From b42f2e8e9685d0e2ff1d687fee16d6f681e6cf13 Mon Sep 17 00:00:00 2001 From: Andrea Amorese Date: Tue, 24 Aug 2021 17:18:08 +0200 Subject: [PATCH] Built motion from commit 85951d68.|2.5.33 --- 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 +- 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/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 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.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.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/realtime/realtime.model.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 +- 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/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 +- 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/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/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.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/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/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/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.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/action.js | 2 +- server/services/ami/dialer/additionalPhone.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.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/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/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/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/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 +- 1166 files changed, 1166 insertions(+), 1166 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 370dce9..26ac1c8 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-24T14:51:08.195Z", + "time": "2021-08-24T15:12:00.018Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index d3be097..ebb7023 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-24T14:51:08.195Z", + "time": "2021-08-24T15:12:00.018Z", "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 57bf141..2704a5f 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 _0x560b=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','integration','motionbar','jscripty','browser','bot'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x560b,0xc1));var _0xb560=function(_0x507cdf,_0x557a41){_0x507cdf=_0x507cdf-0x0;var _0x9599f5=_0x560b[_0x507cdf];return _0x9599f5;};'use strict';var Sequelize=require(_0xb560('0x0'));module[_0xb560('0x1')]={'name':{'type':Sequelize[_0xb560('0x2')],'get':function(_0x2d457c){return this[_0xb560('0x3')](_0xb560('0x4'));}},'action':{'type':Sequelize[_0xb560('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xb560('0x6'),_0xb560('0x7'),_0xb560('0x8'),'urlForward',_0xb560('0x9'),_0xb560('0xa'),_0xb560('0xb')]],'msg':_0xb560('0xc')}},'comment':_0xb560('0xc')},'data1':{'type':Sequelize[_0xb560('0x5')](0x1000),'comment':_0xb560('0xd')},'data2':{'type':Sequelize[_0xb560('0x5')](0x1000),'comment':_0xb560('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xb560('0xf')},'data4':{'type':Sequelize[_0xb560('0x5')](0x1000)},'data5':{'type':Sequelize[_0xb560('0x5')](0x1000)},'data6':{'type':Sequelize[_0xb560('0x5')]},'data7':{'type':Sequelize[_0xb560('0x10')]}}; \ No newline at end of file +var _0xf3ff=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','urlForward'];(function(_0x520401,_0x6a3ccc){var _0x250325=function(_0x53f3c3){while(--_0x53f3c3){_0x520401['push'](_0x520401['shift']());}};_0x250325(++_0x6a3ccc);}(_0xf3ff,0x104));var _0xff3f=function(_0x202a07,_0x3b0cec){_0x202a07=_0x202a07-0x0;var _0x4c966f=_0xf3ff[_0x202a07];return _0x4c966f;};'use strict';var Sequelize=require(_0xff3f('0x0'));module[_0xff3f('0x1')]={'name':{'type':Sequelize[_0xff3f('0x2')],'get':function(_0x40c978){return this[_0xff3f('0x3')](_0xff3f('0x4'));}},'action':{'type':Sequelize[_0xff3f('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xff3f('0x6'),_0xff3f('0x7'),_0xff3f('0x8'),'jscripty',_0xff3f('0x9'),'browser','bot','script']],'msg':_0xff3f('0xa')}},'comment':_0xff3f('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xff3f('0xb')},'data2':{'type':Sequelize[_0xff3f('0x5')](0x1000),'comment':_0xff3f('0xc')},'data3':{'type':Sequelize[_0xff3f('0x5')](0x1000),'comment':_0xff3f('0xd')},'data4':{'type':Sequelize[_0xff3f('0x5')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xff3f('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a5094bc..00c466e 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 _0xd4de=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','body','Action','params','catch','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0xd4de,0xdc));var _0xed4d=function(_0x9aa5ea,_0x91a637){_0x9aa5ea=_0x9aa5ea-0x0;var _0x53611a=_0xd4de[_0x9aa5ea];return _0x53611a;};'use strict';var emlformat=require(_0xed4d('0x0'));var rimraf=require(_0xed4d('0x1'));var zipdir=require(_0xed4d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed4d('0x3'));var moment=require('moment');var BPromise=require(_0xed4d('0x4'));var Mustache=require(_0xed4d('0x5'));var util=require(_0xed4d('0x6'));var path=require('path');var sox=require(_0xed4d('0x7'));var csv=require(_0xed4d('0x8'));var ejs=require(_0xed4d('0x9'));var fs=require('fs');var fs_extra=require(_0xed4d('0xa'));var _=require('lodash');var squel=require(_0xed4d('0xb'));var crypto=require(_0xed4d('0xc'));var jsforce=require(_0xed4d('0xd'));var deskjs=require(_0xed4d('0xe'));var toCsv=require(_0xed4d('0x8'));var querystring=require(_0xed4d('0xf'));var Papa=require(_0xed4d('0x10'));var Redis=require('ioredis');var authService=require(_0xed4d('0x11'));var qs=require(_0xed4d('0x12'));var as=require(_0xed4d('0x13'));var hardwareService=require(_0xed4d('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xed4d('0x15'));var config=require(_0xed4d('0x16'));var licenseUtil=require(_0xed4d('0x17'));var db=require(_0xed4d('0x18'))['db'];function respondWithStatusCode(_0x2d660d,_0x475ab2){_0x475ab2=_0x475ab2||0xcc;return function(_0x56b8d3){if(_0x56b8d3){return _0x2d660d[_0xed4d('0x19')](_0x475ab2);}return _0x2d660d['status'](_0x475ab2)[_0xed4d('0x1a')]();};}function respondWithResult(_0x2fb3d9,_0x272e91){_0x272e91=_0x272e91||0xc8;return function(_0x4f019f){if(_0x4f019f){return _0x2fb3d9[_0xed4d('0x1b')](_0x272e91)[_0xed4d('0x1c')](_0x4f019f);}};}function respondWithFilteredResult(_0x276b68,_0x2f35b5){return function(_0xd28e6d){if(_0xd28e6d){var _0x440454=typeof _0x2f35b5[_0xed4d('0x1d')]===_0xed4d('0x1e')&&typeof _0x2f35b5[_0xed4d('0x1f')]==='undefined';var _0x3b9a40=_0xd28e6d[_0xed4d('0x20')];var _0x3d38ff=_0x440454?0x0:_0x2f35b5['offset'];var _0x3d30d5=_0x440454?_0xd28e6d[_0xed4d('0x20')]:_0x2f35b5[_0xed4d('0x1d')]+_0x2f35b5[_0xed4d('0x1f')];var _0x54563f;if(_0x3d30d5>=_0x3b9a40){_0x3d30d5=_0x3b9a40;_0x54563f=0xc8;}else{_0x54563f=0xce;}_0x276b68[_0xed4d('0x1b')](_0x54563f);return _0x276b68[_0xed4d('0x21')]('Content-Range',_0x3d38ff+'-'+_0x3d30d5+'/'+_0x3b9a40)[_0xed4d('0x1c')](_0xd28e6d);}return null;};}function patchUpdates(_0x198eb7){return function(_0x308b59){try{jsonpatch[_0xed4d('0x22')](_0x308b59,_0x198eb7,!![]);}catch(_0x3610eb){return BPromise['reject'](_0x3610eb);}return _0x308b59[_0xed4d('0x23')]();};}function saveUpdates(_0x3dc478,_0x2e07f6){return function(_0x1564f7){if(_0x1564f7){return _0x1564f7[_0xed4d('0x24')](_0x3dc478)[_0xed4d('0x25')](function(_0x5e27c9){return _0x5e27c9;});}return null;};}function removeEntity(_0x22a14f,_0x16042a){return function(_0x1282b9){if(_0x1282b9){return _0x1282b9[_0xed4d('0x26')]()[_0xed4d('0x25')](function(){_0x22a14f[_0xed4d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28f5a9,_0x3ccfcc){return function(_0xfce9cd){if(!_0xfce9cd){_0x28f5a9[_0xed4d('0x19')](0x194);}return _0xfce9cd;};}function handleError(_0x2fdaf6,_0x546023){_0x546023=_0x546023||0x1f4;return function(_0x289823){logger[_0xed4d('0x27')](_0x289823['stack']);if(_0x289823[_0xed4d('0x28')]){delete _0x289823['name'];}_0x2fdaf6[_0xed4d('0x1b')](_0x546023)['send'](_0x289823);};}exports[_0xed4d('0x24')]=function(_0x2616ef,_0x19c35e){if(_0x2616ef[_0xed4d('0x29')]['id']){delete _0x2616ef['body']['id'];}return db[_0xed4d('0x2a')]['find']({'where':{'id':_0x2616ef[_0xed4d('0x2b')]['id']}})['then'](handleEntityNotFound(_0x19c35e,null))[_0xed4d('0x25')](saveUpdates(_0x2616ef[_0xed4d('0x29')],null))[_0xed4d('0x25')](respondWithResult(_0x19c35e,null))[_0xed4d('0x2c')](handleError(_0x19c35e,null));};exports[_0xed4d('0x26')]=function(_0x14b6ab,_0x4d9aad){return db[_0xed4d('0x2a')]['find']({'where':{'id':_0x14b6ab[_0xed4d('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4d9aad,null))[_0xed4d('0x25')](removeEntity(_0x4d9aad,null))[_0xed4d('0x2c')](handleError(_0x4d9aad,null));}; \ No newline at end of file +var _0xbdde=['find','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','body','params','catch','Action'];(function(_0x94b169,_0x5df9e5){var _0x14434c=function(_0x46593c){while(--_0x46593c){_0x94b169['push'](_0x94b169['shift']());}};_0x14434c(++_0x5df9e5);}(_0xbdde,0x12e));var _0xebdd=function(_0x250453,_0x2a0799){_0x250453=_0x250453-0x0;var _0x471c1a=_0xbdde[_0x250453];return _0x471c1a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xebdd('0x0'));var moment=require('moment');var BPromise=require(_0xebdd('0x1'));var Mustache=require(_0xebdd('0x2'));var util=require(_0xebdd('0x3'));var path=require('path');var sox=require(_0xebdd('0x4'));var csv=require(_0xebdd('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xebdd('0x6'));var _=require(_0xebdd('0x7'));var squel=require(_0xebdd('0x8'));var crypto=require(_0xebdd('0x9'));var jsforce=require(_0xebdd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xebdd('0x5'));var querystring=require(_0xebdd('0xb'));var Papa=require(_0xebdd('0xc'));var Redis=require(_0xebdd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xebdd('0xe'));var as=require(_0xebdd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebdd('0x10'))(_0xebdd('0x11'));var utils=require(_0xebdd('0x12'));var config=require(_0xebdd('0x13'));var licenseUtil=require(_0xebdd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7e35ac,_0x1f566a){_0x1f566a=_0x1f566a||0xcc;return function(_0x39050c){if(_0x39050c){return _0x7e35ac['sendStatus'](_0x1f566a);}return _0x7e35ac[_0xebdd('0x15')](_0x1f566a)['end']();};}function respondWithResult(_0x1dbe68,_0xf3d997){_0xf3d997=_0xf3d997||0xc8;return function(_0x57e83d){if(_0x57e83d){return _0x1dbe68['status'](_0xf3d997)['json'](_0x57e83d);}};}function respondWithFilteredResult(_0x1bc740,_0x611915){return function(_0x18640e){if(_0x18640e){var _0x747cb5=typeof _0x611915[_0xebdd('0x16')]==='undefined'&&typeof _0x611915['limit']===_0xebdd('0x17');var _0x37b220=_0x18640e['count'];var _0x438e27=_0x747cb5?0x0:_0x611915[_0xebdd('0x16')];var _0x49d72e=_0x747cb5?_0x18640e[_0xebdd('0x18')]:_0x611915[_0xebdd('0x16')]+_0x611915[_0xebdd('0x19')];var _0x42d3be;if(_0x49d72e>=_0x37b220){_0x49d72e=_0x37b220;_0x42d3be=0xc8;}else{_0x42d3be=0xce;}_0x1bc740[_0xebdd('0x15')](_0x42d3be);return _0x1bc740['set']('Content-Range',_0x438e27+'-'+_0x49d72e+'/'+_0x37b220)[_0xebdd('0x1a')](_0x18640e);}return null;};}function patchUpdates(_0x312e5c){return function(_0x49339a){try{jsonpatch[_0xebdd('0x1b')](_0x49339a,_0x312e5c,!![]);}catch(_0x1875b1){return BPromise[_0xebdd('0x1c')](_0x1875b1);}return _0x49339a[_0xebdd('0x1d')]();};}function saveUpdates(_0x32ca78,_0x295d51){return function(_0x1b9452){if(_0x1b9452){return _0x1b9452[_0xebdd('0x1e')](_0x32ca78)[_0xebdd('0x1f')](function(_0x1febc2){return _0x1febc2;});}return null;};}function removeEntity(_0x2eb6a0,_0x4ac289){return function(_0x855255){if(_0x855255){return _0x855255[_0xebdd('0x20')]()[_0xebdd('0x1f')](function(){_0x2eb6a0['status'](0xcc)[_0xebdd('0x21')]();});}};}function handleEntityNotFound(_0x33d18c,_0xb3fbc4){return function(_0x50d3ee){if(!_0x50d3ee){_0x33d18c[_0xebdd('0x22')](0x194);}return _0x50d3ee;};}function handleError(_0x203fc7,_0x26045f){_0x26045f=_0x26045f||0x1f4;return function(_0x32c075){logger[_0xebdd('0x23')](_0x32c075['stack']);if(_0x32c075[_0xebdd('0x24')]){delete _0x32c075['name'];}_0x203fc7[_0xebdd('0x15')](_0x26045f)[_0xebdd('0x25')](_0x32c075);};}exports[_0xebdd('0x1e')]=function(_0x5f4b63,_0x50cd4a){if(_0x5f4b63[_0xebdd('0x26')]['id']){delete _0x5f4b63['body']['id'];}return db['Action']['find']({'where':{'id':_0x5f4b63[_0xebdd('0x27')]['id']}})[_0xebdd('0x1f')](handleEntityNotFound(_0x50cd4a,null))[_0xebdd('0x1f')](saveUpdates(_0x5f4b63[_0xebdd('0x26')],null))[_0xebdd('0x1f')](respondWithResult(_0x50cd4a,null))[_0xebdd('0x28')](handleError(_0x50cd4a,null));};exports['destroy']=function(_0x5c4757,_0x52849b){return db[_0xebdd('0x29')][_0xebdd('0x2a')]({'where':{'id':_0x5c4757['params']['id']}})[_0xebdd('0x1f')](handleEntityNotFound(_0x52849b,null))[_0xebdd('0x1f')](removeEntity(_0x52849b,null))['catch'](handleError(_0x52849b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 13617d1..3b47045 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 _0x46c5=['Action','tools_actions','util','../../config/logger','api','moment','bluebird','request-promise','./action.attributes','define'];(function(_0x455582,_0xe40e92){var _0x4048ff=function(_0x55f96b){while(--_0x55f96b){_0x455582['push'](_0x455582['shift']());}};_0x4048ff(++_0xe40e92);}(_0x46c5,0x14c));var _0x546c=function(_0xf9d990,_0xf0c532){_0xf9d990=_0xf9d990-0x0;var _0x1405a9=_0x46c5[_0xf9d990];return _0x1405a9;};'use strict';var _=require('lodash');var util=require(_0x546c('0x0'));var logger=require(_0x546c('0x1'))(_0x546c('0x2'));var moment=require(_0x546c('0x3'));var BPromise=require(_0x546c('0x4'));var rp=require(_0x546c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x546c('0x6'));module['exports']=function(_0xfd48b1,_0x31f34f){return _0xfd48b1[_0x546c('0x7')](_0x546c('0x8'),attributes,{'tableName':_0x546c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29b1=['rimraf','../../config/environment','./action.attributes','exports','Action','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3f5c46,_0x1cb7c4){var _0x2ce2fc=function(_0x96dff3){while(--_0x96dff3){_0x3f5c46['push'](_0x3f5c46['shift']());}};_0x2ce2fc(++_0x1cb7c4);}(_0x29b1,0x16d));var _0x129b=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x29b1[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x129b('0x0'));var util=require(_0x129b('0x1'));var logger=require(_0x129b('0x2'))(_0x129b('0x3'));var moment=require(_0x129b('0x4'));var BPromise=require('bluebird');var rp=require(_0x129b('0x5'));var fs=require('fs');var path=require(_0x129b('0x6'));var rimraf=require(_0x129b('0x7'));var config=require(_0x129b('0x8'));var attributes=require(_0x129b('0x9'));module[_0x129b('0xa')]=function(_0x31e428,_0xe27ed4){return _0x31e428['define'](_0x129b('0xb'),attributes,{'tableName':'tools_actions','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 4c9f6f7..287729d 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 _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x97cdf0,_0x561627){var _0x345fc5=function(_0x4147ee){while(--_0x4147ee){_0x97cdf0['push'](_0x97cdf0['shift']());}};_0x345fc5(++_0x561627);}(_0x326f,0xd1));var _0xf326=function(_0x394242,_0x3ec2d3){_0x394242=_0x394242-0x0;var _0x6f32b=_0x326f[_0x394242];return _0x6f32b;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2b65b3,_0x1cbb98){var _0xf7b6ff=function(_0x526859){while(--_0x526859){_0x2b65b3['push'](_0x2b65b3['shift']());}};_0xf7b6ff(++_0x1cbb98);}(_0x1261,0x144));var _0x1126=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x1261[_0x117f4c];return _0x2b24e9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f341bda..6ee8581 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 _0x901a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x901a,0xbe));var _0xa901=function(_0x367314,_0x47a010){_0x367314=_0x367314-0x0;var _0x2fb6ab=_0x901a[_0x367314];return _0x2fb6ab;};'use strict';var multer=require(_0xa901('0x0'));var util=require(_0xa901('0x1'));var path=require('path');var timeout=require(_0xa901('0x2'));var express=require(_0xa901('0x3'));var router=express[_0xa901('0x4')]();var fs_extra=require(_0xa901('0x5'));var auth=require(_0xa901('0x6'));var interaction=require(_0xa901('0x7'));var config=require(_0xa901('0x8'));var controller=require(_0xa901('0x9'));router['put']('/:id',auth['isAuthenticated'](),controller[_0xa901('0xa')]);router[_0xa901('0xb')](_0xa901('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa901('0xd')]=router; \ No newline at end of file +var _0xb23d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','exports','multer','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb23d,0x184));var _0xdb23=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0xb23d[_0xf5d71c];return _0x5af672;};'use strict';var multer=require(_0xdb23('0x0'));var util=require('util');var path=require(_0xdb23('0x1'));var timeout=require(_0xdb23('0x2'));var express=require(_0xdb23('0x3'));var router=express[_0xdb23('0x4')]();var fs_extra=require(_0xdb23('0x5'));var auth=require(_0xdb23('0x6'));var interaction=require(_0xdb23('0x7'));var config=require('../../config/environment');var controller=require(_0xdb23('0x8'));router[_0xdb23('0x9')](_0xdb23('0xa'),auth[_0xdb23('0xb')](),controller[_0xdb23('0xc')]);router[_0xdb23('0xd')](_0xdb23('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xdb23('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 92d0f12..9a2753d 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x243aca,_0x272cb3){var _0x4a586d=function(_0x388d8b){while(--_0x388d8b){_0x243aca['push'](_0x243aca['shift']());}};_0x4a586d(++_0x272cb3);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4d98ab,_0x2e35cc){_0x4d98ab=_0x4d98ab-0x0;var _0x3d582e=_0xb4c7[_0x4d98ab];return _0x3d582e;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d2e246d..5921266 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 _0x472f=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','error','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','create','user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','preview','join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','from','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','DATE(%s)','IS\x20NOT\x20NULL','keyBy','clone','output','web','fullPath','%s-%s.%s','randomstring','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','UNIX_TIMESTAMP(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x472f,0x1e5));var _0xf472=function(_0x3a20c1,_0x3737a3){_0x3a20c1=_0x3a20c1-0x0;var _0x55867f=_0x472f[_0x3a20c1];return _0x55867f;};'use strict';var emlformat=require(_0xf472('0x0'));var rimraf=require(_0xf472('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf472('0x2'));var rp=require(_0xf472('0x3'));var moment=require(_0xf472('0x4'));var BPromise=require(_0xf472('0x5'));var Mustache=require('mustache');var util=require(_0xf472('0x6'));var path=require('path');var sox=require(_0xf472('0x7'));var csv=require(_0xf472('0x8'));var ejs=require(_0xf472('0x9'));var fs=require('fs');var fs_extra=require(_0xf472('0xa'));var _=require(_0xf472('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf472('0xc'));var deskjs=require(_0xf472('0xd'));var toCsv=require(_0xf472('0x8'));var querystring=require(_0xf472('0xe'));var Papa=require(_0xf472('0xf'));var Redis=require(_0xf472('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf472('0x11'));var as=require(_0xf472('0x12'));var hardwareService=require(_0xf472('0x13'));var logger=require(_0xf472('0x14'))(_0xf472('0x15'));var utils=require(_0xf472('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf472('0x17'));var db=require(_0xf472('0x18'))['db'];var dbH=require('../../mysqldb')[_0xf472('0x19')];function respondWithStatusCode(_0x17eaf0,_0x4cea57){_0x4cea57=_0x4cea57||0xcc;return function(_0x1f22a2){if(_0x1f22a2){return _0x17eaf0[_0xf472('0x1a')](_0x4cea57);}return _0x17eaf0[_0xf472('0x1b')](_0x4cea57)['end']();};}function respondWithResult(_0x208020,_0x5d81a6){_0x5d81a6=_0x5d81a6||0xc8;return function(_0x35d46e){if(_0x35d46e){return _0x208020[_0xf472('0x1b')](_0x5d81a6)[_0xf472('0x1c')](_0x35d46e);}};}function respondWithFilteredResult(_0x3538a8,_0x54b283){return function(_0x39390d){if(_0x39390d){var _0x19a59d=typeof _0x54b283[_0xf472('0x1d')]===_0xf472('0x1e')&&typeof _0x54b283[_0xf472('0x1f')]==='undefined';var _0x347f08=_0x39390d['count'];var _0x193a79=_0x19a59d?0x0:_0x54b283[_0xf472('0x1d')];var _0x15c321=_0x19a59d?_0x39390d['count']:_0x54b283[_0xf472('0x1d')]+_0x54b283['limit'];var _0x549d77;if(_0x15c321>=_0x347f08){_0x15c321=_0x347f08;_0x549d77=0xc8;}else{_0x549d77=0xce;}_0x3538a8['status'](_0x549d77);return _0x3538a8[_0xf472('0x20')](_0xf472('0x21'),_0x193a79+'-'+_0x15c321+'/'+_0x347f08)[_0xf472('0x1c')](_0x39390d);}return null;};}function patchUpdates(_0x5cc20e){return function(_0xa77e6c){try{jsonpatch['apply'](_0xa77e6c,_0x5cc20e,!![]);}catch(_0x4643d7){return BPromise[_0xf472('0x22')](_0x4643d7);}return _0xa77e6c[_0xf472('0x23')]();};}function saveUpdates(_0x6c7707,_0x3d8438){return function(_0x1847b7){if(_0x1847b7){return _0x1847b7[_0xf472('0x24')](_0x6c7707)[_0xf472('0x25')](function(_0x3feb06){return _0x3feb06;});}return null;};}function removeEntity(_0x9a24fd,_0x1c3ba8){return function(_0x487e74){if(_0x487e74){return _0x487e74[_0xf472('0x26')]()['then'](function(){var _0x5ce6ad=_0x487e74[_0xf472('0x27')]({'plain':!![]});var _0x19aedd=_0xf472('0x28');return db[_0xf472('0x29')][_0xf472('0x26')]({'where':{'type':_0x19aedd,'resourceId':_0x5ce6ad['id']}})[_0xf472('0x25')](function(){return _0x487e74;});})[_0xf472('0x25')](function(){_0x9a24fd[_0xf472('0x1b')](0xcc)[_0xf472('0x2a')]();});}};}function handleEntityNotFound(_0xade9a9,_0x438e0b){return function(_0x107379){if(!_0x107379){_0xade9a9[_0xf472('0x1a')](0x194);}return _0x107379;};}function handleError(_0xb3c96c,_0x59f7d4){_0x59f7d4=_0x59f7d4||0x1f4;return function(_0x2f2e2a){logger[_0xf472('0x2b')](_0x2f2e2a['stack']);if(_0x2f2e2a[_0xf472('0x2c')]){delete _0x2f2e2a[_0xf472('0x2c')];}_0xb3c96c[_0xf472('0x1b')](_0x59f7d4)['send'](_0x2f2e2a);};}exports[_0xf472('0x2d')]=function(_0xedb45e,_0x9e230c){var _0x339b04={},_0x3e8ca7={},_0x303e99={'count':0x0,'rows':[]};var _0x4be12a=_[_0xf472('0x2e')](db[_0xf472('0x2f')][_0xf472('0x30')],function(_0x2714c2){return{'name':_0x2714c2[_0xf472('0x31')],'type':_0x2714c2[_0xf472('0x32')][_0xf472('0x33')]};});_0x3e8ca7[_0xf472('0x34')]=_[_0xf472('0x2e')](_0x4be12a,_0xf472('0x2c'));_0x3e8ca7['query']=_[_0xf472('0x35')](_0xedb45e[_0xf472('0x36')]);_0x3e8ca7['filters']=_[_0xf472('0x37')](_0x3e8ca7['model'],_0x3e8ca7['query']);_0x339b04[_0xf472('0x38')]=_['intersection'](_0x3e8ca7[_0xf472('0x34')],qs['fields'](_0xedb45e['query'][_0xf472('0x39')]));_0x339b04[_0xf472('0x38')]=_0x339b04[_0xf472('0x38')][_0xf472('0x3a')]?_0x339b04[_0xf472('0x38')]:_0x3e8ca7[_0xf472('0x34')];if(!_0xedb45e[_0xf472('0x36')]['hasOwnProperty'](_0xf472('0x3b'))){_0x339b04[_0xf472('0x1f')]=qs['limit'](_0xedb45e[_0xf472('0x36')][_0xf472('0x1f')]);_0x339b04['offset']=qs[_0xf472('0x1d')](_0xedb45e[_0xf472('0x36')]['offset']);}_0x339b04['order']=qs[_0xf472('0x3c')](_0xedb45e[_0xf472('0x36')][_0xf472('0x3c')]);_0x339b04[_0xf472('0x3d')]=qs['filters'](_[_0xf472('0x3e')](_0xedb45e['query'],_0x3e8ca7[_0xf472('0x3f')]),_0x4be12a);if(_0xedb45e[_0xf472('0x36')][_0xf472('0x40')]){_0x339b04[_0xf472('0x3d')]=_['merge'](_0x339b04['where'],{'$or':_[_0xf472('0x2e')](_0x4be12a,function(_0x134c43){if(_0x134c43[_0xf472('0x32')]!==_0xf472('0x41')){var _0x298f90={};_0x298f90[_0x134c43[_0xf472('0x2c')]]={'$like':'%'+_0xedb45e[_0xf472('0x36')][_0xf472('0x40')]+'%'};return _0x298f90;}})});}_0x339b04=_[_0xf472('0x42')]({},_0x339b04,_0xedb45e[_0xf472('0x43')]);var _0x117b0d={'where':_0x339b04['where']};return db['AnalyticCustomReport'][_0xf472('0x44')](_0x117b0d)['then'](function(_0x297d05){_0x303e99[_0xf472('0x44')]=_0x297d05;if(_0xedb45e[_0xf472('0x36')][_0xf472('0x45')]){_0x339b04[_0xf472('0x46')]=[{'all':!![]}];}return db[_0xf472('0x2f')]['findAll'](_0x339b04);})[_0xf472('0x25')](function(_0x3d055c){_0x303e99[_0xf472('0x47')]=_0x3d055c;return _0x303e99;})[_0xf472('0x25')](respondWithFilteredResult(_0x9e230c,_0x339b04))[_0xf472('0x48')](handleError(_0x9e230c,null));};exports[_0xf472('0x49')]=function(_0x5e8eb4,_0x4514f2){var _0x3aabb8={'raw':![],'where':{'id':_0x5e8eb4[_0xf472('0x4a')]['id']}},_0x121ba7={};_0x121ba7['model']=_[_0xf472('0x35')](db[_0xf472('0x2f')]['rawAttributes']);_0x121ba7[_0xf472('0x36')]=_[_0xf472('0x35')](_0x5e8eb4['query']);_0x121ba7['filters']=_[_0xf472('0x37')](_0x121ba7[_0xf472('0x34')],_0x121ba7[_0xf472('0x36')]);_0x3aabb8[_0xf472('0x38')]=_[_0xf472('0x37')](_0x121ba7[_0xf472('0x34')],qs[_0xf472('0x39')](_0x5e8eb4[_0xf472('0x36')]['fields']));_0x3aabb8['attributes']=_0x3aabb8[_0xf472('0x38')][_0xf472('0x3a')]?_0x3aabb8[_0xf472('0x38')]:_0x121ba7[_0xf472('0x34')];if(_0x5e8eb4[_0xf472('0x36')][_0xf472('0x45')]){_0x3aabb8['include']=[{'all':!![]}];}_0x3aabb8=_['merge']({},_0x3aabb8,_0x5e8eb4['options']);return db[_0xf472('0x2f')]['find'](_0x3aabb8)[_0xf472('0x25')](handleEntityNotFound(_0x4514f2,null))['then'](respondWithResult(_0x4514f2,null))[_0xf472('0x48')](handleError(_0x4514f2,null));};exports[_0xf472('0x4b')]=function(_0x103d0a,_0x47973d){return db['AnalyticCustomReport'][_0xf472('0x4b')](_0x103d0a['body'],{})[_0xf472('0x25')](function(_0x5ab23c){var _0x191e42=_0x103d0a[_0xf472('0x4c')][_0xf472('0x27')]({'plain':!![]});if(!_0x191e42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x191e42[_0xf472('0x4d')]===_0xf472('0x4c')){var _0x57bc18=_0x5ab23c[_0xf472('0x27')]({'plain':!![]});var _0x109daf=_0xf472('0x4e');return db[_0xf472('0x4f')]['find']({'where':{'name':_0x109daf,'userProfileId':_0x191e42[_0xf472('0x50')]},'raw':!![]})[_0xf472('0x25')](function(_0x210f87){if(_0x210f87&&_0x210f87['autoAssociation']===0x0){return db[_0xf472('0x29')][_0xf472('0x4b')]({'name':_0x57bc18[_0xf472('0x2c')],'resourceId':_0x57bc18['id'],'type':'CustomReports','sectionId':_0x210f87['id']},{})[_0xf472('0x25')](function(){return _0x5ab23c;});}else{return _0x5ab23c;}})['catch'](function(_0xd99a7e){logger[_0xf472('0x2b')](_0xf472('0x51'),_0xd99a7e);throw _0xd99a7e;});}return _0x5ab23c;})['then'](respondWithResult(_0x47973d,0xc9))[_0xf472('0x48')](handleError(_0x47973d,null));};exports[_0xf472('0x24')]=function(_0x1f66f8,_0x4e7a30){if(_0x1f66f8['body']['id']){delete _0x1f66f8[_0xf472('0x52')]['id'];}return db[_0xf472('0x2f')]['find']({'where':{'id':_0x1f66f8[_0xf472('0x4a')]['id']}})[_0xf472('0x25')](handleEntityNotFound(_0x4e7a30,null))[_0xf472('0x25')](saveUpdates(_0x1f66f8[_0xf472('0x52')],null))[_0xf472('0x25')](respondWithResult(_0x4e7a30,null))[_0xf472('0x48')](handleError(_0x4e7a30,null));};exports['destroy']=function(_0x1a4485,_0x5e2fd2){return db[_0xf472('0x2f')][_0xf472('0x53')]({'where':{'id':_0x1a4485[_0xf472('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5e2fd2,null))['then'](removeEntity(_0x5e2fd2,null))[_0xf472('0x48')](handleError(_0x5e2fd2,null));};exports[_0xf472('0x54')]=function(_0x149a04,_0x5f302a){var _0x1b5317=0xa;var _0x5e4fb5=[_0xf472('0x55'),'left_join','right_join','cross_join'];var _0x2010e5={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf472('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf472('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3bf6e1={'SEC_TO_TIME':_0xf472('0x58'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xf472('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x47a3e6=function(_0x2e5557){return!_[_0xf472('0x5a')]([_0xf472('0x5b'),'IS\x20NOT\x20NULL',_0xf472('0x5c'),_0xf472('0x5d')],_0x2e5557);};var _0x5d4a0d=function(_0x41882f){if(!_0x41882f||!_0x41882f[_0xf472('0x5e')][_0xf472('0x3a')]){return'';}for(var _0x3c6045='(',_0x4cfde9=0x0;_0x4cfde9<_0x41882f[_0xf472('0x5e')][_0xf472('0x3a')];_0x4cfde9+=0x1){_0x4cfde9>0x0&&(_0x3c6045+='\x20'+_0x41882f[_0xf472('0x5f')]+'\x20');_0x3c6045+=_0x41882f['rules'][_0x4cfde9][_0xf472('0x60')]?_0x5d4a0d(_0x41882f[_0xf472('0x5e')][_0x4cfde9][_0xf472('0x60')]):_0x41882f[_0xf472('0x5e')][_0x4cfde9]['field']+'\x20'+_0x41882f[_0xf472('0x5e')][_0x4cfde9][_0xf472('0x61')]+(_0x47a3e6(_0x41882f[_0xf472('0x5e')][_0x4cfde9]['condition'])?'\x20'+_0x41882f[_0xf472('0x5e')][_0x4cfde9][_0xf472('0x62')]:'');}return _0x3c6045+')';};var _0x37c7d6={'where':{'id':_0x149a04[_0xf472('0x4a')]['id']}},_0x735d58,_0x494395,_0x583ca2,_0x5b0de6,_0x47d163;_0x37c7d6=_[_0xf472('0x42')]({},_0x37c7d6,_0x149a04[_0xf472('0x43')]);return db['AnalyticCustomReport']['find'](_0x37c7d6)['then'](function(_0x263cd8){if(_0x263cd8){_0x735d58=_0x263cd8;return _0x263cd8[_0xf472('0x63')]();}return null;})['then'](function(_0x1ff313){if(_0x1ff313){if(!_0x1ff313[_0xf472('0x3a')]){throw new db[(_0xf472('0x64'))][(_0xf472('0x65'))](_0xf472('0x66'),0x193);}_0x494395=_0x1ff313;return db[_0xf472('0x67')][_0xf472('0x68')]({'raw':!![]});}return null;})[_0xf472('0x25')](function(_0x3fc25a){if(_0x3fc25a){_0x583ca2=_['keyBy'](_0x3fc25a,'id');var _0x46a2ae;var _0x19641d=squel[_0xf472('0x69')]();_0x19641d[_0xf472('0x6a')](_0x735d58[_0xf472('0x6b')]);for(var _0x1936c3=0x0;_0x1936c3<_0x494395[_0xf472('0x3a')];_0x1936c3+=0x1){_0x46a2ae=_0x494395[_0x1936c3][_0xf472('0x6c')]?_0x583ca2[_0x494395[_0x1936c3][_0xf472('0x6c')]][_0xf472('0x6d')]:_0x494395[_0x1936c3][_0xf472('0x6e')];_0x46a2ae=_0x494395[_0x1936c3][_0xf472('0x6f')]?_[_0xf472('0x70')](_0x2010e5[_0x494395[_0x1936c3][_0xf472('0x6f')]],'%s',_0x46a2ae):_0x46a2ae;_0x46a2ae=_0x494395[_0x1936c3][_0xf472('0x71')]?_[_0xf472('0x70')](_0x3bf6e1[_0x494395[_0x1936c3][_0xf472('0x71')]],'%s',_0x46a2ae):_0x46a2ae;if(_0x494395[_0x1936c3][_0xf472('0x72')]){_0x19641d[_0xf472('0x60')](_0x46a2ae);}_0x494395[_0x1936c3]['orderBy']&&_0x19641d[_0xf472('0x73')](_0x46a2ae,_0x494395[_0x1936c3][_0xf472('0x74')]===_0xf472('0x75')?![]:!![]);_0x19641d['field'](_0x46a2ae,_0x494395[_0x1936c3][_0xf472('0x76')]||_0x46a2ae);}if(_0x735d58['joins']){_0x735d58[_0xf472('0x77')]=JSON[_0xf472('0x78')](_0x735d58[_0xf472('0x77')]);for(var _0x56e363=0x0;_0x56e363<_0x735d58['joins'][_0xf472('0x3a')];_0x56e363+=0x1){if(_0x735d58[_0xf472('0x77')][_0x56e363][_0xf472('0x32')]&&_[_0xf472('0x5a')](_0x5e4fb5,_0x735d58[_0xf472('0x77')][_0x56e363][_0xf472('0x32')])&&_0x735d58['joins'][_0x56e363]['parentKey']&&_0x735d58['joins'][_0x56e363][_0xf472('0x79')]&&_0x735d58[_0xf472('0x77')][_0x56e363][_0xf472('0x7a')]){_0x19641d[_0x735d58[_0xf472('0x77')][_0x56e363][_0xf472('0x32')]](_0x735d58[_0xf472('0x77')][_0x56e363][_0xf472('0x79')],null,util[_0xf472('0x71')](_0xf472('0x7b'),_0x735d58[_0xf472('0x6b')],_0x735d58[_0xf472('0x77')][_0x56e363][_0xf472('0x7c')],_0x735d58[_0xf472('0x77')][_0x56e363][_0xf472('0x79')],_0x735d58[_0xf472('0x77')][_0x56e363]['foreignKey']));}}}if(_0x735d58[_0xf472('0x7d')]){_0x735d58[_0xf472('0x7d')]=JSON[_0xf472('0x78')](_0x735d58[_0xf472('0x7d')]);_0x19641d['where'](_0x5d4a0d(_0x735d58[_0xf472('0x7d')][_0xf472('0x60')]));}_0x47d163=_0x19641d['clone']();_0x19641d['limit'](_0x1b5317);_0x19641d['offset'](0x0);logger[_0xf472('0x7e')](_0xf472('0x7f'),_0x19641d[_0xf472('0x80')]());return dbH[_0xf472('0x81')][_0xf472('0x36')](_0x19641d[_0xf472('0x80')](),{'type':dbH['sequelize']['QueryTypes'][_0xf472('0x82')]});}})[_0xf472('0x25')](respondWithResult(_0x5f302a,null))[_0xf472('0x48')](handleError(_0x5f302a,null));};function runReport(_0x391bb1,_0x5b4300,_0x2b7c53){var _0x3c2441=_0x5b4300[_0xf472('0x2c')];var _0x1aa07c=0xa;var _0xaabdf5=[_0xf472('0x55'),_0xf472('0x83'),'right_join',_0xf472('0x84')];var _0x86ba19={'SUM':_0xf472('0x85'),'COUNT':_0xf472('0x86'),'COUNT DISTINCT':_0xf472('0x87'),'MAX':_0xf472('0x56'),'MIN':'MIN(%s)','AVG':_0xf472('0x88'),'GROUP_CONCAT':_0xf472('0x89'),'GROUP_CONCAT ASC':_0xf472('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x69913f={'SEC_TO_TIME':_0xf472('0x58'),'DATE':_0xf472('0x8a'),'HOUR':'HOUR(%s)','ROUND':_0xf472('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x24811e=function(_0x18178b){return!_['includes'](['IS\x20NULL',_0xf472('0x8b'),'IS\x20EMPTY',_0xf472('0x5d')],_0x18178b);};var _0x2a0591=function(_0x442295){if(!_0x442295||!_0x442295[_0xf472('0x5e')][_0xf472('0x3a')]){return'';}for(var _0x592d00='(',_0x24694a=0x0;_0x24694a<_0x442295[_0xf472('0x5e')][_0xf472('0x3a')];_0x24694a+=0x1){_0x24694a>0x0&&(_0x592d00+='\x20'+_0x442295[_0xf472('0x5f')]+'\x20');_0x592d00+=_0x442295['rules'][_0x24694a][_0xf472('0x60')]?_0x2a0591(_0x442295[_0xf472('0x5e')][_0x24694a]['group']):_0x442295['rules'][_0x24694a][_0xf472('0x6e')]+'\x20'+_0x442295[_0xf472('0x5e')][_0x24694a][_0xf472('0x61')]+(_0x24811e(_0x442295['rules'][_0x24694a][_0xf472('0x61')])?'\x20'+_0x442295[_0xf472('0x5e')][_0x24694a][_0xf472('0x62')]:'');}return _0x592d00+')';};var _0x47b54f={'where':{'id':_0x391bb1['id']}},_0x26d6ff,_0x1d17e9,_0x478dd2,_0x1a1764,_0x44c943;_0x47b54f=_[_0xf472('0x42')]({},_0x47b54f,_0x2b7c53);return db[_0xf472('0x2f')][_0xf472('0x53')](_0x47b54f)[_0xf472('0x25')](function(_0xb2a789){if(_0xb2a789){_0x26d6ff=_0xb2a789;return _0xb2a789[_0xf472('0x63')]();}return null;})[_0xf472('0x25')](function(_0x361edf){if(_0x361edf){if(!_0x361edf['length']){throw new db['Sequelize'][(_0xf472('0x65'))](_0xf472('0x66'),0x193);}_0x1d17e9=_0x361edf;return db[_0xf472('0x67')][_0xf472('0x68')]({'raw':!![]});}return null;})[_0xf472('0x25')](function(_0x47e7ee){if(_0x47e7ee){_0x478dd2=_[_0xf472('0x8c')](_0x47e7ee,'id');var _0x20f197;var _0x152d06=squel[_0xf472('0x69')]();_0x152d06[_0xf472('0x6a')](_0x26d6ff[_0xf472('0x6b')]);for(var _0x57fbef=0x0;_0x57fbef<_0x1d17e9[_0xf472('0x3a')];_0x57fbef+=0x1){_0x20f197=_0x1d17e9[_0x57fbef][_0xf472('0x6c')]?_0x478dd2[_0x1d17e9[_0x57fbef][_0xf472('0x6c')]][_0xf472('0x6d')]:_0x1d17e9[_0x57fbef][_0xf472('0x6e')];_0x20f197=_0x1d17e9[_0x57fbef][_0xf472('0x6f')]?_[_0xf472('0x70')](_0x86ba19[_0x1d17e9[_0x57fbef]['function']],'%s',_0x20f197):_0x20f197;_0x20f197=_0x1d17e9[_0x57fbef][_0xf472('0x71')]?_[_0xf472('0x70')](_0x69913f[_0x1d17e9[_0x57fbef]['format']],'%s',_0x20f197):_0x20f197;if(_0x1d17e9[_0x57fbef][_0xf472('0x72')]){_0x152d06[_0xf472('0x60')](_0x20f197);}_0x1d17e9[_0x57fbef][_0xf472('0x74')]&&_0x152d06[_0xf472('0x73')](_0x20f197,_0x1d17e9[_0x57fbef][_0xf472('0x74')]===_0xf472('0x75')?![]:!![]);_0x152d06[_0xf472('0x6e')](_0x20f197,_0x1d17e9[_0x57fbef][_0xf472('0x76')]||_0x20f197);}if(_0x26d6ff[_0xf472('0x77')]){_0x26d6ff[_0xf472('0x77')]=JSON[_0xf472('0x78')](_0x26d6ff[_0xf472('0x77')]);for(var _0x58a0ff=0x0;_0x58a0ff<_0x26d6ff[_0xf472('0x77')][_0xf472('0x3a')];_0x58a0ff+=0x1){if(_0x26d6ff[_0xf472('0x77')][_0x58a0ff][_0xf472('0x32')]&&_[_0xf472('0x5a')](_0xaabdf5,_0x26d6ff[_0xf472('0x77')][_0x58a0ff][_0xf472('0x32')])&&_0x26d6ff[_0xf472('0x77')][_0x58a0ff][_0xf472('0x7c')]&&_0x26d6ff[_0xf472('0x77')][_0x58a0ff][_0xf472('0x79')]&&_0x26d6ff[_0xf472('0x77')][_0x58a0ff][_0xf472('0x7a')]){_0x152d06[_0x26d6ff[_0xf472('0x77')][_0x58a0ff]['type']](_0x26d6ff[_0xf472('0x77')][_0x58a0ff][_0xf472('0x79')],null,util[_0xf472('0x71')](_0xf472('0x7b'),_0x26d6ff[_0xf472('0x6b')],_0x26d6ff['joins'][_0x58a0ff][_0xf472('0x7c')],_0x26d6ff[_0xf472('0x77')][_0x58a0ff][_0xf472('0x79')],_0x26d6ff[_0xf472('0x77')][_0x58a0ff]['foreignKey']));}}}if(_0x26d6ff['conditions']){_0x26d6ff[_0xf472('0x7d')]=JSON['parse'](_0x26d6ff['conditions']);_0x152d06[_0xf472('0x3d')](_0x2a0591(_0x26d6ff['conditions'][_0xf472('0x60')]));}_0x44c943=_0x152d06[_0xf472('0x8d')]();_0x152d06[_0xf472('0x1f')](_0x1aa07c);_0x152d06[_0xf472('0x1d')](0x0);return;}})[_0xf472('0x25')](function(){if(_0x5b4300[_0xf472('0x8e')]===_0xf472('0x8f')){return null;}var _0xad5b66=_[_0xf472('0x42')](_0x5b4300,{'name':_0x5b4300[_0xf472('0x90')]||_0x5b4300[_0xf472('0x2c')]||_0x26d6ff[_0xf472('0x2c')],'basename':_0x3c2441,'savename':util[_0xf472('0x71')](_0xf472('0x91'),_0x5b4300[_0xf472('0x2c')]||_0x26d6ff['name'],require(_0xf472('0x92'))['generate'](0x4),_0x5b4300[_0xf472('0x8e')]||'csv'),'reportId':_0x26d6ff['id'],'reportType':_0xf472('0x93')});return db[_0xf472('0x94')][_0xf472('0x4b')](_0xad5b66,{'raw':!![]});})[_0xf472('0x25')](function(_0x685b3c){if(_0x26d6ff['table']===_0xf472('0x95')){_0x44c943['where'](_0x26d6ff['table']+_0xf472('0x96'),_0x5b4300['startDate'],_0x5b4300[_0xf472('0x97')]);}else{_0x44c943[_0xf472('0x3d')](_0x26d6ff[_0xf472('0x6b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b4300[_0xf472('0x98')],_0x5b4300[_0xf472('0x97')]);}if(_0x685b3c){logger[_0xf472('0x99')](_0xf472('0x9a'),_0x44c943[_0xf472('0x80')]());require(_0xf472('0x9b'))['fork'](path[_0xf472('0x55')](__dirname,_0xf472('0x9c'),_0x685b3c[_0xf472('0x8e')]),[_0x685b3c['id'],_0x44c943['toString'](),path[_0xf472('0x55')](__dirname,_0xf472('0x9d'),_0x685b3c[_0xf472('0x9e')]),_0x3c2441]);return _0x685b3c;}else{var _0x340108=squel[_0xf472('0x69')]();_0x340108[_0xf472('0x6a')]('('+_0x44c943[_0xf472('0x80')]()+')',_0xf472('0x9f'));_0x340108[_0xf472('0x6e')](_0xf472('0xa0'),_0xf472('0x44'));_0x44c943[_0xf472('0x1f')](_0x5b4300['limit']||_0x1aa07c);_0x44c943[_0xf472('0x1d')](_0x5b4300[_0xf472('0x1d')]||0x0);return dbH['sequelize'][_0xf472('0x36')](_0x340108[_0xf472('0x80')](),{'type':dbH[_0xf472('0x81')][_0xf472('0xa1')]['SELECT']})[_0xf472('0x25')](function(_0x193b65){if(!_0x193b65['length']){_0x1a1764=0x0;}else{_0x1a1764=_0x193b65[0x0][_0xf472('0x44')]||0x0;}return dbH[_0xf472('0x81')][_0xf472('0x36')](_0x44c943['toString'](),{'type':dbH['sequelize'][_0xf472('0xa1')]['SELECT']});})[_0xf472('0x25')](function(_0x3d846c){return{'rows':_0x3d846c||[],'count':_0x1a1764};});}});}exports['run']=function(_0x5899b0,_0x112d2f){return runReport(_0x5899b0[_0xf472('0x4a')],_0x5899b0['query'],_0x5899b0['options'])[_0xf472('0x25')](respondWithResult(_0x112d2f,null))[_0xf472('0x48')](handleError(_0x112d2f,null));};exports['runReport']=runReport;exports['query']=function(_0x55b8f0,_0x51281d){var _0x156582=0xa;var _0x5ae99b=[_0xf472('0x55'),_0xf472('0x83'),'right_join',_0xf472('0x84')];var _0x58fbd1={'SUM':'SUM(%s)','COUNT':_0xf472('0x86'),'COUNT DISTINCT':_0xf472('0x87'),'MAX':_0xf472('0x56'),'MIN':_0xf472('0xa2'),'AVG':_0xf472('0x88'),'GROUP_CONCAT':_0xf472('0x89'),'GROUP_CONCAT ASC':_0xf472('0x57'),'GROUP_CONCAT DESC':_0xf472('0xa3')};var _0x590830={'SEC_TO_TIME':_0xf472('0x58'),'DATE':_0xf472('0x8a'),'HOUR':_0xf472('0xa4'),'ROUND':_0xf472('0x59'),'UNIX_TIMESTAMP':_0xf472('0xa5')};var _0xa5f540=function(_0x21aed8){return!_[_0xf472('0x5a')]([_0xf472('0x5b'),_0xf472('0x8b'),_0xf472('0x5c'),'IS\x20NOT\x20EMPTY'],_0x21aed8);};var _0x8485d1=function(_0x45832a){if(!_0x45832a||!_0x45832a['rules'][_0xf472('0x3a')]){return'';}for(var _0x306bbe='(',_0x3a6b0f=0x0;_0x3a6b0f<_0x45832a[_0xf472('0x5e')]['length'];_0x3a6b0f+=0x1){_0x3a6b0f>0x0&&(_0x306bbe+='\x20'+_0x45832a[_0xf472('0x5f')]+'\x20');_0x306bbe+=_0x45832a[_0xf472('0x5e')][_0x3a6b0f][_0xf472('0x60')]?_0x8485d1(_0x45832a[_0xf472('0x5e')][_0x3a6b0f][_0xf472('0x60')]):_0x45832a[_0xf472('0x5e')][_0x3a6b0f][_0xf472('0x6e')]+'\x20'+_0x45832a['rules'][_0x3a6b0f][_0xf472('0x61')]+(_0xa5f540(_0x45832a[_0xf472('0x5e')][_0x3a6b0f][_0xf472('0x61')])?'\x20'+_0x45832a[_0xf472('0x5e')][_0x3a6b0f]['value']:'');}return _0x306bbe+')';};var _0x1b833c={'where':{'id':_0x55b8f0[_0xf472('0x4a')]['id']}},_0x3dd99c,_0x46a2b9,_0xc572e5,_0x3b2c0b,_0x41ef60;_0x1b833c=_[_0xf472('0x42')]({},_0x1b833c,_0x55b8f0['options']);return db[_0xf472('0x2f')][_0xf472('0x53')](_0x1b833c)[_0xf472('0x25')](function(_0x39d517){if(_0x39d517){_0x3dd99c=_0x39d517;return _0x39d517[_0xf472('0x63')]();}return null;})['then'](function(_0x2d6d94){if(_0x2d6d94){if(!_0x2d6d94[_0xf472('0x3a')]){throw new db[(_0xf472('0x64'))]['ValidationErrorItem'](_0xf472('0x66'),0x193);}_0x46a2b9=_0x2d6d94;return db[_0xf472('0x67')][_0xf472('0x68')]({'raw':!![]});}return null;})[_0xf472('0x25')](function(_0x4dc9d9){if(_0x4dc9d9){_0xc572e5=_[_0xf472('0x8c')](_0x4dc9d9,'id');var _0x3b5e83;var _0x2f747a=squel[_0xf472('0x69')]();_0x2f747a['from'](_0x3dd99c[_0xf472('0x6b')]);for(var _0x4b1a49=0x0;_0x4b1a49<_0x46a2b9[_0xf472('0x3a')];_0x4b1a49+=0x1){_0x3b5e83=_0x46a2b9[_0x4b1a49]['MetricId']?_0xc572e5[_0x46a2b9[_0x4b1a49][_0xf472('0x6c')]][_0xf472('0x6d')]:_0x46a2b9[_0x4b1a49][_0xf472('0x6e')];_0x3b5e83=_0x46a2b9[_0x4b1a49][_0xf472('0x6f')]?_[_0xf472('0x70')](_0x58fbd1[_0x46a2b9[_0x4b1a49]['function']],'%s',_0x3b5e83):_0x3b5e83;_0x3b5e83=_0x46a2b9[_0x4b1a49]['format']?_['replace'](_0x590830[_0x46a2b9[_0x4b1a49]['format']],'%s',_0x3b5e83):_0x3b5e83;if(_0x46a2b9[_0x4b1a49][_0xf472('0x72')]){_0x2f747a[_0xf472('0x60')](_0x3b5e83);}_0x46a2b9[_0x4b1a49][_0xf472('0x74')]&&_0x2f747a[_0xf472('0x73')](_0x3b5e83,_0x46a2b9[_0x4b1a49][_0xf472('0x74')]===_0xf472('0x75')?![]:!![]);_0x2f747a[_0xf472('0x6e')](_0x3b5e83,_0x46a2b9[_0x4b1a49][_0xf472('0x76')]||_0x3b5e83);}if(_0x3dd99c[_0xf472('0x77')]){_0x3dd99c[_0xf472('0x77')]=JSON[_0xf472('0x78')](_0x3dd99c[_0xf472('0x77')]);for(var _0x3f6e47=0x0;_0x3f6e47<_0x3dd99c['joins'][_0xf472('0x3a')];_0x3f6e47+=0x1){if(_0x3dd99c[_0xf472('0x77')][_0x3f6e47][_0xf472('0x32')]&&_['includes'](_0x5ae99b,_0x3dd99c[_0xf472('0x77')][_0x3f6e47][_0xf472('0x32')])&&_0x3dd99c[_0xf472('0x77')][_0x3f6e47][_0xf472('0x7c')]&&_0x3dd99c['joins'][_0x3f6e47]['foreignTable']&&_0x3dd99c[_0xf472('0x77')][_0x3f6e47][_0xf472('0x7a')]){_0x2f747a[_0x3dd99c['joins'][_0x3f6e47][_0xf472('0x32')]](_0x3dd99c['joins'][_0x3f6e47]['foreignTable'],null,util[_0xf472('0x71')](_0xf472('0x7b'),_0x3dd99c['table'],_0x3dd99c[_0xf472('0x77')][_0x3f6e47][_0xf472('0x7c')],_0x3dd99c[_0xf472('0x77')][_0x3f6e47][_0xf472('0x79')],_0x3dd99c[_0xf472('0x77')][_0x3f6e47][_0xf472('0x7a')]));}}}if(_0x3dd99c[_0xf472('0x7d')]){_0x3dd99c['conditions']=JSON['parse'](_0x3dd99c[_0xf472('0x7d')]);_0x2f747a[_0xf472('0x3d')](_0x8485d1(_0x3dd99c[_0xf472('0x7d')][_0xf472('0x60')]));}_0x41ef60=_0x2f747a[_0xf472('0x8d')]();_0x2f747a[_0xf472('0x1f')](_0x156582);_0x2f747a[_0xf472('0x1d')](0x0);logger[_0xf472('0x7e')]('Limited\x20Query:',_0x2f747a[_0xf472('0x80')]());return dbH[_0xf472('0x81')][_0xf472('0x36')](_0x2f747a[_0xf472('0x80')](),{'type':dbH[_0xf472('0x81')][_0xf472('0xa1')][_0xf472('0x82')]});}})[_0xf472('0x25')](function(){return{'sql':_0x41ef60['toString']()};})[_0xf472('0x25')](respondWithResult(_0x51281d,null))[_0xf472('0x48')](handleError(_0x51281d,null));}; \ No newline at end of file +var _0x50bf=['merge','options','includeAll','include','rows','catch','show','params','body','user','role','Reports','find','autoAssociation','UserProfileResource','create','error','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','sequelize','SELECT','join','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','includes','operator','getFields','metric','groupBy','output','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','toString','countTable','COUNT(*)','QueryTypes','run','left_join','MIN(%s)','SEC_TO_TIME(%s)','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','sendStatus','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL'];(function(_0x3d6d10,_0x57c8fb){var _0xbeda88=function(_0x2171e7){while(--_0x2171e7){_0x3d6d10['push'](_0x3d6d10['shift']());}};_0xbeda88(++_0x57c8fb);}(_0x50bf,0x106));var _0xf50b=function(_0x365890,_0xd9d579){_0x365890=_0x365890-0x0;var _0x4199ae=_0x50bf[_0x365890];return _0x4199ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf50b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf50b('0x1'));var rp=require(_0xf50b('0x2'));var moment=require('moment');var BPromise=require(_0xf50b('0x3'));var Mustache=require(_0xf50b('0x4'));var util=require('util');var path=require(_0xf50b('0x5'));var sox=require('sox');var csv=require(_0xf50b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf50b('0x7'));var _=require(_0xf50b('0x8'));var squel=require(_0xf50b('0x9'));var crypto=require('crypto');var jsforce=require(_0xf50b('0xa'));var deskjs=require(_0xf50b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf50b('0xc'));var qs=require(_0xf50b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf50b('0xe'));var logger=require('../../config/logger')(_0xf50b('0xf'));var utils=require(_0xf50b('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xf50b('0x11'));var db=require(_0xf50b('0x12'))['db'];var dbH=require('../../mysqldb')[_0xf50b('0x13')];function respondWithStatusCode(_0x420701,_0x12ce91){_0x12ce91=_0x12ce91||0xcc;return function(_0x2cf201){if(_0x2cf201){return _0x420701['sendStatus'](_0x12ce91);}return _0x420701[_0xf50b('0x14')](_0x12ce91)[_0xf50b('0x15')]();};}function respondWithResult(_0x405f94,_0x4e28c7){_0x4e28c7=_0x4e28c7||0xc8;return function(_0x5cf90c){if(_0x5cf90c){return _0x405f94['status'](_0x4e28c7)[_0xf50b('0x16')](_0x5cf90c);}};}function respondWithFilteredResult(_0x4c041d,_0x19460c){return function(_0x39b90f){if(_0x39b90f){var _0x6b3d2d=typeof _0x19460c[_0xf50b('0x17')]==='undefined'&&typeof _0x19460c['limit']===_0xf50b('0x18');var _0x4fbf00=_0x39b90f['count'];var _0x43ad41=_0x6b3d2d?0x0:_0x19460c[_0xf50b('0x17')];var _0x159e70=_0x6b3d2d?_0x39b90f[_0xf50b('0x19')]:_0x19460c['offset']+_0x19460c['limit'];var _0x10f1f4;if(_0x159e70>=_0x4fbf00){_0x159e70=_0x4fbf00;_0x10f1f4=0xc8;}else{_0x10f1f4=0xce;}_0x4c041d['status'](_0x10f1f4);return _0x4c041d[_0xf50b('0x1a')](_0xf50b('0x1b'),_0x43ad41+'-'+_0x159e70+'/'+_0x4fbf00)[_0xf50b('0x16')](_0x39b90f);}return null;};}function patchUpdates(_0x43a8a2){return function(_0x26912b){try{jsonpatch[_0xf50b('0x1c')](_0x26912b,_0x43a8a2,!![]);}catch(_0x217451){return BPromise[_0xf50b('0x1d')](_0x217451);}return _0x26912b[_0xf50b('0x1e')]();};}function saveUpdates(_0x5121fd,_0x12d6e5){return function(_0xf7a4d3){if(_0xf7a4d3){return _0xf7a4d3[_0xf50b('0x1f')](_0x5121fd)[_0xf50b('0x20')](function(_0x1572c9){return _0x1572c9;});}return null;};}function removeEntity(_0x3a0df9,_0x4a23e9){return function(_0x3942fb){if(_0x3942fb){return _0x3942fb[_0xf50b('0x21')]()['then'](function(){var _0x531399=_0x3942fb[_0xf50b('0x22')]({'plain':!![]});var _0x50f773=_0xf50b('0x23');return db['UserProfileResource'][_0xf50b('0x21')]({'where':{'type':_0x50f773,'resourceId':_0x531399['id']}})[_0xf50b('0x20')](function(){return _0x3942fb;});})['then'](function(){_0x3a0df9[_0xf50b('0x14')](0xcc)[_0xf50b('0x15')]();});}};}function handleEntityNotFound(_0xc9c5a6,_0x532367){return function(_0x33a55e){if(!_0x33a55e){_0xc9c5a6[_0xf50b('0x24')](0x194);}return _0x33a55e;};}function handleError(_0xf2dfac,_0x2997b9){_0x2997b9=_0x2997b9||0x1f4;return function(_0x5e4c29){logger['error'](_0x5e4c29[_0xf50b('0x25')]);if(_0x5e4c29['name']){delete _0x5e4c29[_0xf50b('0x26')];}_0xf2dfac[_0xf50b('0x14')](_0x2997b9)[_0xf50b('0x27')](_0x5e4c29);};}exports[_0xf50b('0x28')]=function(_0x4ec50d,_0x3c1666){var _0x4446f0={},_0x58a132={},_0x4978bb={'count':0x0,'rows':[]};var _0xec921a=_[_0xf50b('0x29')](db[_0xf50b('0x2a')][_0xf50b('0x2b')],function(_0x5315f0){return{'name':_0x5315f0['fieldName'],'type':_0x5315f0[_0xf50b('0x2c')][_0xf50b('0x2d')]};});_0x58a132[_0xf50b('0x2e')]=_[_0xf50b('0x29')](_0xec921a,'name');_0x58a132[_0xf50b('0x2f')]=_[_0xf50b('0x30')](_0x4ec50d[_0xf50b('0x2f')]);_0x58a132[_0xf50b('0x31')]=_[_0xf50b('0x32')](_0x58a132['model'],_0x58a132[_0xf50b('0x2f')]);_0x4446f0[_0xf50b('0x33')]=_[_0xf50b('0x32')](_0x58a132[_0xf50b('0x2e')],qs[_0xf50b('0x34')](_0x4ec50d['query'][_0xf50b('0x34')]));_0x4446f0[_0xf50b('0x33')]=_0x4446f0['attributes'][_0xf50b('0x35')]?_0x4446f0[_0xf50b('0x33')]:_0x58a132[_0xf50b('0x2e')];if(!_0x4ec50d[_0xf50b('0x2f')]['hasOwnProperty'](_0xf50b('0x36'))){_0x4446f0[_0xf50b('0x37')]=qs[_0xf50b('0x37')](_0x4ec50d[_0xf50b('0x2f')][_0xf50b('0x37')]);_0x4446f0['offset']=qs[_0xf50b('0x17')](_0x4ec50d[_0xf50b('0x2f')]['offset']);}_0x4446f0[_0xf50b('0x38')]=qs[_0xf50b('0x39')](_0x4ec50d[_0xf50b('0x2f')][_0xf50b('0x39')]);_0x4446f0[_0xf50b('0x3a')]=qs[_0xf50b('0x31')](_[_0xf50b('0x3b')](_0x4ec50d['query'],_0x58a132['filters']),_0xec921a);if(_0x4ec50d[_0xf50b('0x2f')][_0xf50b('0x3c')]){_0x4446f0['where']=_['merge'](_0x4446f0[_0xf50b('0x3a')],{'$or':_['map'](_0xec921a,function(_0x4394e2){if(_0x4394e2[_0xf50b('0x2c')]!==_0xf50b('0x3d')){var _0x4375f7={};_0x4375f7[_0x4394e2['name']]={'$like':'%'+_0x4ec50d['query'][_0xf50b('0x3c')]+'%'};return _0x4375f7;}})});}_0x4446f0=_[_0xf50b('0x3e')]({},_0x4446f0,_0x4ec50d[_0xf50b('0x3f')]);var _0x940983={'where':_0x4446f0[_0xf50b('0x3a')]};return db['AnalyticCustomReport']['count'](_0x940983)[_0xf50b('0x20')](function(_0x421699){_0x4978bb[_0xf50b('0x19')]=_0x421699;if(_0x4ec50d[_0xf50b('0x2f')][_0xf50b('0x40')]){_0x4446f0[_0xf50b('0x41')]=[{'all':!![]}];}return db[_0xf50b('0x2a')]['findAll'](_0x4446f0);})[_0xf50b('0x20')](function(_0x263738){_0x4978bb[_0xf50b('0x42')]=_0x263738;return _0x4978bb;})['then'](respondWithFilteredResult(_0x3c1666,_0x4446f0))[_0xf50b('0x43')](handleError(_0x3c1666,null));};exports[_0xf50b('0x44')]=function(_0x593df2,_0x50d812){var _0x1e4b1f={'raw':![],'where':{'id':_0x593df2[_0xf50b('0x45')]['id']}},_0x1a6fd6={};_0x1a6fd6['model']=_[_0xf50b('0x30')](db['AnalyticCustomReport'][_0xf50b('0x2b')]);_0x1a6fd6['query']=_[_0xf50b('0x30')](_0x593df2[_0xf50b('0x2f')]);_0x1a6fd6[_0xf50b('0x31')]=_[_0xf50b('0x32')](_0x1a6fd6['model'],_0x1a6fd6['query']);_0x1e4b1f[_0xf50b('0x33')]=_[_0xf50b('0x32')](_0x1a6fd6[_0xf50b('0x2e')],qs[_0xf50b('0x34')](_0x593df2[_0xf50b('0x2f')][_0xf50b('0x34')]));_0x1e4b1f[_0xf50b('0x33')]=_0x1e4b1f[_0xf50b('0x33')][_0xf50b('0x35')]?_0x1e4b1f[_0xf50b('0x33')]:_0x1a6fd6[_0xf50b('0x2e')];if(_0x593df2['query']['includeAll']){_0x1e4b1f[_0xf50b('0x41')]=[{'all':!![]}];}_0x1e4b1f=_[_0xf50b('0x3e')]({},_0x1e4b1f,_0x593df2[_0xf50b('0x3f')]);return db['AnalyticCustomReport']['find'](_0x1e4b1f)['then'](handleEntityNotFound(_0x50d812,null))['then'](respondWithResult(_0x50d812,null))[_0xf50b('0x43')](handleError(_0x50d812,null));};exports['create']=function(_0x12030d,_0x3e8175){return db[_0xf50b('0x2a')]['create'](_0x12030d[_0xf50b('0x46')],{})[_0xf50b('0x20')](function(_0x402207){var _0x3fc592=_0x12030d[_0xf50b('0x47')][_0xf50b('0x22')]({'plain':!![]});if(!_0x3fc592)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fc592[_0xf50b('0x48')]==='user'){var _0x32391e=_0x402207[_0xf50b('0x22')]({'plain':!![]});var _0x5e9f25=_0xf50b('0x49');return db['UserProfileSection'][_0xf50b('0x4a')]({'where':{'name':_0x5e9f25,'userProfileId':_0x3fc592['userProfileId']},'raw':!![]})[_0xf50b('0x20')](function(_0x57de5e){if(_0x57de5e&&_0x57de5e[_0xf50b('0x4b')]===0x0){return db[_0xf50b('0x4c')][_0xf50b('0x4d')]({'name':_0x32391e[_0xf50b('0x26')],'resourceId':_0x32391e['id'],'type':'CustomReports','sectionId':_0x57de5e['id']},{})['then'](function(){return _0x402207;});}else{return _0x402207;}})['catch'](function(_0x2d456a){logger[_0xf50b('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d456a);throw _0x2d456a;});}return _0x402207;})[_0xf50b('0x20')](respondWithResult(_0x3e8175,0xc9))[_0xf50b('0x43')](handleError(_0x3e8175,null));};exports[_0xf50b('0x1f')]=function(_0x4e247a,_0x292b4d){if(_0x4e247a[_0xf50b('0x46')]['id']){delete _0x4e247a[_0xf50b('0x46')]['id'];}return db['AnalyticCustomReport'][_0xf50b('0x4a')]({'where':{'id':_0x4e247a[_0xf50b('0x45')]['id']}})[_0xf50b('0x20')](handleEntityNotFound(_0x292b4d,null))[_0xf50b('0x20')](saveUpdates(_0x4e247a[_0xf50b('0x46')],null))[_0xf50b('0x20')](respondWithResult(_0x292b4d,null))[_0xf50b('0x43')](handleError(_0x292b4d,null));};exports[_0xf50b('0x21')]=function(_0x2e798a,_0xeec22d){return db[_0xf50b('0x2a')][_0xf50b('0x4a')]({'where':{'id':_0x2e798a[_0xf50b('0x45')]['id']}})['then'](handleEntityNotFound(_0xeec22d,null))[_0xf50b('0x20')](removeEntity(_0xeec22d,null))['catch'](handleError(_0xeec22d,null));};exports['preview']=function(_0xbe4791,_0x2ee0ac){var _0xc43bfa=0xa;var _0xf19fec=['join','left_join','right_join',_0xf50b('0x4f')];var _0x56695e={'SUM':_0xf50b('0x50'),'COUNT':_0xf50b('0x51'),'COUNT DISTINCT':_0xf50b('0x52'),'MAX':_0xf50b('0x53'),'MIN':'MIN(%s)','AVG':_0xf50b('0x54'),'GROUP_CONCAT':_0xf50b('0x55'),'GROUP_CONCAT ASC':_0xf50b('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xa358fc={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf50b('0x57'),'HOUR':_0xf50b('0x58'),'ROUND':_0xf50b('0x59'),'UNIX_TIMESTAMP':_0xf50b('0x5a')};var _0x2d9ef2=function(_0x4d5180){return!_['includes']([_0xf50b('0x5b'),_0xf50b('0x5c'),_0xf50b('0x5d'),_0xf50b('0x5e')],_0x4d5180);};var _0x3174c9=function(_0x42fb77){if(!_0x42fb77||!_0x42fb77[_0xf50b('0x5f')][_0xf50b('0x35')]){return'';}for(var _0x309dee='(',_0x12ba67=0x0;_0x12ba67<_0x42fb77['rules'][_0xf50b('0x35')];_0x12ba67+=0x1){_0x12ba67>0x0&&(_0x309dee+='\x20'+_0x42fb77['operator']+'\x20');_0x309dee+=_0x42fb77[_0xf50b('0x5f')][_0x12ba67][_0xf50b('0x60')]?_0x3174c9(_0x42fb77[_0xf50b('0x5f')][_0x12ba67]['group']):_0x42fb77[_0xf50b('0x5f')][_0x12ba67][_0xf50b('0x61')]+'\x20'+_0x42fb77['rules'][_0x12ba67][_0xf50b('0x62')]+(_0x2d9ef2(_0x42fb77[_0xf50b('0x5f')][_0x12ba67][_0xf50b('0x62')])?'\x20'+_0x42fb77[_0xf50b('0x5f')][_0x12ba67][_0xf50b('0x63')]:'');}return _0x309dee+')';};var _0x4ed0a9={'where':{'id':_0xbe4791[_0xf50b('0x45')]['id']}},_0x3c0a07,_0x1e1ca4,_0x1c126d,_0x6ad1c,_0x444f16;_0x4ed0a9=_[_0xf50b('0x3e')]({},_0x4ed0a9,_0xbe4791[_0xf50b('0x3f')]);return db[_0xf50b('0x2a')]['find'](_0x4ed0a9)[_0xf50b('0x20')](function(_0x456cdc){if(_0x456cdc){_0x3c0a07=_0x456cdc;return _0x456cdc['getFields']();}return null;})['then'](function(_0x192e51){if(_0x192e51){if(!_0x192e51[_0xf50b('0x35')]){throw new db[(_0xf50b('0x64'))][(_0xf50b('0x65'))](_0xf50b('0x66'),0x193);}_0x1e1ca4=_0x192e51;return db[_0xf50b('0x67')][_0xf50b('0x68')]({'raw':!![]});}return null;})[_0xf50b('0x20')](function(_0x3fee9d){if(_0x3fee9d){_0x1c126d=_[_0xf50b('0x69')](_0x3fee9d,'id');var _0x5d3b31;var _0x203169=squel[_0xf50b('0x6a')]();_0x203169[_0xf50b('0x6b')](_0x3c0a07['table']);for(var _0x544bee=0x0;_0x544bee<_0x1e1ca4[_0xf50b('0x35')];_0x544bee+=0x1){_0x5d3b31=_0x1e1ca4[_0x544bee][_0xf50b('0x6c')]?_0x1c126d[_0x1e1ca4[_0x544bee][_0xf50b('0x6c')]]['metric']:_0x1e1ca4[_0x544bee][_0xf50b('0x61')];_0x5d3b31=_0x1e1ca4[_0x544bee]['function']?_[_0xf50b('0x6d')](_0x56695e[_0x1e1ca4[_0x544bee][_0xf50b('0x6e')]],'%s',_0x5d3b31):_0x5d3b31;_0x5d3b31=_0x1e1ca4[_0x544bee][_0xf50b('0x6f')]?_[_0xf50b('0x6d')](_0xa358fc[_0x1e1ca4[_0x544bee][_0xf50b('0x6f')]],'%s',_0x5d3b31):_0x5d3b31;if(_0x1e1ca4[_0x544bee]['groupBy']){_0x203169[_0xf50b('0x60')](_0x5d3b31);}_0x1e1ca4[_0x544bee][_0xf50b('0x70')]&&_0x203169[_0xf50b('0x38')](_0x5d3b31,_0x1e1ca4[_0x544bee][_0xf50b('0x70')]===_0xf50b('0x71')?![]:!![]);_0x203169[_0xf50b('0x61')](_0x5d3b31,_0x1e1ca4[_0x544bee][_0xf50b('0x72')]||_0x5d3b31);}if(_0x3c0a07[_0xf50b('0x73')]){_0x3c0a07['joins']=JSON[_0xf50b('0x74')](_0x3c0a07['joins']);for(var _0x439511=0x0;_0x439511<_0x3c0a07[_0xf50b('0x73')][_0xf50b('0x35')];_0x439511+=0x1){if(_0x3c0a07['joins'][_0x439511]['type']&&_['includes'](_0xf19fec,_0x3c0a07['joins'][_0x439511][_0xf50b('0x2c')])&&_0x3c0a07[_0xf50b('0x73')][_0x439511][_0xf50b('0x75')]&&_0x3c0a07[_0xf50b('0x73')][_0x439511][_0xf50b('0x76')]&&_0x3c0a07[_0xf50b('0x73')][_0x439511][_0xf50b('0x77')]){_0x203169[_0x3c0a07[_0xf50b('0x73')][_0x439511][_0xf50b('0x2c')]](_0x3c0a07[_0xf50b('0x73')][_0x439511][_0xf50b('0x76')],null,util[_0xf50b('0x6f')](_0xf50b('0x78'),_0x3c0a07[_0xf50b('0x79')],_0x3c0a07[_0xf50b('0x73')][_0x439511]['parentKey'],_0x3c0a07[_0xf50b('0x73')][_0x439511][_0xf50b('0x76')],_0x3c0a07[_0xf50b('0x73')][_0x439511]['foreignKey']));}}}if(_0x3c0a07[_0xf50b('0x7a')]){_0x3c0a07[_0xf50b('0x7a')]=JSON[_0xf50b('0x74')](_0x3c0a07[_0xf50b('0x7a')]);_0x203169['where'](_0x3174c9(_0x3c0a07['conditions'][_0xf50b('0x60')]));}_0x444f16=_0x203169[_0xf50b('0x7b')]();_0x203169[_0xf50b('0x37')](_0xc43bfa);_0x203169[_0xf50b('0x17')](0x0);logger[_0xf50b('0x7c')](_0xf50b('0x7d'),_0x203169['toString']());return dbH[_0xf50b('0x7e')][_0xf50b('0x2f')](_0x203169['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xf50b('0x7f')]});}})[_0xf50b('0x20')](respondWithResult(_0x2ee0ac,null))[_0xf50b('0x43')](handleError(_0x2ee0ac,null));};function runReport(_0x34e1bf,_0x42aa44,_0xb84e51){var _0x44aa76=_0x42aa44[_0xf50b('0x26')];var _0x59fca5=0xa;var _0x4e748b=[_0xf50b('0x80'),'left_join',_0xf50b('0x81'),_0xf50b('0x4f')];var _0x1b285c={'SUM':'SUM(%s)','COUNT':_0xf50b('0x51'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf50b('0x53'),'MIN':'MIN(%s)','AVG':_0xf50b('0x54'),'GROUP_CONCAT':_0xf50b('0x55'),'GROUP_CONCAT ASC':_0xf50b('0x56'),'GROUP_CONCAT DESC':_0xf50b('0x82')};var _0x1eeb53={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf50b('0x57'),'HOUR':_0xf50b('0x58'),'ROUND':_0xf50b('0x59'),'UNIX_TIMESTAMP':_0xf50b('0x5a')};var _0x6fd21b=function(_0x146ab7){return!_[_0xf50b('0x83')]([_0xf50b('0x5b'),_0xf50b('0x5c'),_0xf50b('0x5d'),_0xf50b('0x5e')],_0x146ab7);};var _0x317190=function(_0xe2b562){if(!_0xe2b562||!_0xe2b562[_0xf50b('0x5f')][_0xf50b('0x35')]){return'';}for(var _0x1eac4c='(',_0xc2719e=0x0;_0xc2719e<_0xe2b562['rules'][_0xf50b('0x35')];_0xc2719e+=0x1){_0xc2719e>0x0&&(_0x1eac4c+='\x20'+_0xe2b562[_0xf50b('0x84')]+'\x20');_0x1eac4c+=_0xe2b562['rules'][_0xc2719e]['group']?_0x317190(_0xe2b562['rules'][_0xc2719e]['group']):_0xe2b562[_0xf50b('0x5f')][_0xc2719e][_0xf50b('0x61')]+'\x20'+_0xe2b562[_0xf50b('0x5f')][_0xc2719e]['condition']+(_0x6fd21b(_0xe2b562[_0xf50b('0x5f')][_0xc2719e]['condition'])?'\x20'+_0xe2b562['rules'][_0xc2719e][_0xf50b('0x63')]:'');}return _0x1eac4c+')';};var _0xf829f1={'where':{'id':_0x34e1bf['id']}},_0x3f72c0,_0x5212c3,_0x28da62,_0x16f384,_0xedc329;_0xf829f1=_[_0xf50b('0x3e')]({},_0xf829f1,_0xb84e51);return db[_0xf50b('0x2a')][_0xf50b('0x4a')](_0xf829f1)[_0xf50b('0x20')](function(_0x551be7){if(_0x551be7){_0x3f72c0=_0x551be7;return _0x551be7[_0xf50b('0x85')]();}return null;})['then'](function(_0xdfe0c8){if(_0xdfe0c8){if(!_0xdfe0c8['length']){throw new db[(_0xf50b('0x64'))][(_0xf50b('0x65'))](_0xf50b('0x66'),0x193);}_0x5212c3=_0xdfe0c8;return db[_0xf50b('0x67')]['findAll']({'raw':!![]});}return null;})[_0xf50b('0x20')](function(_0x2dc994){if(_0x2dc994){_0x28da62=_['keyBy'](_0x2dc994,'id');var _0x226bf4;var _0x155ba3=squel[_0xf50b('0x6a')]();_0x155ba3[_0xf50b('0x6b')](_0x3f72c0[_0xf50b('0x79')]);for(var _0x24395b=0x0;_0x24395b<_0x5212c3[_0xf50b('0x35')];_0x24395b+=0x1){_0x226bf4=_0x5212c3[_0x24395b][_0xf50b('0x6c')]?_0x28da62[_0x5212c3[_0x24395b]['MetricId']][_0xf50b('0x86')]:_0x5212c3[_0x24395b][_0xf50b('0x61')];_0x226bf4=_0x5212c3[_0x24395b][_0xf50b('0x6e')]?_[_0xf50b('0x6d')](_0x1b285c[_0x5212c3[_0x24395b][_0xf50b('0x6e')]],'%s',_0x226bf4):_0x226bf4;_0x226bf4=_0x5212c3[_0x24395b]['format']?_['replace'](_0x1eeb53[_0x5212c3[_0x24395b][_0xf50b('0x6f')]],'%s',_0x226bf4):_0x226bf4;if(_0x5212c3[_0x24395b][_0xf50b('0x87')]){_0x155ba3[_0xf50b('0x60')](_0x226bf4);}_0x5212c3[_0x24395b][_0xf50b('0x70')]&&_0x155ba3[_0xf50b('0x38')](_0x226bf4,_0x5212c3[_0x24395b][_0xf50b('0x70')]==='DESC'?![]:!![]);_0x155ba3[_0xf50b('0x61')](_0x226bf4,_0x5212c3[_0x24395b][_0xf50b('0x72')]||_0x226bf4);}if(_0x3f72c0[_0xf50b('0x73')]){_0x3f72c0['joins']=JSON[_0xf50b('0x74')](_0x3f72c0[_0xf50b('0x73')]);for(var _0x125821=0x0;_0x125821<_0x3f72c0['joins'][_0xf50b('0x35')];_0x125821+=0x1){if(_0x3f72c0[_0xf50b('0x73')][_0x125821][_0xf50b('0x2c')]&&_['includes'](_0x4e748b,_0x3f72c0['joins'][_0x125821][_0xf50b('0x2c')])&&_0x3f72c0[_0xf50b('0x73')][_0x125821][_0xf50b('0x75')]&&_0x3f72c0[_0xf50b('0x73')][_0x125821][_0xf50b('0x76')]&&_0x3f72c0[_0xf50b('0x73')][_0x125821][_0xf50b('0x77')]){_0x155ba3[_0x3f72c0[_0xf50b('0x73')][_0x125821][_0xf50b('0x2c')]](_0x3f72c0['joins'][_0x125821][_0xf50b('0x76')],null,util[_0xf50b('0x6f')](_0xf50b('0x78'),_0x3f72c0[_0xf50b('0x79')],_0x3f72c0[_0xf50b('0x73')][_0x125821][_0xf50b('0x75')],_0x3f72c0[_0xf50b('0x73')][_0x125821][_0xf50b('0x76')],_0x3f72c0[_0xf50b('0x73')][_0x125821][_0xf50b('0x77')]));}}}if(_0x3f72c0[_0xf50b('0x7a')]){_0x3f72c0['conditions']=JSON['parse'](_0x3f72c0[_0xf50b('0x7a')]);_0x155ba3[_0xf50b('0x3a')](_0x317190(_0x3f72c0['conditions'][_0xf50b('0x60')]));}_0xedc329=_0x155ba3[_0xf50b('0x7b')]();_0x155ba3[_0xf50b('0x37')](_0x59fca5);_0x155ba3['offset'](0x0);return;}})[_0xf50b('0x20')](function(){if(_0x42aa44[_0xf50b('0x88')]==='web'){return null;}var _0x3e0879=_[_0xf50b('0x3e')](_0x42aa44,{'name':_0x42aa44[_0xf50b('0x89')]||_0x42aa44[_0xf50b('0x26')]||_0x3f72c0[_0xf50b('0x26')],'basename':_0x44aa76,'savename':util[_0xf50b('0x6f')](_0xf50b('0x8a'),_0x42aa44[_0xf50b('0x26')]||_0x3f72c0['name'],require(_0xf50b('0x8b'))[_0xf50b('0x8c')](0x4),_0x42aa44['output']||'csv'),'reportId':_0x3f72c0['id'],'reportType':_0xf50b('0x8d')});return db[_0xf50b('0x8e')][_0xf50b('0x4d')](_0x3e0879,{'raw':!![]});})[_0xf50b('0x20')](function(_0x5c7465){if(_0x3f72c0[_0xf50b('0x79')]===_0xf50b('0x8f')){_0xedc329[_0xf50b('0x3a')](_0x3f72c0[_0xf50b('0x79')]+_0xf50b('0x90'),_0x42aa44[_0xf50b('0x91')],_0x42aa44[_0xf50b('0x92')]);}else{_0xedc329['where'](_0x3f72c0[_0xf50b('0x79')]+_0xf50b('0x93'),_0x42aa44[_0xf50b('0x91')],_0x42aa44[_0xf50b('0x92')]);}if(_0x5c7465){logger['info'](_0xf50b('0x94'),_0xedc329['toString']());require(_0xf50b('0x95'))[_0xf50b('0x96')](path[_0xf50b('0x80')](__dirname,_0xf50b('0x97'),_0x5c7465[_0xf50b('0x88')]),[_0x5c7465['id'],_0xedc329['toString'](),path['join'](__dirname,_0xf50b('0x98'),_0x5c7465[_0xf50b('0x99')]),_0x44aa76]);return _0x5c7465;}else{var _0x3c0834=squel[_0xf50b('0x6a')]();_0x3c0834[_0xf50b('0x6b')]('('+_0xedc329[_0xf50b('0x9a')]()+')',_0xf50b('0x9b'));_0x3c0834['field'](_0xf50b('0x9c'),_0xf50b('0x19'));_0xedc329[_0xf50b('0x37')](_0x42aa44[_0xf50b('0x37')]||_0x59fca5);_0xedc329['offset'](_0x42aa44[_0xf50b('0x17')]||0x0);return dbH[_0xf50b('0x7e')][_0xf50b('0x2f')](_0x3c0834['toString'](),{'type':dbH[_0xf50b('0x7e')][_0xf50b('0x9d')][_0xf50b('0x7f')]})['then'](function(_0x1e33c6){if(!_0x1e33c6['length']){_0x16f384=0x0;}else{_0x16f384=_0x1e33c6[0x0]['count']||0x0;}return dbH[_0xf50b('0x7e')][_0xf50b('0x2f')](_0xedc329[_0xf50b('0x9a')](),{'type':dbH['sequelize'][_0xf50b('0x9d')]['SELECT']});})['then'](function(_0x38d030){return{'rows':_0x38d030||[],'count':_0x16f384};});}});}exports[_0xf50b('0x9e')]=function(_0x230fd4,_0x193d94){return runReport(_0x230fd4['params'],_0x230fd4[_0xf50b('0x2f')],_0x230fd4['options'])[_0xf50b('0x20')](respondWithResult(_0x193d94,null))['catch'](handleError(_0x193d94,null));};exports['runReport']=runReport;exports[_0xf50b('0x2f')]=function(_0x40392b,_0x1bd938){var _0x526430=0xa;var _0x1786df=[_0xf50b('0x80'),_0xf50b('0x9f'),_0xf50b('0x81'),_0xf50b('0x4f')];var _0x4bcce3={'SUM':_0xf50b('0x50'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf50b('0x52'),'MAX':'MAX(%s)','MIN':_0xf50b('0xa0'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf50b('0x55'),'GROUP_CONCAT ASC':_0xf50b('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x10db4b={'SEC_TO_TIME':_0xf50b('0xa1'),'DATE':_0xf50b('0x57'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf50b('0x5a')};var _0x105bcd=function(_0x85545b){return!_['includes']([_0xf50b('0x5b'),_0xf50b('0x5c'),_0xf50b('0x5d'),_0xf50b('0x5e')],_0x85545b);};var _0x31b572=function(_0x57926d){if(!_0x57926d||!_0x57926d[_0xf50b('0x5f')][_0xf50b('0x35')]){return'';}for(var _0x365c50='(',_0xeaaa3f=0x0;_0xeaaa3f<_0x57926d[_0xf50b('0x5f')][_0xf50b('0x35')];_0xeaaa3f+=0x1){_0xeaaa3f>0x0&&(_0x365c50+='\x20'+_0x57926d[_0xf50b('0x84')]+'\x20');_0x365c50+=_0x57926d[_0xf50b('0x5f')][_0xeaaa3f]['group']?_0x31b572(_0x57926d[_0xf50b('0x5f')][_0xeaaa3f]['group']):_0x57926d[_0xf50b('0x5f')][_0xeaaa3f][_0xf50b('0x61')]+'\x20'+_0x57926d[_0xf50b('0x5f')][_0xeaaa3f][_0xf50b('0x62')]+(_0x105bcd(_0x57926d[_0xf50b('0x5f')][_0xeaaa3f][_0xf50b('0x62')])?'\x20'+_0x57926d[_0xf50b('0x5f')][_0xeaaa3f][_0xf50b('0x63')]:'');}return _0x365c50+')';};var _0x4a23f3={'where':{'id':_0x40392b[_0xf50b('0x45')]['id']}},_0x3a6101,_0x135d41,_0x1a21bc,_0x415c32,_0x4d0d3e;_0x4a23f3=_[_0xf50b('0x3e')]({},_0x4a23f3,_0x40392b[_0xf50b('0x3f')]);return db[_0xf50b('0x2a')][_0xf50b('0x4a')](_0x4a23f3)[_0xf50b('0x20')](function(_0x2324d2){if(_0x2324d2){_0x3a6101=_0x2324d2;return _0x2324d2[_0xf50b('0x85')]();}return null;})[_0xf50b('0x20')](function(_0x5e6041){if(_0x5e6041){if(!_0x5e6041[_0xf50b('0x35')]){throw new db[(_0xf50b('0x64'))][(_0xf50b('0x65'))](_0xf50b('0x66'),0x193);}_0x135d41=_0x5e6041;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x4ac860){if(_0x4ac860){_0x1a21bc=_['keyBy'](_0x4ac860,'id');var _0x2273c1;var _0x53ae15=squel[_0xf50b('0x6a')]();_0x53ae15[_0xf50b('0x6b')](_0x3a6101['table']);for(var _0x2ad825=0x0;_0x2ad825<_0x135d41[_0xf50b('0x35')];_0x2ad825+=0x1){_0x2273c1=_0x135d41[_0x2ad825]['MetricId']?_0x1a21bc[_0x135d41[_0x2ad825][_0xf50b('0x6c')]]['metric']:_0x135d41[_0x2ad825][_0xf50b('0x61')];_0x2273c1=_0x135d41[_0x2ad825]['function']?_['replace'](_0x4bcce3[_0x135d41[_0x2ad825][_0xf50b('0x6e')]],'%s',_0x2273c1):_0x2273c1;_0x2273c1=_0x135d41[_0x2ad825]['format']?_[_0xf50b('0x6d')](_0x10db4b[_0x135d41[_0x2ad825][_0xf50b('0x6f')]],'%s',_0x2273c1):_0x2273c1;if(_0x135d41[_0x2ad825][_0xf50b('0x87')]){_0x53ae15[_0xf50b('0x60')](_0x2273c1);}_0x135d41[_0x2ad825][_0xf50b('0x70')]&&_0x53ae15[_0xf50b('0x38')](_0x2273c1,_0x135d41[_0x2ad825][_0xf50b('0x70')]===_0xf50b('0x71')?![]:!![]);_0x53ae15['field'](_0x2273c1,_0x135d41[_0x2ad825][_0xf50b('0x72')]||_0x2273c1);}if(_0x3a6101[_0xf50b('0x73')]){_0x3a6101[_0xf50b('0x73')]=JSON[_0xf50b('0x74')](_0x3a6101['joins']);for(var _0x572e0a=0x0;_0x572e0a<_0x3a6101[_0xf50b('0x73')][_0xf50b('0x35')];_0x572e0a+=0x1){if(_0x3a6101['joins'][_0x572e0a][_0xf50b('0x2c')]&&_[_0xf50b('0x83')](_0x1786df,_0x3a6101[_0xf50b('0x73')][_0x572e0a][_0xf50b('0x2c')])&&_0x3a6101[_0xf50b('0x73')][_0x572e0a]['parentKey']&&_0x3a6101['joins'][_0x572e0a]['foreignTable']&&_0x3a6101[_0xf50b('0x73')][_0x572e0a][_0xf50b('0x77')]){_0x53ae15[_0x3a6101[_0xf50b('0x73')][_0x572e0a][_0xf50b('0x2c')]](_0x3a6101[_0xf50b('0x73')][_0x572e0a][_0xf50b('0x76')],null,util[_0xf50b('0x6f')]('%s.%s\x20=\x20%s.%s',_0x3a6101[_0xf50b('0x79')],_0x3a6101['joins'][_0x572e0a][_0xf50b('0x75')],_0x3a6101[_0xf50b('0x73')][_0x572e0a][_0xf50b('0x76')],_0x3a6101['joins'][_0x572e0a][_0xf50b('0x77')]));}}}if(_0x3a6101[_0xf50b('0x7a')]){_0x3a6101[_0xf50b('0x7a')]=JSON[_0xf50b('0x74')](_0x3a6101[_0xf50b('0x7a')]);_0x53ae15[_0xf50b('0x3a')](_0x31b572(_0x3a6101[_0xf50b('0x7a')][_0xf50b('0x60')]));}_0x4d0d3e=_0x53ae15[_0xf50b('0x7b')]();_0x53ae15['limit'](_0x526430);_0x53ae15[_0xf50b('0x17')](0x0);logger[_0xf50b('0x7c')](_0xf50b('0x7d'),_0x53ae15['toString']());return dbH['sequelize'][_0xf50b('0x2f')](_0x53ae15[_0xf50b('0x9a')](),{'type':dbH['sequelize'][_0xf50b('0x9d')][_0xf50b('0x7f')]});}})[_0xf50b('0x20')](function(){return{'sql':_0x4d0d3e[_0xf50b('0x9a')]()};})[_0xf50b('0x20')](respondWithResult(_0x1bd938,null))['catch'](handleError(_0x1bd938,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a688d99..02f74ed 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 _0x3a06=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x5cc253,_0x59e268){var _0x18b9b2=function(_0x3e1f99){while(--_0x3e1f99){_0x5cc253['push'](_0x5cc253['shift']());}};_0x18b9b2(++_0x59e268);}(_0x3a06,0x1a4));var _0x63a0=function(_0x41549c,_0x3c50d){_0x41549c=_0x41549c-0x0;var _0xeec39e=_0x3a06[_0x41549c];return _0xeec39e;};'use strict';var _=require(_0x63a0('0x0'));var util=require(_0x63a0('0x1'));var logger=require(_0x63a0('0x2'))(_0x63a0('0x3'));var moment=require(_0x63a0('0x4'));var BPromise=require(_0x63a0('0x5'));var rp=require(_0x63a0('0x6'));var fs=require('fs');var path=require(_0x63a0('0x7'));var rimraf=require('rimraf');var config=require(_0x63a0('0x8'));var attributes=require(_0x63a0('0x9'));module[_0x63a0('0xa')]=function(_0x521e97,_0x18c57c){return _0x521e97[_0x63a0('0xb')](_0x63a0('0xc'),attributes,{'tableName':_0x63a0('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cb7=['path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57e118,_0x99b7b8){var _0x58896c=function(_0xb83347){while(--_0xb83347){_0x57e118['push'](_0x57e118['shift']());}};_0x58896c(++_0x99b7b8);}(_0x9cb7,0xbc));var _0x79cb=function(_0x41fe6b,_0x2aea0f){_0x41fe6b=_0x41fe6b-0x0;var _0x2c4d39=_0x9cb7[_0x41fe6b];return _0x2c4d39;};'use strict';var _=require(_0x79cb('0x0'));var util=require(_0x79cb('0x1'));var logger=require(_0x79cb('0x2'))(_0x79cb('0x3'));var moment=require(_0x79cb('0x4'));var BPromise=require(_0x79cb('0x5'));var rp=require(_0x79cb('0x6'));var fs=require('fs');var path=require(_0x79cb('0x7'));var rimraf=require(_0x79cb('0x8'));var config=require(_0x79cb('0x9'));var attributes=require(_0x79cb('0xa'));module['exports']=function(_0x419685,_0x37bb0c){return _0x419685[_0x79cb('0xb')]('AnalyticCustomReport',attributes,{'tableName':_0x79cb('0xc'),'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 f024ae6..8277f7d 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 _0x0765=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x0765,0x1b5));var _0x5076=function(_0x486909,_0x19d283){_0x486909=_0x486909-0x0;var _0xaba3d8=_0x0765[_0x486909];return _0xaba3d8;};'use strict';var _=require(_0x5076('0x0'));var util=require(_0x5076('0x1'));var moment=require(_0x5076('0x2'));var BPromise=require(_0x5076('0x3'));var rs=require(_0x5076('0x4'));var fs=require('fs');var Redis=require(_0x5076('0x5'));var db=require(_0x5076('0x6'))['db'];var utils=require(_0x5076('0x7'));var logger=require(_0x5076('0x8'))(_0x5076('0x9'));var config=require(_0x5076('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8c6629,_0x5c8021,_0x3f2c94){return new BPromise(function(_0x1a0782,_0x504d15){return client[_0x5076('0xb')](_0x8c6629,_0x3f2c94)[_0x5076('0xc')](function(_0x15fa39){logger[_0x5076('0xd')](_0x5076('0xe'),_0x5c8021,_0x5076('0xf'));logger[_0x5076('0x10')](_0x5076('0x11'),_0x5c8021,_0x5076('0xf'),JSON[_0x5076('0x12')](_0x15fa39));if(_0x15fa39['error']){if(_0x15fa39['error'][_0x5076('0x13')]===0x1f4){logger[_0x5076('0x14')](_0x5076('0xe'),_0x5c8021,_0x15fa39['error']['message']);return _0x504d15(_0x15fa39[_0x5076('0x14')][_0x5076('0x15')]);}logger[_0x5076('0x14')](_0x5076('0xe'),_0x5c8021,_0x15fa39[_0x5076('0x14')]['message']);return _0x1a0782(_0x15fa39[_0x5076('0x14')]['message']);}else{logger['info'](_0x5076('0xe'),_0x5c8021,_0x5076('0xf'));_0x1a0782(_0x15fa39['result'][_0x5076('0x15')]);}})[_0x5076('0x16')](function(_0x54c0f3){logger[_0x5076('0x14')](_0x5076('0xe'),_0x5c8021,_0x54c0f3);_0x504d15(_0x54c0f3);});});} \ No newline at end of file +var _0x157e=['code','message','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16404b,_0x28a2dc){var _0x55fa00=function(_0x595d67){while(--_0x595d67){_0x16404b['push'](_0x16404b['shift']());}};_0x55fa00(++_0x28a2dc);}(_0x157e,0x9c));var _0xe157=function(_0x112e2a,_0x364486){_0x112e2a=_0x112e2a-0x0;var _0x4f8af9=_0x157e[_0x112e2a];return _0x4f8af9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe157('0x0'));var BPromise=require(_0xe157('0x1'));var rs=require(_0xe157('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe157('0x3'))['db'];var utils=require(_0xe157('0x4'));var logger=require(_0xe157('0x5'))(_0xe157('0x6'));var config=require(_0xe157('0x7'));var jayson=require(_0xe157('0x8'));var client=jayson[_0xe157('0x9')][_0xe157('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4262b9,_0x107fd3,_0x17770a){return new BPromise(function(_0x4f1980,_0x1b4606){return client[_0xe157('0xb')](_0x4262b9,_0x17770a)[_0xe157('0xc')](function(_0x3ec433){logger[_0xe157('0xd')](_0xe157('0xe'),_0x107fd3,_0xe157('0xf'));logger[_0xe157('0x10')](_0xe157('0x11'),_0x107fd3,_0xe157('0xf'),JSON[_0xe157('0x12')](_0x3ec433));if(_0x3ec433[_0xe157('0x13')]){if(_0x3ec433[_0xe157('0x13')][_0xe157('0x14')]===0x1f4){logger[_0xe157('0x13')](_0xe157('0xe'),_0x107fd3,_0x3ec433[_0xe157('0x13')][_0xe157('0x15')]);return _0x1b4606(_0x3ec433[_0xe157('0x13')][_0xe157('0x15')]);}logger['error'](_0xe157('0xe'),_0x107fd3,_0x3ec433[_0xe157('0x13')][_0xe157('0x15')]);return _0x4f1980(_0x3ec433[_0xe157('0x13')]['message']);}else{logger[_0xe157('0xd')](_0xe157('0xe'),_0x107fd3,_0xe157('0xf'));_0x4f1980(_0x3ec433['result'][_0xe157('0x15')]);}})['catch'](function(_0x1bcde1){logger['error'](_0xe157('0xe'),_0x107fd3,_0x1bcde1);_0x1b4606(_0x1bcde1);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 5daab1f..219df1d 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 _0x5224=['../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','/:id/preview','preview','run','/:id/query','query','create','put','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24e0c9,_0x284109){var _0x4448f0=function(_0x576980){while(--_0x576980){_0x24e0c9['push'](_0x24e0c9['shift']());}};_0x4448f0(++_0x284109);}(_0x5224,0x1dd));var _0x4522=function(_0x599aaf,_0x3d3622){_0x599aaf=_0x599aaf-0x0;var _0xd995f3=_0x5224[_0x599aaf];return _0xd995f3;};'use strict';var multer=require(_0x4522('0x0'));var util=require(_0x4522('0x1'));var path=require(_0x4522('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4522('0x3'));var auth=require(_0x4522('0x4'));var interaction=require(_0x4522('0x5'));var config=require(_0x4522('0x6'));var controller=require(_0x4522('0x7'));router['get']('/',auth[_0x4522('0x8')](),controller['index']);router[_0x4522('0x9')](_0x4522('0xa'),auth[_0x4522('0x8')](),controller['show']);router[_0x4522('0x9')](_0x4522('0xb'),auth[_0x4522('0x8')](),controller[_0x4522('0xc')]);router[_0x4522('0x9')]('/:id/run',auth[_0x4522('0x8')](),controller[_0x4522('0xd')]);router['get'](_0x4522('0xe'),auth[_0x4522('0x8')](),controller[_0x4522('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4522('0x10')]);router[_0x4522('0x11')](_0x4522('0xa'),auth[_0x4522('0x8')](),controller['update']);router[_0x4522('0x12')]('/:id',auth[_0x4522('0x8')](),controller[_0x4522('0x13')]);module[_0x4522('0x14')]=router; \ No newline at end of file +var _0xaf08=['index','show','/:id/preview','preview','run','/:id/query','query','post','create','put','/:id','update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated'];(function(_0x5e3665,_0x369ac8){var _0x187299=function(_0x5c37f8){while(--_0x5c37f8){_0x5e3665['push'](_0x5e3665['shift']());}};_0x187299(++_0x369ac8);}(_0xaf08,0x138));var _0x8af0=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0xaf08[_0xc7348b];return _0x307cec;};'use strict';var multer=require('multer');var util=require(_0x8af0('0x0'));var path=require(_0x8af0('0x1'));var timeout=require('connect-timeout');var express=require(_0x8af0('0x2'));var router=express[_0x8af0('0x3')]();var fs_extra=require(_0x8af0('0x4'));var auth=require(_0x8af0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8af0('0x6'));var controller=require(_0x8af0('0x7'));router[_0x8af0('0x8')]('/',auth[_0x8af0('0x9')](),controller[_0x8af0('0xa')]);router[_0x8af0('0x8')]('/:id',auth[_0x8af0('0x9')](),controller[_0x8af0('0xb')]);router['get'](_0x8af0('0xc'),auth['isAuthenticated'](),controller[_0x8af0('0xd')]);router['get']('/:id/run',auth[_0x8af0('0x9')](),controller[_0x8af0('0xe')]);router[_0x8af0('0x8')](_0x8af0('0xf'),auth[_0x8af0('0x9')](),controller[_0x8af0('0x10')]);router[_0x8af0('0x11')]('/',auth[_0x8af0('0x9')](),controller[_0x8af0('0x12')]);router[_0x8af0('0x13')](_0x8af0('0x14'),auth[_0x8af0('0x9')](),controller[_0x8af0('0x15')]);router['delete']('/:id',auth[_0x8af0('0x9')](),controller[_0x8af0('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 9fdec7b..1965a14 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 _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x3c3772,_0xf3aaa7){var _0x40ce64=function(_0x48dd65){while(--_0x48dd65){_0x3c3772['push'](_0x3c3772['shift']());}};_0x40ce64(++_0xf3aaa7);}(_0x1883,0xab));var _0x3188=function(_0x3f6408,_0x132511){_0x3f6408=_0x3f6408-0x0;var _0x37f707=_0x1883[_0x3f6408];return _0x37f707;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x2a275f,_0x14b467){var _0x445d29=function(_0x239cdb){while(--_0x239cdb){_0x2a275f['push'](_0x2a275f['shift']());}};_0x445d29(++_0x14b467);}(_0x31f0,0xb7));var _0x031f=function(_0x8b4957,_0xb90afa){_0x8b4957=_0x8b4957-0x0;var _0x54b3e4=_0x31f0[_0x8b4957];return _0x54b3e4;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 7eb3788..6be9bb5 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 _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','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/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x6fdd77,_0x39451b){var _0x5bda9a=function(_0xf851fc){while(--_0xf851fc){_0x6fdd77['push'](_0x6fdd77['shift']());}};_0x5bda9a(++_0x39451b);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x14e51e,_0xed289b){_0x14e51e=_0x14e51e-0x0;var _0xf93e94=_0x3f8a[_0x14e51e];return _0xf93e94;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file +var _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x5ba549,_0x425afd){var _0x36e3a1=function(_0x464308){while(--_0x464308){_0x5ba549['push'](_0x5ba549['shift']());}};_0x36e3a1(++_0x425afd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 7d6e1e9..1c5e984 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 _0xbf20=['AnalyticDefaultReport','../../config/logger','moment','bluebird','path','rimraf','./analyticDefaultReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf20,0x18d));var _0x0bf2=function(_0x1972ba,_0x4c8a45){_0x1972ba=_0x1972ba-0x0;var _0x4bc9e9=_0xbf20[_0x1972ba];return _0x4bc9e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0bf2('0x0'))('api');var moment=require(_0x0bf2('0x1'));var BPromise=require(_0x0bf2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bf2('0x3'));var rimraf=require(_0x0bf2('0x4'));var config=require('../../config/environment');var attributes=require(_0x0bf2('0x5'));module[_0x0bf2('0x6')]=function(_0x577af1,_0xc99027){return _0x577af1[_0x0bf2('0x7')](_0x0bf2('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb694=['exports','define','AnalyticDefaultReport','lodash','util','bluebird','request-promise','rimraf'];(function(_0x2be2ff,_0x4a4e07){var _0x2b0ed3=function(_0x2d1843){while(--_0x2d1843){_0x2be2ff['push'](_0x2be2ff['shift']());}};_0x2b0ed3(++_0x4a4e07);}(_0xb694,0xcb));var _0x4b69=function(_0x51888b,_0x5f1ce9){_0x51888b=_0x51888b-0x0;var _0x29baa6=_0xb694[_0x51888b];return _0x29baa6;};'use strict';var _=require(_0x4b69('0x0'));var util=require(_0x4b69('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4b69('0x2'));var rp=require(_0x4b69('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b69('0x4'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x4b69('0x5')]=function(_0xca7592,_0x2f937d){return _0xca7592[_0x4b69('0x6')](_0x4b69('0x7'),attributes,{'tableName':'analytics_default_reports','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 bc7f649..ff3e4d6 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 _0xff68=['code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x58558d,_0x57c29f){var _0x449143=function(_0x3effd7){while(--_0x3effd7){_0x58558d['push'](_0x58558d['shift']());}};_0x449143(++_0x57c29f);}(_0xff68,0x16c));var _0x8ff6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xff68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8ff6('0x0'));var moment=require(_0x8ff6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ff6('0x2'));var db=require(_0x8ff6('0x3'))['db'];var utils=require(_0x8ff6('0x4'));var logger=require('../../config/logger')(_0x8ff6('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ff6('0x6')][_0x8ff6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2bd1ee,_0x7d305c,_0x144691){return new BPromise(function(_0x55e89f,_0x1f4148){return client[_0x8ff6('0x8')](_0x2bd1ee,_0x144691)[_0x8ff6('0x9')](function(_0x1f5a2f){logger[_0x8ff6('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x7d305c,_0x8ff6('0xb'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x7d305c,'request\x20sent',JSON[_0x8ff6('0xc')](_0x1f5a2f));if(_0x1f5a2f[_0x8ff6('0xd')]){if(_0x1f5a2f[_0x8ff6('0xd')][_0x8ff6('0xe')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x7d305c,_0x1f5a2f[_0x8ff6('0xd')][_0x8ff6('0xf')]);return _0x1f4148(_0x1f5a2f[_0x8ff6('0xd')][_0x8ff6('0xf')]);}logger[_0x8ff6('0xd')](_0x8ff6('0x10'),_0x7d305c,_0x1f5a2f[_0x8ff6('0xd')][_0x8ff6('0xf')]);return _0x55e89f(_0x1f5a2f[_0x8ff6('0xd')]['message']);}else{logger['info'](_0x8ff6('0x10'),_0x7d305c,_0x8ff6('0xb'));_0x55e89f(_0x1f5a2f[_0x8ff6('0x11')][_0x8ff6('0xf')]);}})['catch'](function(_0x21ce87){logger[_0x8ff6('0xd')](_0x8ff6('0x10'),_0x7d305c,_0x21ce87);_0x1f4148(_0x21ce87);});});} \ No newline at end of file +var _0x8fd3=['catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x46fc6c,_0x297637){var _0x18694f=function(_0x34e1e0){while(--_0x34e1e0){_0x46fc6c['push'](_0x46fc6c['shift']());}};_0x18694f(++_0x297637);}(_0x8fd3,0x1a5));var _0x38fd=function(_0x4aec3e,_0x1c9afd){_0x4aec3e=_0x4aec3e-0x0;var _0x59cae3=_0x8fd3[_0x4aec3e];return _0x59cae3;};'use strict';var _=require(_0x38fd('0x0'));var util=require(_0x38fd('0x1'));var moment=require(_0x38fd('0x2'));var BPromise=require(_0x38fd('0x3'));var rs=require(_0x38fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x38fd('0x5'))(_0x38fd('0x6'));var config=require(_0x38fd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x38fd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12a3f0,_0x568b14,_0x4ea202){return new BPromise(function(_0x36be61,_0x1a2e0e){return client[_0x38fd('0x9')](_0x12a3f0,_0x4ea202)['then'](function(_0x1dfb6c){logger[_0x38fd('0xa')](_0x38fd('0xb'),_0x568b14,_0x38fd('0xc'));logger[_0x38fd('0xd')](_0x38fd('0xe'),_0x568b14,_0x38fd('0xc'),JSON[_0x38fd('0xf')](_0x1dfb6c));if(_0x1dfb6c['error']){if(_0x1dfb6c[_0x38fd('0x10')][_0x38fd('0x11')]===0x1f4){logger[_0x38fd('0x10')](_0x38fd('0xb'),_0x568b14,_0x1dfb6c[_0x38fd('0x10')][_0x38fd('0x12')]);return _0x1a2e0e(_0x1dfb6c[_0x38fd('0x10')][_0x38fd('0x12')]);}logger[_0x38fd('0x10')](_0x38fd('0xb'),_0x568b14,_0x1dfb6c['error'][_0x38fd('0x12')]);return _0x36be61(_0x1dfb6c[_0x38fd('0x10')]['message']);}else{logger[_0x38fd('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x568b14,_0x38fd('0xc'));_0x36be61(_0x1dfb6c['result'][_0x38fd('0x12')]);}})[_0x38fd('0x13')](function(_0x50eaa8){logger[_0x38fd('0x10')](_0x38fd('0xb'),_0x568b14,_0x50eaa8);_0x1a2e0e(_0x50eaa8);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 28e221f..7df96a9 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 _0x0979=['update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','show','/:id/preview','preview','/:id/run','run','query','post','create','put','/:id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0979,0x1a1));var _0x9097=function(_0x5d04ee,_0x2a38ca){_0x5d04ee=_0x5d04ee-0x0;var _0x4a666a=_0x0979[_0x5d04ee];return _0x4a666a;};'use strict';var multer=require(_0x9097('0x0'));var util=require(_0x9097('0x1'));var path=require('path');var timeout=require(_0x9097('0x2'));var express=require('express');var router=express[_0x9097('0x3')]();var fs_extra=require(_0x9097('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9097('0x5'));var config=require(_0x9097('0x6'));var controller=require(_0x9097('0x7'));router[_0x9097('0x8')]('/',auth[_0x9097('0x9')](),controller['index']);router[_0x9097('0x8')]('/:id',auth[_0x9097('0x9')](),controller[_0x9097('0xa')]);router[_0x9097('0x8')](_0x9097('0xb'),auth['isAuthenticated'](),controller[_0x9097('0xc')]);router[_0x9097('0x8')](_0x9097('0xd'),auth[_0x9097('0x9')](),controller[_0x9097('0xe')]);router['get']('/:id/query',auth[_0x9097('0x9')](),controller[_0x9097('0xf')]);router[_0x9097('0x10')]('/',auth['isAuthenticated'](),controller[_0x9097('0x11')]);router[_0x9097('0x12')](_0x9097('0x13'),auth[_0x9097('0x9')](),controller[_0x9097('0x14')]);router['delete'](_0x9097('0x13'),auth[_0x9097('0x9')](),controller[_0x9097('0x15')]);module[_0x9097('0x16')]=router; \ No newline at end of file +var _0x3d1f=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','isAuthenticated','show','/:id/preview','/:id/run','/:id/query','query','post','create','put','/:id','destroy','multer','util'];(function(_0x324496,_0x3a4cdd){var _0x899545=function(_0x506ef1){while(--_0x506ef1){_0x324496['push'](_0x324496['shift']());}};_0x899545(++_0x3a4cdd);}(_0x3d1f,0xfb));var _0xf3d1=function(_0x445af7,_0x2921ef){_0x445af7=_0x445af7-0x0;var _0x1ca9a2=_0x3d1f[_0x445af7];return _0x1ca9a2;};'use strict';var multer=require(_0xf3d1('0x0'));var util=require(_0xf3d1('0x1'));var path=require(_0xf3d1('0x2'));var timeout=require(_0xf3d1('0x3'));var express=require('express');var router=express[_0xf3d1('0x4')]();var fs_extra=require(_0xf3d1('0x5'));var auth=require(_0xf3d1('0x6'));var interaction=require(_0xf3d1('0x7'));var config=require(_0xf3d1('0x8'));var controller=require(_0xf3d1('0x9'));router[_0xf3d1('0xa')]('/',auth['isAuthenticated'](),controller[_0xf3d1('0xb')]);router[_0xf3d1('0xa')]('/:id',auth[_0xf3d1('0xc')](),controller[_0xf3d1('0xd')]);router['get'](_0xf3d1('0xe'),auth[_0xf3d1('0xc')](),controller['preview']);router[_0xf3d1('0xa')](_0xf3d1('0xf'),auth['isAuthenticated'](),controller['run']);router[_0xf3d1('0xa')](_0xf3d1('0x10'),auth[_0xf3d1('0xc')](),controller[_0xf3d1('0x11')]);router[_0xf3d1('0x12')]('/',auth[_0xf3d1('0xc')](),controller[_0xf3d1('0x13')]);router[_0xf3d1('0x14')](_0xf3d1('0x15'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf3d1('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 3361244..db2d18f 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 _0x39bd=['INTEGER','UNSIGNED','sequelize','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled'];(function(_0x388942,_0x5a6d67){var _0x513726=function(_0x2d9c13){while(--_0x2d9c13){_0x388942['push'](_0x388942['shift']());}};_0x513726(++_0x5a6d67);}(_0x39bd,0x18e));var _0xd39b=function(_0x5b8c27,_0x353d81){_0x5b8c27=_0x5b8c27-0x0;var _0x162976=_0x39bd[_0x5b8c27];return _0x162976;};'use strict';var Sequelize=require(_0xd39b('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0xd39b('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xd39b('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xd39b('0x2')](_0xd39b('0x3'),_0xd39b('0x4'),_0xd39b('0x5')),'allowNull':![],'defaultValue':_0xd39b('0x3')},'savename':{'type':Sequelize[_0xd39b('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd39b('0x6')]},'endDate':{'type':Sequelize[_0xd39b('0x6')]},'status':{'type':Sequelize[_0xd39b('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xd39b('0x2')](_0xd39b('0x7'),_0xd39b('0x8')),'allowNull':![],'defaultValue':_0xd39b('0x7')},'reportId':{'type':Sequelize[_0xd39b('0x9')](0xb)[_0xd39b('0xa')]},'reportType':{'type':Sequelize[_0xd39b('0x1')]}}; \ No newline at end of file +var _0x60a4=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual'];(function(_0x4af01f,_0x423477){var _0x3e02b9=function(_0x5c5626){while(--_0x5c5626){_0x4af01f['push'](_0x4af01f['shift']());}};_0x3e02b9(++_0x423477);}(_0x60a4,0x12d));var _0x460a=function(_0x52cbe2,_0x5afefb){_0x52cbe2=_0x52cbe2-0x0;var _0x277141=_0x60a4[_0x52cbe2];return _0x277141;};'use strict';var Sequelize=require(_0x460a('0x0'));var moment=require(_0x460a('0x1'));module[_0x460a('0x2')]={'name':{'type':Sequelize[_0x460a('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x460a('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x460a('0x4')](_0x460a('0x5'),_0x460a('0x6'),_0x460a('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x460a('0x8')]},'endDate':{'type':Sequelize[_0x460a('0x8')]},'status':{'type':Sequelize[_0x460a('0x3')],'defaultValue':_0x460a('0x9')},'type':{'type':Sequelize[_0x460a('0x4')](_0x460a('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0x460a('0xa')},'reportId':{'type':Sequelize[_0x460a('0xb')](0xb)[_0x460a('0xc')]},'reportType':{'type':Sequelize[_0x460a('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 76e041c..2f6b20c 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 _0x75b7=['join','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','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','undefined','limit','count','offset','set','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','stack','name','send','index','AnalyticExtractedReport','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','download','basename','savename','output','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x75b7,0xc4));var _0x775b=function(_0x3f893a,_0x2cb9cc){_0x3f893a=_0x3f893a-0x0;var _0x3eb3d6=_0x75b7[_0x3f893a];return _0x3eb3d6;};'use strict';var emlformat=require(_0x775b('0x0'));var rimraf=require(_0x775b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x775b('0x2'));var rp=require(_0x775b('0x3'));var moment=require(_0x775b('0x4'));var BPromise=require(_0x775b('0x5'));var Mustache=require(_0x775b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x775b('0x7'));var csv=require('to-csv');var ejs=require(_0x775b('0x8'));var fs=require('fs');var fs_extra=require(_0x775b('0x9'));var _=require('lodash');var squel=require(_0x775b('0xa'));var crypto=require(_0x775b('0xb'));var jsforce=require(_0x775b('0xc'));var deskjs=require(_0x775b('0xd'));var toCsv=require(_0x775b('0xe'));var querystring=require('querystring');var Papa=require(_0x775b('0xf'));var Redis=require(_0x775b('0x10'));var authService=require(_0x775b('0x11'));var qs=require(_0x775b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x775b('0x13'));var logger=require(_0x775b('0x14'))(_0x775b('0x15'));var utils=require(_0x775b('0x16'));var config=require(_0x775b('0x17'));var licenseUtil=require(_0x775b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2af854,_0x5bae1b){_0x5bae1b=_0x5bae1b||0xcc;return function(_0x1a94a0){if(_0x1a94a0){return _0x2af854[_0x775b('0x19')](_0x5bae1b);}return _0x2af854[_0x775b('0x1a')](_0x5bae1b)[_0x775b('0x1b')]();};}function respondWithResult(_0x2701ea,_0x8152a7){_0x8152a7=_0x8152a7||0xc8;return function(_0x57395b){if(_0x57395b){return _0x2701ea[_0x775b('0x1a')](_0x8152a7)[_0x775b('0x1c')](_0x57395b);}};}function respondWithFilteredResult(_0x209975,_0x4bde0a){return function(_0x5ac8bf){if(_0x5ac8bf){var _0x169362=typeof _0x4bde0a['offset']===_0x775b('0x1d')&&typeof _0x4bde0a[_0x775b('0x1e')]===_0x775b('0x1d');var _0x237988=_0x5ac8bf[_0x775b('0x1f')];var _0x29bfaa=_0x169362?0x0:_0x4bde0a[_0x775b('0x20')];var _0x19c6bb=_0x169362?_0x5ac8bf[_0x775b('0x1f')]:_0x4bde0a['offset']+_0x4bde0a[_0x775b('0x1e')];var _0x4a68a5;if(_0x19c6bb>=_0x237988){_0x19c6bb=_0x237988;_0x4a68a5=0xc8;}else{_0x4a68a5=0xce;}_0x209975[_0x775b('0x1a')](_0x4a68a5);return _0x209975[_0x775b('0x21')]('Content-Range',_0x29bfaa+'-'+_0x19c6bb+'/'+_0x237988)[_0x775b('0x1c')](_0x5ac8bf);}return null;};}function patchUpdates(_0x5cfba5){return function(_0x4718fa){try{jsonpatch['apply'](_0x4718fa,_0x5cfba5,!![]);}catch(_0x870744){return BPromise[_0x775b('0x22')](_0x870744);}return _0x4718fa[_0x775b('0x23')]();};}function saveUpdates(_0x4693eb,_0x265a6a){return function(_0x1ee408){if(_0x1ee408){return _0x1ee408[_0x775b('0x24')](_0x4693eb)[_0x775b('0x25')](function(_0x261e9d){return _0x261e9d;});}return null;};}function removeEntity(_0x10b75c,_0x3732ee){return function(_0x5db2f3){if(_0x5db2f3){return _0x5db2f3['destroy']()[_0x775b('0x25')](function(){var _0x285b0e=_0x5db2f3[_0x775b('0x26')]({'plain':!![]});var _0x25d160=_0x775b('0x27');return db[_0x775b('0x28')][_0x775b('0x29')]({'where':{'type':_0x25d160,'resourceId':_0x285b0e['id']}})[_0x775b('0x25')](function(){return _0x5db2f3;});})[_0x775b('0x25')](function(){_0x10b75c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e6ac7,_0xe0ec20){return function(_0x381084){if(!_0x381084){_0x4e6ac7['sendStatus'](0x194);}return _0x381084;};}function handleError(_0x14fe32,_0x394a49){_0x394a49=_0x394a49||0x1f4;return function(_0x36cce4){logger['error'](_0x36cce4[_0x775b('0x2a')]);if(_0x36cce4[_0x775b('0x2b')]){delete _0x36cce4['name'];}_0x14fe32[_0x775b('0x1a')](_0x394a49)[_0x775b('0x2c')](_0x36cce4);};}exports[_0x775b('0x2d')]=function(_0x10aad8,_0x2598fe){var _0x4fd129={},_0x818f3d={},_0x3348f0={'count':0x0,'rows':[]};var _0x54e0b6=_['map'](db[_0x775b('0x2e')]['rawAttributes'],function(_0x1ec4a9){return{'name':_0x1ec4a9[_0x775b('0x2f')],'type':_0x1ec4a9[_0x775b('0x30')][_0x775b('0x31')]};});_0x818f3d[_0x775b('0x32')]=_['map'](_0x54e0b6,_0x775b('0x2b'));_0x818f3d['query']=_[_0x775b('0x33')](_0x10aad8[_0x775b('0x34')]);_0x818f3d['filters']=_[_0x775b('0x35')](_0x818f3d[_0x775b('0x32')],_0x818f3d['query']);_0x4fd129['attributes']=_['intersection'](_0x818f3d['model'],qs[_0x775b('0x36')](_0x10aad8[_0x775b('0x34')][_0x775b('0x36')]));_0x4fd129[_0x775b('0x37')]=_0x4fd129[_0x775b('0x37')][_0x775b('0x38')]?_0x4fd129[_0x775b('0x37')]:_0x818f3d[_0x775b('0x32')];if(!_0x10aad8[_0x775b('0x34')][_0x775b('0x39')](_0x775b('0x3a'))){_0x4fd129['limit']=qs['limit'](_0x10aad8[_0x775b('0x34')]['limit']);_0x4fd129[_0x775b('0x20')]=qs[_0x775b('0x20')](_0x10aad8[_0x775b('0x34')]['offset']);}_0x4fd129[_0x775b('0x3b')]=qs['sort'](_0x10aad8[_0x775b('0x34')][_0x775b('0x3c')]);_0x4fd129[_0x775b('0x3d')]=qs[_0x775b('0x3e')](_[_0x775b('0x3f')](_0x10aad8['query'],_0x818f3d[_0x775b('0x3e')]),_0x54e0b6);if(_0x10aad8[_0x775b('0x34')][_0x775b('0x40')]){_0x4fd129[_0x775b('0x3d')]=_[_0x775b('0x41')](_0x4fd129['where'],{'$or':_['map'](_0x54e0b6,function(_0x523983){if(_0x523983['type']!=='VIRTUAL'){var _0x3d7534={};_0x3d7534[_0x523983['name']]={'$like':'%'+_0x10aad8[_0x775b('0x34')][_0x775b('0x40')]+'%'};return _0x3d7534;}})});}_0x4fd129=_[_0x775b('0x41')]({},_0x4fd129,_0x10aad8[_0x775b('0x42')]);var _0x4ac034={'where':_0x4fd129[_0x775b('0x3d')]};return db[_0x775b('0x2e')][_0x775b('0x1f')](_0x4ac034)[_0x775b('0x25')](function(_0x2b2746){_0x3348f0['count']=_0x2b2746;if(_0x10aad8[_0x775b('0x34')][_0x775b('0x43')]){_0x4fd129[_0x775b('0x44')]=[{'all':!![]}];}return db[_0x775b('0x2e')][_0x775b('0x45')](_0x4fd129);})['then'](function(_0x3ff226){_0x3348f0[_0x775b('0x46')]=_0x3ff226;return _0x3348f0;})[_0x775b('0x25')](respondWithFilteredResult(_0x2598fe,_0x4fd129))['catch'](handleError(_0x2598fe,null));};exports[_0x775b('0x47')]=function(_0x2a2098,_0x1fab2f){var _0x3dbbb={'raw':!![],'where':{'id':_0x2a2098['params']['id']}},_0x45d3aa={};_0x45d3aa['model']=_[_0x775b('0x33')](db[_0x775b('0x2e')]['rawAttributes']);_0x45d3aa[_0x775b('0x34')]=_[_0x775b('0x33')](_0x2a2098['query']);_0x45d3aa[_0x775b('0x3e')]=_['intersection'](_0x45d3aa['model'],_0x45d3aa['query']);_0x3dbbb[_0x775b('0x37')]=_[_0x775b('0x35')](_0x45d3aa[_0x775b('0x32')],qs['fields'](_0x2a2098[_0x775b('0x34')]['fields']));_0x3dbbb[_0x775b('0x37')]=_0x3dbbb[_0x775b('0x37')]['length']?_0x3dbbb[_0x775b('0x37')]:_0x45d3aa['model'];if(_0x2a2098['query']['includeAll']){_0x3dbbb[_0x775b('0x44')]=[{'all':!![]}];}_0x3dbbb=_[_0x775b('0x41')]({},_0x3dbbb,_0x2a2098['options']);return db[_0x775b('0x2e')][_0x775b('0x48')](_0x3dbbb)[_0x775b('0x25')](handleEntityNotFound(_0x1fab2f,null))[_0x775b('0x25')](respondWithResult(_0x1fab2f,null))[_0x775b('0x49')](handleError(_0x1fab2f,null));};exports[_0x775b('0x4a')]=function(_0x12e9bc,_0x384084){return db['AnalyticExtractedReport'][_0x775b('0x4a')](_0x12e9bc[_0x775b('0x4b')],{})['then'](function(_0x516d65){var _0x3f3a61=_0x12e9bc[_0x775b('0x4c')][_0x775b('0x26')]({'plain':!![]});if(!_0x3f3a61)throw new Error(_0x775b('0x4d'));if(_0x3f3a61['role']===_0x775b('0x4c')){var _0x1125b4=_0x516d65['get']({'plain':!![]});var _0x500be7='ExtractedReports';return db[_0x775b('0x4e')][_0x775b('0x48')]({'where':{'name':_0x500be7,'userProfileId':_0x3f3a61[_0x775b('0x4f')]},'raw':!![]})[_0x775b('0x25')](function(_0x21b3e9){if(_0x21b3e9&&_0x21b3e9[_0x775b('0x50')]===0x0){return db['UserProfileResource'][_0x775b('0x4a')]({'name':_0x1125b4[_0x775b('0x2b')],'resourceId':_0x1125b4['id'],'type':_0x21b3e9[_0x775b('0x2b')],'sectionId':_0x21b3e9['id']},{})['then'](function(){return _0x516d65;});}else{return _0x516d65;}})[_0x775b('0x49')](function(_0x5697fd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5697fd);throw _0x5697fd;});}return _0x516d65;})[_0x775b('0x25')](respondWithResult(_0x384084,0xc9))[_0x775b('0x49')](handleError(_0x384084,null));};exports[_0x775b('0x24')]=function(_0xbe43b9,_0x4a0c1d){if(_0xbe43b9['body']['id']){delete _0xbe43b9[_0x775b('0x4b')]['id'];}return db[_0x775b('0x2e')][_0x775b('0x48')]({'where':{'id':_0xbe43b9[_0x775b('0x51')]['id']}})[_0x775b('0x25')](handleEntityNotFound(_0x4a0c1d,null))[_0x775b('0x25')](saveUpdates(_0xbe43b9['body'],null))[_0x775b('0x25')](respondWithResult(_0x4a0c1d,null))[_0x775b('0x49')](handleError(_0x4a0c1d,null));};exports[_0x775b('0x29')]=function(_0x377a18,_0x573293){return db[_0x775b('0x2e')]['find']({'where':{'id':_0x377a18['params']['id']}})['then'](handleEntityNotFound(_0x573293,null))[_0x775b('0x25')](removeEntity(_0x573293,null))[_0x775b('0x49')](handleError(_0x573293,null));};exports[_0x775b('0x52')]=function(_0x2e2ee7,_0x27b9d6,_0x6a1815){return db['AnalyticExtractedReport'][_0x775b('0x48')]({'where':{'id':_0x2e2ee7[_0x775b('0x51')]['id']},'attributes':['name',_0x775b('0x53'),_0x775b('0x54'),_0x775b('0x55')],'raw':!![]})[_0x775b('0x25')](handleEntityNotFound(_0x27b9d6,null))[_0x775b('0x25')](function(_0x3eec41){if(_0x3eec41){if(!fs['existsSync'](path['join'](config[_0x775b('0x56')],_0x775b('0x57'),_0x3eec41[_0x775b('0x54')]))){throw new db[(_0x775b('0x58'))][(_0x775b('0x59'))](_0x775b('0x5a'));}if(_0x2e2ee7[_0x775b('0x34')][_0x775b('0x5b')]){return _0x27b9d6[_0x775b('0x19')](0xc8);}return _0x27b9d6[_0x775b('0x52')](path[_0x775b('0x5c')](config[_0x775b('0x56')],_0x775b('0x57'),_0x3eec41[_0x775b('0x54')]),util[_0x775b('0x5d')](_0x775b('0x5e'),_0x3eec41[_0x775b('0x53')]||_0x3eec41[_0x775b('0x2b')],_0x3eec41[_0x775b('0x55')][_0x775b('0x5f')]()));}})[_0x775b('0x49')](handleError(_0x27b9d6,null));}; \ No newline at end of file +var _0xde96=['query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','fields','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','destroy','download','basename','savename','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','output','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key'];(function(_0x14a34f,_0x250eec){var _0x32676c=function(_0x414e9e){while(--_0x414e9e){_0x14a34f['push'](_0x14a34f['shift']());}};_0x32676c(++_0x250eec);}(_0xde96,0x14e));var _0x6de9=function(_0x155806,_0x41696e){_0x155806=_0x155806-0x0;var _0x102397=_0xde96[_0x155806];return _0x102397;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6de9('0x0'));var zipdir=require(_0x6de9('0x1'));var jsonpatch=require(_0x6de9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6de9('0x3'));var Mustache=require(_0x6de9('0x4'));var util=require(_0x6de9('0x5'));var path=require(_0x6de9('0x6'));var sox=require(_0x6de9('0x7'));var csv=require(_0x6de9('0x8'));var ejs=require(_0x6de9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6de9('0xa'));var squel=require(_0x6de9('0xb'));var crypto=require('crypto');var jsforce=require(_0x6de9('0xc'));var deskjs=require(_0x6de9('0xd'));var toCsv=require(_0x6de9('0x8'));var querystring=require(_0x6de9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6de9('0xf'));var as=require(_0x6de9('0x10'));var hardwareService=require(_0x6de9('0x11'));var logger=require(_0x6de9('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(_0x2659d7,_0xa38219){_0xa38219=_0xa38219||0xcc;return function(_0x1290bb){if(_0x1290bb){return _0x2659d7[_0x6de9('0x13')](_0xa38219);}return _0x2659d7[_0x6de9('0x14')](_0xa38219)[_0x6de9('0x15')]();};}function respondWithResult(_0x53f28b,_0x392c13){_0x392c13=_0x392c13||0xc8;return function(_0x2bdf60){if(_0x2bdf60){return _0x53f28b[_0x6de9('0x14')](_0x392c13)[_0x6de9('0x16')](_0x2bdf60);}};}function respondWithFilteredResult(_0xbb752a,_0x276191){return function(_0x215a09){if(_0x215a09){var _0x3f8cd8=typeof _0x276191[_0x6de9('0x17')]===_0x6de9('0x18')&&typeof _0x276191[_0x6de9('0x19')]===_0x6de9('0x18');var _0x2745f7=_0x215a09[_0x6de9('0x1a')];var _0x1b4142=_0x3f8cd8?0x0:_0x276191[_0x6de9('0x17')];var _0x48d8c1=_0x3f8cd8?_0x215a09[_0x6de9('0x1a')]:_0x276191[_0x6de9('0x17')]+_0x276191[_0x6de9('0x19')];var _0x31f47e;if(_0x48d8c1>=_0x2745f7){_0x48d8c1=_0x2745f7;_0x31f47e=0xc8;}else{_0x31f47e=0xce;}_0xbb752a[_0x6de9('0x14')](_0x31f47e);return _0xbb752a[_0x6de9('0x1b')](_0x6de9('0x1c'),_0x1b4142+'-'+_0x48d8c1+'/'+_0x2745f7)['json'](_0x215a09);}return null;};}function patchUpdates(_0x205338){return function(_0x14faef){try{jsonpatch['apply'](_0x14faef,_0x205338,!![]);}catch(_0x22255f){return BPromise[_0x6de9('0x1d')](_0x22255f);}return _0x14faef[_0x6de9('0x1e')]();};}function saveUpdates(_0x1d3292,_0x798f47){return function(_0x31497f){if(_0x31497f){return _0x31497f[_0x6de9('0x1f')](_0x1d3292)['then'](function(_0x2f2956){return _0x2f2956;});}return null;};}function removeEntity(_0x2dbfc0,_0x508026){return function(_0x44829f){if(_0x44829f){return _0x44829f['destroy']()[_0x6de9('0x20')](function(){var _0x147582=_0x44829f[_0x6de9('0x21')]({'plain':!![]});var _0x1c5f18=_0x6de9('0x22');return db[_0x6de9('0x23')]['destroy']({'where':{'type':_0x1c5f18,'resourceId':_0x147582['id']}})[_0x6de9('0x20')](function(){return _0x44829f;});})[_0x6de9('0x20')](function(){_0x2dbfc0[_0x6de9('0x14')](0xcc)[_0x6de9('0x15')]();});}};}function handleEntityNotFound(_0x3c6a08,_0x4a561f){return function(_0x2235e2){if(!_0x2235e2){_0x3c6a08['sendStatus'](0x194);}return _0x2235e2;};}function handleError(_0x2acdfc,_0x4a4271){_0x4a4271=_0x4a4271||0x1f4;return function(_0x58c924){logger[_0x6de9('0x24')](_0x58c924[_0x6de9('0x25')]);if(_0x58c924[_0x6de9('0x26')]){delete _0x58c924[_0x6de9('0x26')];}_0x2acdfc['status'](_0x4a4271)[_0x6de9('0x27')](_0x58c924);};}exports[_0x6de9('0x28')]=function(_0x4270dd,_0xefb84a){var _0x1365e2={},_0x5b406f={},_0x5d18d1={'count':0x0,'rows':[]};var _0x12ba0b=_[_0x6de9('0x29')](db[_0x6de9('0x2a')]['rawAttributes'],function(_0x3c7847){return{'name':_0x3c7847[_0x6de9('0x2b')],'type':_0x3c7847[_0x6de9('0x2c')][_0x6de9('0x2d')]};});_0x5b406f['model']=_[_0x6de9('0x29')](_0x12ba0b,_0x6de9('0x26'));_0x5b406f[_0x6de9('0x2e')]=_[_0x6de9('0x2f')](_0x4270dd['query']);_0x5b406f[_0x6de9('0x30')]=_['intersection'](_0x5b406f[_0x6de9('0x31')],_0x5b406f[_0x6de9('0x2e')]);_0x1365e2[_0x6de9('0x32')]=_[_0x6de9('0x33')](_0x5b406f[_0x6de9('0x31')],qs['fields'](_0x4270dd[_0x6de9('0x2e')]['fields']));_0x1365e2[_0x6de9('0x32')]=_0x1365e2[_0x6de9('0x32')][_0x6de9('0x34')]?_0x1365e2['attributes']:_0x5b406f[_0x6de9('0x31')];if(!_0x4270dd[_0x6de9('0x2e')][_0x6de9('0x35')](_0x6de9('0x36'))){_0x1365e2[_0x6de9('0x19')]=qs[_0x6de9('0x19')](_0x4270dd['query'][_0x6de9('0x19')]);_0x1365e2[_0x6de9('0x17')]=qs[_0x6de9('0x17')](_0x4270dd[_0x6de9('0x2e')]['offset']);}_0x1365e2[_0x6de9('0x37')]=qs[_0x6de9('0x38')](_0x4270dd['query'][_0x6de9('0x38')]);_0x1365e2[_0x6de9('0x39')]=qs[_0x6de9('0x30')](_[_0x6de9('0x3a')](_0x4270dd[_0x6de9('0x2e')],_0x5b406f[_0x6de9('0x30')]),_0x12ba0b);if(_0x4270dd[_0x6de9('0x2e')][_0x6de9('0x3b')]){_0x1365e2[_0x6de9('0x39')]=_[_0x6de9('0x3c')](_0x1365e2['where'],{'$or':_[_0x6de9('0x29')](_0x12ba0b,function(_0x3a6072){if(_0x3a6072[_0x6de9('0x2c')]!==_0x6de9('0x3d')){var _0x2edc69={};_0x2edc69[_0x3a6072[_0x6de9('0x26')]]={'$like':'%'+_0x4270dd[_0x6de9('0x2e')][_0x6de9('0x3b')]+'%'};return _0x2edc69;}})});}_0x1365e2=_[_0x6de9('0x3c')]({},_0x1365e2,_0x4270dd[_0x6de9('0x3e')]);var _0x13c7f2={'where':_0x1365e2['where']};return db[_0x6de9('0x2a')][_0x6de9('0x1a')](_0x13c7f2)[_0x6de9('0x20')](function(_0x4b5b2a){_0x5d18d1[_0x6de9('0x1a')]=_0x4b5b2a;if(_0x4270dd['query'][_0x6de9('0x3f')]){_0x1365e2[_0x6de9('0x40')]=[{'all':!![]}];}return db[_0x6de9('0x2a')][_0x6de9('0x41')](_0x1365e2);})[_0x6de9('0x20')](function(_0x182ac2){_0x5d18d1['rows']=_0x182ac2;return _0x5d18d1;})[_0x6de9('0x20')](respondWithFilteredResult(_0xefb84a,_0x1365e2))[_0x6de9('0x42')](handleError(_0xefb84a,null));};exports[_0x6de9('0x43')]=function(_0x14ee39,_0xa22e56){var _0x44d787={'raw':!![],'where':{'id':_0x14ee39[_0x6de9('0x44')]['id']}},_0x32015a={};_0x32015a[_0x6de9('0x31')]=_[_0x6de9('0x2f')](db[_0x6de9('0x2a')][_0x6de9('0x45')]);_0x32015a[_0x6de9('0x2e')]=_['keys'](_0x14ee39[_0x6de9('0x2e')]);_0x32015a[_0x6de9('0x30')]=_[_0x6de9('0x33')](_0x32015a[_0x6de9('0x31')],_0x32015a['query']);_0x44d787[_0x6de9('0x32')]=_[_0x6de9('0x33')](_0x32015a['model'],qs[_0x6de9('0x46')](_0x14ee39[_0x6de9('0x2e')][_0x6de9('0x46')]));_0x44d787[_0x6de9('0x32')]=_0x44d787['attributes'][_0x6de9('0x34')]?_0x44d787[_0x6de9('0x32')]:_0x32015a[_0x6de9('0x31')];if(_0x14ee39['query'][_0x6de9('0x3f')]){_0x44d787['include']=[{'all':!![]}];}_0x44d787=_[_0x6de9('0x3c')]({},_0x44d787,_0x14ee39['options']);return db[_0x6de9('0x2a')][_0x6de9('0x47')](_0x44d787)['then'](handleEntityNotFound(_0xa22e56,null))[_0x6de9('0x20')](respondWithResult(_0xa22e56,null))[_0x6de9('0x42')](handleError(_0xa22e56,null));};exports[_0x6de9('0x48')]=function(_0x4e50cd,_0x205723){return db[_0x6de9('0x2a')]['create'](_0x4e50cd[_0x6de9('0x49')],{})['then'](function(_0x3a4c24){var _0x41223a=_0x4e50cd[_0x6de9('0x4a')][_0x6de9('0x21')]({'plain':!![]});if(!_0x41223a)throw new Error(_0x6de9('0x4b'));if(_0x41223a[_0x6de9('0x4c')]===_0x6de9('0x4a')){var _0x289cd4=_0x3a4c24[_0x6de9('0x21')]({'plain':!![]});var _0x4a98ee=_0x6de9('0x22');return db[_0x6de9('0x4d')]['find']({'where':{'name':_0x4a98ee,'userProfileId':_0x41223a[_0x6de9('0x4e')]},'raw':!![]})[_0x6de9('0x20')](function(_0x40ddea){if(_0x40ddea&&_0x40ddea[_0x6de9('0x4f')]===0x0){return db[_0x6de9('0x23')][_0x6de9('0x48')]({'name':_0x289cd4[_0x6de9('0x26')],'resourceId':_0x289cd4['id'],'type':_0x40ddea[_0x6de9('0x26')],'sectionId':_0x40ddea['id']},{})[_0x6de9('0x20')](function(){return _0x3a4c24;});}else{return _0x3a4c24;}})['catch'](function(_0x1b4850){logger[_0x6de9('0x24')](_0x6de9('0x50'),_0x1b4850);throw _0x1b4850;});}return _0x3a4c24;})[_0x6de9('0x20')](respondWithResult(_0x205723,0xc9))[_0x6de9('0x42')](handleError(_0x205723,null));};exports[_0x6de9('0x1f')]=function(_0xedaf1,_0x3b56f7){if(_0xedaf1[_0x6de9('0x49')]['id']){delete _0xedaf1[_0x6de9('0x49')]['id'];}return db[_0x6de9('0x2a')][_0x6de9('0x47')]({'where':{'id':_0xedaf1[_0x6de9('0x44')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x3b56f7,null))[_0x6de9('0x20')](saveUpdates(_0xedaf1['body'],null))[_0x6de9('0x20')](respondWithResult(_0x3b56f7,null))[_0x6de9('0x42')](handleError(_0x3b56f7,null));};exports[_0x6de9('0x51')]=function(_0x2a4bf6,_0x1046db){return db[_0x6de9('0x2a')][_0x6de9('0x47')]({'where':{'id':_0x2a4bf6[_0x6de9('0x44')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x1046db,null))[_0x6de9('0x20')](removeEntity(_0x1046db,null))[_0x6de9('0x42')](handleError(_0x1046db,null));};exports[_0x6de9('0x52')]=function(_0x347214,_0x302233,_0x25ff0c){return db[_0x6de9('0x2a')][_0x6de9('0x47')]({'where':{'id':_0x347214[_0x6de9('0x44')]['id']},'attributes':[_0x6de9('0x26'),_0x6de9('0x53'),_0x6de9('0x54'),'output'],'raw':!![]})[_0x6de9('0x20')](handleEntityNotFound(_0x302233,null))['then'](function(_0x5b7c2e){if(_0x5b7c2e){if(!fs[_0x6de9('0x55')](path[_0x6de9('0x56')](config['root'],_0x6de9('0x57'),_0x5b7c2e[_0x6de9('0x54')]))){throw new db[(_0x6de9('0x58'))][(_0x6de9('0x59'))](_0x6de9('0x5a'));}if(_0x347214[_0x6de9('0x2e')][_0x6de9('0x5b')]){return _0x302233[_0x6de9('0x13')](0xc8);}return _0x302233[_0x6de9('0x52')](path[_0x6de9('0x56')](config[_0x6de9('0x5c')],_0x6de9('0x57'),_0x5b7c2e['savename']),util[_0x6de9('0x5d')]('%s.%s',_0x5b7c2e[_0x6de9('0x53')]||_0x5b7c2e['name'],_0x5b7c2e[_0x6de9('0x5e')]['toLowerCase']()));}})['catch'](handleError(_0x302233,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index df7c988..7fb37e5 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 _0x1acc=['request-promise','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','api','moment','bluebird'];(function(_0x14379b,_0x253026){var _0x2db08e=function(_0x94f716){while(--_0x94f716){_0x14379b['push'](_0x14379b['shift']());}};_0x2db08e(++_0x253026);}(_0x1acc,0xec));var _0xc1ac=function(_0x344c41,_0x49a16d){_0x344c41=_0x344c41-0x0;var _0x3ecfc9=_0x1acc[_0x344c41];return _0x3ecfc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc1ac('0x0'))(_0xc1ac('0x1'));var moment=require(_0xc1ac('0x2'));var BPromise=require(_0xc1ac('0x3'));var rp=require(_0xc1ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc1ac('0x5'));var attributes=require(_0xc1ac('0x6'));module[_0xc1ac('0x7')]=function(_0x3cd004,_0x209be0){return _0x3cd004['define'](_0xc1ac('0x8'),attributes,{'tableName':_0xc1ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x124f=['request-promise','path','../../config/environment','exports','AnalyticExtractedReport','../../config/logger','api','bluebird'];(function(_0x46a3b0,_0xfa6e4){var _0x2e3980=function(_0x43ce3b){while(--_0x43ce3b){_0x46a3b0['push'](_0x46a3b0['shift']());}};_0x2e3980(++_0xfa6e4);}(_0x124f,0x18d));var _0xf124=function(_0x295cc1,_0x2664fb){_0x295cc1=_0x295cc1-0x0;var _0x4f5dbc=_0x124f[_0x295cc1];return _0x4f5dbc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf124('0x0'))(_0xf124('0x1'));var moment=require('moment');var BPromise=require(_0xf124('0x2'));var rp=require(_0xf124('0x3'));var fs=require('fs');var path=require(_0xf124('0x4'));var rimraf=require('rimraf');var config=require(_0xf124('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0xf124('0x6')]=function(_0x506ebb,_0xbeb49f){return _0x506ebb['define'](_0xf124('0x7'),attributes,{'tableName':'analytics_extracted_reports','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 568e343..e02e32c 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 _0x0b70=['info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x510728,_0x2a9c0b){var _0x18cb8d=function(_0x4ebd6d){while(--_0x4ebd6d){_0x510728['push'](_0x510728['shift']());}};_0x18cb8d(++_0x2a9c0b);}(_0x0b70,0x159));var _0x00b7=function(_0x14a584,_0xed8364){_0x14a584=_0x14a584-0x0;var _0x57d0ec=_0x0b70[_0x14a584];return _0x57d0ec;};'use strict';var _=require('lodash');var util=require(_0x00b7('0x0'));var moment=require('moment');var BPromise=require(_0x00b7('0x1'));var rs=require(_0x00b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00b7('0x3'))['db'];var utils=require(_0x00b7('0x4'));var logger=require(_0x00b7('0x5'))('rpc');var config=require(_0x00b7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x00b7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8137,_0x5a2dee,_0xa57ae4){return new BPromise(function(_0x56adcc,_0x420f35){return client[_0x00b7('0x8')](_0x3f8137,_0xa57ae4)[_0x00b7('0x9')](function(_0x203c15){logger['info'](_0x00b7('0xa'),_0x5a2dee,_0x00b7('0xb'));logger[_0x00b7('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x5a2dee,_0x00b7('0xb'),JSON['stringify'](_0x203c15));if(_0x203c15[_0x00b7('0xd')]){if(_0x203c15[_0x00b7('0xd')][_0x00b7('0xe')]===0x1f4){logger[_0x00b7('0xd')](_0x00b7('0xa'),_0x5a2dee,_0x203c15[_0x00b7('0xd')][_0x00b7('0xf')]);return _0x420f35(_0x203c15[_0x00b7('0xd')][_0x00b7('0xf')]);}logger[_0x00b7('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5a2dee,_0x203c15[_0x00b7('0xd')][_0x00b7('0xf')]);return _0x56adcc(_0x203c15['error']['message']);}else{logger[_0x00b7('0x10')](_0x00b7('0xa'),_0x5a2dee,_0x00b7('0xb'));_0x56adcc(_0x203c15[_0x00b7('0x11')][_0x00b7('0xf')]);}})[_0x00b7('0x12')](function(_0x342b82){logger[_0x00b7('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5a2dee,_0x342b82);_0x420f35(_0x342b82);});});} \ No newline at end of file +var _0xf36b=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x3f9e8c,_0x4f6caf){var _0x590945=function(_0x566887){while(--_0x566887){_0x3f9e8c['push'](_0x3f9e8c['shift']());}};_0x590945(++_0x4f6caf);}(_0xf36b,0x127));var _0xbf36=function(_0x53f1b7,_0x355294){_0x53f1b7=_0x53f1b7-0x0;var _0x32669c=_0xf36b[_0x53f1b7];return _0x32669c;};'use strict';var _=require(_0xbf36('0x0'));var util=require(_0xbf36('0x1'));var moment=require(_0xbf36('0x2'));var BPromise=require(_0xbf36('0x3'));var rs=require(_0xbf36('0x4'));var fs=require('fs');var Redis=require(_0xbf36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf36('0x6'));var logger=require(_0xbf36('0x7'))(_0xbf36('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbf36('0x9')][_0xbf36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x582e62,_0x36fcf5,_0x3187e9){return new BPromise(function(_0x4f84d6,_0x12aea9){return client[_0xbf36('0xb')](_0x582e62,_0x3187e9)[_0xbf36('0xc')](function(_0x42a29d){logger[_0xbf36('0xd')](_0xbf36('0xe'),_0x36fcf5,_0xbf36('0xf'));logger[_0xbf36('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x36fcf5,_0xbf36('0xf'),JSON[_0xbf36('0x11')](_0x42a29d));if(_0x42a29d[_0xbf36('0x12')]){if(_0x42a29d[_0xbf36('0x12')][_0xbf36('0x13')]===0x1f4){logger[_0xbf36('0x12')](_0xbf36('0xe'),_0x36fcf5,_0x42a29d[_0xbf36('0x12')][_0xbf36('0x14')]);return _0x12aea9(_0x42a29d[_0xbf36('0x12')][_0xbf36('0x14')]);}logger[_0xbf36('0x12')](_0xbf36('0xe'),_0x36fcf5,_0x42a29d[_0xbf36('0x12')][_0xbf36('0x14')]);return _0x4f84d6(_0x42a29d[_0xbf36('0x12')]['message']);}else{logger[_0xbf36('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x36fcf5,_0xbf36('0xf'));_0x4f84d6(_0x42a29d[_0xbf36('0x15')][_0xbf36('0x14')]);}})['catch'](function(_0x3f41cc){logger[_0xbf36('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x36fcf5,_0x3f41cc);_0x12aea9(_0x3f41cc);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5c722c1..32b53d3 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 _0xe57f=['update','destroy','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','/:id/download','isAuthenticated','create'];(function(_0x48561a,_0x424b41){var _0x328ba7=function(_0x1f5369){while(--_0x1f5369){_0x48561a['push'](_0x48561a['shift']());}};_0x328ba7(++_0x424b41);}(_0xe57f,0x1e3));var _0xfe57=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe57f[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfe57('0x0'));var timeout=require('connect-timeout');var express=require(_0xfe57('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfe57('0x2'));var interaction=require(_0xfe57('0x3'));var config=require(_0xfe57('0x4'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfe57('0x5')]);router[_0xfe57('0x6')](_0xfe57('0x7'),auth['isAuthenticated'](),controller[_0xfe57('0x8')]);router[_0xfe57('0x6')](_0xfe57('0x9'),auth[_0xfe57('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xfe57('0xb')]);router['put'](_0xfe57('0x7'),auth['isAuthenticated'](),controller[_0xfe57('0xc')]);router['delete'](_0xfe57('0x7'),auth['isAuthenticated'](),controller[_0xfe57('0xd')]);module[_0xfe57('0xe')]=router; \ No newline at end of file +var _0x87f3=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','destroy','exports'];(function(_0x10edeb,_0x1b93b8){var _0x1c5fea=function(_0x16a1c5){while(--_0x16a1c5){_0x10edeb['push'](_0x10edeb['shift']());}};_0x1c5fea(++_0x1b93b8);}(_0x87f3,0x69));var _0x387f=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x87f3[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x387f('0x0'));var util=require('util');var path=require(_0x387f('0x1'));var timeout=require(_0x387f('0x2'));var express=require('express');var router=express[_0x387f('0x3')]();var fs_extra=require(_0x387f('0x4'));var auth=require(_0x387f('0x5'));var interaction=require(_0x387f('0x6'));var config=require(_0x387f('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0x387f('0x8')]('/',auth[_0x387f('0x9')](),controller[_0x387f('0xa')]);router['get'](_0x387f('0xb'),auth['isAuthenticated'](),controller[_0x387f('0xc')]);router[_0x387f('0x8')](_0x387f('0xd'),auth[_0x387f('0x9')](),controller[_0x387f('0xe')]);router[_0x387f('0xf')]('/',auth[_0x387f('0x9')](),controller[_0x387f('0x10')]);router[_0x387f('0x11')](_0x387f('0xb'),auth['isAuthenticated'](),controller[_0x387f('0x12')]);router['delete'](_0x387f('0xb'),auth['isAuthenticated'](),controller[_0x387f('0x13')]);module[_0x387f('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index d524401..6f1d358 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 _0xa5d0=['TEXT','STRING','sequelize','exports'];(function(_0x58b782,_0x394475){var _0x3f2c13=function(_0x1b216a){while(--_0x1b216a){_0x58b782['push'](_0x58b782['shift']());}};_0x3f2c13(++_0x394475);}(_0xa5d0,0x1be));var _0x0a5d=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xa5d0[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0x0a5d('0x0'));module[_0x0a5d('0x1')]={'field':{'type':Sequelize[_0x0a5d('0x2')]},'alias':{'type':Sequelize[_0x0a5d('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0a5d('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0a5d('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0a38=['BOOLEAN','exports','STRING'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x0a38,0xc1));var _0x80a3=function(_0x4b2088,_0x3facc7){_0x4b2088=_0x4b2088-0x0;var _0x49c48d=_0x0a38[_0x4b2088];return _0x49c48d;};'use strict';var Sequelize=require('sequelize');module[_0x80a3('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x80a3('0x1')]},'format':{'type':Sequelize[_0x80a3('0x1')]},'groupBy':{'type':Sequelize[_0x80a3('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x80a3('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 83bfd5b..f64c6d1 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 _0x04a3=['index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0xe7eb35,_0x2bd730){var _0x2e8494=function(_0xd9a933){while(--_0xd9a933){_0xe7eb35['push'](_0xe7eb35['shift']());}};_0x2e8494(++_0x2bd730);}(_0x04a3,0x16f));var _0x304a=function(_0x48a06f,_0x152e72){_0x48a06f=_0x48a06f-0x0;var _0x3e75e4=_0x04a3[_0x48a06f];return _0x3e75e4;};'use strict';var emlformat=require(_0x304a('0x0'));var rimraf=require(_0x304a('0x1'));var zipdir=require(_0x304a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x304a('0x3'));var moment=require(_0x304a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x304a('0x5'));var util=require('util');var path=require(_0x304a('0x6'));var sox=require(_0x304a('0x7'));var csv=require(_0x304a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x304a('0x9'));var squel=require('squel');var crypto=require(_0x304a('0xa'));var jsforce=require(_0x304a('0xb'));var deskjs=require(_0x304a('0xc'));var toCsv=require(_0x304a('0x8'));var querystring=require(_0x304a('0xd'));var Papa=require(_0x304a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x304a('0xf'));var as=require(_0x304a('0x10'));var hardwareService=require(_0x304a('0x11'));var logger=require(_0x304a('0x12'))(_0x304a('0x13'));var utils=require(_0x304a('0x14'));var config=require(_0x304a('0x15'));var licenseUtil=require(_0x304a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540089,_0x40c1c6){_0x40c1c6=_0x40c1c6||0xcc;return function(_0x12a12d){if(_0x12a12d){return _0x540089[_0x304a('0x17')](_0x40c1c6);}return _0x540089[_0x304a('0x18')](_0x40c1c6)[_0x304a('0x19')]();};}function respondWithResult(_0x15f1a4,_0x249049){_0x249049=_0x249049||0xc8;return function(_0x37f28d){if(_0x37f28d){return _0x15f1a4['status'](_0x249049)[_0x304a('0x1a')](_0x37f28d);}};}function respondWithFilteredResult(_0x5791e2,_0xd83942){return function(_0x5be09a){if(_0x5be09a){var _0x535b9d=typeof _0xd83942[_0x304a('0x1b')]===_0x304a('0x1c')&&typeof _0xd83942[_0x304a('0x1d')]===_0x304a('0x1c');var _0x2d5bb1=_0x5be09a[_0x304a('0x1e')];var _0x9e4847=_0x535b9d?0x0:_0xd83942['offset'];var _0x32e689=_0x535b9d?_0x5be09a[_0x304a('0x1e')]:_0xd83942['offset']+_0xd83942[_0x304a('0x1d')];var _0x5a16f8;if(_0x32e689>=_0x2d5bb1){_0x32e689=_0x2d5bb1;_0x5a16f8=0xc8;}else{_0x5a16f8=0xce;}_0x5791e2['status'](_0x5a16f8);return _0x5791e2[_0x304a('0x1f')](_0x304a('0x20'),_0x9e4847+'-'+_0x32e689+'/'+_0x2d5bb1)[_0x304a('0x1a')](_0x5be09a);}return null;};}function patchUpdates(_0x3f9cd4){return function(_0x5537ec){try{jsonpatch[_0x304a('0x21')](_0x5537ec,_0x3f9cd4,!![]);}catch(_0x53da11){return BPromise[_0x304a('0x22')](_0x53da11);}return _0x5537ec[_0x304a('0x23')]();};}function saveUpdates(_0x46d0c4,_0x55bbe3){return function(_0x50df41){if(_0x50df41){return _0x50df41[_0x304a('0x24')](_0x46d0c4)[_0x304a('0x25')](function(_0x39d49e){return _0x39d49e;});}return null;};}function removeEntity(_0x4f7d08,_0xbffa98){return function(_0x15ae8){if(_0x15ae8){return _0x15ae8[_0x304a('0x26')]()[_0x304a('0x25')](function(){_0x4f7d08[_0x304a('0x18')](0xcc)[_0x304a('0x19')]();});}};}function handleEntityNotFound(_0x12d38b,_0x475b82){return function(_0x11cd30){if(!_0x11cd30){_0x12d38b[_0x304a('0x17')](0x194);}return _0x11cd30;};}function handleError(_0x3ac07e,_0x568cb7){_0x568cb7=_0x568cb7||0x1f4;return function(_0xb0f334){logger[_0x304a('0x27')](_0xb0f334[_0x304a('0x28')]);if(_0xb0f334[_0x304a('0x29')]){delete _0xb0f334['name'];}_0x3ac07e[_0x304a('0x18')](_0x568cb7)[_0x304a('0x2a')](_0xb0f334);};}exports[_0x304a('0x2b')]=function(_0x53b2b5,_0x573667){var _0x33cf2a={},_0x334cd8={},_0x1dfbe1={'count':0x0,'rows':[]};var _0x1909ac=_[_0x304a('0x2c')](db[_0x304a('0x2d')][_0x304a('0x2e')],function(_0xdbc3a8){return{'name':_0xdbc3a8[_0x304a('0x2f')],'type':_0xdbc3a8[_0x304a('0x30')][_0x304a('0x31')]};});_0x334cd8[_0x304a('0x32')]=_[_0x304a('0x2c')](_0x1909ac,_0x304a('0x29'));_0x334cd8[_0x304a('0x33')]=_[_0x304a('0x34')](_0x53b2b5[_0x304a('0x33')]);_0x334cd8[_0x304a('0x35')]=_[_0x304a('0x36')](_0x334cd8['model'],_0x334cd8[_0x304a('0x33')]);_0x33cf2a[_0x304a('0x37')]=_[_0x304a('0x36')](_0x334cd8[_0x304a('0x32')],qs['fields'](_0x53b2b5[_0x304a('0x33')][_0x304a('0x38')]));_0x33cf2a[_0x304a('0x37')]=_0x33cf2a['attributes'][_0x304a('0x39')]?_0x33cf2a[_0x304a('0x37')]:_0x334cd8[_0x304a('0x32')];if(!_0x53b2b5[_0x304a('0x33')][_0x304a('0x3a')](_0x304a('0x3b'))){_0x33cf2a[_0x304a('0x1d')]=qs[_0x304a('0x1d')](_0x53b2b5[_0x304a('0x33')][_0x304a('0x1d')]);_0x33cf2a[_0x304a('0x1b')]=qs[_0x304a('0x1b')](_0x53b2b5[_0x304a('0x33')]['offset']);}_0x33cf2a['order']=qs[_0x304a('0x3c')](_0x53b2b5[_0x304a('0x33')]['sort']);_0x33cf2a[_0x304a('0x3d')]=qs['filters'](_['pick'](_0x53b2b5['query'],_0x334cd8[_0x304a('0x35')]),_0x1909ac);if(_0x53b2b5['query'][_0x304a('0x3e')]){_0x33cf2a[_0x304a('0x3d')]=_[_0x304a('0x3f')](_0x33cf2a[_0x304a('0x3d')],{'$or':_[_0x304a('0x2c')](_0x1909ac,function(_0x40bb0f){if(_0x40bb0f[_0x304a('0x30')]!==_0x304a('0x40')){var _0xa67be6={};_0xa67be6[_0x40bb0f[_0x304a('0x29')]]={'$like':'%'+_0x53b2b5['query'][_0x304a('0x3e')]+'%'};return _0xa67be6;}})});}_0x33cf2a=_['merge']({},_0x33cf2a,_0x53b2b5[_0x304a('0x41')]);var _0x25e982={'where':_0x33cf2a[_0x304a('0x3d')]};return db[_0x304a('0x2d')][_0x304a('0x1e')](_0x25e982)[_0x304a('0x25')](function(_0x30920d){_0x1dfbe1[_0x304a('0x1e')]=_0x30920d;if(_0x53b2b5['query'][_0x304a('0x42')]){_0x33cf2a[_0x304a('0x43')]=[{'all':!![]}];}return db[_0x304a('0x2d')][_0x304a('0x44')](_0x33cf2a);})[_0x304a('0x25')](function(_0x280891){_0x1dfbe1[_0x304a('0x45')]=_0x280891;return _0x1dfbe1;})[_0x304a('0x25')](respondWithFilteredResult(_0x573667,_0x33cf2a))['catch'](handleError(_0x573667,null));};exports[_0x304a('0x46')]=function(_0x32b7d1,_0x2c9376){var _0x2fc59c={'raw':![],'where':{'id':_0x32b7d1[_0x304a('0x47')]['id']}},_0x5c9507={};_0x5c9507[_0x304a('0x32')]=_[_0x304a('0x34')](db['AnalyticFieldReport'][_0x304a('0x2e')]);_0x5c9507[_0x304a('0x33')]=_[_0x304a('0x34')](_0x32b7d1[_0x304a('0x33')]);_0x5c9507[_0x304a('0x35')]=_['intersection'](_0x5c9507[_0x304a('0x32')],_0x5c9507[_0x304a('0x33')]);_0x2fc59c[_0x304a('0x37')]=_[_0x304a('0x36')](_0x5c9507[_0x304a('0x32')],qs[_0x304a('0x38')](_0x32b7d1[_0x304a('0x33')][_0x304a('0x38')]));_0x2fc59c[_0x304a('0x37')]=_0x2fc59c[_0x304a('0x37')][_0x304a('0x39')]?_0x2fc59c[_0x304a('0x37')]:_0x5c9507[_0x304a('0x32')];if(_0x32b7d1[_0x304a('0x33')][_0x304a('0x42')]){_0x2fc59c['include']=[{'all':!![]}];}_0x2fc59c=_[_0x304a('0x3f')]({},_0x2fc59c,_0x32b7d1[_0x304a('0x41')]);return db[_0x304a('0x2d')][_0x304a('0x48')](_0x2fc59c)[_0x304a('0x25')](handleEntityNotFound(_0x2c9376,null))['then'](respondWithResult(_0x2c9376,null))[_0x304a('0x49')](handleError(_0x2c9376,null));};exports[_0x304a('0x4a')]=function(_0xaa2f83,_0xaacd86){return db[_0x304a('0x2d')][_0x304a('0x4a')](_0xaa2f83[_0x304a('0x4b')],{})[_0x304a('0x25')](respondWithResult(_0xaacd86,0xc9))[_0x304a('0x49')](handleError(_0xaacd86,null));};exports['bulkCreate']=function(_0xa25912,_0x1579cd){return db[_0x304a('0x2d')][_0x304a('0x4c')](_0xa25912[_0x304a('0x4b')],{'raw':![],'individualHooks':!![]})[_0x304a('0x25')](respondWithResult(_0x1579cd,0xc9))[_0x304a('0x49')](handleError(_0x1579cd,null));};exports[_0x304a('0x24')]=function(_0x1e5e01,_0x7ad524){if(_0x1e5e01[_0x304a('0x4b')]['id']){delete _0x1e5e01['body']['id'];}return db[_0x304a('0x2d')][_0x304a('0x48')]({'where':{'id':_0x1e5e01['params']['id']}})[_0x304a('0x25')](handleEntityNotFound(_0x7ad524,null))[_0x304a('0x25')](saveUpdates(_0x1e5e01[_0x304a('0x4b')],null))[_0x304a('0x25')](respondWithResult(_0x7ad524,null))[_0x304a('0x49')](handleError(_0x7ad524,null));};exports[_0x304a('0x26')]=function(_0x4a4180,_0x441744){return db['AnalyticFieldReport'][_0x304a('0x48')]({'where':{'id':_0x4a4180[_0x304a('0x47')]['id']}})['then'](handleEntityNotFound(_0x441744,null))[_0x304a('0x25')](removeEntity(_0x441744,null))[_0x304a('0x49')](handleError(_0x441744,null));};exports[_0x304a('0x4d')]=function(_0x1c0033,_0x26246f){return db[_0x304a('0x2d')][_0x304a('0x26')]({'where':{'id':_0x1c0033['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x26246f,0xcc))[_0x304a('0x49')](handleError(_0x26246f,null));};exports[_0x304a('0x4e')]=function(_0x2e9e79,_0x10f7e5,_0x4da7c1){return db[_0x304a('0x4f')][_0x304a('0x50')]({'where':{'id':_0x2e9e79[_0x304a('0x47')]['id']}})['then'](handleEntityNotFound(_0x10f7e5,null))[_0x304a('0x25')](function(_0x17a87e){if(_0x17a87e){return db[_0x304a('0x51')]['transaction'](function(_0x4818e6){return db[_0x304a('0x2d')][_0x304a('0x26')]({'where':{'CustomReportId':_0x2e9e79[_0x304a('0x47')]['id']},'transaction':_0x4818e6})[_0x304a('0x25')](function(_0x3c4dec){var _0x13a7c=_[_0x304a('0x2c')](_0x2e9e79[_0x304a('0x4b')],function(_0x41c34a){delete _0x41c34a['id'];_0x41c34a['CustomReportId']=_0x2e9e79['params']['id'];return _0x41c34a;});return db['AnalyticFieldReport']['bulkCreate'](_0x13a7c,{'transaction':_0x4818e6});});})[_0x304a('0x25')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x2e9e79[_0x304a('0x47')]['id']}});});}})['then'](respondWithResult(_0x10f7e5,null))['catch'](handleError(_0x10f7e5,null));}; \ No newline at end of file +var _0x68f5=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','create','body','bulkCreate','update','find','destroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','then','stack','name','send','map','AnalyticFieldReport','rawAttributes'];(function(_0x2b2d32,_0x401bf9){var _0x594f99=function(_0x10760d){while(--_0x10760d){_0x2b2d32['push'](_0x2b2d32['shift']());}};_0x594f99(++_0x401bf9);}(_0x68f5,0x75));var _0x568f=function(_0x4323cc,_0x37f323){_0x4323cc=_0x4323cc-0x0;var _0x2209de=_0x68f5[_0x4323cc];return _0x2209de;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x568f('0x0'));var rp=require(_0x568f('0x1'));var moment=require(_0x568f('0x2'));var BPromise=require(_0x568f('0x3'));var Mustache=require(_0x568f('0x4'));var util=require(_0x568f('0x5'));var path=require(_0x568f('0x6'));var sox=require(_0x568f('0x7'));var csv=require(_0x568f('0x8'));var ejs=require(_0x568f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x568f('0xa'));var squel=require(_0x568f('0xb'));var crypto=require(_0x568f('0xc'));var jsforce=require(_0x568f('0xd'));var deskjs=require(_0x568f('0xe'));var toCsv=require(_0x568f('0x8'));var querystring=require(_0x568f('0xf'));var Papa=require(_0x568f('0x10'));var Redis=require(_0x568f('0x11'));var authService=require(_0x568f('0x12'));var qs=require(_0x568f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x568f('0x14'));var logger=require('../../config/logger')(_0x568f('0x15'));var utils=require(_0x568f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x568f('0x17'));var db=require(_0x568f('0x18'))['db'];function respondWithStatusCode(_0x2fa40e,_0x91ce6b){_0x91ce6b=_0x91ce6b||0xcc;return function(_0x1c4052){if(_0x1c4052){return _0x2fa40e[_0x568f('0x19')](_0x91ce6b);}return _0x2fa40e[_0x568f('0x1a')](_0x91ce6b)[_0x568f('0x1b')]();};}function respondWithResult(_0x1805c9,_0x5e0081){_0x5e0081=_0x5e0081||0xc8;return function(_0x370955){if(_0x370955){return _0x1805c9[_0x568f('0x1a')](_0x5e0081)[_0x568f('0x1c')](_0x370955);}};}function respondWithFilteredResult(_0x27fee6,_0x351bcd){return function(_0x2a0cb9){if(_0x2a0cb9){var _0x2c3113=typeof _0x351bcd[_0x568f('0x1d')]===_0x568f('0x1e')&&typeof _0x351bcd['limit']===_0x568f('0x1e');var _0x43b415=_0x2a0cb9[_0x568f('0x1f')];var _0x309a7b=_0x2c3113?0x0:_0x351bcd[_0x568f('0x1d')];var _0x5f17a5=_0x2c3113?_0x2a0cb9[_0x568f('0x1f')]:_0x351bcd[_0x568f('0x1d')]+_0x351bcd[_0x568f('0x20')];var _0x29ff29;if(_0x5f17a5>=_0x43b415){_0x5f17a5=_0x43b415;_0x29ff29=0xc8;}else{_0x29ff29=0xce;}_0x27fee6[_0x568f('0x1a')](_0x29ff29);return _0x27fee6[_0x568f('0x21')](_0x568f('0x22'),_0x309a7b+'-'+_0x5f17a5+'/'+_0x43b415)[_0x568f('0x1c')](_0x2a0cb9);}return null;};}function patchUpdates(_0x48758a){return function(_0x9e431f){try{jsonpatch['apply'](_0x9e431f,_0x48758a,!![]);}catch(_0x4bd26d){return BPromise['reject'](_0x4bd26d);}return _0x9e431f[_0x568f('0x23')]();};}function saveUpdates(_0x57117f,_0x153cd0){return function(_0x278d2b){if(_0x278d2b){return _0x278d2b['update'](_0x57117f)[_0x568f('0x24')](function(_0x4a12b9){return _0x4a12b9;});}return null;};}function removeEntity(_0x644732,_0x39e0a4){return function(_0x1f6519){if(_0x1f6519){return _0x1f6519['destroy']()[_0x568f('0x24')](function(){_0x644732[_0x568f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f60e,_0x2cfab7){return function(_0x163941){if(!_0x163941){_0x15f60e[_0x568f('0x19')](0x194);}return _0x163941;};}function handleError(_0x161f7d,_0x57d32b){_0x57d32b=_0x57d32b||0x1f4;return function(_0x501077){logger['error'](_0x501077[_0x568f('0x25')]);if(_0x501077[_0x568f('0x26')]){delete _0x501077['name'];}_0x161f7d[_0x568f('0x1a')](_0x57d32b)[_0x568f('0x27')](_0x501077);};}exports['index']=function(_0x3877ac,_0x3792eb){var _0x1937ae={},_0x2b763e={},_0x4c5884={'count':0x0,'rows':[]};var _0x478d31=_[_0x568f('0x28')](db[_0x568f('0x29')][_0x568f('0x2a')],function(_0x2833f0){return{'name':_0x2833f0['fieldName'],'type':_0x2833f0['type'][_0x568f('0x2b')]};});_0x2b763e[_0x568f('0x2c')]=_[_0x568f('0x28')](_0x478d31,_0x568f('0x26'));_0x2b763e[_0x568f('0x2d')]=_[_0x568f('0x2e')](_0x3877ac[_0x568f('0x2d')]);_0x2b763e[_0x568f('0x2f')]=_[_0x568f('0x30')](_0x2b763e[_0x568f('0x2c')],_0x2b763e[_0x568f('0x2d')]);_0x1937ae[_0x568f('0x31')]=_['intersection'](_0x2b763e['model'],qs[_0x568f('0x32')](_0x3877ac['query']['fields']));_0x1937ae[_0x568f('0x31')]=_0x1937ae[_0x568f('0x31')][_0x568f('0x33')]?_0x1937ae['attributes']:_0x2b763e[_0x568f('0x2c')];if(!_0x3877ac[_0x568f('0x2d')][_0x568f('0x34')]('nolimit')){_0x1937ae[_0x568f('0x20')]=qs[_0x568f('0x20')](_0x3877ac[_0x568f('0x2d')][_0x568f('0x20')]);_0x1937ae[_0x568f('0x1d')]=qs['offset'](_0x3877ac[_0x568f('0x2d')][_0x568f('0x1d')]);}_0x1937ae[_0x568f('0x35')]=qs['sort'](_0x3877ac[_0x568f('0x2d')][_0x568f('0x36')]);_0x1937ae[_0x568f('0x37')]=qs[_0x568f('0x2f')](_[_0x568f('0x38')](_0x3877ac['query'],_0x2b763e['filters']),_0x478d31);if(_0x3877ac[_0x568f('0x2d')][_0x568f('0x39')]){_0x1937ae['where']=_[_0x568f('0x3a')](_0x1937ae[_0x568f('0x37')],{'$or':_[_0x568f('0x28')](_0x478d31,function(_0x161bf6){if(_0x161bf6[_0x568f('0x3b')]!==_0x568f('0x3c')){var _0x39203a={};_0x39203a[_0x161bf6['name']]={'$like':'%'+_0x3877ac[_0x568f('0x2d')][_0x568f('0x39')]+'%'};return _0x39203a;}})});}_0x1937ae=_[_0x568f('0x3a')]({},_0x1937ae,_0x3877ac['options']);var _0x48d399={'where':_0x1937ae[_0x568f('0x37')]};return db['AnalyticFieldReport']['count'](_0x48d399)[_0x568f('0x24')](function(_0x96fc54){_0x4c5884[_0x568f('0x1f')]=_0x96fc54;if(_0x3877ac[_0x568f('0x2d')][_0x568f('0x3d')]){_0x1937ae[_0x568f('0x3e')]=[{'all':!![]}];}return db[_0x568f('0x29')][_0x568f('0x3f')](_0x1937ae);})[_0x568f('0x24')](function(_0x44c50e){_0x4c5884[_0x568f('0x40')]=_0x44c50e;return _0x4c5884;})[_0x568f('0x24')](respondWithFilteredResult(_0x3792eb,_0x1937ae))[_0x568f('0x41')](handleError(_0x3792eb,null));};exports[_0x568f('0x42')]=function(_0x2f1092,_0xe90c35){var _0x595c09={'raw':![],'where':{'id':_0x2f1092[_0x568f('0x43')]['id']}},_0x2e52f5={};_0x2e52f5[_0x568f('0x2c')]=_[_0x568f('0x2e')](db[_0x568f('0x29')]['rawAttributes']);_0x2e52f5['query']=_[_0x568f('0x2e')](_0x2f1092['query']);_0x2e52f5[_0x568f('0x2f')]=_['intersection'](_0x2e52f5[_0x568f('0x2c')],_0x2e52f5[_0x568f('0x2d')]);_0x595c09[_0x568f('0x31')]=_['intersection'](_0x2e52f5[_0x568f('0x2c')],qs[_0x568f('0x32')](_0x2f1092['query'][_0x568f('0x32')]));_0x595c09[_0x568f('0x31')]=_0x595c09[_0x568f('0x31')][_0x568f('0x33')]?_0x595c09[_0x568f('0x31')]:_0x2e52f5[_0x568f('0x2c')];if(_0x2f1092[_0x568f('0x2d')][_0x568f('0x3d')]){_0x595c09[_0x568f('0x3e')]=[{'all':!![]}];}_0x595c09=_[_0x568f('0x3a')]({},_0x595c09,_0x2f1092['options']);return db[_0x568f('0x29')]['find'](_0x595c09)[_0x568f('0x24')](handleEntityNotFound(_0xe90c35,null))['then'](respondWithResult(_0xe90c35,null))[_0x568f('0x41')](handleError(_0xe90c35,null));};exports[_0x568f('0x44')]=function(_0x2418f6,_0x47fdf3){return db['AnalyticFieldReport'][_0x568f('0x44')](_0x2418f6[_0x568f('0x45')],{})[_0x568f('0x24')](respondWithResult(_0x47fdf3,0xc9))[_0x568f('0x41')](handleError(_0x47fdf3,null));};exports[_0x568f('0x46')]=function(_0x2442a0,_0x27d050){return db[_0x568f('0x29')][_0x568f('0x46')](_0x2442a0['body'],{'raw':![],'individualHooks':!![]})[_0x568f('0x24')](respondWithResult(_0x27d050,0xc9))[_0x568f('0x41')](handleError(_0x27d050,null));};exports[_0x568f('0x47')]=function(_0xa1db11,_0x12ded2){if(_0xa1db11[_0x568f('0x45')]['id']){delete _0xa1db11[_0x568f('0x45')]['id'];}return db[_0x568f('0x29')][_0x568f('0x48')]({'where':{'id':_0xa1db11[_0x568f('0x43')]['id']}})['then'](handleEntityNotFound(_0x12ded2,null))[_0x568f('0x24')](saveUpdates(_0xa1db11[_0x568f('0x45')],null))[_0x568f('0x24')](respondWithResult(_0x12ded2,null))[_0x568f('0x41')](handleError(_0x12ded2,null));};exports[_0x568f('0x49')]=function(_0x1af873,_0x34df2e){return db[_0x568f('0x29')][_0x568f('0x48')]({'where':{'id':_0x1af873[_0x568f('0x43')]['id']}})[_0x568f('0x24')](handleEntityNotFound(_0x34df2e,null))['then'](removeEntity(_0x34df2e,null))[_0x568f('0x41')](handleError(_0x34df2e,null));};exports['bulkDestroy']=function(_0xd8bfa9,_0x5ac76b){return db[_0x568f('0x29')][_0x568f('0x49')]({'where':{'id':_0xd8bfa9[_0x568f('0x2d')][_0x568f('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x568f('0x24')](respondWithResult(_0x5ac76b,0xcc))[_0x568f('0x41')](handleError(_0x5ac76b,null));};exports[_0x568f('0x4b')]=function(_0x2ed4a3,_0x290aed,_0x131d40){return db[_0x568f('0x4c')]['findOne']({'where':{'id':_0x2ed4a3[_0x568f('0x43')]['id']}})[_0x568f('0x24')](handleEntityNotFound(_0x290aed,null))[_0x568f('0x24')](function(_0xb53d34){if(_0xb53d34){return db[_0x568f('0x4d')][_0x568f('0x4e')](function(_0xbeb401){return db[_0x568f('0x29')][_0x568f('0x49')]({'where':{'CustomReportId':_0x2ed4a3[_0x568f('0x43')]['id']},'transaction':_0xbeb401})[_0x568f('0x24')](function(_0x562167){var _0x163073=_[_0x568f('0x28')](_0x2ed4a3['body'],function(_0x329777){delete _0x329777['id'];_0x329777[_0x568f('0x4f')]=_0x2ed4a3[_0x568f('0x43')]['id'];return _0x329777;});return db[_0x568f('0x29')][_0x568f('0x46')](_0x163073,{'transaction':_0xbeb401});});})[_0x568f('0x24')](function(){return db[_0x568f('0x29')][_0x568f('0x3f')]({'where':{'CustomReportId':_0x2ed4a3[_0x568f('0x43')]['id']}});});}})[_0x568f('0x24')](respondWithResult(_0x290aed,null))['catch'](handleError(_0x290aed,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a369438..f9868cb 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 _0xf50b=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x73582a,_0x2e2856){var _0x33a4f8=function(_0x38abf8){while(--_0x38abf8){_0x73582a['push'](_0x73582a['shift']());}};_0x33a4f8(++_0x2e2856);}(_0xf50b,0x186));var _0xbf50=function(_0x52491c,_0x311e90){_0x52491c=_0x52491c-0x0;var _0x105dbb=_0xf50b[_0x52491c];return _0x105dbb;};'use strict';var _=require('lodash');var util=require(_0xbf50('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbf50('0x1'));var BPromise=require(_0xbf50('0x2'));var rp=require(_0xbf50('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf50('0x4'));var config=require(_0xbf50('0x5'));var attributes=require(_0xbf50('0x6'));module[_0xbf50('0x7')]=function(_0x49180c,_0x4fb7c5){return _0x49180c[_0xbf50('0x8')](_0xbf50('0x9'),attributes,{'tableName':_0xbf50('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a93=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x3122c1,_0x21d826){var _0x2c280a=function(_0x20bec6){while(--_0x20bec6){_0x3122c1['push'](_0x3122c1['shift']());}};_0x2c280a(++_0x21d826);}(_0x5a93,0x17a));var _0x35a9=function(_0x13fa45,_0x3eecdc){_0x13fa45=_0x13fa45-0x0;var _0x5f2b91=_0x5a93[_0x13fa45];return _0x5f2b91;};'use strict';var _=require(_0x35a9('0x0'));var util=require(_0x35a9('0x1'));var logger=require(_0x35a9('0x2'))(_0x35a9('0x3'));var moment=require('moment');var BPromise=require(_0x35a9('0x4'));var rp=require(_0x35a9('0x5'));var fs=require('fs');var path=require(_0x35a9('0x6'));var rimraf=require(_0x35a9('0x7'));var config=require(_0x35a9('0x8'));var attributes=require(_0x35a9('0x9'));module[_0x35a9('0xa')]=function(_0x44bf7e,_0x5e25a4){return _0x44bf7e[_0x35a9('0xb')](_0x35a9('0xc'),attributes,{'tableName':_0x35a9('0xd'),'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 0fb20a3..3173d58 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 _0xd2fa=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2b6a40,_0x49898e){var _0x31b218=function(_0x550890){while(--_0x550890){_0x2b6a40['push'](_0x2b6a40['shift']());}};_0x31b218(++_0x49898e);}(_0xd2fa,0x161));var _0xad2f=function(_0x346ff8,_0xa83449){_0x346ff8=_0x346ff8-0x0;var _0x151021=_0xd2fa[_0x346ff8];return _0x151021;};'use strict';var _=require(_0xad2f('0x0'));var util=require(_0xad2f('0x1'));var moment=require(_0xad2f('0x2'));var BPromise=require(_0xad2f('0x3'));var rs=require(_0xad2f('0x4'));var fs=require('fs');var Redis=require(_0xad2f('0x5'));var db=require(_0xad2f('0x6'))['db'];var utils=require(_0xad2f('0x7'));var logger=require(_0xad2f('0x8'))(_0xad2f('0x9'));var config=require('../../config/environment');var jayson=require(_0xad2f('0xa'));var client=jayson['client'][_0xad2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52f63c,_0xd35d9b,_0x373246){return new BPromise(function(_0x5f14e3,_0x13e54f){return client[_0xad2f('0xc')](_0x52f63c,_0x373246)[_0xad2f('0xd')](function(_0x2640c0){logger[_0xad2f('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd35d9b,'request\x20sent');logger['debug'](_0xad2f('0xf'),_0xd35d9b,_0xad2f('0x10'),JSON[_0xad2f('0x11')](_0x2640c0));if(_0x2640c0[_0xad2f('0x12')]){if(_0x2640c0[_0xad2f('0x12')][_0xad2f('0x13')]===0x1f4){logger[_0xad2f('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd35d9b,_0x2640c0[_0xad2f('0x12')][_0xad2f('0x14')]);return _0x13e54f(_0x2640c0[_0xad2f('0x12')][_0xad2f('0x14')]);}logger[_0xad2f('0x12')](_0xad2f('0x15'),_0xd35d9b,_0x2640c0['error'][_0xad2f('0x14')]);return _0x5f14e3(_0x2640c0[_0xad2f('0x12')][_0xad2f('0x14')]);}else{logger[_0xad2f('0xe')](_0xad2f('0x15'),_0xd35d9b,'request\x20sent');_0x5f14e3(_0x2640c0[_0xad2f('0x16')][_0xad2f('0x14')]);}})[_0xad2f('0x17')](function(_0x1699b7){logger[_0xad2f('0x12')](_0xad2f('0x15'),_0xd35d9b,_0x1699b7);_0x13e54f(_0x1699b7);});});} \ No newline at end of file +var _0x6594=['client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x96e3c9,_0x2078a6){var _0x581019=function(_0x4a070b){while(--_0x4a070b){_0x96e3c9['push'](_0x96e3c9['shift']());}};_0x581019(++_0x2078a6);}(_0x6594,0x100));var _0x4659=function(_0x547bb6,_0x2d6f27){_0x547bb6=_0x547bb6-0x0;var _0x1a9154=_0x6594[_0x547bb6];return _0x1a9154;};'use strict';var _=require('lodash');var util=require(_0x4659('0x0'));var moment=require(_0x4659('0x1'));var BPromise=require('bluebird');var rs=require(_0x4659('0x2'));var fs=require('fs');var Redis=require(_0x4659('0x3'));var db=require(_0x4659('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4659('0x5'));var config=require(_0x4659('0x6'));var jayson=require(_0x4659('0x7'));var client=jayson[_0x4659('0x8')][_0x4659('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16b1c3,_0x1bc8ab,_0x3f18e7){return new BPromise(function(_0x3734dc,_0x2955db){return client[_0x4659('0xa')](_0x16b1c3,_0x3f18e7)[_0x4659('0xb')](function(_0x1114bb){logger[_0x4659('0xc')](_0x4659('0xd'),_0x1bc8ab,_0x4659('0xe'));logger[_0x4659('0xf')](_0x4659('0x10'),_0x1bc8ab,_0x4659('0xe'),JSON[_0x4659('0x11')](_0x1114bb));if(_0x1114bb[_0x4659('0x12')]){if(_0x1114bb[_0x4659('0x12')][_0x4659('0x13')]===0x1f4){logger[_0x4659('0x12')](_0x4659('0xd'),_0x1bc8ab,_0x1114bb[_0x4659('0x12')][_0x4659('0x14')]);return _0x2955db(_0x1114bb[_0x4659('0x12')][_0x4659('0x14')]);}logger[_0x4659('0x12')](_0x4659('0xd'),_0x1bc8ab,_0x1114bb[_0x4659('0x12')]['message']);return _0x3734dc(_0x1114bb[_0x4659('0x12')][_0x4659('0x14')]);}else{logger[_0x4659('0xc')](_0x4659('0xd'),_0x1bc8ab,_0x4659('0xe'));_0x3734dc(_0x1114bb['result']['message']);}})[_0x4659('0x15')](function(_0x1918ea){logger[_0x4659('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1bc8ab,_0x1918ea);_0x2955db(_0x1918ea);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b204fde..250e537 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(_0x75b0e,_0x561fcb){var _0x3e7740=function(_0x4d9580){while(--_0x4d9580){_0x75b0e['push'](_0x75b0e['shift']());}};_0x3e7740(++_0x561fcb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x124d6c,_0x3f6654){var _0x3b4645=function(_0x206003){while(--_0x206003){_0x124d6c['push'](_0x124d6c['shift']());}};_0x3b4645(++_0x3f6654);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 98a92b4..da6aab3 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 _0xb16f=['STRING','TEXT','sequelize','exports'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0xb16f,0xf6));var _0xfb16=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0xb16f[_0x509c83];return _0x534626;};'use strict';var Sequelize=require(_0xfb16('0x0'));module[_0xfb16('0x1')]={'name':{'type':Sequelize[_0xfb16('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xfb16('0x2')]},'metric':{'type':Sequelize[_0xfb16('0x3')]},'description':{'type':Sequelize[_0xfb16('0x2')]}}; \ No newline at end of file +var _0x4746=['name','TEXT','STRING','sequelize','exports'];(function(_0x30a956,_0x11222e){var _0x2ac17d=function(_0x3be1d2){while(--_0x3be1d2){_0x30a956['push'](_0x30a956['shift']());}};_0x2ac17d(++_0x11222e);}(_0x4746,0xc6));var _0x6474=function(_0x5c8736,_0x2a2a03){_0x5c8736=_0x5c8736-0x0;var _0x142bdb=_0x4746[_0x5c8736];return _0x142bdb;};'use strict';var Sequelize=require(_0x6474('0x0'));module[_0x6474('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6474('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x6474('0x3')]},'description':{'type':Sequelize[_0x6474('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 20a4b4b..4de2639 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 _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0xe05026,_0x157568){var _0x5dcd33=function(_0x3ae196){while(--_0x3ae196){_0xe05026['push'](_0xe05026['shift']());}};_0x5dcd33(++_0x157568);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x24ca[_0x4b7b69];return _0x173b4c;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,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(_0x13ee19,_0x1a8807){var _0x4f2fbe=function(_0x36d6d4){while(--_0x36d6d4){_0x13ee19['push'](_0x13ee19['shift']());}};_0x4f2fbe(++_0x1a8807);}(_0x55ca,0x126));var _0xa55c=function(_0xa63ea3,_0x4367ff){_0xa63ea3=_0xa63ea3-0x0;var _0x2aa5ff=_0x55ca[_0xa63ea3];return _0x2aa5ff;};'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 e77d8d9..2c8e85e 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 _0x7ee1=['analytics_metrics','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x5df6b3,_0x5604ab){var _0x4b065b=function(_0x5d730d){while(--_0x5d730d){_0x5df6b3['push'](_0x5df6b3['shift']());}};_0x4b065b(++_0x5604ab);}(_0x7ee1,0x8d));var _0x17ee=function(_0x7ad9c3,_0x39ffd6){_0x7ad9c3=_0x7ad9c3-0x0;var _0x2960f0=_0x7ee1[_0x7ad9c3];return _0x2960f0;};'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')]('AnalyticMetric',attributes,{'tableName':_0x17ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11e5=['path','../../config/environment','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x354e78,_0xa8c7d8){var _0x3f9cb2=function(_0x2bdff2){while(--_0x2bdff2){_0x354e78['push'](_0x354e78['shift']());}};_0x3f9cb2(++_0xa8c7d8);}(_0x11e5,0x8b));var _0x511e=function(_0x40f4cc,_0x432f55){_0x40f4cc=_0x40f4cc-0x0;var _0x458315=_0x11e5[_0x40f4cc];return _0x458315;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x342539,_0x323f8c){return _0x342539[_0x511e('0x7')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','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 958f887..1b958f8 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 _0xa7c0=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticMetric,\x20%s,\x20%s'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0xa7c0,0x18c));var _0x0a7c=function(_0x5e30e7,_0x16d54f){_0x5e30e7=_0x5e30e7-0x0;var _0x24efb2=_0xa7c0[_0x5e30e7];return _0x24efb2;};'use strict';var _=require(_0x0a7c('0x0'));var util=require(_0x0a7c('0x1'));var moment=require(_0x0a7c('0x2'));var BPromise=require(_0x0a7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a7c('0x5'));var logger=require(_0x0a7c('0x6'))('rpc');var config=require(_0x0a7c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0a7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd5ffe,_0x2536ce,_0x109421){return new BPromise(function(_0xbd2c4c,_0x266564){return client[_0x0a7c('0x9')](_0xd5ffe,_0x109421)['then'](function(_0x332a0a){logger[_0x0a7c('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x2536ce,_0x0a7c('0xb'));logger[_0x0a7c('0xc')](_0x0a7c('0xd'),_0x2536ce,_0x0a7c('0xb'),JSON[_0x0a7c('0xe')](_0x332a0a));if(_0x332a0a[_0x0a7c('0xf')]){if(_0x332a0a[_0x0a7c('0xf')]['code']===0x1f4){logger[_0x0a7c('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2536ce,_0x332a0a[_0x0a7c('0xf')][_0x0a7c('0x10')]);return _0x266564(_0x332a0a[_0x0a7c('0xf')][_0x0a7c('0x10')]);}logger['error'](_0x0a7c('0x11'),_0x2536ce,_0x332a0a['error'][_0x0a7c('0x10')]);return _0xbd2c4c(_0x332a0a[_0x0a7c('0xf')]['message']);}else{logger[_0x0a7c('0xa')](_0x0a7c('0x11'),_0x2536ce,_0x0a7c('0xb'));_0xbd2c4c(_0x332a0a['result'][_0x0a7c('0x10')]);}})['catch'](function(_0x448f63){logger[_0x0a7c('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2536ce,_0x448f63);_0x266564(_0x448f63);});});} \ No newline at end of file +var _0xbb20=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x57392e,_0x2ba38b){var _0x1f2183=function(_0x2563ad){while(--_0x2563ad){_0x57392e['push'](_0x57392e['shift']());}};_0x1f2183(++_0x2ba38b);}(_0xbb20,0x152));var _0x0bb2=function(_0xbeea1c,_0x541820){_0xbeea1c=_0xbeea1c-0x0;var _0x294011=_0xbb20[_0xbeea1c];return _0x294011;};'use strict';var _=require('lodash');var util=require(_0x0bb2('0x0'));var moment=require(_0x0bb2('0x1'));var BPromise=require(_0x0bb2('0x2'));var rs=require(_0x0bb2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0bb2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bb2('0x5'))('rpc');var config=require(_0x0bb2('0x6'));var jayson=require(_0x0bb2('0x7'));var client=jayson[_0x0bb2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xebdd98,_0x59ad45,_0x4b4fcc){return new BPromise(function(_0x5470ac,_0xf51477){return client[_0x0bb2('0x9')](_0xebdd98,_0x4b4fcc)[_0x0bb2('0xa')](function(_0x6e2381){logger[_0x0bb2('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x59ad45,_0x0bb2('0xc'));logger[_0x0bb2('0xd')](_0x0bb2('0xe'),_0x59ad45,_0x0bb2('0xc'),JSON[_0x0bb2('0xf')](_0x6e2381));if(_0x6e2381[_0x0bb2('0x10')]){if(_0x6e2381[_0x0bb2('0x10')][_0x0bb2('0x11')]===0x1f4){logger[_0x0bb2('0x10')](_0x0bb2('0x12'),_0x59ad45,_0x6e2381[_0x0bb2('0x10')][_0x0bb2('0x13')]);return _0xf51477(_0x6e2381['error'][_0x0bb2('0x13')]);}logger[_0x0bb2('0x10')](_0x0bb2('0x12'),_0x59ad45,_0x6e2381[_0x0bb2('0x10')][_0x0bb2('0x13')]);return _0x5470ac(_0x6e2381[_0x0bb2('0x10')]['message']);}else{logger[_0x0bb2('0xb')](_0x0bb2('0x12'),_0x59ad45,_0x0bb2('0xc'));_0x5470ac(_0x6e2381[_0x0bb2('0x14')][_0x0bb2('0x13')]);}})[_0x0bb2('0x15')](function(_0x5013bb){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x59ad45,_0x5013bb);_0xf51477(_0x5013bb);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 582b4d7..2016510 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 _0x46ed=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0x46ed,0x168));var _0xd46e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x46ed[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xa')]);router[_0xd46e('0x8')](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xc')]);router[_0xd46e('0xd')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xe')]);router['put'](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller['update']);router[_0xd46e('0xf')](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file +var _0xf13b=['multer','express','Router','fs-extra','../../components/auth/service','./analyticMetric.controller','get','index','isAuthenticated','show','create','put','/:id','update','destroy','exports'];(function(_0x33f5fd,_0x13c092){var _0x4f4546=function(_0x4cb466){while(--_0x4cb466){_0x33f5fd['push'](_0x33f5fd['shift']());}};_0x4f4546(++_0x13c092);}(_0xf13b,0x1f0));var _0xbf13=function(_0x2d43ea,_0x169e4c){_0x2d43ea=_0x2d43ea-0x0;var _0x432d99=_0xf13b[_0x2d43ea];return _0x432d99;};'use strict';var multer=require(_0xbf13('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbf13('0x1'));var router=express[_0xbf13('0x2')]();var fs_extra=require(_0xbf13('0x3'));var auth=require(_0xbf13('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbf13('0x5'));router[_0xbf13('0x6')]('/',auth['isAuthenticated'](),controller[_0xbf13('0x7')]);router[_0xbf13('0x6')]('/:id',auth[_0xbf13('0x8')](),controller[_0xbf13('0x9')]);router['post']('/',auth[_0xbf13('0x8')](),controller[_0xbf13('0xa')]);router[_0xbf13('0xb')](_0xbf13('0xc'),auth['isAuthenticated'](),controller[_0xbf13('0xd')]);router['delete'](_0xbf13('0xc'),auth['isAuthenticated'](),controller[_0xbf13('0xe')]);module[_0xbf13('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index b7adee0..8d3370c 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 _0xcbe7=['TEXT'];(function(_0x4a98d3,_0x3ce0de){var _0x1e2307=function(_0x15674f){while(--_0x15674f){_0x4a98d3['push'](_0x4a98d3['shift']());}};_0x1e2307(++_0x3ce0de);}(_0xcbe7,0x134));var _0x7cbe=function(_0x1e0fd7,_0x43a6cd){_0x1e0fd7=_0x1e0fd7-0x0;var _0x3255a0=_0xcbe7[_0x1e0fd7];return _0x3255a0;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x7cbe('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xe623=['exports','TEXT'];(function(_0x781f65,_0x1908bd){var _0x4b5514=function(_0x20298d){while(--_0x20298d){_0x781f65['push'](_0x781f65['shift']());}};_0x4b5514(++_0x1908bd);}(_0xe623,0x10a));var _0x3e62=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe623[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require('sequelize');module[_0x3e62('0x0')]={'tree':{'type':Sequelize[_0x3e62('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 864dd5a..ad9743d 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 _0xfce6=['filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','create','body','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../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','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick'];(function(_0x24bbf5,_0x3946e9){var _0x3d61c8=function(_0x3ccdf9){while(--_0x3ccdf9){_0x24bbf5['push'](_0x24bbf5['shift']());}};_0x3d61c8(++_0x3946e9);}(_0xfce6,0x1c3));var _0x6fce=function(_0x4b630c,_0x5da947){_0x4b630c=_0x4b630c-0x0;var _0x1be67a=_0xfce6[_0x4b630c];return _0x1be67a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6fce('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fce('0x1'));var moment=require(_0x6fce('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6fce('0x3'));var util=require(_0x6fce('0x4'));var path=require(_0x6fce('0x5'));var sox=require(_0x6fce('0x6'));var csv=require(_0x6fce('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fce('0x8'));var _=require(_0x6fce('0x9'));var squel=require('squel');var crypto=require(_0x6fce('0xa'));var jsforce=require(_0x6fce('0xb'));var deskjs=require(_0x6fce('0xc'));var toCsv=require(_0x6fce('0x7'));var querystring=require(_0x6fce('0xd'));var Papa=require('papaparse');var Redis=require(_0x6fce('0xe'));var authService=require(_0x6fce('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6fce('0x10'));var hardwareService=require(_0x6fce('0x11'));var logger=require(_0x6fce('0x12'))(_0x6fce('0x13'));var utils=require(_0x6fce('0x14'));var config=require(_0x6fce('0x15'));var licenseUtil=require(_0x6fce('0x16'));var db=require(_0x6fce('0x17'))['db'];function respondWithStatusCode(_0xe342c1,_0x3208d8){_0x3208d8=_0x3208d8||0xcc;return function(_0x3df73b){if(_0x3df73b){return _0xe342c1[_0x6fce('0x18')](_0x3208d8);}return _0xe342c1[_0x6fce('0x19')](_0x3208d8)[_0x6fce('0x1a')]();};}function respondWithResult(_0x590215,_0xa5dedf){_0xa5dedf=_0xa5dedf||0xc8;return function(_0x5c7483){if(_0x5c7483){return _0x590215[_0x6fce('0x19')](_0xa5dedf)[_0x6fce('0x1b')](_0x5c7483);}};}function respondWithFilteredResult(_0x178b6f,_0x3af9f2){return function(_0x2d6faa){if(_0x2d6faa){var _0x3bdc96=typeof _0x3af9f2[_0x6fce('0x1c')]===_0x6fce('0x1d')&&typeof _0x3af9f2[_0x6fce('0x1e')]===_0x6fce('0x1d');var _0x1f2b56=_0x2d6faa[_0x6fce('0x1f')];var _0x3088e8=_0x3bdc96?0x0:_0x3af9f2['offset'];var _0x5a79df=_0x3bdc96?_0x2d6faa['count']:_0x3af9f2[_0x6fce('0x1c')]+_0x3af9f2[_0x6fce('0x1e')];var _0x387005;if(_0x5a79df>=_0x1f2b56){_0x5a79df=_0x1f2b56;_0x387005=0xc8;}else{_0x387005=0xce;}_0x178b6f[_0x6fce('0x19')](_0x387005);return _0x178b6f['set'](_0x6fce('0x20'),_0x3088e8+'-'+_0x5a79df+'/'+_0x1f2b56)[_0x6fce('0x1b')](_0x2d6faa);}return null;};}function patchUpdates(_0x4b8479){return function(_0x161584){try{jsonpatch[_0x6fce('0x21')](_0x161584,_0x4b8479,!![]);}catch(_0x4fa1f5){return BPromise[_0x6fce('0x22')](_0x4fa1f5);}return _0x161584[_0x6fce('0x23')]();};}function saveUpdates(_0x4003b1,_0x1be341){return function(_0x43d0fe){if(_0x43d0fe){return _0x43d0fe[_0x6fce('0x24')](_0x4003b1)['then'](function(_0x5ed9d8){return _0x5ed9d8;});}return null;};}function removeEntity(_0x112130,_0xb9426){return function(_0xe3c41b){if(_0xe3c41b){return _0xe3c41b[_0x6fce('0x25')]()[_0x6fce('0x26')](function(){_0x112130[_0x6fce('0x19')](0xcc)[_0x6fce('0x1a')]();});}};}function handleEntityNotFound(_0x45f237,_0x25bcbb){return function(_0xaf40ff){if(!_0xaf40ff){_0x45f237[_0x6fce('0x18')](0x194);}return _0xaf40ff;};}function handleError(_0x3763af,_0x579f07){_0x579f07=_0x579f07||0x1f4;return function(_0x4a298f){logger['error'](_0x4a298f[_0x6fce('0x27')]);if(_0x4a298f[_0x6fce('0x28')]){delete _0x4a298f['name'];}_0x3763af[_0x6fce('0x19')](_0x579f07)[_0x6fce('0x29')](_0x4a298f);};}exports[_0x6fce('0x2a')]=function(_0x551e80,_0x4af602){var _0x545853={},_0xf481b0={},_0x5904f2={'count':0x0,'rows':[]};var _0x2069db=_[_0x6fce('0x2b')](db[_0x6fce('0x2c')][_0x6fce('0x2d')],function(_0xeeadbf){return{'name':_0xeeadbf['fieldName'],'type':_0xeeadbf[_0x6fce('0x2e')]['key']};});_0xf481b0['model']=_[_0x6fce('0x2b')](_0x2069db,_0x6fce('0x28'));_0xf481b0[_0x6fce('0x2f')]=_[_0x6fce('0x30')](_0x551e80[_0x6fce('0x2f')]);_0xf481b0[_0x6fce('0x31')]=_[_0x6fce('0x32')](_0xf481b0[_0x6fce('0x33')],_0xf481b0[_0x6fce('0x2f')]);_0x545853['attributes']=_[_0x6fce('0x32')](_0xf481b0[_0x6fce('0x33')],qs[_0x6fce('0x34')](_0x551e80[_0x6fce('0x2f')][_0x6fce('0x34')]));_0x545853[_0x6fce('0x35')]=_0x545853[_0x6fce('0x35')][_0x6fce('0x36')]?_0x545853[_0x6fce('0x35')]:_0xf481b0[_0x6fce('0x33')];if(!_0x551e80[_0x6fce('0x2f')]['hasOwnProperty'](_0x6fce('0x37'))){_0x545853[_0x6fce('0x1e')]=qs[_0x6fce('0x1e')](_0x551e80[_0x6fce('0x2f')][_0x6fce('0x1e')]);_0x545853[_0x6fce('0x1c')]=qs[_0x6fce('0x1c')](_0x551e80[_0x6fce('0x2f')][_0x6fce('0x1c')]);}_0x545853[_0x6fce('0x38')]=qs['sort'](_0x551e80[_0x6fce('0x2f')][_0x6fce('0x39')]);_0x545853[_0x6fce('0x3a')]=qs[_0x6fce('0x31')](_[_0x6fce('0x3b')](_0x551e80[_0x6fce('0x2f')],_0xf481b0[_0x6fce('0x31')]),_0x2069db);if(_0x551e80[_0x6fce('0x2f')][_0x6fce('0x3c')]){_0x545853[_0x6fce('0x3a')]=_[_0x6fce('0x3d')](_0x545853[_0x6fce('0x3a')],{'$or':_[_0x6fce('0x2b')](_0x2069db,function(_0x424331){if(_0x424331[_0x6fce('0x2e')]!==_0x6fce('0x3e')){var _0x135846={};_0x135846[_0x424331[_0x6fce('0x28')]]={'$like':'%'+_0x551e80[_0x6fce('0x2f')][_0x6fce('0x3c')]+'%'};return _0x135846;}})});}_0x545853=_[_0x6fce('0x3d')]({},_0x545853,_0x551e80['options']);var _0x16d91c={'where':_0x545853[_0x6fce('0x3a')]};return db[_0x6fce('0x2c')][_0x6fce('0x1f')](_0x16d91c)[_0x6fce('0x26')](function(_0x180eb4){_0x5904f2[_0x6fce('0x1f')]=_0x180eb4;if(_0x551e80[_0x6fce('0x2f')][_0x6fce('0x3f')]){_0x545853['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x6fce('0x40')](_0x545853);})[_0x6fce('0x26')](function(_0xfeefc6){_0x5904f2[_0x6fce('0x41')]=_0xfeefc6;return _0x5904f2;})[_0x6fce('0x26')](respondWithFilteredResult(_0x4af602,_0x545853))[_0x6fce('0x42')](handleError(_0x4af602,null));};exports[_0x6fce('0x43')]=function(_0x4de059,_0x1c41d3){var _0x5677f9={'raw':!![],'where':{'id':_0x4de059[_0x6fce('0x44')]['id']}},_0x51eef1={};_0x51eef1[_0x6fce('0x33')]=_[_0x6fce('0x30')](db[_0x6fce('0x2c')][_0x6fce('0x2d')]);_0x51eef1[_0x6fce('0x2f')]=_['keys'](_0x4de059[_0x6fce('0x2f')]);_0x51eef1[_0x6fce('0x31')]=_[_0x6fce('0x32')](_0x51eef1['model'],_0x51eef1[_0x6fce('0x2f')]);_0x5677f9[_0x6fce('0x35')]=_[_0x6fce('0x32')](_0x51eef1[_0x6fce('0x33')],qs[_0x6fce('0x34')](_0x4de059[_0x6fce('0x2f')][_0x6fce('0x34')]));_0x5677f9[_0x6fce('0x35')]=_0x5677f9[_0x6fce('0x35')][_0x6fce('0x36')]?_0x5677f9[_0x6fce('0x35')]:_0x51eef1['model'];if(_0x4de059[_0x6fce('0x2f')]['includeAll']){_0x5677f9['include']=[{'all':!![]}];}_0x5677f9=_['merge']({},_0x5677f9,_0x4de059[_0x6fce('0x45')]);return db['AnalyticTreeReport'][_0x6fce('0x46')](_0x5677f9)[_0x6fce('0x26')](handleEntityNotFound(_0x1c41d3,null))[_0x6fce('0x26')](respondWithResult(_0x1c41d3,null))[_0x6fce('0x42')](handleError(_0x1c41d3,null));};exports[_0x6fce('0x47')]=function(_0x3449f1,_0x1ea4ef){return db[_0x6fce('0x2c')][_0x6fce('0x47')](_0x3449f1[_0x6fce('0x48')],{})['then'](respondWithResult(_0x1ea4ef,0xc9))[_0x6fce('0x42')](handleError(_0x1ea4ef,null));};exports[_0x6fce('0x24')]=function(_0x526ab0,_0x31997f){if(_0x526ab0['body']['id']){delete _0x526ab0['body']['id'];}return db[_0x6fce('0x2c')][_0x6fce('0x46')]({'where':{'id':_0x526ab0[_0x6fce('0x44')]['id']}})['then'](handleEntityNotFound(_0x31997f,null))[_0x6fce('0x26')](saveUpdates(_0x526ab0[_0x6fce('0x48')],null))[_0x6fce('0x26')](respondWithResult(_0x31997f,null))[_0x6fce('0x42')](handleError(_0x31997f,null));};exports[_0x6fce('0x25')]=function(_0x1a24c4,_0x2a8e46){return db[_0x6fce('0x2c')][_0x6fce('0x46')]({'where':{'id':_0x1a24c4['params']['id']}})[_0x6fce('0x26')](handleEntityNotFound(_0x2a8e46,null))[_0x6fce('0x26')](removeEntity(_0x2a8e46,null))[_0x6fce('0x42')](handleError(_0x2a8e46,null));}; \ No newline at end of file +var _0xa803=['../../config/environment','../../config/license/util','end','status','json','limit','undefined','offset','count','set','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','index','AnalyticTreeReport','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','options','create','body','params','find','eml-format','zip-dir','fast-json-patch','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','../../config/logger','api'];(function(_0x492fe1,_0x54de76){var _0x269485=function(_0x59a3ca){while(--_0x59a3ca){_0x492fe1['push'](_0x492fe1['shift']());}};_0x269485(++_0x54de76);}(_0xa803,0x119));var _0x3a80=function(_0x4937c7,_0x49c4c1){_0x4937c7=_0x4937c7-0x0;var _0x4ba422=_0xa803[_0x4937c7];return _0x4ba422;};'use strict';var emlformat=require(_0x3a80('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a80('0x1'));var jsonpatch=require(_0x3a80('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3a80('0x3'));var Mustache=require(_0x3a80('0x4'));var util=require(_0x3a80('0x5'));var path=require(_0x3a80('0x6'));var sox=require('sox');var csv=require(_0x3a80('0x7'));var ejs=require(_0x3a80('0x8'));var fs=require('fs');var fs_extra=require(_0x3a80('0x9'));var _=require(_0x3a80('0xa'));var squel=require(_0x3a80('0xb'));var crypto=require(_0x3a80('0xc'));var jsforce=require(_0x3a80('0xd'));var deskjs=require(_0x3a80('0xe'));var toCsv=require(_0x3a80('0x7'));var querystring=require(_0x3a80('0xf'));var Papa=require(_0x3a80('0x10'));var Redis=require(_0x3a80('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3a80('0x12'));var as=require(_0x3a80('0x13'));var hardwareService=require(_0x3a80('0x14'));var logger=require(_0x3a80('0x15'))(_0x3a80('0x16'));var utils=require('../../config/utils');var config=require(_0x3a80('0x17'));var licenseUtil=require(_0x3a80('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x501ca6,_0x34b188){_0x34b188=_0x34b188||0xcc;return function(_0x40919b){if(_0x40919b){return _0x501ca6['sendStatus'](_0x34b188);}return _0x501ca6['status'](_0x34b188)[_0x3a80('0x19')]();};}function respondWithResult(_0xdf5e00,_0x34487d){_0x34487d=_0x34487d||0xc8;return function(_0x406b30){if(_0x406b30){return _0xdf5e00[_0x3a80('0x1a')](_0x34487d)[_0x3a80('0x1b')](_0x406b30);}};}function respondWithFilteredResult(_0x22c925,_0x27b26e){return function(_0x5b8eeb){if(_0x5b8eeb){var _0x8ae209=typeof _0x27b26e['offset']==='undefined'&&typeof _0x27b26e[_0x3a80('0x1c')]===_0x3a80('0x1d');var _0x372c75=_0x5b8eeb['count'];var _0x580e0c=_0x8ae209?0x0:_0x27b26e[_0x3a80('0x1e')];var _0x4c6466=_0x8ae209?_0x5b8eeb[_0x3a80('0x1f')]:_0x27b26e[_0x3a80('0x1e')]+_0x27b26e[_0x3a80('0x1c')];var _0x504b69;if(_0x4c6466>=_0x372c75){_0x4c6466=_0x372c75;_0x504b69=0xc8;}else{_0x504b69=0xce;}_0x22c925[_0x3a80('0x1a')](_0x504b69);return _0x22c925[_0x3a80('0x20')](_0x3a80('0x21'),_0x580e0c+'-'+_0x4c6466+'/'+_0x372c75)[_0x3a80('0x1b')](_0x5b8eeb);}return null;};}function patchUpdates(_0xeda109){return function(_0x4ab27f){try{jsonpatch[_0x3a80('0x22')](_0x4ab27f,_0xeda109,!![]);}catch(_0x114a00){return BPromise['reject'](_0x114a00);}return _0x4ab27f['save']();};}function saveUpdates(_0x35948a,_0x35acd4){return function(_0x1d3fcd){if(_0x1d3fcd){return _0x1d3fcd[_0x3a80('0x23')](_0x35948a)['then'](function(_0x7d8323){return _0x7d8323;});}return null;};}function removeEntity(_0x295651,_0x1a49eb){return function(_0x2bb0f3){if(_0x2bb0f3){return _0x2bb0f3[_0x3a80('0x24')]()[_0x3a80('0x25')](function(){_0x295651[_0x3a80('0x1a')](0xcc)[_0x3a80('0x19')]();});}};}function handleEntityNotFound(_0x6bdbca,_0x1cad4b){return function(_0x21ccbd){if(!_0x21ccbd){_0x6bdbca[_0x3a80('0x26')](0x194);}return _0x21ccbd;};}function handleError(_0x8b3eb4,_0x8e98da){_0x8e98da=_0x8e98da||0x1f4;return function(_0x4f97a3){logger[_0x3a80('0x27')](_0x4f97a3[_0x3a80('0x28')]);if(_0x4f97a3[_0x3a80('0x29')]){delete _0x4f97a3[_0x3a80('0x29')];}_0x8b3eb4[_0x3a80('0x1a')](_0x8e98da)['send'](_0x4f97a3);};}exports[_0x3a80('0x2a')]=function(_0x42578e,_0xf7dc9b){var _0x16e963={},_0x5c9569={},_0xfba31={'count':0x0,'rows':[]};var _0x505b7f=_['map'](db[_0x3a80('0x2b')]['rawAttributes'],function(_0x2b2cc5){return{'name':_0x2b2cc5[_0x3a80('0x2c')],'type':_0x2b2cc5[_0x3a80('0x2d')][_0x3a80('0x2e')]};});_0x5c9569[_0x3a80('0x2f')]=_['map'](_0x505b7f,_0x3a80('0x29'));_0x5c9569[_0x3a80('0x30')]=_['keys'](_0x42578e[_0x3a80('0x30')]);_0x5c9569['filters']=_[_0x3a80('0x31')](_0x5c9569[_0x3a80('0x2f')],_0x5c9569[_0x3a80('0x30')]);_0x16e963['attributes']=_[_0x3a80('0x31')](_0x5c9569[_0x3a80('0x2f')],qs[_0x3a80('0x32')](_0x42578e[_0x3a80('0x30')][_0x3a80('0x32')]));_0x16e963[_0x3a80('0x33')]=_0x16e963[_0x3a80('0x33')][_0x3a80('0x34')]?_0x16e963['attributes']:_0x5c9569[_0x3a80('0x2f')];if(!_0x42578e[_0x3a80('0x30')][_0x3a80('0x35')]('nolimit')){_0x16e963[_0x3a80('0x1c')]=qs[_0x3a80('0x1c')](_0x42578e[_0x3a80('0x30')][_0x3a80('0x1c')]);_0x16e963[_0x3a80('0x1e')]=qs[_0x3a80('0x1e')](_0x42578e[_0x3a80('0x30')][_0x3a80('0x1e')]);}_0x16e963[_0x3a80('0x36')]=qs['sort'](_0x42578e[_0x3a80('0x30')][_0x3a80('0x37')]);_0x16e963[_0x3a80('0x38')]=qs['filters'](_[_0x3a80('0x39')](_0x42578e[_0x3a80('0x30')],_0x5c9569[_0x3a80('0x3a')]),_0x505b7f);if(_0x42578e[_0x3a80('0x30')][_0x3a80('0x3b')]){_0x16e963[_0x3a80('0x38')]=_[_0x3a80('0x3c')](_0x16e963[_0x3a80('0x38')],{'$or':_[_0x3a80('0x3d')](_0x505b7f,function(_0x5486be){if(_0x5486be[_0x3a80('0x2d')]!==_0x3a80('0x3e')){var _0x27fee4={};_0x27fee4[_0x5486be[_0x3a80('0x29')]]={'$like':'%'+_0x42578e[_0x3a80('0x30')][_0x3a80('0x3b')]+'%'};return _0x27fee4;}})});}_0x16e963=_[_0x3a80('0x3c')]({},_0x16e963,_0x42578e['options']);var _0x367b68={'where':_0x16e963[_0x3a80('0x38')]};return db['AnalyticTreeReport']['count'](_0x367b68)['then'](function(_0x80318e){_0xfba31['count']=_0x80318e;if(_0x42578e['query']['includeAll']){_0x16e963[_0x3a80('0x3f')]=[{'all':!![]}];}return db[_0x3a80('0x2b')][_0x3a80('0x40')](_0x16e963);})[_0x3a80('0x25')](function(_0x3e88c2){_0xfba31[_0x3a80('0x41')]=_0x3e88c2;return _0xfba31;})[_0x3a80('0x25')](respondWithFilteredResult(_0xf7dc9b,_0x16e963))[_0x3a80('0x42')](handleError(_0xf7dc9b,null));};exports[_0x3a80('0x43')]=function(_0x4fef3a,_0x2238f3){var _0x4a256f={'raw':!![],'where':{'id':_0x4fef3a['params']['id']}},_0x1b77cf={};_0x1b77cf[_0x3a80('0x2f')]=_[_0x3a80('0x44')](db[_0x3a80('0x2b')][_0x3a80('0x45')]);_0x1b77cf['query']=_['keys'](_0x4fef3a[_0x3a80('0x30')]);_0x1b77cf['filters']=_[_0x3a80('0x31')](_0x1b77cf[_0x3a80('0x2f')],_0x1b77cf['query']);_0x4a256f[_0x3a80('0x33')]=_[_0x3a80('0x31')](_0x1b77cf[_0x3a80('0x2f')],qs['fields'](_0x4fef3a[_0x3a80('0x30')][_0x3a80('0x32')]));_0x4a256f[_0x3a80('0x33')]=_0x4a256f[_0x3a80('0x33')][_0x3a80('0x34')]?_0x4a256f[_0x3a80('0x33')]:_0x1b77cf[_0x3a80('0x2f')];if(_0x4fef3a[_0x3a80('0x30')][_0x3a80('0x46')]){_0x4a256f[_0x3a80('0x3f')]=[{'all':!![]}];}_0x4a256f=_['merge']({},_0x4a256f,_0x4fef3a[_0x3a80('0x47')]);return db[_0x3a80('0x2b')]['find'](_0x4a256f)[_0x3a80('0x25')](handleEntityNotFound(_0x2238f3,null))[_0x3a80('0x25')](respondWithResult(_0x2238f3,null))[_0x3a80('0x42')](handleError(_0x2238f3,null));};exports[_0x3a80('0x48')]=function(_0x2a345b,_0x51e41c){return db[_0x3a80('0x2b')]['create'](_0x2a345b[_0x3a80('0x49')],{})[_0x3a80('0x25')](respondWithResult(_0x51e41c,0xc9))[_0x3a80('0x42')](handleError(_0x51e41c,null));};exports[_0x3a80('0x23')]=function(_0x326117,_0x221dc2){if(_0x326117[_0x3a80('0x49')]['id']){delete _0x326117['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x326117[_0x3a80('0x4a')]['id']}})[_0x3a80('0x25')](handleEntityNotFound(_0x221dc2,null))[_0x3a80('0x25')](saveUpdates(_0x326117[_0x3a80('0x49')],null))['then'](respondWithResult(_0x221dc2,null))[_0x3a80('0x42')](handleError(_0x221dc2,null));};exports['destroy']=function(_0x5bd1bb,_0x24eaee){return db[_0x3a80('0x2b')][_0x3a80('0x4b')]({'where':{'id':_0x5bd1bb[_0x3a80('0x4a')]['id']}})[_0x3a80('0x25')](handleEntityNotFound(_0x24eaee,null))[_0x3a80('0x25')](removeEntity(_0x24eaee,null))[_0x3a80('0x42')](handleError(_0x24eaee,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3e53664..4376a67 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 _0x449b=['define','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x43747e,_0x13b832){var _0x7fb853=function(_0x4b1028){while(--_0x4b1028){_0x43747e['push'](_0x43747e['shift']());}};_0x7fb853(++_0x13b832);}(_0x449b,0xb6));var _0xb449=function(_0x2d49d3,_0x1a09a5){_0x2d49d3=_0x2d49d3-0x0;var _0x543e70=_0x449b[_0x2d49d3];return _0x543e70;};'use strict';var _=require(_0xb449('0x0'));var util=require(_0xb449('0x1'));var logger=require(_0xb449('0x2'))(_0xb449('0x3'));var moment=require(_0xb449('0x4'));var BPromise=require(_0xb449('0x5'));var rp=require(_0xb449('0x6'));var fs=require('fs');var path=require(_0xb449('0x7'));var rimraf=require('rimraf');var config=require(_0xb449('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0xb449('0x9')]=function(_0x187801,_0xa8c9c6){return _0x187801[_0xb449('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xb449('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5817=['analytics_report_trees','lodash','util','../../config/logger','api','path','rimraf','./analyticTreeReport.attributes','define','AnalyticTreeReport'];(function(_0x59bed7,_0x235302){var _0x58c04a=function(_0xef3b65){while(--_0xef3b65){_0x59bed7['push'](_0x59bed7['shift']());}};_0x58c04a(++_0x235302);}(_0x5817,0xa1));var _0x7581=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5817[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7581('0x0'));var util=require(_0x7581('0x1'));var logger=require(_0x7581('0x2'))(_0x7581('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7581('0x4'));var rimraf=require(_0x7581('0x5'));var config=require('../../config/environment');var attributes=require(_0x7581('0x6'));module['exports']=function(_0x1685f6,_0xe2183e){return _0x1685f6[_0x7581('0x7')](_0x7581('0x8'),attributes,{'tableName':_0x7581('0x9'),'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 327bf59..3e41362 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x1ba41c,_0x4ad1b4){var _0xbd3de3=function(_0xeb4210){while(--_0xeb4210){_0x1ba41c['push'](_0x1ba41c['shift']());}};_0xbd3de3(++_0x4ad1b4);}(_0x1261,0x144));var _0x1126=function(_0x2ae2bc,_0x177514){_0x2ae2bc=_0x2ae2bc-0x0;var _0x53c290=_0x1261[_0x2ae2bc];return _0x53c290;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x2971d5,_0x205974){_0x2971d5=_0x2971d5-0x0;var _0x31e59e=_0x7a54[_0x2971d5];return _0x31e59e;};'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 79f191a..e88182a 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 _0xea54=['Router','fs-extra','../../components/auth/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xea54,0x106));var _0x4ea5=function(_0x213d6e,_0x3cefd5){_0x213d6e=_0x213d6e-0x0;var _0x142869=_0xea54[_0x213d6e];return _0x142869;};'use strict';var multer=require(_0x4ea5('0x0'));var util=require(_0x4ea5('0x1'));var path=require(_0x4ea5('0x2'));var timeout=require(_0x4ea5('0x3'));var express=require('express');var router=express[_0x4ea5('0x4')]();var fs_extra=require(_0x4ea5('0x5'));var auth=require(_0x4ea5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4ea5('0x7'));router[_0x4ea5('0x8')]('/',auth[_0x4ea5('0x9')](),controller[_0x4ea5('0xa')]);router['get'](_0x4ea5('0xb'),auth[_0x4ea5('0x9')](),controller[_0x4ea5('0xc')]);router['post']('/',auth[_0x4ea5('0x9')](),controller[_0x4ea5('0xd')]);router[_0x4ea5('0xe')](_0x4ea5('0xb'),auth[_0x4ea5('0x9')](),controller[_0x4ea5('0xf')]);router[_0x4ea5('0x10')](_0x4ea5('0xb'),auth['isAuthenticated'](),controller[_0x4ea5('0x11')]);module[_0x4ea5('0x12')]=router; \ No newline at end of file +var _0xb450=['isAuthenticated','get','/:id','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./analyticTreeReport.controller'];(function(_0x26d10b,_0x1d909b){var _0xe9a76=function(_0x37bc2c){while(--_0x37bc2c){_0x26d10b['push'](_0x26d10b['shift']());}};_0xe9a76(++_0x1d909b);}(_0xb450,0xad));var _0x0b45=function(_0x589081,_0x54d794){_0x589081=_0x589081-0x0;var _0x4b7e8c=_0xb450[_0x589081];return _0x4b7e8c;};'use strict';var multer=require(_0x0b45('0x0'));var util=require(_0x0b45('0x1'));var path=require(_0x0b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0b45('0x3')]();var fs_extra=require(_0x0b45('0x4'));var auth=require(_0x0b45('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0b45('0x6'));router['get']('/',auth[_0x0b45('0x7')](),controller['index']);router[_0x0b45('0x8')](_0x0b45('0x9'),auth[_0x0b45('0x7')](),controller['show']);router['post']('/',auth[_0x0b45('0x7')](),controller['create']);router['put'](_0x0b45('0x9'),auth[_0x0b45('0x7')](),controller['update']);router[_0x0b45('0xa')](_0x0b45('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x0b45('0xb')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f84bc9b..e4e05db 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 _0xde64=['exports','STRING','sequelize'];(function(_0x515de6,_0x2204df){var _0x10d356=function(_0x49d819){while(--_0x49d819){_0x515de6['push'](_0x515de6['shift']());}};_0x10d356(++_0x2204df);}(_0xde64,0x17c));var _0x4de6=function(_0xcadf12,_0x526b25){_0xcadf12=_0xcadf12-0x0;var _0x2c7a91=_0xde64[_0xcadf12];return _0x2c7a91;};'use strict';var Sequelize=require(_0x4de6('0x0'));module[_0x4de6('0x1')]={'name':{'type':Sequelize[_0x4de6('0x2')]},'basename':{'type':Sequelize[_0x4de6('0x2')]},'type':{'type':Sequelize[_0x4de6('0x2')]}}; \ No newline at end of file +var _0xc997=['exports','STRING'];(function(_0x298064,_0x1d2bfb){var _0x2512ea=function(_0x3e5b28){while(--_0x3e5b28){_0x298064['push'](_0x298064['shift']());}};_0x2512ea(++_0x1d2bfb);}(_0xc997,0x1ac));var _0x7c99=function(_0x537a03,_0x187e16){_0x537a03=_0x537a03-0x0;var _0x5f59df=_0xc997[_0x537a03];return _0x5f59df;};'use strict';var Sequelize=require('sequelize');module[_0x7c99('0x0')]={'name':{'type':Sequelize[_0x7c99('0x1')]},'basename':{'type':Sequelize[_0x7c99('0x1')]},'type':{'type':Sequelize[_0x7c99('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 4550ff6..6842e0c 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 _0x020c=['body','updatedAt','file','originalname','basename','filename','mimetype','create','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','rimraf','util','path','sox','to-csv','ejs','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','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','clone','get','omit','createdAt'];(function(_0x2b4d7f,_0x45f7aa){var _0x3fceaa=function(_0x481329){while(--_0x481329){_0x2b4d7f['push'](_0x2b4d7f['shift']());}};_0x3fceaa(++_0x45f7aa);}(_0x020c,0x1bc));var _0xc020=function(_0x18d677,_0x5d7115){_0x18d677=_0x18d677-0x0;var _0x171e51=_0x020c[_0x18d677];return _0x171e51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc020('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc020('0x1'));var path=require(_0xc020('0x2'));var sox=require(_0xc020('0x3'));var csv=require(_0xc020('0x4'));var ejs=require(_0xc020('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc020('0x6'));var squel=require(_0xc020('0x7'));var crypto=require('crypto');var jsforce=require(_0xc020('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xc020('0x4'));var querystring=require(_0xc020('0x9'));var Papa=require(_0xc020('0xa'));var Redis=require(_0xc020('0xb'));var authService=require(_0xc020('0xc'));var qs=require(_0xc020('0xd'));var as=require(_0xc020('0xe'));var hardwareService=require(_0xc020('0xf'));var logger=require(_0xc020('0x10'))(_0xc020('0x11'));var utils=require(_0xc020('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc020('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f9514,_0x51355c){_0x51355c=_0x51355c||0xcc;return function(_0x557343){if(_0x557343){return _0x4f9514[_0xc020('0x14')](_0x51355c);}return _0x4f9514['status'](_0x51355c)[_0xc020('0x15')]();};}function respondWithResult(_0x100d69,_0x535f54){_0x535f54=_0x535f54||0xc8;return function(_0x98371b){if(_0x98371b){return _0x100d69['status'](_0x535f54)[_0xc020('0x16')](_0x98371b);}};}function respondWithFilteredResult(_0x57cdfb,_0x4710ee){return function(_0x5aa15a){if(_0x5aa15a){var _0xaa9ae1=typeof _0x4710ee[_0xc020('0x17')]===_0xc020('0x18')&&typeof _0x4710ee[_0xc020('0x19')]===_0xc020('0x18');var _0x1379bc=_0x5aa15a[_0xc020('0x1a')];var _0x3ad30b=_0xaa9ae1?0x0:_0x4710ee[_0xc020('0x17')];var _0xb619d1=_0xaa9ae1?_0x5aa15a[_0xc020('0x1a')]:_0x4710ee[_0xc020('0x17')]+_0x4710ee[_0xc020('0x19')];var _0x4369e8;if(_0xb619d1>=_0x1379bc){_0xb619d1=_0x1379bc;_0x4369e8=0xc8;}else{_0x4369e8=0xce;}_0x57cdfb[_0xc020('0x1b')](_0x4369e8);return _0x57cdfb['set'](_0xc020('0x1c'),_0x3ad30b+'-'+_0xb619d1+'/'+_0x1379bc)[_0xc020('0x16')](_0x5aa15a);}return null;};}function patchUpdates(_0x1814bb){return function(_0x3736ab){try{jsonpatch['apply'](_0x3736ab,_0x1814bb,!![]);}catch(_0xba3df5){return BPromise[_0xc020('0x1d')](_0xba3df5);}return _0x3736ab[_0xc020('0x1e')]();};}function saveUpdates(_0x4832ec,_0x547fb3){return function(_0x3af5c5){if(_0x3af5c5){return _0x3af5c5[_0xc020('0x1f')](_0x4832ec)[_0xc020('0x20')](function(_0xb6deab){return _0xb6deab;});}return null;};}function removeEntity(_0x44344b,_0x1521a9){return function(_0x5dd46f){if(_0x5dd46f){return _0x5dd46f[_0xc020('0x21')]()['then'](function(){_0x44344b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d751,_0x2359b7){return function(_0x208d2f){if(!_0x208d2f){_0x11d751[_0xc020('0x14')](0x194);}return _0x208d2f;};}function handleError(_0x10a65d,_0x346462){_0x346462=_0x346462||0x1f4;return function(_0x335195){logger[_0xc020('0x22')](_0x335195[_0xc020('0x23')]);if(_0x335195[_0xc020('0x24')]){delete _0x335195[_0xc020('0x24')];}_0x10a65d['status'](_0x346462)[_0xc020('0x25')](_0x335195);};}exports[_0xc020('0x26')]=function(_0x2da53a,_0x208eff){var _0x3fc6ef={},_0x496e7d={},_0x1fb62d={'count':0x0,'rows':[]};var _0x410e2f=_[_0xc020('0x27')](db[_0xc020('0x28')]['rawAttributes'],function(_0xcf0aec){return{'name':_0xcf0aec[_0xc020('0x29')],'type':_0xcf0aec[_0xc020('0x2a')][_0xc020('0x2b')]};});_0x496e7d['model']=_[_0xc020('0x27')](_0x410e2f,_0xc020('0x24'));_0x496e7d[_0xc020('0x2c')]=_[_0xc020('0x2d')](_0x2da53a[_0xc020('0x2c')]);_0x496e7d[_0xc020('0x2e')]=_[_0xc020('0x2f')](_0x496e7d['model'],_0x496e7d[_0xc020('0x2c')]);_0x3fc6ef[_0xc020('0x30')]=_['intersection'](_0x496e7d[_0xc020('0x31')],qs[_0xc020('0x32')](_0x2da53a[_0xc020('0x2c')][_0xc020('0x32')]));_0x3fc6ef[_0xc020('0x30')]=_0x3fc6ef[_0xc020('0x30')][_0xc020('0x33')]?_0x3fc6ef[_0xc020('0x30')]:_0x496e7d[_0xc020('0x31')];if(!_0x2da53a[_0xc020('0x2c')][_0xc020('0x34')](_0xc020('0x35'))){_0x3fc6ef[_0xc020('0x19')]=qs[_0xc020('0x19')](_0x2da53a[_0xc020('0x2c')]['limit']);_0x3fc6ef[_0xc020('0x17')]=qs[_0xc020('0x17')](_0x2da53a['query']['offset']);}_0x3fc6ef['order']=qs[_0xc020('0x36')](_0x2da53a[_0xc020('0x2c')][_0xc020('0x36')]);_0x3fc6ef[_0xc020('0x37')]=qs['filters'](_[_0xc020('0x38')](_0x2da53a[_0xc020('0x2c')],_0x496e7d[_0xc020('0x2e')]),_0x410e2f);if(_0x2da53a[_0xc020('0x2c')]['filter']){_0x3fc6ef['where']=_[_0xc020('0x39')](_0x3fc6ef[_0xc020('0x37')],{'$or':_[_0xc020('0x27')](_0x410e2f,function(_0x2efdc1){if(_0x2efdc1[_0xc020('0x2a')]!==_0xc020('0x3a')){var _0x2bc477={};_0x2bc477[_0x2efdc1[_0xc020('0x24')]]={'$like':'%'+_0x2da53a['query']['filter']+'%'};return _0x2bc477;}})});}_0x3fc6ef=_[_0xc020('0x39')]({},_0x3fc6ef,_0x2da53a[_0xc020('0x3b')]);var _0x5bac6e={'where':_0x3fc6ef[_0xc020('0x37')]};return db[_0xc020('0x28')][_0xc020('0x1a')](_0x5bac6e)[_0xc020('0x20')](function(_0x5c045a){_0x1fb62d['count']=_0x5c045a;if(_0x2da53a['query'][_0xc020('0x3c')]){_0x3fc6ef[_0xc020('0x3d')]=[{'all':!![]}];}return db[_0xc020('0x28')][_0xc020('0x3e')](_0x3fc6ef);})['then'](function(_0x59f3da){_0x1fb62d['rows']=_0x59f3da;return _0x1fb62d;})[_0xc020('0x20')](respondWithFilteredResult(_0x208eff,_0x3fc6ef))[_0xc020('0x3f')](handleError(_0x208eff,null));};exports[_0xc020('0x40')]=function(_0x5c4b4b,_0x352290){var _0x589c0d={'raw':!![],'where':{'id':_0x5c4b4b[_0xc020('0x41')]['id']}},_0x37beec={};_0x37beec[_0xc020('0x31')]=_['keys'](db[_0xc020('0x28')][_0xc020('0x42')]);_0x37beec['query']=_[_0xc020('0x2d')](_0x5c4b4b['query']);_0x37beec[_0xc020('0x2e')]=_[_0xc020('0x2f')](_0x37beec[_0xc020('0x31')],_0x37beec[_0xc020('0x2c')]);_0x589c0d[_0xc020('0x30')]=_[_0xc020('0x2f')](_0x37beec[_0xc020('0x31')],qs[_0xc020('0x32')](_0x5c4b4b['query'][_0xc020('0x32')]));_0x589c0d[_0xc020('0x30')]=_0x589c0d[_0xc020('0x30')]['length']?_0x589c0d[_0xc020('0x30')]:_0x37beec[_0xc020('0x31')];if(_0x5c4b4b['query'][_0xc020('0x3c')]){_0x589c0d[_0xc020('0x3d')]=[{'all':!![]}];}_0x589c0d=_['merge']({},_0x589c0d,_0x5c4b4b[_0xc020('0x3b')]);return db[_0xc020('0x28')][_0xc020('0x43')](_0x589c0d)[_0xc020('0x20')](handleEntityNotFound(_0x352290,null))['then'](respondWithResult(_0x352290,null))[_0xc020('0x3f')](handleError(_0x352290,null));};exports[_0xc020('0x44')]=function(_0x46e27f,_0x120435){var _0x3d50d3={'where':{'id':_0x46e27f['params']['id']}},_0xfdaea3={};_0xfdaea3[_0xc020('0x31')]=_[_0xc020('0x2d')](db[_0xc020('0x28')][_0xc020('0x42')]);_0x3d50d3[_0xc020('0x30')]=_[_0xc020('0x2f')](_0xfdaea3['model'],qs[_0xc020('0x32')](_0x46e27f['query'][_0xc020('0x32')]));_0x3d50d3[_0xc020('0x30')]=_0x3d50d3[_0xc020('0x30')][_0xc020('0x33')]?_0x3d50d3[_0xc020('0x30')]:_0xfdaea3[_0xc020('0x31')];if(_0x46e27f[_0xc020('0x2c')]['includeAll']){_0x3d50d3[_0xc020('0x3d')]=[{'all':!![]}];}_0x3d50d3=_[_0xc020('0x39')]({},_0x3d50d3,_0x46e27f['options']);return db[_0xc020('0x28')][_0xc020('0x43')](_0x3d50d3)[_0xc020('0x20')](handleEntityNotFound(_0x120435,null))[_0xc020('0x20')](function(_0xcc84e8){if(_0xcc84e8){var _0x211a5e=_0xcc84e8[_0xc020('0x45')]({'plain':!![]});_0x211a5e=qs[_0xc020('0x46')](_0x211a5e,['id',_0xc020('0x47'),'updatedAt']);_0x46e27f[_0xc020('0x48')]=_[_0xc020('0x46')](_0x46e27f[_0xc020('0x48')],['id',_0xc020('0x47'),_0xc020('0x49')]);return db['Attachment']['create'](_[_0xc020('0x39')](_0x211a5e,_0x46e27f[_0xc020('0x48')]),{'include':_0x46e27f['query'][_0xc020('0x3c')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x120435,0xc9))[_0xc020('0x3f')](handleError(_0x120435,null));};exports[_0xc020('0x1f')]=function(_0x3f917a,_0x4ba6c2){if(_0x3f917a[_0xc020('0x48')]['id']){delete _0x3f917a['body']['id'];}return db[_0xc020('0x28')][_0xc020('0x43')]({'where':{'id':_0x3f917a[_0xc020('0x41')]['id']}})[_0xc020('0x20')](handleEntityNotFound(_0x4ba6c2,null))[_0xc020('0x20')](saveUpdates(_0x3f917a['body'],null))['then'](respondWithResult(_0x4ba6c2,null))[_0xc020('0x3f')](handleError(_0x4ba6c2,null));};exports[_0xc020('0x21')]=function(_0x151980,_0x5b4560){return db['Attachment'][_0xc020('0x43')]({'where':{'id':_0x151980[_0xc020('0x41')]['id']}})[_0xc020('0x20')](handleEntityNotFound(_0x5b4560,null))[_0xc020('0x20')](removeEntity(_0x5b4560,null))[_0xc020('0x3f')](handleError(_0x5b4560,null));};exports['create']=function(_0x384aa7,_0x3e70ff,_0x4d735c){_0x384aa7[_0xc020('0x48')][_0xc020('0x24')]=_0x384aa7[_0xc020('0x4a')][_0xc020('0x4b')];_0x384aa7[_0xc020('0x48')][_0xc020('0x4c')]=_0x384aa7[_0xc020('0x4a')][_0xc020('0x4d')];_0x384aa7['body'][_0xc020('0x2a')]=_0x384aa7[_0xc020('0x4a')][_0xc020('0x4e')];return db[_0xc020('0x28')][_0xc020('0x4f')](_0x384aa7['body'])['then'](respondWithResult(_0x3e70ff,0xc9))[_0xc020('0x3f')](handleError(_0x3e70ff,null));};exports[_0xc020('0x50')]=function(_0x145661,_0x4a91aa,_0xc7ac45){return db['Attachment'][_0xc020('0x51')]({'where':{'id':_0x145661[_0xc020('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4a91aa,null))[_0xc020('0x20')](function(_0x5940fb){if(_0x5940fb){var _0x1f6187=_0x5940fb[_0xc020('0x52')]!==null;var _0x29865c=path[_0xc020('0x53')](config[_0xc020('0x54')],'server/files/attachments/');if(_0x1f6187){_0x29865c=path['join'](_0x29865c,_0xc020('0x55'));}var _0x3e3d3a=path[_0xc020('0x53')](_0x29865c,_0x5940fb[_0xc020('0x4c')]);return _0x4a91aa[_0xc020('0x50')](_0x3e3d3a);}})[_0xc020('0x3f')](handleError(_0x4a91aa,null));}; \ No newline at end of file +var _0xd56e=['Attachment','rawAttributes','type','key','model','name','query','keys','filters','attributes','fields','length','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','intersection','include','find','get','omit','updatedAt','body','createdAt','destroy','create','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','error','map'];(function(_0xbb1fa0,_0xff58e8){var _0xe383a3=function(_0x429459){while(--_0x429459){_0xbb1fa0['push'](_0xbb1fa0['shift']());}};_0xe383a3(++_0xff58e8);}(_0xd56e,0x11c));var _0xed56=function(_0x3e48d3,_0x2a2931){_0x3e48d3=_0x3e48d3-0x0;var _0x220927=_0xd56e[_0x3e48d3];return _0x220927;};'use strict';var emlformat=require(_0xed56('0x0'));var rimraf=require(_0xed56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed56('0x2'));var rp=require(_0xed56('0x3'));var moment=require(_0xed56('0x4'));var BPromise=require(_0xed56('0x5'));var Mustache=require('mustache');var util=require(_0xed56('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xed56('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed56('0x8'));var squel=require(_0xed56('0x9'));var crypto=require(_0xed56('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xed56('0xb'));var toCsv=require(_0xed56('0xc'));var querystring=require('querystring');var Papa=require(_0xed56('0xd'));var Redis=require(_0xed56('0xe'));var authService=require(_0xed56('0xf'));var qs=require(_0xed56('0x10'));var as=require(_0xed56('0x11'));var hardwareService=require(_0xed56('0x12'));var logger=require('../../config/logger')(_0xed56('0x13'));var utils=require(_0xed56('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xed56('0x15'))['db'];function respondWithStatusCode(_0x6f119d,_0x2c6fdc){_0x2c6fdc=_0x2c6fdc||0xcc;return function(_0x151f72){if(_0x151f72){return _0x6f119d['sendStatus'](_0x2c6fdc);}return _0x6f119d['status'](_0x2c6fdc)[_0xed56('0x16')]();};}function respondWithResult(_0x8d0ee6,_0x4f7eae){_0x4f7eae=_0x4f7eae||0xc8;return function(_0x70bf8f){if(_0x70bf8f){return _0x8d0ee6[_0xed56('0x17')](_0x4f7eae)['json'](_0x70bf8f);}};}function respondWithFilteredResult(_0x2202c9,_0x6fb655){return function(_0x13102b){if(_0x13102b){var _0x50df94=typeof _0x6fb655[_0xed56('0x18')]===_0xed56('0x19')&&typeof _0x6fb655['limit']===_0xed56('0x19');var _0x2ee147=_0x13102b[_0xed56('0x1a')];var _0xe416f9=_0x50df94?0x0:_0x6fb655[_0xed56('0x18')];var _0x31edca=_0x50df94?_0x13102b['count']:_0x6fb655[_0xed56('0x18')]+_0x6fb655[_0xed56('0x1b')];var _0x3f1f74;if(_0x31edca>=_0x2ee147){_0x31edca=_0x2ee147;_0x3f1f74=0xc8;}else{_0x3f1f74=0xce;}_0x2202c9[_0xed56('0x17')](_0x3f1f74);return _0x2202c9['set'](_0xed56('0x1c'),_0xe416f9+'-'+_0x31edca+'/'+_0x2ee147)[_0xed56('0x1d')](_0x13102b);}return null;};}function patchUpdates(_0x138651){return function(_0x4390a9){try{jsonpatch['apply'](_0x4390a9,_0x138651,!![]);}catch(_0x4af5b5){return BPromise[_0xed56('0x1e')](_0x4af5b5);}return _0x4390a9[_0xed56('0x1f')]();};}function saveUpdates(_0x2c800c,_0x502cf2){return function(_0x17f810){if(_0x17f810){return _0x17f810[_0xed56('0x20')](_0x2c800c)['then'](function(_0x86c1f0){return _0x86c1f0;});}return null;};}function removeEntity(_0x25970b,_0x2d2057){return function(_0x298ceb){if(_0x298ceb){return _0x298ceb['destroy']()[_0xed56('0x21')](function(){_0x25970b[_0xed56('0x17')](0xcc)[_0xed56('0x16')]();});}};}function handleEntityNotFound(_0x49bb83,_0x2cef7e){return function(_0x5924fc){if(!_0x5924fc){_0x49bb83['sendStatus'](0x194);}return _0x5924fc;};}function handleError(_0x4ee943,_0x106384){_0x106384=_0x106384||0x1f4;return function(_0x3652fc){logger[_0xed56('0x22')](_0x3652fc['stack']);if(_0x3652fc['name']){delete _0x3652fc['name'];}_0x4ee943[_0xed56('0x17')](_0x106384)['send'](_0x3652fc);};}exports['index']=function(_0x5df5c3,_0x3a6a90){var _0x457f5b={},_0x5b0665={},_0x239033={'count':0x0,'rows':[]};var _0x12dff9=_[_0xed56('0x23')](db[_0xed56('0x24')][_0xed56('0x25')],function(_0x2fafc5){return{'name':_0x2fafc5['fieldName'],'type':_0x2fafc5[_0xed56('0x26')][_0xed56('0x27')]};});_0x5b0665[_0xed56('0x28')]=_[_0xed56('0x23')](_0x12dff9,_0xed56('0x29'));_0x5b0665[_0xed56('0x2a')]=_[_0xed56('0x2b')](_0x5df5c3['query']);_0x5b0665[_0xed56('0x2c')]=_['intersection'](_0x5b0665['model'],_0x5b0665[_0xed56('0x2a')]);_0x457f5b[_0xed56('0x2d')]=_['intersection'](_0x5b0665[_0xed56('0x28')],qs['fields'](_0x5df5c3[_0xed56('0x2a')][_0xed56('0x2e')]));_0x457f5b[_0xed56('0x2d')]=_0x457f5b[_0xed56('0x2d')][_0xed56('0x2f')]?_0x457f5b[_0xed56('0x2d')]:_0x5b0665['model'];if(!_0x5df5c3[_0xed56('0x2a')]['hasOwnProperty']('nolimit')){_0x457f5b[_0xed56('0x1b')]=qs[_0xed56('0x1b')](_0x5df5c3[_0xed56('0x2a')][_0xed56('0x1b')]);_0x457f5b['offset']=qs[_0xed56('0x18')](_0x5df5c3[_0xed56('0x2a')][_0xed56('0x18')]);}_0x457f5b['order']=qs[_0xed56('0x30')](_0x5df5c3['query'][_0xed56('0x30')]);_0x457f5b[_0xed56('0x31')]=qs['filters'](_['pick'](_0x5df5c3[_0xed56('0x2a')],_0x5b0665[_0xed56('0x2c')]),_0x12dff9);if(_0x5df5c3['query']['filter']){_0x457f5b[_0xed56('0x31')]=_[_0xed56('0x32')](_0x457f5b['where'],{'$or':_[_0xed56('0x23')](_0x12dff9,function(_0x23201a){if(_0x23201a[_0xed56('0x26')]!==_0xed56('0x33')){var _0x332e4a={};_0x332e4a[_0x23201a[_0xed56('0x29')]]={'$like':'%'+_0x5df5c3[_0xed56('0x2a')][_0xed56('0x34')]+'%'};return _0x332e4a;}})});}_0x457f5b=_['merge']({},_0x457f5b,_0x5df5c3[_0xed56('0x35')]);var _0x143756={'where':_0x457f5b[_0xed56('0x31')]};return db[_0xed56('0x24')][_0xed56('0x1a')](_0x143756)[_0xed56('0x21')](function(_0x43805d){_0x239033[_0xed56('0x1a')]=_0x43805d;if(_0x5df5c3[_0xed56('0x2a')][_0xed56('0x36')]){_0x457f5b['include']=[{'all':!![]}];}return db[_0xed56('0x24')]['findAll'](_0x457f5b);})[_0xed56('0x21')](function(_0x25a568){_0x239033[_0xed56('0x37')]=_0x25a568;return _0x239033;})[_0xed56('0x21')](respondWithFilteredResult(_0x3a6a90,_0x457f5b))[_0xed56('0x38')](handleError(_0x3a6a90,null));};exports[_0xed56('0x39')]=function(_0x3fdd08,_0x4acb75){var _0x3c1788={'raw':!![],'where':{'id':_0x3fdd08[_0xed56('0x3a')]['id']}},_0x17b3df={};_0x17b3df[_0xed56('0x28')]=_[_0xed56('0x2b')](db[_0xed56('0x24')][_0xed56('0x25')]);_0x17b3df[_0xed56('0x2a')]=_['keys'](_0x3fdd08['query']);_0x17b3df[_0xed56('0x2c')]=_[_0xed56('0x3b')](_0x17b3df[_0xed56('0x28')],_0x17b3df[_0xed56('0x2a')]);_0x3c1788[_0xed56('0x2d')]=_[_0xed56('0x3b')](_0x17b3df[_0xed56('0x28')],qs[_0xed56('0x2e')](_0x3fdd08[_0xed56('0x2a')]['fields']));_0x3c1788[_0xed56('0x2d')]=_0x3c1788['attributes']['length']?_0x3c1788[_0xed56('0x2d')]:_0x17b3df[_0xed56('0x28')];if(_0x3fdd08[_0xed56('0x2a')][_0xed56('0x36')]){_0x3c1788[_0xed56('0x3c')]=[{'all':!![]}];}_0x3c1788=_[_0xed56('0x32')]({},_0x3c1788,_0x3fdd08[_0xed56('0x35')]);return db['Attachment'][_0xed56('0x3d')](_0x3c1788)[_0xed56('0x21')](handleEntityNotFound(_0x4acb75,null))[_0xed56('0x21')](respondWithResult(_0x4acb75,null))[_0xed56('0x38')](handleError(_0x4acb75,null));};exports['clone']=function(_0x57a0da,_0x331a71){var _0x46e8ff={'where':{'id':_0x57a0da[_0xed56('0x3a')]['id']}},_0x580c73={};_0x580c73[_0xed56('0x28')]=_[_0xed56('0x2b')](db['Attachment'][_0xed56('0x25')]);_0x46e8ff['attributes']=_[_0xed56('0x3b')](_0x580c73['model'],qs[_0xed56('0x2e')](_0x57a0da[_0xed56('0x2a')][_0xed56('0x2e')]));_0x46e8ff[_0xed56('0x2d')]=_0x46e8ff['attributes'][_0xed56('0x2f')]?_0x46e8ff[_0xed56('0x2d')]:_0x580c73[_0xed56('0x28')];if(_0x57a0da['query'][_0xed56('0x36')]){_0x46e8ff[_0xed56('0x3c')]=[{'all':!![]}];}_0x46e8ff=_[_0xed56('0x32')]({},_0x46e8ff,_0x57a0da[_0xed56('0x35')]);return db['Attachment'][_0xed56('0x3d')](_0x46e8ff)[_0xed56('0x21')](handleEntityNotFound(_0x331a71,null))[_0xed56('0x21')](function(_0x250719){if(_0x250719){var _0x2bc884=_0x250719[_0xed56('0x3e')]({'plain':!![]});_0x2bc884=qs[_0xed56('0x3f')](_0x2bc884,['id','createdAt',_0xed56('0x40')]);_0x57a0da['body']=_[_0xed56('0x3f')](_0x57a0da[_0xed56('0x41')],['id',_0xed56('0x42'),_0xed56('0x40')]);return db[_0xed56('0x24')]['create'](_[_0xed56('0x32')](_0x2bc884,_0x57a0da[_0xed56('0x41')]),{'include':_0x57a0da[_0xed56('0x2a')][_0xed56('0x36')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x331a71,0xc9))['catch'](handleError(_0x331a71,null));};exports['update']=function(_0x5947ab,_0x5db2b1){if(_0x5947ab[_0xed56('0x41')]['id']){delete _0x5947ab[_0xed56('0x41')]['id'];}return db['Attachment'][_0xed56('0x3d')]({'where':{'id':_0x5947ab[_0xed56('0x3a')]['id']}})[_0xed56('0x21')](handleEntityNotFound(_0x5db2b1,null))[_0xed56('0x21')](saveUpdates(_0x5947ab['body'],null))['then'](respondWithResult(_0x5db2b1,null))[_0xed56('0x38')](handleError(_0x5db2b1,null));};exports[_0xed56('0x43')]=function(_0x11b3b5,_0x190e87){return db[_0xed56('0x24')][_0xed56('0x3d')]({'where':{'id':_0x11b3b5[_0xed56('0x3a')]['id']}})[_0xed56('0x21')](handleEntityNotFound(_0x190e87,null))[_0xed56('0x21')](removeEntity(_0x190e87,null))[_0xed56('0x38')](handleError(_0x190e87,null));};exports[_0xed56('0x44')]=function(_0xe3cc80,_0x293407,_0x13b9e9){_0xe3cc80['body'][_0xed56('0x29')]=_0xe3cc80[_0xed56('0x45')][_0xed56('0x46')];_0xe3cc80[_0xed56('0x41')]['basename']=_0xe3cc80[_0xed56('0x45')][_0xed56('0x47')];_0xe3cc80[_0xed56('0x41')][_0xed56('0x26')]=_0xe3cc80[_0xed56('0x45')][_0xed56('0x48')];return db[_0xed56('0x24')][_0xed56('0x44')](_0xe3cc80[_0xed56('0x41')])[_0xed56('0x21')](respondWithResult(_0x293407,0xc9))[_0xed56('0x38')](handleError(_0x293407,null));};exports[_0xed56('0x49')]=function(_0x59a193,_0x1b9945,_0x37c6d7){return db[_0xed56('0x24')][_0xed56('0x4a')]({'where':{'id':_0x59a193[_0xed56('0x3a')]['id']},'raw':!![]})[_0xed56('0x21')](handleEntityNotFound(_0x1b9945,null))[_0xed56('0x21')](function(_0x3e944c){if(_0x3e944c){var _0x281970=_0x3e944c[_0xed56('0x4b')]!==null;var _0x4bfcc8=path[_0xed56('0x4c')](config[_0xed56('0x4d')],_0xed56('0x4e'));if(_0x281970){_0x4bfcc8=path[_0xed56('0x4c')](_0x4bfcc8,_0xed56('0x4f'));}var _0x495d91=path[_0xed56('0x4c')](_0x4bfcc8,_0x3e944c['basename']);return _0x1b9945['download'](_0x495d91);}})[_0xed56('0x38')](handleError(_0x1b9945,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index b6af7b4..d773852 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 _0x046c=['../../config/logger','api','bluebird','../../config/environment','./attachment.attributes','exports','Attachment','attachments','util'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x046c,0xbc));var _0xc046=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x046c[_0x68ee8b];return _0x5148f7;};'use strict';var _=require('lodash');var util=require(_0xc046('0x0'));var logger=require(_0xc046('0x1'))(_0xc046('0x2'));var moment=require('moment');var BPromise=require(_0xc046('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc046('0x4'));var attributes=require(_0xc046('0x5'));module[_0xc046('0x6')]=function(_0x5192c0,_0x335a8b){return _0x5192c0['define'](_0xc046('0x7'),attributes,{'tableName':_0xc046('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ff0=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments'];(function(_0x27cfaf,_0x125bff){var _0x38490f=function(_0x334cf0){while(--_0x334cf0){_0x27cfaf['push'](_0x27cfaf['shift']());}};_0x38490f(++_0x125bff);}(_0x6ff0,0x16c));var _0x06ff=function(_0x2308d7,_0xb501ad){_0x2308d7=_0x2308d7-0x0;var _0x480907=_0x6ff0[_0x2308d7];return _0x480907;};'use strict';var _=require(_0x06ff('0x0'));var util=require(_0x06ff('0x1'));var logger=require('../../config/logger')(_0x06ff('0x2'));var moment=require(_0x06ff('0x3'));var BPromise=require(_0x06ff('0x4'));var rp=require(_0x06ff('0x5'));var fs=require('fs');var path=require(_0x06ff('0x6'));var rimraf=require(_0x06ff('0x7'));var config=require(_0x06ff('0x8'));var attributes=require(_0x06ff('0x9'));module[_0x06ff('0xa')]=function(_0x1f1fa0,_0x79af3c){return _0x1f1fa0[_0x06ff('0xb')](_0x06ff('0xc'),attributes,{'tableName':_0x06ff('0xd'),'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 9d9f8ce..ccc70dc 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 _0x74f0=['body','raw','then','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateAttachment'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x74f0,0xf3));var _0x074f=function(_0x218756,_0x419c39){_0x218756=_0x218756-0x0;var _0x1b90ec=_0x74f0[_0x218756];return _0x1b90ec;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x074f('0x1'));var fs=require('fs');var Redis=require(_0x074f('0x2'));var db=require(_0x074f('0x3'))['db'];var utils=require(_0x074f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x074f('0x5'));var jayson=require(_0x074f('0x6'));var client=jayson[_0x074f('0x7')][_0x074f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10b244,_0x395b3c,_0x3dd440){return new BPromise(function(_0x547297,_0x7108e1){return client[_0x074f('0x9')](_0x10b244,_0x3dd440)['then'](function(_0x252a2e){logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));logger[_0x074f('0xd')]('Attachment,\x20%s,\x20%s,\x20%s',_0x395b3c,'request\x20sent',JSON[_0x074f('0xe')](_0x252a2e));if(_0x252a2e[_0x074f('0xf')]){if(_0x252a2e[_0x074f('0xf')][_0x074f('0x10')]===0x1f4){logger[_0x074f('0xf')](_0x074f('0xb'),_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x7108e1(_0x252a2e[_0x074f('0xf')]['message']);}logger[_0x074f('0xf')]('Attachment,\x20%s,\x20%s',_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x547297(_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);}else{logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));_0x547297(_0x252a2e[_0x074f('0x12')][_0x074f('0x11')]);}})[_0x074f('0x13')](function(_0x40fd10){logger['error'](_0x074f('0xb'),_0x395b3c,_0x40fd10);_0x7108e1(_0x40fd10);});});}exports[_0x074f('0x14')]=function(_0x200e43){var _0x3facd8=this;return new Promise(function(_0x315e7d,_0x1c5406){return db['Attachment']['create'](_0x200e43[_0x074f('0x15')],{'raw':_0x200e43['options']?_0x200e43['options'][_0x074f('0x16')]===undefined?!![]:![]:!![]})[_0x074f('0x17')](function(_0x1563f3){logger[_0x074f('0xa')](_0x074f('0x14'),_0x200e43);logger[_0x074f('0xd')](_0x074f('0x14'),_0x200e43,JSON[_0x074f('0xe')](_0x1563f3));_0x315e7d(_0x1563f3);})[_0x074f('0x13')](function(_0x2c3b23){logger[_0x074f('0xf')](_0x074f('0x14'),_0x2c3b23[_0x074f('0x11')],_0x200e43);_0x1c5406(_0x3facd8[_0x074f('0xf')](0x1f4,_0x2c3b23[_0x074f('0x11')]));});});}; \ No newline at end of file +var _0xa588=['debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','create','body','options','raw'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0xa588,0xe1));var _0x8a58=function(_0x47397f,_0x45ba05){_0x47397f=_0x47397f-0x0;var _0xba5ff1=_0xa588[_0x47397f];return _0xba5ff1;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var moment=require(_0x8a58('0x1'));var BPromise=require(_0x8a58('0x2'));var rs=require(_0x8a58('0x3'));var fs=require('fs');var Redis=require(_0x8a58('0x4'));var db=require(_0x8a58('0x5'))['db'];var utils=require(_0x8a58('0x6'));var logger=require(_0x8a58('0x7'))(_0x8a58('0x8'));var config=require('../../config/environment');var jayson=require(_0x8a58('0x9'));var client=jayson[_0x8a58('0xa')][_0x8a58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35d5ad,_0xe0af18,_0x140f99){return new BPromise(function(_0x77b421,_0x585376){return client['request'](_0x35d5ad,_0x140f99)[_0x8a58('0xc')](function(_0x39a20e){logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));logger['debug'](_0x8a58('0x10'),_0xe0af18,_0x8a58('0xf'),JSON[_0x8a58('0x11')](_0x39a20e));if(_0x39a20e[_0x8a58('0x12')]){if(_0x39a20e['error']['code']===0x1f4){logger[_0x8a58('0x12')]('Attachment,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x585376(_0x39a20e['error'][_0x8a58('0x13')]);}logger[_0x8a58('0x12')]('Attachment,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x77b421(_0x39a20e['error'][_0x8a58('0x13')]);}else{logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));_0x77b421(_0x39a20e[_0x8a58('0x14')][_0x8a58('0x13')]);}})[_0x8a58('0x15')](function(_0x49ee0e){logger['error'](_0x8a58('0xe'),_0xe0af18,_0x49ee0e);_0x585376(_0x49ee0e);});});}exports[_0x8a58('0x16')]=function(_0x18a14d){var _0x4b5012=this;return new Promise(function(_0x282f2d,_0xe73eb9){return db['Attachment'][_0x8a58('0x17')](_0x18a14d[_0x8a58('0x18')],{'raw':_0x18a14d[_0x8a58('0x19')]?_0x18a14d[_0x8a58('0x19')][_0x8a58('0x1a')]===undefined?!![]:![]:!![]})[_0x8a58('0xc')](function(_0x284bb8){logger[_0x8a58('0xd')](_0x8a58('0x16'),_0x18a14d);logger[_0x8a58('0x1b')](_0x8a58('0x16'),_0x18a14d,JSON[_0x8a58('0x11')](_0x284bb8));_0x282f2d(_0x284bb8);})[_0x8a58('0x15')](function(_0x34adb8){logger['error'](_0x8a58('0x16'),_0x34adb8[_0x8a58('0x13')],_0x18a14d);_0xe73eb9(_0x4b5012[_0x8a58('0x12')](0x1f4,_0x34adb8[_0x8a58('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6939385..11c57c6 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0x0b0e[_0x3efe9b];return _0x132073;};'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['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 118d15d..6312b62 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 _0x1245=['blocked','blockedAt','add','minutes','clearBlockUser','getLicense','lodash','passport','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','/login','profile','callback','use','clientID','clientSecret','secret','callbackURL','Setting','allowedLoginAttempts','blockDuration','then','find','map','emails','value','admin','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x4de2c5,_0x21aeb7){var _0x4ef52b=function(_0x5e52f4){while(--_0x5e52f4){_0x4de2c5['push'](_0x4de2c5['shift']());}};_0x4ef52b(++_0x21aeb7);}(_0x1245,0xde));var _0x5124=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1245[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5124('0x0'));var passport=require(_0x5124('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x5124('0x2')];var moment=require(_0x5124('0x3'));var db=require(_0x5124('0x4'))['db'];var config=require(_0x5124('0x5'));var signToken=require(_0x5124('0x6'))['signToken'];var utils=require(_0x5124('0x7'));exports[_0x5124('0x8')]=passport[_0x5124('0x9')](_0x5124('0xa'),{'failureRedirect':_0x5124('0xb'),'scope':[_0x5124('0xc'),'email'],'session':![]});exports[_0x5124('0xd')]=passport[_0x5124('0x9')](_0x5124('0xa'),{'failureRedirect':_0x5124('0xb'),'session':![]});passport[_0x5124('0xe')](new GoogleStrategy({'clientID':config[_0x5124('0xa')]?config[_0x5124('0xa')][_0x5124('0xf')]:'id','clientSecret':config[_0x5124('0xa')]?config[_0x5124('0xa')][_0x5124('0x10')]:_0x5124('0x11'),'callbackURL':config[_0x5124('0xa')]?config[_0x5124('0xa')][_0x5124('0x12')]:''},function(_0x552beb,_0x5ca3ae,_0x56d9a6,_0x14bde2){var _0x46693a,_0x2a7512;return db[_0x5124('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0x5124('0x14'),_0x5124('0x15')],'raw':!![]})[_0x5124('0x16')](function(_0x3fe18f){_0x46693a=_0x3fe18f;return db['User'][_0x5124('0x17')]({'where':{'email':_[_0x5124('0x18')](_0x56d9a6[_0x5124('0x19')],_0x5124('0x1a')),'role':{'$or':[_0x5124('0x1b'),'user','agent']}}});})[_0x5124('0x16')](function(_0x34147a){_0x2a7512=_0x34147a;if(_0x2a7512){if(_0x2a7512[_0x5124('0x1c')]){return _0x14bde2(_0x5124('0x1d'));}else if(_0x46693a['blockDuration']>0x0){if(_0x2a7512[_0x5124('0x1e')]){if(moment(_0x2a7512[_0x5124('0x1f')])[_0x5124('0x20')](_0x46693a[_0x5124('0x15')],_0x5124('0x21'))>moment()){return _0x14bde2(_0x5124('0x1d'));}else{return utils[_0x5124('0x22')](_0x2a7512,0x0,![],null)['then'](function(){return utils[_0x5124('0x23')](_0x2a7512);})[_0x5124('0x16')](function(){return _0x14bde2(null,_0x2a7512);});}}else{return utils[_0x5124('0x23')](_0x2a7512)[_0x5124('0x16')](function(){return _0x14bde2(null,_0x2a7512);});}}else{return utils[_0x5124('0x23')](_0x2a7512)[_0x5124('0x16')](function(){return _0x14bde2(null,_0x2a7512);});}}return _0x14bde2('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x21c1d2){_0x14bde2(_0x21c1d2);});})); \ No newline at end of file +var _0xc818=['passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','google','/login','profile','callback','use','clientID','clientSecret','callbackURL','Setting','allowedLoginAttempts','blockDuration','then','User','map','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','getLicense','catch','lodash','passport'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xc818,0x86));var _0x8c81=function(_0x6a3be8,_0x3cfef3){_0x6a3be8=_0x6a3be8-0x0;var _0x5d041b=_0xc818[_0x6a3be8];return _0x5d041b;};'use strict';var _=require(_0x8c81('0x0'));var passport=require(_0x8c81('0x1'));var GoogleStrategy=require(_0x8c81('0x2'))[_0x8c81('0x3')];var moment=require('moment');var db=require(_0x8c81('0x4'))['db'];var config=require(_0x8c81('0x5'));var signToken=require(_0x8c81('0x6'))['signToken'];var utils=require(_0x8c81('0x7'));exports['login']=passport['authenticate'](_0x8c81('0x8'),{'failureRedirect':_0x8c81('0x9'),'scope':[_0x8c81('0xa'),'email'],'session':![]});exports[_0x8c81('0xb')]=passport['authenticate'](_0x8c81('0x8'),{'failureRedirect':_0x8c81('0x9'),'session':![]});passport[_0x8c81('0xc')](new GoogleStrategy({'clientID':config[_0x8c81('0x8')]?config[_0x8c81('0x8')][_0x8c81('0xd')]:'id','clientSecret':config[_0x8c81('0x8')]?config['google'][_0x8c81('0xe')]:'secret','callbackURL':config['google']?config['google'][_0x8c81('0xf')]:''},function(_0xff8bf6,_0x2c3007,_0x449941,_0x1c63be){var _0x1993d0,_0x1081b5;return db[_0x8c81('0x10')]['findOne']({'where':{'id':0x1},'attributes':[_0x8c81('0x11'),_0x8c81('0x12')],'raw':!![]})[_0x8c81('0x13')](function(_0x5cd9ed){_0x1993d0=_0x5cd9ed;return db[_0x8c81('0x14')]['find']({'where':{'email':_[_0x8c81('0x15')](_0x449941['emails'],_0x8c81('0x16')),'role':{'$or':[_0x8c81('0x17'),_0x8c81('0x18'),_0x8c81('0x19')]}}});})[_0x8c81('0x13')](function(_0x110c2a){_0x1081b5=_0x110c2a;if(_0x1081b5){if(_0x1081b5[_0x8c81('0x1a')]){return _0x1c63be(_0x8c81('0x1b'));}else if(_0x1993d0['blockDuration']>0x0){if(_0x1081b5[_0x8c81('0x1c')]){if(moment(_0x1081b5[_0x8c81('0x1d')])[_0x8c81('0x1e')](_0x1993d0[_0x8c81('0x12')],_0x8c81('0x1f'))>moment()){return _0x1c63be('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x1081b5,0x0,![],null)[_0x8c81('0x13')](function(){return utils[_0x8c81('0x20')](_0x1081b5);})['then'](function(){return _0x1c63be(null,_0x1081b5);});}}else{return utils[_0x8c81('0x20')](_0x1081b5)[_0x8c81('0x13')](function(){return _0x1c63be(null,_0x1081b5);});}}else{return utils[_0x8c81('0x20')](_0x1081b5)[_0x8c81('0x13')](function(){return _0x1c63be(null,_0x1081b5);});}}return _0x1c63be(_0x8c81('0x1b'));})[_0x8c81('0x21')](function(_0x4b1a56){_0x1c63be(_0x4b1a56);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 00eddc7..6db8eea 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 _0x4024=['exports','express','passport','Router','../user/user.controller.js','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x4024,0xdd));var _0x4402=function(_0x30966a,_0x166040){_0x30966a=_0x30966a-0x0;var _0x197cde=_0x4024[_0x30966a];return _0x197cde;};'use strict';var express=require(_0x4402('0x0'));var passport=require(_0x4402('0x1'));var router=express[_0x4402('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x4402('0x3'));var authService=require('../../components/auth/service');router[_0x4402('0x4')]('/',controller[_0x4402('0x5')]);router[_0x4402('0x4')](_0x4402('0x6'),controller[_0x4402('0x7')],authService[_0x4402('0x8')],userController[_0x4402('0x5')],authService[_0x4402('0x9')]);module[_0x4402('0xa')]=router; \ No newline at end of file +var _0x362a=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x3d25e6,_0x2e55a3){var _0x3639c0=function(_0x2ac5a4){while(--_0x2ac5a4){_0x3d25e6['push'](_0x3d25e6['shift']());}};_0x3639c0(++_0x2e55a3);}(_0x362a,0x102));var _0xa362=function(_0x14d233,_0x4289f7){_0x14d233=_0x14d233-0x0;var _0x2d4c76=_0x362a[_0x14d233];return _0x2d4c76;};'use strict';var express=require(_0xa362('0x0'));var passport=require(_0xa362('0x1'));var router=express[_0xa362('0x2')]();var controller=require(_0xa362('0x3'));var userController=require(_0xa362('0x4'));var authService=require(_0xa362('0x5'));router[_0xa362('0x6')]('/',controller[_0xa362('0x7')]);router[_0xa362('0x6')](_0xa362('0x8'),controller[_0xa362('0x9')],authService[_0xa362('0xa')],userController['login'],authService[_0xa362('0xb')]);module[_0xa362('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 3be1220..3cc7245 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 _0x730a=['Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','password','save','Password\x20reset!','util','passport'];(function(_0x2838fe,_0x34aa60){var _0x3617a4=function(_0x111d9b){while(--_0x111d9b){_0x2838fe['push'](_0x2838fe['shift']());}};_0x3617a4(++_0x34aa60);}(_0x730a,0x1b1));var _0xa730=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0x730a[_0x53b199];return _0x1ba42d;};'use strict';var util=require(_0xa730('0x0'));var passport=require(_0xa730('0x1'));var LocalStrategy=require('passport-local')[_0xa730('0x2')];var jayson=require(_0xa730('0x3'));var _=require(_0xa730('0x4'));var rs=require(_0xa730('0x5'));var moment=require(_0xa730('0x6'));var db=require(_0xa730('0x7'))['db'];var authService=require(_0xa730('0x8'));var utils=require(_0xa730('0x9'));var client=jayson[_0xa730('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x8b6ded,_0x22c8a6,_0x2c8031,_0x1fed81){var _0x52cc04,_0x351847;return db[_0xa730('0xb')][_0xa730('0xc')]({'where':{'id':0x1},'attributes':[_0xa730('0xd'),_0xa730('0xe')],'raw':!![]})['then'](function(_0x55b2d5){_0x52cc04=_0x55b2d5;return _0x8b6ded[_0xa730('0xc')]({'attributes':['id','name','password',_0xa730('0xf'),_0xa730('0x10'),_0xa730('0x11'),_0xa730('0x12'),_0xa730('0x13'),_0xa730('0x14')],'where':{'name':_0x22c8a6,'role':{'$or':[_0xa730('0x15'),_0xa730('0x16'),_0xa730('0x17')]}}});})[_0xa730('0x18')](function(_0x5c74f4){if(!_0x5c74f4||_0x5c74f4&&_0x5c74f4[_0xa730('0x19')]!==_0x22c8a6){throw new Error(_0xa730('0x1a'));}else{_0x351847=_0x5c74f4;return _0x351847;}})['then'](function(){_0x351847[_0xa730('0x1b')](_0x2c8031,function(_0xc20b71,_0x572aa3){var _0x27d78c=_0x351847['loginAttempts']+0x1;if(_0xc20b71){return _0x1fed81(_0xc20b71);}else if(!_0x572aa3){if(_0x351847[_0xa730('0x11')]){return _0x1fed81(null,![],{'message':_0xa730('0x1a')});}else if(_0x52cc04[_0xa730('0xd')]>0x0){if(_0x351847[_0xa730('0x12')]){if(_0x52cc04[_0xa730('0xe')]>0x0){if(moment(_0x351847['blockedAt'])[_0xa730('0x1c')](_0x52cc04[_0xa730('0xe')],_0xa730('0x1d'))>moment()){return _0x1fed81(null,![],{'message':_0xa730('0x1a')});}else{return utils[_0xa730('0x1e')](_0x351847,_0x27d78c,![],null)['then'](function(){return _0x1fed81(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1fed81(null,![],{'message':_0xa730('0x1a')});}}else{if(_0x27d78c>=_0x52cc04[_0xa730('0xd')]){return utils[_0xa730('0x1e')](_0x351847,0x0,!![],moment())[_0xa730('0x18')](function(){return _0x1fed81(null,![],{'message':_0xa730('0x1a')});});}else{return utils[_0xa730('0x1e')](_0x351847,_0x27d78c,![],null)[_0xa730('0x18')](function(){return _0x1fed81(null,![],{'message':_0xa730('0x1a')});});}}}else{return _0x1fed81(null,![],{'message':_0xa730('0x1a')});}}else{if(_0x351847[_0xa730('0x11')]){return _0x1fed81(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x52cc04[_0xa730('0xd')]>0x0){if(_0x351847[_0xa730('0x12')]){if(_0x52cc04[_0xa730('0xe')]>0x0){if(moment(_0x351847['blockedAt'])[_0xa730('0x1c')](_0x52cc04[_0xa730('0xe')],_0xa730('0x1d'))>moment()){return _0x1fed81(null,![],{'message':_0xa730('0x1a')});}else{return utils[_0xa730('0x1e')](_0x351847,0x0,![],null)[_0xa730('0x18')](function(){return utils[_0xa730('0x1f')](_0x351847);})[_0xa730('0x18')](function(){return _0x1fed81(null,_0x351847);});}}else{return _0x1fed81(null,![],{'message':_0xa730('0x1a')});}}else{return utils[_0xa730('0x1e')](_0x351847,0x0,![],null)[_0xa730('0x18')](function(){return utils[_0xa730('0x1f')](_0x351847);})['then'](function(){return _0x1fed81(null,_0x351847);})[_0xa730('0x20')](function(_0x4b99a6){return _0x1fed81(null,![],_0x4b99a6);});}}else{if(_0x351847[_0xa730('0x12')]){return _0x1fed81(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x351847)['then'](function(){return _0x1fed81(null,_0x351847);});}}}});})[_0xa730('0x20')](function(_0x1b4fcc){return _0x1fed81(null,![],_0x1b4fcc);});}function sendServiceMail(_0x170783){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0xa730('0x19'),_0xa730('0x21')],'include':[{'model':db['MailServerOut'],'as':_0xa730('0x22')}]})['then'](function(_0x9a51b5){if(!_0x9a51b5){throw new Error(_0xa730('0x23'));}var _0x75ad84={'tls':{'rejectUnauthorized':![]}};if(_0x9a51b5[_0xa730('0x22')][_0xa730('0x24')]){_0x75ad84[_0xa730('0x24')]=_0x9a51b5['Smtp'][_0xa730('0x24')];}else{_0x75ad84[_0xa730('0x25')]=_0x9a51b5[_0xa730('0x22')][_0xa730('0x25')];_0x75ad84[_0xa730('0x26')]=_0x9a51b5[_0xa730('0x22')][_0xa730('0x26')];_0x75ad84[_0xa730('0x27')]=_0x9a51b5[_0xa730('0x22')][_0xa730('0x27')];}if(_0x9a51b5[_0xa730('0x22')][_0xa730('0x28')]){_0x75ad84[_0xa730('0x29')]={'user':_0x9a51b5[_0xa730('0x22')][_0xa730('0x16')],'pass':_0x9a51b5[_0xa730('0x22')][_0xa730('0x2a')]};}var _0x32cf8a={'account':_0x75ad84,'message':_[_0xa730('0x2b')]({'from':util[_0xa730('0x2c')](_0xa730('0x2d'),_0x9a51b5[_0xa730('0x19')],_0x9a51b5[_0xa730('0x21')]||_0x9a51b5['Smtp'][_0xa730('0x16')])},_0x170783)};return client[_0xa730('0x2e')](_0xa730('0x2f'),_0x32cf8a);})[_0xa730('0x18')](function(_0xd4fa30){if(_0xd4fa30[_0xa730('0x30')]){throw new Error(util[_0xa730('0x2c')](_0xa730('0x31'),_0xd4fa30[_0xa730('0x30')][_0xa730('0x32')]||JSON[_0xa730('0x33')](_0xd4fa30[_0xa730('0x30')])));}return!![];});}function handleError(_0x3d84fd,_0x1eebe6,_0x5265fa){return _0x3d84fd[_0xa730('0x34')](_0x1eebe6||0x1f4)[_0xa730('0x35')]({'message':_0x5265fa?_0x5265fa[_0xa730('0x32')]||_0x5265fa:''});}exports['login']=function(_0x52751b,_0x1083b7,_0x41a994){passport['authenticate']('local',function(_0xf703a3,_0x4edbc5,_0x4bc1c1){var _0x33ba2b=_0xf703a3||_0x4bc1c1;if(_0x33ba2b){return handleError(_0x1083b7,0x191,_0x33ba2b);}if(!_0x4edbc5){return handleError(_0x1083b7,0x194,{'message':_0xa730('0x36')});}else{var _0x35f89d={'payload':{'id':_0x4edbc5['id'],'role':_0x4edbc5['role']},'options':{'expiresIn':0x15180}};return authService[_0xa730('0x37')](_0x35f89d)[_0xa730('0x18')](function(_0x460b26){_0x1083b7['json']({'id':_0x4edbc5['id'],'token':_0x460b26,'statusCall':'','isAlreadyLogged':_0x4edbc5[_0xa730('0x38')]});});}})(_0x52751b,_0x1083b7,_0x41a994);};exports[_0xa730('0x39')]=function(_0x156247,_0x5f4ffc,_0x2d5072){if(!_0x156247['body'][_0xa730('0x21')]){return handleError(_0x5f4ffc,0x1f4,{'message':_0xa730('0x3a')});}var _0x3e1275=rs[_0xa730('0x3b')]();_0x156247['body'][_0xa730('0x21')]=_0x156247[_0xa730('0x3c')][_0xa730('0x21')][_0xa730('0x3d')]()['toLowerCase']();var _0x49896e;return db[_0xa730('0xb')][_0xa730('0xc')]({'where':{'id':0x1},'attributes':[_0xa730('0xd'),'blockDuration'],'raw':!![]})[_0xa730('0x18')](function(_0x52cb2e){_0x49896e=_0x52cb2e;return db[_0xa730('0x3e')][_0xa730('0x3f')]({'where':{'email':_0x156247['body'][_0xa730('0x21')]}});})[_0xa730('0x18')](function(_0x2e7f35){if(!_0x2e7f35){throw new Error(_0xa730('0x40'));}if(_0x2e7f35[_0xa730('0x11')]){throw new Error(_0xa730('0x41'));}if(_0x2e7f35['blocked']){if(moment(_0x2e7f35[_0xa730('0x13')])[_0xa730('0x1c')](_0x49896e[_0xa730('0xe')],_0xa730('0x1d'))>moment()){throw new Error(_0xa730('0x42'));}else{_0x2e7f35[_0xa730('0x12')]=![];_0x2e7f35['blockedAt']=null;}}_0x2e7f35[_0xa730('0x43')]=_0x3e1275;_0x2e7f35[_0xa730('0x44')]=Date[_0xa730('0x45')]()+0x36ee80;return _0x2e7f35['save']();})['then'](function(){return sendServiceMail({'to':_0x156247[_0xa730('0x3c')][_0xa730('0x21')],'subject':_0xa730('0x46'),'text':_0xa730('0x47')+_0xa730('0x48')+'https://'+_0x156247[_0xa730('0x49')]['host']+_0xa730('0x4a')+_0x3e1275+'\x0a\x0a'+_0xa730('0x4b')});})[_0xa730('0x18')](function(){_0x5f4ffc[_0xa730('0x34')](0xc8)['send']({'message':_0xa730('0x4c')});})[_0xa730('0x20')](function(_0x5618f9){return handleError(_0x5f4ffc,0x1f4,_0x5618f9);});};exports[_0xa730('0x4d')]=function(_0x58a098,_0x41ae57,_0x1ce3e4){return db[_0xa730('0x3e')]['find']({'where':{'resetPasswordToken':_0x58a098['params'][_0xa730('0x4e')],'resetPasswordExpires':{'$gt':Date[_0xa730('0x45')]()}}})[_0xa730('0x18')](function(_0x3332aa){if(!_0x3332aa){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xa730('0xb')][_0xa730('0xc')]({'attributes':['id',_0xa730('0x4f'),_0xa730('0x50'),_0xa730('0x51')]})[_0xa730('0x18')](function(_0x46700b){if(_0x46700b[_0xa730('0x4f')])authService[_0xa730('0x52')](_0x58a098[_0xa730('0x3c')]['password']);if(!_0x46700b[_0xa730('0x50')]||!_0x3332aa[_0xa730('0x53')])return _0x3332aa;authService['validatePasswordHistory'](_0x58a098['body'][_0xa730('0x54')],_0x3332aa[_0xa730('0x53')],_0x46700b[_0xa730('0x51')]);return _0x3332aa;})['then'](function(){_0x3332aa[_0xa730('0x54')]=_0x58a098['body'][_0xa730('0x54')];_0x3332aa[_0xa730('0x43')]=null;_0x3332aa[_0xa730('0x44')]=null;return _0x3332aa[_0xa730('0x55')]();});})['then'](function(){_0x41ae57[_0xa730('0x34')](0xc8)['send']({'message':_0xa730('0x56')});})[_0xa730('0x20')](function(_0xd7ac3f){return handleError(_0x41ae57,0x1f4,_0xd7ac3f);});};passport['use'](new LocalStrategy({'usernameField':_0xa730('0x19'),'passwordField':_0xa730('0x54')},function(_0x4fe452,_0x2757fb,_0x5dd0d2){return localAuthenticate(db['User'],_0x4fe452,_0x2757fb,_0x5dd0d2);})); \ No newline at end of file +var _0xc343=['Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','password','salt','role','disabled','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','blockedAt','add','blockDuration','minutes','clearBlockUser','getLicense','catch','MailAccount','email','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body'];(function(_0xa06e80,_0x552e22){var _0x3729f8=function(_0x22d078){while(--_0x22d078){_0xa06e80['push'](_0xa06e80['shift']());}};_0x3729f8(++_0x552e22);}(_0xc343,0x173));var _0x3c34=function(_0x309d68,_0x971dd1){_0x309d68=_0x309d68-0x0;var _0x2c6801=_0xc343[_0x309d68];return _0x2c6801;};'use strict';var util=require(_0x3c34('0x0'));var passport=require('passport');var LocalStrategy=require(_0x3c34('0x1'))[_0x3c34('0x2')];var jayson=require(_0x3c34('0x3'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x3c34('0x4'));var db=require(_0x3c34('0x5'))['db'];var authService=require(_0x3c34('0x6'));var utils=require(_0x3c34('0x7'));var client=jayson[_0x3c34('0x8')][_0x3c34('0x9')]({'port':0x232b});function localAuthenticate(_0x401457,_0x2b12df,_0x9b457,_0x3d7335){var _0x351315,_0x1e98c3;return db[_0x3c34('0xa')][_0x3c34('0xb')]({'where':{'id':0x1},'attributes':[_0x3c34('0xc'),'blockDuration'],'raw':!![]})[_0x3c34('0xd')](function(_0x519a26){_0x351315=_0x519a26;return _0x401457[_0x3c34('0xb')]({'attributes':['id','name',_0x3c34('0xe'),_0x3c34('0xf'),_0x3c34('0x10'),_0x3c34('0x11'),'blocked','blockedAt',_0x3c34('0x12')],'where':{'name':_0x2b12df,'role':{'$or':[_0x3c34('0x13'),'user',_0x3c34('0x14')]}}});})[_0x3c34('0xd')](function(_0x50b90d){if(!_0x50b90d||_0x50b90d&&_0x50b90d[_0x3c34('0x15')]!==_0x2b12df){throw new Error(_0x3c34('0x16'));}else{_0x1e98c3=_0x50b90d;return _0x1e98c3;}})[_0x3c34('0xd')](function(){_0x1e98c3[_0x3c34('0x17')](_0x9b457,function(_0x236ffc,_0x277539){var _0x1ab6d9=_0x1e98c3['loginAttempts']+0x1;if(_0x236ffc){return _0x3d7335(_0x236ffc);}else if(!_0x277539){if(_0x1e98c3[_0x3c34('0x11')]){return _0x3d7335(null,![],{'message':_0x3c34('0x16')});}else if(_0x351315[_0x3c34('0xc')]>0x0){if(_0x1e98c3[_0x3c34('0x18')]){if(_0x351315['blockDuration']>0x0){if(moment(_0x1e98c3[_0x3c34('0x19')])[_0x3c34('0x1a')](_0x351315[_0x3c34('0x1b')],_0x3c34('0x1c'))>moment()){return _0x3d7335(null,![],{'message':_0x3c34('0x16')});}else{return utils[_0x3c34('0x1d')](_0x1e98c3,_0x1ab6d9,![],null)[_0x3c34('0xd')](function(){return _0x3d7335(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3d7335(null,![],{'message':_0x3c34('0x16')});}}else{if(_0x1ab6d9>=_0x351315[_0x3c34('0xc')]){return utils[_0x3c34('0x1d')](_0x1e98c3,0x0,!![],moment())['then'](function(){return _0x3d7335(null,![],{'message':_0x3c34('0x16')});});}else{return utils[_0x3c34('0x1d')](_0x1e98c3,_0x1ab6d9,![],null)[_0x3c34('0xd')](function(){return _0x3d7335(null,![],{'message':_0x3c34('0x16')});});}}}else{return _0x3d7335(null,![],{'message':_0x3c34('0x16')});}}else{if(_0x1e98c3[_0x3c34('0x11')]){return _0x3d7335(null,![],{'message':_0x3c34('0x16')});}else if(_0x351315[_0x3c34('0xc')]>0x0){if(_0x1e98c3[_0x3c34('0x18')]){if(_0x351315[_0x3c34('0x1b')]>0x0){if(moment(_0x1e98c3[_0x3c34('0x19')])[_0x3c34('0x1a')](_0x351315['blockDuration'],_0x3c34('0x1c'))>moment()){return _0x3d7335(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3c34('0x1d')](_0x1e98c3,0x0,![],null)[_0x3c34('0xd')](function(){return utils[_0x3c34('0x1e')](_0x1e98c3);})[_0x3c34('0xd')](function(){return _0x3d7335(null,_0x1e98c3);});}}else{return _0x3d7335(null,![],{'message':_0x3c34('0x16')});}}else{return utils[_0x3c34('0x1d')](_0x1e98c3,0x0,![],null)[_0x3c34('0xd')](function(){return utils[_0x3c34('0x1e')](_0x1e98c3);})['then'](function(){return _0x3d7335(null,_0x1e98c3);})[_0x3c34('0x1f')](function(_0x1e3764){return _0x3d7335(null,![],_0x1e3764);});}}else{if(_0x1e98c3[_0x3c34('0x18')]){return _0x3d7335(null,![],{'message':_0x3c34('0x16')});}else{return utils['getLicense'](_0x1e98c3)[_0x3c34('0xd')](function(){return _0x3d7335(null,_0x1e98c3);});}}}});})['catch'](function(_0x5892b0){return _0x3d7335(null,![],_0x5892b0);});}function sendServiceMail(_0x48ba00){return db[_0x3c34('0x20')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x3c34('0x21')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})['then'](function(_0x5ef622){if(!_0x5ef622){throw new Error(_0x3c34('0x22'));}var _0x431b7c={'tls':{'rejectUnauthorized':![]}};if(_0x5ef622[_0x3c34('0x23')]['service']){_0x431b7c[_0x3c34('0x24')]=_0x5ef622[_0x3c34('0x23')][_0x3c34('0x24')];}else{_0x431b7c[_0x3c34('0x25')]=_0x5ef622['Smtp'][_0x3c34('0x25')];_0x431b7c[_0x3c34('0x26')]=_0x5ef622['Smtp']['port'];_0x431b7c[_0x3c34('0x27')]=_0x5ef622[_0x3c34('0x23')][_0x3c34('0x27')];}if(_0x5ef622[_0x3c34('0x23')][_0x3c34('0x28')]){_0x431b7c[_0x3c34('0x29')]={'user':_0x5ef622[_0x3c34('0x23')][_0x3c34('0x2a')],'pass':_0x5ef622[_0x3c34('0x23')][_0x3c34('0x2b')]};}var _0x51187a={'account':_0x431b7c,'message':_[_0x3c34('0x2c')]({'from':util[_0x3c34('0x2d')](_0x3c34('0x2e'),_0x5ef622[_0x3c34('0x15')],_0x5ef622[_0x3c34('0x21')]||_0x5ef622[_0x3c34('0x23')][_0x3c34('0x2a')])},_0x48ba00)};return client['request'](_0x3c34('0x2f'),_0x51187a);})['then'](function(_0x454019){if(_0x454019['error']){throw new Error(util[_0x3c34('0x2d')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x454019[_0x3c34('0x30')][_0x3c34('0x31')]||JSON[_0x3c34('0x32')](_0x454019[_0x3c34('0x30')])));}return!![];});}function handleError(_0x4e791d,_0x1cee5f,_0x517ed5){return _0x4e791d['status'](_0x1cee5f||0x1f4)[_0x3c34('0x33')]({'message':_0x517ed5?_0x517ed5['message']||_0x517ed5:''});}exports[_0x3c34('0x34')]=function(_0x219481,_0x30c311,_0x20f93b){passport['authenticate']('local',function(_0x59db30,_0x13d19b,_0x249832){var _0xfd3dad=_0x59db30||_0x249832;if(_0xfd3dad){return handleError(_0x30c311,0x191,_0xfd3dad);}if(!_0x13d19b){return handleError(_0x30c311,0x194,{'message':_0x3c34('0x35')});}else{var _0x536bf8={'payload':{'id':_0x13d19b['id'],'role':_0x13d19b['role']},'options':{'expiresIn':0x15180}};return authService[_0x3c34('0x36')](_0x536bf8)[_0x3c34('0xd')](function(_0x1e7c08){_0x30c311[_0x3c34('0x37')]({'id':_0x13d19b['id'],'token':_0x1e7c08,'statusCall':'','isAlreadyLogged':_0x13d19b[_0x3c34('0x38')]});});}})(_0x219481,_0x30c311,_0x20f93b);};exports[_0x3c34('0x39')]=function(_0x56ae4d,_0x32913f,_0x875eb2){if(!_0x56ae4d[_0x3c34('0x3a')][_0x3c34('0x21')]){return handleError(_0x32913f,0x1f4,{'message':_0x3c34('0x3b')});}var _0x1fdd75=rs[_0x3c34('0x3c')]();_0x56ae4d[_0x3c34('0x3a')][_0x3c34('0x21')]=_0x56ae4d[_0x3c34('0x3a')]['email'][_0x3c34('0x3d')]()[_0x3c34('0x3e')]();var _0x25432f;return db[_0x3c34('0xa')][_0x3c34('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x3c34('0xd')](function(_0x566f8c){_0x25432f=_0x566f8c;return db[_0x3c34('0x3f')][_0x3c34('0x40')]({'where':{'email':_0x56ae4d[_0x3c34('0x3a')][_0x3c34('0x21')]}});})[_0x3c34('0xd')](function(_0x3abfd8){if(!_0x3abfd8){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x3abfd8['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3abfd8[_0x3c34('0x18')]){if(moment(_0x3abfd8[_0x3c34('0x19')])[_0x3c34('0x1a')](_0x25432f[_0x3c34('0x1b')],_0x3c34('0x1c'))>moment()){throw new Error(_0x3c34('0x41'));}else{_0x3abfd8['blocked']=![];_0x3abfd8[_0x3c34('0x19')]=null;}}_0x3abfd8[_0x3c34('0x42')]=_0x1fdd75;_0x3abfd8['resetPasswordExpires']=Date[_0x3c34('0x43')]()+0x36ee80;return _0x3abfd8[_0x3c34('0x44')]();})[_0x3c34('0xd')](function(){return sendServiceMail({'to':_0x56ae4d[_0x3c34('0x3a')][_0x3c34('0x21')],'subject':_0x3c34('0x45'),'text':_0x3c34('0x46')+_0x3c34('0x47')+'https://'+_0x56ae4d[_0x3c34('0x48')][_0x3c34('0x25')]+_0x3c34('0x49')+_0x1fdd75+'\x0a\x0a'+_0x3c34('0x4a')});})[_0x3c34('0xd')](function(){_0x32913f[_0x3c34('0x4b')](0xc8)[_0x3c34('0x33')]({'message':_0x3c34('0x4c')});})[_0x3c34('0x1f')](function(_0x348c74){return handleError(_0x32913f,0x1f4,_0x348c74);});};exports['reset']=function(_0x283243,_0x4631d8,_0x2913f7){return db['User'][_0x3c34('0x40')]({'where':{'resetPasswordToken':_0x283243[_0x3c34('0x4d')][_0x3c34('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x3c34('0x43')]()}}})[_0x3c34('0xd')](function(_0x393a67){if(!_0x393a67){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x3c34('0xa')][_0x3c34('0xb')]({'attributes':['id',_0x3c34('0x4f'),_0x3c34('0x50'),_0x3c34('0x51')]})['then'](function(_0x21334c){if(_0x21334c[_0x3c34('0x4f')])authService[_0x3c34('0x52')](_0x283243['body'][_0x3c34('0xe')]);if(!_0x21334c[_0x3c34('0x50')]||!_0x393a67['previousPasswords'])return _0x393a67;authService['validatePasswordHistory'](_0x283243['body'][_0x3c34('0xe')],_0x393a67[_0x3c34('0x53')],_0x21334c['passwordHistoryLimit']);return _0x393a67;})[_0x3c34('0xd')](function(){_0x393a67['password']=_0x283243[_0x3c34('0x3a')][_0x3c34('0xe')];_0x393a67[_0x3c34('0x42')]=null;_0x393a67['resetPasswordExpires']=null;return _0x393a67[_0x3c34('0x44')]();});})[_0x3c34('0xd')](function(){_0x4631d8[_0x3c34('0x4b')](0xc8)[_0x3c34('0x33')]({'message':_0x3c34('0x54')});})[_0x3c34('0x1f')](function(_0x193d8c){return handleError(_0x4631d8,0x1f4,_0x193d8c);});};passport[_0x3c34('0x55')](new LocalStrategy({'usernameField':_0x3c34('0x15'),'passwordField':_0x3c34('0xe')},function(_0x439c75,_0x46aa36,_0x43739b){return localAuthenticate(db[_0x3c34('0x3f')],_0x439c75,_0x46aa36,_0x43739b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 5665cf4..a6388ba 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 _0x2aee=['forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','login','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2aee,0x187));var _0xe2ae=function(_0x5c6ceb,_0x4ed099){_0x5c6ceb=_0x5c6ceb-0x0;var _0x28821b=_0x2aee[_0x5c6ceb];return _0x28821b;};'use strict';var express=require(_0xe2ae('0x0'));var router=express[_0xe2ae('0x1')]();var controller=require(_0xe2ae('0x2'));router['post']('/',controller[_0xe2ae('0x3')]);router[_0xe2ae('0x4')]('/forgot',controller[_0xe2ae('0x5')]);router['post'](_0xe2ae('0x6'),controller[_0xe2ae('0x7')]);module[_0xe2ae('0x8')]=router; \ No newline at end of file +var _0xe5e6=['forgot','/reset/:token','reset','express','./authLocal.controller','post','/forgot'];(function(_0x1e1bd9,_0x5d2e0c){var _0x28ea77=function(_0x359f98){while(--_0x359f98){_0x1e1bd9['push'](_0x1e1bd9['shift']());}};_0x28ea77(++_0x5d2e0c);}(_0xe5e6,0x168));var _0x6e5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe5e6[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0x6e5e('0x0'));var router=express['Router']();var controller=require(_0x6e5e('0x1'));router['post']('/',controller['login']);router[_0x6e5e('0x2')](_0x6e5e('0x3'),controller[_0x6e5e('0x4')]);router[_0x6e5e('0x2')](_0x6e5e('0x5'),controller[_0x6e5e('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index fc4503c..7d8878d 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 _0x5186=['BOOLEAN','sequelize','exports','STRING'];(function(_0xaa8da2,_0x39f582){var _0x3ab359=function(_0x461be6){while(--_0x461be6){_0xaa8da2['push'](_0xaa8da2['shift']());}};_0x3ab359(++_0x39f582);}(_0x5186,0x1c1));var _0x6518=function(_0x2f6e39,_0x4f535c){_0x2f6e39=_0x2f6e39-0x0;var _0x1c29c4=_0x5186[_0x2f6e39];return _0x1c29c4;};'use strict';var Sequelize=require(_0x6518('0x0'));module[_0x6518('0x1')]={'name':{'type':Sequelize[_0x6518('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x6518('0x2')]},'description':{'type':Sequelize[_0x6518('0x2')]},'status':{'type':Sequelize[_0x6518('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x7f59=['STRING','INTEGER','sequelize','exports'];(function(_0x3adf4e,_0x26d25f){var _0x4dc28b=function(_0x38d031){while(--_0x38d031){_0x3adf4e['push'](_0x3adf4e['shift']());}};_0x4dc28b(++_0x26d25f);}(_0x7f59,0xba));var _0x97f5=function(_0x51ab0a,_0x2c6928){_0x51ab0a=_0x51ab0a-0x0;var _0x35d20e=_0x7f59[_0x51ab0a];return _0x35d20e;};'use strict';var Sequelize=require(_0x97f5('0x0'));module[_0x97f5('0x1')]={'name':{'type':Sequelize[_0x97f5('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x97f5('0x3')],'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 5237ed2..08e83c2 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 _0x3f22=['status','offset','limit','count','set','apply','reject','save','update','then','error','stack','name','send','map','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','Automation','findAll','rows','catch','show','rawAttributes','includeAll','merge','options','find','create','body','params','destroy','Condition','ids','omit','findOne','pick','getConditions','addActions','Action','getActions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end'];(function(_0x1c16a3,_0x17969e){var _0x2633a1=function(_0x21fdcc){while(--_0x21fdcc){_0x1c16a3['push'](_0x1c16a3['shift']());}};_0x2633a1(++_0x17969e);}(_0x3f22,0x171));var _0x23f2=function(_0x4f4e3c,_0x3e3457){_0x4f4e3c=_0x4f4e3c-0x0;var _0x184067=_0x3f22[_0x4f4e3c];return _0x184067;};'use strict';var emlformat=require(_0x23f2('0x0'));var rimraf=require(_0x23f2('0x1'));var zipdir=require(_0x23f2('0x2'));var jsonpatch=require(_0x23f2('0x3'));var rp=require(_0x23f2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x23f2('0x5'));var util=require(_0x23f2('0x6'));var path=require(_0x23f2('0x7'));var sox=require(_0x23f2('0x8'));var csv=require('to-csv');var ejs=require(_0x23f2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23f2('0xa'));var squel=require(_0x23f2('0xb'));var crypto=require('crypto');var jsforce=require(_0x23f2('0xc'));var deskjs=require(_0x23f2('0xd'));var toCsv=require(_0x23f2('0xe'));var querystring=require('querystring');var Papa=require(_0x23f2('0xf'));var Redis=require(_0x23f2('0x10'));var authService=require(_0x23f2('0x11'));var qs=require(_0x23f2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23f2('0x13'));var logger=require(_0x23f2('0x14'))(_0x23f2('0x15'));var utils=require(_0x23f2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x23f2('0x17'))['db'];function respondWithStatusCode(_0x369d61,_0x90ca4){_0x90ca4=_0x90ca4||0xcc;return function(_0x4905e0){if(_0x4905e0){return _0x369d61[_0x23f2('0x18')](_0x90ca4);}return _0x369d61['status'](_0x90ca4)[_0x23f2('0x19')]();};}function respondWithResult(_0x5847d1,_0x5d58a4){_0x5d58a4=_0x5d58a4||0xc8;return function(_0x3aea0b){if(_0x3aea0b){return _0x5847d1[_0x23f2('0x1a')](_0x5d58a4)['json'](_0x3aea0b);}};}function respondWithFilteredResult(_0x25a401,_0x319758){return function(_0x8ed1d6){if(_0x8ed1d6){var _0x477e60=typeof _0x319758[_0x23f2('0x1b')]==='undefined'&&typeof _0x319758[_0x23f2('0x1c')]==='undefined';var _0xdcdc32=_0x8ed1d6[_0x23f2('0x1d')];var _0x2663bc=_0x477e60?0x0:_0x319758[_0x23f2('0x1b')];var _0x2a1010=_0x477e60?_0x8ed1d6[_0x23f2('0x1d')]:_0x319758['offset']+_0x319758[_0x23f2('0x1c')];var _0x2841ca;if(_0x2a1010>=_0xdcdc32){_0x2a1010=_0xdcdc32;_0x2841ca=0xc8;}else{_0x2841ca=0xce;}_0x25a401[_0x23f2('0x1a')](_0x2841ca);return _0x25a401[_0x23f2('0x1e')]('Content-Range',_0x2663bc+'-'+_0x2a1010+'/'+_0xdcdc32)['json'](_0x8ed1d6);}return null;};}function patchUpdates(_0x1d7d7f){return function(_0x94028d){try{jsonpatch[_0x23f2('0x1f')](_0x94028d,_0x1d7d7f,!![]);}catch(_0x2937e3){return BPromise[_0x23f2('0x20')](_0x2937e3);}return _0x94028d[_0x23f2('0x21')]();};}function saveUpdates(_0x22bdf8,_0x25fd9f){return function(_0x14f849){if(_0x14f849){return _0x14f849[_0x23f2('0x22')](_0x22bdf8)[_0x23f2('0x23')](function(_0x3b6ec9){return _0x3b6ec9;});}return null;};}function removeEntity(_0x56ca36,_0x4a55bd){return function(_0x478044){if(_0x478044){return _0x478044['destroy']()['then'](function(){_0x56ca36[_0x23f2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b1ad,_0x3fdb15){return function(_0x55f50e){if(!_0x55f50e){_0x13b1ad['sendStatus'](0x194);}return _0x55f50e;};}function handleError(_0x1bd5f6,_0x2f26c2){_0x2f26c2=_0x2f26c2||0x1f4;return function(_0x48708f){logger[_0x23f2('0x24')](_0x48708f[_0x23f2('0x25')]);if(_0x48708f[_0x23f2('0x26')]){delete _0x48708f[_0x23f2('0x26')];}_0x1bd5f6['status'](_0x2f26c2)[_0x23f2('0x27')](_0x48708f);};}exports['index']=function(_0x34a4ef,_0x1f9836){var _0x5f0ec3={},_0x2efab4={},_0xb99101={'count':0x0,'rows':[]};var _0x232ce3=_[_0x23f2('0x28')](db['Automation']['rawAttributes'],function(_0x3d8854){return{'name':_0x3d8854['fieldName'],'type':_0x3d8854['type']['key']};});_0x2efab4[_0x23f2('0x29')]=_[_0x23f2('0x28')](_0x232ce3,_0x23f2('0x26'));_0x2efab4[_0x23f2('0x2a')]=_[_0x23f2('0x2b')](_0x34a4ef['query']);_0x2efab4[_0x23f2('0x2c')]=_['intersection'](_0x2efab4[_0x23f2('0x29')],_0x2efab4[_0x23f2('0x2a')]);_0x5f0ec3[_0x23f2('0x2d')]=_[_0x23f2('0x2e')](_0x2efab4[_0x23f2('0x29')],qs['fields'](_0x34a4ef[_0x23f2('0x2a')][_0x23f2('0x2f')]));_0x5f0ec3[_0x23f2('0x2d')]=_0x5f0ec3[_0x23f2('0x2d')][_0x23f2('0x30')]?_0x5f0ec3[_0x23f2('0x2d')]:_0x2efab4[_0x23f2('0x29')];if(!_0x34a4ef['query']['hasOwnProperty'](_0x23f2('0x31'))){_0x5f0ec3['limit']=qs['limit'](_0x34a4ef[_0x23f2('0x2a')]['limit']);_0x5f0ec3[_0x23f2('0x1b')]=qs['offset'](_0x34a4ef[_0x23f2('0x2a')]['offset']);}_0x5f0ec3[_0x23f2('0x32')]=qs['sort'](_0x34a4ef[_0x23f2('0x2a')][_0x23f2('0x33')]);_0x5f0ec3[_0x23f2('0x34')]=qs[_0x23f2('0x2c')](_['pick'](_0x34a4ef['query'],_0x2efab4['filters']),_0x232ce3);if(_0x34a4ef[_0x23f2('0x2a')][_0x23f2('0x35')]){_0x5f0ec3[_0x23f2('0x34')]=_['merge'](_0x5f0ec3['where'],{'$or':_[_0x23f2('0x28')](_0x232ce3,function(_0x13cf38){if(_0x13cf38['type']!==_0x23f2('0x36')){var _0x372cd5={};_0x372cd5[_0x13cf38[_0x23f2('0x26')]]={'$like':'%'+_0x34a4ef[_0x23f2('0x2a')][_0x23f2('0x35')]+'%'};return _0x372cd5;}})});}_0x5f0ec3=_['merge']({},_0x5f0ec3,_0x34a4ef['options']);var _0x3607b0={'where':_0x5f0ec3[_0x23f2('0x34')]};return db[_0x23f2('0x37')][_0x23f2('0x1d')](_0x3607b0)[_0x23f2('0x23')](function(_0x10aaf7){_0xb99101[_0x23f2('0x1d')]=_0x10aaf7;if(_0x34a4ef[_0x23f2('0x2a')]['includeAll']){_0x5f0ec3['include']=[{'all':!![]}];}return db[_0x23f2('0x37')][_0x23f2('0x38')](_0x5f0ec3);})[_0x23f2('0x23')](function(_0x54eff2){_0xb99101[_0x23f2('0x39')]=_0x54eff2;return _0xb99101;})[_0x23f2('0x23')](respondWithFilteredResult(_0x1f9836,_0x5f0ec3))[_0x23f2('0x3a')](handleError(_0x1f9836,null));};exports[_0x23f2('0x3b')]=function(_0x330588,_0xbf01bb){var _0x18b148={'raw':![],'where':{'id':_0x330588['params']['id']}},_0x5dad43={};_0x5dad43[_0x23f2('0x29')]=_[_0x23f2('0x2b')](db[_0x23f2('0x37')][_0x23f2('0x3c')]);_0x5dad43[_0x23f2('0x2a')]=_[_0x23f2('0x2b')](_0x330588['query']);_0x5dad43[_0x23f2('0x2c')]=_[_0x23f2('0x2e')](_0x5dad43[_0x23f2('0x29')],_0x5dad43[_0x23f2('0x2a')]);_0x18b148[_0x23f2('0x2d')]=_[_0x23f2('0x2e')](_0x5dad43[_0x23f2('0x29')],qs[_0x23f2('0x2f')](_0x330588[_0x23f2('0x2a')][_0x23f2('0x2f')]));_0x18b148[_0x23f2('0x2d')]=_0x18b148[_0x23f2('0x2d')][_0x23f2('0x30')]?_0x18b148[_0x23f2('0x2d')]:_0x5dad43[_0x23f2('0x29')];if(_0x330588[_0x23f2('0x2a')][_0x23f2('0x3d')]){_0x18b148['include']=[{'all':!![]}];}_0x18b148=_[_0x23f2('0x3e')]({},_0x18b148,_0x330588[_0x23f2('0x3f')]);return db['Automation'][_0x23f2('0x40')](_0x18b148)['then'](handleEntityNotFound(_0xbf01bb,null))['then'](respondWithResult(_0xbf01bb,null))[_0x23f2('0x3a')](handleError(_0xbf01bb,null));};exports['create']=function(_0x19daf4,_0x314c9d){return db[_0x23f2('0x37')][_0x23f2('0x41')](_0x19daf4['body'],{})[_0x23f2('0x23')](respondWithResult(_0x314c9d,0xc9))['catch'](handleError(_0x314c9d,null));};exports[_0x23f2('0x22')]=function(_0x4a5c1a,_0x3eee48){if(_0x4a5c1a[_0x23f2('0x42')]['id']){delete _0x4a5c1a['body']['id'];}return db[_0x23f2('0x37')]['find']({'where':{'id':_0x4a5c1a[_0x23f2('0x43')]['id']}})[_0x23f2('0x23')](handleEntityNotFound(_0x3eee48,null))[_0x23f2('0x23')](saveUpdates(_0x4a5c1a[_0x23f2('0x42')],null))[_0x23f2('0x23')](respondWithResult(_0x3eee48,null))[_0x23f2('0x3a')](handleError(_0x3eee48,null));};exports[_0x23f2('0x44')]=function(_0x1dc0da,_0xa9191a){return db[_0x23f2('0x37')][_0x23f2('0x40')]({'where':{'id':_0x1dc0da[_0x23f2('0x43')]['id']}})[_0x23f2('0x23')](handleEntityNotFound(_0xa9191a,null))[_0x23f2('0x23')](removeEntity(_0xa9191a,null))[_0x23f2('0x3a')](handleError(_0xa9191a,null));};exports['addConditions']=function(_0x33eef0,_0x2db9ca,_0x359fa8){return db[_0x23f2('0x45')][_0x23f2('0x40')]({'where':{'id':_0x33eef0['params']['id']}})['then'](handleEntityNotFound(_0x2db9ca,null))[_0x23f2('0x23')](function(_0x123b1f){if(_0x123b1f){return _0x123b1f['addConditions'](_0x33eef0['body'][_0x23f2('0x46')],_[_0x23f2('0x47')](_0x33eef0[_0x23f2('0x42')],['ids','id'])||{});}})['then'](respondWithResult(_0x2db9ca,null))[_0x23f2('0x3a')](handleError(_0x2db9ca,null));};exports['getConditions']=function(_0x1915ff,_0x700be1,_0x487f17){var _0x457a67={};var _0x1a67e2={};var _0x754da;var _0x4b57b0;return db[_0x23f2('0x37')][_0x23f2('0x48')]({'where':{'id':_0x1915ff[_0x23f2('0x43')]['id']}})[_0x23f2('0x23')](handleEntityNotFound(_0x700be1,null))[_0x23f2('0x23')](function(_0x5422d3){if(_0x5422d3){_0x754da=_0x5422d3;_0x1a67e2[_0x23f2('0x29')]=_[_0x23f2('0x2b')](db['Condition'][_0x23f2('0x3c')]);_0x1a67e2['query']=_['keys'](_0x1915ff[_0x23f2('0x2a')]);_0x1a67e2['filters']=_[_0x23f2('0x2e')](_0x1a67e2['model'],_0x1a67e2[_0x23f2('0x2a')]);_0x457a67[_0x23f2('0x2d')]=_[_0x23f2('0x2e')](_0x1a67e2[_0x23f2('0x29')],qs['fields'](_0x1915ff[_0x23f2('0x2a')][_0x23f2('0x2f')]));_0x457a67['attributes']=_0x457a67[_0x23f2('0x2d')][_0x23f2('0x30')]?_0x457a67['attributes']:_0x1a67e2[_0x23f2('0x29')];_0x457a67[_0x23f2('0x32')]=qs[_0x23f2('0x33')](_0x1915ff[_0x23f2('0x2a')][_0x23f2('0x33')]);_0x457a67[_0x23f2('0x34')]=qs['filters'](_[_0x23f2('0x49')](_0x1915ff[_0x23f2('0x2a')],_0x1a67e2[_0x23f2('0x2c')]));if(_0x1915ff[_0x23f2('0x2a')][_0x23f2('0x35')]){_0x457a67[_0x23f2('0x34')]=_['merge'](_0x457a67['where'],{'$or':_[_0x23f2('0x28')](_0x457a67['attributes'],function(_0x4dd107){var _0x29fb7d={};_0x29fb7d[_0x4dd107]={'$like':'%'+_0x1915ff[_0x23f2('0x2a')]['filter']+'%'};return _0x29fb7d;})});}_0x457a67=_['merge']({},_0x457a67,_0x1915ff[_0x23f2('0x3f')]);return _0x754da[_0x23f2('0x4a')](_0x457a67);}})[_0x23f2('0x23')](function(_0x3ad24e){if(_0x3ad24e){_0x4b57b0=_0x3ad24e[_0x23f2('0x30')];if(!_0x1915ff[_0x23f2('0x2a')]['hasOwnProperty'](_0x23f2('0x31'))){_0x457a67[_0x23f2('0x1c')]=qs[_0x23f2('0x1c')](_0x1915ff['query'][_0x23f2('0x1c')]);_0x457a67['offset']=qs[_0x23f2('0x1b')](_0x1915ff[_0x23f2('0x2a')][_0x23f2('0x1b')]);}return _0x754da[_0x23f2('0x4a')](_0x457a67);}})[_0x23f2('0x23')](function(_0x6bcb03){if(_0x6bcb03){return _0x6bcb03?{'count':_0x4b57b0,'rows':_0x6bcb03}:null;}})[_0x23f2('0x23')](respondWithResult(_0x700be1,null))[_0x23f2('0x3a')](handleError(_0x700be1,null));};exports[_0x23f2('0x4b')]=function(_0x25a3a8,_0x4e44f6,_0x425b4a){return db[_0x23f2('0x4c')][_0x23f2('0x40')]({'where':{'id':_0x25a3a8['params']['id']}})[_0x23f2('0x23')](handleEntityNotFound(_0x4e44f6,null))[_0x23f2('0x23')](function(_0x75bc29){if(_0x75bc29){return _0x75bc29[_0x23f2('0x4b')](_0x25a3a8[_0x23f2('0x42')][_0x23f2('0x46')],_[_0x23f2('0x47')](_0x25a3a8[_0x23f2('0x42')],['ids','id'])||{});}})['then'](respondWithResult(_0x4e44f6,null))['catch'](handleError(_0x4e44f6,null));};exports[_0x23f2('0x4d')]=function(_0x2c81da,_0x259c2a,_0x518569){var _0x2a423c={};var _0x54fbfd={};var _0x53cf81;var _0x6a5ee0;return db[_0x23f2('0x37')][_0x23f2('0x48')]({'where':{'id':_0x2c81da['params']['id']}})[_0x23f2('0x23')](handleEntityNotFound(_0x259c2a,null))['then'](function(_0x4a9b03){if(_0x4a9b03){_0x53cf81=_0x4a9b03;_0x54fbfd[_0x23f2('0x29')]=_['keys'](db[_0x23f2('0x4c')][_0x23f2('0x3c')]);_0x54fbfd[_0x23f2('0x2a')]=_[_0x23f2('0x2b')](_0x2c81da[_0x23f2('0x2a')]);_0x54fbfd[_0x23f2('0x2c')]=_[_0x23f2('0x2e')](_0x54fbfd[_0x23f2('0x29')],_0x54fbfd[_0x23f2('0x2a')]);_0x2a423c['attributes']=_[_0x23f2('0x2e')](_0x54fbfd[_0x23f2('0x29')],qs[_0x23f2('0x2f')](_0x2c81da[_0x23f2('0x2a')][_0x23f2('0x2f')]));_0x2a423c[_0x23f2('0x2d')]=_0x2a423c[_0x23f2('0x2d')][_0x23f2('0x30')]?_0x2a423c[_0x23f2('0x2d')]:_0x54fbfd[_0x23f2('0x29')];_0x2a423c[_0x23f2('0x32')]=qs['sort'](_0x2c81da[_0x23f2('0x2a')]['sort']);_0x2a423c[_0x23f2('0x34')]=qs[_0x23f2('0x2c')](_[_0x23f2('0x49')](_0x2c81da[_0x23f2('0x2a')],_0x54fbfd[_0x23f2('0x2c')]));if(_0x2c81da[_0x23f2('0x2a')][_0x23f2('0x35')]){_0x2a423c[_0x23f2('0x34')]=_[_0x23f2('0x3e')](_0x2a423c[_0x23f2('0x34')],{'$or':_[_0x23f2('0x28')](_0x2a423c['attributes'],function(_0x1b7187){var _0x295579={};_0x295579[_0x1b7187]={'$like':'%'+_0x2c81da[_0x23f2('0x2a')]['filter']+'%'};return _0x295579;})});}_0x2a423c=_[_0x23f2('0x3e')]({},_0x2a423c,_0x2c81da[_0x23f2('0x3f')]);return _0x53cf81['getActions'](_0x2a423c);}})[_0x23f2('0x23')](function(_0x19e02f){if(_0x19e02f){_0x6a5ee0=_0x19e02f[_0x23f2('0x30')];if(!_0x2c81da[_0x23f2('0x2a')][_0x23f2('0x4e')](_0x23f2('0x31'))){_0x2a423c[_0x23f2('0x1c')]=qs[_0x23f2('0x1c')](_0x2c81da[_0x23f2('0x2a')][_0x23f2('0x1c')]);_0x2a423c['offset']=qs[_0x23f2('0x1b')](_0x2c81da[_0x23f2('0x2a')][_0x23f2('0x1b')]);}return _0x53cf81[_0x23f2('0x4d')](_0x2a423c);}})[_0x23f2('0x23')](function(_0xe61941){if(_0xe61941){return _0xe61941?{'count':_0x6a5ee0,'rows':_0xe61941}:null;}})[_0x23f2('0x23')](respondWithResult(_0x259c2a,null))['catch'](handleError(_0x259c2a,null));}; \ No newline at end of file +var _0xa9cb=['attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','Automation','type','model','keys','filters'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa9cb,0x125));var _0xba9c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9cb[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xba9c('0x0'));var rimraf=require(_0xba9c('0x1'));var zipdir=require(_0xba9c('0x2'));var jsonpatch=require(_0xba9c('0x3'));var rp=require(_0xba9c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xba9c('0x5'));var util=require('util');var path=require(_0xba9c('0x6'));var sox=require(_0xba9c('0x7'));var csv=require(_0xba9c('0x8'));var ejs=require(_0xba9c('0x9'));var fs=require('fs');var fs_extra=require(_0xba9c('0xa'));var _=require(_0xba9c('0xb'));var squel=require(_0xba9c('0xc'));var crypto=require(_0xba9c('0xd'));var jsforce=require(_0xba9c('0xe'));var deskjs=require(_0xba9c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba9c('0x10'));var Redis=require(_0xba9c('0x11'));var authService=require(_0xba9c('0x12'));var qs=require(_0xba9c('0x13'));var as=require(_0xba9c('0x14'));var hardwareService=require(_0xba9c('0x15'));var logger=require(_0xba9c('0x16'))(_0xba9c('0x17'));var utils=require(_0xba9c('0x18'));var config=require(_0xba9c('0x19'));var licenseUtil=require(_0xba9c('0x1a'));var db=require(_0xba9c('0x1b'))['db'];function respondWithStatusCode(_0x36020f,_0x366c3f){_0x366c3f=_0x366c3f||0xcc;return function(_0x1bf2fe){if(_0x1bf2fe){return _0x36020f[_0xba9c('0x1c')](_0x366c3f);}return _0x36020f[_0xba9c('0x1d')](_0x366c3f)[_0xba9c('0x1e')]();};}function respondWithResult(_0x16587e,_0x1b5b04){_0x1b5b04=_0x1b5b04||0xc8;return function(_0x5bcd30){if(_0x5bcd30){return _0x16587e[_0xba9c('0x1d')](_0x1b5b04)['json'](_0x5bcd30);}};}function respondWithFilteredResult(_0x4f0cb,_0x13db57){return function(_0x30eccb){if(_0x30eccb){var _0x9e2848=typeof _0x13db57['offset']===_0xba9c('0x1f')&&typeof _0x13db57[_0xba9c('0x20')]===_0xba9c('0x1f');var _0x210475=_0x30eccb['count'];var _0x265046=_0x9e2848?0x0:_0x13db57[_0xba9c('0x21')];var _0x2404ec=_0x9e2848?_0x30eccb[_0xba9c('0x22')]:_0x13db57[_0xba9c('0x21')]+_0x13db57[_0xba9c('0x20')];var _0x1b7ebe;if(_0x2404ec>=_0x210475){_0x2404ec=_0x210475;_0x1b7ebe=0xc8;}else{_0x1b7ebe=0xce;}_0x4f0cb[_0xba9c('0x1d')](_0x1b7ebe);return _0x4f0cb[_0xba9c('0x23')](_0xba9c('0x24'),_0x265046+'-'+_0x2404ec+'/'+_0x210475)['json'](_0x30eccb);}return null;};}function patchUpdates(_0x49904d){return function(_0x37406c){try{jsonpatch[_0xba9c('0x25')](_0x37406c,_0x49904d,!![]);}catch(_0x41ed7e){return BPromise[_0xba9c('0x26')](_0x41ed7e);}return _0x37406c['save']();};}function saveUpdates(_0x1c02e5,_0x5d863b){return function(_0x24ddc6){if(_0x24ddc6){return _0x24ddc6[_0xba9c('0x27')](_0x1c02e5)[_0xba9c('0x28')](function(_0x42d49a){return _0x42d49a;});}return null;};}function removeEntity(_0x2b829a,_0x5e1cd3){return function(_0x444a4c){if(_0x444a4c){return _0x444a4c[_0xba9c('0x29')]()[_0xba9c('0x28')](function(){_0x2b829a[_0xba9c('0x1d')](0xcc)[_0xba9c('0x1e')]();});}};}function handleEntityNotFound(_0xb676c2,_0xdd90d2){return function(_0x1912db){if(!_0x1912db){_0xb676c2[_0xba9c('0x1c')](0x194);}return _0x1912db;};}function handleError(_0x3664c4,_0x52e9e1){_0x52e9e1=_0x52e9e1||0x1f4;return function(_0x499bc9){logger['error'](_0x499bc9['stack']);if(_0x499bc9[_0xba9c('0x2a')]){delete _0x499bc9[_0xba9c('0x2a')];}_0x3664c4[_0xba9c('0x1d')](_0x52e9e1)[_0xba9c('0x2b')](_0x499bc9);};}exports[_0xba9c('0x2c')]=function(_0x3b3d01,_0x545ac5){var _0x2f3118={},_0x4b1597={},_0x47a7a0={'count':0x0,'rows':[]};var _0x46be5f=_[_0xba9c('0x2d')](db[_0xba9c('0x2e')]['rawAttributes'],function(_0xd7b73e){return{'name':_0xd7b73e['fieldName'],'type':_0xd7b73e[_0xba9c('0x2f')]['key']};});_0x4b1597[_0xba9c('0x30')]=_[_0xba9c('0x2d')](_0x46be5f,_0xba9c('0x2a'));_0x4b1597['query']=_[_0xba9c('0x31')](_0x3b3d01['query']);_0x4b1597[_0xba9c('0x32')]=_['intersection'](_0x4b1597['model'],_0x4b1597['query']);_0x2f3118[_0xba9c('0x33')]=_[_0xba9c('0x34')](_0x4b1597[_0xba9c('0x30')],qs[_0xba9c('0x35')](_0x3b3d01[_0xba9c('0x36')][_0xba9c('0x35')]));_0x2f3118[_0xba9c('0x33')]=_0x2f3118[_0xba9c('0x33')][_0xba9c('0x37')]?_0x2f3118[_0xba9c('0x33')]:_0x4b1597[_0xba9c('0x30')];if(!_0x3b3d01[_0xba9c('0x36')][_0xba9c('0x38')](_0xba9c('0x39'))){_0x2f3118[_0xba9c('0x20')]=qs['limit'](_0x3b3d01['query'][_0xba9c('0x20')]);_0x2f3118[_0xba9c('0x21')]=qs[_0xba9c('0x21')](_0x3b3d01['query'][_0xba9c('0x21')]);}_0x2f3118[_0xba9c('0x3a')]=qs[_0xba9c('0x3b')](_0x3b3d01[_0xba9c('0x36')]['sort']);_0x2f3118['where']=qs[_0xba9c('0x32')](_[_0xba9c('0x3c')](_0x3b3d01[_0xba9c('0x36')],_0x4b1597[_0xba9c('0x32')]),_0x46be5f);if(_0x3b3d01['query'][_0xba9c('0x3d')]){_0x2f3118[_0xba9c('0x3e')]=_[_0xba9c('0x3f')](_0x2f3118[_0xba9c('0x3e')],{'$or':_[_0xba9c('0x2d')](_0x46be5f,function(_0x4089f9){if(_0x4089f9[_0xba9c('0x2f')]!==_0xba9c('0x40')){var _0x427734={};_0x427734[_0x4089f9['name']]={'$like':'%'+_0x3b3d01[_0xba9c('0x36')][_0xba9c('0x3d')]+'%'};return _0x427734;}})});}_0x2f3118=_['merge']({},_0x2f3118,_0x3b3d01[_0xba9c('0x41')]);var _0x4975fc={'where':_0x2f3118['where']};return db[_0xba9c('0x2e')]['count'](_0x4975fc)[_0xba9c('0x28')](function(_0x2f123d){_0x47a7a0[_0xba9c('0x22')]=_0x2f123d;if(_0x3b3d01[_0xba9c('0x36')][_0xba9c('0x42')]){_0x2f3118['include']=[{'all':!![]}];}return db['Automation'][_0xba9c('0x43')](_0x2f3118);})['then'](function(_0x48d8cd){_0x47a7a0[_0xba9c('0x44')]=_0x48d8cd;return _0x47a7a0;})[_0xba9c('0x28')](respondWithFilteredResult(_0x545ac5,_0x2f3118))[_0xba9c('0x45')](handleError(_0x545ac5,null));};exports[_0xba9c('0x46')]=function(_0x3dd37a,_0x3ee490){var _0x813e39={'raw':![],'where':{'id':_0x3dd37a[_0xba9c('0x47')]['id']}},_0x5f5a73={};_0x5f5a73[_0xba9c('0x30')]=_[_0xba9c('0x31')](db[_0xba9c('0x2e')][_0xba9c('0x48')]);_0x5f5a73[_0xba9c('0x36')]=_[_0xba9c('0x31')](_0x3dd37a[_0xba9c('0x36')]);_0x5f5a73[_0xba9c('0x32')]=_[_0xba9c('0x34')](_0x5f5a73[_0xba9c('0x30')],_0x5f5a73[_0xba9c('0x36')]);_0x813e39['attributes']=_[_0xba9c('0x34')](_0x5f5a73[_0xba9c('0x30')],qs[_0xba9c('0x35')](_0x3dd37a[_0xba9c('0x36')][_0xba9c('0x35')]));_0x813e39[_0xba9c('0x33')]=_0x813e39[_0xba9c('0x33')][_0xba9c('0x37')]?_0x813e39['attributes']:_0x5f5a73['model'];if(_0x3dd37a[_0xba9c('0x36')][_0xba9c('0x42')]){_0x813e39[_0xba9c('0x49')]=[{'all':!![]}];}_0x813e39=_[_0xba9c('0x3f')]({},_0x813e39,_0x3dd37a[_0xba9c('0x41')]);return db[_0xba9c('0x2e')][_0xba9c('0x4a')](_0x813e39)[_0xba9c('0x28')](handleEntityNotFound(_0x3ee490,null))[_0xba9c('0x28')](respondWithResult(_0x3ee490,null))[_0xba9c('0x45')](handleError(_0x3ee490,null));};exports[_0xba9c('0x4b')]=function(_0x4071d2,_0x4229a6){return db[_0xba9c('0x2e')][_0xba9c('0x4b')](_0x4071d2[_0xba9c('0x4c')],{})[_0xba9c('0x28')](respondWithResult(_0x4229a6,0xc9))[_0xba9c('0x45')](handleError(_0x4229a6,null));};exports[_0xba9c('0x27')]=function(_0x332fb4,_0x52d4f1){if(_0x332fb4[_0xba9c('0x4c')]['id']){delete _0x332fb4[_0xba9c('0x4c')]['id'];}return db[_0xba9c('0x2e')]['find']({'where':{'id':_0x332fb4[_0xba9c('0x47')]['id']}})[_0xba9c('0x28')](handleEntityNotFound(_0x52d4f1,null))[_0xba9c('0x28')](saveUpdates(_0x332fb4[_0xba9c('0x4c')],null))['then'](respondWithResult(_0x52d4f1,null))[_0xba9c('0x45')](handleError(_0x52d4f1,null));};exports['destroy']=function(_0x2ec21f,_0x2aa91b){return db[_0xba9c('0x2e')][_0xba9c('0x4a')]({'where':{'id':_0x2ec21f['params']['id']}})[_0xba9c('0x28')](handleEntityNotFound(_0x2aa91b,null))[_0xba9c('0x28')](removeEntity(_0x2aa91b,null))[_0xba9c('0x45')](handleError(_0x2aa91b,null));};exports[_0xba9c('0x4d')]=function(_0x1d9512,_0x335815,_0x6c7fbe){return db[_0xba9c('0x4e')][_0xba9c('0x4a')]({'where':{'id':_0x1d9512[_0xba9c('0x47')]['id']}})['then'](handleEntityNotFound(_0x335815,null))[_0xba9c('0x28')](function(_0x5bb3fa){if(_0x5bb3fa){return _0x5bb3fa[_0xba9c('0x4d')](_0x1d9512[_0xba9c('0x4c')][_0xba9c('0x4f')],_[_0xba9c('0x50')](_0x1d9512[_0xba9c('0x4c')],[_0xba9c('0x4f'),'id'])||{});}})[_0xba9c('0x28')](respondWithResult(_0x335815,null))['catch'](handleError(_0x335815,null));};exports[_0xba9c('0x51')]=function(_0x18d649,_0x34f64d,_0x1ec6c4){var _0x4fddd9={};var _0x4c645c={};var _0x1bcbbf;var _0x58be28;return db[_0xba9c('0x2e')][_0xba9c('0x52')]({'where':{'id':_0x18d649['params']['id']}})[_0xba9c('0x28')](handleEntityNotFound(_0x34f64d,null))['then'](function(_0x288768){if(_0x288768){_0x1bcbbf=_0x288768;_0x4c645c[_0xba9c('0x30')]=_[_0xba9c('0x31')](db[_0xba9c('0x4e')][_0xba9c('0x48')]);_0x4c645c[_0xba9c('0x36')]=_['keys'](_0x18d649[_0xba9c('0x36')]);_0x4c645c[_0xba9c('0x32')]=_[_0xba9c('0x34')](_0x4c645c[_0xba9c('0x30')],_0x4c645c[_0xba9c('0x36')]);_0x4fddd9[_0xba9c('0x33')]=_['intersection'](_0x4c645c[_0xba9c('0x30')],qs['fields'](_0x18d649[_0xba9c('0x36')][_0xba9c('0x35')]));_0x4fddd9[_0xba9c('0x33')]=_0x4fddd9['attributes'][_0xba9c('0x37')]?_0x4fddd9[_0xba9c('0x33')]:_0x4c645c[_0xba9c('0x30')];_0x4fddd9[_0xba9c('0x3a')]=qs[_0xba9c('0x3b')](_0x18d649[_0xba9c('0x36')][_0xba9c('0x3b')]);_0x4fddd9[_0xba9c('0x3e')]=qs[_0xba9c('0x32')](_[_0xba9c('0x3c')](_0x18d649['query'],_0x4c645c[_0xba9c('0x32')]));if(_0x18d649[_0xba9c('0x36')][_0xba9c('0x3d')]){_0x4fddd9[_0xba9c('0x3e')]=_[_0xba9c('0x3f')](_0x4fddd9[_0xba9c('0x3e')],{'$or':_[_0xba9c('0x2d')](_0x4fddd9[_0xba9c('0x33')],function(_0x506e80){var _0x1d4f59={};_0x1d4f59[_0x506e80]={'$like':'%'+_0x18d649[_0xba9c('0x36')][_0xba9c('0x3d')]+'%'};return _0x1d4f59;})});}_0x4fddd9=_[_0xba9c('0x3f')]({},_0x4fddd9,_0x18d649[_0xba9c('0x41')]);return _0x1bcbbf[_0xba9c('0x51')](_0x4fddd9);}})['then'](function(_0x5267e3){if(_0x5267e3){_0x58be28=_0x5267e3[_0xba9c('0x37')];if(!_0x18d649[_0xba9c('0x36')]['hasOwnProperty'](_0xba9c('0x39'))){_0x4fddd9[_0xba9c('0x20')]=qs[_0xba9c('0x20')](_0x18d649[_0xba9c('0x36')][_0xba9c('0x20')]);_0x4fddd9[_0xba9c('0x21')]=qs[_0xba9c('0x21')](_0x18d649[_0xba9c('0x36')][_0xba9c('0x21')]);}return _0x1bcbbf[_0xba9c('0x51')](_0x4fddd9);}})[_0xba9c('0x28')](function(_0x2cada8){if(_0x2cada8){return _0x2cada8?{'count':_0x58be28,'rows':_0x2cada8}:null;}})[_0xba9c('0x28')](respondWithResult(_0x34f64d,null))['catch'](handleError(_0x34f64d,null));};exports[_0xba9c('0x53')]=function(_0x489d5b,_0x53aba2,_0x9f4e31){return db[_0xba9c('0x54')][_0xba9c('0x4a')]({'where':{'id':_0x489d5b['params']['id']}})[_0xba9c('0x28')](handleEntityNotFound(_0x53aba2,null))['then'](function(_0x31e963){if(_0x31e963){return _0x31e963[_0xba9c('0x53')](_0x489d5b[_0xba9c('0x4c')][_0xba9c('0x4f')],_[_0xba9c('0x50')](_0x489d5b[_0xba9c('0x4c')],['ids','id'])||{});}})[_0xba9c('0x28')](respondWithResult(_0x53aba2,null))[_0xba9c('0x45')](handleError(_0x53aba2,null));};exports[_0xba9c('0x55')]=function(_0x672bc3,_0x12cb5e,_0x358832){var _0x157396={};var _0x48f1b5={};var _0x5474e5;var _0x5842b5;return db[_0xba9c('0x2e')][_0xba9c('0x52')]({'where':{'id':_0x672bc3[_0xba9c('0x47')]['id']}})[_0xba9c('0x28')](handleEntityNotFound(_0x12cb5e,null))[_0xba9c('0x28')](function(_0x5dad59){if(_0x5dad59){_0x5474e5=_0x5dad59;_0x48f1b5[_0xba9c('0x30')]=_[_0xba9c('0x31')](db['Action'][_0xba9c('0x48')]);_0x48f1b5['query']=_['keys'](_0x672bc3[_0xba9c('0x36')]);_0x48f1b5[_0xba9c('0x32')]=_[_0xba9c('0x34')](_0x48f1b5['model'],_0x48f1b5[_0xba9c('0x36')]);_0x157396[_0xba9c('0x33')]=_[_0xba9c('0x34')](_0x48f1b5[_0xba9c('0x30')],qs[_0xba9c('0x35')](_0x672bc3[_0xba9c('0x36')][_0xba9c('0x35')]));_0x157396['attributes']=_0x157396[_0xba9c('0x33')][_0xba9c('0x37')]?_0x157396['attributes']:_0x48f1b5[_0xba9c('0x30')];_0x157396[_0xba9c('0x3a')]=qs[_0xba9c('0x3b')](_0x672bc3[_0xba9c('0x36')][_0xba9c('0x3b')]);_0x157396[_0xba9c('0x3e')]=qs[_0xba9c('0x32')](_['pick'](_0x672bc3[_0xba9c('0x36')],_0x48f1b5[_0xba9c('0x32')]));if(_0x672bc3['query'][_0xba9c('0x3d')]){_0x157396['where']=_[_0xba9c('0x3f')](_0x157396[_0xba9c('0x3e')],{'$or':_[_0xba9c('0x2d')](_0x157396[_0xba9c('0x33')],function(_0xdb922a){var _0x2d1d21={};_0x2d1d21[_0xdb922a]={'$like':'%'+_0x672bc3[_0xba9c('0x36')][_0xba9c('0x3d')]+'%'};return _0x2d1d21;})});}_0x157396=_[_0xba9c('0x3f')]({},_0x157396,_0x672bc3[_0xba9c('0x41')]);return _0x5474e5[_0xba9c('0x55')](_0x157396);}})[_0xba9c('0x28')](function(_0x20f1ad){if(_0x20f1ad){_0x5842b5=_0x20f1ad[_0xba9c('0x37')];if(!_0x672bc3[_0xba9c('0x36')][_0xba9c('0x38')]('nolimit')){_0x157396[_0xba9c('0x20')]=qs[_0xba9c('0x20')](_0x672bc3['query']['limit']);_0x157396[_0xba9c('0x21')]=qs[_0xba9c('0x21')](_0x672bc3[_0xba9c('0x36')][_0xba9c('0x21')]);}return _0x5474e5['getActions'](_0x157396);}})['then'](function(_0x6f57b5){if(_0x6f57b5){return _0x6f57b5?{'count':_0x5842b5,'rows':_0x6f57b5}:null;}})['then'](respondWithResult(_0x12cb5e,null))['catch'](handleError(_0x12cb5e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 10e4fc8..e70e0b4 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 _0xa1e9=['bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0xa1e9,0x122));var _0x9a1e=function(_0x1a3634,_0x3a5fe7){_0x1a3634=_0x1a3634-0x0;var _0x2338c7=_0xa1e9[_0x1a3634];return _0x2338c7;};'use strict';var _=require(_0x9a1e('0x0'));var util=require(_0x9a1e('0x1'));var logger=require(_0x9a1e('0x2'))(_0x9a1e('0x3'));var moment=require('moment');var BPromise=require(_0x9a1e('0x4'));var rp=require(_0x9a1e('0x5'));var fs=require('fs');var path=require(_0x9a1e('0x6'));var rimraf=require(_0x9a1e('0x7'));var config=require(_0x9a1e('0x8'));var attributes=require(_0x9a1e('0x9'));module[_0x9a1e('0xa')]=function(_0x228fb2,_0x5c5fcf){return _0x228fb2[_0x9a1e('0xb')](_0x9a1e('0xc'),attributes,{'tableName':_0x9a1e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46cd=['rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x32e4de,_0x7da1c5){var _0x51ba2a=function(_0x2a7322){while(--_0x2a7322){_0x32e4de['push'](_0x32e4de['shift']());}};_0x51ba2a(++_0x7da1c5);}(_0x46cd,0xd7));var _0xd46c=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x46cd[_0x616290];return _0x453879;};'use strict';var _=require(_0xd46c('0x0'));var util=require(_0xd46c('0x1'));var logger=require(_0xd46c('0x2'))('api');var moment=require(_0xd46c('0x3'));var BPromise=require('bluebird');var rp=require(_0xd46c('0x4'));var fs=require('fs');var path=require(_0xd46c('0x5'));var rimraf=require(_0xd46c('0x6'));var config=require(_0xd46c('0x7'));var attributes=require(_0xd46c('0x8'));module[_0xd46c('0x9')]=function(_0xdb3d5a,_0x576568){return _0xdb3d5a[_0xd46c('0xa')](_0xd46c('0xb'),attributes,{'tableName':_0xd46c('0xc'),'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 cb40126..ad0a486 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 _0x06ef=['then','info','request\x20sent','debug','stringify','error','code','message','result','catch','Automation,\x20%s,\x20%s','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x5bda3b,_0x41160f){var _0x431bb9=function(_0x160122){while(--_0x160122){_0x5bda3b['push'](_0x5bda3b['shift']());}};_0x431bb9(++_0x41160f);}(_0x06ef,0x185));var _0xf06e=function(_0x259c88,_0x40d6eb){_0x259c88=_0x259c88-0x0;var _0x1d4d25=_0x06ef[_0x259c88];return _0x1d4d25;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf06e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf06e('0x1'));var logger=require(_0xf06e('0x2'))(_0xf06e('0x3'));var config=require('../../config/environment');var jayson=require(_0xf06e('0x4'));var client=jayson[_0xf06e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b74b,_0x4e05dc,_0x5cddf1){return new BPromise(function(_0x4ccbee,_0x25b56e){return client[_0xf06e('0x6')](_0x59b74b,_0x5cddf1)[_0xf06e('0x7')](function(_0x2bb08c){logger[_0xf06e('0x8')]('Automation,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));logger[_0xf06e('0xa')]('Automation,\x20%s,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'),JSON[_0xf06e('0xb')](_0x2bb08c));if(_0x2bb08c[_0xf06e('0xc')]){if(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xd')]===0x1f4){logger[_0xf06e('0xc')]('Automation,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);return _0x25b56e(_0x2bb08c['error'][_0xf06e('0xe')]);}logger[_0xf06e('0xc')]('Automation,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c['error']['message']);return _0x4ccbee(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);}else{logger[_0xf06e('0x8')]('Automation,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));_0x4ccbee(_0x2bb08c[_0xf06e('0xf')][_0xf06e('0xe')]);}})[_0xf06e('0x10')](function(_0x44157a){logger[_0xf06e('0xc')](_0xf06e('0x11'),_0x4e05dc,_0x44157a);_0x25b56e(_0x44157a);});});} \ No newline at end of file +var _0x86c0=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x86c0,0x133));var _0x086c=function(_0x5d4205,_0x135eaa){_0x5d4205=_0x5d4205-0x0;var _0x3ff943=_0x86c0[_0x5d4205];return _0x3ff943;};'use strict';var _=require(_0x086c('0x0'));var util=require('util');var moment=require(_0x086c('0x1'));var BPromise=require(_0x086c('0x2'));var rs=require(_0x086c('0x3'));var fs=require('fs');var Redis=require(_0x086c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x086c('0x5'));var logger=require(_0x086c('0x6'))(_0x086c('0x7'));var config=require(_0x086c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x086c('0x9')][_0x086c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e27a8,_0x387428,_0x117df9){return new BPromise(function(_0x25e437,_0x52b942){return client[_0x086c('0xb')](_0x2e27a8,_0x117df9)[_0x086c('0xc')](function(_0xa1b79a){logger['info']('Automation,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));logger[_0x086c('0xe')](_0x086c('0xf'),_0x387428,_0x086c('0xd'),JSON[_0x086c('0x10')](_0xa1b79a));if(_0xa1b79a['error']){if(_0xa1b79a[_0x086c('0x11')][_0x086c('0x12')]===0x1f4){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error']['message']);return _0x52b942(_0xa1b79a[_0x086c('0x11')]['message']);}logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error'][_0x086c('0x14')]);return _0x25e437(_0xa1b79a[_0x086c('0x11')][_0x086c('0x14')]);}else{logger[_0x086c('0x15')]('Automation,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));_0x25e437(_0xa1b79a[_0x086c('0x16')][_0x086c('0x14')]);}})['catch'](function(_0x34e74f){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0x34e74f);_0x52b942(_0x34e74f);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5f630ee..a8b7a98 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 _0x4be6=['index','get','show','/:id/conditions','getConditions','getActions','post','addConditions','/:id/actions','put','update','delete','/:id','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x4be6,0xb5));var _0x64be=function(_0x46e94c,_0x461216){_0x46e94c=_0x46e94c-0x0;var _0x597221=_0x4be6[_0x46e94c];return _0x597221;};'use strict';var multer=require('multer');var util=require(_0x64be('0x0'));var path=require(_0x64be('0x1'));var timeout=require(_0x64be('0x2'));var express=require(_0x64be('0x3'));var router=express[_0x64be('0x4')]();var fs_extra=require(_0x64be('0x5'));var auth=require(_0x64be('0x6'));var interaction=require(_0x64be('0x7'));var config=require(_0x64be('0x8'));var controller=require(_0x64be('0x9'));router['get']('/',auth[_0x64be('0xa')](),controller[_0x64be('0xb')]);router[_0x64be('0xc')]('/:id',auth[_0x64be('0xa')](),controller[_0x64be('0xd')]);router['get'](_0x64be('0xe'),auth['isAuthenticated'](),controller[_0x64be('0xf')]);router[_0x64be('0xc')]('/:id/actions',auth[_0x64be('0xa')](),controller[_0x64be('0x10')]);router[_0x64be('0x11')]('/',auth[_0x64be('0xa')](),controller['create']);router[_0x64be('0x11')]('/:id/conditions',auth[_0x64be('0xa')](),controller[_0x64be('0x12')]);router[_0x64be('0x11')](_0x64be('0x13'),auth[_0x64be('0xa')](),controller['addActions']);router[_0x64be('0x14')]('/:id',auth[_0x64be('0xa')](),controller[_0x64be('0x15')]);router[_0x64be('0x16')](_0x64be('0x17'),auth[_0x64be('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x207d=['./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','create','post','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x14e67a,_0x2f62a3){var _0x2e53be=function(_0x5d27ea){while(--_0x5d27ea){_0x14e67a['push'](_0x14e67a['shift']());}};_0x2e53be(++_0x2f62a3);}(_0x207d,0x10d));var _0xd207=function(_0x2a29de,_0x1acca3){_0x2a29de=_0x2a29de-0x0;var _0x1e31f3=_0x207d[_0x2a29de];return _0x1e31f3;};'use strict';var multer=require(_0xd207('0x0'));var util=require(_0xd207('0x1'));var path=require(_0xd207('0x2'));var timeout=require(_0xd207('0x3'));var express=require('express');var router=express[_0xd207('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd207('0x5'));var interaction=require(_0xd207('0x6'));var config=require('../../config/environment');var controller=require(_0xd207('0x7'));router[_0xd207('0x8')]('/',auth[_0xd207('0x9')](),controller[_0xd207('0xa')]);router[_0xd207('0x8')](_0xd207('0xb'),auth[_0xd207('0x9')](),controller[_0xd207('0xc')]);router[_0xd207('0x8')](_0xd207('0xd'),auth[_0xd207('0x9')](),controller['getConditions']);router[_0xd207('0x8')](_0xd207('0xe'),auth[_0xd207('0x9')](),controller['getActions']);router['post']('/',auth[_0xd207('0x9')](),controller[_0xd207('0xf')]);router[_0xd207('0x10')]('/:id/conditions',auth[_0xd207('0x9')](),controller['addConditions']);router['post']('/:id/actions',auth[_0xd207('0x9')](),controller[_0xd207('0x11')]);router[_0xd207('0x12')](_0xd207('0xb'),auth[_0xd207('0x9')](),controller[_0xd207('0x13')]);router[_0xd207('0x14')](_0xd207('0xb'),auth[_0xd207('0x9')](),controller[_0xd207('0x15')]);module[_0xd207('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index ffeb5a7..08215f1 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 _0xf19d=['ivr','STRING','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','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\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','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\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name'];(function(_0x2779a0,_0x5472fe){var _0x36240f=function(_0x32ef48){while(--_0x32ef48){_0x2779a0['push'](_0x2779a0['shift']());}};_0x36240f(++_0x5472fe);}(_0xf19d,0xc0));var _0xdf19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf19d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdf19('0x0'));module[_0xdf19('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdf19('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdf19('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xdf19('0x4')]},'active':{'type':Sequelize[_0xdf19('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xdf19('0x6')](0x4)[_0xdf19('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdf19('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdf19('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdf19('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xdf19('0x6')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdf19('0x6')](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xdf19('0x6')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdf19('0x6')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdf19('0x6')](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdf19('0xd')},'dialTimezone':{'type':Sequelize[_0xdf19('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdf19('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xdf19('0xe'),_0xdf19('0xf')),'defaultValue':_0xdf19('0x10')},'dialAMDActive':{'type':Sequelize[_0xdf19('0x5')],'defaultValue':0x0,'comment':_0xdf19('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdf19('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdf19('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xdf19('0x6')](0x9)[_0xdf19('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdf19('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdf19('0x6')](0x9)[_0xdf19('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdf19('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdf19('0x6')](0x9)[_0xdf19('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdf19('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xdf19('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdf19('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdf19('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdf19('0x6')](0x9)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdf19('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdf19('0x6')](0x5)[_0xdf19('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xdf19('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdf19('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdf19('0x1a')](_0xdf19('0x1b'),_0xdf19('0x1c')),'defaultValue':_0xdf19('0x1b')},'dialPrefix':{'type':Sequelize[_0xdf19('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdf19('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdf19('0x1d')},'dialCutDigit':{'type':Sequelize[_0xdf19('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdf19('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdf19('0x6')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdf19('0x6')](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xdf19('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdf19('0x6')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdf19('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0xdf19('0x6')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xdf19('0x6')](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdf19('0x6')](0x3)[_0xdf19('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdf19('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdf19('0x6')](0x5)[_0xdf19('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdf19('0x26')}}; \ No newline at end of file +var _0x2838=['07:00-22:00,*,*,*','always','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\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','INTEGER','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0x2838,0x146));var _0x8283=function(_0x1aa0e7,_0x498fbd){_0x1aa0e7=_0x1aa0e7-0x0;var _0x55f771=_0x2838[_0x1aa0e7];return _0x55f771;};'use strict';var Sequelize=require(_0x8283('0x0'));module[_0x8283('0x1')]={'name':{'type':Sequelize[_0x8283('0x2')],'unique':_0x8283('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x8283('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x8283('0x2')]},'active':{'type':Sequelize[_0x8283('0x5')],'defaultValue':0x0,'comment':_0x8283('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x8283('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8283('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8283('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x8283('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8283('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8283('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8283('0xa')](0x5)[_0x8283('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8283('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x8283('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8283('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8283('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8283('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x8283('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8283('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8283('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8283('0xa')](0x3)[_0x8283('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8283('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x8283('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8283('0x11'),_0x8283('0x12'),_0x8283('0x13')),'defaultValue':_0x8283('0x11')},'dialAMDActive':{'type':Sequelize[_0x8283('0x5')],'defaultValue':0x0,'comment':_0x8283('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x8283('0xa')](0x9)[_0x8283('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8283('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x8283('0xa')](0x9)[_0x8283('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8283('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8283('0xa')](0x9)[_0x8283('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8283('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8283('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8283('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x8283('0xa')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8283('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8283('0xa')](0x9)[_0x8283('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8283('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8283('0xa')](0x9)[_0x8283('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8283('0xa')](0x5)[_0x8283('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8283('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8283('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x8283('0x1c'),_0x8283('0x1d')),'defaultValue':_0x8283('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8283('0xa')](0x3)[_0x8283('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x8283('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8283('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8283('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8283('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8283('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x8283('0xa')](0x3)[_0x8283('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8283('0xa')](0x5)[_0x8283('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8283('0xa')](0x3)[_0x8283('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8283('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8283('0xa')](0x5)[_0x8283('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8283('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x8283('0xa')](0x3)[_0x8283('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8283('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8283('0xa')](0x5)[_0x8283('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8283('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8283('0xa')](0x3)[_0x8283('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8283('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8283('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index d4b8411..7d6fcb6 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 _0xd86f=['type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','options','rows','show','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','include','omit','createdAt','updatedAt','body','getHoppers','findOne','CmHopper','nolimit','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','ContactId','ListId','select','phone','field','NOW()','scheduledAt','CmListId','toString','from','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','name','index','Campaign','rawAttributes','fieldName'];(function(_0x3e838f,_0x58469c){var _0x1e10cf=function(_0x4e9b18){while(--_0x4e9b18){_0x3e838f['push'](_0x3e838f['shift']());}};_0x1e10cf(++_0x58469c);}(_0xd86f,0xf6));var _0xfd86=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd86f[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xfd86('0x0'));var rimraf=require(_0xfd86('0x1'));var zipdir=require(_0xfd86('0x2'));var jsonpatch=require(_0xfd86('0x3'));var rp=require(_0xfd86('0x4'));var moment=require(_0xfd86('0x5'));var BPromise=require(_0xfd86('0x6'));var Mustache=require(_0xfd86('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfd86('0x8'));var ejs=require(_0xfd86('0x9'));var fs=require('fs');var fs_extra=require(_0xfd86('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfd86('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfd86('0x8'));var querystring=require(_0xfd86('0xc'));var Papa=require(_0xfd86('0xd'));var Redis=require(_0xfd86('0xe'));var authService=require(_0xfd86('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfd86('0x10'));var hardwareService=require(_0xfd86('0x11'));var logger=require('../../config/logger')(_0xfd86('0x12'));var utils=require(_0xfd86('0x13'));var config=require(_0xfd86('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd86('0x15'))['db'];function respondWithStatusCode(_0x4ba8ab,_0x5f1f3e){_0x5f1f3e=_0x5f1f3e||0xcc;return function(_0x18fad9){if(_0x18fad9){return _0x4ba8ab[_0xfd86('0x16')](_0x5f1f3e);}return _0x4ba8ab['status'](_0x5f1f3e)[_0xfd86('0x17')]();};}function respondWithResult(_0x5dfa0e,_0x178ed3){_0x178ed3=_0x178ed3||0xc8;return function(_0x23b8fc){if(_0x23b8fc){return _0x5dfa0e[_0xfd86('0x18')](_0x178ed3)[_0xfd86('0x19')](_0x23b8fc);}};}function respondWithFilteredResult(_0xa98827,_0x39a5b9){return function(_0xd5f5e0){if(_0xd5f5e0){var _0x470c22=typeof _0x39a5b9['offset']===_0xfd86('0x1a')&&typeof _0x39a5b9[_0xfd86('0x1b')]==='undefined';var _0x1e857f=_0xd5f5e0[_0xfd86('0x1c')];var _0x5c9ad5=_0x470c22?0x0:_0x39a5b9[_0xfd86('0x1d')];var _0x3086a3=_0x470c22?_0xd5f5e0['count']:_0x39a5b9[_0xfd86('0x1d')]+_0x39a5b9[_0xfd86('0x1b')];var _0x58f33e;if(_0x3086a3>=_0x1e857f){_0x3086a3=_0x1e857f;_0x58f33e=0xc8;}else{_0x58f33e=0xce;}_0xa98827[_0xfd86('0x18')](_0x58f33e);return _0xa98827[_0xfd86('0x1e')](_0xfd86('0x1f'),_0x5c9ad5+'-'+_0x3086a3+'/'+_0x1e857f)[_0xfd86('0x19')](_0xd5f5e0);}return null;};}function patchUpdates(_0x20666f){return function(_0x2bd11b){try{jsonpatch[_0xfd86('0x20')](_0x2bd11b,_0x20666f,!![]);}catch(_0x488d3f){return BPromise['reject'](_0x488d3f);}return _0x2bd11b[_0xfd86('0x21')]();};}function saveUpdates(_0x4562fe,_0xc16cc5){return function(_0x48e4b1){if(_0x48e4b1){return _0x48e4b1[_0xfd86('0x22')](_0x4562fe)[_0xfd86('0x23')](function(_0x4ad150){return _0x4ad150;});}return null;};}function removeEntity(_0x157fe7,_0x3f2e70){return function(_0x1c9150){if(_0x1c9150){return _0x1c9150['destroy']()[_0xfd86('0x23')](function(){var _0x34ea66=_0x1c9150[_0xfd86('0x24')]({'plain':!![]});var _0x1639a1=_0xfd86('0x25');return db[_0xfd86('0x26')][_0xfd86('0x27')]({'where':{'type':_0x1639a1,'resourceId':_0x34ea66['id']}})[_0xfd86('0x23')](function(){return _0x1c9150;});})['then'](function(){_0x157fe7[_0xfd86('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113aea,_0x2a4382){return function(_0x18389a){if(!_0x18389a){_0x113aea[_0xfd86('0x16')](0x194);}return _0x18389a;};}function handleError(_0x2a6082,_0xdcf6cf){_0xdcf6cf=_0xdcf6cf||0x1f4;return function(_0x253cec){logger[_0xfd86('0x28')](_0x253cec['stack']);if(_0x253cec[_0xfd86('0x29')]){delete _0x253cec[_0xfd86('0x29')];}_0x2a6082['status'](_0xdcf6cf)['send'](_0x253cec);};}exports[_0xfd86('0x2a')]=function(_0x4d020a,_0x42bd91){var _0x1b9001={},_0x32d233={},_0x5a9b1e={'count':0x0,'rows':[]};var _0x4a7aee=_['map'](db[_0xfd86('0x2b')][_0xfd86('0x2c')],function(_0x5eef22){return{'name':_0x5eef22[_0xfd86('0x2d')],'type':_0x5eef22[_0xfd86('0x2e')][_0xfd86('0x2f')]};});_0x32d233['model']=_['map'](_0x4a7aee,_0xfd86('0x29'));_0x32d233[_0xfd86('0x30')]=_[_0xfd86('0x31')](_0x4d020a['query']);_0x32d233[_0xfd86('0x32')]=_[_0xfd86('0x33')](_0x32d233['model'],_0x32d233[_0xfd86('0x30')]);_0x1b9001[_0xfd86('0x34')]=_[_0xfd86('0x33')](_0x32d233[_0xfd86('0x35')],qs['fields'](_0x4d020a[_0xfd86('0x30')][_0xfd86('0x36')]));_0x1b9001[_0xfd86('0x34')]=_0x1b9001['attributes'][_0xfd86('0x37')]?_0x1b9001[_0xfd86('0x34')]:_0x32d233['model'];if(!_0x4d020a[_0xfd86('0x30')][_0xfd86('0x38')]('nolimit')){_0x1b9001[_0xfd86('0x1b')]=qs[_0xfd86('0x1b')](_0x4d020a['query']['limit']);_0x1b9001[_0xfd86('0x1d')]=qs[_0xfd86('0x1d')](_0x4d020a[_0xfd86('0x30')][_0xfd86('0x1d')]);}_0x1b9001[_0xfd86('0x39')]=qs[_0xfd86('0x3a')](_0x4d020a[_0xfd86('0x30')][_0xfd86('0x3a')]);_0x1b9001['where']=qs[_0xfd86('0x32')](_[_0xfd86('0x3b')](_0x4d020a[_0xfd86('0x30')],_0x32d233[_0xfd86('0x32')]),_0x4a7aee);if(_0x4d020a[_0xfd86('0x30')][_0xfd86('0x3c')]){_0x1b9001[_0xfd86('0x3d')]=_[_0xfd86('0x3e')](_0x1b9001['where'],{'$or':_[_0xfd86('0x3f')](_0x4a7aee,function(_0x58c844){if(_0x58c844['type']!=='VIRTUAL'){var _0x27dbf1={};_0x27dbf1[_0x58c844[_0xfd86('0x29')]]={'$like':'%'+_0x4d020a[_0xfd86('0x30')][_0xfd86('0x3c')]+'%'};return _0x27dbf1;}})});}_0x1b9001=_[_0xfd86('0x3e')]({},_0x1b9001,_0x4d020a[_0xfd86('0x40')]);var _0x2f342d={'where':_0x1b9001['where']};return db[_0xfd86('0x2b')][_0xfd86('0x1c')](_0x2f342d)[_0xfd86('0x23')](function(_0x22c7a6){_0x5a9b1e['count']=_0x22c7a6;if(_0x4d020a['query']['includeAll']){_0x1b9001['include']=[{'all':!![]}];}return db[_0xfd86('0x2b')]['findAll'](_0x1b9001);})['then'](function(_0x616ef2){_0x5a9b1e[_0xfd86('0x41')]=_0x616ef2;return _0x5a9b1e;})['then'](respondWithFilteredResult(_0x42bd91,_0x1b9001))['catch'](handleError(_0x42bd91,null));};exports[_0xfd86('0x42')]=function(_0xeb66b9,_0x5efffe){var _0x2cade2={'raw':![],'where':{'id':_0xeb66b9['params']['id']}},_0x5a0a0d={};_0x5a0a0d[_0xfd86('0x35')]=_[_0xfd86('0x31')](db[_0xfd86('0x2b')]['rawAttributes']);_0x5a0a0d['query']=_[_0xfd86('0x31')](_0xeb66b9[_0xfd86('0x30')]);_0x5a0a0d[_0xfd86('0x32')]=_[_0xfd86('0x33')](_0x5a0a0d[_0xfd86('0x35')],_0x5a0a0d[_0xfd86('0x30')]);_0x2cade2[_0xfd86('0x34')]=_['intersection'](_0x5a0a0d[_0xfd86('0x35')],qs[_0xfd86('0x36')](_0xeb66b9['query'][_0xfd86('0x36')]));_0x2cade2[_0xfd86('0x34')]=_0x2cade2[_0xfd86('0x34')]['length']?_0x2cade2[_0xfd86('0x34')]:_0x5a0a0d['model'];if(_0xeb66b9[_0xfd86('0x30')][_0xfd86('0x43')]){_0x2cade2['include']=[{'all':!![]}];}_0x2cade2=_['merge']({},_0x2cade2,_0xeb66b9[_0xfd86('0x40')]);return db[_0xfd86('0x2b')][_0xfd86('0x44')](_0x2cade2)[_0xfd86('0x23')](handleEntityNotFound(_0x5efffe,null))[_0xfd86('0x23')](respondWithResult(_0x5efffe,null))[_0xfd86('0x45')](handleError(_0x5efffe,null));};exports[_0xfd86('0x46')]=function(_0xd25228,_0x205c7c){return db[_0xfd86('0x2b')][_0xfd86('0x46')](_0xd25228['body'],{})[_0xfd86('0x23')](function(_0x785a6f){var _0x10ba55=_0xd25228['user']['get']({'plain':!![]});if(!_0x10ba55)throw new Error(_0xfd86('0x47'));if(_0x10ba55[_0xfd86('0x48')]===_0xfd86('0x49')){var _0x1cd07a=_0x785a6f[_0xfd86('0x24')]({'plain':!![]});var _0x5bb3a8='IvrCampaigns';return db[_0xfd86('0x4a')][_0xfd86('0x44')]({'where':{'name':_0x5bb3a8,'userProfileId':_0x10ba55[_0xfd86('0x4b')]},'raw':!![]})[_0xfd86('0x23')](function(_0x302c41){if(_0x302c41&&_0x302c41[_0xfd86('0x4c')]===0x0){return db['UserProfileResource'][_0xfd86('0x46')]({'name':_0x1cd07a[_0xfd86('0x29')],'resourceId':_0x1cd07a['id'],'type':_0x302c41['name'],'sectionId':_0x302c41['id']},{})[_0xfd86('0x23')](function(){return _0x785a6f;});}else{return _0x785a6f;}})[_0xfd86('0x45')](function(_0x586758){logger[_0xfd86('0x28')](_0xfd86('0x4d'),_0x586758);throw _0x586758;});}return _0x785a6f;})[_0xfd86('0x23')](respondWithResult(_0x205c7c,0xc9))[_0xfd86('0x45')](handleError(_0x205c7c,null));};exports[_0xfd86('0x4e')]=function(_0x32a3ce,_0x12acf8){var _0xe97854={'where':{'id':_0x32a3ce[_0xfd86('0x4f')]['id']}},_0x1ef105={};_0x1ef105['model']=_[_0xfd86('0x31')](db[_0xfd86('0x2b')][_0xfd86('0x2c')]);_0xe97854[_0xfd86('0x34')]=_[_0xfd86('0x33')](_0x1ef105['model'],qs['fields'](_0x32a3ce[_0xfd86('0x30')][_0xfd86('0x36')]));_0xe97854[_0xfd86('0x34')]=_0xe97854['attributes'][_0xfd86('0x37')]?_0xe97854[_0xfd86('0x34')]:_0x1ef105[_0xfd86('0x35')];if(_0x32a3ce['query'][_0xfd86('0x43')]){_0xe97854[_0xfd86('0x50')]=[{'all':!![]}];}_0xe97854=_[_0xfd86('0x3e')]({},_0xe97854,_0x32a3ce['options']);return db[_0xfd86('0x2b')][_0xfd86('0x44')](_0xe97854)['then'](handleEntityNotFound(_0x12acf8,null))[_0xfd86('0x23')](function(_0x19e386){if(_0x19e386){var _0x50fd01=_0x19e386[_0xfd86('0x24')]({'plain':!![]});_0x50fd01=qs[_0xfd86('0x51')](_0x50fd01,['id',_0xfd86('0x52'),_0xfd86('0x53')]);_0x32a3ce['body']=_[_0xfd86('0x51')](_0x32a3ce[_0xfd86('0x54')],['id',_0xfd86('0x52'),_0xfd86('0x53')]);return db[_0xfd86('0x2b')][_0xfd86('0x46')](_['merge'](_0x50fd01,_0x32a3ce[_0xfd86('0x54')]),{'include':_0x32a3ce[_0xfd86('0x30')][_0xfd86('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x24c1c8){var _0x48e8bb=_0x32a3ce['user'][_0xfd86('0x24')]({'plain':!![]});if(!_0x48e8bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48e8bb[_0xfd86('0x48')]===_0xfd86('0x49')){var _0x3c8900=_0x24c1c8[_0xfd86('0x24')]({'plain':!![]});var _0x3883c6=_0xfd86('0x25');return db[_0xfd86('0x4a')][_0xfd86('0x44')]({'where':{'name':_0x3883c6,'userProfileId':_0x48e8bb[_0xfd86('0x4b')]},'raw':!![]})['then'](function(_0x2085a5){if(_0x2085a5&&_0x2085a5['autoAssociation']===0x0){return db['UserProfileResource'][_0xfd86('0x46')]({'name':_0x3c8900[_0xfd86('0x29')],'resourceId':_0x3c8900['id'],'type':_0x2085a5['name'],'sectionId':_0x2085a5['id']},{})[_0xfd86('0x23')](function(){return _0x24c1c8;});}else{return _0x24c1c8;}})[_0xfd86('0x45')](function(_0x232171){logger[_0xfd86('0x28')](_0xfd86('0x4d'),_0x232171);throw _0x232171;});}return _0x24c1c8;});}})[_0xfd86('0x23')](respondWithResult(_0x12acf8,0xc9))[_0xfd86('0x45')](handleError(_0x12acf8,null));};exports[_0xfd86('0x22')]=function(_0x3126f6,_0x276cad){if(_0x3126f6[_0xfd86('0x54')]['id']){delete _0x3126f6['body']['id'];}return db[_0xfd86('0x2b')][_0xfd86('0x44')]({'where':{'id':_0x3126f6[_0xfd86('0x4f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x276cad,null))['then'](saveUpdates(_0x3126f6[_0xfd86('0x54')],null))['then'](respondWithResult(_0x276cad,null))[_0xfd86('0x45')](handleError(_0x276cad,null));};exports[_0xfd86('0x27')]=function(_0x2b37c5,_0x1f3fa0){return db[_0xfd86('0x2b')][_0xfd86('0x44')]({'where':{'id':_0x2b37c5[_0xfd86('0x4f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x1f3fa0,null))[_0xfd86('0x23')](removeEntity(_0x1f3fa0,null))[_0xfd86('0x45')](handleError(_0x1f3fa0,null));};exports[_0xfd86('0x55')]=function(_0x1a8b7f,_0x131ec2,_0x24332f){var _0xca0225={'raw':!![],'where':{}};var _0x37d7ad={};var _0x567189={'count':0x0,'rows':[]};return db[_0xfd86('0x2b')][_0xfd86('0x56')]({'where':{'id':_0x1a8b7f[_0xfd86('0x4f')]['id']}})['then'](handleEntityNotFound(_0x131ec2,null))[_0xfd86('0x23')](function(_0x59404e){if(_0x59404e){_0x37d7ad['model']=_[_0xfd86('0x31')](db[_0xfd86('0x57')][_0xfd86('0x2c')]);_0x37d7ad[_0xfd86('0x30')]=_[_0xfd86('0x31')](_0x1a8b7f[_0xfd86('0x30')]);_0x37d7ad[_0xfd86('0x32')]=_[_0xfd86('0x33')](_0x37d7ad[_0xfd86('0x35')],_0x37d7ad[_0xfd86('0x30')]);_0xca0225[_0xfd86('0x34')]=_[_0xfd86('0x33')](_0x37d7ad[_0xfd86('0x35')],qs['fields'](_0x1a8b7f['query'][_0xfd86('0x36')]));_0xca0225[_0xfd86('0x34')]=_0xca0225[_0xfd86('0x34')][_0xfd86('0x37')]?_0xca0225[_0xfd86('0x34')]:_0x37d7ad[_0xfd86('0x35')];if(!_0x1a8b7f[_0xfd86('0x30')][_0xfd86('0x38')](_0xfd86('0x58'))){_0xca0225[_0xfd86('0x1b')]=qs[_0xfd86('0x1b')](_0x1a8b7f[_0xfd86('0x30')]['limit']);_0xca0225[_0xfd86('0x1d')]=qs[_0xfd86('0x1d')](_0x1a8b7f['query'][_0xfd86('0x1d')]);}_0xca0225[_0xfd86('0x39')]=qs[_0xfd86('0x3a')](_0x1a8b7f[_0xfd86('0x30')]['sort']);_0xca0225[_0xfd86('0x3d')]=qs[_0xfd86('0x32')](_[_0xfd86('0x3b')](_0x1a8b7f[_0xfd86('0x30')],_0x37d7ad[_0xfd86('0x32')]));_0xca0225[_0xfd86('0x3d')][_0xfd86('0x59')]=_0x59404e['id'];if(_0x1a8b7f[_0xfd86('0x30')]['filter']){_0xca0225['where']=_[_0xfd86('0x3e')](_0xca0225[_0xfd86('0x3d')],{'$or':_['map'](_0xca0225[_0xfd86('0x34')],function(_0x211c07){var _0x54b99b={};_0x54b99b[_0x211c07]={'$like':'%'+_0x1a8b7f[_0xfd86('0x30')][_0xfd86('0x3c')]+'%'};return _0x54b99b;})});}_0xca0225=_['merge']({},_0xca0225,_0x1a8b7f[_0xfd86('0x40')]);return db[_0xfd86('0x57')]['count']({'where':_0xca0225[_0xfd86('0x3d')]})['then'](function(_0x4e54b7){_0x567189[_0xfd86('0x1c')]=_0x4e54b7;if(_0x1a8b7f[_0xfd86('0x30')]['includeAll']){_0xca0225[_0xfd86('0x50')]=[{'all':!![]}];}return db[_0xfd86('0x57')][_0xfd86('0x5a')](_0xca0225);})['then'](function(_0x53d9fa){_0x567189['rows']=_0x53d9fa;return _0x567189;});}})[_0xfd86('0x23')](respondWithFilteredResult(_0x131ec2,_0xca0225))[_0xfd86('0x45')](handleError(_0x131ec2,null));};exports[_0xfd86('0x5b')]=function(_0x5aabaa,_0x360dea,_0x49e0c8){var _0x2c0ed5={'raw':!![],'where':{}};var _0xfd5933={};var _0x12ce5e={'count':0x0,'rows':[]};return db[_0xfd86('0x2b')]['findOne']({'where':{'id':_0x5aabaa['params']['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x360dea,null))[_0xfd86('0x23')](function(_0x209303){if(_0x209303){_0xfd5933[_0xfd86('0x35')]=_[_0xfd86('0x31')](db[_0xfd86('0x5c')][_0xfd86('0x2c')]);_0xfd5933[_0xfd86('0x30')]=_[_0xfd86('0x31')](_0x5aabaa['query']);_0xfd5933[_0xfd86('0x32')]=_['intersection'](_0xfd5933[_0xfd86('0x35')],_0xfd5933[_0xfd86('0x30')]);_0x2c0ed5[_0xfd86('0x34')]=_['intersection'](_0xfd5933['model'],qs[_0xfd86('0x36')](_0x5aabaa[_0xfd86('0x30')][_0xfd86('0x36')]));_0x2c0ed5[_0xfd86('0x34')]=_0x2c0ed5['attributes'][_0xfd86('0x37')]?_0x2c0ed5['attributes']:_0xfd5933[_0xfd86('0x35')];if(!_0x5aabaa['query'][_0xfd86('0x38')](_0xfd86('0x58'))){_0x2c0ed5[_0xfd86('0x1b')]=qs[_0xfd86('0x1b')](_0x5aabaa[_0xfd86('0x30')]['limit']);_0x2c0ed5[_0xfd86('0x1d')]=qs['offset'](_0x5aabaa[_0xfd86('0x30')][_0xfd86('0x1d')]);}_0x2c0ed5['order']=qs[_0xfd86('0x3a')](_0x5aabaa[_0xfd86('0x30')]['sort']);_0x2c0ed5[_0xfd86('0x3d')]=qs[_0xfd86('0x32')](_['pick'](_0x5aabaa[_0xfd86('0x30')],_0xfd5933['filters']));_0x2c0ed5[_0xfd86('0x3d')][_0xfd86('0x59')]=_0x209303['id'];if(_0x5aabaa['query'][_0xfd86('0x3c')]){_0x2c0ed5[_0xfd86('0x3d')]=_[_0xfd86('0x3e')](_0x2c0ed5[_0xfd86('0x3d')],{'$or':_['map'](_0x2c0ed5[_0xfd86('0x34')],function(_0x47fc9d){var _0xe1d6fd={};_0xe1d6fd[_0x47fc9d]={'$like':'%'+_0x5aabaa[_0xfd86('0x30')][_0xfd86('0x3c')]+'%'};return _0xe1d6fd;})});}_0x2c0ed5=_[_0xfd86('0x3e')]({},_0x2c0ed5,_0x5aabaa[_0xfd86('0x40')]);return db['CmHopperHistory'][_0xfd86('0x1c')]({'where':_0x2c0ed5[_0xfd86('0x3d')]})['then'](function(_0x40ac13){_0x12ce5e[_0xfd86('0x1c')]=_0x40ac13;if(_0x5aabaa[_0xfd86('0x30')][_0xfd86('0x43')]){_0x2c0ed5[_0xfd86('0x50')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x2c0ed5);})['then'](function(_0x532890){_0x12ce5e[_0xfd86('0x41')]=_0x532890;return _0x12ce5e;});}})[_0xfd86('0x23')](respondWithFilteredResult(_0x360dea,_0x2c0ed5))[_0xfd86('0x45')](handleError(_0x360dea,null));};exports[_0xfd86('0x5d')]=function(_0x20baaa,_0x4c3cdd,_0x44d921){var _0xb60bd7={'raw':!![],'where':{}};var _0x539fa3={};var _0x2b5473={'count':0x0,'rows':[]};return db[_0xfd86('0x2b')]['findOne']({'where':{'id':_0x20baaa[_0xfd86('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4c3cdd,null))[_0xfd86('0x23')](function(_0xd8b219){if(_0xd8b219){_0x539fa3[_0xfd86('0x35')]=_[_0xfd86('0x31')](db[_0xfd86('0x5e')][_0xfd86('0x2c')]);_0x539fa3[_0xfd86('0x30')]=_[_0xfd86('0x31')](_0x20baaa[_0xfd86('0x30')]);_0x539fa3[_0xfd86('0x32')]=_[_0xfd86('0x33')](_0x539fa3['model'],_0x539fa3[_0xfd86('0x30')]);_0xb60bd7[_0xfd86('0x34')]=_[_0xfd86('0x33')](_0x539fa3[_0xfd86('0x35')],qs[_0xfd86('0x36')](_0x20baaa[_0xfd86('0x30')][_0xfd86('0x36')]));_0xb60bd7[_0xfd86('0x34')]=_0xb60bd7[_0xfd86('0x34')][_0xfd86('0x37')]?_0xb60bd7[_0xfd86('0x34')]:_0x539fa3[_0xfd86('0x35')];if(!_0x20baaa[_0xfd86('0x30')][_0xfd86('0x38')](_0xfd86('0x58'))){_0xb60bd7[_0xfd86('0x1b')]=qs[_0xfd86('0x1b')](_0x20baaa[_0xfd86('0x30')][_0xfd86('0x1b')]);_0xb60bd7['offset']=qs[_0xfd86('0x1d')](_0x20baaa[_0xfd86('0x30')][_0xfd86('0x1d')]);}_0xb60bd7[_0xfd86('0x39')]=qs[_0xfd86('0x3a')](_0x20baaa[_0xfd86('0x30')]['sort']);_0xb60bd7[_0xfd86('0x3d')]=qs[_0xfd86('0x32')](_[_0xfd86('0x3b')](_0x20baaa[_0xfd86('0x30')],_0x539fa3[_0xfd86('0x32')]));_0xb60bd7[_0xfd86('0x3d')]['CampaignId']=_0xd8b219['id'];if(_0x20baaa[_0xfd86('0x30')]['filter']){_0xb60bd7[_0xfd86('0x3d')]=_[_0xfd86('0x3e')](_0xb60bd7['where'],{'$or':_[_0xfd86('0x3f')](_0xb60bd7[_0xfd86('0x34')],function(_0x51e974){var _0x268dbc={};_0x268dbc[_0x51e974]={'$like':'%'+_0x20baaa[_0xfd86('0x30')][_0xfd86('0x3c')]+'%'};return _0x268dbc;})});}_0xb60bd7=_[_0xfd86('0x3e')]({},_0xb60bd7,_0x20baaa[_0xfd86('0x40')]);return db[_0xfd86('0x5e')][_0xfd86('0x1c')]({'where':_0xb60bd7['where']})[_0xfd86('0x23')](function(_0x574b3b){_0x2b5473[_0xfd86('0x1c')]=_0x574b3b;if(_0x20baaa['query']['includeAll']){_0xb60bd7[_0xfd86('0x50')]=[{'all':!![]}];}return db[_0xfd86('0x5e')][_0xfd86('0x5a')](_0xb60bd7);})['then'](function(_0x2c5b55){_0x2b5473[_0xfd86('0x41')]=_0x2c5b55;return _0x2b5473;});}})[_0xfd86('0x23')](respondWithFilteredResult(_0x4c3cdd,_0xb60bd7))[_0xfd86('0x45')](handleError(_0x4c3cdd,null));};exports[_0xfd86('0x5f')]=function(_0x2ba5d9,_0x41b0a8,_0x2bbb1b){var _0x442a4b={'raw':!![],'where':{}};var _0x2e43ab={};var _0x1522bc={'count':0x0,'rows':[]};return db['Campaign'][_0xfd86('0x56')]({'where':{'id':_0x2ba5d9[_0xfd86('0x4f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x41b0a8,null))['then'](function(_0x2151a5){if(_0x2151a5){_0x2e43ab[_0xfd86('0x35')]=_['keys'](db[_0xfd86('0x60')][_0xfd86('0x2c')]);_0x2e43ab[_0xfd86('0x30')]=_[_0xfd86('0x31')](_0x2ba5d9['query']);_0x2e43ab[_0xfd86('0x32')]=_[_0xfd86('0x33')](_0x2e43ab[_0xfd86('0x35')],_0x2e43ab[_0xfd86('0x30')]);_0x442a4b['attributes']=_[_0xfd86('0x33')](_0x2e43ab['model'],qs[_0xfd86('0x36')](_0x2ba5d9[_0xfd86('0x30')][_0xfd86('0x36')]));_0x442a4b['attributes']=_0x442a4b[_0xfd86('0x34')][_0xfd86('0x37')]?_0x442a4b[_0xfd86('0x34')]:_0x2e43ab['model'];if(!_0x2ba5d9[_0xfd86('0x30')][_0xfd86('0x38')](_0xfd86('0x58'))){_0x442a4b[_0xfd86('0x1b')]=qs[_0xfd86('0x1b')](_0x2ba5d9[_0xfd86('0x30')][_0xfd86('0x1b')]);_0x442a4b[_0xfd86('0x1d')]=qs[_0xfd86('0x1d')](_0x2ba5d9[_0xfd86('0x30')]['offset']);}_0x442a4b['order']=qs[_0xfd86('0x3a')](_0x2ba5d9[_0xfd86('0x30')][_0xfd86('0x3a')]);_0x442a4b[_0xfd86('0x3d')]=qs[_0xfd86('0x32')](_['pick'](_0x2ba5d9['query'],_0x2e43ab[_0xfd86('0x32')]));_0x442a4b['where'][_0xfd86('0x59')]=_0x2151a5['id'];if(_0x2ba5d9[_0xfd86('0x30')][_0xfd86('0x3c')]){_0x442a4b[_0xfd86('0x3d')]=_[_0xfd86('0x3e')](_0x442a4b['where'],{'$or':_['map'](_0x442a4b[_0xfd86('0x34')],function(_0x4565fb){var _0xb1a4db={};_0xb1a4db[_0x4565fb]={'$like':'%'+_0x2ba5d9[_0xfd86('0x30')][_0xfd86('0x3c')]+'%'};return _0xb1a4db;})});}_0x442a4b=_[_0xfd86('0x3e')]({},_0x442a4b,_0x2ba5d9[_0xfd86('0x40')]);return db[_0xfd86('0x60')][_0xfd86('0x1c')]({'where':_0x442a4b[_0xfd86('0x3d')]})[_0xfd86('0x23')](function(_0x12bb85){_0x1522bc[_0xfd86('0x1c')]=_0x12bb85;if(_0x2ba5d9[_0xfd86('0x30')][_0xfd86('0x43')]){_0x442a4b[_0xfd86('0x50')]=[{'all':!![]}];}return db[_0xfd86('0x60')][_0xfd86('0x5a')](_0x442a4b);})[_0xfd86('0x23')](function(_0x290975){_0x1522bc[_0xfd86('0x41')]=_0x290975;return _0x1522bc;});}})[_0xfd86('0x23')](respondWithFilteredResult(_0x41b0a8,_0x442a4b))['catch'](handleError(_0x41b0a8,null));};exports[_0xfd86('0x61')]=function(_0x5d1245,_0x2a56b1,_0x3d4604){var _0x1d8807={};var _0x3c72ba={};var _0x1f0f12;var _0x510ee9;return db['Campaign']['findOne']({'where':{'id':_0x5d1245[_0xfd86('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2a56b1,null))[_0xfd86('0x23')](function(_0x20974f){if(_0x20974f){_0x1f0f12=_0x20974f;_0x3c72ba[_0xfd86('0x35')]=_[_0xfd86('0x31')](db[_0xfd86('0x62')][_0xfd86('0x2c')]);_0x3c72ba[_0xfd86('0x30')]=_[_0xfd86('0x31')](_0x5d1245['query']);_0x3c72ba[_0xfd86('0x32')]=_['intersection'](_0x3c72ba[_0xfd86('0x35')],_0x3c72ba[_0xfd86('0x30')]);_0x1d8807[_0xfd86('0x34')]=_['intersection'](_0x3c72ba['model'],qs[_0xfd86('0x36')](_0x5d1245[_0xfd86('0x30')][_0xfd86('0x36')]));_0x1d8807[_0xfd86('0x34')]=_0x1d8807['attributes'][_0xfd86('0x37')]?_0x1d8807[_0xfd86('0x34')]:_0x3c72ba[_0xfd86('0x35')];_0x1d8807[_0xfd86('0x39')]=qs['sort'](_0x5d1245[_0xfd86('0x30')][_0xfd86('0x3a')]);_0x1d8807['where']=qs[_0xfd86('0x32')](_[_0xfd86('0x3b')](_0x5d1245[_0xfd86('0x30')],_0x3c72ba[_0xfd86('0x32')]));if(_0x5d1245[_0xfd86('0x30')]['filter']){_0x1d8807[_0xfd86('0x3d')]=_[_0xfd86('0x3e')](_0x1d8807[_0xfd86('0x3d')],{'$or':_[_0xfd86('0x3f')](_0x1d8807[_0xfd86('0x34')],function(_0x5705a3){var _0x17ca98={};_0x17ca98[_0x5705a3]={'$like':'%'+_0x5d1245[_0xfd86('0x30')][_0xfd86('0x3c')]+'%'};return _0x17ca98;})});}_0x1d8807=_[_0xfd86('0x3e')]({},_0x1d8807,_0x5d1245['options']);return _0x1f0f12[_0xfd86('0x61')](_0x1d8807);}})[_0xfd86('0x23')](function(_0x51ed5e){if(_0x51ed5e){_0x510ee9=_0x51ed5e[_0xfd86('0x37')];if(!_0x5d1245[_0xfd86('0x30')][_0xfd86('0x38')](_0xfd86('0x58'))){_0x1d8807['limit']=qs['limit'](_0x5d1245[_0xfd86('0x30')][_0xfd86('0x1b')]);_0x1d8807[_0xfd86('0x1d')]=qs[_0xfd86('0x1d')](_0x5d1245['query'][_0xfd86('0x1d')]);}return _0x1f0f12['getLists'](_0x1d8807);}})['then'](function(_0x4096d6){if(_0x4096d6){return _0x4096d6?{'count':_0x510ee9,'rows':_0x4096d6}:null;}})[_0xfd86('0x23')](respondWithResult(_0x2a56b1,null))[_0xfd86('0x45')](handleError(_0x2a56b1,null));};exports['addLists']=function(_0x261975,_0x23db56,_0x42359f){var _0x3f0bd6,_0x631fe7;var _0x40f12c=[];var _0x590353=moment()['format'](_0xfd86('0x63'));return db[_0xfd86('0x2b')]['find']({'where':{'id':_0x261975[_0xfd86('0x4f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x23db56,null))['then'](function(_0x5a80c5){if(_0x5a80c5){_0x631fe7=_0x5a80c5;return _0x5a80c5[_0xfd86('0x64')](_0x261975[_0xfd86('0x54')][_0xfd86('0x65')],_[_0xfd86('0x51')](_0x261975[_0xfd86('0x54')],[_0xfd86('0x65'),'id'])||{});}return null;})[_0xfd86('0x66')](function(_0x2bfcc9){var _0x2181cc;var _0x57d7aa;_0x3f0bd6=_0x2bfcc9||[];var _0x3e9191=[];if(_0x2bfcc9){for(var _0x27b7b1=0x0;_0x27b7b1<_0x2bfcc9[_0xfd86('0x37')];_0x27b7b1+=0x1){var _0x2d5cd8=_0x2bfcc9[_0x27b7b1][_0xfd86('0x24')]({'plain':!![]});_0x631fe7['dialCheckDuplicateType']=_0x261975['body'][_0xfd86('0x67')]?_0x261975[_0xfd86('0x54')][_0xfd86('0x67')]:_0x631fe7['dialCheckDuplicateType'];switch(_0x631fe7[_0xfd86('0x67')]){case _0xfd86('0x68'):_0x2181cc=squel[_0xfd86('0x69')]()['into'](_0xfd86('0x6a'))[_0xfd86('0x6b')](['phone','scheduledAt',_0xfd86('0x6c'),_0xfd86('0x6d'),_0xfd86('0x59'),'createdAt',_0xfd86('0x53')],squel[_0xfd86('0x6e')]()['field'](_0xfd86('0x6f'),_0xfd86('0x6f'))[_0xfd86('0x70')](_0xfd86('0x71'),_0xfd86('0x72'))[_0xfd86('0x70')]('id',_0xfd86('0x6c'))[_0xfd86('0x70')](_0x2d5cd8[_0xfd86('0x73')][_0xfd86('0x74')](),_0xfd86('0x6d'))[_0xfd86('0x70')](_0x261975[_0xfd86('0x4f')]['id'][_0xfd86('0x74')](),_0xfd86('0x59'))[_0xfd86('0x70')]('\x27'+_0x590353+'\x27',_0xfd86('0x52'))[_0xfd86('0x70')]('\x27'+_0x590353+'\x27','updatedAt')[_0xfd86('0x75')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xfd86('0x3d')](_0xfd86('0x76'),_0x2d5cd8[_0xfd86('0x73')]['toString']())[_0xfd86('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xfd86('0x3d')](_0xfd86('0x77'),squel[_0xfd86('0x6e')]()['field'](_0xfd86('0x78'))[_0xfd86('0x75')](_0xfd86('0x79'))[_0xfd86('0x3d')](_0xfd86('0x7a'),_0x261975[_0xfd86('0x4f')]['id'][_0xfd86('0x74')]()))[_0xfd86('0x3d')](_0xfd86('0x77'),squel['select']()[_0xfd86('0x70')](_0xfd86('0x7b'))[_0xfd86('0x75')](_0xfd86('0x6a'))[_0xfd86('0x3d')](_0xfd86('0x7a'),_0x261975[_0xfd86('0x4f')]['id'][_0xfd86('0x74')]())))[_0xfd86('0x74')]();break;case _0xfd86('0x7c'):_0x2181cc=squel['insert']()[_0xfd86('0x7d')](_0xfd86('0x6a'))[_0xfd86('0x6b')]([_0xfd86('0x6f'),_0xfd86('0x72'),_0xfd86('0x6c'),_0xfd86('0x6d'),_0xfd86('0x59'),_0xfd86('0x52'),_0xfd86('0x53')],squel[_0xfd86('0x6e')]()[_0xfd86('0x70')](_0xfd86('0x6f'),_0xfd86('0x6f'))[_0xfd86('0x70')](_0xfd86('0x71'),_0xfd86('0x72'))['field']('id',_0xfd86('0x6c'))['field'](_0x2d5cd8['CmListId'][_0xfd86('0x74')](),_0xfd86('0x6d'))['field'](_0x261975['params']['id']['toString'](),'CampaignId')[_0xfd86('0x70')]('\x27'+_0x590353+'\x27',_0xfd86('0x52'))[_0xfd86('0x70')]('\x27'+_0x590353+'\x27',_0xfd86('0x53'))['from'](_0xfd86('0x7e'))[_0xfd86('0x3d')](_0xfd86('0x7f'))[_0xfd86('0x3d')](_0xfd86('0x76'),_0x2d5cd8['CmListId'][_0xfd86('0x74')]())['where'](_0xfd86('0x80'))[_0xfd86('0x3d')](_0xfd86('0x77'),squel[_0xfd86('0x6e')]()[_0xfd86('0x70')](_0xfd86('0x7b'))[_0xfd86('0x75')](_0xfd86('0x6a'))[_0xfd86('0x3d')](_0xfd86('0x7a'),_0x261975[_0xfd86('0x4f')]['id'][_0xfd86('0x74')]())))[_0xfd86('0x74')]();break;default:_0x2181cc=squel[_0xfd86('0x69')]()[_0xfd86('0x7d')]('cm_hopper')['fromQuery']([_0xfd86('0x6f'),_0xfd86('0x72'),_0xfd86('0x6c'),_0xfd86('0x6d'),_0xfd86('0x59'),_0xfd86('0x52'),_0xfd86('0x53')],squel[_0xfd86('0x6e')]()[_0xfd86('0x70')](_0xfd86('0x6f'),'phone')['field'](_0xfd86('0x71'),_0xfd86('0x72'))['field']('id',_0xfd86('0x6c'))[_0xfd86('0x70')](_0x2d5cd8['CmListId'][_0xfd86('0x74')](),_0xfd86('0x6d'))['field'](_0x261975[_0xfd86('0x4f')]['id']['toString'](),_0xfd86('0x59'))[_0xfd86('0x70')]('\x27'+_0x590353+'\x27',_0xfd86('0x52'))['field']('\x27'+_0x590353+'\x27',_0xfd86('0x53'))[_0xfd86('0x75')]('cm_contacts')[_0xfd86('0x3d')]('deletedAt\x20IS\x20NULL')[_0xfd86('0x3d')](_0xfd86('0x76'),_0x2d5cd8[_0xfd86('0x73')][_0xfd86('0x74')]())[_0xfd86('0x3d')](_0xfd86('0x80')))[_0xfd86('0x74')]();}_0x57d7aa=squel['insert']()[_0xfd86('0x7d')](_0xfd86('0x81'))[_0xfd86('0x6b')]([_0xfd86('0x82'),_0xfd86('0x72'),'phone',_0xfd86('0x83'),_0xfd86('0x52'),_0xfd86('0x53')],squel[_0xfd86('0x6e')]()[_0xfd86('0x70')](_0xfd86('0x84'),'id')[_0xfd86('0x70')](_0xfd86('0x71'),_0xfd86('0x72'))[_0xfd86('0x70')](_0xfd86('0x85'),_0xfd86('0x6f'))[_0xfd86('0x70')](_0xfd86('0x86'),_0xfd86('0x83'))['field']('\x27'+_0x590353+'\x27','createdAt')[_0xfd86('0x70')]('\x27'+_0x590353+'\x27','updatedAt')[_0xfd86('0x75')]('cm_contact_has_items','ci')[_0xfd86('0x87')]('cm_hopper','h',_0xfd86('0x88'))['where']('h.ListId\x20=\x20?',_0x2d5cd8[_0xfd86('0x73')]['toString']())[_0xfd86('0x3d')](_0xfd86('0x89'),_0x261975[_0xfd86('0x4f')]['id'][_0xfd86('0x74')]())[_0xfd86('0x3d')]('h.createdAt\x20=\x20?',_0x590353))[_0xfd86('0x74')]();_0x3e9191[_0xfd86('0x8a')](db[_0xfd86('0x8b')][_0xfd86('0x30')](_0x2181cc));_0x40f12c[_0xfd86('0x8a')](db[_0xfd86('0x8b')]['query'](_0x57d7aa));}return BPromise[_0xfd86('0x8c')](_0x3e9191);}})[_0xfd86('0x23')](function(){return BPromise[_0xfd86('0x8c')](_0x40f12c);})[_0xfd86('0x23')](function(){return _0x3f0bd6;})[_0xfd86('0x23')](respondWithResult(_0x23db56,null))['catch'](handleError(_0x23db56,null));};exports[_0xfd86('0x8d')]=function(_0x3726c3,_0x243604,_0x253d03){return db[_0xfd86('0x2b')]['find']({'where':{'id':_0x3726c3['params']['id']}})['then'](handleEntityNotFound(_0x243604,null))['then'](function(_0x4c03bd){if(_0x4c03bd){return _0x4c03bd['removeLists'](_0x3726c3[_0xfd86('0x30')][_0xfd86('0x65')]);}})[_0xfd86('0x23')](function(_0x27392f){if(_0x27392f){return db[_0xfd86('0x57')]['destroy']({'where':{'ListId':_0x3726c3[_0xfd86('0x30')][_0xfd86('0x65')],'CampaignId':_0x3726c3[_0xfd86('0x4f')]['id']}})[_0xfd86('0x23')](function(){return _0x27392f;});}})[_0xfd86('0x23')](respondWithStatusCode(_0x243604,null))[_0xfd86('0x45')](handleError(_0x243604,null));};exports[_0xfd86('0x8e')]=function(_0x2ed762,_0x57c448,_0x2e18e5){var _0x183980={};var _0xb5ef0c={};var _0x121531;var _0x3233f6;return db[_0xfd86('0x2b')][_0xfd86('0x56')]({'where':{'id':_0x2ed762[_0xfd86('0x4f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x57c448,null))['then'](function(_0x303db8){if(_0x303db8){_0x121531=_0x303db8;_0xb5ef0c[_0xfd86('0x35')]=_[_0xfd86('0x31')](db[_0xfd86('0x62')][_0xfd86('0x2c')]);_0xb5ef0c[_0xfd86('0x30')]=_[_0xfd86('0x31')](_0x2ed762['query']);_0xb5ef0c['filters']=_['intersection'](_0xb5ef0c['model'],_0xb5ef0c['query']);_0x183980[_0xfd86('0x34')]=_[_0xfd86('0x33')](_0xb5ef0c[_0xfd86('0x35')],qs[_0xfd86('0x36')](_0x2ed762[_0xfd86('0x30')]['fields']));_0x183980[_0xfd86('0x34')]=_0x183980[_0xfd86('0x34')][_0xfd86('0x37')]?_0x183980[_0xfd86('0x34')]:_0xb5ef0c[_0xfd86('0x35')];_0x183980[_0xfd86('0x39')]=qs['sort'](_0x2ed762[_0xfd86('0x30')][_0xfd86('0x3a')]);_0x183980['where']=qs['filters'](_[_0xfd86('0x3b')](_0x2ed762[_0xfd86('0x30')],_0xb5ef0c['filters']));if(_0x2ed762[_0xfd86('0x30')][_0xfd86('0x3c')]){_0x183980[_0xfd86('0x3d')]=_[_0xfd86('0x3e')](_0x183980[_0xfd86('0x3d')],{'$or':_[_0xfd86('0x3f')](_0x183980['attributes'],function(_0x135c22){var _0x3fa7ec={};_0x3fa7ec[_0x135c22]={'$like':'%'+_0x2ed762[_0xfd86('0x30')][_0xfd86('0x3c')]+'%'};return _0x3fa7ec;})});}_0x183980=_[_0xfd86('0x3e')]({},_0x183980,_0x2ed762['options']);return _0x121531['getBlackLists'](_0x183980);}})[_0xfd86('0x23')](function(_0x4a59fc){if(_0x4a59fc){_0x3233f6=_0x4a59fc[_0xfd86('0x37')];if(!_0x2ed762['query'][_0xfd86('0x38')](_0xfd86('0x58'))){_0x183980[_0xfd86('0x1b')]=qs[_0xfd86('0x1b')](_0x2ed762['query'][_0xfd86('0x1b')]);_0x183980['offset']=qs[_0xfd86('0x1d')](_0x2ed762[_0xfd86('0x30')][_0xfd86('0x1d')]);}return _0x121531[_0xfd86('0x8e')](_0x183980);}})[_0xfd86('0x23')](function(_0x43b282){if(_0x43b282){return _0x43b282?{'count':_0x3233f6,'rows':_0x43b282}:null;}})[_0xfd86('0x23')](respondWithResult(_0x57c448,null))[_0xfd86('0x45')](handleError(_0x57c448,null));};exports[_0xfd86('0x8f')]=function(_0x733f42,_0x2fe7ae,_0x5dff18){var _0x487a76,_0xaf66de;var _0x258b0e=[];var _0x369147=moment()['format'](_0xfd86('0x63'));return db[_0xfd86('0x2b')][_0xfd86('0x44')]({'where':{'id':_0x733f42['params']['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x2fe7ae,null))[_0xfd86('0x23')](function(_0x342ed1){if(_0x342ed1){_0xaf66de=_0x342ed1;return _0x342ed1[_0xfd86('0x8f')](_0x733f42[_0xfd86('0x54')][_0xfd86('0x65')],_[_0xfd86('0x51')](_0x733f42['body'],[_0xfd86('0x65'),'id'])||{});}return null;})[_0xfd86('0x66')](function(_0x1a598a){var _0x575392;var _0x63b1f;_0x487a76=_0x1a598a||[];var _0x3c9cd3=[];if(_0x1a598a){for(var _0x5a3ccd=0x0;_0x5a3ccd<_0x1a598a[_0xfd86('0x37')];_0x5a3ccd+=0x1){var _0x1b7d4c=_0x1a598a[_0x5a3ccd][_0xfd86('0x24')]({'plain':!![]});_0x575392=squel['insert']()[_0xfd86('0x7d')](_0xfd86('0x90'))[_0xfd86('0x6b')]([_0xfd86('0x6f'),_0xfd86('0x6c'),_0xfd86('0x6d'),_0xfd86('0x59'),_0xfd86('0x52'),_0xfd86('0x53')],squel[_0xfd86('0x6e')]()['field'](_0xfd86('0x6f'),_0xfd86('0x6f'))[_0xfd86('0x70')]('id',_0xfd86('0x6c'))[_0xfd86('0x70')](_0x1b7d4c['CmListId'][_0xfd86('0x74')](),_0xfd86('0x6d'))[_0xfd86('0x70')](_0x733f42[_0xfd86('0x4f')]['id'][_0xfd86('0x74')](),'CampaignId')[_0xfd86('0x70')](_0xfd86('0x71'),_0xfd86('0x52'))['field'](_0xfd86('0x71'),_0xfd86('0x53'))[_0xfd86('0x75')](_0xfd86('0x7e'))['where'](_0xfd86('0x7f'))[_0xfd86('0x3d')](_0xfd86('0x76'),_0x1b7d4c[_0xfd86('0x73')][_0xfd86('0x74')]())[_0xfd86('0x3d')](_0xfd86('0x80')))[_0xfd86('0x74')]();_0x3c9cd3[_0xfd86('0x8a')](db[_0xfd86('0x8b')][_0xfd86('0x30')](_0x575392));}return BPromise[_0xfd86('0x8c')](_0x3c9cd3);}})[_0xfd86('0x23')](function(){return _0x487a76;})[_0xfd86('0x23')](respondWithResult(_0x2fe7ae,null))[_0xfd86('0x45')](handleError(_0x2fe7ae,null));};exports[_0xfd86('0x91')]=function(_0x4ae951,_0x21bc9f,_0xa880bb){return db[_0xfd86('0x2b')]['find']({'where':{'id':_0x4ae951[_0xfd86('0x4f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x21bc9f,null))[_0xfd86('0x23')](function(_0x59484a){if(_0x59484a){return _0x59484a[_0xfd86('0x91')](_0x4ae951[_0xfd86('0x30')][_0xfd86('0x65')]);}})[_0xfd86('0x23')](function(_0xca3504){if(_0xca3504){return db['CmHopperBlack'][_0xfd86('0x27')]({'where':{'ListId':_0x4ae951[_0xfd86('0x30')][_0xfd86('0x65')],'CampaignId':_0x4ae951[_0xfd86('0x4f')]['id']}})['then'](function(){return _0xca3504;});}})[_0xfd86('0x23')](respondWithStatusCode(_0x21bc9f,null))['catch'](handleError(_0x21bc9f,null));}; \ No newline at end of file +var _0x3f8c=['IvrCampaigns','UserProfileResource','destroy','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','role','userProfileId','params','getHoppers','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','fromQuery','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then'];(function(_0x4cfcbf,_0x7804a2){var _0x152d90=function(_0x17e3af){while(--_0x17e3af){_0x4cfcbf['push'](_0x4cfcbf['shift']());}};_0x152d90(++_0x7804a2);}(_0x3f8c,0x104));var _0xc3f8=function(_0x44bf69,_0x34269d){_0x44bf69=_0x44bf69-0x0;var _0x2c9cb6=_0x3f8c[_0x44bf69];return _0x2c9cb6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){var _0x3f196d=_0x2559a4['get']({'plain':!![]});var _0x4569c2=_0xc3f8('0x22');return db[_0xc3f8('0x23')][_0xc3f8('0x24')]({'where':{'type':_0x4569c2,'resourceId':_0x3f196d['id']}})[_0xc3f8('0x21')](function(){return _0x2559a4;});})[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)[_0xc3f8('0x18')]();});}};}function handleEntityNotFound(_0x21b002,_0xbea3b8){return function(_0x22c8e6){if(!_0x22c8e6){_0x21b002[_0xc3f8('0x16')](0x194);}return _0x22c8e6;};}function handleError(_0x238ff5,_0x429fd8){_0x429fd8=_0x429fd8||0x1f4;return function(_0x59e4dd){logger[_0xc3f8('0x25')](_0x59e4dd[_0xc3f8('0x26')]);if(_0x59e4dd[_0xc3f8('0x27')]){delete _0x59e4dd['name'];}_0x238ff5[_0xc3f8('0x17')](_0x429fd8)['send'](_0x59e4dd);};}exports[_0xc3f8('0x28')]=function(_0x32343e,_0x47ab53){var _0x48b32e={},_0x21a225={},_0x25df65={'count':0x0,'rows':[]};var _0xd32b09=_[_0xc3f8('0x29')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')],function(_0x680047){return{'name':_0x680047[_0xc3f8('0x2c')],'type':_0x680047[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x21a225['model']=_[_0xc3f8('0x29')](_0xd32b09,_0xc3f8('0x27'));_0x21a225[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x32343e[_0xc3f8('0x2f')]);_0x21a225['filters']=_['intersection'](_0x21a225[_0xc3f8('0x31')],_0x21a225[_0xc3f8('0x2f')]);_0x48b32e[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x21a225[_0xc3f8('0x31')],qs['fields'](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x48b32e[_0xc3f8('0x32')]=_0x48b32e['attributes'][_0xc3f8('0x35')]?_0x48b32e[_0xc3f8('0x32')]:_0x21a225[_0xc3f8('0x31')];if(!_0x32343e['query'][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x48b32e['limit']=qs[_0xc3f8('0x1b')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x48b32e[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x32343e[_0xc3f8('0x2f')]['offset']);}_0x48b32e[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x48b32e[_0xc3f8('0x3a')]=qs['filters'](_[_0xc3f8('0x3b')](_0x32343e[_0xc3f8('0x2f')],_0x21a225[_0xc3f8('0x3c')]),_0xd32b09);if(_0x32343e['query'][_0xc3f8('0x3d')]){_0x48b32e[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x48b32e[_0xc3f8('0x3a')],{'$or':_['map'](_0xd32b09,function(_0x306182){if(_0x306182[_0xc3f8('0x2d')]!==_0xc3f8('0x3f')){var _0x37b104={};_0x37b104[_0x306182['name']]={'$like':'%'+_0x32343e[_0xc3f8('0x2f')]['filter']+'%'};return _0x37b104;}})});}_0x48b32e=_['merge']({},_0x48b32e,_0x32343e[_0xc3f8('0x40')]);var _0x1f3aef={'where':_0x48b32e[_0xc3f8('0x3a')]};return db[_0xc3f8('0x2a')]['count'](_0x1f3aef)['then'](function(_0x361a85){_0x25df65[_0xc3f8('0x1c')]=_0x361a85;if(_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x48b32e[_0xc3f8('0x42')]=[{'all':!![]}];}return db[_0xc3f8('0x2a')][_0xc3f8('0x43')](_0x48b32e);})[_0xc3f8('0x21')](function(_0x13d8dc){_0x25df65[_0xc3f8('0x44')]=_0x13d8dc;return _0x25df65;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x47ab53,_0x48b32e))['catch'](handleError(_0x47ab53,null));};exports[_0xc3f8('0x45')]=function(_0x22e9b3,_0x4b327f){var _0x1aff20={'raw':![],'where':{'id':_0x22e9b3['params']['id']}},_0x172f1a={};_0x172f1a[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')]);_0x172f1a[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x22e9b3[_0xc3f8('0x2f')]);_0x172f1a[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],_0x172f1a[_0xc3f8('0x2f')]);_0x1aff20['attributes']=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],qs['fields'](_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x1aff20[_0xc3f8('0x32')]=_0x1aff20[_0xc3f8('0x32')]['length']?_0x1aff20['attributes']:_0x172f1a[_0xc3f8('0x31')];if(_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x1aff20['include']=[{'all':!![]}];}_0x1aff20=_[_0xc3f8('0x3e')]({},_0x1aff20,_0x22e9b3[_0xc3f8('0x40')]);return db[_0xc3f8('0x2a')][_0xc3f8('0x46')](_0x1aff20)[_0xc3f8('0x21')](handleEntityNotFound(_0x4b327f,null))['then'](respondWithResult(_0x4b327f,null))[_0xc3f8('0x47')](handleError(_0x4b327f,null));};exports[_0xc3f8('0x48')]=function(_0x5961ab,_0x1becae){return db[_0xc3f8('0x2a')][_0xc3f8('0x48')](_0x5961ab[_0xc3f8('0x49')],{})[_0xc3f8('0x21')](function(_0x3045bc){var _0x1ca7c9=_0x5961ab['user'][_0xc3f8('0x4a')]({'plain':!![]});if(!_0x1ca7c9)throw new Error(_0xc3f8('0x4b'));if(_0x1ca7c9['role']===_0xc3f8('0x4c')){var _0x2e9f93=_0x3045bc[_0xc3f8('0x4a')]({'plain':!![]});var _0x33e5c5=_0xc3f8('0x22');return db[_0xc3f8('0x4d')][_0xc3f8('0x46')]({'where':{'name':_0x33e5c5,'userProfileId':_0x1ca7c9['userProfileId']},'raw':!![]})[_0xc3f8('0x21')](function(_0x2c6999){if(_0x2c6999&&_0x2c6999[_0xc3f8('0x4e')]===0x0){return db[_0xc3f8('0x23')][_0xc3f8('0x48')]({'name':_0x2e9f93[_0xc3f8('0x27')],'resourceId':_0x2e9f93['id'],'type':_0x2c6999[_0xc3f8('0x27')],'sectionId':_0x2c6999['id']},{})[_0xc3f8('0x21')](function(){return _0x3045bc;});}else{return _0x3045bc;}})['catch'](function(_0x51249a){logger[_0xc3f8('0x25')](_0xc3f8('0x4f'),_0x51249a);throw _0x51249a;});}return _0x3045bc;})['then'](respondWithResult(_0x1becae,0xc9))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x50')]=function(_0x4b4adb,_0x1b1e13){var _0xf1e0a6={'where':{'id':_0x4b4adb['params']['id']}},_0x1d95f5={};_0x1d95f5[_0xc3f8('0x31')]=_['keys'](db['Campaign'][_0xc3f8('0x2b')]);_0xf1e0a6['attributes']=_[_0xc3f8('0x33')](_0x1d95f5[_0xc3f8('0x31')],qs[_0xc3f8('0x34')](_0x4b4adb['query'][_0xc3f8('0x34')]));_0xf1e0a6[_0xc3f8('0x32')]=_0xf1e0a6[_0xc3f8('0x32')][_0xc3f8('0x35')]?_0xf1e0a6[_0xc3f8('0x32')]:_0x1d95f5['model'];if(_0x4b4adb['query'][_0xc3f8('0x41')]){_0xf1e0a6[_0xc3f8('0x42')]=[{'all':!![]}];}_0xf1e0a6=_[_0xc3f8('0x3e')]({},_0xf1e0a6,_0x4b4adb[_0xc3f8('0x40')]);return db[_0xc3f8('0x2a')]['find'](_0xf1e0a6)[_0xc3f8('0x21')](handleEntityNotFound(_0x1b1e13,null))['then'](function(_0x21dfc8){if(_0x21dfc8){var _0x337029=_0x21dfc8[_0xc3f8('0x4a')]({'plain':!![]});_0x337029=qs[_0xc3f8('0x51')](_0x337029,['id','createdAt',_0xc3f8('0x52')]);_0x4b4adb['body']=_['omit'](_0x4b4adb['body'],['id','createdAt',_0xc3f8('0x52')]);return db[_0xc3f8('0x2a')][_0xc3f8('0x48')](_[_0xc3f8('0x3e')](_0x337029,_0x4b4adb[_0xc3f8('0x49')]),{'include':_0x4b4adb[_0xc3f8('0x2f')][_0xc3f8('0x41')]?[{'all':!![]}]:undefined})[_0xc3f8('0x21')](function(_0x5250df){var _0x84e1a2=_0x4b4adb[_0xc3f8('0x4c')][_0xc3f8('0x4a')]({'plain':!![]});if(!_0x84e1a2)throw new Error(_0xc3f8('0x4b'));if(_0x84e1a2[_0xc3f8('0x53')]==='user'){var _0x19aded=_0x5250df[_0xc3f8('0x4a')]({'plain':!![]});var _0x30c90f=_0xc3f8('0x22');return db[_0xc3f8('0x4d')]['find']({'where':{'name':_0x30c90f,'userProfileId':_0x84e1a2[_0xc3f8('0x54')]},'raw':!![]})[_0xc3f8('0x21')](function(_0x42b255){if(_0x42b255&&_0x42b255[_0xc3f8('0x4e')]===0x0){return db[_0xc3f8('0x23')][_0xc3f8('0x48')]({'name':_0x19aded['name'],'resourceId':_0x19aded['id'],'type':_0x42b255[_0xc3f8('0x27')],'sectionId':_0x42b255['id']},{})[_0xc3f8('0x21')](function(){return _0x5250df;});}else{return _0x5250df;}})[_0xc3f8('0x47')](function(_0x5e3f96){logger[_0xc3f8('0x25')](_0xc3f8('0x4f'),_0x5e3f96);throw _0x5e3f96;});}return _0x5250df;});}})['then'](respondWithResult(_0x1b1e13,0xc9))['catch'](handleError(_0x1b1e13,null));};exports[_0xc3f8('0x20')]=function(_0x2c7ab9,_0x4a1e61){if(_0x2c7ab9[_0xc3f8('0x49')]['id']){delete _0x2c7ab9[_0xc3f8('0x49')]['id'];}return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x2c7ab9[_0xc3f8('0x55')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x4a1e61,null))[_0xc3f8('0x21')](saveUpdates(_0x2c7ab9[_0xc3f8('0x49')],null))['then'](respondWithResult(_0x4a1e61,null))['catch'](handleError(_0x4a1e61,null));};exports[_0xc3f8('0x24')]=function(_0x5cd8b4,_0x4a1cf5){return db['Campaign']['find']({'where':{'id':_0x5cd8b4['params']['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x4a1cf5,null))[_0xc3f8('0x21')](removeEntity(_0x4a1cf5,null))[_0xc3f8('0x47')](handleError(_0x4a1cf5,null));};exports[_0xc3f8('0x56')]=function(_0x4dd44f,_0x18a398,_0x2d0b58){var _0x5d6208={'raw':!![],'where':{}};var _0x3b9b47={};var _0x273faf={'count':0x0,'rows':[]};return db[_0xc3f8('0x2a')]['findOne']({'where':{'id':_0x4dd44f[_0xc3f8('0x55')]['id']}})['then'](handleEntityNotFound(_0x18a398,null))['then'](function(_0x4935ae){if(_0x4935ae){_0x3b9b47[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db['CmHopper'][_0xc3f8('0x2b')]);_0x3b9b47[_0xc3f8('0x2f')]=_['keys'](_0x4dd44f[_0xc3f8('0x2f')]);_0x3b9b47[_0xc3f8('0x3c')]=_['intersection'](_0x3b9b47[_0xc3f8('0x31')],_0x3b9b47['query']);_0x5d6208[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x3b9b47['model'],qs['fields'](_0x4dd44f[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x5d6208['attributes']=_0x5d6208[_0xc3f8('0x32')]['length']?_0x5d6208[_0xc3f8('0x32')]:_0x3b9b47['model'];if(!_0x4dd44f[_0xc3f8('0x2f')][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x5d6208[_0xc3f8('0x1b')]=qs[_0xc3f8('0x1b')](_0x4dd44f[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x5d6208[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x4dd44f['query'][_0xc3f8('0x1a')]);}_0x5d6208[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x4dd44f[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x5d6208['where']=qs[_0xc3f8('0x3c')](_[_0xc3f8('0x3b')](_0x4dd44f[_0xc3f8('0x2f')],_0x3b9b47[_0xc3f8('0x3c')]));_0x5d6208[_0xc3f8('0x3a')]['CampaignId']=_0x4935ae['id'];if(_0x4dd44f[_0xc3f8('0x2f')][_0xc3f8('0x3d')]){_0x5d6208[_0xc3f8('0x3a')]=_['merge'](_0x5d6208['where'],{'$or':_[_0xc3f8('0x29')](_0x5d6208[_0xc3f8('0x32')],function(_0x1a9c33){var _0x34158f={};_0x34158f[_0x1a9c33]={'$like':'%'+_0x4dd44f['query'][_0xc3f8('0x3d')]+'%'};return _0x34158f;})});}_0x5d6208=_[_0xc3f8('0x3e')]({},_0x5d6208,_0x4dd44f[_0xc3f8('0x40')]);return db['CmHopper'][_0xc3f8('0x1c')]({'where':_0x5d6208[_0xc3f8('0x3a')]})['then'](function(_0x478d21){_0x273faf[_0xc3f8('0x1c')]=_0x478d21;if(_0x4dd44f[_0xc3f8('0x2f')]['includeAll']){_0x5d6208[_0xc3f8('0x42')]=[{'all':!![]}];}return db[_0xc3f8('0x57')]['findAll'](_0x5d6208);})[_0xc3f8('0x21')](function(_0x5f2d86){_0x273faf[_0xc3f8('0x44')]=_0x5f2d86;return _0x273faf;});}})['then'](respondWithFilteredResult(_0x18a398,_0x5d6208))[_0xc3f8('0x47')](handleError(_0x18a398,null));};exports[_0xc3f8('0x58')]=function(_0x2fafd7,_0x1d4abf,_0x2de860){var _0x1a5cc9={'raw':!![],'where':{}};var _0x34af4a={};var _0x18cc23={'count':0x0,'rows':[]};return db[_0xc3f8('0x2a')]['findOne']({'where':{'id':_0x2fafd7['params']['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x1d4abf,null))['then'](function(_0xa2b49d){if(_0xa2b49d){_0x34af4a[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db[_0xc3f8('0x59')]['rawAttributes']);_0x34af4a[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x2fafd7[_0xc3f8('0x2f')]);_0x34af4a[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x34af4a[_0xc3f8('0x31')],_0x34af4a[_0xc3f8('0x2f')]);_0x1a5cc9[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x34af4a['model'],qs['fields'](_0x2fafd7[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x1a5cc9[_0xc3f8('0x32')]=_0x1a5cc9['attributes'][_0xc3f8('0x35')]?_0x1a5cc9['attributes']:_0x34af4a[_0xc3f8('0x31')];if(!_0x2fafd7['query'][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x1a5cc9[_0xc3f8('0x1b')]=qs[_0xc3f8('0x1b')](_0x2fafd7[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x1a5cc9[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x2fafd7['query'][_0xc3f8('0x1a')]);}_0x1a5cc9[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x2fafd7[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x1a5cc9['where']=qs[_0xc3f8('0x3c')](_[_0xc3f8('0x3b')](_0x2fafd7[_0xc3f8('0x2f')],_0x34af4a[_0xc3f8('0x3c')]));_0x1a5cc9['where']['CampaignId']=_0xa2b49d['id'];if(_0x2fafd7[_0xc3f8('0x2f')][_0xc3f8('0x3d')]){_0x1a5cc9['where']=_['merge'](_0x1a5cc9['where'],{'$or':_[_0xc3f8('0x29')](_0x1a5cc9['attributes'],function(_0x2a4b80){var _0x31b48d={};_0x31b48d[_0x2a4b80]={'$like':'%'+_0x2fafd7[_0xc3f8('0x2f')][_0xc3f8('0x3d')]+'%'};return _0x31b48d;})});}_0x1a5cc9=_[_0xc3f8('0x3e')]({},_0x1a5cc9,_0x2fafd7[_0xc3f8('0x40')]);return db[_0xc3f8('0x59')]['count']({'where':_0x1a5cc9['where']})['then'](function(_0x4ea284){_0x18cc23[_0xc3f8('0x1c')]=_0x4ea284;if(_0x2fafd7['query'][_0xc3f8('0x41')]){_0x1a5cc9[_0xc3f8('0x42')]=[{'all':!![]}];}return db[_0xc3f8('0x59')]['findAll'](_0x1a5cc9);})[_0xc3f8('0x21')](function(_0x12bb93){_0x18cc23['rows']=_0x12bb93;return _0x18cc23;});}})[_0xc3f8('0x21')](respondWithFilteredResult(_0x1d4abf,_0x1a5cc9))[_0xc3f8('0x47')](handleError(_0x1d4abf,null));};exports[_0xc3f8('0x5a')]=function(_0x501b02,_0x3314fc,_0x426074){var _0x2acc92={'raw':!![],'where':{}};var _0x5a2197={};var _0x1704e5={'count':0x0,'rows':[]};return db[_0xc3f8('0x2a')][_0xc3f8('0x5b')]({'where':{'id':_0x501b02[_0xc3f8('0x55')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x3314fc,null))[_0xc3f8('0x21')](function(_0x481112){if(_0x481112){_0x5a2197[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db['CmHopperFinal'][_0xc3f8('0x2b')]);_0x5a2197[_0xc3f8('0x2f')]=_['keys'](_0x501b02[_0xc3f8('0x2f')]);_0x5a2197[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x5a2197['model'],_0x5a2197['query']);_0x2acc92[_0xc3f8('0x32')]=_['intersection'](_0x5a2197[_0xc3f8('0x31')],qs[_0xc3f8('0x34')](_0x501b02[_0xc3f8('0x2f')]['fields']));_0x2acc92[_0xc3f8('0x32')]=_0x2acc92[_0xc3f8('0x32')][_0xc3f8('0x35')]?_0x2acc92[_0xc3f8('0x32')]:_0x5a2197[_0xc3f8('0x31')];if(!_0x501b02[_0xc3f8('0x2f')]['hasOwnProperty'](_0xc3f8('0x37'))){_0x2acc92[_0xc3f8('0x1b')]=qs[_0xc3f8('0x1b')](_0x501b02[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x2acc92['offset']=qs[_0xc3f8('0x1a')](_0x501b02[_0xc3f8('0x2f')][_0xc3f8('0x1a')]);}_0x2acc92['order']=qs[_0xc3f8('0x39')](_0x501b02[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x2acc92[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3c')](_['pick'](_0x501b02[_0xc3f8('0x2f')],_0x5a2197[_0xc3f8('0x3c')]));_0x2acc92[_0xc3f8('0x3a')][_0xc3f8('0x5c')]=_0x481112['id'];if(_0x501b02[_0xc3f8('0x2f')][_0xc3f8('0x3d')]){_0x2acc92[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x2acc92[_0xc3f8('0x3a')],{'$or':_[_0xc3f8('0x29')](_0x2acc92[_0xc3f8('0x32')],function(_0x50a6e0){var _0x55e2ee={};_0x55e2ee[_0x50a6e0]={'$like':'%'+_0x501b02[_0xc3f8('0x2f')]['filter']+'%'};return _0x55e2ee;})});}_0x2acc92=_['merge']({},_0x2acc92,_0x501b02[_0xc3f8('0x40')]);return db[_0xc3f8('0x5d')][_0xc3f8('0x1c')]({'where':_0x2acc92[_0xc3f8('0x3a')]})['then'](function(_0x2dad3f){_0x1704e5[_0xc3f8('0x1c')]=_0x2dad3f;if(_0x501b02['query'][_0xc3f8('0x41')]){_0x2acc92[_0xc3f8('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2acc92);})['then'](function(_0x1426ea){_0x1704e5[_0xc3f8('0x44')]=_0x1426ea;return _0x1704e5;});}})[_0xc3f8('0x21')](respondWithFilteredResult(_0x3314fc,_0x2acc92))[_0xc3f8('0x47')](handleError(_0x3314fc,null));};exports[_0xc3f8('0x5e')]=function(_0xefe62a,_0x1c77df,_0x15e1f3){var _0x1ebbe1={'raw':!![],'where':{}};var _0x4c55ae={};var _0x49a936={'count':0x0,'rows':[]};return db[_0xc3f8('0x2a')][_0xc3f8('0x5b')]({'where':{'id':_0xefe62a[_0xc3f8('0x55')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x1c77df,null))[_0xc3f8('0x21')](function(_0x21fe09){if(_0x21fe09){_0x4c55ae[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db[_0xc3f8('0x5f')]['rawAttributes']);_0x4c55ae[_0xc3f8('0x2f')]=_['keys'](_0xefe62a['query']);_0x4c55ae[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x4c55ae[_0xc3f8('0x31')],_0x4c55ae[_0xc3f8('0x2f')]);_0x1ebbe1[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x4c55ae['model'],qs[_0xc3f8('0x34')](_0xefe62a[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x1ebbe1['attributes']=_0x1ebbe1['attributes'][_0xc3f8('0x35')]?_0x1ebbe1[_0xc3f8('0x32')]:_0x4c55ae['model'];if(!_0xefe62a[_0xc3f8('0x2f')][_0xc3f8('0x36')]('nolimit')){_0x1ebbe1[_0xc3f8('0x1b')]=qs[_0xc3f8('0x1b')](_0xefe62a[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x1ebbe1[_0xc3f8('0x1a')]=qs['offset'](_0xefe62a[_0xc3f8('0x2f')]['offset']);}_0x1ebbe1[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0xefe62a['query'][_0xc3f8('0x39')]);_0x1ebbe1[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3c')](_[_0xc3f8('0x3b')](_0xefe62a[_0xc3f8('0x2f')],_0x4c55ae[_0xc3f8('0x3c')]));_0x1ebbe1[_0xc3f8('0x3a')][_0xc3f8('0x5c')]=_0x21fe09['id'];if(_0xefe62a[_0xc3f8('0x2f')][_0xc3f8('0x3d')]){_0x1ebbe1[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x1ebbe1[_0xc3f8('0x3a')],{'$or':_[_0xc3f8('0x29')](_0x1ebbe1[_0xc3f8('0x32')],function(_0x5085cf){var _0x31d6da={};_0x31d6da[_0x5085cf]={'$like':'%'+_0xefe62a[_0xc3f8('0x2f')][_0xc3f8('0x3d')]+'%'};return _0x31d6da;})});}_0x1ebbe1=_['merge']({},_0x1ebbe1,_0xefe62a[_0xc3f8('0x40')]);return db[_0xc3f8('0x5f')]['count']({'where':_0x1ebbe1[_0xc3f8('0x3a')]})['then'](function(_0x2ef6e5){_0x49a936['count']=_0x2ef6e5;if(_0xefe62a[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x1ebbe1[_0xc3f8('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc3f8('0x43')](_0x1ebbe1);})[_0xc3f8('0x21')](function(_0x276108){_0x49a936[_0xc3f8('0x44')]=_0x276108;return _0x49a936;});}})[_0xc3f8('0x21')](respondWithFilteredResult(_0x1c77df,_0x1ebbe1))[_0xc3f8('0x47')](handleError(_0x1c77df,null));};exports[_0xc3f8('0x60')]=function(_0x4af05a,_0x1e1adf,_0xa7e06){var _0x103ded={};var _0x3e87d7={};var _0x349dd9;var _0x4337be;return db[_0xc3f8('0x2a')][_0xc3f8('0x5b')]({'where':{'id':_0x4af05a[_0xc3f8('0x55')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x1e1adf,null))[_0xc3f8('0x21')](function(_0x24f12f){if(_0x24f12f){_0x349dd9=_0x24f12f;_0x3e87d7[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db['CmList'][_0xc3f8('0x2b')]);_0x3e87d7['query']=_[_0xc3f8('0x30')](_0x4af05a['query']);_0x3e87d7['filters']=_[_0xc3f8('0x33')](_0x3e87d7[_0xc3f8('0x31')],_0x3e87d7[_0xc3f8('0x2f')]);_0x103ded['attributes']=_['intersection'](_0x3e87d7[_0xc3f8('0x31')],qs[_0xc3f8('0x34')](_0x4af05a[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x103ded[_0xc3f8('0x32')]=_0x103ded['attributes'][_0xc3f8('0x35')]?_0x103ded[_0xc3f8('0x32')]:_0x3e87d7[_0xc3f8('0x31')];_0x103ded['order']=qs['sort'](_0x4af05a[_0xc3f8('0x2f')]['sort']);_0x103ded['where']=qs['filters'](_[_0xc3f8('0x3b')](_0x4af05a[_0xc3f8('0x2f')],_0x3e87d7[_0xc3f8('0x3c')]));if(_0x4af05a[_0xc3f8('0x2f')]['filter']){_0x103ded[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x103ded[_0xc3f8('0x3a')],{'$or':_['map'](_0x103ded[_0xc3f8('0x32')],function(_0x21b8ed){var _0x165d27={};_0x165d27[_0x21b8ed]={'$like':'%'+_0x4af05a[_0xc3f8('0x2f')][_0xc3f8('0x3d')]+'%'};return _0x165d27;})});}_0x103ded=_['merge']({},_0x103ded,_0x4af05a[_0xc3f8('0x40')]);return _0x349dd9[_0xc3f8('0x60')](_0x103ded);}})[_0xc3f8('0x21')](function(_0x194b4a){if(_0x194b4a){_0x4337be=_0x194b4a[_0xc3f8('0x35')];if(!_0x4af05a[_0xc3f8('0x2f')]['hasOwnProperty'](_0xc3f8('0x37'))){_0x103ded[_0xc3f8('0x1b')]=qs['limit'](_0x4af05a[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x103ded[_0xc3f8('0x1a')]=qs['offset'](_0x4af05a[_0xc3f8('0x2f')]['offset']);}return _0x349dd9[_0xc3f8('0x60')](_0x103ded);}})[_0xc3f8('0x21')](function(_0x6139a6){if(_0x6139a6){return _0x6139a6?{'count':_0x4337be,'rows':_0x6139a6}:null;}})[_0xc3f8('0x21')](respondWithResult(_0x1e1adf,null))[_0xc3f8('0x47')](handleError(_0x1e1adf,null));};exports[_0xc3f8('0x61')]=function(_0x10cfbe,_0x1376e4,_0x2c9b71){var _0x2049f0,_0x3aa0c2;var _0x215ae9=[];var _0x1c6d52=moment()[_0xc3f8('0x62')](_0xc3f8('0x63'));return db[_0xc3f8('0x2a')]['find']({'where':{'id':_0x10cfbe[_0xc3f8('0x55')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x1376e4,null))[_0xc3f8('0x21')](function(_0x3a53a9){if(_0x3a53a9){_0x3aa0c2=_0x3a53a9;return _0x3a53a9[_0xc3f8('0x61')](_0x10cfbe['body'][_0xc3f8('0x64')],_[_0xc3f8('0x51')](_0x10cfbe[_0xc3f8('0x49')],[_0xc3f8('0x64'),'id'])||{});}return null;})[_0xc3f8('0x65')](function(_0xb31d99){var _0x161637;var _0x5a8090;_0x2049f0=_0xb31d99||[];var _0x254bf9=[];if(_0xb31d99){for(var _0x5bde4a=0x0;_0x5bde4a<_0xb31d99['length'];_0x5bde4a+=0x1){var _0x28db21=_0xb31d99[_0x5bde4a][_0xc3f8('0x4a')]({'plain':!![]});_0x3aa0c2[_0xc3f8('0x66')]=_0x10cfbe[_0xc3f8('0x49')][_0xc3f8('0x66')]?_0x10cfbe['body'][_0xc3f8('0x66')]:_0x3aa0c2['dialCheckDuplicateType'];switch(_0x3aa0c2[_0xc3f8('0x66')]){case _0xc3f8('0x67'):_0x161637=squel['insert']()[_0xc3f8('0x68')](_0xc3f8('0x69'))['fromQuery']([_0xc3f8('0x6a'),_0xc3f8('0x6b'),_0xc3f8('0x6c'),_0xc3f8('0x6d'),_0xc3f8('0x5c'),_0xc3f8('0x6e'),_0xc3f8('0x52')],squel[_0xc3f8('0x6f')]()[_0xc3f8('0x70')](_0xc3f8('0x6a'),_0xc3f8('0x6a'))['field'](_0xc3f8('0x71'),'scheduledAt')[_0xc3f8('0x70')]('id','ContactId')[_0xc3f8('0x70')](_0x28db21[_0xc3f8('0x72')]['toString'](),'ListId')['field'](_0x10cfbe[_0xc3f8('0x55')]['id'][_0xc3f8('0x73')](),_0xc3f8('0x5c'))[_0xc3f8('0x70')]('\x27'+_0x1c6d52+'\x27',_0xc3f8('0x6e'))[_0xc3f8('0x70')]('\x27'+_0x1c6d52+'\x27',_0xc3f8('0x52'))[_0xc3f8('0x74')](_0xc3f8('0x75'))[_0xc3f8('0x3a')](_0xc3f8('0x76'))[_0xc3f8('0x3a')]('ListId\x20=\x20?',_0x28db21[_0xc3f8('0x72')][_0xc3f8('0x73')]())[_0xc3f8('0x3a')](_0xc3f8('0x77'))[_0xc3f8('0x3a')](_0xc3f8('0x78'),squel[_0xc3f8('0x6f')]()[_0xc3f8('0x70')](_0xc3f8('0x79'))['from'](_0xc3f8('0x7a'))[_0xc3f8('0x3a')](_0xc3f8('0x7b'),_0x10cfbe[_0xc3f8('0x55')]['id'][_0xc3f8('0x73')]()))[_0xc3f8('0x3a')](_0xc3f8('0x78'),squel[_0xc3f8('0x6f')]()[_0xc3f8('0x70')](_0xc3f8('0x7c'))[_0xc3f8('0x74')](_0xc3f8('0x69'))[_0xc3f8('0x3a')](_0xc3f8('0x7b'),_0x10cfbe[_0xc3f8('0x55')]['id'][_0xc3f8('0x73')]())))[_0xc3f8('0x73')]();break;case _0xc3f8('0x7d'):_0x161637=squel[_0xc3f8('0x7e')]()[_0xc3f8('0x68')](_0xc3f8('0x69'))[_0xc3f8('0x7f')](['phone','scheduledAt','ContactId',_0xc3f8('0x6d'),_0xc3f8('0x5c'),_0xc3f8('0x6e'),'updatedAt'],squel['select']()['field'](_0xc3f8('0x6a'),_0xc3f8('0x6a'))[_0xc3f8('0x70')](_0xc3f8('0x71'),_0xc3f8('0x6b'))['field']('id','ContactId')[_0xc3f8('0x70')](_0x28db21['CmListId']['toString'](),_0xc3f8('0x6d'))[_0xc3f8('0x70')](_0x10cfbe['params']['id']['toString'](),_0xc3f8('0x5c'))[_0xc3f8('0x70')]('\x27'+_0x1c6d52+'\x27',_0xc3f8('0x6e'))[_0xc3f8('0x70')]('\x27'+_0x1c6d52+'\x27','updatedAt')[_0xc3f8('0x74')](_0xc3f8('0x75'))[_0xc3f8('0x3a')](_0xc3f8('0x76'))[_0xc3f8('0x3a')]('ListId\x20=\x20?',_0x28db21[_0xc3f8('0x72')][_0xc3f8('0x73')]())[_0xc3f8('0x3a')](_0xc3f8('0x77'))[_0xc3f8('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc3f8('0x6f')]()[_0xc3f8('0x70')]('COALESCE(phone,\x27\x27)')['from'](_0xc3f8('0x69'))[_0xc3f8('0x3a')](_0xc3f8('0x7b'),_0x10cfbe[_0xc3f8('0x55')]['id'][_0xc3f8('0x73')]())))['toString']();break;default:_0x161637=squel[_0xc3f8('0x7e')]()['into']('cm_hopper')[_0xc3f8('0x7f')]([_0xc3f8('0x6a'),_0xc3f8('0x6b'),_0xc3f8('0x6c'),_0xc3f8('0x6d'),_0xc3f8('0x5c'),_0xc3f8('0x6e'),_0xc3f8('0x52')],squel[_0xc3f8('0x6f')]()['field'](_0xc3f8('0x6a'),_0xc3f8('0x6a'))[_0xc3f8('0x70')]('NOW()',_0xc3f8('0x6b'))[_0xc3f8('0x70')]('id',_0xc3f8('0x6c'))[_0xc3f8('0x70')](_0x28db21[_0xc3f8('0x72')][_0xc3f8('0x73')](),'ListId')['field'](_0x10cfbe[_0xc3f8('0x55')]['id']['toString'](),_0xc3f8('0x5c'))[_0xc3f8('0x70')]('\x27'+_0x1c6d52+'\x27',_0xc3f8('0x6e'))['field']('\x27'+_0x1c6d52+'\x27','updatedAt')[_0xc3f8('0x74')](_0xc3f8('0x75'))[_0xc3f8('0x3a')](_0xc3f8('0x76'))[_0xc3f8('0x3a')](_0xc3f8('0x80'),_0x28db21['CmListId'][_0xc3f8('0x73')]())[_0xc3f8('0x3a')](_0xc3f8('0x77')))['toString']();}_0x5a8090=squel[_0xc3f8('0x7e')]()[_0xc3f8('0x68')](_0xc3f8('0x81'))['fromQuery']([_0xc3f8('0x82'),'scheduledAt',_0xc3f8('0x6a'),'OrderBy',_0xc3f8('0x6e'),_0xc3f8('0x52')],squel[_0xc3f8('0x6f')]()[_0xc3f8('0x70')](_0xc3f8('0x83'),'id')['field'](_0xc3f8('0x71'),_0xc3f8('0x6b'))[_0xc3f8('0x70')]('ci.item',_0xc3f8('0x6a'))[_0xc3f8('0x70')](_0xc3f8('0x84'),_0xc3f8('0x85'))[_0xc3f8('0x70')]('\x27'+_0x1c6d52+'\x27',_0xc3f8('0x6e'))['field']('\x27'+_0x1c6d52+'\x27','updatedAt')[_0xc3f8('0x74')](_0xc3f8('0x86'),'ci')[_0xc3f8('0x87')](_0xc3f8('0x69'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xc3f8('0x3a')](_0xc3f8('0x88'),_0x28db21[_0xc3f8('0x72')]['toString']())[_0xc3f8('0x3a')](_0xc3f8('0x89'),_0x10cfbe[_0xc3f8('0x55')]['id'][_0xc3f8('0x73')]())[_0xc3f8('0x3a')](_0xc3f8('0x8a'),_0x1c6d52))[_0xc3f8('0x73')]();_0x254bf9[_0xc3f8('0x8b')](db[_0xc3f8('0x8c')]['query'](_0x161637));_0x215ae9[_0xc3f8('0x8b')](db[_0xc3f8('0x8c')][_0xc3f8('0x2f')](_0x5a8090));}return BPromise[_0xc3f8('0x8d')](_0x254bf9);}})[_0xc3f8('0x21')](function(){return BPromise[_0xc3f8('0x8d')](_0x215ae9);})['then'](function(){return _0x2049f0;})['then'](respondWithResult(_0x1376e4,null))[_0xc3f8('0x47')](handleError(_0x1376e4,null));};exports['removeLists']=function(_0x3e4819,_0x932db6,_0xae1cee){return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x3e4819['params']['id']}})['then'](handleEntityNotFound(_0x932db6,null))[_0xc3f8('0x21')](function(_0x1b449c){if(_0x1b449c){return _0x1b449c[_0xc3f8('0x8e')](_0x3e4819[_0xc3f8('0x2f')][_0xc3f8('0x64')]);}})[_0xc3f8('0x21')](function(_0x8122fd){if(_0x8122fd){return db[_0xc3f8('0x57')]['destroy']({'where':{'ListId':_0x3e4819[_0xc3f8('0x2f')][_0xc3f8('0x64')],'CampaignId':_0x3e4819[_0xc3f8('0x55')]['id']}})[_0xc3f8('0x21')](function(){return _0x8122fd;});}})['then'](respondWithStatusCode(_0x932db6,null))[_0xc3f8('0x47')](handleError(_0x932db6,null));};exports[_0xc3f8('0x8f')]=function(_0x522759,_0x2eeb45,_0x4da608){var _0x59c31a={};var _0x1c3b72={};var _0x5b0e13;var _0x10bd96;return db[_0xc3f8('0x2a')]['findOne']({'where':{'id':_0x522759['params']['id']}})['then'](handleEntityNotFound(_0x2eeb45,null))[_0xc3f8('0x21')](function(_0x4e01b7){if(_0x4e01b7){_0x5b0e13=_0x4e01b7;_0x1c3b72['model']=_[_0xc3f8('0x30')](db['CmList']['rawAttributes']);_0x1c3b72[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x522759[_0xc3f8('0x2f')]);_0x1c3b72[_0xc3f8('0x3c')]=_['intersection'](_0x1c3b72[_0xc3f8('0x31')],_0x1c3b72[_0xc3f8('0x2f')]);_0x59c31a[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x1c3b72[_0xc3f8('0x31')],qs[_0xc3f8('0x34')](_0x522759[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x59c31a[_0xc3f8('0x32')]=_0x59c31a[_0xc3f8('0x32')]['length']?_0x59c31a[_0xc3f8('0x32')]:_0x1c3b72[_0xc3f8('0x31')];_0x59c31a[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x522759[_0xc3f8('0x2f')]['sort']);_0x59c31a[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3c')](_[_0xc3f8('0x3b')](_0x522759['query'],_0x1c3b72[_0xc3f8('0x3c')]));if(_0x522759[_0xc3f8('0x2f')]['filter']){_0x59c31a[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x59c31a[_0xc3f8('0x3a')],{'$or':_[_0xc3f8('0x29')](_0x59c31a[_0xc3f8('0x32')],function(_0x2f1709){var _0x3cc8d4={};_0x3cc8d4[_0x2f1709]={'$like':'%'+_0x522759[_0xc3f8('0x2f')][_0xc3f8('0x3d')]+'%'};return _0x3cc8d4;})});}_0x59c31a=_['merge']({},_0x59c31a,_0x522759[_0xc3f8('0x40')]);return _0x5b0e13[_0xc3f8('0x8f')](_0x59c31a);}})[_0xc3f8('0x21')](function(_0x492b9e){if(_0x492b9e){_0x10bd96=_0x492b9e['length'];if(!_0x522759[_0xc3f8('0x2f')][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x59c31a[_0xc3f8('0x1b')]=qs[_0xc3f8('0x1b')](_0x522759[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x59c31a[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x522759[_0xc3f8('0x2f')][_0xc3f8('0x1a')]);}return _0x5b0e13[_0xc3f8('0x8f')](_0x59c31a);}})['then'](function(_0x3796d1){if(_0x3796d1){return _0x3796d1?{'count':_0x10bd96,'rows':_0x3796d1}:null;}})[_0xc3f8('0x21')](respondWithResult(_0x2eeb45,null))[_0xc3f8('0x47')](handleError(_0x2eeb45,null));};exports[_0xc3f8('0x90')]=function(_0x27c888,_0x14bf38,_0x12986b){var _0x3fc6fc,_0x3642be;var _0x545b5a=[];var _0x4d921b=moment()[_0xc3f8('0x62')](_0xc3f8('0x63'));return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x27c888[_0xc3f8('0x55')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x14bf38,null))[_0xc3f8('0x21')](function(_0x2a36a9){if(_0x2a36a9){_0x3642be=_0x2a36a9;return _0x2a36a9[_0xc3f8('0x90')](_0x27c888['body'][_0xc3f8('0x64')],_['omit'](_0x27c888['body'],[_0xc3f8('0x64'),'id'])||{});}return null;})['spread'](function(_0x49d71a){var _0x4fd1bb;var _0x4558f8;_0x3fc6fc=_0x49d71a||[];var _0x53d8d1=[];if(_0x49d71a){for(var _0x22a9e2=0x0;_0x22a9e2<_0x49d71a[_0xc3f8('0x35')];_0x22a9e2+=0x1){var _0x50f6a0=_0x49d71a[_0x22a9e2][_0xc3f8('0x4a')]({'plain':!![]});_0x4fd1bb=squel[_0xc3f8('0x7e')]()[_0xc3f8('0x68')](_0xc3f8('0x91'))['fromQuery']([_0xc3f8('0x6a'),_0xc3f8('0x6c'),_0xc3f8('0x6d'),_0xc3f8('0x5c'),'createdAt',_0xc3f8('0x52')],squel[_0xc3f8('0x6f')]()['field'](_0xc3f8('0x6a'),_0xc3f8('0x6a'))[_0xc3f8('0x70')]('id',_0xc3f8('0x6c'))[_0xc3f8('0x70')](_0x50f6a0[_0xc3f8('0x72')][_0xc3f8('0x73')](),_0xc3f8('0x6d'))[_0xc3f8('0x70')](_0x27c888[_0xc3f8('0x55')]['id'][_0xc3f8('0x73')](),_0xc3f8('0x5c'))['field'](_0xc3f8('0x71'),_0xc3f8('0x6e'))['field'](_0xc3f8('0x71'),_0xc3f8('0x52'))[_0xc3f8('0x74')](_0xc3f8('0x75'))['where'](_0xc3f8('0x76'))['where'](_0xc3f8('0x80'),_0x50f6a0[_0xc3f8('0x72')][_0xc3f8('0x73')]())[_0xc3f8('0x3a')](_0xc3f8('0x77')))[_0xc3f8('0x73')]();_0x53d8d1[_0xc3f8('0x8b')](db[_0xc3f8('0x8c')][_0xc3f8('0x2f')](_0x4fd1bb));}return BPromise[_0xc3f8('0x8d')](_0x53d8d1);}})[_0xc3f8('0x21')](function(){return _0x3fc6fc;})[_0xc3f8('0x21')](respondWithResult(_0x14bf38,null))[_0xc3f8('0x47')](handleError(_0x14bf38,null));};exports['removeBlackLists']=function(_0x312f3b,_0x36f4dd,_0x34a23a){return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x312f3b[_0xc3f8('0x55')]['id']}})['then'](handleEntityNotFound(_0x36f4dd,null))['then'](function(_0x13ff81){if(_0x13ff81){return _0x13ff81[_0xc3f8('0x92')](_0x312f3b[_0xc3f8('0x2f')][_0xc3f8('0x64')]);}})[_0xc3f8('0x21')](function(_0x3c480c){if(_0x3c480c){return db[_0xc3f8('0x5f')][_0xc3f8('0x24')]({'where':{'ListId':_0x312f3b[_0xc3f8('0x2f')][_0xc3f8('0x64')],'CampaignId':_0x312f3b['params']['id']}})[_0xc3f8('0x21')](function(){return _0x3c480c;});}})['then'](respondWithStatusCode(_0x36f4dd,null))[_0xc3f8('0x47')](handleError(_0x36f4dd,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6110db4..422f1bb 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2625ee,_0x44821d){var _0x5db885=function(_0x3cc070){while(--_0x3cc070){_0x2625ee['push'](_0x2625ee['shift']());}};_0x5db885(++_0x44821d);}(_0x7a54,0x106));var _0x47a5=function(_0x54a01b,_0x2e2ab5){_0x54a01b=_0x54a01b-0x0;var _0x588b67=_0x7a54[_0x54a01b];return _0x588b67;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x402671,_0x5bb553){var _0x326991=function(_0xa2f254){while(--_0xa2f254){_0x402671['push'](_0x402671['shift']());}};_0x326991(++_0x5bb553);}(_0x7a54,0x106));var _0x47a5=function(_0x52ae53,_0x4fb4f0){_0x52ae53=_0x52ae53-0x0;var _0x229f86=_0x7a54[_0x52ae53];return _0x229f86;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index c64cc92..a8870d8 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 _0x98d3=['result','catch','options','raw','where','limit','include','attributes','model','map','GetCampaign','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x679a15,_0x3da9c7){var _0x12d3c5=function(_0x4b93f0){while(--_0x4b93f0){_0x679a15['push'](_0x679a15['shift']());}};_0x12d3c5(++_0x3da9c7);}(_0x98d3,0x173));var _0x398d=function(_0x4b0e62,_0x3e1b3d){_0x4b0e62=_0x4b0e62-0x0;var _0x2ec671=_0x98d3[_0x4b0e62];return _0x2ec671;};'use strict';var _=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var moment=require('moment');var BPromise=require(_0x398d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x398d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x398d('0x4'));var logger=require(_0x398d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x398d('0x6'));var client=jayson[_0x398d('0x7')][_0x398d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x502652,_0x4ba1a3,_0x391d99){return new BPromise(function(_0x3029f3,_0x399598){return client[_0x398d('0x9')](_0x502652,_0x391d99)['then'](function(_0x3a1934){logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));logger[_0x398d('0xd')](_0x398d('0xe'),_0x4ba1a3,_0x398d('0xc'),JSON[_0x398d('0xf')](_0x3a1934));if(_0x3a1934['error']){if(_0x3a1934[_0x398d('0x10')][_0x398d('0x11')]===0x1f4){logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);return _0x399598(_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);}logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')]['message']);return _0x3029f3(_0x3a1934['error'][_0x398d('0x12')]);}else{logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));_0x3029f3(_0x3a1934[_0x398d('0x13')][_0x398d('0x12')]);}})[_0x398d('0x14')](function(_0x3c151a){logger['error'](_0x398d('0xb'),_0x4ba1a3,_0x3c151a);_0x399598(_0x3c151a);});});}exports['GetCampaign']=function(_0x673840){var _0x476c36=this;return new Promise(function(_0x297768,_0x5de1be){return db['Campaign']['findAll']({'raw':_0x673840[_0x398d('0x15')]?_0x673840[_0x398d('0x15')][_0x398d('0x16')]===undefined?!![]:![]:!![],'where':_0x673840[_0x398d('0x15')]?_0x673840[_0x398d('0x15')][_0x398d('0x17')]||null:null,'attributes':_0x673840[_0x398d('0x15')]?_0x673840['options']['attributes']||null:null,'limit':_0x673840['options']?_0x673840[_0x398d('0x15')][_0x398d('0x18')]||null:null,'include':_0x673840[_0x398d('0x15')]?_0x673840[_0x398d('0x15')][_0x398d('0x19')]?_['map'](_0x673840['options'][_0x398d('0x19')],function(_0x497ad1){return{'model':db[_0x497ad1['model']],'as':_0x497ad1['as'],'attributes':_0x497ad1[_0x398d('0x1a')],'include':_0x497ad1[_0x398d('0x19')]?_['map'](_0x497ad1['include'],function(_0x4aad76){return{'model':db[_0x4aad76[_0x398d('0x1b')]],'as':_0x4aad76['as'],'attributes':_0x4aad76[_0x398d('0x1a')],'include':_0x4aad76[_0x398d('0x19')]?_[_0x398d('0x1c')](_0x4aad76[_0x398d('0x19')],function(_0xd614bf){return{'model':db[_0xd614bf[_0x398d('0x1b')]],'as':_0xd614bf['as'],'attributes':_0xd614bf[_0x398d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35bd19){logger['info']('GetCampaign',_0x673840);logger[_0x398d('0xd')](_0x398d('0x1d'),_0x673840,JSON['stringify'](_0x35bd19));_0x297768(_0x35bd19);})[_0x398d('0x14')](function(_0x558249){logger[_0x398d('0x10')](_0x398d('0x1d'),_0x558249['message'],_0x673840);_0x5de1be(_0x476c36['error'](0x1f4,_0x558249[_0x398d('0x12')]));});});}; \ No newline at end of file +var _0x9ef8=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','model','map','debug','lodash'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9ef8,0x17f));var _0x89ef=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x9ef8[_0x2b91c5];return _0xbd5531;};'use strict';var _=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var moment=require('moment');var BPromise=require(_0x89ef('0x2'));var rs=require(_0x89ef('0x3'));var fs=require('fs');var Redis=require(_0x89ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ef('0x5'));var logger=require(_0x89ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x89ef('0x7')][_0x89ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24439e,_0x90b5bf,_0x46c0da){return new BPromise(function(_0x373288,_0x16e8c3){return client[_0x89ef('0x9')](_0x24439e,_0x46c0da)[_0x89ef('0xa')](function(_0x5683b6){logger[_0x89ef('0xb')](_0x89ef('0xc'),_0x90b5bf,_0x89ef('0xd'));logger['debug'](_0x89ef('0xe'),_0x90b5bf,_0x89ef('0xd'),JSON[_0x89ef('0xf')](_0x5683b6));if(_0x5683b6[_0x89ef('0x10')]){if(_0x5683b6[_0x89ef('0x10')]['code']===0x1f4){logger[_0x89ef('0x10')]('Campaign,\x20%s,\x20%s',_0x90b5bf,_0x5683b6[_0x89ef('0x10')][_0x89ef('0x11')]);return _0x16e8c3(_0x5683b6['error'][_0x89ef('0x11')]);}logger[_0x89ef('0x10')](_0x89ef('0xc'),_0x90b5bf,_0x5683b6[_0x89ef('0x10')][_0x89ef('0x11')]);return _0x373288(_0x5683b6['error'][_0x89ef('0x11')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x90b5bf,_0x89ef('0xd'));_0x373288(_0x5683b6[_0x89ef('0x12')]['message']);}})[_0x89ef('0x13')](function(_0x490877){logger[_0x89ef('0x10')]('Campaign,\x20%s,\x20%s',_0x90b5bf,_0x490877);_0x16e8c3(_0x490877);});});}exports[_0x89ef('0x14')]=function(_0x2c5f51){var _0x2aa140=this;return new Promise(function(_0x1189d7,_0x5e3aed){return db[_0x89ef('0x15')][_0x89ef('0x16')]({'raw':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x18')]===undefined?!![]:![]:!![],'where':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x19')]||null:null,'attributes':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x1a')]||null:null,'limit':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x1b')]||null:null,'include':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x1c')]?_['map'](_0x2c5f51['options']['include'],function(_0x5c9242){return{'model':db[_0x5c9242[_0x89ef('0x1d')]],'as':_0x5c9242['as'],'attributes':_0x5c9242[_0x89ef('0x1a')],'include':_0x5c9242['include']?_['map'](_0x5c9242[_0x89ef('0x1c')],function(_0x10bb22){return{'model':db[_0x10bb22['model']],'as':_0x10bb22['as'],'attributes':_0x10bb22['attributes'],'include':_0x10bb22[_0x89ef('0x1c')]?_[_0x89ef('0x1e')](_0x10bb22[_0x89ef('0x1c')],function(_0x3efb34){return{'model':db[_0x3efb34[_0x89ef('0x1d')]],'as':_0x3efb34['as'],'attributes':_0x3efb34[_0x89ef('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x89ef('0xa')](function(_0x5e8108){logger[_0x89ef('0xb')](_0x89ef('0x14'),_0x2c5f51);logger[_0x89ef('0x1f')](_0x89ef('0x14'),_0x2c5f51,JSON['stringify'](_0x5e8108));_0x1189d7(_0x5e8108);})['catch'](function(_0x51245a){logger[_0x89ef('0x10')](_0x89ef('0x14'),_0x51245a['message'],_0x2c5f51);_0x5e3aed(_0x2aa140[_0x89ef('0x10')](0x1f4,_0x51245a[_0x89ef('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 659c742..ca23f10 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 _0x75e0=['/:id/blacklists','getBlackLists','create','/:id/clone','clone','post','addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists'];(function(_0xd585d9,_0x3d8a7a){var _0x572a2c=function(_0x1c0186){while(--_0x1c0186){_0xd585d9['push'](_0xd585d9['shift']());}};_0x572a2c(++_0x3d8a7a);}(_0x75e0,0x1c8));var _0x075e=function(_0x1c9910,_0x5b9a20){_0x1c9910=_0x1c9910-0x0;var _0x3044fd=_0x75e0[_0x1c9910];return _0x3044fd;};'use strict';var multer=require(_0x075e('0x0'));var util=require(_0x075e('0x1'));var path=require(_0x075e('0x2'));var timeout=require('connect-timeout');var express=require(_0x075e('0x3'));var router=express[_0x075e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x075e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x075e('0x6'));var controller=require(_0x075e('0x7'));router[_0x075e('0x8')]('/',auth[_0x075e('0x9')](),controller[_0x075e('0xa')]);router[_0x075e('0x8')](_0x075e('0xb'),auth[_0x075e('0x9')](),controller[_0x075e('0xc')]);router[_0x075e('0x8')](_0x075e('0xd'),auth[_0x075e('0x9')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x075e('0x9')](),controller[_0x075e('0xe')]);router[_0x075e('0x8')](_0x075e('0xf'),auth['isAuthenticated'](),controller[_0x075e('0x10')]);router[_0x075e('0x8')](_0x075e('0x11'),auth['isAuthenticated'](),controller[_0x075e('0x12')]);router[_0x075e('0x8')](_0x075e('0x13'),auth[_0x075e('0x9')](),controller['getLists']);router[_0x075e('0x8')](_0x075e('0x14'),auth[_0x075e('0x9')](),controller[_0x075e('0x15')]);router['post']('/',auth[_0x075e('0x9')](),controller[_0x075e('0x16')]);router['post'](_0x075e('0x17'),auth[_0x075e('0x9')](),controller[_0x075e('0x18')]);router[_0x075e('0x19')](_0x075e('0x13'),auth['isAuthenticated'](),controller[_0x075e('0x1a')]);router[_0x075e('0x19')](_0x075e('0x14'),auth[_0x075e('0x9')](),controller[_0x075e('0x1b')]);router[_0x075e('0x1c')](_0x075e('0xb'),auth[_0x075e('0x9')](),controller['update']);router[_0x075e('0x1d')](_0x075e('0xb'),auth[_0x075e('0x9')](),controller[_0x075e('0x1e')]);router[_0x075e('0x1d')](_0x075e('0x13'),auth[_0x075e('0x9')](),controller[_0x075e('0x1f')]);router['delete'](_0x075e('0x14'),auth[_0x075e('0x9')](),controller[_0x075e('0x20')]);module[_0x075e('0x21')]=router; \ No newline at end of file +var _0x4092=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_black','/:id/lists','/:id/blacklists','create','post','/:id/clone','clone','addBlackLists','put','delete','removeBlackLists','exports','util','path','connect-timeout','express'];(function(_0x53b611,_0x2912fa){var _0x5649aa=function(_0x18b222){while(--_0x18b222){_0x53b611['push'](_0x53b611['shift']());}};_0x5649aa(++_0x2912fa);}(_0x4092,0x1af));var _0x2409=function(_0xea4f3a,_0x46d2e6){_0xea4f3a=_0xea4f3a-0x0;var _0x88e3dd=_0x4092[_0xea4f3a];return _0x88e3dd;};'use strict';var multer=require('multer');var util=require(_0x2409('0x0'));var path=require(_0x2409('0x1'));var timeout=require(_0x2409('0x2'));var express=require(_0x2409('0x3'));var router=express[_0x2409('0x4')]();var fs_extra=require(_0x2409('0x5'));var auth=require(_0x2409('0x6'));var interaction=require(_0x2409('0x7'));var config=require(_0x2409('0x8'));var controller=require('./campaign.controller');router[_0x2409('0x9')]('/',auth[_0x2409('0xa')](),controller[_0x2409('0xb')]);router['get'](_0x2409('0xc'),auth[_0x2409('0xa')](),controller[_0x2409('0xd')]);router[_0x2409('0x9')](_0x2409('0xe'),auth[_0x2409('0xa')](),controller[_0x2409('0xf')]);router['get']('/:id/hopper_histories',auth[_0x2409('0xa')](),controller[_0x2409('0x10')]);router['get']('/:id/hopper_finals',auth[_0x2409('0xa')](),controller['getHopperFinals']);router[_0x2409('0x9')](_0x2409('0x11'),auth[_0x2409('0xa')](),controller['getHopperBlacks']);router['get'](_0x2409('0x12'),auth[_0x2409('0xa')](),controller['getLists']);router['get'](_0x2409('0x13'),auth[_0x2409('0xa')](),controller['getBlackLists']);router['post']('/',auth['isAuthenticated'](),controller[_0x2409('0x14')]);router[_0x2409('0x15')](_0x2409('0x16'),auth[_0x2409('0xa')](),controller[_0x2409('0x17')]);router[_0x2409('0x15')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0x2409('0x15')](_0x2409('0x13'),auth[_0x2409('0xa')](),controller[_0x2409('0x18')]);router[_0x2409('0x19')](_0x2409('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x2409('0x1a')](_0x2409('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x2409('0x1a')](_0x2409('0x12'),auth['isAuthenticated'](),controller['removeLists']);router[_0x2409('0x1a')](_0x2409('0x13'),auth[_0x2409('0xa')](),controller[_0x2409('0x1b')]);module[_0x2409('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3296301..0a21017 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 _0xdc4e=['getDataValue','key','exports','STRING','TEXT','VIRTUAL'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0xdc4e,0x7a));var _0xedc4=function(_0x44a931,_0x206cb7){_0x44a931=_0x44a931-0x0;var _0x2e7409=_0xdc4e[_0x44a931];return _0x2e7409;};'use strict';var Sequelize=require('sequelize');module[_0xedc4('0x0')]={'key':{'type':Sequelize[_0xedc4('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xedc4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xedc4('0x1')]},'name':{'type':Sequelize[_0xedc4('0x3')],'get':function(){return this[_0xedc4('0x4')](_0xedc4('0x5'));}}}; \ No newline at end of file +var _0x51a8=['exports','STRING','getDataValue','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x51a8,0x1db));var _0x851a=function(_0x424c67,_0x2fd19b){_0x424c67=_0x424c67-0x0;var _0x509b9a=_0x51a8[_0x424c67];return _0x509b9a;};'use strict';var Sequelize=require(_0x851a('0x0'));module[_0x851a('0x1')]={'key':{'type':Sequelize[_0x851a('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x851a('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 7184560..7546936 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 _0x8f35=['sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','length','include','update','body','find','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','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','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../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','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8f35,0x176));var _0x58f3=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x8f35[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58f3('0x0'));var zipdir=require(_0x58f3('0x1'));var jsonpatch=require(_0x58f3('0x2'));var rp=require(_0x58f3('0x3'));var moment=require(_0x58f3('0x4'));var BPromise=require(_0x58f3('0x5'));var Mustache=require(_0x58f3('0x6'));var util=require('util');var path=require(_0x58f3('0x7'));var sox=require(_0x58f3('0x8'));var csv=require(_0x58f3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58f3('0xa'));var _=require(_0x58f3('0xb'));var squel=require(_0x58f3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x58f3('0xd'));var toCsv=require(_0x58f3('0x9'));var querystring=require(_0x58f3('0xe'));var Papa=require(_0x58f3('0xf'));var Redis=require('ioredis');var authService=require(_0x58f3('0x10'));var qs=require(_0x58f3('0x11'));var as=require(_0x58f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x58f3('0x13'))(_0x58f3('0x14'));var utils=require(_0x58f3('0x15'));var config=require(_0x58f3('0x16'));var licenseUtil=require(_0x58f3('0x17'));var db=require(_0x58f3('0x18'))['db'];function respondWithStatusCode(_0x281fef,_0x1abce4){_0x1abce4=_0x1abce4||0xcc;return function(_0x2cf6ea){if(_0x2cf6ea){return _0x281fef[_0x58f3('0x19')](_0x1abce4);}return _0x281fef[_0x58f3('0x1a')](_0x1abce4)[_0x58f3('0x1b')]();};}function respondWithResult(_0x4cfe21,_0x376eec){_0x376eec=_0x376eec||0xc8;return function(_0x64d706){if(_0x64d706){return _0x4cfe21[_0x58f3('0x1a')](_0x376eec)[_0x58f3('0x1c')](_0x64d706);}};}function respondWithFilteredResult(_0x18c2c8,_0x3c0824){return function(_0x5dc635){if(_0x5dc635){var _0x4f4348=typeof _0x3c0824[_0x58f3('0x1d')]===_0x58f3('0x1e')&&typeof _0x3c0824[_0x58f3('0x1f')]===_0x58f3('0x1e');var _0x3e8bed=_0x5dc635['count'];var _0x197fc7=_0x4f4348?0x0:_0x3c0824[_0x58f3('0x1d')];var _0x506bde=_0x4f4348?_0x5dc635[_0x58f3('0x20')]:_0x3c0824[_0x58f3('0x1d')]+_0x3c0824[_0x58f3('0x1f')];var _0x248a7c;if(_0x506bde>=_0x3e8bed){_0x506bde=_0x3e8bed;_0x248a7c=0xc8;}else{_0x248a7c=0xce;}_0x18c2c8[_0x58f3('0x1a')](_0x248a7c);return _0x18c2c8[_0x58f3('0x21')](_0x58f3('0x22'),_0x197fc7+'-'+_0x506bde+'/'+_0x3e8bed)[_0x58f3('0x1c')](_0x5dc635);}return null;};}function patchUpdates(_0x2c4a4b){return function(_0x229ebb){try{jsonpatch[_0x58f3('0x23')](_0x229ebb,_0x2c4a4b,!![]);}catch(_0x5f01d9){return BPromise[_0x58f3('0x24')](_0x5f01d9);}return _0x229ebb[_0x58f3('0x25')]();};}function saveUpdates(_0x280770,_0x1cdd60){return function(_0x27496f){if(_0x27496f){return _0x27496f['update'](_0x280770)[_0x58f3('0x26')](function(_0x15f395){return _0x15f395;});}return null;};}function removeEntity(_0x2ebfc0,_0x2d8682){return function(_0x2f1693){if(_0x2f1693){return _0x2f1693[_0x58f3('0x27')]()[_0x58f3('0x26')](function(){var _0x375d8e=_0x2f1693[_0x58f3('0x28')]({'plain':!![]});var _0x2eea8b=_0x58f3('0x29');return db[_0x58f3('0x2a')]['destroy']({'where':{'type':_0x2eea8b,'resourceId':_0x375d8e['id']}})[_0x58f3('0x26')](function(){return _0x2f1693;});})['then'](function(){_0x2ebfc0[_0x58f3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x345add,_0xcc8a5f){return function(_0x351e81){if(!_0x351e81){_0x345add[_0x58f3('0x19')](0x194);}return _0x351e81;};}function handleError(_0x56b2e0,_0x56ad18){_0x56ad18=_0x56ad18||0x1f4;return function(_0x5c7b84){logger['error'](_0x5c7b84['stack']);if(_0x5c7b84['name']){delete _0x5c7b84[_0x58f3('0x2b')];}_0x56b2e0[_0x58f3('0x1a')](_0x56ad18)[_0x58f3('0x2c')](_0x5c7b84);};}exports[_0x58f3('0x2d')]=function(_0x2dc2ec,_0x160193){var _0x88fe3b={},_0x293cec={},_0x170cf1={'count':0x0,'rows':[]};var _0x43e264=_[_0x58f3('0x2e')](db[_0x58f3('0x2f')]['rawAttributes'],function(_0x2bbd3){return{'name':_0x2bbd3[_0x58f3('0x30')],'type':_0x2bbd3[_0x58f3('0x31')][_0x58f3('0x32')]};});_0x293cec[_0x58f3('0x33')]=_[_0x58f3('0x2e')](_0x43e264,_0x58f3('0x2b'));_0x293cec[_0x58f3('0x34')]=_[_0x58f3('0x35')](_0x2dc2ec[_0x58f3('0x34')]);_0x293cec[_0x58f3('0x36')]=_[_0x58f3('0x37')](_0x293cec[_0x58f3('0x33')],_0x293cec[_0x58f3('0x34')]);_0x88fe3b[_0x58f3('0x38')]=_[_0x58f3('0x37')](_0x293cec['model'],qs[_0x58f3('0x39')](_0x2dc2ec[_0x58f3('0x34')][_0x58f3('0x39')]));_0x88fe3b[_0x58f3('0x38')]=_0x88fe3b[_0x58f3('0x38')]['length']?_0x88fe3b[_0x58f3('0x38')]:_0x293cec[_0x58f3('0x33')];if(!_0x2dc2ec[_0x58f3('0x34')][_0x58f3('0x3a')](_0x58f3('0x3b'))){_0x88fe3b['limit']=qs[_0x58f3('0x1f')](_0x2dc2ec[_0x58f3('0x34')][_0x58f3('0x1f')]);_0x88fe3b[_0x58f3('0x1d')]=qs[_0x58f3('0x1d')](_0x2dc2ec['query']['offset']);}_0x88fe3b[_0x58f3('0x3c')]=qs['sort'](_0x2dc2ec['query'][_0x58f3('0x3d')]);_0x88fe3b[_0x58f3('0x3e')]=qs[_0x58f3('0x36')](_[_0x58f3('0x3f')](_0x2dc2ec[_0x58f3('0x34')],_0x293cec['filters']),_0x43e264);if(_0x2dc2ec[_0x58f3('0x34')][_0x58f3('0x40')]){_0x88fe3b[_0x58f3('0x3e')]=_[_0x58f3('0x41')](_0x88fe3b[_0x58f3('0x3e')],{'$or':[{'key':{'$like':'%'+_0x2dc2ec[_0x58f3('0x34')][_0x58f3('0x40')]+'%'}},{'value':{'$like':'%'+_0x2dc2ec[_0x58f3('0x34')][_0x58f3('0x40')]+'%'}}]});}_0x88fe3b=_['merge']({},_0x88fe3b,_0x2dc2ec[_0x58f3('0x42')]);var _0x52ab4f={'where':_0x88fe3b[_0x58f3('0x3e')]};return db[_0x58f3('0x2f')][_0x58f3('0x20')](_0x52ab4f)[_0x58f3('0x26')](function(_0x189429){_0x170cf1[_0x58f3('0x20')]=_0x189429;if(_0x2dc2ec['query'][_0x58f3('0x43')]){_0x88fe3b['include']=[{'all':!![]}];}return db[_0x58f3('0x2f')][_0x58f3('0x44')](_0x88fe3b);})[_0x58f3('0x26')](function(_0xf50142){_0x170cf1[_0x58f3('0x45')]=_0xf50142;return _0x170cf1;})[_0x58f3('0x26')](respondWithFilteredResult(_0x160193,_0x88fe3b))['catch'](handleError(_0x160193,null));};exports[_0x58f3('0x46')]=function(_0x3f2650,_0x22314f){var _0x38ad4d={'raw':!![],'where':{'id':_0x3f2650['params']['id']}},_0x52093b={};_0x52093b['model']=_[_0x58f3('0x35')](db[_0x58f3('0x2f')]['rawAttributes']);_0x52093b['query']=_[_0x58f3('0x35')](_0x3f2650['query']);_0x52093b['filters']=_[_0x58f3('0x37')](_0x52093b[_0x58f3('0x33')],_0x52093b[_0x58f3('0x34')]);_0x38ad4d['attributes']=_[_0x58f3('0x37')](_0x52093b['model'],qs[_0x58f3('0x39')](_0x3f2650[_0x58f3('0x34')][_0x58f3('0x39')]));_0x38ad4d[_0x58f3('0x38')]=_0x38ad4d[_0x58f3('0x38')][_0x58f3('0x47')]?_0x38ad4d[_0x58f3('0x38')]:_0x52093b[_0x58f3('0x33')];if(_0x3f2650['query'][_0x58f3('0x43')]){_0x38ad4d[_0x58f3('0x48')]=[{'all':!![]}];}_0x38ad4d=_[_0x58f3('0x41')]({},_0x38ad4d,_0x3f2650[_0x58f3('0x42')]);return db[_0x58f3('0x2f')]['find'](_0x38ad4d)[_0x58f3('0x26')](handleEntityNotFound(_0x22314f,null))[_0x58f3('0x26')](respondWithResult(_0x22314f,null))['catch'](handleError(_0x22314f,null));};exports[_0x58f3('0x49')]=function(_0xa2922d,_0x27b02b){if(_0xa2922d[_0x58f3('0x4a')]['id']){delete _0xa2922d[_0x58f3('0x4a')]['id'];}return db[_0x58f3('0x2f')][_0x58f3('0x4b')]({'where':{'id':_0xa2922d['params']['id']}})['then'](handleEntityNotFound(_0x27b02b,null))[_0x58f3('0x26')](saveUpdates(_0xa2922d[_0x58f3('0x4a')],null))[_0x58f3('0x26')](respondWithResult(_0x27b02b,null))['catch'](handleError(_0x27b02b,null));};exports['destroy']=function(_0x58ba17,_0x31ad39){return db[_0x58f3('0x2f')]['find']({'where':{'id':_0x58ba17['params']['id']}})[_0x58f3('0x26')](handleEntityNotFound(_0x31ad39,null))[_0x58f3('0x26')](removeEntity(_0x31ad39,null))[_0x58f3('0x4c')](handleError(_0x31ad39,null));};exports[_0x58f3('0x4d')]=function(_0x443af1,_0x221fc9){var _0x3e5e29={'key':_0x443af1[_0x58f3('0x4a')]['key']};if(_0x443af1['body'][_0x58f3('0x4e')]){_0x3e5e29[_0x58f3('0x4e')]=_0x443af1['body'][_0x58f3('0x4e')];}else if(_0x443af1[_0x58f3('0x4a')][_0x58f3('0x4f')]){_0x3e5e29[_0x58f3('0x4f')]=_0x443af1[_0x58f3('0x4a')][_0x58f3('0x4f')];}else if(_0x443af1[_0x58f3('0x4a')][_0x58f3('0x50')]){_0x3e5e29[_0x58f3('0x50')]=_0x443af1[_0x58f3('0x4a')][_0x58f3('0x50')];}else if(_0x443af1['body'][_0x58f3('0x51')]){_0x3e5e29['ChatWebsiteId']=_0x443af1[_0x58f3('0x4a')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x3e5e29})[_0x58f3('0x26')](function(_0x5a522a){if(_0x5a522a){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x58f3('0x2f')][_0x58f3('0x4d')](_0x443af1['body']);})[_0x58f3('0x26')](function(_0x2f0188){var _0x255f2f=_0x443af1[_0x58f3('0x52')][_0x58f3('0x28')]({'plain':!![]});if(!_0x255f2f)throw new Error(_0x58f3('0x53'));if(_0x255f2f[_0x58f3('0x54')]===_0x58f3('0x52')){var _0x4fd84c=_0x2f0188[_0x58f3('0x28')]({'plain':!![]});return db[_0x58f3('0x55')][_0x58f3('0x4b')]({'where':{'name':'CannedAnswers','userProfileId':_0x255f2f['userProfileId']},'raw':!![]})[_0x58f3('0x26')](function(_0x29939c){if(_0x29939c&&_0x29939c['autoAssociation']===0x0){return db[_0x58f3('0x2a')][_0x58f3('0x4d')]({'name':_0x4fd84c[_0x58f3('0x2b')],'resourceId':_0x4fd84c['id'],'type':_0x29939c[_0x58f3('0x2b')],'sectionId':_0x29939c['id']},{})[_0x58f3('0x26')](function(){return _0x2f0188;});}else{return _0x2f0188;}})[_0x58f3('0x4c')](function(_0x3dc937){logger['error'](_0x58f3('0x56'),_0x3dc937);throw _0x3dc937;});}return _0x2f0188;})[_0x58f3('0x26')](respondWithResult(_0x221fc9,0xc9))[_0x58f3('0x4c')](handleError(_0x221fc9,null));}; \ No newline at end of file +var _0xdc77=['sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','send','index','CannedAnswer','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','include','findAll','catch','show','params','includeAll','options','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdc77,0xed));var _0x7dc7=function(_0x278495,_0x264281){_0x278495=_0x278495-0x0;var _0x229a4a=_0xdc77[_0x278495];return _0x229a4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7dc7('0x0'));var zipdir=require(_0x7dc7('0x1'));var jsonpatch=require(_0x7dc7('0x2'));var rp=require('request-promise');var moment=require(_0x7dc7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7dc7('0x4'));var path=require(_0x7dc7('0x5'));var sox=require(_0x7dc7('0x6'));var csv=require('to-csv');var ejs=require(_0x7dc7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7dc7('0x8'));var crypto=require('crypto');var jsforce=require(_0x7dc7('0x9'));var deskjs=require(_0x7dc7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7dc7('0xb'));var Papa=require('papaparse');var Redis=require(_0x7dc7('0xc'));var authService=require(_0x7dc7('0xd'));var qs=require(_0x7dc7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7dc7('0xf'));var logger=require(_0x7dc7('0x10'))(_0x7dc7('0x11'));var utils=require('../../config/utils');var config=require(_0x7dc7('0x12'));var licenseUtil=require(_0x7dc7('0x13'));var db=require(_0x7dc7('0x14'))['db'];function respondWithStatusCode(_0x2d758d,_0x404fb){_0x404fb=_0x404fb||0xcc;return function(_0x984aa5){if(_0x984aa5){return _0x2d758d[_0x7dc7('0x15')](_0x404fb);}return _0x2d758d['status'](_0x404fb)['end']();};}function respondWithResult(_0x235261,_0x305b82){_0x305b82=_0x305b82||0xc8;return function(_0xa5688e){if(_0xa5688e){return _0x235261[_0x7dc7('0x16')](_0x305b82)[_0x7dc7('0x17')](_0xa5688e);}};}function respondWithFilteredResult(_0x1b0831,_0x2fe5d2){return function(_0x59c3b4){if(_0x59c3b4){var _0x261cfa=typeof _0x2fe5d2['offset']==='undefined'&&typeof _0x2fe5d2[_0x7dc7('0x18')]===_0x7dc7('0x19');var _0x16c4dc=_0x59c3b4['count'];var _0x473a03=_0x261cfa?0x0:_0x2fe5d2[_0x7dc7('0x1a')];var _0x2972e6=_0x261cfa?_0x59c3b4[_0x7dc7('0x1b')]:_0x2fe5d2[_0x7dc7('0x1a')]+_0x2fe5d2[_0x7dc7('0x18')];var _0x14e49a;if(_0x2972e6>=_0x16c4dc){_0x2972e6=_0x16c4dc;_0x14e49a=0xc8;}else{_0x14e49a=0xce;}_0x1b0831[_0x7dc7('0x16')](_0x14e49a);return _0x1b0831[_0x7dc7('0x1c')](_0x7dc7('0x1d'),_0x473a03+'-'+_0x2972e6+'/'+_0x16c4dc)[_0x7dc7('0x17')](_0x59c3b4);}return null;};}function patchUpdates(_0xdecb31){return function(_0x4881f4){try{jsonpatch[_0x7dc7('0x1e')](_0x4881f4,_0xdecb31,!![]);}catch(_0x5705cb){return BPromise[_0x7dc7('0x1f')](_0x5705cb);}return _0x4881f4[_0x7dc7('0x20')]();};}function saveUpdates(_0x26f99d,_0x53f2f5){return function(_0x4616bf){if(_0x4616bf){return _0x4616bf['update'](_0x26f99d)[_0x7dc7('0x21')](function(_0x1c0627){return _0x1c0627;});}return null;};}function removeEntity(_0x20333d,_0x19628b){return function(_0xbbdcc3){if(_0xbbdcc3){return _0xbbdcc3[_0x7dc7('0x22')]()[_0x7dc7('0x21')](function(){var _0xfff274=_0xbbdcc3[_0x7dc7('0x23')]({'plain':!![]});var _0x123a36=_0x7dc7('0x24');return db[_0x7dc7('0x25')][_0x7dc7('0x22')]({'where':{'type':_0x123a36,'resourceId':_0xfff274['id']}})[_0x7dc7('0x21')](function(){return _0xbbdcc3;});})[_0x7dc7('0x21')](function(){_0x20333d[_0x7dc7('0x16')](0xcc)[_0x7dc7('0x26')]();});}};}function handleEntityNotFound(_0xd3c24b,_0x3b511d){return function(_0x423a23){if(!_0x423a23){_0xd3c24b[_0x7dc7('0x15')](0x194);}return _0x423a23;};}function handleError(_0x2c5983,_0x38b7c2){_0x38b7c2=_0x38b7c2||0x1f4;return function(_0x3144f1){logger[_0x7dc7('0x27')](_0x3144f1[_0x7dc7('0x28')]);if(_0x3144f1['name']){delete _0x3144f1['name'];}_0x2c5983['status'](_0x38b7c2)[_0x7dc7('0x29')](_0x3144f1);};}exports[_0x7dc7('0x2a')]=function(_0x3ba0e0,_0xfbd198){var _0x2974c4={},_0x715c31={},_0x54de13={'count':0x0,'rows':[]};var _0x344aa5=_['map'](db[_0x7dc7('0x2b')][_0x7dc7('0x2c')],function(_0x1e5431){return{'name':_0x1e5431['fieldName'],'type':_0x1e5431[_0x7dc7('0x2d')][_0x7dc7('0x2e')]};});_0x715c31[_0x7dc7('0x2f')]=_[_0x7dc7('0x30')](_0x344aa5,'name');_0x715c31[_0x7dc7('0x31')]=_[_0x7dc7('0x32')](_0x3ba0e0[_0x7dc7('0x31')]);_0x715c31[_0x7dc7('0x33')]=_[_0x7dc7('0x34')](_0x715c31[_0x7dc7('0x2f')],_0x715c31[_0x7dc7('0x31')]);_0x2974c4['attributes']=_[_0x7dc7('0x34')](_0x715c31[_0x7dc7('0x2f')],qs[_0x7dc7('0x35')](_0x3ba0e0[_0x7dc7('0x31')]['fields']));_0x2974c4[_0x7dc7('0x36')]=_0x2974c4['attributes'][_0x7dc7('0x37')]?_0x2974c4[_0x7dc7('0x36')]:_0x715c31['model'];if(!_0x3ba0e0['query'][_0x7dc7('0x38')]('nolimit')){_0x2974c4[_0x7dc7('0x18')]=qs[_0x7dc7('0x18')](_0x3ba0e0['query']['limit']);_0x2974c4[_0x7dc7('0x1a')]=qs[_0x7dc7('0x1a')](_0x3ba0e0[_0x7dc7('0x31')][_0x7dc7('0x1a')]);}_0x2974c4['order']=qs[_0x7dc7('0x39')](_0x3ba0e0['query'][_0x7dc7('0x39')]);_0x2974c4[_0x7dc7('0x3a')]=qs[_0x7dc7('0x33')](_['pick'](_0x3ba0e0[_0x7dc7('0x31')],_0x715c31['filters']),_0x344aa5);if(_0x3ba0e0[_0x7dc7('0x31')][_0x7dc7('0x3b')]){_0x2974c4['where']=_[_0x7dc7('0x3c')](_0x2974c4[_0x7dc7('0x3a')],{'$or':[{'key':{'$like':'%'+_0x3ba0e0[_0x7dc7('0x31')][_0x7dc7('0x3b')]+'%'}},{'value':{'$like':'%'+_0x3ba0e0[_0x7dc7('0x31')][_0x7dc7('0x3b')]+'%'}}]});}_0x2974c4=_[_0x7dc7('0x3c')]({},_0x2974c4,_0x3ba0e0['options']);var _0x5898bc={'where':_0x2974c4[_0x7dc7('0x3a')]};return db[_0x7dc7('0x2b')][_0x7dc7('0x1b')](_0x5898bc)['then'](function(_0x4f8687){_0x54de13['count']=_0x4f8687;if(_0x3ba0e0['query']['includeAll']){_0x2974c4[_0x7dc7('0x3d')]=[{'all':!![]}];}return db[_0x7dc7('0x2b')][_0x7dc7('0x3e')](_0x2974c4);})['then'](function(_0x1bc21c){_0x54de13['rows']=_0x1bc21c;return _0x54de13;})[_0x7dc7('0x21')](respondWithFilteredResult(_0xfbd198,_0x2974c4))[_0x7dc7('0x3f')](handleError(_0xfbd198,null));};exports[_0x7dc7('0x40')]=function(_0x252506,_0x53558b){var _0x42b503={'raw':!![],'where':{'id':_0x252506[_0x7dc7('0x41')]['id']}},_0x3dbc6b={};_0x3dbc6b[_0x7dc7('0x2f')]=_[_0x7dc7('0x32')](db['CannedAnswer']['rawAttributes']);_0x3dbc6b[_0x7dc7('0x31')]=_['keys'](_0x252506[_0x7dc7('0x31')]);_0x3dbc6b[_0x7dc7('0x33')]=_[_0x7dc7('0x34')](_0x3dbc6b['model'],_0x3dbc6b['query']);_0x42b503[_0x7dc7('0x36')]=_[_0x7dc7('0x34')](_0x3dbc6b[_0x7dc7('0x2f')],qs[_0x7dc7('0x35')](_0x252506[_0x7dc7('0x31')][_0x7dc7('0x35')]));_0x42b503[_0x7dc7('0x36')]=_0x42b503[_0x7dc7('0x36')]['length']?_0x42b503[_0x7dc7('0x36')]:_0x3dbc6b['model'];if(_0x252506['query'][_0x7dc7('0x42')]){_0x42b503[_0x7dc7('0x3d')]=[{'all':!![]}];}_0x42b503=_[_0x7dc7('0x3c')]({},_0x42b503,_0x252506[_0x7dc7('0x43')]);return db[_0x7dc7('0x2b')][_0x7dc7('0x44')](_0x42b503)[_0x7dc7('0x21')](handleEntityNotFound(_0x53558b,null))[_0x7dc7('0x21')](respondWithResult(_0x53558b,null))[_0x7dc7('0x3f')](handleError(_0x53558b,null));};exports[_0x7dc7('0x45')]=function(_0x63d4b9,_0x41721c){if(_0x63d4b9[_0x7dc7('0x46')]['id']){delete _0x63d4b9[_0x7dc7('0x46')]['id'];}return db[_0x7dc7('0x2b')][_0x7dc7('0x44')]({'where':{'id':_0x63d4b9['params']['id']}})[_0x7dc7('0x21')](handleEntityNotFound(_0x41721c,null))[_0x7dc7('0x21')](saveUpdates(_0x63d4b9[_0x7dc7('0x46')],null))[_0x7dc7('0x21')](respondWithResult(_0x41721c,null))['catch'](handleError(_0x41721c,null));};exports[_0x7dc7('0x22')]=function(_0x3c00fc,_0x2d2a06){return db[_0x7dc7('0x2b')]['find']({'where':{'id':_0x3c00fc[_0x7dc7('0x41')]['id']}})[_0x7dc7('0x21')](handleEntityNotFound(_0x2d2a06,null))[_0x7dc7('0x21')](removeEntity(_0x2d2a06,null))[_0x7dc7('0x3f')](handleError(_0x2d2a06,null));};exports[_0x7dc7('0x47')]=function(_0x17167b,_0x36ed69){var _0x24677e={'key':_0x17167b[_0x7dc7('0x46')][_0x7dc7('0x2e')]};if(_0x17167b[_0x7dc7('0x46')][_0x7dc7('0x48')]){_0x24677e[_0x7dc7('0x48')]=_0x17167b[_0x7dc7('0x46')]['MailAccountId'];}else if(_0x17167b[_0x7dc7('0x46')]['SmsAccountId']){_0x24677e[_0x7dc7('0x49')]=_0x17167b[_0x7dc7('0x46')][_0x7dc7('0x49')];}else if(_0x17167b[_0x7dc7('0x46')][_0x7dc7('0x4a')]){_0x24677e[_0x7dc7('0x4a')]=_0x17167b[_0x7dc7('0x46')][_0x7dc7('0x4a')];}else if(_0x17167b['body'][_0x7dc7('0x4b')]){_0x24677e['ChatWebsiteId']=_0x17167b['body'][_0x7dc7('0x4b')];}return db['CannedAnswer'][_0x7dc7('0x44')]({'where':_0x24677e})[_0x7dc7('0x21')](function(_0x5b9937){if(_0x5b9937){throw new db[(_0x7dc7('0x4c'))][(_0x7dc7('0x4d'))](_0x7dc7('0x4e'));}return db[_0x7dc7('0x2b')][_0x7dc7('0x47')](_0x17167b[_0x7dc7('0x46')]);})['then'](function(_0x36d043){var _0x4ef93a=_0x17167b[_0x7dc7('0x4f')][_0x7dc7('0x23')]({'plain':!![]});if(!_0x4ef93a)throw new Error(_0x7dc7('0x50'));if(_0x4ef93a[_0x7dc7('0x51')]===_0x7dc7('0x4f')){var _0x3811b0=_0x36d043[_0x7dc7('0x23')]({'plain':!![]});return db[_0x7dc7('0x52')][_0x7dc7('0x44')]({'where':{'name':_0x7dc7('0x24'),'userProfileId':_0x4ef93a[_0x7dc7('0x53')]},'raw':!![]})['then'](function(_0x3b7f63){if(_0x3b7f63&&_0x3b7f63['autoAssociation']===0x0){return db[_0x7dc7('0x25')][_0x7dc7('0x47')]({'name':_0x3811b0[_0x7dc7('0x54')],'resourceId':_0x3811b0['id'],'type':_0x3b7f63[_0x7dc7('0x54')],'sectionId':_0x3b7f63['id']},{})[_0x7dc7('0x21')](function(){return _0x36d043;});}else{return _0x36d043;}})[_0x7dc7('0x3f')](function(_0x49738b){logger[_0x7dc7('0x27')](_0x7dc7('0x55'),_0x49738b);throw _0x49738b;});}return _0x36d043;})[_0x7dc7('0x21')](respondWithResult(_0x36ed69,0xc9))[_0x7dc7('0x3f')](handleError(_0x36ed69,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 809be54..ad56356 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 _0x8e18=['moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x52c423,_0x33d7dd){var _0x29e7e3=function(_0x3378a7){while(--_0x3378a7){_0x52c423['push'](_0x52c423['shift']());}};_0x29e7e3(++_0x33d7dd);}(_0x8e18,0x1ae));var _0x88e1=function(_0x5d6e05,_0x479727){_0x5d6e05=_0x5d6e05-0x0;var _0x5d8a1f=_0x8e18[_0x5d6e05];return _0x5d8a1f;};'use strict';var _=require(_0x88e1('0x0'));var util=require(_0x88e1('0x1'));var logger=require(_0x88e1('0x2'))(_0x88e1('0x3'));var moment=require(_0x88e1('0x4'));var BPromise=require('bluebird');var rp=require(_0x88e1('0x5'));var fs=require('fs');var path=require(_0x88e1('0x6'));var rimraf=require(_0x88e1('0x7'));var config=require(_0x88e1('0x8'));var attributes=require(_0x88e1('0x9'));module[_0x88e1('0xa')]=function(_0x528360,_0x20d067){return _0x528360['define'](_0x88e1('0xb'),attributes,{'tableName':_0x88e1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x88e1('0xd')});}; \ No newline at end of file +var _0xaebe=['path','rimraf','./cannedAnswer.attributes','exports','define','tools_canned_answers','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xaebe,0xed));var _0xeaeb=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xaebe[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xeaeb('0x0'));var util=require(_0xeaeb('0x1'));var logger=require(_0xeaeb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeaeb('0x3'));var rp=require(_0xeaeb('0x4'));var fs=require('fs');var path=require(_0xeaeb('0x5'));var rimraf=require(_0xeaeb('0x6'));var config=require('../../config/environment');var attributes=require(_0xeaeb('0x7'));module[_0xeaeb('0x8')]=function(_0x2d542c,_0x1a1a6c){return _0x2d542c[_0xeaeb('0x9')]('CannedAnswer',attributes,{'tableName':_0xeaeb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 3aa6590..988bfc7 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(_0x12a121,_0x442177){var _0x54a439=function(_0x1310c5){while(--_0x1310c5){_0x12a121['push'](_0x12a121['shift']());}};_0x54a439(++_0x442177);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x18d556,_0x4c8eea){var _0x2acef1=function(_0x4ed9f4){while(--_0x4ed9f4){_0x18d556['push'](_0x18d556['shift']());}};_0x2acef1(++_0x4c8eea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 ab762e4..3d724ee 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 _0xeaed=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','put','update','delete'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0xeaed,0x146));var _0xdeae=function(_0x204fae,_0x4e8d03){_0x204fae=_0x204fae-0x0;var _0x3d0fff=_0xeaed[_0x204fae];return _0x3d0fff;};'use strict';var multer=require(_0xdeae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdeae('0x1'));var express=require(_0xdeae('0x2'));var router=express[_0xdeae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdeae('0x4'));var interaction=require(_0xdeae('0x5'));var config=require(_0xdeae('0x6'));var controller=require(_0xdeae('0x7'));router[_0xdeae('0x8')]('/',auth[_0xdeae('0x9')](),controller['index']);router['get'](_0xdeae('0xa'),auth['isAuthenticated'](),controller[_0xdeae('0xb')]);router[_0xdeae('0xc')]('/',auth[_0xdeae('0x9')](),controller['create']);router[_0xdeae('0xd')](_0xdeae('0xa'),auth[_0xdeae('0x9')](),controller[_0xdeae('0xe')]);router[_0xdeae('0xf')](_0xdeae('0xa'),auth[_0xdeae('0x9')](),controller[_0xdeae('0x10')]);module[_0xdeae('0x11')]=router; \ No newline at end of file +var _0x7894=['show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7894,0x1bf));var _0x4789=function(_0x1096f0,_0xb7c8a0){_0x1096f0=_0x1096f0-0x0;var _0x5286c8=_0x7894[_0x1096f0];return _0x5286c8;};'use strict';var multer=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var path=require(_0x4789('0x2'));var timeout=require(_0x4789('0x3'));var express=require(_0x4789('0x4'));var router=express[_0x4789('0x5')]();var fs_extra=require(_0x4789('0x6'));var auth=require(_0x4789('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4789('0x8'));var controller=require('./cannedAnswer.controller');router[_0x4789('0x9')]('/',auth[_0x4789('0xa')](),controller[_0x4789('0xb')]);router[_0x4789('0x9')](_0x4789('0xc'),auth['isAuthenticated'](),controller[_0x4789('0xd')]);router['post']('/',auth[_0x4789('0xa')](),controller[_0x4789('0xe')]);router[_0x4789('0xf')]('/:id',auth[_0x4789('0xa')](),controller[_0x4789('0x10')]);router[_0x4789('0x11')](_0x4789('0xc'),auth['isAuthenticated'](),controller[_0x4789('0x12')]);module[_0x4789('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index dee8ffb..8588f17 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 _0x81a4=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0x81a4,0x1a6));var _0x481a=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0x81a4[_0x16eb11];return _0x3ae7ef;};'use strict';var Sequelize=require(_0x481a('0x0'));module[_0x481a('0x1')]={'calldate':{'type':Sequelize[_0x481a('0x2')],'allowNull':![],'defaultValue':_0x481a('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x481a('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x481a('0x4')]},'channel':{'type':Sequelize[_0x481a('0x4')]},'dstchannel':{'type':Sequelize[_0x481a('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x481a('0x4')]},'duration':{'type':Sequelize[_0x481a('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x481a('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x481a('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x481a('0x4')]},'userfield':{'type':Sequelize[_0x481a('0x4')]},'uniqueid':{'type':Sequelize[_0x481a('0x4')]},'linkedid':{'type':Sequelize[_0x481a('0x4')]},'sequence':{'type':Sequelize[_0x481a('0x4')]},'peeraccount':{'type':Sequelize[_0x481a('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x481a('0x4')]}}; \ No newline at end of file +var _0xd8b0=['INTEGER','sequelize','exports','STRING'];(function(_0x124ff4,_0x51c1b5){var _0x2c240a=function(_0x2633e0){while(--_0x2633e0){_0x124ff4['push'](_0x124ff4['shift']());}};_0x2c240a(++_0x51c1b5);}(_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')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x0d8b('0x2')]},'dst':{'type':Sequelize[_0x0d8b('0x2')]},'dcontext':{'type':Sequelize[_0x0d8b('0x2')]},'channel':{'type':Sequelize[_0x0d8b('0x2')]},'dstchannel':{'type':Sequelize[_0x0d8b('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0d8b('0x2')]},'userfield':{'type':Sequelize[_0x0d8b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x0d8b('0x2')]},'sequence':{'type':Sequelize[_0x0d8b('0x2')]},'peeraccount':{'type':Sequelize[_0x0d8b('0x2')]},'type':{'type':Sequelize[_0x0d8b('0x2')]},'tag':{'type':Sequelize[_0x0d8b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 8554863..0f01253 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 _0x02a7=['then','destroy','end','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','undefined','count','offset','status','set','Content-Range','json','apply','reject','save','update'];(function(_0x2da1f9,_0x5e4269){var _0x22ef92=function(_0x1a152a){while(--_0x1a152a){_0x2da1f9['push'](_0x2da1f9['shift']());}};_0x22ef92(++_0x5e4269);}(_0x02a7,0x7a));var _0x702a=function(_0x3f7a8c,_0x5a0d43){_0x3f7a8c=_0x3f7a8c-0x0;var _0x52f3c8=_0x02a7[_0x3f7a8c];return _0x52f3c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x702a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x702a('0x1'));var moment=require(_0x702a('0x2'));var BPromise=require(_0x702a('0x3'));var Mustache=require(_0x702a('0x4'));var util=require(_0x702a('0x5'));var path=require(_0x702a('0x6'));var sox=require(_0x702a('0x7'));var csv=require('to-csv');var ejs=require(_0x702a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x702a('0x9'));var squel=require(_0x702a('0xa'));var crypto=require(_0x702a('0xb'));var jsforce=require(_0x702a('0xc'));var deskjs=require(_0x702a('0xd'));var toCsv=require(_0x702a('0xe'));var querystring=require(_0x702a('0xf'));var Papa=require('papaparse');var Redis=require(_0x702a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x702a('0x11'));var hardwareService=require(_0x702a('0x12'));var logger=require(_0x702a('0x13'))(_0x702a('0x14'));var utils=require('../../config/utils');var config=require(_0x702a('0x15'));var licenseUtil=require(_0x702a('0x16'));var db=require(_0x702a('0x17'))['db'];function respondWithStatusCode(_0x221b35,_0x4688d1){_0x4688d1=_0x4688d1||0xcc;return function(_0x75455){if(_0x75455){return _0x221b35[_0x702a('0x18')](_0x4688d1);}return _0x221b35['status'](_0x4688d1)['end']();};}function respondWithResult(_0x38139d,_0x57f5fc){_0x57f5fc=_0x57f5fc||0xc8;return function(_0x576cf8){if(_0x576cf8){return _0x38139d['status'](_0x57f5fc)['json'](_0x576cf8);}};}function respondWithFilteredResult(_0x5c768d,_0x44f7fd){return function(_0x3c9770){if(_0x3c9770){var _0xa124dd=typeof _0x44f7fd['offset']==='undefined'&&typeof _0x44f7fd['limit']===_0x702a('0x19');var _0x469cb2=_0x3c9770[_0x702a('0x1a')];var _0x492cfb=_0xa124dd?0x0:_0x44f7fd[_0x702a('0x1b')];var _0x5ec1b3=_0xa124dd?_0x3c9770[_0x702a('0x1a')]:_0x44f7fd[_0x702a('0x1b')]+_0x44f7fd['limit'];var _0x4f8b29;if(_0x5ec1b3>=_0x469cb2){_0x5ec1b3=_0x469cb2;_0x4f8b29=0xc8;}else{_0x4f8b29=0xce;}_0x5c768d[_0x702a('0x1c')](_0x4f8b29);return _0x5c768d[_0x702a('0x1d')](_0x702a('0x1e'),_0x492cfb+'-'+_0x5ec1b3+'/'+_0x469cb2)[_0x702a('0x1f')](_0x3c9770);}return null;};}function patchUpdates(_0x332254){return function(_0x3152bf){try{jsonpatch[_0x702a('0x20')](_0x3152bf,_0x332254,!![]);}catch(_0x3a4add){return BPromise[_0x702a('0x21')](_0x3a4add);}return _0x3152bf[_0x702a('0x22')]();};}function saveUpdates(_0x47d0f5,_0x1ecd28){return function(_0x3d213c){if(_0x3d213c){return _0x3d213c[_0x702a('0x23')](_0x47d0f5)[_0x702a('0x24')](function(_0x1d6dae){return _0x1d6dae;});}return null;};}function removeEntity(_0x466b74,_0x2aede0){return function(_0x156212){if(_0x156212){return _0x156212[_0x702a('0x25')]()['then'](function(){_0x466b74[_0x702a('0x1c')](0xcc)[_0x702a('0x26')]();});}};}function handleEntityNotFound(_0x57add6,_0xf08699){return function(_0x1a9fbf){if(!_0x1a9fbf){_0x57add6[_0x702a('0x18')](0x194);}return _0x1a9fbf;};}function handleError(_0xf6b463,_0x3d4ed0){_0x3d4ed0=_0x3d4ed0||0x1f4;return function(_0x2eff20){logger['error'](_0x2eff20[_0x702a('0x27')]);if(_0x2eff20[_0x702a('0x28')]){delete _0x2eff20['name'];}_0xf6b463[_0x702a('0x1c')](_0x3d4ed0)[_0x702a('0x29')](_0x2eff20);};}exports[_0x702a('0x2a')]=function(_0x21ba99,_0x1973c7){var _0xa0877a={},_0x1596a8={},_0x5c6da4={'count':0x0,'rows':[]};var _0x2d7044=_[_0x702a('0x2b')](db[_0x702a('0x2c')][_0x702a('0x2d')],function(_0x511e7e){return{'name':_0x511e7e[_0x702a('0x2e')],'type':_0x511e7e['type'][_0x702a('0x2f')]};});_0x1596a8[_0x702a('0x30')]=_['map'](_0x2d7044,'name');_0x1596a8[_0x702a('0x31')]=_[_0x702a('0x32')](_0x21ba99['query']);_0x1596a8[_0x702a('0x33')]=_['intersection'](_0x1596a8['model'],_0x1596a8[_0x702a('0x31')]);_0xa0877a[_0x702a('0x34')]=_[_0x702a('0x35')](_0x1596a8['model'],qs[_0x702a('0x36')](_0x21ba99[_0x702a('0x31')][_0x702a('0x36')]));_0xa0877a[_0x702a('0x34')]=_0xa0877a[_0x702a('0x34')][_0x702a('0x37')]?_0xa0877a[_0x702a('0x34')]:_0x1596a8[_0x702a('0x30')];if(!_0x21ba99[_0x702a('0x31')][_0x702a('0x38')](_0x702a('0x39'))){_0xa0877a[_0x702a('0x3a')]=qs[_0x702a('0x3a')](_0x21ba99[_0x702a('0x31')][_0x702a('0x3a')]);_0xa0877a[_0x702a('0x1b')]=qs[_0x702a('0x1b')](_0x21ba99[_0x702a('0x31')]['offset']);}_0xa0877a[_0x702a('0x3b')]=qs[_0x702a('0x3c')](_0x21ba99[_0x702a('0x31')][_0x702a('0x3c')]);_0xa0877a[_0x702a('0x3d')]=qs[_0x702a('0x33')](_[_0x702a('0x3e')](_0x21ba99[_0x702a('0x31')],_0x1596a8['filters']),_0x2d7044);if(_0x21ba99[_0x702a('0x31')][_0x702a('0x3f')]){_0xa0877a[_0x702a('0x3d')]=_[_0x702a('0x40')](_0xa0877a[_0x702a('0x3d')],{'$or':_[_0x702a('0x2b')](_0x2d7044,function(_0x3bc107){if(_0x3bc107[_0x702a('0x41')]!==_0x702a('0x42')){var _0x10fee4={};_0x10fee4[_0x3bc107[_0x702a('0x28')]]={'$like':'%'+_0x21ba99[_0x702a('0x31')][_0x702a('0x3f')]+'%'};return _0x10fee4;}})});}_0xa0877a=_[_0x702a('0x40')]({},_0xa0877a,_0x21ba99['options']);var _0x252b54={'where':_0xa0877a[_0x702a('0x3d')]};return db[_0x702a('0x2c')]['count'](_0x252b54)[_0x702a('0x24')](function(_0x202425){_0x5c6da4[_0x702a('0x1a')]=_0x202425;if(_0x21ba99[_0x702a('0x31')][_0x702a('0x43')]){_0xa0877a[_0x702a('0x44')]=[{'all':!![]}];}return db['Cdr'][_0x702a('0x45')](_0xa0877a);})[_0x702a('0x24')](function(_0x34a26f){_0x5c6da4[_0x702a('0x46')]=_0x34a26f;return _0x5c6da4;})[_0x702a('0x24')](respondWithFilteredResult(_0x1973c7,_0xa0877a))[_0x702a('0x47')](handleError(_0x1973c7,null));};exports[_0x702a('0x48')]=function(_0x275262,_0x5a67df){var _0x41a7ab={'raw':!![],'where':{'id':_0x275262[_0x702a('0x49')]['id']}},_0x5dc8f8={};_0x5dc8f8[_0x702a('0x30')]=_[_0x702a('0x32')](db['Cdr'][_0x702a('0x2d')]);_0x5dc8f8[_0x702a('0x31')]=_[_0x702a('0x32')](_0x275262[_0x702a('0x31')]);_0x5dc8f8[_0x702a('0x33')]=_[_0x702a('0x35')](_0x5dc8f8[_0x702a('0x30')],_0x5dc8f8['query']);_0x41a7ab['attributes']=_[_0x702a('0x35')](_0x5dc8f8[_0x702a('0x30')],qs['fields'](_0x275262['query']['fields']));_0x41a7ab[_0x702a('0x34')]=_0x41a7ab[_0x702a('0x34')][_0x702a('0x37')]?_0x41a7ab[_0x702a('0x34')]:_0x5dc8f8[_0x702a('0x30')];if(_0x275262[_0x702a('0x31')][_0x702a('0x43')]){_0x41a7ab[_0x702a('0x44')]=[{'all':!![]}];}_0x41a7ab=_[_0x702a('0x40')]({},_0x41a7ab,_0x275262[_0x702a('0x4a')]);return db[_0x702a('0x2c')][_0x702a('0x4b')](_0x41a7ab)[_0x702a('0x24')](handleEntityNotFound(_0x5a67df,null))['then'](respondWithResult(_0x5a67df,null))['catch'](handleError(_0x5a67df,null));};exports[_0x702a('0x4c')]=function(_0x919678,_0x5a1cdf){return db[_0x702a('0x2c')][_0x702a('0x4c')](_0x919678['body'],{})[_0x702a('0x24')](respondWithResult(_0x5a1cdf,0xc9))[_0x702a('0x47')](handleError(_0x5a1cdf,null));};exports[_0x702a('0x23')]=function(_0x55e380,_0x3b1bba){if(_0x55e380[_0x702a('0x4d')]['id']){delete _0x55e380['body']['id'];}return db[_0x702a('0x2c')][_0x702a('0x4b')]({'where':{'id':_0x55e380['params']['id']}})[_0x702a('0x24')](handleEntityNotFound(_0x3b1bba,null))[_0x702a('0x24')](saveUpdates(_0x55e380[_0x702a('0x4d')],null))[_0x702a('0x24')](respondWithResult(_0x3b1bba,null))[_0x702a('0x47')](handleError(_0x3b1bba,null));};exports[_0x702a('0x25')]=function(_0xee9f8d,_0xbf2b99){return db[_0x702a('0x2c')]['find']({'where':{'id':_0xee9f8d[_0x702a('0x49')]['id']}})[_0x702a('0x24')](handleEntityNotFound(_0xbf2b99,null))[_0x702a('0x24')](removeEntity(_0xbf2b99,null))[_0x702a('0x47')](handleError(_0xbf2b99,null));};exports['describe']=function(_0x859fe6,_0x4235b4){return db[_0x702a('0x2c')][_0x702a('0x4e')]()[_0x702a('0x24')](respondWithResult(_0x4235b4,null))['catch'](handleError(_0x4235b4,null));}; \ No newline at end of file +var _0xfb65=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Cdr','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x1a2ef3,_0x21186c){var _0x34f4a4=function(_0x277126){while(--_0x277126){_0x1a2ef3['push'](_0x1a2ef3['shift']());}};_0x34f4a4(++_0x21186c);}(_0xfb65,0x82));var _0x5fb6=function(_0x2b1bb9,_0x3f85cc){_0x2b1bb9=_0x2b1bb9-0x0;var _0x59f401=_0xfb65[_0x2b1bb9];return _0x59f401;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fb6('0x0'));var zipdir=require(_0x5fb6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fb6('0x2'));var moment=require('moment');var BPromise=require(_0x5fb6('0x3'));var Mustache=require(_0x5fb6('0x4'));var util=require(_0x5fb6('0x5'));var path=require(_0x5fb6('0x6'));var sox=require(_0x5fb6('0x7'));var csv=require(_0x5fb6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fb6('0x9'));var squel=require(_0x5fb6('0xa'));var crypto=require(_0x5fb6('0xb'));var jsforce=require(_0x5fb6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5fb6('0x8'));var querystring=require(_0x5fb6('0xd'));var Papa=require(_0x5fb6('0xe'));var Redis=require(_0x5fb6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5fb6('0x10'));var as=require(_0x5fb6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fb6('0x12'))(_0x5fb6('0x13'));var utils=require(_0x5fb6('0x14'));var config=require(_0x5fb6('0x15'));var licenseUtil=require(_0x5fb6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1927d0,_0x15b296){_0x15b296=_0x15b296||0xcc;return function(_0x42285b){if(_0x42285b){return _0x1927d0[_0x5fb6('0x17')](_0x15b296);}return _0x1927d0[_0x5fb6('0x18')](_0x15b296)[_0x5fb6('0x19')]();};}function respondWithResult(_0x1a391f,_0x1ded21){_0x1ded21=_0x1ded21||0xc8;return function(_0x5e69c3){if(_0x5e69c3){return _0x1a391f['status'](_0x1ded21)[_0x5fb6('0x1a')](_0x5e69c3);}};}function respondWithFilteredResult(_0xfaea56,_0x58febe){return function(_0x1d57b1){if(_0x1d57b1){var _0x21ddd3=typeof _0x58febe[_0x5fb6('0x1b')]==='undefined'&&typeof _0x58febe[_0x5fb6('0x1c')]===_0x5fb6('0x1d');var _0x27bd8b=_0x1d57b1[_0x5fb6('0x1e')];var _0x167354=_0x21ddd3?0x0:_0x58febe[_0x5fb6('0x1b')];var _0x50bca8=_0x21ddd3?_0x1d57b1[_0x5fb6('0x1e')]:_0x58febe['offset']+_0x58febe[_0x5fb6('0x1c')];var _0x54c319;if(_0x50bca8>=_0x27bd8b){_0x50bca8=_0x27bd8b;_0x54c319=0xc8;}else{_0x54c319=0xce;}_0xfaea56[_0x5fb6('0x18')](_0x54c319);return _0xfaea56[_0x5fb6('0x1f')](_0x5fb6('0x20'),_0x167354+'-'+_0x50bca8+'/'+_0x27bd8b)[_0x5fb6('0x1a')](_0x1d57b1);}return null;};}function patchUpdates(_0x5885f1){return function(_0x418f58){try{jsonpatch[_0x5fb6('0x21')](_0x418f58,_0x5885f1,!![]);}catch(_0x50a414){return BPromise['reject'](_0x50a414);}return _0x418f58[_0x5fb6('0x22')]();};}function saveUpdates(_0x39ace4,_0x48a70e){return function(_0xdf1794){if(_0xdf1794){return _0xdf1794[_0x5fb6('0x23')](_0x39ace4)[_0x5fb6('0x24')](function(_0x36457e){return _0x36457e;});}return null;};}function removeEntity(_0x582f60,_0x2fca34){return function(_0x44aebe){if(_0x44aebe){return _0x44aebe[_0x5fb6('0x25')]()[_0x5fb6('0x24')](function(){_0x582f60[_0x5fb6('0x18')](0xcc)[_0x5fb6('0x19')]();});}};}function handleEntityNotFound(_0x4e2bff,_0x4cbdaf){return function(_0x298b44){if(!_0x298b44){_0x4e2bff[_0x5fb6('0x17')](0x194);}return _0x298b44;};}function handleError(_0x92f94d,_0x3ce22f){_0x3ce22f=_0x3ce22f||0x1f4;return function(_0x2731a3){logger[_0x5fb6('0x26')](_0x2731a3[_0x5fb6('0x27')]);if(_0x2731a3['name']){delete _0x2731a3[_0x5fb6('0x28')];}_0x92f94d[_0x5fb6('0x18')](_0x3ce22f)[_0x5fb6('0x29')](_0x2731a3);};}exports['index']=function(_0x2afc08,_0x1b4ae4){var _0x49a828={},_0x218428={},_0x408fd9={'count':0x0,'rows':[]};var _0x52afd7=_[_0x5fb6('0x2a')](db['Cdr'][_0x5fb6('0x2b')],function(_0x53dbeb){return{'name':_0x53dbeb['fieldName'],'type':_0x53dbeb[_0x5fb6('0x2c')][_0x5fb6('0x2d')]};});_0x218428[_0x5fb6('0x2e')]=_[_0x5fb6('0x2a')](_0x52afd7,_0x5fb6('0x28'));_0x218428[_0x5fb6('0x2f')]=_['keys'](_0x2afc08[_0x5fb6('0x2f')]);_0x218428[_0x5fb6('0x30')]=_[_0x5fb6('0x31')](_0x218428[_0x5fb6('0x2e')],_0x218428[_0x5fb6('0x2f')]);_0x49a828[_0x5fb6('0x32')]=_[_0x5fb6('0x31')](_0x218428[_0x5fb6('0x2e')],qs[_0x5fb6('0x33')](_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x33')]));_0x49a828['attributes']=_0x49a828[_0x5fb6('0x32')][_0x5fb6('0x34')]?_0x49a828['attributes']:_0x218428[_0x5fb6('0x2e')];if(!_0x2afc08['query']['hasOwnProperty'](_0x5fb6('0x35'))){_0x49a828[_0x5fb6('0x1c')]=qs[_0x5fb6('0x1c')](_0x2afc08['query'][_0x5fb6('0x1c')]);_0x49a828['offset']=qs['offset'](_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x1b')]);}_0x49a828[_0x5fb6('0x36')]=qs[_0x5fb6('0x37')](_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x37')]);_0x49a828[_0x5fb6('0x38')]=qs[_0x5fb6('0x30')](_[_0x5fb6('0x39')](_0x2afc08[_0x5fb6('0x2f')],_0x218428[_0x5fb6('0x30')]),_0x52afd7);if(_0x2afc08[_0x5fb6('0x2f')]['filter']){_0x49a828[_0x5fb6('0x38')]=_[_0x5fb6('0x3a')](_0x49a828[_0x5fb6('0x38')],{'$or':_['map'](_0x52afd7,function(_0x1e83fc){if(_0x1e83fc['type']!==_0x5fb6('0x3b')){var _0x4bd9e5={};_0x4bd9e5[_0x1e83fc[_0x5fb6('0x28')]]={'$like':'%'+_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x3c')]+'%'};return _0x4bd9e5;}})});}_0x49a828=_[_0x5fb6('0x3a')]({},_0x49a828,_0x2afc08[_0x5fb6('0x3d')]);var _0x59875a={'where':_0x49a828[_0x5fb6('0x38')]};return db[_0x5fb6('0x3e')][_0x5fb6('0x1e')](_0x59875a)[_0x5fb6('0x24')](function(_0x52e858){_0x408fd9[_0x5fb6('0x1e')]=_0x52e858;if(_0x2afc08[_0x5fb6('0x2f')][_0x5fb6('0x3f')]){_0x49a828[_0x5fb6('0x40')]=[{'all':!![]}];}return db[_0x5fb6('0x3e')][_0x5fb6('0x41')](_0x49a828);})['then'](function(_0x10c242){_0x408fd9[_0x5fb6('0x42')]=_0x10c242;return _0x408fd9;})[_0x5fb6('0x24')](respondWithFilteredResult(_0x1b4ae4,_0x49a828))[_0x5fb6('0x43')](handleError(_0x1b4ae4,null));};exports[_0x5fb6('0x44')]=function(_0x290e77,_0xd3245f){var _0x529c2d={'raw':!![],'where':{'id':_0x290e77[_0x5fb6('0x45')]['id']}},_0x2e3f97={};_0x2e3f97[_0x5fb6('0x2e')]=_['keys'](db[_0x5fb6('0x3e')]['rawAttributes']);_0x2e3f97[_0x5fb6('0x2f')]=_[_0x5fb6('0x46')](_0x290e77['query']);_0x2e3f97[_0x5fb6('0x30')]=_[_0x5fb6('0x31')](_0x2e3f97[_0x5fb6('0x2e')],_0x2e3f97['query']);_0x529c2d['attributes']=_[_0x5fb6('0x31')](_0x2e3f97[_0x5fb6('0x2e')],qs[_0x5fb6('0x33')](_0x290e77[_0x5fb6('0x2f')][_0x5fb6('0x33')]));_0x529c2d[_0x5fb6('0x32')]=_0x529c2d[_0x5fb6('0x32')][_0x5fb6('0x34')]?_0x529c2d[_0x5fb6('0x32')]:_0x2e3f97[_0x5fb6('0x2e')];if(_0x290e77[_0x5fb6('0x2f')]['includeAll']){_0x529c2d[_0x5fb6('0x40')]=[{'all':!![]}];}_0x529c2d=_['merge']({},_0x529c2d,_0x290e77['options']);return db[_0x5fb6('0x3e')][_0x5fb6('0x47')](_0x529c2d)[_0x5fb6('0x24')](handleEntityNotFound(_0xd3245f,null))[_0x5fb6('0x24')](respondWithResult(_0xd3245f,null))[_0x5fb6('0x43')](handleError(_0xd3245f,null));};exports[_0x5fb6('0x48')]=function(_0x45ba31,_0x5729a2){return db[_0x5fb6('0x3e')][_0x5fb6('0x48')](_0x45ba31['body'],{})[_0x5fb6('0x24')](respondWithResult(_0x5729a2,0xc9))[_0x5fb6('0x43')](handleError(_0x5729a2,null));};exports[_0x5fb6('0x23')]=function(_0x3fc547,_0x3b508a){if(_0x3fc547[_0x5fb6('0x49')]['id']){delete _0x3fc547[_0x5fb6('0x49')]['id'];}return db[_0x5fb6('0x3e')]['find']({'where':{'id':_0x3fc547[_0x5fb6('0x45')]['id']}})[_0x5fb6('0x24')](handleEntityNotFound(_0x3b508a,null))['then'](saveUpdates(_0x3fc547[_0x5fb6('0x49')],null))[_0x5fb6('0x24')](respondWithResult(_0x3b508a,null))[_0x5fb6('0x43')](handleError(_0x3b508a,null));};exports[_0x5fb6('0x25')]=function(_0x4bf156,_0x4bb943){return db[_0x5fb6('0x3e')][_0x5fb6('0x47')]({'where':{'id':_0x4bf156[_0x5fb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bb943,null))[_0x5fb6('0x24')](removeEntity(_0x4bb943,null))['catch'](handleError(_0x4bb943,null));};exports[_0x5fb6('0x4a')]=function(_0x5eb7cf,_0xa949ae){return db[_0x5fb6('0x3e')][_0x5fb6('0x4a')]()['then'](respondWithResult(_0xa949ae,null))[_0x5fb6('0x43')](handleError(_0xa949ae,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0d8e139..de32c2c 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(_0x434be4,_0x11d10a){var _0x487126=function(_0x1153df){while(--_0x1153df){_0x434be4['push'](_0x434be4['shift']());}};_0x487126(++_0x11d10a);}(_0x7a54,0x106));var _0x47a5=function(_0xd30ecf,_0x3ce922){_0xd30ecf=_0xd30ecf-0x0;var _0x3f9233=_0x7a54[_0xd30ecf];return _0x3f9233;};'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(_0x3e6f07,_0x155ae7){var _0x2954ab=function(_0x275c8b){while(--_0x275c8b){_0x3e6f07['push'](_0x3e6f07['shift']());}};_0x2954ab(++_0x155ae7);}(_0x7a54,0x106));var _0x47a5=function(_0x24fe54,_0x2cda12){_0x24fe54=_0x24fe54-0x0;var _0x518051=_0x7a54[_0x24fe54];return _0x518051;};'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 76797a5..b52e72f 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 _0xfae8=['http','request','then','Cdr,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xc4967c,_0x33c33a){var _0xf0d9cd=function(_0x5dc3a7){while(--_0x5dc3a7){_0xc4967c['push'](_0xc4967c['shift']());}};_0xf0d9cd(++_0x33c33a);}(_0xfae8,0xd1));var _0x8fae=function(_0x20aa01,_0x54b1cd){_0x20aa01=_0x20aa01-0x0;var _0x42490d=_0xfae8[_0x20aa01];return _0x42490d;};'use strict';var _=require('lodash');var util=require(_0x8fae('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fae('0x1'));var db=require(_0x8fae('0x2'))['db'];var utils=require(_0x8fae('0x3'));var logger=require(_0x8fae('0x4'))(_0x8fae('0x5'));var config=require('../../config/environment');var jayson=require(_0x8fae('0x6'));var client=jayson['client'][_0x8fae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d122d,_0x284d88,_0x780bdc){return new BPromise(function(_0x1ba848,_0x19c383){return client[_0x8fae('0x8')](_0x1d122d,_0x780bdc)[_0x8fae('0x9')](function(_0x24059c){logger['info'](_0x8fae('0xa'),_0x284d88,'request\x20sent');logger[_0x8fae('0xb')]('Cdr,\x20%s,\x20%s,\x20%s',_0x284d88,_0x8fae('0xc'),JSON[_0x8fae('0xd')](_0x24059c));if(_0x24059c[_0x8fae('0xe')]){if(_0x24059c[_0x8fae('0xe')]['code']===0x1f4){logger[_0x8fae('0xe')](_0x8fae('0xa'),_0x284d88,_0x24059c[_0x8fae('0xe')]['message']);return _0x19c383(_0x24059c[_0x8fae('0xe')][_0x8fae('0xf')]);}logger[_0x8fae('0xe')](_0x8fae('0xa'),_0x284d88,_0x24059c['error'][_0x8fae('0xf')]);return _0x1ba848(_0x24059c[_0x8fae('0xe')][_0x8fae('0xf')]);}else{logger['info'](_0x8fae('0xa'),_0x284d88,'request\x20sent');_0x1ba848(_0x24059c[_0x8fae('0x10')][_0x8fae('0xf')]);}})[_0x8fae('0x11')](function(_0x1f47fa){logger[_0x8fae('0xe')](_0x8fae('0xa'),_0x284d88,_0x1f47fa);_0x19c383(_0x1f47fa);});});} \ No newline at end of file +var _0x0ab5=['request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0ab5,0xc6));var _0x50ab=function(_0x15407b,_0x4a30c7){_0x15407b=_0x15407b-0x0;var _0x46e21d=_0x0ab5[_0x15407b];return _0x46e21d;};'use strict';var _=require('lodash');var util=require(_0x50ab('0x0'));var moment=require(_0x50ab('0x1'));var BPromise=require(_0x50ab('0x2'));var rs=require(_0x50ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50ab('0x4'))['db'];var utils=require(_0x50ab('0x5'));var logger=require('../../config/logger')(_0x50ab('0x6'));var config=require(_0x50ab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x50ab('0x8')][_0x50ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20189d,_0x359fe3,_0x3a2272){return new BPromise(function(_0x10c0b2,_0x93dff4){return client[_0x50ab('0xa')](_0x20189d,_0x3a2272)['then'](function(_0x17f9a7){logger[_0x50ab('0xb')]('Cdr,\x20%s,\x20%s',_0x359fe3,_0x50ab('0xc'));logger[_0x50ab('0xd')](_0x50ab('0xe'),_0x359fe3,_0x50ab('0xc'),JSON[_0x50ab('0xf')](_0x17f9a7));if(_0x17f9a7[_0x50ab('0x10')]){if(_0x17f9a7['error'][_0x50ab('0x11')]===0x1f4){logger[_0x50ab('0x10')]('Cdr,\x20%s,\x20%s',_0x359fe3,_0x17f9a7[_0x50ab('0x10')][_0x50ab('0x12')]);return _0x93dff4(_0x17f9a7['error']['message']);}logger[_0x50ab('0x10')]('Cdr,\x20%s,\x20%s',_0x359fe3,_0x17f9a7['error'][_0x50ab('0x12')]);return _0x10c0b2(_0x17f9a7[_0x50ab('0x10')]['message']);}else{logger[_0x50ab('0xb')](_0x50ab('0x13'),_0x359fe3,_0x50ab('0xc'));_0x10c0b2(_0x17f9a7[_0x50ab('0x14')][_0x50ab('0x12')]);}})['catch'](function(_0x45e0b6){logger['error'](_0x50ab('0x13'),_0x359fe3,_0x45e0b6);_0x93dff4(_0x45e0b6);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6afb423..0711486 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(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_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 +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(_0x457062,_0x1893df){var _0x4df1a9=function(_0x5b9652){while(--_0x5b9652){_0x457062['push'](_0x457062['shift']());}};_0x4df1a9(++_0x1893df);}(_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 4e664c9..78ccdc9 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 _0x5c51=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x20916b,_0xad2a){var _0x3dd070=function(_0x4c0b22){while(--_0x4c0b22){_0x20916b['push'](_0x20916b['shift']());}};_0x3dd070(++_0xad2a);}(_0x5c51,0x101));var _0x15c5=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0x5c51[_0x469ac7];return _0x22f3b0;};'use strict';var Sequelize=require(_0x15c5('0x0'));module[_0x15c5('0x1')]={'priority':{'type':Sequelize[_0x15c5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x15c5('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x15c5('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x15c5('0x4')}}; \ No newline at end of file +var _0x1f2b=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x22a217,_0x5daf6d){var _0x5a208b=function(_0x1331d9){while(--_0x1331d9){_0x22a217['push'](_0x22a217['shift']());}};_0x5a208b(++_0x5daf6d);}(_0x1f2b,0x182));var _0xb1f2=function(_0x3e7bd4,_0x5ec934){_0x3e7bd4=_0x3e7bd4-0x0;var _0x3b4224=_0x1f2b[_0x3e7bd4];return _0x3b4224;};'use strict';var Sequelize=require(_0xb1f2('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb1f2('0x1')],'allowNull':![],'defaultValue':_0xb1f2('0x2')},'appdata':{'type':Sequelize[_0xb1f2('0x3')]()},'description':{'type':Sequelize[_0xb1f2('0x1')]},'interval':{'type':Sequelize[_0xb1f2('0x1')],'defaultValue':_0xb1f2('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 746b3c3..28fbd49 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 _0xf69b=['apply','reject','update','then','destroy','sendStatus','error','stack','name','show','params','model','ChatApplication','rawAttributes','intersection','attributes','fields','length','query','includeAll','include','merge','options','find','catch','body','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x4b7dda,_0x301844){var _0x59dbfe=function(_0x49f5da){while(--_0x49f5da){_0x4b7dda['push'](_0x4b7dda['shift']());}};_0x59dbfe(++_0x301844);}(_0xf69b,0xc8));var _0xbf69=function(_0x15bd27,_0xca4ed8){_0x15bd27=_0x15bd27-0x0;var _0x246778=_0xf69b[_0x15bd27];return _0x246778;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf69('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf69('0x1'));var rp=require('request-promise');var moment=require(_0xbf69('0x2'));var BPromise=require(_0xbf69('0x3'));var Mustache=require(_0xbf69('0x4'));var util=require('util');var path=require(_0xbf69('0x5'));var sox=require('sox');var csv=require(_0xbf69('0x6'));var ejs=require(_0xbf69('0x7'));var fs=require('fs');var fs_extra=require(_0xbf69('0x8'));var _=require(_0xbf69('0x9'));var squel=require(_0xbf69('0xa'));var crypto=require(_0xbf69('0xb'));var jsforce=require(_0xbf69('0xc'));var deskjs=require(_0xbf69('0xd'));var toCsv=require(_0xbf69('0x6'));var querystring=require(_0xbf69('0xe'));var Papa=require('papaparse');var Redis=require(_0xbf69('0xf'));var authService=require(_0xbf69('0x10'));var qs=require(_0xbf69('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf69('0x12'));var logger=require(_0xbf69('0x13'))(_0xbf69('0x14'));var utils=require(_0xbf69('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbf69('0x16'));var db=require(_0xbf69('0x17'))['db'];function respondWithStatusCode(_0x2edf93,_0x980232){_0x980232=_0x980232||0xcc;return function(_0x294fdb){if(_0x294fdb){return _0x2edf93['sendStatus'](_0x980232);}return _0x2edf93['status'](_0x980232)[_0xbf69('0x18')]();};}function respondWithResult(_0x514f81,_0x4d858a){_0x4d858a=_0x4d858a||0xc8;return function(_0x4bd76d){if(_0x4bd76d){return _0x514f81[_0xbf69('0x19')](_0x4d858a)[_0xbf69('0x1a')](_0x4bd76d);}};}function respondWithFilteredResult(_0x87c8a9,_0x4a44a5){return function(_0x1b7412){if(_0x1b7412){var _0x301fe7=typeof _0x4a44a5[_0xbf69('0x1b')]===_0xbf69('0x1c')&&typeof _0x4a44a5[_0xbf69('0x1d')]===_0xbf69('0x1c');var _0x342883=_0x1b7412[_0xbf69('0x1e')];var _0x307fbb=_0x301fe7?0x0:_0x4a44a5[_0xbf69('0x1b')];var _0x41e749=_0x301fe7?_0x1b7412[_0xbf69('0x1e')]:_0x4a44a5[_0xbf69('0x1b')]+_0x4a44a5[_0xbf69('0x1d')];var _0x191972;if(_0x41e749>=_0x342883){_0x41e749=_0x342883;_0x191972=0xc8;}else{_0x191972=0xce;}_0x87c8a9[_0xbf69('0x19')](_0x191972);return _0x87c8a9['set'](_0xbf69('0x1f'),_0x307fbb+'-'+_0x41e749+'/'+_0x342883)[_0xbf69('0x1a')](_0x1b7412);}return null;};}function patchUpdates(_0x331a3c){return function(_0x4998b7){try{jsonpatch[_0xbf69('0x20')](_0x4998b7,_0x331a3c,!![]);}catch(_0x3fcfd9){return BPromise[_0xbf69('0x21')](_0x3fcfd9);}return _0x4998b7['save']();};}function saveUpdates(_0x4cb86f,_0xc75cf){return function(_0x1e5cf1){if(_0x1e5cf1){return _0x1e5cf1[_0xbf69('0x22')](_0x4cb86f)[_0xbf69('0x23')](function(_0x3e0f36){return _0x3e0f36;});}return null;};}function removeEntity(_0x5de824,_0x14b4b0){return function(_0x49edb3){if(_0x49edb3){return _0x49edb3[_0xbf69('0x24')]()['then'](function(){_0x5de824[_0xbf69('0x19')](0xcc)[_0xbf69('0x18')]();});}};}function handleEntityNotFound(_0x10b9c0,_0x276a00){return function(_0x23bef3){if(!_0x23bef3){_0x10b9c0[_0xbf69('0x25')](0x194);}return _0x23bef3;};}function handleError(_0x1ff38b,_0xfb7055){_0xfb7055=_0xfb7055||0x1f4;return function(_0x7ad809){logger[_0xbf69('0x26')](_0x7ad809[_0xbf69('0x27')]);if(_0x7ad809[_0xbf69('0x28')]){delete _0x7ad809[_0xbf69('0x28')];}_0x1ff38b[_0xbf69('0x19')](_0xfb7055)['send'](_0x7ad809);};}exports[_0xbf69('0x29')]=function(_0x3c8f0a,_0x36c8e5){var _0x320585={'raw':!![],'where':{'id':_0x3c8f0a[_0xbf69('0x2a')]['id']}},_0x1711f7={};_0x1711f7[_0xbf69('0x2b')]=_['keys'](db[_0xbf69('0x2c')][_0xbf69('0x2d')]);_0x1711f7['query']=_['keys'](_0x3c8f0a['query']);_0x1711f7['filters']=_[_0xbf69('0x2e')](_0x1711f7[_0xbf69('0x2b')],_0x1711f7['query']);_0x320585[_0xbf69('0x2f')]=_[_0xbf69('0x2e')](_0x1711f7[_0xbf69('0x2b')],qs['fields'](_0x3c8f0a['query'][_0xbf69('0x30')]));_0x320585[_0xbf69('0x2f')]=_0x320585[_0xbf69('0x2f')][_0xbf69('0x31')]?_0x320585['attributes']:_0x1711f7[_0xbf69('0x2b')];if(_0x3c8f0a[_0xbf69('0x32')][_0xbf69('0x33')]){_0x320585[_0xbf69('0x34')]=[{'all':!![]}];}_0x320585=_[_0xbf69('0x35')]({},_0x320585,_0x3c8f0a[_0xbf69('0x36')]);return db[_0xbf69('0x2c')][_0xbf69('0x37')](_0x320585)['then'](handleEntityNotFound(_0x36c8e5,null))[_0xbf69('0x23')](respondWithResult(_0x36c8e5,null))[_0xbf69('0x38')](handleError(_0x36c8e5,null));};exports[_0xbf69('0x22')]=function(_0x5c41d7,_0x17ed4d){if(_0x5c41d7['body']['id']){delete _0x5c41d7['body']['id'];}return db[_0xbf69('0x2c')][_0xbf69('0x37')]({'where':{'id':_0x5c41d7['params']['id']}})['then'](handleEntityNotFound(_0x17ed4d,null))[_0xbf69('0x23')](saveUpdates(_0x5c41d7[_0xbf69('0x39')],null))[_0xbf69('0x23')](respondWithResult(_0x17ed4d,null))['catch'](handleError(_0x17ed4d,null));};exports[_0xbf69('0x24')]=function(_0x5908ed,_0x179971){return db['ChatApplication'][_0xbf69('0x37')]({'where':{'id':_0x5908ed['params']['id']}})['then'](handleEntityNotFound(_0x179971,null))[_0xbf69('0x23')](removeEntity(_0x179971,null))[_0xbf69('0x38')](handleError(_0x179971,null));}; \ No newline at end of file +var _0x7382=['save','then','destroy','error','stack','name','send','show','params','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','rimraf','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0x7382,0x1f2));var _0x2738=function(_0x4dfbe8,_0x1bee42){_0x4dfbe8=_0x4dfbe8-0x0;var _0x2a2a44=_0x7382[_0x4dfbe8];return _0x2a2a44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2738('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2738('0x1'));var moment=require('moment');var BPromise=require(_0x2738('0x2'));var Mustache=require('mustache');var util=require(_0x2738('0x3'));var path=require(_0x2738('0x4'));var sox=require('sox');var csv=require(_0x2738('0x5'));var ejs=require(_0x2738('0x6'));var fs=require('fs');var fs_extra=require(_0x2738('0x7'));var _=require(_0x2738('0x8'));var squel=require('squel');var crypto=require(_0x2738('0x9'));var jsforce=require(_0x2738('0xa'));var deskjs=require(_0x2738('0xb'));var toCsv=require(_0x2738('0x5'));var querystring=require(_0x2738('0xc'));var Papa=require('papaparse');var Redis=require(_0x2738('0xd'));var authService=require(_0x2738('0xe'));var qs=require(_0x2738('0xf'));var as=require(_0x2738('0x10'));var hardwareService=require(_0x2738('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2738('0x12'));var licenseUtil=require(_0x2738('0x13'));var db=require(_0x2738('0x14'))['db'];function respondWithStatusCode(_0x46072b,_0x263b48){_0x263b48=_0x263b48||0xcc;return function(_0x41b111){if(_0x41b111){return _0x46072b[_0x2738('0x15')](_0x263b48);}return _0x46072b[_0x2738('0x16')](_0x263b48)[_0x2738('0x17')]();};}function respondWithResult(_0x1506fe,_0x4584f8){_0x4584f8=_0x4584f8||0xc8;return function(_0x1d2de7){if(_0x1d2de7){return _0x1506fe['status'](_0x4584f8)[_0x2738('0x18')](_0x1d2de7);}};}function respondWithFilteredResult(_0x2db43f,_0x547823){return function(_0x4cde16){if(_0x4cde16){var _0x1542b6=typeof _0x547823[_0x2738('0x19')]===_0x2738('0x1a')&&typeof _0x547823['limit']===_0x2738('0x1a');var _0x1f3962=_0x4cde16[_0x2738('0x1b')];var _0x2ab61b=_0x1542b6?0x0:_0x547823[_0x2738('0x19')];var _0x4a0f1e=_0x1542b6?_0x4cde16[_0x2738('0x1b')]:_0x547823[_0x2738('0x19')]+_0x547823[_0x2738('0x1c')];var _0x1d5cb1;if(_0x4a0f1e>=_0x1f3962){_0x4a0f1e=_0x1f3962;_0x1d5cb1=0xc8;}else{_0x1d5cb1=0xce;}_0x2db43f[_0x2738('0x16')](_0x1d5cb1);return _0x2db43f[_0x2738('0x1d')](_0x2738('0x1e'),_0x2ab61b+'-'+_0x4a0f1e+'/'+_0x1f3962)[_0x2738('0x18')](_0x4cde16);}return null;};}function patchUpdates(_0x2dcc5e){return function(_0x514e45){try{jsonpatch[_0x2738('0x1f')](_0x514e45,_0x2dcc5e,!![]);}catch(_0x52c7df){return BPromise[_0x2738('0x20')](_0x52c7df);}return _0x514e45[_0x2738('0x21')]();};}function saveUpdates(_0x264a56,_0x36b4bb){return function(_0x532cb8){if(_0x532cb8){return _0x532cb8['update'](_0x264a56)[_0x2738('0x22')](function(_0xae5515){return _0xae5515;});}return null;};}function removeEntity(_0x1637bb,_0x476c38){return function(_0x509c92){if(_0x509c92){return _0x509c92[_0x2738('0x23')]()[_0x2738('0x22')](function(){_0x1637bb[_0x2738('0x16')](0xcc)[_0x2738('0x17')]();});}};}function handleEntityNotFound(_0x4b4c15,_0x4bb15e){return function(_0x5b7fd0){if(!_0x5b7fd0){_0x4b4c15[_0x2738('0x15')](0x194);}return _0x5b7fd0;};}function handleError(_0x37f176,_0x536d42){_0x536d42=_0x536d42||0x1f4;return function(_0x2f0002){logger[_0x2738('0x24')](_0x2f0002[_0x2738('0x25')]);if(_0x2f0002['name']){delete _0x2f0002[_0x2738('0x26')];}_0x37f176[_0x2738('0x16')](_0x536d42)[_0x2738('0x27')](_0x2f0002);};}exports[_0x2738('0x28')]=function(_0xbfa426,_0x263ebd){var _0x13343a={'raw':!![],'where':{'id':_0xbfa426[_0x2738('0x29')]['id']}},_0x390d2d={};_0x390d2d['model']=_['keys'](db[_0x2738('0x2a')][_0x2738('0x2b')]);_0x390d2d['query']=_['keys'](_0xbfa426[_0x2738('0x2c')]);_0x390d2d[_0x2738('0x2d')]=_[_0x2738('0x2e')](_0x390d2d[_0x2738('0x2f')],_0x390d2d[_0x2738('0x2c')]);_0x13343a[_0x2738('0x30')]=_[_0x2738('0x2e')](_0x390d2d[_0x2738('0x2f')],qs[_0x2738('0x31')](_0xbfa426['query']['fields']));_0x13343a[_0x2738('0x30')]=_0x13343a[_0x2738('0x30')][_0x2738('0x32')]?_0x13343a[_0x2738('0x30')]:_0x390d2d[_0x2738('0x2f')];if(_0xbfa426['query'][_0x2738('0x33')]){_0x13343a[_0x2738('0x34')]=[{'all':!![]}];}_0x13343a=_[_0x2738('0x35')]({},_0x13343a,_0xbfa426[_0x2738('0x36')]);return db[_0x2738('0x2a')][_0x2738('0x37')](_0x13343a)[_0x2738('0x22')](handleEntityNotFound(_0x263ebd,null))[_0x2738('0x22')](respondWithResult(_0x263ebd,null))[_0x2738('0x38')](handleError(_0x263ebd,null));};exports[_0x2738('0x39')]=function(_0x19d49d,_0x20e02a){if(_0x19d49d[_0x2738('0x3a')]['id']){delete _0x19d49d[_0x2738('0x3a')]['id'];}return db[_0x2738('0x2a')][_0x2738('0x37')]({'where':{'id':_0x19d49d[_0x2738('0x29')]['id']}})[_0x2738('0x22')](handleEntityNotFound(_0x20e02a,null))[_0x2738('0x22')](saveUpdates(_0x19d49d[_0x2738('0x3a')],null))[_0x2738('0x22')](respondWithResult(_0x20e02a,null))[_0x2738('0x38')](handleError(_0x20e02a,null));};exports[_0x2738('0x23')]=function(_0x53084c,_0x10e729){return db[_0x2738('0x2a')][_0x2738('0x37')]({'where':{'id':_0x53084c[_0x2738('0x29')]['id']}})[_0x2738('0x22')](handleEntityNotFound(_0x10e729,null))[_0x2738('0x22')](removeEntity(_0x10e729,null))[_0x2738('0x38')](handleError(_0x10e729,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2948c09..8af963e 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 _0x0b71=['utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x0b71,0x119));var _0x10b7=function(_0x30eb5b,_0x234476){_0x30eb5b=_0x30eb5b-0x0;var _0x559d73=_0x0b71[_0x30eb5b];return _0x559d73;};'use strict';var _=require(_0x10b7('0x0'));var util=require(_0x10b7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x10b7('0x2'));var BPromise=require(_0x10b7('0x3'));var rp=require(_0x10b7('0x4'));var fs=require('fs');var path=require(_0x10b7('0x5'));var rimraf=require(_0x10b7('0x6'));var config=require(_0x10b7('0x7'));var attributes=require(_0x10b7('0x8'));module['exports']=function(_0xde0bed,_0x30f052){return _0xde0bed[_0x10b7('0x9')](_0x10b7('0xa'),attributes,{'tableName':_0x10b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x10b7('0xc'),'collate':_0x10b7('0xd')});}; \ No newline at end of file +var _0xc964=['bluebird','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x3efdaa,_0x236adf){var _0x1848f7=function(_0x4f0c23){while(--_0x4f0c23){_0x3efdaa['push'](_0x3efdaa['shift']());}};_0x1848f7(++_0x236adf);}(_0xc964,0x7e));var _0x4c96=function(_0x468fbf,_0x385efe){_0x468fbf=_0x468fbf-0x0;var _0x4a7892=_0xc964[_0x468fbf];return _0x4a7892;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var logger=require('../../config/logger')(_0x4c96('0x2'));var moment=require(_0x4c96('0x3'));var BPromise=require(_0x4c96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c96('0x5'));var rimraf=require('rimraf');var config=require(_0x4c96('0x6'));var attributes=require(_0x4c96('0x7'));module[_0x4c96('0x8')]=function(_0x2f6461,_0x45bb27){return _0x2f6461[_0x4c96('0x9')](_0x4c96('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4c96('0xb'),'collate':_0x4c96('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d8868db..d6eaec7 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 _0xe603=['then','ChatApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x18e52b,_0x1fae35){var _0x3d3062=function(_0x133b14){while(--_0x133b14){_0x18e52b['push'](_0x18e52b['shift']());}};_0x3d3062(++_0x1fae35);}(_0xe603,0x1eb));var _0x3e60=function(_0x522b73,_0x265a1d){_0x522b73=_0x522b73-0x0;var _0x57e075=_0xe603[_0x522b73];return _0x57e075;};'use strict';var _=require('lodash');var util=require(_0x3e60('0x0'));var moment=require('moment');var BPromise=require(_0x3e60('0x1'));var rs=require(_0x3e60('0x2'));var fs=require('fs');var Redis=require(_0x3e60('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e60('0x4'));var logger=require(_0x3e60('0x5'))(_0x3e60('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3e60('0x7')][_0x3e60('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4acb7c,_0x5e1770,_0x441941){return new BPromise(function(_0x428145,_0x2cba92){return client['request'](_0x4acb7c,_0x441941)[_0x3e60('0x9')](function(_0x592b6e){logger['info'](_0x3e60('0xa'),_0x5e1770,'request\x20sent');logger[_0x3e60('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x5e1770,_0x3e60('0xc'),JSON[_0x3e60('0xd')](_0x592b6e));if(_0x592b6e[_0x3e60('0xe')]){if(_0x592b6e['error'][_0x3e60('0xf')]===0x1f4){logger[_0x3e60('0xe')](_0x3e60('0xa'),_0x5e1770,_0x592b6e[_0x3e60('0xe')]['message']);return _0x2cba92(_0x592b6e[_0x3e60('0xe')]['message']);}logger['error'](_0x3e60('0xa'),_0x5e1770,_0x592b6e[_0x3e60('0xe')][_0x3e60('0x10')]);return _0x428145(_0x592b6e['error'][_0x3e60('0x10')]);}else{logger[_0x3e60('0x11')]('ChatApplication,\x20%s,\x20%s',_0x5e1770,_0x3e60('0xc'));_0x428145(_0x592b6e[_0x3e60('0x12')][_0x3e60('0x10')]);}})[_0x3e60('0x13')](function(_0x22b26e){logger[_0x3e60('0xe')](_0x3e60('0xa'),_0x5e1770,_0x22b26e);_0x2cba92(_0x22b26e);});});} \ No newline at end of file +var _0x4568=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x38c7d8,_0x253557){var _0x266426=function(_0x2f727b){while(--_0x2f727b){_0x38c7d8['push'](_0x38c7d8['shift']());}};_0x266426(++_0x253557);}(_0x4568,0x154));var _0x8456=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x4568[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x8456('0x0'));var util=require('util');var moment=require(_0x8456('0x1'));var BPromise=require(_0x8456('0x2'));var rs=require(_0x8456('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8456('0x4'))['db'];var utils=require(_0x8456('0x5'));var logger=require('../../config/logger')(_0x8456('0x6'));var config=require(_0x8456('0x7'));var jayson=require(_0x8456('0x8'));var client=jayson['client'][_0x8456('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf78b1f,_0x473539,_0x3165ac){return new BPromise(function(_0xc2732,_0x493c63){return client['request'](_0xf78b1f,_0x3165ac)['then'](function(_0x3c89e7){logger[_0x8456('0xa')](_0x8456('0xb'),_0x473539,_0x8456('0xc'));logger[_0x8456('0xd')](_0x8456('0xe'),_0x473539,'request\x20sent',JSON[_0x8456('0xf')](_0x3c89e7));if(_0x3c89e7[_0x8456('0x10')]){if(_0x3c89e7[_0x8456('0x10')]['code']===0x1f4){logger[_0x8456('0x10')](_0x8456('0xb'),_0x473539,_0x3c89e7[_0x8456('0x10')]['message']);return _0x493c63(_0x3c89e7[_0x8456('0x10')][_0x8456('0x11')]);}logger[_0x8456('0x10')]('ChatApplication,\x20%s,\x20%s',_0x473539,_0x3c89e7[_0x8456('0x10')][_0x8456('0x11')]);return _0xc2732(_0x3c89e7[_0x8456('0x10')][_0x8456('0x11')]);}else{logger['info'](_0x8456('0xb'),_0x473539,_0x8456('0xc'));_0xc2732(_0x3c89e7[_0x8456('0x12')][_0x8456('0x11')]);}})[_0x8456('0x13')](function(_0x4745f3){logger[_0x8456('0x10')]('ChatApplication,\x20%s,\x20%s',_0x473539,_0x4745f3);_0x493c63(_0x4745f3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 6ba6b8e..f332bdb 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 _0xd225=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','put','update','delete','destroy','exports','util'];(function(_0x3213b7,_0x6789ca){var _0xb960bf=function(_0x2f7f04){while(--_0x2f7f04){_0x3213b7['push'](_0x3213b7['shift']());}};_0xb960bf(++_0x6789ca);}(_0xd225,0x11c));var _0x5d22=function(_0x515b4e,_0xe41f4b){_0x515b4e=_0x515b4e-0x0;var _0x2ac0a5=_0xd225[_0x515b4e];return _0x2ac0a5;};'use strict';var multer=require('multer');var util=require(_0x5d22('0x0'));var path=require('path');var timeout=require(_0x5d22('0x1'));var express=require(_0x5d22('0x2'));var router=express[_0x5d22('0x3')]();var fs_extra=require(_0x5d22('0x4'));var auth=require(_0x5d22('0x5'));var interaction=require(_0x5d22('0x6'));var config=require(_0x5d22('0x7'));var controller=require('./chatApplication.controller');router['get'](_0x5d22('0x8'),auth[_0x5d22('0x9')](),controller['show']);router[_0x5d22('0xa')]('/:id',auth[_0x5d22('0x9')](),controller[_0x5d22('0xb')]);router[_0x5d22('0xc')](_0x5d22('0x8'),auth[_0x5d22('0x9')](),controller[_0x5d22('0xd')]);module[_0x5d22('0xe')]=router; \ No newline at end of file +var _0xdad1=['delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xdad1,0xb6));var _0x1dad=function(_0x1ceaed,_0x2cac3d){_0x1ceaed=_0x1ceaed-0x0;var _0x1d9dd0=_0xdad1[_0x1ceaed];return _0x1d9dd0;};'use strict';var multer=require(_0x1dad('0x0'));var util=require('util');var path=require(_0x1dad('0x1'));var timeout=require(_0x1dad('0x2'));var express=require('express');var router=express[_0x1dad('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1dad('0x4'));var interaction=require(_0x1dad('0x5'));var config=require('../../config/environment');var controller=require(_0x1dad('0x6'));router[_0x1dad('0x7')](_0x1dad('0x8'),auth[_0x1dad('0x9')](),controller[_0x1dad('0xa')]);router[_0x1dad('0xb')](_0x1dad('0x8'),auth[_0x1dad('0x9')](),controller[_0x1dad('0xc')]);router[_0x1dad('0xd')](_0x1dad('0x8'),auth[_0x1dad('0x9')](),controller['destroy']);module[_0x1dad('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 26f6fd2..c012cf3 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 _0xec90=['sequelize','exports','STRING','BOOLEAN'];(function(_0x496a12,_0x19f180){var _0x3ae956=function(_0x417b90){while(--_0x417b90){_0x496a12['push'](_0x496a12['shift']());}};_0x3ae956(++_0x19f180);}(_0xec90,0x19c));var _0x0ec9=function(_0x2694f6,_0x31b042){_0x2694f6=_0x2694f6-0x0;var _0x13ab43=_0xec90[_0x2694f6];return _0x13ab43;};'use strict';var Sequelize=require(_0x0ec9('0x0'));module[_0x0ec9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0ec9('0x2')]},'write':{'type':Sequelize[_0x0ec9('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x242e=['STRING','sequelize'];(function(_0x2e46d1,_0x38899a){var _0xd9f1c1=function(_0x3d66fa){while(--_0x3d66fa){_0x2e46d1['push'](_0x2e46d1['shift']());}};_0xd9f1c1(++_0x38899a);}(_0x242e,0x12f));var _0xe242=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x242e[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xe242('0x0'));module['exports']={'name':{'type':Sequelize[_0xe242('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe242('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index e5628c3..a344857 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 _0x4643=['moment','bluebird','mustache','path','sox','to-csv','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/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','error','name','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','ChatInternalMessage','$gte','split','format','getMessages','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4a0220,_0x1362ae){var _0x17c9c5=function(_0x32794c){while(--_0x32794c){_0x4a0220['push'](_0x4a0220['shift']());}};_0x17c9c5(++_0x1362ae);}(_0x4643,0x1f0));var _0x3464=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4643[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x3464('0x0'));var rimraf=require(_0x3464('0x1'));var zipdir=require(_0x3464('0x2'));var jsonpatch=require(_0x3464('0x3'));var rp=require('request-promise');var moment=require(_0x3464('0x4'));var BPromise=require(_0x3464('0x5'));var Mustache=require(_0x3464('0x6'));var util=require('util');var path=require(_0x3464('0x7'));var sox=require(_0x3464('0x8'));var csv=require(_0x3464('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3464('0xa'));var _=require('lodash');var squel=require(_0x3464('0xb'));var crypto=require(_0x3464('0xc'));var jsforce=require(_0x3464('0xd'));var deskjs=require(_0x3464('0xe'));var toCsv=require(_0x3464('0x9'));var querystring=require(_0x3464('0xf'));var Papa=require('papaparse');var Redis=require(_0x3464('0x10'));var authService=require(_0x3464('0x11'));var qs=require(_0x3464('0x12'));var as=require(_0x3464('0x13'));var hardwareService=require(_0x3464('0x14'));var logger=require(_0x3464('0x15'))(_0x3464('0x16'));var utils=require('../../config/utils');var config=require(_0x3464('0x17'));var licenseUtil=require(_0x3464('0x18'));var db=require(_0x3464('0x19'))['db'];config['redis']=_[_0x3464('0x1a')](config[_0x3464('0x1b')],{'host':_0x3464('0x1c'),'port':0x18eb});var socket=require(_0x3464('0x1d'))(new Redis(config[_0x3464('0x1b')]));require(_0x3464('0x1e'))[_0x3464('0x1f')](socket);function respondWithStatusCode(_0x3a9c1c,_0xb82658){_0xb82658=_0xb82658||0xcc;return function(_0x3915fd){if(_0x3915fd){return _0x3a9c1c[_0x3464('0x20')](_0xb82658);}return _0x3a9c1c[_0x3464('0x21')](_0xb82658)[_0x3464('0x22')]();};}function respondWithResult(_0x2dc90f,_0x211a10){_0x211a10=_0x211a10||0xc8;return function(_0x3d969e){if(_0x3d969e){return _0x2dc90f[_0x3464('0x21')](_0x211a10)[_0x3464('0x23')](_0x3d969e);}};}function respondWithFilteredResult(_0x5fbdf0,_0x448a3c){return function(_0x1a1052){if(_0x1a1052){var _0x494dcb=typeof _0x448a3c[_0x3464('0x24')]===_0x3464('0x25')&&typeof _0x448a3c['limit']===_0x3464('0x25');var _0x8c3a1f=_0x1a1052['count'];var _0x1eba85=_0x494dcb?0x0:_0x448a3c[_0x3464('0x24')];var _0x337646=_0x494dcb?_0x1a1052['count']:_0x448a3c[_0x3464('0x24')]+_0x448a3c[_0x3464('0x26')];var _0x3aa225;if(_0x337646>=_0x8c3a1f){_0x337646=_0x8c3a1f;_0x3aa225=0xc8;}else{_0x3aa225=0xce;}_0x5fbdf0['status'](_0x3aa225);return _0x5fbdf0[_0x3464('0x27')](_0x3464('0x28'),_0x1eba85+'-'+_0x337646+'/'+_0x8c3a1f)['json'](_0x1a1052);}return null;};}function patchUpdates(_0x420812){return function(_0x36a76b){try{jsonpatch[_0x3464('0x29')](_0x36a76b,_0x420812,!![]);}catch(_0x21b219){return BPromise['reject'](_0x21b219);}return _0x36a76b[_0x3464('0x2a')]();};}function saveUpdates(_0x37aab4,_0x415861){return function(_0x34c7fe){if(_0x34c7fe){return _0x34c7fe[_0x3464('0x2b')](_0x37aab4)[_0x3464('0x2c')](function(_0x24657a){return _0x24657a;});}return null;};}function removeEntity(_0x1be250,_0x2b67c8){return function(_0x4755c6){if(_0x4755c6){return _0x4755c6['destroy']()[_0x3464('0x2c')](function(){_0x1be250[_0x3464('0x21')](0xcc)[_0x3464('0x22')]();});}};}function handleEntityNotFound(_0x30f6da,_0x1f9bc4){return function(_0x14abd3){if(!_0x14abd3){_0x30f6da[_0x3464('0x20')](0x194);}return _0x14abd3;};}function handleError(_0xa0c2fb,_0x323a81){_0x323a81=_0x323a81||0x1f4;return function(_0x431290){logger[_0x3464('0x2d')](_0x431290['stack']);if(_0x431290['name']){delete _0x431290[_0x3464('0x2e')];}_0xa0c2fb[_0x3464('0x21')](_0x323a81)['send'](_0x431290);};}exports[_0x3464('0x2f')]=function(_0x2aa463,_0x10c2e9){var _0x4ad70a={},_0x5ba5bc={},_0x16dcec={'count':0x0,'rows':[]};var _0x2ab824=_[_0x3464('0x30')](db[_0x3464('0x31')]['rawAttributes'],function(_0x5085de){return{'name':_0x5085de[_0x3464('0x32')],'type':_0x5085de[_0x3464('0x33')][_0x3464('0x34')]};});_0x5ba5bc[_0x3464('0x35')]=_[_0x3464('0x30')](_0x2ab824,_0x3464('0x2e'));_0x5ba5bc[_0x3464('0x36')]=_[_0x3464('0x37')](_0x2aa463['query']);_0x5ba5bc[_0x3464('0x38')]=_[_0x3464('0x39')](_0x5ba5bc[_0x3464('0x35')],_0x5ba5bc[_0x3464('0x36')]);_0x4ad70a[_0x3464('0x3a')]=_[_0x3464('0x39')](_0x5ba5bc[_0x3464('0x35')],qs['fields'](_0x2aa463[_0x3464('0x36')][_0x3464('0x3b')]));_0x4ad70a['attributes']=_0x4ad70a[_0x3464('0x3a')][_0x3464('0x3c')]?_0x4ad70a['attributes']:_0x5ba5bc[_0x3464('0x35')];if(!_0x2aa463[_0x3464('0x36')][_0x3464('0x3d')](_0x3464('0x3e'))){_0x4ad70a['limit']=qs[_0x3464('0x26')](_0x2aa463[_0x3464('0x36')][_0x3464('0x26')]);_0x4ad70a[_0x3464('0x24')]=qs[_0x3464('0x24')](_0x2aa463['query']['offset']);}_0x4ad70a[_0x3464('0x3f')]=qs[_0x3464('0x40')](_0x2aa463[_0x3464('0x36')]['sort']);_0x4ad70a[_0x3464('0x41')]=qs[_0x3464('0x38')](_['pick'](_0x2aa463['query'],_0x5ba5bc[_0x3464('0x38')]),_0x2ab824);if(_0x2aa463[_0x3464('0x36')]['filter']){_0x4ad70a[_0x3464('0x41')]=_['merge'](_0x4ad70a[_0x3464('0x41')],{'$or':_[_0x3464('0x30')](_0x2ab824,function(_0x5d1778){if(_0x5d1778['type']!==_0x3464('0x42')){var _0x4e0940={};_0x4e0940[_0x5d1778[_0x3464('0x2e')]]={'$like':'%'+_0x2aa463[_0x3464('0x36')][_0x3464('0x43')]+'%'};return _0x4e0940;}})});}_0x4ad70a=_[_0x3464('0x44')]({},_0x4ad70a,_0x2aa463[_0x3464('0x45')]);var _0xcaf4cb={'where':_0x4ad70a[_0x3464('0x41')]};return db[_0x3464('0x31')][_0x3464('0x46')](_0xcaf4cb)[_0x3464('0x2c')](function(_0x3abb9d){_0x16dcec[_0x3464('0x46')]=_0x3abb9d;if(_0x2aa463[_0x3464('0x36')]['includeAll']){_0x4ad70a[_0x3464('0x47')]=[{'all':!![]}];}return db[_0x3464('0x31')][_0x3464('0x48')](_0x4ad70a);})[_0x3464('0x2c')](function(_0x58baf9){_0x16dcec[_0x3464('0x49')]=_0x58baf9;return _0x16dcec;})[_0x3464('0x2c')](respondWithFilteredResult(_0x10c2e9,_0x4ad70a))[_0x3464('0x4a')](handleError(_0x10c2e9,null));};exports[_0x3464('0x4b')]=function(_0xdffeaf,_0x282c31){var _0x3b8a56={'raw':!![],'where':{'id':_0xdffeaf[_0x3464('0x4c')]['id']}},_0x55a12c={};_0x55a12c['model']=_[_0x3464('0x37')](db[_0x3464('0x31')][_0x3464('0x4d')]);_0x55a12c['query']=_[_0x3464('0x37')](_0xdffeaf['query']);_0x55a12c[_0x3464('0x38')]=_[_0x3464('0x39')](_0x55a12c[_0x3464('0x35')],_0x55a12c[_0x3464('0x36')]);_0x3b8a56[_0x3464('0x3a')]=_[_0x3464('0x39')](_0x55a12c[_0x3464('0x35')],qs[_0x3464('0x3b')](_0xdffeaf[_0x3464('0x36')][_0x3464('0x3b')]));_0x3b8a56[_0x3464('0x3a')]=_0x3b8a56['attributes'][_0x3464('0x3c')]?_0x3b8a56[_0x3464('0x3a')]:_0x55a12c[_0x3464('0x35')];if(_0xdffeaf[_0x3464('0x36')][_0x3464('0x4e')]){_0x3b8a56[_0x3464('0x47')]=[{'all':!![]}];}_0x3b8a56=_[_0x3464('0x44')]({},_0x3b8a56,_0xdffeaf[_0x3464('0x45')]);return db['ChatGroup'][_0x3464('0x4f')](_0x3b8a56)[_0x3464('0x2c')](handleEntityNotFound(_0x282c31,null))[_0x3464('0x2c')](respondWithResult(_0x282c31,null))[_0x3464('0x4a')](handleError(_0x282c31,null));};exports[_0x3464('0x50')]=function(_0x5bc2e1,_0xa60d07){return db['ChatGroup'][_0x3464('0x50')](_0x5bc2e1[_0x3464('0x51')],{})['then'](respondWithResult(_0xa60d07,0xc9))[_0x3464('0x4a')](handleError(_0xa60d07,null));};exports[_0x3464('0x2b')]=function(_0x4f3436,_0x2e9e65){if(_0x4f3436[_0x3464('0x51')]['id']){delete _0x4f3436[_0x3464('0x51')]['id'];}return db['ChatGroup'][_0x3464('0x4f')]({'where':{'id':_0x4f3436[_0x3464('0x4c')]['id']}})[_0x3464('0x2c')](handleEntityNotFound(_0x2e9e65,null))['then'](saveUpdates(_0x4f3436[_0x3464('0x51')],null))[_0x3464('0x2c')](respondWithResult(_0x2e9e65,null))[_0x3464('0x4a')](handleError(_0x2e9e65,null));};exports[_0x3464('0x52')]=function(_0x2f6cfb,_0x2d80c4){return db[_0x3464('0x31')]['find']({'where':{'id':_0x2f6cfb['params']['id']}})[_0x3464('0x2c')](handleEntityNotFound(_0x2d80c4,null))['then'](removeEntity(_0x2d80c4,null))['catch'](handleError(_0x2d80c4,null));};exports[_0x3464('0x53')]=function(_0x52d47e,_0x484982){return db[_0x3464('0x31')][_0x3464('0x53')]()[_0x3464('0x2c')](respondWithResult(_0x484982,null))['catch'](handleError(_0x484982,null));};exports[_0x3464('0x54')]=function(_0x54daef,_0x14f71d,_0x14e59f){return db['ChatInternalMessage'][_0x3464('0x46')]({'where':{'ChatGroupId':_0x54daef[_0x3464('0x4c')]['id'],'ToId':_0x54daef[_0x3464('0x55')]['id'],'read':![]}})[_0x3464('0x2c')](function(_0x35c1fe){return{'id':_[_0x3464('0x56')](_0x54daef[_0x3464('0x4c')]['id']),'count':_0x35c1fe};})[_0x3464('0x2c')](respondWithResult(_0x14f71d,null))[_0x3464('0x4a')](handleError(_0x14f71d,null));};exports[_0x3464('0x57')]=function(_0x26862d,_0x34d944,_0x177a93){return db[_0x3464('0x31')][_0x3464('0x4f')]({'where':{'id':_0x26862d[_0x3464('0x4c')]['id']}})[_0x3464('0x2c')](handleEntityNotFound(_0x34d944,null))[_0x3464('0x2c')](function(_0x236edf){if(_0x236edf){return _0x236edf[_0x3464('0x57')](_0x26862d['body'][_0x3464('0x58')],_[_0x3464('0x59')](_0x26862d[_0x3464('0x51')],['ids','id'])||{});}})[_0x3464('0x2c')](respondWithResult(_0x34d944,null))[_0x3464('0x4a')](handleError(_0x34d944,null));};exports[_0x3464('0x5a')]=function(_0x398aed,_0x4b0ded,_0x195668){var _0x2bb2a4={};var _0x3d7522={};var _0x33f5cd;var _0x2064b4;return db[_0x3464('0x31')][_0x3464('0x5b')]({'where':{'id':_0x398aed[_0x3464('0x4c')]['id']}})[_0x3464('0x2c')](handleEntityNotFound(_0x4b0ded,null))[_0x3464('0x2c')](function(_0x478b1a){if(_0x478b1a){_0x33f5cd=_0x478b1a;_0x3d7522[_0x3464('0x35')]=_['keys'](db[_0x3464('0x5c')][_0x3464('0x4d')]);_0x3d7522['query']=_['keys'](_0x398aed[_0x3464('0x36')]);_0x3d7522['filters']=_['intersection'](_0x3d7522[_0x3464('0x35')],_0x3d7522[_0x3464('0x36')]);_0x2bb2a4['attributes']=_[_0x3464('0x39')](_0x3d7522[_0x3464('0x35')],qs['fields'](_0x398aed[_0x3464('0x36')]['fields']));_0x2bb2a4[_0x3464('0x3a')]=_0x2bb2a4[_0x3464('0x3a')][_0x3464('0x3c')]?_0x2bb2a4[_0x3464('0x3a')]:_0x3d7522[_0x3464('0x35')];_0x2bb2a4['order']=qs[_0x3464('0x40')](_0x398aed[_0x3464('0x36')]['sort']);_0x2bb2a4[_0x3464('0x41')]=qs['filters'](_[_0x3464('0x5d')](_0x398aed[_0x3464('0x36')],_0x3d7522[_0x3464('0x38')]));if(_0x398aed[_0x3464('0x36')]['filter']){_0x2bb2a4[_0x3464('0x41')]=_['merge'](_0x2bb2a4[_0x3464('0x41')],{'$or':_['map'](_0x2bb2a4[_0x3464('0x3a')],function(_0x439c70){var _0xee564d={};_0xee564d[_0x439c70]={'$like':'%'+_0x398aed['query'][_0x3464('0x43')]+'%'};return _0xee564d;})});}_0x2bb2a4=_[_0x3464('0x44')]({},_0x2bb2a4,_0x398aed[_0x3464('0x45')]);return _0x33f5cd[_0x3464('0x5a')](_0x2bb2a4);}})[_0x3464('0x2c')](function(_0x17e393){if(_0x17e393){_0x2064b4=_0x17e393['length'];if(!_0x398aed[_0x3464('0x36')][_0x3464('0x3d')](_0x3464('0x3e'))){_0x2bb2a4[_0x3464('0x26')]=qs[_0x3464('0x26')](_0x398aed['query'][_0x3464('0x26')]);_0x2bb2a4['offset']=qs[_0x3464('0x24')](_0x398aed[_0x3464('0x36')][_0x3464('0x24')]);}return _0x33f5cd[_0x3464('0x5a')](_0x2bb2a4);}})[_0x3464('0x2c')](function(_0x51f6f5){if(_0x51f6f5){return _0x51f6f5?{'count':_0x2064b4,'rows':_0x51f6f5}:null;}})['then'](respondWithResult(_0x4b0ded,null))[_0x3464('0x4a')](handleError(_0x4b0ded,null));};exports['removeMembers']=function(_0x2d77bf,_0x1b816f,_0x332b80){return db['ChatGroup'][_0x3464('0x4f')]({'where':{'id':_0x2d77bf['params']['id']}})[_0x3464('0x2c')](handleEntityNotFound(_0x1b816f,null))[_0x3464('0x2c')](function(_0x5ec380){if(_0x5ec380){return _0x5ec380[_0x3464('0x5e')](_0x2d77bf[_0x3464('0x36')][_0x3464('0x58')]);}})[_0x3464('0x2c')](respondWithStatusCode(_0x1b816f,null))['catch'](handleError(_0x1b816f,null));};exports['addMessage']=function(_0xc7206b,_0x3ebceb,_0x5647d4){if(_0xc7206b[_0x3464('0x51')]['id']){delete _0xc7206b['body']['id'];}return db['ChatGroup'][_0x3464('0x4f')]({'where':{'id':_0xc7206b[_0x3464('0x4c')]['id']}})[_0x3464('0x2c')](handleEntityNotFound(_0x3ebceb,null))[_0x3464('0x2c')](function(_0x4a2338){if(_0x4a2338){_0xc7206b['body']['ChatGroupId']=_0x4a2338['id'];return db['ChatInternalMessage'][_0x3464('0x50')](_0xc7206b[_0x3464('0x51')]);}})[_0x3464('0x2c')](respondWithResult(_0x3ebceb,null))[_0x3464('0x4a')](handleError(_0x3ebceb,null));};exports['getMessages']=function(_0x1324ad,_0x999a87,_0x221d6d){var _0x4f9ecb={};var _0x1e8bd7={};var _0x460f20;var _0x20aa95;return db['ChatGroup'][_0x3464('0x5b')]({'where':{'id':_0x1324ad['params']['id']}})[_0x3464('0x2c')](handleEntityNotFound(_0x999a87,null))['then'](function(_0x34c0a8){if(_0x34c0a8){_0x460f20=_0x34c0a8;_0x1e8bd7[_0x3464('0x35')]=_['keys'](db[_0x3464('0x5f')]['rawAttributes']);_0x1e8bd7[_0x3464('0x36')]=_[_0x3464('0x37')](_0x1324ad[_0x3464('0x36')]);_0x1e8bd7[_0x3464('0x38')]=_[_0x3464('0x39')](_0x1e8bd7['model'],_0x1e8bd7[_0x3464('0x36')]);_0x4f9ecb[_0x3464('0x3a')]=_['intersection'](_0x1e8bd7[_0x3464('0x35')],qs[_0x3464('0x3b')](_0x1324ad[_0x3464('0x36')][_0x3464('0x3b')]));_0x4f9ecb[_0x3464('0x3a')]=_0x4f9ecb['attributes'][_0x3464('0x3c')]?_0x4f9ecb[_0x3464('0x3a')]:_0x1e8bd7['model'];_0x4f9ecb[_0x3464('0x3f')]=qs[_0x3464('0x40')](_0x1324ad[_0x3464('0x36')][_0x3464('0x40')]);_0x4f9ecb[_0x3464('0x41')]=qs[_0x3464('0x38')](_['pick'](_0x1324ad[_0x3464('0x36')],_0x1e8bd7[_0x3464('0x38')]));if(_0x1324ad[_0x3464('0x36')][_0x3464('0x43')]){_0x4f9ecb[_0x3464('0x41')]=_['merge'](_0x4f9ecb[_0x3464('0x41')],{'$or':_[_0x3464('0x30')](_0x4f9ecb[_0x3464('0x3a')],function(_0x7afb2c){var _0x299456={};_0x299456[_0x7afb2c]={'$like':'%'+_0x1324ad[_0x3464('0x36')][_0x3464('0x43')]+'%'};return _0x299456;})});}if(_0x1324ad[_0x3464('0x36')][_0x3464('0x60')]){var _0x2acef4=_0x1324ad[_0x3464('0x36')]['$gte'][_0x3464('0x61')](',');var _0x22b977={};_0x22b977[_0x2acef4[0x0]]={'$gte':moment(_0x2acef4[0x1])[_0x3464('0x62')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4f9ecb['where']=_[_0x3464('0x44')](_0x4f9ecb['where'],_0x22b977);}_0x4f9ecb=_['merge']({},_0x4f9ecb,_0x1324ad['options']);return _0x460f20[_0x3464('0x63')](_0x4f9ecb);}})[_0x3464('0x2c')](function(_0x3232be){if(_0x3232be){_0x20aa95=_0x3232be[_0x3464('0x3c')];if(!_0x1324ad['query'][_0x3464('0x3d')](_0x3464('0x3e'))){_0x4f9ecb['limit']=qs[_0x3464('0x26')](_0x1324ad['query'][_0x3464('0x26')]);_0x4f9ecb[_0x3464('0x24')]=qs[_0x3464('0x24')](_0x1324ad[_0x3464('0x36')][_0x3464('0x24')]);}return _0x460f20[_0x3464('0x63')](_0x4f9ecb);}})[_0x3464('0x2c')](function(_0x538843){if(_0x538843){return _0x538843?{'count':_0x20aa95,'rows':_0x538843}:null;}})[_0x3464('0x2c')](respondWithResult(_0x999a87,null))['catch'](handleError(_0x999a87,null));}; \ No newline at end of file +var _0x48f8=['options','includeAll','include','rows','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','findOne','order','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','$gte','format','getMessages','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','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','../../config/environment','../../config/license/util','../../mysqldb','redis','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x37ef93,_0x8b26a6){var _0xa47012=function(_0x4c2ad8){while(--_0x4c2ad8){_0x37ef93['push'](_0x37ef93['shift']());}};_0xa47012(++_0x8b26a6);}(_0x48f8,0x18f));var _0x848f=function(_0x106d51,_0x2eb27c){_0x106d51=_0x106d51-0x0;var _0x1924b9=_0x48f8[_0x106d51];return _0x1924b9;};'use strict';var emlformat=require(_0x848f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x848f('0x1'));var jsonpatch=require(_0x848f('0x2'));var rp=require(_0x848f('0x3'));var moment=require('moment');var BPromise=require(_0x848f('0x4'));var Mustache=require('mustache');var util=require(_0x848f('0x5'));var path=require(_0x848f('0x6'));var sox=require(_0x848f('0x7'));var csv=require(_0x848f('0x8'));var ejs=require(_0x848f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x848f('0xa'));var squel=require('squel');var crypto=require(_0x848f('0xb'));var jsforce=require(_0x848f('0xc'));var deskjs=require(_0x848f('0xd'));var toCsv=require(_0x848f('0x8'));var querystring=require(_0x848f('0xe'));var Papa=require(_0x848f('0xf'));var Redis=require(_0x848f('0x10'));var authService=require(_0x848f('0x11'));var qs=require(_0x848f('0x12'));var as=require(_0x848f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x848f('0x14'))(_0x848f('0x15'));var utils=require(_0x848f('0x16'));var config=require(_0x848f('0x17'));var licenseUtil=require(_0x848f('0x18'));var db=require(_0x848f('0x19'))['db'];config['redis']=_['defaults'](config[_0x848f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x848f('0x1a')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0xdbc693,_0x2b6546){_0x2b6546=_0x2b6546||0xcc;return function(_0x17cbe3){if(_0x17cbe3){return _0xdbc693[_0x848f('0x1b')](_0x2b6546);}return _0xdbc693['status'](_0x2b6546)[_0x848f('0x1c')]();};}function respondWithResult(_0x57ae7b,_0x240c98){_0x240c98=_0x240c98||0xc8;return function(_0x5009cc){if(_0x5009cc){return _0x57ae7b[_0x848f('0x1d')](_0x240c98)[_0x848f('0x1e')](_0x5009cc);}};}function respondWithFilteredResult(_0x674dd2,_0x324a93){return function(_0x497cc3){if(_0x497cc3){var _0x3771b3=typeof _0x324a93[_0x848f('0x1f')]===_0x848f('0x20')&&typeof _0x324a93[_0x848f('0x21')]===_0x848f('0x20');var _0x2f79fd=_0x497cc3[_0x848f('0x22')];var _0x53081e=_0x3771b3?0x0:_0x324a93['offset'];var _0x5d88e0=_0x3771b3?_0x497cc3[_0x848f('0x22')]:_0x324a93['offset']+_0x324a93['limit'];var _0x4d5667;if(_0x5d88e0>=_0x2f79fd){_0x5d88e0=_0x2f79fd;_0x4d5667=0xc8;}else{_0x4d5667=0xce;}_0x674dd2[_0x848f('0x1d')](_0x4d5667);return _0x674dd2['set'](_0x848f('0x23'),_0x53081e+'-'+_0x5d88e0+'/'+_0x2f79fd)['json'](_0x497cc3);}return null;};}function patchUpdates(_0x51817e){return function(_0x3db3c7){try{jsonpatch[_0x848f('0x24')](_0x3db3c7,_0x51817e,!![]);}catch(_0x4e5976){return BPromise[_0x848f('0x25')](_0x4e5976);}return _0x3db3c7['save']();};}function saveUpdates(_0x389fbe,_0x3fa759){return function(_0x23917a){if(_0x23917a){return _0x23917a[_0x848f('0x26')](_0x389fbe)[_0x848f('0x27')](function(_0x1772ce){return _0x1772ce;});}return null;};}function removeEntity(_0x2e3d70,_0x115f6e){return function(_0x3a0328){if(_0x3a0328){return _0x3a0328[_0x848f('0x28')]()[_0x848f('0x27')](function(){_0x2e3d70[_0x848f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3313b7,_0x5de048){return function(_0x19815c){if(!_0x19815c){_0x3313b7[_0x848f('0x1b')](0x194);}return _0x19815c;};}function handleError(_0x32c0a3,_0x535e35){_0x535e35=_0x535e35||0x1f4;return function(_0x457265){logger[_0x848f('0x29')](_0x457265['stack']);if(_0x457265[_0x848f('0x2a')]){delete _0x457265['name'];}_0x32c0a3['status'](_0x535e35)[_0x848f('0x2b')](_0x457265);};}exports[_0x848f('0x2c')]=function(_0x1b3950,_0x1a3d46){var _0x39884f={},_0x1d2892={},_0x90f1ce={'count':0x0,'rows':[]};var _0x4f5741=_[_0x848f('0x2d')](db[_0x848f('0x2e')][_0x848f('0x2f')],function(_0x54cec9){return{'name':_0x54cec9[_0x848f('0x30')],'type':_0x54cec9[_0x848f('0x31')][_0x848f('0x32')]};});_0x1d2892[_0x848f('0x33')]=_[_0x848f('0x2d')](_0x4f5741,_0x848f('0x2a'));_0x1d2892[_0x848f('0x34')]=_[_0x848f('0x35')](_0x1b3950[_0x848f('0x34')]);_0x1d2892[_0x848f('0x36')]=_[_0x848f('0x37')](_0x1d2892[_0x848f('0x33')],_0x1d2892[_0x848f('0x34')]);_0x39884f[_0x848f('0x38')]=_[_0x848f('0x37')](_0x1d2892[_0x848f('0x33')],qs['fields'](_0x1b3950[_0x848f('0x34')][_0x848f('0x39')]));_0x39884f[_0x848f('0x38')]=_0x39884f[_0x848f('0x38')][_0x848f('0x3a')]?_0x39884f[_0x848f('0x38')]:_0x1d2892[_0x848f('0x33')];if(!_0x1b3950[_0x848f('0x34')][_0x848f('0x3b')]('nolimit')){_0x39884f[_0x848f('0x21')]=qs['limit'](_0x1b3950[_0x848f('0x34')][_0x848f('0x21')]);_0x39884f[_0x848f('0x1f')]=qs[_0x848f('0x1f')](_0x1b3950[_0x848f('0x34')]['offset']);}_0x39884f['order']=qs['sort'](_0x1b3950[_0x848f('0x34')][_0x848f('0x3c')]);_0x39884f[_0x848f('0x3d')]=qs[_0x848f('0x36')](_[_0x848f('0x3e')](_0x1b3950[_0x848f('0x34')],_0x1d2892['filters']),_0x4f5741);if(_0x1b3950[_0x848f('0x34')][_0x848f('0x3f')]){_0x39884f[_0x848f('0x3d')]=_['merge'](_0x39884f[_0x848f('0x3d')],{'$or':_[_0x848f('0x2d')](_0x4f5741,function(_0x4aff69){if(_0x4aff69[_0x848f('0x31')]!==_0x848f('0x40')){var _0x11f6b3={};_0x11f6b3[_0x4aff69['name']]={'$like':'%'+_0x1b3950[_0x848f('0x34')][_0x848f('0x3f')]+'%'};return _0x11f6b3;}})});}_0x39884f=_[_0x848f('0x41')]({},_0x39884f,_0x1b3950[_0x848f('0x42')]);var _0x5bf0f1={'where':_0x39884f[_0x848f('0x3d')]};return db[_0x848f('0x2e')][_0x848f('0x22')](_0x5bf0f1)[_0x848f('0x27')](function(_0x387c33){_0x90f1ce['count']=_0x387c33;if(_0x1b3950[_0x848f('0x34')][_0x848f('0x43')]){_0x39884f[_0x848f('0x44')]=[{'all':!![]}];}return db[_0x848f('0x2e')]['findAll'](_0x39884f);})[_0x848f('0x27')](function(_0x215a0f){_0x90f1ce[_0x848f('0x45')]=_0x215a0f;return _0x90f1ce;})['then'](respondWithFilteredResult(_0x1a3d46,_0x39884f))[_0x848f('0x46')](handleError(_0x1a3d46,null));};exports[_0x848f('0x47')]=function(_0x34ea88,_0x398333){var _0x3c1de3={'raw':!![],'where':{'id':_0x34ea88[_0x848f('0x48')]['id']}},_0x2c15e5={};_0x2c15e5[_0x848f('0x33')]=_[_0x848f('0x35')](db[_0x848f('0x2e')][_0x848f('0x2f')]);_0x2c15e5['query']=_[_0x848f('0x35')](_0x34ea88[_0x848f('0x34')]);_0x2c15e5[_0x848f('0x36')]=_[_0x848f('0x37')](_0x2c15e5[_0x848f('0x33')],_0x2c15e5['query']);_0x3c1de3[_0x848f('0x38')]=_[_0x848f('0x37')](_0x2c15e5[_0x848f('0x33')],qs[_0x848f('0x39')](_0x34ea88[_0x848f('0x34')][_0x848f('0x39')]));_0x3c1de3[_0x848f('0x38')]=_0x3c1de3['attributes'][_0x848f('0x3a')]?_0x3c1de3[_0x848f('0x38')]:_0x2c15e5[_0x848f('0x33')];if(_0x34ea88['query'][_0x848f('0x43')]){_0x3c1de3[_0x848f('0x44')]=[{'all':!![]}];}_0x3c1de3=_[_0x848f('0x41')]({},_0x3c1de3,_0x34ea88[_0x848f('0x42')]);return db[_0x848f('0x2e')][_0x848f('0x49')](_0x3c1de3)['then'](handleEntityNotFound(_0x398333,null))[_0x848f('0x27')](respondWithResult(_0x398333,null))[_0x848f('0x46')](handleError(_0x398333,null));};exports[_0x848f('0x4a')]=function(_0x168f81,_0x110f91){return db['ChatGroup']['create'](_0x168f81[_0x848f('0x4b')],{})[_0x848f('0x27')](respondWithResult(_0x110f91,0xc9))[_0x848f('0x46')](handleError(_0x110f91,null));};exports['update']=function(_0x3d28d2,_0x561141){if(_0x3d28d2[_0x848f('0x4b')]['id']){delete _0x3d28d2[_0x848f('0x4b')]['id'];}return db[_0x848f('0x2e')][_0x848f('0x49')]({'where':{'id':_0x3d28d2[_0x848f('0x48')]['id']}})[_0x848f('0x27')](handleEntityNotFound(_0x561141,null))['then'](saveUpdates(_0x3d28d2['body'],null))['then'](respondWithResult(_0x561141,null))['catch'](handleError(_0x561141,null));};exports[_0x848f('0x28')]=function(_0x24dc45,_0x3d1505){return db[_0x848f('0x2e')]['find']({'where':{'id':_0x24dc45[_0x848f('0x48')]['id']}})[_0x848f('0x27')](handleEntityNotFound(_0x3d1505,null))['then'](removeEntity(_0x3d1505,null))[_0x848f('0x46')](handleError(_0x3d1505,null));};exports[_0x848f('0x4c')]=function(_0x23631d,_0x317bf8){return db[_0x848f('0x2e')][_0x848f('0x4c')]()[_0x848f('0x27')](respondWithResult(_0x317bf8,null))[_0x848f('0x46')](handleError(_0x317bf8,null));};exports[_0x848f('0x4d')]=function(_0x5d4b61,_0x5dad98,_0x4d400a){return db[_0x848f('0x4e')][_0x848f('0x22')]({'where':{'ChatGroupId':_0x5d4b61['params']['id'],'ToId':_0x5d4b61[_0x848f('0x4f')]['id'],'read':![]}})[_0x848f('0x27')](function(_0x5dccb1){return{'id':_['toInteger'](_0x5d4b61[_0x848f('0x48')]['id']),'count':_0x5dccb1};})['then'](respondWithResult(_0x5dad98,null))[_0x848f('0x46')](handleError(_0x5dad98,null));};exports[_0x848f('0x50')]=function(_0x3c1309,_0x1bac0a,_0x18d391){return db[_0x848f('0x2e')][_0x848f('0x49')]({'where':{'id':_0x3c1309[_0x848f('0x48')]['id']}})[_0x848f('0x27')](handleEntityNotFound(_0x1bac0a,null))[_0x848f('0x27')](function(_0x27074c){if(_0x27074c){return _0x27074c[_0x848f('0x50')](_0x3c1309[_0x848f('0x4b')][_0x848f('0x51')],_[_0x848f('0x52')](_0x3c1309['body'],[_0x848f('0x51'),'id'])||{});}})[_0x848f('0x27')](respondWithResult(_0x1bac0a,null))['catch'](handleError(_0x1bac0a,null));};exports['getMembers']=function(_0x313477,_0x374ae5,_0xa387e3){var _0x1c596f={};var _0x29c6a5={};var _0x377361;var _0x3a93b6;return db[_0x848f('0x2e')][_0x848f('0x53')]({'where':{'id':_0x313477[_0x848f('0x48')]['id']}})[_0x848f('0x27')](handleEntityNotFound(_0x374ae5,null))[_0x848f('0x27')](function(_0x2667d2){if(_0x2667d2){_0x377361=_0x2667d2;_0x29c6a5[_0x848f('0x33')]=_[_0x848f('0x35')](db['User'][_0x848f('0x2f')]);_0x29c6a5['query']=_[_0x848f('0x35')](_0x313477['query']);_0x29c6a5[_0x848f('0x36')]=_[_0x848f('0x37')](_0x29c6a5[_0x848f('0x33')],_0x29c6a5['query']);_0x1c596f[_0x848f('0x38')]=_[_0x848f('0x37')](_0x29c6a5[_0x848f('0x33')],qs['fields'](_0x313477[_0x848f('0x34')][_0x848f('0x39')]));_0x1c596f[_0x848f('0x38')]=_0x1c596f[_0x848f('0x38')][_0x848f('0x3a')]?_0x1c596f['attributes']:_0x29c6a5['model'];_0x1c596f[_0x848f('0x54')]=qs[_0x848f('0x3c')](_0x313477['query'][_0x848f('0x3c')]);_0x1c596f['where']=qs[_0x848f('0x36')](_[_0x848f('0x3e')](_0x313477[_0x848f('0x34')],_0x29c6a5['filters']));if(_0x313477[_0x848f('0x34')]['filter']){_0x1c596f['where']=_[_0x848f('0x41')](_0x1c596f[_0x848f('0x3d')],{'$or':_[_0x848f('0x2d')](_0x1c596f[_0x848f('0x38')],function(_0x103eef){var _0x3d481f={};_0x3d481f[_0x103eef]={'$like':'%'+_0x313477[_0x848f('0x34')]['filter']+'%'};return _0x3d481f;})});}_0x1c596f=_[_0x848f('0x41')]({},_0x1c596f,_0x313477[_0x848f('0x42')]);return _0x377361[_0x848f('0x55')](_0x1c596f);}})[_0x848f('0x27')](function(_0x1dc500){if(_0x1dc500){_0x3a93b6=_0x1dc500[_0x848f('0x3a')];if(!_0x313477[_0x848f('0x34')]['hasOwnProperty'](_0x848f('0x56'))){_0x1c596f[_0x848f('0x21')]=qs['limit'](_0x313477[_0x848f('0x34')][_0x848f('0x21')]);_0x1c596f[_0x848f('0x1f')]=qs[_0x848f('0x1f')](_0x313477[_0x848f('0x34')][_0x848f('0x1f')]);}return _0x377361[_0x848f('0x55')](_0x1c596f);}})[_0x848f('0x27')](function(_0x26071d){if(_0x26071d){return _0x26071d?{'count':_0x3a93b6,'rows':_0x26071d}:null;}})[_0x848f('0x27')](respondWithResult(_0x374ae5,null))[_0x848f('0x46')](handleError(_0x374ae5,null));};exports[_0x848f('0x57')]=function(_0x209da5,_0x72e699,_0x55d719){return db['ChatGroup'][_0x848f('0x49')]({'where':{'id':_0x209da5[_0x848f('0x48')]['id']}})[_0x848f('0x27')](handleEntityNotFound(_0x72e699,null))[_0x848f('0x27')](function(_0x2c6466){if(_0x2c6466){return _0x2c6466[_0x848f('0x57')](_0x209da5[_0x848f('0x34')]['ids']);}})[_0x848f('0x27')](respondWithStatusCode(_0x72e699,null))[_0x848f('0x46')](handleError(_0x72e699,null));};exports[_0x848f('0x58')]=function(_0x439b6d,_0x1d70d8,_0x4be3a6){if(_0x439b6d[_0x848f('0x4b')]['id']){delete _0x439b6d['body']['id'];}return db['ChatGroup']['find']({'where':{'id':_0x439b6d[_0x848f('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d70d8,null))['then'](function(_0x29d974){if(_0x29d974){_0x439b6d[_0x848f('0x4b')][_0x848f('0x59')]=_0x29d974['id'];return db[_0x848f('0x4e')]['create'](_0x439b6d[_0x848f('0x4b')]);}})[_0x848f('0x27')](respondWithResult(_0x1d70d8,null))[_0x848f('0x46')](handleError(_0x1d70d8,null));};exports['getMessages']=function(_0x118418,_0x4898bf,_0x2f4caf){var _0x1cc371={};var _0x4929ff={};var _0x1901af;var _0x25ec71;return db[_0x848f('0x2e')][_0x848f('0x53')]({'where':{'id':_0x118418[_0x848f('0x48')]['id']}})[_0x848f('0x27')](handleEntityNotFound(_0x4898bf,null))[_0x848f('0x27')](function(_0x2d61fb){if(_0x2d61fb){_0x1901af=_0x2d61fb;_0x4929ff['model']=_['keys'](db[_0x848f('0x4e')][_0x848f('0x2f')]);_0x4929ff[_0x848f('0x34')]=_[_0x848f('0x35')](_0x118418[_0x848f('0x34')]);_0x4929ff[_0x848f('0x36')]=_[_0x848f('0x37')](_0x4929ff[_0x848f('0x33')],_0x4929ff['query']);_0x1cc371[_0x848f('0x38')]=_['intersection'](_0x4929ff[_0x848f('0x33')],qs['fields'](_0x118418[_0x848f('0x34')][_0x848f('0x39')]));_0x1cc371[_0x848f('0x38')]=_0x1cc371[_0x848f('0x38')]['length']?_0x1cc371[_0x848f('0x38')]:_0x4929ff[_0x848f('0x33')];_0x1cc371[_0x848f('0x54')]=qs[_0x848f('0x3c')](_0x118418[_0x848f('0x34')][_0x848f('0x3c')]);_0x1cc371[_0x848f('0x3d')]=qs[_0x848f('0x36')](_[_0x848f('0x3e')](_0x118418[_0x848f('0x34')],_0x4929ff[_0x848f('0x36')]));if(_0x118418[_0x848f('0x34')]['filter']){_0x1cc371[_0x848f('0x3d')]=_[_0x848f('0x41')](_0x1cc371[_0x848f('0x3d')],{'$or':_[_0x848f('0x2d')](_0x1cc371[_0x848f('0x38')],function(_0x50db42){var _0x210f91={};_0x210f91[_0x50db42]={'$like':'%'+_0x118418['query'][_0x848f('0x3f')]+'%'};return _0x210f91;})});}if(_0x118418['query'][_0x848f('0x5a')]){var _0xcb52af=_0x118418[_0x848f('0x34')][_0x848f('0x5a')]['split'](',');var _0xfc31fc={};_0xfc31fc[_0xcb52af[0x0]]={'$gte':moment(_0xcb52af[0x1])[_0x848f('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1cc371[_0x848f('0x3d')]=_['merge'](_0x1cc371['where'],_0xfc31fc);}_0x1cc371=_[_0x848f('0x41')]({},_0x1cc371,_0x118418[_0x848f('0x42')]);return _0x1901af[_0x848f('0x5c')](_0x1cc371);}})[_0x848f('0x27')](function(_0x59133a){if(_0x59133a){_0x25ec71=_0x59133a[_0x848f('0x3a')];if(!_0x118418[_0x848f('0x34')][_0x848f('0x3b')](_0x848f('0x56'))){_0x1cc371['limit']=qs['limit'](_0x118418[_0x848f('0x34')][_0x848f('0x21')]);_0x1cc371[_0x848f('0x1f')]=qs[_0x848f('0x1f')](_0x118418['query'][_0x848f('0x1f')]);}return _0x1901af[_0x848f('0x5c')](_0x1cc371);}})[_0x848f('0x27')](function(_0x28eaee){if(_0x28eaee){return _0x28eaee?{'count':_0x25ec71,'rows':_0x28eaee}:null;}})[_0x848f('0x27')](respondWithResult(_0x4898bf,null))[_0x848f('0x46')](handleError(_0x4898bf,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 49e152c..dd1165e 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 _0x3a20=['update','emit','hook','../../mysqldb','setMaxListeners'];(function(_0x259bc2,_0x3b7c21){var _0x15dc72=function(_0x4882c6){while(--_0x4882c6){_0x259bc2['push'](_0x259bc2['shift']());}};_0x15dc72(++_0x3b7c21);}(_0x3a20,0xd0));var _0x03a2=function(_0x16582e,_0x51e91e){_0x16582e=_0x16582e-0x0;var _0x14314b=_0x3a20[_0x16582e];return _0x14314b;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x03a2('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x03a2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x03a2('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5ea125){return function(_0x48afbd,_0x1bc8b4,_0x5ca482){ChatGroupEvents[_0x03a2('0x3')](_0x5ea125+':'+_0x48afbd['id'],_0x48afbd);ChatGroupEvents[_0x03a2('0x3')](_0x5ea125,_0x48afbd);_0x5ca482(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x03a2('0x4')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x1d63=['hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0x2ae881,_0x1d223a){var _0x572d1e=function(_0x4b0229){while(--_0x4b0229){_0x2ae881['push'](_0x2ae881['shift']());}};_0x572d1e(++_0x1d223a);}(_0x1d63,0xa4));var _0x31d6=function(_0x165c9d,_0xedb680){_0x165c9d=_0x165c9d-0x0;var _0x294ab1=_0x1d63[_0x165c9d];return _0x294ab1;};'use strict';var EventEmitter=require(_0x31d6('0x0'));var ChatGroup=require(_0x31d6('0x1'))['db'][_0x31d6('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x31d6('0x3')](0x0);var events={'afterCreate':_0x31d6('0x4'),'afterUpdate':'update','afterDestroy':_0x31d6('0x5')};function emitEvent(_0x44ebb1){return function(_0x27c1c8,_0xe4dc8b,_0x3e83c7){ChatGroupEvents[_0x31d6('0x6')](_0x44ebb1+':'+_0x27c1c8['id'],_0x27c1c8);ChatGroupEvents[_0x31d6('0x6')](_0x44ebb1,_0x27c1c8);_0x3e83c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x31d6('0x7')](e,emitEvent(event));}}module[_0x31d6('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 701cbbd..0ebda9a 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 _0xaa55=['define','ChatGroup','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x506881,_0x1e8d5b){var _0x54df59=function(_0x1e5648){while(--_0x1e5648){_0x506881['push'](_0x506881['shift']());}};_0x54df59(++_0x1e8d5b);}(_0xaa55,0xde));var _0x5aa5=function(_0x470628,_0x4d1abb){_0x470628=_0x470628-0x0;var _0x4ff5e5=_0xaa55[_0x470628];return _0x4ff5e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5aa5('0x0'))(_0x5aa5('0x1'));var moment=require(_0x5aa5('0x2'));var BPromise=require(_0x5aa5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5aa5('0x4'));var rimraf=require(_0x5aa5('0x5'));var config=require(_0x5aa5('0x6'));var attributes=require(_0x5aa5('0x7'));module[_0x5aa5('0x8')]=function(_0x15bebf,_0x4f649a){return _0x15bebf[_0x5aa5('0x9')](_0x5aa5('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3ec=['moment','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','util','api'];(function(_0x200b50,_0x4cf547){var _0x58e759=function(_0x5cbb73){while(--_0x5cbb73){_0x200b50['push'](_0x200b50['shift']());}};_0x58e759(++_0x4cf547);}(_0xe3ec,0x1a2));var _0xce3e=function(_0x50b087,_0x29e612){_0x50b087=_0x50b087-0x0;var _0x4d4d94=_0xe3ec[_0x50b087];return _0x4d4d94;};'use strict';var _=require('lodash');var util=require(_0xce3e('0x0'));var logger=require('../../config/logger')(_0xce3e('0x1'));var moment=require(_0xce3e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce3e('0x3'));var rimraf=require(_0xce3e('0x4'));var config=require(_0xce3e('0x5'));var attributes=require(_0xce3e('0x6'));module['exports']=function(_0x4508db,_0x5282b3){return _0x4508db[_0xce3e('0x7')](_0xce3e('0x8'),attributes,{'tableName':_0xce3e('0x9'),'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 10fe463..9c3707b 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 _0xb815=['localhost','socket.io-emitter','./chatGroup.socket','register','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x4b2037,_0x41055c){var _0x48599b=function(_0x251da3){while(--_0x251da3){_0x4b2037['push'](_0x4b2037['shift']());}};_0x48599b(++_0x41055c);}(_0xb815,0x160));var _0x5b81=function(_0x34c403,_0x341b70){_0x34c403=_0x34c403-0x0;var _0x5bf2b9=_0xb815[_0x34c403];return _0x5bf2b9;};'use strict';var _=require(_0x5b81('0x0'));var util=require(_0x5b81('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b81('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b81('0x3'))['db'];var utils=require(_0x5b81('0x4'));var logger=require(_0x5b81('0x5'))(_0x5b81('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b81('0x7'));var client=jayson[_0x5b81('0x8')][_0x5b81('0x9')]({'port':0x232a});config[_0x5b81('0xa')]=_[_0x5b81('0xb')](config[_0x5b81('0xa')],{'host':_0x5b81('0xc'),'port':0x18eb});var socket=require(_0x5b81('0xd'))(new Redis(config[_0x5b81('0xa')]));require(_0x5b81('0xe'))[_0x5b81('0xf')](socket);function respondWithRpcPromise(_0x1bd508,_0x3b480c,_0x5345f8){return new BPromise(function(_0x4153f0,_0x21bb6d){return client['request'](_0x1bd508,_0x5345f8)[_0x5b81('0x10')](function(_0x3d2296){logger[_0x5b81('0x11')]('ChatGroup,\x20%s,\x20%s',_0x3b480c,_0x5b81('0x12'));logger[_0x5b81('0x13')](_0x5b81('0x14'),_0x3b480c,_0x5b81('0x12'),JSON[_0x5b81('0x15')](_0x3d2296));if(_0x3d2296[_0x5b81('0x16')]){if(_0x3d2296[_0x5b81('0x16')]['code']===0x1f4){logger[_0x5b81('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3b480c,_0x3d2296[_0x5b81('0x16')][_0x5b81('0x17')]);return _0x21bb6d(_0x3d2296[_0x5b81('0x16')][_0x5b81('0x17')]);}logger[_0x5b81('0x16')](_0x5b81('0x18'),_0x3b480c,_0x3d2296[_0x5b81('0x16')][_0x5b81('0x17')]);return _0x4153f0(_0x3d2296[_0x5b81('0x16')][_0x5b81('0x17')]);}else{logger[_0x5b81('0x11')]('ChatGroup,\x20%s,\x20%s',_0x3b480c,_0x5b81('0x12'));_0x4153f0(_0x3d2296[_0x5b81('0x19')][_0x5b81('0x17')]);}})['catch'](function(_0xfa7f55){logger['error'](_0x5b81('0x18'),_0x3b480c,_0xfa7f55);_0x21bb6d(_0xfa7f55);});});} \ No newline at end of file +var _0x7217=['then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});config[_0x7721('0xb')]=_[_0x7721('0xc')](config[_0x7721('0xb')],{'host':_0x7721('0xd'),'port':0x18eb});var socket=require(_0x7721('0xe'))(new Redis(config[_0x7721('0xb')]));require(_0x7721('0xf'))[_0x7721('0x10')](socket);function respondWithRpcPromise(_0x138740,_0x2c3986,_0x578d59){return new BPromise(function(_0x461d1a,_0x29bc8f){return client[_0x7721('0x11')](_0x138740,_0x578d59)[_0x7721('0x12')](function(_0xa8977c){logger[_0x7721('0x13')](_0x7721('0x14'),_0x2c3986,_0x7721('0x15'));logger['debug'](_0x7721('0x16'),_0x2c3986,_0x7721('0x15'),JSON['stringify'](_0xa8977c));if(_0xa8977c[_0x7721('0x17')]){if(_0xa8977c[_0x7721('0x17')][_0x7721('0x18')]===0x1f4){logger[_0x7721('0x17')]('ChatGroup,\x20%s,\x20%s',_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x29bc8f(_0xa8977c['error']['message']);}logger['error'](_0x7721('0x14'),_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x461d1a(_0xa8977c[_0x7721('0x17')]['message']);}else{logger[_0x7721('0x13')]('ChatGroup,\x20%s,\x20%s',_0x2c3986,_0x7721('0x15'));_0x461d1a(_0xa8977c['result'][_0x7721('0x19')]);}})[_0x7721('0x1a')](function(_0x3ab5a5){logger[_0x7721('0x17')](_0x7721('0x14'),_0x2c3986,_0x3ab5a5);_0x29bc8f(_0x3ab5a5);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 36c5c08..d37b7df 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 _0xa2bb=['removeListener','register','length','remove','update'];(function(_0x3a931e,_0x583292){var _0x4fd6b6=function(_0x287a64){while(--_0x287a64){_0x3a931e['push'](_0x3a931e['shift']());}};_0x4fd6b6(++_0x583292);}(_0xa2bb,0x175));var _0xba2b=function(_0x525782,_0x18c4b9){_0x525782=_0x525782-0x0;var _0x4684cc=_0xa2bb[_0x525782];return _0x4684cc;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0xba2b('0x0'),_0xba2b('0x1')];function createListener(_0x598eaf,_0x35aa9e){return function(_0xc5e29a){_0x35aa9e['emit'](_0x598eaf,_0xc5e29a);};}function removeListener(_0x1cbed3,_0x557f51){return function(){ChatGroupEvents[_0xba2b('0x2')](_0x1cbed3,_0x557f51);};}exports[_0xba2b('0x3')]=function(_0x4ef15b){for(var _0xac80a5=0x0,_0x5eac4b=events[_0xba2b('0x4')];_0xac80a5<_0x5eac4b;_0xac80a5++){var _0x5a762b=events[_0xac80a5];var _0x3826f1=createListener('chatGroup:'+_0x5a762b,_0x4ef15b);ChatGroupEvents['on'](_0x5a762b,_0x3826f1);}}; \ No newline at end of file +var _0x5910=['removeListener','register','length','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0x97ade9,_0x568fad){var _0x171e11=function(_0x1d280a){while(--_0x1d280a){_0x97ade9['push'](_0x97ade9['shift']());}};_0x171e11(++_0x568fad);}(_0x5910,0x12c));var _0x0591=function(_0x1f0398,_0x4a96ef){_0x1f0398=_0x1f0398-0x0;var _0x1c35cd=_0x5910[_0x1f0398];return _0x1c35cd;};'use strict';var ChatGroupEvents=require(_0x0591('0x0'));var events=['save',_0x0591('0x1'),_0x0591('0x2')];function createListener(_0x15644e,_0xb4dd9f){return function(_0x4b499d){_0xb4dd9f[_0x0591('0x3')](_0x15644e,_0x4b499d);};}function removeListener(_0x58936a,_0xc0de1f){return function(){ChatGroupEvents[_0x0591('0x4')](_0x58936a,_0xc0de1f);};}exports[_0x0591('0x5')]=function(_0x58e506){for(var _0xaa8e8f=0x0,_0x2247aa=events[_0x0591('0x6')];_0xaa8e8f<_0x2247aa;_0xaa8e8f++){var _0x1c0a63=events[_0xaa8e8f];var _0x3babfb=createListener(_0x0591('0x7')+_0x1c0a63,_0x58e506);ChatGroupEvents['on'](_0x1c0a63,_0x3babfb);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 596db25..e83e449 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 _0x0da6=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','create','post','addMessage','put','update','delete','removeMembers','multer','util','path','express','fs-extra'];(function(_0x4c3c7d,_0x126158){var _0x3762c8=function(_0x2cdf1e){while(--_0x2cdf1e){_0x4c3c7d['push'](_0x4c3c7d['shift']());}};_0x3762c8(++_0x126158);}(_0x0da6,0x1c3));var _0x60da=function(_0x246a98,_0xdf59a8){_0x246a98=_0x246a98-0x0;var _0x3b8b79=_0x0da6[_0x246a98];return _0x3b8b79;};'use strict';var multer=require(_0x60da('0x0'));var util=require(_0x60da('0x1'));var path=require(_0x60da('0x2'));var timeout=require('connect-timeout');var express=require(_0x60da('0x3'));var router=express['Router']();var fs_extra=require(_0x60da('0x4'));var auth=require(_0x60da('0x5'));var interaction=require(_0x60da('0x6'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x60da('0x7')]('/',auth[_0x60da('0x8')](),controller['index']);router[_0x60da('0x7')](_0x60da('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x60da('0x7')](_0x60da('0xa'),auth[_0x60da('0x8')](),controller[_0x60da('0xb')]);router[_0x60da('0x7')](_0x60da('0xc'),auth[_0x60da('0x8')](),controller[_0x60da('0xd')]);router[_0x60da('0x7')](_0x60da('0xe'),auth[_0x60da('0x8')](),controller[_0x60da('0xf')]);router['get'](_0x60da('0x10'),auth[_0x60da('0x8')](),controller['getMessages']);router['post']('/',auth[_0x60da('0x8')](),controller[_0x60da('0x11')]);router['post'](_0x60da('0xe'),auth['isAuthenticated'](),controller['addMembers']);router[_0x60da('0x12')](_0x60da('0x10'),auth[_0x60da('0x8')](),controller[_0x60da('0x13')]);router[_0x60da('0x14')](_0x60da('0xa'),auth[_0x60da('0x8')](),controller[_0x60da('0x15')]);router['delete']('/:id',auth[_0x60da('0x8')](),controller['destroy']);router[_0x60da('0x16')](_0x60da('0xe'),auth[_0x60da('0x8')](),controller[_0x60da('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0144=['describe','/:id','isAuthenticated','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','/:id/messages','put','delete','destroy','removeMembers','exports','multer','connect-timeout','fs-extra','../../config/environment','./chatGroup.controller','get','index','/describe'];(function(_0x40a545,_0x5a2595){var _0x5888da=function(_0x3d3e6c){while(--_0x3d3e6c){_0x40a545['push'](_0x40a545['shift']());}};_0x5888da(++_0x5a2595);}(_0x0144,0xb8));var _0x4014=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x0144[_0x1e2321];return _0x1d346d;};'use strict';var multer=require(_0x4014('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4014('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4014('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4014('0x3'));var controller=require(_0x4014('0x4'));router[_0x4014('0x5')]('/',auth['isAuthenticated'](),controller[_0x4014('0x6')]);router[_0x4014('0x5')](_0x4014('0x7'),auth['isAuthenticated'](),controller[_0x4014('0x8')]);router['get'](_0x4014('0x9'),auth[_0x4014('0xa')](),controller[_0x4014('0xb')]);router['get'](_0x4014('0xc'),auth['isAuthenticated'](),controller[_0x4014('0xd')]);router['get'](_0x4014('0xe'),auth['isAuthenticated'](),controller[_0x4014('0xf')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x4014('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4014('0x11')](_0x4014('0xe'),auth[_0x4014('0xa')](),controller['addMembers']);router[_0x4014('0x11')](_0x4014('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0x4014('0x13')](_0x4014('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4014('0x14')](_0x4014('0x9'),auth[_0x4014('0xa')](),controller[_0x4014('0x15')]);router['delete']('/:id/members',auth[_0x4014('0xa')](),controller[_0x4014('0x16')]);module[_0x4014('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 17ee2c1..d1d45cf 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 _0x082b=['STRING','ENUM','sequelize','exports','BOOLEAN','INTEGER','star','thumb','TEXT','DATE'];(function(_0x139147,_0xdb9a5b){var _0x3851fe=function(_0x44f8ff){while(--_0x44f8ff){_0x139147['push'](_0x139147['shift']());}};_0x3851fe(++_0xdb9a5b);}(_0x082b,0x1ec));var _0xb082=function(_0x26e088,_0x3ef2fe){_0x26e088=_0x26e088-0x0;var _0x11814d=_0x082b[_0x26e088];return _0x11814d;};'use strict';var Sequelize=require(_0xb082('0x0'));module[_0xb082('0x1')]={'closed':{'type':Sequelize[_0xb082('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb082('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0xb082('0x4'),_0xb082('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xb082('0x6')]},'pathTranscript':{'type':Sequelize[_0xb082('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb082('0x7')]},'disposition':{'type':Sequelize[_0xb082('0x8')]},'secondDisposition':{'type':Sequelize[_0xb082('0x8')]},'thirdDisposition':{'type':Sequelize[_0xb082('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xb082('0x8')]},'browserVersion':{'type':Sequelize[_0xb082('0x8')]},'osName':{'type':Sequelize[_0xb082('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xb082('0x8')]},'deviceVendor':{'type':Sequelize[_0xb082('0x8')]},'deviceType':{'type':Sequelize[_0xb082('0x8')]},'referer':{'type':Sequelize[_0xb082('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xb082('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xb082('0x7')]},'lastMsgAt':{'type':Sequelize[_0xb082('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xb082('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xb082('0x8')]},'customerPort':{'type':Sequelize[_0xb082('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xb082('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xb082('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7df3=['BOOLEAN','sequelize','exports','INTEGER','star','TEXT','STRING','DATE','ENUM'];(function(_0x28be71,_0x1a660d){var _0x369de0=function(_0x259ec9){while(--_0x259ec9){_0x28be71['push'](_0x28be71['shift']());}};_0x369de0(++_0x1a660d);}(_0x7df3,0x1cc));var _0x37df=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7df3[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x37df('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x37df('0x3'),'thumb'),'defaultValue':_0x37df('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x37df('0x4')]},'mailTranscript':{'type':Sequelize[_0x37df('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x37df('0x6')]},'disposition':{'type':Sequelize[_0x37df('0x5')]},'secondDisposition':{'type':Sequelize[_0x37df('0x5')]},'thirdDisposition':{'type':Sequelize[_0x37df('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x37df('0x5')]},'osVersion':{'type':Sequelize[_0x37df('0x5')]},'deviceModel':{'type':Sequelize[_0x37df('0x5')]},'deviceVendor':{'type':Sequelize[_0x37df('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x37df('0x4')]},'customerIp':{'type':Sequelize[_0x37df('0x5')]},'formData':{'type':Sequelize[_0x37df('0x4')]('long')},'read1stAt':{'type':Sequelize[_0x37df('0x6')]},'lastMsgAt':{'type':Sequelize[_0x37df('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x37df('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x37df('0x5')]},'customerPort':{'type':Sequelize[_0x37df('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x37df('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x37df('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 8db9259..c6b913d 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 _0xb10b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','stack','name','send','body','contact','interaction','account','Users','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','some','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','catch','show','params','keys','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','close','mailTranscript','root','now','Messages','format','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','split','YYYY-MM-DD\x20HH:mm:ss','includeAgent','alias','findAll','setTags','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','disposition','osName','referer','customerPort','tail','existsSync','pipe','createWriteStream','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x12c7c4,_0x445b21){var _0x30bbdb=function(_0x3b9a58){while(--_0x3b9a58){_0x12c7c4['push'](_0x12c7c4['shift']());}};_0x30bbdb(++_0x445b21);}(_0xb10b,0x12a));var _0xbb10=function(_0x414d86,_0x32abf3){_0x414d86=_0x414d86-0x0;var _0x4170d6=_0xb10b[_0x414d86];return _0x4170d6;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xbb10('0x13'));var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))('api');var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb10('0x17'));var db=require(_0xbb10('0x18'))['db'];config[_0xbb10('0x19')]=_[_0xbb10('0x1a')](config[_0xbb10('0x19')],{'host':_0xbb10('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb10('0x19')]));require(_0xbb10('0x1c'))[_0xbb10('0x1d')](socket);var jayson=require(_0xbb10('0x1e'));var client=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232b});var client9004=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3e26f4,_0x2b184e,_0x4a2bfc,_0x2eca0f){return new BPromise(function(_0x1145f1,_0x133ac2){var _0x42db98=_0x2eca0f||client;return _0x42db98[_0xbb10('0x21')](_0x3e26f4,_0x4a2bfc)[_0xbb10('0x22')](function(_0x575cca){logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));logger['debug'](_0xbb10('0x26'),_0x2b184e,_0xbb10('0x25'),JSON[_0xbb10('0x27')](_0x575cca));if(_0x575cca[_0xbb10('0x28')]){if(_0x575cca[_0xbb10('0x28')][_0xbb10('0x29')]===0x1f4){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')]['message']);return _0x133ac2(_0x575cca['error'][_0xbb10('0x2a')]);}logger[_0xbb10('0x28')](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);return _0x1145f1(_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);}else{logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));_0x1145f1(_0x575cca[_0xbb10('0x2b')][_0xbb10('0x2a')]);}})['catch'](function(_0x4fedac){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x4fedac);_0x133ac2(_0x4fedac);});});}function respondWithStatusCode(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0xcc;return function(_0x4e25ff){if(_0x4e25ff){return _0x3c5ae7[_0xbb10('0x2c')](_0x2c89b9);}return _0x3c5ae7[_0xbb10('0x2d')](_0x2c89b9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xc8;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9)['json'](_0x20d946);}};}function respondWithFilteredResult(_0x3796c7,_0x21ac54){return function(_0xfc3595){if(_0xfc3595){var _0x2e0249=typeof _0x21ac54[_0xbb10('0x2f')]===_0xbb10('0x30')&&typeof _0x21ac54['limit']===_0xbb10('0x30');var _0x4ee02e=_0xfc3595[_0xbb10('0x31')];var _0x56f2da=_0x2e0249?0x0:_0x21ac54[_0xbb10('0x2f')];var _0x1dcc9c=_0x2e0249?_0xfc3595[_0xbb10('0x31')]:_0x21ac54['offset']+_0x21ac54['limit'];var _0x4c3744;if(_0x1dcc9c>=_0x4ee02e){_0x1dcc9c=_0x4ee02e;_0x4c3744=0xc8;}else{_0x4c3744=0xce;}_0x3796c7[_0xbb10('0x2d')](_0x4c3744);return _0x3796c7['set'](_0xbb10('0x32'),_0x56f2da+'-'+_0x1dcc9c+'/'+_0x4ee02e)[_0xbb10('0x33')](_0xfc3595);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x22')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x22')](function(){_0x188cbd[_0xbb10('0x2d')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x28')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}function getMustacheRender(_0x25d72f,_0x52de31){return Mustache['render'](_0x25d72f,_['merge'](_0x52de31[_0xbb10('0x3a')],{'contact':_0x52de31[_0xbb10('0x3b')],'message':_0x52de31[_0xbb10('0x2a')],'agent':_0x52de31['agent'],'interaction':_0x52de31[_0xbb10('0x3c')],'account':_0x52de31[_0xbb10('0x3d')]}))||'';}function getInteractionUsers(_0x4345f3,_0x4d1a83){return new BPromise(function(_0x17b6c5,_0x12238a){try{if(_0x4d1a83[_0x4345f3['id']]){_0x4345f3[_0xbb10('0x3e')]=_[_0xbb10('0x3f')](_0x4d1a83[_0x4345f3['id']],function(_0x4f1cdd){return{'id':_0x4f1cdd['id'],'fullname':_0x4f1cdd[_0xbb10('0x40')]};});}}catch(_0x110eb5){_0x12238a(_0x110eb5);}_0x17b6c5(_0x4345f3);});}function getInteractionTags(_0x5835fd,_0xe2040f){return new BPromise(function(_0x2e3214,_0x44d6ae){try{if(_0x5835fd[_0xbb10('0x41')]){_0x5835fd[_0xbb10('0x42')]=[];_0x5835fd[_0xbb10('0x41')]['split'](',')[_0xbb10('0x43')](function(_0x1c7fae){_0x5835fd[_0xbb10('0x42')][_0xbb10('0x44')](_0xe2040f[_0x1c7fae]);});}delete _0x5835fd['TagIds'];}catch(_0x3fff6c){_0x44d6ae(_0x3fff6c);}_0x2e3214(_0x5835fd);});}function updateChatInteraction(_0x331751,_0x23dc18,_0x403beb){return new BPromise(function(_0x5e2cfa,_0x351484){return getInteractionUsers(_0x331751,_0x403beb)[_0xbb10('0x22')](function(_0x54ac18){return getInteractionTags(_0x54ac18,_0x23dc18);})['then'](function(_0x38d78f){_0x5e2cfa(_0x38d78f);})['catch'](function(_0x318984){_0x351484(_0x318984);});});}exports[_0xbb10('0x45')]=function(_0x4c66d8,_0x366608){var _0x1d82bf={},_0x474e99={},_0x5cf4f8={'count':0x0,'rows':[]};var _0x2dd02b=_[_0xbb10('0x3f')](db[_0xbb10('0x46')][_0xbb10('0x47')],function(_0x36e1fa){return{'name':_0x36e1fa[_0xbb10('0x48')],'type':_0x36e1fa[_0xbb10('0x49')][_0xbb10('0x4a')]};});_0x474e99[_0xbb10('0x4b')]=_[_0xbb10('0x3f')](_0x2dd02b,_0xbb10('0x38'));_0x474e99[_0xbb10('0x4c')]=_['keys'](_0x4c66d8[_0xbb10('0x4c')]);_0x474e99[_0xbb10('0x4d')]=_['intersection'](_0x474e99[_0xbb10('0x4b')],_0x474e99[_0xbb10('0x4c')]);_0x1d82bf[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x474e99[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4c66d8[_0xbb10('0x4c')]['fields']));_0x1d82bf['attributes']=_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x51')]?_0x1d82bf[_0xbb10('0x4e')]:_0x474e99['model'];if(!_0x4c66d8['query'][_0xbb10('0x52')](_0xbb10('0x53'))){_0x1d82bf[_0xbb10('0x54')]=qs[_0xbb10('0x54')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x1d82bf[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x1d82bf['order']=qs['sort'](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x1d82bf[_0xbb10('0x56')]=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x4c66d8[_0xbb10('0x4c')],_0x474e99[_0xbb10('0x4d')]),_0x2dd02b);var _0x445870=[];var _0x1c0d8f=squel[_0xbb10('0x58')]()[_0xbb10('0x59')]('id')[_0xbb10('0x59')](_0xbb10('0x38'))[_0xbb10('0x59')](_0xbb10('0x5a'))['from'](_0xbb10('0x5b'));var _0x5bd44d=squel[_0xbb10('0x58')]()[_0xbb10('0x59')](_0xbb10('0x5c'))[_0xbb10('0x59')](_0xbb10('0x5d'))[_0xbb10('0x59')](_0xbb10('0x5e'))[_0xbb10('0x5f')](_0xbb10('0x60'),'ui')[_0xbb10('0x61')](_0xbb10('0x62'),'u',_0xbb10('0x63'));var _0x1d49e1=squel[_0xbb10('0x58')]()[_0xbb10('0x5f')]('chat_interactions','i')[_0xbb10('0x61')](_0xbb10('0x64'),'c',_0xbb10('0x65'))[_0xbb10('0x61')](_0xbb10('0x62'),'o',_0xbb10('0x66'))['left_join'](_0xbb10('0x67'),'a',_0xbb10('0x68'))[_0xbb10('0x61')](_0xbb10('0x69'),'me',_0xbb10('0x6a'))[_0xbb10('0x61')](_0xbb10('0x6b'),'it',_0xbb10('0x6c'))[_0xbb10('0x61')](_0xbb10('0x5b'),'t',_0xbb10('0x6d'));var _0x2a1ce1=squel[_0xbb10('0x6e')]();var _0x4e7fac=[];var _0x4ea1a6=squel[_0xbb10('0x6e')]();var _0x3e6338;if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x6f')]){_0x3e6338=as['parseSearch'](_0x4c66d8['query'][_0xbb10('0x6f')]);var _0xaf2cc3=_0x3e6338[_0xbb10('0x70')];for(var _0x2dd150=0x0;_0x2dd150<_0x3e6338[_0xbb10('0x71')][_0xbb10('0x51')];_0x2dd150++){var _0x45c0dc=_0x3e6338['conditions'][_0x2dd150];var _0x117e84='i';var _0x216cff=_['find'](_0x2dd02b,['name',_0x45c0dc['field']]);if(!_0x216cff){switch(_0x45c0dc[_0xbb10('0x59')]){case _0xbb10('0x72'):if(_0x45c0dc[_0xbb10('0x73')]==0x1){_0x1d49e1['having']('`'+_0x45c0dc['field']+'`\x20=\x200');}else{_0x1d49e1[_0xbb10('0x74')]('`'+_0x45c0dc[_0xbb10('0x59')]+_0xbb10('0x75'));}break;case'Contact':if(_0x45c0dc[_0xbb10('0x76')]===_0xbb10('0x77')){if(_0x45c0dc['value']['split']('\x20')[_0xbb10('0x51')]>0x1){_0x2a1ce1[_0xaf2cc3](_0xbb10('0x78'),qs[_0xbb10('0x79')](_0x45c0dc[_0xbb10('0x73')]),null);}else{var _0x54b7c5='%'+_0x45c0dc[_0xbb10('0x73')]+'%';_0x2a1ce1[_0xaf2cc3](_0xbb10('0x7a'),_0x54b7c5,_0x54b7c5,_0x54b7c5);}}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,['name',_0xbb10('0x7c')]);_0x45c0dc[_0xbb10('0x59')]=_0xbb10('0x7c');_0x329da7=as['buildExpression'](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x7f'):var _0x108e5b=_0x45c0dc[_0xbb10('0x73')]['split'](',')[_0xbb10('0x3f')](function(_0x277fe7){return Number(_0x277fe7);});_0x108e5b[_0xbb10('0x43')](function(_0x2ceb3e){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x2ceb3e+',%');});_0x4e7fac=_[_0xbb10('0x81')](_0x4e7fac,_0x108e5b);break;case _0xbb10('0x82'):if(_0x45c0dc['operator']==='$substring'){_0x2a1ce1[_0xaf2cc3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x45c0dc[_0xbb10('0x73')]+'%',null);}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,[_0xbb10('0x38'),'UserId']);_0x45c0dc['field']=_0xbb10('0x83');_0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x3a'):_0x329da7=as[_0xbb10('0x84')]('me',null,_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')]['start'],_0x329da7['value']['end']);break;}}else{var _0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}}}else{var _0x4bc316=_(_0x4c66d8['query'])['keys']()[_0xbb10('0x3f')](function(_0x13040d){return _[_0xbb10('0x85')](_0x2dd02b,[_0xbb10('0x38'),_0x13040d])?_0x13040d:undefined;})['compact']()[_0xbb10('0x73')]();if(!_['isEmpty'](_0x4bc316)){_0x4bc316['forEach'](function(_0x165fe9){if(_0x165fe9===_0xbb10('0x86')){_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),[][_0xbb10('0x88')](_0x4c66d8['query'][_0x165fe9]));}else if(_0x165fe9===_0xbb10('0x89')){var _0x19fcec=JSON[_0xbb10('0x8a')](_0x4c66d8[_0xbb10('0x4c')][_0x165fe9])[_0xbb10('0x8b')];var _0x27f42f=JSON[_0xbb10('0x8a')](_0x4c66d8['query'][_0x165fe9])[_0xbb10('0x8c')];_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x8d'),_0x19fcec,_0x27f42f);}else{if(_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]===_0xbb10('0x8e')){_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+_0xbb10('0x8f'));}else{_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+'\x20=\x20?',_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]);}}});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x90')]){if(_0x4c66d8['query']['read']==0x1){_0x1d49e1['having'](_0xbb10('0x91'));}else{_0x1d49e1['having']('`unreadMessages`\x20>\x200');}}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]){_0x4e7fac=_[_0xbb10('0x93')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')])?_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]:new Array(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]);_0x4e7fac['forEach'](function(_0x318a14){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x318a14+',%');});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x94')]){var _0x5c8eb8=_0x4c66d8['query'][_0xbb10('0x94')][_0xbb10('0x95')]('\x5c','\x5c\x5c')[_0xbb10('0x95')](/'/g,'\x27\x27');if(qs[_0xbb10('0x96')](_0x5c8eb8)){_0x2a1ce1['or']('i.id\x20LIKE\x20?',_0x5c8eb8+'%');}else{_0x2a1ce1['or'](_0xbb10('0x97'),qs[_0xbb10('0x79')](_0x5c8eb8))['or'](_0xbb10('0x98'),_0x5c8eb8+'%');}}}_0x1d49e1[_0xbb10('0x56')](_0x2a1ce1);_0x1d49e1[_0xbb10('0x99')]('i.id');var _0x5f0691={'type':db[_0xbb10('0x9a')][_0xbb10('0x9b')][_0xbb10('0x9c')],'raw':!![]};var _0x5239da=_0x1d49e1[_0xbb10('0x9d')]();_0x5239da[_0xbb10('0x59')]('i.id');_0x5239da['field'](_0xbb10('0x9e'),_0xbb10('0x72'));if(_0x1d82bf[_0xbb10('0x9f')]){_0x1d82bf['order'][_0xbb10('0x43')](function(_0x3a17fc){var _0xfbb365=_0x3a17fc[0x0]===_0xbb10('0xa0')?_0x3a17fc[0x0]:'i.'+_0x3a17fc[0x0];_0x1d49e1[_0xbb10('0x9f')](_0xfbb365,_0x3a17fc[0x1]===_0xbb10('0xa1')?![]:!![]);});}if(!_[_0xbb10('0xa2')](_0x4e7fac)){_0x1d49e1[_0xbb10('0x74')](_0x4ea1a6);_0x5239da[_0xbb10('0x56')]('t.id\x20IN\x20?',_0x4e7fac);}BPromise[_0xbb10('0xa3')]()[_0xbb10('0x22')](function(){if(!_0x3e6338){if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x86')])return;_0x5239da[_0xbb10('0x56')](_0xbb10('0xa4'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0xa4'));return;}if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]!==_0xbb10('0xa7'))return;return _0x4c66d8[_0xbb10('0xa5')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0xe1fc51){if(_[_0xbb10('0xa2')](_0xe1fc51)){_0x5239da[_0xbb10('0x56')](_0xbb10('0xa8'));_0x1d49e1[_0xbb10('0x56')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x5239da[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));}});})['then'](function(){if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]==='agent'&&!_0x3e6338&&!_0x4c66d8[_0xbb10('0x4c')]['ChatWebsiteId'])return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5239da[_0xbb10('0xaa')](),_0x5f0691);})[_0xbb10('0x22')](function(_0x3a4a6e){_0x5cf4f8['count']=_0x3a4a6e[_0xbb10('0x51')];if(_0x5cf4f8['count']===0x0)return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x1c0d8f['toString'](),_0x5f0691)['then'](function(_0x415407){_0x445870=_[_0xbb10('0xab')](_0x415407,'id');_0x5f0691=_[_0xbb10('0xac')](_0x5f0691,{'model':db[_0xbb10('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x50')]){_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x43')](function(_0x252ab8){_0x1d49e1[_0xbb10('0x59')]('i.'+_0x252ab8);});}else{_0x1d49e1[_0xbb10('0x59')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbb10('0x72'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xad'),_0xbb10('0xae'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xaf'),_0xbb10('0xb0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb1'),_0xbb10('0xa0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb2'));_0x1d49e1['field'](_0xbb10('0xb3'),'Contact.firstName');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb4'),_0xbb10('0xb5'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb6'),'Contact.email');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb7'),_0xbb10('0xb8'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb9'),_0xbb10('0xba'));_0x1d49e1['field']('c.fax',_0xbb10('0xbb'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbc'),'Owner.fullname');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbd'),'Owner.internal');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbe'),'TagIds');}if(_0x1d82bf[_0xbb10('0x54')])_0x1d49e1['limit'](_0x1d82bf[_0xbb10('0x54')]);if(_0x1d82bf[_0xbb10('0x2f')])_0x1d49e1['offset'](_0x1d82bf[_0xbb10('0x2f')]);return db[_0xbb10('0xa9')]['query'](_0x1d49e1['toString'](),_0x5f0691);})[_0xbb10('0x22')](function(_0x13ae83){if(_0x13ae83[_0xbb10('0x51')]>0x0)_0x5bd44d[_0xbb10('0x56')](_0xbb10('0xbf'),_['map'](_0x13ae83,'id'));return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5bd44d[_0xbb10('0xaa')](),_0x5f0691)['then'](function(_0xd68afa){var _0x4f90e6=_[_0xbb10('0xc0')](_0xd68afa,_0xbb10('0xc1'));var _0x44a3e1=[];_0x13ae83[_0xbb10('0x43')](function(_0x1f55d3){_0x44a3e1[_0xbb10('0x44')](updateChatInteraction(_0x1f55d3,_0x445870,_0x4f90e6));});return BPromise[_0xbb10('0xc2')](_0x44a3e1);});});})['then'](function(_0x4fc544){_0x5cf4f8[_0xbb10('0xc3')]=_0x4fc544;return _0x5cf4f8;})[_0xbb10('0x22')](respondWithFilteredResult(_0x366608,_0x1d82bf))[_0xbb10('0xc4')](handleError(_0x366608,null));};exports[_0xbb10('0xc5')]=function(_0x20b585,_0x363b81){var _0x1cccec={'raw':![],'where':{'id':_0x20b585[_0xbb10('0xc6')]['id']}},_0x1674f7={};_0x1674f7[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db[_0xbb10('0x46')][_0xbb10('0x47')]);_0x1674f7['query']=_[_0xbb10('0xc7')](_0x20b585[_0xbb10('0x4c')]);_0x1674f7[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],_0x1674f7[_0xbb10('0x4c')]);_0x1cccec[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x20b585[_0xbb10('0x4c')]['fields']));_0x1cccec[_0xbb10('0x4e')]=_0x1cccec['attributes'][_0xbb10('0x51')]?_0x1cccec[_0xbb10('0x4e')]:_0x1674f7[_0xbb10('0x4b')];if(_0x20b585[_0xbb10('0x4c')][_0xbb10('0xc8')]){_0x1cccec[_0xbb10('0xc9')]=[{'all':!![]}];}_0x1cccec=_['merge']({},_0x1cccec,_0x20b585[_0xbb10('0xca')]);return db['ChatInteraction'][_0xbb10('0x7b')](_0x1cccec)[_0xbb10('0x22')](handleEntityNotFound(_0x363b81,null))[_0xbb10('0x22')](respondWithResult(_0x363b81,null))[_0xbb10('0xc4')](handleError(_0x363b81,null));};exports[_0xbb10('0xcb')]=function(_0x31907e,_0x4f06c){return db[_0xbb10('0x46')][_0xbb10('0xcb')](_0x31907e[_0xbb10('0x3a')],{})[_0xbb10('0x22')](respondWithResult(_0x4f06c,0xc9))[_0xbb10('0xc4')](handleError(_0x4f06c,null));};exports['update']=function(_0x3696b3,_0x516520){if(_0x3696b3[_0xbb10('0x3a')]['id']){delete _0x3696b3[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x3696b3[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x516520,null))[_0xbb10('0x22')](saveUpdates(_0x3696b3['body'],null))[_0xbb10('0x22')](respondWithResult(_0x516520,null))['catch'](handleError(_0x516520,null));};exports['destroy']=function(_0x1513e0,_0x35cbb9){return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x1513e0[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x35cbb9,null))['then'](removeEntity(_0x35cbb9,null))[_0xbb10('0xc4')](handleError(_0x35cbb9,null));};exports[_0xbb10('0xcc')]=function(_0x39aa9e,_0xb1b7c8){return db[_0xbb10('0x46')][_0xbb10('0xcc')]()['then'](respondWithResult(_0xb1b7c8,null))[_0xbb10('0xc4')](handleError(_0xb1b7c8,null));};exports[_0xbb10('0xcd')]=function(_0xb7c454,_0xa8b7c3){var _0x31718f=_0xb7c454[_0xbb10('0xc6')]['id'];var _0x2764e1;var _0x5e405b;var _0x33a43e;return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x31718f}})['then'](function(_0x4c8b68){_0x2764e1=_0x4c8b68;return db[_0xbb10('0xcf')][_0xbb10('0xce')]({'where':{'id':_0x4c8b68[_0xbb10('0x86')]},'attributes':['id',_0xbb10('0xd0'),_0xbb10('0xd1'),'vidaooTopic',_0xbb10('0xd2'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x4dd138){if(_0x4dd138&&_0x4dd138[_0xbb10('0xd0')]&&_0x4dd138[_0xbb10('0xd1')]){_0x5e405b=_0x4dd138;var _0x1b9012={'interaction':{'id':_0x31718f},'agent':{'id':_0xb7c454[_0xbb10('0xa5')]['id'],'name':_0xb7c454[_0xbb10('0xa5')]['name'],'fullname':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0x40')],'email':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]},'contact':_0xb7c454[_0xbb10('0x3a')][_0xbb10('0x3b')],'account':_0xb7c454[_0xbb10('0x3a')]['account']};var _0x4c95c2={'rejectUnauthorized':![],'method':'POST','url':_0xbb10('0xd4'),'headers':{'X-APIKEY':_0x4dd138[_0xbb10('0xd0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]],'buttons':null,'topic':_0x5e405b[_0xbb10('0xd5')],'note':_[_0xbb10('0xd6')](_0x5e405b[_0xbb10('0xd2')])?null:getMustacheRender(_0x5e405b[_0xbb10('0xd2')],_0x1b9012),'metadata':null},'redirect':_0xbb10('0xd7'),'json':!![]};try{if(!_[_0xbb10('0xd6')](_0x5e405b['vidaooMetadata'])){var _0x58295f=getMustacheRender(_0x5e405b['vidaooMetadata'],_0x1b9012);var _0x3d4b89=JSON[_0xbb10('0x8a')](_0x58295f);_0x4c95c2[_0xbb10('0x3a')]['metadata']=_0x3d4b89;}}catch(_0x2bfa8e){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xd9'));}return rp(_0x4c95c2);}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x356660){_0x33a43e=_0x356660;if(_0x33a43e['id']){var _0x48889b={'body':_0x33a43e[_0xbb10('0xda')],'ChatWebsiteId':_0x5e405b['id'],'ChatInteractionId':_0x2764e1['id'],'direction':_0xbb10('0xdb'),'UserId':_0xb7c454[_0xbb10('0xa5')]['id']};return db[_0xbb10('0xdc')][_0xbb10('0xcb')](_0x48889b,{});}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xdd'));}})[_0xbb10('0x22')](function(){return _0x2764e1[_0xbb10('0xde')]({'vidaooSessionId':_0x33a43e['id']});})['then'](respondWithResult(_0xa8b7c3,null))[_0xbb10('0xc4')](handleError(_0xa8b7c3,null));};exports['customUpdate']=function(_0x27bed2,_0x5547fa){if(_0x27bed2[_0xbb10('0x3a')]['id']){delete _0x27bed2[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x27bed2['params']['id']},'include':[{'model':db[_0xbb10('0xdf')],'as':'Contact'}]})[_0xbb10('0x22')](handleEntityNotFound(_0x5547fa,null))[_0xbb10('0x22')](saveUpdates(_0x27bed2[_0xbb10('0x3a')],null))['then'](respondWithResult(_0x5547fa,null))[_0xbb10('0xc4')](handleError(_0x5547fa,null));};exports[_0xbb10('0xe0')]=function(_0x140173,_0x18a44f,_0x11d31b){if(_0x140173[_0xbb10('0x3a')]['id']){delete _0x140173['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x140173[_0xbb10('0xc6')]['id']}})['then'](function(_0x318908){if(!_0x318908){logger['error'](_0xbb10('0xe1'),_0xbb10('0xe0'),0x194,_0xbb10('0xe2'));_0x18a44f['sendStatus'](0x194);}else{if(_0x318908['UserId']){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xe3'));}}return _0x318908;})['then'](function(_0x440108){if(_0x440108){return _0x440108[_0xbb10('0x36')]({'closed':_0x140173[_0xbb10('0x3a')]['closed'],'disposition':_0x140173['body']['disposition']})[_0xbb10('0x22')](function(_0x55aa03){return _0x55aa03;});}})[_0xbb10('0x22')](function(_0x1c2c95){return respondWithRpcPromise(_0xbb10('0xe4'),_0xbb10('0xe0'),_0x140173[_0xbb10('0x3a')],client9004);})[_0xbb10('0x22')](respondWithResult(_0x18a44f,null))[_0xbb10('0xc4')](handleError(_0x18a44f,null));};exports[_0xbb10('0xe5')]=function(_0x2746eb,_0x431792,_0x2e2710){_0x2746eb['body'][_0xbb10('0x38')]=_0x2746eb[_0xbb10('0xe6')]['originalname'];_0x2746eb[_0xbb10('0x3a')]['basename']=_0x2746eb['file'][_0xbb10('0xe7')];_0x2746eb[_0xbb10('0x3a')][_0xbb10('0x49')]=_0x2746eb[_0xbb10('0xe6')][_0xbb10('0xe8')];return db['Attachment'][_0xbb10('0xcb')](_0x2746eb[_0xbb10('0x3a')])['then'](respondWithResult(_0x431792,0xc9))[_0xbb10('0xc4')](handleError(_0x431792,null));};exports[_0xbb10('0xe9')]=function(_0x5a82e7,_0x424c96,_0x4c769b){return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0xc6')]['id']},'raw':!![]})[_0xbb10('0x22')](handleEntityNotFound(_0x424c96,null))[_0xbb10('0x22')](function(_0x20b312){if(_0x20b312){if(_0x20b312[_0xbb10('0xea')]){return _0x424c96['status'](0x193)[_0xbb10('0x33')]({'status':0x193,'message':_0xbb10('0xeb')});}return db[_0xbb10('0xec')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0x4c')][_0xbb10('0xed')]},'raw':!![]})['then'](handleEntityNotFound(_0x424c96,null));}})['then'](function(_0x5a40e8){if(_0x5a40e8){var _0x23849e=_0x5a40e8[_0xbb10('0xee')]!==null;var _0x3e1a86=path[_0xbb10('0xef')](config['root'],_0xbb10('0xf0'));if(_0x23849e){_0x3e1a86=path[_0xbb10('0xef')](_0x3e1a86,_0xbb10('0xf1'));}var _0x577d27=path['join'](_0x3e1a86,_0x5a40e8[_0xbb10('0xf2')]);return _0x424c96['download'](_0x577d27);}})[_0xbb10('0xc4')](handleError(_0x424c96,null));};exports[_0xbb10('0xf3')]=function(_0xb9bc5a,_0x42276f){var _0x425505=null;var _0xcb61bb=null;var _0x1fe250=null;var _0x57933f=null;if(_0xb9bc5a[_0xbb10('0x3a')]['id']){delete _0xb9bc5a[_0xbb10('0x3a')]['id'];}if(_0xb9bc5a['body'][_0xbb10('0xf4')]){_0x57933f=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server/files/chat/upload/',util['format']('transcript-%s.txt',Date[_0xbb10('0xf6')]()));_0xb9bc5a[_0xbb10('0x3a')]['pathTranscript']=_0x57933f;}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0xb9bc5a[_0xbb10('0xc6')]['id']},'include':[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'include':[{'model':db[_0xbb10('0x82')],'as':_0xbb10('0x82')}]}]})['then'](handleEntityNotFound(_0x42276f,null))[_0xbb10('0x22')](saveUpdates(_0xb9bc5a['body'],null))['then'](function(_0x4aa0d7){if(_0x4aa0d7){_0x425505=_0x4aa0d7;return db[_0xbb10('0xcf')][_0xbb10('0x7b')]({'where':{'id':_0x425505['ChatWebsiteId']}});}})[_0xbb10('0x22')](function(_0x49f324){if(_0x49f324){_0x1fe250=_0x49f324;return db[_0xbb10('0xdf')][_0xbb10('0x7b')]({'where':{'id':_0x425505[_0xbb10('0x7c')]}});}})['then'](function(_0x4d10ea){if(_0x4d10ea){_0xcb61bb=_0x4d10ea;if(_0x57933f){var _0x447c0d=null;for(var _0x502e73=0x1;_0x502e73<_0x425505[_0xbb10('0xf7')][_0xbb10('0x51')];++_0x502e73){_0x447c0d=_0x425505['Messages'][_0x502e73];var _0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250['agentAlias'],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');var _0x22f153=_0xb9bc5a['body'][_0xbb10('0xfb')]||util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0xbb10('0xfc'),_0x447c0d[_0xbb10('0x7c')]);switch(_0x1fe250[_0xbb10('0xfd')]){case _0xbb10('0xfe'):_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');break;case'agent_alias':_0x50cd00=_0x447c0d['UserId']?_0x447c0d[_0xbb10('0x82')]['alias']||_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;case'agent_fullname':_0x50cd00=_0x447c0d[_0xbb10('0x83')]?_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;default:_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util['format'](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');}var _0x150d4c=util[_0xbb10('0xf8')]('[%s]\x20%s:\x20%s\x0a',moment(_0x447c0d[_0xbb10('0x89')])[_0xbb10('0xf8')]('MM/DD/YYYY\x20HH:mm:ss'),_0x447c0d[_0xbb10('0x100')]==='in'?_0x22f153:_0x50cd00,_0x447c0d[_0xbb10('0x3a')]);if(!_0x447c0d[_0xbb10('0x101')]){fs[_0xbb10('0x102')](_0x57933f,_0x150d4c);}}return db[_0xbb10('0x103')][_0xbb10('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0xbb10('0x104')],'as':_0xbb10('0x105'),'raw':!![]}]});}}})[_0xbb10('0x22')](function(_0x33d1b7){if(_0x33d1b7&&_0x33d1b7[_0xbb10('0x105')]&&_0xb9bc5a[_0xbb10('0x3a')]){var _0x1db646={'tls':{'rejectUnauthorized':![]}};if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')]){_0x1db646['service']=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')];}else{_0x1db646['host']=_0x33d1b7['Smtp'][_0xbb10('0x107')];_0x1db646[_0xbb10('0x108')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x108')];_0x1db646[_0xbb10('0x109')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x109')];}if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x10a')]){_0x1db646['auth']={'user':_0x33d1b7['Smtp']['user'],'pass':_0x33d1b7['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xbb10('0x10b'),{'account':_0x1db646,'message':{'from':util[_0xbb10('0xf8')](_0xbb10('0x10c'),_0x33d1b7[_0xbb10('0x38')],_0x33d1b7['email']||_0x33d1b7[_0xbb10('0x105')][_0xbb10('0xa5')]),'to':_0xb9bc5a[_0xbb10('0x3a')][_0xbb10('0xf4')],'subject':'Mail\x20Transcript','text':util['format'](_0xbb10('0x10d'),_0xb9bc5a[_0xbb10('0x3a')]['mailTranscript']),'attachments':[{'path':_0x57933f}]}})['then'](function(){return _0x425505;})[_0xbb10('0xc4')](function(_0xf1371a){console[_0xbb10('0x28')](_0xf1371a);});}else{return _0x425505;}})[_0xbb10('0x22')](respondWithStatusCode(_0x42276f,0xc8))[_0xbb10('0xc4')](handleError(_0x42276f,null));};exports['addMessage']=function(_0x4744f4,_0x5382e9,_0x4c97b9){return db[_0xbb10('0xdc')][_0xbb10('0x7b')]({'where':{'id':_0x4744f4[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5382e9,null))[_0xbb10('0x22')](function(_0x21c0fd){if(_0x21c0fd){return _0x21c0fd['addMessage'](_0x4744f4[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x4744f4[_0xbb10('0x3a')],[_0xbb10('0x10e'),'id'])||{});}})[_0xbb10('0x22')](respondWithResult(_0x5382e9,null))[_0xbb10('0xc4')](handleError(_0x5382e9,null));};exports[_0xbb10('0x110')]=function(_0x233d5e,_0x16f3ce,_0xbae19c){var _0x26f4b0={'raw':![],'where':{}};var _0x1dbf7b={};var _0x117e95={'count':0x0,'rows':[]};return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x233d5e[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x16f3ce,null))[_0xbb10('0x22')](function(_0x43a203){if(_0x43a203){_0x1dbf7b[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db['ChatMessage'][_0xbb10('0x47')]);_0x1dbf7b['query']=_[_0xbb10('0xc7')](_0x233d5e[_0xbb10('0x4c')]);_0x1dbf7b[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1dbf7b[_0xbb10('0x4b')],_0x1dbf7b['query']);_0x26f4b0['attributes']=_['intersection'](_0x1dbf7b[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x233d5e['query'][_0xbb10('0x50')]));_0x26f4b0[_0xbb10('0x4e')]=_0x26f4b0[_0xbb10('0x4e')]['length']?_0x26f4b0[_0xbb10('0x4e')]:_0x1dbf7b[_0xbb10('0x4b')];if(!_0x233d5e[_0xbb10('0x4c')]['hasOwnProperty'](_0xbb10('0x53'))){_0x26f4b0['limit']=qs[_0xbb10('0x54')](_0x233d5e['query']['limit']);_0x26f4b0['offset']=qs['offset'](_0x233d5e['query']['offset']);}_0x26f4b0[_0xbb10('0x9f')]=qs[_0xbb10('0x55')](_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x26f4b0['where']=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x233d5e[_0xbb10('0x4c')],_0x1dbf7b[_0xbb10('0x4d')]));_0x26f4b0[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x43a203['id'];if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0['where'],{'$or':_[_0xbb10('0x3f')](_0x26f4b0[_0xbb10('0x4e')],function(_0x288ccc){var _0x5c5ecc={};_0x5c5ecc[_0x288ccc]={'$like':'%'+_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]+'%'};return _0x5c5ecc;})});}if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')]){var _0x5b2292=_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')][_0xbb10('0x111')](',');var _0x22ec50={};_0x22ec50[_0x5b2292[0x0]]={'$gte':moment(_0x5b2292[0x1])[_0xbb10('0xf8')](_0xbb10('0x112'))};_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0[_0xbb10('0x56')],_0x22ec50);}_0x26f4b0=_[_0xbb10('0xac')]({},_0x26f4b0,_0x233d5e[_0xbb10('0xca')]);return db['ChatMessage'][_0xbb10('0x31')]({'where':_0x26f4b0[_0xbb10('0x56')]})['then'](function(_0x5eb1fb){_0x117e95[_0xbb10('0x31')]=_0x5eb1fb;if(_0x233d5e[_0xbb10('0x4c')]['includeAll']){_0x26f4b0[_0xbb10('0xc9')]=[{'all':!![]}];}return db[_0xbb10('0xdc')]['findAll'](_0x26f4b0);})[_0xbb10('0x22')](function(_0x42441e){_0x117e95[_0xbb10('0xc3')]=_0x42441e;return _0x117e95;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x16f3ce,_0x26f4b0))[_0xbb10('0xc4')](handleError(_0x16f3ce,null));};exports['getMyMessages']=function(_0x4fc260,_0x5a502c,_0xaeaa51){var _0x4db9ad={'where':{}},_0x43deea={},_0x53e73e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x4fc260[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5a502c,null))[_0xbb10('0x22')](function(_0x2527f4){if(_0x2527f4){_0x43deea[_0xbb10('0x4b')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x43deea[_0xbb10('0x4c')]=_[_0xbb10('0xc7')](_0x4fc260[_0xbb10('0x4c')]);_0x43deea[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],_0x43deea[_0xbb10('0x4c')]);_0x4db9ad['attributes']=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4fc260[_0xbb10('0x4c')]['fields']));_0x4db9ad[_0xbb10('0x4e')]=_0x4db9ad['attributes']['length']?_0x4db9ad[_0xbb10('0x4e')]:_0x43deea[_0xbb10('0x4b')];if(!_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x52')](_0xbb10('0x53'))){_0x4db9ad[_0xbb10('0x54')]=qs['limit'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x4db9ad[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x4db9ad[_0xbb10('0x9f')]=qs['sort'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x4db9ad[_0xbb10('0x56')]=qs['filters'](_['pick'](_0x4fc260[_0xbb10('0x4c')],_0x43deea[_0xbb10('0x4d')]));_0x4db9ad[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x2527f4['id'];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x4db9ad[_0xbb10('0x56')]=_['merge'](_0x4db9ad[_0xbb10('0x56')],{'$or':_[_0xbb10('0x3f')](_0x4db9ad[_0xbb10('0x4e')],function(_0x55ba78){var _0x5e195a={};_0x5e195a[_0x55ba78]={'$like':'%'+_0x4fc260['query']['filter']+'%'};return _0x5e195a;})});}_0x4db9ad[_0xbb10('0x56')][_0xbb10('0x101')]=![];if(_0x4fc260[_0xbb10('0x4c')]['id']){_0x4db9ad[_0xbb10('0x56')]['id']={'$gt':_0x4fc260['query']['id']};}_0x4db9ad=_[_0xbb10('0xac')]({},_0x4db9ad,_0x4fc260['options']);return db[_0xbb10('0xdc')][_0xbb10('0x31')]({'where':_0x4db9ad[_0xbb10('0x56')]})[_0xbb10('0x22')](function(_0xa16287){_0x53e73e[_0xbb10('0x31')]=_0xa16287;_0x4db9ad[_0xbb10('0xc9')]=[];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x113')]){_0x4db9ad[_0xbb10('0xc9')][_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40'),_0xbb10('0x114')]});}if(_0x4fc260[_0xbb10('0x4c')]['includeAll']){_0x4db9ad[_0xbb10('0xc9')]=[{'all':!![]}];}return db['ChatMessage'][_0xbb10('0x115')](_0x4db9ad);})[_0xbb10('0x22')](function(_0x280119){_0x53e73e[_0xbb10('0xc3')]=_0x280119;return _0x53e73e;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x5a502c,_0x4db9ad))['catch'](handleError(_0x5a502c,null));};exports['addTags']=function(_0x842d94,_0x4cf5cc,_0x553bb8){return db[_0xbb10('0x46')]['find']({'where':{'id':_0x842d94[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4cf5cc,null))[_0xbb10('0x22')](function(_0x4469c4){if(_0x4469c4){return _0x4469c4[_0xbb10('0x116')](_0x842d94[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x842d94['body'],[_0xbb10('0x10e'),'id'])||{})['spread'](function(){return db[_0xbb10('0x7f')]['findAll']({'attributes':['id',_0xbb10('0x38'),_0xbb10('0x5a')],'where':{'id':_0x842d94['body'][_0xbb10('0x10e')]}});})[_0xbb10('0x22')](function(_0x1bb072){socket['emit'](_0xbb10('0x117'),{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]});return{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]};});}})['then'](respondWithResult(_0x4cf5cc,null))[_0xbb10('0xc4')](handleError(_0x4cf5cc,null));};exports[_0xbb10('0x118')]=function(_0x46df90,_0x4b781e,_0x3e6756){return db['ChatInteraction'][_0xbb10('0x7b')]({'where':{'id':_0x46df90[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4b781e,null))[_0xbb10('0x22')](function(_0x583a3e){if(_0x583a3e){return _0x583a3e[_0xbb10('0x118')](_0x46df90[_0xbb10('0x4c')][_0xbb10('0x10e')]);}})[_0xbb10('0x22')](respondWithStatusCode(_0x4b781e,null))[_0xbb10('0xc4')](handleError(_0x4b781e,null));};exports['download']=function(_0x4b10ed,_0x40b5da){var _0x4739a6=moment()[_0xbb10('0x119')]()['toString']();var _0x3d5870=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x11b'),_0xbb10('0x11c'));var _0x81d970=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server',_0xbb10('0x11b'),_0xbb10('0x11d'));var _0x4102af=path[_0xbb10('0xef')](_0x3d5870,_0x4739a6);var _0x4d49a7=util[_0xbb10('0xf8')](_0xbb10('0x11e'),_0x4b10ed[_0xbb10('0xc6')]['id'],_0x4739a6);var _0x59fef2=path['join'](_0x3d5870,_0x4d49a7);var _0x3b45c4=[];_0x3b45c4['push']({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40')],'raw':!![]});_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xdf')],'as':_0xbb10('0x11f'),'attributes':['id',_0xbb10('0x120'),_0xbb10('0x121')],'raw':!![]});if(_0x4b10ed[_0xbb10('0x4c')]['attachments']){_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xec')],'as':_0xbb10('0xec'),'raw':!![]});}var _0x2807d2=[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'attributes':['id','body',_0xbb10('0x89'),_0xbb10('0x100'),_0xbb10('0x101'),_0xbb10('0x90')],'include':_0x3b45c4}];_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0xcf')],'as':_0xbb10('0x122'),'attributes':['id','name']});_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':_0xbb10('0x123'),'attributes':['id','fullname']});return db[_0xbb10('0x46')]['find']({'where':{'id':_0x4b10ed[_0xbb10('0xc6')]['id']},'include':_0x2807d2})[_0xbb10('0x22')](handleEntityNotFound(_0x40b5da,null))[_0xbb10('0x22')](function(_0x58a447){if(_0x58a447){var _0x50fa4e=_0x58a447[_0xbb10('0x124')]({'plain':!![]});fs[_0xbb10('0x125')](_0x4102af);var _0xbb410e={'channel':_0xbb10('0x126'),'account':_0x50fa4e[_0xbb10('0x122')][_0xbb10('0x38')],'agent':_0x50fa4e[_0xbb10('0x123')]?_0x50fa4e[_0xbb10('0x123')][_0xbb10('0x40')]:_0xbb10('0x127'),'createdAt':moment(_0x50fa4e[_0xbb10('0x89')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbb10('0xaa')](),'closedAt':_0x50fa4e[_0xbb10('0xea')]?moment(_0x50fa4e['closedAt'])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')]():'','disposition':_0x50fa4e[_0xbb10('0x128')],'chatInfo':{'browser':_0x50fa4e['browserName'],'os':_0x50fa4e[_0xbb10('0x129')],'referer':_0x50fa4e[_0xbb10('0x12a')],'customerIp':_0x50fa4e['customerIp'],'customerPort':_0x50fa4e[_0xbb10('0x12b')]?_0x50fa4e[_0xbb10('0x12b')]:'N.A.'},'messages':_(_0x50fa4e['Messages'])[_0xbb10('0x12c')]()[_0xbb10('0x94')]({'secret':![]})[_0xbb10('0x3f')](function(_0x5cab64){if(_0x5cab64['Attachment']){var _0x58ee41=path[_0xbb10('0xef')](_0x81d970,_0x5cab64['Attachment'][_0xbb10('0xf2')]);if(fs[_0xbb10('0x12d')](_0x58ee41)){fs['createReadStream'](_0x58ee41)[_0xbb10('0x12e')](fs[_0xbb10('0x12f')](path[_0xbb10('0xef')](_0x4102af,_0x5cab64[_0xbb10('0xec')]['basename'])));}}return{'date':moment(_0x5cab64[_0xbb10('0x89')])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')](),'sender':_0x5cab64[_0xbb10('0x100')]===_0xbb10('0xdb')?_0x5cab64[_0xbb10('0x82')]?_0x5cab64[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa'):_0x5cab64['Contact'][_0xbb10('0x120')]+(_0x5cab64[_0xbb10('0x11f')][_0xbb10('0x121')]?'\x20'+_0x5cab64[_0xbb10('0x11f')]['lastName']:''),'body':_0x5cab64['Attachment']?_0x5cab64[_0xbb10('0xec')][_0xbb10('0xf2')]:_0x5cab64[_0xbb10('0x3a')],'direction':_0x5cab64[_0xbb10('0x100')]==='out'?'A':'C','secret':_0x5cab64[_0xbb10('0x101')],'read':_0x5cab64[_0xbb10('0x90')],'attachment':_0x5cab64['Attachment']};})[_0xbb10('0x73')]()};return ejs['renderFile'](path['join'](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x130'),_0xbb10('0x131')),{'interaction':_0xbb410e})[_0xbb10('0x22')](function(_0x4aa76a){var _0x38403e=path[_0xbb10('0xef')](_0x4102af,_0xbb10('0x132')+_0x50fa4e['id']+'-'+_0x4739a6+_0xbb10('0x133'));var _0x1b7274={'path':_0x38403e,'channel':_0xbb10('0x126'),'interactionId':_0x50fa4e['id']};return pdf[_0xbb10('0x134')](_0x4aa76a,_0x1b7274);})[_0xbb10('0x22')](function(){return new BPromise(function(_0x34f4d6,_0x254b6e){zipdir(_0x4102af,{'saveTo':_0x59fef2},function(_0x368adb,_0xef4ccf){if(_0x368adb)return _0x254b6e(_0x368adb);return _0x34f4d6(_0xef4ccf);});})[_0xbb10('0x22')](function(){return new BPromise(function(_0x9fcc26,_0x111fd4){rimraf(_0x4102af,function(_0x256ce9){if(_0x256ce9)_0x111fd4(_0x256ce9);return _0x9fcc26();});});})[_0xbb10('0x22')](function(){return _0x40b5da[_0xbb10('0x135')](_0x59fef2,_0x4d49a7,function(_0x27e0c5){if(_0x27e0c5){console[_0xbb10('0x136')](_0xbb10('0x137'),_0x27e0c5);}else{fs[_0xbb10('0x138')](_0x59fef2);}});});});}else{return _0x40b5da[_0xbb10('0x2c')](0xc8);}})[_0xbb10('0xc4')](handleError(_0x40b5da,null));}; \ No newline at end of file +var _0xef0f=['alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','mailTranscript','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','hasOwnProperty','includeAgent','addTags','setTags','omit','emit','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','mkdirSync','Chat','Owner','N.A.','browserName','osName','existsSync','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','save','update','destroy','end','stack','name','send','render','body','contact','interaction','account','Users','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','select','field','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','ChatWebsiteId','sequelize','toString','count','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','Contact.firstName','Contact.lastName','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','keys','includeAll','include','options','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooMetadata','vidaooApiKey','email','isNull','vidaooNote','follow','metadata','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','originalname','basename','file','filename','mimetype','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','offline-chat/','server/files/chat/upload/','format','now','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias'];(function(_0x38d23e,_0x5e4cd6){var _0x55a3eb=function(_0x27eb8c){while(--_0x27eb8c){_0x38d23e['push'](_0x38d23e['shift']());}};_0x55a3eb(++_0x5e4cd6);}(_0xef0f,0x168));var _0xfef0=function(_0x5d7926,_0x10895a){_0x5d7926=_0x5d7926-0x0;var _0x66fbfc=_0xef0f[_0x5d7926];return _0x66fbfc;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var pdf=require(_0xfef0('0x14'));var hardwareService=require(_0xfef0('0x15'));var logger=require(_0xfef0('0x16'))(_0xfef0('0x17'));var utils=require(_0xfef0('0x18'));var config=require(_0xfef0('0x19'));var licenseUtil=require(_0xfef0('0x1a'));var db=require('../../mysqldb')['db'];config[_0xfef0('0x1b')]=_[_0xfef0('0x1c')](config[_0xfef0('0x1b')],{'host':_0xfef0('0x1d'),'port':0x18eb});var socket=require(_0xfef0('0x1e'))(new Redis(config[_0xfef0('0x1b')]));require(_0xfef0('0x1f'))['register'](socket);var jayson=require(_0xfef0('0x20'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson['client'][_0xfef0('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x284b6d,_0x3510a7,_0x1bce2f,_0x2a96d9){return new BPromise(function(_0x3f9a6c,_0x155833){var _0x2887e6=_0x2a96d9||client;return _0x2887e6['request'](_0x284b6d,_0x1bce2f)[_0xfef0('0x22')](function(_0x1642cd){logger[_0xfef0('0x23')](_0xfef0('0x24'),_0x3510a7,_0xfef0('0x25'));logger['debug'](_0xfef0('0x26'),_0x3510a7,'request\x20sent',JSON[_0xfef0('0x27')](_0x1642cd));if(_0x1642cd[_0xfef0('0x28')]){if(_0x1642cd[_0xfef0('0x28')]['code']===0x1f4){logger[_0xfef0('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x3510a7,_0x1642cd[_0xfef0('0x28')][_0xfef0('0x29')]);return _0x155833(_0x1642cd['error']['message']);}logger['error'](_0xfef0('0x24'),_0x3510a7,_0x1642cd['error'][_0xfef0('0x29')]);return _0x3f9a6c(_0x1642cd[_0xfef0('0x28')][_0xfef0('0x29')]);}else{logger[_0xfef0('0x23')](_0xfef0('0x24'),_0x3510a7,_0xfef0('0x25'));_0x3f9a6c(_0x1642cd['result']['message']);}})[_0xfef0('0x2a')](function(_0x1ffaa4){logger[_0xfef0('0x28')](_0xfef0('0x24'),_0x3510a7,_0x1ffaa4);_0x155833(_0x1ffaa4);});});}function respondWithStatusCode(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0xcc;return function(_0x5df04f){if(_0x5df04f){return _0xab231c[_0xfef0('0x2b')](_0xf60f2);}return _0xab231c[_0xfef0('0x2c')](_0xf60f2)['end']();};}function respondWithResult(_0x1a6758,_0x394bad){_0x394bad=_0x394bad||0xc8;return function(_0xca0cce){if(_0xca0cce){return _0x1a6758[_0xfef0('0x2c')](_0x394bad)[_0xfef0('0x2d')](_0xca0cce);}};}function respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c){return function(_0x3e026a){if(_0x3e026a){var _0x26cb9a=typeof _0x3e3c4c[_0xfef0('0x2e')]===_0xfef0('0x2f')&&typeof _0x3e3c4c[_0xfef0('0x30')]==='undefined';var _0x445625=_0x3e026a['count'];var _0x4eaf74=_0x26cb9a?0x0:_0x3e3c4c[_0xfef0('0x2e')];var _0x2ae54a=_0x26cb9a?_0x3e026a['count']:_0x3e3c4c['offset']+_0x3e3c4c['limit'];var _0x4f65cd;if(_0x2ae54a>=_0x445625){_0x2ae54a=_0x445625;_0x4f65cd=0xc8;}else{_0x4f65cd=0xce;}_0x1ac4a3['status'](_0x4f65cd);return _0x1ac4a3[_0xfef0('0x31')](_0xfef0('0x32'),_0x4eaf74+'-'+_0x2ae54a+'/'+_0x445625)[_0xfef0('0x2d')](_0x3e026a);}return null;};}function patchUpdates(_0x5cda6b){return function(_0x4d0778){try{jsonpatch['apply'](_0x4d0778,_0x5cda6b,!![]);}catch(_0x1f8110){return BPromise['reject'](_0x1f8110);}return _0x4d0778[_0xfef0('0x33')]();};}function saveUpdates(_0x3783f9,_0x1b9f39){return function(_0x4a2773){if(_0x4a2773){return _0x4a2773[_0xfef0('0x34')](_0x3783f9)['then'](function(_0x4234e4){return _0x4234e4;});}return null;};}function removeEntity(_0x1f21b7,_0x234d49){return function(_0xe5188e){if(_0xe5188e){return _0xe5188e[_0xfef0('0x35')]()[_0xfef0('0x22')](function(){_0x1f21b7[_0xfef0('0x2c')](0xcc)[_0xfef0('0x36')]();});}};}function handleEntityNotFound(_0x590e37,_0x24ea7c){return function(_0xea09ec){if(!_0xea09ec){_0x590e37[_0xfef0('0x2b')](0x194);}return _0xea09ec;};}function handleError(_0x36b2d1,_0xae697){_0xae697=_0xae697||0x1f4;return function(_0x262341){logger[_0xfef0('0x28')](_0x262341[_0xfef0('0x37')]);if(_0x262341[_0xfef0('0x38')]){delete _0x262341[_0xfef0('0x38')];}_0x36b2d1[_0xfef0('0x2c')](_0xae697)[_0xfef0('0x39')](_0x262341);};}function getMustacheRender(_0x366667,_0x4a8af4){return Mustache[_0xfef0('0x3a')](_0x366667,_['merge'](_0x4a8af4[_0xfef0('0x3b')],{'contact':_0x4a8af4[_0xfef0('0x3c')],'message':_0x4a8af4[_0xfef0('0x29')],'agent':_0x4a8af4['agent'],'interaction':_0x4a8af4[_0xfef0('0x3d')],'account':_0x4a8af4[_0xfef0('0x3e')]}))||'';}function getInteractionUsers(_0x3f2753,_0x5537c8){return new BPromise(function(_0x8613a0,_0x3abcc5){try{if(_0x5537c8[_0x3f2753['id']]){_0x3f2753[_0xfef0('0x3f')]=_['map'](_0x5537c8[_0x3f2753['id']],function(_0x3a6667){return{'id':_0x3a6667['id'],'fullname':_0x3a6667['fullname']};});}}catch(_0x49ed48){_0x3abcc5(_0x49ed48);}_0x8613a0(_0x3f2753);});}function getInteractionTags(_0xf30aff,_0x547a5d){return new BPromise(function(_0x5c3305,_0xbf6ddd){try{if(_0xf30aff[_0xfef0('0x40')]){_0xf30aff[_0xfef0('0x41')]=[];_0xf30aff[_0xfef0('0x40')][_0xfef0('0x42')](',')[_0xfef0('0x43')](function(_0x4dd8f8){_0xf30aff[_0xfef0('0x41')][_0xfef0('0x44')](_0x547a5d[_0x4dd8f8]);});}delete _0xf30aff['TagIds'];}catch(_0x54d5cb){_0xbf6ddd(_0x54d5cb);}_0x5c3305(_0xf30aff);});}function updateChatInteraction(_0x1d554e,_0x5dc824,_0x1fc518){return new BPromise(function(_0x22c940,_0x3c100c){return getInteractionUsers(_0x1d554e,_0x1fc518)[_0xfef0('0x22')](function(_0x199c57){return getInteractionTags(_0x199c57,_0x5dc824);})[_0xfef0('0x22')](function(_0x166a7b){_0x22c940(_0x166a7b);})[_0xfef0('0x2a')](function(_0x4e63f3){_0x3c100c(_0x4e63f3);});});}exports[_0xfef0('0x45')]=function(_0x50e372,_0x4b6da1){var _0x18c656={},_0x17d7f2={},_0x5bf416={'count':0x0,'rows':[]};var _0x2af79f=_['map'](db[_0xfef0('0x46')][_0xfef0('0x47')],function(_0x1f252e){return{'name':_0x1f252e[_0xfef0('0x48')],'type':_0x1f252e['type'][_0xfef0('0x49')]};});_0x17d7f2[_0xfef0('0x4a')]=_['map'](_0x2af79f,'name');_0x17d7f2[_0xfef0('0x4b')]=_['keys'](_0x50e372[_0xfef0('0x4b')]);_0x17d7f2[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0x17d7f2[_0xfef0('0x4a')],_0x17d7f2[_0xfef0('0x4b')]);_0x18c656[_0xfef0('0x4e')]=_['intersection'](_0x17d7f2[_0xfef0('0x4a')],qs['fields'](_0x50e372['query'][_0xfef0('0x4f')]));_0x18c656[_0xfef0('0x4e')]=_0x18c656[_0xfef0('0x4e')]['length']?_0x18c656[_0xfef0('0x4e')]:_0x17d7f2['model'];if(!_0x50e372['query']['hasOwnProperty'](_0xfef0('0x50'))){_0x18c656[_0xfef0('0x30')]=qs[_0xfef0('0x30')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x30')]);_0x18c656[_0xfef0('0x2e')]=qs[_0xfef0('0x2e')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x2e')]);}_0x18c656['order']=qs['sort'](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x51')]);_0x18c656[_0xfef0('0x52')]=qs[_0xfef0('0x4c')](_[_0xfef0('0x53')](_0x50e372[_0xfef0('0x4b')],_0x17d7f2[_0xfef0('0x4c')]),_0x2af79f);var _0x20b647=[];var _0x5e989f=squel[_0xfef0('0x54')]()[_0xfef0('0x55')]('id')[_0xfef0('0x55')](_0xfef0('0x38'))[_0xfef0('0x55')]('color')['from']('tools_tags');var _0x445f3f=squel[_0xfef0('0x54')]()[_0xfef0('0x55')](_0xfef0('0x56'))['field'](_0xfef0('0x57'))[_0xfef0('0x55')](_0xfef0('0x58'))[_0xfef0('0x59')](_0xfef0('0x5a'),'ui')[_0xfef0('0x5b')](_0xfef0('0x5c'),'u','u.id\x20=\x20ui.UserId');var _0x3458b0=squel[_0xfef0('0x54')]()['from'](_0xfef0('0x5d'),'i')['left_join'](_0xfef0('0x5e'),'c',_0xfef0('0x5f'))['left_join'](_0xfef0('0x5c'),'o','o.id\x20=\x20i.UserId')['left_join']('chat_websites','a',_0xfef0('0x60'))[_0xfef0('0x5b')](_0xfef0('0x61'),'me',_0xfef0('0x62'))[_0xfef0('0x5b')](_0xfef0('0x63'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xfef0('0x5b')](_0xfef0('0x64'),'t',_0xfef0('0x65'));var _0x45abb3=squel[_0xfef0('0x66')]();var _0x58d95e=[];var _0x59d1b6=squel['expr']();var _0x135653;if(_0x50e372['query'][_0xfef0('0x67')]){_0x135653=as[_0xfef0('0x68')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x67')]);var _0xd0255c=_0x135653['sqlOperator'];for(var _0x2abdb7=0x0;_0x2abdb7<_0x135653['conditions'][_0xfef0('0x69')];_0x2abdb7++){var _0x4a1316=_0x135653['conditions'][_0x2abdb7];var _0x3a12c5='i';var _0x3c5640=_[_0xfef0('0x6a')](_0x2af79f,[_0xfef0('0x38'),_0x4a1316[_0xfef0('0x55')]]);if(!_0x3c5640){switch(_0x4a1316[_0xfef0('0x55')]){case _0xfef0('0x6b'):if(_0x4a1316[_0xfef0('0x6c')]==0x1){_0x3458b0[_0xfef0('0x6d')]('`'+_0x4a1316[_0xfef0('0x55')]+_0xfef0('0x6e'));}else{_0x3458b0[_0xfef0('0x6d')]('`'+_0x4a1316['field']+_0xfef0('0x6f'));}break;case _0xfef0('0x70'):if(_0x4a1316[_0xfef0('0x71')]===_0xfef0('0x72')){if(_0x4a1316[_0xfef0('0x6c')]['split']('\x20')[_0xfef0('0x69')]>0x1){_0x45abb3[_0xd0255c](_0xfef0('0x73'),qs[_0xfef0('0x74')](_0x4a1316[_0xfef0('0x6c')]),null);}else{var _0x176fc7='%'+_0x4a1316[_0xfef0('0x6c')]+'%';_0x45abb3[_0xd0255c](_0xfef0('0x75'),_0x176fc7,_0x176fc7,_0x176fc7);}}else{_0x3c5640=_[_0xfef0('0x6a')](_0x2af79f,[_0xfef0('0x38'),_0xfef0('0x76')]);_0x4a1316['field']=_0xfef0('0x76');_0x1d7caf=as['buildExpression'](_0x3a12c5,_0x3c5640[_0xfef0('0x77')],_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf[_0xfef0('0x78')],_0x1d7caf['value'][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x36')]);}break;case _0xfef0('0x7a'):var _0x1e0ad5=_0x4a1316['value'][_0xfef0('0x42')](',')[_0xfef0('0x7b')](function(_0x2ccb33){return Number(_0x2ccb33);});_0x1e0ad5['forEach'](function(_0x117b74){_0x59d1b6['or'](_0xfef0('0x7c'),'%,'+_0x117b74+',%');});_0x58d95e=_[_0xfef0('0x7d')](_0x58d95e,_0x1e0ad5);break;case _0xfef0('0x7e'):if(_0x4a1316[_0xfef0('0x71')]===_0xfef0('0x72')){_0x45abb3[_0xd0255c](_0xfef0('0x7f'),'%'+_0x4a1316['value']+'%',null);}else{_0x3c5640=_[_0xfef0('0x6a')](_0x2af79f,[_0xfef0('0x38'),_0xfef0('0x80')]);_0x4a1316[_0xfef0('0x55')]=_0xfef0('0x80');_0x1d7caf=as[_0xfef0('0x81')](_0x3a12c5,_0x3c5640['type'],_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf[_0xfef0('0x78')],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')]['end']);}break;case _0xfef0('0x3b'):_0x1d7caf=as[_0xfef0('0x81')]('me',null,_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf['text'],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x36')]);break;}}else{var _0x1d7caf=as['buildExpression'](_0x3a12c5,_0x3c5640['type'],_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf['text'],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')]['end']);}}}else{var _0x24229e=_(_0x50e372['query'])['keys']()['map'](function(_0x2a92de){return _[_0xfef0('0x82')](_0x2af79f,['name',_0x2a92de])?_0x2a92de:undefined;})[_0xfef0('0x83')]()[_0xfef0('0x6c')]();if(!_[_0xfef0('0x84')](_0x24229e)){_0x24229e['forEach'](function(_0x3f2b55){if(_0x3f2b55==='ChatWebsiteId'){_0x3458b0['where'](_0xfef0('0x85'),[][_0xfef0('0x86')](_0x50e372[_0xfef0('0x4b')][_0x3f2b55]));}else if(_0x3f2b55===_0xfef0('0x87')){var _0x4df63b=JSON['parse'](_0x50e372['query'][_0x3f2b55])[_0xfef0('0x88')];var _0x546455=JSON[_0xfef0('0x89')](_0x50e372[_0xfef0('0x4b')][_0x3f2b55])[_0xfef0('0x8a')];_0x3458b0[_0xfef0('0x52')](_0xfef0('0x8b'),_0x4df63b,_0x546455);}else{if(_0x50e372['query'][_0x3f2b55]===_0xfef0('0x8c')){_0x3458b0['where']('i.'+_0x3f2b55+'\x20IS\x20NULL');}else{_0x3458b0[_0xfef0('0x52')]('i.'+_0x3f2b55+_0xfef0('0x8d'),_0x50e372[_0xfef0('0x4b')][_0x3f2b55]);}}});}if(_0x50e372[_0xfef0('0x4b')]['read']){if(_0x50e372['query'][_0xfef0('0x8e')]==0x1){_0x3458b0[_0xfef0('0x6d')]('`unreadMessages`\x20=\x200');}else{_0x3458b0[_0xfef0('0x6d')](_0xfef0('0x8f'));}}if(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')]){_0x58d95e=_[_0xfef0('0x91')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')])?_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')]:new Array(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')]);_0x58d95e[_0xfef0('0x43')](function(_0x3c1136){_0x59d1b6['or'](_0xfef0('0x7c'),'%,'+_0x3c1136+',%');});}if(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x92')]){var _0x1a61e4=_0x50e372['query'][_0xfef0('0x92')][_0xfef0('0x93')]('\x5c','\x5c\x5c')[_0xfef0('0x93')](/'/g,'\x27\x27');if(qs[_0xfef0('0x94')](_0x1a61e4)){_0x45abb3['or'](_0xfef0('0x95'),_0x1a61e4+'%');}else{_0x45abb3['or'](_0xfef0('0x96'),qs[_0xfef0('0x74')](_0x1a61e4))['or'](_0xfef0('0x97'),_0x1a61e4+'%');}}}_0x3458b0[_0xfef0('0x52')](_0x45abb3);_0x3458b0[_0xfef0('0x98')](_0xfef0('0x99'));var _0x17c350={'type':db[_0xfef0('0x9a')]['QueryTypes'][_0xfef0('0x9b')],'raw':!![]};var _0x56af65=_0x3458b0['clone']();_0x56af65[_0xfef0('0x55')](_0xfef0('0x99'));_0x56af65['field'](_0xfef0('0x9c'),'unreadMessages');if(_0x18c656['order']){_0x18c656[_0xfef0('0x9d')][_0xfef0('0x43')](function(_0x4ebcf){var _0x437cb2=_0x4ebcf[0x0]==='contactName'?_0x4ebcf[0x0]:'i.'+_0x4ebcf[0x0];_0x3458b0[_0xfef0('0x9d')](_0x437cb2,_0x4ebcf[0x1]===_0xfef0('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x58d95e)){_0x3458b0[_0xfef0('0x6d')](_0x59d1b6);_0x56af65[_0xfef0('0x52')](_0xfef0('0x9f'),_0x58d95e);}BPromise['resolve']()['then'](function(){if(!_0x135653){if(_0x50e372[_0xfef0('0x4b')]['ChatWebsiteId'])return;_0x56af65['where'](_0xfef0('0xa0'));_0x3458b0['where'](_0xfef0('0xa0'));return;}if(_0x50e372[_0xfef0('0xa1')][_0xfef0('0xa2')]!==_0xfef0('0xa3'))return;return _0x50e372[_0xfef0('0xa1')][_0xfef0('0xa4')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x22')](function(_0x28cc77){if(_[_0xfef0('0x84')](_0x28cc77)){_0x56af65[_0xfef0('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');_0x3458b0[_0xfef0('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x56af65['where'](_0xfef0('0x85'),_['map'](_0x28cc77,'id'));_0x3458b0[_0xfef0('0x52')](_0xfef0('0x85'),_[_0xfef0('0x7b')](_0x28cc77,'id'));}});})[_0xfef0('0x22')](function(){if(_0x50e372[_0xfef0('0xa1')][_0xfef0('0xa2')]==='agent'&&!_0x135653&&!_0x50e372[_0xfef0('0x4b')][_0xfef0('0xa5')])return[];return db[_0xfef0('0xa6')][_0xfef0('0x4b')](_0x56af65[_0xfef0('0xa7')](),_0x17c350);})[_0xfef0('0x22')](function(_0x3cc27e){_0x5bf416[_0xfef0('0xa8')]=_0x3cc27e['length'];if(_0x5bf416[_0xfef0('0xa8')]===0x0)return[];return db[_0xfef0('0xa6')]['query'](_0x5e989f[_0xfef0('0xa7')](),_0x17c350)[_0xfef0('0x22')](function(_0x221b17){_0x20b647=_['keyBy'](_0x221b17,'id');_0x17c350=_[_0xfef0('0xa9')](_0x17c350,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x4f')]){_0x18c656['attributes'][_0xfef0('0x43')](function(_0x51f79b){_0x3458b0[_0xfef0('0x55')]('i.'+_0x51f79b);});}else{_0x3458b0[_0xfef0('0x55')](_0xfef0('0x9c'),_0xfef0('0x6b'));_0x3458b0[_0xfef0('0x55')](_0xfef0('0xaa'),_0xfef0('0xab'));_0x3458b0[_0xfef0('0x55')](_0xfef0('0xac'),_0xfef0('0xad'));_0x3458b0[_0xfef0('0x55')]('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',_0xfef0('0xae'));_0x3458b0['field']('i.*');_0x3458b0[_0xfef0('0x55')]('c.firstName',_0xfef0('0xaf'));_0x3458b0['field']('c.lastName',_0xfef0('0xb0'));_0x3458b0['field']('c.email','Contact.email');_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb1'),_0xfef0('0xb2'));_0x3458b0[_0xfef0('0x55')]('c.mobile',_0xfef0('0xb3'));_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb4'),_0xfef0('0xb5'));_0x3458b0[_0xfef0('0x55')]('o.fullname','Owner.fullname');_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb6'),'Owner.internal');_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb7'),_0xfef0('0x40'));}if(_0x18c656[_0xfef0('0x30')])_0x3458b0[_0xfef0('0x30')](_0x18c656[_0xfef0('0x30')]);if(_0x18c656[_0xfef0('0x2e')])_0x3458b0[_0xfef0('0x2e')](_0x18c656['offset']);return db['sequelize'][_0xfef0('0x4b')](_0x3458b0[_0xfef0('0xa7')](),_0x17c350);})[_0xfef0('0x22')](function(_0x475eb7){if(_0x475eb7[_0xfef0('0x69')]>0x0)_0x445f3f[_0xfef0('0x52')](_0xfef0('0xb8'),_[_0xfef0('0x7b')](_0x475eb7,'id'));return db['sequelize']['query'](_0x445f3f[_0xfef0('0xa7')](),_0x17c350)[_0xfef0('0x22')](function(_0x374877){var _0xd780bb=_[_0xfef0('0xb9')](_0x374877,_0xfef0('0xba'));var _0x5ac2df=[];_0x475eb7[_0xfef0('0x43')](function(_0x1060c2){_0x5ac2df['push'](updateChatInteraction(_0x1060c2,_0x20b647,_0xd780bb));});return BPromise[_0xfef0('0xbb')](_0x5ac2df);});});})[_0xfef0('0x22')](function(_0x36873f){_0x5bf416[_0xfef0('0xbc')]=_0x36873f;return _0x5bf416;})[_0xfef0('0x22')](respondWithFilteredResult(_0x4b6da1,_0x18c656))[_0xfef0('0x2a')](handleError(_0x4b6da1,null));};exports['show']=function(_0x4dd6e8,_0x1084b9){var _0xd7c5b={'raw':![],'where':{'id':_0x4dd6e8[_0xfef0('0xbd')]['id']}},_0xd2c0be={};_0xd2c0be[_0xfef0('0x4a')]=_[_0xfef0('0xbe')](db['ChatInteraction'][_0xfef0('0x47')]);_0xd2c0be['query']=_[_0xfef0('0xbe')](_0x4dd6e8['query']);_0xd2c0be[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0xd2c0be['model'],_0xd2c0be[_0xfef0('0x4b')]);_0xd7c5b[_0xfef0('0x4e')]=_[_0xfef0('0x4d')](_0xd2c0be['model'],qs['fields'](_0x4dd6e8['query'][_0xfef0('0x4f')]));_0xd7c5b['attributes']=_0xd7c5b[_0xfef0('0x4e')][_0xfef0('0x69')]?_0xd7c5b['attributes']:_0xd2c0be[_0xfef0('0x4a')];if(_0x4dd6e8['query'][_0xfef0('0xbf')]){_0xd7c5b[_0xfef0('0xc0')]=[{'all':!![]}];}_0xd7c5b=_[_0xfef0('0xa9')]({},_0xd7c5b,_0x4dd6e8[_0xfef0('0xc1')]);return db[_0xfef0('0x46')][_0xfef0('0x6a')](_0xd7c5b)[_0xfef0('0x22')](handleEntityNotFound(_0x1084b9,null))['then'](respondWithResult(_0x1084b9,null))[_0xfef0('0x2a')](handleError(_0x1084b9,null));};exports[_0xfef0('0xc2')]=function(_0x38f96f,_0x1bdf18){return db[_0xfef0('0x46')][_0xfef0('0xc2')](_0x38f96f[_0xfef0('0x3b')],{})[_0xfef0('0x22')](respondWithResult(_0x1bdf18,0xc9))[_0xfef0('0x2a')](handleError(_0x1bdf18,null));};exports[_0xfef0('0x34')]=function(_0x2a25cb,_0x34f1db){if(_0x2a25cb[_0xfef0('0x3b')]['id']){delete _0x2a25cb[_0xfef0('0x3b')]['id'];}return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x2a25cb[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x34f1db,null))[_0xfef0('0x22')](saveUpdates(_0x2a25cb[_0xfef0('0x3b')],null))[_0xfef0('0x22')](respondWithResult(_0x34f1db,null))[_0xfef0('0x2a')](handleError(_0x34f1db,null));};exports[_0xfef0('0x35')]=function(_0x191072,_0x5b5a15){return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x191072['params']['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x5b5a15,null))[_0xfef0('0x22')](removeEntity(_0x5b5a15,null))[_0xfef0('0x2a')](handleError(_0x5b5a15,null));};exports[_0xfef0('0xc3')]=function(_0xd9c290,_0x365938){return db[_0xfef0('0x46')][_0xfef0('0xc3')]()[_0xfef0('0x22')](respondWithResult(_0x365938,null))[_0xfef0('0x2a')](handleError(_0x365938,null));};exports[_0xfef0('0xc4')]=function(_0x4c6ddd,_0x17ac08){var _0x40afcb=_0x4c6ddd['params']['id'];var _0xaa5902;var _0x189964;var _0x524db7;return db[_0xfef0('0x46')]['findOne']({'where':{'id':_0x40afcb}})[_0xfef0('0x22')](function(_0x41aadf){_0xaa5902=_0x41aadf;return db[_0xfef0('0xc5')][_0xfef0('0xc6')]({'where':{'id':_0x41aadf[_0xfef0('0xa5')]},'attributes':['id','vidaooApiKey',_0xfef0('0xc7'),_0xfef0('0xc8'),'vidaooNote',_0xfef0('0xc9')],'raw':!![]});})['then'](function(_0x3a180e){if(_0x3a180e&&_0x3a180e[_0xfef0('0xca')]&&_0x3a180e[_0xfef0('0xc7')]){_0x189964=_0x3a180e;var _0x52fb8b={'interaction':{'id':_0x40afcb},'agent':{'id':_0x4c6ddd[_0xfef0('0xa1')]['id'],'name':_0x4c6ddd['user']['name'],'fullname':_0x4c6ddd[_0xfef0('0xa1')]['fullname'],'email':_0x4c6ddd[_0xfef0('0xa1')][_0xfef0('0xcb')]},'contact':_0x4c6ddd[_0xfef0('0x3b')][_0xfef0('0x3c')],'account':_0x4c6ddd[_0xfef0('0x3b')][_0xfef0('0x3e')]};var _0x7f9b61={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x3a180e[_0xfef0('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4c6ddd['user'][_0xfef0('0xcb')]],'buttons':null,'topic':_0x189964[_0xfef0('0xc8')],'note':_[_0xfef0('0xcc')](_0x189964[_0xfef0('0xcd')])?null:getMustacheRender(_0x189964[_0xfef0('0xcd')],_0x52fb8b),'metadata':null},'redirect':_0xfef0('0xce'),'json':!![]};try{if(!_[_0xfef0('0xcc')](_0x189964[_0xfef0('0xc9')])){var _0x4a3b68=getMustacheRender(_0x189964['vidaooMetadata'],_0x52fb8b);var _0x3c5471=JSON[_0xfef0('0x89')](_0x4a3b68);_0x7f9b61[_0xfef0('0x3b')][_0xfef0('0xcf')]=_0x3c5471;}}catch(_0xdbd7f2){throw new db['Sequelize']['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x7f9b61);}else{throw new db[(_0xfef0('0x9a'))][(_0xfef0('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xfef0('0x22')](function(_0x4f171b){_0x524db7=_0x4f171b;if(_0x524db7['id']){var _0x236523={'body':_0x524db7[_0xfef0('0xd1')],'ChatWebsiteId':_0x189964['id'],'ChatInteractionId':_0xaa5902['id'],'direction':_0xfef0('0xd2'),'UserId':_0x4c6ddd[_0xfef0('0xa1')]['id']};return db[_0xfef0('0xd3')][_0xfef0('0xc2')](_0x236523,{});}else{throw new db[(_0xfef0('0x9a'))][(_0xfef0('0xd0'))](_0xfef0('0xd4'));}})[_0xfef0('0x22')](function(){return _0xaa5902[_0xfef0('0xd5')]({'vidaooSessionId':_0x524db7['id']});})['then'](respondWithResult(_0x17ac08,null))[_0xfef0('0x2a')](handleError(_0x17ac08,null));};exports['customUpdate']=function(_0xf763b1,_0x1fc6a0){if(_0xf763b1[_0xfef0('0x3b')]['id']){delete _0xf763b1[_0xfef0('0x3b')]['id'];}return db[_0xfef0('0x46')][_0xfef0('0x6a')]({'where':{'id':_0xf763b1[_0xfef0('0xbd')]['id']},'include':[{'model':db[_0xfef0('0xd6')],'as':_0xfef0('0x70')}]})['then'](handleEntityNotFound(_0x1fc6a0,null))['then'](saveUpdates(_0xf763b1[_0xfef0('0x3b')],null))['then'](respondWithResult(_0x1fc6a0,null))[_0xfef0('0x2a')](handleError(_0x1fc6a0,null));};exports[_0xfef0('0xd7')]=function(_0x45049d,_0x238112,_0x3a7c93){if(_0x45049d['body']['id']){delete _0x45049d[_0xfef0('0x3b')]['id'];}return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x45049d[_0xfef0('0xbd')]['id']}})['then'](function(_0x34bcc3){if(!_0x34bcc3){logger['error'](_0xfef0('0xd8'),'abandon',0x194,'entity\x20not\x20found');_0x238112[_0xfef0('0x2b')](0x194);}else{if(_0x34bcc3['UserId']){throw new db[(_0xfef0('0x9a'))][(_0xfef0('0xd0'))](_0xfef0('0xd9'));}}return _0x34bcc3;})['then'](function(_0x5c7b35){if(_0x5c7b35){return _0x5c7b35[_0xfef0('0x34')]({'closed':_0x45049d[_0xfef0('0x3b')][_0xfef0('0xda')],'disposition':_0x45049d[_0xfef0('0x3b')][_0xfef0('0xdb')]})[_0xfef0('0x22')](function(_0x3107e2){return _0x3107e2;});}})[_0xfef0('0x22')](function(_0x325d36){return respondWithRpcPromise('AbandonInteraction',_0xfef0('0xd7'),_0x45049d[_0xfef0('0x3b')],client9004);})[_0xfef0('0x22')](respondWithResult(_0x238112,null))[_0xfef0('0x2a')](handleError(_0x238112,null));};exports[_0xfef0('0xdc')]=function(_0xb1df6f,_0x42604b,_0x5969d2){_0xb1df6f[_0xfef0('0x3b')][_0xfef0('0x38')]=_0xb1df6f['file'][_0xfef0('0xdd')];_0xb1df6f[_0xfef0('0x3b')][_0xfef0('0xde')]=_0xb1df6f[_0xfef0('0xdf')][_0xfef0('0xe0')];_0xb1df6f['body'][_0xfef0('0x77')]=_0xb1df6f['file'][_0xfef0('0xe1')];return db['Attachment']['create'](_0xb1df6f['body'])[_0xfef0('0x22')](respondWithResult(_0x42604b,0xc9))['catch'](handleError(_0x42604b,null));};exports['attachmentDownload']=function(_0x25fed0,_0x43453b,_0x4da5b0){return db[_0xfef0('0x46')][_0xfef0('0xc6')]({'where':{'id':_0x25fed0[_0xfef0('0xbd')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x43453b,null))['then'](function(_0x39a2a7){if(_0x39a2a7){if(_0x39a2a7[_0xfef0('0xda')]){return _0x43453b[_0xfef0('0x2c')](0x193)[_0xfef0('0x2d')]({'status':0x193,'message':_0xfef0('0xe2')});}return db[_0xfef0('0xe3')][_0xfef0('0xc6')]({'where':{'id':_0x25fed0['query'][_0xfef0('0xe4')]},'raw':!![]})[_0xfef0('0x22')](handleEntityNotFound(_0x43453b,null));}})[_0xfef0('0x22')](function(_0x4544fe){if(_0x4544fe){var _0x5c0f32=_0x4544fe['ChatOfflineMessageId']!==null;var _0x461c91=path[_0xfef0('0xe5')](config[_0xfef0('0xe6')],_0xfef0('0xe7'));if(_0x5c0f32){_0x461c91=path[_0xfef0('0xe5')](_0x461c91,_0xfef0('0xe8'));}var _0xe24c2d=path['join'](_0x461c91,_0x4544fe['basename']);return _0x43453b['download'](_0xe24c2d);}})[_0xfef0('0x2a')](handleError(_0x43453b,null));};exports['close']=function(_0x38ac84,_0x4a1406){var _0x2daf2a=null;var _0x4f703e=null;var _0x20cf67=null;var _0x235122=null;if(_0x38ac84[_0xfef0('0x3b')]['id']){delete _0x38ac84[_0xfef0('0x3b')]['id'];}if(_0x38ac84[_0xfef0('0x3b')]['mailTranscript']){_0x235122=path[_0xfef0('0xe5')](config[_0xfef0('0xe6')],_0xfef0('0xe9'),util[_0xfef0('0xea')]('transcript-%s.txt',Date[_0xfef0('0xeb')]()));_0x38ac84['body']['pathTranscript']=_0x235122;}return db[_0xfef0('0x46')]['find']({'where':{'id':_0x38ac84['params']['id']},'include':[{'model':db[_0xfef0('0xd3')],'as':'Messages','include':[{'model':db[_0xfef0('0x7e')],'as':_0xfef0('0x7e')}]}]})[_0xfef0('0x22')](handleEntityNotFound(_0x4a1406,null))[_0xfef0('0x22')](saveUpdates(_0x38ac84[_0xfef0('0x3b')],null))[_0xfef0('0x22')](function(_0x4f6c50){if(_0x4f6c50){_0x2daf2a=_0x4f6c50;return db[_0xfef0('0xc5')][_0xfef0('0x6a')]({'where':{'id':_0x2daf2a[_0xfef0('0xa5')]}});}})['then'](function(_0x3ac462){if(_0x3ac462){_0x20cf67=_0x3ac462;return db['CmContact'][_0xfef0('0x6a')]({'where':{'id':_0x2daf2a[_0xfef0('0x76')]}});}})[_0xfef0('0x22')](function(_0x5ef687){if(_0x5ef687){_0x4f703e=_0x5ef687;if(_0x235122){var _0x906e55=null;for(var _0x4cec7d=0x1;_0x4cec7d<_0x2daf2a['Messages'][_0xfef0('0x69')];++_0x4cec7d){_0x906e55=_0x2daf2a[_0xfef0('0xec')][_0x4cec7d];var _0x58a4ef=_0x906e55[_0xfef0('0x80')]?util[_0xfef0('0xea')](_0xfef0('0xed'),_0x20cf67[_0xfef0('0xee')],_0x906e55['UserId']):_0xfef0('0xef');var _0x484cc3=_0x38ac84[_0xfef0('0x3b')][_0xfef0('0xf0')]||util[_0xfef0('0xea')](_0xfef0('0xed'),_0xfef0('0xf1'),_0x906e55[_0xfef0('0x76')]);switch(_0x20cf67[_0xfef0('0xf2')]){case _0xfef0('0xf3'):_0x58a4ef=_0x906e55[_0xfef0('0x80')]?util['format'](_0xfef0('0xed'),_0x20cf67[_0xfef0('0xee')],_0x906e55['UserId']):_0xfef0('0xef');break;case'agent_alias':_0x58a4ef=_0x906e55[_0xfef0('0x80')]?_0x906e55[_0xfef0('0x7e')][_0xfef0('0xf4')]||_0x906e55[_0xfef0('0x7e')][_0xfef0('0xf5')]:'System';break;case _0xfef0('0xf6'):_0x58a4ef=_0x906e55[_0xfef0('0x80')]?_0x906e55[_0xfef0('0x7e')]['fullname']:'System';break;default:_0x58a4ef=_0x906e55[_0xfef0('0x80')]?util[_0xfef0('0xea')](_0xfef0('0xed'),_0x20cf67[_0xfef0('0xee')],_0x906e55['UserId']):_0xfef0('0xef');}var _0x4b4986=util[_0xfef0('0xea')](_0xfef0('0xf7'),moment(_0x906e55[_0xfef0('0x87')])[_0xfef0('0xea')](_0xfef0('0xf8')),_0x906e55['direction']==='in'?_0x484cc3:_0x58a4ef,_0x906e55[_0xfef0('0x3b')]);if(!_0x906e55[_0xfef0('0xf9')]){fs[_0xfef0('0xfa')](_0x235122,_0x4b4986);}}return db[_0xfef0('0xfb')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xfef0('0xfc')],'as':'Smtp','raw':!![]}]});}}})[_0xfef0('0x22')](function(_0x402c7d){if(_0x402c7d&&_0x402c7d[_0xfef0('0xfd')]&&_0x38ac84[_0xfef0('0x3b')]){var _0x5315eb={'tls':{'rejectUnauthorized':![]}};if(_0x402c7d['Smtp'][_0xfef0('0xfe')]){_0x5315eb[_0xfef0('0xfe')]=_0x402c7d[_0xfef0('0xfd')][_0xfef0('0xfe')];}else{_0x5315eb[_0xfef0('0xff')]=_0x402c7d[_0xfef0('0xfd')][_0xfef0('0xff')];_0x5315eb['port']=_0x402c7d['Smtp'][_0xfef0('0x100')];_0x5315eb[_0xfef0('0x101')]=_0x402c7d['Smtp'][_0xfef0('0x101')];}if(_0x402c7d['Smtp']['authentication']){_0x5315eb[_0xfef0('0x102')]={'user':_0x402c7d[_0xfef0('0xfd')][_0xfef0('0xa1')],'pass':_0x402c7d[_0xfef0('0xfd')][_0xfef0('0x103')]};}return respondWithRpcPromise('SendMail',_0xfef0('0x104'),{'account':_0x5315eb,'message':{'from':util[_0xfef0('0xea')](_0xfef0('0x105'),_0x402c7d[_0xfef0('0x38')],_0x402c7d['email']||_0x402c7d['Smtp']['user']),'to':_0x38ac84[_0xfef0('0x3b')]['mailTranscript'],'subject':_0xfef0('0x106'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x38ac84['body'][_0xfef0('0x107')]),'attachments':[{'path':_0x235122}]}})[_0xfef0('0x22')](function(){return _0x2daf2a;})['catch'](function(_0x411870){console['error'](_0x411870);});}else{return _0x2daf2a;}})[_0xfef0('0x22')](respondWithStatusCode(_0x4a1406,0xc8))[_0xfef0('0x2a')](handleError(_0x4a1406,null));};exports[_0xfef0('0x108')]=function(_0x9b2969,_0x1f842f,_0x36c978){return db[_0xfef0('0xd3')][_0xfef0('0x6a')]({'where':{'id':_0x9b2969[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x1f842f,null))['then'](function(_0x1d342a){if(_0x1d342a){return _0x1d342a[_0xfef0('0x108')](_0x9b2969['body'][_0xfef0('0x109')],_['omit'](_0x9b2969[_0xfef0('0x3b')],[_0xfef0('0x109'),'id'])||{});}})[_0xfef0('0x22')](respondWithResult(_0x1f842f,null))[_0xfef0('0x2a')](handleError(_0x1f842f,null));};exports[_0xfef0('0x10a')]=function(_0x422af1,_0xcb9eb8,_0x38e829){var _0x287403={'raw':![],'where':{}};var _0x2ebd8d={};var _0x115454={'count':0x0,'rows':[]};return db[_0xfef0('0x46')][_0xfef0('0xc6')]({'where':{'id':_0x422af1[_0xfef0('0xbd')]['id']}})['then'](handleEntityNotFound(_0xcb9eb8,null))[_0xfef0('0x22')](function(_0x5593de){if(_0x5593de){_0x2ebd8d['model']=_[_0xfef0('0xbe')](db['ChatMessage'][_0xfef0('0x47')]);_0x2ebd8d[_0xfef0('0x4b')]=_[_0xfef0('0xbe')](_0x422af1['query']);_0x2ebd8d[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0x2ebd8d[_0xfef0('0x4a')],_0x2ebd8d[_0xfef0('0x4b')]);_0x287403[_0xfef0('0x4e')]=_[_0xfef0('0x4d')](_0x2ebd8d[_0xfef0('0x4a')],qs[_0xfef0('0x4f')](_0x422af1[_0xfef0('0x4b')][_0xfef0('0x4f')]));_0x287403[_0xfef0('0x4e')]=_0x287403[_0xfef0('0x4e')][_0xfef0('0x69')]?_0x287403[_0xfef0('0x4e')]:_0x2ebd8d['model'];if(!_0x422af1[_0xfef0('0x4b')]['hasOwnProperty'](_0xfef0('0x50'))){_0x287403['limit']=qs[_0xfef0('0x30')](_0x422af1[_0xfef0('0x4b')][_0xfef0('0x30')]);_0x287403[_0xfef0('0x2e')]=qs[_0xfef0('0x2e')](_0x422af1['query']['offset']);}_0x287403[_0xfef0('0x9d')]=qs[_0xfef0('0x51')](_0x422af1['query'][_0xfef0('0x51')]);_0x287403[_0xfef0('0x52')]=qs[_0xfef0('0x4c')](_[_0xfef0('0x53')](_0x422af1[_0xfef0('0x4b')],_0x2ebd8d[_0xfef0('0x4c')]));_0x287403[_0xfef0('0x52')][_0xfef0('0xba')]=_0x5593de['id'];if(_0x422af1['query'][_0xfef0('0x92')]){_0x287403[_0xfef0('0x52')]=_['merge'](_0x287403[_0xfef0('0x52')],{'$or':_['map'](_0x287403[_0xfef0('0x4e')],function(_0x41790c){var _0x189965={};_0x189965[_0x41790c]={'$like':'%'+_0x422af1[_0xfef0('0x4b')][_0xfef0('0x92')]+'%'};return _0x189965;})});}if(_0x422af1[_0xfef0('0x4b')][_0xfef0('0x88')]){var _0x5b1b34=_0x422af1[_0xfef0('0x4b')][_0xfef0('0x88')]['split'](',');var _0xfa83e1={};_0xfa83e1[_0x5b1b34[0x0]]={'$gte':moment(_0x5b1b34[0x1])[_0xfef0('0xea')](_0xfef0('0x10b'))};_0x287403['where']=_[_0xfef0('0xa9')](_0x287403[_0xfef0('0x52')],_0xfa83e1);}_0x287403=_[_0xfef0('0xa9')]({},_0x287403,_0x422af1[_0xfef0('0xc1')]);return db[_0xfef0('0xd3')][_0xfef0('0xa8')]({'where':_0x287403[_0xfef0('0x52')]})[_0xfef0('0x22')](function(_0x464d00){_0x115454[_0xfef0('0xa8')]=_0x464d00;if(_0x422af1['query'][_0xfef0('0xbf')]){_0x287403[_0xfef0('0xc0')]=[{'all':!![]}];}return db[_0xfef0('0xd3')][_0xfef0('0x10c')](_0x287403);})[_0xfef0('0x22')](function(_0x1b23f0){_0x115454['rows']=_0x1b23f0;return _0x115454;});}})['then'](respondWithFilteredResult(_0xcb9eb8,_0x287403))[_0xfef0('0x2a')](handleError(_0xcb9eb8,null));};exports['getMyMessages']=function(_0x30f7d5,_0x1a53fa,_0x14a37e){var _0x303128={'where':{}},_0x2b3263={},_0x43e758={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xfef0('0xc6')]({'where':{'id':_0x30f7d5[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x1a53fa,null))[_0xfef0('0x22')](function(_0x273e8b){if(_0x273e8b){_0x2b3263[_0xfef0('0x4a')]=_[_0xfef0('0xbe')](db['ChatMessage'][_0xfef0('0x47')]);_0x2b3263[_0xfef0('0x4b')]=_[_0xfef0('0xbe')](_0x30f7d5[_0xfef0('0x4b')]);_0x2b3263[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0x2b3263['model'],_0x2b3263['query']);_0x303128[_0xfef0('0x4e')]=_[_0xfef0('0x4d')](_0x2b3263[_0xfef0('0x4a')],qs[_0xfef0('0x4f')](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x4f')]));_0x303128[_0xfef0('0x4e')]=_0x303128[_0xfef0('0x4e')][_0xfef0('0x69')]?_0x303128[_0xfef0('0x4e')]:_0x2b3263[_0xfef0('0x4a')];if(!_0x30f7d5['query'][_0xfef0('0x10d')](_0xfef0('0x50'))){_0x303128[_0xfef0('0x30')]=qs[_0xfef0('0x30')](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x30')]);_0x303128['offset']=qs[_0xfef0('0x2e')](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x2e')]);}_0x303128[_0xfef0('0x9d')]=qs['sort'](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x51')]);_0x303128['where']=qs[_0xfef0('0x4c')](_[_0xfef0('0x53')](_0x30f7d5[_0xfef0('0x4b')],_0x2b3263[_0xfef0('0x4c')]));_0x303128[_0xfef0('0x52')][_0xfef0('0xba')]=_0x273e8b['id'];if(_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x92')]){_0x303128['where']=_[_0xfef0('0xa9')](_0x303128[_0xfef0('0x52')],{'$or':_['map'](_0x303128['attributes'],function(_0x3081e){var _0xd34b68={};_0xd34b68[_0x3081e]={'$like':'%'+_0x30f7d5[_0xfef0('0x4b')]['filter']+'%'};return _0xd34b68;})});}_0x303128[_0xfef0('0x52')][_0xfef0('0xf9')]=![];if(_0x30f7d5['query']['id']){_0x303128[_0xfef0('0x52')]['id']={'$gt':_0x30f7d5[_0xfef0('0x4b')]['id']};}_0x303128=_[_0xfef0('0xa9')]({},_0x303128,_0x30f7d5[_0xfef0('0xc1')]);return db[_0xfef0('0xd3')]['count']({'where':_0x303128[_0xfef0('0x52')]})['then'](function(_0x63bcae){_0x43e758['count']=_0x63bcae;_0x303128[_0xfef0('0xc0')]=[];if(_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x10e')]){_0x303128['include'][_0xfef0('0x44')]({'model':db[_0xfef0('0x7e')],'as':'User','attributes':['id','fullname',_0xfef0('0xf4')]});}if(_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0xbf')]){_0x303128['include']=[{'all':!![]}];}return db[_0xfef0('0xd3')][_0xfef0('0x10c')](_0x303128);})['then'](function(_0x527d0d){_0x43e758[_0xfef0('0xbc')]=_0x527d0d;return _0x43e758;});}})[_0xfef0('0x22')](respondWithFilteredResult(_0x1a53fa,_0x303128))['catch'](handleError(_0x1a53fa,null));};exports[_0xfef0('0x10f')]=function(_0x3f68ed,_0x45a5e8,_0x33cecb){return db[_0xfef0('0x46')][_0xfef0('0x6a')]({'where':{'id':_0x3f68ed[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x45a5e8,null))[_0xfef0('0x22')](function(_0x53ce05){if(_0x53ce05){return _0x53ce05[_0xfef0('0x110')](_0x3f68ed[_0xfef0('0x3b')][_0xfef0('0x109')],_[_0xfef0('0x111')](_0x3f68ed[_0xfef0('0x3b')],[_0xfef0('0x109'),'id'])||{})['spread'](function(){return db[_0xfef0('0x7a')][_0xfef0('0x10c')]({'attributes':['id','name','color'],'where':{'id':_0x3f68ed[_0xfef0('0x3b')][_0xfef0('0x109')]}});})[_0xfef0('0x22')](function(_0x4697ee){socket[_0xfef0('0x112')]('chatInteractionTags:save',{'id':Number(_0x3f68ed[_0xfef0('0xbd')]['id']),'tags':_0x4697ee||[]});return{'id':Number(_0x3f68ed[_0xfef0('0xbd')]['id']),'tags':_0x4697ee||[]};});}})[_0xfef0('0x22')](respondWithResult(_0x45a5e8,null))['catch'](handleError(_0x45a5e8,null));};exports[_0xfef0('0x113')]=function(_0x2a229b,_0xcb6d50,_0x53ed7e){return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x2a229b[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0xcb6d50,null))['then'](function(_0x241763){if(_0x241763){return _0x241763[_0xfef0('0x113')](_0x2a229b['query'][_0xfef0('0x109')]);}})[_0xfef0('0x22')](respondWithStatusCode(_0xcb6d50,null))['catch'](handleError(_0xcb6d50,null));};exports[_0xfef0('0x114')]=function(_0x57e2d8,_0x3fdeae){var _0x30b0a9=moment()[_0xfef0('0x115')]()['toString']();var _0x416d36=path[_0xfef0('0xe5')](config['root'],_0xfef0('0x116'),_0xfef0('0x117'),_0xfef0('0x118'));var _0x50b3d7=path[_0xfef0('0xe5')](config[_0xfef0('0xe6')],_0xfef0('0x116'),_0xfef0('0x117'),_0xfef0('0x119'));var _0x2a9a1e=path[_0xfef0('0xe5')](_0x416d36,_0x30b0a9);var _0x584c9b=util[_0xfef0('0xea')](_0xfef0('0x11a'),_0x57e2d8[_0xfef0('0xbd')]['id'],_0x30b0a9);var _0x4f4c4e=path[_0xfef0('0xe5')](_0x416d36,_0x584c9b);var _0x1c6ab9=[];_0x1c6ab9[_0xfef0('0x44')]({'model':db[_0xfef0('0x7e')],'as':_0xfef0('0x7e'),'attributes':['id',_0xfef0('0xf5')],'raw':!![]});_0x1c6ab9['push']({'model':db[_0xfef0('0xd6')],'as':'Contact','attributes':['id',_0xfef0('0x11b'),_0xfef0('0x11c')],'raw':!![]});if(_0x57e2d8[_0xfef0('0x4b')][_0xfef0('0x119')]){_0x1c6ab9[_0xfef0('0x44')]({'model':db[_0xfef0('0xe3')],'as':'Attachment','raw':!![]});}var _0x937d8e=[{'model':db[_0xfef0('0xd3')],'as':_0xfef0('0xec'),'attributes':['id',_0xfef0('0x3b'),'createdAt',_0xfef0('0x11d'),_0xfef0('0xf9'),'read'],'include':_0x1c6ab9}];_0x937d8e['push']({'model':db[_0xfef0('0xc5')],'as':_0xfef0('0x11e'),'attributes':['id',_0xfef0('0x38')]});_0x937d8e[_0xfef0('0x44')]({'model':db['User'],'as':'Owner','attributes':['id',_0xfef0('0xf5')]});return db[_0xfef0('0x46')][_0xfef0('0x6a')]({'where':{'id':_0x57e2d8[_0xfef0('0xbd')]['id']},'include':_0x937d8e})[_0xfef0('0x22')](handleEntityNotFound(_0x3fdeae,null))['then'](function(_0x2978cc){if(_0x2978cc){var _0x81bcee=_0x2978cc['get']({'plain':!![]});fs[_0xfef0('0x11f')](_0x2a9a1e);var _0xc8d0ca={'channel':_0xfef0('0x120'),'account':_0x81bcee[_0xfef0('0x11e')][_0xfef0('0x38')],'agent':_0x81bcee[_0xfef0('0x121')]?_0x81bcee['Owner']['fullname']:_0xfef0('0x122'),'createdAt':moment(_0x81bcee[_0xfef0('0x87')])[_0xfef0('0xea')](_0xfef0('0x10b'))['toString'](),'closedAt':_0x81bcee['closed']?moment(_0x81bcee['closedAt'])[_0xfef0('0xea')](_0xfef0('0x10b'))[_0xfef0('0xa7')]():'','disposition':_0x81bcee[_0xfef0('0xdb')],'chatInfo':{'browser':_0x81bcee[_0xfef0('0x123')],'os':_0x81bcee[_0xfef0('0x124')],'referer':_0x81bcee['referer'],'customerIp':_0x81bcee['customerIp'],'customerPort':_0x81bcee['customerPort']?_0x81bcee['customerPort']:'N.A.'},'messages':_(_0x81bcee[_0xfef0('0xec')])['tail']()[_0xfef0('0x92')]({'secret':![]})[_0xfef0('0x7b')](function(_0x46ab62){if(_0x46ab62[_0xfef0('0xe3')]){var _0x3507a8=path['join'](_0x50b3d7,_0x46ab62[_0xfef0('0xe3')][_0xfef0('0xde')]);if(fs[_0xfef0('0x125')](_0x3507a8)){fs['createReadStream'](_0x3507a8)[_0xfef0('0x126')](fs[_0xfef0('0x127')](path[_0xfef0('0xe5')](_0x2a9a1e,_0x46ab62[_0xfef0('0xe3')][_0xfef0('0xde')])));}}return{'date':moment(_0x46ab62[_0xfef0('0x87')])[_0xfef0('0xea')](_0xfef0('0x10b'))[_0xfef0('0xa7')](),'sender':_0x46ab62[_0xfef0('0x11d')]===_0xfef0('0xd2')?_0x46ab62[_0xfef0('0x7e')]?_0x46ab62[_0xfef0('0x7e')][_0xfef0('0xf5')]:_0xfef0('0xef'):_0x46ab62[_0xfef0('0x70')][_0xfef0('0x11b')]+(_0x46ab62[_0xfef0('0x70')][_0xfef0('0x11c')]?'\x20'+_0x46ab62[_0xfef0('0x70')]['lastName']:''),'body':_0x46ab62['Attachment']?_0x46ab62['Attachment']['basename']:_0x46ab62[_0xfef0('0x3b')],'direction':_0x46ab62[_0xfef0('0x11d')]===_0xfef0('0xd2')?'A':'C','secret':_0x46ab62['secret'],'read':_0x46ab62[_0xfef0('0x8e')],'attachment':_0x46ab62[_0xfef0('0xe3')]};})[_0xfef0('0x6c')]()};return ejs[_0xfef0('0x128')](path['join'](config['root'],'server',_0xfef0('0x129'),_0xfef0('0x12a')),{'interaction':_0xc8d0ca})[_0xfef0('0x22')](function(_0x2b1f64){var _0x55ecff=path[_0xfef0('0xe5')](_0x2a9a1e,_0xfef0('0x12b')+_0x81bcee['id']+'-'+_0x30b0a9+'.pdf');var _0x409147={'path':_0x55ecff,'channel':_0xfef0('0x120'),'interactionId':_0x81bcee['id']};return pdf[_0xfef0('0x12c')](_0x2b1f64,_0x409147);})[_0xfef0('0x22')](function(){return new BPromise(function(_0x27856d,_0x44081d){zipdir(_0x2a9a1e,{'saveTo':_0x4f4c4e},function(_0x177c9b,_0x322672){if(_0x177c9b)return _0x44081d(_0x177c9b);return _0x27856d(_0x322672);});})[_0xfef0('0x22')](function(){return new BPromise(function(_0x102b4e,_0x2a206b){rimraf(_0x2a9a1e,function(_0x279f5b){if(_0x279f5b)_0x2a206b(_0x279f5b);return _0x102b4e();});});})[_0xfef0('0x22')](function(){return _0x3fdeae[_0xfef0('0x114')](_0x4f4c4e,_0x584c9b,function(_0x44603e){if(_0x44603e){console['log'](_0xfef0('0x12d'),_0x44603e);}else{fs['unlinkSync'](_0x4f4c4e);}});});});}else{return _0x3fdeae[_0xfef0('0x2b')](0xc8);}})['catch'](handleError(_0x3fdeae,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index ee2f598..3ff63ab 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 _0x416f=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','save','update','remove','getUsers','then','setDataValue','Users','findAll','length'];(function(_0x58be4e,_0x16f307){var _0x151634=function(_0x226cd4){while(--_0x226cd4){_0x58be4e['push'](_0x58be4e['shift']());}};_0x151634(++_0x16f307);}(_0x416f,0x130));var _0xf416=function(_0x5def1a,_0x1c53b5){_0x5def1a=_0x5def1a-0x0;var _0x4c738f=_0x416f[_0x5def1a];return _0x4c738f;};'use strict';var EventEmitter=require(_0xf416('0x0'));var ChatInteraction=require(_0xf416('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf416('0x2'),'afterUpdate':_0xf416('0x3'),'afterDestroy':_0xf416('0x4')};function emitEvent(_0x5e83a4){return function(_0x12a394,_0x3d4053,_0x123978){_0x12a394[_0xf416('0x5')]({'attributes':['id'],'raw':!![]})[_0xf416('0x6')](function(_0xc48a64){_0x12a394[_0xf416('0x7')](_0xf416('0x8'),_0xc48a64['map'](function(_0x31f6d4){return{'id':_0x31f6d4['id']};}));return ChatMessage[_0xf416('0x9')]({'where':{'ChatInteractionId':_0x12a394['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf416('0x6')](function(_0x56fab9){_0x12a394[_0xf416('0x7')]('unreadMessages',_0x56fab9[_0xf416('0xa')]);ChatInteractionEvents[_0xf416('0xb')](_0x5e83a4+':'+_0x12a394['id'],_0x12a394);ChatInteractionEvents[_0xf416('0xb')](_0x5e83a4,_0x12a394);_0x123978(null);})[_0xf416('0xc')](_0x123978(null));};}for(var e in events){if(events[_0xf416('0xd')](e)){var event=events[e];ChatInteraction[_0xf416('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x7536=['Users','map','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7536,0x97));var _0x6753=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x7536[_0x4e6eb2];return _0x4e0c1c;};'use strict';var EventEmitter=require(_0x6753('0x0'));var ChatInteraction=require(_0x6753('0x1'))['db'][_0x6753('0x2')];var ChatMessage=require(_0x6753('0x1'))['db'][_0x6753('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6753('0x4')](0x0);var events={'afterCreate':_0x6753('0x5'),'afterUpdate':_0x6753('0x6'),'afterDestroy':_0x6753('0x7')};function emitEvent(_0x3b20ff){return function(_0x1a902d,_0x4651a1,_0x282b86){_0x1a902d[_0x6753('0x8')]({'attributes':['id'],'raw':!![]})[_0x6753('0x9')](function(_0x1a88d8){_0x1a902d[_0x6753('0xa')](_0x6753('0xb'),_0x1a88d8[_0x6753('0xc')](function(_0x3f3377){return{'id':_0x3f3377['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1a902d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2382ae){_0x1a902d[_0x6753('0xa')](_0x6753('0xd'),_0x2382ae['length']);ChatInteractionEvents[_0x6753('0xe')](_0x3b20ff+':'+_0x1a902d['id'],_0x1a902d);ChatInteractionEvents[_0x6753('0xe')](_0x3b20ff,_0x1a902d);_0x282b86(null);})[_0x6753('0xf')](_0x282b86(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x6753('0x10')](e,emitEvent(event));}}module[_0x6753('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 013f68b..5b8e98f 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 _0x8a03=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions'];(function(_0x249fa3,_0xdd0af9){var _0x5eb304=function(_0x51d434){while(--_0x51d434){_0x249fa3['push'](_0x249fa3['shift']());}};_0x5eb304(++_0xdd0af9);}(_0x8a03,0xc3));var _0x38a0=function(_0x41b809,_0x5af527){_0x41b809=_0x41b809-0x0;var _0x5abfc8=_0x8a03[_0x41b809];return _0x5abfc8;};'use strict';var _=require(_0x38a0('0x0'));var util=require(_0x38a0('0x1'));var logger=require(_0x38a0('0x2'))(_0x38a0('0x3'));var moment=require(_0x38a0('0x4'));var BPromise=require(_0x38a0('0x5'));var rp=require(_0x38a0('0x6'));var fs=require('fs');var path=require(_0x38a0('0x7'));var rimraf=require(_0x38a0('0x8'));var config=require(_0x38a0('0x9'));var attributes=require(_0x38a0('0xa'));module['exports']=function(_0x371763,_0x4b1c13){return _0x371763[_0x38a0('0xb')](_0x38a0('0xc'),attributes,{'tableName':_0x38a0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x169f89,_0x585dcf,_0xf4ee16){if(_0x169f89[_0x38a0('0xe')](_0x38a0('0xf'))){_0x169f89[_0x38a0('0x10')]=moment()[_0x38a0('0x11')](_0x38a0('0x12'));}_0xf4ee16(null,_0x169f89);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x76ec=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions'];(function(_0x40a1fd,_0x2e0977){var _0x496317=function(_0x17e189){while(--_0x17e189){_0x40a1fd['push'](_0x40a1fd['shift']());}};_0x496317(++_0x2e0977);}(_0x76ec,0x7d));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc76e('0x0'));var util=require(_0xc76e('0x1'));var logger=require(_0xc76e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc76e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc76e('0x4'));var rimraf=require(_0xc76e('0x5'));var config=require(_0xc76e('0x6'));var attributes=require(_0xc76e('0x7'));module['exports']=function(_0x30632d,_0x12b151){return _0x30632d[_0xc76e('0x8')](_0xc76e('0x9'),attributes,{'tableName':_0xc76e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x335a07,_0x1624a4,_0x2ae79d){if(_0x335a07[_0xc76e('0xb')]('closed')){_0x335a07[_0xc76e('0xc')]=moment()[_0xc76e('0xd')](_0xc76e('0xe'));}_0x2ae79d(null,_0x335a07);}},'charset':_0xc76e('0xf'),'collate':_0xc76e('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index c060a8c..b1ca528 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 _0x7d90=['socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','stringify','AddTagsToChatInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','redis'];(function(_0x2ac5c7,_0x21a0a5){var _0x1bd226=function(_0x9a4f69){while(--_0x9a4f69){_0x2ac5c7['push'](_0x2ac5c7['shift']());}};_0x1bd226(++_0x21a0a5);}(_0x7d90,0x14c));var _0x07d9=function(_0x1aee0e,_0x34314e){_0x1aee0e=_0x1aee0e-0x0;var _0x491589=_0x7d90[_0x1aee0e];return _0x491589;};'use strict';var _=require(_0x07d9('0x0'));var util=require(_0x07d9('0x1'));var moment=require(_0x07d9('0x2'));var BPromise=require(_0x07d9('0x3'));var rs=require(_0x07d9('0x4'));var fs=require('fs');var Redis=require(_0x07d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x07d9('0x6'));var logger=require(_0x07d9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x07d9('0x8')]['http']({'port':0x232a});config[_0x07d9('0x9')]=_['defaults'](config[_0x07d9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x07d9('0xa'))(new Redis(config['redis']));require(_0x07d9('0xb'))['register'](socket);function respondWithRpcPromise(_0x5b8be8,_0x5b7628,_0x52c691){return new BPromise(function(_0x4cedcf,_0x409ae7){return client['request'](_0x5b8be8,_0x52c691)[_0x07d9('0xc')](function(_0x4d6284){logger[_0x07d9('0xd')](_0x07d9('0xe'),_0x5b7628,_0x07d9('0xf'));logger[_0x07d9('0x10')](_0x07d9('0x11'),_0x5b7628,_0x07d9('0xf'),JSON['stringify'](_0x4d6284));if(_0x4d6284[_0x07d9('0x12')]){if(_0x4d6284[_0x07d9('0x12')][_0x07d9('0x13')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5b7628,_0x4d6284[_0x07d9('0x12')][_0x07d9('0x14')]);return _0x409ae7(_0x4d6284[_0x07d9('0x12')][_0x07d9('0x14')]);}logger[_0x07d9('0x12')](_0x07d9('0xe'),_0x5b7628,_0x4d6284[_0x07d9('0x12')][_0x07d9('0x14')]);return _0x4cedcf(_0x4d6284[_0x07d9('0x12')]['message']);}else{logger['info'](_0x07d9('0xe'),_0x5b7628,_0x07d9('0xf'));_0x4cedcf(_0x4d6284[_0x07d9('0x15')][_0x07d9('0x14')]);}})[_0x07d9('0x16')](function(_0xbc3a1a){logger[_0x07d9('0x12')](_0x07d9('0xe'),_0x5b7628,_0xbc3a1a);_0x409ae7(_0xbc3a1a);});});}exports[_0x07d9('0x17')]=function(_0x387ac9){var _0x4ef536=this;return new Promise(function(_0x502bfb,_0x5c300a){return db[_0x07d9('0x18')][_0x07d9('0x19')](_0x387ac9[_0x07d9('0x1a')],{'raw':_0x387ac9[_0x07d9('0x1b')]?_0x387ac9['options'][_0x07d9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x387ac9[_0x07d9('0x1b')]?_0x387ac9['options'][_0x07d9('0x1d')]||null:null,'attributes':_0x387ac9[_0x07d9('0x1b')]?_0x387ac9[_0x07d9('0x1b')][_0x07d9('0x1e')]||null:null,'limit':_0x387ac9[_0x07d9('0x1b')]?_0x387ac9[_0x07d9('0x1b')]['limit']||null:null})[_0x07d9('0xc')](function(_0x52b7cc){logger[_0x07d9('0xd')](_0x07d9('0x17'),_0x387ac9);logger[_0x07d9('0x10')](_0x07d9('0x17'),_0x387ac9,JSON[_0x07d9('0x1f')](_0x52b7cc));_0x502bfb(_0x52b7cc);})[_0x07d9('0x16')](function(_0x4a9a78){logger[_0x07d9('0x12')](_0x07d9('0x17'),_0x4a9a78[_0x07d9('0x14')],_0x387ac9);_0x5c300a(_0x4ef536['error'](0x1f4,_0x4a9a78[_0x07d9('0x14')]));});});};exports[_0x07d9('0x20')]=function(_0x1e94df){return new Promise(function(_0x190bc3,_0x301e71){return db[_0x07d9('0x18')][_0x07d9('0x21')]({'where':_0x1e94df[_0x07d9('0x1b')]?_0x1e94df[_0x07d9('0x1b')]['where']||null:null})[_0x07d9('0xc')](function(_0x5f0b18){if(_0x5f0b18){return _0x5f0b18[_0x07d9('0x22')](_0x1e94df[_0x07d9('0x1a')]['ids'],_[_0x07d9('0x23')](_0x1e94df[_0x07d9('0x1a')],[_0x07d9('0x24'),'id'])||{});}})['spread'](function(_0x11de5c){logger[_0x07d9('0xd')]('AddTags',_0x1e94df);logger[_0x07d9('0x10')](_0x07d9('0x25'),_0x1e94df,JSON['stringify'](_0x11de5c));_0x190bc3(_0x11de5c);})[_0x07d9('0x16')](function(_0x5e2808){logger['error'](_0x07d9('0x25'),_0x5e2808[_0x07d9('0x14')],_0x1e94df);_0x301e71(_this[_0x07d9('0x12')](0x1f4,_0x5e2808[_0x07d9('0x14')]));});});}; \ No newline at end of file +var _0x5672=['body','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','then','AddTagsToChatInteraction','find','addTags'];(function(_0x40eba3,_0x37c878){var _0x1131e6=function(_0x23c09f){while(--_0x23c09f){_0x40eba3['push'](_0x40eba3['shift']());}};_0x1131e6(++_0x37c878);}(_0x5672,0x19b));var _0x2567=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x5672[_0x77d310];return _0x2cdce4;};'use strict';var _=require(_0x2567('0x0'));var util=require(_0x2567('0x1'));var moment=require(_0x2567('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2567('0x3'));var db=require(_0x2567('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2567('0x5'))('rpc');var config=require(_0x2567('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x2567('0x7')](config[_0x2567('0x8')],{'host':_0x2567('0x9'),'port':0x18eb});var socket=require(_0x2567('0xa'))(new Redis(config['redis']));require(_0x2567('0xb'))[_0x2567('0xc')](socket);function respondWithRpcPromise(_0x661c0e,_0x3e2291,_0x57dedc){return new BPromise(function(_0x23dd83,_0x39582a){return client[_0x2567('0xd')](_0x661c0e,_0x57dedc)['then'](function(_0x4100a9){logger[_0x2567('0xe')](_0x2567('0xf'),_0x3e2291,'request\x20sent');logger[_0x2567('0x10')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3e2291,_0x2567('0x11'),JSON[_0x2567('0x12')](_0x4100a9));if(_0x4100a9['error']){if(_0x4100a9[_0x2567('0x13')]['code']===0x1f4){logger['error'](_0x2567('0xf'),_0x3e2291,_0x4100a9[_0x2567('0x13')][_0x2567('0x14')]);return _0x39582a(_0x4100a9[_0x2567('0x13')]['message']);}logger[_0x2567('0x13')](_0x2567('0xf'),_0x3e2291,_0x4100a9[_0x2567('0x13')][_0x2567('0x14')]);return _0x23dd83(_0x4100a9['error'][_0x2567('0x14')]);}else{logger['info'](_0x2567('0xf'),_0x3e2291,'request\x20sent');_0x23dd83(_0x4100a9[_0x2567('0x15')]['message']);}})[_0x2567('0x16')](function(_0x5d6b22){logger[_0x2567('0x13')](_0x2567('0xf'),_0x3e2291,_0x5d6b22);_0x39582a(_0x5d6b22);});});}exports[_0x2567('0x17')]=function(_0x43f9b8){var _0x40a27c=this;return new Promise(function(_0x4b55be,_0x4d72d6){return db[_0x2567('0x18')][_0x2567('0x19')](_0x43f9b8['body'],{'raw':_0x43f9b8[_0x2567('0x1a')]?_0x43f9b8[_0x2567('0x1a')][_0x2567('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43f9b8['options']?_0x43f9b8[_0x2567('0x1a')][_0x2567('0x1c')]||null:null,'attributes':_0x43f9b8[_0x2567('0x1a')]?_0x43f9b8[_0x2567('0x1a')]['attributes']||null:null,'limit':_0x43f9b8['options']?_0x43f9b8[_0x2567('0x1a')]['limit']||null:null})[_0x2567('0x1d')](function(_0x23cd27){logger[_0x2567('0xe')](_0x2567('0x17'),_0x43f9b8);logger[_0x2567('0x10')](_0x2567('0x17'),_0x43f9b8,JSON['stringify'](_0x23cd27));_0x4b55be(_0x23cd27);})[_0x2567('0x16')](function(_0x4b2909){logger[_0x2567('0x13')](_0x2567('0x17'),_0x4b2909[_0x2567('0x14')],_0x43f9b8);_0x4d72d6(_0x40a27c[_0x2567('0x13')](0x1f4,_0x4b2909[_0x2567('0x14')]));});});};exports[_0x2567('0x1e')]=function(_0x3c1cd4){return new Promise(function(_0x49d000,_0x4f071b){return db[_0x2567('0x18')][_0x2567('0x1f')]({'where':_0x3c1cd4[_0x2567('0x1a')]?_0x3c1cd4['options'][_0x2567('0x1c')]||null:null})[_0x2567('0x1d')](function(_0x112a67){if(_0x112a67){return _0x112a67[_0x2567('0x20')](_0x3c1cd4[_0x2567('0x21')]['ids'],_[_0x2567('0x22')](_0x3c1cd4[_0x2567('0x21')],['ids','id'])||{});}})[_0x2567('0x23')](function(_0x1a1745){logger['info'](_0x2567('0x24'),_0x3c1cd4);logger['debug'](_0x2567('0x24'),_0x3c1cd4,JSON['stringify'](_0x1a1745));_0x49d000(_0x1a1745);})[_0x2567('0x16')](function(_0x323ee4){logger['error'](_0x2567('0x24'),_0x323ee4['message'],_0x3c1cd4);_0x4f071b(_this[_0x2567('0x13')](0x1f4,_0x323ee4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 120442d..8307dd8 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 _0xf589=['chatInteraction:','./chatInteraction.events','save','update','emit','register','length'];(function(_0x1649fe,_0x5916da){var _0x473a67=function(_0x163cae){while(--_0x163cae){_0x1649fe['push'](_0x1649fe['shift']());}};_0x473a67(++_0x5916da);}(_0xf589,0xe1));var _0x9f58=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf589[_0x432682];return _0x463d05;};'use strict';var ChatInteractionEvents=require(_0x9f58('0x0'));var events=[_0x9f58('0x1'),'remove',_0x9f58('0x2')];function createListener(_0x37c1dc,_0x3f6987){return function(_0x1b6027){_0x3f6987[_0x9f58('0x3')](_0x37c1dc,_0x1b6027);};}function removeListener(_0x394339,_0x1fe604){return function(){ChatInteractionEvents['removeListener'](_0x394339,_0x1fe604);};}exports[_0x9f58('0x4')]=function(_0x4fdb49){for(var _0x76c022=0x0,_0xbe6926=events[_0x9f58('0x5')];_0x76c022<_0xbe6926;_0x76c022++){var _0x39578a=events[_0x76c022];var _0x1c4bde=createListener(_0x9f58('0x6')+_0x39578a,_0x4fdb49);ChatInteractionEvents['on'](_0x39578a,_0x1c4bde);}}; \ No newline at end of file +var _0x6bbe=['length','chatInteraction:','./chatInteraction.events','save','update','emit','removeListener','register'];(function(_0x5c7995,_0x55727f){var _0x1bf482=function(_0x3fd79c){while(--_0x3fd79c){_0x5c7995['push'](_0x5c7995['shift']());}};_0x1bf482(++_0x55727f);}(_0x6bbe,0x172));var _0xe6bb=function(_0x4b16b5,_0x2405c6){_0x4b16b5=_0x4b16b5-0x0;var _0x498d87=_0x6bbe[_0x4b16b5];return _0x498d87;};'use strict';var ChatInteractionEvents=require(_0xe6bb('0x0'));var events=[_0xe6bb('0x1'),'remove',_0xe6bb('0x2')];function createListener(_0x3c3ca0,_0xde9621){return function(_0x4f0622){_0xde9621[_0xe6bb('0x3')](_0x3c3ca0,_0x4f0622);};}function removeListener(_0x410cc9,_0x38d8d0){return function(){ChatInteractionEvents[_0xe6bb('0x4')](_0x410cc9,_0x38d8d0);};}exports[_0xe6bb('0x5')]=function(_0x3742d0){for(var _0x2c74d8=0x0,_0x2fef59=events[_0xe6bb('0x6')];_0x2c74d8<_0x2fef59;_0x2c74d8++){var _0x21bbdd=events[_0x2c74d8];var _0xfe720b=createListener(_0xe6bb('0x7')+_0x21bbdd,_0x3742d0);ChatInteractionEvents['on'](_0x21bbdd,_0xfe720b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index fd08a12..fec7bc5 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 _0xc0b8=['replace','file','attachmentUpload','addMessage','chat','chatinteraction:addtags','addTags','put','/:id','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/attachment_download','isChatInteractionAuthorized','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','join','root','server/files/attachments/','format','%s-%s','now'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0xc0b8,0x1d0));var _0x8c0b=function(_0x865991,_0xc30a8){_0x865991=_0x865991-0x0;var _0x334bc8=_0xc0b8[_0x865991];return _0x334bc8;};'use strict';var multer=require('multer');var util=require(_0x8c0b('0x0'));var path=require(_0x8c0b('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c0b('0x2'));var router=express[_0x8c0b('0x3')]();var fs_extra=require(_0x8c0b('0x4'));var auth=require(_0x8c0b('0x5'));var interaction=require(_0x8c0b('0x6'));var config=require(_0x8c0b('0x7'));var controller=require(_0x8c0b('0x8'));router[_0x8c0b('0x9')]('/',auth[_0x8c0b('0xa')](),controller[_0x8c0b('0xb')]);router[_0x8c0b('0x9')](_0x8c0b('0xc'),auth[_0x8c0b('0xa')](),controller[_0x8c0b('0xd')]);router[_0x8c0b('0x9')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x8c0b('0xe')]);router[_0x8c0b('0x9')](_0x8c0b('0xf'),auth[_0x8c0b('0x10')](),controller['attachmentDownload']);router[_0x8c0b('0x9')](_0x8c0b('0x11'),auth[_0x8c0b('0xa')](),controller[_0x8c0b('0x12')]);router[_0x8c0b('0x9')]('/:id/my_messages',auth[_0x8c0b('0x10')](),controller[_0x8c0b('0x13')]);router[_0x8c0b('0x9')](_0x8c0b('0x14'),auth[_0x8c0b('0xa')](),controller[_0x8c0b('0x15')]);router[_0x8c0b('0x16')]('/',auth[_0x8c0b('0xa')](),controller[_0x8c0b('0x17')]);router[_0x8c0b('0x16')](_0x8c0b('0x18'),auth[_0x8c0b('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x225cbe,_0x225c5f,_0x4627c8){_0x4627c8(null,path[_0x8c0b('0x19')](config[_0x8c0b('0x1a')],_0x8c0b('0x1b')));},'filename':function(_0x191761,_0x3c796e,_0x3e11db){_0x3e11db(null,util[_0x8c0b('0x1c')](_0x8c0b('0x1d'),Date[_0x8c0b('0x1e')](),_0x3c796e['originalname'][_0x8c0b('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single'](_0x8c0b('0x20')),controller[_0x8c0b('0x21')]);router['post']('/:id/messages',auth[_0x8c0b('0x10')](),controller[_0x8c0b('0x22')]);router[_0x8c0b('0x16')]('/:id/tags',auth[_0x8c0b('0xa')](),interaction['tracked'](_0x8c0b('0x23'),_0x8c0b('0x24')),controller[_0x8c0b('0x25')]);router[_0x8c0b('0x26')](_0x8c0b('0x27'),auth[_0x8c0b('0xa')](),interaction[_0x8c0b('0x28')](_0x8c0b('0x23'),_0x8c0b('0x29')),controller[_0x8c0b('0x2a')]);router[_0x8c0b('0x26')](_0x8c0b('0x2b'),controller[_0x8c0b('0x2c')]);router['put'](_0x8c0b('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0x8c0b('0x2e')]);router[_0x8c0b('0x26')](_0x8c0b('0x2f'),controller[_0x8c0b('0x30')]);router['delete'](_0x8c0b('0x27'),auth[_0x8c0b('0xa')](),interaction[_0x8c0b('0x28')](_0x8c0b('0x23'),_0x8c0b('0x31')),controller[_0x8c0b('0x32')]);router[_0x8c0b('0x33')](_0x8c0b('0x34'),auth[_0x8c0b('0xa')](),controller[_0x8c0b('0x35')]);module[_0x8c0b('0x36')]=router; \ No newline at end of file +var _0x651d=['chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','now','originalname','/:id/attachment_upload','single','file','/:id/tags','chat'];(function(_0x104662,_0x53a7a7){var _0x19cba7=function(_0x5a76c0){while(--_0x5a76c0){_0x104662['push'](_0x104662['shift']());}};_0x19cba7(++_0x53a7a7);}(_0x651d,0x111));var _0xd651=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0x651d[_0x5756c6];return _0x4b5806;};'use strict';var multer=require(_0xd651('0x0'));var util=require(_0xd651('0x1'));var path=require(_0xd651('0x2'));var timeout=require(_0xd651('0x3'));var express=require(_0xd651('0x4'));var router=express[_0xd651('0x5')]();var fs_extra=require(_0xd651('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd651('0x7'));var controller=require(_0xd651('0x8'));router[_0xd651('0x9')]('/',auth[_0xd651('0xa')](),controller[_0xd651('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd651('0xc')]);router['get'](_0xd651('0xd'),auth[_0xd651('0xe')](),controller[_0xd651('0xf')]);router[_0xd651('0x9')](_0xd651('0x10'),auth['isChatInteractionAuthorized'](),controller[_0xd651('0x11')]);router[_0xd651('0x9')](_0xd651('0x12'),auth['isAuthenticated'](),controller[_0xd651('0x13')]);router[_0xd651('0x9')](_0xd651('0x14'),auth[_0xd651('0xe')](),controller[_0xd651('0x15')]);router['get'](_0xd651('0x16'),auth[_0xd651('0xa')](),controller[_0xd651('0x17')]);router['post']('/',auth[_0xd651('0xa')](),controller[_0xd651('0x18')]);router[_0xd651('0x19')](_0xd651('0x1a'),auth[_0xd651('0xa')](),controller[_0xd651('0x1b')]);var upload=multer({'storage':multer[_0xd651('0x1c')]({'destination':function(_0x34cdd4,_0x1cf519,_0x417f5a){_0x417f5a(null,path[_0xd651('0x1d')](config[_0xd651('0x1e')],'server/files/attachments/'));},'filename':function(_0x33c610,_0x42eab1,_0x26e244){_0x26e244(null,util[_0xd651('0x1f')]('%s-%s',Date[_0xd651('0x20')](),_0x42eab1[_0xd651('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd651('0x19')](_0xd651('0x22'),upload[_0xd651('0x23')](_0xd651('0x24')),controller['attachmentUpload']);router['post'](_0xd651('0x12'),auth[_0xd651('0xe')](),controller['addMessage']);router[_0xd651('0x19')](_0xd651('0x25'),auth[_0xd651('0xa')](),interaction['tracked'](_0xd651('0x26'),_0xd651('0x27')),controller[_0xd651('0x28')]);router[_0xd651('0x29')]('/:id',auth[_0xd651('0xa')](),interaction[_0xd651('0x2a')](_0xd651('0x26'),_0xd651('0x2b')),controller[_0xd651('0x2c')]);router[_0xd651('0x29')]('/:id/custom_update',controller[_0xd651('0x2d')]);router[_0xd651('0x29')](_0xd651('0x2e'),auth['isChatInteractionAuthorized'](),controller[_0xd651('0x2f')]);router['put'](_0xd651('0x30'),controller['close']);router[_0xd651('0x31')](_0xd651('0xd'),auth[_0xd651('0xa')](),interaction[_0xd651('0x2a')](_0xd651('0x26'),_0xd651('0x32')),controller[_0xd651('0x33')]);router['delete'](_0xd651('0x25'),auth['isAuthenticated'](),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 c871be4..c36f9ab 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 _0x0731=['BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x5ae11e,_0x52f33d){var _0x362203=function(_0x42aced){while(--_0x42aced){_0x5ae11e['push'](_0x5ae11e['shift']());}};_0x362203(++_0x52f33d);}(_0x0731,0x1de));var _0x1073=function(_0x219a58,_0x14a9a6){_0x219a58=_0x219a58-0x0;var _0x4fdc46=_0x0731[_0x219a58];return _0x4fdc46;};'use strict';var Sequelize=require(_0x1073('0x0'));module['exports']={'body':{'type':Sequelize[_0x1073('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1073('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1073('0x3')]}}; \ No newline at end of file +var _0x5ab6=['INTEGER','sequelize','TEXT','medium'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5ab6,0x19d));var _0x65ab=function(_0x6d4970,_0x4dae29){_0x6d4970=_0x6d4970-0x0;var _0x3597e3=_0x5ab6[_0x6d4970];return _0x3597e3;};'use strict';var Sequelize=require(_0x65ab('0x0'));module['exports']={'body':{'type':Sequelize[_0x65ab('0x1')](_0x65ab('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65ab('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 20f35ec..252801f 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 _0x0519=['agent','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','length','createdAt','FromId','read','-createdAt','all','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','ChatInternalMessage','rawAttributes','type','model','map','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','destroy','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers'];(function(_0x447572,_0x3231e8){var _0x1032bb=function(_0x5e7b60){while(--_0x5e7b60){_0x447572['push'](_0x447572['shift']());}};_0x1032bb(++_0x3231e8);}(_0x0519,0x177));var _0x9051=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0x0519[_0x101a17];return _0x3b76ee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9051('0x0'));var jsonpatch=require(_0x9051('0x1'));var rp=require(_0x9051('0x2'));var moment=require(_0x9051('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9051('0x4'));var util=require('util');var path=require(_0x9051('0x5'));var sox=require(_0x9051('0x6'));var csv=require(_0x9051('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9051('0x8'));var _=require(_0x9051('0x9'));var squel=require(_0x9051('0xa'));var crypto=require(_0x9051('0xb'));var jsforce=require(_0x9051('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9051('0x7'));var querystring=require(_0x9051('0xd'));var Papa=require(_0x9051('0xe'));var Redis=require(_0x9051('0xf'));var authService=require(_0x9051('0x10'));var qs=require(_0x9051('0x11'));var as=require(_0x9051('0x12'));var hardwareService=require(_0x9051('0x13'));var logger=require(_0x9051('0x14'))('api');var utils=require(_0x9051('0x15'));var config=require(_0x9051('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9051('0x17'))['db'];config[_0x9051('0x18')]=_[_0x9051('0x19')](config[_0x9051('0x18')],{'host':_0x9051('0x1a'),'port':0x18eb});var socket=require(_0x9051('0x1b'))(new Redis(config['redis']));require(_0x9051('0x1c'))[_0x9051('0x1d')](socket);function respondWithStatusCode(_0x16087c,_0x341a00){_0x341a00=_0x341a00||0xcc;return function(_0x3309aa){if(_0x3309aa){return _0x16087c[_0x9051('0x1e')](_0x341a00);}return _0x16087c['status'](_0x341a00)[_0x9051('0x1f')]();};}function respondWithResult(_0x7255f0,_0x44b43d){_0x44b43d=_0x44b43d||0xc8;return function(_0x43cfb2){if(_0x43cfb2){return _0x7255f0[_0x9051('0x20')](_0x44b43d)[_0x9051('0x21')](_0x43cfb2);}};}function respondWithFilteredResult(_0x1a6670,_0x2f87e1){return function(_0x48230a){if(_0x48230a){var _0x374867=typeof _0x2f87e1['offset']===_0x9051('0x22')&&typeof _0x2f87e1[_0x9051('0x23')]===_0x9051('0x22');var _0x32905a=_0x48230a['count'];var _0x7d9350=_0x374867?0x0:_0x2f87e1[_0x9051('0x24')];var _0x22cab4=_0x374867?_0x48230a[_0x9051('0x25')]:_0x2f87e1[_0x9051('0x24')]+_0x2f87e1['limit'];var _0x2d57ea;if(_0x22cab4>=_0x32905a){_0x22cab4=_0x32905a;_0x2d57ea=0xc8;}else{_0x2d57ea=0xce;}_0x1a6670[_0x9051('0x20')](_0x2d57ea);return _0x1a6670[_0x9051('0x26')](_0x9051('0x27'),_0x7d9350+'-'+_0x22cab4+'/'+_0x32905a)[_0x9051('0x21')](_0x48230a);}return null;};}function patchUpdates(_0x96dacc){return function(_0x42928e){try{jsonpatch[_0x9051('0x28')](_0x42928e,_0x96dacc,!![]);}catch(_0x4399b4){return BPromise[_0x9051('0x29')](_0x4399b4);}return _0x42928e[_0x9051('0x2a')]();};}function saveUpdates(_0x2ac661,_0x12d33e){return function(_0x410291){if(_0x410291){return _0x410291[_0x9051('0x2b')](_0x2ac661)['then'](function(_0x148cf2){return _0x148cf2;});}return null;};}function removeEntity(_0x34a09b,_0x1ce320){return function(_0x4c70f6){if(_0x4c70f6){return _0x4c70f6['destroy']()[_0x9051('0x2c')](function(){_0x34a09b['status'](0xcc)[_0x9051('0x1f')]();});}};}function handleEntityNotFound(_0x52e074,_0xb078bb){return function(_0x470786){if(!_0x470786){_0x52e074[_0x9051('0x1e')](0x194);}return _0x470786;};}function handleError(_0x1bc72b,_0x5c9f07){_0x5c9f07=_0x5c9f07||0x1f4;return function(_0x57efa5){logger[_0x9051('0x2d')](_0x57efa5[_0x9051('0x2e')]);if(_0x57efa5[_0x9051('0x2f')]){delete _0x57efa5[_0x9051('0x2f')];}_0x1bc72b[_0x9051('0x20')](_0x5c9f07)[_0x9051('0x30')](_0x57efa5);};}exports[_0x9051('0x31')]=function(_0x847ba7,_0x35aad1){var _0xba991a={},_0x462011={},_0x34237c={'count':0x0,'rows':[]};var _0x8aa8cb=_['map'](db[_0x9051('0x32')][_0x9051('0x33')],function(_0xe238c7){return{'name':_0xe238c7['fieldName'],'type':_0xe238c7[_0x9051('0x34')]['key']};});_0x462011[_0x9051('0x35')]=_[_0x9051('0x36')](_0x8aa8cb,'name');_0x462011[_0x9051('0x37')]=_[_0x9051('0x38')](_0x847ba7[_0x9051('0x37')]);_0x462011[_0x9051('0x39')]=_['intersection'](_0x462011[_0x9051('0x35')],_0x462011[_0x9051('0x37')]);_0xba991a[_0x9051('0x3a')]=_['intersection'](_0x462011[_0x9051('0x35')],qs[_0x9051('0x3b')](_0x847ba7[_0x9051('0x37')][_0x9051('0x3b')]));_0xba991a['attributes']=_0xba991a[_0x9051('0x3a')]['length']?_0xba991a['attributes']:_0x462011[_0x9051('0x35')];if(!_0x847ba7[_0x9051('0x37')][_0x9051('0x3c')]('nolimit')){_0xba991a['limit']=qs[_0x9051('0x23')](_0x847ba7[_0x9051('0x37')]['limit']);_0xba991a[_0x9051('0x24')]=qs[_0x9051('0x24')](_0x847ba7[_0x9051('0x37')][_0x9051('0x24')]);}_0xba991a[_0x9051('0x3d')]=qs[_0x9051('0x3e')](_0x847ba7[_0x9051('0x37')][_0x9051('0x3e')]);_0xba991a[_0x9051('0x3f')]=qs[_0x9051('0x39')](_[_0x9051('0x40')](_0x847ba7['query'],_0x462011['filters']),_0x8aa8cb);if(_0x847ba7[_0x9051('0x37')][_0x9051('0x41')]){_0xba991a[_0x9051('0x3f')]=_[_0x9051('0x42')](_0xba991a['where'],{'$or':_[_0x9051('0x36')](_0x8aa8cb,function(_0x470978){if(_0x470978[_0x9051('0x34')]!==_0x9051('0x43')){var _0x4a7f1f={};_0x4a7f1f[_0x470978[_0x9051('0x2f')]]={'$like':'%'+_0x847ba7[_0x9051('0x37')][_0x9051('0x41')]+'%'};return _0x4a7f1f;}})});}_0xba991a=_[_0x9051('0x42')]({},_0xba991a,_0x847ba7[_0x9051('0x44')]);var _0x3b7165={'where':_0xba991a['where']};return db[_0x9051('0x32')]['count'](_0x3b7165)[_0x9051('0x2c')](function(_0x348e59){_0x34237c['count']=_0x348e59;if(_0x847ba7['query'][_0x9051('0x45')]){_0xba991a[_0x9051('0x46')]=[{'all':!![]}];}return db[_0x9051('0x32')][_0x9051('0x47')](_0xba991a);})[_0x9051('0x2c')](function(_0x17ad17){_0x34237c[_0x9051('0x48')]=_0x17ad17;return _0x34237c;})[_0x9051('0x2c')](respondWithFilteredResult(_0x35aad1,_0xba991a))[_0x9051('0x49')](handleError(_0x35aad1,null));};exports[_0x9051('0x4a')]=function(_0x2f6663,_0x6df7e0){var _0x625611={'raw':!![],'where':{'id':_0x2f6663[_0x9051('0x4b')]['id']}},_0x1517a4={};_0x1517a4[_0x9051('0x35')]=_[_0x9051('0x38')](db[_0x9051('0x32')][_0x9051('0x33')]);_0x1517a4[_0x9051('0x37')]=_[_0x9051('0x38')](_0x2f6663[_0x9051('0x37')]);_0x1517a4[_0x9051('0x39')]=_['intersection'](_0x1517a4[_0x9051('0x35')],_0x1517a4[_0x9051('0x37')]);_0x625611[_0x9051('0x3a')]=_[_0x9051('0x4c')](_0x1517a4[_0x9051('0x35')],qs['fields'](_0x2f6663['query']['fields']));_0x625611[_0x9051('0x3a')]=_0x625611['attributes']['length']?_0x625611[_0x9051('0x3a')]:_0x1517a4[_0x9051('0x35')];if(_0x2f6663['query'][_0x9051('0x45')]){_0x625611[_0x9051('0x46')]=[{'all':!![]}];}_0x625611=_[_0x9051('0x42')]({},_0x625611,_0x2f6663[_0x9051('0x44')]);return db['ChatInternalMessage'][_0x9051('0x4d')](_0x625611)[_0x9051('0x2c')](handleEntityNotFound(_0x6df7e0,null))['then'](respondWithResult(_0x6df7e0,null))['catch'](handleError(_0x6df7e0,null));};exports['create']=function(_0x429299,_0x4be3a5){return db['ChatInternalMessage'][_0x9051('0x4e')](_0x429299[_0x9051('0x4f')],{})[_0x9051('0x2c')](respondWithResult(_0x4be3a5,0xc9))[_0x9051('0x49')](handleError(_0x4be3a5,null));};exports[_0x9051('0x2b')]=function(_0x20d740,_0x44defb){if(_0x20d740['body']['id']){delete _0x20d740[_0x9051('0x4f')]['id'];}return db[_0x9051('0x32')]['find']({'where':{'id':_0x20d740[_0x9051('0x4b')]['id']}})[_0x9051('0x2c')](handleEntityNotFound(_0x44defb,null))[_0x9051('0x2c')](saveUpdates(_0x20d740[_0x9051('0x4f')],null))['then'](respondWithResult(_0x44defb,null))['catch'](handleError(_0x44defb,null));};exports[_0x9051('0x50')]=function(_0x5a0e72,_0x43785d){return db[_0x9051('0x32')][_0x9051('0x4d')]({'where':{'id':_0x5a0e72['params']['id']}})[_0x9051('0x2c')](handleEntityNotFound(_0x43785d,null))[_0x9051('0x2c')](removeEntity(_0x43785d,null))[_0x9051('0x49')](handleError(_0x43785d,null));};exports[_0x9051('0x51')]=function(_0x2b5060,_0x166461){return db[_0x9051('0x32')][_0x9051('0x51')]()['then'](respondWithResult(_0x166461,null))['catch'](handleError(_0x166461,null));};function wrapUser(_0x344777){return function(_0x2648b3){var _0x5bf0d0=_0x344777[_0x9051('0x52')]({'plain':!![]});_0x5bf0d0[_0x9051('0x53')]=[];if(_0x2648b3){_0x5bf0d0[_0x9051('0x54')]=_0x2648b3['createdAt'];_0x5bf0d0[_0x9051('0x55')]=_0x2648b3;}else{_0x5bf0d0['lastMessageAt']=moment(0x0)[_0x9051('0x56')](_0x9051('0x57'));_0x5bf0d0[_0x9051('0x55')]={};}return _0x5bf0d0;};}exports[_0x9051('0x58')]=function(_0x46220a,_0x288985,_0x299f77){var _0xb94493=[];return db['User']['findAll']({'where':{'role':[_0x9051('0x59'),_0x9051('0x5a'),_0x9051('0x5b')]},'attributes':['id',_0x9051('0x5c'),_0x9051('0x2f'),_0x9051('0x5d'),_0x9051('0x5e'),_0x9051('0x5f'),'online',_0x9051('0x60'),_0x9051('0x61'),_0x9051('0x62')],'order':qs['sort'](_0x9051('0x63')),'include':[{'model':db[_0x9051('0x64')],'as':_0x9051('0x65'),'attributes':['id',_0x9051('0x2f'),_0x9051('0x34')],'through':{'attributes':[]}}]})[_0x9051('0x2c')](function(_0x46561b){if(_0x46561b){var _0x1d1e65=_0x46220a[_0x9051('0x5b')][_0x9051('0x52')]({'plain':!![]});if(!_0x1d1e65)throw new Error(_0x9051('0x66'));if(_0x1d1e65[_0x9051('0x5d')]==='user'){return db['UserProfileSection'][_0x9051('0x4d')]({'where':{'name':_0x9051('0x67'),'userProfileId':_0x1d1e65[_0x9051('0x68')]},'raw':!![]})[_0x9051('0x2c')](function(_0x2cfd31){if(_0x2cfd31){if(_0x2cfd31[_0x9051('0x69')]===0x0){return db[_0x9051('0x6a')]['findAll']({'where':{'sectionId':_0x2cfd31['id']},'raw':!![]})['then'](function(_0x5024a0){var _0x461b9a=[];if(_[_0x9051('0x6b')](_0x5024a0)){_0x461b9a=_['filter'](_0x46561b,function(_0x157c97){if(_0x157c97['role']!==_0x9051('0x59')){return _0x157c97;}});return _0x461b9a;}else{for(var _0x21b9c7=0x0;_0x21b9c7<_0x46561b['length'];_0x21b9c7++){var _0x419e00=_0x46561b[_0x21b9c7];if(_0x419e00[_0x9051('0x5d')]===_0x9051('0x59')){var _0xd21f35=_['find'](_0x5024a0,function(_0x8efc0){return _0x8efc0[_0x9051('0x6c')]===_0x419e00['id'];});if(_0xd21f35)_0x461b9a[_0x9051('0x6d')](_0x419e00);}else{_0x461b9a['push'](_0x419e00);}}return _0x461b9a;}});}else{return _0x46561b;}}else{var _0x5a5474=_[_0x9051('0x41')](_0x46561b,function(_0x323b79){if(_0x323b79[_0x9051('0x5d')]!==_0x9051('0x59')){return _0x323b79;}});return _0x5a5474;}});}else{return _0x46561b;}}})[_0x9051('0x2c')](function(_0x20f9c6){var _0x496a95=[];if(_0x20f9c6){_0xb94493=_0x20f9c6;for(var _0x335d31=0x0;_0x335d31<_0x20f9c6[_0x9051('0x6e')];_0x335d31+=0x1){_0xb94493[_0x335d31][_0x9051('0x53')]=[];_0x496a95['push'](db[_0x9051('0x32')][_0x9051('0x4d')]({'where':{'FromId':[_0x46220a['user']['id'],_0x20f9c6[_0x335d31]['id']],'ToId':[_0x46220a[_0x9051('0x5b')]['id'],_0x20f9c6[_0x335d31]['id']],'ChatGroupId':null},'attributes':['id',_0x9051('0x6f'),_0x9051('0x70'),'ToId',_0x9051('0x71'),'body'],'order':qs['sort'](_0x9051('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9051('0x2c')](wrapUser(_0x20f9c6[_0x335d31])));}return BPromise[_0x9051('0x73')](_0x496a95);}return[];})['then'](function(_0x6f7ebe){return{'rows':_0x6f7ebe,'count':_0x6f7ebe[_0x9051('0x6e')]};})[_0x9051('0x2c')](respondWithResult(_0x288985,null))['catch'](handleError(_0x288985,null));}; \ No newline at end of file +var _0x3e43=['fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','body','find','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','ChatInternalMessage','rawAttributes'];(function(_0x2d7eae,_0x484361){var _0x208af1=function(_0x2ef19c){while(--_0x2ef19c){_0x2d7eae['push'](_0x2d7eae['shift']());}};_0x208af1(++_0x484361);}(_0x3e43,0x19d));var _0x33e4=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3e43[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x33e4('0x0'));var rimraf=require(_0x33e4('0x1'));var zipdir=require(_0x33e4('0x2'));var jsonpatch=require(_0x33e4('0x3'));var rp=require('request-promise');var moment=require(_0x33e4('0x4'));var BPromise=require(_0x33e4('0x5'));var Mustache=require(_0x33e4('0x6'));var util=require(_0x33e4('0x7'));var path=require('path');var sox=require(_0x33e4('0x8'));var csv=require(_0x33e4('0x9'));var ejs=require(_0x33e4('0xa'));var fs=require('fs');var fs_extra=require(_0x33e4('0xb'));var _=require(_0x33e4('0xc'));var squel=require(_0x33e4('0xd'));var crypto=require(_0x33e4('0xe'));var jsforce=require(_0x33e4('0xf'));var deskjs=require(_0x33e4('0x10'));var toCsv=require('to-csv');var querystring=require(_0x33e4('0x11'));var Papa=require(_0x33e4('0x12'));var Redis=require(_0x33e4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x33e4('0x14'));var as=require(_0x33e4('0x15'));var hardwareService=require(_0x33e4('0x16'));var logger=require(_0x33e4('0x17'))(_0x33e4('0x18'));var utils=require('../../config/utils');var config=require(_0x33e4('0x19'));var licenseUtil=require(_0x33e4('0x1a'));var db=require(_0x33e4('0x1b'))['db'];config[_0x33e4('0x1c')]=_[_0x33e4('0x1d')](config['redis'],{'host':_0x33e4('0x1e'),'port':0x18eb});var socket=require(_0x33e4('0x1f'))(new Redis(config[_0x33e4('0x1c')]));require('./chatInternalMessage.socket')[_0x33e4('0x20')](socket);function respondWithStatusCode(_0x32a2a2,_0x430abc){_0x430abc=_0x430abc||0xcc;return function(_0x3b084e){if(_0x3b084e){return _0x32a2a2['sendStatus'](_0x430abc);}return _0x32a2a2[_0x33e4('0x21')](_0x430abc)['end']();};}function respondWithResult(_0x519e25,_0x49c91f){_0x49c91f=_0x49c91f||0xc8;return function(_0x2470bc){if(_0x2470bc){return _0x519e25[_0x33e4('0x21')](_0x49c91f)[_0x33e4('0x22')](_0x2470bc);}};}function respondWithFilteredResult(_0x139e2e,_0xf1628){return function(_0x56e305){if(_0x56e305){var _0x5129a3=typeof _0xf1628['offset']==='undefined'&&typeof _0xf1628[_0x33e4('0x23')]==='undefined';var _0x19eb4c=_0x56e305[_0x33e4('0x24')];var _0xd251e8=_0x5129a3?0x0:_0xf1628['offset'];var _0x53c3b8=_0x5129a3?_0x56e305[_0x33e4('0x24')]:_0xf1628[_0x33e4('0x25')]+_0xf1628['limit'];var _0x55ceca;if(_0x53c3b8>=_0x19eb4c){_0x53c3b8=_0x19eb4c;_0x55ceca=0xc8;}else{_0x55ceca=0xce;}_0x139e2e[_0x33e4('0x21')](_0x55ceca);return _0x139e2e[_0x33e4('0x26')](_0x33e4('0x27'),_0xd251e8+'-'+_0x53c3b8+'/'+_0x19eb4c)[_0x33e4('0x22')](_0x56e305);}return null;};}function patchUpdates(_0x59fc4a){return function(_0x82a9f6){try{jsonpatch[_0x33e4('0x28')](_0x82a9f6,_0x59fc4a,!![]);}catch(_0x846a34){return BPromise[_0x33e4('0x29')](_0x846a34);}return _0x82a9f6[_0x33e4('0x2a')]();};}function saveUpdates(_0x2977e1,_0x5223ac){return function(_0x50ecfb){if(_0x50ecfb){return _0x50ecfb[_0x33e4('0x2b')](_0x2977e1)[_0x33e4('0x2c')](function(_0x385a33){return _0x385a33;});}return null;};}function removeEntity(_0x253540,_0x47ed14){return function(_0xde7b86){if(_0xde7b86){return _0xde7b86[_0x33e4('0x2d')]()[_0x33e4('0x2c')](function(){_0x253540['status'](0xcc)[_0x33e4('0x2e')]();});}};}function handleEntityNotFound(_0x509847,_0x5b7e54){return function(_0x540e7f){if(!_0x540e7f){_0x509847[_0x33e4('0x2f')](0x194);}return _0x540e7f;};}function handleError(_0x46be70,_0x520b26){_0x520b26=_0x520b26||0x1f4;return function(_0x38102c){logger[_0x33e4('0x30')](_0x38102c[_0x33e4('0x31')]);if(_0x38102c[_0x33e4('0x32')]){delete _0x38102c[_0x33e4('0x32')];}_0x46be70['status'](_0x520b26)[_0x33e4('0x33')](_0x38102c);};}exports['index']=function(_0x412c45,_0x3c6a70){var _0x15f297={},_0x95ab89={},_0x267278={'count':0x0,'rows':[]};var _0x4a45e3=_[_0x33e4('0x34')](db[_0x33e4('0x35')][_0x33e4('0x36')],function(_0x3178b0){return{'name':_0x3178b0[_0x33e4('0x37')],'type':_0x3178b0[_0x33e4('0x38')]['key']};});_0x95ab89[_0x33e4('0x39')]=_[_0x33e4('0x34')](_0x4a45e3,_0x33e4('0x32'));_0x95ab89[_0x33e4('0x3a')]=_[_0x33e4('0x3b')](_0x412c45[_0x33e4('0x3a')]);_0x95ab89[_0x33e4('0x3c')]=_['intersection'](_0x95ab89[_0x33e4('0x39')],_0x95ab89['query']);_0x15f297[_0x33e4('0x3d')]=_['intersection'](_0x95ab89['model'],qs[_0x33e4('0x3e')](_0x412c45[_0x33e4('0x3a')][_0x33e4('0x3e')]));_0x15f297[_0x33e4('0x3d')]=_0x15f297[_0x33e4('0x3d')][_0x33e4('0x3f')]?_0x15f297['attributes']:_0x95ab89['model'];if(!_0x412c45[_0x33e4('0x3a')][_0x33e4('0x40')](_0x33e4('0x41'))){_0x15f297[_0x33e4('0x23')]=qs[_0x33e4('0x23')](_0x412c45['query'][_0x33e4('0x23')]);_0x15f297[_0x33e4('0x25')]=qs[_0x33e4('0x25')](_0x412c45['query'][_0x33e4('0x25')]);}_0x15f297[_0x33e4('0x42')]=qs[_0x33e4('0x43')](_0x412c45[_0x33e4('0x3a')]['sort']);_0x15f297['where']=qs['filters'](_['pick'](_0x412c45[_0x33e4('0x3a')],_0x95ab89[_0x33e4('0x3c')]),_0x4a45e3);if(_0x412c45['query'][_0x33e4('0x44')]){_0x15f297['where']=_[_0x33e4('0x45')](_0x15f297[_0x33e4('0x46')],{'$or':_[_0x33e4('0x34')](_0x4a45e3,function(_0x52c088){if(_0x52c088[_0x33e4('0x38')]!==_0x33e4('0x47')){var _0x3c5db0={};_0x3c5db0[_0x52c088[_0x33e4('0x32')]]={'$like':'%'+_0x412c45[_0x33e4('0x3a')][_0x33e4('0x44')]+'%'};return _0x3c5db0;}})});}_0x15f297=_[_0x33e4('0x45')]({},_0x15f297,_0x412c45[_0x33e4('0x48')]);var _0x5ba6c0={'where':_0x15f297['where']};return db[_0x33e4('0x35')]['count'](_0x5ba6c0)['then'](function(_0x211638){_0x267278[_0x33e4('0x24')]=_0x211638;if(_0x412c45['query'][_0x33e4('0x49')]){_0x15f297['include']=[{'all':!![]}];}return db[_0x33e4('0x35')][_0x33e4('0x4a')](_0x15f297);})[_0x33e4('0x2c')](function(_0x36d244){_0x267278['rows']=_0x36d244;return _0x267278;})[_0x33e4('0x2c')](respondWithFilteredResult(_0x3c6a70,_0x15f297))[_0x33e4('0x4b')](handleError(_0x3c6a70,null));};exports[_0x33e4('0x4c')]=function(_0x7c4b22,_0x4271b8){var _0x85c72a={'raw':!![],'where':{'id':_0x7c4b22[_0x33e4('0x4d')]['id']}},_0x25362e={};_0x25362e[_0x33e4('0x39')]=_['keys'](db[_0x33e4('0x35')][_0x33e4('0x36')]);_0x25362e[_0x33e4('0x3a')]=_['keys'](_0x7c4b22[_0x33e4('0x3a')]);_0x25362e[_0x33e4('0x3c')]=_['intersection'](_0x25362e['model'],_0x25362e[_0x33e4('0x3a')]);_0x85c72a['attributes']=_['intersection'](_0x25362e['model'],qs[_0x33e4('0x3e')](_0x7c4b22[_0x33e4('0x3a')][_0x33e4('0x3e')]));_0x85c72a[_0x33e4('0x3d')]=_0x85c72a[_0x33e4('0x3d')]['length']?_0x85c72a['attributes']:_0x25362e['model'];if(_0x7c4b22[_0x33e4('0x3a')]['includeAll']){_0x85c72a[_0x33e4('0x4e')]=[{'all':!![]}];}_0x85c72a=_[_0x33e4('0x45')]({},_0x85c72a,_0x7c4b22[_0x33e4('0x48')]);return db[_0x33e4('0x35')]['find'](_0x85c72a)[_0x33e4('0x2c')](handleEntityNotFound(_0x4271b8,null))[_0x33e4('0x2c')](respondWithResult(_0x4271b8,null))['catch'](handleError(_0x4271b8,null));};exports[_0x33e4('0x4f')]=function(_0x3fccfb,_0x5dab6f){return db[_0x33e4('0x35')]['create'](_0x3fccfb[_0x33e4('0x50')],{})[_0x33e4('0x2c')](respondWithResult(_0x5dab6f,0xc9))[_0x33e4('0x4b')](handleError(_0x5dab6f,null));};exports[_0x33e4('0x2b')]=function(_0x743c09,_0x461eb4){if(_0x743c09[_0x33e4('0x50')]['id']){delete _0x743c09[_0x33e4('0x50')]['id'];}return db['ChatInternalMessage'][_0x33e4('0x51')]({'where':{'id':_0x743c09[_0x33e4('0x4d')]['id']}})[_0x33e4('0x2c')](handleEntityNotFound(_0x461eb4,null))[_0x33e4('0x2c')](saveUpdates(_0x743c09[_0x33e4('0x50')],null))[_0x33e4('0x2c')](respondWithResult(_0x461eb4,null))[_0x33e4('0x4b')](handleError(_0x461eb4,null));};exports['destroy']=function(_0x248f38,_0xadfc09){return db[_0x33e4('0x35')][_0x33e4('0x51')]({'where':{'id':_0x248f38['params']['id']}})[_0x33e4('0x2c')](handleEntityNotFound(_0xadfc09,null))[_0x33e4('0x2c')](removeEntity(_0xadfc09,null))[_0x33e4('0x4b')](handleError(_0xadfc09,null));};exports[_0x33e4('0x52')]=function(_0x15b56c,_0x545ea3){return db[_0x33e4('0x35')][_0x33e4('0x52')]()['then'](respondWithResult(_0x545ea3,null))['catch'](handleError(_0x545ea3,null));};function wrapUser(_0x363543){return function(_0x343f47){var _0x3934af=_0x363543[_0x33e4('0x53')]({'plain':!![]});_0x3934af[_0x33e4('0x54')]=[];if(_0x343f47){_0x3934af[_0x33e4('0x55')]=_0x343f47['createdAt'];_0x3934af[_0x33e4('0x56')]=_0x343f47;}else{_0x3934af[_0x33e4('0x55')]=moment(0x0)[_0x33e4('0x57')](_0x33e4('0x58'));_0x3934af['lastMessage']={};}return _0x3934af;};}exports['getUsers']=function(_0x362b2f,_0x2cd79d,_0xd5a425){var _0x55feee=[];return db['User']['findAll']({'where':{'role':[_0x33e4('0x59'),_0x33e4('0x5a'),_0x33e4('0x5b')]},'attributes':['id',_0x33e4('0x5c'),_0x33e4('0x32'),_0x33e4('0x5d'),_0x33e4('0x5e'),_0x33e4('0x5f'),_0x33e4('0x60'),_0x33e4('0x61'),_0x33e4('0x62'),_0x33e4('0x63')],'order':qs[_0x33e4('0x43')](_0x33e4('0x64')),'include':[{'model':db[_0x33e4('0x65')],'as':_0x33e4('0x66'),'attributes':['id',_0x33e4('0x32'),_0x33e4('0x38')],'through':{'attributes':[]}}]})[_0x33e4('0x2c')](function(_0x5f409e){if(_0x5f409e){var _0x15acf3=_0x362b2f[_0x33e4('0x5b')][_0x33e4('0x53')]({'plain':!![]});if(!_0x15acf3)throw new Error(_0x33e4('0x67'));if(_0x15acf3[_0x33e4('0x5d')]===_0x33e4('0x5b')){return db['UserProfileSection']['find']({'where':{'name':_0x33e4('0x68'),'userProfileId':_0x15acf3[_0x33e4('0x69')]},'raw':!![]})[_0x33e4('0x2c')](function(_0x29a81a){if(_0x29a81a){if(_0x29a81a[_0x33e4('0x6a')]===0x0){return db[_0x33e4('0x6b')][_0x33e4('0x4a')]({'where':{'sectionId':_0x29a81a['id']},'raw':!![]})[_0x33e4('0x2c')](function(_0x4a53af){var _0x29a79a=[];if(_[_0x33e4('0x6c')](_0x4a53af)){_0x29a79a=_['filter'](_0x5f409e,function(_0x168ad7){if(_0x168ad7['role']!==_0x33e4('0x59')){return _0x168ad7;}});return _0x29a79a;}else{for(var _0x1bd0f9=0x0;_0x1bd0f9<_0x5f409e['length'];_0x1bd0f9++){var _0x18b277=_0x5f409e[_0x1bd0f9];if(_0x18b277['role']===_0x33e4('0x59')){var _0x4e35d3=_[_0x33e4('0x51')](_0x4a53af,function(_0xb66aae){return _0xb66aae[_0x33e4('0x6d')]===_0x18b277['id'];});if(_0x4e35d3)_0x29a79a[_0x33e4('0x6e')](_0x18b277);}else{_0x29a79a['push'](_0x18b277);}}return _0x29a79a;}});}else{return _0x5f409e;}}else{var _0x26821a=_[_0x33e4('0x44')](_0x5f409e,function(_0x54eefb){if(_0x54eefb[_0x33e4('0x5d')]!==_0x33e4('0x59')){return _0x54eefb;}});return _0x26821a;}});}else{return _0x5f409e;}}})[_0x33e4('0x2c')](function(_0x626a22){var _0x5ac75e=[];if(_0x626a22){_0x55feee=_0x626a22;for(var _0x3e884b=0x0;_0x3e884b<_0x626a22[_0x33e4('0x3f')];_0x3e884b+=0x1){_0x55feee[_0x3e884b][_0x33e4('0x54')]=[];_0x5ac75e[_0x33e4('0x6e')](db[_0x33e4('0x35')][_0x33e4('0x51')]({'where':{'FromId':[_0x362b2f[_0x33e4('0x5b')]['id'],_0x626a22[_0x3e884b]['id']],'ToId':[_0x362b2f[_0x33e4('0x5b')]['id'],_0x626a22[_0x3e884b]['id']],'ChatGroupId':null},'attributes':['id',_0x33e4('0x6f'),_0x33e4('0x70'),_0x33e4('0x71'),_0x33e4('0x72'),_0x33e4('0x50')],'order':qs['sort'](_0x33e4('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x33e4('0x2c')](wrapUser(_0x626a22[_0x3e884b])));}return BPromise[_0x33e4('0x74')](_0x5ac75e);}return[];})[_0x33e4('0x2c')](function(_0x6296f2){return{'rows':_0x6296f2,'count':_0x6296f2[_0x33e4('0x3f')]};})[_0x33e4('0x2c')](respondWithResult(_0x2cd79d,null))['catch'](handleError(_0x2cd79d,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 712acf7..744f3b4 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 _0xc048=['exports','events','../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x536098,_0x2cfc30){var _0x10d3c3=function(_0x1b3dad){while(--_0x1b3dad){_0x536098['push'](_0x536098['shift']());}};_0x10d3c3(++_0x2cfc30);}(_0xc048,0x187));var _0x8c04=function(_0x3b4825,_0x400f19){_0x3b4825=_0x3b4825-0x0;var _0x188884=_0xc048[_0x3b4825];return _0x188884;};'use strict';var EventEmitter=require(_0x8c04('0x0'));var ChatInternalMessage=require(_0x8c04('0x1'))['db'][_0x8c04('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c04('0x3'),'afterUpdate':_0x8c04('0x4'),'afterDestroy':_0x8c04('0x5')};function emitEvent(_0x3a8b28){return function(_0x4e4280,_0x53be5d,_0x5e712e){ChatInternalMessageEvents[_0x8c04('0x6')](_0x3a8b28+':'+_0x4e4280['id'],_0x4e4280);ChatInternalMessageEvents[_0x8c04('0x6')](_0x3a8b28,_0x4e4280);_0x5e712e(null);};}for(var e in events){if(events[_0x8c04('0x7')](e)){var event=events[e];ChatInternalMessage[_0x8c04('0x8')](e,emitEvent(event));}}module[_0x8c04('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x326b=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x340aa5,_0x2d5553){var _0x3a5b7f=function(_0x23758f){while(--_0x23758f){_0x340aa5['push'](_0x340aa5['shift']());}};_0x3a5b7f(++_0x2d5553);}(_0x326b,0x1dc));var _0xb326=function(_0x16d411,_0x5e0970){_0x16d411=_0x16d411-0x0;var _0x20336d=_0x326b[_0x16d411];return _0x20336d;};'use strict';var EventEmitter=require(_0xb326('0x0'));var ChatInternalMessage=require(_0xb326('0x1'))['db'][_0xb326('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb326('0x3')](0x0);var events={'afterCreate':_0xb326('0x4'),'afterUpdate':_0xb326('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3fdbc2){return function(_0x50e112,_0x217543,_0x51ffb8){ChatInternalMessageEvents[_0xb326('0x6')](_0x3fdbc2+':'+_0x50e112['id'],_0x50e112);ChatInternalMessageEvents['emit'](_0x3fdbc2,_0x50e112);_0x51ffb8(null);};}for(var e in events){if(events[_0xb326('0x7')](e)){var event=events[e];ChatInternalMessage[_0xb326('0x8')](e,emitEvent(event));}}module[_0xb326('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c64b598..7a0c0b5 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 _0xc3b3=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc3b3,0x10f));var _0x3c3b=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xc3b3[_0x35da42];return _0x370035;};'use strict';var _=require(_0x3c3b('0x0'));var util=require(_0x3c3b('0x1'));var logger=require(_0x3c3b('0x2'))(_0x3c3b('0x3'));var moment=require('moment');var BPromise=require(_0x3c3b('0x4'));var rp=require(_0x3c3b('0x5'));var fs=require('fs');var path=require(_0x3c3b('0x6'));var rimraf=require(_0x3c3b('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c3b('0x8'));module[_0x3c3b('0x9')]=function(_0x24ada7,_0x10478c){return _0x24ada7[_0x3c3b('0xa')](_0x3c3b('0xb'),attributes,{'tableName':_0x3c3b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c3b('0xd'),'collate':_0x3c3b('0xe')});}; \ No newline at end of file +var _0xc101=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path'];(function(_0x41be79,_0x51393e){var _0x37ffca=function(_0x4a6d78){while(--_0x4a6d78){_0x41be79['push'](_0x41be79['shift']());}};_0x37ffca(++_0x51393e);}(_0xc101,0x1f3));var _0x1c10=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0xc101[_0x3e91a9];return _0x25c9ad;};'use strict';var _=require('lodash');var util=require(_0x1c10('0x0'));var logger=require(_0x1c10('0x1'))('api');var moment=require(_0x1c10('0x2'));var BPromise=require(_0x1c10('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c10('0x4'));var rimraf=require(_0x1c10('0x5'));var config=require(_0x1c10('0x6'));var attributes=require(_0x1c10('0x7'));module[_0x1c10('0x8')]=function(_0x259de2,_0x3f9418){return _0x259de2[_0x1c10('0x9')]('ChatInternalMessage',attributes,{'tableName':_0x1c10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1c10('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index d6c1ca4..bd4b1f6 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 _0x3221=['redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5a133c,_0x2af714){var _0x5e573e=function(_0x3f732c){while(--_0x3f732c){_0x5a133c['push'](_0x5a133c['shift']());}};_0x5e573e(++_0x2af714);}(_0x3221,0x1c2));var _0x1322=function(_0x416aed,_0x556c97){_0x416aed=_0x416aed-0x0;var _0x2cbadc=_0x3221[_0x416aed];return _0x2cbadc;};'use strict';var _=require(_0x1322('0x0'));var util=require(_0x1322('0x1'));var moment=require(_0x1322('0x2'));var BPromise=require(_0x1322('0x3'));var rs=require(_0x1322('0x4'));var fs=require('fs');var Redis=require(_0x1322('0x5'));var db=require(_0x1322('0x6'))['db'];var utils=require(_0x1322('0x7'));var logger=require(_0x1322('0x8'))(_0x1322('0x9'));var config=require(_0x1322('0xa'));var jayson=require(_0x1322('0xb'));var client=jayson[_0x1322('0xc')][_0x1322('0xd')]({'port':0x232a});config[_0x1322('0xe')]=_['defaults'](config[_0x1322('0xe')],{'host':_0x1322('0xf'),'port':0x18eb});var socket=require(_0x1322('0x10'))(new Redis(config['redis']));require(_0x1322('0x11'))[_0x1322('0x12')](socket);function respondWithRpcPromise(_0x5b058a,_0x391be2,_0x30f603){return new BPromise(function(_0x1d7a8c,_0x19384f){return client[_0x1322('0x13')](_0x5b058a,_0x30f603)[_0x1322('0x14')](function(_0x355a15){logger[_0x1322('0x15')](_0x1322('0x16'),_0x391be2,_0x1322('0x17'));logger['debug'](_0x1322('0x18'),_0x391be2,_0x1322('0x17'),JSON[_0x1322('0x19')](_0x355a15));if(_0x355a15[_0x1322('0x1a')]){if(_0x355a15[_0x1322('0x1a')]['code']===0x1f4){logger[_0x1322('0x1a')](_0x1322('0x16'),_0x391be2,_0x355a15[_0x1322('0x1a')]['message']);return _0x19384f(_0x355a15[_0x1322('0x1a')]['message']);}logger[_0x1322('0x1a')]('ChatInternalMessage,\x20%s,\x20%s',_0x391be2,_0x355a15['error']['message']);return _0x1d7a8c(_0x355a15[_0x1322('0x1a')]['message']);}else{logger[_0x1322('0x15')](_0x1322('0x16'),_0x391be2,_0x1322('0x17'));_0x1d7a8c(_0x355a15['result'][_0x1322('0x1b')]);}})[_0x1322('0x1c')](function(_0x507dbe){logger[_0x1322('0x1a')](_0x1322('0x16'),_0x391be2,_0x507dbe);_0x19384f(_0x507dbe);});});} \ No newline at end of file +var _0x57b8=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x93b411,_0x4263ca){var _0x14ce11=function(_0x3f71c4){while(--_0x3f71c4){_0x93b411['push'](_0x93b411['shift']());}};_0x14ce11(++_0x4263ca);}(_0x57b8,0x17c));var _0x857b=function(_0x49f3cc,_0x46f3e0){_0x49f3cc=_0x49f3cc-0x0;var _0x499553=_0x57b8[_0x49f3cc];return _0x499553;};'use strict';var _=require(_0x857b('0x0'));var util=require(_0x857b('0x1'));var moment=require(_0x857b('0x2'));var BPromise=require(_0x857b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x857b('0x4'));var db=require(_0x857b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x857b('0x6'))(_0x857b('0x7'));var config=require(_0x857b('0x8'));var jayson=require(_0x857b('0x9'));var client=jayson[_0x857b('0xa')][_0x857b('0xb')]({'port':0x232a});config[_0x857b('0xc')]=_[_0x857b('0xd')](config[_0x857b('0xc')],{'host':_0x857b('0xe'),'port':0x18eb});var socket=require(_0x857b('0xf'))(new Redis(config['redis']));require(_0x857b('0x10'))[_0x857b('0x11')](socket);function respondWithRpcPromise(_0x5167fe,_0x4cd93b,_0x31f976){return new BPromise(function(_0x3710be,_0x1e994b){return client[_0x857b('0x12')](_0x5167fe,_0x31f976)[_0x857b('0x13')](function(_0x39a5be){logger[_0x857b('0x14')](_0x857b('0x15'),_0x4cd93b,_0x857b('0x16'));logger[_0x857b('0x17')](_0x857b('0x18'),_0x4cd93b,_0x857b('0x16'),JSON['stringify'](_0x39a5be));if(_0x39a5be[_0x857b('0x19')]){if(_0x39a5be['error']['code']===0x1f4){logger[_0x857b('0x19')](_0x857b('0x15'),_0x4cd93b,_0x39a5be['error'][_0x857b('0x1a')]);return _0x1e994b(_0x39a5be[_0x857b('0x19')][_0x857b('0x1a')]);}logger['error'](_0x857b('0x15'),_0x4cd93b,_0x39a5be[_0x857b('0x19')][_0x857b('0x1a')]);return _0x3710be(_0x39a5be[_0x857b('0x19')][_0x857b('0x1a')]);}else{logger[_0x857b('0x14')](_0x857b('0x15'),_0x4cd93b,_0x857b('0x16'));_0x3710be(_0x39a5be[_0x857b('0x1b')][_0x857b('0x1a')]);}})[_0x857b('0x1c')](function(_0x5938f4){logger[_0x857b('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x4cd93b,_0x5938f4);_0x1e994b(_0x5938f4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 52aa977..bc9fe12 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 _0x1baf=['update','emit','register','length','./chatInternalMessage.events','save','remove'];(function(_0x223c1e,_0x4da8d3){var _0xbeaf50=function(_0xe9491b){while(--_0xe9491b){_0x223c1e['push'](_0x223c1e['shift']());}};_0xbeaf50(++_0x4da8d3);}(_0x1baf,0x19a));var _0xf1ba=function(_0x56c91b,_0x370894){_0x56c91b=_0x56c91b-0x0;var _0x23d322=_0x1baf[_0x56c91b];return _0x23d322;};'use strict';var ChatInternalMessageEvents=require(_0xf1ba('0x0'));var events=[_0xf1ba('0x1'),_0xf1ba('0x2'),_0xf1ba('0x3')];function createListener(_0x4e6d45,_0x4357b4){return function(_0x120aa3){_0x4357b4[_0xf1ba('0x4')](_0x4e6d45,_0x120aa3);};}function removeListener(_0xd3b394,_0x27473e){return function(){ChatInternalMessageEvents['removeListener'](_0xd3b394,_0x27473e);};}exports[_0xf1ba('0x5')]=function(_0x3c5777){for(var _0x4f2437=0x0,_0x4d3c3d=events[_0xf1ba('0x6')];_0x4f2437<_0x4d3c3d;_0x4f2437++){var _0x447052=events[_0x4f2437];var _0x147644=createListener('chatInternalMessage:'+_0x447052,_0x3c5777);ChatInternalMessageEvents['on'](_0x447052,_0x147644);}}; \ No newline at end of file +var _0xb6af=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0xb6af,0x7b));var _0xfb6a=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0xb6af[_0x176317];return _0xef2759;};'use strict';var ChatInternalMessageEvents=require(_0xfb6a('0x0'));var events=[_0xfb6a('0x1'),'remove',_0xfb6a('0x2')];function createListener(_0x8d95b5,_0x16c3fc){return function(_0x24ba0c){_0x16c3fc[_0xfb6a('0x3')](_0x8d95b5,_0x24ba0c);};}function removeListener(_0xd2980,_0x3cdf5a){return function(){ChatInternalMessageEvents[_0xfb6a('0x4')](_0xd2980,_0x3cdf5a);};}exports[_0xfb6a('0x5')]=function(_0x2e00e0){for(var _0x30fe14=0x0,_0x48e55a=events[_0xfb6a('0x6')];_0x30fe14<_0x48e55a;_0x30fe14++){var _0x42ce82=events[_0x30fe14];var _0x5648c7=createListener(_0xfb6a('0x7')+_0x42ce82,_0x2e00e0);ChatInternalMessageEvents['on'](_0x42ce82,_0x5648c7);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7c5142a..d1f2a39 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 _0x994a=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','getUsers','/:id','show','create','put','update','exports','multer','util'];(function(_0xf2cfad,_0x1ec4ed){var _0x45e11e=function(_0x1614e9){while(--_0x1614e9){_0xf2cfad['push'](_0xf2cfad['shift']());}};_0x45e11e(++_0x1ec4ed);}(_0x994a,0x185));var _0xa994=function(_0x4e8588,_0x2b38a0){_0x4e8588=_0x4e8588-0x0;var _0x526b6d=_0x994a[_0x4e8588];return _0x526b6d;};'use strict';var multer=require(_0xa994('0x0'));var util=require(_0xa994('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa994('0x2'));var router=express['Router']();var fs_extra=require(_0xa994('0x3'));var auth=require(_0xa994('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa994('0x5'));var controller=require('./chatInternalMessage.controller');router[_0xa994('0x6')]('/',auth[_0xa994('0x7')](),controller[_0xa994('0x8')]);router['get'](_0xa994('0x9'),auth[_0xa994('0x7')](),controller['describe']);router[_0xa994('0x6')]('/users',auth[_0xa994('0x7')](),controller[_0xa994('0xa')]);router[_0xa994('0x6')](_0xa994('0xb'),auth[_0xa994('0x7')](),controller[_0xa994('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa994('0xd')]);router[_0xa994('0xe')](_0xa994('0xb'),controller[_0xa994('0xf')]);router['delete'](_0xa994('0xb'),auth[_0xa994('0x7')](),controller['destroy']);module[_0xa994('0x10')]=router; \ No newline at end of file +var _0x5607=['getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','describe'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x5607,0x186));var _0x7560=function(_0x1d69e1,_0x450840){_0x1d69e1=_0x1d69e1-0x0;var _0x23f4e1=_0x5607[_0x1d69e1];return _0x23f4e1;};'use strict';var multer=require(_0x7560('0x0'));var util=require(_0x7560('0x1'));var path=require('path');var timeout=require(_0x7560('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7560('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7560('0x4'));var controller=require(_0x7560('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7560('0x6')](_0x7560('0x7'),auth[_0x7560('0x8')](),controller[_0x7560('0x9')]);router[_0x7560('0x6')]('/users',auth[_0x7560('0x8')](),controller[_0x7560('0xa')]);router[_0x7560('0x6')](_0x7560('0xb'),auth['isAuthenticated'](),controller[_0x7560('0xc')]);router[_0x7560('0xd')]('/',auth[_0x7560('0x8')](),controller[_0x7560('0xe')]);router[_0x7560('0xf')](_0x7560('0xb'),controller[_0x7560('0x10')]);router[_0x7560('0x11')]('/:id',auth[_0x7560('0x8')](),controller[_0x7560('0x12')]);module[_0x7560('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f667d46..af6dbb0 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 _0x915a=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x193a32,_0x34a673){var _0x5a533b=function(_0x446977){while(--_0x446977){_0x193a32['push'](_0x193a32['shift']());}};_0x5a533b(++_0x34a673);}(_0x915a,0x1d2));var _0xa915=function(_0x3ca5de,_0x501162){_0x3ca5de=_0x3ca5de-0x0;var _0x3426f2=_0x915a[_0x3ca5de];return _0x3426f2;};'use strict';var Sequelize=require(_0xa915('0x0'));module[_0xa915('0x1')]={'body':{'type':Sequelize[_0xa915('0x2')](_0xa915('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa915('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa915('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xa915('0x6')]},'providerName':{'type':Sequelize[_0xa915('0x7')]},'providerResponse':{'type':Sequelize[_0xa915('0x2')]}}; \ No newline at end of file +var _0x97e6=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5e9b18,_0x3874b4){var _0x2f342b=function(_0x17808f){while(--_0x17808f){_0x5e9b18['push'](_0x5e9b18['shift']());}};_0x2f342b(++_0x3874b4);}(_0x97e6,0x159));var _0x697e=function(_0x2c9d95,_0xcc4c3){_0x2c9d95=_0x2c9d95-0x0;var _0x1b9a2e=_0x97e6[_0x2c9d95];return _0x1b9a2e;};'use strict';var Sequelize=require(_0x697e('0x0'));module['exports']={'body':{'type':Sequelize[_0x697e('0x1')](_0x697e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x697e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x697e('0x4')]('in',_0x697e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x697e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x697e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index c0649a5..3a4fa2f 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 _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x386312,_0x56398e){var _0x44c452=function(_0x188004){while(--_0x188004){_0x386312['push'](_0x386312['shift']());}};_0x44c452(++_0x56398e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x2b3661,_0x1842ac){var _0xb12ecb=function(_0x127636){while(--_0x127636){_0x2b3661['push'](_0x2b3661['shift']());}};_0xb12ecb(++_0x1842ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index eb2384d..e620e94 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 _0x2e7a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x418bd5,_0x1b765c){var _0x153058=function(_0x3674f5){while(--_0x3674f5){_0x418bd5['push'](_0x418bd5['shift']());}};_0x153058(++_0x1b765c);}(_0x2e7a,0x9e));var _0xa2e7=function(_0x4f83f0,_0x4afe44){_0x4f83f0=_0x4f83f0-0x0;var _0x2cff81=_0x2e7a[_0x4f83f0];return _0x2cff81;};'use strict';var EventEmitter=require(_0xa2e7('0x0'));var ChatMessage=require(_0xa2e7('0x1'))['db'][_0xa2e7('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa2e7('0x3')](0x0);var events={'afterCreate':_0xa2e7('0x4'),'afterUpdate':_0xa2e7('0x5'),'afterDestroy':_0xa2e7('0x6')};function emitEvent(_0x5d361a){return function(_0x4c7dc3,_0x56168a,_0x1940ba){ChatMessageEvents[_0xa2e7('0x7')](_0x5d361a+':'+_0x4c7dc3['id'],_0x4c7dc3);ChatMessageEvents[_0xa2e7('0x7')](_0x5d361a,_0x4c7dc3);_0x1940ba(null);};}for(var e in events){if(events[_0xa2e7('0x8')](e)){var event=events[e];ChatMessage[_0xa2e7('0x9')](e,emitEvent(event));}}module[_0xa2e7('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0xfd47=['emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x3bbd7a,_0x45f9ac){var _0x27e32f=function(_0x3f3831){while(--_0x3f3831){_0x3bbd7a['push'](_0x3bbd7a['shift']());}};_0x27e32f(++_0x45f9ac);}(_0xfd47,0x9c));var _0x7fd4=function(_0x2ad3b5,_0x5ab1c4){_0x2ad3b5=_0x2ad3b5-0x0;var _0x281301=_0xfd47[_0x2ad3b5];return _0x281301;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x7fd4('0x0'))['db'][_0x7fd4('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7fd4('0x2')](0x0);var events={'afterCreate':_0x7fd4('0x3'),'afterUpdate':_0x7fd4('0x4'),'afterDestroy':_0x7fd4('0x5')};function emitEvent(_0x453773){return function(_0x243ce9,_0x4b3e58,_0xff8b4c){ChatMessageEvents[_0x7fd4('0x6')](_0x453773+':'+_0x243ce9['id'],_0x243ce9);ChatMessageEvents[_0x7fd4('0x6')](_0x453773,_0x243ce9);_0xff8b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x7fd4('0x7')](e,emitEvent(event));}}module[_0x7fd4('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1f3833c..7beb15b 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 _0x3d5d=['toLowerCase','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','models','direction'];(function(_0x2d9609,_0x30fd05){var _0x223398=function(_0x3ce692){while(--_0x3ce692){_0x2d9609['push'](_0x2d9609['shift']());}};_0x223398(++_0x30fd05);}(_0x3d5d,0x104));var _0xd3d5=function(_0x2f32c4,_0x531dc6){_0x2f32c4=_0x2f32c4-0x0;var _0x3f3018=_0x3d5d[_0x2f32c4];return _0x3f3018;};'use strict';var _=require(_0xd3d5('0x0'));var util=require(_0xd3d5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd3d5('0x2'));var BPromise=require(_0xd3d5('0x3'));var rp=require(_0xd3d5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3d5('0x5'));var config=require(_0xd3d5('0x6'));var attributes=require(_0xd3d5('0x7'));module[_0xd3d5('0x8')]=function(_0x5542ef,_0x3b857d){return _0x5542ef['define'](_0xd3d5('0x9'),attributes,{'tableName':_0xd3d5('0xa'),'paranoid':![],'indexes':[{'name':_0xd3d5('0xb'),'fields':[_0xd3d5('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe2ae5e,_0x30b884,_0x209305){var _0x5c66cf=_0x5542ef[_0xd3d5('0xd')];var _0x3fba26=_0xe2ae5e['get']({'plain':!![]});if(_0x3fba26[_0xd3d5('0xe')][_0xd3d5('0xf')]()==='in'||_0x3fba26[_0xd3d5('0xe')][_0xd3d5('0xf')]()==='out'&&!_0x3fba26['secret']&&!_[_0xd3d5('0x10')](_0x3fba26[_0xd3d5('0x11')])){_0x5c66cf[_0xd3d5('0x12')][_0xd3d5('0x13')]({'where':{'id':_0x3fba26[_0xd3d5('0x14')]}})['then'](function(_0x1eeae8){if(_0x1eeae8){_0x1eeae8[_0xd3d5('0x15')]({'lastMsgAt':_0x3fba26[_0xd3d5('0x16')],'lastMsgDirection':_0x3fba26['direction'][_0xd3d5('0xf')]()});}})['catch'](function(_0x4c07dc){console[_0xd3d5('0x17')](_0x4c07dc);});}_0x209305();}},'charset':'utf8mb4','collate':_0xd3d5('0x18')});}; \ No newline at end of file +var _0x3fc6=['ChatInteraction','findOne','ChatInteractionId','then','update','catch','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3fc6,0x159));var _0x63fc=function(_0x5a421e,_0x18f21){_0x5a421e=_0x5a421e-0x0;var _0x2a0ea0=_0x3fc6[_0x5a421e];return _0x2a0ea0;};'use strict';var _=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var logger=require(_0x63fc('0x2'))('api');var moment=require(_0x63fc('0x3'));var BPromise=require(_0x63fc('0x4'));var rp=require(_0x63fc('0x5'));var fs=require('fs');var path=require(_0x63fc('0x6'));var rimraf=require(_0x63fc('0x7'));var config=require(_0x63fc('0x8'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0xdb65b8,_0x7d24f){return _0xdb65b8[_0x63fc('0x9')]('ChatMessage',attributes,{'tableName':_0x63fc('0xa'),'paranoid':![],'indexes':[{'name':_0x63fc('0xb'),'fields':['body'],'type':_0x63fc('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28a180,_0x231e48,_0x21866b){var _0xef7fb2=_0xdb65b8[_0x63fc('0xd')];var _0x17cf03=_0x28a180[_0x63fc('0xe')]({'plain':!![]});if(_0x17cf03[_0x63fc('0xf')][_0x63fc('0x10')]()==='in'||_0x17cf03['direction'][_0x63fc('0x10')]()===_0x63fc('0x11')&&!_0x17cf03[_0x63fc('0x12')]&&!_['isNil'](_0x17cf03['UserId'])){_0xef7fb2[_0x63fc('0x13')][_0x63fc('0x14')]({'where':{'id':_0x17cf03[_0x63fc('0x15')]}})[_0x63fc('0x16')](function(_0xed9cc1){if(_0xed9cc1){_0xed9cc1[_0x63fc('0x17')]({'lastMsgAt':_0x17cf03['createdAt'],'lastMsgDirection':_0x17cf03[_0x63fc('0xf')][_0x63fc('0x10')]()});}})[_0x63fc('0x18')](function(_0x337192){console['error'](_0x337192);});}_0x21866b();}},'charset':_0x63fc('0x19'),'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 2358ee4..a241554 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 _0xa847=['options','raw','then','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','request\x20sent','debug','error','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','body'];(function(_0x12c280,_0x51dd07){var _0x3638d3=function(_0x53b273){while(--_0x53b273){_0x12c280['push'](_0x12c280['shift']());}};_0x3638d3(++_0x51dd07);}(_0xa847,0xcb));var _0x7a84=function(_0x3012e1,_0x51045f){_0x3012e1=_0x3012e1-0x0;var _0xd57512=_0xa847[_0x3012e1];return _0xd57512;};'use strict';var _=require(_0x7a84('0x0'));var util=require(_0x7a84('0x1'));var moment=require(_0x7a84('0x2'));var BPromise=require(_0x7a84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a84('0x4'));var db=require(_0x7a84('0x5'))['db'];var utils=require(_0x7a84('0x6'));var logger=require(_0x7a84('0x7'))('rpc');var config=require(_0x7a84('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7a84('0x9')]['http']({'port':0x232a});config[_0x7a84('0xa')]=_[_0x7a84('0xb')](config[_0x7a84('0xa')],{'host':_0x7a84('0xc'),'port':0x18eb});var socket=require(_0x7a84('0xd'))(new Redis(config[_0x7a84('0xa')]));require(_0x7a84('0xe'))[_0x7a84('0xf')](socket);function respondWithRpcPromise(_0x297551,_0xba562a,_0x12ef6b){return new BPromise(function(_0x88d6d0,_0x28bcc7){return client[_0x7a84('0x10')](_0x297551,_0x12ef6b)['then'](function(_0x27018e){logger[_0x7a84('0x11')]('ChatMessage,\x20%s,\x20%s',_0xba562a,_0x7a84('0x12'));logger[_0x7a84('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xba562a,_0x7a84('0x12'),JSON['stringify'](_0x27018e));if(_0x27018e[_0x7a84('0x14')]){if(_0x27018e['error']['code']===0x1f4){logger['error'](_0x7a84('0x15'),_0xba562a,_0x27018e[_0x7a84('0x14')][_0x7a84('0x16')]);return _0x28bcc7(_0x27018e['error'][_0x7a84('0x16')]);}logger[_0x7a84('0x14')]('ChatMessage,\x20%s,\x20%s',_0xba562a,_0x27018e['error']['message']);return _0x88d6d0(_0x27018e[_0x7a84('0x14')][_0x7a84('0x16')]);}else{logger['info'](_0x7a84('0x15'),_0xba562a,'request\x20sent');_0x88d6d0(_0x27018e[_0x7a84('0x17')][_0x7a84('0x16')]);}})['catch'](function(_0x25af03){logger[_0x7a84('0x14')]('ChatMessage,\x20%s,\x20%s',_0xba562a,_0x25af03);_0x28bcc7(_0x25af03);});});}exports[_0x7a84('0x18')]=function(_0x2ff61e){var _0x5e89ba=this;return new Promise(function(_0xe479df,_0x2d2ee5){return db[_0x7a84('0x19')][_0x7a84('0x1a')](_0x2ff61e[_0x7a84('0x1b')],{'raw':_0x2ff61e[_0x7a84('0x1c')]?_0x2ff61e[_0x7a84('0x1c')][_0x7a84('0x1d')]===undefined?!![]:![]:!![]})[_0x7a84('0x1e')](function(_0x24b521){logger['info'](_0x7a84('0x18'),_0x2ff61e);logger[_0x7a84('0x13')](_0x7a84('0x18'),_0x2ff61e,JSON[_0x7a84('0x1f')](_0x24b521));_0xe479df(_0x24b521);})[_0x7a84('0x20')](function(_0x5b4593){logger[_0x7a84('0x14')]('CreateChatMessage',_0x5b4593['message'],_0x2ff61e);_0x2d2ee5(_0x5e89ba[_0x7a84('0x14')](0x1f4,_0x5b4593[_0x7a84('0x16')]));});});}; \ No newline at end of file +var _0xfb00=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','util','moment'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xfb00,0x8a));var _0x0fb0=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0xfb00[_0xcfd89f];return _0x59acd4;};'use strict';var _=require('lodash');var util=require(_0x0fb0('0x0'));var moment=require(_0x0fb0('0x1'));var BPromise=require(_0x0fb0('0x2'));var rs=require(_0x0fb0('0x3'));var fs=require('fs');var Redis=require(_0x0fb0('0x4'));var db=require(_0x0fb0('0x5'))['db'];var utils=require(_0x0fb0('0x6'));var logger=require(_0x0fb0('0x7'))('rpc');var config=require(_0x0fb0('0x8'));var jayson=require(_0x0fb0('0x9'));var client=jayson[_0x0fb0('0xa')][_0x0fb0('0xb')]({'port':0x232a});config[_0x0fb0('0xc')]=_[_0x0fb0('0xd')](config['redis'],{'host':_0x0fb0('0xe'),'port':0x18eb});var socket=require(_0x0fb0('0xf'))(new Redis(config[_0x0fb0('0xc')]));require(_0x0fb0('0x10'))['register'](socket);function respondWithRpcPromise(_0x30d7da,_0x3f2bc2,_0x1b932e){return new BPromise(function(_0x50a29c,_0x6a0ed4){return client[_0x0fb0('0x11')](_0x30d7da,_0x1b932e)[_0x0fb0('0x12')](function(_0x11e7c4){logger[_0x0fb0('0x13')](_0x0fb0('0x14'),_0x3f2bc2,_0x0fb0('0x15'));logger[_0x0fb0('0x16')](_0x0fb0('0x17'),_0x3f2bc2,'request\x20sent',JSON['stringify'](_0x11e7c4));if(_0x11e7c4[_0x0fb0('0x18')]){if(_0x11e7c4[_0x0fb0('0x18')]['code']===0x1f4){logger[_0x0fb0('0x18')](_0x0fb0('0x14'),_0x3f2bc2,_0x11e7c4[_0x0fb0('0x18')][_0x0fb0('0x19')]);return _0x6a0ed4(_0x11e7c4['error'][_0x0fb0('0x19')]);}logger['error'](_0x0fb0('0x14'),_0x3f2bc2,_0x11e7c4[_0x0fb0('0x18')][_0x0fb0('0x19')]);return _0x50a29c(_0x11e7c4[_0x0fb0('0x18')]['message']);}else{logger['info'](_0x0fb0('0x14'),_0x3f2bc2,'request\x20sent');_0x50a29c(_0x11e7c4[_0x0fb0('0x1a')][_0x0fb0('0x19')]);}})[_0x0fb0('0x1b')](function(_0x36639a){logger['error'](_0x0fb0('0x14'),_0x3f2bc2,_0x36639a);_0x6a0ed4(_0x36639a);});});}exports[_0x0fb0('0x1c')]=function(_0x27a77f){var _0x1394e5=this;return new Promise(function(_0x314228,_0x16028b){return db[_0x0fb0('0x1d')][_0x0fb0('0x1e')](_0x27a77f[_0x0fb0('0x1f')],{'raw':_0x27a77f[_0x0fb0('0x20')]?_0x27a77f[_0x0fb0('0x20')][_0x0fb0('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x3063e0){logger[_0x0fb0('0x13')](_0x0fb0('0x1c'),_0x27a77f);logger['debug'](_0x0fb0('0x1c'),_0x27a77f,JSON[_0x0fb0('0x22')](_0x3063e0));_0x314228(_0x3063e0);})[_0x0fb0('0x1b')](function(_0x56fc6b){logger[_0x0fb0('0x18')](_0x0fb0('0x1c'),_0x56fc6b[_0x0fb0('0x19')],_0x27a77f);_0x16028b(_0x1394e5[_0x0fb0('0x18')](0x1f4,_0x56fc6b[_0x0fb0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 1d08db7..cbfb5fb 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 _0x7da7=['save','remove','register','chatMessage:','./chatMessage.events'];(function(_0xfadf05,_0x5e7cab){var _0x4f7aad=function(_0x42720a){while(--_0x42720a){_0xfadf05['push'](_0xfadf05['shift']());}};_0x4f7aad(++_0x5e7cab);}(_0x7da7,0x10d));var _0x77da=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x7da7[_0x2d1971];return _0x4d7759;};'use strict';var ChatMessageEvents=require(_0x77da('0x0'));var events=[_0x77da('0x1'),_0x77da('0x2'),'update'];function createListener(_0x59892b,_0x37667b){return function(_0xaaefb1){_0x37667b['emit'](_0x59892b,_0xaaefb1);};}function removeListener(_0x3a9fa6,_0x37b3d9){return function(){ChatMessageEvents['removeListener'](_0x3a9fa6,_0x37b3d9);};}exports[_0x77da('0x3')]=function(_0xc54a12){for(var _0x47da81=0x0,_0x30afe0=events['length'];_0x47da81<_0x30afe0;_0x47da81++){var _0x1191de=events[_0x47da81];var _0x13992e=createListener(_0x77da('0x4')+_0x1191de,_0xc54a12);ChatMessageEvents['on'](_0x1191de,_0x13992e);}}; \ No newline at end of file +var _0x2f2e=['emit','length','save','remove'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x2f2e,0x146));var _0xe2f2=function(_0x358c86,_0x38a8a2){_0x358c86=_0x358c86-0x0;var _0x52edc5=_0x2f2e[_0x358c86];return _0x52edc5;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xe2f2('0x0'),_0xe2f2('0x1'),'update'];function createListener(_0xc8150e,_0x5c1823){return function(_0x1d89ba){_0x5c1823[_0xe2f2('0x2')](_0xc8150e,_0x1d89ba);};}function removeListener(_0x2da048,_0x14543c){return function(){ChatMessageEvents['removeListener'](_0x2da048,_0x14543c);};}exports['register']=function(_0x5b202f){for(var _0x3dca30=0x0,_0x23f7a8=events[_0xe2f2('0x3')];_0x3dca30<_0x23f7a8;_0x3dca30++){var _0xc44c89=events[_0x3dca30];var _0x48111c=createListener('chatMessage:'+_0xc44c89,_0x5b202f);ChatMessageEvents['on'](_0xc44c89,_0x48111c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f16ccb5..c346ad7 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 _0xe322=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','reject','delete','destroy','util','path','connect-timeout','express'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xe322,0x98));var _0x2e32=function(_0x2983c6,_0x1edf39){_0x2983c6=_0x2983c6-0x0;var _0x7252a8=_0xe322[_0x2983c6];return _0x7252a8;};'use strict';var multer=require('multer');var util=require(_0x2e32('0x0'));var path=require(_0x2e32('0x1'));var timeout=require(_0x2e32('0x2'));var express=require(_0x2e32('0x3'));var router=express[_0x2e32('0x4')]();var fs_extra=require(_0x2e32('0x5'));var auth=require(_0x2e32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2e32('0x7'));var controller=require(_0x2e32('0x8'));router[_0x2e32('0x9')]('/',auth[_0x2e32('0xa')](),controller[_0x2e32('0xb')]);router[_0x2e32('0x9')]('/describe',auth[_0x2e32('0xa')](),controller[_0x2e32('0xc')]);router[_0x2e32('0x9')](_0x2e32('0xd'),auth[_0x2e32('0xa')](),controller[_0x2e32('0xe')]);router[_0x2e32('0xf')]('/',auth[_0x2e32('0xa')](),interaction[_0x2e32('0x10')](_0x2e32('0x11'),_0x2e32('0x12')),controller[_0x2e32('0x13')]);router[_0x2e32('0x14')]('/:id',controller['update']);router[_0x2e32('0x14')](_0x2e32('0x15'),auth[_0x2e32('0xa')](),controller[_0x2e32('0x16')]);router[_0x2e32('0x14')]('/:id/reject',auth[_0x2e32('0xa')](),controller[_0x2e32('0x17')]);router[_0x2e32('0x18')](_0x2e32('0xd'),auth[_0x2e32('0xa')](),controller[_0x2e32('0x19')]);module['exports']=router; \ No newline at end of file +var _0xff53=['../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','put','update','/:id/accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x10896c,_0x4f833a){var _0xd9ab0a=function(_0x5945fb){while(--_0x5945fb){_0x10896c['push'](_0x10896c['shift']());}};_0xd9ab0a(++_0x4f833a);}(_0xff53,0x116));var _0x3ff5=function(_0xdfc45b,_0x16abfc){_0xdfc45b=_0xdfc45b-0x0;var _0x2c2f2d=_0xff53[_0xdfc45b];return _0x2c2f2d;};'use strict';var multer=require(_0x3ff5('0x0'));var util=require(_0x3ff5('0x1'));var path=require(_0x3ff5('0x2'));var timeout=require(_0x3ff5('0x3'));var express=require(_0x3ff5('0x4'));var router=express['Router']();var fs_extra=require(_0x3ff5('0x5'));var auth=require(_0x3ff5('0x6'));var interaction=require(_0x3ff5('0x7'));var config=require(_0x3ff5('0x8'));var controller=require(_0x3ff5('0x9'));router[_0x3ff5('0xa')]('/',auth[_0x3ff5('0xb')](),controller[_0x3ff5('0xc')]);router[_0x3ff5('0xa')](_0x3ff5('0xd'),auth[_0x3ff5('0xb')](),controller[_0x3ff5('0xe')]);router[_0x3ff5('0xa')](_0x3ff5('0xf'),auth[_0x3ff5('0xb')](),controller['show']);router[_0x3ff5('0x10')]('/',auth[_0x3ff5('0xb')](),interaction[_0x3ff5('0x11')](_0x3ff5('0x12'),_0x3ff5('0x13')),controller['create']);router[_0x3ff5('0x14')](_0x3ff5('0xf'),controller[_0x3ff5('0x15')]);router[_0x3ff5('0x14')](_0x3ff5('0x16'),auth[_0x3ff5('0xb')](),controller['accept']);router[_0x3ff5('0x14')](_0x3ff5('0x17'),auth[_0x3ff5('0xb')](),controller['reject']);router[_0x3ff5('0x18')](_0x3ff5('0xf'),auth[_0x3ff5('0xb')](),controller['destroy']);module[_0x3ff5('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 0854529..fcee613 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 _0x5ae3=['sequelize','exports','TEXT','medium'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x5ae3,0x144));var _0x35ae=function(_0x53ba7e,_0x3812e8){_0x53ba7e=_0x53ba7e-0x0;var _0x2facd7=_0x5ae3[_0x53ba7e];return _0x2facd7;};'use strict';var Sequelize=require(_0x35ae('0x0'));module[_0x35ae('0x1')]={'body':{'type':Sequelize[_0x35ae('0x2')](_0x35ae('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xf071=['TEXT','medium','sequelize'];(function(_0x3a00e0,_0x1454ef){var _0x261259=function(_0x3f3d7e){while(--_0x3f3d7e){_0x3a00e0['push'](_0x3a00e0['shift']());}};_0x261259(++_0x1454ef);}(_0xf071,0x146));var _0x1f07=function(_0xc97c28,_0x286191){_0xc97c28=_0xc97c28-0x0;var _0x5a6aec=_0xf071[_0xc97c28];return _0x5a6aec;};'use strict';var Sequelize=require(_0x1f07('0x0'));module['exports']={'body':{'type':Sequelize[_0x1f07('0x1')](_0x1f07('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 5979c08..5eefe67 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(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x7a54,0x106));var _0x47a5=function(_0x546c8d,_0x247ebf){_0x546c8d=_0x546c8d-0x0;var _0x33ce53=_0x7a54[_0x546c8d];return _0x33ce53;};'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 _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(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0xd822f3,_0x489dd9){_0xd822f3=_0xd822f3-0x0;var _0x13ec6a=_0x7a54[_0xd822f3];return _0x13ec6a;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 1a8579a..3f78588 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 _0x8d5d=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise'];(function(_0x2bcba1,_0x4ca700){var _0x318356=function(_0x3eaec6){while(--_0x3eaec6){_0x2bcba1['push'](_0x2bcba1['shift']());}};_0x318356(++_0x4ca700);}(_0x8d5d,0x1b3));var _0xd8d5=function(_0x57734c,_0xea97c7){_0x57734c=_0x57734c-0x0;var _0x476fbd=_0x8d5d[_0x57734c];return _0x476fbd;};'use strict';var _=require(_0xd8d5('0x0'));var util=require(_0xd8d5('0x1'));var logger=require(_0xd8d5('0x2'))('api');var moment=require(_0xd8d5('0x3'));var BPromise=require('bluebird');var rp=require(_0xd8d5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd8d5('0x5'));module[_0xd8d5('0x6')]=function(_0x58774c,_0x16a3bc){return _0x58774c[_0xd8d5('0x7')](_0xd8d5('0x8'),attributes,{'tableName':_0xd8d5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd8d5('0xa')});}; \ No newline at end of file +var _0x1351=['moment','bluebird','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0x1351,0x7a));var _0x1135=function(_0xca66c5,_0x45c6f3){_0xca66c5=_0xca66c5-0x0;var _0x2ad2ad=_0x1351[_0xca66c5];return _0x2ad2ad;};'use strict';var _=require(_0x1135('0x0'));var util=require(_0x1135('0x1'));var logger=require(_0x1135('0x2'))(_0x1135('0x3'));var moment=require(_0x1135('0x4'));var BPromise=require(_0x1135('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1135('0x6'));var attributes=require(_0x1135('0x7'));module[_0x1135('0x8')]=function(_0x1b79e2,_0x4b88c8){return _0x1b79e2[_0x1135('0x9')](_0x1135('0xa'),attributes,{'tableName':_0x1135('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1135('0xc'),'collate':_0x1135('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index b1c879f..7884a72 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 _0xd9ef=['ChatOfflineMessage,\x20%s,\x20%s','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd9ef,0x95));var _0xfd9e=function(_0x2c7776,_0x594900){_0x2c7776=_0x2c7776-0x0;var _0x3d0013=_0xd9ef[_0x2c7776];return _0x3d0013;};'use strict';var _=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var moment=require('moment');var BPromise=require(_0xfd9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfd9e('0x3'));var logger=require(_0xfd9e('0x4'))(_0xfd9e('0x5'));var config=require(_0xfd9e('0x6'));var jayson=require(_0xfd9e('0x7'));var client=jayson[_0xfd9e('0x8')][_0xfd9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c3dec,_0x261826,_0x302795){return new BPromise(function(_0xb61585,_0x1f35c7){return client[_0xfd9e('0xa')](_0x3c3dec,_0x302795)['then'](function(_0xd8d6bc){logger[_0xfd9e('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x261826,_0xfd9e('0xc'));logger[_0xfd9e('0xd')](_0xfd9e('0xe'),_0x261826,'request\x20sent',JSON[_0xfd9e('0xf')](_0xd8d6bc));if(_0xd8d6bc[_0xfd9e('0x10')]){if(_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x11')]===0x1f4){logger[_0xfd9e('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x261826,_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);return _0x1f35c7(_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);}logger[_0xfd9e('0x10')](_0xfd9e('0x13'),_0x261826,_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);return _0xb61585(_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);}else{logger['info'](_0xfd9e('0x13'),_0x261826,'request\x20sent');_0xb61585(_0xd8d6bc['result'][_0xfd9e('0x12')]);}})[_0xfd9e('0x14')](function(_0x144372){logger['error'](_0xfd9e('0x13'),_0x261826,_0x144372);_0x1f35c7(_0x144372);});});} \ No newline at end of file +var _0x3713=['client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xf7b253,_0x2de075){var _0x413798=function(_0x3420fc){while(--_0x3420fc){_0xf7b253['push'](_0xf7b253['shift']());}};_0x413798(++_0x2de075);}(_0x3713,0xe7));var _0x3371=function(_0x821dba,_0x569953){_0x821dba=_0x821dba-0x0;var _0x1a4dac=_0x3713[_0x821dba];return _0x1a4dac;};'use strict';var _=require(_0x3371('0x0'));var util=require('util');var moment=require(_0x3371('0x1'));var BPromise=require(_0x3371('0x2'));var rs=require(_0x3371('0x3'));var fs=require('fs');var Redis=require(_0x3371('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3371('0x5'));var logger=require(_0x3371('0x6'))('rpc');var config=require(_0x3371('0x7'));var jayson=require(_0x3371('0x8'));var client=jayson[_0x3371('0x9')][_0x3371('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26bf23,_0xd2e5fa,_0x8342ed){return new BPromise(function(_0x26f18e,_0x506a72){return client[_0x3371('0xb')](_0x26bf23,_0x8342ed)[_0x3371('0xc')](function(_0x45f661){logger[_0x3371('0xd')](_0x3371('0xe'),_0xd2e5fa,_0x3371('0xf'));logger[_0x3371('0x10')](_0x3371('0x11'),_0xd2e5fa,'request\x20sent',JSON[_0x3371('0x12')](_0x45f661));if(_0x45f661[_0x3371('0x13')]){if(_0x45f661[_0x3371('0x13')][_0x3371('0x14')]===0x1f4){logger[_0x3371('0x13')](_0x3371('0xe'),_0xd2e5fa,_0x45f661[_0x3371('0x13')][_0x3371('0x15')]);return _0x506a72(_0x45f661[_0x3371('0x13')][_0x3371('0x15')]);}logger[_0x3371('0x13')](_0x3371('0xe'),_0xd2e5fa,_0x45f661['error']['message']);return _0x26f18e(_0x45f661[_0x3371('0x13')][_0x3371('0x15')]);}else{logger[_0x3371('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0xd2e5fa,_0x3371('0xf'));_0x26f18e(_0x45f661[_0x3371('0x16')]['message']);}})[_0x3371('0x17')](function(_0x1b3ce7){logger[_0x3371('0x13')](_0x3371('0xe'),_0xd2e5fa,_0x1b3ce7);_0x506a72(_0x1b3ce7);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 374d7ac..52e5b42 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 _0x09ba=['/describe','describe','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x47ff9c,_0x5e4c9e){var _0x482bde=function(_0x446a35){while(--_0x446a35){_0x47ff9c['push'](_0x47ff9c['shift']());}};_0x482bde(++_0x5e4c9e);}(_0x09ba,0x68));var _0xa09b=function(_0x2bae44,_0x33f37a){_0x2bae44=_0x2bae44-0x0;var _0x1e111b=_0x09ba[_0x2bae44];return _0x1e111b;};'use strict';var multer=require(_0xa09b('0x0'));var util=require('util');var path=require(_0xa09b('0x1'));var timeout=require(_0xa09b('0x2'));var express=require(_0xa09b('0x3'));var router=express['Router']();var fs_extra=require(_0xa09b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa09b('0x5'));var config=require('../../config/environment');var controller=require(_0xa09b('0x6'));router[_0xa09b('0x7')]('/',auth[_0xa09b('0x8')](),controller[_0xa09b('0x9')]);router[_0xa09b('0x7')](_0xa09b('0xa'),auth[_0xa09b('0x8')](),controller[_0xa09b('0xb')]);router[_0xa09b('0x7')](_0xa09b('0xc'),auth[_0xa09b('0x8')](),controller[_0xa09b('0xd')]);router[_0xa09b('0xe')]('/',auth[_0xa09b('0x8')](),controller['create']);router[_0xa09b('0xf')](_0xa09b('0xc'),auth[_0xa09b('0x8')](),controller[_0xa09b('0x10')]);router[_0xa09b('0x11')]('/:id',auth[_0xa09b('0x8')](),controller['destroy']);module[_0xa09b('0x12')]=router; \ No newline at end of file +var _0xe729=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','create','update','delete','/:id','exports','multer','util','path'];(function(_0x53f7b6,_0x16ffbe){var _0x1aeb7e=function(_0x54e835){while(--_0x54e835){_0x53f7b6['push'](_0x53f7b6['shift']());}};_0x1aeb7e(++_0x16ffbe);}(_0xe729,0x19d));var _0x9e72=function(_0x4830ef,_0x12b408){_0x4830ef=_0x4830ef-0x0;var _0x350dae=_0xe729[_0x4830ef];return _0x350dae;};'use strict';var multer=require(_0x9e72('0x0'));var util=require(_0x9e72('0x1'));var path=require(_0x9e72('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e72('0x3'));var router=express['Router']();var fs_extra=require(_0x9e72('0x4'));var auth=require(_0x9e72('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9e72('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0x9e72('0x7')]('/',auth[_0x9e72('0x8')](),controller[_0x9e72('0x9')]);router[_0x9e72('0x7')](_0x9e72('0xa'),auth[_0x9e72('0x8')](),controller['describe']);router[_0x9e72('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9e72('0x8')](),controller[_0x9e72('0xb')]);router['put']('/:id',auth[_0x9e72('0x8')](),controller[_0x9e72('0xc')]);router[_0x9e72('0xd')](_0x9e72('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x9e72('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d19af5a..eea4ff7 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 _0xf4ae=['mouseOver','timeout','STRING','sequelize','exports'];(function(_0x174e82,_0x4ef745){var _0x353f52=function(_0x1017e6){while(--_0x1017e6){_0x174e82['push'](_0x174e82['shift']());}};_0x353f52(++_0x4ef745);}(_0xf4ae,0x184));var _0xef4a=function(_0x484ad6,_0x4efaee){_0x484ad6=_0x484ad6-0x0;var _0x4950d0=_0xf4ae[_0x484ad6];return _0x4950d0;};'use strict';var Sequelize=require(_0xef4a('0x0'));module[_0xef4a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xef4a('0x2'),_0xef4a('0x3')),'defaultValue':_0xef4a('0x2')},'selector':{'type':Sequelize[_0xef4a('0x4')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbf20=['timeout','INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x384eb1,_0xef2c1f){var _0x12cd33=function(_0x59d08d){while(--_0x59d08d){_0x384eb1['push'](_0x384eb1['shift']());}};_0x12cd33(++_0xef2c1f);}(_0xbf20,0xcd));var _0x0bf2=function(_0x5e9bc0,_0x5a8e4e){_0x5e9bc0=_0x5e9bc0-0x0;var _0x294555=_0xbf20[_0x5e9bc0];return _0x294555;};'use strict';var Sequelize=require(_0x0bf2('0x0'));module[_0x0bf2('0x1')]={'name':{'type':Sequelize[_0x0bf2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0bf2('0x3')](_0x0bf2('0x4'),_0x0bf2('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x0bf2('0x2')]},'timeout':{'type':Sequelize[_0x0bf2('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ebd58e5..c1f1c56 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 _0xe35c=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xe35c,0x146));var _0xce35=function(_0x59820d,_0xc8e6ba){_0x59820d=_0x59820d-0x0;var _0x3c72b1=_0xe35c[_0x59820d];return _0x3c72b1;};'use strict';var emlformat=require(_0xce35('0x0'));var rimraf=require(_0xce35('0x1'));var zipdir=require(_0xce35('0x2'));var jsonpatch=require(_0xce35('0x3'));var rp=require(_0xce35('0x4'));var moment=require(_0xce35('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xce35('0x6'));var path=require('path');var sox=require(_0xce35('0x7'));var csv=require(_0xce35('0x8'));var ejs=require(_0xce35('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce35('0xa'));var squel=require(_0xce35('0xb'));var crypto=require(_0xce35('0xc'));var jsforce=require(_0xce35('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce35('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce35('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce35('0xf'));var hardwareService=require(_0xce35('0x10'));var logger=require(_0xce35('0x11'))(_0xce35('0x12'));var utils=require(_0xce35('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce35('0x14'))['db'];function respondWithStatusCode(_0x20553a,_0x45ccf8){_0x45ccf8=_0x45ccf8||0xcc;return function(_0x251ca5){if(_0x251ca5){return _0x20553a[_0xce35('0x15')](_0x45ccf8);}return _0x20553a['status'](_0x45ccf8)['end']();};}function respondWithResult(_0xc8ec3f,_0x15f921){_0x15f921=_0x15f921||0xc8;return function(_0x55e36d){if(_0x55e36d){return _0xc8ec3f[_0xce35('0x16')](_0x15f921)[_0xce35('0x17')](_0x55e36d);}};}function respondWithFilteredResult(_0x30fe18,_0x231143){return function(_0x3540bc){if(_0x3540bc){var _0x398fc6=typeof _0x231143[_0xce35('0x18')]===_0xce35('0x19')&&typeof _0x231143[_0xce35('0x1a')]===_0xce35('0x19');var _0x36812b=_0x3540bc['count'];var _0x8d7f28=_0x398fc6?0x0:_0x231143[_0xce35('0x18')];var _0x3efb22=_0x398fc6?_0x3540bc[_0xce35('0x1b')]:_0x231143[_0xce35('0x18')]+_0x231143['limit'];var _0x40321d;if(_0x3efb22>=_0x36812b){_0x3efb22=_0x36812b;_0x40321d=0xc8;}else{_0x40321d=0xce;}_0x30fe18[_0xce35('0x16')](_0x40321d);return _0x30fe18[_0xce35('0x1c')](_0xce35('0x1d'),_0x8d7f28+'-'+_0x3efb22+'/'+_0x36812b)[_0xce35('0x17')](_0x3540bc);}return null;};}function patchUpdates(_0x8a0771){return function(_0x18ff68){try{jsonpatch[_0xce35('0x1e')](_0x18ff68,_0x8a0771,!![]);}catch(_0x556a73){return BPromise[_0xce35('0x1f')](_0x556a73);}return _0x18ff68[_0xce35('0x20')]();};}function saveUpdates(_0x32a76d,_0x43ce68){return function(_0x2f6d42){if(_0x2f6d42){return _0x2f6d42[_0xce35('0x21')](_0x32a76d)[_0xce35('0x22')](function(_0x16b19a){return _0x16b19a;});}return null;};}function removeEntity(_0x320800,_0x323497){return function(_0x5e88b2){if(_0x5e88b2){return _0x5e88b2[_0xce35('0x23')]()[_0xce35('0x22')](function(){_0x320800[_0xce35('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422874,_0x66335c){return function(_0x510307){if(!_0x510307){_0x422874[_0xce35('0x15')](0x194);}return _0x510307;};}function handleError(_0x1b41a2,_0x2b87b4){_0x2b87b4=_0x2b87b4||0x1f4;return function(_0x184f1f){logger[_0xce35('0x24')](_0x184f1f['stack']);if(_0x184f1f[_0xce35('0x25')]){delete _0x184f1f[_0xce35('0x25')];}_0x1b41a2[_0xce35('0x16')](_0x2b87b4)[_0xce35('0x26')](_0x184f1f);};}exports[_0xce35('0x27')]=function(_0x3876ed,_0xa66ead){var _0x104315={'raw':!![],'where':{'id':_0x3876ed['params']['id']}},_0x295ecc={};_0x295ecc[_0xce35('0x28')]=_['keys'](db[_0xce35('0x29')][_0xce35('0x2a')]);_0x295ecc[_0xce35('0x2b')]=_[_0xce35('0x2c')](_0x3876ed[_0xce35('0x2b')]);_0x295ecc[_0xce35('0x2d')]=_[_0xce35('0x2e')](_0x295ecc['model'],_0x295ecc[_0xce35('0x2b')]);_0x104315['attributes']=_[_0xce35('0x2e')](_0x295ecc[_0xce35('0x28')],qs[_0xce35('0x2f')](_0x3876ed[_0xce35('0x2b')]['fields']));_0x104315[_0xce35('0x30')]=_0x104315[_0xce35('0x30')][_0xce35('0x31')]?_0x104315[_0xce35('0x30')]:_0x295ecc[_0xce35('0x28')];if(_0x3876ed[_0xce35('0x2b')][_0xce35('0x32')]){_0x104315[_0xce35('0x33')]=[{'all':!![]}];}_0x104315=_[_0xce35('0x34')]({},_0x104315,_0x3876ed[_0xce35('0x35')]);return db[_0xce35('0x29')][_0xce35('0x36')](_0x104315)[_0xce35('0x22')](handleEntityNotFound(_0xa66ead,null))['then'](respondWithResult(_0xa66ead,null))['catch'](handleError(_0xa66ead,null));};exports[_0xce35('0x37')]=function(_0xb12036,_0x2302a9){return db['ChatProactiveAction'][_0xce35('0x37')](_0xb12036[_0xce35('0x38')],{})[_0xce35('0x22')](respondWithResult(_0x2302a9,0xc9))['catch'](handleError(_0x2302a9,null));};exports[_0xce35('0x21')]=function(_0x363bba,_0x97e59){if(_0x363bba[_0xce35('0x38')]['id']){delete _0x363bba[_0xce35('0x38')]['id'];}return db[_0xce35('0x29')][_0xce35('0x36')]({'where':{'id':_0x363bba['params']['id']}})['then'](handleEntityNotFound(_0x97e59,null))[_0xce35('0x22')](saveUpdates(_0x363bba['body'],null))['then'](respondWithResult(_0x97e59,null))[_0xce35('0x39')](handleError(_0x97e59,null));};exports[_0xce35('0x23')]=function(_0x2bb3e1,_0x49d0de){return db[_0xce35('0x29')]['find']({'where':{'id':_0x2bb3e1['params']['id']}})[_0xce35('0x22')](handleEntityNotFound(_0x49d0de,null))['then'](removeEntity(_0x49d0de,null))[_0xce35('0x39')](handleError(_0x49d0de,null));}; \ No newline at end of file +var _0x308a=['ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','options','find','catch','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xa308('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa308('0x1'));var jsonpatch=require(_0xa308('0x2'));var rp=require(_0xa308('0x3'));var moment=require(_0xa308('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa308('0x5'));var path=require(_0xa308('0x6'));var sox=require(_0xa308('0x7'));var csv=require(_0xa308('0x8'));var ejs=require(_0xa308('0x9'));var fs=require('fs');var fs_extra=require(_0xa308('0xa'));var _=require(_0xa308('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa308('0xc'));var deskjs=require(_0xa308('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa308('0xe'));var Papa=require('papaparse');var Redis=require(_0xa308('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa308('0x10'));var as=require(_0xa308('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa308('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa308('0x13'));var licenseUtil=require(_0xa308('0x14'));var db=require(_0xa308('0x15'))['db'];function respondWithStatusCode(_0x36b6eb,_0x224599){_0x224599=_0x224599||0xcc;return function(_0x4577ca){if(_0x4577ca){return _0x36b6eb['sendStatus'](_0x224599);}return _0x36b6eb[_0xa308('0x16')](_0x224599)[_0xa308('0x17')]();};}function respondWithResult(_0x80ee50,_0x32d57e){_0x32d57e=_0x32d57e||0xc8;return function(_0x39b04c){if(_0x39b04c){return _0x80ee50['status'](_0x32d57e)['json'](_0x39b04c);}};}function respondWithFilteredResult(_0x558c31,_0x1ba897){return function(_0x31193e){if(_0x31193e){var _0x178c33=typeof _0x1ba897[_0xa308('0x18')]==='undefined'&&typeof _0x1ba897[_0xa308('0x19')]===_0xa308('0x1a');var _0x1a94ba=_0x31193e[_0xa308('0x1b')];var _0x309ac0=_0x178c33?0x0:_0x1ba897[_0xa308('0x18')];var _0x4d6ab9=_0x178c33?_0x31193e[_0xa308('0x1b')]:_0x1ba897[_0xa308('0x18')]+_0x1ba897[_0xa308('0x19')];var _0x5408b1;if(_0x4d6ab9>=_0x1a94ba){_0x4d6ab9=_0x1a94ba;_0x5408b1=0xc8;}else{_0x5408b1=0xce;}_0x558c31[_0xa308('0x16')](_0x5408b1);return _0x558c31[_0xa308('0x1c')](_0xa308('0x1d'),_0x309ac0+'-'+_0x4d6ab9+'/'+_0x1a94ba)[_0xa308('0x1e')](_0x31193e);}return null;};}function patchUpdates(_0x1312aa){return function(_0x2e1d96){try{jsonpatch[_0xa308('0x1f')](_0x2e1d96,_0x1312aa,!![]);}catch(_0x57cec3){return BPromise[_0xa308('0x20')](_0x57cec3);}return _0x2e1d96[_0xa308('0x21')]();};}function saveUpdates(_0x167a27,_0x1588d0){return function(_0x31eb17){if(_0x31eb17){return _0x31eb17['update'](_0x167a27)[_0xa308('0x22')](function(_0x3acb1c){return _0x3acb1c;});}return null;};}function removeEntity(_0x1c5a22,_0x18ec9a){return function(_0x5dbbbf){if(_0x5dbbbf){return _0x5dbbbf[_0xa308('0x23')]()[_0xa308('0x22')](function(){_0x1c5a22[_0xa308('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ed1a2,_0x5f3995){return function(_0x557a11){if(!_0x557a11){_0x1ed1a2[_0xa308('0x24')](0x194);}return _0x557a11;};}function handleError(_0x54bfc4,_0x592364){_0x592364=_0x592364||0x1f4;return function(_0x192597){logger[_0xa308('0x25')](_0x192597[_0xa308('0x26')]);if(_0x192597['name']){delete _0x192597[_0xa308('0x27')];}_0x54bfc4[_0xa308('0x16')](_0x592364)[_0xa308('0x28')](_0x192597);};}exports[_0xa308('0x29')]=function(_0x15666f,_0x1f49f2){var _0x5814eb={'raw':!![],'where':{'id':_0x15666f[_0xa308('0x2a')]['id']}},_0x1f9db4={};_0x1f9db4[_0xa308('0x2b')]=_[_0xa308('0x2c')](db[_0xa308('0x2d')][_0xa308('0x2e')]);_0x1f9db4['query']=_[_0xa308('0x2c')](_0x15666f[_0xa308('0x2f')]);_0x1f9db4[_0xa308('0x30')]=_['intersection'](_0x1f9db4[_0xa308('0x2b')],_0x1f9db4['query']);_0x5814eb[_0xa308('0x31')]=_[_0xa308('0x32')](_0x1f9db4[_0xa308('0x2b')],qs[_0xa308('0x33')](_0x15666f['query'][_0xa308('0x33')]));_0x5814eb[_0xa308('0x31')]=_0x5814eb[_0xa308('0x31')][_0xa308('0x34')]?_0x5814eb['attributes']:_0x1f9db4['model'];if(_0x15666f[_0xa308('0x2f')][_0xa308('0x35')]){_0x5814eb[_0xa308('0x36')]=[{'all':!![]}];}_0x5814eb=_['merge']({},_0x5814eb,_0x15666f[_0xa308('0x37')]);return db['ChatProactiveAction'][_0xa308('0x38')](_0x5814eb)[_0xa308('0x22')](handleEntityNotFound(_0x1f49f2,null))[_0xa308('0x22')](respondWithResult(_0x1f49f2,null))[_0xa308('0x39')](handleError(_0x1f49f2,null));};exports[_0xa308('0x3a')]=function(_0x101ed6,_0x4940bf){return db[_0xa308('0x2d')]['create'](_0x101ed6['body'],{})[_0xa308('0x22')](respondWithResult(_0x4940bf,0xc9))['catch'](handleError(_0x4940bf,null));};exports[_0xa308('0x3b')]=function(_0x3b8cc8,_0x1eac26){if(_0x3b8cc8['body']['id']){delete _0x3b8cc8[_0xa308('0x3c')]['id'];}return db[_0xa308('0x2d')][_0xa308('0x38')]({'where':{'id':_0x3b8cc8[_0xa308('0x2a')]['id']}})[_0xa308('0x22')](handleEntityNotFound(_0x1eac26,null))[_0xa308('0x22')](saveUpdates(_0x3b8cc8[_0xa308('0x3c')],null))[_0xa308('0x22')](respondWithResult(_0x1eac26,null))[_0xa308('0x39')](handleError(_0x1eac26,null));};exports['destroy']=function(_0x501def,_0x1ea9d1){return db['ChatProactiveAction']['find']({'where':{'id':_0x501def[_0xa308('0x2a')]['id']}})[_0xa308('0x22')](handleEntityNotFound(_0x1ea9d1,null))[_0xa308('0x22')](removeEntity(_0x1ea9d1,null))[_0xa308('0x39')](handleError(_0x1ea9d1,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ebe140b..237adc0 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 _0x73ef=['util','moment','bluebird','request-promise','path','rimraf','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x742198,_0x52d771){var _0x346044=function(_0x2045ce){while(--_0x2045ce){_0x742198['push'](_0x742198['shift']());}};_0x346044(++_0x52d771);}(_0x73ef,0x118));var _0xf73e=function(_0x1aa26c,_0x224943){_0x1aa26c=_0x1aa26c-0x0;var _0x207a9d=_0x73ef[_0x1aa26c];return _0x207a9d;};'use strict';var _=require('lodash');var util=require(_0xf73e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf73e('0x1'));var BPromise=require(_0xf73e('0x2'));var rp=require(_0xf73e('0x3'));var fs=require('fs');var path=require(_0xf73e('0x4'));var rimraf=require(_0xf73e('0x5'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xf73e('0x6')]=function(_0x478181,_0xd4182d){return _0x478181[_0xf73e('0x7')](_0xf73e('0x8'),attributes,{'tableName':_0xf73e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8361=['util','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','chat_proactive_actions'];(function(_0x25ec19,_0x385cd5){var _0x173b68=function(_0x49052f){while(--_0x49052f){_0x25ec19['push'](_0x25ec19['shift']());}};_0x173b68(++_0x385cd5);}(_0x8361,0xd9));var _0x1836=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x8361[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require(_0x1836('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1836('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1836('0x2'));var rimraf=require(_0x1836('0x3'));var config=require(_0x1836('0x4'));var attributes=require(_0x1836('0x5'));module['exports']=function(_0x4b344b,_0x4146f9){return _0x4b344b['define']('ChatProactiveAction',attributes,{'tableName':_0x1836('0x6'),'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 515d796..df8924f 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 _0x8fc0=['../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','stringify','error','message','ChatProactiveAction,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x8fc0,0x67));var _0x08fc=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0x8fc0[_0xd1c39b];return _0x58f5bc;};'use strict';var _=require(_0x08fc('0x0'));var util=require('util');var moment=require(_0x08fc('0x1'));var BPromise=require(_0x08fc('0x2'));var rs=require(_0x08fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08fc('0x4'))['db'];var utils=require(_0x08fc('0x5'));var logger=require(_0x08fc('0x6'))(_0x08fc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x08fc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x432b2d,_0x3fbf74,_0x1f8fef){return new BPromise(function(_0x44e0e5,_0x50d446){return client[_0x08fc('0x9')](_0x432b2d,_0x1f8fef)[_0x08fc('0xa')](function(_0x3764ff){logger[_0x08fc('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x3fbf74,_0x08fc('0xc'));logger[_0x08fc('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3fbf74,_0x08fc('0xc'),JSON[_0x08fc('0xe')](_0x3764ff));if(_0x3764ff[_0x08fc('0xf')]){if(_0x3764ff['error']['code']===0x1f4){logger[_0x08fc('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x3fbf74,_0x3764ff['error'][_0x08fc('0x10')]);return _0x50d446(_0x3764ff['error'][_0x08fc('0x10')]);}logger[_0x08fc('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x3fbf74,_0x3764ff[_0x08fc('0xf')]['message']);return _0x44e0e5(_0x3764ff[_0x08fc('0xf')][_0x08fc('0x10')]);}else{logger['info'](_0x08fc('0x11'),_0x3fbf74,_0x08fc('0xc'));_0x44e0e5(_0x3764ff['result']['message']);}})['catch'](function(_0x11dfdd){logger['error'](_0x08fc('0x11'),_0x3fbf74,_0x11dfdd);_0x50d446(_0x11dfdd);});});} \ No newline at end of file +var _0xd80e=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x3c84a4,_0x1a2471){var _0x521c7f=function(_0x5a18a3){while(--_0x5a18a3){_0x3c84a4['push'](_0x3c84a4['shift']());}};_0x521c7f(++_0x1a2471);}(_0xd80e,0xf6));var _0xed80=function(_0x2a448c,_0x488f3f){_0x2a448c=_0x2a448c-0x0;var _0x2c04ee=_0xd80e[_0x2a448c];return _0x2c04ee;};'use strict';var _=require(_0xed80('0x0'));var util=require(_0xed80('0x1'));var moment=require(_0xed80('0x2'));var BPromise=require(_0xed80('0x3'));var rs=require(_0xed80('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed80('0x5'));var logger=require(_0xed80('0x6'))('rpc');var config=require(_0xed80('0x7'));var jayson=require(_0xed80('0x8'));var client=jayson['client'][_0xed80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9ae150,_0x3041d2,_0x841e23){return new BPromise(function(_0x28d15e,_0x10eaf2){return client[_0xed80('0xa')](_0x9ae150,_0x841e23)[_0xed80('0xb')](function(_0x3f2668){logger['info'](_0xed80('0xc'),_0x3041d2,'request\x20sent');logger['debug'](_0xed80('0xd'),_0x3041d2,'request\x20sent',JSON['stringify'](_0x3f2668));if(_0x3f2668['error']){if(_0x3f2668[_0xed80('0xe')][_0xed80('0xf')]===0x1f4){logger[_0xed80('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x3041d2,_0x3f2668['error'][_0xed80('0x10')]);return _0x10eaf2(_0x3f2668[_0xed80('0xe')]['message']);}logger[_0xed80('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x3041d2,_0x3f2668[_0xed80('0xe')]['message']);return _0x28d15e(_0x3f2668[_0xed80('0xe')][_0xed80('0x10')]);}else{logger[_0xed80('0x11')](_0xed80('0xc'),_0x3041d2,'request\x20sent');_0x28d15e(_0x3f2668[_0xed80('0x12')]['message']);}})[_0xed80('0x13')](function(_0x378754){logger[_0xed80('0xe')](_0xed80('0xc'),_0x3041d2,_0x378754);_0x10eaf2(_0x378754);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index db60b5d..5b09a08 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 _0x7dfd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x2f13ea,_0x11186b){var _0x35b952=function(_0x3b3d90){while(--_0x3b3d90){_0x2f13ea['push'](_0x2f13ea['shift']());}};_0x35b952(++_0x11186b);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0xe')]);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xd')](),controller['create']);router[_0xd7df('0x10')](_0xd7df('0xc'),auth[_0xd7df('0xd')](),controller[_0xd7df('0x11')]);router['delete'](_0xd7df('0xc'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);module['exports']=router; \ No newline at end of file +var _0x24ca=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4f8718,_0x524b54){var _0x751503=function(_0x53451f){while(--_0x53451f){_0x4f8718['push'](_0x4f8718['shift']());}};_0x751503(++_0x524b54);}(_0x24ca,0x1bc));var _0xa24c=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x24ca[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0xc')]);router[_0xa24c('0xd')]('/',auth[_0xa24c('0xb')](),controller['create']);router[_0xa24c('0xe')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller['update']);router[_0xa24c('0xf')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0x10')]);module[_0xa24c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 0d962e3..50db3a4 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 _0x0aca=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0aca,0x117));var _0xa0ac=function(_0x277dff,_0x1bdc8d){_0x277dff=_0x277dff-0x0;var _0x3e584a=_0x0aca[_0x277dff];return _0x3e584a;};'use strict';var Sequelize=require(_0xa0ac('0x0'));module[_0xa0ac('0x1')]={'name':{'type':Sequelize[_0xa0ac('0x2')],'unique':_0xa0ac('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa0ac('0x2')]},'timeout':{'type':Sequelize[_0xa0ac('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa0ac('0x5')](_0xa0ac('0x6'),_0xa0ac('0x7'),_0xa0ac('0x8'))}}; \ No newline at end of file +var _0xcb38=['beepall','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xcb38,0x71));var _0x8cb3=function(_0x4e998d,_0x145397){_0x4e998d=_0x4e998d-0x0;var _0x5e8a44=_0xcb38[_0x4e998d];return _0x5e8a44;};'use strict';var Sequelize=require(_0x8cb3('0x0'));module[_0x8cb3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8cb3('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8cb3('0x3')]},'timeout':{'type':Sequelize[_0x8cb3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8cb3('0x5')](_0x8cb3('0x6'),_0x8cb3('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 22ae71c..09bce5a 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 _0xae3f=['./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','keys','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','order','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','SIP','getTeams','Team','length','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','findAll','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','redis'];(function(_0x3d0098,_0x22ee82){var _0x3ef587=function(_0xe43a50){while(--_0xe43a50){_0x3d0098['push'](_0x3d0098['shift']());}};_0x3ef587(++_0x22ee82);}(_0xae3f,0x115));var _0xfae3=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xae3f[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfae3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfae3('0x1'));var rp=require(_0xfae3('0x2'));var moment=require('moment');var BPromise=require(_0xfae3('0x3'));var Mustache=require(_0xfae3('0x4'));var util=require(_0xfae3('0x5'));var path=require(_0xfae3('0x6'));var sox=require('sox');var csv=require(_0xfae3('0x7'));var ejs=require(_0xfae3('0x8'));var fs=require('fs');var fs_extra=require(_0xfae3('0x9'));var _=require('lodash');var squel=require(_0xfae3('0xa'));var crypto=require(_0xfae3('0xb'));var jsforce=require(_0xfae3('0xc'));var deskjs=require(_0xfae3('0xd'));var toCsv=require(_0xfae3('0x7'));var querystring=require(_0xfae3('0xe'));var Papa=require(_0xfae3('0xf'));var Redis=require(_0xfae3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfae3('0x11'));var as=require(_0xfae3('0x12'));var hardwareService=require(_0xfae3('0x13'));var logger=require(_0xfae3('0x14'))(_0xfae3('0x15'));var utils=require(_0xfae3('0x16'));var config=require(_0xfae3('0x17'));var licenseUtil=require(_0xfae3('0x18'));var db=require(_0xfae3('0x19'))['db'];config['redis']=_['defaults'](config[_0xfae3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfae3('0x1a')]));require(_0xfae3('0x1b'))[_0xfae3('0x1c')](socket);var jayson=require(_0xfae3('0x1d'));var client=jayson['client'][_0xfae3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5bcd11,_0x163ef9,_0x4a9d36,_0x451677){return new BPromise(function(_0x58fce5,_0x2800cb){var _0xdcdaee=_0x451677||client;return _0xdcdaee[_0xfae3('0x1f')](_0x5bcd11,_0x4a9d36)[_0xfae3('0x20')](function(_0x4a99fb){logger[_0xfae3('0x21')](_0xfae3('0x22'),_0x163ef9,_0xfae3('0x23'));logger[_0xfae3('0x24')](_0xfae3('0x25'),_0x163ef9,'request\x20sent',JSON[_0xfae3('0x26')](_0x4a99fb));if(_0x4a99fb[_0xfae3('0x27')]){if(_0x4a99fb[_0xfae3('0x27')][_0xfae3('0x28')]===0x1f4){logger[_0xfae3('0x27')](_0xfae3('0x22'),_0x163ef9,_0x4a99fb[_0xfae3('0x27')][_0xfae3('0x29')]);return _0x2800cb(_0x4a99fb[_0xfae3('0x27')][_0xfae3('0x29')]);}logger[_0xfae3('0x27')](_0xfae3('0x22'),_0x163ef9,_0x4a99fb[_0xfae3('0x27')]['message']);return _0x58fce5(_0x4a99fb[_0xfae3('0x27')][_0xfae3('0x29')]);}else{logger[_0xfae3('0x21')](_0xfae3('0x22'),_0x163ef9,_0xfae3('0x23'));_0x58fce5(_0x4a99fb['result'][_0xfae3('0x29')]);}})[_0xfae3('0x2a')](function(_0x274156){logger['error'](_0xfae3('0x22'),_0x163ef9,_0x274156);_0x2800cb(_0x274156);});});}function respondWithStatusCode(_0x5cae7c,_0x22f4b8){_0x22f4b8=_0x22f4b8||0xcc;return function(_0x20e9c5){if(_0x20e9c5){return _0x5cae7c[_0xfae3('0x2b')](_0x22f4b8);}return _0x5cae7c[_0xfae3('0x2c')](_0x22f4b8)[_0xfae3('0x2d')]();};}function respondWithResult(_0x490bf5,_0x2c9577){_0x2c9577=_0x2c9577||0xc8;return function(_0x1993c6){if(_0x1993c6){return _0x490bf5[_0xfae3('0x2c')](_0x2c9577)[_0xfae3('0x2e')](_0x1993c6);}};}function respondWithFilteredResult(_0x1218a4,_0x94bd78){return function(_0x57b2fc){if(_0x57b2fc){var _0x8a5cf=typeof _0x94bd78[_0xfae3('0x2f')]==='undefined'&&typeof _0x94bd78[_0xfae3('0x30')]===_0xfae3('0x31');var _0x321a1b=_0x57b2fc[_0xfae3('0x32')];var _0x11ebf8=_0x8a5cf?0x0:_0x94bd78['offset'];var _0x566742=_0x8a5cf?_0x57b2fc['count']:_0x94bd78[_0xfae3('0x2f')]+_0x94bd78[_0xfae3('0x30')];var _0xa23c09;if(_0x566742>=_0x321a1b){_0x566742=_0x321a1b;_0xa23c09=0xc8;}else{_0xa23c09=0xce;}_0x1218a4[_0xfae3('0x2c')](_0xa23c09);return _0x1218a4['set'](_0xfae3('0x33'),_0x11ebf8+'-'+_0x566742+'/'+_0x321a1b)[_0xfae3('0x2e')](_0x57b2fc);}return null;};}function patchUpdates(_0x1a57c4){return function(_0x229fca){try{jsonpatch[_0xfae3('0x34')](_0x229fca,_0x1a57c4,!![]);}catch(_0x2cd2ae){return BPromise[_0xfae3('0x35')](_0x2cd2ae);}return _0x229fca[_0xfae3('0x36')]();};}function saveUpdates(_0x1df4e0,_0x373a55){return function(_0x53444b){if(_0x53444b){return _0x53444b[_0xfae3('0x37')](_0x1df4e0)['then'](function(_0x138127){return _0x138127;});}return null;};}function removeEntity(_0x40511b,_0x20386e){return function(_0x458dc9){if(_0x458dc9){return _0x458dc9[_0xfae3('0x38')]()['then'](function(){var _0x2ec058=_0x458dc9[_0xfae3('0x39')]({'plain':!![]});var _0x3bb850=_0xfae3('0x3a');return db[_0xfae3('0x3b')][_0xfae3('0x38')]({'where':{'type':_0x3bb850,'resourceId':_0x2ec058['id']}})[_0xfae3('0x20')](function(){return _0x458dc9;});})[_0xfae3('0x20')](function(){_0x40511b['status'](0xcc)[_0xfae3('0x2d')]();});}};}function handleEntityNotFound(_0x2ca25d,_0x44c2d1){return function(_0x48b4ba){if(!_0x48b4ba){_0x2ca25d[_0xfae3('0x2b')](0x194);}return _0x48b4ba;};}function handleError(_0x3222be,_0x42931b){_0x42931b=_0x42931b||0x1f4;return function(_0x19a08c){logger['error'](_0x19a08c[_0xfae3('0x3c')]);if(_0x19a08c['name']){delete _0x19a08c[_0xfae3('0x3d')];}_0x3222be[_0xfae3('0x2c')](_0x42931b)[_0xfae3('0x3e')](_0x19a08c);};}exports['index']=function(_0x106eca,_0x42f8c5){var _0x11bfdc={},_0x105675={},_0x2b2aa5={'count':0x0,'rows':[]};var _0x305623=_[_0xfae3('0x3f')](db[_0xfae3('0x40')][_0xfae3('0x41')],function(_0x276a2c){return{'name':_0x276a2c[_0xfae3('0x42')],'type':_0x276a2c[_0xfae3('0x43')][_0xfae3('0x44')]};});_0x105675[_0xfae3('0x45')]=_[_0xfae3('0x3f')](_0x305623,_0xfae3('0x3d'));_0x105675[_0xfae3('0x46')]=_['keys'](_0x106eca[_0xfae3('0x46')]);_0x105675['filters']=_[_0xfae3('0x47')](_0x105675[_0xfae3('0x45')],_0x105675[_0xfae3('0x46')]);_0x11bfdc['attributes']=_['intersection'](_0x105675[_0xfae3('0x45')],qs[_0xfae3('0x48')](_0x106eca[_0xfae3('0x46')]['fields']));_0x11bfdc['attributes']=_0x11bfdc[_0xfae3('0x49')]['length']?_0x11bfdc[_0xfae3('0x49')]:_0x105675[_0xfae3('0x45')];if(!_0x106eca[_0xfae3('0x46')][_0xfae3('0x4a')](_0xfae3('0x4b'))){_0x11bfdc[_0xfae3('0x30')]=qs[_0xfae3('0x30')](_0x106eca['query']['limit']);_0x11bfdc[_0xfae3('0x2f')]=qs[_0xfae3('0x2f')](_0x106eca[_0xfae3('0x46')][_0xfae3('0x2f')]);}_0x11bfdc['order']=qs[_0xfae3('0x4c')](_0x106eca[_0xfae3('0x46')][_0xfae3('0x4c')]);_0x11bfdc[_0xfae3('0x4d')]=qs['filters'](_['pick'](_0x106eca[_0xfae3('0x46')],_0x105675[_0xfae3('0x4e')]),_0x305623);if(_0x106eca[_0xfae3('0x46')]['filter']){_0x11bfdc[_0xfae3('0x4d')]=_[_0xfae3('0x4f')](_0x11bfdc[_0xfae3('0x4d')],{'$or':_[_0xfae3('0x3f')](_0x305623,function(_0xe00932){if(_0xe00932[_0xfae3('0x43')]!==_0xfae3('0x50')){var _0xb38ad0={};_0xb38ad0[_0xe00932[_0xfae3('0x3d')]]={'$like':'%'+_0x106eca[_0xfae3('0x46')][_0xfae3('0x51')]+'%'};return _0xb38ad0;}})});}_0x11bfdc=_[_0xfae3('0x4f')]({},_0x11bfdc,_0x106eca[_0xfae3('0x52')]);var _0xf2c519={'where':_0x11bfdc[_0xfae3('0x4d')]};return db[_0xfae3('0x40')][_0xfae3('0x32')](_0xf2c519)[_0xfae3('0x20')](function(_0x306592){_0x2b2aa5[_0xfae3('0x32')]=_0x306592;if(_0x106eca[_0xfae3('0x46')][_0xfae3('0x53')]){_0x11bfdc[_0xfae3('0x54')]=[{'all':!![]}];}return db[_0xfae3('0x40')]['findAll'](_0x11bfdc);})['then'](function(_0x15868b){_0x2b2aa5[_0xfae3('0x55')]=_0x15868b;return _0x2b2aa5;})[_0xfae3('0x20')](respondWithFilteredResult(_0x42f8c5,_0x11bfdc))[_0xfae3('0x2a')](handleError(_0x42f8c5,null));};exports[_0xfae3('0x56')]=function(_0x300611,_0x358572){var _0xc9076d={'raw':!![],'where':{'id':_0x300611[_0xfae3('0x57')]['id']}},_0x14d536={};_0x14d536[_0xfae3('0x45')]=_[_0xfae3('0x58')](db[_0xfae3('0x40')][_0xfae3('0x41')]);_0x14d536[_0xfae3('0x46')]=_[_0xfae3('0x58')](_0x300611[_0xfae3('0x46')]);_0x14d536['filters']=_[_0xfae3('0x47')](_0x14d536[_0xfae3('0x45')],_0x14d536['query']);_0xc9076d[_0xfae3('0x49')]=_[_0xfae3('0x47')](_0x14d536['model'],qs[_0xfae3('0x48')](_0x300611[_0xfae3('0x46')]['fields']));_0xc9076d[_0xfae3('0x49')]=_0xc9076d[_0xfae3('0x49')]['length']?_0xc9076d[_0xfae3('0x49')]:_0x14d536[_0xfae3('0x45')];if(_0x300611[_0xfae3('0x46')][_0xfae3('0x53')]){_0xc9076d['include']=[{'all':!![]}];}_0xc9076d=_[_0xfae3('0x4f')]({},_0xc9076d,_0x300611[_0xfae3('0x52')]);return db[_0xfae3('0x40')][_0xfae3('0x59')](_0xc9076d)[_0xfae3('0x20')](handleEntityNotFound(_0x358572,null))['then'](respondWithResult(_0x358572,null))[_0xfae3('0x2a')](handleError(_0x358572,null));};exports[_0xfae3('0x5a')]=function(_0x20d348,_0xf7fe00){return db['ChatQueue']['create'](_0x20d348[_0xfae3('0x5b')],{})[_0xfae3('0x20')](function(_0x3b8a39){var _0x4c14b9=_0x20d348[_0xfae3('0x5c')][_0xfae3('0x39')]({'plain':!![]});if(!_0x4c14b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c14b9[_0xfae3('0x5d')]===_0xfae3('0x5c')){var _0x3175e7=_0x3b8a39[_0xfae3('0x39')]({'plain':!![]});var _0x33ea32=_0xfae3('0x3a');return db['UserProfileSection'][_0xfae3('0x59')]({'where':{'name':_0x33ea32,'userProfileId':_0x4c14b9[_0xfae3('0x5e')]},'raw':!![]})[_0xfae3('0x20')](function(_0x53c10d){if(_0x53c10d&&_0x53c10d[_0xfae3('0x5f')]===0x0){return db[_0xfae3('0x3b')][_0xfae3('0x5a')]({'name':_0x3175e7[_0xfae3('0x3d')],'resourceId':_0x3175e7['id'],'type':_0x53c10d['name'],'sectionId':_0x53c10d['id']},{})[_0xfae3('0x20')](function(){return _0x3b8a39;});}else{return _0x3b8a39;}})['catch'](function(_0xa88161){logger[_0xfae3('0x27')](_0xfae3('0x60'),_0xa88161);throw _0xa88161;});}return _0x3b8a39;})[_0xfae3('0x20')](respondWithResult(_0xf7fe00,0xc9))[_0xfae3('0x2a')](handleError(_0xf7fe00,null));};exports[_0xfae3('0x37')]=function(_0x1ad9fe,_0x1db1ff){if(_0x1ad9fe['body']['id']){delete _0x1ad9fe[_0xfae3('0x5b')]['id'];}return db[_0xfae3('0x40')][_0xfae3('0x59')]({'where':{'id':_0x1ad9fe['params']['id']}})[_0xfae3('0x20')](handleEntityNotFound(_0x1db1ff,null))[_0xfae3('0x20')](saveUpdates(_0x1ad9fe['body'],null))[_0xfae3('0x20')](respondWithResult(_0x1db1ff,null))[_0xfae3('0x2a')](handleError(_0x1db1ff,null));};exports[_0xfae3('0x38')]=function(_0x37025c,_0x4fbae6){return db['ChatQueue'][_0xfae3('0x59')]({'where':{'id':_0x37025c[_0xfae3('0x57')]['id']}})[_0xfae3('0x20')](handleEntityNotFound(_0x4fbae6,null))['then'](removeEntity(_0x4fbae6,null))[_0xfae3('0x2a')](handleError(_0x4fbae6,null));};exports[_0xfae3('0x61')]=function(_0x3f094f,_0x258cc2){return db[_0xfae3('0x40')][_0xfae3('0x61')]()[_0xfae3('0x20')](respondWithResult(_0x258cc2,null))[_0xfae3('0x2a')](handleError(_0x258cc2,null));};exports['getMembers']=function(_0x4e1c3d,_0x13c094,_0x4ff355){var _0x388a7a={'raw':!![],'where':{}},_0x3f35cb={},_0x183b2;return db[_0xfae3('0x40')][_0xfae3('0x62')]({'where':{'id':_0x4e1c3d['params']['id']}})[_0xfae3('0x20')](handleEntityNotFound(_0x13c094,null))['then'](function(_0x3656b1){if(_0x3656b1){_0x183b2=_0x3656b1[_0xfae3('0x39')]({'plain':!![]});_0x3f35cb[_0xfae3('0x45')]=_[_0xfae3('0x58')](db[_0xfae3('0x63')][_0xfae3('0x41')]);_0x3f35cb[_0xfae3('0x46')]=_[_0xfae3('0x58')](_0x4e1c3d[_0xfae3('0x46')]);_0x3f35cb[_0xfae3('0x4e')]=_[_0xfae3('0x47')](_0x3f35cb[_0xfae3('0x45')],_0x3f35cb['query']);_0x388a7a[_0xfae3('0x49')]=_['intersection'](_0x3f35cb[_0xfae3('0x45')],qs[_0xfae3('0x48')](_0x4e1c3d[_0xfae3('0x46')][_0xfae3('0x48')]));_0x388a7a[_0xfae3('0x49')]=_0x388a7a[_0xfae3('0x49')]['length']?_0x388a7a[_0xfae3('0x49')]:_0x3f35cb[_0xfae3('0x45')];if(!_0x4e1c3d['query']['hasOwnProperty'](_0xfae3('0x4b'))){_0x388a7a[_0xfae3('0x30')]=qs['limit'](_0x4e1c3d[_0xfae3('0x46')][_0xfae3('0x30')]);_0x388a7a['offset']=qs[_0xfae3('0x2f')](_0x4e1c3d[_0xfae3('0x46')][_0xfae3('0x2f')]);}_0x388a7a[_0xfae3('0x64')]=qs[_0xfae3('0x4c')](_0x4e1c3d['query']['sort']);_0x388a7a['where']=qs[_0xfae3('0x4e')](_[_0xfae3('0x65')](_0x4e1c3d[_0xfae3('0x46')],_0x3f35cb[_0xfae3('0x4e')]));_0x388a7a[_0xfae3('0x4d')][_0xfae3('0x66')]=_0x3656b1['id'];if(_0x4e1c3d[_0xfae3('0x46')]['filter']){_0x388a7a[_0xfae3('0x4d')]=_[_0xfae3('0x4f')](_0x388a7a[_0xfae3('0x4d')],{'$or':_[_0xfae3('0x3f')](_0x388a7a[_0xfae3('0x49')],function(_0x38d11a){var _0x3ab17b={};_0x3ab17b[_0x38d11a]={'$like':'%'+_0x4e1c3d['query']['filter']+'%'};return _0x3ab17b;})});}_0x388a7a=_[_0xfae3('0x4f')]({},_0x388a7a,_0x4e1c3d[_0xfae3('0x52')]);return db[_0xfae3('0x63')]['findAll'](_0x388a7a);}})[_0xfae3('0x20')](function(_0x307cbd){if(_0x307cbd){return db[_0xfae3('0x67')][_0xfae3('0x68')]({'where':{'id':_[_0xfae3('0x3f')](_0x307cbd,_0xfae3('0x69')),'role':_0xfae3('0x6a')},'attributes':['id',_0xfae3('0x3d'),_0xfae3('0x6b'),_0xfae3('0x6c'),_0xfae3('0x6d')]});}})[_0xfae3('0x20')](function(_0x57c784){if(_0x57c784){return{'count':_0x57c784[_0xfae3('0x32')],'rows':_[_0xfae3('0x3f')](_0x57c784[_0xfae3('0x55')],function(_0x5da938){return{'membername':_0x5da938[_0xfae3('0x3d')],'UserId':_0x5da938['id'],'queue_name':_0x183b2[_0xfae3('0x3d')],'ChatQueueId':_0x183b2['id'],'interface':util['format']('%s/%s',_0xfae3('0x6e'),_0x5da938[_0xfae3('0x3d')]),'penalty':0x0,'paused':_0x5da938[_0xfae3('0x6b')],'createdAt':_0x5da938[_0xfae3('0x6d')],'updatedAt':_0x5da938[_0xfae3('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfae3('0x20')](respondWithFilteredResult(_0x13c094,_0x388a7a))['catch'](handleError(_0x13c094,null));};exports[_0xfae3('0x6f')]=function(_0x3fcccb,_0xe9d67f,_0x3910a9){var _0x10b2e9={};var _0x3b221a={};var _0x564860;var _0x12ac96;return db[_0xfae3('0x40')][_0xfae3('0x62')]({'where':{'id':_0x3fcccb['params']['id']}})[_0xfae3('0x20')](handleEntityNotFound(_0xe9d67f,null))['then'](function(_0x5f2bc2){if(_0x5f2bc2){_0x564860=_0x5f2bc2;_0x3b221a[_0xfae3('0x45')]=_[_0xfae3('0x58')](db[_0xfae3('0x70')]['rawAttributes']);_0x3b221a[_0xfae3('0x46')]=_[_0xfae3('0x58')](_0x3fcccb[_0xfae3('0x46')]);_0x3b221a[_0xfae3('0x4e')]=_[_0xfae3('0x47')](_0x3b221a[_0xfae3('0x45')],_0x3b221a[_0xfae3('0x46')]);_0x10b2e9[_0xfae3('0x49')]=_[_0xfae3('0x47')](_0x3b221a['model'],qs[_0xfae3('0x48')](_0x3fcccb[_0xfae3('0x46')][_0xfae3('0x48')]));_0x10b2e9[_0xfae3('0x49')]=_0x10b2e9[_0xfae3('0x49')]['length']?_0x10b2e9[_0xfae3('0x49')]:_0x3b221a[_0xfae3('0x45')];_0x10b2e9[_0xfae3('0x64')]=qs[_0xfae3('0x4c')](_0x3fcccb['query'][_0xfae3('0x4c')]);_0x10b2e9[_0xfae3('0x4d')]=qs[_0xfae3('0x4e')](_[_0xfae3('0x65')](_0x3fcccb[_0xfae3('0x46')],_0x3b221a[_0xfae3('0x4e')]));if(_0x3fcccb[_0xfae3('0x46')][_0xfae3('0x51')]){_0x10b2e9['where']=_[_0xfae3('0x4f')](_0x10b2e9['where'],{'$or':_['map'](_0x10b2e9['attributes'],function(_0xf8d5ae){var _0x5a3b8a={};_0x5a3b8a[_0xf8d5ae]={'$like':'%'+_0x3fcccb[_0xfae3('0x46')][_0xfae3('0x51')]+'%'};return _0x5a3b8a;})});}_0x10b2e9=_[_0xfae3('0x4f')]({},_0x10b2e9,_0x3fcccb['options']);return _0x564860['getTeams'](_0x10b2e9);}})[_0xfae3('0x20')](function(_0x375c34){if(_0x375c34){_0x12ac96=_0x375c34[_0xfae3('0x71')];if(!_0x3fcccb[_0xfae3('0x46')][_0xfae3('0x4a')](_0xfae3('0x4b'))){_0x10b2e9[_0xfae3('0x30')]=qs[_0xfae3('0x30')](_0x3fcccb['query'][_0xfae3('0x30')]);_0x10b2e9[_0xfae3('0x2f')]=qs[_0xfae3('0x2f')](_0x3fcccb[_0xfae3('0x46')][_0xfae3('0x2f')]);}return _0x564860[_0xfae3('0x6f')](_0x10b2e9);}})['then'](function(_0x1e1ff1){if(_0x1e1ff1){return _0x1e1ff1?{'count':_0x12ac96,'rows':_0x1e1ff1}:null;}})['then'](respondWithResult(_0xe9d67f,null))[_0xfae3('0x2a')](handleError(_0xe9d67f,null));};exports[_0xfae3('0x72')]=function(_0x213271,_0x202f80,_0x3440b1){var _0x55b2a5=_0x213271[_0xfae3('0x5b')]['ids'];return db[_0xfae3('0x70')]['findAll']({'where':{'id':_0x55b2a5},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfae3('0x73'),'attributes':['id',_0xfae3('0x3d'),_0xfae3('0x74'),_0xfae3('0x75'),_0xfae3('0x76')],'raw':!![]}]})[_0xfae3('0x20')](function(_0x1a4d4d){if(_0x1a4d4d){var _0x4b729e=_[_0xfae3('0x77')](_0x1a4d4d,function(_0x497449){var _0x621077=_0x497449[_0xfae3('0x39')]({'plain':!![]});return _0x621077[_0xfae3('0x73')];});return db[_0xfae3('0x40')]['find']({'where':{'id':_0x213271[_0xfae3('0x57')]['id']}})[_0xfae3('0x20')](function(_0x399517){return db[_0xfae3('0x78')][_0xfae3('0x79')](function(_0x2b54df){return _0x399517[_0xfae3('0x72')](_0x55b2a5,{'transaction':_0x2b54df})[_0xfae3('0x20')](function(){return BPromise[_0xfae3('0x7a')](_0x4b729e,function(_0x2a89b7){return db[_0xfae3('0x63')]['findOrCreate']({'where':{'UserId':_0x2a89b7['id'],'ChatQueueId':_0x213271['params']['id']},'transaction':_0x2b54df});});})[_0xfae3('0x20')](function(){_0x4b729e[_0xfae3('0x7b')](function(_0x15fc06){socket[_0xfae3('0x7c')](_0xfae3('0x7d'),{'UserId':_0x15fc06['id'],'ChatQueueId':_0x399517['id']});});});});});}})[_0xfae3('0x20')](respondWithStatusCode(_0x202f80,null))[_0xfae3('0x2a')](handleError(_0x202f80,null));};exports[_0xfae3('0x7e')]=function(_0x5f1140,_0x19d0a8,_0x206cf1){return db[_0xfae3('0x70')][_0xfae3('0x7f')]({'where':{'id':_0x5f1140['query'][_0xfae3('0x80')]},'attributes':['id'],'include':[{'model':db[_0xfae3('0x67')],'as':_0xfae3('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x19d0a8,null))[_0xfae3('0x20')](function(_0x2a0eaf){var _0x2334e9=_['map'](_0x2a0eaf,'id');var _0x166015=[];var _0x148ac4=[];var _0x287bd9=squel[_0xfae3('0x81')]();_0x287bd9[_0xfae3('0x82')](_0xfae3('0x83'))[_0xfae3('0x84')](_0xfae3('0x85'),'tq')[_0xfae3('0x86')](_0xfae3('0x87'),'ut',_0xfae3('0x88'))['where']('ChatQueueId\x20=\x20?',_0x5f1140[_0xfae3('0x57')]['id']);for(var _0xf77b8f=0x0;_0xf77b8f<_0x2a0eaf[_0xfae3('0x71')];_0xf77b8f+=0x1){let _0x3ecedb=_0x2a0eaf[_0xf77b8f];for(var _0x25a16c=0x0;_0x25a16c<_0x3ecedb[_0xfae3('0x73')]['length'];_0x25a16c+=0x1){let _0x237969=_0x3ecedb[_0xfae3('0x73')][_0x25a16c];var _0x3b4349=_0x287bd9[_0xfae3('0x89')]();_0x3b4349[_0xfae3('0x4d')](_0xfae3('0x8a'),_0x237969['id']);_0x148ac4['push'](db[_0xfae3('0x78')]['query'](_0x3b4349['toString'](),{'type':db[_0xfae3('0x78')][_0xfae3('0x8b')][_0xfae3('0x8c')]})[_0xfae3('0x20')](function(_0x5c0b67){if(_0x5c0b67[_0xfae3('0x71')]===0x1){return _0x237969['id'];}else{var _0x5077ae=_[_0xfae3('0x8d')](_['map'](_0x5c0b67,_0xfae3('0x8e')),function(_0x1208d1){return _['includes'](_0x2334e9,_0x1208d1);});if(_0x5077ae){return _0x237969['id'];}}}));}}return BPromise[_0xfae3('0x8f')](_0x148ac4)[_0xfae3('0x20')](function(_0x14c6b3){_0x166015=_(_0x166015)['union'](_0x14c6b3)['compact']()['value']();return db[_0xfae3('0x40')][_0xfae3('0x59')]({'where':{'id':_0x5f1140['params']['id']}})[_0xfae3('0x20')](function(_0x3907b9){return db[_0xfae3('0x78')][_0xfae3('0x79')](function(_0x37b2bd){return _0x3907b9[_0xfae3('0x7e')](_0x5f1140['query'][_0xfae3('0x80')],{'transaction':_0x37b2bd})['then'](function(){if(!_[_0xfae3('0x90')](_0x166015)){return _0x3907b9[_0xfae3('0x91')](_0x166015,{'transaction':_0x37b2bd});}})[_0xfae3('0x20')](function(){_0x166015[_0xfae3('0x7b')](function(_0x376149){socket['emit'](_0xfae3('0x92'),{'UserId':_0x376149,'ChatQueueId':_0x3907b9['id']});});});});});});})['then'](respondWithStatusCode(_0x19d0a8,null))[_0xfae3('0x2a')](handleError(_0x19d0a8,null));};exports[_0xfae3('0x93')]=function(_0x2ca818,_0x2cbcad,_0x3d6008){return db[_0xfae3('0x40')]['find']({'where':{'id':_0x2ca818[_0xfae3('0x57')]['id']}})[_0xfae3('0x20')](handleEntityNotFound(_0x2cbcad,null))[_0xfae3('0x20')](function(_0x38b118){if(_0x38b118){return _0x38b118[_0xfae3('0x93')](_0x2ca818[_0xfae3('0x5b')][_0xfae3('0x80')],_[_0xfae3('0x94')](_0x2ca818[_0xfae3('0x5b')],[_0xfae3('0x80'),'id'])||{})[_0xfae3('0x95')](function(_0x23790a){for(var _0x4227a6=0x0;_0x4227a6<_0x2ca818[_0xfae3('0x5b')][_0xfae3('0x80')][_0xfae3('0x71')];_0x4227a6+=0x1){socket[_0xfae3('0x7c')](_0xfae3('0x7d'),{'UserId':Number(_0x2ca818['body'][_0xfae3('0x80')][_0x4227a6]),'ChatQueueId':Number(_0x2ca818[_0xfae3('0x57')]['id'])});}return _0x23790a;});}})[_0xfae3('0x20')](respondWithResult(_0x2cbcad,null))['catch'](handleError(_0x2cbcad,null));};exports['removeAgents']=function(_0x18b812,_0x355803,_0x5f2a8b){return db['ChatQueue'][_0xfae3('0x59')]({'where':{'id':_0x18b812[_0xfae3('0x57')]['id']}})[_0xfae3('0x20')](handleEntityNotFound(_0x355803,null))[_0xfae3('0x20')](function(_0x286d78){if(_0x286d78){return _0x286d78[_0xfae3('0x91')](_0x18b812[_0xfae3('0x46')][_0xfae3('0x80')])[_0xfae3('0x20')](function(){if(_[_0xfae3('0x96')](_0x18b812[_0xfae3('0x46')][_0xfae3('0x80')])){for(var _0x1ba54a=0x0;_0x1ba54a<_0x18b812[_0xfae3('0x46')][_0xfae3('0x80')][_0xfae3('0x71')];_0x1ba54a+=0x1){socket[_0xfae3('0x7c')](_0xfae3('0x92'),{'UserId':Number(_0x18b812[_0xfae3('0x46')][_0xfae3('0x80')][_0x1ba54a]),'ChatQueueId':Number(_0x18b812['params']['id'])});}}else{socket[_0xfae3('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x18b812[_0xfae3('0x46')][_0xfae3('0x80')]),'ChatQueueId':Number(_0x18b812[_0xfae3('0x57')]['id'])});}});}})[_0xfae3('0x20')](respondWithStatusCode(_0x355803,null))[_0xfae3('0x2a')](handleError(_0x355803,null));};exports[_0xfae3('0x97')]=function(_0x5a5674,_0x308854,_0x174cf8){var _0x95956e={};var _0x1d5c0a={};var _0x55d8cd;var _0x472596;return db[_0xfae3('0x40')][_0xfae3('0x62')]({'where':{'id':_0x5a5674[_0xfae3('0x57')]['id']}})[_0xfae3('0x20')](handleEntityNotFound(_0x308854,null))[_0xfae3('0x20')](function(_0x218e86){if(_0x218e86){_0x55d8cd=_0x218e86;_0x1d5c0a['model']=_[_0xfae3('0x58')](db[_0xfae3('0x67')][_0xfae3('0x41')]);_0x1d5c0a[_0xfae3('0x46')]=_['keys'](_0x5a5674[_0xfae3('0x46')]);_0x1d5c0a[_0xfae3('0x4e')]=_['intersection'](_0x1d5c0a[_0xfae3('0x45')],_0x1d5c0a[_0xfae3('0x46')]);_0x95956e[_0xfae3('0x49')]=_[_0xfae3('0x47')](_0x1d5c0a[_0xfae3('0x45')],qs[_0xfae3('0x48')](_0x5a5674['query'][_0xfae3('0x48')]));_0x95956e[_0xfae3('0x49')]=_0x95956e['attributes'][_0xfae3('0x71')]?_0x95956e[_0xfae3('0x49')]:_0x1d5c0a['model'];_0x95956e[_0xfae3('0x64')]=qs[_0xfae3('0x4c')](_0x5a5674[_0xfae3('0x46')][_0xfae3('0x4c')]);_0x95956e[_0xfae3('0x4d')]=qs[_0xfae3('0x4e')](_[_0xfae3('0x65')](_0x5a5674['query'],_0x1d5c0a['filters']));if(_0x5a5674[_0xfae3('0x46')]['filter']){_0x95956e[_0xfae3('0x4d')]=_[_0xfae3('0x4f')](_0x95956e['where'],{'$or':_[_0xfae3('0x3f')](_0x95956e[_0xfae3('0x49')],function(_0x4a21a5){var _0x2248a4={};_0x2248a4[_0x4a21a5]={'$like':'%'+_0x5a5674[_0xfae3('0x46')]['filter']+'%'};return _0x2248a4;})});}_0x95956e=_['merge']({},_0x95956e,_0x5a5674[_0xfae3('0x52')]);return _0x55d8cd['getAgents'](_0x95956e);}})[_0xfae3('0x20')](function(_0x4a94c4){if(_0x4a94c4){_0x472596=_0x4a94c4[_0xfae3('0x71')];if(!_0x5a5674[_0xfae3('0x46')][_0xfae3('0x4a')](_0xfae3('0x4b'))){_0x95956e[_0xfae3('0x30')]=qs[_0xfae3('0x30')](_0x5a5674['query'][_0xfae3('0x30')]);_0x95956e[_0xfae3('0x2f')]=qs[_0xfae3('0x2f')](_0x5a5674[_0xfae3('0x46')][_0xfae3('0x2f')]);}return _0x55d8cd['getAgents'](_0x95956e);}})['then'](function(_0x2ef440){if(_0x2ef440){return _0x2ef440?{'count':_0x472596,'rows':_0x2ef440}:null;}})[_0xfae3('0x20')](respondWithResult(_0x308854,null))['catch'](handleError(_0x308854,null));}; \ No newline at end of file +var _0x79d7=['catch','sendStatus','status','undefined','count','offset','limit','set','json','apply','save','update','destroy','get','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','params','describe','getMembers','findOne','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','flatMap','transaction','each','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','rimraf','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x306186,_0x5db739){var _0x27c782=function(_0x9c5c16){while(--_0x9c5c16){_0x306186['push'](_0x306186['shift']());}};_0x27c782(++_0x5db739);}(_0x79d7,0x18c));var _0x779d=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x79d7[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x779d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x779d('0x1'));var moment=require(_0x779d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x779d('0x3'));var util=require('util');var path=require(_0x779d('0x4'));var sox=require(_0x779d('0x5'));var csv=require(_0x779d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x779d('0x7'));var _=require(_0x779d('0x8'));var squel=require(_0x779d('0x9'));var crypto=require(_0x779d('0xa'));var jsforce=require(_0x779d('0xb'));var deskjs=require(_0x779d('0xc'));var toCsv=require(_0x779d('0x6'));var querystring=require(_0x779d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x779d('0xe'));var qs=require(_0x779d('0xf'));var as=require(_0x779d('0x10'));var hardwareService=require(_0x779d('0x11'));var logger=require(_0x779d('0x12'))('api');var utils=require(_0x779d('0x13'));var config=require(_0x779d('0x14'));var licenseUtil=require(_0x779d('0x15'));var db=require(_0x779d('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x779d('0x17'),'port':0x18eb});var socket=require(_0x779d('0x18'))(new Redis(config['redis']));require(_0x779d('0x19'))[_0x779d('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed7a5,_0x3fb8df,_0x2cfe06,_0xfa4390){return new BPromise(function(_0x459fb7,_0xd7c43a){var _0x115f53=_0xfa4390||client;return _0x115f53[_0x779d('0x1b')](_0x2ed7a5,_0x2cfe06)[_0x779d('0x1c')](function(_0x167207){logger[_0x779d('0x1d')](_0x779d('0x1e'),_0x3fb8df,'request\x20sent');logger[_0x779d('0x1f')](_0x779d('0x20'),_0x3fb8df,_0x779d('0x21'),JSON[_0x779d('0x22')](_0x167207));if(_0x167207['error']){if(_0x167207[_0x779d('0x23')][_0x779d('0x24')]===0x1f4){logger['error'](_0x779d('0x1e'),_0x3fb8df,_0x167207[_0x779d('0x23')][_0x779d('0x25')]);return _0xd7c43a(_0x167207[_0x779d('0x23')]['message']);}logger[_0x779d('0x23')](_0x779d('0x1e'),_0x3fb8df,_0x167207[_0x779d('0x23')]['message']);return _0x459fb7(_0x167207[_0x779d('0x23')][_0x779d('0x25')]);}else{logger[_0x779d('0x1d')](_0x779d('0x1e'),_0x3fb8df,_0x779d('0x21'));_0x459fb7(_0x167207[_0x779d('0x26')]['message']);}})[_0x779d('0x27')](function(_0x5ca74b){logger['error'](_0x779d('0x1e'),_0x3fb8df,_0x5ca74b);_0xd7c43a(_0x5ca74b);});});}function respondWithStatusCode(_0x22d1a4,_0x3e52c0){_0x3e52c0=_0x3e52c0||0xcc;return function(_0x190236){if(_0x190236){return _0x22d1a4[_0x779d('0x28')](_0x3e52c0);}return _0x22d1a4[_0x779d('0x29')](_0x3e52c0)['end']();};}function respondWithResult(_0xaa4afb,_0xd313b){_0xd313b=_0xd313b||0xc8;return function(_0x125c7d){if(_0x125c7d){return _0xaa4afb['status'](_0xd313b)['json'](_0x125c7d);}};}function respondWithFilteredResult(_0x47e74e,_0x54843c){return function(_0x5d0b77){if(_0x5d0b77){var _0x2c51ac=typeof _0x54843c['offset']==='undefined'&&typeof _0x54843c['limit']===_0x779d('0x2a');var _0x124c37=_0x5d0b77[_0x779d('0x2b')];var _0x592c3c=_0x2c51ac?0x0:_0x54843c[_0x779d('0x2c')];var _0x19bc1c=_0x2c51ac?_0x5d0b77[_0x779d('0x2b')]:_0x54843c[_0x779d('0x2c')]+_0x54843c[_0x779d('0x2d')];var _0x49f237;if(_0x19bc1c>=_0x124c37){_0x19bc1c=_0x124c37;_0x49f237=0xc8;}else{_0x49f237=0xce;}_0x47e74e['status'](_0x49f237);return _0x47e74e[_0x779d('0x2e')]('Content-Range',_0x592c3c+'-'+_0x19bc1c+'/'+_0x124c37)[_0x779d('0x2f')](_0x5d0b77);}return null;};}function patchUpdates(_0x1973f4){return function(_0x111234){try{jsonpatch[_0x779d('0x30')](_0x111234,_0x1973f4,!![]);}catch(_0xc8e940){return BPromise['reject'](_0xc8e940);}return _0x111234[_0x779d('0x31')]();};}function saveUpdates(_0x4e950d,_0x22d3c3){return function(_0xea1106){if(_0xea1106){return _0xea1106[_0x779d('0x32')](_0x4e950d)[_0x779d('0x1c')](function(_0x4ccbe5){return _0x4ccbe5;});}return null;};}function removeEntity(_0x3bb208,_0x5f39cd){return function(_0x2335a1){if(_0x2335a1){return _0x2335a1[_0x779d('0x33')]()['then'](function(){var _0x58b4bf=_0x2335a1[_0x779d('0x34')]({'plain':!![]});var _0x32141a='ChatQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x32141a,'resourceId':_0x58b4bf['id']}})[_0x779d('0x1c')](function(){return _0x2335a1;});})[_0x779d('0x1c')](function(){_0x3bb208[_0x779d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df56e,_0x595e6f){return function(_0xfa213d){if(!_0xfa213d){_0x1df56e[_0x779d('0x28')](0x194);}return _0xfa213d;};}function handleError(_0x1a3b16,_0x2d0004){_0x2d0004=_0x2d0004||0x1f4;return function(_0x521641){logger[_0x779d('0x23')](_0x521641['stack']);if(_0x521641['name']){delete _0x521641[_0x779d('0x35')];}_0x1a3b16[_0x779d('0x29')](_0x2d0004)[_0x779d('0x36')](_0x521641);};}exports[_0x779d('0x37')]=function(_0x729251,_0xf576aa){var _0x5e5aea={},_0x208dbd={},_0x2cbe3f={'count':0x0,'rows':[]};var _0x442e97=_[_0x779d('0x38')](db[_0x779d('0x39')][_0x779d('0x3a')],function(_0x3de56c){return{'name':_0x3de56c[_0x779d('0x3b')],'type':_0x3de56c['type'][_0x779d('0x3c')]};});_0x208dbd[_0x779d('0x3d')]=_[_0x779d('0x38')](_0x442e97,_0x779d('0x35'));_0x208dbd['query']=_[_0x779d('0x3e')](_0x729251[_0x779d('0x3f')]);_0x208dbd[_0x779d('0x40')]=_['intersection'](_0x208dbd[_0x779d('0x3d')],_0x208dbd[_0x779d('0x3f')]);_0x5e5aea[_0x779d('0x41')]=_[_0x779d('0x42')](_0x208dbd['model'],qs['fields'](_0x729251['query'][_0x779d('0x43')]));_0x5e5aea[_0x779d('0x41')]=_0x5e5aea[_0x779d('0x41')]['length']?_0x5e5aea[_0x779d('0x41')]:_0x208dbd[_0x779d('0x3d')];if(!_0x729251[_0x779d('0x3f')][_0x779d('0x44')](_0x779d('0x45'))){_0x5e5aea[_0x779d('0x2d')]=qs[_0x779d('0x2d')](_0x729251['query']['limit']);_0x5e5aea['offset']=qs[_0x779d('0x2c')](_0x729251['query']['offset']);}_0x5e5aea[_0x779d('0x46')]=qs[_0x779d('0x47')](_0x729251[_0x779d('0x3f')]['sort']);_0x5e5aea[_0x779d('0x48')]=qs['filters'](_[_0x779d('0x49')](_0x729251['query'],_0x208dbd['filters']),_0x442e97);if(_0x729251[_0x779d('0x3f')][_0x779d('0x4a')]){_0x5e5aea[_0x779d('0x48')]=_[_0x779d('0x4b')](_0x5e5aea['where'],{'$or':_[_0x779d('0x38')](_0x442e97,function(_0x39f015){if(_0x39f015[_0x779d('0x4c')]!==_0x779d('0x4d')){var _0xd0441c={};_0xd0441c[_0x39f015[_0x779d('0x35')]]={'$like':'%'+_0x729251['query']['filter']+'%'};return _0xd0441c;}})});}_0x5e5aea=_[_0x779d('0x4b')]({},_0x5e5aea,_0x729251[_0x779d('0x4e')]);var _0xf61041={'where':_0x5e5aea[_0x779d('0x48')]};return db[_0x779d('0x39')]['count'](_0xf61041)[_0x779d('0x1c')](function(_0x20ae88){_0x2cbe3f[_0x779d('0x2b')]=_0x20ae88;if(_0x729251[_0x779d('0x3f')][_0x779d('0x4f')]){_0x5e5aea[_0x779d('0x50')]=[{'all':!![]}];}return db[_0x779d('0x39')][_0x779d('0x51')](_0x5e5aea);})[_0x779d('0x1c')](function(_0x298448){_0x2cbe3f[_0x779d('0x52')]=_0x298448;return _0x2cbe3f;})[_0x779d('0x1c')](respondWithFilteredResult(_0xf576aa,_0x5e5aea))[_0x779d('0x27')](handleError(_0xf576aa,null));};exports[_0x779d('0x53')]=function(_0x4a8b71,_0x5654b4){var _0x42934f={'raw':!![],'where':{'id':_0x4a8b71['params']['id']}},_0x333f84={};_0x333f84[_0x779d('0x3d')]=_['keys'](db[_0x779d('0x39')][_0x779d('0x3a')]);_0x333f84[_0x779d('0x3f')]=_['keys'](_0x4a8b71[_0x779d('0x3f')]);_0x333f84['filters']=_['intersection'](_0x333f84[_0x779d('0x3d')],_0x333f84['query']);_0x42934f[_0x779d('0x41')]=_[_0x779d('0x42')](_0x333f84[_0x779d('0x3d')],qs['fields'](_0x4a8b71[_0x779d('0x3f')]['fields']));_0x42934f['attributes']=_0x42934f[_0x779d('0x41')][_0x779d('0x54')]?_0x42934f[_0x779d('0x41')]:_0x333f84[_0x779d('0x3d')];if(_0x4a8b71[_0x779d('0x3f')][_0x779d('0x4f')]){_0x42934f[_0x779d('0x50')]=[{'all':!![]}];}_0x42934f=_[_0x779d('0x4b')]({},_0x42934f,_0x4a8b71[_0x779d('0x4e')]);return db[_0x779d('0x39')][_0x779d('0x55')](_0x42934f)[_0x779d('0x1c')](handleEntityNotFound(_0x5654b4,null))[_0x779d('0x1c')](respondWithResult(_0x5654b4,null))[_0x779d('0x27')](handleError(_0x5654b4,null));};exports[_0x779d('0x56')]=function(_0x18eae7,_0x2bcfbe){return db[_0x779d('0x39')]['create'](_0x18eae7[_0x779d('0x57')],{})[_0x779d('0x1c')](function(_0x176ba2){var _0x189db9=_0x18eae7[_0x779d('0x58')][_0x779d('0x34')]({'plain':!![]});if(!_0x189db9)throw new Error(_0x779d('0x59'));if(_0x189db9['role']===_0x779d('0x58')){var _0x5ebb84=_0x176ba2['get']({'plain':!![]});var _0x5d1087='ChatQueues';return db[_0x779d('0x5a')]['find']({'where':{'name':_0x5d1087,'userProfileId':_0x189db9['userProfileId']},'raw':!![]})['then'](function(_0x42b8a7){if(_0x42b8a7&&_0x42b8a7[_0x779d('0x5b')]===0x0){return db[_0x779d('0x5c')][_0x779d('0x56')]({'name':_0x5ebb84[_0x779d('0x35')],'resourceId':_0x5ebb84['id'],'type':_0x42b8a7['name'],'sectionId':_0x42b8a7['id']},{})[_0x779d('0x1c')](function(){return _0x176ba2;});}else{return _0x176ba2;}})[_0x779d('0x27')](function(_0x2c8976){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c8976);throw _0x2c8976;});}return _0x176ba2;})[_0x779d('0x1c')](respondWithResult(_0x2bcfbe,0xc9))[_0x779d('0x27')](handleError(_0x2bcfbe,null));};exports[_0x779d('0x32')]=function(_0x3919eb,_0x287bdd){if(_0x3919eb[_0x779d('0x57')]['id']){delete _0x3919eb[_0x779d('0x57')]['id'];}return db[_0x779d('0x39')]['find']({'where':{'id':_0x3919eb[_0x779d('0x5d')]['id']}})[_0x779d('0x1c')](handleEntityNotFound(_0x287bdd,null))['then'](saveUpdates(_0x3919eb[_0x779d('0x57')],null))[_0x779d('0x1c')](respondWithResult(_0x287bdd,null))[_0x779d('0x27')](handleError(_0x287bdd,null));};exports['destroy']=function(_0x62ecfb,_0x1aaa08){return db[_0x779d('0x39')][_0x779d('0x55')]({'where':{'id':_0x62ecfb['params']['id']}})['then'](handleEntityNotFound(_0x1aaa08,null))['then'](removeEntity(_0x1aaa08,null))['catch'](handleError(_0x1aaa08,null));};exports[_0x779d('0x5e')]=function(_0x49bccc,_0x4f232b){return db[_0x779d('0x39')]['describe']()[_0x779d('0x1c')](respondWithResult(_0x4f232b,null))['catch'](handleError(_0x4f232b,null));};exports[_0x779d('0x5f')]=function(_0xc09cbd,_0xf18e27,_0x2031f9){var _0x598058={'raw':!![],'where':{}},_0x42d6d1={},_0x579a39;return db['ChatQueue'][_0x779d('0x60')]({'where':{'id':_0xc09cbd[_0x779d('0x5d')]['id']}})[_0x779d('0x1c')](handleEntityNotFound(_0xf18e27,null))['then'](function(_0x2970aa){if(_0x2970aa){_0x579a39=_0x2970aa[_0x779d('0x34')]({'plain':!![]});_0x42d6d1['model']=_[_0x779d('0x3e')](db['UserChatQueue']['rawAttributes']);_0x42d6d1['query']=_[_0x779d('0x3e')](_0xc09cbd[_0x779d('0x3f')]);_0x42d6d1[_0x779d('0x40')]=_[_0x779d('0x42')](_0x42d6d1['model'],_0x42d6d1[_0x779d('0x3f')]);_0x598058[_0x779d('0x41')]=_[_0x779d('0x42')](_0x42d6d1['model'],qs['fields'](_0xc09cbd['query'][_0x779d('0x43')]));_0x598058[_0x779d('0x41')]=_0x598058[_0x779d('0x41')][_0x779d('0x54')]?_0x598058[_0x779d('0x41')]:_0x42d6d1[_0x779d('0x3d')];if(!_0xc09cbd[_0x779d('0x3f')][_0x779d('0x44')](_0x779d('0x45'))){_0x598058['limit']=qs[_0x779d('0x2d')](_0xc09cbd[_0x779d('0x3f')]['limit']);_0x598058['offset']=qs[_0x779d('0x2c')](_0xc09cbd[_0x779d('0x3f')][_0x779d('0x2c')]);}_0x598058[_0x779d('0x46')]=qs['sort'](_0xc09cbd[_0x779d('0x3f')][_0x779d('0x47')]);_0x598058['where']=qs[_0x779d('0x40')](_[_0x779d('0x49')](_0xc09cbd[_0x779d('0x3f')],_0x42d6d1[_0x779d('0x40')]));_0x598058['where'][_0x779d('0x61')]=_0x2970aa['id'];if(_0xc09cbd[_0x779d('0x3f')][_0x779d('0x4a')]){_0x598058['where']=_['merge'](_0x598058[_0x779d('0x48')],{'$or':_['map'](_0x598058['attributes'],function(_0x5569ed){var _0x25a597={};_0x25a597[_0x5569ed]={'$like':'%'+_0xc09cbd[_0x779d('0x3f')]['filter']+'%'};return _0x25a597;})});}_0x598058=_[_0x779d('0x4b')]({},_0x598058,_0xc09cbd['options']);return db[_0x779d('0x62')][_0x779d('0x51')](_0x598058);}})[_0x779d('0x1c')](function(_0x2fe516){if(_0x2fe516){return db[_0x779d('0x63')][_0x779d('0x64')]({'where':{'id':_['map'](_0x2fe516,_0x779d('0x65')),'role':_0x779d('0x66')},'attributes':['id','name',_0x779d('0x67'),_0x779d('0x68'),_0x779d('0x69')]});}})[_0x779d('0x1c')](function(_0xde3c95){if(_0xde3c95){return{'count':_0xde3c95[_0x779d('0x2b')],'rows':_[_0x779d('0x38')](_0xde3c95['rows'],function(_0x2b89be){return{'membername':_0x2b89be[_0x779d('0x35')],'UserId':_0x2b89be['id'],'queue_name':_0x579a39['name'],'ChatQueueId':_0x579a39['id'],'interface':util[_0x779d('0x6a')]('%s/%s',_0x779d('0x6b'),_0x2b89be[_0x779d('0x35')]),'penalty':0x0,'paused':_0x2b89be[_0x779d('0x67')],'createdAt':_0x2b89be['createdAt'],'updatedAt':_0x2b89be[_0x779d('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x779d('0x1c')](respondWithFilteredResult(_0xf18e27,_0x598058))[_0x779d('0x27')](handleError(_0xf18e27,null));};exports[_0x779d('0x6c')]=function(_0x3f5f64,_0x20c201,_0x370cf8){var _0x300974={};var _0x2e92ed={};var _0x45e96f;var _0x1c0a58;return db['ChatQueue']['findOne']({'where':{'id':_0x3f5f64[_0x779d('0x5d')]['id']}})[_0x779d('0x1c')](handleEntityNotFound(_0x20c201,null))[_0x779d('0x1c')](function(_0x462999){if(_0x462999){_0x45e96f=_0x462999;_0x2e92ed[_0x779d('0x3d')]=_[_0x779d('0x3e')](db[_0x779d('0x6d')][_0x779d('0x3a')]);_0x2e92ed[_0x779d('0x3f')]=_[_0x779d('0x3e')](_0x3f5f64[_0x779d('0x3f')]);_0x2e92ed[_0x779d('0x40')]=_[_0x779d('0x42')](_0x2e92ed[_0x779d('0x3d')],_0x2e92ed['query']);_0x300974[_0x779d('0x41')]=_[_0x779d('0x42')](_0x2e92ed[_0x779d('0x3d')],qs[_0x779d('0x43')](_0x3f5f64[_0x779d('0x3f')][_0x779d('0x43')]));_0x300974[_0x779d('0x41')]=_0x300974[_0x779d('0x41')]['length']?_0x300974['attributes']:_0x2e92ed[_0x779d('0x3d')];_0x300974['order']=qs[_0x779d('0x47')](_0x3f5f64[_0x779d('0x3f')][_0x779d('0x47')]);_0x300974[_0x779d('0x48')]=qs[_0x779d('0x40')](_[_0x779d('0x49')](_0x3f5f64[_0x779d('0x3f')],_0x2e92ed[_0x779d('0x40')]));if(_0x3f5f64[_0x779d('0x3f')][_0x779d('0x4a')]){_0x300974[_0x779d('0x48')]=_[_0x779d('0x4b')](_0x300974[_0x779d('0x48')],{'$or':_[_0x779d('0x38')](_0x300974[_0x779d('0x41')],function(_0x1f498a){var _0x378eea={};_0x378eea[_0x1f498a]={'$like':'%'+_0x3f5f64[_0x779d('0x3f')][_0x779d('0x4a')]+'%'};return _0x378eea;})});}_0x300974=_[_0x779d('0x4b')]({},_0x300974,_0x3f5f64[_0x779d('0x4e')]);return _0x45e96f[_0x779d('0x6c')](_0x300974);}})[_0x779d('0x1c')](function(_0x4aac4c){if(_0x4aac4c){_0x1c0a58=_0x4aac4c[_0x779d('0x54')];if(!_0x3f5f64[_0x779d('0x3f')][_0x779d('0x44')]('nolimit')){_0x300974[_0x779d('0x2d')]=qs[_0x779d('0x2d')](_0x3f5f64[_0x779d('0x3f')][_0x779d('0x2d')]);_0x300974[_0x779d('0x2c')]=qs['offset'](_0x3f5f64[_0x779d('0x3f')][_0x779d('0x2c')]);}return _0x45e96f[_0x779d('0x6c')](_0x300974);}})[_0x779d('0x1c')](function(_0x448717){if(_0x448717){return _0x448717?{'count':_0x1c0a58,'rows':_0x448717}:null;}})['then'](respondWithResult(_0x20c201,null))[_0x779d('0x27')](handleError(_0x20c201,null));};exports[_0x779d('0x6e')]=function(_0x56021c,_0x1ba2b7,_0x182322){var _0x3b5199=_0x56021c['body'][_0x779d('0x6f')];return db[_0x779d('0x6d')][_0x779d('0x51')]({'where':{'id':_0x3b5199},'attributes':['id'],'include':[{'model':db[_0x779d('0x63')],'as':_0x779d('0x70'),'attributes':['id',_0x779d('0x35'),_0x779d('0x71'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x412da7){if(_0x412da7){var _0x5143ab=_[_0x779d('0x72')](_0x412da7,function(_0x12bc63){var _0x5a2fe2=_0x12bc63[_0x779d('0x34')]({'plain':!![]});return _0x5a2fe2[_0x779d('0x70')];});return db[_0x779d('0x39')]['find']({'where':{'id':_0x56021c[_0x779d('0x5d')]['id']}})[_0x779d('0x1c')](function(_0x52ced5){return db['sequelize'][_0x779d('0x73')](function(_0x306783){return _0x52ced5[_0x779d('0x6e')](_0x3b5199,{'transaction':_0x306783})[_0x779d('0x1c')](function(){return BPromise[_0x779d('0x74')](_0x5143ab,function(_0x1cbe45){return db[_0x779d('0x62')]['findOrCreate']({'where':{'UserId':_0x1cbe45['id'],'ChatQueueId':_0x56021c[_0x779d('0x5d')]['id']},'transaction':_0x306783});});})[_0x779d('0x1c')](function(){_0x5143ab[_0x779d('0x75')](function(_0x7ead9d){socket[_0x779d('0x76')](_0x779d('0x77'),{'UserId':_0x7ead9d['id'],'ChatQueueId':_0x52ced5['id']});});});});});}})[_0x779d('0x1c')](respondWithStatusCode(_0x1ba2b7,null))[_0x779d('0x27')](handleError(_0x1ba2b7,null));};exports[_0x779d('0x78')]=function(_0x24bfd6,_0x206dd8,_0x27282b){return db[_0x779d('0x6d')]['findAll']({'where':{'id':_0x24bfd6[_0x779d('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x779d('0x70'),'attributes':['id'],'raw':!![]}]})[_0x779d('0x1c')](handleEntityNotFound(_0x206dd8,null))[_0x779d('0x1c')](function(_0x185c98){var _0x2e7fc1=_[_0x779d('0x38')](_0x185c98,'id');var _0x5f105a=[];var _0x115d1a=[];var _0x123a84=squel['select']();_0x123a84[_0x779d('0x79')](_0x779d('0x7a'))[_0x779d('0x7b')]('team_has_chat_queues','tq')['join'](_0x779d('0x7c'),'ut',_0x779d('0x7d'))['where'](_0x779d('0x7e'),_0x24bfd6['params']['id']);for(var _0x3a4e27=0x0;_0x3a4e27<_0x185c98['length'];_0x3a4e27+=0x1){let _0x3dfb63=_0x185c98[_0x3a4e27];for(var _0x55c2f1=0x0;_0x55c2f1<_0x3dfb63[_0x779d('0x70')][_0x779d('0x54')];_0x55c2f1+=0x1){let _0x264669=_0x3dfb63[_0x779d('0x70')][_0x55c2f1];var _0x52ba76=_0x123a84['clone']();_0x52ba76[_0x779d('0x48')](_0x779d('0x7f'),_0x264669['id']);_0x115d1a[_0x779d('0x80')](db[_0x779d('0x81')][_0x779d('0x3f')](_0x52ba76['toString'](),{'type':db[_0x779d('0x81')][_0x779d('0x82')][_0x779d('0x83')]})['then'](function(_0x35d201){if(_0x35d201[_0x779d('0x54')]===0x1){return _0x264669['id'];}else{var _0x214e7a=_[_0x779d('0x84')](_['map'](_0x35d201,_0x779d('0x85')),function(_0x117835){return _[_0x779d('0x86')](_0x2e7fc1,_0x117835);});if(_0x214e7a){return _0x264669['id'];}}}));}}return BPromise[_0x779d('0x87')](_0x115d1a)['then'](function(_0x77f3f){_0x5f105a=_(_0x5f105a)[_0x779d('0x88')](_0x77f3f)[_0x779d('0x89')]()[_0x779d('0x8a')]();return db['ChatQueue'][_0x779d('0x55')]({'where':{'id':_0x24bfd6['params']['id']}})[_0x779d('0x1c')](function(_0x380ad2){return db[_0x779d('0x81')][_0x779d('0x73')](function(_0x19b645){return _0x380ad2[_0x779d('0x78')](_0x24bfd6[_0x779d('0x3f')]['ids'],{'transaction':_0x19b645})['then'](function(){if(!_['isEmpty'](_0x5f105a)){return _0x380ad2[_0x779d('0x8b')](_0x5f105a,{'transaction':_0x19b645});}})[_0x779d('0x1c')](function(){_0x5f105a['forEach'](function(_0x4e2fab){socket['emit'](_0x779d('0x8c'),{'UserId':_0x4e2fab,'ChatQueueId':_0x380ad2['id']});});});});});});})[_0x779d('0x1c')](respondWithStatusCode(_0x206dd8,null))[_0x779d('0x27')](handleError(_0x206dd8,null));};exports[_0x779d('0x8d')]=function(_0x271cfb,_0x2aca7e,_0x15fb1d){return db[_0x779d('0x39')][_0x779d('0x55')]({'where':{'id':_0x271cfb[_0x779d('0x5d')]['id']}})[_0x779d('0x1c')](handleEntityNotFound(_0x2aca7e,null))[_0x779d('0x1c')](function(_0x519a62){if(_0x519a62){return _0x519a62['addAgents'](_0x271cfb[_0x779d('0x57')][_0x779d('0x6f')],_['omit'](_0x271cfb[_0x779d('0x57')],['ids','id'])||{})[_0x779d('0x8e')](function(_0x243db1){for(var _0x3fb08b=0x0;_0x3fb08b<_0x271cfb[_0x779d('0x57')][_0x779d('0x6f')][_0x779d('0x54')];_0x3fb08b+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x271cfb[_0x779d('0x57')][_0x779d('0x6f')][_0x3fb08b]),'ChatQueueId':Number(_0x271cfb['params']['id'])});}return _0x243db1;});}})[_0x779d('0x1c')](respondWithResult(_0x2aca7e,null))[_0x779d('0x27')](handleError(_0x2aca7e,null));};exports['removeAgents']=function(_0x437535,_0x5adba8,_0x28ee49){return db[_0x779d('0x39')]['find']({'where':{'id':_0x437535[_0x779d('0x5d')]['id']}})[_0x779d('0x1c')](handleEntityNotFound(_0x5adba8,null))[_0x779d('0x1c')](function(_0x2c60dc){if(_0x2c60dc){return _0x2c60dc[_0x779d('0x8b')](_0x437535[_0x779d('0x3f')][_0x779d('0x6f')])[_0x779d('0x1c')](function(){if(_[_0x779d('0x8f')](_0x437535[_0x779d('0x3f')]['ids'])){for(var _0x1cdacb=0x0;_0x1cdacb<_0x437535[_0x779d('0x3f')][_0x779d('0x6f')][_0x779d('0x54')];_0x1cdacb+=0x1){socket[_0x779d('0x76')](_0x779d('0x8c'),{'UserId':Number(_0x437535[_0x779d('0x3f')][_0x779d('0x6f')][_0x1cdacb]),'ChatQueueId':Number(_0x437535[_0x779d('0x5d')]['id'])});}}else{socket[_0x779d('0x76')]('userChatQueue:remove',{'UserId':Number(_0x437535[_0x779d('0x3f')][_0x779d('0x6f')]),'ChatQueueId':Number(_0x437535[_0x779d('0x5d')]['id'])});}});}})[_0x779d('0x1c')](respondWithStatusCode(_0x5adba8,null))['catch'](handleError(_0x5adba8,null));};exports['getAgents']=function(_0x27484f,_0x49948d,_0x5ccf89){var _0x2d364e={};var _0x34daf3={};var _0x5a992a;var _0x57eecc;return db[_0x779d('0x39')][_0x779d('0x60')]({'where':{'id':_0x27484f[_0x779d('0x5d')]['id']}})[_0x779d('0x1c')](handleEntityNotFound(_0x49948d,null))[_0x779d('0x1c')](function(_0xdd9b3a){if(_0xdd9b3a){_0x5a992a=_0xdd9b3a;_0x34daf3[_0x779d('0x3d')]=_['keys'](db[_0x779d('0x63')][_0x779d('0x3a')]);_0x34daf3[_0x779d('0x3f')]=_[_0x779d('0x3e')](_0x27484f[_0x779d('0x3f')]);_0x34daf3['filters']=_[_0x779d('0x42')](_0x34daf3[_0x779d('0x3d')],_0x34daf3['query']);_0x2d364e[_0x779d('0x41')]=_[_0x779d('0x42')](_0x34daf3['model'],qs[_0x779d('0x43')](_0x27484f[_0x779d('0x3f')]['fields']));_0x2d364e[_0x779d('0x41')]=_0x2d364e[_0x779d('0x41')]['length']?_0x2d364e[_0x779d('0x41')]:_0x34daf3[_0x779d('0x3d')];_0x2d364e[_0x779d('0x46')]=qs['sort'](_0x27484f[_0x779d('0x3f')][_0x779d('0x47')]);_0x2d364e[_0x779d('0x48')]=qs[_0x779d('0x40')](_[_0x779d('0x49')](_0x27484f[_0x779d('0x3f')],_0x34daf3[_0x779d('0x40')]));if(_0x27484f['query'][_0x779d('0x4a')]){_0x2d364e['where']=_['merge'](_0x2d364e['where'],{'$or':_[_0x779d('0x38')](_0x2d364e[_0x779d('0x41')],function(_0x1d900e){var _0x3f4716={};_0x3f4716[_0x1d900e]={'$like':'%'+_0x27484f[_0x779d('0x3f')][_0x779d('0x4a')]+'%'};return _0x3f4716;})});}_0x2d364e=_['merge']({},_0x2d364e,_0x27484f['options']);return _0x5a992a[_0x779d('0x90')](_0x2d364e);}})[_0x779d('0x1c')](function(_0xeee092){if(_0xeee092){_0x57eecc=_0xeee092[_0x779d('0x54')];if(!_0x27484f[_0x779d('0x3f')][_0x779d('0x44')](_0x779d('0x45'))){_0x2d364e[_0x779d('0x2d')]=qs[_0x779d('0x2d')](_0x27484f[_0x779d('0x3f')]['limit']);_0x2d364e[_0x779d('0x2c')]=qs['offset'](_0x27484f[_0x779d('0x3f')]['offset']);}return _0x5a992a[_0x779d('0x90')](_0x2d364e);}})['then'](function(_0x21cadf){if(_0x21cadf){return _0x21cadf?{'count':_0x57eecc,'rows':_0x21cadf}:null;}})[_0x779d('0x1c')](respondWithResult(_0x49948d,null))[_0x779d('0x27')](handleError(_0x49948d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 6954446..34c3984 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 _0x08b8=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x08b8,0xf0));var _0x808b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08b8[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x808b('0x0'));var ChatQueue=require(_0x808b('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x808b('0x2')](0x0);var events={'afterCreate':_0x808b('0x3'),'afterUpdate':_0x808b('0x4'),'afterDestroy':_0x808b('0x5')};function emitEvent(_0x2443fb){return function(_0x967ada,_0x3b5024,_0x427727){ChatQueueEvents['emit'](_0x2443fb+':'+_0x967ada['id'],_0x967ada);ChatQueueEvents[_0x808b('0x6')](_0x2443fb,_0x967ada);_0x427727(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x808b('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x45d1=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5a8480,_0xfc8036){var _0x1abdd0=function(_0x2099af){while(--_0x2099af){_0x5a8480['push'](_0x5a8480['shift']());}};_0x1abdd0(++_0xfc8036);}(_0x45d1,0x1cb));var _0x145d=function(_0x5cf90e,_0x5df405){_0x5cf90e=_0x5cf90e-0x0;var _0xae958d=_0x45d1[_0x5cf90e];return _0xae958d;};'use strict';var EventEmitter=require(_0x145d('0x0'));var ChatQueue=require(_0x145d('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x145d('0x2')](0x0);var events={'afterCreate':_0x145d('0x3'),'afterUpdate':'update','afterDestroy':_0x145d('0x4')};function emitEvent(_0x55eb4e){return function(_0x3076c2,_0x327cd3,_0x407d84){ChatQueueEvents[_0x145d('0x5')](_0x55eb4e+':'+_0x3076c2['id'],_0x3076c2);ChatQueueEvents[_0x145d('0x5')](_0x55eb4e,_0x3076c2);_0x407d84(null);};}for(var e in events){if(events[_0x145d('0x6')](e)){var event=events[e];ChatQueue[_0x145d('0x7')](e,emitEvent(event));}}module[_0x145d('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 73ce417..0680134 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 _0x9e72=['chat_queues','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x9e72,0x64));var _0x29e7=function(_0x3df6d5,_0x63e781){_0x3df6d5=_0x3df6d5-0x0;var _0x1bf76f=_0x9e72[_0x3df6d5];return _0x1bf76f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x29e7('0x0'))(_0x29e7('0x1'));var moment=require(_0x29e7('0x2'));var BPromise=require(_0x29e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29e7('0x4'));var config=require(_0x29e7('0x5'));var attributes=require(_0x29e7('0x6'));module[_0x29e7('0x7')]=function(_0x326721,_0x2799fb){return _0x326721[_0x29e7('0x8')](_0x29e7('0x9'),attributes,{'tableName':_0x29e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1d5=['bluebird','path','rimraf','../../config/environment','define','ChatQueue','chat_queues','util','../../config/logger','api','moment'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xd1d5,0x96));var _0x5d1d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xd1d5[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require(_0x5d1d('0x0'));var logger=require(_0x5d1d('0x1'))(_0x5d1d('0x2'));var moment=require(_0x5d1d('0x3'));var BPromise=require(_0x5d1d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d1d('0x5'));var rimraf=require(_0x5d1d('0x6'));var config=require(_0x5d1d('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x30d5f7,_0x2bdba5){return _0x30d5f7[_0x5d1d('0x8')](_0x5d1d('0x9'),attributes,{'tableName':_0x5d1d('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 15ef40e..d3f9683 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 _0xdf79=['redis','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','include','model','map','ShowChatQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http'];(function(_0x7e97c4,_0x40f381){var _0x396c15=function(_0x2fb357){while(--_0x2fb357){_0x7e97c4['push'](_0x7e97c4['shift']());}};_0x396c15(++_0x40f381);}(_0xdf79,0xa7));var _0x9df7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdf79[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9df7('0x0'));var BPromise=require(_0x9df7('0x1'));var rs=require(_0x9df7('0x2'));var fs=require('fs');var Redis=require(_0x9df7('0x3'));var db=require(_0x9df7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9df7('0x5'));var client=jayson[_0x9df7('0x6')][_0x9df7('0x7')]({'port':0x232a});config[_0x9df7('0x8')]=_['defaults'](config[_0x9df7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9df7('0x9'))(new Redis(config['redis']));require(_0x9df7('0xa'))[_0x9df7('0xb')](socket);function respondWithRpcPromise(_0x340553,_0x4ee4aa,_0x2b457d){return new BPromise(function(_0x6d46a9,_0x2296e7){return client['request'](_0x340553,_0x2b457d)[_0x9df7('0xc')](function(_0x3c3b99){logger[_0x9df7('0xd')](_0x9df7('0xe'),_0x4ee4aa,_0x9df7('0xf'));logger[_0x9df7('0x10')](_0x9df7('0x11'),_0x4ee4aa,_0x9df7('0xf'),JSON[_0x9df7('0x12')](_0x3c3b99));if(_0x3c3b99[_0x9df7('0x13')]){if(_0x3c3b99[_0x9df7('0x13')][_0x9df7('0x14')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4ee4aa,_0x3c3b99[_0x9df7('0x13')][_0x9df7('0x15')]);return _0x2296e7(_0x3c3b99[_0x9df7('0x13')]['message']);}logger[_0x9df7('0x13')]('ChatQueue,\x20%s,\x20%s',_0x4ee4aa,_0x3c3b99['error']['message']);return _0x6d46a9(_0x3c3b99[_0x9df7('0x13')][_0x9df7('0x15')]);}else{logger[_0x9df7('0xd')](_0x9df7('0xe'),_0x4ee4aa,_0x9df7('0xf'));_0x6d46a9(_0x3c3b99[_0x9df7('0x16')][_0x9df7('0x15')]);}})[_0x9df7('0x17')](function(_0x1c9a02){logger[_0x9df7('0x13')](_0x9df7('0xe'),_0x4ee4aa,_0x1c9a02);_0x2296e7(_0x1c9a02);});});}exports[_0x9df7('0x18')]=function(_0x192a2c){var _0x4e829b=this;return new Promise(function(_0x4cf55c,_0xec1731){return db[_0x9df7('0x19')]['findAll']({'raw':_0x192a2c[_0x9df7('0x1a')]?_0x192a2c['options'][_0x9df7('0x1b')]===undefined?!![]:![]:!![],'where':_0x192a2c[_0x9df7('0x1a')]?_0x192a2c[_0x9df7('0x1a')][_0x9df7('0x1c')]||null:null,'attributes':_0x192a2c[_0x9df7('0x1a')]?_0x192a2c[_0x9df7('0x1a')][_0x9df7('0x1d')]||null:null,'limit':_0x192a2c['options']?_0x192a2c[_0x9df7('0x1a')]['limit']||null:null,'include':_0x192a2c[_0x9df7('0x1a')]?_0x192a2c[_0x9df7('0x1a')][_0x9df7('0x1e')]?_['map'](_0x192a2c[_0x9df7('0x1a')][_0x9df7('0x1e')],function(_0x374395){return{'model':db[_0x374395['model']],'as':_0x374395['as'],'attributes':_0x374395[_0x9df7('0x1d')],'include':_0x374395[_0x9df7('0x1e')]?_['map'](_0x374395[_0x9df7('0x1e')],function(_0x4cf055){return{'model':db[_0x4cf055[_0x9df7('0x1f')]],'as':_0x4cf055['as'],'attributes':_0x4cf055[_0x9df7('0x1d')],'include':_0x4cf055['include']?_[_0x9df7('0x20')](_0x4cf055[_0x9df7('0x1e')],function(_0x2c5cc8){return{'model':db[_0x2c5cc8[_0x9df7('0x1f')]],'as':_0x2c5cc8['as'],'attributes':_0x2c5cc8[_0x9df7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9df7('0xc')](function(_0x3cb6ce){logger[_0x9df7('0xd')]('GetChatQueue',_0x192a2c);logger[_0x9df7('0x10')](_0x9df7('0x18'),_0x192a2c,JSON[_0x9df7('0x12')](_0x3cb6ce));_0x4cf55c(_0x3cb6ce);})['catch'](function(_0xb678b0){logger['error']('GetChatQueue',_0xb678b0[_0x9df7('0x15')],_0x192a2c);_0xec1731(_0x4e829b[_0x9df7('0x13')](0x1f4,_0xb678b0[_0x9df7('0x15')]));});});};exports[_0x9df7('0x21')]=function(_0x35d3a3){var _0x3a8545=this;return new Promise(function(_0x579e2a,_0x450bbe){return db[_0x9df7('0x19')][_0x9df7('0x22')]({'raw':_0x35d3a3[_0x9df7('0x1a')]?_0x35d3a3[_0x9df7('0x1a')][_0x9df7('0x1b')]===undefined?!![]:![]:!![],'where':_0x35d3a3['options']?_0x35d3a3[_0x9df7('0x1a')][_0x9df7('0x1c')]||null:null,'attributes':_0x35d3a3[_0x9df7('0x1a')]?_0x35d3a3[_0x9df7('0x1a')]['attributes']||null:null,'include':_0x35d3a3[_0x9df7('0x1a')]?_0x35d3a3[_0x9df7('0x1a')][_0x9df7('0x1e')]?_[_0x9df7('0x20')](_0x35d3a3[_0x9df7('0x1a')]['include'],function(_0x59340d){return{'model':db[_0x59340d['model']],'as':_0x59340d['as'],'attributes':_0x59340d[_0x9df7('0x1d')],'include':_0x59340d[_0x9df7('0x1e')]?_[_0x9df7('0x20')](_0x59340d[_0x9df7('0x1e')],function(_0xc3b0b0){return{'model':db[_0xc3b0b0['model']],'as':_0xc3b0b0['as'],'attributes':_0xc3b0b0[_0x9df7('0x1d')],'include':_0xc3b0b0[_0x9df7('0x1e')]?_[_0x9df7('0x20')](_0xc3b0b0[_0x9df7('0x1e')],function(_0x227d7a){return{'model':db[_0x227d7a[_0x9df7('0x1f')]],'as':_0x227d7a['as'],'attributes':_0x227d7a[_0x9df7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9df7('0xc')](function(_0x20b92b){logger[_0x9df7('0xd')](_0x9df7('0x21'),_0x35d3a3);logger[_0x9df7('0x10')]('ShowChatQueue',_0x35d3a3,JSON[_0x9df7('0x12')](_0x20b92b));_0x579e2a(_0x20b92b);})[_0x9df7('0x17')](function(_0x5d95af){logger['error']('ShowChatQueue',_0x5d95af[_0x9df7('0x15')],_0x35d3a3);_0x450bbe(_0x3a8545[_0x9df7('0x13')](0x1f4,_0x5d95af[_0x9df7('0x15')]));});});}; \ No newline at end of file +var _0x3eaf=['options','raw','where','include','model','attributes','map','GetChatQueue','find','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./chatQueue.socket','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','findAll'];(function(_0x166b45,_0x55f458){var _0x2ed348=function(_0x233a9a){while(--_0x233a9a){_0x166b45['push'](_0x166b45['shift']());}};_0x2ed348(++_0x55f458);}(_0x3eaf,0x190));var _0xf3ea=function(_0x4f2ebb,_0x2843e8){_0x4f2ebb=_0x4f2ebb-0x0;var _0x31a724=_0x3eaf[_0x4f2ebb];return _0x31a724;};'use strict';var _=require(_0xf3ea('0x0'));var util=require(_0xf3ea('0x1'));var moment=require(_0xf3ea('0x2'));var BPromise=require(_0xf3ea('0x3'));var rs=require(_0xf3ea('0x4'));var fs=require('fs');var Redis=require(_0xf3ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3ea('0x6'));var logger=require(_0xf3ea('0x7'))(_0xf3ea('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3ea('0x9'));var client=jayson['client'][_0xf3ea('0xa')]({'port':0x232a});config[_0xf3ea('0xb')]=_[_0xf3ea('0xc')](config['redis'],{'host':_0xf3ea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3ea('0xb')]));require(_0xf3ea('0xe'))['register'](socket);function respondWithRpcPromise(_0x1c62d3,_0x4c98aa,_0x21a505){return new BPromise(function(_0x1f2825,_0x585092){return client['request'](_0x1c62d3,_0x21a505)[_0xf3ea('0xf')](function(_0x446f7c){logger[_0xf3ea('0x10')]('ChatQueue,\x20%s,\x20%s',_0x4c98aa,_0xf3ea('0x11'));logger[_0xf3ea('0x12')](_0xf3ea('0x13'),_0x4c98aa,'request\x20sent',JSON[_0xf3ea('0x14')](_0x446f7c));if(_0x446f7c[_0xf3ea('0x15')]){if(_0x446f7c[_0xf3ea('0x15')][_0xf3ea('0x16')]===0x1f4){logger[_0xf3ea('0x15')](_0xf3ea('0x17'),_0x4c98aa,_0x446f7c[_0xf3ea('0x15')][_0xf3ea('0x18')]);return _0x585092(_0x446f7c['error'][_0xf3ea('0x18')]);}logger['error'](_0xf3ea('0x17'),_0x4c98aa,_0x446f7c[_0xf3ea('0x15')]['message']);return _0x1f2825(_0x446f7c[_0xf3ea('0x15')][_0xf3ea('0x18')]);}else{logger[_0xf3ea('0x10')](_0xf3ea('0x17'),_0x4c98aa,'request\x20sent');_0x1f2825(_0x446f7c[_0xf3ea('0x19')][_0xf3ea('0x18')]);}})[_0xf3ea('0x1a')](function(_0x16bff3){logger[_0xf3ea('0x15')]('ChatQueue,\x20%s,\x20%s',_0x4c98aa,_0x16bff3);_0x585092(_0x16bff3);});});}exports['GetChatQueue']=function(_0x23c030){var _0x69546=this;return new Promise(function(_0x4d7f46,_0x2c7419){return db[_0xf3ea('0x1b')][_0xf3ea('0x1c')]({'raw':_0x23c030[_0xf3ea('0x1d')]?_0x23c030[_0xf3ea('0x1d')][_0xf3ea('0x1e')]===undefined?!![]:![]:!![],'where':_0x23c030[_0xf3ea('0x1d')]?_0x23c030[_0xf3ea('0x1d')][_0xf3ea('0x1f')]||null:null,'attributes':_0x23c030[_0xf3ea('0x1d')]?_0x23c030[_0xf3ea('0x1d')]['attributes']||null:null,'limit':_0x23c030[_0xf3ea('0x1d')]?_0x23c030[_0xf3ea('0x1d')]['limit']||null:null,'include':_0x23c030['options']?_0x23c030['options'][_0xf3ea('0x20')]?_['map'](_0x23c030[_0xf3ea('0x1d')][_0xf3ea('0x20')],function(_0x4ea971){return{'model':db[_0x4ea971[_0xf3ea('0x21')]],'as':_0x4ea971['as'],'attributes':_0x4ea971[_0xf3ea('0x22')],'include':_0x4ea971[_0xf3ea('0x20')]?_[_0xf3ea('0x23')](_0x4ea971[_0xf3ea('0x20')],function(_0x5b91e9){return{'model':db[_0x5b91e9['model']],'as':_0x5b91e9['as'],'attributes':_0x5b91e9['attributes'],'include':_0x5b91e9['include']?_[_0xf3ea('0x23')](_0x5b91e9[_0xf3ea('0x20')],function(_0x120232){return{'model':db[_0x120232[_0xf3ea('0x21')]],'as':_0x120232['as'],'attributes':_0x120232[_0xf3ea('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf3ea('0xf')](function(_0x3c2cdb){logger[_0xf3ea('0x10')]('GetChatQueue',_0x23c030);logger[_0xf3ea('0x12')](_0xf3ea('0x24'),_0x23c030,JSON[_0xf3ea('0x14')](_0x3c2cdb));_0x4d7f46(_0x3c2cdb);})[_0xf3ea('0x1a')](function(_0x9c5d48){logger[_0xf3ea('0x15')](_0xf3ea('0x24'),_0x9c5d48[_0xf3ea('0x18')],_0x23c030);_0x2c7419(_0x69546[_0xf3ea('0x15')](0x1f4,_0x9c5d48[_0xf3ea('0x18')]));});});};exports['ShowChatQueue']=function(_0x4a6093){var _0x18f0a8=this;return new Promise(function(_0x299ff8,_0x457629){return db[_0xf3ea('0x1b')][_0xf3ea('0x25')]({'raw':_0x4a6093[_0xf3ea('0x1d')]?_0x4a6093[_0xf3ea('0x1d')][_0xf3ea('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a6093[_0xf3ea('0x1d')]?_0x4a6093['options'][_0xf3ea('0x1f')]||null:null,'attributes':_0x4a6093[_0xf3ea('0x1d')]?_0x4a6093[_0xf3ea('0x1d')][_0xf3ea('0x22')]||null:null,'include':_0x4a6093[_0xf3ea('0x1d')]?_0x4a6093[_0xf3ea('0x1d')][_0xf3ea('0x20')]?_[_0xf3ea('0x23')](_0x4a6093[_0xf3ea('0x1d')][_0xf3ea('0x20')],function(_0x2186ba){return{'model':db[_0x2186ba[_0xf3ea('0x21')]],'as':_0x2186ba['as'],'attributes':_0x2186ba[_0xf3ea('0x22')],'include':_0x2186ba[_0xf3ea('0x20')]?_[_0xf3ea('0x23')](_0x2186ba['include'],function(_0x4b73e8){return{'model':db[_0x4b73e8[_0xf3ea('0x21')]],'as':_0x4b73e8['as'],'attributes':_0x4b73e8[_0xf3ea('0x22')],'include':_0x4b73e8[_0xf3ea('0x20')]?_['map'](_0x4b73e8[_0xf3ea('0x20')],function(_0x51589d){return{'model':db[_0x51589d[_0xf3ea('0x21')]],'as':_0x51589d['as'],'attributes':_0x51589d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf3ea('0xf')](function(_0x59fa88){logger[_0xf3ea('0x10')](_0xf3ea('0x26'),_0x4a6093);logger[_0xf3ea('0x12')](_0xf3ea('0x26'),_0x4a6093,JSON[_0xf3ea('0x14')](_0x59fa88));_0x299ff8(_0x59fa88);})[_0xf3ea('0x1a')](function(_0x44a599){logger[_0xf3ea('0x15')](_0xf3ea('0x26'),_0x44a599[_0xf3ea('0x18')],_0x4a6093);_0x457629(_0x18f0a8[_0xf3ea('0x15')](0x1f4,_0x44a599['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 4a42818..322feba 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 _0x4c4e=['length','chatQueue:','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x29d450,_0x270087){var _0xd3112d=function(_0x2d0b64){while(--_0x2d0b64){_0x29d450['push'](_0x29d450['shift']());}};_0xd3112d(++_0x270087);}(_0x4c4e,0x152));var _0xe4c4=function(_0x38a8d8,_0x41281f){_0x38a8d8=_0x38a8d8-0x0;var _0x1c2c0d=_0x4c4e[_0x38a8d8];return _0x1c2c0d;};'use strict';var ChatQueueEvents=require(_0xe4c4('0x0'));var events=['save',_0xe4c4('0x1'),_0xe4c4('0x2')];function createListener(_0xe3f2f,_0x58c8f6){return function(_0x1b6c91){_0x58c8f6[_0xe4c4('0x3')](_0xe3f2f,_0x1b6c91);};}function removeListener(_0x1a4483,_0x4cd652){return function(){ChatQueueEvents[_0xe4c4('0x4')](_0x1a4483,_0x4cd652);};}exports['register']=function(_0x177732){for(var _0x1a12a6=0x0,_0x262b64=events[_0xe4c4('0x5')];_0x1a12a6<_0x262b64;_0x1a12a6++){var _0x22085a=events[_0x1a12a6];var _0x329d29=createListener(_0xe4c4('0x6')+_0x22085a,_0x177732);ChatQueueEvents['on'](_0x22085a,_0x329d29);}}; \ No newline at end of file +var _0x0bde=['save','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xe0bd('0x0'),'remove',_0xe0bd('0x1')];function createListener(_0x3dc984,_0x1d8922){return function(_0x1e198a){_0x1d8922[_0xe0bd('0x2')](_0x3dc984,_0x1e198a);};}function removeListener(_0x5541b9,_0x34df88){return function(){ChatQueueEvents[_0xe0bd('0x3')](_0x5541b9,_0x34df88);};}exports[_0xe0bd('0x4')]=function(_0x3b712a){for(var _0x22bfd1=0x0,_0x26393f=events[_0xe0bd('0x5')];_0x22bfd1<_0x26393f;_0x22bfd1++){var _0x491dc7=events[_0x22bfd1];var _0x40b36a=createListener(_0xe0bd('0x6')+_0x491dc7,_0x3b712a);ChatQueueEvents['on'](_0x491dc7,_0x40b36a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index d31d3e6..4e30efd 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 _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(_0x39ec7e,_0x22670c){var _0xfd4b3c=function(_0x5d0796){while(--_0x5d0796){_0x39ec7e['push'](_0x39ec7e['shift']());}};_0xfd4b3c(++_0x22670c);}(_0x008c,0x188));var _0xc008=function(_0x55ffee,_0x1862c1){_0x55ffee=_0x55ffee-0x0;var _0x27992d=_0x008c[_0x55ffee];return _0x27992d;};'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 +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x5fc3[_0x5e8c32];return _0x595f7b;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 4ac0b6d..e3dd748 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 _0xa1ad=['moment','exports','STRING','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa1ad,0x98));var _0xda1a=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0xa1ad[_0x4687df];return _0x32eaef;};'use strict';var moment=require(_0xda1a('0x0'));var Sequelize=require('sequelize');module[_0xda1a('0x1')]={'uniqueid':{'type':Sequelize[_0xda1a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xda1a('0x2')]},'joinAt':{'type':Sequelize[_0xda1a('0x3')]},'leaveAt':{'type':Sequelize[_0xda1a('0x3')]},'acceptAt':{'type':Sequelize[_0xda1a('0x3')]},'exitAt':{'type':Sequelize[_0xda1a('0x3')]},'reason':{'type':Sequelize[_0xda1a('0x2')]}}; \ No newline at end of file +var _0x52be=['moment','sequelize','STRING','DATE'];(function(_0x25b4a7,_0x33e75b){var _0x2e5b69=function(_0x7d4843){while(--_0x7d4843){_0x25b4a7['push'](_0x25b4a7['shift']());}};_0x2e5b69(++_0x33e75b);}(_0x52be,0xc4));var _0xe52b=function(_0x34f8ba,_0x2bb6a8){_0x34f8ba=_0x34f8ba-0x0;var _0xa5ed05=_0x52be[_0x34f8ba];return _0xa5ed05;};'use strict';var moment=require(_0xe52b('0x0'));var Sequelize=require(_0xe52b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe52b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe52b('0x2')]},'joinAt':{'type':Sequelize[_0xe52b('0x3')]},'leaveAt':{'type':Sequelize[_0xe52b('0x3')]},'acceptAt':{'type':Sequelize[_0xe52b('0x3')]},'exitAt':{'type':Sequelize[_0xe52b('0x3')]},'reason':{'type':Sequelize[_0xe52b('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b363da3..0f7cb9d 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 _0x639a=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','error','name','send','index','map','ChatQueueReport','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','length','find','create','body','catch','destroy','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x639a,0x1e8));var _0xa639=function(_0x1dbf2e,_0x54de86){_0x1dbf2e=_0x1dbf2e-0x0;var _0x5d68b0=_0x639a[_0x1dbf2e];return _0x5d68b0;};'use strict';var emlformat=require(_0xa639('0x0'));var rimraf=require(_0xa639('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa639('0x2'));var moment=require(_0xa639('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa639('0x4'));var util=require(_0xa639('0x5'));var path=require(_0xa639('0x6'));var sox=require(_0xa639('0x7'));var csv=require('to-csv');var ejs=require(_0xa639('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa639('0x9'));var squel=require(_0xa639('0xa'));var crypto=require(_0xa639('0xb'));var jsforce=require(_0xa639('0xc'));var deskjs=require(_0xa639('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa639('0xe'));var Papa=require(_0xa639('0xf'));var Redis=require(_0xa639('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa639('0x11'));var as=require(_0xa639('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa639('0x13'))(_0xa639('0x14'));var utils=require('../../config/utils');var config=require(_0xa639('0x15'));var licenseUtil=require(_0xa639('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450aa7,_0x1a666e){_0x1a666e=_0x1a666e||0xcc;return function(_0x110488){if(_0x110488){return _0x450aa7[_0xa639('0x17')](_0x1a666e);}return _0x450aa7[_0xa639('0x18')](_0x1a666e)[_0xa639('0x19')]();};}function respondWithResult(_0x3dc4b5,_0x56fa87){_0x56fa87=_0x56fa87||0xc8;return function(_0x15605d){if(_0x15605d){return _0x3dc4b5[_0xa639('0x18')](_0x56fa87)[_0xa639('0x1a')](_0x15605d);}};}function respondWithFilteredResult(_0x28f05c,_0x19436b){return function(_0x7ec7ce){if(_0x7ec7ce){var _0x10c096=typeof _0x19436b[_0xa639('0x1b')]===_0xa639('0x1c')&&typeof _0x19436b['limit']===_0xa639('0x1c');var _0x1d4f47=_0x7ec7ce['count'];var _0x15002b=_0x10c096?0x0:_0x19436b[_0xa639('0x1b')];var _0x200a65=_0x10c096?_0x7ec7ce[_0xa639('0x1d')]:_0x19436b['offset']+_0x19436b[_0xa639('0x1e')];var _0x108005;if(_0x200a65>=_0x1d4f47){_0x200a65=_0x1d4f47;_0x108005=0xc8;}else{_0x108005=0xce;}_0x28f05c[_0xa639('0x18')](_0x108005);return _0x28f05c[_0xa639('0x1f')]('Content-Range',_0x15002b+'-'+_0x200a65+'/'+_0x1d4f47)[_0xa639('0x1a')](_0x7ec7ce);}return null;};}function patchUpdates(_0x4509df){return function(_0x32d216){try{jsonpatch[_0xa639('0x20')](_0x32d216,_0x4509df,!![]);}catch(_0x20c03d){return BPromise['reject'](_0x20c03d);}return _0x32d216[_0xa639('0x21')]();};}function saveUpdates(_0x1180f1,_0x107a5d){return function(_0x917ed4){if(_0x917ed4){return _0x917ed4['update'](_0x1180f1)[_0xa639('0x22')](function(_0x597397){return _0x597397;});}return null;};}function removeEntity(_0x40954e,_0x11299b){return function(_0x3442cd){if(_0x3442cd){return _0x3442cd['destroy']()[_0xa639('0x22')](function(){_0x40954e['status'](0xcc)[_0xa639('0x19')]();});}};}function handleEntityNotFound(_0x127fa9,_0x10ff2b){return function(_0x14a86d){if(!_0x14a86d){_0x127fa9['sendStatus'](0x194);}return _0x14a86d;};}function handleError(_0x3e4b0b,_0x176dcf){_0x176dcf=_0x176dcf||0x1f4;return function(_0x1414be){logger[_0xa639('0x23')](_0x1414be['stack']);if(_0x1414be[_0xa639('0x24')]){delete _0x1414be[_0xa639('0x24')];}_0x3e4b0b[_0xa639('0x18')](_0x176dcf)[_0xa639('0x25')](_0x1414be);};}exports[_0xa639('0x26')]=function(_0x343360,_0x4cf740){var _0x4cbf18={},_0x43c236={},_0x2cf80a={'count':0x0,'rows':[]};var _0x3a82b5=_[_0xa639('0x27')](db[_0xa639('0x28')]['rawAttributes'],function(_0x5151a1){return{'name':_0x5151a1[_0xa639('0x29')],'type':_0x5151a1['type'][_0xa639('0x2a')]};});_0x43c236['model']=_[_0xa639('0x27')](_0x3a82b5,_0xa639('0x24'));_0x43c236[_0xa639('0x2b')]=_[_0xa639('0x2c')](_0x343360[_0xa639('0x2b')]);_0x43c236[_0xa639('0x2d')]=_[_0xa639('0x2e')](_0x43c236[_0xa639('0x2f')],_0x43c236['query']);_0x4cbf18[_0xa639('0x30')]=_['intersection'](_0x43c236[_0xa639('0x2f')],qs[_0xa639('0x31')](_0x343360['query'][_0xa639('0x31')]));_0x4cbf18[_0xa639('0x30')]=_0x4cbf18['attributes']['length']?_0x4cbf18[_0xa639('0x30')]:_0x43c236[_0xa639('0x2f')];if(!_0x343360[_0xa639('0x2b')][_0xa639('0x32')](_0xa639('0x33'))){_0x4cbf18[_0xa639('0x1e')]=qs['limit'](_0x343360['query'][_0xa639('0x1e')]);_0x4cbf18[_0xa639('0x1b')]=qs['offset'](_0x343360[_0xa639('0x2b')][_0xa639('0x1b')]);}_0x4cbf18[_0xa639('0x34')]=qs[_0xa639('0x35')](_0x343360['query'][_0xa639('0x35')]);_0x4cbf18[_0xa639('0x36')]=qs[_0xa639('0x2d')](_[_0xa639('0x37')](_0x343360['query'],_0x43c236[_0xa639('0x2d')]),_0x3a82b5);if(_0x343360[_0xa639('0x2b')][_0xa639('0x38')]){_0x4cbf18[_0xa639('0x36')]=_[_0xa639('0x39')](_0x4cbf18[_0xa639('0x36')],{'$or':_[_0xa639('0x27')](_0x3a82b5,function(_0x78f94e){if(_0x78f94e[_0xa639('0x3a')]!==_0xa639('0x3b')){var _0x1256a1={};_0x1256a1[_0x78f94e[_0xa639('0x24')]]={'$like':'%'+_0x343360[_0xa639('0x2b')][_0xa639('0x38')]+'%'};return _0x1256a1;}})});}_0x4cbf18=_[_0xa639('0x39')]({},_0x4cbf18,_0x343360[_0xa639('0x3c')]);var _0x563c70={'where':_0x4cbf18[_0xa639('0x36')]};return db[_0xa639('0x28')][_0xa639('0x1d')](_0x563c70)['then'](function(_0x12dd1b){_0x2cf80a[_0xa639('0x1d')]=_0x12dd1b;if(_0x343360[_0xa639('0x2b')][_0xa639('0x3d')]){_0x4cbf18[_0xa639('0x3e')]=[{'all':!![]}];}return db[_0xa639('0x28')][_0xa639('0x3f')](_0x4cbf18);})['then'](function(_0x379143){_0x2cf80a[_0xa639('0x40')]=_0x379143;return _0x2cf80a;})[_0xa639('0x22')](respondWithFilteredResult(_0x4cf740,_0x4cbf18))['catch'](handleError(_0x4cf740,null));};exports['show']=function(_0x571963,_0x16e342){var _0x153aee={'raw':!![],'where':{'id':_0x571963['params']['id']}},_0x6c7dd7={};_0x6c7dd7['model']=_[_0xa639('0x2c')](db[_0xa639('0x28')]['rawAttributes']);_0x6c7dd7[_0xa639('0x2b')]=_['keys'](_0x571963['query']);_0x6c7dd7[_0xa639('0x2d')]=_[_0xa639('0x2e')](_0x6c7dd7['model'],_0x6c7dd7[_0xa639('0x2b')]);_0x153aee[_0xa639('0x30')]=_[_0xa639('0x2e')](_0x6c7dd7[_0xa639('0x2f')],qs[_0xa639('0x31')](_0x571963[_0xa639('0x2b')][_0xa639('0x31')]));_0x153aee[_0xa639('0x30')]=_0x153aee[_0xa639('0x30')][_0xa639('0x41')]?_0x153aee[_0xa639('0x30')]:_0x6c7dd7['model'];if(_0x571963[_0xa639('0x2b')]['includeAll']){_0x153aee[_0xa639('0x3e')]=[{'all':!![]}];}_0x153aee=_[_0xa639('0x39')]({},_0x153aee,_0x571963[_0xa639('0x3c')]);return db[_0xa639('0x28')][_0xa639('0x42')](_0x153aee)[_0xa639('0x22')](handleEntityNotFound(_0x16e342,null))[_0xa639('0x22')](respondWithResult(_0x16e342,null))['catch'](handleError(_0x16e342,null));};exports['create']=function(_0x4d0edd,_0x34dac5){return db[_0xa639('0x28')][_0xa639('0x43')](_0x4d0edd['body'],{})[_0xa639('0x22')](respondWithResult(_0x34dac5,0xc9))['catch'](handleError(_0x34dac5,null));};exports['update']=function(_0x267551,_0xb805cc){if(_0x267551[_0xa639('0x44')]['id']){delete _0x267551[_0xa639('0x44')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x267551['params']['id']}})[_0xa639('0x22')](handleEntityNotFound(_0xb805cc,null))['then'](saveUpdates(_0x267551[_0xa639('0x44')],null))[_0xa639('0x22')](respondWithResult(_0xb805cc,null))[_0xa639('0x45')](handleError(_0xb805cc,null));};exports[_0xa639('0x46')]=function(_0x303f5a,_0x381990){return db[_0xa639('0x28')][_0xa639('0x42')]({'where':{'id':_0x303f5a['params']['id']}})[_0xa639('0x22')](handleEntityNotFound(_0x381990,null))[_0xa639('0x22')](removeEntity(_0x381990,null))[_0xa639('0x45')](handleError(_0x381990,null));};exports[_0xa639('0x47')]=function(_0x3ffed1,_0x5d052f){return db[_0xa639('0x28')][_0xa639('0x47')]()['then'](respondWithResult(_0x5d052f,null))[_0xa639('0x45')](handleError(_0x5d052f,null));}; \ No newline at end of file +var _0x9e2e=['zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','filters','length','find','body','describe','eml-format','rimraf'];(function(_0xd2d531,_0x19de07){var _0x70346=function(_0x136e8b){while(--_0x136e8b){_0xd2d531['push'](_0xd2d531['shift']());}};_0x70346(++_0x19de07);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x414212,_0xce2258){_0x414212=_0x414212-0x0;var _0x97dfa2=_0x9e2e[_0x414212];return _0x97dfa2;};'use strict';var emlformat=require(_0xe9e2('0x0'));var rimraf=require(_0xe9e2('0x1'));var zipdir=require(_0xe9e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9e2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9e2('0x4'));var util=require(_0xe9e2('0x5'));var path=require(_0xe9e2('0x6'));var sox=require(_0xe9e2('0x7'));var csv=require(_0xe9e2('0x8'));var ejs=require(_0xe9e2('0x9'));var fs=require('fs');var fs_extra=require(_0xe9e2('0xa'));var _=require('lodash');var squel=require(_0xe9e2('0xb'));var crypto=require('crypto');var jsforce=require(_0xe9e2('0xc'));var deskjs=require(_0xe9e2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe9e2('0xe'));var Papa=require(_0xe9e2('0xf'));var Redis=require('ioredis');var authService=require(_0xe9e2('0x10'));var qs=require(_0xe9e2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9e2('0x12'))(_0xe9e2('0x13'));var utils=require(_0xe9e2('0x14'));var config=require(_0xe9e2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b6493,_0xc13a68){_0xc13a68=_0xc13a68||0xcc;return function(_0x116686){if(_0x116686){return _0x1b6493[_0xe9e2('0x16')](_0xc13a68);}return _0x1b6493[_0xe9e2('0x17')](_0xc13a68)[_0xe9e2('0x18')]();};}function respondWithResult(_0x41ea08,_0x1ba905){_0x1ba905=_0x1ba905||0xc8;return function(_0xc67cb1){if(_0xc67cb1){return _0x41ea08[_0xe9e2('0x17')](_0x1ba905)['json'](_0xc67cb1);}};}function respondWithFilteredResult(_0x5ae5ff,_0x117e38){return function(_0x590974){if(_0x590974){var _0x533e9e=typeof _0x117e38[_0xe9e2('0x19')]===_0xe9e2('0x1a')&&typeof _0x117e38[_0xe9e2('0x1b')]===_0xe9e2('0x1a');var _0x20da8e=_0x590974[_0xe9e2('0x1c')];var _0x5f3fc8=_0x533e9e?0x0:_0x117e38[_0xe9e2('0x19')];var _0x2094fc=_0x533e9e?_0x590974[_0xe9e2('0x1c')]:_0x117e38['offset']+_0x117e38[_0xe9e2('0x1b')];var _0x2e7fd0;if(_0x2094fc>=_0x20da8e){_0x2094fc=_0x20da8e;_0x2e7fd0=0xc8;}else{_0x2e7fd0=0xce;}_0x5ae5ff[_0xe9e2('0x17')](_0x2e7fd0);return _0x5ae5ff['set'](_0xe9e2('0x1d'),_0x5f3fc8+'-'+_0x2094fc+'/'+_0x20da8e)[_0xe9e2('0x1e')](_0x590974);}return null;};}function patchUpdates(_0x6d8193){return function(_0x5057f6){try{jsonpatch[_0xe9e2('0x1f')](_0x5057f6,_0x6d8193,!![]);}catch(_0x36c8a3){return BPromise[_0xe9e2('0x20')](_0x36c8a3);}return _0x5057f6[_0xe9e2('0x21')]();};}function saveUpdates(_0x5bb286,_0x183680){return function(_0x1655fe){if(_0x1655fe){return _0x1655fe[_0xe9e2('0x22')](_0x5bb286)[_0xe9e2('0x23')](function(_0x38fb40){return _0x38fb40;});}return null;};}function removeEntity(_0x518328,_0x26ce3d){return function(_0x26239c){if(_0x26239c){return _0x26239c[_0xe9e2('0x24')]()[_0xe9e2('0x23')](function(){_0x518328[_0xe9e2('0x17')](0xcc)[_0xe9e2('0x18')]();});}};}function handleEntityNotFound(_0x2a3d69,_0x274468){return function(_0x313b09){if(!_0x313b09){_0x2a3d69[_0xe9e2('0x16')](0x194);}return _0x313b09;};}function handleError(_0x2fac3e,_0x4d4343){_0x4d4343=_0x4d4343||0x1f4;return function(_0x43445d){logger[_0xe9e2('0x25')](_0x43445d[_0xe9e2('0x26')]);if(_0x43445d[_0xe9e2('0x27')]){delete _0x43445d['name'];}_0x2fac3e[_0xe9e2('0x17')](_0x4d4343)[_0xe9e2('0x28')](_0x43445d);};}exports[_0xe9e2('0x29')]=function(_0x39c4a9,_0x257a3a){var _0x4fc1ce={},_0x4cf43f={},_0x39df15={'count':0x0,'rows':[]};var _0x242319=_[_0xe9e2('0x2a')](db[_0xe9e2('0x2b')][_0xe9e2('0x2c')],function(_0x42b8ca){return{'name':_0x42b8ca[_0xe9e2('0x2d')],'type':_0x42b8ca[_0xe9e2('0x2e')][_0xe9e2('0x2f')]};});_0x4cf43f[_0xe9e2('0x30')]=_[_0xe9e2('0x2a')](_0x242319,_0xe9e2('0x27'));_0x4cf43f[_0xe9e2('0x31')]=_[_0xe9e2('0x32')](_0x39c4a9['query']);_0x4cf43f['filters']=_[_0xe9e2('0x33')](_0x4cf43f[_0xe9e2('0x30')],_0x4cf43f['query']);_0x4fc1ce[_0xe9e2('0x34')]=_[_0xe9e2('0x33')](_0x4cf43f[_0xe9e2('0x30')],qs['fields'](_0x39c4a9[_0xe9e2('0x31')][_0xe9e2('0x35')]));_0x4fc1ce[_0xe9e2('0x34')]=_0x4fc1ce[_0xe9e2('0x34')]['length']?_0x4fc1ce[_0xe9e2('0x34')]:_0x4cf43f[_0xe9e2('0x30')];if(!_0x39c4a9[_0xe9e2('0x31')]['hasOwnProperty']('nolimit')){_0x4fc1ce[_0xe9e2('0x1b')]=qs[_0xe9e2('0x1b')](_0x39c4a9[_0xe9e2('0x31')][_0xe9e2('0x1b')]);_0x4fc1ce[_0xe9e2('0x19')]=qs[_0xe9e2('0x19')](_0x39c4a9[_0xe9e2('0x31')]['offset']);}_0x4fc1ce['order']=qs[_0xe9e2('0x36')](_0x39c4a9['query'][_0xe9e2('0x36')]);_0x4fc1ce[_0xe9e2('0x37')]=qs['filters'](_[_0xe9e2('0x38')](_0x39c4a9[_0xe9e2('0x31')],_0x4cf43f['filters']),_0x242319);if(_0x39c4a9[_0xe9e2('0x31')][_0xe9e2('0x39')]){_0x4fc1ce['where']=_['merge'](_0x4fc1ce[_0xe9e2('0x37')],{'$or':_[_0xe9e2('0x2a')](_0x242319,function(_0x24ed93){if(_0x24ed93['type']!==_0xe9e2('0x3a')){var _0x4f9970={};_0x4f9970[_0x24ed93[_0xe9e2('0x27')]]={'$like':'%'+_0x39c4a9[_0xe9e2('0x31')][_0xe9e2('0x39')]+'%'};return _0x4f9970;}})});}_0x4fc1ce=_[_0xe9e2('0x3b')]({},_0x4fc1ce,_0x39c4a9[_0xe9e2('0x3c')]);var _0x1c687d={'where':_0x4fc1ce[_0xe9e2('0x37')]};return db[_0xe9e2('0x2b')]['count'](_0x1c687d)['then'](function(_0x269068){_0x39df15[_0xe9e2('0x1c')]=_0x269068;if(_0x39c4a9[_0xe9e2('0x31')][_0xe9e2('0x3d')]){_0x4fc1ce[_0xe9e2('0x3e')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xe9e2('0x3f')](_0x4fc1ce);})['then'](function(_0x1fe966){_0x39df15['rows']=_0x1fe966;return _0x39df15;})[_0xe9e2('0x23')](respondWithFilteredResult(_0x257a3a,_0x4fc1ce))[_0xe9e2('0x40')](handleError(_0x257a3a,null));};exports[_0xe9e2('0x41')]=function(_0x5275bb,_0x33e750){var _0x40d34b={'raw':!![],'where':{'id':_0x5275bb[_0xe9e2('0x42')]['id']}},_0x22092e={};_0x22092e[_0xe9e2('0x30')]=_[_0xe9e2('0x32')](db['ChatQueueReport']['rawAttributes']);_0x22092e[_0xe9e2('0x31')]=_[_0xe9e2('0x32')](_0x5275bb[_0xe9e2('0x31')]);_0x22092e[_0xe9e2('0x43')]=_[_0xe9e2('0x33')](_0x22092e[_0xe9e2('0x30')],_0x22092e['query']);_0x40d34b[_0xe9e2('0x34')]=_['intersection'](_0x22092e['model'],qs[_0xe9e2('0x35')](_0x5275bb[_0xe9e2('0x31')]['fields']));_0x40d34b['attributes']=_0x40d34b[_0xe9e2('0x34')][_0xe9e2('0x44')]?_0x40d34b['attributes']:_0x22092e['model'];if(_0x5275bb[_0xe9e2('0x31')][_0xe9e2('0x3d')]){_0x40d34b[_0xe9e2('0x3e')]=[{'all':!![]}];}_0x40d34b=_[_0xe9e2('0x3b')]({},_0x40d34b,_0x5275bb[_0xe9e2('0x3c')]);return db['ChatQueueReport'][_0xe9e2('0x45')](_0x40d34b)[_0xe9e2('0x23')](handleEntityNotFound(_0x33e750,null))[_0xe9e2('0x23')](respondWithResult(_0x33e750,null))[_0xe9e2('0x40')](handleError(_0x33e750,null));};exports['create']=function(_0x1ab0ee,_0x176c73){return db['ChatQueueReport']['create'](_0x1ab0ee[_0xe9e2('0x46')],{})[_0xe9e2('0x23')](respondWithResult(_0x176c73,0xc9))[_0xe9e2('0x40')](handleError(_0x176c73,null));};exports[_0xe9e2('0x22')]=function(_0x1be3ba,_0x502381){if(_0x1be3ba[_0xe9e2('0x46')]['id']){delete _0x1be3ba[_0xe9e2('0x46')]['id'];}return db[_0xe9e2('0x2b')][_0xe9e2('0x45')]({'where':{'id':_0x1be3ba[_0xe9e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x502381,null))['then'](saveUpdates(_0x1be3ba[_0xe9e2('0x46')],null))[_0xe9e2('0x23')](respondWithResult(_0x502381,null))[_0xe9e2('0x40')](handleError(_0x502381,null));};exports['destroy']=function(_0x1ca157,_0x209af0){return db[_0xe9e2('0x2b')]['find']({'where':{'id':_0x1ca157[_0xe9e2('0x42')]['id']}})[_0xe9e2('0x23')](handleEntityNotFound(_0x209af0,null))[_0xe9e2('0x23')](removeEntity(_0x209af0,null))[_0xe9e2('0x40')](handleError(_0x209af0,null));};exports['describe']=function(_0x25e832,_0x3732e7){return db[_0xe9e2('0x2b')][_0xe9e2('0x47')]()[_0xe9e2('0x23')](respondWithResult(_0x3732e7,null))[_0xe9e2('0x40')](handleError(_0x3732e7,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5f03991..b1914c0 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'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(_0x14c5cc,_0xbebb70){var _0x33096f=function(_0x73aea6){while(--_0x73aea6){_0x14c5cc['push'](_0x14c5cc['shift']());}};_0x33096f(++_0xbebb70);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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 b3999c2..67a8fd4 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 _0xd635=['UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw'];(function(_0x42b4d8,_0xe7dd1b){var _0x43d78f=function(_0x3055e2){while(--_0x3055e2){_0x42b4d8['push'](_0x42b4d8['shift']());}};_0x43d78f(++_0xe7dd1b);}(_0xd635,0x18b));var _0x5d63=function(_0x9791c4,_0x283c9f){_0x9791c4=_0x9791c4-0x0;var _0x36d7c9=_0xd635[_0x9791c4];return _0x36d7c9;};'use strict';var _=require(_0x5d63('0x0'));var util=require(_0x5d63('0x1'));var moment=require(_0x5d63('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d63('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d63('0x4'))['db'];var utils=require(_0x5d63('0x5'));var logger=require(_0x5d63('0x6'))('rpc');var config=require(_0x5d63('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d63('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1798ed,_0x3230e9,_0x47aa32){return new BPromise(function(_0x6ca8c8,_0x5c1059){return client['request'](_0x1798ed,_0x47aa32)[_0x5d63('0x9')](function(_0x1dba06){logger[_0x5d63('0xa')](_0x5d63('0xb'),_0x3230e9,'request\x20sent');logger[_0x5d63('0xc')](_0x5d63('0xd'),_0x3230e9,'request\x20sent',JSON[_0x5d63('0xe')](_0x1dba06));if(_0x1dba06['error']){if(_0x1dba06[_0x5d63('0xf')][_0x5d63('0x10')]===0x1f4){logger['error'](_0x5d63('0xb'),_0x3230e9,_0x1dba06[_0x5d63('0xf')][_0x5d63('0x11')]);return _0x5c1059(_0x1dba06[_0x5d63('0xf')]['message']);}logger[_0x5d63('0xf')](_0x5d63('0xb'),_0x3230e9,_0x1dba06[_0x5d63('0xf')][_0x5d63('0x11')]);return _0x6ca8c8(_0x1dba06['error']['message']);}else{logger[_0x5d63('0xa')](_0x5d63('0xb'),_0x3230e9,'request\x20sent');_0x6ca8c8(_0x1dba06[_0x5d63('0x12')][_0x5d63('0x11')]);}})[_0x5d63('0x13')](function(_0x1987ba){logger['error'](_0x5d63('0xb'),_0x3230e9,_0x1987ba);_0x5c1059(_0x1987ba);});});}exports[_0x5d63('0x14')]=function(_0x3af47a){var _0xca1d18=this;return new Promise(function(_0x20f0f6,_0x51915e){return db[_0x5d63('0x15')][_0x5d63('0x16')](_0x3af47a['body'],{'raw':_0x3af47a[_0x5d63('0x17')]?_0x3af47a['options'][_0x5d63('0x18')]===undefined?!![]:![]:!![]})[_0x5d63('0x9')](function(_0x8777c9){logger[_0x5d63('0xa')](_0x5d63('0x14'),_0x3af47a);logger[_0x5d63('0xc')]('CreateChatQueueReport',_0x3af47a,JSON[_0x5d63('0xe')](_0x8777c9));_0x20f0f6(_0x8777c9);})['catch'](function(_0x510986){logger[_0x5d63('0xf')](_0x5d63('0x14'),_0x510986[_0x5d63('0x11')],_0x3af47a);_0x51915e(_0xca1d18[_0x5d63('0xf')](0x1f4,_0x510986['message']));});});};exports[_0x5d63('0x19')]=function(_0x3477e6){var _0x44c7e0=this;return new Promise(function(_0x454356,_0x1d3e7b){return db[_0x5d63('0x15')][_0x5d63('0x1a')](_0x3477e6['body'],{'raw':_0x3477e6[_0x5d63('0x17')]?_0x3477e6['options'][_0x5d63('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3477e6[_0x5d63('0x17')]?_0x3477e6[_0x5d63('0x17')][_0x5d63('0x1b')]||null:null,'attributes':_0x3477e6[_0x5d63('0x17')]?_0x3477e6[_0x5d63('0x17')][_0x5d63('0x1c')]||null:null,'limit':_0x3477e6[_0x5d63('0x17')]?_0x3477e6[_0x5d63('0x17')][_0x5d63('0x1d')]||null:null})['then'](function(_0x3c8909){logger[_0x5d63('0xa')](_0x5d63('0x19'),_0x3477e6);logger[_0x5d63('0xc')](_0x5d63('0x19'),_0x3477e6,JSON['stringify'](_0x3c8909));_0x454356(_0x3c8909);})[_0x5d63('0x13')](function(_0x1f5355){logger[_0x5d63('0xf')]('UpdateChatQueueReport',_0x1f5355[_0x5d63('0x11')],_0x3477e6);_0x1d3e7b(_0x44c7e0['error'](0x1f4,_0x1f5355[_0x5d63('0x11')]));});});}; \ No newline at end of file +var _0x4d41=['message','CreateChatQueueReport','create','body','options','update','raw','where','attributes','UpdateChatQueueReport','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x4e0f38,_0x221eda){var _0x2a42b4=function(_0x5ab9d2){while(--_0x5ab9d2){_0x4e0f38['push'](_0x4e0f38['shift']());}};_0x2a42b4(++_0x221eda);}(_0x4d41,0x1a0));var _0x14d4=function(_0x493503,_0x351993){_0x493503=_0x493503-0x0;var _0x1986d0=_0x4d41[_0x493503];return _0x1986d0;};'use strict';var _=require(_0x14d4('0x0'));var util=require('util');var moment=require(_0x14d4('0x1'));var BPromise=require('bluebird');var rs=require(_0x14d4('0x2'));var fs=require('fs');var Redis=require(_0x14d4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x14d4('0x4'));var logger=require(_0x14d4('0x5'))('rpc');var config=require(_0x14d4('0x6'));var jayson=require(_0x14d4('0x7'));var client=jayson[_0x14d4('0x8')][_0x14d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3880ad,_0x10db52,_0x5afc24){return new BPromise(function(_0x211701,_0x1d345d){return client[_0x14d4('0xa')](_0x3880ad,_0x5afc24)[_0x14d4('0xb')](function(_0x57c107){logger[_0x14d4('0xc')](_0x14d4('0xd'),_0x10db52,'request\x20sent');logger[_0x14d4('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x10db52,_0x14d4('0xf'),JSON[_0x14d4('0x10')](_0x57c107));if(_0x57c107[_0x14d4('0x11')]){if(_0x57c107['error'][_0x14d4('0x12')]===0x1f4){logger[_0x14d4('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x10db52,_0x57c107['error'][_0x14d4('0x13')]);return _0x1d345d(_0x57c107[_0x14d4('0x11')][_0x14d4('0x13')]);}logger['error'](_0x14d4('0xd'),_0x10db52,_0x57c107[_0x14d4('0x11')][_0x14d4('0x13')]);return _0x211701(_0x57c107[_0x14d4('0x11')]['message']);}else{logger[_0x14d4('0xc')](_0x14d4('0xd'),_0x10db52,_0x14d4('0xf'));_0x211701(_0x57c107['result'][_0x14d4('0x13')]);}})['catch'](function(_0x21072b){logger[_0x14d4('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x10db52,_0x21072b);_0x1d345d(_0x21072b);});});}exports[_0x14d4('0x14')]=function(_0x4be7ed){var _0x3adaa1=this;return new Promise(function(_0x4544bb,_0x4b4be4){return db['ChatQueueReport'][_0x14d4('0x15')](_0x4be7ed[_0x14d4('0x16')],{'raw':_0x4be7ed['options']?_0x4be7ed[_0x14d4('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x14d4('0xb')](function(_0x6535e8){logger['info'](_0x14d4('0x14'),_0x4be7ed);logger['debug'](_0x14d4('0x14'),_0x4be7ed,JSON[_0x14d4('0x10')](_0x6535e8));_0x4544bb(_0x6535e8);})['catch'](function(_0x157c1d){logger[_0x14d4('0x11')](_0x14d4('0x14'),_0x157c1d[_0x14d4('0x13')],_0x4be7ed);_0x4b4be4(_0x3adaa1['error'](0x1f4,_0x157c1d[_0x14d4('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x598773){var _0x2f0c0c=this;return new Promise(function(_0xd3d24e,_0x543c58){return db['ChatQueueReport'][_0x14d4('0x18')](_0x598773[_0x14d4('0x16')],{'raw':_0x598773[_0x14d4('0x17')]?_0x598773[_0x14d4('0x17')][_0x14d4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x598773['options']?_0x598773[_0x14d4('0x17')][_0x14d4('0x1a')]||null:null,'attributes':_0x598773[_0x14d4('0x17')]?_0x598773['options'][_0x14d4('0x1b')]||null:null,'limit':_0x598773[_0x14d4('0x17')]?_0x598773[_0x14d4('0x17')]['limit']||null:null})['then'](function(_0x37ebca){logger[_0x14d4('0xc')](_0x14d4('0x1c'),_0x598773);logger[_0x14d4('0xe')]('UpdateChatQueueReport',_0x598773,JSON[_0x14d4('0x10')](_0x37ebca));_0xd3d24e(_0x37ebca);})['catch'](function(_0x5a84a0){logger['error']('UpdateChatQueueReport',_0x5a84a0[_0x14d4('0x13')],_0x598773);_0x543c58(_0x2f0c0c[_0x14d4('0x11')](0x1f4,_0x5a84a0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 22cff49..6220ece 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 _0x967a=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4c7ee1,_0xdd33ba){var _0x3576fb=function(_0xc96c4b){while(--_0xc96c4b){_0x4c7ee1['push'](_0x4c7ee1['shift']());}};_0x3576fb(++_0xdd33ba);}(_0x967a,0x78));var _0xa967=function(_0x2173d2,_0x35fe97){_0x2173d2=_0x2173d2-0x0;var _0x41612d=_0x967a[_0x2173d2];return _0x41612d;};'use strict';var multer=require(_0xa967('0x0'));var util=require(_0xa967('0x1'));var path=require('path');var timeout=require(_0xa967('0x2'));var express=require(_0xa967('0x3'));var router=express['Router']();var fs_extra=require(_0xa967('0x4'));var auth=require(_0xa967('0x5'));var interaction=require(_0xa967('0x6'));var config=require(_0xa967('0x7'));var controller=require(_0xa967('0x8'));router[_0xa967('0x9')]('/',auth[_0xa967('0xa')](),controller[_0xa967('0xb')]);router['get'](_0xa967('0xc'),auth[_0xa967('0xa')](),controller[_0xa967('0xd')]);router[_0xa967('0x9')](_0xa967('0xe'),auth['isAuthenticated'](),controller[_0xa967('0xf')]);router[_0xa967('0x10')]('/',auth[_0xa967('0xa')](),controller[_0xa967('0x11')]);router[_0xa967('0x12')](_0xa967('0xe'),auth['isAuthenticated'](),controller[_0xa967('0x13')]);router['delete'](_0xa967('0xe'),auth[_0xa967('0xa')](),controller['destroy']);module[_0xa967('0x14')]=router; \ No newline at end of file +var _0x125b=['get','isAuthenticated','index','/describe','describe','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller'];(function(_0x4ba0ba,_0x399518){var _0x2a5dcf=function(_0x303226){while(--_0x303226){_0x4ba0ba['push'](_0x4ba0ba['shift']());}};_0x2a5dcf(++_0x399518);}(_0x125b,0x91));var _0xb125=function(_0x39f097,_0x17116b){_0x39f097=_0x39f097-0x0;var _0x544f6a=_0x125b[_0x39f097];return _0x544f6a;};'use strict';var multer=require(_0xb125('0x0'));var util=require(_0xb125('0x1'));var path=require('path');var timeout=require(_0xb125('0x2'));var express=require('express');var router=express[_0xb125('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb125('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb125('0x5'));var controller=require(_0xb125('0x6'));router[_0xb125('0x7')]('/',auth[_0xb125('0x8')](),controller[_0xb125('0x9')]);router['get'](_0xb125('0xa'),auth[_0xb125('0x8')](),controller[_0xb125('0xb')]);router[_0xb125('0x7')]('/:id',auth[_0xb125('0x8')](),controller['show']);router['post']('/',auth[_0xb125('0x8')](),controller[_0xb125('0xc')]);router[_0xb125('0xd')](_0xb125('0xe'),auth[_0xb125('0x8')](),controller[_0xb125('0xf')]);router[_0xb125('0x10')](_0xb125('0xe'),auth[_0xb125('0x8')](),controller[_0xb125('0x11')]);module[_0xb125('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4cb6fa7..0d6f931 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x101237,_0x448f24){var _0x50ede4=function(_0x4d858d){while(--_0x4d858d){_0x101237['push'](_0x101237['shift']());}};_0x50ede4(++_0x448f24);}(_0x34e8,0x12c));var _0x834e=function(_0x311115,_0x32bc5c){_0x311115=_0x311115-0x0;var _0xfc06b5=_0x34e8[_0x311115];return _0xfc06b5;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0xf2662b,_0x4d8f41){var _0x257dc7=function(_0x46b1d1){while(--_0x46b1d1){_0xf2662b['push'](_0xf2662b['shift']());}};_0x257dc7(++_0x4d8f41);}(_0xb43b,0x1b2));var _0xbb43=function(_0x10f363,_0x37c87a){_0x10f363=_0x10f363-0x0;var _0x2e8b9a=_0xb43b[_0x10f363];return _0x2e8b9a;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 46a71cf..d34473a 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 _0x0533=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','destroy','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','then','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length'];(function(_0x4066c4,_0x4aff64){var _0x5febe9=function(_0xe9e693){while(--_0xe9e693){_0x4066c4['push'](_0x4066c4['shift']());}};_0x5febe9(++_0x4aff64);}(_0x0533,0x101));var _0x3053=function(_0x40ea3f,_0x15e963){_0x40ea3f=_0x40ea3f-0x0;var _0x4767d8=_0x0533[_0x40ea3f];return _0x4767d8;};'use strict';var emlformat=require(_0x3053('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3053('0x1'));var rp=require('request-promise');var moment=require(_0x3053('0x2'));var BPromise=require(_0x3053('0x3'));var Mustache=require(_0x3053('0x4'));var util=require(_0x3053('0x5'));var path=require(_0x3053('0x6'));var sox=require(_0x3053('0x7'));var csv=require('to-csv');var ejs=require(_0x3053('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3053('0x9'));var squel=require(_0x3053('0xa'));var crypto=require(_0x3053('0xb'));var jsforce=require(_0x3053('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3053('0xd'));var querystring=require(_0x3053('0xe'));var Papa=require(_0x3053('0xf'));var Redis=require(_0x3053('0x10'));var authService=require(_0x3053('0x11'));var qs=require(_0x3053('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3053('0x13'));var logger=require('../../config/logger')(_0x3053('0x14'));var utils=require(_0x3053('0x15'));var config=require(_0x3053('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3053('0x17'))['db'];function respondWithStatusCode(_0x75c340,_0x33fefd){_0x33fefd=_0x33fefd||0xcc;return function(_0x27aea0){if(_0x27aea0){return _0x75c340[_0x3053('0x18')](_0x33fefd);}return _0x75c340[_0x3053('0x19')](_0x33fefd)[_0x3053('0x1a')]();};}function respondWithResult(_0x35c8fc,_0x5678ad){_0x5678ad=_0x5678ad||0xc8;return function(_0x586a96){if(_0x586a96){return _0x35c8fc[_0x3053('0x19')](_0x5678ad)['json'](_0x586a96);}};}function respondWithFilteredResult(_0x255b34,_0x3a2df7){return function(_0x19c0ef){if(_0x19c0ef){var _0x3e1708=typeof _0x3a2df7[_0x3053('0x1b')]==='undefined'&&typeof _0x3a2df7['limit']===_0x3053('0x1c');var _0x23b9b7=_0x19c0ef[_0x3053('0x1d')];var _0x1491ec=_0x3e1708?0x0:_0x3a2df7[_0x3053('0x1b')];var _0x151ea3=_0x3e1708?_0x19c0ef[_0x3053('0x1d')]:_0x3a2df7['offset']+_0x3a2df7[_0x3053('0x1e')];var _0x3fdcd4;if(_0x151ea3>=_0x23b9b7){_0x151ea3=_0x23b9b7;_0x3fdcd4=0xc8;}else{_0x3fdcd4=0xce;}_0x255b34[_0x3053('0x19')](_0x3fdcd4);return _0x255b34[_0x3053('0x1f')](_0x3053('0x20'),_0x1491ec+'-'+_0x151ea3+'/'+_0x23b9b7)[_0x3053('0x21')](_0x19c0ef);}return null;};}function patchUpdates(_0x226400){return function(_0x1446fe){try{jsonpatch['apply'](_0x1446fe,_0x226400,!![]);}catch(_0x5937ca){return BPromise['reject'](_0x5937ca);}return _0x1446fe[_0x3053('0x22')]();};}function saveUpdates(_0x187177,_0x4b0abc){return function(_0x33dc67){if(_0x33dc67){return _0x33dc67[_0x3053('0x23')](_0x187177)[_0x3053('0x24')](function(_0x264054){return _0x264054;});}return null;};}function removeEntity(_0x2d7c6a,_0x365323){return function(_0x22a112){if(_0x22a112){return _0x22a112['destroy']()[_0x3053('0x24')](function(){_0x2d7c6a['status'](0xcc)[_0x3053('0x1a')]();});}};}function handleEntityNotFound(_0x2761c7,_0x7fc2d4){return function(_0x36e90d){if(!_0x36e90d){_0x2761c7[_0x3053('0x18')](0x194);}return _0x36e90d;};}function handleError(_0x31abfa,_0xaa317){_0xaa317=_0xaa317||0x1f4;return function(_0x32cf86){logger[_0x3053('0x25')](_0x32cf86[_0x3053('0x26')]);if(_0x32cf86['name']){delete _0x32cf86[_0x3053('0x27')];}_0x31abfa[_0x3053('0x19')](_0xaa317)[_0x3053('0x28')](_0x32cf86);};}exports[_0x3053('0x29')]=function(_0xa85194,_0x356661){var _0x5295db={},_0x547734={},_0x3d5ca8={'count':0x0,'rows':[]};var _0xbfe044=_[_0x3053('0x2a')](db[_0x3053('0x2b')]['rawAttributes'],function(_0x40b39a){return{'name':_0x40b39a[_0x3053('0x2c')],'type':_0x40b39a[_0x3053('0x2d')][_0x3053('0x2e')]};});_0x547734['model']=_['map'](_0xbfe044,_0x3053('0x27'));_0x547734[_0x3053('0x2f')]=_[_0x3053('0x30')](_0xa85194[_0x3053('0x2f')]);_0x547734[_0x3053('0x31')]=_[_0x3053('0x32')](_0x547734['model'],_0x547734[_0x3053('0x2f')]);_0x5295db[_0x3053('0x33')]=_[_0x3053('0x32')](_0x547734[_0x3053('0x34')],qs[_0x3053('0x35')](_0xa85194[_0x3053('0x2f')][_0x3053('0x35')]));_0x5295db[_0x3053('0x33')]=_0x5295db[_0x3053('0x33')][_0x3053('0x36')]?_0x5295db[_0x3053('0x33')]:_0x547734['model'];if(!_0xa85194[_0x3053('0x2f')][_0x3053('0x37')](_0x3053('0x38'))){_0x5295db[_0x3053('0x1e')]=qs[_0x3053('0x1e')](_0xa85194[_0x3053('0x2f')][_0x3053('0x1e')]);_0x5295db[_0x3053('0x1b')]=qs[_0x3053('0x1b')](_0xa85194['query']['offset']);}_0x5295db[_0x3053('0x39')]=qs[_0x3053('0x3a')](_0xa85194[_0x3053('0x2f')]['sort']);_0x5295db[_0x3053('0x3b')]=qs['filters'](_[_0x3053('0x3c')](_0xa85194[_0x3053('0x2f')],_0x547734[_0x3053('0x31')]),_0xbfe044);if(_0xa85194[_0x3053('0x2f')][_0x3053('0x3d')]){_0x5295db[_0x3053('0x3b')]=_[_0x3053('0x3e')](_0x5295db[_0x3053('0x3b')],{'$or':_[_0x3053('0x2a')](_0xbfe044,function(_0x585338){if(_0x585338['type']!==_0x3053('0x3f')){var _0x385c6d={};_0x385c6d[_0x585338[_0x3053('0x27')]]={'$like':'%'+_0xa85194[_0x3053('0x2f')][_0x3053('0x3d')]+'%'};return _0x385c6d;}})});}_0x5295db=_[_0x3053('0x3e')]({},_0x5295db,_0xa85194['options']);var _0xe85719={'where':_0x5295db[_0x3053('0x3b')]};return db[_0x3053('0x2b')]['count'](_0xe85719)[_0x3053('0x24')](function(_0x19dfd5){_0x3d5ca8[_0x3053('0x1d')]=_0x19dfd5;if(_0xa85194['query'][_0x3053('0x40')]){_0x5295db[_0x3053('0x41')]=[{'all':!![]}];}return db[_0x3053('0x2b')][_0x3053('0x42')](_0x5295db);})[_0x3053('0x24')](function(_0x432b16){_0x3d5ca8[_0x3053('0x43')]=_0x432b16;return _0x3d5ca8;})[_0x3053('0x24')](respondWithFilteredResult(_0x356661,_0x5295db))[_0x3053('0x44')](handleError(_0x356661,null));};exports[_0x3053('0x45')]=function(_0x35859b,_0x592dcd){var _0x6f048f={'raw':!![],'where':{'id':_0x35859b[_0x3053('0x46')]['id']}},_0xb59338={};_0xb59338[_0x3053('0x34')]=_[_0x3053('0x30')](db['ChatTransferReport'][_0x3053('0x47')]);_0xb59338[_0x3053('0x2f')]=_['keys'](_0x35859b[_0x3053('0x2f')]);_0xb59338['filters']=_[_0x3053('0x32')](_0xb59338[_0x3053('0x34')],_0xb59338[_0x3053('0x2f')]);_0x6f048f[_0x3053('0x33')]=_[_0x3053('0x32')](_0xb59338[_0x3053('0x34')],qs[_0x3053('0x35')](_0x35859b[_0x3053('0x2f')][_0x3053('0x35')]));_0x6f048f[_0x3053('0x33')]=_0x6f048f[_0x3053('0x33')][_0x3053('0x36')]?_0x6f048f['attributes']:_0xb59338[_0x3053('0x34')];if(_0x35859b[_0x3053('0x2f')][_0x3053('0x40')]){_0x6f048f[_0x3053('0x41')]=[{'all':!![]}];}_0x6f048f=_[_0x3053('0x3e')]({},_0x6f048f,_0x35859b[_0x3053('0x48')]);return db[_0x3053('0x2b')][_0x3053('0x49')](_0x6f048f)[_0x3053('0x24')](handleEntityNotFound(_0x592dcd,null))[_0x3053('0x24')](respondWithResult(_0x592dcd,null))[_0x3053('0x44')](handleError(_0x592dcd,null));};exports['create']=function(_0x89e99,_0x12ea4c){return db[_0x3053('0x2b')][_0x3053('0x4a')](_0x89e99[_0x3053('0x4b')],{})[_0x3053('0x24')](respondWithResult(_0x12ea4c,0xc9))['catch'](handleError(_0x12ea4c,null));};exports[_0x3053('0x23')]=function(_0x5a82c4,_0x29f8af){if(_0x5a82c4[_0x3053('0x4b')]['id']){delete _0x5a82c4[_0x3053('0x4b')]['id'];}return db[_0x3053('0x2b')]['find']({'where':{'id':_0x5a82c4[_0x3053('0x46')]['id']}})[_0x3053('0x24')](handleEntityNotFound(_0x29f8af,null))['then'](saveUpdates(_0x5a82c4[_0x3053('0x4b')],null))['then'](respondWithResult(_0x29f8af,null))['catch'](handleError(_0x29f8af,null));};exports[_0x3053('0x4c')]=function(_0x3d5361,_0x72389d){return db['ChatTransferReport'][_0x3053('0x49')]({'where':{'id':_0x3d5361['params']['id']}})[_0x3053('0x24')](handleEntityNotFound(_0x72389d,null))['then'](removeEntity(_0x72389d,null))['catch'](handleError(_0x72389d,null));};exports[_0x3053('0x4d')]=function(_0x4b61c2,_0x442b69){return db[_0x3053('0x2b')]['describe']()['then'](respondWithResult(_0x442b69,null))[_0x3053('0x44')](handleError(_0x442b69,null));}; \ No newline at end of file +var _0x0904=['includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0x0904,0x182));var _0x4090=function(_0x1e0a4a,_0x55752e){_0x1e0a4a=_0x1e0a4a-0x0;var _0x352afd=_0x0904[_0x1e0a4a];return _0x352afd;};'use strict';var emlformat=require(_0x4090('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4090('0x1'));var jsonpatch=require(_0x4090('0x2'));var rp=require(_0x4090('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4090('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x4090('0x5'));var ejs=require(_0x4090('0x6'));var fs=require('fs');var fs_extra=require(_0x4090('0x7'));var _=require('lodash');var squel=require(_0x4090('0x8'));var crypto=require(_0x4090('0x9'));var jsforce=require(_0x4090('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4090('0xb'));var Papa=require(_0x4090('0xc'));var Redis=require(_0x4090('0xd'));var authService=require(_0x4090('0xe'));var qs=require(_0x4090('0xf'));var as=require(_0x4090('0x10'));var hardwareService=require(_0x4090('0x11'));var logger=require(_0x4090('0x12'))(_0x4090('0x13'));var utils=require(_0x4090('0x14'));var config=require(_0x4090('0x15'));var licenseUtil=require(_0x4090('0x16'));var db=require(_0x4090('0x17'))['db'];function respondWithStatusCode(_0x82d5e4,_0x2d04a7){_0x2d04a7=_0x2d04a7||0xcc;return function(_0x44b07d){if(_0x44b07d){return _0x82d5e4[_0x4090('0x18')](_0x2d04a7);}return _0x82d5e4[_0x4090('0x19')](_0x2d04a7)[_0x4090('0x1a')]();};}function respondWithResult(_0x2382e5,_0x1b3b8d){_0x1b3b8d=_0x1b3b8d||0xc8;return function(_0x9852ad){if(_0x9852ad){return _0x2382e5[_0x4090('0x19')](_0x1b3b8d)[_0x4090('0x1b')](_0x9852ad);}};}function respondWithFilteredResult(_0x4485fc,_0x3164c2){return function(_0x50a0c4){if(_0x50a0c4){var _0x413626=typeof _0x3164c2[_0x4090('0x1c')]===_0x4090('0x1d')&&typeof _0x3164c2[_0x4090('0x1e')]===_0x4090('0x1d');var _0x4c06ed=_0x50a0c4['count'];var _0x4588ea=_0x413626?0x0:_0x3164c2[_0x4090('0x1c')];var _0x51f940=_0x413626?_0x50a0c4[_0x4090('0x1f')]:_0x3164c2[_0x4090('0x1c')]+_0x3164c2[_0x4090('0x1e')];var _0x17bbf7;if(_0x51f940>=_0x4c06ed){_0x51f940=_0x4c06ed;_0x17bbf7=0xc8;}else{_0x17bbf7=0xce;}_0x4485fc['status'](_0x17bbf7);return _0x4485fc[_0x4090('0x20')](_0x4090('0x21'),_0x4588ea+'-'+_0x51f940+'/'+_0x4c06ed)[_0x4090('0x1b')](_0x50a0c4);}return null;};}function patchUpdates(_0x348b2c){return function(_0x523fc2){try{jsonpatch['apply'](_0x523fc2,_0x348b2c,!![]);}catch(_0xa7654d){return BPromise[_0x4090('0x22')](_0xa7654d);}return _0x523fc2['save']();};}function saveUpdates(_0x4b06ca,_0x1dfe29){return function(_0x22ee53){if(_0x22ee53){return _0x22ee53[_0x4090('0x23')](_0x4b06ca)[_0x4090('0x24')](function(_0x13e1ce){return _0x13e1ce;});}return null;};}function removeEntity(_0x31b7c4,_0x20c6e7){return function(_0x21764f){if(_0x21764f){return _0x21764f[_0x4090('0x25')]()[_0x4090('0x24')](function(){_0x31b7c4[_0x4090('0x19')](0xcc)[_0x4090('0x1a')]();});}};}function handleEntityNotFound(_0x5c4550,_0x87e904){return function(_0xe5f7e6){if(!_0xe5f7e6){_0x5c4550[_0x4090('0x18')](0x194);}return _0xe5f7e6;};}function handleError(_0x4f5d57,_0x34e4fd){_0x34e4fd=_0x34e4fd||0x1f4;return function(_0x2ea073){logger['error'](_0x2ea073[_0x4090('0x26')]);if(_0x2ea073[_0x4090('0x27')]){delete _0x2ea073[_0x4090('0x27')];}_0x4f5d57[_0x4090('0x19')](_0x34e4fd)[_0x4090('0x28')](_0x2ea073);};}exports[_0x4090('0x29')]=function(_0x6c1861,_0x2fa9fc){var _0x5a6706={},_0x2817d2={},_0x594781={'count':0x0,'rows':[]};var _0x27e637=_['map'](db[_0x4090('0x2a')][_0x4090('0x2b')],function(_0x51be4e){return{'name':_0x51be4e[_0x4090('0x2c')],'type':_0x51be4e[_0x4090('0x2d')][_0x4090('0x2e')]};});_0x2817d2['model']=_[_0x4090('0x2f')](_0x27e637,_0x4090('0x27'));_0x2817d2[_0x4090('0x30')]=_[_0x4090('0x31')](_0x6c1861[_0x4090('0x30')]);_0x2817d2[_0x4090('0x32')]=_[_0x4090('0x33')](_0x2817d2[_0x4090('0x34')],_0x2817d2[_0x4090('0x30')]);_0x5a6706[_0x4090('0x35')]=_[_0x4090('0x33')](_0x2817d2[_0x4090('0x34')],qs[_0x4090('0x36')](_0x6c1861[_0x4090('0x30')]['fields']));_0x5a6706[_0x4090('0x35')]=_0x5a6706[_0x4090('0x35')]['length']?_0x5a6706['attributes']:_0x2817d2[_0x4090('0x34')];if(!_0x6c1861['query'][_0x4090('0x37')](_0x4090('0x38'))){_0x5a6706[_0x4090('0x1e')]=qs[_0x4090('0x1e')](_0x6c1861['query']['limit']);_0x5a6706['offset']=qs[_0x4090('0x1c')](_0x6c1861[_0x4090('0x30')][_0x4090('0x1c')]);}_0x5a6706[_0x4090('0x39')]=qs['sort'](_0x6c1861[_0x4090('0x30')][_0x4090('0x3a')]);_0x5a6706[_0x4090('0x3b')]=qs['filters'](_['pick'](_0x6c1861['query'],_0x2817d2['filters']),_0x27e637);if(_0x6c1861['query'][_0x4090('0x3c')]){_0x5a6706[_0x4090('0x3b')]=_[_0x4090('0x3d')](_0x5a6706[_0x4090('0x3b')],{'$or':_[_0x4090('0x2f')](_0x27e637,function(_0x5c234a){if(_0x5c234a[_0x4090('0x2d')]!==_0x4090('0x3e')){var _0x724d4d={};_0x724d4d[_0x5c234a[_0x4090('0x27')]]={'$like':'%'+_0x6c1861['query']['filter']+'%'};return _0x724d4d;}})});}_0x5a6706=_[_0x4090('0x3d')]({},_0x5a6706,_0x6c1861[_0x4090('0x3f')]);var _0x23ee77={'where':_0x5a6706['where']};return db[_0x4090('0x2a')][_0x4090('0x1f')](_0x23ee77)[_0x4090('0x24')](function(_0x588fe2){_0x594781[_0x4090('0x1f')]=_0x588fe2;if(_0x6c1861[_0x4090('0x30')][_0x4090('0x40')]){_0x5a6706[_0x4090('0x41')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x4090('0x42')](_0x5a6706);})[_0x4090('0x24')](function(_0x5d9773){_0x594781[_0x4090('0x43')]=_0x5d9773;return _0x594781;})[_0x4090('0x24')](respondWithFilteredResult(_0x2fa9fc,_0x5a6706))['catch'](handleError(_0x2fa9fc,null));};exports[_0x4090('0x44')]=function(_0x1ae243,_0x17f388){var _0x4332fc={'raw':!![],'where':{'id':_0x1ae243['params']['id']}},_0x486f7e={};_0x486f7e[_0x4090('0x34')]=_['keys'](db[_0x4090('0x2a')]['rawAttributes']);_0x486f7e[_0x4090('0x30')]=_[_0x4090('0x31')](_0x1ae243[_0x4090('0x30')]);_0x486f7e[_0x4090('0x32')]=_[_0x4090('0x33')](_0x486f7e['model'],_0x486f7e['query']);_0x4332fc[_0x4090('0x35')]=_['intersection'](_0x486f7e[_0x4090('0x34')],qs[_0x4090('0x36')](_0x1ae243[_0x4090('0x30')][_0x4090('0x36')]));_0x4332fc[_0x4090('0x35')]=_0x4332fc[_0x4090('0x35')]['length']?_0x4332fc[_0x4090('0x35')]:_0x486f7e[_0x4090('0x34')];if(_0x1ae243[_0x4090('0x30')][_0x4090('0x40')]){_0x4332fc[_0x4090('0x41')]=[{'all':!![]}];}_0x4332fc=_['merge']({},_0x4332fc,_0x1ae243['options']);return db[_0x4090('0x2a')][_0x4090('0x45')](_0x4332fc)[_0x4090('0x24')](handleEntityNotFound(_0x17f388,null))[_0x4090('0x24')](respondWithResult(_0x17f388,null))[_0x4090('0x46')](handleError(_0x17f388,null));};exports['create']=function(_0x3ebca1,_0x5312ca){return db['ChatTransferReport'][_0x4090('0x47')](_0x3ebca1['body'],{})[_0x4090('0x24')](respondWithResult(_0x5312ca,0xc9))[_0x4090('0x46')](handleError(_0x5312ca,null));};exports[_0x4090('0x23')]=function(_0x517a01,_0x1c7168){if(_0x517a01[_0x4090('0x48')]['id']){delete _0x517a01[_0x4090('0x48')]['id'];}return db[_0x4090('0x2a')][_0x4090('0x45')]({'where':{'id':_0x517a01['params']['id']}})[_0x4090('0x24')](handleEntityNotFound(_0x1c7168,null))[_0x4090('0x24')](saveUpdates(_0x517a01[_0x4090('0x48')],null))['then'](respondWithResult(_0x1c7168,null))[_0x4090('0x46')](handleError(_0x1c7168,null));};exports[_0x4090('0x25')]=function(_0x315db5,_0x4399c9){return db[_0x4090('0x2a')][_0x4090('0x45')]({'where':{'id':_0x315db5[_0x4090('0x49')]['id']}})[_0x4090('0x24')](handleEntityNotFound(_0x4399c9,null))[_0x4090('0x24')](removeEntity(_0x4399c9,null))[_0x4090('0x46')](handleError(_0x4399c9,null));};exports['describe']=function(_0xc47278,_0x39f03d){return db[_0x4090('0x2a')][_0x4090('0x4a')]()[_0x4090('0x24')](respondWithResult(_0x39f03d,null))['catch'](handleError(_0x39f03d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 699508a..0e493c1 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 _0x1837=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1837,0x17c));var _0x7183=function(_0x2f4e37,_0x149092){_0x2f4e37=_0x2f4e37-0x0;var _0x16e00c=_0x1837[_0x2f4e37];return _0x16e00c;};'use strict';var _=require(_0x7183('0x0'));var util=require(_0x7183('0x1'));var logger=require(_0x7183('0x2'))(_0x7183('0x3'));var moment=require(_0x7183('0x4'));var BPromise=require('bluebird');var rp=require(_0x7183('0x5'));var fs=require('fs');var path=require(_0x7183('0x6'));var rimraf=require(_0x7183('0x7'));var config=require(_0x7183('0x8'));var attributes=require(_0x7183('0x9'));module['exports']=function(_0x378f62,_0x47e1c2){return _0x378f62[_0x7183('0xa')](_0x7183('0xb'),attributes,{'tableName':_0x7183('0xc'),'paranoid':![],'indexes':[{'name':_0x7183('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x82db=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x10f6b0,_0x48c9b8){var _0x61feee=function(_0x67196a){while(--_0x67196a){_0x10f6b0['push'](_0x10f6b0['shift']());}};_0x61feee(++_0x48c9b8);}(_0x82db,0xee));var _0xb82d=function(_0x31185a,_0xd5eddd){_0x31185a=_0x31185a-0x0;var _0x7458fb=_0x82db[_0x31185a];return _0x7458fb;};'use strict';var _=require(_0xb82d('0x0'));var util=require(_0xb82d('0x1'));var logger=require(_0xb82d('0x2'))(_0xb82d('0x3'));var moment=require(_0xb82d('0x4'));var BPromise=require(_0xb82d('0x5'));var rp=require(_0xb82d('0x6'));var fs=require('fs');var path=require(_0xb82d('0x7'));var rimraf=require(_0xb82d('0x8'));var config=require(_0xb82d('0x9'));var attributes=require(_0xb82d('0xa'));module[_0xb82d('0xb')]=function(_0x4af15b,_0x2b2d0e){return _0x4af15b[_0xb82d('0xc')](_0xb82d('0xd'),attributes,{'tableName':_0xb82d('0xe'),'paranoid':![],'indexes':[{'name':_0xb82d('0xf'),'fields':[_0xb82d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d6c8a01..713cb5c 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 _0xad00=['code','ChatTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xad00,0x1bc));var _0x0ad0=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0xad00[_0x39e164];return _0x13fa6b;};'use strict';var _=require(_0x0ad0('0x0'));var util=require(_0x0ad0('0x1'));var moment=require('moment');var BPromise=require(_0x0ad0('0x2'));var rs=require(_0x0ad0('0x3'));var fs=require('fs');var Redis=require(_0x0ad0('0x4'));var db=require(_0x0ad0('0x5'))['db'];var utils=require(_0x0ad0('0x6'));var logger=require(_0x0ad0('0x7'))('rpc');var config=require(_0x0ad0('0x8'));var jayson=require(_0x0ad0('0x9'));var client=jayson[_0x0ad0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53525a,_0x3258a7,_0x1e9ff6){return new BPromise(function(_0x3fda7a,_0x22ebf0){return client[_0x0ad0('0xb')](_0x53525a,_0x1e9ff6)['then'](function(_0x49bd82){logger[_0x0ad0('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x3258a7,_0x0ad0('0xd'));logger[_0x0ad0('0xe')](_0x0ad0('0xf'),_0x3258a7,_0x0ad0('0xd'),JSON[_0x0ad0('0x10')](_0x49bd82));if(_0x49bd82[_0x0ad0('0x11')]){if(_0x49bd82['error'][_0x0ad0('0x12')]===0x1f4){logger[_0x0ad0('0x11')](_0x0ad0('0x13'),_0x3258a7,_0x49bd82['error'][_0x0ad0('0x14')]);return _0x22ebf0(_0x49bd82['error'][_0x0ad0('0x14')]);}logger['error'](_0x0ad0('0x13'),_0x3258a7,_0x49bd82[_0x0ad0('0x11')][_0x0ad0('0x14')]);return _0x3fda7a(_0x49bd82[_0x0ad0('0x11')][_0x0ad0('0x14')]);}else{logger['info'](_0x0ad0('0x13'),_0x3258a7,_0x0ad0('0xd'));_0x3fda7a(_0x49bd82['result'][_0x0ad0('0x14')]);}})[_0x0ad0('0x15')](function(_0x4abaec){logger[_0x0ad0('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3258a7,_0x4abaec);_0x22ebf0(_0x4abaec);});});} \ No newline at end of file +var _0xc372=['error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0xbab8d5,_0x45ae45){var _0x274ce6=function(_0x16b1cc){while(--_0x16b1cc){_0xbab8d5['push'](_0xbab8d5['shift']());}};_0x274ce6(++_0x45ae45);}(_0xc372,0xdf));var _0x2c37=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc372[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2c37('0x0'));var util=require(_0x2c37('0x1'));var moment=require(_0x2c37('0x2'));var BPromise=require(_0x2c37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c37('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c37('0x5'));var logger=require(_0x2c37('0x6'))(_0x2c37('0x7'));var config=require(_0x2c37('0x8'));var jayson=require(_0x2c37('0x9'));var client=jayson[_0x2c37('0xa')][_0x2c37('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45472f,_0x9a023e,_0x43e438){return new BPromise(function(_0x318a4e,_0x354a77){return client[_0x2c37('0xc')](_0x45472f,_0x43e438)['then'](function(_0x35ffcd){logger[_0x2c37('0xd')](_0x2c37('0xe'),_0x9a023e,_0x2c37('0xf'));logger['debug'](_0x2c37('0x10'),_0x9a023e,_0x2c37('0xf'),JSON['stringify'](_0x35ffcd));if(_0x35ffcd[_0x2c37('0x11')]){if(_0x35ffcd[_0x2c37('0x11')]['code']===0x1f4){logger[_0x2c37('0x11')](_0x2c37('0xe'),_0x9a023e,_0x35ffcd[_0x2c37('0x11')][_0x2c37('0x12')]);return _0x354a77(_0x35ffcd[_0x2c37('0x11')]['message']);}logger[_0x2c37('0x11')](_0x2c37('0xe'),_0x9a023e,_0x35ffcd['error']['message']);return _0x318a4e(_0x35ffcd[_0x2c37('0x11')][_0x2c37('0x12')]);}else{logger['info'](_0x2c37('0xe'),_0x9a023e,_0x2c37('0xf'));_0x318a4e(_0x35ffcd['result']['message']);}})[_0x2c37('0x13')](function(_0x1f4d9c){logger['error'](_0x2c37('0xe'),_0x9a023e,_0x1f4d9c);_0x354a77(_0x1f4d9c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 7999c35..07a48e4 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 _0x2d40=['describe','/:id','show','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x4b09b2,_0x31fafe){var _0x3156b1=function(_0x186744){while(--_0x186744){_0x4b09b2['push'](_0x4b09b2['shift']());}};_0x3156b1(++_0x31fafe);}(_0x2d40,0x15d));var _0x02d4=function(_0x47c330,_0x10c4aa){_0x47c330=_0x47c330-0x0;var _0x1b53eb=_0x2d40[_0x47c330];return _0x1b53eb;};'use strict';var multer=require('multer');var util=require(_0x02d4('0x0'));var path=require('path');var timeout=require(_0x02d4('0x1'));var express=require(_0x02d4('0x2'));var router=express[_0x02d4('0x3')]();var fs_extra=require(_0x02d4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x02d4('0x5'));var controller=require(_0x02d4('0x6'));router[_0x02d4('0x7')]('/',auth[_0x02d4('0x8')](),controller[_0x02d4('0x9')]);router[_0x02d4('0x7')](_0x02d4('0xa'),auth[_0x02d4('0x8')](),controller[_0x02d4('0xb')]);router[_0x02d4('0x7')](_0x02d4('0xc'),auth[_0x02d4('0x8')](),controller[_0x02d4('0xd')]);router['post']('/',auth[_0x02d4('0x8')](),controller['create']);router[_0x02d4('0xe')](_0x02d4('0xc'),auth[_0x02d4('0x8')](),controller[_0x02d4('0xf')]);router[_0x02d4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x02d4('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9d57=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x55097b,_0x14beb7){var _0x5b90ae=function(_0x58d82d){while(--_0x58d82d){_0x55097b['push'](_0x55097b['shift']());}};_0x5b90ae(++_0x14beb7);}(_0x9d57,0x158));var _0x79d5=function(_0x4de566,_0x504ac0){_0x4de566=_0x4de566-0x0;var _0x47837b=_0x9d57[_0x4de566];return _0x47837b;};'use strict';var multer=require(_0x79d5('0x0'));var util=require('util');var path=require(_0x79d5('0x1'));var timeout=require(_0x79d5('0x2'));var express=require(_0x79d5('0x3'));var router=express[_0x79d5('0x4')]();var fs_extra=require(_0x79d5('0x5'));var auth=require(_0x79d5('0x6'));var interaction=require(_0x79d5('0x7'));var config=require(_0x79d5('0x8'));var controller=require(_0x79d5('0x9'));router[_0x79d5('0xa')]('/',auth[_0x79d5('0xb')](),controller[_0x79d5('0xc')]);router['get'](_0x79d5('0xd'),auth[_0x79d5('0xb')](),controller[_0x79d5('0xe')]);router[_0x79d5('0xa')](_0x79d5('0xf'),auth[_0x79d5('0xb')](),controller[_0x79d5('0x10')]);router[_0x79d5('0x11')]('/',auth[_0x79d5('0xb')](),controller[_0x79d5('0x12')]);router['put'](_0x79d5('0xf'),auth['isAuthenticated'](),controller[_0x79d5('0x13')]);router[_0x79d5('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x79d5('0x15')]);module[_0x79d5('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 13d2b5b..25c955d 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 _0x5685=['textarea','Comments','offlineForm','generate','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.','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','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','address','STRING','email','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x5685,0xaf));var _0x5568=function(_0x5e8874,_0x134292){_0x5e8874=_0x5e8874-0x0;var _0x4bf1de=_0x5685[_0x5e8874];return _0x4bf1de;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5568('0x0'));module[_0x5568('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5568('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x5568('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x4')},'key':{'type':Sequelize[_0x5568('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5568('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x5568('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5568('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5568('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5568('0x3')],'allowNull':![],'defaultValue':_0x5568('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5568('0x3')]},'animation':{'type':Sequelize[_0x5568('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5568('0x8')](_0x5568('0x9'),'squared'),'defaultValue':_0x5568('0x9')},'header_online':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x5568('0xb')},'offline_chat_button':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0xc')},'header_offline':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0xd')},'download_transcript':{'type':Sequelize[_0x5568('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5568('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x5568('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5568('0x10')]},'closingQuestion':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5568('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x12')},'noteTitle':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5568('0x14')},'closingMessageButton':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0xc')},'skipMessageButton':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x15')},'conditionAgreement':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x16')},'ratingType':{'type':Sequelize[_0x5568('0x8')](_0x5568('0x17'),_0x5568('0x18')),'defaultValue':_0x5568('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x5568('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5568('0x10')],'defaultValue':function(){return JSON[_0x5568('0x19')]({'items':[{'type':_0x5568('0x1a'),'variable':null,'config':{'placeholder':_0x5568('0x1b'),'type':_0x5568('0x1c'),'required':!![]},'props':{'title':_0x5568('0x1b'),'helpText':''}},{'type':_0x5568('0x1a'),'props':{'title':_0x5568('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x5568('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5568('0x1d')](_0x5568('0x1e'))?JSON[_0x5568('0x1f')](this['getDataValue'](_0x5568('0x1e'))):{};},'set':function(_0x214623){return this[_0x5568('0x20')](_0x5568('0x1e'),JSON[_0x5568('0x19')](_0x214623));}},'offlineForm':{'type':Sequelize[_0x5568('0x10')],'defaultValue':function(){return JSON[_0x5568('0x19')]({'items':[{'type':_0x5568('0x1a'),'props':{'title':_0x5568('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x5568('0x4'),'type':_0x5568('0x4')},'variable':null},{'type':_0x5568('0x21'),'config':{'placeholder':_0x5568('0x22')},'props':{'title':_0x5568('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x5568('0x1d')](_0x5568('0x23'))?JSON['parse'](this['getDataValue']('offlineForm')):{};},'set':function(_0x19c500){return this[_0x5568('0x20')](_0x5568('0x23'),JSON[_0x5568('0x19')](_0x19c500));}},'token':{'type':Sequelize[_0x5568('0x3')],'defaultValue':function(){return rs[_0x5568('0x24')]();}},'autoclose':{'type':Sequelize[_0x5568('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5568('0x3')]},'forwardOffline':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5568('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5568('0x25')},'waitingMessage':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x5568('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x5568('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x28')},'skipUnmanaged':{'type':Sequelize[_0x5568('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5568('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5568('0x29');}},'notificationSound':{'type':Sequelize[_0x5568('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5568('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5568('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x5568('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x2b')},'defaultTitle':{'type':Sequelize[_0x5568('0x3')]},'customerAvatar':{'type':Sequelize[_0x5568('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5568('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5568('0x3')],'allowNull':![],'defaultValue':_0x5568('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5568('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5568('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5568('0x3')],'defaultValue':_0x5568('0x2d')},'systemAvatar':{'type':Sequelize[_0x5568('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x5568('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![],'comment':_0x5568('0x2f'),'set':function(_0x1ee11e){if(!_0x1ee11e)this[_0x5568('0x20')](_0x5568('0x30'),null);this[_0x5568('0x20')](_0x5568('0x31'),_0x1ee11e);}},'vidaooEscalation':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5568('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5568('0x32')},'vidaooNote':{'type':Sequelize[_0x5568('0x3')],'defaultValue':function(){return _0x5568('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x5568('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5568('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5568('0x10')]}}; \ No newline at end of file +var _0x3ea4=['offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','#011F6A','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','star','thumb','input','name','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','Leave\x20your\x20comments'];(function(_0x1a2974,_0xfba559){var _0x31f214=function(_0x1c2d58){while(--_0x1c2d58){_0x1a2974['push'](_0x1a2974['shift']());}};_0x31f214(++_0xfba559);}(_0x3ea4,0xcc));var _0x43ea=function(_0x59ee91,_0x5ca1ef){_0x59ee91=_0x59ee91-0x0;var _0x51b0b7=_0x3ea4[_0x59ee91];return _0x51b0b7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x43ea('0x0'));module[_0x43ea('0x1')]={'name':{'type':Sequelize[_0x43ea('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x43ea('0x2')],'allowNull':![],'unique':_0x43ea('0x3')},'description':{'type':Sequelize[_0x43ea('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x43ea('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x43ea('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x43ea('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x43ea('0x2')]},'animation':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x43ea('0x7')](_0x43ea('0x8'),_0x43ea('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0xa')},'start_chat_button':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x43ea('0xc')},'header_offline':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0xd')},'download_transcript':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x43ea('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x43ea('0xf')]},'closingQuestion':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0x12')},'closingMessage':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0x13')},'ratingType':{'type':Sequelize[_0x43ea('0x7')](_0x43ea('0x14'),_0x43ea('0x15')),'defaultValue':_0x43ea('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x43ea('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x43ea('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x43ea('0x16'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x43ea('0x17'),'helpText':''}},{'type':_0x43ea('0x16'),'props':{'title':_0x43ea('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x43ea('0x4'),'type':_0x43ea('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x43ea('0x18')](_0x43ea('0x19'))?JSON[_0x43ea('0x1a')](this[_0x43ea('0x18')](_0x43ea('0x19'))):{};},'set':function(_0x1ed4af){return this[_0x43ea('0x1b')]('onlineForm',JSON[_0x43ea('0x1c')](_0x1ed4af));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x43ea('0x1c')]({'items':[{'type':_0x43ea('0x16'),'props':{'title':_0x43ea('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x43ea('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x43ea('0x1d')},'props':{'title':_0x43ea('0x1d'),'helpText':_0x43ea('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0x43ea('0x18')]('offlineForm')?JSON[_0x43ea('0x1a')](this[_0x43ea('0x18')](_0x43ea('0x1f'))):{};},'set':function(_0x1a99a1){return this[_0x43ea('0x1b')]('offlineForm',JSON['stringify'](_0x1a99a1));}},'token':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x43ea('0x2')]},'forwardOffline':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x43ea('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x43ea('0x20')},'waitingMessage':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0x21')},'offlineMessageBody':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0x22')},'enableUnmanagedNote':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0x23')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x43ea('0x24')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x43ea('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x43ea('0x25');}},'notificationSound':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':_0x43ea('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x43ea('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x43ea('0x27')},'verticalAlignment':{'type':Sequelize[_0x43ea('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x43ea('0x28')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x43ea('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x43ea('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x43ea('0x2')],'allowNull':![],'defaultValue':_0x43ea('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x43ea('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x43ea('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x43ea('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x43ea('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![],'comment':_0x43ea('0x2b'),'set':function(_0x3f0e2a){if(!_0x3f0e2a)this[_0x43ea('0x1b')](_0x43ea('0x2c'),null);this['setDataValue'](_0x43ea('0x2d'),_0x3f0e2a);}},'vidaooEscalation':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x43ea('0x2')]},'vidaooTopic':{'type':Sequelize[_0x43ea('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x43ea('0x2')],'defaultValue':function(){return _0x43ea('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0x43ea('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x43ea('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x43ea('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4266167..51355f2 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 _0x4bff=['split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','format','device','%s\x20%s\x20%s','vendor','threadId','externalUrl','ContactId','interaction','ChatInteraction','spread','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','notify','offline','files','no\x20available\x20attributes','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','offline-chat','openNewInteraction','transaction','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','stringify','x-real-ip','connection','remoteAddress','replace','render','verticalAlignment','textColor','color_button','sequelize','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','getFields','online','offlineForm','onlineForm','fromKey','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./chatWebsite.socket','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','get','ChatWebsites','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','params','intersection','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','findOne','length','order','ChatWebsiteId','Disposition','includeAll','removeDispositions','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','user-agent-parser','headers','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','orderBy','contact','customerIp','cf-connecting-ip','first','x-forwarded-for'];(function(_0x1244a0,_0x1f133e){var _0x17ea18=function(_0x34ca86){while(--_0x34ca86){_0x1244a0['push'](_0x1244a0['shift']());}};_0x17ea18(++_0x1f133e);}(_0x4bff,0x8b));var _0xf4bf=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4bff[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4bf('0x0'));var zipdir=require(_0xf4bf('0x1'));var jsonpatch=require(_0xf4bf('0x2'));var rp=require('request-promise');var moment=require(_0xf4bf('0x3'));var BPromise=require(_0xf4bf('0x4'));var Mustache=require(_0xf4bf('0x5'));var util=require(_0xf4bf('0x6'));var path=require(_0xf4bf('0x7'));var sox=require(_0xf4bf('0x8'));var csv=require('to-csv');var ejs=require(_0xf4bf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4bf('0xa'));var squel=require(_0xf4bf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf4bf('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf4bf('0xd'));var Redis=require(_0xf4bf('0xe'));var authService=require(_0xf4bf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf4bf('0x10'));var hardwareService=require(_0xf4bf('0x11'));var logger=require(_0xf4bf('0x12'))(_0xf4bf('0x13'));var utils=require(_0xf4bf('0x14'));var config=require(_0xf4bf('0x15'));var licenseUtil=require(_0xf4bf('0x16'));var db=require(_0xf4bf('0x17'))['db'];config['redis']=_[_0xf4bf('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf4bf('0x19'))(new Redis(config[_0xf4bf('0x1a')]));require(_0xf4bf('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf4bf('0x1c')][_0xf4bf('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xf4bf('0x1d')]({'port':0x232a});var client9003=jayson[_0xf4bf('0x1c')]['http']({'port':0x232b});var client9001=jayson[_0xf4bf('0x1c')][_0xf4bf('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0xa5c00,_0x3a7efa,_0x3c5ffb,_0x554e76){return new BPromise(function(_0x45f719,_0x519532){var _0x1a8b65=_0x554e76||client;return _0x1a8b65[_0xf4bf('0x1e')](_0xa5c00,_0x3c5ffb)[_0xf4bf('0x1f')](function(_0x15b0eb){logger['info'](_0xf4bf('0x20'),_0x3a7efa,_0xf4bf('0x21'));logger[_0xf4bf('0x22')](_0xf4bf('0x23'),_0x3a7efa,_0xf4bf('0x21'),JSON['stringify'](_0x15b0eb));if(_0x15b0eb[_0xf4bf('0x24')]){if(_0x15b0eb[_0xf4bf('0x24')][_0xf4bf('0x25')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3a7efa,_0x15b0eb[_0xf4bf('0x24')]['message']);return _0x519532(_0x15b0eb[_0xf4bf('0x24')][_0xf4bf('0x26')]);}logger[_0xf4bf('0x24')](_0xf4bf('0x20'),_0x3a7efa,_0x15b0eb[_0xf4bf('0x24')][_0xf4bf('0x26')]);return _0x45f719(_0x15b0eb[_0xf4bf('0x24')]['message']);}else{logger[_0xf4bf('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x3a7efa,'request\x20sent');_0x45f719(_0x15b0eb[_0xf4bf('0x28')][_0xf4bf('0x26')]);}})[_0xf4bf('0x29')](function(_0x1566de){logger[_0xf4bf('0x24')](_0xf4bf('0x20'),_0x3a7efa,_0x1566de);_0x519532(_0x1566de);});});}function respondWithStatusCode(_0x12db5b,_0x12cf6d){_0x12cf6d=_0x12cf6d||0xcc;return function(_0x2b54d0){if(_0x2b54d0){return _0x12db5b[_0xf4bf('0x2a')](_0x12cf6d);}return _0x12db5b[_0xf4bf('0x2b')](_0x12cf6d)[_0xf4bf('0x2c')]();};}function respondWithResult(_0xf9dfdc,_0x562068){_0x562068=_0x562068||0xc8;return function(_0x126491){if(_0x126491){return _0xf9dfdc[_0xf4bf('0x2b')](_0x562068)['json'](_0x126491);}};}function respondWithFilteredResult(_0x596ece,_0x2ccd5e){return function(_0x4f9f88){if(_0x4f9f88){var _0x419cf6=typeof _0x2ccd5e[_0xf4bf('0x2d')]===_0xf4bf('0x2e')&&typeof _0x2ccd5e[_0xf4bf('0x2f')]==='undefined';var _0x21ae2b=_0x4f9f88[_0xf4bf('0x30')];var _0x31c5ab=_0x419cf6?0x0:_0x2ccd5e['offset'];var _0x4d83bb=_0x419cf6?_0x4f9f88['count']:_0x2ccd5e[_0xf4bf('0x2d')]+_0x2ccd5e[_0xf4bf('0x2f')];var _0x506be8;if(_0x4d83bb>=_0x21ae2b){_0x4d83bb=_0x21ae2b;_0x506be8=0xc8;}else{_0x506be8=0xce;}_0x596ece[_0xf4bf('0x2b')](_0x506be8);return _0x596ece[_0xf4bf('0x31')]('Content-Range',_0x31c5ab+'-'+_0x4d83bb+'/'+_0x21ae2b)[_0xf4bf('0x32')](_0x4f9f88);}return null;};}function patchUpdates(_0x1e273a){return function(_0x46175b){try{jsonpatch[_0xf4bf('0x33')](_0x46175b,_0x1e273a,!![]);}catch(_0x3239b1){return BPromise[_0xf4bf('0x34')](_0x3239b1);}return _0x46175b[_0xf4bf('0x35')]();};}function saveUpdates(_0x4fdab3,_0x4e3ce8){return function(_0x16324e){if(_0x16324e){return _0x16324e[_0xf4bf('0x36')](_0x4fdab3)['then'](function(_0x55d9cf){return _0x55d9cf;});}return null;};}function removeEntity(_0x55a908,_0x1d57ad){return function(_0xa324ea){if(_0xa324ea){return _0xa324ea[_0xf4bf('0x37')]()[_0xf4bf('0x1f')](function(){var _0x4c122b=_0xa324ea[_0xf4bf('0x38')]({'plain':!![]});var _0x2bdb43=_0xf4bf('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x2bdb43,'resourceId':_0x4c122b['id']}})['then'](function(){return _0xa324ea;});})['then'](function(){_0x55a908[_0xf4bf('0x2b')](0xcc)[_0xf4bf('0x2c')]();});}};}function handleEntityNotFound(_0x350d0c,_0x40ff3f){return function(_0x2ce9ea){if(!_0x2ce9ea){_0x350d0c[_0xf4bf('0x2a')](0x194);}return _0x2ce9ea;};}function handleError(_0x2d3d53,_0x31ab82){_0x31ab82=_0x31ab82||0x1f4;return function(_0x2a5c94){logger['error'](_0x2a5c94[_0xf4bf('0x3a')]);if(_0x2a5c94[_0xf4bf('0x3b')]){delete _0x2a5c94[_0xf4bf('0x3b')];}_0x2d3d53[_0xf4bf('0x2b')](_0x31ab82)[_0xf4bf('0x3c')](_0x2a5c94);};}exports['index']=function(_0x9fc5,_0x40fffa){var _0x4cd80a={'include':[{'model':db[_0xf4bf('0x3d')],'as':_0xf4bf('0x3e')}]},_0x14adb1={},_0x2aba03={'count':0x0,'rows':[]};var _0x2bda70=_[_0xf4bf('0x3f')](db[_0xf4bf('0x40')][_0xf4bf('0x41')],function(_0x4125fc){return{'name':_0x4125fc[_0xf4bf('0x42')],'type':_0x4125fc['type'][_0xf4bf('0x43')]};});_0x14adb1[_0xf4bf('0x44')]=_[_0xf4bf('0x3f')](_0x2bda70,_0xf4bf('0x3b'));_0x14adb1[_0xf4bf('0x45')]=_[_0xf4bf('0x46')](_0x9fc5[_0xf4bf('0x45')]);_0x14adb1[_0xf4bf('0x47')]=_['intersection'](_0x14adb1[_0xf4bf('0x44')],_0x14adb1['query']);_0x4cd80a[_0xf4bf('0x48')]=_['intersection'](_0x14adb1[_0xf4bf('0x44')],qs[_0xf4bf('0x49')](_0x9fc5[_0xf4bf('0x45')][_0xf4bf('0x49')]));_0x4cd80a[_0xf4bf('0x48')]=_0x4cd80a[_0xf4bf('0x48')]['length']?_0x4cd80a[_0xf4bf('0x48')]:_0x14adb1[_0xf4bf('0x44')];if(!_0x9fc5[_0xf4bf('0x45')][_0xf4bf('0x4a')](_0xf4bf('0x4b'))){_0x4cd80a['limit']=qs[_0xf4bf('0x2f')](_0x9fc5[_0xf4bf('0x45')]['limit']);_0x4cd80a[_0xf4bf('0x2d')]=qs[_0xf4bf('0x2d')](_0x9fc5[_0xf4bf('0x45')]['offset']);}_0x4cd80a['order']=qs[_0xf4bf('0x4c')](_0x9fc5[_0xf4bf('0x45')]['sort']);_0x4cd80a[_0xf4bf('0x4d')]=qs[_0xf4bf('0x47')](_[_0xf4bf('0x4e')](_0x9fc5[_0xf4bf('0x45')],_0x14adb1[_0xf4bf('0x47')]),_0x2bda70);if(_0x9fc5[_0xf4bf('0x45')][_0xf4bf('0x4f')]){_0x4cd80a[_0xf4bf('0x4d')]=_[_0xf4bf('0x50')](_0x4cd80a[_0xf4bf('0x4d')],{'$or':_[_0xf4bf('0x3f')](_0x2bda70,function(_0x7af7f4){if(_0x7af7f4[_0xf4bf('0x51')]!=='VIRTUAL'){var _0x45b71a={};_0x45b71a[_0x7af7f4['name']]={'$like':'%'+_0x9fc5[_0xf4bf('0x45')][_0xf4bf('0x4f')]+'%'};return _0x45b71a;}})});}_0x4cd80a=_[_0xf4bf('0x50')]({},_0x4cd80a,_0x9fc5[_0xf4bf('0x52')]);var _0x43b2c2={'where':_0x4cd80a[_0xf4bf('0x4d')]};return db[_0xf4bf('0x40')][_0xf4bf('0x30')](_0x43b2c2)[_0xf4bf('0x1f')](function(_0x4433fb){_0x2aba03[_0xf4bf('0x30')]=_0x4433fb;if(_0x9fc5[_0xf4bf('0x45')]['includeAll']){_0x4cd80a[_0xf4bf('0x53')]=[{'all':!![]}];}return db[_0xf4bf('0x40')][_0xf4bf('0x54')](_0x4cd80a);})[_0xf4bf('0x1f')](function(_0x18ba1c){_0x2aba03[_0xf4bf('0x55')]=_0x18ba1c;return _0x2aba03;})[_0xf4bf('0x1f')](respondWithFilteredResult(_0x40fffa,_0x4cd80a))[_0xf4bf('0x29')](handleError(_0x40fffa,null));};exports[_0xf4bf('0x56')]=function(_0x6d2c6a,_0x138579){var _0x4dd2c8={'raw':![],'where':{'id':_0x6d2c6a[_0xf4bf('0x57')]['id']},'include':[{'model':db[_0xf4bf('0x3d')],'as':_0xf4bf('0x3e')}]},_0x103778={};_0x103778[_0xf4bf('0x44')]=_[_0xf4bf('0x46')](db[_0xf4bf('0x40')][_0xf4bf('0x41')]);_0x103778[_0xf4bf('0x45')]=_['keys'](_0x6d2c6a[_0xf4bf('0x45')]);_0x103778[_0xf4bf('0x47')]=_[_0xf4bf('0x58')](_0x103778[_0xf4bf('0x44')],_0x103778[_0xf4bf('0x45')]);_0x4dd2c8[_0xf4bf('0x48')]=_[_0xf4bf('0x58')](_0x103778[_0xf4bf('0x44')],qs[_0xf4bf('0x49')](_0x6d2c6a[_0xf4bf('0x45')][_0xf4bf('0x49')]));_0x4dd2c8[_0xf4bf('0x48')]=_0x4dd2c8[_0xf4bf('0x48')]['length']?_0x4dd2c8['attributes']:_0x103778[_0xf4bf('0x44')];if(_0x6d2c6a[_0xf4bf('0x45')]['includeAll']){_0x4dd2c8[_0xf4bf('0x53')]=[{'all':!![]}];}_0x4dd2c8=_[_0xf4bf('0x50')]({},_0x4dd2c8,_0x6d2c6a[_0xf4bf('0x52')]);return db[_0xf4bf('0x40')][_0xf4bf('0x59')](_0x4dd2c8)[_0xf4bf('0x1f')](handleEntityNotFound(_0x138579,null))[_0xf4bf('0x1f')](respondWithResult(_0x138579,null))['catch'](handleError(_0x138579,null));};exports[_0xf4bf('0x5a')]=function(_0x3ff87d,_0x4c881a){return db[_0xf4bf('0x40')][_0xf4bf('0x5a')](_0x3ff87d['body'],{})['then'](function(_0x2c19d1){var _0x141827=_0x3ff87d['user'][_0xf4bf('0x38')]({'plain':!![]});if(!_0x141827)throw new Error(_0xf4bf('0x5b'));if(_0x141827[_0xf4bf('0x5c')]===_0xf4bf('0x5d')){var _0x1ade34=_0x2c19d1['get']({'plain':!![]});var _0x29781b=_0xf4bf('0x39');return db[_0xf4bf('0x5e')][_0xf4bf('0x59')]({'where':{'name':_0x29781b,'userProfileId':_0x141827[_0xf4bf('0x5f')]},'raw':!![]})[_0xf4bf('0x1f')](function(_0xa49e1){if(_0xa49e1&&_0xa49e1[_0xf4bf('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x1ade34[_0xf4bf('0x3b')],'resourceId':_0x1ade34['id'],'type':_0xa49e1[_0xf4bf('0x3b')],'sectionId':_0xa49e1['id']},{})[_0xf4bf('0x1f')](function(){return _0x2c19d1;});}else{return _0x2c19d1;}})[_0xf4bf('0x29')](function(_0x38ca02){logger[_0xf4bf('0x24')](_0xf4bf('0x61'),_0x38ca02);throw _0x38ca02;});}return _0x2c19d1;})[_0xf4bf('0x1f')](respondWithResult(_0x4c881a,0xc9))['catch'](handleError(_0x4c881a,null));};exports['update']=function(_0x21972e,_0x55340d){if(_0x21972e[_0xf4bf('0x62')]['id']){delete _0x21972e[_0xf4bf('0x62')]['id'];}return db[_0xf4bf('0x40')][_0xf4bf('0x59')]({'where':{'id':_0x21972e[_0xf4bf('0x57')]['id']},'include':[{'model':db[_0xf4bf('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xf4bf('0x1f')](handleEntityNotFound(_0x55340d,null))[_0xf4bf('0x1f')](saveUpdates(_0x21972e[_0xf4bf('0x62')],null))[_0xf4bf('0x1f')](respondWithResult(_0x55340d,null))[_0xf4bf('0x29')](handleError(_0x55340d,null));};exports[_0xf4bf('0x37')]=function(_0x20d6d6,_0x47ab6d){return db[_0xf4bf('0x40')][_0xf4bf('0x59')]({'where':{'id':_0x20d6d6[_0xf4bf('0x57')]['id']}})['then'](handleEntityNotFound(_0x47ab6d,null))['then'](removeEntity(_0x47ab6d,null))[_0xf4bf('0x29')](handleError(_0x47ab6d,null));};exports[_0xf4bf('0x63')]=function(_0xa3930d,_0x4f2c9e){return db['ChatWebsite']['describe']()[_0xf4bf('0x1f')](respondWithResult(_0x4f2c9e,null))['catch'](handleError(_0x4f2c9e,null));};exports[_0xf4bf('0x64')]=function(_0x1ad670,_0x3abc9b,_0x30d3af){if(_0x1ad670[_0xf4bf('0x62')]['id']){delete _0x1ad670[_0xf4bf('0x62')]['id'];}return db[_0xf4bf('0x40')][_0xf4bf('0x59')]({'where':{'id':_0x1ad670[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x3abc9b,null))['then'](function(_0x4151fc){if(_0x4151fc){_0x1ad670[_0xf4bf('0x62')]['ChatWebsiteId']=_0x4151fc['id'];return db['Disposition'][_0xf4bf('0x5a')](_0x1ad670['body']);}})[_0xf4bf('0x1f')](respondWithResult(_0x3abc9b,null))[_0xf4bf('0x29')](handleError(_0x3abc9b,null));};exports['getDispositions']=function(_0x4958e9,_0x3179da,_0x4c1fd4){var _0x54bee6={'raw':![],'where':{}};var _0x1be0cd={};var _0x187060={'count':0x0,'rows':[]};return db[_0xf4bf('0x40')][_0xf4bf('0x65')]({'where':{'id':_0x4958e9[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x3179da,null))[_0xf4bf('0x1f')](function(_0x3d7ebb){if(_0x3d7ebb){_0x1be0cd['model']=_[_0xf4bf('0x46')](db['Disposition'][_0xf4bf('0x41')]);_0x1be0cd[_0xf4bf('0x45')]=_[_0xf4bf('0x46')](_0x4958e9[_0xf4bf('0x45')]);_0x1be0cd[_0xf4bf('0x47')]=_[_0xf4bf('0x58')](_0x1be0cd[_0xf4bf('0x44')],_0x1be0cd[_0xf4bf('0x45')]);_0x54bee6[_0xf4bf('0x48')]=_[_0xf4bf('0x58')](_0x1be0cd[_0xf4bf('0x44')],qs[_0xf4bf('0x49')](_0x4958e9[_0xf4bf('0x45')][_0xf4bf('0x49')]));_0x54bee6['attributes']=_0x54bee6[_0xf4bf('0x48')][_0xf4bf('0x66')]?_0x54bee6[_0xf4bf('0x48')]:_0x1be0cd[_0xf4bf('0x44')];if(!_0x4958e9[_0xf4bf('0x45')][_0xf4bf('0x4a')](_0xf4bf('0x4b'))){_0x54bee6[_0xf4bf('0x2f')]=qs['limit'](_0x4958e9[_0xf4bf('0x45')][_0xf4bf('0x2f')]);_0x54bee6[_0xf4bf('0x2d')]=qs[_0xf4bf('0x2d')](_0x4958e9[_0xf4bf('0x45')][_0xf4bf('0x2d')]);}_0x54bee6[_0xf4bf('0x67')]=qs[_0xf4bf('0x4c')](_0x4958e9[_0xf4bf('0x45')][_0xf4bf('0x4c')]);_0x54bee6[_0xf4bf('0x4d')]=qs[_0xf4bf('0x47')](_[_0xf4bf('0x4e')](_0x4958e9['query'],_0x1be0cd[_0xf4bf('0x47')]));_0x54bee6[_0xf4bf('0x4d')][_0xf4bf('0x68')]=_0x3d7ebb['id'];if(_0x4958e9[_0xf4bf('0x45')][_0xf4bf('0x4f')]){_0x54bee6[_0xf4bf('0x4d')]=_[_0xf4bf('0x50')](_0x54bee6[_0xf4bf('0x4d')],{'$or':_[_0xf4bf('0x3f')](_0x54bee6[_0xf4bf('0x48')],function(_0x28bb61){var _0x3f1b74={};_0x3f1b74[_0x28bb61]={'$like':'%'+_0x4958e9[_0xf4bf('0x45')]['filter']+'%'};return _0x3f1b74;})});}_0x54bee6=_[_0xf4bf('0x50')]({},_0x54bee6,_0x4958e9[_0xf4bf('0x52')]);return db[_0xf4bf('0x69')][_0xf4bf('0x30')]({'where':_0x54bee6[_0xf4bf('0x4d')]})[_0xf4bf('0x1f')](function(_0x532efa){_0x187060[_0xf4bf('0x30')]=_0x532efa;if(_0x4958e9[_0xf4bf('0x45')][_0xf4bf('0x6a')]){_0x54bee6[_0xf4bf('0x53')]=[{'all':!![]}];}return db[_0xf4bf('0x69')]['findAll'](_0x54bee6);})['then'](function(_0x64db35){_0x187060[_0xf4bf('0x55')]=_0x64db35;return _0x187060;});}})[_0xf4bf('0x1f')](respondWithFilteredResult(_0x3179da,_0x54bee6))[_0xf4bf('0x29')](handleError(_0x3179da,null));};exports[_0xf4bf('0x6b')]=function(_0xc717e3,_0x10a861,_0x183b85){return db['ChatWebsite']['find']({'where':{'id':_0xc717e3[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x10a861,null))[_0xf4bf('0x1f')](function(_0x1d07b0){if(_0x1d07b0){return _0x1d07b0[_0xf4bf('0x6b')](_0xc717e3['query']['ids']);}})['then'](respondWithStatusCode(_0x10a861,null))['catch'](handleError(_0x10a861,null));};exports['addAnswer']=function(_0x26b0d4,_0x151866,_0x1585a2){if(_0x26b0d4[_0xf4bf('0x62')]['id']){delete _0x26b0d4[_0xf4bf('0x62')]['id'];}return db['ChatWebsite'][_0xf4bf('0x59')]({'where':{'id':_0x26b0d4[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x151866,null))[_0xf4bf('0x1f')](function(_0x256b03){if(_0x256b03){_0x26b0d4['body'][_0xf4bf('0x68')]=_0x256b03['id'];return db[_0xf4bf('0x6c')][_0xf4bf('0x5a')](_0x26b0d4[_0xf4bf('0x62')]);}})[_0xf4bf('0x1f')](respondWithResult(_0x151866,null))[_0xf4bf('0x29')](handleError(_0x151866,null));};exports[_0xf4bf('0x6d')]=function(_0x2af39c,_0x10be6e,_0xf02a4c){var _0x2f70a9={'raw':![],'where':{}};var _0x206b78={};var _0x598ef9={'count':0x0,'rows':[]};return db[_0xf4bf('0x40')][_0xf4bf('0x65')]({'where':{'id':_0x2af39c[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x10be6e,null))[_0xf4bf('0x1f')](function(_0xa1ba65){if(_0xa1ba65){_0x206b78[_0xf4bf('0x44')]=_[_0xf4bf('0x46')](db[_0xf4bf('0x6c')]['rawAttributes']);_0x206b78[_0xf4bf('0x45')]=_[_0xf4bf('0x46')](_0x2af39c[_0xf4bf('0x45')]);_0x206b78['filters']=_[_0xf4bf('0x58')](_0x206b78[_0xf4bf('0x44')],_0x206b78[_0xf4bf('0x45')]);_0x2f70a9[_0xf4bf('0x48')]=_['intersection'](_0x206b78[_0xf4bf('0x44')],qs[_0xf4bf('0x49')](_0x2af39c[_0xf4bf('0x45')][_0xf4bf('0x49')]));_0x2f70a9[_0xf4bf('0x48')]=_0x2f70a9['attributes']['length']?_0x2f70a9['attributes']:_0x206b78[_0xf4bf('0x44')];if(!_0x2af39c['query'][_0xf4bf('0x4a')]('nolimit')){_0x2f70a9[_0xf4bf('0x2f')]=qs[_0xf4bf('0x2f')](_0x2af39c[_0xf4bf('0x45')]['limit']);_0x2f70a9[_0xf4bf('0x2d')]=qs['offset'](_0x2af39c[_0xf4bf('0x45')][_0xf4bf('0x2d')]);}_0x2f70a9[_0xf4bf('0x67')]=qs[_0xf4bf('0x4c')](_0x2af39c[_0xf4bf('0x45')]['sort']);_0x2f70a9[_0xf4bf('0x4d')]=qs[_0xf4bf('0x47')](_[_0xf4bf('0x4e')](_0x2af39c[_0xf4bf('0x45')],_0x206b78[_0xf4bf('0x47')]));_0x2f70a9['where']['ChatWebsiteId']=_0xa1ba65['id'];if(_0x2af39c['query'][_0xf4bf('0x4f')]){_0x2f70a9[_0xf4bf('0x4d')]=_[_0xf4bf('0x50')](_0x2f70a9[_0xf4bf('0x4d')],{'$or':_[_0xf4bf('0x3f')](_0x2f70a9[_0xf4bf('0x48')],function(_0x289d10){var _0x24a7b8={};_0x24a7b8[_0x289d10]={'$like':'%'+_0x2af39c[_0xf4bf('0x45')][_0xf4bf('0x4f')]+'%'};return _0x24a7b8;})});}_0x2f70a9=_['merge']({},_0x2f70a9,_0x2af39c[_0xf4bf('0x52')]);return db[_0xf4bf('0x6c')][_0xf4bf('0x30')]({'where':_0x2f70a9[_0xf4bf('0x4d')]})[_0xf4bf('0x1f')](function(_0x2793e9){_0x598ef9[_0xf4bf('0x30')]=_0x2793e9;if(_0x2af39c[_0xf4bf('0x45')][_0xf4bf('0x6a')]){_0x2f70a9[_0xf4bf('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2f70a9);})[_0xf4bf('0x1f')](function(_0x231e58){_0x598ef9['rows']=_0x231e58;return _0x598ef9;});}})[_0xf4bf('0x1f')](respondWithFilteredResult(_0x10be6e,_0x2f70a9))[_0xf4bf('0x29')](handleError(_0x10be6e,null));};exports['removeAnswers']=function(_0x33f82f,_0x472f50,_0x34f6d1){return db[_0xf4bf('0x40')][_0xf4bf('0x59')]({'where':{'id':_0x33f82f['params']['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x472f50,null))[_0xf4bf('0x1f')](function(_0x5f393b){if(_0x5f393b){return _0x5f393b[_0xf4bf('0x6e')](_0x33f82f[_0xf4bf('0x45')]['ids']);}})[_0xf4bf('0x1f')](respondWithStatusCode(_0x472f50,null))['catch'](handleError(_0x472f50,null));};exports[_0xf4bf('0x6f')]=function(_0x2f8c18,_0x1e948e,_0x39a430){_0x2f8c18['body']['sitepic']=_0x2f8c18[_0xf4bf('0x70')][_0xf4bf('0x71')];return db[_0xf4bf('0x40')][_0xf4bf('0x59')]({'where':{'id':_0x2f8c18[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x1e948e,null))[_0xf4bf('0x1f')](saveUpdates(_0x2f8c18[_0xf4bf('0x62')],null))[_0xf4bf('0x1f')](respondWithResult(_0x1e948e,null))[_0xf4bf('0x29')](handleError(_0x1e948e,null));};exports[_0xf4bf('0x72')]=function(_0x55f59d,_0x44dfa8,_0x3c276f){_0x55f59d[_0xf4bf('0x62')][_0xf4bf('0x73')]=_0x55f59d[_0xf4bf('0x70')]['filename'];return db[_0xf4bf('0x40')][_0xf4bf('0x59')]({'where':{'id':_0x55f59d[_0xf4bf('0x57')]['id']}})['then'](handleEntityNotFound(_0x44dfa8,null))[_0xf4bf('0x1f')](saveUpdates(_0x55f59d[_0xf4bf('0x62')],null))[_0xf4bf('0x1f')](respondWithResult(_0x44dfa8,null))[_0xf4bf('0x29')](handleError(_0x44dfa8,null));};exports[_0xf4bf('0x74')]=function(_0x1c5afa,_0x1b0ef7,_0x2536c6){_0x1c5afa[_0xf4bf('0x62')][_0xf4bf('0x75')]=_0x1c5afa[_0xf4bf('0x70')][_0xf4bf('0x71')];return db[_0xf4bf('0x40')][_0xf4bf('0x59')]({'where':{'id':_0x1c5afa[_0xf4bf('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b0ef7,null))[_0xf4bf('0x1f')](saveUpdates(_0x1c5afa[_0xf4bf('0x62')],null))[_0xf4bf('0x1f')](respondWithResult(_0x1b0ef7,null))[_0xf4bf('0x29')](handleError(_0x1b0ef7,null));};exports['addSystemAvatar']=function(_0x566e28,_0x38f3cf,_0x53fe7c){_0x566e28[_0xf4bf('0x62')][_0xf4bf('0x76')]=_0x566e28[_0xf4bf('0x70')][_0xf4bf('0x71')];return db['ChatWebsite'][_0xf4bf('0x59')]({'where':{'id':_0x566e28[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x38f3cf,null))[_0xf4bf('0x1f')](saveUpdates(_0x566e28[_0xf4bf('0x62')],null))[_0xf4bf('0x1f')](respondWithResult(_0x38f3cf,null))[_0xf4bf('0x29')](handleError(_0x38f3cf,null));};exports[_0xf4bf('0x77')]=function(_0x401a27,_0x1d1364,_0xada961){var _0xd26437=path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],_0xf4bf('0x7a'));var _0x14ee4e={'where':{'id':_0x401a27[_0xf4bf('0x57')]['id']},'attributes':['id',_0xf4bf('0x7b')],'raw':!![]};var _0xfc0978=![];return require('../../config/license/util')[_0xf4bf('0x7c')]()['then'](function(_0x31b6bc){if(_0x31b6bc){_0xfc0978=_0x31b6bc['custom'];}})[_0xf4bf('0x1f')](function(){return db['ChatWebsite'][_0xf4bf('0x59')](_0x14ee4e);})['then'](handleEntityNotFound(_0x1d1364,null))['then'](function(_0x23cc65){if(_0x23cc65){if(!_[_0xf4bf('0x7d')](_0x23cc65[_0xf4bf('0x7b')])){if(fs[_0xf4bf('0x7e')](path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],'server/files/images/logos/',_0x23cc65[_0xf4bf('0x7b')]))&&_0xfc0978){_0xd26437=path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],_0xf4bf('0x7f'),_0x23cc65[_0xf4bf('0x7b')]);}}return _0x1d1364[_0xf4bf('0x80')](_0xd26437);}})[_0xf4bf('0x29')](handleError(_0x1d1364,null));};exports[_0xf4bf('0x81')]=function(_0x3481cf,_0x421520,_0x5bc264){var _0x2c9a72=path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],'server/files/images/avatars/default_avatar.png');var _0x462397={'where':{'id':_0x3481cf[_0xf4bf('0x57')]['id']},'attributes':['id',_0xf4bf('0x73')],'raw':!![]};return db[_0xf4bf('0x40')]['find'](_0x462397)[_0xf4bf('0x1f')](handleEntityNotFound(_0x421520,null))['then'](function(_0x826f92){if(_0x826f92){if(!_[_0xf4bf('0x7d')](_0x826f92['agentAvatar'])){if(fs['existsSync'](path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],_0xf4bf('0x82'),_0x826f92[_0xf4bf('0x73')]))){_0x2c9a72=path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],_0xf4bf('0x82'),_0x826f92[_0xf4bf('0x73')]);}}return _0x421520['download'](_0x2c9a72);}})[_0xf4bf('0x29')](handleError(_0x421520,null));};exports[_0xf4bf('0x83')]=function(_0x1a28d4,_0x861558,_0x3d4dfa){var _0x1e0c89=path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],_0xf4bf('0x84'));var _0x21ea4d={'where':{'id':_0x1a28d4[_0xf4bf('0x57')]['id']},'attributes':['id','customerAvatar',_0xf4bf('0x85')],'raw':!![]};return db[_0xf4bf('0x40')][_0xf4bf('0x59')](_0x21ea4d)[_0xf4bf('0x1f')](handleEntityNotFound(_0x861558,null))[_0xf4bf('0x1f')](function(_0x131787){if(_0x131787){if(!_[_0xf4bf('0x7d')](_0x131787[_0xf4bf('0x75')])){if(fs[_0xf4bf('0x7e')](path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],'server/files/images/avatars/',_0x131787['customerAvatar']))&&_0x131787[_0xf4bf('0x85')]){_0x1e0c89=path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],_0xf4bf('0x82'),_0x131787['customerAvatar']);}}return _0x861558[_0xf4bf('0x80')](_0x1e0c89);}})[_0xf4bf('0x29')](handleError(_0x861558,null));};exports[_0xf4bf('0x86')]=function(_0x412963,_0x55a5ab,_0x4358e6){var _0x33afc2=path[_0xf4bf('0x78')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x2f0122={'where':{'id':_0x412963[_0xf4bf('0x57')]['id']},'attributes':['id',_0xf4bf('0x76')],'raw':!![]};return db[_0xf4bf('0x40')]['find'](_0x2f0122)[_0xf4bf('0x1f')](handleEntityNotFound(_0x55a5ab,null))[_0xf4bf('0x1f')](function(_0x527ee){if(_0x527ee){if(!_[_0xf4bf('0x7d')](_0x527ee[_0xf4bf('0x76')])){if(fs[_0xf4bf('0x7e')](path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],_0xf4bf('0x82'),_0x527ee[_0xf4bf('0x76')]))){_0x33afc2=path['join'](config[_0xf4bf('0x79')],_0xf4bf('0x82'),_0x527ee[_0xf4bf('0x76')]);}}return _0x55a5ab[_0xf4bf('0x80')](_0x33afc2);}})['catch'](handleError(_0x55a5ab,null));};exports['notify']=function(_0x4d9285,_0x1dc803,_0x562cb5){var _0x47834d=require(_0xf4bf('0x87'));var _0x3cb8c8=new _0x47834d();var _0x43107c=_0x3cb8c8['setUA'](_0x4d9285[_0xf4bf('0x88')]['user-agent'])[_0xf4bf('0x89')]();var _0x3fe5fa={'body':_0x4d9285[_0xf4bf('0x62')],'channel':_0xf4bf('0x8a')};var _0x4ee12f=[];var _0x4bef21=[];var _0x8eacbf={};var _0x114371=![];return db[_0xf4bf('0x8b')][_0xf4bf('0x63')]()['then'](function(_0x562623){if(!_0x562623){throw new db[(_0xf4bf('0x8c'))][(_0xf4bf('0x8d'))]('no\x20available\x20attributes');}_0x4ee12f=_[_0xf4bf('0x8e')](_[_0xf4bf('0x46')](_0x562623),[_0xf4bf('0x8f'),_0xf4bf('0x90')]);_0x4bef21=_[_0xf4bf('0x8e')](_['keys'](_0x562623),[_0xf4bf('0x8f'),_0xf4bf('0x90'),'CompanyId',_0xf4bf('0x91')]);if(_0x4d9285[_0xf4bf('0x62')]['id']){delete _0x4d9285[_0xf4bf('0x62')]['id'];}if(_[_0xf4bf('0x7d')](_0x4d9285[_0xf4bf('0x62')]['from'])){throw new db[(_0xf4bf('0x8c'))][(_0xf4bf('0x8d'))](_0xf4bf('0x92'));}if(_[_0xf4bf('0x7d')](_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0x62')])||_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0x62')]===''){throw new db[(_0xf4bf('0x8c'))][(_0xf4bf('0x8d'))](_0xf4bf('0x93'));}if(_[_0xf4bf('0x7d')](_0x4d9285['body'][_0xf4bf('0x94')])){throw new db['Sequelize']['ValidationError'](_0xf4bf('0x95')+_0x4bef21);}if(!_[_0xf4bf('0x96')](_0x4bef21,_0x4d9285[_0xf4bf('0x62')]['mapKey'])){throw new db[(_0xf4bf('0x8c'))][(_0xf4bf('0x8d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4bef21);}_0x8eacbf[_0x4d9285['body'][_0xf4bf('0x94')]]=_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0x97')];})[_0xf4bf('0x1f')](function(){return db[_0xf4bf('0x40')][_0xf4bf('0x59')]({'where':{'id':_0x4d9285[_0xf4bf('0x57')]['id']},'include':[{'model':db[_0xf4bf('0x98')],'as':_0xf4bf('0x99'),'include':[{'model':db['CmContact'],'as':_0xf4bf('0x9a'),'where':_0x8eacbf,'limit':0x1,'order':[[_0xf4bf('0x90'),_0xf4bf('0x9b')]]}]},{'model':db[_0xf4bf('0x9c')],'as':_0xf4bf('0x9d')}]});})[_0xf4bf('0x1f')](handleEntityNotFound(_0x1dc803,null))[_0xf4bf('0x1f')](function(_0x4e412c){if(_0x4e412c&&_0x4e412c[_0xf4bf('0x99')]){_0x3fe5fa[_0xf4bf('0x9e')]=_0x4e412c;_0x3fe5fa['applications']=_0x4e412c[_0xf4bf('0x9d')];_0x3fe5fa[_0xf4bf('0x9f')]=_0x4e412c[_0xf4bf('0x99')];_0x3fe5fa[_0xf4bf('0xa0')]=_[_0xf4bf('0xa1')](_0x3fe5fa[_0xf4bf('0xa0')],['priority'],['asc']);if(_0x3fe5fa['account'][_0xf4bf('0x9d')]){delete _0x3fe5fa['account']['Applications'];}if(_0x3fe5fa[_0xf4bf('0x9e')]['List']&&_0x3fe5fa['account'][_0xf4bf('0x99')][_0xf4bf('0x9a')][_0xf4bf('0x66')]){return _0x3fe5fa[_0xf4bf('0x9e')]['List'][_0xf4bf('0x9a')][0x0];}var _0x3ae3cc=_[_0xf4bf('0x18')](_0x4d9285['body'],{'firstName':_0x4d9285['body'][_0xf4bf('0x97')],'ListId':_0x4e412c[_0xf4bf('0x91')]});_0x3ae3cc[_0x4d9285['body'][_0xf4bf('0x94')]]=_0x4d9285['body'][_0xf4bf('0x97')];return db[_0xf4bf('0x8b')][_0xf4bf('0x5a')](_0x3ae3cc,{'fields':_0x4ee12f,'raw':!![]});}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x1dc803,null))[_0xf4bf('0x1f')](function(_0x21d670){_0x3fe5fa[_0xf4bf('0xa2')]=_0x21d670;var _0x298246=_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0xa3')];if(_0x4d9285[_0xf4bf('0x88')][_0xf4bf('0xa4')]){_0x298246=_0x4d9285[_0xf4bf('0x88')][_0xf4bf('0xa4')];}else if(_0x4d9285[_0xf4bf('0x88')]['x-forwarded-for']){_0x298246=_[_0xf4bf('0xa5')](_0x4d9285[_0xf4bf('0x88')][_0xf4bf('0xa6')][_0xf4bf('0xa7')](','));}if(_0x21d670){var _0x38763d={'ContactId':_0x21d670['id'],'ChatWebsiteId':_0x4d9285[_0xf4bf('0x57')]['id'],'from':(_0x21d670[_0xf4bf('0xa8')]||'')+'\x20'+(_0x21d670[_0xf4bf('0xa9')]||''),'customerIp':_0x298246,'customerPort':_0x4d9285[_0xf4bf('0x88')][_0xf4bf('0xaa')]?_0x4d9285[_0xf4bf('0x88')][_0xf4bf('0xaa')]:null,'referer':_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0xab')],'browserName':_0x43107c[_0xf4bf('0xac')][_0xf4bf('0x3b')]&&_0x43107c[_0xf4bf('0xac')][_0xf4bf('0xad')]?util['format'](_0xf4bf('0xae'),_0x43107c[_0xf4bf('0xac')][_0xf4bf('0x3b')],_0x43107c['browser'][_0xf4bf('0xad')]):'unknown','browserVersion':_0x43107c['browser']['version']||'unknown','osName':util[_0xf4bf('0xaf')](_0xf4bf('0xae'),_0x43107c['os'][_0xf4bf('0x3b')],_0x43107c['os'][_0xf4bf('0xad')]),'osVersion':_0x43107c['os'][_0xf4bf('0xad')],'deviceModel':_0x43107c[_0xf4bf('0xb0')]['model']&&_0x43107c[_0xf4bf('0xb0')]['vendor']?util['format'](_0xf4bf('0xb1'),_0x43107c[_0xf4bf('0xb0')][_0xf4bf('0x44')],_0x43107c[_0xf4bf('0xb0')][_0xf4bf('0xb2')],_0x43107c[_0xf4bf('0xb0')][_0xf4bf('0x51')]):null,'deviceVendor':_0x43107c[_0xf4bf('0xb0')][_0xf4bf('0xb2')],'deviceType':_0x43107c[_0xf4bf('0xb0')][_0xf4bf('0x51')],'formData':JSON['stringify'](_0x4d9285[_0xf4bf('0x62')])};var _0x21147e={'ChatWebsiteId':_0x4d9285[_0xf4bf('0x57')]['id'],'closed':![]};if(_0x4d9285[_0xf4bf('0x62')]['threadId']){_0x21147e[_0xf4bf('0xb3')]=_0x4d9285['body'][_0xf4bf('0xb3')];return db['ChatInteraction'][_0xf4bf('0x59')]({'where':_0x21147e})['then'](function(_0x38639e){if(_0x38639e){return[_0x38639e,![]];}_0x38763d[_0xf4bf('0xb3')]=_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0xb3')];_0x38763d[_0xf4bf('0xb4')]=_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0xb4')];return db['ChatInteraction'][_0xf4bf('0x5a')](_0x38763d)[_0xf4bf('0x1f')](function(_0x5ebde8){return[_0x5ebde8,!![]];});});}_0x21147e[_0xf4bf('0xb5')]=_0x21d670['id'];if(_0x4d9285[_0xf4bf('0x62')]['interaction']&&_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0xb6')]['id']){_0x21147e['id']=_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0xb6')]['id'];return db[_0xf4bf('0xb7')][_0xf4bf('0x59')]({'where':_0x21147e})[_0xf4bf('0x1f')](function(_0x569ee0){if(_0x569ee0){return[_0x569ee0,![]];}return db[_0xf4bf('0xb7')]['create'](_0x38763d)[_0xf4bf('0x1f')](function(_0x5b0a89){return[_0x5b0a89,!![]];});});}return db[_0xf4bf('0xb7')][_0xf4bf('0x5a')](_0x38763d)[_0xf4bf('0x1f')](function(_0x4a5f44){return[_0x4a5f44,!![]];});}})[_0xf4bf('0xb8')](function(_0xc8c331,_0x21d992){if(_0xc8c331){_0x114371=_0x21d992;if(!_0x21d992){var _0x18f80c={'from':(_0x3fe5fa['contact'][_0xf4bf('0xa8')]||'')+'\x20'+(_0x3fe5fa[_0xf4bf('0xa2')][_0xf4bf('0xa9')]||'')};if(_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0xb3')]&&_0x4d9285['body']['messageId']&&_0x4d9285[_0xf4bf('0x62')]['threadId']!=_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0xb9')]){_0x18f80c['threadId']=_0x4d9285[_0xf4bf('0x62')]['messageId'];}return _0xc8c331[_0xf4bf('0x36')](_0x18f80c);}else{return _0xc8c331;}}})['then'](function(_0x12979a){_0x3fe5fa[_0xf4bf('0xb6')]=_0x12979a[_0xf4bf('0x38')]({'plain':!![]});_0x3fe5fa['interaction'][_0xf4bf('0xba')]=_0x114371;if(_0x3fe5fa[_0xf4bf('0xb6')][_0xf4bf('0xba')]){if(_0x3fe5fa[_0xf4bf('0x9e')][_0xf4bf('0xbb')]){_0x3fe5fa['applications'][_0xf4bf('0xbc')]({'id':0x0,'priority':_0x3fe5fa[_0xf4bf('0xa0')]['length']+0x1,'app':_0xf4bf('0xbd'),'appdata':'unmanaged','interval':_0xf4bf('0xbe')});}}return db[_0xf4bf('0xbf')][_0xf4bf('0x5a')]({'body':_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0x62')],'ChatWebsiteId':_0x4d9285[_0xf4bf('0x57')]['id'],'ChatInteractionId':_0x12979a['id'],'direction':'in','ContactId':_0x3fe5fa[_0xf4bf('0xa2')]['id'],'AttachmentId':_0x4d9285[_0xf4bf('0x62')][_0xf4bf('0xc0')]});})[_0xf4bf('0x1f')](function(_0x270804){_0x3fe5fa[_0xf4bf('0x26')]=_0x270804;if(_0x3fe5fa[_0xf4bf('0xb6')][_0xf4bf('0xc1')]){return db['User'][_0xf4bf('0x59')]({'attributes':['id',_0xf4bf('0x3b')],'where':{'id':_0x3fe5fa[_0xf4bf('0xb6')][_0xf4bf('0xc1')]}})[_0xf4bf('0x1f')](function(_0x26215c){if(_0x26215c){_0x3fe5fa['applications'][_0xf4bf('0xc2')]({'id':0x0,'priority':0x0,'app':_0xf4bf('0xc3'),'appdata':_0x26215c[_0xf4bf('0x3b')]+','+(_0x3fe5fa[_0xf4bf('0x9e')][_0xf4bf('0xc4')]||0xa),'interval':_0xf4bf('0xbe')});_0x3fe5fa['forcedOwnership']=!![];}return respondWithRpcPromise(_0xf4bf('0xc5'),_0xf4bf('0xc6'),_0x3fe5fa);});}return respondWithRpcPromise('Start','startRouting',_0x3fe5fa);})[_0xf4bf('0x1f')](function(_0x245247){respondWithRpcPromise('EventManager','EventManager',{'event':_0xf4bf('0xc7'),'message':_0x245247},client9002);return _0x245247;})[_0xf4bf('0x1f')](respondWithResult(_0x1dc803,null))['catch'](handleError(_0x1dc803,null));};exports[_0xf4bf('0xc8')]=function(_0x3a21be,_0xb4f1f9,_0x2c83df){var _0x30f5f7,_0x4d28bd,_0x428f30;var _0x344caf=[];var _0x40f8ef=[];var _0x51e199={};var _0x3856ad=_0x3a21be[_0xf4bf('0xc9')]||[];var _0x235519=[];var _0xb7334c;return db['CmContact']['describe']()['then'](function(_0x2186f0){if(!_0x2186f0){throw new db[(_0xf4bf('0x8c'))][(_0xf4bf('0x8d'))](_0xf4bf('0xca'));}_0x40f8ef=_[_0xf4bf('0x8e')](_['keys'](_0x2186f0),['createdAt',_0xf4bf('0x90')]);_0x344caf=_[_0xf4bf('0x8e')](_['keys'](_0x2186f0),[_0xf4bf('0x8f'),_0xf4bf('0x90'),_0xf4bf('0xcb'),_0xf4bf('0x91')]);if(_0x3a21be['body']['id']){delete _0x3a21be[_0xf4bf('0x62')]['id'];}if(_[_0xf4bf('0x7d')](_0x3a21be[_0xf4bf('0x62')][_0xf4bf('0x97')])){throw _0xb4f1f9[_0xf4bf('0x2b')](0x1f4)['send'](new db[(_0xf4bf('0x8c'))][(_0xf4bf('0x8d'))](_0xf4bf('0x92')));}if(_['isNil'](_0x3a21be[_0xf4bf('0x62')][_0xf4bf('0x62')])||_0x3a21be['body']['body']===''){throw _0xb4f1f9['status'](0x1f4)[_0xf4bf('0x3c')](new db[(_0xf4bf('0x8c'))][(_0xf4bf('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xf4bf('0x7d')](_0x3a21be[_0xf4bf('0x62')][_0xf4bf('0xcc')])){throw _0xb4f1f9['status'](0x1f4)[_0xf4bf('0x3c')](new db['Sequelize'][(_0xf4bf('0x8d'))](_0xf4bf('0xcd')+_0x344caf));}if(!_[_0xf4bf('0x96')](_0x344caf,_0x3a21be[_0xf4bf('0x62')][_0xf4bf('0xcc')])){throw _0xb4f1f9[_0xf4bf('0x2b')](0x1f4)[_0xf4bf('0x3c')](new db[(_0xf4bf('0x8c'))][(_0xf4bf('0x8d'))](_0xf4bf('0xce')+_0x344caf));}_0x51e199[_0x3a21be[_0xf4bf('0x62')]['mapKeyOffline']]=_0x3a21be[_0xf4bf('0x62')][_0xf4bf('0x97')];})[_0xf4bf('0x1f')](function(){return db[_0xf4bf('0x40')][_0xf4bf('0x59')]({'where':{'id':_0x3a21be[_0xf4bf('0x57')]['id']},'include':[{'model':db[_0xf4bf('0x98')],'as':'List'},{'model':db['MailAccount'],'as':_0xf4bf('0xcf')}]});})[_0xf4bf('0x1f')](handleEntityNotFound(_0xb4f1f9,null))['then'](function(_0x4c3a1c){if(_0x4c3a1c&&_0x4c3a1c[_0xf4bf('0x99')]){_0x4d28bd=_0x4c3a1c;var _0x58d44b=_[_0xf4bf('0x18')](_0x3a21be[_0xf4bf('0x62')],{'firstName':_0x3a21be[_0xf4bf('0x62')][_0xf4bf('0x97')],'phone':_0x3a21be[_0xf4bf('0x62')][_0xf4bf('0x97')],'ListId':_0x4c3a1c[_0xf4bf('0x91')]});_0x58d44b[_0x3a21be['body'][_0xf4bf('0xcc')]]=_0x3a21be[_0xf4bf('0x62')][_0xf4bf('0x97')];return db[_0xf4bf('0x8b')][_0xf4bf('0xd0')]({'where':_0x51e199,'defaults':_0x58d44b});}})[_0xf4bf('0xb8')](function(_0x134787){if(_0x134787){_0x428f30=_0x134787;var _0x1d192f=fs[_0xf4bf('0xd1')](path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],'server/files/templates/chatOfflineMessage.ejs'),_0xf4bf('0xd2'));var _0x83e3fb=ejs['render'](_0x1d192f,{'body':_[_0xf4bf('0xd3')](_0x3a21be[_0xf4bf('0x62')][_0xf4bf('0x62')]),'bodyTitle':_0x4d28bd[_0xf4bf('0xd4')]});return db[_0xf4bf('0xd5')]['create']({'body':_0x83e3fb,'ContactId':_0x134787['id'],'ChatWebsiteId':_0x4d28bd['id']});}})[_0xf4bf('0x1f')](function(_0x209bfc){_0xb7334c=_0x209bfc;if(_0x3856ad[_0xf4bf('0x66')]){var _0x317e34=_0x3856ad['map'](function(_0x35c5be){return{'name':_0x35c5be[_0xf4bf('0xd6')],'basename':_0x35c5be['filename'],'type':_0x35c5be['mimetype'],'ChatOfflineMessageId':_0x209bfc['id']};});_0x235519=_0x317e34['map'](_0x354c7b=>{var _0x52ab7b={'filename':_0x354c7b[_0xf4bf('0x3b')],'path':path['join'](config['root'],_0xf4bf('0xd7'),'files',_0xf4bf('0xd8'),_0xf4bf('0xd9'),_0x354c7b['basename'])};return _0x52ab7b;});if(!_0x4d28bd[_0xf4bf('0xda')]){return db['sequelize'][_0xf4bf('0xdb')](function(_0x3ad8ce){return db['Attachment'][_0xf4bf('0xdc')](_0x317e34,{'transaction':_0x3ad8ce});});}}})[_0xf4bf('0x1f')](function(){if(_0xb7334c){_0x30f5f7=_0xb7334c;return db['MailAccount'][_0xf4bf('0x65')]({'where':{'active':!![]},'include':[{'model':db[_0xf4bf('0xdd')],'as':_0xf4bf('0xde'),'raw':!![]}]});}})[_0xf4bf('0x1f')](function(_0x51550b){if(_0x51550b&&_0x51550b[_0xf4bf('0xde')]&&_0x4d28bd['forwardOffline']&&_0x4d28bd[_0xf4bf('0xdf')]){var _0x5aa3fd={'tls':{'rejectUnauthorized':![]}};if(_0x51550b[_0xf4bf('0xde')][_0xf4bf('0xe0')]){_0x5aa3fd[_0xf4bf('0xe0')]=_0x51550b[_0xf4bf('0xde')]['service'];}else{_0x5aa3fd['host']=_0x51550b[_0xf4bf('0xde')]['host'];_0x5aa3fd[_0xf4bf('0xe1')]=_0x51550b[_0xf4bf('0xde')][_0xf4bf('0xe1')];_0x5aa3fd[_0xf4bf('0xe2')]=_0x51550b[_0xf4bf('0xde')][_0xf4bf('0xe2')];}if(_0x51550b['Smtp'][_0xf4bf('0xe3')]){_0x5aa3fd[_0xf4bf('0xe4')]={'user':_0x51550b[_0xf4bf('0xde')][_0xf4bf('0x5d')],'pass':_0x51550b['Smtp'][_0xf4bf('0xe5')]};}return respondWithRpcPromise(_0xf4bf('0xe6'),'sendMail',{'account':_0x5aa3fd,'message':{'from':util[_0xf4bf('0xaf')](_0xf4bf('0xe7'),_0x51550b[_0xf4bf('0x3b')],_0x51550b[_0xf4bf('0xe8')]||_0x51550b[_0xf4bf('0xde')][_0xf4bf('0x5d')]),'to':_0x4d28bd[_0xf4bf('0xdf')],'subject':_0x4d28bd['offlineMessageSubject'],'html':_0x30f5f7[_0xf4bf('0x62')],'attachments':_0x235519}},client9003)['then'](function(){return _0x30f5f7;})['catch'](function(_0x1df466){console[_0xf4bf('0x24')](_0x1df466);});}})[_0xf4bf('0x1f')](function(){if(_0x4d28bd&&_0x4d28bd[_0xf4bf('0xda')]&&_0x4d28bd[_0xf4bf('0xe9')]){var _0x349a44=[];if(_0x3856ad[_0xf4bf('0x66')]){_0x349a44=_0x3856ad[_0xf4bf('0x3f')](function(_0xa4c01){return{'name':_0xa4c01[_0xf4bf('0xd6')],'basename':_0xa4c01['filename'],'type':_0xa4c01[_0xf4bf('0xea')],'ChatOfflineMessageId':_0xb7334c['id']};});}var _0x3f7727;if(!_[_0xf4bf('0x7d')](_0x4d28bd[_0xf4bf('0xeb')])){var _0x2e411c=_[_0xf4bf('0x3f')](_0x3a21be['body'],function(_0x204003){return _0x204003;});var _0x173a6a=_[_0xf4bf('0xec')](_0x2e411c)[0x0];var _0x386bde=_[_0xf4bf('0xed')](_0x173a6a,function(_0x213108){return _0x213108;});_0x3f7727=_0x386bde[0x1][_0x4d28bd[_0xf4bf('0xeb')]];}var _0x2ec749={'from':_0x428f30[_0xf4bf('0xe8')],'firstName':_0x428f30[_0xf4bf('0xa8')],'lastName':_0x428f30[_0xf4bf('0xa9')],'mapKey':_0xf4bf('0xe8'),'message':{'from':_0x428f30[_0xf4bf('0xe8')],'to':_0x4d28bd[_0xf4bf('0xcf')]['email'],'cc':'','subject':_[_0xf4bf('0x7d')](_0x3f7727)?_0x4d28bd[_0xf4bf('0xee')]:_0x3f7727,'messageId':'','sentAt':new Date(),'attach':_0x349a44[_0xf4bf('0x66')],'attachments':_0x349a44,'originChannel':_0xf4bf('0xef'),'ChatWebsiteId':_0x4d28bd['id'],'ChatOfflineMessageId':_0x30f5f7['id'],'originTo':_0x4d28bd['MailAccount'][_0xf4bf('0xe8')]},'body':_0x30f5f7[_0xf4bf('0x62')]};var _0x5b2490={'account':{'id':_0x4d28bd['MailAccountId']},'body':_0x2ec749,'log':_0xf4bf('0xf0')};return respondWithRpcPromise('NotifyMailAccount',_0xf4bf('0xf1'),_0x5b2490,client9001)[_0xf4bf('0x1f')](function(){return _0x30f5f7;})[_0xf4bf('0x29')](function(_0x4d98c2){console['error'](_0x4d98c2);});}return;})[_0xf4bf('0x1f')](function(){if(_0x30f5f7){return _0x30f5f7;}})[_0xf4bf('0x1f')](respondWithResult(_0xb4f1f9,null))[_0xf4bf('0x29')](function(_0x1f243a){console[_0xf4bf('0x24')]('catch',_0x1f243a);for(var _0x6ec6c2 of _0x3856ad){var _0x5d2bca=path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],_0xf4bf('0xd7'),_0xf4bf('0xc9'),_0xf4bf('0xd8'),'offline-chat',_0x6ec6c2[_0xf4bf('0x71')]);fs_extra[_0xf4bf('0xf2')](_0x5d2bca)[_0xf4bf('0x29')](function(_0x18b8be){console[_0xf4bf('0x24')](_0xf4bf('0xf3'),_0x5d2bca,_0x18b8be);});}});};exports[_0xf4bf('0xf4')]=function(_0x288f97,_0x29b30d,_0x4855c3){return db[_0xf4bf('0xb7')][_0xf4bf('0x59')]({'where':{'id':_0x288f97['params']['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x29b30d,null))[_0xf4bf('0x1f')](function(_0x1aa6dc){if(_0x1aa6dc){return _0x1aa6dc[_0xf4bf('0xf4')](_0x288f97[_0xf4bf('0x62')][_0xf4bf('0xf5')],_[_0xf4bf('0xf6')](_0x288f97[_0xf4bf('0x62')],[_0xf4bf('0xf5'),'id'])||{});}})[_0xf4bf('0x1f')](respondWithResult(_0x29b30d,null))[_0xf4bf('0x29')](handleError(_0x29b30d,null));};exports[_0xf4bf('0xf7')]=function(_0x2e9009,_0x2aaa27,_0x4aca5d){var _0x52825b={'raw':![],'where':{}};var _0x239859={};var _0x10432f={'count':0x0,'rows':[]};return db[_0xf4bf('0x40')][_0xf4bf('0x65')]({'where':{'id':_0x2e9009[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x2aaa27,null))[_0xf4bf('0x1f')](function(_0x2642e6){if(_0x2642e6){_0x239859[_0xf4bf('0x44')]=_[_0xf4bf('0x46')](db['ChatInteraction']['rawAttributes']);_0x239859[_0xf4bf('0x45')]=_[_0xf4bf('0x46')](_0x2e9009[_0xf4bf('0x45')]);_0x239859[_0xf4bf('0x47')]=_[_0xf4bf('0x58')](_0x239859[_0xf4bf('0x44')],_0x239859['query']);_0x52825b[_0xf4bf('0x48')]=_['intersection'](_0x239859[_0xf4bf('0x44')],qs[_0xf4bf('0x49')](_0x2e9009[_0xf4bf('0x45')][_0xf4bf('0x49')]));_0x52825b[_0xf4bf('0x48')]=_0x52825b[_0xf4bf('0x48')][_0xf4bf('0x66')]?_0x52825b[_0xf4bf('0x48')]:_0x239859[_0xf4bf('0x44')];if(!_0x2e9009[_0xf4bf('0x45')]['hasOwnProperty'](_0xf4bf('0x4b'))){_0x52825b[_0xf4bf('0x2f')]=qs[_0xf4bf('0x2f')](_0x2e9009['query'][_0xf4bf('0x2f')]);_0x52825b['offset']=qs['offset'](_0x2e9009[_0xf4bf('0x45')][_0xf4bf('0x2d')]);}_0x52825b[_0xf4bf('0x67')]=qs[_0xf4bf('0x4c')](_0x2e9009[_0xf4bf('0x45')][_0xf4bf('0x4c')]);_0x52825b['where']=qs[_0xf4bf('0x47')](_[_0xf4bf('0x4e')](_0x2e9009[_0xf4bf('0x45')],_0x239859[_0xf4bf('0x47')]));_0x52825b[_0xf4bf('0x4d')][_0xf4bf('0x68')]=_0x2642e6['id'];if(_0x2e9009[_0xf4bf('0x45')]['filter']){_0x52825b[_0xf4bf('0x4d')]=_[_0xf4bf('0x50')](_0x52825b[_0xf4bf('0x4d')],{'$or':_['map'](_0x52825b[_0xf4bf('0x48')],function(_0x539dc1){var _0x53189c={};_0x53189c[_0x539dc1]={'$like':'%'+_0x2e9009[_0xf4bf('0x45')][_0xf4bf('0x4f')]+'%'};return _0x53189c;})});}_0x52825b=_[_0xf4bf('0x50')]({},_0x52825b,_0x2e9009[_0xf4bf('0x52')]);return db[_0xf4bf('0xb7')]['count']({'where':_0x52825b[_0xf4bf('0x4d')]})['then'](function(_0x3303e0){_0x10432f[_0xf4bf('0x30')]=_0x3303e0;if(_0x2e9009[_0xf4bf('0x45')][_0xf4bf('0x6a')]){_0x52825b[_0xf4bf('0x53')]=[{'model':db[_0xf4bf('0x8b')],'as':_0xf4bf('0xf8'),'required':![]},{'model':db[_0xf4bf('0xf9')],'as':_0xf4bf('0xfa'),'attributes':[_0xf4bf('0x3b'),'fullname',_0xf4bf('0xfb')],'required':![]},{'model':db[_0xf4bf('0xfc')],'as':_0xf4bf('0xfd'),'attributes':['id',_0xf4bf('0x3b'),_0xf4bf('0xfe')],'where':_0x2e9009['query'][_0xf4bf('0xff')]?{'id':_0x2e9009[_0xf4bf('0x45')][_0xf4bf('0xff')]}:undefined,'required':_0x2e9009[_0xf4bf('0x45')][_0xf4bf('0xff')]?!![]:![]}];}return db[_0xf4bf('0xb7')]['findAll'](_0x52825b);})[_0xf4bf('0x1f')](function(_0x4f9556){_0x10432f[_0xf4bf('0x55')]=_0x4f9556;return _0x10432f;});}})['then'](respondWithFilteredResult(_0x2aaa27,_0x52825b))['catch'](handleError(_0x2aaa27,null));};function iftimePromise(_0x1f371b,_0x223b10){return respondWithRpcPromise(_0xf4bf('0x100'),_0xf4bf('0x101'),{'command':_0x223b10[_0xf4bf('0x102')]?util['format'](_0xf4bf('0x103'),_0x1f371b[_0xf4bf('0x104')],_0x223b10[_0xf4bf('0x102')]):util[_0xf4bf('0xaf')](_0xf4bf('0x105'),_0x1f371b['interval'])},client9002)[_0xf4bf('0x1f')](function(_0x399cad){var _0x24ddf0=_0x399cad&&_0x399cad[_0xf4bf('0x106')]('true')>=0x0?!![]:![];logger[_0xf4bf('0x27')](_0xf4bf('0x107'),_0x223b10['id'],_0x1f371b['id'],_0x1f371b[_0xf4bf('0x104')],_0x24ddf0?_0xf4bf('0x108'):_0xf4bf('0x109'),_0x223b10[_0xf4bf('0x102')]?_0x223b10[_0xf4bf('0x102')]:'No\x20timezone');return _0x24ddf0;})[_0xf4bf('0x29')](function(_0x2f5fde){logger[_0xf4bf('0x24')](_0xf4bf('0x107'),_0x223b10['id'],_0x1f371b['id'],_0x1f371b[_0xf4bf('0x104')],util[_0xf4bf('0x10a')](_0x2f5fde,{'showHidden':![],'depth':null}),_0x223b10['timezone']?_0x223b10[_0xf4bf('0x102')]:_0xf4bf('0x10b'));return![];});}exports['getSnippet']=function(_0x312da4,_0x309bb3,_0x56a70c){var _0x568ff1=0x0;var _0x5d3b7d=0x0;var _0x115ac9=![];var _0x11041e;var _0x471910;return db['ChatWebsite']['find']({'where':{'id':_0x312da4[_0xf4bf('0x57')]['id']},'include':[{'model':db['Interval'],'as':_0xf4bf('0x10c'),'include':[{'model':db['Interval'],'as':_0xf4bf('0x10d'),'attributes':['id',_0xf4bf('0x104')],'raw':!![]}]}]})[_0xf4bf('0x1f')](handleEntityNotFound(_0x309bb3,null))['then'](function(_0x197bad){if(_0x197bad){_0x11041e=_0x197bad;return _0x197bad[_0xf4bf('0x10e')]({'raw':!![]});}})[_0xf4bf('0x1f')](function(_0x50dac9){if(_0x11041e){if(_0x50dac9){_0x471910=_0x50dac9;}}return require('../../config/license/util')[_0xf4bf('0x7c')]();})['then'](function(_0x439797){if(_0x439797){_0x5d3b7d=_0x439797[_0xf4bf('0x10f')];_0x115ac9=_0x439797['custom'];}})['then'](function(){return db[_0xf4bf('0xb7')][_0xf4bf('0x30')]({'where':{'closed':![]}});})['then'](function(_0x56b6ad){_0x568ff1=_0x56b6ad;if(_0x5d3b7d&&_0x56b6ad>_0x5d3b7d){return db[_0xf4bf('0x110')]['findOne']({'where':{'id':0x1}})['then'](function(_0x39a293){if(_0x39a293){_0x39a293[_0xf4bf('0x111')](_0xf4bf('0x112'));}});}})[_0xf4bf('0x1f')](function(){if(_0x11041e[_0xf4bf('0x10c')]&&_0x11041e['Interval']['Intervals']){var _0x56054f=[];for(var _0x14d390=0x0;_0x14d390<_0x11041e[_0xf4bf('0x10c')][_0xf4bf('0x10d')]['length'];_0x14d390++){var _0x3d0010=_0x11041e['Interval']['Intervals'][_0x14d390][_0xf4bf('0x38')]({'plain':!![]});_0x56054f['push'](iftimePromise(_0x3d0010,_0x11041e));}return BPromise[_0xf4bf('0x113')](_0x56054f)[_0xf4bf('0x1f')](function(_0x5b03d5){return _['some'](_0x5b03d5);});}else{return!![];}})[_0xf4bf('0x1f')](function(_0xfd5eea){var _0x1cf1d6=fs['readFileSync'](path[_0xf4bf('0x78')](config[_0xf4bf('0x79')],_0xf4bf('0x114')),'utf8');var _0x2d68b9={'remote':_0x11041e[_0xf4bf('0x115')],'query':querystring[_0xf4bf('0x116')](_[_0xf4bf('0x50')](_0x11041e[_0xf4bf('0x38')]({'plain':!![]}),{'customerIp':_0x312da4[_0xf4bf('0x88')][_0xf4bf('0xa6')]||_0x312da4[_0xf4bf('0x88')][_0xf4bf('0x117')]||_0x312da4[_0xf4bf('0x118')][_0xf4bf('0x119')]||_0x312da4['ip'],'referer':_0x312da4['headers']['referer'],'openedInteractions':_0x568ff1,'maxInteractions':_0x5d3b7d,'virtual':_0x115ac9[_0xf4bf('0x10f')],'online':_0xfd5eea,'custom':_0x115ac9}))[_0xf4bf('0x11a')](/'/g,'\x5c\x27')};_0x309bb3[_0xf4bf('0x3c')](ejs[_0xf4bf('0x11b')](Mustache[_0xf4bf('0x11b')](_0x1cf1d6,_0x2d68b9),{'proactiveActions':_0x471910,'alignment':_0x11041e['alignment'],'verticalAlignment':_0x11041e[_0xf4bf('0x11c')],'div_color':_0x11041e[_0xf4bf('0xfe')],'text_color':_0x11041e[_0xf4bf('0x11d')],'button_color':_0x11041e[_0xf4bf('0x11e')],'background_color':_0x11041e['backgroundColor']}));})['catch'](handleError(_0x309bb3,null));};exports['addApplications']=function(_0x504f79,_0x3d5fc6,_0x3ef361){return db['ChatWebsite'][_0xf4bf('0x65')]({'where':{'id':_0x504f79[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x3d5fc6,null))[_0xf4bf('0x1f')](function(_0x1f30c2){if(_0x1f30c2){return db[_0xf4bf('0x11f')][_0xf4bf('0xdb')](function(_0x16283e){return db[_0xf4bf('0x9c')][_0xf4bf('0x37')]({'where':{'ChatWebsiteId':_0x504f79['params']['id']},'transaction':_0x16283e})['then'](function(_0x14e071){var _0x35195e=_['map'](_0x504f79['body'],function(_0x3b4f9d){_0x3b4f9d['ChatWebsiteId']=_0x504f79[_0xf4bf('0x57')]['id'];return _0x3b4f9d;});return db[_0xf4bf('0x9c')][_0xf4bf('0xdc')](_0x35195e,{'transaction':_0x16283e});});})['then'](function(){return db[_0xf4bf('0x9c')][_0xf4bf('0x120')]({'where':{'ChatWebsiteId':_0x504f79['params']['id']},'order':'priority'});});}})[_0xf4bf('0x1f')](respondWithResult(_0x3d5fc6,null))['catch'](handleError(_0x3d5fc6,null));};exports[_0xf4bf('0x121')]=function(_0x4e0f46,_0x29fc53,_0x16f020){var _0x4cfe1a={};var _0x302e53={};var _0x21a759;var _0xfeafdb;return db[_0xf4bf('0x40')][_0xf4bf('0x65')]({'where':{'id':_0x4e0f46[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x29fc53,null))[_0xf4bf('0x1f')](function(_0x462b43){if(_0x462b43){_0x21a759=_0x462b43;_0x302e53['model']=_[_0xf4bf('0x46')](db['ChatApplication']['rawAttributes']);_0x302e53[_0xf4bf('0x45')]=_['keys'](_0x4e0f46[_0xf4bf('0x45')]);_0x302e53[_0xf4bf('0x47')]=_[_0xf4bf('0x58')](_0x302e53[_0xf4bf('0x44')],_0x302e53[_0xf4bf('0x45')]);_0x4cfe1a['attributes']=_['intersection'](_0x302e53[_0xf4bf('0x44')],qs[_0xf4bf('0x49')](_0x4e0f46['query'][_0xf4bf('0x49')]));_0x4cfe1a[_0xf4bf('0x48')]=_0x4cfe1a[_0xf4bf('0x48')][_0xf4bf('0x66')]?_0x4cfe1a['attributes']:_0x302e53[_0xf4bf('0x44')];_0x4cfe1a[_0xf4bf('0x67')]=qs['sort'](_0x4e0f46[_0xf4bf('0x45')][_0xf4bf('0x4c')]);_0x4cfe1a['where']=qs['filters'](_[_0xf4bf('0x4e')](_0x4e0f46[_0xf4bf('0x45')],_0x302e53[_0xf4bf('0x47')]));if(_0x4e0f46[_0xf4bf('0x45')][_0xf4bf('0x4f')]){_0x4cfe1a[_0xf4bf('0x4d')]=_[_0xf4bf('0x50')](_0x4cfe1a[_0xf4bf('0x4d')],{'$or':_[_0xf4bf('0x3f')](_0x4cfe1a[_0xf4bf('0x48')],function(_0xa676ea){var _0x4c2f8c={};_0x4c2f8c[_0xa676ea]={'$like':'%'+_0x4e0f46['query']['filter']+'%'};return _0x4c2f8c;})});}_0x4cfe1a=_['merge']({},_0x4cfe1a,_0x4e0f46['options']);return _0x21a759[_0xf4bf('0x121')](_0x4cfe1a);}})['then'](function(_0x395f9c){if(_0x395f9c){_0xfeafdb=_0x395f9c[_0xf4bf('0x66')];if(!_0x4e0f46[_0xf4bf('0x45')]['hasOwnProperty'](_0xf4bf('0x4b'))){_0x4cfe1a[_0xf4bf('0x2f')]=qs[_0xf4bf('0x2f')](_0x4e0f46[_0xf4bf('0x45')][_0xf4bf('0x2f')]);_0x4cfe1a[_0xf4bf('0x2d')]=qs['offset'](_0x4e0f46[_0xf4bf('0x45')]['offset']);}return _0x21a759[_0xf4bf('0x121')](_0x4cfe1a);}})[_0xf4bf('0x1f')](function(_0x165703){if(_0x165703){return _0x165703?{'count':_0xfeafdb,'rows':_0x165703}:null;}})[_0xf4bf('0x1f')](respondWithResult(_0x29fc53,null))[_0xf4bf('0x29')](handleError(_0x29fc53,null));};exports['addProactiveActions']=function(_0x4199ba,_0x5f0a67,_0xd1e1c0){return db[_0xf4bf('0x122')][_0xf4bf('0x59')]({'where':{'id':_0x4199ba['params']['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x5f0a67,null))['then'](function(_0x502c37){if(_0x502c37){return _0x502c37[_0xf4bf('0x123')](_0x4199ba[_0xf4bf('0x62')][_0xf4bf('0xf5')],_[_0xf4bf('0xf6')](_0x4199ba[_0xf4bf('0x62')],[_0xf4bf('0xf5'),'id'])||{});}})['then'](respondWithResult(_0x5f0a67,null))[_0xf4bf('0x29')](handleError(_0x5f0a67,null));};exports[_0xf4bf('0x10e')]=function(_0x3c81ac,_0x590a73,_0x1b102b){var _0x56df49={};var _0x4dace8={};var _0x45fe71;var _0x4ba679;return db['ChatWebsite']['findOne']({'where':{'id':_0x3c81ac[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x590a73,null))['then'](function(_0x41509b){if(_0x41509b){_0x45fe71=_0x41509b;_0x4dace8[_0xf4bf('0x44')]=_['keys'](db['ChatProactiveAction'][_0xf4bf('0x41')]);_0x4dace8['query']=_[_0xf4bf('0x46')](_0x3c81ac['query']);_0x4dace8[_0xf4bf('0x47')]=_['intersection'](_0x4dace8[_0xf4bf('0x44')],_0x4dace8[_0xf4bf('0x45')]);_0x56df49[_0xf4bf('0x48')]=_['intersection'](_0x4dace8['model'],qs[_0xf4bf('0x49')](_0x3c81ac[_0xf4bf('0x45')][_0xf4bf('0x49')]));_0x56df49[_0xf4bf('0x48')]=_0x56df49[_0xf4bf('0x48')][_0xf4bf('0x66')]?_0x56df49['attributes']:_0x4dace8[_0xf4bf('0x44')];_0x56df49[_0xf4bf('0x67')]=qs[_0xf4bf('0x4c')](_0x3c81ac['query'][_0xf4bf('0x4c')]);_0x56df49[_0xf4bf('0x4d')]=qs[_0xf4bf('0x47')](_[_0xf4bf('0x4e')](_0x3c81ac[_0xf4bf('0x45')],_0x4dace8[_0xf4bf('0x47')]));if(_0x3c81ac[_0xf4bf('0x45')][_0xf4bf('0x4f')]){_0x56df49[_0xf4bf('0x4d')]=_[_0xf4bf('0x50')](_0x56df49['where'],{'$or':_[_0xf4bf('0x3f')](_0x56df49[_0xf4bf('0x48')],function(_0x240d1f){var _0x68d8b3={};_0x68d8b3[_0x240d1f]={'$like':'%'+_0x3c81ac['query'][_0xf4bf('0x4f')]+'%'};return _0x68d8b3;})});}_0x56df49=_[_0xf4bf('0x50')]({},_0x56df49,_0x3c81ac[_0xf4bf('0x52')]);return _0x45fe71[_0xf4bf('0x10e')](_0x56df49);}})['then'](function(_0x37dd93){if(_0x37dd93){_0x4ba679=_0x37dd93[_0xf4bf('0x66')];if(!_0x3c81ac[_0xf4bf('0x45')]['hasOwnProperty'](_0xf4bf('0x4b'))){_0x56df49[_0xf4bf('0x2f')]=qs['limit'](_0x3c81ac['query'][_0xf4bf('0x2f')]);_0x56df49[_0xf4bf('0x2d')]=qs[_0xf4bf('0x2d')](_0x3c81ac[_0xf4bf('0x45')][_0xf4bf('0x2d')]);}return _0x45fe71['getProactiveActions'](_0x56df49);}})[_0xf4bf('0x1f')](function(_0xe184ef){if(_0xe184ef){return _0xe184ef?{'count':_0x4ba679,'rows':_0xe184ef}:null;}})['then'](respondWithResult(_0x590a73,null))['catch'](handleError(_0x590a73,null));};exports[_0xf4bf('0x124')]=function(_0x279989,_0x2178f1,_0x45c5d4){var _0x50cbb2=_0x279989[_0xf4bf('0x45')][_0xf4bf('0x125')]==='false'?_0xf4bf('0x126'):_0xf4bf('0x127');return db['ChatWebsite'][_0xf4bf('0x59')]({'attributes':['id',_0x50cbb2],'where':{'id':_0x279989[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x2178f1,null))[_0xf4bf('0x1f')](function(_0x3533ca){if(_0x3533ca){var _0x96a734=_0x3533ca[_0x50cbb2];var _0x42ba74=_0x96a734&&_0x96a734['items']?_0x96a734['items']:[];_0x2178f1[_0xf4bf('0x3c')]({'fromKey':_['isNil'](_0x96a734[_0xf4bf('0x128')])?undefined:_0x96a734[_0xf4bf('0x128')],'count':_0x42ba74[_0xf4bf('0x66')],'rows':_0x42ba74});}})['catch'](handleError(_0x2178f1,null));};exports['getOfflineMessages']=function(_0xdaa747,_0x3fc099,_0x1a0d44){var _0x2eb667={'raw':![],'where':{}};var _0x4e6e81={};var _0x27ee3f={'count':0x0,'rows':[]};return db[_0xf4bf('0x40')]['findOne']({'where':{'id':_0xdaa747[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x3fc099,null))[_0xf4bf('0x1f')](function(_0x503b01){if(_0x503b01){_0x4e6e81[_0xf4bf('0x44')]=_[_0xf4bf('0x46')](db[_0xf4bf('0xd5')]['rawAttributes']);_0x4e6e81['query']=_[_0xf4bf('0x46')](_0xdaa747[_0xf4bf('0x45')]);_0x4e6e81[_0xf4bf('0x47')]=_['intersection'](_0x4e6e81[_0xf4bf('0x44')],_0x4e6e81['query']);_0x2eb667[_0xf4bf('0x48')]=_[_0xf4bf('0x58')](_0x4e6e81['model'],qs[_0xf4bf('0x49')](_0xdaa747[_0xf4bf('0x45')][_0xf4bf('0x49')]));_0x2eb667[_0xf4bf('0x48')]=_0x2eb667[_0xf4bf('0x48')][_0xf4bf('0x66')]?_0x2eb667['attributes']:_0x4e6e81[_0xf4bf('0x44')];if(!_0xdaa747[_0xf4bf('0x45')][_0xf4bf('0x4a')](_0xf4bf('0x4b'))){_0x2eb667['limit']=qs['limit'](_0xdaa747['query'][_0xf4bf('0x2f')]);_0x2eb667[_0xf4bf('0x2d')]=qs['offset'](_0xdaa747['query'][_0xf4bf('0x2d')]);}_0x2eb667[_0xf4bf('0x67')]=qs['sort'](_0xdaa747[_0xf4bf('0x45')]['sort']);_0x2eb667[_0xf4bf('0x4d')]=qs[_0xf4bf('0x47')](_[_0xf4bf('0x4e')](_0xdaa747['query'],_0x4e6e81[_0xf4bf('0x47')]));_0x2eb667[_0xf4bf('0x4d')][_0xf4bf('0x68')]=_0x503b01['id'];if(_0xdaa747[_0xf4bf('0x45')]['filter']){_0x2eb667['where']=_['merge'](_0x2eb667[_0xf4bf('0x4d')],{'$or':_[_0xf4bf('0x3f')](_0x2eb667['attributes'],function(_0x4d0aa7){var _0x4337ca={};_0x4337ca[_0x4d0aa7]={'$like':'%'+_0xdaa747[_0xf4bf('0x45')][_0xf4bf('0x4f')]+'%'};return _0x4337ca;})});}_0x2eb667=_['merge']({},_0x2eb667,_0xdaa747[_0xf4bf('0x52')]);return db[_0xf4bf('0xd5')][_0xf4bf('0x30')]({'where':_0x2eb667[_0xf4bf('0x4d')]})['then'](function(_0x6c85f3){_0x27ee3f['count']=_0x6c85f3;if(_0xdaa747[_0xf4bf('0x45')][_0xf4bf('0x6a')]){_0x2eb667[_0xf4bf('0x53')]=[{'all':!![]}];}else{_0x2eb667[_0xf4bf('0x53')]=[{'model':db[_0xf4bf('0x8b')],'as':_0xf4bf('0xf8'),'required':![]},{'model':db[_0xf4bf('0x129')],'as':_0xf4bf('0x12a'),'required':![]}];}return db[_0xf4bf('0xd5')][_0xf4bf('0x54')](_0x2eb667);})[_0xf4bf('0x1f')](function(_0x4087cb){_0x27ee3f[_0xf4bf('0x55')]=_0x4087cb;return _0x27ee3f;});}})[_0xf4bf('0x1f')](respondWithFilteredResult(_0x3fc099,_0x2eb667))['catch'](handleError(_0x3fc099,null));};exports['addAgents']=function(_0x574077,_0x225c5b,_0x4f867d){return db['ChatWebsite'][_0xf4bf('0x59')]({'where':{'id':_0x574077[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x225c5b,null))[_0xf4bf('0x1f')](function(_0x29eaf6){if(_0x29eaf6){return _0x29eaf6[_0xf4bf('0x12b')](_0x574077[_0xf4bf('0x62')][_0xf4bf('0xf5')],_[_0xf4bf('0xf6')](_0x574077[_0xf4bf('0x62')],['ids','id'])||{})[_0xf4bf('0xb8')](function(_0x3ef1b0){for(var _0x5c2393=0x0;_0x5c2393<_0x574077[_0xf4bf('0x62')]['ids']['length'];_0x5c2393+=0x1){socket[_0xf4bf('0x12c')](_0xf4bf('0x12d'),{'UserId':Number(_0x574077[_0xf4bf('0x62')][_0xf4bf('0xf5')][_0x5c2393]),'ChatWebsiteId':Number(_0x574077[_0xf4bf('0x57')]['id'])});}return _0x3ef1b0;});}})[_0xf4bf('0x1f')](respondWithResult(_0x225c5b,null))[_0xf4bf('0x29')](handleError(_0x225c5b,null));};exports[_0xf4bf('0x12e')]=function(_0x502b1b,_0x2a4ab8,_0x170030){return db[_0xf4bf('0x40')]['find']({'where':{'id':_0x502b1b[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x2a4ab8,null))[_0xf4bf('0x1f')](function(_0x533601){if(_0x533601){return _0x533601['removeAgents'](_0x502b1b[_0xf4bf('0x45')]['ids'])[_0xf4bf('0x1f')](function(){if(_[_0xf4bf('0x12f')](_0x502b1b[_0xf4bf('0x45')]['ids'])){for(var _0xb936e8=0x0;_0xb936e8<_0x502b1b[_0xf4bf('0x45')][_0xf4bf('0xf5')]['length'];_0xb936e8+=0x1){socket[_0xf4bf('0x12c')](_0xf4bf('0x130'),{'UserId':Number(_0x502b1b[_0xf4bf('0x45')][_0xf4bf('0xf5')][_0xb936e8]),'ChatWebsiteId':Number(_0x502b1b['params']['id'])});}}else{socket['emit'](_0xf4bf('0x130'),{'UserId':Number(_0x502b1b[_0xf4bf('0x45')][_0xf4bf('0xf5')]),'ChatWebsiteId':Number(_0x502b1b[_0xf4bf('0x57')]['id'])});}});}})[_0xf4bf('0x1f')](respondWithStatusCode(_0x2a4ab8,null))['catch'](handleError(_0x2a4ab8,null));};exports[_0xf4bf('0x131')]=function(_0x32daeb,_0x377969,_0x503fa9){var _0x2c65b3={};var _0x4c90f5={};var _0x50cbfc;var _0x2dec4e;return db[_0xf4bf('0x40')][_0xf4bf('0x65')]({'where':{'id':_0x32daeb[_0xf4bf('0x57')]['id']}})[_0xf4bf('0x1f')](handleEntityNotFound(_0x377969,null))['then'](function(_0x89c049){if(_0x89c049){_0x50cbfc=_0x89c049;_0x4c90f5[_0xf4bf('0x44')]=_[_0xf4bf('0x46')](db['User']['rawAttributes']);_0x4c90f5[_0xf4bf('0x45')]=_[_0xf4bf('0x46')](_0x32daeb[_0xf4bf('0x45')]);_0x4c90f5[_0xf4bf('0x47')]=_[_0xf4bf('0x58')](_0x4c90f5[_0xf4bf('0x44')],_0x4c90f5[_0xf4bf('0x45')]);_0x2c65b3[_0xf4bf('0x48')]=_[_0xf4bf('0x58')](_0x4c90f5[_0xf4bf('0x44')],qs[_0xf4bf('0x49')](_0x32daeb[_0xf4bf('0x45')][_0xf4bf('0x49')]));_0x2c65b3[_0xf4bf('0x48')]=_0x2c65b3[_0xf4bf('0x48')][_0xf4bf('0x66')]?_0x2c65b3['attributes']:_0x4c90f5[_0xf4bf('0x44')];_0x2c65b3[_0xf4bf('0x67')]=qs['sort'](_0x32daeb[_0xf4bf('0x45')][_0xf4bf('0x4c')]);_0x2c65b3[_0xf4bf('0x4d')]=qs[_0xf4bf('0x47')](_[_0xf4bf('0x4e')](_0x32daeb[_0xf4bf('0x45')],_0x4c90f5['filters']));if(_0x32daeb[_0xf4bf('0x45')][_0xf4bf('0x4f')]){_0x2c65b3[_0xf4bf('0x4d')]=_['merge'](_0x2c65b3[_0xf4bf('0x4d')],{'$or':_[_0xf4bf('0x3f')](_0x2c65b3[_0xf4bf('0x48')],function(_0x50a4bd){var _0x1e1fad={};_0x1e1fad[_0x50a4bd]={'$like':'%'+_0x32daeb[_0xf4bf('0x45')][_0xf4bf('0x4f')]+'%'};return _0x1e1fad;})});}_0x2c65b3=_['merge']({},_0x2c65b3,_0x32daeb[_0xf4bf('0x52')]);return _0x50cbfc[_0xf4bf('0x131')](_0x2c65b3);}})[_0xf4bf('0x1f')](function(_0x21745a){if(_0x21745a){_0x2dec4e=_0x21745a[_0xf4bf('0x66')];if(!_0x32daeb[_0xf4bf('0x45')]['hasOwnProperty']('nolimit')){_0x2c65b3[_0xf4bf('0x2f')]=qs[_0xf4bf('0x2f')](_0x32daeb[_0xf4bf('0x45')][_0xf4bf('0x2f')]);_0x2c65b3[_0xf4bf('0x2d')]=qs[_0xf4bf('0x2d')](_0x32daeb[_0xf4bf('0x45')]['offset']);}return _0x50cbfc[_0xf4bf('0x131')](_0x2c65b3);}})[_0xf4bf('0x1f')](function(_0x25006d){if(_0x25006d){return _0x25006d?{'count':_0x2dec4e,'rows':_0x25006d}:null;}})['then'](respondWithResult(_0x377969,null))[_0xf4bf('0x29')](handleError(_0x377969,null));}; \ No newline at end of file +var _0x03fe=['x-real-ip','connection','remoteAddress','referer','replace','alignment','color','color_button','addApplications','transaction','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','onlineForm','items','fromKey','Attachment','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','ChatWebsites','destroy','end','name','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','Pause','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','describe','ChatWebsiteId','Disposition','findOne','sort','removeDispositions','addAnswer','CannedAnswer','order','findAll','removeAnswers','ids','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','getLogo','join','getLicense','custom','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','isNil','existsSync','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','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','from','CmList','CmContact','Contacts','DESC','ChatApplication','Applications','List','account','list','orderBy','applications','priority','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','offline','CompanyId','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','all','some','server/files/chat/iframe.ejs','remote'];(function(_0x946d1f,_0x1cf238){var _0x546e1b=function(_0x180ea1){while(--_0x180ea1){_0x946d1f['push'](_0x946d1f['shift']());}};_0x546e1b(++_0x1cf238);}(_0x03fe,0x154));var _0xe03f=function(_0x5719dc,_0x4bab45){_0x5719dc=_0x5719dc-0x0;var _0x4349d0=_0x03fe[_0x5719dc];return _0x4349d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe03f('0x0'));var zipdir=require(_0xe03f('0x1'));var jsonpatch=require(_0xe03f('0x2'));var rp=require(_0xe03f('0x3'));var moment=require(_0xe03f('0x4'));var BPromise=require(_0xe03f('0x5'));var Mustache=require(_0xe03f('0x6'));var util=require(_0xe03f('0x7'));var path=require(_0xe03f('0x8'));var sox=require('sox');var csv=require(_0xe03f('0x9'));var ejs=require(_0xe03f('0xa'));var fs=require('fs');var fs_extra=require(_0xe03f('0xb'));var _=require(_0xe03f('0xc'));var squel=require(_0xe03f('0xd'));var crypto=require(_0xe03f('0xe'));var jsforce=require(_0xe03f('0xf'));var deskjs=require(_0xe03f('0x10'));var toCsv=require(_0xe03f('0x9'));var querystring=require(_0xe03f('0x11'));var Papa=require(_0xe03f('0x12'));var Redis=require('ioredis');var authService=require(_0xe03f('0x13'));var qs=require(_0xe03f('0x14'));var as=require(_0xe03f('0x15'));var hardwareService=require(_0xe03f('0x16'));var logger=require('../../config/logger')(_0xe03f('0x17'));var utils=require(_0xe03f('0x18'));var config=require(_0xe03f('0x19'));var licenseUtil=require(_0xe03f('0x1a'));var db=require(_0xe03f('0x1b'))['db'];config[_0xe03f('0x1c')]=_[_0xe03f('0x1d')](config[_0xe03f('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xe03f('0x1e'))(new Redis(config['redis']));require(_0xe03f('0x1f'))[_0xe03f('0x20')](socket);var jayson=require(_0xe03f('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe03f('0x22')][_0xe03f('0x23')]({'port':0x232a});var client9003=jayson[_0xe03f('0x22')]['http']({'port':0x232b});var client9001=jayson[_0xe03f('0x22')][_0xe03f('0x23')]({'port':0x2329});function respondWithRpcPromise(_0xcba94c,_0x585916,_0x72b466,_0x5abdd3){return new BPromise(function(_0x2a57da,_0x4887a2){var _0x12b570=_0x5abdd3||client;return _0x12b570[_0xe03f('0x24')](_0xcba94c,_0x72b466)[_0xe03f('0x25')](function(_0x501388){logger[_0xe03f('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x585916,_0xe03f('0x27'));logger[_0xe03f('0x28')](_0xe03f('0x29'),_0x585916,'request\x20sent',JSON[_0xe03f('0x2a')](_0x501388));if(_0x501388[_0xe03f('0x2b')]){if(_0x501388[_0xe03f('0x2b')][_0xe03f('0x2c')]===0x1f4){logger[_0xe03f('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0x585916,_0x501388[_0xe03f('0x2b')]['message']);return _0x4887a2(_0x501388['error'][_0xe03f('0x2d')]);}logger['error'](_0xe03f('0x2e'),_0x585916,_0x501388[_0xe03f('0x2b')][_0xe03f('0x2d')]);return _0x2a57da(_0x501388[_0xe03f('0x2b')][_0xe03f('0x2d')]);}else{logger[_0xe03f('0x26')](_0xe03f('0x2e'),_0x585916,_0xe03f('0x27'));_0x2a57da(_0x501388[_0xe03f('0x2f')][_0xe03f('0x2d')]);}})['catch'](function(_0x468dae){logger['error'](_0xe03f('0x2e'),_0x585916,_0x468dae);_0x4887a2(_0x468dae);});});}function respondWithStatusCode(_0x3eb2b8,_0x1efbe9){_0x1efbe9=_0x1efbe9||0xcc;return function(_0x1cea86){if(_0x1cea86){return _0x3eb2b8[_0xe03f('0x30')](_0x1efbe9);}return _0x3eb2b8[_0xe03f('0x31')](_0x1efbe9)['end']();};}function respondWithResult(_0x36f881,_0x108f6b){_0x108f6b=_0x108f6b||0xc8;return function(_0x378d71){if(_0x378d71){return _0x36f881[_0xe03f('0x31')](_0x108f6b)[_0xe03f('0x32')](_0x378d71);}};}function respondWithFilteredResult(_0xd6413,_0x2fdfd8){return function(_0x25af93){if(_0x25af93){var _0x3a9190=typeof _0x2fdfd8[_0xe03f('0x33')]===_0xe03f('0x34')&&typeof _0x2fdfd8[_0xe03f('0x35')]===_0xe03f('0x34');var _0x106925=_0x25af93[_0xe03f('0x36')];var _0x191a41=_0x3a9190?0x0:_0x2fdfd8['offset'];var _0x553bf3=_0x3a9190?_0x25af93[_0xe03f('0x36')]:_0x2fdfd8[_0xe03f('0x33')]+_0x2fdfd8['limit'];var _0x20d324;if(_0x553bf3>=_0x106925){_0x553bf3=_0x106925;_0x20d324=0xc8;}else{_0x20d324=0xce;}_0xd6413[_0xe03f('0x31')](_0x20d324);return _0xd6413[_0xe03f('0x37')](_0xe03f('0x38'),_0x191a41+'-'+_0x553bf3+'/'+_0x106925)[_0xe03f('0x32')](_0x25af93);}return null;};}function patchUpdates(_0x48b5ad){return function(_0x3fe2c2){try{jsonpatch[_0xe03f('0x39')](_0x3fe2c2,_0x48b5ad,!![]);}catch(_0x355ff5){return BPromise['reject'](_0x355ff5);}return _0x3fe2c2[_0xe03f('0x3a')]();};}function saveUpdates(_0x3b616f,_0x3ca58f){return function(_0x573c8e){if(_0x573c8e){return _0x573c8e[_0xe03f('0x3b')](_0x3b616f)[_0xe03f('0x25')](function(_0x1e9849){return _0x1e9849;});}return null;};}function removeEntity(_0x1f21f3,_0x19fc7d){return function(_0x2edbb3){if(_0x2edbb3){return _0x2edbb3['destroy']()[_0xe03f('0x25')](function(){var _0x182050=_0x2edbb3['get']({'plain':!![]});var _0x1329b9=_0xe03f('0x3c');return db['UserProfileResource'][_0xe03f('0x3d')]({'where':{'type':_0x1329b9,'resourceId':_0x182050['id']}})['then'](function(){return _0x2edbb3;});})['then'](function(){_0x1f21f3[_0xe03f('0x31')](0xcc)[_0xe03f('0x3e')]();});}};}function handleEntityNotFound(_0x168b80,_0x4c49ce){return function(_0x37b6cf){if(!_0x37b6cf){_0x168b80[_0xe03f('0x30')](0x194);}return _0x37b6cf;};}function handleError(_0x1fc0c3,_0xb90aa3){_0xb90aa3=_0xb90aa3||0x1f4;return function(_0x285074){logger['error'](_0x285074['stack']);if(_0x285074['name']){delete _0x285074[_0xe03f('0x3f')];}_0x1fc0c3[_0xe03f('0x31')](_0xb90aa3)['send'](_0x285074);};}exports[_0xe03f('0x40')]=function(_0x85e20f,_0x468e3a){var _0x1b484b={'include':[{'model':db['Pause'],'as':_0xe03f('0x41')}]},_0x558fa2={},_0x23ca5a={'count':0x0,'rows':[]};var _0x5abd60=_[_0xe03f('0x42')](db[_0xe03f('0x43')][_0xe03f('0x44')],function(_0x33fd70){return{'name':_0x33fd70[_0xe03f('0x45')],'type':_0x33fd70['type'][_0xe03f('0x46')]};});_0x558fa2[_0xe03f('0x47')]=_[_0xe03f('0x42')](_0x5abd60,_0xe03f('0x3f'));_0x558fa2['query']=_['keys'](_0x85e20f[_0xe03f('0x48')]);_0x558fa2[_0xe03f('0x49')]=_[_0xe03f('0x4a')](_0x558fa2[_0xe03f('0x47')],_0x558fa2[_0xe03f('0x48')]);_0x1b484b[_0xe03f('0x4b')]=_['intersection'](_0x558fa2[_0xe03f('0x47')],qs[_0xe03f('0x4c')](_0x85e20f[_0xe03f('0x48')][_0xe03f('0x4c')]));_0x1b484b['attributes']=_0x1b484b[_0xe03f('0x4b')][_0xe03f('0x4d')]?_0x1b484b['attributes']:_0x558fa2['model'];if(!_0x85e20f['query'][_0xe03f('0x4e')](_0xe03f('0x4f'))){_0x1b484b[_0xe03f('0x35')]=qs['limit'](_0x85e20f['query']['limit']);_0x1b484b['offset']=qs['offset'](_0x85e20f[_0xe03f('0x48')][_0xe03f('0x33')]);}_0x1b484b['order']=qs['sort'](_0x85e20f['query']['sort']);_0x1b484b[_0xe03f('0x50')]=qs[_0xe03f('0x49')](_[_0xe03f('0x51')](_0x85e20f[_0xe03f('0x48')],_0x558fa2[_0xe03f('0x49')]),_0x5abd60);if(_0x85e20f[_0xe03f('0x48')]['filter']){_0x1b484b['where']=_['merge'](_0x1b484b[_0xe03f('0x50')],{'$or':_[_0xe03f('0x42')](_0x5abd60,function(_0x4888ef){if(_0x4888ef[_0xe03f('0x52')]!==_0xe03f('0x53')){var _0x6b4dca={};_0x6b4dca[_0x4888ef[_0xe03f('0x3f')]]={'$like':'%'+_0x85e20f[_0xe03f('0x48')][_0xe03f('0x54')]+'%'};return _0x6b4dca;}})});}_0x1b484b=_[_0xe03f('0x55')]({},_0x1b484b,_0x85e20f[_0xe03f('0x56')]);var _0xeee97c={'where':_0x1b484b[_0xe03f('0x50')]};return db[_0xe03f('0x43')][_0xe03f('0x36')](_0xeee97c)['then'](function(_0x52e9cd){_0x23ca5a[_0xe03f('0x36')]=_0x52e9cd;if(_0x85e20f[_0xe03f('0x48')][_0xe03f('0x57')]){_0x1b484b[_0xe03f('0x58')]=[{'all':!![]}];}return db[_0xe03f('0x43')]['findAll'](_0x1b484b);})[_0xe03f('0x25')](function(_0x5ae653){_0x23ca5a[_0xe03f('0x59')]=_0x5ae653;return _0x23ca5a;})[_0xe03f('0x25')](respondWithFilteredResult(_0x468e3a,_0x1b484b))[_0xe03f('0x5a')](handleError(_0x468e3a,null));};exports[_0xe03f('0x5b')]=function(_0x1d6e7f,_0x4d974c){var _0x11d486={'raw':![],'where':{'id':_0x1d6e7f[_0xe03f('0x5c')]['id']},'include':[{'model':db[_0xe03f('0x5d')],'as':'mandatoryDispositionPause'}]},_0x15d53b={};_0x15d53b[_0xe03f('0x47')]=_[_0xe03f('0x5e')](db[_0xe03f('0x43')][_0xe03f('0x44')]);_0x15d53b[_0xe03f('0x48')]=_[_0xe03f('0x5e')](_0x1d6e7f['query']);_0x15d53b[_0xe03f('0x49')]=_[_0xe03f('0x4a')](_0x15d53b[_0xe03f('0x47')],_0x15d53b[_0xe03f('0x48')]);_0x11d486[_0xe03f('0x4b')]=_[_0xe03f('0x4a')](_0x15d53b[_0xe03f('0x47')],qs['fields'](_0x1d6e7f[_0xe03f('0x48')]['fields']));_0x11d486[_0xe03f('0x4b')]=_0x11d486[_0xe03f('0x4b')][_0xe03f('0x4d')]?_0x11d486[_0xe03f('0x4b')]:_0x15d53b['model'];if(_0x1d6e7f['query'][_0xe03f('0x57')]){_0x11d486[_0xe03f('0x58')]=[{'all':!![]}];}_0x11d486=_[_0xe03f('0x55')]({},_0x11d486,_0x1d6e7f[_0xe03f('0x56')]);return db['ChatWebsite'][_0xe03f('0x5f')](_0x11d486)['then'](handleEntityNotFound(_0x4d974c,null))[_0xe03f('0x25')](respondWithResult(_0x4d974c,null))['catch'](handleError(_0x4d974c,null));};exports[_0xe03f('0x60')]=function(_0xa19092,_0x3370e9){return db[_0xe03f('0x43')][_0xe03f('0x60')](_0xa19092[_0xe03f('0x61')],{})[_0xe03f('0x25')](function(_0x91863f){var _0x96d233=_0xa19092[_0xe03f('0x62')][_0xe03f('0x63')]({'plain':!![]});if(!_0x96d233)throw new Error(_0xe03f('0x64'));if(_0x96d233[_0xe03f('0x65')]===_0xe03f('0x62')){var _0x2b6035=_0x91863f['get']({'plain':!![]});var _0x13e843=_0xe03f('0x3c');return db[_0xe03f('0x66')][_0xe03f('0x5f')]({'where':{'name':_0x13e843,'userProfileId':_0x96d233['userProfileId']},'raw':!![]})[_0xe03f('0x25')](function(_0x438f05){if(_0x438f05&&_0x438f05[_0xe03f('0x67')]===0x0){return db[_0xe03f('0x68')]['create']({'name':_0x2b6035[_0xe03f('0x3f')],'resourceId':_0x2b6035['id'],'type':_0x438f05[_0xe03f('0x3f')],'sectionId':_0x438f05['id']},{})['then'](function(){return _0x91863f;});}else{return _0x91863f;}})['catch'](function(_0x131d29){logger[_0xe03f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x131d29);throw _0x131d29;});}return _0x91863f;})['then'](respondWithResult(_0x3370e9,0xc9))[_0xe03f('0x5a')](handleError(_0x3370e9,null));};exports['update']=function(_0x3eba41,_0x35b6dd){if(_0x3eba41[_0xe03f('0x61')]['id']){delete _0x3eba41[_0xe03f('0x61')]['id'];}return db['ChatWebsite'][_0xe03f('0x5f')]({'where':{'id':_0x3eba41[_0xe03f('0x5c')]['id']},'include':[{'model':db[_0xe03f('0x5d')],'as':_0xe03f('0x41')}]})['then'](handleEntityNotFound(_0x35b6dd,null))[_0xe03f('0x25')](saveUpdates(_0x3eba41[_0xe03f('0x61')],null))[_0xe03f('0x25')](respondWithResult(_0x35b6dd,null))[_0xe03f('0x5a')](handleError(_0x35b6dd,null));};exports[_0xe03f('0x3d')]=function(_0x5dcb1c,_0x5d2e8e){return db[_0xe03f('0x43')]['find']({'where':{'id':_0x5dcb1c[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x5d2e8e,null))[_0xe03f('0x25')](removeEntity(_0x5d2e8e,null))['catch'](handleError(_0x5d2e8e,null));};exports[_0xe03f('0x69')]=function(_0x2266af,_0x216f3a){return db['ChatWebsite']['describe']()[_0xe03f('0x25')](respondWithResult(_0x216f3a,null))['catch'](handleError(_0x216f3a,null));};exports['addDisposition']=function(_0x5b93c8,_0x374f9a,_0x395d89){if(_0x5b93c8[_0xe03f('0x61')]['id']){delete _0x5b93c8[_0xe03f('0x61')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x5b93c8['params']['id']}})['then'](handleEntityNotFound(_0x374f9a,null))[_0xe03f('0x25')](function(_0x289099){if(_0x289099){_0x5b93c8[_0xe03f('0x61')][_0xe03f('0x6a')]=_0x289099['id'];return db[_0xe03f('0x6b')][_0xe03f('0x60')](_0x5b93c8[_0xe03f('0x61')]);}})[_0xe03f('0x25')](respondWithResult(_0x374f9a,null))['catch'](handleError(_0x374f9a,null));};exports['getDispositions']=function(_0x4dd18d,_0x4ea623,_0x347ed8){var _0x59f28c={'raw':![],'where':{}};var _0xd0f594={};var _0x3b66ff={'count':0x0,'rows':[]};return db[_0xe03f('0x43')][_0xe03f('0x6c')]({'where':{'id':_0x4dd18d['params']['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x4ea623,null))[_0xe03f('0x25')](function(_0x2dc9ed){if(_0x2dc9ed){_0xd0f594['model']=_['keys'](db[_0xe03f('0x6b')]['rawAttributes']);_0xd0f594[_0xe03f('0x48')]=_[_0xe03f('0x5e')](_0x4dd18d[_0xe03f('0x48')]);_0xd0f594[_0xe03f('0x49')]=_['intersection'](_0xd0f594['model'],_0xd0f594[_0xe03f('0x48')]);_0x59f28c[_0xe03f('0x4b')]=_[_0xe03f('0x4a')](_0xd0f594[_0xe03f('0x47')],qs[_0xe03f('0x4c')](_0x4dd18d[_0xe03f('0x48')]['fields']));_0x59f28c[_0xe03f('0x4b')]=_0x59f28c['attributes'][_0xe03f('0x4d')]?_0x59f28c['attributes']:_0xd0f594[_0xe03f('0x47')];if(!_0x4dd18d[_0xe03f('0x48')][_0xe03f('0x4e')](_0xe03f('0x4f'))){_0x59f28c[_0xe03f('0x35')]=qs[_0xe03f('0x35')](_0x4dd18d[_0xe03f('0x48')][_0xe03f('0x35')]);_0x59f28c[_0xe03f('0x33')]=qs[_0xe03f('0x33')](_0x4dd18d[_0xe03f('0x48')][_0xe03f('0x33')]);}_0x59f28c['order']=qs[_0xe03f('0x6d')](_0x4dd18d['query']['sort']);_0x59f28c[_0xe03f('0x50')]=qs['filters'](_[_0xe03f('0x51')](_0x4dd18d[_0xe03f('0x48')],_0xd0f594[_0xe03f('0x49')]));_0x59f28c[_0xe03f('0x50')][_0xe03f('0x6a')]=_0x2dc9ed['id'];if(_0x4dd18d[_0xe03f('0x48')][_0xe03f('0x54')]){_0x59f28c[_0xe03f('0x50')]=_[_0xe03f('0x55')](_0x59f28c[_0xe03f('0x50')],{'$or':_[_0xe03f('0x42')](_0x59f28c[_0xe03f('0x4b')],function(_0x2eb9db){var _0x510437={};_0x510437[_0x2eb9db]={'$like':'%'+_0x4dd18d[_0xe03f('0x48')][_0xe03f('0x54')]+'%'};return _0x510437;})});}_0x59f28c=_['merge']({},_0x59f28c,_0x4dd18d[_0xe03f('0x56')]);return db['Disposition'][_0xe03f('0x36')]({'where':_0x59f28c[_0xe03f('0x50')]})[_0xe03f('0x25')](function(_0x2ad7ee){_0x3b66ff['count']=_0x2ad7ee;if(_0x4dd18d[_0xe03f('0x48')][_0xe03f('0x57')]){_0x59f28c['include']=[{'all':!![]}];}return db[_0xe03f('0x6b')]['findAll'](_0x59f28c);})['then'](function(_0x2fef60){_0x3b66ff[_0xe03f('0x59')]=_0x2fef60;return _0x3b66ff;});}})[_0xe03f('0x25')](respondWithFilteredResult(_0x4ea623,_0x59f28c))['catch'](handleError(_0x4ea623,null));};exports[_0xe03f('0x6e')]=function(_0x44f703,_0x13b774,_0x2dd2b2){return db[_0xe03f('0x43')][_0xe03f('0x5f')]({'where':{'id':_0x44f703[_0xe03f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x13b774,null))[_0xe03f('0x25')](function(_0x4dfafa){if(_0x4dfafa){return _0x4dfafa['removeDispositions'](_0x44f703['query']['ids']);}})[_0xe03f('0x25')](respondWithStatusCode(_0x13b774,null))[_0xe03f('0x5a')](handleError(_0x13b774,null));};exports[_0xe03f('0x6f')]=function(_0x22ec7e,_0x390055,_0x5de7d4){if(_0x22ec7e[_0xe03f('0x61')]['id']){delete _0x22ec7e[_0xe03f('0x61')]['id'];}return db['ChatWebsite'][_0xe03f('0x5f')]({'where':{'id':_0x22ec7e['params']['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x390055,null))[_0xe03f('0x25')](function(_0x13d928){if(_0x13d928){_0x22ec7e[_0xe03f('0x61')][_0xe03f('0x6a')]=_0x13d928['id'];return db[_0xe03f('0x70')][_0xe03f('0x60')](_0x22ec7e[_0xe03f('0x61')]);}})[_0xe03f('0x25')](respondWithResult(_0x390055,null))[_0xe03f('0x5a')](handleError(_0x390055,null));};exports['getAnswers']=function(_0x5c1cbd,_0x22a4e2,_0x2ac303){var _0x9cb54b={'raw':![],'where':{}};var _0x2a22d2={};var _0x59a8df={'count':0x0,'rows':[]};return db[_0xe03f('0x43')]['findOne']({'where':{'id':_0x5c1cbd[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x22a4e2,null))[_0xe03f('0x25')](function(_0x167295){if(_0x167295){_0x2a22d2[_0xe03f('0x47')]=_[_0xe03f('0x5e')](db[_0xe03f('0x70')][_0xe03f('0x44')]);_0x2a22d2[_0xe03f('0x48')]=_['keys'](_0x5c1cbd[_0xe03f('0x48')]);_0x2a22d2[_0xe03f('0x49')]=_[_0xe03f('0x4a')](_0x2a22d2[_0xe03f('0x47')],_0x2a22d2[_0xe03f('0x48')]);_0x9cb54b[_0xe03f('0x4b')]=_['intersection'](_0x2a22d2[_0xe03f('0x47')],qs[_0xe03f('0x4c')](_0x5c1cbd[_0xe03f('0x48')][_0xe03f('0x4c')]));_0x9cb54b[_0xe03f('0x4b')]=_0x9cb54b[_0xe03f('0x4b')]['length']?_0x9cb54b[_0xe03f('0x4b')]:_0x2a22d2[_0xe03f('0x47')];if(!_0x5c1cbd['query'][_0xe03f('0x4e')]('nolimit')){_0x9cb54b['limit']=qs['limit'](_0x5c1cbd['query'][_0xe03f('0x35')]);_0x9cb54b['offset']=qs['offset'](_0x5c1cbd[_0xe03f('0x48')][_0xe03f('0x33')]);}_0x9cb54b[_0xe03f('0x71')]=qs['sort'](_0x5c1cbd[_0xe03f('0x48')][_0xe03f('0x6d')]);_0x9cb54b[_0xe03f('0x50')]=qs[_0xe03f('0x49')](_[_0xe03f('0x51')](_0x5c1cbd[_0xe03f('0x48')],_0x2a22d2[_0xe03f('0x49')]));_0x9cb54b['where'][_0xe03f('0x6a')]=_0x167295['id'];if(_0x5c1cbd[_0xe03f('0x48')][_0xe03f('0x54')]){_0x9cb54b['where']=_[_0xe03f('0x55')](_0x9cb54b[_0xe03f('0x50')],{'$or':_['map'](_0x9cb54b[_0xe03f('0x4b')],function(_0x5190a2){var _0x3b790b={};_0x3b790b[_0x5190a2]={'$like':'%'+_0x5c1cbd[_0xe03f('0x48')][_0xe03f('0x54')]+'%'};return _0x3b790b;})});}_0x9cb54b=_['merge']({},_0x9cb54b,_0x5c1cbd['options']);return db[_0xe03f('0x70')][_0xe03f('0x36')]({'where':_0x9cb54b[_0xe03f('0x50')]})[_0xe03f('0x25')](function(_0x19c83a){_0x59a8df[_0xe03f('0x36')]=_0x19c83a;if(_0x5c1cbd[_0xe03f('0x48')][_0xe03f('0x57')]){_0x9cb54b['include']=[{'all':!![]}];}return db[_0xe03f('0x70')][_0xe03f('0x72')](_0x9cb54b);})[_0xe03f('0x25')](function(_0x489e58){_0x59a8df['rows']=_0x489e58;return _0x59a8df;});}})[_0xe03f('0x25')](respondWithFilteredResult(_0x22a4e2,_0x9cb54b))[_0xe03f('0x5a')](handleError(_0x22a4e2,null));};exports[_0xe03f('0x73')]=function(_0x35ad8c,_0x1d5bc1,_0x4ddf71){return db[_0xe03f('0x43')][_0xe03f('0x5f')]({'where':{'id':_0x35ad8c['params']['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x1d5bc1,null))[_0xe03f('0x25')](function(_0xbcc8b7){if(_0xbcc8b7){return _0xbcc8b7[_0xe03f('0x73')](_0x35ad8c[_0xe03f('0x48')][_0xe03f('0x74')]);}})[_0xe03f('0x25')](respondWithStatusCode(_0x1d5bc1,null))[_0xe03f('0x5a')](handleError(_0x1d5bc1,null));};exports['addLogo']=function(_0x22922b,_0x49ff47,_0x28368d){_0x22922b[_0xe03f('0x61')][_0xe03f('0x75')]=_0x22922b[_0xe03f('0x76')][_0xe03f('0x77')];return db[_0xe03f('0x43')][_0xe03f('0x5f')]({'where':{'id':_0x22922b[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x49ff47,null))[_0xe03f('0x25')](saveUpdates(_0x22922b[_0xe03f('0x61')],null))['then'](respondWithResult(_0x49ff47,null))[_0xe03f('0x5a')](handleError(_0x49ff47,null));};exports[_0xe03f('0x78')]=function(_0x32e65b,_0x3067c1,_0x27e38b){_0x32e65b[_0xe03f('0x61')][_0xe03f('0x79')]=_0x32e65b['file'][_0xe03f('0x77')];return db['ChatWebsite'][_0xe03f('0x5f')]({'where':{'id':_0x32e65b[_0xe03f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3067c1,null))[_0xe03f('0x25')](saveUpdates(_0x32e65b['body'],null))['then'](respondWithResult(_0x3067c1,null))[_0xe03f('0x5a')](handleError(_0x3067c1,null));};exports['addCustomerAvatar']=function(_0x299295,_0x35acd1,_0x1202ca){_0x299295[_0xe03f('0x61')][_0xe03f('0x7a')]=_0x299295[_0xe03f('0x76')][_0xe03f('0x77')];return db[_0xe03f('0x43')][_0xe03f('0x5f')]({'where':{'id':_0x299295[_0xe03f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x35acd1,null))['then'](saveUpdates(_0x299295[_0xe03f('0x61')],null))[_0xe03f('0x25')](respondWithResult(_0x35acd1,null))[_0xe03f('0x5a')](handleError(_0x35acd1,null));};exports[_0xe03f('0x7b')]=function(_0x1b076b,_0x1ed334,_0x462432){_0x1b076b[_0xe03f('0x61')]['systemAvatar']=_0x1b076b[_0xe03f('0x76')][_0xe03f('0x77')];return db['ChatWebsite']['find']({'where':{'id':_0x1b076b[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x1ed334,null))[_0xe03f('0x25')](saveUpdates(_0x1b076b[_0xe03f('0x61')],null))[_0xe03f('0x25')](respondWithResult(_0x1ed334,null))[_0xe03f('0x5a')](handleError(_0x1ed334,null));};exports[_0xe03f('0x7c')]=function(_0x47695c,_0x1df6ca,_0x58fdbc){var _0x2d76a5=path[_0xe03f('0x7d')](config['root'],'server/files/images/logos/default_logo.svg');var _0x3e2115={'where':{'id':_0x47695c[_0xe03f('0x5c')]['id']},'attributes':['id',_0xe03f('0x75')],'raw':!![]};var _0x192ba4=![];return require(_0xe03f('0x1a'))[_0xe03f('0x7e')]()['then'](function(_0x5c188d){if(_0x5c188d){_0x192ba4=_0x5c188d[_0xe03f('0x7f')];}})[_0xe03f('0x25')](function(){return db[_0xe03f('0x43')][_0xe03f('0x5f')](_0x3e2115);})['then'](handleEntityNotFound(_0x1df6ca,null))[_0xe03f('0x25')](function(_0x305581){if(_0x305581){if(!_['isNil'](_0x305581[_0xe03f('0x75')])){if(fs['existsSync'](path[_0xe03f('0x7d')](config[_0xe03f('0x80')],_0xe03f('0x81'),_0x305581[_0xe03f('0x75')]))&&_0x192ba4){_0x2d76a5=path[_0xe03f('0x7d')](config['root'],_0xe03f('0x81'),_0x305581[_0xe03f('0x75')]);}}return _0x1df6ca[_0xe03f('0x82')](_0x2d76a5);}})[_0xe03f('0x5a')](handleError(_0x1df6ca,null));};exports['getAvatar']=function(_0x32b902,_0x147df1,_0x2dccee){var _0xb9839f=path[_0xe03f('0x7d')](config[_0xe03f('0x80')],_0xe03f('0x83'));var _0x1fcb96={'where':{'id':_0x32b902['params']['id']},'attributes':['id',_0xe03f('0x79')],'raw':!![]};return db['ChatWebsite'][_0xe03f('0x5f')](_0x1fcb96)[_0xe03f('0x25')](handleEntityNotFound(_0x147df1,null))[_0xe03f('0x25')](function(_0x4995bc){if(_0x4995bc){if(!_[_0xe03f('0x84')](_0x4995bc['agentAvatar'])){if(fs[_0xe03f('0x85')](path[_0xe03f('0x7d')](config[_0xe03f('0x80')],'server/files/images/avatars/',_0x4995bc['agentAvatar']))){_0xb9839f=path['join'](config[_0xe03f('0x80')],'server/files/images/avatars/',_0x4995bc[_0xe03f('0x79')]);}}return _0x147df1[_0xe03f('0x82')](_0xb9839f);}})[_0xe03f('0x5a')](handleError(_0x147df1,null));};exports[_0xe03f('0x86')]=function(_0x22d3b3,_0x8acddb,_0x5729cd){var _0x1d94ba=path['join'](config[_0xe03f('0x80')],_0xe03f('0x87'));var _0x3ece64={'where':{'id':_0x22d3b3[_0xe03f('0x5c')]['id']},'attributes':['id','customerAvatar',_0xe03f('0x88')],'raw':!![]};return db[_0xe03f('0x43')]['find'](_0x3ece64)[_0xe03f('0x25')](handleEntityNotFound(_0x8acddb,null))[_0xe03f('0x25')](function(_0x5ee5a4){if(_0x5ee5a4){if(!_[_0xe03f('0x84')](_0x5ee5a4[_0xe03f('0x7a')])){if(fs[_0xe03f('0x85')](path[_0xe03f('0x7d')](config[_0xe03f('0x80')],_0xe03f('0x89'),_0x5ee5a4[_0xe03f('0x7a')]))&&_0x5ee5a4[_0xe03f('0x88')]){_0x1d94ba=path['join'](config[_0xe03f('0x80')],_0xe03f('0x89'),_0x5ee5a4['customerAvatar']);}}return _0x8acddb[_0xe03f('0x82')](_0x1d94ba);}})[_0xe03f('0x5a')](handleError(_0x8acddb,null));};exports[_0xe03f('0x8a')]=function(_0x4c703e,_0x54855d,_0x380e39){var _0x2af139=path[_0xe03f('0x7d')](config['root'],_0xe03f('0x8b'));var _0x41a4eb={'where':{'id':_0x4c703e[_0xe03f('0x5c')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xe03f('0x43')][_0xe03f('0x5f')](_0x41a4eb)['then'](handleEntityNotFound(_0x54855d,null))[_0xe03f('0x25')](function(_0x3ebfc4){if(_0x3ebfc4){if(!_[_0xe03f('0x84')](_0x3ebfc4[_0xe03f('0x8c')])){if(fs['existsSync'](path[_0xe03f('0x7d')](config[_0xe03f('0x80')],_0xe03f('0x89'),_0x3ebfc4['systemAvatar']))){_0x2af139=path['join'](config['root'],_0xe03f('0x89'),_0x3ebfc4['systemAvatar']);}}return _0x54855d['download'](_0x2af139);}})[_0xe03f('0x5a')](handleError(_0x54855d,null));};exports[_0xe03f('0x8d')]=function(_0x26efd1,_0x78f64b,_0x2cf515){var _0x32c47c=require(_0xe03f('0x8e'));var _0x8e3598=new _0x32c47c();var _0x1a6b09=_0x8e3598[_0xe03f('0x8f')](_0x26efd1[_0xe03f('0x90')][_0xe03f('0x91')])[_0xe03f('0x92')]();var _0x42776c={'body':_0x26efd1[_0xe03f('0x61')],'channel':_0xe03f('0x93')};var _0x3f1083=[];var _0x296f98=[];var _0x565643={};var _0x7616f5=![];return db['CmContact']['describe']()[_0xe03f('0x25')](function(_0x4d6db2){if(!_0x4d6db2){throw new db[(_0xe03f('0x94'))][(_0xe03f('0x95'))](_0xe03f('0x96'));}_0x3f1083=_[_0xe03f('0x97')](_['keys'](_0x4d6db2),[_0xe03f('0x98'),_0xe03f('0x99')]);_0x296f98=_[_0xe03f('0x97')](_[_0xe03f('0x5e')](_0x4d6db2),['createdAt','updatedAt','CompanyId',_0xe03f('0x9a')]);if(_0x26efd1[_0xe03f('0x61')]['id']){delete _0x26efd1[_0xe03f('0x61')]['id'];}if(_[_0xe03f('0x84')](_0x26efd1[_0xe03f('0x61')]['from'])){throw new db['Sequelize'][(_0xe03f('0x95'))](_0xe03f('0x9b'));}if(_[_0xe03f('0x84')](_0x26efd1[_0xe03f('0x61')]['body'])||_0x26efd1[_0xe03f('0x61')][_0xe03f('0x61')]===''){throw new db[(_0xe03f('0x94'))][(_0xe03f('0x95'))](_0xe03f('0x9c'));}if(_[_0xe03f('0x84')](_0x26efd1[_0xe03f('0x61')][_0xe03f('0x9d')])){throw new db[(_0xe03f('0x94'))][(_0xe03f('0x95'))](_0xe03f('0x9e')+_0x296f98);}if(!_[_0xe03f('0x9f')](_0x296f98,_0x26efd1['body'][_0xe03f('0x9d')])){throw new db[(_0xe03f('0x94'))][(_0xe03f('0x95'))](_0xe03f('0xa0')+_0x296f98);}_0x565643[_0x26efd1[_0xe03f('0x61')]['mapKey']]=_0x26efd1[_0xe03f('0x61')][_0xe03f('0xa1')];})['then'](function(){return db[_0xe03f('0x43')][_0xe03f('0x5f')]({'where':{'id':_0x26efd1['params']['id']},'include':[{'model':db[_0xe03f('0xa2')],'as':'List','include':[{'model':db[_0xe03f('0xa3')],'as':_0xe03f('0xa4'),'where':_0x565643,'limit':0x1,'order':[[_0xe03f('0x99'),_0xe03f('0xa5')]]}]},{'model':db[_0xe03f('0xa6')],'as':_0xe03f('0xa7')}]});})[_0xe03f('0x25')](handleEntityNotFound(_0x78f64b,null))[_0xe03f('0x25')](function(_0x109d13){if(_0x109d13&&_0x109d13[_0xe03f('0xa8')]){_0x42776c[_0xe03f('0xa9')]=_0x109d13;_0x42776c['applications']=_0x109d13[_0xe03f('0xa7')];_0x42776c[_0xe03f('0xaa')]=_0x109d13[_0xe03f('0xa8')];_0x42776c['applications']=_[_0xe03f('0xab')](_0x42776c[_0xe03f('0xac')],[_0xe03f('0xad')],['asc']);if(_0x42776c['account']['Applications']){delete _0x42776c['account'][_0xe03f('0xa7')];}if(_0x42776c[_0xe03f('0xa9')][_0xe03f('0xa8')]&&_0x42776c['account']['List'][_0xe03f('0xa4')][_0xe03f('0x4d')]){return _0x42776c['account'][_0xe03f('0xa8')][_0xe03f('0xa4')][0x0];}var _0x24e495=_[_0xe03f('0x1d')](_0x26efd1[_0xe03f('0x61')],{'firstName':_0x26efd1[_0xe03f('0x61')][_0xe03f('0xa1')],'ListId':_0x109d13['ListId']});_0x24e495[_0x26efd1[_0xe03f('0x61')][_0xe03f('0x9d')]]=_0x26efd1[_0xe03f('0x61')][_0xe03f('0xa1')];return db[_0xe03f('0xa3')][_0xe03f('0x60')](_0x24e495,{'fields':_0x3f1083,'raw':!![]});}})[_0xe03f('0x25')](handleEntityNotFound(_0x78f64b,null))[_0xe03f('0x25')](function(_0x17e3a2){_0x42776c[_0xe03f('0xae')]=_0x17e3a2;var _0x4fa634=_0x26efd1[_0xe03f('0x61')][_0xe03f('0xaf')];if(_0x26efd1[_0xe03f('0x90')][_0xe03f('0xb0')]){_0x4fa634=_0x26efd1[_0xe03f('0x90')][_0xe03f('0xb0')];}else if(_0x26efd1[_0xe03f('0x90')]['x-forwarded-for']){_0x4fa634=_[_0xe03f('0xb1')](_0x26efd1['headers'][_0xe03f('0xb2')][_0xe03f('0xb3')](','));}if(_0x17e3a2){var _0x217f05={'ContactId':_0x17e3a2['id'],'ChatWebsiteId':_0x26efd1[_0xe03f('0x5c')]['id'],'from':(_0x17e3a2[_0xe03f('0xb4')]||'')+'\x20'+(_0x17e3a2[_0xe03f('0xb5')]||''),'customerIp':_0x4fa634,'customerPort':_0x26efd1[_0xe03f('0x90')][_0xe03f('0xb6')]?_0x26efd1[_0xe03f('0x90')]['x-real-port']:null,'referer':_0x26efd1['body']['referer'],'browserName':_0x1a6b09['browser'][_0xe03f('0x3f')]&&_0x1a6b09[_0xe03f('0xb7')][_0xe03f('0xb8')]?util['format'](_0xe03f('0xb9'),_0x1a6b09[_0xe03f('0xb7')][_0xe03f('0x3f')],_0x1a6b09['browser'][_0xe03f('0xb8')]):'unknown','browserVersion':_0x1a6b09['browser'][_0xe03f('0xb8')]||_0xe03f('0xba'),'osName':util[_0xe03f('0xbb')](_0xe03f('0xb9'),_0x1a6b09['os'][_0xe03f('0x3f')],_0x1a6b09['os']['version']),'osVersion':_0x1a6b09['os'][_0xe03f('0xb8')],'deviceModel':_0x1a6b09['device'][_0xe03f('0x47')]&&_0x1a6b09[_0xe03f('0xbc')][_0xe03f('0xbd')]?util[_0xe03f('0xbb')](_0xe03f('0xbe'),_0x1a6b09['device'][_0xe03f('0x47')],_0x1a6b09[_0xe03f('0xbc')]['vendor'],_0x1a6b09[_0xe03f('0xbc')]['type']):null,'deviceVendor':_0x1a6b09['device'][_0xe03f('0xbd')],'deviceType':_0x1a6b09[_0xe03f('0xbc')][_0xe03f('0x52')],'formData':JSON[_0xe03f('0x2a')](_0x26efd1['body'])};var _0x1cfbba={'ChatWebsiteId':_0x26efd1[_0xe03f('0x5c')]['id'],'closed':![]};if(_0x26efd1[_0xe03f('0x61')][_0xe03f('0xbf')]){_0x1cfbba[_0xe03f('0xbf')]=_0x26efd1[_0xe03f('0x61')][_0xe03f('0xbf')];return db[_0xe03f('0xc0')][_0xe03f('0x5f')]({'where':_0x1cfbba})[_0xe03f('0x25')](function(_0x3d1d80){if(_0x3d1d80){return[_0x3d1d80,![]];}_0x217f05[_0xe03f('0xbf')]=_0x26efd1[_0xe03f('0x61')]['threadId'];_0x217f05[_0xe03f('0xc1')]=_0x26efd1[_0xe03f('0x61')][_0xe03f('0xc1')];return db[_0xe03f('0xc0')][_0xe03f('0x60')](_0x217f05)[_0xe03f('0x25')](function(_0x4a4791){return[_0x4a4791,!![]];});});}_0x1cfbba[_0xe03f('0xc2')]=_0x17e3a2['id'];if(_0x26efd1[_0xe03f('0x61')][_0xe03f('0xc3')]&&_0x26efd1[_0xe03f('0x61')]['interaction']['id']){_0x1cfbba['id']=_0x26efd1[_0xe03f('0x61')]['interaction']['id'];return db[_0xe03f('0xc0')]['find']({'where':_0x1cfbba})['then'](function(_0x560cfd){if(_0x560cfd){return[_0x560cfd,![]];}return db[_0xe03f('0xc0')]['create'](_0x217f05)[_0xe03f('0x25')](function(_0x5cc169){return[_0x5cc169,!![]];});});}return db[_0xe03f('0xc0')][_0xe03f('0x60')](_0x217f05)[_0xe03f('0x25')](function(_0x1fa4bd){return[_0x1fa4bd,!![]];});}})[_0xe03f('0xc4')](function(_0x4d7c36,_0x27240a){if(_0x4d7c36){_0x7616f5=_0x27240a;if(!_0x27240a){var _0x32646f={'from':(_0x42776c[_0xe03f('0xae')][_0xe03f('0xb4')]||'')+'\x20'+(_0x42776c[_0xe03f('0xae')][_0xe03f('0xb5')]||'')};if(_0x26efd1[_0xe03f('0x61')][_0xe03f('0xbf')]&&_0x26efd1[_0xe03f('0x61')]['messageId']&&_0x26efd1['body'][_0xe03f('0xbf')]!=_0x26efd1[_0xe03f('0x61')][_0xe03f('0xc5')]){_0x32646f['threadId']=_0x26efd1[_0xe03f('0x61')][_0xe03f('0xc5')];}return _0x4d7c36[_0xe03f('0x3b')](_0x32646f);}else{return _0x4d7c36;}}})[_0xe03f('0x25')](function(_0x3873aa){_0x42776c[_0xe03f('0xc3')]=_0x3873aa[_0xe03f('0x63')]({'plain':!![]});_0x42776c[_0xe03f('0xc3')][_0xe03f('0xc6')]=_0x7616f5;if(_0x42776c[_0xe03f('0xc3')][_0xe03f('0xc6')]){if(_0x42776c[_0xe03f('0xa9')][_0xe03f('0xc7')]){_0x42776c['applications'][_0xe03f('0xc8')]({'id':0x0,'priority':_0x42776c[_0xe03f('0xac')][_0xe03f('0x4d')]+0x1,'app':_0xe03f('0xc9'),'appdata':_0xe03f('0xca'),'interval':_0xe03f('0xcb')});}}return db[_0xe03f('0xcc')][_0xe03f('0x60')]({'body':_0x26efd1[_0xe03f('0x61')]['body'],'ChatWebsiteId':_0x26efd1['params']['id'],'ChatInteractionId':_0x3873aa['id'],'direction':'in','ContactId':_0x42776c[_0xe03f('0xae')]['id'],'AttachmentId':_0x26efd1[_0xe03f('0x61')][_0xe03f('0xcd')]});})['then'](function(_0x24b284){_0x42776c['message']=_0x24b284;if(_0x42776c[_0xe03f('0xc3')][_0xe03f('0xce')]){return db[_0xe03f('0xcf')]['find']({'attributes':['id',_0xe03f('0x3f')],'where':{'id':_0x42776c['interaction'][_0xe03f('0xce')]}})[_0xe03f('0x25')](function(_0x38e13a){if(_0x38e13a){_0x42776c[_0xe03f('0xac')][_0xe03f('0xd0')]({'id':0x0,'priority':0x0,'app':_0xe03f('0xd1'),'appdata':_0x38e13a['name']+','+(_0x42776c[_0xe03f('0xa9')]['waitForTheAssignedAgent']||0xa),'interval':_0xe03f('0xcb')});_0x42776c[_0xe03f('0xd2')]=!![];}return respondWithRpcPromise(_0xe03f('0xd3'),_0xe03f('0xd4'),_0x42776c);});}return respondWithRpcPromise(_0xe03f('0xd3'),_0xe03f('0xd4'),_0x42776c);})[_0xe03f('0x25')](function(_0x49bed6){respondWithRpcPromise(_0xe03f('0xd5'),_0xe03f('0xd5'),{'event':_0xe03f('0x8d'),'message':_0x49bed6},client9002);return _0x49bed6;})['then'](respondWithResult(_0x78f64b,null))[_0xe03f('0x5a')](handleError(_0x78f64b,null));};exports[_0xe03f('0xd6')]=function(_0x450aba,_0x1d059b,_0x540fe2){var _0x2d14f6,_0x1f748c,_0x136b0c;var _0x6908a7=[];var _0x4d9830=[];var _0x1aad51={};var _0x2473fc=_0x450aba['files']||[];var _0x19e37b=[];var _0x33511d;return db[_0xe03f('0xa3')][_0xe03f('0x69')]()['then'](function(_0x5a5d14){if(!_0x5a5d14){throw new db['Sequelize'][(_0xe03f('0x95'))](_0xe03f('0x96'));}_0x4d9830=_[_0xe03f('0x97')](_[_0xe03f('0x5e')](_0x5a5d14),[_0xe03f('0x98'),'updatedAt']);_0x6908a7=_['difference'](_['keys'](_0x5a5d14),[_0xe03f('0x98'),_0xe03f('0x99'),_0xe03f('0xd7'),_0xe03f('0x9a')]);if(_0x450aba[_0xe03f('0x61')]['id']){delete _0x450aba[_0xe03f('0x61')]['id'];}if(_[_0xe03f('0x84')](_0x450aba[_0xe03f('0x61')][_0xe03f('0xa1')])){throw _0x1d059b[_0xe03f('0x31')](0x1f4)[_0xe03f('0xd8')](new db[(_0xe03f('0x94'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x450aba['body'][_0xe03f('0x61')])||_0x450aba['body'][_0xe03f('0x61')]===''){throw _0x1d059b[_0xe03f('0x31')](0x1f4)['send'](new db[(_0xe03f('0x94'))][(_0xe03f('0x95'))](_0xe03f('0x9c')));}if(_[_0xe03f('0x84')](_0x450aba[_0xe03f('0x61')][_0xe03f('0xd9')])){throw _0x1d059b['status'](0x1f4)[_0xe03f('0xd8')](new db['Sequelize'][(_0xe03f('0x95'))](_0xe03f('0xda')+_0x6908a7));}if(!_[_0xe03f('0x9f')](_0x6908a7,_0x450aba[_0xe03f('0x61')][_0xe03f('0xd9')])){throw _0x1d059b[_0xe03f('0x31')](0x1f4)[_0xe03f('0xd8')](new db[(_0xe03f('0x94'))][(_0xe03f('0x95'))](_0xe03f('0xdb')+_0x6908a7));}_0x1aad51[_0x450aba[_0xe03f('0x61')]['mapKeyOffline']]=_0x450aba[_0xe03f('0x61')][_0xe03f('0xa1')];})[_0xe03f('0x25')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x450aba['params']['id']},'include':[{'model':db[_0xe03f('0xa2')],'as':_0xe03f('0xa8')},{'model':db[_0xe03f('0xdc')],'as':_0xe03f('0xdc')}]});})[_0xe03f('0x25')](handleEntityNotFound(_0x1d059b,null))[_0xe03f('0x25')](function(_0x34c4c2){if(_0x34c4c2&&_0x34c4c2[_0xe03f('0xa8')]){_0x1f748c=_0x34c4c2;var _0x4fe45e=_[_0xe03f('0x1d')](_0x450aba[_0xe03f('0x61')],{'firstName':_0x450aba['body']['from'],'phone':_0x450aba[_0xe03f('0x61')][_0xe03f('0xa1')],'ListId':_0x34c4c2[_0xe03f('0x9a')]});_0x4fe45e[_0x450aba['body'][_0xe03f('0xd9')]]=_0x450aba['body'][_0xe03f('0xa1')];return db[_0xe03f('0xa3')][_0xe03f('0xdd')]({'where':_0x1aad51,'defaults':_0x4fe45e});}})[_0xe03f('0xc4')](function(_0x47b147){if(_0x47b147){_0x136b0c=_0x47b147;var _0x2d80c4=fs[_0xe03f('0xde')](path[_0xe03f('0x7d')](config[_0xe03f('0x80')],_0xe03f('0xdf')),_0xe03f('0xe0'));var _0x43a02f=ejs[_0xe03f('0xe1')](_0x2d80c4,{'body':_[_0xe03f('0xe2')](_0x450aba[_0xe03f('0x61')][_0xe03f('0x61')]),'bodyTitle':_0x1f748c[_0xe03f('0xe3')]});return db[_0xe03f('0xe4')][_0xe03f('0x60')]({'body':_0x43a02f,'ContactId':_0x47b147['id'],'ChatWebsiteId':_0x1f748c['id']});}})[_0xe03f('0x25')](function(_0x26ebed){_0x33511d=_0x26ebed;if(_0x2473fc[_0xe03f('0x4d')]){var _0x4fdb29=_0x2473fc['map'](function(_0xe2d2d0){return{'name':_0xe2d2d0[_0xe03f('0xe5')],'basename':_0xe2d2d0[_0xe03f('0x77')],'type':_0xe2d2d0['mimetype'],'ChatOfflineMessageId':_0x26ebed['id']};});_0x19e37b=_0x4fdb29['map'](_0x5132f7=>{var _0x2b4286={'filename':_0x5132f7['name'],'path':path['join'](config[_0xe03f('0x80')],_0xe03f('0xe6'),_0xe03f('0xe7'),_0xe03f('0xe8'),_0xe03f('0xe9'),_0x5132f7[_0xe03f('0xea')])};return _0x2b4286;});if(!_0x1f748c[_0xe03f('0xeb')]){return db[_0xe03f('0xec')]['transaction'](function(_0x57278c){return db['Attachment'][_0xe03f('0xed')](_0x4fdb29,{'transaction':_0x57278c});});}}})['then'](function(){if(_0x33511d){_0x2d14f6=_0x33511d;return db[_0xe03f('0xdc')][_0xe03f('0x6c')]({'where':{'active':!![]},'include':[{'model':db[_0xe03f('0xee')],'as':_0xe03f('0xef'),'raw':!![]}]});}})['then'](function(_0x406494){if(_0x406494&&_0x406494[_0xe03f('0xef')]&&_0x1f748c[_0xe03f('0xf0')]&&_0x1f748c[_0xe03f('0xf1')]){var _0x9ca17a={'tls':{'rejectUnauthorized':![]}};if(_0x406494[_0xe03f('0xef')][_0xe03f('0xf2')]){_0x9ca17a[_0xe03f('0xf2')]=_0x406494[_0xe03f('0xef')][_0xe03f('0xf2')];}else{_0x9ca17a['host']=_0x406494[_0xe03f('0xef')][_0xe03f('0xf3')];_0x9ca17a[_0xe03f('0xf4')]=_0x406494[_0xe03f('0xef')][_0xe03f('0xf4')];_0x9ca17a[_0xe03f('0xf5')]=_0x406494[_0xe03f('0xef')]['secure'];}if(_0x406494['Smtp']['authentication']){_0x9ca17a['auth']={'user':_0x406494['Smtp']['user'],'pass':_0x406494[_0xe03f('0xef')][_0xe03f('0xf6')]};}return respondWithRpcPromise(_0xe03f('0xf7'),'sendMail',{'account':_0x9ca17a,'message':{'from':util[_0xe03f('0xbb')](_0xe03f('0xf8'),_0x406494[_0xe03f('0x3f')],_0x406494[_0xe03f('0xf9')]||_0x406494[_0xe03f('0xef')][_0xe03f('0x62')]),'to':_0x1f748c['forwardOfflineAddress'],'subject':_0x1f748c[_0xe03f('0xfa')],'html':_0x2d14f6[_0xe03f('0x61')],'attachments':_0x19e37b}},client9003)[_0xe03f('0x25')](function(){return _0x2d14f6;})[_0xe03f('0x5a')](function(_0x3c6d9d){console[_0xe03f('0x2b')](_0x3c6d9d);});}})[_0xe03f('0x25')](function(){if(_0x1f748c&&_0x1f748c[_0xe03f('0xeb')]&&_0x1f748c[_0xe03f('0xfb')]){var _0x3a65da=[];if(_0x2473fc[_0xe03f('0x4d')]){_0x3a65da=_0x2473fc['map'](function(_0xb7c74e){return{'name':_0xb7c74e[_0xe03f('0xe5')],'basename':_0xb7c74e[_0xe03f('0x77')],'type':_0xb7c74e[_0xe03f('0xfc')],'ChatOfflineMessageId':_0x33511d['id']};});}var _0x289887;if(!_['isNil'](_0x1f748c[_0xe03f('0xfd')])){var _0x2b1b31=_[_0xe03f('0x42')](_0x450aba[_0xe03f('0x61')],function(_0x36e1ff){return _0x36e1ff;});var _0x352a95=_['toPairsIn'](_0x2b1b31)[0x0];var _0x55b9a3=_['mapValues'](_0x352a95,function(_0x48b903){return _0x48b903;});_0x289887=_0x55b9a3[0x1][_0x1f748c[_0xe03f('0xfd')]];}var _0x273a31={'from':_0x136b0c[_0xe03f('0xf9')],'firstName':_0x136b0c[_0xe03f('0xb4')],'lastName':_0x136b0c[_0xe03f('0xb5')],'mapKey':'email','message':{'from':_0x136b0c[_0xe03f('0xf9')],'to':_0x1f748c[_0xe03f('0xdc')]['email'],'cc':'','subject':_[_0xe03f('0x84')](_0x289887)?_0x1f748c[_0xe03f('0xfa')]:_0x289887,'messageId':'','sentAt':new Date(),'attach':_0x3a65da[_0xe03f('0x4d')],'attachments':_0x3a65da,'originChannel':'Chat','ChatWebsiteId':_0x1f748c['id'],'ChatOfflineMessageId':_0x2d14f6['id'],'originTo':_0x1f748c[_0xe03f('0xdc')]['email']},'body':_0x2d14f6[_0xe03f('0x61')]};var _0x1c7126={'account':{'id':_0x1f748c['MailAccountId']},'body':_0x273a31,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xe03f('0xfe'),'notifyMail',_0x1c7126,client9001)[_0xe03f('0x25')](function(){return _0x2d14f6;})[_0xe03f('0x5a')](function(_0x5d667c){console[_0xe03f('0x2b')](_0x5d667c);});}return;})[_0xe03f('0x25')](function(){if(_0x2d14f6){return _0x2d14f6;}})[_0xe03f('0x25')](respondWithResult(_0x1d059b,null))['catch'](function(_0x2a887d){console[_0xe03f('0x2b')](_0xe03f('0x5a'),_0x2a887d);for(var _0x1c68a3 of _0x2473fc){var _0x4925b8=path[_0xe03f('0x7d')](config[_0xe03f('0x80')],'server',_0xe03f('0xe7'),_0xe03f('0xe8'),_0xe03f('0xe9'),_0x1c68a3['filename']);fs_extra[_0xe03f('0xff')](_0x4925b8)[_0xe03f('0x5a')](function(_0x223186){console['error'](_0xe03f('0x100'),_0x4925b8,_0x223186);});}});};exports['addInteraction']=function(_0x52767d,_0x17ea1e,_0x162ffd){return db[_0xe03f('0xc0')][_0xe03f('0x5f')]({'where':{'id':_0x52767d[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x17ea1e,null))[_0xe03f('0x25')](function(_0x304043){if(_0x304043){return _0x304043[_0xe03f('0x101')](_0x52767d['body'][_0xe03f('0x74')],_[_0xe03f('0x102')](_0x52767d[_0xe03f('0x61')],[_0xe03f('0x74'),'id'])||{});}})[_0xe03f('0x25')](respondWithResult(_0x17ea1e,null))['catch'](handleError(_0x17ea1e,null));};exports[_0xe03f('0x103')]=function(_0x5acac2,_0x265407,_0x87b17b){var _0x15b145={'raw':![],'where':{}};var _0x42767f={};var _0x47b755={'count':0x0,'rows':[]};return db[_0xe03f('0x43')]['findOne']({'where':{'id':_0x5acac2[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x265407,null))[_0xe03f('0x25')](function(_0x5791c5){if(_0x5791c5){_0x42767f[_0xe03f('0x47')]=_[_0xe03f('0x5e')](db[_0xe03f('0xc0')][_0xe03f('0x44')]);_0x42767f[_0xe03f('0x48')]=_[_0xe03f('0x5e')](_0x5acac2['query']);_0x42767f[_0xe03f('0x49')]=_[_0xe03f('0x4a')](_0x42767f[_0xe03f('0x47')],_0x42767f['query']);_0x15b145[_0xe03f('0x4b')]=_[_0xe03f('0x4a')](_0x42767f[_0xe03f('0x47')],qs[_0xe03f('0x4c')](_0x5acac2[_0xe03f('0x48')][_0xe03f('0x4c')]));_0x15b145['attributes']=_0x15b145[_0xe03f('0x4b')][_0xe03f('0x4d')]?_0x15b145[_0xe03f('0x4b')]:_0x42767f[_0xe03f('0x47')];if(!_0x5acac2['query'][_0xe03f('0x4e')](_0xe03f('0x4f'))){_0x15b145[_0xe03f('0x35')]=qs[_0xe03f('0x35')](_0x5acac2['query'][_0xe03f('0x35')]);_0x15b145[_0xe03f('0x33')]=qs[_0xe03f('0x33')](_0x5acac2[_0xe03f('0x48')][_0xe03f('0x33')]);}_0x15b145[_0xe03f('0x71')]=qs[_0xe03f('0x6d')](_0x5acac2[_0xe03f('0x48')][_0xe03f('0x6d')]);_0x15b145[_0xe03f('0x50')]=qs[_0xe03f('0x49')](_['pick'](_0x5acac2['query'],_0x42767f[_0xe03f('0x49')]));_0x15b145[_0xe03f('0x50')][_0xe03f('0x6a')]=_0x5791c5['id'];if(_0x5acac2[_0xe03f('0x48')][_0xe03f('0x54')]){_0x15b145[_0xe03f('0x50')]=_[_0xe03f('0x55')](_0x15b145[_0xe03f('0x50')],{'$or':_[_0xe03f('0x42')](_0x15b145['attributes'],function(_0x80cc58){var _0x350384={};_0x350384[_0x80cc58]={'$like':'%'+_0x5acac2['query'][_0xe03f('0x54')]+'%'};return _0x350384;})});}_0x15b145=_['merge']({},_0x15b145,_0x5acac2[_0xe03f('0x56')]);return db['ChatInteraction']['count']({'where':_0x15b145[_0xe03f('0x50')]})[_0xe03f('0x25')](function(_0x2e8c26){_0x47b755['count']=_0x2e8c26;if(_0x5acac2[_0xe03f('0x48')][_0xe03f('0x57')]){_0x15b145[_0xe03f('0x58')]=[{'model':db[_0xe03f('0xa3')],'as':_0xe03f('0x104'),'required':![]},{'model':db[_0xe03f('0xcf')],'as':_0xe03f('0x105'),'attributes':[_0xe03f('0x3f'),_0xe03f('0x106'),'internal'],'required':![]},{'model':db[_0xe03f('0x107')],'as':_0xe03f('0x108'),'attributes':['id',_0xe03f('0x3f'),'color'],'where':_0x5acac2['query'][_0xe03f('0x109')]?{'id':_0x5acac2[_0xe03f('0x48')][_0xe03f('0x109')]}:undefined,'required':_0x5acac2[_0xe03f('0x48')][_0xe03f('0x109')]?!![]:![]}];}return db[_0xe03f('0xc0')][_0xe03f('0x72')](_0x15b145);})['then'](function(_0x5ab1d7){_0x47b755[_0xe03f('0x59')]=_0x5ab1d7;return _0x47b755;});}})[_0xe03f('0x25')](respondWithFilteredResult(_0x265407,_0x15b145))[_0xe03f('0x5a')](handleError(_0x265407,null));};function iftimePromise(_0x223b1f,_0xcf091a){return respondWithRpcPromise(_0xe03f('0x10a'),_0xe03f('0x10b'),{'command':_0xcf091a[_0xe03f('0x10c')]?util[_0xe03f('0xbb')](_0xe03f('0x10d'),_0x223b1f[_0xe03f('0x10e')],_0xcf091a['timezone']):util[_0xe03f('0xbb')](_0xe03f('0x10f'),_0x223b1f[_0xe03f('0x10e')])},client9002)['then'](function(_0x217789){var _0x254444=_0x217789&&_0x217789['indexOf']('true')>=0x0?!![]:![];logger[_0xe03f('0x26')](_0xe03f('0x110'),_0xcf091a['id'],_0x223b1f['id'],_0x223b1f[_0xe03f('0x10e')],_0x254444?_0xe03f('0x111'):_0xe03f('0x112'),_0xcf091a[_0xe03f('0x10c')]?_0xcf091a[_0xe03f('0x10c')]:'No\x20timezone');return _0x254444;})['catch'](function(_0x17e5a8){logger[_0xe03f('0x2b')](_0xe03f('0x110'),_0xcf091a['id'],_0x223b1f['id'],_0x223b1f['interval'],util[_0xe03f('0x113')](_0x17e5a8,{'showHidden':![],'depth':null}),_0xcf091a['timezone']?_0xcf091a[_0xe03f('0x10c')]:_0xe03f('0x114'));return![];});}exports[_0xe03f('0x10b')]=function(_0x40fe22,_0x5c8b12,_0x1f48ba){var _0x23a1d6=0x0;var _0x24024e=0x0;var _0x2da007=![];var _0x548430;var _0x25fb65;return db['ChatWebsite'][_0xe03f('0x5f')]({'where':{'id':_0x40fe22['params']['id']},'include':[{'model':db[_0xe03f('0x115')],'as':_0xe03f('0x115'),'include':[{'model':db[_0xe03f('0x115')],'as':_0xe03f('0x116'),'attributes':['id',_0xe03f('0x10e')],'raw':!![]}]}]})[_0xe03f('0x25')](handleEntityNotFound(_0x5c8b12,null))[_0xe03f('0x25')](function(_0x9d39cb){if(_0x9d39cb){_0x548430=_0x9d39cb;return _0x9d39cb[_0xe03f('0x117')]({'raw':!![]});}})['then'](function(_0x3a6833){if(_0x548430){if(_0x3a6833){_0x25fb65=_0x3a6833;}}return require(_0xe03f('0x1a'))[_0xe03f('0x7e')]();})['then'](function(_0x2f5738){if(_0x2f5738){_0x24024e=_0x2f5738[_0xe03f('0x118')];_0x2da007=_0x2f5738[_0xe03f('0x7f')];}})['then'](function(){return db[_0xe03f('0xc0')]['count']({'where':{'closed':![]}});})[_0xe03f('0x25')](function(_0xc5fd6){_0x23a1d6=_0xc5fd6;if(_0x24024e&&_0xc5fd6>_0x24024e){return db[_0xe03f('0x119')]['findOne']({'where':{'id':0x1}})['then'](function(_0x4eb2fe){if(_0x4eb2fe){_0x4eb2fe['increment']('chatLicenseExceeded');}});}})[_0xe03f('0x25')](function(){if(_0x548430[_0xe03f('0x115')]&&_0x548430[_0xe03f('0x115')][_0xe03f('0x116')]){var _0x5a41d5=[];for(var _0x3592da=0x0;_0x3592da<_0x548430[_0xe03f('0x115')][_0xe03f('0x116')][_0xe03f('0x4d')];_0x3592da++){var _0x487656=_0x548430[_0xe03f('0x115')][_0xe03f('0x116')][_0x3592da][_0xe03f('0x63')]({'plain':!![]});_0x5a41d5[_0xe03f('0xc8')](iftimePromise(_0x487656,_0x548430));}return BPromise[_0xe03f('0x11a')](_0x5a41d5)[_0xe03f('0x25')](function(_0x1fa1b6){return _[_0xe03f('0x11b')](_0x1fa1b6);});}else{return!![];}})['then'](function(_0x203f4a){var _0xa9147b=fs[_0xe03f('0xde')](path[_0xe03f('0x7d')](config[_0xe03f('0x80')],_0xe03f('0x11c')),_0xe03f('0xe0'));var _0x3a8030={'remote':_0x548430[_0xe03f('0x11d')],'query':querystring[_0xe03f('0x2a')](_[_0xe03f('0x55')](_0x548430[_0xe03f('0x63')]({'plain':!![]}),{'customerIp':_0x40fe22[_0xe03f('0x90')][_0xe03f('0xb2')]||_0x40fe22[_0xe03f('0x90')][_0xe03f('0x11e')]||_0x40fe22[_0xe03f('0x11f')][_0xe03f('0x120')]||_0x40fe22['ip'],'referer':_0x40fe22['headers'][_0xe03f('0x121')],'openedInteractions':_0x23a1d6,'maxInteractions':_0x24024e,'virtual':_0x2da007['virtual'],'online':_0x203f4a,'custom':_0x2da007}))[_0xe03f('0x122')](/'/g,'\x5c\x27')};_0x5c8b12[_0xe03f('0xd8')](ejs['render'](Mustache[_0xe03f('0xe1')](_0xa9147b,_0x3a8030),{'proactiveActions':_0x25fb65,'alignment':_0x548430[_0xe03f('0x123')],'verticalAlignment':_0x548430['verticalAlignment'],'div_color':_0x548430[_0xe03f('0x124')],'text_color':_0x548430['textColor'],'button_color':_0x548430[_0xe03f('0x125')],'background_color':_0x548430['backgroundColor']}));})[_0xe03f('0x5a')](handleError(_0x5c8b12,null));};exports[_0xe03f('0x126')]=function(_0x4358a9,_0x1173dc,_0x2ecbca){return db[_0xe03f('0x43')][_0xe03f('0x6c')]({'where':{'id':_0x4358a9['params']['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x1173dc,null))[_0xe03f('0x25')](function(_0x49a215){if(_0x49a215){return db['sequelize'][_0xe03f('0x127')](function(_0x3a8b1f){return db[_0xe03f('0xa6')][_0xe03f('0x3d')]({'where':{'ChatWebsiteId':_0x4358a9[_0xe03f('0x5c')]['id']},'transaction':_0x3a8b1f})[_0xe03f('0x25')](function(_0x194a16){var _0x4d606e=_[_0xe03f('0x42')](_0x4358a9[_0xe03f('0x61')],function(_0x171bbd){_0x171bbd['ChatWebsiteId']=_0x4358a9[_0xe03f('0x5c')]['id'];return _0x171bbd;});return db[_0xe03f('0xa6')]['bulkCreate'](_0x4d606e,{'transaction':_0x3a8b1f});});})['then'](function(){return db[_0xe03f('0xa6')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x4358a9[_0xe03f('0x5c')]['id']},'order':_0xe03f('0xad')});});}})[_0xe03f('0x25')](respondWithResult(_0x1173dc,null))[_0xe03f('0x5a')](handleError(_0x1173dc,null));};exports[_0xe03f('0x128')]=function(_0x4362cc,_0x409a97,_0x4e0235){var _0x39ed6f={};var _0x3a9dcf={};var _0xb5b9b9;var _0x4f2091;return db['ChatWebsite'][_0xe03f('0x6c')]({'where':{'id':_0x4362cc[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x409a97,null))[_0xe03f('0x25')](function(_0x489246){if(_0x489246){_0xb5b9b9=_0x489246;_0x3a9dcf[_0xe03f('0x47')]=_[_0xe03f('0x5e')](db[_0xe03f('0xa6')]['rawAttributes']);_0x3a9dcf[_0xe03f('0x48')]=_[_0xe03f('0x5e')](_0x4362cc['query']);_0x3a9dcf[_0xe03f('0x49')]=_['intersection'](_0x3a9dcf[_0xe03f('0x47')],_0x3a9dcf[_0xe03f('0x48')]);_0x39ed6f['attributes']=_[_0xe03f('0x4a')](_0x3a9dcf[_0xe03f('0x47')],qs[_0xe03f('0x4c')](_0x4362cc[_0xe03f('0x48')][_0xe03f('0x4c')]));_0x39ed6f[_0xe03f('0x4b')]=_0x39ed6f[_0xe03f('0x4b')][_0xe03f('0x4d')]?_0x39ed6f[_0xe03f('0x4b')]:_0x3a9dcf['model'];_0x39ed6f[_0xe03f('0x71')]=qs[_0xe03f('0x6d')](_0x4362cc['query'][_0xe03f('0x6d')]);_0x39ed6f[_0xe03f('0x50')]=qs['filters'](_['pick'](_0x4362cc[_0xe03f('0x48')],_0x3a9dcf[_0xe03f('0x49')]));if(_0x4362cc[_0xe03f('0x48')][_0xe03f('0x54')]){_0x39ed6f[_0xe03f('0x50')]=_['merge'](_0x39ed6f['where'],{'$or':_['map'](_0x39ed6f['attributes'],function(_0x41bf11){var _0xab4684={};_0xab4684[_0x41bf11]={'$like':'%'+_0x4362cc[_0xe03f('0x48')]['filter']+'%'};return _0xab4684;})});}_0x39ed6f=_[_0xe03f('0x55')]({},_0x39ed6f,_0x4362cc[_0xe03f('0x56')]);return _0xb5b9b9[_0xe03f('0x128')](_0x39ed6f);}})[_0xe03f('0x25')](function(_0x22678c){if(_0x22678c){_0x4f2091=_0x22678c[_0xe03f('0x4d')];if(!_0x4362cc[_0xe03f('0x48')]['hasOwnProperty'](_0xe03f('0x4f'))){_0x39ed6f['limit']=qs['limit'](_0x4362cc[_0xe03f('0x48')][_0xe03f('0x35')]);_0x39ed6f[_0xe03f('0x33')]=qs[_0xe03f('0x33')](_0x4362cc[_0xe03f('0x48')][_0xe03f('0x33')]);}return _0xb5b9b9[_0xe03f('0x128')](_0x39ed6f);}})['then'](function(_0x1c5ee0){if(_0x1c5ee0){return _0x1c5ee0?{'count':_0x4f2091,'rows':_0x1c5ee0}:null;}})['then'](respondWithResult(_0x409a97,null))[_0xe03f('0x5a')](handleError(_0x409a97,null));};exports[_0xe03f('0x129')]=function(_0x389486,_0xa828db,_0x2a794f){return db[_0xe03f('0x12a')]['find']({'where':{'id':_0x389486[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0xa828db,null))[_0xe03f('0x25')](function(_0x5b4cab){if(_0x5b4cab){return _0x5b4cab[_0xe03f('0x129')](_0x389486[_0xe03f('0x61')][_0xe03f('0x74')],_[_0xe03f('0x102')](_0x389486[_0xe03f('0x61')],[_0xe03f('0x74'),'id'])||{});}})[_0xe03f('0x25')](respondWithResult(_0xa828db,null))['catch'](handleError(_0xa828db,null));};exports['getProactiveActions']=function(_0x5066d4,_0x3d7204,_0x3ff2f6){var _0x470881={};var _0x128f43={};var _0x3cf889;var _0x30030c;return db[_0xe03f('0x43')][_0xe03f('0x6c')]({'where':{'id':_0x5066d4[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x3d7204,null))[_0xe03f('0x25')](function(_0x212904){if(_0x212904){_0x3cf889=_0x212904;_0x128f43[_0xe03f('0x47')]=_[_0xe03f('0x5e')](db[_0xe03f('0x12b')][_0xe03f('0x44')]);_0x128f43[_0xe03f('0x48')]=_[_0xe03f('0x5e')](_0x5066d4[_0xe03f('0x48')]);_0x128f43[_0xe03f('0x49')]=_[_0xe03f('0x4a')](_0x128f43['model'],_0x128f43['query']);_0x470881['attributes']=_['intersection'](_0x128f43['model'],qs['fields'](_0x5066d4[_0xe03f('0x48')][_0xe03f('0x4c')]));_0x470881[_0xe03f('0x4b')]=_0x470881[_0xe03f('0x4b')][_0xe03f('0x4d')]?_0x470881['attributes']:_0x128f43['model'];_0x470881[_0xe03f('0x71')]=qs['sort'](_0x5066d4[_0xe03f('0x48')][_0xe03f('0x6d')]);_0x470881['where']=qs[_0xe03f('0x49')](_[_0xe03f('0x51')](_0x5066d4[_0xe03f('0x48')],_0x128f43['filters']));if(_0x5066d4[_0xe03f('0x48')][_0xe03f('0x54')]){_0x470881[_0xe03f('0x50')]=_['merge'](_0x470881[_0xe03f('0x50')],{'$or':_['map'](_0x470881[_0xe03f('0x4b')],function(_0x585664){var _0x64a56d={};_0x64a56d[_0x585664]={'$like':'%'+_0x5066d4[_0xe03f('0x48')][_0xe03f('0x54')]+'%'};return _0x64a56d;})});}_0x470881=_[_0xe03f('0x55')]({},_0x470881,_0x5066d4[_0xe03f('0x56')]);return _0x3cf889[_0xe03f('0x117')](_0x470881);}})[_0xe03f('0x25')](function(_0x21ab8b){if(_0x21ab8b){_0x30030c=_0x21ab8b[_0xe03f('0x4d')];if(!_0x5066d4[_0xe03f('0x48')]['hasOwnProperty'](_0xe03f('0x4f'))){_0x470881[_0xe03f('0x35')]=qs['limit'](_0x5066d4[_0xe03f('0x48')]['limit']);_0x470881[_0xe03f('0x33')]=qs['offset'](_0x5066d4[_0xe03f('0x48')][_0xe03f('0x33')]);}return _0x3cf889[_0xe03f('0x117')](_0x470881);}})['then'](function(_0x131b15){if(_0x131b15){return _0x131b15?{'count':_0x30030c,'rows':_0x131b15}:null;}})[_0xe03f('0x25')](respondWithResult(_0x3d7204,null))[_0xe03f('0x5a')](handleError(_0x3d7204,null));};exports['getFields']=function(_0x28cbb9,_0x2bf131,_0x474e06){var _0x5ca8b2=_0x28cbb9[_0xe03f('0x48')][_0xe03f('0x12c')]===_0xe03f('0x12d')?'offlineForm':_0xe03f('0x12e');return db[_0xe03f('0x43')][_0xe03f('0x5f')]({'attributes':['id',_0x5ca8b2],'where':{'id':_0x28cbb9['params']['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x2bf131,null))['then'](function(_0x12bf11){if(_0x12bf11){var _0x35af04=_0x12bf11[_0x5ca8b2];var _0x1c0179=_0x35af04&&_0x35af04[_0xe03f('0x12f')]?_0x35af04[_0xe03f('0x12f')]:[];_0x2bf131[_0xe03f('0xd8')]({'fromKey':_[_0xe03f('0x84')](_0x35af04[_0xe03f('0x130')])?undefined:_0x35af04[_0xe03f('0x130')],'count':_0x1c0179[_0xe03f('0x4d')],'rows':_0x1c0179});}})[_0xe03f('0x5a')](handleError(_0x2bf131,null));};exports['getOfflineMessages']=function(_0x5ab8dc,_0x1d34e6,_0x2dc7ee){var _0x298b5e={'raw':![],'where':{}};var _0x3dbdf1={};var _0x3a2d24={'count':0x0,'rows':[]};return db[_0xe03f('0x43')][_0xe03f('0x6c')]({'where':{'id':_0x5ab8dc[_0xe03f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d34e6,null))[_0xe03f('0x25')](function(_0x1b01ce){if(_0x1b01ce){_0x3dbdf1[_0xe03f('0x47')]=_[_0xe03f('0x5e')](db[_0xe03f('0xe4')][_0xe03f('0x44')]);_0x3dbdf1[_0xe03f('0x48')]=_['keys'](_0x5ab8dc[_0xe03f('0x48')]);_0x3dbdf1[_0xe03f('0x49')]=_[_0xe03f('0x4a')](_0x3dbdf1[_0xe03f('0x47')],_0x3dbdf1[_0xe03f('0x48')]);_0x298b5e[_0xe03f('0x4b')]=_[_0xe03f('0x4a')](_0x3dbdf1['model'],qs[_0xe03f('0x4c')](_0x5ab8dc[_0xe03f('0x48')][_0xe03f('0x4c')]));_0x298b5e[_0xe03f('0x4b')]=_0x298b5e['attributes']['length']?_0x298b5e[_0xe03f('0x4b')]:_0x3dbdf1[_0xe03f('0x47')];if(!_0x5ab8dc['query']['hasOwnProperty'](_0xe03f('0x4f'))){_0x298b5e[_0xe03f('0x35')]=qs[_0xe03f('0x35')](_0x5ab8dc[_0xe03f('0x48')][_0xe03f('0x35')]);_0x298b5e[_0xe03f('0x33')]=qs[_0xe03f('0x33')](_0x5ab8dc[_0xe03f('0x48')][_0xe03f('0x33')]);}_0x298b5e['order']=qs['sort'](_0x5ab8dc[_0xe03f('0x48')][_0xe03f('0x6d')]);_0x298b5e[_0xe03f('0x50')]=qs[_0xe03f('0x49')](_['pick'](_0x5ab8dc['query'],_0x3dbdf1['filters']));_0x298b5e[_0xe03f('0x50')][_0xe03f('0x6a')]=_0x1b01ce['id'];if(_0x5ab8dc[_0xe03f('0x48')][_0xe03f('0x54')]){_0x298b5e[_0xe03f('0x50')]=_[_0xe03f('0x55')](_0x298b5e[_0xe03f('0x50')],{'$or':_[_0xe03f('0x42')](_0x298b5e['attributes'],function(_0x31b5cc){var _0xfd7ff9={};_0xfd7ff9[_0x31b5cc]={'$like':'%'+_0x5ab8dc[_0xe03f('0x48')]['filter']+'%'};return _0xfd7ff9;})});}_0x298b5e=_['merge']({},_0x298b5e,_0x5ab8dc['options']);return db['ChatOfflineMessage'][_0xe03f('0x36')]({'where':_0x298b5e['where']})[_0xe03f('0x25')](function(_0x569229){_0x3a2d24[_0xe03f('0x36')]=_0x569229;if(_0x5ab8dc[_0xe03f('0x48')][_0xe03f('0x57')]){_0x298b5e['include']=[{'all':!![]}];}else{_0x298b5e[_0xe03f('0x58')]=[{'model':db['CmContact'],'as':_0xe03f('0x104'),'required':![]},{'model':db[_0xe03f('0x131')],'as':_0xe03f('0x132'),'required':![]}];}return db[_0xe03f('0xe4')][_0xe03f('0x72')](_0x298b5e);})[_0xe03f('0x25')](function(_0x23456b){_0x3a2d24[_0xe03f('0x59')]=_0x23456b;return _0x3a2d24;});}})['then'](respondWithFilteredResult(_0x1d34e6,_0x298b5e))[_0xe03f('0x5a')](handleError(_0x1d34e6,null));};exports['addAgents']=function(_0x5d9dd6,_0xc7e928,_0x3e7691){return db['ChatWebsite'][_0xe03f('0x5f')]({'where':{'id':_0x5d9dd6[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0xc7e928,null))['then'](function(_0x2dc8c5){if(_0x2dc8c5){return _0x2dc8c5[_0xe03f('0x133')](_0x5d9dd6[_0xe03f('0x61')][_0xe03f('0x74')],_[_0xe03f('0x102')](_0x5d9dd6[_0xe03f('0x61')],[_0xe03f('0x74'),'id'])||{})[_0xe03f('0xc4')](function(_0x2a3492){for(var _0x20eeac=0x0;_0x20eeac<_0x5d9dd6[_0xe03f('0x61')]['ids'][_0xe03f('0x4d')];_0x20eeac+=0x1){socket[_0xe03f('0x134')]('userChatWebsite:save',{'UserId':Number(_0x5d9dd6[_0xe03f('0x61')][_0xe03f('0x74')][_0x20eeac]),'ChatWebsiteId':Number(_0x5d9dd6['params']['id'])});}return _0x2a3492;});}})['then'](respondWithResult(_0xc7e928,null))['catch'](handleError(_0xc7e928,null));};exports['removeAgents']=function(_0x3e92ae,_0x661f36,_0x2a6f0d){return db[_0xe03f('0x43')][_0xe03f('0x5f')]({'where':{'id':_0x3e92ae[_0xe03f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x661f36,null))[_0xe03f('0x25')](function(_0x56e55e){if(_0x56e55e){return _0x56e55e[_0xe03f('0x135')](_0x3e92ae[_0xe03f('0x48')][_0xe03f('0x74')])['then'](function(){if(_[_0xe03f('0x136')](_0x3e92ae[_0xe03f('0x48')]['ids'])){for(var _0x245d34=0x0;_0x245d34<_0x3e92ae[_0xe03f('0x48')][_0xe03f('0x74')][_0xe03f('0x4d')];_0x245d34+=0x1){socket[_0xe03f('0x134')](_0xe03f('0x137'),{'UserId':Number(_0x3e92ae[_0xe03f('0x48')][_0xe03f('0x74')][_0x245d34]),'ChatWebsiteId':Number(_0x3e92ae[_0xe03f('0x5c')]['id'])});}}else{socket['emit'](_0xe03f('0x137'),{'UserId':Number(_0x3e92ae['query'][_0xe03f('0x74')]),'ChatWebsiteId':Number(_0x3e92ae[_0xe03f('0x5c')]['id'])});}});}})[_0xe03f('0x25')](respondWithStatusCode(_0x661f36,null))[_0xe03f('0x5a')](handleError(_0x661f36,null));};exports[_0xe03f('0x138')]=function(_0x382112,_0x1a30cc,_0x40e7ff){var _0x3a0830={};var _0x32e764={};var _0x14bbb2;var _0x5d1776;return db[_0xe03f('0x43')][_0xe03f('0x6c')]({'where':{'id':_0x382112[_0xe03f('0x5c')]['id']}})[_0xe03f('0x25')](handleEntityNotFound(_0x1a30cc,null))[_0xe03f('0x25')](function(_0x4c0cc6){if(_0x4c0cc6){_0x14bbb2=_0x4c0cc6;_0x32e764['model']=_[_0xe03f('0x5e')](db[_0xe03f('0xcf')][_0xe03f('0x44')]);_0x32e764[_0xe03f('0x48')]=_[_0xe03f('0x5e')](_0x382112[_0xe03f('0x48')]);_0x32e764[_0xe03f('0x49')]=_[_0xe03f('0x4a')](_0x32e764[_0xe03f('0x47')],_0x32e764['query']);_0x3a0830[_0xe03f('0x4b')]=_['intersection'](_0x32e764[_0xe03f('0x47')],qs[_0xe03f('0x4c')](_0x382112[_0xe03f('0x48')][_0xe03f('0x4c')]));_0x3a0830[_0xe03f('0x4b')]=_0x3a0830[_0xe03f('0x4b')]['length']?_0x3a0830['attributes']:_0x32e764[_0xe03f('0x47')];_0x3a0830[_0xe03f('0x71')]=qs[_0xe03f('0x6d')](_0x382112['query'][_0xe03f('0x6d')]);_0x3a0830[_0xe03f('0x50')]=qs[_0xe03f('0x49')](_[_0xe03f('0x51')](_0x382112[_0xe03f('0x48')],_0x32e764['filters']));if(_0x382112[_0xe03f('0x48')]['filter']){_0x3a0830[_0xe03f('0x50')]=_[_0xe03f('0x55')](_0x3a0830[_0xe03f('0x50')],{'$or':_['map'](_0x3a0830[_0xe03f('0x4b')],function(_0x338d23){var _0x21a7e9={};_0x21a7e9[_0x338d23]={'$like':'%'+_0x382112[_0xe03f('0x48')]['filter']+'%'};return _0x21a7e9;})});}_0x3a0830=_[_0xe03f('0x55')]({},_0x3a0830,_0x382112[_0xe03f('0x56')]);return _0x14bbb2[_0xe03f('0x138')](_0x3a0830);}})['then'](function(_0x3277da){if(_0x3277da){_0x5d1776=_0x3277da['length'];if(!_0x382112['query']['hasOwnProperty'](_0xe03f('0x4f'))){_0x3a0830[_0xe03f('0x35')]=qs[_0xe03f('0x35')](_0x382112[_0xe03f('0x48')]['limit']);_0x3a0830['offset']=qs[_0xe03f('0x33')](_0x382112[_0xe03f('0x48')][_0xe03f('0x33')]);}return _0x14bbb2[_0xe03f('0x138')](_0x3a0830);}})[_0xe03f('0x25')](function(_0x3831b9){if(_0x3831b9){return _0x3831b9?{'count':_0x5d1776,'rows':_0x3831b9}:null;}})[_0xe03f('0x25')](respondWithResult(_0x1a30cc,null))[_0xe03f('0x5a')](handleError(_0x1a30cc,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b686586..1970e30 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 _0x28e3=['update','remove','emit','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x4a7a4c,_0x1211be){var _0x1b73f5=function(_0x295119){while(--_0x295119){_0x4a7a4c['push'](_0x4a7a4c['shift']());}};_0x1b73f5(++_0x1211be);}(_0x28e3,0x106));var _0x328e=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x28e3[_0x2706da];return _0x3ba87e;};'use strict';var EventEmitter=require(_0x328e('0x0'));var ChatWebsite=require(_0x328e('0x1'))['db'][_0x328e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x328e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x328e('0x4'),'afterDestroy':_0x328e('0x5')};function emitEvent(_0x106c30){return function(_0x168893,_0x8cdc14,_0x15aade){ChatWebsiteEvents[_0x328e('0x6')](_0x106c30+':'+_0x168893['id'],_0x168893);ChatWebsiteEvents[_0x328e('0x6')](_0x106c30,_0x168893);_0x15aade(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x9865=['hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9865,0x1ba));var _0x5986=function(_0x5c9274,_0x4e849b){_0x5c9274=_0x5c9274-0x0;var _0x1ef7d3=_0x9865[_0x5c9274];return _0x1ef7d3;};'use strict';var EventEmitter=require(_0x5986('0x0'));var ChatWebsite=require(_0x5986('0x1'))['db'][_0x5986('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x5986('0x3')](0x0);var events={'afterCreate':_0x5986('0x4'),'afterUpdate':_0x5986('0x5'),'afterDestroy':_0x5986('0x6')};function emitEvent(_0x12c471){return function(_0x236420,_0xef2d15,_0x5b7602){ChatWebsiteEvents[_0x5986('0x7')](_0x12c471+':'+_0x236420['id'],_0x236420);ChatWebsiteEvents[_0x5986('0x7')](_0x12c471,_0x236420);_0x5b7602(null);};}for(var e in events){if(events[_0x5986('0x8')](e)){var event=events[e];ChatWebsite[_0x5986('0x9')](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 9524549..a87e7c5 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 _0x8d0b=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./chatWebsite.attributes','define','chat_websites','lodash'];(function(_0x363ccb,_0xde985){var _0x2e0fe9=function(_0x4c7d2a){while(--_0x4c7d2a){_0x363ccb['push'](_0x363ccb['shift']());}};_0x2e0fe9(++_0xde985);}(_0x8d0b,0x10d));var _0xb8d0=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x8d0b[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0xb8d0('0x0'));var util=require(_0xb8d0('0x1'));var logger=require(_0xb8d0('0x2'))(_0xb8d0('0x3'));var moment=require('moment');var BPromise=require(_0xb8d0('0x4'));var rp=require(_0xb8d0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb8d0('0x6'));var attributes=require(_0xb8d0('0x7'));module['exports']=function(_0x48cc61,_0x511c50){return _0x48cc61[_0xb8d0('0x8')]('ChatWebsite',attributes,{'tableName':_0xb8d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1e3=['define','ChatWebsite','chat_websites','util','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x5c43cf,_0x297c45){var _0x56a800=function(_0x1f1b3e){while(--_0x1f1b3e){_0x5c43cf['push'](_0x5c43cf['shift']());}};_0x56a800(++_0x297c45);}(_0xb1e3,0x1bb));var _0x3b1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3b1e('0x0'));var logger=require('../../config/logger')(_0x3b1e('0x1'));var moment=require(_0x3b1e('0x2'));var BPromise=require(_0x3b1e('0x3'));var rp=require(_0x3b1e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b1e('0x5'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x3b1e('0x6')]=function(_0xa635e6,_0x20b1b2){return _0xa635e6[_0x3b1e('0x7')](_0x3b1e('0x8'),attributes,{'tableName':_0x3b1e('0x9'),'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 4f26136..0310558 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 _0x996f=['code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x996f,0x143));var _0xf996=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x996f[_0x50007c];return _0x5c1ec7;};'use strict';var _=require('lodash');var util=require(_0xf996('0x0'));var moment=require('moment');var BPromise=require(_0xf996('0x1'));var rs=require(_0xf996('0x2'));var fs=require('fs');var Redis=require(_0xf996('0x3'));var db=require(_0xf996('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf996('0x5'))(_0xf996('0x6'));var config=require(_0xf996('0x7'));var jayson=require(_0xf996('0x8'));var client=jayson[_0xf996('0x9')][_0xf996('0xa')]({'port':0x232a});config['redis']=_[_0xf996('0xb')](config[_0xf996('0xc')],{'host':_0xf996('0xd'),'port':0x18eb});var socket=require(_0xf996('0xe'))(new Redis(config['redis']));require(_0xf996('0xf'))[_0xf996('0x10')](socket);function respondWithRpcPromise(_0x6567dd,_0x4aabf5,_0x42ca06){return new BPromise(function(_0xc111f8,_0x20cdb7){return client[_0xf996('0x11')](_0x6567dd,_0x42ca06)['then'](function(_0x241b9f){logger[_0xf996('0x12')](_0xf996('0x13'),_0x4aabf5,'request\x20sent');logger[_0xf996('0x14')](_0xf996('0x15'),_0x4aabf5,_0xf996('0x16'),JSON[_0xf996('0x17')](_0x241b9f));if(_0x241b9f['error']){if(_0x241b9f[_0xf996('0x18')][_0xf996('0x19')]===0x1f4){logger[_0xf996('0x18')](_0xf996('0x13'),_0x4aabf5,_0x241b9f[_0xf996('0x18')]['message']);return _0x20cdb7(_0x241b9f[_0xf996('0x18')][_0xf996('0x1a')]);}logger[_0xf996('0x18')](_0xf996('0x13'),_0x4aabf5,_0x241b9f['error'][_0xf996('0x1a')]);return _0xc111f8(_0x241b9f[_0xf996('0x18')][_0xf996('0x1a')]);}else{logger[_0xf996('0x12')](_0xf996('0x13'),_0x4aabf5,_0xf996('0x16'));_0xc111f8(_0x241b9f[_0xf996('0x1b')][_0xf996('0x1a')]);}})[_0xf996('0x1c')](function(_0x32c8c4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4aabf5,_0x32c8c4);_0x20cdb7(_0x32c8c4);});});} \ No newline at end of file +var _0x40e6=['debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','http','defaults','redis','./chatWebsite.socket','register','request','info','request\x20sent'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x40e6,0xe1));var _0x640e=function(_0xbd77c1,_0x50b969){_0xbd77c1=_0xbd77c1-0x0;var _0x47fa83=_0x40e6[_0xbd77c1];return _0x47fa83;};'use strict';var _=require('lodash');var util=require(_0x640e('0x0'));var moment=require(_0x640e('0x1'));var BPromise=require(_0x640e('0x2'));var rs=require(_0x640e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x640e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x640e('0x5'));var config=require(_0x640e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x640e('0x7')]({'port':0x232a});config['redis']=_[_0x640e('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x640e('0x9')]));require(_0x640e('0xa'))[_0x640e('0xb')](socket);function respondWithRpcPromise(_0x32d64d,_0x57599b,_0x4248f6){return new BPromise(function(_0x151492,_0x79cfac){return client[_0x640e('0xc')](_0x32d64d,_0x4248f6)['then'](function(_0x3099b6){logger[_0x640e('0xd')]('ChatWebsite,\x20%s,\x20%s',_0x57599b,_0x640e('0xe'));logger[_0x640e('0xf')](_0x640e('0x10'),_0x57599b,_0x640e('0xe'),JSON[_0x640e('0x11')](_0x3099b6));if(_0x3099b6[_0x640e('0x12')]){if(_0x3099b6['error'][_0x640e('0x13')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x57599b,_0x3099b6['error'][_0x640e('0x14')]);return _0x79cfac(_0x3099b6[_0x640e('0x12')][_0x640e('0x14')]);}logger[_0x640e('0x12')](_0x640e('0x15'),_0x57599b,_0x3099b6['error']['message']);return _0x151492(_0x3099b6[_0x640e('0x12')]['message']);}else{logger[_0x640e('0xd')](_0x640e('0x15'),_0x57599b,'request\x20sent');_0x151492(_0x3099b6[_0x640e('0x16')][_0x640e('0x14')]);}})[_0x640e('0x17')](function(_0x217a02){logger[_0x640e('0x12')](_0x640e('0x15'),_0x57599b,_0x217a02);_0x79cfac(_0x217a02);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 62d3fa8..c6c11c0 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 _0x0a8c=['emit','register','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x59adc9,_0x55995c){var _0x3fdfca=function(_0x58e7d5){while(--_0x58e7d5){_0x59adc9['push'](_0x59adc9['shift']());}};_0x3fdfca(++_0x55995c);}(_0x0a8c,0x1ae));var _0xc0a8=function(_0x461e08,_0x32ea15){_0x461e08=_0x461e08-0x0;var _0x19a69c=_0x0a8c[_0x461e08];return _0x19a69c;};'use strict';var ChatWebsiteEvents=require(_0xc0a8('0x0'));var events=[_0xc0a8('0x1'),_0xc0a8('0x2'),_0xc0a8('0x3')];function createListener(_0x47cf32,_0x234629){return function(_0x5bd20a){_0x234629[_0xc0a8('0x4')](_0x47cf32,_0x5bd20a);};}function removeListener(_0x178156,_0x7a9e2b){return function(){ChatWebsiteEvents['removeListener'](_0x178156,_0x7a9e2b);};}exports[_0xc0a8('0x5')]=function(_0x1a8671){for(var _0x428080=0x0,_0x3394ba=events['length'];_0x428080<_0x3394ba;_0x428080++){var _0x12b421=events[_0x428080];var _0x51fb36=createListener(_0xc0a8('0x6')+_0x12b421,_0x1a8671);ChatWebsiteEvents['on'](_0x12b421,_0x51fb36);}}; \ No newline at end of file +var _0x6b1d=['register','length','chatWebsite:','./chatWebsite.events','remove','removeListener'];(function(_0x121033,_0x4d1215){var _0x5751af=function(_0x260c8c){while(--_0x260c8c){_0x121033['push'](_0x121033['shift']());}};_0x5751af(++_0x4d1215);}(_0x6b1d,0xe7));var _0xd6b1=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0x6b1d[_0xd3b0ac];return _0x3d773e;};'use strict';var ChatWebsiteEvents=require(_0xd6b1('0x0'));var events=['save',_0xd6b1('0x1'),'update'];function createListener(_0x1f16c4,_0x584cdc){return function(_0x20561a){_0x584cdc['emit'](_0x1f16c4,_0x20561a);};}function removeListener(_0x1306b9,_0x62f5b4){return function(){ChatWebsiteEvents[_0xd6b1('0x2')](_0x1306b9,_0x62f5b4);};}exports[_0xd6b1('0x3')]=function(_0x54cf64){for(var _0x46ea5b=0x0,_0x197c82=events[_0xd6b1('0x4')];_0x46ea5b<_0x197c82;_0x46ea5b++){var _0x4dd836=events[_0x46ea5b];var _0x44c6e5=createListener(_0xd6b1('0x5')+_0x4dd836,_0x54cf64);ChatWebsiteEvents['on'](_0x4dd836,_0x44c6e5);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 75dca52..4efac45 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 _0x0790=['get','/describe','describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','root','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2885c3,_0x2e7ef6){var _0x1eac9d=function(_0x4fe414){while(--_0x4fe414){_0x2885c3['push'](_0x2885c3['shift']());}};_0x1eac9d(++_0x2e7ef6);}(_0x0790,0x153));var _0x0079=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x0790[_0x2ade6c];return _0x2cb372;};'use strict';var multer=require(_0x0079('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0079('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0079('0x2'));var auth=require(_0x0079('0x3'));var interaction=require(_0x0079('0x4'));var config=require(_0x0079('0x5'));var controller=require('./chatWebsite.controller');router[_0x0079('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0079('0x6')](_0x0079('0x7'),auth['isAuthenticated'](),controller[_0x0079('0x8')]);router[_0x0079('0x6')]('/:id',auth[_0x0079('0x9')](),controller[_0x0079('0xa')]);router[_0x0079('0x6')](_0x0079('0xb'),auth[_0x0079('0x9')](),controller[_0x0079('0xc')]);router[_0x0079('0x6')](_0x0079('0xd'),auth[_0x0079('0x9')](),controller[_0x0079('0xe')]);router['get'](_0x0079('0xf'),controller[_0x0079('0x10')]);router[_0x0079('0x6')](_0x0079('0x11'),controller[_0x0079('0x12')]);router['get']('/:id/customer_avatar',controller[_0x0079('0x13')]);router[_0x0079('0x6')](_0x0079('0x14'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x0079('0x9')](),controller[_0x0079('0x15')]);router[_0x0079('0x6')](_0x0079('0x16'),controller['getSnippet']);router['get'](_0x0079('0x17'),auth['isAuthenticated'](),controller[_0x0079('0x18')]);router['get'](_0x0079('0x19'),auth[_0x0079('0x9')](),controller['getProactiveActions']);router[_0x0079('0x6')]('/:id/fields',controller[_0x0079('0x1a')]);router[_0x0079('0x6')](_0x0079('0x1b'),auth[_0x0079('0x9')](),controller[_0x0079('0x1c')]);router[_0x0079('0x6')]('/:id/users',auth[_0x0079('0x9')](),controller[_0x0079('0x1d')]);router[_0x0079('0x1e')]('/',auth[_0x0079('0x9')](),controller['create']);router[_0x0079('0x1e')]('/:id/dispositions',auth[_0x0079('0x9')](),controller['addDisposition']);router['post'](_0x0079('0xd'),auth[_0x0079('0x9')](),controller[_0x0079('0x1f')]);var upload=multer({'storage':multer[_0x0079('0x20')]({'destination':function(_0x1d6369,_0x4b8046,_0x209ba3){_0x209ba3(null,path[_0x0079('0x21')](config['root'],_0x0079('0x22')));},'filename':function(_0x2c237d,_0x49e166,_0x17e757){_0x17e757(null,util[_0x0079('0x23')](_0x0079('0x24'),Date[_0x0079('0x25')](),_0x49e166[_0x0079('0x26')]));}})});router[_0x0079('0x1e')]('/:id/logo',upload['single'](_0x0079('0x27')),controller[_0x0079('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x359b71,_0x4d42fd,_0x4de4b2){_0x4de4b2(null,path[_0x0079('0x21')](config[_0x0079('0x29')],'server/files/images/avatars/'));},'filename':function(_0x4ed79a,_0x1d52bf,_0x280eb0){_0x280eb0(null,util[_0x0079('0x23')](_0x0079('0x24'),Date[_0x0079('0x25')](),_0x1d52bf[_0x0079('0x26')]));}})});router['post']('/:id/avatar',upload[_0x0079('0x2a')](_0x0079('0x27')),controller[_0x0079('0x2b')]);var upload=multer({'storage':multer[_0x0079('0x20')]({'destination':function(_0x38c8ca,_0x5ddda1,_0x57a6bb){_0x57a6bb(null,path[_0x0079('0x21')](config[_0x0079('0x29')],_0x0079('0x2c')));},'filename':function(_0x3eb55f,_0x39a95e,_0x1f7852){_0x1f7852(null,util[_0x0079('0x23')]('%s-%s',Date[_0x0079('0x25')](),_0x39a95e[_0x0079('0x26')]));}})});router[_0x0079('0x1e')](_0x0079('0x2d'),upload[_0x0079('0x2a')]('file'),controller[_0x0079('0x2e')]);var upload=multer({'storage':multer[_0x0079('0x20')]({'destination':function(_0x773597,_0x50f53d,_0x4fda9d){_0x4fda9d(null,path[_0x0079('0x21')](config['root'],'server/files/images/avatars/'));},'filename':function(_0xee1f32,_0x57b737,_0xab2a2){_0xab2a2(null,util[_0x0079('0x23')](_0x0079('0x24'),Date[_0x0079('0x25')](),_0x57b737[_0x0079('0x26')]));}})});router[_0x0079('0x1e')](_0x0079('0x14'),upload['single'](_0x0079('0x27')),controller['addSystemAvatar']);router[_0x0079('0x1e')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x0079('0x20')]({'destination':function(_0x3fe326,_0x470a20,_0x2aad03){const _0x54cd86=path[_0x0079('0x21')](config[_0x0079('0x29')],_0x0079('0x2f'),_0x0079('0x30'),_0x0079('0x31'));fs_extra[_0x0079('0x32')](_0x54cd86,function(){_0x2aad03(null,_0x54cd86);});},'filename':function(_0x1d2245,_0x3b2f71,_0x258b39){const _0x4d044c=_0x3b2f71[_0x0079('0x26')][_0x0079('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2e0fba=path[_0x0079('0x34')](_0x4d044c);const _0x1b3316=Date[_0x0079('0x25')]()+'-'+_0x4d044c['replace'](_0x2e0fba,'')+_0x2e0fba;_0x258b39(null,_0x1b3316);}})});router[_0x0079('0x1e')](_0x0079('0x35'),offlineUploadMulter[_0x0079('0x36')](),controller[_0x0079('0x37')]);router[_0x0079('0x1e')](_0x0079('0x38'),auth['isAuthenticated'](),controller[_0x0079('0x39')]);router['post']('/:id/applications',auth[_0x0079('0x9')](),controller[_0x0079('0x3a')]);router['post'](_0x0079('0x19'),auth[_0x0079('0x9')](),controller[_0x0079('0x3b')]);router[_0x0079('0x1e')]('/:id/users',auth[_0x0079('0x9')](),controller[_0x0079('0x3c')]);router[_0x0079('0x3d')](_0x0079('0x3e'),auth[_0x0079('0x9')](),controller[_0x0079('0x3f')]);router[_0x0079('0x40')](_0x0079('0x3e'),auth[_0x0079('0x9')](),controller['destroy']);router['delete'](_0x0079('0xb'),auth[_0x0079('0x9')](),controller[_0x0079('0x41')]);router[_0x0079('0x40')](_0x0079('0xd'),auth['isAuthenticated'](),controller[_0x0079('0x42')]);router[_0x0079('0x40')](_0x0079('0x43'),auth['isAuthenticated'](),controller[_0x0079('0x44')]);module['exports']=router; \ No newline at end of file +var _0xcb59=['/:id/offline','any','offline','addInteraction','addApplications','/:id/proactive_actions','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','format','%s-%s','now','originalname','file','addLogo','join','server/files/images/avatars/','single','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','ensureDir','replace'];(function(_0x8b9b45,_0x555425){var _0x5254f1=function(_0x3980a5){while(--_0x3980a5){_0x8b9b45['push'](_0x8b9b45['shift']());}};_0x5254f1(++_0x555425);}(_0xcb59,0x138));var _0x9cb5=function(_0x7a18fb,_0x3242fb){_0x7a18fb=_0x7a18fb-0x0;var _0x412cc6=_0xcb59[_0x7a18fb];return _0x412cc6;};'use strict';var multer=require(_0x9cb5('0x0'));var util=require(_0x9cb5('0x1'));var path=require(_0x9cb5('0x2'));var timeout=require(_0x9cb5('0x3'));var express=require(_0x9cb5('0x4'));var router=express[_0x9cb5('0x5')]();var fs_extra=require(_0x9cb5('0x6'));var auth=require(_0x9cb5('0x7'));var interaction=require(_0x9cb5('0x8'));var config=require(_0x9cb5('0x9'));var controller=require(_0x9cb5('0xa'));router[_0x9cb5('0xb')]('/',auth[_0x9cb5('0xc')](),controller[_0x9cb5('0xd')]);router['get'](_0x9cb5('0xe'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0xf')]);router[_0x9cb5('0xb')]('/:id',auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x10')]);router['get'](_0x9cb5('0x11'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x12')]);router['get']('/:id/canned_answers',auth[_0x9cb5('0xc')](),controller['getAnswers']);router['get'](_0x9cb5('0x13'),controller['getLogo']);router[_0x9cb5('0xb')](_0x9cb5('0x14'),controller[_0x9cb5('0x15')]);router[_0x9cb5('0xb')]('/:id/customer_avatar',controller[_0x9cb5('0x16')]);router[_0x9cb5('0xb')](_0x9cb5('0x17'),controller['getSystemAvatar']);router[_0x9cb5('0xb')]('/:id/interactions',auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x18')]);router[_0x9cb5('0xb')](_0x9cb5('0x19'),controller[_0x9cb5('0x1a')]);router[_0x9cb5('0xb')](_0x9cb5('0x1b'),auth['isAuthenticated'](),controller['getApplications']);router[_0x9cb5('0xb')]('/:id/proactive_actions',auth[_0x9cb5('0xc')](),controller['getProactiveActions']);router['get'](_0x9cb5('0x1c'),controller['getFields']);router['get'](_0x9cb5('0x1d'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x1e')]);router[_0x9cb5('0xb')](_0x9cb5('0x1f'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x20')]);router[_0x9cb5('0x21')]('/',auth['isAuthenticated'](),controller[_0x9cb5('0x22')]);router[_0x9cb5('0x21')](_0x9cb5('0x11'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x23')]);router[_0x9cb5('0x21')](_0x9cb5('0x24'),auth['isAuthenticated'](),controller[_0x9cb5('0x25')]);var upload=multer({'storage':multer[_0x9cb5('0x26')]({'destination':function(_0x96e9eb,_0x57fa14,_0x2efddf){_0x2efddf(null,path['join'](config[_0x9cb5('0x27')],'server/files/images/logos/'));},'filename':function(_0x3f0026,_0x314234,_0x55fe67){_0x55fe67(null,util[_0x9cb5('0x28')](_0x9cb5('0x29'),Date[_0x9cb5('0x2a')](),_0x314234[_0x9cb5('0x2b')]));}})});router['post'](_0x9cb5('0x13'),upload['single'](_0x9cb5('0x2c')),controller[_0x9cb5('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2aa798,_0x364c65,_0x186479){_0x186479(null,path[_0x9cb5('0x2e')](config['root'],_0x9cb5('0x2f')));},'filename':function(_0x2ea038,_0x4ba820,_0x3cc181){_0x3cc181(null,util['format'](_0x9cb5('0x29'),Date['now'](),_0x4ba820[_0x9cb5('0x2b')]));}})});router[_0x9cb5('0x21')]('/:id/avatar',upload[_0x9cb5('0x30')](_0x9cb5('0x2c')),controller[_0x9cb5('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4026df,_0x1efaa5,_0x59f10c){_0x59f10c(null,path[_0x9cb5('0x2e')](config[_0x9cb5('0x27')],_0x9cb5('0x2f')));},'filename':function(_0x2dd49c,_0x297dfc,_0x4aa9af){_0x4aa9af(null,util[_0x9cb5('0x28')](_0x9cb5('0x29'),Date[_0x9cb5('0x2a')](),_0x297dfc[_0x9cb5('0x2b')]));}})});router['post'](_0x9cb5('0x32'),upload['single'](_0x9cb5('0x2c')),controller[_0x9cb5('0x33')]);var upload=multer({'storage':multer[_0x9cb5('0x26')]({'destination':function(_0x388c70,_0x1eba73,_0x44107f){_0x44107f(null,path[_0x9cb5('0x2e')](config[_0x9cb5('0x27')],'server/files/images/avatars/'));},'filename':function(_0x2ef953,_0x421c78,_0x258efb){_0x258efb(null,util[_0x9cb5('0x28')](_0x9cb5('0x29'),Date['now'](),_0x421c78[_0x9cb5('0x2b')]));}})});router[_0x9cb5('0x21')](_0x9cb5('0x17'),upload[_0x9cb5('0x30')](_0x9cb5('0x2c')),controller[_0x9cb5('0x34')]);router['post'](_0x9cb5('0x35'),controller[_0x9cb5('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x9cb5('0x26')]({'destination':function(_0x5081ab,_0x446f37,_0x3c0d4c){const _0x39f879=path[_0x9cb5('0x2e')](config[_0x9cb5('0x27')],_0x9cb5('0x37'),'attachments','offline-chat');fs_extra[_0x9cb5('0x38')](_0x39f879,function(){_0x3c0d4c(null,_0x39f879);});},'filename':function(_0x59bcb0,_0x577da3,_0x3a99ae){const _0x206a1f=_0x577da3[_0x9cb5('0x2b')][_0x9cb5('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2cc1e7=path['extname'](_0x206a1f);const _0x3ddb80=Date[_0x9cb5('0x2a')]()+'-'+_0x206a1f[_0x9cb5('0x39')](_0x2cc1e7,'')+_0x2cc1e7;_0x3a99ae(null,_0x3ddb80);}})});router[_0x9cb5('0x21')](_0x9cb5('0x3a'),offlineUploadMulter[_0x9cb5('0x3b')](),controller[_0x9cb5('0x3c')]);router['post']('/:id/interactions',auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x3d')]);router[_0x9cb5('0x21')](_0x9cb5('0x1b'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x3e')]);router[_0x9cb5('0x21')](_0x9cb5('0x3f'),auth[_0x9cb5('0xc')](),controller['addProactiveActions']);router['post'](_0x9cb5('0x1f'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x40')]);router[_0x9cb5('0x41')](_0x9cb5('0x42'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x43')]);router[_0x9cb5('0x44')](_0x9cb5('0x42'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x45')]);router['delete']('/:id/dispositions',auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x46')]);router[_0x9cb5('0x44')](_0x9cb5('0x24'),auth['isAuthenticated'](),controller[_0x9cb5('0x47')]);router[_0x9cb5('0x44')](_0x9cb5('0x1f'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x48')]);module[_0x9cb5('0x49')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 8960d8b..926287f 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 _0x88b0=['exports','AmazonAWS','Google','STRING','sequelize'];(function(_0x2bcad9,_0x38885c){var _0xee9443=function(_0x52acbb){while(--_0x52acbb){_0x2bcad9['push'](_0x2bcad9['shift']());}};_0xee9443(++_0x38885c);}(_0x88b0,0x1cb));var _0x088b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x88b0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x088b('0x0'));module[_0x088b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x088b('0x2'),_0x088b('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x088b('0x4')]},'data2':{'type':Sequelize[_0x088b('0x4')]}}; \ No newline at end of file +var _0xd8a5=['sequelize','STRING','ENUM','Google'];(function(_0x47ad1a,_0x467d68){var _0x586211=function(_0x169364){while(--_0x169364){_0x47ad1a['push'](_0x47ad1a['shift']());}};_0x586211(++_0x467d68);}(_0xd8a5,0x160));var _0x5d8a=function(_0x616db3,_0x1d982f){_0x616db3=_0x616db3-0x0;var _0x5315e7=_0xd8a5[_0x616db3];return _0x5315e7;};'use strict';var Sequelize=require(_0x5d8a('0x0'));module['exports']={'name':{'type':Sequelize[_0x5d8a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5d8a('0x2')]('AmazonAWS',_0x5d8a('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x5d8a('0x1')]},'data2':{'type':Sequelize[_0x5d8a('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b6e17f0..4e5816b 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 _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x7723c7,_0xced17a){_0x7723c7=_0x7723c7-0x0;var _0x13ac3a=_0x5f2f[_0x7723c7];return _0x13ac3a;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file +var _0x5f66=['update','catch','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','../../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','CloudProvider','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x12646b,_0x5d7539){var _0x1b244f=function(_0x4fd6ad){while(--_0x4fd6ad){_0x12646b['push'](_0x12646b['shift']());}};_0x1b244f(++_0x5d7539);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'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')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['CloudProvider'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 09c7bfa..fce78af 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 _0x9e05=['define','CloudProvider','cloud_providers','lodash','util','path','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x4052c0,_0x4271ab){var _0x296f04=function(_0x5373fc){while(--_0x5373fc){_0x4052c0['push'](_0x4052c0['shift']());}};_0x296f04(++_0x4271ab);}(_0x9e05,0x1d7));var _0x59e0=function(_0x29670b,_0x491833){_0x29670b=_0x29670b-0x0;var _0x3b27bb=_0x9e05[_0x29670b];return _0x3b27bb;};'use strict';var _=require(_0x59e0('0x0'));var util=require(_0x59e0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x59e0('0x2'));var rimraf=require('rimraf');var config=require(_0x59e0('0x3'));var attributes=require(_0x59e0('0x4'));module[_0x59e0('0x5')]=function(_0x38d621,_0x491e0c){return _0x38d621[_0x59e0('0x6')](_0x59e0('0x7'),attributes,{'tableName':_0x59e0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36ce=['CloudProvider','cloud_providers','util','../../config/logger','api','path','rimraf','./cloudProvider.attributes','define'];(function(_0x3f9631,_0x51ffcb){var _0x242d84=function(_0xfcd4f7){while(--_0xfcd4f7){_0x3f9631['push'](_0x3f9631['shift']());}};_0x242d84(++_0x51ffcb);}(_0x36ce,0xa4));var _0xe36c=function(_0x1ab8f9,_0x57f54e){_0x1ab8f9=_0x1ab8f9-0x0;var _0x3da929=_0x36ce[_0x1ab8f9];return _0x3da929;};'use strict';var _=require('lodash');var util=require(_0xe36c('0x0'));var logger=require(_0xe36c('0x1'))(_0xe36c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe36c('0x3'));var rimraf=require(_0xe36c('0x4'));var config=require('../../config/environment');var attributes=require(_0xe36c('0x5'));module['exports']=function(_0x2e29ce,_0x3c9c12){return _0x2e29ce[_0xe36c('0x6')](_0xe36c('0x7'),attributes,{'tableName':_0xe36c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 6dc4330..c697fde 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 _0xf470=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2eef53,_0x25e6c4){var _0x23ed4a=function(_0x13dcc8){while(--_0x13dcc8){_0x2eef53['push'](_0x2eef53['shift']());}};_0x23ed4a(++_0x25e6c4);}(_0xf470,0xfd));var _0x0f47=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf470[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x0f47('0x0'));var util=require(_0x0f47('0x1'));var moment=require(_0x0f47('0x2'));var BPromise=require(_0x0f47('0x3'));var rs=require(_0x0f47('0x4'));var fs=require('fs');var Redis=require(_0x0f47('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f47('0x6'));var logger=require(_0x0f47('0x7'))('rpc');var config=require(_0x0f47('0x8'));var jayson=require(_0x0f47('0x9'));var client=jayson[_0x0f47('0xa')][_0x0f47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42c33a,_0x3c1886,_0x36f17c){return new BPromise(function(_0x4500be,_0x145344){return client[_0x0f47('0xc')](_0x42c33a,_0x36f17c)[_0x0f47('0xd')](function(_0x30d884){logger[_0x0f47('0xe')](_0x0f47('0xf'),_0x3c1886,_0x0f47('0x10'));logger[_0x0f47('0x11')](_0x0f47('0x12'),_0x3c1886,_0x0f47('0x10'),JSON[_0x0f47('0x13')](_0x30d884));if(_0x30d884['error']){if(_0x30d884[_0x0f47('0x14')][_0x0f47('0x15')]===0x1f4){logger[_0x0f47('0x14')](_0x0f47('0xf'),_0x3c1886,_0x30d884[_0x0f47('0x14')]['message']);return _0x145344(_0x30d884['error'][_0x0f47('0x16')]);}logger[_0x0f47('0x14')](_0x0f47('0xf'),_0x3c1886,_0x30d884[_0x0f47('0x14')][_0x0f47('0x16')]);return _0x4500be(_0x30d884['error'][_0x0f47('0x16')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x3c1886,_0x0f47('0x10'));_0x4500be(_0x30d884[_0x0f47('0x17')][_0x0f47('0x16')]);}})[_0x0f47('0x18')](function(_0x475754){logger[_0x0f47('0x14')](_0x0f47('0xf'),_0x3c1886,_0x475754);_0x145344(_0x475754);});});} \ No newline at end of file +var _0x5853=['then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5853,0x113));var _0x3585=function(_0x2bf1d6,_0x410efd){_0x2bf1d6=_0x2bf1d6-0x0;var _0x1be08a=_0x5853[_0x2bf1d6];return _0x1be08a;};'use strict';var _=require(_0x3585('0x0'));var util=require(_0x3585('0x1'));var moment=require(_0x3585('0x2'));var BPromise=require(_0x3585('0x3'));var rs=require(_0x3585('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3585('0x5'))['db'];var utils=require(_0x3585('0x6'));var logger=require(_0x3585('0x7'))(_0x3585('0x8'));var config=require(_0x3585('0x9'));var jayson=require(_0x3585('0xa'));var client=jayson['client'][_0x3585('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48b3ff,_0x5d8c2d,_0x1a97fd){return new BPromise(function(_0x5e78f3,_0x5910ab){return client[_0x3585('0xc')](_0x48b3ff,_0x1a97fd)[_0x3585('0xd')](function(_0x2febe8){logger[_0x3585('0xe')](_0x3585('0xf'),_0x5d8c2d,_0x3585('0x10'));logger['debug'](_0x3585('0x11'),_0x5d8c2d,_0x3585('0x10'),JSON[_0x3585('0x12')](_0x2febe8));if(_0x2febe8[_0x3585('0x13')]){if(_0x2febe8[_0x3585('0x13')][_0x3585('0x14')]===0x1f4){logger[_0x3585('0x13')]('CloudProvider,\x20%s,\x20%s',_0x5d8c2d,_0x2febe8[_0x3585('0x13')]['message']);return _0x5910ab(_0x2febe8['error']['message']);}logger['error'](_0x3585('0xf'),_0x5d8c2d,_0x2febe8['error'][_0x3585('0x15')]);return _0x5e78f3(_0x2febe8[_0x3585('0x13')]['message']);}else{logger[_0x3585('0xe')](_0x3585('0xf'),_0x5d8c2d,'request\x20sent');_0x5e78f3(_0x2febe8[_0x3585('0x16')][_0x3585('0x15')]);}})[_0x3585('0x17')](function(_0x2beae5){logger[_0x3585('0x13')]('CloudProvider,\x20%s,\x20%s',_0x5d8c2d,_0x2beae5);_0x5910ab(_0x2beae5);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6fa515a..633a7ff 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 _0x8f1a=['express','Router','fs-extra','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x4d8263,_0x2a64c4){var _0x4914db=function(_0x1ff907){while(--_0x1ff907){_0x4d8263['push'](_0x4d8263['shift']());}};_0x4914db(++_0x2a64c4);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x4a87d8,_0x1a5af5){_0x4a87d8=_0x4a87d8-0x0;var _0x408437=_0x8f1a[_0x4a87d8];return _0x408437;};'use strict';var multer=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var path=require(_0xa8f1('0x2'));var timeout=require(_0xa8f1('0x3'));var express=require(_0xa8f1('0x4'));var router=express[_0xa8f1('0x5')]();var fs_extra=require(_0xa8f1('0x6'));var auth=require(_0xa8f1('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa8f1('0x8'));router['get']('/',auth[_0xa8f1('0x9')](),controller[_0xa8f1('0xa')]);router['get'](_0xa8f1('0xb'),auth[_0xa8f1('0x9')](),controller[_0xa8f1('0xc')]);router[_0xa8f1('0xd')]('/',auth[_0xa8f1('0x9')](),controller[_0xa8f1('0xe')]);router[_0xa8f1('0xf')](_0xa8f1('0xb'),auth['isAuthenticated'](),controller[_0xa8f1('0x10')]);router[_0xa8f1('0x11')]('/:id',auth[_0xa8f1('0x9')](),controller['destroy']);module[_0xa8f1('0x12')]=router; \ No newline at end of file +var _0xf590=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','/:id','show','post','create','put','isAuthenticated','delete','multer','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf590,0x1e2));var _0x0f59=function(_0x36c87d,_0x2ab247){_0x36c87d=_0x36c87d-0x0;var _0x54dc55=_0xf590[_0x36c87d];return _0x54dc55;};'use strict';var multer=require(_0x0f59('0x0'));var util=require('util');var path=require(_0x0f59('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f59('0x2'));var router=express[_0x0f59('0x3')]();var fs_extra=require(_0x0f59('0x4'));var auth=require(_0x0f59('0x5'));var interaction=require(_0x0f59('0x6'));var config=require(_0x0f59('0x7'));var controller=require(_0x0f59('0x8'));router[_0x0f59('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f59('0xa')]);router[_0x0f59('0x9')](_0x0f59('0xb'),auth['isAuthenticated'](),controller[_0x0f59('0xc')]);router[_0x0f59('0xd')]('/',auth['isAuthenticated'](),controller[_0x0f59('0xe')]);router[_0x0f59('0xf')](_0x0f59('0xb'),auth[_0x0f59('0x10')](),controller['update']);router[_0x0f59('0x11')](_0x0f59('0xb'),auth[_0x0f59('0x10')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8240108..3f7508d 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 _0x9b69=['exports','STRING','name','sequelize'];(function(_0x57d9e6,_0x13f317){var _0xefea09=function(_0x32b3d3){while(--_0x32b3d3){_0x57d9e6['push'](_0x57d9e6['shift']());}};_0xefea09(++_0x13f317);}(_0x9b69,0x183));var _0x99b6=function(_0x47b408,_0xece1a9){_0x47b408=_0x47b408-0x0;var _0x3c6015=_0x9b69[_0x47b408];return _0x3c6015;};'use strict';var Sequelize=require(_0x99b6('0x0'));module[_0x99b6('0x1')]={'name':{'type':Sequelize[_0x99b6('0x2')],'unique':_0x99b6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x99b6('0x2')]},'companyId':{'type':Sequelize[_0x99b6('0x2')]},'website':{'type':Sequelize[_0x99b6('0x2')]},'phone':{'type':Sequelize[_0x99b6('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x99b6('0x2')]},'street':{'type':Sequelize[_0x99b6('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x99b6('0x2')]},'country':{'type':Sequelize[_0x99b6('0x2')]},'email':{'type':Sequelize[_0x99b6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x99b6('0x2')]},'sPostalCode':{'type':Sequelize[_0x99b6('0x2')]},'sCity':{'type':Sequelize[_0x99b6('0x2')]},'sCountry':{'type':Sequelize[_0x99b6('0x2')]},'description':{'type':Sequelize[_0x99b6('0x2')]}}; \ No newline at end of file +var _0xef2e=['exports','STRING','name'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0xef2e,0x141));var _0xeef2=function(_0x3246b4,_0x401153){_0x3246b4=_0x3246b4-0x0;var _0x34b3d7=_0xef2e[_0x3246b4];return _0x34b3d7;};'use strict';var Sequelize=require('sequelize');module[_0xeef2('0x0')]={'name':{'type':Sequelize[_0xeef2('0x1')],'unique':_0xeef2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xeef2('0x1')]},'companyId':{'type':Sequelize[_0xeef2('0x1')]},'website':{'type':Sequelize[_0xeef2('0x1')]},'phone':{'type':Sequelize[_0xeef2('0x1')]},'fax':{'type':Sequelize[_0xeef2('0x1')]},'type':{'type':Sequelize[_0xeef2('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xeef2('0x1')]},'city':{'type':Sequelize[_0xeef2('0x1')]},'country':{'type':Sequelize[_0xeef2('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xeef2('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xeef2('0x1')]},'sCity':{'type':Sequelize[_0xeef2('0x1')]},'sCountry':{'type':Sequelize[_0xeef2('0x1')]},'description':{'type':Sequelize[_0xeef2('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 119d7b3..3090173 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 _0x3c6f=['apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','stack','name','send','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','CmCompany','include','findAll','rows','catch','show','params','intersection','includeAll','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','describe','addContacts','CmContact','ids','omit','findOne','rawAttributes','getContacts','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','json'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x3c6f,0x135));var _0xf3c6=function(_0x47520a,_0x2b772c){_0x47520a=_0x47520a-0x0;var _0x344661=_0x3c6f[_0x47520a];return _0x344661;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf3c6('0x0'));var zipdir=require(_0xf3c6('0x1'));var jsonpatch=require(_0xf3c6('0x2'));var rp=require('request-promise');var moment=require(_0xf3c6('0x3'));var BPromise=require(_0xf3c6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf3c6('0x5'));var sox=require(_0xf3c6('0x6'));var csv=require(_0xf3c6('0x7'));var ejs=require(_0xf3c6('0x8'));var fs=require('fs');var fs_extra=require(_0xf3c6('0x9'));var _=require(_0xf3c6('0xa'));var squel=require('squel');var crypto=require(_0xf3c6('0xb'));var jsforce=require(_0xf3c6('0xc'));var deskjs=require(_0xf3c6('0xd'));var toCsv=require(_0xf3c6('0x7'));var querystring=require(_0xf3c6('0xe'));var Papa=require(_0xf3c6('0xf'));var Redis=require(_0xf3c6('0x10'));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(_0xf3c6('0x11'))(_0xf3c6('0x12'));var utils=require(_0xf3c6('0x13'));var config=require(_0xf3c6('0x14'));var licenseUtil=require(_0xf3c6('0x15'));var db=require(_0xf3c6('0x16'))['db'];function respondWithStatusCode(_0x2c20b8,_0x55eea1){_0x55eea1=_0x55eea1||0xcc;return function(_0x504c1f){if(_0x504c1f){return _0x2c20b8[_0xf3c6('0x17')](_0x55eea1);}return _0x2c20b8[_0xf3c6('0x18')](_0x55eea1)['end']();};}function respondWithResult(_0x794555,_0x57d357){_0x57d357=_0x57d357||0xc8;return function(_0x169016){if(_0x169016){return _0x794555[_0xf3c6('0x18')](_0x57d357)['json'](_0x169016);}};}function respondWithFilteredResult(_0x333963,_0x1a64f9){return function(_0x474341){if(_0x474341){var _0x323b46=typeof _0x1a64f9['offset']===_0xf3c6('0x19')&&typeof _0x1a64f9['limit']===_0xf3c6('0x19');var _0x1fa22a=_0x474341[_0xf3c6('0x1a')];var _0x53b8ab=_0x323b46?0x0:_0x1a64f9[_0xf3c6('0x1b')];var _0x23c88f=_0x323b46?_0x474341['count']:_0x1a64f9['offset']+_0x1a64f9[_0xf3c6('0x1c')];var _0x46f077;if(_0x23c88f>=_0x1fa22a){_0x23c88f=_0x1fa22a;_0x46f077=0xc8;}else{_0x46f077=0xce;}_0x333963[_0xf3c6('0x18')](_0x46f077);return _0x333963[_0xf3c6('0x1d')]('Content-Range',_0x53b8ab+'-'+_0x23c88f+'/'+_0x1fa22a)[_0xf3c6('0x1e')](_0x474341);}return null;};}function patchUpdates(_0x3d2b4b){return function(_0x4ef935){try{jsonpatch[_0xf3c6('0x1f')](_0x4ef935,_0x3d2b4b,!![]);}catch(_0x2992e6){return BPromise[_0xf3c6('0x20')](_0x2992e6);}return _0x4ef935[_0xf3c6('0x21')]();};}function saveUpdates(_0x127fe2,_0x4009da){return function(_0x2d0697){if(_0x2d0697){return _0x2d0697[_0xf3c6('0x22')](_0x127fe2)[_0xf3c6('0x23')](function(_0x224789){return _0x224789;});}return null;};}function removeEntity(_0x23c3ce,_0x31cff0){return function(_0x4cacc1){if(_0x4cacc1){return _0x4cacc1[_0xf3c6('0x24')]()['then'](function(){var _0x1ae62d=_0x4cacc1[_0xf3c6('0x25')]({'plain':!![]});var _0x4958b1=_0xf3c6('0x26');return db[_0xf3c6('0x27')][_0xf3c6('0x24')]({'where':{'type':_0x4958b1,'resourceId':_0x1ae62d['id']}})['then'](function(){return _0x4cacc1;});})[_0xf3c6('0x23')](function(){_0x23c3ce[_0xf3c6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4b20,_0x2c1131){return function(_0x56ee0c){if(!_0x56ee0c){_0x3e4b20['sendStatus'](0x194);}return _0x56ee0c;};}function handleError(_0x86d8bd,_0xd81cb9){_0xd81cb9=_0xd81cb9||0x1f4;return function(_0x153ff8){logger['error'](_0x153ff8[_0xf3c6('0x28')]);if(_0x153ff8['name']){delete _0x153ff8[_0xf3c6('0x29')];}_0x86d8bd[_0xf3c6('0x18')](_0xd81cb9)[_0xf3c6('0x2a')](_0x153ff8);};}exports['index']=function(_0x38da9d,_0x57cb1b){var _0x3f55dd={},_0x258116={},_0x2840e8={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0xf3c6('0x23')](function(_0x16766e){_0x258116[_0xf3c6('0x2b')]=_['keys'](_0x16766e);_0x258116[_0xf3c6('0x2c')]=_[_0xf3c6('0x2d')](_0x38da9d[_0xf3c6('0x2c')]);_0x258116[_0xf3c6('0x2e')]=_['intersection'](_0x258116['model'],_0x258116[_0xf3c6('0x2c')]);_0x3f55dd['attributes']=_['intersection'](_0x258116['model'],qs[_0xf3c6('0x2f')](_0x38da9d[_0xf3c6('0x2c')]['fields']));_0x3f55dd[_0xf3c6('0x30')]=_0x3f55dd['attributes'][_0xf3c6('0x31')]?_0x3f55dd['attributes']:_0x258116[_0xf3c6('0x2b')];if(!_0x38da9d[_0xf3c6('0x2c')][_0xf3c6('0x32')]('nolimit')){_0x3f55dd['limit']=qs[_0xf3c6('0x1c')](_0x38da9d[_0xf3c6('0x2c')][_0xf3c6('0x1c')]);_0x3f55dd['offset']=qs[_0xf3c6('0x1b')](_0x38da9d[_0xf3c6('0x2c')][_0xf3c6('0x1b')]);}_0x3f55dd[_0xf3c6('0x33')]=qs[_0xf3c6('0x34')](_0x38da9d[_0xf3c6('0x2c')][_0xf3c6('0x34')]);_0x3f55dd[_0xf3c6('0x35')]=qs[_0xf3c6('0x2e')](_[_0xf3c6('0x36')](_0x38da9d[_0xf3c6('0x2c')],_0x258116[_0xf3c6('0x2e')]),_0x16766e);if(_0x38da9d[_0xf3c6('0x2c')]['filter']){_0x3f55dd[_0xf3c6('0x35')]=_[_0xf3c6('0x37')](_0x3f55dd[_0xf3c6('0x35')],{'$or':_['map'](_0x3f55dd[_0xf3c6('0x30')],function(_0x3bfc8d){var _0x42d31d={};_0x42d31d[_0x3bfc8d]={'$like':'%'+_0x38da9d[_0xf3c6('0x2c')][_0xf3c6('0x38')]+'%'};return _0x42d31d;})});}_0x3f55dd=_[_0xf3c6('0x37')]({},_0x3f55dd,_0x38da9d[_0xf3c6('0x39')]);var _0x1e69b9={'where':_0x3f55dd[_0xf3c6('0x35')]};return db[_0xf3c6('0x3a')][_0xf3c6('0x1a')](_0x1e69b9)[_0xf3c6('0x23')](function(_0x41aece){_0x2840e8[_0xf3c6('0x1a')]=_0x41aece;if(_0x38da9d['query']['includeAll']){_0x3f55dd[_0xf3c6('0x3b')]=[{'all':!![]}];}return db[_0xf3c6('0x3a')][_0xf3c6('0x3c')](_0x3f55dd);})[_0xf3c6('0x23')](function(_0x3e3d8c){_0x2840e8[_0xf3c6('0x3d')]=_0x3e3d8c;return _0x2840e8;})['then'](respondWithFilteredResult(_0x57cb1b,_0x3f55dd))[_0xf3c6('0x3e')](handleError(_0x57cb1b,null));})[_0xf3c6('0x3e')](handleError(_0x57cb1b,null));};exports[_0xf3c6('0x3f')]=function(_0x13471c,_0x46a094){var _0x1a3a20={'raw':![],'where':{'id':_0x13471c[_0xf3c6('0x40')]['id']}},_0x3957c1={};_0x3957c1[_0xf3c6('0x2b')]=_[_0xf3c6('0x2d')](db[_0xf3c6('0x3a')]['rawAttributes']);_0x3957c1[_0xf3c6('0x2c')]=_[_0xf3c6('0x2d')](_0x13471c[_0xf3c6('0x2c')]);_0x3957c1['filters']=_['intersection'](_0x3957c1[_0xf3c6('0x2b')],_0x3957c1[_0xf3c6('0x2c')]);_0x1a3a20[_0xf3c6('0x30')]=_[_0xf3c6('0x41')](_0x3957c1['model'],qs[_0xf3c6('0x2f')](_0x13471c['query'][_0xf3c6('0x2f')]));_0x1a3a20[_0xf3c6('0x30')]=_0x1a3a20['attributes']['length']?_0x1a3a20[_0xf3c6('0x30')]:_0x3957c1[_0xf3c6('0x2b')];if(_0x13471c[_0xf3c6('0x2c')][_0xf3c6('0x42')]){_0x1a3a20[_0xf3c6('0x3b')]=[{'all':!![]}];}_0x1a3a20=_[_0xf3c6('0x37')]({},_0x1a3a20,_0x13471c[_0xf3c6('0x39')]);return db[_0xf3c6('0x3a')][_0xf3c6('0x43')](_0x1a3a20)[_0xf3c6('0x23')](handleEntityNotFound(_0x46a094,null))['then'](respondWithResult(_0x46a094,null))[_0xf3c6('0x3e')](handleError(_0x46a094,null));};exports[_0xf3c6('0x44')]=function(_0x56dc2c,_0x3cfd54){return db[_0xf3c6('0x3a')][_0xf3c6('0x44')](_0x56dc2c['body'],{})[_0xf3c6('0x23')](function(_0x44e3fe){var _0x26f1c3=_0x56dc2c[_0xf3c6('0x45')][_0xf3c6('0x25')]({'plain':!![]});if(!_0x26f1c3)throw new Error(_0xf3c6('0x46'));if(_0x26f1c3[_0xf3c6('0x47')]===_0xf3c6('0x45')){var _0x23c836=_0x44e3fe['get']({'plain':!![]});var _0x1beb95=_0xf3c6('0x26');return db[_0xf3c6('0x48')]['find']({'where':{'name':_0x1beb95,'userProfileId':_0x26f1c3[_0xf3c6('0x49')]},'raw':!![]})[_0xf3c6('0x23')](function(_0x5b7fa9){if(_0x5b7fa9&&_0x5b7fa9['autoAssociation']===0x0){return db[_0xf3c6('0x27')]['create']({'name':_0x23c836['name'],'resourceId':_0x23c836['id'],'type':_0x5b7fa9[_0xf3c6('0x29')],'sectionId':_0x5b7fa9['id']},{})['then'](function(){return _0x44e3fe;});}else{return _0x44e3fe;}})[_0xf3c6('0x3e')](function(_0xfaaef2){logger[_0xf3c6('0x4a')](_0xf3c6('0x4b'),_0xfaaef2);throw _0xfaaef2;});}return _0x44e3fe;})[_0xf3c6('0x23')](respondWithResult(_0x3cfd54,0xc9))[_0xf3c6('0x3e')](handleError(_0x3cfd54,null));};exports[_0xf3c6('0x22')]=function(_0xc30ef7,_0x4a7473){if(_0xc30ef7[_0xf3c6('0x4c')]['id']){delete _0xc30ef7[_0xf3c6('0x4c')]['id'];}return db[_0xf3c6('0x3a')]['find']({'where':{'id':_0xc30ef7[_0xf3c6('0x40')]['id']}})[_0xf3c6('0x23')](handleEntityNotFound(_0x4a7473,null))[_0xf3c6('0x23')](saveUpdates(_0xc30ef7['body'],null))[_0xf3c6('0x23')](respondWithResult(_0x4a7473,null))[_0xf3c6('0x3e')](handleError(_0x4a7473,null));};exports[_0xf3c6('0x24')]=function(_0x103932,_0x4626cf){return db[_0xf3c6('0x3a')]['find']({'where':{'id':_0x103932[_0xf3c6('0x40')]['id']}})[_0xf3c6('0x23')](handleEntityNotFound(_0x4626cf,null))[_0xf3c6('0x23')](removeEntity(_0x4626cf,null))[_0xf3c6('0x3e')](handleError(_0x4626cf,null));};exports['describe']=function(_0x410ac8,_0x58edef){return db['CmCompany'][_0xf3c6('0x4d')]()[_0xf3c6('0x23')](respondWithResult(_0x58edef,null))[_0xf3c6('0x3e')](handleError(_0x58edef,null));};exports[_0xf3c6('0x4e')]=function(_0x2e3e8c,_0x29897a,_0x448d44){return db[_0xf3c6('0x4f')][_0xf3c6('0x43')]({'where':{'id':_0x2e3e8c['params']['id']}})[_0xf3c6('0x23')](handleEntityNotFound(_0x29897a,null))[_0xf3c6('0x23')](function(_0x431a69){if(_0x431a69){return _0x431a69[_0xf3c6('0x4e')](_0x2e3e8c[_0xf3c6('0x4c')][_0xf3c6('0x50')],_[_0xf3c6('0x51')](_0x2e3e8c[_0xf3c6('0x4c')],[_0xf3c6('0x50'),'id'])||{});}})['then'](respondWithResult(_0x29897a,null))['catch'](handleError(_0x29897a,null));};exports['getContacts']=function(_0x14f2d8,_0x2df367,_0x3f4639){var _0x3b8c6f={};var _0x3d60b5={};var _0xd55ac3;var _0x1abf0f;return db[_0xf3c6('0x3a')][_0xf3c6('0x52')]({'where':{'id':_0x14f2d8[_0xf3c6('0x40')]['id']}})[_0xf3c6('0x23')](handleEntityNotFound(_0x2df367,null))[_0xf3c6('0x23')](function(_0x7767d8){if(_0x7767d8){_0xd55ac3=_0x7767d8;_0x3d60b5['model']=_[_0xf3c6('0x2d')](db[_0xf3c6('0x4f')][_0xf3c6('0x53')]);_0x3d60b5['query']=_[_0xf3c6('0x2d')](_0x14f2d8[_0xf3c6('0x2c')]);_0x3d60b5[_0xf3c6('0x2e')]=_[_0xf3c6('0x41')](_0x3d60b5[_0xf3c6('0x2b')],_0x3d60b5[_0xf3c6('0x2c')]);_0x3b8c6f['attributes']=_[_0xf3c6('0x41')](_0x3d60b5[_0xf3c6('0x2b')],qs[_0xf3c6('0x2f')](_0x14f2d8[_0xf3c6('0x2c')][_0xf3c6('0x2f')]));_0x3b8c6f[_0xf3c6('0x30')]=_0x3b8c6f[_0xf3c6('0x30')][_0xf3c6('0x31')]?_0x3b8c6f[_0xf3c6('0x30')]:_0x3d60b5[_0xf3c6('0x2b')];_0x3b8c6f[_0xf3c6('0x33')]=qs[_0xf3c6('0x34')](_0x14f2d8[_0xf3c6('0x2c')][_0xf3c6('0x34')]);_0x3b8c6f[_0xf3c6('0x35')]=qs[_0xf3c6('0x2e')](_[_0xf3c6('0x36')](_0x14f2d8[_0xf3c6('0x2c')],_0x3d60b5[_0xf3c6('0x2e')]));if(_0x14f2d8['query'][_0xf3c6('0x38')]){_0x3b8c6f['where']=_[_0xf3c6('0x37')](_0x3b8c6f[_0xf3c6('0x35')],{'$or':_['map'](_0x3b8c6f[_0xf3c6('0x30')],function(_0x5cb884){var _0x76dd21={};_0x76dd21[_0x5cb884]={'$like':'%'+_0x14f2d8['query']['filter']+'%'};return _0x76dd21;})});}_0x3b8c6f=_[_0xf3c6('0x37')]({},_0x3b8c6f,_0x14f2d8[_0xf3c6('0x39')]);return _0xd55ac3[_0xf3c6('0x54')](_0x3b8c6f);}})[_0xf3c6('0x23')](function(_0x4ed755){if(_0x4ed755){_0x1abf0f=_0x4ed755['length'];if(!_0x14f2d8[_0xf3c6('0x2c')][_0xf3c6('0x32')]('nolimit')){_0x3b8c6f[_0xf3c6('0x1c')]=qs['limit'](_0x14f2d8['query'][_0xf3c6('0x1c')]);_0x3b8c6f[_0xf3c6('0x1b')]=qs[_0xf3c6('0x1b')](_0x14f2d8[_0xf3c6('0x2c')]['offset']);}return _0xd55ac3[_0xf3c6('0x54')](_0x3b8c6f);}})[_0xf3c6('0x23')](function(_0x16efe3){if(_0x16efe3){return _0x16efe3?{'count':_0x1abf0f,'rows':_0x16efe3}:null;}})[_0xf3c6('0x23')](respondWithResult(_0x2df367,null))[_0xf3c6('0x3e')](handleError(_0x2df367,null));}; \ No newline at end of file +var _0xe1d9=['includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','getContacts','order','nolimit','eml-format','zip-dir','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','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','reject','destroy','then','get','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','options'];(function(_0x1b1bd5,_0xf50a3){var _0x12bf17=function(_0x5a1a9f){while(--_0x5a1a9f){_0x1b1bd5['push'](_0x1b1bd5['shift']());}};_0x12bf17(++_0xf50a3);}(_0xe1d9,0x1db));var _0x9e1d=function(_0x41e2b9,_0x3270cc){_0x41e2b9=_0x41e2b9-0x0;var _0x3ca389=_0xe1d9[_0x41e2b9];return _0x3ca389;};'use strict';var emlformat=require(_0x9e1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9e1d('0x2'));var BPromise=require(_0x9e1d('0x3'));var Mustache=require(_0x9e1d('0x4'));var util=require(_0x9e1d('0x5'));var path=require('path');var sox=require(_0x9e1d('0x6'));var csv=require('to-csv');var ejs=require(_0x9e1d('0x7'));var fs=require('fs');var fs_extra=require(_0x9e1d('0x8'));var _=require(_0x9e1d('0x9'));var squel=require(_0x9e1d('0xa'));var crypto=require(_0x9e1d('0xb'));var jsforce=require(_0x9e1d('0xc'));var deskjs=require(_0x9e1d('0xd'));var toCsv=require(_0x9e1d('0xe'));var querystring=require(_0x9e1d('0xf'));var Papa=require(_0x9e1d('0x10'));var Redis=require(_0x9e1d('0x11'));var authService=require(_0x9e1d('0x12'));var qs=require(_0x9e1d('0x13'));var as=require(_0x9e1d('0x14'));var hardwareService=require(_0x9e1d('0x15'));var logger=require(_0x9e1d('0x16'))(_0x9e1d('0x17'));var utils=require(_0x9e1d('0x18'));var config=require(_0x9e1d('0x19'));var licenseUtil=require(_0x9e1d('0x1a'));var db=require(_0x9e1d('0x1b'))['db'];function respondWithStatusCode(_0x56a0cb,_0xfbfe22){_0xfbfe22=_0xfbfe22||0xcc;return function(_0x58fea5){if(_0x58fea5){return _0x56a0cb[_0x9e1d('0x1c')](_0xfbfe22);}return _0x56a0cb[_0x9e1d('0x1d')](_0xfbfe22)[_0x9e1d('0x1e')]();};}function respondWithResult(_0x2b9485,_0x4f7e95){_0x4f7e95=_0x4f7e95||0xc8;return function(_0x24ebcc){if(_0x24ebcc){return _0x2b9485[_0x9e1d('0x1d')](_0x4f7e95)[_0x9e1d('0x1f')](_0x24ebcc);}};}function respondWithFilteredResult(_0x8393a7,_0x2c0904){return function(_0x3bb149){if(_0x3bb149){var _0x5c290d=typeof _0x2c0904['offset']===_0x9e1d('0x20')&&typeof _0x2c0904[_0x9e1d('0x21')]===_0x9e1d('0x20');var _0x432918=_0x3bb149[_0x9e1d('0x22')];var _0x34bc7d=_0x5c290d?0x0:_0x2c0904[_0x9e1d('0x23')];var _0x5aa2b7=_0x5c290d?_0x3bb149[_0x9e1d('0x22')]:_0x2c0904[_0x9e1d('0x23')]+_0x2c0904[_0x9e1d('0x21')];var _0x3a480a;if(_0x5aa2b7>=_0x432918){_0x5aa2b7=_0x432918;_0x3a480a=0xc8;}else{_0x3a480a=0xce;}_0x8393a7[_0x9e1d('0x1d')](_0x3a480a);return _0x8393a7[_0x9e1d('0x24')]('Content-Range',_0x34bc7d+'-'+_0x5aa2b7+'/'+_0x432918)[_0x9e1d('0x1f')](_0x3bb149);}return null;};}function patchUpdates(_0x18dfe9){return function(_0x117469){try{jsonpatch['apply'](_0x117469,_0x18dfe9,!![]);}catch(_0x410e0a){return BPromise[_0x9e1d('0x25')](_0x410e0a);}return _0x117469['save']();};}function saveUpdates(_0x304ef8,_0x7ea22e){return function(_0x3ed631){if(_0x3ed631){return _0x3ed631['update'](_0x304ef8)['then'](function(_0x1cd08){return _0x1cd08;});}return null;};}function removeEntity(_0x15d7c1,_0x4bb710){return function(_0x566bc4){if(_0x566bc4){return _0x566bc4[_0x9e1d('0x26')]()[_0x9e1d('0x27')](function(){var _0x14427d=_0x566bc4[_0x9e1d('0x28')]({'plain':!![]});var _0x1b76bb=_0x9e1d('0x29');return db[_0x9e1d('0x2a')][_0x9e1d('0x26')]({'where':{'type':_0x1b76bb,'resourceId':_0x14427d['id']}})['then'](function(){return _0x566bc4;});})['then'](function(){_0x15d7c1[_0x9e1d('0x1d')](0xcc)[_0x9e1d('0x1e')]();});}};}function handleEntityNotFound(_0x264e2d,_0x224482){return function(_0x1a9e7d){if(!_0x1a9e7d){_0x264e2d[_0x9e1d('0x1c')](0x194);}return _0x1a9e7d;};}function handleError(_0x4c81d0,_0x265a19){_0x265a19=_0x265a19||0x1f4;return function(_0x4d00a3){logger['error'](_0x4d00a3[_0x9e1d('0x2b')]);if(_0x4d00a3[_0x9e1d('0x2c')]){delete _0x4d00a3[_0x9e1d('0x2c')];}_0x4c81d0[_0x9e1d('0x1d')](_0x265a19)[_0x9e1d('0x2d')](_0x4d00a3);};}exports[_0x9e1d('0x2e')]=function(_0x3a91b2,_0x4790fe){var _0x231814={},_0x2c27fa={},_0x26e083={'count':0x0,'rows':[]};return db[_0x9e1d('0x2f')][_0x9e1d('0x30')]()[_0x9e1d('0x27')](function(_0x3e6212){_0x2c27fa[_0x9e1d('0x31')]=_[_0x9e1d('0x32')](_0x3e6212);_0x2c27fa[_0x9e1d('0x33')]=_[_0x9e1d('0x32')](_0x3a91b2['query']);_0x2c27fa[_0x9e1d('0x34')]=_[_0x9e1d('0x35')](_0x2c27fa['model'],_0x2c27fa[_0x9e1d('0x33')]);_0x231814[_0x9e1d('0x36')]=_[_0x9e1d('0x35')](_0x2c27fa[_0x9e1d('0x31')],qs[_0x9e1d('0x37')](_0x3a91b2[_0x9e1d('0x33')]['fields']));_0x231814[_0x9e1d('0x36')]=_0x231814['attributes'][_0x9e1d('0x38')]?_0x231814['attributes']:_0x2c27fa[_0x9e1d('0x31')];if(!_0x3a91b2[_0x9e1d('0x33')][_0x9e1d('0x39')]('nolimit')){_0x231814['limit']=qs[_0x9e1d('0x21')](_0x3a91b2[_0x9e1d('0x33')][_0x9e1d('0x21')]);_0x231814[_0x9e1d('0x23')]=qs[_0x9e1d('0x23')](_0x3a91b2[_0x9e1d('0x33')][_0x9e1d('0x23')]);}_0x231814['order']=qs[_0x9e1d('0x3a')](_0x3a91b2[_0x9e1d('0x33')][_0x9e1d('0x3a')]);_0x231814[_0x9e1d('0x3b')]=qs[_0x9e1d('0x34')](_[_0x9e1d('0x3c')](_0x3a91b2[_0x9e1d('0x33')],_0x2c27fa[_0x9e1d('0x34')]),_0x3e6212);if(_0x3a91b2[_0x9e1d('0x33')][_0x9e1d('0x3d')]){_0x231814['where']=_[_0x9e1d('0x3e')](_0x231814[_0x9e1d('0x3b')],{'$or':_[_0x9e1d('0x3f')](_0x231814['attributes'],function(_0x20718a){var _0x51d0e9={};_0x51d0e9[_0x20718a]={'$like':'%'+_0x3a91b2[_0x9e1d('0x33')]['filter']+'%'};return _0x51d0e9;})});}_0x231814=_[_0x9e1d('0x3e')]({},_0x231814,_0x3a91b2[_0x9e1d('0x40')]);var _0x3d4bf8={'where':_0x231814[_0x9e1d('0x3b')]};return db[_0x9e1d('0x2f')][_0x9e1d('0x22')](_0x3d4bf8)[_0x9e1d('0x27')](function(_0x38e36e){_0x26e083[_0x9e1d('0x22')]=_0x38e36e;if(_0x3a91b2[_0x9e1d('0x33')][_0x9e1d('0x41')]){_0x231814['include']=[{'all':!![]}];}return db['CmCompany'][_0x9e1d('0x42')](_0x231814);})[_0x9e1d('0x27')](function(_0x3ad340){_0x26e083[_0x9e1d('0x43')]=_0x3ad340;return _0x26e083;})[_0x9e1d('0x27')](respondWithFilteredResult(_0x4790fe,_0x231814))[_0x9e1d('0x44')](handleError(_0x4790fe,null));})[_0x9e1d('0x44')](handleError(_0x4790fe,null));};exports[_0x9e1d('0x45')]=function(_0x4aa159,_0x405178){var _0x17ca87={'raw':![],'where':{'id':_0x4aa159[_0x9e1d('0x46')]['id']}},_0x325cd2={};_0x325cd2['model']=_[_0x9e1d('0x32')](db[_0x9e1d('0x2f')][_0x9e1d('0x47')]);_0x325cd2[_0x9e1d('0x33')]=_[_0x9e1d('0x32')](_0x4aa159[_0x9e1d('0x33')]);_0x325cd2['filters']=_[_0x9e1d('0x35')](_0x325cd2[_0x9e1d('0x31')],_0x325cd2[_0x9e1d('0x33')]);_0x17ca87['attributes']=_[_0x9e1d('0x35')](_0x325cd2[_0x9e1d('0x31')],qs['fields'](_0x4aa159[_0x9e1d('0x33')][_0x9e1d('0x37')]));_0x17ca87['attributes']=_0x17ca87[_0x9e1d('0x36')][_0x9e1d('0x38')]?_0x17ca87[_0x9e1d('0x36')]:_0x325cd2[_0x9e1d('0x31')];if(_0x4aa159[_0x9e1d('0x33')]['includeAll']){_0x17ca87[_0x9e1d('0x48')]=[{'all':!![]}];}_0x17ca87=_[_0x9e1d('0x3e')]({},_0x17ca87,_0x4aa159[_0x9e1d('0x40')]);return db[_0x9e1d('0x2f')][_0x9e1d('0x49')](_0x17ca87)['then'](handleEntityNotFound(_0x405178,null))['then'](respondWithResult(_0x405178,null))[_0x9e1d('0x44')](handleError(_0x405178,null));};exports[_0x9e1d('0x4a')]=function(_0x13b191,_0x45c4f8){return db[_0x9e1d('0x2f')][_0x9e1d('0x4a')](_0x13b191['body'],{})['then'](function(_0x557049){var _0x135ab7=_0x13b191[_0x9e1d('0x4b')]['get']({'plain':!![]});if(!_0x135ab7)throw new Error(_0x9e1d('0x4c'));if(_0x135ab7[_0x9e1d('0x4d')]===_0x9e1d('0x4b')){var _0xd220f4=_0x557049[_0x9e1d('0x28')]({'plain':!![]});var _0x5d10f8='Companies';return db[_0x9e1d('0x4e')]['find']({'where':{'name':_0x5d10f8,'userProfileId':_0x135ab7[_0x9e1d('0x4f')]},'raw':!![]})[_0x9e1d('0x27')](function(_0x3f6489){if(_0x3f6489&&_0x3f6489[_0x9e1d('0x50')]===0x0){return db[_0x9e1d('0x2a')][_0x9e1d('0x4a')]({'name':_0xd220f4[_0x9e1d('0x2c')],'resourceId':_0xd220f4['id'],'type':_0x3f6489['name'],'sectionId':_0x3f6489['id']},{})[_0x9e1d('0x27')](function(){return _0x557049;});}else{return _0x557049;}})[_0x9e1d('0x44')](function(_0x59a6de){logger[_0x9e1d('0x51')](_0x9e1d('0x52'),_0x59a6de);throw _0x59a6de;});}return _0x557049;})['then'](respondWithResult(_0x45c4f8,0xc9))[_0x9e1d('0x44')](handleError(_0x45c4f8,null));};exports['update']=function(_0x67ebec,_0x3d522d){if(_0x67ebec[_0x9e1d('0x53')]['id']){delete _0x67ebec[_0x9e1d('0x53')]['id'];}return db[_0x9e1d('0x2f')][_0x9e1d('0x49')]({'where':{'id':_0x67ebec[_0x9e1d('0x46')]['id']}})[_0x9e1d('0x27')](handleEntityNotFound(_0x3d522d,null))[_0x9e1d('0x27')](saveUpdates(_0x67ebec['body'],null))[_0x9e1d('0x27')](respondWithResult(_0x3d522d,null))['catch'](handleError(_0x3d522d,null));};exports['destroy']=function(_0x2b5316,_0x5c76a6){return db[_0x9e1d('0x2f')]['find']({'where':{'id':_0x2b5316['params']['id']}})[_0x9e1d('0x27')](handleEntityNotFound(_0x5c76a6,null))[_0x9e1d('0x27')](removeEntity(_0x5c76a6,null))[_0x9e1d('0x44')](handleError(_0x5c76a6,null));};exports[_0x9e1d('0x30')]=function(_0x105d4b,_0x252de2){return db[_0x9e1d('0x2f')][_0x9e1d('0x30')]()[_0x9e1d('0x27')](respondWithResult(_0x252de2,null))[_0x9e1d('0x44')](handleError(_0x252de2,null));};exports[_0x9e1d('0x54')]=function(_0x57c8c9,_0x573a2f,_0x535c42){return db[_0x9e1d('0x55')][_0x9e1d('0x49')]({'where':{'id':_0x57c8c9[_0x9e1d('0x46')]['id']}})[_0x9e1d('0x27')](handleEntityNotFound(_0x573a2f,null))[_0x9e1d('0x27')](function(_0x31fb62){if(_0x31fb62){return _0x31fb62[_0x9e1d('0x54')](_0x57c8c9[_0x9e1d('0x53')][_0x9e1d('0x56')],_['omit'](_0x57c8c9['body'],[_0x9e1d('0x56'),'id'])||{});}})[_0x9e1d('0x27')](respondWithResult(_0x573a2f,null))[_0x9e1d('0x44')](handleError(_0x573a2f,null));};exports[_0x9e1d('0x57')]=function(_0x4eec69,_0x7c7ecc,_0x141fff){var _0x3f9658={};var _0x546cc5={};var _0x2c8659;var _0x134ee1;return db[_0x9e1d('0x2f')]['findOne']({'where':{'id':_0x4eec69[_0x9e1d('0x46')]['id']}})[_0x9e1d('0x27')](handleEntityNotFound(_0x7c7ecc,null))[_0x9e1d('0x27')](function(_0x1384b9){if(_0x1384b9){_0x2c8659=_0x1384b9;_0x546cc5[_0x9e1d('0x31')]=_['keys'](db[_0x9e1d('0x55')]['rawAttributes']);_0x546cc5[_0x9e1d('0x33')]=_['keys'](_0x4eec69[_0x9e1d('0x33')]);_0x546cc5['filters']=_['intersection'](_0x546cc5[_0x9e1d('0x31')],_0x546cc5['query']);_0x3f9658[_0x9e1d('0x36')]=_['intersection'](_0x546cc5[_0x9e1d('0x31')],qs[_0x9e1d('0x37')](_0x4eec69[_0x9e1d('0x33')][_0x9e1d('0x37')]));_0x3f9658[_0x9e1d('0x36')]=_0x3f9658[_0x9e1d('0x36')][_0x9e1d('0x38')]?_0x3f9658[_0x9e1d('0x36')]:_0x546cc5['model'];_0x3f9658[_0x9e1d('0x58')]=qs[_0x9e1d('0x3a')](_0x4eec69['query'][_0x9e1d('0x3a')]);_0x3f9658[_0x9e1d('0x3b')]=qs[_0x9e1d('0x34')](_[_0x9e1d('0x3c')](_0x4eec69['query'],_0x546cc5['filters']));if(_0x4eec69['query'][_0x9e1d('0x3d')]){_0x3f9658['where']=_['merge'](_0x3f9658['where'],{'$or':_[_0x9e1d('0x3f')](_0x3f9658['attributes'],function(_0x312298){var _0x197551={};_0x197551[_0x312298]={'$like':'%'+_0x4eec69[_0x9e1d('0x33')][_0x9e1d('0x3d')]+'%'};return _0x197551;})});}_0x3f9658=_['merge']({},_0x3f9658,_0x4eec69['options']);return _0x2c8659[_0x9e1d('0x57')](_0x3f9658);}})[_0x9e1d('0x27')](function(_0x2f708e){if(_0x2f708e){_0x134ee1=_0x2f708e[_0x9e1d('0x38')];if(!_0x4eec69[_0x9e1d('0x33')][_0x9e1d('0x39')](_0x9e1d('0x59'))){_0x3f9658['limit']=qs[_0x9e1d('0x21')](_0x4eec69[_0x9e1d('0x33')][_0x9e1d('0x21')]);_0x3f9658[_0x9e1d('0x23')]=qs[_0x9e1d('0x23')](_0x4eec69['query'][_0x9e1d('0x23')]);}return _0x2c8659[_0x9e1d('0x57')](_0x3f9658);}})[_0x9e1d('0x27')](function(_0x2a2a1c){if(_0x2a2a1c){return _0x2a2a1c?{'count':_0x134ee1,'rows':_0x2a2a1c}:null;}})[_0x9e1d('0x27')](respondWithResult(_0x7c7ecc,null))[_0x9e1d('0x44')](handleError(_0x7c7ecc,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 5f94457..cfb0373 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 _0xa17c=['exports','cm_companies','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0xad68cf,_0x215bce){var _0x3d7b1d=function(_0x12fe01){while(--_0x12fe01){_0xad68cf['push'](_0xad68cf['shift']());}};_0x3d7b1d(++_0x215bce);}(_0xa17c,0xe9));var _0xca17=function(_0x45cf81,_0x40701e){_0x45cf81=_0x45cf81-0x0;var _0x1a7a92=_0xa17c[_0x45cf81];return _0x1a7a92;};'use strict';var _=require('lodash');var util=require(_0xca17('0x0'));var logger=require(_0xca17('0x1'))(_0xca17('0x2'));var moment=require(_0xca17('0x3'));var BPromise=require('bluebird');var rp=require(_0xca17('0x4'));var fs=require('fs');var path=require(_0xca17('0x5'));var rimraf=require(_0xca17('0x6'));var config=require(_0xca17('0x7'));var attributes=require(_0xca17('0x8'));module[_0xca17('0x9')]=function(_0x5bd5ea,_0x150480){return _0x5bd5ea['define']('CmCompany',attributes,{'tableName':_0xca17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7628=['path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','api','moment','request-promise'];(function(_0x2d8128,_0x525a80){var _0x5b9feb=function(_0x2c294b){while(--_0x2c294b){_0x2d8128['push'](_0x2d8128['shift']());}};_0x5b9feb(++_0x525a80);}(_0x7628,0x17d));var _0x8762=function(_0x5c4274,_0x400429){_0x5c4274=_0x5c4274-0x0;var _0x582abd=_0x7628[_0x5c4274];return _0x582abd;};'use strict';var _=require(_0x8762('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8762('0x1'));var moment=require(_0x8762('0x2'));var BPromise=require('bluebird');var rp=require(_0x8762('0x3'));var fs=require('fs');var path=require(_0x8762('0x4'));var rimraf=require(_0x8762('0x5'));var config=require(_0x8762('0x6'));var attributes=require(_0x8762('0x7'));module['exports']=function(_0x21344f,_0x1b813e){return _0x21344f[_0x8762('0x8')](_0x8762('0x9'),attributes,{'tableName':_0x8762('0xa'),'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 95af113..284d249 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 _0x8b7d=['request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmCompany,\x20%s,\x20%s'];(function(_0x51d451,_0x129097){var _0x243d91=function(_0x2463e3){while(--_0x2463e3){_0x51d451['push'](_0x51d451['shift']());}};_0x243d91(++_0x129097);}(_0x8b7d,0xd3));var _0xd8b7=function(_0x23c262,_0x74765a){_0x23c262=_0x23c262-0x0;var _0x9b913f=_0x8b7d[_0x23c262];return _0x9b913f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8b7('0x0'));var BPromise=require(_0xd8b7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8b7('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8b7('0x3'))('rpc');var config=require(_0xd8b7('0x4'));var jayson=require(_0xd8b7('0x5'));var client=jayson['client'][_0xd8b7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5ac2bc,_0x49e150,_0x556c14){return new BPromise(function(_0x5afa53,_0x233236){return client[_0xd8b7('0x7')](_0x5ac2bc,_0x556c14)['then'](function(_0x14e235){logger[_0xd8b7('0x8')](_0xd8b7('0x9'),_0x49e150,_0xd8b7('0xa'));logger[_0xd8b7('0xb')](_0xd8b7('0xc'),_0x49e150,_0xd8b7('0xa'),JSON[_0xd8b7('0xd')](_0x14e235));if(_0x14e235[_0xd8b7('0xe')]){if(_0x14e235[_0xd8b7('0xe')][_0xd8b7('0xf')]===0x1f4){logger[_0xd8b7('0xe')](_0xd8b7('0x9'),_0x49e150,_0x14e235[_0xd8b7('0xe')]['message']);return _0x233236(_0x14e235[_0xd8b7('0xe')]['message']);}logger['error']('CmCompany,\x20%s,\x20%s',_0x49e150,_0x14e235['error'][_0xd8b7('0x10')]);return _0x5afa53(_0x14e235['error'][_0xd8b7('0x10')]);}else{logger[_0xd8b7('0x8')]('CmCompany,\x20%s,\x20%s',_0x49e150,'request\x20sent');_0x5afa53(_0x14e235['result'][_0xd8b7('0x10')]);}})['catch'](function(_0x16c513){logger[_0xd8b7('0xe')](_0xd8b7('0x9'),_0x49e150,_0x16c513);_0x233236(_0x16c513);});});} \ No newline at end of file +var _0xe677=['jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x59f3c8,_0x269e43){var _0x320c2f=function(_0x2c22a5){while(--_0x2c22a5){_0x59f3c8['push'](_0x59f3c8['shift']());}};_0x320c2f(++_0x269e43);}(_0xe677,0xc1));var _0x7e67=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0xe677[_0x1e4a8e];return _0x5408f9;};'use strict';var _=require(_0x7e67('0x0'));var util=require(_0x7e67('0x1'));var moment=require('moment');var BPromise=require(_0x7e67('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e67('0x3'))['db'];var utils=require(_0x7e67('0x4'));var logger=require('../../config/logger')(_0x7e67('0x5'));var config=require(_0x7e67('0x6'));var jayson=require(_0x7e67('0x7'));var client=jayson[_0x7e67('0x8')][_0x7e67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d4116,_0x5efe32,_0x52121e){return new BPromise(function(_0x34fc31,_0xaec077){return client['request'](_0x4d4116,_0x52121e)[_0x7e67('0xa')](function(_0x276730){logger[_0x7e67('0xb')](_0x7e67('0xc'),_0x5efe32,_0x7e67('0xd'));logger[_0x7e67('0xe')](_0x7e67('0xf'),_0x5efe32,_0x7e67('0xd'),JSON[_0x7e67('0x10')](_0x276730));if(_0x276730['error']){if(_0x276730[_0x7e67('0x11')]['code']===0x1f4){logger[_0x7e67('0x11')](_0x7e67('0xc'),_0x5efe32,_0x276730[_0x7e67('0x11')][_0x7e67('0x12')]);return _0xaec077(_0x276730['error'][_0x7e67('0x12')]);}logger[_0x7e67('0x11')]('CmCompany,\x20%s,\x20%s',_0x5efe32,_0x276730[_0x7e67('0x11')]['message']);return _0x34fc31(_0x276730[_0x7e67('0x11')]['message']);}else{logger[_0x7e67('0xb')](_0x7e67('0xc'),_0x5efe32,_0x7e67('0xd'));_0x34fc31(_0x276730['result'][_0x7e67('0x12')]);}})[_0x7e67('0x13')](function(_0x2f47d5){logger[_0x7e67('0x11')](_0x7e67('0xc'),_0x5efe32,_0x2f47d5);_0xaec077(_0x2f47d5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9f52237..67cb91a 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 _0xe75c=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','get','/describe','getContacts','create','post','addContacts','put','/:id','delete'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe75c,0x172));var _0xce75=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe75c[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xce75('0x0'));var util=require(_0xce75('0x1'));var path=require(_0xce75('0x2'));var timeout=require(_0xce75('0x3'));var express=require(_0xce75('0x4'));var router=express[_0xce75('0x5')]();var fs_extra=require(_0xce75('0x6'));var auth=require(_0xce75('0x7'));var interaction=require(_0xce75('0x8'));var config=require(_0xce75('0x9'));var controller=require(_0xce75('0xa'));router['get']('/',auth[_0xce75('0xb')](),controller['index']);router[_0xce75('0xc')](_0xce75('0xd'),auth[_0xce75('0xb')](),controller['describe']);router[_0xce75('0xc')]('/:id',auth[_0xce75('0xb')](),controller['show']);router[_0xce75('0xc')]('/:id/contacts',auth[_0xce75('0xb')](),controller[_0xce75('0xe')]);router['post']('/',auth[_0xce75('0xb')](),controller[_0xce75('0xf')]);router[_0xce75('0x10')]('/:id/contacts',auth[_0xce75('0xb')](),controller[_0xce75('0x11')]);router[_0xce75('0x12')](_0xce75('0x13'),auth[_0xce75('0xb')](),controller['update']);router[_0xce75('0x14')]('/:id',auth[_0xce75('0xb')](),controller[_0xce75('0x15')]);module[_0xce75('0x16')]=router; \ No newline at end of file +var _0x637f=['show','/:id/contacts','getContacts','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/:id'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x637f,0x10d));var _0xf637=function(_0x5a9397,_0x2e444c){_0x5a9397=_0x5a9397-0x0;var _0x5b89be=_0x637f[_0x5a9397];return _0x5b89be;};'use strict';var multer=require(_0xf637('0x0'));var util=require(_0xf637('0x1'));var path=require('path');var timeout=require(_0xf637('0x2'));var express=require('express');var router=express[_0xf637('0x3')]();var fs_extra=require(_0xf637('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf637('0x5'));var config=require(_0xf637('0x6'));var controller=require(_0xf637('0x7'));router[_0xf637('0x8')]('/',auth[_0xf637('0x9')](),controller['index']);router[_0xf637('0x8')]('/describe',auth[_0xf637('0x9')](),controller['describe']);router[_0xf637('0x8')](_0xf637('0xa'),auth[_0xf637('0x9')](),controller[_0xf637('0xb')]);router[_0xf637('0x8')](_0xf637('0xc'),auth[_0xf637('0x9')](),controller[_0xf637('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf637('0xe')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0xf637('0xf')](_0xf637('0xa'),auth['isAuthenticated'](),controller[_0xf637('0x10')]);router[_0xf637('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf637('0x12')]);module[_0xf637('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6adbfbc..cde4539 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 _0xfdcd=['exports','STRING','TEXT','INTEGER','UNSIGNED','sequelize'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var Sequelize=require(_0xdfdc('0x0'));module[_0xdfdc('0x1')]={'firstName':{'type':Sequelize[_0xdfdc('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xdfdc('0x2')]},'postalCode':{'type':Sequelize[_0xdfdc('0x2')]},'city':{'type':Sequelize[_0xdfdc('0x2')]},'country':{'type':Sequelize[_0xdfdc('0x2')]},'dateOfBirth':{'type':Sequelize[_0xdfdc('0x2')]},'description':{'type':Sequelize[_0xdfdc('0x3')]},'phone':{'type':Sequelize[_0xdfdc('0x2')]},'mobile':{'type':Sequelize[_0xdfdc('0x2')]},'fax':{'type':Sequelize[_0xdfdc('0x2')]},'email':{'type':Sequelize[_0xdfdc('0x2')]},'url':{'type':Sequelize[_0xdfdc('0x2')]},'facebook':{'type':Sequelize[_0xdfdc('0x2')]},'fb_data':{'type':Sequelize[_0xdfdc('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xdfdc('0x2')]},'teams':{'type':Sequelize[_0xdfdc('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xdfdc('0x2')]},'wechat':{'type':Sequelize[_0xdfdc('0x2')]},'telegram':{'type':Sequelize[_0xdfdc('0x2')]},'UserId':{'type':Sequelize[_0xdfdc('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xdfdc('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xdfdc('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x66f4=['STRING','INTEGER','UNSIGNED','DATE','NOW','sequelize','exports'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x66f4,0xb4));var _0x466f=function(_0x171981,_0x3e8305){_0x171981=_0x171981-0x0;var _0x5d5e56=_0x66f4[_0x171981];return _0x5d5e56;};'use strict';var _=require('lodash');var Sequelize=require(_0x466f('0x0'));module[_0x466f('0x1')]={'firstName':{'type':Sequelize[_0x466f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x466f('0x2')]},'street':{'type':Sequelize[_0x466f('0x2')]},'postalCode':{'type':Sequelize[_0x466f('0x2')]},'city':{'type':Sequelize[_0x466f('0x2')]},'country':{'type':Sequelize[_0x466f('0x2')]},'dateOfBirth':{'type':Sequelize[_0x466f('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x466f('0x2')]},'mobile':{'type':Sequelize[_0x466f('0x2')]},'fax':{'type':Sequelize[_0x466f('0x2')]},'email':{'type':Sequelize[_0x466f('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x466f('0x2')]},'fb_data':{'type':Sequelize[_0x466f('0x2')]},'twitter':{'type':Sequelize[_0x466f('0x2')]},'skype':{'type':Sequelize[_0x466f('0x2')]},'teams':{'type':Sequelize[_0x466f('0x2')]},'viber':{'type':Sequelize[_0x466f('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x466f('0x2')]},'telegram':{'type':Sequelize[_0x466f('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x466f('0x2')]},'priority':{'type':Sequelize[_0x466f('0x3')](0x2)[_0x466f('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x466f('0x5')],'defaultValue':Sequelize[_0x466f('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 484b01c..b66d61e 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 _0xb010=['params','Phones','ContactItemType','literal','`Phones.ItemType`.OrderBy','log','$and','omit','format','cf_%d','table','setFields','id\x20=\x20?','phone','getTags','Tag','rawAttributes','fields','options','setTags','setAdditionalPhones','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','OrderBy','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','PHONE','fromContactId','CmContactId','toContactId','getHoppers','include','includeAll','CmHopperFinal','getJscriptySessions','ContactId','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','parse','meta','import','binding','child_process','../../components/import/cm/csv2','stringify','message','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','exit','getJourney','chat','whatsapp','voice','-createdAt','includes','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','DESC','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','substatus','openchannel','externalUrl','threadId','Interaction','flatten','sortBy','reverse','slice','rimraf','fast-json-patch','moment','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','destroy','then','name','index','CmContact','describe','length','keys','cf_','CmCustomField','findOne','trimStart','all','type','query','filters','attributes','intersection','model','nolimit','order','sort','pick','field','color','from','tools_tags','select','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','conditions','find','value','split','map','union','uc.UserId\x20=\x20?','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','text','hasOwnProperty','filter','isNil','push','Contact','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','QueryTypes','clone','isEmpty','having','resolve','user','role','agent','some','User','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','merge','c.firstName','c.lastName','c.mobile','c.fax','c.email','c.CompanyId','TagIds','Tags','rows','catch','tags','startsWith','columnName','displayName','findAll','custom','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','create','ChatInteraction','update','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmContactHasItem','CmHopperHistory','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','additionalPhones','bulkCreate','each','duplicates','findOrCreate','spread','error','contact','show'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xb010,0x8b));var _0x0b01=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xb010[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b01('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b01('0x1'));var rp=require('request-promise');var moment=require(_0x0b01('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0b01('0x3'));var util=require(_0x0b01('0x4'));var path=require(_0x0b01('0x5'));var sox=require(_0x0b01('0x6'));var csv=require(_0x0b01('0x7'));var ejs=require(_0x0b01('0x8'));var fs=require('fs');var fs_extra=require(_0x0b01('0x9'));var _=require(_0x0b01('0xa'));var squel=require(_0x0b01('0xb'));var crypto=require(_0x0b01('0xc'));var jsforce=require(_0x0b01('0xd'));var deskjs=require(_0x0b01('0xe'));var toCsv=require(_0x0b01('0x7'));var querystring=require('querystring');var Papa=require(_0x0b01('0xf'));var Redis=require(_0x0b01('0x10'));var authService=require(_0x0b01('0x11'));var qs=require(_0x0b01('0x12'));var as=require(_0x0b01('0x13'));var hardwareService=require(_0x0b01('0x14'));var logger=require(_0x0b01('0x15'))(_0x0b01('0x16'));var utils=require(_0x0b01('0x17'));var config=require(_0x0b01('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b01('0x19'))['db'];config[_0x0b01('0x1a')]=_[_0x0b01('0x1b')](config[_0x0b01('0x1a')],{'host':_0x0b01('0x1c'),'port':0x18eb});var socket=require(_0x0b01('0x1d'))(new Redis(config[_0x0b01('0x1a')]));require('./cmContact.socket')[_0x0b01('0x1e')](socket);function respondWithStatusCode(_0x3fc8cb,_0x18ae27){_0x18ae27=_0x18ae27||0xcc;return function(_0x2ca014){if(_0x2ca014){return _0x3fc8cb[_0x0b01('0x1f')](_0x18ae27);}return _0x3fc8cb[_0x0b01('0x20')](_0x18ae27)[_0x0b01('0x21')]();};}function respondWithResult(_0x2348ef,_0x9a813d){_0x9a813d=_0x9a813d||0xc8;return function(_0x15bfdf){if(_0x15bfdf){return _0x2348ef[_0x0b01('0x20')](_0x9a813d)[_0x0b01('0x22')](_0x15bfdf);}};}function respondWithFilteredResult(_0x55aceb,_0x2f399c){return function(_0x21139b){if(_0x21139b){var _0x2b94fa=typeof _0x2f399c['offset']==='undefined'&&typeof _0x2f399c['limit']===_0x0b01('0x23');var _0x217eac=_0x21139b[_0x0b01('0x24')];var _0x1d9227=_0x2b94fa?0x0:_0x2f399c[_0x0b01('0x25')];var _0x2e47b0=_0x2b94fa?_0x21139b['count']:_0x2f399c[_0x0b01('0x25')]+_0x2f399c[_0x0b01('0x26')];var _0xc91328;if(_0x2e47b0>=_0x217eac){_0x2e47b0=_0x217eac;_0xc91328=0xc8;}else{_0xc91328=0xce;}_0x55aceb[_0x0b01('0x20')](_0xc91328);return _0x55aceb[_0x0b01('0x27')]('Content-Range',_0x1d9227+'-'+_0x2e47b0+'/'+_0x217eac)['json'](_0x21139b);}return null;};}function patchUpdates(_0x3e966c){return function(_0x108e5b){try{jsonpatch[_0x0b01('0x28')](_0x108e5b,_0x3e966c,!![]);}catch(_0x220615){return BPromise['reject'](_0x220615);}return _0x108e5b['save']();};}function saveUpdates(_0x47f13a,_0x21eddd){return function(_0x5540b4){if(_0x5540b4){return _0x5540b4['update'](_0x47f13a)['then'](function(_0x2a165f){return _0x2a165f;});}return null;};}function removeEntity(_0x80c47,_0xed5e34){return function(_0xf9fbfc){if(_0xf9fbfc){return _0xf9fbfc[_0x0b01('0x29')]()[_0x0b01('0x2a')](function(){_0x80c47[_0x0b01('0x20')](0xcc)[_0x0b01('0x21')]();});}};}function handleEntityNotFound(_0x5cff03,_0xe33073){return function(_0x3d42e6){if(!_0x3d42e6){_0x5cff03[_0x0b01('0x1f')](0x194);}return _0x3d42e6;};}function handleError(_0x513f07,_0x53b17a){_0x53b17a=_0x53b17a||0x1f4;return function(_0x29799c){logger['error'](_0x29799c['stack']);if(_0x29799c[_0x0b01('0x2b')]){delete _0x29799c[_0x0b01('0x2b')];}_0x513f07[_0x0b01('0x20')](_0x53b17a)['send'](_0x29799c);};}exports[_0x0b01('0x2c')]=function(_0x3ef977,_0x177bc1){var _0x1b9ecf={},_0x65488={},_0x2f5551={'count':0x0,'rows':[]};return db[_0x0b01('0x2d')][_0x0b01('0x2e')]()['then'](function(_0x3bb0b0){var _0x471897=[];for(var _0x10eb80=0x0;_0x10eb800x1){_0x49aab4['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0b01('0x6b')](_0x2b707c),null);}else{if(qs[_0x0b01('0x6c')](_0x2b707c)){_0x49aab4['or']('c.id\x20LIKE\x20?',_0x2b707c+'%');_0x49aab4['or'](_0x0b01('0x6d'),_0x2b707c+'%');_0x49aab4['or'](_0x0b01('0x6e'),_0x2b707c+'%');_0x49aab4['or'](_0x0b01('0x6f'),_0x2b707c+'%');}else if(qs[_0x0b01('0x70')](_0x2b707c)){_0x49aab4['or']('c.email\x20LIKE\x20?',_0x2b707c+'%');}else{_0x49aab4['or']('c.firstName\x20LIKE\x20?','%'+_0x2b707c+'%');_0x49aab4['or'](_0x0b01('0x71'),'%'+_0x2b707c+'%');_0x49aab4['or'](_0x0b01('0x72'),'%'+_0x2b707c+'%');}}}}_0x1773e3[_0x0b01('0x4b')](_0x49aab4);_0x1773e3[_0x0b01('0x73')](_0x0b01('0x74'));var _0x1ae7d2={'type':db['Sequelize'][_0x0b01('0x75')]['SELECT'],'raw':!![]};var _0x4732aa=_0x1773e3[_0x0b01('0x76')]()[_0x0b01('0x40')](_0x0b01('0x74'));if(_0x1b9ecf[_0x0b01('0x3d')]){_0x1b9ecf[_0x0b01('0x3d')]['forEach'](function(_0x128661){_0x1773e3[_0x0b01('0x3d')]('c.'+_0x128661[0x0],_0x128661[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0b01('0x77')](_0x42e9d8)){_0x1773e3[_0x0b01('0x78')](_0x38f213);_0x4732aa[_0x0b01('0x4b')]('t.id\x20IN\x20?',_0x42e9d8);}BPromise[_0x0b01('0x79')]()[_0x0b01('0x2a')](function(){if(!_0x22a7b3)return;if(_0x3ef977[_0x0b01('0x7a')][_0x0b01('0x7b')]!==_0x0b01('0x7c'))return;if(!_[_0x0b01('0x7d')](_0x22a7b3[_0x0b01('0x4f')],[_0x0b01('0x40'),_0x0b01('0x7e')])){return _0x3ef977['user'][_0x0b01('0x7f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2e835f){if(_[_0x0b01('0x77')](_0x2e835f)){_0x4732aa['where'](_0x0b01('0x80'));_0x1773e3[_0x0b01('0x4b')]('c.ListId\x20IS\x20NULL');}else{_0x4732aa[_0x0b01('0x4b')](_0x0b01('0x64'),_[_0x0b01('0x53')](_0x2e835f,'id'));_0x1773e3['where'](_0x0b01('0x64'),_[_0x0b01('0x53')](_0x2e835f,'id'));}});}})['then'](function(){if(_0x3ef977['user'][_0x0b01('0x7b')]===_0x0b01('0x7c')&&!_0x22a7b3&&!_0x3ef977[_0x0b01('0x37')][_0x0b01('0x63')])return[];return db['sequelize'][_0x0b01('0x37')](_0x4732aa['toString'](),_0x1ae7d2);})[_0x0b01('0x2a')](function(_0x1eb05b){_0x2f5551[_0x0b01('0x24')]=_0x1eb05b[_0x0b01('0x2f')];if(_0x2f5551[_0x0b01('0x24')]===0x0)return[];return db[_0x0b01('0x81')][_0x0b01('0x37')](_0x49081f[_0x0b01('0x82')](),_0x1ae7d2)[_0x0b01('0x2a')](function(_0xaf2f6e){_0x19e706=_['keyBy'](_0xaf2f6e,'id');_0x1ae7d2=_[_0x0b01('0x83')](_0x1ae7d2,{'model':db[_0x0b01('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ef977[_0x0b01('0x37')]['fields']){_0x1b9ecf['attributes']['forEach'](function(_0x4e8340){_0x1773e3[_0x0b01('0x40')]('c.'+_0x4e8340);});}else{_0x1773e3[_0x0b01('0x40')]('c.id');_0x1773e3['field'](_0x0b01('0x84'));_0x1773e3['field'](_0x0b01('0x85'));_0x1773e3[_0x0b01('0x40')]('c.phone');_0x1773e3[_0x0b01('0x40')](_0x0b01('0x86'));_0x1773e3[_0x0b01('0x40')](_0x0b01('0x87'));_0x1773e3[_0x0b01('0x40')](_0x0b01('0x88'));_0x1773e3['field']('c.ListId');_0x1773e3[_0x0b01('0x40')]('c.createdAt');_0x1773e3[_0x0b01('0x40')]('c.deletedAt');_0x1773e3[_0x0b01('0x40')](_0x0b01('0x89'));_0x1773e3[_0x0b01('0x40')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0b01('0x8a'));}if(_0x1b9ecf[_0x0b01('0x26')])_0x1773e3[_0x0b01('0x26')](_0x1b9ecf[_0x0b01('0x26')]);if(_0x1b9ecf[_0x0b01('0x25')])_0x1773e3['offset'](_0x1b9ecf[_0x0b01('0x25')]);return db[_0x0b01('0x81')][_0x0b01('0x37')](_0x1773e3['toString'](),_0x1ae7d2);});})['then'](function(_0x5c7f7c){_0x5c7f7c[_0x0b01('0x62')](function(_0x1c2535){if(_0x1c2535[_0x0b01('0x8a')]){_0x1c2535[_0x0b01('0x8b')]=[];_0x1c2535['TagIds']['split'](',')[_0x0b01('0x62')](function(_0x572543){_0x1c2535['Tags'][_0x0b01('0x60')](_0x19e706[_0x572543]);});}delete _0x1c2535[_0x0b01('0x8a')];});_0x2f5551[_0x0b01('0x8c')]=_0x5c7f7c;return _0x2f5551;})[_0x0b01('0x2a')](respondWithFilteredResult(_0x177bc1,_0x1b9ecf));})[_0x0b01('0x8d')](handleError(_0x177bc1,null));};exports[_0x0b01('0x29')]=function(_0x45b575,_0x500ed4){return db[_0x0b01('0x2d')][_0x0b01('0x50')]({'where':{'id':_0x45b575['params']['id']}})['then'](handleEntityNotFound(_0x500ed4,null))[_0x0b01('0x2a')](removeEntity(_0x500ed4,null))['catch'](handleError(_0x500ed4,null));};exports[_0x0b01('0x2e')]=function(_0xe3324d,_0x1606b6){return db[_0x0b01('0x2d')][_0x0b01('0x2e')]()[_0x0b01('0x2a')](function(_0x592a71){delete _0x592a71[_0x0b01('0x8e')];for(var _0x3949e4=0x0;_0x3949e40x0){return new Promise(function(_0x4a64b,_0x3a3c06){var _0x14bc17=[];for(var _0x238473=0x0;_0x238473<_0x4409ed[_0x0b01('0x2f')];_0x238473++){_0x14bc17[_0x0b01('0x60')](insertAdditionalPhones(_0x4409ed[_0x238473][_0x0b01('0xb8')],_0x4409ed[_0x238473][_0x0b01('0xb1')]));}Promise[_0x0b01('0x35')](_0x14bc17)[_0x0b01('0x2a')](function(){_0x4a64b(0x1);});})[_0x0b01('0x2a')](function(){return{'success':_0x172b02,'failure':_0x1aa589,'duplicates':_0x17c9fd};});}else{return{'success':_0x172b02,'failure':_0x1aa589,'duplicates':_0x17c9fd};}}})[_0x0b01('0x2a')](respondWithResult(_0x567684,0xc9))[_0x0b01('0x8d')](handleError(_0x567684,null));};exports[_0x0b01('0xb9')]=function(_0x6836d8,_0x3c9e25,_0x3aaa62){var _0x3a4a49;return db['CmContact'][_0x0b01('0x2e')]()[_0x0b01('0x2a')](function(_0x57d4c3){return db[_0x0b01('0x2d')][_0x0b01('0x50')]({'where':{'id':_0x6836d8[_0x0b01('0xba')]['id']},'include':[{'model':db['Tag'],'as':_0x0b01('0x8b'),'attributes':['id','name',_0x0b01('0x41')],'required':_0x6836d8[_0x0b01('0x37')]['tag']?!![]:![]},{'model':db[_0x0b01('0xa6')],'as':_0x0b01('0xbb'),'where':{'CmContactId':_0x6836d8['params']['id']},'required':![],'include':[{'model':db[_0x0b01('0xbc')],'as':'ItemType'}]}],'order':[db[_0x0b01('0x81')][_0x0b01('0xbd')](_0x0b01('0xbe'))],'logging':console[_0x0b01('0xbf')],'attributes':_[_0x0b01('0x30')](_0x57d4c3)});})[_0x0b01('0x2a')](function(_0x131adc){_0x3a4a49=_0x131adc['get']({'plain':!![]});var _0x1c92f2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x131adc&&_0x131adc[_0x0b01('0x63')]){if(_0x131adc[_0x0b01('0x63')]){_0x1c92f2['where'][_0x0b01('0xc0')][_0x0b01('0x60')]({'ListId':{'$ne':_0x131adc['ListId']}});}}return db[_0x0b01('0x32')][_0x0b01('0x92')](_0x1c92f2);})[_0x0b01('0x2a')](function(_0x448831){return _[_0x0b01('0xc1')](_0x3a4a49,_[_0x0b01('0x53')](_0x448831,function(_0x326b75){return util[_0x0b01('0xc2')](_0x0b01('0xc3'),_0x326b75['id']);}));})[_0x0b01('0x2a')](handleEntityNotFound(_0x3c9e25,null))[_0x0b01('0x2a')](respondWithResult(_0x3c9e25,null))['catch'](handleError(_0x3c9e25,null));};exports['update']=function(_0x51cbd4,_0x14450e){var _0x41614a;if(_0x51cbd4[_0x0b01('0x95')]['id']){delete _0x51cbd4[_0x0b01('0x95')]['id'];}return db[_0x0b01('0x2d')][_0x0b01('0x50')]({'where':{'id':_0x51cbd4[_0x0b01('0xba')]['id']}})[_0x0b01('0x2a')](handleEntityNotFound(_0x14450e,null))[_0x0b01('0x2a')](saveUpdates(_0x51cbd4[_0x0b01('0x95')],null))[_0x0b01('0x2a')](function(_0x103322){_0x41614a=_0x103322;var _0x493f01={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x103322&&_0x103322['ListId']){if(_0x103322['ListId']){_0x493f01[_0x0b01('0x4b')][_0x0b01('0xc0')][_0x0b01('0x60')]({'ListId':{'$ne':_0x103322[_0x0b01('0x63')]}});}}return db[_0x0b01('0x32')]['findAll'](_0x493f01);})[_0x0b01('0x2a')](function(_0x171559){if(_0x171559){return _[_0x0b01('0xc1')](_['pickBy'](_0x51cbd4[_0x0b01('0x95')],function(_0x1c4a2c,_0x1d5c90){return _[_0x0b01('0x8f')](_0x1d5c90,'cf_');}),_['map'](_0x171559,function(_0x26b686){return util[_0x0b01('0xc2')](_0x0b01('0xc3'),_0x26b686['id']);}));}})[_0x0b01('0x2a')](function(_0x2d089b){if(_0x2d089b&&!_['isEmpty'](_0x2d089b)){var _0x4f1340=squel[_0x0b01('0x9f')]()[_0x0b01('0xc4')](_0x0b01('0x45'))[_0x0b01('0xc5')](_0x2d089b)[_0x0b01('0x4b')](_0x0b01('0xc6'),_0x51cbd4[_0x0b01('0xba')]['id'])['toParam']();return db[_0x0b01('0x81')][_0x0b01('0x37')](_0x4f1340[_0x0b01('0x5c')],{'replacements':_0x4f1340[_0x0b01('0x94')]});}})[_0x0b01('0x2a')](function(){if(_0x51cbd4[_0x0b01('0x95')][_0x0b01('0xc7')]&&_0x41614a){return db[_0x0b01('0x9b')][_0x0b01('0x9f')]({'phone':_0x51cbd4[_0x0b01('0x95')][_0x0b01('0xc7')]},{'where':{'ContactId':_0x41614a['id']}});}})[_0x0b01('0x2a')](function(){return _0x41614a;})['then'](respondWithResult(_0x14450e,null))[_0x0b01('0x8d')](handleError(_0x14450e,null));};exports[_0x0b01('0xc8')]=function(_0x34e694,_0x4fc241,_0x513443){var _0x306dd0={};var _0x209146={};var _0x23a95a;var _0x5607b2;return db[_0x0b01('0x2d')]['findOne']({'where':{'id':_0x34e694[_0x0b01('0xba')]['id']}})[_0x0b01('0x2a')](handleEntityNotFound(_0x4fc241,null))[_0x0b01('0x2a')](function(_0x1f873b){if(_0x1f873b){_0x23a95a=_0x1f873b;_0x209146['model']=_[_0x0b01('0x30')](db[_0x0b01('0xc9')][_0x0b01('0xca')]);_0x209146[_0x0b01('0x37')]=_[_0x0b01('0x30')](_0x34e694[_0x0b01('0x37')]);_0x209146[_0x0b01('0x38')]=_[_0x0b01('0x3a')](_0x209146[_0x0b01('0x3b')],_0x209146['query']);_0x306dd0[_0x0b01('0x39')]=_['intersection'](_0x209146[_0x0b01('0x3b')],qs[_0x0b01('0xcb')](_0x34e694[_0x0b01('0x37')][_0x0b01('0xcb')]));_0x306dd0[_0x0b01('0x39')]=_0x306dd0[_0x0b01('0x39')][_0x0b01('0x2f')]?_0x306dd0['attributes']:_0x209146[_0x0b01('0x3b')];_0x306dd0[_0x0b01('0x3d')]=qs[_0x0b01('0x3e')](_0x34e694[_0x0b01('0x37')][_0x0b01('0x3e')]);_0x306dd0[_0x0b01('0x4b')]=qs['filters'](_[_0x0b01('0x3f')](_0x34e694['query'],_0x209146[_0x0b01('0x38')]));if(_0x34e694['query'][_0x0b01('0x5e')]){_0x306dd0[_0x0b01('0x4b')]=_[_0x0b01('0x83')](_0x306dd0[_0x0b01('0x4b')],{'$or':_['map'](_0x306dd0[_0x0b01('0x39')],function(_0x255c39){var _0x382f17={};_0x382f17[_0x255c39]={'$like':'%'+_0x34e694[_0x0b01('0x37')]['filter']+'%'};return _0x382f17;})});}_0x306dd0=_[_0x0b01('0x83')]({},_0x306dd0,_0x34e694[_0x0b01('0xcc')]);return _0x23a95a[_0x0b01('0xc8')](_0x306dd0);}})[_0x0b01('0x2a')](function(_0x90e55e){if(_0x90e55e){_0x5607b2=_0x90e55e[_0x0b01('0x2f')];if(!_0x34e694[_0x0b01('0x37')]['hasOwnProperty'](_0x0b01('0x3c'))){_0x306dd0[_0x0b01('0x26')]=qs[_0x0b01('0x26')](_0x34e694[_0x0b01('0x37')][_0x0b01('0x26')]);_0x306dd0[_0x0b01('0x25')]=qs[_0x0b01('0x25')](_0x34e694[_0x0b01('0x37')][_0x0b01('0x25')]);}return _0x23a95a[_0x0b01('0xc8')](_0x306dd0);}})[_0x0b01('0x2a')](function(_0x56fd81){if(_0x56fd81){return _0x56fd81?{'count':_0x5607b2,'rows':_0x56fd81}:null;}})[_0x0b01('0x2a')](respondWithResult(_0x4fc241,null))[_0x0b01('0x8d')](handleError(_0x4fc241,null));};exports['setTags']=function(_0x57dc94,_0x5e1d22,_0x19d813){if(_0x57dc94['body']['id']){delete _0x57dc94[_0x0b01('0x95')]['id'];}return db[_0x0b01('0x2d')][_0x0b01('0x33')]({'where':{'id':_0x57dc94[_0x0b01('0xba')]['id']}})[_0x0b01('0x2a')](handleEntityNotFound(_0x5e1d22,null))[_0x0b01('0x2a')](function(_0x2a135b){if(_0x2a135b){return _0x2a135b[_0x0b01('0xcd')](_0x57dc94[_0x0b01('0x95')]['ids']||[]);}return null;})[_0x0b01('0x2a')](respondWithResult(_0x5e1d22,null))[_0x0b01('0x8d')](handleError(_0x5e1d22,null));};exports[_0x0b01('0xce')]=function(_0xda1572,_0x3da776){var _0x4d6ff1=[];_0x4d6ff1[_0x0b01('0x60')](addAdditionalPhones(_0xda1572['body']));Promise[_0x0b01('0x35')](_0x4d6ff1)[_0x0b01('0x2a')](function(){_0x4d6ff1=[];_0x4d6ff1[_0x0b01('0x60')](deleteCmHopperPhones(_0xda1572[_0x0b01('0x95')]['id']));_0x4d6ff1[_0x0b01('0x60')](addCmHopperPhones(_0xda1572[_0x0b01('0x95')]['id']));Promise[_0x0b01('0x35')](_0x4d6ff1)[_0x0b01('0x2a')](function(){return[0x1];})[_0x0b01('0x2a')](respondWithResult(_0x3da776,null));});};function addAdditionalPhones(_0x556976){return new Promise(function(_0x28ed50,_0x2410c6){return db[_0x0b01('0xa6')][_0x0b01('0x29')]({'where':{'CmContactId':_0x556976['id']}})['then'](function(){var _0x4a2b5f=[];for(var _0x5e4335=0x0;_0x5e4335<_0x556976[_0x0b01('0xcf')][_0x0b01('0x2f')];_0x5e4335++){_0x4a2b5f[_0x0b01('0x60')](addAdditionalPhone(_0x556976['id'],_0x556976[_0x0b01('0xcf')][_0x5e4335][_0x0b01('0xc7')],_0x556976[_0x0b01('0xd0')]?_[_0x0b01('0x5f')](_0x556976['item_types'][_0x5e4335])?null:_0x556976[_0x0b01('0xd0')][_0x5e4335]:_0x556976['items'][_0x5e4335][_0x0b01('0xd1')]?_0x556976[_0x0b01('0xcf')][_0x5e4335][_0x0b01('0xd1')]:null,_0x5e4335,_0x556976[_0x0b01('0xcf')][_0x5e4335][_0x0b01('0xd2')]));}Promise[_0x0b01('0x35')](_0x4a2b5f)[_0x0b01('0x2a')](function(){_0x28ed50(0x1);});});});}function addAdditionalPhone(_0x472b49,_0x2617ea,_0x37f2d9,_0x12f683,_0x4172f7){return db[_0x0b01('0xa6')]['find']({'where':{'CmContactId':_0x472b49,'item':_0x2617ea}})[_0x0b01('0x2a')](function(_0x3fa6e9){if(_0x3fa6e9)logger[_0x0b01('0x99')](_0x0b01('0xd3'),_0x3fa6e9);else{db[_0x0b01('0xa6')][_0x0b01('0x9d')]({'CmContactId':_0x472b49,'item':_0x2617ea,'ItemTypeId':_0x37f2d9,'OrderBy':_0x12f683,'ItemClass':'PHONE','description':_0x4172f7});}});}function deletePhones(_0x4bb7f6){return db[_0x0b01('0xa6')]['destroy']({'where':{'CmContactId':_0x4bb7f6}});}function deleteCmHopperPhones(_0x4c5824){return new Promise(function(_0x41ef97,_0x189c92){return db[_0x0b01('0x9b')][_0x0b01('0x92')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4c5824}})[_0x0b01('0x2a')](function(_0x44e216){db[_0x0b01('0xd4')][_0x0b01('0x29')]({'where':{'CmHopperId':{'$in':_[_0x0b01('0x53')](_0x44e216,'id')}}});})[_0x0b01('0x2a')](function(){_0x41ef97(0x1);});});}function addCmHopperPhones(_0x2907bd){return new Promise(function(_0x49b32d,_0xcf6d02){return db[_0x0b01('0x9b')][_0x0b01('0x92')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2907bd}})[_0x0b01('0x2a')](function(_0x275648){var _0x243372=[];_[_0x0b01('0x53')](_0x275648,function(_0x46fb53){_0x243372[_0x0b01('0x60')](createCmHopperPhone(_0x2907bd,_0x46fb53['id']));});Promise[_0x0b01('0x35')](_0x243372)[_0x0b01('0x2a')](function(){_0x49b32d(0x1);});});});}function createCmHopperPhone(_0x4d9ab9,_0xb37def){return new Promise(function(_0x5ccb72,_0x3ad99f){db[_0x0b01('0xa6')][_0x0b01('0x92')]({'raw':!![],'attributes':[_0x0b01('0xd5')],'where':{'CmContactId':_0x4d9ab9,'ItemClass':'PHONE'},'include':[{'model':db[_0x0b01('0xbc')],'attributes':[_0x0b01('0xd6')],'as':_0x0b01('0xd7')}],'order':[db[_0x0b01('0x81')]['literal'](_0x0b01('0xd8'))]})[_0x0b01('0x2a')](function(_0x346995){var _0x537101=0x1;var _0x44f979=_[_0x0b01('0x53')](_0x346995,function(_0x1a3e08){_0x1a3e08[_0x0b01('0xd9')]=_0xb37def;_0x1a3e08[_0x0b01('0xc7')]=_0x1a3e08[_0x0b01('0xd5')];_0x1a3e08[_0x0b01('0xd6')]=_0x1a3e08['ItemType.OrderBy']||_0x537101;delete _0x1a3e08[_0x0b01('0xda')];_0x537101=_0x537101+0x1;return _0x1a3e08;});return db['CmHopperAdditionalPhone'][_0x0b01('0xb2')](_0x44f979,{});})[_0x0b01('0x2a')](function(){_0x5ccb72(0x1);});});}function insertAdditionalPhones(_0x3e3a46,_0x413cf7){return new Promise(function(_0x19a428,_0x3a01f3){var _0x3740dd=[];for(var _0x1dafd3=0x0;_0x1dafd3<_0x413cf7[_0x0b01('0x2f')];_0x1dafd3++){var _0x10622f=_0x413cf7[_0x1dafd3];_0x3740dd[_0x0b01('0x60')](parseContactItemType(_0x10622f));}Promise['all'](_0x3740dd)[_0x0b01('0x2a')](function(){var _0x5cea51={'id':_0x3e3a46['id'],'items':_0x413cf7};return addAdditionalPhones(_0x5cea51)[_0x0b01('0x2a')](function(_0x3334a9){return addCmHopperPhones(_0x3e3a46['id']);});})[_0x0b01('0x2a')](function(){_0x19a428(_0x3e3a46);});});}function parseContactItemType(_0xbe16b1){return new Promise(function(_0x2cc924,_0x552f62){if(_0xbe16b1['hasOwnProperty'](_0x0b01('0xd1'))){_0x2cc924(_0xbe16b1);}else{return db[_0x0b01('0xbc')]['find']({'where':{'name':_0xbe16b1[_0x0b01('0xd7')]}})[_0x0b01('0x2a')](function(_0x20fe16){if(_[_0x0b01('0x5f')](_0x20fe16))_0xbe16b1[_0x0b01('0xd1')]=null;else _0xbe16b1[_0x0b01('0xd1')]=_0x20fe16['id'];_0x2cc924(_0xbe16b1);});}});}exports['getAdditionalPhones']=function(_0x1efd60,_0x3f08d2){return db[_0x0b01('0xa6')][_0x0b01('0x92')]({'raw':!![],'where':{'CmContactId':_0x1efd60[_0x0b01('0xba')]['id'],'ItemClass':_0x0b01('0xdb')},'include':[{'model':db[_0x0b01('0xbc')],'as':'ItemType'}],'order':[[db['sequelize'][_0x0b01('0xbd')](_0x0b01('0xd8'))],[_0x0b01('0xd6')]]})[_0x0b01('0x2a')](function(_0x176fd5){return _0x176fd5;})[_0x0b01('0x2a')](respondWithResult(_0x3f08d2,null))[_0x0b01('0x8d')](handleError(_0x3f08d2,null));};exports['duplicateAdditionalPhones']=function(_0x464eb8,_0x589129){return db[_0x0b01('0xa6')][_0x0b01('0x92')]({'raw':!![],'where':{'CmContactId':_0x464eb8[_0x0b01('0x95')][_0x0b01('0xdc')]}})[_0x0b01('0x2a')](function(_0x1d106f){var _0x23ea38=_['map'](_0x1d106f,function(_0x11147f){_0x11147f[_0x0b01('0xdd')]=_0x464eb8['body'][_0x0b01('0xde')];return _0x11147f;});return db['CmContactHasItem'][_0x0b01('0xb2')](_0x23ea38,{});})[_0x0b01('0x2a')](function(_0x528622){return addCmHopperPhones(_0x464eb8[_0x0b01('0x95')][_0x0b01('0xde')]);})['then'](function(_0x128f82){return['ok'];})[_0x0b01('0x2a')](respondWithResult(_0x589129,null))[_0x0b01('0x8d')](handleError(_0x589129,null));};exports['rescheduleAdditionalPhones']=function(_0x362e7f,_0x10c44a){var _0x14adc3=[];_0x14adc3[_0x0b01('0x60')](createCmHopperPhone(_0x362e7f[_0x0b01('0x95')]['id'],_0x362e7f[_0x0b01('0x95')]['hopperId']));Promise[_0x0b01('0x35')](_0x14adc3)['then'](function(){return[0x1];})['then'](respondWithResult(_0x10c44a,null));};exports[_0x0b01('0xdf')]=function(_0x52412b,_0x34316b,_0x12ff88){var _0x1ac757={'raw':![],'where':{}};var _0x4f4ce2={};var _0x293196={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x52412b[_0x0b01('0xba')]['id']}})[_0x0b01('0x2a')](handleEntityNotFound(_0x34316b,null))[_0x0b01('0x2a')](function(_0x4e9a8d){if(_0x4e9a8d){_0x4f4ce2[_0x0b01('0x3b')]=_[_0x0b01('0x30')](db[_0x0b01('0x9b')][_0x0b01('0xca')]);_0x4f4ce2[_0x0b01('0x37')]=_[_0x0b01('0x30')](_0x52412b[_0x0b01('0x37')]);_0x4f4ce2[_0x0b01('0x38')]=_['intersection'](_0x4f4ce2[_0x0b01('0x3b')],_0x4f4ce2[_0x0b01('0x37')]);_0x1ac757[_0x0b01('0x39')]=_['intersection'](_0x4f4ce2[_0x0b01('0x3b')],qs[_0x0b01('0xcb')](_0x52412b[_0x0b01('0x37')]['fields']));_0x1ac757[_0x0b01('0x39')]=_0x1ac757[_0x0b01('0x39')][_0x0b01('0x2f')]?_0x1ac757[_0x0b01('0x39')]:_0x4f4ce2[_0x0b01('0x3b')];if(!_0x52412b[_0x0b01('0x37')][_0x0b01('0x5d')](_0x0b01('0x3c'))){_0x1ac757[_0x0b01('0x26')]=qs['limit'](_0x52412b['query'][_0x0b01('0x26')]);_0x1ac757[_0x0b01('0x25')]=qs[_0x0b01('0x25')](_0x52412b[_0x0b01('0x37')][_0x0b01('0x25')]);}_0x1ac757[_0x0b01('0x3d')]=qs[_0x0b01('0x3e')](_0x52412b[_0x0b01('0x37')][_0x0b01('0x3e')]);_0x1ac757[_0x0b01('0x4b')]=qs['filters'](_[_0x0b01('0x3f')](_0x52412b['query'],_0x4f4ce2[_0x0b01('0x38')]));_0x1ac757[_0x0b01('0x4b')]['ContactId']=_0x4e9a8d['id'];if(_0x52412b['query'][_0x0b01('0x5e')]){_0x1ac757[_0x0b01('0x4b')]=_[_0x0b01('0x83')](_0x1ac757[_0x0b01('0x4b')],{'$or':_[_0x0b01('0x53')](_0x1ac757[_0x0b01('0x39')],function(_0x2d8f83){var _0x3c5461={};_0x3c5461[_0x2d8f83]={'$like':'%'+_0x52412b[_0x0b01('0x37')][_0x0b01('0x5e')]+'%'};return _0x3c5461;})});}_0x1ac757=_['merge']({},_0x1ac757,_0x52412b[_0x0b01('0xcc')]);return db['CmHopper'][_0x0b01('0x24')]({'where':_0x1ac757[_0x0b01('0x4b')]})[_0x0b01('0x2a')](function(_0x34f031){_0x293196[_0x0b01('0x24')]=_0x34f031;if(_0x52412b['query']['includeAll']){_0x1ac757[_0x0b01('0xe0')]=[{'all':!![]}];}return db[_0x0b01('0x9b')]['findAll'](_0x1ac757);})[_0x0b01('0x2a')](function(_0x29820c){_0x293196[_0x0b01('0x8c')]=_0x29820c;return _0x293196;});}})[_0x0b01('0x2a')](respondWithFilteredResult(_0x34316b,_0x1ac757))[_0x0b01('0x8d')](handleError(_0x34316b,null));};exports['getHopperHistories']=function(_0x104b4c,_0x4d5a64,_0x4a7d63){var _0x571d38={'raw':!![],'where':{}};var _0x5ded40={};var _0x3d8ad9={'count':0x0,'rows':[]};return db[_0x0b01('0x2d')][_0x0b01('0x33')]({'where':{'id':_0x104b4c[_0x0b01('0xba')]['id']}})[_0x0b01('0x2a')](handleEntityNotFound(_0x4d5a64,null))[_0x0b01('0x2a')](function(_0x418e66){if(_0x418e66){_0x5ded40[_0x0b01('0x3b')]=_[_0x0b01('0x30')](db[_0x0b01('0xa7')]['rawAttributes']);_0x5ded40[_0x0b01('0x37')]=_[_0x0b01('0x30')](_0x104b4c[_0x0b01('0x37')]);_0x5ded40[_0x0b01('0x38')]=_[_0x0b01('0x3a')](_0x5ded40['model'],_0x5ded40[_0x0b01('0x37')]);_0x571d38['attributes']=_[_0x0b01('0x3a')](_0x5ded40['model'],qs[_0x0b01('0xcb')](_0x104b4c[_0x0b01('0x37')][_0x0b01('0xcb')]));_0x571d38[_0x0b01('0x39')]=_0x571d38[_0x0b01('0x39')][_0x0b01('0x2f')]?_0x571d38[_0x0b01('0x39')]:_0x5ded40[_0x0b01('0x3b')];if(!_0x104b4c[_0x0b01('0x37')]['hasOwnProperty'](_0x0b01('0x3c'))){_0x571d38[_0x0b01('0x26')]=qs[_0x0b01('0x26')](_0x104b4c[_0x0b01('0x37')][_0x0b01('0x26')]);_0x571d38[_0x0b01('0x25')]=qs['offset'](_0x104b4c[_0x0b01('0x37')][_0x0b01('0x25')]);}_0x571d38[_0x0b01('0x3d')]=qs[_0x0b01('0x3e')](_0x104b4c[_0x0b01('0x37')]['sort']);_0x571d38['where']=qs[_0x0b01('0x38')](_[_0x0b01('0x3f')](_0x104b4c['query'],_0x5ded40[_0x0b01('0x38')]));_0x571d38[_0x0b01('0x4b')]['ContactId']=_0x418e66['id'];if(_0x104b4c[_0x0b01('0x37')][_0x0b01('0x5e')]){_0x571d38['where']=_[_0x0b01('0x83')](_0x571d38[_0x0b01('0x4b')],{'$or':_[_0x0b01('0x53')](_0x571d38[_0x0b01('0x39')],function(_0x387b46){var _0x5eb196={};_0x5eb196[_0x387b46]={'$like':'%'+_0x104b4c['query'][_0x0b01('0x5e')]+'%'};return _0x5eb196;})});}_0x571d38=_[_0x0b01('0x83')]({},_0x571d38,_0x104b4c[_0x0b01('0xcc')]);return db[_0x0b01('0xa7')][_0x0b01('0x24')]({'where':_0x571d38[_0x0b01('0x4b')]})['then'](function(_0x20d0d8){_0x3d8ad9[_0x0b01('0x24')]=_0x20d0d8;if(_0x104b4c[_0x0b01('0x37')][_0x0b01('0xe1')]){_0x571d38[_0x0b01('0xe0')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x571d38);})[_0x0b01('0x2a')](function(_0x45c4d4){_0x3d8ad9[_0x0b01('0x8c')]=_0x45c4d4;return _0x3d8ad9;});}})[_0x0b01('0x2a')](respondWithFilteredResult(_0x4d5a64,_0x571d38))[_0x0b01('0x8d')](handleError(_0x4d5a64,null));};exports['getHopperFinals']=function(_0xe2b41d,_0x3f4f74,_0x2a0bb8){var _0x4bbba3={'raw':!![],'where':{}};var _0x2f2b2d={};var _0x563bd7={'count':0x0,'rows':[]};return db[_0x0b01('0x2d')]['findOne']({'where':{'id':_0xe2b41d[_0x0b01('0xba')]['id']}})['then'](handleEntityNotFound(_0x3f4f74,null))[_0x0b01('0x2a')](function(_0x1ba10d){if(_0x1ba10d){_0x2f2b2d[_0x0b01('0x3b')]=_[_0x0b01('0x30')](db[_0x0b01('0xe2')][_0x0b01('0xca')]);_0x2f2b2d[_0x0b01('0x37')]=_[_0x0b01('0x30')](_0xe2b41d[_0x0b01('0x37')]);_0x2f2b2d[_0x0b01('0x38')]=_[_0x0b01('0x3a')](_0x2f2b2d[_0x0b01('0x3b')],_0x2f2b2d[_0x0b01('0x37')]);_0x4bbba3[_0x0b01('0x39')]=_[_0x0b01('0x3a')](_0x2f2b2d[_0x0b01('0x3b')],qs[_0x0b01('0xcb')](_0xe2b41d[_0x0b01('0x37')][_0x0b01('0xcb')]));_0x4bbba3[_0x0b01('0x39')]=_0x4bbba3[_0x0b01('0x39')]['length']?_0x4bbba3[_0x0b01('0x39')]:_0x2f2b2d[_0x0b01('0x3b')];if(!_0xe2b41d['query'][_0x0b01('0x5d')](_0x0b01('0x3c'))){_0x4bbba3['limit']=qs[_0x0b01('0x26')](_0xe2b41d['query']['limit']);_0x4bbba3['offset']=qs['offset'](_0xe2b41d['query'][_0x0b01('0x25')]);}_0x4bbba3[_0x0b01('0x3d')]=qs[_0x0b01('0x3e')](_0xe2b41d[_0x0b01('0x37')][_0x0b01('0x3e')]);_0x4bbba3['where']=qs[_0x0b01('0x38')](_[_0x0b01('0x3f')](_0xe2b41d[_0x0b01('0x37')],_0x2f2b2d[_0x0b01('0x38')]));_0x4bbba3['where']['ContactId']=_0x1ba10d['id'];if(_0xe2b41d['query'][_0x0b01('0x5e')]){_0x4bbba3[_0x0b01('0x4b')]=_[_0x0b01('0x83')](_0x4bbba3[_0x0b01('0x4b')],{'$or':_[_0x0b01('0x53')](_0x4bbba3[_0x0b01('0x39')],function(_0x6879cc){var _0x47b7d8={};_0x47b7d8[_0x6879cc]={'$like':'%'+_0xe2b41d['query']['filter']+'%'};return _0x47b7d8;})});}_0x4bbba3=_[_0x0b01('0x83')]({},_0x4bbba3,_0xe2b41d[_0x0b01('0xcc')]);return db[_0x0b01('0xe2')]['count']({'where':_0x4bbba3['where']})[_0x0b01('0x2a')](function(_0x46263a){_0x563bd7[_0x0b01('0x24')]=_0x46263a;if(_0xe2b41d['query'][_0x0b01('0xe1')]){_0x4bbba3[_0x0b01('0xe0')]=[{'all':!![]}];}return db[_0x0b01('0xe2')]['findAll'](_0x4bbba3);})['then'](function(_0x54c9d4){_0x563bd7[_0x0b01('0x8c')]=_0x54c9d4;return _0x563bd7;});}})[_0x0b01('0x2a')](respondWithFilteredResult(_0x3f4f74,_0x4bbba3))['catch'](handleError(_0x3f4f74,null));};exports[_0x0b01('0xe3')]=function(_0x419b37,_0x46106d,_0x2b9643){var _0x28db01={'raw':!![],'where':{}};var _0x346691={};var _0x109629={'count':0x0,'rows':[]};return db[_0x0b01('0x2d')][_0x0b01('0x33')]({'where':{'id':_0x419b37['params']['id']}})['then'](handleEntityNotFound(_0x46106d,null))['then'](function(_0x2e2c45){if(_0x2e2c45){_0x346691[_0x0b01('0x3b')]=_[_0x0b01('0x30')](db[_0x0b01('0xad')][_0x0b01('0xca')]);_0x346691[_0x0b01('0x37')]=_[_0x0b01('0x30')](_0x419b37[_0x0b01('0x37')]);_0x346691[_0x0b01('0x38')]=_[_0x0b01('0x3a')](_0x346691[_0x0b01('0x3b')],_0x346691[_0x0b01('0x37')]);_0x28db01[_0x0b01('0x39')]=_[_0x0b01('0x3a')](_0x346691[_0x0b01('0x3b')],qs[_0x0b01('0xcb')](_0x419b37['query'][_0x0b01('0xcb')]));_0x28db01['attributes']=_0x28db01[_0x0b01('0x39')][_0x0b01('0x2f')]?_0x28db01[_0x0b01('0x39')]:_0x346691[_0x0b01('0x3b')];if(!_0x419b37[_0x0b01('0x37')][_0x0b01('0x5d')]('nolimit')){_0x28db01['limit']=qs[_0x0b01('0x26')](_0x419b37['query'][_0x0b01('0x26')]);_0x28db01[_0x0b01('0x25')]=qs[_0x0b01('0x25')](_0x419b37[_0x0b01('0x37')]['offset']);}_0x28db01['order']=qs[_0x0b01('0x3e')](_0x419b37[_0x0b01('0x37')][_0x0b01('0x3e')]);_0x28db01[_0x0b01('0x4b')]=qs[_0x0b01('0x38')](_['pick'](_0x419b37[_0x0b01('0x37')],_0x346691[_0x0b01('0x38')]));_0x28db01[_0x0b01('0x4b')][_0x0b01('0xe4')]=_0x2e2c45['id'];if(_0x419b37[_0x0b01('0x37')]['filter']){_0x28db01[_0x0b01('0x4b')]=_['merge'](_0x28db01[_0x0b01('0x4b')],{'$or':_[_0x0b01('0x53')](_0x28db01[_0x0b01('0x39')],function(_0x43f072){var _0x5d1547={};_0x5d1547[_0x43f072]={'$like':'%'+_0x419b37[_0x0b01('0x37')][_0x0b01('0x5e')]+'%'};return _0x5d1547;})});}_0x28db01=_[_0x0b01('0x83')]({},_0x28db01,_0x419b37[_0x0b01('0xcc')]);return db[_0x0b01('0xad')][_0x0b01('0x24')]({'where':_0x28db01[_0x0b01('0x4b')]})[_0x0b01('0x2a')](function(_0x2970a8){_0x109629[_0x0b01('0x24')]=_0x2970a8;if(_0x419b37['query'][_0x0b01('0xe1')]){_0x28db01[_0x0b01('0xe0')]=[{'all':!![]}];}return db[_0x0b01('0xad')][_0x0b01('0x92')](_0x28db01);})['then'](function(_0x3eba29){_0x109629[_0x0b01('0x8c')]=_0x3eba29;return _0x109629;});}})['then'](respondWithFilteredResult(_0x46106d,_0x28db01))[_0x0b01('0x8d')](handleError(_0x46106d,null));};exports[_0x0b01('0xe5')]=function(_0x326f1a,_0x14fe3c,_0x250c3b){try{if(!_0x326f1a['body'][_0x0b01('0x63')]){throw new Error(_0x0b01('0xe6'));}if(!_0x326f1a['body'][_0x0b01('0xe7')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x326f1a[_0x0b01('0x95')]['binding_values']){throw new Error(_0x0b01('0xe8'));}if(!_0x326f1a[_0x0b01('0x95')][_0x0b01('0xe9')]){throw new Error(_0x0b01('0xea'));}var _0x55158c=_0x326f1a['body'][_0x0b01('0xe7')][_0x0b01('0x52')](',');var _0x37c9cf=_0x326f1a[_0x0b01('0x95')][_0x0b01('0xeb')][_0x0b01('0x52')](',');if(!_0x55158c[_0x0b01('0x2f')]||!_0x37c9cf['length']||_0x55158c[_0x0b01('0x2f')]!==_0x37c9cf[_0x0b01('0x2f')]){throw new Error(_0x0b01('0xec'));}_0x326f1a[_0x0b01('0x95')][_0x0b01('0xcb')]=_[_0x0b01('0xed')](_0x55158c,_0x37c9cf);if(!_0x326f1a['body']['fields'][_0x0b01('0xc7')]){throw new Error(_0x0b01('0xee'));}if(!_0x326f1a['body'][_0x0b01('0xcb')][_0x0b01('0xef')]){throw new Error(_0x0b01('0xf0'));}var _0x4cd4a2=path[_0x0b01('0x98')](config[_0x0b01('0xf1')],_0x0b01('0xf2'),_0x326f1a[_0x0b01('0xf3')][_0x0b01('0xf4')]);fs[_0x0b01('0xf5')](_0x4cd4a2,parseInt(_0x0b01('0xf6'),0x8));var _0x2f5aa1=require('child_process')[_0x0b01('0xf7')](path[_0x0b01('0x98')](__dirname,_0x0b01('0xf8')),[_0x4cd4a2,_0x326f1a[_0x0b01('0x95')][_0x0b01('0xe7')],_0x326f1a[_0x0b01('0x95')]['binding_values'],_0x326f1a[_0x0b01('0x95')]['ListId'],_0x326f1a['body'][_0x0b01('0xf9')],_0x326f1a[_0x0b01('0x95')][_0x0b01('0xb4')],_0x326f1a[_0x0b01('0x95')][_0x0b01('0xe9')]]);return _0x14fe3c[_0x0b01('0x20')](0xc8)[_0x0b01('0x22')]({'message':_0x0b01('0xfa'),'pid':_0x2f5aa1[_0x0b01('0xfb')]});}catch(_0x163bd1){return _0x14fe3c[_0x0b01('0x20')](0x1f4)[_0x0b01('0xfc')](_0x163bd1);}};exports[_0x0b01('0xfd')]=function(_0x2edc21,_0x49ff32,_0xf19bc4){var _0x35a37d=fs['createReadStream'](_0x2edc21['file']['path']);Papa[_0x0b01('0xfe')](_0x35a37d,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x538875){return _0x49ff32[_0x0b01('0x20')](0xc8)[_0x0b01('0x22')]({'file':_0x2edc21['file'],'fields':_0x538875[_0x0b01('0xff')][_0x0b01('0xcb')]});}});};exports[_0x0b01('0x100')]=function(_0x49a60f,_0x4659a5,_0x3a0909){return db[_0x0b01('0x7e')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x5d9411){var _0x2b9fcf=![];if(!_0x49a60f[_0x0b01('0x95')][_0x0b01('0x63')]){throw new Error(_0x0b01('0xe6'));}if(!_0x49a60f[_0x0b01('0x95')][_0x0b01('0x101')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x49a60f[_0x0b01('0x95')][_0x0b01('0x101')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x49a60f[_0x0b01('0x95')][_0x0b01('0xe9')]){throw new Error(_0x0b01('0xea'));}var _0x4bccb0=require(_0x0b01('0x102'))['fork'](path[_0x0b01('0x98')](__dirname,_0x0b01('0x103')),[_0x49a60f[_0x0b01('0xba')]['id'],JSON[_0x0b01('0x104')](_0x49a60f[_0x0b01('0x95')]),JSON['stringify'](_0x5d9411)]);_0x4bccb0['on'](_0x0b01('0x105'),function(_0x4a93c8){_0x2b9fcf=!![];return _0x4659a5[_0x0b01('0x20')](0xc8)[_0x0b01('0x22')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x4bccb0[_0x0b01('0xfb')]});});_0x4bccb0['on']('exit',function(_0x39a0d2){if(_0x39a0d2&&!_0x2b9fcf){return _0x4659a5[_0x0b01('0x20')](0x1f4)[_0x0b01('0x22')]({'message':_0x0b01('0x106'),'pid':_0x4bccb0['pid']});}});})[_0x0b01('0x8d')](handleError(_0x4659a5,null));};exports[_0x0b01('0x107')]=function(_0x12a641,_0x5b4a75,_0xb89958){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0b01('0x7c')}})['then'](function(_0x17038f){var _0x5dc204=![];if(!_0x12a641[_0x0b01('0x95')]['ListId']){throw new Error(_0x0b01('0xe6'));}if(!_0x12a641[_0x0b01('0x95')][_0x0b01('0x101')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x12a641[_0x0b01('0x95')]['binding'][_0x0b01('0xef')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x12a641[_0x0b01('0x95')][_0x0b01('0xe9')]){throw new Error(_0x0b01('0xea'));}var _0x1bc998=require(_0x0b01('0x102'))['fork'](path[_0x0b01('0x98')](__dirname,_0x0b01('0x108')),[_0x12a641['params']['id'],JSON[_0x0b01('0x104')](_0x12a641['body']),JSON[_0x0b01('0x104')](_0x17038f)]);_0x1bc998['on'](_0x0b01('0x105'),function(_0x6d0f43){_0x5dc204=!![];return _0x5b4a75[_0x0b01('0x20')](0xc8)[_0x0b01('0x22')]({'message':_0x0b01('0x109'),'pid':_0x1bc998[_0x0b01('0xfb')]});});_0x1bc998['on'](_0x0b01('0x10a'),function(_0x2fcb7e){if(_0x2fcb7e&&!_0x5dc204){return _0x5b4a75[_0x0b01('0x20')](0x1f4)[_0x0b01('0x22')]({'message':_0x0b01('0x106'),'pid':_0x1bc998[_0x0b01('0xfb')]});}});})['catch'](handleError(_0x5b4a75,null));};exports[_0x0b01('0x10b')]=function(_0x56f261,_0x1c2ba9){var _0x5aedb1=['mail',_0x0b01('0x10c'),'sms','openchannel','fax',_0x0b01('0x10d'),_0x0b01('0x10e')];var _0x15231a={'offset':0x0,'order':qs[_0x0b01('0x3e')](_0x0b01('0x10f'))},_0x59fc25={'count':0x0,'rows':[]};Promise[_0x0b01('0x79')]()[_0x0b01('0x2a')](function(){if(_0x56f261[_0x0b01('0x37')]['channel']){if(!_[_0x0b01('0x110')](_0x5aedb1,_0x56f261[_0x0b01('0x37')][_0x0b01('0x111')][_0x0b01('0x112')]())){throw new Error('Invalid\x20channel');}_0x5aedb1=[_0x56f261[_0x0b01('0x37')][_0x0b01('0x111')][_0x0b01('0x112')]()];}if(_0x56f261['query'][_0x0b01('0x113')]){try{var _0xc3758d=JSON['parse'](_0x56f261[_0x0b01('0x37')]['range']);if(!moment(_0xc3758d[_0x0b01('0x42')])[_0x0b01('0x114')]()){throw new Error(_0x0b01('0x115'));}if(!moment(_0xc3758d['to'])['isValid']()){throw new Error(_0x0b01('0x116'));}}catch(_0x3dbbee){throw new Error(_0x0b01('0x117'));}}if(!_0x56f261[_0x0b01('0x37')]['hasOwnProperty']('nolimit')){_0x15231a[_0x0b01('0x26')]=qs[_0x0b01('0x26')](_0x56f261['query'][_0x0b01('0x26')]||0xa);_0x15231a[_0x0b01('0x25')]=qs[_0x0b01('0x25')](_0x56f261[_0x0b01('0x37')][_0x0b01('0x25')]);}var _0x41801d=_0x5aedb1[_0x0b01('0x53')](function(_0xeb3fb0){if(_0xeb3fb0==='voice'){var _0x22c8ab={'attributes':['id',_0x0b01('0x118'),_0x0b01('0x36'),_0x0b01('0x119'),_0x0b01('0x11a'),_0x0b01('0x11b'),_0x0b01('0x11c'),_0x0b01('0x11d'),_0x0b01('0x11e'),_0x0b01('0x11f'),_0x0b01('0x120'),_0x0b01('0x121'),_0x0b01('0x122'),_0x0b01('0x123'),_0x0b01('0x124')],'where':{'ContactId':_0x56f261[_0x0b01('0xba')]['id']},'include':[{'model':db[_0x0b01('0x7e')],'as':'User','attributes':['id',_0x0b01('0x2b'),_0x0b01('0x125'),'alias']}],'order':[[_0x0b01('0x120'),'DESC']]};if(_0x56f261['query'][_0x0b01('0x113')]){_0x22c8ab[_0x0b01('0x4b')][_0x0b01('0x120')]={'$gte':_0xc3758d[_0x0b01('0x42')],'$lte':_0xc3758d['to']};}return db[_0x0b01('0xa8')][_0x0b01('0x126')](_0x22c8ab)['then'](function(_0x59b976){_0x59fc25[_0x0b01('0x24')]+=_0x59b976['count'];return _['map'](_0x59b976[_0x0b01('0x8c')],function(_0x5412f8){var _0x499fd4=_0x5412f8[_0x0b01('0x96')]({'plain':!![]});_0x499fd4[_0x0b01('0x111')]=_0xeb3fb0;if(_0x499fd4[_0x0b01('0x7e')]){_0x499fd4[_0x0b01('0x7e')]={'id':_0x499fd4[_0x0b01('0x7e')]['id'],'name':_0x499fd4[_0x0b01('0x7e')][_0x0b01('0x2b')],'fullname':_0x499fd4[_0x0b01('0x7e')]['fullname'],'alias':_0x499fd4['User']['alias']};}return _0x499fd4;});});}else{var _0xd642ba=_[_0x0b01('0x127')](_0xeb3fb0)+(_0xeb3fb0===_0x0b01('0x10c')?_0x0b01('0x128'):_0x0b01('0x129'));var _0x114ca0={'attributes':['id',_0x0b01('0x12a'),_0x0b01('0x12b'),'createdAt',_0x0b01('0x11f'),_0x0b01('0x12c'),_0x0b01('0x12d'),_0x0b01('0x12e'),'UserId',_0xd642ba+'Id'],'where':{'ContactId':_0x56f261['params']['id']},'include':[{'model':db[_0xd642ba],'as':_0x0b01('0x129'),'attributes':['id','name',_0x0b01('0x12f')]},{'model':db[_0x0b01('0x7e')],'as':_0x0b01('0x130'),'attributes':['id',_0x0b01('0x2b'),_0x0b01('0x125')]},{'model':db['Tag'],'as':_0x0b01('0x8b'),'attributes':['id',_0x0b01('0x2b'),_0x0b01('0x41')],'through':{'attributes':[]}}],'order':[['createdAt',_0x0b01('0x131')]]};if(_0x56f261[_0x0b01('0x37')]['range']){_0x114ca0['where'][_0x0b01('0x120')]={'$gte':_0xc3758d[_0x0b01('0x42')],'$lte':_0xc3758d['to']};}switch(_0xeb3fb0){case'chat':_0x114ca0[_0x0b01('0x39')][_0x0b01('0x60')](_0x0b01('0x132'),_0x0b01('0x133'),_0x0b01('0x134'),_0x0b01('0x135'),_0x0b01('0x136'),_0x0b01('0x137'),_0x0b01('0x138'),_0x0b01('0x139'),_0x0b01('0x13a'));break;case _0x0b01('0x13b'):_0x114ca0[_0x0b01('0x39')][_0x0b01('0x60')]('subject',_0x0b01('0x13c'));break;case _0x0b01('0x13d'):_0x114ca0['attributes'][_0x0b01('0x60')](_0x0b01('0x13e'),_0x0b01('0x13f'));break;}return db[_['startCase'](_0xeb3fb0)+_0x0b01('0x140')][_0x0b01('0x126')](_0x114ca0)['then'](function(_0x18ce9a){_0x59fc25['count']+=_0x18ce9a[_0x0b01('0x24')];return _[_0x0b01('0x53')](_0x18ce9a[_0x0b01('0x8c')],function(_0x534a6c){var _0x5121aa=_0x534a6c[_0x0b01('0x96')]({'plain':!![]});_0x5121aa[_0x0b01('0x111')]=_0xeb3fb0;if(_0x5121aa['Owner']){_0x5121aa['Owner']={'id':_0x5121aa[_0x0b01('0x130')]['id'],'name':_0x5121aa[_0x0b01('0x130')][_0x0b01('0x2b')],'fullname':_0x5121aa[_0x0b01('0x130')]['fullname']};}return _0x5121aa;});});}});return Promise[_0x0b01('0x35')](_0x41801d);})[_0x0b01('0x2a')](function(_0x501124){return _(_0x501124)[_0x0b01('0x141')]()[_0x0b01('0x142')](_0x0b01('0x120'))[_0x0b01('0x143')]()[_0x0b01('0x51')]();})[_0x0b01('0x2a')](function(_0x377646){_0x59fc25[_0x0b01('0x8c')]=_0x15231a['limit']?_0x377646[_0x0b01('0x144')](_0x15231a[_0x0b01('0x25')],_0x15231a['offset']+_0x15231a['limit']):_0x377646;return _0x59fc25;})[_0x0b01('0x2a')](respondWithFilteredResult(_0x1c2ba9,_0x15231a))[_0x0b01('0x8d')](handleError(_0x1c2ba9,null));}; \ No newline at end of file +var _0xb58b=['TagIds','Tags','rows','catch','params','describe','tags','columnName','displayName','findAll','alias','values','merge','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','show','Phones','ContactItemType','ItemType','literal','`Phones.ItemType`.OrderBy','log','$and','format','cf_%d','omit','table','setFields','id\x20=\x20?','toParam','text','phone','getTags','setTags','ids','setAdditionalPhones','all','items','item_types','isNil','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','options','includeAll','include','getHopperHistories','rawAttributes','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','join','root','file','chmodSync','child_process','fork','../../components/import/cm/csv','binding_values','File\x20uploaded\x20correctly!','createReadStream','parse','meta','import','No\x20phone\x20column\x20specified','binding','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','pid','importUpdates','../../components/import/cm/csvUpdates','message','getJourney','mail','chat','sms','fax','whatsapp','voice','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','destination','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','startCase','Website','closed','secondDisposition','thirdDisposition','Account','Owner','browserName','customerIp','osName','ratingMessage','ratingType','ratingValue','referer','substatus','openchannel','threadId','Interaction','findAndCountAll','flatten','sortBy','reverse','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','end','offset','limit','undefined','count','status','set','Content-Range','json','save','update','then','destroy','sendStatus','error','stack','name','send','index','CmContact','keys','length','startsWith','cf_','push','CmCustomField','findOne','fieldType','filters','intersection','query','attributes','model','fields','nolimit','order','sort','pick','field','color','from','select','cm_contacts','cm_user_has_contacts','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','Tag','split','forEach','union','and','value','dateOfBirth','datetime','castTo','DATE','buildExpression','type','start','map','hasOwnProperty','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','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.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','SELECT','clone','DESC','having','t.id\x20IN\x20?','user','role','agent','some','User','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','c.firstName','c.phone','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId'];(function(_0x4774ab,_0x192e64){var _0x208d54=function(_0x2fcb6e){while(--_0x2fcb6e){_0x4774ab['push'](_0x4774ab['shift']());}};_0x208d54(++_0x192e64);}(_0xb58b,0x1f1));var _0xbb58=function(_0x536b3e,_0x2c63c9){_0x536b3e=_0x536b3e-0x0;var _0xd725c5=_0xb58b[_0x536b3e];return _0xd725c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];config[_0xbb58('0x18')]=_[_0xbb58('0x19')](config['redis'],{'host':_0xbb58('0x1a'),'port':0x18eb});var socket=require(_0xbb58('0x1b'))(new Redis(config[_0xbb58('0x18')]));require(_0xbb58('0x1c'))[_0xbb58('0x1d')](socket);function respondWithStatusCode(_0x58245f,_0x110944){_0x110944=_0x110944||0xcc;return function(_0x23fd15){if(_0x23fd15){return _0x58245f['sendStatus'](_0x110944);}return _0x58245f['status'](_0x110944)[_0xbb58('0x1e')]();};}function respondWithResult(_0x445b1f,_0x38d69a){_0x38d69a=_0x38d69a||0xc8;return function(_0x47c927){if(_0x47c927){return _0x445b1f['status'](_0x38d69a)['json'](_0x47c927);}};}function respondWithFilteredResult(_0x55156e,_0x28637b){return function(_0x3134ea){if(_0x3134ea){var _0x48f3e0=typeof _0x28637b[_0xbb58('0x1f')]==='undefined'&&typeof _0x28637b[_0xbb58('0x20')]===_0xbb58('0x21');var _0x3c33d9=_0x3134ea[_0xbb58('0x22')];var _0x3d961a=_0x48f3e0?0x0:_0x28637b[_0xbb58('0x1f')];var _0x32d694=_0x48f3e0?_0x3134ea['count']:_0x28637b[_0xbb58('0x1f')]+_0x28637b[_0xbb58('0x20')];var _0x3e64fe;if(_0x32d694>=_0x3c33d9){_0x32d694=_0x3c33d9;_0x3e64fe=0xc8;}else{_0x3e64fe=0xce;}_0x55156e[_0xbb58('0x23')](_0x3e64fe);return _0x55156e[_0xbb58('0x24')](_0xbb58('0x25'),_0x3d961a+'-'+_0x32d694+'/'+_0x3c33d9)[_0xbb58('0x26')](_0x3134ea);}return null;};}function patchUpdates(_0x350be7){return function(_0x27bbec){try{jsonpatch['apply'](_0x27bbec,_0x350be7,!![]);}catch(_0x27806d){return BPromise['reject'](_0x27806d);}return _0x27bbec[_0xbb58('0x27')]();};}function saveUpdates(_0x287822,_0x152f22){return function(_0x3e215c){if(_0x3e215c){return _0x3e215c[_0xbb58('0x28')](_0x287822)[_0xbb58('0x29')](function(_0x2d556a){return _0x2d556a;});}return null;};}function removeEntity(_0x15e4c5,_0x4e0303){return function(_0x283dff){if(_0x283dff){return _0x283dff[_0xbb58('0x2a')]()[_0xbb58('0x29')](function(){_0x15e4c5[_0xbb58('0x23')](0xcc)[_0xbb58('0x1e')]();});}};}function handleEntityNotFound(_0x521d0c,_0x3608dc){return function(_0x2ce7c3){if(!_0x2ce7c3){_0x521d0c[_0xbb58('0x2b')](0x194);}return _0x2ce7c3;};}function handleError(_0x2d5b39,_0xf6687e){_0xf6687e=_0xf6687e||0x1f4;return function(_0x28b3a3){logger[_0xbb58('0x2c')](_0x28b3a3[_0xbb58('0x2d')]);if(_0x28b3a3[_0xbb58('0x2e')]){delete _0x28b3a3['name'];}_0x2d5b39[_0xbb58('0x23')](_0xf6687e)[_0xbb58('0x2f')](_0x28b3a3);};}exports[_0xbb58('0x30')]=function(_0x3c9cee,_0x3304b9){var _0x9d379f={},_0x1ba526={},_0x643e0e={'count':0x0,'rows':[]};return db[_0xbb58('0x31')]['describe']()[_0xbb58('0x29')](function(_0x22329b){var _0x3edc34=[];for(var _0x3a1e46=0x0;_0x3a1e460x1){_0x18799c['or'](_0xbb58('0x70'),qs['getFullTextValue'](_0x2a6963),null);}else{if(qs[_0xbb58('0x71')](_0x2a6963)){_0x18799c['or'](_0xbb58('0x72'),_0x2a6963+'%');_0x18799c['or'](_0xbb58('0x73'),_0x2a6963+'%');_0x18799c['or']('c.mobile\x20LIKE\x20?',_0x2a6963+'%');_0x18799c['or'](_0xbb58('0x74'),_0x2a6963+'%');}else if(qs['isEmail'](_0x2a6963)){_0x18799c['or'](_0xbb58('0x75'),_0x2a6963+'%');}else{_0x18799c['or'](_0xbb58('0x76'),'%'+_0x2a6963+'%');_0x18799c['or']('c.lastName\x20LIKE\x20?','%'+_0x2a6963+'%');_0x18799c['or'](_0xbb58('0x75'),'%'+_0x2a6963+'%');}}}}_0x324be0[_0xbb58('0x4f')](_0x18799c);_0x324be0[_0xbb58('0x77')](_0xbb58('0x78'));var _0xcac910={'type':db['Sequelize']['QueryTypes'][_0xbb58('0x79')],'raw':!![]};var _0x2f0db7=_0x324be0[_0xbb58('0x7a')]()['field'](_0xbb58('0x78'));if(_0x9d379f[_0xbb58('0x41')]){_0x9d379f['order'][_0xbb58('0x58')](function(_0x22a287){_0x324be0['order']('c.'+_0x22a287[0x0],_0x22a287[0x1]===_0xbb58('0x7b')?![]:!![]);});}if(!_[_0xbb58('0x66')](_0x2c4ba6)){_0x324be0[_0xbb58('0x7c')](_0x109a95);_0x2f0db7[_0xbb58('0x4f')](_0xbb58('0x7d'),_0x2c4ba6);}BPromise['resolve']()[_0xbb58('0x29')](function(){if(!_0x55a1cc)return;if(_0x3c9cee[_0xbb58('0x7e')][_0xbb58('0x7f')]!==_0xbb58('0x80'))return;if(!_[_0xbb58('0x81')](_0x55a1cc['conditions'],['field',_0xbb58('0x82')])){return _0x3c9cee['user'][_0xbb58('0x83')]({'attributes':['id'],'raw':!![]})[_0xbb58('0x29')](function(_0xcfac9e){if(_[_0xbb58('0x66')](_0xcfac9e)){_0x2f0db7[_0xbb58('0x4f')](_0xbb58('0x84'));_0x324be0[_0xbb58('0x4f')](_0xbb58('0x84'));}else{_0x2f0db7[_0xbb58('0x4f')](_0xbb58('0x85'),_['map'](_0xcfac9e,'id'));_0x324be0[_0xbb58('0x4f')](_0xbb58('0x85'),_[_0xbb58('0x63')](_0xcfac9e,'id'));}});}})['then'](function(){if(_0x3c9cee[_0xbb58('0x7e')]['role']==='agent'&&!_0x55a1cc&&!_0x3c9cee[_0xbb58('0x3c')][_0xbb58('0x67')])return[];return db[_0xbb58('0x86')][_0xbb58('0x3c')](_0x2f0db7['toString'](),_0xcac910);})['then'](function(_0x3210d7){_0x643e0e[_0xbb58('0x22')]=_0x3210d7['length'];if(_0x643e0e[_0xbb58('0x22')]===0x0)return[];return db[_0xbb58('0x86')][_0xbb58('0x3c')](_0x301e15[_0xbb58('0x87')](),_0xcac910)[_0xbb58('0x29')](function(_0x55d3c5){_0x1185b3=_[_0xbb58('0x88')](_0x55d3c5,'id');_0xcac910=_['merge'](_0xcac910,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c9cee[_0xbb58('0x3c')][_0xbb58('0x3f')]){_0x9d379f[_0xbb58('0x3d')]['forEach'](function(_0x25b6d8){_0x324be0[_0xbb58('0x44')]('c.'+_0x25b6d8);});}else{_0x324be0[_0xbb58('0x44')](_0xbb58('0x78'));_0x324be0['field'](_0xbb58('0x89'));_0x324be0['field']('c.lastName');_0x324be0[_0xbb58('0x44')](_0xbb58('0x8a'));_0x324be0[_0xbb58('0x44')]('c.mobile');_0x324be0['field'](_0xbb58('0x8b'));_0x324be0[_0xbb58('0x44')](_0xbb58('0x8c'));_0x324be0[_0xbb58('0x44')](_0xbb58('0x8d'));_0x324be0[_0xbb58('0x44')](_0xbb58('0x8e'));_0x324be0[_0xbb58('0x44')](_0xbb58('0x8f'));_0x324be0[_0xbb58('0x44')](_0xbb58('0x90'));_0x324be0['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbb58('0x91'));}if(_0x9d379f[_0xbb58('0x20')])_0x324be0[_0xbb58('0x20')](_0x9d379f['limit']);if(_0x9d379f[_0xbb58('0x1f')])_0x324be0[_0xbb58('0x1f')](_0x9d379f[_0xbb58('0x1f')]);return db['sequelize'][_0xbb58('0x3c')](_0x324be0['toString'](),_0xcac910);});})[_0xbb58('0x29')](function(_0x47fd65){_0x47fd65[_0xbb58('0x58')](function(_0x35dc6e){if(_0x35dc6e[_0xbb58('0x91')]){_0x35dc6e[_0xbb58('0x92')]=[];_0x35dc6e[_0xbb58('0x91')][_0xbb58('0x57')](',')['forEach'](function(_0x5dc707){_0x35dc6e[_0xbb58('0x92')][_0xbb58('0x36')](_0x1185b3[_0x5dc707]);});}delete _0x35dc6e['TagIds'];});_0x643e0e[_0xbb58('0x93')]=_0x47fd65;return _0x643e0e;})[_0xbb58('0x29')](respondWithFilteredResult(_0x3304b9,_0x9d379f));})[_0xbb58('0x94')](handleError(_0x3304b9,null));};exports['destroy']=function(_0x371a9a,_0x5a7f77){return db[_0xbb58('0x31')][_0xbb58('0x55')]({'where':{'id':_0x371a9a[_0xbb58('0x95')]['id']}})[_0xbb58('0x29')](handleEntityNotFound(_0x5a7f77,null))[_0xbb58('0x29')](removeEntity(_0x5a7f77,null))[_0xbb58('0x94')](handleError(_0x5a7f77,null));};exports[_0xbb58('0x96')]=function(_0x5a80ef,_0x10828e){return db[_0xbb58('0x31')][_0xbb58('0x96')]()['then'](function(_0x25fb59){delete _0x25fb59[_0xbb58('0x97')];for(var _0x484a81=0x0;_0x484a810x0){return new Promise(function(_0x3cc325,_0x200d16){var _0x1f5844=[];for(var _0xab7d39=0x0;_0xab7d39<_0x3e1502['length'];_0xab7d39++){_0x1f5844['push'](insertAdditionalPhones(_0x3e1502[_0xab7d39]['contact'],_0x3e1502[_0xab7d39][_0xbb58('0xba')]));}Promise['all'](_0x1f5844)[_0xbb58('0x29')](function(){_0x3cc325(0x1);});})[_0xbb58('0x29')](function(){return{'success':_0x4bd8c9,'failure':_0x450581,'duplicates':_0x578b9a};});}else{return{'success':_0x4bd8c9,'failure':_0x450581,'duplicates':_0x578b9a};}}})[_0xbb58('0x29')](respondWithResult(_0x26f479,0xc9))[_0xbb58('0x94')](handleError(_0x26f479,null));};exports[_0xbb58('0xc0')]=function(_0x2e5dcd,_0x9050b8,_0x52ba37){var _0x154f13;return db[_0xbb58('0x31')][_0xbb58('0x96')]()[_0xbb58('0x29')](function(_0x2ca70a){return db['CmContact'][_0xbb58('0x55')]({'where':{'id':_0x2e5dcd['params']['id']},'include':[{'model':db[_0xbb58('0x56')],'as':_0xbb58('0x92'),'attributes':['id',_0xbb58('0x2e'),_0xbb58('0x45')],'required':_0x2e5dcd[_0xbb58('0x3c')]['tag']?!![]:![]},{'model':db[_0xbb58('0xae')],'as':_0xbb58('0xc1'),'where':{'CmContactId':_0x2e5dcd[_0xbb58('0x95')]['id']},'required':![],'include':[{'model':db[_0xbb58('0xc2')],'as':_0xbb58('0xc3')}]}],'order':[db['sequelize'][_0xbb58('0xc4')](_0xbb58('0xc5'))],'logging':console[_0xbb58('0xc6')],'attributes':_[_0xbb58('0x32')](_0x2ca70a)});})['then'](function(_0xf1243e){_0x154f13=_0xf1243e[_0xbb58('0x9f')]({'plain':!![]});var _0x4e617f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf1243e&&_0xf1243e[_0xbb58('0x67')]){if(_0xf1243e[_0xbb58('0x67')]){_0x4e617f[_0xbb58('0x4f')][_0xbb58('0xc7')][_0xbb58('0x36')]({'ListId':{'$ne':_0xf1243e[_0xbb58('0x67')]}});}}return db[_0xbb58('0x37')][_0xbb58('0x9a')](_0x4e617f);})['then'](function(_0x5c6b9b){return _['omit'](_0x154f13,_['map'](_0x5c6b9b,function(_0x5b7751){return util[_0xbb58('0xc8')](_0xbb58('0xc9'),_0x5b7751['id']);}));})[_0xbb58('0x29')](handleEntityNotFound(_0x9050b8,null))[_0xbb58('0x29')](respondWithResult(_0x9050b8,null))[_0xbb58('0x94')](handleError(_0x9050b8,null));};exports[_0xbb58('0x28')]=function(_0x520662,_0x2f3189){var _0x2968e3;if(_0x520662[_0xbb58('0x9e')]['id']){delete _0x520662[_0xbb58('0x9e')]['id'];}return db['CmContact']['find']({'where':{'id':_0x520662[_0xbb58('0x95')]['id']}})[_0xbb58('0x29')](handleEntityNotFound(_0x2f3189,null))[_0xbb58('0x29')](saveUpdates(_0x520662[_0xbb58('0x9e')],null))['then'](function(_0xe2d886){_0x2968e3=_0xe2d886;var _0x261064={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xe2d886&&_0xe2d886['ListId']){if(_0xe2d886[_0xbb58('0x67')]){_0x261064[_0xbb58('0x4f')][_0xbb58('0xc7')][_0xbb58('0x36')]({'ListId':{'$ne':_0xe2d886['ListId']}});}}return db['CmCustomField']['findAll'](_0x261064);})[_0xbb58('0x29')](function(_0xde4dff){if(_0xde4dff){return _[_0xbb58('0xca')](_['pickBy'](_0x520662['body'],function(_0x9ab172,_0x93cc1b){return _['startsWith'](_0x93cc1b,'cf_');}),_[_0xbb58('0x63')](_0xde4dff,function(_0x2649df){return util[_0xbb58('0xc8')](_0xbb58('0xc9'),_0x2649df['id']);}));}})[_0xbb58('0x29')](function(_0x2e2e89){if(_0x2e2e89&&!_[_0xbb58('0x66')](_0x2e2e89)){var _0x2eb383=squel[_0xbb58('0x28')]()[_0xbb58('0xcb')]('cm_contacts')[_0xbb58('0xcc')](_0x2e2e89)[_0xbb58('0x4f')](_0xbb58('0xcd'),_0x520662['params']['id'])[_0xbb58('0xce')]();return db[_0xbb58('0x86')][_0xbb58('0x3c')](_0x2eb383[_0xbb58('0xcf')],{'replacements':_0x2eb383['values']});}})['then'](function(){if(_0x520662['body']['phone']&&_0x2968e3){return db[_0xbb58('0xa3')]['update']({'phone':_0x520662[_0xbb58('0x9e')][_0xbb58('0xd0')]},{'where':{'ContactId':_0x2968e3['id']}});}})[_0xbb58('0x29')](function(){return _0x2968e3;})[_0xbb58('0x29')](respondWithResult(_0x2f3189,null))['catch'](handleError(_0x2f3189,null));};exports[_0xbb58('0xd1')]=function(_0x2e18dc,_0xe2af62,_0x39a058){var _0x237a05={};var _0x35a73f={};var _0x2ce203;var _0x1ca3ba;return db[_0xbb58('0x31')][_0xbb58('0x38')]({'where':{'id':_0x2e18dc[_0xbb58('0x95')]['id']}})['then'](handleEntityNotFound(_0xe2af62,null))[_0xbb58('0x29')](function(_0x598279){if(_0x598279){_0x2ce203=_0x598279;_0x35a73f[_0xbb58('0x3e')]=_[_0xbb58('0x32')](db[_0xbb58('0x56')]['rawAttributes']);_0x35a73f['query']=_[_0xbb58('0x32')](_0x2e18dc[_0xbb58('0x3c')]);_0x35a73f[_0xbb58('0x3a')]=_['intersection'](_0x35a73f[_0xbb58('0x3e')],_0x35a73f[_0xbb58('0x3c')]);_0x237a05[_0xbb58('0x3d')]=_[_0xbb58('0x3b')](_0x35a73f[_0xbb58('0x3e')],qs[_0xbb58('0x3f')](_0x2e18dc[_0xbb58('0x3c')][_0xbb58('0x3f')]));_0x237a05[_0xbb58('0x3d')]=_0x237a05[_0xbb58('0x3d')][_0xbb58('0x33')]?_0x237a05[_0xbb58('0x3d')]:_0x35a73f[_0xbb58('0x3e')];_0x237a05[_0xbb58('0x41')]=qs[_0xbb58('0x42')](_0x2e18dc[_0xbb58('0x3c')][_0xbb58('0x42')]);_0x237a05[_0xbb58('0x4f')]=qs['filters'](_[_0xbb58('0x43')](_0x2e18dc[_0xbb58('0x3c')],_0x35a73f[_0xbb58('0x3a')]));if(_0x2e18dc[_0xbb58('0x3c')][_0xbb58('0x6e')]){_0x237a05[_0xbb58('0x4f')]=_[_0xbb58('0x9d')](_0x237a05[_0xbb58('0x4f')],{'$or':_[_0xbb58('0x63')](_0x237a05[_0xbb58('0x3d')],function(_0x41d338){var _0x1fb584={};_0x1fb584[_0x41d338]={'$like':'%'+_0x2e18dc['query']['filter']+'%'};return _0x1fb584;})});}_0x237a05=_[_0xbb58('0x9d')]({},_0x237a05,_0x2e18dc['options']);return _0x2ce203[_0xbb58('0xd1')](_0x237a05);}})[_0xbb58('0x29')](function(_0x2d5bf4){if(_0x2d5bf4){_0x1ca3ba=_0x2d5bf4[_0xbb58('0x33')];if(!_0x2e18dc['query'][_0xbb58('0x64')](_0xbb58('0x40'))){_0x237a05['limit']=qs[_0xbb58('0x20')](_0x2e18dc[_0xbb58('0x3c')][_0xbb58('0x20')]);_0x237a05[_0xbb58('0x1f')]=qs[_0xbb58('0x1f')](_0x2e18dc[_0xbb58('0x3c')][_0xbb58('0x1f')]);}return _0x2ce203[_0xbb58('0xd1')](_0x237a05);}})['then'](function(_0x49b610){if(_0x49b610){return _0x49b610?{'count':_0x1ca3ba,'rows':_0x49b610}:null;}})[_0xbb58('0x29')](respondWithResult(_0xe2af62,null))['catch'](handleError(_0xe2af62,null));};exports[_0xbb58('0xd2')]=function(_0xa7b4bb,_0x963489,_0x2d26e4){if(_0xa7b4bb['body']['id']){delete _0xa7b4bb[_0xbb58('0x9e')]['id'];}return db[_0xbb58('0x31')][_0xbb58('0x38')]({'where':{'id':_0xa7b4bb[_0xbb58('0x95')]['id']}})['then'](handleEntityNotFound(_0x963489,null))[_0xbb58('0x29')](function(_0x294264){if(_0x294264){return _0x294264['setTags'](_0xa7b4bb[_0xbb58('0x9e')][_0xbb58('0xd3')]||[]);}return null;})['then'](respondWithResult(_0x963489,null))[_0xbb58('0x94')](handleError(_0x963489,null));};exports[_0xbb58('0xd4')]=function(_0xed090e,_0x290044){var _0x50a286=[];_0x50a286[_0xbb58('0x36')](addAdditionalPhones(_0xed090e['body']));Promise[_0xbb58('0xd5')](_0x50a286)[_0xbb58('0x29')](function(){_0x50a286=[];_0x50a286[_0xbb58('0x36')](deleteCmHopperPhones(_0xed090e[_0xbb58('0x9e')]['id']));_0x50a286['push'](addCmHopperPhones(_0xed090e['body']['id']));Promise[_0xbb58('0xd5')](_0x50a286)[_0xbb58('0x29')](function(){return[0x1];})['then'](respondWithResult(_0x290044,null));});};function addAdditionalPhones(_0x424391){return new Promise(function(_0x49d142,_0x2f0816){return db[_0xbb58('0xae')][_0xbb58('0x2a')]({'where':{'CmContactId':_0x424391['id']}})[_0xbb58('0x29')](function(){var _0x3bb7ba=[];for(var _0x2d9f63=0x0;_0x2d9f63<_0x424391[_0xbb58('0xd6')]['length'];_0x2d9f63++){_0x3bb7ba[_0xbb58('0x36')](addAdditionalPhone(_0x424391['id'],_0x424391[_0xbb58('0xd6')][_0x2d9f63][_0xbb58('0xd0')],_0x424391[_0xbb58('0xd7')]?_[_0xbb58('0xd8')](_0x424391[_0xbb58('0xd7')][_0x2d9f63])?null:_0x424391['item_types'][_0x2d9f63]:_0x424391[_0xbb58('0xd6')][_0x2d9f63][_0xbb58('0xd9')]?_0x424391['items'][_0x2d9f63]['ItemTypeId']:null,_0x2d9f63,_0x424391[_0xbb58('0xd6')][_0x2d9f63][_0xbb58('0xda')]));}Promise[_0xbb58('0xd5')](_0x3bb7ba)[_0xbb58('0x29')](function(){_0x49d142(0x1);});});});}function addAdditionalPhone(_0x3efd44,_0x110007,_0xa618a8,_0x5e0ae5,_0x581a86){return db[_0xbb58('0xae')]['find']({'where':{'CmContactId':_0x3efd44,'item':_0x110007}})[_0xbb58('0x29')](function(_0x3090b5){if(_0x3090b5)logger[_0xbb58('0xa1')]('contact\x20phone\x20exists',_0x3090b5);else{db[_0xbb58('0xae')][_0xbb58('0xb9')]({'CmContactId':_0x3efd44,'item':_0x110007,'ItemTypeId':_0xa618a8,'OrderBy':_0x5e0ae5,'ItemClass':_0xbb58('0xdb'),'description':_0x581a86});}});}function deletePhones(_0x500654){return db[_0xbb58('0xae')][_0xbb58('0x2a')]({'where':{'CmContactId':_0x500654}});}function deleteCmHopperPhones(_0x2c8d82){return new Promise(function(_0x16594f,_0x55537b){return db[_0xbb58('0xa3')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2c8d82}})[_0xbb58('0x29')](function(_0x3dbbdf){db[_0xbb58('0xdc')][_0xbb58('0x2a')]({'where':{'CmHopperId':{'$in':_[_0xbb58('0x63')](_0x3dbbdf,'id')}}});})[_0xbb58('0x29')](function(){_0x16594f(0x1);});});}function addCmHopperPhones(_0x5b6c2f){return new Promise(function(_0x23e42e,_0x583fa4){return db[_0xbb58('0xa3')][_0xbb58('0x9a')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5b6c2f}})[_0xbb58('0x29')](function(_0x2c8b0e){var _0x1a223b=[];_[_0xbb58('0x63')](_0x2c8b0e,function(_0x25e695){_0x1a223b[_0xbb58('0x36')](createCmHopperPhone(_0x5b6c2f,_0x25e695['id']));});Promise[_0xbb58('0xd5')](_0x1a223b)[_0xbb58('0x29')](function(){_0x23e42e(0x1);});});});}function createCmHopperPhone(_0x24da2a,_0x3c045f){return new Promise(function(_0x2c2ef1,_0x50a786){db['CmContactHasItem'][_0xbb58('0x9a')]({'raw':!![],'attributes':[_0xbb58('0xdd')],'where':{'CmContactId':_0x24da2a,'ItemClass':_0xbb58('0xdb')},'include':[{'model':db[_0xbb58('0xc2')],'attributes':[_0xbb58('0xde')],'as':_0xbb58('0xc3')}],'order':[db[_0xbb58('0x86')][_0xbb58('0xc4')]('`ItemType`.OrderBy')]})[_0xbb58('0x29')](function(_0x45175d){var _0x24fd50=0x1;var _0x1ba344=_[_0xbb58('0x63')](_0x45175d,function(_0x1fff94){_0x1fff94[_0xbb58('0xdf')]=_0x3c045f;_0x1fff94[_0xbb58('0xd0')]=_0x1fff94[_0xbb58('0xdd')];_0x1fff94[_0xbb58('0xde')]=_0x1fff94[_0xbb58('0xe0')]||_0x24fd50;delete _0x1fff94['ItemType.OrderBy'];_0x24fd50=_0x24fd50+0x1;return _0x1fff94;});return db[_0xbb58('0xdc')][_0xbb58('0xbb')](_0x1ba344,{});})[_0xbb58('0x29')](function(){_0x2c2ef1(0x1);});});}function insertAdditionalPhones(_0xc8affe,_0x27eeb6){return new Promise(function(_0xaf0f2f,_0x4ab464){var _0x548e6a=[];for(var _0x3f470a=0x0;_0x3f470a<_0x27eeb6[_0xbb58('0x33')];_0x3f470a++){var _0x5ae2cb=_0x27eeb6[_0x3f470a];_0x548e6a[_0xbb58('0x36')](parseContactItemType(_0x5ae2cb));}Promise[_0xbb58('0xd5')](_0x548e6a)['then'](function(){var _0x37d956={'id':_0xc8affe['id'],'items':_0x27eeb6};return addAdditionalPhones(_0x37d956)[_0xbb58('0x29')](function(_0x214f17){return addCmHopperPhones(_0xc8affe['id']);});})['then'](function(){_0xaf0f2f(_0xc8affe);});});}function parseContactItemType(_0x33194a){return new Promise(function(_0x44f609,_0x4242e2){if(_0x33194a[_0xbb58('0x64')](_0xbb58('0xd9'))){_0x44f609(_0x33194a);}else{return db['ContactItemType']['find']({'where':{'name':_0x33194a[_0xbb58('0xc3')]}})[_0xbb58('0x29')](function(_0x52f803){if(_[_0xbb58('0xd8')](_0x52f803))_0x33194a[_0xbb58('0xd9')]=null;else _0x33194a[_0xbb58('0xd9')]=_0x52f803['id'];_0x44f609(_0x33194a);});}});}exports[_0xbb58('0xe1')]=function(_0x1733f7,_0x1972af){return db[_0xbb58('0xae')][_0xbb58('0x9a')]({'raw':!![],'where':{'CmContactId':_0x1733f7['params']['id'],'ItemClass':_0xbb58('0xdb')},'include':[{'model':db['ContactItemType'],'as':_0xbb58('0xc3')}],'order':[[db[_0xbb58('0x86')][_0xbb58('0xc4')](_0xbb58('0xe2'))],[_0xbb58('0xde')]]})[_0xbb58('0x29')](function(_0x4d5745){return _0x4d5745;})[_0xbb58('0x29')](respondWithResult(_0x1972af,null))[_0xbb58('0x94')](handleError(_0x1972af,null));};exports[_0xbb58('0xe3')]=function(_0x2ee131,_0x46e36b){return db[_0xbb58('0xae')][_0xbb58('0x9a')]({'raw':!![],'where':{'CmContactId':_0x2ee131[_0xbb58('0x9e')][_0xbb58('0xe4')]}})['then'](function(_0x24983c){var _0x4cafeb=_[_0xbb58('0x63')](_0x24983c,function(_0x14e817){_0x14e817[_0xbb58('0xe5')]=_0x2ee131['body']['toContactId'];return _0x14e817;});return db[_0xbb58('0xae')][_0xbb58('0xbb')](_0x4cafeb,{});})[_0xbb58('0x29')](function(_0x5b275f){return addCmHopperPhones(_0x2ee131[_0xbb58('0x9e')]['toContactId']);})['then'](function(_0x21eb63){return['ok'];})[_0xbb58('0x29')](respondWithResult(_0x46e36b,null))[_0xbb58('0x94')](handleError(_0x46e36b,null));};exports[_0xbb58('0xe6')]=function(_0x29bc66,_0x30e354){var _0x50b5ee=[];_0x50b5ee[_0xbb58('0x36')](createCmHopperPhone(_0x29bc66[_0xbb58('0x9e')]['id'],_0x29bc66['body'][_0xbb58('0xe7')]));Promise[_0xbb58('0xd5')](_0x50b5ee)['then'](function(){return[0x1];})[_0xbb58('0x29')](respondWithResult(_0x30e354,null));};exports[_0xbb58('0xe8')]=function(_0x18972f,_0x305e0a,_0x3ee22f){var _0x4841ab={'raw':![],'where':{}};var _0x129a40={};var _0x187efc={'count':0x0,'rows':[]};return db['CmContact'][_0xbb58('0x38')]({'where':{'id':_0x18972f[_0xbb58('0x95')]['id']}})[_0xbb58('0x29')](handleEntityNotFound(_0x305e0a,null))['then'](function(_0x285017){if(_0x285017){_0x129a40[_0xbb58('0x3e')]=_[_0xbb58('0x32')](db[_0xbb58('0xa3')]['rawAttributes']);_0x129a40[_0xbb58('0x3c')]=_[_0xbb58('0x32')](_0x18972f[_0xbb58('0x3c')]);_0x129a40[_0xbb58('0x3a')]=_[_0xbb58('0x3b')](_0x129a40[_0xbb58('0x3e')],_0x129a40[_0xbb58('0x3c')]);_0x4841ab[_0xbb58('0x3d')]=_[_0xbb58('0x3b')](_0x129a40['model'],qs['fields'](_0x18972f[_0xbb58('0x3c')]['fields']));_0x4841ab[_0xbb58('0x3d')]=_0x4841ab[_0xbb58('0x3d')]['length']?_0x4841ab[_0xbb58('0x3d')]:_0x129a40[_0xbb58('0x3e')];if(!_0x18972f[_0xbb58('0x3c')][_0xbb58('0x64')]('nolimit')){_0x4841ab[_0xbb58('0x20')]=qs[_0xbb58('0x20')](_0x18972f[_0xbb58('0x3c')][_0xbb58('0x20')]);_0x4841ab['offset']=qs['offset'](_0x18972f[_0xbb58('0x3c')][_0xbb58('0x1f')]);}_0x4841ab[_0xbb58('0x41')]=qs[_0xbb58('0x42')](_0x18972f['query'][_0xbb58('0x42')]);_0x4841ab['where']=qs[_0xbb58('0x3a')](_[_0xbb58('0x43')](_0x18972f['query'],_0x129a40['filters']));_0x4841ab[_0xbb58('0x4f')][_0xbb58('0xe9')]=_0x285017['id'];if(_0x18972f['query'][_0xbb58('0x6e')]){_0x4841ab['where']=_[_0xbb58('0x9d')](_0x4841ab['where'],{'$or':_['map'](_0x4841ab[_0xbb58('0x3d')],function(_0x1220d6){var _0x4e3700={};_0x4e3700[_0x1220d6]={'$like':'%'+_0x18972f[_0xbb58('0x3c')][_0xbb58('0x6e')]+'%'};return _0x4e3700;})});}_0x4841ab=_[_0xbb58('0x9d')]({},_0x4841ab,_0x18972f[_0xbb58('0xea')]);return db[_0xbb58('0xa3')]['count']({'where':_0x4841ab[_0xbb58('0x4f')]})[_0xbb58('0x29')](function(_0x31f4a8){_0x187efc[_0xbb58('0x22')]=_0x31f4a8;if(_0x18972f['query'][_0xbb58('0xeb')]){_0x4841ab[_0xbb58('0xec')]=[{'all':!![]}];}return db[_0xbb58('0xa3')]['findAll'](_0x4841ab);})[_0xbb58('0x29')](function(_0x34d6d4){_0x187efc[_0xbb58('0x93')]=_0x34d6d4;return _0x187efc;});}})['then'](respondWithFilteredResult(_0x305e0a,_0x4841ab))[_0xbb58('0x94')](handleError(_0x305e0a,null));};exports[_0xbb58('0xed')]=function(_0x1f306a,_0x134cf9,_0x5734b2){var _0x5d815f={'raw':!![],'where':{}};var _0xde225e={};var _0x15c13d={'count':0x0,'rows':[]};return db[_0xbb58('0x31')][_0xbb58('0x38')]({'where':{'id':_0x1f306a[_0xbb58('0x95')]['id']}})['then'](handleEntityNotFound(_0x134cf9,null))['then'](function(_0xb7de6){if(_0xb7de6){_0xde225e[_0xbb58('0x3e')]=_[_0xbb58('0x32')](db[_0xbb58('0xb0')][_0xbb58('0xee')]);_0xde225e['query']=_[_0xbb58('0x32')](_0x1f306a['query']);_0xde225e[_0xbb58('0x3a')]=_[_0xbb58('0x3b')](_0xde225e[_0xbb58('0x3e')],_0xde225e[_0xbb58('0x3c')]);_0x5d815f[_0xbb58('0x3d')]=_['intersection'](_0xde225e[_0xbb58('0x3e')],qs[_0xbb58('0x3f')](_0x1f306a['query']['fields']));_0x5d815f[_0xbb58('0x3d')]=_0x5d815f[_0xbb58('0x3d')]['length']?_0x5d815f['attributes']:_0xde225e[_0xbb58('0x3e')];if(!_0x1f306a['query'][_0xbb58('0x64')](_0xbb58('0x40'))){_0x5d815f[_0xbb58('0x20')]=qs['limit'](_0x1f306a['query'][_0xbb58('0x20')]);_0x5d815f[_0xbb58('0x1f')]=qs[_0xbb58('0x1f')](_0x1f306a['query']['offset']);}_0x5d815f['order']=qs[_0xbb58('0x42')](_0x1f306a[_0xbb58('0x3c')][_0xbb58('0x42')]);_0x5d815f[_0xbb58('0x4f')]=qs['filters'](_[_0xbb58('0x43')](_0x1f306a[_0xbb58('0x3c')],_0xde225e['filters']));_0x5d815f[_0xbb58('0x4f')][_0xbb58('0xe9')]=_0xb7de6['id'];if(_0x1f306a[_0xbb58('0x3c')][_0xbb58('0x6e')]){_0x5d815f['where']=_[_0xbb58('0x9d')](_0x5d815f[_0xbb58('0x4f')],{'$or':_[_0xbb58('0x63')](_0x5d815f[_0xbb58('0x3d')],function(_0x5102a6){var _0x4caf14={};_0x4caf14[_0x5102a6]={'$like':'%'+_0x1f306a['query'][_0xbb58('0x6e')]+'%'};return _0x4caf14;})});}_0x5d815f=_[_0xbb58('0x9d')]({},_0x5d815f,_0x1f306a['options']);return db[_0xbb58('0xb0')]['count']({'where':_0x5d815f[_0xbb58('0x4f')]})['then'](function(_0x4d04b0){_0x15c13d['count']=_0x4d04b0;if(_0x1f306a['query']['includeAll']){_0x5d815f['include']=[{'all':!![]}];}return db[_0xbb58('0xb0')]['findAll'](_0x5d815f);})[_0xbb58('0x29')](function(_0x41fca2){_0x15c13d[_0xbb58('0x93')]=_0x41fca2;return _0x15c13d;});}})[_0xbb58('0x29')](respondWithFilteredResult(_0x134cf9,_0x5d815f))[_0xbb58('0x94')](handleError(_0x134cf9,null));};exports[_0xbb58('0xef')]=function(_0x6d299a,_0x1f1219,_0x147467){var _0x3e21bf={'raw':!![],'where':{}};var _0x5f4a84={};var _0x4a82e7={'count':0x0,'rows':[]};return db[_0xbb58('0x31')]['findOne']({'where':{'id':_0x6d299a['params']['id']}})[_0xbb58('0x29')](handleEntityNotFound(_0x1f1219,null))['then'](function(_0x29d6e1){if(_0x29d6e1){_0x5f4a84[_0xbb58('0x3e')]=_[_0xbb58('0x32')](db[_0xbb58('0xaf')][_0xbb58('0xee')]);_0x5f4a84[_0xbb58('0x3c')]=_['keys'](_0x6d299a['query']);_0x5f4a84[_0xbb58('0x3a')]=_[_0xbb58('0x3b')](_0x5f4a84['model'],_0x5f4a84[_0xbb58('0x3c')]);_0x3e21bf[_0xbb58('0x3d')]=_[_0xbb58('0x3b')](_0x5f4a84[_0xbb58('0x3e')],qs[_0xbb58('0x3f')](_0x6d299a[_0xbb58('0x3c')][_0xbb58('0x3f')]));_0x3e21bf[_0xbb58('0x3d')]=_0x3e21bf[_0xbb58('0x3d')]['length']?_0x3e21bf[_0xbb58('0x3d')]:_0x5f4a84['model'];if(!_0x6d299a[_0xbb58('0x3c')][_0xbb58('0x64')](_0xbb58('0x40'))){_0x3e21bf[_0xbb58('0x20')]=qs[_0xbb58('0x20')](_0x6d299a[_0xbb58('0x3c')][_0xbb58('0x20')]);_0x3e21bf[_0xbb58('0x1f')]=qs[_0xbb58('0x1f')](_0x6d299a['query'][_0xbb58('0x1f')]);}_0x3e21bf['order']=qs[_0xbb58('0x42')](_0x6d299a[_0xbb58('0x3c')][_0xbb58('0x42')]);_0x3e21bf[_0xbb58('0x4f')]=qs[_0xbb58('0x3a')](_[_0xbb58('0x43')](_0x6d299a['query'],_0x5f4a84[_0xbb58('0x3a')]));_0x3e21bf[_0xbb58('0x4f')][_0xbb58('0xe9')]=_0x29d6e1['id'];if(_0x6d299a[_0xbb58('0x3c')][_0xbb58('0x6e')]){_0x3e21bf[_0xbb58('0x4f')]=_['merge'](_0x3e21bf[_0xbb58('0x4f')],{'$or':_['map'](_0x3e21bf[_0xbb58('0x3d')],function(_0x30169f){var _0x5bf0b9={};_0x5bf0b9[_0x30169f]={'$like':'%'+_0x6d299a[_0xbb58('0x3c')][_0xbb58('0x6e')]+'%'};return _0x5bf0b9;})});}_0x3e21bf=_[_0xbb58('0x9d')]({},_0x3e21bf,_0x6d299a['options']);return db[_0xbb58('0xaf')][_0xbb58('0x22')]({'where':_0x3e21bf[_0xbb58('0x4f')]})[_0xbb58('0x29')](function(_0x2ac8d1){_0x4a82e7[_0xbb58('0x22')]=_0x2ac8d1;if(_0x6d299a[_0xbb58('0x3c')][_0xbb58('0xeb')]){_0x3e21bf[_0xbb58('0xec')]=[{'all':!![]}];}return db[_0xbb58('0xaf')][_0xbb58('0x9a')](_0x3e21bf);})[_0xbb58('0x29')](function(_0x22c054){_0x4a82e7[_0xbb58('0x93')]=_0x22c054;return _0x4a82e7;});}})['then'](respondWithFilteredResult(_0x1f1219,_0x3e21bf))[_0xbb58('0x94')](handleError(_0x1f1219,null));};exports[_0xbb58('0xf0')]=function(_0x14a3f0,_0x2b63fb,_0x2b36c8){var _0x17a6ee={'raw':!![],'where':{}};var _0x5d8f94={};var _0x300084={'count':0x0,'rows':[]};return db[_0xbb58('0x31')][_0xbb58('0x38')]({'where':{'id':_0x14a3f0[_0xbb58('0x95')]['id']}})['then'](handleEntityNotFound(_0x2b63fb,null))[_0xbb58('0x29')](function(_0x1de5da){if(_0x1de5da){_0x5d8f94['model']=_[_0xbb58('0x32')](db[_0xbb58('0xb6')][_0xbb58('0xee')]);_0x5d8f94['query']=_[_0xbb58('0x32')](_0x14a3f0[_0xbb58('0x3c')]);_0x5d8f94[_0xbb58('0x3a')]=_[_0xbb58('0x3b')](_0x5d8f94[_0xbb58('0x3e')],_0x5d8f94[_0xbb58('0x3c')]);_0x17a6ee[_0xbb58('0x3d')]=_[_0xbb58('0x3b')](_0x5d8f94['model'],qs[_0xbb58('0x3f')](_0x14a3f0[_0xbb58('0x3c')][_0xbb58('0x3f')]));_0x17a6ee[_0xbb58('0x3d')]=_0x17a6ee[_0xbb58('0x3d')][_0xbb58('0x33')]?_0x17a6ee[_0xbb58('0x3d')]:_0x5d8f94[_0xbb58('0x3e')];if(!_0x14a3f0[_0xbb58('0x3c')][_0xbb58('0x64')](_0xbb58('0x40'))){_0x17a6ee[_0xbb58('0x20')]=qs[_0xbb58('0x20')](_0x14a3f0['query'][_0xbb58('0x20')]);_0x17a6ee[_0xbb58('0x1f')]=qs[_0xbb58('0x1f')](_0x14a3f0[_0xbb58('0x3c')]['offset']);}_0x17a6ee['order']=qs['sort'](_0x14a3f0[_0xbb58('0x3c')]['sort']);_0x17a6ee[_0xbb58('0x4f')]=qs[_0xbb58('0x3a')](_[_0xbb58('0x43')](_0x14a3f0['query'],_0x5d8f94[_0xbb58('0x3a')]));_0x17a6ee[_0xbb58('0x4f')][_0xbb58('0xe9')]=_0x1de5da['id'];if(_0x14a3f0[_0xbb58('0x3c')][_0xbb58('0x6e')]){_0x17a6ee[_0xbb58('0x4f')]=_[_0xbb58('0x9d')](_0x17a6ee[_0xbb58('0x4f')],{'$or':_[_0xbb58('0x63')](_0x17a6ee['attributes'],function(_0x28b7dc){var _0xd2e409={};_0xd2e409[_0x28b7dc]={'$like':'%'+_0x14a3f0[_0xbb58('0x3c')][_0xbb58('0x6e')]+'%'};return _0xd2e409;})});}_0x17a6ee=_['merge']({},_0x17a6ee,_0x14a3f0['options']);return db[_0xbb58('0xb6')][_0xbb58('0x22')]({'where':_0x17a6ee[_0xbb58('0x4f')]})['then'](function(_0x5f1c0b){_0x300084[_0xbb58('0x22')]=_0x5f1c0b;if(_0x14a3f0[_0xbb58('0x3c')][_0xbb58('0xeb')]){_0x17a6ee[_0xbb58('0xec')]=[{'all':!![]}];}return db[_0xbb58('0xb6')][_0xbb58('0x9a')](_0x17a6ee);})[_0xbb58('0x29')](function(_0x3b1ba0){_0x300084[_0xbb58('0x93')]=_0x3b1ba0;return _0x300084;});}})['then'](respondWithFilteredResult(_0x2b63fb,_0x17a6ee))[_0xbb58('0x94')](handleError(_0x2b63fb,null));};exports['uploadCsv']=function(_0x241f69,_0x186b0e,_0x14424f){try{if(!_0x241f69['body'][_0xbb58('0x67')]){throw new Error(_0xbb58('0xf1'));}if(!_0x241f69[_0xbb58('0x9e')]['binding_keys']){throw new Error(_0xbb58('0xf2'));}if(!_0x241f69[_0xbb58('0x9e')]['binding_values']){throw new Error(_0xbb58('0xf3'));}if(!_0x241f69[_0xbb58('0x9e')][_0xbb58('0xf4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x150089=_0x241f69[_0xbb58('0x9e')][_0xbb58('0xf5')][_0xbb58('0x57')](',');var _0x4fbad2=_0x241f69[_0xbb58('0x9e')]['binding_values'][_0xbb58('0x57')](',');if(!_0x150089['length']||!_0x4fbad2[_0xbb58('0x33')]||_0x150089[_0xbb58('0x33')]!==_0x4fbad2[_0xbb58('0x33')]){throw new Error(_0xbb58('0xf6'));}_0x241f69[_0xbb58('0x9e')][_0xbb58('0x3f')]=_[_0xbb58('0xf7')](_0x150089,_0x4fbad2);if(!_0x241f69[_0xbb58('0x9e')][_0xbb58('0x3f')][_0xbb58('0xd0')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x241f69[_0xbb58('0x9e')]['fields'][_0xbb58('0xf8')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x10410d=path[_0xbb58('0xf9')](config[_0xbb58('0xfa')],'server/files/tmp',_0x241f69[_0xbb58('0xfb')]['filename']);fs[_0xbb58('0xfc')](_0x10410d,parseInt('0777',0x8));var _0x4b0ebd=require(_0xbb58('0xfd'))[_0xbb58('0xfe')](path[_0xbb58('0xf9')](__dirname,_0xbb58('0xff')),[_0x10410d,_0x241f69[_0xbb58('0x9e')][_0xbb58('0xf5')],_0x241f69[_0xbb58('0x9e')][_0xbb58('0x100')],_0x241f69[_0xbb58('0x9e')]['ListId'],_0x241f69[_0xbb58('0x9e')]['CompanyId'],_0x241f69[_0xbb58('0x9e')]['duplicates'],_0x241f69[_0xbb58('0x9e')][_0xbb58('0xf4')]]);return _0x186b0e[_0xbb58('0x23')](0xc8)[_0xbb58('0x26')]({'message':_0xbb58('0x101'),'pid':_0x4b0ebd['pid']});}catch(_0x20f9dc){return _0x186b0e['status'](0x1f4)[_0xbb58('0x2f')](_0x20f9dc);}};exports['upload']=function(_0x25676a,_0x2b2ac6,_0x377578){var _0x463183=fs[_0xbb58('0x102')](_0x25676a['file']['path']);Papa[_0xbb58('0x103')](_0x463183,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x27c26e){return _0x2b2ac6[_0xbb58('0x23')](0xc8)['json']({'file':_0x25676a[_0xbb58('0xfb')],'fields':_0x27c26e[_0xbb58('0x104')][_0xbb58('0x3f')]});}});};exports[_0xbb58('0x105')]=function(_0x5efaef,_0x31abab,_0x1da3d1){return db[_0xbb58('0x82')][_0xbb58('0x9a')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbb58('0x80')}})[_0xbb58('0x29')](function(_0x31f7d7){var _0x145945=![];if(!_0x5efaef['body'][_0xbb58('0x67')]){throw new Error(_0xbb58('0xf1'));}if(!_0x5efaef[_0xbb58('0x9e')]['binding']['phone']){throw new Error(_0xbb58('0x106'));}if(!_0x5efaef[_0xbb58('0x9e')][_0xbb58('0x107')][_0xbb58('0xf8')]){throw new Error(_0xbb58('0x108'));}if(!_0x5efaef[_0xbb58('0x9e')][_0xbb58('0xf4')]){throw new Error(_0xbb58('0x109'));}var _0x1347c1=require(_0xbb58('0xfd'))[_0xbb58('0xfe')](path[_0xbb58('0xf9')](__dirname,'../../components/import/cm/csv2'),[_0x5efaef[_0xbb58('0x95')]['id'],JSON[_0xbb58('0x10a')](_0x5efaef[_0xbb58('0x9e')]),JSON[_0xbb58('0x10a')](_0x31f7d7)]);_0x1347c1['on']('message',function(_0x523c43){_0x145945=!![];return _0x31abab[_0xbb58('0x23')](0xc8)[_0xbb58('0x26')]({'message':_0xbb58('0x10b'),'pid':_0x1347c1['pid']});});_0x1347c1['on'](_0xbb58('0x10c'),function(_0x36f0f0){if(_0x36f0f0&&!_0x145945){return _0x31abab[_0xbb58('0x23')](0x1f4)[_0xbb58('0x26')]({'message':_0xbb58('0x10d'),'pid':_0x1347c1[_0xbb58('0x10e')]});}});})[_0xbb58('0x94')](handleError(_0x31abab,null));};exports[_0xbb58('0x10f')]=function(_0x1e533c,_0x468674,_0x3a35d4){return db[_0xbb58('0x82')][_0xbb58('0x9a')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbb58('0x80')}})['then'](function(_0x21aa8b){var _0x156abc=![];if(!_0x1e533c[_0xbb58('0x9e')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x1e533c[_0xbb58('0x9e')][_0xbb58('0x107')][_0xbb58('0xd0')]){throw new Error(_0xbb58('0x106'));}if(!_0x1e533c[_0xbb58('0x9e')][_0xbb58('0x107')][_0xbb58('0xf8')]){throw new Error(_0xbb58('0x108'));}if(!_0x1e533c[_0xbb58('0x9e')][_0xbb58('0xf4')]){throw new Error(_0xbb58('0x109'));}var _0x23ff9a=require(_0xbb58('0xfd'))['fork'](path['join'](__dirname,_0xbb58('0x110')),[_0x1e533c[_0xbb58('0x95')]['id'],JSON[_0xbb58('0x10a')](_0x1e533c[_0xbb58('0x9e')]),JSON[_0xbb58('0x10a')](_0x21aa8b)]);_0x23ff9a['on'](_0xbb58('0x111'),function(_0x4d2169){_0x156abc=!![];return _0x468674[_0xbb58('0x23')](0xc8)[_0xbb58('0x26')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x23ff9a[_0xbb58('0x10e')]});});_0x23ff9a['on']('exit',function(_0x1091ce){if(_0x1091ce&&!_0x156abc){return _0x468674[_0xbb58('0x23')](0x1f4)[_0xbb58('0x26')]({'message':_0xbb58('0x10d'),'pid':_0x23ff9a[_0xbb58('0x10e')]});}});})['catch'](handleError(_0x468674,null));};exports[_0xbb58('0x112')]=function(_0x8701aa,_0xdfbe03){var _0x395182=[_0xbb58('0x113'),_0xbb58('0x114'),_0xbb58('0x115'),'openchannel',_0xbb58('0x116'),_0xbb58('0x117'),_0xbb58('0x118')];var _0xf9ec14={'offset':0x0,'order':qs[_0xbb58('0x42')]('-createdAt')},_0x103e21={'count':0x0,'rows':[]};Promise['resolve']()[_0xbb58('0x29')](function(){if(_0x8701aa[_0xbb58('0x3c')]['channel']){if(!_['includes'](_0x395182,_0x8701aa[_0xbb58('0x3c')][_0xbb58('0x119')][_0xbb58('0x11a')]())){throw new Error(_0xbb58('0x11b'));}_0x395182=[_0x8701aa['query'][_0xbb58('0x119')]['toLowerCase']()];}if(_0x8701aa['query'][_0xbb58('0x11c')]){try{var _0x2df3b4=JSON[_0xbb58('0x103')](_0x8701aa[_0xbb58('0x3c')][_0xbb58('0x11c')]);if(!moment(_0x2df3b4[_0xbb58('0x46')])[_0xbb58('0x11d')]()){throw new Error(_0xbb58('0x11e'));}if(!moment(_0x2df3b4['to'])[_0xbb58('0x11d')]()){throw new Error(_0xbb58('0x11f'));}}catch(_0x2ca1b4){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x8701aa[_0xbb58('0x3c')][_0xbb58('0x64')]('nolimit')){_0xf9ec14['limit']=qs['limit'](_0x8701aa['query'][_0xbb58('0x20')]||0xa);_0xf9ec14['offset']=qs['offset'](_0x8701aa[_0xbb58('0x3c')][_0xbb58('0x1f')]);}var _0x57c0b0=_0x395182[_0xbb58('0x63')](function(_0x11b57a){if(_0x11b57a==='voice'){var _0x191b6b={'attributes':['id','uniqueid','type','source',_0xbb58('0x120'),_0xbb58('0x121'),_0xbb58('0x122'),_0xbb58('0x123'),'duration',_0xbb58('0x124'),_0xbb58('0x125'),_0xbb58('0x126'),_0xbb58('0x127'),_0xbb58('0x128'),_0xbb58('0x129')],'where':{'ContactId':_0x8701aa[_0xbb58('0x95')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0xbb58('0x2e'),_0xbb58('0x12a'),_0xbb58('0x9b')]}],'order':[[_0xbb58('0x125'),_0xbb58('0x7b')]]};if(_0x8701aa[_0xbb58('0x3c')][_0xbb58('0x11c')]){_0x191b6b[_0xbb58('0x4f')][_0xbb58('0x125')]={'$gte':_0x2df3b4[_0xbb58('0x46')],'$lte':_0x2df3b4['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x191b6b)[_0xbb58('0x29')](function(_0x14dafd){_0x103e21['count']+=_0x14dafd['count'];return _[_0xbb58('0x63')](_0x14dafd['rows'],function(_0x4c8921){var _0x4db97f=_0x4c8921[_0xbb58('0x9f')]({'plain':!![]});_0x4db97f[_0xbb58('0x119')]=_0x11b57a;if(_0x4db97f[_0xbb58('0x82')]){_0x4db97f[_0xbb58('0x82')]={'id':_0x4db97f['User']['id'],'name':_0x4db97f[_0xbb58('0x82')][_0xbb58('0x2e')],'fullname':_0x4db97f['User'][_0xbb58('0x12a')],'alias':_0x4db97f[_0xbb58('0x82')][_0xbb58('0x9b')]};}return _0x4db97f;});});}else{var _0x566aee=_[_0xbb58('0x12b')](_0x11b57a)+(_0x11b57a==='chat'?_0xbb58('0x12c'):'Account');var _0x27b38c={'attributes':['id',_0xbb58('0x12d'),'closedAt',_0xbb58('0x125'),_0xbb58('0x124'),'disposition',_0xbb58('0x12e'),_0xbb58('0x12f'),'UserId',_0x566aee+'Id'],'where':{'ContactId':_0x8701aa['params']['id']},'include':[{'model':db[_0x566aee],'as':_0xbb58('0x130'),'attributes':['id','name','key']},{'model':db[_0xbb58('0x82')],'as':_0xbb58('0x131'),'attributes':['id',_0xbb58('0x2e'),_0xbb58('0x12a')]},{'model':db[_0xbb58('0x56')],'as':'Tags','attributes':['id',_0xbb58('0x2e'),_0xbb58('0x45')],'through':{'attributes':[]}}],'order':[[_0xbb58('0x125'),_0xbb58('0x7b')]]};if(_0x8701aa['query'][_0xbb58('0x11c')]){_0x27b38c[_0xbb58('0x4f')][_0xbb58('0x125')]={'$gte':_0x2df3b4[_0xbb58('0x46')],'$lte':_0x2df3b4['to']};}switch(_0x11b57a){case'chat':_0x27b38c[_0xbb58('0x3d')][_0xbb58('0x36')](_0xbb58('0x132'),_0xbb58('0x133'),'customerPort','deviceModel',_0xbb58('0x134'),_0xbb58('0x135'),_0xbb58('0x136'),_0xbb58('0x137'),_0xbb58('0x138'));break;case _0xbb58('0x113'):_0x27b38c['attributes']['push']('subject',_0xbb58('0x139'));break;case _0xbb58('0x13a'):_0x27b38c['attributes'][_0xbb58('0x36')]('externalUrl',_0xbb58('0x13b'));break;}return db[_[_0xbb58('0x12b')](_0x11b57a)+_0xbb58('0x13c')][_0xbb58('0x13d')](_0x27b38c)[_0xbb58('0x29')](function(_0x2aa4f3){_0x103e21['count']+=_0x2aa4f3[_0xbb58('0x22')];return _[_0xbb58('0x63')](_0x2aa4f3[_0xbb58('0x93')],function(_0x62c97f){var _0x354dca=_0x62c97f[_0xbb58('0x9f')]({'plain':!![]});_0x354dca[_0xbb58('0x119')]=_0x11b57a;if(_0x354dca[_0xbb58('0x131')]){_0x354dca['Owner']={'id':_0x354dca[_0xbb58('0x131')]['id'],'name':_0x354dca[_0xbb58('0x131')][_0xbb58('0x2e')],'fullname':_0x354dca[_0xbb58('0x131')][_0xbb58('0x12a')]};}return _0x354dca;});});}});return Promise[_0xbb58('0xd5')](_0x57c0b0);})[_0xbb58('0x29')](function(_0x38a6f5){return _(_0x38a6f5)[_0xbb58('0x13e')]()[_0xbb58('0x13f')](_0xbb58('0x125'))[_0xbb58('0x140')]()[_0xbb58('0x5b')]();})[_0xbb58('0x29')](function(_0x157301){_0x103e21['rows']=_0xf9ec14[_0xbb58('0x20')]?_0x157301['slice'](_0xf9ec14[_0xbb58('0x1f')],_0xf9ec14[_0xbb58('0x1f')]+_0xf9ec14['limit']):_0x157301;return _0x103e21;})[_0xbb58('0x29')](respondWithFilteredResult(_0xdfbe03,_0xf9ec14))['catch'](handleError(_0xdfbe03,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index a453351..16d45c9 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 _0xb260=['CmContact','setMaxListeners','save','update','emit','hook'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0xb260,0x1ce));var _0x0b26=function(_0x4d0aa7,_0xdbd3b8){_0x4d0aa7=_0x4d0aa7-0x0;var _0x49224b=_0xb260[_0x4d0aa7];return _0x49224b;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0x0b26('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x0b26('0x1')](0x0);var events={'afterCreate':_0x0b26('0x2'),'afterUpdate':_0x0b26('0x3'),'afterDestroy':'remove'};function emitEvent(_0x46bfd5){return function(_0x3089c6,_0x29d58c,_0x2f6093){CmContactEvents[_0x0b26('0x4')](_0x46bfd5+':'+_0x3089c6['id'],_0x3089c6);CmContactEvents[_0x0b26('0x4')](_0x46bfd5,_0x3089c6);_0x2f6093(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x0b26('0x5')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x4b96=['save','emit','hook','exports','events','CmContact','setMaxListeners'];(function(_0x1a2411,_0x2b1a04){var _0x2f5872=function(_0x25d8aa){while(--_0x25d8aa){_0x1a2411['push'](_0x1a2411['shift']());}};_0x2f5872(++_0x2b1a04);}(_0x4b96,0xa5));var _0x64b9=function(_0x334adf,_0x2325f3){_0x334adf=_0x334adf-0x0;var _0x3d6c9e=_0x4b96[_0x334adf];return _0x3d6c9e;};'use strict';var EventEmitter=require(_0x64b9('0x0'));var CmContact=require('../../mysqldb')['db'][_0x64b9('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x64b9('0x2')](0x0);var events={'afterCreate':_0x64b9('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45aa0b){return function(_0x2e0e86,_0x2d3f44,_0x2c3114){CmContactEvents[_0x64b9('0x4')](_0x45aa0b+':'+_0x2e0e86['id'],_0x2e0e86);CmContactEvents[_0x64b9('0x4')](_0x45aa0b,_0x2e0e86);_0x2c3114(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x64b9('0x5')](e,emitEvent(event));}}module[_0x64b9('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 134376e..0d5eabe 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 _0x2d7c=['fti_cm_contacts','firstName','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','inspect','CmHopper','findOne','then','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','findAll','outbound','Campaign','CmHopperBlack','cmContact,\x20%s,\x20%s','afterCreate','message','ContactId','push','all','info','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmContact.attributes','exports','CmContact','cm_contacts','phone'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0x2d7c,0x12d));var _0xc2d7=function(_0x22ed4b,_0x20609c){_0x22ed4b=_0x22ed4b-0x0;var _0x4e9cf6=_0x2d7c[_0x22ed4b];return _0x4e9cf6;};'use strict';var _=require(_0xc2d7('0x0'));var util=require(_0xc2d7('0x1'));var logger=require(_0xc2d7('0x2'))(_0xc2d7('0x3'));var moment=require(_0xc2d7('0x4'));var BPromise=require(_0xc2d7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2d7('0x6'));var rimraf=require(_0xc2d7('0x7'));var config=require(_0xc2d7('0x8'));var attributes=require(_0xc2d7('0x9'));module[_0xc2d7('0xa')]=function(_0x371d9b,_0x18be90){return _0x371d9b['define'](_0xc2d7('0xb'),attributes,{'tableName':_0xc2d7('0xc'),'paranoid':!![],'indexes':[{'name':_0xc2d7('0xd'),'fields':[_0xc2d7('0xd')]},{'name':_0xc2d7('0xe'),'fields':[_0xc2d7('0xf'),'lastName',_0xc2d7('0xd'),'mobile','fax',_0xc2d7('0x10')],'type':_0xc2d7('0x11')}],'timestamps':!![],'charset':_0xc2d7('0x12'),'collate':_0xc2d7('0x13'),'hooks':{'afterCreate':function(_0x232d51,_0x4fed96,_0xf78e56){var _0x18cb30=_0x371d9b['models'];var _0xc4668f=_0x232d51[_0xc2d7('0x14')]({'plain':!![]});function _0x30f13c(){return function(_0x60d315){logger[_0xc2d7('0x15')](_0xc2d7('0x16'),'afterCreate',util[_0xc2d7('0x17')](_0x60d315,{'showHidden':![],'depth':null}));};}var _0x2cb2d4=function(_0x3d5599){return new BPromise(function(_0x35ee16,_0x39c85b){_0x18cb30[_0xc2d7('0x18')][_0xc2d7('0x19')]({'where':{'phone':_0xc4668f[_0xc2d7('0xd')],'VoiceQueueId':_0x3d5599['id']}})[_0xc2d7('0x1a')](function(_0x218e75){if(!_[_0xc2d7('0x1b')](_0x218e75)){throw new Error(_0xc2d7('0x1c')+_0xc4668f[_0xc2d7('0xd')]+_0xc2d7('0x1d')+_0x3d5599['id']);}return _0x18cb30[_0xc2d7('0x18')][_0xc2d7('0x1e')]({'phone':_0xc4668f['phone'],'ContactId':_0xc4668f['id'],'ListId':_0xc4668f['ListId'],'priority':_0xc4668f[_0xc2d7('0x1f')]?_0xc4668f['priority']:0x2,'scheduledat':_0xc4668f['scheduledat']?_0xc4668f[_0xc2d7('0x20')]:moment()[_0xc2d7('0x21')](_0xc2d7('0x22')),'callback':_0xc4668f[_0xc2d7('0x23')]?!![]:![],'callbackuniqueid':_0xc4668f[_0xc2d7('0x23')]?_0xc4668f[_0xc2d7('0x23')]:undefined,'callbackat':_0xc4668f['callbackUniqueid']?moment()[_0xc2d7('0x21')](_0xc2d7('0x22')):undefined,'VoiceQueueId':_0x3d5599['id']});})[_0xc2d7('0x24')](function(_0x20e955){_0x39c85b(_0x20e955);});});};var _0x5ea661=function(_0x46a851){return new BPromise(function(_0x120ae3,_0x215e2c){_0x18cb30[_0xc2d7('0x18')][_0xc2d7('0x19')]({'where':{'phone':_0xc4668f['phone'],'VoiceQueueId':_0x46a851['id']}})['then'](function(_0x3d1833){if(!_[_0xc2d7('0x1b')](_0x3d1833)){throw new Error(_0xc2d7('0x1c')+_0xc4668f['phone']+_0xc2d7('0x25')+_0x46a851['id']);}return _0x18cb30[_0xc2d7('0x26')]['findOne']({'where':{'calleridnum':_0xc4668f[_0xc2d7('0xd')],'VoiceQueueId':_0x46a851['id']}});})[_0xc2d7('0x1a')](function(_0x35544f){if(!_[_0xc2d7('0x1b')](_0x35544f)){throw new Error('cmContact,\x20afterCreate,\x20'+_0xc4668f[_0xc2d7('0xd')]+_0xc2d7('0x27')+_0x46a851['id']);}return _0x18cb30[_0xc2d7('0x18')][_0xc2d7('0x1e')]({'phone':_0xc4668f[_0xc2d7('0xd')],'ContactId':_0xc4668f['id'],'ListId':_0xc4668f[_0xc2d7('0x28')],'priority':_0xc4668f[_0xc2d7('0x1f')]?_0xc4668f['priority']:0x2,'scheduledat':_0xc4668f[_0xc2d7('0x20')]?_0xc4668f['scheduledat']:moment()[_0xc2d7('0x21')](_0xc2d7('0x22')),'callback':_0xc4668f[_0xc2d7('0x23')]?!![]:![],'callbackuniqueid':_0xc4668f[_0xc2d7('0x23')]?_0xc4668f[_0xc2d7('0x23')]:undefined,'callbackat':_0xc4668f[_0xc2d7('0x23')]?moment()[_0xc2d7('0x21')](_0xc2d7('0x22')):undefined,'VoiceQueueId':_0x46a851['id']});})[_0xc2d7('0x24')](function(_0x35fb32){_0x215e2c(_0x35fb32);});});};function _0x230692(){return function(_0x3a1286){logger[_0xc2d7('0x15')]('cmContact','afterCreate',util[_0xc2d7('0x17')](_0x3a1286,{'showHidden':![],'depth':null}));};}var _0x3a3ac8=function(_0x50a055){return new BPromise(function(_0x2f328e,_0x2ecaec){_0x18cb30[_0xc2d7('0x18')][_0xc2d7('0x19')]({'where':{'phone':_0xc4668f[_0xc2d7('0xd')],'CampaignId':_0x50a055['id']}})[_0xc2d7('0x1a')](function(_0x50259b){if(!_['isNil'](_0x50259b)){throw new Error(_0xc2d7('0x1c')+_0xc4668f[_0xc2d7('0xd')]+_0xc2d7('0x29')+_0x50a055['id']);}return _0x18cb30[_0xc2d7('0x18')][_0xc2d7('0x1e')]({'phone':_0xc4668f[_0xc2d7('0xd')],'ContactId':_0xc4668f['id'],'ListId':_0xc4668f['ListId'],'priority':_0xc4668f['priority']?_0xc4668f[_0xc2d7('0x1f')]:0x2,'scheduledat':_0xc4668f[_0xc2d7('0x20')]?_0xc4668f[_0xc2d7('0x20')]:moment()[_0xc2d7('0x21')](_0xc2d7('0x22')),'callback':_0xc4668f[_0xc2d7('0x23')]?!![]:![],'callbackuniqueid':_0xc4668f[_0xc2d7('0x23')]?_0xc4668f['callbackUniqueid']:undefined,'callbackat':_0xc4668f['callbackUniqueid']?moment()[_0xc2d7('0x21')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x50a055['id']});})[_0xc2d7('0x24')](function(_0xe20a71){_0x2ecaec(_0xe20a71);});});};var _0x5134d4=function(_0x136927){return new BPromise(function(_0x1d6ac3,_0x140668){_0x18cb30[_0xc2d7('0x18')][_0xc2d7('0x19')]({'where':{'phone':_0xc4668f['phone'],'CampaignId':_0x136927['id']}})[_0xc2d7('0x1a')](function(_0x2a9952){if(!_['isNil'](_0x2a9952)){throw new Error(_0xc2d7('0x1c')+_0xc4668f[_0xc2d7('0xd')]+_0xc2d7('0x2a')+_0x136927['id']);}return _0x18cb30[_0xc2d7('0x26')][_0xc2d7('0x19')]({'where':{'calleridnum':_0xc4668f[_0xc2d7('0xd')],'CampaignId':_0x136927['id']}});})[_0xc2d7('0x1a')](function(_0x5cb90e){if(!_[_0xc2d7('0x1b')](_0x5cb90e)){throw new Error(_0xc2d7('0x2b')+_0xc4668f[_0xc2d7('0xd')]+_0xc2d7('0x2c')+_0x136927['id']);}return _0x18cb30['CmHopper'][_0xc2d7('0x1e')]({'phone':_0xc4668f[_0xc2d7('0xd')],'ContactId':_0xc4668f['id'],'ListId':_0xc4668f[_0xc2d7('0x28')],'priority':_0xc4668f[_0xc2d7('0x1f')]?_0xc4668f[_0xc2d7('0x1f')]:0x2,'scheduledat':_0xc4668f[_0xc2d7('0x20')]?_0xc4668f['scheduledat']:moment()[_0xc2d7('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xc4668f[_0xc2d7('0x23')]?!![]:![],'callbackuniqueid':_0xc4668f['callbackUniqueid']?_0xc4668f[_0xc2d7('0x23')]:undefined,'callbackat':_0xc4668f[_0xc2d7('0x23')]?moment()[_0xc2d7('0x21')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x136927['id']});})['catch'](function(_0x3fb28b){_0x140668(_0x3fb28b);});});};if(_0xc4668f[_0xc2d7('0x28')]){_0x18cb30[_0xc2d7('0x2d')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0xc2d7('0x2e')],'include':[{'model':_0x18cb30[_0xc2d7('0x2f')],'as':_0xc2d7('0x30'),'where':{'id':_0xc4668f[_0xc2d7('0x28')]}}]})[_0xc2d7('0x1a')](function(_0x34e9b5){if(_0x34e9b5){var _0x114a55=[];for(var _0x3cdfe3=0x0,_0x4c2d20;_0x3cdfe3<_0x34e9b5[_0xc2d7('0x31')];_0x3cdfe3+=0x1){_0x4c2d20=_0x34e9b5[_0x3cdfe3][_0xc2d7('0x14')]({'plain':!![]});switch(_0x4c2d20[_0xc2d7('0x2e')]){case _0xc2d7('0x32'):_0x5ea661(_0x4c2d20)[_0xc2d7('0x24')](_0x30f13c());break;case _0xc2d7('0x33'):_0x2cb2d4(_0x4c2d20)[_0xc2d7('0x24')](_0x30f13c());break;default:_0x18cb30[_0xc2d7('0x18')][_0xc2d7('0x1e')]({'phone':_0xc4668f['phone'],'ContactId':_0xc4668f['id'],'ListId':_0xc4668f[_0xc2d7('0x28')],'scheduledat':_0xc4668f[_0xc2d7('0x20')]?_0xc4668f[_0xc2d7('0x20')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xc4668f[_0xc2d7('0x1f')]?_0xc4668f[_0xc2d7('0x1f')]:0x2,'callback':_0xc4668f[_0xc2d7('0x23')]?!![]:![],'callbackuniqueid':_0xc4668f[_0xc2d7('0x23')]?_0xc4668f[_0xc2d7('0x23')]:undefined,'callbackat':_0xc4668f[_0xc2d7('0x23')]?moment()[_0xc2d7('0x21')](_0xc2d7('0x22')):undefined,'VoiceQueueId':_0x4c2d20['id']})[_0xc2d7('0x24')](_0x30f13c());}}}})[_0xc2d7('0x1a')](function(){return _0x18cb30[_0xc2d7('0x2d')][_0xc2d7('0x34')]({'where':{'type':_0xc2d7('0x35')},'attributes':['id'],'include':[{'model':_0x18cb30[_0xc2d7('0x2f')],'as':'BlackLists','where':{'id':_0xc4668f[_0xc2d7('0x28')]}}]})[_0xc2d7('0x1a')](function(_0x4ac8a4){if(_0x4ac8a4){var _0xbf2eac=[];for(var _0x15da41=0x0,_0x47e0e1;_0x15da41<_0x4ac8a4[_0xc2d7('0x31')];_0x15da41+=0x1){_0x47e0e1=_0x4ac8a4[_0x15da41][_0xc2d7('0x14')]({'plain':!![]});_0x18cb30['CmHopperBlack'][_0xc2d7('0x1e')]({'phone':_0xc4668f['phone'],'ContactId':_0xc4668f['id'],'ListId':_0xc4668f[_0xc2d7('0x28')],'VoiceQueueId':_0x47e0e1['id']})[_0xc2d7('0x24')](function(_0x536985){logger[_0xc2d7('0x15')]('cmContact,\x20%s,\x20%s','afterCreate',_0x536985['message']);});}}});})[_0xc2d7('0x1a')](function(){return _0x18cb30[_0xc2d7('0x36')][_0xc2d7('0x34')]({'attributes':['id',_0xc2d7('0x2e')],'include':[{'model':_0x18cb30[_0xc2d7('0x2f')],'as':_0xc2d7('0x30'),'where':{'id':_0xc4668f[_0xc2d7('0x28')]}}]})[_0xc2d7('0x1a')](function(_0x168640){if(_0x168640){var _0x17c328=[];for(var _0x3c95a9=0x0,_0x572b88;_0x3c95a9<_0x168640['length'];_0x3c95a9+=0x1){_0x572b88=_0x168640[_0x3c95a9][_0xc2d7('0x14')]({'plain':!![]});switch(_0x572b88[_0xc2d7('0x2e')]){case _0xc2d7('0x32'):_0x5134d4(_0x572b88)[_0xc2d7('0x24')](_0x230692());break;case _0xc2d7('0x33'):_0x3a3ac8(_0x572b88)['catch'](_0x230692());break;default:_0x18cb30[_0xc2d7('0x18')][_0xc2d7('0x1e')]({'phone':_0xc4668f[_0xc2d7('0xd')],'ContactId':_0xc4668f['id'],'ListId':_0xc4668f[_0xc2d7('0x28')],'scheduledat':_0xc4668f['scheduledat']?_0xc4668f[_0xc2d7('0x20')]:moment()[_0xc2d7('0x21')](_0xc2d7('0x22')),'priority':_0xc4668f[_0xc2d7('0x1f')]?_0xc4668f['priority']:0x2,'callback':_0xc4668f[_0xc2d7('0x23')]?!![]:![],'callbackuniqueid':_0xc4668f[_0xc2d7('0x23')]?_0xc4668f[_0xc2d7('0x23')]:undefined,'callbackat':_0xc4668f[_0xc2d7('0x23')]?moment()[_0xc2d7('0x21')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x572b88['id']})[_0xc2d7('0x24')](_0x230692());}}}});})[_0xc2d7('0x1a')](function(){return _0x18cb30[_0xc2d7('0x36')][_0xc2d7('0x34')]({'attributes':['id'],'include':[{'model':_0x18cb30[_0xc2d7('0x2f')],'as':'BlackLists','where':{'id':_0xc4668f[_0xc2d7('0x28')]}}]})[_0xc2d7('0x1a')](function(_0x72c33f){if(_0x72c33f){var _0x167158=[];for(var _0x53a1b0=0x0,_0x3376e7;_0x53a1b0<_0x72c33f[_0xc2d7('0x31')];_0x53a1b0+=0x1){_0x3376e7=_0x72c33f[_0x53a1b0]['get']({'plain':!![]});_0x18cb30[_0xc2d7('0x37')][_0xc2d7('0x1e')]({'phone':_0xc4668f[_0xc2d7('0xd')],'ContactId':_0xc4668f['id'],'ListId':_0xc4668f[_0xc2d7('0x28')],'CampaignId':_0x3376e7['id']})[_0xc2d7('0x24')](function(_0xffb140){logger[_0xc2d7('0x15')](_0xc2d7('0x38'),_0xc2d7('0x39'),_0xffb140['message']);});}}});})[_0xc2d7('0x1a')](function(){_0xf78e56();})[_0xc2d7('0x24')](function(_0x3b5ec8){logger['error'](_0xc2d7('0x38'),_0xc2d7('0x39'),_0x3b5ec8[_0xc2d7('0x3a')]);_0xf78e56(_0x3b5ec8);});}else{_0xf78e56(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x11c118,_0x2b4682,_0x4357b2){var _0x4e905c=_0x371d9b['models'];var _0xc02c81=_0x11c118[_0xc2d7('0x14')]({'plain':!![]});return _0x4e905c[_0xc2d7('0x18')]['findAll']({'raw':!![],'where':{'ListId':_0xc02c81[_0xc2d7('0x28')],'ContactId':_0xc02c81['id']}})[_0xc2d7('0x1a')](function(_0x39f3b6){if(!_['isEmpty'](_0x39f3b6)){var _0x1718bb=[];for(var _0x1d43b4=0x0;_0x1d43b4<_0x39f3b6[_0xc2d7('0x31')];_0x1d43b4+=0x1){var _0x2a7809=_0x4e905c[_0xc2d7('0x18')]['destroy']({'where':{'ListId':_0x39f3b6[_0x1d43b4][_0xc2d7('0x28')],'ContactId':_0x39f3b6[_0x1d43b4][_0xc2d7('0x3b')],'VoiceQueueId':_0x39f3b6[_0x1d43b4]['VoiceQueueId'],'CampaignId':_0x39f3b6[_0x1d43b4]['CampaignId']}});_0x1718bb[_0xc2d7('0x3c')](_0x2a7809);}return BPromise[_0xc2d7('0x3d')](_0x1718bb);}})[_0xc2d7('0x1a')](function(_0x5364d8){logger[_0xc2d7('0x3e')]('[CmContact][afterDestroy][Succesfull]',util[_0xc2d7('0x17')](_0x5364d8,{'showHidden':![],'depth':null}));_0x4357b2();})[_0xc2d7('0x24')](function(_0x1e95e5){logger[_0xc2d7('0x15')]('[CmContact][afterDestroy][Error]',util[_0xc2d7('0x17')](_0x1e95e5,{'showHidden':![],'depth':null}));_0x4357b2(_0x1e95e5);});}}});}; \ No newline at end of file +var _0xa8c7=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','afterCreate','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','outbound','CmList','Lists','length','get','dialCheckDuplicateType','always','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','findAll','onlyIfOpen','List\x20not\x20found','isEmpty','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','api','moment','request-promise','rimraf','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','error','cmContact','inspect','CmHopper','findOne','then','cmContact,\x20afterCreate\x20','create','ListId','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','isNil'];(function(_0x55b5e4,_0x3a5c4a){var _0x25257e=function(_0x37a6b8){while(--_0x37a6b8){_0x55b5e4['push'](_0x55b5e4['shift']());}};_0x25257e(++_0x3a5c4a);}(_0xa8c7,0x1a3));var _0x7a8c=function(_0x970aec,_0x1815c1){_0x970aec=_0x970aec-0x0;var _0x48cffa=_0xa8c7[_0x970aec];return _0x48cffa;};'use strict';var _=require('lodash');var util=require(_0x7a8c('0x0'));var logger=require('../../config/logger')(_0x7a8c('0x1'));var moment=require(_0x7a8c('0x2'));var BPromise=require('bluebird');var rp=require(_0x7a8c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a8c('0x4'));var config=require('../../config/environment');var attributes=require(_0x7a8c('0x5'));module[_0x7a8c('0x6')]=function(_0x661ee7,_0x2296cd){return _0x661ee7[_0x7a8c('0x7')](_0x7a8c('0x8'),attributes,{'tableName':_0x7a8c('0x9'),'paranoid':!![],'indexes':[{'name':_0x7a8c('0xa'),'fields':['phone']},{'name':_0x7a8c('0xb'),'fields':[_0x7a8c('0xc'),_0x7a8c('0xd'),_0x7a8c('0xa'),_0x7a8c('0xe'),_0x7a8c('0xf'),_0x7a8c('0x10')],'type':_0x7a8c('0x11')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x7a8c('0x12'),'hooks':{'afterCreate':function(_0x3a10d1,_0x5c7e58,_0x313717){var _0x5a760d=_0x661ee7[_0x7a8c('0x13')];var _0x27220d=_0x3a10d1['get']({'plain':!![]});function _0x1d5961(){return function(_0x17c012){logger[_0x7a8c('0x14')](_0x7a8c('0x15'),'afterCreate',util[_0x7a8c('0x16')](_0x17c012,{'showHidden':![],'depth':null}));};}var _0x413e78=function(_0x4f5e65){return new BPromise(function(_0x5d379b,_0x575d45){_0x5a760d[_0x7a8c('0x17')][_0x7a8c('0x18')]({'where':{'phone':_0x27220d[_0x7a8c('0xa')],'VoiceQueueId':_0x4f5e65['id']}})[_0x7a8c('0x19')](function(_0x5d240e){if(!_['isNil'](_0x5d240e)){throw new Error(_0x7a8c('0x1a')+_0x27220d[_0x7a8c('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x4f5e65['id']);}return _0x5a760d[_0x7a8c('0x17')][_0x7a8c('0x1b')]({'phone':_0x27220d[_0x7a8c('0xa')],'ContactId':_0x27220d['id'],'ListId':_0x27220d[_0x7a8c('0x1c')],'priority':_0x27220d[_0x7a8c('0x1d')]?_0x27220d[_0x7a8c('0x1d')]:0x2,'scheduledat':_0x27220d[_0x7a8c('0x1e')]?_0x27220d[_0x7a8c('0x1e')]:moment()[_0x7a8c('0x1f')](_0x7a8c('0x20')),'callback':_0x27220d[_0x7a8c('0x21')]?!![]:![],'callbackuniqueid':_0x27220d[_0x7a8c('0x21')]?_0x27220d[_0x7a8c('0x21')]:undefined,'callbackat':_0x27220d[_0x7a8c('0x21')]?moment()[_0x7a8c('0x1f')](_0x7a8c('0x20')):undefined,'VoiceQueueId':_0x4f5e65['id']});})[_0x7a8c('0x22')](function(_0x3f2338){_0x575d45(_0x3f2338);});});};var _0x50a881=function(_0x1153a0){return new BPromise(function(_0x5080c4,_0x153031){_0x5a760d[_0x7a8c('0x17')][_0x7a8c('0x18')]({'where':{'phone':_0x27220d[_0x7a8c('0xa')],'VoiceQueueId':_0x1153a0['id']}})[_0x7a8c('0x19')](function(_0x932beb){if(!_[_0x7a8c('0x23')](_0x932beb)){throw new Error('cmContact,\x20afterCreate\x20'+_0x27220d['phone']+_0x7a8c('0x24')+_0x1153a0['id']);}return _0x5a760d[_0x7a8c('0x25')][_0x7a8c('0x18')]({'where':{'calleridnum':_0x27220d[_0x7a8c('0xa')],'VoiceQueueId':_0x1153a0['id']}});})[_0x7a8c('0x19')](function(_0x1ac7b2){if(!_['isNil'](_0x1ac7b2)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x27220d[_0x7a8c('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x1153a0['id']);}return _0x5a760d[_0x7a8c('0x17')][_0x7a8c('0x1b')]({'phone':_0x27220d[_0x7a8c('0xa')],'ContactId':_0x27220d['id'],'ListId':_0x27220d[_0x7a8c('0x1c')],'priority':_0x27220d[_0x7a8c('0x1d')]?_0x27220d[_0x7a8c('0x1d')]:0x2,'scheduledat':_0x27220d[_0x7a8c('0x1e')]?_0x27220d[_0x7a8c('0x1e')]:moment()[_0x7a8c('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x27220d[_0x7a8c('0x21')]?!![]:![],'callbackuniqueid':_0x27220d[_0x7a8c('0x21')]?_0x27220d[_0x7a8c('0x21')]:undefined,'callbackat':_0x27220d[_0x7a8c('0x21')]?moment()[_0x7a8c('0x1f')](_0x7a8c('0x20')):undefined,'VoiceQueueId':_0x1153a0['id']});})[_0x7a8c('0x22')](function(_0x18843e){_0x153031(_0x18843e);});});};function _0x2c6f95(){return function(_0x38e41c){logger[_0x7a8c('0x14')](_0x7a8c('0x15'),_0x7a8c('0x26'),util[_0x7a8c('0x16')](_0x38e41c,{'showHidden':![],'depth':null}));};}var _0x34c69c=function(_0x3565a4){return new BPromise(function(_0x472351,_0x5b5c87){_0x5a760d['CmHopper'][_0x7a8c('0x18')]({'where':{'phone':_0x27220d['phone'],'CampaignId':_0x3565a4['id']}})[_0x7a8c('0x19')](function(_0x128948){if(!_[_0x7a8c('0x23')](_0x128948)){throw new Error(_0x7a8c('0x1a')+_0x27220d[_0x7a8c('0xa')]+_0x7a8c('0x27')+_0x3565a4['id']);}return _0x5a760d[_0x7a8c('0x17')][_0x7a8c('0x1b')]({'phone':_0x27220d[_0x7a8c('0xa')],'ContactId':_0x27220d['id'],'ListId':_0x27220d[_0x7a8c('0x1c')],'priority':_0x27220d['priority']?_0x27220d[_0x7a8c('0x1d')]:0x2,'scheduledat':_0x27220d[_0x7a8c('0x1e')]?_0x27220d['scheduledat']:moment()[_0x7a8c('0x1f')](_0x7a8c('0x20')),'callback':_0x27220d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x27220d[_0x7a8c('0x21')]?_0x27220d[_0x7a8c('0x21')]:undefined,'callbackat':_0x27220d['callbackUniqueid']?moment()[_0x7a8c('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3565a4['id']});})[_0x7a8c('0x22')](function(_0x51f512){_0x5b5c87(_0x51f512);});});};var _0x15ebbe=function(_0x428cee){return new BPromise(function(_0x22716a,_0xb289fc){_0x5a760d[_0x7a8c('0x17')][_0x7a8c('0x18')]({'where':{'phone':_0x27220d[_0x7a8c('0xa')],'CampaignId':_0x428cee['id']}})[_0x7a8c('0x19')](function(_0x1f6e2e){if(!_[_0x7a8c('0x23')](_0x1f6e2e)){throw new Error(_0x7a8c('0x1a')+_0x27220d[_0x7a8c('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x428cee['id']);}return _0x5a760d[_0x7a8c('0x25')][_0x7a8c('0x18')]({'where':{'calleridnum':_0x27220d[_0x7a8c('0xa')],'CampaignId':_0x428cee['id']}});})[_0x7a8c('0x19')](function(_0x5ee6be){if(!_['isNil'](_0x5ee6be)){throw new Error(_0x7a8c('0x28')+_0x27220d[_0x7a8c('0xa')]+_0x7a8c('0x29')+_0x428cee['id']);}return _0x5a760d[_0x7a8c('0x17')][_0x7a8c('0x1b')]({'phone':_0x27220d['phone'],'ContactId':_0x27220d['id'],'ListId':_0x27220d[_0x7a8c('0x1c')],'priority':_0x27220d['priority']?_0x27220d[_0x7a8c('0x1d')]:0x2,'scheduledat':_0x27220d[_0x7a8c('0x1e')]?_0x27220d['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x27220d[_0x7a8c('0x21')]?!![]:![],'callbackuniqueid':_0x27220d[_0x7a8c('0x21')]?_0x27220d[_0x7a8c('0x21')]:undefined,'callbackat':_0x27220d[_0x7a8c('0x21')]?moment()['format'](_0x7a8c('0x20')):undefined,'CampaignId':_0x428cee['id']});})[_0x7a8c('0x22')](function(_0x21674c){_0xb289fc(_0x21674c);});});};if(_0x27220d[_0x7a8c('0x1c')]){_0x5a760d[_0x7a8c('0x2a')]['findAll']({'where':{'type':_0x7a8c('0x2b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x5a760d[_0x7a8c('0x2c')],'as':_0x7a8c('0x2d'),'where':{'id':_0x27220d[_0x7a8c('0x1c')]}}]})[_0x7a8c('0x19')](function(_0x247fa1){if(_0x247fa1){var _0xfd5571=[];for(var _0x13e390=0x0,_0x1830a5;_0x13e390<_0x247fa1[_0x7a8c('0x2e')];_0x13e390+=0x1){_0x1830a5=_0x247fa1[_0x13e390][_0x7a8c('0x2f')]({'plain':!![]});switch(_0x1830a5[_0x7a8c('0x30')]){case _0x7a8c('0x31'):_0x50a881(_0x1830a5)[_0x7a8c('0x22')](_0x1d5961());break;case'onlyIfOpen':_0x413e78(_0x1830a5)[_0x7a8c('0x22')](_0x1d5961());break;default:_0x5a760d[_0x7a8c('0x17')][_0x7a8c('0x1b')]({'phone':_0x27220d[_0x7a8c('0xa')],'ContactId':_0x27220d['id'],'ListId':_0x27220d[_0x7a8c('0x1c')],'scheduledat':_0x27220d['scheduledat']?_0x27220d[_0x7a8c('0x1e')]:moment()[_0x7a8c('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x27220d[_0x7a8c('0x1d')]?_0x27220d[_0x7a8c('0x1d')]:0x2,'callback':_0x27220d[_0x7a8c('0x21')]?!![]:![],'callbackuniqueid':_0x27220d[_0x7a8c('0x21')]?_0x27220d[_0x7a8c('0x21')]:undefined,'callbackat':_0x27220d[_0x7a8c('0x21')]?moment()[_0x7a8c('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1830a5['id']})[_0x7a8c('0x22')](_0x1d5961());}}}})['then'](function(){return _0x5a760d[_0x7a8c('0x2a')]['findAll']({'where':{'type':_0x7a8c('0x2b')},'attributes':['id'],'include':[{'model':_0x5a760d[_0x7a8c('0x2c')],'as':_0x7a8c('0x32'),'where':{'id':_0x27220d[_0x7a8c('0x1c')]}}]})[_0x7a8c('0x19')](function(_0x1dca93){if(_0x1dca93){var _0x511f2b=[];for(var _0x57518d=0x0,_0x1c34c6;_0x57518d<_0x1dca93[_0x7a8c('0x2e')];_0x57518d+=0x1){_0x1c34c6=_0x1dca93[_0x57518d]['get']({'plain':!![]});_0x5a760d[_0x7a8c('0x33')][_0x7a8c('0x1b')]({'phone':_0x27220d[_0x7a8c('0xa')],'ContactId':_0x27220d['id'],'ListId':_0x27220d[_0x7a8c('0x1c')],'VoiceQueueId':_0x1c34c6['id']})[_0x7a8c('0x22')](function(_0xa68b38){logger['error'](_0x7a8c('0x34'),_0x7a8c('0x26'),_0xa68b38[_0x7a8c('0x35')]);});}}});})['then'](function(){return _0x5a760d[_0x7a8c('0x36')][_0x7a8c('0x37')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x5a760d[_0x7a8c('0x2c')],'as':_0x7a8c('0x2d'),'where':{'id':_0x27220d['ListId']}}]})[_0x7a8c('0x19')](function(_0x1a319c){if(_0x1a319c){var _0x5c0edd=[];for(var _0x113973=0x0,_0x4a9ad9;_0x113973<_0x1a319c['length'];_0x113973+=0x1){_0x4a9ad9=_0x1a319c[_0x113973][_0x7a8c('0x2f')]({'plain':!![]});switch(_0x4a9ad9['dialCheckDuplicateType']){case _0x7a8c('0x31'):_0x15ebbe(_0x4a9ad9)[_0x7a8c('0x22')](_0x2c6f95());break;case _0x7a8c('0x38'):_0x34c69c(_0x4a9ad9)['catch'](_0x2c6f95());break;default:_0x5a760d['CmHopper'][_0x7a8c('0x1b')]({'phone':_0x27220d[_0x7a8c('0xa')],'ContactId':_0x27220d['id'],'ListId':_0x27220d[_0x7a8c('0x1c')],'scheduledat':_0x27220d[_0x7a8c('0x1e')]?_0x27220d[_0x7a8c('0x1e')]:moment()['format'](_0x7a8c('0x20')),'priority':_0x27220d[_0x7a8c('0x1d')]?_0x27220d[_0x7a8c('0x1d')]:0x2,'callback':_0x27220d[_0x7a8c('0x21')]?!![]:![],'callbackuniqueid':_0x27220d['callbackUniqueid']?_0x27220d['callbackUniqueid']:undefined,'callbackat':_0x27220d[_0x7a8c('0x21')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4a9ad9['id']})[_0x7a8c('0x22')](_0x2c6f95());}}}});})[_0x7a8c('0x19')](function(){return _0x5a760d[_0x7a8c('0x36')][_0x7a8c('0x37')]({'attributes':['id'],'include':[{'model':_0x5a760d[_0x7a8c('0x2c')],'as':_0x7a8c('0x32'),'where':{'id':_0x27220d[_0x7a8c('0x1c')]}}]})[_0x7a8c('0x19')](function(_0x17d701){if(_0x17d701){var _0x27b881=[];for(var _0x390bcf=0x0,_0x57217a;_0x390bcf<_0x17d701['length'];_0x390bcf+=0x1){_0x57217a=_0x17d701[_0x390bcf][_0x7a8c('0x2f')]({'plain':!![]});_0x5a760d[_0x7a8c('0x33')][_0x7a8c('0x1b')]({'phone':_0x27220d[_0x7a8c('0xa')],'ContactId':_0x27220d['id'],'ListId':_0x27220d[_0x7a8c('0x1c')],'CampaignId':_0x57217a['id']})[_0x7a8c('0x22')](function(_0x2d5fbc){logger['error']('cmContact,\x20%s,\x20%s',_0x7a8c('0x26'),_0x2d5fbc[_0x7a8c('0x35')]);});}}});})[_0x7a8c('0x19')](function(){_0x313717();})[_0x7a8c('0x22')](function(_0x2c6094){logger[_0x7a8c('0x14')](_0x7a8c('0x34'),'afterCreate',_0x2c6094[_0x7a8c('0x35')]);_0x313717(_0x2c6094);});}else{_0x313717(new Error(_0x7a8c('0x39')));}},'afterDestroy':function(_0xf08afc,_0x3809a6,_0x200672){var _0x2aaf31=_0x661ee7['models'];var _0x52df1d=_0xf08afc[_0x7a8c('0x2f')]({'plain':!![]});return _0x2aaf31[_0x7a8c('0x17')][_0x7a8c('0x37')]({'raw':!![],'where':{'ListId':_0x52df1d[_0x7a8c('0x1c')],'ContactId':_0x52df1d['id']}})[_0x7a8c('0x19')](function(_0x3c3f02){if(!_[_0x7a8c('0x3a')](_0x3c3f02)){var _0x30007f=[];for(var _0x1b8d1d=0x0;_0x1b8d1d<_0x3c3f02[_0x7a8c('0x2e')];_0x1b8d1d+=0x1){var _0x14295f=_0x2aaf31[_0x7a8c('0x17')][_0x7a8c('0x3b')]({'where':{'ListId':_0x3c3f02[_0x1b8d1d][_0x7a8c('0x1c')],'ContactId':_0x3c3f02[_0x1b8d1d][_0x7a8c('0x3c')],'VoiceQueueId':_0x3c3f02[_0x1b8d1d]['VoiceQueueId'],'CampaignId':_0x3c3f02[_0x1b8d1d]['CampaignId']}});_0x30007f[_0x7a8c('0x3d')](_0x14295f);}return BPromise['all'](_0x30007f);}})[_0x7a8c('0x19')](function(_0x402d50){logger[_0x7a8c('0x3e')](_0x7a8c('0x3f'),util['inspect'](_0x402d50,{'showHidden':![],'depth':null}));_0x200672();})[_0x7a8c('0x22')](function(_0x5a81fe){logger[_0x7a8c('0x14')](_0x7a8c('0x40'),util[_0x7a8c('0x16')](_0x5a81fe,{'showHidden':![],'depth':null}));_0x200672(_0x5a81fe);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 6d5cf79..5ce9626 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 _0x6a1e=['info','request\x20sent','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContact,\x20%s,\x20%s','message','result','catch','CmContact','findAll','options','raw','where','attributes','limit','include','map','model','then','GetCmContact','CreateCmContact','create','body','keys','startsWith','cf_','toString','sequelize','query','lodash','util','randomstring','ioredis','squel','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6a1e,0x184));var _0xe6a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a1e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe6a1('0x0'));var util=require(_0xe6a1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe6a1('0x2'));var fs=require('fs');var Redis=require(_0xe6a1('0x3'));var squel=require(_0xe6a1('0x4'));var db=require(_0xe6a1('0x5'))['db'];var utils=require(_0xe6a1('0x6'));var logger=require(_0xe6a1('0x7'))(_0xe6a1('0x8'));var config=require(_0xe6a1('0x9'));var jayson=require(_0xe6a1('0xa'));var client=jayson[_0xe6a1('0xb')][_0xe6a1('0xc')]({'port':0x232a});config['redis']=_[_0xe6a1('0xd')](config[_0xe6a1('0xe')],{'host':_0xe6a1('0xf'),'port':0x18eb});var socket=require(_0xe6a1('0x10'))(new Redis(config[_0xe6a1('0xe')]));require(_0xe6a1('0x11'))[_0xe6a1('0x12')](socket);function respondWithRpcPromise(_0x25f9a9,_0x51b425,_0x2ae6ca){return new BPromise(function(_0x5dd90a,_0x282ed3){return client[_0xe6a1('0x13')](_0x25f9a9,_0x2ae6ca)['then'](function(_0x568d73){logger[_0xe6a1('0x14')]('CmContact,\x20%s,\x20%s',_0x51b425,_0xe6a1('0x15'));logger['debug'](_0xe6a1('0x16'),_0x51b425,_0xe6a1('0x15'),JSON[_0xe6a1('0x17')](_0x568d73));if(_0x568d73[_0xe6a1('0x18')]){if(_0x568d73[_0xe6a1('0x18')][_0xe6a1('0x19')]===0x1f4){logger[_0xe6a1('0x18')](_0xe6a1('0x1a'),_0x51b425,_0x568d73['error'][_0xe6a1('0x1b')]);return _0x282ed3(_0x568d73['error'][_0xe6a1('0x1b')]);}logger[_0xe6a1('0x18')](_0xe6a1('0x1a'),_0x51b425,_0x568d73['error'][_0xe6a1('0x1b')]);return _0x5dd90a(_0x568d73[_0xe6a1('0x18')][_0xe6a1('0x1b')]);}else{logger['info'](_0xe6a1('0x1a'),_0x51b425,_0xe6a1('0x15'));_0x5dd90a(_0x568d73[_0xe6a1('0x1c')]['message']);}})[_0xe6a1('0x1d')](function(_0x52e991){logger[_0xe6a1('0x18')](_0xe6a1('0x1a'),_0x51b425,_0x52e991);_0x282ed3(_0x52e991);});});}exports['GetCmContact']=function(_0x399d90){var _0xd15e2f=this;return new Promise(function(_0x4b9942,_0x459fab){return db[_0xe6a1('0x1e')][_0xe6a1('0x1f')]({'raw':_0x399d90['options']?_0x399d90[_0xe6a1('0x20')][_0xe6a1('0x21')]===undefined?!![]:![]:!![],'where':_0x399d90[_0xe6a1('0x20')]?_0x399d90['options'][_0xe6a1('0x22')]||null:null,'attributes':_0x399d90[_0xe6a1('0x20')]?_0x399d90[_0xe6a1('0x20')][_0xe6a1('0x23')]||null:null,'limit':_0x399d90[_0xe6a1('0x20')]?_0x399d90['options'][_0xe6a1('0x24')]||null:null,'include':_0x399d90[_0xe6a1('0x20')]?_0x399d90[_0xe6a1('0x20')][_0xe6a1('0x25')]?_[_0xe6a1('0x26')](_0x399d90[_0xe6a1('0x20')]['include'],function(_0x5644f5){return{'model':db[_0x5644f5[_0xe6a1('0x27')]],'as':_0x5644f5['as'],'attributes':_0x5644f5[_0xe6a1('0x23')],'include':_0x5644f5[_0xe6a1('0x25')]?_[_0xe6a1('0x26')](_0x5644f5[_0xe6a1('0x25')],function(_0x209dd5){return{'model':db[_0x209dd5[_0xe6a1('0x27')]],'as':_0x209dd5['as'],'attributes':_0x209dd5[_0xe6a1('0x23')],'include':_0x209dd5['include']?_[_0xe6a1('0x26')](_0x209dd5[_0xe6a1('0x25')],function(_0x5bf024){return{'model':db[_0x5bf024[_0xe6a1('0x27')]],'as':_0x5bf024['as'],'attributes':_0x5bf024['attributes']};}):[]};}):[]};}):[]:[]})[_0xe6a1('0x28')](function(_0x3a54b4){logger['info'](_0xe6a1('0x29'),_0x399d90);logger['debug'](_0xe6a1('0x29'),_0x399d90,JSON[_0xe6a1('0x17')](_0x3a54b4));_0x4b9942(_0x3a54b4);})['catch'](function(_0x435508){logger[_0xe6a1('0x18')]('GetCmContact',_0x435508['message'],_0x399d90);_0x459fab(_0xd15e2f[_0xe6a1('0x18')](0x1f4,_0x435508['message']));});});};exports[_0xe6a1('0x2a')]=function(_0x13303b){var _0x4576cb=this;return new Promise(function(_0x22098c,_0x148f49){return db[_0xe6a1('0x1e')][_0xe6a1('0x2b')](_0x13303b[_0xe6a1('0x2c')],{'raw':_0x13303b[_0xe6a1('0x20')]?_0x13303b[_0xe6a1('0x20')][_0xe6a1('0x21')]===undefined?!![]:![]:!![]})[_0xe6a1('0x28')](function(_0x2959a3){var _0x1ad6a2;for(var _0x765d6f=0x0;_0x765d6f{}\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(_0x2d1fd2,_0x415079){var _0x389c78=function(_0x2b0235){while(--_0x2b0235){_0x2d1fd2['push'](_0x2d1fd2['shift']());}};_0x389c78(++_0x415079);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 4497c82..383ab4f 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 _0x2821=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x46980e,_0x540f1a){var _0x984710=function(_0x4b02bf){while(--_0x4b02bf){_0x46980e['push'](_0x46980e['shift']());}};_0x984710(++_0x540f1a);}(_0x2821,0x87));var _0x1282=function(_0x31d494,_0x4e6a46){_0x31d494=_0x31d494-0x0;var _0x551248=_0x2821[_0x31d494];return _0x551248;};'use strict';var Sequelize=require(_0x1282('0x0'));module[_0x1282('0x1')]={'CmContactId':{'type':Sequelize[_0x1282('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1282('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1282('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x1282('0x3')],'defaultValue':_0x1282('0x4')},'OrderBy':{'type':Sequelize[_0x1282('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x1282('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x644a=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x2a9197,_0x5225eb){var _0x588c8a=function(_0x4698ee){while(--_0x4698ee){_0x2a9197['push'](_0x2a9197['shift']());}};_0x588c8a(++_0x5225eb);}(_0x644a,0xfd));var _0xa644=function(_0x437ea9,_0x55c4cd){_0x437ea9=_0x437ea9-0x0;var _0x5c04b4=_0x644a[_0x437ea9];return _0x5c04b4;};'use strict';var Sequelize=require(_0xa644('0x0'));module[_0xa644('0x1')]={'CmContactId':{'type':Sequelize[_0xa644('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xa644('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa644('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xa644('0x4')},'OrderBy':{'type':Sequelize[_0xa644('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 27ba339..8909bec 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 _0xe839=['CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','role','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get'];(function(_0x2d32e1,_0x476738){var _0x24d174=function(_0x5dcc01){while(--_0x5dcc01){_0x2d32e1['push'](_0x2d32e1['shift']());}};_0x24d174(++_0x476738);}(_0xe839,0xd5));var _0x9e83=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0xe839[_0xd336fa];return _0x3370b1;};'use strict';var emlformat=require(_0x9e83('0x0'));var rimraf=require(_0x9e83('0x1'));var zipdir=require(_0x9e83('0x2'));var jsonpatch=require(_0x9e83('0x3'));var rp=require(_0x9e83('0x4'));var moment=require(_0x9e83('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9e83('0x6'));var util=require(_0x9e83('0x7'));var path=require(_0x9e83('0x8'));var sox=require(_0x9e83('0x9'));var csv=require(_0x9e83('0xa'));var ejs=require(_0x9e83('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9e83('0xc'));var crypto=require(_0x9e83('0xd'));var jsforce=require(_0x9e83('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9e83('0xa'));var querystring=require(_0x9e83('0xf'));var Papa=require(_0x9e83('0x10'));var Redis=require('ioredis');var authService=require(_0x9e83('0x11'));var qs=require(_0x9e83('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e83('0x13'));var logger=require(_0x9e83('0x14'))(_0x9e83('0x15'));var utils=require(_0x9e83('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9e83('0x17'));var db=require(_0x9e83('0x18'))['db'];function respondWithStatusCode(_0x57fe7f,_0xef36ca){_0xef36ca=_0xef36ca||0xcc;return function(_0x2520b7){if(_0x2520b7){return _0x57fe7f['sendStatus'](_0xef36ca);}return _0x57fe7f[_0x9e83('0x19')](_0xef36ca)['end']();};}function respondWithResult(_0x4b40e6,_0x17ba30){_0x17ba30=_0x17ba30||0xc8;return function(_0x466bb4){if(_0x466bb4){return _0x4b40e6['status'](_0x17ba30)[_0x9e83('0x1a')](_0x466bb4);}};}function respondWithFilteredResult(_0x26f1e4,_0x1c4b02){return function(_0x1658f8){if(_0x1658f8){var _0x1533e3=typeof _0x1c4b02[_0x9e83('0x1b')]===_0x9e83('0x1c')&&typeof _0x1c4b02[_0x9e83('0x1d')]===_0x9e83('0x1c');var _0x2a4b21=_0x1658f8[_0x9e83('0x1e')];var _0x1f3f73=_0x1533e3?0x0:_0x1c4b02[_0x9e83('0x1b')];var _0x4c3f39=_0x1533e3?_0x1658f8['count']:_0x1c4b02[_0x9e83('0x1b')]+_0x1c4b02[_0x9e83('0x1d')];var _0x1d9a55;if(_0x4c3f39>=_0x2a4b21){_0x4c3f39=_0x2a4b21;_0x1d9a55=0xc8;}else{_0x1d9a55=0xce;}_0x26f1e4[_0x9e83('0x19')](_0x1d9a55);return _0x26f1e4['set'](_0x9e83('0x1f'),_0x1f3f73+'-'+_0x4c3f39+'/'+_0x2a4b21)['json'](_0x1658f8);}return null;};}function patchUpdates(_0x47680f){return function(_0x39caa9){try{jsonpatch[_0x9e83('0x20')](_0x39caa9,_0x47680f,!![]);}catch(_0x5b4bd5){return BPromise[_0x9e83('0x21')](_0x5b4bd5);}return _0x39caa9[_0x9e83('0x22')]();};}function saveUpdates(_0x47d3d0,_0x187256){return function(_0x55f268){if(_0x55f268){return _0x55f268[_0x9e83('0x23')](_0x47d3d0)['then'](function(_0x4aafe7){return _0x4aafe7;});}return null;};}function removeEntity(_0x82103c,_0x26372d){return function(_0x26952e){if(_0x26952e){return _0x26952e[_0x9e83('0x24')]()[_0x9e83('0x25')](function(){var _0xa05365=_0x26952e[_0x9e83('0x26')]({'plain':!![]});var _0xcab822=_0x9e83('0x27');return db[_0x9e83('0x28')][_0x9e83('0x24')]({'where':{'type':_0xcab822,'resourceId':_0xa05365['id']}})[_0x9e83('0x25')](function(){return _0x26952e;});})[_0x9e83('0x25')](function(){_0x82103c[_0x9e83('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d89ce,_0x32985a){return function(_0x57ff98){if(!_0x57ff98){_0x1d89ce[_0x9e83('0x29')](0x194);}return _0x57ff98;};}function handleError(_0x2c6f78,_0x482ca9){_0x482ca9=_0x482ca9||0x1f4;return function(_0xe250d7){logger[_0x9e83('0x2a')](_0xe250d7[_0x9e83('0x2b')]);if(_0xe250d7['name']){delete _0xe250d7[_0x9e83('0x2c')];}_0x2c6f78['status'](_0x482ca9)[_0x9e83('0x2d')](_0xe250d7);};}exports[_0x9e83('0x2e')]=function(_0x14e8ac,_0x119cd5){var _0x5a34d9={},_0x29b038={},_0x51e551={'count':0x0,'rows':[]};var _0x27eb79=_[_0x9e83('0x2f')](db[_0x9e83('0x30')][_0x9e83('0x31')],function(_0x15dbb6){return{'name':_0x15dbb6[_0x9e83('0x32')],'type':_0x15dbb6['type'][_0x9e83('0x33')]};});_0x29b038[_0x9e83('0x34')]=_[_0x9e83('0x2f')](_0x27eb79,_0x9e83('0x2c'));_0x29b038[_0x9e83('0x35')]=_[_0x9e83('0x36')](_0x14e8ac[_0x9e83('0x35')]);_0x29b038[_0x9e83('0x37')]=_[_0x9e83('0x38')](_0x29b038[_0x9e83('0x34')],_0x29b038['query']);_0x5a34d9[_0x9e83('0x39')]=_[_0x9e83('0x38')](_0x29b038[_0x9e83('0x34')],qs[_0x9e83('0x3a')](_0x14e8ac[_0x9e83('0x35')][_0x9e83('0x3a')]));_0x5a34d9['attributes']=_0x5a34d9[_0x9e83('0x39')][_0x9e83('0x3b')]?_0x5a34d9[_0x9e83('0x39')]:_0x29b038[_0x9e83('0x34')];if(!_0x14e8ac[_0x9e83('0x35')][_0x9e83('0x3c')](_0x9e83('0x3d'))){_0x5a34d9[_0x9e83('0x1d')]=qs[_0x9e83('0x1d')](_0x14e8ac[_0x9e83('0x35')]['limit']);_0x5a34d9[_0x9e83('0x1b')]=qs[_0x9e83('0x1b')](_0x14e8ac['query'][_0x9e83('0x1b')]);}_0x5a34d9[_0x9e83('0x3e')]=qs['sort'](_0x14e8ac[_0x9e83('0x35')][_0x9e83('0x3f')]);_0x5a34d9[_0x9e83('0x40')]=qs[_0x9e83('0x37')](_[_0x9e83('0x41')](_0x14e8ac[_0x9e83('0x35')],_0x29b038['filters']),_0x27eb79);if(_0x14e8ac[_0x9e83('0x35')]['filter']){_0x5a34d9['where']=_[_0x9e83('0x42')](_0x5a34d9[_0x9e83('0x40')],{'$or':_['map'](_0x27eb79,function(_0x19052d){if(_0x19052d[_0x9e83('0x43')]!==_0x9e83('0x44')){var _0x64491f={};_0x64491f[_0x19052d['name']]={'$like':'%'+_0x14e8ac[_0x9e83('0x35')]['filter']+'%'};return _0x64491f;}})});}_0x5a34d9=_['merge']({},_0x5a34d9,_0x14e8ac[_0x9e83('0x45')]);var _0x4384ed={'where':_0x5a34d9[_0x9e83('0x40')]};return db[_0x9e83('0x30')]['count'](_0x4384ed)[_0x9e83('0x25')](function(_0x4dbf24){_0x51e551[_0x9e83('0x1e')]=_0x4dbf24;if(_0x14e8ac[_0x9e83('0x35')][_0x9e83('0x46')]){_0x5a34d9[_0x9e83('0x47')]=[{'all':!![]}];}return db[_0x9e83('0x30')][_0x9e83('0x48')](_0x5a34d9);})['then'](function(_0x197d5c){_0x51e551['rows']=_0x197d5c;return _0x51e551;})[_0x9e83('0x25')](respondWithFilteredResult(_0x119cd5,_0x5a34d9))[_0x9e83('0x49')](handleError(_0x119cd5,null));};exports[_0x9e83('0x4a')]=function(_0x1431c8,_0x493fd5){var _0x536dfc={'raw':!![],'where':{'id':_0x1431c8[_0x9e83('0x4b')]['id']}},_0x527252={};_0x527252[_0x9e83('0x34')]=_[_0x9e83('0x36')](db['CmContactHasItem']['rawAttributes']);_0x527252[_0x9e83('0x35')]=_[_0x9e83('0x36')](_0x1431c8[_0x9e83('0x35')]);_0x527252[_0x9e83('0x37')]=_[_0x9e83('0x38')](_0x527252['model'],_0x527252[_0x9e83('0x35')]);_0x536dfc[_0x9e83('0x39')]=_[_0x9e83('0x38')](_0x527252['model'],qs[_0x9e83('0x3a')](_0x1431c8[_0x9e83('0x35')]['fields']));_0x536dfc['attributes']=_0x536dfc[_0x9e83('0x39')]['length']?_0x536dfc['attributes']:_0x527252[_0x9e83('0x34')];if(_0x1431c8[_0x9e83('0x35')][_0x9e83('0x46')]){_0x536dfc[_0x9e83('0x47')]=[{'all':!![]}];}_0x536dfc=_[_0x9e83('0x42')]({},_0x536dfc,_0x1431c8[_0x9e83('0x45')]);return db[_0x9e83('0x30')][_0x9e83('0x4c')](_0x536dfc)['then'](handleEntityNotFound(_0x493fd5,null))['then'](respondWithResult(_0x493fd5,null))[_0x9e83('0x49')](handleError(_0x493fd5,null));};exports['create']=function(_0x5462fb,_0x4ea66c){return db['CmContactHasItem']['create'](_0x5462fb['body'],{})[_0x9e83('0x25')](function(_0x5adf40){var _0x1eea7c=_0x5462fb['user']['get']({'plain':!![]});if(!_0x1eea7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1eea7c[_0x9e83('0x4d')]===_0x9e83('0x4e')){var _0x747951=_0x5adf40[_0x9e83('0x26')]({'plain':!![]});var _0x1f1a33=_0x9e83('0x27');return db[_0x9e83('0x4f')][_0x9e83('0x4c')]({'where':{'name':_0x1f1a33,'userProfileId':_0x1eea7c[_0x9e83('0x50')]},'raw':!![]})[_0x9e83('0x25')](function(_0x7d3203){if(_0x7d3203&&_0x7d3203['autoAssociation']===0x0){return db[_0x9e83('0x28')][_0x9e83('0x51')]({'name':_0x747951[_0x9e83('0x2c')],'resourceId':_0x747951['id'],'type':_0x7d3203[_0x9e83('0x2c')],'sectionId':_0x7d3203['id']},{})['then'](function(){return _0x5adf40;});}else{return _0x5adf40;}})[_0x9e83('0x49')](function(_0x4b9a51){logger[_0x9e83('0x2a')](_0x9e83('0x52'),_0x4b9a51);throw _0x4b9a51;});}return _0x5adf40;})[_0x9e83('0x25')](respondWithResult(_0x4ea66c,0xc9))['catch'](handleError(_0x4ea66c,null));};exports[_0x9e83('0x23')]=function(_0x5072ae,_0x5f43bd){if(_0x5072ae[_0x9e83('0x53')]['id']){delete _0x5072ae['body']['id'];}return db['CmContactHasItem'][_0x9e83('0x4c')]({'where':{'id':_0x5072ae[_0x9e83('0x4b')]['id']}})[_0x9e83('0x25')](handleEntityNotFound(_0x5f43bd,null))[_0x9e83('0x25')](saveUpdates(_0x5072ae[_0x9e83('0x53')],null))[_0x9e83('0x25')](respondWithResult(_0x5f43bd,null))[_0x9e83('0x49')](handleError(_0x5f43bd,null));};exports[_0x9e83('0x24')]=function(_0x16781b,_0x4fb011){return db['CmContactHasItem'][_0x9e83('0x4c')]({'where':{'id':_0x16781b['params']['id']}})[_0x9e83('0x25')](handleEntityNotFound(_0x4fb011,null))[_0x9e83('0x25')](removeEntity(_0x4fb011,null))['catch'](handleError(_0x4fb011,null));}; \ No newline at end of file +var _0x99b9=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','moment','mustache','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','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','sendStatus','error','stack','name','send','CmContactHasItem','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','options','include','rows','catch','params','merge','find','create','user','role','UserProfileSection'];(function(_0x5842eb,_0x585f4c){var _0x3eca2d=function(_0x59a441){while(--_0x59a441){_0x5842eb['push'](_0x5842eb['shift']());}};_0x3eca2d(++_0x585f4c);}(_0x99b9,0x1ea));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x999b('0x0'));var zipdir=require(_0x999b('0x1'));var jsonpatch=require(_0x999b('0x2'));var rp=require('request-promise');var moment=require(_0x999b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x999b('0x4'));var util=require(_0x999b('0x5'));var path=require(_0x999b('0x6'));var sox=require('sox');var csv=require(_0x999b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x999b('0x8'));var _=require(_0x999b('0x9'));var squel=require(_0x999b('0xa'));var crypto=require(_0x999b('0xb'));var jsforce=require(_0x999b('0xc'));var deskjs=require(_0x999b('0xd'));var toCsv=require(_0x999b('0x7'));var querystring=require(_0x999b('0xe'));var Papa=require(_0x999b('0xf'));var Redis=require(_0x999b('0x10'));var authService=require(_0x999b('0x11'));var qs=require(_0x999b('0x12'));var as=require(_0x999b('0x13'));var hardwareService=require(_0x999b('0x14'));var logger=require(_0x999b('0x15'))('api');var utils=require(_0x999b('0x16'));var config=require(_0x999b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x999b('0x18'))['db'];function respondWithStatusCode(_0x5d1732,_0x147c30){_0x147c30=_0x147c30||0xcc;return function(_0x3115dc){if(_0x3115dc){return _0x5d1732['sendStatus'](_0x147c30);}return _0x5d1732[_0x999b('0x19')](_0x147c30)[_0x999b('0x1a')]();};}function respondWithResult(_0x3a617d,_0x56d8b6){_0x56d8b6=_0x56d8b6||0xc8;return function(_0x407b4f){if(_0x407b4f){return _0x3a617d[_0x999b('0x19')](_0x56d8b6)[_0x999b('0x1b')](_0x407b4f);}};}function respondWithFilteredResult(_0x1a6eb8,_0x4fbbcd){return function(_0x1c9934){if(_0x1c9934){var _0x2e9a65=typeof _0x4fbbcd[_0x999b('0x1c')]===_0x999b('0x1d')&&typeof _0x4fbbcd['limit']===_0x999b('0x1d');var _0x53532c=_0x1c9934['count'];var _0xbb9a81=_0x2e9a65?0x0:_0x4fbbcd[_0x999b('0x1c')];var _0x2e318c=_0x2e9a65?_0x1c9934[_0x999b('0x1e')]:_0x4fbbcd[_0x999b('0x1c')]+_0x4fbbcd['limit'];var _0x20de61;if(_0x2e318c>=_0x53532c){_0x2e318c=_0x53532c;_0x20de61=0xc8;}else{_0x20de61=0xce;}_0x1a6eb8[_0x999b('0x19')](_0x20de61);return _0x1a6eb8[_0x999b('0x1f')]('Content-Range',_0xbb9a81+'-'+_0x2e318c+'/'+_0x53532c)[_0x999b('0x1b')](_0x1c9934);}return null;};}function patchUpdates(_0x23b780){return function(_0x2bf77c){try{jsonpatch[_0x999b('0x20')](_0x2bf77c,_0x23b780,!![]);}catch(_0x1ee738){return BPromise[_0x999b('0x21')](_0x1ee738);}return _0x2bf77c[_0x999b('0x22')]();};}function saveUpdates(_0x41d303,_0x10d0b8){return function(_0x554546){if(_0x554546){return _0x554546[_0x999b('0x23')](_0x41d303)[_0x999b('0x24')](function(_0x568d67){return _0x568d67;});}return null;};}function removeEntity(_0x464cc8,_0x4dd45a){return function(_0xc25804){if(_0xc25804){return _0xc25804['destroy']()[_0x999b('0x24')](function(){var _0x3bc9a6=_0xc25804[_0x999b('0x25')]({'plain':!![]});var _0x3cfd46=_0x999b('0x26');return db[_0x999b('0x27')][_0x999b('0x28')]({'where':{'type':_0x3cfd46,'resourceId':_0x3bc9a6['id']}})['then'](function(){return _0xc25804;});})[_0x999b('0x24')](function(){_0x464cc8[_0x999b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x487401,_0x1b3b15){return function(_0x5b4b30){if(!_0x5b4b30){_0x487401[_0x999b('0x29')](0x194);}return _0x5b4b30;};}function handleError(_0x267ac6,_0x492e25){_0x492e25=_0x492e25||0x1f4;return function(_0x522cde){logger[_0x999b('0x2a')](_0x522cde[_0x999b('0x2b')]);if(_0x522cde[_0x999b('0x2c')]){delete _0x522cde['name'];}_0x267ac6[_0x999b('0x19')](_0x492e25)[_0x999b('0x2d')](_0x522cde);};}exports['index']=function(_0x3c7fe3,_0x5940ee){var _0x57c849={},_0x2914a0={},_0x13a5e4={'count':0x0,'rows':[]};var _0x9eb273=_['map'](db[_0x999b('0x2e')][_0x999b('0x2f')],function(_0x55814e){return{'name':_0x55814e[_0x999b('0x30')],'type':_0x55814e[_0x999b('0x31')]['key']};});_0x2914a0[_0x999b('0x32')]=_[_0x999b('0x33')](_0x9eb273,_0x999b('0x2c'));_0x2914a0[_0x999b('0x34')]=_[_0x999b('0x35')](_0x3c7fe3[_0x999b('0x34')]);_0x2914a0[_0x999b('0x36')]=_[_0x999b('0x37')](_0x2914a0[_0x999b('0x32')],_0x2914a0[_0x999b('0x34')]);_0x57c849[_0x999b('0x38')]=_['intersection'](_0x2914a0[_0x999b('0x32')],qs['fields'](_0x3c7fe3['query'][_0x999b('0x39')]));_0x57c849[_0x999b('0x38')]=_0x57c849['attributes'][_0x999b('0x3a')]?_0x57c849[_0x999b('0x38')]:_0x2914a0[_0x999b('0x32')];if(!_0x3c7fe3[_0x999b('0x34')][_0x999b('0x3b')](_0x999b('0x3c'))){_0x57c849[_0x999b('0x3d')]=qs[_0x999b('0x3d')](_0x3c7fe3[_0x999b('0x34')][_0x999b('0x3d')]);_0x57c849[_0x999b('0x1c')]=qs['offset'](_0x3c7fe3[_0x999b('0x34')][_0x999b('0x1c')]);}_0x57c849['order']=qs['sort'](_0x3c7fe3[_0x999b('0x34')][_0x999b('0x3e')]);_0x57c849[_0x999b('0x3f')]=qs[_0x999b('0x36')](_[_0x999b('0x40')](_0x3c7fe3[_0x999b('0x34')],_0x2914a0[_0x999b('0x36')]),_0x9eb273);if(_0x3c7fe3[_0x999b('0x34')]['filter']){_0x57c849[_0x999b('0x3f')]=_['merge'](_0x57c849[_0x999b('0x3f')],{'$or':_[_0x999b('0x33')](_0x9eb273,function(_0x296581){if(_0x296581[_0x999b('0x31')]!=='VIRTUAL'){var _0x3eb178={};_0x3eb178[_0x296581['name']]={'$like':'%'+_0x3c7fe3['query'][_0x999b('0x41')]+'%'};return _0x3eb178;}})});}_0x57c849=_['merge']({},_0x57c849,_0x3c7fe3[_0x999b('0x42')]);var _0x1d46cc={'where':_0x57c849[_0x999b('0x3f')]};return db[_0x999b('0x2e')][_0x999b('0x1e')](_0x1d46cc)['then'](function(_0x36e83e){_0x13a5e4[_0x999b('0x1e')]=_0x36e83e;if(_0x3c7fe3[_0x999b('0x34')]['includeAll']){_0x57c849[_0x999b('0x43')]=[{'all':!![]}];}return db[_0x999b('0x2e')]['findAll'](_0x57c849);})[_0x999b('0x24')](function(_0x2b8835){_0x13a5e4[_0x999b('0x44')]=_0x2b8835;return _0x13a5e4;})[_0x999b('0x24')](respondWithFilteredResult(_0x5940ee,_0x57c849))[_0x999b('0x45')](handleError(_0x5940ee,null));};exports['show']=function(_0x31343d,_0x29c768){var _0x43e4fa={'raw':!![],'where':{'id':_0x31343d[_0x999b('0x46')]['id']}},_0x16f9f8={};_0x16f9f8[_0x999b('0x32')]=_[_0x999b('0x35')](db[_0x999b('0x2e')]['rawAttributes']);_0x16f9f8[_0x999b('0x34')]=_['keys'](_0x31343d[_0x999b('0x34')]);_0x16f9f8[_0x999b('0x36')]=_[_0x999b('0x37')](_0x16f9f8[_0x999b('0x32')],_0x16f9f8[_0x999b('0x34')]);_0x43e4fa[_0x999b('0x38')]=_[_0x999b('0x37')](_0x16f9f8[_0x999b('0x32')],qs['fields'](_0x31343d['query'][_0x999b('0x39')]));_0x43e4fa[_0x999b('0x38')]=_0x43e4fa['attributes'][_0x999b('0x3a')]?_0x43e4fa[_0x999b('0x38')]:_0x16f9f8[_0x999b('0x32')];if(_0x31343d['query']['includeAll']){_0x43e4fa['include']=[{'all':!![]}];}_0x43e4fa=_[_0x999b('0x47')]({},_0x43e4fa,_0x31343d['options']);return db[_0x999b('0x2e')][_0x999b('0x48')](_0x43e4fa)['then'](handleEntityNotFound(_0x29c768,null))[_0x999b('0x24')](respondWithResult(_0x29c768,null))[_0x999b('0x45')](handleError(_0x29c768,null));};exports['create']=function(_0x1e3fae,_0x5f3e07){return db[_0x999b('0x2e')][_0x999b('0x49')](_0x1e3fae['body'],{})[_0x999b('0x24')](function(_0x4a82ab){var _0x3b9043=_0x1e3fae[_0x999b('0x4a')][_0x999b('0x25')]({'plain':!![]});if(!_0x3b9043)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b9043[_0x999b('0x4b')]===_0x999b('0x4a')){var _0x510dc8=_0x4a82ab['get']({'plain':!![]});var _0x1fa12d=_0x999b('0x26');return db[_0x999b('0x4c')][_0x999b('0x48')]({'where':{'name':_0x1fa12d,'userProfileId':_0x3b9043[_0x999b('0x4d')]},'raw':!![]})[_0x999b('0x24')](function(_0x559b22){if(_0x559b22&&_0x559b22[_0x999b('0x4e')]===0x0){return db[_0x999b('0x27')][_0x999b('0x49')]({'name':_0x510dc8[_0x999b('0x2c')],'resourceId':_0x510dc8['id'],'type':_0x559b22['name'],'sectionId':_0x559b22['id']},{})[_0x999b('0x24')](function(){return _0x4a82ab;});}else{return _0x4a82ab;}})[_0x999b('0x45')](function(_0xfe517d){logger['error'](_0x999b('0x4f'),_0xfe517d);throw _0xfe517d;});}return _0x4a82ab;})[_0x999b('0x24')](respondWithResult(_0x5f3e07,0xc9))[_0x999b('0x45')](handleError(_0x5f3e07,null));};exports[_0x999b('0x23')]=function(_0x54cb26,_0x2ccc6a){if(_0x54cb26[_0x999b('0x50')]['id']){delete _0x54cb26[_0x999b('0x50')]['id'];}return db[_0x999b('0x2e')][_0x999b('0x48')]({'where':{'id':_0x54cb26[_0x999b('0x46')]['id']}})[_0x999b('0x24')](handleEntityNotFound(_0x2ccc6a,null))[_0x999b('0x24')](saveUpdates(_0x54cb26[_0x999b('0x50')],null))['then'](respondWithResult(_0x2ccc6a,null))['catch'](handleError(_0x2ccc6a,null));};exports['destroy']=function(_0x3118de,_0x53568e){return db[_0x999b('0x2e')][_0x999b('0x48')]({'where':{'id':_0x3118de[_0x999b('0x46')]['id']}})[_0x999b('0x24')](handleEntityNotFound(_0x53568e,null))[_0x999b('0x24')](removeEntity(_0x53568e,null))[_0x999b('0x45')](handleError(_0x53568e,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 68d3e5d..f56d7d8 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 _0x1e8e=['../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x1e8e,0xc8));var _0xe1e8=function(_0x181fe7,_0x29729c){_0x181fe7=_0x181fe7-0x0;var _0x2166a4=_0x1e8e[_0x181fe7];return _0x2166a4;};'use strict';var _=require(_0xe1e8('0x0'));var util=require(_0xe1e8('0x1'));var logger=require(_0xe1e8('0x2'))(_0xe1e8('0x3'));var moment=require('moment');var BPromise=require(_0xe1e8('0x4'));var rp=require(_0xe1e8('0x5'));var fs=require('fs');var path=require(_0xe1e8('0x6'));var rimraf=require(_0xe1e8('0x7'));var config=require(_0xe1e8('0x8'));var attributes=require(_0xe1e8('0x9'));module['exports']=function(_0x453eee,_0x324a0d){return _0x453eee[_0xe1e8('0xa')](_0xe1e8('0xb'),attributes,{'tableName':_0xe1e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc10a=['path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','util','api','moment','bluebird'];(function(_0x412801,_0x1a8606){var _0x5a0acf=function(_0x4ee05b){while(--_0x4ee05b){_0x412801['push'](_0x412801['shift']());}};_0x5a0acf(++_0x1a8606);}(_0xc10a,0x15a));var _0xac10=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0xc10a[_0x2c27ed];return _0x597bd1;};'use strict';var _=require('lodash');var util=require(_0xac10('0x0'));var logger=require('../../config/logger')(_0xac10('0x1'));var moment=require(_0xac10('0x2'));var BPromise=require(_0xac10('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac10('0x4'));var rimraf=require(_0xac10('0x5'));var config=require(_0xac10('0x6'));var attributes=require(_0xac10('0x7'));module['exports']=function(_0x43cf8a,_0x1d9817){return _0x43cf8a[_0xac10('0x8')]('CmContactHasItem',attributes,{'tableName':_0xac10('0x9'),'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 31cd81a..ecd6b15 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 _0x6b56=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3bce5f,_0xaf192f){var _0x329e02=function(_0x3033ab){while(--_0x3033ab){_0x3bce5f['push'](_0x3bce5f['shift']());}};_0x329e02(++_0xaf192f);}(_0x6b56,0xab));var _0x66b5=function(_0x2adbf8,_0x4afd45){_0x2adbf8=_0x2adbf8-0x0;var _0x4d8466=_0x6b56[_0x2adbf8];return _0x4d8466;};'use strict';var _=require('lodash');var util=require(_0x66b5('0x0'));var moment=require(_0x66b5('0x1'));var BPromise=require(_0x66b5('0x2'));var rs=require(_0x66b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66b5('0x4'))['db'];var utils=require(_0x66b5('0x5'));var logger=require('../../config/logger')(_0x66b5('0x6'));var config=require(_0x66b5('0x7'));var jayson=require(_0x66b5('0x8'));var client=jayson[_0x66b5('0x9')][_0x66b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ded44,_0x507603,_0x222fd0){return new BPromise(function(_0x1f4d4e,_0x11867e){return client[_0x66b5('0xb')](_0x4ded44,_0x222fd0)[_0x66b5('0xc')](function(_0x3cd91d){logger[_0x66b5('0xd')](_0x66b5('0xe'),_0x507603,_0x66b5('0xf'));logger['debug'](_0x66b5('0x10'),_0x507603,_0x66b5('0xf'),JSON[_0x66b5('0x11')](_0x3cd91d));if(_0x3cd91d[_0x66b5('0x12')]){if(_0x3cd91d[_0x66b5('0x12')][_0x66b5('0x13')]===0x1f4){logger[_0x66b5('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x507603,_0x3cd91d[_0x66b5('0x12')]['message']);return _0x11867e(_0x3cd91d['error'][_0x66b5('0x14')]);}logger[_0x66b5('0x12')](_0x66b5('0xe'),_0x507603,_0x3cd91d[_0x66b5('0x12')]['message']);return _0x1f4d4e(_0x3cd91d[_0x66b5('0x12')]['message']);}else{logger[_0x66b5('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x507603,_0x66b5('0xf'));_0x1f4d4e(_0x3cd91d[_0x66b5('0x15')][_0x66b5('0x14')]);}})[_0x66b5('0x16')](function(_0xe7df17){logger[_0x66b5('0x12')](_0x66b5('0xe'),_0x507603,_0xe7df17);_0x11867e(_0xe7df17);});});} \ No newline at end of file +var _0x7d13=['message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e1645,_0x21ef10){var _0xe2de77=function(_0x582a6f){while(--_0x582a6f){_0x4e1645['push'](_0x4e1645['shift']());}};_0xe2de77(++_0x21ef10);}(_0x7d13,0x174));var _0x37d1=function(_0x3325c8,_0x5701c2){_0x3325c8=_0x3325c8-0x0;var _0x3526f9=_0x7d13[_0x3325c8];return _0x3526f9;};'use strict';var _=require('lodash');var util=require(_0x37d1('0x0'));var moment=require(_0x37d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x37d1('0x2'));var fs=require('fs');var Redis=require(_0x37d1('0x3'));var db=require(_0x37d1('0x4'))['db'];var utils=require(_0x37d1('0x5'));var logger=require(_0x37d1('0x6'))(_0x37d1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x37d1('0x8')][_0x37d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6651c0,_0x26297f,_0x521507){return new BPromise(function(_0x6d7af0,_0x38730e){return client[_0x37d1('0xa')](_0x6651c0,_0x521507)[_0x37d1('0xb')](function(_0x1fe6bf){logger['info'](_0x37d1('0xc'),_0x26297f,_0x37d1('0xd'));logger[_0x37d1('0xe')](_0x37d1('0xf'),_0x26297f,_0x37d1('0xd'),JSON[_0x37d1('0x10')](_0x1fe6bf));if(_0x1fe6bf[_0x37d1('0x11')]){if(_0x1fe6bf[_0x37d1('0x11')][_0x37d1('0x12')]===0x1f4){logger[_0x37d1('0x11')](_0x37d1('0xc'),_0x26297f,_0x1fe6bf[_0x37d1('0x11')][_0x37d1('0x13')]);return _0x38730e(_0x1fe6bf['error']['message']);}logger[_0x37d1('0x11')](_0x37d1('0xc'),_0x26297f,_0x1fe6bf[_0x37d1('0x11')][_0x37d1('0x13')]);return _0x6d7af0(_0x1fe6bf['error'][_0x37d1('0x13')]);}else{logger[_0x37d1('0x14')](_0x37d1('0xc'),_0x26297f,_0x37d1('0xd'));_0x6d7af0(_0x1fe6bf[_0x37d1('0x15')][_0x37d1('0x13')]);}})[_0x37d1('0x16')](function(_0x5e5882){logger[_0x37d1('0x11')](_0x37d1('0xc'),_0x26297f,_0x5e5882);_0x38730e(_0x5e5882);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index d19e602..299448f 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 _0xe378=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe378,0xb6));var _0x8e37=function(_0x4ad39a,_0x26766b){_0x4ad39a=_0x4ad39a-0x0;var _0x270ec2=_0xe378[_0x4ad39a];return _0x270ec2;};'use strict';var multer=require(_0x8e37('0x0'));var util=require(_0x8e37('0x1'));var path=require(_0x8e37('0x2'));var timeout=require(_0x8e37('0x3'));var express=require(_0x8e37('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8e37('0x5'));var interaction=require(_0x8e37('0x6'));var config=require(_0x8e37('0x7'));var controller=require(_0x8e37('0x8'));router[_0x8e37('0x9')]('/',auth[_0x8e37('0xa')](),controller[_0x8e37('0xb')]);router[_0x8e37('0x9')](_0x8e37('0xc'),auth[_0x8e37('0xa')](),controller[_0x8e37('0xd')]);router[_0x8e37('0xe')]('/',auth[_0x8e37('0xa')](),controller['create']);router[_0x8e37('0xf')](_0x8e37('0xc'),auth[_0x8e37('0xa')](),controller[_0x8e37('0x10')]);router[_0x8e37('0x11')](_0x8e37('0xc'),auth[_0x8e37('0xa')](),controller[_0x8e37('0x12')]);module[_0x8e37('0x13')]=router; \ No newline at end of file +var _0x67ec=['./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x47a13d,_0x582540){var _0x4ac638=function(_0x5bafd6){while(--_0x5bafd6){_0x47a13d['push'](_0x47a13d['shift']());}};_0x4ac638(++_0x582540);}(_0x67ec,0x11c));var _0xc67e=function(_0x168e82,_0x5827fb){_0x168e82=_0x168e82-0x0;var _0x5b4a64=_0x67ec[_0x168e82];return _0x5b4a64;};'use strict';var multer=require(_0xc67e('0x0'));var util=require(_0xc67e('0x1'));var path=require(_0xc67e('0x2'));var timeout=require(_0xc67e('0x3'));var express=require(_0xc67e('0x4'));var router=express[_0xc67e('0x5')]();var fs_extra=require(_0xc67e('0x6'));var auth=require(_0xc67e('0x7'));var interaction=require(_0xc67e('0x8'));var config=require(_0xc67e('0x9'));var controller=require(_0xc67e('0xa'));router[_0xc67e('0xb')]('/',auth[_0xc67e('0xc')](),controller[_0xc67e('0xd')]);router[_0xc67e('0xb')](_0xc67e('0xe'),auth['isAuthenticated'](),controller[_0xc67e('0xf')]);router['post']('/',auth[_0xc67e('0xc')](),controller[_0xc67e('0x10')]);router[_0xc67e('0x11')](_0xc67e('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xc67e('0x12')](_0xc67e('0xe'),auth[_0xc67e('0xc')](),controller[_0xc67e('0x13')]);module[_0xc67e('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 25210de..60b154d 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 _0xd0da=['exports','VIRTUAL','alias','setDataValue','getDataValue','name','TEXT','long','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','lodash'];(function(_0x19557a,_0x1e9250){var _0x387e4a=function(_0x36ceb4){while(--_0x36ceb4){_0x19557a['push'](_0x19557a['shift']());}};_0x387e4a(++_0x1e9250);}(_0xd0da,0x65));var _0xad0d=function(_0x409682,_0x370090){_0x409682=_0x409682-0x0;var _0x1ee901=_0xd0da[_0x409682];return _0x1ee901;};'use strict';var Sequelize=require('sequelize');var _=require(_0xad0d('0x0'));module[_0xad0d('0x1')]={'name':{'type':Sequelize[_0xad0d('0x2')],'get':function(_0x30ddd5){return this['getDataValue'](_0xad0d('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x48dc0d){this[_0xad0d('0x4')](_0xad0d('0x3'),_0x48dc0d?_0x48dc0d:this[_0xad0d('0x5')](_0xad0d('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xad0d('0x7')](_0xad0d('0x8')),'get':function(){if(this['getDataValue']('type')===_0xad0d('0x9')){return JSON[_0xad0d('0xa')](this['getDataValue'](_0xad0d('0xb')));}else{return this['getDataValue'](_0xad0d('0xb'));}},'set':function(_0x1f2940){if(Array[_0xad0d('0xc')](_0x1f2940)){this[_0xad0d('0x4')](_0xad0d('0xb'),JSON[_0xad0d('0xd')](_0x1f2940));}else{this['setDataValue'](_0xad0d('0xb'),_0x1f2940);}}},'required':{'type':Sequelize[_0xad0d('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xad0d('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xad0d('0xf')](_0xad0d('0x10'))}}; \ No newline at end of file +var _0x08df=['VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT','type','select','parse','values','isArray','stringify','BOOLEAN','voice','sequelize'];(function(_0x3420da,_0xc7f01f){var _0x2c7100=function(_0x29f8d){while(--_0x29f8d){_0x3420da['push'](_0x3420da['shift']());}};_0x2c7100(++_0xc7f01f);}(_0x08df,0x11c));var _0xf08d=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x08df[_0x135904];return _0x1ce7d5;};'use strict';var Sequelize=require(_0xf08d('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xf08d('0x1')],'get':function(_0x58a336){return this[_0xf08d('0x2')](_0xf08d('0x3'));}},'alias':{'type':Sequelize[_0xf08d('0x4')],'allowNull':![],'set':function(_0x4e1a17){this[_0xf08d('0x5')](_0xf08d('0x3'),_0x4e1a17?_0x4e1a17:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xf08d('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xf08d('0x6')]('long'),'get':function(){if(this[_0xf08d('0x2')](_0xf08d('0x7'))===_0xf08d('0x8')){return JSON[_0xf08d('0x9')](this[_0xf08d('0x2')](_0xf08d('0xa')));}else{return this[_0xf08d('0x2')](_0xf08d('0xa'));}},'set':function(_0x77e43b){if(Array[_0xf08d('0xb')](_0x77e43b)){this[_0xf08d('0x5')](_0xf08d('0xa'),JSON[_0xf08d('0xc')](_0x77e43b));}else{this[_0xf08d('0x5')](_0xf08d('0xa'),_0x77e43b);}}},'required':{'type':Sequelize[_0xf08d('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf08d('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xf08d('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4318a3c..95c0bfa 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 _0x8e54=['includeAll','CmCustomField','findAll','rows','catch','show','params','keys','length','include','find','body','create','sequelize','Sequelize','TEXT','text','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x56e7bd,_0x151729){var _0x1ff7de=function(_0x5111a1){while(--_0x5111a1){_0x56e7bd['push'](_0x56e7bd['shift']());}};_0x1ff7de(++_0x151729);}(_0x8e54,0x127));var _0x48e5=function(_0x17aa0e,_0x1a956f){_0x17aa0e=_0x17aa0e-0x0;var _0x2fdd35=_0x8e54[_0x17aa0e];return _0x2fdd35;};'use strict';var emlformat=require(_0x48e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x48e5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48e5('0x2'));var moment=require(_0x48e5('0x3'));var BPromise=require(_0x48e5('0x4'));var Mustache=require(_0x48e5('0x5'));var util=require(_0x48e5('0x6'));var path=require(_0x48e5('0x7'));var sox=require(_0x48e5('0x8'));var csv=require('to-csv');var ejs=require(_0x48e5('0x9'));var fs=require('fs');var fs_extra=require(_0x48e5('0xa'));var _=require('lodash');var squel=require(_0x48e5('0xb'));var crypto=require(_0x48e5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x48e5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x48e5('0xe'));var Papa=require(_0x48e5('0xf'));var Redis=require(_0x48e5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x48e5('0x11'));var as=require(_0x48e5('0x12'));var hardwareService=require(_0x48e5('0x13'));var logger=require(_0x48e5('0x14'))(_0x48e5('0x15'));var utils=require(_0x48e5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x48e5('0x17'))['db'];function respondWithStatusCode(_0x1b147d,_0x57850a){_0x57850a=_0x57850a||0xcc;return function(_0x2d968a){if(_0x2d968a){return _0x1b147d[_0x48e5('0x18')](_0x57850a);}return _0x1b147d['status'](_0x57850a)['end']();};}function respondWithResult(_0x4fcdae,_0x259941){_0x259941=_0x259941||0xc8;return function(_0x1ef412){if(_0x1ef412){return _0x4fcdae[_0x48e5('0x19')](_0x259941)[_0x48e5('0x1a')](_0x1ef412);}};}function respondWithFilteredResult(_0x9e3971,_0x2276ad){return function(_0x12aed0){if(_0x12aed0){var _0xc3eefa=typeof _0x2276ad[_0x48e5('0x1b')]===_0x48e5('0x1c')&&typeof _0x2276ad[_0x48e5('0x1d')]===_0x48e5('0x1c');var _0x10ec31=_0x12aed0[_0x48e5('0x1e')];var _0xd7b1b5=_0xc3eefa?0x0:_0x2276ad[_0x48e5('0x1b')];var _0x12b9da=_0xc3eefa?_0x12aed0[_0x48e5('0x1e')]:_0x2276ad[_0x48e5('0x1b')]+_0x2276ad[_0x48e5('0x1d')];var _0x2bd1e5;if(_0x12b9da>=_0x10ec31){_0x12b9da=_0x10ec31;_0x2bd1e5=0xc8;}else{_0x2bd1e5=0xce;}_0x9e3971[_0x48e5('0x19')](_0x2bd1e5);return _0x9e3971[_0x48e5('0x1f')](_0x48e5('0x20'),_0xd7b1b5+'-'+_0x12b9da+'/'+_0x10ec31)['json'](_0x12aed0);}return null;};}function patchUpdates(_0x96b357){return function(_0x484c0d){try{jsonpatch[_0x48e5('0x21')](_0x484c0d,_0x96b357,!![]);}catch(_0x3ec331){return BPromise[_0x48e5('0x22')](_0x3ec331);}return _0x484c0d[_0x48e5('0x23')]();};}function saveUpdates(_0x38ae5a,_0x577f52){return function(_0xe417e1){if(_0xe417e1){return _0xe417e1[_0x48e5('0x24')](_0x38ae5a)[_0x48e5('0x25')](function(_0x490b70){return _0x490b70;});}return null;};}function removeEntity(_0x50f2da,_0x56985f){return function(_0x17cc7c){if(_0x17cc7c){return _0x17cc7c[_0x48e5('0x26')]()[_0x48e5('0x25')](function(){_0x50f2da['status'](0xcc)[_0x48e5('0x27')]();});}};}function handleEntityNotFound(_0x55ef7b,_0x4aabb5){return function(_0x26b9b9){if(!_0x26b9b9){_0x55ef7b['sendStatus'](0x194);}return _0x26b9b9;};}function handleError(_0x48b072,_0x3c7177){_0x3c7177=_0x3c7177||0x1f4;return function(_0x279223){logger[_0x48e5('0x28')](_0x279223[_0x48e5('0x29')]);if(_0x279223['name']){delete _0x279223[_0x48e5('0x2a')];}_0x48b072['status'](_0x3c7177)['send'](_0x279223);};}exports[_0x48e5('0x2b')]=function(_0x2aa4c0,_0xf1f82c){var _0x2de456={},_0x211fe1={},_0x586f7d={'count':0x0,'rows':[]};var _0x5658cc=_[_0x48e5('0x2c')](db['CmCustomField'][_0x48e5('0x2d')],function(_0x5e48bd){return{'name':_0x5e48bd[_0x48e5('0x2e')],'type':_0x5e48bd[_0x48e5('0x2f')][_0x48e5('0x30')]};});_0x211fe1['model']=_[_0x48e5('0x31')](_[_0x48e5('0x2c')](_0x5658cc,'name'),[_0x48e5('0x2a')]);_0x211fe1[_0x48e5('0x32')]=_['keys'](_0x2aa4c0[_0x48e5('0x32')]);_0x211fe1[_0x48e5('0x33')]=_[_0x48e5('0x34')](_0x211fe1[_0x48e5('0x35')],_0x211fe1[_0x48e5('0x32')]);_0x2de456[_0x48e5('0x36')]=_['intersection'](_0x211fe1[_0x48e5('0x35')],qs[_0x48e5('0x37')](_0x2aa4c0[_0x48e5('0x32')][_0x48e5('0x37')]));_0x2de456[_0x48e5('0x36')]=_0x2de456['attributes']['length']?_0x2de456['attributes']:_0x211fe1[_0x48e5('0x35')];if(!_0x2aa4c0[_0x48e5('0x32')]['hasOwnProperty'](_0x48e5('0x38'))){_0x2de456['limit']=qs['limit'](_0x2aa4c0[_0x48e5('0x32')][_0x48e5('0x1d')]);_0x2de456[_0x48e5('0x1b')]=qs['offset'](_0x2aa4c0[_0x48e5('0x32')]['offset']);}_0x2de456[_0x48e5('0x39')]=qs[_0x48e5('0x3a')](_0x2aa4c0[_0x48e5('0x32')]['sort']);_0x2de456[_0x48e5('0x3b')]=qs[_0x48e5('0x33')](_[_0x48e5('0x3c')](_0x2aa4c0[_0x48e5('0x32')],_0x211fe1[_0x48e5('0x33')]),_0x5658cc);if(_0x2aa4c0[_0x48e5('0x32')][_0x48e5('0x3d')]){_0x2de456[_0x48e5('0x3b')]=_[_0x48e5('0x3e')](_0x2de456[_0x48e5('0x3b')],{'$or':_['map'](_0x5658cc,function(_0x5ca4c0){if(_0x5ca4c0['type']!==_0x48e5('0x3f')){var _0x5df06c={};_0x5df06c[_0x5ca4c0[_0x48e5('0x2a')]]={'$like':'%'+_0x2aa4c0['query'][_0x48e5('0x3d')]+'%'};return _0x5df06c;}})});}_0x2de456=_[_0x48e5('0x3e')]({},_0x2de456,_0x2aa4c0[_0x48e5('0x40')]);var _0x6ebed9={'where':_0x2de456[_0x48e5('0x3b')]};return db['CmCustomField'][_0x48e5('0x1e')](_0x6ebed9)[_0x48e5('0x25')](function(_0x4c0232){_0x586f7d[_0x48e5('0x1e')]=_0x4c0232;if(_0x2aa4c0['query'][_0x48e5('0x41')]){_0x2de456['include']=[{'all':!![]}];}return db[_0x48e5('0x42')][_0x48e5('0x43')](_0x2de456);})[_0x48e5('0x25')](function(_0x249635){_0x586f7d[_0x48e5('0x44')]=_0x249635;return _0x586f7d;})['then'](respondWithFilteredResult(_0xf1f82c,_0x2de456))[_0x48e5('0x45')](handleError(_0xf1f82c,null));};exports[_0x48e5('0x46')]=function(_0x39411d,_0x45ba79){var _0x1591d6={'raw':!![],'where':{'id':_0x39411d[_0x48e5('0x47')]['id']}},_0x44ffd0={};_0x44ffd0[_0x48e5('0x35')]=_[_0x48e5('0x48')](db[_0x48e5('0x42')][_0x48e5('0x2d')]);_0x44ffd0['query']=_[_0x48e5('0x48')](_0x39411d['query']);_0x44ffd0[_0x48e5('0x33')]=_[_0x48e5('0x34')](_0x44ffd0[_0x48e5('0x35')],_0x44ffd0['query']);_0x1591d6[_0x48e5('0x36')]=_[_0x48e5('0x34')](_0x44ffd0['model'],qs[_0x48e5('0x37')](_0x39411d[_0x48e5('0x32')][_0x48e5('0x37')]));_0x1591d6[_0x48e5('0x36')]=_0x1591d6[_0x48e5('0x36')][_0x48e5('0x49')]?_0x1591d6[_0x48e5('0x36')]:_0x44ffd0['model'];if(_0x39411d[_0x48e5('0x32')][_0x48e5('0x41')]){_0x1591d6[_0x48e5('0x4a')]=[{'all':!![]}];}_0x1591d6=_[_0x48e5('0x3e')]({},_0x1591d6,_0x39411d[_0x48e5('0x40')]);return db['CmCustomField'][_0x48e5('0x4b')](_0x1591d6)[_0x48e5('0x25')](handleEntityNotFound(_0x45ba79,null))['then'](respondWithResult(_0x45ba79,null))[_0x48e5('0x45')](handleError(_0x45ba79,null));};exports[_0x48e5('0x24')]=function(_0xee9ef9,_0x58c8fe){if(_0xee9ef9[_0x48e5('0x4c')]['id']){delete _0xee9ef9[_0x48e5('0x4c')]['id'];}return db['CmCustomField'][_0x48e5('0x4b')]({'where':{'id':_0xee9ef9[_0x48e5('0x47')]['id']}})[_0x48e5('0x25')](handleEntityNotFound(_0x58c8fe,null))['then'](saveUpdates(_0xee9ef9[_0x48e5('0x4c')],null))[_0x48e5('0x25')](respondWithResult(_0x58c8fe,null))[_0x48e5('0x45')](handleError(_0x58c8fe,null));};exports[_0x48e5('0x26')]=function(_0x26fe37,_0x322842){return db[_0x48e5('0x42')][_0x48e5('0x4b')]({'where':{'id':_0x26fe37[_0x48e5('0x47')]['id']}})[_0x48e5('0x25')](handleEntityNotFound(_0x322842,null))['then'](removeEntity(_0x322842,null))['catch'](handleError(_0x322842,null));};exports[_0x48e5('0x4d')]=function(_0x21ffce,_0x9d7a24){var _0x10fa09;return db[_0x48e5('0x4e')]['transaction'](function(_0x1025ad){return db[_0x48e5('0x42')]['create'](_0x21ffce[_0x48e5('0x4c')],{'transaction':_0x1025ad})[_0x48e5('0x25')](function(_0x54c078){_0x10fa09=_0x54c078;var _0x33185b={'type':db[_0x48e5('0x4f')][_0x48e5('0x50')],'transaction':_0x1025ad};switch(_0x21ffce[_0x48e5('0x4c')]['type']){case _0x48e5('0x51'):_0x33185b[_0x48e5('0x2f')]=db[_0x48e5('0x4f')]['TEXT'];break;case'number':_0x33185b[_0x48e5('0x2f')]=db['Sequelize'][_0x48e5('0x52')];break;case'switch':_0x33185b[_0x48e5('0x2f')]=db[_0x48e5('0x4f')][_0x48e5('0x53')];_0x33185b[_0x48e5('0x54')]=![];break;default:}return db['sequelize'][_0x48e5('0x55')][_0x48e5('0x56')](_0x48e5('0x57'),util[_0x48e5('0x58')](_0x48e5('0x59'),_0x10fa09['id']),_0x33185b);})[_0x48e5('0x25')](function(){return _0x10fa09;});})['then'](respondWithResult(_0x9d7a24,0xc9))['catch'](handleError(_0x9d7a24,null));}; \ No newline at end of file +var _0xb54d=['../../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','reject','save','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','model','differenceBy','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','update','body','create','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis'];(function(_0x54597a,_0x4ea42f){var _0x5a764f=function(_0x5c000b){while(--_0x5c000b){_0x54597a['push'](_0x54597a['shift']());}};_0x5a764f(++_0x4ea42f);}(_0xb54d,0xa3));var _0xdb54=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0xb54d[_0x498334];return _0x13bb70;};'use strict';var emlformat=require(_0xdb54('0x0'));var rimraf=require(_0xdb54('0x1'));var zipdir=require(_0xdb54('0x2'));var jsonpatch=require(_0xdb54('0x3'));var rp=require(_0xdb54('0x4'));var moment=require(_0xdb54('0x5'));var BPromise=require(_0xdb54('0x6'));var Mustache=require('mustache');var util=require(_0xdb54('0x7'));var path=require(_0xdb54('0x8'));var sox=require(_0xdb54('0x9'));var csv=require(_0xdb54('0xa'));var ejs=require(_0xdb54('0xb'));var fs=require('fs');var fs_extra=require(_0xdb54('0xc'));var _=require('lodash');var squel=require(_0xdb54('0xd'));var crypto=require(_0xdb54('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdb54('0xa'));var querystring=require('querystring');var Papa=require(_0xdb54('0xf'));var Redis=require(_0xdb54('0x10'));var authService=require(_0xdb54('0x11'));var qs=require(_0xdb54('0x12'));var as=require(_0xdb54('0x13'));var hardwareService=require(_0xdb54('0x14'));var logger=require(_0xdb54('0x15'))(_0xdb54('0x16'));var utils=require(_0xdb54('0x17'));var config=require(_0xdb54('0x18'));var licenseUtil=require(_0xdb54('0x19'));var db=require(_0xdb54('0x1a'))['db'];function respondWithStatusCode(_0x150196,_0x4885b7){_0x4885b7=_0x4885b7||0xcc;return function(_0x4326f1){if(_0x4326f1){return _0x150196[_0xdb54('0x1b')](_0x4885b7);}return _0x150196[_0xdb54('0x1c')](_0x4885b7)[_0xdb54('0x1d')]();};}function respondWithResult(_0x1f8514,_0x1e23df){_0x1e23df=_0x1e23df||0xc8;return function(_0x109a1e){if(_0x109a1e){return _0x1f8514[_0xdb54('0x1c')](_0x1e23df)[_0xdb54('0x1e')](_0x109a1e);}};}function respondWithFilteredResult(_0xf20eac,_0x224c81){return function(_0x5dce2){if(_0x5dce2){var _0x13b6c8=typeof _0x224c81[_0xdb54('0x1f')]===_0xdb54('0x20')&&typeof _0x224c81[_0xdb54('0x21')]===_0xdb54('0x20');var _0x427913=_0x5dce2[_0xdb54('0x22')];var _0x4b4a37=_0x13b6c8?0x0:_0x224c81[_0xdb54('0x1f')];var _0x550ae1=_0x13b6c8?_0x5dce2['count']:_0x224c81[_0xdb54('0x1f')]+_0x224c81[_0xdb54('0x21')];var _0x241edc;if(_0x550ae1>=_0x427913){_0x550ae1=_0x427913;_0x241edc=0xc8;}else{_0x241edc=0xce;}_0xf20eac[_0xdb54('0x1c')](_0x241edc);return _0xf20eac[_0xdb54('0x23')](_0xdb54('0x24'),_0x4b4a37+'-'+_0x550ae1+'/'+_0x427913)['json'](_0x5dce2);}return null;};}function patchUpdates(_0x579454){return function(_0x1012b4){try{jsonpatch['apply'](_0x1012b4,_0x579454,!![]);}catch(_0x296636){return BPromise[_0xdb54('0x25')](_0x296636);}return _0x1012b4[_0xdb54('0x26')]();};}function saveUpdates(_0x4fdb8d,_0x2e762d){return function(_0x1b677f){if(_0x1b677f){return _0x1b677f['update'](_0x4fdb8d)[_0xdb54('0x27')](function(_0x5a2dda){return _0x5a2dda;});}return null;};}function removeEntity(_0x2016c8,_0x509247){return function(_0x562007){if(_0x562007){return _0x562007[_0xdb54('0x28')]()[_0xdb54('0x27')](function(){_0x2016c8[_0xdb54('0x1c')](0xcc)[_0xdb54('0x1d')]();});}};}function handleEntityNotFound(_0xecfd58,_0x8fa7a1){return function(_0x406f19){if(!_0x406f19){_0xecfd58[_0xdb54('0x1b')](0x194);}return _0x406f19;};}function handleError(_0x405cfe,_0x105fdb){_0x105fdb=_0x105fdb||0x1f4;return function(_0x2f2c5b){logger[_0xdb54('0x29')](_0x2f2c5b[_0xdb54('0x2a')]);if(_0x2f2c5b['name']){delete _0x2f2c5b[_0xdb54('0x2b')];}_0x405cfe[_0xdb54('0x1c')](_0x105fdb)[_0xdb54('0x2c')](_0x2f2c5b);};}exports[_0xdb54('0x2d')]=function(_0x1ced7a,_0x47c661){var _0x4d1bdd={},_0x1d8422={},_0x2b7e2f={'count':0x0,'rows':[]};var _0x5f2cb1=_[_0xdb54('0x2e')](db[_0xdb54('0x2f')][_0xdb54('0x30')],function(_0x23c7a6){return{'name':_0x23c7a6['fieldName'],'type':_0x23c7a6[_0xdb54('0x31')]['key']};});_0x1d8422[_0xdb54('0x32')]=_[_0xdb54('0x33')](_[_0xdb54('0x2e')](_0x5f2cb1,_0xdb54('0x2b')),[_0xdb54('0x2b')]);_0x1d8422[_0xdb54('0x34')]=_[_0xdb54('0x35')](_0x1ced7a['query']);_0x1d8422[_0xdb54('0x36')]=_['intersection'](_0x1d8422['model'],_0x1d8422[_0xdb54('0x34')]);_0x4d1bdd[_0xdb54('0x37')]=_[_0xdb54('0x38')](_0x1d8422[_0xdb54('0x32')],qs[_0xdb54('0x39')](_0x1ced7a['query'][_0xdb54('0x39')]));_0x4d1bdd[_0xdb54('0x37')]=_0x4d1bdd['attributes']['length']?_0x4d1bdd['attributes']:_0x1d8422[_0xdb54('0x32')];if(!_0x1ced7a[_0xdb54('0x34')][_0xdb54('0x3a')]('nolimit')){_0x4d1bdd[_0xdb54('0x21')]=qs[_0xdb54('0x21')](_0x1ced7a[_0xdb54('0x34')][_0xdb54('0x21')]);_0x4d1bdd[_0xdb54('0x1f')]=qs[_0xdb54('0x1f')](_0x1ced7a[_0xdb54('0x34')]['offset']);}_0x4d1bdd['order']=qs[_0xdb54('0x3b')](_0x1ced7a[_0xdb54('0x34')][_0xdb54('0x3b')]);_0x4d1bdd[_0xdb54('0x3c')]=qs['filters'](_[_0xdb54('0x3d')](_0x1ced7a['query'],_0x1d8422[_0xdb54('0x36')]),_0x5f2cb1);if(_0x1ced7a[_0xdb54('0x34')][_0xdb54('0x3e')]){_0x4d1bdd[_0xdb54('0x3c')]=_[_0xdb54('0x3f')](_0x4d1bdd['where'],{'$or':_[_0xdb54('0x2e')](_0x5f2cb1,function(_0x618bdd){if(_0x618bdd[_0xdb54('0x31')]!==_0xdb54('0x40')){var _0x29b9e8={};_0x29b9e8[_0x618bdd['name']]={'$like':'%'+_0x1ced7a['query']['filter']+'%'};return _0x29b9e8;}})});}_0x4d1bdd=_['merge']({},_0x4d1bdd,_0x1ced7a[_0xdb54('0x41')]);var _0x14e5bc={'where':_0x4d1bdd['where']};return db[_0xdb54('0x2f')]['count'](_0x14e5bc)[_0xdb54('0x27')](function(_0x3c7417){_0x2b7e2f[_0xdb54('0x22')]=_0x3c7417;if(_0x1ced7a[_0xdb54('0x34')][_0xdb54('0x42')]){_0x4d1bdd[_0xdb54('0x43')]=[{'all':!![]}];}return db[_0xdb54('0x2f')][_0xdb54('0x44')](_0x4d1bdd);})[_0xdb54('0x27')](function(_0x3c47c4){_0x2b7e2f[_0xdb54('0x45')]=_0x3c47c4;return _0x2b7e2f;})['then'](respondWithFilteredResult(_0x47c661,_0x4d1bdd))['catch'](handleError(_0x47c661,null));};exports[_0xdb54('0x46')]=function(_0x7fbfbc,_0xf8aa3e){var _0x384c58={'raw':!![],'where':{'id':_0x7fbfbc[_0xdb54('0x47')]['id']}},_0x187c6e={};_0x187c6e[_0xdb54('0x32')]=_[_0xdb54('0x35')](db[_0xdb54('0x2f')][_0xdb54('0x30')]);_0x187c6e['query']=_[_0xdb54('0x35')](_0x7fbfbc[_0xdb54('0x34')]);_0x187c6e[_0xdb54('0x36')]=_[_0xdb54('0x38')](_0x187c6e[_0xdb54('0x32')],_0x187c6e['query']);_0x384c58['attributes']=_['intersection'](_0x187c6e[_0xdb54('0x32')],qs[_0xdb54('0x39')](_0x7fbfbc[_0xdb54('0x34')]['fields']));_0x384c58[_0xdb54('0x37')]=_0x384c58['attributes'][_0xdb54('0x48')]?_0x384c58[_0xdb54('0x37')]:_0x187c6e[_0xdb54('0x32')];if(_0x7fbfbc[_0xdb54('0x34')][_0xdb54('0x42')]){_0x384c58[_0xdb54('0x43')]=[{'all':!![]}];}_0x384c58=_[_0xdb54('0x3f')]({},_0x384c58,_0x7fbfbc[_0xdb54('0x41')]);return db[_0xdb54('0x2f')][_0xdb54('0x49')](_0x384c58)[_0xdb54('0x27')](handleEntityNotFound(_0xf8aa3e,null))[_0xdb54('0x27')](respondWithResult(_0xf8aa3e,null))[_0xdb54('0x4a')](handleError(_0xf8aa3e,null));};exports[_0xdb54('0x4b')]=function(_0x6ab6b,_0x403f91){if(_0x6ab6b['body']['id']){delete _0x6ab6b[_0xdb54('0x4c')]['id'];}return db[_0xdb54('0x2f')][_0xdb54('0x49')]({'where':{'id':_0x6ab6b[_0xdb54('0x47')]['id']}})[_0xdb54('0x27')](handleEntityNotFound(_0x403f91,null))[_0xdb54('0x27')](saveUpdates(_0x6ab6b[_0xdb54('0x4c')],null))[_0xdb54('0x27')](respondWithResult(_0x403f91,null))[_0xdb54('0x4a')](handleError(_0x403f91,null));};exports['destroy']=function(_0x529789,_0x3e4b1d){return db[_0xdb54('0x2f')][_0xdb54('0x49')]({'where':{'id':_0x529789[_0xdb54('0x47')]['id']}})[_0xdb54('0x27')](handleEntityNotFound(_0x3e4b1d,null))[_0xdb54('0x27')](removeEntity(_0x3e4b1d,null))['catch'](handleError(_0x3e4b1d,null));};exports['create']=function(_0x314dc6,_0x3a4ad0){var _0x3e1deb;return db['sequelize']['transaction'](function(_0x8684c){return db[_0xdb54('0x2f')][_0xdb54('0x4d')](_0x314dc6[_0xdb54('0x4c')],{'transaction':_0x8684c})['then'](function(_0x21859c){_0x3e1deb=_0x21859c;var _0x3f196f={'type':db[_0xdb54('0x4e')]['TEXT'],'transaction':_0x8684c};switch(_0x314dc6['body']['type']){case _0xdb54('0x4f'):_0x3f196f['type']=db['Sequelize'][_0xdb54('0x50')];break;case _0xdb54('0x51'):_0x3f196f[_0xdb54('0x31')]=db[_0xdb54('0x4e')][_0xdb54('0x52')];break;case _0xdb54('0x53'):_0x3f196f['type']=db[_0xdb54('0x4e')][_0xdb54('0x54')];_0x3f196f[_0xdb54('0x55')]=![];break;default:}return db[_0xdb54('0x56')]['queryInterface'][_0xdb54('0x57')](_0xdb54('0x58'),util[_0xdb54('0x59')]('cf_%d',_0x3e1deb['id']),_0x3f196f);})['then'](function(){return _0x3e1deb;});})['then'](respondWithResult(_0x3a4ad0,0xc9))[_0xdb54('0x4a')](handleError(_0x3a4ad0,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 468f49e..ba843e8 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 _0xde30=['./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7c18b1,_0x50cbc9){var _0x5140a2=function(_0x4afdac){while(--_0x4afdac){_0x7c18b1['push'](_0x7c18b1['shift']());}};_0x5140a2(++_0x50cbc9);}(_0xde30,0xb9));var _0x0de3=function(_0x407cd5,_0x5b8281){_0x407cd5=_0x407cd5-0x0;var _0x80846f=_0xde30[_0x407cd5];return _0x80846f;};'use strict';var _=require(_0x0de3('0x0'));var util=require(_0x0de3('0x1'));var logger=require(_0x0de3('0x2'))(_0x0de3('0x3'));var moment=require(_0x0de3('0x4'));var BPromise=require(_0x0de3('0x5'));var rp=require(_0x0de3('0x6'));var fs=require('fs');var path=require(_0x0de3('0x7'));var rimraf=require(_0x0de3('0x8'));var config=require(_0x0de3('0x9'));var attributes=require(_0x0de3('0xa'));module[_0x0de3('0xb')]=function(_0x314fc3,_0x103b65){return _0x314fc3[_0x0de3('0xc')](_0x0de3('0xd'),attributes,{'tableName':_0x0de3('0xe'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf22a=['define','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b13a4,_0xb9fa20){var _0x501041=function(_0x428b13){while(--_0x428b13){_0x4b13a4['push'](_0x4b13a4['shift']());}};_0x501041(++_0xb9fa20);}(_0xf22a,0x1ec));var _0xaf22=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xf22a[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xaf22('0x0'));var util=require('util');var logger=require(_0xaf22('0x1'))(_0xaf22('0x2'));var moment=require(_0xaf22('0x3'));var BPromise=require(_0xaf22('0x4'));var rp=require(_0xaf22('0x5'));var fs=require('fs');var path=require(_0xaf22('0x6'));var rimraf=require(_0xaf22('0x7'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x2d0319,_0x119d0e){return _0x2d0319[_0xaf22('0x8')]('CmCustomField',attributes,{'tableName':_0xaf22('0x9'),'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 81ca508..99f14e7 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 _0x5d53=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmCustomField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2ecd75,_0x1daaef){var _0x46505f=function(_0xd3bc96){while(--_0xd3bc96){_0x2ecd75['push'](_0x2ecd75['shift']());}};_0x46505f(++_0x1daaef);}(_0x5d53,0x104));var _0x35d5=function(_0x225815,_0x5db310){_0x225815=_0x225815-0x0;var _0x47a32e=_0x5d53[_0x225815];return _0x47a32e;};'use strict';var _=require(_0x35d5('0x0'));var util=require(_0x35d5('0x1'));var moment=require(_0x35d5('0x2'));var BPromise=require(_0x35d5('0x3'));var rs=require(_0x35d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35d5('0x5'))['db'];var utils=require(_0x35d5('0x6'));var logger=require(_0x35d5('0x7'))(_0x35d5('0x8'));var config=require(_0x35d5('0x9'));var jayson=require(_0x35d5('0xa'));var client=jayson['client'][_0x35d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d4094,_0x5559ba,_0x1da55e){return new BPromise(function(_0x26a7ea,_0x18f6ab){return client['request'](_0x2d4094,_0x1da55e)[_0x35d5('0xc')](function(_0x74a984){logger[_0x35d5('0xd')](_0x35d5('0xe'),_0x5559ba,'request\x20sent');logger[_0x35d5('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5559ba,_0x35d5('0x10'),JSON[_0x35d5('0x11')](_0x74a984));if(_0x74a984['error']){if(_0x74a984[_0x35d5('0x12')]['code']===0x1f4){logger['error'](_0x35d5('0xe'),_0x5559ba,_0x74a984[_0x35d5('0x12')][_0x35d5('0x13')]);return _0x18f6ab(_0x74a984['error'][_0x35d5('0x13')]);}logger['error'](_0x35d5('0xe'),_0x5559ba,_0x74a984[_0x35d5('0x12')][_0x35d5('0x13')]);return _0x26a7ea(_0x74a984[_0x35d5('0x12')][_0x35d5('0x13')]);}else{logger['info'](_0x35d5('0xe'),_0x5559ba,_0x35d5('0x10'));_0x26a7ea(_0x74a984[_0x35d5('0x14')][_0x35d5('0x13')]);}})[_0x35d5('0x15')](function(_0x25ae7e){logger[_0x35d5('0x12')](_0x35d5('0xe'),_0x5559ba,_0x25ae7e);_0x18f6ab(_0x25ae7e);});});} \ No newline at end of file +var _0x2455=['rpc','../../config/environment','jayson/promise','client','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x1116ac,_0xcbe059){var _0x3e806b=function(_0x33b585){while(--_0x33b585){_0x1116ac['push'](_0x1116ac['shift']());}};_0x3e806b(++_0xcbe059);}(_0x2455,0x19c));var _0x5245=function(_0x5e7979,_0x4175c0){_0x5e7979=_0x5e7979-0x0;var _0x50f569=_0x2455[_0x5e7979];return _0x50f569;};'use strict';var _=require(_0x5245('0x0'));var util=require(_0x5245('0x1'));var moment=require(_0x5245('0x2'));var BPromise=require(_0x5245('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5245('0x4'))['db'];var utils=require(_0x5245('0x5'));var logger=require('../../config/logger')(_0x5245('0x6'));var config=require(_0x5245('0x7'));var jayson=require(_0x5245('0x8'));var client=jayson[_0x5245('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ab414,_0x1f32ea,_0x3159ac){return new BPromise(function(_0x2eb16f,_0x523331){return client[_0x5245('0xa')](_0x4ab414,_0x3159ac)['then'](function(_0x56199a){logger['info'](_0x5245('0xb'),_0x1f32ea,_0x5245('0xc'));logger[_0x5245('0xd')](_0x5245('0xe'),_0x1f32ea,_0x5245('0xc'),JSON[_0x5245('0xf')](_0x56199a));if(_0x56199a[_0x5245('0x10')]){if(_0x56199a[_0x5245('0x10')][_0x5245('0x11')]===0x1f4){logger[_0x5245('0x10')](_0x5245('0xb'),_0x1f32ea,_0x56199a[_0x5245('0x10')][_0x5245('0x12')]);return _0x523331(_0x56199a[_0x5245('0x10')][_0x5245('0x12')]);}logger['error'](_0x5245('0xb'),_0x1f32ea,_0x56199a[_0x5245('0x10')]['message']);return _0x2eb16f(_0x56199a[_0x5245('0x10')][_0x5245('0x12')]);}else{logger[_0x5245('0x13')]('CmCustomField,\x20%s,\x20%s',_0x1f32ea,_0x5245('0xc'));_0x2eb16f(_0x56199a[_0x5245('0x14')][_0x5245('0x12')]);}})[_0x5245('0x15')](function(_0x39ebed){logger[_0x5245('0x10')](_0x5245('0xb'),_0x1f32ea,_0x39ebed);_0x523331(_0x39ebed);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a8ef7e7..b33e5cd 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 _0x5419=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x27c401,_0x592dab){var _0x263b74=function(_0x55f9ce){while(--_0x55f9ce){_0x27c401['push'](_0x27c401['shift']());}};_0x263b74(++_0x592dab);}(_0x5419,0x175));var _0x9541=function(_0x549829,_0x3b5bd5){_0x549829=_0x549829-0x0;var _0x554e92=_0x5419[_0x549829];return _0x554e92;};'use strict';var multer=require(_0x9541('0x0'));var util=require(_0x9541('0x1'));var path=require(_0x9541('0x2'));var timeout=require(_0x9541('0x3'));var express=require(_0x9541('0x4'));var router=express[_0x9541('0x5')]();var fs_extra=require(_0x9541('0x6'));var auth=require(_0x9541('0x7'));var interaction=require(_0x9541('0x8'));var config=require(_0x9541('0x9'));var controller=require('./cmCustomField.controller');router[_0x9541('0xa')]('/',auth[_0x9541('0xb')](),controller[_0x9541('0xc')]);router[_0x9541('0xa')](_0x9541('0xd'),auth[_0x9541('0xb')](),controller[_0x9541('0xe')]);router[_0x9541('0xf')]('/',auth['isAuthenticated'](),controller[_0x9541('0x10')]);router['put'](_0x9541('0xd'),auth[_0x9541('0xb')](),controller[_0x9541('0x11')]);router[_0x9541('0x12')](_0x9541('0xd'),auth[_0x9541('0xb')](),controller[_0x9541('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb175=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','isAuthenticated','index','get','/:id','show','post','put'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb175,0x1a4));var _0x5b17=function(_0x34e506,_0x542966){_0x34e506=_0x34e506-0x0;var _0x298d4a=_0xb175[_0x34e506];return _0x298d4a;};'use strict';var multer=require(_0x5b17('0x0'));var util=require(_0x5b17('0x1'));var path=require(_0x5b17('0x2'));var timeout=require(_0x5b17('0x3'));var express=require('express');var router=express[_0x5b17('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('./cmCustomField.controller');router['get']('/',auth[_0x5b17('0x5')](),controller[_0x5b17('0x6')]);router[_0x5b17('0x7')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0x9')]);router[_0x5b17('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5b17('0xb')]('/:id',auth[_0x5b17('0x5')](),controller[_0x5b17('0xc')]);router[_0x5b17('0xd')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0xe')]);module[_0x5b17('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 2ae0610..21eb081 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 _0x3247=['moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue'];(function(_0x3464d7,_0x3935b8){var _0x25f085=function(_0x53bffa){while(--_0x53bffa){_0x3464d7['push'](_0x3464d7['shift']());}};_0x25f085(++_0x3935b8);}(_0x3247,0x1a7));var _0x7324=function(_0x119ea4,_0x5816f6){_0x119ea4=_0x119ea4-0x0;var _0x3cece4=_0x3247[_0x119ea4];return _0x3cece4;};'use strict';var moment=require(_0x7324('0x0'));var Sequelize=require(_0x7324('0x1'));module[_0x7324('0x2')]={'phone':{'type':Sequelize[_0x7324('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x7324('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7324('0x5')],'defaultValue':moment()['format'](_0x7324('0x6'))},'countbusyretry':{'type':Sequelize[_0x7324('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7324('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7324('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7324('0x5')]},'priority':{'type':Sequelize[_0x7324('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7324('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7324('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x7324('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x7324('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x7324('0x8')},'CampaignId':{'type':Sequelize[_0x7324('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x7324('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7324('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7324('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7324('0x7')],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file +var _0x307d=['contactListQueue','moment','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x39036f,_0x284392){var _0x184dd1=function(_0x49d792){while(--_0x49d792){_0x39036f['push'](_0x39036f['shift']());}};_0x184dd1(++_0x284392);}(_0x307d,0x9a));var _0xd307=function(_0x44ee72,_0x5723bb){_0x44ee72=_0x44ee72-0x0;var _0x35cb71=_0x307d[_0x44ee72];return _0x35cb71;};'use strict';var moment=require(_0xd307('0x0'));var Sequelize=require('sequelize');module[_0xd307('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xd307('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd307('0x3')],'defaultValue':moment()[_0xd307('0x4')](_0xd307('0x5'))},'countbusyretry':{'type':Sequelize[_0xd307('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd307('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd307('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xd307('0x6')](0x2)[_0xd307('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xd307('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xd307('0x8')},'UserId':{'type':Sequelize[_0xd307('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xd307('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xd307('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd307('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd307('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd307('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index c2f9522..1a27795 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 _0x9a19=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','map','CmHopper','fieldName','type','key','model','query','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','update','describe','CampaignId','VoiceQueueId','Campaign','omit','dataValues','updatedAt','state','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','getVoiceQueues','outbound','preview','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','literal','scheduledAt','phone','LOCK','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9a19,0x114));var _0x99a1=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x9a19[_0x10852d];return _0x13a8d6;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0x3c813,_0x491341){return function(_0x4fe7f7){if(!_0x4fe7f7){_0x3c813[_0x99a1('0x19')](0x194);}return _0x4fe7f7;};}function handleError(_0x5dabd9,_0x5dc733){_0x5dc733=_0x5dc733||0x1f4;return function(_0xafea84){logger[_0x99a1('0x25')](_0xafea84[_0x99a1('0x26')]);if(_0xafea84[_0x99a1('0x27')]){delete _0xafea84[_0x99a1('0x27')];}_0x5dabd9[_0x99a1('0x1a')](_0x5dc733)[_0x99a1('0x28')](_0xafea84);};}exports['index']=function(_0xf41b0d,_0x499eef){var _0x255197={},_0x1137f2={},_0x26fbae={'count':0x0,'rows':[]};var _0x523668=_[_0x99a1('0x29')](db[_0x99a1('0x2a')]['rawAttributes'],function(_0x37514e){return{'name':_0x37514e[_0x99a1('0x2b')],'type':_0x37514e[_0x99a1('0x2c')][_0x99a1('0x2d')]};});_0x1137f2[_0x99a1('0x2e')]=_[_0x99a1('0x29')](_0x523668,_0x99a1('0x27'));_0x1137f2[_0x99a1('0x2f')]=_['keys'](_0xf41b0d['query']);_0x1137f2[_0x99a1('0x30')]=_['intersection'](_0x1137f2[_0x99a1('0x2e')],_0x1137f2[_0x99a1('0x2f')]);_0x1137f2['filters']=_[_0x99a1('0x31')](_0x1137f2[_0x99a1('0x30')],[_0x99a1('0x32'),_0x99a1('0x33'),_0x99a1('0x34'),_0x99a1('0x35'),_0x99a1('0x36'),_0x99a1('0x37'),_0x99a1('0x38'),_0x99a1('0x39'),_0x99a1('0x3a'),_0x99a1('0x3b'),_0x99a1('0x3c'),_0x99a1('0x3d'),'$notIn','$like',_0x99a1('0x3e'),_0x99a1('0x3f'),_0x99a1('0x40'),_0x99a1('0x41'),_0x99a1('0x42'),_0x99a1('0x43'),_0x99a1('0x44'),'$any']);_0x255197[_0x99a1('0x45')]=_[_0x99a1('0x46')](_0x1137f2['model'],qs[_0x99a1('0x47')](_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x47')]));_0x255197[_0x99a1('0x45')]=_0x255197[_0x99a1('0x45')][_0x99a1('0x48')]?_0x255197[_0x99a1('0x45')]:_0x1137f2[_0x99a1('0x2e')];if(!_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x49')](_0x99a1('0x4a'))){_0x255197[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0xf41b0d['query']['limit']);_0x255197['offset']=qs[_0x99a1('0x1c')](_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x1c')]);}_0x255197[_0x99a1('0x4b')]=qs[_0x99a1('0x4c')](_0xf41b0d['query'][_0x99a1('0x4c')]);_0x255197[_0x99a1('0x4d')]=qs[_0x99a1('0x30')](_['pick'](_0xf41b0d['query'],_0x1137f2[_0x99a1('0x30')]),_0x523668);if(_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x4e')]){_0x255197['where']=_[_0x99a1('0x4f')](_0x255197[_0x99a1('0x4d')],{'$or':_[_0x99a1('0x29')](_0x523668,function(_0x394762){if(_0x394762[_0x99a1('0x2c')]!==_0x99a1('0x50')){var _0x8b49a6={};_0x8b49a6[_0x394762[_0x99a1('0x27')]]={'$like':'%'+_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x4e')]+'%'};return _0x8b49a6;}})});}_0x255197=_['merge']({},_0x255197,_0xf41b0d[_0x99a1('0x51')]);var _0x45e558={'where':_0x255197[_0x99a1('0x4d')]};return db['CmHopper'][_0x99a1('0x1f')](_0x45e558)['then'](function(_0x1cf24c){_0x26fbae[_0x99a1('0x1f')]=_0x1cf24c;if(_0xf41b0d[_0x99a1('0x2f')][_0x99a1('0x52')]){_0x255197[_0x99a1('0x53')]=[{'all':!![]}];}return db[_0x99a1('0x2a')]['findAll'](_0x255197);})[_0x99a1('0x23')](function(_0x49730f){_0x26fbae[_0x99a1('0x54')]=_0x49730f;return _0x26fbae;})[_0x99a1('0x23')](respondWithFilteredResult(_0x499eef,_0x255197))[_0x99a1('0x55')](handleError(_0x499eef,null));};exports[_0x99a1('0x56')]=function(_0x3a0b44,_0x67992){var _0x31db25={'raw':!![],'where':{'id':_0x3a0b44[_0x99a1('0x57')]['id']}},_0x3861b6={};_0x3861b6[_0x99a1('0x2e')]=_[_0x99a1('0x58')](db['CmHopper'][_0x99a1('0x59')]);_0x3861b6[_0x99a1('0x2f')]=_['keys'](_0x3a0b44[_0x99a1('0x2f')]);_0x3861b6[_0x99a1('0x30')]=_[_0x99a1('0x46')](_0x3861b6[_0x99a1('0x2e')],_0x3861b6[_0x99a1('0x2f')]);_0x31db25[_0x99a1('0x45')]=_[_0x99a1('0x46')](_0x3861b6['model'],qs[_0x99a1('0x47')](_0x3a0b44['query'][_0x99a1('0x47')]));_0x31db25[_0x99a1('0x45')]=_0x31db25['attributes']['length']?_0x31db25[_0x99a1('0x45')]:_0x3861b6[_0x99a1('0x2e')];if(_0x3a0b44[_0x99a1('0x2f')][_0x99a1('0x52')]){_0x31db25[_0x99a1('0x53')]=[{'all':!![]}];}_0x31db25=_['merge']({},_0x31db25,_0x3a0b44['options']);return db['CmHopper'][_0x99a1('0x5a')](_0x31db25)[_0x99a1('0x23')](handleEntityNotFound(_0x67992,null))[_0x99a1('0x23')](respondWithResult(_0x67992,null))[_0x99a1('0x55')](handleError(_0x67992,null));};exports[_0x99a1('0x5b')]=function(_0x9d9148,_0x1059b1){return db['CmHopper'][_0x99a1('0x5b')](_0x9d9148[_0x99a1('0x5c')],{})[_0x99a1('0x23')](respondWithResult(_0x1059b1,0xc9))['catch'](handleError(_0x1059b1,null));};exports[_0x99a1('0x5d')]=function(_0x4c517c,_0x53d402){if(_0x4c517c[_0x99a1('0x5c')]['id']){delete _0x4c517c[_0x99a1('0x5c')]['id'];}return db[_0x99a1('0x2a')][_0x99a1('0x5a')]({'where':{'id':_0x4c517c[_0x99a1('0x57')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53d402,null))[_0x99a1('0x23')](saveUpdates(_0x4c517c[_0x99a1('0x5c')],null))[_0x99a1('0x23')](respondWithResult(_0x53d402,null))['catch'](handleError(_0x53d402,null));};exports[_0x99a1('0x5e')]=function(_0x557879,_0x30cc97){return db[_0x99a1('0x2a')]['describe']()[_0x99a1('0x23')](respondWithResult(_0x30cc97,null))[_0x99a1('0x55')](handleError(_0x30cc97,null));};exports[_0x99a1('0x24')]=function(_0x2b2d63,_0x2800d5){var _0x1bff78;var _0x157c49=_0x2b2d63[_0x99a1('0x57')]['id'];return db[_0x99a1('0x2a')][_0x99a1('0x5a')]({'where':{'id':_0x2b2d63[_0x99a1('0x57')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x2800d5,null))['then'](function(_0x4f64b7){if(_0x4f64b7){return _0x4f64b7[_0x99a1('0x24')]()[_0x99a1('0x23')](function(_0x28caeb){return _0x28caeb;});}})[_0x99a1('0x23')](function(_0x213719){_0x1bff78=_0x213719;if(_0x213719){if(_0x213719['VoiceQueueId']||_0x213719[_0x99a1('0x5f')]){return db[_0x213719[_0x99a1('0x60')]?'VoiceQueue':_0x99a1('0x61')][_0x99a1('0x5a')]({'where':{'id':_0x213719[_0x99a1('0x60')]?_0x213719[_0x99a1('0x60')]:_0x213719[_0x99a1('0x5f')]},'attributes':['id','name'],'raw':!![]});}}})[_0x99a1('0x23')](function(_0x257331){var _0x1bb1cb={};if(_0x257331){_[_0x99a1('0x4f')](_0x1bb1cb,_[_0x99a1('0x62')](_0x1bff78[_0x99a1('0x63')],['createdAt',_0x99a1('0x64'),'id']));_0x1bb1cb[_0x99a1('0x65')]=0x15;_0x1bb1cb['statedesc']=_0x99a1('0x66');_0x1bb1cb[_0x99a1('0x67')]=_0x257331[_0x99a1('0x27')];_0x1bb1cb[_0x99a1('0x68')]=_0x2b2d63[_0x99a1('0x69')]['name'];_0x1bb1cb[_0x99a1('0x6a')]=_0x2b2d63['user']['id'];_0x1bb1cb['deleted']=!![];_0x1bb1cb['deletedat']=moment()[_0x99a1('0x6b')](_0x99a1('0x6c'));_0x1bb1cb['calleridnum']=_0x1bff78['phone'];_0x1bb1cb[_0x99a1('0x6d')]=_0x1bff78['VoiceQueueId']?_0x99a1('0x6e'):_0x99a1('0x6f');return db[_0x99a1('0x70')][_0x99a1('0x5a')]({'where':{'id':_0x1bb1cb['ContactId']},'attributes':[_0x99a1('0x71'),_0x99a1('0x72')]})[_0x99a1('0x23')](function(_0x4fbfb3){if(!_[_0x99a1('0x73')](_0x2800d5)&&!_['isNil'](_0x4fbfb3[_0x99a1('0x71')])){_0x1bb1cb[_0x99a1('0x74')]=_0x4fbfb3[_0x99a1('0x71')];if(!_[_0x99a1('0x73')](_0x4fbfb3[_0x99a1('0x72')])){_0x1bb1cb['calleridname']+='\x20'+_0x4fbfb3['lastName'];}}})['finally'](function(){return db[_0x99a1('0x75')][_0x99a1('0x5b')](_0x1bb1cb);});}})['then'](function(_0x490ced){return db[_0x99a1('0x76')][_0x99a1('0x24')]({'where':{'CmHopperId':_0x157c49}});})[_0x99a1('0x23')](function(){return _0x2800d5['status'](0xcc)['end']();})[_0x99a1('0x55')](handleError(_0x2800d5,null));};exports['getPreview']=function(_0x2770fd,_0x129690,_0x32373b){var _0x4b946b=[];return db[_0x99a1('0x70')][_0x99a1('0x5e')]()['then'](function(_0x4c14ed){_0x4b946b=_[_0x99a1('0x58')](_0x4c14ed);return _0x2770fd['user'][_0x99a1('0x77')]({'where':{'type':_0x99a1('0x78'),'dialActive':!![],'dialMethod':_0x99a1('0x79')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x99a1('0x23')](function(_0x35278b){if(_0x35278b&&_0x35278b[_0x99a1('0x48')]){return db[_0x99a1('0x7a')][_0x99a1('0x7b')](function(_0x55033e){var _0x4c574c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x99a1('0x6b')](_0x99a1('0x6c'))},'VoiceQueueId':{'$in':_[_0x99a1('0x29')](_0x35278b,'id')},'$or':[{'UserId':null},{'UserId':_0x2770fd[_0x99a1('0x69')]['id']}]};var _0x500ba8=[];if(_0x2770fd[_0x99a1('0x5c')]['direction']&&_0x2770fd['body'][_0x99a1('0x7c')]===_0x99a1('0x7d')){if(!_[_0x99a1('0x7e')](_0x2770fd['body'][_0x99a1('0x7f')])){_0x4c574c['id']={'$in':_0x2770fd[_0x99a1('0x5c')][_0x99a1('0x7f')]};}_0x500ba8=[[_0x99a1('0x80'),_0x99a1('0x81')],['scheduledAt',_0x35278b[0x0][_0x99a1('0x82')]===_0x99a1('0x81')?_0x99a1('0x83'):_0x99a1('0x81')],db[_0x99a1('0x7a')][_0x99a1('0x84')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x99a1('0x83')]];}else{if(!_[_0x99a1('0x7e')](_0x2770fd[_0x99a1('0x5c')][_0x99a1('0x7f')])){_0x4c574c['id']={'$notIn':_0x2770fd[_0x99a1('0x5c')]['hopperIds']};}_0x500ba8=[[_0x99a1('0x80'),_0x99a1('0x83')],[_0x99a1('0x85'),_0x35278b[0x0][_0x99a1('0x82')]],db[_0x99a1('0x7a')][_0x99a1('0x84')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x99a1('0x81')]];}return db[_0x99a1('0x2a')]['findOne']({'attributes':['id','scheduledat',_0x99a1('0x86')],'where':_0x4c574c,'order':_0x500ba8,'transaction':_0x55033e,'lock':_0x55033e[_0x99a1('0x87')]['UPDATE'],'include':[{'model':db[_0x99a1('0x70')],'as':_0x99a1('0x88'),'attributes':_0x4b946b,'include':[{'model':db[_0x99a1('0x89')],'as':_0x99a1('0x8a'),'attributes':['id',_0x99a1('0x27')]}]},{'model':db[_0x99a1('0x8b')],'as':_0x99a1('0x8c'),'attributes':['id',_0x99a1('0x27')]},{'model':db[_0x99a1('0x8d')],'as':_0x99a1('0x8e'),'attributes':['id',_0x99a1('0x27'),_0x99a1('0x8f')]}]})[_0x99a1('0x23')](function(_0x597cb7){if(_0x597cb7){return _0x597cb7[_0x99a1('0x5d')]({'UserId':_0x2770fd['user']['id']},{'transaction':_0x55033e});}});});}})['then'](handleEntityNotFound(_0x129690,null))[_0x99a1('0x23')](respondWithResult(_0x129690,null))[_0x99a1('0x55')](handleError(_0x129690,null));};exports[_0x99a1('0x90')]=function(_0x3676eb,_0xbbbe26,_0x470514){return _0x3676eb[_0x99a1('0x69')][_0x99a1('0x77')]({'where':{'type':_0x99a1('0x78'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x99a1('0x23')](function(_0x17ebe7){if(_0x17ebe7&&_0x17ebe7[_0x99a1('0x48')]){return db[_0x99a1('0x2a')][_0x99a1('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x99a1('0x6b')](_0x99a1('0x6c'))},'VoiceQueueId':{'$in':_[_0x99a1('0x29')](_0x17ebe7,'id')},'$or':[{'UserId':null},{'UserId':_0x3676eb['user']['id']}]}});}return 0x0;})['then'](function(_0x51c289){if(!_[_0x99a1('0x73')](_0x51c289)&&_[_0x99a1('0x91')](_0x51c289)){return _0xbbbe26['status'](0xc8)[_0x99a1('0x92')]({'contacts':_0x51c289});}else{logger[_0x99a1('0x25')](_0x99a1('0x93'),_0x99a1('0x90'),0x194,'entity\x20not\x20found');_0xbbbe26[_0x99a1('0x19')](0x194);}})[_0x99a1('0x55')](handleError(_0xbbbe26,null));}; \ No newline at end of file +var _0xedd9=['count','set','apply','then','end','error','stack','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','update','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','state','deleted','campaign','membername','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','CmContact','ContactId','lastName','isNil','firstName','finally','outbound','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xedd9,0xfc));var _0x9edd=function(_0x52147f,_0x1b0a35){_0x52147f=_0x52147f-0x0;var _0x5554cf=_0xedd9[_0x52147f];return _0x5554cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x33')](_0x2ae8dd['filters'],[_0x9edd('0x34'),_0x9edd('0x35'),_0x9edd('0x36'),_0x9edd('0x37'),_0x9edd('0x38'),_0x9edd('0x39'),_0x9edd('0x3a'),_0x9edd('0x3b'),_0x9edd('0x3c'),_0x9edd('0x3d'),_0x9edd('0x3e'),_0x9edd('0x3f'),_0x9edd('0x40'),_0x9edd('0x41'),'$notLike',_0x9edd('0x42'),'$notILike',_0x9edd('0x41'),_0x9edd('0x43'),_0x9edd('0x44'),_0x9edd('0x45'),_0x9edd('0x46')]);_0x28cfae['attributes']=_[_0x9edd('0x32')](_0x2ae8dd[_0x9edd('0x2d')],qs[_0x9edd('0x47')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x47')]));_0x28cfae[_0x9edd('0x48')]=_0x28cfae[_0x9edd('0x48')][_0x9edd('0x49')]?_0x28cfae[_0x9edd('0x48')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a['query'][_0x9edd('0x4a')]('nolimit')){_0x28cfae[_0x9edd('0x1d')]=qs['limit'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1d')]);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x4b')]=qs['sort'](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x4c')]=qs[_0x9edd('0x31')](_['pick'](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x4d')]){_0x28cfae['where']=_[_0x9edd('0x4e')](_0x28cfae['where'],{'$or':_[_0x9edd('0x27')](_0x5eccfb,function(_0xc1e657){if(_0xc1e657['type']!==_0x9edd('0x4f')){var _0x49a128={};_0x49a128[_0xc1e657['name']]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x4d')]+'%'};return _0x49a128;}})});}_0x28cfae=_[_0x9edd('0x4e')]({},_0x28cfae,_0x52746a[_0x9edd('0x50')]);var _0x25e6ec={'where':_0x28cfae[_0x9edd('0x4c')]};return db[_0x9edd('0x28')][_0x9edd('0x1e')](_0x25e6ec)[_0x9edd('0x21')](function(_0x2b081a){_0x41af53[_0x9edd('0x1e')]=_0x2b081a;if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x51')]){_0x28cfae[_0x9edd('0x52')]=[{'all':!![]}];}return db[_0x9edd('0x28')]['findAll'](_0x28cfae);})[_0x9edd('0x21')](function(_0x2570e3){_0x41af53[_0x9edd('0x53')]=_0x2570e3;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x54')](handleError(_0x238b22,null));};exports[_0x9edd('0x55')]=function(_0x10d41e,_0x4e9ad1){var _0x4a4656={'raw':!![],'where':{'id':_0x10d41e[_0x9edd('0x56')]['id']}},_0x4bc7a1={};_0x4bc7a1['model']=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x4bc7a1[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x10d41e['query']);_0x4bc7a1[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x4bc7a1[_0x9edd('0x2d')],_0x4bc7a1['query']);_0x4a4656[_0x9edd('0x48')]=_[_0x9edd('0x32')](_0x4bc7a1[_0x9edd('0x2d')],qs[_0x9edd('0x47')](_0x10d41e[_0x9edd('0x2f')][_0x9edd('0x47')]));_0x4a4656['attributes']=_0x4a4656[_0x9edd('0x48')][_0x9edd('0x49')]?_0x4a4656['attributes']:_0x4bc7a1[_0x9edd('0x2d')];if(_0x10d41e[_0x9edd('0x2f')]['includeAll']){_0x4a4656[_0x9edd('0x52')]=[{'all':!![]}];}_0x4a4656=_[_0x9edd('0x4e')]({},_0x4a4656,_0x10d41e[_0x9edd('0x50')]);return db['CmHopper'][_0x9edd('0x57')](_0x4a4656)[_0x9edd('0x21')](handleEntityNotFound(_0x4e9ad1,null))[_0x9edd('0x21')](respondWithResult(_0x4e9ad1,null))[_0x9edd('0x54')](handleError(_0x4e9ad1,null));};exports['create']=function(_0x446443,_0x527727){return db[_0x9edd('0x28')]['create'](_0x446443[_0x9edd('0x58')],{})[_0x9edd('0x21')](respondWithResult(_0x527727,0xc9))['catch'](handleError(_0x527727,null));};exports[_0x9edd('0x59')]=function(_0x4e2aaf,_0x336494){if(_0x4e2aaf[_0x9edd('0x58')]['id']){delete _0x4e2aaf[_0x9edd('0x58')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x57')]({'where':{'id':_0x4e2aaf[_0x9edd('0x56')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x336494,null))[_0x9edd('0x21')](saveUpdates(_0x4e2aaf[_0x9edd('0x58')],null))[_0x9edd('0x21')](respondWithResult(_0x336494,null))[_0x9edd('0x54')](handleError(_0x336494,null));};exports['describe']=function(_0x161bea,_0xf617e3){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0xf617e3,null))['catch'](handleError(_0xf617e3,null));};exports['destroy']=function(_0x54ecfa,_0x1348a7){var _0x45f47c;var _0x366316=_0x54ecfa[_0x9edd('0x56')]['id'];return db['CmHopper']['find']({'where':{'id':_0x54ecfa['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x1348a7,null))[_0x9edd('0x21')](function(_0xd5090a){if(_0xd5090a){return _0xd5090a[_0x9edd('0x5a')]()[_0x9edd('0x21')](function(_0x41ec97){return _0x41ec97;});}})[_0x9edd('0x21')](function(_0x1e3087){_0x45f47c=_0x1e3087;if(_0x1e3087){if(_0x1e3087['VoiceQueueId']||_0x1e3087[_0x9edd('0x5b')]){return db[_0x1e3087['VoiceQueueId']?_0x9edd('0x5c'):_0x9edd('0x5d')]['find']({'where':{'id':_0x1e3087[_0x9edd('0x5e')]?_0x1e3087[_0x9edd('0x5e')]:_0x1e3087[_0x9edd('0x5b')]},'attributes':['id','name'],'raw':!![]});}}})[_0x9edd('0x21')](function(_0x2e1ce3){var _0x430eb4={};if(_0x2e1ce3){_[_0x9edd('0x4e')](_0x430eb4,_[_0x9edd('0x5f')](_0x45f47c[_0x9edd('0x60')],['createdAt','updatedAt','id']));_0x430eb4[_0x9edd('0x61')]=0x15;_0x430eb4['statedesc']=_0x9edd('0x62');_0x430eb4[_0x9edd('0x63')]=_0x2e1ce3[_0x9edd('0x2e')];_0x430eb4[_0x9edd('0x64')]=_0x54ecfa['user'][_0x9edd('0x2e')];_0x430eb4['UserId']=_0x54ecfa[_0x9edd('0x65')]['id'];_0x430eb4[_0x9edd('0x62')]=!![];_0x430eb4[_0x9edd('0x66')]=moment()['format'](_0x9edd('0x67'));_0x430eb4['calleridnum']=_0x45f47c[_0x9edd('0x68')];_0x430eb4[_0x9edd('0x69')]=_0x45f47c['VoiceQueueId']?_0x9edd('0x6a'):'ivr';return db[_0x9edd('0x6b')][_0x9edd('0x57')]({'where':{'id':_0x430eb4[_0x9edd('0x6c')]},'attributes':['firstName',_0x9edd('0x6d')]})[_0x9edd('0x21')](function(_0x45c17d){if(!_[_0x9edd('0x6e')](_0x1348a7)&&!_[_0x9edd('0x6e')](_0x45c17d['firstName'])){_0x430eb4['calleridname']=_0x45c17d[_0x9edd('0x6f')];if(!_[_0x9edd('0x6e')](_0x45c17d['lastName'])){_0x430eb4['calleridname']+='\x20'+_0x45c17d['lastName'];}}})[_0x9edd('0x70')](function(){return db['CmHopperFinal']['create'](_0x430eb4);});}})[_0x9edd('0x21')](function(_0x32ff46){return db['CmHopperAdditionalPhone'][_0x9edd('0x5a')]({'where':{'CmHopperId':_0x366316}});})[_0x9edd('0x21')](function(){return _0x1348a7[_0x9edd('0x19')](0xcc)['end']();})[_0x9edd('0x54')](handleError(_0x1348a7,null));};exports['getPreview']=function(_0x37b018,_0x18d1a0,_0x4c8d06){var _0x1f80c4=[];return db[_0x9edd('0x6b')]['describe']()[_0x9edd('0x21')](function(_0x475dc3){_0x1f80c4=_[_0x9edd('0x30')](_0x475dc3);return _0x37b018[_0x9edd('0x65')]['getVoiceQueues']({'where':{'type':_0x9edd('0x71'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x9edd('0x72')],'raw':!![]});})[_0x9edd('0x21')](function(_0xf6c8aa){if(_0xf6c8aa&&_0xf6c8aa['length']){return db[_0x9edd('0x73')][_0x9edd('0x74')](function(_0x130dba){var _0x383cb9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9edd('0x75')](_0x9edd('0x67'))},'VoiceQueueId':{'$in':_[_0x9edd('0x27')](_0xf6c8aa,'id')},'$or':[{'UserId':null},{'UserId':_0x37b018['user']['id']}]};var _0x5e29d0=[];if(_0x37b018[_0x9edd('0x58')][_0x9edd('0x76')]&&_0x37b018[_0x9edd('0x58')][_0x9edd('0x76')]===_0x9edd('0x77')){if(!_['isEmpty'](_0x37b018[_0x9edd('0x58')][_0x9edd('0x78')])){_0x383cb9['id']={'$in':_0x37b018[_0x9edd('0x58')]['hopperIds']};}_0x5e29d0=[[_0x9edd('0x79'),_0x9edd('0x7a')],['scheduledAt',_0xf6c8aa[0x0][_0x9edd('0x72')]===_0x9edd('0x7a')?'DESC':_0x9edd('0x7a')],db[_0x9edd('0x73')]['literal'](_0x9edd('0x7b')),['id','DESC']];}else{if(!_['isEmpty'](_0x37b018[_0x9edd('0x58')][_0x9edd('0x78')])){_0x383cb9['id']={'$notIn':_0x37b018[_0x9edd('0x58')]['hopperIds']};}_0x5e29d0=[[_0x9edd('0x79'),_0x9edd('0x7c')],['scheduledAt',_0xf6c8aa[0x0][_0x9edd('0x72')]],db[_0x9edd('0x73')][_0x9edd('0x7d')](_0x9edd('0x7e')),['id','ASC']];}return db['CmHopper'][_0x9edd('0x7f')]({'attributes':['id','scheduledat',_0x9edd('0x68')],'where':_0x383cb9,'order':_0x5e29d0,'transaction':_0x130dba,'lock':_0x130dba[_0x9edd('0x80')][_0x9edd('0x81')],'include':[{'model':db[_0x9edd('0x6b')],'as':_0x9edd('0x82'),'attributes':_0x1f80c4,'include':[{'model':db[_0x9edd('0x83')],'as':_0x9edd('0x84'),'attributes':['id',_0x9edd('0x2e')]}]},{'model':db[_0x9edd('0x85')],'as':'List','attributes':['id',_0x9edd('0x2e')]},{'model':db[_0x9edd('0x5c')],'as':_0x9edd('0x86'),'attributes':['id',_0x9edd('0x2e'),_0x9edd('0x87')]}]})[_0x9edd('0x21')](function(_0x14fa8a){if(_0x14fa8a){return _0x14fa8a['update']({'UserId':_0x37b018[_0x9edd('0x65')]['id']},{'transaction':_0x130dba});}});});}})[_0x9edd('0x21')](handleEntityNotFound(_0x18d1a0,null))['then'](respondWithResult(_0x18d1a0,null))[_0x9edd('0x54')](handleError(_0x18d1a0,null));};exports[_0x9edd('0x88')]=function(_0x57231c,_0x304e56,_0x3d6d7a){return _0x57231c[_0x9edd('0x65')]['getVoiceQueues']({'where':{'type':_0x9edd('0x71'),'dialActive':!![],'dialMethod':_0x9edd('0x89')},'attributes':['id'],'raw':!![]})[_0x9edd('0x21')](function(_0x5a7de3){if(_0x5a7de3&&_0x5a7de3['length']){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9edd('0x75')](_0x9edd('0x67'))},'VoiceQueueId':{'$in':_[_0x9edd('0x27')](_0x5a7de3,'id')},'$or':[{'UserId':null},{'UserId':_0x57231c['user']['id']}]}});}return 0x0;})['then'](function(_0x49dc1d){if(!_[_0x9edd('0x6e')](_0x49dc1d)&&_[_0x9edd('0x8a')](_0x49dc1d)){return _0x304e56[_0x9edd('0x19')](0xc8)[_0x9edd('0x1a')]({'contacts':_0x49dc1d});}else{logger[_0x9edd('0x23')](_0x9edd('0x8b'),_0x9edd('0x88'),0x194,_0x9edd('0x8c'));_0x304e56[_0x9edd('0x18')](0x194);}})[_0x9edd('0x54')](handleError(_0x304e56,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8671266..002cbd3 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 _0x3f8a=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xa13db0,_0x37803c){var _0x1cb0db=function(_0x5e7ede){while(--_0x5e7ede){_0xa13db0['push'](_0xa13db0['shift']());}};_0x1cb0db(++_0x37803c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2a1fb1,_0x238da5){_0x2a1fb1=_0x2a1fb1-0x0;var _0x56b46b=_0x3f8a[_0x2a1fb1];return _0x56b46b;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[{'name':_0xa3f8('0xe'),'fields':[_0xa3f8('0xe')]},{'name':_0xa3f8('0xf'),'fields':[_0xa3f8('0xf')]},{'name':_0xa3f8('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x90b1,0x1bb));var _0x190b=function(_0x2c5315,_0x3696d8){_0x2c5315=_0x2c5315-0x0;var _0x934ff9=_0x90b1[_0x2c5315];return _0x934ff9;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index aa73294..cd1b3db 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 _0xf89c=['keys','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','message','result','GetCmHopper','CmHopper','options','where','attributes','limit','include','model','map','stringify','catch','ShowCmHopper','CreateCmHopper','create','body','raw','then','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE'];(function(_0x564cea,_0x1e076e){var _0x56ecc3=function(_0x1b579d){while(--_0x1b579d){_0x564cea['push'](_0x564cea['shift']());}};_0x56ecc3(++_0x1e076e);}(_0xf89c,0x9b));var _0xcf89=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf89c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcf89('0x0'));var util=require(_0xcf89('0x1'));var moment=require(_0xcf89('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcf89('0x4'));var logger=require('../../config/logger')(_0xcf89('0x5'));var config=require(_0xcf89('0x6'));var jayson=require(_0xcf89('0x7'));var client=jayson[_0xcf89('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568aa3,_0x13e2b8,_0x2903b4){return new BPromise(function(_0x39a96e,_0x4e9b5b){return client['request'](_0x568aa3,_0x2903b4)['then'](function(_0x257d20){logger[_0xcf89('0x9')](_0xcf89('0xa'),_0x13e2b8,_0xcf89('0xb'));logger[_0xcf89('0xc')](_0xcf89('0xd'),_0x13e2b8,_0xcf89('0xb'),JSON['stringify'](_0x257d20));if(_0x257d20['error']){if(_0x257d20[_0xcf89('0xe')]['code']===0x1f4){logger[_0xcf89('0xe')](_0xcf89('0xa'),_0x13e2b8,_0x257d20[_0xcf89('0xe')]['message']);return _0x4e9b5b(_0x257d20[_0xcf89('0xe')][_0xcf89('0xf')]);}logger[_0xcf89('0xe')](_0xcf89('0xa'),_0x13e2b8,_0x257d20['error'][_0xcf89('0xf')]);return _0x39a96e(_0x257d20[_0xcf89('0xe')][_0xcf89('0xf')]);}else{logger[_0xcf89('0x9')](_0xcf89('0xa'),_0x13e2b8,'request\x20sent');_0x39a96e(_0x257d20[_0xcf89('0x10')][_0xcf89('0xf')]);}})['catch'](function(_0x31e537){logger['error'](_0xcf89('0xa'),_0x13e2b8,_0x31e537);_0x4e9b5b(_0x31e537);});});}exports[_0xcf89('0x11')]=function(_0x20b13f){var _0x2ba98d=this;return new Promise(function(_0x405f69,_0x552ab2){return db[_0xcf89('0x12')]['findAll']({'raw':_0x20b13f[_0xcf89('0x13')]?_0x20b13f[_0xcf89('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x20b13f['options']?_0x20b13f[_0xcf89('0x13')][_0xcf89('0x14')]||null:null,'attributes':_0x20b13f['options']?_0x20b13f['options'][_0xcf89('0x15')]||null:null,'limit':_0x20b13f['options']?_0x20b13f['options'][_0xcf89('0x16')]||null:null,'include':_0x20b13f[_0xcf89('0x13')]?_0x20b13f[_0xcf89('0x13')][_0xcf89('0x17')]?_['map'](_0x20b13f[_0xcf89('0x13')][_0xcf89('0x17')],function(_0x1b244b){return{'model':db[_0x1b244b[_0xcf89('0x18')]],'as':_0x1b244b['as'],'attributes':_0x1b244b[_0xcf89('0x15')],'include':_0x1b244b[_0xcf89('0x17')]?_['map'](_0x1b244b[_0xcf89('0x17')],function(_0x3d88da){return{'model':db[_0x3d88da['model']],'as':_0x3d88da['as'],'attributes':_0x3d88da[_0xcf89('0x15')],'include':_0x3d88da[_0xcf89('0x17')]?_[_0xcf89('0x19')](_0x3d88da[_0xcf89('0x17')],function(_0x2ed50b){return{'model':db[_0x2ed50b[_0xcf89('0x18')]],'as':_0x2ed50b['as'],'attributes':_0x2ed50b[_0xcf89('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e494d){logger[_0xcf89('0x9')]('GetCmHopper',_0x20b13f);logger[_0xcf89('0xc')](_0xcf89('0x11'),_0x20b13f,JSON[_0xcf89('0x1a')](_0x4e494d));_0x405f69(_0x4e494d);})[_0xcf89('0x1b')](function(_0x182c8b){logger['error']('GetCmHopper',_0x182c8b[_0xcf89('0xf')],_0x20b13f);_0x552ab2(_0x2ba98d[_0xcf89('0xe')](0x1f4,_0x182c8b[_0xcf89('0xf')]));});});};exports[_0xcf89('0x1c')]=function(_0x400888){var _0x3944ab=this;return new Promise(function(_0x430fa9,_0xe50798){return db[_0xcf89('0x12')]['find']({'raw':_0x400888['options']?_0x400888['options']['raw']===undefined?!![]:![]:!![],'where':_0x400888[_0xcf89('0x13')]?_0x400888['options'][_0xcf89('0x14')]||null:null,'attributes':_0x400888[_0xcf89('0x13')]?_0x400888[_0xcf89('0x13')][_0xcf89('0x15')]||null:null,'include':_0x400888[_0xcf89('0x13')]?_0x400888['options'][_0xcf89('0x17')]?_[_0xcf89('0x19')](_0x400888[_0xcf89('0x13')][_0xcf89('0x17')],function(_0x2fd614){return{'model':db[_0x2fd614['model']],'as':_0x2fd614['as'],'attributes':_0x2fd614['attributes'],'include':_0x2fd614['include']?_[_0xcf89('0x19')](_0x2fd614[_0xcf89('0x17')],function(_0x59ff8c){return{'model':db[_0x59ff8c[_0xcf89('0x18')]],'as':_0x59ff8c['as'],'attributes':_0x59ff8c['attributes'],'include':_0x59ff8c[_0xcf89('0x17')]?_['map'](_0x59ff8c[_0xcf89('0x17')],function(_0x30c404){return{'model':db[_0x30c404['model']],'as':_0x30c404['as'],'attributes':_0x30c404[_0xcf89('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d09c6){logger['info'](_0xcf89('0x1c'),_0x400888);logger['debug']('ShowCmHopper',_0x400888,JSON[_0xcf89('0x1a')](_0x1d09c6));_0x430fa9(_0x1d09c6);})[_0xcf89('0x1b')](function(_0x19fd06){logger[_0xcf89('0xe')](_0xcf89('0x1c'),_0x19fd06[_0xcf89('0xf')],_0x400888);_0xe50798(_0x3944ab[_0xcf89('0xe')](0x1f4,_0x19fd06['message']));});});};exports[_0xcf89('0x1d')]=function(_0x388631){var _0x24aac5=this;return new Promise(function(_0x55b494,_0x23616b){return db[_0xcf89('0x12')][_0xcf89('0x1e')](_0x388631[_0xcf89('0x1f')],{'raw':_0x388631[_0xcf89('0x13')]?_0x388631['options'][_0xcf89('0x20')]===undefined?!![]:![]:!![]})[_0xcf89('0x21')](function(_0x529369){logger[_0xcf89('0x9')](_0xcf89('0x1d'),_0x388631);logger[_0xcf89('0xc')](_0xcf89('0x1d'),_0x388631,JSON[_0xcf89('0x1a')](_0x529369));_0x55b494(_0x529369);})['catch'](function(_0x5161c2){logger[_0xcf89('0xe')](_0xcf89('0x1d'),_0x5161c2[_0xcf89('0xf')],_0x388631);_0x23616b(_0x24aac5[_0xcf89('0xe')](0x1f4,_0x5161c2[_0xcf89('0xf')]));});});};exports[_0xcf89('0x22')]=function(_0x43e9f9){var _0x42f35d=this;return new Promise(function(_0x1410ff,_0x2d7688){return db[_0xcf89('0x12')][_0xcf89('0x23')](_0x43e9f9[_0xcf89('0x1f')],{'raw':_0x43e9f9[_0xcf89('0x13')]?_0x43e9f9['options'][_0xcf89('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e9f9[_0xcf89('0x13')]?_0x43e9f9[_0xcf89('0x13')][_0xcf89('0x14')]||null:null,'attributes':_0x43e9f9[_0xcf89('0x13')]?_0x43e9f9[_0xcf89('0x13')]['attributes']||null:null,'limit':_0x43e9f9[_0xcf89('0x13')]?_0x43e9f9[_0xcf89('0x13')][_0xcf89('0x16')]||null:null})[_0xcf89('0x21')](function(_0x599fe8){logger[_0xcf89('0x9')]('UpdateCmHopper',_0x43e9f9);logger[_0xcf89('0xc')](_0xcf89('0x22'),_0x43e9f9,JSON[_0xcf89('0x1a')](_0x599fe8));_0x1410ff(_0x599fe8);})[_0xcf89('0x1b')](function(_0x137e39){logger[_0xcf89('0xe')](_0xcf89('0x22'),_0x137e39[_0xcf89('0xf')],_0x43e9f9);_0x2d7688(_0x42f35d[_0xcf89('0xe')](0x1f4,_0x137e39[_0xcf89('0xf')]));});});};exports[_0xcf89('0x24')]=function(_0x372908){var _0x1c4153=this;return new Promise(function(_0x4bca7b,_0x2495a8){return db['CmHopper'][_0xcf89('0x25')]({'where':_0x372908[_0xcf89('0x13')]?_0x372908[_0xcf89('0x13')][_0xcf89('0x14')]||null:null})['then'](function(_0x109b6a){logger[_0xcf89('0x9')](_0xcf89('0x24'),_0x372908);logger[_0xcf89('0xc')](_0xcf89('0x24'),_0x372908,JSON[_0xcf89('0x1a')](_0x109b6a));_0x4bca7b(_0x109b6a);})[_0xcf89('0x1b')](function(_0x198fa2){logger['error'](_0xcf89('0x24'),_0x198fa2[_0xcf89('0xf')],_0x372908);_0x2495a8(_0x1c4153[_0xcf89('0xe')](0x1f4,_0x198fa2['message']));});});};exports['GetContactDialer']=function(_0x49b680){var _0x1d859b=this;return new Promise(function(_0x1fb863,_0x26cf6e){return db[_0xcf89('0x26')][_0xcf89('0x27')]()[_0xcf89('0x21')](function(_0x317523){return db[_0xcf89('0x28')][_0xcf89('0x29')](function(_0x144934){return db['CmHopper'][_0xcf89('0x2a')]({'where':_0x49b680[_0xcf89('0x13')]?_0x49b680[_0xcf89('0x13')][_0xcf89('0x14')]||null:null,'attributes':_0x49b680[_0xcf89('0x13')]?_0x49b680[_0xcf89('0x13')][_0xcf89('0x15')]||null:null,'limit':_0x49b680[_0xcf89('0x13')]?_0x49b680[_0xcf89('0x13')][_0xcf89('0x16')]||null:null,'order':_0x49b680['options']?_0x49b680['options'][_0xcf89('0x2b')]||null:null,'transaction':_0x144934,'lock':_0x144934[_0xcf89('0x2c')][_0xcf89('0x2d')],'include':[{'model':db[_0xcf89('0x26')],'as':'Contact','attributes':_[_0xcf89('0x2e')](_0x317523)},{'model':db['User'],'as':_0xcf89('0x2f'),'attributes':['id',_0xcf89('0x30'),_0xcf89('0x31')]}]})[_0xcf89('0x21')](function(_0x474809){var _0x36fe98=[];var _0xa2de63=[];for(var _0x36fd6f=0x0;_0x36fd6f<_0x474809[_0xcf89('0x32')];_0x36fd6f+=0x1){var _0x267a76=_0x474809[_0x36fd6f][_0xcf89('0x33')];if(_0x267a76===null){_0x36fe98[_0xcf89('0x34')](_0x474809[_0x36fd6f]['update'](_0x49b680[_0xcf89('0x1f')],{'transaction':_0x144934}));}else if(!_0xa2de63[_0xcf89('0x35')](_0x267a76)){_0xa2de63[_0xcf89('0x34')](_0x267a76);_0x36fe98[_0xcf89('0x34')](_0x474809[_0x36fd6f][_0xcf89('0x23')](_0x49b680[_0xcf89('0x1f')],{'transaction':_0x144934}));}}return BPromise[_0xcf89('0x36')](_0x36fe98);});})[_0xcf89('0x21')](function(_0x2147ac){logger[_0xcf89('0x9')](_0xcf89('0x37'),_0x49b680);logger[_0xcf89('0xc')]('GetContactDialer',_0x49b680,JSON[_0xcf89('0x1a')](_0x2147ac));_0x1fb863(_0x2147ac);})[_0xcf89('0x1b')](function(_0x1cb87e){logger[_0xcf89('0xe')](_0xcf89('0x37'),_0x1cb87e[_0xcf89('0xf')],_0x49b680);_0x26cf6e(_0x1d859b[_0xcf89('0xe')](0x1f4,_0x1cb87e['message']));});});});};exports[_0xcf89('0x38')]=function(_0x192676){var _0x1c0d43=this;return new Promise(function(_0x1bef4e,_0x486d1d){return db['sequelize'][_0xcf89('0x29')](function(_0x4288e4){return db[_0xcf89('0x39')][_0xcf89('0x1e')](_0x192676[_0xcf89('0x1f')],{'raw':_0x192676[_0xcf89('0x13')]?_0x192676['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x4288e4})[_0xcf89('0x21')](function(){return db[_0xcf89('0x12')][_0xcf89('0x25')]({'where':_0x192676[_0xcf89('0x13')]?_0x192676['options']['where']||null:null,'transaction':_0x4288e4});});})['then'](function(_0x4c26ef){logger['info']('MoveContactManagedDialer',_0x192676);logger[_0xcf89('0xc')](_0xcf89('0x38'),_0x192676,JSON[_0xcf89('0x1a')](_0x4c26ef));_0x1bef4e(_0x4c26ef);})[_0xcf89('0x1b')](function(_0x161818){logger['error'](_0xcf89('0x38'),_0x161818[_0xcf89('0xf')],_0x192676);_0x486d1d(_0x1c0d43[_0xcf89('0xe')](0x1f4,_0x161818[_0xcf89('0xf')]));});});};exports['CountReScheduled']=function(_0x2db864){var _0x11adab=this;return new Promise(function(_0x3dd1d9,_0x5cddf5){return db['CmHopper'][_0xcf89('0x2a')]({'raw':_0x2db864['options']?_0x2db864[_0xcf89('0x13')][_0xcf89('0x20')]===undefined?!![]:![]:!![],'where':_0x2db864[_0xcf89('0x13')]?_0x2db864[_0xcf89('0x13')]['where']||null:null,'attributes':[[db[_0xcf89('0x28')]['fn'](_0xcf89('0x3a'),db[_0xcf89('0x28')]['fn']('IF',db[_0xcf89('0x28')]['literal'](_0xcf89('0x3b')+util[_0xcf89('0x3c')](_0xcf89('0x3d'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0xcf89('0x3e')))),_0xcf89('0x3f')]]})[_0xcf89('0x21')](function(_0x3df675){logger[_0xcf89('0x9')]('CountReScheduled',_0x2db864);logger['debug']('CountReScheduled',_0x2db864,JSON[_0xcf89('0x1a')](_0x3df675));_0x3dd1d9(_0x3df675);})['catch'](function(_0x4a3887){logger[_0xcf89('0xe')](_0xcf89('0x40'),_0x4a3887[_0xcf89('0xf')],_0x2db864);_0x5cddf5(_0x11adab[_0xcf89('0xe')](0x1f4,_0x4a3887[_0xcf89('0xf')]));});});};exports['GetContactRecallMe']=function(_0x58b41d){var _0xb8143c=this;return new Promise(function(_0xe0f0f2,_0x17a0b8){return db['CmContact']['describe']()['then'](function(_0xbac257){return db['sequelize'][_0xcf89('0x29')](function(_0x3de739){return db[_0xcf89('0x12')][_0xcf89('0x2a')]({'where':_0x58b41d['options']?_0x58b41d[_0xcf89('0x13')]['where']||null:null,'attributes':_0x58b41d['options']?_0x58b41d[_0xcf89('0x13')]['attributes']||null:null,'limit':0x1,'order':_0x58b41d['options']?_0x58b41d['options'][_0xcf89('0x2b')]||null:null,'group':db['CmHopper'][_0xcf89('0x33')],'transaction':_0x3de739,'lock':_0x3de739['LOCK'][_0xcf89('0x2d')],'include':_0x58b41d[_0xcf89('0x13')]?_0x58b41d[_0xcf89('0x13')]['include']?_['map'](_0x58b41d['options']['include'],function(_0x1c54e1){return{'model':db[_0x1c54e1[_0xcf89('0x18')]],'as':_0x1c54e1['as'],'attributes':_0x1c54e1[_0xcf89('0x15')],'include':_0x1c54e1['include']?_[_0xcf89('0x19')](_0x1c54e1['include'],function(_0x1df402){return{'model':db[_0x1df402[_0xcf89('0x18')]],'as':_0x1df402['as'],'attributes':_0x1df402[_0xcf89('0x15')],'include':_0x1df402['include']?_['map'](_0x1df402[_0xcf89('0x17')],function(_0x1793b4){return{'model':db[_0x1793b4[_0xcf89('0x18')]],'as':_0x1793b4['as'],'attributes':_0x1793b4[_0xcf89('0x15')]};}):[]};}):[]};}):[]:[]})[_0xcf89('0x21')](function(_0x586a9f){var _0x486a08=[];for(var _0x4fd6cb=0x0;_0x4fd6cb<_0x586a9f['length'];_0x4fd6cb+=0x1){_0x486a08[_0xcf89('0x34')](_0x586a9f[_0x4fd6cb][_0xcf89('0x23')](_0x58b41d['body'],{'transaction':_0x3de739}));}return BPromise[_0xcf89('0x36')](_0x486a08);});})[_0xcf89('0x21')](function(_0x426ff9){logger['info']('GetContactRecallMe',_0x58b41d);logger[_0xcf89('0xc')](_0xcf89('0x41'),_0x58b41d,JSON['stringify'](_0x426ff9));_0xe0f0f2(_0x426ff9);})[_0xcf89('0x1b')](function(_0x4c99a2){logger[_0xcf89('0xe')](_0xcf89('0x41'),_0x4c99a2['message'],_0x58b41d);_0x17a0b8(_0xb8143c[_0xcf89('0xe')](0x1f4,_0x4c99a2['message']));});});});};exports[_0xcf89('0x42')]=function(_0x327d14){var _0x472711=this;return new Promise(function(_0x564cb4,_0x519f7f){db[_0xcf89('0x26')][_0xcf89('0x27')]()[_0xcf89('0x21')](function(_0x23b03e){return db['CmHopper'][_0xcf89('0x2a')]({'raw':_0x327d14[_0xcf89('0x13')]?_0x327d14[_0xcf89('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x327d14['options']?_0x327d14[_0xcf89('0x13')]['where']||null:null,'attributes':_0x327d14[_0xcf89('0x13')]?_0x327d14[_0xcf89('0x13')]['attributes']||null:null,'limit':_0x327d14[_0xcf89('0x13')]?_0x327d14[_0xcf89('0x13')][_0xcf89('0x16')]||null:null,'include':_0x327d14['options']?_0x327d14[_0xcf89('0x13')][_0xcf89('0x17')]?_[_0xcf89('0x19')](_0x327d14[_0xcf89('0x13')][_0xcf89('0x17')],function(_0x3c858a){return{'model':db[_0x3c858a[_0xcf89('0x18')]],'as':_0x3c858a['as'],'attributes':_0x3c858a['as']==='Contact'?_[_0xcf89('0x2e')](_0x23b03e):_0x3c858a[_0xcf89('0x15')],'include':_0x3c858a[_0xcf89('0x17')]?_['map'](_0x3c858a[_0xcf89('0x17')],function(_0x920654){return{'model':db[_0x920654['model']],'as':_0x920654['as'],'attributes':_0x920654['attributes'],'include':_0x920654[_0xcf89('0x17')]?_[_0xcf89('0x19')](_0x920654['include'],function(_0x46f80d){return{'model':db[_0x46f80d[_0xcf89('0x18')]],'as':_0x46f80d['as'],'attributes':_0x46f80d['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf89('0x21')](function(_0x2871a6){logger[_0xcf89('0x9')](_0xcf89('0x11'),_0x327d14);logger[_0xcf89('0xc')](_0xcf89('0x11'),_0x327d14,JSON['stringify'](_0x2871a6));_0x564cb4(_0x2871a6);})[_0xcf89('0x1b')](function(_0x51d5e1){logger[_0xcf89('0xe')]('GetCmHopper',_0x51d5e1['message'],_0x327d14);_0x519f7f(_0x472711[_0xcf89('0xe')](0x1f4,_0x51d5e1['message']));});});});}; \ No newline at end of file +var _0x0b7c=['ShowCmHopper','CmHopper','find','then','CreateCmHopper','create','UpdateCmHopper','update','body','limit','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','order','CmContact','Contact','keys','User','Agent','voicePause','length','push','includes','all','MoveContactManagedDialer','CountReScheduled','sequelize','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','UserId','UPDATE','GetCmHopperPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','findAll','options','raw','where','include','map','model','attributes'];(function(_0x12fb7a,_0x3a091c){var _0x2eec67=function(_0x5e9348){while(--_0x5e9348){_0x12fb7a['push'](_0x12fb7a['shift']());}};_0x2eec67(++_0x3a091c);}(_0x0b7c,0x184));var _0xc0b7=function(_0x112147,_0x4e692e){_0x112147=_0x112147-0x0;var _0x3ba744=_0x0b7c[_0x112147];return _0x3ba744;};'use strict';var _=require(_0xc0b7('0x0'));var util=require(_0xc0b7('0x1'));var moment=require('moment');var BPromise=require(_0xc0b7('0x2'));var rs=require(_0xc0b7('0x3'));var fs=require('fs');var Redis=require(_0xc0b7('0x4'));var db=require(_0xc0b7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc0b7('0x6'));var config=require(_0xc0b7('0x7'));var jayson=require(_0xc0b7('0x8'));var client=jayson[_0xc0b7('0x9')][_0xc0b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27404e,_0x1679ad,_0x2e7f6f){return new BPromise(function(_0x328b52,_0x18b48a){return client[_0xc0b7('0xb')](_0x27404e,_0x2e7f6f)['then'](function(_0x1c5600){logger[_0xc0b7('0xc')](_0xc0b7('0xd'),_0x1679ad,_0xc0b7('0xe'));logger[_0xc0b7('0xf')](_0xc0b7('0x10'),_0x1679ad,'request\x20sent',JSON[_0xc0b7('0x11')](_0x1c5600));if(_0x1c5600['error']){if(_0x1c5600[_0xc0b7('0x12')][_0xc0b7('0x13')]===0x1f4){logger[_0xc0b7('0x12')](_0xc0b7('0xd'),_0x1679ad,_0x1c5600[_0xc0b7('0x12')]['message']);return _0x18b48a(_0x1c5600[_0xc0b7('0x12')][_0xc0b7('0x14')]);}logger[_0xc0b7('0x12')](_0xc0b7('0xd'),_0x1679ad,_0x1c5600[_0xc0b7('0x12')][_0xc0b7('0x14')]);return _0x328b52(_0x1c5600[_0xc0b7('0x12')][_0xc0b7('0x14')]);}else{logger[_0xc0b7('0xc')]('CmHopper,\x20%s,\x20%s',_0x1679ad,'request\x20sent');_0x328b52(_0x1c5600[_0xc0b7('0x15')][_0xc0b7('0x14')]);}})[_0xc0b7('0x16')](function(_0x410608){logger[_0xc0b7('0x12')](_0xc0b7('0xd'),_0x1679ad,_0x410608);_0x18b48a(_0x410608);});});}exports[_0xc0b7('0x17')]=function(_0x1d46c5){var _0x58b772=this;return new Promise(function(_0x4d46f7,_0x5cfebc){return db['CmHopper'][_0xc0b7('0x18')]({'raw':_0x1d46c5[_0xc0b7('0x19')]?_0x1d46c5['options'][_0xc0b7('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d46c5[_0xc0b7('0x19')]?_0x1d46c5[_0xc0b7('0x19')][_0xc0b7('0x1b')]||null:null,'attributes':_0x1d46c5['options']?_0x1d46c5[_0xc0b7('0x19')]['attributes']||null:null,'limit':_0x1d46c5[_0xc0b7('0x19')]?_0x1d46c5['options']['limit']||null:null,'include':_0x1d46c5[_0xc0b7('0x19')]?_0x1d46c5[_0xc0b7('0x19')][_0xc0b7('0x1c')]?_[_0xc0b7('0x1d')](_0x1d46c5[_0xc0b7('0x19')][_0xc0b7('0x1c')],function(_0x326ba7){return{'model':db[_0x326ba7[_0xc0b7('0x1e')]],'as':_0x326ba7['as'],'attributes':_0x326ba7['attributes'],'include':_0x326ba7[_0xc0b7('0x1c')]?_[_0xc0b7('0x1d')](_0x326ba7[_0xc0b7('0x1c')],function(_0x4ad7ec){return{'model':db[_0x4ad7ec['model']],'as':_0x4ad7ec['as'],'attributes':_0x4ad7ec[_0xc0b7('0x1f')],'include':_0x4ad7ec[_0xc0b7('0x1c')]?_['map'](_0x4ad7ec[_0xc0b7('0x1c')],function(_0x45b7fe){return{'model':db[_0x45b7fe[_0xc0b7('0x1e')]],'as':_0x45b7fe['as'],'attributes':_0x45b7fe[_0xc0b7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x285004){logger['info'](_0xc0b7('0x17'),_0x1d46c5);logger[_0xc0b7('0xf')]('GetCmHopper',_0x1d46c5,JSON[_0xc0b7('0x11')](_0x285004));_0x4d46f7(_0x285004);})[_0xc0b7('0x16')](function(_0x5edf32){logger[_0xc0b7('0x12')](_0xc0b7('0x17'),_0x5edf32['message'],_0x1d46c5);_0x5cfebc(_0x58b772[_0xc0b7('0x12')](0x1f4,_0x5edf32[_0xc0b7('0x14')]));});});};exports[_0xc0b7('0x20')]=function(_0xb81d68){var _0x1e78f4=this;return new Promise(function(_0x2194bc,_0x2621a5){return db[_0xc0b7('0x21')][_0xc0b7('0x22')]({'raw':_0xb81d68[_0xc0b7('0x19')]?_0xb81d68[_0xc0b7('0x19')][_0xc0b7('0x1a')]===undefined?!![]:![]:!![],'where':_0xb81d68[_0xc0b7('0x19')]?_0xb81d68[_0xc0b7('0x19')][_0xc0b7('0x1b')]||null:null,'attributes':_0xb81d68[_0xc0b7('0x19')]?_0xb81d68[_0xc0b7('0x19')][_0xc0b7('0x1f')]||null:null,'include':_0xb81d68[_0xc0b7('0x19')]?_0xb81d68[_0xc0b7('0x19')]['include']?_[_0xc0b7('0x1d')](_0xb81d68['options'][_0xc0b7('0x1c')],function(_0x4e938d){return{'model':db[_0x4e938d[_0xc0b7('0x1e')]],'as':_0x4e938d['as'],'attributes':_0x4e938d['attributes'],'include':_0x4e938d[_0xc0b7('0x1c')]?_[_0xc0b7('0x1d')](_0x4e938d[_0xc0b7('0x1c')],function(_0x241ace){return{'model':db[_0x241ace[_0xc0b7('0x1e')]],'as':_0x241ace['as'],'attributes':_0x241ace['attributes'],'include':_0x241ace[_0xc0b7('0x1c')]?_[_0xc0b7('0x1d')](_0x241ace[_0xc0b7('0x1c')],function(_0x3b2c1d){return{'model':db[_0x3b2c1d[_0xc0b7('0x1e')]],'as':_0x3b2c1d['as'],'attributes':_0x3b2c1d[_0xc0b7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc0b7('0x23')](function(_0x1f2ad8){logger['info']('ShowCmHopper',_0xb81d68);logger['debug'](_0xc0b7('0x20'),_0xb81d68,JSON['stringify'](_0x1f2ad8));_0x2194bc(_0x1f2ad8);})['catch'](function(_0x4de169){logger[_0xc0b7('0x12')](_0xc0b7('0x20'),_0x4de169['message'],_0xb81d68);_0x2621a5(_0x1e78f4[_0xc0b7('0x12')](0x1f4,_0x4de169[_0xc0b7('0x14')]));});});};exports[_0xc0b7('0x24')]=function(_0x1a0e5b){var _0x375579=this;return new Promise(function(_0x50f230,_0x33b5ee){return db['CmHopper'][_0xc0b7('0x25')](_0x1a0e5b['body'],{'raw':_0x1a0e5b[_0xc0b7('0x19')]?_0x1a0e5b[_0xc0b7('0x19')][_0xc0b7('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4c606a){logger[_0xc0b7('0xc')](_0xc0b7('0x24'),_0x1a0e5b);logger['debug'](_0xc0b7('0x24'),_0x1a0e5b,JSON[_0xc0b7('0x11')](_0x4c606a));_0x50f230(_0x4c606a);})[_0xc0b7('0x16')](function(_0x2ed049){logger[_0xc0b7('0x12')]('CreateCmHopper',_0x2ed049['message'],_0x1a0e5b);_0x33b5ee(_0x375579[_0xc0b7('0x12')](0x1f4,_0x2ed049[_0xc0b7('0x14')]));});});};exports[_0xc0b7('0x26')]=function(_0xd103bf){var _0x5b6e3d=this;return new Promise(function(_0x3fdc22,_0x2c18f1){return db[_0xc0b7('0x21')][_0xc0b7('0x27')](_0xd103bf[_0xc0b7('0x28')],{'raw':_0xd103bf[_0xc0b7('0x19')]?_0xd103bf[_0xc0b7('0x19')][_0xc0b7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd103bf[_0xc0b7('0x19')]?_0xd103bf[_0xc0b7('0x19')][_0xc0b7('0x1b')]||null:null,'attributes':_0xd103bf[_0xc0b7('0x19')]?_0xd103bf[_0xc0b7('0x19')][_0xc0b7('0x1f')]||null:null,'limit':_0xd103bf['options']?_0xd103bf[_0xc0b7('0x19')][_0xc0b7('0x29')]||null:null})[_0xc0b7('0x23')](function(_0x38319c){logger[_0xc0b7('0xc')](_0xc0b7('0x26'),_0xd103bf);logger[_0xc0b7('0xf')](_0xc0b7('0x26'),_0xd103bf,JSON[_0xc0b7('0x11')](_0x38319c));_0x3fdc22(_0x38319c);})[_0xc0b7('0x16')](function(_0x5627af){logger[_0xc0b7('0x12')]('UpdateCmHopper',_0x5627af[_0xc0b7('0x14')],_0xd103bf);_0x2c18f1(_0x5b6e3d['error'](0x1f4,_0x5627af[_0xc0b7('0x14')]));});});};exports[_0xc0b7('0x2a')]=function(_0x74151d){var _0x4d570c=this;return new Promise(function(_0xd2b8c,_0x3a8290){return db['CmHopper'][_0xc0b7('0x2b')]({'where':_0x74151d['options']?_0x74151d[_0xc0b7('0x19')][_0xc0b7('0x1b')]||null:null})[_0xc0b7('0x23')](function(_0x5838b6){logger['info'](_0xc0b7('0x2a'),_0x74151d);logger[_0xc0b7('0xf')](_0xc0b7('0x2a'),_0x74151d,JSON['stringify'](_0x5838b6));_0xd2b8c(_0x5838b6);})[_0xc0b7('0x16')](function(_0x2e063f){logger[_0xc0b7('0x12')]('DestroyCmHopper',_0x2e063f[_0xc0b7('0x14')],_0x74151d);_0x3a8290(_0x4d570c[_0xc0b7('0x12')](0x1f4,_0x2e063f[_0xc0b7('0x14')]));});});};exports[_0xc0b7('0x2c')]=function(_0x40cc00){var _0xe4d4a=this;return new Promise(function(_0x455951,_0x4cb27e){return db['CmContact'][_0xc0b7('0x2d')]()[_0xc0b7('0x23')](function(_0xeae843){return db['sequelize'][_0xc0b7('0x2e')](function(_0x328b19){return db[_0xc0b7('0x21')]['findAll']({'where':_0x40cc00[_0xc0b7('0x19')]?_0x40cc00[_0xc0b7('0x19')][_0xc0b7('0x1b')]||null:null,'attributes':_0x40cc00['options']?_0x40cc00[_0xc0b7('0x19')][_0xc0b7('0x1f')]||null:null,'limit':_0x40cc00['options']?_0x40cc00[_0xc0b7('0x19')][_0xc0b7('0x29')]||null:null,'order':_0x40cc00[_0xc0b7('0x19')]?_0x40cc00[_0xc0b7('0x19')][_0xc0b7('0x2f')]||null:null,'transaction':_0x328b19,'lock':_0x328b19['LOCK']['UPDATE'],'include':[{'model':db[_0xc0b7('0x30')],'as':_0xc0b7('0x31'),'attributes':_[_0xc0b7('0x32')](_0xeae843)},{'model':db[_0xc0b7('0x33')],'as':_0xc0b7('0x34'),'attributes':['id','name',_0xc0b7('0x35')]}]})[_0xc0b7('0x23')](function(_0x1a3141){var _0x26c606=[];var _0x4d23ab=[];for(var _0x586369=0x0;_0x586369<_0x1a3141[_0xc0b7('0x36')];_0x586369+=0x1){var _0x38527f=_0x1a3141[_0x586369]['UserId'];if(_0x38527f===null){_0x26c606[_0xc0b7('0x37')](_0x1a3141[_0x586369][_0xc0b7('0x27')](_0x40cc00[_0xc0b7('0x28')],{'transaction':_0x328b19}));}else if(!_0x4d23ab[_0xc0b7('0x38')](_0x38527f)){_0x4d23ab[_0xc0b7('0x37')](_0x38527f);_0x26c606[_0xc0b7('0x37')](_0x1a3141[_0x586369]['update'](_0x40cc00[_0xc0b7('0x28')],{'transaction':_0x328b19}));}}return BPromise[_0xc0b7('0x39')](_0x26c606);});})[_0xc0b7('0x23')](function(_0x129161){logger['info'](_0xc0b7('0x2c'),_0x40cc00);logger[_0xc0b7('0xf')](_0xc0b7('0x2c'),_0x40cc00,JSON[_0xc0b7('0x11')](_0x129161));_0x455951(_0x129161);})[_0xc0b7('0x16')](function(_0x1e880d){logger[_0xc0b7('0x12')](_0xc0b7('0x2c'),_0x1e880d[_0xc0b7('0x14')],_0x40cc00);_0x4cb27e(_0xe4d4a['error'](0x1f4,_0x1e880d[_0xc0b7('0x14')]));});});});};exports[_0xc0b7('0x3a')]=function(_0x207c11){var _0x5bab50=this;return new Promise(function(_0x356eab,_0xfc723a){return db['sequelize'][_0xc0b7('0x2e')](function(_0x491f23){return db['CmHopperFinal'][_0xc0b7('0x25')](_0x207c11[_0xc0b7('0x28')],{'raw':_0x207c11[_0xc0b7('0x19')]?_0x207c11[_0xc0b7('0x19')][_0xc0b7('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x491f23})[_0xc0b7('0x23')](function(){return db[_0xc0b7('0x21')][_0xc0b7('0x2b')]({'where':_0x207c11[_0xc0b7('0x19')]?_0x207c11[_0xc0b7('0x19')][_0xc0b7('0x1b')]||null:null,'transaction':_0x491f23});});})[_0xc0b7('0x23')](function(_0x37f117){logger[_0xc0b7('0xc')]('MoveContactManagedDialer',_0x207c11);logger[_0xc0b7('0xf')]('MoveContactManagedDialer',_0x207c11,JSON[_0xc0b7('0x11')](_0x37f117));_0x356eab(_0x37f117);})[_0xc0b7('0x16')](function(_0x54df5d){logger['error'](_0xc0b7('0x3a'),_0x54df5d[_0xc0b7('0x14')],_0x207c11);_0xfc723a(_0x5bab50[_0xc0b7('0x12')](0x1f4,_0x54df5d[_0xc0b7('0x14')]));});});};exports[_0xc0b7('0x3b')]=function(_0x4648fc){var _0x9647b0=this;return new Promise(function(_0x20ded6,_0x4806eb){return db[_0xc0b7('0x21')][_0xc0b7('0x18')]({'raw':_0x4648fc['options']?_0x4648fc[_0xc0b7('0x19')][_0xc0b7('0x1a')]===undefined?!![]:![]:!![],'where':_0x4648fc[_0xc0b7('0x19')]?_0x4648fc['options']['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xc0b7('0x3c')]['fn']('IF',db[_0xc0b7('0x3c')][_0xc0b7('0x3d')](_0xc0b7('0x3e')+util[_0xc0b7('0x3f')]('\x22%s\x22',moment()['format'](_0xc0b7('0x40')))+_0xc0b7('0x41')))),'contactsRescheduled']]})[_0xc0b7('0x23')](function(_0x3ce398){logger[_0xc0b7('0xc')](_0xc0b7('0x3b'),_0x4648fc);logger[_0xc0b7('0xf')]('CountReScheduled',_0x4648fc,JSON[_0xc0b7('0x11')](_0x3ce398));_0x20ded6(_0x3ce398);})[_0xc0b7('0x16')](function(_0x8deaaf){logger['error'](_0xc0b7('0x3b'),_0x8deaaf[_0xc0b7('0x14')],_0x4648fc);_0x4806eb(_0x9647b0[_0xc0b7('0x12')](0x1f4,_0x8deaaf[_0xc0b7('0x14')]));});});};exports[_0xc0b7('0x42')]=function(_0x3be582){var _0x4cc528=this;return new Promise(function(_0x11b17f,_0x2022f5){return db[_0xc0b7('0x30')][_0xc0b7('0x2d')]()[_0xc0b7('0x23')](function(_0x35706b){return db[_0xc0b7('0x3c')]['transaction'](function(_0x3bb923){return db[_0xc0b7('0x21')][_0xc0b7('0x18')]({'where':_0x3be582[_0xc0b7('0x19')]?_0x3be582['options'][_0xc0b7('0x1b')]||null:null,'attributes':_0x3be582[_0xc0b7('0x19')]?_0x3be582['options'][_0xc0b7('0x1f')]||null:null,'limit':0x1,'order':_0x3be582[_0xc0b7('0x19')]?_0x3be582['options'][_0xc0b7('0x2f')]||null:null,'group':db[_0xc0b7('0x21')][_0xc0b7('0x43')],'transaction':_0x3bb923,'lock':_0x3bb923['LOCK'][_0xc0b7('0x44')],'include':_0x3be582[_0xc0b7('0x19')]?_0x3be582['options'][_0xc0b7('0x1c')]?_['map'](_0x3be582[_0xc0b7('0x19')][_0xc0b7('0x1c')],function(_0x4d97a3){return{'model':db[_0x4d97a3['model']],'as':_0x4d97a3['as'],'attributes':_0x4d97a3[_0xc0b7('0x1f')],'include':_0x4d97a3[_0xc0b7('0x1c')]?_[_0xc0b7('0x1d')](_0x4d97a3[_0xc0b7('0x1c')],function(_0x4fc020){return{'model':db[_0x4fc020[_0xc0b7('0x1e')]],'as':_0x4fc020['as'],'attributes':_0x4fc020[_0xc0b7('0x1f')],'include':_0x4fc020[_0xc0b7('0x1c')]?_[_0xc0b7('0x1d')](_0x4fc020[_0xc0b7('0x1c')],function(_0x4d2212){return{'model':db[_0x4d2212[_0xc0b7('0x1e')]],'as':_0x4d2212['as'],'attributes':_0x4d2212['attributes']};}):[]};}):[]};}):[]:[]})[_0xc0b7('0x23')](function(_0x1e32d6){var _0xad5d8d=[];for(var _0x137777=0x0;_0x137777<_0x1e32d6[_0xc0b7('0x36')];_0x137777+=0x1){_0xad5d8d['push'](_0x1e32d6[_0x137777]['update'](_0x3be582['body'],{'transaction':_0x3bb923}));}return BPromise[_0xc0b7('0x39')](_0xad5d8d);});})['then'](function(_0x475c10){logger['info'](_0xc0b7('0x42'),_0x3be582);logger[_0xc0b7('0xf')](_0xc0b7('0x42'),_0x3be582,JSON[_0xc0b7('0x11')](_0x475c10));_0x11b17f(_0x475c10);})[_0xc0b7('0x16')](function(_0x4ffe3f){logger[_0xc0b7('0x12')](_0xc0b7('0x42'),_0x4ffe3f['message'],_0x3be582);_0x2022f5(_0x4cc528[_0xc0b7('0x12')](0x1f4,_0x4ffe3f[_0xc0b7('0x14')]));});});});};exports[_0xc0b7('0x45')]=function(_0x3b6dbb){var _0x14ac09=this;return new Promise(function(_0x503a85,_0x1c8d50){db[_0xc0b7('0x30')][_0xc0b7('0x2d')]()[_0xc0b7('0x23')](function(_0x15276b){return db[_0xc0b7('0x21')]['findAll']({'raw':_0x3b6dbb['options']?_0x3b6dbb['options'][_0xc0b7('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b6dbb[_0xc0b7('0x19')]?_0x3b6dbb[_0xc0b7('0x19')][_0xc0b7('0x1b')]||null:null,'attributes':_0x3b6dbb[_0xc0b7('0x19')]?_0x3b6dbb['options'][_0xc0b7('0x1f')]||null:null,'limit':_0x3b6dbb[_0xc0b7('0x19')]?_0x3b6dbb[_0xc0b7('0x19')][_0xc0b7('0x29')]||null:null,'include':_0x3b6dbb[_0xc0b7('0x19')]?_0x3b6dbb['options'][_0xc0b7('0x1c')]?_[_0xc0b7('0x1d')](_0x3b6dbb['options']['include'],function(_0x39ce81){return{'model':db[_0x39ce81[_0xc0b7('0x1e')]],'as':_0x39ce81['as'],'attributes':_0x39ce81['as']===_0xc0b7('0x31')?_[_0xc0b7('0x32')](_0x15276b):_0x39ce81[_0xc0b7('0x1f')],'include':_0x39ce81[_0xc0b7('0x1c')]?_['map'](_0x39ce81['include'],function(_0x122edd){return{'model':db[_0x122edd[_0xc0b7('0x1e')]],'as':_0x122edd['as'],'attributes':_0x122edd[_0xc0b7('0x1f')],'include':_0x122edd[_0xc0b7('0x1c')]?_[_0xc0b7('0x1d')](_0x122edd[_0xc0b7('0x1c')],function(_0x2107ad){return{'model':db[_0x2107ad['model']],'as':_0x2107ad['as'],'attributes':_0x2107ad[_0xc0b7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb8c0e4){logger[_0xc0b7('0xc')](_0xc0b7('0x17'),_0x3b6dbb);logger[_0xc0b7('0xf')](_0xc0b7('0x17'),_0x3b6dbb,JSON[_0xc0b7('0x11')](_0xb8c0e4));_0x503a85(_0xb8c0e4);})['catch'](function(_0x8642cb){logger[_0xc0b7('0x12')](_0xc0b7('0x17'),_0x8642cb['message'],_0x3b6dbb);_0x1c8d50(_0x14ac09[_0xc0b7('0x12')](0x1f4,_0x8642cb['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 277d62c..8f1c950 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 _0x2d5a=['/:id','post','create','/preview','getPreview','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts'];(function(_0x2d2bcb,_0x3051fc){var _0x303f0f=function(_0x3fd68f){while(--_0x3fd68f){_0x2d2bcb['push'](_0x2d2bcb['shift']());}};_0x303f0f(++_0x3051fc);}(_0x2d5a,0xd8));var _0xa2d5=function(_0x33c0d9,_0xb46a8){_0x33c0d9=_0x33c0d9-0x0;var _0x157db0=_0x2d5a[_0x33c0d9];return _0x157db0;};'use strict';var multer=require(_0xa2d5('0x0'));var util=require(_0xa2d5('0x1'));var path=require(_0xa2d5('0x2'));var timeout=require(_0xa2d5('0x3'));var express=require(_0xa2d5('0x4'));var router=express[_0xa2d5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa2d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa2d5('0x7'));var controller=require('./cmHopper.controller');router[_0xa2d5('0x8')]('/',auth[_0xa2d5('0x9')](),controller['index']);router[_0xa2d5('0x8')](_0xa2d5('0xa'),auth[_0xa2d5('0x9')](),controller[_0xa2d5('0xb')]);router[_0xa2d5('0x8')](_0xa2d5('0xc'),auth[_0xa2d5('0x9')](),controller[_0xa2d5('0xd')]);router[_0xa2d5('0x8')](_0xa2d5('0xe'),auth[_0xa2d5('0x9')](),controller['show']);router[_0xa2d5('0xf')]('/',auth[_0xa2d5('0x9')](),controller[_0xa2d5('0x10')]);router[_0xa2d5('0xf')](_0xa2d5('0x11'),auth['isAuthenticated'](),controller[_0xa2d5('0x12')]);router[_0xa2d5('0x13')](_0xa2d5('0xe'),auth[_0xa2d5('0x9')](),controller[_0xa2d5('0x14')]);router['delete'](_0xa2d5('0xe'),auth[_0xa2d5('0x9')](),controller[_0xa2d5('0x15')]);module[_0xa2d5('0x16')]=router; \ No newline at end of file +var _0x626f=['/describe','describe','getOpenContacts','/:id','show','post','/preview','getPreview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x626f,0x184));var _0xf626=function(_0x25fd8c,_0x5e91fa){_0x25fd8c=_0x25fd8c-0x0;var _0x37ca9b=_0x626f[_0x25fd8c];return _0x37ca9b;};'use strict';var multer=require(_0xf626('0x0'));var util=require(_0xf626('0x1'));var path=require(_0xf626('0x2'));var timeout=require(_0xf626('0x3'));var express=require('express');var router=express[_0xf626('0x4')]();var fs_extra=require(_0xf626('0x5'));var auth=require(_0xf626('0x6'));var interaction=require(_0xf626('0x7'));var config=require(_0xf626('0x8'));var controller=require(_0xf626('0x9'));router[_0xf626('0xa')]('/',auth[_0xf626('0xb')](),controller['index']);router['get'](_0xf626('0xc'),auth[_0xf626('0xb')](),controller[_0xf626('0xd')]);router[_0xf626('0xa')]('/opencontacts',auth[_0xf626('0xb')](),controller[_0xf626('0xe')]);router[_0xf626('0xa')](_0xf626('0xf'),auth['isAuthenticated'](),controller[_0xf626('0x10')]);router[_0xf626('0x11')]('/',auth[_0xf626('0xb')](),controller['create']);router[_0xf626('0x11')](_0xf626('0x12'),auth['isAuthenticated'](),controller[_0xf626('0x13')]);router[_0xf626('0x14')](_0xf626('0xf'),auth[_0xf626('0xb')](),controller[_0xf626('0x15')]);router[_0xf626('0x16')](_0xf626('0xf'),auth[_0xf626('0xb')](),controller[_0xf626('0x17')]);module[_0xf626('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 75011ab..057837a 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 _0x05d4=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER'];(function(_0x251d2a,_0x560156){var _0xfbd53b=function(_0x165cac){while(--_0x165cac){_0x251d2a['push'](_0x251d2a['shift']());}};_0xfbd53b(++_0x560156);}(_0x05d4,0x1bc));var _0x405d=function(_0xa57f9f,_0x337d01){_0xa57f9f=_0xa57f9f-0x0;var _0xa98c39=_0x05d4[_0xa57f9f];return _0xa98c39;};'use strict';var moment=require(_0x405d('0x0'));var Sequelize=require(_0x405d('0x1'));module[_0x405d('0x2')]={'CmHopperId':{'type':Sequelize[_0x405d('0x3')]},'phone':{'type':Sequelize[_0x405d('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x405d('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x405d('0x5')],'defaultValue':moment()[_0x405d('0x6')](_0x405d('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x405d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x405d('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x405d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x405d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x405d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x405d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x405d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9de=['INTEGER','STRING','moment','sequelize'];(function(_0x2301c1,_0x3c5a47){var _0x28f1eb=function(_0x6a6bb){while(--_0x6a6bb){_0x2301c1['push'](_0x2301c1['shift']());}};_0x28f1eb(++_0x3c5a47);}(_0xa9de,0xb2));var _0xea9d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa9de[_0x4b369d];return _0x571a98;};'use strict';var moment=require(_0xea9d('0x0'));var Sequelize=require(_0xea9d('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xea9d('0x2')]},'phone':{'type':Sequelize[_0xea9d('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xea9d('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xea9d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea9d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xea9d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea9d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea9d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea9d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 d567872..21abe8a 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 _0xcd1a=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','end','sendStatus','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','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','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2afb28,_0x19e8b0){var _0x41d764=function(_0x566707){while(--_0x566707){_0x2afb28['push'](_0x2afb28['shift']());}};_0x41d764(++_0x19e8b0);}(_0xcd1a,0x147));var _0xacd1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xcd1a[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xacd1('0x0'));var rimraf=require(_0xacd1('0x1'));var zipdir=require(_0xacd1('0x2'));var jsonpatch=require(_0xacd1('0x3'));var rp=require(_0xacd1('0x4'));var moment=require('moment');var BPromise=require(_0xacd1('0x5'));var Mustache=require(_0xacd1('0x6'));var util=require(_0xacd1('0x7'));var path=require(_0xacd1('0x8'));var sox=require(_0xacd1('0x9'));var csv=require('to-csv');var ejs=require(_0xacd1('0xa'));var fs=require('fs');var fs_extra=require(_0xacd1('0xb'));var _=require(_0xacd1('0xc'));var squel=require(_0xacd1('0xd'));var crypto=require(_0xacd1('0xe'));var jsforce=require(_0xacd1('0xf'));var deskjs=require(_0xacd1('0x10'));var toCsv=require(_0xacd1('0x11'));var querystring=require(_0xacd1('0x12'));var Papa=require(_0xacd1('0x13'));var Redis=require(_0xacd1('0x14'));var authService=require(_0xacd1('0x15'));var qs=require(_0xacd1('0x16'));var as=require(_0xacd1('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacd1('0x18'))('api');var utils=require(_0xacd1('0x19'));var config=require(_0xacd1('0x1a'));var licenseUtil=require(_0xacd1('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x327832,_0x111d02){_0x111d02=_0x111d02||0xcc;return function(_0x41fae6){if(_0x41fae6){return _0x327832['sendStatus'](_0x111d02);}return _0x327832[_0xacd1('0x1c')](_0x111d02)['end']();};}function respondWithResult(_0xdf580d,_0x1c3e4c){_0x1c3e4c=_0x1c3e4c||0xc8;return function(_0x2a451c){if(_0x2a451c){return _0xdf580d[_0xacd1('0x1c')](_0x1c3e4c)['json'](_0x2a451c);}};}function respondWithFilteredResult(_0x53d6c3,_0x4c16fd){return function(_0x19511a){if(_0x19511a){var _0x105f89=typeof _0x4c16fd[_0xacd1('0x1d')]===_0xacd1('0x1e')&&typeof _0x4c16fd[_0xacd1('0x1f')]==='undefined';var _0x3b96b9=_0x19511a['count'];var _0x41b508=_0x105f89?0x0:_0x4c16fd['offset'];var _0x46e292=_0x105f89?_0x19511a[_0xacd1('0x20')]:_0x4c16fd[_0xacd1('0x1d')]+_0x4c16fd[_0xacd1('0x1f')];var _0x5da4bb;if(_0x46e292>=_0x3b96b9){_0x46e292=_0x3b96b9;_0x5da4bb=0xc8;}else{_0x5da4bb=0xce;}_0x53d6c3[_0xacd1('0x1c')](_0x5da4bb);return _0x53d6c3[_0xacd1('0x21')](_0xacd1('0x22'),_0x41b508+'-'+_0x46e292+'/'+_0x3b96b9)[_0xacd1('0x23')](_0x19511a);}return null;};}function patchUpdates(_0x16a923){return function(_0x45b06a){try{jsonpatch[_0xacd1('0x24')](_0x45b06a,_0x16a923,!![]);}catch(_0x4df7ff){return BPromise[_0xacd1('0x25')](_0x4df7ff);}return _0x45b06a['save']();};}function saveUpdates(_0x5f1dc6,_0x1991c9){return function(_0x491377){if(_0x491377){return _0x491377[_0xacd1('0x26')](_0x5f1dc6)['then'](function(_0x2c63f2){return _0x2c63f2;});}return null;};}function removeEntity(_0x2f0513,_0xda6c4b){return function(_0x1fe8fe){if(_0x1fe8fe){return _0x1fe8fe['destroy']()[_0xacd1('0x27')](function(){var _0x137e8b=_0x1fe8fe[_0xacd1('0x28')]({'plain':!![]});var _0x151322=_0xacd1('0x29');return db[_0xacd1('0x2a')][_0xacd1('0x2b')]({'where':{'type':_0x151322,'resourceId':_0x137e8b['id']}})[_0xacd1('0x27')](function(){return _0x1fe8fe;});})[_0xacd1('0x27')](function(){_0x2f0513[_0xacd1('0x1c')](0xcc)[_0xacd1('0x2c')]();});}};}function handleEntityNotFound(_0xa9063f,_0x46b2cc){return function(_0x3f0224){if(!_0x3f0224){_0xa9063f[_0xacd1('0x2d')](0x194);}return _0x3f0224;};}function handleError(_0x46b030,_0x363d1d){_0x363d1d=_0x363d1d||0x1f4;return function(_0xc5a359){logger['error'](_0xc5a359[_0xacd1('0x2e')]);if(_0xc5a359[_0xacd1('0x2f')]){delete _0xc5a359[_0xacd1('0x2f')];}_0x46b030[_0xacd1('0x1c')](_0x363d1d)['send'](_0xc5a359);};}exports[_0xacd1('0x30')]=function(_0x88bf04,_0x4bbe48){var _0x42da8c={},_0x2fffd2={},_0x3ebaad={'count':0x0,'rows':[]};var _0x4173ac=_[_0xacd1('0x31')](db[_0xacd1('0x32')][_0xacd1('0x33')],function(_0x1080dd){return{'name':_0x1080dd['fieldName'],'type':_0x1080dd[_0xacd1('0x34')][_0xacd1('0x35')]};});_0x2fffd2[_0xacd1('0x36')]=_[_0xacd1('0x31')](_0x4173ac,_0xacd1('0x2f'));_0x2fffd2[_0xacd1('0x37')]=_[_0xacd1('0x38')](_0x88bf04['query']);_0x2fffd2[_0xacd1('0x39')]=_[_0xacd1('0x3a')](_0x2fffd2['model'],_0x2fffd2[_0xacd1('0x37')]);_0x42da8c[_0xacd1('0x3b')]=_[_0xacd1('0x3a')](_0x2fffd2[_0xacd1('0x36')],qs[_0xacd1('0x3c')](_0x88bf04[_0xacd1('0x37')][_0xacd1('0x3c')]));_0x42da8c['attributes']=_0x42da8c[_0xacd1('0x3b')][_0xacd1('0x3d')]?_0x42da8c[_0xacd1('0x3b')]:_0x2fffd2[_0xacd1('0x36')];if(!_0x88bf04[_0xacd1('0x37')][_0xacd1('0x3e')](_0xacd1('0x3f'))){_0x42da8c[_0xacd1('0x1f')]=qs[_0xacd1('0x1f')](_0x88bf04[_0xacd1('0x37')][_0xacd1('0x1f')]);_0x42da8c[_0xacd1('0x1d')]=qs[_0xacd1('0x1d')](_0x88bf04[_0xacd1('0x37')][_0xacd1('0x1d')]);}_0x42da8c[_0xacd1('0x40')]=qs[_0xacd1('0x41')](_0x88bf04['query'][_0xacd1('0x41')]);_0x42da8c[_0xacd1('0x42')]=qs[_0xacd1('0x39')](_[_0xacd1('0x43')](_0x88bf04[_0xacd1('0x37')],_0x2fffd2[_0xacd1('0x39')]),_0x4173ac);if(_0x88bf04['query'][_0xacd1('0x44')]){_0x42da8c['where']=_[_0xacd1('0x45')](_0x42da8c[_0xacd1('0x42')],{'$or':_[_0xacd1('0x31')](_0x4173ac,function(_0x3321ad){if(_0x3321ad[_0xacd1('0x34')]!=='VIRTUAL'){var _0x370005={};_0x370005[_0x3321ad[_0xacd1('0x2f')]]={'$like':'%'+_0x88bf04[_0xacd1('0x37')][_0xacd1('0x44')]+'%'};return _0x370005;}})});}_0x42da8c=_['merge']({},_0x42da8c,_0x88bf04[_0xacd1('0x46')]);var _0x3367f8={'where':_0x42da8c['where']};return db[_0xacd1('0x32')][_0xacd1('0x20')](_0x3367f8)[_0xacd1('0x27')](function(_0x6d9a55){_0x3ebaad[_0xacd1('0x20')]=_0x6d9a55;if(_0x88bf04[_0xacd1('0x37')][_0xacd1('0x47')]){_0x42da8c[_0xacd1('0x48')]=[{'all':!![]}];}return db[_0xacd1('0x32')][_0xacd1('0x49')](_0x42da8c);})[_0xacd1('0x27')](function(_0x466a20){_0x3ebaad[_0xacd1('0x4a')]=_0x466a20;return _0x3ebaad;})[_0xacd1('0x27')](respondWithFilteredResult(_0x4bbe48,_0x42da8c))['catch'](handleError(_0x4bbe48,null));};exports['show']=function(_0x172cb1,_0x34a5d1){var _0xd459b1={'raw':!![],'where':{'id':_0x172cb1[_0xacd1('0x4b')]['id']}},_0x25adb6={};_0x25adb6['model']=_[_0xacd1('0x38')](db[_0xacd1('0x32')][_0xacd1('0x33')]);_0x25adb6[_0xacd1('0x37')]=_[_0xacd1('0x38')](_0x172cb1[_0xacd1('0x37')]);_0x25adb6[_0xacd1('0x39')]=_[_0xacd1('0x3a')](_0x25adb6[_0xacd1('0x36')],_0x25adb6[_0xacd1('0x37')]);_0xd459b1['attributes']=_[_0xacd1('0x3a')](_0x25adb6['model'],qs['fields'](_0x172cb1[_0xacd1('0x37')][_0xacd1('0x3c')]));_0xd459b1['attributes']=_0xd459b1[_0xacd1('0x3b')][_0xacd1('0x3d')]?_0xd459b1['attributes']:_0x25adb6[_0xacd1('0x36')];if(_0x172cb1['query'][_0xacd1('0x47')]){_0xd459b1[_0xacd1('0x48')]=[{'all':!![]}];}_0xd459b1=_[_0xacd1('0x45')]({},_0xd459b1,_0x172cb1['options']);return db['CmHopperAdditionalPhone'][_0xacd1('0x4c')](_0xd459b1)[_0xacd1('0x27')](handleEntityNotFound(_0x34a5d1,null))['then'](respondWithResult(_0x34a5d1,null))[_0xacd1('0x4d')](handleError(_0x34a5d1,null));};exports[_0xacd1('0x4e')]=function(_0x5797c0,_0x1fbb58){return db[_0xacd1('0x32')][_0xacd1('0x4e')](_0x5797c0[_0xacd1('0x4f')],{})[_0xacd1('0x27')](function(_0x109da2){var _0x427184=_0x5797c0['user'][_0xacd1('0x28')]({'plain':!![]});if(!_0x427184)throw new Error(_0xacd1('0x50'));if(_0x427184['role']===_0xacd1('0x51')){var _0x4843c4=_0x109da2[_0xacd1('0x28')]({'plain':!![]});var _0x361f4a='CmHopperAdditionalPhones';return db[_0xacd1('0x52')][_0xacd1('0x4c')]({'where':{'name':_0x361f4a,'userProfileId':_0x427184[_0xacd1('0x53')]},'raw':!![]})[_0xacd1('0x27')](function(_0x4f2b70){if(_0x4f2b70&&_0x4f2b70['autoAssociation']===0x0){return db[_0xacd1('0x2a')][_0xacd1('0x4e')]({'name':_0x4843c4[_0xacd1('0x2f')],'resourceId':_0x4843c4['id'],'type':_0x4f2b70[_0xacd1('0x2f')],'sectionId':_0x4f2b70['id']},{})[_0xacd1('0x27')](function(){return _0x109da2;});}else{return _0x109da2;}})['catch'](function(_0x3d36ac){logger[_0xacd1('0x54')](_0xacd1('0x55'),_0x3d36ac);throw _0x3d36ac;});}return _0x109da2;})[_0xacd1('0x27')](respondWithResult(_0x1fbb58,0xc9))[_0xacd1('0x4d')](handleError(_0x1fbb58,null));};exports['update']=function(_0x5a266e,_0x39397e){if(_0x5a266e[_0xacd1('0x4f')]['id']){delete _0x5a266e[_0xacd1('0x4f')]['id'];}return db['CmHopperAdditionalPhone'][_0xacd1('0x4c')]({'where':{'id':_0x5a266e[_0xacd1('0x4b')]['id']}})[_0xacd1('0x27')](handleEntityNotFound(_0x39397e,null))[_0xacd1('0x27')](saveUpdates(_0x5a266e[_0xacd1('0x4f')],null))[_0xacd1('0x27')](respondWithResult(_0x39397e,null))[_0xacd1('0x4d')](handleError(_0x39397e,null));};exports[_0xacd1('0x2b')]=function(_0xd7608f,_0x35afe8){return db[_0xacd1('0x32')][_0xacd1('0x4c')]({'where':{'id':_0xd7608f[_0xacd1('0x4b')]['id']}})[_0xacd1('0x27')](handleEntityNotFound(_0x35afe8,null))[_0xacd1('0x27')](removeEntity(_0x35afe8,null))['catch'](handleError(_0x35afe8,null));}; \ No newline at end of file +var _0xa967=['order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','keys','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopperAdditionalPhones','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','request-promise','moment','bluebird','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','get','error','stack','name','index','CmHopperAdditionalPhone','rawAttributes','type','key','model','intersection','attributes','fields','length','query','hasOwnProperty'];(function(_0x1cb042,_0x481bf8){var _0x1495a5=function(_0x18a5ee){while(--_0x18a5ee){_0x1cb042['push'](_0x1cb042['shift']());}};_0x1495a5(++_0x481bf8);}(_0xa967,0x6d));var _0x7a96=function(_0x3ef626,_0x335afc){_0x3ef626=_0x3ef626-0x0;var _0x57039b=_0xa967[_0x3ef626];return _0x57039b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a96('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a96('0x1'));var rp=require(_0x7a96('0x2'));var moment=require(_0x7a96('0x3'));var BPromise=require(_0x7a96('0x4'));var Mustache=require('mustache');var util=require(_0x7a96('0x5'));var path=require(_0x7a96('0x6'));var sox=require('sox');var csv=require(_0x7a96('0x7'));var ejs=require(_0x7a96('0x8'));var fs=require('fs');var fs_extra=require(_0x7a96('0x9'));var _=require(_0x7a96('0xa'));var squel=require(_0x7a96('0xb'));var crypto=require(_0x7a96('0xc'));var jsforce=require(_0x7a96('0xd'));var deskjs=require(_0x7a96('0xe'));var toCsv=require(_0x7a96('0x7'));var querystring=require(_0x7a96('0xf'));var Papa=require(_0x7a96('0x10'));var Redis=require(_0x7a96('0x11'));var authService=require(_0x7a96('0x12'));var qs=require(_0x7a96('0x13'));var as=require(_0x7a96('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a96('0x15'))(_0x7a96('0x16'));var utils=require(_0x7a96('0x17'));var config=require(_0x7a96('0x18'));var licenseUtil=require(_0x7a96('0x19'));var db=require(_0x7a96('0x1a'))['db'];function respondWithStatusCode(_0x244804,_0x394492){_0x394492=_0x394492||0xcc;return function(_0x2f4744){if(_0x2f4744){return _0x244804[_0x7a96('0x1b')](_0x394492);}return _0x244804['status'](_0x394492)[_0x7a96('0x1c')]();};}function respondWithResult(_0x3de2b5,_0x3d2ad1){_0x3d2ad1=_0x3d2ad1||0xc8;return function(_0x47cef6){if(_0x47cef6){return _0x3de2b5[_0x7a96('0x1d')](_0x3d2ad1)[_0x7a96('0x1e')](_0x47cef6);}};}function respondWithFilteredResult(_0x3f4ab5,_0xb24fa3){return function(_0x282f28){if(_0x282f28){var _0xa2aab3=typeof _0xb24fa3['offset']===_0x7a96('0x1f')&&typeof _0xb24fa3[_0x7a96('0x20')]==='undefined';var _0x33f7d2=_0x282f28[_0x7a96('0x21')];var _0x116db2=_0xa2aab3?0x0:_0xb24fa3[_0x7a96('0x22')];var _0x4edc5d=_0xa2aab3?_0x282f28[_0x7a96('0x21')]:_0xb24fa3[_0x7a96('0x22')]+_0xb24fa3[_0x7a96('0x20')];var _0x42fe1d;if(_0x4edc5d>=_0x33f7d2){_0x4edc5d=_0x33f7d2;_0x42fe1d=0xc8;}else{_0x42fe1d=0xce;}_0x3f4ab5[_0x7a96('0x1d')](_0x42fe1d);return _0x3f4ab5['set'](_0x7a96('0x23'),_0x116db2+'-'+_0x4edc5d+'/'+_0x33f7d2)[_0x7a96('0x1e')](_0x282f28);}return null;};}function patchUpdates(_0x1ac97d){return function(_0x24cd90){try{jsonpatch[_0x7a96('0x24')](_0x24cd90,_0x1ac97d,!![]);}catch(_0x444699){return BPromise[_0x7a96('0x25')](_0x444699);}return _0x24cd90['save']();};}function saveUpdates(_0x6c3066,_0x38e7c5){return function(_0x5ed058){if(_0x5ed058){return _0x5ed058[_0x7a96('0x26')](_0x6c3066)[_0x7a96('0x27')](function(_0x2816ad){return _0x2816ad;});}return null;};}function removeEntity(_0x297c74,_0x3878c3){return function(_0x2b1a78){if(_0x2b1a78){return _0x2b1a78[_0x7a96('0x28')]()[_0x7a96('0x27')](function(){var _0x2f4499=_0x2b1a78[_0x7a96('0x29')]({'plain':!![]});var _0x11ae28='CmHopperAdditionalPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x11ae28,'resourceId':_0x2f4499['id']}})['then'](function(){return _0x2b1a78;});})[_0x7a96('0x27')](function(){_0x297c74[_0x7a96('0x1d')](0xcc)[_0x7a96('0x1c')]();});}};}function handleEntityNotFound(_0x9ccf0,_0x184866){return function(_0x1ec8ed){if(!_0x1ec8ed){_0x9ccf0['sendStatus'](0x194);}return _0x1ec8ed;};}function handleError(_0x5b9ce5,_0x1f6c17){_0x1f6c17=_0x1f6c17||0x1f4;return function(_0x43453a){logger[_0x7a96('0x2a')](_0x43453a[_0x7a96('0x2b')]);if(_0x43453a[_0x7a96('0x2c')]){delete _0x43453a[_0x7a96('0x2c')];}_0x5b9ce5[_0x7a96('0x1d')](_0x1f6c17)['send'](_0x43453a);};}exports[_0x7a96('0x2d')]=function(_0x3fc310,_0x40e500){var _0x3a0f55={},_0x26d800={},_0x5edc0f={'count':0x0,'rows':[]};var _0x2acd2c=_['map'](db[_0x7a96('0x2e')][_0x7a96('0x2f')],function(_0x361bfc){return{'name':_0x361bfc['fieldName'],'type':_0x361bfc[_0x7a96('0x30')][_0x7a96('0x31')]};});_0x26d800[_0x7a96('0x32')]=_['map'](_0x2acd2c,_0x7a96('0x2c'));_0x26d800['query']=_['keys'](_0x3fc310['query']);_0x26d800['filters']=_[_0x7a96('0x33')](_0x26d800['model'],_0x26d800['query']);_0x3a0f55[_0x7a96('0x34')]=_[_0x7a96('0x33')](_0x26d800[_0x7a96('0x32')],qs[_0x7a96('0x35')](_0x3fc310['query'][_0x7a96('0x35')]));_0x3a0f55[_0x7a96('0x34')]=_0x3a0f55[_0x7a96('0x34')][_0x7a96('0x36')]?_0x3a0f55[_0x7a96('0x34')]:_0x26d800[_0x7a96('0x32')];if(!_0x3fc310[_0x7a96('0x37')][_0x7a96('0x38')]('nolimit')){_0x3a0f55[_0x7a96('0x20')]=qs['limit'](_0x3fc310['query'][_0x7a96('0x20')]);_0x3a0f55[_0x7a96('0x22')]=qs['offset'](_0x3fc310[_0x7a96('0x37')][_0x7a96('0x22')]);}_0x3a0f55[_0x7a96('0x39')]=qs[_0x7a96('0x3a')](_0x3fc310['query'][_0x7a96('0x3a')]);_0x3a0f55[_0x7a96('0x3b')]=qs[_0x7a96('0x3c')](_['pick'](_0x3fc310[_0x7a96('0x37')],_0x26d800[_0x7a96('0x3c')]),_0x2acd2c);if(_0x3fc310[_0x7a96('0x37')][_0x7a96('0x3d')]){_0x3a0f55['where']=_[_0x7a96('0x3e')](_0x3a0f55['where'],{'$or':_[_0x7a96('0x3f')](_0x2acd2c,function(_0x4fa38c){if(_0x4fa38c[_0x7a96('0x30')]!==_0x7a96('0x40')){var _0x5b64de={};_0x5b64de[_0x4fa38c[_0x7a96('0x2c')]]={'$like':'%'+_0x3fc310[_0x7a96('0x37')][_0x7a96('0x3d')]+'%'};return _0x5b64de;}})});}_0x3a0f55=_['merge']({},_0x3a0f55,_0x3fc310[_0x7a96('0x41')]);var _0x1ff1a8={'where':_0x3a0f55['where']};return db[_0x7a96('0x2e')][_0x7a96('0x21')](_0x1ff1a8)['then'](function(_0x7631f7){_0x5edc0f['count']=_0x7631f7;if(_0x3fc310['query'][_0x7a96('0x42')]){_0x3a0f55['include']=[{'all':!![]}];}return db[_0x7a96('0x2e')][_0x7a96('0x43')](_0x3a0f55);})['then'](function(_0x2b5a27){_0x5edc0f[_0x7a96('0x44')]=_0x2b5a27;return _0x5edc0f;})[_0x7a96('0x27')](respondWithFilteredResult(_0x40e500,_0x3a0f55))[_0x7a96('0x45')](handleError(_0x40e500,null));};exports['show']=function(_0x262f4a,_0x40e00e){var _0x57a97e={'raw':!![],'where':{'id':_0x262f4a['params']['id']}},_0x132f60={};_0x132f60[_0x7a96('0x32')]=_[_0x7a96('0x46')](db['CmHopperAdditionalPhone'][_0x7a96('0x2f')]);_0x132f60[_0x7a96('0x37')]=_[_0x7a96('0x46')](_0x262f4a[_0x7a96('0x37')]);_0x132f60[_0x7a96('0x3c')]=_[_0x7a96('0x33')](_0x132f60[_0x7a96('0x32')],_0x132f60[_0x7a96('0x37')]);_0x57a97e[_0x7a96('0x34')]=_[_0x7a96('0x33')](_0x132f60[_0x7a96('0x32')],qs[_0x7a96('0x35')](_0x262f4a[_0x7a96('0x37')][_0x7a96('0x35')]));_0x57a97e[_0x7a96('0x34')]=_0x57a97e[_0x7a96('0x34')][_0x7a96('0x36')]?_0x57a97e[_0x7a96('0x34')]:_0x132f60[_0x7a96('0x32')];if(_0x262f4a[_0x7a96('0x37')][_0x7a96('0x42')]){_0x57a97e[_0x7a96('0x47')]=[{'all':!![]}];}_0x57a97e=_['merge']({},_0x57a97e,_0x262f4a[_0x7a96('0x41')]);return db[_0x7a96('0x2e')]['find'](_0x57a97e)['then'](handleEntityNotFound(_0x40e00e,null))[_0x7a96('0x27')](respondWithResult(_0x40e00e,null))['catch'](handleError(_0x40e00e,null));};exports[_0x7a96('0x48')]=function(_0x21fb38,_0x53874b){return db[_0x7a96('0x2e')][_0x7a96('0x48')](_0x21fb38[_0x7a96('0x49')],{})[_0x7a96('0x27')](function(_0x38f04f){var _0x4bbbc6=_0x21fb38['user'][_0x7a96('0x29')]({'plain':!![]});if(!_0x4bbbc6)throw new Error(_0x7a96('0x4a'));if(_0x4bbbc6['role']==='user'){var _0x3b5a87=_0x38f04f['get']({'plain':!![]});var _0x4cbaa5=_0x7a96('0x4b');return db[_0x7a96('0x4c')][_0x7a96('0x4d')]({'where':{'name':_0x4cbaa5,'userProfileId':_0x4bbbc6[_0x7a96('0x4e')]},'raw':!![]})[_0x7a96('0x27')](function(_0xdd1b71){if(_0xdd1b71&&_0xdd1b71[_0x7a96('0x4f')]===0x0){return db[_0x7a96('0x50')][_0x7a96('0x48')]({'name':_0x3b5a87['name'],'resourceId':_0x3b5a87['id'],'type':_0xdd1b71[_0x7a96('0x2c')],'sectionId':_0xdd1b71['id']},{})[_0x7a96('0x27')](function(){return _0x38f04f;});}else{return _0x38f04f;}})[_0x7a96('0x45')](function(_0x53534e){logger['error'](_0x7a96('0x51'),_0x53534e);throw _0x53534e;});}return _0x38f04f;})[_0x7a96('0x27')](respondWithResult(_0x53874b,0xc9))[_0x7a96('0x45')](handleError(_0x53874b,null));};exports[_0x7a96('0x26')]=function(_0x23fc9b,_0xfbd907){if(_0x23fc9b[_0x7a96('0x49')]['id']){delete _0x23fc9b[_0x7a96('0x49')]['id'];}return db[_0x7a96('0x2e')][_0x7a96('0x4d')]({'where':{'id':_0x23fc9b[_0x7a96('0x52')]['id']}})[_0x7a96('0x27')](handleEntityNotFound(_0xfbd907,null))[_0x7a96('0x27')](saveUpdates(_0x23fc9b[_0x7a96('0x49')],null))[_0x7a96('0x27')](respondWithResult(_0xfbd907,null))[_0x7a96('0x45')](handleError(_0xfbd907,null));};exports[_0x7a96('0x28')]=function(_0x248d36,_0x30410d){return db[_0x7a96('0x2e')][_0x7a96('0x4d')]({'where':{'id':_0x248d36[_0x7a96('0x52')]['id']}})['then'](handleEntityNotFound(_0x30410d,null))[_0x7a96('0x27')](removeEntity(_0x30410d,null))[_0x7a96('0x45')](handleError(_0x30410d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 403f9d2..feb7a5e 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 _0xe3c5=['define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x584d37,_0x13fb20){_0x584d37=_0x584d37-0x0;var _0x1a1dbf=_0xe3c5[_0x584d37];return _0x1a1dbf;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var logger=require(_0x5e3c('0x2'))(_0x5e3c('0x3'));var moment=require(_0x5e3c('0x4'));var BPromise=require(_0x5e3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e3c('0x6'));var rimraf=require(_0x5e3c('0x7'));var config=require(_0x5e3c('0x8'));var attributes=require(_0x5e3c('0x9'));module[_0x5e3c('0xa')]=function(_0x31a878,_0x1e631d){return _0x31a878[_0x5e3c('0xb')](_0x5e3c('0xc'),attributes,{'tableName':_0x5e3c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1427=['CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','api','moment','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define'];(function(_0x40548b,_0x4fa248){var _0x4b93b4=function(_0x2602a2){while(--_0x2602a2){_0x40548b['push'](_0x40548b['shift']());}};_0x4b93b4(++_0x4fa248);}(_0x1427,0x7b));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7142('0x0'));var logger=require(_0x7142('0x1'))(_0x7142('0x2'));var moment=require(_0x7142('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7142('0x4'));var rimraf=require('rimraf');var config=require(_0x7142('0x5'));var attributes=require(_0x7142('0x6'));module[_0x7142('0x7')]=function(_0x3a225d,_0x28a8cd){return _0x3a225d[_0x7142('0x8')](_0x7142('0x9'),attributes,{'tableName':_0x7142('0xa'),'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 de40026..2b4a6d9 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 _0xdc49=['../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','VerifyAdditionalPhones','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','findOne','countbusyretry','countnosuchnumberretry','countdropretry','SwapAdditionalPhones','ASC','duration','waitTime','scheduledat','minutes','add','phone','isNil','createdAt','updatedAt','additionalToHop','transaction','update','CmHopper','IncrementPreviewCounters','field','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ff63d,_0x245cec){var _0x52da23=function(_0x7464de){while(--_0x7464de){_0x3ff63d['push'](_0x3ff63d['shift']());}};_0x52da23(++_0x245cec);}(_0xdc49,0xa9));var _0x9dc4=function(_0x3719ca,_0x36a820){_0x3719ca=_0x3719ca-0x0;var _0x30744a=_0xdc49[_0x3719ca];return _0x30744a;};'use strict';var _=require(_0x9dc4('0x0'));var util=require(_0x9dc4('0x1'));var moment=require(_0x9dc4('0x2'));var BPromise=require('bluebird');var rs=require(_0x9dc4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9dc4('0x4'))['db'];var utils=require(_0x9dc4('0x5'));var logger=require(_0x9dc4('0x6'))(_0x9dc4('0x7'));var config=require(_0x9dc4('0x8'));var jayson=require(_0x9dc4('0x9'));var client=jayson[_0x9dc4('0xa')][_0x9dc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51626e,_0x4b0488,_0x2c0fcc){return new BPromise(function(_0x41c390,_0x3cf5d7){return client['request'](_0x51626e,_0x2c0fcc)[_0x9dc4('0xc')](function(_0x3bc638){logger[_0x9dc4('0xd')](_0x9dc4('0xe'),_0x4b0488,'request\x20sent');logger[_0x9dc4('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x4b0488,_0x9dc4('0x10'),JSON[_0x9dc4('0x11')](_0x3bc638));if(_0x3bc638['error']){if(_0x3bc638['error'][_0x9dc4('0x12')]===0x1f4){logger['error'](_0x9dc4('0xe'),_0x4b0488,_0x3bc638[_0x9dc4('0x13')][_0x9dc4('0x14')]);return _0x3cf5d7(_0x3bc638['error'][_0x9dc4('0x14')]);}logger['error'](_0x9dc4('0xe'),_0x4b0488,_0x3bc638[_0x9dc4('0x13')]['message']);return _0x41c390(_0x3bc638[_0x9dc4('0x13')][_0x9dc4('0x14')]);}else{logger[_0x9dc4('0xd')](_0x9dc4('0xe'),_0x4b0488,_0x9dc4('0x10'));_0x41c390(_0x3bc638[_0x9dc4('0x15')][_0x9dc4('0x14')]);}})[_0x9dc4('0x16')](function(_0xfbe2ff){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4b0488,_0xfbe2ff);_0x3cf5d7(_0xfbe2ff);});});}exports[_0x9dc4('0x17')]=function(_0x3d63f1){var _0x2a3e01=this;return new Promise(function(_0x18ebb1,_0x4359e6){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x3d63f1[_0x9dc4('0x18')][_0x9dc4('0x19')],'ListId':_0x3d63f1[_0x9dc4('0x18')][_0x9dc4('0x1a')],'VoiceQueueId':_0x3d63f1[_0x9dc4('0x18')][_0x9dc4('0x1b')]===undefined?null:_0x3d63f1[_0x9dc4('0x18')][_0x9dc4('0x1b')],'CampaignId':_0x3d63f1[_0x9dc4('0x18')][_0x9dc4('0x1c')]===undefined?null:_0x3d63f1[_0x9dc4('0x18')][_0x9dc4('0x1c')]}})[_0x9dc4('0xc')](function(_0x2867c5){if(_0x2867c5!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2867c5['id'],'OrderBy':{'$gt':_0x2867c5[_0x9dc4('0x1d')]}},'order':[[_0x9dc4('0x1d'),'ASC']]})['then'](function(_0x4abfd4){var _0x32e7b2=0x0;if(_0x4abfd4){if(_0x4abfd4['countbusyretry']+_0x4abfd4[_0x9dc4('0x1e')]+_0x4abfd4[_0x9dc4('0x1f')]+_0x4abfd4['countnosuchnumberretry']+_0x4abfd4['countdropretry']+_0x4abfd4[_0x9dc4('0x20')]+_0x4abfd4[_0x9dc4('0x21')]+_0x4abfd4[_0x9dc4('0x22')]<_0x3d63f1[_0x9dc4('0x23')][_0x9dc4('0x24')])_0x32e7b2=0x1;_0x18ebb1({'additional':_0x32e7b2});}else{return db[_0x9dc4('0x25')][_0x9dc4('0x26')]({'raw':!![],'where':{'CmHopperId':_0x2867c5['id']},'order':[['OrderBy','ASC']]})[_0x9dc4('0xc')](function(_0xef6c40){var _0x241bd6=0x0;if(_0xef6c40){if(_0xef6c40[_0x9dc4('0x27')]+_0xef6c40[_0x9dc4('0x1e')]+_0xef6c40['countnoanswerretry']+_0xef6c40[_0x9dc4('0x28')]+_0xef6c40[_0x9dc4('0x29')]+_0xef6c40[_0x9dc4('0x20')]+_0xef6c40[_0x9dc4('0x21')]+_0xef6c40[_0x9dc4('0x22')]<_0x3d63f1['entity']['dialGlobalMaxRetry'])_0x241bd6=0x1;_0x18ebb1({'additional':_0x241bd6});}else{_0x18ebb1({'additional':0x0});}})['catch'](function(_0x5c3463){logger['error'](_0x9dc4('0x17'),_0x5c3463[_0x9dc4('0x14')],_0x3d63f1);_0x4359e6(_0x2a3e01[_0x9dc4('0x13')](0x1f4,_0x5c3463[_0x9dc4('0x14')]));});}})[_0x9dc4('0x16')](function(_0x59d921){logger[_0x9dc4('0x13')]('VerifyAdditionalPhones',_0x59d921[_0x9dc4('0x14')],_0x3d63f1);_0x4359e6(_0x2a3e01[_0x9dc4('0x13')](0x1f4,_0x59d921[_0x9dc4('0x14')]));});}else _0x18ebb1({'additional':0x0});});});};exports[_0x9dc4('0x2a')]=function(_0x4093a7){var _0x551db5=this;return new Promise(function(_0x4abd18,_0x3df596){return db['CmHopper'][_0x9dc4('0x26')]({'raw':!![],'where':{'ContactId':_0x4093a7['body'][_0x9dc4('0x19')],'ListId':_0x4093a7[_0x9dc4('0x18')][_0x9dc4('0x1a')],'VoiceQueueId':_0x4093a7[_0x9dc4('0x18')][_0x9dc4('0x1b')]===undefined?null:_0x4093a7[_0x9dc4('0x18')][_0x9dc4('0x1b')],'CampaignId':_0x4093a7['body'][_0x9dc4('0x1c')]===undefined?null:_0x4093a7[_0x9dc4('0x18')][_0x9dc4('0x1c')]}})[_0x9dc4('0xc')](function(_0x35a26f){if(_0x35a26f!=null){return db[_0x9dc4('0x25')][_0x9dc4('0x26')]({'raw':!![],'where':{'CmHopperId':_0x35a26f['id'],'OrderBy':{'$gte':_0x35a26f['OrderBy']}},'order':[['OrderBy',_0x9dc4('0x2b')]]})[_0x9dc4('0xc')](function(_0x328578){if(_0x328578)return activateAdditionalPhone(_0x35a26f,_0x4093a7[_0x9dc4('0x18')],_0x328578,_0x4093a7[_0x9dc4('0x2c')],_0x4093a7['waitTime'])[_0x9dc4('0xc')](function(_0x525e24){_0x4abd18(_0x525e24);});else{return db[_0x9dc4('0x25')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x35a26f['id']},'order':[[_0x9dc4('0x1d'),_0x9dc4('0x2b')]]})[_0x9dc4('0xc')](function(_0x1daa54){if(_0x1daa54)return activateAdditionalPhone(_0x35a26f,_0x4093a7[_0x9dc4('0x18')],_0x1daa54,_0x4093a7[_0x9dc4('0x2c')],_0x4093a7[_0x9dc4('0x2d')])['then'](function(_0x2032c7){_0x4abd18(_0x2032c7);});else{_0x4abd18({'id':_0x35a26f['id'],'phone':''});}})[_0x9dc4('0x16')](function(_0x3855a0){logger[_0x9dc4('0x13')](_0x9dc4('0x17'),_0x3855a0[_0x9dc4('0x14')],_0x4093a7);_0x3df596(_0x551db5[_0x9dc4('0x13')](0x1f4,_0x3855a0[_0x9dc4('0x14')]));});}})[_0x9dc4('0x16')](function(_0x501555){logger[_0x9dc4('0x13')](_0x9dc4('0x17'),_0x501555[_0x9dc4('0x14')],_0x4093a7);_0x3df596(_0x551db5['error'](0x1f4,_0x501555['message']));});}else _0x4abd18(0x1);});});};function activateAdditionalPhone(_0xe5ce18,_0x9120d3,_0x40cf11,_0x35b0f8,_0x5ea0cc){return new Promise(function(_0x31ead4,_0x4864a3){logger['info'](_0x9dc4('0x17'),_0x40cf11);var _0x805397;if(moment()>moment(_0x40cf11[_0x9dc4('0x2e')])){_0x805397=moment()['add'](_0x5ea0cc||0x3,_0x9dc4('0x2f'));}else{if(_0x40cf11[_0x9dc4('0x1d')]==0x0){_0x805397=moment(_0x40cf11[_0x9dc4('0x2e')]);}else{_0x805397=moment()[_0x9dc4('0x30')](_0x5ea0cc||0x3,_0x9dc4('0x2f'));}}var _0x383935={'phone':_0xe5ce18[_0x9dc4('0x31')],'active':0x0,'OrderBy':_[_0x9dc4('0x32')](_0xe5ce18[_0x9dc4('0x1d')])?0x0:_0xe5ce18[_0x9dc4('0x1d')],'scheduledat':moment()['add'](_0x35b0f8||0x1,_0x9dc4('0x2f')),'countbusyretry':_0x9120d3[_0x9dc4('0x27')],'countcongestionretry':_0x9120d3[_0x9dc4('0x1e')],'countnoanswerretry':_0x9120d3['countnoanswerretry'],'countnosuchnumberretry':_0x9120d3[_0x9dc4('0x28')],'countdropretry':_0x9120d3[_0x9dc4('0x29')],'countabandonedretry':_0x9120d3[_0x9dc4('0x20')],'countmachineretry':_0x9120d3[_0x9dc4('0x21')],'countagentrejectretry':_0x9120d3[_0x9dc4('0x22')],'createdAt':_0x9120d3[_0x9dc4('0x33')],'updatedAt':_0x9120d3[_0x9dc4('0x34')]};var _0x445461={'CmHopperId':_0xe5ce18['id'],'phone':_0x40cf11[_0x9dc4('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x40cf11[_0x9dc4('0x1d')])?0x0:_0x40cf11[_0x9dc4('0x1d')],'scheduledat':_0x805397,'countbusyretry':_0x40cf11[_0x9dc4('0x27')],'countcongestionretry':_0x40cf11[_0x9dc4('0x1e')],'countnoanswerretry':_0x40cf11[_0x9dc4('0x1f')],'countnosuchnumberretry':_0x40cf11[_0x9dc4('0x28')],'countdropretry':_0x40cf11['countdropretry'],'countabandonedretry':_0x40cf11[_0x9dc4('0x20')],'countmachineretry':_0x40cf11['countmachineretry'],'countagentrejectretry':_0x40cf11[_0x9dc4('0x22')],'createdAt':_0x40cf11[_0x9dc4('0x33')],'updatedAt':_0x40cf11['updatedAt']};logger['info']('hopperToAdd',_0x383935);logger[_0x9dc4('0xd')](_0x9dc4('0x35'),_0x445461);return db['sequelize'][_0x9dc4('0x36')](function(_0x5317eb){return db[_0x9dc4('0x25')][_0x9dc4('0x37')](_0x383935,{'where':{'id':_0x40cf11['id']}},{'transaction':_0x5317eb})['then'](function(){return db[_0x9dc4('0x38')][_0x9dc4('0x37')](_0x445461,{'where':{'id':_0xe5ce18['id']}},{'transaction':_0x5317eb});});})['then'](function(_0x5b7dcc){_0x31ead4({'id':_0xe5ce18['id'],'phone':_0x40cf11[_0x9dc4('0x31')]});})[_0x9dc4('0x16')](function(_0x4f11c1){logger[_0x9dc4('0x13')](_0x9dc4('0x17'),_0x4f11c1['message'],req);_0x4864a3(_this[_0x9dc4('0x13')](0x1f4,_0x4f11c1[_0x9dc4('0x14')]));});});}exports[_0x9dc4('0x39')]=function(_0x51bc56){var _0xd04067=this;return new Promise(function(_0x5d5a66,_0x15771d){return db[_0x9dc4('0x38')][_0x9dc4('0x37')](_0x51bc56[_0x9dc4('0x18')][_0x9dc4('0x3a')],{'where':{'id':_0x51bc56['body']['id']}})[_0x9dc4('0xc')](function(_0x300b48){_0x5d5a66(_0x300b48);})['catch'](function(_0x5def20){logger['error']('IncrementPreviewCounters',_0x5def20['message'],_0x51bc56);_0x15771d(_0xd04067[_0x9dc4('0x13')](0x1f4,_0x5def20[_0x9dc4('0x14')]));});});}; \ No newline at end of file +var _0x8422=['debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','entity','countabandonedretry','dialGlobalMaxRetry','catch','SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','add','createdAt','updatedAt','isNil','countdropretry','hopperToAdd','transaction','update','phone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x5c25ed,_0x54b40b){var _0x3eb331=function(_0x56fa93){while(--_0x56fa93){_0x5c25ed['push'](_0x5c25ed['shift']());}};_0x3eb331(++_0x54b40b);}(_0x8422,0x64));var _0x2842=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0x8422[_0x28b0a4];return _0x105ce6;};'use strict';var _=require(_0x2842('0x0'));var util=require(_0x2842('0x1'));var moment=require(_0x2842('0x2'));var BPromise=require(_0x2842('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2842('0x4'));var db=require(_0x2842('0x5'))['db'];var utils=require(_0x2842('0x6'));var logger=require(_0x2842('0x7'))(_0x2842('0x8'));var config=require(_0x2842('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2842('0xa')][_0x2842('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x403f7a,_0x2e3fb0,_0x555f54){return new BPromise(function(_0x138d23,_0x4e422d){return client[_0x2842('0xc')](_0x403f7a,_0x555f54)[_0x2842('0xd')](function(_0x8af36b){logger[_0x2842('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2e3fb0,_0x2842('0xf'));logger[_0x2842('0x10')](_0x2842('0x11'),_0x2e3fb0,_0x2842('0xf'),JSON['stringify'](_0x8af36b));if(_0x8af36b['error']){if(_0x8af36b[_0x2842('0x12')]['code']===0x1f4){logger[_0x2842('0x12')](_0x2842('0x13'),_0x2e3fb0,_0x8af36b[_0x2842('0x12')][_0x2842('0x14')]);return _0x4e422d(_0x8af36b['error']['message']);}logger[_0x2842('0x12')](_0x2842('0x13'),_0x2e3fb0,_0x8af36b['error']['message']);return _0x138d23(_0x8af36b[_0x2842('0x12')]['message']);}else{logger[_0x2842('0xe')](_0x2842('0x13'),_0x2e3fb0,_0x2842('0xf'));_0x138d23(_0x8af36b[_0x2842('0x15')][_0x2842('0x14')]);}})['catch'](function(_0x1e1980){logger[_0x2842('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2e3fb0,_0x1e1980);_0x4e422d(_0x1e1980);});});}exports[_0x2842('0x16')]=function(_0x1fff96){var _0x12da9c=this;return new Promise(function(_0x46f393,_0x2cfee0){return db[_0x2842('0x17')][_0x2842('0x18')]({'raw':!![],'where':{'ContactId':_0x1fff96['body']['ContactId'],'ListId':_0x1fff96[_0x2842('0x19')][_0x2842('0x1a')],'VoiceQueueId':_0x1fff96[_0x2842('0x19')][_0x2842('0x1b')]===undefined?null:_0x1fff96[_0x2842('0x19')][_0x2842('0x1b')],'CampaignId':_0x1fff96['body'][_0x2842('0x1c')]===undefined?null:_0x1fff96[_0x2842('0x19')][_0x2842('0x1c')]}})[_0x2842('0xd')](function(_0x1c99a2){if(_0x1c99a2!=null){return db[_0x2842('0x1d')][_0x2842('0x18')]({'raw':!![],'where':{'CmHopperId':_0x1c99a2['id'],'OrderBy':{'$gt':_0x1c99a2['OrderBy']}},'order':[[_0x2842('0x1e'),_0x2842('0x1f')]]})[_0x2842('0xd')](function(_0x16b20){var _0x21365e=0x0;if(_0x16b20){if(_0x16b20[_0x2842('0x20')]+_0x16b20[_0x2842('0x21')]+_0x16b20[_0x2842('0x22')]+_0x16b20[_0x2842('0x23')]+_0x16b20['countdropretry']+_0x16b20['countabandonedretry']+_0x16b20[_0x2842('0x24')]+_0x16b20[_0x2842('0x25')]<_0x1fff96[_0x2842('0x26')]['dialGlobalMaxRetry'])_0x21365e=0x1;_0x46f393({'additional':_0x21365e});}else{return db[_0x2842('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1c99a2['id']},'order':[['OrderBy',_0x2842('0x1f')]]})[_0x2842('0xd')](function(_0x394fd3){var _0x1b0a74=0x0;if(_0x394fd3){if(_0x394fd3['countbusyretry']+_0x394fd3[_0x2842('0x21')]+_0x394fd3[_0x2842('0x22')]+_0x394fd3[_0x2842('0x23')]+_0x394fd3['countdropretry']+_0x394fd3[_0x2842('0x27')]+_0x394fd3[_0x2842('0x24')]+_0x394fd3[_0x2842('0x25')]<_0x1fff96[_0x2842('0x26')][_0x2842('0x28')])_0x1b0a74=0x1;_0x46f393({'additional':_0x1b0a74});}else{_0x46f393({'additional':0x0});}})[_0x2842('0x29')](function(_0x11b9d6){logger['error'](_0x2842('0x16'),_0x11b9d6[_0x2842('0x14')],_0x1fff96);_0x2cfee0(_0x12da9c[_0x2842('0x12')](0x1f4,_0x11b9d6[_0x2842('0x14')]));});}})['catch'](function(_0x961941){logger[_0x2842('0x12')](_0x2842('0x16'),_0x961941[_0x2842('0x14')],_0x1fff96);_0x2cfee0(_0x12da9c[_0x2842('0x12')](0x1f4,_0x961941[_0x2842('0x14')]));});}else _0x46f393({'additional':0x0});});});};exports[_0x2842('0x2a')]=function(_0x177cad){var _0x3fb0e3=this;return new Promise(function(_0x3c2def,_0x2edced){return db[_0x2842('0x17')][_0x2842('0x18')]({'raw':!![],'where':{'ContactId':_0x177cad['body']['ContactId'],'ListId':_0x177cad[_0x2842('0x19')]['ListId'],'VoiceQueueId':_0x177cad[_0x2842('0x19')][_0x2842('0x1b')]===undefined?null:_0x177cad['body']['VoiceQueueId'],'CampaignId':_0x177cad[_0x2842('0x19')][_0x2842('0x1c')]===undefined?null:_0x177cad[_0x2842('0x19')]['CampaignId']}})[_0x2842('0xd')](function(_0x45c53a){if(_0x45c53a!=null){return db['CmHopperAdditionalPhone'][_0x2842('0x18')]({'raw':!![],'where':{'CmHopperId':_0x45c53a['id'],'OrderBy':{'$gte':_0x45c53a['OrderBy']}},'order':[[_0x2842('0x1e'),_0x2842('0x1f')]]})[_0x2842('0xd')](function(_0x24ae2a){if(_0x24ae2a)return activateAdditionalPhone(_0x45c53a,_0x177cad[_0x2842('0x19')],_0x24ae2a,_0x177cad[_0x2842('0x2b')],_0x177cad[_0x2842('0x2c')])[_0x2842('0xd')](function(_0x4e425c){_0x3c2def(_0x4e425c);});else{return db[_0x2842('0x1d')][_0x2842('0x18')]({'raw':!![],'where':{'CmHopperId':_0x45c53a['id']},'order':[[_0x2842('0x1e'),_0x2842('0x1f')]]})[_0x2842('0xd')](function(_0x2668d6){if(_0x2668d6)return activateAdditionalPhone(_0x45c53a,_0x177cad[_0x2842('0x19')],_0x2668d6,_0x177cad[_0x2842('0x2b')],_0x177cad[_0x2842('0x2c')])[_0x2842('0xd')](function(_0x20a8be){_0x3c2def(_0x20a8be);});else{_0x3c2def({'id':_0x45c53a['id'],'phone':''});}})[_0x2842('0x29')](function(_0x579de1){logger[_0x2842('0x12')](_0x2842('0x16'),_0x579de1[_0x2842('0x14')],_0x177cad);_0x2edced(_0x3fb0e3['error'](0x1f4,_0x579de1[_0x2842('0x14')]));});}})[_0x2842('0x29')](function(_0x409fc3){logger[_0x2842('0x12')](_0x2842('0x16'),_0x409fc3[_0x2842('0x14')],_0x177cad);_0x2edced(_0x3fb0e3[_0x2842('0x12')](0x1f4,_0x409fc3[_0x2842('0x14')]));});}else _0x3c2def(0x1);});});};function activateAdditionalPhone(_0x53ef99,_0x10327b,_0x151776,_0x569e7f,_0x38f74d){return new Promise(function(_0x17d183,_0x2203c3){logger['info'](_0x2842('0x16'),_0x151776);var _0x20b409;if(moment()>moment(_0x151776[_0x2842('0x2d')])){_0x20b409=moment()['add'](_0x38f74d||0x3,_0x2842('0x2e'));}else{if(_0x151776[_0x2842('0x1e')]==0x0){_0x20b409=moment(_0x151776['scheduledat']);}else{_0x20b409=moment()[_0x2842('0x2f')](_0x38f74d||0x3,_0x2842('0x2e'));}}var _0x4667d3={'phone':_0x53ef99['phone'],'active':0x0,'OrderBy':_['isNil'](_0x53ef99['OrderBy'])?0x0:_0x53ef99['OrderBy'],'scheduledat':moment()[_0x2842('0x2f')](_0x569e7f||0x1,_0x2842('0x2e')),'countbusyretry':_0x10327b[_0x2842('0x20')],'countcongestionretry':_0x10327b[_0x2842('0x21')],'countnoanswerretry':_0x10327b[_0x2842('0x22')],'countnosuchnumberretry':_0x10327b[_0x2842('0x23')],'countdropretry':_0x10327b['countdropretry'],'countabandonedretry':_0x10327b[_0x2842('0x27')],'countmachineretry':_0x10327b[_0x2842('0x24')],'countagentrejectretry':_0x10327b[_0x2842('0x25')],'createdAt':_0x10327b[_0x2842('0x30')],'updatedAt':_0x10327b[_0x2842('0x31')]};var _0xecb4dd={'CmHopperId':_0x53ef99['id'],'phone':_0x151776['phone'],'active':0x0,'OrderBy':_[_0x2842('0x32')](_0x151776[_0x2842('0x1e')])?0x0:_0x151776['OrderBy'],'scheduledat':_0x20b409,'countbusyretry':_0x151776['countbusyretry'],'countcongestionretry':_0x151776[_0x2842('0x21')],'countnoanswerretry':_0x151776[_0x2842('0x22')],'countnosuchnumberretry':_0x151776[_0x2842('0x23')],'countdropretry':_0x151776[_0x2842('0x33')],'countabandonedretry':_0x151776[_0x2842('0x27')],'countmachineretry':_0x151776[_0x2842('0x24')],'countagentrejectretry':_0x151776[_0x2842('0x25')],'createdAt':_0x151776[_0x2842('0x30')],'updatedAt':_0x151776[_0x2842('0x31')]};logger[_0x2842('0xe')](_0x2842('0x34'),_0x4667d3);logger['info']('additionalToHop',_0xecb4dd);return db['sequelize'][_0x2842('0x35')](function(_0x173b3d){return db[_0x2842('0x1d')][_0x2842('0x36')](_0x4667d3,{'where':{'id':_0x151776['id']}},{'transaction':_0x173b3d})[_0x2842('0xd')](function(){return db['CmHopper'][_0x2842('0x36')](_0xecb4dd,{'where':{'id':_0x53ef99['id']}},{'transaction':_0x173b3d});});})[_0x2842('0xd')](function(_0x3d58ec){_0x17d183({'id':_0x53ef99['id'],'phone':_0x151776[_0x2842('0x37')]});})[_0x2842('0x29')](function(_0x263a8a){logger['error'](_0x2842('0x16'),_0x263a8a[_0x2842('0x14')],req);_0x2203c3(_this['error'](0x1f4,_0x263a8a[_0x2842('0x14')]));});});}exports[_0x2842('0x38')]=function(_0x484a60){var _0x4e648b=this;return new Promise(function(_0x4f6705,_0x4b4fbd){return db[_0x2842('0x17')][_0x2842('0x36')](_0x484a60[_0x2842('0x19')][_0x2842('0x39')],{'where':{'id':_0x484a60[_0x2842('0x19')]['id']}})[_0x2842('0xd')](function(_0x449510){_0x4f6705(_0x449510);})[_0x2842('0x29')](function(_0x577eea){logger[_0x2842('0x12')]('IncrementPreviewCounters',_0x577eea[_0x2842('0x14')],_0x484a60);_0x4b4fbd(_0x4e648b[_0x2842('0x12')](0x1f4,_0x577eea[_0x2842('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index d38fe9a..dbf7df3 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 _0x7c80=['fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','/:id','show','post','create','delete','multer','util','express','Router'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x07c8('0x0'));var util=require(_0x07c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x07c8('0x2'));var router=express[_0x07c8('0x3')]();var fs_extra=require(_0x07c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x07c8('0x5'));var config=require(_0x07c8('0x6'));var controller=require(_0x07c8('0x7'));router['get']('/',auth[_0x07c8('0x8')](),controller['index']);router['get'](_0x07c8('0x9'),auth[_0x07c8('0x8')](),controller[_0x07c8('0xa')]);router[_0x07c8('0xb')]('/',auth[_0x07c8('0x8')](),controller[_0x07c8('0xc')]);router['put'](_0x07c8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x07c8('0xd')]('/:id',auth[_0x07c8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa354=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3c2863,_0x1b2cee){var _0x2c3d27=function(_0x4f831b){while(--_0x4f831b){_0x3c2863['push'](_0x3c2863['shift']());}};_0x2c3d27(++_0x1b2cee);}(_0xa354,0xd6));var _0x4a35=function(_0x30eccc,_0x23566d){_0x30eccc=_0x30eccc-0x0;var _0x53d230=_0xa354[_0x30eccc];return _0x53d230;};'use strict';var multer=require(_0x4a35('0x0'));var util=require(_0x4a35('0x1'));var path=require(_0x4a35('0x2'));var timeout=require(_0x4a35('0x3'));var express=require(_0x4a35('0x4'));var router=express['Router']();var fs_extra=require(_0x4a35('0x5'));var auth=require(_0x4a35('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a35('0x7'));router[_0x4a35('0x8')]('/',auth[_0x4a35('0x9')](),controller[_0x4a35('0xa')]);router['get'](_0x4a35('0xb'),auth[_0x4a35('0x9')](),controller['show']);router[_0x4a35('0xc')]('/',auth[_0x4a35('0x9')](),controller[_0x4a35('0xd')]);router['put']('/:id',auth[_0x4a35('0x9')](),controller[_0x4a35('0xe')]);router[_0x4a35('0xf')]('/:id',auth[_0x4a35('0x9')](),controller['destroy']);module[_0x4a35('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 358b80b..50f010f 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 _0x770d=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x1b77a5,_0x1119ad){var _0x5545c7=function(_0x2bac9a){while(--_0x2bac9a){_0x1b77a5['push'](_0x1b77a5['shift']());}};_0x5545c7(++_0x1119ad);}(_0x770d,0x122));var _0xd770=function(_0x193a26,_0x43b298){_0x193a26=_0x193a26-0x0;var _0x23b9bb=_0x770d[_0x193a26];return _0x23b9bb;};'use strict';var moment=require(_0xd770('0x0'));var Sequelize=require(_0xd770('0x1'));module[_0xd770('0x2')]={'phone':{'type':Sequelize[_0xd770('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd770('0x4')],'unique':_0xd770('0x5')},'ListId':{'type':Sequelize[_0xd770('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xd770('0x4')],'unique':_0xd770('0x5')}}; \ No newline at end of file +var _0x3cdc=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x389a8c,_0x13e8cf){var _0x3de6a8=function(_0x9feede){while(--_0x9feede){_0x389a8c['push'](_0x389a8c['shift']());}};_0x3de6a8(++_0x13e8cf);}(_0x3cdc,0x18b));var _0xc3cd=function(_0x5bff9e,_0x39ea3a){_0x5bff9e=_0x5bff9e-0x0;var _0x7f42ef=_0x3cdc[_0x5bff9e];return _0x7f42ef;};'use strict';var moment=require('moment');var Sequelize=require(_0xc3cd('0x0'));module[_0xc3cd('0x1')]={'phone':{'type':Sequelize[_0xc3cd('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc3cd('0x3')],'unique':_0xc3cd('0x4')},'ListId':{'type':Sequelize[_0xc3cd('0x3')],'unique':_0xc3cd('0x4')},'VoiceQueueId':{'type':Sequelize[_0xc3cd('0x3')],'unique':_0xc3cd('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index d5b8239..ead2ec4 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 _0x98ae=['map','fieldName','type','key','model','keys','attributes','fields','query','length','nolimit','order','where','filters','pick','filter','merge','options','includeAll','include','CmHopperBlack','findAll','rows','catch','show','intersection','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send'];(function(_0x33229b,_0x27c283){var _0x5c4968=function(_0x5991d9){while(--_0x5991d9){_0x33229b['push'](_0x33229b['shift']());}};_0x5c4968(++_0x27c283);}(_0x98ae,0x142));var _0xe98a=function(_0x1a5833,_0x4cc32d){_0x1a5833=_0x1a5833-0x0;var _0x548572=_0x98ae[_0x1a5833];return _0x548572;};'use strict';var emlformat=require(_0xe98a('0x0'));var rimraf=require(_0xe98a('0x1'));var zipdir=require(_0xe98a('0x2'));var jsonpatch=require(_0xe98a('0x3'));var rp=require('request-promise');var moment=require(_0xe98a('0x4'));var BPromise=require(_0xe98a('0x5'));var Mustache=require(_0xe98a('0x6'));var util=require('util');var path=require(_0xe98a('0x7'));var sox=require(_0xe98a('0x8'));var csv=require('to-csv');var ejs=require(_0xe98a('0x9'));var fs=require('fs');var fs_extra=require(_0xe98a('0xa'));var _=require(_0xe98a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe98a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe98a('0xd'));var querystring=require(_0xe98a('0xe'));var Papa=require(_0xe98a('0xf'));var Redis=require(_0xe98a('0x10'));var authService=require(_0xe98a('0x11'));var qs=require(_0xe98a('0x12'));var as=require(_0xe98a('0x13'));var hardwareService=require(_0xe98a('0x14'));var logger=require('../../config/logger')(_0xe98a('0x15'));var utils=require(_0xe98a('0x16'));var config=require(_0xe98a('0x17'));var licenseUtil=require(_0xe98a('0x18'));var db=require(_0xe98a('0x19'))['db'];function respondWithStatusCode(_0x41b7bc,_0x402c50){_0x402c50=_0x402c50||0xcc;return function(_0x528643){if(_0x528643){return _0x41b7bc['sendStatus'](_0x402c50);}return _0x41b7bc['status'](_0x402c50)['end']();};}function respondWithResult(_0x4465d0,_0x5d78ca){_0x5d78ca=_0x5d78ca||0xc8;return function(_0x2fd849){if(_0x2fd849){return _0x4465d0[_0xe98a('0x1a')](_0x5d78ca)['json'](_0x2fd849);}};}function respondWithFilteredResult(_0x5e644c,_0x5633ae){return function(_0x1de095){if(_0x1de095){var _0x7d43a2=typeof _0x5633ae[_0xe98a('0x1b')]===_0xe98a('0x1c')&&typeof _0x5633ae[_0xe98a('0x1d')]===_0xe98a('0x1c');var _0x2746e8=_0x1de095[_0xe98a('0x1e')];var _0x271ef1=_0x7d43a2?0x0:_0x5633ae[_0xe98a('0x1b')];var _0x35873d=_0x7d43a2?_0x1de095['count']:_0x5633ae[_0xe98a('0x1b')]+_0x5633ae[_0xe98a('0x1d')];var _0x1ae518;if(_0x35873d>=_0x2746e8){_0x35873d=_0x2746e8;_0x1ae518=0xc8;}else{_0x1ae518=0xce;}_0x5e644c[_0xe98a('0x1a')](_0x1ae518);return _0x5e644c[_0xe98a('0x1f')](_0xe98a('0x20'),_0x271ef1+'-'+_0x35873d+'/'+_0x2746e8)[_0xe98a('0x21')](_0x1de095);}return null;};}function patchUpdates(_0x532852){return function(_0x12a379){try{jsonpatch[_0xe98a('0x22')](_0x12a379,_0x532852,!![]);}catch(_0x287d84){return BPromise[_0xe98a('0x23')](_0x287d84);}return _0x12a379[_0xe98a('0x24')]();};}function saveUpdates(_0x3f97e6,_0x33e9d8){return function(_0x1b2073){if(_0x1b2073){return _0x1b2073[_0xe98a('0x25')](_0x3f97e6)[_0xe98a('0x26')](function(_0x49bbe1){return _0x49bbe1;});}return null;};}function removeEntity(_0x2df36a,_0x31d795){return function(_0x252cd8){if(_0x252cd8){return _0x252cd8[_0xe98a('0x27')]()[_0xe98a('0x26')](function(){_0x2df36a[_0xe98a('0x1a')](0xcc)[_0xe98a('0x28')]();});}};}function handleEntityNotFound(_0x5e705f,_0x459395){return function(_0x235f6b){if(!_0x235f6b){_0x5e705f['sendStatus'](0x194);}return _0x235f6b;};}function handleError(_0x5c969b,_0x3c9257){_0x3c9257=_0x3c9257||0x1f4;return function(_0x3e6752){logger['error'](_0x3e6752['stack']);if(_0x3e6752[_0xe98a('0x29')]){delete _0x3e6752[_0xe98a('0x29')];}_0x5c969b[_0xe98a('0x1a')](_0x3c9257)[_0xe98a('0x2a')](_0x3e6752);};}exports['index']=function(_0x446f7f,_0x315f0a){var _0x142f84={},_0x2a2c4e={},_0x2b14dd={'count':0x0,'rows':[]};var _0x43e60d=_[_0xe98a('0x2b')](db['CmHopperBlack']['rawAttributes'],function(_0x34d5f7){return{'name':_0x34d5f7[_0xe98a('0x2c')],'type':_0x34d5f7[_0xe98a('0x2d')][_0xe98a('0x2e')]};});_0x2a2c4e[_0xe98a('0x2f')]=_['map'](_0x43e60d,_0xe98a('0x29'));_0x2a2c4e['query']=_[_0xe98a('0x30')](_0x446f7f['query']);_0x2a2c4e['filters']=_['intersection'](_0x2a2c4e[_0xe98a('0x2f')],_0x2a2c4e['query']);_0x142f84[_0xe98a('0x31')]=_['intersection'](_0x2a2c4e['model'],qs[_0xe98a('0x32')](_0x446f7f[_0xe98a('0x33')][_0xe98a('0x32')]));_0x142f84[_0xe98a('0x31')]=_0x142f84[_0xe98a('0x31')][_0xe98a('0x34')]?_0x142f84['attributes']:_0x2a2c4e[_0xe98a('0x2f')];if(!_0x446f7f[_0xe98a('0x33')]['hasOwnProperty'](_0xe98a('0x35'))){_0x142f84['limit']=qs['limit'](_0x446f7f[_0xe98a('0x33')][_0xe98a('0x1d')]);_0x142f84[_0xe98a('0x1b')]=qs[_0xe98a('0x1b')](_0x446f7f[_0xe98a('0x33')][_0xe98a('0x1b')]);}_0x142f84[_0xe98a('0x36')]=qs['sort'](_0x446f7f[_0xe98a('0x33')]['sort']);_0x142f84[_0xe98a('0x37')]=qs[_0xe98a('0x38')](_[_0xe98a('0x39')](_0x446f7f[_0xe98a('0x33')],_0x2a2c4e[_0xe98a('0x38')]),_0x43e60d);if(_0x446f7f[_0xe98a('0x33')][_0xe98a('0x3a')]){_0x142f84[_0xe98a('0x37')]=_['merge'](_0x142f84[_0xe98a('0x37')],{'$or':_[_0xe98a('0x2b')](_0x43e60d,function(_0x48f315){if(_0x48f315[_0xe98a('0x2d')]!=='VIRTUAL'){var _0x3824de={};_0x3824de[_0x48f315['name']]={'$like':'%'+_0x446f7f[_0xe98a('0x33')][_0xe98a('0x3a')]+'%'};return _0x3824de;}})});}_0x142f84=_[_0xe98a('0x3b')]({},_0x142f84,_0x446f7f[_0xe98a('0x3c')]);var _0xf577f7={'where':_0x142f84[_0xe98a('0x37')]};return db['CmHopperBlack'][_0xe98a('0x1e')](_0xf577f7)[_0xe98a('0x26')](function(_0x2ebf7e){_0x2b14dd['count']=_0x2ebf7e;if(_0x446f7f['query'][_0xe98a('0x3d')]){_0x142f84[_0xe98a('0x3e')]=[{'all':!![]}];}return db[_0xe98a('0x3f')][_0xe98a('0x40')](_0x142f84);})[_0xe98a('0x26')](function(_0x41bae6){_0x2b14dd[_0xe98a('0x41')]=_0x41bae6;return _0x2b14dd;})['then'](respondWithFilteredResult(_0x315f0a,_0x142f84))[_0xe98a('0x42')](handleError(_0x315f0a,null));};exports[_0xe98a('0x43')]=function(_0x5c0e4a,_0x481efe){var _0x4e20d3={'raw':!![],'where':{'id':_0x5c0e4a['params']['id']}},_0x309256={};_0x309256[_0xe98a('0x2f')]=_[_0xe98a('0x30')](db['CmHopperBlack']['rawAttributes']);_0x309256[_0xe98a('0x33')]=_['keys'](_0x5c0e4a[_0xe98a('0x33')]);_0x309256[_0xe98a('0x38')]=_[_0xe98a('0x44')](_0x309256[_0xe98a('0x2f')],_0x309256[_0xe98a('0x33')]);_0x4e20d3[_0xe98a('0x31')]=_['intersection'](_0x309256['model'],qs[_0xe98a('0x32')](_0x5c0e4a[_0xe98a('0x33')][_0xe98a('0x32')]));_0x4e20d3[_0xe98a('0x31')]=_0x4e20d3[_0xe98a('0x31')][_0xe98a('0x34')]?_0x4e20d3[_0xe98a('0x31')]:_0x309256['model'];if(_0x5c0e4a[_0xe98a('0x33')][_0xe98a('0x3d')]){_0x4e20d3['include']=[{'all':!![]}];}_0x4e20d3=_[_0xe98a('0x3b')]({},_0x4e20d3,_0x5c0e4a['options']);return db['CmHopperBlack'][_0xe98a('0x45')](_0x4e20d3)[_0xe98a('0x26')](handleEntityNotFound(_0x481efe,null))[_0xe98a('0x26')](respondWithResult(_0x481efe,null))['catch'](handleError(_0x481efe,null));};exports[_0xe98a('0x25')]=function(_0x337af,_0x3bfdfd){if(_0x337af[_0xe98a('0x46')]['id']){delete _0x337af[_0xe98a('0x46')]['id'];}return db['CmHopperBlack'][_0xe98a('0x45')]({'where':{'id':_0x337af['params']['id']}})[_0xe98a('0x26')](handleEntityNotFound(_0x3bfdfd,null))['then'](saveUpdates(_0x337af[_0xe98a('0x46')],null))[_0xe98a('0x26')](respondWithResult(_0x3bfdfd,null))[_0xe98a('0x42')](handleError(_0x3bfdfd,null));};exports[_0xe98a('0x27')]=function(_0x4544f4,_0x1ae5cc){return db['CmHopperBlack']['find']({'where':{'id':_0x4544f4[_0xe98a('0x47')]['id']}})[_0xe98a('0x26')](handleEntityNotFound(_0x1ae5cc,null))[_0xe98a('0x26')](removeEntity(_0x1ae5cc,null))[_0xe98a('0x42')](handleError(_0x1ae5cc,null));};exports['describe']=function(_0x44f1d2,_0x45b2d6){return db[_0xe98a('0x3f')][_0xe98a('0x48')]()[_0xe98a('0x26')](respondWithResult(_0x45b2d6,null))[_0xe98a('0x42')](handleError(_0x45b2d6,null));}; \ No newline at end of file +var _0xdebe=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','catch','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','squel','crypto','desk.js','querystring'];(function(_0x340619,_0x580b0b){var _0x3cf7b6=function(_0x2ebdc9){while(--_0x2ebdc9){_0x340619['push'](_0x340619['shift']());}};_0x3cf7b6(++_0x580b0b);}(_0xdebe,0x142));var _0xedeb=function(_0x235ec0,_0x2f4031){_0x235ec0=_0x235ec0-0x0;var _0x4ebb45=_0xdebe[_0x235ec0];return _0x4ebb45;};'use strict';var emlformat=require(_0xedeb('0x0'));var rimraf=require(_0xedeb('0x1'));var zipdir=require(_0xedeb('0x2'));var jsonpatch=require(_0xedeb('0x3'));var rp=require('request-promise');var moment=require(_0xedeb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xedeb('0x5'));var util=require(_0xedeb('0x6'));var path=require('path');var sox=require(_0xedeb('0x7'));var csv=require(_0xedeb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xedeb('0x9'));var crypto=require(_0xedeb('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xedeb('0xb'));var toCsv=require('to-csv');var querystring=require(_0xedeb('0xc'));var Papa=require(_0xedeb('0xd'));var Redis=require(_0xedeb('0xe'));var authService=require(_0xedeb('0xf'));var qs=require(_0xedeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedeb('0x11'));var logger=require(_0xedeb('0x12'))(_0xedeb('0x13'));var utils=require(_0xedeb('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xedeb('0x15'))['db'];function respondWithStatusCode(_0x151982,_0x37f7ab){_0x37f7ab=_0x37f7ab||0xcc;return function(_0x43da53){if(_0x43da53){return _0x151982['sendStatus'](_0x37f7ab);}return _0x151982[_0xedeb('0x16')](_0x37f7ab)['end']();};}function respondWithResult(_0x31cb04,_0x1371e5){_0x1371e5=_0x1371e5||0xc8;return function(_0x1666be){if(_0x1666be){return _0x31cb04[_0xedeb('0x16')](_0x1371e5)[_0xedeb('0x17')](_0x1666be);}};}function respondWithFilteredResult(_0x3e0045,_0x385f93){return function(_0x209b11){if(_0x209b11){var _0x5c7d92=typeof _0x385f93[_0xedeb('0x18')]===_0xedeb('0x19')&&typeof _0x385f93['limit']===_0xedeb('0x19');var _0x312e11=_0x209b11[_0xedeb('0x1a')];var _0x272067=_0x5c7d92?0x0:_0x385f93[_0xedeb('0x18')];var _0x216a3e=_0x5c7d92?_0x209b11[_0xedeb('0x1a')]:_0x385f93[_0xedeb('0x18')]+_0x385f93[_0xedeb('0x1b')];var _0x1323ec;if(_0x216a3e>=_0x312e11){_0x216a3e=_0x312e11;_0x1323ec=0xc8;}else{_0x1323ec=0xce;}_0x3e0045[_0xedeb('0x16')](_0x1323ec);return _0x3e0045[_0xedeb('0x1c')](_0xedeb('0x1d'),_0x272067+'-'+_0x216a3e+'/'+_0x312e11)[_0xedeb('0x17')](_0x209b11);}return null;};}function patchUpdates(_0xe9897f){return function(_0x3e5b28){try{jsonpatch['apply'](_0x3e5b28,_0xe9897f,!![]);}catch(_0xc8359a){return BPromise[_0xedeb('0x1e')](_0xc8359a);}return _0x3e5b28[_0xedeb('0x1f')]();};}function saveUpdates(_0x27aa01,_0x33887e){return function(_0x20bb3f){if(_0x20bb3f){return _0x20bb3f[_0xedeb('0x20')](_0x27aa01)[_0xedeb('0x21')](function(_0x4bcaf4){return _0x4bcaf4;});}return null;};}function removeEntity(_0xadf097,_0x2b7051){return function(_0x8a1152){if(_0x8a1152){return _0x8a1152[_0xedeb('0x22')]()[_0xedeb('0x21')](function(){_0xadf097['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b30b,_0x46db0d){return function(_0x579987){if(!_0x579987){_0x35b30b['sendStatus'](0x194);}return _0x579987;};}function handleError(_0x4db997,_0x33a207){_0x33a207=_0x33a207||0x1f4;return function(_0x3c7b62){logger[_0xedeb('0x23')](_0x3c7b62[_0xedeb('0x24')]);if(_0x3c7b62[_0xedeb('0x25')]){delete _0x3c7b62[_0xedeb('0x25')];}_0x4db997['status'](_0x33a207)['send'](_0x3c7b62);};}exports[_0xedeb('0x26')]=function(_0x42d0d0,_0x36f06c){var _0xedc43c={},_0x3f92fa={},_0x366de0={'count':0x0,'rows':[]};var _0x9c5646=_[_0xedeb('0x27')](db['CmHopperBlack'][_0xedeb('0x28')],function(_0x488c58){return{'name':_0x488c58[_0xedeb('0x29')],'type':_0x488c58[_0xedeb('0x2a')]['key']};});_0x3f92fa['model']=_['map'](_0x9c5646,_0xedeb('0x25'));_0x3f92fa[_0xedeb('0x2b')]=_[_0xedeb('0x2c')](_0x42d0d0[_0xedeb('0x2b')]);_0x3f92fa[_0xedeb('0x2d')]=_[_0xedeb('0x2e')](_0x3f92fa[_0xedeb('0x2f')],_0x3f92fa[_0xedeb('0x2b')]);_0xedc43c[_0xedeb('0x30')]=_['intersection'](_0x3f92fa[_0xedeb('0x2f')],qs[_0xedeb('0x31')](_0x42d0d0[_0xedeb('0x2b')][_0xedeb('0x31')]));_0xedc43c[_0xedeb('0x30')]=_0xedc43c[_0xedeb('0x30')][_0xedeb('0x32')]?_0xedc43c['attributes']:_0x3f92fa[_0xedeb('0x2f')];if(!_0x42d0d0[_0xedeb('0x2b')]['hasOwnProperty'](_0xedeb('0x33'))){_0xedc43c['limit']=qs[_0xedeb('0x1b')](_0x42d0d0[_0xedeb('0x2b')][_0xedeb('0x1b')]);_0xedc43c[_0xedeb('0x18')]=qs[_0xedeb('0x18')](_0x42d0d0[_0xedeb('0x2b')][_0xedeb('0x18')]);}_0xedc43c['order']=qs[_0xedeb('0x34')](_0x42d0d0[_0xedeb('0x2b')][_0xedeb('0x34')]);_0xedc43c[_0xedeb('0x35')]=qs[_0xedeb('0x2d')](_[_0xedeb('0x36')](_0x42d0d0[_0xedeb('0x2b')],_0x3f92fa['filters']),_0x9c5646);if(_0x42d0d0[_0xedeb('0x2b')][_0xedeb('0x37')]){_0xedc43c[_0xedeb('0x35')]=_[_0xedeb('0x38')](_0xedc43c['where'],{'$or':_[_0xedeb('0x27')](_0x9c5646,function(_0x26c6b5){if(_0x26c6b5[_0xedeb('0x2a')]!==_0xedeb('0x39')){var _0x4903f2={};_0x4903f2[_0x26c6b5[_0xedeb('0x25')]]={'$like':'%'+_0x42d0d0[_0xedeb('0x2b')][_0xedeb('0x37')]+'%'};return _0x4903f2;}})});}_0xedc43c=_[_0xedeb('0x38')]({},_0xedc43c,_0x42d0d0[_0xedeb('0x3a')]);var _0x1ee31e={'where':_0xedc43c['where']};return db[_0xedeb('0x3b')][_0xedeb('0x1a')](_0x1ee31e)[_0xedeb('0x21')](function(_0x4fdbe0){_0x366de0[_0xedeb('0x1a')]=_0x4fdbe0;if(_0x42d0d0[_0xedeb('0x2b')][_0xedeb('0x3c')]){_0xedc43c[_0xedeb('0x3d')]=[{'all':!![]}];}return db[_0xedeb('0x3b')]['findAll'](_0xedc43c);})[_0xedeb('0x21')](function(_0x48d9ad){_0x366de0['rows']=_0x48d9ad;return _0x366de0;})[_0xedeb('0x21')](respondWithFilteredResult(_0x36f06c,_0xedc43c))[_0xedeb('0x3e')](handleError(_0x36f06c,null));};exports['show']=function(_0x194b95,_0x3503a7){var _0x29b208={'raw':!![],'where':{'id':_0x194b95['params']['id']}},_0x11375a={};_0x11375a[_0xedeb('0x2f')]=_['keys'](db[_0xedeb('0x3b')][_0xedeb('0x28')]);_0x11375a[_0xedeb('0x2b')]=_[_0xedeb('0x2c')](_0x194b95[_0xedeb('0x2b')]);_0x11375a[_0xedeb('0x2d')]=_[_0xedeb('0x2e')](_0x11375a[_0xedeb('0x2f')],_0x11375a[_0xedeb('0x2b')]);_0x29b208[_0xedeb('0x30')]=_[_0xedeb('0x2e')](_0x11375a[_0xedeb('0x2f')],qs[_0xedeb('0x31')](_0x194b95[_0xedeb('0x2b')][_0xedeb('0x31')]));_0x29b208[_0xedeb('0x30')]=_0x29b208['attributes'][_0xedeb('0x32')]?_0x29b208[_0xedeb('0x30')]:_0x11375a[_0xedeb('0x2f')];if(_0x194b95[_0xedeb('0x2b')][_0xedeb('0x3c')]){_0x29b208[_0xedeb('0x3d')]=[{'all':!![]}];}_0x29b208=_[_0xedeb('0x38')]({},_0x29b208,_0x194b95[_0xedeb('0x3a')]);return db[_0xedeb('0x3b')][_0xedeb('0x3f')](_0x29b208)[_0xedeb('0x21')](handleEntityNotFound(_0x3503a7,null))[_0xedeb('0x21')](respondWithResult(_0x3503a7,null))['catch'](handleError(_0x3503a7,null));};exports[_0xedeb('0x20')]=function(_0x28b485,_0x1ee6d0){if(_0x28b485['body']['id']){delete _0x28b485[_0xedeb('0x40')]['id'];}return db[_0xedeb('0x3b')]['find']({'where':{'id':_0x28b485[_0xedeb('0x41')]['id']}})[_0xedeb('0x21')](handleEntityNotFound(_0x1ee6d0,null))[_0xedeb('0x21')](saveUpdates(_0x28b485[_0xedeb('0x40')],null))['then'](respondWithResult(_0x1ee6d0,null))['catch'](handleError(_0x1ee6d0,null));};exports[_0xedeb('0x22')]=function(_0x1846a5,_0x558594){return db[_0xedeb('0x3b')][_0xedeb('0x3f')]({'where':{'id':_0x1846a5[_0xedeb('0x41')]['id']}})[_0xedeb('0x21')](handleEntityNotFound(_0x558594,null))[_0xedeb('0x21')](removeEntity(_0x558594,null))[_0xedeb('0x3e')](handleError(_0x558594,null));};exports[_0xedeb('0x42')]=function(_0x3b3137,_0x5de3fb){return db[_0xedeb('0x3b')]['describe']()[_0xedeb('0x21')](respondWithResult(_0x5de3fb,null))[_0xedeb('0x3e')](handleError(_0x5de3fb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 93449be..679cc96 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 _0xe51f=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','lodash','util','../../config/logger','api'];(function(_0xbd92d,_0x131ea1){var _0x263486=function(_0x534da2){while(--_0x534da2){_0xbd92d['push'](_0xbd92d['shift']());}};_0x263486(++_0x131ea1);}(_0xe51f,0x151));var _0xfe51=function(_0xeb15a7,_0x5b46f0){_0xeb15a7=_0xeb15a7-0x0;var _0x12092d=_0xe51f[_0xeb15a7];return _0x12092d;};'use strict';var _=require(_0xfe51('0x0'));var util=require(_0xfe51('0x1'));var logger=require(_0xfe51('0x2'))(_0xfe51('0x3'));var moment=require('moment');var BPromise=require(_0xfe51('0x4'));var rp=require(_0xfe51('0x5'));var fs=require('fs');var path=require(_0xfe51('0x6'));var rimraf=require(_0xfe51('0x7'));var config=require(_0xfe51('0x8'));var attributes=require(_0xfe51('0x9'));module[_0xfe51('0xa')]=function(_0x59e30a,_0x5ab56d){return _0x59e30a['define']('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fb9=['request-promise','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird'];(function(_0x5f5baf,_0x430fce){var _0x36e933=function(_0x735729){while(--_0x735729){_0x5f5baf['push'](_0x5f5baf['shift']());}};_0x36e933(++_0x430fce);}(_0x7fb9,0x131));var _0x97fb=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7fb9[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x97fb('0x0'));var util=require(_0x97fb('0x1'));var logger=require('../../config/logger')(_0x97fb('0x2'));var moment=require(_0x97fb('0x3'));var BPromise=require(_0x97fb('0x4'));var rp=require(_0x97fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x97fb('0x6')]=function(_0x383ce0,_0x18de8d){return _0x383ce0[_0x97fb('0x7')](_0x97fb('0x8'),attributes,{'tableName':_0x97fb('0x9'),'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 f52c87b..d94bb3b 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 _0x9d15=['rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','findAll','options','where','attributes','limit','include','map','GetCmHopperBlack','debug','stringify','CmHopperBlack','update','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xcddd5c,_0x58d80d){var _0x3834ec=function(_0x40b141){while(--_0x40b141){_0xcddd5c['push'](_0xcddd5c['shift']());}};_0x3834ec(++_0x58d80d);}(_0x9d15,0x6b));var _0x59d1=function(_0x58f0c5,_0x53955e){_0x58f0c5=_0x58f0c5-0x0;var _0x5cb879=_0x9d15[_0x58f0c5];return _0x5cb879;};'use strict';var _=require(_0x59d1('0x0'));var util=require(_0x59d1('0x1'));var moment=require(_0x59d1('0x2'));var BPromise=require(_0x59d1('0x3'));var rs=require(_0x59d1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59d1('0x5'))['db'];var utils=require(_0x59d1('0x6'));var logger=require('../../config/logger')(_0x59d1('0x7'));var config=require(_0x59d1('0x8'));var jayson=require(_0x59d1('0x9'));var client=jayson[_0x59d1('0xa')][_0x59d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a7ed7,_0x3aaf34,_0x5ee7c4){return new BPromise(function(_0x26e188,_0x3bcadb){return client['request'](_0x5a7ed7,_0x5ee7c4)[_0x59d1('0xc')](function(_0x53afe8){logger[_0x59d1('0xd')](_0x59d1('0xe'),_0x3aaf34,'request\x20sent');logger['debug'](_0x59d1('0xf'),_0x3aaf34,_0x59d1('0x10'),JSON['stringify'](_0x53afe8));if(_0x53afe8[_0x59d1('0x11')]){if(_0x53afe8[_0x59d1('0x11')][_0x59d1('0x12')]===0x1f4){logger[_0x59d1('0x11')](_0x59d1('0xe'),_0x3aaf34,_0x53afe8[_0x59d1('0x11')][_0x59d1('0x13')]);return _0x3bcadb(_0x53afe8[_0x59d1('0x11')][_0x59d1('0x13')]);}logger[_0x59d1('0x11')](_0x59d1('0xe'),_0x3aaf34,_0x53afe8[_0x59d1('0x11')][_0x59d1('0x13')]);return _0x26e188(_0x53afe8[_0x59d1('0x11')]['message']);}else{logger['info'](_0x59d1('0xe'),_0x3aaf34,_0x59d1('0x10'));_0x26e188(_0x53afe8[_0x59d1('0x14')][_0x59d1('0x13')]);}})[_0x59d1('0x15')](function(_0x3f7dfc){logger[_0x59d1('0x11')](_0x59d1('0xe'),_0x3aaf34,_0x3f7dfc);_0x3bcadb(_0x3f7dfc);});});}exports['GetCmHopperBlack']=function(_0x17c58f){var _0x19d228=this;return new Promise(function(_0x169ada,_0x2d5e0f){return db['CmHopperBlack'][_0x59d1('0x16')]({'raw':_0x17c58f[_0x59d1('0x17')]?_0x17c58f['options']['raw']===undefined?!![]:![]:!![],'where':_0x17c58f[_0x59d1('0x17')]?_0x17c58f[_0x59d1('0x17')][_0x59d1('0x18')]||null:null,'attributes':_0x17c58f[_0x59d1('0x17')]?_0x17c58f['options'][_0x59d1('0x19')]||null:null,'limit':_0x17c58f[_0x59d1('0x17')]?_0x17c58f['options'][_0x59d1('0x1a')]||null:null,'include':_0x17c58f[_0x59d1('0x17')]?_0x17c58f[_0x59d1('0x17')][_0x59d1('0x1b')]?_[_0x59d1('0x1c')](_0x17c58f[_0x59d1('0x17')][_0x59d1('0x1b')],function(_0x3760e6){return{'model':db[_0x3760e6['model']],'as':_0x3760e6['as'],'attributes':_0x3760e6[_0x59d1('0x19')],'include':_0x3760e6[_0x59d1('0x1b')]?_[_0x59d1('0x1c')](_0x3760e6[_0x59d1('0x1b')],function(_0x13c5a8){return{'model':db[_0x13c5a8['model']],'as':_0x13c5a8['as'],'attributes':_0x13c5a8['attributes'],'include':_0x13c5a8['include']?_['map'](_0x13c5a8['include'],function(_0x363beb){return{'model':db[_0x363beb['model']],'as':_0x363beb['as'],'attributes':_0x363beb[_0x59d1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x59d1('0xc')](function(_0x4f55a2){logger[_0x59d1('0xd')](_0x59d1('0x1d'),_0x17c58f);logger[_0x59d1('0x1e')](_0x59d1('0x1d'),_0x17c58f,JSON[_0x59d1('0x1f')](_0x4f55a2));_0x169ada(_0x4f55a2);})[_0x59d1('0x15')](function(_0x32e642){logger[_0x59d1('0x11')](_0x59d1('0x1d'),_0x32e642[_0x59d1('0x13')],_0x17c58f);_0x2d5e0f(_0x19d228[_0x59d1('0x11')](0x1f4,_0x32e642[_0x59d1('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x253a89){var _0x123421=this;return new Promise(function(_0x2a98f4,_0x46d11b){return db[_0x59d1('0x20')][_0x59d1('0x21')](_0x253a89['body'],{'raw':_0x253a89[_0x59d1('0x17')]?_0x253a89['options'][_0x59d1('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x253a89['options']?_0x253a89[_0x59d1('0x17')][_0x59d1('0x18')]||null:null,'attributes':_0x253a89[_0x59d1('0x17')]?_0x253a89[_0x59d1('0x17')]['attributes']||null:null,'limit':_0x253a89[_0x59d1('0x17')]?_0x253a89[_0x59d1('0x17')]['limit']||null:null})[_0x59d1('0xc')](function(_0x1e1d05){logger[_0x59d1('0xd')]('UpdateCmHopperBlack',_0x253a89);logger[_0x59d1('0x1e')]('UpdateCmHopperBlack',_0x253a89,JSON[_0x59d1('0x1f')](_0x1e1d05));_0x2a98f4(_0x1e1d05);})['catch'](function(_0x2cb488){logger['error'](_0x59d1('0x23'),_0x2cb488[_0x59d1('0x13')],_0x253a89);_0x46d11b(_0x123421['error'](0x1f4,_0x2cb488[_0x59d1('0x13')]));});});};exports[_0x59d1('0x24')]=function(_0x14a951){var _0x2523bd=this;return new Promise(function(_0x521ce9,_0x309c4f){return db[_0x59d1('0x20')][_0x59d1('0x25')]({'where':_0x14a951[_0x59d1('0x17')]?_0x14a951['options'][_0x59d1('0x18')]||null:null})[_0x59d1('0xc')](function(_0x565580){logger[_0x59d1('0xd')]('DestroyCmHopperBlack',_0x14a951);logger['debug'](_0x59d1('0x24'),_0x14a951,JSON[_0x59d1('0x1f')](_0x565580));_0x521ce9(_0x565580);})[_0x59d1('0x15')](function(_0x1defbd){logger[_0x59d1('0x11')](_0x59d1('0x24'),_0x1defbd[_0x59d1('0x13')],_0x14a951);_0x309c4f(_0x2523bd[_0x59d1('0x11')](0x1f4,_0x1defbd[_0x59d1('0x13')]));});});}; \ No newline at end of file +var _0xc2d8=['util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','debug','destroy','DestroyCmHopperBlack','lodash'];(function(_0x18f396,_0x174d17){var _0x3ba532=function(_0x2bc92f){while(--_0x2bc92f){_0x18f396['push'](_0x18f396['shift']());}};_0x3ba532(++_0x174d17);}(_0xc2d8,0x1e0));var _0x8c2d=function(_0x183b69,_0x21b23e){_0x183b69=_0x183b69-0x0;var _0x326224=_0xc2d8[_0x183b69];return _0x326224;};'use strict';var _=require(_0x8c2d('0x0'));var util=require(_0x8c2d('0x1'));var moment=require('moment');var BPromise=require(_0x8c2d('0x2'));var rs=require(_0x8c2d('0x3'));var fs=require('fs');var Redis=require(_0x8c2d('0x4'));var db=require(_0x8c2d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c2d('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c2d('0x7'));var client=jayson[_0x8c2d('0x8')][_0x8c2d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3838d8,_0x42a6dc,_0x2bcfa9){return new BPromise(function(_0x50808a,_0x26702f){return client[_0x8c2d('0xa')](_0x3838d8,_0x2bcfa9)[_0x8c2d('0xb')](function(_0x25dc26){logger[_0x8c2d('0xc')](_0x8c2d('0xd'),_0x42a6dc,'request\x20sent');logger['debug'](_0x8c2d('0xe'),_0x42a6dc,_0x8c2d('0xf'),JSON[_0x8c2d('0x10')](_0x25dc26));if(_0x25dc26[_0x8c2d('0x11')]){if(_0x25dc26[_0x8c2d('0x11')][_0x8c2d('0x12')]===0x1f4){logger[_0x8c2d('0x11')](_0x8c2d('0xd'),_0x42a6dc,_0x25dc26[_0x8c2d('0x11')]['message']);return _0x26702f(_0x25dc26[_0x8c2d('0x11')][_0x8c2d('0x13')]);}logger[_0x8c2d('0x11')](_0x8c2d('0xd'),_0x42a6dc,_0x25dc26['error']['message']);return _0x50808a(_0x25dc26[_0x8c2d('0x11')][_0x8c2d('0x13')]);}else{logger[_0x8c2d('0xc')](_0x8c2d('0xd'),_0x42a6dc,_0x8c2d('0xf'));_0x50808a(_0x25dc26['result']['message']);}})[_0x8c2d('0x14')](function(_0x4226f4){logger['error'](_0x8c2d('0xd'),_0x42a6dc,_0x4226f4);_0x26702f(_0x4226f4);});});}exports[_0x8c2d('0x15')]=function(_0x3a396a){var _0x11c6c6=this;return new Promise(function(_0x482be4,_0x155847){return db[_0x8c2d('0x16')][_0x8c2d('0x17')]({'raw':_0x3a396a[_0x8c2d('0x18')]?_0x3a396a['options'][_0x8c2d('0x19')]===undefined?!![]:![]:!![],'where':_0x3a396a[_0x8c2d('0x18')]?_0x3a396a[_0x8c2d('0x18')][_0x8c2d('0x1a')]||null:null,'attributes':_0x3a396a[_0x8c2d('0x18')]?_0x3a396a[_0x8c2d('0x18')][_0x8c2d('0x1b')]||null:null,'limit':_0x3a396a['options']?_0x3a396a['options'][_0x8c2d('0x1c')]||null:null,'include':_0x3a396a[_0x8c2d('0x18')]?_0x3a396a[_0x8c2d('0x18')][_0x8c2d('0x1d')]?_[_0x8c2d('0x1e')](_0x3a396a[_0x8c2d('0x18')][_0x8c2d('0x1d')],function(_0x3a0f51){return{'model':db[_0x3a0f51[_0x8c2d('0x1f')]],'as':_0x3a0f51['as'],'attributes':_0x3a0f51[_0x8c2d('0x1b')],'include':_0x3a0f51[_0x8c2d('0x1d')]?_['map'](_0x3a0f51[_0x8c2d('0x1d')],function(_0x52293){return{'model':db[_0x52293[_0x8c2d('0x1f')]],'as':_0x52293['as'],'attributes':_0x52293[_0x8c2d('0x1b')],'include':_0x52293['include']?_[_0x8c2d('0x1e')](_0x52293['include'],function(_0x46cd7c){return{'model':db[_0x46cd7c[_0x8c2d('0x1f')]],'as':_0x46cd7c['as'],'attributes':_0x46cd7c[_0x8c2d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8c2d('0xb')](function(_0x1b3255){logger[_0x8c2d('0xc')](_0x8c2d('0x15'),_0x3a396a);logger['debug'](_0x8c2d('0x15'),_0x3a396a,JSON[_0x8c2d('0x10')](_0x1b3255));_0x482be4(_0x1b3255);})[_0x8c2d('0x14')](function(_0x53a085){logger[_0x8c2d('0x11')](_0x8c2d('0x15'),_0x53a085['message'],_0x3a396a);_0x155847(_0x11c6c6['error'](0x1f4,_0x53a085[_0x8c2d('0x13')]));});});};exports[_0x8c2d('0x20')]=function(_0x1cb22e){var _0x400acb=this;return new Promise(function(_0x159b34,_0x54d25d){return db[_0x8c2d('0x16')]['update'](_0x1cb22e[_0x8c2d('0x21')],{'raw':_0x1cb22e[_0x8c2d('0x18')]?_0x1cb22e[_0x8c2d('0x18')][_0x8c2d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cb22e[_0x8c2d('0x18')]?_0x1cb22e['options'][_0x8c2d('0x1a')]||null:null,'attributes':_0x1cb22e[_0x8c2d('0x18')]?_0x1cb22e[_0x8c2d('0x18')][_0x8c2d('0x1b')]||null:null,'limit':_0x1cb22e[_0x8c2d('0x18')]?_0x1cb22e['options'][_0x8c2d('0x1c')]||null:null})[_0x8c2d('0xb')](function(_0x1a3b4f){logger[_0x8c2d('0xc')](_0x8c2d('0x20'),_0x1cb22e);logger[_0x8c2d('0x22')]('UpdateCmHopperBlack',_0x1cb22e,JSON[_0x8c2d('0x10')](_0x1a3b4f));_0x159b34(_0x1a3b4f);})[_0x8c2d('0x14')](function(_0x302d7e){logger['error'](_0x8c2d('0x20'),_0x302d7e[_0x8c2d('0x13')],_0x1cb22e);_0x54d25d(_0x400acb[_0x8c2d('0x11')](0x1f4,_0x302d7e['message']));});});};exports['DestroyCmHopperBlack']=function(_0x28bb54){var _0x1a0ee0=this;return new Promise(function(_0x490ccf,_0x163fd7){return db[_0x8c2d('0x16')][_0x8c2d('0x23')]({'where':_0x28bb54[_0x8c2d('0x18')]?_0x28bb54[_0x8c2d('0x18')]['where']||null:null})[_0x8c2d('0xb')](function(_0x8bc6f7){logger[_0x8c2d('0xc')](_0x8c2d('0x24'),_0x28bb54);logger[_0x8c2d('0x22')](_0x8c2d('0x24'),_0x28bb54,JSON[_0x8c2d('0x10')](_0x8bc6f7));_0x490ccf(_0x8bc6f7);})[_0x8c2d('0x14')](function(_0x4108a3){logger[_0x8c2d('0x11')]('DestroyCmHopperBlack',_0x4108a3[_0x8c2d('0x13')],_0x28bb54);_0x163fd7(_0x1a0ee0[_0x8c2d('0x11')](0x1f4,_0x4108a3['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d43d211..54804f5 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 _0x2675=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','put','/:id','delete','exports','multer','express','Router'];(function(_0x1d89db,_0x5ad867){var _0x326adb=function(_0x301e33){while(--_0x301e33){_0x1d89db['push'](_0x1d89db['shift']());}};_0x326adb(++_0x5ad867);}(_0x2675,0x75));var _0x5267=function(_0x596f62,_0x3e9513){_0x596f62=_0x596f62-0x0;var _0x3098c8=_0x2675[_0x596f62];return _0x3098c8;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0x8')]);router[_0x5267('0x6')](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xa')]);router[_0x5267('0x6')]('/:id',auth[_0x5267('0x7')](),controller['show']);router[_0x5267('0xb')](_0x5267('0xc'),auth[_0x5267('0x7')](),controller['update']);router[_0x5267('0xd')]('/:id',auth[_0x5267('0x7')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file +var _0xcaf2=['./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x32a6f7,_0x5890e9){var _0x4e5269=function(_0x1634b4){while(--_0x1634b4){_0x32a6f7['push'](_0x32a6f7['shift']());}};_0x4e5269(++_0x5890e9);}(_0xcaf2,0x8a));var _0x2caf=function(_0x5e9689,_0x48e034){_0x5e9689=_0x5e9689-0x0;var _0x2fac94=_0xcaf2[_0x5e9689];return _0x2fac94;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0xd')](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0xf')](_0x2caf('0xb'),auth['isAuthenticated'](),controller[_0x2caf('0x10')]);module[_0x2caf('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 08ba8af..d564704 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 _0xd77f=['endtime','followuptime','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd77f,0x93));var _0xfd77=function(_0x3b4394,_0x3d881d){_0x3b4394=_0x3b4394-0x0;var _0x58d00a=_0xd77f[_0x3b4394];return _0x58d00a;};'use strict';var Sequelize=require(_0xfd77('0x0'));var moment=require(_0xfd77('0x1'));module[_0xfd77('0x2')]={'state':{'type':Sequelize[_0xfd77('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xfd77('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfd77('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xfd77('0x4')]},'originatecalleridname':{'type':Sequelize[_0xfd77('0x4')]},'calleridnum':{'type':Sequelize[_0xfd77('0x4')]},'calleridname':{'type':Sequelize[_0xfd77('0x4')]},'starttime':{'type':Sequelize[_0xfd77('0x5')]},'responsetime':{'type':Sequelize[_0xfd77('0x5')]},'answertime':{'type':Sequelize[_0xfd77('0x5')]},'droptime':{'type':Sequelize[_0xfd77('0x5')]},'endtime':{'type':Sequelize[_0xfd77('0x5')]},'ringtime':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xfd77('0x4')]},'campaigntype':{'type':Sequelize[_0xfd77('0x4')]},'membername':{'type':Sequelize[_0xfd77('0x4')]},'reason':{'type':Sequelize[_0xfd77('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfd77('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3fe0aa){var _0x7a0b68=this[_0xfd77('0x6')](_0xfd77('0x7'));if(_0x7a0b68&&_0x3fe0aa){this['setDataValue'](_0xfd77('0x8'),moment(_0x3fe0aa)['diff'](moment(_0x7a0b68),_0xfd77('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xfd77('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xfd77('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xfd77('0x5')]},'callback':{'type':Sequelize[_0xfd77('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfd77('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xfd77('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfd77('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xfd77('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfd77('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb2c0=['sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','seconds','BOOLEAN'];(function(_0xcea54f,_0x171ac7){var _0x1b820f=function(_0x241e63){while(--_0x241e63){_0xcea54f['push'](_0xcea54f['shift']());}};_0x1b820f(++_0x171ac7);}(_0xb2c0,0x14a));var _0x0b2c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb2c0[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x0b2c('0x0'));var moment=require(_0x0b2c('0x1'));module['exports']={'state':{'type':Sequelize[_0x0b2c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0b2c('0x3')]},'scheduledat':{'type':Sequelize[_0x0b2c('0x4')]},'countbusyretry':{'type':Sequelize[_0x0b2c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0b2c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0b2c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0b2c('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0b2c('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0b2c('0x3')]},'calleridnum':{'type':Sequelize[_0x0b2c('0x3')]},'calleridname':{'type':Sequelize[_0x0b2c('0x3')]},'starttime':{'type':Sequelize[_0x0b2c('0x4')]},'responsetime':{'type':Sequelize[_0x0b2c('0x4')]},'answertime':{'type':Sequelize[_0x0b2c('0x4')]},'droptime':{'type':Sequelize[_0x0b2c('0x4')]},'endtime':{'type':Sequelize[_0x0b2c('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0b2c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0b2c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0b2c('0x3')]},'campaign':{'type':Sequelize[_0x0b2c('0x3')]},'campaigntype':{'type':Sequelize[_0x0b2c('0x3')]},'membername':{'type':Sequelize[_0x0b2c('0x3')]},'reason':{'type':Sequelize[_0x0b2c('0x3')]},'disposition':{'type':Sequelize[_0x0b2c('0x3')]},'secondDisposition':{'type':Sequelize[_0x0b2c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0b2c('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x209652){var _0x2e2cff=this[_0x0b2c('0x5')](_0x0b2c('0x6'));if(_0x2e2cff&&_0x209652){this['setDataValue'](_0x0b2c('0x7'),moment(_0x209652)['diff'](moment(_0x2e2cff),_0x0b2c('0x8')));}}},'amd':{'type':Sequelize[_0x0b2c('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0b2c('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0b2c('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0b2c('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0b2c('0x4')]},'callback':{'type':Sequelize[_0x0b2c('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0b2c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0b2c('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0b2c('0x4')]},'recallme':{'type':Sequelize[_0x0b2c('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0b2c('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x0b2c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0b2c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0b2c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0b2c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0b2c('0x2')],'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 a3224aa..1087be9 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 _0x430c=['field','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','createdAt','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','from','checkContactHopper','CmHopper','findOne','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','describe','update','uniqueid','body','find','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x208,\x201,\x20null','dropContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select'];(function(_0x24da95,_0x4e8e1a){var _0x593878=function(_0x2954f5){while(--_0x2954f5){_0x24da95['push'](_0x24da95['shift']());}};_0x593878(++_0x4e8e1a);}(_0x430c,0x1a1));var _0xc430=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x430c[_0xb3b452];return _0x238983;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':!![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['describe']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')]()[_0xc430('0x1e')](respondWithResult(_0x4eafae,null))['catch'](handleError(_0x4eafae,null));};exports[_0xc430('0x45')]=function(_0x2e7052,_0x19e563){if(_0x2e7052['body'][_0xc430('0x46')]){delete _0x2e7052[_0xc430('0x47')][_0xc430('0x46')];}return db[_0xc430('0x25')][_0xc430('0x48')]({'where':{'uniqueid':_0x2e7052[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19e563,null))['then'](saveUpdates(_0x2e7052[_0xc430('0x47')],null))[_0xc430('0x1e')](respondWithResult(_0x19e563,null))[_0xc430('0x40')](handleError(_0x19e563,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x23cb41,_0x4178d7,_0x2d064b){return db[_0xc430('0x25')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x23cb41[_0xc430('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x4e')))),_0xc430('0x4f')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x50')))),_0xc430('0x51')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc430('0x52')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x53')))),'dropContacts'],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x58')))),'answeringMachine']]})[_0xc430('0x1e')](handleEntityNotFound(_0x4178d7,null))[_0xc430('0x1e')](respondWithResult(_0x4178d7,null))[_0xc430('0x40')](handleError(_0x4178d7,null));};exports[_0xc430('0x59')]=function(_0x147062,_0x45eec6,_0x5d3393){return db[_0xc430('0x25')][_0xc430('0x3e')]({'raw':![],'where':{'CampaignId':_0x147062['params']['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4e')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),_0xc430('0x51')],[db['sequelize']['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x5a')))),'congestionContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc430('0x5b')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x58')))),_0xc430('0x5c')]]})['then'](handleEntityNotFound(_0x45eec6,null))['then'](respondWithResult(_0x45eec6,null))[_0xc430('0x40')](handleError(_0x45eec6,null));};exports[_0xc430('0x5d')]=function(_0x31ae3c,_0x19c080,_0x256290){return db[_0xc430('0x5e')][_0xc430('0x48')]({'where':{'id':_0x31ae3c[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19c080,null))[_0xc430('0x1e')](function(_0x5ca0f2){var _0x6debfb;if(_0x5ca0f2){_0x6debfb=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery'](['phone',_0xc430('0x61'),_0xc430('0x62'),_0xc430('0x63'),_0xc430('0x64'),'createdAt',_0xc430('0x65')],squel[_0xc430('0x66')]()[_0xc430('0x67')]('ANY_VALUE(calleridnum)',_0xc430('0x68'))['field'](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),_0xc430('0x62'))['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x6c'),'VoiceQueueId')['field'](_0xc430('0x69'),'createdAt')['field'](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x6e'),_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())[_0xc430('0x34')]('state\x20=\x20?',_0x31ae3c[_0xc430('0x47')][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()['field'](_0xc430('0x68'))['from']('cm_hopper')[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id']['toString']()))[_0xc430('0x34')](_0xc430('0x71'),squel['select']()[_0xc430('0x67')](_0xc430('0x72'))['from'](_0xc430('0x6d'))[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())['where'](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x6debfb);}return[];})[_0xc430('0x1e')](respondWithResult(_0x19c080,null))[_0xc430('0x40')](handleError(_0x19c080,null));};exports[_0xc430('0x75')]=function(_0x19789f,_0x24b380,_0x4fe467){return db[_0xc430('0x76')][_0xc430('0x48')]({'where':{'id':_0x19789f[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x24b380,null))['then'](function(_0x150a8a){var _0x4edead;if(_0x150a8a){_0x4edead=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery']([_0xc430('0x68'),_0xc430('0x61'),_0xc430('0x62'),'ListId',_0xc430('0x77'),'createdAt','updatedAt'],squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x78'),'phone')[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),'ContactId')['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x79'),_0xc430('0x77'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x7a'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())['where'](_0xc430('0x7c'),_0x19789f['body'][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')](_0xc430('0x7d'))[_0xc430('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0xc430('0x7e')]('cm_hopper')['where'](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id'][_0xc430('0x6f')]()))[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x72'))[_0xc430('0x7e')](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())[_0xc430('0x34')](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x4edead);}return[];})[_0xc430('0x1e')](respondWithResult(_0x24b380,null))['catch'](handleError(_0x24b380,null));};exports[_0xc430('0x7f')]=function(_0x6e48a3,_0x5be78a,_0x3bd6e1){return db[_0xc430('0x80')][_0xc430('0x81')]({'where':{'VoiceQueueId':_0x6e48a3[_0xc430('0x47')]['VoiceQueueId'],'CampaignId':_0x6e48a3[_0xc430('0x47')]['CampaignId'],'ContactId':_0x6e48a3['body'][_0xc430('0x62')]}})[_0xc430('0x1e')](handleEntityNotFound(_0x5be78a,null))[_0xc430('0x1e')](function(_0x207067){if(_0x207067){return _0x207067;}return null;})[_0xc430('0x1e')](respondWithResult(_0x5be78a,null))[_0xc430('0x40')](handleError(_0x5be78a,null));}; \ No newline at end of file +var _0xd117=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','CmHopperFinal','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format'];(function(_0x1b283a,_0x37ae9c){var _0x13a83c=function(_0x124185){while(--_0x124185){_0x1b283a['push'](_0x1b283a['shift']());}};_0x13a83c(++_0x37ae9c);}(_0xd117,0x182));var _0x7d11=function(_0x497948,_0x4ca60c){_0x497948=_0x497948-0x0;var _0x39bb36=_0xd117[_0x497948];return _0x39bb36;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':!![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['describe']()['then'](respondWithResult(_0x193631,null))['catch'](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x1e5bb5,_0x20297a){if(_0x1e5bb5[_0x7d11('0x48')][_0x7d11('0x49')]){delete _0x1e5bb5[_0x7d11('0x48')][_0x7d11('0x49')];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'uniqueid':_0x1e5bb5[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x20297a,null))[_0x7d11('0x22')](saveUpdates(_0x1e5bb5['body'],null))[_0x7d11('0x22')](respondWithResult(_0x20297a,null))[_0x7d11('0x40')](handleError(_0x20297a,null));};exports[_0x7d11('0x4a')]=function(_0x553a03,_0x503ebc,_0x14db1c){return db[_0x7d11('0x28')][_0x7d11('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x553a03['params']['id']},'attributes':[[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db['sequelize'][_0x7d11('0x4d')](_0x7d11('0x4e')))),_0x7d11('0x4f')],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),_0x7d11('0x50')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x7d11('0x51')))),_0x7d11('0x52')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x53')))),_0x7d11('0x54')],[db[_0x7d11('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7d11('0x4d')](_0x7d11('0x55')))),_0x7d11('0x56')],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x57')))),_0x7d11('0x58')],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})['then'](handleEntityNotFound(_0x503ebc,null))[_0x7d11('0x22')](respondWithResult(_0x503ebc,null))['catch'](handleError(_0x503ebc,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x52d62d,_0x32c551,_0x12f05b){return db[_0x7d11('0x28')][_0x7d11('0x3e')]({'raw':![],'where':{'CampaignId':_0x52d62d[_0x7d11('0x42')]['id']},'attributes':[[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db['sequelize'][_0x7d11('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0x7d11('0x4f')],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x59')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x5a')))),'busyContacts'],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x51')))),'congestionContacts'],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x53')))),_0x7d11('0x54')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x55')))),_0x7d11('0x56')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db['sequelize']['fn']('IF',db[_0x7d11('0x4c')]['literal'](_0x7d11('0x57')))),'reCallContacts'],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x7d11('0x5b')]]})[_0x7d11('0x22')](handleEntityNotFound(_0x32c551,null))[_0x7d11('0x22')](respondWithResult(_0x32c551,null))['catch'](handleError(_0x32c551,null));};exports[_0x7d11('0x5c')]=function(_0x3c656b,_0x31cb39,_0x1b89de){return db[_0x7d11('0x5d')][_0x7d11('0x45')]({'where':{'id':_0x3c656b['params']['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x31cb39,null))['then'](function(_0x1fd598){var _0x4c88c6;if(_0x1fd598){_0x4c88c6=squel['insert']()[_0x7d11('0x5e')](_0x7d11('0x5f'))[_0x7d11('0x60')]([_0x7d11('0x61'),_0x7d11('0x62'),_0x7d11('0x63'),_0x7d11('0x64'),_0x7d11('0x65'),_0x7d11('0x66'),_0x7d11('0x67')],squel[_0x7d11('0x68')]()['field'](_0x7d11('0x69'),'phone')[_0x7d11('0x6a')](_0x7d11('0x6b'),_0x7d11('0x62'))[_0x7d11('0x6a')](_0x7d11('0x6c'),_0x7d11('0x63'))[_0x7d11('0x6a')]('ANY_VALUE(ListId)','ListId')[_0x7d11('0x6a')](_0x7d11('0x6d'),_0x7d11('0x65'))[_0x7d11('0x6a')](_0x7d11('0x6b'),'createdAt')[_0x7d11('0x6a')]('NOW()',_0x7d11('0x67'))[_0x7d11('0x6e')](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]())[_0x7d11('0x38')]('state\x20=\x20?',_0x3c656b['body'][_0x7d11('0x72')][_0x7d11('0x71')]())[_0x7d11('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7d11('0x73'),squel['select']()[_0x7d11('0x6a')](_0x7d11('0x61'))[_0x7d11('0x6e')](_0x7d11('0x5f'))['where'](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]()))[_0x7d11('0x38')](_0x7d11('0x73'),squel[_0x7d11('0x68')]()[_0x7d11('0x6a')](_0x7d11('0x74'))['from'](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]())['where'](_0x7d11('0x75')))[_0x7d11('0x76')](_0x7d11('0x63')))[_0x7d11('0x71')]();return db[_0x7d11('0x4c')]['query'](_0x4c88c6);}return[];})['then'](respondWithResult(_0x31cb39,null))['catch'](handleError(_0x31cb39,null));};exports[_0x7d11('0x77')]=function(_0x4c15e9,_0x2a9e92,_0x5459d1){return db['Campaign'][_0x7d11('0x45')]({'where':{'id':_0x4c15e9[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x2a9e92,null))[_0x7d11('0x22')](function(_0x345fb3){var _0x32a17a;if(_0x345fb3){_0x32a17a=squel[_0x7d11('0x78')]()[_0x7d11('0x5e')](_0x7d11('0x5f'))[_0x7d11('0x60')](['phone',_0x7d11('0x62'),_0x7d11('0x63'),'ListId',_0x7d11('0x79'),_0x7d11('0x66'),_0x7d11('0x67')],squel[_0x7d11('0x68')]()['field']('ANY_VALUE(calleridnum)',_0x7d11('0x61'))['field'](_0x7d11('0x6b'),_0x7d11('0x62'))[_0x7d11('0x6a')](_0x7d11('0x6c'),_0x7d11('0x63'))[_0x7d11('0x6a')](_0x7d11('0x7a'),'ListId')[_0x7d11('0x6a')](_0x7d11('0x7b'),_0x7d11('0x79'))[_0x7d11('0x6a')]('NOW()',_0x7d11('0x66'))[_0x7d11('0x6a')]('NOW()',_0x7d11('0x67'))[_0x7d11('0x6e')](_0x7d11('0x6f'))['where'](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id']['toString']())[_0x7d11('0x38')](_0x7d11('0x7d'),_0x4c15e9['body'][_0x7d11('0x72')]['toString']())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7d11('0x73'),squel[_0x7d11('0x68')]()[_0x7d11('0x6a')](_0x7d11('0x61'))[_0x7d11('0x6e')](_0x7d11('0x5f'))[_0x7d11('0x38')](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id'][_0x7d11('0x71')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7d11('0x68')]()[_0x7d11('0x6a')]('calleridnum')['from'](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id']['toString']())['where']('state\x20=\x204'))[_0x7d11('0x76')](_0x7d11('0x63')))[_0x7d11('0x71')]();return db['sequelize'][_0x7d11('0x2d')](_0x32a17a);}return[];})[_0x7d11('0x22')](respondWithResult(_0x2a9e92,null))['catch'](handleError(_0x2a9e92,null));};exports[_0x7d11('0x7e')]=function(_0x1cb457,_0x59f0db,_0x5e5faf){return db[_0x7d11('0x7f')][_0x7d11('0x80')]({'where':{'VoiceQueueId':_0x1cb457['body']['VoiceQueueId'],'CampaignId':_0x1cb457[_0x7d11('0x48')][_0x7d11('0x79')],'ContactId':_0x1cb457[_0x7d11('0x48')][_0x7d11('0x63')]}})['then'](handleEntityNotFound(_0x59f0db,null))[_0x7d11('0x22')](function(_0x2cfa77){if(_0x2cfa77){return _0x2cfa77;}return null;})[_0x7d11('0x22')](respondWithResult(_0x59f0db,null))[_0x7d11('0x40')](handleError(_0x59f0db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 766df52..ab85b86 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 _0x322f=['../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x364e71,_0x13d07c){var _0x14ef4a=function(_0x2c975d){while(--_0x2c975d){_0x364e71['push'](_0x364e71['shift']());}};_0x14ef4a(++_0x13d07c);}(_0x322f,0x19e));var _0xf322=function(_0x87a5e8,_0x5a8519){_0x87a5e8=_0x87a5e8-0x0;var _0x5db7c0=_0x322f[_0x87a5e8];return _0x5db7c0;};'use strict';var _=require('lodash');var util=require(_0xf322('0x0'));var logger=require(_0xf322('0x1'))(_0xf322('0x2'));var moment=require(_0xf322('0x3'));var BPromise=require('bluebird');var rp=require(_0xf322('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf322('0x5'));var config=require(_0xf322('0x6'));var attributes=require(_0xf322('0x7'));module[_0xf322('0x8')]=function(_0xe33b83,_0x7223a5){return _0xe33b83['define'](_0xf322('0x9'),attributes,{'tableName':_0xf322('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xf322('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d93=['cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal'];(function(_0x5c1449,_0x2af4b4){var _0x270473=function(_0x1461b6){while(--_0x1461b6){_0x5c1449['push'](_0x5c1449['shift']());}};_0x270473(++_0x2af4b4);}(_0x9d93,0x189));var _0x39d9=function(_0x29c7b7,_0x4bdfbf){_0x29c7b7=_0x29c7b7-0x0;var _0x68d9b8=_0x9d93[_0x29c7b7];return _0x68d9b8;};'use strict';var _=require(_0x39d9('0x0'));var util=require(_0x39d9('0x1'));var logger=require('../../config/logger')(_0x39d9('0x2'));var moment=require(_0x39d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x39d9('0x4'));var fs=require('fs');var path=require(_0x39d9('0x5'));var rimraf=require(_0x39d9('0x6'));var config=require(_0x39d9('0x7'));var attributes=require(_0x39d9('0x8'));module[_0x39d9('0x9')]=function(_0x678ec5,_0x31e21b){return _0x678ec5[_0x39d9('0xa')](_0x39d9('0xb'),attributes,{'tableName':_0x39d9('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x39d9('0xd')]},{'name':_0x39d9('0xe'),'fields':[_0x39d9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8e8a3a3..43776f0 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(_0x1775cc,_0x4fc441){var _0x4eb550=function(_0xc2cec0){while(--_0xc2cec0){_0x1775cc['push'](_0x1775cc['shift']());}};_0x4eb550(++_0x4fc441);}(_0x7a54,0x106));var _0x47a5=function(_0x15beb5,_0x1f8a6d){_0x15beb5=_0x15beb5-0x0;var _0x2bbc62=_0x7a54[_0x15beb5];return _0x2bbc62;};'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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x300723,_0x4d6db8){var _0x25ccac=function(_0x5d9c80){while(--_0x5d9c80){_0x300723['push'](_0x300723['shift']());}};_0x25ccac(++_0x4d6db8);}(_0xb10b,0x12a));var _0xbb10=function(_0x2287c3,_0x2b34e2){_0x2287c3=_0x2287c3-0x0;var _0x448916=_0xb10b[_0x2287c3];return _0x448916;};'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')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index d818950..4d738c0 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 _0xa440=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa440,0x6e));var _0x0a44=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0xa440[_0x55d829];return _0x52163b;};'use strict';var multer=require(_0x0a44('0x0'));var util=require(_0x0a44('0x1'));var path=require('path');var timeout=require(_0x0a44('0x2'));var express=require(_0x0a44('0x3'));var router=express[_0x0a44('0x4')]();var fs_extra=require(_0x0a44('0x5'));var auth=require(_0x0a44('0x6'));var interaction=require(_0x0a44('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x0a44('0x8')]('/',auth[_0x0a44('0x9')](),controller[_0x0a44('0xa')]);router['get'](_0x0a44('0xb'),auth[_0x0a44('0x9')](),controller[_0x0a44('0xc')]);router[_0x0a44('0x8')](_0x0a44('0xd'),auth[_0x0a44('0x9')](),controller[_0x0a44('0xe')]);router[_0x0a44('0x8')](_0x0a44('0xf'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x0a44('0x8')](_0x0a44('0x10'),auth[_0x0a44('0x9')](),controller[_0x0a44('0x11')]);router['post']('/voice/queue/moveContacts/:id',auth[_0x0a44('0x9')](),controller[_0x0a44('0x12')]);router[_0x0a44('0x13')](_0x0a44('0x14'),auth['isAuthenticated'](),controller[_0x0a44('0x15')]);router['post'](_0x0a44('0x16'),auth['isAuthenticated'](),controller[_0x0a44('0x17')]);router['put'](_0x0a44('0xd'),auth[_0x0a44('0x9')](),controller[_0x0a44('0x18')]);module[_0x0a44('0x19')]=router; \ No newline at end of file +var _0x2711=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','util','path'];(function(_0x3ead04,_0x39bccf){var _0x142c29=function(_0x394f0a){while(--_0x394f0a){_0x3ead04['push'](_0x3ead04['shift']());}};_0x142c29(++_0x39bccf);}(_0x2711,0x1e1));var _0x1271=function(_0x2d0bb7,_0x12d5a9){_0x2d0bb7=_0x2d0bb7-0x0;var _0x4b9432=_0x2711[_0x2d0bb7];return _0x4b9432;};'use strict';var multer=require('multer');var util=require(_0x1271('0x0'));var path=require(_0x1271('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1271('0x2')]();var fs_extra=require(_0x1271('0x3'));var auth=require(_0x1271('0x4'));var interaction=require(_0x1271('0x5'));var config=require(_0x1271('0x6'));var controller=require(_0x1271('0x7'));router[_0x1271('0x8')]('/',auth[_0x1271('0x9')](),controller['index']);router[_0x1271('0x8')]('/describe',auth[_0x1271('0x9')](),controller[_0x1271('0xa')]);router[_0x1271('0x8')](_0x1271('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1271('0x8')]('/voice/queue/countAttributes/:id',auth[_0x1271('0x9')](),controller[_0x1271('0xc')]);router[_0x1271('0x8')](_0x1271('0xd'),auth['isAuthenticated'](),controller[_0x1271('0xe')]);router[_0x1271('0xf')]('/voice/queue/moveContacts/:id',auth[_0x1271('0x9')](),controller[_0x1271('0x10')]);router['post'](_0x1271('0x11'),auth[_0x1271('0x9')](),controller[_0x1271('0x12')]);router[_0x1271('0xf')](_0x1271('0x13'),auth[_0x1271('0x9')](),controller[_0x1271('0x14')]);router['put'](_0x1271('0xb'),auth['isAuthenticated'](),controller[_0x1271('0x15')]);module[_0x1271('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index ef216ab..fb97e55 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 _0x9dde=['exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x181546,_0x2268c6){var _0x13e8f7=function(_0x4b76a4){while(--_0x4b76a4){_0x181546['push'](_0x181546['shift']());}};_0x13e8f7(++_0x2268c6);}(_0x9dde,0x1b3));var _0xe9dd=function(_0x4db342,_0x2b12f7){_0x4db342=_0x4db342-0x0;var _0x147627=_0x9dde[_0x4db342];return _0x147627;};'use strict';var Sequelize=require('sequelize');module[_0xe9dd('0x0')]={'state':{'type':Sequelize[_0xe9dd('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe9dd('0x2')]},'scheduledat':{'type':Sequelize[_0xe9dd('0x3')]},'countbusyretry':{'type':Sequelize[_0xe9dd('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe9dd('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe9dd('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe9dd('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe9dd('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xe9dd('0x2')]},'calleridnum':{'type':Sequelize[_0xe9dd('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe9dd('0x3')]},'responsetime':{'type':Sequelize[_0xe9dd('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe9dd('0x3')]},'endtime':{'type':Sequelize[_0xe9dd('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe9dd('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe9dd('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe9dd('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe9dd('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe9dd('0x2')]},'membername':{'type':Sequelize[_0xe9dd('0x2')]},'reason':{'type':Sequelize[_0xe9dd('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe9dd('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe9dd('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe9dd('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe9dd('0x3')]},'recallme':{'type':Sequelize[_0xe9dd('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe9dd('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe9dd('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe9dd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd585=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x24fdd7,_0xe598bf){var _0x38931b=function(_0x114027){while(--_0x114027){_0x24fdd7['push'](_0x24fdd7['shift']());}};_0x38931b(++_0xe598bf);}(_0xd585,0x130));var _0x5d58=function(_0x528623,_0x19a3f9){_0x528623=_0x528623-0x0;var _0xa76ff1=_0xd585[_0x528623];return _0xa76ff1;};'use strict';var Sequelize=require(_0x5d58('0x0'));module[_0x5d58('0x1')]={'state':{'type':Sequelize[_0x5d58('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5d58('0x3')]},'scheduledat':{'type':Sequelize[_0x5d58('0x4')]},'countbusyretry':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5d58('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5d58('0x3')]},'calleridnum':{'type':Sequelize[_0x5d58('0x3')]},'calleridname':{'type':Sequelize[_0x5d58('0x3')]},'starttime':{'type':Sequelize[_0x5d58('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5d58('0x4')]},'droptime':{'type':Sequelize[_0x5d58('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5d58('0x3')]},'campaign':{'type':Sequelize[_0x5d58('0x3')]},'campaigntype':{'type':Sequelize[_0x5d58('0x3')]},'membername':{'type':Sequelize[_0x5d58('0x3')]},'reason':{'type':Sequelize[_0x5d58('0x3')]},'amd':{'type':Sequelize[_0x5d58('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5d58('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5d58('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5d58('0x4')]},'recallme':{'type':Sequelize[_0x5d58('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x5d58('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ea04cf2..710775d 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 _0xbbe4=['find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show'];(function(_0x2e00e3,_0x178704){var _0x3eec93=function(_0x41bb95){while(--_0x41bb95){_0x2e00e3['push'](_0x2e00e3['shift']());}};_0x3eec93(++_0x178704);}(_0xbbe4,0x1c8));var _0x4bbe=function(_0xfc2644,_0x4a3b13){_0xfc2644=_0xfc2644-0x0;var _0x4873b7=_0xbbe4[_0xfc2644];return _0x4873b7;};'use strict';var emlformat=require(_0x4bbe('0x0'));var rimraf=require(_0x4bbe('0x1'));var zipdir=require(_0x4bbe('0x2'));var jsonpatch=require(_0x4bbe('0x3'));var rp=require(_0x4bbe('0x4'));var moment=require(_0x4bbe('0x5'));var BPromise=require(_0x4bbe('0x6'));var Mustache=require('mustache');var util=require(_0x4bbe('0x7'));var path=require(_0x4bbe('0x8'));var sox=require(_0x4bbe('0x9'));var csv=require(_0x4bbe('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4bbe('0xb'));var _=require(_0x4bbe('0xc'));var squel=require(_0x4bbe('0xd'));var crypto=require(_0x4bbe('0xe'));var jsforce=require(_0x4bbe('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4bbe('0xa'));var querystring=require('querystring');var Papa=require(_0x4bbe('0x10'));var Redis=require(_0x4bbe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4bbe('0x12'));var as=require(_0x4bbe('0x13'));var hardwareService=require(_0x4bbe('0x14'));var logger=require('../../config/logger')(_0x4bbe('0x15'));var utils=require(_0x4bbe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4bbe('0x17'));var db=require(_0x4bbe('0x18'))['db'];function respondWithStatusCode(_0x16c02e,_0x21a1d7){_0x21a1d7=_0x21a1d7||0xcc;return function(_0x38dac2){if(_0x38dac2){return _0x16c02e[_0x4bbe('0x19')](_0x21a1d7);}return _0x16c02e[_0x4bbe('0x1a')](_0x21a1d7)[_0x4bbe('0x1b')]();};}function respondWithResult(_0x997ae7,_0x26572c){_0x26572c=_0x26572c||0xc8;return function(_0x3f3329){if(_0x3f3329){return _0x997ae7[_0x4bbe('0x1a')](_0x26572c)[_0x4bbe('0x1c')](_0x3f3329);}};}function respondWithFilteredResult(_0x7021e8,_0x9af476){return function(_0xd9b466){if(_0xd9b466){var _0x44baa8=typeof _0x9af476[_0x4bbe('0x1d')]===_0x4bbe('0x1e')&&typeof _0x9af476[_0x4bbe('0x1f')]==='undefined';var _0x23bdee=_0xd9b466['count'];var _0x3f7e65=_0x44baa8?0x0:_0x9af476[_0x4bbe('0x1d')];var _0x30bd66=_0x44baa8?_0xd9b466[_0x4bbe('0x20')]:_0x9af476[_0x4bbe('0x1d')]+_0x9af476[_0x4bbe('0x1f')];var _0x2c2d85;if(_0x30bd66>=_0x23bdee){_0x30bd66=_0x23bdee;_0x2c2d85=0xc8;}else{_0x2c2d85=0xce;}_0x7021e8[_0x4bbe('0x1a')](_0x2c2d85);return _0x7021e8[_0x4bbe('0x21')](_0x4bbe('0x22'),_0x3f7e65+'-'+_0x30bd66+'/'+_0x23bdee)['json'](_0xd9b466);}return null;};}function patchUpdates(_0x561ecf){return function(_0x4cd6ac){try{jsonpatch[_0x4bbe('0x23')](_0x4cd6ac,_0x561ecf,!![]);}catch(_0x355c7){return BPromise[_0x4bbe('0x24')](_0x355c7);}return _0x4cd6ac[_0x4bbe('0x25')]();};}function saveUpdates(_0x397af2,_0x10f3ce){return function(_0x14f067){if(_0x14f067){return _0x14f067[_0x4bbe('0x26')](_0x397af2)[_0x4bbe('0x27')](function(_0x50f58e){return _0x50f58e;});}return null;};}function removeEntity(_0x388450,_0x20a8f2){return function(_0xc24a6){if(_0xc24a6){return _0xc24a6[_0x4bbe('0x28')]()[_0x4bbe('0x27')](function(){_0x388450[_0x4bbe('0x1a')](0xcc)[_0x4bbe('0x1b')]();});}};}function handleEntityNotFound(_0x199519,_0x15badd){return function(_0x5985b9){if(!_0x5985b9){_0x199519[_0x4bbe('0x19')](0x194);}return _0x5985b9;};}function handleError(_0xe8fd45,_0x5cfbc1){_0x5cfbc1=_0x5cfbc1||0x1f4;return function(_0x44cd5c){logger['error'](_0x44cd5c[_0x4bbe('0x29')]);if(_0x44cd5c[_0x4bbe('0x2a')]){delete _0x44cd5c[_0x4bbe('0x2a')];}_0xe8fd45[_0x4bbe('0x1a')](_0x5cfbc1)['send'](_0x44cd5c);};}exports['index']=function(_0x4d2f1e,_0x586135){var _0x2e5612={},_0x218178={},_0x2ac7c8={'count':0x0,'rows':[]};var _0x22115f=_[_0x4bbe('0x2b')](db['CmHopperHistory'][_0x4bbe('0x2c')],function(_0x4669a9){return{'name':_0x4669a9[_0x4bbe('0x2d')],'type':_0x4669a9[_0x4bbe('0x2e')]['key']};});_0x218178['model']=_[_0x4bbe('0x2b')](_0x22115f,_0x4bbe('0x2a'));_0x218178[_0x4bbe('0x2f')]=_['keys'](_0x4d2f1e[_0x4bbe('0x2f')]);_0x218178[_0x4bbe('0x30')]=_[_0x4bbe('0x31')](_0x218178[_0x4bbe('0x32')],_0x218178['query']);_0x2e5612['attributes']=_[_0x4bbe('0x31')](_0x218178[_0x4bbe('0x32')],qs[_0x4bbe('0x33')](_0x4d2f1e[_0x4bbe('0x2f')][_0x4bbe('0x33')]));_0x2e5612[_0x4bbe('0x34')]=_0x2e5612[_0x4bbe('0x34')][_0x4bbe('0x35')]?_0x2e5612[_0x4bbe('0x34')]:_0x218178[_0x4bbe('0x32')];if(!_0x4d2f1e[_0x4bbe('0x2f')]['hasOwnProperty'](_0x4bbe('0x36'))){_0x2e5612['limit']=qs['limit'](_0x4d2f1e[_0x4bbe('0x2f')]['limit']);_0x2e5612[_0x4bbe('0x1d')]=qs[_0x4bbe('0x1d')](_0x4d2f1e[_0x4bbe('0x2f')]['offset']);}_0x2e5612['order']=qs[_0x4bbe('0x37')](_0x4d2f1e['query'][_0x4bbe('0x37')]);_0x2e5612[_0x4bbe('0x38')]=qs[_0x4bbe('0x30')](_[_0x4bbe('0x39')](_0x4d2f1e[_0x4bbe('0x2f')],_0x218178[_0x4bbe('0x30')]),_0x22115f);if(_0x4d2f1e[_0x4bbe('0x2f')][_0x4bbe('0x3a')]){_0x2e5612[_0x4bbe('0x38')]=_[_0x4bbe('0x3b')](_0x2e5612[_0x4bbe('0x38')],{'$or':_[_0x4bbe('0x2b')](_0x22115f,function(_0x244c3b){if(_0x244c3b[_0x4bbe('0x2e')]!==_0x4bbe('0x3c')){var _0x4092bb={};_0x4092bb[_0x244c3b['name']]={'$like':'%'+_0x4d2f1e[_0x4bbe('0x2f')][_0x4bbe('0x3a')]+'%'};return _0x4092bb;}})});}_0x2e5612=_[_0x4bbe('0x3b')]({},_0x2e5612,_0x4d2f1e[_0x4bbe('0x3d')]);var _0x47548f={'where':_0x2e5612[_0x4bbe('0x38')]};return db[_0x4bbe('0x3e')][_0x4bbe('0x20')](_0x47548f)[_0x4bbe('0x27')](function(_0xc6b111){_0x2ac7c8[_0x4bbe('0x20')]=_0xc6b111;if(_0x4d2f1e['query'][_0x4bbe('0x3f')]){_0x2e5612[_0x4bbe('0x40')]=[{'all':!![]}];}return db[_0x4bbe('0x3e')][_0x4bbe('0x41')](_0x2e5612);})[_0x4bbe('0x27')](function(_0x426ac0){_0x2ac7c8[_0x4bbe('0x42')]=_0x426ac0;return _0x2ac7c8;})[_0x4bbe('0x27')](respondWithFilteredResult(_0x586135,_0x2e5612))[_0x4bbe('0x43')](handleError(_0x586135,null));};exports[_0x4bbe('0x44')]=function(_0xebdff3,_0x2dd7f4){var _0x394c1c={'raw':!![],'where':{'id':_0xebdff3['params']['id']}},_0x56e90c={};_0x56e90c[_0x4bbe('0x32')]=_['keys'](db[_0x4bbe('0x3e')]['rawAttributes']);_0x56e90c[_0x4bbe('0x2f')]=_['keys'](_0xebdff3[_0x4bbe('0x2f')]);_0x56e90c['filters']=_[_0x4bbe('0x31')](_0x56e90c[_0x4bbe('0x32')],_0x56e90c[_0x4bbe('0x2f')]);_0x394c1c[_0x4bbe('0x34')]=_[_0x4bbe('0x31')](_0x56e90c['model'],qs[_0x4bbe('0x33')](_0xebdff3[_0x4bbe('0x2f')][_0x4bbe('0x33')]));_0x394c1c[_0x4bbe('0x34')]=_0x394c1c[_0x4bbe('0x34')]['length']?_0x394c1c[_0x4bbe('0x34')]:_0x56e90c[_0x4bbe('0x32')];if(_0xebdff3['query'][_0x4bbe('0x3f')]){_0x394c1c[_0x4bbe('0x40')]=[{'all':!![]}];}_0x394c1c=_['merge']({},_0x394c1c,_0xebdff3['options']);return db[_0x4bbe('0x3e')][_0x4bbe('0x45')](_0x394c1c)['then'](handleEntityNotFound(_0x2dd7f4,null))[_0x4bbe('0x27')](respondWithResult(_0x2dd7f4,null))[_0x4bbe('0x43')](handleError(_0x2dd7f4,null));};exports[_0x4bbe('0x46')]=function(_0x158b1d,_0x90eb4e){return db['CmHopperHistory'][_0x4bbe('0x46')](_0x158b1d[_0x4bbe('0x47')],{})[_0x4bbe('0x27')](respondWithResult(_0x90eb4e,0xc9))[_0x4bbe('0x43')](handleError(_0x90eb4e,null));};exports[_0x4bbe('0x48')]=function(_0x363461,_0x510037){return db['CmHopperHistory'][_0x4bbe('0x48')]()[_0x4bbe('0x27')](respondWithResult(_0x510037,null))[_0x4bbe('0x43')](handleError(_0x510037,null));};exports[_0x4bbe('0x26')]=function(_0x3115ad,_0x6c13ea){if(_0x3115ad[_0x4bbe('0x47')]['uniqueid']){delete _0x3115ad[_0x4bbe('0x47')][_0x4bbe('0x49')];}return db[_0x4bbe('0x3e')][_0x4bbe('0x45')]({'where':{'uniqueid':_0x3115ad[_0x4bbe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6c13ea,null))[_0x4bbe('0x27')](saveUpdates(_0x3115ad['body'],null))[_0x4bbe('0x27')](respondWithResult(_0x6c13ea,null))['catch'](handleError(_0x6c13ea,null));}; \ No newline at end of file +var _0xca5c=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','destroy','error','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','then','include','findAll','rows','params','length','includeAll','catch','create','body','describe','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0xca5c,0x1b7));var _0xcca5=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xca5c[_0x5e4563];return _0x8d1bf5;};'use strict';var emlformat=require(_0xcca5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcca5('0x1'));var jsonpatch=require(_0xcca5('0x2'));var rp=require(_0xcca5('0x3'));var moment=require(_0xcca5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcca5('0x5'));var util=require(_0xcca5('0x6'));var path=require(_0xcca5('0x7'));var sox=require('sox');var csv=require(_0xcca5('0x8'));var ejs=require(_0xcca5('0x9'));var fs=require('fs');var fs_extra=require(_0xcca5('0xa'));var _=require(_0xcca5('0xb'));var squel=require(_0xcca5('0xc'));var crypto=require(_0xcca5('0xd'));var jsforce=require(_0xcca5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcca5('0x8'));var querystring=require(_0xcca5('0xf'));var Papa=require(_0xcca5('0x10'));var Redis=require(_0xcca5('0x11'));var authService=require(_0xcca5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcca5('0x13'));var hardwareService=require(_0xcca5('0x14'));var logger=require(_0xcca5('0x15'))(_0xcca5('0x16'));var utils=require(_0xcca5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcca5('0x18'));var db=require(_0xcca5('0x19'))['db'];function respondWithStatusCode(_0x20a815,_0x5cb1c5){_0x5cb1c5=_0x5cb1c5||0xcc;return function(_0x43426c){if(_0x43426c){return _0x20a815[_0xcca5('0x1a')](_0x5cb1c5);}return _0x20a815['status'](_0x5cb1c5)[_0xcca5('0x1b')]();};}function respondWithResult(_0x21c07e,_0x2fa398){_0x2fa398=_0x2fa398||0xc8;return function(_0x818e7e){if(_0x818e7e){return _0x21c07e['status'](_0x2fa398)[_0xcca5('0x1c')](_0x818e7e);}};}function respondWithFilteredResult(_0x22e962,_0x43e9a2){return function(_0x478458){if(_0x478458){var _0x5dff51=typeof _0x43e9a2[_0xcca5('0x1d')]===_0xcca5('0x1e')&&typeof _0x43e9a2[_0xcca5('0x1f')]===_0xcca5('0x1e');var _0x598c0b=_0x478458[_0xcca5('0x20')];var _0x10c77b=_0x5dff51?0x0:_0x43e9a2['offset'];var _0x367d34=_0x5dff51?_0x478458['count']:_0x43e9a2['offset']+_0x43e9a2['limit'];var _0x46af71;if(_0x367d34>=_0x598c0b){_0x367d34=_0x598c0b;_0x46af71=0xc8;}else{_0x46af71=0xce;}_0x22e962[_0xcca5('0x21')](_0x46af71);return _0x22e962[_0xcca5('0x22')]('Content-Range',_0x10c77b+'-'+_0x367d34+'/'+_0x598c0b)['json'](_0x478458);}return null;};}function patchUpdates(_0x371a88){return function(_0x21ae30){try{jsonpatch[_0xcca5('0x23')](_0x21ae30,_0x371a88,!![]);}catch(_0x5c4fc9){return BPromise[_0xcca5('0x24')](_0x5c4fc9);}return _0x21ae30[_0xcca5('0x25')]();};}function saveUpdates(_0x3853ea,_0x42d3d8){return function(_0x4ca8db){if(_0x4ca8db){return _0x4ca8db[_0xcca5('0x26')](_0x3853ea)['then'](function(_0x41c013){return _0x41c013;});}return null;};}function removeEntity(_0xf12b24,_0x2d93eb){return function(_0x2f6110){if(_0x2f6110){return _0x2f6110[_0xcca5('0x27')]()['then'](function(){_0xf12b24[_0xcca5('0x21')](0xcc)[_0xcca5('0x1b')]();});}};}function handleEntityNotFound(_0x527984,_0x366fbf){return function(_0x301015){if(!_0x301015){_0x527984[_0xcca5('0x1a')](0x194);}return _0x301015;};}function handleError(_0x3b426a,_0x385f9a){_0x385f9a=_0x385f9a||0x1f4;return function(_0x9ded7f){logger[_0xcca5('0x28')](_0x9ded7f['stack']);if(_0x9ded7f[_0xcca5('0x29')]){delete _0x9ded7f[_0xcca5('0x29')];}_0x3b426a[_0xcca5('0x21')](_0x385f9a)[_0xcca5('0x2a')](_0x9ded7f);};}exports['index']=function(_0x4d50f5,_0x228671){var _0x8e774d={},_0x1bcb35={},_0x232fd8={'count':0x0,'rows':[]};var _0x4b1a34=_[_0xcca5('0x2b')](db[_0xcca5('0x2c')][_0xcca5('0x2d')],function(_0x34482b){return{'name':_0x34482b[_0xcca5('0x2e')],'type':_0x34482b[_0xcca5('0x2f')][_0xcca5('0x30')]};});_0x1bcb35[_0xcca5('0x31')]=_[_0xcca5('0x2b')](_0x4b1a34,_0xcca5('0x29'));_0x1bcb35[_0xcca5('0x32')]=_[_0xcca5('0x33')](_0x4d50f5['query']);_0x1bcb35[_0xcca5('0x34')]=_[_0xcca5('0x35')](_0x1bcb35[_0xcca5('0x31')],_0x1bcb35[_0xcca5('0x32')]);_0x8e774d[_0xcca5('0x36')]=_['intersection'](_0x1bcb35[_0xcca5('0x31')],qs[_0xcca5('0x37')](_0x4d50f5[_0xcca5('0x32')][_0xcca5('0x37')]));_0x8e774d['attributes']=_0x8e774d[_0xcca5('0x36')]['length']?_0x8e774d[_0xcca5('0x36')]:_0x1bcb35[_0xcca5('0x31')];if(!_0x4d50f5[_0xcca5('0x32')][_0xcca5('0x38')](_0xcca5('0x39'))){_0x8e774d['limit']=qs[_0xcca5('0x1f')](_0x4d50f5[_0xcca5('0x32')][_0xcca5('0x1f')]);_0x8e774d[_0xcca5('0x1d')]=qs[_0xcca5('0x1d')](_0x4d50f5[_0xcca5('0x32')][_0xcca5('0x1d')]);}_0x8e774d[_0xcca5('0x3a')]=qs['sort'](_0x4d50f5[_0xcca5('0x32')]['sort']);_0x8e774d[_0xcca5('0x3b')]=qs[_0xcca5('0x34')](_[_0xcca5('0x3c')](_0x4d50f5[_0xcca5('0x32')],_0x1bcb35[_0xcca5('0x34')]),_0x4b1a34);if(_0x4d50f5['query']['filter']){_0x8e774d[_0xcca5('0x3b')]=_[_0xcca5('0x3d')](_0x8e774d[_0xcca5('0x3b')],{'$or':_[_0xcca5('0x2b')](_0x4b1a34,function(_0x5e1f02){if(_0x5e1f02['type']!==_0xcca5('0x3e')){var _0x49f13b={};_0x49f13b[_0x5e1f02['name']]={'$like':'%'+_0x4d50f5[_0xcca5('0x32')][_0xcca5('0x3f')]+'%'};return _0x49f13b;}})});}_0x8e774d=_[_0xcca5('0x3d')]({},_0x8e774d,_0x4d50f5[_0xcca5('0x40')]);var _0x12db4c={'where':_0x8e774d[_0xcca5('0x3b')]};return db['CmHopperHistory'][_0xcca5('0x20')](_0x12db4c)[_0xcca5('0x41')](function(_0x179c47){_0x232fd8['count']=_0x179c47;if(_0x4d50f5[_0xcca5('0x32')]['includeAll']){_0x8e774d[_0xcca5('0x42')]=[{'all':!![]}];}return db[_0xcca5('0x2c')][_0xcca5('0x43')](_0x8e774d);})[_0xcca5('0x41')](function(_0x1b948d){_0x232fd8[_0xcca5('0x44')]=_0x1b948d;return _0x232fd8;})['then'](respondWithFilteredResult(_0x228671,_0x8e774d))['catch'](handleError(_0x228671,null));};exports['show']=function(_0x1f975b,_0x30a984){var _0x29ab8d={'raw':!![],'where':{'id':_0x1f975b[_0xcca5('0x45')]['id']}},_0x110aa3={};_0x110aa3[_0xcca5('0x31')]=_[_0xcca5('0x33')](db[_0xcca5('0x2c')]['rawAttributes']);_0x110aa3[_0xcca5('0x32')]=_[_0xcca5('0x33')](_0x1f975b[_0xcca5('0x32')]);_0x110aa3['filters']=_[_0xcca5('0x35')](_0x110aa3['model'],_0x110aa3['query']);_0x29ab8d['attributes']=_[_0xcca5('0x35')](_0x110aa3[_0xcca5('0x31')],qs[_0xcca5('0x37')](_0x1f975b[_0xcca5('0x32')][_0xcca5('0x37')]));_0x29ab8d[_0xcca5('0x36')]=_0x29ab8d[_0xcca5('0x36')][_0xcca5('0x46')]?_0x29ab8d[_0xcca5('0x36')]:_0x110aa3[_0xcca5('0x31')];if(_0x1f975b[_0xcca5('0x32')][_0xcca5('0x47')]){_0x29ab8d[_0xcca5('0x42')]=[{'all':!![]}];}_0x29ab8d=_['merge']({},_0x29ab8d,_0x1f975b['options']);return db['CmHopperHistory']['find'](_0x29ab8d)[_0xcca5('0x41')](handleEntityNotFound(_0x30a984,null))[_0xcca5('0x41')](respondWithResult(_0x30a984,null))[_0xcca5('0x48')](handleError(_0x30a984,null));};exports[_0xcca5('0x49')]=function(_0x3d09eb,_0xf16366){return db[_0xcca5('0x2c')][_0xcca5('0x49')](_0x3d09eb[_0xcca5('0x4a')],{})[_0xcca5('0x41')](respondWithResult(_0xf16366,0xc9))['catch'](handleError(_0xf16366,null));};exports[_0xcca5('0x4b')]=function(_0x492191,_0x4d7538){return db[_0xcca5('0x2c')][_0xcca5('0x4b')]()[_0xcca5('0x41')](respondWithResult(_0x4d7538,null))['catch'](handleError(_0x4d7538,null));};exports[_0xcca5('0x26')]=function(_0x5d1c79,_0x259008){if(_0x5d1c79[_0xcca5('0x4a')]['uniqueid']){delete _0x5d1c79[_0xcca5('0x4a')]['uniqueid'];}return db[_0xcca5('0x2c')][_0xcca5('0x4c')]({'where':{'uniqueid':_0x5d1c79[_0xcca5('0x45')]['id']}})[_0xcca5('0x41')](handleEntityNotFound(_0x259008,null))[_0xcca5('0x41')](saveUpdates(_0x5d1c79[_0xcca5('0x4a')],null))['then'](respondWithResult(_0x259008,null))['catch'](handleError(_0x259008,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 18fab89..cb0cb91 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 _0xfa25=['rimraf','exports','CmHopperHistory','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4882bb,_0x4f9d6f){var _0x324486=function(_0x5cd965){while(--_0x5cd965){_0x4882bb['push'](_0x4882bb['shift']());}};_0x324486(++_0x4f9d6f);}(_0xfa25,0xd1));var _0x5fa2=function(_0x29ab53,_0x4e8c62){_0x29ab53=_0x29ab53-0x0;var _0x2e4cbf=_0xfa25[_0x29ab53];return _0x2e4cbf;};'use strict';var _=require('lodash');var util=require(_0x5fa2('0x0'));var logger=require(_0x5fa2('0x1'))(_0x5fa2('0x2'));var moment=require(_0x5fa2('0x3'));var BPromise=require(_0x5fa2('0x4'));var rp=require(_0x5fa2('0x5'));var fs=require('fs');var path=require(_0x5fa2('0x6'));var rimraf=require(_0x5fa2('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x5fa2('0x8')]=function(_0x29efc3,_0x479b86){return _0x29efc3['define'](_0x5fa2('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x5fa2('0xa'),'fields':[_0x5fa2('0xa')]},{'name':_0x5fa2('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','endtime','uniqueid'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0xc2a2,0x84));var _0x2c2a=function(_0x5e9ebc,_0x167133){_0x5e9ebc=_0x5e9ebc-0x0;var _0x2bfb69=_0xc2a2[_0x5e9ebc];return _0x2bfb69;};'use strict';var _=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var logger=require(_0x2c2a('0x2'))(_0x2c2a('0x3'));var moment=require('moment');var BPromise=require(_0x2c2a('0x4'));var rp=require(_0x2c2a('0x5'));var fs=require('fs');var path=require(_0x2c2a('0x6'));var rimraf=require('rimraf');var config=require(_0x2c2a('0x7'));var attributes=require(_0x2c2a('0x8'));module[_0x2c2a('0x9')]=function(_0x17db27,_0x51c919){return _0x17db27['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x2c2a('0xa')]},{'name':'uniqueid','fields':[_0x2c2a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 0627b25..d0e7152 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 _0x1df5=['predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperHistory','body','options','raw','debug','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal'];(function(_0x2d202f,_0x4c391d){var _0x406c13=function(_0x29c0e2){while(--_0x29c0e2){_0x2d202f['push'](_0x2d202f['shift']());}};_0x406c13(++_0x4c391d);}(_0x1df5,0xfd));var _0x51df=function(_0x38af50,_0x1d98c5){_0x38af50=_0x38af50-0x0;var _0x3ec1b6=_0x1df5[_0x38af50];return _0x3ec1b6;};'use strict';var _=require(_0x51df('0x0'));var util=require(_0x51df('0x1'));var moment=require(_0x51df('0x2'));var BPromise=require(_0x51df('0x3'));var rs=require(_0x51df('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51df('0x5'))['db'];var utils=require(_0x51df('0x6'));var logger=require(_0x51df('0x7'))(_0x51df('0x8'));var config=require(_0x51df('0x9'));var jayson=require(_0x51df('0xa'));var client=jayson[_0x51df('0xb')][_0x51df('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50961e,_0x1316c2,_0x53b879){return new BPromise(function(_0x42a74a,_0x3e7952){return client[_0x51df('0xd')](_0x50961e,_0x53b879)[_0x51df('0xe')](function(_0x7e1410){logger[_0x51df('0xf')](_0x51df('0x10'),_0x1316c2,_0x51df('0x11'));logger['debug'](_0x51df('0x12'),_0x1316c2,_0x51df('0x11'),JSON[_0x51df('0x13')](_0x7e1410));if(_0x7e1410[_0x51df('0x14')]){if(_0x7e1410[_0x51df('0x14')][_0x51df('0x15')]===0x1f4){logger[_0x51df('0x14')](_0x51df('0x10'),_0x1316c2,_0x7e1410[_0x51df('0x14')][_0x51df('0x16')]);return _0x3e7952(_0x7e1410[_0x51df('0x14')][_0x51df('0x16')]);}logger[_0x51df('0x14')](_0x51df('0x10'),_0x1316c2,_0x7e1410[_0x51df('0x14')]['message']);return _0x42a74a(_0x7e1410[_0x51df('0x14')][_0x51df('0x16')]);}else{logger['info'](_0x51df('0x10'),_0x1316c2,_0x51df('0x11'));_0x42a74a(_0x7e1410[_0x51df('0x17')]['message']);}})[_0x51df('0x18')](function(_0x353a81){logger[_0x51df('0x14')](_0x51df('0x10'),_0x1316c2,_0x353a81);_0x3e7952(_0x353a81);});});}exports['CreateCmHopperHistory']=function(_0x1bdba3){var _0x3e24e7=this;return new Promise(function(_0x5cd515,_0x49470b){return db[_0x51df('0x19')]['create'](_0x1bdba3[_0x51df('0x1a')],{'raw':_0x1bdba3[_0x51df('0x1b')]?_0x1bdba3[_0x51df('0x1b')][_0x51df('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xfba51f){logger[_0x51df('0xf')]('CreateCmHopperHistory',_0x1bdba3);logger[_0x51df('0x1d')]('CreateCmHopperHistory',_0x1bdba3,JSON[_0x51df('0x13')](_0xfba51f));_0x5cd515(_0xfba51f);})['catch'](function(_0x5c4877){logger[_0x51df('0x14')](_0x51df('0x1e'),_0x5c4877[_0x51df('0x16')],_0x1bdba3);_0x49470b(_0x3e24e7[_0x51df('0x14')](0x1f4,_0x5c4877[_0x51df('0x16')]));});});};exports[_0x51df('0x1f')]=function(_0x1e1c9d){var _0x1b6f5c=this;return new Promise(function(_0x25e4fc,_0x40b6c7){return db[_0x51df('0x19')][_0x51df('0x20')]({'raw':_0x1e1c9d[_0x51df('0x1b')]?_0x1e1c9d[_0x51df('0x1b')][_0x51df('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e1c9d[_0x51df('0x1b')]?_0x1e1c9d[_0x51df('0x1b')][_0x51df('0x21')]||null:null,'attributes':[[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db['sequelize']['col']('id')),_0x51df('0x24')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x51df('0x25')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')]('`state`\x20=\x2010,\x201,\x20null'))),_0x51df('0x27')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x28')))),_0x51df('0x29')],[db[_0x51df('0x22')]['fn']('AVG',db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x51df('0x2a')],[db[_0x51df('0x22')]['fn']('AVG',db[_0x51df('0x22')]['fn']('IF',db['sequelize']['literal'](_0x51df('0x2b')))),_0x51df('0x2c')]]})['then'](function(_0x38d61d){logger[_0x51df('0xf')](_0x51df('0x1f'),_0x1e1c9d);logger['debug'](_0x51df('0x1f'),_0x1e1c9d,JSON[_0x51df('0x13')](_0x38d61d));_0x25e4fc(_0x38d61d);})[_0x51df('0x18')](function(_0x2304d7){logger[_0x51df('0x14')](_0x51df('0x1f'),_0x2304d7[_0x51df('0x16')],_0x1e1c9d);_0x40b6c7(_0x1b6f5c[_0x51df('0x14')](0x1f4,_0x2304d7[_0x51df('0x16')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x21cff7){var _0x4308fa=this;return new Promise(function(_0x5cb829,_0x46c4ad){return db['CmHopperHistory']['findAll']({'raw':_0x21cff7[_0x51df('0x1b')]?_0x21cff7[_0x51df('0x1b')][_0x51df('0x1c')]===undefined?!![]:![]:!![],'where':_0x21cff7[_0x51df('0x1b')]?_0x21cff7[_0x51df('0x1b')][_0x51df('0x21')]||null:null,'attributes':[[_0x51df('0x2d'),_0x51df('0x2e')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x2f')))),_0x51df('0x30')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')]['literal'](_0x51df('0x31')))),_0x51df('0x32')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db['sequelize']['fn']('IF',db[_0x51df('0x22')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x33')))),_0x51df('0x34')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x35')))),_0x51df('0x36')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x37')))),_0x51df('0x38')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db['sequelize']['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x39')))),_0x51df('0x3a')],[db['sequelize']['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x3b')))),_0x51df('0x3c')],[db[_0x51df('0x22')]['fn']('COUNT',db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x3d')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x3e')))),_0x51df('0x3f')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db['sequelize']['fn']('IF',db[_0x51df('0x22')]['literal'](_0x51df('0x40')))),_0x51df('0x41')],[db[_0x51df('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')](_0x51df('0x42')))),_0x51df('0x43')],[db['sequelize']['fn']('COUNT',db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')][_0x51df('0x26')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db['sequelize']['fn']('IF',db[_0x51df('0x22')]['literal'](_0x51df('0x44')))),'outboundReCallsDay']],'group':['campaign']})[_0x51df('0xe')](function(_0x3aed50){logger[_0x51df('0xf')](_0x51df('0x45'),_0x21cff7);logger[_0x51df('0x1d')](_0x51df('0x45'),_0x21cff7,JSON[_0x51df('0x13')](_0x3aed50));_0x5cb829(_0x3aed50);})[_0x51df('0x18')](function(_0xc08422){logger[_0x51df('0x14')](_0x51df('0x45'),_0xc08422[_0x51df('0x16')],_0x21cff7);_0x46c4ad(_0x4308fa['error'](0x1f4,_0xc08422[_0x51df('0x16')]));});});};exports[_0x51df('0x46')]=function(_0x2fb8f9){var _0x59931e=this;return new Promise(function(_0x5f2373,_0x170c14){return db['CmHopperHistory'][_0x51df('0x20')]({'raw':_0x2fb8f9[_0x51df('0x1b')]?_0x2fb8f9[_0x51df('0x1b')][_0x51df('0x1c')]===undefined?!![]:![]:!![],'where':_0x2fb8f9[_0x51df('0x1b')]?_0x2fb8f9[_0x51df('0x1b')][_0x51df('0x21')]||null:null,'attributes':[[_0x51df('0x2d'),'name'],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')][_0x51df('0x47')]('id')),_0x51df('0x48')],[db[_0x51df('0x22')]['fn'](_0x51df('0x23'),db[_0x51df('0x22')]['fn']('IF',db[_0x51df('0x22')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x51df('0x2d')]})[_0x51df('0xe')](function(_0x19d5dc){logger[_0x51df('0xf')](_0x51df('0x46'),_0x2fb8f9);logger[_0x51df('0x1d')](_0x51df('0x46'),_0x2fb8f9,JSON[_0x51df('0x13')](_0x19d5dc));_0x5f2373(_0x19d5dc);})[_0x51df('0x18')](function(_0x1672af){logger['error'](_0x51df('0x46'),_0x1672af[_0x51df('0x16')],_0x2fb8f9);_0x170c14(_0x59931e[_0x51df('0x14')](0x1f4,_0x1672af['message']));});});}; \ No newline at end of file +var _0x9795=['`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CmHopperHistory','options','CreateCmHopperHistory','AvgHandleTime','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay'];(function(_0x4d0b28,_0x41f716){var _0x2b401a=function(_0x3e0424){while(--_0x3e0424){_0x4d0b28['push'](_0x4d0b28['shift']());}};_0x2b401a(++_0x41f716);}(_0x9795,0x92));var _0x5979=function(_0x176a0d,_0xa1cfab){_0x176a0d=_0x176a0d-0x0;var _0x30fc9c=_0x9795[_0x176a0d];return _0x30fc9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5979('0x0'));var BPromise=require('bluebird');var rs=require(_0x5979('0x1'));var fs=require('fs');var Redis=require(_0x5979('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5979('0x3'));var logger=require('../../config/logger')(_0x5979('0x4'));var config=require(_0x5979('0x5'));var jayson=require(_0x5979('0x6'));var client=jayson[_0x5979('0x7')][_0x5979('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12e4ae,_0x3415ff,_0x150d7e){return new BPromise(function(_0x35777c,_0x475731){return client[_0x5979('0x9')](_0x12e4ae,_0x150d7e)[_0x5979('0xa')](function(_0x3bddac){logger['info'](_0x5979('0xb'),_0x3415ff,_0x5979('0xc'));logger[_0x5979('0xd')](_0x5979('0xe'),_0x3415ff,_0x5979('0xc'),JSON[_0x5979('0xf')](_0x3bddac));if(_0x3bddac[_0x5979('0x10')]){if(_0x3bddac[_0x5979('0x10')][_0x5979('0x11')]===0x1f4){logger['error'](_0x5979('0xb'),_0x3415ff,_0x3bddac['error']['message']);return _0x475731(_0x3bddac['error'][_0x5979('0x12')]);}logger[_0x5979('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x3415ff,_0x3bddac['error'][_0x5979('0x12')]);return _0x35777c(_0x3bddac[_0x5979('0x10')][_0x5979('0x12')]);}else{logger[_0x5979('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x3415ff,_0x5979('0xc'));_0x35777c(_0x3bddac[_0x5979('0x14')][_0x5979('0x12')]);}})['catch'](function(_0x5d14be){logger[_0x5979('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x3415ff,_0x5d14be);_0x475731(_0x5d14be);});});}exports['CreateCmHopperHistory']=function(_0x2ae33f){var _0x4468c9=this;return new Promise(function(_0x360870,_0x35a695){return db[_0x5979('0x15')]['create'](_0x2ae33f['body'],{'raw':_0x2ae33f['options']?_0x2ae33f[_0x5979('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x5979('0xa')](function(_0x5e5012){logger[_0x5979('0x13')](_0x5979('0x17'),_0x2ae33f);logger['debug']('CreateCmHopperHistory',_0x2ae33f,JSON[_0x5979('0xf')](_0x5e5012));_0x360870(_0x5e5012);})['catch'](function(_0x165223){logger['error'](_0x5979('0x17'),_0x165223[_0x5979('0x12')],_0x2ae33f);_0x35a695(_0x4468c9[_0x5979('0x10')](0x1f4,_0x165223['message']));});});};exports[_0x5979('0x18')]=function(_0x11029b){var _0x4f9bb0=this;return new Promise(function(_0x2d0555,_0x2d02ca){return db[_0x5979('0x15')][_0x5979('0x19')]({'raw':_0x11029b[_0x5979('0x16')]?_0x11029b[_0x5979('0x16')][_0x5979('0x1a')]===undefined?!![]:![]:!![],'where':_0x11029b[_0x5979('0x16')]?_0x11029b[_0x5979('0x16')][_0x5979('0x1b')]||null:null,'attributes':[[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')][_0x5979('0x1e')]('id')),_0x5979('0x1f')],[db['sequelize']['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')]['literal'](_0x5979('0x20')))),_0x5979('0x21')],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x5979('0x22')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x5979('0x23')](_0x5979('0x24')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x5979('0x25'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x26')))),_0x5979('0x27')],[db[_0x5979('0x1c')]['fn'](_0x5979('0x25'),db['sequelize']['fn']('IF',db[_0x5979('0x1c')]['literal'](_0x5979('0x28')))),_0x5979('0x29')]]})[_0x5979('0xa')](function(_0xa493be){logger[_0x5979('0x13')](_0x5979('0x18'),_0x11029b);logger[_0x5979('0xd')](_0x5979('0x18'),_0x11029b,JSON['stringify'](_0xa493be));_0x2d0555(_0xa493be);})[_0x5979('0x2a')](function(_0x2950ff){logger[_0x5979('0x10')](_0x5979('0x18'),_0x2950ff['message'],_0x11029b);_0x2d02ca(_0x4f9bb0[_0x5979('0x10')](0x1f4,_0x2950ff[_0x5979('0x12')]));});});};exports[_0x5979('0x2b')]=function(_0x1b5d2b){var _0x2a66bf=this;return new Promise(function(_0x3702f2,_0xf64983){return db['CmHopperHistory'][_0x5979('0x19')]({'raw':_0x1b5d2b[_0x5979('0x16')]?_0x1b5d2b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b5d2b[_0x5979('0x16')]?_0x1b5d2b[_0x5979('0x16')][_0x5979('0x1b')]||null:null,'attributes':[[_0x5979('0x2c'),_0x5979('0x2d')],[db['sequelize']['fn']('COUNT',db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x2e')))),_0x5979('0x2f')],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x30')))),_0x5979('0x31')],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x20')))),_0x5979('0x32')],[db['sequelize']['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x33')))),_0x5979('0x34')],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db['sequelize'][_0x5979('0x23')](_0x5979('0x35')))),'outboundDropCallsDayTimeout'],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db['sequelize']['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x36')))),_0x5979('0x37')],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x38')))),_0x5979('0x39')],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db['sequelize'][_0x5979('0x23')](_0x5979('0x3a')))),'outboundBlacklistCallsDay'],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x3b')))),_0x5979('0x3c')],[db[_0x5979('0x1c')]['fn']('COUNT',db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x3d')))),_0x5979('0x3e')],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x5979('0x3f')],[db[_0x5979('0x1c')]['fn'](_0x5979('0x1d'),db[_0x5979('0x1c')]['fn']('IF',db['sequelize'][_0x5979('0x23')]('`state`\x20=\x2020,\x201,\x20null'))),_0x5979('0x3e')],[db[_0x5979('0x1c')]['fn']('COUNT',db[_0x5979('0x1c')]['fn']('IF',db[_0x5979('0x1c')][_0x5979('0x23')](_0x5979('0x40')))),_0x5979('0x41')]],'group':[_0x5979('0x2c')]})[_0x5979('0xa')](function(_0x43bc84){logger[_0x5979('0x13')](_0x5979('0x2b'),_0x1b5d2b);logger[_0x5979('0xd')](_0x5979('0x2b'),_0x1b5d2b,JSON[_0x5979('0xf')](_0x43bc84));_0x3702f2(_0x43bc84);})[_0x5979('0x2a')](function(_0x30c6ac){logger['error'](_0x5979('0x2b'),_0x30c6ac[_0x5979('0x12')],_0x1b5d2b);_0xf64983(_0x2a66bf[_0x5979('0x10')](0x1f4,_0x30c6ac[_0x5979('0x12')]));});});};exports[_0x5979('0x42')]=function(_0x38fd76){var _0x4708fb=this;return new Promise(function(_0x328346,_0x22a4ea){return db[_0x5979('0x15')]['findAll']({'raw':_0x38fd76[_0x5979('0x16')]?_0x38fd76[_0x5979('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x38fd76[_0x5979('0x16')]?_0x38fd76['options'][_0x5979('0x1b')]||null:null,'attributes':[[_0x5979('0x2c'),'name'],[db[_0x5979('0x1c')]['fn']('COUNT',db[_0x5979('0x1c')][_0x5979('0x1e')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0x5979('0x1c')]['fn']('IF',db['sequelize'][_0x5979('0x23')](_0x5979('0x20')))),_0x5979('0x43')]],'group':['campaign']})[_0x5979('0xa')](function(_0x4c56b4){logger[_0x5979('0x13')](_0x5979('0x42'),_0x38fd76);logger[_0x5979('0xd')](_0x5979('0x42'),_0x38fd76,JSON[_0x5979('0xf')](_0x4c56b4));_0x328346(_0x4c56b4);})[_0x5979('0x2a')](function(_0x394c8d){logger['error'](_0x5979('0x42'),_0x394c8d[_0x5979('0x12')],_0x38fd76);_0x22a4ea(_0x4708fb[_0x5979('0x10')](0x1f4,_0x394c8d[_0x5979('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f1e7900..9ebed9f 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 _0xb78f=['/:id','post','create','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x4e6b5f,_0x210669){var _0x2b8864=function(_0x5c4421){while(--_0x5c4421){_0x4e6b5f['push'](_0x4e6b5f['shift']());}};_0x2b8864(++_0x210669);}(_0xb78f,0x9f));var _0xfb78=function(_0x5daa7a,_0x481e56){_0x5daa7a=_0x5daa7a-0x0;var _0x5b1305=_0xb78f[_0x5daa7a];return _0x5b1305;};'use strict';var multer=require(_0xfb78('0x0'));var util=require(_0xfb78('0x1'));var path=require(_0xfb78('0x2'));var timeout=require(_0xfb78('0x3'));var express=require('express');var router=express[_0xfb78('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfb78('0x5'));var interaction=require(_0xfb78('0x6'));var config=require(_0xfb78('0x7'));var controller=require(_0xfb78('0x8'));router[_0xfb78('0x9')]('/',auth[_0xfb78('0xa')](),controller['index']);router[_0xfb78('0x9')]('/describe',auth[_0xfb78('0xa')](),controller['describe']);router[_0xfb78('0x9')](_0xfb78('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xfb78('0xc')]('/',auth['isAuthenticated'](),controller[_0xfb78('0xd')]);router[_0xfb78('0xe')](_0xfb78('0xb'),auth[_0xfb78('0xa')](),controller[_0xfb78('0xf')]);module[_0xfb78('0x10')]=router; \ No newline at end of file +var _0xa252=['./cmHopperHistory.controller','isAuthenticated','index','get','post','put','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x42bbd4,_0x231135){var _0x3da3e8=function(_0x1a39db){while(--_0x1a39db){_0x42bbd4['push'](_0x42bbd4['shift']());}};_0x3da3e8(++_0x231135);}(_0xa252,0xe0));var _0x2a25=function(_0x5acd6,_0x50d378){_0x5acd6=_0x5acd6-0x0;var _0x5a7ed0=_0xa252[_0x5acd6];return _0x5a7ed0;};'use strict';var multer=require(_0x2a25('0x0'));var util=require(_0x2a25('0x1'));var path=require(_0x2a25('0x2'));var timeout=require(_0x2a25('0x3'));var express=require(_0x2a25('0x4'));var router=express[_0x2a25('0x5')]();var fs_extra=require(_0x2a25('0x6'));var auth=require(_0x2a25('0x7'));var interaction=require(_0x2a25('0x8'));var config=require(_0x2a25('0x9'));var controller=require(_0x2a25('0xa'));router['get']('/',auth[_0x2a25('0xb')](),controller[_0x2a25('0xc')]);router[_0x2a25('0xd')]('/describe',auth[_0x2a25('0xb')](),controller['describe']);router[_0x2a25('0xd')]('/:id',auth[_0x2a25('0xb')](),controller['show']);router[_0x2a25('0xe')]('/',auth[_0x2a25('0xb')](),controller['create']);router[_0x2a25('0xf')](_0x2a25('0x10'),auth['isAuthenticated'](),controller[_0x2a25('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 81b2643..bc05ad4 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 _0x1ef3=['STRING','sequelize','exports','name'];(function(_0x5cb423,_0x1ea49d){var _0x2a4650=function(_0x576f50){while(--_0x576f50){_0x5cb423['push'](_0x5cb423['shift']());}};_0x2a4650(++_0x1ea49d);}(_0x1ef3,0x69));var _0x31ef=function(_0x11ad0e,_0x1d45b2){_0x11ad0e=_0x11ad0e-0x0;var _0x4dfb80=_0x1ef3[_0x11ad0e];return _0x4dfb80;};'use strict';var Sequelize=require(_0x31ef('0x0'));module[_0x31ef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x31ef('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x31ef('0x3')]},'dialPrefix':{'type':Sequelize[_0x31ef('0x3')]}}; \ No newline at end of file +var _0xb079=['name','exports','STRING'];(function(_0x31836e,_0x82a1d){var _0x484f8d=function(_0x51edf8){while(--_0x51edf8){_0x31836e['push'](_0x31836e['shift']());}};_0x484f8d(++_0x82a1d);}(_0xb079,0x1c9));var _0x9b07=function(_0x208950,_0x40b1dd){_0x208950=_0x208950-0x0;var _0xb8ea1e=_0xb079[_0x208950];return _0xb8ea1e;};'use strict';var Sequelize=require('sequelize');module[_0x9b07('0x0')]={'name':{'type':Sequelize[_0x9b07('0x1')],'unique':_0x9b07('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9b07('0x1')]},'dialPrefix':{'type':Sequelize[_0x9b07('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 5b8424e..c0beb44 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 _0x1225=['redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','count','set','json','apply','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','describe','ListId','findOne','Disposition','order','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','keys','CustomFields','format','cf_%d','raw','getContactsCsv','concat','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','TEXT','number','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x41f59e,_0x5e916a){var _0x1d5e3=function(_0x11d7c9){while(--_0x11d7c9){_0x41f59e['push'](_0x41f59e['shift']());}};_0x1d5e3(++_0x5e916a);}(_0x1225,0x77));var _0x5122=function(_0x1d49b5,_0x5b37a1){_0x1d49b5=_0x1d49b5-0x0;var _0x3baca5=_0x1225[_0x1d49b5];return _0x3baca5;};'use strict';var emlformat=require(_0x5122('0x0'));var rimraf=require(_0x5122('0x1'));var zipdir=require(_0x5122('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5122('0x3'));var BPromise=require(_0x5122('0x4'));var Mustache=require('mustache');var util=require(_0x5122('0x5'));var path=require(_0x5122('0x6'));var sox=require(_0x5122('0x7'));var csv=require(_0x5122('0x8'));var ejs=require(_0x5122('0x9'));var fs=require('fs');var fs_extra=require(_0x5122('0xa'));var _=require(_0x5122('0xb'));var squel=require(_0x5122('0xc'));var crypto=require(_0x5122('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5122('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5122('0xf'));var Papa=require(_0x5122('0x10'));var Redis=require(_0x5122('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5122('0x12'));var hardwareService=require(_0x5122('0x13'));var logger=require(_0x5122('0x14'))(_0x5122('0x15'));var utils=require(_0x5122('0x16'));var config=require(_0x5122('0x17'));var licenseUtil=require(_0x5122('0x18'));var db=require('../../mysqldb')['db'];config[_0x5122('0x19')]=_[_0x5122('0x1a')](config[_0x5122('0x19')],{'host':_0x5122('0x1b'),'port':0x18eb});var socket=require(_0x5122('0x1c'))(new Redis(config[_0x5122('0x19')]));require(_0x5122('0x1d'))[_0x5122('0x1e')](socket);function respondWithStatusCode(_0x5508d4,_0x14389e){_0x14389e=_0x14389e||0xcc;return function(_0x5ce85f){if(_0x5ce85f){return _0x5508d4[_0x5122('0x1f')](_0x14389e);}return _0x5508d4[_0x5122('0x20')](_0x14389e)[_0x5122('0x21')]();};}function respondWithResult(_0x1a9858,_0xb672c2){_0xb672c2=_0xb672c2||0xc8;return function(_0x51a62c){if(_0x51a62c){return _0x1a9858[_0x5122('0x20')](_0xb672c2)['json'](_0x51a62c);}};}function respondWithFilteredResult(_0x207789,_0x4c5b9f){return function(_0x30fee5){if(_0x30fee5){var _0x36629d=typeof _0x4c5b9f[_0x5122('0x22')]===_0x5122('0x23')&&typeof _0x4c5b9f['limit']===_0x5122('0x23');var _0x5b5b11=_0x30fee5[_0x5122('0x24')];var _0xb20852=_0x36629d?0x0:_0x4c5b9f[_0x5122('0x22')];var _0x4c744c=_0x36629d?_0x30fee5[_0x5122('0x24')]:_0x4c5b9f[_0x5122('0x22')]+_0x4c5b9f['limit'];var _0x37299c;if(_0x4c744c>=_0x5b5b11){_0x4c744c=_0x5b5b11;_0x37299c=0xc8;}else{_0x37299c=0xce;}_0x207789[_0x5122('0x20')](_0x37299c);return _0x207789[_0x5122('0x25')]('Content-Range',_0xb20852+'-'+_0x4c744c+'/'+_0x5b5b11)[_0x5122('0x26')](_0x30fee5);}return null;};}function patchUpdates(_0x2d2038){return function(_0x14ea44){try{jsonpatch[_0x5122('0x27')](_0x14ea44,_0x2d2038,!![]);}catch(_0x4e3efa){return BPromise['reject'](_0x4e3efa);}return _0x14ea44[_0x5122('0x28')]();};}function saveUpdates(_0x17b6ca,_0x412855){return function(_0x5b1c25){if(_0x5b1c25){return _0x5b1c25[_0x5122('0x29')](_0x17b6ca)[_0x5122('0x2a')](function(_0x5d4be7){return _0x5d4be7;});}return null;};}function removeEntity(_0x5d4e15,_0x18c3f4){return function(_0x308dc4){if(_0x308dc4){return _0x308dc4[_0x5122('0x2b')]()[_0x5122('0x2a')](function(){var _0x2fee83=_0x308dc4[_0x5122('0x2c')]({'plain':!![]});var _0x5d8f8c=_0x5122('0x2d');return db[_0x5122('0x2e')]['destroy']({'where':{'type':_0x5d8f8c,'resourceId':_0x2fee83['id']}})[_0x5122('0x2a')](function(){return _0x308dc4;});})[_0x5122('0x2a')](function(){_0x5d4e15[_0x5122('0x20')](0xcc)[_0x5122('0x21')]();});}};}function handleEntityNotFound(_0x307f4c,_0x37a98d){return function(_0x225f35){if(!_0x225f35){_0x307f4c[_0x5122('0x1f')](0x194);}return _0x225f35;};}function handleError(_0xab0fd2,_0xe8c135){_0xe8c135=_0xe8c135||0x1f4;return function(_0x48d59d){logger[_0x5122('0x2f')](_0x48d59d[_0x5122('0x30')]);if(_0x48d59d[_0x5122('0x31')]){delete _0x48d59d[_0x5122('0x31')];}_0xab0fd2['status'](_0xe8c135)[_0x5122('0x32')](_0x48d59d);};}exports[_0x5122('0x33')]=function(_0x146b33,_0x127061){var _0x25e6a0={},_0x245e65={},_0x30c596={'count':0x0,'rows':[]};var _0x58ea21=_[_0x5122('0x34')](db['CmList'][_0x5122('0x35')],function(_0x1882df){return{'name':_0x1882df['fieldName'],'type':_0x1882df[_0x5122('0x36')][_0x5122('0x37')]};});_0x245e65[_0x5122('0x38')]=_['map'](_0x58ea21,_0x5122('0x31'));_0x245e65[_0x5122('0x39')]=_['keys'](_0x146b33['query']);_0x245e65[_0x5122('0x3a')]=_[_0x5122('0x3b')](_0x245e65[_0x5122('0x38')],_0x245e65['query']);_0x25e6a0[_0x5122('0x3c')]=_['intersection'](_0x245e65['model'],qs[_0x5122('0x3d')](_0x146b33['query'][_0x5122('0x3d')]));_0x25e6a0['attributes']=_0x25e6a0[_0x5122('0x3c')]['length']?_0x25e6a0[_0x5122('0x3c')]:_0x245e65[_0x5122('0x38')];if(!_0x146b33[_0x5122('0x39')][_0x5122('0x3e')](_0x5122('0x3f'))){_0x25e6a0[_0x5122('0x40')]=qs[_0x5122('0x40')](_0x146b33['query'][_0x5122('0x40')]);_0x25e6a0['offset']=qs[_0x5122('0x22')](_0x146b33[_0x5122('0x39')][_0x5122('0x22')]);}_0x25e6a0['order']=qs[_0x5122('0x41')](_0x146b33['query'][_0x5122('0x41')]);_0x25e6a0[_0x5122('0x42')]=qs[_0x5122('0x3a')](_[_0x5122('0x43')](_0x146b33[_0x5122('0x39')],_0x245e65[_0x5122('0x3a')]),_0x58ea21);if(_0x146b33[_0x5122('0x39')][_0x5122('0x44')]){_0x25e6a0[_0x5122('0x42')]=_[_0x5122('0x45')](_0x25e6a0['where'],{'$or':_['map'](_0x58ea21,function(_0x5f27c3){if(_0x5f27c3['type']!==_0x5122('0x46')){var _0x509195={};_0x509195[_0x5f27c3[_0x5122('0x31')]]={'$like':'%'+_0x146b33['query'][_0x5122('0x44')]+'%'};return _0x509195;}})});}_0x25e6a0=_[_0x5122('0x45')]({},_0x25e6a0,_0x146b33[_0x5122('0x47')]);var _0xf99cc5={'where':_0x25e6a0[_0x5122('0x42')]};return db[_0x5122('0x48')]['count'](_0xf99cc5)[_0x5122('0x2a')](function(_0x29b223){_0x30c596['count']=_0x29b223;if(_0x146b33[_0x5122('0x39')][_0x5122('0x49')]){_0x25e6a0[_0x5122('0x4a')]=[{'all':!![]}];}return db[_0x5122('0x48')][_0x5122('0x4b')](_0x25e6a0);})['then'](function(_0x3c461a){_0x30c596[_0x5122('0x4c')]=_0x3c461a;return _0x30c596;})[_0x5122('0x2a')](respondWithFilteredResult(_0x127061,_0x25e6a0))['catch'](handleError(_0x127061,null));};exports[_0x5122('0x4d')]=function(_0x669647,_0x19913d){var _0x5c5dc9={'raw':![],'where':{'id':_0x669647[_0x5122('0x4e')]['id']}},_0x4c5158={};_0x4c5158[_0x5122('0x38')]=_['keys'](db[_0x5122('0x48')][_0x5122('0x35')]);_0x4c5158[_0x5122('0x39')]=_['keys'](_0x669647['query']);_0x4c5158[_0x5122('0x3a')]=_[_0x5122('0x3b')](_0x4c5158['model'],_0x4c5158['query']);_0x5c5dc9[_0x5122('0x3c')]=_[_0x5122('0x3b')](_0x4c5158['model'],qs['fields'](_0x669647['query'][_0x5122('0x3d')]));_0x5c5dc9['attributes']=_0x5c5dc9['attributes'][_0x5122('0x4f')]?_0x5c5dc9[_0x5122('0x3c')]:_0x4c5158[_0x5122('0x38')];if(_0x669647[_0x5122('0x39')]['includeAll']){_0x5c5dc9[_0x5122('0x4a')]=[{'all':!![]}];}_0x5c5dc9=_[_0x5122('0x45')]({},_0x5c5dc9,_0x669647[_0x5122('0x47')]);return db['CmList'][_0x5122('0x50')](_0x5c5dc9)[_0x5122('0x2a')](handleEntityNotFound(_0x19913d,null))['then'](respondWithResult(_0x19913d,null))[_0x5122('0x51')](handleError(_0x19913d,null));};exports[_0x5122('0x52')]=function(_0x162189,_0xd97a59){return db[_0x5122('0x48')][_0x5122('0x52')](_0x162189[_0x5122('0x53')],{})[_0x5122('0x2a')](function(_0x3873e8){var _0x2c9ffd=_0x162189['user'][_0x5122('0x2c')]({'plain':!![]});if(!_0x2c9ffd)throw new Error(_0x5122('0x54'));if(_0x2c9ffd['role']==='user'){var _0x4af681=_0x3873e8[_0x5122('0x2c')]({'plain':!![]});var _0xfa9a8f=_0x5122('0x2d');return db[_0x5122('0x55')]['find']({'where':{'name':_0xfa9a8f,'userProfileId':_0x2c9ffd['userProfileId']},'raw':!![]})[_0x5122('0x2a')](function(_0x3d2112){if(_0x3d2112&&_0x3d2112['autoAssociation']===0x0){return db[_0x5122('0x2e')][_0x5122('0x52')]({'name':_0x4af681[_0x5122('0x31')],'resourceId':_0x4af681['id'],'type':_0x3d2112[_0x5122('0x31')],'sectionId':_0x3d2112['id']},{})[_0x5122('0x2a')](function(){return _0x3873e8;});}else{return _0x3873e8;}})[_0x5122('0x51')](function(_0x5ee78c){logger[_0x5122('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ee78c);throw _0x5ee78c;});}return _0x3873e8;})[_0x5122('0x2a')](respondWithResult(_0xd97a59,0xc9))['catch'](handleError(_0xd97a59,null));};exports[_0x5122('0x29')]=function(_0x2770db,_0x1a1901){if(_0x2770db[_0x5122('0x53')]['id']){delete _0x2770db['body']['id'];}return db[_0x5122('0x48')]['find']({'where':{'id':_0x2770db[_0x5122('0x4e')]['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x1a1901,null))[_0x5122('0x2a')](saveUpdates(_0x2770db[_0x5122('0x53')],null))[_0x5122('0x2a')](respondWithResult(_0x1a1901,null))['catch'](handleError(_0x1a1901,null));};exports[_0x5122('0x2b')]=function(_0x146bc2,_0x2717b0){return db[_0x5122('0x48')][_0x5122('0x50')]({'where':{'id':_0x146bc2[_0x5122('0x4e')]['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x2717b0,null))[_0x5122('0x2a')](removeEntity(_0x2717b0,null))[_0x5122('0x51')](handleError(_0x2717b0,null));};exports[_0x5122('0x56')]=function(_0xfb852a,_0x4e2b4e){return db[_0x5122('0x48')][_0x5122('0x56')]()['then'](respondWithResult(_0x4e2b4e,null))[_0x5122('0x51')](handleError(_0x4e2b4e,null));};exports['addDisposition']=function(_0x3212ba,_0x52963d,_0x13ac86){if(_0x3212ba[_0x5122('0x53')]['id']){delete _0x3212ba[_0x5122('0x53')]['id'];}return db[_0x5122('0x48')][_0x5122('0x50')]({'where':{'id':_0x3212ba[_0x5122('0x4e')]['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x52963d,null))['then'](function(_0x4ad39b){if(_0x4ad39b){_0x3212ba[_0x5122('0x53')][_0x5122('0x57')]=_0x4ad39b['id'];return db['Disposition'][_0x5122('0x52')](_0x3212ba[_0x5122('0x53')]);}})['then'](respondWithResult(_0x52963d,null))['catch'](handleError(_0x52963d,null));};exports['getDispositions']=function(_0x598653,_0x43a9b6,_0x285a4d){var _0x628886={'raw':![],'where':{}};var _0x5905c5={};var _0x52a953={'count':0x0,'rows':[]};return db[_0x5122('0x48')][_0x5122('0x58')]({'where':{'id':_0x598653[_0x5122('0x4e')]['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x43a9b6,null))[_0x5122('0x2a')](function(_0xc62f90){if(_0xc62f90){_0x5905c5['model']=_['keys'](db[_0x5122('0x59')]['rawAttributes']);_0x5905c5[_0x5122('0x39')]=_['keys'](_0x598653[_0x5122('0x39')]);_0x5905c5['filters']=_['intersection'](_0x5905c5[_0x5122('0x38')],_0x5905c5[_0x5122('0x39')]);_0x628886[_0x5122('0x3c')]=_['intersection'](_0x5905c5[_0x5122('0x38')],qs[_0x5122('0x3d')](_0x598653[_0x5122('0x39')][_0x5122('0x3d')]));_0x628886[_0x5122('0x3c')]=_0x628886['attributes'][_0x5122('0x4f')]?_0x628886['attributes']:_0x5905c5[_0x5122('0x38')];if(!_0x598653[_0x5122('0x39')][_0x5122('0x3e')]('nolimit')){_0x628886[_0x5122('0x40')]=qs['limit'](_0x598653[_0x5122('0x39')][_0x5122('0x40')]);_0x628886['offset']=qs[_0x5122('0x22')](_0x598653['query'][_0x5122('0x22')]);}_0x628886[_0x5122('0x5a')]=qs[_0x5122('0x41')](_0x598653[_0x5122('0x39')]['sort']);_0x628886[_0x5122('0x42')]=qs[_0x5122('0x3a')](_[_0x5122('0x43')](_0x598653[_0x5122('0x39')],_0x5905c5[_0x5122('0x3a')]));_0x628886[_0x5122('0x42')][_0x5122('0x57')]=_0xc62f90['id'];if(_0x598653[_0x5122('0x39')][_0x5122('0x44')]){_0x628886[_0x5122('0x42')]=_[_0x5122('0x45')](_0x628886[_0x5122('0x42')],{'$or':_[_0x5122('0x34')](_0x628886[_0x5122('0x3c')],function(_0x1838da){var _0x1e9459={};_0x1e9459[_0x1838da]={'$like':'%'+_0x598653[_0x5122('0x39')]['filter']+'%'};return _0x1e9459;})});}_0x628886=_[_0x5122('0x45')]({},_0x628886,_0x598653[_0x5122('0x47')]);return db['Disposition'][_0x5122('0x24')]({'where':_0x628886['where']})['then'](function(_0x389a24){_0x52a953[_0x5122('0x24')]=_0x389a24;if(_0x598653[_0x5122('0x39')]['includeAll']){_0x628886[_0x5122('0x4a')]=[{'all':!![]}];}return db['Disposition'][_0x5122('0x4b')](_0x628886);})[_0x5122('0x2a')](function(_0x18844){_0x52a953[_0x5122('0x4c')]=_0x18844;return _0x52a953;});}})[_0x5122('0x2a')](respondWithFilteredResult(_0x43a9b6,_0x628886))['catch'](handleError(_0x43a9b6,null));};exports[_0x5122('0x5b')]=function(_0x10c067,_0x1a726d,_0x41e993){return db[_0x5122('0x48')][_0x5122('0x50')]({'where':{'id':_0x10c067[_0x5122('0x4e')]['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x1a726d,null))['then'](function(_0x34028f){if(_0x34028f){return _0x34028f[_0x5122('0x5b')](_0x10c067[_0x5122('0x39')][_0x5122('0x5c')]);}})[_0x5122('0x2a')](respondWithStatusCode(_0x1a726d,null))[_0x5122('0x51')](handleError(_0x1a726d,null));};exports[_0x5122('0x5d')]=function(_0x89a269,_0x3f4ce4,_0x282e4c){return db[_0x5122('0x48')][_0x5122('0x50')]({'where':{'id':_0x89a269['params']['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x3f4ce4,null))[_0x5122('0x2a')](function(_0x14e6af){if(_0x14e6af){var _0x35a656=[];var _0x481242={'success':[],'errors':[]};return db[_0x5122('0x5e')][_0x5122('0x56')]()['then'](function(_0x347760){if(_0x89a269[_0x5122('0x53')]['tags']&&_[_0x5122('0x5f')](_0x89a269[_0x5122('0x53')][_0x5122('0x60')])){if(_0x89a269[_0x5122('0x53')][_0x5122('0x60')][_0x5122('0x4f')]){_0x89a269['body'][_0x5122('0x60')]=_0x89a269[_0x5122('0x53')][_0x5122('0x60')][_0x5122('0x61')](';')+';';}else{_0x89a269[_0x5122('0x53')]['tags']=null;}}else{_0x89a269[_0x5122('0x53')][_0x5122('0x60')]=null;}if(_0x89a269[_0x5122('0x53')]&&_[_0x5122('0x5f')](_0x89a269[_0x5122('0x53')])){for(var _0x2b6438=0x0;_0x2b6438<_0x89a269['body'][_0x5122('0x4f')];_0x2b6438+=0x1){_0x89a269['body'][_0x2b6438][_0x5122('0x57')]=_0x89a269[_0x5122('0x4e')]['id'];_0x35a656['push'](_0x89a269[_0x5122('0x53')][_0x2b6438]);}return BPromise['each'](_0x35a656,function(_0x34a83e){return db[_0x5122('0x5e')][_0x5122('0x52')](_[_0x5122('0x62')](_0x34a83e,[_0x5122('0x5c'),'id'])||{},{'fields':_['keys'](_0x347760),'raw':!![]})[_0x5122('0x2a')](function(_0x3fdb20){_0x481242[_0x5122('0x63')][_0x5122('0x64')](_0x3fdb20[_0x5122('0x65')]);})[_0x5122('0x51')](function(_0x56a1aa){_0x481242[_0x5122('0x66')]['push']({'data':_0x34a83e,'error':_0x56a1aa[_0x5122('0x67')]});});})[_0x5122('0x2a')](function(_0xfa1cbc){return _0x481242;})[_0x5122('0x51')](function(_0x90142d){return _0x90142d;});}else{_0x3f4ce4['status'](0x190)[_0x5122('0x26')]({'message':_0x5122('0x68')});}});}})['then'](respondWithResult(_0x3f4ce4,null))[_0x5122('0x51')](handleError(_0x3f4ce4,null));};exports[_0x5122('0x69')]=function(_0x5caa82,_0x21cce2,_0x18ec51){var _0x532f6d;return db[_0x5122('0x48')][_0x5122('0x50')]({'where':{'id':_0x5caa82[_0x5122('0x4e')]['id']},'include':[{'model':db[_0x5122('0x6a')],'as':'CustomFields'}]})[_0x5122('0x2a')](handleEntityNotFound(_0x21cce2,null))[_0x5122('0x2a')](function(_0x539af5){if(_0x539af5){_0x532f6d=_0x539af5;return db['CmContact']['rawAttributes'];}})[_0x5122('0x2a')](function(_0x2f519c){if(_0x2f519c){var _0x38cf28={};var _0x4a9ed9={};_0x4a9ed9['model']=_['concat'](_[_0x5122('0x6b')](_0x2f519c),_[_0x5122('0x34')](_0x532f6d[_0x5122('0x6c')],function(_0xd8dd39){return util[_0x5122('0x6d')](_0x5122('0x6e'),_0xd8dd39['id']);}));_0x4a9ed9[_0x5122('0x39')]=_[_0x5122('0x6b')](_0x5caa82['query']);_0x4a9ed9[_0x5122('0x3a')]=_[_0x5122('0x3b')](_0x4a9ed9[_0x5122('0x38')],_0x4a9ed9[_0x5122('0x39')]);_0x38cf28['attributes']=_['intersection'](_0x4a9ed9[_0x5122('0x38')],qs['fields'](_0x5caa82[_0x5122('0x39')][_0x5122('0x3d')]));_0x38cf28['attributes']=_0x38cf28[_0x5122('0x3c')][_0x5122('0x4f')]?_0x38cf28['attributes']:_0x4a9ed9[_0x5122('0x38')];if(!_0x5caa82[_0x5122('0x39')][_0x5122('0x3e')]('nolimit')){_0x38cf28[_0x5122('0x40')]=qs[_0x5122('0x40')](_0x5caa82[_0x5122('0x39')][_0x5122('0x40')]);_0x38cf28[_0x5122('0x22')]=qs[_0x5122('0x22')](_0x5caa82['query'][_0x5122('0x22')]);}_0x38cf28[_0x5122('0x5a')]=qs[_0x5122('0x41')](_0x5caa82[_0x5122('0x39')][_0x5122('0x41')]);_0x38cf28[_0x5122('0x42')]=qs['filters'](_['pick'](_0x5caa82[_0x5122('0x39')],_0x4a9ed9[_0x5122('0x3a')]));_0x38cf28[_0x5122('0x6f')]=!![];if(_0x5caa82['query'][_0x5122('0x44')]){_0x38cf28[_0x5122('0x42')]=_[_0x5122('0x45')](_0x38cf28[_0x5122('0x42')],{'$or':_[_0x5122('0x34')](_0x38cf28[_0x5122('0x3c')],function(_0x48550d){var _0x3af1cb={};_0x3af1cb[_0x48550d]={'$like':'%'+_0x5caa82[_0x5122('0x39')][_0x5122('0x44')]+'%'};return _0x3af1cb;})});}_0x38cf28=_['merge']({},_0x38cf28,_0x5caa82[_0x5122('0x47')]);return _0x532f6d[_0x5122('0x69')](_0x38cf28);}})[_0x5122('0x2a')](respondWithResult(_0x21cce2,null))[_0x5122('0x51')](handleError(_0x21cce2,null));};exports[_0x5122('0x70')]=function(_0x42b50d,_0x4a8e84,_0xd40e3){var _0x17faa0;return db[_0x5122('0x48')][_0x5122('0x50')]({'where':{'id':_0x42b50d[_0x5122('0x4e')]['id']},'include':[{'model':db[_0x5122('0x6a')],'as':_0x5122('0x6c')}]})[_0x5122('0x2a')](handleEntityNotFound(_0x4a8e84,null))[_0x5122('0x2a')](function(_0xc806c9){if(_0xc806c9){_0x17faa0=_0xc806c9;return db['CmContact']['rawAttributes'];}})['then'](function(_0x48c8c2){if(_0x48c8c2){var _0x5ddb80={};var _0x31f6e3={};_0x31f6e3[_0x5122('0x38')]=_[_0x5122('0x71')](_[_0x5122('0x6b')](_0x48c8c2),_[_0x5122('0x34')](_0x17faa0[_0x5122('0x6c')],function(_0x1a3eb5){return util[_0x5122('0x6d')](_0x5122('0x6e'),_0x1a3eb5['id']);}));_0x31f6e3['query']=_['keys'](_0x42b50d[_0x5122('0x39')]);_0x31f6e3[_0x5122('0x3a')]=_[_0x5122('0x3b')](_0x31f6e3[_0x5122('0x38')],_0x31f6e3[_0x5122('0x39')]);_0x5ddb80['attributes']=_[_0x5122('0x3b')](_0x31f6e3[_0x5122('0x38')],qs[_0x5122('0x3d')](_0x42b50d[_0x5122('0x39')][_0x5122('0x3d')]));_0x5ddb80[_0x5122('0x3c')]=_0x5ddb80['attributes'][_0x5122('0x4f')]?_0x5ddb80['attributes']:_0x31f6e3[_0x5122('0x38')];if(!_0x42b50d[_0x5122('0x39')][_0x5122('0x3e')](_0x5122('0x3f'))){_0x5ddb80[_0x5122('0x40')]=qs[_0x5122('0x40')](_0x42b50d[_0x5122('0x39')]['limit']);_0x5ddb80[_0x5122('0x22')]=qs[_0x5122('0x22')](_0x42b50d[_0x5122('0x39')][_0x5122('0x22')]);}_0x5ddb80[_0x5122('0x5a')]=qs['sort'](_0x42b50d[_0x5122('0x39')]['sort']);_0x5ddb80['where']=qs[_0x5122('0x3a')](_[_0x5122('0x43')](_0x42b50d[_0x5122('0x39')],_0x31f6e3[_0x5122('0x3a')]));_0x5ddb80[_0x5122('0x6f')]=!![];if(_0x42b50d[_0x5122('0x39')][_0x5122('0x44')]){_0x5ddb80[_0x5122('0x42')]=_[_0x5122('0x45')](_0x5ddb80[_0x5122('0x42')],{'$or':_[_0x5122('0x34')](_0x5ddb80[_0x5122('0x3c')],function(_0x298365){var _0x5a1295={};_0x5a1295[_0x298365]={'$like':'%'+_0x42b50d[_0x5122('0x39')][_0x5122('0x44')]+'%'};return _0x5a1295;})});}_0x5ddb80=_['merge']({},_0x5ddb80,_0x42b50d[_0x5122('0x47')]);return _0x17faa0[_0x5122('0x69')](_0x5ddb80);}})[_0x5122('0x2a')](function(_0x589488){if(!_[_0x5122('0x72')](_0x589488)){var _0x9adbd3=toCsv(_0x589488);var _0x34c132=Date[_0x5122('0x73')]();fs[_0x5122('0x74')](util[_0x5122('0x6d')](_0x5122('0x75'),_0x17faa0['id'],_0x34c132),_0x9adbd3);_0x4a8e84['setHeader'](_0x5122('0x76'),_0x5122('0x77')+util[_0x5122('0x6d')]('list_%d_%s.csv',_0x17faa0['id'],_0x34c132));_0x4a8e84['setHeader'](_0x5122('0x78'),_0x5122('0x79'));return _0x4a8e84[_0x5122('0x7a')](util[_0x5122('0x6d')](_0x5122('0x75'),_0x17faa0['id'],_0x34c132));}else{return _0x4a8e84[_0x5122('0x1f')](0xcc);}})[_0x5122('0x51')](handleError(_0x4a8e84,null));};exports[_0x5122('0x7b')]=function(_0x863e67,_0x223797,_0x2eddc0){var _0x5ade44;delete _0x863e67[_0x5122('0x53')]['id'];return db[_0x5122('0x48')]['findOne']({'where':{'id':_0x863e67[_0x5122('0x4e')]['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x223797,null))['then'](function(_0xd0cdd4){if(_0xd0cdd4){return db[_0x5122('0x7c')][_0x5122('0x7d')](function(_0x2f8a5a){return db['CmCustomField'][_0x5122('0x52')](_0x863e67['body'],{'transaction':_0x2f8a5a})[_0x5122('0x2a')](function(_0x3eab18){_0x5ade44=_0x3eab18;return _0xd0cdd4['addCustomFields'](_0x3eab18,{'transaction':_0x2f8a5a});})['then'](function(){var _0x51263f={'type':db[_0x5122('0x7e')][_0x5122('0x7f')],'transaction':_0x2f8a5a};switch(_0x863e67[_0x5122('0x53')][_0x5122('0x36')]){case'text':_0x51263f['type']=db[_0x5122('0x7e')]['TEXT'];break;case _0x5122('0x80'):_0x51263f[_0x5122('0x36')]=db[_0x5122('0x7e')][_0x5122('0x81')];break;case'switch':_0x51263f['type']=db[_0x5122('0x7e')]['BOOLEAN'];_0x51263f[_0x5122('0x82')]=![];break;default:}return db[_0x5122('0x7c')][_0x5122('0x83')][_0x5122('0x84')](_0x5122('0x85'),util['format'](_0x5122('0x86'),_0x5ade44['id']),_0x51263f);})[_0x5122('0x2a')](function(){return _0x5ade44;});});}})[_0x5122('0x2a')](respondWithResult(_0x223797,null))[_0x5122('0x51')](handleError(_0x223797,null));};exports[_0x5122('0x87')]=function(_0x1af1fe,_0x465bf2,_0x422db1){var _0x5c2804={};var _0x61eb81={};var _0x144ecc;var _0xa8330c;return db['CmList'][_0x5122('0x58')]({'where':{'id':_0x1af1fe[_0x5122('0x4e')]['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x465bf2,null))[_0x5122('0x2a')](function(_0x5d87f4){if(_0x5d87f4){_0x144ecc=_0x5d87f4;_0x61eb81[_0x5122('0x38')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x61eb81[_0x5122('0x39')]=_[_0x5122('0x6b')](_0x1af1fe[_0x5122('0x39')]);_0x61eb81[_0x5122('0x3a')]=_[_0x5122('0x3b')](_0x61eb81['model'],_0x61eb81['query']);_0x5c2804[_0x5122('0x3c')]=_['intersection'](_0x61eb81['model'],qs['fields'](_0x1af1fe[_0x5122('0x39')][_0x5122('0x3d')]));_0x5c2804['attributes']=_0x5c2804[_0x5122('0x3c')][_0x5122('0x4f')]?_0x5c2804[_0x5122('0x3c')]:_0x61eb81[_0x5122('0x38')];_0x5c2804[_0x5122('0x5a')]=qs[_0x5122('0x41')](_0x1af1fe[_0x5122('0x39')]['sort']);_0x5c2804[_0x5122('0x42')]=qs['filters'](_[_0x5122('0x43')](_0x1af1fe[_0x5122('0x39')],_0x61eb81[_0x5122('0x3a')]));_0x5c2804['where']=_[_0x5122('0x45')](_0x5c2804[_0x5122('0x42')],{'$or':[{'ListId':_0x5d87f4['id']},{'ListId':null}]});if(_0x1af1fe[_0x5122('0x39')][_0x5122('0x44')]){_0x5c2804['where']=_[_0x5122('0x45')](_0x5c2804[_0x5122('0x42')],{'$or':_[_0x5122('0x34')](_0x5c2804[_0x5122('0x3c')],function(_0x36deef){var _0x3ed665={};_0x3ed665[_0x36deef]={'$like':'%'+_0x1af1fe[_0x5122('0x39')][_0x5122('0x44')]+'%'};return _0x3ed665;})});}_0x5c2804=_['merge']({},_0x5c2804,_0x1af1fe[_0x5122('0x47')]);return db[_0x5122('0x6a')]['findAndCountAll'](_0x5c2804);}})['then'](respondWithResult(_0x465bf2,null))[_0x5122('0x51')](handleError(_0x465bf2,null));};exports[_0x5122('0x88')]=function(_0x50a632,_0x85a6eb,_0x1a1794){return db[_0x5122('0x48')]['find']({'where':{'id':_0x50a632[_0x5122('0x4e')]['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x85a6eb,null))[_0x5122('0x2a')](function(_0x53f246){if(_0x53f246){return _0x53f246[_0x5122('0x88')](_0x50a632[_0x5122('0x53')][_0x5122('0x5c')],_[_0x5122('0x62')](_0x50a632['body'],[_0x5122('0x5c'),'id'])||{})[_0x5122('0x89')](function(_0x141980){for(var _0x2b9ded=0x0;_0x2b9ded<_0x50a632[_0x5122('0x53')][_0x5122('0x5c')][_0x5122('0x4f')];_0x2b9ded+=0x1){socket[_0x5122('0x8a')](_0x5122('0x8b'),{'UserId':Number(_0x50a632[_0x5122('0x53')][_0x5122('0x5c')][_0x2b9ded]),'CmListId':Number(_0x50a632[_0x5122('0x4e')]['id'])});}return _0x141980;});}})[_0x5122('0x2a')](respondWithResult(_0x85a6eb,null))[_0x5122('0x51')](handleError(_0x85a6eb,null));};exports[_0x5122('0x8c')]=function(_0x8a7c2c,_0x482bac,_0x4b3246){return db[_0x5122('0x48')][_0x5122('0x50')]({'where':{'id':_0x8a7c2c[_0x5122('0x4e')]['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x482bac,null))[_0x5122('0x2a')](function(_0x174b42){if(_0x174b42){return _0x174b42[_0x5122('0x8c')](_0x8a7c2c[_0x5122('0x39')][_0x5122('0x5c')])[_0x5122('0x2a')](function(){if(_[_0x5122('0x5f')](_0x8a7c2c[_0x5122('0x39')][_0x5122('0x5c')])){for(var _0xfe3713=0x0;_0xfe3713<_0x8a7c2c[_0x5122('0x39')]['ids'][_0x5122('0x4f')];_0xfe3713+=0x1){socket[_0x5122('0x8a')](_0x5122('0x8d'),{'UserId':Number(_0x8a7c2c['query'][_0x5122('0x5c')][_0xfe3713]),'CmListId':Number(_0x8a7c2c[_0x5122('0x4e')]['id'])});}}else{socket[_0x5122('0x8a')](_0x5122('0x8d'),{'UserId':Number(_0x8a7c2c['query'][_0x5122('0x5c')]),'CmListId':Number(_0x8a7c2c['params']['id'])});}});}})[_0x5122('0x2a')](respondWithStatusCode(_0x482bac,null))[_0x5122('0x51')](handleError(_0x482bac,null));};exports[_0x5122('0x8e')]=function(_0x22d5ee,_0x4562be,_0x3b4338){var _0x1ac99b={};var _0x4451d6={};var _0xbc855;var _0x32b01e;return db['CmList']['findOne']({'where':{'id':_0x22d5ee['params']['id']}})[_0x5122('0x2a')](handleEntityNotFound(_0x4562be,null))[_0x5122('0x2a')](function(_0x2d78ef){if(_0x2d78ef){_0xbc855=_0x2d78ef;_0x4451d6[_0x5122('0x38')]=_[_0x5122('0x6b')](db[_0x5122('0x8f')][_0x5122('0x35')]);_0x4451d6[_0x5122('0x39')]=_['keys'](_0x22d5ee['query']);_0x4451d6['filters']=_[_0x5122('0x3b')](_0x4451d6[_0x5122('0x38')],_0x4451d6[_0x5122('0x39')]);_0x1ac99b[_0x5122('0x3c')]=_[_0x5122('0x3b')](_0x4451d6[_0x5122('0x38')],qs[_0x5122('0x3d')](_0x22d5ee['query'][_0x5122('0x3d')]));_0x1ac99b[_0x5122('0x3c')]=_0x1ac99b[_0x5122('0x3c')][_0x5122('0x4f')]?_0x1ac99b[_0x5122('0x3c')]:_0x4451d6[_0x5122('0x38')];_0x1ac99b['order']=qs[_0x5122('0x41')](_0x22d5ee[_0x5122('0x39')][_0x5122('0x41')]);_0x1ac99b[_0x5122('0x42')]=qs[_0x5122('0x3a')](_[_0x5122('0x43')](_0x22d5ee[_0x5122('0x39')],_0x4451d6[_0x5122('0x3a')]));if(_0x22d5ee[_0x5122('0x39')][_0x5122('0x44')]){_0x1ac99b[_0x5122('0x42')]=_[_0x5122('0x45')](_0x1ac99b['where'],{'$or':_[_0x5122('0x34')](_0x1ac99b[_0x5122('0x3c')],function(_0x26229c){var _0x2e3530={};_0x2e3530[_0x26229c]={'$like':'%'+_0x22d5ee['query']['filter']+'%'};return _0x2e3530;})});}_0x1ac99b=_[_0x5122('0x45')]({},_0x1ac99b,_0x22d5ee['options']);return _0xbc855[_0x5122('0x8e')](_0x1ac99b);}})[_0x5122('0x2a')](function(_0xc5092a){if(_0xc5092a){_0x32b01e=_0xc5092a[_0x5122('0x4f')];if(!_0x22d5ee['query']['hasOwnProperty']('nolimit')){_0x1ac99b[_0x5122('0x40')]=qs[_0x5122('0x40')](_0x22d5ee[_0x5122('0x39')][_0x5122('0x40')]);_0x1ac99b[_0x5122('0x22')]=qs[_0x5122('0x22')](_0x22d5ee['query'][_0x5122('0x22')]);}return _0xbc855[_0x5122('0x8e')](_0x1ac99b);}})[_0x5122('0x2a')](function(_0x22be37){if(_0x22be37){return _0x22be37?{'count':_0x32b01e,'rows':_0x22be37}:null;}})['then'](respondWithResult(_0x4562be,null))[_0x5122('0x51')](handleError(_0x4562be,null));}; \ No newline at end of file +var _0x4919=['describe','ListId','Disposition','getDispositions','findOne','removeDispositions','CmContact','tags','isArray','join','push','ids','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','format','cf_%d','getContactsCsv','concat','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sequelize','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','removeAgents','emit','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','Lists','UserProfileResource','destroy','error','stack','name','send','CmList','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find'];(function(_0x109d91,_0x37b324){var _0x4fd53d=function(_0xf74bd6){while(--_0xf74bd6){_0x109d91['push'](_0x109d91['shift']());}};_0x4fd53d(++_0x37b324);}(_0x4919,0xc8));var _0x9491=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x4919[_0x3c8e9a];return _0x2d4c57;};'use strict';var emlformat=require(_0x9491('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9491('0x1'));var jsonpatch=require(_0x9491('0x2'));var rp=require(_0x9491('0x3'));var moment=require(_0x9491('0x4'));var BPromise=require(_0x9491('0x5'));var Mustache=require(_0x9491('0x6'));var util=require(_0x9491('0x7'));var path=require(_0x9491('0x8'));var sox=require('sox');var csv=require(_0x9491('0x9'));var ejs=require(_0x9491('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9491('0xb'));var squel=require('squel');var crypto=require(_0x9491('0xc'));var jsforce=require(_0x9491('0xd'));var deskjs=require(_0x9491('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9491('0xf'));var Papa=require(_0x9491('0x10'));var Redis=require('ioredis');var authService=require(_0x9491('0x11'));var qs=require(_0x9491('0x12'));var as=require(_0x9491('0x13'));var hardwareService=require(_0x9491('0x14'));var logger=require('../../config/logger')(_0x9491('0x15'));var utils=require(_0x9491('0x16'));var config=require(_0x9491('0x17'));var licenseUtil=require(_0x9491('0x18'));var db=require(_0x9491('0x19'))['db'];config[_0x9491('0x1a')]=_[_0x9491('0x1b')](config[_0x9491('0x1a')],{'host':_0x9491('0x1c'),'port':0x18eb});var socket=require(_0x9491('0x1d'))(new Redis(config[_0x9491('0x1a')]));require('./cmList.socket')[_0x9491('0x1e')](socket);function respondWithStatusCode(_0x1f8714,_0x5b11cd){_0x5b11cd=_0x5b11cd||0xcc;return function(_0x193229){if(_0x193229){return _0x1f8714[_0x9491('0x1f')](_0x5b11cd);}return _0x1f8714[_0x9491('0x20')](_0x5b11cd)[_0x9491('0x21')]();};}function respondWithResult(_0x2fa30e,_0x2da891){_0x2da891=_0x2da891||0xc8;return function(_0x3ef0da){if(_0x3ef0da){return _0x2fa30e[_0x9491('0x20')](_0x2da891)[_0x9491('0x22')](_0x3ef0da);}};}function respondWithFilteredResult(_0xa024f7,_0x5e52ae){return function(_0x5d3e08){if(_0x5d3e08){var _0x9378ce=typeof _0x5e52ae[_0x9491('0x23')]==='undefined'&&typeof _0x5e52ae['limit']===_0x9491('0x24');var _0x1f5cd1=_0x5d3e08[_0x9491('0x25')];var _0x97b8c2=_0x9378ce?0x0:_0x5e52ae[_0x9491('0x23')];var _0x163c2a=_0x9378ce?_0x5d3e08[_0x9491('0x25')]:_0x5e52ae[_0x9491('0x23')]+_0x5e52ae[_0x9491('0x26')];var _0x4f2f1f;if(_0x163c2a>=_0x1f5cd1){_0x163c2a=_0x1f5cd1;_0x4f2f1f=0xc8;}else{_0x4f2f1f=0xce;}_0xa024f7[_0x9491('0x20')](_0x4f2f1f);return _0xa024f7[_0x9491('0x27')](_0x9491('0x28'),_0x97b8c2+'-'+_0x163c2a+'/'+_0x1f5cd1)['json'](_0x5d3e08);}return null;};}function patchUpdates(_0x5627cf){return function(_0x53a4d2){try{jsonpatch[_0x9491('0x29')](_0x53a4d2,_0x5627cf,!![]);}catch(_0x53fe71){return BPromise[_0x9491('0x2a')](_0x53fe71);}return _0x53a4d2[_0x9491('0x2b')]();};}function saveUpdates(_0x56f7ed,_0x5ad2bf){return function(_0x486ce4){if(_0x486ce4){return _0x486ce4['update'](_0x56f7ed)[_0x9491('0x2c')](function(_0x4ed6c5){return _0x4ed6c5;});}return null;};}function removeEntity(_0x251639,_0x4b7f0e){return function(_0x33c8c5){if(_0x33c8c5){return _0x33c8c5['destroy']()[_0x9491('0x2c')](function(){var _0x37dc36=_0x33c8c5['get']({'plain':!![]});var _0x3b960c=_0x9491('0x2d');return db[_0x9491('0x2e')][_0x9491('0x2f')]({'where':{'type':_0x3b960c,'resourceId':_0x37dc36['id']}})[_0x9491('0x2c')](function(){return _0x33c8c5;});})[_0x9491('0x2c')](function(){_0x251639[_0x9491('0x20')](0xcc)[_0x9491('0x21')]();});}};}function handleEntityNotFound(_0x305350,_0x2714e3){return function(_0x4d1ece){if(!_0x4d1ece){_0x305350[_0x9491('0x1f')](0x194);}return _0x4d1ece;};}function handleError(_0x34d180,_0x1726c5){_0x1726c5=_0x1726c5||0x1f4;return function(_0x381b11){logger[_0x9491('0x30')](_0x381b11[_0x9491('0x31')]);if(_0x381b11[_0x9491('0x32')]){delete _0x381b11[_0x9491('0x32')];}_0x34d180[_0x9491('0x20')](_0x1726c5)[_0x9491('0x33')](_0x381b11);};}exports['index']=function(_0x2f754a,_0x5eea8c){var _0x2d9436={},_0xcb7958={},_0x21c183={'count':0x0,'rows':[]};var _0x4c8bb0=_['map'](db[_0x9491('0x34')][_0x9491('0x35')],function(_0x2e008c){return{'name':_0x2e008c[_0x9491('0x36')],'type':_0x2e008c[_0x9491('0x37')][_0x9491('0x38')]};});_0xcb7958[_0x9491('0x39')]=_[_0x9491('0x3a')](_0x4c8bb0,_0x9491('0x32'));_0xcb7958[_0x9491('0x3b')]=_['keys'](_0x2f754a[_0x9491('0x3b')]);_0xcb7958['filters']=_[_0x9491('0x3c')](_0xcb7958['model'],_0xcb7958[_0x9491('0x3b')]);_0x2d9436['attributes']=_['intersection'](_0xcb7958[_0x9491('0x39')],qs['fields'](_0x2f754a['query'][_0x9491('0x3d')]));_0x2d9436[_0x9491('0x3e')]=_0x2d9436[_0x9491('0x3e')]['length']?_0x2d9436[_0x9491('0x3e')]:_0xcb7958['model'];if(!_0x2f754a['query'][_0x9491('0x3f')](_0x9491('0x40'))){_0x2d9436[_0x9491('0x26')]=qs[_0x9491('0x26')](_0x2f754a['query'][_0x9491('0x26')]);_0x2d9436['offset']=qs[_0x9491('0x23')](_0x2f754a[_0x9491('0x3b')][_0x9491('0x23')]);}_0x2d9436[_0x9491('0x41')]=qs[_0x9491('0x42')](_0x2f754a[_0x9491('0x3b')]['sort']);_0x2d9436[_0x9491('0x43')]=qs[_0x9491('0x44')](_[_0x9491('0x45')](_0x2f754a[_0x9491('0x3b')],_0xcb7958[_0x9491('0x44')]),_0x4c8bb0);if(_0x2f754a['query'][_0x9491('0x46')]){_0x2d9436['where']=_[_0x9491('0x47')](_0x2d9436[_0x9491('0x43')],{'$or':_['map'](_0x4c8bb0,function(_0x2bbf6e){if(_0x2bbf6e[_0x9491('0x37')]!==_0x9491('0x48')){var _0x109290={};_0x109290[_0x2bbf6e['name']]={'$like':'%'+_0x2f754a['query']['filter']+'%'};return _0x109290;}})});}_0x2d9436=_[_0x9491('0x47')]({},_0x2d9436,_0x2f754a[_0x9491('0x49')]);var _0x4919dc={'where':_0x2d9436['where']};return db[_0x9491('0x34')]['count'](_0x4919dc)[_0x9491('0x2c')](function(_0x1aa77d){_0x21c183[_0x9491('0x25')]=_0x1aa77d;if(_0x2f754a['query'][_0x9491('0x4a')]){_0x2d9436[_0x9491('0x4b')]=[{'all':!![]}];}return db[_0x9491('0x34')][_0x9491('0x4c')](_0x2d9436);})['then'](function(_0x3e6135){_0x21c183[_0x9491('0x4d')]=_0x3e6135;return _0x21c183;})['then'](respondWithFilteredResult(_0x5eea8c,_0x2d9436))[_0x9491('0x4e')](handleError(_0x5eea8c,null));};exports[_0x9491('0x4f')]=function(_0x24bd82,_0x3fd10a){var _0x538981={'raw':![],'where':{'id':_0x24bd82[_0x9491('0x50')]['id']}},_0x4d76f2={};_0x4d76f2['model']=_['keys'](db[_0x9491('0x34')]['rawAttributes']);_0x4d76f2[_0x9491('0x3b')]=_[_0x9491('0x51')](_0x24bd82[_0x9491('0x3b')]);_0x4d76f2[_0x9491('0x44')]=_[_0x9491('0x3c')](_0x4d76f2[_0x9491('0x39')],_0x4d76f2[_0x9491('0x3b')]);_0x538981[_0x9491('0x3e')]=_[_0x9491('0x3c')](_0x4d76f2[_0x9491('0x39')],qs[_0x9491('0x3d')](_0x24bd82[_0x9491('0x3b')][_0x9491('0x3d')]));_0x538981[_0x9491('0x3e')]=_0x538981[_0x9491('0x3e')][_0x9491('0x52')]?_0x538981[_0x9491('0x3e')]:_0x4d76f2[_0x9491('0x39')];if(_0x24bd82[_0x9491('0x3b')]['includeAll']){_0x538981['include']=[{'all':!![]}];}_0x538981=_[_0x9491('0x47')]({},_0x538981,_0x24bd82[_0x9491('0x49')]);return db['CmList']['find'](_0x538981)['then'](handleEntityNotFound(_0x3fd10a,null))['then'](respondWithResult(_0x3fd10a,null))[_0x9491('0x4e')](handleError(_0x3fd10a,null));};exports['create']=function(_0x4d1571,_0x430962){return db[_0x9491('0x34')]['create'](_0x4d1571[_0x9491('0x53')],{})[_0x9491('0x2c')](function(_0x147b66){var _0x22d12a=_0x4d1571[_0x9491('0x54')][_0x9491('0x55')]({'plain':!![]});if(!_0x22d12a)throw new Error(_0x9491('0x56'));if(_0x22d12a[_0x9491('0x57')]===_0x9491('0x54')){var _0x411f14=_0x147b66[_0x9491('0x55')]({'plain':!![]});var _0x5d5504='Lists';return db[_0x9491('0x58')]['find']({'where':{'name':_0x5d5504,'userProfileId':_0x22d12a['userProfileId']},'raw':!![]})[_0x9491('0x2c')](function(_0x553c93){if(_0x553c93&&_0x553c93[_0x9491('0x59')]===0x0){return db['UserProfileResource'][_0x9491('0x5a')]({'name':_0x411f14[_0x9491('0x32')],'resourceId':_0x411f14['id'],'type':_0x553c93[_0x9491('0x32')],'sectionId':_0x553c93['id']},{})['then'](function(){return _0x147b66;});}else{return _0x147b66;}})[_0x9491('0x4e')](function(_0x108157){logger[_0x9491('0x30')](_0x9491('0x5b'),_0x108157);throw _0x108157;});}return _0x147b66;})[_0x9491('0x2c')](respondWithResult(_0x430962,0xc9))[_0x9491('0x4e')](handleError(_0x430962,null));};exports[_0x9491('0x5c')]=function(_0x519a43,_0x334df1){if(_0x519a43['body']['id']){delete _0x519a43['body']['id'];}return db[_0x9491('0x34')][_0x9491('0x5d')]({'where':{'id':_0x519a43[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x334df1,null))[_0x9491('0x2c')](saveUpdates(_0x519a43['body'],null))[_0x9491('0x2c')](respondWithResult(_0x334df1,null))[_0x9491('0x4e')](handleError(_0x334df1,null));};exports['destroy']=function(_0x105b84,_0x557b0d){return db[_0x9491('0x34')][_0x9491('0x5d')]({'where':{'id':_0x105b84[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x557b0d,null))[_0x9491('0x2c')](removeEntity(_0x557b0d,null))[_0x9491('0x4e')](handleError(_0x557b0d,null));};exports[_0x9491('0x5e')]=function(_0x2f41fc,_0x570b66){return db[_0x9491('0x34')][_0x9491('0x5e')]()[_0x9491('0x2c')](respondWithResult(_0x570b66,null))['catch'](handleError(_0x570b66,null));};exports['addDisposition']=function(_0x4994cb,_0x35af62,_0x482b3a){if(_0x4994cb[_0x9491('0x53')]['id']){delete _0x4994cb['body']['id'];}return db[_0x9491('0x34')][_0x9491('0x5d')]({'where':{'id':_0x4994cb[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x35af62,null))[_0x9491('0x2c')](function(_0x31c1ad){if(_0x31c1ad){_0x4994cb[_0x9491('0x53')][_0x9491('0x5f')]=_0x31c1ad['id'];return db[_0x9491('0x60')][_0x9491('0x5a')](_0x4994cb[_0x9491('0x53')]);}})[_0x9491('0x2c')](respondWithResult(_0x35af62,null))['catch'](handleError(_0x35af62,null));};exports[_0x9491('0x61')]=function(_0x1037e3,_0x395583,_0x187143){var _0xb0c0b7={'raw':![],'where':{}};var _0x3f40bb={};var _0x50ff1d={'count':0x0,'rows':[]};return db[_0x9491('0x34')][_0x9491('0x62')]({'where':{'id':_0x1037e3[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x395583,null))['then'](function(_0x328cdb){if(_0x328cdb){_0x3f40bb[_0x9491('0x39')]=_[_0x9491('0x51')](db['Disposition'][_0x9491('0x35')]);_0x3f40bb['query']=_[_0x9491('0x51')](_0x1037e3['query']);_0x3f40bb['filters']=_['intersection'](_0x3f40bb[_0x9491('0x39')],_0x3f40bb[_0x9491('0x3b')]);_0xb0c0b7[_0x9491('0x3e')]=_[_0x9491('0x3c')](_0x3f40bb[_0x9491('0x39')],qs[_0x9491('0x3d')](_0x1037e3[_0x9491('0x3b')]['fields']));_0xb0c0b7['attributes']=_0xb0c0b7[_0x9491('0x3e')][_0x9491('0x52')]?_0xb0c0b7[_0x9491('0x3e')]:_0x3f40bb[_0x9491('0x39')];if(!_0x1037e3[_0x9491('0x3b')][_0x9491('0x3f')](_0x9491('0x40'))){_0xb0c0b7['limit']=qs[_0x9491('0x26')](_0x1037e3['query']['limit']);_0xb0c0b7['offset']=qs['offset'](_0x1037e3[_0x9491('0x3b')][_0x9491('0x23')]);}_0xb0c0b7[_0x9491('0x41')]=qs[_0x9491('0x42')](_0x1037e3[_0x9491('0x3b')][_0x9491('0x42')]);_0xb0c0b7['where']=qs['filters'](_[_0x9491('0x45')](_0x1037e3[_0x9491('0x3b')],_0x3f40bb[_0x9491('0x44')]));_0xb0c0b7[_0x9491('0x43')][_0x9491('0x5f')]=_0x328cdb['id'];if(_0x1037e3[_0x9491('0x3b')][_0x9491('0x46')]){_0xb0c0b7[_0x9491('0x43')]=_[_0x9491('0x47')](_0xb0c0b7['where'],{'$or':_['map'](_0xb0c0b7['attributes'],function(_0x5c9611){var _0x2f7d39={};_0x2f7d39[_0x5c9611]={'$like':'%'+_0x1037e3[_0x9491('0x3b')]['filter']+'%'};return _0x2f7d39;})});}_0xb0c0b7=_['merge']({},_0xb0c0b7,_0x1037e3[_0x9491('0x49')]);return db[_0x9491('0x60')]['count']({'where':_0xb0c0b7['where']})[_0x9491('0x2c')](function(_0x5b7809){_0x50ff1d['count']=_0x5b7809;if(_0x1037e3[_0x9491('0x3b')][_0x9491('0x4a')]){_0xb0c0b7[_0x9491('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0x9491('0x4c')](_0xb0c0b7);})[_0x9491('0x2c')](function(_0x106adf){_0x50ff1d[_0x9491('0x4d')]=_0x106adf;return _0x50ff1d;});}})[_0x9491('0x2c')](respondWithFilteredResult(_0x395583,_0xb0c0b7))[_0x9491('0x4e')](handleError(_0x395583,null));};exports[_0x9491('0x63')]=function(_0x4dd091,_0x5d5658,_0x57b956){return db[_0x9491('0x34')][_0x9491('0x5d')]({'where':{'id':_0x4dd091[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x5d5658,null))['then'](function(_0x38691b){if(_0x38691b){return _0x38691b[_0x9491('0x63')](_0x4dd091[_0x9491('0x3b')]['ids']);}})['then'](respondWithStatusCode(_0x5d5658,null))[_0x9491('0x4e')](handleError(_0x5d5658,null));};exports['addContacts']=function(_0x55ff38,_0x38e958,_0x818581){return db[_0x9491('0x34')][_0x9491('0x5d')]({'where':{'id':_0x55ff38[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x38e958,null))[_0x9491('0x2c')](function(_0x2fb35d){if(_0x2fb35d){var _0x340117=[];var _0x50cdb5={'success':[],'errors':[]};return db[_0x9491('0x64')][_0x9491('0x5e')]()[_0x9491('0x2c')](function(_0x505431){if(_0x55ff38[_0x9491('0x53')][_0x9491('0x65')]&&_[_0x9491('0x66')](_0x55ff38[_0x9491('0x53')]['tags'])){if(_0x55ff38[_0x9491('0x53')]['tags']['length']){_0x55ff38[_0x9491('0x53')][_0x9491('0x65')]=_0x55ff38[_0x9491('0x53')][_0x9491('0x65')][_0x9491('0x67')](';')+';';}else{_0x55ff38[_0x9491('0x53')][_0x9491('0x65')]=null;}}else{_0x55ff38[_0x9491('0x53')][_0x9491('0x65')]=null;}if(_0x55ff38[_0x9491('0x53')]&&_[_0x9491('0x66')](_0x55ff38[_0x9491('0x53')])){for(var _0x512167=0x0;_0x512167<_0x55ff38[_0x9491('0x53')]['length'];_0x512167+=0x1){_0x55ff38[_0x9491('0x53')][_0x512167]['ListId']=_0x55ff38[_0x9491('0x50')]['id'];_0x340117[_0x9491('0x68')](_0x55ff38[_0x9491('0x53')][_0x512167]);}return BPromise['each'](_0x340117,function(_0x41f07d){return db[_0x9491('0x64')][_0x9491('0x5a')](_['omit'](_0x41f07d,[_0x9491('0x69'),'id'])||{},{'fields':_[_0x9491('0x51')](_0x505431),'raw':!![]})[_0x9491('0x2c')](function(_0x319bca){_0x50cdb5[_0x9491('0x6a')][_0x9491('0x68')](_0x319bca[_0x9491('0x6b')]);})[_0x9491('0x4e')](function(_0x117385){_0x50cdb5['errors']['push']({'data':_0x41f07d,'error':_0x117385[_0x9491('0x6c')]});});})[_0x9491('0x2c')](function(_0x4aaac9){return _0x50cdb5;})['catch'](function(_0x183bb1){return _0x183bb1;});}else{_0x38e958[_0x9491('0x20')](0x190)[_0x9491('0x22')]({'message':_0x9491('0x6d')});}});}})['then'](respondWithResult(_0x38e958,null))['catch'](handleError(_0x38e958,null));};exports[_0x9491('0x6e')]=function(_0x37cfae,_0x179c6e,_0x58f63b){var _0x4097c8;return db[_0x9491('0x34')][_0x9491('0x5d')]({'where':{'id':_0x37cfae[_0x9491('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x9491('0x6f')}]})[_0x9491('0x2c')](handleEntityNotFound(_0x179c6e,null))[_0x9491('0x2c')](function(_0x1a2ccb){if(_0x1a2ccb){_0x4097c8=_0x1a2ccb;return db[_0x9491('0x64')]['rawAttributes'];}})[_0x9491('0x2c')](function(_0x39ea1f){if(_0x39ea1f){var _0x1b5210={};var _0x43dc8c={};_0x43dc8c[_0x9491('0x39')]=_['concat'](_[_0x9491('0x51')](_0x39ea1f),_[_0x9491('0x3a')](_0x4097c8[_0x9491('0x6f')],function(_0x4b5447){return util[_0x9491('0x70')](_0x9491('0x71'),_0x4b5447['id']);}));_0x43dc8c[_0x9491('0x3b')]=_[_0x9491('0x51')](_0x37cfae[_0x9491('0x3b')]);_0x43dc8c['filters']=_[_0x9491('0x3c')](_0x43dc8c[_0x9491('0x39')],_0x43dc8c[_0x9491('0x3b')]);_0x1b5210['attributes']=_[_0x9491('0x3c')](_0x43dc8c['model'],qs[_0x9491('0x3d')](_0x37cfae[_0x9491('0x3b')][_0x9491('0x3d')]));_0x1b5210[_0x9491('0x3e')]=_0x1b5210['attributes'][_0x9491('0x52')]?_0x1b5210[_0x9491('0x3e')]:_0x43dc8c[_0x9491('0x39')];if(!_0x37cfae[_0x9491('0x3b')][_0x9491('0x3f')](_0x9491('0x40'))){_0x1b5210['limit']=qs['limit'](_0x37cfae['query'][_0x9491('0x26')]);_0x1b5210[_0x9491('0x23')]=qs['offset'](_0x37cfae[_0x9491('0x3b')][_0x9491('0x23')]);}_0x1b5210[_0x9491('0x41')]=qs[_0x9491('0x42')](_0x37cfae['query'][_0x9491('0x42')]);_0x1b5210['where']=qs['filters'](_[_0x9491('0x45')](_0x37cfae[_0x9491('0x3b')],_0x43dc8c[_0x9491('0x44')]));_0x1b5210['raw']=!![];if(_0x37cfae[_0x9491('0x3b')][_0x9491('0x46')]){_0x1b5210[_0x9491('0x43')]=_[_0x9491('0x47')](_0x1b5210[_0x9491('0x43')],{'$or':_['map'](_0x1b5210['attributes'],function(_0x36dbee){var _0x50e96b={};_0x50e96b[_0x36dbee]={'$like':'%'+_0x37cfae[_0x9491('0x3b')][_0x9491('0x46')]+'%'};return _0x50e96b;})});}_0x1b5210=_[_0x9491('0x47')]({},_0x1b5210,_0x37cfae[_0x9491('0x49')]);return _0x4097c8[_0x9491('0x6e')](_0x1b5210);}})[_0x9491('0x2c')](respondWithResult(_0x179c6e,null))['catch'](handleError(_0x179c6e,null));};exports[_0x9491('0x72')]=function(_0x2527b0,_0x3691d7,_0x23d52a){var _0x34271b;return db[_0x9491('0x34')][_0x9491('0x5d')]({'where':{'id':_0x2527b0[_0x9491('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x9491('0x6f')}]})[_0x9491('0x2c')](handleEntityNotFound(_0x3691d7,null))['then'](function(_0x5bd287){if(_0x5bd287){_0x34271b=_0x5bd287;return db[_0x9491('0x64')][_0x9491('0x35')];}})[_0x9491('0x2c')](function(_0x1c228c){if(_0x1c228c){var _0xffc797={};var _0x28431e={};_0x28431e[_0x9491('0x39')]=_[_0x9491('0x73')](_[_0x9491('0x51')](_0x1c228c),_[_0x9491('0x3a')](_0x34271b[_0x9491('0x6f')],function(_0x6e0016){return util[_0x9491('0x70')](_0x9491('0x71'),_0x6e0016['id']);}));_0x28431e[_0x9491('0x3b')]=_[_0x9491('0x51')](_0x2527b0['query']);_0x28431e[_0x9491('0x44')]=_[_0x9491('0x3c')](_0x28431e[_0x9491('0x39')],_0x28431e[_0x9491('0x3b')]);_0xffc797[_0x9491('0x3e')]=_['intersection'](_0x28431e[_0x9491('0x39')],qs[_0x9491('0x3d')](_0x2527b0['query']['fields']));_0xffc797[_0x9491('0x3e')]=_0xffc797[_0x9491('0x3e')][_0x9491('0x52')]?_0xffc797[_0x9491('0x3e')]:_0x28431e[_0x9491('0x39')];if(!_0x2527b0['query'][_0x9491('0x3f')](_0x9491('0x40'))){_0xffc797[_0x9491('0x26')]=qs[_0x9491('0x26')](_0x2527b0[_0x9491('0x3b')][_0x9491('0x26')]);_0xffc797['offset']=qs[_0x9491('0x23')](_0x2527b0['query'][_0x9491('0x23')]);}_0xffc797['order']=qs['sort'](_0x2527b0[_0x9491('0x3b')][_0x9491('0x42')]);_0xffc797[_0x9491('0x43')]=qs['filters'](_[_0x9491('0x45')](_0x2527b0[_0x9491('0x3b')],_0x28431e['filters']));_0xffc797[_0x9491('0x74')]=!![];if(_0x2527b0['query'][_0x9491('0x46')]){_0xffc797[_0x9491('0x43')]=_[_0x9491('0x47')](_0xffc797[_0x9491('0x43')],{'$or':_[_0x9491('0x3a')](_0xffc797[_0x9491('0x3e')],function(_0x3b71fc){var _0x25d83c={};_0x25d83c[_0x3b71fc]={'$like':'%'+_0x2527b0[_0x9491('0x3b')][_0x9491('0x46')]+'%'};return _0x25d83c;})});}_0xffc797=_[_0x9491('0x47')]({},_0xffc797,_0x2527b0[_0x9491('0x49')]);return _0x34271b['getContacts'](_0xffc797);}})[_0x9491('0x2c')](function(_0x8cac90){if(!_[_0x9491('0x75')](_0x8cac90)){var _0x1cb36c=toCsv(_0x8cac90);var _0x2dad95=Date[_0x9491('0x76')]();fs[_0x9491('0x77')](util[_0x9491('0x70')](_0x9491('0x78'),_0x34271b['id'],_0x2dad95),_0x1cb36c);_0x3691d7[_0x9491('0x79')]('Content-disposition',_0x9491('0x7a')+util[_0x9491('0x70')](_0x9491('0x7b'),_0x34271b['id'],_0x2dad95));_0x3691d7[_0x9491('0x79')](_0x9491('0x7c'),'text/csv');return _0x3691d7[_0x9491('0x7d')](util[_0x9491('0x70')](_0x9491('0x78'),_0x34271b['id'],_0x2dad95));}else{return _0x3691d7[_0x9491('0x1f')](0xcc);}})[_0x9491('0x4e')](handleError(_0x3691d7,null));};exports['addCustomField']=function(_0x29aa05,_0x9aefc9,_0x573e8e){var _0x50565b;delete _0x29aa05['body']['id'];return db['CmList'][_0x9491('0x62')]({'where':{'id':_0x29aa05[_0x9491('0x50')]['id']}})['then'](handleEntityNotFound(_0x9aefc9,null))['then'](function(_0x59808d){if(_0x59808d){return db[_0x9491('0x7e')]['transaction'](function(_0x2b1688){return db['CmCustomField']['create'](_0x29aa05[_0x9491('0x53')],{'transaction':_0x2b1688})[_0x9491('0x2c')](function(_0x529774){_0x50565b=_0x529774;return _0x59808d[_0x9491('0x7f')](_0x529774,{'transaction':_0x2b1688});})['then'](function(){var _0x1705cc={'type':db['Sequelize'][_0x9491('0x80')],'transaction':_0x2b1688};switch(_0x29aa05['body'][_0x9491('0x37')]){case _0x9491('0x81'):_0x1705cc[_0x9491('0x37')]=db[_0x9491('0x82')]['TEXT'];break;case _0x9491('0x83'):_0x1705cc['type']=db[_0x9491('0x82')][_0x9491('0x84')];break;case _0x9491('0x85'):_0x1705cc['type']=db[_0x9491('0x82')]['BOOLEAN'];_0x1705cc[_0x9491('0x86')]=![];break;default:}return db[_0x9491('0x7e')][_0x9491('0x87')]['addColumn'](_0x9491('0x88'),util[_0x9491('0x70')](_0x9491('0x89'),_0x50565b['id']),_0x1705cc);})[_0x9491('0x2c')](function(){return _0x50565b;});});}})['then'](respondWithResult(_0x9aefc9,null))[_0x9491('0x4e')](handleError(_0x9aefc9,null));};exports[_0x9491('0x8a')]=function(_0x5a1338,_0x1e9197,_0xce623a){var _0x5b9b04={};var _0x4c3848={};var _0x44f97c;var _0x5740b5;return db[_0x9491('0x34')][_0x9491('0x62')]({'where':{'id':_0x5a1338[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x1e9197,null))[_0x9491('0x2c')](function(_0x148aba){if(_0x148aba){_0x44f97c=_0x148aba;_0x4c3848[_0x9491('0x39')]=_[_0x9491('0x51')](db['CmCustomField'][_0x9491('0x35')]);_0x4c3848['query']=_[_0x9491('0x51')](_0x5a1338[_0x9491('0x3b')]);_0x4c3848[_0x9491('0x44')]=_[_0x9491('0x3c')](_0x4c3848['model'],_0x4c3848['query']);_0x5b9b04[_0x9491('0x3e')]=_[_0x9491('0x3c')](_0x4c3848[_0x9491('0x39')],qs[_0x9491('0x3d')](_0x5a1338[_0x9491('0x3b')]['fields']));_0x5b9b04[_0x9491('0x3e')]=_0x5b9b04[_0x9491('0x3e')][_0x9491('0x52')]?_0x5b9b04[_0x9491('0x3e')]:_0x4c3848['model'];_0x5b9b04[_0x9491('0x41')]=qs['sort'](_0x5a1338[_0x9491('0x3b')][_0x9491('0x42')]);_0x5b9b04['where']=qs[_0x9491('0x44')](_[_0x9491('0x45')](_0x5a1338[_0x9491('0x3b')],_0x4c3848[_0x9491('0x44')]));_0x5b9b04[_0x9491('0x43')]=_[_0x9491('0x47')](_0x5b9b04[_0x9491('0x43')],{'$or':[{'ListId':_0x148aba['id']},{'ListId':null}]});if(_0x5a1338[_0x9491('0x3b')][_0x9491('0x46')]){_0x5b9b04['where']=_[_0x9491('0x47')](_0x5b9b04['where'],{'$or':_[_0x9491('0x3a')](_0x5b9b04[_0x9491('0x3e')],function(_0x345383){var _0x21b85b={};_0x21b85b[_0x345383]={'$like':'%'+_0x5a1338[_0x9491('0x3b')][_0x9491('0x46')]+'%'};return _0x21b85b;})});}_0x5b9b04=_[_0x9491('0x47')]({},_0x5b9b04,_0x5a1338['options']);return db['CmCustomField'][_0x9491('0x8b')](_0x5b9b04);}})[_0x9491('0x2c')](respondWithResult(_0x1e9197,null))[_0x9491('0x4e')](handleError(_0x1e9197,null));};exports[_0x9491('0x8c')]=function(_0x5cdc4f,_0x2fa5d7,_0xb9e964){return db[_0x9491('0x34')]['find']({'where':{'id':_0x5cdc4f[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x2fa5d7,null))[_0x9491('0x2c')](function(_0x3ce05a){if(_0x3ce05a){return _0x3ce05a[_0x9491('0x8c')](_0x5cdc4f[_0x9491('0x53')][_0x9491('0x69')],_[_0x9491('0x8d')](_0x5cdc4f[_0x9491('0x53')],[_0x9491('0x69'),'id'])||{})[_0x9491('0x8e')](function(_0x39d242){for(var _0x101092=0x0;_0x101092<_0x5cdc4f['body'][_0x9491('0x69')][_0x9491('0x52')];_0x101092+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x5cdc4f[_0x9491('0x53')][_0x9491('0x69')][_0x101092]),'CmListId':Number(_0x5cdc4f[_0x9491('0x50')]['id'])});}return _0x39d242;});}})[_0x9491('0x2c')](respondWithResult(_0x2fa5d7,null))[_0x9491('0x4e')](handleError(_0x2fa5d7,null));};exports['removeAgents']=function(_0x50e045,_0x19602e,_0x117648){return db[_0x9491('0x34')][_0x9491('0x5d')]({'where':{'id':_0x50e045[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x19602e,null))['then'](function(_0x356c6b){if(_0x356c6b){return _0x356c6b[_0x9491('0x8f')](_0x50e045[_0x9491('0x3b')]['ids'])['then'](function(){if(_[_0x9491('0x66')](_0x50e045['query'][_0x9491('0x69')])){for(var _0x467ff2=0x0;_0x467ff2<_0x50e045[_0x9491('0x3b')]['ids'][_0x9491('0x52')];_0x467ff2+=0x1){socket[_0x9491('0x90')]('userCmList:remove',{'UserId':Number(_0x50e045[_0x9491('0x3b')][_0x9491('0x69')][_0x467ff2]),'CmListId':Number(_0x50e045[_0x9491('0x50')]['id'])});}}else{socket[_0x9491('0x90')]('userCmList:remove',{'UserId':Number(_0x50e045[_0x9491('0x3b')][_0x9491('0x69')]),'CmListId':Number(_0x50e045[_0x9491('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x19602e,null))[_0x9491('0x4e')](handleError(_0x19602e,null));};exports[_0x9491('0x91')]=function(_0x1553ae,_0x5d4470,_0x4fe69d){var _0x287527={};var _0x319366={};var _0x2599bc;var _0x52ec4c;return db[_0x9491('0x34')][_0x9491('0x62')]({'where':{'id':_0x1553ae[_0x9491('0x50')]['id']}})[_0x9491('0x2c')](handleEntityNotFound(_0x5d4470,null))[_0x9491('0x2c')](function(_0x305a8b){if(_0x305a8b){_0x2599bc=_0x305a8b;_0x319366[_0x9491('0x39')]=_[_0x9491('0x51')](db[_0x9491('0x92')][_0x9491('0x35')]);_0x319366[_0x9491('0x3b')]=_[_0x9491('0x51')](_0x1553ae[_0x9491('0x3b')]);_0x319366[_0x9491('0x44')]=_[_0x9491('0x3c')](_0x319366[_0x9491('0x39')],_0x319366['query']);_0x287527[_0x9491('0x3e')]=_[_0x9491('0x3c')](_0x319366[_0x9491('0x39')],qs[_0x9491('0x3d')](_0x1553ae[_0x9491('0x3b')][_0x9491('0x3d')]));_0x287527[_0x9491('0x3e')]=_0x287527[_0x9491('0x3e')][_0x9491('0x52')]?_0x287527[_0x9491('0x3e')]:_0x319366[_0x9491('0x39')];_0x287527[_0x9491('0x41')]=qs[_0x9491('0x42')](_0x1553ae[_0x9491('0x3b')]['sort']);_0x287527['where']=qs[_0x9491('0x44')](_[_0x9491('0x45')](_0x1553ae[_0x9491('0x3b')],_0x319366[_0x9491('0x44')]));if(_0x1553ae['query'][_0x9491('0x46')]){_0x287527[_0x9491('0x43')]=_[_0x9491('0x47')](_0x287527['where'],{'$or':_['map'](_0x287527[_0x9491('0x3e')],function(_0x51bfb5){var _0x2daaea={};_0x2daaea[_0x51bfb5]={'$like':'%'+_0x1553ae['query']['filter']+'%'};return _0x2daaea;})});}_0x287527=_[_0x9491('0x47')]({},_0x287527,_0x1553ae['options']);return _0x2599bc[_0x9491('0x91')](_0x287527);}})[_0x9491('0x2c')](function(_0x5ce84f){if(_0x5ce84f){_0x52ec4c=_0x5ce84f[_0x9491('0x52')];if(!_0x1553ae[_0x9491('0x3b')]['hasOwnProperty'](_0x9491('0x40'))){_0x287527[_0x9491('0x26')]=qs['limit'](_0x1553ae[_0x9491('0x3b')][_0x9491('0x26')]);_0x287527[_0x9491('0x23')]=qs['offset'](_0x1553ae[_0x9491('0x3b')][_0x9491('0x23')]);}return _0x2599bc[_0x9491('0x91')](_0x287527);}})[_0x9491('0x2c')](function(_0x2cbad1){if(_0x2cbad1){return _0x2cbad1?{'count':_0x52ec4c,'rows':_0x2cbad1}:null;}})[_0x9491('0x2c')](respondWithResult(_0x5d4470,null))['catch'](handleError(_0x5d4470,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0d0d476..63e1cfc 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x1723ef,_0x41c2d9){_0x1723ef=_0x1723ef-0x0;var _0x22be22=_0x3e74[_0x1723ef];return _0x22be22;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0x7217,0x19e));var _0x7721=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x7217[_0x4b7b62];return _0x2280df;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3bbc58b..041d823 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 _0x70e0=['cm_lists','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes'];(function(_0x2c93a2,_0x1c1e3b){var _0x5bde6c=function(_0x227d3b){while(--_0x227d3b){_0x2c93a2['push'](_0x2c93a2['shift']());}};_0x5bde6c(++_0x1c1e3b);}(_0x70e0,0x17b));var _0x070e=function(_0x4ba95c,_0x437e1f){_0x4ba95c=_0x4ba95c-0x0;var _0x3ca2fa=_0x70e0[_0x4ba95c];return _0x3ca2fa;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('CmList',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1f76ec,_0x38b217){var _0x44851e=function(_0x313c54){while(--_0x313c54){_0x1f76ec['push'](_0x1f76ec['shift']());}};_0x44851e(++_0x38b217);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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':'cm_lists','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 ad26c42..9d3f89a 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 _0xe052=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xe052,0x103));var _0x2e05=function(_0x5568c7,_0x347ab8){_0x5568c7=_0x5568c7-0x0;var _0x47fec6=_0xe052[_0x5568c7];return _0x47fec6;};'use strict';var _=require(_0x2e05('0x0'));var util=require('util');var moment=require(_0x2e05('0x1'));var BPromise=require(_0x2e05('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e05('0x3'));var db=require(_0x2e05('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2e05('0x5'));var config=require(_0x2e05('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2e05('0x7')][_0x2e05('0x8')]({'port':0x232a});config[_0x2e05('0x9')]=_['defaults'](config[_0x2e05('0x9')],{'host':_0x2e05('0xa'),'port':0x18eb});var socket=require(_0x2e05('0xb'))(new Redis(config['redis']));require('./cmList.socket')[_0x2e05('0xc')](socket);function respondWithRpcPromise(_0x1c9e9a,_0x561ba2,_0x58f7e0){return new BPromise(function(_0x27c001,_0x5d3495){return client[_0x2e05('0xd')](_0x1c9e9a,_0x58f7e0)[_0x2e05('0xe')](function(_0x110d4f){logger[_0x2e05('0xf')]('CmList,\x20%s,\x20%s',_0x561ba2,_0x2e05('0x10'));logger['debug'](_0x2e05('0x11'),_0x561ba2,_0x2e05('0x10'),JSON['stringify'](_0x110d4f));if(_0x110d4f[_0x2e05('0x12')]){if(_0x110d4f[_0x2e05('0x12')][_0x2e05('0x13')]===0x1f4){logger[_0x2e05('0x12')](_0x2e05('0x14'),_0x561ba2,_0x110d4f[_0x2e05('0x12')][_0x2e05('0x15')]);return _0x5d3495(_0x110d4f['error'][_0x2e05('0x15')]);}logger[_0x2e05('0x12')](_0x2e05('0x14'),_0x561ba2,_0x110d4f[_0x2e05('0x12')]['message']);return _0x27c001(_0x110d4f['error'][_0x2e05('0x15')]);}else{logger[_0x2e05('0xf')](_0x2e05('0x14'),_0x561ba2,'request\x20sent');_0x27c001(_0x110d4f[_0x2e05('0x16')][_0x2e05('0x15')]);}})[_0x2e05('0x17')](function(_0x41a891){logger[_0x2e05('0x12')](_0x2e05('0x14'),_0x561ba2,_0x41a891);_0x5d3495(_0x41a891);});});} \ No newline at end of file +var _0xade8=['error','code','message','catch','lodash','util','moment','randomstring','ioredis','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x88d72b,_0x161055){var _0x15a298=function(_0x2a9b04){while(--_0x2a9b04){_0x88d72b['push'](_0x88d72b['shift']());}};_0x15a298(++_0x161055);}(_0xade8,0x94));var _0x8ade=function(_0x1e2232,_0x397ea8){_0x1e2232=_0x1e2232-0x0;var _0x410968=_0xade8[_0x1e2232];return _0x410968;};'use strict';var _=require(_0x8ade('0x0'));var util=require(_0x8ade('0x1'));var moment=require(_0x8ade('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ade('0x3'));var fs=require('fs');var Redis=require(_0x8ade('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ade('0x5'));var config=require('../../config/environment');var jayson=require(_0x8ade('0x6'));var client=jayson[_0x8ade('0x7')]['http']({'port':0x232a});config[_0x8ade('0x8')]=_['defaults'](config['redis'],{'host':_0x8ade('0x9'),'port':0x18eb});var socket=require(_0x8ade('0xa'))(new Redis(config[_0x8ade('0x8')]));require(_0x8ade('0xb'))[_0x8ade('0xc')](socket);function respondWithRpcPromise(_0x4539b1,_0x332ebd,_0x4d4a3c){return new BPromise(function(_0x52f841,_0x3d33fa){return client['request'](_0x4539b1,_0x4d4a3c)[_0x8ade('0xd')](function(_0x35e22f){logger[_0x8ade('0xe')](_0x8ade('0xf'),_0x332ebd,_0x8ade('0x10'));logger[_0x8ade('0x11')](_0x8ade('0x12'),_0x332ebd,_0x8ade('0x10'),JSON[_0x8ade('0x13')](_0x35e22f));if(_0x35e22f[_0x8ade('0x14')]){if(_0x35e22f[_0x8ade('0x14')][_0x8ade('0x15')]===0x1f4){logger[_0x8ade('0x14')](_0x8ade('0xf'),_0x332ebd,_0x35e22f['error'][_0x8ade('0x16')]);return _0x3d33fa(_0x35e22f['error'][_0x8ade('0x16')]);}logger[_0x8ade('0x14')](_0x8ade('0xf'),_0x332ebd,_0x35e22f[_0x8ade('0x14')][_0x8ade('0x16')]);return _0x52f841(_0x35e22f[_0x8ade('0x14')][_0x8ade('0x16')]);}else{logger[_0x8ade('0xe')]('CmList,\x20%s,\x20%s',_0x332ebd,_0x8ade('0x10'));_0x52f841(_0x35e22f['result'][_0x8ade('0x16')]);}})[_0x8ade('0x17')](function(_0x152276){logger[_0x8ade('0x14')](_0x8ade('0xf'),_0x332ebd,_0x152276);_0x3d33fa(_0x152276);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e783b19..bf3f188 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 _0x36cc=['./cmList.events','save','remove','update','emit','removeListener','register','cmList:'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x36cc,0x78));var _0xc36c=function(_0x488648,_0x545f67){_0x488648=_0x488648-0x0;var _0x18e62b=_0x36cc[_0x488648];return _0x18e62b;};'use strict';var CmListEvents=require(_0xc36c('0x0'));var events=[_0xc36c('0x1'),_0xc36c('0x2'),_0xc36c('0x3')];function createListener(_0x5a699d,_0x539e89){return function(_0x530288){_0x539e89[_0xc36c('0x4')](_0x5a699d,_0x530288);};}function removeListener(_0x364576,_0x2b09d8){return function(){CmListEvents[_0xc36c('0x5')](_0x364576,_0x2b09d8);};}exports[_0xc36c('0x6')]=function(_0x225890){for(var _0x59208a=0x0,_0x1d4481=events['length'];_0x59208a<_0x1d4481;_0x59208a++){var _0x2758b6=events[_0x59208a];var _0x455efc=createListener(_0xc36c('0x7')+_0x2758b6,_0x225890);CmListEvents['on'](_0x2758b6,_0x455efc);}}; \ No newline at end of file +var _0xbeed=['update','emit','register','length','cmList:','./cmList.events','remove'];(function(_0x4d89fd,_0x411fe1){var _0x3262a6=function(_0x2c7505){while(--_0x2c7505){_0x4d89fd['push'](_0x4d89fd['shift']());}};_0x3262a6(++_0x411fe1);}(_0xbeed,0x9f));var _0xdbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeed[_0x2dafbe];return _0x58a45a;};'use strict';var CmListEvents=require(_0xdbee('0x0'));var events=['save',_0xdbee('0x1'),_0xdbee('0x2')];function createListener(_0x53cf23,_0x1f3c51){return function(_0x46e905){_0x1f3c51[_0xdbee('0x3')](_0x53cf23,_0x46e905);};}function removeListener(_0x5798a7,_0x4e1b25){return function(){CmListEvents['removeListener'](_0x5798a7,_0x4e1b25);};}exports[_0xdbee('0x4')]=function(_0x2b408e){for(var _0x42daf1=0x0,_0x3a5944=events[_0xdbee('0x5')];_0x42daf1<_0x3a5944;_0x42daf1++){var _0x139da4=events[_0x42daf1];var _0xdb61e9=createListener(_0xdbee('0x6')+_0x139da4,_0x2b408e);CmListEvents['on'](_0x139da4,_0xdb61e9);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3197e8b..6002ffe 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 _0xbe77=['addCustomField','/:id','update','delete','removeDispositions','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','addDisposition'];(function(_0x4316a8,_0x6d3763){var _0x15642d=function(_0x8f09e1){while(--_0x8f09e1){_0x4316a8['push'](_0x4316a8['shift']());}};_0x15642d(++_0x6d3763);}(_0xbe77,0x16d));var _0x7be7=function(_0x1a1307,_0x27f0e5){_0x1a1307=_0x1a1307-0x0;var _0x5dfc70=_0xbe77[_0x1a1307];return _0x5dfc70;};'use strict';var multer=require(_0x7be7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7be7('0x1'));var express=require(_0x7be7('0x2'));var router=express[_0x7be7('0x3')]();var fs_extra=require(_0x7be7('0x4'));var auth=require(_0x7be7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7be7('0x6'));var controller=require(_0x7be7('0x7'));router[_0x7be7('0x8')]('/',auth[_0x7be7('0x9')](),controller[_0x7be7('0xa')]);router[_0x7be7('0x8')](_0x7be7('0xb'),auth[_0x7be7('0x9')](),controller[_0x7be7('0xc')]);router[_0x7be7('0x8')]('/:id',auth[_0x7be7('0x9')](),controller[_0x7be7('0xd')]);router[_0x7be7('0x8')](_0x7be7('0xe'),auth[_0x7be7('0x9')](),controller[_0x7be7('0xf')]);router[_0x7be7('0x8')](_0x7be7('0x10'),auth[_0x7be7('0x9')](),controller[_0x7be7('0x11')]);router[_0x7be7('0x8')](_0x7be7('0x12'),auth[_0x7be7('0x9')](),controller[_0x7be7('0x13')]);router[_0x7be7('0x8')]('/:id/fields',auth[_0x7be7('0x9')](),controller[_0x7be7('0x14')]);router[_0x7be7('0x8')](_0x7be7('0x15'),auth['isAuthenticated'](),controller[_0x7be7('0x16')]);router[_0x7be7('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7be7('0x17')](_0x7be7('0xe'),auth[_0x7be7('0x9')](),controller[_0x7be7('0x18')]);router[_0x7be7('0x17')](_0x7be7('0x10'),auth[_0x7be7('0x9')](),controller['addContacts']);router[_0x7be7('0x17')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7be7('0x19')]);router['post'](_0x7be7('0x15'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x7be7('0x1a'),auth['isAuthenticated'](),controller[_0x7be7('0x1b')]);router[_0x7be7('0x1c')](_0x7be7('0x1a'),auth['isAuthenticated'](),controller['destroy']);router[_0x7be7('0x1c')](_0x7be7('0xe'),auth[_0x7be7('0x9')](),controller[_0x7be7('0x1d')]);router[_0x7be7('0x1c')](_0x7be7('0x15'),auth[_0x7be7('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x8ce7=['getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','/:id/users','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions'];(function(_0x2236dc,_0x43c7f9){var _0x20583f=function(_0x293e36){while(--_0x293e36){_0x2236dc['push'](_0x2236dc['shift']());}};_0x20583f(++_0x43c7f9);}(_0x8ce7,0xbb));var _0x78ce=function(_0x26bb33,_0x5bfd82){_0x26bb33=_0x26bb33-0x0;var _0x3aae3c=_0x8ce7[_0x26bb33];return _0x3aae3c;};'use strict';var multer=require(_0x78ce('0x0'));var util=require(_0x78ce('0x1'));var path=require(_0x78ce('0x2'));var timeout=require(_0x78ce('0x3'));var express=require(_0x78ce('0x4'));var router=express[_0x78ce('0x5')]();var fs_extra=require(_0x78ce('0x6'));var auth=require(_0x78ce('0x7'));var interaction=require(_0x78ce('0x8'));var config=require('../../config/environment');var controller=require(_0x78ce('0x9'));router[_0x78ce('0xa')]('/',auth[_0x78ce('0xb')](),controller[_0x78ce('0xc')]);router[_0x78ce('0xa')](_0x78ce('0xd'),auth[_0x78ce('0xb')](),controller['describe']);router[_0x78ce('0xa')](_0x78ce('0xe'),auth['isAuthenticated'](),controller[_0x78ce('0xf')]);router['get'](_0x78ce('0x10'),auth[_0x78ce('0xb')](),controller[_0x78ce('0x11')]);router['get'](_0x78ce('0x12'),auth[_0x78ce('0xb')](),controller[_0x78ce('0x13')]);router[_0x78ce('0xa')]('/:id/contacts/csv',auth[_0x78ce('0xb')](),controller[_0x78ce('0x14')]);router[_0x78ce('0xa')](_0x78ce('0x15'),auth['isAuthenticated'](),controller['getCustomFields']);router['get']('/:id/users',auth[_0x78ce('0xb')](),controller[_0x78ce('0x16')]);router[_0x78ce('0x17')]('/',auth[_0x78ce('0xb')](),controller['create']);router['post'](_0x78ce('0x10'),auth['isAuthenticated'](),controller[_0x78ce('0x18')]);router[_0x78ce('0x17')](_0x78ce('0x12'),auth['isAuthenticated'](),controller[_0x78ce('0x19')]);router[_0x78ce('0x17')]('/:id/fields',auth[_0x78ce('0xb')](),controller[_0x78ce('0x1a')]);router[_0x78ce('0x17')]('/:id/users',auth[_0x78ce('0xb')](),controller[_0x78ce('0x1b')]);router[_0x78ce('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x78ce('0x1d')]);router[_0x78ce('0x1e')](_0x78ce('0xe'),auth[_0x78ce('0xb')](),controller[_0x78ce('0x1f')]);router[_0x78ce('0x1e')]('/:id/dispositions',auth[_0x78ce('0xb')](),controller['removeDispositions']);router[_0x78ce('0x1e')](_0x78ce('0x20'),auth[_0x78ce('0xb')](),controller['removeAgents']);module[_0x78ce('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index dd1cca1..0900439 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 _0x64d9=['STRING','sequelize','VIRTUAL','getDataValue','field'];(function(_0x156770,_0x3ecf2e){var _0x36b14a=function(_0x3ad29d){while(--_0x3ad29d){_0x156770['push'](_0x156770['shift']());}};_0x36b14a(++_0x3ecf2e);}(_0x64d9,0x15a));var _0x964d=function(_0x589327,_0x44340c){_0x589327=_0x589327-0x0;var _0x31dec5=_0x64d9[_0x589327];return _0x31dec5;};'use strict';var Sequelize=require(_0x964d('0x0'));module['exports']={'name':{'type':Sequelize[_0x964d('0x1')],'get':function(_0x4afeca){return this[_0x964d('0x2')](_0x964d('0x3'));}},'field':{'type':Sequelize[_0x964d('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x964d('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1af8=['VIRTUAL','getDataValue','field','STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1af8,0xcc));var _0x81af=function(_0x1b939b,_0x5188ac){_0x1b939b=_0x1b939b-0x0;var _0x4f1020=_0x1af8[_0x1b939b];return _0x4f1020;};'use strict';var Sequelize=require('sequelize');module[_0x81af('0x0')]={'name':{'type':Sequelize[_0x81af('0x1')],'get':function(_0x171dce){return this[_0x81af('0x2')](_0x81af('0x3'));}},'field':{'type':Sequelize[_0x81af('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x81af('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 3019f82..8d670fd 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 _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(_0x534102,_0x31cd38){var _0x5034a6=function(_0x51d99c){while(--_0x51d99c){_0x534102['push'](_0x534102['shift']());}};_0x5034a6(++_0x31cd38);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 +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(_0x4c2f42,_0x18bcf8){var _0x3bf57b=function(_0x49f7a7){while(--_0x49f7a7){_0x4c2f42['push'](_0x4c2f42['shift']());}};_0x3bf57b(++_0x18bcf8);}(_0x7a54,0x106));var _0x47a5=function(_0x36bd4a,_0x54c4ee){_0x36bd4a=_0x36bd4a-0x0;var _0x5ba279=_0x7a54[_0x36bd4a];return _0x5ba279;};'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 diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index e0863bc..4170efd 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 _0xcfbf=['exports','define','Condition','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5a579d,_0x216972){var _0x189fa6=function(_0x4900e9){while(--_0x4900e9){_0x5a579d['push'](_0x5a579d['shift']());}};_0x189fa6(++_0x216972);}(_0xcfbf,0x1a5));var _0xfcfb=function(_0x25e510,_0x5745a1){_0x25e510=_0x25e510-0x0;var _0x5baf3d=_0xcfbf[_0x25e510];return _0x5baf3d;};'use strict';var _=require(_0xfcfb('0x0'));var util=require(_0xfcfb('0x1'));var logger=require(_0xfcfb('0x2'))(_0xfcfb('0x3'));var moment=require(_0xfcfb('0x4'));var BPromise=require(_0xfcfb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcfb('0x6'));var rimraf=require(_0xfcfb('0x7'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0xfcfb('0x8')]=function(_0x13dc22,_0x3bf1c0){return _0x13dc22[_0xfcfb('0x9')](_0xfcfb('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ed9=['request-promise','./condition.attributes','define','lodash','../../config/logger','api','moment'];(function(_0x408bb6,_0x51ec4a){var _0x830d87=function(_0x2a0ccd){while(--_0x2a0ccd){_0x408bb6['push'](_0x408bb6['shift']());}};_0x830d87(++_0x51ec4a);}(_0x2ed9,0x129));var _0x92ed=function(_0x5eae14,_0x127218){_0x5eae14=_0x5eae14-0x0;var _0x317a7e=_0x2ed9[_0x5eae14];return _0x317a7e;};'use strict';var _=require(_0x92ed('0x0'));var util=require('util');var logger=require(_0x92ed('0x1'))(_0x92ed('0x2'));var moment=require(_0x92ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x92ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x92ed('0x5'));module['exports']=function(_0x4b96c6,_0x4e8d0b){return _0x4b96c6[_0x92ed('0x6')]('Condition',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 8822342..e96b69b 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 _0xdcd9=['rpc','../../config/environment','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x364406,_0x18bb1d){var _0x13e149=function(_0x1493a9){while(--_0x1493a9){_0x364406['push'](_0x364406['shift']());}};_0x13e149(++_0x18bb1d);}(_0xdcd9,0x71));var _0x9dcd=function(_0x48436e,_0xc5245e){_0x48436e=_0x48436e-0x0;var _0x506633=_0xdcd9[_0x48436e];return _0x506633;};'use strict';var _=require('lodash');var util=require(_0x9dcd('0x0'));var moment=require(_0x9dcd('0x1'));var BPromise=require(_0x9dcd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dcd('0x3'));var db=require(_0x9dcd('0x4'))['db'];var utils=require(_0x9dcd('0x5'));var logger=require(_0x9dcd('0x6'))(_0x9dcd('0x7'));var config=require(_0x9dcd('0x8'));var jayson=require(_0x9dcd('0x9'));var client=jayson[_0x9dcd('0xa')][_0x9dcd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a2c88,_0x34a3e0,_0x529bb7){return new BPromise(function(_0x5c1e27,_0x3fdde8){return client[_0x9dcd('0xc')](_0x2a2c88,_0x529bb7)[_0x9dcd('0xd')](function(_0x30f245){logger['info'](_0x9dcd('0xe'),_0x34a3e0,_0x9dcd('0xf'));logger[_0x9dcd('0x10')](_0x9dcd('0x11'),_0x34a3e0,_0x9dcd('0xf'),JSON[_0x9dcd('0x12')](_0x30f245));if(_0x30f245[_0x9dcd('0x13')]){if(_0x30f245[_0x9dcd('0x13')]['code']===0x1f4){logger[_0x9dcd('0x13')](_0x9dcd('0xe'),_0x34a3e0,_0x30f245[_0x9dcd('0x13')][_0x9dcd('0x14')]);return _0x3fdde8(_0x30f245[_0x9dcd('0x13')][_0x9dcd('0x14')]);}logger[_0x9dcd('0x13')](_0x9dcd('0xe'),_0x34a3e0,_0x30f245[_0x9dcd('0x13')]['message']);return _0x5c1e27(_0x30f245[_0x9dcd('0x13')][_0x9dcd('0x14')]);}else{logger[_0x9dcd('0x15')](_0x9dcd('0xe'),_0x34a3e0,_0x9dcd('0xf'));_0x5c1e27(_0x30f245[_0x9dcd('0x16')]['message']);}})[_0x9dcd('0x17')](function(_0xb62b3){logger[_0x9dcd('0x13')](_0x9dcd('0xe'),_0x34a3e0,_0xb62b3);_0x3fdde8(_0xb62b3);});});} \ No newline at end of file +var _0x11a8=['message','result','lodash','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x54dcf4,_0xc85639){var _0x15b109=function(_0x570493){while(--_0x570493){_0x54dcf4['push'](_0x54dcf4['shift']());}};_0x15b109(++_0xc85639);}(_0x11a8,0x134));var _0x811a=function(_0x1025c2,_0x26b5db){_0x1025c2=_0x1025c2-0x0;var _0x25e5c2=_0x11a8[_0x1025c2];return _0x25e5c2;};'use strict';var _=require(_0x811a('0x0'));var util=require('util');var moment=require(_0x811a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x811a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x811a('0x3'))('rpc');var config=require(_0x811a('0x4'));var jayson=require(_0x811a('0x5'));var client=jayson['client'][_0x811a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xfd4402,_0x4280c3,_0x1842e4){return new BPromise(function(_0x26acac,_0x116934){return client['request'](_0xfd4402,_0x1842e4)[_0x811a('0x7')](function(_0x1ef8b1){logger[_0x811a('0x8')](_0x811a('0x9'),_0x4280c3,_0x811a('0xa'));logger[_0x811a('0xb')]('Condition,\x20%s,\x20%s,\x20%s',_0x4280c3,_0x811a('0xa'),JSON[_0x811a('0xc')](_0x1ef8b1));if(_0x1ef8b1[_0x811a('0xd')]){if(_0x1ef8b1[_0x811a('0xd')][_0x811a('0xe')]===0x1f4){logger[_0x811a('0xd')](_0x811a('0x9'),_0x4280c3,_0x1ef8b1['error'][_0x811a('0xf')]);return _0x116934(_0x1ef8b1[_0x811a('0xd')][_0x811a('0xf')]);}logger['error'](_0x811a('0x9'),_0x4280c3,_0x1ef8b1[_0x811a('0xd')][_0x811a('0xf')]);return _0x26acac(_0x1ef8b1[_0x811a('0xd')][_0x811a('0xf')]);}else{logger[_0x811a('0x8')](_0x811a('0x9'),_0x4280c3,'request\x20sent');_0x26acac(_0x1ef8b1[_0x811a('0x10')][_0x811a('0xf')]);}})['catch'](function(_0x42a1a1){logger[_0x811a('0xd')](_0x811a('0x9'),_0x4280c3,_0x42a1a1);_0x116934(_0x42a1a1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3395d5c..250156d 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 _0x325e=['put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2220a0,_0x4008a2){var _0x407c5b=function(_0x1b8cf8){while(--_0x1b8cf8){_0x2220a0['push'](_0x2220a0['shift']());}};_0x407c5b(++_0x4008a2);}(_0x325e,0x17a));var _0xe325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x325e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe325('0x0'));var util=require(_0xe325('0x1'));var path=require(_0xe325('0x2'));var timeout=require(_0xe325('0x3'));var express=require('express');var router=express[_0xe325('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe325('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xe325('0x6')](_0xe325('0x7'),auth[_0xe325('0x8')](),controller[_0xe325('0x9')]);router[_0xe325('0xa')]('/:id',auth[_0xe325('0x8')](),controller[_0xe325('0xb')]);module['exports']=router; \ No newline at end of file +var _0x5b0d=['/:id','update','delete','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./condition.controller'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5b0d,0xae));var _0xd5b0=function(_0x5bbfa7,_0x118a4a){_0x5bbfa7=_0x5bbfa7-0x0;var _0x671f7=_0x5b0d[_0x5bbfa7];return _0x671f7;};'use strict';var multer=require(_0xd5b0('0x0'));var util=require('util');var path=require(_0xd5b0('0x1'));var timeout=require(_0xd5b0('0x2'));var express=require(_0xd5b0('0x3'));var router=express[_0xd5b0('0x4')]();var fs_extra=require(_0xd5b0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd5b0('0x6'));var config=require('../../config/environment');var controller=require(_0xd5b0('0x7'));router['put'](_0xd5b0('0x8'),auth['isAuthenticated'](),controller[_0xd5b0('0x9')]);router[_0xd5b0('0xa')](_0xd5b0('0x8'),auth[_0xd5b0('0xb')](),controller[_0xd5b0('0xc')]);module[_0xd5b0('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index aba5774..5226a13 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 _0x6d44=['STRING','exports'];(function(_0x53d8ee,_0x5251ac){var _0x551b78=function(_0x1da774){while(--_0x1da774){_0x53d8ee['push'](_0x53d8ee['shift']());}};_0x551b78(++_0x5251ac);}(_0x6d44,0xb9));var _0x46d4=function(_0x11dc6c,_0x21bdfe){_0x11dc6c=_0x11dc6c-0x0;var _0xddae9c=_0x6d44[_0x11dc6c];return _0xddae9c;};'use strict';var Sequelize=require('sequelize');module[_0x46d4('0x0')]={'name':{'type':Sequelize[_0x46d4('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x46d4('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xc120=['STRING','name','sequelize'];(function(_0x4ca24a,_0x20672e){var _0x2180dc=function(_0x21dc74){while(--_0x21dc74){_0x4ca24a['push'](_0x4ca24a['shift']());}};_0x2180dc(++_0x20672e);}(_0xc120,0x1be));var _0x0c12=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xc120[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x0c12('0x0'));module['exports']={'name':{'type':Sequelize[_0x0c12('0x1')],'allowNull':![],'unique':_0x0c12('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 8a96a8a..078f90a 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 _0xad5b=['index','ContactItemType','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','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','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ContactItemTypes','UserProfileResource','then','end','error','name','send'];(function(_0x724d7e,_0x23d139){var _0xdad997=function(_0x4be2bf){while(--_0x4be2bf){_0x724d7e['push'](_0x724d7e['shift']());}};_0xdad997(++_0x23d139);}(_0xad5b,0x175));var _0xbad5=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xad5b[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0xbad5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbad5('0x1'));var rp=require(_0xbad5('0x2'));var moment=require(_0xbad5('0x3'));var BPromise=require(_0xbad5('0x4'));var Mustache=require('mustache');var util=require(_0xbad5('0x5'));var path=require(_0xbad5('0x6'));var sox=require(_0xbad5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbad5('0x8'));var _=require(_0xbad5('0x9'));var squel=require(_0xbad5('0xa'));var crypto=require(_0xbad5('0xb'));var jsforce=require(_0xbad5('0xc'));var deskjs=require(_0xbad5('0xd'));var toCsv=require(_0xbad5('0xe'));var querystring=require(_0xbad5('0xf'));var Papa=require('papaparse');var Redis=require(_0xbad5('0x10'));var authService=require(_0xbad5('0x11'));var qs=require(_0xbad5('0x12'));var as=require(_0xbad5('0x13'));var hardwareService=require(_0xbad5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xbad5('0x15'));var config=require(_0xbad5('0x16'));var licenseUtil=require(_0xbad5('0x17'));var db=require(_0xbad5('0x18'))['db'];function respondWithStatusCode(_0x1a0ffe,_0x5dd915){_0x5dd915=_0x5dd915||0xcc;return function(_0x3faa40){if(_0x3faa40){return _0x1a0ffe[_0xbad5('0x19')](_0x5dd915);}return _0x1a0ffe[_0xbad5('0x1a')](_0x5dd915)['end']();};}function respondWithResult(_0x14ffc6,_0x2bf3bb){_0x2bf3bb=_0x2bf3bb||0xc8;return function(_0x12cf06){if(_0x12cf06){return _0x14ffc6[_0xbad5('0x1a')](_0x2bf3bb)[_0xbad5('0x1b')](_0x12cf06);}};}function respondWithFilteredResult(_0x428600,_0x302846){return function(_0x1460fa){if(_0x1460fa){var _0x5c3745=typeof _0x302846[_0xbad5('0x1c')]===_0xbad5('0x1d')&&typeof _0x302846[_0xbad5('0x1e')]===_0xbad5('0x1d');var _0x459e64=_0x1460fa['count'];var _0x495580=_0x5c3745?0x0:_0x302846[_0xbad5('0x1c')];var _0x2433b6=_0x5c3745?_0x1460fa[_0xbad5('0x1f')]:_0x302846[_0xbad5('0x1c')]+_0x302846['limit'];var _0x2b212e;if(_0x2433b6>=_0x459e64){_0x2433b6=_0x459e64;_0x2b212e=0xc8;}else{_0x2b212e=0xce;}_0x428600['status'](_0x2b212e);return _0x428600[_0xbad5('0x20')](_0xbad5('0x21'),_0x495580+'-'+_0x2433b6+'/'+_0x459e64)[_0xbad5('0x1b')](_0x1460fa);}return null;};}function patchUpdates(_0x95c5c9){return function(_0x23d4d8){try{jsonpatch[_0xbad5('0x22')](_0x23d4d8,_0x95c5c9,!![]);}catch(_0x2a865b){return BPromise[_0xbad5('0x23')](_0x2a865b);}return _0x23d4d8[_0xbad5('0x24')]();};}function saveUpdates(_0x403c0a,_0x269f3d){return function(_0xe8782c){if(_0xe8782c){return _0xe8782c[_0xbad5('0x25')](_0x403c0a)['then'](function(_0x456111){return _0x456111;});}return null;};}function removeEntity(_0x38b74f,_0x727c8){return function(_0x5232b0){if(_0x5232b0){return _0x5232b0[_0xbad5('0x26')]()['then'](function(){var _0x32cda6=_0x5232b0[_0xbad5('0x27')]({'plain':!![]});var _0x1bbd17=_0xbad5('0x28');return db[_0xbad5('0x29')][_0xbad5('0x26')]({'where':{'type':_0x1bbd17,'resourceId':_0x32cda6['id']}})[_0xbad5('0x2a')](function(){return _0x5232b0;});})[_0xbad5('0x2a')](function(){_0x38b74f[_0xbad5('0x1a')](0xcc)[_0xbad5('0x2b')]();});}};}function handleEntityNotFound(_0x30f708,_0x50f902){return function(_0x13c293){if(!_0x13c293){_0x30f708['sendStatus'](0x194);}return _0x13c293;};}function handleError(_0x3a2c05,_0x2c8cfc){_0x2c8cfc=_0x2c8cfc||0x1f4;return function(_0x5b3235){logger[_0xbad5('0x2c')](_0x5b3235['stack']);if(_0x5b3235[_0xbad5('0x2d')]){delete _0x5b3235['name'];}_0x3a2c05[_0xbad5('0x1a')](_0x2c8cfc)[_0xbad5('0x2e')](_0x5b3235);};}exports[_0xbad5('0x2f')]=function(_0xaa6482,_0x121e09){var _0x83d93c={},_0x63782e={},_0x5a94d4={'count':0x0,'rows':[]};var _0x4a5aaa=_['map'](db[_0xbad5('0x30')][_0xbad5('0x31')],function(_0x37eaf7){return{'name':_0x37eaf7['fieldName'],'type':_0x37eaf7[_0xbad5('0x32')][_0xbad5('0x33')]};});_0x63782e[_0xbad5('0x34')]=_[_0xbad5('0x35')](_0x4a5aaa,'name');_0x63782e[_0xbad5('0x36')]=_[_0xbad5('0x37')](_0xaa6482[_0xbad5('0x36')]);_0x63782e[_0xbad5('0x38')]=_[_0xbad5('0x39')](_0x63782e[_0xbad5('0x34')],_0x63782e[_0xbad5('0x36')]);_0x83d93c[_0xbad5('0x3a')]=_[_0xbad5('0x39')](_0x63782e[_0xbad5('0x34')],qs[_0xbad5('0x3b')](_0xaa6482[_0xbad5('0x36')][_0xbad5('0x3b')]));_0x83d93c['attributes']=_0x83d93c[_0xbad5('0x3a')][_0xbad5('0x3c')]?_0x83d93c['attributes']:_0x63782e[_0xbad5('0x34')];if(!_0xaa6482[_0xbad5('0x36')][_0xbad5('0x3d')]('nolimit')){_0x83d93c[_0xbad5('0x1e')]=qs[_0xbad5('0x1e')](_0xaa6482[_0xbad5('0x36')][_0xbad5('0x1e')]);_0x83d93c[_0xbad5('0x1c')]=qs[_0xbad5('0x1c')](_0xaa6482['query']['offset']);}_0x83d93c['order']=qs['sort'](_0xaa6482[_0xbad5('0x36')][_0xbad5('0x3e')]);_0x83d93c[_0xbad5('0x3f')]=qs[_0xbad5('0x38')](_['pick'](_0xaa6482[_0xbad5('0x36')],_0x63782e['filters']),_0x4a5aaa);if(_0xaa6482[_0xbad5('0x36')]['filter']){_0x83d93c[_0xbad5('0x3f')]=_[_0xbad5('0x40')](_0x83d93c['where'],{'$or':_['map'](_0x4a5aaa,function(_0x58c6c4){if(_0x58c6c4[_0xbad5('0x32')]!==_0xbad5('0x41')){var _0x3bf120={};_0x3bf120[_0x58c6c4['name']]={'$like':'%'+_0xaa6482[_0xbad5('0x36')][_0xbad5('0x42')]+'%'};return _0x3bf120;}})});}_0x83d93c=_[_0xbad5('0x40')]({},_0x83d93c,_0xaa6482['options']);var _0x1d31d5={'where':_0x83d93c[_0xbad5('0x3f')]};return db[_0xbad5('0x30')]['count'](_0x1d31d5)['then'](function(_0x33bbb5){_0x5a94d4[_0xbad5('0x1f')]=_0x33bbb5;if(_0xaa6482['query'][_0xbad5('0x43')]){_0x83d93c[_0xbad5('0x44')]=[{'all':!![]}];}return db[_0xbad5('0x30')][_0xbad5('0x45')](_0x83d93c);})[_0xbad5('0x2a')](function(_0x53fd6b){_0x5a94d4[_0xbad5('0x46')]=_0x53fd6b;return _0x5a94d4;})['then'](respondWithFilteredResult(_0x121e09,_0x83d93c))['catch'](handleError(_0x121e09,null));};exports['show']=function(_0xd3c0ee,_0x4b45b6){var _0x25fa22={'raw':!![],'where':{'id':_0xd3c0ee[_0xbad5('0x47')]['id']}},_0x74f94e={};_0x74f94e[_0xbad5('0x34')]=_[_0xbad5('0x37')](db[_0xbad5('0x30')][_0xbad5('0x31')]);_0x74f94e['query']=_['keys'](_0xd3c0ee[_0xbad5('0x36')]);_0x74f94e[_0xbad5('0x38')]=_[_0xbad5('0x39')](_0x74f94e['model'],_0x74f94e[_0xbad5('0x36')]);_0x25fa22[_0xbad5('0x3a')]=_['intersection'](_0x74f94e[_0xbad5('0x34')],qs[_0xbad5('0x3b')](_0xd3c0ee[_0xbad5('0x36')][_0xbad5('0x3b')]));_0x25fa22[_0xbad5('0x3a')]=_0x25fa22[_0xbad5('0x3a')][_0xbad5('0x3c')]?_0x25fa22[_0xbad5('0x3a')]:_0x74f94e['model'];if(_0xd3c0ee['query'][_0xbad5('0x43')]){_0x25fa22[_0xbad5('0x44')]=[{'all':!![]}];}_0x25fa22=_[_0xbad5('0x40')]({},_0x25fa22,_0xd3c0ee[_0xbad5('0x48')]);return db['ContactItemType'][_0xbad5('0x49')](_0x25fa22)[_0xbad5('0x2a')](handleEntityNotFound(_0x4b45b6,null))[_0xbad5('0x2a')](respondWithResult(_0x4b45b6,null))[_0xbad5('0x4a')](handleError(_0x4b45b6,null));};exports[_0xbad5('0x4b')]=function(_0x13858c,_0x27a64c){return db[_0xbad5('0x30')][_0xbad5('0x4b')](_0x13858c[_0xbad5('0x4c')],{})[_0xbad5('0x2a')](function(_0x1da3f7){var _0xece724=_0x13858c[_0xbad5('0x4d')][_0xbad5('0x27')]({'plain':!![]});if(!_0xece724)throw new Error(_0xbad5('0x4e'));if(_0xece724[_0xbad5('0x4f')]===_0xbad5('0x4d')){var _0x4b1e58=_0x1da3f7[_0xbad5('0x27')]({'plain':!![]});var _0x1d283e='ContactItemTypes';return db[_0xbad5('0x50')]['find']({'where':{'name':_0x1d283e,'userProfileId':_0xece724[_0xbad5('0x51')]},'raw':!![]})[_0xbad5('0x2a')](function(_0x3e16db){if(_0x3e16db&&_0x3e16db[_0xbad5('0x52')]===0x0){return db[_0xbad5('0x29')][_0xbad5('0x4b')]({'name':_0x4b1e58[_0xbad5('0x2d')],'resourceId':_0x4b1e58['id'],'type':_0x3e16db[_0xbad5('0x2d')],'sectionId':_0x3e16db['id']},{})['then'](function(){return _0x1da3f7;});}else{return _0x1da3f7;}})[_0xbad5('0x4a')](function(_0x41e10e){logger[_0xbad5('0x2c')](_0xbad5('0x53'),_0x41e10e);throw _0x41e10e;});}return _0x1da3f7;})[_0xbad5('0x2a')](respondWithResult(_0x27a64c,0xc9))['catch'](handleError(_0x27a64c,null));};exports[_0xbad5('0x25')]=function(_0x153d4c,_0x1f353f){if(_0x153d4c['body']['id']){delete _0x153d4c['body']['id'];}return db[_0xbad5('0x30')]['find']({'where':{'id':_0x153d4c[_0xbad5('0x47')]['id']}})[_0xbad5('0x2a')](handleEntityNotFound(_0x1f353f,null))['then'](saveUpdates(_0x153d4c[_0xbad5('0x4c')],null))[_0xbad5('0x2a')](respondWithResult(_0x1f353f,null))[_0xbad5('0x4a')](handleError(_0x1f353f,null));};exports[_0xbad5('0x26')]=function(_0x1221ed,_0x2282a3){return db[_0xbad5('0x30')]['find']({'where':{'id':_0x1221ed['params']['id']}})[_0xbad5('0x2a')](handleEntityNotFound(_0x2282a3,null))[_0xbad5('0x2a')](removeEntity(_0x2282a3,null))[_0xbad5('0x4a')](handleError(_0x2282a3,null));}; \ No newline at end of file +var _0x2ca4=['count','include','findAll','catch','show','params','keys','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','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','set','Content-Range','json','apply','reject','save','update','destroy','then','get','ContactItemTypes','end','error','name','map','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','ContactItemType'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x2ca4,0x66));var _0x42ca=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0x2ca4[_0x42ebba];return _0x3fd2af;};'use strict';var emlformat=require(_0x42ca('0x0'));var rimraf=require(_0x42ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42ca('0x2'));var rp=require(_0x42ca('0x3'));var moment=require('moment');var BPromise=require(_0x42ca('0x4'));var Mustache=require(_0x42ca('0x5'));var util=require(_0x42ca('0x6'));var path=require(_0x42ca('0x7'));var sox=require(_0x42ca('0x8'));var csv=require('to-csv');var ejs=require(_0x42ca('0x9'));var fs=require('fs');var fs_extra=require(_0x42ca('0xa'));var _=require(_0x42ca('0xb'));var squel=require(_0x42ca('0xc'));var crypto=require(_0x42ca('0xd'));var jsforce=require(_0x42ca('0xe'));var deskjs=require(_0x42ca('0xf'));var toCsv=require(_0x42ca('0x10'));var querystring=require(_0x42ca('0x11'));var Papa=require(_0x42ca('0x12'));var Redis=require(_0x42ca('0x13'));var authService=require(_0x42ca('0x14'));var qs=require(_0x42ca('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x42ca('0x16'))(_0x42ca('0x17'));var utils=require('../../config/utils');var config=require(_0x42ca('0x18'));var licenseUtil=require(_0x42ca('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x166797,_0x5d52f5){_0x5d52f5=_0x5d52f5||0xcc;return function(_0x25154c){if(_0x25154c){return _0x166797[_0x42ca('0x1a')](_0x5d52f5);}return _0x166797[_0x42ca('0x1b')](_0x5d52f5)['end']();};}function respondWithResult(_0xb91a40,_0x1301f9){_0x1301f9=_0x1301f9||0xc8;return function(_0x20999b){if(_0x20999b){return _0xb91a40[_0x42ca('0x1b')](_0x1301f9)['json'](_0x20999b);}};}function respondWithFilteredResult(_0x3c605f,_0x2d99bb){return function(_0x5ca598){if(_0x5ca598){var _0x6144ca=typeof _0x2d99bb[_0x42ca('0x1c')]==='undefined'&&typeof _0x2d99bb['limit']===_0x42ca('0x1d');var _0x168890=_0x5ca598['count'];var _0x200c8b=_0x6144ca?0x0:_0x2d99bb[_0x42ca('0x1c')];var _0x3ca6ab=_0x6144ca?_0x5ca598['count']:_0x2d99bb[_0x42ca('0x1c')]+_0x2d99bb['limit'];var _0x105f5d;if(_0x3ca6ab>=_0x168890){_0x3ca6ab=_0x168890;_0x105f5d=0xc8;}else{_0x105f5d=0xce;}_0x3c605f[_0x42ca('0x1b')](_0x105f5d);return _0x3c605f[_0x42ca('0x1e')](_0x42ca('0x1f'),_0x200c8b+'-'+_0x3ca6ab+'/'+_0x168890)[_0x42ca('0x20')](_0x5ca598);}return null;};}function patchUpdates(_0x502196){return function(_0x2c145f){try{jsonpatch[_0x42ca('0x21')](_0x2c145f,_0x502196,!![]);}catch(_0x17bf68){return BPromise[_0x42ca('0x22')](_0x17bf68);}return _0x2c145f[_0x42ca('0x23')]();};}function saveUpdates(_0x10bdec,_0x5de56b){return function(_0x2d5a35){if(_0x2d5a35){return _0x2d5a35[_0x42ca('0x24')](_0x10bdec)['then'](function(_0x59489e){return _0x59489e;});}return null;};}function removeEntity(_0x41b5c7,_0x27cb30){return function(_0x4a7857){if(_0x4a7857){return _0x4a7857[_0x42ca('0x25')]()[_0x42ca('0x26')](function(){var _0x5883c6=_0x4a7857[_0x42ca('0x27')]({'plain':!![]});var _0x44b30a=_0x42ca('0x28');return db['UserProfileResource'][_0x42ca('0x25')]({'where':{'type':_0x44b30a,'resourceId':_0x5883c6['id']}})[_0x42ca('0x26')](function(){return _0x4a7857;});})['then'](function(){_0x41b5c7['status'](0xcc)[_0x42ca('0x29')]();});}};}function handleEntityNotFound(_0x280326,_0x413d2a){return function(_0x246315){if(!_0x246315){_0x280326[_0x42ca('0x1a')](0x194);}return _0x246315;};}function handleError(_0x12ddc5,_0x13ace2){_0x13ace2=_0x13ace2||0x1f4;return function(_0x298dc7){logger[_0x42ca('0x2a')](_0x298dc7['stack']);if(_0x298dc7[_0x42ca('0x2b')]){delete _0x298dc7[_0x42ca('0x2b')];}_0x12ddc5['status'](_0x13ace2)['send'](_0x298dc7);};}exports['index']=function(_0x1932a0,_0x1f6ffb){var _0x3d58fd={},_0x544507={},_0x16680f={'count':0x0,'rows':[]};var _0x523001=_[_0x42ca('0x2c')](db['ContactItemType'][_0x42ca('0x2d')],function(_0x20d938){return{'name':_0x20d938['fieldName'],'type':_0x20d938[_0x42ca('0x2e')][_0x42ca('0x2f')]};});_0x544507['model']=_['map'](_0x523001,'name');_0x544507[_0x42ca('0x30')]=_['keys'](_0x1932a0['query']);_0x544507[_0x42ca('0x31')]=_['intersection'](_0x544507[_0x42ca('0x32')],_0x544507['query']);_0x3d58fd[_0x42ca('0x33')]=_[_0x42ca('0x34')](_0x544507[_0x42ca('0x32')],qs[_0x42ca('0x35')](_0x1932a0[_0x42ca('0x30')]['fields']));_0x3d58fd[_0x42ca('0x33')]=_0x3d58fd['attributes'][_0x42ca('0x36')]?_0x3d58fd[_0x42ca('0x33')]:_0x544507[_0x42ca('0x32')];if(!_0x1932a0['query'][_0x42ca('0x37')](_0x42ca('0x38'))){_0x3d58fd[_0x42ca('0x39')]=qs['limit'](_0x1932a0[_0x42ca('0x30')]['limit']);_0x3d58fd[_0x42ca('0x1c')]=qs[_0x42ca('0x1c')](_0x1932a0[_0x42ca('0x30')][_0x42ca('0x1c')]);}_0x3d58fd[_0x42ca('0x3a')]=qs[_0x42ca('0x3b')](_0x1932a0['query'][_0x42ca('0x3b')]);_0x3d58fd[_0x42ca('0x3c')]=qs[_0x42ca('0x31')](_['pick'](_0x1932a0[_0x42ca('0x30')],_0x544507[_0x42ca('0x31')]),_0x523001);if(_0x1932a0[_0x42ca('0x30')]['filter']){_0x3d58fd['where']=_[_0x42ca('0x3d')](_0x3d58fd['where'],{'$or':_['map'](_0x523001,function(_0x311ebf){if(_0x311ebf[_0x42ca('0x2e')]!==_0x42ca('0x3e')){var _0x5776a6={};_0x5776a6[_0x311ebf[_0x42ca('0x2b')]]={'$like':'%'+_0x1932a0[_0x42ca('0x30')][_0x42ca('0x3f')]+'%'};return _0x5776a6;}})});}_0x3d58fd=_[_0x42ca('0x3d')]({},_0x3d58fd,_0x1932a0[_0x42ca('0x40')]);var _0x5d48f2={'where':_0x3d58fd[_0x42ca('0x3c')]};return db[_0x42ca('0x41')][_0x42ca('0x42')](_0x5d48f2)['then'](function(_0x503f9b){_0x16680f[_0x42ca('0x42')]=_0x503f9b;if(_0x1932a0[_0x42ca('0x30')]['includeAll']){_0x3d58fd[_0x42ca('0x43')]=[{'all':!![]}];}return db[_0x42ca('0x41')][_0x42ca('0x44')](_0x3d58fd);})[_0x42ca('0x26')](function(_0x434243){_0x16680f['rows']=_0x434243;return _0x16680f;})['then'](respondWithFilteredResult(_0x1f6ffb,_0x3d58fd))[_0x42ca('0x45')](handleError(_0x1f6ffb,null));};exports[_0x42ca('0x46')]=function(_0x15f621,_0x5667f9){var _0x2a22cf={'raw':!![],'where':{'id':_0x15f621[_0x42ca('0x47')]['id']}},_0xffd8fc={};_0xffd8fc[_0x42ca('0x32')]=_[_0x42ca('0x48')](db[_0x42ca('0x41')][_0x42ca('0x2d')]);_0xffd8fc['query']=_[_0x42ca('0x48')](_0x15f621['query']);_0xffd8fc['filters']=_[_0x42ca('0x34')](_0xffd8fc[_0x42ca('0x32')],_0xffd8fc['query']);_0x2a22cf[_0x42ca('0x33')]=_[_0x42ca('0x34')](_0xffd8fc[_0x42ca('0x32')],qs['fields'](_0x15f621[_0x42ca('0x30')]['fields']));_0x2a22cf[_0x42ca('0x33')]=_0x2a22cf['attributes']['length']?_0x2a22cf[_0x42ca('0x33')]:_0xffd8fc[_0x42ca('0x32')];if(_0x15f621[_0x42ca('0x30')]['includeAll']){_0x2a22cf[_0x42ca('0x43')]=[{'all':!![]}];}_0x2a22cf=_[_0x42ca('0x3d')]({},_0x2a22cf,_0x15f621['options']);return db['ContactItemType'][_0x42ca('0x49')](_0x2a22cf)[_0x42ca('0x26')](handleEntityNotFound(_0x5667f9,null))[_0x42ca('0x26')](respondWithResult(_0x5667f9,null))[_0x42ca('0x45')](handleError(_0x5667f9,null));};exports[_0x42ca('0x4a')]=function(_0x26214f,_0x356401){return db[_0x42ca('0x41')]['create'](_0x26214f[_0x42ca('0x4b')],{})[_0x42ca('0x26')](function(_0x2415ab){var _0x11717c=_0x26214f[_0x42ca('0x4c')][_0x42ca('0x27')]({'plain':!![]});if(!_0x11717c)throw new Error(_0x42ca('0x4d'));if(_0x11717c[_0x42ca('0x4e')]===_0x42ca('0x4c')){var _0x156072=_0x2415ab[_0x42ca('0x27')]({'plain':!![]});var _0xc320d2=_0x42ca('0x28');return db[_0x42ca('0x4f')][_0x42ca('0x49')]({'where':{'name':_0xc320d2,'userProfileId':_0x11717c[_0x42ca('0x50')]},'raw':!![]})[_0x42ca('0x26')](function(_0x47f661){if(_0x47f661&&_0x47f661[_0x42ca('0x51')]===0x0){return db[_0x42ca('0x52')][_0x42ca('0x4a')]({'name':_0x156072[_0x42ca('0x2b')],'resourceId':_0x156072['id'],'type':_0x47f661['name'],'sectionId':_0x47f661['id']},{})[_0x42ca('0x26')](function(){return _0x2415ab;});}else{return _0x2415ab;}})[_0x42ca('0x45')](function(_0x2f4339){logger[_0x42ca('0x2a')](_0x42ca('0x53'),_0x2f4339);throw _0x2f4339;});}return _0x2415ab;})[_0x42ca('0x26')](respondWithResult(_0x356401,0xc9))[_0x42ca('0x45')](handleError(_0x356401,null));};exports['update']=function(_0x2a9589,_0x25a8bf){if(_0x2a9589[_0x42ca('0x4b')]['id']){delete _0x2a9589[_0x42ca('0x4b')]['id'];}return db[_0x42ca('0x41')]['find']({'where':{'id':_0x2a9589[_0x42ca('0x47')]['id']}})[_0x42ca('0x26')](handleEntityNotFound(_0x25a8bf,null))[_0x42ca('0x26')](saveUpdates(_0x2a9589[_0x42ca('0x4b')],null))['then'](respondWithResult(_0x25a8bf,null))['catch'](handleError(_0x25a8bf,null));};exports[_0x42ca('0x25')]=function(_0x599861,_0x2e54ea){return db[_0x42ca('0x41')][_0x42ca('0x49')]({'where':{'id':_0x599861[_0x42ca('0x47')]['id']}})[_0x42ca('0x26')](handleEntityNotFound(_0x2e54ea,null))['then'](removeEntity(_0x2e54ea,null))[_0x42ca('0x45')](handleError(_0x2e54ea,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index e3f5ab7..3e244de 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 _0x78a6=['ContactItemType','tools_contact_item_types','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x4132f2,_0x1c1f28){var _0x43d8f4=function(_0x1cdc02){while(--_0x1cdc02){_0x4132f2['push'](_0x4132f2['shift']());}};_0x43d8f4(++_0x1c1f28);}(_0x78a6,0x156));var _0x678a=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x78a6[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require('lodash');var util=require(_0x678a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x678a('0x1'));var BPromise=require(_0x678a('0x2'));var rp=require(_0x678a('0x3'));var fs=require('fs');var path=require(_0x678a('0x4'));var rimraf=require(_0x678a('0x5'));var config=require(_0x678a('0x6'));var attributes=require(_0x678a('0x7'));module['exports']=function(_0x2666b6,_0x25af7d){return _0x2666b6['define'](_0x678a('0x8'),attributes,{'tableName':_0x678a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d3c=['rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x15dfef,_0x43b647){var _0x125abf=function(_0x25bccd){while(--_0x25bccd){_0x15dfef['push'](_0x15dfef['shift']());}};_0x125abf(++_0x43b647);}(_0x8d3c,0x19a));var _0xc8d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8d3('0x0'));var util=require(_0xc8d3('0x1'));var logger=require(_0xc8d3('0x2'))(_0xc8d3('0x3'));var moment=require('moment');var BPromise=require(_0xc8d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8d3('0x5'));var rimraf=require(_0xc8d3('0x6'));var config=require(_0xc8d3('0x7'));var attributes=require(_0xc8d3('0x8'));module[_0xc8d3('0x9')]=function(_0x2ddc41,_0x2afafb){return _0x2ddc41[_0xc8d3('0xa')](_0xc8d3('0xb'),attributes,{'tableName':_0xc8d3('0xc'),'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 fe8107b..182f371 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 _0xdef9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1805bd,_0x1c1e7d){var _0x56b6f1=function(_0x10697f){while(--_0x10697f){_0x1805bd['push'](_0x1805bd['shift']());}};_0x56b6f1(++_0x1c1e7d);}(_0xdef9,0x1ed));var _0x9def=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0xdef9[_0x27dba4];return _0x35ec9d;};'use strict';var _=require(_0x9def('0x0'));var util=require(_0x9def('0x1'));var moment=require(_0x9def('0x2'));var BPromise=require(_0x9def('0x3'));var rs=require(_0x9def('0x4'));var fs=require('fs');var Redis=require(_0x9def('0x5'));var db=require(_0x9def('0x6'))['db'];var utils=require(_0x9def('0x7'));var logger=require(_0x9def('0x8'))(_0x9def('0x9'));var config=require(_0x9def('0xa'));var jayson=require(_0x9def('0xb'));var client=jayson[_0x9def('0xc')][_0x9def('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40c607,_0x25a03e,_0x42296c){return new BPromise(function(_0x1efce0,_0x8262f1){return client['request'](_0x40c607,_0x42296c)[_0x9def('0xe')](function(_0x4f0a0d){logger['info'](_0x9def('0xf'),_0x25a03e,_0x9def('0x10'));logger[_0x9def('0x11')](_0x9def('0x12'),_0x25a03e,'request\x20sent',JSON[_0x9def('0x13')](_0x4f0a0d));if(_0x4f0a0d[_0x9def('0x14')]){if(_0x4f0a0d[_0x9def('0x14')][_0x9def('0x15')]===0x1f4){logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')]['message']);return _0x8262f1(_0x4f0a0d[_0x9def('0x14')]['message']);}logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')][_0x9def('0x16')]);return _0x1efce0(_0x4f0a0d['error'][_0x9def('0x16')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x25a03e,_0x9def('0x10'));_0x1efce0(_0x4f0a0d[_0x9def('0x17')][_0x9def('0x16')]);}})[_0x9def('0x18')](function(_0x463520){logger[_0x9def('0x14')](_0x9def('0xf'),_0x25a03e,_0x463520);_0x8262f1(_0x463520);});});} \ No newline at end of file +var _0x6b35=['result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','code','error','message'];(function(_0x194329,_0x1212d4){var _0x432437=function(_0x22b74e){while(--_0x22b74e){_0x194329['push'](_0x194329['shift']());}};_0x432437(++_0x1212d4);}(_0x6b35,0x6e));var _0x56b3=function(_0x45f47d,_0x3ba268){_0x45f47d=_0x45f47d-0x0;var _0x5a34d4=_0x6b35[_0x45f47d];return _0x5a34d4;};'use strict';var _=require('lodash');var util=require(_0x56b3('0x0'));var moment=require(_0x56b3('0x1'));var BPromise=require(_0x56b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56b3('0x3'))['db'];var utils=require(_0x56b3('0x4'));var logger=require(_0x56b3('0x5'))(_0x56b3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a33a5,_0x3486b9,_0xabf2d7){return new BPromise(function(_0x1ca183,_0x48a098){return client[_0x56b3('0x7')](_0x1a33a5,_0xabf2d7)[_0x56b3('0x8')](function(_0x3d6f0d){logger[_0x56b3('0x9')](_0x56b3('0xa'),_0x3486b9,_0x56b3('0xb'));logger[_0x56b3('0xc')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x3486b9,'request\x20sent',JSON['stringify'](_0x3d6f0d));if(_0x3d6f0d['error']){if(_0x3d6f0d['error'][_0x56b3('0xd')]===0x1f4){logger[_0x56b3('0xe')](_0x56b3('0xa'),_0x3486b9,_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);return _0x48a098(_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);}logger[_0x56b3('0xe')](_0x56b3('0xa'),_0x3486b9,_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);return _0x1ca183(_0x3d6f0d[_0x56b3('0xe')][_0x56b3('0xf')]);}else{logger[_0x56b3('0x9')]('ContactItemType,\x20%s,\x20%s',_0x3486b9,_0x56b3('0xb'));_0x1ca183(_0x3d6f0d[_0x56b3('0x10')][_0x56b3('0xf')]);}})[_0x56b3('0x11')](function(_0x3ab6cc){logger[_0x56b3('0xe')](_0x56b3('0xa'),_0x3486b9,_0x3ab6cc);_0x48a098(_0x3ab6cc);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index edc5d9f..0de0a26 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 _0x5097=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','get'];(function(_0x5cb710,_0x4ac057){var _0x40d53b=function(_0x584dbb){while(--_0x584dbb){_0x5cb710['push'](_0x5cb710['shift']());}};_0x40d53b(++_0x4ac057);}(_0x5097,0xf8));var _0x7509=function(_0x15f22f,_0x15dde5){_0x15f22f=_0x15f22f-0x0;var _0x5434ea=_0x5097[_0x15f22f];return _0x5434ea;};'use strict';var multer=require('multer');var util=require(_0x7509('0x0'));var path=require(_0x7509('0x1'));var timeout=require('connect-timeout');var express=require(_0x7509('0x2'));var router=express[_0x7509('0x3')]();var fs_extra=require(_0x7509('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7509('0x5'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x7509('0x6')]('/',auth[_0x7509('0x7')](),controller[_0x7509('0x8')]);router[_0x7509('0x6')](_0x7509('0x9'),auth[_0x7509('0x7')](),controller[_0x7509('0xa')]);router[_0x7509('0xb')]('/',auth[_0x7509('0x7')](),controller[_0x7509('0xc')]);router[_0x7509('0xd')](_0x7509('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x7509('0xe')](_0x7509('0x9'),auth[_0x7509('0x7')](),controller[_0x7509('0xf')]);module[_0x7509('0x10')]=router; \ No newline at end of file +var _0x36c8=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','/:id','show','post','create','put','isAuthenticated','update','delete'];(function(_0x5afbc2,_0x29aab5){var _0xe98381=function(_0x33038f){while(--_0x33038f){_0x5afbc2['push'](_0x5afbc2['shift']());}};_0xe98381(++_0x29aab5);}(_0x36c8,0x75));var _0x836c=function(_0x5416c2,_0x5d3ab2){_0x5416c2=_0x5416c2-0x0;var _0x1e0002=_0x36c8[_0x5416c2];return _0x1e0002;};'use strict';var multer=require(_0x836c('0x0'));var util=require(_0x836c('0x1'));var path=require(_0x836c('0x2'));var timeout=require(_0x836c('0x3'));var express=require(_0x836c('0x4'));var router=express[_0x836c('0x5')]();var fs_extra=require(_0x836c('0x6'));var auth=require(_0x836c('0x7'));var interaction=require(_0x836c('0x8'));var config=require(_0x836c('0x9'));var controller=require(_0x836c('0xa'));router[_0x836c('0xb')]('/',auth['isAuthenticated'](),controller[_0x836c('0xc')]);router[_0x836c('0xb')](_0x836c('0xd'),auth['isAuthenticated'](),controller[_0x836c('0xe')]);router[_0x836c('0xf')]('/',auth['isAuthenticated'](),controller[_0x836c('0x10')]);router[_0x836c('0x11')](_0x836c('0xd'),auth[_0x836c('0x12')](),controller[_0x836c('0x13')]);router[_0x836c('0x14')](_0x836c('0xd'),auth['isAuthenticated'](),controller[_0x836c('0x15')]);module[_0x836c('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 1a5bf29..c9cfc14 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 _0x0713=['STRING','name'];(function(_0xa4906c,_0x28f859){var _0x4a69b6=function(_0xda4800){while(--_0xda4800){_0xa4906c['push'](_0xa4906c['shift']());}};_0x4a69b6(++_0x28f859);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb7e7[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index bef488d..08acb02 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 _0x22f6=['api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','get','CustomDashboards','UserProfileResource','then','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','Dashboard','includeAll','include','catch','show','rawAttributes','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','params','omit','updatedAt','createdAt','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','order','pick','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1a68ec,_0x2ab029){var _0x59ecde=function(_0x168d5a){while(--_0x168d5a){_0x1a68ec['push'](_0x1a68ec['shift']());}};_0x59ecde(++_0x2ab029);}(_0x22f6,0x69));var _0x622f=function(_0x5e5337,_0x582e2e){_0x5e5337=_0x5e5337-0x0;var _0x2ad632=_0x22f6[_0x5e5337];return _0x2ad632;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x622f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x622f('0x1'));var moment=require(_0x622f('0x2'));var BPromise=require(_0x622f('0x3'));var Mustache=require(_0x622f('0x4'));var util=require(_0x622f('0x5'));var path=require(_0x622f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x622f('0x7'));var fs=require('fs');var fs_extra=require(_0x622f('0x8'));var _=require(_0x622f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x622f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x622f('0xb'));var Papa=require(_0x622f('0xc'));var Redis=require(_0x622f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x622f('0xe'));var as=require(_0x622f('0xf'));var hardwareService=require(_0x622f('0x10'));var logger=require(_0x622f('0x11'))(_0x622f('0x12'));var utils=require(_0x622f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x622f('0x14'));var db=require(_0x622f('0x15'))['db'];config[_0x622f('0x16')]=_[_0x622f('0x17')](config['redis'],{'host':_0x622f('0x18'),'port':0x18eb});var socket=require(_0x622f('0x19'))(new Redis(config[_0x622f('0x16')]));require(_0x622f('0x1a'))[_0x622f('0x1b')](socket);function respondWithStatusCode(_0x3f0264,_0x210a6c){_0x210a6c=_0x210a6c||0xcc;return function(_0x373fe6){if(_0x373fe6){return _0x3f0264[_0x622f('0x1c')](_0x210a6c);}return _0x3f0264[_0x622f('0x1d')](_0x210a6c)[_0x622f('0x1e')]();};}function respondWithResult(_0x3065b6,_0x13aea0){_0x13aea0=_0x13aea0||0xc8;return function(_0x253100){if(_0x253100){return _0x3065b6[_0x622f('0x1d')](_0x13aea0)[_0x622f('0x1f')](_0x253100);}};}function respondWithFilteredResult(_0x4c420b,_0x4bcc26){return function(_0x12f90d){if(_0x12f90d){var _0x180144=typeof _0x4bcc26[_0x622f('0x20')]===_0x622f('0x21')&&typeof _0x4bcc26[_0x622f('0x22')]===_0x622f('0x21');var _0x225a6b=_0x12f90d['count'];var _0x2c6b8c=_0x180144?0x0:_0x4bcc26[_0x622f('0x20')];var _0x229e36=_0x180144?_0x12f90d[_0x622f('0x23')]:_0x4bcc26[_0x622f('0x20')]+_0x4bcc26['limit'];var _0xc1c38f;if(_0x229e36>=_0x225a6b){_0x229e36=_0x225a6b;_0xc1c38f=0xc8;}else{_0xc1c38f=0xce;}_0x4c420b[_0x622f('0x1d')](_0xc1c38f);return _0x4c420b['set'](_0x622f('0x24'),_0x2c6b8c+'-'+_0x229e36+'/'+_0x225a6b)['json'](_0x12f90d);}return null;};}function patchUpdates(_0x1dc617){return function(_0x18209d){try{jsonpatch['apply'](_0x18209d,_0x1dc617,!![]);}catch(_0x10ed1e){return BPromise[_0x622f('0x25')](_0x10ed1e);}return _0x18209d[_0x622f('0x26')]();};}function saveUpdates(_0x108b41,_0x1bb941){return function(_0x5aba3d){if(_0x5aba3d){return _0x5aba3d[_0x622f('0x27')](_0x108b41)['then'](function(_0x180fc9){return _0x180fc9;});}return null;};}function removeEntity(_0x1c776a,_0x46f6b1){return function(_0x18e000){if(_0x18e000){return _0x18e000[_0x622f('0x28')]()['then'](function(){var _0x62a54=_0x18e000[_0x622f('0x29')]({'plain':!![]});var _0x2382f6=_0x622f('0x2a');return db[_0x622f('0x2b')][_0x622f('0x28')]({'where':{'type':_0x2382f6,'resourceId':_0x62a54['id']}})[_0x622f('0x2c')](function(){return _0x18e000;});})[_0x622f('0x2c')](function(){_0x1c776a['status'](0xcc)[_0x622f('0x1e')]();});}};}function handleEntityNotFound(_0x59ba78,_0x1d163c){return function(_0x4e3ce3){if(!_0x4e3ce3){_0x59ba78[_0x622f('0x1c')](0x194);}return _0x4e3ce3;};}function handleError(_0x9c3c35,_0x19d0af){_0x19d0af=_0x19d0af||0x1f4;return function(_0x59b4d7){logger['error'](_0x59b4d7[_0x622f('0x2d')]);if(_0x59b4d7[_0x622f('0x2e')]){delete _0x59b4d7[_0x622f('0x2e')];}_0x9c3c35[_0x622f('0x1d')](_0x19d0af)[_0x622f('0x2f')](_0x59b4d7);};}exports[_0x622f('0x30')]=function(_0xc04fe7,_0x55f047){var _0x1863d9={},_0x3af99e={},_0x214016={'count':0x0,'rows':[]};var _0x1b7dda=_[_0x622f('0x31')](db['Dashboard']['rawAttributes'],function(_0x1d53f3){return{'name':_0x1d53f3[_0x622f('0x32')],'type':_0x1d53f3['type'][_0x622f('0x33')]};});_0x3af99e[_0x622f('0x34')]=_['map'](_0x1b7dda,'name');_0x3af99e[_0x622f('0x35')]=_[_0x622f('0x36')](_0xc04fe7[_0x622f('0x35')]);_0x3af99e['filters']=_[_0x622f('0x37')](_0x3af99e['model'],_0x3af99e['query']);_0x1863d9[_0x622f('0x38')]=_[_0x622f('0x37')](_0x3af99e['model'],qs[_0x622f('0x39')](_0xc04fe7[_0x622f('0x35')]['fields']));_0x1863d9['attributes']=_0x1863d9[_0x622f('0x38')][_0x622f('0x3a')]?_0x1863d9[_0x622f('0x38')]:_0x3af99e[_0x622f('0x34')];if(!_0xc04fe7[_0x622f('0x35')][_0x622f('0x3b')](_0x622f('0x3c'))){_0x1863d9[_0x622f('0x22')]=qs[_0x622f('0x22')](_0xc04fe7['query'][_0x622f('0x22')]);_0x1863d9['offset']=qs[_0x622f('0x20')](_0xc04fe7[_0x622f('0x35')][_0x622f('0x20')]);}_0x1863d9['order']=qs[_0x622f('0x3d')](_0xc04fe7[_0x622f('0x35')][_0x622f('0x3d')]);_0x1863d9[_0x622f('0x3e')]=qs['filters'](_['pick'](_0xc04fe7['query'],_0x3af99e[_0x622f('0x3f')]),_0x1b7dda);if(_0xc04fe7['query']['filter']){_0x1863d9[_0x622f('0x3e')]=_[_0x622f('0x40')](_0x1863d9[_0x622f('0x3e')],{'$or':_[_0x622f('0x31')](_0x1b7dda,function(_0x25b420){if(_0x25b420['type']!==_0x622f('0x41')){var _0x29d443={};_0x29d443[_0x25b420[_0x622f('0x2e')]]={'$like':'%'+_0xc04fe7['query'][_0x622f('0x42')]+'%'};return _0x29d443;}})});}_0x1863d9=_[_0x622f('0x40')]({},_0x1863d9,_0xc04fe7[_0x622f('0x43')]);var _0x7c1811={'where':_0x1863d9[_0x622f('0x3e')]};return db[_0x622f('0x44')][_0x622f('0x23')](_0x7c1811)[_0x622f('0x2c')](function(_0x1c8d96){_0x214016[_0x622f('0x23')]=_0x1c8d96;if(_0xc04fe7['query'][_0x622f('0x45')]){_0x1863d9[_0x622f('0x46')]=[{'all':!![]}];}return db[_0x622f('0x44')]['findAll'](_0x1863d9);})[_0x622f('0x2c')](function(_0x1a3ca3){_0x214016['rows']=_0x1a3ca3;return _0x214016;})[_0x622f('0x2c')](respondWithFilteredResult(_0x55f047,_0x1863d9))[_0x622f('0x47')](handleError(_0x55f047,null));};exports[_0x622f('0x48')]=function(_0x24e5ac,_0xf3983f){var _0x2c5f38={'raw':![],'where':{'id':_0x24e5ac['params']['id']}},_0x23fbc0={};_0x23fbc0[_0x622f('0x34')]=_[_0x622f('0x36')](db[_0x622f('0x44')][_0x622f('0x49')]);_0x23fbc0[_0x622f('0x35')]=_[_0x622f('0x36')](_0x24e5ac[_0x622f('0x35')]);_0x23fbc0[_0x622f('0x3f')]=_[_0x622f('0x37')](_0x23fbc0['model'],_0x23fbc0[_0x622f('0x35')]);_0x2c5f38[_0x622f('0x38')]=_[_0x622f('0x37')](_0x23fbc0[_0x622f('0x34')],qs[_0x622f('0x39')](_0x24e5ac['query'][_0x622f('0x39')]));_0x2c5f38[_0x622f('0x38')]=_0x2c5f38[_0x622f('0x38')][_0x622f('0x3a')]?_0x2c5f38[_0x622f('0x38')]:_0x23fbc0['model'];if(_0x24e5ac[_0x622f('0x35')][_0x622f('0x45')]){_0x2c5f38['include']=[{'all':!![]}];}_0x2c5f38=_[_0x622f('0x40')]({},_0x2c5f38,_0x24e5ac[_0x622f('0x43')]);return db[_0x622f('0x44')][_0x622f('0x4a')](_0x2c5f38)[_0x622f('0x2c')](handleEntityNotFound(_0xf3983f,null))['then'](respondWithResult(_0xf3983f,null))['catch'](handleError(_0xf3983f,null));};exports[_0x622f('0x4b')]=function(_0x55415e,_0x1e57e0){return db[_0x622f('0x44')]['create'](_0x55415e[_0x622f('0x4c')],{})[_0x622f('0x2c')](function(_0x2a5130){var _0x269c5c=_0x55415e[_0x622f('0x4d')]['get']({'plain':!![]});if(!_0x269c5c)throw new Error(_0x622f('0x4e'));if(_0x269c5c[_0x622f('0x4f')]===_0x622f('0x4d')){var _0x1bc13b=_0x2a5130[_0x622f('0x29')]({'plain':!![]});var _0x799f3e='CustomDashboards';return db[_0x622f('0x50')][_0x622f('0x4a')]({'where':{'name':_0x799f3e,'userProfileId':_0x269c5c[_0x622f('0x51')]},'raw':!![]})[_0x622f('0x2c')](function(_0x1cd05b){if(_0x1cd05b&&_0x1cd05b[_0x622f('0x52')]===0x0){return db[_0x622f('0x2b')][_0x622f('0x4b')]({'name':_0x1bc13b['name'],'resourceId':_0x1bc13b['id'],'type':_0x1cd05b[_0x622f('0x2e')],'sectionId':_0x1cd05b['id']},{})['then'](function(){return _0x2a5130;});}else{return _0x2a5130;}})[_0x622f('0x47')](function(_0xfaa2af){logger[_0x622f('0x53')](_0x622f('0x54'),_0xfaa2af);throw _0xfaa2af;});}return _0x2a5130;})['then'](respondWithResult(_0x1e57e0,0xc9))[_0x622f('0x47')](handleError(_0x1e57e0,null));};exports[_0x622f('0x55')]=function(_0x5139fb,_0x479cd5){var _0x5f25b2={'where':{'id':_0x5139fb[_0x622f('0x56')]['id']}},_0x3df3c1={};_0x3df3c1[_0x622f('0x34')]=_[_0x622f('0x36')](db[_0x622f('0x44')]['rawAttributes']);_0x5f25b2[_0x622f('0x38')]=_['intersection'](_0x3df3c1[_0x622f('0x34')],qs[_0x622f('0x39')](_0x5139fb[_0x622f('0x35')][_0x622f('0x39')]));_0x5f25b2[_0x622f('0x38')]=_0x5f25b2[_0x622f('0x38')][_0x622f('0x3a')]?_0x5f25b2[_0x622f('0x38')]:_0x3df3c1[_0x622f('0x34')];if(_0x5139fb['query']['includeAll']){_0x5f25b2[_0x622f('0x46')]=[{'all':!![]}];}_0x5f25b2=_[_0x622f('0x40')]({},_0x5f25b2,_0x5139fb['options']);return db['Dashboard'][_0x622f('0x4a')](_0x5f25b2)[_0x622f('0x2c')](handleEntityNotFound(_0x479cd5,null))[_0x622f('0x2c')](function(_0x1e6c15){if(_0x1e6c15){var _0x3949e4=_0x1e6c15['get']({'plain':!![]});_0x3949e4=qs[_0x622f('0x57')](_0x3949e4,['id','createdAt',_0x622f('0x58')]);_0x5139fb[_0x622f('0x4c')]=_['omit'](_0x5139fb['body'],['id',_0x622f('0x59'),_0x622f('0x58')]);return db[_0x622f('0x44')][_0x622f('0x4b')](_[_0x622f('0x40')](_0x3949e4,_0x5139fb[_0x622f('0x4c')]),{'include':_0x5139fb['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x5f0f7f){var _0x362b53=_0x5139fb['user'][_0x622f('0x29')]({'plain':!![]});if(!_0x362b53)throw new Error(_0x622f('0x4e'));if(_0x362b53['role']===_0x622f('0x4d')){var _0x5ccf5e=_0x5f0f7f['get']({'plain':!![]});var _0xfefec7=_0x622f('0x2a');return db[_0x622f('0x50')][_0x622f('0x4a')]({'where':{'name':_0xfefec7,'userProfileId':_0x362b53[_0x622f('0x51')]},'raw':!![]})[_0x622f('0x2c')](function(_0x1ac69c){if(_0x1ac69c&&_0x1ac69c[_0x622f('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x5ccf5e[_0x622f('0x2e')],'resourceId':_0x5ccf5e['id'],'type':_0x1ac69c[_0x622f('0x2e')],'sectionId':_0x1ac69c['id']},{})[_0x622f('0x2c')](function(){return _0x5f0f7f;});}else{return _0x5f0f7f;}})[_0x622f('0x47')](function(_0x5748e2){logger['error'](_0x622f('0x54'),_0x5748e2);throw _0x5748e2;});}return _0x5f0f7f;});}})['then'](respondWithResult(_0x479cd5,0xc9))['catch'](handleError(_0x479cd5,null));};exports[_0x622f('0x27')]=function(_0x6d60c8,_0x237827){if(_0x6d60c8['body']['id']){delete _0x6d60c8[_0x622f('0x4c')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x6d60c8['params']['id']}})[_0x622f('0x2c')](handleEntityNotFound(_0x237827,null))[_0x622f('0x2c')](saveUpdates(_0x6d60c8[_0x622f('0x4c')],null))[_0x622f('0x2c')](respondWithResult(_0x237827,null))[_0x622f('0x47')](handleError(_0x237827,null));};exports[_0x622f('0x28')]=function(_0x407c9c,_0x5bf0b4){return db[_0x622f('0x44')][_0x622f('0x4a')]({'where':{'id':_0x407c9c[_0x622f('0x56')]['id']}})[_0x622f('0x2c')](handleEntityNotFound(_0x5bf0b4,null))[_0x622f('0x2c')](removeEntity(_0x5bf0b4,null))['catch'](handleError(_0x5bf0b4,null));};function widgetAttributes(_0x2aad32){try{switch(_0x2aad32[_0x622f('0x5a')]){case _0x622f('0x5b'):return[{'name':_0x622f('0x5c'),'value':_0x2aad32[_0x622f('0x5c')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32['attrs'][0x0]?_0x2aad32[_0x622f('0x5d')][0x0][_0x622f('0x5e')]:undefined)||_0x622f('0x5f')}];case _0x622f('0x60'):return[{'name':'attrPath','value':_0x2aad32[_0x622f('0x61')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x0]?_0x2aad32[_0x622f('0x5d')][0x0][_0x622f('0x5e')]:undefined)||''}];case _0x622f('0x62'):return[{'name':'attrHourFormat','value':_0x2aad32['attrHourFormat']||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x0]?_0x2aad32[_0x622f('0x5d')][0x0][_0x622f('0x5e')]:undefined)||_0x622f('0x63')},{'name':_0x622f('0x64'),'value':_0x2aad32['attrTimezone']||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x1]?_0x2aad32[_0x622f('0x5d')][0x1]['value']:undefined)||'0.00'},{'name':_0x622f('0x65'),'value':_0x2aad32[_0x622f('0x65')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x2]?_0x2aad32[_0x622f('0x5d')][0x2][_0x622f('0x5e')]:undefined)||0xc}];case _0x622f('0x66'):return[{'name':_0x622f('0x67'),'value':_0x2aad32[_0x622f('0x67')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32['attrs'][0x0]?_0x2aad32[_0x622f('0x5d')][0x0][_0x622f('0x5e')]:undefined)||'total'},{'name':_0x622f('0x68'),'value':_0x2aad32['attrVoiceQueues']||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x1]?_0x2aad32[_0x622f('0x5d')][0x1][_0x622f('0x5e')]:undefined)||[]},{'name':_0x622f('0x65'),'value':_0x2aad32[_0x622f('0x65')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x2]?_0x2aad32[_0x622f('0x5d')][0x2][_0x622f('0x5e')]:undefined)||0x14}];case _0x622f('0x69'):case _0x622f('0x6a'):return[{'name':_0x622f('0x6b'),'value':_0x2aad32[_0x622f('0x6b')]||(_0x2aad32['attrs']&&_0x2aad32['attrs'][0x0]?_0x2aad32[_0x622f('0x5d')][0x0]['value']:undefined)||'total'},{'name':_0x622f('0x6c'),'value':_0x2aad32[_0x622f('0x6c')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x1]?_0x2aad32[_0x622f('0x5d')][0x1][_0x622f('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x2aad32[_0x622f('0x6d')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x2]?_0x2aad32['attrs'][0x2]['value']:undefined)||null},{'name':_0x622f('0x68'),'value':_0x2aad32[_0x622f('0x68')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x3]?_0x2aad32['attrs'][0x3]['value']:undefined)||[]}];case _0x622f('0x6e'):return[{'name':_0x622f('0x6f'),'type':_0x2aad32[_0x622f('0x70')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32['attrs'][0x0]?_0x2aad32[_0x622f('0x5d')][0x0][_0x622f('0x5a')]:undefined)||null,'value':_0x2aad32[_0x622f('0x6f')]||(_0x2aad32['attrs']&&_0x2aad32['attrs'][0x0]?_0x2aad32[_0x622f('0x5d')][0x0]['value']:undefined)||null},{'name':_0x622f('0x71'),'value':_0x2aad32[_0x622f('0x71')]||(_0x2aad32[_0x622f('0x5d')]&&_0x2aad32[_0x622f('0x5d')][0x1]?_0x2aad32['attrs'][0x1][_0x622f('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x2b1d54){logger['error'](_0x622f('0x72'),JSON[_0x622f('0x73')](_0x2b1d54));return[];}}exports[_0x622f('0x74')]=function(_0x2f5ed6,_0x593d53,_0x5badfd){if(_0x2f5ed6[_0x622f('0x4c')]['id']){delete _0x2f5ed6[_0x622f('0x4c')]['id'];}return db[_0x622f('0x44')][_0x622f('0x4a')]({'where':{'id':_0x2f5ed6[_0x622f('0x56')]['id']}})[_0x622f('0x2c')](handleEntityNotFound(_0x593d53,null))['then'](function(_0x4d482a){if(_0x4d482a){_0x2f5ed6[_0x622f('0x4c')][_0x622f('0x75')]=_0x4d482a['id'];_0x2f5ed6[_0x622f('0x4c')][_0x622f('0x5d')]=widgetAttributes(_0x2f5ed6[_0x622f('0x4c')]);return db['DashboardItem'][_0x622f('0x4b')](_0x2f5ed6['body']);}})['then'](respondWithResult(_0x593d53,null))[_0x622f('0x47')](handleError(_0x593d53,null));};exports[_0x622f('0x76')]=function(_0x5092c1,_0x4eb20e,_0x577525){var _0x69b924={};var _0x54a256={};var _0x16aaa3;var _0x3df938;return db[_0x622f('0x44')][_0x622f('0x77')]({'where':{'id':_0x5092c1[_0x622f('0x56')]['id']}})[_0x622f('0x2c')](handleEntityNotFound(_0x4eb20e,null))[_0x622f('0x2c')](function(_0x5b2008){if(_0x5b2008){_0x16aaa3=_0x5b2008;_0x54a256[_0x622f('0x34')]=_['keys'](db[_0x622f('0x78')][_0x622f('0x49')]);_0x54a256[_0x622f('0x35')]=_['keys'](_0x5092c1[_0x622f('0x35')]);_0x54a256[_0x622f('0x3f')]=_[_0x622f('0x37')](_0x54a256[_0x622f('0x34')],_0x54a256['query']);_0x69b924[_0x622f('0x38')]=_[_0x622f('0x37')](_0x54a256[_0x622f('0x34')],qs[_0x622f('0x39')](_0x5092c1[_0x622f('0x35')][_0x622f('0x39')]));_0x69b924[_0x622f('0x38')]=_0x69b924[_0x622f('0x38')][_0x622f('0x3a')]?_0x69b924[_0x622f('0x38')]:_0x54a256[_0x622f('0x34')];_0x69b924[_0x622f('0x79')]=qs[_0x622f('0x3d')](_0x5092c1[_0x622f('0x35')][_0x622f('0x3d')]);_0x69b924[_0x622f('0x3e')]=qs[_0x622f('0x3f')](_[_0x622f('0x7a')](_0x5092c1[_0x622f('0x35')],_0x54a256[_0x622f('0x3f')]));if(_0x5092c1[_0x622f('0x35')][_0x622f('0x42')]){_0x69b924[_0x622f('0x3e')]=_[_0x622f('0x40')](_0x69b924[_0x622f('0x3e')],{'$or':_[_0x622f('0x31')](_0x69b924[_0x622f('0x38')],function(_0x5896cb){var _0xc15f7a={};_0xc15f7a[_0x5896cb]={'$like':'%'+_0x5092c1[_0x622f('0x35')]['filter']+'%'};return _0xc15f7a;})});}_0x69b924=_[_0x622f('0x40')]({},_0x69b924,_0x5092c1[_0x622f('0x43')]);return _0x16aaa3['getItems'](_0x69b924);}})[_0x622f('0x2c')](function(_0x54b492){if(_0x54b492){_0x3df938=_0x54b492['length'];if(!_0x5092c1[_0x622f('0x35')][_0x622f('0x3b')](_0x622f('0x3c'))){_0x69b924[_0x622f('0x22')]=qs[_0x622f('0x22')](_0x5092c1[_0x622f('0x35')][_0x622f('0x22')]);_0x69b924[_0x622f('0x20')]=qs[_0x622f('0x20')](_0x5092c1[_0x622f('0x35')]['offset']);}return _0x16aaa3[_0x622f('0x76')](_0x69b924);}})[_0x622f('0x2c')](function(_0x3d575d){if(_0x3d575d){return _0x3d575d?{'count':_0x3df938,'rows':_0x3d575d}:null;}})[_0x622f('0x2c')](respondWithResult(_0x4eb20e,null))[_0x622f('0x47')](handleError(_0x4eb20e,null));}; \ No newline at end of file +var _0x4d60=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','user','role','CustomDashboards','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','UserProfileSection','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','sort','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x447919,_0x1a0776){var _0x4cd546=function(_0x2f61b0){while(--_0x2f61b0){_0x447919['push'](_0x447919['shift']());}};_0x4cd546(++_0x1a0776);}(_0x4d60,0x1e3));var _0x04d6=function(_0x233494,_0x498a62){_0x233494=_0x233494-0x0;var _0x4547f9=_0x4d60[_0x233494];return _0x4547f9;};'use strict';var emlformat=require(_0x04d6('0x0'));var rimraf=require(_0x04d6('0x1'));var zipdir=require(_0x04d6('0x2'));var jsonpatch=require(_0x04d6('0x3'));var rp=require(_0x04d6('0x4'));var moment=require(_0x04d6('0x5'));var BPromise=require(_0x04d6('0x6'));var Mustache=require(_0x04d6('0x7'));var util=require(_0x04d6('0x8'));var path=require(_0x04d6('0x9'));var sox=require(_0x04d6('0xa'));var csv=require(_0x04d6('0xb'));var ejs=require(_0x04d6('0xc'));var fs=require('fs');var fs_extra=require(_0x04d6('0xd'));var _=require(_0x04d6('0xe'));var squel=require(_0x04d6('0xf'));var crypto=require('crypto');var jsforce=require(_0x04d6('0x10'));var deskjs=require(_0x04d6('0x11'));var toCsv=require(_0x04d6('0xb'));var querystring=require(_0x04d6('0x12'));var Papa=require(_0x04d6('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x04d6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04d6('0x15'));var logger=require(_0x04d6('0x16'))('api');var utils=require(_0x04d6('0x17'));var config=require(_0x04d6('0x18'));var licenseUtil=require(_0x04d6('0x19'));var db=require(_0x04d6('0x1a'))['db'];config[_0x04d6('0x1b')]=_['defaults'](config[_0x04d6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04d6('0x1b')]));require(_0x04d6('0x1c'))[_0x04d6('0x1d')](socket);function respondWithStatusCode(_0x4c5269,_0x95337a){_0x95337a=_0x95337a||0xcc;return function(_0x411c65){if(_0x411c65){return _0x4c5269[_0x04d6('0x1e')](_0x95337a);}return _0x4c5269[_0x04d6('0x1f')](_0x95337a)[_0x04d6('0x20')]();};}function respondWithResult(_0x597698,_0x17049b){_0x17049b=_0x17049b||0xc8;return function(_0x2a4868){if(_0x2a4868){return _0x597698[_0x04d6('0x1f')](_0x17049b)[_0x04d6('0x21')](_0x2a4868);}};}function respondWithFilteredResult(_0x5c55bc,_0x2e9866){return function(_0x1384b0){if(_0x1384b0){var _0x214043=typeof _0x2e9866[_0x04d6('0x22')]===_0x04d6('0x23')&&typeof _0x2e9866['limit']===_0x04d6('0x23');var _0x3d1d23=_0x1384b0[_0x04d6('0x24')];var _0x4e71e5=_0x214043?0x0:_0x2e9866['offset'];var _0x14ae63=_0x214043?_0x1384b0[_0x04d6('0x24')]:_0x2e9866[_0x04d6('0x22')]+_0x2e9866['limit'];var _0x4e4575;if(_0x14ae63>=_0x3d1d23){_0x14ae63=_0x3d1d23;_0x4e4575=0xc8;}else{_0x4e4575=0xce;}_0x5c55bc[_0x04d6('0x1f')](_0x4e4575);return _0x5c55bc[_0x04d6('0x25')](_0x04d6('0x26'),_0x4e71e5+'-'+_0x14ae63+'/'+_0x3d1d23)[_0x04d6('0x21')](_0x1384b0);}return null;};}function patchUpdates(_0x4560f1){return function(_0xca6b35){try{jsonpatch[_0x04d6('0x27')](_0xca6b35,_0x4560f1,!![]);}catch(_0x455b9f){return BPromise['reject'](_0x455b9f);}return _0xca6b35[_0x04d6('0x28')]();};}function saveUpdates(_0x2d44ba,_0xe3bfb6){return function(_0x29b842){if(_0x29b842){return _0x29b842[_0x04d6('0x29')](_0x2d44ba)[_0x04d6('0x2a')](function(_0x412aa7){return _0x412aa7;});}return null;};}function removeEntity(_0x11b0ff,_0x53df16){return function(_0x45287b){if(_0x45287b){return _0x45287b[_0x04d6('0x2b')]()[_0x04d6('0x2a')](function(){var _0x2f0392=_0x45287b[_0x04d6('0x2c')]({'plain':!![]});var _0x19fba1='CustomDashboards';return db[_0x04d6('0x2d')][_0x04d6('0x2b')]({'where':{'type':_0x19fba1,'resourceId':_0x2f0392['id']}})[_0x04d6('0x2a')](function(){return _0x45287b;});})[_0x04d6('0x2a')](function(){_0x11b0ff['status'](0xcc)[_0x04d6('0x20')]();});}};}function handleEntityNotFound(_0xe00654,_0x242c44){return function(_0x1a4a9b){if(!_0x1a4a9b){_0xe00654['sendStatus'](0x194);}return _0x1a4a9b;};}function handleError(_0xc0729a,_0x2664be){_0x2664be=_0x2664be||0x1f4;return function(_0xe23b57){logger[_0x04d6('0x2e')](_0xe23b57[_0x04d6('0x2f')]);if(_0xe23b57[_0x04d6('0x30')]){delete _0xe23b57['name'];}_0xc0729a['status'](_0x2664be)[_0x04d6('0x31')](_0xe23b57);};}exports[_0x04d6('0x32')]=function(_0x510889,_0x417c06){var _0x372c9e={},_0x36c966={},_0x54aef1={'count':0x0,'rows':[]};var _0x18038b=_[_0x04d6('0x33')](db[_0x04d6('0x34')][_0x04d6('0x35')],function(_0x5a682f){return{'name':_0x5a682f['fieldName'],'type':_0x5a682f['type'][_0x04d6('0x36')]};});_0x36c966['model']=_[_0x04d6('0x33')](_0x18038b,_0x04d6('0x30'));_0x36c966['query']=_[_0x04d6('0x37')](_0x510889['query']);_0x36c966[_0x04d6('0x38')]=_[_0x04d6('0x39')](_0x36c966[_0x04d6('0x3a')],_0x36c966[_0x04d6('0x3b')]);_0x372c9e[_0x04d6('0x3c')]=_[_0x04d6('0x39')](_0x36c966[_0x04d6('0x3a')],qs[_0x04d6('0x3d')](_0x510889[_0x04d6('0x3b')][_0x04d6('0x3d')]));_0x372c9e[_0x04d6('0x3c')]=_0x372c9e[_0x04d6('0x3c')][_0x04d6('0x3e')]?_0x372c9e[_0x04d6('0x3c')]:_0x36c966[_0x04d6('0x3a')];if(!_0x510889[_0x04d6('0x3b')][_0x04d6('0x3f')](_0x04d6('0x40'))){_0x372c9e['limit']=qs[_0x04d6('0x41')](_0x510889[_0x04d6('0x3b')][_0x04d6('0x41')]);_0x372c9e[_0x04d6('0x22')]=qs['offset'](_0x510889['query'][_0x04d6('0x22')]);}_0x372c9e[_0x04d6('0x42')]=qs['sort'](_0x510889[_0x04d6('0x3b')]['sort']);_0x372c9e[_0x04d6('0x43')]=qs[_0x04d6('0x38')](_['pick'](_0x510889['query'],_0x36c966[_0x04d6('0x38')]),_0x18038b);if(_0x510889['query'][_0x04d6('0x44')]){_0x372c9e[_0x04d6('0x43')]=_[_0x04d6('0x45')](_0x372c9e[_0x04d6('0x43')],{'$or':_[_0x04d6('0x33')](_0x18038b,function(_0x238716){if(_0x238716[_0x04d6('0x46')]!==_0x04d6('0x47')){var _0x223a62={};_0x223a62[_0x238716['name']]={'$like':'%'+_0x510889[_0x04d6('0x3b')]['filter']+'%'};return _0x223a62;}})});}_0x372c9e=_[_0x04d6('0x45')]({},_0x372c9e,_0x510889['options']);var _0x49a8c0={'where':_0x372c9e[_0x04d6('0x43')]};return db[_0x04d6('0x34')][_0x04d6('0x24')](_0x49a8c0)[_0x04d6('0x2a')](function(_0x2ee35a){_0x54aef1['count']=_0x2ee35a;if(_0x510889[_0x04d6('0x3b')][_0x04d6('0x48')]){_0x372c9e[_0x04d6('0x49')]=[{'all':!![]}];}return db[_0x04d6('0x34')]['findAll'](_0x372c9e);})[_0x04d6('0x2a')](function(_0x229d77){_0x54aef1[_0x04d6('0x4a')]=_0x229d77;return _0x54aef1;})[_0x04d6('0x2a')](respondWithFilteredResult(_0x417c06,_0x372c9e))[_0x04d6('0x4b')](handleError(_0x417c06,null));};exports[_0x04d6('0x4c')]=function(_0x3b5d56,_0x3892f8){var _0x409ae6={'raw':![],'where':{'id':_0x3b5d56['params']['id']}},_0x4b08c4={};_0x4b08c4[_0x04d6('0x3a')]=_['keys'](db[_0x04d6('0x34')][_0x04d6('0x35')]);_0x4b08c4[_0x04d6('0x3b')]=_[_0x04d6('0x37')](_0x3b5d56['query']);_0x4b08c4[_0x04d6('0x38')]=_[_0x04d6('0x39')](_0x4b08c4['model'],_0x4b08c4[_0x04d6('0x3b')]);_0x409ae6[_0x04d6('0x3c')]=_[_0x04d6('0x39')](_0x4b08c4['model'],qs[_0x04d6('0x3d')](_0x3b5d56[_0x04d6('0x3b')][_0x04d6('0x3d')]));_0x409ae6[_0x04d6('0x3c')]=_0x409ae6[_0x04d6('0x3c')][_0x04d6('0x3e')]?_0x409ae6['attributes']:_0x4b08c4[_0x04d6('0x3a')];if(_0x3b5d56[_0x04d6('0x3b')]['includeAll']){_0x409ae6[_0x04d6('0x49')]=[{'all':!![]}];}_0x409ae6=_[_0x04d6('0x45')]({},_0x409ae6,_0x3b5d56[_0x04d6('0x4d')]);return db[_0x04d6('0x34')][_0x04d6('0x4e')](_0x409ae6)[_0x04d6('0x2a')](handleEntityNotFound(_0x3892f8,null))[_0x04d6('0x2a')](respondWithResult(_0x3892f8,null))['catch'](handleError(_0x3892f8,null));};exports[_0x04d6('0x4f')]=function(_0x40a71c,_0x223520){return db[_0x04d6('0x34')][_0x04d6('0x4f')](_0x40a71c[_0x04d6('0x50')],{})['then'](function(_0x1a1793){var _0x5d6e8a=_0x40a71c[_0x04d6('0x51')]['get']({'plain':!![]});if(!_0x5d6e8a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d6e8a[_0x04d6('0x52')]===_0x04d6('0x51')){var _0x255d54=_0x1a1793[_0x04d6('0x2c')]({'plain':!![]});var _0x5304bd=_0x04d6('0x53');return db['UserProfileSection'][_0x04d6('0x4e')]({'where':{'name':_0x5304bd,'userProfileId':_0x5d6e8a[_0x04d6('0x54')]},'raw':!![]})[_0x04d6('0x2a')](function(_0x4b0e58){if(_0x4b0e58&&_0x4b0e58[_0x04d6('0x55')]===0x0){return db[_0x04d6('0x2d')][_0x04d6('0x4f')]({'name':_0x255d54['name'],'resourceId':_0x255d54['id'],'type':_0x4b0e58[_0x04d6('0x30')],'sectionId':_0x4b0e58['id']},{})[_0x04d6('0x2a')](function(){return _0x1a1793;});}else{return _0x1a1793;}})[_0x04d6('0x4b')](function(_0x49acbe){logger[_0x04d6('0x2e')](_0x04d6('0x56'),_0x49acbe);throw _0x49acbe;});}return _0x1a1793;})[_0x04d6('0x2a')](respondWithResult(_0x223520,0xc9))['catch'](handleError(_0x223520,null));};exports[_0x04d6('0x57')]=function(_0x8f8e2e,_0x147af6){var _0x20c8fe={'where':{'id':_0x8f8e2e[_0x04d6('0x58')]['id']}},_0xb90e8b={};_0xb90e8b[_0x04d6('0x3a')]=_['keys'](db[_0x04d6('0x34')][_0x04d6('0x35')]);_0x20c8fe[_0x04d6('0x3c')]=_[_0x04d6('0x39')](_0xb90e8b['model'],qs['fields'](_0x8f8e2e[_0x04d6('0x3b')][_0x04d6('0x3d')]));_0x20c8fe[_0x04d6('0x3c')]=_0x20c8fe[_0x04d6('0x3c')][_0x04d6('0x3e')]?_0x20c8fe['attributes']:_0xb90e8b[_0x04d6('0x3a')];if(_0x8f8e2e[_0x04d6('0x3b')][_0x04d6('0x48')]){_0x20c8fe[_0x04d6('0x49')]=[{'all':!![]}];}_0x20c8fe=_['merge']({},_0x20c8fe,_0x8f8e2e[_0x04d6('0x4d')]);return db[_0x04d6('0x34')][_0x04d6('0x4e')](_0x20c8fe)[_0x04d6('0x2a')](handleEntityNotFound(_0x147af6,null))[_0x04d6('0x2a')](function(_0x3ad90f){if(_0x3ad90f){var _0x2a818f=_0x3ad90f['get']({'plain':!![]});_0x2a818f=qs[_0x04d6('0x59')](_0x2a818f,['id',_0x04d6('0x5a'),_0x04d6('0x5b')]);_0x8f8e2e['body']=_['omit'](_0x8f8e2e[_0x04d6('0x50')],['id',_0x04d6('0x5a'),_0x04d6('0x5b')]);return db['Dashboard'][_0x04d6('0x4f')](_[_0x04d6('0x45')](_0x2a818f,_0x8f8e2e[_0x04d6('0x50')]),{'include':_0x8f8e2e['query'][_0x04d6('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x543d8d){var _0x5d9234=_0x8f8e2e[_0x04d6('0x51')][_0x04d6('0x2c')]({'plain':!![]});if(!_0x5d9234)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d9234[_0x04d6('0x52')]===_0x04d6('0x51')){var _0x5ba176=_0x543d8d[_0x04d6('0x2c')]({'plain':!![]});var _0x3dfd44=_0x04d6('0x53');return db[_0x04d6('0x5c')][_0x04d6('0x4e')]({'where':{'name':_0x3dfd44,'userProfileId':_0x5d9234['userProfileId']},'raw':!![]})[_0x04d6('0x2a')](function(_0x568f99){if(_0x568f99&&_0x568f99[_0x04d6('0x55')]===0x0){return db[_0x04d6('0x2d')]['create']({'name':_0x5ba176[_0x04d6('0x30')],'resourceId':_0x5ba176['id'],'type':_0x568f99[_0x04d6('0x30')],'sectionId':_0x568f99['id']},{})[_0x04d6('0x2a')](function(){return _0x543d8d;});}else{return _0x543d8d;}})['catch'](function(_0x1c56f0){logger[_0x04d6('0x2e')](_0x04d6('0x56'),_0x1c56f0);throw _0x1c56f0;});}return _0x543d8d;});}})[_0x04d6('0x2a')](respondWithResult(_0x147af6,0xc9))['catch'](handleError(_0x147af6,null));};exports[_0x04d6('0x29')]=function(_0x2bcca0,_0x1dd762){if(_0x2bcca0[_0x04d6('0x50')]['id']){delete _0x2bcca0[_0x04d6('0x50')]['id'];}return db['Dashboard'][_0x04d6('0x4e')]({'where':{'id':_0x2bcca0['params']['id']}})[_0x04d6('0x2a')](handleEntityNotFound(_0x1dd762,null))[_0x04d6('0x2a')](saveUpdates(_0x2bcca0[_0x04d6('0x50')],null))['then'](respondWithResult(_0x1dd762,null))[_0x04d6('0x4b')](handleError(_0x1dd762,null));};exports[_0x04d6('0x2b')]=function(_0x5a97a3,_0x473360){return db['Dashboard'][_0x04d6('0x4e')]({'where':{'id':_0x5a97a3[_0x04d6('0x58')]['id']}})[_0x04d6('0x2a')](handleEntityNotFound(_0x473360,null))[_0x04d6('0x2a')](removeEntity(_0x473360,null))[_0x04d6('0x4b')](handleError(_0x473360,null));};function widgetAttributes(_0x2d9fab){try{switch(_0x2d9fab[_0x04d6('0x46')]){case _0x04d6('0x5d'):return[{'name':_0x04d6('0x5e'),'value':_0x2d9fab[_0x04d6('0x5e')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x0]?_0x2d9fab[_0x04d6('0x5f')][0x0][_0x04d6('0x60')]:undefined)||_0x04d6('0x61')}];case'custom':return[{'name':_0x04d6('0x62'),'value':_0x2d9fab['attrPath']||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x0]?_0x2d9fab[_0x04d6('0x5f')][0x0]['value']:undefined)||''}];case _0x04d6('0x63'):return[{'name':_0x04d6('0x64'),'value':_0x2d9fab[_0x04d6('0x64')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x0]?_0x2d9fab[_0x04d6('0x5f')][0x0][_0x04d6('0x60')]:undefined)||'HH:mm:ss'},{'name':_0x04d6('0x65'),'value':_0x2d9fab[_0x04d6('0x65')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab['attrs'][0x1]?_0x2d9fab[_0x04d6('0x5f')][0x1][_0x04d6('0x60')]:undefined)||_0x04d6('0x66')},{'name':_0x04d6('0x67'),'value':_0x2d9fab[_0x04d6('0x67')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab['attrs'][0x2]?_0x2d9fab[_0x04d6('0x5f')][0x2]['value']:undefined)||0xc}];case _0x04d6('0x68'):return[{'name':_0x04d6('0x69'),'value':_0x2d9fab[_0x04d6('0x69')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x0]?_0x2d9fab[_0x04d6('0x5f')][0x0][_0x04d6('0x60')]:undefined)||'total'},{'name':_0x04d6('0x6a'),'value':_0x2d9fab['attrVoiceQueues']||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab['attrs'][0x1]?_0x2d9fab['attrs'][0x1][_0x04d6('0x60')]:undefined)||[]},{'name':_0x04d6('0x67'),'value':_0x2d9fab[_0x04d6('0x67')]||(_0x2d9fab['attrs']&&_0x2d9fab['attrs'][0x2]?_0x2d9fab[_0x04d6('0x5f')][0x2][_0x04d6('0x60')]:undefined)||0x14}];case _0x04d6('0x6b'):case _0x04d6('0x6c'):return[{'name':_0x04d6('0x6d'),'value':_0x2d9fab[_0x04d6('0x6d')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x0]?_0x2d9fab[_0x04d6('0x5f')][0x0][_0x04d6('0x60')]:undefined)||_0x04d6('0x6e')},{'name':_0x04d6('0x6f'),'value':_0x2d9fab[_0x04d6('0x6f')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x1]?_0x2d9fab[_0x04d6('0x5f')][0x1][_0x04d6('0x60')]:undefined)||null},{'name':_0x04d6('0x70'),'value':_0x2d9fab[_0x04d6('0x70')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x2]?_0x2d9fab['attrs'][0x2]['value']:undefined)||null},{'name':_0x04d6('0x6a'),'value':_0x2d9fab[_0x04d6('0x6a')]||(_0x2d9fab['attrs']&&_0x2d9fab[_0x04d6('0x5f')][0x3]?_0x2d9fab['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x04d6('0x71'),'type':_0x2d9fab[_0x04d6('0x72')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x0]?_0x2d9fab['attrs'][0x0][_0x04d6('0x46')]:undefined)||null,'value':_0x2d9fab[_0x04d6('0x71')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x0]?_0x2d9fab[_0x04d6('0x5f')][0x0][_0x04d6('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0x2d9fab[_0x04d6('0x73')]||(_0x2d9fab[_0x04d6('0x5f')]&&_0x2d9fab[_0x04d6('0x5f')][0x1]?_0x2d9fab[_0x04d6('0x5f')][0x1][_0x04d6('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x4ceeef){logger['error']('widgetAttributes:\x20%s',JSON[_0x04d6('0x74')](_0x4ceeef));return[];}}exports[_0x04d6('0x75')]=function(_0x3916f4,_0x3ebc9c,_0x37bf68){if(_0x3916f4[_0x04d6('0x50')]['id']){delete _0x3916f4[_0x04d6('0x50')]['id'];}return db['Dashboard'][_0x04d6('0x4e')]({'where':{'id':_0x3916f4[_0x04d6('0x58')]['id']}})[_0x04d6('0x2a')](handleEntityNotFound(_0x3ebc9c,null))['then'](function(_0x54e4d6){if(_0x54e4d6){_0x3916f4[_0x04d6('0x50')][_0x04d6('0x76')]=_0x54e4d6['id'];_0x3916f4[_0x04d6('0x50')][_0x04d6('0x5f')]=widgetAttributes(_0x3916f4['body']);return db[_0x04d6('0x77')]['create'](_0x3916f4[_0x04d6('0x50')]);}})['then'](respondWithResult(_0x3ebc9c,null))[_0x04d6('0x4b')](handleError(_0x3ebc9c,null));};exports[_0x04d6('0x78')]=function(_0x19edd4,_0x23ffd8,_0x4908bc){var _0x3f637d={};var _0x5920c2={};var _0x1602c5;var _0x343699;return db[_0x04d6('0x34')][_0x04d6('0x79')]({'where':{'id':_0x19edd4[_0x04d6('0x58')]['id']}})['then'](handleEntityNotFound(_0x23ffd8,null))['then'](function(_0xdeeb51){if(_0xdeeb51){_0x1602c5=_0xdeeb51;_0x5920c2[_0x04d6('0x3a')]=_[_0x04d6('0x37')](db[_0x04d6('0x77')][_0x04d6('0x35')]);_0x5920c2[_0x04d6('0x3b')]=_['keys'](_0x19edd4[_0x04d6('0x3b')]);_0x5920c2[_0x04d6('0x38')]=_['intersection'](_0x5920c2['model'],_0x5920c2[_0x04d6('0x3b')]);_0x3f637d[_0x04d6('0x3c')]=_[_0x04d6('0x39')](_0x5920c2[_0x04d6('0x3a')],qs[_0x04d6('0x3d')](_0x19edd4[_0x04d6('0x3b')]['fields']));_0x3f637d[_0x04d6('0x3c')]=_0x3f637d[_0x04d6('0x3c')][_0x04d6('0x3e')]?_0x3f637d[_0x04d6('0x3c')]:_0x5920c2['model'];_0x3f637d[_0x04d6('0x42')]=qs[_0x04d6('0x7a')](_0x19edd4[_0x04d6('0x3b')][_0x04d6('0x7a')]);_0x3f637d['where']=qs[_0x04d6('0x38')](_[_0x04d6('0x7b')](_0x19edd4[_0x04d6('0x3b')],_0x5920c2[_0x04d6('0x38')]));if(_0x19edd4[_0x04d6('0x3b')]['filter']){_0x3f637d[_0x04d6('0x43')]=_[_0x04d6('0x45')](_0x3f637d[_0x04d6('0x43')],{'$or':_[_0x04d6('0x33')](_0x3f637d[_0x04d6('0x3c')],function(_0x4a7fb1){var _0x43fb5a={};_0x43fb5a[_0x4a7fb1]={'$like':'%'+_0x19edd4['query'][_0x04d6('0x44')]+'%'};return _0x43fb5a;})});}_0x3f637d=_[_0x04d6('0x45')]({},_0x3f637d,_0x19edd4[_0x04d6('0x4d')]);return _0x1602c5[_0x04d6('0x78')](_0x3f637d);}})[_0x04d6('0x2a')](function(_0x3617ca){if(_0x3617ca){_0x343699=_0x3617ca[_0x04d6('0x3e')];if(!_0x19edd4[_0x04d6('0x3b')][_0x04d6('0x3f')](_0x04d6('0x40'))){_0x3f637d[_0x04d6('0x41')]=qs[_0x04d6('0x41')](_0x19edd4[_0x04d6('0x3b')]['limit']);_0x3f637d[_0x04d6('0x22')]=qs[_0x04d6('0x22')](_0x19edd4['query']['offset']);}return _0x1602c5[_0x04d6('0x78')](_0x3f637d);}})[_0x04d6('0x2a')](function(_0x3fe7f7){if(_0x3fe7f7){return _0x3fe7f7?{'count':_0x343699,'rows':_0x3fe7f7}:null;}})[_0x04d6('0x2a')](respondWithResult(_0x23ffd8,null))['catch'](handleError(_0x23ffd8,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 4824cd7..678cfc7 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 _0x0d8b=['remove','emit','hook','events','../../mysqldb','Dashboard','setMaxListeners','save','update'];(function(_0x361502,_0x57844b){var _0xe88b05=function(_0x5b851d){while(--_0x5b851d){_0x361502['push'](_0x361502['shift']());}};_0xe88b05(++_0x57844b);}(_0x0d8b,0x8a));var _0xb0d8=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0x0d8b[_0x208d75];return _0x382d27;};'use strict';var EventEmitter=require(_0xb0d8('0x0'));var Dashboard=require(_0xb0d8('0x1'))['db'][_0xb0d8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb0d8('0x3')](0x0);var events={'afterCreate':_0xb0d8('0x4'),'afterUpdate':_0xb0d8('0x5'),'afterDestroy':_0xb0d8('0x6')};function emitEvent(_0x5091ff){return function(_0x37aac0,_0x4c34c2,_0x50c717){DashboardEvents[_0xb0d8('0x7')](_0x5091ff+':'+_0x37aac0['id'],_0x37aac0);DashboardEvents[_0xb0d8('0x7')](_0x5091ff,_0x37aac0);_0x50c717(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xb0d8('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x9e0c=['update','remove','emit','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x529a26,_0x149b7e){var _0x5eec66=function(_0x5a3f0f){while(--_0x5a3f0f){_0x529a26['push'](_0x529a26['shift']());}};_0x5eec66(++_0x149b7e);}(_0x9e0c,0x194));var _0xc9e0=function(_0x24fc34,_0x1c1e06){_0x24fc34=_0x24fc34-0x0;var _0x2fc6b5=_0x9e0c[_0x24fc34];return _0x2fc6b5;};'use strict';var EventEmitter=require(_0xc9e0('0x0'));var Dashboard=require(_0xc9e0('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc9e0('0x2')](0x0);var events={'afterCreate':_0xc9e0('0x3'),'afterUpdate':_0xc9e0('0x4'),'afterDestroy':_0xc9e0('0x5')};function emitEvent(_0x58c9b8){return function(_0xd59665,_0x4c1d12,_0x1e6bc1){DashboardEvents[_0xc9e0('0x6')](_0x58c9b8+':'+_0xd59665['id'],_0xd59665);DashboardEvents[_0xc9e0('0x6')](_0x58c9b8,_0xd59665);_0x1e6bc1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xc9e0('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f4cb4c1..4a9079d 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 _0x921b=['api','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x921b,0x1a3));var _0xb921=function(_0x203d01,_0x1884bc){_0x203d01=_0x203d01-0x0;var _0x1074d2=_0x921b[_0x203d01];return _0x1074d2;};'use strict';var _=require(_0xb921('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb921('0x1'));var moment=require(_0xb921('0x2'));var BPromise=require('bluebird');var rp=require(_0xb921('0x3'));var fs=require('fs');var path=require(_0xb921('0x4'));var rimraf=require(_0xb921('0x5'));var config=require(_0xb921('0x6'));var attributes=require(_0xb921('0x7'));module[_0xb921('0x8')]=function(_0x3a86d1,_0x310409){return _0x3a86d1[_0xb921('0x9')](_0xb921('0xa'),attributes,{'tableName':_0xb921('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f83=['path','rimraf','./dashboard.attributes','define','util','api','moment'];(function(_0x209659,_0x424b92){var _0x32670f=function(_0x5a2c6b){while(--_0x5a2c6b){_0x209659['push'](_0x209659['shift']());}};_0x32670f(++_0x424b92);}(_0x6f83,0x154));var _0x36f8=function(_0x3a1ba0,_0x5c6dce){_0x3a1ba0=_0x3a1ba0-0x0;var _0x661e48=_0x6f83[_0x3a1ba0];return _0x661e48;};'use strict';var _=require('lodash');var util=require(_0x36f8('0x0'));var logger=require('../../config/logger')(_0x36f8('0x1'));var moment=require(_0x36f8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x36f8('0x3'));var rimraf=require(_0x36f8('0x4'));var config=require('../../config/environment');var attributes=require(_0x36f8('0x5'));module['exports']=function(_0x517ce6,_0x184f73){return _0x517ce6[_0x36f8('0x6')]('Dashboard',attributes,{'tableName':'dashboards','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 b24b075..9069d59 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 _0xf025=['then','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','message','Dashboard,\x20%s,\x20%s','info','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request'];(function(_0x239361,_0x2e74a2){var _0x516911=function(_0x427234){while(--_0x427234){_0x239361['push'](_0x239361['shift']());}};_0x516911(++_0x2e74a2);}(_0xf025,0x93));var _0x5f02=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0xf025[_0x30faee];return _0x3a90ab;};'use strict';var _=require('lodash');var util=require(_0x5f02('0x0'));var moment=require('moment');var BPromise=require(_0x5f02('0x1'));var rs=require(_0x5f02('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f02('0x3'))['db'];var utils=require(_0x5f02('0x4'));var logger=require(_0x5f02('0x5'))('rpc');var config=require(_0x5f02('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5f02('0x7')]=_[_0x5f02('0x8')](config['redis'],{'host':_0x5f02('0x9'),'port':0x18eb});var socket=require(_0x5f02('0xa'))(new Redis(config[_0x5f02('0x7')]));require(_0x5f02('0xb'))['register'](socket);function respondWithRpcPromise(_0x4153e8,_0x3b9700,_0x13aa68){return new BPromise(function(_0x13620f,_0x18ace2){return client[_0x5f02('0xc')](_0x4153e8,_0x13aa68)[_0x5f02('0xd')](function(_0x3cd2c5){logger['info']('Dashboard,\x20%s,\x20%s',_0x3b9700,_0x5f02('0xe'));logger['debug'](_0x5f02('0xf'),_0x3b9700,_0x5f02('0xe'),JSON['stringify'](_0x3cd2c5));if(_0x3cd2c5[_0x5f02('0x10')]){if(_0x3cd2c5['error']['code']===0x1f4){logger[_0x5f02('0x10')]('Dashboard,\x20%s,\x20%s',_0x3b9700,_0x3cd2c5[_0x5f02('0x10')][_0x5f02('0x11')]);return _0x18ace2(_0x3cd2c5['error'][_0x5f02('0x11')]);}logger['error'](_0x5f02('0x12'),_0x3b9700,_0x3cd2c5[_0x5f02('0x10')][_0x5f02('0x11')]);return _0x13620f(_0x3cd2c5[_0x5f02('0x10')]['message']);}else{logger[_0x5f02('0x13')](_0x5f02('0x12'),_0x3b9700,_0x5f02('0xe'));_0x13620f(_0x3cd2c5['result'][_0x5f02('0x11')]);}})['catch'](function(_0x18eb6a){logger['error'](_0x5f02('0x12'),_0x3b9700,_0x18eb6a);_0x18ace2(_0x18eb6a);});});} \ No newline at end of file +var _0x6ebd=['stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./dashboard.socket','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x5cccb4,_0x3f7e91){var _0x4fe1e8=function(_0x29e4ea){while(--_0x29e4ea){_0x5cccb4['push'](_0x5cccb4['shift']());}};_0x4fe1e8(++_0x3f7e91);}(_0x6ebd,0xf6));var _0xd6eb=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x6ebd[_0x29b609];return _0x54c952;};'use strict';var _=require('lodash');var util=require(_0xd6eb('0x0'));var moment=require(_0xd6eb('0x1'));var BPromise=require('bluebird');var rs=require(_0xd6eb('0x2'));var fs=require('fs');var Redis=require(_0xd6eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6eb('0x4'));var logger=require(_0xd6eb('0x5'))(_0xd6eb('0x6'));var config=require(_0xd6eb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd6eb('0x8')][_0xd6eb('0x9')]({'port':0x232a});config[_0xd6eb('0xa')]=_[_0xd6eb('0xb')](config[_0xd6eb('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd6eb('0xc'))['register'](socket);function respondWithRpcPromise(_0x59c620,_0x41cc26,_0x1c8d1d){return new BPromise(function(_0x59cffd,_0x134ba2){return client[_0xd6eb('0xd')](_0x59c620,_0x1c8d1d)['then'](function(_0x4b736f){logger['info'](_0xd6eb('0xe'),_0x41cc26,_0xd6eb('0xf'));logger[_0xd6eb('0x10')](_0xd6eb('0x11'),_0x41cc26,'request\x20sent',JSON[_0xd6eb('0x12')](_0x4b736f));if(_0x4b736f[_0xd6eb('0x13')]){if(_0x4b736f[_0xd6eb('0x13')][_0xd6eb('0x14')]===0x1f4){logger[_0xd6eb('0x13')]('Dashboard,\x20%s,\x20%s',_0x41cc26,_0x4b736f['error']['message']);return _0x134ba2(_0x4b736f[_0xd6eb('0x13')][_0xd6eb('0x15')]);}logger[_0xd6eb('0x13')](_0xd6eb('0xe'),_0x41cc26,_0x4b736f['error']['message']);return _0x59cffd(_0x4b736f[_0xd6eb('0x13')][_0xd6eb('0x15')]);}else{logger['info'](_0xd6eb('0xe'),_0x41cc26,_0xd6eb('0xf'));_0x59cffd(_0x4b736f[_0xd6eb('0x16')][_0xd6eb('0x15')]);}})[_0xd6eb('0x17')](function(_0x43d409){logger['error']('Dashboard,\x20%s,\x20%s',_0x41cc26,_0x43d409);_0x134ba2(_0x43d409);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ffb9795..ee7b92e 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 _0x399e=['remove','update','emit','removeListener','length','dashboard:','./dashboard.events','save'];(function(_0x3ec32d,_0x189fd4){var _0xd30d38=function(_0x2bf7bb){while(--_0x2bf7bb){_0x3ec32d['push'](_0x3ec32d['shift']());}};_0xd30d38(++_0x189fd4);}(_0x399e,0x106));var _0xe399=function(_0x4cbb8e,_0x1047c8){_0x4cbb8e=_0x4cbb8e-0x0;var _0x17846f=_0x399e[_0x4cbb8e];return _0x17846f;};'use strict';var DashboardEvents=require(_0xe399('0x0'));var events=[_0xe399('0x1'),_0xe399('0x2'),_0xe399('0x3')];function createListener(_0x3815a2,_0x133598){return function(_0x4473f1){_0x133598[_0xe399('0x4')](_0x3815a2,_0x4473f1);};}function removeListener(_0x40dd0e,_0x2382a6){return function(){DashboardEvents[_0xe399('0x5')](_0x40dd0e,_0x2382a6);};}exports['register']=function(_0x33dd9c){for(var _0x3d4944=0x0,_0x4185d2=events[_0xe399('0x6')];_0x3d4944<_0x4185d2;_0x3d4944++){var _0xcc3c8e=events[_0x3d4944];var _0x46396c=createListener(_0xe399('0x7')+_0xcc3c8e,_0x33dd9c);DashboardEvents['on'](_0xcc3c8e,_0x46396c);}}; \ No newline at end of file +var _0xab6a=['remove','update','emit','removeListener','save'];(function(_0x3938f7,_0x3dc3ef){var _0x42bf7d=function(_0x42bee3){while(--_0x42bee3){_0x3938f7['push'](_0x3938f7['shift']());}};_0x42bf7d(++_0x3dc3ef);}(_0xab6a,0x9a));var _0xaab6=function(_0xe01761,_0x80ef7d){_0xe01761=_0xe01761-0x0;var _0x3586f2=_0xab6a[_0xe01761];return _0x3586f2;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xaab6('0x0'),_0xaab6('0x1'),_0xaab6('0x2')];function createListener(_0x12af95,_0x5a69cd){return function(_0x2e7d0d){_0x5a69cd[_0xaab6('0x3')](_0x12af95,_0x2e7d0d);};}function removeListener(_0x26b4c2,_0x436bc3){return function(){DashboardEvents[_0xaab6('0x4')](_0x26b4c2,_0x436bc3);};}exports['register']=function(_0x33c8bb){for(var _0x1763f7=0x0,_0x486412=events['length'];_0x1763f7<_0x486412;_0x1763f7++){var _0x526acc=events[_0x1763f7];var _0x4253da=createListener('dashboard:'+_0x526acc,_0x33c8bb);DashboardEvents['on'](_0x526acc,_0x4253da);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ae3d7ff..7515e22 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 _0x4346=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5ad303,_0x5265bd){var _0x1e755f=function(_0x2ae1b7){while(--_0x2ae1b7){_0x5ad303['push'](_0x5ad303['shift']());}};_0x1e755f(++_0x5265bd);}(_0x4346,0x1f1));var _0x6434=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0x4346[_0x2afb44];return _0x15ccc2;};'use strict';var multer=require('multer');var util=require(_0x6434('0x0'));var path=require(_0x6434('0x1'));var timeout=require(_0x6434('0x2'));var express=require(_0x6434('0x3'));var router=express[_0x6434('0x4')]();var fs_extra=require(_0x6434('0x5'));var auth=require(_0x6434('0x6'));var interaction=require(_0x6434('0x7'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x6434('0x8')]('/',auth[_0x6434('0x9')](),controller[_0x6434('0xa')]);router[_0x6434('0x8')](_0x6434('0xb'),auth[_0x6434('0x9')](),controller[_0x6434('0xc')]);router[_0x6434('0x8')](_0x6434('0xd'),auth[_0x6434('0x9')](),controller[_0x6434('0xe')]);router[_0x6434('0xf')]('/',auth['isAuthenticated'](),controller[_0x6434('0x10')]);router[_0x6434('0xf')](_0x6434('0x11'),auth[_0x6434('0x9')](),controller[_0x6434('0x12')]);router[_0x6434('0xf')]('/:id/items',auth[_0x6434('0x9')](),controller['addItem']);router[_0x6434('0x13')](_0x6434('0xb'),auth[_0x6434('0x9')](),controller[_0x6434('0x14')]);router[_0x6434('0x15')]('/:id',auth[_0x6434('0x9')](),controller[_0x6434('0x16')]);module[_0x6434('0x17')]=router; \ No newline at end of file +var _0xf08e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','clone','/:id/items','addItem','put','update','destroy'];(function(_0x2ef252,_0x1993fe){var _0x1139ca=function(_0x31f949){while(--_0x31f949){_0x2ef252['push'](_0x2ef252['shift']());}};_0x1139ca(++_0x1993fe);}(_0xf08e,0xb0));var _0xef08=function(_0x23d45e,_0x159a89){_0x23d45e=_0x23d45e-0x0;var _0x2b3511=_0xf08e[_0x23d45e];return _0x2b3511;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xef08('0x0'));var timeout=require(_0xef08('0x1'));var express=require(_0xef08('0x2'));var router=express[_0xef08('0x3')]();var fs_extra=require(_0xef08('0x4'));var auth=require(_0xef08('0x5'));var interaction=require(_0xef08('0x6'));var config=require(_0xef08('0x7'));var controller=require(_0xef08('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xef08('0x9')]);router[_0xef08('0xa')](_0xef08('0xb'),auth['isAuthenticated'](),controller[_0xef08('0xc')]);router['get']('/:id/items',auth[_0xef08('0xd')](),controller[_0xef08('0xe')]);router[_0xef08('0xf')]('/',auth[_0xef08('0xd')](),controller['create']);router['post']('/:id/clone',auth[_0xef08('0xd')](),controller[_0xef08('0x10')]);router['post'](_0xef08('0x11'),auth[_0xef08('0xd')](),controller[_0xef08('0x12')]);router[_0xef08('0x13')](_0xef08('0xb'),auth[_0xef08('0xd')](),controller[_0xef08('0x14')]);router['delete']('/:id',auth[_0xef08('0xd')](),controller[_0xef08('0x15')]);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 7a8a604..7151bd3 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 _0x3f8a=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','long'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3e21cc,_0x12ed23){_0x3e21cc=_0x3e21cc-0x0;var _0x13e4c7=_0x3f8a[_0x3e21cc];return _0x13e4c7;};'use strict';var Sequelize=require(_0xa3f8('0x0'));var squel=require(_0xa3f8('0x1'));var _=require(_0xa3f8('0x2'));module[_0xa3f8('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa3f8('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa3f8('0x5')](_0xa3f8('0x6')),'get':function(){try{return JSON[_0xa3f8('0x7')](this[_0xa3f8('0x8')](_0xa3f8('0x9')));}catch(_0x39d2e4){return[];}},'set':function(_0x471464){try{this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')](_0x471464));}catch(_0x268332){this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xa3f8('0xc')]},'background':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':_0xa3f8('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa3f8('0x4')]},'titleFontSize':{'type':Sequelize[_0xa3f8('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0xafc4=['TEXT','long','setDataValue','attrs','stringify','INTEGER','sequelize','lodash','STRING'];(function(_0x275af3,_0x58c7c5){var _0x12846e=function(_0x28231a){while(--_0x28231a){_0x275af3['push'](_0x275af3['shift']());}};_0x12846e(++_0x58c7c5);}(_0xafc4,0x69));var _0x4afc=function(_0x1a9a12,_0x528eed){_0x1a9a12=_0x1a9a12-0x0;var _0xfe41d7=_0xafc4[_0x1a9a12];return _0xfe41d7;};'use strict';var Sequelize=require(_0x4afc('0x0'));var squel=require('squel');var _=require(_0x4afc('0x1'));module['exports']={'title':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4afc('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4afc('0x3')](_0x4afc('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x36cb50){return[];}},'set':function(_0x471d45){try{this[_0x4afc('0x5')](_0x4afc('0x6'),JSON[_0x4afc('0x7')](_0x471d45));}catch(_0xaf053d){this['setDataValue'](_0x4afc('0x6'),JSON[_0x4afc('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4afc('0x8')]},'col':{'type':Sequelize[_0x4afc('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4afc('0x2')]},'titleFontSize':{'type':Sequelize[_0x4afc('0x8')],'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 8433068..6dc29d1 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 _0x903e=['query','keys','intersection','attributes','fields','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','show','params','model','DashboardItem','rawAttributes'];(function(_0x275264,_0x12c4c1){var _0xfcfa63=function(_0x2c103e){while(--_0x2c103e){_0x275264['push'](_0x275264['shift']());}};_0xfcfa63(++_0x12c4c1);}(_0x903e,0x195));var _0xe903=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x903e[_0x4d45c1];return _0x244478;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe903('0x0'));var zipdir=require(_0xe903('0x1'));var jsonpatch=require(_0xe903('0x2'));var rp=require(_0xe903('0x3'));var moment=require(_0xe903('0x4'));var BPromise=require(_0xe903('0x5'));var Mustache=require(_0xe903('0x6'));var util=require(_0xe903('0x7'));var path=require('path');var sox=require(_0xe903('0x8'));var csv=require(_0xe903('0x9'));var ejs=require(_0xe903('0xa'));var fs=require('fs');var fs_extra=require(_0xe903('0xb'));var _=require(_0xe903('0xc'));var squel=require(_0xe903('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe903('0xe'));var toCsv=require(_0xe903('0x9'));var querystring=require(_0xe903('0xf'));var Papa=require(_0xe903('0x10'));var Redis=require(_0xe903('0x11'));var authService=require(_0xe903('0x12'));var qs=require(_0xe903('0x13'));var as=require(_0xe903('0x14'));var hardwareService=require(_0xe903('0x15'));var logger=require(_0xe903('0x16'))('api');var utils=require(_0xe903('0x17'));var config=require(_0xe903('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe903('0x19'))['db'];config[_0xe903('0x1a')]=_[_0xe903('0x1b')](config[_0xe903('0x1a')],{'host':_0xe903('0x1c'),'port':0x18eb});var socket=require(_0xe903('0x1d'))(new Redis(config[_0xe903('0x1a')]));require(_0xe903('0x1e'))['register'](socket);function respondWithStatusCode(_0x1d3188,_0x70f809){_0x70f809=_0x70f809||0xcc;return function(_0x283351){if(_0x283351){return _0x1d3188[_0xe903('0x1f')](_0x70f809);}return _0x1d3188[_0xe903('0x20')](_0x70f809)[_0xe903('0x21')]();};}function respondWithResult(_0x1d91ec,_0x4a7e76){_0x4a7e76=_0x4a7e76||0xc8;return function(_0x551d66){if(_0x551d66){return _0x1d91ec[_0xe903('0x20')](_0x4a7e76)['json'](_0x551d66);}};}function respondWithFilteredResult(_0x2a539e,_0x2e5e6c){return function(_0x236356){if(_0x236356){var _0x3d5c42=typeof _0x2e5e6c[_0xe903('0x22')]==='undefined'&&typeof _0x2e5e6c['limit']===_0xe903('0x23');var _0x45d0a9=_0x236356[_0xe903('0x24')];var _0x52f15a=_0x3d5c42?0x0:_0x2e5e6c['offset'];var _0x1b97fa=_0x3d5c42?_0x236356[_0xe903('0x24')]:_0x2e5e6c[_0xe903('0x22')]+_0x2e5e6c[_0xe903('0x25')];var _0x3f00d7;if(_0x1b97fa>=_0x45d0a9){_0x1b97fa=_0x45d0a9;_0x3f00d7=0xc8;}else{_0x3f00d7=0xce;}_0x2a539e[_0xe903('0x20')](_0x3f00d7);return _0x2a539e[_0xe903('0x26')](_0xe903('0x27'),_0x52f15a+'-'+_0x1b97fa+'/'+_0x45d0a9)[_0xe903('0x28')](_0x236356);}return null;};}function patchUpdates(_0x436767){return function(_0x414484){try{jsonpatch[_0xe903('0x29')](_0x414484,_0x436767,!![]);}catch(_0x48329b){return BPromise[_0xe903('0x2a')](_0x48329b);}return _0x414484[_0xe903('0x2b')]();};}function saveUpdates(_0x27845d,_0x2f8e25){return function(_0x2a9cb7){if(_0x2a9cb7){return _0x2a9cb7[_0xe903('0x2c')](_0x27845d)[_0xe903('0x2d')](function(_0x3039a6){return _0x3039a6;});}return null;};}function removeEntity(_0x3063f0,_0x2f77a5){return function(_0x3e31ee){if(_0x3e31ee){return _0x3e31ee[_0xe903('0x2e')]()['then'](function(){_0x3063f0[_0xe903('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc64a,_0x4b77ff){return function(_0x285756){if(!_0x285756){_0x4dc64a[_0xe903('0x1f')](0x194);}return _0x285756;};}function handleError(_0x154f95,_0x2463a8){_0x2463a8=_0x2463a8||0x1f4;return function(_0x53650f){logger[_0xe903('0x2f')](_0x53650f['stack']);if(_0x53650f[_0xe903('0x30')]){delete _0x53650f[_0xe903('0x30')];}_0x154f95[_0xe903('0x20')](_0x2463a8)[_0xe903('0x31')](_0x53650f);};}exports[_0xe903('0x32')]=function(_0x2407f4,_0x473254){var _0x1f9f8f={'raw':![],'where':{'id':_0x2407f4[_0xe903('0x33')]['id']}},_0x1a4433={};_0x1a4433[_0xe903('0x34')]=_['keys'](db[_0xe903('0x35')][_0xe903('0x36')]);_0x1a4433[_0xe903('0x37')]=_[_0xe903('0x38')](_0x2407f4[_0xe903('0x37')]);_0x1a4433['filters']=_[_0xe903('0x39')](_0x1a4433[_0xe903('0x34')],_0x1a4433[_0xe903('0x37')]);_0x1f9f8f[_0xe903('0x3a')]=_[_0xe903('0x39')](_0x1a4433[_0xe903('0x34')],qs[_0xe903('0x3b')](_0x2407f4[_0xe903('0x37')][_0xe903('0x3b')]));_0x1f9f8f[_0xe903('0x3a')]=_0x1f9f8f[_0xe903('0x3a')]['length']?_0x1f9f8f[_0xe903('0x3a')]:_0x1a4433[_0xe903('0x34')];if(_0x2407f4[_0xe903('0x37')][_0xe903('0x3c')]){_0x1f9f8f[_0xe903('0x3d')]=[{'all':!![]}];}_0x1f9f8f=_[_0xe903('0x3e')]({},_0x1f9f8f,_0x2407f4['options']);return db[_0xe903('0x35')][_0xe903('0x3f')](_0x1f9f8f)[_0xe903('0x2d')](handleEntityNotFound(_0x473254,null))[_0xe903('0x2d')](respondWithResult(_0x473254,null))['catch'](handleError(_0x473254,null));};exports[_0xe903('0x2e')]=function(_0x226853,_0x2b8159){return db['DashboardItem'][_0xe903('0x3f')]({'where':{'id':_0x226853[_0xe903('0x33')]['id']}})[_0xe903('0x2d')](handleEntityNotFound(_0x2b8159,null))[_0xe903('0x2d')](removeEntity(_0x2b8159,null))[_0xe903('0x40')](handleError(_0x2b8159,null));};function widgetAttributes(_0x505499){try{switch(_0x505499[_0xe903('0x41')]){case _0xe903('0x42'):return[{'name':_0xe903('0x43'),'value':_0x505499['attrUrl']||(_0x505499['attrs']&&_0x505499[_0xe903('0x44')][0x0]?_0x505499[_0xe903('0x44')][0x0][_0xe903('0x45')]:undefined)||_0xe903('0x46')}];case _0xe903('0x47'):return[{'name':'attrPath','value':_0x505499[_0xe903('0x48')]||(_0x505499[_0xe903('0x44')]&&_0x505499['attrs'][0x0]?_0x505499[_0xe903('0x44')][0x0][_0xe903('0x45')]:undefined)||''}];case _0xe903('0x49'):return[{'name':'attrHourFormat','value':_0x505499[_0xe903('0x4a')]||(_0x505499[_0xe903('0x44')]&&_0x505499[_0xe903('0x44')][0x0]?_0x505499[_0xe903('0x44')][0x0][_0xe903('0x45')]:undefined)||_0xe903('0x4b')},{'name':_0xe903('0x4c'),'value':_0x505499[_0xe903('0x4c')]||(_0x505499[_0xe903('0x44')]&&_0x505499[_0xe903('0x44')][0x1]?_0x505499[_0xe903('0x44')][0x1][_0xe903('0x45')]:undefined)||_0xe903('0x4d')},{'name':_0xe903('0x4e'),'value':_0x505499['attrFontSize']||(_0x505499[_0xe903('0x44')]&&_0x505499[_0xe903('0x44')][0x2]?_0x505499[_0xe903('0x44')][0x2][_0xe903('0x45')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x505499[_0xe903('0x4f')]||(_0x505499[_0xe903('0x44')]&&_0x505499[_0xe903('0x44')][0x0]?_0x505499['attrs'][0x0][_0xe903('0x45')]:undefined)||_0xe903('0x50')},{'name':_0xe903('0x51'),'value':_0x505499[_0xe903('0x51')]||(_0x505499[_0xe903('0x44')]&&_0x505499[_0xe903('0x44')][0x1]?_0x505499[_0xe903('0x44')][0x1]['value']:undefined)||[]},{'name':_0xe903('0x4e'),'value':_0x505499['attrFontSize']||(_0x505499[_0xe903('0x44')]&&_0x505499[_0xe903('0x44')][0x2]?_0x505499[_0xe903('0x44')][0x2][_0xe903('0x45')]:undefined)||0x14}];case'multibar-chart':case _0xe903('0x52'):return[{'name':_0xe903('0x53'),'value':_0x505499['attrSerie1']||(_0x505499[_0xe903('0x44')]&&_0x505499['attrs'][0x0]?_0x505499['attrs'][0x0]['value']:undefined)||_0xe903('0x50')},{'name':_0xe903('0x54'),'value':_0x505499[_0xe903('0x54')]||(_0x505499[_0xe903('0x44')]&&_0x505499['attrs'][0x1]?_0x505499[_0xe903('0x44')][0x1][_0xe903('0x45')]:undefined)||null},{'name':_0xe903('0x55'),'value':_0x505499['attrSerie3']||(_0x505499['attrs']&&_0x505499[_0xe903('0x44')][0x2]?_0x505499[_0xe903('0x44')][0x2][_0xe903('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x505499[_0xe903('0x51')]||(_0x505499[_0xe903('0x44')]&&_0x505499['attrs'][0x3]?_0x505499['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xe903('0x56'),'type':_0x505499[_0xe903('0x57')]||(_0x505499[_0xe903('0x44')]&&_0x505499[_0xe903('0x44')][0x0]?_0x505499['attrs'][0x0][_0xe903('0x41')]:undefined)||null,'value':_0x505499[_0xe903('0x56')]||(_0x505499['attrs']&&_0x505499[_0xe903('0x44')][0x0]?_0x505499['attrs'][0x0][_0xe903('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x505499[_0xe903('0x58')]||(_0x505499[_0xe903('0x44')]&&_0x505499[_0xe903('0x44')][0x1]?_0x505499['attrs'][0x1][_0xe903('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x19e7f0){logger[_0xe903('0x2f')](_0xe903('0x59'),JSON['stringify'](_0x19e7f0));return[];}}exports[_0xe903('0x5a')]=function(_0x336634,_0x303230){if(_0x336634[_0xe903('0x5b')]){_0x336634['body'][_0xe903('0x44')]=widgetAttributes(_0x336634[_0xe903('0x5b')]);}return db['DashboardItem']['create'](_0x336634['body'],{})[_0xe903('0x2d')](respondWithResult(_0x303230,0xc9))['catch'](handleError(_0x303230,null));};exports['update']=function(_0x1cacb6,_0x3c7468){if(_0x1cacb6[_0xe903('0x5b')]['id']){delete _0x1cacb6[_0xe903('0x5b')]['id'];}_0x1cacb6[_0xe903('0x5b')]['attrs']=widgetAttributes(_0x1cacb6[_0xe903('0x5b')]);return db[_0xe903('0x35')]['find']({'where':{'id':_0x1cacb6[_0xe903('0x33')]['id']}})['then'](handleEntityNotFound(_0x3c7468,null))[_0xe903('0x2d')](saveUpdates(_0x1cacb6[_0xe903('0x5b')],null))['then'](respondWithResult(_0x3c7468,null))[_0xe903('0x40')](handleError(_0x3c7468,null));}; \ No newline at end of file +var _0x5632=['options','catch','find','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge'];(function(_0x1dae94,_0x239003){var _0x36ce2d=function(_0x295f18){while(--_0x295f18){_0x1dae94['push'](_0x1dae94['shift']());}};_0x36ce2d(++_0x239003);}(_0x5632,0xd4));var _0x2563=function(_0x447ade,_0xa0711f){_0x447ade=_0x447ade-0x0;var _0x1e0617=_0x5632[_0x447ade];return _0x1e0617;};'use strict';var emlformat=require(_0x2563('0x0'));var rimraf=require(_0x2563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2563('0x2'));var rp=require(_0x2563('0x3'));var moment=require(_0x2563('0x4'));var BPromise=require(_0x2563('0x5'));var Mustache=require(_0x2563('0x6'));var util=require(_0x2563('0x7'));var path=require(_0x2563('0x8'));var sox=require(_0x2563('0x9'));var csv=require(_0x2563('0xa'));var ejs=require(_0x2563('0xb'));var fs=require('fs');var fs_extra=require(_0x2563('0xc'));var _=require(_0x2563('0xd'));var squel=require(_0x2563('0xe'));var crypto=require(_0x2563('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2563('0x10'));var toCsv=require(_0x2563('0xa'));var querystring=require(_0x2563('0x11'));var Papa=require(_0x2563('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2563('0x13'));var as=require(_0x2563('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2563('0x15'));var utils=require(_0x2563('0x16'));var config=require(_0x2563('0x17'));var licenseUtil=require(_0x2563('0x18'));var db=require(_0x2563('0x19'))['db'];config[_0x2563('0x1a')]=_[_0x2563('0x1b')](config[_0x2563('0x1a')],{'host':_0x2563('0x1c'),'port':0x18eb});var socket=require(_0x2563('0x1d'))(new Redis(config[_0x2563('0x1a')]));require(_0x2563('0x1e'))[_0x2563('0x1f')](socket);function respondWithStatusCode(_0x25a4f3,_0x29fbfd){_0x29fbfd=_0x29fbfd||0xcc;return function(_0x2af310){if(_0x2af310){return _0x25a4f3[_0x2563('0x20')](_0x29fbfd);}return _0x25a4f3[_0x2563('0x21')](_0x29fbfd)[_0x2563('0x22')]();};}function respondWithResult(_0x3f1bf8,_0x3f6ff9){_0x3f6ff9=_0x3f6ff9||0xc8;return function(_0x43d079){if(_0x43d079){return _0x3f1bf8[_0x2563('0x21')](_0x3f6ff9)[_0x2563('0x23')](_0x43d079);}};}function respondWithFilteredResult(_0x62f947,_0x31e52b){return function(_0x8ca677){if(_0x8ca677){var _0xf5631=typeof _0x31e52b[_0x2563('0x24')]===_0x2563('0x25')&&typeof _0x31e52b['limit']==='undefined';var _0xf6e1dc=_0x8ca677[_0x2563('0x26')];var _0x56e51f=_0xf5631?0x0:_0x31e52b[_0x2563('0x24')];var _0x46a59e=_0xf5631?_0x8ca677[_0x2563('0x26')]:_0x31e52b[_0x2563('0x24')]+_0x31e52b[_0x2563('0x27')];var _0x27f254;if(_0x46a59e>=_0xf6e1dc){_0x46a59e=_0xf6e1dc;_0x27f254=0xc8;}else{_0x27f254=0xce;}_0x62f947['status'](_0x27f254);return _0x62f947[_0x2563('0x28')]('Content-Range',_0x56e51f+'-'+_0x46a59e+'/'+_0xf6e1dc)['json'](_0x8ca677);}return null;};}function patchUpdates(_0x2300a3){return function(_0xe12cf9){try{jsonpatch[_0x2563('0x29')](_0xe12cf9,_0x2300a3,!![]);}catch(_0x71c48c){return BPromise[_0x2563('0x2a')](_0x71c48c);}return _0xe12cf9[_0x2563('0x2b')]();};}function saveUpdates(_0x2c6a19,_0x2231dd){return function(_0x1091e7){if(_0x1091e7){return _0x1091e7[_0x2563('0x2c')](_0x2c6a19)[_0x2563('0x2d')](function(_0xca2d75){return _0xca2d75;});}return null;};}function removeEntity(_0x1fdc2e,_0x5b21f0){return function(_0x43adfb){if(_0x43adfb){return _0x43adfb[_0x2563('0x2e')]()[_0x2563('0x2d')](function(){_0x1fdc2e['status'](0xcc)[_0x2563('0x22')]();});}};}function handleEntityNotFound(_0x22f2e7,_0x33acd0){return function(_0x42e5cc){if(!_0x42e5cc){_0x22f2e7[_0x2563('0x20')](0x194);}return _0x42e5cc;};}function handleError(_0x12b076,_0x7e4cbf){_0x7e4cbf=_0x7e4cbf||0x1f4;return function(_0x49e79f){logger[_0x2563('0x2f')](_0x49e79f[_0x2563('0x30')]);if(_0x49e79f[_0x2563('0x31')]){delete _0x49e79f[_0x2563('0x31')];}_0x12b076['status'](_0x7e4cbf)[_0x2563('0x32')](_0x49e79f);};}exports['show']=function(_0x556824,_0x24e050){var _0x440257={'raw':![],'where':{'id':_0x556824[_0x2563('0x33')]['id']}},_0x5c60c2={};_0x5c60c2[_0x2563('0x34')]=_[_0x2563('0x35')](db[_0x2563('0x36')][_0x2563('0x37')]);_0x5c60c2['query']=_['keys'](_0x556824[_0x2563('0x38')]);_0x5c60c2[_0x2563('0x39')]=_[_0x2563('0x3a')](_0x5c60c2[_0x2563('0x34')],_0x5c60c2[_0x2563('0x38')]);_0x440257[_0x2563('0x3b')]=_['intersection'](_0x5c60c2[_0x2563('0x34')],qs[_0x2563('0x3c')](_0x556824['query'][_0x2563('0x3c')]));_0x440257[_0x2563('0x3b')]=_0x440257[_0x2563('0x3b')][_0x2563('0x3d')]?_0x440257['attributes']:_0x5c60c2[_0x2563('0x34')];if(_0x556824[_0x2563('0x38')]['includeAll']){_0x440257[_0x2563('0x3e')]=[{'all':!![]}];}_0x440257=_[_0x2563('0x3f')]({},_0x440257,_0x556824[_0x2563('0x40')]);return db[_0x2563('0x36')]['find'](_0x440257)[_0x2563('0x2d')](handleEntityNotFound(_0x24e050,null))[_0x2563('0x2d')](respondWithResult(_0x24e050,null))[_0x2563('0x41')](handleError(_0x24e050,null));};exports[_0x2563('0x2e')]=function(_0x164fa0,_0x198e66){return db[_0x2563('0x36')][_0x2563('0x42')]({'where':{'id':_0x164fa0[_0x2563('0x33')]['id']}})[_0x2563('0x2d')](handleEntityNotFound(_0x198e66,null))[_0x2563('0x2d')](removeEntity(_0x198e66,null))[_0x2563('0x41')](handleError(_0x198e66,null));};function widgetAttributes(_0x50df28){try{switch(_0x50df28[_0x2563('0x43')]){case _0x2563('0x44'):return[{'name':_0x2563('0x45'),'value':_0x50df28[_0x2563('0x45')]||(_0x50df28[_0x2563('0x46')]&&_0x50df28['attrs'][0x0]?_0x50df28[_0x2563('0x46')][0x0][_0x2563('0x47')]:undefined)||_0x2563('0x48')}];case'custom':return[{'name':_0x2563('0x49'),'value':_0x50df28[_0x2563('0x49')]||(_0x50df28['attrs']&&_0x50df28[_0x2563('0x46')][0x0]?_0x50df28['attrs'][0x0][_0x2563('0x47')]:undefined)||''}];case _0x2563('0x4a'):return[{'name':'attrHourFormat','value':_0x50df28[_0x2563('0x4b')]||(_0x50df28[_0x2563('0x46')]&&_0x50df28[_0x2563('0x46')][0x0]?_0x50df28[_0x2563('0x46')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x50df28['attrTimezone']||(_0x50df28[_0x2563('0x46')]&&_0x50df28[_0x2563('0x46')][0x1]?_0x50df28[_0x2563('0x46')][0x1][_0x2563('0x47')]:undefined)||_0x2563('0x4c')},{'name':_0x2563('0x4d'),'value':_0x50df28[_0x2563('0x4d')]||(_0x50df28[_0x2563('0x46')]&&_0x50df28[_0x2563('0x46')][0x2]?_0x50df28[_0x2563('0x46')][0x2][_0x2563('0x47')]:undefined)||0xc}];case _0x2563('0x4e'):return[{'name':'attrMetric','value':_0x50df28[_0x2563('0x4f')]||(_0x50df28[_0x2563('0x46')]&&_0x50df28['attrs'][0x0]?_0x50df28[_0x2563('0x46')][0x0][_0x2563('0x47')]:undefined)||_0x2563('0x50')},{'name':_0x2563('0x51'),'value':_0x50df28['attrVoiceQueues']||(_0x50df28['attrs']&&_0x50df28[_0x2563('0x46')][0x1]?_0x50df28['attrs'][0x1][_0x2563('0x47')]:undefined)||[]},{'name':_0x2563('0x4d'),'value':_0x50df28[_0x2563('0x4d')]||(_0x50df28[_0x2563('0x46')]&&_0x50df28[_0x2563('0x46')][0x2]?_0x50df28[_0x2563('0x46')][0x2][_0x2563('0x47')]:undefined)||0x14}];case _0x2563('0x52'):case _0x2563('0x53'):return[{'name':_0x2563('0x54'),'value':_0x50df28[_0x2563('0x54')]||(_0x50df28['attrs']&&_0x50df28['attrs'][0x0]?_0x50df28[_0x2563('0x46')][0x0][_0x2563('0x47')]:undefined)||_0x2563('0x50')},{'name':_0x2563('0x55'),'value':_0x50df28[_0x2563('0x55')]||(_0x50df28['attrs']&&_0x50df28[_0x2563('0x46')][0x1]?_0x50df28[_0x2563('0x46')][0x1][_0x2563('0x47')]:undefined)||null},{'name':_0x2563('0x56'),'value':_0x50df28[_0x2563('0x56')]||(_0x50df28[_0x2563('0x46')]&&_0x50df28[_0x2563('0x46')][0x2]?_0x50df28[_0x2563('0x46')][0x2][_0x2563('0x47')]:undefined)||null},{'name':_0x2563('0x51'),'value':_0x50df28[_0x2563('0x51')]||(_0x50df28[_0x2563('0x46')]&&_0x50df28[_0x2563('0x46')][0x3]?_0x50df28[_0x2563('0x46')][0x3][_0x2563('0x47')]:undefined)||[]}];case _0x2563('0x57'):return[{'name':_0x2563('0x58'),'type':_0x50df28['reportType']||(_0x50df28[_0x2563('0x46')]&&_0x50df28[_0x2563('0x46')][0x0]?_0x50df28['attrs'][0x0][_0x2563('0x43')]:undefined)||null,'value':_0x50df28[_0x2563('0x58')]||(_0x50df28[_0x2563('0x46')]&&_0x50df28[_0x2563('0x46')][0x0]?_0x50df28['attrs'][0x0][_0x2563('0x47')]:undefined)||null},{'name':_0x2563('0x59'),'value':_0x50df28[_0x2563('0x59')]||(_0x50df28[_0x2563('0x46')]&&_0x50df28[_0x2563('0x46')][0x1]?_0x50df28[_0x2563('0x46')][0x1][_0x2563('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x521c08){logger['error'](_0x2563('0x5a'),JSON['stringify'](_0x521c08));return[];}}exports['create']=function(_0x40f54c,_0x5c9b25){if(_0x40f54c[_0x2563('0x5b')]){_0x40f54c[_0x2563('0x5b')][_0x2563('0x46')]=widgetAttributes(_0x40f54c[_0x2563('0x5b')]);}return db[_0x2563('0x36')]['create'](_0x40f54c['body'],{})[_0x2563('0x2d')](respondWithResult(_0x5c9b25,0xc9))[_0x2563('0x41')](handleError(_0x5c9b25,null));};exports[_0x2563('0x2c')]=function(_0x12c241,_0x326b81){if(_0x12c241[_0x2563('0x5b')]['id']){delete _0x12c241['body']['id'];}_0x12c241['body'][_0x2563('0x46')]=widgetAttributes(_0x12c241[_0x2563('0x5b')]);return db[_0x2563('0x36')][_0x2563('0x42')]({'where':{'id':_0x12c241['params']['id']}})[_0x2563('0x2d')](handleEntityNotFound(_0x326b81,null))['then'](saveUpdates(_0x12c241[_0x2563('0x5b')],null))[_0x2563('0x2d')](respondWithResult(_0x326b81,null))['catch'](handleError(_0x326b81,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 09b2678..c31fcae 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 _0xd371=['events','DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3a41a8,_0x1e25b9){var _0x19dfeb=function(_0x4f6567){while(--_0x4f6567){_0x3a41a8['push'](_0x3a41a8['shift']());}};_0x19dfeb(++_0x1e25b9);}(_0xd371,0x117));var _0x1d37=function(_0x1621dd,_0x172229){_0x1621dd=_0x1621dd-0x0;var _0x3b0046=_0xd371[_0x1621dd];return _0x3b0046;};'use strict';var EventEmitter=require(_0x1d37('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x1d37('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1d37('0x2')](0x0);var events={'afterCreate':_0x1d37('0x3'),'afterUpdate':'update','afterDestroy':_0x1d37('0x4')};function emitEvent(_0x2dcb31){return function(_0x329fa6,_0x34810b,_0x3dbc24){DashboardItemEvents[_0x1d37('0x5')](_0x2dcb31+':'+_0x329fa6['id'],_0x329fa6);DashboardItemEvents[_0x1d37('0x5')](_0x2dcb31,_0x329fa6);_0x3dbc24(null);};}for(var e in events){if(events[_0x1d37('0x6')](e)){var event=events[e];DashboardItem[_0x1d37('0x7')](e,emitEvent(event));}}module[_0x1d37('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x90c1=['setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x714d60,_0x1ede1f){var _0x25b2f1=function(_0x12b209){while(--_0x12b209){_0x714d60['push'](_0x714d60['shift']());}};_0x25b2f1(++_0x1ede1f);}(_0x90c1,0x109));var _0x190c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x90c1[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x190c('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x190c('0x1')](0x0);var events={'afterCreate':_0x190c('0x2'),'afterUpdate':_0x190c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x37e128){return function(_0x337bfe,_0xaf259a,_0x2f47fb){DashboardItemEvents[_0x190c('0x4')](_0x37e128+':'+_0x337bfe['id'],_0x337bfe);DashboardItemEvents[_0x190c('0x4')](_0x37e128,_0x337bfe);_0x2f47fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x190c('0x5')](e,emitEvent(event));}}module[_0x190c('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d129e8e..4962172 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 _0xa251=['../../config/logger','api','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','lodash','util'];(function(_0x3d551d,_0x1f1791){var _0x35acb1=function(_0x7dbbec){while(--_0x7dbbec){_0x3d551d['push'](_0x3d551d['shift']());}};_0x35acb1(++_0x1f1791);}(_0xa251,0x1de));var _0x1a25=function(_0x4eb082,_0x5ee5de){_0x4eb082=_0x4eb082-0x0;var _0x2f17e0=_0xa251[_0x4eb082];return _0x2f17e0;};'use strict';var _=require(_0x1a25('0x0'));var util=require(_0x1a25('0x1'));var logger=require(_0x1a25('0x2'))(_0x1a25('0x3'));var moment=require('moment');var BPromise=require(_0x1a25('0x4'));var rp=require(_0x1a25('0x5'));var fs=require('fs');var path=require(_0x1a25('0x6'));var rimraf=require(_0x1a25('0x7'));var config=require('../../config/environment');var attributes=require(_0x1a25('0x8'));module[_0x1a25('0x9')]=function(_0x106d02,_0x1c2a7a){return _0x106d02['define']('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdc5=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x2f67cc,_0x5e41eb){var _0x3adf53=function(_0x7b9a13){while(--_0x7b9a13){_0x2f67cc['push'](_0x2f67cc['shift']());}};_0x3adf53(++_0x5e41eb);}(_0xfdc5,0xa8));var _0x5fdc=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xfdc5[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x5fdc('0x0'));var util=require(_0x5fdc('0x1'));var logger=require(_0x5fdc('0x2'))(_0x5fdc('0x3'));var moment=require(_0x5fdc('0x4'));var BPromise=require(_0x5fdc('0x5'));var rp=require(_0x5fdc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fdc('0x7'));var config=require('../../config/environment');var attributes=require(_0x5fdc('0x8'));module[_0x5fdc('0x9')]=function(_0x2aa904,_0x1cc2e8){return _0x2aa904[_0x5fdc('0xa')](_0x5fdc('0xb'),attributes,{'tableName':_0x5fdc('0xc'),'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 89409ac..44d10dd 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 _0xb3f5=['http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x123824,_0x52a5c7){var _0x1421eb=function(_0x37881){while(--_0x37881){_0x123824['push'](_0x123824['shift']());}};_0x1421eb(++_0x52a5c7);}(_0xb3f5,0x1b6));var _0x5b3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5b3f('0x0'));var moment=require(_0x5b3f('0x1'));var BPromise=require(_0x5b3f('0x2'));var rs=require(_0x5b3f('0x3'));var fs=require('fs');var Redis=require(_0x5b3f('0x4'));var db=require(_0x5b3f('0x5'))['db'];var utils=require(_0x5b3f('0x6'));var logger=require(_0x5b3f('0x7'))(_0x5b3f('0x8'));var config=require(_0x5b3f('0x9'));var jayson=require(_0x5b3f('0xa'));var client=jayson[_0x5b3f('0xb')][_0x5b3f('0xc')]({'port':0x232a});config[_0x5b3f('0xd')]=_[_0x5b3f('0xe')](config[_0x5b3f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b3f('0xf'))(new Redis(config['redis']));require(_0x5b3f('0x10'))[_0x5b3f('0x11')](socket);function respondWithRpcPromise(_0xb8c7cc,_0x70e974,_0x5bd397){return new BPromise(function(_0x140dbe,_0x445160){return client[_0x5b3f('0x12')](_0xb8c7cc,_0x5bd397)[_0x5b3f('0x13')](function(_0x41153a){logger[_0x5b3f('0x14')](_0x5b3f('0x15'),_0x70e974,_0x5b3f('0x16'));logger[_0x5b3f('0x17')](_0x5b3f('0x18'),_0x70e974,_0x5b3f('0x16'),JSON['stringify'](_0x41153a));if(_0x41153a[_0x5b3f('0x19')]){if(_0x41153a[_0x5b3f('0x19')][_0x5b3f('0x1a')]===0x1f4){logger[_0x5b3f('0x19')]('DashboardItem,\x20%s,\x20%s',_0x70e974,_0x41153a['error'][_0x5b3f('0x1b')]);return _0x445160(_0x41153a[_0x5b3f('0x19')][_0x5b3f('0x1b')]);}logger['error'](_0x5b3f('0x15'),_0x70e974,_0x41153a['error']['message']);return _0x140dbe(_0x41153a[_0x5b3f('0x19')]['message']);}else{logger['info'](_0x5b3f('0x15'),_0x70e974,'request\x20sent');_0x140dbe(_0x41153a[_0x5b3f('0x1c')][_0x5b3f('0x1b')]);}})[_0x5b3f('0x1d')](function(_0x7de95){logger[_0x5b3f('0x19')](_0x5b3f('0x15'),_0x70e974,_0x7de95);_0x445160(_0x7de95);});});} \ No newline at end of file +var _0x751a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x33f614,_0x5242a8){var _0x564db2=function(_0x16d3e0){while(--_0x16d3e0){_0x33f614['push'](_0x33f614['shift']());}};_0x564db2(++_0x5242a8);}(_0x751a,0xc9));var _0xa751=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0x751a[_0x543242];return _0x4c99b6;};'use strict';var _=require(_0xa751('0x0'));var util=require(_0xa751('0x1'));var moment=require(_0xa751('0x2'));var BPromise=require(_0xa751('0x3'));var rs=require(_0xa751('0x4'));var fs=require('fs');var Redis=require(_0xa751('0x5'));var db=require(_0xa751('0x6'))['db'];var utils=require(_0xa751('0x7'));var logger=require('../../config/logger')(_0xa751('0x8'));var config=require(_0xa751('0x9'));var jayson=require(_0xa751('0xa'));var client=jayson['client'][_0xa751('0xb')]({'port':0x232a});config['redis']=_[_0xa751('0xc')](config[_0xa751('0xd')],{'host':_0xa751('0xe'),'port':0x18eb});var socket=require(_0xa751('0xf'))(new Redis(config[_0xa751('0xd')]));require(_0xa751('0x10'))[_0xa751('0x11')](socket);function respondWithRpcPromise(_0x3f1ead,_0x1485f0,_0x491e64){return new BPromise(function(_0x1df96a,_0x16a482){return client['request'](_0x3f1ead,_0x491e64)[_0xa751('0x12')](function(_0x5a594b){logger[_0xa751('0x13')](_0xa751('0x14'),_0x1485f0,'request\x20sent');logger[_0xa751('0x15')](_0xa751('0x16'),_0x1485f0,_0xa751('0x17'),JSON[_0xa751('0x18')](_0x5a594b));if(_0x5a594b[_0xa751('0x19')]){if(_0x5a594b[_0xa751('0x19')]['code']===0x1f4){logger[_0xa751('0x19')]('DashboardItem,\x20%s,\x20%s',_0x1485f0,_0x5a594b['error'][_0xa751('0x1a')]);return _0x16a482(_0x5a594b[_0xa751('0x19')][_0xa751('0x1a')]);}logger[_0xa751('0x19')](_0xa751('0x14'),_0x1485f0,_0x5a594b[_0xa751('0x19')][_0xa751('0x1a')]);return _0x1df96a(_0x5a594b[_0xa751('0x19')][_0xa751('0x1a')]);}else{logger[_0xa751('0x13')](_0xa751('0x14'),_0x1485f0,'request\x20sent');_0x1df96a(_0x5a594b[_0xa751('0x1b')][_0xa751('0x1a')]);}})[_0xa751('0x1c')](function(_0x5f2a63){logger[_0xa751('0x19')](_0xa751('0x14'),_0x1485f0,_0x5f2a63);_0x16a482(_0x5f2a63);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 870ed05..df1ad90 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 _0x0703=['register','length','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0703,0xf2));var _0x3070=function(_0x1874b8,_0x2f5ac7){_0x1874b8=_0x1874b8-0x0;var _0x3b76be=_0x0703[_0x1874b8];return _0x3b76be;};'use strict';var DashboardItemEvents=require(_0x3070('0x0'));var events=[_0x3070('0x1'),_0x3070('0x2'),_0x3070('0x3')];function createListener(_0x111582,_0x3e96db){return function(_0x44fd47){_0x3e96db[_0x3070('0x4')](_0x111582,_0x44fd47);};}function removeListener(_0x392973,_0x42f7cb){return function(){DashboardItemEvents[_0x3070('0x5')](_0x392973,_0x42f7cb);};}exports[_0x3070('0x6')]=function(_0x2763ac){for(var _0xa56a1=0x0,_0x16106f=events[_0x3070('0x7')];_0xa56a1<_0x16106f;_0xa56a1++){var _0x66a5dc=events[_0xa56a1];var _0x3b1936=createListener('dashboardItem:'+_0x66a5dc,_0x2763ac);DashboardItemEvents['on'](_0x66a5dc,_0x3b1936);}}; \ No newline at end of file +var _0x53c2=['removeListener','register','dashboardItem:','./dashboardItem.events','remove','emit'];(function(_0x5bb77e,_0x166608){var _0x3f9482=function(_0x1d38b0){while(--_0x1d38b0){_0x5bb77e['push'](_0x5bb77e['shift']());}};_0x3f9482(++_0x166608);}(_0x53c2,0x99));var _0x253c=function(_0x3515bc,_0x26a1ec){_0x3515bc=_0x3515bc-0x0;var _0xeef5f=_0x53c2[_0x3515bc];return _0xeef5f;};'use strict';var DashboardItemEvents=require(_0x253c('0x0'));var events=['save',_0x253c('0x1'),'update'];function createListener(_0xc1b5d8,_0x1b86cf){return function(_0x2952c9){_0x1b86cf[_0x253c('0x2')](_0xc1b5d8,_0x2952c9);};}function removeListener(_0x321556,_0x35a25c){return function(){DashboardItemEvents[_0x253c('0x3')](_0x321556,_0x35a25c);};}exports[_0x253c('0x4')]=function(_0x3e2592){for(var _0x5dfb39=0x0,_0x3dadbf=events['length'];_0x5dfb39<_0x3dadbf;_0x5dfb39++){var _0x3b0308=events[_0x5dfb39];var _0x13d29c=createListener(_0x253c('0x5')+_0x3b0308,_0x3e2592);DashboardItemEvents['on'](_0x3b0308,_0x13d29c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 639bcfc..638fb70 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 _0xf61e=['/:id','isAuthenticated','show','post','create','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x5b0424,_0x688ad7){var _0x25dd4d=function(_0x369d84){while(--_0x369d84){_0x5b0424['push'](_0x5b0424['shift']());}};_0x25dd4d(++_0x688ad7);}(_0xf61e,0x188));var _0xef61=function(_0x256d94,_0x9f9896){_0x256d94=_0x256d94-0x0;var _0x368352=_0xf61e[_0x256d94];return _0x368352;};'use strict';var multer=require('multer');var util=require(_0xef61('0x0'));var path=require('path');var timeout=require(_0xef61('0x1'));var express=require(_0xef61('0x2'));var router=express[_0xef61('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xef61('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xef61('0x5'));var controller=require(_0xef61('0x6'));router[_0xef61('0x7')](_0xef61('0x8'),auth[_0xef61('0x9')](),controller[_0xef61('0xa')]);router[_0xef61('0xb')]('/',auth[_0xef61('0x9')](),controller[_0xef61('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xef61('0xd')](_0xef61('0x8'),auth['isAuthenticated'](),controller[_0xef61('0xe')]);module[_0xef61('0xf')]=router; \ No newline at end of file +var _0xf653=['destroy','exports','util','connect-timeout','express','fs-extra','./dashboardItem.controller','/:id','isAuthenticated','post','create','update','delete'];(function(_0x4e8a07,_0x16bedb){var _0x3a16ea=function(_0xc11398){while(--_0xc11398){_0x4e8a07['push'](_0x4e8a07['shift']());}};_0x3a16ea(++_0x16bedb);}(_0xf653,0x195));var _0x3f65=function(_0x22e5e8,_0x5e67d0){_0x22e5e8=_0x22e5e8-0x0;var _0x286231=_0xf653[_0x22e5e8];return _0x286231;};'use strict';var multer=require('multer');var util=require(_0x3f65('0x0'));var path=require('path');var timeout=require(_0x3f65('0x1'));var express=require(_0x3f65('0x2'));var router=express['Router']();var fs_extra=require(_0x3f65('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3f65('0x4'));router['get'](_0x3f65('0x5'),auth[_0x3f65('0x6')](),controller['show']);router[_0x3f65('0x7')]('/',auth[_0x3f65('0x6')](),controller[_0x3f65('0x8')]);router['put'](_0x3f65('0x5'),auth[_0x3f65('0x6')](),controller[_0x3f65('0x9')]);router[_0x3f65('0xa')]('/:id',auth[_0x3f65('0x6')](),controller[_0x3f65('0xb')]);module[_0x3f65('0xc')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 3a37178..cf1fc77 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 _0x2978=['third','exports','STRING','ENUM','first','second'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x2978,0xb5));var _0x8297=function(_0xc3a8c0,_0x4ca9d0){_0xc3a8c0=_0xc3a8c0-0x0;var _0x11283b=_0x2978[_0xc3a8c0];return _0x11283b;};'use strict';var Sequelize=require('sequelize');module[_0x8297('0x0')]={'name':{'type':Sequelize[_0x8297('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x8297('0x2')](_0x8297('0x3'),_0x8297('0x4'),_0x8297('0x5')),'allowNull':![],'defaultValue':_0x8297('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb4a3=['sequelize','exports','STRING','ENUM','second','third','first'];(function(_0x41c088,_0x155e0f){var _0x273b77=function(_0x1ba82f){while(--_0x1ba82f){_0x41c088['push'](_0x41c088['shift']());}};_0x273b77(++_0x155e0f);}(_0xb4a3,0xbd));var _0x3b4a=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0xb4a3[_0x44268d];return _0x4be92d;};'use strict';var Sequelize=require(_0x3b4a('0x0'));module[_0x3b4a('0x1')]={'name':{'type':Sequelize[_0x3b4a('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3b4a('0x3')]('first',_0x3b4a('0x4'),_0x3b4a('0x5')),'allowNull':![],'defaultValue':_0x3b4a('0x6')},'description':{'type':Sequelize[_0x3b4a('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 85b4937..db01a25 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 _0xb3d8=['get','Dispositions','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x2d2d03,_0x3e6c53){_0x2d2d03=_0x2d2d03-0x0;var _0x106733=_0xb3d8[_0x2d2d03];return _0x106733;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b3d('0x0'));var zipdir=require(_0x8b3d('0x1'));var jsonpatch=require(_0x8b3d('0x2'));var rp=require(_0x8b3d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8b3d('0x4'));var util=require(_0x8b3d('0x5'));var path=require(_0x8b3d('0x6'));var sox=require(_0x8b3d('0x7'));var csv=require(_0x8b3d('0x8'));var ejs=require(_0x8b3d('0x9'));var fs=require('fs');var fs_extra=require(_0x8b3d('0xa'));var _=require(_0x8b3d('0xb'));var squel=require(_0x8b3d('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b3d('0xd'));var deskjs=require(_0x8b3d('0xe'));var toCsv=require(_0x8b3d('0x8'));var querystring=require(_0x8b3d('0xf'));var Papa=require(_0x8b3d('0x10'));var Redis=require(_0x8b3d('0x11'));var authService=require(_0x8b3d('0x12'));var qs=require(_0x8b3d('0x13'));var as=require(_0x8b3d('0x14'));var hardwareService=require(_0x8b3d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8b3d('0x16'));var config=require(_0x8b3d('0x17'));var licenseUtil=require(_0x8b3d('0x18'));var db=require(_0x8b3d('0x19'))['db'];function respondWithStatusCode(_0x16e1fb,_0x1fa985){_0x1fa985=_0x1fa985||0xcc;return function(_0x63293){if(_0x63293){return _0x16e1fb[_0x8b3d('0x1a')](_0x1fa985);}return _0x16e1fb[_0x8b3d('0x1b')](_0x1fa985)[_0x8b3d('0x1c')]();};}function respondWithResult(_0x984b9a,_0x3f03ee){_0x3f03ee=_0x3f03ee||0xc8;return function(_0xb0a303){if(_0xb0a303){return _0x984b9a[_0x8b3d('0x1b')](_0x3f03ee)[_0x8b3d('0x1d')](_0xb0a303);}};}function respondWithFilteredResult(_0x14611e,_0x4fc552){return function(_0x2c624d){if(_0x2c624d){var _0x381c0d=typeof _0x4fc552['offset']===_0x8b3d('0x1e')&&typeof _0x4fc552[_0x8b3d('0x1f')]==='undefined';var _0xb493ac=_0x2c624d[_0x8b3d('0x20')];var _0xcc9b46=_0x381c0d?0x0:_0x4fc552[_0x8b3d('0x21')];var _0x1d96ae=_0x381c0d?_0x2c624d['count']:_0x4fc552['offset']+_0x4fc552[_0x8b3d('0x1f')];var _0x4f1b21;if(_0x1d96ae>=_0xb493ac){_0x1d96ae=_0xb493ac;_0x4f1b21=0xc8;}else{_0x4f1b21=0xce;}_0x14611e['status'](_0x4f1b21);return _0x14611e['set'](_0x8b3d('0x22'),_0xcc9b46+'-'+_0x1d96ae+'/'+_0xb493ac)[_0x8b3d('0x1d')](_0x2c624d);}return null;};}function patchUpdates(_0x4867e4){return function(_0x45c245){try{jsonpatch[_0x8b3d('0x23')](_0x45c245,_0x4867e4,!![]);}catch(_0xff346c){return BPromise[_0x8b3d('0x24')](_0xff346c);}return _0x45c245[_0x8b3d('0x25')]();};}function saveUpdates(_0x43a68,_0x3510f4){return function(_0x116ea4){if(_0x116ea4){return _0x116ea4[_0x8b3d('0x26')](_0x43a68)[_0x8b3d('0x27')](function(_0x338f6b){return _0x338f6b;});}return null;};}function removeEntity(_0x5462c6,_0x37c98e){return function(_0x584a71){if(_0x584a71){return _0x584a71[_0x8b3d('0x28')]()[_0x8b3d('0x27')](function(){var _0x113633=_0x584a71[_0x8b3d('0x29')]({'plain':!![]});var _0x57fe10=_0x8b3d('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x57fe10,'resourceId':_0x113633['id']}})[_0x8b3d('0x27')](function(){return _0x584a71;});})['then'](function(){_0x5462c6['status'](0xcc)[_0x8b3d('0x1c')]();});}};}function handleEntityNotFound(_0x3a075b,_0x52467f){return function(_0x5901f4){if(!_0x5901f4){_0x3a075b[_0x8b3d('0x1a')](0x194);}return _0x5901f4;};}function handleError(_0x3aef33,_0x15f2f4){_0x15f2f4=_0x15f2f4||0x1f4;return function(_0x1cab3a){logger[_0x8b3d('0x2b')](_0x1cab3a['stack']);if(_0x1cab3a[_0x8b3d('0x2c')]){delete _0x1cab3a[_0x8b3d('0x2c')];}_0x3aef33[_0x8b3d('0x1b')](_0x15f2f4)[_0x8b3d('0x2d')](_0x1cab3a);};}exports[_0x8b3d('0x2e')]=function(_0x487065,_0x520a69){var _0x3dae7e={},_0x20bc19={},_0x36a125={'count':0x0,'rows':[]};var _0x5cd208=_[_0x8b3d('0x2f')](db[_0x8b3d('0x30')][_0x8b3d('0x31')],function(_0x49db47){return{'name':_0x49db47[_0x8b3d('0x32')],'type':_0x49db47[_0x8b3d('0x33')][_0x8b3d('0x34')]};});_0x20bc19['model']=_['map'](_0x5cd208,_0x8b3d('0x2c'));_0x20bc19[_0x8b3d('0x35')]=_[_0x8b3d('0x36')](_0x487065[_0x8b3d('0x35')]);_0x20bc19[_0x8b3d('0x37')]=_[_0x8b3d('0x38')](_0x20bc19[_0x8b3d('0x39')],_0x20bc19['query']);_0x3dae7e[_0x8b3d('0x3a')]=_[_0x8b3d('0x38')](_0x20bc19[_0x8b3d('0x39')],qs[_0x8b3d('0x3b')](_0x487065[_0x8b3d('0x35')][_0x8b3d('0x3b')]));_0x3dae7e[_0x8b3d('0x3a')]=_0x3dae7e[_0x8b3d('0x3a')][_0x8b3d('0x3c')]?_0x3dae7e[_0x8b3d('0x3a')]:_0x20bc19[_0x8b3d('0x39')];if(!_0x487065[_0x8b3d('0x35')][_0x8b3d('0x3d')](_0x8b3d('0x3e'))){_0x3dae7e[_0x8b3d('0x1f')]=qs[_0x8b3d('0x1f')](_0x487065[_0x8b3d('0x35')]['limit']);_0x3dae7e['offset']=qs[_0x8b3d('0x21')](_0x487065['query'][_0x8b3d('0x21')]);}_0x3dae7e[_0x8b3d('0x3f')]=qs[_0x8b3d('0x40')](_0x487065['query']['sort']);_0x3dae7e[_0x8b3d('0x41')]=qs[_0x8b3d('0x37')](_[_0x8b3d('0x42')](_0x487065['query'],_0x20bc19['filters']),_0x5cd208);if(_0x487065['query'][_0x8b3d('0x43')]){_0x3dae7e[_0x8b3d('0x41')]=_['merge'](_0x3dae7e['where'],{'$or':_['map'](_0x5cd208,function(_0x1ef070){if(_0x1ef070['type']!==_0x8b3d('0x44')){var _0x8aa30={};_0x8aa30[_0x1ef070[_0x8b3d('0x2c')]]={'$like':'%'+_0x487065[_0x8b3d('0x35')][_0x8b3d('0x43')]+'%'};return _0x8aa30;}})});}_0x3dae7e=_[_0x8b3d('0x45')]({},_0x3dae7e,_0x487065[_0x8b3d('0x46')]);var _0x8a96ab={'where':_0x3dae7e[_0x8b3d('0x41')]};return db[_0x8b3d('0x30')][_0x8b3d('0x20')](_0x8a96ab)[_0x8b3d('0x27')](function(_0x42790b){_0x36a125[_0x8b3d('0x20')]=_0x42790b;if(_0x487065[_0x8b3d('0x35')][_0x8b3d('0x47')]){_0x3dae7e[_0x8b3d('0x48')]=[{'all':!![]}];}return db[_0x8b3d('0x30')][_0x8b3d('0x49')](_0x3dae7e);})['then'](function(_0x2d2c5e){_0x36a125['rows']=_0x2d2c5e;return _0x36a125;})[_0x8b3d('0x27')](respondWithFilteredResult(_0x520a69,_0x3dae7e))['catch'](handleError(_0x520a69,null));};exports[_0x8b3d('0x4a')]=function(_0x583a35,_0x1cc9f5){var _0x105eb6={'raw':!![],'where':{'id':_0x583a35[_0x8b3d('0x4b')]['id']}},_0x3b34d0={};_0x3b34d0[_0x8b3d('0x39')]=_[_0x8b3d('0x36')](db[_0x8b3d('0x30')][_0x8b3d('0x31')]);_0x3b34d0['query']=_[_0x8b3d('0x36')](_0x583a35[_0x8b3d('0x35')]);_0x3b34d0['filters']=_[_0x8b3d('0x38')](_0x3b34d0[_0x8b3d('0x39')],_0x3b34d0[_0x8b3d('0x35')]);_0x105eb6[_0x8b3d('0x3a')]=_[_0x8b3d('0x38')](_0x3b34d0[_0x8b3d('0x39')],qs[_0x8b3d('0x3b')](_0x583a35[_0x8b3d('0x35')][_0x8b3d('0x3b')]));_0x105eb6[_0x8b3d('0x3a')]=_0x105eb6['attributes'][_0x8b3d('0x3c')]?_0x105eb6['attributes']:_0x3b34d0[_0x8b3d('0x39')];if(_0x583a35[_0x8b3d('0x35')][_0x8b3d('0x47')]){_0x105eb6[_0x8b3d('0x48')]=[{'all':!![]}];}_0x105eb6=_[_0x8b3d('0x45')]({},_0x105eb6,_0x583a35['options']);return db[_0x8b3d('0x30')][_0x8b3d('0x4c')](_0x105eb6)[_0x8b3d('0x27')](handleEntityNotFound(_0x1cc9f5,null))[_0x8b3d('0x27')](respondWithResult(_0x1cc9f5,null))['catch'](handleError(_0x1cc9f5,null));};exports[_0x8b3d('0x4d')]=function(_0x4a49d6,_0x5d94e7){return db[_0x8b3d('0x30')][_0x8b3d('0x4d')](_0x4a49d6[_0x8b3d('0x4e')],{})[_0x8b3d('0x27')](function(_0x5535fe){var _0x17c133=_0x4a49d6[_0x8b3d('0x4f')]['get']({'plain':!![]});if(!_0x17c133)throw new Error(_0x8b3d('0x50'));if(_0x17c133[_0x8b3d('0x51')]===_0x8b3d('0x4f')){var _0x455623=_0x5535fe[_0x8b3d('0x29')]({'plain':!![]});var _0x454cf4=_0x8b3d('0x2a');return db[_0x8b3d('0x52')][_0x8b3d('0x4c')]({'where':{'name':_0x454cf4,'userProfileId':_0x17c133[_0x8b3d('0x53')]},'raw':!![]})['then'](function(_0x1dc9ef){if(_0x1dc9ef&&_0x1dc9ef['autoAssociation']===0x0){return db[_0x8b3d('0x54')]['create']({'name':_0x455623[_0x8b3d('0x2c')],'resourceId':_0x455623['id'],'type':_0x1dc9ef[_0x8b3d('0x2c')],'sectionId':_0x1dc9ef['id']},{})[_0x8b3d('0x27')](function(){return _0x5535fe;});}else{return _0x5535fe;}})[_0x8b3d('0x55')](function(_0x4e3102){logger[_0x8b3d('0x2b')](_0x8b3d('0x56'),_0x4e3102);throw _0x4e3102;});}return _0x5535fe;})[_0x8b3d('0x27')](respondWithResult(_0x5d94e7,0xc9))[_0x8b3d('0x55')](handleError(_0x5d94e7,null));};exports[_0x8b3d('0x26')]=function(_0x14154c,_0x5f123b){if(_0x14154c[_0x8b3d('0x4e')]['id']){delete _0x14154c['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x14154c[_0x8b3d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5f123b,null))[_0x8b3d('0x27')](saveUpdates(_0x14154c[_0x8b3d('0x4e')],null))['then'](respondWithResult(_0x5f123b,null))[_0x8b3d('0x55')](handleError(_0x5f123b,null));};exports[_0x8b3d('0x28')]=function(_0x52cfb7,_0x127811){return db[_0x8b3d('0x30')][_0x8b3d('0x4c')]({'where':{'id':_0x52cfb7[_0x8b3d('0x4b')]['id']}})[_0x8b3d('0x27')](handleEntityNotFound(_0x127811,null))['then'](removeEntity(_0x127811,null))[_0x8b3d('0x55')](handleError(_0x127811,null));}; \ No newline at end of file +var _0x9ca1=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','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','../../config/license/util','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','Dispositions','UserProfileResource','destroy','end','sendStatus','error','stack','name','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','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);}(_0x9ca1,0x1cc));var _0x19ca=function(_0x3f2adc,_0x17fddd){_0x3f2adc=_0x3f2adc-0x0;var _0x48a6bb=_0x9ca1[_0x3f2adc];return _0x48a6bb;};'use strict';var emlformat=require(_0x19ca('0x0'));var rimraf=require(_0x19ca('0x1'));var zipdir=require(_0x19ca('0x2'));var jsonpatch=require(_0x19ca('0x3'));var rp=require(_0x19ca('0x4'));var moment=require(_0x19ca('0x5'));var BPromise=require(_0x19ca('0x6'));var Mustache=require(_0x19ca('0x7'));var util=require(_0x19ca('0x8'));var path=require(_0x19ca('0x9'));var sox=require(_0x19ca('0xa'));var csv=require('to-csv');var ejs=require(_0x19ca('0xb'));var fs=require('fs');var fs_extra=require(_0x19ca('0xc'));var _=require(_0x19ca('0xd'));var squel=require('squel');var crypto=require(_0x19ca('0xe'));var jsforce=require(_0x19ca('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x19ca('0x10'));var querystring=require(_0x19ca('0x11'));var Papa=require('papaparse');var Redis=require(_0x19ca('0x12'));var authService=require(_0x19ca('0x13'));var qs=require(_0x19ca('0x14'));var as=require(_0x19ca('0x15'));var hardwareService=require(_0x19ca('0x16'));var logger=require(_0x19ca('0x17'))(_0x19ca('0x18'));var utils=require(_0x19ca('0x19'));var config=require(_0x19ca('0x1a'));var licenseUtil=require(_0x19ca('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x194637,_0x4b7849){_0x4b7849=_0x4b7849||0xcc;return function(_0x1cf26c){if(_0x1cf26c){return _0x194637['sendStatus'](_0x4b7849);}return _0x194637['status'](_0x4b7849)['end']();};}function respondWithResult(_0x1140fe,_0x2c95e9){_0x2c95e9=_0x2c95e9||0xc8;return function(_0xd3d0da){if(_0xd3d0da){return _0x1140fe[_0x19ca('0x1c')](_0x2c95e9)[_0x19ca('0x1d')](_0xd3d0da);}};}function respondWithFilteredResult(_0x41ce35,_0x5ef83a){return function(_0x4dd7bf){if(_0x4dd7bf){var _0x2e4e4c=typeof _0x5ef83a['offset']===_0x19ca('0x1e')&&typeof _0x5ef83a[_0x19ca('0x1f')]===_0x19ca('0x1e');var _0x32b675=_0x4dd7bf[_0x19ca('0x20')];var _0x576d19=_0x2e4e4c?0x0:_0x5ef83a['offset'];var _0x8d0152=_0x2e4e4c?_0x4dd7bf[_0x19ca('0x20')]:_0x5ef83a[_0x19ca('0x21')]+_0x5ef83a['limit'];var _0x18b386;if(_0x8d0152>=_0x32b675){_0x8d0152=_0x32b675;_0x18b386=0xc8;}else{_0x18b386=0xce;}_0x41ce35['status'](_0x18b386);return _0x41ce35[_0x19ca('0x22')](_0x19ca('0x23'),_0x576d19+'-'+_0x8d0152+'/'+_0x32b675)['json'](_0x4dd7bf);}return null;};}function patchUpdates(_0x11da7e){return function(_0x2b26e5){try{jsonpatch[_0x19ca('0x24')](_0x2b26e5,_0x11da7e,!![]);}catch(_0x4b1abc){return BPromise[_0x19ca('0x25')](_0x4b1abc);}return _0x2b26e5[_0x19ca('0x26')]();};}function saveUpdates(_0x5a0e6c,_0x12b6dc){return function(_0x29d9de){if(_0x29d9de){return _0x29d9de['update'](_0x5a0e6c)['then'](function(_0x56d564){return _0x56d564;});}return null;};}function removeEntity(_0x1764e5,_0x518fef){return function(_0x3db06f){if(_0x3db06f){return _0x3db06f['destroy']()[_0x19ca('0x27')](function(){var _0x4bed1b=_0x3db06f[_0x19ca('0x28')]({'plain':!![]});var _0x3cfe4c=_0x19ca('0x29');return db[_0x19ca('0x2a')][_0x19ca('0x2b')]({'where':{'type':_0x3cfe4c,'resourceId':_0x4bed1b['id']}})[_0x19ca('0x27')](function(){return _0x3db06f;});})[_0x19ca('0x27')](function(){_0x1764e5[_0x19ca('0x1c')](0xcc)[_0x19ca('0x2c')]();});}};}function handleEntityNotFound(_0x110e02,_0x2a3197){return function(_0x280a30){if(!_0x280a30){_0x110e02[_0x19ca('0x2d')](0x194);}return _0x280a30;};}function handleError(_0xfe17cf,_0x1b0d3e){_0x1b0d3e=_0x1b0d3e||0x1f4;return function(_0x398da7){logger[_0x19ca('0x2e')](_0x398da7[_0x19ca('0x2f')]);if(_0x398da7[_0x19ca('0x30')]){delete _0x398da7[_0x19ca('0x30')];}_0xfe17cf[_0x19ca('0x1c')](_0x1b0d3e)['send'](_0x398da7);};}exports['index']=function(_0x58d699,_0x27c2c4){var _0x83e400={},_0x12064e={},_0x2eebd7={'count':0x0,'rows':[]};var _0x14e08a=_[_0x19ca('0x31')](db[_0x19ca('0x32')][_0x19ca('0x33')],function(_0x2493a5){return{'name':_0x2493a5[_0x19ca('0x34')],'type':_0x2493a5[_0x19ca('0x35')][_0x19ca('0x36')]};});_0x12064e[_0x19ca('0x37')]=_['map'](_0x14e08a,_0x19ca('0x30'));_0x12064e[_0x19ca('0x38')]=_[_0x19ca('0x39')](_0x58d699['query']);_0x12064e[_0x19ca('0x3a')]=_[_0x19ca('0x3b')](_0x12064e[_0x19ca('0x37')],_0x12064e['query']);_0x83e400[_0x19ca('0x3c')]=_[_0x19ca('0x3b')](_0x12064e[_0x19ca('0x37')],qs['fields'](_0x58d699['query'][_0x19ca('0x3d')]));_0x83e400[_0x19ca('0x3c')]=_0x83e400[_0x19ca('0x3c')][_0x19ca('0x3e')]?_0x83e400[_0x19ca('0x3c')]:_0x12064e['model'];if(!_0x58d699['query'][_0x19ca('0x3f')]('nolimit')){_0x83e400[_0x19ca('0x1f')]=qs[_0x19ca('0x1f')](_0x58d699[_0x19ca('0x38')]['limit']);_0x83e400[_0x19ca('0x21')]=qs[_0x19ca('0x21')](_0x58d699[_0x19ca('0x38')][_0x19ca('0x21')]);}_0x83e400[_0x19ca('0x40')]=qs[_0x19ca('0x41')](_0x58d699[_0x19ca('0x38')][_0x19ca('0x41')]);_0x83e400[_0x19ca('0x42')]=qs[_0x19ca('0x3a')](_[_0x19ca('0x43')](_0x58d699['query'],_0x12064e[_0x19ca('0x3a')]),_0x14e08a);if(_0x58d699[_0x19ca('0x38')][_0x19ca('0x44')]){_0x83e400[_0x19ca('0x42')]=_[_0x19ca('0x45')](_0x83e400[_0x19ca('0x42')],{'$or':_[_0x19ca('0x31')](_0x14e08a,function(_0x4ffed9){if(_0x4ffed9['type']!==_0x19ca('0x46')){var _0x104d8b={};_0x104d8b[_0x4ffed9[_0x19ca('0x30')]]={'$like':'%'+_0x58d699[_0x19ca('0x38')][_0x19ca('0x44')]+'%'};return _0x104d8b;}})});}_0x83e400=_[_0x19ca('0x45')]({},_0x83e400,_0x58d699[_0x19ca('0x47')]);var _0x16109b={'where':_0x83e400[_0x19ca('0x42')]};return db[_0x19ca('0x32')]['count'](_0x16109b)['then'](function(_0x46877a){_0x2eebd7['count']=_0x46877a;if(_0x58d699[_0x19ca('0x38')][_0x19ca('0x48')]){_0x83e400[_0x19ca('0x49')]=[{'all':!![]}];}return db[_0x19ca('0x32')][_0x19ca('0x4a')](_0x83e400);})['then'](function(_0x5d2182){_0x2eebd7[_0x19ca('0x4b')]=_0x5d2182;return _0x2eebd7;})[_0x19ca('0x27')](respondWithFilteredResult(_0x27c2c4,_0x83e400))[_0x19ca('0x4c')](handleError(_0x27c2c4,null));};exports[_0x19ca('0x4d')]=function(_0x2061b3,_0x22bfb4){var _0x203ba2={'raw':!![],'where':{'id':_0x2061b3[_0x19ca('0x4e')]['id']}},_0x4bf362={};_0x4bf362[_0x19ca('0x37')]=_[_0x19ca('0x39')](db[_0x19ca('0x32')]['rawAttributes']);_0x4bf362['query']=_[_0x19ca('0x39')](_0x2061b3[_0x19ca('0x38')]);_0x4bf362[_0x19ca('0x3a')]=_[_0x19ca('0x3b')](_0x4bf362[_0x19ca('0x37')],_0x4bf362[_0x19ca('0x38')]);_0x203ba2[_0x19ca('0x3c')]=_['intersection'](_0x4bf362[_0x19ca('0x37')],qs['fields'](_0x2061b3[_0x19ca('0x38')][_0x19ca('0x3d')]));_0x203ba2[_0x19ca('0x3c')]=_0x203ba2[_0x19ca('0x3c')]['length']?_0x203ba2[_0x19ca('0x3c')]:_0x4bf362['model'];if(_0x2061b3[_0x19ca('0x38')]['includeAll']){_0x203ba2[_0x19ca('0x49')]=[{'all':!![]}];}_0x203ba2=_['merge']({},_0x203ba2,_0x2061b3[_0x19ca('0x47')]);return db[_0x19ca('0x32')][_0x19ca('0x4f')](_0x203ba2)[_0x19ca('0x27')](handleEntityNotFound(_0x22bfb4,null))[_0x19ca('0x27')](respondWithResult(_0x22bfb4,null))[_0x19ca('0x4c')](handleError(_0x22bfb4,null));};exports[_0x19ca('0x50')]=function(_0x4af6aa,_0xfd190f){return db[_0x19ca('0x32')][_0x19ca('0x50')](_0x4af6aa[_0x19ca('0x51')],{})['then'](function(_0x159d38){var _0x315208=_0x4af6aa['user'][_0x19ca('0x28')]({'plain':!![]});if(!_0x315208)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x315208[_0x19ca('0x52')]===_0x19ca('0x53')){var _0x1e92fe=_0x159d38[_0x19ca('0x28')]({'plain':!![]});var _0x5159a8=_0x19ca('0x29');return db[_0x19ca('0x54')][_0x19ca('0x4f')]({'where':{'name':_0x5159a8,'userProfileId':_0x315208[_0x19ca('0x55')]},'raw':!![]})[_0x19ca('0x27')](function(_0x5ec75e){if(_0x5ec75e&&_0x5ec75e['autoAssociation']===0x0){return db[_0x19ca('0x2a')]['create']({'name':_0x1e92fe[_0x19ca('0x30')],'resourceId':_0x1e92fe['id'],'type':_0x5ec75e[_0x19ca('0x30')],'sectionId':_0x5ec75e['id']},{})['then'](function(){return _0x159d38;});}else{return _0x159d38;}})[_0x19ca('0x4c')](function(_0x205faf){logger[_0x19ca('0x2e')](_0x19ca('0x56'),_0x205faf);throw _0x205faf;});}return _0x159d38;})[_0x19ca('0x27')](respondWithResult(_0xfd190f,0xc9))[_0x19ca('0x4c')](handleError(_0xfd190f,null));};exports[_0x19ca('0x57')]=function(_0x1a9e47,_0x1f31c0){if(_0x1a9e47[_0x19ca('0x51')]['id']){delete _0x1a9e47[_0x19ca('0x51')]['id'];}return db[_0x19ca('0x32')][_0x19ca('0x4f')]({'where':{'id':_0x1a9e47['params']['id']}})[_0x19ca('0x27')](handleEntityNotFound(_0x1f31c0,null))['then'](saveUpdates(_0x1a9e47['body'],null))[_0x19ca('0x27')](respondWithResult(_0x1f31c0,null))[_0x19ca('0x4c')](handleError(_0x1f31c0,null));};exports[_0x19ca('0x2b')]=function(_0x3fde10,_0xc8b9c){return db[_0x19ca('0x32')][_0x19ca('0x4f')]({'where':{'id':_0x3fde10[_0x19ca('0x4e')]['id']}})[_0x19ca('0x27')](handleEntityNotFound(_0xc8b9c,null))[_0x19ca('0x27')](removeEntity(_0xc8b9c,null))['catch'](handleError(_0xc8b9c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 480c579..7dba75e 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 _0x8fa7=['util','../../config/logger','api','moment','bluebird','path','exports','tools_dispositions','name_voice','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId'];(function(_0x507b0b,_0x5f1c1a){var _0x4fafa9=function(_0x20c69a){while(--_0x20c69a){_0x507b0b['push'](_0x507b0b['shift']());}};_0x4fafa9(++_0x5f1c1a);}(_0x8fa7,0x17c));var _0x78fa=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x8fa7[_0x5027b1];return _0x4a46cf;};'use strict';var _=require('lodash');var util=require(_0x78fa('0x0'));var logger=require(_0x78fa('0x1'))(_0x78fa('0x2'));var moment=require(_0x78fa('0x3'));var BPromise=require(_0x78fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78fa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x78fa('0x6')]=function(_0x16ded8,_0x1a50a7){return _0x16ded8['define']('Disposition',attributes,{'tableName':_0x78fa('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x78fa('0x8'),'fields':['name','ListId']},{'unique':!![],'name':_0x78fa('0x9'),'fields':[_0x78fa('0xa'),_0x78fa('0xb')]},{'unique':!![],'name':_0x78fa('0xc'),'fields':[_0x78fa('0xa'),_0x78fa('0xd')]},{'unique':!![],'name':'name_sms','fields':['name',_0x78fa('0xe')]},{'unique':!![],'name':_0x78fa('0xf'),'fields':[_0x78fa('0xa'),'FaxAccountId']},{'unique':!![],'name':_0x78fa('0x10'),'fields':[_0x78fa('0xa'),'OpenchannelAccountId']},{'unique':!![],'name':_0x78fa('0x11'),'fields':['name',_0x78fa('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9849=['ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x9849,0x1a2));var _0x9984=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x9849[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0x9984('0x0'));var util=require('util');var logger=require(_0x9984('0x1'))(_0x9984('0x2'));var moment=require(_0x9984('0x3'));var BPromise=require(_0x9984('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9984('0x5'));var config=require(_0x9984('0x6'));var attributes=require(_0x9984('0x7'));module[_0x9984('0x8')]=function(_0x50bd4d,_0x437188){return _0x50bd4d[_0x9984('0x9')](_0x9984('0xa'),attributes,{'tableName':_0x9984('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9984('0xc'),'fields':[_0x9984('0xd'),_0x9984('0xe')]},{'unique':!![],'name':_0x9984('0xf'),'fields':[_0x9984('0xd'),_0x9984('0x10')]},{'unique':!![],'name':_0x9984('0x11'),'fields':[_0x9984('0xd'),_0x9984('0x12')]},{'unique':!![],'name':_0x9984('0x13'),'fields':[_0x9984('0xd'),_0x9984('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0x9984('0xd'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x9984('0xd'),_0x9984('0x15')]},{'unique':!![],'name':_0x9984('0x16'),'fields':[_0x9984('0xd'),_0x9984('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index be25871..fe95726 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(_0x186d09,_0x2c85e1){var _0xfa8c41=function(_0x1d93ef){while(--_0x1d93ef){_0x186d09['push'](_0x186d09['shift']());}};_0xfa8c41(++_0x2c85e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x566efd,_0x5ddae3){var _0x4bb188=function(_0x981ec2){while(--_0x981ec2){_0x566efd['push'](_0x566efd['shift']());}};_0x4bb188(++_0x5ddae3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 3fa85cf..c173dc6 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 _0xa7f4=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xa7f4,0xa7));var _0x4a7f=function(_0x1b305e,_0x52f3de){_0x1b305e=_0x1b305e-0x0;var _0x28fb07=_0xa7f4[_0x1b305e];return _0x28fb07;};'use strict';var multer=require('multer');var util=require(_0x4a7f('0x0'));var path=require(_0x4a7f('0x1'));var timeout=require(_0x4a7f('0x2'));var express=require(_0x4a7f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4a7f('0x4'));var interaction=require(_0x4a7f('0x5'));var config=require(_0x4a7f('0x6'));var controller=require(_0x4a7f('0x7'));router[_0x4a7f('0x8')]('/',auth[_0x4a7f('0x9')](),controller[_0x4a7f('0xa')]);router[_0x4a7f('0x8')](_0x4a7f('0xb'),auth[_0x4a7f('0x9')](),controller[_0x4a7f('0xc')]);router[_0x4a7f('0xd')]('/',auth[_0x4a7f('0x9')](),controller[_0x4a7f('0xe')]);router[_0x4a7f('0xf')](_0x4a7f('0xb'),auth[_0x4a7f('0x9')](),controller[_0x4a7f('0x10')]);router[_0x4a7f('0x11')]('/:id',auth[_0x4a7f('0x9')](),controller[_0x4a7f('0x12')]);module[_0x4a7f('0x13')]=router; \ No newline at end of file +var _0xb568=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','path'];(function(_0x300caf,_0x6118c5){var _0x18ce81=function(_0x1c867d){while(--_0x1c867d){_0x300caf['push'](_0x300caf['shift']());}};_0x18ce81(++_0x6118c5);}(_0xb568,0x1ec));var _0x8b56=function(_0x50a635,_0x158de3){_0x50a635=_0x50a635-0x0;var _0x15fcdf=_0xb568[_0x50a635];return _0x15fcdf;};'use strict';var multer=require(_0x8b56('0x0'));var util=require('util');var path=require(_0x8b56('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b56('0x2'));var router=express[_0x8b56('0x3')]();var fs_extra=require(_0x8b56('0x4'));var auth=require(_0x8b56('0x5'));var interaction=require(_0x8b56('0x6'));var config=require(_0x8b56('0x7'));var controller=require(_0x8b56('0x8'));router[_0x8b56('0x9')]('/',auth[_0x8b56('0xa')](),controller[_0x8b56('0xb')]);router['get'](_0x8b56('0xc'),auth['isAuthenticated'](),controller[_0x8b56('0xd')]);router[_0x8b56('0xe')]('/',auth[_0x8b56('0xa')](),controller[_0x8b56('0xf')]);router['put'](_0x8b56('0xc'),auth[_0x8b56('0xa')](),controller[_0x8b56('0x10')]);router[_0x8b56('0x11')](_0x8b56('0xc'),auth[_0x8b56('0xa')](),controller[_0x8b56('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 9773141..6af15ea 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 _0xa85a=['DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa85a,0x103));var _0xaa85=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa85a[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xaa85('0x0'));module[_0xaa85('0x1')]={'name':{'type':Sequelize[_0xaa85('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0xaa85('0x3'),'no'),'defaultValue':_0xaa85('0x3')},'headerinfo':{'type':Sequelize[_0xaa85('0x2')],'defaultValue':_0xaa85('0x4')},'localstationid':{'type':Sequelize[_0xaa85('0x2')],'unique':_0xaa85('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xaa85('0x6'),_0xaa85('0x7'),_0xaa85('0x8'),_0xaa85('0x9'),_0xaa85('0xa'),'14400'),'defaultValue':_0xaa85('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400',_0xaa85('0x7'),'7200',_0xaa85('0x9'),_0xaa85('0xa'),_0xaa85('0xb')),'defaultValue':_0xaa85('0xb')},'modem':{'type':Sequelize[_0xaa85('0x2')],'defaultValue':_0xaa85('0xc')},'gateway':{'type':Sequelize[_0xaa85('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xaa85('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xaa85('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xaa85('0xe'),_0xaa85('0xf'),_0xaa85('0x10'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xaa85('0x11')],'defaultValue':function(){return _0xaa85('0x12');}},'notificationSound':{'type':Sequelize[_0xaa85('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaa85('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaa85('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaa85('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaa85('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xaa85('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xaa85('0x13')],'defaultValue':![],'comment':_0xaa85('0x15'),'set':function(_0x3fbca8){if(!_0x3fbca8)this[_0xaa85('0x16')](_0xaa85('0x17'),null);this[_0xaa85('0x16')](_0xaa85('0x18'),_0x3fbca8);}}}; \ No newline at end of file +var _0xc939=['INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400','7200','9600','12000','4800','14400','v17,v27,v29'];(function(_0x2417af,_0x24011d){var _0x3736bb=function(_0x9b621f){while(--_0x9b621f){_0x2417af['push'](_0x2417af['shift']());}};_0x3736bb(++_0x24011d);}(_0xc939,0xed));var _0x9c93=function(_0x14eece,_0x326c42){_0x14eece=_0x14eece-0x0;var _0xdf72c8=_0xc939[_0x14eece];return _0xdf72c8;};'use strict';var Sequelize=require(_0x9c93('0x0'));module[_0x9c93('0x1')]={'name':{'type':Sequelize[_0x9c93('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c93('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x9c93('0x3'),'no'),'defaultValue':_0x9c93('0x3')},'headerinfo':{'type':Sequelize[_0x9c93('0x2')],'defaultValue':_0x9c93('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x9c93('0x5')](_0x9c93('0x6'),'4800',_0x9c93('0x7'),_0x9c93('0x8'),_0x9c93('0x9'),'14400'),'defaultValue':_0x9c93('0xa')},'maxrate':{'type':Sequelize[_0x9c93('0x5')](_0x9c93('0x6'),'4800',_0x9c93('0x7'),_0x9c93('0x8'),_0x9c93('0x9'),_0x9c93('0xb')),'defaultValue':_0x9c93('0xb')},'modem':{'type':Sequelize[_0x9c93('0x2')],'defaultValue':_0x9c93('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9c93('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9c93('0x5')](_0x9c93('0xe'),_0x9c93('0xf'),_0x9c93('0x10'),'KHOMP'),'defaultValue':_0x9c93('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9c93('0x11')],'defaultValue':function(){return _0x9c93('0x12');}},'notificationSound':{'type':Sequelize[_0x9c93('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9c93('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c93('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9c93('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c93('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9c93('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9c93('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x9c93('0x13')],'defaultValue':![],'comment':_0x9c93('0x15'),'set':function(_0x454c3d){if(!_0x454c3d)this[_0x9c93('0x16')](_0x9c93('0x17'),null);this['setDataValue'](_0x9c93('0x18'),_0x454c3d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 4ffdb30..06ec638 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 _0xc2f9=['path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxAccount,\x20%s,\x20%s','result','sendStatus','status','end','offset','undefined','set','Content-Range','json','apply','save','update','destroy','FaxAccounts','UserProfileResource','then','stack','name','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','Pause','keys','length','merge','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tags','tag','addApplications','sequelize','FaxApplication','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','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','transaction','bulkCreate','updateAccountApplications','VoiceExtension','tech','key','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','util'];(function(_0x977034,_0x21020d){var _0x470685=function(_0x5da588){while(--_0x5da588){_0x977034['push'](_0x977034['shift']());}};_0x470685(++_0x21020d);}(_0xc2f9,0x17a));var _0x9c2f=function(_0x7e622f,_0x49698e){_0x7e622f=_0x7e622f-0x0;var _0x1bedc5=_0xc2f9[_0x7e622f];return _0x1bedc5;};'use strict';var emlformat=require(_0x9c2f('0x0'));var rimraf=require(_0x9c2f('0x1'));var zipdir=require(_0x9c2f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c2f('0x3'));var moment=require(_0x9c2f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c2f('0x5'));var path=require(_0x9c2f('0x6'));var sox=require('sox');var csv=require(_0x9c2f('0x7'));var ejs=require(_0x9c2f('0x8'));var fs=require('fs');var fs_extra=require(_0x9c2f('0x9'));var _=require(_0x9c2f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9c2f('0xb'));var deskjs=require(_0x9c2f('0xc'));var toCsv=require(_0x9c2f('0x7'));var querystring=require(_0x9c2f('0xd'));var Papa=require(_0x9c2f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9c2f('0xf'));var as=require(_0x9c2f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c2f('0x11'));var utils=require('../../config/utils');var config=require(_0x9c2f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c2f('0x13'))['db'];config[_0x9c2f('0x14')]=_[_0x9c2f('0x15')](config[_0x9c2f('0x14')],{'host':_0x9c2f('0x16'),'port':0x18eb});var socket=require(_0x9c2f('0x17'))(new Redis(config['redis']));require(_0x9c2f('0x18'))[_0x9c2f('0x19')](socket);var jayson=require(_0x9c2f('0x1a'));var client=jayson['client'][_0x9c2f('0x1b')]({'port':0x232c});var client9002=jayson[_0x9c2f('0x1c')][_0x9c2f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5b1c5f,_0x3989f3,_0x19114a,_0x540c4a){return new BPromise(function(_0x5cfbcd,_0x271597){var _0x4beabc=_0x540c4a||client;return _0x4beabc['request'](_0x5b1c5f,_0x19114a)['then'](function(_0x53d28a){logger[_0x9c2f('0x1d')]('FaxAccount,\x20%s,\x20%s',_0x3989f3,_0x9c2f('0x1e'));logger[_0x9c2f('0x1f')](_0x9c2f('0x20'),_0x3989f3,'request\x20sent',JSON[_0x9c2f('0x21')](_0x53d28a));if(_0x53d28a[_0x9c2f('0x22')]){if(_0x53d28a['error']['code']===0x1f4){logger[_0x9c2f('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3989f3,_0x53d28a[_0x9c2f('0x22')]['message']);return _0x271597(_0x53d28a['error'][_0x9c2f('0x23')]);}logger[_0x9c2f('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3989f3,_0x53d28a['error']['message']);return _0x5cfbcd(_0x53d28a[_0x9c2f('0x22')][_0x9c2f('0x23')]);}else{logger[_0x9c2f('0x1d')](_0x9c2f('0x24'),_0x3989f3,'request\x20sent');_0x5cfbcd(_0x53d28a[_0x9c2f('0x25')]['message']);}})['catch'](function(_0x365d0f){logger[_0x9c2f('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3989f3,_0x365d0f);_0x271597(_0x365d0f);});});}function respondWithStatusCode(_0x4fb4b7,_0xad78ec){_0xad78ec=_0xad78ec||0xcc;return function(_0x177014){if(_0x177014){return _0x4fb4b7[_0x9c2f('0x26')](_0xad78ec);}return _0x4fb4b7[_0x9c2f('0x27')](_0xad78ec)[_0x9c2f('0x28')]();};}function respondWithResult(_0x645beb,_0x1fe921){_0x1fe921=_0x1fe921||0xc8;return function(_0x1df723){if(_0x1df723){return _0x645beb[_0x9c2f('0x27')](_0x1fe921)['json'](_0x1df723);}};}function respondWithFilteredResult(_0x39dcd2,_0x546fc7){return function(_0x3f56e9){if(_0x3f56e9){var _0x56c76f=typeof _0x546fc7[_0x9c2f('0x29')]===_0x9c2f('0x2a')&&typeof _0x546fc7['limit']===_0x9c2f('0x2a');var _0x10edce=_0x3f56e9['count'];var _0x369090=_0x56c76f?0x0:_0x546fc7[_0x9c2f('0x29')];var _0x1ca175=_0x56c76f?_0x3f56e9['count']:_0x546fc7[_0x9c2f('0x29')]+_0x546fc7['limit'];var _0x21f889;if(_0x1ca175>=_0x10edce){_0x1ca175=_0x10edce;_0x21f889=0xc8;}else{_0x21f889=0xce;}_0x39dcd2[_0x9c2f('0x27')](_0x21f889);return _0x39dcd2[_0x9c2f('0x2b')](_0x9c2f('0x2c'),_0x369090+'-'+_0x1ca175+'/'+_0x10edce)[_0x9c2f('0x2d')](_0x3f56e9);}return null;};}function patchUpdates(_0x4066cf){return function(_0x3bc750){try{jsonpatch[_0x9c2f('0x2e')](_0x3bc750,_0x4066cf,!![]);}catch(_0x17dd10){return BPromise['reject'](_0x17dd10);}return _0x3bc750[_0x9c2f('0x2f')]();};}function saveUpdates(_0x295b6a,_0xa8bb83){return function(_0x10fa6c){if(_0x10fa6c){return _0x10fa6c[_0x9c2f('0x30')](_0x295b6a)['then'](function(_0x491ac2){return _0x491ac2;});}return null;};}function removeEntity(_0x39819a,_0x53b863){return function(_0x5e42c2){if(_0x5e42c2){return _0x5e42c2[_0x9c2f('0x31')]()['then'](function(){var _0x37c937=_0x5e42c2['get']({'plain':!![]});var _0x57be97=_0x9c2f('0x32');return db[_0x9c2f('0x33')][_0x9c2f('0x31')]({'where':{'type':_0x57be97,'resourceId':_0x37c937['id']}})[_0x9c2f('0x34')](function(){return _0x5e42c2;});})[_0x9c2f('0x34')](function(){_0x39819a[_0x9c2f('0x27')](0xcc)[_0x9c2f('0x28')]();});}};}function handleEntityNotFound(_0x3a65fc,_0x5dfaa1){return function(_0x2d30b0){if(!_0x2d30b0){_0x3a65fc['sendStatus'](0x194);}return _0x2d30b0;};}function handleError(_0x5ec47e,_0x52c9f1){_0x52c9f1=_0x52c9f1||0x1f4;return function(_0x58a270){logger['error'](_0x58a270[_0x9c2f('0x35')]);if(_0x58a270['name']){delete _0x58a270[_0x9c2f('0x36')];}_0x5ec47e[_0x9c2f('0x27')](_0x52c9f1)['send'](_0x58a270);};}exports[_0x9c2f('0x37')]=function(_0x3e94a5,_0x4e888d){var _0xfb43fb={'include':[{'model':db['Pause'],'as':_0x9c2f('0x38')}]},_0x531d6f={},_0x3c2a72={'count':0x0,'rows':[]};var _0x5ee665=_[_0x9c2f('0x39')](db[_0x9c2f('0x3a')][_0x9c2f('0x3b')],function(_0x4eb7a8){return{'name':_0x4eb7a8[_0x9c2f('0x3c')],'type':_0x4eb7a8[_0x9c2f('0x3d')]['key']};});_0x531d6f[_0x9c2f('0x3e')]=_[_0x9c2f('0x39')](_0x5ee665,_0x9c2f('0x36'));_0x531d6f[_0x9c2f('0x3f')]=_['keys'](_0x3e94a5[_0x9c2f('0x3f')]);_0x531d6f[_0x9c2f('0x40')]=_[_0x9c2f('0x41')](_0x531d6f[_0x9c2f('0x3e')],_0x531d6f[_0x9c2f('0x3f')]);_0xfb43fb[_0x9c2f('0x42')]=_['intersection'](_0x531d6f['model'],qs[_0x9c2f('0x43')](_0x3e94a5[_0x9c2f('0x3f')]['fields']));_0xfb43fb[_0x9c2f('0x42')]=_0xfb43fb[_0x9c2f('0x42')]['length']?_0xfb43fb[_0x9c2f('0x42')]:_0x531d6f[_0x9c2f('0x3e')];if(!_0x3e94a5[_0x9c2f('0x3f')][_0x9c2f('0x44')](_0x9c2f('0x45'))){_0xfb43fb['limit']=qs[_0x9c2f('0x46')](_0x3e94a5['query'][_0x9c2f('0x46')]);_0xfb43fb[_0x9c2f('0x29')]=qs[_0x9c2f('0x29')](_0x3e94a5[_0x9c2f('0x3f')][_0x9c2f('0x29')]);}_0xfb43fb[_0x9c2f('0x47')]=qs[_0x9c2f('0x48')](_0x3e94a5[_0x9c2f('0x3f')]['sort']);_0xfb43fb[_0x9c2f('0x49')]=qs[_0x9c2f('0x40')](_[_0x9c2f('0x4a')](_0x3e94a5[_0x9c2f('0x3f')],_0x531d6f['filters']),_0x5ee665);if(_0x3e94a5[_0x9c2f('0x3f')][_0x9c2f('0x4b')]){_0xfb43fb[_0x9c2f('0x49')]=_['merge'](_0xfb43fb[_0x9c2f('0x49')],{'$or':_[_0x9c2f('0x39')](_0x5ee665,function(_0x4ff804){if(_0x4ff804[_0x9c2f('0x3d')]!==_0x9c2f('0x4c')){var _0x4bc195={};_0x4bc195[_0x4ff804[_0x9c2f('0x36')]]={'$like':'%'+_0x3e94a5[_0x9c2f('0x3f')]['filter']+'%'};return _0x4bc195;}})});}_0xfb43fb=_['merge']({},_0xfb43fb,_0x3e94a5[_0x9c2f('0x4d')]);var _0x5048f5={'where':_0xfb43fb[_0x9c2f('0x49')]};return db[_0x9c2f('0x3a')][_0x9c2f('0x4e')](_0x5048f5)['then'](function(_0x49296c){_0x3c2a72['count']=_0x49296c;if(_0x3e94a5['query'][_0x9c2f('0x4f')]){_0xfb43fb[_0x9c2f('0x50')]=[{'all':!![]}];}return db[_0x9c2f('0x3a')][_0x9c2f('0x51')](_0xfb43fb);})[_0x9c2f('0x34')](function(_0x84a1ea){_0x3c2a72[_0x9c2f('0x52')]=_0x84a1ea;return _0x3c2a72;})['then'](respondWithFilteredResult(_0x4e888d,_0xfb43fb))[_0x9c2f('0x53')](handleError(_0x4e888d,null));};exports[_0x9c2f('0x54')]=function(_0x1d6f29,_0x4a1dd2){var _0x293bc6={'raw':![],'where':{'id':_0x1d6f29['params']['id']},'include':[{'model':db[_0x9c2f('0x55')],'as':_0x9c2f('0x38')}]},_0x262ba7={};_0x262ba7[_0x9c2f('0x3e')]=_['keys'](db[_0x9c2f('0x3a')][_0x9c2f('0x3b')]);_0x262ba7[_0x9c2f('0x3f')]=_[_0x9c2f('0x56')](_0x1d6f29[_0x9c2f('0x3f')]);_0x262ba7['filters']=_[_0x9c2f('0x41')](_0x262ba7['model'],_0x262ba7[_0x9c2f('0x3f')]);_0x293bc6['attributes']=_[_0x9c2f('0x41')](_0x262ba7[_0x9c2f('0x3e')],qs[_0x9c2f('0x43')](_0x1d6f29[_0x9c2f('0x3f')][_0x9c2f('0x43')]));_0x293bc6[_0x9c2f('0x42')]=_0x293bc6[_0x9c2f('0x42')][_0x9c2f('0x57')]?_0x293bc6[_0x9c2f('0x42')]:_0x262ba7[_0x9c2f('0x3e')];if(_0x1d6f29[_0x9c2f('0x3f')][_0x9c2f('0x4f')]){_0x293bc6['include']=[{'all':!![]}];}_0x293bc6=_[_0x9c2f('0x58')]({},_0x293bc6,_0x1d6f29[_0x9c2f('0x4d')]);return db[_0x9c2f('0x3a')]['find'](_0x293bc6)[_0x9c2f('0x34')](handleEntityNotFound(_0x4a1dd2,null))[_0x9c2f('0x34')](respondWithResult(_0x4a1dd2,null))['catch'](handleError(_0x4a1dd2,null));};exports[_0x9c2f('0x59')]=function(_0x2d418d,_0x5befc8){return db[_0x9c2f('0x3a')][_0x9c2f('0x59')](_0x2d418d['body'],{})[_0x9c2f('0x34')](function(_0x21c9ba){var _0x292e8d=_0x2d418d['user'][_0x9c2f('0x5a')]({'plain':!![]});if(!_0x292e8d)throw new Error(_0x9c2f('0x5b'));if(_0x292e8d['role']===_0x9c2f('0x5c')){var _0xb6603f=_0x21c9ba[_0x9c2f('0x5a')]({'plain':!![]});var _0x47d7fb=_0x9c2f('0x32');return db[_0x9c2f('0x5d')][_0x9c2f('0x5e')]({'where':{'name':_0x47d7fb,'userProfileId':_0x292e8d[_0x9c2f('0x5f')]},'raw':!![]})['then'](function(_0xda4e57){if(_0xda4e57&&_0xda4e57['autoAssociation']===0x0){return db[_0x9c2f('0x33')]['create']({'name':_0xb6603f[_0x9c2f('0x36')],'resourceId':_0xb6603f['id'],'type':_0xda4e57[_0x9c2f('0x36')],'sectionId':_0xda4e57['id']},{})[_0x9c2f('0x34')](function(){return _0x21c9ba;});}else{return _0x21c9ba;}})[_0x9c2f('0x53')](function(_0x4b44b4){logger['error'](_0x9c2f('0x60'),_0x4b44b4);throw _0x4b44b4;});}return _0x21c9ba;})[_0x9c2f('0x34')](respondWithResult(_0x5befc8,0xc9))[_0x9c2f('0x53')](handleError(_0x5befc8,null));};exports[_0x9c2f('0x30')]=function(_0x21d9b4,_0x488918){if(_0x21d9b4[_0x9c2f('0x61')]['id']){delete _0x21d9b4[_0x9c2f('0x61')]['id'];}return db[_0x9c2f('0x3a')][_0x9c2f('0x5e')]({'where':{'id':_0x21d9b4[_0x9c2f('0x62')]['id']},'include':[{'model':db[_0x9c2f('0x55')],'as':_0x9c2f('0x38')}]})[_0x9c2f('0x34')](handleEntityNotFound(_0x488918,null))['then'](saveUpdates(_0x21d9b4['body'],null))[_0x9c2f('0x34')](respondWithResult(_0x488918,null))[_0x9c2f('0x53')](handleError(_0x488918,null));};exports[_0x9c2f('0x31')]=function(_0xe07375,_0x396ae5){return db[_0x9c2f('0x3a')][_0x9c2f('0x5e')]({'where':{'id':_0xe07375[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x396ae5,null))[_0x9c2f('0x34')](removeEntity(_0x396ae5,null))[_0x9c2f('0x53')](handleError(_0x396ae5,null));};exports[_0x9c2f('0x63')]=function(_0x2ed467,_0x1b02a3){return db[_0x9c2f('0x3a')][_0x9c2f('0x63')]()[_0x9c2f('0x34')](respondWithResult(_0x1b02a3,null))['catch'](handleError(_0x1b02a3,null));};exports[_0x9c2f('0x64')]=function(_0x3386b1,_0x4ce0c9,_0x3ef0d2){if(_0x3386b1['body']['id']){delete _0x3386b1['body']['id'];}return db[_0x9c2f('0x3a')]['find']({'where':{'id':_0x3386b1[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x4ce0c9,null))[_0x9c2f('0x34')](function(_0x26226c){if(_0x26226c){_0x3386b1[_0x9c2f('0x61')][_0x9c2f('0x65')]=_0x26226c['id'];return db[_0x9c2f('0x66')][_0x9c2f('0x59')](_0x3386b1['body']);}})[_0x9c2f('0x34')](respondWithResult(_0x4ce0c9,null))[_0x9c2f('0x53')](handleError(_0x4ce0c9,null));};exports[_0x9c2f('0x67')]=function(_0x4530b0,_0x4a4b07,_0x3a183a){var _0x297f81={'raw':![],'where':{}};var _0x23de82={};var _0x5f37e8={'count':0x0,'rows':[]};return db[_0x9c2f('0x3a')][_0x9c2f('0x68')]({'where':{'id':_0x4530b0[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x4a4b07,null))[_0x9c2f('0x34')](function(_0x48d0f5){if(_0x48d0f5){_0x23de82[_0x9c2f('0x3e')]=_['keys'](db[_0x9c2f('0x66')]['rawAttributes']);_0x23de82[_0x9c2f('0x3f')]=_[_0x9c2f('0x56')](_0x4530b0[_0x9c2f('0x3f')]);_0x23de82[_0x9c2f('0x40')]=_[_0x9c2f('0x41')](_0x23de82['model'],_0x23de82[_0x9c2f('0x3f')]);_0x297f81[_0x9c2f('0x42')]=_[_0x9c2f('0x41')](_0x23de82[_0x9c2f('0x3e')],qs['fields'](_0x4530b0[_0x9c2f('0x3f')][_0x9c2f('0x43')]));_0x297f81[_0x9c2f('0x42')]=_0x297f81[_0x9c2f('0x42')][_0x9c2f('0x57')]?_0x297f81['attributes']:_0x23de82[_0x9c2f('0x3e')];if(!_0x4530b0[_0x9c2f('0x3f')][_0x9c2f('0x44')](_0x9c2f('0x45'))){_0x297f81[_0x9c2f('0x46')]=qs[_0x9c2f('0x46')](_0x4530b0[_0x9c2f('0x3f')][_0x9c2f('0x46')]);_0x297f81[_0x9c2f('0x29')]=qs['offset'](_0x4530b0['query'][_0x9c2f('0x29')]);}_0x297f81['order']=qs[_0x9c2f('0x48')](_0x4530b0[_0x9c2f('0x3f')][_0x9c2f('0x48')]);_0x297f81[_0x9c2f('0x49')]=qs[_0x9c2f('0x40')](_[_0x9c2f('0x4a')](_0x4530b0['query'],_0x23de82[_0x9c2f('0x40')]));_0x297f81[_0x9c2f('0x49')][_0x9c2f('0x65')]=_0x48d0f5['id'];if(_0x4530b0['query'][_0x9c2f('0x4b')]){_0x297f81[_0x9c2f('0x49')]=_[_0x9c2f('0x58')](_0x297f81[_0x9c2f('0x49')],{'$or':_['map'](_0x297f81[_0x9c2f('0x42')],function(_0x6359e5){var _0x403193={};_0x403193[_0x6359e5]={'$like':'%'+_0x4530b0[_0x9c2f('0x3f')][_0x9c2f('0x4b')]+'%'};return _0x403193;})});}_0x297f81=_['merge']({},_0x297f81,_0x4530b0[_0x9c2f('0x4d')]);return db[_0x9c2f('0x66')][_0x9c2f('0x4e')]({'where':_0x297f81[_0x9c2f('0x49')]})[_0x9c2f('0x34')](function(_0x57dd26){_0x5f37e8[_0x9c2f('0x4e')]=_0x57dd26;if(_0x4530b0['query']['includeAll']){_0x297f81['include']=[{'all':!![]}];}return db[_0x9c2f('0x66')][_0x9c2f('0x51')](_0x297f81);})[_0x9c2f('0x34')](function(_0x214ccc){_0x5f37e8[_0x9c2f('0x52')]=_0x214ccc;return _0x5f37e8;});}})[_0x9c2f('0x34')](respondWithFilteredResult(_0x4a4b07,_0x297f81))[_0x9c2f('0x53')](handleError(_0x4a4b07,null));};exports[_0x9c2f('0x69')]=function(_0x3853f0,_0x326dae,_0x2a3ad9){return db[_0x9c2f('0x3a')][_0x9c2f('0x5e')]({'where':{'id':_0x3853f0[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x326dae,null))['then'](function(_0x3b91cb){if(_0x3b91cb){return _0x3b91cb['removeDispositions'](_0x3853f0[_0x9c2f('0x3f')]['ids']);}})[_0x9c2f('0x34')](respondWithStatusCode(_0x326dae,null))[_0x9c2f('0x53')](handleError(_0x326dae,null));};exports[_0x9c2f('0x6a')]=function(_0x31edb0,_0x48196f,_0x22bccb){if(_0x31edb0['body']['id']){delete _0x31edb0[_0x9c2f('0x61')]['id'];}return db['FaxAccount'][_0x9c2f('0x5e')]({'where':{'id':_0x31edb0[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x48196f,null))['then'](function(_0x2e974c){if(_0x2e974c){_0x31edb0[_0x9c2f('0x61')][_0x9c2f('0x65')]=_0x2e974c['id'];return db[_0x9c2f('0x6b')][_0x9c2f('0x59')](_0x31edb0[_0x9c2f('0x61')]);}})[_0x9c2f('0x34')](respondWithResult(_0x48196f,null))[_0x9c2f('0x53')](handleError(_0x48196f,null));};exports[_0x9c2f('0x6c')]=function(_0x7a6224,_0x4026f0,_0x3fd38b){var _0x446b05={'raw':![],'where':{}};var _0x36b8e4={};var _0x22ac53={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9c2f('0x68')]({'where':{'id':_0x7a6224[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x4026f0,null))[_0x9c2f('0x34')](function(_0x25bacc){if(_0x25bacc){_0x36b8e4[_0x9c2f('0x3e')]=_['keys'](db[_0x9c2f('0x6b')][_0x9c2f('0x3b')]);_0x36b8e4['query']=_[_0x9c2f('0x56')](_0x7a6224['query']);_0x36b8e4[_0x9c2f('0x40')]=_[_0x9c2f('0x41')](_0x36b8e4['model'],_0x36b8e4[_0x9c2f('0x3f')]);_0x446b05[_0x9c2f('0x42')]=_['intersection'](_0x36b8e4[_0x9c2f('0x3e')],qs['fields'](_0x7a6224['query'][_0x9c2f('0x43')]));_0x446b05[_0x9c2f('0x42')]=_0x446b05['attributes'][_0x9c2f('0x57')]?_0x446b05[_0x9c2f('0x42')]:_0x36b8e4[_0x9c2f('0x3e')];if(!_0x7a6224[_0x9c2f('0x3f')][_0x9c2f('0x44')](_0x9c2f('0x45'))){_0x446b05['limit']=qs['limit'](_0x7a6224[_0x9c2f('0x3f')][_0x9c2f('0x46')]);_0x446b05[_0x9c2f('0x29')]=qs[_0x9c2f('0x29')](_0x7a6224[_0x9c2f('0x3f')][_0x9c2f('0x29')]);}_0x446b05[_0x9c2f('0x47')]=qs[_0x9c2f('0x48')](_0x7a6224[_0x9c2f('0x3f')][_0x9c2f('0x48')]);_0x446b05['where']=qs[_0x9c2f('0x40')](_['pick'](_0x7a6224['query'],_0x36b8e4[_0x9c2f('0x40')]));_0x446b05['where'][_0x9c2f('0x65')]=_0x25bacc['id'];if(_0x7a6224['query'][_0x9c2f('0x4b')]){_0x446b05[_0x9c2f('0x49')]=_[_0x9c2f('0x58')](_0x446b05[_0x9c2f('0x49')],{'$or':_['map'](_0x446b05[_0x9c2f('0x42')],function(_0x9ea942){var _0x3739ff={};_0x3739ff[_0x9ea942]={'$like':'%'+_0x7a6224[_0x9c2f('0x3f')][_0x9c2f('0x4b')]+'%'};return _0x3739ff;})});}_0x446b05=_['merge']({},_0x446b05,_0x7a6224[_0x9c2f('0x4d')]);return db[_0x9c2f('0x6b')][_0x9c2f('0x4e')]({'where':_0x446b05[_0x9c2f('0x49')]})[_0x9c2f('0x34')](function(_0x154a31){_0x22ac53[_0x9c2f('0x4e')]=_0x154a31;if(_0x7a6224[_0x9c2f('0x3f')][_0x9c2f('0x4f')]){_0x446b05[_0x9c2f('0x50')]=[{'all':!![]}];}return db[_0x9c2f('0x6b')][_0x9c2f('0x51')](_0x446b05);})['then'](function(_0x50ad1e){_0x22ac53[_0x9c2f('0x52')]=_0x50ad1e;return _0x22ac53;});}})[_0x9c2f('0x34')](respondWithFilteredResult(_0x4026f0,_0x446b05))['catch'](handleError(_0x4026f0,null));};exports[_0x9c2f('0x6d')]=function(_0x5bb652,_0xb282aa,_0xd3b28f){return db['FaxAccount']['find']({'where':{'id':_0x5bb652['params']['id']}})['then'](handleEntityNotFound(_0xb282aa,null))[_0x9c2f('0x34')](function(_0x51a09a){if(_0x51a09a){return _0x51a09a[_0x9c2f('0x6d')](_0x5bb652[_0x9c2f('0x3f')][_0x9c2f('0x6e')]);}})[_0x9c2f('0x34')](respondWithStatusCode(_0xb282aa,null))[_0x9c2f('0x53')](handleError(_0xb282aa,null));};exports['addInteraction']=function(_0x1abc42,_0x1d8a93,_0x1618eb){return db[_0x9c2f('0x6f')][_0x9c2f('0x5e')]({'where':{'id':_0x1abc42[_0x9c2f('0x62')]['id']}})['then'](handleEntityNotFound(_0x1d8a93,null))[_0x9c2f('0x34')](function(_0x55e422){if(_0x55e422){return _0x55e422[_0x9c2f('0x70')](_0x1abc42['body'][_0x9c2f('0x6e')],_[_0x9c2f('0x71')](_0x1abc42[_0x9c2f('0x61')],['ids','id'])||{});}})[_0x9c2f('0x34')](respondWithResult(_0x1d8a93,null))[_0x9c2f('0x53')](handleError(_0x1d8a93,null));};exports[_0x9c2f('0x72')]=function(_0x55e203,_0x123d26,_0x3fa8c8){var _0x188a3b={'raw':![],'where':{}};var _0x48613b={};var _0x1594e8={'count':0x0,'rows':[]};return db[_0x9c2f('0x3a')][_0x9c2f('0x68')]({'where':{'id':_0x55e203[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x123d26,null))[_0x9c2f('0x34')](function(_0x328b38){if(_0x328b38){_0x48613b[_0x9c2f('0x3e')]=_[_0x9c2f('0x56')](db[_0x9c2f('0x6f')][_0x9c2f('0x3b')]);_0x48613b[_0x9c2f('0x3f')]=_[_0x9c2f('0x56')](_0x55e203[_0x9c2f('0x3f')]);_0x48613b['filters']=_[_0x9c2f('0x41')](_0x48613b[_0x9c2f('0x3e')],_0x48613b[_0x9c2f('0x3f')]);_0x188a3b[_0x9c2f('0x42')]=_['intersection'](_0x48613b[_0x9c2f('0x3e')],qs[_0x9c2f('0x43')](_0x55e203['query'][_0x9c2f('0x43')]));_0x188a3b[_0x9c2f('0x42')]=_0x188a3b[_0x9c2f('0x42')][_0x9c2f('0x57')]?_0x188a3b[_0x9c2f('0x42')]:_0x48613b['model'];if(!_0x55e203[_0x9c2f('0x3f')]['hasOwnProperty'](_0x9c2f('0x45'))){_0x188a3b[_0x9c2f('0x46')]=qs[_0x9c2f('0x46')](_0x55e203['query'][_0x9c2f('0x46')]);_0x188a3b[_0x9c2f('0x29')]=qs[_0x9c2f('0x29')](_0x55e203[_0x9c2f('0x3f')][_0x9c2f('0x29')]);}_0x188a3b[_0x9c2f('0x47')]=qs[_0x9c2f('0x48')](_0x55e203[_0x9c2f('0x3f')]['sort']);_0x188a3b['where']=qs['filters'](_[_0x9c2f('0x4a')](_0x55e203['query'],_0x48613b[_0x9c2f('0x40')]));_0x188a3b[_0x9c2f('0x49')]['FaxAccountId']=_0x328b38['id'];if(_0x55e203[_0x9c2f('0x3f')]['filter']){_0x188a3b[_0x9c2f('0x49')]=_[_0x9c2f('0x58')](_0x188a3b[_0x9c2f('0x49')],{'$or':_[_0x9c2f('0x39')](_0x188a3b['attributes'],function(_0x1b61c3){var _0x18363d={};_0x18363d[_0x1b61c3]={'$like':'%'+_0x55e203[_0x9c2f('0x3f')][_0x9c2f('0x4b')]+'%'};return _0x18363d;})});}_0x188a3b=_['merge']({},_0x188a3b,_0x55e203[_0x9c2f('0x4d')]);return db['FaxInteraction']['count']({'where':_0x188a3b[_0x9c2f('0x49')]})[_0x9c2f('0x34')](function(_0x353881){_0x1594e8[_0x9c2f('0x4e')]=_0x353881;if(_0x55e203[_0x9c2f('0x3f')][_0x9c2f('0x4f')]){_0x188a3b['include']=[{'model':db[_0x9c2f('0x73')],'as':_0x9c2f('0x74'),'required':![]},{'model':db[_0x9c2f('0x75')],'as':_0x9c2f('0x76'),'attributes':[_0x9c2f('0x36'),_0x9c2f('0x77'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x9c2f('0x78'),'attributes':['id',_0x9c2f('0x36'),'color'],'where':_0x55e203[_0x9c2f('0x3f')][_0x9c2f('0x79')]?{'id':_0x55e203[_0x9c2f('0x3f')][_0x9c2f('0x79')]}:undefined,'required':_0x55e203[_0x9c2f('0x3f')][_0x9c2f('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0x9c2f('0x51')](_0x188a3b);})['then'](function(_0x2557c8){_0x1594e8[_0x9c2f('0x52')]=_0x2557c8;return _0x1594e8;});}})[_0x9c2f('0x34')](respondWithFilteredResult(_0x123d26,_0x188a3b))[_0x9c2f('0x53')](handleError(_0x123d26,null));};exports[_0x9c2f('0x7a')]=function(_0x362839,_0x1ed4bf,_0x162fd6){return db['FaxAccount'][_0x9c2f('0x68')]({'where':{'id':_0x362839[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x1ed4bf,null))['then'](function(_0x2cd8a3){if(_0x2cd8a3){return db[_0x9c2f('0x7b')]['transaction'](function(_0x5d9232){return db['FaxApplication'][_0x9c2f('0x31')]({'where':{'FaxAccountId':_0x362839[_0x9c2f('0x62')]['id']},'transaction':_0x5d9232})[_0x9c2f('0x34')](function(_0x17bd07){var _0x1876bd=_[_0x9c2f('0x39')](_0x362839[_0x9c2f('0x61')],function(_0xf9c213){_0xf9c213[_0x9c2f('0x65')]=_0x362839[_0x9c2f('0x62')]['id'];return _0xf9c213;});return db[_0x9c2f('0x7c')]['bulkCreate'](_0x1876bd,{'transaction':_0x5d9232});});})[_0x9c2f('0x34')](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x362839['params']['id']},'order':_0x9c2f('0x7d')});});}})[_0x9c2f('0x34')](respondWithResult(_0x1ed4bf,null))['catch'](handleError(_0x1ed4bf,null));};exports[_0x9c2f('0x7e')]=function(_0x353ae0,_0x359829,_0x566caa){var _0x4e60d3={};var _0x313c7b={};var _0x2f1a1e;var _0x1d90f8;return db[_0x9c2f('0x3a')][_0x9c2f('0x68')]({'where':{'id':_0x353ae0[_0x9c2f('0x62')]['id']}})['then'](handleEntityNotFound(_0x359829,null))['then'](function(_0x581353){if(_0x581353){_0x2f1a1e=_0x581353;_0x313c7b[_0x9c2f('0x3e')]=_[_0x9c2f('0x56')](db[_0x9c2f('0x7c')][_0x9c2f('0x3b')]);_0x313c7b['query']=_[_0x9c2f('0x56')](_0x353ae0[_0x9c2f('0x3f')]);_0x313c7b[_0x9c2f('0x40')]=_[_0x9c2f('0x41')](_0x313c7b[_0x9c2f('0x3e')],_0x313c7b['query']);_0x4e60d3[_0x9c2f('0x42')]=_[_0x9c2f('0x41')](_0x313c7b[_0x9c2f('0x3e')],qs[_0x9c2f('0x43')](_0x353ae0['query'][_0x9c2f('0x43')]));_0x4e60d3[_0x9c2f('0x42')]=_0x4e60d3[_0x9c2f('0x42')][_0x9c2f('0x57')]?_0x4e60d3[_0x9c2f('0x42')]:_0x313c7b[_0x9c2f('0x3e')];_0x4e60d3[_0x9c2f('0x47')]=qs[_0x9c2f('0x48')](_0x353ae0[_0x9c2f('0x3f')][_0x9c2f('0x48')]);_0x4e60d3[_0x9c2f('0x49')]=qs['filters'](_[_0x9c2f('0x4a')](_0x353ae0[_0x9c2f('0x3f')],_0x313c7b[_0x9c2f('0x40')]));if(_0x353ae0[_0x9c2f('0x3f')][_0x9c2f('0x4b')]){_0x4e60d3[_0x9c2f('0x49')]=_[_0x9c2f('0x58')](_0x4e60d3[_0x9c2f('0x49')],{'$or':_[_0x9c2f('0x39')](_0x4e60d3[_0x9c2f('0x42')],function(_0x5ab544){var _0x51abf3={};_0x51abf3[_0x5ab544]={'$like':'%'+_0x353ae0['query']['filter']+'%'};return _0x51abf3;})});}_0x4e60d3=_['merge']({},_0x4e60d3,_0x353ae0[_0x9c2f('0x4d')]);return _0x2f1a1e[_0x9c2f('0x7e')](_0x4e60d3);}})['then'](function(_0x500d18){if(_0x500d18){_0x1d90f8=_0x500d18[_0x9c2f('0x57')];if(!_0x353ae0[_0x9c2f('0x3f')][_0x9c2f('0x44')](_0x9c2f('0x45'))){_0x4e60d3['limit']=qs[_0x9c2f('0x46')](_0x353ae0[_0x9c2f('0x3f')][_0x9c2f('0x46')]);_0x4e60d3[_0x9c2f('0x29')]=qs[_0x9c2f('0x29')](_0x353ae0['query']['offset']);}return _0x2f1a1e[_0x9c2f('0x7e')](_0x4e60d3);}})[_0x9c2f('0x34')](function(_0xb95cd1){if(_0xb95cd1){return _0xb95cd1?{'count':_0x1d90f8,'rows':_0xb95cd1}:null;}})[_0x9c2f('0x34')](respondWithResult(_0x359829,null))['catch'](handleError(_0x359829,null));};function Extension(_0x11ec7a,_0x5ae42f,_0x35fb84,_0x128d99){this[_0x9c2f('0x7f')]=_0x9c2f('0x80');this[_0x9c2f('0x81')]=_0x11ec7a[_0x9c2f('0x82')];this[_0x9c2f('0x83')]=_0x128d99;this[_0x9c2f('0x3d')]=_0x9c2f('0x84');this[_0x9c2f('0x85')]=_0x9c2f('0x86');this['FaxAccountId']=_0x11ec7a['id'];this[_0x9c2f('0x7d')]=_0x5ae42f;this['appdata']=_0x35fb84;}function createExtensionsReciveFax(_0x53e2d4){var _0xdc43c4=0x1;var _0x5e3d24=[];_0x5e3d24[_0x9c2f('0x87')](new Extension(_0x53e2d4,_0xdc43c4,'','Answer'));_0xdc43c4+=0x1;_0x5e3d24[_0x9c2f('0x87')](new Extension(_0x53e2d4,_0xdc43c4,_0x9c2f('0x88'),_0x9c2f('0x89')));_0xdc43c4+=0x1;for(var _0x356b1a in _0x53e2d4){if(_0x53e2d4['hasOwnProperty'](_0x356b1a)&&(_0x356b1a===_0x9c2f('0x8a')||_0x356b1a==='localstationid'||_0x356b1a===_0x9c2f('0x8b')||_0x356b1a===_0x9c2f('0x8c')||_0x356b1a===_0x9c2f('0x8d')||_0x356b1a==='maxrate'||_0x356b1a===_0x9c2f('0x8e')||_0x356b1a==='modem'||_0x356b1a===_0x9c2f('0x8f'))){_0x5e3d24[_0x9c2f('0x87')](new Extension(_0x53e2d4,_0xdc43c4,_0x9c2f('0x90')+_0x356b1a+')='+_0x53e2d4[_0x356b1a],_0x9c2f('0x89')));_0xdc43c4+=0x1;}}_0x5e3d24[_0x9c2f('0x87')](new Extension(_0x53e2d4,_0xdc43c4,'6',_0x9c2f('0x91')));_0xdc43c4+=0x1;_0x5e3d24[_0x9c2f('0x87')](new Extension(_0x53e2d4,_0xdc43c4,_0x9c2f('0x92'),'ReceiveFax'));_0xdc43c4=0x0;return _0x5e3d24;}exports['addAccountApplications']=function(_0x1d7df0,_0x2bc602,_0x553613){var _0x58c5f4;return db[_0x9c2f('0x7b')][_0x9c2f('0x93')](function(_0xbd7e0a){return db[_0x9c2f('0x3a')][_0x9c2f('0x59')](_0x1d7df0[_0x9c2f('0x61')],{'transaction':_0xbd7e0a})[_0x9c2f('0x34')](function(_0x5ebd65){_0x58c5f4=_0x5ebd65[_0x9c2f('0x5a')]({'plain':!![]});return db['VoiceExtension'][_0x9c2f('0x94')](createExtensionsReciveFax(_0x58c5f4),{'transaction':_0xbd7e0a});});})[_0x9c2f('0x34')](function(){return _0x58c5f4;})[_0x9c2f('0x34')](respondWithResult(_0x2bc602,null))[_0x9c2f('0x53')](handleError(_0x2bc602,null));};exports[_0x9c2f('0x95')]=function(_0x4f8e5c,_0x14e6e5,_0xae7ba7){var _0x28476e;return db['sequelize'][_0x9c2f('0x93')](function(_0x26cb5b){return db[_0x9c2f('0x3a')][_0x9c2f('0x30')](_0x4f8e5c[_0x9c2f('0x61')],{'where':{'id':_0x4f8e5c[_0x9c2f('0x61')]['id']},'transaction':_0x26cb5b})[_0x9c2f('0x34')](function(_0x4e7c94){return db[_0x9c2f('0x96')][_0x9c2f('0x31')]({'where':{'FaxAccountId':_0x4f8e5c[_0x9c2f('0x61')]['id']},'transaction':_0x26cb5b})[_0x9c2f('0x34')](function(_0x39e36c){return db[_0x9c2f('0x96')][_0x9c2f('0x94')](createExtensionsReciveFax(_[_0x9c2f('0x71')](_0x4f8e5c[_0x9c2f('0x61')],[_0x9c2f('0x97'),_0x9c2f('0x98'),'createdAt',_0x9c2f('0x99'),_0x9c2f('0x9a'),_0x9c2f('0x9b')])),{'transaction':_0x26cb5b});});});})[_0x9c2f('0x34')](function(){return db[_0x9c2f('0x3a')][_0x9c2f('0x9c')](_0x4f8e5c[_0x9c2f('0x61')]['id']);})[_0x9c2f('0x34')](respondWithResult(_0x14e6e5,null))['catch'](handleError(_0x14e6e5,null));};exports['getMessages']=function(_0x42f51f,_0x15fc8d,_0x1f98a0){var _0x27b900={'raw':!![],'where':{}};var _0x5b12e7={};var _0x4d01b8={'count':0x0,'rows':[]};return db[_0x9c2f('0x3a')]['findOne']({'where':{'id':_0x42f51f[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x15fc8d,null))[_0x9c2f('0x34')](function(_0x4f1c90){if(_0x4f1c90){_0x5b12e7[_0x9c2f('0x3e')]=_[_0x9c2f('0x56')](db[_0x9c2f('0x9d')][_0x9c2f('0x3b')]);_0x5b12e7[_0x9c2f('0x3f')]=_[_0x9c2f('0x56')](_0x42f51f[_0x9c2f('0x3f')]);_0x5b12e7[_0x9c2f('0x40')]=_[_0x9c2f('0x41')](_0x5b12e7[_0x9c2f('0x3e')],_0x5b12e7['query']);_0x27b900[_0x9c2f('0x42')]=_[_0x9c2f('0x41')](_0x5b12e7[_0x9c2f('0x3e')],qs[_0x9c2f('0x43')](_0x42f51f['query'][_0x9c2f('0x43')]));_0x27b900[_0x9c2f('0x42')]=_0x27b900[_0x9c2f('0x42')][_0x9c2f('0x57')]?_0x27b900[_0x9c2f('0x42')]:_0x5b12e7['model'];if(!_0x42f51f[_0x9c2f('0x3f')]['hasOwnProperty'](_0x9c2f('0x45'))){_0x27b900[_0x9c2f('0x46')]=qs[_0x9c2f('0x46')](_0x42f51f['query'][_0x9c2f('0x46')]);_0x27b900[_0x9c2f('0x29')]=qs[_0x9c2f('0x29')](_0x42f51f['query'][_0x9c2f('0x29')]);}_0x27b900[_0x9c2f('0x47')]=qs['sort'](_0x42f51f[_0x9c2f('0x3f')][_0x9c2f('0x48')]);_0x27b900['where']=qs[_0x9c2f('0x40')](_[_0x9c2f('0x4a')](_0x42f51f[_0x9c2f('0x3f')],_0x5b12e7[_0x9c2f('0x40')]));_0x27b900[_0x9c2f('0x49')][_0x9c2f('0x65')]=_0x4f1c90['id'];if(_0x42f51f[_0x9c2f('0x3f')][_0x9c2f('0x4b')]){_0x27b900[_0x9c2f('0x49')]=_[_0x9c2f('0x58')](_0x27b900['where'],{'$or':_[_0x9c2f('0x39')](_0x27b900[_0x9c2f('0x42')],function(_0x1e23a8){var _0x374748={};_0x374748[_0x1e23a8]={'$like':'%'+_0x42f51f['query']['filter']+'%'};return _0x374748;})});}if(_0x42f51f[_0x9c2f('0x3f')][_0x9c2f('0x9e')]){var _0x40689d=_0x42f51f['query']['$gte'][_0x9c2f('0x9f')](',');var _0x32177d={};_0x32177d[_0x40689d[0x0]]={'$gte':moment(_0x40689d[0x1])[_0x9c2f('0xa0')](_0x9c2f('0xa1'))};_0x27b900[_0x9c2f('0x49')]=_[_0x9c2f('0x58')](_0x27b900[_0x9c2f('0x49')],_0x32177d);}_0x27b900=_[_0x9c2f('0x58')]({},_0x27b900,_0x42f51f[_0x9c2f('0x4d')]);return db[_0x9c2f('0x9d')]['count']({'where':_0x27b900['where']})[_0x9c2f('0x34')](function(_0x524620){_0x4d01b8[_0x9c2f('0x4e')]=_0x524620;if(_0x42f51f['query'][_0x9c2f('0x4f')]){_0x27b900[_0x9c2f('0x50')]=[{'all':!![]}];}return db['FaxMessage'][_0x9c2f('0x51')](_0x27b900);})['then'](function(_0x4a9cc7){_0x4d01b8[_0x9c2f('0x52')]=_0x4a9cc7;return _0x4d01b8;});}})['then'](respondWithFilteredResult(_0x15fc8d,_0x27b900))[_0x9c2f('0x53')](handleError(_0x15fc8d,null));};exports['send']=function(_0x42bf73,_0x8fe1c8,_0x4a86ec){var _0x48b8f5,_0x3a606a={},_0x338acf;if(_0x42bf73[_0x9c2f('0x61')]['to']){_0x338acf=_0x42bf73[_0x9c2f('0x61')]['to'][0x0];}return db['FaxAccount'][_0x9c2f('0x5e')]({'where':{'id':_0x42bf73['params']['id']},'include':[{'model':db[_0x9c2f('0xa2')],'as':_0x9c2f('0xa3'),'include':[{'model':db['CmContact'],'as':_0x9c2f('0xa4'),'where':{'fax':_0x338acf},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x9c2f('0x34')](handleEntityNotFound(_0x8fe1c8,null))[_0x9c2f('0x34')](function(_0x152ddf){_0x48b8f5=_0x152ddf;if(_0x42bf73[_0x9c2f('0x61')][_0x9c2f('0xa5')]&&_0x42bf73[_0x9c2f('0x61')][_0x9c2f('0xa5')][_0x9c2f('0x57')]){for(var _0x301923=0x0;_0x301923<_0x42bf73[_0x9c2f('0x61')][_0x9c2f('0xa5')][_0x9c2f('0x57')];_0x301923+=0x1){_0x42bf73[_0x9c2f('0x61')][_0x9c2f('0xa5')][_0x301923]={'filename':_0x42bf73['body'][_0x9c2f('0xa5')][_0x301923][_0x9c2f('0x36')],'id':_0x42bf73[_0x9c2f('0x61')][_0x9c2f('0xa5')][_0x301923]['id'],'path':path[_0x9c2f('0xa6')](config[_0x9c2f('0xa7')],_0x9c2f('0xa8'),_0x42bf73[_0x9c2f('0x61')]['attachments'][_0x301923][_0x9c2f('0xa9')])};}}return respondWithRpcPromise(_0x9c2f('0xaa'),_0x9c2f('0xaa'),{'FaxAccountId':_['isNil'](_0x42bf73[_0x9c2f('0x62')]['id'])?undefined:_0x42bf73[_0x9c2f('0x62')]['id'],'path':_[_0x9c2f('0xab')](_0x42bf73[_0x9c2f('0x61')]['attachments'][0x0][_0x9c2f('0x6')])?undefined:_0x42bf73['body'][_0x9c2f('0xa5')][0x0][_0x9c2f('0x6')],'fax':_['isNil'](_0x42bf73[_0x9c2f('0x61')]['to'][0x0])?undefined:_0x42bf73[_0x9c2f('0x61')]['to'][0x0]},client9002);})[_0x9c2f('0x34')](function(){if(_0x48b8f5){if(_[_0x9c2f('0xab')](_0x42bf73['body'][_0x9c2f('0xac')])){_0x42bf73[_0x9c2f('0x61')][_0x9c2f('0xac')]=util[_0x9c2f('0xa0')](_0x9c2f('0xad'),_0x48b8f5['name'],_0x48b8f5[_0x9c2f('0xae')]);}if(_0x48b8f5[_0x9c2f('0xa3')]){if(_0x48b8f5[_0x9c2f('0xa3')][_0x9c2f('0xa4')]['length']){return _0x48b8f5[_0x9c2f('0xa3')][_0x9c2f('0xa4')][0x0];}else{return db[_0x9c2f('0x73')]['create'](_['defaults'](_0x42bf73[_0x9c2f('0x61')],{'firstName':_0x42bf73['body']['to'][0x0],'phone':_0x42bf73['body']['to'][0x0],'fax':_0x42bf73[_0x9c2f('0x61')]['to'][0x0],'ListId':_0x48b8f5['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x9c2f('0xaf'));}})['then'](function(_0x4ceb4c){if(_0x4ceb4c){return db[_0x9c2f('0x6f')][_0x9c2f('0x5e')]({'where':{'ContactId':_0x4ceb4c['id'],'closed':![],'FaxAccountId':_0x48b8f5['id']}})[_0x9c2f('0x34')](function(_0x3f8084){if(_0x3f8084){return[_0x3f8084,![]];}return db[_0x9c2f('0x6f')][_0x9c2f('0x59')]({'UserId':_0x42bf73[_0x9c2f('0x5c')]['id'],'ContactId':_0x4ceb4c['id'],'FaxAccountId':_0x48b8f5['id'],'fax':_0x42bf73[_0x9c2f('0x61')]['to'][0x0],'firstMsgDirection':_0x9c2f('0xb0'),'Messages':[_['merge'](_0x42bf73[_0x9c2f('0x61')],{'read':![],'body':_0x42bf73['body'][_0x9c2f('0xa5')][0x0][_0x9c2f('0xb1')],'FaxAccountId':_0x48b8f5['id'],'UserId':_0x42bf73[_0x9c2f('0x5c')]['id'],'ContactId':_0x4ceb4c['id'],'AttachmentId':_0x42bf73['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x9c2f('0x9d')],'as':_0x9c2f('0xb2')}]})['then'](function(_0xe24aea){return[_0xe24aea,!![]];});});}else{throw new Error(_0x9c2f('0xb3'));}})[_0x9c2f('0xb4')](function(_0x2cb89d,_0x4f055a){if(_0x4f055a){return _0x2cb89d;}return db['FaxMessage'][_0x9c2f('0x59')]({'direction':'out','read':![],'body':_0x42bf73[_0x9c2f('0x61')][_0x9c2f('0xa5')][0x0]['filename'],'FaxAccountId':_0x48b8f5['id'],'FaxInteractionId':_0x2cb89d['id'],'UserId':_0x42bf73[_0x9c2f('0x5c')]['id'],'ContactId':_0x2cb89d[_0x9c2f('0xb5')],'AttachmentId':_0x42bf73[_0x9c2f('0x61')][_0x9c2f('0xa5')][0x0]['id']})[_0x9c2f('0x34')](function(_0x2b9306){_0x2cb89d[_0x9c2f('0xb6')][_0x9c2f('0xb2')]=[];_0x2cb89d[_0x9c2f('0xb6')][_0x9c2f('0xb2')][_0x9c2f('0x87')](_0x2b9306['dataValues']);return _0x2cb89d;});})['then'](function(_0x295b77){respondWithRpcPromise(_0x9c2f('0xb7'),_0x9c2f('0xb7'),{'FaxAccountId':_[_0x9c2f('0xab')](_0x42bf73[_0x9c2f('0x62')]['id'])?undefined:_0x42bf73[_0x9c2f('0x62')]['id'],'path':_[_0x9c2f('0xab')](_0x42bf73[_0x9c2f('0x61')]['attachments'][0x0][_0x9c2f('0x6')])?undefined:_0x42bf73[_0x9c2f('0x61')]['attachments'][0x0][_0x9c2f('0x6')],'fax':_[_0x9c2f('0xab')](_0x42bf73[_0x9c2f('0x61')]['to'][0x0])?undefined:_0x42bf73[_0x9c2f('0x61')]['to'][0x0],'AttachmentId':_0x42bf73['body'][_0x9c2f('0xa5')][0x0]['id']},client9002)[_0x9c2f('0x34')](function(_0x3c94e8){logger[_0x9c2f('0x1d')](_0x9c2f('0xb8'),_0x3c94e8);})['catch'](function(_0x2254ce){logger[_0x9c2f('0x1d')]('SendFaxRpc,\x20%s',_0x2254ce);});return _0x295b77;})['then'](respondWithResult(_0x8fe1c8,null))['catch'](handleError(_0x8fe1c8,null));};exports['addAgents']=function(_0x133298,_0x5a9e27,_0xbe857c){return db[_0x9c2f('0x3a')][_0x9c2f('0x5e')]({'where':{'id':_0x133298[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x5a9e27,null))[_0x9c2f('0x34')](function(_0x4a86a6){if(_0x4a86a6){return _0x4a86a6[_0x9c2f('0xb9')](_0x133298['body']['ids'],_[_0x9c2f('0x71')](_0x133298[_0x9c2f('0x61')],['ids','id'])||{})['spread'](function(_0x3d8c81){for(var _0x54c531=0x0;_0x54c531<_0x133298[_0x9c2f('0x61')][_0x9c2f('0x6e')][_0x9c2f('0x57')];_0x54c531+=0x1){socket[_0x9c2f('0xba')](_0x9c2f('0xbb'),{'UserId':Number(_0x133298[_0x9c2f('0x61')][_0x9c2f('0x6e')][_0x54c531]),'FaxAccountId':Number(_0x133298[_0x9c2f('0x62')]['id'])});}return _0x3d8c81;});}})[_0x9c2f('0x34')](respondWithResult(_0x5a9e27,null))['catch'](handleError(_0x5a9e27,null));};exports[_0x9c2f('0xbc')]=function(_0x1c0700,_0x12451d,_0x5bd216){return db[_0x9c2f('0x3a')][_0x9c2f('0x5e')]({'where':{'id':_0x1c0700[_0x9c2f('0x62')]['id']}})[_0x9c2f('0x34')](handleEntityNotFound(_0x12451d,null))['then'](function(_0x42c4e6){if(_0x42c4e6){return _0x42c4e6[_0x9c2f('0xbc')](_0x1c0700[_0x9c2f('0x3f')][_0x9c2f('0x6e')])[_0x9c2f('0x34')](function(){if(_[_0x9c2f('0xbd')](_0x1c0700[_0x9c2f('0x3f')][_0x9c2f('0x6e')])){for(var _0x52f3c7=0x0;_0x52f3c7<_0x1c0700[_0x9c2f('0x3f')]['ids']['length'];_0x52f3c7+=0x1){socket['emit'](_0x9c2f('0xbe'),{'UserId':Number(_0x1c0700['query'][_0x9c2f('0x6e')][_0x52f3c7]),'FaxAccountId':Number(_0x1c0700[_0x9c2f('0x62')]['id'])});}}else{socket['emit'](_0x9c2f('0xbe'),{'UserId':Number(_0x1c0700['query'][_0x9c2f('0x6e')]),'FaxAccountId':Number(_0x1c0700[_0x9c2f('0x62')]['id'])});}});}})[_0x9c2f('0x34')](respondWithStatusCode(_0x12451d,null))[_0x9c2f('0x53')](handleError(_0x12451d,null));};exports[_0x9c2f('0xbf')]=function(_0x2b25eb,_0x2e7a91,_0x4eb8df){var _0x1d6312={};var _0x48c62e={};var _0x1e8f66;var _0x145f69;return db[_0x9c2f('0x3a')]['findOne']({'where':{'id':_0x2b25eb[_0x9c2f('0x62')]['id']}})['then'](handleEntityNotFound(_0x2e7a91,null))[_0x9c2f('0x34')](function(_0x32ac97){if(_0x32ac97){_0x1e8f66=_0x32ac97;_0x48c62e[_0x9c2f('0x3e')]=_['keys'](db[_0x9c2f('0x75')][_0x9c2f('0x3b')]);_0x48c62e[_0x9c2f('0x3f')]=_[_0x9c2f('0x56')](_0x2b25eb[_0x9c2f('0x3f')]);_0x48c62e['filters']=_[_0x9c2f('0x41')](_0x48c62e[_0x9c2f('0x3e')],_0x48c62e[_0x9c2f('0x3f')]);_0x1d6312[_0x9c2f('0x42')]=_[_0x9c2f('0x41')](_0x48c62e['model'],qs[_0x9c2f('0x43')](_0x2b25eb[_0x9c2f('0x3f')]['fields']));_0x1d6312[_0x9c2f('0x42')]=_0x1d6312['attributes'][_0x9c2f('0x57')]?_0x1d6312[_0x9c2f('0x42')]:_0x48c62e[_0x9c2f('0x3e')];_0x1d6312[_0x9c2f('0x47')]=qs['sort'](_0x2b25eb['query'][_0x9c2f('0x48')]);_0x1d6312[_0x9c2f('0x49')]=qs['filters'](_[_0x9c2f('0x4a')](_0x2b25eb[_0x9c2f('0x3f')],_0x48c62e[_0x9c2f('0x40')]));if(_0x2b25eb[_0x9c2f('0x3f')][_0x9c2f('0x4b')]){_0x1d6312[_0x9c2f('0x49')]=_[_0x9c2f('0x58')](_0x1d6312[_0x9c2f('0x49')],{'$or':_[_0x9c2f('0x39')](_0x1d6312['attributes'],function(_0x3a8a43){var _0x3c9f45={};_0x3c9f45[_0x3a8a43]={'$like':'%'+_0x2b25eb['query'][_0x9c2f('0x4b')]+'%'};return _0x3c9f45;})});}_0x1d6312=_[_0x9c2f('0x58')]({},_0x1d6312,_0x2b25eb[_0x9c2f('0x4d')]);return _0x1e8f66['getAgents'](_0x1d6312);}})[_0x9c2f('0x34')](function(_0x2899bc){if(_0x2899bc){_0x145f69=_0x2899bc[_0x9c2f('0x57')];if(!_0x2b25eb[_0x9c2f('0x3f')]['hasOwnProperty']('nolimit')){_0x1d6312[_0x9c2f('0x46')]=qs[_0x9c2f('0x46')](_0x2b25eb['query'][_0x9c2f('0x46')]);_0x1d6312[_0x9c2f('0x29')]=qs['offset'](_0x2b25eb[_0x9c2f('0x3f')]['offset']);}return _0x1e8f66['getAgents'](_0x1d6312);}})[_0x9c2f('0x34')](function(_0x5cbae7){if(_0x5cbae7){return _0x5cbae7?{'count':_0x145f69,'rows':_0x5cbae7}:null;}})[_0x9c2f('0x34')](respondWithResult(_0x2e7a91,null))['catch'](handleError(_0x2e7a91,null));}; \ No newline at end of file +var _0xcc99=['client','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','include','findAll','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','length','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','getInteractions','findOne','Contact','User','Owner','fullname','internal','Tags','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','app','system','description','appdata','push','Answer','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Set','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','addAccountApplications','sequelize','VoiceExtension','omit','key','createdAt','TrunkId','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','rows','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','redis','./faxAccount.socket','register','http'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xcc99,0x163));var _0x9cc9=function(_0x157a48,_0x53a46e){_0x157a48=_0x157a48-0x0;var _0x27b51f=_0xcc99[_0x157a48];return _0x27b51f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9cc9('0x0'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9cc9('0x1'));var path=require(_0x9cc9('0x2'));var sox=require('sox');var csv=require(_0x9cc9('0x3'));var ejs=require(_0x9cc9('0x4'));var fs=require('fs');var fs_extra=require(_0x9cc9('0x5'));var _=require('lodash');var squel=require(_0x9cc9('0x6'));var crypto=require(_0x9cc9('0x7'));var jsforce=require(_0x9cc9('0x8'));var deskjs=require(_0x9cc9('0x9'));var toCsv=require(_0x9cc9('0x3'));var querystring=require('querystring');var Papa=require(_0x9cc9('0xa'));var Redis=require(_0x9cc9('0xb'));var authService=require(_0x9cc9('0xc'));var qs=require(_0x9cc9('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cc9('0xe'));var logger=require(_0x9cc9('0xf'))(_0x9cc9('0x10'));var utils=require(_0x9cc9('0x11'));var config=require(_0x9cc9('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9cc9('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9cc9('0x14'))(new Redis(config[_0x9cc9('0x15')]));require(_0x9cc9('0x16'))[_0x9cc9('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9cc9('0x18')]({'port':0x232c});var client9002=jayson[_0x9cc9('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cc3c6,_0xd929e6,_0x5c4a4d,_0xed1204){return new BPromise(function(_0x555310,_0x5a2027){var _0x35faaa=_0xed1204||client;return _0x35faaa[_0x9cc9('0x1a')](_0x2cc3c6,_0x5c4a4d)[_0x9cc9('0x1b')](function(_0x928614){logger['info']('FaxAccount,\x20%s,\x20%s',_0xd929e6,_0x9cc9('0x1c'));logger[_0x9cc9('0x1d')](_0x9cc9('0x1e'),_0xd929e6,_0x9cc9('0x1c'),JSON[_0x9cc9('0x1f')](_0x928614));if(_0x928614['error']){if(_0x928614[_0x9cc9('0x20')][_0x9cc9('0x21')]===0x1f4){logger[_0x9cc9('0x20')](_0x9cc9('0x22'),_0xd929e6,_0x928614[_0x9cc9('0x20')]['message']);return _0x5a2027(_0x928614[_0x9cc9('0x20')][_0x9cc9('0x23')]);}logger[_0x9cc9('0x20')](_0x9cc9('0x22'),_0xd929e6,_0x928614[_0x9cc9('0x20')][_0x9cc9('0x23')]);return _0x555310(_0x928614[_0x9cc9('0x20')][_0x9cc9('0x23')]);}else{logger[_0x9cc9('0x24')]('FaxAccount,\x20%s,\x20%s',_0xd929e6,_0x9cc9('0x1c'));_0x555310(_0x928614[_0x9cc9('0x25')][_0x9cc9('0x23')]);}})[_0x9cc9('0x26')](function(_0x152da5){logger['error'](_0x9cc9('0x22'),_0xd929e6,_0x152da5);_0x5a2027(_0x152da5);});});}function respondWithStatusCode(_0x34283f,_0x129886){_0x129886=_0x129886||0xcc;return function(_0x50ed65){if(_0x50ed65){return _0x34283f[_0x9cc9('0x27')](_0x129886);}return _0x34283f[_0x9cc9('0x28')](_0x129886)[_0x9cc9('0x29')]();};}function respondWithResult(_0x323bbc,_0x278f2e){_0x278f2e=_0x278f2e||0xc8;return function(_0x1ee2d2){if(_0x1ee2d2){return _0x323bbc['status'](_0x278f2e)[_0x9cc9('0x2a')](_0x1ee2d2);}};}function respondWithFilteredResult(_0x5d65fd,_0x2b5316){return function(_0x49712c){if(_0x49712c){var _0x55cc7f=typeof _0x2b5316[_0x9cc9('0x2b')]===_0x9cc9('0x2c')&&typeof _0x2b5316[_0x9cc9('0x2d')]===_0x9cc9('0x2c');var _0x87eb3e=_0x49712c[_0x9cc9('0x2e')];var _0x12ad69=_0x55cc7f?0x0:_0x2b5316[_0x9cc9('0x2b')];var _0x413b78=_0x55cc7f?_0x49712c[_0x9cc9('0x2e')]:_0x2b5316[_0x9cc9('0x2b')]+_0x2b5316['limit'];var _0x439b92;if(_0x413b78>=_0x87eb3e){_0x413b78=_0x87eb3e;_0x439b92=0xc8;}else{_0x439b92=0xce;}_0x5d65fd['status'](_0x439b92);return _0x5d65fd[_0x9cc9('0x2f')]('Content-Range',_0x12ad69+'-'+_0x413b78+'/'+_0x87eb3e)[_0x9cc9('0x2a')](_0x49712c);}return null;};}function patchUpdates(_0x35a9f6){return function(_0x487ac1){try{jsonpatch['apply'](_0x487ac1,_0x35a9f6,!![]);}catch(_0x502317){return BPromise[_0x9cc9('0x30')](_0x502317);}return _0x487ac1[_0x9cc9('0x31')]();};}function saveUpdates(_0xd5a96,_0x511b3a){return function(_0x5132a7){if(_0x5132a7){return _0x5132a7[_0x9cc9('0x32')](_0xd5a96)[_0x9cc9('0x1b')](function(_0x24a6d7){return _0x24a6d7;});}return null;};}function removeEntity(_0x49fccf,_0x23b2e0){return function(_0x1d1485){if(_0x1d1485){return _0x1d1485[_0x9cc9('0x33')]()[_0x9cc9('0x1b')](function(){var _0x17d83b=_0x1d1485[_0x9cc9('0x34')]({'plain':!![]});var _0x1a22ea=_0x9cc9('0x35');return db[_0x9cc9('0x36')][_0x9cc9('0x33')]({'where':{'type':_0x1a22ea,'resourceId':_0x17d83b['id']}})[_0x9cc9('0x1b')](function(){return _0x1d1485;});})[_0x9cc9('0x1b')](function(){_0x49fccf[_0x9cc9('0x28')](0xcc)[_0x9cc9('0x29')]();});}};}function handleEntityNotFound(_0x26d384,_0x180d4c){return function(_0x16bfdb){if(!_0x16bfdb){_0x26d384[_0x9cc9('0x27')](0x194);}return _0x16bfdb;};}function handleError(_0x1b079f,_0x525204){_0x525204=_0x525204||0x1f4;return function(_0x592194){logger[_0x9cc9('0x20')](_0x592194[_0x9cc9('0x37')]);if(_0x592194[_0x9cc9('0x38')]){delete _0x592194[_0x9cc9('0x38')];}_0x1b079f['status'](_0x525204)[_0x9cc9('0x39')](_0x592194);};}exports[_0x9cc9('0x3a')]=function(_0x56f325,_0x32ea3f){var _0x580a5c={'include':[{'model':db[_0x9cc9('0x3b')],'as':_0x9cc9('0x3c')}]},_0x86c989={},_0xb8d50e={'count':0x0,'rows':[]};var _0x32ad92=_['map'](db[_0x9cc9('0x3d')][_0x9cc9('0x3e')],function(_0x1e206c){return{'name':_0x1e206c[_0x9cc9('0x3f')],'type':_0x1e206c[_0x9cc9('0x40')]['key']};});_0x86c989[_0x9cc9('0x41')]=_['map'](_0x32ad92,_0x9cc9('0x38'));_0x86c989[_0x9cc9('0x42')]=_[_0x9cc9('0x43')](_0x56f325[_0x9cc9('0x42')]);_0x86c989[_0x9cc9('0x44')]=_[_0x9cc9('0x45')](_0x86c989['model'],_0x86c989['query']);_0x580a5c['attributes']=_[_0x9cc9('0x45')](_0x86c989[_0x9cc9('0x41')],qs[_0x9cc9('0x46')](_0x56f325[_0x9cc9('0x42')]['fields']));_0x580a5c[_0x9cc9('0x47')]=_0x580a5c['attributes']['length']?_0x580a5c[_0x9cc9('0x47')]:_0x86c989[_0x9cc9('0x41')];if(!_0x56f325['query'][_0x9cc9('0x48')](_0x9cc9('0x49'))){_0x580a5c['limit']=qs[_0x9cc9('0x2d')](_0x56f325['query'][_0x9cc9('0x2d')]);_0x580a5c['offset']=qs['offset'](_0x56f325[_0x9cc9('0x42')][_0x9cc9('0x2b')]);}_0x580a5c[_0x9cc9('0x4a')]=qs[_0x9cc9('0x4b')](_0x56f325[_0x9cc9('0x42')][_0x9cc9('0x4b')]);_0x580a5c[_0x9cc9('0x4c')]=qs[_0x9cc9('0x44')](_[_0x9cc9('0x4d')](_0x56f325[_0x9cc9('0x42')],_0x86c989[_0x9cc9('0x44')]),_0x32ad92);if(_0x56f325[_0x9cc9('0x42')]['filter']){_0x580a5c[_0x9cc9('0x4c')]=_[_0x9cc9('0x4e')](_0x580a5c[_0x9cc9('0x4c')],{'$or':_[_0x9cc9('0x4f')](_0x32ad92,function(_0x49f173){if(_0x49f173[_0x9cc9('0x40')]!==_0x9cc9('0x50')){var _0x58cf89={};_0x58cf89[_0x49f173[_0x9cc9('0x38')]]={'$like':'%'+_0x56f325[_0x9cc9('0x42')][_0x9cc9('0x51')]+'%'};return _0x58cf89;}})});}_0x580a5c=_[_0x9cc9('0x4e')]({},_0x580a5c,_0x56f325['options']);var _0x49019f={'where':_0x580a5c[_0x9cc9('0x4c')]};return db[_0x9cc9('0x3d')]['count'](_0x49019f)[_0x9cc9('0x1b')](function(_0x1987a5){_0xb8d50e['count']=_0x1987a5;if(_0x56f325[_0x9cc9('0x42')][_0x9cc9('0x52')]){_0x580a5c[_0x9cc9('0x53')]=[{'all':!![]}];}return db['FaxAccount'][_0x9cc9('0x54')](_0x580a5c);})['then'](function(_0x3f2cb9){_0xb8d50e['rows']=_0x3f2cb9;return _0xb8d50e;})[_0x9cc9('0x1b')](respondWithFilteredResult(_0x32ea3f,_0x580a5c))[_0x9cc9('0x26')](handleError(_0x32ea3f,null));};exports[_0x9cc9('0x55')]=function(_0x5a4dd7,_0x18ccc9){var _0x131e9c={'raw':![],'where':{'id':_0x5a4dd7[_0x9cc9('0x56')]['id']},'include':[{'model':db[_0x9cc9('0x3b')],'as':'mandatoryDispositionPause'}]},_0x370593={};_0x370593['model']=_[_0x9cc9('0x43')](db[_0x9cc9('0x3d')][_0x9cc9('0x3e')]);_0x370593[_0x9cc9('0x42')]=_['keys'](_0x5a4dd7[_0x9cc9('0x42')]);_0x370593[_0x9cc9('0x44')]=_['intersection'](_0x370593[_0x9cc9('0x41')],_0x370593[_0x9cc9('0x42')]);_0x131e9c[_0x9cc9('0x47')]=_[_0x9cc9('0x45')](_0x370593[_0x9cc9('0x41')],qs['fields'](_0x5a4dd7[_0x9cc9('0x42')][_0x9cc9('0x46')]));_0x131e9c[_0x9cc9('0x47')]=_0x131e9c[_0x9cc9('0x47')]['length']?_0x131e9c[_0x9cc9('0x47')]:_0x370593[_0x9cc9('0x41')];if(_0x5a4dd7['query']['includeAll']){_0x131e9c[_0x9cc9('0x53')]=[{'all':!![]}];}_0x131e9c=_[_0x9cc9('0x4e')]({},_0x131e9c,_0x5a4dd7[_0x9cc9('0x57')]);return db[_0x9cc9('0x3d')][_0x9cc9('0x58')](_0x131e9c)['then'](handleEntityNotFound(_0x18ccc9,null))[_0x9cc9('0x1b')](respondWithResult(_0x18ccc9,null))['catch'](handleError(_0x18ccc9,null));};exports[_0x9cc9('0x59')]=function(_0x5c4723,_0x5a3589){return db[_0x9cc9('0x3d')][_0x9cc9('0x59')](_0x5c4723[_0x9cc9('0x5a')],{})[_0x9cc9('0x1b')](function(_0x3fcbb2){var _0x89f67b=_0x5c4723[_0x9cc9('0x5b')]['get']({'plain':!![]});if(!_0x89f67b)throw new Error(_0x9cc9('0x5c'));if(_0x89f67b[_0x9cc9('0x5d')]==='user'){var _0x44c5fa=_0x3fcbb2['get']({'plain':!![]});var _0x5d0db4=_0x9cc9('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x5d0db4,'userProfileId':_0x89f67b[_0x9cc9('0x5e')]},'raw':!![]})[_0x9cc9('0x1b')](function(_0x14d4f1){if(_0x14d4f1&&_0x14d4f1['autoAssociation']===0x0){return db['UserProfileResource'][_0x9cc9('0x59')]({'name':_0x44c5fa[_0x9cc9('0x38')],'resourceId':_0x44c5fa['id'],'type':_0x14d4f1[_0x9cc9('0x38')],'sectionId':_0x14d4f1['id']},{})[_0x9cc9('0x1b')](function(){return _0x3fcbb2;});}else{return _0x3fcbb2;}})[_0x9cc9('0x26')](function(_0x26c316){logger[_0x9cc9('0x20')](_0x9cc9('0x5f'),_0x26c316);throw _0x26c316;});}return _0x3fcbb2;})[_0x9cc9('0x1b')](respondWithResult(_0x5a3589,0xc9))[_0x9cc9('0x26')](handleError(_0x5a3589,null));};exports['update']=function(_0x4d13ea,_0x199ef5){if(_0x4d13ea['body']['id']){delete _0x4d13ea[_0x9cc9('0x5a')]['id'];}return db[_0x9cc9('0x3d')][_0x9cc9('0x58')]({'where':{'id':_0x4d13ea[_0x9cc9('0x56')]['id']},'include':[{'model':db[_0x9cc9('0x3b')],'as':_0x9cc9('0x3c')}]})['then'](handleEntityNotFound(_0x199ef5,null))['then'](saveUpdates(_0x4d13ea[_0x9cc9('0x5a')],null))[_0x9cc9('0x1b')](respondWithResult(_0x199ef5,null))['catch'](handleError(_0x199ef5,null));};exports['destroy']=function(_0x15b48c,_0x4704bc){return db['FaxAccount'][_0x9cc9('0x58')]({'where':{'id':_0x15b48c['params']['id']}})['then'](handleEntityNotFound(_0x4704bc,null))[_0x9cc9('0x1b')](removeEntity(_0x4704bc,null))[_0x9cc9('0x26')](handleError(_0x4704bc,null));};exports[_0x9cc9('0x60')]=function(_0x30116e,_0x55979f){return db['FaxAccount']['describe']()['then'](respondWithResult(_0x55979f,null))[_0x9cc9('0x26')](handleError(_0x55979f,null));};exports[_0x9cc9('0x61')]=function(_0x8b2214,_0x222666,_0x504246){if(_0x8b2214[_0x9cc9('0x5a')]['id']){delete _0x8b2214[_0x9cc9('0x5a')]['id'];}return db[_0x9cc9('0x3d')]['find']({'where':{'id':_0x8b2214[_0x9cc9('0x56')]['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x222666,null))[_0x9cc9('0x1b')](function(_0x364837){if(_0x364837){_0x8b2214[_0x9cc9('0x5a')][_0x9cc9('0x62')]=_0x364837['id'];return db[_0x9cc9('0x63')][_0x9cc9('0x59')](_0x8b2214[_0x9cc9('0x5a')]);}})[_0x9cc9('0x1b')](respondWithResult(_0x222666,null))[_0x9cc9('0x26')](handleError(_0x222666,null));};exports[_0x9cc9('0x64')]=function(_0x3d15cb,_0x4b02ff,_0x380dd3){var _0x544c96={'raw':![],'where':{}};var _0x51a823={};var _0x56b432={'count':0x0,'rows':[]};return db[_0x9cc9('0x3d')]['findOne']({'where':{'id':_0x3d15cb[_0x9cc9('0x56')]['id']}})['then'](handleEntityNotFound(_0x4b02ff,null))[_0x9cc9('0x1b')](function(_0xc7b5fd){if(_0xc7b5fd){_0x51a823['model']=_['keys'](db[_0x9cc9('0x63')][_0x9cc9('0x3e')]);_0x51a823['query']=_['keys'](_0x3d15cb[_0x9cc9('0x42')]);_0x51a823[_0x9cc9('0x44')]=_[_0x9cc9('0x45')](_0x51a823[_0x9cc9('0x41')],_0x51a823[_0x9cc9('0x42')]);_0x544c96[_0x9cc9('0x47')]=_['intersection'](_0x51a823[_0x9cc9('0x41')],qs[_0x9cc9('0x46')](_0x3d15cb['query']['fields']));_0x544c96[_0x9cc9('0x47')]=_0x544c96[_0x9cc9('0x47')][_0x9cc9('0x65')]?_0x544c96[_0x9cc9('0x47')]:_0x51a823[_0x9cc9('0x41')];if(!_0x3d15cb[_0x9cc9('0x42')][_0x9cc9('0x48')](_0x9cc9('0x49'))){_0x544c96[_0x9cc9('0x2d')]=qs[_0x9cc9('0x2d')](_0x3d15cb['query'][_0x9cc9('0x2d')]);_0x544c96[_0x9cc9('0x2b')]=qs[_0x9cc9('0x2b')](_0x3d15cb['query'][_0x9cc9('0x2b')]);}_0x544c96[_0x9cc9('0x4a')]=qs[_0x9cc9('0x4b')](_0x3d15cb[_0x9cc9('0x42')][_0x9cc9('0x4b')]);_0x544c96[_0x9cc9('0x4c')]=qs[_0x9cc9('0x44')](_[_0x9cc9('0x4d')](_0x3d15cb['query'],_0x51a823['filters']));_0x544c96[_0x9cc9('0x4c')][_0x9cc9('0x62')]=_0xc7b5fd['id'];if(_0x3d15cb[_0x9cc9('0x42')][_0x9cc9('0x51')]){_0x544c96[_0x9cc9('0x4c')]=_[_0x9cc9('0x4e')](_0x544c96[_0x9cc9('0x4c')],{'$or':_[_0x9cc9('0x4f')](_0x544c96[_0x9cc9('0x47')],function(_0x2f1684){var _0x15a1f0={};_0x15a1f0[_0x2f1684]={'$like':'%'+_0x3d15cb['query']['filter']+'%'};return _0x15a1f0;})});}_0x544c96=_[_0x9cc9('0x4e')]({},_0x544c96,_0x3d15cb[_0x9cc9('0x57')]);return db['Disposition'][_0x9cc9('0x2e')]({'where':_0x544c96[_0x9cc9('0x4c')]})[_0x9cc9('0x1b')](function(_0x1cb788){_0x56b432['count']=_0x1cb788;if(_0x3d15cb[_0x9cc9('0x42')][_0x9cc9('0x52')]){_0x544c96[_0x9cc9('0x53')]=[{'all':!![]}];}return db[_0x9cc9('0x63')][_0x9cc9('0x54')](_0x544c96);})[_0x9cc9('0x1b')](function(_0x3d2099){_0x56b432['rows']=_0x3d2099;return _0x56b432;});}})[_0x9cc9('0x1b')](respondWithFilteredResult(_0x4b02ff,_0x544c96))[_0x9cc9('0x26')](handleError(_0x4b02ff,null));};exports[_0x9cc9('0x66')]=function(_0x43b941,_0x2fa0a4,_0x50f502){return db['FaxAccount']['find']({'where':{'id':_0x43b941['params']['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x2fa0a4,null))[_0x9cc9('0x1b')](function(_0x31c5d8){if(_0x31c5d8){return _0x31c5d8[_0x9cc9('0x66')](_0x43b941[_0x9cc9('0x42')][_0x9cc9('0x67')]);}})['then'](respondWithStatusCode(_0x2fa0a4,null))['catch'](handleError(_0x2fa0a4,null));};exports[_0x9cc9('0x68')]=function(_0x4ba244,_0x4e117e,_0x48f0f6){if(_0x4ba244['body']['id']){delete _0x4ba244[_0x9cc9('0x5a')]['id'];}return db[_0x9cc9('0x3d')][_0x9cc9('0x58')]({'where':{'id':_0x4ba244[_0x9cc9('0x56')]['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x4e117e,null))[_0x9cc9('0x1b')](function(_0x581828){if(_0x581828){_0x4ba244[_0x9cc9('0x5a')]['FaxAccountId']=_0x581828['id'];return db['CannedAnswer'][_0x9cc9('0x59')](_0x4ba244['body']);}})[_0x9cc9('0x1b')](respondWithResult(_0x4e117e,null))[_0x9cc9('0x26')](handleError(_0x4e117e,null));};exports[_0x9cc9('0x69')]=function(_0x4c73e9,_0x1cb639,_0x3c3082){var _0x1df7af={'raw':![],'where':{}};var _0x1cb7d7={};var _0x2afd92={'count':0x0,'rows':[]};return db[_0x9cc9('0x3d')]['findOne']({'where':{'id':_0x4c73e9[_0x9cc9('0x56')]['id']}})['then'](handleEntityNotFound(_0x1cb639,null))['then'](function(_0x428e){if(_0x428e){_0x1cb7d7[_0x9cc9('0x41')]=_['keys'](db[_0x9cc9('0x6a')][_0x9cc9('0x3e')]);_0x1cb7d7[_0x9cc9('0x42')]=_[_0x9cc9('0x43')](_0x4c73e9['query']);_0x1cb7d7['filters']=_[_0x9cc9('0x45')](_0x1cb7d7[_0x9cc9('0x41')],_0x1cb7d7[_0x9cc9('0x42')]);_0x1df7af[_0x9cc9('0x47')]=_['intersection'](_0x1cb7d7[_0x9cc9('0x41')],qs[_0x9cc9('0x46')](_0x4c73e9['query'][_0x9cc9('0x46')]));_0x1df7af[_0x9cc9('0x47')]=_0x1df7af['attributes'][_0x9cc9('0x65')]?_0x1df7af[_0x9cc9('0x47')]:_0x1cb7d7[_0x9cc9('0x41')];if(!_0x4c73e9[_0x9cc9('0x42')][_0x9cc9('0x48')]('nolimit')){_0x1df7af[_0x9cc9('0x2d')]=qs[_0x9cc9('0x2d')](_0x4c73e9[_0x9cc9('0x42')][_0x9cc9('0x2d')]);_0x1df7af['offset']=qs[_0x9cc9('0x2b')](_0x4c73e9[_0x9cc9('0x42')][_0x9cc9('0x2b')]);}_0x1df7af['order']=qs['sort'](_0x4c73e9[_0x9cc9('0x42')][_0x9cc9('0x4b')]);_0x1df7af[_0x9cc9('0x4c')]=qs['filters'](_[_0x9cc9('0x4d')](_0x4c73e9['query'],_0x1cb7d7[_0x9cc9('0x44')]));_0x1df7af['where'][_0x9cc9('0x62')]=_0x428e['id'];if(_0x4c73e9[_0x9cc9('0x42')][_0x9cc9('0x51')]){_0x1df7af['where']=_[_0x9cc9('0x4e')](_0x1df7af['where'],{'$or':_['map'](_0x1df7af['attributes'],function(_0xa260a){var _0x1934ff={};_0x1934ff[_0xa260a]={'$like':'%'+_0x4c73e9[_0x9cc9('0x42')]['filter']+'%'};return _0x1934ff;})});}_0x1df7af=_['merge']({},_0x1df7af,_0x4c73e9[_0x9cc9('0x57')]);return db[_0x9cc9('0x6a')][_0x9cc9('0x2e')]({'where':_0x1df7af[_0x9cc9('0x4c')]})[_0x9cc9('0x1b')](function(_0x4e8384){_0x2afd92['count']=_0x4e8384;if(_0x4c73e9[_0x9cc9('0x42')]['includeAll']){_0x1df7af['include']=[{'all':!![]}];}return db[_0x9cc9('0x6a')][_0x9cc9('0x54')](_0x1df7af);})[_0x9cc9('0x1b')](function(_0x16ceae){_0x2afd92['rows']=_0x16ceae;return _0x2afd92;});}})[_0x9cc9('0x1b')](respondWithFilteredResult(_0x1cb639,_0x1df7af))['catch'](handleError(_0x1cb639,null));};exports[_0x9cc9('0x6b')]=function(_0x56801,_0x32c4a2,_0x58d02e){return db[_0x9cc9('0x3d')][_0x9cc9('0x58')]({'where':{'id':_0x56801[_0x9cc9('0x56')]['id']}})['then'](handleEntityNotFound(_0x32c4a2,null))[_0x9cc9('0x1b')](function(_0x470de5){if(_0x470de5){return _0x470de5[_0x9cc9('0x6b')](_0x56801[_0x9cc9('0x42')][_0x9cc9('0x67')]);}})['then'](respondWithStatusCode(_0x32c4a2,null))[_0x9cc9('0x26')](handleError(_0x32c4a2,null));};exports[_0x9cc9('0x6c')]=function(_0x321c05,_0x14004d,_0x2c9edf){return db[_0x9cc9('0x6d')][_0x9cc9('0x58')]({'where':{'id':_0x321c05[_0x9cc9('0x56')]['id']}})['then'](handleEntityNotFound(_0x14004d,null))[_0x9cc9('0x1b')](function(_0x4e4559){if(_0x4e4559){return _0x4e4559[_0x9cc9('0x6c')](_0x321c05['body'][_0x9cc9('0x67')],_['omit'](_0x321c05['body'],[_0x9cc9('0x67'),'id'])||{});}})[_0x9cc9('0x1b')](respondWithResult(_0x14004d,null))['catch'](handleError(_0x14004d,null));};exports[_0x9cc9('0x6e')]=function(_0x5c4337,_0x2ba567,_0x49e8d5){var _0xc09799={'raw':![],'where':{}};var _0x512e91={};var _0x409827={'count':0x0,'rows':[]};return db[_0x9cc9('0x3d')][_0x9cc9('0x6f')]({'where':{'id':_0x5c4337['params']['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x2ba567,null))[_0x9cc9('0x1b')](function(_0x4b2e79){if(_0x4b2e79){_0x512e91[_0x9cc9('0x41')]=_[_0x9cc9('0x43')](db[_0x9cc9('0x6d')]['rawAttributes']);_0x512e91[_0x9cc9('0x42')]=_['keys'](_0x5c4337[_0x9cc9('0x42')]);_0x512e91[_0x9cc9('0x44')]=_[_0x9cc9('0x45')](_0x512e91[_0x9cc9('0x41')],_0x512e91[_0x9cc9('0x42')]);_0xc09799['attributes']=_[_0x9cc9('0x45')](_0x512e91['model'],qs['fields'](_0x5c4337[_0x9cc9('0x42')][_0x9cc9('0x46')]));_0xc09799[_0x9cc9('0x47')]=_0xc09799[_0x9cc9('0x47')]['length']?_0xc09799[_0x9cc9('0x47')]:_0x512e91[_0x9cc9('0x41')];if(!_0x5c4337[_0x9cc9('0x42')][_0x9cc9('0x48')](_0x9cc9('0x49'))){_0xc09799[_0x9cc9('0x2d')]=qs[_0x9cc9('0x2d')](_0x5c4337['query'][_0x9cc9('0x2d')]);_0xc09799[_0x9cc9('0x2b')]=qs['offset'](_0x5c4337[_0x9cc9('0x42')]['offset']);}_0xc09799['order']=qs[_0x9cc9('0x4b')](_0x5c4337[_0x9cc9('0x42')][_0x9cc9('0x4b')]);_0xc09799[_0x9cc9('0x4c')]=qs[_0x9cc9('0x44')](_[_0x9cc9('0x4d')](_0x5c4337[_0x9cc9('0x42')],_0x512e91[_0x9cc9('0x44')]));_0xc09799[_0x9cc9('0x4c')]['FaxAccountId']=_0x4b2e79['id'];if(_0x5c4337['query'][_0x9cc9('0x51')]){_0xc09799[_0x9cc9('0x4c')]=_['merge'](_0xc09799['where'],{'$or':_[_0x9cc9('0x4f')](_0xc09799[_0x9cc9('0x47')],function(_0x3dd140){var _0x43347a={};_0x43347a[_0x3dd140]={'$like':'%'+_0x5c4337[_0x9cc9('0x42')][_0x9cc9('0x51')]+'%'};return _0x43347a;})});}_0xc09799=_[_0x9cc9('0x4e')]({},_0xc09799,_0x5c4337[_0x9cc9('0x57')]);return db[_0x9cc9('0x6d')]['count']({'where':_0xc09799[_0x9cc9('0x4c')]})[_0x9cc9('0x1b')](function(_0x54b3a7){_0x409827[_0x9cc9('0x2e')]=_0x54b3a7;if(_0x5c4337[_0x9cc9('0x42')][_0x9cc9('0x52')]){_0xc09799['include']=[{'model':db['CmContact'],'as':_0x9cc9('0x70'),'required':![]},{'model':db[_0x9cc9('0x71')],'as':_0x9cc9('0x72'),'attributes':[_0x9cc9('0x38'),_0x9cc9('0x73'),_0x9cc9('0x74')],'required':![]},{'model':db['Tag'],'as':_0x9cc9('0x75'),'attributes':['id','name','color'],'where':_0x5c4337['query']['tag']?{'id':_0x5c4337['query'][_0x9cc9('0x76')]}:undefined,'required':_0x5c4337[_0x9cc9('0x42')]['tag']?!![]:![]}];}return db[_0x9cc9('0x6d')][_0x9cc9('0x54')](_0xc09799);})[_0x9cc9('0x1b')](function(_0x26904a){_0x409827['rows']=_0x26904a;return _0x409827;});}})['then'](respondWithFilteredResult(_0x2ba567,_0xc09799))[_0x9cc9('0x26')](handleError(_0x2ba567,null));};exports[_0x9cc9('0x77')]=function(_0x37b0c5,_0x6149e9,_0x209e4f){return db['FaxAccount'][_0x9cc9('0x6f')]({'where':{'id':_0x37b0c5['params']['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x6149e9,null))['then'](function(_0x348eab){if(_0x348eab){return db['sequelize'][_0x9cc9('0x78')](function(_0x231243){return db[_0x9cc9('0x79')][_0x9cc9('0x33')]({'where':{'FaxAccountId':_0x37b0c5[_0x9cc9('0x56')]['id']},'transaction':_0x231243})[_0x9cc9('0x1b')](function(_0x14e2f3){var _0x23827d=_[_0x9cc9('0x4f')](_0x37b0c5['body'],function(_0x37106e){_0x37106e[_0x9cc9('0x62')]=_0x37b0c5[_0x9cc9('0x56')]['id'];return _0x37106e;});return db[_0x9cc9('0x79')][_0x9cc9('0x7a')](_0x23827d,{'transaction':_0x231243});});})[_0x9cc9('0x1b')](function(){return db[_0x9cc9('0x79')][_0x9cc9('0x7b')]({'where':{'FaxAccountId':_0x37b0c5[_0x9cc9('0x56')]['id']},'order':_0x9cc9('0x7c')});});}})[_0x9cc9('0x1b')](respondWithResult(_0x6149e9,null))[_0x9cc9('0x26')](handleError(_0x6149e9,null));};exports[_0x9cc9('0x7d')]=function(_0x22d63f,_0x5b03af,_0x11cf48){var _0x11c56c={};var _0x4bc55f={};var _0x5351a3;var _0x1dc564;return db[_0x9cc9('0x3d')][_0x9cc9('0x6f')]({'where':{'id':_0x22d63f[_0x9cc9('0x56')]['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x5b03af,null))[_0x9cc9('0x1b')](function(_0x258b55){if(_0x258b55){_0x5351a3=_0x258b55;_0x4bc55f[_0x9cc9('0x41')]=_[_0x9cc9('0x43')](db[_0x9cc9('0x79')]['rawAttributes']);_0x4bc55f['query']=_[_0x9cc9('0x43')](_0x22d63f[_0x9cc9('0x42')]);_0x4bc55f[_0x9cc9('0x44')]=_['intersection'](_0x4bc55f[_0x9cc9('0x41')],_0x4bc55f[_0x9cc9('0x42')]);_0x11c56c['attributes']=_[_0x9cc9('0x45')](_0x4bc55f[_0x9cc9('0x41')],qs[_0x9cc9('0x46')](_0x22d63f[_0x9cc9('0x42')][_0x9cc9('0x46')]));_0x11c56c['attributes']=_0x11c56c['attributes'][_0x9cc9('0x65')]?_0x11c56c[_0x9cc9('0x47')]:_0x4bc55f[_0x9cc9('0x41')];_0x11c56c[_0x9cc9('0x4a')]=qs[_0x9cc9('0x4b')](_0x22d63f[_0x9cc9('0x42')][_0x9cc9('0x4b')]);_0x11c56c['where']=qs['filters'](_[_0x9cc9('0x4d')](_0x22d63f[_0x9cc9('0x42')],_0x4bc55f[_0x9cc9('0x44')]));if(_0x22d63f['query']['filter']){_0x11c56c['where']=_['merge'](_0x11c56c[_0x9cc9('0x4c')],{'$or':_[_0x9cc9('0x4f')](_0x11c56c[_0x9cc9('0x47')],function(_0x35327b){var _0x544add={};_0x544add[_0x35327b]={'$like':'%'+_0x22d63f[_0x9cc9('0x42')][_0x9cc9('0x51')]+'%'};return _0x544add;})});}_0x11c56c=_[_0x9cc9('0x4e')]({},_0x11c56c,_0x22d63f[_0x9cc9('0x57')]);return _0x5351a3[_0x9cc9('0x7d')](_0x11c56c);}})['then'](function(_0x2cabe5){if(_0x2cabe5){_0x1dc564=_0x2cabe5[_0x9cc9('0x65')];if(!_0x22d63f[_0x9cc9('0x42')]['hasOwnProperty'](_0x9cc9('0x49'))){_0x11c56c[_0x9cc9('0x2d')]=qs[_0x9cc9('0x2d')](_0x22d63f[_0x9cc9('0x42')][_0x9cc9('0x2d')]);_0x11c56c[_0x9cc9('0x2b')]=qs['offset'](_0x22d63f[_0x9cc9('0x42')][_0x9cc9('0x2b')]);}return _0x5351a3[_0x9cc9('0x7d')](_0x11c56c);}})[_0x9cc9('0x1b')](function(_0x56e8fa){if(_0x56e8fa){return _0x56e8fa?{'count':_0x1dc564,'rows':_0x56e8fa}:null;}})[_0x9cc9('0x1b')](respondWithResult(_0x5b03af,null))[_0x9cc9('0x26')](handleError(_0x5b03af,null));};function Extension(_0x56d748,_0xd095e3,_0x4f5d7f,_0x2075d6){this['context']=_0x9cc9('0x7e');this[_0x9cc9('0x7f')]=_0x56d748['localstationid'];this[_0x9cc9('0x80')]=_0x2075d6;this[_0x9cc9('0x40')]=_0x9cc9('0x81');this[_0x9cc9('0x82')]='Fax\x20Extension';this[_0x9cc9('0x62')]=_0x56d748['id'];this[_0x9cc9('0x7c')]=_0xd095e3;this[_0x9cc9('0x83')]=_0x4f5d7f;}function createExtensionsReciveFax(_0x47ad47){var _0x3dffe0=0x1;var _0x1e7a42=[];_0x1e7a42[_0x9cc9('0x84')](new Extension(_0x47ad47,_0x3dffe0,'',_0x9cc9('0x85')));_0x3dffe0+=0x1;_0x1e7a42[_0x9cc9('0x84')](new Extension(_0x47ad47,_0x3dffe0,'CDR(type)=inbound-fax','Set'));_0x3dffe0+=0x1;for(var _0x198cd5 in _0x47ad47){if(_0x47ad47['hasOwnProperty'](_0x198cd5)&&(_0x198cd5===_0x9cc9('0x86')||_0x198cd5===_0x9cc9('0x87')||_0x198cd5===_0x9cc9('0x88')||_0x198cd5===_0x9cc9('0x89')||_0x198cd5===_0x9cc9('0x8a')||_0x198cd5===_0x9cc9('0x8b')||_0x198cd5===_0x9cc9('0x8c')||_0x198cd5===_0x9cc9('0x8d')||_0x198cd5==='t38timeout')){_0x1e7a42['push'](new Extension(_0x47ad47,_0x3dffe0,_0x9cc9('0x8e')+_0x198cd5+')='+_0x47ad47[_0x198cd5],_0x9cc9('0x8f')));_0x3dffe0+=0x1;}}_0x1e7a42[_0x9cc9('0x84')](new Extension(_0x47ad47,_0x3dffe0,'6',_0x9cc9('0x90')));_0x3dffe0+=0x1;_0x1e7a42[_0x9cc9('0x84')](new Extension(_0x47ad47,_0x3dffe0,_0x9cc9('0x91'),'ReceiveFax'));_0x3dffe0=0x0;return _0x1e7a42;}exports[_0x9cc9('0x92')]=function(_0x100b4c,_0x575d44,_0x302880){var _0x17798a;return db[_0x9cc9('0x93')][_0x9cc9('0x78')](function(_0xf6755e){return db[_0x9cc9('0x3d')][_0x9cc9('0x59')](_0x100b4c[_0x9cc9('0x5a')],{'transaction':_0xf6755e})[_0x9cc9('0x1b')](function(_0x39f97f){_0x17798a=_0x39f97f[_0x9cc9('0x34')]({'plain':!![]});return db[_0x9cc9('0x94')][_0x9cc9('0x7a')](createExtensionsReciveFax(_0x17798a),{'transaction':_0xf6755e});});})[_0x9cc9('0x1b')](function(){return _0x17798a;})[_0x9cc9('0x1b')](respondWithResult(_0x575d44,null))['catch'](handleError(_0x575d44,null));};exports['updateAccountApplications']=function(_0x81add3,_0x30ecf5,_0x4d5c8e){var _0x3e69c9;return db['sequelize'][_0x9cc9('0x78')](function(_0x4b047c){return db[_0x9cc9('0x3d')]['update'](_0x81add3[_0x9cc9('0x5a')],{'where':{'id':_0x81add3[_0x9cc9('0x5a')]['id']},'transaction':_0x4b047c})['then'](function(_0x36bcea){return db[_0x9cc9('0x94')][_0x9cc9('0x33')]({'where':{'FaxAccountId':_0x81add3[_0x9cc9('0x5a')]['id']},'transaction':_0x4b047c})[_0x9cc9('0x1b')](function(_0x21299f){return db[_0x9cc9('0x94')][_0x9cc9('0x7a')](createExtensionsReciveFax(_[_0x9cc9('0x95')](_0x81add3[_0x9cc9('0x5a')],['tech',_0x9cc9('0x96'),_0x9cc9('0x97'),'updatedAt',_0x9cc9('0x98'),'ListId'])),{'transaction':_0x4b047c});});});})['then'](function(){return db[_0x9cc9('0x3d')][_0x9cc9('0x99')](_0x81add3[_0x9cc9('0x5a')]['id']);})[_0x9cc9('0x1b')](respondWithResult(_0x30ecf5,null))['catch'](handleError(_0x30ecf5,null));};exports['getMessages']=function(_0x1b67be,_0x52d4ad,_0x14ea7c){var _0xc4e6a0={'raw':!![],'where':{}};var _0x3c9f2f={};var _0x362def={'count':0x0,'rows':[]};return db[_0x9cc9('0x3d')][_0x9cc9('0x6f')]({'where':{'id':_0x1b67be[_0x9cc9('0x56')]['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x52d4ad,null))[_0x9cc9('0x1b')](function(_0xb89fd6){if(_0xb89fd6){_0x3c9f2f[_0x9cc9('0x41')]=_[_0x9cc9('0x43')](db['FaxMessage'][_0x9cc9('0x3e')]);_0x3c9f2f[_0x9cc9('0x42')]=_['keys'](_0x1b67be[_0x9cc9('0x42')]);_0x3c9f2f[_0x9cc9('0x44')]=_[_0x9cc9('0x45')](_0x3c9f2f[_0x9cc9('0x41')],_0x3c9f2f[_0x9cc9('0x42')]);_0xc4e6a0['attributes']=_[_0x9cc9('0x45')](_0x3c9f2f[_0x9cc9('0x41')],qs[_0x9cc9('0x46')](_0x1b67be[_0x9cc9('0x42')][_0x9cc9('0x46')]));_0xc4e6a0['attributes']=_0xc4e6a0[_0x9cc9('0x47')][_0x9cc9('0x65')]?_0xc4e6a0[_0x9cc9('0x47')]:_0x3c9f2f['model'];if(!_0x1b67be[_0x9cc9('0x42')][_0x9cc9('0x48')](_0x9cc9('0x49'))){_0xc4e6a0[_0x9cc9('0x2d')]=qs[_0x9cc9('0x2d')](_0x1b67be[_0x9cc9('0x42')][_0x9cc9('0x2d')]);_0xc4e6a0[_0x9cc9('0x2b')]=qs[_0x9cc9('0x2b')](_0x1b67be[_0x9cc9('0x42')][_0x9cc9('0x2b')]);}_0xc4e6a0[_0x9cc9('0x4a')]=qs['sort'](_0x1b67be['query'][_0x9cc9('0x4b')]);_0xc4e6a0[_0x9cc9('0x4c')]=qs[_0x9cc9('0x44')](_[_0x9cc9('0x4d')](_0x1b67be[_0x9cc9('0x42')],_0x3c9f2f[_0x9cc9('0x44')]));_0xc4e6a0[_0x9cc9('0x4c')][_0x9cc9('0x62')]=_0xb89fd6['id'];if(_0x1b67be[_0x9cc9('0x42')][_0x9cc9('0x51')]){_0xc4e6a0[_0x9cc9('0x4c')]=_[_0x9cc9('0x4e')](_0xc4e6a0[_0x9cc9('0x4c')],{'$or':_[_0x9cc9('0x4f')](_0xc4e6a0[_0x9cc9('0x47')],function(_0x1c516f){var _0x4f68aa={};_0x4f68aa[_0x1c516f]={'$like':'%'+_0x1b67be[_0x9cc9('0x42')][_0x9cc9('0x51')]+'%'};return _0x4f68aa;})});}if(_0x1b67be[_0x9cc9('0x42')]['$gte']){var _0x349035=_0x1b67be[_0x9cc9('0x42')][_0x9cc9('0x9a')][_0x9cc9('0x9b')](',');var _0x56d0d9={};_0x56d0d9[_0x349035[0x0]]={'$gte':moment(_0x349035[0x1])[_0x9cc9('0x9c')](_0x9cc9('0x9d'))};_0xc4e6a0['where']=_['merge'](_0xc4e6a0['where'],_0x56d0d9);}_0xc4e6a0=_[_0x9cc9('0x4e')]({},_0xc4e6a0,_0x1b67be[_0x9cc9('0x57')]);return db['FaxMessage'][_0x9cc9('0x2e')]({'where':_0xc4e6a0['where']})[_0x9cc9('0x1b')](function(_0x14b8b7){_0x362def['count']=_0x14b8b7;if(_0x1b67be['query'][_0x9cc9('0x52')]){_0xc4e6a0[_0x9cc9('0x53')]=[{'all':!![]}];}return db[_0x9cc9('0x9e')]['findAll'](_0xc4e6a0);})[_0x9cc9('0x1b')](function(_0x3084bf){_0x362def[_0x9cc9('0x9f')]=_0x3084bf;return _0x362def;});}})['then'](respondWithFilteredResult(_0x52d4ad,_0xc4e6a0))[_0x9cc9('0x26')](handleError(_0x52d4ad,null));};exports[_0x9cc9('0x39')]=function(_0x146f22,_0x532cef,_0xc5b936){var _0x48f1e1,_0x39b119={},_0x5931ca;if(_0x146f22[_0x9cc9('0x5a')]['to']){_0x5931ca=_0x146f22[_0x9cc9('0x5a')]['to'][0x0];}return db['FaxAccount'][_0x9cc9('0x58')]({'where':{'id':_0x146f22[_0x9cc9('0x56')]['id']},'include':[{'model':db[_0x9cc9('0xa0')],'as':_0x9cc9('0xa1'),'include':[{'model':db[_0x9cc9('0xa2')],'as':_0x9cc9('0xa3'),'where':{'fax':_0x5931ca},'limit':0x1,'order':[['updatedAt',_0x9cc9('0xa4')]]}]}]})[_0x9cc9('0x1b')](handleEntityNotFound(_0x532cef,null))[_0x9cc9('0x1b')](function(_0x593ada){_0x48f1e1=_0x593ada;if(_0x146f22[_0x9cc9('0x5a')][_0x9cc9('0xa5')]&&_0x146f22[_0x9cc9('0x5a')][_0x9cc9('0xa5')][_0x9cc9('0x65')]){for(var _0x3b3c15=0x0;_0x3b3c15<_0x146f22[_0x9cc9('0x5a')][_0x9cc9('0xa5')]['length'];_0x3b3c15+=0x1){_0x146f22['body'][_0x9cc9('0xa5')][_0x3b3c15]={'filename':_0x146f22[_0x9cc9('0x5a')]['attachments'][_0x3b3c15]['name'],'id':_0x146f22[_0x9cc9('0x5a')][_0x9cc9('0xa5')][_0x3b3c15]['id'],'path':path[_0x9cc9('0xa6')](config[_0x9cc9('0xa7')],_0x9cc9('0xa8'),_0x146f22[_0x9cc9('0x5a')][_0x9cc9('0xa5')][_0x3b3c15]['basename'])};}}return respondWithRpcPromise(_0x9cc9('0xa9'),_0x9cc9('0xa9'),{'FaxAccountId':_[_0x9cc9('0xaa')](_0x146f22[_0x9cc9('0x56')]['id'])?undefined:_0x146f22['params']['id'],'path':_[_0x9cc9('0xaa')](_0x146f22[_0x9cc9('0x5a')][_0x9cc9('0xa5')][0x0][_0x9cc9('0x2')])?undefined:_0x146f22['body'][_0x9cc9('0xa5')][0x0]['path'],'fax':_[_0x9cc9('0xaa')](_0x146f22['body']['to'][0x0])?undefined:_0x146f22['body']['to'][0x0]},client9002);})[_0x9cc9('0x1b')](function(){if(_0x48f1e1){if(_['isNil'](_0x146f22[_0x9cc9('0x5a')]['from'])){_0x146f22['body'][_0x9cc9('0xab')]=util['format']('\x22%s\x22\x20<%s>',_0x48f1e1['name'],_0x48f1e1['fax']);}if(_0x48f1e1[_0x9cc9('0xa1')]){if(_0x48f1e1[_0x9cc9('0xa1')][_0x9cc9('0xa3')]['length']){return _0x48f1e1[_0x9cc9('0xa1')][_0x9cc9('0xa3')][0x0];}else{return db['CmContact'][_0x9cc9('0x59')](_[_0x9cc9('0x13')](_0x146f22[_0x9cc9('0x5a')],{'firstName':_0x146f22[_0x9cc9('0x5a')]['to'][0x0],'phone':_0x146f22['body']['to'][0x0],'fax':_0x146f22[_0x9cc9('0x5a')]['to'][0x0],'ListId':_0x48f1e1[_0x9cc9('0xac')]}));}}else{throw new Error(_0x9cc9('0xad'));}}else{throw new Error(_0x9cc9('0xae'));}})[_0x9cc9('0x1b')](function(_0x544e2c){if(_0x544e2c){return db[_0x9cc9('0x6d')][_0x9cc9('0x58')]({'where':{'ContactId':_0x544e2c['id'],'closed':![],'FaxAccountId':_0x48f1e1['id']}})['then'](function(_0x2ea3ad){if(_0x2ea3ad){return[_0x2ea3ad,![]];}return db[_0x9cc9('0x6d')][_0x9cc9('0x59')]({'UserId':_0x146f22[_0x9cc9('0x5b')]['id'],'ContactId':_0x544e2c['id'],'FaxAccountId':_0x48f1e1['id'],'fax':_0x146f22[_0x9cc9('0x5a')]['to'][0x0],'firstMsgDirection':_0x9cc9('0xaf'),'Messages':[_[_0x9cc9('0x4e')](_0x146f22['body'],{'read':![],'body':_0x146f22[_0x9cc9('0x5a')][_0x9cc9('0xa5')][0x0]['filename'],'FaxAccountId':_0x48f1e1['id'],'UserId':_0x146f22[_0x9cc9('0x5b')]['id'],'ContactId':_0x544e2c['id'],'AttachmentId':_0x146f22['body'][_0x9cc9('0xa5')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x9cc9('0xb0')}]})[_0x9cc9('0x1b')](function(_0x4b9b9a){return[_0x4b9b9a,!![]];});});}else{throw new Error(_0x9cc9('0xb1'));}})[_0x9cc9('0xb2')](function(_0x55ce99,_0x85d958){if(_0x85d958){return _0x55ce99;}return db[_0x9cc9('0x9e')][_0x9cc9('0x59')]({'direction':'out','read':![],'body':_0x146f22[_0x9cc9('0x5a')][_0x9cc9('0xa5')][0x0][_0x9cc9('0xb3')],'FaxAccountId':_0x48f1e1['id'],'FaxInteractionId':_0x55ce99['id'],'UserId':_0x146f22[_0x9cc9('0x5b')]['id'],'ContactId':_0x55ce99[_0x9cc9('0xb4')],'AttachmentId':_0x146f22['body'][_0x9cc9('0xa5')][0x0]['id']})[_0x9cc9('0x1b')](function(_0x56dfac){_0x55ce99['dataValues'][_0x9cc9('0xb0')]=[];_0x55ce99['dataValues'][_0x9cc9('0xb0')]['push'](_0x56dfac[_0x9cc9('0xb5')]);return _0x55ce99;});})[_0x9cc9('0x1b')](function(_0x14926a){respondWithRpcPromise(_0x9cc9('0xb6'),_0x9cc9('0xb6'),{'FaxAccountId':_[_0x9cc9('0xaa')](_0x146f22[_0x9cc9('0x56')]['id'])?undefined:_0x146f22[_0x9cc9('0x56')]['id'],'path':_[_0x9cc9('0xaa')](_0x146f22[_0x9cc9('0x5a')]['attachments'][0x0][_0x9cc9('0x2')])?undefined:_0x146f22['body']['attachments'][0x0][_0x9cc9('0x2')],'fax':_[_0x9cc9('0xaa')](_0x146f22['body']['to'][0x0])?undefined:_0x146f22[_0x9cc9('0x5a')]['to'][0x0],'AttachmentId':_0x146f22['body']['attachments'][0x0]['id']},client9002)[_0x9cc9('0x1b')](function(_0x3bbaf8){logger['info']('SendFaxRpc,\x20%s',_0x3bbaf8);})[_0x9cc9('0x26')](function(_0x4ead56){logger[_0x9cc9('0x24')](_0x9cc9('0xb7'),_0x4ead56);});return _0x14926a;})['then'](respondWithResult(_0x532cef,null))['catch'](handleError(_0x532cef,null));};exports[_0x9cc9('0xb8')]=function(_0x271385,_0x4b6ec9,_0x118a66){return db['FaxAccount'][_0x9cc9('0x58')]({'where':{'id':_0x271385[_0x9cc9('0x56')]['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x4b6ec9,null))[_0x9cc9('0x1b')](function(_0x3e6fe6){if(_0x3e6fe6){return _0x3e6fe6[_0x9cc9('0xb8')](_0x271385[_0x9cc9('0x5a')][_0x9cc9('0x67')],_[_0x9cc9('0x95')](_0x271385[_0x9cc9('0x5a')],[_0x9cc9('0x67'),'id'])||{})[_0x9cc9('0xb2')](function(_0x11ad84){for(var _0x23b54c=0x0;_0x23b54c<_0x271385[_0x9cc9('0x5a')][_0x9cc9('0x67')]['length'];_0x23b54c+=0x1){socket[_0x9cc9('0xb9')](_0x9cc9('0xba'),{'UserId':Number(_0x271385[_0x9cc9('0x5a')][_0x9cc9('0x67')][_0x23b54c]),'FaxAccountId':Number(_0x271385[_0x9cc9('0x56')]['id'])});}return _0x11ad84;});}})[_0x9cc9('0x1b')](respondWithResult(_0x4b6ec9,null))[_0x9cc9('0x26')](handleError(_0x4b6ec9,null));};exports[_0x9cc9('0xbb')]=function(_0x2cad82,_0x293945,_0x53c514){return db[_0x9cc9('0x3d')]['find']({'where':{'id':_0x2cad82[_0x9cc9('0x56')]['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x293945,null))[_0x9cc9('0x1b')](function(_0x1d5597){if(_0x1d5597){return _0x1d5597[_0x9cc9('0xbb')](_0x2cad82[_0x9cc9('0x42')][_0x9cc9('0x67')])[_0x9cc9('0x1b')](function(){if(_[_0x9cc9('0xbc')](_0x2cad82['query'][_0x9cc9('0x67')])){for(var _0xf75e5f=0x0;_0xf75e5f<_0x2cad82[_0x9cc9('0x42')][_0x9cc9('0x67')]['length'];_0xf75e5f+=0x1){socket[_0x9cc9('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x2cad82['query']['ids'][_0xf75e5f]),'FaxAccountId':Number(_0x2cad82[_0x9cc9('0x56')]['id'])});}}else{socket[_0x9cc9('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x2cad82[_0x9cc9('0x42')][_0x9cc9('0x67')]),'FaxAccountId':Number(_0x2cad82[_0x9cc9('0x56')]['id'])});}});}})[_0x9cc9('0x1b')](respondWithStatusCode(_0x293945,null))[_0x9cc9('0x26')](handleError(_0x293945,null));};exports[_0x9cc9('0xbd')]=function(_0x29eab6,_0x9bace4,_0x18a486){var _0x5e28bb={};var _0x4d5c91={};var _0x578171;var _0x47fd52;return db['FaxAccount']['findOne']({'where':{'id':_0x29eab6['params']['id']}})[_0x9cc9('0x1b')](handleEntityNotFound(_0x9bace4,null))[_0x9cc9('0x1b')](function(_0xc56e58){if(_0xc56e58){_0x578171=_0xc56e58;_0x4d5c91['model']=_[_0x9cc9('0x43')](db['User'][_0x9cc9('0x3e')]);_0x4d5c91[_0x9cc9('0x42')]=_[_0x9cc9('0x43')](_0x29eab6[_0x9cc9('0x42')]);_0x4d5c91[_0x9cc9('0x44')]=_[_0x9cc9('0x45')](_0x4d5c91[_0x9cc9('0x41')],_0x4d5c91[_0x9cc9('0x42')]);_0x5e28bb['attributes']=_[_0x9cc9('0x45')](_0x4d5c91[_0x9cc9('0x41')],qs[_0x9cc9('0x46')](_0x29eab6['query'][_0x9cc9('0x46')]));_0x5e28bb[_0x9cc9('0x47')]=_0x5e28bb[_0x9cc9('0x47')]['length']?_0x5e28bb[_0x9cc9('0x47')]:_0x4d5c91[_0x9cc9('0x41')];_0x5e28bb[_0x9cc9('0x4a')]=qs['sort'](_0x29eab6[_0x9cc9('0x42')][_0x9cc9('0x4b')]);_0x5e28bb['where']=qs['filters'](_[_0x9cc9('0x4d')](_0x29eab6['query'],_0x4d5c91[_0x9cc9('0x44')]));if(_0x29eab6[_0x9cc9('0x42')][_0x9cc9('0x51')]){_0x5e28bb[_0x9cc9('0x4c')]=_[_0x9cc9('0x4e')](_0x5e28bb[_0x9cc9('0x4c')],{'$or':_[_0x9cc9('0x4f')](_0x5e28bb['attributes'],function(_0x34f291){var _0x3fa37d={};_0x3fa37d[_0x34f291]={'$like':'%'+_0x29eab6[_0x9cc9('0x42')][_0x9cc9('0x51')]+'%'};return _0x3fa37d;})});}_0x5e28bb=_[_0x9cc9('0x4e')]({},_0x5e28bb,_0x29eab6[_0x9cc9('0x57')]);return _0x578171['getAgents'](_0x5e28bb);}})['then'](function(_0x64a0c8){if(_0x64a0c8){_0x47fd52=_0x64a0c8[_0x9cc9('0x65')];if(!_0x29eab6[_0x9cc9('0x42')][_0x9cc9('0x48')]('nolimit')){_0x5e28bb[_0x9cc9('0x2d')]=qs[_0x9cc9('0x2d')](_0x29eab6[_0x9cc9('0x42')][_0x9cc9('0x2d')]);_0x5e28bb[_0x9cc9('0x2b')]=qs[_0x9cc9('0x2b')](_0x29eab6['query'][_0x9cc9('0x2b')]);}return _0x578171[_0x9cc9('0xbd')](_0x5e28bb);}})['then'](function(_0x3cc771){if(_0x3cc771){return _0x3cc771?{'count':_0x47fd52,'rows':_0x3cc771}:null;}})[_0x9cc9('0x1b')](respondWithResult(_0x9bace4,null))['catch'](handleError(_0x9bace4,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4284274..448b87e 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 _0x9934=['save','update','remove','emit','hasOwnProperty','../../mysqldb','setMaxListeners'];(function(_0x21b762,_0xc8ef11){var _0x2ea6d4=function(_0x22bd14){while(--_0x22bd14){_0x21b762['push'](_0x21b762['shift']());}};_0x2ea6d4(++_0xc8ef11);}(_0x9934,0x7c));var _0x4993=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x9934[_0xf0ec6e];return _0x8bbc27;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x4993('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4993('0x1')](0x0);var events={'afterCreate':_0x4993('0x2'),'afterUpdate':_0x4993('0x3'),'afterDestroy':_0x4993('0x4')};function emitEvent(_0x47a4d4){return function(_0x7deb84,_0x308008,_0x14ec4f){FaxAccountEvents[_0x4993('0x5')](_0x47a4d4+':'+_0x7deb84['id'],_0x7deb84);FaxAccountEvents[_0x4993('0x5')](_0x47a4d4,_0x7deb84);_0x14ec4f(null);};}for(var e in events){if(events[_0x4993('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x3859=['hasOwnProperty','hook','events','setMaxListeners','save','update','remove','emit'];(function(_0x54b3d5,_0x1a09b2){var _0x259ea6=function(_0x57a46c){while(--_0x57a46c){_0x54b3d5['push'](_0x54b3d5['shift']());}};_0x259ea6(++_0x1a09b2);}(_0x3859,0xf2));var _0x9385=function(_0x3c06c1,_0x340bd6){_0x3c06c1=_0x3c06c1-0x0;var _0x52031f=_0x3859[_0x3c06c1];return _0x52031f;};'use strict';var EventEmitter=require(_0x9385('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9385('0x1')](0x0);var events={'afterCreate':_0x9385('0x2'),'afterUpdate':_0x9385('0x3'),'afterDestroy':_0x9385('0x4')};function emitEvent(_0x3d17fc){return function(_0x1f8063,_0x26ee66,_0x28c6c8){FaxAccountEvents['emit'](_0x3d17fc+':'+_0x1f8063['id'],_0x1f8063);FaxAccountEvents[_0x9385('0x5')](_0x3d17fc,_0x1f8063);_0x28c6c8(null);};}for(var e in events){if(events[_0x9385('0x6')](e)){var event=events[e];FaxAccount[_0x9385('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9ce4d8e..3ba9bf4 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 _0x9135=['define','FaxAccount','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3c903e,_0xddddac){var _0x4e6ae0=function(_0x2f6622){while(--_0x2f6622){_0x3c903e['push'](_0x3c903e['shift']());}};_0x4e6ae0(++_0xddddac);}(_0x9135,0x86));var _0x5913=function(_0x2bc9b7,_0x317208){_0x2bc9b7=_0x2bc9b7-0x0;var _0x5685a5=_0x9135[_0x2bc9b7];return _0x5685a5;};'use strict';var _=require(_0x5913('0x0'));var util=require(_0x5913('0x1'));var logger=require('../../config/logger')(_0x5913('0x2'));var moment=require(_0x5913('0x3'));var BPromise=require('bluebird');var rp=require(_0x5913('0x4'));var fs=require('fs');var path=require(_0x5913('0x5'));var rimraf=require(_0x5913('0x6'));var config=require(_0x5913('0x7'));var attributes=require('./faxAccount.attributes');module[_0x5913('0x8')]=function(_0x45625e,_0x3158cc){return _0x45625e[_0x5913('0x9')](_0x5913('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3af=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util'];(function(_0x45dbe3,_0xd2bf96){var _0x1e71cf=function(_0x47d46d){while(--_0x47d46d){_0x45dbe3['push'](_0x45dbe3['shift']());}};_0x1e71cf(++_0xd2bf96);}(_0xd3af,0x196));var _0xfd3a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd3af[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xfd3a('0x0'));var util=require(_0xfd3a('0x1'));var logger=require(_0xfd3a('0x2'))('api');var moment=require(_0xfd3a('0x3'));var BPromise=require(_0xfd3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd3a('0x5'));var rimraf=require(_0xfd3a('0x6'));var config=require(_0xfd3a('0x7'));var attributes=require(_0xfd3a('0x8'));module[_0xfd3a('0x9')]=function(_0x29c499,_0x512fce){return _0x29c499[_0xfd3a('0xa')](_0xfd3a('0xb'),attributes,{'tableName':'fax_accounts','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 cf54680..4464236 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 _0x9f09=['close','unmanaged','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','FaxAccount','find','CmList','List','Contacts','Applications','get','applications','list','orderBy','asc','account','length','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push'];(function(_0x3ba11a,_0x442572){var _0x34c885=function(_0x46045d){while(--_0x46045d){_0x3ba11a['push'](_0x3ba11a['shift']());}};_0x34c885(++_0x442572);}(_0x9f09,0xc5));var _0x99f0=function(_0x2844a3,_0x1ab093){_0x2844a3=_0x2844a3-0x0;var _0x123318=_0x9f09[_0x2844a3];return _0x123318;};'use strict';var _=require(_0x99f0('0x0'));var util=require(_0x99f0('0x1'));var moment=require('moment');var BPromise=require(_0x99f0('0x2'));var rs=require(_0x99f0('0x3'));var fs=require('fs');var Redis=require(_0x99f0('0x4'));var db=require(_0x99f0('0x5'))['db'];var utils=require(_0x99f0('0x6'));var logger=require('../../config/logger')(_0x99f0('0x7'));var config=require(_0x99f0('0x8'));var jayson=require(_0x99f0('0x9'));var client=jayson[_0x99f0('0xa')][_0x99f0('0xb')]({'port':0x232c});config[_0x99f0('0xc')]=_[_0x99f0('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x99f0('0xe'))(new Redis(config[_0x99f0('0xc')]));require(_0x99f0('0xf'))['register'](socket);function respondWithRpcPromise(_0x92091f,_0x56380c,_0x113a35){return new BPromise(function(_0x177560,_0x3a81fb){return client[_0x99f0('0x10')](_0x92091f,_0x113a35)[_0x99f0('0x11')](function(_0x64a6b5){logger[_0x99f0('0x12')](_0x99f0('0x13'),_0x56380c,_0x99f0('0x14'));logger[_0x99f0('0x15')](_0x99f0('0x16'),_0x56380c,_0x99f0('0x14'),JSON['stringify'](_0x64a6b5));if(_0x64a6b5[_0x99f0('0x17')]){if(_0x64a6b5[_0x99f0('0x17')][_0x99f0('0x18')]===0x1f4){logger[_0x99f0('0x17')](_0x99f0('0x13'),_0x56380c,_0x64a6b5[_0x99f0('0x17')][_0x99f0('0x19')]);return _0x3a81fb(_0x64a6b5[_0x99f0('0x17')]['message']);}logger[_0x99f0('0x17')](_0x99f0('0x13'),_0x56380c,_0x64a6b5[_0x99f0('0x17')][_0x99f0('0x19')]);return _0x177560(_0x64a6b5['error']['message']);}else{logger['info'](_0x99f0('0x13'),_0x56380c,_0x99f0('0x14'));_0x177560(_0x64a6b5[_0x99f0('0x1a')][_0x99f0('0x19')]);}})[_0x99f0('0x1b')](function(_0x4fed5a){logger[_0x99f0('0x17')]('FaxAccount,\x20%s,\x20%s',_0x56380c,_0x4fed5a);_0x3a81fb(_0x4fed5a);});});}exports[_0x99f0('0x1c')]=function(_0xb3bac){var _0x1d2b1=this;return new Promise(function(_0x1bf26c,_0x59698d){return db['FaxAccount'][_0x99f0('0x1d')]({'raw':_0xb3bac[_0x99f0('0x1e')]?_0xb3bac[_0x99f0('0x1e')][_0x99f0('0x1f')]===undefined?!![]:![]:!![],'where':_0xb3bac['options']?_0xb3bac['options'][_0x99f0('0x20')]||null:null,'attributes':_0xb3bac[_0x99f0('0x1e')]?_0xb3bac[_0x99f0('0x1e')][_0x99f0('0x21')]||null:null,'limit':_0xb3bac[_0x99f0('0x1e')]?_0xb3bac[_0x99f0('0x1e')][_0x99f0('0x22')]||null:null,'include':_0xb3bac[_0x99f0('0x1e')]?_0xb3bac[_0x99f0('0x1e')][_0x99f0('0x23')]?_[_0x99f0('0x24')](_0xb3bac[_0x99f0('0x1e')][_0x99f0('0x23')],function(_0x475288){return{'model':db[_0x475288[_0x99f0('0x25')]],'as':_0x475288['as'],'attributes':_0x475288[_0x99f0('0x21')],'include':_0x475288['include']?_['map'](_0x475288[_0x99f0('0x23')],function(_0x3a3259){return{'model':db[_0x3a3259['model']],'as':_0x3a3259['as'],'attributes':_0x3a3259[_0x99f0('0x21')],'include':_0x3a3259[_0x99f0('0x23')]?_['map'](_0x3a3259[_0x99f0('0x23')],function(_0x876c38){return{'model':db[_0x876c38[_0x99f0('0x25')]],'as':_0x876c38['as'],'attributes':_0x876c38[_0x99f0('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd2dca0){logger[_0x99f0('0x12')](_0x99f0('0x1c'),_0xb3bac);logger[_0x99f0('0x15')](_0x99f0('0x1c'),_0xb3bac,JSON['stringify'](_0xd2dca0));_0x1bf26c(_0xd2dca0);})[_0x99f0('0x1b')](function(_0x436ba7){logger[_0x99f0('0x17')](_0x99f0('0x1c'),_0x436ba7[_0x99f0('0x19')],_0xb3bac);_0x59698d(_0x1d2b1[_0x99f0('0x17')](0x1f4,_0x436ba7[_0x99f0('0x19')]));});});};exports[_0x99f0('0x26')]=function(_0xa466e8,_0x3a6afb,_0x34749d){var _0xc764fe=this;return new Promise(function(_0x54ca28,_0x3cbfd1){var _0x2a2bcd={'body':_0xa466e8['body'],'channel':_0x99f0('0x27')};var _0x234c50=[];var _0x104e5c=[];var _0x1295f7={};return db[_0x99f0('0x28')][_0x99f0('0x29')]()[_0x99f0('0x11')](function(_0x581f2b){if(!_0x581f2b){throw new db[(_0x99f0('0x2a'))][(_0x99f0('0x2b'))](_0x99f0('0x2c'));}_0x234c50=_['difference'](_[_0x99f0('0x2d')](_0x581f2b),['createdAt',_0x99f0('0x2e')]);_0x104e5c=_[_0x99f0('0x2f')](_[_0x99f0('0x2d')](_0x581f2b),['createdAt',_0x99f0('0x2e'),_0x99f0('0x30'),_0x99f0('0x31')]);if(_0xa466e8[_0x99f0('0x32')]['id']){delete _0xa466e8[_0x99f0('0x32')]['id'];}if(_[_0x99f0('0x33')](_0xa466e8[_0x99f0('0x32')][_0x99f0('0x34')])){throw new db['Sequelize'][(_0x99f0('0x2b'))](_0x99f0('0x35'));}if(_[_0x99f0('0x33')](_0xa466e8[_0x99f0('0x32')]['body'])||_0xa466e8[_0x99f0('0x32')][_0x99f0('0x32')]===''){throw new db['Sequelize']['ValidationError'](_0x99f0('0x36'));}if(_[_0x99f0('0x33')](_0xa466e8['body'][_0x99f0('0x37')])){throw new db[(_0x99f0('0x2a'))][(_0x99f0('0x2b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x104e5c);}if(!_[_0x99f0('0x38')](_0x104e5c,_0xa466e8[_0x99f0('0x32')][_0x99f0('0x37')])){throw new db['Sequelize'][(_0x99f0('0x2b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x104e5c);}_0x1295f7[_0xa466e8['body'][_0x99f0('0x37')]]=_0xa466e8[_0x99f0('0x32')][_0x99f0('0x34')];})[_0x99f0('0x11')](function(){return db[_0x99f0('0x39')][_0x99f0('0x3a')]({'where':{'id':_0xa466e8['account']['id']},'include':[{'model':db[_0x99f0('0x3b')],'as':_0x99f0('0x3c'),'include':[{'model':db[_0x99f0('0x28')],'as':_0x99f0('0x3d'),'where':_0x1295f7,'limit':0x1,'order':[[_0x99f0('0x2e'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x99f0('0x3e')}]});})[_0x99f0('0x11')](function(_0x3622ea){if(_0x3622ea&&_0x3622ea[_0x99f0('0x3c')]){var _0x1514c2=_0x3622ea[_0x99f0('0x3f')]({'plain':!![]});_0x2a2bcd['account']=_0x1514c2;_0x2a2bcd[_0x99f0('0x40')]=_0x1514c2['Applications'];_0x2a2bcd[_0x99f0('0x41')]=_0x1514c2[_0x99f0('0x3c')];_0x2a2bcd[_0x99f0('0x40')]=_[_0x99f0('0x42')](_0x2a2bcd[_0x99f0('0x40')],['priority'],[_0x99f0('0x43')]);if(_0x2a2bcd['account'][_0x99f0('0x3e')]){delete _0x2a2bcd[_0x99f0('0x44')][_0x99f0('0x3e')];}if(_0x2a2bcd[_0x99f0('0x44')][_0x99f0('0x3c')]&&_0x2a2bcd[_0x99f0('0x44')][_0x99f0('0x3c')][_0x99f0('0x3d')][_0x99f0('0x45')]){return _0x2a2bcd[_0x99f0('0x44')][_0x99f0('0x3c')][_0x99f0('0x3d')][0x0];}var _0xfba8d0=_[_0x99f0('0xd')](_0xa466e8[_0x99f0('0x32')],{'firstName':_0xa466e8[_0x99f0('0x32')][_0x99f0('0x34')],'ListId':_0x1514c2['ListId']});_0xfba8d0[_0xa466e8[_0x99f0('0x32')]['mapKey']]=_0xa466e8[_0x99f0('0x32')][_0x99f0('0x34')];return db['CmContact']['create'](_0xfba8d0,{'fields':_0x234c50,'raw':!![]});}})['then'](function(_0x5a861b){_0x2a2bcd['contact']=_0x5a861b;if(_0x5a861b){var _0x184291={'ContactId':_0x5a861b['id'],'FaxAccountId':_0xa466e8[_0x99f0('0x44')]['id'],'fax':_0x5a861b[_0x99f0('0x27')]};return db[_0x99f0('0x46')][_0x99f0('0x3a')]({'where':{'ContactId':_0x5a861b['id'],'closed':![],'FaxAccountId':_0xa466e8[_0x99f0('0x44')]['id']}})[_0x99f0('0x11')](function(_0x8de375){if(_0x8de375){return[_0x8de375,![]];}return db[_0x99f0('0x46')][_0x99f0('0x47')](_0x184291)['then'](function(_0x4c0c1a){return[_0x4c0c1a,!![]];});});}else{throw new Error(_0x99f0('0x48'));}})[_0x99f0('0x49')](function(_0x5b756d,_0x50c217){var _0x17805b=_0x5b756d[_0x99f0('0x3f')]({'plain':!![]});if(_0x50c217){if(_0x2a2bcd[_0x99f0('0x44')][_0x99f0('0x4a')]){_0x2a2bcd[_0x99f0('0x40')][_0x99f0('0x4b')]({'id':0x0,'priority':_0x2a2bcd[_0x99f0('0x40')][_0x99f0('0x45')]+0x1,'app':_0x99f0('0x4c'),'appdata':_0x99f0('0x4d'),'interval':'*,*,*,*'});}_0x17805b['created']=!![];}else{_0x17805b[_0x99f0('0x4e')]=![];}_0x2a2bcd[_0x99f0('0x4f')]=_0x17805b;return db[_0x99f0('0x50')]['create']({'body':_0xa466e8[_0x99f0('0x32')][_0x99f0('0x32')],'FaxAccountId':_0xa466e8[_0x99f0('0x44')]['id'],'FaxInteractionId':_0x5b756d['id'],'direction':'in','ContactId':_0x5b756d[_0x99f0('0x51')],'AttachmentId':_0xa466e8[_0x99f0('0x32')]['AttachmentId']});})[_0x99f0('0x11')](function(_0x18da34){_0x2a2bcd[_0x99f0('0x19')]=_0x18da34;if(_0x2a2bcd[_0x99f0('0x4f')][_0x99f0('0x52')]){return db[_0x99f0('0x53')]['find']({'attributes':['id',_0x99f0('0x54')],'where':{'id':_0x2a2bcd['interaction'][_0x99f0('0x52')]}})[_0x99f0('0x11')](function(_0x36ec3b){if(_0x36ec3b){_0x2a2bcd[_0x99f0('0x40')][_0x99f0('0x55')]({'id':0x0,'priority':0x0,'app':_0x99f0('0x56'),'appdata':_0x36ec3b[_0x99f0('0x54')]+','+(_0x2a2bcd[_0x99f0('0x44')][_0x99f0('0x57')]||0xa),'interval':_0x99f0('0x58')});}return respondWithRpcPromise('Start',_0x99f0('0x59'),_0x2a2bcd);});}return respondWithRpcPromise(_0x99f0('0x5a'),_0x99f0('0x59'),_0x2a2bcd);})[_0x99f0('0x11')](function(_0x405522){_0x54ca28(_0x405522);})['catch'](function(_0x6481e2){_0x3cbfd1(_0xc764fe[_0x99f0('0x17')](0x1f4,_0x6481e2['message']));});});}; \ No newline at end of file +var _0x6820=['Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','limit','include','map','model','attributes','debug','stringify','fax','Sequelize','no\x20available\x20attributes','difference','keys','updatedAt','CompanyId','ListId','body','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','length','from','create','contact','FaxInteraction'];(function(_0x3ebf9b,_0x503fa6){var _0x3b2664=function(_0x4edf52){while(--_0x4edf52){_0x3ebf9b['push'](_0x3ebf9b['shift']());}};_0x3b2664(++_0x503fa6);}(_0x6820,0x6d));var _0x0682=function(_0x2f5072,_0x11d0cd){_0x2f5072=_0x2f5072-0x0;var _0x28d2c8=_0x6820[_0x2f5072];return _0x28d2c8;};'use strict';var _=require('lodash');var util=require(_0x0682('0x0'));var moment=require(_0x0682('0x1'));var BPromise=require('bluebird');var rs=require(_0x0682('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0682('0x3'))['db'];var utils=require(_0x0682('0x4'));var logger=require(_0x0682('0x5'))('rpc');var config=require(_0x0682('0x6'));var jayson=require(_0x0682('0x7'));var client=jayson[_0x0682('0x8')][_0x0682('0x9')]({'port':0x232c});config[_0x0682('0xa')]=_[_0x0682('0xb')](config[_0x0682('0xa')],{'host':_0x0682('0xc'),'port':0x18eb});var socket=require(_0x0682('0xd'))(new Redis(config[_0x0682('0xa')]));require('./faxAccount.socket')[_0x0682('0xe')](socket);function respondWithRpcPromise(_0x57f855,_0x5b7813,_0x4d8839){return new BPromise(function(_0x17d4b8,_0x57fcb5){return client[_0x0682('0xf')](_0x57f855,_0x4d8839)[_0x0682('0x10')](function(_0x3f1e5c){logger['info']('FaxAccount,\x20%s,\x20%s',_0x5b7813,_0x0682('0x11'));logger['debug'](_0x0682('0x12'),_0x5b7813,_0x0682('0x11'),JSON['stringify'](_0x3f1e5c));if(_0x3f1e5c[_0x0682('0x13')]){if(_0x3f1e5c[_0x0682('0x13')][_0x0682('0x14')]===0x1f4){logger[_0x0682('0x13')](_0x0682('0x15'),_0x5b7813,_0x3f1e5c[_0x0682('0x13')]['message']);return _0x57fcb5(_0x3f1e5c[_0x0682('0x13')][_0x0682('0x16')]);}logger[_0x0682('0x13')](_0x0682('0x15'),_0x5b7813,_0x3f1e5c[_0x0682('0x13')]['message']);return _0x17d4b8(_0x3f1e5c['error'][_0x0682('0x16')]);}else{logger['info'](_0x0682('0x15'),_0x5b7813,_0x0682('0x11'));_0x17d4b8(_0x3f1e5c[_0x0682('0x17')][_0x0682('0x16')]);}})[_0x0682('0x18')](function(_0x5f534c){logger[_0x0682('0x13')](_0x0682('0x15'),_0x5b7813,_0x5f534c);_0x57fcb5(_0x5f534c);});});}exports[_0x0682('0x19')]=function(_0x388f21){var _0x13576f=this;return new Promise(function(_0x636a28,_0x1ad921){return db[_0x0682('0x1a')]['findAll']({'raw':_0x388f21[_0x0682('0x1b')]?_0x388f21[_0x0682('0x1b')][_0x0682('0x1c')]===undefined?!![]:![]:!![],'where':_0x388f21['options']?_0x388f21[_0x0682('0x1b')][_0x0682('0x1d')]||null:null,'attributes':_0x388f21[_0x0682('0x1b')]?_0x388f21[_0x0682('0x1b')]['attributes']||null:null,'limit':_0x388f21[_0x0682('0x1b')]?_0x388f21[_0x0682('0x1b')][_0x0682('0x1e')]||null:null,'include':_0x388f21[_0x0682('0x1b')]?_0x388f21['options'][_0x0682('0x1f')]?_[_0x0682('0x20')](_0x388f21['options'][_0x0682('0x1f')],function(_0x575f84){return{'model':db[_0x575f84[_0x0682('0x21')]],'as':_0x575f84['as'],'attributes':_0x575f84['attributes'],'include':_0x575f84[_0x0682('0x1f')]?_[_0x0682('0x20')](_0x575f84[_0x0682('0x1f')],function(_0x2f0e9e){return{'model':db[_0x2f0e9e[_0x0682('0x21')]],'as':_0x2f0e9e['as'],'attributes':_0x2f0e9e[_0x0682('0x22')],'include':_0x2f0e9e[_0x0682('0x1f')]?_[_0x0682('0x20')](_0x2f0e9e[_0x0682('0x1f')],function(_0x99a563){return{'model':db[_0x99a563['model']],'as':_0x99a563['as'],'attributes':_0x99a563[_0x0682('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0682('0x10')](function(_0xc0a668){logger['info'](_0x0682('0x19'),_0x388f21);logger[_0x0682('0x23')](_0x0682('0x19'),_0x388f21,JSON[_0x0682('0x24')](_0xc0a668));_0x636a28(_0xc0a668);})[_0x0682('0x18')](function(_0x241051){logger[_0x0682('0x13')](_0x0682('0x19'),_0x241051[_0x0682('0x16')],_0x388f21);_0x1ad921(_0x13576f[_0x0682('0x13')](0x1f4,_0x241051[_0x0682('0x16')]));});});};exports['NotifyFaxAccount']=function(_0x4087a3,_0x362ce1,_0x131013){var _0x5f2ac7=this;return new Promise(function(_0xe9b6a2,_0x2ad46d){var _0x4ac012={'body':_0x4087a3['body'],'channel':_0x0682('0x25')};var _0x1aef99=[];var _0x114008=[];var _0x1ef69d={};return db['CmContact']['describe']()['then'](function(_0x4449a7){if(!_0x4449a7){throw new db[(_0x0682('0x26'))]['ValidationError'](_0x0682('0x27'));}_0x1aef99=_[_0x0682('0x28')](_[_0x0682('0x29')](_0x4449a7),['createdAt','updatedAt']);_0x114008=_['difference'](_[_0x0682('0x29')](_0x4449a7),['createdAt',_0x0682('0x2a'),_0x0682('0x2b'),_0x0682('0x2c')]);if(_0x4087a3[_0x0682('0x2d')]['id']){delete _0x4087a3[_0x0682('0x2d')]['id'];}if(_[_0x0682('0x2e')](_0x4087a3['body']['from'])){throw new db['Sequelize'][(_0x0682('0x2f'))]('from\x20is\x20mandatory');}if(_[_0x0682('0x2e')](_0x4087a3['body'][_0x0682('0x2d')])||_0x4087a3[_0x0682('0x2d')][_0x0682('0x2d')]===''){throw new db[(_0x0682('0x26'))][(_0x0682('0x2f'))](_0x0682('0x30'));}if(_[_0x0682('0x2e')](_0x4087a3['body'][_0x0682('0x31')])){throw new db[(_0x0682('0x26'))][(_0x0682('0x2f'))](_0x0682('0x32')+_0x114008);}if(!_[_0x0682('0x33')](_0x114008,_0x4087a3[_0x0682('0x2d')]['mapKey'])){throw new db['Sequelize'][(_0x0682('0x2f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x114008);}_0x1ef69d[_0x4087a3['body'][_0x0682('0x31')]]=_0x4087a3['body']['from'];})['then'](function(){return db['FaxAccount'][_0x0682('0x34')]({'where':{'id':_0x4087a3[_0x0682('0x35')]['id']},'include':[{'model':db[_0x0682('0x36')],'as':_0x0682('0x37'),'include':[{'model':db[_0x0682('0x38')],'as':_0x0682('0x39'),'where':_0x1ef69d,'limit':0x1,'order':[['updatedAt',_0x0682('0x3a')]]}]},{'model':db[_0x0682('0x3b')],'as':_0x0682('0x3c')}]});})[_0x0682('0x10')](function(_0x268c08){if(_0x268c08&&_0x268c08['List']){var _0x45bcae=_0x268c08[_0x0682('0x3d')]({'plain':!![]});_0x4ac012[_0x0682('0x35')]=_0x45bcae;_0x4ac012[_0x0682('0x3e')]=_0x45bcae[_0x0682('0x3c')];_0x4ac012[_0x0682('0x3f')]=_0x45bcae[_0x0682('0x37')];_0x4ac012[_0x0682('0x3e')]=_[_0x0682('0x40')](_0x4ac012[_0x0682('0x3e')],[_0x0682('0x41')],['asc']);if(_0x4ac012[_0x0682('0x35')][_0x0682('0x3c')]){delete _0x4ac012[_0x0682('0x35')][_0x0682('0x3c')];}if(_0x4ac012[_0x0682('0x35')]['List']&&_0x4ac012['account'][_0x0682('0x37')][_0x0682('0x39')][_0x0682('0x42')]){return _0x4ac012['account'][_0x0682('0x37')][_0x0682('0x39')][0x0];}var _0x48c83d=_[_0x0682('0xb')](_0x4087a3[_0x0682('0x2d')],{'firstName':_0x4087a3[_0x0682('0x2d')][_0x0682('0x43')],'ListId':_0x45bcae[_0x0682('0x2c')]});_0x48c83d[_0x4087a3[_0x0682('0x2d')]['mapKey']]=_0x4087a3['body'][_0x0682('0x43')];return db[_0x0682('0x38')][_0x0682('0x44')](_0x48c83d,{'fields':_0x1aef99,'raw':!![]});}})[_0x0682('0x10')](function(_0x2f350c){_0x4ac012[_0x0682('0x45')]=_0x2f350c;if(_0x2f350c){var _0x71fe2f={'ContactId':_0x2f350c['id'],'FaxAccountId':_0x4087a3[_0x0682('0x35')]['id'],'fax':_0x2f350c['fax']};return db['FaxInteraction']['find']({'where':{'ContactId':_0x2f350c['id'],'closed':![],'FaxAccountId':_0x4087a3[_0x0682('0x35')]['id']}})[_0x0682('0x10')](function(_0x27617b){if(_0x27617b){return[_0x27617b,![]];}return db[_0x0682('0x46')][_0x0682('0x44')](_0x71fe2f)[_0x0682('0x10')](function(_0x56a66b){return[_0x56a66b,!![]];});});}else{throw new Error(_0x0682('0x47'));}})[_0x0682('0x48')](function(_0x19a6c8,_0x17e60f){var _0x235d87=_0x19a6c8[_0x0682('0x3d')]({'plain':!![]});if(_0x17e60f){if(_0x4ac012[_0x0682('0x35')][_0x0682('0x49')]){_0x4ac012[_0x0682('0x3e')][_0x0682('0x4a')]({'id':0x0,'priority':_0x4ac012['applications'][_0x0682('0x42')]+0x1,'app':_0x0682('0x4b'),'appdata':_0x0682('0x4c'),'interval':_0x0682('0x4d')});}_0x235d87[_0x0682('0x4e')]=!![];}else{_0x235d87[_0x0682('0x4e')]=![];}_0x4ac012[_0x0682('0x4f')]=_0x235d87;return db[_0x0682('0x50')][_0x0682('0x44')]({'body':_0x4087a3['body'][_0x0682('0x2d')],'FaxAccountId':_0x4087a3['account']['id'],'FaxInteractionId':_0x19a6c8['id'],'direction':'in','ContactId':_0x19a6c8[_0x0682('0x51')],'AttachmentId':_0x4087a3[_0x0682('0x2d')][_0x0682('0x52')]});})['then'](function(_0x2d8e4f){_0x4ac012[_0x0682('0x16')]=_0x2d8e4f;if(_0x4ac012['interaction'][_0x0682('0x53')]){return db['User'][_0x0682('0x34')]({'attributes':['id',_0x0682('0x54')],'where':{'id':_0x4ac012[_0x0682('0x4f')][_0x0682('0x53')]}})[_0x0682('0x10')](function(_0x1fb89a){if(_0x1fb89a){_0x4ac012['applications'][_0x0682('0x55')]({'id':0x0,'priority':0x0,'app':_0x0682('0x56'),'appdata':_0x1fb89a[_0x0682('0x54')]+','+(_0x4ac012[_0x0682('0x35')][_0x0682('0x57')]||0xa),'interval':_0x0682('0x4d')});}return respondWithRpcPromise('Start','startRouting',_0x4ac012);});}return respondWithRpcPromise(_0x0682('0x58'),_0x0682('0x59'),_0x4ac012);})[_0x0682('0x10')](function(_0x18e9f3){_0xe9b6a2(_0x18e9f3);})[_0x0682('0x18')](function(_0x26f11d){_0x2ad46d(_0x5f2ac7[_0x0682('0x13')](0x1f4,_0x26f11d[_0x0682('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 05f7a52..d850b40 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 _0x3ccf=['./faxAccount.events','save','remove','register','length','faxAccount:'];(function(_0x304540,_0x110c59){var _0x25b2ba=function(_0x3612e6){while(--_0x3612e6){_0x304540['push'](_0x304540['shift']());}};_0x25b2ba(++_0x110c59);}(_0x3ccf,0x1f2));var _0xf3cc=function(_0x405653,_0x5fa229){_0x405653=_0x405653-0x0;var _0x35e819=_0x3ccf[_0x405653];return _0x35e819;};'use strict';var FaxAccountEvents=require(_0xf3cc('0x0'));var events=[_0xf3cc('0x1'),_0xf3cc('0x2'),'update'];function createListener(_0x58a580,_0x28b550){return function(_0xacc1ba){_0x28b550['emit'](_0x58a580,_0xacc1ba);};}function removeListener(_0x23bbf9,_0x35985e){return function(){FaxAccountEvents['removeListener'](_0x23bbf9,_0x35985e);};}exports[_0xf3cc('0x3')]=function(_0x362104){for(var _0x3e729f=0x0,_0x5844d8=events[_0xf3cc('0x4')];_0x3e729f<_0x5844d8;_0x3e729f++){var _0x12788d=events[_0x3e729f];var _0x13fc1c=createListener(_0xf3cc('0x5')+_0x12788d,_0x362104);FaxAccountEvents['on'](_0x12788d,_0x13fc1c);}}; \ No newline at end of file +var _0xf7e9=['update','remove'];(function(_0x3a4513,_0x2663ea){var _0x4bed7d=function(_0x30d979){while(--_0x30d979){_0x3a4513['push'](_0x3a4513['shift']());}};_0x4bed7d(++_0x2663ea);}(_0xf7e9,0x109));var _0x9f7e=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0xf7e9[_0x2338fa];return _0x42df9b;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0x9f7e('0x0'),_0x9f7e('0x1')];function createListener(_0x3977db,_0x2da958){return function(_0x53b0f4){_0x2da958['emit'](_0x3977db,_0x53b0f4);};}function removeListener(_0x5c995f,_0xec22fa){return function(){FaxAccountEvents['removeListener'](_0x5c995f,_0xec22fa);};}exports['register']=function(_0x4217dc){for(var _0x3dd1bb=0x0,_0x243bc4=events['length'];_0x3dd1bb<_0x243bc4;_0x3dd1bb++){var _0x9918f3=events[_0x3dd1bb];var _0x1fe035=createListener('faxAccount:'+_0x9918f3,_0x4217dc);FaxAccountEvents['on'](_0x9918f3,_0x1fe035);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 2a6eb70..04aa566 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(_0xf98b5,_0x5a438c){var _0x5d380a=function(_0x23ae73){while(--_0x23ae73){_0xf98b5['push'](_0xf98b5['shift']());}};_0x5d380a(++_0x5a438c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x2efd23,_0x44fcb2){var _0x232e4c=function(_0x1d5d3b){while(--_0x1d5d3b){_0x2efd23['push'](_0x2efd23['shift']());}};_0x232e4c(++_0x44fcb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 25def0c..96361e6 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 _0x97f4=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x4a1a6b,_0x380a31){var _0x339252=function(_0x190104){while(--_0x190104){_0x4a1a6b['push'](_0x4a1a6b['shift']());}};_0x339252(++_0x380a31);}(_0x97f4,0xc7));var _0x497f=function(_0x5747b9,_0xd5ad1){_0x5747b9=_0x5747b9-0x0;var _0x43018f=_0x97f4[_0x5747b9];return _0x43018f;};'use strict';var Sequelize=require(_0x497f('0x0'));module[_0x497f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x497f('0x2')],'allowNull':![],'defaultValue':_0x497f('0x3')},'appdata':{'type':Sequelize[_0x497f('0x4')]()},'description':{'type':Sequelize[_0x497f('0x2')]},'interval':{'type':Sequelize[_0x497f('0x2')],'defaultValue':_0x497f('0x5')}}; \ No newline at end of file +var _0x2b4b=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x2b4b,0x1bb));var _0xb2b4=function(_0xefcea9,_0x2a644a){_0xefcea9=_0xefcea9-0x0;var _0x36ec67=_0x2b4b[_0xefcea9];return _0x36ec67;};'use strict';var Sequelize=require(_0xb2b4('0x0'));module[_0xb2b4('0x1')]={'priority':{'type':Sequelize[_0xb2b4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb2b4('0x3')],'allowNull':![],'defaultValue':_0xb2b4('0x4')},'appdata':{'type':Sequelize[_0xb2b4('0x5')]()},'description':{'type':Sequelize[_0xb2b4('0x3')]},'interval':{'type':Sequelize[_0xb2b4('0x3')],'defaultValue':_0xb2b4('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e1e3772..3ea08a8 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 _0x73a9=['name','send','map','FaxApplication','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','length','options','find','create','body','params','rimraf','request-promise','moment','mustache','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x73a9,0x1be));var _0x973a=function(_0x38bad,_0x964b8f){_0x38bad=_0x38bad-0x0;var _0x130d7b=_0x73a9[_0x38bad];return _0x130d7b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x973a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x973a('0x1'));var moment=require(_0x973a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x973a('0x3'));var util=require('util');var path=require(_0x973a('0x4'));var sox=require('sox');var csv=require(_0x973a('0x5'));var ejs=require(_0x973a('0x6'));var fs=require('fs');var fs_extra=require(_0x973a('0x7'));var _=require('lodash');var squel=require(_0x973a('0x8'));var crypto=require(_0x973a('0x9'));var jsforce=require(_0x973a('0xa'));var deskjs=require(_0x973a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x973a('0xc'));var Papa=require('papaparse');var Redis=require(_0x973a('0xd'));var authService=require(_0x973a('0xe'));var qs=require(_0x973a('0xf'));var as=require(_0x973a('0x10'));var hardwareService=require(_0x973a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x973a('0x12'));var config=require(_0x973a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x973a('0x14'))['db'];function respondWithStatusCode(_0x5766ab,_0x2cf52a){_0x2cf52a=_0x2cf52a||0xcc;return function(_0x167fb6){if(_0x167fb6){return _0x5766ab[_0x973a('0x15')](_0x2cf52a);}return _0x5766ab[_0x973a('0x16')](_0x2cf52a)[_0x973a('0x17')]();};}function respondWithResult(_0x31d358,_0x12efa1){_0x12efa1=_0x12efa1||0xc8;return function(_0x115d42){if(_0x115d42){return _0x31d358[_0x973a('0x16')](_0x12efa1)['json'](_0x115d42);}};}function respondWithFilteredResult(_0xafa107,_0x30c9d8){return function(_0x2e2795){if(_0x2e2795){var _0x477703=typeof _0x30c9d8[_0x973a('0x18')]===_0x973a('0x19')&&typeof _0x30c9d8['limit']===_0x973a('0x19');var _0x23cce7=_0x2e2795[_0x973a('0x1a')];var _0x13bff1=_0x477703?0x0:_0x30c9d8[_0x973a('0x18')];var _0x2d706e=_0x477703?_0x2e2795[_0x973a('0x1a')]:_0x30c9d8[_0x973a('0x18')]+_0x30c9d8[_0x973a('0x1b')];var _0x28e21a;if(_0x2d706e>=_0x23cce7){_0x2d706e=_0x23cce7;_0x28e21a=0xc8;}else{_0x28e21a=0xce;}_0xafa107['status'](_0x28e21a);return _0xafa107[_0x973a('0x1c')](_0x973a('0x1d'),_0x13bff1+'-'+_0x2d706e+'/'+_0x23cce7)[_0x973a('0x1e')](_0x2e2795);}return null;};}function patchUpdates(_0x41889a){return function(_0x344bbb){try{jsonpatch['apply'](_0x344bbb,_0x41889a,!![]);}catch(_0x23e9fa){return BPromise[_0x973a('0x1f')](_0x23e9fa);}return _0x344bbb[_0x973a('0x20')]();};}function saveUpdates(_0x3ea65f,_0x15f131){return function(_0x7ebd9f){if(_0x7ebd9f){return _0x7ebd9f[_0x973a('0x21')](_0x3ea65f)[_0x973a('0x22')](function(_0x5f3dbf){return _0x5f3dbf;});}return null;};}function removeEntity(_0x420ad4,_0x5d7d0e){return function(_0x1d3a60){if(_0x1d3a60){return _0x1d3a60[_0x973a('0x23')]()['then'](function(){_0x420ad4[_0x973a('0x16')](0xcc)[_0x973a('0x17')]();});}};}function handleEntityNotFound(_0xee96bf,_0x21a101){return function(_0x1d7fcb){if(!_0x1d7fcb){_0xee96bf[_0x973a('0x15')](0x194);}return _0x1d7fcb;};}function handleError(_0x2414e5,_0x11b394){_0x11b394=_0x11b394||0x1f4;return function(_0x1cd524){logger[_0x973a('0x24')](_0x1cd524['stack']);if(_0x1cd524[_0x973a('0x25')]){delete _0x1cd524[_0x973a('0x25')];}_0x2414e5[_0x973a('0x16')](_0x11b394)[_0x973a('0x26')](_0x1cd524);};}exports['index']=function(_0x4dbcc3,_0x5e96c9){var _0x41d027={},_0x35b822={},_0x10d6e3={'count':0x0,'rows':[]};var _0x5d54e4=_[_0x973a('0x27')](db[_0x973a('0x28')][_0x973a('0x29')],function(_0x545cea){return{'name':_0x545cea['fieldName'],'type':_0x545cea['type'][_0x973a('0x2a')]};});_0x35b822['model']=_[_0x973a('0x27')](_0x5d54e4,_0x973a('0x25'));_0x35b822[_0x973a('0x2b')]=_[_0x973a('0x2c')](_0x4dbcc3[_0x973a('0x2b')]);_0x35b822[_0x973a('0x2d')]=_[_0x973a('0x2e')](_0x35b822['model'],_0x35b822['query']);_0x41d027[_0x973a('0x2f')]=_[_0x973a('0x2e')](_0x35b822[_0x973a('0x30')],qs['fields'](_0x4dbcc3[_0x973a('0x2b')][_0x973a('0x31')]));_0x41d027['attributes']=_0x41d027[_0x973a('0x2f')]['length']?_0x41d027[_0x973a('0x2f')]:_0x35b822['model'];if(!_0x4dbcc3[_0x973a('0x2b')][_0x973a('0x32')](_0x973a('0x33'))){_0x41d027[_0x973a('0x1b')]=qs['limit'](_0x4dbcc3['query'][_0x973a('0x1b')]);_0x41d027[_0x973a('0x18')]=qs[_0x973a('0x18')](_0x4dbcc3['query'][_0x973a('0x18')]);}_0x41d027[_0x973a('0x34')]=qs[_0x973a('0x35')](_0x4dbcc3['query'][_0x973a('0x35')]);_0x41d027[_0x973a('0x36')]=qs[_0x973a('0x2d')](_[_0x973a('0x37')](_0x4dbcc3[_0x973a('0x2b')],_0x35b822[_0x973a('0x2d')]),_0x5d54e4);if(_0x4dbcc3[_0x973a('0x2b')]['filter']){_0x41d027[_0x973a('0x36')]=_[_0x973a('0x38')](_0x41d027[_0x973a('0x36')],{'$or':_['map'](_0x5d54e4,function(_0x6191b2){if(_0x6191b2['type']!==_0x973a('0x39')){var _0x16bfd1={};_0x16bfd1[_0x6191b2[_0x973a('0x25')]]={'$like':'%'+_0x4dbcc3[_0x973a('0x2b')]['filter']+'%'};return _0x16bfd1;}})});}_0x41d027=_[_0x973a('0x38')]({},_0x41d027,_0x4dbcc3['options']);var _0x339f06={'where':_0x41d027[_0x973a('0x36')]};return db['FaxApplication']['count'](_0x339f06)['then'](function(_0x36e4dd){_0x10d6e3[_0x973a('0x1a')]=_0x36e4dd;if(_0x4dbcc3['query'][_0x973a('0x3a')]){_0x41d027[_0x973a('0x3b')]=[{'all':!![]}];}return db[_0x973a('0x28')][_0x973a('0x3c')](_0x41d027);})[_0x973a('0x22')](function(_0x345e9c){_0x10d6e3['rows']=_0x345e9c;return _0x10d6e3;})['then'](respondWithFilteredResult(_0x5e96c9,_0x41d027))[_0x973a('0x3d')](handleError(_0x5e96c9,null));};exports[_0x973a('0x3e')]=function(_0x353f95,_0x2834d0){var _0x5b0481={'raw':!![],'where':{'id':_0x353f95['params']['id']}},_0x4553fb={};_0x4553fb[_0x973a('0x30')]=_[_0x973a('0x2c')](db[_0x973a('0x28')]['rawAttributes']);_0x4553fb[_0x973a('0x2b')]=_[_0x973a('0x2c')](_0x353f95[_0x973a('0x2b')]);_0x4553fb[_0x973a('0x2d')]=_[_0x973a('0x2e')](_0x4553fb[_0x973a('0x30')],_0x4553fb[_0x973a('0x2b')]);_0x5b0481['attributes']=_[_0x973a('0x2e')](_0x4553fb[_0x973a('0x30')],qs[_0x973a('0x31')](_0x353f95[_0x973a('0x2b')][_0x973a('0x31')]));_0x5b0481[_0x973a('0x2f')]=_0x5b0481[_0x973a('0x2f')][_0x973a('0x3f')]?_0x5b0481['attributes']:_0x4553fb[_0x973a('0x30')];if(_0x353f95[_0x973a('0x2b')]['includeAll']){_0x5b0481[_0x973a('0x3b')]=[{'all':!![]}];}_0x5b0481=_[_0x973a('0x38')]({},_0x5b0481,_0x353f95[_0x973a('0x40')]);return db[_0x973a('0x28')][_0x973a('0x41')](_0x5b0481)[_0x973a('0x22')](handleEntityNotFound(_0x2834d0,null))[_0x973a('0x22')](respondWithResult(_0x2834d0,null))['catch'](handleError(_0x2834d0,null));};exports[_0x973a('0x42')]=function(_0x17a62e,_0x1f2385){return db[_0x973a('0x28')][_0x973a('0x42')](_0x17a62e[_0x973a('0x43')],{})[_0x973a('0x22')](respondWithResult(_0x1f2385,0xc9))[_0x973a('0x3d')](handleError(_0x1f2385,null));};exports[_0x973a('0x21')]=function(_0x23fccc,_0x2ae129){if(_0x23fccc[_0x973a('0x43')]['id']){delete _0x23fccc['body']['id'];}return db[_0x973a('0x28')][_0x973a('0x41')]({'where':{'id':_0x23fccc[_0x973a('0x44')]['id']}})[_0x973a('0x22')](handleEntityNotFound(_0x2ae129,null))[_0x973a('0x22')](saveUpdates(_0x23fccc[_0x973a('0x43')],null))['then'](respondWithResult(_0x2ae129,null))[_0x973a('0x3d')](handleError(_0x2ae129,null));};exports[_0x973a('0x23')]=function(_0x285afa,_0x573d78){return db['FaxApplication'][_0x973a('0x41')]({'where':{'id':_0x285afa[_0x973a('0x44')]['id']}})['then'](handleEntityNotFound(_0x573d78,null))[_0x973a('0x22')](removeEntity(_0x573d78,null))['catch'](handleError(_0x573d78,null));}; \ No newline at end of file +var _0x54d3=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x4c0266,_0x12014a){var _0x2139d1=function(_0xf2a49b){while(--_0xf2a49b){_0x4c0266['push'](_0x4c0266['shift']());}};_0x2139d1(++_0x12014a);}(_0x54d3,0x1d4));var _0x354d=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x54d3[_0x487b0c];return _0x1adbdc;};'use strict';var emlformat=require(_0x354d('0x0'));var rimraf=require(_0x354d('0x1'));var zipdir=require(_0x354d('0x2'));var jsonpatch=require(_0x354d('0x3'));var rp=require('request-promise');var moment=require(_0x354d('0x4'));var BPromise=require(_0x354d('0x5'));var Mustache=require('mustache');var util=require(_0x354d('0x6'));var path=require('path');var sox=require(_0x354d('0x7'));var csv=require(_0x354d('0x8'));var ejs=require(_0x354d('0x9'));var fs=require('fs');var fs_extra=require(_0x354d('0xa'));var _=require(_0x354d('0xb'));var squel=require(_0x354d('0xc'));var crypto=require(_0x354d('0xd'));var jsforce=require(_0x354d('0xe'));var deskjs=require(_0x354d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x354d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x354d('0x11'));var qs=require(_0x354d('0x12'));var as=require(_0x354d('0x13'));var hardwareService=require(_0x354d('0x14'));var logger=require(_0x354d('0x15'))(_0x354d('0x16'));var utils=require('../../config/utils');var config=require(_0x354d('0x17'));var licenseUtil=require(_0x354d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25694b,_0x21b72a){_0x21b72a=_0x21b72a||0xcc;return function(_0x35d32f){if(_0x35d32f){return _0x25694b[_0x354d('0x19')](_0x21b72a);}return _0x25694b[_0x354d('0x1a')](_0x21b72a)['end']();};}function respondWithResult(_0x4c4f64,_0x327665){_0x327665=_0x327665||0xc8;return function(_0x447ddb){if(_0x447ddb){return _0x4c4f64[_0x354d('0x1a')](_0x327665)[_0x354d('0x1b')](_0x447ddb);}};}function respondWithFilteredResult(_0x361493,_0x2974b2){return function(_0x113fee){if(_0x113fee){var _0x383ee6=typeof _0x2974b2[_0x354d('0x1c')]===_0x354d('0x1d')&&typeof _0x2974b2[_0x354d('0x1e')]==='undefined';var _0x40310c=_0x113fee['count'];var _0x1e744d=_0x383ee6?0x0:_0x2974b2['offset'];var _0x2639ae=_0x383ee6?_0x113fee[_0x354d('0x1f')]:_0x2974b2['offset']+_0x2974b2[_0x354d('0x1e')];var _0x31f2d9;if(_0x2639ae>=_0x40310c){_0x2639ae=_0x40310c;_0x31f2d9=0xc8;}else{_0x31f2d9=0xce;}_0x361493[_0x354d('0x1a')](_0x31f2d9);return _0x361493[_0x354d('0x20')](_0x354d('0x21'),_0x1e744d+'-'+_0x2639ae+'/'+_0x40310c)['json'](_0x113fee);}return null;};}function patchUpdates(_0x1dab88){return function(_0x1cc337){try{jsonpatch[_0x354d('0x22')](_0x1cc337,_0x1dab88,!![]);}catch(_0xae7f56){return BPromise[_0x354d('0x23')](_0xae7f56);}return _0x1cc337[_0x354d('0x24')]();};}function saveUpdates(_0x37a19a,_0x590d5c){return function(_0x17b7ae){if(_0x17b7ae){return _0x17b7ae[_0x354d('0x25')](_0x37a19a)[_0x354d('0x26')](function(_0x15c2e4){return _0x15c2e4;});}return null;};}function removeEntity(_0x3fb280,_0x3c72a2){return function(_0x3470b3){if(_0x3470b3){return _0x3470b3[_0x354d('0x27')]()[_0x354d('0x26')](function(){_0x3fb280[_0x354d('0x1a')](0xcc)[_0x354d('0x28')]();});}};}function handleEntityNotFound(_0xcf82ff,_0x3da4b2){return function(_0x3e7b55){if(!_0x3e7b55){_0xcf82ff[_0x354d('0x19')](0x194);}return _0x3e7b55;};}function handleError(_0x1e7fd6,_0x269a77){_0x269a77=_0x269a77||0x1f4;return function(_0x3aeaa0){logger[_0x354d('0x29')](_0x3aeaa0[_0x354d('0x2a')]);if(_0x3aeaa0[_0x354d('0x2b')]){delete _0x3aeaa0['name'];}_0x1e7fd6['status'](_0x269a77)[_0x354d('0x2c')](_0x3aeaa0);};}exports[_0x354d('0x2d')]=function(_0x4cc22e,_0x2da7ec){var _0x68d7f3={},_0x17fcd6={},_0x1d15f1={'count':0x0,'rows':[]};var _0x3c5d87=_['map'](db[_0x354d('0x2e')][_0x354d('0x2f')],function(_0x759998){return{'name':_0x759998[_0x354d('0x30')],'type':_0x759998['type'][_0x354d('0x31')]};});_0x17fcd6[_0x354d('0x32')]=_[_0x354d('0x33')](_0x3c5d87,'name');_0x17fcd6['query']=_[_0x354d('0x34')](_0x4cc22e[_0x354d('0x35')]);_0x17fcd6['filters']=_['intersection'](_0x17fcd6[_0x354d('0x32')],_0x17fcd6[_0x354d('0x35')]);_0x68d7f3[_0x354d('0x36')]=_[_0x354d('0x37')](_0x17fcd6['model'],qs[_0x354d('0x38')](_0x4cc22e[_0x354d('0x35')]['fields']));_0x68d7f3[_0x354d('0x36')]=_0x68d7f3[_0x354d('0x36')][_0x354d('0x39')]?_0x68d7f3['attributes']:_0x17fcd6[_0x354d('0x32')];if(!_0x4cc22e['query'][_0x354d('0x3a')](_0x354d('0x3b'))){_0x68d7f3['limit']=qs[_0x354d('0x1e')](_0x4cc22e[_0x354d('0x35')]['limit']);_0x68d7f3[_0x354d('0x1c')]=qs[_0x354d('0x1c')](_0x4cc22e[_0x354d('0x35')][_0x354d('0x1c')]);}_0x68d7f3['order']=qs[_0x354d('0x3c')](_0x4cc22e[_0x354d('0x35')][_0x354d('0x3c')]);_0x68d7f3['where']=qs[_0x354d('0x3d')](_['pick'](_0x4cc22e['query'],_0x17fcd6[_0x354d('0x3d')]),_0x3c5d87);if(_0x4cc22e[_0x354d('0x35')][_0x354d('0x3e')]){_0x68d7f3[_0x354d('0x3f')]=_[_0x354d('0x40')](_0x68d7f3[_0x354d('0x3f')],{'$or':_[_0x354d('0x33')](_0x3c5d87,function(_0x39ea47){if(_0x39ea47[_0x354d('0x41')]!==_0x354d('0x42')){var _0x1de8eb={};_0x1de8eb[_0x39ea47['name']]={'$like':'%'+_0x4cc22e['query'][_0x354d('0x3e')]+'%'};return _0x1de8eb;}})});}_0x68d7f3=_[_0x354d('0x40')]({},_0x68d7f3,_0x4cc22e[_0x354d('0x43')]);var _0x5ce1d0={'where':_0x68d7f3[_0x354d('0x3f')]};return db[_0x354d('0x2e')][_0x354d('0x1f')](_0x5ce1d0)[_0x354d('0x26')](function(_0x3e102f){_0x1d15f1[_0x354d('0x1f')]=_0x3e102f;if(_0x4cc22e['query'][_0x354d('0x44')]){_0x68d7f3[_0x354d('0x45')]=[{'all':!![]}];}return db['FaxApplication'][_0x354d('0x46')](_0x68d7f3);})['then'](function(_0x31f378){_0x1d15f1[_0x354d('0x47')]=_0x31f378;return _0x1d15f1;})[_0x354d('0x26')](respondWithFilteredResult(_0x2da7ec,_0x68d7f3))[_0x354d('0x48')](handleError(_0x2da7ec,null));};exports[_0x354d('0x49')]=function(_0x353971,_0xd5f2ed){var _0x1b637c={'raw':!![],'where':{'id':_0x353971[_0x354d('0x4a')]['id']}},_0x2a5563={};_0x2a5563[_0x354d('0x32')]=_[_0x354d('0x34')](db[_0x354d('0x2e')][_0x354d('0x2f')]);_0x2a5563[_0x354d('0x35')]=_[_0x354d('0x34')](_0x353971[_0x354d('0x35')]);_0x2a5563[_0x354d('0x3d')]=_[_0x354d('0x37')](_0x2a5563[_0x354d('0x32')],_0x2a5563['query']);_0x1b637c['attributes']=_[_0x354d('0x37')](_0x2a5563[_0x354d('0x32')],qs[_0x354d('0x38')](_0x353971[_0x354d('0x35')][_0x354d('0x38')]));_0x1b637c['attributes']=_0x1b637c['attributes'][_0x354d('0x39')]?_0x1b637c['attributes']:_0x2a5563[_0x354d('0x32')];if(_0x353971[_0x354d('0x35')][_0x354d('0x44')]){_0x1b637c['include']=[{'all':!![]}];}_0x1b637c=_[_0x354d('0x40')]({},_0x1b637c,_0x353971[_0x354d('0x43')]);return db[_0x354d('0x2e')][_0x354d('0x4b')](_0x1b637c)[_0x354d('0x26')](handleEntityNotFound(_0xd5f2ed,null))[_0x354d('0x26')](respondWithResult(_0xd5f2ed,null))[_0x354d('0x48')](handleError(_0xd5f2ed,null));};exports[_0x354d('0x4c')]=function(_0x53a23b,_0x895ff2){return db[_0x354d('0x2e')]['create'](_0x53a23b[_0x354d('0x4d')],{})['then'](respondWithResult(_0x895ff2,0xc9))[_0x354d('0x48')](handleError(_0x895ff2,null));};exports['update']=function(_0x797786,_0x214ca){if(_0x797786[_0x354d('0x4d')]['id']){delete _0x797786[_0x354d('0x4d')]['id'];}return db[_0x354d('0x2e')]['find']({'where':{'id':_0x797786[_0x354d('0x4a')]['id']}})[_0x354d('0x26')](handleEntityNotFound(_0x214ca,null))[_0x354d('0x26')](saveUpdates(_0x797786['body'],null))[_0x354d('0x26')](respondWithResult(_0x214ca,null))[_0x354d('0x48')](handleError(_0x214ca,null));};exports[_0x354d('0x27')]=function(_0x3c7120,_0x43ec23){return db[_0x354d('0x2e')][_0x354d('0x4b')]({'where':{'id':_0x3c7120[_0x354d('0x4a')]['id']}})[_0x354d('0x26')](handleEntityNotFound(_0x43ec23,null))[_0x354d('0x26')](removeEntity(_0x43ec23,null))[_0x354d('0x48')](handleError(_0x43ec23,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 7c125ba..23e6138 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 _0x0b7a=['moment','path','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x397a30,_0x185792){var _0x3db183=function(_0x58e8a2){while(--_0x58e8a2){_0x397a30['push'](_0x397a30['shift']());}};_0x3db183(++_0x185792);}(_0x0b7a,0x1ac));var _0xa0b7=function(_0x39bcde,_0x383809){_0x39bcde=_0x39bcde-0x0;var _0x287523=_0x0b7a[_0x39bcde];return _0x287523;};'use strict';var _=require('lodash');var util=require(_0xa0b7('0x0'));var logger=require(_0xa0b7('0x1'))('api');var moment=require(_0xa0b7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0b7('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa0b7('0x4'));module[_0xa0b7('0x5')]=function(_0xe8cc91,_0x2e9c6d){return _0xe8cc91['define'](_0xa0b7('0x6'),attributes,{'tableName':_0xa0b7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa0b7('0x8'),'collate':_0xa0b7('0x9')});}; \ No newline at end of file +var _0xc3c4=['./faxApplication.attributes','exports','define','fax_applications','util','../../config/logger','api','moment','path','rimraf'];(function(_0xea91ce,_0x44e887){var _0x142d27=function(_0x3970d3){while(--_0x3970d3){_0xea91ce['push'](_0xea91ce['shift']());}};_0x142d27(++_0x44e887);}(_0xc3c4,0x126));var _0x4c3c=function(_0x5d3da9,_0x5a4656){_0x5d3da9=_0x5d3da9-0x0;var _0x4d6dca=_0xc3c4[_0x5d3da9];return _0x4d6dca;};'use strict';var _=require('lodash');var util=require(_0x4c3c('0x0'));var logger=require(_0x4c3c('0x1'))(_0x4c3c('0x2'));var moment=require(_0x4c3c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c3c('0x4'));var rimraf=require(_0x4c3c('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c3c('0x6'));module[_0x4c3c('0x7')]=function(_0x11f22d,_0x1785b7){return _0x11f22d[_0x4c3c('0x8')]('FaxApplication',attributes,{'tableName':_0x4c3c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5dd4457..af16ae9 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 _0xf4c0=['catch','lodash','util','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxApplication','FaxApplication','options','raw','where'];(function(_0x38691f,_0x5a0aaa){var _0x59c057=function(_0x5886ce){while(--_0x5886ce){_0x38691f['push'](_0x38691f['shift']());}};_0x59c057(++_0x5a0aaa);}(_0xf4c0,0x1aa));var _0x0f4c=function(_0x459f9e,_0x298a44){_0x459f9e=_0x459f9e-0x0;var _0x3d53cf=_0xf4c0[_0x459f9e];return _0x3d53cf;};'use strict';var _=require(_0x0f4c('0x0'));var util=require(_0x0f4c('0x1'));var moment=require(_0x0f4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0f4c('0x4'))(_0x0f4c('0x5'));var config=require('../../config/environment');var jayson=require(_0x0f4c('0x6'));var client=jayson[_0x0f4c('0x7')][_0x0f4c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23a1c2,_0x3615cf,_0x11b72d){return new BPromise(function(_0x25a8b5,_0x4eb48d){return client[_0x0f4c('0x9')](_0x23a1c2,_0x11b72d)[_0x0f4c('0xa')](function(_0x4daf48){logger[_0x0f4c('0xb')](_0x0f4c('0xc'),_0x3615cf,_0x0f4c('0xd'));logger['debug'](_0x0f4c('0xe'),_0x3615cf,_0x0f4c('0xd'),JSON['stringify'](_0x4daf48));if(_0x4daf48[_0x0f4c('0xf')]){if(_0x4daf48[_0x0f4c('0xf')][_0x0f4c('0x10')]===0x1f4){logger[_0x0f4c('0xf')]('FaxApplication,\x20%s,\x20%s',_0x3615cf,_0x4daf48['error'][_0x0f4c('0x11')]);return _0x4eb48d(_0x4daf48[_0x0f4c('0xf')][_0x0f4c('0x11')]);}logger[_0x0f4c('0xf')](_0x0f4c('0xc'),_0x3615cf,_0x4daf48[_0x0f4c('0xf')][_0x0f4c('0x11')]);return _0x25a8b5(_0x4daf48[_0x0f4c('0xf')][_0x0f4c('0x11')]);}else{logger[_0x0f4c('0xb')](_0x0f4c('0xc'),_0x3615cf,_0x0f4c('0xd'));_0x25a8b5(_0x4daf48[_0x0f4c('0x12')][_0x0f4c('0x11')]);}})['catch'](function(_0x22a8af){logger[_0x0f4c('0xf')]('FaxApplication,\x20%s,\x20%s',_0x3615cf,_0x22a8af);_0x4eb48d(_0x22a8af);});});}exports[_0x0f4c('0x13')]=function(_0x438a88){var _0x53e9cb=this;return new Promise(function(_0x17f0f9,_0x76f855){return db[_0x0f4c('0x14')]['update'](_0x438a88['body'],{'raw':_0x438a88['options']?_0x438a88[_0x0f4c('0x15')][_0x0f4c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x438a88['options']?_0x438a88[_0x0f4c('0x15')][_0x0f4c('0x17')]||null:null,'attributes':_0x438a88[_0x0f4c('0x15')]?_0x438a88[_0x0f4c('0x15')]['attributes']||null:null,'limit':_0x438a88['options']?_0x438a88[_0x0f4c('0x15')]['limit']||null:null})[_0x0f4c('0xa')](function(_0x3adfa9){logger[_0x0f4c('0xb')](_0x0f4c('0x13'),_0x438a88);logger['debug'](_0x0f4c('0x13'),_0x438a88,JSON['stringify'](_0x3adfa9));_0x17f0f9(_0x3adfa9);})[_0x0f4c('0x18')](function(_0x1b4a89){logger[_0x0f4c('0xf')]('UpdateFaxApplication',_0x1b4a89['message'],_0x438a88);_0x76f855(_0x53e9cb['error'](0x1f4,_0x1b4a89[_0x0f4c('0x11')]));});});}; \ No newline at end of file +var _0x2c7b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','update','body','options','raw','attributes','limit','UpdateFaxApplication','lodash','util','bluebird','randomstring'];(function(_0x44d0b5,_0x57122f){var _0x325e20=function(_0x350e8e){while(--_0x350e8e){_0x44d0b5['push'](_0x44d0b5['shift']());}};_0x325e20(++_0x57122f);}(_0x2c7b,0x1af));var _0xb2c7=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x2c7b[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xb2c7('0x0'));var util=require(_0xb2c7('0x1'));var moment=require('moment');var BPromise=require(_0xb2c7('0x2'));var rs=require(_0xb2c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb2c7('0x4'));var logger=require(_0xb2c7('0x5'))(_0xb2c7('0x6'));var config=require(_0xb2c7('0x7'));var jayson=require(_0xb2c7('0x8'));var client=jayson['client'][_0xb2c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27d6f,_0x3bd2c7,_0x50f7b5){return new BPromise(function(_0x1076c0,_0x55f679){return client[_0xb2c7('0xa')](_0x27d6f,_0x50f7b5)[_0xb2c7('0xb')](function(_0x364572){logger['info'](_0xb2c7('0xc'),_0x3bd2c7,_0xb2c7('0xd'));logger[_0xb2c7('0xe')](_0xb2c7('0xf'),_0x3bd2c7,_0xb2c7('0xd'),JSON[_0xb2c7('0x10')](_0x364572));if(_0x364572[_0xb2c7('0x11')]){if(_0x364572['error'][_0xb2c7('0x12')]===0x1f4){logger[_0xb2c7('0x11')](_0xb2c7('0xc'),_0x3bd2c7,_0x364572[_0xb2c7('0x11')][_0xb2c7('0x13')]);return _0x55f679(_0x364572['error']['message']);}logger['error'](_0xb2c7('0xc'),_0x3bd2c7,_0x364572['error'][_0xb2c7('0x13')]);return _0x1076c0(_0x364572[_0xb2c7('0x11')][_0xb2c7('0x13')]);}else{logger[_0xb2c7('0x14')]('FaxApplication,\x20%s,\x20%s',_0x3bd2c7,'request\x20sent');_0x1076c0(_0x364572['result'][_0xb2c7('0x13')]);}})[_0xb2c7('0x15')](function(_0x56729f){logger[_0xb2c7('0x11')](_0xb2c7('0xc'),_0x3bd2c7,_0x56729f);_0x55f679(_0x56729f);});});}exports['UpdateFaxApplication']=function(_0x2cd409){var _0x1ba79d=this;return new Promise(function(_0x41b5f9,_0xbc55df){return db['FaxApplication'][_0xb2c7('0x16')](_0x2cd409[_0xb2c7('0x17')],{'raw':_0x2cd409[_0xb2c7('0x18')]?_0x2cd409[_0xb2c7('0x18')][_0xb2c7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cd409[_0xb2c7('0x18')]?_0x2cd409[_0xb2c7('0x18')]['where']||null:null,'attributes':_0x2cd409[_0xb2c7('0x18')]?_0x2cd409['options'][_0xb2c7('0x1a')]||null:null,'limit':_0x2cd409[_0xb2c7('0x18')]?_0x2cd409[_0xb2c7('0x18')][_0xb2c7('0x1b')]||null:null})[_0xb2c7('0xb')](function(_0x25dd46){logger['info']('UpdateFaxApplication',_0x2cd409);logger['debug'](_0xb2c7('0x1c'),_0x2cd409,JSON['stringify'](_0x25dd46));_0x41b5f9(_0x25dd46);})[_0xb2c7('0x15')](function(_0x21516f){logger['error'](_0xb2c7('0x1c'),_0x21516f[_0xb2c7('0x13')],_0x2cd409);_0xbc55df(_0x1ba79d[_0xb2c7('0x11')](0x1f4,_0x21516f[_0xb2c7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 68e5aa3..d2cdc89 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x47aded,_0xb76625){var _0x505e9a=function(_0x68696d){while(--_0x68696d){_0x47aded['push'](_0x47aded['shift']());}};_0x505e9a(++_0xb76625);}(_0xda3f,0xec));var _0xfda3=function(_0x303832,_0x228dac){_0x303832=_0x303832-0x0;var _0x16d348=_0xda3f[_0x303832];return _0x16d348;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./faxApplication.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x80ed=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x80ed,0x11c));var _0xd80e=function(_0x35e05f,_0x2d6122){_0x35e05f=_0x35e05f-0x0;var _0x13591d=_0x80ed[_0x35e05f];return _0x13591d;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./faxApplication.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0xd')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0xf')](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x10')]);router['delete'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);module[_0xd80e('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 b2f3a48..46d4827 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 _0x0648=['BOOLEAN','STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x4bfab7,_0x1f92fc){var _0x232fd7=function(_0x2fb73c){while(--_0x2fb73c){_0x4bfab7['push'](_0x4bfab7['shift']());}};_0x232fd7(++_0x1f92fc);}(_0x0648,0x1e8));var _0x8064=function(_0x302f41,_0x19541b){_0x302f41=_0x302f41-0x0;var _0x23344a=_0x0648[_0x302f41];return _0x23344a;};'use strict';var Sequelize=require(_0x8064('0x0'));module[_0x8064('0x1')]={'closed':{'type':Sequelize[_0x8064('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8064('0x3')]},'secondDisposition':{'type':Sequelize[_0x8064('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8064('0x4')]},'fax':{'type':Sequelize[_0x8064('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8064('0x5')]('in',_0x8064('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8064('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8064('0x5')]('in',_0x8064('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5727=['out','DATE','ENUM','sequelize','exports','BOOLEAN','STRING'];(function(_0x2f769e,_0x33e588){var _0x89d8ba=function(_0x3af8c3){while(--_0x3af8c3){_0x2f769e['push'](_0x2f769e['shift']());}};_0x89d8ba(++_0x33e588);}(_0x5727,0xb2));var _0x7572=function(_0x144c51,_0x9327f0){_0x144c51=_0x144c51-0x0;var _0x24653f=_0x5727[_0x144c51];return _0x24653f;};'use strict';var Sequelize=require(_0x7572('0x0'));module[_0x7572('0x1')]={'closed':{'type':Sequelize[_0x7572('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7572('0x3')]},'secondDisposition':{'type':Sequelize[_0x7572('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7572('0x3')]},'note':{'type':Sequelize[_0x7572('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x7572('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7572('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7572('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x7572('0x6')]('in',_0x7572('0x4')),'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 8dda1ba..810d0db 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 _0x7852=['ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','i.*','c.firstName','Contact.firstName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','all','rows','show','params','intersection','fields','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','rawAttributes','merge','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','then','error','stack','name','Users','fullname','TagIds','Tags','forEach','push','catch','index','FaxInteraction','type','key','model','map','query','keys','attributes','length','nolimit','order','sort','where','filters','pick','field','color','from','tools_tags','select','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x358201,_0x5f4744){var _0x425b73=function(_0x5067b9){while(--_0x5067b9){_0x358201['push'](_0x358201['shift']());}};_0x425b73(++_0x5f4744);}(_0x7852,0x74));var _0x2785=function(_0x5f12c5,_0x2a1bfe){_0x5f12c5=_0x5f12c5-0x0;var _0x16d5e0=_0x7852[_0x5f12c5];return _0x16d5e0;};'use strict';var emlformat=require(_0x2785('0x0'));var rimraf=require(_0x2785('0x1'));var zipdir=require(_0x2785('0x2'));var jsonpatch=require(_0x2785('0x3'));var rp=require('request-promise');var moment=require(_0x2785('0x4'));var BPromise=require(_0x2785('0x5'));var Mustache=require('mustache');var util=require(_0x2785('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2785('0x7'));var ejs=require(_0x2785('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2785('0x9'));var squel=require(_0x2785('0xa'));var crypto=require(_0x2785('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2785('0xc'));var toCsv=require(_0x2785('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2785('0xd'));var authService=require(_0x2785('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2785('0xf'));var hardwareService=require(_0x2785('0x10'));var logger=require(_0x2785('0x11'))(_0x2785('0x12'));var utils=require(_0x2785('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2785('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2785('0x15')](config[_0x2785('0x16')],{'host':_0x2785('0x17'),'port':0x18eb});var socket=require(_0x2785('0x18'))(new Redis(config[_0x2785('0x16')]));require(_0x2785('0x19'))[_0x2785('0x1a')](socket);function respondWithStatusCode(_0xba9a4a,_0x323f42){_0x323f42=_0x323f42||0xcc;return function(_0x496ffc){if(_0x496ffc){return _0xba9a4a[_0x2785('0x1b')](_0x323f42);}return _0xba9a4a[_0x2785('0x1c')](_0x323f42)[_0x2785('0x1d')]();};}function respondWithResult(_0xeff26e,_0x868873){_0x868873=_0x868873||0xc8;return function(_0x5bfc30){if(_0x5bfc30){return _0xeff26e[_0x2785('0x1c')](_0x868873)[_0x2785('0x1e')](_0x5bfc30);}};}function respondWithFilteredResult(_0x375243,_0x238f3f){return function(_0x5920be){if(_0x5920be){var _0x24b71c=typeof _0x238f3f[_0x2785('0x1f')]===_0x2785('0x20')&&typeof _0x238f3f[_0x2785('0x21')]==='undefined';var _0x1bd537=_0x5920be[_0x2785('0x22')];var _0x353ce3=_0x24b71c?0x0:_0x238f3f[_0x2785('0x1f')];var _0x2dd739=_0x24b71c?_0x5920be[_0x2785('0x22')]:_0x238f3f[_0x2785('0x1f')]+_0x238f3f['limit'];var _0x33fad0;if(_0x2dd739>=_0x1bd537){_0x2dd739=_0x1bd537;_0x33fad0=0xc8;}else{_0x33fad0=0xce;}_0x375243['status'](_0x33fad0);return _0x375243[_0x2785('0x23')]('Content-Range',_0x353ce3+'-'+_0x2dd739+'/'+_0x1bd537)[_0x2785('0x1e')](_0x5920be);}return null;};}function patchUpdates(_0x363fb8){return function(_0x1217c7){try{jsonpatch['apply'](_0x1217c7,_0x363fb8,!![]);}catch(_0x5ad8ab){return BPromise[_0x2785('0x24')](_0x5ad8ab);}return _0x1217c7['save']();};}function saveUpdates(_0x9edd72,_0x402368){return function(_0x4e2e38){if(_0x4e2e38){return _0x4e2e38[_0x2785('0x25')](_0x9edd72)['then'](function(_0x1cfacf){return _0x1cfacf;});}return null;};}function removeEntity(_0x56e758,_0x4baf06){return function(_0x2ba59b){if(_0x2ba59b){return _0x2ba59b[_0x2785('0x26')]()[_0x2785('0x27')](function(){_0x56e758[_0x2785('0x1c')](0xcc)[_0x2785('0x1d')]();});}};}function handleEntityNotFound(_0x4ca855,_0x18767e){return function(_0x2747b5){if(!_0x2747b5){_0x4ca855[_0x2785('0x1b')](0x194);}return _0x2747b5;};}function handleError(_0x476a9f,_0x144b2c){_0x144b2c=_0x144b2c||0x1f4;return function(_0x4d488d){logger[_0x2785('0x28')](_0x4d488d[_0x2785('0x29')]);if(_0x4d488d[_0x2785('0x2a')]){delete _0x4d488d[_0x2785('0x2a')];}_0x476a9f[_0x2785('0x1c')](_0x144b2c)['send'](_0x4d488d);};}function getInteractionUsers(_0x5bbffb,_0x204fc9){return new BPromise(function(_0x14ab87,_0x2661e2){try{if(_0x204fc9[_0x5bbffb['id']]){_0x5bbffb[_0x2785('0x2b')]=_['map'](_0x204fc9[_0x5bbffb['id']],function(_0x46350c){return{'id':_0x46350c['id'],'fullname':_0x46350c[_0x2785('0x2c')]};});}}catch(_0x1d8557){_0x2661e2(_0x1d8557);}_0x14ab87(_0x5bbffb);});}function getInteractionTags(_0x54957b,_0x104e8e){return new BPromise(function(_0xc179f,_0x1436eb){try{if(_0x54957b[_0x2785('0x2d')]){_0x54957b[_0x2785('0x2e')]=[];_0x54957b[_0x2785('0x2d')]['split'](',')[_0x2785('0x2f')](function(_0x4750c6){_0x54957b['Tags'][_0x2785('0x30')](_0x104e8e[_0x4750c6]);});}delete _0x54957b[_0x2785('0x2d')];}catch(_0x3a9707){_0x1436eb(_0x3a9707);}_0xc179f(_0x54957b);});}function updateFaxInteraction(_0x5f2b95,_0x58dc0a,_0x4eb595){return new BPromise(function(_0x29247d,_0x2f7f03){return getInteractionUsers(_0x5f2b95,_0x4eb595)[_0x2785('0x27')](function(_0x4a322c){return getInteractionTags(_0x4a322c,_0x58dc0a);})[_0x2785('0x27')](function(_0x1cbe4c){_0x29247d(_0x1cbe4c);})[_0x2785('0x31')](function(_0x507125){_0x2f7f03(_0x507125);});});}exports[_0x2785('0x32')]=function(_0x48cd4a,_0x157dc0){var _0x2d5b76={},_0x17db9f={},_0x395552={'count':0x0,'rows':[]};var _0x18c50f=_['map'](db[_0x2785('0x33')]['rawAttributes'],function(_0x2a9c2a){return{'name':_0x2a9c2a['fieldName'],'type':_0x2a9c2a[_0x2785('0x34')][_0x2785('0x35')]};});_0x17db9f[_0x2785('0x36')]=_[_0x2785('0x37')](_0x18c50f,_0x2785('0x2a'));_0x17db9f[_0x2785('0x38')]=_[_0x2785('0x39')](_0x48cd4a['query']);_0x17db9f['filters']=_['intersection'](_0x17db9f[_0x2785('0x36')],_0x17db9f[_0x2785('0x38')]);_0x2d5b76[_0x2785('0x3a')]=_['intersection'](_0x17db9f['model'],qs['fields'](_0x48cd4a['query']['fields']));_0x2d5b76[_0x2785('0x3a')]=_0x2d5b76['attributes'][_0x2785('0x3b')]?_0x2d5b76[_0x2785('0x3a')]:_0x17db9f[_0x2785('0x36')];if(!_0x48cd4a['query']['hasOwnProperty'](_0x2785('0x3c'))){_0x2d5b76[_0x2785('0x21')]=qs[_0x2785('0x21')](_0x48cd4a[_0x2785('0x38')][_0x2785('0x21')]);_0x2d5b76[_0x2785('0x1f')]=qs['offset'](_0x48cd4a[_0x2785('0x38')][_0x2785('0x1f')]);}_0x2d5b76[_0x2785('0x3d')]=qs[_0x2785('0x3e')](_0x48cd4a[_0x2785('0x38')]['sort']);_0x2d5b76[_0x2785('0x3f')]=qs[_0x2785('0x40')](_[_0x2785('0x41')](_0x48cd4a[_0x2785('0x38')],_0x17db9f['filters']),_0x18c50f);var _0x5cc2cc=[];var _0x186838=squel['select']()[_0x2785('0x42')]('id')['field']('name')[_0x2785('0x42')](_0x2785('0x43'))[_0x2785('0x44')](_0x2785('0x45'));var _0x57e025=squel[_0x2785('0x46')]()[_0x2785('0x42')]('u.id')[_0x2785('0x42')]('u.fullname')[_0x2785('0x42')](_0x2785('0x47'))[_0x2785('0x44')](_0x2785('0x48'),'ui')[_0x2785('0x49')](_0x2785('0x4a'),'u',_0x2785('0x4b'));var _0x4d3417=squel[_0x2785('0x46')]()[_0x2785('0x44')](_0x2785('0x4c'),'i')[_0x2785('0x49')](_0x2785('0x4d'),'c',_0x2785('0x4e'))[_0x2785('0x49')](_0x2785('0x4a'),'o',_0x2785('0x4f'))[_0x2785('0x49')]('fax_accounts','a',_0x2785('0x50'))['left_join'](_0x2785('0x51'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x2785('0x49')](_0x2785('0x52'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x2785('0x49')](_0x2785('0x45'),'t',_0x2785('0x53'));var _0x4d3f2c=squel['expr']();var _0x4ca438=[];var _0x2e22d3=squel[_0x2785('0x54')]();var _0x1e6526;if(_0x48cd4a[_0x2785('0x38')][_0x2785('0x55')]){_0x1e6526=as[_0x2785('0x56')](_0x48cd4a['query'][_0x2785('0x55')]);var _0x59ce74=_0x1e6526[_0x2785('0x57')];for(var _0x4241c6=0x0;_0x4241c6<_0x1e6526[_0x2785('0x58')]['length'];_0x4241c6++){var _0x5bc7e3=_0x1e6526[_0x2785('0x58')][_0x4241c6];var _0x1393b0='i';var _0x46595f=_[_0x2785('0x59')](_0x18c50f,[_0x2785('0x2a'),_0x5bc7e3['field']]);if(!_0x46595f){switch(_0x5bc7e3[_0x2785('0x42')]){case _0x2785('0x5a'):if(_0x5bc7e3[_0x2785('0x5b')]==0x1){_0x4d3417[_0x2785('0x5c')]('`'+_0x5bc7e3['field']+'`\x20=\x200');}else{_0x4d3417[_0x2785('0x5c')]('`'+_0x5bc7e3[_0x2785('0x42')]+'`\x20>\x200');}break;case _0x2785('0x5d'):if(_0x5bc7e3[_0x2785('0x5e')]===_0x2785('0x5f')){if(_0x5bc7e3[_0x2785('0x5b')][_0x2785('0x60')]('\x20')[_0x2785('0x3b')]>0x1){_0x4d3f2c[_0x59ce74](_0x2785('0x61'),qs[_0x2785('0x62')](_0x5bc7e3[_0x2785('0x5b')]),null);}else{var _0x581c33='%'+_0x5bc7e3['value']+'%';_0x4d3f2c[_0x59ce74](_0x2785('0x63'),_0x581c33,_0x581c33,_0x581c33);}}else{_0x46595f=_['find'](_0x18c50f,[_0x2785('0x2a'),_0x2785('0x64')]);_0x5bc7e3[_0x2785('0x42')]=_0x2785('0x64');_0x7a4ce4=as[_0x2785('0x65')](_0x1393b0,_0x46595f[_0x2785('0x34')],_0x5bc7e3);_0x4d3f2c[_0x59ce74](_0x7a4ce4[_0x2785('0x66')],_0x7a4ce4[_0x2785('0x5b')][_0x2785('0x67')],_0x7a4ce4[_0x2785('0x5b')]['end']);}break;case _0x2785('0x68'):var _0x2f4580=_0x5bc7e3['value'][_0x2785('0x60')](',')[_0x2785('0x37')](function(_0x821e9e){return Number(_0x821e9e);});_0x2f4580['forEach'](function(_0x3c7a67){_0x2e22d3['or'](_0x2785('0x69'),'%,'+_0x3c7a67+',%');});_0x4ca438=_[_0x2785('0x6a')](_0x4ca438,_0x2f4580);break;case'User':if(_0x5bc7e3[_0x2785('0x5e')]===_0x2785('0x5f')){_0x4d3f2c[_0x59ce74]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5bc7e3[_0x2785('0x5b')]+'%',null);}else{_0x46595f=_[_0x2785('0x59')](_0x18c50f,[_0x2785('0x2a'),_0x2785('0x6b')]);_0x5bc7e3[_0x2785('0x42')]=_0x2785('0x6b');_0x7a4ce4=as[_0x2785('0x65')](_0x1393b0,_0x46595f[_0x2785('0x34')],_0x5bc7e3);_0x4d3f2c[_0x59ce74](_0x7a4ce4[_0x2785('0x66')],_0x7a4ce4[_0x2785('0x5b')]['start'],_0x7a4ce4[_0x2785('0x5b')]['end']);}break;case _0x2785('0x6c'):_0x7a4ce4=as[_0x2785('0x65')]('me',null,_0x5bc7e3);_0x4d3f2c[_0x59ce74](_0x7a4ce4['text'],_0x7a4ce4[_0x2785('0x5b')]['start'],_0x7a4ce4[_0x2785('0x5b')][_0x2785('0x1d')]);break;}}else{var _0x7a4ce4=as[_0x2785('0x65')](_0x1393b0,_0x46595f[_0x2785('0x34')],_0x5bc7e3);_0x4d3f2c[_0x59ce74](_0x7a4ce4[_0x2785('0x66')],_0x7a4ce4[_0x2785('0x5b')][_0x2785('0x67')],_0x7a4ce4[_0x2785('0x5b')]['end']);}}}else{var _0x5bc359=_(_0x48cd4a[_0x2785('0x38')])[_0x2785('0x39')]()[_0x2785('0x37')](function(_0x97c5d4){return _[_0x2785('0x6d')](_0x18c50f,[_0x2785('0x2a'),_0x97c5d4])?_0x97c5d4:undefined;})[_0x2785('0x6e')]()[_0x2785('0x5b')]();if(!_[_0x2785('0x6f')](_0x5bc359)){_0x5bc359[_0x2785('0x2f')](function(_0x3ced9f){if(_0x3ced9f===_0x2785('0x70')){_0x4d3417[_0x2785('0x3f')](_0x2785('0x71'),[][_0x2785('0x72')](_0x48cd4a[_0x2785('0x38')][_0x3ced9f]));}else if(_0x3ced9f===_0x2785('0x73')){var _0x3c1923=JSON['parse'](_0x48cd4a[_0x2785('0x38')][_0x3ced9f])[_0x2785('0x74')];var _0x31cb8f=JSON[_0x2785('0x75')](_0x48cd4a[_0x2785('0x38')][_0x3ced9f])[_0x2785('0x76')];_0x4d3417['where'](_0x2785('0x77'),_0x3c1923,_0x31cb8f);}else{if(_0x48cd4a[_0x2785('0x38')][_0x3ced9f]===_0x2785('0x78')){_0x4d3417[_0x2785('0x3f')]('i.'+_0x3ced9f+_0x2785('0x79'));}else{_0x4d3417[_0x2785('0x3f')]('i.'+_0x3ced9f+_0x2785('0x7a'),_0x48cd4a[_0x2785('0x38')][_0x3ced9f]);}}});}if(_0x48cd4a[_0x2785('0x38')][_0x2785('0x7b')]){if(_0x48cd4a[_0x2785('0x38')][_0x2785('0x7b')]==0x1){_0x4d3417[_0x2785('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x4d3417[_0x2785('0x5c')](_0x2785('0x7c'));}}if(_0x48cd4a[_0x2785('0x38')][_0x2785('0x7d')]){_0x4ca438=_[_0x2785('0x7e')](_0x48cd4a[_0x2785('0x38')][_0x2785('0x7d')])?_0x48cd4a[_0x2785('0x38')][_0x2785('0x7d')]:new Array(_0x48cd4a[_0x2785('0x38')][_0x2785('0x7d')]);_0x4ca438[_0x2785('0x2f')](function(_0x480115){_0x2e22d3['or'](_0x2785('0x69'),'%,'+_0x480115+',%');});}if(_0x48cd4a[_0x2785('0x38')][_0x2785('0x7f')]){var _0x48790d=_0x48cd4a[_0x2785('0x38')][_0x2785('0x7f')][_0x2785('0x80')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x48790d)){_0x4d3f2c['or'](_0x2785('0x81'),_0x48790d+'%')['or']('i.fax\x20LIKE\x20?',_0x48790d+'%');}_0x4d3f2c['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x48790d+'%');}}_0x4d3417['where'](_0x4d3f2c);_0x4d3417[_0x2785('0x82')]('i.id');var _0x4fbffe={'type':db[_0x2785('0x83')][_0x2785('0x84')][_0x2785('0x85')],'raw':!![]};var _0x21a71c=_0x4d3417[_0x2785('0x86')]();_0x21a71c[_0x2785('0x42')](_0x2785('0x87'));_0x21a71c[_0x2785('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2785('0x5a'));if(_0x2d5b76[_0x2785('0x3d')]){_0x2d5b76[_0x2785('0x3d')][_0x2785('0x2f')](function(_0x7c6055){var _0x106a3d=_0x7c6055[0x0]===_0x2785('0x88')?_0x7c6055[0x0]:'i.'+_0x7c6055[0x0];_0x4d3417[_0x2785('0x3d')](_0x106a3d,_0x7c6055[0x1]===_0x2785('0x89')?![]:!![]);});}if(!_[_0x2785('0x6f')](_0x4ca438)){_0x4d3417['having'](_0x2e22d3);_0x21a71c[_0x2785('0x3f')]('t.id\x20IN\x20?',_0x4ca438);}BPromise[_0x2785('0x8a')]()[_0x2785('0x27')](function(){if(!_0x1e6526){if(_0x48cd4a[_0x2785('0x38')][_0x2785('0x70')])return;_0x21a71c[_0x2785('0x3f')](_0x2785('0x8b'));_0x4d3417[_0x2785('0x3f')](_0x2785('0x8b'));return;}if(_0x48cd4a[_0x2785('0x8c')][_0x2785('0x8d')]!==_0x2785('0x8e'))return;return _0x48cd4a['user'][_0x2785('0x8f')]({'attributes':['id'],'raw':!![]})[_0x2785('0x27')](function(_0x1288ac){if(_[_0x2785('0x6f')](_0x1288ac)){_0x21a71c['where'](_0x2785('0x90'));_0x4d3417[_0x2785('0x3f')](_0x2785('0x90'));}else{_0x21a71c[_0x2785('0x3f')](_0x2785('0x71'),_[_0x2785('0x37')](_0x1288ac,'id'));_0x4d3417[_0x2785('0x3f')](_0x2785('0x71'),_[_0x2785('0x37')](_0x1288ac,'id'));}});})[_0x2785('0x27')](function(){if(_0x48cd4a[_0x2785('0x8c')][_0x2785('0x8d')]===_0x2785('0x8e')&&!_0x1e6526&&!_0x48cd4a[_0x2785('0x38')][_0x2785('0x70')])return[];return db[_0x2785('0x91')][_0x2785('0x38')](_0x21a71c[_0x2785('0x92')](),_0x4fbffe);})[_0x2785('0x27')](function(_0x532b0d){_0x395552[_0x2785('0x22')]=_0x532b0d[_0x2785('0x3b')];if(_0x395552[_0x2785('0x22')]===0x0)return[];return db[_0x2785('0x91')]['query'](_0x186838[_0x2785('0x92')](),_0x4fbffe)[_0x2785('0x27')](function(_0x1c216b){_0x5cc2cc=_[_0x2785('0x93')](_0x1c216b,'id');_0x4fbffe=_['merge'](_0x4fbffe,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48cd4a[_0x2785('0x38')]['fields']){_0x2d5b76['attributes'][_0x2785('0x2f')](function(_0x58c0bd){_0x4d3417[_0x2785('0x42')]('i.'+_0x58c0bd);});}else{_0x4d3417['field'](_0x2785('0x94'),'unreadMessages');_0x4d3417[_0x2785('0x42')](_0x2785('0x95'),_0x2785('0x96'));_0x4d3417[_0x2785('0x42')](_0x2785('0x97'),_0x2785('0x98'));_0x4d3417[_0x2785('0x42')](_0x2785('0x99'),_0x2785('0x88'));_0x4d3417[_0x2785('0x42')](_0x2785('0x9a'));_0x4d3417[_0x2785('0x42')](_0x2785('0x9b'),_0x2785('0x9c'));_0x4d3417[_0x2785('0x42')]('c.lastName',_0x2785('0x9d'));_0x4d3417[_0x2785('0x42')]('c.email','Contact.email');_0x4d3417[_0x2785('0x42')](_0x2785('0x9e'),_0x2785('0x9f'));_0x4d3417['field'](_0x2785('0xa0'),_0x2785('0xa1'));_0x4d3417[_0x2785('0x42')]('c.fax',_0x2785('0xa2'));_0x4d3417[_0x2785('0x42')](_0x2785('0xa3'),_0x2785('0xa4'));_0x4d3417[_0x2785('0x42')](_0x2785('0xa5'),'Owner.internal');_0x4d3417['field'](_0x2785('0xa6'),'TagIds');}if(_0x2d5b76[_0x2785('0x21')])_0x4d3417[_0x2785('0x21')](_0x2d5b76[_0x2785('0x21')]);if(_0x2d5b76[_0x2785('0x1f')])_0x4d3417[_0x2785('0x1f')](_0x2d5b76['offset']);return db['sequelize'][_0x2785('0x38')](_0x4d3417['toString'](),_0x4fbffe);})[_0x2785('0x27')](function(_0x52c345){if(_0x52c345[_0x2785('0x3b')]>0x0)_0x57e025[_0x2785('0x3f')]('ui.FaxInteractionId\x20IN\x20?',_[_0x2785('0x37')](_0x52c345,'id'));return db[_0x2785('0x91')][_0x2785('0x38')](_0x57e025[_0x2785('0x92')](),_0x4fbffe)[_0x2785('0x27')](function(_0x5b041c){var _0x11e9a4=_['groupBy'](_0x5b041c,_0x2785('0xa7'));var _0x455af2=[];_0x52c345[_0x2785('0x2f')](function(_0x382804){_0x455af2[_0x2785('0x30')](updateFaxInteraction(_0x382804,_0x5cc2cc,_0x11e9a4));});return BPromise[_0x2785('0xa8')](_0x455af2);});});})['then'](function(_0x3e1f3e){_0x395552[_0x2785('0xa9')]=_0x3e1f3e;return _0x395552;})['then'](respondWithFilteredResult(_0x157dc0,_0x2d5b76))[_0x2785('0x31')](handleError(_0x157dc0,null));};exports[_0x2785('0xaa')]=function(_0x78a646,_0x2a4ee1){var _0x541cf9={'raw':![],'where':{'id':_0x78a646[_0x2785('0xab')]['id']}},_0x3a7bba={};_0x3a7bba[_0x2785('0x36')]=_[_0x2785('0x39')](db['FaxInteraction']['rawAttributes']);_0x3a7bba[_0x2785('0x38')]=_[_0x2785('0x39')](_0x78a646[_0x2785('0x38')]);_0x3a7bba[_0x2785('0x40')]=_[_0x2785('0xac')](_0x3a7bba[_0x2785('0x36')],_0x3a7bba[_0x2785('0x38')]);_0x541cf9[_0x2785('0x3a')]=_[_0x2785('0xac')](_0x3a7bba[_0x2785('0x36')],qs[_0x2785('0xad')](_0x78a646[_0x2785('0x38')][_0x2785('0xad')]));_0x541cf9[_0x2785('0x3a')]=_0x541cf9[_0x2785('0x3a')]['length']?_0x541cf9[_0x2785('0x3a')]:_0x3a7bba[_0x2785('0x36')];if(_0x78a646[_0x2785('0x38')]['includeAll']){_0x541cf9[_0x2785('0xae')]=[{'all':!![]}];}_0x541cf9=_['merge']({},_0x541cf9,_0x78a646[_0x2785('0xaf')]);return db[_0x2785('0x33')][_0x2785('0x59')](_0x541cf9)[_0x2785('0x27')](handleEntityNotFound(_0x2a4ee1,null))[_0x2785('0x27')](respondWithResult(_0x2a4ee1,null))['catch'](handleError(_0x2a4ee1,null));};exports[_0x2785('0xb0')]=function(_0x165d47,_0x5dbc55){return db[_0x2785('0x33')]['create'](_0x165d47['body'],{})[_0x2785('0x27')](respondWithResult(_0x5dbc55,0xc9))['catch'](handleError(_0x5dbc55,null));};exports['update']=function(_0x2337ea,_0x5554da){if(_0x2337ea[_0x2785('0x6c')]['id']){delete _0x2337ea[_0x2785('0x6c')]['id'];}return db['FaxInteraction'][_0x2785('0x59')]({'where':{'id':_0x2337ea[_0x2785('0xab')]['id']}})[_0x2785('0x27')](handleEntityNotFound(_0x5554da,null))[_0x2785('0x27')](saveUpdates(_0x2337ea[_0x2785('0x6c')],null))[_0x2785('0x27')](respondWithResult(_0x5554da,null))[_0x2785('0x31')](handleError(_0x5554da,null));};exports[_0x2785('0x26')]=function(_0x39d755,_0x46074c){return db['FaxInteraction'][_0x2785('0x59')]({'where':{'id':_0x39d755['params']['id']}})[_0x2785('0x27')](handleEntityNotFound(_0x46074c,null))['then'](removeEntity(_0x46074c,null))[_0x2785('0x31')](handleError(_0x46074c,null));};exports[_0x2785('0xb1')]=function(_0x3f3bb9,_0x1797d8){return db['FaxInteraction'][_0x2785('0xb1')]()[_0x2785('0x27')](respondWithResult(_0x1797d8,null))[_0x2785('0x31')](handleError(_0x1797d8,null));};exports[_0x2785('0xb2')]=function(_0x5c29e0,_0x485279,_0x3b4aab){return db['FaxMessage'][_0x2785('0x59')]({'where':{'id':_0x5c29e0[_0x2785('0xab')]['id']}})['then'](handleEntityNotFound(_0x485279,null))[_0x2785('0x27')](function(_0x3de1d2){if(_0x3de1d2){return _0x3de1d2[_0x2785('0xb2')](_0x5c29e0[_0x2785('0x6c')][_0x2785('0xb3')],_[_0x2785('0xb4')](_0x5c29e0['body'],[_0x2785('0xb3'),'id'])||{});}})['then'](respondWithResult(_0x485279,null))[_0x2785('0x31')](handleError(_0x485279,null));};exports[_0x2785('0xb5')]=function(_0x459d6e,_0x11bd12,_0x24fe40){var _0x31ea45={'raw':![],'where':{}};var _0x199de9={};var _0xe989cf={'count':0x0,'rows':[]};return db[_0x2785('0x33')][_0x2785('0xb6')]({'where':{'id':_0x459d6e[_0x2785('0xab')]['id']}})[_0x2785('0x27')](handleEntityNotFound(_0x11bd12,null))[_0x2785('0x27')](function(_0x5c9eaa){if(_0x5c9eaa){_0x199de9[_0x2785('0x36')]=_[_0x2785('0x39')](db[_0x2785('0xb7')][_0x2785('0xb8')]);_0x199de9[_0x2785('0x38')]=_[_0x2785('0x39')](_0x459d6e[_0x2785('0x38')]);_0x199de9[_0x2785('0x40')]=_[_0x2785('0xac')](_0x199de9[_0x2785('0x36')],_0x199de9[_0x2785('0x38')]);_0x31ea45[_0x2785('0x3a')]=_[_0x2785('0xac')](_0x199de9[_0x2785('0x36')],qs[_0x2785('0xad')](_0x459d6e[_0x2785('0x38')][_0x2785('0xad')]));_0x31ea45[_0x2785('0x3a')]=_0x31ea45[_0x2785('0x3a')]['length']?_0x31ea45[_0x2785('0x3a')]:_0x199de9[_0x2785('0x36')];if(!_0x459d6e[_0x2785('0x38')]['hasOwnProperty']('nolimit')){_0x31ea45['limit']=qs[_0x2785('0x21')](_0x459d6e[_0x2785('0x38')][_0x2785('0x21')]);_0x31ea45[_0x2785('0x1f')]=qs[_0x2785('0x1f')](_0x459d6e[_0x2785('0x38')][_0x2785('0x1f')]);}_0x31ea45[_0x2785('0x3d')]=qs[_0x2785('0x3e')](_0x459d6e[_0x2785('0x38')][_0x2785('0x3e')]);_0x31ea45[_0x2785('0x3f')]=qs[_0x2785('0x40')](_[_0x2785('0x41')](_0x459d6e[_0x2785('0x38')],_0x199de9[_0x2785('0x40')]));_0x31ea45[_0x2785('0x3f')][_0x2785('0xa7')]=_0x5c9eaa['id'];if(_0x459d6e[_0x2785('0x38')][_0x2785('0x7f')]){_0x31ea45[_0x2785('0x3f')]=_[_0x2785('0xb9')](_0x31ea45[_0x2785('0x3f')],{'$or':_[_0x2785('0x37')](_0x31ea45[_0x2785('0x3a')],function(_0x49dac1){var _0x830ff={};_0x830ff[_0x49dac1]={'$like':'%'+_0x459d6e['query'][_0x2785('0x7f')]+'%'};return _0x830ff;})});}if(_0x459d6e[_0x2785('0x38')][_0x2785('0x74')]){var _0x5d10c4=_0x459d6e[_0x2785('0x38')][_0x2785('0x74')][_0x2785('0x60')](',');var _0x430aeb={};_0x430aeb[_0x5d10c4[0x0]]={'$gte':moment(_0x5d10c4[0x1])['format'](_0x2785('0xba'))};_0x31ea45[_0x2785('0x3f')]=_['merge'](_0x31ea45[_0x2785('0x3f')],_0x430aeb);}_0x31ea45=_[_0x2785('0xb9')]({},_0x31ea45,_0x459d6e['options']);return db[_0x2785('0xb7')][_0x2785('0x22')]({'where':_0x31ea45[_0x2785('0x3f')]})['then'](function(_0x20e376){_0xe989cf['count']=_0x20e376;if(_0x459d6e[_0x2785('0x38')][_0x2785('0xbb')]){_0x31ea45[_0x2785('0xae')]=[{'all':!![]}];}return db[_0x2785('0xb7')][_0x2785('0xbc')](_0x31ea45);})[_0x2785('0x27')](function(_0x4e9c16){_0xe989cf[_0x2785('0xa9')]=_0x4e9c16;return _0xe989cf;});}})['then'](respondWithFilteredResult(_0x11bd12,_0x31ea45))[_0x2785('0x31')](handleError(_0x11bd12,null));};exports['addTags']=function(_0x58ee07,_0x4a9578,_0x2c5325){return db[_0x2785('0x33')]['find']({'where':{'id':_0x58ee07[_0x2785('0xab')]['id']}})[_0x2785('0x27')](handleEntityNotFound(_0x4a9578,null))[_0x2785('0x27')](function(_0x4f9f28){if(_0x4f9f28){return _0x4f9f28[_0x2785('0xbd')](_0x58ee07[_0x2785('0x6c')]['ids'],_['omit'](_0x58ee07['body'],[_0x2785('0xb3'),'id'])||{})[_0x2785('0xbe')](function(){return db['Tag'][_0x2785('0xbc')]({'attributes':['id',_0x2785('0x2a'),'color'],'where':{'id':_0x58ee07[_0x2785('0x6c')][_0x2785('0xb3')]}});})['then'](function(_0x26584a){socket[_0x2785('0xbf')](_0x2785('0xc0'),{'id':Number(_0x58ee07['params']['id']),'tags':_0x26584a||[]});return{'id':Number(_0x58ee07['params']['id']),'tags':_0x26584a||[]};});}})[_0x2785('0x27')](respondWithResult(_0x4a9578,null))['catch'](handleError(_0x4a9578,null));};exports[_0x2785('0xc1')]=function(_0x468dd9,_0x50d1d8,_0x402828){return db['FaxInteraction']['find']({'where':{'id':_0x468dd9['params']['id']}})['then'](handleEntityNotFound(_0x50d1d8,null))[_0x2785('0x27')](function(_0x164a1d){if(_0x164a1d){return _0x164a1d[_0x2785('0xc1')](_0x468dd9['query'][_0x2785('0xb3')]);}})[_0x2785('0x27')](respondWithStatusCode(_0x50d1d8,null))[_0x2785('0x31')](handleError(_0x50d1d8,null));};exports[_0x2785('0xc2')]=function(_0xe37e6b,_0x5dbede){var _0xb41407=moment()[_0x2785('0xc3')]()['toString']();var _0x51b6fa=path['join'](config[_0x2785('0xc4')],_0x2785('0xc5'),'files',_0x2785('0xc6'));var _0x2fbd6b=path[_0x2785('0xc7')](config[_0x2785('0xc4')],_0x2785('0xc5'),_0x2785('0xc8'),_0x2785('0xc9'));var _0x3299fe=path[_0x2785('0xc7')](_0x51b6fa,_0xb41407);var _0x2f38ce=util[_0x2785('0xca')](_0x2785('0xcb'),_0xe37e6b[_0x2785('0xab')]['id'],_0xb41407);var _0x4e531d=path[_0x2785('0xc7')](_0x51b6fa,_0x2f38ce);var _0x369153=[];_0x369153[_0x2785('0x30')]({'model':db['Attachment'],'as':_0x2785('0xcc'),'raw':!![]});var _0x31eb02=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body',_0x2785('0x73')],'include':_0x369153}];return db[_0x2785('0x33')][_0x2785('0x59')]({'where':{'id':_0xe37e6b['params']['id']},'include':_0x31eb02})[_0x2785('0x27')](handleEntityNotFound(_0x5dbede,null))[_0x2785('0x27')](function(_0x5cff38){if(_0x5cff38&&_0x5cff38[_0x2785('0xcd')]){var _0x4e5a5b=_0x5cff38[_0x2785('0xce')]({'plain':!![]});fs[_0x2785('0xcf')](_0x3299fe);for(var _0x393910=0x0;_0x393910<_0x4e5a5b[_0x2785('0xcd')][_0x2785('0x3b')];_0x393910++){var _0x24f74b=_0x4e5a5b['Messages'][_0x393910]['Attachment'];if(_0x24f74b){var _0x30b737=path[_0x2785('0xc7')](_0x2fbd6b,_0x24f74b[_0x2785('0xd0')]);if(fs[_0x2785('0xd1')](_0x30b737)){fs[_0x2785('0xd2')](_0x30b737)[_0x2785('0xd3')](fs[_0x2785('0xd4')](path[_0x2785('0xc7')](_0x3299fe,_0x24f74b[_0x2785('0xd0')])));}}}return BPromise[_0x2785('0x8a')]()[_0x2785('0x27')](function(){return new BPromise(function(_0x19d93e,_0x5b820f){zipdir(_0x3299fe,{'saveTo':_0x4e531d},function(_0x5c5a78,_0x9ac60f){if(_0x5c5a78)return _0x5b820f(_0x5c5a78);return _0x19d93e(_0x9ac60f);});})[_0x2785('0x27')](function(){return new BPromise(function(_0x1e6bbd,_0x15dc85){rimraf(_0x3299fe,function(_0x5da4d7){if(_0x5da4d7)_0x15dc85(_0x5da4d7);return _0x1e6bbd();});});})['then'](function(){return _0x5dbede[_0x2785('0xc2')](_0x4e531d,_0x2f38ce,function(_0x593d1e){if(_0x593d1e){console[_0x2785('0xd5')](_0x2785('0xd6'),_0x593d1e);}else{fs[_0x2785('0xd7')](_0x4e531d);}});});});}else{return _0x5dbede['sendStatus'](0xc8);}})[_0x2785('0x31')](handleError(_0x5dbede,null));}; \ No newline at end of file +var _0xa749=['Tag','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','start','some','isEmpty','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','catch','params','includeAll','include','options','create','destroy','describe','addMessage','omit','getMessages','FaxMessage','pick','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','ids','spread','findAll','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','sendStatus','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','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','./faxInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','map','TagIds','Tags','split','forEach','push','index','FaxInteraction','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','users','u.id\x20=\x20ui.UserId','select','fax_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text'];(function(_0x380fa9,_0x5123eb){var _0x4f2532=function(_0x4bde43){while(--_0x4bde43){_0x380fa9['push'](_0x380fa9['shift']());}};_0x4f2532(++_0x5123eb);}(_0xa749,0x150));var _0x9a74=function(_0x236119,_0x52cb57){_0x236119=_0x236119-0x0;var _0x1f015d=_0xa749[_0x236119];return _0x1f015d;};'use strict';var emlformat=require(_0x9a74('0x0'));var rimraf=require(_0x9a74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a74('0x2'));var rp=require('request-promise');var moment=require(_0x9a74('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9a74('0x4'));var util=require(_0x9a74('0x5'));var path=require(_0x9a74('0x6'));var sox=require('sox');var csv=require(_0x9a74('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a74('0x8'));var _=require(_0x9a74('0x9'));var squel=require(_0x9a74('0xa'));var crypto=require('crypto');var jsforce=require(_0x9a74('0xb'));var deskjs=require(_0x9a74('0xc'));var toCsv=require(_0x9a74('0x7'));var querystring=require(_0x9a74('0xd'));var Papa=require(_0x9a74('0xe'));var Redis=require(_0x9a74('0xf'));var authService=require(_0x9a74('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9a74('0x11'));var hardwareService=require(_0x9a74('0x12'));var logger=require(_0x9a74('0x13'))(_0x9a74('0x14'));var utils=require(_0x9a74('0x15'));var config=require(_0x9a74('0x16'));var licenseUtil=require(_0x9a74('0x17'));var db=require(_0x9a74('0x18'))['db'];config[_0x9a74('0x19')]=_['defaults'](config[_0x9a74('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a74('0x19')]));require(_0x9a74('0x1a'))[_0x9a74('0x1b')](socket);function respondWithStatusCode(_0x19fd5e,_0x36894d){_0x36894d=_0x36894d||0xcc;return function(_0x1caa43){if(_0x1caa43){return _0x19fd5e['sendStatus'](_0x36894d);}return _0x19fd5e[_0x9a74('0x1c')](_0x36894d)['end']();};}function respondWithResult(_0x277f87,_0x49942d){_0x49942d=_0x49942d||0xc8;return function(_0xd66eb2){if(_0xd66eb2){return _0x277f87[_0x9a74('0x1c')](_0x49942d)[_0x9a74('0x1d')](_0xd66eb2);}};}function respondWithFilteredResult(_0x266f43,_0x1209f0){return function(_0x5b4d2d){if(_0x5b4d2d){var _0x4157f9=typeof _0x1209f0[_0x9a74('0x1e')]===_0x9a74('0x1f')&&typeof _0x1209f0[_0x9a74('0x20')]===_0x9a74('0x1f');var _0x35ea0e=_0x5b4d2d[_0x9a74('0x21')];var _0x3d9e27=_0x4157f9?0x0:_0x1209f0[_0x9a74('0x1e')];var _0x52fb57=_0x4157f9?_0x5b4d2d['count']:_0x1209f0[_0x9a74('0x1e')]+_0x1209f0[_0x9a74('0x20')];var _0x5dca85;if(_0x52fb57>=_0x35ea0e){_0x52fb57=_0x35ea0e;_0x5dca85=0xc8;}else{_0x5dca85=0xce;}_0x266f43[_0x9a74('0x1c')](_0x5dca85);return _0x266f43[_0x9a74('0x22')](_0x9a74('0x23'),_0x3d9e27+'-'+_0x52fb57+'/'+_0x35ea0e)[_0x9a74('0x1d')](_0x5b4d2d);}return null;};}function patchUpdates(_0x318b4c){return function(_0x3da4b6){try{jsonpatch[_0x9a74('0x24')](_0x3da4b6,_0x318b4c,!![]);}catch(_0x594193){return BPromise['reject'](_0x594193);}return _0x3da4b6[_0x9a74('0x25')]();};}function saveUpdates(_0x255d43,_0x5a0793){return function(_0x5bc9ef){if(_0x5bc9ef){return _0x5bc9ef[_0x9a74('0x26')](_0x255d43)[_0x9a74('0x27')](function(_0x343d2c){return _0x343d2c;});}return null;};}function removeEntity(_0x30a13c,_0x29ec0d){return function(_0x2a0ec7){if(_0x2a0ec7){return _0x2a0ec7['destroy']()[_0x9a74('0x27')](function(){_0x30a13c[_0x9a74('0x1c')](0xcc)[_0x9a74('0x28')]();});}};}function handleEntityNotFound(_0x40f0b7,_0x2faca1){return function(_0x119e51){if(!_0x119e51){_0x40f0b7['sendStatus'](0x194);}return _0x119e51;};}function handleError(_0x5c6fe3,_0x32bf0c){_0x32bf0c=_0x32bf0c||0x1f4;return function(_0x4a1ab3){logger[_0x9a74('0x29')](_0x4a1ab3[_0x9a74('0x2a')]);if(_0x4a1ab3[_0x9a74('0x2b')]){delete _0x4a1ab3[_0x9a74('0x2b')];}_0x5c6fe3[_0x9a74('0x1c')](_0x32bf0c)[_0x9a74('0x2c')](_0x4a1ab3);};}function getInteractionUsers(_0x4c556d,_0x33364e){return new BPromise(function(_0x38a0ca,_0x3544d6){try{if(_0x33364e[_0x4c556d['id']]){_0x4c556d['Users']=_[_0x9a74('0x2d')](_0x33364e[_0x4c556d['id']],function(_0x582f25){return{'id':_0x582f25['id'],'fullname':_0x582f25['fullname']};});}}catch(_0x4acda9){_0x3544d6(_0x4acda9);}_0x38a0ca(_0x4c556d);});}function getInteractionTags(_0x20ed3f,_0x4822be){return new BPromise(function(_0x1d8984,_0x45b2b6){try{if(_0x20ed3f[_0x9a74('0x2e')]){_0x20ed3f[_0x9a74('0x2f')]=[];_0x20ed3f[_0x9a74('0x2e')][_0x9a74('0x30')](',')[_0x9a74('0x31')](function(_0x42ce83){_0x20ed3f[_0x9a74('0x2f')][_0x9a74('0x32')](_0x4822be[_0x42ce83]);});}delete _0x20ed3f[_0x9a74('0x2e')];}catch(_0x54a90a){_0x45b2b6(_0x54a90a);}_0x1d8984(_0x20ed3f);});}function updateFaxInteraction(_0x55bcc4,_0x171191,_0x5420ad){return new BPromise(function(_0x5b7671,_0x530f64){return getInteractionUsers(_0x55bcc4,_0x5420ad)['then'](function(_0x369c99){return getInteractionTags(_0x369c99,_0x171191);})['then'](function(_0x2fd50e){_0x5b7671(_0x2fd50e);})['catch'](function(_0x1c37b7){_0x530f64(_0x1c37b7);});});}exports[_0x9a74('0x33')]=function(_0x37484e,_0x202462){var _0x105276={},_0xbd45af={},_0x444439={'count':0x0,'rows':[]};var _0x5c4345=_['map'](db[_0x9a74('0x34')][_0x9a74('0x35')],function(_0x3e539d){return{'name':_0x3e539d[_0x9a74('0x36')],'type':_0x3e539d['type'][_0x9a74('0x37')]};});_0xbd45af['model']=_[_0x9a74('0x2d')](_0x5c4345,_0x9a74('0x2b'));_0xbd45af[_0x9a74('0x38')]=_[_0x9a74('0x39')](_0x37484e['query']);_0xbd45af['filters']=_['intersection'](_0xbd45af[_0x9a74('0x3a')],_0xbd45af['query']);_0x105276[_0x9a74('0x3b')]=_[_0x9a74('0x3c')](_0xbd45af['model'],qs[_0x9a74('0x3d')](_0x37484e[_0x9a74('0x38')][_0x9a74('0x3d')]));_0x105276['attributes']=_0x105276['attributes'][_0x9a74('0x3e')]?_0x105276[_0x9a74('0x3b')]:_0xbd45af[_0x9a74('0x3a')];if(!_0x37484e['query'][_0x9a74('0x3f')](_0x9a74('0x40'))){_0x105276['limit']=qs[_0x9a74('0x20')](_0x37484e['query'][_0x9a74('0x20')]);_0x105276[_0x9a74('0x1e')]=qs[_0x9a74('0x1e')](_0x37484e[_0x9a74('0x38')][_0x9a74('0x1e')]);}_0x105276[_0x9a74('0x41')]=qs[_0x9a74('0x42')](_0x37484e[_0x9a74('0x38')][_0x9a74('0x42')]);_0x105276['where']=qs[_0x9a74('0x43')](_['pick'](_0x37484e[_0x9a74('0x38')],_0xbd45af['filters']),_0x5c4345);var _0x38a13e=[];var _0x4e34a1=squel['select']()[_0x9a74('0x44')]('id')['field']('name')['field'](_0x9a74('0x45'))['from'](_0x9a74('0x46'));var _0x134fa6=squel['select']()['field'](_0x9a74('0x47'))[_0x9a74('0x44')](_0x9a74('0x48'))[_0x9a74('0x44')](_0x9a74('0x49'))[_0x9a74('0x4a')]('user_has_fax_interactions','ui')['left_join'](_0x9a74('0x4b'),'u',_0x9a74('0x4c'));var _0xaa52a5=squel[_0x9a74('0x4d')]()[_0x9a74('0x4a')](_0x9a74('0x4e'),'i')[_0x9a74('0x4f')](_0x9a74('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9a74('0x4f')]('users','o',_0x9a74('0x51'))[_0x9a74('0x4f')](_0x9a74('0x52'),'a','a.id\x20=\x20i.FaxAccountId')[_0x9a74('0x4f')](_0x9a74('0x53'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0x9a74('0x54'),'it',_0x9a74('0x55'))[_0x9a74('0x4f')]('tools_tags','t',_0x9a74('0x56'));var _0x297bea=squel[_0x9a74('0x57')]();var _0x31ae8e=[];var _0x5bdcd4=squel[_0x9a74('0x57')]();var _0x3480f6;if(_0x37484e['query'][_0x9a74('0x58')]){_0x3480f6=as[_0x9a74('0x59')](_0x37484e[_0x9a74('0x38')][_0x9a74('0x58')]);var _0x176857=_0x3480f6[_0x9a74('0x5a')];for(var _0x36ffa6=0x0;_0x36ffa6<_0x3480f6[_0x9a74('0x5b')][_0x9a74('0x3e')];_0x36ffa6++){var _0x504b89=_0x3480f6[_0x9a74('0x5b')][_0x36ffa6];var _0x879ef6='i';var _0x41db5e=_[_0x9a74('0x5c')](_0x5c4345,[_0x9a74('0x2b'),_0x504b89[_0x9a74('0x44')]]);if(!_0x41db5e){switch(_0x504b89[_0x9a74('0x44')]){case _0x9a74('0x5d'):if(_0x504b89['value']==0x1){_0xaa52a5[_0x9a74('0x5e')]('`'+_0x504b89['field']+_0x9a74('0x5f'));}else{_0xaa52a5[_0x9a74('0x5e')]('`'+_0x504b89[_0x9a74('0x44')]+_0x9a74('0x60'));}break;case'Contact':if(_0x504b89['operator']===_0x9a74('0x61')){if(_0x504b89[_0x9a74('0x62')][_0x9a74('0x30')]('\x20')['length']>0x1){_0x297bea[_0x176857](_0x9a74('0x63'),qs[_0x9a74('0x64')](_0x504b89[_0x9a74('0x62')]),null);}else{var _0x4ba50a='%'+_0x504b89[_0x9a74('0x62')]+'%';_0x297bea[_0x176857](_0x9a74('0x65'),_0x4ba50a,_0x4ba50a,_0x4ba50a);}}else{_0x41db5e=_['find'](_0x5c4345,['name',_0x9a74('0x66')]);_0x504b89[_0x9a74('0x44')]=_0x9a74('0x66');_0x1657dc=as[_0x9a74('0x67')](_0x879ef6,_0x41db5e[_0x9a74('0x68')],_0x504b89);_0x297bea[_0x176857](_0x1657dc[_0x9a74('0x69')],_0x1657dc[_0x9a74('0x62')]['start'],_0x1657dc[_0x9a74('0x62')][_0x9a74('0x28')]);}break;case _0x9a74('0x6a'):var _0x4a46bb=_0x504b89[_0x9a74('0x62')][_0x9a74('0x30')](',')[_0x9a74('0x2d')](function(_0x57e313){return Number(_0x57e313);});_0x4a46bb[_0x9a74('0x31')](function(_0x21552e){_0x5bdcd4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x21552e+',%');});_0x31ae8e=_[_0x9a74('0x6b')](_0x31ae8e,_0x4a46bb);break;case'User':if(_0x504b89[_0x9a74('0x6c')]===_0x9a74('0x61')){_0x297bea[_0x176857](_0x9a74('0x6d'),'%'+_0x504b89['value']+'%',null);}else{_0x41db5e=_[_0x9a74('0x5c')](_0x5c4345,[_0x9a74('0x2b'),_0x9a74('0x6e')]);_0x504b89['field']=_0x9a74('0x6e');_0x1657dc=as[_0x9a74('0x67')](_0x879ef6,_0x41db5e[_0x9a74('0x68')],_0x504b89);_0x297bea[_0x176857](_0x1657dc[_0x9a74('0x69')],_0x1657dc[_0x9a74('0x62')]['start'],_0x1657dc[_0x9a74('0x62')][_0x9a74('0x28')]);}break;case _0x9a74('0x6f'):_0x1657dc=as[_0x9a74('0x67')]('me',null,_0x504b89);_0x297bea[_0x176857](_0x1657dc[_0x9a74('0x69')],_0x1657dc[_0x9a74('0x62')]['start'],_0x1657dc[_0x9a74('0x62')][_0x9a74('0x28')]);break;}}else{var _0x1657dc=as[_0x9a74('0x67')](_0x879ef6,_0x41db5e[_0x9a74('0x68')],_0x504b89);_0x297bea[_0x176857](_0x1657dc[_0x9a74('0x69')],_0x1657dc[_0x9a74('0x62')][_0x9a74('0x70')],_0x1657dc[_0x9a74('0x62')][_0x9a74('0x28')]);}}}else{var _0x580165=_(_0x37484e[_0x9a74('0x38')])[_0x9a74('0x39')]()['map'](function(_0x48964c){return _[_0x9a74('0x71')](_0x5c4345,[_0x9a74('0x2b'),_0x48964c])?_0x48964c:undefined;})['compact']()['value']();if(!_[_0x9a74('0x72')](_0x580165)){_0x580165['forEach'](function(_0x28d849){if(_0x28d849==='FaxAccountId'){_0xaa52a5[_0x9a74('0x73')](_0x9a74('0x74'),[][_0x9a74('0x75')](_0x37484e['query'][_0x28d849]));}else if(_0x28d849===_0x9a74('0x76')){var _0x258602=JSON[_0x9a74('0x77')](_0x37484e[_0x9a74('0x38')][_0x28d849])[_0x9a74('0x78')];var _0x102a44=JSON['parse'](_0x37484e['query'][_0x28d849])[_0x9a74('0x79')];_0xaa52a5[_0x9a74('0x73')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x258602,_0x102a44);}else{if(_0x37484e[_0x9a74('0x38')][_0x28d849]===_0x9a74('0x7a')){_0xaa52a5[_0x9a74('0x73')]('i.'+_0x28d849+_0x9a74('0x7b'));}else{_0xaa52a5[_0x9a74('0x73')]('i.'+_0x28d849+'\x20=\x20?',_0x37484e[_0x9a74('0x38')][_0x28d849]);}}});}if(_0x37484e['query'][_0x9a74('0x7c')]){if(_0x37484e[_0x9a74('0x38')]['read']==0x1){_0xaa52a5[_0x9a74('0x5e')](_0x9a74('0x7d'));}else{_0xaa52a5[_0x9a74('0x5e')](_0x9a74('0x7e'));}}if(_0x37484e['query'][_0x9a74('0x7f')]){_0x31ae8e=_[_0x9a74('0x80')](_0x37484e['query']['tag'])?_0x37484e[_0x9a74('0x38')][_0x9a74('0x7f')]:new Array(_0x37484e[_0x9a74('0x38')][_0x9a74('0x7f')]);_0x31ae8e['forEach'](function(_0x35d2ea){_0x5bdcd4['or'](_0x9a74('0x81'),'%,'+_0x35d2ea+',%');});}if(_0x37484e[_0x9a74('0x38')][_0x9a74('0x82')]){var _0x55e68b=_0x37484e[_0x9a74('0x38')][_0x9a74('0x82')][_0x9a74('0x83')]('\x5c','\x5c\x5c')[_0x9a74('0x83')](/'/g,'\x27\x27');if(qs[_0x9a74('0x84')](_0x55e68b)){_0x297bea['or']('i.id\x20LIKE\x20?',_0x55e68b+'%')['or'](_0x9a74('0x85'),_0x55e68b+'%');}_0x297bea['or'](_0x9a74('0x86'),_0x55e68b+'%');}}_0xaa52a5[_0x9a74('0x73')](_0x297bea);_0xaa52a5[_0x9a74('0x87')]('i.id');var _0x291e26={'type':db[_0x9a74('0x88')][_0x9a74('0x89')][_0x9a74('0x8a')],'raw':!![]};var _0x42800f=_0xaa52a5[_0x9a74('0x8b')]();_0x42800f[_0x9a74('0x44')]('i.id');_0x42800f['field'](_0x9a74('0x8c'),_0x9a74('0x5d'));if(_0x105276[_0x9a74('0x41')]){_0x105276[_0x9a74('0x41')][_0x9a74('0x31')](function(_0x261105){var _0x5b4d20=_0x261105[0x0]===_0x9a74('0x8d')?_0x261105[0x0]:'i.'+_0x261105[0x0];_0xaa52a5['order'](_0x5b4d20,_0x261105[0x1]===_0x9a74('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x31ae8e)){_0xaa52a5[_0x9a74('0x5e')](_0x5bdcd4);_0x42800f['where'](_0x9a74('0x8f'),_0x31ae8e);}BPromise[_0x9a74('0x90')]()[_0x9a74('0x27')](function(){if(!_0x3480f6){if(_0x37484e[_0x9a74('0x38')][_0x9a74('0x91')])return;_0x42800f[_0x9a74('0x73')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0xaa52a5[_0x9a74('0x73')](_0x9a74('0x92'));return;}if(_0x37484e['user'][_0x9a74('0x93')]!==_0x9a74('0x94'))return;return _0x37484e[_0x9a74('0x95')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x9a74('0x27')](function(_0x478bf8){if(_[_0x9a74('0x72')](_0x478bf8)){_0x42800f['where'](_0x9a74('0x96'));_0xaa52a5[_0x9a74('0x73')](_0x9a74('0x96'));}else{_0x42800f[_0x9a74('0x73')](_0x9a74('0x74'),_[_0x9a74('0x2d')](_0x478bf8,'id'));_0xaa52a5[_0x9a74('0x73')](_0x9a74('0x74'),_[_0x9a74('0x2d')](_0x478bf8,'id'));}});})[_0x9a74('0x27')](function(){if(_0x37484e[_0x9a74('0x95')][_0x9a74('0x93')]===_0x9a74('0x94')&&!_0x3480f6&&!_0x37484e['query'][_0x9a74('0x91')])return[];return db[_0x9a74('0x97')][_0x9a74('0x38')](_0x42800f[_0x9a74('0x98')](),_0x291e26);})['then'](function(_0x59dc3a){_0x444439[_0x9a74('0x21')]=_0x59dc3a[_0x9a74('0x3e')];if(_0x444439[_0x9a74('0x21')]===0x0)return[];return db[_0x9a74('0x97')][_0x9a74('0x38')](_0x4e34a1[_0x9a74('0x98')](),_0x291e26)['then'](function(_0x149265){_0x38a13e=_['keyBy'](_0x149265,'id');_0x291e26=_[_0x9a74('0x99')](_0x291e26,{'model':db[_0x9a74('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x37484e[_0x9a74('0x38')]['fields']){_0x105276['attributes'][_0x9a74('0x31')](function(_0x503f95){_0xaa52a5[_0x9a74('0x44')]('i.'+_0x503f95);});}else{_0xaa52a5[_0x9a74('0x44')](_0x9a74('0x8c'),_0x9a74('0x5d'));_0xaa52a5[_0x9a74('0x44')](_0x9a74('0x9a'),_0x9a74('0x9b'));_0xaa52a5[_0x9a74('0x44')](_0x9a74('0x9c'),_0x9a74('0x9d'));_0xaa52a5[_0x9a74('0x44')](_0x9a74('0x9e'),_0x9a74('0x8d'));_0xaa52a5[_0x9a74('0x44')](_0x9a74('0x9f'));_0xaa52a5[_0x9a74('0x44')](_0x9a74('0xa0'),_0x9a74('0xa1'));_0xaa52a5[_0x9a74('0x44')](_0x9a74('0xa2'),'Contact.lastName');_0xaa52a5[_0x9a74('0x44')](_0x9a74('0xa3'),'Contact.email');_0xaa52a5[_0x9a74('0x44')](_0x9a74('0xa4'),_0x9a74('0xa5'));_0xaa52a5[_0x9a74('0x44')](_0x9a74('0xa6'),_0x9a74('0xa7'));_0xaa52a5[_0x9a74('0x44')](_0x9a74('0xa8'),_0x9a74('0xa9'));_0xaa52a5['field'](_0x9a74('0xaa'),_0x9a74('0xab'));_0xaa52a5[_0x9a74('0x44')]('o.internal',_0x9a74('0xac'));_0xaa52a5[_0x9a74('0x44')](_0x9a74('0xad'),'TagIds');}if(_0x105276[_0x9a74('0x20')])_0xaa52a5[_0x9a74('0x20')](_0x105276[_0x9a74('0x20')]);if(_0x105276['offset'])_0xaa52a5['offset'](_0x105276[_0x9a74('0x1e')]);return db['sequelize'][_0x9a74('0x38')](_0xaa52a5[_0x9a74('0x98')](),_0x291e26);})[_0x9a74('0x27')](function(_0x2cdf07){if(_0x2cdf07[_0x9a74('0x3e')]>0x0)_0x134fa6[_0x9a74('0x73')](_0x9a74('0xae'),_[_0x9a74('0x2d')](_0x2cdf07,'id'));return db[_0x9a74('0x97')][_0x9a74('0x38')](_0x134fa6['toString'](),_0x291e26)['then'](function(_0x288de7){var _0x13942b=_[_0x9a74('0xaf')](_0x288de7,_0x9a74('0xb0'));var _0x1be9d8=[];_0x2cdf07['forEach'](function(_0x2d2de7){_0x1be9d8[_0x9a74('0x32')](updateFaxInteraction(_0x2d2de7,_0x38a13e,_0x13942b));});return BPromise[_0x9a74('0xb1')](_0x1be9d8);});});})[_0x9a74('0x27')](function(_0x110999){_0x444439['rows']=_0x110999;return _0x444439;})[_0x9a74('0x27')](respondWithFilteredResult(_0x202462,_0x105276))[_0x9a74('0xb2')](handleError(_0x202462,null));};exports['show']=function(_0xb58451,_0x33cd5c){var _0x761647={'raw':![],'where':{'id':_0xb58451[_0x9a74('0xb3')]['id']}},_0x5d0f69={};_0x5d0f69[_0x9a74('0x3a')]=_['keys'](db[_0x9a74('0x34')][_0x9a74('0x35')]);_0x5d0f69[_0x9a74('0x38')]=_[_0x9a74('0x39')](_0xb58451['query']);_0x5d0f69[_0x9a74('0x43')]=_['intersection'](_0x5d0f69['model'],_0x5d0f69[_0x9a74('0x38')]);_0x761647[_0x9a74('0x3b')]=_[_0x9a74('0x3c')](_0x5d0f69['model'],qs[_0x9a74('0x3d')](_0xb58451[_0x9a74('0x38')][_0x9a74('0x3d')]));_0x761647[_0x9a74('0x3b')]=_0x761647[_0x9a74('0x3b')][_0x9a74('0x3e')]?_0x761647['attributes']:_0x5d0f69[_0x9a74('0x3a')];if(_0xb58451[_0x9a74('0x38')][_0x9a74('0xb4')]){_0x761647[_0x9a74('0xb5')]=[{'all':!![]}];}_0x761647=_['merge']({},_0x761647,_0xb58451[_0x9a74('0xb6')]);return db[_0x9a74('0x34')][_0x9a74('0x5c')](_0x761647)[_0x9a74('0x27')](handleEntityNotFound(_0x33cd5c,null))['then'](respondWithResult(_0x33cd5c,null))[_0x9a74('0xb2')](handleError(_0x33cd5c,null));};exports[_0x9a74('0xb7')]=function(_0x54a908,_0x1b63e4){return db[_0x9a74('0x34')][_0x9a74('0xb7')](_0x54a908[_0x9a74('0x6f')],{})[_0x9a74('0x27')](respondWithResult(_0x1b63e4,0xc9))[_0x9a74('0xb2')](handleError(_0x1b63e4,null));};exports[_0x9a74('0x26')]=function(_0x2bb5a3,_0x4f3697){if(_0x2bb5a3[_0x9a74('0x6f')]['id']){delete _0x2bb5a3[_0x9a74('0x6f')]['id'];}return db[_0x9a74('0x34')][_0x9a74('0x5c')]({'where':{'id':_0x2bb5a3[_0x9a74('0xb3')]['id']}})[_0x9a74('0x27')](handleEntityNotFound(_0x4f3697,null))[_0x9a74('0x27')](saveUpdates(_0x2bb5a3[_0x9a74('0x6f')],null))[_0x9a74('0x27')](respondWithResult(_0x4f3697,null))[_0x9a74('0xb2')](handleError(_0x4f3697,null));};exports[_0x9a74('0xb8')]=function(_0x2320b9,_0xcba3c6){return db[_0x9a74('0x34')][_0x9a74('0x5c')]({'where':{'id':_0x2320b9[_0x9a74('0xb3')]['id']}})[_0x9a74('0x27')](handleEntityNotFound(_0xcba3c6,null))[_0x9a74('0x27')](removeEntity(_0xcba3c6,null))['catch'](handleError(_0xcba3c6,null));};exports[_0x9a74('0xb9')]=function(_0x385ecd,_0x368b84){return db[_0x9a74('0x34')]['describe']()[_0x9a74('0x27')](respondWithResult(_0x368b84,null))[_0x9a74('0xb2')](handleError(_0x368b84,null));};exports[_0x9a74('0xba')]=function(_0x1c97c2,_0x5d436f,_0x4dade5){return db['FaxMessage'][_0x9a74('0x5c')]({'where':{'id':_0x1c97c2[_0x9a74('0xb3')]['id']}})[_0x9a74('0x27')](handleEntityNotFound(_0x5d436f,null))[_0x9a74('0x27')](function(_0x98e660){if(_0x98e660){return _0x98e660[_0x9a74('0xba')](_0x1c97c2['body']['ids'],_[_0x9a74('0xbb')](_0x1c97c2[_0x9a74('0x6f')],['ids','id'])||{});}})['then'](respondWithResult(_0x5d436f,null))[_0x9a74('0xb2')](handleError(_0x5d436f,null));};exports[_0x9a74('0xbc')]=function(_0x6e6338,_0x19cd7e,_0x2cf186){var _0x1b151c={'raw':![],'where':{}};var _0x5cc672={};var _0x5ed4f7={'count':0x0,'rows':[]};return db[_0x9a74('0x34')]['findOne']({'where':{'id':_0x6e6338['params']['id']}})[_0x9a74('0x27')](handleEntityNotFound(_0x19cd7e,null))['then'](function(_0xeb74da){if(_0xeb74da){_0x5cc672[_0x9a74('0x3a')]=_[_0x9a74('0x39')](db[_0x9a74('0xbd')][_0x9a74('0x35')]);_0x5cc672['query']=_['keys'](_0x6e6338[_0x9a74('0x38')]);_0x5cc672[_0x9a74('0x43')]=_[_0x9a74('0x3c')](_0x5cc672['model'],_0x5cc672[_0x9a74('0x38')]);_0x1b151c['attributes']=_[_0x9a74('0x3c')](_0x5cc672[_0x9a74('0x3a')],qs[_0x9a74('0x3d')](_0x6e6338['query'][_0x9a74('0x3d')]));_0x1b151c[_0x9a74('0x3b')]=_0x1b151c[_0x9a74('0x3b')]['length']?_0x1b151c[_0x9a74('0x3b')]:_0x5cc672[_0x9a74('0x3a')];if(!_0x6e6338[_0x9a74('0x38')][_0x9a74('0x3f')]('nolimit')){_0x1b151c[_0x9a74('0x20')]=qs[_0x9a74('0x20')](_0x6e6338[_0x9a74('0x38')]['limit']);_0x1b151c[_0x9a74('0x1e')]=qs[_0x9a74('0x1e')](_0x6e6338[_0x9a74('0x38')][_0x9a74('0x1e')]);}_0x1b151c[_0x9a74('0x41')]=qs['sort'](_0x6e6338[_0x9a74('0x38')]['sort']);_0x1b151c[_0x9a74('0x73')]=qs[_0x9a74('0x43')](_[_0x9a74('0xbe')](_0x6e6338[_0x9a74('0x38')],_0x5cc672[_0x9a74('0x43')]));_0x1b151c['where']['FaxInteractionId']=_0xeb74da['id'];if(_0x6e6338[_0x9a74('0x38')][_0x9a74('0x82')]){_0x1b151c['where']=_[_0x9a74('0x99')](_0x1b151c[_0x9a74('0x73')],{'$or':_['map'](_0x1b151c['attributes'],function(_0x470c83){var _0x5509a9={};_0x5509a9[_0x470c83]={'$like':'%'+_0x6e6338[_0x9a74('0x38')]['filter']+'%'};return _0x5509a9;})});}if(_0x6e6338['query'][_0x9a74('0x78')]){var _0x15b9b1=_0x6e6338['query'][_0x9a74('0x78')][_0x9a74('0x30')](',');var _0x52e877={};_0x52e877[_0x15b9b1[0x0]]={'$gte':moment(_0x15b9b1[0x1])[_0x9a74('0xbf')](_0x9a74('0xc0'))};_0x1b151c[_0x9a74('0x73')]=_[_0x9a74('0x99')](_0x1b151c['where'],_0x52e877);}_0x1b151c=_[_0x9a74('0x99')]({},_0x1b151c,_0x6e6338[_0x9a74('0xb6')]);return db[_0x9a74('0xbd')][_0x9a74('0x21')]({'where':_0x1b151c[_0x9a74('0x73')]})[_0x9a74('0x27')](function(_0x2a02b0){_0x5ed4f7[_0x9a74('0x21')]=_0x2a02b0;if(_0x6e6338[_0x9a74('0x38')][_0x9a74('0xb4')]){_0x1b151c[_0x9a74('0xb5')]=[{'all':!![]}];}return db[_0x9a74('0xbd')]['findAll'](_0x1b151c);})[_0x9a74('0x27')](function(_0x10de26){_0x5ed4f7[_0x9a74('0xc1')]=_0x10de26;return _0x5ed4f7;});}})[_0x9a74('0x27')](respondWithFilteredResult(_0x19cd7e,_0x1b151c))[_0x9a74('0xb2')](handleError(_0x19cd7e,null));};exports[_0x9a74('0xc2')]=function(_0x17b17e,_0x46c124,_0x5d7ea7){return db[_0x9a74('0x34')]['find']({'where':{'id':_0x17b17e[_0x9a74('0xb3')]['id']}})[_0x9a74('0x27')](handleEntityNotFound(_0x46c124,null))[_0x9a74('0x27')](function(_0x3e8040){if(_0x3e8040){return _0x3e8040['setTags'](_0x17b17e[_0x9a74('0x6f')][_0x9a74('0xc3')],_[_0x9a74('0xbb')](_0x17b17e[_0x9a74('0x6f')],[_0x9a74('0xc3'),'id'])||{})[_0x9a74('0xc4')](function(){return db['Tag'][_0x9a74('0xc5')]({'attributes':['id',_0x9a74('0x2b'),_0x9a74('0x45')],'where':{'id':_0x17b17e[_0x9a74('0x6f')][_0x9a74('0xc3')]}});})[_0x9a74('0x27')](function(_0x2ec60f){socket['emit'](_0x9a74('0xc6'),{'id':Number(_0x17b17e[_0x9a74('0xb3')]['id']),'tags':_0x2ec60f||[]});return{'id':Number(_0x17b17e['params']['id']),'tags':_0x2ec60f||[]};});}})[_0x9a74('0x27')](respondWithResult(_0x46c124,null))[_0x9a74('0xb2')](handleError(_0x46c124,null));};exports[_0x9a74('0xc7')]=function(_0x497a88,_0x1fc701,_0x782592){return db[_0x9a74('0x34')]['find']({'where':{'id':_0x497a88[_0x9a74('0xb3')]['id']}})[_0x9a74('0x27')](handleEntityNotFound(_0x1fc701,null))['then'](function(_0x3d62c7){if(_0x3d62c7){return _0x3d62c7[_0x9a74('0xc7')](_0x497a88[_0x9a74('0x38')]['ids']);}})[_0x9a74('0x27')](respondWithStatusCode(_0x1fc701,null))[_0x9a74('0xb2')](handleError(_0x1fc701,null));};exports[_0x9a74('0xc8')]=function(_0x4e04d5,_0x57b39f){var _0x1604c4=moment()[_0x9a74('0xc9')]()[_0x9a74('0x98')]();var _0x367106=path[_0x9a74('0xca')](config[_0x9a74('0xcb')],_0x9a74('0xcc'),_0x9a74('0xcd'),_0x9a74('0xce'));var _0x4b22e5=path[_0x9a74('0xca')](config[_0x9a74('0xcb')],_0x9a74('0xcc'),_0x9a74('0xcd'),_0x9a74('0xcf'));var _0x26fd58=path[_0x9a74('0xca')](_0x367106,_0x1604c4);var _0x42c8f5=util['format'](_0x9a74('0xd0'),_0x4e04d5[_0x9a74('0xb3')]['id'],_0x1604c4);var _0x37c7b0=path[_0x9a74('0xca')](_0x367106,_0x42c8f5);var _0x58b9a7=[];_0x58b9a7[_0x9a74('0x32')]({'model':db[_0x9a74('0xd1')],'as':_0x9a74('0xd1'),'raw':!![]});var _0x43961f=[{'model':db[_0x9a74('0xbd')],'as':'Messages','attributes':['id','body','createdAt'],'include':_0x58b9a7}];return db[_0x9a74('0x34')][_0x9a74('0x5c')]({'where':{'id':_0x4e04d5['params']['id']},'include':_0x43961f})[_0x9a74('0x27')](handleEntityNotFound(_0x57b39f,null))[_0x9a74('0x27')](function(_0x56f24a){if(_0x56f24a&&_0x56f24a[_0x9a74('0xd2')]){var _0x42ea83=_0x56f24a[_0x9a74('0xd3')]({'plain':!![]});fs[_0x9a74('0xd4')](_0x26fd58);for(var _0x451c83=0x0;_0x451c83<_0x42ea83[_0x9a74('0xd2')][_0x9a74('0x3e')];_0x451c83++){var _0x223fdf=_0x42ea83['Messages'][_0x451c83][_0x9a74('0xd1')];if(_0x223fdf){var _0x2765a5=path[_0x9a74('0xca')](_0x4b22e5,_0x223fdf[_0x9a74('0xd5')]);if(fs[_0x9a74('0xd6')](_0x2765a5)){fs['createReadStream'](_0x2765a5)[_0x9a74('0xd7')](fs[_0x9a74('0xd8')](path[_0x9a74('0xca')](_0x26fd58,_0x223fdf[_0x9a74('0xd5')])));}}}return BPromise['resolve']()[_0x9a74('0x27')](function(){return new BPromise(function(_0x3dd500,_0x3c33b6){zipdir(_0x26fd58,{'saveTo':_0x37c7b0},function(_0xf3cc90,_0x35bd90){if(_0xf3cc90)return _0x3c33b6(_0xf3cc90);return _0x3dd500(_0x35bd90);});})['then'](function(){return new BPromise(function(_0xd49b7,_0x3dc497){rimraf(_0x26fd58,function(_0x26a558){if(_0x26a558)_0x3dc497(_0x26a558);return _0xd49b7();});});})[_0x9a74('0x27')](function(){return _0x57b39f[_0x9a74('0xc8')](_0x37c7b0,_0x42c8f5,function(_0x48e4ff){if(_0x48e4ff){console[_0x9a74('0xd9')](_0x9a74('0xda'),_0x48e4ff);}else{fs[_0x9a74('0xdb')](_0x37c7b0);}});});});}else{return _0x57b39f[_0x9a74('0xdc')](0xc8);}})[_0x9a74('0xb2')](handleError(_0x57b39f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6021ef4..8f15a19 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 _0xa9d2=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x551a3d,_0x389881){var _0x331e82=function(_0x3f33e6){while(--_0x3f33e6){_0x551a3d['push'](_0x551a3d['shift']());}};_0x331e82(++_0x389881);}(_0xa9d2,0xee));var _0x2a9d=function(_0x55caca,_0x18bc05){_0x55caca=_0x55caca-0x0;var _0x1b350a=_0xa9d2[_0x55caca];return _0x1b350a;};'use strict';var EventEmitter=require(_0x2a9d('0x0'));var FaxInteraction=require(_0x2a9d('0x1'))['db'][_0x2a9d('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x2a9d('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2a9d('0x4')](0x0);var events={'afterCreate':_0x2a9d('0x5'),'afterUpdate':_0x2a9d('0x6'),'afterDestroy':_0x2a9d('0x7')};function emitEvent(_0x5d5072){return function(_0x283b43,_0xe6f0c8,_0x16e1bb){_0x283b43[_0x2a9d('0x8')]({'attributes':['id'],'raw':!![]})[_0x2a9d('0x9')](function(_0x5a5776){_0x283b43[_0x2a9d('0xa')](_0x2a9d('0xb'),_0x5a5776[_0x2a9d('0xc')](function(_0x66d539){return{'id':_0x66d539['id']};}));return FaxMessage[_0x2a9d('0xd')]({'where':{'FaxInteractionId':_0x283b43['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2a9d('0x9')](function(_0x4726c7){_0x283b43[_0x2a9d('0xa')](_0x2a9d('0xe'),_0x4726c7[_0x2a9d('0xf')]);FaxInteractionEvents[_0x2a9d('0x10')](_0x5d5072+':'+_0x283b43['id'],_0x283b43);FaxInteractionEvents[_0x2a9d('0x10')](_0x5d5072,_0x283b43);_0x16e1bb(null);})[_0x2a9d('0x11')](_0x16e1bb(null));};}for(var e in events){if(events[_0x2a9d('0x12')](e)){var event=events[e];FaxInteraction[_0x2a9d('0x13')](e,emitEvent(event));}}module[_0x2a9d('0x14')]=FaxInteractionEvents; \ No newline at end of file +var _0x2ac5=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage'];(function(_0x17de8f,_0x2d5177){var _0xc19ec4=function(_0x3424c0){while(--_0x3424c0){_0x17de8f['push'](_0x17de8f['shift']());}};_0xc19ec4(++_0x2d5177);}(_0x2ac5,0x152));var _0x52ac=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0x2ac5[_0x1c0f41];return _0x369a9f;};'use strict';var EventEmitter=require(_0x52ac('0x0'));var FaxInteraction=require(_0x52ac('0x1'))['db'][_0x52ac('0x2')];var FaxMessage=require(_0x52ac('0x1'))['db'][_0x52ac('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x52ac('0x4')](0x0);var events={'afterCreate':_0x52ac('0x5'),'afterUpdate':_0x52ac('0x6'),'afterDestroy':_0x52ac('0x7')};function emitEvent(_0x4b1a52){return function(_0x1d0d3d,_0x552318,_0x6d6c11){_0x1d0d3d[_0x52ac('0x8')]({'attributes':['id'],'raw':!![]})[_0x52ac('0x9')](function(_0x5e7c24){_0x1d0d3d[_0x52ac('0xa')](_0x52ac('0xb'),_0x5e7c24['map'](function(_0x1cf6b6){return{'id':_0x1cf6b6['id']};}));return FaxMessage[_0x52ac('0xc')]({'where':{'FaxInteractionId':_0x1d0d3d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x52ac('0x9')](function(_0x3c86a5){_0x1d0d3d[_0x52ac('0xa')](_0x52ac('0xd'),_0x3c86a5['length']);FaxInteractionEvents[_0x52ac('0xe')](_0x4b1a52+':'+_0x1d0d3d['id'],_0x1d0d3d);FaxInteractionEvents[_0x52ac('0xe')](_0x4b1a52,_0x1d0d3d);_0x6d6c11(null);})[_0x52ac('0xf')](_0x6d6c11(null));};}for(var e in events){if(events[_0x52ac('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x52ac('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b16ff47..a4747f0 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 _0x4727=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x101aaf,_0x2ee781){var _0x4fdf58=function(_0x47c0d5){while(--_0x47c0d5){_0x101aaf['push'](_0x101aaf['shift']());}};_0x4fdf58(++_0x2ee781);}(_0x4727,0x70));var _0x7472=function(_0x2f080a,_0xde1aee){_0x2f080a=_0x2f080a-0x0;var _0x1fdf34=_0x4727[_0x2f080a];return _0x1fdf34;};'use strict';var _=require(_0x7472('0x0'));var util=require(_0x7472('0x1'));var logger=require(_0x7472('0x2'))(_0x7472('0x3'));var moment=require(_0x7472('0x4'));var BPromise=require(_0x7472('0x5'));var rp=require(_0x7472('0x6'));var fs=require('fs');var path=require(_0x7472('0x7'));var rimraf=require('rimraf');var config=require(_0x7472('0x8'));var attributes=require(_0x7472('0x9'));module[_0x7472('0xa')]=function(_0x3ca0b3,_0x54ec7b){return _0x3ca0b3[_0x7472('0xb')](_0x7472('0xc'),attributes,{'tableName':_0x7472('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ae19f,_0x35c78e,_0x25d42c){if(_0x4ae19f['changed'](_0x7472('0xe'))){_0x4ae19f[_0x7472('0xf')]=moment()[_0x7472('0x10')](_0x7472('0x11'));}_0x25d42c(null,_0x4ae19f);}}});}; \ No newline at end of file +var _0xb4f1=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb4f1,0x115));var _0x1b4f=function(_0xf3dabf,_0x5595fa){_0xf3dabf=_0xf3dabf-0x0;var _0x23eed3=_0xb4f1[_0xf3dabf];return _0x23eed3;};'use strict';var _=require(_0x1b4f('0x0'));var util=require(_0x1b4f('0x1'));var logger=require(_0x1b4f('0x2'))(_0x1b4f('0x3'));var moment=require(_0x1b4f('0x4'));var BPromise=require(_0x1b4f('0x5'));var rp=require(_0x1b4f('0x6'));var fs=require('fs');var path=require(_0x1b4f('0x7'));var rimraf=require('rimraf');var config=require(_0x1b4f('0x8'));var attributes=require(_0x1b4f('0x9'));module[_0x1b4f('0xa')]=function(_0x80e143,_0x2826a4){return _0x80e143['define'](_0x1b4f('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7e1ef0,_0x178fa7,_0x6842e){if(_0x7e1ef0[_0x1b4f('0xc')](_0x1b4f('0xd'))){_0x7e1ef0[_0x1b4f('0xe')]=moment()[_0x1b4f('0xf')](_0x1b4f('0x10'));}_0x6842e(null,_0x7e1ef0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f42689e..d4bcae0 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 _0x44b1=['FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','UpdateFaxInteraction','AddTagsToFaxInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x44b1,0x100));var _0x144b=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x44b1[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x144b('0x0'));var util=require(_0x144b('0x1'));var moment=require(_0x144b('0x2'));var BPromise=require(_0x144b('0x3'));var rs=require(_0x144b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x144b('0x5'))(_0x144b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x144b('0x7')]['http']({'port':0x232a});config[_0x144b('0x8')]=_[_0x144b('0x9')](config[_0x144b('0x8')],{'host':_0x144b('0xa'),'port':0x18eb});var socket=require(_0x144b('0xb'))(new Redis(config['redis']));require(_0x144b('0xc'))[_0x144b('0xd')](socket);function respondWithRpcPromise(_0x147c02,_0x3c0343,_0x33fc67){return new BPromise(function(_0x147bac,_0x5ee2bd){return client[_0x144b('0xe')](_0x147c02,_0x33fc67)[_0x144b('0xf')](function(_0x53a044){logger[_0x144b('0x10')](_0x144b('0x11'),_0x3c0343,'request\x20sent');logger['debug'](_0x144b('0x12'),_0x3c0343,'request\x20sent',JSON[_0x144b('0x13')](_0x53a044));if(_0x53a044[_0x144b('0x14')]){if(_0x53a044[_0x144b('0x14')]['code']===0x1f4){logger[_0x144b('0x14')](_0x144b('0x11'),_0x3c0343,_0x53a044['error'][_0x144b('0x15')]);return _0x5ee2bd(_0x53a044['error'][_0x144b('0x15')]);}logger[_0x144b('0x14')](_0x144b('0x11'),_0x3c0343,_0x53a044[_0x144b('0x14')][_0x144b('0x15')]);return _0x147bac(_0x53a044[_0x144b('0x14')][_0x144b('0x15')]);}else{logger[_0x144b('0x10')](_0x144b('0x11'),_0x3c0343,_0x144b('0x16'));_0x147bac(_0x53a044['result'][_0x144b('0x15')]);}})[_0x144b('0x17')](function(_0x9582a5){logger[_0x144b('0x14')](_0x144b('0x11'),_0x3c0343,_0x9582a5);_0x5ee2bd(_0x9582a5);});});}exports['UpdateFaxInteraction']=function(_0x31105e){var _0x182068=this;return new Promise(function(_0x589250,_0x2f1918){return db[_0x144b('0x18')][_0x144b('0x19')](_0x31105e[_0x144b('0x1a')],{'raw':_0x31105e['options']?_0x31105e[_0x144b('0x1b')][_0x144b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31105e[_0x144b('0x1b')]?_0x31105e[_0x144b('0x1b')][_0x144b('0x1d')]||null:null,'attributes':_0x31105e[_0x144b('0x1b')]?_0x31105e[_0x144b('0x1b')][_0x144b('0x1e')]||null:null,'limit':_0x31105e[_0x144b('0x1b')]?_0x31105e['options'][_0x144b('0x1f')]||null:null})[_0x144b('0xf')](function(_0x330025){logger[_0x144b('0x10')]('UpdateFaxInteraction',_0x31105e);logger[_0x144b('0x20')](_0x144b('0x21'),_0x31105e,JSON['stringify'](_0x330025));_0x589250(_0x330025);})[_0x144b('0x17')](function(_0x43c22e){logger[_0x144b('0x14')]('UpdateFaxInteraction',_0x43c22e[_0x144b('0x15')],_0x31105e);_0x2f1918(_0x182068[_0x144b('0x14')](0x1f4,_0x43c22e[_0x144b('0x15')]));});});};exports[_0x144b('0x22')]=function(_0x309eef){return new Promise(function(_0x17569b,_0x395edd){return db[_0x144b('0x18')][_0x144b('0x23')]({'where':_0x309eef[_0x144b('0x1b')]?_0x309eef[_0x144b('0x1b')]['where']||null:null})[_0x144b('0xf')](function(_0x439efd){if(_0x439efd){return _0x439efd['addTags'](_0x309eef[_0x144b('0x1a')][_0x144b('0x24')],_[_0x144b('0x25')](_0x309eef[_0x144b('0x1a')],[_0x144b('0x24'),'id'])||{});}})['spread'](function(_0x34aaa5){logger[_0x144b('0x10')](_0x144b('0x26'),_0x309eef);logger[_0x144b('0x20')]('AddTags',_0x309eef,JSON[_0x144b('0x13')](_0x34aaa5));_0x17569b(_0x34aaa5);})['catch'](function(_0x1a4733){logger[_0x144b('0x14')]('AddTags',_0x1a4733[_0x144b('0x15')],_0x309eef);_0x395edd(_this[_0x144b('0x14')](0x1f4,_0x1a4733[_0x144b('0x15')]));});});}; \ No newline at end of file +var _0x3ce1=['omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','FaxInteraction','update','body','options','attributes','limit','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find','where','addTags','ids'];(function(_0x4ff8b4,_0xc41b9){var _0x1d78c4=function(_0x43d80b){while(--_0x43d80b){_0x4ff8b4['push'](_0x4ff8b4['shift']());}};_0x1d78c4(++_0xc41b9);}(_0x3ce1,0x174));var _0x13ce=function(_0x40ef86,_0x59688b){_0x40ef86=_0x40ef86-0x0;var _0x42fb3e=_0x3ce1[_0x40ef86];return _0x42fb3e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x13ce('0x0'));var BPromise=require(_0x13ce('0x1'));var rs=require(_0x13ce('0x2'));var fs=require('fs');var Redis=require(_0x13ce('0x3'));var db=require(_0x13ce('0x4'))['db'];var utils=require(_0x13ce('0x5'));var logger=require(_0x13ce('0x6'))(_0x13ce('0x7'));var config=require(_0x13ce('0x8'));var jayson=require(_0x13ce('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x13ce('0xa')](config[_0x13ce('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x13ce('0xc'))(new Redis(config[_0x13ce('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1e99b0,_0x428f69,_0x5ae303){return new BPromise(function(_0x3e5279,_0x33f88c){return client[_0x13ce('0xd')](_0x1e99b0,_0x5ae303)[_0x13ce('0xe')](function(_0x106716){logger[_0x13ce('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x428f69,_0x13ce('0x10'));logger[_0x13ce('0x11')](_0x13ce('0x12'),_0x428f69,_0x13ce('0x10'),JSON['stringify'](_0x106716));if(_0x106716['error']){if(_0x106716[_0x13ce('0x13')][_0x13ce('0x14')]===0x1f4){logger[_0x13ce('0x13')](_0x13ce('0x15'),_0x428f69,_0x106716[_0x13ce('0x13')][_0x13ce('0x16')]);return _0x33f88c(_0x106716[_0x13ce('0x13')]['message']);}logger[_0x13ce('0x13')](_0x13ce('0x15'),_0x428f69,_0x106716['error'][_0x13ce('0x16')]);return _0x3e5279(_0x106716[_0x13ce('0x13')][_0x13ce('0x16')]);}else{logger['info'](_0x13ce('0x15'),_0x428f69,_0x13ce('0x10'));_0x3e5279(_0x106716[_0x13ce('0x17')][_0x13ce('0x16')]);}})[_0x13ce('0x18')](function(_0x2c21b7){logger[_0x13ce('0x13')](_0x13ce('0x15'),_0x428f69,_0x2c21b7);_0x33f88c(_0x2c21b7);});});}exports['UpdateFaxInteraction']=function(_0x321cca){var _0x362cb9=this;return new Promise(function(_0x2a7949,_0x46cf76){return db[_0x13ce('0x19')][_0x13ce('0x1a')](_0x321cca[_0x13ce('0x1b')],{'raw':_0x321cca[_0x13ce('0x1c')]?_0x321cca[_0x13ce('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x321cca['options']?_0x321cca[_0x13ce('0x1c')]['where']||null:null,'attributes':_0x321cca['options']?_0x321cca[_0x13ce('0x1c')][_0x13ce('0x1d')]||null:null,'limit':_0x321cca[_0x13ce('0x1c')]?_0x321cca[_0x13ce('0x1c')][_0x13ce('0x1e')]||null:null})['then'](function(_0x4483a1){logger[_0x13ce('0xf')](_0x13ce('0x1f'),_0x321cca);logger[_0x13ce('0x11')](_0x13ce('0x1f'),_0x321cca,JSON[_0x13ce('0x20')](_0x4483a1));_0x2a7949(_0x4483a1);})[_0x13ce('0x18')](function(_0x248d91){logger[_0x13ce('0x13')](_0x13ce('0x1f'),_0x248d91['message'],_0x321cca);_0x46cf76(_0x362cb9[_0x13ce('0x13')](0x1f4,_0x248d91[_0x13ce('0x16')]));});});};exports[_0x13ce('0x21')]=function(_0x23fd74){return new Promise(function(_0x282f7c,_0x4efe16){return db[_0x13ce('0x19')][_0x13ce('0x22')]({'where':_0x23fd74[_0x13ce('0x1c')]?_0x23fd74[_0x13ce('0x1c')][_0x13ce('0x23')]||null:null})[_0x13ce('0xe')](function(_0x4338f1){if(_0x4338f1){return _0x4338f1[_0x13ce('0x24')](_0x23fd74['body'][_0x13ce('0x25')],_[_0x13ce('0x26')](_0x23fd74[_0x13ce('0x1b')],[_0x13ce('0x25'),'id'])||{});}})[_0x13ce('0x27')](function(_0x44eca4){logger[_0x13ce('0xf')](_0x13ce('0x28'),_0x23fd74);logger[_0x13ce('0x11')](_0x13ce('0x28'),_0x23fd74,JSON[_0x13ce('0x20')](_0x44eca4));_0x282f7c(_0x44eca4);})[_0x13ce('0x18')](function(_0x15481f){logger[_0x13ce('0x13')](_0x13ce('0x28'),_0x15481f['message'],_0x23fd74);_0x4efe16(_this[_0x13ce('0x13')](0x1f4,_0x15481f[_0x13ce('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0aab1c2..a47064e 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 _0x2c67=['length','./faxInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x2c67,0x101));var _0x72c6=function(_0x43056f,_0x4d9714){_0x43056f=_0x43056f-0x0;var _0xe31d0a=_0x2c67[_0x43056f];return _0xe31d0a;};'use strict';var FaxInteractionEvents=require(_0x72c6('0x0'));var events=[_0x72c6('0x1'),_0x72c6('0x2'),_0x72c6('0x3')];function createListener(_0x175cda,_0x9ae3c1){return function(_0x1d7cf5){_0x9ae3c1[_0x72c6('0x4')](_0x175cda,_0x1d7cf5);};}function removeListener(_0x1f1cc1,_0x2bd7dd){return function(){FaxInteractionEvents[_0x72c6('0x5')](_0x1f1cc1,_0x2bd7dd);};}exports[_0x72c6('0x6')]=function(_0xcafc8c){for(var _0x36f6b9=0x0,_0x565149=events[_0x72c6('0x7')];_0x36f6b9<_0x565149;_0x36f6b9++){var _0x2b836b=events[_0x36f6b9];var _0x102b5e=createListener('faxInteraction:'+_0x2b836b,_0xcafc8c);FaxInteractionEvents['on'](_0x2b836b,_0x102b5e);}}; \ No newline at end of file +var _0x073d=['update','emit','removeListener','register','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x47144b,_0x50f0c1){var _0x132297=function(_0x484b93){while(--_0x484b93){_0x47144b['push'](_0x47144b['shift']());}};_0x132297(++_0x50f0c1);}(_0x073d,0x1e5));var _0xd073=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x073d[_0x3712e2];return _0x1faff4;};'use strict';var FaxInteractionEvents=require(_0xd073('0x0'));var events=[_0xd073('0x1'),_0xd073('0x2'),_0xd073('0x3')];function createListener(_0x3cc57b,_0x2510e6){return function(_0x2b0453){_0x2510e6[_0xd073('0x4')](_0x3cc57b,_0x2b0453);};}function removeListener(_0x2dcdd0,_0x26b8da){return function(){FaxInteractionEvents[_0xd073('0x5')](_0x2dcdd0,_0x26b8da);};}exports[_0xd073('0x6')]=function(_0x10368c){for(var _0x167ef0=0x0,_0x24a766=events['length'];_0x167ef0<_0x24a766;_0x167ef0++){var _0x30149d=events[_0x167ef0];var _0x37f8fa=createListener(_0xd073('0x7')+_0x30149d,_0x10368c);FaxInteractionEvents['on'](_0x30149d,_0x37f8fa);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 993ad95..0f8a9df 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 _0xa234=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./faxInteraction.controller'];(function(_0x310d56,_0x581328){var _0x8759c7=function(_0x2eafc5){while(--_0x2eafc5){_0x310d56['push'](_0x310d56['shift']());}};_0x8759c7(++_0x581328);}(_0xa234,0x142));var _0x4a23=function(_0x45bdff,_0x49e859){_0x45bdff=_0x45bdff-0x0;var _0x249d50=_0xa234[_0x45bdff];return _0x249d50;};'use strict';var multer=require(_0x4a23('0x0'));var util=require(_0x4a23('0x1'));var path=require(_0x4a23('0x2'));var timeout=require(_0x4a23('0x3'));var express=require(_0x4a23('0x4'));var router=express['Router']();var fs_extra=require(_0x4a23('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4a23('0x6'));var config=require('../../config/environment');var controller=require(_0x4a23('0x7'));router[_0x4a23('0x8')]('/',auth[_0x4a23('0x9')](),controller[_0x4a23('0xa')]);router[_0x4a23('0x8')](_0x4a23('0xb'),auth['isAuthenticated'](),controller[_0x4a23('0xc')]);router[_0x4a23('0x8')](_0x4a23('0xd'),auth[_0x4a23('0x9')](),controller[_0x4a23('0xe')]);router[_0x4a23('0x8')](_0x4a23('0xf'),auth[_0x4a23('0x9')](),controller[_0x4a23('0x10')]);router[_0x4a23('0x8')](_0x4a23('0x11'),auth['isAuthenticated'](),controller[_0x4a23('0x12')]);router[_0x4a23('0x13')]('/',auth[_0x4a23('0x9')](),controller['create']);router[_0x4a23('0x13')](_0x4a23('0xf'),auth[_0x4a23('0x9')](),controller[_0x4a23('0x14')]);router['post'](_0x4a23('0x15'),auth[_0x4a23('0x9')](),interaction[_0x4a23('0x16')](_0x4a23('0x17'),'faxinteraction:addtags'),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x4a23('0x16')](_0x4a23('0x17'),_0x4a23('0x18')),controller[_0x4a23('0x19')]);router['delete'](_0x4a23('0xd'),auth['isAuthenticated'](),interaction[_0x4a23('0x16')](_0x4a23('0x17'),_0x4a23('0x1a')),controller[_0x4a23('0x1b')]);router[_0x4a23('0x1c')](_0x4a23('0x15'),auth['isAuthenticated'](),controller[_0x4a23('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x02ea=['exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags'];(function(_0x12ef2e,_0x412417){var _0x582975=function(_0x1cdd64){while(--_0x1cdd64){_0x12ef2e['push'](_0x12ef2e['shift']());}};_0x582975(++_0x412417);}(_0x02ea,0x135));var _0xa02e=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x02ea[_0x1ed116];return _0x574066;};'use strict';var multer=require('multer');var util=require(_0xa02e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa02e('0x1')]();var fs_extra=require(_0xa02e('0x2'));var auth=require(_0xa02e('0x3'));var interaction=require(_0xa02e('0x4'));var config=require(_0xa02e('0x5'));var controller=require('./faxInteraction.controller');router[_0xa02e('0x6')]('/',auth[_0xa02e('0x7')](),controller['index']);router[_0xa02e('0x6')]('/describe',auth[_0xa02e('0x7')](),controller['describe']);router[_0xa02e('0x6')](_0xa02e('0x8'),auth[_0xa02e('0x7')](),controller[_0xa02e('0x9')]);router[_0xa02e('0x6')](_0xa02e('0xa'),auth['isAuthenticated'](),controller[_0xa02e('0xb')]);router[_0xa02e('0x6')]('/:id/download',auth[_0xa02e('0x7')](),controller[_0xa02e('0xc')]);router[_0xa02e('0xd')]('/',auth['isAuthenticated'](),controller[_0xa02e('0xe')]);router['post'](_0xa02e('0xa'),auth['isAuthenticated'](),controller[_0xa02e('0xf')]);router[_0xa02e('0xd')](_0xa02e('0x10'),auth[_0xa02e('0x7')](),interaction['tracked'](_0xa02e('0x11'),_0xa02e('0x12')),controller[_0xa02e('0x13')]);router[_0xa02e('0x14')](_0xa02e('0x8'),auth[_0xa02e('0x7')](),interaction['tracked']('fax',_0xa02e('0x15')),controller[_0xa02e('0x16')]);router[_0xa02e('0x17')](_0xa02e('0x8'),auth[_0xa02e('0x7')](),interaction['tracked'](_0xa02e('0x11'),_0xa02e('0x18')),controller[_0xa02e('0x19')]);router[_0xa02e('0x17')](_0xa02e('0x10'),auth['isAuthenticated'](),controller[_0xa02e('0x1a')]);module[_0xa02e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c4dc79f..0815e77 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 _0xcea5=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x14f297,_0x410dd3){var _0x308913=function(_0x2e33b3){while(--_0x2e33b3){_0x14f297['push'](_0x14f297['shift']());}};_0x308913(++_0x410dd3);}(_0xcea5,0xed));var _0x5cea=function(_0x369325,_0x50fc41){_0x369325=_0x369325-0x0;var _0x5bb519=_0xcea5[_0x369325];return _0x5bb519;};'use strict';var Sequelize=require(_0x5cea('0x0'));module[_0x5cea('0x1')]={'body':{'type':Sequelize[_0x5cea('0x2')](_0x5cea('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5cea('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5cea('0x5')),'defaultValue':_0x5cea('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5cea('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x5cea('0x6')]}}; \ No newline at end of file +var _0x8f37=['TEXT','ENUM','out','DATE','sequelize','exports'];(function(_0x3f7356,_0x2c907f){var _0x52b78a=function(_0x2aa045){while(--_0x2aa045){_0x3f7356['push'](_0x3f7356['shift']());}};_0x52b78a(++_0x2c907f);}(_0x8f37,0x190));var _0x78f3=function(_0x5ec015,_0x1fb586){_0x5ec015=_0x5ec015-0x0;var _0x26d841=_0x8f37[_0x5ec015];return _0x26d841;};'use strict';var Sequelize=require(_0x78f3('0x0'));module[_0x78f3('0x1')]={'body':{'type':Sequelize[_0x78f3('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x78f3('0x3')]('in',_0x78f3('0x4')),'defaultValue':_0x78f3('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x78f3('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index f31f940..480b812 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 _0x53a6=['localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','name','send','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','sort','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','fields','length','merge','find','body','fax-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','event','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','QueryTypes','channel','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','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','redis'];(function(_0x323255,_0x10d00c){var _0x2eb6bd=function(_0x7156a){while(--_0x7156a){_0x323255['push'](_0x323255['shift']());}};_0x2eb6bd(++_0x10d00c);}(_0x53a6,0x75));var _0x653a=function(_0x517cb6,_0x12f9b2){_0x517cb6=_0x517cb6-0x0;var _0x424563=_0x53a6[_0x517cb6];return _0x424563;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x653a('0x0'));var jsonpatch=require(_0x653a('0x1'));var rp=require(_0x653a('0x2'));var moment=require('moment');var BPromise=require(_0x653a('0x3'));var Mustache=require(_0x653a('0x4'));var util=require('util');var path=require(_0x653a('0x5'));var sox=require(_0x653a('0x6'));var csv=require(_0x653a('0x7'));var ejs=require(_0x653a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x653a('0x9'));var crypto=require(_0x653a('0xa'));var jsforce=require(_0x653a('0xb'));var deskjs=require(_0x653a('0xc'));var toCsv=require(_0x653a('0x7'));var querystring=require(_0x653a('0xd'));var Papa=require(_0x653a('0xe'));var Redis=require(_0x653a('0xf'));var authService=require(_0x653a('0x10'));var qs=require(_0x653a('0x11'));var as=require(_0x653a('0x12'));var hardwareService=require(_0x653a('0x13'));var logger=require(_0x653a('0x14'))('api');var utils=require(_0x653a('0x15'));var config=require(_0x653a('0x16'));var licenseUtil=require(_0x653a('0x17'));var db=require('../../mysqldb')['db'];config[_0x653a('0x18')]=_['defaults'](config[_0x653a('0x18')],{'host':_0x653a('0x19'),'port':0x18eb});var socket=require(_0x653a('0x1a'))(new Redis(config[_0x653a('0x18')]));require(_0x653a('0x1b'))[_0x653a('0x1c')](socket);var jayson=require(_0x653a('0x1d'));var client=jayson[_0x653a('0x1e')][_0x653a('0x1f')]({'port':0x232c});var client9002=jayson[_0x653a('0x1e')][_0x653a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x136bce,_0x5b58f4,_0x212f0e,_0x34de95){return new BPromise(function(_0x214401,_0x227dc5){var _0x521654=_0x34de95||client;return _0x521654[_0x653a('0x20')](_0x136bce,_0x212f0e)['then'](function(_0xb7e7f9){logger[_0x653a('0x21')]('FaxMessage,\x20%s,\x20%s',_0x5b58f4,'request\x20sent');logger[_0x653a('0x22')](_0x653a('0x23'),_0x5b58f4,_0x653a('0x24'),JSON[_0x653a('0x25')](_0xb7e7f9));if(_0xb7e7f9[_0x653a('0x26')]){if(_0xb7e7f9[_0x653a('0x26')][_0x653a('0x27')]===0x1f4){logger[_0x653a('0x26')]('FaxMessage,\x20%s,\x20%s',_0x5b58f4,_0xb7e7f9[_0x653a('0x26')][_0x653a('0x28')]);return _0x227dc5(_0xb7e7f9['error'][_0x653a('0x28')]);}logger[_0x653a('0x26')](_0x653a('0x29'),_0x5b58f4,_0xb7e7f9['error'][_0x653a('0x28')]);return _0x214401(_0xb7e7f9[_0x653a('0x26')][_0x653a('0x28')]);}else{logger[_0x653a('0x21')](_0x653a('0x29'),_0x5b58f4,_0x653a('0x24'));_0x214401(_0xb7e7f9[_0x653a('0x2a')]['message']);}})['catch'](function(_0x4b2ced){logger[_0x653a('0x26')](_0x653a('0x29'),_0x5b58f4,_0x4b2ced);_0x227dc5(_0x4b2ced);});});}function respondWithStatusCode(_0x2d31b0,_0x4bde7d){_0x4bde7d=_0x4bde7d||0xcc;return function(_0x40ba86){if(_0x40ba86){return _0x2d31b0[_0x653a('0x2b')](_0x4bde7d);}return _0x2d31b0[_0x653a('0x2c')](_0x4bde7d)['end']();};}function respondWithResult(_0xa14e43,_0xed2d1d){_0xed2d1d=_0xed2d1d||0xc8;return function(_0x23a475){if(_0x23a475){return _0xa14e43[_0x653a('0x2c')](_0xed2d1d)[_0x653a('0x2d')](_0x23a475);}};}function respondWithFilteredResult(_0x44dd4b,_0x2e69e4){return function(_0x255a98){if(_0x255a98){var _0x4a42ad=typeof _0x2e69e4['offset']===_0x653a('0x2e')&&typeof _0x2e69e4[_0x653a('0x2f')]===_0x653a('0x2e');var _0x5b2a7f=_0x255a98[_0x653a('0x30')];var _0xf679da=_0x4a42ad?0x0:_0x2e69e4['offset'];var _0x108f3=_0x4a42ad?_0x255a98[_0x653a('0x30')]:_0x2e69e4[_0x653a('0x31')]+_0x2e69e4[_0x653a('0x2f')];var _0x28c654;if(_0x108f3>=_0x5b2a7f){_0x108f3=_0x5b2a7f;_0x28c654=0xc8;}else{_0x28c654=0xce;}_0x44dd4b['status'](_0x28c654);return _0x44dd4b[_0x653a('0x32')](_0x653a('0x33'),_0xf679da+'-'+_0x108f3+'/'+_0x5b2a7f)['json'](_0x255a98);}return null;};}function patchUpdates(_0x2118c9){return function(_0x27e2bf){try{jsonpatch['apply'](_0x27e2bf,_0x2118c9,!![]);}catch(_0x67dc19){return BPromise[_0x653a('0x34')](_0x67dc19);}return _0x27e2bf[_0x653a('0x35')]();};}function saveUpdates(_0x2e651f,_0x305251){return function(_0x24fd08){if(_0x24fd08){return _0x24fd08[_0x653a('0x36')](_0x2e651f)['then'](function(_0xdc443f){return _0xdc443f;});}return null;};}function removeEntity(_0x2c4136,_0x92c07f){return function(_0xcfb9cc){if(_0xcfb9cc){return _0xcfb9cc[_0x653a('0x37')]()[_0x653a('0x38')](function(){_0x2c4136[_0x653a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x109138,_0x14e873){return function(_0xd3ef88){if(!_0xd3ef88){_0x109138['sendStatus'](0x194);}return _0xd3ef88;};}function handleError(_0x3de3ce,_0x242024){_0x242024=_0x242024||0x1f4;return function(_0x337f05){logger['error'](_0x337f05['stack']);if(_0x337f05[_0x653a('0x39')]){delete _0x337f05[_0x653a('0x39')];}_0x3de3ce[_0x653a('0x2c')](_0x242024)[_0x653a('0x3a')](_0x337f05);};}exports['index']=function(_0x3448e5,_0x231c8c){var _0x15fddc={},_0x5bb6cc={},_0x55646f={'count':0x0,'rows':[]};var _0x2f5a97=_[_0x653a('0x3b')](db[_0x653a('0x3c')][_0x653a('0x3d')],function(_0x29bf7a){return{'name':_0x29bf7a[_0x653a('0x3e')],'type':_0x29bf7a[_0x653a('0x3f')][_0x653a('0x40')]};});_0x5bb6cc[_0x653a('0x41')]=_[_0x653a('0x3b')](_0x2f5a97,_0x653a('0x39'));_0x5bb6cc[_0x653a('0x42')]=_['keys'](_0x3448e5[_0x653a('0x42')]);_0x5bb6cc[_0x653a('0x43')]=_[_0x653a('0x44')](_0x5bb6cc[_0x653a('0x41')],_0x5bb6cc[_0x653a('0x42')]);_0x15fddc[_0x653a('0x45')]=_[_0x653a('0x44')](_0x5bb6cc['model'],qs['fields'](_0x3448e5[_0x653a('0x42')]['fields']));_0x15fddc[_0x653a('0x45')]=_0x15fddc['attributes']['length']?_0x15fddc[_0x653a('0x45')]:_0x5bb6cc[_0x653a('0x41')];if(!_0x3448e5[_0x653a('0x42')][_0x653a('0x46')]('nolimit')){_0x15fddc[_0x653a('0x2f')]=qs['limit'](_0x3448e5[_0x653a('0x42')][_0x653a('0x2f')]);_0x15fddc['offset']=qs[_0x653a('0x31')](_0x3448e5[_0x653a('0x42')][_0x653a('0x31')]);}_0x15fddc['order']=qs['sort'](_0x3448e5[_0x653a('0x42')][_0x653a('0x47')]);_0x15fddc['where']=qs[_0x653a('0x43')](_['pick'](_0x3448e5['query'],_0x5bb6cc[_0x653a('0x43')]),_0x2f5a97);if(_0x3448e5['query']['filter']){_0x15fddc[_0x653a('0x48')]=_['merge'](_0x15fddc[_0x653a('0x48')],{'$or':_[_0x653a('0x3b')](_0x2f5a97,function(_0x1129bb){if(_0x1129bb['type']!==_0x653a('0x49')){var _0x406fc4={};_0x406fc4[_0x1129bb[_0x653a('0x39')]]={'$like':'%'+_0x3448e5[_0x653a('0x42')]['filter']+'%'};return _0x406fc4;}})});}_0x15fddc=_['merge']({},_0x15fddc,_0x3448e5[_0x653a('0x4a')]);var _0x3d2916={'where':_0x15fddc[_0x653a('0x48')]};return db[_0x653a('0x3c')][_0x653a('0x30')](_0x3d2916)[_0x653a('0x38')](function(_0x7db4dc){_0x55646f[_0x653a('0x30')]=_0x7db4dc;if(_0x3448e5['query'][_0x653a('0x4b')]){_0x15fddc[_0x653a('0x4c')]=[{'all':!![]}];}return db['FaxMessage'][_0x653a('0x4d')](_0x15fddc);})['then'](function(_0x3a3919){_0x55646f[_0x653a('0x4e')]=_0x3a3919;return _0x55646f;})[_0x653a('0x38')](respondWithFilteredResult(_0x231c8c,_0x15fddc))[_0x653a('0x4f')](handleError(_0x231c8c,null));};exports['show']=function(_0x5872d0,_0x227353){var _0x33f017={'raw':!![],'where':{'id':_0x5872d0[_0x653a('0x50')]['id']}},_0x2022cd={};_0x2022cd['model']=_['keys'](db[_0x653a('0x3c')]['rawAttributes']);_0x2022cd[_0x653a('0x42')]=_[_0x653a('0x51')](_0x5872d0[_0x653a('0x42')]);_0x2022cd[_0x653a('0x43')]=_['intersection'](_0x2022cd[_0x653a('0x41')],_0x2022cd['query']);_0x33f017[_0x653a('0x45')]=_[_0x653a('0x44')](_0x2022cd[_0x653a('0x41')],qs[_0x653a('0x52')](_0x5872d0['query'][_0x653a('0x52')]));_0x33f017[_0x653a('0x45')]=_0x33f017['attributes'][_0x653a('0x53')]?_0x33f017['attributes']:_0x2022cd[_0x653a('0x41')];if(_0x5872d0[_0x653a('0x42')][_0x653a('0x4b')]){_0x33f017['include']=[{'all':!![]}];}_0x33f017=_[_0x653a('0x54')]({},_0x33f017,_0x5872d0[_0x653a('0x4a')]);return db['FaxMessage'][_0x653a('0x55')](_0x33f017)[_0x653a('0x38')](handleEntityNotFound(_0x227353,null))[_0x653a('0x38')](respondWithResult(_0x227353,null))[_0x653a('0x4f')](handleError(_0x227353,null));};exports[_0x653a('0x36')]=function(_0x957ce0,_0x44b0c7){if(_0x957ce0[_0x653a('0x56')]['id']){delete _0x957ce0['body']['id'];}return db[_0x653a('0x3c')][_0x653a('0x55')]({'where':{'id':_0x957ce0[_0x653a('0x50')]['id']}})[_0x653a('0x38')](handleEntityNotFound(_0x44b0c7,null))[_0x653a('0x38')](saveUpdates(_0x957ce0[_0x653a('0x56')],null))[_0x653a('0x38')](respondWithResult(_0x44b0c7,null))[_0x653a('0x4f')](handleError(_0x44b0c7,null));};exports['destroy']=function(_0xddc599,_0x10eb53){return db[_0x653a('0x3c')]['find']({'where':{'id':_0xddc599[_0x653a('0x50')]['id']}})[_0x653a('0x38')](handleEntityNotFound(_0x10eb53,null))['then'](removeEntity(_0x10eb53,null))[_0x653a('0x4f')](handleError(_0x10eb53,null));};exports['describe']=function(_0x31f30a,_0x5bbbe8){return db[_0x653a('0x3c')]['describe']()[_0x653a('0x38')](respondWithResult(_0x5bbbe8,null))[_0x653a('0x4f')](handleError(_0x5bbbe8,null));};var interaction_log=require(_0x653a('0x14'))(_0x653a('0x57'));exports[_0x653a('0x58')]=function(_0x2f7172,_0x442c97,_0x2ecd5c){var _0x16c5be={'agent':{},'channel':'fax'};if(_0x2f7172[_0x653a('0x56')]['id']){delete _0x2f7172[_0x653a('0x56')]['id'];}_0x2f7172[_0x653a('0x56')]['read']=!![];_0x2f7172[_0x653a('0x56')]['readAt']=moment()[_0x653a('0x59')](_0x653a('0x5a'));_0x2f7172[_0x653a('0x56')][_0x653a('0x5b')]=_0x2f7172[_0x653a('0x56')][_0x653a('0x5b')]||_0x2f7172['user']['id'];_0x16c5be[_0x653a('0x5c')]['id']=_0x2f7172[_0x653a('0x56')][_0x653a('0x5b')];return db[_0x653a('0x3c')]['find']({'where':{'id':_0x2f7172[_0x653a('0x50')]['id'],'UserId':null}})[_0x653a('0x38')](handleEntityNotFound(_0x442c97,null))[_0x653a('0x38')](saveUpdates(_0x2f7172[_0x653a('0x56')],null))[_0x653a('0x38')](function(_0x4962bc){if(_0x4962bc){_0x16c5be['message']=_0x4962bc[_0x653a('0x5d')]({'plain':!![]});return db['FaxInteraction'][_0x653a('0x55')]({'where':{'id':_0x4962bc[_0x653a('0x5e')]}});}return null;})[_0x653a('0x38')](handleEntityNotFound(_0x442c97,null))[_0x653a('0x38')](function(_0x34ba91){if(_0x34ba91){return _0x34ba91[_0x653a('0x36')]({'UserId':_0x2f7172['body'][_0x653a('0x5b')],'read1stAt':_[_0x653a('0x5f')](_0x34ba91[_0x653a('0x60')])?moment()[_0x653a('0x59')](_0x653a('0x5a')):undefined});}return null;})['then'](function(_0x5c065d){if(_0x5c065d){_0x16c5be[_0x653a('0x61')]=_0x5c065d[_0x653a('0x5d')]({'plain':!![]});interaction_log[_0x653a('0x21')](_0x653a('0x62'),_0x2f7172[_0x653a('0x63')]['id'],_0x2f7172[_0x653a('0x63')][_0x653a('0x39')],_0x2f7172['user'][_0x653a('0x64')],_0x16c5be[_0x653a('0x61')]['id'],_0x2f7172[_0x653a('0x56')]?JSON[_0x653a('0x25')](_0x2f7172[_0x653a('0x56')]):_0x653a('0x65'));return respondWithRpcPromise(_0x653a('0x66'),_0x653a('0x67'),_0x16c5be);}return null;})[_0x653a('0x38')](function(_0x380009){var _0x4c9c4e=_0x653a('0x68')+_0x380009['message']['ContactId'];return db[_0x653a('0x69')][_0x653a('0x42')](_0x4c9c4e,{'type':db[_0x653a('0x6a')]['QueryTypes'][_0x653a('0x6b')],'raw':!![]})[_0x653a('0x38')](function(_0x1670a9){return _0x1670a9;});})[_0x653a('0x38')](function(_0x15f06a){if(_0x15f06a){_0x16c5be[_0x653a('0x28')][_0x653a('0x6c')]=_0x15f06a[0x0];if(!_0x2f7172['body'][_0x653a('0x5b')])return;return db[_0x653a('0x6d')][_0x653a('0x55')]({'where':{'id':_0x2f7172[_0x653a('0x56')][_0x653a('0x5b')],'role':'agent'},'attributes':['id',_0x653a('0x39'),_0x653a('0x6e'),_0x653a('0x6f'),_0x653a('0x70')],'raw':!![]});}return null;})[_0x653a('0x38')](function(_0x3938f6){if(!_0x3938f6)return null;_0x16c5be['message'][_0x653a('0x5c')]=_0x3938f6;return _0x16c5be;})[_0x653a('0x38')](function(_0x4b836a){if(_0x4b836a){if(_0x2f7172[_0x653a('0x56')]['manual']){_0x16c5be[_0x653a('0x28')][_0x653a('0x71')]=util['format'](_0x653a('0x72'),_0x2f7172[_0x653a('0x63')][_0x653a('0x39')]);_0x16c5be[_0x653a('0x28')]['channel']=_0x16c5be['channel'];_0x16c5be['message'][_0x653a('0x73')]=_0x653a('0x58');return respondWithRpcPromise(_0x653a('0x74'),_0x653a('0x74'),{'event':_0x653a('0x75'),'message':_0x16c5be[_0x653a('0x28')]},client9002)['then'](function(){return _0x16c5be;});}return _0x16c5be;}return null;})['then'](respondWithResult(_0x442c97,null))[_0x653a('0x4f')](handleError(_0x442c97,null));};var interaction_log=require(_0x653a('0x14'))('fax-interactions');exports[_0x653a('0x34')]=function(_0x5e4895,_0x54ae47,_0x248115){var _0x2e681c={'agent':{},'channel':_0x653a('0x76')};if(_0x5e4895[_0x653a('0x56')]['id']){delete _0x5e4895[_0x653a('0x56')]['id'];}_0x5e4895[_0x653a('0x56')][_0x653a('0x5b')]=_0x5e4895[_0x653a('0x56')][_0x653a('0x5b')]||_0x5e4895['user']['id'];_0x2e681c[_0x653a('0x5c')]['id']=_0x5e4895[_0x653a('0x56')][_0x653a('0x5b')];return db[_0x653a('0x3c')][_0x653a('0x55')]({'where':{'id':_0x5e4895[_0x653a('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x54ae47,null))['then'](function(_0x368a44){if(_0x368a44){_0x2e681c['message']=_0x368a44['get']({'plain':!![]});return db[_0x653a('0x77')]['find']({'where':{'id':_0x368a44['FaxInteractionId']}});}return null;})[_0x653a('0x38')](handleEntityNotFound(_0x54ae47,null))['then'](function(_0x1b47f4){if(_0x1b47f4){_0x2e681c['interaction']=_0x1b47f4[_0x653a('0x5d')]({'plain':!![]});interaction_log['info'](_0x653a('0x78'),_0x5e4895[_0x653a('0x63')]['id'],_0x5e4895['user']['name'],_0x5e4895['user'][_0x653a('0x64')],_0x2e681c[_0x653a('0x61')]['id'],_0x5e4895['body']?JSON[_0x653a('0x25')](_0x5e4895[_0x653a('0x56')]):_0x653a('0x65'));return respondWithRpcPromise(_0x653a('0x79'),_0x653a('0x7a'),_0x2e681c);}return null;})[_0x653a('0x38')](function(_0x42fecf){var _0x2afdfb=_0x653a('0x68')+_0x42fecf[_0x653a('0x28')][_0x653a('0x7b')];return db[_0x653a('0x69')][_0x653a('0x42')](_0x2afdfb,{'type':db[_0x653a('0x6a')][_0x653a('0x7c')][_0x653a('0x6b')],'raw':!![]})[_0x653a('0x38')](function(_0x4385e0){return _0x4385e0;});})[_0x653a('0x38')](function(_0x2bc1df){if(_0x2bc1df){_0x2e681c[_0x653a('0x28')][_0x653a('0x6c')]=_0x2bc1df[0x0];if(!_0x5e4895['body'][_0x653a('0x5b')])return;return db[_0x653a('0x6d')][_0x653a('0x55')]({'where':{'id':_0x5e4895['body'][_0x653a('0x5b')],'role':'agent'},'attributes':['id','name',_0x653a('0x6e'),_0x653a('0x6f'),'internal'],'raw':!![]});}return null;})[_0x653a('0x38')](function(_0x349ce9){if(!_0x349ce9)return null;_0x2e681c['message'][_0x653a('0x5c')]=_0x349ce9;return _0x2e681c;})[_0x653a('0x38')](function(_0x61afa1){if(_0x61afa1){_0x61afa1['message']['interface']=util[_0x653a('0x59')]('SIP/%s',_0x5e4895[_0x653a('0x63')][_0x653a('0x39')]);_0x61afa1[_0x653a('0x28')][_0x653a('0x7d')]=_0x2e681c[_0x653a('0x7d')];_0x61afa1[_0x653a('0x28')][_0x653a('0x73')]=_0x653a('0x34');respondWithRpcPromise(_0x653a('0x74'),_0x653a('0x74'),{'event':_0x653a('0x7e'),'message':_0x61afa1[_0x653a('0x28')]},client9002);return _0x2e681c;}return null;})[_0x653a('0x38')](respondWithResult(_0x54ae47,null))['catch'](handleError(_0x54ae47,null));};exports[_0x653a('0x7f')]=function(_0x44b3c2,_0x1e69e7){var _0x3973cb;return db[_0x653a('0x3c')][_0x653a('0x7f')](_0x44b3c2['body'],{})[_0x653a('0x38')](function(_0x2b4bc1){_0x3973cb=_0x2b4bc1;return db[_0x653a('0x80')][_0x653a('0x81')]({'where':{'id':_0x3973cb[_0x653a('0x7b')]}});})[_0x653a('0x38')](function(_0x56fd24){if(_['isNil'](_0x56fd24)){return;}else{_0x3973cb[_0x653a('0x76')]=_0x56fd24[_0x653a('0x76')];return db['Attachment']['findOne']({'where':{'id':_0x3973cb[_0x653a('0x82')]}});}})[_0x653a('0x38')](function(_0x15b988){return respondWithRpcPromise(_0x653a('0x83'),_0x653a('0x83'),{'FaxAccountId':_[_0x653a('0x5f')](_0x44b3c2['body'])?undefined:_0x44b3c2['body'][_0x653a('0x84')],'path':_[_0x653a('0x5f')](_0x15b988)?undefined:util[_0x653a('0x59')](_0x653a('0x85'),_0x15b988[_0x653a('0x86')]),'fax':_['isNil'](_0x3973cb[_0x653a('0x76')])?undefined:_0x3973cb['fax'],'AttachmentId':_0x3973cb['AttachmentId']},client9002);})[_0x653a('0x38')](respondWithResult(_0x1e69e7,0xc9))['catch'](handleError(_0x1e69e7,null));};exports[_0x653a('0x87')]=function(_0x36f530,_0x1eafee){var _0xad0b69=path[_0x653a('0x88')](config[_0x653a('0x89')],_0x653a('0x8a'),_0x653a('0x8b'),_0x653a('0x8c'));return db[_0x653a('0x3c')]['find']({'where':{'id':_0x36f530['params']['id']},'include':[{'model':db['Attachment'],'as':_0x653a('0x8d')}]})[_0x653a('0x38')](handleEntityNotFound(_0x1eafee,null))[_0x653a('0x38')](function(_0x555a84){if(_0x555a84){return _0x1eafee[_0x653a('0x87')](path[_0x653a('0x88')](_0xad0b69,_0x555a84[_0x653a('0x8d')][_0x653a('0x86')]));}})['catch'](handleError(_0x1eafee,null));}; \ No newline at end of file +var _0xcb88=['Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','debug','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','intersection','find','body','params','describe','fax-interactions','accept','read','readAt','format','UserId','user','agent','FaxInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','fax','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','contact','internal','create'];(function(_0x31157b,_0x6b2fe1){var _0x19dd21=function(_0x1a19be){while(--_0x1a19be){_0x31157b['push'](_0x31157b['shift']());}};_0x19dd21(++_0x6b2fe1);}(_0xcb88,0x1cc));var _0x8cb8=function(_0x2c9bec,_0x1d7bd0){_0x2c9bec=_0x2c9bec-0x0;var _0x1ab136=_0xcb88[_0x2c9bec];return _0x1ab136;};'use strict';var emlformat=require(_0x8cb8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cb8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8cb8('0x2'));var BPromise=require(_0x8cb8('0x3'));var Mustache=require(_0x8cb8('0x4'));var util=require('util');var path=require(_0x8cb8('0x5'));var sox=require(_0x8cb8('0x6'));var csv=require('to-csv');var ejs=require(_0x8cb8('0x7'));var fs=require('fs');var fs_extra=require(_0x8cb8('0x8'));var _=require(_0x8cb8('0x9'));var squel=require('squel');var crypto=require(_0x8cb8('0xa'));var jsforce=require(_0x8cb8('0xb'));var deskjs=require(_0x8cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8cb8('0xd'));var Papa=require('papaparse');var Redis=require(_0x8cb8('0xe'));var authService=require(_0x8cb8('0xf'));var qs=require(_0x8cb8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cb8('0x11'));var logger=require(_0x8cb8('0x12'))(_0x8cb8('0x13'));var utils=require(_0x8cb8('0x14'));var config=require(_0x8cb8('0x15'));var licenseUtil=require(_0x8cb8('0x16'));var db=require(_0x8cb8('0x17'))['db'];config[_0x8cb8('0x18')]=_[_0x8cb8('0x19')](config['redis'],{'host':_0x8cb8('0x1a'),'port':0x18eb});var socket=require(_0x8cb8('0x1b'))(new Redis(config[_0x8cb8('0x18')]));require(_0x8cb8('0x1c'))[_0x8cb8('0x1d')](socket);var jayson=require(_0x8cb8('0x1e'));var client=jayson[_0x8cb8('0x1f')][_0x8cb8('0x20')]({'port':0x232c});var client9002=jayson[_0x8cb8('0x1f')][_0x8cb8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x50dcb0,_0x239e35,_0xf31133,_0xd864a2){return new BPromise(function(_0x43947a,_0x5bbe8e){var _0x579815=_0xd864a2||client;return _0x579815[_0x8cb8('0x21')](_0x50dcb0,_0xf31133)[_0x8cb8('0x22')](function(_0x2450f8){logger[_0x8cb8('0x23')](_0x8cb8('0x24'),_0x239e35,'request\x20sent');logger[_0x8cb8('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x239e35,_0x8cb8('0x26'),JSON['stringify'](_0x2450f8));if(_0x2450f8[_0x8cb8('0x27')]){if(_0x2450f8[_0x8cb8('0x27')][_0x8cb8('0x28')]===0x1f4){logger[_0x8cb8('0x27')](_0x8cb8('0x24'),_0x239e35,_0x2450f8[_0x8cb8('0x27')][_0x8cb8('0x29')]);return _0x5bbe8e(_0x2450f8[_0x8cb8('0x27')]['message']);}logger[_0x8cb8('0x27')](_0x8cb8('0x24'),_0x239e35,_0x2450f8[_0x8cb8('0x27')][_0x8cb8('0x29')]);return _0x43947a(_0x2450f8[_0x8cb8('0x27')][_0x8cb8('0x29')]);}else{logger[_0x8cb8('0x23')](_0x8cb8('0x24'),_0x239e35,_0x8cb8('0x26'));_0x43947a(_0x2450f8[_0x8cb8('0x2a')]['message']);}})[_0x8cb8('0x2b')](function(_0x535e08){logger[_0x8cb8('0x27')](_0x8cb8('0x24'),_0x239e35,_0x535e08);_0x5bbe8e(_0x535e08);});});}function respondWithStatusCode(_0x28ad4a,_0x4043f7){_0x4043f7=_0x4043f7||0xcc;return function(_0x4d368f){if(_0x4d368f){return _0x28ad4a[_0x8cb8('0x2c')](_0x4043f7);}return _0x28ad4a[_0x8cb8('0x2d')](_0x4043f7)[_0x8cb8('0x2e')]();};}function respondWithResult(_0x19b64b,_0x47873a){_0x47873a=_0x47873a||0xc8;return function(_0x35fc56){if(_0x35fc56){return _0x19b64b[_0x8cb8('0x2d')](_0x47873a)[_0x8cb8('0x2f')](_0x35fc56);}};}function respondWithFilteredResult(_0x5449a9,_0x34b6f3){return function(_0x50a768){if(_0x50a768){var _0x4714de=typeof _0x34b6f3[_0x8cb8('0x30')]===_0x8cb8('0x31')&&typeof _0x34b6f3['limit']===_0x8cb8('0x31');var _0xdd72fb=_0x50a768['count'];var _0xceedc=_0x4714de?0x0:_0x34b6f3[_0x8cb8('0x30')];var _0x1b8fef=_0x4714de?_0x50a768[_0x8cb8('0x32')]:_0x34b6f3[_0x8cb8('0x30')]+_0x34b6f3['limit'];var _0x5736e0;if(_0x1b8fef>=_0xdd72fb){_0x1b8fef=_0xdd72fb;_0x5736e0=0xc8;}else{_0x5736e0=0xce;}_0x5449a9['status'](_0x5736e0);return _0x5449a9[_0x8cb8('0x33')](_0x8cb8('0x34'),_0xceedc+'-'+_0x1b8fef+'/'+_0xdd72fb)['json'](_0x50a768);}return null;};}function patchUpdates(_0x41e50a){return function(_0x7420bf){try{jsonpatch[_0x8cb8('0x35')](_0x7420bf,_0x41e50a,!![]);}catch(_0x524d85){return BPromise[_0x8cb8('0x36')](_0x524d85);}return _0x7420bf[_0x8cb8('0x37')]();};}function saveUpdates(_0x2e5452,_0x4f3823){return function(_0x1c877d){if(_0x1c877d){return _0x1c877d[_0x8cb8('0x38')](_0x2e5452)[_0x8cb8('0x22')](function(_0x31b71f){return _0x31b71f;});}return null;};}function removeEntity(_0x4ea3a3,_0x106174){return function(_0x130eaf){if(_0x130eaf){return _0x130eaf[_0x8cb8('0x39')]()[_0x8cb8('0x22')](function(){_0x4ea3a3[_0x8cb8('0x2d')](0xcc)[_0x8cb8('0x2e')]();});}};}function handleEntityNotFound(_0x4321f3,_0x3d1af6){return function(_0x82216f){if(!_0x82216f){_0x4321f3['sendStatus'](0x194);}return _0x82216f;};}function handleError(_0x1e9384,_0x5c78ed){_0x5c78ed=_0x5c78ed||0x1f4;return function(_0x4699cc){logger[_0x8cb8('0x27')](_0x4699cc[_0x8cb8('0x3a')]);if(_0x4699cc[_0x8cb8('0x3b')]){delete _0x4699cc['name'];}_0x1e9384[_0x8cb8('0x2d')](_0x5c78ed)[_0x8cb8('0x3c')](_0x4699cc);};}exports[_0x8cb8('0x3d')]=function(_0x2338be,_0x5ed4c2){var _0x33929a={},_0x37ff08={},_0x3fa0f7={'count':0x0,'rows':[]};var _0x3308b8=_[_0x8cb8('0x3e')](db[_0x8cb8('0x3f')][_0x8cb8('0x40')],function(_0x3a93f2){return{'name':_0x3a93f2[_0x8cb8('0x41')],'type':_0x3a93f2[_0x8cb8('0x42')][_0x8cb8('0x43')]};});_0x37ff08[_0x8cb8('0x44')]=_[_0x8cb8('0x3e')](_0x3308b8,_0x8cb8('0x3b'));_0x37ff08[_0x8cb8('0x45')]=_[_0x8cb8('0x46')](_0x2338be[_0x8cb8('0x45')]);_0x37ff08[_0x8cb8('0x47')]=_['intersection'](_0x37ff08[_0x8cb8('0x44')],_0x37ff08['query']);_0x33929a['attributes']=_['intersection'](_0x37ff08['model'],qs[_0x8cb8('0x48')](_0x2338be[_0x8cb8('0x45')][_0x8cb8('0x48')]));_0x33929a[_0x8cb8('0x49')]=_0x33929a[_0x8cb8('0x49')][_0x8cb8('0x4a')]?_0x33929a[_0x8cb8('0x49')]:_0x37ff08['model'];if(!_0x2338be['query'][_0x8cb8('0x4b')](_0x8cb8('0x4c'))){_0x33929a[_0x8cb8('0x4d')]=qs[_0x8cb8('0x4d')](_0x2338be[_0x8cb8('0x45')]['limit']);_0x33929a['offset']=qs['offset'](_0x2338be['query'][_0x8cb8('0x30')]);}_0x33929a[_0x8cb8('0x4e')]=qs[_0x8cb8('0x4f')](_0x2338be[_0x8cb8('0x45')]['sort']);_0x33929a[_0x8cb8('0x50')]=qs[_0x8cb8('0x47')](_[_0x8cb8('0x51')](_0x2338be[_0x8cb8('0x45')],_0x37ff08[_0x8cb8('0x47')]),_0x3308b8);if(_0x2338be[_0x8cb8('0x45')][_0x8cb8('0x52')]){_0x33929a[_0x8cb8('0x50')]=_[_0x8cb8('0x53')](_0x33929a['where'],{'$or':_[_0x8cb8('0x3e')](_0x3308b8,function(_0x2a6232){if(_0x2a6232[_0x8cb8('0x42')]!==_0x8cb8('0x54')){var _0x252bb2={};_0x252bb2[_0x2a6232[_0x8cb8('0x3b')]]={'$like':'%'+_0x2338be['query'][_0x8cb8('0x52')]+'%'};return _0x252bb2;}})});}_0x33929a=_[_0x8cb8('0x53')]({},_0x33929a,_0x2338be['options']);var _0x5144d7={'where':_0x33929a[_0x8cb8('0x50')]};return db[_0x8cb8('0x3f')][_0x8cb8('0x32')](_0x5144d7)[_0x8cb8('0x22')](function(_0x1b3bbd){_0x3fa0f7['count']=_0x1b3bbd;if(_0x2338be[_0x8cb8('0x45')][_0x8cb8('0x55')]){_0x33929a['include']=[{'all':!![]}];}return db['FaxMessage'][_0x8cb8('0x56')](_0x33929a);})[_0x8cb8('0x22')](function(_0x2e5438){_0x3fa0f7['rows']=_0x2e5438;return _0x3fa0f7;})[_0x8cb8('0x22')](respondWithFilteredResult(_0x5ed4c2,_0x33929a))[_0x8cb8('0x2b')](handleError(_0x5ed4c2,null));};exports[_0x8cb8('0x57')]=function(_0x374934,_0x36002f){var _0x40e73f={'raw':!![],'where':{'id':_0x374934['params']['id']}},_0x1a8d86={};_0x1a8d86[_0x8cb8('0x44')]=_[_0x8cb8('0x46')](db[_0x8cb8('0x3f')][_0x8cb8('0x40')]);_0x1a8d86[_0x8cb8('0x45')]=_[_0x8cb8('0x46')](_0x374934[_0x8cb8('0x45')]);_0x1a8d86[_0x8cb8('0x47')]=_[_0x8cb8('0x58')](_0x1a8d86[_0x8cb8('0x44')],_0x1a8d86[_0x8cb8('0x45')]);_0x40e73f[_0x8cb8('0x49')]=_[_0x8cb8('0x58')](_0x1a8d86['model'],qs[_0x8cb8('0x48')](_0x374934[_0x8cb8('0x45')]['fields']));_0x40e73f[_0x8cb8('0x49')]=_0x40e73f[_0x8cb8('0x49')][_0x8cb8('0x4a')]?_0x40e73f['attributes']:_0x1a8d86[_0x8cb8('0x44')];if(_0x374934[_0x8cb8('0x45')][_0x8cb8('0x55')]){_0x40e73f['include']=[{'all':!![]}];}_0x40e73f=_[_0x8cb8('0x53')]({},_0x40e73f,_0x374934['options']);return db[_0x8cb8('0x3f')][_0x8cb8('0x59')](_0x40e73f)[_0x8cb8('0x22')](handleEntityNotFound(_0x36002f,null))[_0x8cb8('0x22')](respondWithResult(_0x36002f,null))[_0x8cb8('0x2b')](handleError(_0x36002f,null));};exports[_0x8cb8('0x38')]=function(_0x4fc297,_0x25a0c7){if(_0x4fc297[_0x8cb8('0x5a')]['id']){delete _0x4fc297[_0x8cb8('0x5a')]['id'];}return db[_0x8cb8('0x3f')]['find']({'where':{'id':_0x4fc297[_0x8cb8('0x5b')]['id']}})[_0x8cb8('0x22')](handleEntityNotFound(_0x25a0c7,null))[_0x8cb8('0x22')](saveUpdates(_0x4fc297[_0x8cb8('0x5a')],null))[_0x8cb8('0x22')](respondWithResult(_0x25a0c7,null))[_0x8cb8('0x2b')](handleError(_0x25a0c7,null));};exports[_0x8cb8('0x39')]=function(_0xe67399,_0x3a464d){return db[_0x8cb8('0x3f')][_0x8cb8('0x59')]({'where':{'id':_0xe67399[_0x8cb8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3a464d,null))[_0x8cb8('0x22')](removeEntity(_0x3a464d,null))[_0x8cb8('0x2b')](handleError(_0x3a464d,null));};exports['describe']=function(_0x45ad72,_0x4a9fe0){return db[_0x8cb8('0x3f')][_0x8cb8('0x5c')]()[_0x8cb8('0x22')](respondWithResult(_0x4a9fe0,null))['catch'](handleError(_0x4a9fe0,null));};var interaction_log=require(_0x8cb8('0x12'))(_0x8cb8('0x5d'));exports[_0x8cb8('0x5e')]=function(_0x2e5d55,_0xeeb13,_0x177394){var _0x5780e5={'agent':{},'channel':'fax'};if(_0x2e5d55[_0x8cb8('0x5a')]['id']){delete _0x2e5d55['body']['id'];}_0x2e5d55[_0x8cb8('0x5a')][_0x8cb8('0x5f')]=!![];_0x2e5d55[_0x8cb8('0x5a')][_0x8cb8('0x60')]=moment()[_0x8cb8('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e5d55[_0x8cb8('0x5a')][_0x8cb8('0x62')]=_0x2e5d55['body'][_0x8cb8('0x62')]||_0x2e5d55[_0x8cb8('0x63')]['id'];_0x5780e5[_0x8cb8('0x64')]['id']=_0x2e5d55[_0x8cb8('0x5a')][_0x8cb8('0x62')];return db[_0x8cb8('0x3f')][_0x8cb8('0x59')]({'where':{'id':_0x2e5d55[_0x8cb8('0x5b')]['id'],'UserId':null}})[_0x8cb8('0x22')](handleEntityNotFound(_0xeeb13,null))['then'](saveUpdates(_0x2e5d55['body'],null))[_0x8cb8('0x22')](function(_0x5a2b75){if(_0x5a2b75){_0x5780e5[_0x8cb8('0x29')]=_0x5a2b75['get']({'plain':!![]});return db[_0x8cb8('0x65')][_0x8cb8('0x59')]({'where':{'id':_0x5a2b75['FaxInteractionId']}});}return null;})[_0x8cb8('0x22')](handleEntityNotFound(_0xeeb13,null))[_0x8cb8('0x22')](function(_0x26c1c5){if(_0x26c1c5){return _0x26c1c5[_0x8cb8('0x38')]({'UserId':_0x2e5d55['body'][_0x8cb8('0x62')],'read1stAt':_[_0x8cb8('0x66')](_0x26c1c5[_0x8cb8('0x67')])?moment()[_0x8cb8('0x61')](_0x8cb8('0x68')):undefined});}return null;})[_0x8cb8('0x22')](function(_0x1f5278){if(_0x1f5278){_0x5780e5['interaction']=_0x1f5278[_0x8cb8('0x69')]({'plain':!![]});interaction_log[_0x8cb8('0x23')](_0x8cb8('0x6a'),_0x2e5d55[_0x8cb8('0x63')]['id'],_0x2e5d55[_0x8cb8('0x63')][_0x8cb8('0x3b')],_0x2e5d55['user'][_0x8cb8('0x6b')],_0x5780e5[_0x8cb8('0x6c')]['id'],_0x2e5d55[_0x8cb8('0x5a')]?JSON['stringify'](_0x2e5d55[_0x8cb8('0x5a')]):_0x8cb8('0x6d'));return respondWithRpcPromise(_0x8cb8('0x6e'),_0x8cb8('0x6f'),_0x5780e5);}return null;})[_0x8cb8('0x22')](function(_0x30ff6a){var _0x5e2758=_0x8cb8('0x70')+_0x30ff6a[_0x8cb8('0x29')][_0x8cb8('0x71')];return db[_0x8cb8('0x72')][_0x8cb8('0x45')](_0x5e2758,{'type':db[_0x8cb8('0x73')][_0x8cb8('0x74')][_0x8cb8('0x75')],'raw':!![]})['then'](function(_0xb631dc){return _0xb631dc;});})[_0x8cb8('0x22')](function(_0x3ec6e8){if(_0x3ec6e8){_0x5780e5[_0x8cb8('0x29')]['contact']=_0x3ec6e8[0x0];if(!_0x2e5d55[_0x8cb8('0x5a')][_0x8cb8('0x62')])return;return db[_0x8cb8('0x76')][_0x8cb8('0x59')]({'where':{'id':_0x2e5d55[_0x8cb8('0x5a')][_0x8cb8('0x62')],'role':'agent'},'attributes':['id','name',_0x8cb8('0x77'),_0x8cb8('0x78'),'internal'],'raw':!![]});}return null;})[_0x8cb8('0x22')](function(_0x244b5){if(!_0x244b5)return null;_0x5780e5[_0x8cb8('0x29')][_0x8cb8('0x64')]=_0x244b5;return _0x5780e5;})[_0x8cb8('0x22')](function(_0x24e246){if(_0x24e246){if(_0x2e5d55['body'][_0x8cb8('0x79')]){_0x5780e5[_0x8cb8('0x29')][_0x8cb8('0x7a')]=util[_0x8cb8('0x61')](_0x8cb8('0x7b'),_0x2e5d55[_0x8cb8('0x63')][_0x8cb8('0x3b')]);_0x5780e5['message'][_0x8cb8('0x7c')]=_0x5780e5[_0x8cb8('0x7c')];_0x5780e5['message'][_0x8cb8('0x7d')]=_0x8cb8('0x5e');return respondWithRpcPromise(_0x8cb8('0x7e'),_0x8cb8('0x7e'),{'event':'acceptmessage','message':_0x5780e5[_0x8cb8('0x29')]},client9002)[_0x8cb8('0x22')](function(){return _0x5780e5;});}return _0x5780e5;}return null;})[_0x8cb8('0x22')](respondWithResult(_0xeeb13,null))[_0x8cb8('0x2b')](handleError(_0xeeb13,null));};var interaction_log=require('../../config/logger')(_0x8cb8('0x5d'));exports['reject']=function(_0x1599ac,_0x504eaa,_0x4ee598){var _0x4e5d7c={'agent':{},'channel':_0x8cb8('0x7f')};if(_0x1599ac[_0x8cb8('0x5a')]['id']){delete _0x1599ac[_0x8cb8('0x5a')]['id'];}_0x1599ac[_0x8cb8('0x5a')][_0x8cb8('0x62')]=_0x1599ac[_0x8cb8('0x5a')]['UserId']||_0x1599ac['user']['id'];_0x4e5d7c[_0x8cb8('0x64')]['id']=_0x1599ac[_0x8cb8('0x5a')][_0x8cb8('0x62')];return db[_0x8cb8('0x3f')][_0x8cb8('0x59')]({'where':{'id':_0x1599ac[_0x8cb8('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x504eaa,null))[_0x8cb8('0x22')](function(_0x5303fd){if(_0x5303fd){_0x4e5d7c[_0x8cb8('0x29')]=_0x5303fd['get']({'plain':!![]});return db[_0x8cb8('0x65')][_0x8cb8('0x59')]({'where':{'id':_0x5303fd[_0x8cb8('0x80')]}});}return null;})[_0x8cb8('0x22')](handleEntityNotFound(_0x504eaa,null))[_0x8cb8('0x22')](function(_0x1d381d){if(_0x1d381d){_0x4e5d7c[_0x8cb8('0x6c')]=_0x1d381d[_0x8cb8('0x69')]({'plain':!![]});interaction_log[_0x8cb8('0x23')](_0x8cb8('0x81'),_0x1599ac['user']['id'],_0x1599ac[_0x8cb8('0x63')][_0x8cb8('0x3b')],_0x1599ac[_0x8cb8('0x63')][_0x8cb8('0x6b')],_0x4e5d7c[_0x8cb8('0x6c')]['id'],_0x1599ac[_0x8cb8('0x5a')]?JSON[_0x8cb8('0x82')](_0x1599ac[_0x8cb8('0x5a')]):_0x8cb8('0x6d'));return respondWithRpcPromise(_0x8cb8('0x83'),_0x8cb8('0x84'),_0x4e5d7c);}return null;})[_0x8cb8('0x22')](function(_0x1e86b1){var _0x1560c3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1e86b1['message']['ContactId'];return db[_0x8cb8('0x72')][_0x8cb8('0x45')](_0x1560c3,{'type':db[_0x8cb8('0x73')][_0x8cb8('0x74')][_0x8cb8('0x75')],'raw':!![]})['then'](function(_0x4060d7){return _0x4060d7;});})['then'](function(_0x528dea){if(_0x528dea){_0x4e5d7c['message'][_0x8cb8('0x85')]=_0x528dea[0x0];if(!_0x1599ac[_0x8cb8('0x5a')][_0x8cb8('0x62')])return;return db[_0x8cb8('0x76')][_0x8cb8('0x59')]({'where':{'id':_0x1599ac[_0x8cb8('0x5a')][_0x8cb8('0x62')],'role':_0x8cb8('0x64')},'attributes':['id',_0x8cb8('0x3b'),'fullname',_0x8cb8('0x78'),_0x8cb8('0x86')],'raw':!![]});}return null;})[_0x8cb8('0x22')](function(_0x3cdc1c){if(!_0x3cdc1c)return null;_0x4e5d7c[_0x8cb8('0x29')][_0x8cb8('0x64')]=_0x3cdc1c;return _0x4e5d7c;})[_0x8cb8('0x22')](function(_0x505981){if(_0x505981){_0x505981[_0x8cb8('0x29')][_0x8cb8('0x7a')]=util['format'](_0x8cb8('0x7b'),_0x1599ac[_0x8cb8('0x63')][_0x8cb8('0x3b')]);_0x505981['message'][_0x8cb8('0x7c')]=_0x4e5d7c[_0x8cb8('0x7c')];_0x505981[_0x8cb8('0x29')][_0x8cb8('0x7d')]='reject';respondWithRpcPromise(_0x8cb8('0x7e'),'EventManager',{'event':'rejectmessage','message':_0x505981[_0x8cb8('0x29')]},client9002);return _0x4e5d7c;}return null;})[_0x8cb8('0x22')](respondWithResult(_0x504eaa,null))[_0x8cb8('0x2b')](handleError(_0x504eaa,null));};exports[_0x8cb8('0x87')]=function(_0x1c4300,_0xdb3fef){var _0x2b1d02;return db['FaxMessage']['create'](_0x1c4300[_0x8cb8('0x5a')],{})[_0x8cb8('0x22')](function(_0x48b557){_0x2b1d02=_0x48b557;return db['CmContact']['findOne']({'where':{'id':_0x2b1d02[_0x8cb8('0x71')]}});})[_0x8cb8('0x22')](function(_0x585880){if(_[_0x8cb8('0x66')](_0x585880)){return;}else{_0x2b1d02[_0x8cb8('0x7f')]=_0x585880['fax'];return db[_0x8cb8('0x88')][_0x8cb8('0x89')]({'where':{'id':_0x2b1d02[_0x8cb8('0x8a')]}});}})[_0x8cb8('0x22')](function(_0x51c236){return respondWithRpcPromise('SendFax',_0x8cb8('0x8b'),{'FaxAccountId':_[_0x8cb8('0x66')](_0x1c4300['body'])?undefined:_0x1c4300[_0x8cb8('0x5a')][_0x8cb8('0x8c')],'path':_[_0x8cb8('0x66')](_0x51c236)?undefined:util['format'](_0x8cb8('0x8d'),_0x51c236[_0x8cb8('0x8e')]),'fax':_['isNil'](_0x2b1d02[_0x8cb8('0x7f')])?undefined:_0x2b1d02[_0x8cb8('0x7f')],'AttachmentId':_0x2b1d02[_0x8cb8('0x8a')]},client9002);})[_0x8cb8('0x22')](respondWithResult(_0xdb3fef,0xc9))[_0x8cb8('0x2b')](handleError(_0xdb3fef,null));};exports[_0x8cb8('0x8f')]=function(_0x5befad,_0x59f035){var _0x5b2e14=path[_0x8cb8('0x90')](config[_0x8cb8('0x91')],_0x8cb8('0x92'),_0x8cb8('0x93'),_0x8cb8('0x94'));return db[_0x8cb8('0x3f')][_0x8cb8('0x59')]({'where':{'id':_0x5befad[_0x8cb8('0x5b')]['id']},'include':[{'model':db[_0x8cb8('0x88')],'as':_0x8cb8('0x88')}]})['then'](handleEntityNotFound(_0x59f035,null))[_0x8cb8('0x22')](function(_0x5e8d16){if(_0x5e8d16){return _0x59f035['download'](path[_0x8cb8('0x90')](_0x5b2e14,_0x5e8d16[_0x8cb8('0x88')][_0x8cb8('0x8e')]));}})[_0x8cb8('0x2b')](handleError(_0x59f035,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 2a3a94a..dd3f6fa 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 _0x0958=['FaxMessage','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x0958,0x7c));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x8095('0x0'));var FaxMessage=require(_0x8095('0x1'))['db'][_0x8095('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8095('0x3'),'afterUpdate':_0x8095('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56d986){return function(_0x4625ee,_0x3da09b,_0x58bdb8){FaxMessageEvents['emit'](_0x56d986+':'+_0x4625ee['id'],_0x4625ee);FaxMessageEvents[_0x8095('0x5')](_0x56d986,_0x4625ee);_0x58bdb8(null);};}for(var e in events){if(events[_0x8095('0x6')](e)){var event=events[e];FaxMessage[_0x8095('0x7')](e,emitEvent(event));}}module[_0x8095('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x292c=['hook','exports','events','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x29183b,_0x8296f3){var _0x3cdbbf=function(_0x5d3909){while(--_0x5d3909){_0x29183b['push'](_0x29183b['shift']());}};_0x3cdbbf(++_0x8296f3);}(_0x292c,0x66));var _0xc292=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x292c[_0x4e1d03];return _0x362d4b;};'use strict';var EventEmitter=require(_0xc292('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xc292('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc292('0x2')](0x0);var events={'afterCreate':_0xc292('0x3'),'afterUpdate':_0xc292('0x4'),'afterDestroy':_0xc292('0x5')};function emitEvent(_0x50b478){return function(_0x1f14f9,_0x536154,_0x516f54){FaxMessageEvents[_0xc292('0x6')](_0x50b478+':'+_0x1f14f9['id'],_0x1f14f9);FaxMessageEvents[_0xc292('0x6')](_0x50b478,_0x1f14f9);_0x516f54(null);};}for(var e in events){if(events[_0xc292('0x7')](e)){var event=events[e];FaxMessage[_0xc292('0x8')](e,emitEvent(event));}}module[_0xc292('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index af026fc..31ab81f 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 _0x7786=['FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x7786,0x12c));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6778('0x0'));var logger=require(_0x6778('0x1'))(_0x6778('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6778('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6778('0x4'));module['exports']=function(_0x40eac7,_0x162020){return _0x40eac7[_0x6778('0x5')](_0x6778('0x6'),attributes,{'tableName':_0x6778('0x7'),'paranoid':![],'indexes':[{'name':_0x6778('0x8'),'fields':[_0x6778('0x9')],'type':_0x6778('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47ea5c,_0x13c650,_0x2429e7){var _0x496245=_0x40eac7[_0x6778('0xb')];var _0x53ce74=_0x47ea5c[_0x6778('0xc')]({'plain':!![]});if(_0x53ce74[_0x6778('0xd')]['toLowerCase']()==='in'||_0x53ce74[_0x6778('0xd')][_0x6778('0xe')]()===_0x6778('0xf')&&!_0x53ce74[_0x6778('0x10')]&&!_[_0x6778('0x11')](_0x53ce74[_0x6778('0x12')])){_0x496245[_0x6778('0x13')][_0x6778('0x14')]({'where':{'id':_0x53ce74[_0x6778('0x15')]}})[_0x6778('0x16')](function(_0x3bcec5){if(_0x3bcec5){_0x3bcec5[_0x6778('0x17')]({'lastMsgAt':_0x53ce74[_0x6778('0x18')],'lastMsgDirection':_0x53ce74[_0x6778('0xd')][_0x6778('0xe')]()});}})[_0x6778('0x19')](function(_0x4056fc){console[_0x6778('0x1a')](_0x4056fc);});}_0x2429e7();}},'charset':_0x6778('0x1b'),'collate':_0x6778('0x1c')});}; \ No newline at end of file +var _0x670e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','findOne','FaxInteractionId','then','update','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x15f125,_0x2f759d){var _0x27da70=function(_0x5eac57){while(--_0x5eac57){_0x15f125['push'](_0x15f125['shift']());}};_0x27da70(++_0x2f759d);}(_0x670e,0x174));var _0xe670=function(_0x2ffac0,_0x19e68d){_0x2ffac0=_0x2ffac0-0x0;var _0x2beda9=_0x670e[_0x2ffac0];return _0x2beda9;};'use strict';var _=require(_0xe670('0x0'));var util=require(_0xe670('0x1'));var logger=require(_0xe670('0x2'))(_0xe670('0x3'));var moment=require(_0xe670('0x4'));var BPromise=require(_0xe670('0x5'));var rp=require(_0xe670('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe670('0x7'));var config=require(_0xe670('0x8'));var attributes=require(_0xe670('0x9'));module[_0xe670('0xa')]=function(_0x5d078e,_0xfa8eb7){return _0x5d078e[_0xe670('0xb')]('FaxMessage',attributes,{'tableName':_0xe670('0xc'),'paranoid':![],'indexes':[{'name':_0xe670('0xd'),'fields':[_0xe670('0xe')],'type':_0xe670('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fd14a,_0x390228,_0x2c97ea){var _0x1bf8dd=_0x5d078e[_0xe670('0x10')];var _0x50504b=_0x1fd14a[_0xe670('0x11')]({'plain':!![]});if(_0x50504b[_0xe670('0x12')]['toLowerCase']()==='in'||_0x50504b[_0xe670('0x12')]['toLowerCase']()===_0xe670('0x13')&&!_0x50504b[_0xe670('0x14')]&&!_[_0xe670('0x15')](_0x50504b[_0xe670('0x16')])){_0x1bf8dd['FaxInteraction'][_0xe670('0x17')]({'where':{'id':_0x50504b[_0xe670('0x18')]}})[_0xe670('0x19')](function(_0x544020){if(_0x544020){_0x544020[_0xe670('0x1a')]({'lastMsgAt':_0x50504b['createdAt'],'lastMsgDirection':_0x50504b[_0xe670('0x12')][_0xe670('0x1b')]()});}})[_0xe670('0x1c')](function(_0xffb54a){console['error'](_0xffb54a);});}_0x2c97ea();}},'charset':_0xe670('0x1d'),'collate':_0xe670('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 11361b9..fdb2f1f 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 _0x4bc3=['CreateFaxMessage','FaxMessage','create','body','options','raw','then','stringify','catch','UpdateFaxMessage','update','where','attributes','limit','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x4bc3[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x41b2ff,_0x5de8b5,_0x5a478d){return new BPromise(function(_0x2b8112,_0x33025c){return client[_0x34bc('0x10')](_0x41b2ff,_0x5a478d)['then'](function(_0x41960e){logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));logger[_0x34bc('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5de8b5,_0x34bc('0x12'),JSON['stringify'](_0x41960e));if(_0x41960e[_0x34bc('0x14')]){if(_0x41960e[_0x34bc('0x14')][_0x34bc('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x41960e[_0x34bc('0x14')]['message']);return _0x33025c(_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);}logger[_0x34bc('0x14')](_0x34bc('0x11'),_0x5de8b5,_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);return _0x2b8112(_0x41960e['error']['message']);}else{logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));_0x2b8112(_0x41960e[_0x34bc('0x17')][_0x34bc('0x16')]);}})['catch'](function(_0x46aa24){logger[_0x34bc('0x14')]('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x46aa24);_0x33025c(_0x46aa24);});});}exports[_0x34bc('0x18')]=function(_0x9e9f14){var _0x4d2d5e=this;return new Promise(function(_0x14cec8,_0x26cdec){return db[_0x34bc('0x19')][_0x34bc('0x1a')](_0x9e9f14[_0x34bc('0x1b')],{'raw':_0x9e9f14[_0x34bc('0x1c')]?_0x9e9f14['options'][_0x34bc('0x1d')]===undefined?!![]:![]:!![]})[_0x34bc('0x1e')](function(_0x38882c){logger['info']('CreateFaxMessage',_0x9e9f14);logger[_0x34bc('0x13')](_0x34bc('0x18'),_0x9e9f14,JSON[_0x34bc('0x1f')](_0x38882c));_0x14cec8(_0x38882c);})[_0x34bc('0x20')](function(_0x13094a){logger[_0x34bc('0x14')](_0x34bc('0x18'),_0x13094a[_0x34bc('0x16')],_0x9e9f14);_0x26cdec(_0x4d2d5e[_0x34bc('0x14')](0x1f4,_0x13094a[_0x34bc('0x16')]));});});};exports[_0x34bc('0x21')]=function(_0x1edcb0){var _0x4fd589=this;return new Promise(function(_0x43e527,_0x48ec13){return db['FaxMessage'][_0x34bc('0x22')](_0x1edcb0['body'],{'raw':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1edcb0['options']?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x23')]||null:null,'attributes':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x24')]||null:null,'limit':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0['options'][_0x34bc('0x25')]||null:null})[_0x34bc('0x1e')](function(_0x22aacc){logger[_0x34bc('0x26')](_0x34bc('0x21'),_0x1edcb0);logger[_0x34bc('0x13')]('UpdateFaxMessage',_0x1edcb0,JSON[_0x34bc('0x1f')](_0x22aacc));_0x43e527(_0x22aacc);})['catch'](function(_0x530748){logger[_0x34bc('0x14')]('UpdateFaxMessage',_0x530748[_0x34bc('0x16')],_0x1edcb0);_0x48ec13(_0x4fd589[_0x34bc('0x14')](0x1f4,_0x530748[_0x34bc('0x16')]));});});}; \ No newline at end of file +var _0x5fd1=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','raw','catch','UpdateFaxMessage','options','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fd1,0x155));var _0x15fd=function(_0x3682ad,_0x3d954f){_0x3682ad=_0x3682ad-0x0;var _0x212ff3=_0x5fd1[_0x3682ad];return _0x212ff3;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});config[_0x15fd('0xa')]=_[_0x15fd('0xb')](config['redis'],{'host':_0x15fd('0xc'),'port':0x18eb});var socket=require(_0x15fd('0xd'))(new Redis(config[_0x15fd('0xa')]));require('./faxMessage.socket')[_0x15fd('0xe')](socket);function respondWithRpcPromise(_0x5c9c63,_0x3dfdbb,_0x250457){return new BPromise(function(_0x4c226a,_0x4883fd){return client['request'](_0x5c9c63,_0x250457)[_0x15fd('0xf')](function(_0x2a4d55){logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x3dfdbb,_0x15fd('0x12'));logger[_0x15fd('0x13')](_0x15fd('0x14'),_0x3dfdbb,_0x15fd('0x12'),JSON[_0x15fd('0x15')](_0x2a4d55));if(_0x2a4d55['error']){if(_0x2a4d55['error']['code']===0x1f4){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);return _0x4883fd(_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);}logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55['error']['message']);return _0x4c226a(_0x2a4d55[_0x15fd('0x16')]['message']);}else{logger[_0x15fd('0x10')]('FaxMessage,\x20%s,\x20%s',_0x3dfdbb,_0x15fd('0x12'));_0x4c226a(_0x2a4d55[_0x15fd('0x18')][_0x15fd('0x17')]);}})['catch'](function(_0x367c36){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x367c36);_0x4883fd(_0x367c36);});});}exports[_0x15fd('0x19')]=function(_0x2fb919){var _0x36a90e=this;return new Promise(function(_0x3761db,_0x2f46f1){return db[_0x15fd('0x1a')][_0x15fd('0x1b')](_0x2fb919[_0x15fd('0x1c')],{'raw':_0x2fb919['options']?_0x2fb919['options'][_0x15fd('0x1d')]===undefined?!![]:![]:!![]})[_0x15fd('0xf')](function(_0x252a1c){logger[_0x15fd('0x10')](_0x15fd('0x19'),_0x2fb919);logger[_0x15fd('0x13')](_0x15fd('0x19'),_0x2fb919,JSON['stringify'](_0x252a1c));_0x3761db(_0x252a1c);})[_0x15fd('0x1e')](function(_0x2d19ac){logger[_0x15fd('0x16')]('CreateFaxMessage',_0x2d19ac[_0x15fd('0x17')],_0x2fb919);_0x2f46f1(_0x36a90e['error'](0x1f4,_0x2d19ac[_0x15fd('0x17')]));});});};exports[_0x15fd('0x1f')]=function(_0x21601d){var _0x4c9708=this;return new Promise(function(_0x16b87c,_0x1cbf2c){return db[_0x15fd('0x1a')]['update'](_0x21601d[_0x15fd('0x1c')],{'raw':_0x21601d['options']?_0x21601d[_0x15fd('0x20')][_0x15fd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x21')]||null:null,'attributes':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x22')]||null:null,'limit':_0x21601d[_0x15fd('0x20')]?_0x21601d[_0x15fd('0x20')][_0x15fd('0x23')]||null:null})['then'](function(_0x47c22c){logger[_0x15fd('0x10')]('UpdateFaxMessage',_0x21601d);logger[_0x15fd('0x13')](_0x15fd('0x1f'),_0x21601d,JSON['stringify'](_0x47c22c));_0x16b87c(_0x47c22c);})[_0x15fd('0x1e')](function(_0x197d15){logger['error'](_0x15fd('0x1f'),_0x197d15[_0x15fd('0x17')],_0x21601d);_0x1cbf2c(_0x4c9708[_0x15fd('0x16')](0x1f4,_0x197d15[_0x15fd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 275af06..99a53a9 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 _0x8e7c=['./faxMessage.events','save','remove','update','removeListener','length'];(function(_0xa9f5b2,_0x2d7a84){var _0x985899=function(_0x40d2e1){while(--_0x40d2e1){_0xa9f5b2['push'](_0xa9f5b2['shift']());}};_0x985899(++_0x2d7a84);}(_0x8e7c,0x1bc));var _0xc8e7=function(_0x570ebd,_0x12168f){_0x570ebd=_0x570ebd-0x0;var _0x316818=_0x8e7c[_0x570ebd];return _0x316818;};'use strict';var FaxMessageEvents=require(_0xc8e7('0x0'));var events=[_0xc8e7('0x1'),_0xc8e7('0x2'),_0xc8e7('0x3')];function createListener(_0x32ebc7,_0x5f5acd){return function(_0x136e13){_0x5f5acd['emit'](_0x32ebc7,_0x136e13);};}function removeListener(_0x375f41,_0x5a13e2){return function(){FaxMessageEvents[_0xc8e7('0x4')](_0x375f41,_0x5a13e2);};}exports['register']=function(_0x40e751){for(var _0x545211=0x0,_0x301399=events[_0xc8e7('0x5')];_0x545211<_0x301399;_0x545211++){var _0x314f97=events[_0x545211];var _0x474049=createListener('faxMessage:'+_0x314f97,_0x40e751);FaxMessageEvents['on'](_0x314f97,_0x474049);}}; \ No newline at end of file +var _0xc2a9=['faxMessage:','save','emit','removeListener','length'];(function(_0x13b35d,_0x3ae11c){var _0x321790=function(_0x642c10){while(--_0x642c10){_0x13b35d['push'](_0x13b35d['shift']());}};_0x321790(++_0x3ae11c);}(_0xc2a9,0xe2));var _0x9c2a=function(_0x331400,_0x1db9fa){_0x331400=_0x331400-0x0;var _0x2c3c19=_0xc2a9[_0x331400];return _0x2c3c19;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x9c2a('0x0'),'remove','update'];function createListener(_0x5e05b1,_0xacf9f){return function(_0x587e41){_0xacf9f[_0x9c2a('0x1')](_0x5e05b1,_0x587e41);};}function removeListener(_0x58ecf7,_0x2dbeb4){return function(){FaxMessageEvents[_0x9c2a('0x2')](_0x58ecf7,_0x2dbeb4);};}exports['register']=function(_0xa56676){for(var _0x4e9ef4=0x0,_0x1ee478=events[_0x9c2a('0x3')];_0x4e9ef4<_0x1ee478;_0x4e9ef4++){var _0x8d1fee=events[_0x4e9ef4];var _0x107523=createListener(_0x9c2a('0x4')+_0x8d1fee,_0xa56676);FaxMessageEvents['on'](_0x8d1fee,_0x107523);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 389fb76..42d433f 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 _0xf4eb=['/:id/accept','accept','/:id/reject','delete','exports','multer','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','tracked','faxmessage:create','create','put'];(function(_0x21b037,_0x4b0bdd){var _0x571eeb=function(_0x10dab0){while(--_0x10dab0){_0x21b037['push'](_0x21b037['shift']());}};_0x571eeb(++_0x4b0bdd);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5a0f65,_0x412737){_0x5a0f65=_0x5a0f65-0x0;var _0x1ac0b3=_0xf4eb[_0x5a0f65];return _0x1ac0b3;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xbf4e('0xc')]('fax',_0xbf4e('0xd')),controller[_0xbf4e('0xe')]);router['put'](_0xbf4e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xbf4e('0xf')](_0xbf4e('0x10'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x11')]);router[_0xbf4e('0xf')](_0xbf4e('0x12'),auth['isAuthenticated'](),controller['reject']);router[_0xbf4e('0x13')](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0x14')]=router; \ No newline at end of file +var _0xa5fa=['accept','/:id/reject','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','tracked','faxmessage:create','create','put'];(function(_0x16bfe3,_0x359e77){var _0x19de7b=function(_0x1a630e){while(--_0x1a630e){_0x16bfe3['push'](_0x16bfe3['shift']());}};_0x19de7b(++_0x359e77);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x4eaafe,_0x5d6567){_0x4eaafe=_0x4eaafe-0x0;var _0x4efb4e=_0xa5fa[_0x4eaafe];return _0x4efb4e;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5f('0x4'));var auth=require(_0xaa5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5f('0x6'));var controller=require(_0xaa5f('0x7'));router[_0xaa5f('0x8')]('/',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xa')]);router[_0xaa5f('0x8')](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xc')]);router[_0xaa5f('0x8')](_0xaa5f('0xd'),auth['isAuthenticated'](),controller[_0xaa5f('0xe')]);router[_0xaa5f('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xaa5f('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xaa5f('0x10')]('fax',_0xaa5f('0x11')),controller[_0xaa5f('0x12')]);router[_0xaa5f('0x13')](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller['update']);router[_0xaa5f('0x13')]('/:id/accept',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x14')]);router[_0xaa5f('0x13')](_0xaa5f('0x15'),auth[_0xaa5f('0x9')](),controller['reject']);router['delete'](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x16')]);module[_0xaa5f('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2423592..2e1d9c2 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 _0x31e5=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x4623b6,_0x3639e1){var _0x4c5a4c=function(_0x3f12ed){while(--_0x3f12ed){_0x4623b6['push'](_0x4623b6['shift']());}};_0x4c5a4c(++_0x3639e1);}(_0x31e5,0x164));var _0x531e=function(_0x1228b2,_0x1445c1){_0x1228b2=_0x1228b2-0x0;var _0x2fc1ed=_0x31e5[_0x1228b2];return _0x2fc1ed;};'use strict';var Sequelize=require(_0x531e('0x0'));module[_0x531e('0x1')]={'name':{'type':Sequelize[_0x531e('0x2')],'unique':_0x531e('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x531e('0x2')]},'timeout':{'type':Sequelize[_0x531e('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x531e('0x5')](_0x531e('0x6'),_0x531e('0x7'),_0x531e('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x531e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9e69=['exports','STRING','name','ENUM','rrmemory','roundrobin','INTEGER'];(function(_0x3b781c,_0x511716){var _0x4073a7=function(_0x5b1259){while(--_0x5b1259){_0x3b781c['push'](_0x3b781c['shift']());}};_0x4073a7(++_0x511716);}(_0x9e69,0x150));var _0x99e6=function(_0x4f3e18,_0x135ef2){_0x4f3e18=_0x4f3e18-0x0;var _0x5b5094=_0x9e69[_0x4f3e18];return _0x5b5094;};'use strict';var Sequelize=require('sequelize');module[_0x99e6('0x0')]={'name':{'type':Sequelize[_0x99e6('0x1')],'unique':_0x99e6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x99e6('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x99e6('0x3')](_0x99e6('0x4'),'beepall',_0x99e6('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x99e6('0x6')],'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 15e8e93..c77487a 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 _0x0c88=['forEach','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','FaxQueues','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','where','pick','filter','merge','VIRTUAL','FaxQueue','includeAll','include','findAll','rows','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','catch','update','describe','getMembers','UserFaxQueue','order','sort','FaxQueueId','options','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userFaxQueue:save','field','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents'];(function(_0x96f7a7,_0x35bae9){var _0x1c9aef=function(_0x9b1e37){while(--_0x9b1e37){_0x96f7a7['push'](_0x96f7a7['shift']());}};_0x1c9aef(++_0x35bae9);}(_0x0c88,0x11c));var _0x80c8=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x0c88[_0xb1cf84];return _0x4bad2e;};'use strict';var emlformat=require(_0x80c8('0x0'));var rimraf=require(_0x80c8('0x1'));var zipdir=require(_0x80c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x80c8('0x3'));var BPromise=require(_0x80c8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x80c8('0x5'));var sox=require('sox');var csv=require(_0x80c8('0x6'));var ejs=require(_0x80c8('0x7'));var fs=require('fs');var fs_extra=require(_0x80c8('0x8'));var _=require(_0x80c8('0x9'));var squel=require(_0x80c8('0xa'));var crypto=require(_0x80c8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x80c8('0xc'));var toCsv=require(_0x80c8('0x6'));var querystring=require(_0x80c8('0xd'));var Papa=require(_0x80c8('0xe'));var Redis=require(_0x80c8('0xf'));var authService=require(_0x80c8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x80c8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x80c8('0x12'));var utils=require(_0x80c8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x80c8('0x14'));var db=require(_0x80c8('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x80c8('0x16'),'port':0x18eb});var socket=require(_0x80c8('0x17'))(new Redis(config[_0x80c8('0x18')]));require(_0x80c8('0x19'))['register'](socket);function respondWithStatusCode(_0x28b26f,_0x3e08aa){_0x3e08aa=_0x3e08aa||0xcc;return function(_0x493270){if(_0x493270){return _0x28b26f[_0x80c8('0x1a')](_0x3e08aa);}return _0x28b26f[_0x80c8('0x1b')](_0x3e08aa)[_0x80c8('0x1c')]();};}function respondWithResult(_0x1fe255,_0x2e571b){_0x2e571b=_0x2e571b||0xc8;return function(_0x5cc4e5){if(_0x5cc4e5){return _0x1fe255['status'](_0x2e571b)[_0x80c8('0x1d')](_0x5cc4e5);}};}function respondWithFilteredResult(_0x5f4463,_0x5389f6){return function(_0x36b729){if(_0x36b729){var _0x54042c=typeof _0x5389f6[_0x80c8('0x1e')]==='undefined'&&typeof _0x5389f6['limit']===_0x80c8('0x1f');var _0x45ac49=_0x36b729['count'];var _0x59fc6d=_0x54042c?0x0:_0x5389f6['offset'];var _0x4bce93=_0x54042c?_0x36b729[_0x80c8('0x20')]:_0x5389f6[_0x80c8('0x1e')]+_0x5389f6[_0x80c8('0x21')];var _0x1bdb58;if(_0x4bce93>=_0x45ac49){_0x4bce93=_0x45ac49;_0x1bdb58=0xc8;}else{_0x1bdb58=0xce;}_0x5f4463[_0x80c8('0x1b')](_0x1bdb58);return _0x5f4463[_0x80c8('0x22')]('Content-Range',_0x59fc6d+'-'+_0x4bce93+'/'+_0x45ac49)[_0x80c8('0x1d')](_0x36b729);}return null;};}function patchUpdates(_0xdfad83){return function(_0x4e3884){try{jsonpatch[_0x80c8('0x23')](_0x4e3884,_0xdfad83,!![]);}catch(_0x56893f){return BPromise[_0x80c8('0x24')](_0x56893f);}return _0x4e3884[_0x80c8('0x25')]();};}function saveUpdates(_0xac57e3,_0x2e567f){return function(_0x2b4f21){if(_0x2b4f21){return _0x2b4f21['update'](_0xac57e3)[_0x80c8('0x26')](function(_0x42564a){return _0x42564a;});}return null;};}function removeEntity(_0x5b95de,_0x535914){return function(_0x3fa2d7){if(_0x3fa2d7){return _0x3fa2d7['destroy']()[_0x80c8('0x26')](function(){var _0x35388b=_0x3fa2d7['get']({'plain':!![]});var _0xa41de=_0x80c8('0x27');return db[_0x80c8('0x28')][_0x80c8('0x29')]({'where':{'type':_0xa41de,'resourceId':_0x35388b['id']}})['then'](function(){return _0x3fa2d7;});})[_0x80c8('0x26')](function(){_0x5b95de[_0x80c8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x575280,_0x47336f){return function(_0x339dec){if(!_0x339dec){_0x575280[_0x80c8('0x1a')](0x194);}return _0x339dec;};}function handleError(_0x6ac5b8,_0x4f457c){_0x4f457c=_0x4f457c||0x1f4;return function(_0x4d454f){logger[_0x80c8('0x2a')](_0x4d454f[_0x80c8('0x2b')]);if(_0x4d454f[_0x80c8('0x2c')]){delete _0x4d454f[_0x80c8('0x2c')];}_0x6ac5b8[_0x80c8('0x1b')](_0x4f457c)[_0x80c8('0x2d')](_0x4d454f);};}exports['index']=function(_0x2f5e3d,_0x1afbf2){var _0x296b04={},_0x28e58f={},_0x4f109a={'count':0x0,'rows':[]};var _0x60088d=_[_0x80c8('0x2e')](db['FaxQueue'][_0x80c8('0x2f')],function(_0x4689c8){return{'name':_0x4689c8[_0x80c8('0x30')],'type':_0x4689c8[_0x80c8('0x31')][_0x80c8('0x32')]};});_0x28e58f[_0x80c8('0x33')]=_['map'](_0x60088d,_0x80c8('0x2c'));_0x28e58f['query']=_[_0x80c8('0x34')](_0x2f5e3d[_0x80c8('0x35')]);_0x28e58f[_0x80c8('0x36')]=_[_0x80c8('0x37')](_0x28e58f[_0x80c8('0x33')],_0x28e58f[_0x80c8('0x35')]);_0x296b04[_0x80c8('0x38')]=_[_0x80c8('0x37')](_0x28e58f[_0x80c8('0x33')],qs[_0x80c8('0x39')](_0x2f5e3d[_0x80c8('0x35')]['fields']));_0x296b04['attributes']=_0x296b04[_0x80c8('0x38')]['length']?_0x296b04['attributes']:_0x28e58f[_0x80c8('0x33')];if(!_0x2f5e3d[_0x80c8('0x35')]['hasOwnProperty'](_0x80c8('0x3a'))){_0x296b04[_0x80c8('0x21')]=qs['limit'](_0x2f5e3d[_0x80c8('0x35')][_0x80c8('0x21')]);_0x296b04['offset']=qs[_0x80c8('0x1e')](_0x2f5e3d[_0x80c8('0x35')][_0x80c8('0x1e')]);}_0x296b04['order']=qs['sort'](_0x2f5e3d['query']['sort']);_0x296b04[_0x80c8('0x3b')]=qs[_0x80c8('0x36')](_[_0x80c8('0x3c')](_0x2f5e3d[_0x80c8('0x35')],_0x28e58f[_0x80c8('0x36')]),_0x60088d);if(_0x2f5e3d[_0x80c8('0x35')][_0x80c8('0x3d')]){_0x296b04['where']=_[_0x80c8('0x3e')](_0x296b04[_0x80c8('0x3b')],{'$or':_[_0x80c8('0x2e')](_0x60088d,function(_0x18e3fe){if(_0x18e3fe['type']!==_0x80c8('0x3f')){var _0x374f2d={};_0x374f2d[_0x18e3fe[_0x80c8('0x2c')]]={'$like':'%'+_0x2f5e3d[_0x80c8('0x35')][_0x80c8('0x3d')]+'%'};return _0x374f2d;}})});}_0x296b04=_['merge']({},_0x296b04,_0x2f5e3d['options']);var _0x35f281={'where':_0x296b04['where']};return db[_0x80c8('0x40')][_0x80c8('0x20')](_0x35f281)[_0x80c8('0x26')](function(_0xae1dd9){_0x4f109a['count']=_0xae1dd9;if(_0x2f5e3d[_0x80c8('0x35')][_0x80c8('0x41')]){_0x296b04[_0x80c8('0x42')]=[{'all':!![]}];}return db[_0x80c8('0x40')][_0x80c8('0x43')](_0x296b04);})['then'](function(_0xf89fd3){_0x4f109a[_0x80c8('0x44')]=_0xf89fd3;return _0x4f109a;})[_0x80c8('0x26')](respondWithFilteredResult(_0x1afbf2,_0x296b04))['catch'](handleError(_0x1afbf2,null));};exports[_0x80c8('0x45')]=function(_0x44c17a,_0x1912cc){var _0x23cd9b={'raw':!![],'where':{'id':_0x44c17a[_0x80c8('0x46')]['id']}},_0x34064e={};_0x34064e['model']=_['keys'](db['FaxQueue'][_0x80c8('0x2f')]);_0x34064e[_0x80c8('0x35')]=_[_0x80c8('0x34')](_0x44c17a[_0x80c8('0x35')]);_0x34064e['filters']=_[_0x80c8('0x37')](_0x34064e[_0x80c8('0x33')],_0x34064e[_0x80c8('0x35')]);_0x23cd9b[_0x80c8('0x38')]=_['intersection'](_0x34064e[_0x80c8('0x33')],qs[_0x80c8('0x39')](_0x44c17a[_0x80c8('0x35')]['fields']));_0x23cd9b['attributes']=_0x23cd9b['attributes'][_0x80c8('0x47')]?_0x23cd9b[_0x80c8('0x38')]:_0x34064e[_0x80c8('0x33')];if(_0x44c17a[_0x80c8('0x35')]['includeAll']){_0x23cd9b[_0x80c8('0x42')]=[{'all':!![]}];}_0x23cd9b=_[_0x80c8('0x3e')]({},_0x23cd9b,_0x44c17a['options']);return db[_0x80c8('0x40')][_0x80c8('0x48')](_0x23cd9b)[_0x80c8('0x26')](handleEntityNotFound(_0x1912cc,null))[_0x80c8('0x26')](respondWithResult(_0x1912cc,null))['catch'](handleError(_0x1912cc,null));};exports[_0x80c8('0x49')]=function(_0x52ba8d,_0x499ca1){return db[_0x80c8('0x40')][_0x80c8('0x49')](_0x52ba8d[_0x80c8('0x4a')],{})['then'](function(_0x5598a2){var _0x583326=_0x52ba8d['user'][_0x80c8('0x4b')]({'plain':!![]});if(!_0x583326)throw new Error(_0x80c8('0x4c'));if(_0x583326[_0x80c8('0x4d')]===_0x80c8('0x4e')){var _0xaba818=_0x5598a2[_0x80c8('0x4b')]({'plain':!![]});var _0x36ff91=_0x80c8('0x27');return db[_0x80c8('0x4f')][_0x80c8('0x48')]({'where':{'name':_0x36ff91,'userProfileId':_0x583326['userProfileId']},'raw':!![]})[_0x80c8('0x26')](function(_0x28b67a){if(_0x28b67a&&_0x28b67a['autoAssociation']===0x0){return db['UserProfileResource'][_0x80c8('0x49')]({'name':_0xaba818[_0x80c8('0x2c')],'resourceId':_0xaba818['id'],'type':_0x28b67a[_0x80c8('0x2c')],'sectionId':_0x28b67a['id']},{})['then'](function(){return _0x5598a2;});}else{return _0x5598a2;}})[_0x80c8('0x50')](function(_0x98f921){logger[_0x80c8('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x98f921);throw _0x98f921;});}return _0x5598a2;})[_0x80c8('0x26')](respondWithResult(_0x499ca1,0xc9))[_0x80c8('0x50')](handleError(_0x499ca1,null));};exports[_0x80c8('0x51')]=function(_0x2d9b5c,_0x201c5d){if(_0x2d9b5c[_0x80c8('0x4a')]['id']){delete _0x2d9b5c[_0x80c8('0x4a')]['id'];}return db[_0x80c8('0x40')][_0x80c8('0x48')]({'where':{'id':_0x2d9b5c['params']['id']}})[_0x80c8('0x26')](handleEntityNotFound(_0x201c5d,null))[_0x80c8('0x26')](saveUpdates(_0x2d9b5c[_0x80c8('0x4a')],null))['then'](respondWithResult(_0x201c5d,null))[_0x80c8('0x50')](handleError(_0x201c5d,null));};exports['destroy']=function(_0x24394b,_0x3ff2be){return db[_0x80c8('0x40')]['find']({'where':{'id':_0x24394b[_0x80c8('0x46')]['id']}})[_0x80c8('0x26')](handleEntityNotFound(_0x3ff2be,null))['then'](removeEntity(_0x3ff2be,null))[_0x80c8('0x50')](handleError(_0x3ff2be,null));};exports[_0x80c8('0x52')]=function(_0x5051ca,_0x2cb0ff){return db[_0x80c8('0x40')][_0x80c8('0x52')]()[_0x80c8('0x26')](respondWithResult(_0x2cb0ff,null))['catch'](handleError(_0x2cb0ff,null));};exports[_0x80c8('0x53')]=function(_0x4d749f,_0x544c24,_0x3f0c16){var _0x43fe43={'raw':!![],'where':{}},_0x54de65={},_0x36705b;return db['FaxQueue']['findOne']({'where':{'id':_0x4d749f[_0x80c8('0x46')]['id']}})[_0x80c8('0x26')](handleEntityNotFound(_0x544c24,null))[_0x80c8('0x26')](function(_0x448c77){if(_0x448c77){_0x36705b=_0x448c77[_0x80c8('0x4b')]({'plain':!![]});_0x54de65['model']=_[_0x80c8('0x34')](db[_0x80c8('0x54')][_0x80c8('0x2f')]);_0x54de65[_0x80c8('0x35')]=_['keys'](_0x4d749f[_0x80c8('0x35')]);_0x54de65[_0x80c8('0x36')]=_[_0x80c8('0x37')](_0x54de65[_0x80c8('0x33')],_0x54de65[_0x80c8('0x35')]);_0x43fe43[_0x80c8('0x38')]=_[_0x80c8('0x37')](_0x54de65['model'],qs[_0x80c8('0x39')](_0x4d749f[_0x80c8('0x35')][_0x80c8('0x39')]));_0x43fe43[_0x80c8('0x38')]=_0x43fe43[_0x80c8('0x38')][_0x80c8('0x47')]?_0x43fe43['attributes']:_0x54de65['model'];if(!_0x4d749f[_0x80c8('0x35')]['hasOwnProperty'](_0x80c8('0x3a'))){_0x43fe43[_0x80c8('0x21')]=qs[_0x80c8('0x21')](_0x4d749f['query'][_0x80c8('0x21')]);_0x43fe43[_0x80c8('0x1e')]=qs[_0x80c8('0x1e')](_0x4d749f[_0x80c8('0x35')]['offset']);}_0x43fe43[_0x80c8('0x55')]=qs[_0x80c8('0x56')](_0x4d749f[_0x80c8('0x35')]['sort']);_0x43fe43[_0x80c8('0x3b')]=qs['filters'](_[_0x80c8('0x3c')](_0x4d749f[_0x80c8('0x35')],_0x54de65[_0x80c8('0x36')]));_0x43fe43[_0x80c8('0x3b')][_0x80c8('0x57')]=_0x448c77['id'];if(_0x4d749f[_0x80c8('0x35')][_0x80c8('0x3d')]){_0x43fe43['where']=_['merge'](_0x43fe43[_0x80c8('0x3b')],{'$or':_[_0x80c8('0x2e')](_0x43fe43[_0x80c8('0x38')],function(_0x234c89){var _0x4c2bc6={};_0x4c2bc6[_0x234c89]={'$like':'%'+_0x4d749f[_0x80c8('0x35')][_0x80c8('0x3d')]+'%'};return _0x4c2bc6;})});}_0x43fe43=_['merge']({},_0x43fe43,_0x4d749f[_0x80c8('0x58')]);return db[_0x80c8('0x54')]['findAll'](_0x43fe43);}})[_0x80c8('0x26')](function(_0x2b4f76){if(_0x2b4f76){return db['User'][_0x80c8('0x59')]({'where':{'id':_[_0x80c8('0x2e')](_0x2b4f76,_0x80c8('0x5a')),'role':_0x80c8('0x5b')},'attributes':['id',_0x80c8('0x2c'),_0x80c8('0x5c'),_0x80c8('0x5d'),_0x80c8('0x5e')]});}})[_0x80c8('0x26')](function(_0x34341d){if(_0x34341d){return{'count':_0x34341d[_0x80c8('0x20')],'rows':_[_0x80c8('0x2e')](_0x34341d['rows'],function(_0x382053){return{'membername':_0x382053['name'],'UserId':_0x382053['id'],'queue_name':_0x36705b['name'],'FaxQueueId':_0x36705b['id'],'interface':util[_0x80c8('0x5f')]('%s/%s',_0x80c8('0x60'),_0x382053['name']),'penalty':0x0,'paused':_0x382053['faxPause'],'createdAt':_0x382053['createdAt'],'updatedAt':_0x382053[_0x80c8('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x544c24,_0x43fe43))[_0x80c8('0x50')](handleError(_0x544c24,null));};exports[_0x80c8('0x61')]=function(_0x3650d2,_0x13304f,_0x22ea63){var _0x3d745c={};var _0x1175b5={};var _0x3d8661;var _0x1ef951;return db['FaxQueue'][_0x80c8('0x62')]({'where':{'id':_0x3650d2[_0x80c8('0x46')]['id']}})[_0x80c8('0x26')](handleEntityNotFound(_0x13304f,null))[_0x80c8('0x26')](function(_0x4fd22f){if(_0x4fd22f){_0x3d8661=_0x4fd22f;_0x1175b5[_0x80c8('0x33')]=_[_0x80c8('0x34')](db[_0x80c8('0x63')][_0x80c8('0x2f')]);_0x1175b5['query']=_[_0x80c8('0x34')](_0x3650d2['query']);_0x1175b5[_0x80c8('0x36')]=_['intersection'](_0x1175b5[_0x80c8('0x33')],_0x1175b5[_0x80c8('0x35')]);_0x3d745c[_0x80c8('0x38')]=_[_0x80c8('0x37')](_0x1175b5[_0x80c8('0x33')],qs[_0x80c8('0x39')](_0x3650d2[_0x80c8('0x35')][_0x80c8('0x39')]));_0x3d745c[_0x80c8('0x38')]=_0x3d745c['attributes'][_0x80c8('0x47')]?_0x3d745c[_0x80c8('0x38')]:_0x1175b5['model'];_0x3d745c[_0x80c8('0x55')]=qs[_0x80c8('0x56')](_0x3650d2[_0x80c8('0x35')][_0x80c8('0x56')]);_0x3d745c[_0x80c8('0x3b')]=qs[_0x80c8('0x36')](_[_0x80c8('0x3c')](_0x3650d2[_0x80c8('0x35')],_0x1175b5[_0x80c8('0x36')]));if(_0x3650d2[_0x80c8('0x35')][_0x80c8('0x3d')]){_0x3d745c[_0x80c8('0x3b')]=_['merge'](_0x3d745c[_0x80c8('0x3b')],{'$or':_['map'](_0x3d745c[_0x80c8('0x38')],function(_0x45af42){var _0x3fc4ee={};_0x3fc4ee[_0x45af42]={'$like':'%'+_0x3650d2[_0x80c8('0x35')][_0x80c8('0x3d')]+'%'};return _0x3fc4ee;})});}_0x3d745c=_[_0x80c8('0x3e')]({},_0x3d745c,_0x3650d2[_0x80c8('0x58')]);return _0x3d8661['getTeams'](_0x3d745c);}})[_0x80c8('0x26')](function(_0x4c2a06){if(_0x4c2a06){_0x1ef951=_0x4c2a06[_0x80c8('0x47')];if(!_0x3650d2[_0x80c8('0x35')][_0x80c8('0x64')]('nolimit')){_0x3d745c[_0x80c8('0x21')]=qs['limit'](_0x3650d2[_0x80c8('0x35')]['limit']);_0x3d745c[_0x80c8('0x1e')]=qs['offset'](_0x3650d2[_0x80c8('0x35')][_0x80c8('0x1e')]);}return _0x3d8661['getTeams'](_0x3d745c);}})[_0x80c8('0x26')](function(_0x8826d0){if(_0x8826d0){return _0x8826d0?{'count':_0x1ef951,'rows':_0x8826d0}:null;}})[_0x80c8('0x26')](respondWithResult(_0x13304f,null))['catch'](handleError(_0x13304f,null));};exports[_0x80c8('0x65')]=function(_0x359f3a,_0x565a6f,_0x24262e){var _0x503282=_0x359f3a[_0x80c8('0x4a')][_0x80c8('0x66')];return db['Team']['findAll']({'where':{'id':_0x503282},'attributes':['id'],'include':[{'model':db[_0x80c8('0x67')],'as':_0x80c8('0x68'),'attributes':['id',_0x80c8('0x2c'),_0x80c8('0x69'),_0x80c8('0x6a'),_0x80c8('0x6b')],'raw':!![]}]})['then'](function(_0x428bf0){if(_0x428bf0){var _0x233c87=_[_0x80c8('0x6c')](_0x428bf0,function(_0x503faa){var _0x14fdef=_0x503faa[_0x80c8('0x4b')]({'plain':!![]});return _0x14fdef[_0x80c8('0x68')];});return db[_0x80c8('0x40')][_0x80c8('0x48')]({'where':{'id':_0x359f3a['params']['id']}})[_0x80c8('0x26')](function(_0x48ac93){return db[_0x80c8('0x6d')][_0x80c8('0x6e')](function(_0x57000a){return _0x48ac93[_0x80c8('0x65')](_0x503282,{'transaction':_0x57000a})[_0x80c8('0x26')](function(){return BPromise[_0x80c8('0x6f')](_0x233c87,function(_0x3f0eca){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x3f0eca['id'],'FaxQueueId':_0x359f3a[_0x80c8('0x46')]['id']},'transaction':_0x57000a});});})[_0x80c8('0x26')](function(){_0x233c87['forEach'](function(_0x37eec8){socket[_0x80c8('0x70')](_0x80c8('0x71'),{'UserId':_0x37eec8['id'],'FaxQueueId':_0x48ac93['id']});});});});});}})[_0x80c8('0x26')](respondWithStatusCode(_0x565a6f,null))[_0x80c8('0x50')](handleError(_0x565a6f,null));};exports['removeTeams']=function(_0x3dc63a,_0x2d9a54,_0x103478){return db[_0x80c8('0x63')][_0x80c8('0x43')]({'where':{'id':_0x3dc63a[_0x80c8('0x35')][_0x80c8('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x80c8('0x68'),'attributes':['id'],'raw':!![]}]})[_0x80c8('0x26')](handleEntityNotFound(_0x2d9a54,null))['then'](function(_0x2dae1f){var _0x250931=_[_0x80c8('0x2e')](_0x2dae1f,'id');var _0x18b916=[];var _0x332abd=[];var _0x1e0b37=squel['select']();_0x1e0b37[_0x80c8('0x72')]('tq.TeamId')['from'](_0x80c8('0x73'),'tq')[_0x80c8('0x74')](_0x80c8('0x75'),'ut',_0x80c8('0x76'))['where'](_0x80c8('0x77'),_0x3dc63a['params']['id']);for(var _0x330d94=0x0;_0x330d94<_0x2dae1f['length'];_0x330d94+=0x1){let _0xb2d2c4=_0x2dae1f[_0x330d94];for(var _0x3b1f97=0x0;_0x3b1f97<_0xb2d2c4[_0x80c8('0x68')][_0x80c8('0x47')];_0x3b1f97+=0x1){let _0x234448=_0xb2d2c4[_0x80c8('0x68')][_0x3b1f97];var _0x3c5ff8=_0x1e0b37[_0x80c8('0x78')]();_0x3c5ff8[_0x80c8('0x3b')]('ut.UserId\x20=\x20?',_0x234448['id']);_0x332abd[_0x80c8('0x79')](db[_0x80c8('0x6d')][_0x80c8('0x35')](_0x3c5ff8[_0x80c8('0x7a')](),{'type':db['sequelize'][_0x80c8('0x7b')][_0x80c8('0x7c')]})[_0x80c8('0x26')](function(_0x591c18){if(_0x591c18[_0x80c8('0x47')]===0x1){return _0x234448['id'];}else{var _0x10a39a=_['every'](_[_0x80c8('0x2e')](_0x591c18,'TeamId'),function(_0x573a){return _[_0x80c8('0x7d')](_0x250931,_0x573a);});if(_0x10a39a){return _0x234448['id'];}}}));}}return BPromise[_0x80c8('0x7e')](_0x332abd)[_0x80c8('0x26')](function(_0x51b938){_0x18b916=_(_0x18b916)[_0x80c8('0x7f')](_0x51b938)[_0x80c8('0x80')]()[_0x80c8('0x81')]();return db[_0x80c8('0x40')]['find']({'where':{'id':_0x3dc63a[_0x80c8('0x46')]['id']}})['then'](function(_0xd84244){return db[_0x80c8('0x6d')][_0x80c8('0x6e')](function(_0x2b8e3d){return _0xd84244[_0x80c8('0x82')](_0x3dc63a['query']['ids'],{'transaction':_0x2b8e3d})[_0x80c8('0x26')](function(){if(!_[_0x80c8('0x83')](_0x18b916)){return _0xd84244[_0x80c8('0x84')](_0x18b916,{'transaction':_0x2b8e3d});}})[_0x80c8('0x26')](function(){_0x18b916[_0x80c8('0x85')](function(_0x1da390){socket['emit'](_0x80c8('0x86'),{'UserId':_0x1da390,'FaxQueueId':_0xd84244['id']});});});});});});})[_0x80c8('0x26')](respondWithStatusCode(_0x2d9a54,null))[_0x80c8('0x50')](handleError(_0x2d9a54,null));};exports[_0x80c8('0x87')]=function(_0x27dee2,_0xa47fdd,_0x5e2bce){return db[_0x80c8('0x40')][_0x80c8('0x48')]({'where':{'id':_0x27dee2[_0x80c8('0x46')]['id']}})[_0x80c8('0x26')](handleEntityNotFound(_0xa47fdd,null))[_0x80c8('0x26')](function(_0x5c3805){if(_0x5c3805){return _0x5c3805[_0x80c8('0x87')](_0x27dee2[_0x80c8('0x4a')]['ids'],_[_0x80c8('0x88')](_0x27dee2[_0x80c8('0x4a')],[_0x80c8('0x66'),'id'])||{})['spread'](function(_0xf3f08e){for(var _0xd47ffd=0x0;_0xd47ffd<_0x27dee2['body']['ids']['length'];_0xd47ffd+=0x1){socket[_0x80c8('0x70')](_0x80c8('0x71'),{'UserId':Number(_0x27dee2[_0x80c8('0x4a')][_0x80c8('0x66')][_0xd47ffd]),'FaxQueueId':Number(_0x27dee2[_0x80c8('0x46')]['id'])});}return _0xf3f08e;});}})[_0x80c8('0x26')](respondWithResult(_0xa47fdd,null))[_0x80c8('0x50')](handleError(_0xa47fdd,null));};exports[_0x80c8('0x84')]=function(_0x5b0f30,_0x555ae7,_0x4db26c){return db[_0x80c8('0x40')][_0x80c8('0x48')]({'where':{'id':_0x5b0f30[_0x80c8('0x46')]['id']}})['then'](handleEntityNotFound(_0x555ae7,null))[_0x80c8('0x26')](function(_0x3a775e){if(_0x3a775e){return _0x3a775e[_0x80c8('0x84')](_0x5b0f30[_0x80c8('0x35')][_0x80c8('0x66')])[_0x80c8('0x26')](function(){if(_[_0x80c8('0x89')](_0x5b0f30[_0x80c8('0x35')]['ids'])){for(var _0xee25f5=0x0;_0xee25f5<_0x5b0f30[_0x80c8('0x35')][_0x80c8('0x66')][_0x80c8('0x47')];_0xee25f5+=0x1){socket[_0x80c8('0x70')](_0x80c8('0x86'),{'UserId':Number(_0x5b0f30['query']['ids'][_0xee25f5]),'FaxQueueId':Number(_0x5b0f30[_0x80c8('0x46')]['id'])});}}else{socket['emit'](_0x80c8('0x86'),{'UserId':Number(_0x5b0f30[_0x80c8('0x35')][_0x80c8('0x66')]),'FaxQueueId':Number(_0x5b0f30[_0x80c8('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x555ae7,null))['catch'](handleError(_0x555ae7,null));};exports[_0x80c8('0x8a')]=function(_0xfec41a,_0x30133f,_0x379cf6){var _0x59b692={};var _0x1af190={};var _0x13e053;var _0x2b22c9;return db[_0x80c8('0x40')][_0x80c8('0x62')]({'where':{'id':_0xfec41a[_0x80c8('0x46')]['id']}})[_0x80c8('0x26')](handleEntityNotFound(_0x30133f,null))['then'](function(_0x42d43a){if(_0x42d43a){_0x13e053=_0x42d43a;_0x1af190[_0x80c8('0x33')]=_[_0x80c8('0x34')](db['User'][_0x80c8('0x2f')]);_0x1af190[_0x80c8('0x35')]=_[_0x80c8('0x34')](_0xfec41a[_0x80c8('0x35')]);_0x1af190['filters']=_[_0x80c8('0x37')](_0x1af190['model'],_0x1af190[_0x80c8('0x35')]);_0x59b692[_0x80c8('0x38')]=_[_0x80c8('0x37')](_0x1af190[_0x80c8('0x33')],qs['fields'](_0xfec41a[_0x80c8('0x35')]['fields']));_0x59b692[_0x80c8('0x38')]=_0x59b692['attributes'][_0x80c8('0x47')]?_0x59b692['attributes']:_0x1af190[_0x80c8('0x33')];_0x59b692[_0x80c8('0x55')]=qs[_0x80c8('0x56')](_0xfec41a[_0x80c8('0x35')][_0x80c8('0x56')]);_0x59b692[_0x80c8('0x3b')]=qs[_0x80c8('0x36')](_['pick'](_0xfec41a[_0x80c8('0x35')],_0x1af190['filters']));if(_0xfec41a['query']['filter']){_0x59b692['where']=_['merge'](_0x59b692[_0x80c8('0x3b')],{'$or':_[_0x80c8('0x2e')](_0x59b692[_0x80c8('0x38')],function(_0x3f3541){var _0x1525a9={};_0x1525a9[_0x3f3541]={'$like':'%'+_0xfec41a[_0x80c8('0x35')]['filter']+'%'};return _0x1525a9;})});}_0x59b692=_[_0x80c8('0x3e')]({},_0x59b692,_0xfec41a[_0x80c8('0x58')]);return _0x13e053[_0x80c8('0x8a')](_0x59b692);}})['then'](function(_0x314208){if(_0x314208){_0x2b22c9=_0x314208[_0x80c8('0x47')];if(!_0xfec41a[_0x80c8('0x35')][_0x80c8('0x64')]('nolimit')){_0x59b692[_0x80c8('0x21')]=qs[_0x80c8('0x21')](_0xfec41a[_0x80c8('0x35')][_0x80c8('0x21')]);_0x59b692['offset']=qs['offset'](_0xfec41a['query'][_0x80c8('0x1e')]);}return _0x13e053[_0x80c8('0x8a')](_0x59b692);}})[_0x80c8('0x26')](function(_0x4c9e02){if(_0x4c9e02){return _0x4c9e02?{'count':_0x2b22c9,'rows':_0x4c9e02}:null;}})[_0x80c8('0x26')](respondWithResult(_0x30133f,null))['catch'](handleError(_0x30133f,null));}; \ No newline at end of file +var _0x411c=['addAgents','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','FaxQueues','destroy','error','name','index','map','FaxQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','include','findAll','catch','show','params','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','SIP','getTeams','Team','addTeams','User','online','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','removeTeams','ids','tq.TeamId','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','removeAgents'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0x411c,0x93));var _0xc411=function(_0x21628b,_0x522d9f){_0x21628b=_0x21628b-0x0;var _0x5e49a2=_0x411c[_0x21628b];return _0x5e49a2;};'use strict';var emlformat=require(_0xc411('0x0'));var rimraf=require(_0xc411('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc411('0x2'));var moment=require('moment');var BPromise=require(_0xc411('0x3'));var Mustache=require(_0xc411('0x4'));var util=require(_0xc411('0x5'));var path=require(_0xc411('0x6'));var sox=require(_0xc411('0x7'));var csv=require(_0xc411('0x8'));var ejs=require(_0xc411('0x9'));var fs=require('fs');var fs_extra=require(_0xc411('0xa'));var _=require(_0xc411('0xb'));var squel=require(_0xc411('0xc'));var crypto=require(_0xc411('0xd'));var jsforce=require(_0xc411('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc411('0x8'));var querystring=require(_0xc411('0xf'));var Papa=require(_0xc411('0x10'));var Redis=require(_0xc411('0x11'));var authService=require(_0xc411('0x12'));var qs=require(_0xc411('0x13'));var as=require(_0xc411('0x14'));var hardwareService=require(_0xc411('0x15'));var logger=require(_0xc411('0x16'))(_0xc411('0x17'));var utils=require(_0xc411('0x18'));var config=require(_0xc411('0x19'));var licenseUtil=require(_0xc411('0x1a'));var db=require(_0xc411('0x1b'))['db'];config[_0xc411('0x1c')]=_[_0xc411('0x1d')](config[_0xc411('0x1c')],{'host':_0xc411('0x1e'),'port':0x18eb});var socket=require(_0xc411('0x1f'))(new Redis(config['redis']));require(_0xc411('0x20'))[_0xc411('0x21')](socket);function respondWithStatusCode(_0x793a24,_0x36b1c4){_0x36b1c4=_0x36b1c4||0xcc;return function(_0x5520b4){if(_0x5520b4){return _0x793a24[_0xc411('0x22')](_0x36b1c4);}return _0x793a24[_0xc411('0x23')](_0x36b1c4)[_0xc411('0x24')]();};}function respondWithResult(_0x1b894d,_0x211de4){_0x211de4=_0x211de4||0xc8;return function(_0x43145b){if(_0x43145b){return _0x1b894d[_0xc411('0x23')](_0x211de4)[_0xc411('0x25')](_0x43145b);}};}function respondWithFilteredResult(_0x30c7da,_0x123389){return function(_0x199adb){if(_0x199adb){var _0x14264c=typeof _0x123389[_0xc411('0x26')]===_0xc411('0x27')&&typeof _0x123389[_0xc411('0x28')]===_0xc411('0x27');var _0x5abdbd=_0x199adb[_0xc411('0x29')];var _0x7da9cb=_0x14264c?0x0:_0x123389['offset'];var _0x2d54df=_0x14264c?_0x199adb[_0xc411('0x29')]:_0x123389[_0xc411('0x26')]+_0x123389['limit'];var _0x40f110;if(_0x2d54df>=_0x5abdbd){_0x2d54df=_0x5abdbd;_0x40f110=0xc8;}else{_0x40f110=0xce;}_0x30c7da[_0xc411('0x23')](_0x40f110);return _0x30c7da[_0xc411('0x2a')](_0xc411('0x2b'),_0x7da9cb+'-'+_0x2d54df+'/'+_0x5abdbd)['json'](_0x199adb);}return null;};}function patchUpdates(_0x3379da){return function(_0x4f7425){try{jsonpatch[_0xc411('0x2c')](_0x4f7425,_0x3379da,!![]);}catch(_0x29696b){return BPromise[_0xc411('0x2d')](_0x29696b);}return _0x4f7425[_0xc411('0x2e')]();};}function saveUpdates(_0x90c930,_0xcc2159){return function(_0x82cfe8){if(_0x82cfe8){return _0x82cfe8[_0xc411('0x2f')](_0x90c930)[_0xc411('0x30')](function(_0x2e12ba){return _0x2e12ba;});}return null;};}function removeEntity(_0x41aeb6,_0x34d3c0){return function(_0x1d1dba){if(_0x1d1dba){return _0x1d1dba['destroy']()[_0xc411('0x30')](function(){var _0xbd5c19=_0x1d1dba[_0xc411('0x31')]({'plain':!![]});var _0x45b413=_0xc411('0x32');return db['UserProfileResource'][_0xc411('0x33')]({'where':{'type':_0x45b413,'resourceId':_0xbd5c19['id']}})[_0xc411('0x30')](function(){return _0x1d1dba;});})[_0xc411('0x30')](function(){_0x41aeb6[_0xc411('0x23')](0xcc)[_0xc411('0x24')]();});}};}function handleEntityNotFound(_0x25c652,_0x42a1cb){return function(_0x1282eb){if(!_0x1282eb){_0x25c652[_0xc411('0x22')](0x194);}return _0x1282eb;};}function handleError(_0x309772,_0x5056a2){_0x5056a2=_0x5056a2||0x1f4;return function(_0x2aa7ec){logger[_0xc411('0x34')](_0x2aa7ec['stack']);if(_0x2aa7ec[_0xc411('0x35')]){delete _0x2aa7ec[_0xc411('0x35')];}_0x309772[_0xc411('0x23')](_0x5056a2)['send'](_0x2aa7ec);};}exports[_0xc411('0x36')]=function(_0x512609,_0x309437){var _0x7b84af={},_0x1bf10a={},_0x1f65dc={'count':0x0,'rows':[]};var _0x45a1a4=_[_0xc411('0x37')](db[_0xc411('0x38')][_0xc411('0x39')],function(_0x373d96){return{'name':_0x373d96[_0xc411('0x3a')],'type':_0x373d96['type'][_0xc411('0x3b')]};});_0x1bf10a['model']=_[_0xc411('0x37')](_0x45a1a4,_0xc411('0x35'));_0x1bf10a[_0xc411('0x3c')]=_[_0xc411('0x3d')](_0x512609[_0xc411('0x3c')]);_0x1bf10a[_0xc411('0x3e')]=_[_0xc411('0x3f')](_0x1bf10a['model'],_0x1bf10a['query']);_0x7b84af['attributes']=_[_0xc411('0x3f')](_0x1bf10a[_0xc411('0x40')],qs[_0xc411('0x41')](_0x512609[_0xc411('0x3c')][_0xc411('0x41')]));_0x7b84af['attributes']=_0x7b84af[_0xc411('0x42')]['length']?_0x7b84af['attributes']:_0x1bf10a[_0xc411('0x40')];if(!_0x512609[_0xc411('0x3c')]['hasOwnProperty']('nolimit')){_0x7b84af[_0xc411('0x28')]=qs[_0xc411('0x28')](_0x512609['query']['limit']);_0x7b84af[_0xc411('0x26')]=qs[_0xc411('0x26')](_0x512609['query']['offset']);}_0x7b84af[_0xc411('0x43')]=qs[_0xc411('0x44')](_0x512609['query'][_0xc411('0x44')]);_0x7b84af[_0xc411('0x45')]=qs['filters'](_[_0xc411('0x46')](_0x512609[_0xc411('0x3c')],_0x1bf10a[_0xc411('0x3e')]),_0x45a1a4);if(_0x512609['query']['filter']){_0x7b84af[_0xc411('0x45')]=_['merge'](_0x7b84af[_0xc411('0x45')],{'$or':_[_0xc411('0x37')](_0x45a1a4,function(_0x187b27){if(_0x187b27['type']!=='VIRTUAL'){var _0x4c0cd4={};_0x4c0cd4[_0x187b27[_0xc411('0x35')]]={'$like':'%'+_0x512609['query'][_0xc411('0x47')]+'%'};return _0x4c0cd4;}})});}_0x7b84af=_['merge']({},_0x7b84af,_0x512609['options']);var _0x22a66b={'where':_0x7b84af[_0xc411('0x45')]};return db[_0xc411('0x38')][_0xc411('0x29')](_0x22a66b)[_0xc411('0x30')](function(_0x59a0b5){_0x1f65dc[_0xc411('0x29')]=_0x59a0b5;if(_0x512609[_0xc411('0x3c')]['includeAll']){_0x7b84af[_0xc411('0x48')]=[{'all':!![]}];}return db['FaxQueue'][_0xc411('0x49')](_0x7b84af);})[_0xc411('0x30')](function(_0x2d352d){_0x1f65dc['rows']=_0x2d352d;return _0x1f65dc;})[_0xc411('0x30')](respondWithFilteredResult(_0x309437,_0x7b84af))[_0xc411('0x4a')](handleError(_0x309437,null));};exports[_0xc411('0x4b')]=function(_0x3bab77,_0x56f62b){var _0xfd189={'raw':!![],'where':{'id':_0x3bab77[_0xc411('0x4c')]['id']}},_0x574372={};_0x574372[_0xc411('0x40')]=_[_0xc411('0x3d')](db[_0xc411('0x38')][_0xc411('0x39')]);_0x574372[_0xc411('0x3c')]=_['keys'](_0x3bab77[_0xc411('0x3c')]);_0x574372['filters']=_[_0xc411('0x3f')](_0x574372[_0xc411('0x40')],_0x574372[_0xc411('0x3c')]);_0xfd189['attributes']=_[_0xc411('0x3f')](_0x574372['model'],qs['fields'](_0x3bab77[_0xc411('0x3c')][_0xc411('0x41')]));_0xfd189[_0xc411('0x42')]=_0xfd189[_0xc411('0x42')][_0xc411('0x4d')]?_0xfd189['attributes']:_0x574372['model'];if(_0x3bab77['query'][_0xc411('0x4e')]){_0xfd189[_0xc411('0x48')]=[{'all':!![]}];}_0xfd189=_[_0xc411('0x4f')]({},_0xfd189,_0x3bab77[_0xc411('0x50')]);return db[_0xc411('0x38')][_0xc411('0x51')](_0xfd189)[_0xc411('0x30')](handleEntityNotFound(_0x56f62b,null))['then'](respondWithResult(_0x56f62b,null))[_0xc411('0x4a')](handleError(_0x56f62b,null));};exports['create']=function(_0x1bbd99,_0x580a48){return db[_0xc411('0x38')][_0xc411('0x52')](_0x1bbd99[_0xc411('0x53')],{})[_0xc411('0x30')](function(_0xc8a4dd){var _0x3dd7fa=_0x1bbd99[_0xc411('0x54')][_0xc411('0x31')]({'plain':!![]});if(!_0x3dd7fa)throw new Error(_0xc411('0x55'));if(_0x3dd7fa['role']==='user'){var _0x1c2bf1=_0xc8a4dd[_0xc411('0x31')]({'plain':!![]});var _0xe40e85='FaxQueues';return db[_0xc411('0x56')]['find']({'where':{'name':_0xe40e85,'userProfileId':_0x3dd7fa['userProfileId']},'raw':!![]})[_0xc411('0x30')](function(_0x2ce39d){if(_0x2ce39d&&_0x2ce39d['autoAssociation']===0x0){return db[_0xc411('0x57')][_0xc411('0x52')]({'name':_0x1c2bf1[_0xc411('0x35')],'resourceId':_0x1c2bf1['id'],'type':_0x2ce39d[_0xc411('0x35')],'sectionId':_0x2ce39d['id']},{})[_0xc411('0x30')](function(){return _0xc8a4dd;});}else{return _0xc8a4dd;}})['catch'](function(_0x1ab070){logger[_0xc411('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ab070);throw _0x1ab070;});}return _0xc8a4dd;})[_0xc411('0x30')](respondWithResult(_0x580a48,0xc9))[_0xc411('0x4a')](handleError(_0x580a48,null));};exports[_0xc411('0x2f')]=function(_0x4107a7,_0x1707d3){if(_0x4107a7[_0xc411('0x53')]['id']){delete _0x4107a7[_0xc411('0x53')]['id'];}return db[_0xc411('0x38')][_0xc411('0x51')]({'where':{'id':_0x4107a7[_0xc411('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1707d3,null))[_0xc411('0x30')](saveUpdates(_0x4107a7[_0xc411('0x53')],null))['then'](respondWithResult(_0x1707d3,null))[_0xc411('0x4a')](handleError(_0x1707d3,null));};exports[_0xc411('0x33')]=function(_0x1c82db,_0x3c895f){return db[_0xc411('0x38')]['find']({'where':{'id':_0x1c82db[_0xc411('0x4c')]['id']}})[_0xc411('0x30')](handleEntityNotFound(_0x3c895f,null))[_0xc411('0x30')](removeEntity(_0x3c895f,null))[_0xc411('0x4a')](handleError(_0x3c895f,null));};exports[_0xc411('0x58')]=function(_0xd31d16,_0x181651){return db['FaxQueue'][_0xc411('0x58')]()[_0xc411('0x30')](respondWithResult(_0x181651,null))[_0xc411('0x4a')](handleError(_0x181651,null));};exports[_0xc411('0x59')]=function(_0x4cd1a0,_0x1b38cd,_0x3c1f3c){var _0x302ff9={'raw':!![],'where':{}},_0x300eef={},_0x1b4d14;return db[_0xc411('0x38')][_0xc411('0x5a')]({'where':{'id':_0x4cd1a0[_0xc411('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b38cd,null))[_0xc411('0x30')](function(_0x505312){if(_0x505312){_0x1b4d14=_0x505312['get']({'plain':!![]});_0x300eef['model']=_[_0xc411('0x3d')](db[_0xc411('0x5b')][_0xc411('0x39')]);_0x300eef[_0xc411('0x3c')]=_[_0xc411('0x3d')](_0x4cd1a0['query']);_0x300eef[_0xc411('0x3e')]=_['intersection'](_0x300eef[_0xc411('0x40')],_0x300eef['query']);_0x302ff9[_0xc411('0x42')]=_[_0xc411('0x3f')](_0x300eef['model'],qs[_0xc411('0x41')](_0x4cd1a0[_0xc411('0x3c')]['fields']));_0x302ff9['attributes']=_0x302ff9['attributes'][_0xc411('0x4d')]?_0x302ff9[_0xc411('0x42')]:_0x300eef['model'];if(!_0x4cd1a0[_0xc411('0x3c')][_0xc411('0x5c')](_0xc411('0x5d'))){_0x302ff9['limit']=qs[_0xc411('0x28')](_0x4cd1a0[_0xc411('0x3c')][_0xc411('0x28')]);_0x302ff9[_0xc411('0x26')]=qs[_0xc411('0x26')](_0x4cd1a0[_0xc411('0x3c')][_0xc411('0x26')]);}_0x302ff9['order']=qs[_0xc411('0x44')](_0x4cd1a0[_0xc411('0x3c')]['sort']);_0x302ff9['where']=qs[_0xc411('0x3e')](_[_0xc411('0x46')](_0x4cd1a0[_0xc411('0x3c')],_0x300eef[_0xc411('0x3e')]));_0x302ff9['where'][_0xc411('0x5e')]=_0x505312['id'];if(_0x4cd1a0[_0xc411('0x3c')]['filter']){_0x302ff9[_0xc411('0x45')]=_[_0xc411('0x4f')](_0x302ff9[_0xc411('0x45')],{'$or':_[_0xc411('0x37')](_0x302ff9[_0xc411('0x42')],function(_0x3abc9d){var _0x50df7e={};_0x50df7e[_0x3abc9d]={'$like':'%'+_0x4cd1a0[_0xc411('0x3c')][_0xc411('0x47')]+'%'};return _0x50df7e;})});}_0x302ff9=_[_0xc411('0x4f')]({},_0x302ff9,_0x4cd1a0['options']);return db[_0xc411('0x5b')][_0xc411('0x49')](_0x302ff9);}})['then'](function(_0x56ae99){if(_0x56ae99){return db['User'][_0xc411('0x5f')]({'where':{'id':_[_0xc411('0x37')](_0x56ae99,_0xc411('0x60')),'role':_0xc411('0x61')},'attributes':['id',_0xc411('0x35'),_0xc411('0x62'),_0xc411('0x63'),_0xc411('0x64')]});}})[_0xc411('0x30')](function(_0x383d5b){if(_0x383d5b){return{'count':_0x383d5b[_0xc411('0x29')],'rows':_[_0xc411('0x37')](_0x383d5b[_0xc411('0x65')],function(_0x13a249){return{'membername':_0x13a249[_0xc411('0x35')],'UserId':_0x13a249['id'],'queue_name':_0x1b4d14[_0xc411('0x35')],'FaxQueueId':_0x1b4d14['id'],'interface':util['format']('%s/%s',_0xc411('0x66'),_0x13a249[_0xc411('0x35')]),'penalty':0x0,'paused':_0x13a249['faxPause'],'createdAt':_0x13a249[_0xc411('0x64')],'updatedAt':_0x13a249['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc411('0x30')](respondWithFilteredResult(_0x1b38cd,_0x302ff9))[_0xc411('0x4a')](handleError(_0x1b38cd,null));};exports[_0xc411('0x67')]=function(_0x589076,_0xb2086e,_0xe6645){var _0x5bacd1={};var _0x276ce6={};var _0xf75828;var _0x26ec90;return db[_0xc411('0x38')][_0xc411('0x5a')]({'where':{'id':_0x589076[_0xc411('0x4c')]['id']}})[_0xc411('0x30')](handleEntityNotFound(_0xb2086e,null))[_0xc411('0x30')](function(_0x1e34f3){if(_0x1e34f3){_0xf75828=_0x1e34f3;_0x276ce6[_0xc411('0x40')]=_['keys'](db[_0xc411('0x68')][_0xc411('0x39')]);_0x276ce6[_0xc411('0x3c')]=_['keys'](_0x589076[_0xc411('0x3c')]);_0x276ce6[_0xc411('0x3e')]=_[_0xc411('0x3f')](_0x276ce6[_0xc411('0x40')],_0x276ce6[_0xc411('0x3c')]);_0x5bacd1[_0xc411('0x42')]=_[_0xc411('0x3f')](_0x276ce6[_0xc411('0x40')],qs[_0xc411('0x41')](_0x589076[_0xc411('0x3c')][_0xc411('0x41')]));_0x5bacd1['attributes']=_0x5bacd1[_0xc411('0x42')]['length']?_0x5bacd1['attributes']:_0x276ce6[_0xc411('0x40')];_0x5bacd1[_0xc411('0x43')]=qs[_0xc411('0x44')](_0x589076[_0xc411('0x3c')][_0xc411('0x44')]);_0x5bacd1[_0xc411('0x45')]=qs[_0xc411('0x3e')](_[_0xc411('0x46')](_0x589076[_0xc411('0x3c')],_0x276ce6[_0xc411('0x3e')]));if(_0x589076[_0xc411('0x3c')][_0xc411('0x47')]){_0x5bacd1[_0xc411('0x45')]=_[_0xc411('0x4f')](_0x5bacd1['where'],{'$or':_[_0xc411('0x37')](_0x5bacd1[_0xc411('0x42')],function(_0x57ffb3){var _0x38a423={};_0x38a423[_0x57ffb3]={'$like':'%'+_0x589076[_0xc411('0x3c')]['filter']+'%'};return _0x38a423;})});}_0x5bacd1=_[_0xc411('0x4f')]({},_0x5bacd1,_0x589076[_0xc411('0x50')]);return _0xf75828[_0xc411('0x67')](_0x5bacd1);}})[_0xc411('0x30')](function(_0x36f8ec){if(_0x36f8ec){_0x26ec90=_0x36f8ec[_0xc411('0x4d')];if(!_0x589076[_0xc411('0x3c')][_0xc411('0x5c')](_0xc411('0x5d'))){_0x5bacd1['limit']=qs[_0xc411('0x28')](_0x589076[_0xc411('0x3c')][_0xc411('0x28')]);_0x5bacd1[_0xc411('0x26')]=qs[_0xc411('0x26')](_0x589076[_0xc411('0x3c')][_0xc411('0x26')]);}return _0xf75828[_0xc411('0x67')](_0x5bacd1);}})['then'](function(_0x45c001){if(_0x45c001){return _0x45c001?{'count':_0x26ec90,'rows':_0x45c001}:null;}})['then'](respondWithResult(_0xb2086e,null))[_0xc411('0x4a')](handleError(_0xb2086e,null));};exports[_0xc411('0x69')]=function(_0x2c214c,_0x5aa007,_0x390aca){var _0x2c23f1=_0x2c214c['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x2c23f1},'attributes':['id'],'include':[{'model':db[_0xc411('0x6a')],'as':'Agents','attributes':['id',_0xc411('0x35'),_0xc411('0x6b'),'voicePause',_0xc411('0x6c')],'raw':!![]}]})[_0xc411('0x30')](function(_0x1c8d72){if(_0x1c8d72){var _0x110b49=_[_0xc411('0x6d')](_0x1c8d72,function(_0x277f31){var _0x3f1e63=_0x277f31[_0xc411('0x31')]({'plain':!![]});return _0x3f1e63[_0xc411('0x6e')];});return db[_0xc411('0x38')][_0xc411('0x51')]({'where':{'id':_0x2c214c['params']['id']}})[_0xc411('0x30')](function(_0x1852b0){return db[_0xc411('0x6f')][_0xc411('0x70')](function(_0x32220e){return _0x1852b0['addTeams'](_0x2c23f1,{'transaction':_0x32220e})[_0xc411('0x30')](function(){return BPromise[_0xc411('0x71')](_0x110b49,function(_0x48cdae){return db[_0xc411('0x5b')]['findOrCreate']({'where':{'UserId':_0x48cdae['id'],'FaxQueueId':_0x2c214c[_0xc411('0x4c')]['id']},'transaction':_0x32220e});});})[_0xc411('0x30')](function(){_0x110b49[_0xc411('0x72')](function(_0x16a4f5){socket[_0xc411('0x73')]('userFaxQueue:save',{'UserId':_0x16a4f5['id'],'FaxQueueId':_0x1852b0['id']});});});});});}})['then'](respondWithStatusCode(_0x5aa007,null))[_0xc411('0x4a')](handleError(_0x5aa007,null));};exports[_0xc411('0x74')]=function(_0xd957f1,_0x4686fd,_0x8f8443){return db[_0xc411('0x68')][_0xc411('0x49')]({'where':{'id':_0xd957f1[_0xc411('0x3c')][_0xc411('0x75')]},'attributes':['id'],'include':[{'model':db[_0xc411('0x6a')],'as':_0xc411('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xc411('0x30')](handleEntityNotFound(_0x4686fd,null))[_0xc411('0x30')](function(_0x4046f5){var _0x1df7de=_['map'](_0x4046f5,'id');var _0x1322b2=[];var _0x2cc817=[];var _0x2b9da8=squel['select']();_0x2b9da8['field'](_0xc411('0x76'))[_0xc411('0x77')](_0xc411('0x78'),'tq')['join'](_0xc411('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc411('0x45')](_0xc411('0x7a'),_0xd957f1[_0xc411('0x4c')]['id']);for(var _0x45fcc3=0x0;_0x45fcc3<_0x4046f5['length'];_0x45fcc3+=0x1){let _0x2e13e1=_0x4046f5[_0x45fcc3];for(var _0x471b42=0x0;_0x471b42<_0x2e13e1[_0xc411('0x6e')][_0xc411('0x4d')];_0x471b42+=0x1){let _0x3f7728=_0x2e13e1['Agents'][_0x471b42];var _0xdd9937=_0x2b9da8[_0xc411('0x7b')]();_0xdd9937['where'](_0xc411('0x7c'),_0x3f7728['id']);_0x2cc817[_0xc411('0x7d')](db[_0xc411('0x6f')]['query'](_0xdd9937[_0xc411('0x7e')](),{'type':db[_0xc411('0x6f')][_0xc411('0x7f')][_0xc411('0x80')]})[_0xc411('0x30')](function(_0x24fbd4){if(_0x24fbd4[_0xc411('0x4d')]===0x1){return _0x3f7728['id'];}else{var _0x4b528b=_[_0xc411('0x81')](_[_0xc411('0x37')](_0x24fbd4,_0xc411('0x82')),function(_0x743d28){return _[_0xc411('0x83')](_0x1df7de,_0x743d28);});if(_0x4b528b){return _0x3f7728['id'];}}}));}}return BPromise['all'](_0x2cc817)[_0xc411('0x30')](function(_0x197e6d){_0x1322b2=_(_0x1322b2)[_0xc411('0x84')](_0x197e6d)['compact']()[_0xc411('0x85')]();return db[_0xc411('0x38')][_0xc411('0x51')]({'where':{'id':_0xd957f1[_0xc411('0x4c')]['id']}})[_0xc411('0x30')](function(_0x319b09){return db[_0xc411('0x6f')][_0xc411('0x70')](function(_0x5c2d1a){return _0x319b09[_0xc411('0x74')](_0xd957f1[_0xc411('0x3c')]['ids'],{'transaction':_0x5c2d1a})[_0xc411('0x30')](function(){if(!_['isEmpty'](_0x1322b2)){return _0x319b09[_0xc411('0x86')](_0x1322b2,{'transaction':_0x5c2d1a});}})[_0xc411('0x30')](function(){_0x1322b2[_0xc411('0x72')](function(_0x5ddfed){socket[_0xc411('0x73')]('userFaxQueue:remove',{'UserId':_0x5ddfed,'FaxQueueId':_0x319b09['id']});});});});});});})[_0xc411('0x30')](respondWithStatusCode(_0x4686fd,null))[_0xc411('0x4a')](handleError(_0x4686fd,null));};exports[_0xc411('0x87')]=function(_0x4c89ce,_0x50eb0c,_0xb56102){return db[_0xc411('0x38')]['find']({'where':{'id':_0x4c89ce[_0xc411('0x4c')]['id']}})[_0xc411('0x30')](handleEntityNotFound(_0x50eb0c,null))['then'](function(_0xdf5f07){if(_0xdf5f07){return _0xdf5f07['addAgents'](_0x4c89ce[_0xc411('0x53')][_0xc411('0x75')],_['omit'](_0x4c89ce['body'],['ids','id'])||{})[_0xc411('0x88')](function(_0x46288d){for(var _0x3ec4d3=0x0;_0x3ec4d3<_0x4c89ce[_0xc411('0x53')][_0xc411('0x75')]['length'];_0x3ec4d3+=0x1){socket[_0xc411('0x73')](_0xc411('0x89'),{'UserId':Number(_0x4c89ce['body'][_0xc411('0x75')][_0x3ec4d3]),'FaxQueueId':Number(_0x4c89ce[_0xc411('0x4c')]['id'])});}return _0x46288d;});}})[_0xc411('0x30')](respondWithResult(_0x50eb0c,null))[_0xc411('0x4a')](handleError(_0x50eb0c,null));};exports['removeAgents']=function(_0x36637a,_0x79506f,_0x404f11){return db[_0xc411('0x38')][_0xc411('0x51')]({'where':{'id':_0x36637a['params']['id']}})[_0xc411('0x30')](handleEntityNotFound(_0x79506f,null))['then'](function(_0x2fd753){if(_0x2fd753){return _0x2fd753[_0xc411('0x86')](_0x36637a[_0xc411('0x3c')][_0xc411('0x75')])[_0xc411('0x30')](function(){if(_[_0xc411('0x8a')](_0x36637a['query'][_0xc411('0x75')])){for(var _0x372bd6=0x0;_0x372bd6<_0x36637a['query'][_0xc411('0x75')][_0xc411('0x4d')];_0x372bd6+=0x1){socket[_0xc411('0x73')](_0xc411('0x8b'),{'UserId':Number(_0x36637a['query'][_0xc411('0x75')][_0x372bd6]),'FaxQueueId':Number(_0x36637a[_0xc411('0x4c')]['id'])});}}else{socket['emit'](_0xc411('0x8b'),{'UserId':Number(_0x36637a[_0xc411('0x3c')]['ids']),'FaxQueueId':Number(_0x36637a[_0xc411('0x4c')]['id'])});}});}})[_0xc411('0x30')](respondWithStatusCode(_0x79506f,null))['catch'](handleError(_0x79506f,null));};exports['getAgents']=function(_0x17f8f0,_0x1609bd,_0x364846){var _0x1a41cd={};var _0x24c2d0={};var _0x587491;var _0x49a5eb;return db[_0xc411('0x38')]['findOne']({'where':{'id':_0x17f8f0[_0xc411('0x4c')]['id']}})[_0xc411('0x30')](handleEntityNotFound(_0x1609bd,null))[_0xc411('0x30')](function(_0x40e731){if(_0x40e731){_0x587491=_0x40e731;_0x24c2d0['model']=_['keys'](db['User'][_0xc411('0x39')]);_0x24c2d0[_0xc411('0x3c')]=_[_0xc411('0x3d')](_0x17f8f0[_0xc411('0x3c')]);_0x24c2d0[_0xc411('0x3e')]=_[_0xc411('0x3f')](_0x24c2d0[_0xc411('0x40')],_0x24c2d0[_0xc411('0x3c')]);_0x1a41cd['attributes']=_[_0xc411('0x3f')](_0x24c2d0['model'],qs[_0xc411('0x41')](_0x17f8f0[_0xc411('0x3c')]['fields']));_0x1a41cd[_0xc411('0x42')]=_0x1a41cd[_0xc411('0x42')][_0xc411('0x4d')]?_0x1a41cd[_0xc411('0x42')]:_0x24c2d0[_0xc411('0x40')];_0x1a41cd[_0xc411('0x43')]=qs[_0xc411('0x44')](_0x17f8f0['query'][_0xc411('0x44')]);_0x1a41cd['where']=qs[_0xc411('0x3e')](_[_0xc411('0x46')](_0x17f8f0[_0xc411('0x3c')],_0x24c2d0[_0xc411('0x3e')]));if(_0x17f8f0[_0xc411('0x3c')][_0xc411('0x47')]){_0x1a41cd[_0xc411('0x45')]=_[_0xc411('0x4f')](_0x1a41cd['where'],{'$or':_[_0xc411('0x37')](_0x1a41cd['attributes'],function(_0x5169ed){var _0x2139b9={};_0x2139b9[_0x5169ed]={'$like':'%'+_0x17f8f0['query'][_0xc411('0x47')]+'%'};return _0x2139b9;})});}_0x1a41cd=_[_0xc411('0x4f')]({},_0x1a41cd,_0x17f8f0[_0xc411('0x50')]);return _0x587491[_0xc411('0x8c')](_0x1a41cd);}})[_0xc411('0x30')](function(_0x793238){if(_0x793238){_0x49a5eb=_0x793238[_0xc411('0x4d')];if(!_0x17f8f0[_0xc411('0x3c')][_0xc411('0x5c')]('nolimit')){_0x1a41cd[_0xc411('0x28')]=qs[_0xc411('0x28')](_0x17f8f0[_0xc411('0x3c')]['limit']);_0x1a41cd['offset']=qs[_0xc411('0x26')](_0x17f8f0[_0xc411('0x3c')][_0xc411('0x26')]);}return _0x587491['getAgents'](_0x1a41cd);}})[_0xc411('0x30')](function(_0x2d0408){if(_0x2d0408){return _0x2d0408?{'count':_0x49a5eb,'rows':_0x2d0408}:null;}})[_0xc411('0x30')](respondWithResult(_0x1609bd,null))['catch'](handleError(_0x1609bd,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 4756908..8a1e4f3 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 _0x2b43=['save','remove','emit','hasOwnProperty','setMaxListeners'];(function(_0x3071ab,_0x574a59){var _0x2f458c=function(_0x1eb9c7){while(--_0x1eb9c7){_0x3071ab['push'](_0x3071ab['shift']());}};_0x2f458c(++_0x574a59);}(_0x2b43,0x17b));var _0x32b4=function(_0x3b4024,_0x346d48){_0x3b4024=_0x3b4024-0x0;var _0x11920f=_0x2b43[_0x3b4024];return _0x11920f;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x32b4('0x0')](0x0);var events={'afterCreate':_0x32b4('0x1'),'afterUpdate':'update','afterDestroy':_0x32b4('0x2')};function emitEvent(_0x4a69dc){return function(_0x155f38,_0x380d15,_0x2581fd){FaxQueueEvents[_0x32b4('0x3')](_0x4a69dc+':'+_0x155f38['id'],_0x155f38);FaxQueueEvents[_0x32b4('0x3')](_0x4a69dc,_0x155f38);_0x2581fd(null);};}for(var e in events){if(events[_0x32b4('0x4')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x4d5e=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x45c43f,_0x343b96){var _0x39fc3e=function(_0x492eb9){while(--_0x492eb9){_0x45c43f['push'](_0x45c43f['shift']());}};_0x39fc3e(++_0x343b96);}(_0x4d5e,0x1db));var _0xe4d5=function(_0xf03404,_0x54b2ad){_0xf03404=_0xf03404-0x0;var _0x10eb4e=_0x4d5e[_0xf03404];return _0x10eb4e;};'use strict';var EventEmitter=require(_0xe4d5('0x0'));var FaxQueue=require(_0xe4d5('0x1'))['db'][_0xe4d5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe4d5('0x3')](0x0);var events={'afterCreate':_0xe4d5('0x4'),'afterUpdate':_0xe4d5('0x5'),'afterDestroy':_0xe4d5('0x6')};function emitEvent(_0x501582){return function(_0x2316ad,_0x3d9334,_0x50ec5a){FaxQueueEvents['emit'](_0x501582+':'+_0x2316ad['id'],_0x2316ad);FaxQueueEvents[_0xe4d5('0x7')](_0x501582,_0x2316ad);_0x50ec5a(null);};}for(var e in events){if(events[_0xe4d5('0x8')](e)){var event=events[e];FaxQueue[_0xe4d5('0x9')](e,emitEvent(event));}}module[_0xe4d5('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index a2cdc78..02d8c86 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 _0x8ce5=['./faxQueue.attributes','exports','define','FaxQueue','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x4b11ff,_0x51e4fe){var _0x1032bb=function(_0x1bd20d){while(--_0x1bd20d){_0x4b11ff['push'](_0x4b11ff['shift']());}};_0x1032bb(++_0x51e4fe);}(_0x8ce5,0x130));var _0x58ce=function(_0x425755,_0x1de5eb){_0x425755=_0x425755-0x0;var _0x45116e=_0x8ce5[_0x425755];return _0x45116e;};'use strict';var _=require('lodash');var util=require(_0x58ce('0x0'));var logger=require(_0x58ce('0x1'))(_0x58ce('0x2'));var moment=require('moment');var BPromise=require(_0x58ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58ce('0x4'));var rimraf=require('rimraf');var config=require(_0x58ce('0x5'));var attributes=require(_0x58ce('0x6'));module[_0x58ce('0x7')]=function(_0x532c2c,_0x456dfb){return _0x532c2c[_0x58ce('0x8')](_0x58ce('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d79=['moment','request-promise','path','rimraf','./faxQueue.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x327f7d,_0x186a9a){var _0x3e4046=function(_0x176ce8){while(--_0x176ce8){_0x327f7d['push'](_0x327f7d['shift']());}};_0x3e4046(++_0x186a9a);}(_0x1d79,0x18d));var _0x91d7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1d79[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x91d7('0x0'));var util=require(_0x91d7('0x1'));var logger=require(_0x91d7('0x2'))('api');var moment=require(_0x91d7('0x3'));var BPromise=require('bluebird');var rp=require(_0x91d7('0x4'));var fs=require('fs');var path=require(_0x91d7('0x5'));var rimraf=require(_0x91d7('0x6'));var config=require('../../config/environment');var attributes=require(_0x91d7('0x7'));module[_0x91d7('0x8')]=function(_0x265cfa,_0x49a792){return _0x265cfa[_0x91d7('0x9')]('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 af03391..66424c4 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 _0xdfa5=['options','raw','where','attributes','include','model','map','stringify','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll'];(function(_0x4c5eae,_0x4d1a6a){var _0x397fc6=function(_0x55b84e){while(--_0x55b84e){_0x4c5eae['push'](_0x4c5eae['shift']());}};_0x397fc6(++_0x4d1a6a);}(_0xdfa5,0xf3));var _0x5dfa=function(_0x29bb51,_0x1fb819){_0x29bb51=_0x29bb51-0x0;var _0x2dbdb3=_0xdfa5[_0x29bb51];return _0x2dbdb3;};'use strict';var _=require(_0x5dfa('0x0'));var util=require(_0x5dfa('0x1'));var moment=require(_0x5dfa('0x2'));var BPromise=require(_0x5dfa('0x3'));var rs=require(_0x5dfa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5dfa('0x5'))['db'];var utils=require(_0x5dfa('0x6'));var logger=require(_0x5dfa('0x7'))(_0x5dfa('0x8'));var config=require(_0x5dfa('0x9'));var jayson=require(_0x5dfa('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x5dfa('0xb')]=_['defaults'](config[_0x5dfa('0xb')],{'host':_0x5dfa('0xc'),'port':0x18eb});var socket=require(_0x5dfa('0xd'))(new Redis(config[_0x5dfa('0xb')]));require(_0x5dfa('0xe'))['register'](socket);function respondWithRpcPromise(_0x465ab1,_0x53a1d6,_0x43fdd1){return new BPromise(function(_0x4c0e3a,_0x55a471){return client[_0x5dfa('0xf')](_0x465ab1,_0x43fdd1)[_0x5dfa('0x10')](function(_0x3f718e){logger[_0x5dfa('0x11')](_0x5dfa('0x12'),_0x53a1d6,'request\x20sent');logger[_0x5dfa('0x13')](_0x5dfa('0x14'),_0x53a1d6,_0x5dfa('0x15'),JSON['stringify'](_0x3f718e));if(_0x3f718e['error']){if(_0x3f718e[_0x5dfa('0x16')][_0x5dfa('0x17')]===0x1f4){logger[_0x5dfa('0x16')](_0x5dfa('0x12'),_0x53a1d6,_0x3f718e[_0x5dfa('0x16')]['message']);return _0x55a471(_0x3f718e[_0x5dfa('0x16')][_0x5dfa('0x18')]);}logger['error'](_0x5dfa('0x12'),_0x53a1d6,_0x3f718e['error']['message']);return _0x4c0e3a(_0x3f718e[_0x5dfa('0x16')][_0x5dfa('0x18')]);}else{logger[_0x5dfa('0x11')](_0x5dfa('0x12'),_0x53a1d6,_0x5dfa('0x15'));_0x4c0e3a(_0x3f718e[_0x5dfa('0x19')][_0x5dfa('0x18')]);}})[_0x5dfa('0x1a')](function(_0x41ee30){logger[_0x5dfa('0x16')](_0x5dfa('0x12'),_0x53a1d6,_0x41ee30);_0x55a471(_0x41ee30);});});}exports[_0x5dfa('0x1b')]=function(_0x12a682){var _0x50cc81=this;return new Promise(function(_0x937ca4,_0x3d92c1){return db[_0x5dfa('0x1c')][_0x5dfa('0x1d')]({'raw':_0x12a682[_0x5dfa('0x1e')]?_0x12a682[_0x5dfa('0x1e')][_0x5dfa('0x1f')]===undefined?!![]:![]:!![],'where':_0x12a682['options']?_0x12a682[_0x5dfa('0x1e')][_0x5dfa('0x20')]||null:null,'attributes':_0x12a682[_0x5dfa('0x1e')]?_0x12a682['options'][_0x5dfa('0x21')]||null:null,'limit':_0x12a682['options']?_0x12a682[_0x5dfa('0x1e')]['limit']||null:null,'include':_0x12a682[_0x5dfa('0x1e')]?_0x12a682[_0x5dfa('0x1e')][_0x5dfa('0x22')]?_['map'](_0x12a682['options']['include'],function(_0x2a3d67){return{'model':db[_0x2a3d67['model']],'as':_0x2a3d67['as'],'attributes':_0x2a3d67[_0x5dfa('0x21')],'include':_0x2a3d67[_0x5dfa('0x22')]?_['map'](_0x2a3d67['include'],function(_0x190be9){return{'model':db[_0x190be9[_0x5dfa('0x23')]],'as':_0x190be9['as'],'attributes':_0x190be9[_0x5dfa('0x21')],'include':_0x190be9['include']?_[_0x5dfa('0x24')](_0x190be9[_0x5dfa('0x22')],function(_0x52e010){return{'model':db[_0x52e010[_0x5dfa('0x23')]],'as':_0x52e010['as'],'attributes':_0x52e010[_0x5dfa('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47e45c){logger['info']('GetFaxQueue',_0x12a682);logger[_0x5dfa('0x13')](_0x5dfa('0x1b'),_0x12a682,JSON[_0x5dfa('0x25')](_0x47e45c));_0x937ca4(_0x47e45c);})['catch'](function(_0x1ec404){logger[_0x5dfa('0x16')](_0x5dfa('0x1b'),_0x1ec404['message'],_0x12a682);_0x3d92c1(_0x50cc81['error'](0x1f4,_0x1ec404['message']));});});};exports['ShowFaxQueue']=function(_0x4ff22b){var _0x574f9d=this;return new Promise(function(_0x49d8ec,_0x22fe37){return db[_0x5dfa('0x1c')]['find']({'raw':_0x4ff22b['options']?_0x4ff22b[_0x5dfa('0x1e')][_0x5dfa('0x1f')]===undefined?!![]:![]:!![],'where':_0x4ff22b[_0x5dfa('0x1e')]?_0x4ff22b[_0x5dfa('0x1e')][_0x5dfa('0x20')]||null:null,'attributes':_0x4ff22b[_0x5dfa('0x1e')]?_0x4ff22b[_0x5dfa('0x1e')][_0x5dfa('0x21')]||null:null,'include':_0x4ff22b['options']?_0x4ff22b[_0x5dfa('0x1e')]['include']?_[_0x5dfa('0x24')](_0x4ff22b[_0x5dfa('0x1e')][_0x5dfa('0x22')],function(_0x23d856){return{'model':db[_0x23d856[_0x5dfa('0x23')]],'as':_0x23d856['as'],'attributes':_0x23d856[_0x5dfa('0x21')],'include':_0x23d856[_0x5dfa('0x22')]?_[_0x5dfa('0x24')](_0x23d856[_0x5dfa('0x22')],function(_0x5c0be5){return{'model':db[_0x5c0be5[_0x5dfa('0x23')]],'as':_0x5c0be5['as'],'attributes':_0x5c0be5['attributes'],'include':_0x5c0be5['include']?_[_0x5dfa('0x24')](_0x5c0be5[_0x5dfa('0x22')],function(_0x3e975a){return{'model':db[_0x3e975a[_0x5dfa('0x23')]],'as':_0x3e975a['as'],'attributes':_0x3e975a[_0x5dfa('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5dfa('0x10')](function(_0x452319){logger[_0x5dfa('0x11')](_0x5dfa('0x26'),_0x4ff22b);logger[_0x5dfa('0x13')]('ShowFaxQueue',_0x4ff22b,JSON[_0x5dfa('0x25')](_0x452319));_0x49d8ec(_0x452319);})['catch'](function(_0x3fb622){logger[_0x5dfa('0x16')](_0x5dfa('0x26'),_0x3fb622[_0x5dfa('0x18')],_0x4ff22b);_0x22fe37(_0x574f9d['error'](0x1f4,_0x3fb622[_0x5dfa('0x18')]));});});}; \ No newline at end of file +var _0x516a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','include','map','model','attributes','debug','stringify','find','ShowFaxQueue','lodash','util','moment'];(function(_0x461a42,_0x282c5b){var _0x38a8a5=function(_0x44d2ad){while(--_0x44d2ad){_0x461a42['push'](_0x461a42['shift']());}};_0x38a8a5(++_0x282c5b);}(_0x516a,0x1cb));var _0xa516=function(_0x5a2837,_0x67be2d){_0x5a2837=_0x5a2837-0x0;var _0x534f71=_0x516a[_0x5a2837];return _0x534f71;};'use strict';var _=require(_0xa516('0x0'));var util=require(_0xa516('0x1'));var moment=require(_0xa516('0x2'));var BPromise=require(_0xa516('0x3'));var rs=require(_0xa516('0x4'));var fs=require('fs');var Redis=require(_0xa516('0x5'));var db=require(_0xa516('0x6'))['db'];var utils=require(_0xa516('0x7'));var logger=require('../../config/logger')(_0xa516('0x8'));var config=require(_0xa516('0x9'));var jayson=require(_0xa516('0xa'));var client=jayson[_0xa516('0xb')][_0xa516('0xc')]({'port':0x232a});config[_0xa516('0xd')]=_[_0xa516('0xe')](config['redis'],{'host':_0xa516('0xf'),'port':0x18eb});var socket=require(_0xa516('0x10'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xa516('0x11')](socket);function respondWithRpcPromise(_0x51aa7e,_0x437705,_0x1ec580){return new BPromise(function(_0x372820,_0x5129be){return client[_0xa516('0x12')](_0x51aa7e,_0x1ec580)[_0xa516('0x13')](function(_0x5c60a5){logger[_0xa516('0x14')](_0xa516('0x15'),_0x437705,_0xa516('0x16'));logger['debug'](_0xa516('0x17'),_0x437705,'request\x20sent',JSON['stringify'](_0x5c60a5));if(_0x5c60a5[_0xa516('0x18')]){if(_0x5c60a5[_0xa516('0x18')][_0xa516('0x19')]===0x1f4){logger[_0xa516('0x18')]('FaxQueue,\x20%s,\x20%s',_0x437705,_0x5c60a5['error'][_0xa516('0x1a')]);return _0x5129be(_0x5c60a5[_0xa516('0x18')][_0xa516('0x1a')]);}logger[_0xa516('0x18')]('FaxQueue,\x20%s,\x20%s',_0x437705,_0x5c60a5[_0xa516('0x18')]['message']);return _0x372820(_0x5c60a5['error'][_0xa516('0x1a')]);}else{logger[_0xa516('0x14')](_0xa516('0x15'),_0x437705,_0xa516('0x16'));_0x372820(_0x5c60a5[_0xa516('0x1b')][_0xa516('0x1a')]);}})[_0xa516('0x1c')](function(_0x1e2c29){logger['error'](_0xa516('0x15'),_0x437705,_0x1e2c29);_0x5129be(_0x1e2c29);});});}exports[_0xa516('0x1d')]=function(_0x198d2d){var _0x4d1dc7=this;return new Promise(function(_0x4fbabe,_0x17d148){return db[_0xa516('0x1e')]['findAll']({'raw':_0x198d2d[_0xa516('0x1f')]?_0x198d2d['options'][_0xa516('0x20')]===undefined?!![]:![]:!![],'where':_0x198d2d[_0xa516('0x1f')]?_0x198d2d[_0xa516('0x1f')][_0xa516('0x21')]||null:null,'attributes':_0x198d2d[_0xa516('0x1f')]?_0x198d2d[_0xa516('0x1f')]['attributes']||null:null,'limit':_0x198d2d[_0xa516('0x1f')]?_0x198d2d[_0xa516('0x1f')]['limit']||null:null,'include':_0x198d2d[_0xa516('0x1f')]?_0x198d2d[_0xa516('0x1f')][_0xa516('0x22')]?_[_0xa516('0x23')](_0x198d2d['options'][_0xa516('0x22')],function(_0x1f1ffd){return{'model':db[_0x1f1ffd[_0xa516('0x24')]],'as':_0x1f1ffd['as'],'attributes':_0x1f1ffd[_0xa516('0x25')],'include':_0x1f1ffd[_0xa516('0x22')]?_[_0xa516('0x23')](_0x1f1ffd['include'],function(_0x5810fa){return{'model':db[_0x5810fa[_0xa516('0x24')]],'as':_0x5810fa['as'],'attributes':_0x5810fa[_0xa516('0x25')],'include':_0x5810fa['include']?_['map'](_0x5810fa[_0xa516('0x22')],function(_0x6fa0c5){return{'model':db[_0x6fa0c5[_0xa516('0x24')]],'as':_0x6fa0c5['as'],'attributes':_0x6fa0c5['attributes']};}):[]};}):[]};}):[]:[]})[_0xa516('0x13')](function(_0x2bee77){logger[_0xa516('0x14')](_0xa516('0x1d'),_0x198d2d);logger[_0xa516('0x26')](_0xa516('0x1d'),_0x198d2d,JSON[_0xa516('0x27')](_0x2bee77));_0x4fbabe(_0x2bee77);})[_0xa516('0x1c')](function(_0x5168a2){logger['error'](_0xa516('0x1d'),_0x5168a2[_0xa516('0x1a')],_0x198d2d);_0x17d148(_0x4d1dc7[_0xa516('0x18')](0x1f4,_0x5168a2[_0xa516('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x48cfe3){var _0x4d7c35=this;return new Promise(function(_0x596063,_0x228bc7){return db['FaxQueue'][_0xa516('0x28')]({'raw':_0x48cfe3[_0xa516('0x1f')]?_0x48cfe3[_0xa516('0x1f')][_0xa516('0x20')]===undefined?!![]:![]:!![],'where':_0x48cfe3[_0xa516('0x1f')]?_0x48cfe3[_0xa516('0x1f')][_0xa516('0x21')]||null:null,'attributes':_0x48cfe3[_0xa516('0x1f')]?_0x48cfe3[_0xa516('0x1f')][_0xa516('0x25')]||null:null,'include':_0x48cfe3[_0xa516('0x1f')]?_0x48cfe3[_0xa516('0x1f')][_0xa516('0x22')]?_[_0xa516('0x23')](_0x48cfe3[_0xa516('0x1f')][_0xa516('0x22')],function(_0x24f00e){return{'model':db[_0x24f00e[_0xa516('0x24')]],'as':_0x24f00e['as'],'attributes':_0x24f00e[_0xa516('0x25')],'include':_0x24f00e['include']?_['map'](_0x24f00e[_0xa516('0x22')],function(_0x224b04){return{'model':db[_0x224b04[_0xa516('0x24')]],'as':_0x224b04['as'],'attributes':_0x224b04[_0xa516('0x25')],'include':_0x224b04[_0xa516('0x22')]?_[_0xa516('0x23')](_0x224b04['include'],function(_0x4371b4){return{'model':db[_0x4371b4[_0xa516('0x24')]],'as':_0x4371b4['as'],'attributes':_0x4371b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xa516('0x13')](function(_0x1c7057){logger[_0xa516('0x14')](_0xa516('0x29'),_0x48cfe3);logger[_0xa516('0x26')](_0xa516('0x29'),_0x48cfe3,JSON[_0xa516('0x27')](_0x1c7057));_0x596063(_0x1c7057);})[_0xa516('0x1c')](function(_0x414ac3){logger[_0xa516('0x18')](_0xa516('0x29'),_0x414ac3[_0xa516('0x1a')],_0x48cfe3);_0x228bc7(_0x4d7c35['error'](0x1f4,_0x414ac3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 12943ce..f0c00bc 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 _0xb78f=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x4cfa2e,_0x5752b5){var _0x279b50=function(_0x3f817b){while(--_0x3f817b){_0x4cfa2e['push'](_0x4cfa2e['shift']());}};_0x279b50(++_0x5752b5);}(_0xb78f,0x134));var _0xfb78=function(_0x2eb211,_0x156731){_0x2eb211=_0x2eb211-0x0;var _0x1f9f7f=_0xb78f[_0x2eb211];return _0x1f9f7f;};'use strict';var FaxQueueEvents=require(_0xfb78('0x0'));var events=[_0xfb78('0x1'),_0xfb78('0x2'),_0xfb78('0x3')];function createListener(_0x40bbd4,_0x122834){return function(_0x1d415e){_0x122834[_0xfb78('0x4')](_0x40bbd4,_0x1d415e);};}function removeListener(_0x49c43d,_0x348c03){return function(){FaxQueueEvents[_0xfb78('0x5')](_0x49c43d,_0x348c03);};}exports[_0xfb78('0x6')]=function(_0x5e965c){for(var _0x77615d=0x0,_0x1ea90e=events[_0xfb78('0x7')];_0x77615d<_0x1ea90e;_0x77615d++){var _0x4dc72d=events[_0x77615d];var _0x729197=createListener(_0xfb78('0x8')+_0x4dc72d,_0x5e965c);FaxQueueEvents['on'](_0x4dc72d,_0x729197);}}; \ No newline at end of file +var _0x2411=['faxQueue:','save','remove','update','removeListener','register'];(function(_0x4dee16,_0x599bf4){var _0xe688a9=function(_0x2a6a2a){while(--_0x2a6a2a){_0x4dee16['push'](_0x4dee16['shift']());}};_0xe688a9(++_0x599bf4);}(_0x2411,0x175));var _0x1241=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x2411[_0x4e93a9];return _0x43013c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x1241('0x0'),_0x1241('0x1'),_0x1241('0x2')];function createListener(_0x22f54f,_0x32eeb2){return function(_0x28dac6){_0x32eeb2['emit'](_0x22f54f,_0x28dac6);};}function removeListener(_0x151bae,_0x88409d){return function(){FaxQueueEvents[_0x1241('0x3')](_0x151bae,_0x88409d);};}exports[_0x1241('0x4')]=function(_0x3b2074){for(var _0x1f9d02=0x0,_0x358ebb=events['length'];_0x1f9d02<_0x358ebb;_0x1f9d02++){var _0x309200=events[_0x1f9d02];var _0x136400=createListener(_0x1241('0x5')+_0x309200,_0x3b2074);FaxQueueEvents['on'](_0x309200,_0x136400);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 0fb5352..f4ad5d9 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 _0x4c60=['destroy','multer','util','path','connect-timeout','Router','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete'];(function(_0x3158e8,_0xd941f9){var _0x1aefcb=function(_0x3acb4e){while(--_0x3acb4e){_0x3158e8['push'](_0x3158e8['shift']());}};_0x1aefcb(++_0xd941f9);}(_0x4c60,0xc1));var _0x04c6=function(_0x3f0152,_0x39ec12){_0x3f0152=_0x3f0152-0x0;var _0xecd19b=_0x4c60[_0x3f0152];return _0xecd19b;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('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(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['describe']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x04c6('0xc')]);router['get'](_0x04c6('0xd'),auth[_0x04c6('0x7')](),controller['getTeams']);router[_0x04c6('0x6')](_0x04c6('0xe'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xf')]);router['post']('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x10')]);router[_0x04c6('0x11')]('/:id/teams',auth[_0x04c6('0x7')](),controller[_0x04c6('0x12')]);router[_0x04c6('0x11')](_0x04c6('0xe'),auth[_0x04c6('0x7')](),controller[_0x04c6('0x13')]);router[_0x04c6('0x14')](_0x04c6('0xa'),auth['isAuthenticated'](),controller[_0x04c6('0x15')]);router[_0x04c6('0x16')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0x17')]);router[_0x04c6('0x16')](_0x04c6('0xd'),auth[_0x04c6('0x7')](),controller['removeTeams']);router[_0x04c6('0x16')](_0x04c6('0xe'),auth[_0x04c6('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9a5a=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','delete','removeTeams','exports','multer','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9a5a,0x194));var _0xa9a5=function(_0x181f5f,_0x1f4572){_0x181f5f=_0x181f5f-0x0;var _0x9861c0=_0x9a5a[_0x181f5f];return _0x9861c0;};'use strict';var multer=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var path=require(_0xa9a5('0x2'));var timeout=require(_0xa9a5('0x3'));var express=require(_0xa9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xa9a5('0x5'));var auth=require(_0xa9a5('0x6'));var interaction=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var controller=require(_0xa9a5('0x9'));router[_0xa9a5('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a5('0xb')]);router[_0xa9a5('0xa')](_0xa9a5('0xc'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa9a5('0xf')]);router[_0xa9a5('0xa')](_0xa9a5('0x10'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x11')]);router[_0xa9a5('0xa')](_0xa9a5('0x12'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xa9a5('0x13'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x14')]);router[_0xa9a5('0x15')]('/',auth[_0xa9a5('0xd')](),controller['create']);router[_0xa9a5('0x15')](_0xa9a5('0x12'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x16')]);router[_0xa9a5('0x15')](_0xa9a5('0x13'),auth['isAuthenticated'](),controller[_0xa9a5('0x17')]);router[_0xa9a5('0x18')](_0xa9a5('0x19'),auth[_0xa9a5('0xd')](),controller['update']);router[_0xa9a5('0x1a')](_0xa9a5('0x19'),auth[_0xa9a5('0xd')](),controller['destroy']);router[_0xa9a5('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa9a5('0x1b')]);router[_0xa9a5('0x1a')]('/:id/users',auth[_0xa9a5('0xd')](),controller['removeAgents']);module[_0xa9a5('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 87ad892..41fa267 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 _0xd9bf=['STRING','DATE','moment','sequelize'];(function(_0x56e441,_0x4f72bb){var _0x32554d=function(_0x5288d4){while(--_0x5288d4){_0x56e441['push'](_0x56e441['shift']());}};_0x32554d(++_0x4f72bb);}(_0xd9bf,0x1d2));var _0xfd9b=function(_0x3035b9,_0x369a65){_0x3035b9=_0x3035b9-0x0;var _0x58747b=_0xd9bf[_0x3035b9];return _0x58747b;};'use strict';var moment=require(_0xfd9b('0x0'));var Sequelize=require(_0xfd9b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xfd9b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfd9b('0x3')]},'acceptAt':{'type':Sequelize[_0xfd9b('0x3')]},'exitAt':{'type':Sequelize[_0xfd9b('0x3')]},'reason':{'type':Sequelize[_0xfd9b('0x2')]}}; \ No newline at end of file +var _0x42b1=['STRING','DATE','sequelize'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0x42b1,0x164));var _0x142b=function(_0x4ddd1c,_0xad744c){_0x4ddd1c=_0x4ddd1c-0x0;var _0x3842c5=_0x42b1[_0x4ddd1c];return _0x3842c5;};'use strict';var moment=require('moment');var Sequelize=require(_0x142b('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x142b('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x142b('0x2')]},'acceptAt':{'type':Sequelize[_0x142b('0x2')]},'exitAt':{'type':Sequelize[_0x142b('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 3a73c5d..851057c 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 _0x7834=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','map','FaxQueueReport','fieldName','key','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7834,0x13f));var _0x4783=function(_0x1e90b4,_0x14ce86){_0x1e90b4=_0x1e90b4-0x0;var _0x4d52f8=_0x7834[_0x1e90b4];return _0x4d52f8;};'use strict';var emlformat=require(_0x4783('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4783('0x1'));var rp=require('request-promise');var moment=require(_0x4783('0x2'));var BPromise=require(_0x4783('0x3'));var Mustache=require(_0x4783('0x4'));var util=require(_0x4783('0x5'));var path=require(_0x4783('0x6'));var sox=require(_0x4783('0x7'));var csv=require(_0x4783('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4783('0x9'));var _=require(_0x4783('0xa'));var squel=require('squel');var crypto=require(_0x4783('0xb'));var jsforce=require(_0x4783('0xc'));var deskjs=require(_0x4783('0xd'));var toCsv=require(_0x4783('0x8'));var querystring=require(_0x4783('0xe'));var Papa=require(_0x4783('0xf'));var Redis=require('ioredis');var authService=require(_0x4783('0x10'));var qs=require(_0x4783('0x11'));var as=require(_0x4783('0x12'));var hardwareService=require(_0x4783('0x13'));var logger=require(_0x4783('0x14'))(_0x4783('0x15'));var utils=require(_0x4783('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4783('0x17'))['db'];function respondWithStatusCode(_0x85087d,_0x4ce944){_0x4ce944=_0x4ce944||0xcc;return function(_0x2afbdc){if(_0x2afbdc){return _0x85087d['sendStatus'](_0x4ce944);}return _0x85087d[_0x4783('0x18')](_0x4ce944)[_0x4783('0x19')]();};}function respondWithResult(_0x41d853,_0xecb9f9){_0xecb9f9=_0xecb9f9||0xc8;return function(_0x230ae6){if(_0x230ae6){return _0x41d853['status'](_0xecb9f9)[_0x4783('0x1a')](_0x230ae6);}};}function respondWithFilteredResult(_0x225443,_0x11e996){return function(_0x20788f){if(_0x20788f){var _0x3cb485=typeof _0x11e996[_0x4783('0x1b')]===_0x4783('0x1c')&&typeof _0x11e996[_0x4783('0x1d')]===_0x4783('0x1c');var _0x28c979=_0x20788f[_0x4783('0x1e')];var _0x323a90=_0x3cb485?0x0:_0x11e996['offset'];var _0x465ed7=_0x3cb485?_0x20788f[_0x4783('0x1e')]:_0x11e996['offset']+_0x11e996[_0x4783('0x1d')];var _0x4a9dc8;if(_0x465ed7>=_0x28c979){_0x465ed7=_0x28c979;_0x4a9dc8=0xc8;}else{_0x4a9dc8=0xce;}_0x225443[_0x4783('0x18')](_0x4a9dc8);return _0x225443[_0x4783('0x1f')](_0x4783('0x20'),_0x323a90+'-'+_0x465ed7+'/'+_0x28c979)[_0x4783('0x1a')](_0x20788f);}return null;};}function patchUpdates(_0x1b5e90){return function(_0x2772b3){try{jsonpatch[_0x4783('0x21')](_0x2772b3,_0x1b5e90,!![]);}catch(_0x4e15d7){return BPromise[_0x4783('0x22')](_0x4e15d7);}return _0x2772b3['save']();};}function saveUpdates(_0x429801,_0x2d592f){return function(_0x46ada4){if(_0x46ada4){return _0x46ada4[_0x4783('0x23')](_0x429801)[_0x4783('0x24')](function(_0x54529d){return _0x54529d;});}return null;};}function removeEntity(_0x2633e6,_0x16ee3a){return function(_0xba686e){if(_0xba686e){return _0xba686e[_0x4783('0x25')]()[_0x4783('0x24')](function(){_0x2633e6[_0x4783('0x18')](0xcc)[_0x4783('0x19')]();});}};}function handleEntityNotFound(_0x48da76,_0x22d276){return function(_0x3e45d2){if(!_0x3e45d2){_0x48da76['sendStatus'](0x194);}return _0x3e45d2;};}function handleError(_0x5f2ed1,_0x1d3e22){_0x1d3e22=_0x1d3e22||0x1f4;return function(_0xb5f71c){logger['error'](_0xb5f71c[_0x4783('0x26')]);if(_0xb5f71c['name']){delete _0xb5f71c['name'];}_0x5f2ed1['status'](_0x1d3e22)['send'](_0xb5f71c);};}exports['index']=function(_0x59e49b,_0x250b9d){var _0x589082={},_0x3a996c={},_0x455559={'count':0x0,'rows':[]};var _0x424806=_[_0x4783('0x27')](db[_0x4783('0x28')]['rawAttributes'],function(_0x1e23f4){return{'name':_0x1e23f4[_0x4783('0x29')],'type':_0x1e23f4['type'][_0x4783('0x2a')]};});_0x3a996c[_0x4783('0x2b')]=_['map'](_0x424806,_0x4783('0x2c'));_0x3a996c['query']=_[_0x4783('0x2d')](_0x59e49b['query']);_0x3a996c[_0x4783('0x2e')]=_[_0x4783('0x2f')](_0x3a996c['model'],_0x3a996c[_0x4783('0x30')]);_0x589082[_0x4783('0x31')]=_[_0x4783('0x2f')](_0x3a996c[_0x4783('0x2b')],qs['fields'](_0x59e49b[_0x4783('0x30')][_0x4783('0x32')]));_0x589082[_0x4783('0x31')]=_0x589082[_0x4783('0x31')]['length']?_0x589082[_0x4783('0x31')]:_0x3a996c[_0x4783('0x2b')];if(!_0x59e49b['query'][_0x4783('0x33')](_0x4783('0x34'))){_0x589082[_0x4783('0x1d')]=qs[_0x4783('0x1d')](_0x59e49b[_0x4783('0x30')]['limit']);_0x589082[_0x4783('0x1b')]=qs['offset'](_0x59e49b['query'][_0x4783('0x1b')]);}_0x589082[_0x4783('0x35')]=qs[_0x4783('0x36')](_0x59e49b['query'][_0x4783('0x36')]);_0x589082['where']=qs[_0x4783('0x2e')](_['pick'](_0x59e49b[_0x4783('0x30')],_0x3a996c[_0x4783('0x2e')]),_0x424806);if(_0x59e49b[_0x4783('0x30')]['filter']){_0x589082[_0x4783('0x37')]=_['merge'](_0x589082[_0x4783('0x37')],{'$or':_[_0x4783('0x27')](_0x424806,function(_0x85209b){if(_0x85209b[_0x4783('0x38')]!=='VIRTUAL'){var _0x172958={};_0x172958[_0x85209b[_0x4783('0x2c')]]={'$like':'%'+_0x59e49b[_0x4783('0x30')]['filter']+'%'};return _0x172958;}})});}_0x589082=_[_0x4783('0x39')]({},_0x589082,_0x59e49b[_0x4783('0x3a')]);var _0x1ebdc8={'where':_0x589082['where']};return db['FaxQueueReport'][_0x4783('0x1e')](_0x1ebdc8)[_0x4783('0x24')](function(_0x373208){_0x455559[_0x4783('0x1e')]=_0x373208;if(_0x59e49b[_0x4783('0x30')][_0x4783('0x3b')]){_0x589082[_0x4783('0x3c')]=[{'all':!![]}];}return db[_0x4783('0x28')][_0x4783('0x3d')](_0x589082);})['then'](function(_0x49e41a){_0x455559[_0x4783('0x3e')]=_0x49e41a;return _0x455559;})['then'](respondWithFilteredResult(_0x250b9d,_0x589082))[_0x4783('0x3f')](handleError(_0x250b9d,null));};exports[_0x4783('0x40')]=function(_0x4708be,_0x3df302){var _0x5e5bc7={'raw':!![],'where':{'id':_0x4708be[_0x4783('0x41')]['id']}},_0x409ac6={};_0x409ac6[_0x4783('0x2b')]=_['keys'](db['FaxQueueReport'][_0x4783('0x42')]);_0x409ac6[_0x4783('0x30')]=_['keys'](_0x4708be[_0x4783('0x30')]);_0x409ac6['filters']=_[_0x4783('0x2f')](_0x409ac6[_0x4783('0x2b')],_0x409ac6[_0x4783('0x30')]);_0x5e5bc7[_0x4783('0x31')]=_[_0x4783('0x2f')](_0x409ac6[_0x4783('0x2b')],qs[_0x4783('0x32')](_0x4708be[_0x4783('0x30')]['fields']));_0x5e5bc7['attributes']=_0x5e5bc7[_0x4783('0x31')]['length']?_0x5e5bc7[_0x4783('0x31')]:_0x409ac6[_0x4783('0x2b')];if(_0x4708be[_0x4783('0x30')][_0x4783('0x3b')]){_0x5e5bc7[_0x4783('0x3c')]=[{'all':!![]}];}_0x5e5bc7=_[_0x4783('0x39')]({},_0x5e5bc7,_0x4708be[_0x4783('0x3a')]);return db[_0x4783('0x28')][_0x4783('0x43')](_0x5e5bc7)[_0x4783('0x24')](handleEntityNotFound(_0x3df302,null))[_0x4783('0x24')](respondWithResult(_0x3df302,null))[_0x4783('0x3f')](handleError(_0x3df302,null));};exports['create']=function(_0x5f44f9,_0xb416de){return db[_0x4783('0x28')]['create'](_0x5f44f9['body'],{})[_0x4783('0x24')](respondWithResult(_0xb416de,0xc9))[_0x4783('0x3f')](handleError(_0xb416de,null));};exports[_0x4783('0x23')]=function(_0x5b248f,_0x3dbd65){if(_0x5b248f['body']['id']){delete _0x5b248f[_0x4783('0x44')]['id'];}return db[_0x4783('0x28')]['find']({'where':{'id':_0x5b248f['params']['id']}})['then'](handleEntityNotFound(_0x3dbd65,null))[_0x4783('0x24')](saveUpdates(_0x5b248f[_0x4783('0x44')],null))['then'](respondWithResult(_0x3dbd65,null))[_0x4783('0x3f')](handleError(_0x3dbd65,null));};exports[_0x4783('0x25')]=function(_0x51a14f,_0x447ab9){return db['FaxQueueReport'][_0x4783('0x43')]({'where':{'id':_0x51a14f['params']['id']}})[_0x4783('0x24')](handleEntityNotFound(_0x447ab9,null))['then'](removeEntity(_0x447ab9,null))[_0x4783('0x3f')](handleError(_0x447ab9,null));};exports['describe']=function(_0x5f0f9a,_0x525b5a){return db[_0x4783('0x28')]['describe']()[_0x4783('0x24')](respondWithResult(_0x525b5a,null))[_0x4783('0x3f')](handleError(_0x525b5a,null));}; \ No newline at end of file +var _0xa1b9=['update','then','destroy','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','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','undefined','limit','count','offset','Content-Range','reject','save'];(function(_0x3b03a5,_0x3dcd9b){var _0x503d2c=function(_0x35e566){while(--_0x35e566){_0x3b03a5['push'](_0x3b03a5['shift']());}};_0x503d2c(++_0x3dcd9b);}(_0xa1b9,0x71));var _0x9a1b=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa1b9[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0x9a1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a1b('0x1'));var jsonpatch=require(_0x9a1b('0x2'));var rp=require(_0x9a1b('0x3'));var moment=require(_0x9a1b('0x4'));var BPromise=require(_0x9a1b('0x5'));var Mustache=require(_0x9a1b('0x6'));var util=require(_0x9a1b('0x7'));var path=require('path');var sox=require(_0x9a1b('0x8'));var csv=require(_0x9a1b('0x9'));var ejs=require(_0x9a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x9a1b('0xb'));var _=require('lodash');var squel=require(_0x9a1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a1b('0xd'));var deskjs=require(_0x9a1b('0xe'));var toCsv=require(_0x9a1b('0x9'));var querystring=require(_0x9a1b('0xf'));var Papa=require(_0x9a1b('0x10'));var Redis=require('ioredis');var authService=require(_0x9a1b('0x11'));var qs=require(_0x9a1b('0x12'));var as=require(_0x9a1b('0x13'));var hardwareService=require(_0x9a1b('0x14'));var logger=require(_0x9a1b('0x15'))(_0x9a1b('0x16'));var utils=require(_0x9a1b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a1b('0x18'));var db=require(_0x9a1b('0x19'))['db'];function respondWithStatusCode(_0x27062b,_0x5ee9d3){_0x5ee9d3=_0x5ee9d3||0xcc;return function(_0x1d016d){if(_0x1d016d){return _0x27062b[_0x9a1b('0x1a')](_0x5ee9d3);}return _0x27062b[_0x9a1b('0x1b')](_0x5ee9d3)[_0x9a1b('0x1c')]();};}function respondWithResult(_0x390ad9,_0x157b6f){_0x157b6f=_0x157b6f||0xc8;return function(_0x3fe388){if(_0x3fe388){return _0x390ad9[_0x9a1b('0x1b')](_0x157b6f)[_0x9a1b('0x1d')](_0x3fe388);}};}function respondWithFilteredResult(_0x101622,_0x5c397f){return function(_0x357cd9){if(_0x357cd9){var _0x2440fc=typeof _0x5c397f['offset']===_0x9a1b('0x1e')&&typeof _0x5c397f[_0x9a1b('0x1f')]===_0x9a1b('0x1e');var _0x1a7324=_0x357cd9[_0x9a1b('0x20')];var _0x478626=_0x2440fc?0x0:_0x5c397f[_0x9a1b('0x21')];var _0x599325=_0x2440fc?_0x357cd9[_0x9a1b('0x20')]:_0x5c397f[_0x9a1b('0x21')]+_0x5c397f[_0x9a1b('0x1f')];var _0x1f1dea;if(_0x599325>=_0x1a7324){_0x599325=_0x1a7324;_0x1f1dea=0xc8;}else{_0x1f1dea=0xce;}_0x101622[_0x9a1b('0x1b')](_0x1f1dea);return _0x101622['set'](_0x9a1b('0x22'),_0x478626+'-'+_0x599325+'/'+_0x1a7324)[_0x9a1b('0x1d')](_0x357cd9);}return null;};}function patchUpdates(_0x36c95c){return function(_0x1977a7){try{jsonpatch['apply'](_0x1977a7,_0x36c95c,!![]);}catch(_0x2ccb02){return BPromise[_0x9a1b('0x23')](_0x2ccb02);}return _0x1977a7[_0x9a1b('0x24')]();};}function saveUpdates(_0x13f828,_0x1c9ab3){return function(_0x327cac){if(_0x327cac){return _0x327cac[_0x9a1b('0x25')](_0x13f828)[_0x9a1b('0x26')](function(_0xb6b23a){return _0xb6b23a;});}return null;};}function removeEntity(_0x37971c,_0x5841c1){return function(_0x2439e9){if(_0x2439e9){return _0x2439e9[_0x9a1b('0x27')]()[_0x9a1b('0x26')](function(){_0x37971c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0ff3,_0x52fce9){return function(_0x17704b){if(!_0x17704b){_0x3b0ff3['sendStatus'](0x194);}return _0x17704b;};}function handleError(_0x5e65ce,_0x48e736){_0x48e736=_0x48e736||0x1f4;return function(_0x432a3d){logger['error'](_0x432a3d[_0x9a1b('0x28')]);if(_0x432a3d[_0x9a1b('0x29')]){delete _0x432a3d[_0x9a1b('0x29')];}_0x5e65ce[_0x9a1b('0x1b')](_0x48e736)[_0x9a1b('0x2a')](_0x432a3d);};}exports[_0x9a1b('0x2b')]=function(_0x1c13d6,_0x1453c4){var _0x4070aa={},_0x2d9ca8={},_0x56f3e8={'count':0x0,'rows':[]};var _0x5735a4=_[_0x9a1b('0x2c')](db[_0x9a1b('0x2d')]['rawAttributes'],function(_0x14ea6b){return{'name':_0x14ea6b[_0x9a1b('0x2e')],'type':_0x14ea6b[_0x9a1b('0x2f')][_0x9a1b('0x30')]};});_0x2d9ca8[_0x9a1b('0x31')]=_[_0x9a1b('0x2c')](_0x5735a4,_0x9a1b('0x29'));_0x2d9ca8[_0x9a1b('0x32')]=_[_0x9a1b('0x33')](_0x1c13d6['query']);_0x2d9ca8[_0x9a1b('0x34')]=_['intersection'](_0x2d9ca8[_0x9a1b('0x31')],_0x2d9ca8[_0x9a1b('0x32')]);_0x4070aa[_0x9a1b('0x35')]=_[_0x9a1b('0x36')](_0x2d9ca8['model'],qs[_0x9a1b('0x37')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x37')]));_0x4070aa[_0x9a1b('0x35')]=_0x4070aa[_0x9a1b('0x35')][_0x9a1b('0x38')]?_0x4070aa[_0x9a1b('0x35')]:_0x2d9ca8[_0x9a1b('0x31')];if(!_0x1c13d6[_0x9a1b('0x32')]['hasOwnProperty'](_0x9a1b('0x39'))){_0x4070aa[_0x9a1b('0x1f')]=qs[_0x9a1b('0x1f')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x1f')]);_0x4070aa[_0x9a1b('0x21')]=qs[_0x9a1b('0x21')](_0x1c13d6['query'][_0x9a1b('0x21')]);}_0x4070aa[_0x9a1b('0x3a')]=qs[_0x9a1b('0x3b')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3b')]);_0x4070aa[_0x9a1b('0x3c')]=qs[_0x9a1b('0x34')](_[_0x9a1b('0x3d')](_0x1c13d6[_0x9a1b('0x32')],_0x2d9ca8['filters']),_0x5735a4);if(_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3e')]){_0x4070aa['where']=_[_0x9a1b('0x3f')](_0x4070aa[_0x9a1b('0x3c')],{'$or':_['map'](_0x5735a4,function(_0x47bf8e){if(_0x47bf8e['type']!==_0x9a1b('0x40')){var _0x2adbb9={};_0x2adbb9[_0x47bf8e[_0x9a1b('0x29')]]={'$like':'%'+_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3e')]+'%'};return _0x2adbb9;}})});}_0x4070aa=_['merge']({},_0x4070aa,_0x1c13d6[_0x9a1b('0x41')]);var _0xfa7f44={'where':_0x4070aa[_0x9a1b('0x3c')]};return db[_0x9a1b('0x2d')][_0x9a1b('0x20')](_0xfa7f44)[_0x9a1b('0x26')](function(_0x2faeeb){_0x56f3e8['count']=_0x2faeeb;if(_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x42')]){_0x4070aa['include']=[{'all':!![]}];}return db[_0x9a1b('0x2d')][_0x9a1b('0x43')](_0x4070aa);})[_0x9a1b('0x26')](function(_0x69c499){_0x56f3e8['rows']=_0x69c499;return _0x56f3e8;})[_0x9a1b('0x26')](respondWithFilteredResult(_0x1453c4,_0x4070aa))[_0x9a1b('0x44')](handleError(_0x1453c4,null));};exports[_0x9a1b('0x45')]=function(_0x3ddcf6,_0x1863d8){var _0x18a606={'raw':!![],'where':{'id':_0x3ddcf6[_0x9a1b('0x46')]['id']}},_0x515bb8={};_0x515bb8[_0x9a1b('0x31')]=_[_0x9a1b('0x33')](db['FaxQueueReport'][_0x9a1b('0x47')]);_0x515bb8[_0x9a1b('0x32')]=_[_0x9a1b('0x33')](_0x3ddcf6[_0x9a1b('0x32')]);_0x515bb8[_0x9a1b('0x34')]=_[_0x9a1b('0x36')](_0x515bb8[_0x9a1b('0x31')],_0x515bb8['query']);_0x18a606[_0x9a1b('0x35')]=_[_0x9a1b('0x36')](_0x515bb8[_0x9a1b('0x31')],qs[_0x9a1b('0x37')](_0x3ddcf6['query'][_0x9a1b('0x37')]));_0x18a606[_0x9a1b('0x35')]=_0x18a606[_0x9a1b('0x35')][_0x9a1b('0x38')]?_0x18a606[_0x9a1b('0x35')]:_0x515bb8[_0x9a1b('0x31')];if(_0x3ddcf6[_0x9a1b('0x32')]['includeAll']){_0x18a606['include']=[{'all':!![]}];}_0x18a606=_[_0x9a1b('0x3f')]({},_0x18a606,_0x3ddcf6[_0x9a1b('0x41')]);return db['FaxQueueReport'][_0x9a1b('0x48')](_0x18a606)[_0x9a1b('0x26')](handleEntityNotFound(_0x1863d8,null))[_0x9a1b('0x26')](respondWithResult(_0x1863d8,null))['catch'](handleError(_0x1863d8,null));};exports['create']=function(_0x4a98c1,_0x31b879){return db[_0x9a1b('0x2d')]['create'](_0x4a98c1[_0x9a1b('0x49')],{})[_0x9a1b('0x26')](respondWithResult(_0x31b879,0xc9))['catch'](handleError(_0x31b879,null));};exports['update']=function(_0x23e3b8,_0x2ff4b5){if(_0x23e3b8['body']['id']){delete _0x23e3b8[_0x9a1b('0x49')]['id'];}return db[_0x9a1b('0x2d')][_0x9a1b('0x48')]({'where':{'id':_0x23e3b8[_0x9a1b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ff4b5,null))['then'](saveUpdates(_0x23e3b8['body'],null))[_0x9a1b('0x26')](respondWithResult(_0x2ff4b5,null))[_0x9a1b('0x44')](handleError(_0x2ff4b5,null));};exports[_0x9a1b('0x27')]=function(_0x3f9c17,_0x1a608a){return db[_0x9a1b('0x2d')][_0x9a1b('0x48')]({'where':{'id':_0x3f9c17[_0x9a1b('0x46')]['id']}})[_0x9a1b('0x26')](handleEntityNotFound(_0x1a608a,null))[_0x9a1b('0x26')](removeEntity(_0x1a608a,null))[_0x9a1b('0x44')](handleError(_0x1a608a,null));};exports[_0x9a1b('0x4a')]=function(_0x719389,_0x2bc22a){return db['FaxQueueReport']['describe']()[_0x9a1b('0x26')](respondWithResult(_0x2bc22a,null))[_0x9a1b('0x44')](handleError(_0x2bc22a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a6f51d5..1f6aa73 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0x814b,0x1a2));var _0xb814=function(_0x101094,_0x5d3900){_0x101094=_0x101094-0x0;var _0x3d6d75=_0x814b[_0x101094];return _0x3d6d75;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x2ee3b9,_0x201d1b){var _0xd2e6b2=function(_0x158043){while(--_0x158043){_0x2ee3b9['push'](_0x2ee3b9['shift']());}};_0xd2e6b2(++_0x201d1b);}(_0xe14b,0x93));var _0xbe14=function(_0x1c8fb1,_0x5089c6){_0x1c8fb1=_0x1c8fb1-0x0;var _0x16df76=_0xe14b[_0x1c8fb1];return _0x16df76;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 483af29..4e0a56e 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 _0x5efb=['jayson/promise','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','update','where','attributes','limit','UpdateFaxQueueReport','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x38c61b,_0x3c2945){var _0x28b8e6=function(_0x5bb6ab){while(--_0x5bb6ab){_0x38c61b['push'](_0x38c61b['shift']());}};_0x28b8e6(++_0x3c2945);}(_0x5efb,0x190));var _0xb5ef=function(_0x1de01d,_0xeb122c){_0x1de01d=_0x1de01d-0x0;var _0x2865ef=_0x5efb[_0x1de01d];return _0x2865ef;};'use strict';var _=require('lodash');var util=require(_0xb5ef('0x0'));var moment=require(_0xb5ef('0x1'));var BPromise=require(_0xb5ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5ef('0x3'));var db=require(_0xb5ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5ef('0x5'))(_0xb5ef('0x6'));var config=require(_0xb5ef('0x7'));var jayson=require(_0xb5ef('0x8'));var client=jayson['client'][_0xb5ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1157f8,_0x53583b,_0x523fd5){return new BPromise(function(_0xff663b,_0x3f4a54){return client[_0xb5ef('0xa')](_0x1157f8,_0x523fd5)['then'](function(_0x1e3523){logger[_0xb5ef('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x53583b,_0xb5ef('0xc'));logger[_0xb5ef('0xd')](_0xb5ef('0xe'),_0x53583b,'request\x20sent',JSON[_0xb5ef('0xf')](_0x1e3523));if(_0x1e3523['error']){if(_0x1e3523['error'][_0xb5ef('0x10')]===0x1f4){logger[_0xb5ef('0x11')](_0xb5ef('0x12'),_0x53583b,_0x1e3523[_0xb5ef('0x11')][_0xb5ef('0x13')]);return _0x3f4a54(_0x1e3523[_0xb5ef('0x11')]['message']);}logger[_0xb5ef('0x11')](_0xb5ef('0x12'),_0x53583b,_0x1e3523[_0xb5ef('0x11')][_0xb5ef('0x13')]);return _0xff663b(_0x1e3523[_0xb5ef('0x11')][_0xb5ef('0x13')]);}else{logger[_0xb5ef('0xb')](_0xb5ef('0x12'),_0x53583b,'request\x20sent');_0xff663b(_0x1e3523[_0xb5ef('0x14')][_0xb5ef('0x13')]);}})['catch'](function(_0x470b3e){logger[_0xb5ef('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x53583b,_0x470b3e);_0x3f4a54(_0x470b3e);});});}exports[_0xb5ef('0x15')]=function(_0x3f8920){var _0x64c943=this;return new Promise(function(_0x2f8cbe,_0x35841c){return db[_0xb5ef('0x16')][_0xb5ef('0x17')](_0x3f8920[_0xb5ef('0x18')],{'raw':_0x3f8920[_0xb5ef('0x19')]?_0x3f8920[_0xb5ef('0x19')][_0xb5ef('0x1a')]===undefined?!![]:![]:!![]})[_0xb5ef('0x1b')](function(_0x1b12d2){logger[_0xb5ef('0xb')](_0xb5ef('0x15'),_0x3f8920);logger[_0xb5ef('0xd')](_0xb5ef('0x15'),_0x3f8920,JSON['stringify'](_0x1b12d2));_0x2f8cbe(_0x1b12d2);})['catch'](function(_0x4e6658){logger[_0xb5ef('0x11')](_0xb5ef('0x15'),_0x4e6658[_0xb5ef('0x13')],_0x3f8920);_0x35841c(_0x64c943[_0xb5ef('0x11')](0x1f4,_0x4e6658['message']));});});};exports['UpdateFaxQueueReport']=function(_0x37a3cd){var _0x3a63ec=this;return new Promise(function(_0x24012a,_0x41f694){return db['FaxQueueReport'][_0xb5ef('0x1c')](_0x37a3cd[_0xb5ef('0x18')],{'raw':_0x37a3cd[_0xb5ef('0x19')]?_0x37a3cd[_0xb5ef('0x19')][_0xb5ef('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37a3cd[_0xb5ef('0x19')]?_0x37a3cd['options'][_0xb5ef('0x1d')]||null:null,'attributes':_0x37a3cd[_0xb5ef('0x19')]?_0x37a3cd[_0xb5ef('0x19')][_0xb5ef('0x1e')]||null:null,'limit':_0x37a3cd[_0xb5ef('0x19')]?_0x37a3cd['options'][_0xb5ef('0x1f')]||null:null})[_0xb5ef('0x1b')](function(_0x5ee613){logger[_0xb5ef('0xb')]('UpdateFaxQueueReport',_0x37a3cd);logger[_0xb5ef('0xd')](_0xb5ef('0x20'),_0x37a3cd,JSON[_0xb5ef('0xf')](_0x5ee613));_0x24012a(_0x5ee613);})[_0xb5ef('0x21')](function(_0x4ed480){logger[_0xb5ef('0x11')]('UpdateFaxQueueReport',_0x4ed480['message'],_0x37a3cd);_0x41f694(_0x3a63ec[_0xb5ef('0x11')](0x1f4,_0x4ed480[_0xb5ef('0x13')]));});});}; \ No newline at end of file +var _0xd245=['../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x38c21f,_0x5d27a5){var _0x2e1b03=function(_0x70cc69){while(--_0x70cc69){_0x38c21f['push'](_0x38c21f['shift']());}};_0x2e1b03(++_0x5d27a5);}(_0xd245,0xa2));var _0x5d24=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0xd245[_0x384231];return _0x2480bf;};'use strict';var _=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var moment=require(_0x5d24('0x2'));var BPromise=require(_0x5d24('0x3'));var rs=require(_0x5d24('0x4'));var fs=require('fs');var Redis=require(_0x5d24('0x5'));var db=require(_0x5d24('0x6'))['db'];var utils=require(_0x5d24('0x7'));var logger=require(_0x5d24('0x8'))(_0x5d24('0x9'));var config=require(_0x5d24('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5d24('0xb')][_0x5d24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21e230,_0x2e5fa7,_0x4f7d91){return new BPromise(function(_0x57296c,_0x29d5b4){return client['request'](_0x21e230,_0x4f7d91)[_0x5d24('0xd')](function(_0x579438){logger[_0x5d24('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x2e5fa7,'request\x20sent');logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x2e5fa7,_0x5d24('0xf'),JSON[_0x5d24('0x10')](_0x579438));if(_0x579438['error']){if(_0x579438[_0x5d24('0x11')][_0x5d24('0x12')]===0x1f4){logger[_0x5d24('0x11')](_0x5d24('0x13'),_0x2e5fa7,_0x579438[_0x5d24('0x11')][_0x5d24('0x14')]);return _0x29d5b4(_0x579438[_0x5d24('0x11')][_0x5d24('0x14')]);}logger[_0x5d24('0x11')](_0x5d24('0x13'),_0x2e5fa7,_0x579438[_0x5d24('0x11')][_0x5d24('0x14')]);return _0x57296c(_0x579438[_0x5d24('0x11')]['message']);}else{logger[_0x5d24('0xe')](_0x5d24('0x13'),_0x2e5fa7,'request\x20sent');_0x57296c(_0x579438['result']['message']);}})[_0x5d24('0x15')](function(_0x56c19c){logger['error'](_0x5d24('0x13'),_0x2e5fa7,_0x56c19c);_0x29d5b4(_0x56c19c);});});}exports[_0x5d24('0x16')]=function(_0x3ed988){var _0x1d7667=this;return new Promise(function(_0x5c05ca,_0x19392f){return db[_0x5d24('0x17')][_0x5d24('0x18')](_0x3ed988[_0x5d24('0x19')],{'raw':_0x3ed988[_0x5d24('0x1a')]?_0x3ed988[_0x5d24('0x1a')][_0x5d24('0x1b')]===undefined?!![]:![]:!![]})[_0x5d24('0xd')](function(_0x21c772){logger[_0x5d24('0xe')](_0x5d24('0x16'),_0x3ed988);logger[_0x5d24('0x1c')](_0x5d24('0x16'),_0x3ed988,JSON['stringify'](_0x21c772));_0x5c05ca(_0x21c772);})[_0x5d24('0x15')](function(_0x3d58de){logger['error']('CreateFaxQueueReport',_0x3d58de[_0x5d24('0x14')],_0x3ed988);_0x19392f(_0x1d7667[_0x5d24('0x11')](0x1f4,_0x3d58de[_0x5d24('0x14')]));});});};exports[_0x5d24('0x1d')]=function(_0x512858){var _0x5ec8b1=this;return new Promise(function(_0x26c53c,_0x44b5dc){return db[_0x5d24('0x17')][_0x5d24('0x1e')](_0x512858[_0x5d24('0x19')],{'raw':_0x512858[_0x5d24('0x1a')]?_0x512858[_0x5d24('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x512858['options']?_0x512858['options'][_0x5d24('0x1f')]||null:null,'attributes':_0x512858[_0x5d24('0x1a')]?_0x512858['options'][_0x5d24('0x20')]||null:null,'limit':_0x512858['options']?_0x512858['options'][_0x5d24('0x21')]||null:null})[_0x5d24('0xd')](function(_0x1b4c35){logger['info'](_0x5d24('0x1d'),_0x512858);logger[_0x5d24('0x1c')]('UpdateFaxQueueReport',_0x512858,JSON[_0x5d24('0x10')](_0x1b4c35));_0x26c53c(_0x1b4c35);})[_0x5d24('0x15')](function(_0x451448){logger[_0x5d24('0x11')](_0x5d24('0x1d'),_0x451448[_0x5d24('0x14')],_0x512858);_0x44b5dc(_0x5ec8b1[_0x5d24('0x11')](0x1f4,_0x451448['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index f3e41e4..8d86028 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 _0xecd9=['../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','put','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b2f25,_0x51cbe9){var _0x480f28=function(_0x567ea3){while(--_0x567ea3){_0x4b2f25['push'](_0x4b2f25['shift']());}};_0x480f28(++_0x51cbe9);}(_0xecd9,0x19b));var _0x9ecd=function(_0xee1dd,_0x2cdbfb){_0xee1dd=_0xee1dd-0x0;var _0x390ce1=_0xecd9[_0xee1dd];return _0x390ce1;};'use strict';var multer=require(_0x9ecd('0x0'));var util=require(_0x9ecd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ecd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9ecd('0x3'));var interaction=require(_0x9ecd('0x4'));var config=require(_0x9ecd('0x5'));var controller=require(_0x9ecd('0x6'));router[_0x9ecd('0x7')]('/',auth[_0x9ecd('0x8')](),controller[_0x9ecd('0x9')]);router['get'](_0x9ecd('0xa'),auth[_0x9ecd('0x8')](),controller['describe']);router[_0x9ecd('0x7')](_0x9ecd('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9ecd('0xc')]('/',auth[_0x9ecd('0x8')](),controller['create']);router[_0x9ecd('0xd')](_0x9ecd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9ecd('0xe')](_0x9ecd('0xb'),auth[_0x9ecd('0x8')](),controller['destroy']);module[_0x9ecd('0xf')]=router; \ No newline at end of file +var _0xe027=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1ccfd8,_0x5a3002){var _0xc05115=function(_0x177d4c){while(--_0x177d4c){_0x1ccfd8['push'](_0x1ccfd8['shift']());}};_0xc05115(++_0x5a3002);}(_0xe027,0x106));var _0x7e02=function(_0x953f37,_0x3e761e){_0x953f37=_0x953f37-0x0;var _0x1f75c6=_0xe027[_0x953f37];return _0x1f75c6;};'use strict';var multer=require(_0x7e02('0x0'));var util=require('util');var path=require(_0x7e02('0x1'));var timeout=require(_0x7e02('0x2'));var express=require(_0x7e02('0x3'));var router=express[_0x7e02('0x4')]();var fs_extra=require(_0x7e02('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e02('0x6'));var config=require(_0x7e02('0x7'));var controller=require(_0x7e02('0x8'));router[_0x7e02('0x9')]('/',auth[_0x7e02('0xa')](),controller[_0x7e02('0xb')]);router['get']('/describe',auth[_0x7e02('0xa')](),controller['describe']);router[_0x7e02('0x9')](_0x7e02('0xc'),auth[_0x7e02('0xa')](),controller['show']);router[_0x7e02('0xd')]('/',auth[_0x7e02('0xa')](),controller['create']);router[_0x7e02('0xe')](_0x7e02('0xc'),auth[_0x7e02('0xa')](),controller[_0x7e02('0xf')]);router[_0x7e02('0x10')](_0x7e02('0xc'),auth['isAuthenticated'](),controller[_0x7e02('0x11')]);module[_0x7e02('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 817160d..9540583 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(_0x148db9,_0x57763a){var _0x2a8cc6=function(_0x4c192f){while(--_0x4c192f){_0x148db9['push'](_0x148db9['shift']());}};_0x2a8cc6(++_0x57763a);}(_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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x462e0a,_0x1600b2){_0x462e0a=_0x462e0a-0x0;var _0x4191ab=_0xb43b[_0x462e0a];return _0x4191ab;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e51d3d2..8a9d35e 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 _0xbcaf=['end','error','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','FaxTransferReport','findAll','rows','catch','show','params','rawAttributes','length','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','apply','update','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbcaf,0xb7));var _0xfbca=function(_0x1a496e,_0x146b00){_0x1a496e=_0x1a496e-0x0;var _0x3cac69=_0xbcaf[_0x1a496e];return _0x3cac69;};'use strict';var emlformat=require(_0xfbca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbca('0x1'));var jsonpatch=require(_0xfbca('0x2'));var rp=require(_0xfbca('0x3'));var moment=require(_0xfbca('0x4'));var BPromise=require(_0xfbca('0x5'));var Mustache=require(_0xfbca('0x6'));var util=require(_0xfbca('0x7'));var path=require(_0xfbca('0x8'));var sox=require(_0xfbca('0x9'));var csv=require(_0xfbca('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbca('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfbca('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfbca('0xa'));var querystring=require(_0xfbca('0xd'));var Papa=require(_0xfbca('0xe'));var Redis=require(_0xfbca('0xf'));var authService=require(_0xfbca('0x10'));var qs=require(_0xfbca('0x11'));var as=require(_0xfbca('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbca('0x13'))(_0xfbca('0x14'));var utils=require(_0xfbca('0x15'));var config=require(_0xfbca('0x16'));var licenseUtil=require(_0xfbca('0x17'));var db=require(_0xfbca('0x18'))['db'];function respondWithStatusCode(_0x3bf285,_0x58f6c7){_0x58f6c7=_0x58f6c7||0xcc;return function(_0x213c0e){if(_0x213c0e){return _0x3bf285[_0xfbca('0x19')](_0x58f6c7);}return _0x3bf285[_0xfbca('0x1a')](_0x58f6c7)['end']();};}function respondWithResult(_0x5171c6,_0x4a969d){_0x4a969d=_0x4a969d||0xc8;return function(_0x1106f0){if(_0x1106f0){return _0x5171c6[_0xfbca('0x1a')](_0x4a969d)[_0xfbca('0x1b')](_0x1106f0);}};}function respondWithFilteredResult(_0x4c2797,_0x2d69ee){return function(_0x164d3c){if(_0x164d3c){var _0x505f0a=typeof _0x2d69ee[_0xfbca('0x1c')]===_0xfbca('0x1d')&&typeof _0x2d69ee[_0xfbca('0x1e')]===_0xfbca('0x1d');var _0x71a8ff=_0x164d3c[_0xfbca('0x1f')];var _0x5e7f22=_0x505f0a?0x0:_0x2d69ee[_0xfbca('0x1c')];var _0x40f58b=_0x505f0a?_0x164d3c[_0xfbca('0x1f')]:_0x2d69ee[_0xfbca('0x1c')]+_0x2d69ee['limit'];var _0x55bd6e;if(_0x40f58b>=_0x71a8ff){_0x40f58b=_0x71a8ff;_0x55bd6e=0xc8;}else{_0x55bd6e=0xce;}_0x4c2797[_0xfbca('0x1a')](_0x55bd6e);return _0x4c2797['set'](_0xfbca('0x20'),_0x5e7f22+'-'+_0x40f58b+'/'+_0x71a8ff)[_0xfbca('0x1b')](_0x164d3c);}return null;};}function patchUpdates(_0x573c2c){return function(_0x20906d){try{jsonpatch[_0xfbca('0x21')](_0x20906d,_0x573c2c,!![]);}catch(_0x597ab8){return BPromise['reject'](_0x597ab8);}return _0x20906d['save']();};}function saveUpdates(_0x1f5ec5,_0x7dc0c6){return function(_0x36f07d){if(_0x36f07d){return _0x36f07d[_0xfbca('0x22')](_0x1f5ec5)[_0xfbca('0x23')](function(_0x4327ea){return _0x4327ea;});}return null;};}function removeEntity(_0x14b616,_0x4bcfee){return function(_0x3cc4aa){if(_0x3cc4aa){return _0x3cc4aa['destroy']()[_0xfbca('0x23')](function(){_0x14b616['status'](0xcc)[_0xfbca('0x24')]();});}};}function handleEntityNotFound(_0x1e71b9,_0x2da8c9){return function(_0x5b4d7e){if(!_0x5b4d7e){_0x1e71b9['sendStatus'](0x194);}return _0x5b4d7e;};}function handleError(_0x1b1ba2,_0x39230f){_0x39230f=_0x39230f||0x1f4;return function(_0x39da5d){logger[_0xfbca('0x25')](_0x39da5d['stack']);if(_0x39da5d[_0xfbca('0x26')]){delete _0x39da5d['name'];}_0x1b1ba2[_0xfbca('0x1a')](_0x39230f)['send'](_0x39da5d);};}exports[_0xfbca('0x27')]=function(_0x4e5e23,_0x4e2e3c){var _0x5482ac={},_0x5185a6={},_0x3a19b7={'count':0x0,'rows':[]};var _0x3a9e33=_[_0xfbca('0x28')](db['FaxTransferReport']['rawAttributes'],function(_0x1eb2ec){return{'name':_0x1eb2ec[_0xfbca('0x29')],'type':_0x1eb2ec[_0xfbca('0x2a')][_0xfbca('0x2b')]};});_0x5185a6[_0xfbca('0x2c')]=_[_0xfbca('0x28')](_0x3a9e33,_0xfbca('0x26'));_0x5185a6[_0xfbca('0x2d')]=_[_0xfbca('0x2e')](_0x4e5e23[_0xfbca('0x2d')]);_0x5185a6[_0xfbca('0x2f')]=_[_0xfbca('0x30')](_0x5185a6['model'],_0x5185a6[_0xfbca('0x2d')]);_0x5482ac[_0xfbca('0x31')]=_[_0xfbca('0x30')](_0x5185a6[_0xfbca('0x2c')],qs[_0xfbca('0x32')](_0x4e5e23['query'][_0xfbca('0x32')]));_0x5482ac['attributes']=_0x5482ac[_0xfbca('0x31')]['length']?_0x5482ac[_0xfbca('0x31')]:_0x5185a6[_0xfbca('0x2c')];if(!_0x4e5e23['query']['hasOwnProperty']('nolimit')){_0x5482ac['limit']=qs[_0xfbca('0x1e')](_0x4e5e23['query'][_0xfbca('0x1e')]);_0x5482ac['offset']=qs[_0xfbca('0x1c')](_0x4e5e23['query'][_0xfbca('0x1c')]);}_0x5482ac[_0xfbca('0x33')]=qs[_0xfbca('0x34')](_0x4e5e23[_0xfbca('0x2d')][_0xfbca('0x34')]);_0x5482ac[_0xfbca('0x35')]=qs[_0xfbca('0x2f')](_[_0xfbca('0x36')](_0x4e5e23[_0xfbca('0x2d')],_0x5185a6[_0xfbca('0x2f')]),_0x3a9e33);if(_0x4e5e23[_0xfbca('0x2d')][_0xfbca('0x37')]){_0x5482ac['where']=_[_0xfbca('0x38')](_0x5482ac[_0xfbca('0x35')],{'$or':_[_0xfbca('0x28')](_0x3a9e33,function(_0x5c1c19){if(_0x5c1c19[_0xfbca('0x2a')]!==_0xfbca('0x39')){var _0x53448d={};_0x53448d[_0x5c1c19[_0xfbca('0x26')]]={'$like':'%'+_0x4e5e23['query']['filter']+'%'};return _0x53448d;}})});}_0x5482ac=_[_0xfbca('0x38')]({},_0x5482ac,_0x4e5e23['options']);var _0x2ea0c7={'where':_0x5482ac[_0xfbca('0x35')]};return db['FaxTransferReport']['count'](_0x2ea0c7)['then'](function(_0x557a7e){_0x3a19b7['count']=_0x557a7e;if(_0x4e5e23[_0xfbca('0x2d')][_0xfbca('0x3a')]){_0x5482ac['include']=[{'all':!![]}];}return db[_0xfbca('0x3b')][_0xfbca('0x3c')](_0x5482ac);})['then'](function(_0x528609){_0x3a19b7[_0xfbca('0x3d')]=_0x528609;return _0x3a19b7;})[_0xfbca('0x23')](respondWithFilteredResult(_0x4e2e3c,_0x5482ac))[_0xfbca('0x3e')](handleError(_0x4e2e3c,null));};exports[_0xfbca('0x3f')]=function(_0x1a4e31,_0x48a9df){var _0x207e96={'raw':!![],'where':{'id':_0x1a4e31[_0xfbca('0x40')]['id']}},_0x14b045={};_0x14b045[_0xfbca('0x2c')]=_[_0xfbca('0x2e')](db[_0xfbca('0x3b')][_0xfbca('0x41')]);_0x14b045[_0xfbca('0x2d')]=_[_0xfbca('0x2e')](_0x1a4e31[_0xfbca('0x2d')]);_0x14b045[_0xfbca('0x2f')]=_[_0xfbca('0x30')](_0x14b045[_0xfbca('0x2c')],_0x14b045[_0xfbca('0x2d')]);_0x207e96[_0xfbca('0x31')]=_[_0xfbca('0x30')](_0x14b045[_0xfbca('0x2c')],qs['fields'](_0x1a4e31[_0xfbca('0x2d')]['fields']));_0x207e96['attributes']=_0x207e96[_0xfbca('0x31')][_0xfbca('0x42')]?_0x207e96['attributes']:_0x14b045[_0xfbca('0x2c')];if(_0x1a4e31[_0xfbca('0x2d')]['includeAll']){_0x207e96[_0xfbca('0x43')]=[{'all':!![]}];}_0x207e96=_[_0xfbca('0x38')]({},_0x207e96,_0x1a4e31[_0xfbca('0x44')]);return db[_0xfbca('0x3b')][_0xfbca('0x45')](_0x207e96)[_0xfbca('0x23')](handleEntityNotFound(_0x48a9df,null))[_0xfbca('0x23')](respondWithResult(_0x48a9df,null))[_0xfbca('0x3e')](handleError(_0x48a9df,null));};exports['create']=function(_0x2ce6c3,_0x404199){return db[_0xfbca('0x3b')][_0xfbca('0x46')](_0x2ce6c3[_0xfbca('0x47')],{})[_0xfbca('0x23')](respondWithResult(_0x404199,0xc9))[_0xfbca('0x3e')](handleError(_0x404199,null));};exports[_0xfbca('0x22')]=function(_0x582dad,_0xc8190a){if(_0x582dad[_0xfbca('0x47')]['id']){delete _0x582dad['body']['id'];}return db[_0xfbca('0x3b')][_0xfbca('0x45')]({'where':{'id':_0x582dad[_0xfbca('0x40')]['id']}})[_0xfbca('0x23')](handleEntityNotFound(_0xc8190a,null))[_0xfbca('0x23')](saveUpdates(_0x582dad['body'],null))['then'](respondWithResult(_0xc8190a,null))[_0xfbca('0x3e')](handleError(_0xc8190a,null));};exports['destroy']=function(_0x15ba64,_0x22b9f5){return db[_0xfbca('0x3b')][_0xfbca('0x45')]({'where':{'id':_0x15ba64['params']['id']}})[_0xfbca('0x23')](handleEntityNotFound(_0x22b9f5,null))[_0xfbca('0x23')](removeEntity(_0x22b9f5,null))[_0xfbca('0x3e')](handleError(_0x22b9f5,null));};exports[_0xfbca('0x48')]=function(_0x41b10d,_0x2aa552){return db[_0xfbca('0x3b')][_0xfbca('0x48')]()['then'](respondWithResult(_0x2aa552,null))['catch'](handleError(_0x2aa552,null));}; \ No newline at end of file +var _0xbce6=['offset','set','Content-Range','apply','reject','then','destroy','error','name','send','map','FaxTransferReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','update','body','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','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','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count'];(function(_0x49873e,_0x4eea44){var _0x59876a=function(_0x267a00){while(--_0x267a00){_0x49873e['push'](_0x49873e['shift']());}};_0x59876a(++_0x4eea44);}(_0xbce6,0xbd));var _0x6bce=function(_0x1ffd47,_0x33f9ad){_0x1ffd47=_0x1ffd47-0x0;var _0x5f3d74=_0xbce6[_0x1ffd47];return _0x5f3d74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6bce('0x0'));var zipdir=require(_0x6bce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6bce('0x2'));var BPromise=require(_0x6bce('0x3'));var Mustache=require(_0x6bce('0x4'));var util=require(_0x6bce('0x5'));var path=require(_0x6bce('0x6'));var sox=require('sox');var csv=require(_0x6bce('0x7'));var ejs=require(_0x6bce('0x8'));var fs=require('fs');var fs_extra=require(_0x6bce('0x9'));var _=require(_0x6bce('0xa'));var squel=require(_0x6bce('0xb'));var crypto=require(_0x6bce('0xc'));var jsforce=require(_0x6bce('0xd'));var deskjs=require(_0x6bce('0xe'));var toCsv=require(_0x6bce('0x7'));var querystring=require(_0x6bce('0xf'));var Papa=require('papaparse');var Redis=require(_0x6bce('0x10'));var authService=require(_0x6bce('0x11'));var qs=require(_0x6bce('0x12'));var as=require(_0x6bce('0x13'));var hardwareService=require(_0x6bce('0x14'));var logger=require(_0x6bce('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6bce('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6bce('0x17'))['db'];function respondWithStatusCode(_0x465d8a,_0x74b0b0){_0x74b0b0=_0x74b0b0||0xcc;return function(_0x1141e7){if(_0x1141e7){return _0x465d8a[_0x6bce('0x18')](_0x74b0b0);}return _0x465d8a[_0x6bce('0x19')](_0x74b0b0)[_0x6bce('0x1a')]();};}function respondWithResult(_0x35da3f,_0x4ef753){_0x4ef753=_0x4ef753||0xc8;return function(_0x377796){if(_0x377796){return _0x35da3f['status'](_0x4ef753)[_0x6bce('0x1b')](_0x377796);}};}function respondWithFilteredResult(_0x37e70b,_0x59398a){return function(_0x325fad){if(_0x325fad){var _0x2c8d38=typeof _0x59398a['offset']===_0x6bce('0x1c')&&typeof _0x59398a['limit']===_0x6bce('0x1c');var _0x57a18f=_0x325fad[_0x6bce('0x1d')];var _0x535adf=_0x2c8d38?0x0:_0x59398a[_0x6bce('0x1e')];var _0x3d380d=_0x2c8d38?_0x325fad['count']:_0x59398a[_0x6bce('0x1e')]+_0x59398a['limit'];var _0x1f3d36;if(_0x3d380d>=_0x57a18f){_0x3d380d=_0x57a18f;_0x1f3d36=0xc8;}else{_0x1f3d36=0xce;}_0x37e70b[_0x6bce('0x19')](_0x1f3d36);return _0x37e70b[_0x6bce('0x1f')](_0x6bce('0x20'),_0x535adf+'-'+_0x3d380d+'/'+_0x57a18f)['json'](_0x325fad);}return null;};}function patchUpdates(_0x4ceb7d){return function(_0x1e6f0c){try{jsonpatch[_0x6bce('0x21')](_0x1e6f0c,_0x4ceb7d,!![]);}catch(_0x56a65a){return BPromise[_0x6bce('0x22')](_0x56a65a);}return _0x1e6f0c['save']();};}function saveUpdates(_0x51341,_0x1529ad){return function(_0x22c769){if(_0x22c769){return _0x22c769['update'](_0x51341)[_0x6bce('0x23')](function(_0x591058){return _0x591058;});}return null;};}function removeEntity(_0x33a8fc,_0x465a60){return function(_0x1dcf87){if(_0x1dcf87){return _0x1dcf87[_0x6bce('0x24')]()[_0x6bce('0x23')](function(){_0x33a8fc[_0x6bce('0x19')](0xcc)[_0x6bce('0x1a')]();});}};}function handleEntityNotFound(_0x201b31,_0x5139bd){return function(_0x596040){if(!_0x596040){_0x201b31['sendStatus'](0x194);}return _0x596040;};}function handleError(_0x129d70,_0x418dcb){_0x418dcb=_0x418dcb||0x1f4;return function(_0x394e88){logger[_0x6bce('0x25')](_0x394e88['stack']);if(_0x394e88[_0x6bce('0x26')]){delete _0x394e88[_0x6bce('0x26')];}_0x129d70[_0x6bce('0x19')](_0x418dcb)[_0x6bce('0x27')](_0x394e88);};}exports['index']=function(_0x282dcd,_0x557180){var _0x253476={},_0x496fc8={},_0x52f9ea={'count':0x0,'rows':[]};var _0x1213c8=_[_0x6bce('0x28')](db[_0x6bce('0x29')]['rawAttributes'],function(_0x2579a7){return{'name':_0x2579a7[_0x6bce('0x2a')],'type':_0x2579a7[_0x6bce('0x2b')][_0x6bce('0x2c')]};});_0x496fc8[_0x6bce('0x2d')]=_[_0x6bce('0x28')](_0x1213c8,'name');_0x496fc8[_0x6bce('0x2e')]=_['keys'](_0x282dcd[_0x6bce('0x2e')]);_0x496fc8[_0x6bce('0x2f')]=_[_0x6bce('0x30')](_0x496fc8[_0x6bce('0x2d')],_0x496fc8[_0x6bce('0x2e')]);_0x253476['attributes']=_['intersection'](_0x496fc8[_0x6bce('0x2d')],qs[_0x6bce('0x31')](_0x282dcd[_0x6bce('0x2e')][_0x6bce('0x31')]));_0x253476[_0x6bce('0x32')]=_0x253476['attributes']['length']?_0x253476['attributes']:_0x496fc8['model'];if(!_0x282dcd[_0x6bce('0x2e')][_0x6bce('0x33')]('nolimit')){_0x253476[_0x6bce('0x34')]=qs[_0x6bce('0x34')](_0x282dcd[_0x6bce('0x2e')][_0x6bce('0x34')]);_0x253476['offset']=qs[_0x6bce('0x1e')](_0x282dcd[_0x6bce('0x2e')][_0x6bce('0x1e')]);}_0x253476[_0x6bce('0x35')]=qs['sort'](_0x282dcd[_0x6bce('0x2e')][_0x6bce('0x36')]);_0x253476['where']=qs[_0x6bce('0x2f')](_[_0x6bce('0x37')](_0x282dcd[_0x6bce('0x2e')],_0x496fc8[_0x6bce('0x2f')]),_0x1213c8);if(_0x282dcd[_0x6bce('0x2e')][_0x6bce('0x38')]){_0x253476[_0x6bce('0x39')]=_['merge'](_0x253476[_0x6bce('0x39')],{'$or':_[_0x6bce('0x28')](_0x1213c8,function(_0x319c0b){if(_0x319c0b['type']!=='VIRTUAL'){var _0xff0240={};_0xff0240[_0x319c0b[_0x6bce('0x26')]]={'$like':'%'+_0x282dcd[_0x6bce('0x2e')][_0x6bce('0x38')]+'%'};return _0xff0240;}})});}_0x253476=_[_0x6bce('0x3a')]({},_0x253476,_0x282dcd[_0x6bce('0x3b')]);var _0x2860b9={'where':_0x253476['where']};return db[_0x6bce('0x29')][_0x6bce('0x1d')](_0x2860b9)[_0x6bce('0x23')](function(_0x196367){_0x52f9ea[_0x6bce('0x1d')]=_0x196367;if(_0x282dcd[_0x6bce('0x2e')][_0x6bce('0x3c')]){_0x253476[_0x6bce('0x3d')]=[{'all':!![]}];}return db[_0x6bce('0x29')][_0x6bce('0x3e')](_0x253476);})['then'](function(_0x5e480f){_0x52f9ea['rows']=_0x5e480f;return _0x52f9ea;})['then'](respondWithFilteredResult(_0x557180,_0x253476))[_0x6bce('0x3f')](handleError(_0x557180,null));};exports[_0x6bce('0x40')]=function(_0x1b2b73,_0x5258e7){var _0x199d64={'raw':!![],'where':{'id':_0x1b2b73[_0x6bce('0x41')]['id']}},_0x459705={};_0x459705['model']=_[_0x6bce('0x42')](db[_0x6bce('0x29')]['rawAttributes']);_0x459705[_0x6bce('0x2e')]=_[_0x6bce('0x42')](_0x1b2b73['query']);_0x459705['filters']=_['intersection'](_0x459705[_0x6bce('0x2d')],_0x459705[_0x6bce('0x2e')]);_0x199d64[_0x6bce('0x32')]=_[_0x6bce('0x30')](_0x459705[_0x6bce('0x2d')],qs[_0x6bce('0x31')](_0x1b2b73['query'][_0x6bce('0x31')]));_0x199d64['attributes']=_0x199d64[_0x6bce('0x32')][_0x6bce('0x43')]?_0x199d64[_0x6bce('0x32')]:_0x459705[_0x6bce('0x2d')];if(_0x1b2b73[_0x6bce('0x2e')][_0x6bce('0x3c')]){_0x199d64['include']=[{'all':!![]}];}_0x199d64=_['merge']({},_0x199d64,_0x1b2b73['options']);return db[_0x6bce('0x29')][_0x6bce('0x44')](_0x199d64)[_0x6bce('0x23')](handleEntityNotFound(_0x5258e7,null))[_0x6bce('0x23')](respondWithResult(_0x5258e7,null))[_0x6bce('0x3f')](handleError(_0x5258e7,null));};exports[_0x6bce('0x45')]=function(_0x18fee0,_0x4b169c){return db[_0x6bce('0x29')]['create'](_0x18fee0['body'],{})['then'](respondWithResult(_0x4b169c,0xc9))['catch'](handleError(_0x4b169c,null));};exports[_0x6bce('0x46')]=function(_0x109a51,_0x5b1003){if(_0x109a51[_0x6bce('0x47')]['id']){delete _0x109a51['body']['id'];}return db[_0x6bce('0x29')][_0x6bce('0x44')]({'where':{'id':_0x109a51[_0x6bce('0x41')]['id']}})[_0x6bce('0x23')](handleEntityNotFound(_0x5b1003,null))[_0x6bce('0x23')](saveUpdates(_0x109a51['body'],null))[_0x6bce('0x23')](respondWithResult(_0x5b1003,null))[_0x6bce('0x3f')](handleError(_0x5b1003,null));};exports[_0x6bce('0x24')]=function(_0x207458,_0xc820c7){return db[_0x6bce('0x29')][_0x6bce('0x44')]({'where':{'id':_0x207458[_0x6bce('0x41')]['id']}})['then'](handleEntityNotFound(_0xc820c7,null))[_0x6bce('0x23')](removeEntity(_0xc820c7,null))[_0x6bce('0x3f')](handleError(_0xc820c7,null));};exports[_0x6bce('0x48')]=function(_0x34af01,_0x536f2f){return db[_0x6bce('0x29')][_0x6bce('0x48')]()['then'](respondWithResult(_0x536f2f,null))['catch'](handleError(_0x536f2f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 120bc24..7b008a3 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 _0xfce5=['exports','define','report_fax_transfer','uniqueid','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x201643,_0x580320){var _0x398865=function(_0x3a4db6){while(--_0x3a4db6){_0x201643['push'](_0x201643['shift']());}};_0x398865(++_0x580320);}(_0xfce5,0x70));var _0x5fce=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0xfce5[_0x2f6f50];return _0x2cf365;};'use strict';var _=require('lodash');var util=require(_0x5fce('0x0'));var logger=require(_0x5fce('0x1'))(_0x5fce('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5fce('0x3'));var fs=require('fs');var path=require(_0x5fce('0x4'));var rimraf=require(_0x5fce('0x5'));var config=require(_0x5fce('0x6'));var attributes=require(_0x5fce('0x7'));module[_0x5fce('0x8')]=function(_0x1c7486,_0x4abcb0){return _0x1c7486[_0x5fce('0x9')]('FaxTransferReport',attributes,{'tableName':_0x5fce('0xa'),'paranoid':![],'indexes':[{'name':_0x5fce('0xb'),'fields':[_0x5fce('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf767=['../../config/logger','api','moment','bluebird','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xf767,0x183));var _0x7f76=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0xf767[_0x1526e1];return _0x249a1e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f76('0x0'))(_0x7f76('0x1'));var moment=require(_0x7f76('0x2'));var BPromise=require(_0x7f76('0x3'));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(_0x7f76('0x4'));module[_0x7f76('0x5')]=function(_0x5e8527,_0x509376){return _0x5e8527[_0x7f76('0x6')](_0x7f76('0x7'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x7f76('0x8'),'fields':[_0x7f76('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 485a8e8..a3a1474 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 _0x5940=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x588777,_0x5e0354){var _0x26f3e6=function(_0x1bcb4a){while(--_0x1bcb4a){_0x588777['push'](_0x588777['shift']());}};_0x26f3e6(++_0x5e0354);}(_0x5940,0x1d6));var _0x0594=function(_0x2f2a81,_0x1cdfbe){_0x2f2a81=_0x2f2a81-0x0;var _0xecefe8=_0x5940[_0x2f2a81];return _0xecefe8;};'use strict';var _=require(_0x0594('0x0'));var util=require('util');var moment=require(_0x0594('0x1'));var BPromise=require(_0x0594('0x2'));var rs=require(_0x0594('0x3'));var fs=require('fs');var Redis=require(_0x0594('0x4'));var db=require(_0x0594('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0594('0x6'))(_0x0594('0x7'));var config=require(_0x0594('0x8'));var jayson=require(_0x0594('0x9'));var client=jayson[_0x0594('0xa')][_0x0594('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ec4cb,_0x16332c,_0x5d231c){return new BPromise(function(_0x277735,_0x3d1863){return client[_0x0594('0xc')](_0x2ec4cb,_0x5d231c)[_0x0594('0xd')](function(_0x20937e){logger[_0x0594('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x16332c,_0x0594('0xf'));logger[_0x0594('0x10')](_0x0594('0x11'),_0x16332c,'request\x20sent',JSON[_0x0594('0x12')](_0x20937e));if(_0x20937e['error']){if(_0x20937e['error'][_0x0594('0x13')]===0x1f4){logger[_0x0594('0x14')](_0x0594('0x15'),_0x16332c,_0x20937e['error'][_0x0594('0x16')]);return _0x3d1863(_0x20937e[_0x0594('0x14')][_0x0594('0x16')]);}logger[_0x0594('0x14')](_0x0594('0x15'),_0x16332c,_0x20937e[_0x0594('0x14')][_0x0594('0x16')]);return _0x277735(_0x20937e[_0x0594('0x14')][_0x0594('0x16')]);}else{logger[_0x0594('0xe')](_0x0594('0x15'),_0x16332c,_0x0594('0xf'));_0x277735(_0x20937e[_0x0594('0x17')]['message']);}})[_0x0594('0x18')](function(_0x152f87){logger[_0x0594('0x14')](_0x0594('0x15'),_0x16332c,_0x152f87);_0x3d1863(_0x152f87);});});} \ No newline at end of file +var _0x546f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x44078c,_0x293288){var _0x28c938=function(_0x3f3ee7){while(--_0x3f3ee7){_0x44078c['push'](_0x44078c['shift']());}};_0x28c938(++_0x293288);}(_0x546f,0x11b));var _0xf546=function(_0x2da1f9,_0x5e4269){_0x2da1f9=_0x2da1f9-0x0;var _0x22ef92=_0x546f[_0x2da1f9];return _0x22ef92;};'use strict';var _=require(_0xf546('0x0'));var util=require(_0xf546('0x1'));var moment=require(_0xf546('0x2'));var BPromise=require('bluebird');var rs=require(_0xf546('0x3'));var fs=require('fs');var Redis=require(_0xf546('0x4'));var db=require(_0xf546('0x5'))['db'];var utils=require(_0xf546('0x6'));var logger=require(_0xf546('0x7'))(_0xf546('0x8'));var config=require(_0xf546('0x9'));var jayson=require(_0xf546('0xa'));var client=jayson[_0xf546('0xb')][_0xf546('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e3e48,_0x2c262b,_0x91704d){return new BPromise(function(_0x2d1ec0,_0x491790){return client[_0xf546('0xd')](_0x4e3e48,_0x91704d)[_0xf546('0xe')](function(_0x59b2a1){logger[_0xf546('0xf')](_0xf546('0x10'),_0x2c262b,'request\x20sent');logger['debug'](_0xf546('0x11'),_0x2c262b,_0xf546('0x12'),JSON[_0xf546('0x13')](_0x59b2a1));if(_0x59b2a1['error']){if(_0x59b2a1[_0xf546('0x14')][_0xf546('0x15')]===0x1f4){logger[_0xf546('0x14')](_0xf546('0x10'),_0x2c262b,_0x59b2a1[_0xf546('0x14')][_0xf546('0x16')]);return _0x491790(_0x59b2a1['error'][_0xf546('0x16')]);}logger['error'](_0xf546('0x10'),_0x2c262b,_0x59b2a1[_0xf546('0x14')][_0xf546('0x16')]);return _0x2d1ec0(_0x59b2a1[_0xf546('0x14')][_0xf546('0x16')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2c262b,_0xf546('0x12'));_0x2d1ec0(_0x59b2a1[_0xf546('0x17')][_0xf546('0x16')]);}})['catch'](function(_0x25d8ba){logger[_0xf546('0x14')](_0xf546('0x10'),_0x2c262b,_0x25d8ba);_0x491790(_0x25d8ba);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index aae943f..97916e1 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 _0x925e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','update','/:id','destroy','exports','util','connect-timeout','express'];(function(_0x5339ef,_0x12d03e){var _0xd34178=function(_0x5e7921){while(--_0x5e7921){_0x5339ef['push'](_0x5339ef['shift']());}};_0xd34178(++_0x12d03e);}(_0x925e,0x177));var _0xe925=function(_0x3578ac,_0x31e6fa){_0x3578ac=_0x3578ac-0x0;var _0x21f362=_0x925e[_0x3578ac];return _0x21f362;};'use strict';var multer=require('multer');var util=require(_0xe925('0x0'));var path=require('path');var timeout=require(_0xe925('0x1'));var express=require(_0xe925('0x2'));var router=express[_0xe925('0x3')]();var fs_extra=require(_0xe925('0x4'));var auth=require(_0xe925('0x5'));var interaction=require(_0xe925('0x6'));var config=require(_0xe925('0x7'));var controller=require(_0xe925('0x8'));router[_0xe925('0x9')]('/',auth[_0xe925('0xa')](),controller[_0xe925('0xb')]);router[_0xe925('0x9')](_0xe925('0xc'),auth[_0xe925('0xa')](),controller['describe']);router[_0xe925('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe925('0xd')]);router[_0xe925('0xe')]('/',auth[_0xe925('0xa')](),controller[_0xe925('0xf')]);router[_0xe925('0x10')]('/:id',auth[_0xe925('0xa')](),controller[_0xe925('0x11')]);router['delete'](_0xe925('0x12'),auth['isAuthenticated'](),controller[_0xe925('0x13')]);module[_0xe925('0x14')]=router; \ No newline at end of file +var _0xdff5=['get','isAuthenticated','/describe','show','post','create','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller'];(function(_0x4594e2,_0x25da51){var _0x4be202=function(_0x2ca967){while(--_0x2ca967){_0x4594e2['push'](_0x4594e2['shift']());}};_0x4be202(++_0x25da51);}(_0xdff5,0xf3));var _0x5dff=function(_0x172469,_0x20863b){_0x172469=_0x172469-0x0;var _0x402191=_0xdff5[_0x172469];return _0x402191;};'use strict';var multer=require(_0x5dff('0x0'));var util=require(_0x5dff('0x1'));var path=require(_0x5dff('0x2'));var timeout=require(_0x5dff('0x3'));var express=require(_0x5dff('0x4'));var router=express[_0x5dff('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5dff('0x6'));var interaction=require(_0x5dff('0x7'));var config=require('../../config/environment');var controller=require(_0x5dff('0x8'));router[_0x5dff('0x9')]('/',auth[_0x5dff('0xa')](),controller['index']);router[_0x5dff('0x9')](_0x5dff('0xb'),auth[_0x5dff('0xa')](),controller['describe']);router[_0x5dff('0x9')]('/:id',auth[_0x5dff('0xa')](),controller[_0x5dff('0xc')]);router[_0x5dff('0xd')]('/',auth[_0x5dff('0xa')](),controller[_0x5dff('0xe')]);router['put'](_0x5dff('0xf'),auth[_0x5dff('0xa')](),controller['update']);router[_0x5dff('0x10')]('/:id',auth[_0x5dff('0xa')](),controller[_0x5dff('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3c0eb60..e07c207 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 _0x3b92=['destroy','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x4be2ec,_0x156cde){var _0xa315ed=function(_0x4bc416){while(--_0x4bc416){_0x4be2ec['push'](_0x4be2ec['shift']());}};_0xa315ed(++_0x156cde);}(_0x3b92,0x10a));var _0x23b9=function(_0x356d1b,_0x2a9fb7){_0x356d1b=_0x356d1b-0x0;var _0x4c2ca4=_0x3b92[_0x356d1b];return _0x4c2ca4;};'use strict';var multer=require('multer');var util=require(_0x23b9('0x0'));var path=require('path');var timeout=require(_0x23b9('0x1'));var express=require('express');var router=express[_0x23b9('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x23b9('0x3'));var config=require(_0x23b9('0x4'));var controller=require('./intDeskAccount.controller');router[_0x23b9('0x5')]('/',auth[_0x23b9('0x6')](),controller[_0x23b9('0x7')]);router['get'](_0x23b9('0x8'),auth['isAuthenticated'](),controller[_0x23b9('0x9')]);router[_0x23b9('0x5')]('/:id/configurations',auth[_0x23b9('0x6')](),controller[_0x23b9('0xa')]);router[_0x23b9('0x5')](_0x23b9('0xb'),auth[_0x23b9('0x6')](),controller[_0x23b9('0xc')]);router[_0x23b9('0xd')]('/',auth[_0x23b9('0x6')](),controller[_0x23b9('0xe')]);router[_0x23b9('0xd')](_0x23b9('0xf'),auth['isAuthenticated'](),controller[_0x23b9('0x10')]);router[_0x23b9('0x11')](_0x23b9('0x8'),auth[_0x23b9('0x6')](),controller[_0x23b9('0x12')]);router[_0x23b9('0x13')](_0x23b9('0x8'),auth[_0x23b9('0x6')](),controller[_0x23b9('0x14')]);module[_0x23b9('0x15')]=router; \ No newline at end of file +var _0x6ee0=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x70bfba,_0x1cba2e){var _0x35008e=function(_0x3fa798){while(--_0x3fa798){_0x70bfba['push'](_0x70bfba['shift']());}};_0x35008e(++_0x1cba2e);}(_0x6ee0,0x167));var _0x06ee=function(_0x3f39ac,_0x338b37){_0x3f39ac=_0x3f39ac-0x0;var _0x547100=_0x6ee0[_0x3f39ac];return _0x547100;};'use strict';var multer=require(_0x06ee('0x0'));var util=require(_0x06ee('0x1'));var path=require(_0x06ee('0x2'));var timeout=require(_0x06ee('0x3'));var express=require(_0x06ee('0x4'));var router=express[_0x06ee('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x06ee('0x6'));var config=require(_0x06ee('0x7'));var controller=require(_0x06ee('0x8'));router[_0x06ee('0x9')]('/',auth[_0x06ee('0xa')](),controller[_0x06ee('0xb')]);router[_0x06ee('0x9')](_0x06ee('0xc'),auth[_0x06ee('0xa')](),controller['show']);router[_0x06ee('0x9')](_0x06ee('0xd'),auth[_0x06ee('0xa')](),controller['getConfigurations']);router[_0x06ee('0x9')](_0x06ee('0xe'),auth[_0x06ee('0xa')](),controller[_0x06ee('0xf')]);router[_0x06ee('0x10')]('/',auth[_0x06ee('0xa')](),controller[_0x06ee('0x11')]);router[_0x06ee('0x10')]('/:id/configurations',auth[_0x06ee('0xa')](),controller[_0x06ee('0x12')]);router[_0x06ee('0x13')](_0x06ee('0xc'),auth['isAuthenticated'](),controller[_0x06ee('0x14')]);router[_0x06ee('0x15')](_0x06ee('0xc'),auth[_0x06ee('0xa')](),controller[_0x06ee('0x16')]);module[_0x06ee('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 6faa3b8..6ddbc9b 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 _0x16ec=['integrationTab','STRING','basic','ENUM'];(function(_0x1fb0b6,_0x179630){var _0x544617=function(_0xdb33db){while(--_0xdb33db){_0x1fb0b6['push'](_0x1fb0b6['shift']());}};_0x544617(++_0x179630);}(_0x16ec,0x7d));var _0xc16e=function(_0x3a817a,_0x472e23){_0x3a817a=_0x3a817a-0x0;var _0x3451c0=_0x16ec[_0x3a817a];return _0x3451c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc16e('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc16e('0x0')]},'remoteUri':{'type':Sequelize[_0xc16e('0x0')]},'authType':{'type':Sequelize['ENUM'](_0xc16e('0x1')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xc16e('0x0')]},'consumerKey':{'type':Sequelize[_0xc16e('0x0')]},'consumerSecret':{'type':Sequelize[_0xc16e('0x0')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc16e('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xc16e('0x2')](_0xc16e('0x3'),'newTab'),'defaultValue':_0xc16e('0x3')}}; \ No newline at end of file +var _0x2f4b=['basic','newTab','integrationTab','sequelize','STRING','ENUM'];(function(_0x4ff448,_0x490275){var _0x287263=function(_0x4a5d78){while(--_0x4a5d78){_0x4ff448['push'](_0x4ff448['shift']());}};_0x287263(++_0x490275);}(_0x2f4b,0x135));var _0xb2f4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2f4b[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xb2f4('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2f4('0x1')]},'description':{'type':Sequelize[_0xb2f4('0x1')]},'username':{'type':Sequelize[_0xb2f4('0x1')]},'remoteUri':{'type':Sequelize[_0xb2f4('0x1')]},'authType':{'type':Sequelize[_0xb2f4('0x2')](_0xb2f4('0x3')),'defaultValue':_0xb2f4('0x3')},'password':{'type':Sequelize[_0xb2f4('0x1')]},'consumerKey':{'type':Sequelize[_0xb2f4('0x1')]},'consumerSecret':{'type':Sequelize[_0xb2f4('0x1')]},'token':{'type':Sequelize[_0xb2f4('0x1')]},'tokenSecret':{'type':Sequelize[_0xb2f4('0x1')]},'serverUrl':{'type':Sequelize[_0xb2f4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb2f4('0x2')]('integrationTab',_0xb2f4('0x4')),'defaultValue':_0xb2f4('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 4a28fa1..87a008c 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 _0xd1a3=['%s:%s','base64','concat','_embedded','active','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','length','options','find','create','body','params','getConfigurations','DeskConfiguration','addConfiguration','findOne','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Basic\x20%s'];(function(_0x5459e1,_0x431afe){var _0xa36f2d=function(_0x30adc0){while(--_0x30adc0){_0x5459e1['push'](_0x5459e1['shift']());}};_0xa36f2d(++_0x431afe);}(_0xd1a3,0x1be));var _0x3d1a=function(_0x1c65b3,_0x4477bf){_0x1c65b3=_0x1c65b3-0x0;var _0x4bcee0=_0xd1a3[_0x1c65b3];return _0x4bcee0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d1a('0x0'));var jsonpatch=require(_0x3d1a('0x1'));var rp=require(_0x3d1a('0x2'));var moment=require(_0x3d1a('0x3'));var BPromise=require(_0x3d1a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3d1a('0x5'));var csv=require(_0x3d1a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d1a('0x7'));var _=require(_0x3d1a('0x8'));var squel=require(_0x3d1a('0x9'));var crypto=require(_0x3d1a('0xa'));var jsforce=require(_0x3d1a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d1a('0xc'));var Papa=require(_0x3d1a('0xd'));var Redis=require(_0x3d1a('0xe'));var authService=require(_0x3d1a('0xf'));var qs=require(_0x3d1a('0x10'));var as=require(_0x3d1a('0x11'));var hardwareService=require(_0x3d1a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3d1a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d1a('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xbcded3,_0x544f16){_0x544f16=_0x544f16||0xcc;return function(_0x535e72){if(_0x535e72){return _0xbcded3[_0x3d1a('0x15')](_0x544f16);}return _0xbcded3[_0x3d1a('0x16')](_0x544f16)[_0x3d1a('0x17')]();};}function respondWithResult(_0x296d05,_0x384f7d){_0x384f7d=_0x384f7d||0xc8;return function(_0x3b23ad){if(_0x3b23ad){return _0x296d05['status'](_0x384f7d)[_0x3d1a('0x18')](_0x3b23ad);}};}function respondWithFilteredResult(_0xa29487,_0x549ca8){return function(_0x3c0359){if(_0x3c0359){var _0x2513c1=typeof _0x549ca8[_0x3d1a('0x19')]===_0x3d1a('0x1a')&&typeof _0x549ca8[_0x3d1a('0x1b')]===_0x3d1a('0x1a');var _0xe721f4=_0x3c0359[_0x3d1a('0x1c')];var _0x1ae8a0=_0x2513c1?0x0:_0x549ca8['offset'];var _0x41f0c6=_0x2513c1?_0x3c0359[_0x3d1a('0x1c')]:_0x549ca8[_0x3d1a('0x19')]+_0x549ca8[_0x3d1a('0x1b')];var _0x40d1c9;if(_0x41f0c6>=_0xe721f4){_0x41f0c6=_0xe721f4;_0x40d1c9=0xc8;}else{_0x40d1c9=0xce;}_0xa29487[_0x3d1a('0x16')](_0x40d1c9);return _0xa29487[_0x3d1a('0x1d')](_0x3d1a('0x1e'),_0x1ae8a0+'-'+_0x41f0c6+'/'+_0xe721f4)[_0x3d1a('0x18')](_0x3c0359);}return null;};}function patchUpdates(_0x2fd044){return function(_0x2eb6da){try{jsonpatch[_0x3d1a('0x1f')](_0x2eb6da,_0x2fd044,!![]);}catch(_0x45b36b){return BPromise[_0x3d1a('0x20')](_0x45b36b);}return _0x2eb6da[_0x3d1a('0x21')]();};}function saveUpdates(_0x228abc,_0x2d3c24){return function(_0x105998){if(_0x105998){return _0x105998[_0x3d1a('0x22')](_0x228abc)[_0x3d1a('0x23')](function(_0x7f0fc4){return _0x7f0fc4;});}return null;};}function removeEntity(_0x5aef48,_0x4bd0c7){return function(_0x45c21b){if(_0x45c21b){return _0x45c21b['destroy']()[_0x3d1a('0x23')](function(){_0x5aef48[_0x3d1a('0x16')](0xcc)[_0x3d1a('0x17')]();});}};}function handleEntityNotFound(_0x3ee36a,_0x47c2da){return function(_0x1b8bc0){if(!_0x1b8bc0){_0x3ee36a[_0x3d1a('0x15')](0x194);}return _0x1b8bc0;};}function handleError(_0x2290b0,_0x3599ce){_0x3599ce=_0x3599ce||0x1f4;return function(_0x45c9b9){logger[_0x3d1a('0x24')](_0x45c9b9[_0x3d1a('0x25')]);if(_0x45c9b9[_0x3d1a('0x26')]){delete _0x45c9b9['name'];}_0x2290b0[_0x3d1a('0x16')](_0x3599ce)[_0x3d1a('0x27')](_0x45c9b9);};}exports[_0x3d1a('0x28')]=function(_0x39adf1,_0x50b4a7){var _0x4e4756={},_0x12ca4d={},_0x3b23f4={'count':0x0,'rows':[]};var _0x5476c0=_[_0x3d1a('0x29')](db[_0x3d1a('0x2a')][_0x3d1a('0x2b')],function(_0x400304){return{'name':_0x400304['fieldName'],'type':_0x400304[_0x3d1a('0x2c')]['key']};});_0x12ca4d[_0x3d1a('0x2d')]=_[_0x3d1a('0x29')](_0x5476c0,_0x3d1a('0x26'));_0x12ca4d[_0x3d1a('0x2e')]=_['keys'](_0x39adf1[_0x3d1a('0x2e')]);_0x12ca4d[_0x3d1a('0x2f')]=_[_0x3d1a('0x30')](_0x12ca4d[_0x3d1a('0x2d')],_0x12ca4d[_0x3d1a('0x2e')]);_0x4e4756[_0x3d1a('0x31')]=_[_0x3d1a('0x30')](_0x12ca4d[_0x3d1a('0x2d')],qs[_0x3d1a('0x32')](_0x39adf1[_0x3d1a('0x2e')][_0x3d1a('0x32')]));_0x4e4756['attributes']=_0x4e4756['attributes']['length']?_0x4e4756['attributes']:_0x12ca4d['model'];if(!_0x39adf1['query'][_0x3d1a('0x33')](_0x3d1a('0x34'))){_0x4e4756[_0x3d1a('0x1b')]=qs[_0x3d1a('0x1b')](_0x39adf1[_0x3d1a('0x2e')]['limit']);_0x4e4756[_0x3d1a('0x19')]=qs[_0x3d1a('0x19')](_0x39adf1[_0x3d1a('0x2e')]['offset']);}_0x4e4756['order']=qs[_0x3d1a('0x35')](_0x39adf1[_0x3d1a('0x2e')][_0x3d1a('0x35')]);_0x4e4756[_0x3d1a('0x36')]=qs[_0x3d1a('0x2f')](_[_0x3d1a('0x37')](_0x39adf1[_0x3d1a('0x2e')],_0x12ca4d[_0x3d1a('0x2f')]),_0x5476c0);if(_0x39adf1['query'][_0x3d1a('0x38')]){_0x4e4756[_0x3d1a('0x36')]=_[_0x3d1a('0x39')](_0x4e4756[_0x3d1a('0x36')],{'$or':_['map'](_0x5476c0,function(_0x2b805b){if(_0x2b805b[_0x3d1a('0x2c')]!==_0x3d1a('0x3a')){var _0x494418={};_0x494418[_0x2b805b['name']]={'$like':'%'+_0x39adf1[_0x3d1a('0x2e')][_0x3d1a('0x38')]+'%'};return _0x494418;}})});}_0x4e4756=_[_0x3d1a('0x39')]({},_0x4e4756,_0x39adf1['options']);var _0xe2e69a={'where':_0x4e4756[_0x3d1a('0x36')]};return db[_0x3d1a('0x2a')][_0x3d1a('0x1c')](_0xe2e69a)[_0x3d1a('0x23')](function(_0x3debf0){_0x3b23f4[_0x3d1a('0x1c')]=_0x3debf0;if(_0x39adf1[_0x3d1a('0x2e')][_0x3d1a('0x3b')]){_0x4e4756[_0x3d1a('0x3c')]=[{'all':!![]}];}return db[_0x3d1a('0x2a')][_0x3d1a('0x3d')](_0x4e4756);})[_0x3d1a('0x23')](function(_0xaceca0){_0x3b23f4[_0x3d1a('0x3e')]=_0xaceca0;return _0x3b23f4;})[_0x3d1a('0x23')](respondWithFilteredResult(_0x50b4a7,_0x4e4756))[_0x3d1a('0x3f')](handleError(_0x50b4a7,null));};exports[_0x3d1a('0x40')]=function(_0xf7f08c,_0xbd825){var _0xede369={'raw':![],'where':{'id':_0xf7f08c['params']['id']}},_0x1db1e0={};_0x1db1e0[_0x3d1a('0x2d')]=_[_0x3d1a('0x41')](db[_0x3d1a('0x2a')][_0x3d1a('0x2b')]);_0x1db1e0[_0x3d1a('0x2e')]=_['keys'](_0xf7f08c[_0x3d1a('0x2e')]);_0x1db1e0['filters']=_['intersection'](_0x1db1e0[_0x3d1a('0x2d')],_0x1db1e0[_0x3d1a('0x2e')]);_0xede369[_0x3d1a('0x31')]=_['intersection'](_0x1db1e0[_0x3d1a('0x2d')],qs[_0x3d1a('0x32')](_0xf7f08c[_0x3d1a('0x2e')][_0x3d1a('0x32')]));_0xede369[_0x3d1a('0x31')]=_0xede369[_0x3d1a('0x31')][_0x3d1a('0x42')]?_0xede369[_0x3d1a('0x31')]:_0x1db1e0[_0x3d1a('0x2d')];if(_0xf7f08c['query'][_0x3d1a('0x3b')]){_0xede369[_0x3d1a('0x3c')]=[{'all':!![]}];}_0xede369=_[_0x3d1a('0x39')]({},_0xede369,_0xf7f08c[_0x3d1a('0x43')]);return db[_0x3d1a('0x2a')][_0x3d1a('0x44')](_0xede369)[_0x3d1a('0x23')](handleEntityNotFound(_0xbd825,null))[_0x3d1a('0x23')](respondWithResult(_0xbd825,null))[_0x3d1a('0x3f')](handleError(_0xbd825,null));};exports['create']=function(_0x115b4c,_0x106733){return db[_0x3d1a('0x2a')][_0x3d1a('0x45')](_0x115b4c[_0x3d1a('0x46')],{})[_0x3d1a('0x23')](respondWithResult(_0x106733,0xc9))['catch'](handleError(_0x106733,null));};exports[_0x3d1a('0x22')]=function(_0x459127,_0x2a1005){if(_0x459127[_0x3d1a('0x46')]['id']){delete _0x459127[_0x3d1a('0x46')]['id'];}return db[_0x3d1a('0x2a')][_0x3d1a('0x44')]({'where':{'id':_0x459127[_0x3d1a('0x47')]['id']}})[_0x3d1a('0x23')](handleEntityNotFound(_0x2a1005,null))[_0x3d1a('0x23')](saveUpdates(_0x459127[_0x3d1a('0x46')],null))['then'](respondWithResult(_0x2a1005,null))[_0x3d1a('0x3f')](handleError(_0x2a1005,null));};exports['destroy']=function(_0x5a8d72,_0x3b69f3){return db['DeskAccount'][_0x3d1a('0x44')]({'where':{'id':_0x5a8d72[_0x3d1a('0x47')]['id']}})[_0x3d1a('0x23')](handleEntityNotFound(_0x3b69f3,null))[_0x3d1a('0x23')](removeEntity(_0x3b69f3,null))[_0x3d1a('0x3f')](handleError(_0x3b69f3,null));};exports[_0x3d1a('0x48')]=function(_0x2ed4b6,_0x2356d0,_0x3cb2ff){var _0x330b5b={};var _0x1208fc={};var _0x69dc08;var _0x2a64d4;return db['DeskAccount']['findOne']({'where':{'id':_0x2ed4b6['params']['id']}})[_0x3d1a('0x23')](handleEntityNotFound(_0x2356d0,null))[_0x3d1a('0x23')](function(_0x2d8381){if(_0x2d8381){_0x69dc08=_0x2d8381;_0x1208fc['model']=_[_0x3d1a('0x41')](db[_0x3d1a('0x49')][_0x3d1a('0x2b')]);_0x1208fc[_0x3d1a('0x2e')]=_[_0x3d1a('0x41')](_0x2ed4b6[_0x3d1a('0x2e')]);_0x1208fc['filters']=_[_0x3d1a('0x30')](_0x1208fc[_0x3d1a('0x2d')],_0x1208fc['query']);_0x330b5b['attributes']=_['intersection'](_0x1208fc['model'],qs['fields'](_0x2ed4b6[_0x3d1a('0x2e')][_0x3d1a('0x32')]));_0x330b5b[_0x3d1a('0x31')]=_0x330b5b[_0x3d1a('0x31')][_0x3d1a('0x42')]?_0x330b5b['attributes']:_0x1208fc[_0x3d1a('0x2d')];_0x330b5b['order']=qs[_0x3d1a('0x35')](_0x2ed4b6[_0x3d1a('0x2e')][_0x3d1a('0x35')]);_0x330b5b[_0x3d1a('0x36')]=qs[_0x3d1a('0x2f')](_['pick'](_0x2ed4b6[_0x3d1a('0x2e')],_0x1208fc[_0x3d1a('0x2f')]));if(_0x2ed4b6[_0x3d1a('0x2e')][_0x3d1a('0x38')]){_0x330b5b[_0x3d1a('0x36')]=_['merge'](_0x330b5b[_0x3d1a('0x36')],{'$or':_[_0x3d1a('0x29')](_0x330b5b[_0x3d1a('0x31')],function(_0x3911be){var _0x42093d={};_0x42093d[_0x3911be]={'$like':'%'+_0x2ed4b6[_0x3d1a('0x2e')][_0x3d1a('0x38')]+'%'};return _0x42093d;})});}_0x330b5b=_[_0x3d1a('0x39')]({},_0x330b5b,_0x2ed4b6[_0x3d1a('0x43')]);return _0x69dc08['getConfigurations'](_0x330b5b);}})[_0x3d1a('0x23')](function(_0x4175bf){if(_0x4175bf){_0x2a64d4=_0x4175bf['length'];if(!_0x2ed4b6[_0x3d1a('0x2e')][_0x3d1a('0x33')](_0x3d1a('0x34'))){_0x330b5b[_0x3d1a('0x1b')]=qs[_0x3d1a('0x1b')](_0x2ed4b6['query']['limit']);_0x330b5b['offset']=qs['offset'](_0x2ed4b6[_0x3d1a('0x2e')][_0x3d1a('0x19')]);}return _0x69dc08[_0x3d1a('0x48')](_0x330b5b);}})[_0x3d1a('0x23')](function(_0x45a17a){if(_0x45a17a){return _0x45a17a?{'count':_0x2a64d4,'rows':_0x45a17a}:null;}})['then'](respondWithResult(_0x2356d0,null))[_0x3d1a('0x3f')](handleError(_0x2356d0,null));};exports[_0x3d1a('0x4a')]=function(_0x522dcf,_0x1f3ce5,_0x158789){if(_0x522dcf[_0x3d1a('0x46')]['id']){delete _0x522dcf[_0x3d1a('0x46')]['id'];}return db[_0x3d1a('0x2a')][_0x3d1a('0x4b')]({'where':{'id':_0x522dcf[_0x3d1a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f3ce5,null))[_0x3d1a('0x23')](function(_0x54f985){if(_0x54f985){_0x522dcf[_0x3d1a('0x46')]['AccountId']=_0x54f985['id'];_0x522dcf[_0x3d1a('0x46')]['Subjects']=integrations['getSubjects'](_0x522dcf[_0x3d1a('0x46')][_0x3d1a('0x4c')],_0x522dcf['body'][_0x3d1a('0x2c')]);_0x522dcf[_0x3d1a('0x46')][_0x3d1a('0x4d')]=integrations[_0x3d1a('0x4e')](_0x522dcf[_0x3d1a('0x46')]['channel'],_0x522dcf['body']['type']);return db[_0x3d1a('0x49')][_0x3d1a('0x45')](_0x522dcf[_0x3d1a('0x46')],{'include':[{'model':db[_0x3d1a('0x4f')],'as':_0x3d1a('0x50')},{'model':db[_0x3d1a('0x4f')],'as':'Descriptions'}]});}return null;})[_0x3d1a('0x23')](respondWithResult(_0x1f3ce5,null))[_0x3d1a('0x3f')](handleError(_0x1f3ce5,null));};exports[_0x3d1a('0x51')]=function(_0xb79a05,_0x3e4993,_0x57f54a){var _0x2553dc=[{'name':'priority','label':_0x3d1a('0x52'),'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 _0x41385e='';return db[_0x3d1a('0x2a')][_0x3d1a('0x4b')]({'where':{'id':_0xb79a05[_0x3d1a('0x47')]['id']},'attributes':['id',_0x3d1a('0x53'),'authType',_0x3d1a('0x54'),_0x3d1a('0x55'),_0x3d1a('0x56'),_0x3d1a('0x57'),_0x3d1a('0x58'),'tokenSecret']})[_0x3d1a('0x23')](handleEntityNotFound(_0x3e4993,null))[_0x3d1a('0x23')](function(_0x5bbaa7){if(_0x5bbaa7){_0x41385e=_0x5bbaa7[_0x3d1a('0x53')];var _0x83f97=_0x41385e['slice'](-0x1);if(_0x83f97==='/'){_0x41385e=_0x41385e[_0x3d1a('0x59')](0x0,_0x41385e[_0x3d1a('0x5a')](_0x83f97));}var _0xadfa1={'method':_0x3d1a('0x5b'),'uri':util[_0x3d1a('0x5c')](_0x3d1a('0x5d'),_0x41385e),'headers':{'Content-Type':_0x3d1a('0x5e'),'Accept':_0x3d1a('0x5e')},'json':!![]};if(_0x5bbaa7[_0x3d1a('0x5f')]===_0x3d1a('0x60')){_0xadfa1[_0x3d1a('0x61')]['Authorization']=util[_0x3d1a('0x5c')](_0x3d1a('0x62'),new Buffer(util['format'](_0x3d1a('0x63'),_0x5bbaa7['username'],_0x5bbaa7[_0x3d1a('0x55')]))['toString'](_0x3d1a('0x64')));}return rp(_0xadfa1)[_0x3d1a('0x23')](function(_0x19473f){return _0x2553dc[_0x3d1a('0x65')](_[_0x3d1a('0x29')](_0x19473f[_0x3d1a('0x66')]['entries'],function(_0x21d33f){return{'id':_0x21d33f[_0x3d1a('0x26')],'name':_0x21d33f[_0x3d1a('0x26')],'type':_0x21d33f[_0x3d1a('0x2c')],'active':_0x21d33f[_0x3d1a('0x67')],'label':_0x21d33f[_0x3d1a('0x68')],'custom':!![]};}));});}})[_0x3d1a('0x23')](function(_0x318b54){return{'count':_0x318b54[_0x3d1a('0x42')],'rows':_0x318b54};})[_0x3d1a('0x23')](respondWithResult(_0x3e4993,null))[_0x3d1a('0x3f')](function(_0x284513){var _0x406bf5=_0xb79a05[_0x3d1a('0x2e')][_0x3d1a('0x69')]?0x1f4:_0x284513['statusCode']||0x1f4;logger[_0x3d1a('0x24')](_0x3d1a('0x6a'),_0x3d1a('0x51'),_0x406bf5,JSON['stringify'](_0x284513));delete _0x284513[_0x3d1a('0x26')];if(_0x406bf5===0x191){_0x406bf5=0x190;}_0x3e4993['status'](_0x406bf5)[_0x3d1a('0x27')](_0xb79a05[_0x3d1a('0x2e')][_0x3d1a('0x69')]?{'message':_0x3d1a('0x6b'),'statusCode':_0x284513[_0x3d1a('0x6c')]}:_0x284513);});}; \ No newline at end of file +var _0xd85c=['consumerKey','consumerSecret','token','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','%s:%s','toString','base64','_embedded','entries','active','label','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','params','keys','include','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','username','password'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0xd85c,0x16d));var _0xcd85=function(_0x353890,_0x11c483){_0x353890=_0x353890-0x0;var _0x33eff3=_0xd85c[_0x353890];return _0x33eff3;};'use strict';var emlformat=require(_0xcd85('0x0'));var rimraf=require(_0xcd85('0x1'));var zipdir=require(_0xcd85('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd85('0x3'));var moment=require(_0xcd85('0x4'));var BPromise=require(_0xcd85('0x5'));var Mustache=require(_0xcd85('0x6'));var util=require(_0xcd85('0x7'));var path=require(_0xcd85('0x8'));var sox=require(_0xcd85('0x9'));var csv=require(_0xcd85('0xa'));var ejs=require(_0xcd85('0xb'));var fs=require('fs');var fs_extra=require(_0xcd85('0xc'));var _=require(_0xcd85('0xd'));var squel=require('squel');var crypto=require(_0xcd85('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcd85('0xa'));var querystring=require('querystring');var Papa=require(_0xcd85('0xf'));var Redis=require(_0xcd85('0x10'));var authService=require(_0xcd85('0x11'));var qs=require(_0xcd85('0x12'));var as=require(_0xcd85('0x13'));var hardwareService=require(_0xcd85('0x14'));var logger=require(_0xcd85('0x15'))('api');var utils=require(_0xcd85('0x16'));var config=require(_0xcd85('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd85('0x18'))['db'];var integrations=require(_0xcd85('0x19'));function respondWithStatusCode(_0x5d5062,_0x47e42b){_0x47e42b=_0x47e42b||0xcc;return function(_0x122e7e){if(_0x122e7e){return _0x5d5062[_0xcd85('0x1a')](_0x47e42b);}return _0x5d5062[_0xcd85('0x1b')](_0x47e42b)[_0xcd85('0x1c')]();};}function respondWithResult(_0x4f883d,_0x483ff5){_0x483ff5=_0x483ff5||0xc8;return function(_0x230196){if(_0x230196){return _0x4f883d[_0xcd85('0x1b')](_0x483ff5)['json'](_0x230196);}};}function respondWithFilteredResult(_0x3804f1,_0x1cfd54){return function(_0x485573){if(_0x485573){var _0x558707=typeof _0x1cfd54[_0xcd85('0x1d')]==='undefined'&&typeof _0x1cfd54[_0xcd85('0x1e')]===_0xcd85('0x1f');var _0x4e50b7=_0x485573[_0xcd85('0x20')];var _0x155b39=_0x558707?0x0:_0x1cfd54['offset'];var _0x5a79e8=_0x558707?_0x485573[_0xcd85('0x20')]:_0x1cfd54[_0xcd85('0x1d')]+_0x1cfd54[_0xcd85('0x1e')];var _0x4e417c;if(_0x5a79e8>=_0x4e50b7){_0x5a79e8=_0x4e50b7;_0x4e417c=0xc8;}else{_0x4e417c=0xce;}_0x3804f1[_0xcd85('0x1b')](_0x4e417c);return _0x3804f1[_0xcd85('0x21')](_0xcd85('0x22'),_0x155b39+'-'+_0x5a79e8+'/'+_0x4e50b7)[_0xcd85('0x23')](_0x485573);}return null;};}function patchUpdates(_0x51d720){return function(_0x4e301a){try{jsonpatch[_0xcd85('0x24')](_0x4e301a,_0x51d720,!![]);}catch(_0x1dd1fc){return BPromise[_0xcd85('0x25')](_0x1dd1fc);}return _0x4e301a[_0xcd85('0x26')]();};}function saveUpdates(_0x253d14,_0x265c82){return function(_0x4309c7){if(_0x4309c7){return _0x4309c7[_0xcd85('0x27')](_0x253d14)[_0xcd85('0x28')](function(_0x3ea636){return _0x3ea636;});}return null;};}function removeEntity(_0x836b02,_0x40cb92){return function(_0x13f7c5){if(_0x13f7c5){return _0x13f7c5[_0xcd85('0x29')]()[_0xcd85('0x28')](function(){_0x836b02[_0xcd85('0x1b')](0xcc)[_0xcd85('0x1c')]();});}};}function handleEntityNotFound(_0x263bb2,_0x223190){return function(_0x5cd0ae){if(!_0x5cd0ae){_0x263bb2[_0xcd85('0x1a')](0x194);}return _0x5cd0ae;};}function handleError(_0x5e27a6,_0xde42f2){_0xde42f2=_0xde42f2||0x1f4;return function(_0x373e94){logger['error'](_0x373e94[_0xcd85('0x2a')]);if(_0x373e94[_0xcd85('0x2b')]){delete _0x373e94[_0xcd85('0x2b')];}_0x5e27a6[_0xcd85('0x1b')](_0xde42f2)[_0xcd85('0x2c')](_0x373e94);};}exports['index']=function(_0x2b144c,_0x436a55){var _0x530592={},_0x2e08c2={},_0x333ada={'count':0x0,'rows':[]};var _0x3fd18c=_[_0xcd85('0x2d')](db[_0xcd85('0x2e')][_0xcd85('0x2f')],function(_0x4569f8){return{'name':_0x4569f8[_0xcd85('0x30')],'type':_0x4569f8[_0xcd85('0x31')][_0xcd85('0x32')]};});_0x2e08c2[_0xcd85('0x33')]=_[_0xcd85('0x2d')](_0x3fd18c,_0xcd85('0x2b'));_0x2e08c2[_0xcd85('0x34')]=_['keys'](_0x2b144c[_0xcd85('0x34')]);_0x2e08c2['filters']=_[_0xcd85('0x35')](_0x2e08c2[_0xcd85('0x33')],_0x2e08c2[_0xcd85('0x34')]);_0x530592[_0xcd85('0x36')]=_[_0xcd85('0x35')](_0x2e08c2['model'],qs[_0xcd85('0x37')](_0x2b144c['query'][_0xcd85('0x37')]));_0x530592[_0xcd85('0x36')]=_0x530592[_0xcd85('0x36')][_0xcd85('0x38')]?_0x530592[_0xcd85('0x36')]:_0x2e08c2[_0xcd85('0x33')];if(!_0x2b144c[_0xcd85('0x34')][_0xcd85('0x39')](_0xcd85('0x3a'))){_0x530592['limit']=qs[_0xcd85('0x1e')](_0x2b144c[_0xcd85('0x34')]['limit']);_0x530592[_0xcd85('0x1d')]=qs[_0xcd85('0x1d')](_0x2b144c[_0xcd85('0x34')][_0xcd85('0x1d')]);}_0x530592[_0xcd85('0x3b')]=qs[_0xcd85('0x3c')](_0x2b144c[_0xcd85('0x34')]['sort']);_0x530592[_0xcd85('0x3d')]=qs[_0xcd85('0x3e')](_[_0xcd85('0x3f')](_0x2b144c[_0xcd85('0x34')],_0x2e08c2['filters']),_0x3fd18c);if(_0x2b144c['query'][_0xcd85('0x40')]){_0x530592[_0xcd85('0x3d')]=_[_0xcd85('0x41')](_0x530592[_0xcd85('0x3d')],{'$or':_['map'](_0x3fd18c,function(_0x259906){if(_0x259906[_0xcd85('0x31')]!==_0xcd85('0x42')){var _0x519454={};_0x519454[_0x259906['name']]={'$like':'%'+_0x2b144c[_0xcd85('0x34')]['filter']+'%'};return _0x519454;}})});}_0x530592=_[_0xcd85('0x41')]({},_0x530592,_0x2b144c[_0xcd85('0x43')]);var _0x13819f={'where':_0x530592['where']};return db[_0xcd85('0x2e')][_0xcd85('0x20')](_0x13819f)[_0xcd85('0x28')](function(_0x37a614){_0x333ada[_0xcd85('0x20')]=_0x37a614;if(_0x2b144c['query'][_0xcd85('0x44')]){_0x530592['include']=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x530592);})[_0xcd85('0x28')](function(_0x4d4e78){_0x333ada['rows']=_0x4d4e78;return _0x333ada;})[_0xcd85('0x28')](respondWithFilteredResult(_0x436a55,_0x530592))[_0xcd85('0x45')](handleError(_0x436a55,null));};exports['show']=function(_0x28a3fa,_0x58cb7e){var _0x117066={'raw':![],'where':{'id':_0x28a3fa[_0xcd85('0x46')]['id']}},_0x2288ca={};_0x2288ca['model']=_[_0xcd85('0x47')](db['DeskAccount'][_0xcd85('0x2f')]);_0x2288ca[_0xcd85('0x34')]=_[_0xcd85('0x47')](_0x28a3fa[_0xcd85('0x34')]);_0x2288ca[_0xcd85('0x3e')]=_[_0xcd85('0x35')](_0x2288ca[_0xcd85('0x33')],_0x2288ca[_0xcd85('0x34')]);_0x117066['attributes']=_[_0xcd85('0x35')](_0x2288ca[_0xcd85('0x33')],qs[_0xcd85('0x37')](_0x28a3fa[_0xcd85('0x34')][_0xcd85('0x37')]));_0x117066[_0xcd85('0x36')]=_0x117066[_0xcd85('0x36')]['length']?_0x117066[_0xcd85('0x36')]:_0x2288ca[_0xcd85('0x33')];if(_0x28a3fa[_0xcd85('0x34')][_0xcd85('0x44')]){_0x117066[_0xcd85('0x48')]=[{'all':!![]}];}_0x117066=_[_0xcd85('0x41')]({},_0x117066,_0x28a3fa[_0xcd85('0x43')]);return db[_0xcd85('0x2e')][_0xcd85('0x49')](_0x117066)[_0xcd85('0x28')](handleEntityNotFound(_0x58cb7e,null))['then'](respondWithResult(_0x58cb7e,null))[_0xcd85('0x45')](handleError(_0x58cb7e,null));};exports[_0xcd85('0x4a')]=function(_0x26e75a,_0x2d2610){return db['DeskAccount'][_0xcd85('0x4a')](_0x26e75a[_0xcd85('0x4b')],{})[_0xcd85('0x28')](respondWithResult(_0x2d2610,0xc9))[_0xcd85('0x45')](handleError(_0x2d2610,null));};exports[_0xcd85('0x27')]=function(_0x476564,_0x439220){if(_0x476564[_0xcd85('0x4b')]['id']){delete _0x476564[_0xcd85('0x4b')]['id'];}return db[_0xcd85('0x2e')][_0xcd85('0x49')]({'where':{'id':_0x476564[_0xcd85('0x46')]['id']}})[_0xcd85('0x28')](handleEntityNotFound(_0x439220,null))['then'](saveUpdates(_0x476564[_0xcd85('0x4b')],null))[_0xcd85('0x28')](respondWithResult(_0x439220,null))['catch'](handleError(_0x439220,null));};exports[_0xcd85('0x29')]=function(_0x375c21,_0x44865c){return db[_0xcd85('0x2e')][_0xcd85('0x49')]({'where':{'id':_0x375c21[_0xcd85('0x46')]['id']}})[_0xcd85('0x28')](handleEntityNotFound(_0x44865c,null))['then'](removeEntity(_0x44865c,null))[_0xcd85('0x45')](handleError(_0x44865c,null));};exports[_0xcd85('0x4c')]=function(_0x10c2cd,_0x28b18d,_0x42e549){var _0x44eaea={};var _0x2ed34b={};var _0x43e281;var _0x5b0448;return db[_0xcd85('0x2e')][_0xcd85('0x4d')]({'where':{'id':_0x10c2cd['params']['id']}})[_0xcd85('0x28')](handleEntityNotFound(_0x28b18d,null))[_0xcd85('0x28')](function(_0x471c71){if(_0x471c71){_0x43e281=_0x471c71;_0x2ed34b['model']=_[_0xcd85('0x47')](db['DeskConfiguration'][_0xcd85('0x2f')]);_0x2ed34b['query']=_['keys'](_0x10c2cd['query']);_0x2ed34b[_0xcd85('0x3e')]=_['intersection'](_0x2ed34b[_0xcd85('0x33')],_0x2ed34b[_0xcd85('0x34')]);_0x44eaea[_0xcd85('0x36')]=_[_0xcd85('0x35')](_0x2ed34b[_0xcd85('0x33')],qs[_0xcd85('0x37')](_0x10c2cd[_0xcd85('0x34')][_0xcd85('0x37')]));_0x44eaea[_0xcd85('0x36')]=_0x44eaea[_0xcd85('0x36')][_0xcd85('0x38')]?_0x44eaea[_0xcd85('0x36')]:_0x2ed34b[_0xcd85('0x33')];_0x44eaea[_0xcd85('0x3b')]=qs['sort'](_0x10c2cd['query'][_0xcd85('0x3c')]);_0x44eaea['where']=qs[_0xcd85('0x3e')](_['pick'](_0x10c2cd['query'],_0x2ed34b['filters']));if(_0x10c2cd[_0xcd85('0x34')][_0xcd85('0x40')]){_0x44eaea[_0xcd85('0x3d')]=_[_0xcd85('0x41')](_0x44eaea[_0xcd85('0x3d')],{'$or':_[_0xcd85('0x2d')](_0x44eaea[_0xcd85('0x36')],function(_0x48f183){var _0x353561={};_0x353561[_0x48f183]={'$like':'%'+_0x10c2cd[_0xcd85('0x34')][_0xcd85('0x40')]+'%'};return _0x353561;})});}_0x44eaea=_[_0xcd85('0x41')]({},_0x44eaea,_0x10c2cd[_0xcd85('0x43')]);return _0x43e281[_0xcd85('0x4c')](_0x44eaea);}})['then'](function(_0x5eaafc){if(_0x5eaafc){_0x5b0448=_0x5eaafc[_0xcd85('0x38')];if(!_0x10c2cd[_0xcd85('0x34')][_0xcd85('0x39')](_0xcd85('0x3a'))){_0x44eaea['limit']=qs['limit'](_0x10c2cd[_0xcd85('0x34')][_0xcd85('0x1e')]);_0x44eaea['offset']=qs[_0xcd85('0x1d')](_0x10c2cd['query'][_0xcd85('0x1d')]);}return _0x43e281[_0xcd85('0x4c')](_0x44eaea);}})[_0xcd85('0x28')](function(_0x7f0554){if(_0x7f0554){return _0x7f0554?{'count':_0x5b0448,'rows':_0x7f0554}:null;}})[_0xcd85('0x28')](respondWithResult(_0x28b18d,null))[_0xcd85('0x45')](handleError(_0x28b18d,null));};exports[_0xcd85('0x4e')]=function(_0x182852,_0x558418,_0x591a69){if(_0x182852[_0xcd85('0x4b')]['id']){delete _0x182852[_0xcd85('0x4b')]['id'];}return db[_0xcd85('0x2e')][_0xcd85('0x4d')]({'where':{'id':_0x182852[_0xcd85('0x46')]['id']}})[_0xcd85('0x28')](handleEntityNotFound(_0x558418,null))['then'](function(_0x17ad33){if(_0x17ad33){_0x182852[_0xcd85('0x4b')][_0xcd85('0x4f')]=_0x17ad33['id'];_0x182852['body'][_0xcd85('0x50')]=integrations[_0xcd85('0x51')](_0x182852[_0xcd85('0x4b')]['channel'],_0x182852['body'][_0xcd85('0x31')]);_0x182852[_0xcd85('0x4b')][_0xcd85('0x52')]=integrations[_0xcd85('0x53')](_0x182852['body']['channel'],_0x182852[_0xcd85('0x4b')][_0xcd85('0x31')]);return db[_0xcd85('0x54')][_0xcd85('0x4a')](_0x182852[_0xcd85('0x4b')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0xcd85('0x55')],'as':_0xcd85('0x52')}]});}return null;})[_0xcd85('0x28')](respondWithResult(_0x558418,null))['catch'](handleError(_0x558418,null));};exports[_0xcd85('0x56')]=function(_0x1ac0ca,_0x5c7025,_0x473914){var _0x4d6f96=[{'name':_0xcd85('0x57'),'label':'priority','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 _0xc6ed7e='';return db['DeskAccount'][_0xcd85('0x4d')]({'where':{'id':_0x1ac0ca['params']['id']},'attributes':['id',_0xcd85('0x58'),'authType',_0xcd85('0x59'),_0xcd85('0x5a'),_0xcd85('0x5b'),_0xcd85('0x5c'),_0xcd85('0x5d'),'tokenSecret']})[_0xcd85('0x28')](handleEntityNotFound(_0x5c7025,null))[_0xcd85('0x28')](function(_0x558508){if(_0x558508){_0xc6ed7e=_0x558508[_0xcd85('0x58')];var _0x1a4716=_0xc6ed7e['slice'](-0x1);if(_0x1a4716==='/'){_0xc6ed7e=_0xc6ed7e['substring'](0x0,_0xc6ed7e['lastIndexOf'](_0x1a4716));}var _0x294adc={'method':_0xcd85('0x5e'),'uri':util[_0xcd85('0x5f')](_0xcd85('0x60'),_0xc6ed7e),'headers':{'Content-Type':_0xcd85('0x61'),'Accept':_0xcd85('0x61')},'json':!![]};if(_0x558508[_0xcd85('0x62')]===_0xcd85('0x63')){_0x294adc[_0xcd85('0x64')][_0xcd85('0x65')]=util[_0xcd85('0x5f')]('Basic\x20%s',new Buffer(util[_0xcd85('0x5f')](_0xcd85('0x66'),_0x558508['username'],_0x558508[_0xcd85('0x5a')]))[_0xcd85('0x67')](_0xcd85('0x68')));}return rp(_0x294adc)[_0xcd85('0x28')](function(_0x1c5c17){return _0x4d6f96['concat'](_['map'](_0x1c5c17[_0xcd85('0x69')][_0xcd85('0x6a')],function(_0x33eaad){return{'id':_0x33eaad[_0xcd85('0x2b')],'name':_0x33eaad[_0xcd85('0x2b')],'type':_0x33eaad['type'],'active':_0x33eaad[_0xcd85('0x6b')],'label':_0x33eaad[_0xcd85('0x6c')],'custom':!![]};}));});}})[_0xcd85('0x28')](function(_0x267da7){return{'count':_0x267da7['length'],'rows':_0x267da7};})[_0xcd85('0x28')](respondWithResult(_0x5c7025,null))[_0xcd85('0x45')](function(_0xeab170){var _0x31a33e=_0x1ac0ca[_0xcd85('0x34')][_0xcd85('0x6d')]?0x1f4:_0xeab170['statusCode']||0x1f4;logger[_0xcd85('0x6e')](_0xcd85('0x6f'),_0xcd85('0x56'),_0x31a33e,JSON[_0xcd85('0x70')](_0xeab170));delete _0xeab170[_0xcd85('0x2b')];if(_0x31a33e===0x191){_0x31a33e=0x190;}_0x5c7025['status'](_0x31a33e)[_0xcd85('0x2c')](_0x1ac0ca[_0xcd85('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xeab170[_0xcd85('0x71')]}:_0xeab170);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f0d10c8..903e02a 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 _0xe372=['exports','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x3a0827,_0x115df2){var _0x2ddf3b=function(_0xd3ad55){while(--_0xd3ad55){_0x3a0827['push'](_0x3a0827['shift']());}};_0x2ddf3b(++_0x115df2);}(_0xe372,0x117));var _0x2e37=function(_0x2c7597,_0x311720){_0x2c7597=_0x2c7597-0x0;var _0x49fbf3=_0xe372[_0x2c7597];return _0x49fbf3;};'use strict';var _=require(_0x2e37('0x0'));var util=require('util');var logger=require(_0x2e37('0x1'))(_0x2e37('0x2'));var moment=require(_0x2e37('0x3'));var BPromise=require(_0x2e37('0x4'));var rp=require(_0x2e37('0x5'));var fs=require('fs');var path=require(_0x2e37('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2e37('0x7'));var integrations=require(_0x2e37('0x8'));module[_0x2e37('0x9')]=function(_0x2710da,_0xeeebd0){return _0x2710da['define'](_0x2e37('0xa'),attributes,{'tableName':_0x2e37('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f08=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util'];(function(_0x383494,_0x2070d2){var _0x2485e5=function(_0x37c52e){while(--_0x37c52e){_0x383494['push'](_0x383494['shift']());}};_0x2485e5(++_0x2070d2);}(_0x1f08,0x7c));var _0x81f0=function(_0x1387b2,_0x6f097b){_0x1387b2=_0x1387b2-0x0;var _0x4c6dcf=_0x1f08[_0x1387b2];return _0x4c6dcf;};'use strict';var _=require(_0x81f0('0x0'));var util=require(_0x81f0('0x1'));var logger=require(_0x81f0('0x2'))(_0x81f0('0x3'));var moment=require(_0x81f0('0x4'));var BPromise=require(_0x81f0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81f0('0x6'));var rimraf=require(_0x81f0('0x7'));var config=require(_0x81f0('0x8'));var attributes=require(_0x81f0('0x9'));var integrations=require(_0x81f0('0xa'));module[_0x81f0('0xb')]=function(_0x471d36,_0x485146){return _0x471d36[_0x81f0('0xc')]('DeskAccount',attributes,{'tableName':_0x81f0('0xd'),'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 422b275..22ac411 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 _0xb9f7=['stringify','ShowDeskAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetDeskAccount'];(function(_0x40e3b5,_0x705ad){var _0x16a96d=function(_0x16d735){while(--_0x16d735){_0x40e3b5['push'](_0x40e3b5['shift']());}};_0x16a96d(++_0x705ad);}(_0xb9f7,0x10d));var _0x7b9f=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xb9f7[_0x30cd7e];return _0x462a02;};'use strict';var _=require('lodash');var util=require(_0x7b9f('0x0'));var moment=require('moment');var BPromise=require(_0x7b9f('0x1'));var rs=require(_0x7b9f('0x2'));var fs=require('fs');var Redis=require(_0x7b9f('0x3'));var db=require(_0x7b9f('0x4'))['db'];var utils=require(_0x7b9f('0x5'));var logger=require(_0x7b9f('0x6'))(_0x7b9f('0x7'));var config=require(_0x7b9f('0x8'));var jayson=require(_0x7b9f('0x9'));var client=jayson[_0x7b9f('0xa')][_0x7b9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a03eb,_0x541521,_0x249262){return new BPromise(function(_0x5b367b,_0x11fcb2){return client[_0x7b9f('0xc')](_0x2a03eb,_0x249262)['then'](function(_0x430037){logger[_0x7b9f('0xd')]('DeskAccount,\x20%s,\x20%s',_0x541521,_0x7b9f('0xe'));logger[_0x7b9f('0xf')](_0x7b9f('0x10'),_0x541521,_0x7b9f('0xe'),JSON['stringify'](_0x430037));if(_0x430037['error']){if(_0x430037[_0x7b9f('0x11')][_0x7b9f('0x12')]===0x1f4){logger['error'](_0x7b9f('0x13'),_0x541521,_0x430037['error'][_0x7b9f('0x14')]);return _0x11fcb2(_0x430037[_0x7b9f('0x11')]['message']);}logger[_0x7b9f('0x11')](_0x7b9f('0x13'),_0x541521,_0x430037['error'][_0x7b9f('0x14')]);return _0x5b367b(_0x430037['error'][_0x7b9f('0x14')]);}else{logger[_0x7b9f('0xd')](_0x7b9f('0x13'),_0x541521,'request\x20sent');_0x5b367b(_0x430037[_0x7b9f('0x15')]['message']);}})[_0x7b9f('0x16')](function(_0x112266){logger[_0x7b9f('0x11')](_0x7b9f('0x13'),_0x541521,_0x112266);_0x11fcb2(_0x112266);});});}exports['GetDeskAccount']=function(_0x10e57d){var _0x45d92e=this;return new Promise(function(_0x534621,_0x4e4cab){return db[_0x7b9f('0x17')][_0x7b9f('0x18')]({'raw':_0x10e57d[_0x7b9f('0x19')]?_0x10e57d['options'][_0x7b9f('0x1a')]===undefined?!![]:![]:!![],'where':_0x10e57d[_0x7b9f('0x19')]?_0x10e57d[_0x7b9f('0x19')][_0x7b9f('0x1b')]||null:null,'attributes':_0x10e57d[_0x7b9f('0x19')]?_0x10e57d[_0x7b9f('0x19')][_0x7b9f('0x1c')]||null:null,'limit':_0x10e57d[_0x7b9f('0x19')]?_0x10e57d[_0x7b9f('0x19')][_0x7b9f('0x1d')]||null:null,'include':_0x10e57d[_0x7b9f('0x19')]?_0x10e57d[_0x7b9f('0x19')][_0x7b9f('0x1e')]?_['map'](_0x10e57d[_0x7b9f('0x19')][_0x7b9f('0x1e')],function(_0x192865){return{'model':db[_0x192865['model']],'as':_0x192865['as'],'attributes':_0x192865[_0x7b9f('0x1c')],'include':_0x192865[_0x7b9f('0x1e')]?_[_0x7b9f('0x1f')](_0x192865[_0x7b9f('0x1e')],function(_0x372225){return{'model':db[_0x372225[_0x7b9f('0x20')]],'as':_0x372225['as'],'attributes':_0x372225[_0x7b9f('0x1c')],'include':_0x372225[_0x7b9f('0x1e')]?_[_0x7b9f('0x1f')](_0x372225[_0x7b9f('0x1e')],function(_0x3acffd){return{'model':db[_0x3acffd[_0x7b9f('0x20')]],'as':_0x3acffd['as'],'attributes':_0x3acffd[_0x7b9f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7b9f('0x21')](function(_0x3a32c9){logger[_0x7b9f('0xd')](_0x7b9f('0x22'),_0x10e57d);logger[_0x7b9f('0xf')](_0x7b9f('0x22'),_0x10e57d,JSON[_0x7b9f('0x23')](_0x3a32c9));_0x534621(_0x3a32c9);})[_0x7b9f('0x16')](function(_0x406b9b){logger[_0x7b9f('0x11')](_0x7b9f('0x22'),_0x406b9b[_0x7b9f('0x14')],_0x10e57d);_0x4e4cab(_0x45d92e['error'](0x1f4,_0x406b9b[_0x7b9f('0x14')]));});});};exports[_0x7b9f('0x24')]=function(_0x483187){var _0x2712d3=this;return new Promise(function(_0x5c2e3b,_0xeee567){return db['DeskAccount'][_0x7b9f('0x25')]({'raw':_0x483187['options']?_0x483187[_0x7b9f('0x19')][_0x7b9f('0x1a')]===undefined?!![]:![]:!![],'where':_0x483187[_0x7b9f('0x19')]?_0x483187['options'][_0x7b9f('0x1b')]||null:null,'attributes':_0x483187['options']?_0x483187[_0x7b9f('0x19')]['attributes']||null:null,'include':_0x483187[_0x7b9f('0x19')]?_0x483187[_0x7b9f('0x19')][_0x7b9f('0x1e')]?_[_0x7b9f('0x1f')](_0x483187[_0x7b9f('0x19')][_0x7b9f('0x1e')],function(_0x5516b6){return{'model':db[_0x5516b6[_0x7b9f('0x20')]],'as':_0x5516b6['as'],'attributes':_0x5516b6[_0x7b9f('0x1c')],'include':_0x5516b6[_0x7b9f('0x1e')]?_['map'](_0x5516b6['include'],function(_0x117679){return{'model':db[_0x117679[_0x7b9f('0x20')]],'as':_0x117679['as'],'attributes':_0x117679['attributes'],'include':_0x117679[_0x7b9f('0x1e')]?_[_0x7b9f('0x1f')](_0x117679[_0x7b9f('0x1e')],function(_0x1e3c90){return{'model':db[_0x1e3c90[_0x7b9f('0x20')]],'as':_0x1e3c90['as'],'attributes':_0x1e3c90[_0x7b9f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7b9f('0x21')](function(_0x44ea2f){logger[_0x7b9f('0xd')](_0x7b9f('0x24'),_0x483187);logger[_0x7b9f('0xf')](_0x7b9f('0x24'),_0x483187,JSON[_0x7b9f('0x23')](_0x44ea2f));_0x5c2e3b(_0x44ea2f);})['catch'](function(_0x377c6a){logger[_0x7b9f('0x11')](_0x7b9f('0x24'),_0x377c6a[_0x7b9f('0x14')],_0x483187);_0xeee567(_0x2712d3[_0x7b9f('0x11')](0x1f4,_0x377c6a[_0x7b9f('0x14')]));});});}; \ No newline at end of file +var _0x35cf=['find','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetDeskAccount','findAll','options','raw','limit','include','map','attributes','model','then','ShowDeskAccount','DeskAccount'];(function(_0x34c570,_0x3a95a6){var _0xae81e9=function(_0x6c142d){while(--_0x6c142d){_0x34c570['push'](_0x34c570['shift']());}};_0xae81e9(++_0x3a95a6);}(_0x35cf,0x122));var _0xf35c=function(_0x209e12,_0x2ce907){_0x209e12=_0x209e12-0x0;var _0x3f5b89=_0x35cf[_0x209e12];return _0x3f5b89;};'use strict';var _=require(_0xf35c('0x0'));var util=require(_0xf35c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf35c('0x2'));var fs=require('fs');var Redis=require(_0xf35c('0x3'));var db=require(_0xf35c('0x4'))['db'];var utils=require(_0xf35c('0x5'));var logger=require(_0xf35c('0x6'))('rpc');var config=require(_0xf35c('0x7'));var jayson=require(_0xf35c('0x8'));var client=jayson[_0xf35c('0x9')][_0xf35c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b570d,_0x2ccee3,_0x59d456){return new BPromise(function(_0x261a0b,_0x103a72){return client['request'](_0x3b570d,_0x59d456)['then'](function(_0x30c5e8){logger[_0xf35c('0xb')](_0xf35c('0xc'),_0x2ccee3,'request\x20sent');logger[_0xf35c('0xd')](_0xf35c('0xe'),_0x2ccee3,'request\x20sent',JSON[_0xf35c('0xf')](_0x30c5e8));if(_0x30c5e8[_0xf35c('0x10')]){if(_0x30c5e8[_0xf35c('0x10')][_0xf35c('0x11')]===0x1f4){logger[_0xf35c('0x10')]('DeskAccount,\x20%s,\x20%s',_0x2ccee3,_0x30c5e8[_0xf35c('0x10')]['message']);return _0x103a72(_0x30c5e8[_0xf35c('0x10')][_0xf35c('0x12')]);}logger[_0xf35c('0x10')](_0xf35c('0xc'),_0x2ccee3,_0x30c5e8[_0xf35c('0x10')][_0xf35c('0x12')]);return _0x261a0b(_0x30c5e8[_0xf35c('0x10')][_0xf35c('0x12')]);}else{logger[_0xf35c('0xb')]('DeskAccount,\x20%s,\x20%s',_0x2ccee3,_0xf35c('0x13'));_0x261a0b(_0x30c5e8[_0xf35c('0x14')][_0xf35c('0x12')]);}})[_0xf35c('0x15')](function(_0x21413b){logger[_0xf35c('0x10')](_0xf35c('0xc'),_0x2ccee3,_0x21413b);_0x103a72(_0x21413b);});});}exports[_0xf35c('0x16')]=function(_0x339207){var _0x2ad04f=this;return new Promise(function(_0x5afcfe,_0x10ccdd){return db['DeskAccount'][_0xf35c('0x17')]({'raw':_0x339207[_0xf35c('0x18')]?_0x339207[_0xf35c('0x18')][_0xf35c('0x19')]===undefined?!![]:![]:!![],'where':_0x339207[_0xf35c('0x18')]?_0x339207[_0xf35c('0x18')]['where']||null:null,'attributes':_0x339207[_0xf35c('0x18')]?_0x339207['options']['attributes']||null:null,'limit':_0x339207[_0xf35c('0x18')]?_0x339207[_0xf35c('0x18')][_0xf35c('0x1a')]||null:null,'include':_0x339207[_0xf35c('0x18')]?_0x339207['options'][_0xf35c('0x1b')]?_[_0xf35c('0x1c')](_0x339207[_0xf35c('0x18')]['include'],function(_0x315c68){return{'model':db[_0x315c68['model']],'as':_0x315c68['as'],'attributes':_0x315c68[_0xf35c('0x1d')],'include':_0x315c68[_0xf35c('0x1b')]?_[_0xf35c('0x1c')](_0x315c68[_0xf35c('0x1b')],function(_0x2c23f3){return{'model':db[_0x2c23f3[_0xf35c('0x1e')]],'as':_0x2c23f3['as'],'attributes':_0x2c23f3[_0xf35c('0x1d')],'include':_0x2c23f3[_0xf35c('0x1b')]?_[_0xf35c('0x1c')](_0x2c23f3['include'],function(_0x39fe7b){return{'model':db[_0x39fe7b['model']],'as':_0x39fe7b['as'],'attributes':_0x39fe7b[_0xf35c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf35c('0x1f')](function(_0x277298){logger['info'](_0xf35c('0x16'),_0x339207);logger[_0xf35c('0xd')](_0xf35c('0x16'),_0x339207,JSON[_0xf35c('0xf')](_0x277298));_0x5afcfe(_0x277298);})[_0xf35c('0x15')](function(_0x41f6ea){logger[_0xf35c('0x10')](_0xf35c('0x16'),_0x41f6ea[_0xf35c('0x12')],_0x339207);_0x10ccdd(_0x2ad04f[_0xf35c('0x10')](0x1f4,_0x41f6ea[_0xf35c('0x12')]));});});};exports[_0xf35c('0x20')]=function(_0x29bd52){var _0x2efa58=this;return new Promise(function(_0x42b0df,_0x133bc4){return db[_0xf35c('0x21')][_0xf35c('0x22')]({'raw':_0x29bd52['options']?_0x29bd52[_0xf35c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x29bd52[_0xf35c('0x18')]?_0x29bd52[_0xf35c('0x18')][_0xf35c('0x23')]||null:null,'attributes':_0x29bd52[_0xf35c('0x18')]?_0x29bd52[_0xf35c('0x18')]['attributes']||null:null,'include':_0x29bd52[_0xf35c('0x18')]?_0x29bd52[_0xf35c('0x18')][_0xf35c('0x1b')]?_[_0xf35c('0x1c')](_0x29bd52[_0xf35c('0x18')][_0xf35c('0x1b')],function(_0x50f47f){return{'model':db[_0x50f47f['model']],'as':_0x50f47f['as'],'attributes':_0x50f47f[_0xf35c('0x1d')],'include':_0x50f47f[_0xf35c('0x1b')]?_['map'](_0x50f47f[_0xf35c('0x1b')],function(_0x16cebe){return{'model':db[_0x16cebe[_0xf35c('0x1e')]],'as':_0x16cebe['as'],'attributes':_0x16cebe[_0xf35c('0x1d')],'include':_0x16cebe['include']?_['map'](_0x16cebe[_0xf35c('0x1b')],function(_0xaff12d){return{'model':db[_0xaff12d[_0xf35c('0x1e')]],'as':_0xaff12d['as'],'attributes':_0xaff12d[_0xf35c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf35c('0x1f')](function(_0x4b4d41){logger['info'](_0xf35c('0x20'),_0x29bd52);logger[_0xf35c('0xd')]('ShowDeskAccount',_0x29bd52,JSON[_0xf35c('0xf')](_0x4b4d41));_0x42b0df(_0x4b4d41);})[_0xf35c('0x15')](function(_0x445b1c){logger[_0xf35c('0x10')](_0xf35c('0x20'),_0x445b1c[_0xf35c('0x12')],_0x29bd52);_0x133bc4(_0x2efa58['error'](0x1f4,_0x445b1c[_0xf35c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 9b68e28..361b6cb 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(_0x4fd75e,_0x219e4a){var _0x5b6338=function(_0xf2969c){while(--_0xf2969c){_0x4fd75e['push'](_0x4fd75e['shift']());}};_0x5b6338(++_0x219e4a);}(_0x55ca,0x126));var _0xa55c=function(_0x506aef,_0xb1161c){_0x506aef=_0x506aef-0x0;var _0x579eea=_0x55ca[_0x506aef];return _0x579eea;};'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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2135d3,_0x152021){var _0x4d18c8=function(_0x17a8d3){while(--_0x17a8d3){_0x2135d3['push'](_0x2135d3['shift']());}};_0x4d18c8(++_0x152021);}(_0x34e8,0x12c));var _0x834e=function(_0x233399,_0x39e146){_0x233399=_0x233399-0x0;var _0x1da82a=_0x34e8[_0x233399];return _0x1da82a;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 0c517fa..0bd43f2 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 _0x5f26=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f26,0x1f0));var _0x65f2=function(_0x116c04,_0x4963da){_0x116c04=_0x116c04-0x0;var _0x9e011d=_0x5f26[_0x116c04];return _0x9e011d;};'use strict';var Sequelize=require(_0x65f2('0x0'));module[_0x65f2('0x1')]={'name':{'type':Sequelize[_0x65f2('0x2')]},'description':{'type':Sequelize[_0x65f2('0x2')]}}; \ No newline at end of file +var _0x2f72=['exports','STRING','sequelize'];(function(_0x25fd78,_0x122c90){var _0x1200f2=function(_0x24d056){while(--_0x24d056){_0x25fd78['push'](_0x25fd78['shift']());}};_0x1200f2(++_0x122c90);}(_0x2f72,0x80));var _0x22f7=function(_0x55494a,_0x1c2701){_0x55494a=_0x55494a-0x0;var _0x2f38ee=_0x2f72[_0x55494a];return _0x2f38ee;};'use strict';var Sequelize=require(_0x22f7('0x0'));module[_0x22f7('0x1')]={'name':{'type':Sequelize[_0x22f7('0x2')]},'description':{'type':Sequelize[_0x22f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 6dcc333..cc15ea7 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 _0x8a22=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','save','update','then','destroy','error','name','send','index','DeskConfiguration','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','include','findAll','catch','show','params','rawAttributes','keys','length','includeAll','find','create','body','findOne','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0x8a22,0x93));var _0x28a2=function(_0x5897a2,_0x3f5620){_0x5897a2=_0x5897a2-0x0;var _0x9a56b5=_0x8a22[_0x5897a2];return _0x9a56b5;};'use strict';var emlformat=require(_0x28a2('0x0'));var rimraf=require(_0x28a2('0x1'));var zipdir=require(_0x28a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28a2('0x3'));var moment=require(_0x28a2('0x4'));var BPromise=require(_0x28a2('0x5'));var Mustache=require(_0x28a2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x28a2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28a2('0x8'));var _=require(_0x28a2('0x9'));var squel=require(_0x28a2('0xa'));var crypto=require(_0x28a2('0xb'));var jsforce=require(_0x28a2('0xc'));var deskjs=require(_0x28a2('0xd'));var toCsv=require(_0x28a2('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x28a2('0xf'));var authService=require(_0x28a2('0x10'));var qs=require(_0x28a2('0x11'));var as=require(_0x28a2('0x12'));var hardwareService=require(_0x28a2('0x13'));var logger=require(_0x28a2('0x14'))(_0x28a2('0x15'));var utils=require(_0x28a2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x28a2('0x17'));var db=require(_0x28a2('0x18'))['db'];function respondWithStatusCode(_0x309d6d,_0x2fcdd5){_0x2fcdd5=_0x2fcdd5||0xcc;return function(_0x61466a){if(_0x61466a){return _0x309d6d[_0x28a2('0x19')](_0x2fcdd5);}return _0x309d6d['status'](_0x2fcdd5)[_0x28a2('0x1a')]();};}function respondWithResult(_0x536d64,_0x1cbfc5){_0x1cbfc5=_0x1cbfc5||0xc8;return function(_0x1e3aac){if(_0x1e3aac){return _0x536d64[_0x28a2('0x1b')](_0x1cbfc5)['json'](_0x1e3aac);}};}function respondWithFilteredResult(_0x345b47,_0x12f877){return function(_0x2f797b){if(_0x2f797b){var _0x4b5f2c=typeof _0x12f877[_0x28a2('0x1c')]===_0x28a2('0x1d')&&typeof _0x12f877[_0x28a2('0x1e')]===_0x28a2('0x1d');var _0x35c3b9=_0x2f797b['count'];var _0x44f110=_0x4b5f2c?0x0:_0x12f877[_0x28a2('0x1c')];var _0xd821e5=_0x4b5f2c?_0x2f797b['count']:_0x12f877[_0x28a2('0x1c')]+_0x12f877[_0x28a2('0x1e')];var _0xfb0ae8;if(_0xd821e5>=_0x35c3b9){_0xd821e5=_0x35c3b9;_0xfb0ae8=0xc8;}else{_0xfb0ae8=0xce;}_0x345b47['status'](_0xfb0ae8);return _0x345b47[_0x28a2('0x1f')](_0x28a2('0x20'),_0x44f110+'-'+_0xd821e5+'/'+_0x35c3b9)['json'](_0x2f797b);}return null;};}function patchUpdates(_0x184ca0){return function(_0x51c365){try{jsonpatch['apply'](_0x51c365,_0x184ca0,!![]);}catch(_0x4a1933){return BPromise['reject'](_0x4a1933);}return _0x51c365[_0x28a2('0x21')]();};}function saveUpdates(_0x4c97e3,_0x5f1cbf){return function(_0x51fee3){if(_0x51fee3){return _0x51fee3[_0x28a2('0x22')](_0x4c97e3)[_0x28a2('0x23')](function(_0x165207){return _0x165207;});}return null;};}function removeEntity(_0x1aefca,_0x4d1380){return function(_0x2916f2){if(_0x2916f2){return _0x2916f2[_0x28a2('0x24')]()[_0x28a2('0x23')](function(){_0x1aefca[_0x28a2('0x1b')](0xcc)[_0x28a2('0x1a')]();});}};}function handleEntityNotFound(_0x5a9709,_0x53415e){return function(_0xdac451){if(!_0xdac451){_0x5a9709[_0x28a2('0x19')](0x194);}return _0xdac451;};}function handleError(_0x541e29,_0x3c2be0){_0x3c2be0=_0x3c2be0||0x1f4;return function(_0x4c01ae){logger[_0x28a2('0x25')](_0x4c01ae['stack']);if(_0x4c01ae[_0x28a2('0x26')]){delete _0x4c01ae['name'];}_0x541e29[_0x28a2('0x1b')](_0x3c2be0)[_0x28a2('0x27')](_0x4c01ae);};}exports[_0x28a2('0x28')]=function(_0x282529,_0x41c41f){var _0x199ace={},_0x13e8b0={},_0x4042f2={'count':0x0,'rows':[]};var _0xdbb19=_['map'](db[_0x28a2('0x29')]['rawAttributes'],function(_0xf20076){return{'name':_0xf20076['fieldName'],'type':_0xf20076[_0x28a2('0x2a')][_0x28a2('0x2b')]};});_0x13e8b0[_0x28a2('0x2c')]=_[_0x28a2('0x2d')](_0xdbb19,_0x28a2('0x26'));_0x13e8b0[_0x28a2('0x2e')]=_['keys'](_0x282529[_0x28a2('0x2e')]);_0x13e8b0[_0x28a2('0x2f')]=_[_0x28a2('0x30')](_0x13e8b0[_0x28a2('0x2c')],_0x13e8b0[_0x28a2('0x2e')]);_0x199ace[_0x28a2('0x31')]=_['intersection'](_0x13e8b0[_0x28a2('0x2c')],qs[_0x28a2('0x32')](_0x282529[_0x28a2('0x2e')]['fields']));_0x199ace['attributes']=_0x199ace['attributes']['length']?_0x199ace[_0x28a2('0x31')]:_0x13e8b0[_0x28a2('0x2c')];if(!_0x282529[_0x28a2('0x2e')][_0x28a2('0x33')](_0x28a2('0x34'))){_0x199ace['limit']=qs[_0x28a2('0x1e')](_0x282529['query'][_0x28a2('0x1e')]);_0x199ace[_0x28a2('0x1c')]=qs[_0x28a2('0x1c')](_0x282529[_0x28a2('0x2e')][_0x28a2('0x1c')]);}_0x199ace[_0x28a2('0x35')]=qs['sort'](_0x282529['query'][_0x28a2('0x36')]);_0x199ace['where']=qs[_0x28a2('0x2f')](_[_0x28a2('0x37')](_0x282529['query'],_0x13e8b0[_0x28a2('0x2f')]),_0xdbb19);if(_0x282529['query']['filter']){_0x199ace[_0x28a2('0x38')]=_[_0x28a2('0x39')](_0x199ace['where'],{'$or':_[_0x28a2('0x2d')](_0xdbb19,function(_0x159c5e){if(_0x159c5e['type']!==_0x28a2('0x3a')){var _0xb63565={};_0xb63565[_0x159c5e['name']]={'$like':'%'+_0x282529['query'][_0x28a2('0x3b')]+'%'};return _0xb63565;}})});}_0x199ace=_['merge']({},_0x199ace,_0x282529[_0x28a2('0x3c')]);var _0x3bd83c={'where':_0x199ace[_0x28a2('0x38')]};return db[_0x28a2('0x29')][_0x28a2('0x3d')](_0x3bd83c)['then'](function(_0x540c97){_0x4042f2[_0x28a2('0x3d')]=_0x540c97;if(_0x282529['query']['includeAll']){_0x199ace[_0x28a2('0x3e')]=[{'all':!![]}];}return db[_0x28a2('0x29')][_0x28a2('0x3f')](_0x199ace);})['then'](function(_0x3a694b){_0x4042f2['rows']=_0x3a694b;return _0x4042f2;})[_0x28a2('0x23')](respondWithFilteredResult(_0x41c41f,_0x199ace))[_0x28a2('0x40')](handleError(_0x41c41f,null));};exports[_0x28a2('0x41')]=function(_0x4a5ca5,_0x3d3cd9){var _0x145eda={'raw':![],'where':{'id':_0x4a5ca5[_0x28a2('0x42')]['id']}},_0x3d98cc={};_0x3d98cc['model']=_['keys'](db[_0x28a2('0x29')][_0x28a2('0x43')]);_0x3d98cc[_0x28a2('0x2e')]=_[_0x28a2('0x44')](_0x4a5ca5[_0x28a2('0x2e')]);_0x3d98cc['filters']=_[_0x28a2('0x30')](_0x3d98cc[_0x28a2('0x2c')],_0x3d98cc['query']);_0x145eda['attributes']=_['intersection'](_0x3d98cc[_0x28a2('0x2c')],qs[_0x28a2('0x32')](_0x4a5ca5[_0x28a2('0x2e')][_0x28a2('0x32')]));_0x145eda[_0x28a2('0x31')]=_0x145eda[_0x28a2('0x31')][_0x28a2('0x45')]?_0x145eda[_0x28a2('0x31')]:_0x3d98cc[_0x28a2('0x2c')];if(_0x4a5ca5[_0x28a2('0x2e')][_0x28a2('0x46')]){_0x145eda['include']=[{'all':!![]}];}_0x145eda=_['merge']({},_0x145eda,_0x4a5ca5['options']);return db[_0x28a2('0x29')][_0x28a2('0x47')](_0x145eda)[_0x28a2('0x23')](handleEntityNotFound(_0x3d3cd9,null))[_0x28a2('0x23')](respondWithResult(_0x3d3cd9,null))[_0x28a2('0x40')](handleError(_0x3d3cd9,null));};exports[_0x28a2('0x48')]=function(_0x40cdef,_0x4e7838){return db[_0x28a2('0x29')][_0x28a2('0x48')](_0x40cdef['body'],{})['then'](respondWithResult(_0x4e7838,0xc9))[_0x28a2('0x40')](handleError(_0x4e7838,null));};exports[_0x28a2('0x22')]=function(_0x2851d0,_0x1fc390){if(_0x2851d0[_0x28a2('0x49')]['id']){delete _0x2851d0[_0x28a2('0x49')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x2851d0[_0x28a2('0x42')]['id']}})[_0x28a2('0x23')](handleEntityNotFound(_0x1fc390,null))[_0x28a2('0x23')](saveUpdates(_0x2851d0[_0x28a2('0x49')],null))['then'](respondWithResult(_0x1fc390,null))[_0x28a2('0x40')](handleError(_0x1fc390,null));};exports['destroy']=function(_0x4f399b,_0x4d4e40){return db['DeskConfiguration']['find']({'where':{'id':_0x4f399b[_0x28a2('0x42')]['id']}})[_0x28a2('0x23')](handleEntityNotFound(_0x4d4e40,null))[_0x28a2('0x23')](removeEntity(_0x4d4e40,null))[_0x28a2('0x40')](handleError(_0x4d4e40,null));};exports['getFields']=function(_0x45fa69,_0xe84508,_0x154768){var _0x46ca23={};var _0x7ac7b6={};var _0x766447;var _0x1f068c;return db[_0x28a2('0x29')][_0x28a2('0x4a')]({'where':{'id':_0x45fa69[_0x28a2('0x42')]['id']}})[_0x28a2('0x23')](handleEntityNotFound(_0xe84508,null))[_0x28a2('0x23')](function(_0x2ecc13){if(_0x2ecc13){_0x766447=_0x2ecc13;_0x7ac7b6['model']=_['keys'](db[_0x28a2('0x4b')]['rawAttributes']);_0x7ac7b6[_0x28a2('0x2e')]=_[_0x28a2('0x44')](_0x45fa69[_0x28a2('0x2e')]);_0x7ac7b6[_0x28a2('0x2f')]=_['intersection'](_0x7ac7b6[_0x28a2('0x2c')],_0x7ac7b6['query']);_0x46ca23[_0x28a2('0x31')]=_['intersection'](_0x7ac7b6[_0x28a2('0x2c')],qs[_0x28a2('0x32')](_0x45fa69[_0x28a2('0x2e')][_0x28a2('0x32')]));_0x46ca23[_0x28a2('0x31')]=_0x46ca23[_0x28a2('0x31')][_0x28a2('0x45')]?_0x46ca23['attributes']:_0x7ac7b6[_0x28a2('0x2c')];_0x46ca23['order']=qs[_0x28a2('0x36')](_0x45fa69['query'][_0x28a2('0x36')]);_0x46ca23['where']=qs[_0x28a2('0x2f')](_[_0x28a2('0x37')](_0x45fa69['query'],_0x7ac7b6[_0x28a2('0x2f')]));if(_0x45fa69[_0x28a2('0x2e')]['filter']){_0x46ca23[_0x28a2('0x38')]=_['merge'](_0x46ca23[_0x28a2('0x38')],{'$or':_[_0x28a2('0x2d')](_0x46ca23[_0x28a2('0x31')],function(_0x2ed875){var _0x27a4fa={};_0x27a4fa[_0x2ed875]={'$like':'%'+_0x45fa69[_0x28a2('0x2e')][_0x28a2('0x3b')]+'%'};return _0x27a4fa;})});}_0x46ca23=_[_0x28a2('0x39')]({},_0x46ca23,_0x45fa69[_0x28a2('0x3c')]);return _0x766447['getFields'](_0x46ca23);}})[_0x28a2('0x23')](function(_0xb5d7b2){if(_0xb5d7b2){_0x1f068c=_0xb5d7b2[_0x28a2('0x45')];if(!_0x45fa69[_0x28a2('0x2e')][_0x28a2('0x33')](_0x28a2('0x34'))){_0x46ca23[_0x28a2('0x1e')]=qs[_0x28a2('0x1e')](_0x45fa69['query'][_0x28a2('0x1e')]);_0x46ca23[_0x28a2('0x1c')]=qs['offset'](_0x45fa69[_0x28a2('0x2e')][_0x28a2('0x1c')]);}return _0x766447['getFields'](_0x46ca23);}})['then'](function(_0x114fc5){if(_0x114fc5){return _0x114fc5?{'count':_0x1f068c,'rows':_0x114fc5}:null;}})['then'](respondWithResult(_0xe84508,null))[_0x28a2('0x40')](handleError(_0xe84508,null));};exports[_0x28a2('0x4c')]=function(_0x3a2fbc,_0x454f1a,_0x445715){var _0x24b37e={};var _0x591a28={};var _0x46af72;var _0x536913;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3a2fbc[_0x28a2('0x42')]['id']}})['then'](handleEntityNotFound(_0x454f1a,null))[_0x28a2('0x23')](function(_0x476210){if(_0x476210){_0x46af72=_0x476210;_0x591a28[_0x28a2('0x2c')]=_[_0x28a2('0x44')](db[_0x28a2('0x4b')][_0x28a2('0x43')]);_0x591a28[_0x28a2('0x2e')]=_[_0x28a2('0x44')](_0x3a2fbc['query']);_0x591a28['filters']=_[_0x28a2('0x30')](_0x591a28[_0x28a2('0x2c')],_0x591a28['query']);_0x24b37e[_0x28a2('0x31')]=_[_0x28a2('0x30')](_0x591a28[_0x28a2('0x2c')],qs[_0x28a2('0x32')](_0x3a2fbc[_0x28a2('0x2e')][_0x28a2('0x32')]));_0x24b37e[_0x28a2('0x31')]=_0x24b37e[_0x28a2('0x31')][_0x28a2('0x45')]?_0x24b37e[_0x28a2('0x31')]:_0x591a28[_0x28a2('0x2c')];_0x24b37e[_0x28a2('0x35')]=qs[_0x28a2('0x36')](_0x3a2fbc['query'][_0x28a2('0x36')]);_0x24b37e[_0x28a2('0x38')]=qs[_0x28a2('0x2f')](_['pick'](_0x3a2fbc[_0x28a2('0x2e')],_0x591a28['filters']));if(_0x3a2fbc[_0x28a2('0x2e')]['filter']){_0x24b37e[_0x28a2('0x38')]=_[_0x28a2('0x39')](_0x24b37e['where'],{'$or':_[_0x28a2('0x2d')](_0x24b37e[_0x28a2('0x31')],function(_0x1e5bd4){var _0x4c4171={};_0x4c4171[_0x1e5bd4]={'$like':'%'+_0x3a2fbc[_0x28a2('0x2e')][_0x28a2('0x3b')]+'%'};return _0x4c4171;})});}_0x24b37e=_[_0x28a2('0x39')]({},_0x24b37e,_0x3a2fbc[_0x28a2('0x3c')]);return _0x46af72[_0x28a2('0x4c')](_0x24b37e);}})[_0x28a2('0x23')](function(_0x43db94){if(_0x43db94){_0x536913=_0x43db94[_0x28a2('0x45')];if(!_0x3a2fbc[_0x28a2('0x2e')][_0x28a2('0x33')](_0x28a2('0x34'))){_0x24b37e['limit']=qs[_0x28a2('0x1e')](_0x3a2fbc[_0x28a2('0x2e')][_0x28a2('0x1e')]);_0x24b37e[_0x28a2('0x1c')]=qs['offset'](_0x3a2fbc[_0x28a2('0x2e')]['offset']);}return _0x46af72[_0x28a2('0x4c')](_0x24b37e);}})[_0x28a2('0x23')](function(_0xdd4d25){if(_0xdd4d25){return _0xdd4d25?{'count':_0x536913,'rows':_0xdd4d25}:null;}})[_0x28a2('0x23')](respondWithResult(_0x454f1a,null))['catch'](handleError(_0x454f1a,null));};exports['getDescriptions']=function(_0xe75a79,_0x3633c8,_0x33d8dd){var _0x1356a4={};var _0x14c179={};var _0x4eaba8;var _0x31463c;return db[_0x28a2('0x29')][_0x28a2('0x4a')]({'where':{'id':_0xe75a79[_0x28a2('0x42')]['id']}})['then'](handleEntityNotFound(_0x3633c8,null))[_0x28a2('0x23')](function(_0x50850f){if(_0x50850f){_0x4eaba8=_0x50850f;_0x14c179[_0x28a2('0x2c')]=_[_0x28a2('0x44')](db[_0x28a2('0x4b')]['rawAttributes']);_0x14c179[_0x28a2('0x2e')]=_[_0x28a2('0x44')](_0xe75a79[_0x28a2('0x2e')]);_0x14c179[_0x28a2('0x2f')]=_[_0x28a2('0x30')](_0x14c179[_0x28a2('0x2c')],_0x14c179[_0x28a2('0x2e')]);_0x1356a4[_0x28a2('0x31')]=_['intersection'](_0x14c179['model'],qs[_0x28a2('0x32')](_0xe75a79[_0x28a2('0x2e')]['fields']));_0x1356a4[_0x28a2('0x31')]=_0x1356a4['attributes'][_0x28a2('0x45')]?_0x1356a4[_0x28a2('0x31')]:_0x14c179[_0x28a2('0x2c')];_0x1356a4[_0x28a2('0x35')]=qs['sort'](_0xe75a79[_0x28a2('0x2e')][_0x28a2('0x36')]);_0x1356a4[_0x28a2('0x38')]=qs[_0x28a2('0x2f')](_[_0x28a2('0x37')](_0xe75a79['query'],_0x14c179[_0x28a2('0x2f')]));if(_0xe75a79[_0x28a2('0x2e')][_0x28a2('0x3b')]){_0x1356a4['where']=_[_0x28a2('0x39')](_0x1356a4['where'],{'$or':_[_0x28a2('0x2d')](_0x1356a4['attributes'],function(_0x528060){var _0xdf9c9d={};_0xdf9c9d[_0x528060]={'$like':'%'+_0xe75a79[_0x28a2('0x2e')]['filter']+'%'};return _0xdf9c9d;})});}_0x1356a4=_['merge']({},_0x1356a4,_0xe75a79[_0x28a2('0x3c')]);return _0x4eaba8['getDescriptions'](_0x1356a4);}})['then'](function(_0x3e6f2d){if(_0x3e6f2d){_0x31463c=_0x3e6f2d[_0x28a2('0x45')];if(!_0xe75a79['query'][_0x28a2('0x33')](_0x28a2('0x34'))){_0x1356a4['limit']=qs['limit'](_0xe75a79[_0x28a2('0x2e')][_0x28a2('0x1e')]);_0x1356a4[_0x28a2('0x1c')]=qs[_0x28a2('0x1c')](_0xe75a79[_0x28a2('0x2e')][_0x28a2('0x1c')]);}return _0x4eaba8[_0x28a2('0x4d')](_0x1356a4);}})[_0x28a2('0x23')](function(_0x310717){if(_0x310717){return _0x310717?{'count':_0x31463c,'rows':_0x310717}:null;}})[_0x28a2('0x23')](respondWithResult(_0x3633c8,null))[_0x28a2('0x40')](handleError(_0x3633c8,null));};exports['getTags']=function(_0x1dd620,_0x3c3b93,_0x4f1315){var _0x5e4716={};var _0xf94b8={};var _0x41dd3f;var _0x2f04cf;return db[_0x28a2('0x29')][_0x28a2('0x4a')]({'where':{'id':_0x1dd620[_0x28a2('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c3b93,null))['then'](function(_0x1d2053){if(_0x1d2053){_0x41dd3f=_0x1d2053;_0xf94b8['model']=_[_0x28a2('0x44')](db[_0x28a2('0x4e')]['rawAttributes']);_0xf94b8['query']=_[_0x28a2('0x44')](_0x1dd620[_0x28a2('0x2e')]);_0xf94b8[_0x28a2('0x2f')]=_[_0x28a2('0x30')](_0xf94b8[_0x28a2('0x2c')],_0xf94b8[_0x28a2('0x2e')]);_0x5e4716[_0x28a2('0x31')]=_[_0x28a2('0x30')](_0xf94b8[_0x28a2('0x2c')],qs[_0x28a2('0x32')](_0x1dd620[_0x28a2('0x2e')]['fields']));_0x5e4716[_0x28a2('0x31')]=_0x5e4716[_0x28a2('0x31')][_0x28a2('0x45')]?_0x5e4716[_0x28a2('0x31')]:_0xf94b8[_0x28a2('0x2c')];_0x5e4716[_0x28a2('0x35')]=qs[_0x28a2('0x36')](_0x1dd620['query'][_0x28a2('0x36')]);_0x5e4716[_0x28a2('0x38')]=qs[_0x28a2('0x2f')](_[_0x28a2('0x37')](_0x1dd620[_0x28a2('0x2e')],_0xf94b8[_0x28a2('0x2f')]));if(_0x1dd620[_0x28a2('0x2e')][_0x28a2('0x3b')]){_0x5e4716[_0x28a2('0x38')]=_[_0x28a2('0x39')](_0x5e4716[_0x28a2('0x38')],{'$or':_[_0x28a2('0x2d')](_0x5e4716[_0x28a2('0x31')],function(_0x30f9f2){var _0x5ecde7={};_0x5ecde7[_0x30f9f2]={'$like':'%'+_0x1dd620[_0x28a2('0x2e')]['filter']+'%'};return _0x5ecde7;})});}_0x5e4716=_['merge']({},_0x5e4716,_0x1dd620[_0x28a2('0x3c')]);return _0x41dd3f[_0x28a2('0x4f')](_0x5e4716);}})['then'](function(_0x5070f7){if(_0x5070f7){_0x2f04cf=_0x5070f7['length'];if(!_0x1dd620[_0x28a2('0x2e')][_0x28a2('0x33')](_0x28a2('0x34'))){_0x5e4716[_0x28a2('0x1e')]=qs[_0x28a2('0x1e')](_0x1dd620['query'][_0x28a2('0x1e')]);_0x5e4716[_0x28a2('0x1c')]=qs[_0x28a2('0x1c')](_0x1dd620[_0x28a2('0x2e')][_0x28a2('0x1c')]);}return _0x41dd3f[_0x28a2('0x4f')](_0x5e4716);}})[_0x28a2('0x23')](function(_0x5aba55){if(_0x5aba55){return _0x5aba55?{'count':_0x2f04cf,'rows':_0x5aba55}:null;}})[_0x28a2('0x23')](respondWithResult(_0x3c3b93,null))[_0x28a2('0x40')](handleError(_0x3c3b93,null));};exports[_0x28a2('0x50')]=function(_0x5ad00c,_0x428e4f,_0x59d60a){if(_0x5ad00c['body']['id']){delete _0x5ad00c[_0x28a2('0x49')]['id'];}return db[_0x28a2('0x29')][_0x28a2('0x4a')]({'where':{'id':_0x5ad00c[_0x28a2('0x42')]['id']}})[_0x28a2('0x23')](handleEntityNotFound(_0x428e4f,null))[_0x28a2('0x23')](function(_0x212ce2){if(_0x212ce2){return _0x212ce2[_0x28a2('0x50')](_0x5ad00c[_0x28a2('0x49')][_0x28a2('0x51')]||[]);}return null;})[_0x28a2('0x23')](respondWithResult(_0x428e4f,null))[_0x28a2('0x40')](handleError(_0x428e4f,null));}; \ No newline at end of file +var _0xc79e=['offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','DeskConfiguration','findAll','catch','show','params','includeAll','include','find','body','getFields','findOne','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0xbf55e0,_0x4d0a2a){var _0x43f51b=function(_0x93e352){while(--_0x93e352){_0xbf55e0['push'](_0xbf55e0['shift']());}};_0x43f51b(++_0x4d0a2a);}(_0xc79e,0x7e));var _0xec79=function(_0x10a2ea,_0x487cf2){_0x10a2ea=_0x10a2ea-0x0;var _0x347b66=_0xc79e[_0x10a2ea];return _0x347b66;};'use strict';var emlformat=require(_0xec79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec79('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec79('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec79('0x3'));var util=require(_0xec79('0x4'));var path=require(_0xec79('0x5'));var sox=require(_0xec79('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec79('0x7'));var _=require(_0xec79('0x8'));var squel=require(_0xec79('0x9'));var crypto=require(_0xec79('0xa'));var jsforce=require(_0xec79('0xb'));var deskjs=require(_0xec79('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xec79('0xd'));var Redis=require('ioredis');var authService=require(_0xec79('0xe'));var qs=require(_0xec79('0xf'));var as=require(_0xec79('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec79('0x11'))(_0xec79('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xec79('0x13'));var db=require(_0xec79('0x14'))['db'];function respondWithStatusCode(_0x56cc9a,_0xc76b6e){_0xc76b6e=_0xc76b6e||0xcc;return function(_0x1ba3ed){if(_0x1ba3ed){return _0x56cc9a[_0xec79('0x15')](_0xc76b6e);}return _0x56cc9a[_0xec79('0x16')](_0xc76b6e)['end']();};}function respondWithResult(_0x1d4150,_0x6e8660){_0x6e8660=_0x6e8660||0xc8;return function(_0x427141){if(_0x427141){return _0x1d4150[_0xec79('0x16')](_0x6e8660)[_0xec79('0x17')](_0x427141);}};}function respondWithFilteredResult(_0x3a3196,_0x31d6a1){return function(_0x58211d){if(_0x58211d){var _0x4eed3e=typeof _0x31d6a1[_0xec79('0x18')]==='undefined'&&typeof _0x31d6a1[_0xec79('0x19')]==='undefined';var _0x1c7a7b=_0x58211d['count'];var _0x19569c=_0x4eed3e?0x0:_0x31d6a1[_0xec79('0x18')];var _0x3f8d72=_0x4eed3e?_0x58211d[_0xec79('0x1a')]:_0x31d6a1[_0xec79('0x18')]+_0x31d6a1[_0xec79('0x19')];var _0x30cc0c;if(_0x3f8d72>=_0x1c7a7b){_0x3f8d72=_0x1c7a7b;_0x30cc0c=0xc8;}else{_0x30cc0c=0xce;}_0x3a3196[_0xec79('0x16')](_0x30cc0c);return _0x3a3196[_0xec79('0x1b')](_0xec79('0x1c'),_0x19569c+'-'+_0x3f8d72+'/'+_0x1c7a7b)['json'](_0x58211d);}return null;};}function patchUpdates(_0x52376d){return function(_0xdb33dd){try{jsonpatch[_0xec79('0x1d')](_0xdb33dd,_0x52376d,!![]);}catch(_0x3d9775){return BPromise[_0xec79('0x1e')](_0x3d9775);}return _0xdb33dd[_0xec79('0x1f')]();};}function saveUpdates(_0xe598dd,_0x32f27c){return function(_0x58e046){if(_0x58e046){return _0x58e046['update'](_0xe598dd)[_0xec79('0x20')](function(_0x32f9d7){return _0x32f9d7;});}return null;};}function removeEntity(_0x210d2d,_0x5e6343){return function(_0x101590){if(_0x101590){return _0x101590[_0xec79('0x21')]()[_0xec79('0x20')](function(){_0x210d2d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa30cc0,_0x3c09fb){return function(_0xe03997){if(!_0xe03997){_0xa30cc0['sendStatus'](0x194);}return _0xe03997;};}function handleError(_0x2b08bb,_0x1b73aa){_0x1b73aa=_0x1b73aa||0x1f4;return function(_0x4a4080){logger['error'](_0x4a4080[_0xec79('0x22')]);if(_0x4a4080[_0xec79('0x23')]){delete _0x4a4080['name'];}_0x2b08bb[_0xec79('0x16')](_0x1b73aa)['send'](_0x4a4080);};}exports['index']=function(_0x8259a4,_0x4980b0){var _0x5f2d7a={},_0x5920f5={},_0x1318cc={'count':0x0,'rows':[]};var _0x260975=_[_0xec79('0x24')](db['DeskConfiguration'][_0xec79('0x25')],function(_0x30b2db){return{'name':_0x30b2db[_0xec79('0x26')],'type':_0x30b2db[_0xec79('0x27')]['key']};});_0x5920f5[_0xec79('0x28')]=_['map'](_0x260975,_0xec79('0x23'));_0x5920f5[_0xec79('0x29')]=_[_0xec79('0x2a')](_0x8259a4['query']);_0x5920f5[_0xec79('0x2b')]=_[_0xec79('0x2c')](_0x5920f5[_0xec79('0x28')],_0x5920f5[_0xec79('0x29')]);_0x5f2d7a[_0xec79('0x2d')]=_[_0xec79('0x2c')](_0x5920f5[_0xec79('0x28')],qs[_0xec79('0x2e')](_0x8259a4[_0xec79('0x29')]['fields']));_0x5f2d7a[_0xec79('0x2d')]=_0x5f2d7a[_0xec79('0x2d')][_0xec79('0x2f')]?_0x5f2d7a['attributes']:_0x5920f5['model'];if(!_0x8259a4[_0xec79('0x29')][_0xec79('0x30')](_0xec79('0x31'))){_0x5f2d7a[_0xec79('0x19')]=qs[_0xec79('0x19')](_0x8259a4['query'][_0xec79('0x19')]);_0x5f2d7a['offset']=qs[_0xec79('0x18')](_0x8259a4[_0xec79('0x29')][_0xec79('0x18')]);}_0x5f2d7a[_0xec79('0x32')]=qs['sort'](_0x8259a4['query'][_0xec79('0x33')]);_0x5f2d7a[_0xec79('0x34')]=qs[_0xec79('0x2b')](_[_0xec79('0x35')](_0x8259a4[_0xec79('0x29')],_0x5920f5[_0xec79('0x2b')]),_0x260975);if(_0x8259a4[_0xec79('0x29')]['filter']){_0x5f2d7a[_0xec79('0x34')]=_[_0xec79('0x36')](_0x5f2d7a[_0xec79('0x34')],{'$or':_[_0xec79('0x24')](_0x260975,function(_0x28de85){if(_0x28de85[_0xec79('0x27')]!==_0xec79('0x37')){var _0x592559={};_0x592559[_0x28de85[_0xec79('0x23')]]={'$like':'%'+_0x8259a4[_0xec79('0x29')][_0xec79('0x38')]+'%'};return _0x592559;}})});}_0x5f2d7a=_[_0xec79('0x36')]({},_0x5f2d7a,_0x8259a4[_0xec79('0x39')]);var _0x3861e0={'where':_0x5f2d7a[_0xec79('0x34')]};return db['DeskConfiguration'][_0xec79('0x1a')](_0x3861e0)[_0xec79('0x20')](function(_0x2cb8eb){_0x1318cc[_0xec79('0x1a')]=_0x2cb8eb;if(_0x8259a4['query']['includeAll']){_0x5f2d7a['include']=[{'all':!![]}];}return db[_0xec79('0x3a')][_0xec79('0x3b')](_0x5f2d7a);})[_0xec79('0x20')](function(_0x104387){_0x1318cc['rows']=_0x104387;return _0x1318cc;})['then'](respondWithFilteredResult(_0x4980b0,_0x5f2d7a))[_0xec79('0x3c')](handleError(_0x4980b0,null));};exports[_0xec79('0x3d')]=function(_0x236461,_0x410dbc){var _0xab602b={'raw':![],'where':{'id':_0x236461[_0xec79('0x3e')]['id']}},_0x247011={};_0x247011[_0xec79('0x28')]=_[_0xec79('0x2a')](db[_0xec79('0x3a')]['rawAttributes']);_0x247011[_0xec79('0x29')]=_[_0xec79('0x2a')](_0x236461[_0xec79('0x29')]);_0x247011[_0xec79('0x2b')]=_[_0xec79('0x2c')](_0x247011[_0xec79('0x28')],_0x247011['query']);_0xab602b[_0xec79('0x2d')]=_['intersection'](_0x247011[_0xec79('0x28')],qs[_0xec79('0x2e')](_0x236461['query'][_0xec79('0x2e')]));_0xab602b[_0xec79('0x2d')]=_0xab602b[_0xec79('0x2d')][_0xec79('0x2f')]?_0xab602b['attributes']:_0x247011[_0xec79('0x28')];if(_0x236461[_0xec79('0x29')][_0xec79('0x3f')]){_0xab602b[_0xec79('0x40')]=[{'all':!![]}];}_0xab602b=_[_0xec79('0x36')]({},_0xab602b,_0x236461[_0xec79('0x39')]);return db[_0xec79('0x3a')][_0xec79('0x41')](_0xab602b)[_0xec79('0x20')](handleEntityNotFound(_0x410dbc,null))[_0xec79('0x20')](respondWithResult(_0x410dbc,null))[_0xec79('0x3c')](handleError(_0x410dbc,null));};exports['create']=function(_0x1d8ce8,_0x1cf8bc){return db[_0xec79('0x3a')]['create'](_0x1d8ce8['body'],{})[_0xec79('0x20')](respondWithResult(_0x1cf8bc,0xc9))[_0xec79('0x3c')](handleError(_0x1cf8bc,null));};exports['update']=function(_0x5654e7,_0x41f151){if(_0x5654e7[_0xec79('0x42')]['id']){delete _0x5654e7[_0xec79('0x42')]['id'];}return db[_0xec79('0x3a')][_0xec79('0x41')]({'where':{'id':_0x5654e7[_0xec79('0x3e')]['id']}})[_0xec79('0x20')](handleEntityNotFound(_0x41f151,null))[_0xec79('0x20')](saveUpdates(_0x5654e7[_0xec79('0x42')],null))['then'](respondWithResult(_0x41f151,null))[_0xec79('0x3c')](handleError(_0x41f151,null));};exports[_0xec79('0x21')]=function(_0x167ee4,_0x57c28d){return db[_0xec79('0x3a')]['find']({'where':{'id':_0x167ee4[_0xec79('0x3e')]['id']}})[_0xec79('0x20')](handleEntityNotFound(_0x57c28d,null))[_0xec79('0x20')](removeEntity(_0x57c28d,null))[_0xec79('0x3c')](handleError(_0x57c28d,null));};exports[_0xec79('0x43')]=function(_0x577f54,_0x4c6c19,_0x292334){var _0x3cce05={};var _0x3ca848={};var _0x12ad01;var _0x398a0f;return db[_0xec79('0x3a')][_0xec79('0x44')]({'where':{'id':_0x577f54['params']['id']}})[_0xec79('0x20')](handleEntityNotFound(_0x4c6c19,null))[_0xec79('0x20')](function(_0x3b39e2){if(_0x3b39e2){_0x12ad01=_0x3b39e2;_0x3ca848[_0xec79('0x28')]=_['keys'](db['DeskField']['rawAttributes']);_0x3ca848[_0xec79('0x29')]=_[_0xec79('0x2a')](_0x577f54[_0xec79('0x29')]);_0x3ca848['filters']=_[_0xec79('0x2c')](_0x3ca848[_0xec79('0x28')],_0x3ca848[_0xec79('0x29')]);_0x3cce05[_0xec79('0x2d')]=_[_0xec79('0x2c')](_0x3ca848[_0xec79('0x28')],qs[_0xec79('0x2e')](_0x577f54[_0xec79('0x29')][_0xec79('0x2e')]));_0x3cce05[_0xec79('0x2d')]=_0x3cce05[_0xec79('0x2d')][_0xec79('0x2f')]?_0x3cce05['attributes']:_0x3ca848['model'];_0x3cce05['order']=qs[_0xec79('0x33')](_0x577f54[_0xec79('0x29')][_0xec79('0x33')]);_0x3cce05['where']=qs[_0xec79('0x2b')](_[_0xec79('0x35')](_0x577f54[_0xec79('0x29')],_0x3ca848[_0xec79('0x2b')]));if(_0x577f54['query'][_0xec79('0x38')]){_0x3cce05[_0xec79('0x34')]=_['merge'](_0x3cce05[_0xec79('0x34')],{'$or':_['map'](_0x3cce05[_0xec79('0x2d')],function(_0x3972ee){var _0x6989db={};_0x6989db[_0x3972ee]={'$like':'%'+_0x577f54['query'][_0xec79('0x38')]+'%'};return _0x6989db;})});}_0x3cce05=_[_0xec79('0x36')]({},_0x3cce05,_0x577f54[_0xec79('0x39')]);return _0x12ad01[_0xec79('0x43')](_0x3cce05);}})[_0xec79('0x20')](function(_0x58233c){if(_0x58233c){_0x398a0f=_0x58233c[_0xec79('0x2f')];if(!_0x577f54[_0xec79('0x29')][_0xec79('0x30')](_0xec79('0x31'))){_0x3cce05[_0xec79('0x19')]=qs[_0xec79('0x19')](_0x577f54[_0xec79('0x29')]['limit']);_0x3cce05[_0xec79('0x18')]=qs[_0xec79('0x18')](_0x577f54[_0xec79('0x29')]['offset']);}return _0x12ad01['getFields'](_0x3cce05);}})[_0xec79('0x20')](function(_0x404dfe){if(_0x404dfe){return _0x404dfe?{'count':_0x398a0f,'rows':_0x404dfe}:null;}})[_0xec79('0x20')](respondWithResult(_0x4c6c19,null))['catch'](handleError(_0x4c6c19,null));};exports[_0xec79('0x45')]=function(_0x521143,_0x1f0cb0,_0x5360ce){var _0x2e5173={};var _0x46351e={};var _0x2abebd;var _0x5bd308;return db['DeskConfiguration'][_0xec79('0x44')]({'where':{'id':_0x521143[_0xec79('0x3e')]['id']}})[_0xec79('0x20')](handleEntityNotFound(_0x1f0cb0,null))[_0xec79('0x20')](function(_0xe43b83){if(_0xe43b83){_0x2abebd=_0xe43b83;_0x46351e[_0xec79('0x28')]=_[_0xec79('0x2a')](db[_0xec79('0x46')][_0xec79('0x25')]);_0x46351e['query']=_[_0xec79('0x2a')](_0x521143[_0xec79('0x29')]);_0x46351e[_0xec79('0x2b')]=_[_0xec79('0x2c')](_0x46351e[_0xec79('0x28')],_0x46351e['query']);_0x2e5173[_0xec79('0x2d')]=_[_0xec79('0x2c')](_0x46351e[_0xec79('0x28')],qs[_0xec79('0x2e')](_0x521143[_0xec79('0x29')][_0xec79('0x2e')]));_0x2e5173[_0xec79('0x2d')]=_0x2e5173[_0xec79('0x2d')][_0xec79('0x2f')]?_0x2e5173[_0xec79('0x2d')]:_0x46351e[_0xec79('0x28')];_0x2e5173[_0xec79('0x32')]=qs[_0xec79('0x33')](_0x521143[_0xec79('0x29')][_0xec79('0x33')]);_0x2e5173['where']=qs['filters'](_[_0xec79('0x35')](_0x521143['query'],_0x46351e[_0xec79('0x2b')]));if(_0x521143['query'][_0xec79('0x38')]){_0x2e5173[_0xec79('0x34')]=_[_0xec79('0x36')](_0x2e5173[_0xec79('0x34')],{'$or':_[_0xec79('0x24')](_0x2e5173['attributes'],function(_0x5be919){var _0x5cf271={};_0x5cf271[_0x5be919]={'$like':'%'+_0x521143[_0xec79('0x29')][_0xec79('0x38')]+'%'};return _0x5cf271;})});}_0x2e5173=_[_0xec79('0x36')]({},_0x2e5173,_0x521143[_0xec79('0x39')]);return _0x2abebd[_0xec79('0x45')](_0x2e5173);}})[_0xec79('0x20')](function(_0x5b0167){if(_0x5b0167){_0x5bd308=_0x5b0167[_0xec79('0x2f')];if(!_0x521143[_0xec79('0x29')]['hasOwnProperty'](_0xec79('0x31'))){_0x2e5173[_0xec79('0x19')]=qs[_0xec79('0x19')](_0x521143[_0xec79('0x29')][_0xec79('0x19')]);_0x2e5173[_0xec79('0x18')]=qs[_0xec79('0x18')](_0x521143[_0xec79('0x29')]['offset']);}return _0x2abebd[_0xec79('0x45')](_0x2e5173);}})['then'](function(_0x4b667c){if(_0x4b667c){return _0x4b667c?{'count':_0x5bd308,'rows':_0x4b667c}:null;}})['then'](respondWithResult(_0x1f0cb0,null))[_0xec79('0x3c')](handleError(_0x1f0cb0,null));};exports[_0xec79('0x47')]=function(_0x1998c4,_0x5ed84c,_0x2c5ebf){var _0x4ef473={};var _0x3c3ee0={};var _0x47dff6;var _0x1c1dc5;return db[_0xec79('0x3a')]['findOne']({'where':{'id':_0x1998c4[_0xec79('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ed84c,null))[_0xec79('0x20')](function(_0x1fbabe){if(_0x1fbabe){_0x47dff6=_0x1fbabe;_0x3c3ee0[_0xec79('0x28')]=_[_0xec79('0x2a')](db[_0xec79('0x46')][_0xec79('0x25')]);_0x3c3ee0[_0xec79('0x29')]=_['keys'](_0x1998c4['query']);_0x3c3ee0[_0xec79('0x2b')]=_[_0xec79('0x2c')](_0x3c3ee0[_0xec79('0x28')],_0x3c3ee0[_0xec79('0x29')]);_0x4ef473['attributes']=_[_0xec79('0x2c')](_0x3c3ee0['model'],qs[_0xec79('0x2e')](_0x1998c4['query'][_0xec79('0x2e')]));_0x4ef473[_0xec79('0x2d')]=_0x4ef473['attributes'][_0xec79('0x2f')]?_0x4ef473[_0xec79('0x2d')]:_0x3c3ee0['model'];_0x4ef473['order']=qs[_0xec79('0x33')](_0x1998c4['query'][_0xec79('0x33')]);_0x4ef473[_0xec79('0x34')]=qs[_0xec79('0x2b')](_['pick'](_0x1998c4[_0xec79('0x29')],_0x3c3ee0[_0xec79('0x2b')]));if(_0x1998c4[_0xec79('0x29')][_0xec79('0x38')]){_0x4ef473[_0xec79('0x34')]=_[_0xec79('0x36')](_0x4ef473[_0xec79('0x34')],{'$or':_[_0xec79('0x24')](_0x4ef473[_0xec79('0x2d')],function(_0x29c819){var _0x4513d0={};_0x4513d0[_0x29c819]={'$like':'%'+_0x1998c4[_0xec79('0x29')][_0xec79('0x38')]+'%'};return _0x4513d0;})});}_0x4ef473=_[_0xec79('0x36')]({},_0x4ef473,_0x1998c4[_0xec79('0x39')]);return _0x47dff6[_0xec79('0x47')](_0x4ef473);}})['then'](function(_0x2f5d0d){if(_0x2f5d0d){_0x1c1dc5=_0x2f5d0d['length'];if(!_0x1998c4[_0xec79('0x29')][_0xec79('0x30')](_0xec79('0x31'))){_0x4ef473[_0xec79('0x19')]=qs[_0xec79('0x19')](_0x1998c4['query']['limit']);_0x4ef473['offset']=qs['offset'](_0x1998c4[_0xec79('0x29')][_0xec79('0x18')]);}return _0x47dff6[_0xec79('0x47')](_0x4ef473);}})[_0xec79('0x20')](function(_0x56296d){if(_0x56296d){return _0x56296d?{'count':_0x1c1dc5,'rows':_0x56296d}:null;}})[_0xec79('0x20')](respondWithResult(_0x5ed84c,null))[_0xec79('0x3c')](handleError(_0x5ed84c,null));};exports['getTags']=function(_0x40763f,_0x588838,_0x51984e){var _0xe4729={};var _0x12e772={};var _0x52fef7;var _0x1ee68c;return db[_0xec79('0x3a')]['findOne']({'where':{'id':_0x40763f['params']['id']}})[_0xec79('0x20')](handleEntityNotFound(_0x588838,null))['then'](function(_0x42e504){if(_0x42e504){_0x52fef7=_0x42e504;_0x12e772['model']=_[_0xec79('0x2a')](db['Tag'][_0xec79('0x25')]);_0x12e772[_0xec79('0x29')]=_[_0xec79('0x2a')](_0x40763f[_0xec79('0x29')]);_0x12e772[_0xec79('0x2b')]=_[_0xec79('0x2c')](_0x12e772['model'],_0x12e772[_0xec79('0x29')]);_0xe4729['attributes']=_[_0xec79('0x2c')](_0x12e772[_0xec79('0x28')],qs[_0xec79('0x2e')](_0x40763f[_0xec79('0x29')][_0xec79('0x2e')]));_0xe4729[_0xec79('0x2d')]=_0xe4729[_0xec79('0x2d')]['length']?_0xe4729[_0xec79('0x2d')]:_0x12e772[_0xec79('0x28')];_0xe4729[_0xec79('0x32')]=qs['sort'](_0x40763f[_0xec79('0x29')][_0xec79('0x33')]);_0xe4729[_0xec79('0x34')]=qs[_0xec79('0x2b')](_['pick'](_0x40763f[_0xec79('0x29')],_0x12e772['filters']));if(_0x40763f[_0xec79('0x29')][_0xec79('0x38')]){_0xe4729[_0xec79('0x34')]=_[_0xec79('0x36')](_0xe4729[_0xec79('0x34')],{'$or':_[_0xec79('0x24')](_0xe4729['attributes'],function(_0x57d728){var _0x374cae={};_0x374cae[_0x57d728]={'$like':'%'+_0x40763f['query'][_0xec79('0x38')]+'%'};return _0x374cae;})});}_0xe4729=_[_0xec79('0x36')]({},_0xe4729,_0x40763f[_0xec79('0x39')]);return _0x52fef7[_0xec79('0x48')](_0xe4729);}})['then'](function(_0x253426){if(_0x253426){_0x1ee68c=_0x253426['length'];if(!_0x40763f['query'][_0xec79('0x30')]('nolimit')){_0xe4729['limit']=qs[_0xec79('0x19')](_0x40763f['query']['limit']);_0xe4729['offset']=qs[_0xec79('0x18')](_0x40763f['query'][_0xec79('0x18')]);}return _0x52fef7[_0xec79('0x48')](_0xe4729);}})['then'](function(_0x492d9a){if(_0x492d9a){return _0x492d9a?{'count':_0x1ee68c,'rows':_0x492d9a}:null;}})['then'](respondWithResult(_0x588838,null))[_0xec79('0x3c')](handleError(_0x588838,null));};exports[_0xec79('0x49')]=function(_0x3f90f7,_0x1a5ee8,_0x3b6349){if(_0x3f90f7[_0xec79('0x42')]['id']){delete _0x3f90f7['body']['id'];}return db[_0xec79('0x3a')][_0xec79('0x44')]({'where':{'id':_0x3f90f7[_0xec79('0x3e')]['id']}})[_0xec79('0x20')](handleEntityNotFound(_0x1a5ee8,null))[_0xec79('0x20')](function(_0x23886a){if(_0x23886a){return _0x23886a[_0xec79('0x49')](_0x3f90f7[_0xec79('0x42')][_0xec79('0x4a')]||[]);}return null;})[_0xec79('0x20')](respondWithResult(_0x1a5ee8,null))[_0xec79('0x3c')](handleError(_0x1a5ee8,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0b03bec..bf04552 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 _0x8cd4=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8cd4,0x11a));var _0x48cd=function(_0x11238d,_0x499ac8){_0x11238d=_0x11238d-0x0;var _0x3686b0=_0x8cd4[_0x11238d];return _0x3686b0;};'use strict';var _=require(_0x48cd('0x0'));var util=require(_0x48cd('0x1'));var logger=require(_0x48cd('0x2'))(_0x48cd('0x3'));var moment=require(_0x48cd('0x4'));var BPromise=require(_0x48cd('0x5'));var rp=require(_0x48cd('0x6'));var fs=require('fs');var path=require(_0x48cd('0x7'));var rimraf=require(_0x48cd('0x8'));var config=require(_0x48cd('0x9'));var attributes=require('./intDeskConfiguration.attributes');module[_0x48cd('0xa')]=function(_0x564ded,_0x7ffbfe){return _0x564ded[_0x48cd('0xb')](_0x48cd('0xc'),attributes,{'tableName':_0x48cd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9949=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x9949,0x1ad));var _0x9994=function(_0x1318b9,_0x3d9844){_0x1318b9=_0x1318b9-0x0;var _0x1ee487=_0x9949[_0x1318b9];return _0x1ee487;};'use strict';var _=require(_0x9994('0x0'));var util=require(_0x9994('0x1'));var logger=require(_0x9994('0x2'))('api');var moment=require(_0x9994('0x3'));var BPromise=require(_0x9994('0x4'));var rp=require(_0x9994('0x5'));var fs=require('fs');var path=require(_0x9994('0x6'));var rimraf=require(_0x9994('0x7'));var config=require(_0x9994('0x8'));var attributes=require(_0x9994('0x9'));module[_0x9994('0xa')]=function(_0x35f528,_0x99582f){return _0x35f528[_0x9994('0xb')](_0x9994('0xc'),attributes,{'tableName':'int_desk_configurations','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 c3ced2c..62d7e14 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 _0x6197=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x9d8122,_0x5895d3){var _0x1d5cdc=function(_0x49ab8d){while(--_0x49ab8d){_0x9d8122['push'](_0x9d8122['shift']());}};_0x1d5cdc(++_0x5895d3);}(_0x6197,0x142));var _0x7619=function(_0x2b6747,_0x315361){_0x2b6747=_0x2b6747-0x0;var _0x84a232=_0x6197[_0x2b6747];return _0x84a232;};'use strict';var _=require(_0x7619('0x0'));var util=require('util');var moment=require(_0x7619('0x1'));var BPromise=require('bluebird');var rs=require(_0x7619('0x2'));var fs=require('fs');var Redis=require(_0x7619('0x3'));var db=require(_0x7619('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7619('0x5'))(_0x7619('0x6'));var config=require(_0x7619('0x7'));var jayson=require(_0x7619('0x8'));var client=jayson[_0x7619('0x9')][_0x7619('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37bb25,_0x42b027,_0x34f8e4){return new BPromise(function(_0x3840b4,_0x3e5cb1){return client[_0x7619('0xb')](_0x37bb25,_0x34f8e4)[_0x7619('0xc')](function(_0x42d06a){logger[_0x7619('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x42b027,_0x7619('0xe'));logger[_0x7619('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x42b027,'request\x20sent',JSON[_0x7619('0x10')](_0x42d06a));if(_0x42d06a[_0x7619('0x11')]){if(_0x42d06a['error'][_0x7619('0x12')]===0x1f4){logger[_0x7619('0x11')](_0x7619('0x13'),_0x42b027,_0x42d06a[_0x7619('0x11')][_0x7619('0x14')]);return _0x3e5cb1(_0x42d06a['error'][_0x7619('0x14')]);}logger[_0x7619('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x42b027,_0x42d06a[_0x7619('0x11')][_0x7619('0x14')]);return _0x3840b4(_0x42d06a['error']['message']);}else{logger[_0x7619('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x42b027,'request\x20sent');_0x3840b4(_0x42d06a[_0x7619('0x15')][_0x7619('0x14')]);}})[_0x7619('0x16')](function(_0x333332){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x42b027,_0x333332);_0x3e5cb1(_0x333332);});});} \ No newline at end of file +var _0x762e=['DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31a3b4,_0x4c5524){var _0x32c04b=function(_0x51d863){while(--_0x51d863){_0x31a3b4['push'](_0x31a3b4['shift']());}};_0x32c04b(++_0x4c5524);}(_0x762e,0xea));var _0xe762=function(_0x1b7500,_0x2eb0ed){_0x1b7500=_0x1b7500-0x0;var _0x12f833=_0x762e[_0x1b7500];return _0x12f833;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe762('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe762('0x2'))['db'];var utils=require(_0xe762('0x3'));var logger=require(_0xe762('0x4'))('rpc');var config=require(_0xe762('0x5'));var jayson=require(_0xe762('0x6'));var client=jayson[_0xe762('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f4726,_0x7a1740,_0x2511ad){return new BPromise(function(_0xf20548,_0x26a4fc){return client[_0xe762('0x8')](_0x1f4726,_0x2511ad)['then'](function(_0x50dd96){logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));logger[_0xe762('0xc')](_0xe762('0xd'),_0x7a1740,_0xe762('0xb'),JSON['stringify'](_0x50dd96));if(_0x50dd96[_0xe762('0xe')]){if(_0x50dd96[_0xe762('0xe')][_0xe762('0xf')]===0x1f4){logger['error'](_0xe762('0xa'),_0x7a1740,_0x50dd96['error'][_0xe762('0x10')]);return _0x26a4fc(_0x50dd96['error'][_0xe762('0x10')]);}logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x50dd96['error']['message']);return _0xf20548(_0x50dd96[_0xe762('0xe')][_0xe762('0x10')]);}else{logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));_0xf20548(_0x50dd96[_0xe762('0x11')][_0xe762('0x10')]);}})[_0xe762('0x12')](function(_0x531587){logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x531587);_0x26a4fc(_0x531587);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 52c5a65..0200d1b 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 _0x7752=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x17c216,_0x1eed2a){var _0x2b2b39=function(_0x26a65a){while(--_0x26a65a){_0x17c216['push'](_0x17c216['shift']());}};_0x2b2b39(++_0x1eed2a);}(_0x7752,0x92));var _0x2775=function(_0x889815,_0x52062f){_0x889815=_0x889815-0x0;var _0x1165d6=_0x7752[_0x889815];return _0x1165d6;};'use strict';var multer=require(_0x2775('0x0'));var util=require(_0x2775('0x1'));var path=require('path');var timeout=require(_0x2775('0x2'));var express=require(_0x2775('0x3'));var router=express[_0x2775('0x4')]();var fs_extra=require(_0x2775('0x5'));var auth=require(_0x2775('0x6'));var interaction=require(_0x2775('0x7'));var config=require(_0x2775('0x8'));var controller=require(_0x2775('0x9'));router[_0x2775('0xa')]('/',auth[_0x2775('0xb')](),controller['index']);router['get'](_0x2775('0xc'),auth[_0x2775('0xb')](),controller[_0x2775('0xd')]);router[_0x2775('0xe')]('/',auth[_0x2775('0xb')](),controller[_0x2775('0xf')]);router[_0x2775('0x10')](_0x2775('0xc'),auth[_0x2775('0xb')](),controller[_0x2775('0x11')]);router[_0x2775('0x12')](_0x2775('0xc'),auth['isAuthenticated'](),controller[_0x2775('0x13')]);module[_0x2775('0x14')]=router; \ No newline at end of file +var _0x659b=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x53431a,_0x5be6fd){var _0x40f61b=function(_0x56f5f5){while(--_0x56f5f5){_0x53431a['push'](_0x53431a['shift']());}};_0x40f61b(++_0x5be6fd);}(_0x659b,0x7a));var _0xb659=function(_0x58aac6,_0x12394c){_0x58aac6=_0x58aac6-0x0;var _0x59a1e2=_0x659b[_0x58aac6];return _0x59a1e2;};'use strict';var multer=require(_0xb659('0x0'));var util=require(_0xb659('0x1'));var path=require(_0xb659('0x2'));var timeout=require(_0xb659('0x3'));var express=require(_0xb659('0x4'));var router=express[_0xb659('0x5')]();var fs_extra=require(_0xb659('0x6'));var auth=require(_0xb659('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb659('0x8'));var controller=require(_0xb659('0x9'));router[_0xb659('0xa')]('/',auth[_0xb659('0xb')](),controller['index']);router[_0xb659('0xa')]('/:id',auth[_0xb659('0xb')](),controller[_0xb659('0xc')]);router[_0xb659('0xd')]('/',auth[_0xb659('0xb')](),controller[_0xb659('0xe')]);router[_0xb659('0xf')](_0xb659('0x10'),auth[_0xb659('0xb')](),controller[_0xb659('0x11')]);router['delete'](_0xb659('0x10'),auth['isAuthenticated'](),controller[_0xb659('0x12')]);module[_0xb659('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index a627508..e4710ee 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 _0x6a84=['picklist','STRING','string','customVariable','sequelize','exports','variable','keyValue'];(function(_0xb96a68,_0x58edb6){var _0x4fe02a=function(_0x37399e){while(--_0x37399e){_0xb96a68['push'](_0xb96a68['shift']());}};_0x4fe02a(++_0x58edb6);}(_0x6a84,0xf4));var _0x46a8=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x6a84[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0x46a8('0x0'));module[_0x46a8('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x46a8('0x2'),'customVariable',_0x46a8('0x3'),_0x46a8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x46a8('0x5')]},'key':{'type':Sequelize[_0x46a8('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x46a8('0x6'),_0x46a8('0x2'),_0x46a8('0x7'))},'keyContent':{'type':Sequelize[_0x46a8('0x5')]},'idField':{'type':Sequelize[_0x46a8('0x5')]},'nameField':{'type':Sequelize[_0x46a8('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x46a8('0x5')]}}; \ No newline at end of file +var _0x4526=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x2f3614,_0x4683c9){var _0x5851eb=function(_0x2c9e03){while(--_0x2c9e03){_0x2f3614['push'](_0x2f3614['shift']());}};_0x5851eb(++_0x4683c9);}(_0x4526,0x1b6));var _0x6452=function(_0x32e7ca,_0x31360a){_0x32e7ca=_0x32e7ca-0x0;var _0x1b4d58=_0x4526[_0x32e7ca];return _0x1b4d58;};'use strict';var Sequelize=require(_0x6452('0x0'));module['exports']={'type':{'type':Sequelize[_0x6452('0x1')](_0x6452('0x2'),_0x6452('0x3'),_0x6452('0x4'),_0x6452('0x5'),_0x6452('0x6')),'defaultValue':_0x6452('0x2')},'content':{'type':Sequelize[_0x6452('0x7')]},'key':{'type':Sequelize[_0x6452('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x6452('0x2'),_0x6452('0x3'),_0x6452('0x4'))},'keyContent':{'type':Sequelize[_0x6452('0x7')]},'idField':{'type':Sequelize[_0x6452('0x7')]},'nameField':{'type':Sequelize[_0x6452('0x7')]},'customField':{'type':Sequelize[_0x6452('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6452('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 38018d5..d9172b2 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 _0xc12c=['query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','sendStatus','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys'];(function(_0x58e7cc,_0x100bf6){var _0x2ede70=function(_0x5ab04e){while(--_0x5ab04e){_0x58e7cc['push'](_0x58e7cc['shift']());}};_0x2ede70(++_0x100bf6);}(_0xc12c,0xb3));var _0xcc12=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xc12c[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require(_0xcc12('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc12('0x1'));var jsonpatch=require(_0xcc12('0x2'));var rp=require(_0xcc12('0x3'));var moment=require(_0xcc12('0x4'));var BPromise=require(_0xcc12('0x5'));var Mustache=require(_0xcc12('0x6'));var util=require(_0xcc12('0x7'));var path=require(_0xcc12('0x8'));var sox=require(_0xcc12('0x9'));var csv=require('to-csv');var ejs=require(_0xcc12('0xa'));var fs=require('fs');var fs_extra=require(_0xcc12('0xb'));var _=require(_0xcc12('0xc'));var squel=require(_0xcc12('0xd'));var crypto=require(_0xcc12('0xe'));var jsforce=require(_0xcc12('0xf'));var deskjs=require(_0xcc12('0x10'));var toCsv=require(_0xcc12('0x11'));var querystring=require('querystring');var Papa=require(_0xcc12('0x12'));var Redis=require(_0xcc12('0x13'));var authService=require(_0xcc12('0x14'));var qs=require(_0xcc12('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc12('0x16'));var logger=require(_0xcc12('0x17'))(_0xcc12('0x18'));var utils=require(_0xcc12('0x19'));var config=require(_0xcc12('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1029e7,_0x3d431a){_0x3d431a=_0x3d431a||0xcc;return function(_0x3e6197){if(_0x3e6197){return _0x1029e7['sendStatus'](_0x3d431a);}return _0x1029e7[_0xcc12('0x1b')](_0x3d431a)[_0xcc12('0x1c')]();};}function respondWithResult(_0xa2020a,_0x55a6ba){_0x55a6ba=_0x55a6ba||0xc8;return function(_0x1b80a8){if(_0x1b80a8){return _0xa2020a[_0xcc12('0x1b')](_0x55a6ba)[_0xcc12('0x1d')](_0x1b80a8);}};}function respondWithFilteredResult(_0x5bb253,_0x384050){return function(_0x142c8c){if(_0x142c8c){var _0x4eaf1d=typeof _0x384050[_0xcc12('0x1e')]===_0xcc12('0x1f')&&typeof _0x384050['limit']==='undefined';var _0x158d94=_0x142c8c[_0xcc12('0x20')];var _0x1a773b=_0x4eaf1d?0x0:_0x384050[_0xcc12('0x1e')];var _0x317249=_0x4eaf1d?_0x142c8c[_0xcc12('0x20')]:_0x384050[_0xcc12('0x1e')]+_0x384050['limit'];var _0x54482e;if(_0x317249>=_0x158d94){_0x317249=_0x158d94;_0x54482e=0xc8;}else{_0x54482e=0xce;}_0x5bb253[_0xcc12('0x1b')](_0x54482e);return _0x5bb253[_0xcc12('0x21')](_0xcc12('0x22'),_0x1a773b+'-'+_0x317249+'/'+_0x158d94)[_0xcc12('0x1d')](_0x142c8c);}return null;};}function patchUpdates(_0x352f5d){return function(_0x1a5ce9){try{jsonpatch['apply'](_0x1a5ce9,_0x352f5d,!![]);}catch(_0x511a9f){return BPromise[_0xcc12('0x23')](_0x511a9f);}return _0x1a5ce9['save']();};}function saveUpdates(_0x4a1cb5,_0xc78906){return function(_0x48da41){if(_0x48da41){return _0x48da41[_0xcc12('0x24')](_0x4a1cb5)[_0xcc12('0x25')](function(_0xb13680){return _0xb13680;});}return null;};}function removeEntity(_0xca1628,_0xb28012){return function(_0x37b49d){if(_0x37b49d){return _0x37b49d[_0xcc12('0x26')]()[_0xcc12('0x25')](function(){_0xca1628[_0xcc12('0x1b')](0xcc)[_0xcc12('0x1c')]();});}};}function handleEntityNotFound(_0x4b78a4,_0x5c13b6){return function(_0x4cbd50){if(!_0x4cbd50){_0x4b78a4[_0xcc12('0x27')](0x194);}return _0x4cbd50;};}function handleError(_0x338191,_0x27f4c2){_0x27f4c2=_0x27f4c2||0x1f4;return function(_0x514b1c){logger['error'](_0x514b1c[_0xcc12('0x28')]);if(_0x514b1c[_0xcc12('0x29')]){delete _0x514b1c[_0xcc12('0x29')];}_0x338191[_0xcc12('0x1b')](_0x27f4c2)[_0xcc12('0x2a')](_0x514b1c);};}exports[_0xcc12('0x2b')]=function(_0x1847d3,_0xb919c){var _0x4a4f21={},_0x18f367={},_0x5401b2={'count':0x0,'rows':[]};var _0x510c6a=_[_0xcc12('0x2c')](db[_0xcc12('0x2d')][_0xcc12('0x2e')],function(_0x53d13f){return{'name':_0x53d13f[_0xcc12('0x2f')],'type':_0x53d13f[_0xcc12('0x30')][_0xcc12('0x31')]};});_0x18f367[_0xcc12('0x32')]=_[_0xcc12('0x2c')](_0x510c6a,_0xcc12('0x29'));_0x18f367['query']=_[_0xcc12('0x33')](_0x1847d3[_0xcc12('0x34')]);_0x18f367[_0xcc12('0x35')]=_['intersection'](_0x18f367[_0xcc12('0x32')],_0x18f367['query']);_0x4a4f21[_0xcc12('0x36')]=_[_0xcc12('0x37')](_0x18f367['model'],qs[_0xcc12('0x38')](_0x1847d3[_0xcc12('0x34')][_0xcc12('0x38')]));_0x4a4f21['attributes']=_0x4a4f21[_0xcc12('0x36')][_0xcc12('0x39')]?_0x4a4f21['attributes']:_0x18f367[_0xcc12('0x32')];if(!_0x1847d3[_0xcc12('0x34')][_0xcc12('0x3a')](_0xcc12('0x3b'))){_0x4a4f21[_0xcc12('0x3c')]=qs[_0xcc12('0x3c')](_0x1847d3[_0xcc12('0x34')]['limit']);_0x4a4f21[_0xcc12('0x1e')]=qs[_0xcc12('0x1e')](_0x1847d3[_0xcc12('0x34')][_0xcc12('0x1e')]);}_0x4a4f21[_0xcc12('0x3d')]=qs['sort'](_0x1847d3[_0xcc12('0x34')][_0xcc12('0x3e')]);_0x4a4f21['where']=qs[_0xcc12('0x35')](_['pick'](_0x1847d3[_0xcc12('0x34')],_0x18f367[_0xcc12('0x35')]),_0x510c6a);if(_0x1847d3[_0xcc12('0x34')][_0xcc12('0x3f')]){_0x4a4f21[_0xcc12('0x40')]=_[_0xcc12('0x41')](_0x4a4f21['where'],{'$or':_[_0xcc12('0x2c')](_0x510c6a,function(_0x218284){if(_0x218284[_0xcc12('0x30')]!=='VIRTUAL'){var _0x4cac42={};_0x4cac42[_0x218284[_0xcc12('0x29')]]={'$like':'%'+_0x1847d3[_0xcc12('0x34')][_0xcc12('0x3f')]+'%'};return _0x4cac42;}})});}_0x4a4f21=_[_0xcc12('0x41')]({},_0x4a4f21,_0x1847d3[_0xcc12('0x42')]);var _0x300472={'where':_0x4a4f21['where']};return db[_0xcc12('0x2d')][_0xcc12('0x20')](_0x300472)[_0xcc12('0x25')](function(_0x50f4f4){_0x5401b2[_0xcc12('0x20')]=_0x50f4f4;if(_0x1847d3[_0xcc12('0x34')][_0xcc12('0x43')]){_0x4a4f21[_0xcc12('0x44')]=[{'all':!![]}];}return db['DeskField'][_0xcc12('0x45')](_0x4a4f21);})[_0xcc12('0x25')](function(_0xe19a41){_0x5401b2[_0xcc12('0x46')]=_0xe19a41;return _0x5401b2;})[_0xcc12('0x25')](respondWithFilteredResult(_0xb919c,_0x4a4f21))[_0xcc12('0x47')](handleError(_0xb919c,null));};exports[_0xcc12('0x48')]=function(_0x15c3cf,_0xb352f7){var _0x51ae3c={'raw':!![],'where':{'id':_0x15c3cf[_0xcc12('0x49')]['id']}},_0x35eb46={};_0x35eb46['model']=_[_0xcc12('0x33')](db[_0xcc12('0x2d')][_0xcc12('0x2e')]);_0x35eb46[_0xcc12('0x34')]=_['keys'](_0x15c3cf[_0xcc12('0x34')]);_0x35eb46[_0xcc12('0x35')]=_[_0xcc12('0x37')](_0x35eb46[_0xcc12('0x32')],_0x35eb46[_0xcc12('0x34')]);_0x51ae3c[_0xcc12('0x36')]=_[_0xcc12('0x37')](_0x35eb46[_0xcc12('0x32')],qs[_0xcc12('0x38')](_0x15c3cf[_0xcc12('0x34')][_0xcc12('0x38')]));_0x51ae3c[_0xcc12('0x36')]=_0x51ae3c[_0xcc12('0x36')][_0xcc12('0x39')]?_0x51ae3c[_0xcc12('0x36')]:_0x35eb46[_0xcc12('0x32')];if(_0x15c3cf[_0xcc12('0x34')][_0xcc12('0x43')]){_0x51ae3c['include']=[{'all':!![]}];}_0x51ae3c=_[_0xcc12('0x41')]({},_0x51ae3c,_0x15c3cf['options']);return db[_0xcc12('0x2d')][_0xcc12('0x4a')](_0x51ae3c)['then'](handleEntityNotFound(_0xb352f7,null))['then'](respondWithResult(_0xb352f7,null))['catch'](handleError(_0xb352f7,null));};exports[_0xcc12('0x4b')]=function(_0x3cfa31,_0xe4aa21){return db[_0xcc12('0x2d')][_0xcc12('0x4b')](_0x3cfa31['body'],{})[_0xcc12('0x25')](respondWithResult(_0xe4aa21,0xc9))['catch'](handleError(_0xe4aa21,null));};exports[_0xcc12('0x24')]=function(_0x4aba09,_0x1567fc){if(_0x4aba09[_0xcc12('0x4c')]['id']){delete _0x4aba09[_0xcc12('0x4c')]['id'];}return db[_0xcc12('0x2d')]['find']({'where':{'id':_0x4aba09[_0xcc12('0x49')]['id']}})[_0xcc12('0x25')](handleEntityNotFound(_0x1567fc,null))[_0xcc12('0x25')](saveUpdates(_0x4aba09[_0xcc12('0x4c')],null))['then'](respondWithResult(_0x1567fc,null))[_0xcc12('0x47')](handleError(_0x1567fc,null));};exports[_0xcc12('0x26')]=function(_0x52808c,_0x56e2ef){return db[_0xcc12('0x2d')][_0xcc12('0x4a')]({'where':{'id':_0x52808c[_0xcc12('0x49')]['id']}})['then'](handleEntityNotFound(_0x56e2ef,null))[_0xcc12('0x25')](removeEntity(_0x56e2ef,null))[_0xcc12('0x47')](handleError(_0x56e2ef,null));}; \ No newline at end of file +var _0xa6bb=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','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','offset','count','limit','Content-Range','apply','reject','update','then','error','stack','name','index','DeskField','type','model','map','query'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa6bb,0x12c));var _0xba6b=function(_0x45b1c6,_0x195c7d){_0x45b1c6=_0x45b1c6-0x0;var _0x3d66a0=_0xa6bb[_0x45b1c6];return _0x3d66a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba6b('0x0'));var zipdir=require(_0xba6b('0x1'));var jsonpatch=require(_0xba6b('0x2'));var rp=require(_0xba6b('0x3'));var moment=require(_0xba6b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba6b('0x5'));var path=require(_0xba6b('0x6'));var sox=require(_0xba6b('0x7'));var csv=require(_0xba6b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba6b('0x9'));var squel=require(_0xba6b('0xa'));var crypto=require(_0xba6b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba6b('0x8'));var querystring=require(_0xba6b('0xc'));var Papa=require(_0xba6b('0xd'));var Redis=require(_0xba6b('0xe'));var authService=require(_0xba6b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba6b('0x10'));var hardwareService=require(_0xba6b('0x11'));var logger=require(_0xba6b('0x12'))('api');var utils=require(_0xba6b('0x13'));var config=require(_0xba6b('0x14'));var licenseUtil=require(_0xba6b('0x15'));var db=require(_0xba6b('0x16'))['db'];function respondWithStatusCode(_0x55b6ab,_0x1e8473){_0x1e8473=_0x1e8473||0xcc;return function(_0x5b1d28){if(_0x5b1d28){return _0x55b6ab[_0xba6b('0x17')](_0x1e8473);}return _0x55b6ab[_0xba6b('0x18')](_0x1e8473)[_0xba6b('0x19')]();};}function respondWithResult(_0x15d4e2,_0x32144e){_0x32144e=_0x32144e||0xc8;return function(_0x53ec00){if(_0x53ec00){return _0x15d4e2[_0xba6b('0x18')](_0x32144e)[_0xba6b('0x1a')](_0x53ec00);}};}function respondWithFilteredResult(_0x50b58a,_0x16c3d0){return function(_0x1d280e){if(_0x1d280e){var _0x52b2ff=typeof _0x16c3d0['offset']===_0xba6b('0x1b')&&typeof _0x16c3d0['limit']==='undefined';var _0x5a553c=_0x1d280e['count'];var _0x4be059=_0x52b2ff?0x0:_0x16c3d0[_0xba6b('0x1c')];var _0x34aa97=_0x52b2ff?_0x1d280e[_0xba6b('0x1d')]:_0x16c3d0[_0xba6b('0x1c')]+_0x16c3d0[_0xba6b('0x1e')];var _0x15d1d2;if(_0x34aa97>=_0x5a553c){_0x34aa97=_0x5a553c;_0x15d1d2=0xc8;}else{_0x15d1d2=0xce;}_0x50b58a[_0xba6b('0x18')](_0x15d1d2);return _0x50b58a['set'](_0xba6b('0x1f'),_0x4be059+'-'+_0x34aa97+'/'+_0x5a553c)['json'](_0x1d280e);}return null;};}function patchUpdates(_0x54a392){return function(_0x13beca){try{jsonpatch[_0xba6b('0x20')](_0x13beca,_0x54a392,!![]);}catch(_0x3905ae){return BPromise[_0xba6b('0x21')](_0x3905ae);}return _0x13beca['save']();};}function saveUpdates(_0xa632cb,_0x436623){return function(_0x548c1b){if(_0x548c1b){return _0x548c1b[_0xba6b('0x22')](_0xa632cb)[_0xba6b('0x23')](function(_0x82b68f){return _0x82b68f;});}return null;};}function removeEntity(_0x12e4e6,_0x426641){return function(_0x5c2845){if(_0x5c2845){return _0x5c2845['destroy']()['then'](function(){_0x12e4e6['status'](0xcc)[_0xba6b('0x19')]();});}};}function handleEntityNotFound(_0x2525f8,_0x2f5343){return function(_0x39f052){if(!_0x39f052){_0x2525f8[_0xba6b('0x17')](0x194);}return _0x39f052;};}function handleError(_0x32375c,_0x591102){_0x591102=_0x591102||0x1f4;return function(_0x876e58){logger[_0xba6b('0x24')](_0x876e58[_0xba6b('0x25')]);if(_0x876e58['name']){delete _0x876e58[_0xba6b('0x26')];}_0x32375c[_0xba6b('0x18')](_0x591102)['send'](_0x876e58);};}exports[_0xba6b('0x27')]=function(_0x25d5e6,_0xea9fbc){var _0x41a0e0={},_0x506f14={},_0x506447={'count':0x0,'rows':[]};var _0x18a4c1=_['map'](db[_0xba6b('0x28')]['rawAttributes'],function(_0x1a6b93){return{'name':_0x1a6b93['fieldName'],'type':_0x1a6b93[_0xba6b('0x29')]['key']};});_0x506f14[_0xba6b('0x2a')]=_[_0xba6b('0x2b')](_0x18a4c1,_0xba6b('0x26'));_0x506f14[_0xba6b('0x2c')]=_['keys'](_0x25d5e6[_0xba6b('0x2c')]);_0x506f14['filters']=_['intersection'](_0x506f14[_0xba6b('0x2a')],_0x506f14[_0xba6b('0x2c')]);_0x41a0e0['attributes']=_[_0xba6b('0x2d')](_0x506f14['model'],qs['fields'](_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x2e')]));_0x41a0e0[_0xba6b('0x2f')]=_0x41a0e0[_0xba6b('0x2f')][_0xba6b('0x30')]?_0x41a0e0['attributes']:_0x506f14[_0xba6b('0x2a')];if(!_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x31')](_0xba6b('0x32'))){_0x41a0e0[_0xba6b('0x1e')]=qs[_0xba6b('0x1e')](_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x1e')]);_0x41a0e0[_0xba6b('0x1c')]=qs['offset'](_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x1c')]);}_0x41a0e0[_0xba6b('0x33')]=qs[_0xba6b('0x34')](_0x25d5e6['query']['sort']);_0x41a0e0[_0xba6b('0x35')]=qs[_0xba6b('0x36')](_[_0xba6b('0x37')](_0x25d5e6[_0xba6b('0x2c')],_0x506f14['filters']),_0x18a4c1);if(_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x38')]){_0x41a0e0['where']=_[_0xba6b('0x39')](_0x41a0e0['where'],{'$or':_[_0xba6b('0x2b')](_0x18a4c1,function(_0x36df21){if(_0x36df21[_0xba6b('0x29')]!=='VIRTUAL'){var _0x26c479={};_0x26c479[_0x36df21[_0xba6b('0x26')]]={'$like':'%'+_0x25d5e6['query'][_0xba6b('0x38')]+'%'};return _0x26c479;}})});}_0x41a0e0=_['merge']({},_0x41a0e0,_0x25d5e6[_0xba6b('0x3a')]);var _0x5cc07e={'where':_0x41a0e0[_0xba6b('0x35')]};return db['DeskField'][_0xba6b('0x1d')](_0x5cc07e)['then'](function(_0x37dcb6){_0x506447[_0xba6b('0x1d')]=_0x37dcb6;if(_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x3b')]){_0x41a0e0['include']=[{'all':!![]}];}return db[_0xba6b('0x28')][_0xba6b('0x3c')](_0x41a0e0);})[_0xba6b('0x23')](function(_0x31fe5a){_0x506447[_0xba6b('0x3d')]=_0x31fe5a;return _0x506447;})['then'](respondWithFilteredResult(_0xea9fbc,_0x41a0e0))[_0xba6b('0x3e')](handleError(_0xea9fbc,null));};exports['show']=function(_0x1f229b,_0x7cb298){var _0x5b710a={'raw':!![],'where':{'id':_0x1f229b[_0xba6b('0x3f')]['id']}},_0x57e9b5={};_0x57e9b5[_0xba6b('0x2a')]=_[_0xba6b('0x40')](db[_0xba6b('0x28')]['rawAttributes']);_0x57e9b5[_0xba6b('0x2c')]=_[_0xba6b('0x40')](_0x1f229b[_0xba6b('0x2c')]);_0x57e9b5[_0xba6b('0x36')]=_['intersection'](_0x57e9b5[_0xba6b('0x2a')],_0x57e9b5[_0xba6b('0x2c')]);_0x5b710a[_0xba6b('0x2f')]=_[_0xba6b('0x2d')](_0x57e9b5[_0xba6b('0x2a')],qs[_0xba6b('0x2e')](_0x1f229b['query'][_0xba6b('0x2e')]));_0x5b710a[_0xba6b('0x2f')]=_0x5b710a[_0xba6b('0x2f')]['length']?_0x5b710a[_0xba6b('0x2f')]:_0x57e9b5[_0xba6b('0x2a')];if(_0x1f229b[_0xba6b('0x2c')][_0xba6b('0x3b')]){_0x5b710a[_0xba6b('0x41')]=[{'all':!![]}];}_0x5b710a=_[_0xba6b('0x39')]({},_0x5b710a,_0x1f229b[_0xba6b('0x3a')]);return db[_0xba6b('0x28')]['find'](_0x5b710a)[_0xba6b('0x23')](handleEntityNotFound(_0x7cb298,null))[_0xba6b('0x23')](respondWithResult(_0x7cb298,null))[_0xba6b('0x3e')](handleError(_0x7cb298,null));};exports['create']=function(_0x2d231e,_0x37172b){return db[_0xba6b('0x28')][_0xba6b('0x42')](_0x2d231e[_0xba6b('0x43')],{})[_0xba6b('0x23')](respondWithResult(_0x37172b,0xc9))[_0xba6b('0x3e')](handleError(_0x37172b,null));};exports[_0xba6b('0x22')]=function(_0x2dea62,_0x5035b3){if(_0x2dea62[_0xba6b('0x43')]['id']){delete _0x2dea62[_0xba6b('0x43')]['id'];}return db[_0xba6b('0x28')][_0xba6b('0x44')]({'where':{'id':_0x2dea62[_0xba6b('0x3f')]['id']}})[_0xba6b('0x23')](handleEntityNotFound(_0x5035b3,null))[_0xba6b('0x23')](saveUpdates(_0x2dea62[_0xba6b('0x43')],null))[_0xba6b('0x23')](respondWithResult(_0x5035b3,null))[_0xba6b('0x3e')](handleError(_0x5035b3,null));};exports['destroy']=function(_0x40c0ea,_0x36d3db){return db['DeskField'][_0xba6b('0x44')]({'where':{'id':_0x40c0ea[_0xba6b('0x3f')]['id']}})[_0xba6b('0x23')](handleEntityNotFound(_0x36d3db,null))['then'](removeEntity(_0x36d3db,null))[_0xba6b('0x3e')](handleError(_0x36d3db,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index bce7407..7c28d8a 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 _0x52be=['FieldId','lodash','util','moment','path','rimraf','exports','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x41b038,_0x14e06e){var _0x58dcfa=function(_0x490df9){while(--_0x490df9){_0x41b038['push'](_0x41b038['shift']());}};_0x58dcfa(++_0x14e06e);}(_0x52be,0xb1));var _0xe52b=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x52be[_0x350182];return _0x4a0892;};'use strict';var _=require(_0xe52b('0x0'));var util=require(_0xe52b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe52b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe52b('0x3'));var rimraf=require(_0xe52b('0x4'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xe52b('0x5')]=function(_0x4ab26b,_0x504d7e){return _0x4ab26b['define'](_0xe52b('0x6'),attributes,{'tableName':_0xe52b('0x7'),'paranoid':![],'indexes':[{'name':_0xe52b('0x8'),'fields':[_0xe52b('0x9'),_0xe52b('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7504=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','util'];(function(_0x544039,_0xd3d293){var _0x4a6bbf=function(_0xf3230e){while(--_0xf3230e){_0x544039['push'](_0x544039['shift']());}};_0x4a6bbf(++_0xd3d293);}(_0x7504,0x95));var _0x4750=function(_0x1892e5,_0x42bf77){_0x1892e5=_0x1892e5-0x0;var _0x56fd2e=_0x7504[_0x1892e5];return _0x56fd2e;};'use strict';var _=require('lodash');var util=require(_0x4750('0x0'));var logger=require(_0x4750('0x1'))('api');var moment=require(_0x4750('0x2'));var BPromise=require(_0x4750('0x3'));var rp=require(_0x4750('0x4'));var fs=require('fs');var path=require(_0x4750('0x5'));var rimraf=require(_0x4750('0x6'));var config=require(_0x4750('0x7'));var attributes=require(_0x4750('0x8'));module[_0x4750('0x9')]=function(_0x5c9797,_0x5d8010){return _0x5c9797[_0x4750('0xa')](_0x4750('0xb'),attributes,{'tableName':_0x4750('0xc'),'paranoid':![],'indexes':[{'name':_0x4750('0xd'),'fields':[_0x4750('0xe'),'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 028610c..61562f2 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 _0xc617=['client','http','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4f425f,_0x379d16){var _0x3930c9=function(_0x5d717f){while(--_0x5d717f){_0x4f425f['push'](_0x4f425f['shift']());}};_0x3930c9(++_0x379d16);}(_0xc617,0x81));var _0x7c61=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0xc617[_0x1057a3];return _0x131cdb;};'use strict';var _=require(_0x7c61('0x0'));var util=require(_0x7c61('0x1'));var moment=require(_0x7c61('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c61('0x3'));var db=require(_0x7c61('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c61('0x5'))(_0x7c61('0x6'));var config=require(_0x7c61('0x7'));var jayson=require(_0x7c61('0x8'));var client=jayson[_0x7c61('0x9')][_0x7c61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x585227,_0x499741,_0xe5ebdc){return new BPromise(function(_0x4a4901,_0x4b9919){return client['request'](_0x585227,_0xe5ebdc)[_0x7c61('0xb')](function(_0x3ad73b){logger['info'](_0x7c61('0xc'),_0x499741,_0x7c61('0xd'));logger[_0x7c61('0xe')](_0x7c61('0xf'),_0x499741,_0x7c61('0xd'),JSON[_0x7c61('0x10')](_0x3ad73b));if(_0x3ad73b[_0x7c61('0x11')]){if(_0x3ad73b[_0x7c61('0x11')][_0x7c61('0x12')]===0x1f4){logger[_0x7c61('0x11')](_0x7c61('0xc'),_0x499741,_0x3ad73b['error'][_0x7c61('0x13')]);return _0x4b9919(_0x3ad73b[_0x7c61('0x11')][_0x7c61('0x13')]);}logger['error'](_0x7c61('0xc'),_0x499741,_0x3ad73b[_0x7c61('0x11')][_0x7c61('0x13')]);return _0x4a4901(_0x3ad73b['error'][_0x7c61('0x13')]);}else{logger[_0x7c61('0x14')](_0x7c61('0xc'),_0x499741,_0x7c61('0xd'));_0x4a4901(_0x3ad73b[_0x7c61('0x15')][_0x7c61('0x13')]);}})[_0x7c61('0x16')](function(_0x128636){logger[_0x7c61('0x11')](_0x7c61('0xc'),_0x499741,_0x128636);_0x4b9919(_0x128636);});});} \ No newline at end of file +var _0x3aa1=['DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dfb56,_0xfe844d){var _0x5e6e1b=function(_0x4e002f){while(--_0x4e002f){_0x3dfb56['push'](_0x3dfb56['shift']());}};_0x5e6e1b(++_0xfe844d);}(_0x3aa1,0x1ab));var _0x13aa=function(_0x279742,_0x1e2c40){_0x279742=_0x279742-0x0;var _0x302021=_0x3aa1[_0x279742];return _0x302021;};'use strict';var _=require('lodash');var util=require(_0x13aa('0x0'));var moment=require('moment');var BPromise=require(_0x13aa('0x1'));var rs=require(_0x13aa('0x2'));var fs=require('fs');var Redis=require(_0x13aa('0x3'));var db=require(_0x13aa('0x4'))['db'];var utils=require(_0x13aa('0x5'));var logger=require(_0x13aa('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x13aa('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39bfd8,_0x1febca,_0x455768){return new BPromise(function(_0x21935e,_0x10038a){return client[_0x13aa('0x8')](_0x39bfd8,_0x455768)['then'](function(_0x45a517){logger[_0x13aa('0x9')](_0x13aa('0xa'),_0x1febca,_0x13aa('0xb'));logger[_0x13aa('0xc')](_0x13aa('0xd'),_0x1febca,_0x13aa('0xb'),JSON[_0x13aa('0xe')](_0x45a517));if(_0x45a517['error']){if(_0x45a517[_0x13aa('0xf')][_0x13aa('0x10')]===0x1f4){logger[_0x13aa('0xf')](_0x13aa('0xa'),_0x1febca,_0x45a517[_0x13aa('0xf')]['message']);return _0x10038a(_0x45a517[_0x13aa('0xf')]['message']);}logger['error'](_0x13aa('0xa'),_0x1febca,_0x45a517['error'][_0x13aa('0x11')]);return _0x21935e(_0x45a517[_0x13aa('0xf')][_0x13aa('0x11')]);}else{logger[_0x13aa('0x9')]('DeskField,\x20%s,\x20%s',_0x1febca,_0x13aa('0xb'));_0x21935e(_0x45a517[_0x13aa('0x12')]['message']);}})[_0x13aa('0x13')](function(_0x103eab){logger[_0x13aa('0xf')](_0x13aa('0xa'),_0x1febca,_0x103eab);_0x10038a(_0x103eab);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 21459f3..bfb7c8f 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 _0xd79c=['index','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x498fae,_0x5cc98c){var _0x162376=function(_0x24491c){while(--_0x24491c){_0x498fae['push'](_0x498fae['shift']());}};_0x162376(++_0x5cc98c);}(_0xd79c,0xeb));var _0xcd79=function(_0x4ff1f8,_0x226493){_0x4ff1f8=_0x4ff1f8-0x0;var _0x5b3c9b=_0xd79c[_0x4ff1f8];return _0x5b3c9b;};'use strict';var multer=require(_0xcd79('0x0'));var util=require(_0xcd79('0x1'));var path=require(_0xcd79('0x2'));var timeout=require(_0xcd79('0x3'));var express=require(_0xcd79('0x4'));var router=express['Router']();var fs_extra=require(_0xcd79('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd79('0x6'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xcd79('0x7')]);router[_0xcd79('0x8')](_0xcd79('0x9'),auth[_0xcd79('0xa')](),controller[_0xcd79('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xcd79('0xc')]);router[_0xcd79('0x8')](_0xcd79('0xd'),auth[_0xcd79('0xa')](),controller[_0xcd79('0xe')]);router[_0xcd79('0xf')]('/',auth['isAuthenticated'](),controller[_0xcd79('0x10')]);router['post'](_0xcd79('0x11'),auth['isAuthenticated'](),controller[_0xcd79('0x12')]);router[_0xcd79('0x13')]('/:id',auth[_0xcd79('0xa')](),controller['update']);router['delete'](_0xcd79('0x9'),auth[_0xcd79('0xa')](),controller[_0xcd79('0x14')]);module[_0xcd79('0x15')]=router; \ No newline at end of file +var _0x523d=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','destroy'];(function(_0x16031d,_0x49d429){var _0x318f0f=function(_0x3be6e2){while(--_0x3be6e2){_0x16031d['push'](_0x16031d['shift']());}};_0x318f0f(++_0x49d429);}(_0x523d,0x177));var _0xd523=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x523d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd523('0x0'));var util=require(_0xd523('0x1'));var path=require('path');var timeout=require(_0xd523('0x2'));var express=require(_0xd523('0x3'));var router=express[_0xd523('0x4')]();var fs_extra=require(_0xd523('0x5'));var auth=require(_0xd523('0x6'));var interaction=require(_0xd523('0x7'));var config=require(_0xd523('0x8'));var controller=require(_0xd523('0x9'));router[_0xd523('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd523('0xa')](_0xd523('0xb'),auth[_0xd523('0xc')](),controller['show']);router['get'](_0xd523('0xd'),auth[_0xd523('0xc')](),controller[_0xd523('0xe')]);router[_0xd523('0xa')]('/:id/fields',auth[_0xd523('0xc')](),controller[_0xd523('0xf')]);router[_0xd523('0x10')]('/',auth[_0xd523('0xc')](),controller[_0xd523('0x11')]);router[_0xd523('0x10')](_0xd523('0xd'),auth[_0xd523('0xc')](),controller[_0xd523('0x12')]);router['put'](_0xd523('0xb'),auth[_0xd523('0xc')](),controller[_0xd523('0x13')]);router['delete']('/:id',auth[_0xd523('0xc')](),controller[_0xd523('0x14')]);module[_0xd523('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8480ed6..99d2317 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 _0x84d0=['sequelize','exports','STRING'];(function(_0x374cec,_0x2b4ae0){var _0x2f3513=function(_0x3db373){while(--_0x3db373){_0x374cec['push'](_0x374cec['shift']());}};_0x2f3513(++_0x2b4ae0);}(_0x84d0,0x75));var _0x084d=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x84d0[_0x2df507];return _0x1f7167;};'use strict';var Sequelize=require(_0x084d('0x0'));module[_0x084d('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x084d('0x2')]},'password':{'type':Sequelize[_0x084d('0x2')]},'remoteUri':{'type':Sequelize[_0x084d('0x2')]},'tenantId':{'type':Sequelize[_0x084d('0x2')]},'clientId':{'type':Sequelize[_0x084d('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x084d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x084d('0x2')]}}; \ No newline at end of file +var _0x6c6f=['STRING','sequelize'];(function(_0x491eac,_0x1c27d1){var _0xebf9eb=function(_0x41c6eb){while(--_0x41c6eb){_0x491eac['push'](_0x491eac['shift']());}};_0xebf9eb(++_0x1c27d1);}(_0x6c6f,0x10b));var _0xf6c6=function(_0x5d3371,_0x1ac75a){_0x5d3371=_0x5d3371-0x0;var _0x4066db=_0x6c6f[_0x5d3371];return _0x4066db;};'use strict';var Sequelize=require(_0xf6c6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf6c6('0x1')]},'password':{'type':Sequelize[_0xf6c6('0x1')]},'remoteUri':{'type':Sequelize[_0xf6c6('0x1')]},'tenantId':{'type':Sequelize[_0xf6c6('0x1')]},'clientId':{'type':Sequelize[_0xf6c6('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf6c6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf6c6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 08cf39f..29d74f3 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 _0x86dd=['ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','lastIndexOf','%s/api/data/v9.0/','POST','/oauth2/token','access_token','GET','Bearer\x20','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','MetadataId','all','isNil','substring','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','?$select=DisplayName,LogicalName','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','catch','show','params','create','body','find','destroy','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','getFields','incident','title','description','customerid'];(function(_0x109f6b,_0x2a164c){var _0x22c967=function(_0x854889){while(--_0x854889){_0x109f6b['push'](_0x109f6b['shift']());}};_0x22c967(++_0x2a164c);}(_0x86dd,0x1ee));var _0xd86d=function(_0x541bf8,_0x55eb77){_0x541bf8=_0x541bf8-0x0;var _0x166d15=_0x86dd[_0x541bf8];return _0x166d15;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd86d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd86d('0x1'));var rp=require(_0xd86d('0x2'));var moment=require(_0xd86d('0x3'));var BPromise=require(_0xd86d('0x4'));var Mustache=require(_0xd86d('0x5'));var util=require(_0xd86d('0x6'));var path=require(_0xd86d('0x7'));var sox=require(_0xd86d('0x8'));var csv=require(_0xd86d('0x9'));var ejs=require(_0xd86d('0xa'));var fs=require('fs');var fs_extra=require(_0xd86d('0xb'));var _=require(_0xd86d('0xc'));var squel=require('squel');var crypto=require(_0xd86d('0xd'));var jsforce=require(_0xd86d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd86d('0x9'));var querystring=require(_0xd86d('0xf'));var Papa=require(_0xd86d('0x10'));var Redis=require(_0xd86d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd86d('0x12'));var as=require(_0xd86d('0x13'));var hardwareService=require(_0xd86d('0x14'));var logger=require(_0xd86d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd86d('0x16'));var licenseUtil=require(_0xd86d('0x17'));var db=require(_0xd86d('0x18'))['db'];var integrations=require(_0xd86d('0x19'));function respondWithStatusCode(_0x28a283,_0x4f911b){_0x4f911b=_0x4f911b||0xcc;return function(_0x5233d2){if(_0x5233d2){return _0x28a283['sendStatus'](_0x4f911b);}return _0x28a283[_0xd86d('0x1a')](_0x4f911b)[_0xd86d('0x1b')]();};}function respondWithResult(_0x3863a8,_0x13f90e){_0x13f90e=_0x13f90e||0xc8;return function(_0x4457b0){if(_0x4457b0){return _0x3863a8[_0xd86d('0x1a')](_0x13f90e)[_0xd86d('0x1c')](_0x4457b0);}};}function respondWithFilteredResult(_0x570ed1,_0x1d2b33){return function(_0x2cc4d9){if(_0x2cc4d9){var _0x38dc37=typeof _0x1d2b33[_0xd86d('0x1d')]===_0xd86d('0x1e')&&typeof _0x1d2b33[_0xd86d('0x1f')]===_0xd86d('0x1e');var _0x418270=_0x2cc4d9[_0xd86d('0x20')];var _0x21efda=_0x38dc37?0x0:_0x1d2b33['offset'];var _0x4808f4=_0x38dc37?_0x2cc4d9[_0xd86d('0x20')]:_0x1d2b33[_0xd86d('0x1d')]+_0x1d2b33[_0xd86d('0x1f')];var _0x573556;if(_0x4808f4>=_0x418270){_0x4808f4=_0x418270;_0x573556=0xc8;}else{_0x573556=0xce;}_0x570ed1[_0xd86d('0x1a')](_0x573556);return _0x570ed1[_0xd86d('0x21')](_0xd86d('0x22'),_0x21efda+'-'+_0x4808f4+'/'+_0x418270)['json'](_0x2cc4d9);}return null;};}function patchUpdates(_0x2caf8b){return function(_0x21d88b){try{jsonpatch['apply'](_0x21d88b,_0x2caf8b,!![]);}catch(_0x384bb3){return BPromise[_0xd86d('0x23')](_0x384bb3);}return _0x21d88b[_0xd86d('0x24')]();};}function saveUpdates(_0x539c83,_0x2faef6){return function(_0x30c0f1){if(_0x30c0f1){return _0x30c0f1[_0xd86d('0x25')](_0x539c83)[_0xd86d('0x26')](function(_0x49845b){return _0x49845b;});}return null;};}function removeEntity(_0x2c33f0,_0x3a5799){return function(_0x5e1ea3){if(_0x5e1ea3){return _0x5e1ea3['destroy']()['then'](function(){_0x2c33f0[_0xd86d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x158dcb,_0x4b42ca){return function(_0x48c7cc){if(!_0x48c7cc){_0x158dcb[_0xd86d('0x27')](0x194);}return _0x48c7cc;};}function handleError(_0x3e4e3f,_0x48dd45){_0x48dd45=_0x48dd45||0x1f4;return function(_0x1da491){logger['error'](_0x1da491[_0xd86d('0x28')]);if(_0x1da491['name']){delete _0x1da491['name'];}_0x3e4e3f['status'](_0x48dd45)['send'](_0x1da491);};}exports[_0xd86d('0x29')]=function(_0x5daa94,_0x2897b5){var _0x525a87={},_0x3236a4={},_0x2fc237={'count':0x0,'rows':[]};var _0x2626d6=_[_0xd86d('0x2a')](db['Dynamics365Account'][_0xd86d('0x2b')],function(_0x260219){return{'name':_0x260219[_0xd86d('0x2c')],'type':_0x260219[_0xd86d('0x2d')][_0xd86d('0x2e')]};});_0x3236a4[_0xd86d('0x2f')]=_['map'](_0x2626d6,_0xd86d('0x30'));_0x3236a4[_0xd86d('0x31')]=_[_0xd86d('0x32')](_0x5daa94[_0xd86d('0x31')]);_0x3236a4['filters']=_['intersection'](_0x3236a4[_0xd86d('0x2f')],_0x3236a4['query']);_0x525a87[_0xd86d('0x33')]=_[_0xd86d('0x34')](_0x3236a4[_0xd86d('0x2f')],qs[_0xd86d('0x35')](_0x5daa94['query'][_0xd86d('0x35')]));_0x525a87[_0xd86d('0x33')]=_0x525a87['attributes'][_0xd86d('0x36')]?_0x525a87[_0xd86d('0x33')]:_0x3236a4[_0xd86d('0x2f')];if(!_0x5daa94['query'][_0xd86d('0x37')]('nolimit')){_0x525a87[_0xd86d('0x1f')]=qs[_0xd86d('0x1f')](_0x5daa94[_0xd86d('0x31')][_0xd86d('0x1f')]);_0x525a87[_0xd86d('0x1d')]=qs['offset'](_0x5daa94[_0xd86d('0x31')]['offset']);}_0x525a87[_0xd86d('0x38')]=qs['sort'](_0x5daa94[_0xd86d('0x31')][_0xd86d('0x39')]);_0x525a87[_0xd86d('0x3a')]=qs[_0xd86d('0x3b')](_[_0xd86d('0x3c')](_0x5daa94['query'],_0x3236a4[_0xd86d('0x3b')]),_0x2626d6);if(_0x5daa94['query'][_0xd86d('0x3d')]){_0x525a87['where']=_[_0xd86d('0x3e')](_0x525a87['where'],{'$or':_[_0xd86d('0x2a')](_0x2626d6,function(_0x5a28ae){if(_0x5a28ae['type']!==_0xd86d('0x3f')){var _0x16576c={};_0x16576c[_0x5a28ae[_0xd86d('0x30')]]={'$like':'%'+_0x5daa94[_0xd86d('0x31')]['filter']+'%'};return _0x16576c;}})});}_0x525a87=_['merge']({},_0x525a87,_0x5daa94[_0xd86d('0x40')]);var _0x2a92ca={'where':_0x525a87[_0xd86d('0x3a')]};return db[_0xd86d('0x41')]['count'](_0x2a92ca)[_0xd86d('0x26')](function(_0x30d8d7){_0x2fc237[_0xd86d('0x20')]=_0x30d8d7;if(_0x5daa94[_0xd86d('0x31')][_0xd86d('0x42')]){_0x525a87[_0xd86d('0x43')]=[{'all':!![]}];}return db[_0xd86d('0x41')][_0xd86d('0x44')](_0x525a87);})['then'](function(_0x2c4509){_0x2fc237['rows']=_0x2c4509;return _0x2fc237;})[_0xd86d('0x26')](respondWithFilteredResult(_0x2897b5,_0x525a87))[_0xd86d('0x45')](handleError(_0x2897b5,null));};exports[_0xd86d('0x46')]=function(_0x41b49f,_0x4d2523){var _0x3fea7c={'raw':![],'where':{'id':_0x41b49f[_0xd86d('0x47')]['id']}},_0xef2e86={};_0xef2e86[_0xd86d('0x2f')]=_[_0xd86d('0x32')](db[_0xd86d('0x41')][_0xd86d('0x2b')]);_0xef2e86['query']=_[_0xd86d('0x32')](_0x41b49f[_0xd86d('0x31')]);_0xef2e86[_0xd86d('0x3b')]=_[_0xd86d('0x34')](_0xef2e86[_0xd86d('0x2f')],_0xef2e86[_0xd86d('0x31')]);_0x3fea7c[_0xd86d('0x33')]=_['intersection'](_0xef2e86[_0xd86d('0x2f')],qs[_0xd86d('0x35')](_0x41b49f['query']['fields']));_0x3fea7c['attributes']=_0x3fea7c[_0xd86d('0x33')][_0xd86d('0x36')]?_0x3fea7c['attributes']:_0xef2e86[_0xd86d('0x2f')];if(_0x41b49f[_0xd86d('0x31')][_0xd86d('0x42')]){_0x3fea7c[_0xd86d('0x43')]=[{'all':!![]}];}_0x3fea7c=_[_0xd86d('0x3e')]({},_0x3fea7c,_0x41b49f[_0xd86d('0x40')]);return db[_0xd86d('0x41')]['find'](_0x3fea7c)['then'](handleEntityNotFound(_0x4d2523,null))[_0xd86d('0x26')](respondWithResult(_0x4d2523,null))[_0xd86d('0x45')](handleError(_0x4d2523,null));};exports['create']=function(_0x3bc9d3,_0x7bbb3){return db[_0xd86d('0x41')][_0xd86d('0x48')](_0x3bc9d3['body'],{})[_0xd86d('0x26')](respondWithResult(_0x7bbb3,0xc9))[_0xd86d('0x45')](handleError(_0x7bbb3,null));};exports[_0xd86d('0x25')]=function(_0x551b49,_0x3c65d1){if(_0x551b49[_0xd86d('0x49')]['id']){delete _0x551b49[_0xd86d('0x49')]['id'];}return db['Dynamics365Account'][_0xd86d('0x4a')]({'where':{'id':_0x551b49[_0xd86d('0x47')]['id']}})[_0xd86d('0x26')](handleEntityNotFound(_0x3c65d1,null))['then'](saveUpdates(_0x551b49[_0xd86d('0x49')],null))[_0xd86d('0x26')](respondWithResult(_0x3c65d1,null))['catch'](handleError(_0x3c65d1,null));};exports[_0xd86d('0x4b')]=function(_0x387cdd,_0x35930e){return db[_0xd86d('0x41')][_0xd86d('0x4a')]({'where':{'id':_0x387cdd['params']['id']}})['then'](handleEntityNotFound(_0x35930e,null))[_0xd86d('0x26')](removeEntity(_0x35930e,null))[_0xd86d('0x45')](handleError(_0x35930e,null));};exports[_0xd86d('0x4c')]=function(_0x3fce30,_0x40037f,_0x3f5d98){var _0x1be3fe={};var _0x55a7c5={};var _0x477b3e;var _0x117a70;return db[_0xd86d('0x41')]['findOne']({'where':{'id':_0x3fce30[_0xd86d('0x47')]['id']}})[_0xd86d('0x26')](handleEntityNotFound(_0x40037f,null))[_0xd86d('0x26')](function(_0x23e1d1){if(_0x23e1d1){_0x477b3e=_0x23e1d1;_0x55a7c5[_0xd86d('0x2f')]=_[_0xd86d('0x32')](db[_0xd86d('0x4d')]['rawAttributes']);_0x55a7c5[_0xd86d('0x31')]=_[_0xd86d('0x32')](_0x3fce30[_0xd86d('0x31')]);_0x55a7c5[_0xd86d('0x3b')]=_['intersection'](_0x55a7c5['model'],_0x55a7c5[_0xd86d('0x31')]);_0x1be3fe[_0xd86d('0x33')]=_[_0xd86d('0x34')](_0x55a7c5[_0xd86d('0x2f')],qs[_0xd86d('0x35')](_0x3fce30[_0xd86d('0x31')][_0xd86d('0x35')]));_0x1be3fe[_0xd86d('0x33')]=_0x1be3fe[_0xd86d('0x33')][_0xd86d('0x36')]?_0x1be3fe[_0xd86d('0x33')]:_0x55a7c5[_0xd86d('0x2f')];_0x1be3fe[_0xd86d('0x38')]=qs[_0xd86d('0x39')](_0x3fce30[_0xd86d('0x31')][_0xd86d('0x39')]);_0x1be3fe[_0xd86d('0x3a')]=qs['filters'](_[_0xd86d('0x3c')](_0x3fce30[_0xd86d('0x31')],_0x55a7c5[_0xd86d('0x3b')]));if(_0x3fce30[_0xd86d('0x31')][_0xd86d('0x3d')]){_0x1be3fe[_0xd86d('0x3a')]=_[_0xd86d('0x3e')](_0x1be3fe[_0xd86d('0x3a')],{'$or':_[_0xd86d('0x2a')](_0x1be3fe[_0xd86d('0x33')],function(_0x5a08cf){var _0x23e84c={};_0x23e84c[_0x5a08cf]={'$like':'%'+_0x3fce30[_0xd86d('0x31')][_0xd86d('0x3d')]+'%'};return _0x23e84c;})});}_0x1be3fe=_[_0xd86d('0x3e')]({},_0x1be3fe,_0x3fce30[_0xd86d('0x40')]);return _0x477b3e['getConfigurations'](_0x1be3fe);}})[_0xd86d('0x26')](function(_0x177b8e){if(_0x177b8e){_0x117a70=_0x177b8e['length'];if(!_0x3fce30[_0xd86d('0x31')]['hasOwnProperty']('nolimit')){_0x1be3fe['limit']=qs[_0xd86d('0x1f')](_0x3fce30[_0xd86d('0x31')]['limit']);_0x1be3fe[_0xd86d('0x1d')]=qs[_0xd86d('0x1d')](_0x3fce30[_0xd86d('0x31')][_0xd86d('0x1d')]);}return _0x477b3e[_0xd86d('0x4c')](_0x1be3fe);}})['then'](function(_0x24d7dc){if(_0x24d7dc){return _0x24d7dc?{'count':_0x117a70,'rows':_0x24d7dc}:null;}})[_0xd86d('0x26')](respondWithResult(_0x40037f,null))['catch'](handleError(_0x40037f,null));};exports[_0xd86d('0x4e')]=function(_0x56d617,_0x3a0c55,_0x2b97c4){if(_0x56d617['body']['id']){delete _0x56d617[_0xd86d('0x49')]['id'];}return db[_0xd86d('0x41')][_0xd86d('0x4f')]({'where':{'id':_0x56d617[_0xd86d('0x47')]['id']}})[_0xd86d('0x26')](handleEntityNotFound(_0x3a0c55,null))[_0xd86d('0x26')](function(_0xd14708){if(_0xd14708){_0x56d617[_0xd86d('0x49')][_0xd86d('0x50')]=_0xd14708['id'];_0x56d617[_0xd86d('0x49')]['Subjects']=integrations['getSubjects'](_0x56d617[_0xd86d('0x49')][_0xd86d('0x51')],_0x56d617['body'][_0xd86d('0x2d')]);_0x56d617['body'][_0xd86d('0x52')]=integrations[_0xd86d('0x53')](_0x56d617['body'][_0xd86d('0x51')],_0x56d617[_0xd86d('0x49')]['type']);return db[_0xd86d('0x4d')][_0xd86d('0x48')](_0x56d617['body'],{'include':[{'model':db[_0xd86d('0x54')],'as':_0xd86d('0x55')},{'model':db[_0xd86d('0x54')],'as':'Descriptions'}]});}return null;})[_0xd86d('0x26')](respondWithResult(_0x3a0c55,null))[_0xd86d('0x45')](handleError(_0x3a0c55,null));};exports[_0xd86d('0x56')]=function(_0x3fef79,_0x4b156b,_0x6a5b15){var _0x4d4203=_0x3fef79['query']['ticketType'];var _0x294e7f=_0x4d4203===_0xd86d('0x57')?'Incident':'PhoneCall';var _0x47fa7b='';var _0xade65b='';var _0x25a666='';var _0x26ed02='';var _0x36e7c8='';var _0x5281d0='';var _0x2a82fe='';var _0x44d58f='';var _0x7e2180=[_0xd86d('0x58'),_0xd86d('0x59'),_0xd86d('0x5a'),_0xd86d('0x5b'),_0xd86d('0x5c'),_0xd86d('0x5d'),_0xd86d('0x5e'),_0xd86d('0x5f'),_0xd86d('0x60'),_0xd86d('0x61')];var _0x1642bc=['accountidname',_0xd86d('0x62'),'actualserviceunits',_0xd86d('0x63'),'contactidname',_0xd86d('0x64'),_0xd86d('0x65'),'contractidname','createdbyexternalpartyname',_0xd86d('0x66'),_0xd86d('0x67'),_0xd86d('0x68'),'createdon','createdonbehalfbyname',_0xd86d('0x69'),'customeridname',_0xd86d('0x6a'),_0xd86d('0x6b'),_0xd86d('0x6c'),_0xd86d('0x6d'),'entityimage_timestamp',_0xd86d('0x6e'),_0xd86d('0x6f'),'exchangerate',_0xd86d('0x70'),'followupby',_0xd86d('0x71'),_0xd86d('0x72'),_0xd86d('0x73'),'lastonholdtime','masteridname',_0xd86d('0x74'),_0xd86d('0x75'),_0xd86d('0x76'),_0xd86d('0x77'),'modifiedon',_0xd86d('0x78'),_0xd86d('0x79'),'msdyn_incidenttypename',_0xd86d('0x7a'),_0xd86d('0x7b'),_0xd86d('0x7c'),_0xd86d('0x7d'),_0xd86d('0x7e'),_0xd86d('0x7f'),_0xd86d('0x80'),_0xd86d('0x81'),'primarycontactidname','primarycontactidyominame',_0xd86d('0x82'),_0xd86d('0x83'),'productserialnumber',_0xd86d('0x84'),'resolvebykpiidname',_0xd86d('0x85'),_0xd86d('0x86'),_0xd86d('0x87'),'sentimentvalue',_0xd86d('0x88'),'slaname','socialprofileidname','statecode','statuscode',_0xd86d('0x89'),_0xd86d('0x8a'),'timezoneruleversionnumber',_0xd86d('0x8b'),_0xd86d('0x8c'),_0xd86d('0x8d'),_0xd86d('0x8e')];var _0x59d22d=_0x7e2180[_0xd86d('0x8f')](_0x1642bc);return db[_0xd86d('0x41')][_0xd86d('0x4f')]({'where':{'id':_0x3fef79[_0xd86d('0x47')]['id']},'attributes':['id',_0xd86d('0x90'),_0xd86d('0x91'),_0xd86d('0x92'),_0xd86d('0x93'),_0xd86d('0x94'),_0xd86d('0x95')]})[_0xd86d('0x26')](handleEntityNotFound(_0x4b156b,null))[_0xd86d('0x26')](function(_0x3885c2){if(_0x3885c2){_0x44d58f=_0x3885c2[_0xd86d('0x92')];var _0xc706dd=_0x44d58f['slice'](-0x1);if(_0xc706dd==='/'){_0x44d58f=_0x44d58f['substring'](0x0,_0x44d58f[_0xd86d('0x96')](_0xc706dd));}_0x2a82fe=util['format'](_0xd86d('0x97'),_0x44d58f);var _0x3ef50a={'method':_0xd86d('0x98'),'uri':'https://login.microsoftonline.com/'+_0x3885c2[_0xd86d('0x93')]+_0xd86d('0x99'),'form':{'client_id':_0x3885c2['clientId'],'resource':_0x44d58f,'username':_0x3885c2[_0xd86d('0x90')],'password':_0x3885c2[_0xd86d('0x91')],'grant_type':'password','client_secret':_0x3885c2[_0xd86d('0x95')]},'json':!![]};return rp(_0x3ef50a);}})[_0xd86d('0x26')](function(_0x5cccfe){_0x5281d0=_0x5cccfe[_0xd86d('0x9a')];var _0xa8512f={'method':_0xd86d('0x9b'),'uri':encodeURI(_0x2a82fe+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x294e7f+'\x27'),'headers':{'Authorization':_0xd86d('0x9c')+_0x5281d0,'If-None-Match':null,'OData-Version':_0xd86d('0x9d')},'json':!![]};return rp(_0xa8512f);})[_0xd86d('0x26')](function(_0x117feb){var _0x432ed6=_0x117feb['value'][0x0];var _0x33293c=_0x432ed6['MetadataId'];var _0x5985ef={'method':_0xd86d('0x9b'),'uri':_0x2a82fe+'EntityDefinitions('+_0x33293c+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x5281d0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5985ef);})['then'](function(_0x62ea29){_0x47fa7b=_0x62ea29;_0xade65b=_0x47fa7b[_0xd86d('0x9e')];_0xade65b=_[_0xd86d('0x9f')](_0xade65b,function(_0x36ea74){return!_0x59d22d[_0xd86d('0xa0')](_0x36ea74[_0xd86d('0xa1')]);});var _0x40279d=[];var _0x2fe6e7=[];_0xade65b[_0xd86d('0xa2')](function(_0x5141de){if(_0x5141de[_0xd86d('0xa3')]){var _0x1b2661=_0x5141de[_0xd86d('0xa3')]['substring'](_0x5141de[_0xd86d('0xa3')]['lastIndexOf']('.')+0x1);if(_0x1b2661==='PicklistAttributeMetadata'){_0x40279d['push'](getSelectList(_0x2a82fe,_0x4d4203,_0x2fe6e7,_0x47fa7b['MetadataId'],_0x5141de[_0xd86d('0xa4')],_0x5281d0));}}});return Promise[_0xd86d('0xa5')](_0x40279d);})['then'](function(_0xb8759e){_0x25a666=_0xb8759e[0x0];var _0x39af5f=[];var _0x571b9d=[];_0xade65b[_0xd86d('0xa2')](function(_0x3585a1){if(!_[_0xd86d('0xa6')](_0x3585a1[_0xd86d('0xa3')])){var _0xeeeedd=_0x3585a1['@odata.type'][_0xd86d('0xa7')](_0x3585a1[_0xd86d('0xa3')][_0xd86d('0x96')]('.')+0x1);if(_0xeeeedd===_0xd86d('0xa8')){_0x39af5f[_0xd86d('0xa9')](getBooleanList(_0x2a82fe,_0x4d4203,_0x571b9d,_0x47fa7b['MetadataId'],_0x3585a1[_0xd86d('0xa4')],_0x5281d0));}}});return Promise['all'](_0x39af5f);})[_0xd86d('0x26')](function(_0x3b66f1){_0x26ed02=_0x3b66f1[0x0];var _0x404564=[];var _0x4e8229=[];_0xade65b[_0xd86d('0xa2')](function(_0x2f9771){if(_0x2f9771[_0xd86d('0xa3')]){var _0xdbeeea=_0x2f9771[_0xd86d('0xa3')]['substring'](_0x2f9771[_0xd86d('0xa3')][_0xd86d('0x96')]('.')+0x1);if(_0xdbeeea===_0xd86d('0xaa')||_0xdbeeea===_0xd86d('0xab')||_0xdbeeea===_0xd86d('0xac')||_0xdbeeea===_0xd86d('0xad')||_0xdbeeea===_0xd86d('0xae')||_0xdbeeea===_0xd86d('0xaf')||_0xdbeeea===_0xd86d('0xb0')||_0xdbeeea===_0xd86d('0xb1')||_0xdbeeea===_0xd86d('0xb2')||_0xdbeeea===_0xd86d('0xb3')){_0x404564['push'](getInputList(_0x2a82fe,_0x4d4203,_0xdbeeea,_0x4e8229,_0x47fa7b['MetadataId'],_0x2f9771[_0xd86d('0xa4')],_0x5281d0));}}});return Promise['all'](_0x404564);})[_0xd86d('0x26')](function(_0x3de82c){_0x36e7c8=_0x3de82c[0x0];var _0xce97fe=_0x25a666['concat'](_0x26ed02)[_0xd86d('0x8f')](_0x36e7c8);var _0x485fe3={'count':_0xce97fe['length'],'rows':_0xce97fe};return _0x485fe3;})[_0xd86d('0x26')](respondWithResult(_0x4b156b,null))['catch'](function(_0x2ae3e8){var _0x2cbc13=_0x3fef79[_0xd86d('0x31')][_0xd86d('0xb4')]?0x1f4:_0x2ae3e8[_0xd86d('0xb5')]||0x1f4;logger[_0xd86d('0xb6')](_0x2ae3e8[_0xd86d('0x28')]);delete _0x2ae3e8[_0xd86d('0x30')];if(_0x2cbc13===0x191){_0x2cbc13=0x190;}_0x4b156b[_0xd86d('0x1a')](_0x2cbc13)['send'](_0x3fef79[_0xd86d('0x31')][_0xd86d('0xb4')]?{'message':'Wrong\x20credentials','statusCode':_0x2ae3e8['statusCode']}:_0x2ae3e8);});};function getSelectList(_0x2e302a,_0x247d99,_0x328876,_0x575c5b,_0x229ea9,_0x57bee9){var _0x9f0985={'method':_0xd86d('0x9b'),'uri':_0x2e302a+'EntityDefinitions('+_0x575c5b+_0xd86d('0xb7')+_0x229ea9+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xd86d('0xb8'),'headers':{'Authorization':'Bearer\x20'+_0x57bee9,'If-None-Match':null,'OData-Version':_0xd86d('0x9d')},'json':!![]};return rp(_0x9f0985)[_0xd86d('0x26')](function(_0x130c74){var _0x2c001b=[];var _0x410e66=_0x130c74[_0xd86d('0xb9')][_0xd86d('0xba')];_0x410e66[_0xd86d('0xa2')](function(_0x532756){_0x2c001b['push']({'name':_0x532756[_0xd86d('0xbb')]['UserLocalizedLabel'][_0xd86d('0xbb')],'value':String(_0x532756[_0xd86d('0xbc')])});});var _0x114bb1={'id':_0x247d99+'_'+_0x130c74[_0xd86d('0xa1')],'name':_0x130c74[_0xd86d('0xbd')][_0xd86d('0xbe')][_0xd86d('0xbb')],'custom':![],'options':_0x2c001b};_0x328876[_0xd86d('0xa9')](_0x114bb1);return _0x328876;});}function getBooleanList(_0x367945,_0x3f9a84,_0x1b0532,_0x2ff292,_0x2de161,_0x535817){var _0x2d556f={'method':'GET','uri':_0x367945+'EntityDefinitions('+_0x2ff292+_0xd86d('0xb7')+_0x2de161+_0xd86d('0xbf'),'headers':{'Authorization':_0xd86d('0x9c')+_0x535817,'If-None-Match':null,'OData-Version':_0xd86d('0x9d')},'json':!![]};return rp(_0x2d556f)[_0xd86d('0x26')](function(_0x58ad81){var _0x2deaaf=[];_0x2deaaf[_0xd86d('0xa9')]({'name':_0x58ad81[_0xd86d('0xb9')][_0xd86d('0xc0')]['Label'][_0xd86d('0xbe')][_0xd86d('0xbb')],'value':'true'},{'name':_0x58ad81[_0xd86d('0xb9')][_0xd86d('0xc1')][_0xd86d('0xbb')][_0xd86d('0xbe')][_0xd86d('0xbb')],'value':'false'});var _0x4c01bb={'id':_0x3f9a84+'_'+_0x58ad81['LogicalName'],'name':_0x58ad81['DisplayName'][_0xd86d('0xbe')][_0xd86d('0xbb')],'custom':![],'options':_0x2deaaf};_0x1b0532[_0xd86d('0xa9')](_0x4c01bb);return _0x1b0532;});}function getInputList(_0x19435f,_0x505455,_0x3c2297,_0x2e54c3,_0x1e8048,_0x51f122,_0x196ffb){var _0x4e0204={'method':_0xd86d('0x9b'),'uri':_0x19435f+'EntityDefinitions('+_0x1e8048+_0xd86d('0xb7')+_0x51f122+')/Microsoft.Dynamics.CRM.'+_0x3c2297+_0xd86d('0xc2'),'headers':{'Authorization':'Bearer\x20'+_0x196ffb,'If-None-Match':null,'OData-Version':_0xd86d('0x9d')},'json':!![]};return rp(_0x4e0204)[_0xd86d('0x26')](function(_0x17481e){var _0x33324c={'id':_0x505455+'_'+_0x17481e[_0xd86d('0xa1')],'name':_0x17481e['DisplayName'][_0xd86d('0xbe')]?_0x17481e[_0xd86d('0xbd')][_0xd86d('0xbe')][_0xd86d('0xbb')]:_0x17481e['LogicalName'],'custom':![],'options':[]};_0x2e54c3[_0xd86d('0xa9')](_0x33324c);return _0x2e54c3;});} \ No newline at end of file +var _0x24a6=['find','create','body','findOne','Dynamics365Configuration','getConfigurations','nolimit','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','getFields','ticketType','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractdetailidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','clientId','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','stack','send','Wrong\x20credentials','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','eml-format','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/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','name','Dynamics365Account','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','length'];(function(_0x1479d3,_0x2e81a9){var _0x45cfbc=function(_0x922fc7){while(--_0x922fc7){_0x1479d3['push'](_0x1479d3['shift']());}};_0x45cfbc(++_0x2e81a9);}(_0x24a6,0x14f));var _0x624a=function(_0x235643,_0x5ad6c6){_0x235643=_0x235643-0x0;var _0x520e96=_0x24a6[_0x235643];return _0x520e96;};'use strict';var emlformat=require(_0x624a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x624a('0x1'));var jsonpatch=require(_0x624a('0x2'));var rp=require(_0x624a('0x3'));var moment=require(_0x624a('0x4'));var BPromise=require(_0x624a('0x5'));var Mustache=require(_0x624a('0x6'));var util=require(_0x624a('0x7'));var path=require(_0x624a('0x8'));var sox=require(_0x624a('0x9'));var csv=require(_0x624a('0xa'));var ejs=require(_0x624a('0xb'));var fs=require('fs');var fs_extra=require(_0x624a('0xc'));var _=require(_0x624a('0xd'));var squel=require(_0x624a('0xe'));var crypto=require(_0x624a('0xf'));var jsforce=require(_0x624a('0x10'));var deskjs=require(_0x624a('0x11'));var toCsv=require(_0x624a('0xa'));var querystring=require(_0x624a('0x12'));var Papa=require(_0x624a('0x13'));var Redis=require(_0x624a('0x14'));var authService=require(_0x624a('0x15'));var qs=require(_0x624a('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x624a('0x17'))(_0x624a('0x18'));var utils=require(_0x624a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x624a('0x1a'));var db=require(_0x624a('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x50d1aa,_0x5406ce){_0x5406ce=_0x5406ce||0xcc;return function(_0x10080e){if(_0x10080e){return _0x50d1aa['sendStatus'](_0x5406ce);}return _0x50d1aa[_0x624a('0x1c')](_0x5406ce)[_0x624a('0x1d')]();};}function respondWithResult(_0xe310b4,_0x1e6ffd){_0x1e6ffd=_0x1e6ffd||0xc8;return function(_0x547e4f){if(_0x547e4f){return _0xe310b4[_0x624a('0x1c')](_0x1e6ffd)['json'](_0x547e4f);}};}function respondWithFilteredResult(_0x424200,_0x195bfc){return function(_0x53005e){if(_0x53005e){var _0x201751=typeof _0x195bfc[_0x624a('0x1e')]===_0x624a('0x1f')&&typeof _0x195bfc[_0x624a('0x20')]===_0x624a('0x1f');var _0x158b72=_0x53005e[_0x624a('0x21')];var _0x32d6a0=_0x201751?0x0:_0x195bfc[_0x624a('0x1e')];var _0x4721ac=_0x201751?_0x53005e['count']:_0x195bfc[_0x624a('0x1e')]+_0x195bfc['limit'];var _0x387b79;if(_0x4721ac>=_0x158b72){_0x4721ac=_0x158b72;_0x387b79=0xc8;}else{_0x387b79=0xce;}_0x424200['status'](_0x387b79);return _0x424200[_0x624a('0x22')](_0x624a('0x23'),_0x32d6a0+'-'+_0x4721ac+'/'+_0x158b72)[_0x624a('0x24')](_0x53005e);}return null;};}function patchUpdates(_0x200fdc){return function(_0x1c6f64){try{jsonpatch['apply'](_0x1c6f64,_0x200fdc,!![]);}catch(_0x3f459a){return BPromise[_0x624a('0x25')](_0x3f459a);}return _0x1c6f64[_0x624a('0x26')]();};}function saveUpdates(_0x22beca,_0x5dfeec){return function(_0x1a673b){if(_0x1a673b){return _0x1a673b[_0x624a('0x27')](_0x22beca)[_0x624a('0x28')](function(_0x4ba881){return _0x4ba881;});}return null;};}function removeEntity(_0x4aee03,_0x56834b){return function(_0x29257b){if(_0x29257b){return _0x29257b[_0x624a('0x29')]()[_0x624a('0x28')](function(){_0x4aee03[_0x624a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ca99b,_0x2234dc){return function(_0x15ba91){if(!_0x15ba91){_0x5ca99b['sendStatus'](0x194);}return _0x15ba91;};}function handleError(_0xd0730c,_0x19b8a6){_0x19b8a6=_0x19b8a6||0x1f4;return function(_0x534c41){logger['error'](_0x534c41['stack']);if(_0x534c41[_0x624a('0x2a')]){delete _0x534c41[_0x624a('0x2a')];}_0xd0730c['status'](_0x19b8a6)['send'](_0x534c41);};}exports['index']=function(_0x422c20,_0x35c8d0){var _0x4dab19={},_0x55dff7={},_0x16178d={'count':0x0,'rows':[]};var _0x1ba339=_['map'](db[_0x624a('0x2b')]['rawAttributes'],function(_0x209ca5){return{'name':_0x209ca5[_0x624a('0x2c')],'type':_0x209ca5[_0x624a('0x2d')][_0x624a('0x2e')]};});_0x55dff7['model']=_[_0x624a('0x2f')](_0x1ba339,_0x624a('0x2a'));_0x55dff7['query']=_[_0x624a('0x30')](_0x422c20[_0x624a('0x31')]);_0x55dff7[_0x624a('0x32')]=_[_0x624a('0x33')](_0x55dff7[_0x624a('0x34')],_0x55dff7[_0x624a('0x31')]);_0x4dab19['attributes']=_['intersection'](_0x55dff7[_0x624a('0x34')],qs[_0x624a('0x35')](_0x422c20[_0x624a('0x31')]['fields']));_0x4dab19[_0x624a('0x36')]=_0x4dab19['attributes']['length']?_0x4dab19['attributes']:_0x55dff7[_0x624a('0x34')];if(!_0x422c20['query'][_0x624a('0x37')]('nolimit')){_0x4dab19[_0x624a('0x20')]=qs['limit'](_0x422c20['query'][_0x624a('0x20')]);_0x4dab19[_0x624a('0x1e')]=qs[_0x624a('0x1e')](_0x422c20[_0x624a('0x31')][_0x624a('0x1e')]);}_0x4dab19[_0x624a('0x38')]=qs[_0x624a('0x39')](_0x422c20[_0x624a('0x31')][_0x624a('0x39')]);_0x4dab19[_0x624a('0x3a')]=qs['filters'](_[_0x624a('0x3b')](_0x422c20[_0x624a('0x31')],_0x55dff7[_0x624a('0x32')]),_0x1ba339);if(_0x422c20[_0x624a('0x31')][_0x624a('0x3c')]){_0x4dab19['where']=_[_0x624a('0x3d')](_0x4dab19[_0x624a('0x3a')],{'$or':_[_0x624a('0x2f')](_0x1ba339,function(_0x2af5dc){if(_0x2af5dc[_0x624a('0x2d')]!==_0x624a('0x3e')){var _0x51499c={};_0x51499c[_0x2af5dc[_0x624a('0x2a')]]={'$like':'%'+_0x422c20[_0x624a('0x31')][_0x624a('0x3c')]+'%'};return _0x51499c;}})});}_0x4dab19=_['merge']({},_0x4dab19,_0x422c20[_0x624a('0x3f')]);var _0x561c1e={'where':_0x4dab19['where']};return db[_0x624a('0x2b')][_0x624a('0x21')](_0x561c1e)[_0x624a('0x28')](function(_0x4e0d70){_0x16178d['count']=_0x4e0d70;if(_0x422c20[_0x624a('0x31')][_0x624a('0x40')]){_0x4dab19['include']=[{'all':!![]}];}return db[_0x624a('0x2b')][_0x624a('0x41')](_0x4dab19);})['then'](function(_0x475b3f){_0x16178d[_0x624a('0x42')]=_0x475b3f;return _0x16178d;})[_0x624a('0x28')](respondWithFilteredResult(_0x35c8d0,_0x4dab19))[_0x624a('0x43')](handleError(_0x35c8d0,null));};exports['show']=function(_0x577ec5,_0x48e061){var _0x23168b={'raw':![],'where':{'id':_0x577ec5[_0x624a('0x44')]['id']}},_0x19de37={};_0x19de37[_0x624a('0x34')]=_[_0x624a('0x30')](db[_0x624a('0x2b')][_0x624a('0x45')]);_0x19de37['query']=_[_0x624a('0x30')](_0x577ec5[_0x624a('0x31')]);_0x19de37['filters']=_['intersection'](_0x19de37[_0x624a('0x34')],_0x19de37['query']);_0x23168b[_0x624a('0x36')]=_[_0x624a('0x33')](_0x19de37[_0x624a('0x34')],qs['fields'](_0x577ec5[_0x624a('0x31')][_0x624a('0x35')]));_0x23168b[_0x624a('0x36')]=_0x23168b[_0x624a('0x36')][_0x624a('0x46')]?_0x23168b['attributes']:_0x19de37[_0x624a('0x34')];if(_0x577ec5[_0x624a('0x31')][_0x624a('0x40')]){_0x23168b['include']=[{'all':!![]}];}_0x23168b=_[_0x624a('0x3d')]({},_0x23168b,_0x577ec5[_0x624a('0x3f')]);return db[_0x624a('0x2b')][_0x624a('0x47')](_0x23168b)[_0x624a('0x28')](handleEntityNotFound(_0x48e061,null))[_0x624a('0x28')](respondWithResult(_0x48e061,null))['catch'](handleError(_0x48e061,null));};exports[_0x624a('0x48')]=function(_0x519bce,_0x5a45b0){return db['Dynamics365Account'][_0x624a('0x48')](_0x519bce[_0x624a('0x49')],{})[_0x624a('0x28')](respondWithResult(_0x5a45b0,0xc9))[_0x624a('0x43')](handleError(_0x5a45b0,null));};exports['update']=function(_0x18c318,_0x4283ff){if(_0x18c318[_0x624a('0x49')]['id']){delete _0x18c318['body']['id'];}return db['Dynamics365Account'][_0x624a('0x47')]({'where':{'id':_0x18c318[_0x624a('0x44')]['id']}})[_0x624a('0x28')](handleEntityNotFound(_0x4283ff,null))[_0x624a('0x28')](saveUpdates(_0x18c318[_0x624a('0x49')],null))[_0x624a('0x28')](respondWithResult(_0x4283ff,null))['catch'](handleError(_0x4283ff,null));};exports[_0x624a('0x29')]=function(_0x47422e,_0x4ca80b){return db[_0x624a('0x2b')][_0x624a('0x47')]({'where':{'id':_0x47422e[_0x624a('0x44')]['id']}})[_0x624a('0x28')](handleEntityNotFound(_0x4ca80b,null))[_0x624a('0x28')](removeEntity(_0x4ca80b,null))[_0x624a('0x43')](handleError(_0x4ca80b,null));};exports['getConfigurations']=function(_0x8cb341,_0x4091f7,_0x584168){var _0x16cd1e={};var _0x280c30={};var _0x13bb41;var _0x52fc4e;return db[_0x624a('0x2b')][_0x624a('0x4a')]({'where':{'id':_0x8cb341[_0x624a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4091f7,null))['then'](function(_0x590c83){if(_0x590c83){_0x13bb41=_0x590c83;_0x280c30[_0x624a('0x34')]=_[_0x624a('0x30')](db[_0x624a('0x4b')][_0x624a('0x45')]);_0x280c30[_0x624a('0x31')]=_['keys'](_0x8cb341[_0x624a('0x31')]);_0x280c30[_0x624a('0x32')]=_[_0x624a('0x33')](_0x280c30[_0x624a('0x34')],_0x280c30['query']);_0x16cd1e['attributes']=_[_0x624a('0x33')](_0x280c30[_0x624a('0x34')],qs['fields'](_0x8cb341['query'][_0x624a('0x35')]));_0x16cd1e[_0x624a('0x36')]=_0x16cd1e[_0x624a('0x36')]['length']?_0x16cd1e['attributes']:_0x280c30[_0x624a('0x34')];_0x16cd1e['order']=qs[_0x624a('0x39')](_0x8cb341[_0x624a('0x31')][_0x624a('0x39')]);_0x16cd1e[_0x624a('0x3a')]=qs['filters'](_[_0x624a('0x3b')](_0x8cb341[_0x624a('0x31')],_0x280c30[_0x624a('0x32')]));if(_0x8cb341[_0x624a('0x31')][_0x624a('0x3c')]){_0x16cd1e['where']=_[_0x624a('0x3d')](_0x16cd1e[_0x624a('0x3a')],{'$or':_[_0x624a('0x2f')](_0x16cd1e[_0x624a('0x36')],function(_0x21b73a){var _0x4b31bb={};_0x4b31bb[_0x21b73a]={'$like':'%'+_0x8cb341[_0x624a('0x31')]['filter']+'%'};return _0x4b31bb;})});}_0x16cd1e=_[_0x624a('0x3d')]({},_0x16cd1e,_0x8cb341[_0x624a('0x3f')]);return _0x13bb41[_0x624a('0x4c')](_0x16cd1e);}})[_0x624a('0x28')](function(_0x316fbe){if(_0x316fbe){_0x52fc4e=_0x316fbe[_0x624a('0x46')];if(!_0x8cb341[_0x624a('0x31')][_0x624a('0x37')](_0x624a('0x4d'))){_0x16cd1e['limit']=qs[_0x624a('0x20')](_0x8cb341[_0x624a('0x31')][_0x624a('0x20')]);_0x16cd1e[_0x624a('0x1e')]=qs[_0x624a('0x1e')](_0x8cb341['query']['offset']);}return _0x13bb41['getConfigurations'](_0x16cd1e);}})[_0x624a('0x28')](function(_0x501db3){if(_0x501db3){return _0x501db3?{'count':_0x52fc4e,'rows':_0x501db3}:null;}})[_0x624a('0x28')](respondWithResult(_0x4091f7,null))['catch'](handleError(_0x4091f7,null));};exports['addConfiguration']=function(_0x230bf3,_0x2d8513,_0xea678e){if(_0x230bf3['body']['id']){delete _0x230bf3[_0x624a('0x49')]['id'];}return db[_0x624a('0x2b')]['findOne']({'where':{'id':_0x230bf3['params']['id']}})[_0x624a('0x28')](handleEntityNotFound(_0x2d8513,null))[_0x624a('0x28')](function(_0x1ad121){if(_0x1ad121){_0x230bf3[_0x624a('0x49')]['AccountId']=_0x1ad121['id'];_0x230bf3[_0x624a('0x49')][_0x624a('0x4e')]=integrations[_0x624a('0x4f')](_0x230bf3['body'][_0x624a('0x50')],_0x230bf3[_0x624a('0x49')][_0x624a('0x2d')]);_0x230bf3[_0x624a('0x49')][_0x624a('0x51')]=integrations['getDescriptions'](_0x230bf3[_0x624a('0x49')][_0x624a('0x50')],_0x230bf3[_0x624a('0x49')][_0x624a('0x2d')]);return db[_0x624a('0x4b')][_0x624a('0x48')](_0x230bf3[_0x624a('0x49')],{'include':[{'model':db['Dynamics365Field'],'as':_0x624a('0x4e')},{'model':db[_0x624a('0x52')],'as':_0x624a('0x51')}]});}return null;})[_0x624a('0x28')](respondWithResult(_0x2d8513,null))[_0x624a('0x43')](handleError(_0x2d8513,null));};exports[_0x624a('0x53')]=function(_0x46a53f,_0x3f98aa,_0x5eae90){var _0x2de6d6=_0x46a53f[_0x624a('0x31')][_0x624a('0x54')];var _0x1c67c7=_0x2de6d6==='incident'?'Incident':_0x624a('0x55');var _0x75b962='';var _0x50033d='';var _0x3e32b9='';var _0x413e28='';var _0x17b7aa='';var _0x17c0a8='';var _0x177619='';var _0x3f90d0='';var _0x2723f6=[_0x624a('0x56'),_0x624a('0x57'),_0x624a('0x58'),_0x624a('0x59'),_0x624a('0x5a'),_0x624a('0x5b'),'phonenumber','regardingobjectid',_0x624a('0x5c'),_0x624a('0x5d')];var _0x4e76c6=[_0x624a('0x5e'),_0x624a('0x5f'),_0x624a('0x60'),_0x624a('0x61'),'contactidname','contactidyominame',_0x624a('0x62'),'contractidname',_0x624a('0x63'),'createdbyexternalpartyyominame',_0x624a('0x64'),'createdbyyominame',_0x624a('0x65'),_0x624a('0x66'),_0x624a('0x67'),_0x624a('0x68'),_0x624a('0x69'),_0x624a('0x6a'),_0x624a('0x6b'),_0x624a('0x6c'),_0x624a('0x6d'),_0x624a('0x6e'),'escalatedon',_0x624a('0x6f'),_0x624a('0x70'),_0x624a('0x71'),_0x624a('0x72'),_0x624a('0x73'),_0x624a('0x74'),'lastonholdtime','masteridname',_0x624a('0x75'),_0x624a('0x76'),_0x624a('0x77'),_0x624a('0x78'),_0x624a('0x79'),'modifiedonbehalfbyname',_0x624a('0x7a'),'msdyn_incidenttypename','msdyn_iotalertname',_0x624a('0x7b'),_0x624a('0x7c'),_0x624a('0x7d'),_0x624a('0x7e'),_0x624a('0x7f'),_0x624a('0x80'),_0x624a('0x81'),_0x624a('0x82'),_0x624a('0x83'),_0x624a('0x84'),_0x624a('0x85'),_0x624a('0x86'),_0x624a('0x87'),_0x624a('0x88'),_0x624a('0x89'),_0x624a('0x8a'),'responsiblecontactidyominame','sentimentvalue',_0x624a('0x8b'),_0x624a('0x8c'),_0x624a('0x8d'),'statecode',_0x624a('0x8e'),_0x624a('0x8f'),'ticketnumber',_0x624a('0x90'),'transactioncurrencyidname',_0x624a('0x91'),_0x624a('0x92'),_0x624a('0x93')];var _0x36ec56=_0x2723f6[_0x624a('0x94')](_0x4e76c6);return db[_0x624a('0x2b')][_0x624a('0x4a')]({'where':{'id':_0x46a53f[_0x624a('0x44')]['id']},'attributes':['id',_0x624a('0x95'),_0x624a('0x96'),_0x624a('0x97'),_0x624a('0x98'),'clientId','clientSecret']})['then'](handleEntityNotFound(_0x3f98aa,null))[_0x624a('0x28')](function(_0xcfdf42){if(_0xcfdf42){_0x3f90d0=_0xcfdf42[_0x624a('0x97')];var _0x2c4b27=_0x3f90d0[_0x624a('0x99')](-0x1);if(_0x2c4b27==='/'){_0x3f90d0=_0x3f90d0[_0x624a('0x9a')](0x0,_0x3f90d0[_0x624a('0x9b')](_0x2c4b27));}_0x177619=util['format'](_0x624a('0x9c'),_0x3f90d0);var _0x4e28e8={'method':_0x624a('0x9d'),'uri':_0x624a('0x9e')+_0xcfdf42['tenantId']+'/oauth2/token','form':{'client_id':_0xcfdf42[_0x624a('0x9f')],'resource':_0x3f90d0,'username':_0xcfdf42[_0x624a('0x95')],'password':_0xcfdf42[_0x624a('0x96')],'grant_type':_0x624a('0x96'),'client_secret':_0xcfdf42[_0x624a('0xa0')]},'json':!![]};return rp(_0x4e28e8);}})['then'](function(_0x873010){_0x17c0a8=_0x873010[_0x624a('0xa1')];var _0x39884d={'method':_0x624a('0xa2'),'uri':encodeURI(_0x177619+_0x624a('0xa3')+_0x1c67c7+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x17c0a8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x39884d);})['then'](function(_0x375f19){var _0x2c91ab=_0x375f19['value'][0x0];var _0x645f3c=_0x2c91ab[_0x624a('0xa4')];var _0x3add36={'method':'GET','uri':_0x177619+_0x624a('0xa5')+_0x645f3c+_0x624a('0xa6'),'headers':{'Authorization':_0x624a('0xa7')+_0x17c0a8,'If-None-Match':null,'OData-Version':_0x624a('0xa8')},'json':!![]};return rp(_0x3add36);})['then'](function(_0x577f9a){_0x75b962=_0x577f9a;_0x50033d=_0x75b962['Attributes'];_0x50033d=_[_0x624a('0xa9')](_0x50033d,function(_0x410ec3){return!_0x36ec56[_0x624a('0xaa')](_0x410ec3[_0x624a('0xab')]);});var _0x1ddd16=[];var _0x2e6c31=[];_0x50033d[_0x624a('0xac')](function(_0x434379){if(_0x434379[_0x624a('0xad')]){var _0x9181b4=_0x434379[_0x624a('0xad')][_0x624a('0x9a')](_0x434379[_0x624a('0xad')]['lastIndexOf']('.')+0x1);if(_0x9181b4===_0x624a('0xae')){_0x1ddd16[_0x624a('0xaf')](getSelectList(_0x177619,_0x2de6d6,_0x2e6c31,_0x75b962['MetadataId'],_0x434379[_0x624a('0xa4')],_0x17c0a8));}}});return Promise[_0x624a('0xb0')](_0x1ddd16);})[_0x624a('0x28')](function(_0xa6b97e){_0x3e32b9=_0xa6b97e[0x0];var _0x138545=[];var _0x3ebfec=[];_0x50033d['forEach'](function(_0x3ee775){if(!_[_0x624a('0xb1')](_0x3ee775[_0x624a('0xad')])){var _0x135e95=_0x3ee775['@odata.type'][_0x624a('0x9a')](_0x3ee775[_0x624a('0xad')][_0x624a('0x9b')]('.')+0x1);if(_0x135e95==='BooleanAttributeMetadata'){_0x138545[_0x624a('0xaf')](getBooleanList(_0x177619,_0x2de6d6,_0x3ebfec,_0x75b962['MetadataId'],_0x3ee775[_0x624a('0xa4')],_0x17c0a8));}}});return Promise[_0x624a('0xb0')](_0x138545);})[_0x624a('0x28')](function(_0x3b408a){_0x413e28=_0x3b408a[0x0];var _0x345838=[];var _0x59880c=[];_0x50033d[_0x624a('0xac')](function(_0x2d9b78){if(_0x2d9b78[_0x624a('0xad')]){var _0x1a6082=_0x2d9b78[_0x624a('0xad')]['substring'](_0x2d9b78['@odata.type'][_0x624a('0x9b')]('.')+0x1);if(_0x1a6082===_0x624a('0xb2')||_0x1a6082===_0x624a('0xb3')||_0x1a6082===_0x624a('0xb4')||_0x1a6082==='IntegerAttributeMetadata'||_0x1a6082==='MemoAttributeMetadata'||_0x1a6082===_0x624a('0xb5')||_0x1a6082===_0x624a('0xb6')||_0x1a6082==='EntityNameAttributeMetadata'||_0x1a6082===_0x624a('0xb7')||_0x1a6082===_0x624a('0xb8')){_0x345838[_0x624a('0xaf')](getInputList(_0x177619,_0x2de6d6,_0x1a6082,_0x59880c,_0x75b962[_0x624a('0xa4')],_0x2d9b78['MetadataId'],_0x17c0a8));}}});return Promise[_0x624a('0xb0')](_0x345838);})[_0x624a('0x28')](function(_0x44c050){_0x17b7aa=_0x44c050[0x0];var _0x319a1e=_0x3e32b9[_0x624a('0x94')](_0x413e28)['concat'](_0x17b7aa);var _0x38c891={'count':_0x319a1e[_0x624a('0x46')],'rows':_0x319a1e};return _0x38c891;})[_0x624a('0x28')](respondWithResult(_0x3f98aa,null))[_0x624a('0x43')](function(_0x3a58dc){var _0x2db549=_0x46a53f['query'][_0x624a('0xb9')]?0x1f4:_0x3a58dc[_0x624a('0xba')]||0x1f4;logger[_0x624a('0xbb')](_0x3a58dc[_0x624a('0xbc')]);delete _0x3a58dc['name'];if(_0x2db549===0x191){_0x2db549=0x190;}_0x3f98aa[_0x624a('0x1c')](_0x2db549)[_0x624a('0xbd')](_0x46a53f[_0x624a('0x31')][_0x624a('0xb9')]?{'message':_0x624a('0xbe'),'statusCode':_0x3a58dc[_0x624a('0xba')]}:_0x3a58dc);});};function getSelectList(_0x18ed9a,_0x15cfaa,_0x826673,_0x1c7c55,_0x418413,_0x6e8b2a){var _0x298317={'method':_0x624a('0xa2'),'uri':_0x18ed9a+'EntityDefinitions('+_0x1c7c55+')/Attributes('+_0x418413+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x624a('0xbf'),'headers':{'Authorization':_0x624a('0xa7')+_0x6e8b2a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x298317)['then'](function(_0x8ebda7){var _0x1f0f72=[];var _0x5629e1=_0x8ebda7[_0x624a('0xc0')][_0x624a('0xc1')];_0x5629e1[_0x624a('0xac')](function(_0x45745c){_0x1f0f72[_0x624a('0xaf')]({'name':_0x45745c[_0x624a('0xc2')][_0x624a('0xc3')][_0x624a('0xc2')],'value':String(_0x45745c['Value'])});});var _0x1c4f9b={'id':_0x15cfaa+'_'+_0x8ebda7[_0x624a('0xab')],'name':_0x8ebda7[_0x624a('0xc4')][_0x624a('0xc3')]['Label'],'custom':![],'options':_0x1f0f72};_0x826673[_0x624a('0xaf')](_0x1c4f9b);return _0x826673;});}function getBooleanList(_0x330815,_0xa8d61b,_0xc8d94b,_0xb4bd30,_0x4edc2a,_0x31906b){var _0x28bf53={'method':_0x624a('0xa2'),'uri':_0x330815+_0x624a('0xa5')+_0xb4bd30+_0x624a('0xc5')+_0x4edc2a+_0x624a('0xc6'),'headers':{'Authorization':_0x624a('0xa7')+_0x31906b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x28bf53)[_0x624a('0x28')](function(_0x1d0c36){var _0x49b1f4=[];_0x49b1f4[_0x624a('0xaf')]({'name':_0x1d0c36['OptionSet'][_0x624a('0xc7')][_0x624a('0xc2')][_0x624a('0xc3')]['Label'],'value':_0x624a('0xc8')},{'name':_0x1d0c36['OptionSet'][_0x624a('0xc9')][_0x624a('0xc2')][_0x624a('0xc3')][_0x624a('0xc2')],'value':_0x624a('0xca')});var _0x35d003={'id':_0xa8d61b+'_'+_0x1d0c36[_0x624a('0xab')],'name':_0x1d0c36[_0x624a('0xc4')][_0x624a('0xc3')][_0x624a('0xc2')],'custom':![],'options':_0x49b1f4};_0xc8d94b[_0x624a('0xaf')](_0x35d003);return _0xc8d94b;});}function getInputList(_0x5bdb86,_0x559ba3,_0x1d7e63,_0x58156c,_0x1df59d,_0x7d0ccb,_0x30a7c6){var _0x5ce822={'method':_0x624a('0xa2'),'uri':_0x5bdb86+'EntityDefinitions('+_0x1df59d+_0x624a('0xc5')+_0x7d0ccb+')/Microsoft.Dynamics.CRM.'+_0x1d7e63+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x624a('0xa7')+_0x30a7c6,'If-None-Match':null,'OData-Version':_0x624a('0xa8')},'json':!![]};return rp(_0x5ce822)['then'](function(_0x4e6541){var _0x17e409={'id':_0x559ba3+'_'+_0x4e6541[_0x624a('0xab')],'name':_0x4e6541['DisplayName'][_0x624a('0xc3')]?_0x4e6541[_0x624a('0xc4')][_0x624a('0xc3')]['Label']:_0x4e6541[_0x624a('0xab')],'custom':![],'options':[]};_0x58156c[_0x624a('0xaf')](_0x17e409);return _0x58156c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b30221a..9e3fa13 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(_0xbec444,_0x86b7dd){var _0x1e3bf3=function(_0x32576a){while(--_0x32576a){_0xbec444['push'](_0xbec444['shift']());}};_0x1e3bf3(++_0x86b7dd);}(_0x757a,0xde));var _0xa757=function(_0x404c79,_0x23bfc9){_0x404c79=_0x404c79-0x0;var _0x223400=_0x757a[_0x404c79];return _0x223400;};'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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x3e237d,_0x5229af){var _0x4d7c2=function(_0x28622a){while(--_0x28622a){_0x3e237d['push'](_0x3e237d['shift']());}};_0x4d7c2(++_0x5229af);}(_0x757a,0xde));var _0xa757=function(_0x321e98,_0x17359c){_0x321e98=_0x321e98-0x0;var _0x2892d5=_0x757a[_0x321e98];return _0x2892d5;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index db65efb..bd647eb 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 _0xa691=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','limit','include','map','model','attributes','debug','stringify','ShowDynamics365Account'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa691,0x132));var _0x1a69=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa691[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x1a69('0x0'));var util=require(_0x1a69('0x1'));var moment=require(_0x1a69('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a69('0x3'));var fs=require('fs');var Redis=require(_0x1a69('0x4'));var db=require(_0x1a69('0x5'))['db'];var utils=require(_0x1a69('0x6'));var logger=require(_0x1a69('0x7'))(_0x1a69('0x8'));var config=require('../../config/environment');var jayson=require(_0x1a69('0x9'));var client=jayson[_0x1a69('0xa')][_0x1a69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fe1c3,_0x273aa3,_0x3bf5b5){return new BPromise(function(_0x3b8cfc,_0x3a8a7c){return client['request'](_0x3fe1c3,_0x3bf5b5)[_0x1a69('0xc')](function(_0x53a7c1){logger[_0x1a69('0xd')](_0x1a69('0xe'),_0x273aa3,'request\x20sent');logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x273aa3,_0x1a69('0xf'),JSON['stringify'](_0x53a7c1));if(_0x53a7c1[_0x1a69('0x10')]){if(_0x53a7c1[_0x1a69('0x10')][_0x1a69('0x11')]===0x1f4){logger[_0x1a69('0x10')](_0x1a69('0xe'),_0x273aa3,_0x53a7c1[_0x1a69('0x10')][_0x1a69('0x12')]);return _0x3a8a7c(_0x53a7c1[_0x1a69('0x10')][_0x1a69('0x12')]);}logger[_0x1a69('0x10')](_0x1a69('0xe'),_0x273aa3,_0x53a7c1[_0x1a69('0x10')]['message']);return _0x3b8cfc(_0x53a7c1[_0x1a69('0x10')][_0x1a69('0x12')]);}else{logger[_0x1a69('0xd')](_0x1a69('0xe'),_0x273aa3,_0x1a69('0xf'));_0x3b8cfc(_0x53a7c1[_0x1a69('0x13')]['message']);}})[_0x1a69('0x14')](function(_0x2288e8){logger[_0x1a69('0x10')](_0x1a69('0xe'),_0x273aa3,_0x2288e8);_0x3a8a7c(_0x2288e8);});});}exports[_0x1a69('0x15')]=function(_0xd49c43){var _0x5f7eaf=this;return new Promise(function(_0x4c6d05,_0x55d126){return db[_0x1a69('0x16')][_0x1a69('0x17')]({'raw':_0xd49c43[_0x1a69('0x18')]?_0xd49c43['options']['raw']===undefined?!![]:![]:!![],'where':_0xd49c43['options']?_0xd49c43[_0x1a69('0x18')][_0x1a69('0x19')]||null:null,'attributes':_0xd49c43[_0x1a69('0x18')]?_0xd49c43['options']['attributes']||null:null,'limit':_0xd49c43[_0x1a69('0x18')]?_0xd49c43['options'][_0x1a69('0x1a')]||null:null,'include':_0xd49c43[_0x1a69('0x18')]?_0xd49c43[_0x1a69('0x18')][_0x1a69('0x1b')]?_[_0x1a69('0x1c')](_0xd49c43[_0x1a69('0x18')][_0x1a69('0x1b')],function(_0x510a81){return{'model':db[_0x510a81[_0x1a69('0x1d')]],'as':_0x510a81['as'],'attributes':_0x510a81[_0x1a69('0x1e')],'include':_0x510a81[_0x1a69('0x1b')]?_['map'](_0x510a81[_0x1a69('0x1b')],function(_0x131dfe){return{'model':db[_0x131dfe[_0x1a69('0x1d')]],'as':_0x131dfe['as'],'attributes':_0x131dfe[_0x1a69('0x1e')],'include':_0x131dfe['include']?_[_0x1a69('0x1c')](_0x131dfe[_0x1a69('0x1b')],function(_0x52d064){return{'model':db[_0x52d064['model']],'as':_0x52d064['as'],'attributes':_0x52d064[_0x1a69('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1a69('0xc')](function(_0xa2993a){logger[_0x1a69('0xd')](_0x1a69('0x15'),_0xd49c43);logger[_0x1a69('0x1f')](_0x1a69('0x15'),_0xd49c43,JSON[_0x1a69('0x20')](_0xa2993a));_0x4c6d05(_0xa2993a);})['catch'](function(_0x549360){logger['error'](_0x1a69('0x15'),_0x549360[_0x1a69('0x12')],_0xd49c43);_0x55d126(_0x5f7eaf[_0x1a69('0x10')](0x1f4,_0x549360[_0x1a69('0x12')]));});});};exports[_0x1a69('0x21')]=function(_0x427314){var _0x5b6a76=this;return new Promise(function(_0x53cdea,_0x3b844e){return db[_0x1a69('0x16')]['find']({'raw':_0x427314[_0x1a69('0x18')]?_0x427314[_0x1a69('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x427314[_0x1a69('0x18')]?_0x427314[_0x1a69('0x18')][_0x1a69('0x19')]||null:null,'attributes':_0x427314[_0x1a69('0x18')]?_0x427314[_0x1a69('0x18')][_0x1a69('0x1e')]||null:null,'include':_0x427314[_0x1a69('0x18')]?_0x427314[_0x1a69('0x18')][_0x1a69('0x1b')]?_[_0x1a69('0x1c')](_0x427314['options'][_0x1a69('0x1b')],function(_0x11f694){return{'model':db[_0x11f694[_0x1a69('0x1d')]],'as':_0x11f694['as'],'attributes':_0x11f694[_0x1a69('0x1e')],'include':_0x11f694[_0x1a69('0x1b')]?_['map'](_0x11f694['include'],function(_0x14680a){return{'model':db[_0x14680a['model']],'as':_0x14680a['as'],'attributes':_0x14680a[_0x1a69('0x1e')],'include':_0x14680a[_0x1a69('0x1b')]?_[_0x1a69('0x1c')](_0x14680a[_0x1a69('0x1b')],function(_0x302a25){return{'model':db[_0x302a25[_0x1a69('0x1d')]],'as':_0x302a25['as'],'attributes':_0x302a25['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a69('0xc')](function(_0x49cad9){logger[_0x1a69('0xd')](_0x1a69('0x21'),_0x427314);logger[_0x1a69('0x1f')](_0x1a69('0x21'),_0x427314,JSON[_0x1a69('0x20')](_0x49cad9));_0x53cdea(_0x49cad9);})['catch'](function(_0x1c1a06){logger[_0x1a69('0x10')](_0x1a69('0x21'),_0x1c1a06[_0x1a69('0x12')],_0x427314);_0x3b844e(_0x5b6a76[_0x1a69('0x10')](0x1f4,_0x1c1a06[_0x1a69('0x12')]));});});}; \ No newline at end of file +var _0xd26f=['message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','ShowDynamics365Account','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4673ca,_0x270810){var _0x4ef7a7=function(_0x44b228){while(--_0x44b228){_0x4673ca['push'](_0x4673ca['shift']());}};_0x4ef7a7(++_0x270810);}(_0xd26f,0x131));var _0xfd26=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xd26f[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd26('0x0'));var BPromise=require(_0xfd26('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd26('0x2'));var db=require(_0xfd26('0x3'))['db'];var utils=require(_0xfd26('0x4'));var logger=require(_0xfd26('0x5'))(_0xfd26('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd26('0x7')][_0xfd26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1cb30e,_0x1a4b6d,_0x5efaa4){return new BPromise(function(_0x1a69fa,_0x34bbda){return client['request'](_0x1cb30e,_0x5efaa4)['then'](function(_0x4e5efe){logger[_0xfd26('0x9')](_0xfd26('0xa'),_0x1a4b6d,_0xfd26('0xb'));logger['debug'](_0xfd26('0xc'),_0x1a4b6d,_0xfd26('0xb'),JSON['stringify'](_0x4e5efe));if(_0x4e5efe[_0xfd26('0xd')]){if(_0x4e5efe[_0xfd26('0xd')][_0xfd26('0xe')]===0x1f4){logger[_0xfd26('0xd')](_0xfd26('0xa'),_0x1a4b6d,_0x4e5efe['error'][_0xfd26('0xf')]);return _0x34bbda(_0x4e5efe[_0xfd26('0xd')]['message']);}logger[_0xfd26('0xd')](_0xfd26('0xa'),_0x1a4b6d,_0x4e5efe[_0xfd26('0xd')][_0xfd26('0xf')]);return _0x1a69fa(_0x4e5efe[_0xfd26('0xd')][_0xfd26('0xf')]);}else{logger[_0xfd26('0x9')](_0xfd26('0xa'),_0x1a4b6d,'request\x20sent');_0x1a69fa(_0x4e5efe['result'][_0xfd26('0xf')]);}})[_0xfd26('0x10')](function(_0xbb541f){logger[_0xfd26('0xd')](_0xfd26('0xa'),_0x1a4b6d,_0xbb541f);_0x34bbda(_0xbb541f);});});}exports[_0xfd26('0x11')]=function(_0x193d88){var _0x47fb1a=this;return new Promise(function(_0x4955c0,_0x516f49){return db[_0xfd26('0x12')][_0xfd26('0x13')]({'raw':_0x193d88[_0xfd26('0x14')]?_0x193d88[_0xfd26('0x14')][_0xfd26('0x15')]===undefined?!![]:![]:!![],'where':_0x193d88[_0xfd26('0x14')]?_0x193d88[_0xfd26('0x14')][_0xfd26('0x16')]||null:null,'attributes':_0x193d88[_0xfd26('0x14')]?_0x193d88[_0xfd26('0x14')][_0xfd26('0x17')]||null:null,'limit':_0x193d88[_0xfd26('0x14')]?_0x193d88[_0xfd26('0x14')][_0xfd26('0x18')]||null:null,'include':_0x193d88['options']?_0x193d88[_0xfd26('0x14')][_0xfd26('0x19')]?_[_0xfd26('0x1a')](_0x193d88[_0xfd26('0x14')][_0xfd26('0x19')],function(_0x119398){return{'model':db[_0x119398['model']],'as':_0x119398['as'],'attributes':_0x119398[_0xfd26('0x17')],'include':_0x119398[_0xfd26('0x19')]?_[_0xfd26('0x1a')](_0x119398[_0xfd26('0x19')],function(_0x185b6e){return{'model':db[_0x185b6e[_0xfd26('0x1b')]],'as':_0x185b6e['as'],'attributes':_0x185b6e['attributes'],'include':_0x185b6e[_0xfd26('0x19')]?_[_0xfd26('0x1a')](_0x185b6e[_0xfd26('0x19')],function(_0x21a175){return{'model':db[_0x21a175[_0xfd26('0x1b')]],'as':_0x21a175['as'],'attributes':_0x21a175[_0xfd26('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfd26('0x1c')](function(_0x3b9c07){logger[_0xfd26('0x9')](_0xfd26('0x11'),_0x193d88);logger['debug']('GetDynamics365Account',_0x193d88,JSON[_0xfd26('0x1d')](_0x3b9c07));_0x4955c0(_0x3b9c07);})['catch'](function(_0x3a7b6a){logger['error'](_0xfd26('0x11'),_0x3a7b6a['message'],_0x193d88);_0x516f49(_0x47fb1a[_0xfd26('0xd')](0x1f4,_0x3a7b6a[_0xfd26('0xf')]));});});};exports[_0xfd26('0x1e')]=function(_0x1d3a26){var _0x210362=this;return new Promise(function(_0x4bf4a6,_0xe3ab2){return db[_0xfd26('0x12')][_0xfd26('0x1f')]({'raw':_0x1d3a26[_0xfd26('0x14')]?_0x1d3a26[_0xfd26('0x14')][_0xfd26('0x15')]===undefined?!![]:![]:!![],'where':_0x1d3a26['options']?_0x1d3a26[_0xfd26('0x14')][_0xfd26('0x16')]||null:null,'attributes':_0x1d3a26[_0xfd26('0x14')]?_0x1d3a26[_0xfd26('0x14')]['attributes']||null:null,'include':_0x1d3a26[_0xfd26('0x14')]?_0x1d3a26[_0xfd26('0x14')][_0xfd26('0x19')]?_['map'](_0x1d3a26['options']['include'],function(_0x15c905){return{'model':db[_0x15c905['model']],'as':_0x15c905['as'],'attributes':_0x15c905[_0xfd26('0x17')],'include':_0x15c905[_0xfd26('0x19')]?_[_0xfd26('0x1a')](_0x15c905[_0xfd26('0x19')],function(_0x5c1a8b){return{'model':db[_0x5c1a8b['model']],'as':_0x5c1a8b['as'],'attributes':_0x5c1a8b['attributes'],'include':_0x5c1a8b['include']?_['map'](_0x5c1a8b[_0xfd26('0x19')],function(_0x23deba){return{'model':db[_0x23deba[_0xfd26('0x1b')]],'as':_0x23deba['as'],'attributes':_0x23deba['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd26('0x1c')](function(_0x240887){logger['info'](_0xfd26('0x1e'),_0x1d3a26);logger['debug'](_0xfd26('0x1e'),_0x1d3a26,JSON['stringify'](_0x240887));_0x4bf4a6(_0x240887);})[_0xfd26('0x10')](function(_0x5613ef){logger['error'](_0xfd26('0x1e'),_0x5613ef['message'],_0x1d3a26);_0xe3ab2(_0x210362[_0xfd26('0xd')](0x1f4,_0x5613ef[_0xfd26('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ed218c9..036567c 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 _0x03be=['index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x3612eb,_0x4d1079){var _0x341b04=function(_0x39afa4){while(--_0x39afa4){_0x3612eb['push'](_0x3612eb['shift']());}};_0x341b04(++_0x4d1079);}(_0x03be,0xe8));var _0xe03b=function(_0x3c6655,_0x1325de){_0x3c6655=_0x3c6655-0x0;var _0x340d11=_0x03be[_0x3c6655];return _0x340d11;};'use strict';var multer=require(_0xe03b('0x0'));var util=require(_0xe03b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe03b('0x2'));var router=express[_0xe03b('0x3')]();var fs_extra=require(_0xe03b('0x4'));var auth=require(_0xe03b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe03b('0x6'));var controller=require(_0xe03b('0x7'));router[_0xe03b('0x8')]('/',auth[_0xe03b('0x9')](),controller[_0xe03b('0xa')]);router[_0xe03b('0x8')](_0xe03b('0xb'),auth[_0xe03b('0x9')](),controller['show']);router['get'](_0xe03b('0xc'),auth[_0xe03b('0x9')](),controller[_0xe03b('0xd')]);router[_0xe03b('0x8')](_0xe03b('0xe'),auth[_0xe03b('0x9')](),controller[_0xe03b('0xf')]);router[_0xe03b('0x8')](_0xe03b('0x10'),auth[_0xe03b('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xe03b('0x9')](),controller[_0xe03b('0x11')]);router[_0xe03b('0x12')](_0xe03b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe03b('0x13')](_0xe03b('0xb'),auth[_0xe03b('0x9')](),controller[_0xe03b('0x14')]);module[_0xe03b('0x15')]=router; \ No newline at end of file +var _0x2558=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','get','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x3c2fb1,_0x26cb88){var _0x5b7ef4=function(_0x359d4a){while(--_0x359d4a){_0x3c2fb1['push'](_0x3c2fb1['shift']());}};_0x5b7ef4(++_0x26cb88);}(_0x2558,0x1a0));var _0x8255=function(_0x2ecc19,_0x52ab36){_0x2ecc19=_0x2ecc19-0x0;var _0x26bd96=_0x2558[_0x2ecc19];return _0x26bd96;};'use strict';var multer=require('multer');var util=require(_0x8255('0x0'));var path=require(_0x8255('0x1'));var timeout=require(_0x8255('0x2'));var express=require(_0x8255('0x3'));var router=express[_0x8255('0x4')]();var fs_extra=require(_0x8255('0x5'));var auth=require(_0x8255('0x6'));var interaction=require(_0x8255('0x7'));var config=require(_0x8255('0x8'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8255('0x9')]);router['get'](_0x8255('0xa'),auth[_0x8255('0xb')](),controller[_0x8255('0xc')]);router['get']('/:id/fields',auth[_0x8255('0xb')](),controller['getFields']);router[_0x8255('0xd')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8255('0xe')]);router[_0x8255('0xd')](_0x8255('0xf'),auth[_0x8255('0xb')](),controller[_0x8255('0x10')]);router[_0x8255('0x11')]('/',auth[_0x8255('0xb')](),controller[_0x8255('0x12')]);router[_0x8255('0x13')](_0x8255('0xa'),auth[_0x8255('0xb')](),controller[_0x8255('0x14')]);router['delete'](_0x8255('0xa'),auth[_0x8255('0xb')](),controller[_0x8255('0x15')]);module[_0x8255('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f5dc4a7..a162ce0 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 _0xd284=['phonecall','incident','exports','STRING','ENUM'];(function(_0x2529fc,_0x3594c4){var _0x3e393f=function(_0x5ed397){while(--_0x5ed397){_0x2529fc['push'](_0x2529fc['shift']());}};_0x3e393f(++_0x3594c4);}(_0xd284,0xfc));var _0x4d28=function(_0x5fdb09,_0x39b760){_0x5fdb09=_0x5fdb09-0x0;var _0x16ea25=_0xd284[_0x5fdb09];return _0x16ea25;};'use strict';var Sequelize=require('sequelize');module[_0x4d28('0x0')]={'name':{'type':Sequelize[_0x4d28('0x1')]},'description':{'type':Sequelize[_0x4d28('0x1')]},'ticketType':{'type':Sequelize[_0x4d28('0x2')]('incident',_0x4d28('0x3')),'defaultValue':_0x4d28('0x4')}}; \ No newline at end of file +var _0x18a4=['incident','phonecall','STRING'];(function(_0x599a74,_0x34bb1e){var _0x5c7d9f=function(_0x45ae0b){while(--_0x45ae0b){_0x599a74['push'](_0x599a74['shift']());}};_0x5c7d9f(++_0x34bb1e);}(_0x18a4,0x188));var _0x418a=function(_0xa756e8,_0x49b65f){_0xa756e8=_0xa756e8-0x0;var _0x3c57ca=_0x18a4[_0xa756e8];return _0x3c57ca;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x418a('0x0')]},'description':{'type':Sequelize[_0x418a('0x0')]},'ticketType':{'type':Sequelize['ENUM'](_0x418a('0x1'),_0x418a('0x2')),'defaultValue':_0x418a('0x1')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c20f67b..ee04d28 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 _0xf623=['Dynamics365Configuration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','create','body','find','params','findOne','Dynamics365Field','keys','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x38e91c,_0xfabacb){var _0x5cff08=function(_0x32448d){while(--_0x32448d){_0x38e91c['push'](_0x38e91c['shift']());}};_0x5cff08(++_0xfabacb);}(_0xf623,0x1b3));var _0x3f62=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0xf623[_0x13ac10];return _0x28eda2;};'use strict';var emlformat=require(_0x3f62('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f62('0x1'));var jsonpatch=require(_0x3f62('0x2'));var rp=require(_0x3f62('0x3'));var moment=require(_0x3f62('0x4'));var BPromise=require(_0x3f62('0x5'));var Mustache=require(_0x3f62('0x6'));var util=require('util');var path=require(_0x3f62('0x7'));var sox=require('sox');var csv=require(_0x3f62('0x8'));var ejs=require(_0x3f62('0x9'));var fs=require('fs');var fs_extra=require(_0x3f62('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3f62('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3f62('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f62('0xd'));var Papa=require(_0x3f62('0xe'));var Redis=require(_0x3f62('0xf'));var authService=require(_0x3f62('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3f62('0x11'));var hardwareService=require(_0x3f62('0x12'));var logger=require(_0x3f62('0x13'))(_0x3f62('0x14'));var utils=require('../../config/utils');var config=require(_0x3f62('0x15'));var licenseUtil=require(_0x3f62('0x16'));var db=require(_0x3f62('0x17'))['db'];function respondWithStatusCode(_0x125efa,_0x3d77fa){_0x3d77fa=_0x3d77fa||0xcc;return function(_0x3e6ff0){if(_0x3e6ff0){return _0x125efa[_0x3f62('0x18')](_0x3d77fa);}return _0x125efa[_0x3f62('0x19')](_0x3d77fa)[_0x3f62('0x1a')]();};}function respondWithResult(_0x3803b6,_0x43cff8){_0x43cff8=_0x43cff8||0xc8;return function(_0x3d39ae){if(_0x3d39ae){return _0x3803b6['status'](_0x43cff8)[_0x3f62('0x1b')](_0x3d39ae);}};}function respondWithFilteredResult(_0xa3ee47,_0x3b2ec1){return function(_0x5b434e){if(_0x5b434e){var _0x53e87b=typeof _0x3b2ec1[_0x3f62('0x1c')]===_0x3f62('0x1d')&&typeof _0x3b2ec1[_0x3f62('0x1e')]===_0x3f62('0x1d');var _0x4ea11c=_0x5b434e[_0x3f62('0x1f')];var _0x5aec38=_0x53e87b?0x0:_0x3b2ec1['offset'];var _0x15b80e=_0x53e87b?_0x5b434e['count']:_0x3b2ec1['offset']+_0x3b2ec1[_0x3f62('0x1e')];var _0x654c11;if(_0x15b80e>=_0x4ea11c){_0x15b80e=_0x4ea11c;_0x654c11=0xc8;}else{_0x654c11=0xce;}_0xa3ee47['status'](_0x654c11);return _0xa3ee47['set'](_0x3f62('0x20'),_0x5aec38+'-'+_0x15b80e+'/'+_0x4ea11c)[_0x3f62('0x1b')](_0x5b434e);}return null;};}function patchUpdates(_0x2e1d1f){return function(_0x55daa7){try{jsonpatch[_0x3f62('0x21')](_0x55daa7,_0x2e1d1f,!![]);}catch(_0x27ff8d){return BPromise[_0x3f62('0x22')](_0x27ff8d);}return _0x55daa7[_0x3f62('0x23')]();};}function saveUpdates(_0x2bbde9,_0x51d396){return function(_0x2ea1f4){if(_0x2ea1f4){return _0x2ea1f4[_0x3f62('0x24')](_0x2bbde9)[_0x3f62('0x25')](function(_0x150c37){return _0x150c37;});}return null;};}function removeEntity(_0x1a9e84,_0x4b753e){return function(_0x5d9277){if(_0x5d9277){return _0x5d9277[_0x3f62('0x26')]()['then'](function(){_0x1a9e84[_0x3f62('0x19')](0xcc)[_0x3f62('0x1a')]();});}};}function handleEntityNotFound(_0x4765eb,_0x4743b5){return function(_0x1cf820){if(!_0x1cf820){_0x4765eb[_0x3f62('0x18')](0x194);}return _0x1cf820;};}function handleError(_0x4f0c9d,_0x2517be){_0x2517be=_0x2517be||0x1f4;return function(_0x4753d4){logger[_0x3f62('0x27')](_0x4753d4[_0x3f62('0x28')]);if(_0x4753d4[_0x3f62('0x29')]){delete _0x4753d4[_0x3f62('0x29')];}_0x4f0c9d[_0x3f62('0x19')](_0x2517be)[_0x3f62('0x2a')](_0x4753d4);};}exports[_0x3f62('0x2b')]=function(_0x1dd609,_0x563b3a){var _0x31f99f={},_0x233ed6={},_0x5dfc4a={'count':0x0,'rows':[]};var _0x19bc91=_[_0x3f62('0x2c')](db[_0x3f62('0x2d')][_0x3f62('0x2e')],function(_0x31054d){return{'name':_0x31054d[_0x3f62('0x2f')],'type':_0x31054d['type'][_0x3f62('0x30')]};});_0x233ed6[_0x3f62('0x31')]=_[_0x3f62('0x2c')](_0x19bc91,_0x3f62('0x29'));_0x233ed6['query']=_['keys'](_0x1dd609[_0x3f62('0x32')]);_0x233ed6[_0x3f62('0x33')]=_['intersection'](_0x233ed6[_0x3f62('0x31')],_0x233ed6[_0x3f62('0x32')]);_0x31f99f[_0x3f62('0x34')]=_[_0x3f62('0x35')](_0x233ed6[_0x3f62('0x31')],qs[_0x3f62('0x36')](_0x1dd609['query'][_0x3f62('0x36')]));_0x31f99f[_0x3f62('0x34')]=_0x31f99f[_0x3f62('0x34')][_0x3f62('0x37')]?_0x31f99f['attributes']:_0x233ed6['model'];if(!_0x1dd609[_0x3f62('0x32')][_0x3f62('0x38')](_0x3f62('0x39'))){_0x31f99f[_0x3f62('0x1e')]=qs[_0x3f62('0x1e')](_0x1dd609[_0x3f62('0x32')][_0x3f62('0x1e')]);_0x31f99f[_0x3f62('0x1c')]=qs[_0x3f62('0x1c')](_0x1dd609[_0x3f62('0x32')][_0x3f62('0x1c')]);}_0x31f99f[_0x3f62('0x3a')]=qs[_0x3f62('0x3b')](_0x1dd609['query']['sort']);_0x31f99f[_0x3f62('0x3c')]=qs[_0x3f62('0x33')](_[_0x3f62('0x3d')](_0x1dd609[_0x3f62('0x32')],_0x233ed6[_0x3f62('0x33')]),_0x19bc91);if(_0x1dd609[_0x3f62('0x32')][_0x3f62('0x3e')]){_0x31f99f['where']=_[_0x3f62('0x3f')](_0x31f99f[_0x3f62('0x3c')],{'$or':_['map'](_0x19bc91,function(_0x2b65b9){if(_0x2b65b9['type']!=='VIRTUAL'){var _0x428ebe={};_0x428ebe[_0x2b65b9[_0x3f62('0x29')]]={'$like':'%'+_0x1dd609[_0x3f62('0x32')][_0x3f62('0x3e')]+'%'};return _0x428ebe;}})});}_0x31f99f=_[_0x3f62('0x3f')]({},_0x31f99f,_0x1dd609[_0x3f62('0x40')]);var _0x3a754c={'where':_0x31f99f['where']};return db[_0x3f62('0x2d')]['count'](_0x3a754c)['then'](function(_0x4015b9){_0x5dfc4a[_0x3f62('0x1f')]=_0x4015b9;if(_0x1dd609[_0x3f62('0x32')][_0x3f62('0x41')]){_0x31f99f[_0x3f62('0x42')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x3f62('0x43')](_0x31f99f);})[_0x3f62('0x25')](function(_0x3176af){_0x5dfc4a['rows']=_0x3176af;return _0x5dfc4a;})[_0x3f62('0x25')](respondWithFilteredResult(_0x563b3a,_0x31f99f))[_0x3f62('0x44')](handleError(_0x563b3a,null));};exports[_0x3f62('0x45')]=function(_0x71c22c,_0x59fbae){var _0x338240={'raw':![],'where':{'id':_0x71c22c['params']['id']}},_0x4a61c3={};_0x4a61c3[_0x3f62('0x31')]=_['keys'](db[_0x3f62('0x2d')][_0x3f62('0x2e')]);_0x4a61c3[_0x3f62('0x32')]=_['keys'](_0x71c22c[_0x3f62('0x32')]);_0x4a61c3[_0x3f62('0x33')]=_[_0x3f62('0x35')](_0x4a61c3[_0x3f62('0x31')],_0x4a61c3[_0x3f62('0x32')]);_0x338240['attributes']=_[_0x3f62('0x35')](_0x4a61c3[_0x3f62('0x31')],qs['fields'](_0x71c22c[_0x3f62('0x32')][_0x3f62('0x36')]));_0x338240[_0x3f62('0x34')]=_0x338240[_0x3f62('0x34')]['length']?_0x338240[_0x3f62('0x34')]:_0x4a61c3[_0x3f62('0x31')];if(_0x71c22c[_0x3f62('0x32')][_0x3f62('0x41')]){_0x338240['include']=[{'all':!![]}];}_0x338240=_[_0x3f62('0x3f')]({},_0x338240,_0x71c22c[_0x3f62('0x40')]);return db[_0x3f62('0x2d')]['find'](_0x338240)[_0x3f62('0x25')](handleEntityNotFound(_0x59fbae,null))[_0x3f62('0x25')](respondWithResult(_0x59fbae,null))[_0x3f62('0x44')](handleError(_0x59fbae,null));};exports['create']=function(_0x1b27a8,_0x506c79){return db['Dynamics365Configuration'][_0x3f62('0x46')](_0x1b27a8['body'],{})[_0x3f62('0x25')](respondWithResult(_0x506c79,0xc9))[_0x3f62('0x44')](handleError(_0x506c79,null));};exports['update']=function(_0x56effb,_0xdb3225){if(_0x56effb[_0x3f62('0x47')]['id']){delete _0x56effb[_0x3f62('0x47')]['id'];}return db['Dynamics365Configuration'][_0x3f62('0x48')]({'where':{'id':_0x56effb[_0x3f62('0x49')]['id']}})[_0x3f62('0x25')](handleEntityNotFound(_0xdb3225,null))['then'](saveUpdates(_0x56effb[_0x3f62('0x47')],null))[_0x3f62('0x25')](respondWithResult(_0xdb3225,null))['catch'](handleError(_0xdb3225,null));};exports[_0x3f62('0x26')]=function(_0x31073b,_0xe721a8){return db[_0x3f62('0x2d')]['find']({'where':{'id':_0x31073b['params']['id']}})[_0x3f62('0x25')](handleEntityNotFound(_0xe721a8,null))[_0x3f62('0x25')](removeEntity(_0xe721a8,null))['catch'](handleError(_0xe721a8,null));};exports['getFields']=function(_0x3b471c,_0x31d709,_0x360981){var _0xa31939={};var _0x521c75={};var _0x1ac05a;var _0xaf8c07;return db['Dynamics365Configuration'][_0x3f62('0x4a')]({'where':{'id':_0x3b471c[_0x3f62('0x49')]['id']}})['then'](handleEntityNotFound(_0x31d709,null))[_0x3f62('0x25')](function(_0x4a4439){if(_0x4a4439){_0x1ac05a=_0x4a4439;_0x521c75[_0x3f62('0x31')]=_['keys'](db[_0x3f62('0x4b')][_0x3f62('0x2e')]);_0x521c75[_0x3f62('0x32')]=_[_0x3f62('0x4c')](_0x3b471c[_0x3f62('0x32')]);_0x521c75[_0x3f62('0x33')]=_[_0x3f62('0x35')](_0x521c75[_0x3f62('0x31')],_0x521c75[_0x3f62('0x32')]);_0xa31939[_0x3f62('0x34')]=_[_0x3f62('0x35')](_0x521c75[_0x3f62('0x31')],qs['fields'](_0x3b471c['query'][_0x3f62('0x36')]));_0xa31939[_0x3f62('0x34')]=_0xa31939[_0x3f62('0x34')][_0x3f62('0x37')]?_0xa31939[_0x3f62('0x34')]:_0x521c75['model'];_0xa31939[_0x3f62('0x3a')]=qs['sort'](_0x3b471c[_0x3f62('0x32')][_0x3f62('0x3b')]);_0xa31939[_0x3f62('0x3c')]=qs[_0x3f62('0x33')](_[_0x3f62('0x3d')](_0x3b471c['query'],_0x521c75[_0x3f62('0x33')]));if(_0x3b471c[_0x3f62('0x32')][_0x3f62('0x3e')]){_0xa31939[_0x3f62('0x3c')]=_[_0x3f62('0x3f')](_0xa31939[_0x3f62('0x3c')],{'$or':_[_0x3f62('0x2c')](_0xa31939[_0x3f62('0x34')],function(_0x21d829){var _0x2d1b9b={};_0x2d1b9b[_0x21d829]={'$like':'%'+_0x3b471c[_0x3f62('0x32')][_0x3f62('0x3e')]+'%'};return _0x2d1b9b;})});}_0xa31939=_['merge']({},_0xa31939,_0x3b471c['options']);return _0x1ac05a[_0x3f62('0x4d')](_0xa31939);}})['then'](function(_0x42a696){if(_0x42a696){_0xaf8c07=_0x42a696[_0x3f62('0x37')];if(!_0x3b471c[_0x3f62('0x32')][_0x3f62('0x38')]('nolimit')){_0xa31939[_0x3f62('0x1e')]=qs['limit'](_0x3b471c[_0x3f62('0x32')][_0x3f62('0x1e')]);_0xa31939[_0x3f62('0x1c')]=qs['offset'](_0x3b471c[_0x3f62('0x32')][_0x3f62('0x1c')]);}return _0x1ac05a['getFields'](_0xa31939);}})[_0x3f62('0x25')](function(_0x1976e0){if(_0x1976e0){return _0x1976e0?{'count':_0xaf8c07,'rows':_0x1976e0}:null;}})[_0x3f62('0x25')](respondWithResult(_0x31d709,null))['catch'](handleError(_0x31d709,null));};exports[_0x3f62('0x4e')]=function(_0xfb97b4,_0x44e5c5,_0xef9f1){var _0x538824={};var _0x44723c={};var _0x4d7840;var _0x4b7cfd;return db[_0x3f62('0x2d')]['findOne']({'where':{'id':_0xfb97b4['params']['id']}})[_0x3f62('0x25')](handleEntityNotFound(_0x44e5c5,null))[_0x3f62('0x25')](function(_0x3c54b8){if(_0x3c54b8){_0x4d7840=_0x3c54b8;_0x44723c[_0x3f62('0x31')]=_[_0x3f62('0x4c')](db[_0x3f62('0x4b')]['rawAttributes']);_0x44723c[_0x3f62('0x32')]=_[_0x3f62('0x4c')](_0xfb97b4['query']);_0x44723c[_0x3f62('0x33')]=_[_0x3f62('0x35')](_0x44723c['model'],_0x44723c['query']);_0x538824['attributes']=_[_0x3f62('0x35')](_0x44723c['model'],qs[_0x3f62('0x36')](_0xfb97b4[_0x3f62('0x32')][_0x3f62('0x36')]));_0x538824[_0x3f62('0x34')]=_0x538824[_0x3f62('0x34')]['length']?_0x538824['attributes']:_0x44723c[_0x3f62('0x31')];_0x538824[_0x3f62('0x3a')]=qs[_0x3f62('0x3b')](_0xfb97b4['query'][_0x3f62('0x3b')]);_0x538824[_0x3f62('0x3c')]=qs[_0x3f62('0x33')](_[_0x3f62('0x3d')](_0xfb97b4[_0x3f62('0x32')],_0x44723c['filters']));if(_0xfb97b4[_0x3f62('0x32')][_0x3f62('0x3e')]){_0x538824['where']=_[_0x3f62('0x3f')](_0x538824[_0x3f62('0x3c')],{'$or':_['map'](_0x538824['attributes'],function(_0x1794c4){var _0x4525aa={};_0x4525aa[_0x1794c4]={'$like':'%'+_0xfb97b4[_0x3f62('0x32')][_0x3f62('0x3e')]+'%'};return _0x4525aa;})});}_0x538824=_[_0x3f62('0x3f')]({},_0x538824,_0xfb97b4[_0x3f62('0x40')]);return _0x4d7840[_0x3f62('0x4e')](_0x538824);}})[_0x3f62('0x25')](function(_0x198246){if(_0x198246){_0x4b7cfd=_0x198246['length'];if(!_0xfb97b4['query'][_0x3f62('0x38')]('nolimit')){_0x538824[_0x3f62('0x1e')]=qs['limit'](_0xfb97b4[_0x3f62('0x32')]['limit']);_0x538824[_0x3f62('0x1c')]=qs[_0x3f62('0x1c')](_0xfb97b4[_0x3f62('0x32')][_0x3f62('0x1c')]);}return _0x4d7840['getSubjects'](_0x538824);}})['then'](function(_0x3c88d4){if(_0x3c88d4){return _0x3c88d4?{'count':_0x4b7cfd,'rows':_0x3c88d4}:null;}})[_0x3f62('0x25')](respondWithResult(_0x44e5c5,null))[_0x3f62('0x44')](handleError(_0x44e5c5,null));};exports[_0x3f62('0x4f')]=function(_0x1e3cb3,_0x4a796b,_0x3380a4){var _0x51071c={};var _0x4d6e9a={};var _0x47b1f0;var _0x18eddb;return db[_0x3f62('0x2d')]['findOne']({'where':{'id':_0x1e3cb3['params']['id']}})[_0x3f62('0x25')](handleEntityNotFound(_0x4a796b,null))[_0x3f62('0x25')](function(_0x6811dd){if(_0x6811dd){_0x47b1f0=_0x6811dd;_0x4d6e9a['model']=_[_0x3f62('0x4c')](db[_0x3f62('0x4b')][_0x3f62('0x2e')]);_0x4d6e9a[_0x3f62('0x32')]=_['keys'](_0x1e3cb3['query']);_0x4d6e9a[_0x3f62('0x33')]=_[_0x3f62('0x35')](_0x4d6e9a[_0x3f62('0x31')],_0x4d6e9a[_0x3f62('0x32')]);_0x51071c[_0x3f62('0x34')]=_[_0x3f62('0x35')](_0x4d6e9a[_0x3f62('0x31')],qs[_0x3f62('0x36')](_0x1e3cb3['query'][_0x3f62('0x36')]));_0x51071c[_0x3f62('0x34')]=_0x51071c[_0x3f62('0x34')][_0x3f62('0x37')]?_0x51071c[_0x3f62('0x34')]:_0x4d6e9a[_0x3f62('0x31')];_0x51071c[_0x3f62('0x3a')]=qs[_0x3f62('0x3b')](_0x1e3cb3[_0x3f62('0x32')]['sort']);_0x51071c['where']=qs[_0x3f62('0x33')](_[_0x3f62('0x3d')](_0x1e3cb3[_0x3f62('0x32')],_0x4d6e9a[_0x3f62('0x33')]));if(_0x1e3cb3[_0x3f62('0x32')][_0x3f62('0x3e')]){_0x51071c['where']=_[_0x3f62('0x3f')](_0x51071c['where'],{'$or':_[_0x3f62('0x2c')](_0x51071c[_0x3f62('0x34')],function(_0x5c44ca){var _0x1e3db1={};_0x1e3db1[_0x5c44ca]={'$like':'%'+_0x1e3cb3[_0x3f62('0x32')][_0x3f62('0x3e')]+'%'};return _0x1e3db1;})});}_0x51071c=_[_0x3f62('0x3f')]({},_0x51071c,_0x1e3cb3[_0x3f62('0x40')]);return _0x47b1f0[_0x3f62('0x4f')](_0x51071c);}})[_0x3f62('0x25')](function(_0x2c9ae4){if(_0x2c9ae4){_0x18eddb=_0x2c9ae4[_0x3f62('0x37')];if(!_0x1e3cb3[_0x3f62('0x32')][_0x3f62('0x38')]('nolimit')){_0x51071c[_0x3f62('0x1e')]=qs[_0x3f62('0x1e')](_0x1e3cb3['query'][_0x3f62('0x1e')]);_0x51071c[_0x3f62('0x1c')]=qs['offset'](_0x1e3cb3[_0x3f62('0x32')][_0x3f62('0x1c')]);}return _0x47b1f0[_0x3f62('0x4f')](_0x51071c);}})[_0x3f62('0x25')](function(_0x53e3bc){if(_0x53e3bc){return _0x53e3bc?{'count':_0x18eddb,'rows':_0x53e3bc}:null;}})[_0x3f62('0x25')](respondWithResult(_0x4a796b,null))[_0x3f62('0x44')](handleError(_0x4a796b,null));}; \ No newline at end of file +var _0x1aa5=['offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','Dynamics365Configuration','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','getFields','findOne','Dynamics365Field','order','getSubjects','nolimit','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x511e04,_0x237dab){var _0x2b1b1c=function(_0x4b7411){while(--_0x4b7411){_0x511e04['push'](_0x511e04['shift']());}};_0x2b1b1c(++_0x237dab);}(_0x1aa5,0x85));var _0x51aa=function(_0x544d0d,_0x4182b8){_0x544d0d=_0x544d0d-0x0;var _0x305339=_0x1aa5[_0x544d0d];return _0x305339;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51aa('0x0'));var zipdir=require(_0x51aa('0x1'));var jsonpatch=require(_0x51aa('0x2'));var rp=require(_0x51aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51aa('0x4'));var util=require('util');var path=require(_0x51aa('0x5'));var sox=require(_0x51aa('0x6'));var csv=require(_0x51aa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51aa('0x8'));var _=require(_0x51aa('0x9'));var squel=require('squel');var crypto=require(_0x51aa('0xa'));var jsforce=require(_0x51aa('0xb'));var deskjs=require(_0x51aa('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51aa('0xd'));var Redis=require(_0x51aa('0xe'));var authService=require(_0x51aa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x51aa('0x10'));var hardwareService=require(_0x51aa('0x11'));var logger=require(_0x51aa('0x12'))(_0x51aa('0x13'));var utils=require('../../config/utils');var config=require(_0x51aa('0x14'));var licenseUtil=require(_0x51aa('0x15'));var db=require(_0x51aa('0x16'))['db'];function respondWithStatusCode(_0x20fe24,_0x51a851){_0x51a851=_0x51a851||0xcc;return function(_0xfad8fd){if(_0xfad8fd){return _0x20fe24[_0x51aa('0x17')](_0x51a851);}return _0x20fe24[_0x51aa('0x18')](_0x51a851)[_0x51aa('0x19')]();};}function respondWithResult(_0x939a69,_0x4925ce){_0x4925ce=_0x4925ce||0xc8;return function(_0x37eb22){if(_0x37eb22){return _0x939a69['status'](_0x4925ce)[_0x51aa('0x1a')](_0x37eb22);}};}function respondWithFilteredResult(_0x241d17,_0x55cc54){return function(_0x413fc9){if(_0x413fc9){var _0x775ea7=typeof _0x55cc54[_0x51aa('0x1b')]===_0x51aa('0x1c')&&typeof _0x55cc54['limit']===_0x51aa('0x1c');var _0x35a531=_0x413fc9[_0x51aa('0x1d')];var _0x4cabec=_0x775ea7?0x0:_0x55cc54[_0x51aa('0x1b')];var _0x3eb445=_0x775ea7?_0x413fc9[_0x51aa('0x1d')]:_0x55cc54['offset']+_0x55cc54[_0x51aa('0x1e')];var _0x59fbc4;if(_0x3eb445>=_0x35a531){_0x3eb445=_0x35a531;_0x59fbc4=0xc8;}else{_0x59fbc4=0xce;}_0x241d17[_0x51aa('0x18')](_0x59fbc4);return _0x241d17[_0x51aa('0x1f')](_0x51aa('0x20'),_0x4cabec+'-'+_0x3eb445+'/'+_0x35a531)[_0x51aa('0x1a')](_0x413fc9);}return null;};}function patchUpdates(_0x3d7b91){return function(_0x1df4f4){try{jsonpatch[_0x51aa('0x21')](_0x1df4f4,_0x3d7b91,!![]);}catch(_0x4ddc68){return BPromise[_0x51aa('0x22')](_0x4ddc68);}return _0x1df4f4['save']();};}function saveUpdates(_0x556c85,_0x1d47a1){return function(_0x291ee4){if(_0x291ee4){return _0x291ee4[_0x51aa('0x23')](_0x556c85)[_0x51aa('0x24')](function(_0xb132e7){return _0xb132e7;});}return null;};}function removeEntity(_0x1da364,_0x2f6127){return function(_0x42c74a){if(_0x42c74a){return _0x42c74a[_0x51aa('0x25')]()[_0x51aa('0x24')](function(){_0x1da364['status'](0xcc)[_0x51aa('0x19')]();});}};}function handleEntityNotFound(_0x43e075,_0x486df9){return function(_0x2bb3a8){if(!_0x2bb3a8){_0x43e075['sendStatus'](0x194);}return _0x2bb3a8;};}function handleError(_0x2d54aa,_0x317cc8){_0x317cc8=_0x317cc8||0x1f4;return function(_0x36b46e){logger['error'](_0x36b46e[_0x51aa('0x26')]);if(_0x36b46e[_0x51aa('0x27')]){delete _0x36b46e[_0x51aa('0x27')];}_0x2d54aa[_0x51aa('0x18')](_0x317cc8)[_0x51aa('0x28')](_0x36b46e);};}exports['index']=function(_0x492cb8,_0x30fcfc){var _0x169d69={},_0x522feb={},_0x3ac93e={'count':0x0,'rows':[]};var _0x35fab4=_[_0x51aa('0x29')](db['Dynamics365Configuration'][_0x51aa('0x2a')],function(_0xfe1dbd){return{'name':_0xfe1dbd[_0x51aa('0x2b')],'type':_0xfe1dbd[_0x51aa('0x2c')][_0x51aa('0x2d')]};});_0x522feb[_0x51aa('0x2e')]=_[_0x51aa('0x29')](_0x35fab4,_0x51aa('0x27'));_0x522feb[_0x51aa('0x2f')]=_['keys'](_0x492cb8[_0x51aa('0x2f')]);_0x522feb['filters']=_['intersection'](_0x522feb[_0x51aa('0x2e')],_0x522feb['query']);_0x169d69[_0x51aa('0x30')]=_[_0x51aa('0x31')](_0x522feb['model'],qs[_0x51aa('0x32')](_0x492cb8[_0x51aa('0x2f')][_0x51aa('0x32')]));_0x169d69[_0x51aa('0x30')]=_0x169d69[_0x51aa('0x30')][_0x51aa('0x33')]?_0x169d69[_0x51aa('0x30')]:_0x522feb[_0x51aa('0x2e')];if(!_0x492cb8[_0x51aa('0x2f')][_0x51aa('0x34')]('nolimit')){_0x169d69[_0x51aa('0x1e')]=qs[_0x51aa('0x1e')](_0x492cb8[_0x51aa('0x2f')][_0x51aa('0x1e')]);_0x169d69[_0x51aa('0x1b')]=qs[_0x51aa('0x1b')](_0x492cb8['query'][_0x51aa('0x1b')]);}_0x169d69['order']=qs[_0x51aa('0x35')](_0x492cb8[_0x51aa('0x2f')]['sort']);_0x169d69[_0x51aa('0x36')]=qs['filters'](_[_0x51aa('0x37')](_0x492cb8['query'],_0x522feb[_0x51aa('0x38')]),_0x35fab4);if(_0x492cb8[_0x51aa('0x2f')][_0x51aa('0x39')]){_0x169d69[_0x51aa('0x36')]=_[_0x51aa('0x3a')](_0x169d69['where'],{'$or':_[_0x51aa('0x29')](_0x35fab4,function(_0x8a4063){if(_0x8a4063[_0x51aa('0x2c')]!==_0x51aa('0x3b')){var _0x1a074a={};_0x1a074a[_0x8a4063[_0x51aa('0x27')]]={'$like':'%'+_0x492cb8[_0x51aa('0x2f')][_0x51aa('0x39')]+'%'};return _0x1a074a;}})});}_0x169d69=_[_0x51aa('0x3a')]({},_0x169d69,_0x492cb8['options']);var _0x10ad8a={'where':_0x169d69[_0x51aa('0x36')]};return db[_0x51aa('0x3c')][_0x51aa('0x1d')](_0x10ad8a)[_0x51aa('0x24')](function(_0x432bd9){_0x3ac93e[_0x51aa('0x1d')]=_0x432bd9;if(_0x492cb8['query'][_0x51aa('0x3d')]){_0x169d69['include']=[{'all':!![]}];}return db[_0x51aa('0x3c')][_0x51aa('0x3e')](_0x169d69);})[_0x51aa('0x24')](function(_0x46e264){_0x3ac93e[_0x51aa('0x3f')]=_0x46e264;return _0x3ac93e;})['then'](respondWithFilteredResult(_0x30fcfc,_0x169d69))[_0x51aa('0x40')](handleError(_0x30fcfc,null));};exports[_0x51aa('0x41')]=function(_0x2f441a,_0x127aeb){var _0x23eeca={'raw':![],'where':{'id':_0x2f441a[_0x51aa('0x42')]['id']}},_0x50f141={};_0x50f141['model']=_[_0x51aa('0x43')](db[_0x51aa('0x3c')][_0x51aa('0x2a')]);_0x50f141[_0x51aa('0x2f')]=_['keys'](_0x2f441a[_0x51aa('0x2f')]);_0x50f141[_0x51aa('0x38')]=_[_0x51aa('0x31')](_0x50f141['model'],_0x50f141[_0x51aa('0x2f')]);_0x23eeca[_0x51aa('0x30')]=_[_0x51aa('0x31')](_0x50f141[_0x51aa('0x2e')],qs[_0x51aa('0x32')](_0x2f441a[_0x51aa('0x2f')]['fields']));_0x23eeca['attributes']=_0x23eeca['attributes']['length']?_0x23eeca[_0x51aa('0x30')]:_0x50f141[_0x51aa('0x2e')];if(_0x2f441a[_0x51aa('0x2f')][_0x51aa('0x3d')]){_0x23eeca[_0x51aa('0x44')]=[{'all':!![]}];}_0x23eeca=_[_0x51aa('0x3a')]({},_0x23eeca,_0x2f441a[_0x51aa('0x45')]);return db[_0x51aa('0x3c')][_0x51aa('0x46')](_0x23eeca)[_0x51aa('0x24')](handleEntityNotFound(_0x127aeb,null))[_0x51aa('0x24')](respondWithResult(_0x127aeb,null))[_0x51aa('0x40')](handleError(_0x127aeb,null));};exports[_0x51aa('0x47')]=function(_0x380091,_0x161e3d){return db[_0x51aa('0x3c')][_0x51aa('0x47')](_0x380091[_0x51aa('0x48')],{})['then'](respondWithResult(_0x161e3d,0xc9))[_0x51aa('0x40')](handleError(_0x161e3d,null));};exports[_0x51aa('0x23')]=function(_0x311b6a,_0x38968a){if(_0x311b6a['body']['id']){delete _0x311b6a['body']['id'];}return db[_0x51aa('0x3c')][_0x51aa('0x46')]({'where':{'id':_0x311b6a[_0x51aa('0x42')]['id']}})[_0x51aa('0x24')](handleEntityNotFound(_0x38968a,null))[_0x51aa('0x24')](saveUpdates(_0x311b6a[_0x51aa('0x48')],null))[_0x51aa('0x24')](respondWithResult(_0x38968a,null))[_0x51aa('0x40')](handleError(_0x38968a,null));};exports[_0x51aa('0x25')]=function(_0x287034,_0x5b3ecb){return db[_0x51aa('0x3c')][_0x51aa('0x46')]({'where':{'id':_0x287034[_0x51aa('0x42')]['id']}})[_0x51aa('0x24')](handleEntityNotFound(_0x5b3ecb,null))[_0x51aa('0x24')](removeEntity(_0x5b3ecb,null))[_0x51aa('0x40')](handleError(_0x5b3ecb,null));};exports[_0x51aa('0x49')]=function(_0x80122a,_0x3eb688,_0x1bfbbe){var _0x317e34={};var _0xbe867c={};var _0x1ca70d;var _0x58b145;return db[_0x51aa('0x3c')][_0x51aa('0x4a')]({'where':{'id':_0x80122a[_0x51aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x3eb688,null))[_0x51aa('0x24')](function(_0x4748c1){if(_0x4748c1){_0x1ca70d=_0x4748c1;_0xbe867c[_0x51aa('0x2e')]=_[_0x51aa('0x43')](db[_0x51aa('0x4b')]['rawAttributes']);_0xbe867c['query']=_[_0x51aa('0x43')](_0x80122a[_0x51aa('0x2f')]);_0xbe867c['filters']=_['intersection'](_0xbe867c['model'],_0xbe867c[_0x51aa('0x2f')]);_0x317e34[_0x51aa('0x30')]=_[_0x51aa('0x31')](_0xbe867c[_0x51aa('0x2e')],qs[_0x51aa('0x32')](_0x80122a[_0x51aa('0x2f')][_0x51aa('0x32')]));_0x317e34[_0x51aa('0x30')]=_0x317e34[_0x51aa('0x30')][_0x51aa('0x33')]?_0x317e34[_0x51aa('0x30')]:_0xbe867c['model'];_0x317e34[_0x51aa('0x4c')]=qs['sort'](_0x80122a[_0x51aa('0x2f')][_0x51aa('0x35')]);_0x317e34[_0x51aa('0x36')]=qs[_0x51aa('0x38')](_[_0x51aa('0x37')](_0x80122a[_0x51aa('0x2f')],_0xbe867c[_0x51aa('0x38')]));if(_0x80122a[_0x51aa('0x2f')]['filter']){_0x317e34[_0x51aa('0x36')]=_[_0x51aa('0x3a')](_0x317e34[_0x51aa('0x36')],{'$or':_[_0x51aa('0x29')](_0x317e34['attributes'],function(_0x4379bc){var _0x55d6bf={};_0x55d6bf[_0x4379bc]={'$like':'%'+_0x80122a[_0x51aa('0x2f')][_0x51aa('0x39')]+'%'};return _0x55d6bf;})});}_0x317e34=_['merge']({},_0x317e34,_0x80122a['options']);return _0x1ca70d[_0x51aa('0x49')](_0x317e34);}})['then'](function(_0x383033){if(_0x383033){_0x58b145=_0x383033[_0x51aa('0x33')];if(!_0x80122a['query'][_0x51aa('0x34')]('nolimit')){_0x317e34[_0x51aa('0x1e')]=qs[_0x51aa('0x1e')](_0x80122a[_0x51aa('0x2f')]['limit']);_0x317e34[_0x51aa('0x1b')]=qs[_0x51aa('0x1b')](_0x80122a[_0x51aa('0x2f')]['offset']);}return _0x1ca70d[_0x51aa('0x49')](_0x317e34);}})[_0x51aa('0x24')](function(_0x1c6056){if(_0x1c6056){return _0x1c6056?{'count':_0x58b145,'rows':_0x1c6056}:null;}})[_0x51aa('0x24')](respondWithResult(_0x3eb688,null))['catch'](handleError(_0x3eb688,null));};exports[_0x51aa('0x4d')]=function(_0x5156cf,_0x568e08,_0x300139){var _0xa6a9d7={};var _0x557e6d={};var _0x596b35;var _0x4483d5;return db['Dynamics365Configuration'][_0x51aa('0x4a')]({'where':{'id':_0x5156cf[_0x51aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x568e08,null))[_0x51aa('0x24')](function(_0x341d3a){if(_0x341d3a){_0x596b35=_0x341d3a;_0x557e6d[_0x51aa('0x2e')]=_[_0x51aa('0x43')](db[_0x51aa('0x4b')][_0x51aa('0x2a')]);_0x557e6d[_0x51aa('0x2f')]=_[_0x51aa('0x43')](_0x5156cf[_0x51aa('0x2f')]);_0x557e6d[_0x51aa('0x38')]=_[_0x51aa('0x31')](_0x557e6d[_0x51aa('0x2e')],_0x557e6d[_0x51aa('0x2f')]);_0xa6a9d7[_0x51aa('0x30')]=_[_0x51aa('0x31')](_0x557e6d[_0x51aa('0x2e')],qs['fields'](_0x5156cf[_0x51aa('0x2f')][_0x51aa('0x32')]));_0xa6a9d7['attributes']=_0xa6a9d7['attributes']['length']?_0xa6a9d7[_0x51aa('0x30')]:_0x557e6d['model'];_0xa6a9d7['order']=qs['sort'](_0x5156cf[_0x51aa('0x2f')][_0x51aa('0x35')]);_0xa6a9d7[_0x51aa('0x36')]=qs[_0x51aa('0x38')](_[_0x51aa('0x37')](_0x5156cf[_0x51aa('0x2f')],_0x557e6d[_0x51aa('0x38')]));if(_0x5156cf[_0x51aa('0x2f')][_0x51aa('0x39')]){_0xa6a9d7[_0x51aa('0x36')]=_[_0x51aa('0x3a')](_0xa6a9d7[_0x51aa('0x36')],{'$or':_[_0x51aa('0x29')](_0xa6a9d7[_0x51aa('0x30')],function(_0x37e0b0){var _0x1f09b2={};_0x1f09b2[_0x37e0b0]={'$like':'%'+_0x5156cf['query'][_0x51aa('0x39')]+'%'};return _0x1f09b2;})});}_0xa6a9d7=_[_0x51aa('0x3a')]({},_0xa6a9d7,_0x5156cf[_0x51aa('0x45')]);return _0x596b35[_0x51aa('0x4d')](_0xa6a9d7);}})[_0x51aa('0x24')](function(_0xf2f43f){if(_0xf2f43f){_0x4483d5=_0xf2f43f[_0x51aa('0x33')];if(!_0x5156cf[_0x51aa('0x2f')][_0x51aa('0x34')](_0x51aa('0x4e'))){_0xa6a9d7[_0x51aa('0x1e')]=qs[_0x51aa('0x1e')](_0x5156cf[_0x51aa('0x2f')][_0x51aa('0x1e')]);_0xa6a9d7[_0x51aa('0x1b')]=qs[_0x51aa('0x1b')](_0x5156cf['query'][_0x51aa('0x1b')]);}return _0x596b35[_0x51aa('0x4d')](_0xa6a9d7);}})[_0x51aa('0x24')](function(_0x4a0838){if(_0x4a0838){return _0x4a0838?{'count':_0x4483d5,'rows':_0x4a0838}:null;}})[_0x51aa('0x24')](respondWithResult(_0x568e08,null))[_0x51aa('0x40')](handleError(_0x568e08,null));};exports[_0x51aa('0x4f')]=function(_0x1a9b11,_0x108c79,_0x5d62ac){var _0x4cc09a={};var _0x2a28ae={};var _0x15b4fd;var _0x18d6cf;return db[_0x51aa('0x3c')][_0x51aa('0x4a')]({'where':{'id':_0x1a9b11[_0x51aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x108c79,null))[_0x51aa('0x24')](function(_0x3fc614){if(_0x3fc614){_0x15b4fd=_0x3fc614;_0x2a28ae[_0x51aa('0x2e')]=_[_0x51aa('0x43')](db[_0x51aa('0x4b')][_0x51aa('0x2a')]);_0x2a28ae[_0x51aa('0x2f')]=_[_0x51aa('0x43')](_0x1a9b11[_0x51aa('0x2f')]);_0x2a28ae[_0x51aa('0x38')]=_[_0x51aa('0x31')](_0x2a28ae[_0x51aa('0x2e')],_0x2a28ae[_0x51aa('0x2f')]);_0x4cc09a['attributes']=_['intersection'](_0x2a28ae['model'],qs[_0x51aa('0x32')](_0x1a9b11[_0x51aa('0x2f')][_0x51aa('0x32')]));_0x4cc09a[_0x51aa('0x30')]=_0x4cc09a['attributes'][_0x51aa('0x33')]?_0x4cc09a[_0x51aa('0x30')]:_0x2a28ae[_0x51aa('0x2e')];_0x4cc09a[_0x51aa('0x4c')]=qs[_0x51aa('0x35')](_0x1a9b11[_0x51aa('0x2f')][_0x51aa('0x35')]);_0x4cc09a[_0x51aa('0x36')]=qs[_0x51aa('0x38')](_[_0x51aa('0x37')](_0x1a9b11[_0x51aa('0x2f')],_0x2a28ae[_0x51aa('0x38')]));if(_0x1a9b11[_0x51aa('0x2f')][_0x51aa('0x39')]){_0x4cc09a[_0x51aa('0x36')]=_[_0x51aa('0x3a')](_0x4cc09a[_0x51aa('0x36')],{'$or':_[_0x51aa('0x29')](_0x4cc09a[_0x51aa('0x30')],function(_0x40e91e){var _0x5f8864={};_0x5f8864[_0x40e91e]={'$like':'%'+_0x1a9b11[_0x51aa('0x2f')][_0x51aa('0x39')]+'%'};return _0x5f8864;})});}_0x4cc09a=_['merge']({},_0x4cc09a,_0x1a9b11[_0x51aa('0x45')]);return _0x15b4fd[_0x51aa('0x4f')](_0x4cc09a);}})[_0x51aa('0x24')](function(_0x34ae4a){if(_0x34ae4a){_0x18d6cf=_0x34ae4a[_0x51aa('0x33')];if(!_0x1a9b11[_0x51aa('0x2f')][_0x51aa('0x34')](_0x51aa('0x4e'))){_0x4cc09a[_0x51aa('0x1e')]=qs[_0x51aa('0x1e')](_0x1a9b11[_0x51aa('0x2f')][_0x51aa('0x1e')]);_0x4cc09a['offset']=qs[_0x51aa('0x1b')](_0x1a9b11[_0x51aa('0x2f')][_0x51aa('0x1b')]);}return _0x15b4fd['getDescriptions'](_0x4cc09a);}})[_0x51aa('0x24')](function(_0x8b4692){if(_0x8b4692){return _0x8b4692?{'count':_0x18d6cf,'rows':_0x8b4692}:null;}})['then'](respondWithResult(_0x108c79,null))[_0x51aa('0x40')](handleError(_0x108c79,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index bba7836..0389000 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 _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xe14d,0x1ee));var _0xde14=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xe14d[_0x32d457];return _0x338386;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Dynamics365Configuration',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x5400b9,_0xded326){var _0x3871fb=function(_0x51e3f2){while(--_0x51e3f2){_0x5400b9['push'](_0x5400b9['shift']());}};_0x3871fb(++_0xded326);}(_0x84ab,0x12f));var _0xb84a=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x84ab[_0x4914e2];return _0x2dcd07;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','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 ed8d027..be96adf 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 _0xc245=['message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2b9d97,_0x26a9a4){var _0x58cef2=function(_0xbd4abd){while(--_0xbd4abd){_0x2b9d97['push'](_0x2b9d97['shift']());}};_0x58cef2(++_0x26a9a4);}(_0xc245,0x1d1));var _0x5c24=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc245[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c24('0x0'));var BPromise=require(_0x5c24('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c24('0x2'));var db=require(_0x5c24('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c24('0x4'))('rpc');var config=require(_0x5c24('0x5'));var jayson=require(_0x5c24('0x6'));var client=jayson[_0x5c24('0x7')][_0x5c24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41de93,_0x38166e,_0x1b948e){return new BPromise(function(_0x293121,_0x1bbdea){return client[_0x5c24('0x9')](_0x41de93,_0x1b948e)[_0x5c24('0xa')](function(_0x39c99b){logger[_0x5c24('0xb')](_0x5c24('0xc'),_0x38166e,'request\x20sent');logger['debug'](_0x5c24('0xd'),_0x38166e,_0x5c24('0xe'),JSON[_0x5c24('0xf')](_0x39c99b));if(_0x39c99b[_0x5c24('0x10')]){if(_0x39c99b['error'][_0x5c24('0x11')]===0x1f4){logger[_0x5c24('0x10')](_0x5c24('0xc'),_0x38166e,_0x39c99b[_0x5c24('0x10')]['message']);return _0x1bbdea(_0x39c99b[_0x5c24('0x10')][_0x5c24('0x12')]);}logger[_0x5c24('0x10')](_0x5c24('0xc'),_0x38166e,_0x39c99b[_0x5c24('0x10')][_0x5c24('0x12')]);return _0x293121(_0x39c99b['error']['message']);}else{logger[_0x5c24('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x38166e,_0x5c24('0xe'));_0x293121(_0x39c99b[_0x5c24('0x13')]['message']);}})[_0x5c24('0x14')](function(_0x2a899e){logger[_0x5c24('0x10')](_0x5c24('0xc'),_0x38166e,_0x2a899e);_0x1bbdea(_0x2a899e);});});} \ No newline at end of file +var _0x707b=['code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xdbd4f7,_0x4e3bdd){var _0x5c3f9d=function(_0xa7a35a){while(--_0xa7a35a){_0xdbd4f7['push'](_0xdbd4f7['shift']());}};_0x5c3f9d(++_0x4e3bdd);}(_0x707b,0x191));var _0xb707=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x707b[_0x5751e6];return _0x4199e4;};'use strict';var _=require(_0xb707('0x0'));var util=require('util');var moment=require(_0xb707('0x1'));var BPromise=require(_0xb707('0x2'));var rs=require(_0xb707('0x3'));var fs=require('fs');var Redis=require(_0xb707('0x4'));var db=require(_0xb707('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb707('0x6'))('rpc');var config=require(_0xb707('0x7'));var jayson=require(_0xb707('0x8'));var client=jayson['client'][_0xb707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x366237,_0x5eff60,_0x1d29ba){return new BPromise(function(_0x57ae70,_0xf1600d){return client['request'](_0x366237,_0x1d29ba)[_0xb707('0xa')](function(_0x13f546){logger['info'](_0xb707('0xb'),_0x5eff60,_0xb707('0xc'));logger[_0xb707('0xd')](_0xb707('0xe'),_0x5eff60,'request\x20sent',JSON[_0xb707('0xf')](_0x13f546));if(_0x13f546['error']){if(_0x13f546[_0xb707('0x10')][_0xb707('0x11')]===0x1f4){logger['error'](_0xb707('0xb'),_0x5eff60,_0x13f546[_0xb707('0x10')][_0xb707('0x12')]);return _0xf1600d(_0x13f546[_0xb707('0x10')][_0xb707('0x12')]);}logger[_0xb707('0x10')](_0xb707('0xb'),_0x5eff60,_0x13f546[_0xb707('0x10')]['message']);return _0x57ae70(_0x13f546[_0xb707('0x10')][_0xb707('0x12')]);}else{logger[_0xb707('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5eff60,_0xb707('0xc'));_0x57ae70(_0x13f546[_0xb707('0x14')][_0xb707('0x12')]);}})[_0xb707('0x15')](function(_0x2e7d96){logger[_0xb707('0x10')](_0xb707('0xb'),_0x5eff60,_0x2e7d96);_0xf1600d(_0x2e7d96);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 16157eb..70eed4c 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 _0x7513=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','util'];(function(_0x4a0e66,_0x38369d){var _0x8a4a40=function(_0x52054b){while(--_0x52054b){_0x4a0e66['push'](_0x4a0e66['shift']());}};_0x8a4a40(++_0x38369d);}(_0x7513,0x8b));var _0x3751=function(_0x40f5b7,_0xb3243e){_0x40f5b7=_0x40f5b7-0x0;var _0x3c884a=_0x7513[_0x40f5b7];return _0x3c884a;};'use strict';var multer=require('multer');var util=require(_0x3751('0x0'));var path=require(_0x3751('0x1'));var timeout=require(_0x3751('0x2'));var express=require(_0x3751('0x3'));var router=express[_0x3751('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3751('0x5'));var interaction=require(_0x3751('0x6'));var config=require(_0x3751('0x7'));var controller=require(_0x3751('0x8'));router['get']('/',auth[_0x3751('0x9')](),controller[_0x3751('0xa')]);router[_0x3751('0xb')](_0x3751('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3751('0xd')]('/',auth['isAuthenticated'](),controller[_0x3751('0xe')]);router[_0x3751('0xf')](_0x3751('0xc'),auth['isAuthenticated'](),controller[_0x3751('0x10')]);router[_0x3751('0x11')](_0x3751('0xc'),auth[_0x3751('0x9')](),controller[_0x3751('0x12')]);module[_0x3751('0x13')]=router; \ No newline at end of file +var _0x6dc2=['create','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5696d1,_0x45af09){var _0x258c01=function(_0x2d24d5){while(--_0x2d24d5){_0x5696d1['push'](_0x5696d1['shift']());}};_0x258c01(++_0x45af09);}(_0x6dc2,0xae));var _0x26dc=function(_0x4453bd,_0xe773a){_0x4453bd=_0x4453bd-0x0;var _0x5e8ed8=_0x6dc2[_0x4453bd];return _0x5e8ed8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x26dc('0x0'));var timeout=require(_0x26dc('0x1'));var express=require(_0x26dc('0x2'));var router=express['Router']();var fs_extra=require(_0x26dc('0x3'));var auth=require(_0x26dc('0x4'));var interaction=require(_0x26dc('0x5'));var config=require(_0x26dc('0x6'));var controller=require(_0x26dc('0x7'));router[_0x26dc('0x8')]('/',auth[_0x26dc('0x9')](),controller[_0x26dc('0xa')]);router[_0x26dc('0x8')](_0x26dc('0xb'),auth[_0x26dc('0x9')](),controller[_0x26dc('0xc')]);router['post']('/',auth[_0x26dc('0x9')](),controller[_0x26dc('0xd')]);router['put'](_0x26dc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x26dc('0xe')](_0x26dc('0xb'),auth[_0x26dc('0x9')](),controller[_0x26dc('0xf')]);module[_0x26dc('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 9396854..45beaa4 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 _0x4122=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports'];(function(_0x29c981,_0x25d038){var _0xf2043d=function(_0xadd132){while(--_0xadd132){_0x29c981['push'](_0x29c981['shift']());}};_0xf2043d(++_0x25d038);}(_0x4122,0xd6));var _0x2412=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4122[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x2412('0x0'));module[_0x2412('0x1')]={'type':{'type':Sequelize[_0x2412('0x2')](_0x2412('0x3'),'variable',_0x2412('0x4'),_0x2412('0x5'),_0x2412('0x6')),'defaultValue':_0x2412('0x3')},'content':{'type':Sequelize[_0x2412('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2412('0x2')](_0x2412('0x3'),_0x2412('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2412('0x7')]},'nameField':{'type':Sequelize[_0x2412('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2412('0x7')]}}; \ No newline at end of file +var _0x9b38=['variable','customVariable','keyValue','picklist','string','STRING','sequelize'];(function(_0x2f168e,_0x3c923c){var _0x5ee694=function(_0x12fdfa){while(--_0x12fdfa){_0x2f168e['push'](_0x2f168e['shift']());}};_0x5ee694(++_0x3c923c);}(_0x9b38,0x1e2));var _0x89b3=function(_0x565eae,_0x176003){_0x565eae=_0x565eae-0x0;var _0x38744d=_0x9b38[_0x565eae];return _0x38744d;};'use strict';var Sequelize=require(_0x89b3('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x89b3('0x1'),_0x89b3('0x2'),_0x89b3('0x3'),_0x89b3('0x4')),'defaultValue':_0x89b3('0x5')},'content':{'type':Sequelize[_0x89b3('0x6')]},'key':{'type':Sequelize[_0x89b3('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x89b3('0x5'),_0x89b3('0x1'),_0x89b3('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x89b3('0x6')]},'nameField':{'type':Sequelize[_0x89b3('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x89b3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index dc6e154..3c4c63c 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 _0xb837=['catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','rows','show','params','length','find','create','body'];(function(_0x100654,_0x4ae04b){var _0x1e9b9f=function(_0x8d69d6){while(--_0x8d69d6){_0x100654['push'](_0x100654['shift']());}};_0x1e9b9f(++_0x4ae04b);}(_0xb837,0x1c3));var _0x7b83=function(_0x4e5f1e,_0x1b376a){_0x4e5f1e=_0x4e5f1e-0x0;var _0x19fbc7=_0xb837[_0x4e5f1e];return _0x19fbc7;};'use strict';var emlformat=require(_0x7b83('0x0'));var rimraf=require(_0x7b83('0x1'));var zipdir=require(_0x7b83('0x2'));var jsonpatch=require(_0x7b83('0x3'));var rp=require(_0x7b83('0x4'));var moment=require(_0x7b83('0x5'));var BPromise=require(_0x7b83('0x6'));var Mustache=require('mustache');var util=require(_0x7b83('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7b83('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b83('0x9'));var squel=require(_0x7b83('0xa'));var crypto=require(_0x7b83('0xb'));var jsforce=require(_0x7b83('0xc'));var deskjs=require(_0x7b83('0xd'));var toCsv=require(_0x7b83('0x8'));var querystring=require(_0x7b83('0xe'));var Papa=require(_0x7b83('0xf'));var Redis=require(_0x7b83('0x10'));var authService=require(_0x7b83('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7b83('0x12'));var hardwareService=require(_0x7b83('0x13'));var logger=require(_0x7b83('0x14'))(_0x7b83('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b83('0x16'));var db=require(_0x7b83('0x17'))['db'];function respondWithStatusCode(_0x34e70e,_0x2ab285){_0x2ab285=_0x2ab285||0xcc;return function(_0x2034f0){if(_0x2034f0){return _0x34e70e[_0x7b83('0x18')](_0x2ab285);}return _0x34e70e['status'](_0x2ab285)[_0x7b83('0x19')]();};}function respondWithResult(_0x575eda,_0x4290b9){_0x4290b9=_0x4290b9||0xc8;return function(_0x531c5d){if(_0x531c5d){return _0x575eda[_0x7b83('0x1a')](_0x4290b9)[_0x7b83('0x1b')](_0x531c5d);}};}function respondWithFilteredResult(_0x46fc18,_0x50e4d9){return function(_0x56b96b){if(_0x56b96b){var _0x59e238=typeof _0x50e4d9[_0x7b83('0x1c')]===_0x7b83('0x1d')&&typeof _0x50e4d9[_0x7b83('0x1e')]===_0x7b83('0x1d');var _0x54982c=_0x56b96b['count'];var _0x12913c=_0x59e238?0x0:_0x50e4d9[_0x7b83('0x1c')];var _0x15c2b9=_0x59e238?_0x56b96b[_0x7b83('0x1f')]:_0x50e4d9[_0x7b83('0x1c')]+_0x50e4d9[_0x7b83('0x1e')];var _0x2c09f3;if(_0x15c2b9>=_0x54982c){_0x15c2b9=_0x54982c;_0x2c09f3=0xc8;}else{_0x2c09f3=0xce;}_0x46fc18[_0x7b83('0x1a')](_0x2c09f3);return _0x46fc18[_0x7b83('0x20')](_0x7b83('0x21'),_0x12913c+'-'+_0x15c2b9+'/'+_0x54982c)[_0x7b83('0x1b')](_0x56b96b);}return null;};}function patchUpdates(_0x3b95d3){return function(_0x54a3cb){try{jsonpatch[_0x7b83('0x22')](_0x54a3cb,_0x3b95d3,!![]);}catch(_0x5087c6){return BPromise[_0x7b83('0x23')](_0x5087c6);}return _0x54a3cb['save']();};}function saveUpdates(_0x3394f9,_0x3027ea){return function(_0x5a6afd){if(_0x5a6afd){return _0x5a6afd['update'](_0x3394f9)['then'](function(_0x3a3986){return _0x3a3986;});}return null;};}function removeEntity(_0x1be56a,_0x3cf863){return function(_0x3f8a52){if(_0x3f8a52){return _0x3f8a52[_0x7b83('0x24')]()[_0x7b83('0x25')](function(){_0x1be56a[_0x7b83('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36a888,_0x5b1bb6){return function(_0x4d515b){if(!_0x4d515b){_0x36a888[_0x7b83('0x18')](0x194);}return _0x4d515b;};}function handleError(_0x225911,_0x6004fc){_0x6004fc=_0x6004fc||0x1f4;return function(_0x2a04a2){logger['error'](_0x2a04a2[_0x7b83('0x26')]);if(_0x2a04a2[_0x7b83('0x27')]){delete _0x2a04a2[_0x7b83('0x27')];}_0x225911[_0x7b83('0x1a')](_0x6004fc)[_0x7b83('0x28')](_0x2a04a2);};}exports[_0x7b83('0x29')]=function(_0x3348e1,_0x58187f){var _0x101c29={},_0x319700={},_0x130d64={'count':0x0,'rows':[]};var _0x5610a0=_['map'](db['Dynamics365Field'][_0x7b83('0x2a')],function(_0x269370){return{'name':_0x269370[_0x7b83('0x2b')],'type':_0x269370[_0x7b83('0x2c')][_0x7b83('0x2d')]};});_0x319700['model']=_[_0x7b83('0x2e')](_0x5610a0,'name');_0x319700[_0x7b83('0x2f')]=_[_0x7b83('0x30')](_0x3348e1[_0x7b83('0x2f')]);_0x319700['filters']=_[_0x7b83('0x31')](_0x319700[_0x7b83('0x32')],_0x319700[_0x7b83('0x2f')]);_0x101c29[_0x7b83('0x33')]=_[_0x7b83('0x31')](_0x319700['model'],qs[_0x7b83('0x34')](_0x3348e1[_0x7b83('0x2f')][_0x7b83('0x34')]));_0x101c29[_0x7b83('0x33')]=_0x101c29[_0x7b83('0x33')]['length']?_0x101c29[_0x7b83('0x33')]:_0x319700[_0x7b83('0x32')];if(!_0x3348e1['query']['hasOwnProperty'](_0x7b83('0x35'))){_0x101c29['limit']=qs[_0x7b83('0x1e')](_0x3348e1[_0x7b83('0x2f')][_0x7b83('0x1e')]);_0x101c29['offset']=qs['offset'](_0x3348e1[_0x7b83('0x2f')]['offset']);}_0x101c29[_0x7b83('0x36')]=qs[_0x7b83('0x37')](_0x3348e1[_0x7b83('0x2f')][_0x7b83('0x37')]);_0x101c29[_0x7b83('0x38')]=qs[_0x7b83('0x39')](_[_0x7b83('0x3a')](_0x3348e1[_0x7b83('0x2f')],_0x319700[_0x7b83('0x39')]),_0x5610a0);if(_0x3348e1[_0x7b83('0x2f')][_0x7b83('0x3b')]){_0x101c29[_0x7b83('0x38')]=_[_0x7b83('0x3c')](_0x101c29[_0x7b83('0x38')],{'$or':_['map'](_0x5610a0,function(_0x1a5af8){if(_0x1a5af8[_0x7b83('0x2c')]!==_0x7b83('0x3d')){var _0x380654={};_0x380654[_0x1a5af8[_0x7b83('0x27')]]={'$like':'%'+_0x3348e1[_0x7b83('0x2f')]['filter']+'%'};return _0x380654;}})});}_0x101c29=_[_0x7b83('0x3c')]({},_0x101c29,_0x3348e1[_0x7b83('0x3e')]);var _0x361a09={'where':_0x101c29[_0x7b83('0x38')]};return db[_0x7b83('0x3f')][_0x7b83('0x1f')](_0x361a09)['then'](function(_0x2979e2){_0x130d64[_0x7b83('0x1f')]=_0x2979e2;if(_0x3348e1[_0x7b83('0x2f')][_0x7b83('0x40')]){_0x101c29[_0x7b83('0x41')]=[{'all':!![]}];}return db[_0x7b83('0x3f')][_0x7b83('0x42')](_0x101c29);})[_0x7b83('0x25')](function(_0x431656){_0x130d64[_0x7b83('0x43')]=_0x431656;return _0x130d64;})[_0x7b83('0x25')](respondWithFilteredResult(_0x58187f,_0x101c29))['catch'](handleError(_0x58187f,null));};exports[_0x7b83('0x44')]=function(_0x306744,_0x46b291){var _0x5520b5={'raw':!![],'where':{'id':_0x306744[_0x7b83('0x45')]['id']}},_0x54c0c8={};_0x54c0c8[_0x7b83('0x32')]=_[_0x7b83('0x30')](db[_0x7b83('0x3f')]['rawAttributes']);_0x54c0c8[_0x7b83('0x2f')]=_[_0x7b83('0x30')](_0x306744['query']);_0x54c0c8[_0x7b83('0x39')]=_[_0x7b83('0x31')](_0x54c0c8[_0x7b83('0x32')],_0x54c0c8['query']);_0x5520b5[_0x7b83('0x33')]=_[_0x7b83('0x31')](_0x54c0c8[_0x7b83('0x32')],qs['fields'](_0x306744['query'][_0x7b83('0x34')]));_0x5520b5[_0x7b83('0x33')]=_0x5520b5[_0x7b83('0x33')][_0x7b83('0x46')]?_0x5520b5['attributes']:_0x54c0c8[_0x7b83('0x32')];if(_0x306744[_0x7b83('0x2f')][_0x7b83('0x40')]){_0x5520b5[_0x7b83('0x41')]=[{'all':!![]}];}_0x5520b5=_[_0x7b83('0x3c')]({},_0x5520b5,_0x306744[_0x7b83('0x3e')]);return db[_0x7b83('0x3f')][_0x7b83('0x47')](_0x5520b5)[_0x7b83('0x25')](handleEntityNotFound(_0x46b291,null))['then'](respondWithResult(_0x46b291,null))['catch'](handleError(_0x46b291,null));};exports['create']=function(_0x4163c2,_0xf08600){return db['Dynamics365Field'][_0x7b83('0x48')](_0x4163c2[_0x7b83('0x49')],{})[_0x7b83('0x25')](respondWithResult(_0xf08600,0xc9))[_0x7b83('0x4a')](handleError(_0xf08600,null));};exports['update']=function(_0x420b9e,_0x4c1a38){if(_0x420b9e['body']['id']){delete _0x420b9e[_0x7b83('0x49')]['id'];}return db['Dynamics365Field'][_0x7b83('0x47')]({'where':{'id':_0x420b9e[_0x7b83('0x45')]['id']}})[_0x7b83('0x25')](handleEntityNotFound(_0x4c1a38,null))[_0x7b83('0x25')](saveUpdates(_0x420b9e[_0x7b83('0x49')],null))[_0x7b83('0x25')](respondWithResult(_0x4c1a38,null))[_0x7b83('0x4a')](handleError(_0x4c1a38,null));};exports[_0x7b83('0x24')]=function(_0x18ec36,_0x61541e){return db[_0x7b83('0x3f')][_0x7b83('0x47')]({'where':{'id':_0x18ec36[_0x7b83('0x45')]['id']}})[_0x7b83('0x25')](handleEntityNotFound(_0x61541e,null))[_0x7b83('0x25')](removeEntity(_0x61541e,null))[_0x7b83('0x4a')](handleError(_0x61541e,null));}; \ No newline at end of file +var _0x04bf=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','error','stack','name','index','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','Dynamics365Field','includeAll','include','findAll','rows','show','params','catch','create','body','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04bf,0x95));var _0xf04b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x04bf[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xf04b('0x0'));var rimraf=require(_0xf04b('0x1'));var zipdir=require(_0xf04b('0x2'));var jsonpatch=require(_0xf04b('0x3'));var rp=require(_0xf04b('0x4'));var moment=require('moment');var BPromise=require(_0xf04b('0x5'));var Mustache=require('mustache');var util=require(_0xf04b('0x6'));var path=require(_0xf04b('0x7'));var sox=require(_0xf04b('0x8'));var csv=require(_0xf04b('0x9'));var ejs=require(_0xf04b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf04b('0xb'));var crypto=require(_0xf04b('0xc'));var jsforce=require(_0xf04b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf04b('0x9'));var querystring=require(_0xf04b('0xe'));var Papa=require(_0xf04b('0xf'));var Redis=require(_0xf04b('0x10'));var authService=require(_0xf04b('0x11'));var qs=require(_0xf04b('0x12'));var as=require(_0xf04b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf04b('0x14'))('api');var utils=require(_0xf04b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf04b('0x16'));var db=require(_0xf04b('0x17'))['db'];function respondWithStatusCode(_0x28c0f6,_0x4a10f3){_0x4a10f3=_0x4a10f3||0xcc;return function(_0x116e86){if(_0x116e86){return _0x28c0f6[_0xf04b('0x18')](_0x4a10f3);}return _0x28c0f6[_0xf04b('0x19')](_0x4a10f3)[_0xf04b('0x1a')]();};}function respondWithResult(_0x4abe47,_0x20bc72){_0x20bc72=_0x20bc72||0xc8;return function(_0xdb89ed){if(_0xdb89ed){return _0x4abe47['status'](_0x20bc72)[_0xf04b('0x1b')](_0xdb89ed);}};}function respondWithFilteredResult(_0x470051,_0x11d977){return function(_0x257528){if(_0x257528){var _0x521c65=typeof _0x11d977[_0xf04b('0x1c')]===_0xf04b('0x1d')&&typeof _0x11d977['limit']===_0xf04b('0x1d');var _0x12db9a=_0x257528[_0xf04b('0x1e')];var _0x32c616=_0x521c65?0x0:_0x11d977[_0xf04b('0x1c')];var _0x413c76=_0x521c65?_0x257528[_0xf04b('0x1e')]:_0x11d977[_0xf04b('0x1c')]+_0x11d977[_0xf04b('0x1f')];var _0x550785;if(_0x413c76>=_0x12db9a){_0x413c76=_0x12db9a;_0x550785=0xc8;}else{_0x550785=0xce;}_0x470051[_0xf04b('0x19')](_0x550785);return _0x470051[_0xf04b('0x20')](_0xf04b('0x21'),_0x32c616+'-'+_0x413c76+'/'+_0x12db9a)[_0xf04b('0x1b')](_0x257528);}return null;};}function patchUpdates(_0x315baa){return function(_0xbf53d6){try{jsonpatch[_0xf04b('0x22')](_0xbf53d6,_0x315baa,!![]);}catch(_0x7baef0){return BPromise['reject'](_0x7baef0);}return _0xbf53d6['save']();};}function saveUpdates(_0x2d31f3,_0x33db76){return function(_0x3971f2){if(_0x3971f2){return _0x3971f2['update'](_0x2d31f3)[_0xf04b('0x23')](function(_0x58fdcc){return _0x58fdcc;});}return null;};}function removeEntity(_0x44d325,_0x108f66){return function(_0x1fbe16){if(_0x1fbe16){return _0x1fbe16[_0xf04b('0x24')]()[_0xf04b('0x23')](function(){_0x44d325['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x248ecc,_0x3625e7){return function(_0x159b1c){if(!_0x159b1c){_0x248ecc['sendStatus'](0x194);}return _0x159b1c;};}function handleError(_0x43e248,_0x502699){_0x502699=_0x502699||0x1f4;return function(_0x26ad7b){logger[_0xf04b('0x25')](_0x26ad7b[_0xf04b('0x26')]);if(_0x26ad7b[_0xf04b('0x27')]){delete _0x26ad7b[_0xf04b('0x27')];}_0x43e248[_0xf04b('0x19')](_0x502699)['send'](_0x26ad7b);};}exports[_0xf04b('0x28')]=function(_0x5778d9,_0x1cd9c4){var _0x262348={},_0x3f8bf8={},_0x10384d={'count':0x0,'rows':[]};var _0x359b5d=_['map'](db['Dynamics365Field'][_0xf04b('0x29')],function(_0x2abe71){return{'name':_0x2abe71['fieldName'],'type':_0x2abe71['type'][_0xf04b('0x2a')]};});_0x3f8bf8[_0xf04b('0x2b')]=_[_0xf04b('0x2c')](_0x359b5d,'name');_0x3f8bf8['query']=_[_0xf04b('0x2d')](_0x5778d9[_0xf04b('0x2e')]);_0x3f8bf8[_0xf04b('0x2f')]=_[_0xf04b('0x30')](_0x3f8bf8['model'],_0x3f8bf8[_0xf04b('0x2e')]);_0x262348[_0xf04b('0x31')]=_['intersection'](_0x3f8bf8[_0xf04b('0x2b')],qs[_0xf04b('0x32')](_0x5778d9['query'][_0xf04b('0x32')]));_0x262348[_0xf04b('0x31')]=_0x262348[_0xf04b('0x31')][_0xf04b('0x33')]?_0x262348[_0xf04b('0x31')]:_0x3f8bf8[_0xf04b('0x2b')];if(!_0x5778d9[_0xf04b('0x2e')][_0xf04b('0x34')](_0xf04b('0x35'))){_0x262348['limit']=qs[_0xf04b('0x1f')](_0x5778d9[_0xf04b('0x2e')]['limit']);_0x262348[_0xf04b('0x1c')]=qs[_0xf04b('0x1c')](_0x5778d9[_0xf04b('0x2e')][_0xf04b('0x1c')]);}_0x262348[_0xf04b('0x36')]=qs[_0xf04b('0x37')](_0x5778d9[_0xf04b('0x2e')][_0xf04b('0x37')]);_0x262348['where']=qs[_0xf04b('0x2f')](_[_0xf04b('0x38')](_0x5778d9[_0xf04b('0x2e')],_0x3f8bf8[_0xf04b('0x2f')]),_0x359b5d);if(_0x5778d9[_0xf04b('0x2e')][_0xf04b('0x39')]){_0x262348[_0xf04b('0x3a')]=_[_0xf04b('0x3b')](_0x262348[_0xf04b('0x3a')],{'$or':_[_0xf04b('0x2c')](_0x359b5d,function(_0x9dcb79){if(_0x9dcb79[_0xf04b('0x3c')]!=='VIRTUAL'){var _0x58aa16={};_0x58aa16[_0x9dcb79[_0xf04b('0x27')]]={'$like':'%'+_0x5778d9[_0xf04b('0x2e')][_0xf04b('0x39')]+'%'};return _0x58aa16;}})});}_0x262348=_[_0xf04b('0x3b')]({},_0x262348,_0x5778d9[_0xf04b('0x3d')]);var _0x18f215={'where':_0x262348['where']};return db[_0xf04b('0x3e')][_0xf04b('0x1e')](_0x18f215)[_0xf04b('0x23')](function(_0x54a96d){_0x10384d[_0xf04b('0x1e')]=_0x54a96d;if(_0x5778d9['query'][_0xf04b('0x3f')]){_0x262348[_0xf04b('0x40')]=[{'all':!![]}];}return db[_0xf04b('0x3e')][_0xf04b('0x41')](_0x262348);})[_0xf04b('0x23')](function(_0xd5daef){_0x10384d[_0xf04b('0x42')]=_0xd5daef;return _0x10384d;})[_0xf04b('0x23')](respondWithFilteredResult(_0x1cd9c4,_0x262348))['catch'](handleError(_0x1cd9c4,null));};exports[_0xf04b('0x43')]=function(_0x59b588,_0x25647c){var _0x256032={'raw':!![],'where':{'id':_0x59b588[_0xf04b('0x44')]['id']}},_0x58cc9b={};_0x58cc9b[_0xf04b('0x2b')]=_['keys'](db['Dynamics365Field'][_0xf04b('0x29')]);_0x58cc9b[_0xf04b('0x2e')]=_['keys'](_0x59b588[_0xf04b('0x2e')]);_0x58cc9b['filters']=_[_0xf04b('0x30')](_0x58cc9b[_0xf04b('0x2b')],_0x58cc9b[_0xf04b('0x2e')]);_0x256032[_0xf04b('0x31')]=_[_0xf04b('0x30')](_0x58cc9b[_0xf04b('0x2b')],qs[_0xf04b('0x32')](_0x59b588[_0xf04b('0x2e')][_0xf04b('0x32')]));_0x256032[_0xf04b('0x31')]=_0x256032[_0xf04b('0x31')]['length']?_0x256032[_0xf04b('0x31')]:_0x58cc9b[_0xf04b('0x2b')];if(_0x59b588[_0xf04b('0x2e')][_0xf04b('0x3f')]){_0x256032['include']=[{'all':!![]}];}_0x256032=_[_0xf04b('0x3b')]({},_0x256032,_0x59b588[_0xf04b('0x3d')]);return db[_0xf04b('0x3e')]['find'](_0x256032)['then'](handleEntityNotFound(_0x25647c,null))[_0xf04b('0x23')](respondWithResult(_0x25647c,null))[_0xf04b('0x45')](handleError(_0x25647c,null));};exports[_0xf04b('0x46')]=function(_0x4b5f00,_0x29e89c){return db[_0xf04b('0x3e')][_0xf04b('0x46')](_0x4b5f00[_0xf04b('0x47')],{})[_0xf04b('0x23')](respondWithResult(_0x29e89c,0xc9))[_0xf04b('0x45')](handleError(_0x29e89c,null));};exports[_0xf04b('0x48')]=function(_0xb574e,_0x5c8db9){if(_0xb574e[_0xf04b('0x47')]['id']){delete _0xb574e['body']['id'];}return db[_0xf04b('0x3e')][_0xf04b('0x49')]({'where':{'id':_0xb574e[_0xf04b('0x44')]['id']}})[_0xf04b('0x23')](handleEntityNotFound(_0x5c8db9,null))['then'](saveUpdates(_0xb574e['body'],null))[_0xf04b('0x23')](respondWithResult(_0x5c8db9,null))[_0xf04b('0x45')](handleError(_0x5c8db9,null));};exports['destroy']=function(_0x1f3ca8,_0x1a3e6b){return db[_0xf04b('0x3e')][_0xf04b('0x49')]({'where':{'id':_0x1f3ca8['params']['id']}})['then'](handleEntityNotFound(_0x1a3e6b,null))[_0xf04b('0x23')](removeEntity(_0x1a3e6b,null))[_0xf04b('0x45')](handleError(_0x1a3e6b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index da5a7c9..66e8690 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 _0xf587=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xf587,0x150));var _0x7f58=function(_0x49f9ab,_0x190102){_0x49f9ab=_0x49f9ab-0x0;var _0x3e5858=_0xf587[_0x49f9ab];return _0x3e5858;};'use strict';var _=require(_0x7f58('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7f58('0x1'));var moment=require(_0x7f58('0x2'));var BPromise=require(_0x7f58('0x3'));var rp=require(_0x7f58('0x4'));var fs=require('fs');var path=require(_0x7f58('0x5'));var rimraf=require('rimraf');var config=require(_0x7f58('0x6'));var attributes=require(_0x7f58('0x7'));module[_0x7f58('0x8')]=function(_0x343b60,_0x13e699){return _0x343b60[_0x7f58('0x9')](_0x7f58('0xa'),attributes,{'tableName':_0x7f58('0xb'),'paranoid':![],'indexes':[{'name':_0x7f58('0xc'),'fields':[_0x7f58('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x831f=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','idField'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x831f,0x79));var _0xf831=function(_0x1f88f0,_0x2dc0ac){_0x1f88f0=_0x1f88f0-0x0;var _0x3684f5=_0x831f[_0x1f88f0];return _0x3684f5;};'use strict';var _=require(_0xf831('0x0'));var util=require(_0xf831('0x1'));var logger=require(_0xf831('0x2'))(_0xf831('0x3'));var moment=require(_0xf831('0x4'));var BPromise=require('bluebird');var rp=require(_0xf831('0x5'));var fs=require('fs');var path=require(_0xf831('0x6'));var rimraf=require(_0xf831('0x7'));var config=require(_0xf831('0x8'));var attributes=require(_0xf831('0x9'));module[_0xf831('0xa')]=function(_0x2b3104,_0x1e4d4c){return _0x2b3104['define'](_0xf831('0xb'),attributes,{'tableName':_0xf831('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xf831('0xd'),_0xf831('0xe')],'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 b185468..071d2a3 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 _0xc416=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment'];(function(_0x4a767e,_0x362765){var _0x44c621=function(_0x4b22d3){while(--_0x4b22d3){_0x4a767e['push'](_0x4a767e['shift']());}};_0x44c621(++_0x362765);}(_0xc416,0x151));var _0x6c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc416[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c41('0x0'));var util=require(_0x6c41('0x1'));var moment=require(_0x6c41('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c41('0x3'));var fs=require('fs');var Redis=require(_0x6c41('0x4'));var db=require(_0x6c41('0x5'))['db'];var utils=require(_0x6c41('0x6'));var logger=require(_0x6c41('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c41('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bc59f,_0x418b23,_0x2de5bb){return new BPromise(function(_0x3d435b,_0x301f81){return client[_0x6c41('0x9')](_0x2bc59f,_0x2de5bb)[_0x6c41('0xa')](function(_0x394656){logger[_0x6c41('0xb')](_0x6c41('0xc'),_0x418b23,_0x6c41('0xd'));logger[_0x6c41('0xe')](_0x6c41('0xf'),_0x418b23,_0x6c41('0xd'),JSON[_0x6c41('0x10')](_0x394656));if(_0x394656[_0x6c41('0x11')]){if(_0x394656[_0x6c41('0x11')][_0x6c41('0x12')]===0x1f4){logger[_0x6c41('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x418b23,_0x394656[_0x6c41('0x11')][_0x6c41('0x13')]);return _0x301f81(_0x394656[_0x6c41('0x11')][_0x6c41('0x13')]);}logger[_0x6c41('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x418b23,_0x394656['error']['message']);return _0x3d435b(_0x394656[_0x6c41('0x11')]['message']);}else{logger['info'](_0x6c41('0xc'),_0x418b23,_0x6c41('0xd'));_0x3d435b(_0x394656['result']['message']);}})['catch'](function(_0x580e7c){logger[_0x6c41('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x418b23,_0x580e7c);_0x301f81(_0x580e7c);});});} \ No newline at end of file +var _0xf236=['then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf236,0x1ee));var _0x6f23=function(_0x470b0a,_0x2889d6){_0x470b0a=_0x470b0a-0x0;var _0x4463f6=_0xf236[_0x470b0a];return _0x4463f6;};'use strict';var _=require('lodash');var util=require(_0x6f23('0x0'));var moment=require(_0x6f23('0x1'));var BPromise=require(_0x6f23('0x2'));var rs=require(_0x6f23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6f23('0x4'));var logger=require(_0x6f23('0x5'))(_0x6f23('0x6'));var config=require(_0x6f23('0x7'));var jayson=require(_0x6f23('0x8'));var client=jayson[_0x6f23('0x9')][_0x6f23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b077e,_0x192ca4,_0x22140f){return new BPromise(function(_0x529642,_0x5ef650){return client[_0x6f23('0xb')](_0x2b077e,_0x22140f)[_0x6f23('0xc')](function(_0x2630c2){logger[_0x6f23('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x192ca4,_0x6f23('0xe'));logger[_0x6f23('0xf')](_0x6f23('0x10'),_0x192ca4,_0x6f23('0xe'),JSON[_0x6f23('0x11')](_0x2630c2));if(_0x2630c2[_0x6f23('0x12')]){if(_0x2630c2['error']['code']===0x1f4){logger['error'](_0x6f23('0x13'),_0x192ca4,_0x2630c2['error'][_0x6f23('0x14')]);return _0x5ef650(_0x2630c2[_0x6f23('0x12')][_0x6f23('0x14')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x192ca4,_0x2630c2['error'][_0x6f23('0x14')]);return _0x529642(_0x2630c2[_0x6f23('0x12')][_0x6f23('0x14')]);}else{logger['info'](_0x6f23('0x13'),_0x192ca4,_0x6f23('0xe'));_0x529642(_0x2630c2['result'][_0x6f23('0x14')]);}})[_0x6f23('0x15')](function(_0xebeff7){logger[_0x6f23('0x12')](_0x6f23('0x13'),_0x192ca4,_0xebeff7);_0x5ef650(_0xebeff7);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 4ac274e..bc6e4ed 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 _0x1a15=['isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0x1a15,0x9d));var _0x51a1=function(_0xc26ee9,_0x125f39){_0xc26ee9=_0xc26ee9-0x0;var _0x989625=_0x1a15[_0xc26ee9];return _0x989625;};'use strict';var multer=require(_0x51a1('0x0'));var util=require(_0x51a1('0x1'));var path=require(_0x51a1('0x2'));var timeout=require(_0x51a1('0x3'));var express=require(_0x51a1('0x4'));var router=express['Router']();var fs_extra=require(_0x51a1('0x5'));var auth=require(_0x51a1('0x6'));var interaction=require(_0x51a1('0x7'));var config=require(_0x51a1('0x8'));var controller=require(_0x51a1('0x9'));router[_0x51a1('0xa')]('/',auth[_0x51a1('0xb')](),controller['index']);router[_0x51a1('0xa')](_0x51a1('0xc'),auth[_0x51a1('0xb')](),controller[_0x51a1('0xd')]);router[_0x51a1('0xa')](_0x51a1('0xe'),auth[_0x51a1('0xb')](),controller[_0x51a1('0xf')]);router['get'](_0x51a1('0x10'),auth[_0x51a1('0xb')](),controller[_0x51a1('0x11')]);router['post']('/',auth[_0x51a1('0xb')](),controller[_0x51a1('0x12')]);router['post'](_0x51a1('0xe'),auth[_0x51a1('0xb')](),controller[_0x51a1('0x13')]);router[_0x51a1('0x14')](_0x51a1('0xc'),auth[_0x51a1('0xb')](),controller[_0x51a1('0x15')]);router[_0x51a1('0x16')](_0x51a1('0xc'),auth[_0x51a1('0xb')](),controller['destroy']);module[_0x51a1('0x17')]=router; \ No newline at end of file +var _0x0c5f=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','/:id','get','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3e4cca,_0x195314){var _0x37d4b7=function(_0x4ef241){while(--_0x4ef241){_0x3e4cca['push'](_0x3e4cca['shift']());}};_0x37d4b7(++_0x195314);}(_0x0c5f,0xd7));var _0xf0c5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c5f[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf0c5('0x0'));var timeout=require('connect-timeout');var express=require(_0xf0c5('0x1'));var router=express[_0xf0c5('0x2')]();var fs_extra=require(_0xf0c5('0x3'));var auth=require(_0xf0c5('0x4'));var interaction=require(_0xf0c5('0x5'));var config=require(_0xf0c5('0x6'));var controller=require(_0xf0c5('0x7'));router['get']('/',auth[_0xf0c5('0x8')](),controller['index']);router['get'](_0xf0c5('0x9'),auth[_0xf0c5('0x8')](),controller['show']);router[_0xf0c5('0xa')](_0xf0c5('0xb'),auth[_0xf0c5('0x8')](),controller[_0xf0c5('0xc')]);router[_0xf0c5('0xa')](_0xf0c5('0xd'),auth[_0xf0c5('0x8')](),controller['getFields']);router[_0xf0c5('0xe')]('/',auth[_0xf0c5('0x8')](),controller[_0xf0c5('0xf')]);router[_0xf0c5('0xe')](_0xf0c5('0xb'),auth[_0xf0c5('0x8')](),controller[_0xf0c5('0x10')]);router[_0xf0c5('0x11')](_0xf0c5('0x9'),auth['isAuthenticated'](),controller[_0xf0c5('0x12')]);router[_0xf0c5('0x13')](_0xf0c5('0x9'),auth['isAuthenticated'](),controller[_0xf0c5('0x14')]);module[_0xf0c5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index cffee9e..47335d7 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 _0xe5af=['exports','STRING','username','remoteUri'];(function(_0xccdee1,_0x335480){var _0x4b1cff=function(_0x35a362){while(--_0x35a362){_0xccdee1['push'](_0xccdee1['shift']());}};_0x4b1cff(++_0x335480);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2352ee,_0x52eb0c){_0x2352ee=_0x2352ee-0x0;var _0x2916a6=_0xe5af[_0x2352ee];return _0x2916a6;};'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 _0x5fdc=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4052c0,_0x4271ab){var _0x296f04=function(_0x5373fc){while(--_0x5373fc){_0x4052c0['push'](_0x4052c0['shift']());}};_0x296f04(++_0x4271ab);}(_0x5fdc,0x127));var _0xc5fd=function(_0x13194a,_0x91bc83){_0x13194a=_0x13194a-0x0;var _0xd7ae50=_0x5fdc[_0x13194a];return _0xd7ae50;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'name':{'type':Sequelize[_0xc5fd('0x2')]},'description':{'type':Sequelize[_0xc5fd('0x2')]},'username':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x3')},'apiKey':{'type':Sequelize[_0xc5fd('0x2')]},'remoteUri':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x4')},'serverUrl':{'type':Sequelize[_0xc5fd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 0c23c89..65c509d 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 _0x0caf=['pick','merge','filter','includeAll','include','rows','params','rawAttributes','options','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','test','Wrong\x20credentials','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FreshdeskAccount','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x337824,_0x19cb77){var _0x32afc4=function(_0x1deab6){while(--_0x1deab6){_0x337824['push'](_0x337824['shift']());}};_0x32afc4(++_0x19cb77);}(_0x0caf,0x9f));var _0xf0ca=function(_0x2ac4e0,_0x3ff268){_0x2ac4e0=_0x2ac4e0-0x0;var _0x5c08bd=_0x0caf[_0x2ac4e0];return _0x5c08bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0ca('0x0'));var rp=require(_0xf0ca('0x1'));var moment=require(_0xf0ca('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf0ca('0x3'));var path=require(_0xf0ca('0x4'));var sox=require('sox');var csv=require(_0xf0ca('0x5'));var ejs=require(_0xf0ca('0x6'));var fs=require('fs');var fs_extra=require(_0xf0ca('0x7'));var _=require('lodash');var squel=require(_0xf0ca('0x8'));var crypto=require(_0xf0ca('0x9'));var jsforce=require(_0xf0ca('0xa'));var deskjs=require(_0xf0ca('0xb'));var toCsv=require(_0xf0ca('0x5'));var querystring=require(_0xf0ca('0xc'));var Papa=require(_0xf0ca('0xd'));var Redis=require('ioredis');var authService=require(_0xf0ca('0xe'));var qs=require(_0xf0ca('0xf'));var as=require(_0xf0ca('0x10'));var hardwareService=require(_0xf0ca('0x11'));var logger=require(_0xf0ca('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf0ca('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0ca('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3c1332,_0x38c595){_0x38c595=_0x38c595||0xcc;return function(_0x24fd06){if(_0x24fd06){return _0x3c1332[_0xf0ca('0x15')](_0x38c595);}return _0x3c1332[_0xf0ca('0x16')](_0x38c595)[_0xf0ca('0x17')]();};}function respondWithResult(_0x5c5875,_0x6d9157){_0x6d9157=_0x6d9157||0xc8;return function(_0x4afc11){if(_0x4afc11){return _0x5c5875['status'](_0x6d9157)[_0xf0ca('0x18')](_0x4afc11);}};}function respondWithFilteredResult(_0x34ea00,_0x3b1daa){return function(_0x2b074e){if(_0x2b074e){var _0xc4ebc2=typeof _0x3b1daa['offset']==='undefined'&&typeof _0x3b1daa[_0xf0ca('0x19')]==='undefined';var _0x5af77f=_0x2b074e[_0xf0ca('0x1a')];var _0x5eb7e8=_0xc4ebc2?0x0:_0x3b1daa[_0xf0ca('0x1b')];var _0x239f38=_0xc4ebc2?_0x2b074e[_0xf0ca('0x1a')]:_0x3b1daa[_0xf0ca('0x1b')]+_0x3b1daa['limit'];var _0x167411;if(_0x239f38>=_0x5af77f){_0x239f38=_0x5af77f;_0x167411=0xc8;}else{_0x167411=0xce;}_0x34ea00['status'](_0x167411);return _0x34ea00[_0xf0ca('0x1c')](_0xf0ca('0x1d'),_0x5eb7e8+'-'+_0x239f38+'/'+_0x5af77f)['json'](_0x2b074e);}return null;};}function patchUpdates(_0x24303d){return function(_0x216b12){try{jsonpatch[_0xf0ca('0x1e')](_0x216b12,_0x24303d,!![]);}catch(_0x508d12){return BPromise[_0xf0ca('0x1f')](_0x508d12);}return _0x216b12[_0xf0ca('0x20')]();};}function saveUpdates(_0x3414eb,_0x520863){return function(_0x3374ad){if(_0x3374ad){return _0x3374ad[_0xf0ca('0x21')](_0x3414eb)[_0xf0ca('0x22')](function(_0x3d6bad){return _0x3d6bad;});}return null;};}function removeEntity(_0x5f31c6,_0xd8312a){return function(_0x50c892){if(_0x50c892){return _0x50c892['destroy']()[_0xf0ca('0x22')](function(){_0x5f31c6[_0xf0ca('0x16')](0xcc)[_0xf0ca('0x17')]();});}};}function handleEntityNotFound(_0x11916a,_0x106f8e){return function(_0x18223e){if(!_0x18223e){_0x11916a[_0xf0ca('0x15')](0x194);}return _0x18223e;};}function handleError(_0x30b5a3,_0x4c2365){_0x4c2365=_0x4c2365||0x1f4;return function(_0x550e2e){logger[_0xf0ca('0x23')](_0x550e2e[_0xf0ca('0x24')]);if(_0x550e2e['name']){delete _0x550e2e[_0xf0ca('0x25')];}_0x30b5a3[_0xf0ca('0x16')](_0x4c2365)[_0xf0ca('0x26')](_0x550e2e);};}exports[_0xf0ca('0x27')]=function(_0x48bbf8,_0xb41d0a){var _0xbefb0e={},_0x35b78c={},_0x2ee938={'count':0x0,'rows':[]};var _0x2e748d=_[_0xf0ca('0x28')](db[_0xf0ca('0x29')]['rawAttributes'],function(_0x6988a){return{'name':_0x6988a['fieldName'],'type':_0x6988a[_0xf0ca('0x2a')]['key']};});_0x35b78c[_0xf0ca('0x2b')]=_[_0xf0ca('0x28')](_0x2e748d,_0xf0ca('0x25'));_0x35b78c[_0xf0ca('0x2c')]=_[_0xf0ca('0x2d')](_0x48bbf8[_0xf0ca('0x2c')]);_0x35b78c[_0xf0ca('0x2e')]=_[_0xf0ca('0x2f')](_0x35b78c[_0xf0ca('0x2b')],_0x35b78c[_0xf0ca('0x2c')]);_0xbefb0e[_0xf0ca('0x30')]=_[_0xf0ca('0x2f')](_0x35b78c[_0xf0ca('0x2b')],qs[_0xf0ca('0x31')](_0x48bbf8['query'][_0xf0ca('0x31')]));_0xbefb0e[_0xf0ca('0x30')]=_0xbefb0e[_0xf0ca('0x30')][_0xf0ca('0x32')]?_0xbefb0e['attributes']:_0x35b78c[_0xf0ca('0x2b')];if(!_0x48bbf8['query'][_0xf0ca('0x33')]('nolimit')){_0xbefb0e[_0xf0ca('0x19')]=qs[_0xf0ca('0x19')](_0x48bbf8['query'][_0xf0ca('0x19')]);_0xbefb0e['offset']=qs['offset'](_0x48bbf8[_0xf0ca('0x2c')][_0xf0ca('0x1b')]);}_0xbefb0e[_0xf0ca('0x34')]=qs[_0xf0ca('0x35')](_0x48bbf8[_0xf0ca('0x2c')]['sort']);_0xbefb0e[_0xf0ca('0x36')]=qs[_0xf0ca('0x2e')](_[_0xf0ca('0x37')](_0x48bbf8[_0xf0ca('0x2c')],_0x35b78c[_0xf0ca('0x2e')]),_0x2e748d);if(_0x48bbf8[_0xf0ca('0x2c')]['filter']){_0xbefb0e[_0xf0ca('0x36')]=_[_0xf0ca('0x38')](_0xbefb0e[_0xf0ca('0x36')],{'$or':_[_0xf0ca('0x28')](_0x2e748d,function(_0x4bb384){if(_0x4bb384[_0xf0ca('0x2a')]!=='VIRTUAL'){var _0x3a7f56={};_0x3a7f56[_0x4bb384[_0xf0ca('0x25')]]={'$like':'%'+_0x48bbf8[_0xf0ca('0x2c')][_0xf0ca('0x39')]+'%'};return _0x3a7f56;}})});}_0xbefb0e=_[_0xf0ca('0x38')]({},_0xbefb0e,_0x48bbf8['options']);var _0x52bbb1={'where':_0xbefb0e[_0xf0ca('0x36')]};return db[_0xf0ca('0x29')][_0xf0ca('0x1a')](_0x52bbb1)[_0xf0ca('0x22')](function(_0xb2a6a3){_0x2ee938[_0xf0ca('0x1a')]=_0xb2a6a3;if(_0x48bbf8[_0xf0ca('0x2c')][_0xf0ca('0x3a')]){_0xbefb0e[_0xf0ca('0x3b')]=[{'all':!![]}];}return db[_0xf0ca('0x29')]['findAll'](_0xbefb0e);})[_0xf0ca('0x22')](function(_0x19dd2e){_0x2ee938[_0xf0ca('0x3c')]=_0x19dd2e;return _0x2ee938;})[_0xf0ca('0x22')](respondWithFilteredResult(_0xb41d0a,_0xbefb0e))['catch'](handleError(_0xb41d0a,null));};exports['show']=function(_0x2601fd,_0x81e68d){var _0x3c808c={'raw':![],'where':{'id':_0x2601fd[_0xf0ca('0x3d')]['id']}},_0x479c88={};_0x479c88[_0xf0ca('0x2b')]=_[_0xf0ca('0x2d')](db[_0xf0ca('0x29')][_0xf0ca('0x3e')]);_0x479c88[_0xf0ca('0x2c')]=_[_0xf0ca('0x2d')](_0x2601fd[_0xf0ca('0x2c')]);_0x479c88[_0xf0ca('0x2e')]=_[_0xf0ca('0x2f')](_0x479c88[_0xf0ca('0x2b')],_0x479c88[_0xf0ca('0x2c')]);_0x3c808c[_0xf0ca('0x30')]=_[_0xf0ca('0x2f')](_0x479c88[_0xf0ca('0x2b')],qs[_0xf0ca('0x31')](_0x2601fd[_0xf0ca('0x2c')][_0xf0ca('0x31')]));_0x3c808c[_0xf0ca('0x30')]=_0x3c808c[_0xf0ca('0x30')][_0xf0ca('0x32')]?_0x3c808c[_0xf0ca('0x30')]:_0x479c88[_0xf0ca('0x2b')];if(_0x2601fd[_0xf0ca('0x2c')][_0xf0ca('0x3a')]){_0x3c808c['include']=[{'all':!![]}];}_0x3c808c=_[_0xf0ca('0x38')]({},_0x3c808c,_0x2601fd[_0xf0ca('0x3f')]);return db[_0xf0ca('0x29')][_0xf0ca('0x40')](_0x3c808c)[_0xf0ca('0x22')](handleEntityNotFound(_0x81e68d,null))['then'](respondWithResult(_0x81e68d,null))[_0xf0ca('0x41')](handleError(_0x81e68d,null));};exports[_0xf0ca('0x42')]=function(_0x52255f,_0x48ee2a){return db[_0xf0ca('0x29')][_0xf0ca('0x42')](_0x52255f[_0xf0ca('0x43')],{})['then'](respondWithResult(_0x48ee2a,0xc9))[_0xf0ca('0x41')](handleError(_0x48ee2a,null));};exports['update']=function(_0x577f1d,_0x1e0da5){if(_0x577f1d['body']['id']){delete _0x577f1d['body']['id'];}return db[_0xf0ca('0x29')]['find']({'where':{'id':_0x577f1d[_0xf0ca('0x3d')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x1e0da5,null))[_0xf0ca('0x22')](saveUpdates(_0x577f1d[_0xf0ca('0x43')],null))[_0xf0ca('0x22')](respondWithResult(_0x1e0da5,null))[_0xf0ca('0x41')](handleError(_0x1e0da5,null));};exports['destroy']=function(_0x19bc49,_0xb8a7b6){return db[_0xf0ca('0x29')][_0xf0ca('0x40')]({'where':{'id':_0x19bc49['params']['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0xb8a7b6,null))[_0xf0ca('0x22')](removeEntity(_0xb8a7b6,null))[_0xf0ca('0x41')](handleError(_0xb8a7b6,null));};exports[_0xf0ca('0x44')]=function(_0xd883a4,_0x121690,_0x1685f0){var _0x8200f3={};var _0x4f132d={};var _0x4c4e50;var _0x2333f5;return db[_0xf0ca('0x29')][_0xf0ca('0x45')]({'where':{'id':_0xd883a4[_0xf0ca('0x3d')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x121690,null))[_0xf0ca('0x22')](function(_0xf2d7b0){if(_0xf2d7b0){_0x4c4e50=_0xf2d7b0;_0x4f132d[_0xf0ca('0x2b')]=_[_0xf0ca('0x2d')](db[_0xf0ca('0x46')][_0xf0ca('0x3e')]);_0x4f132d[_0xf0ca('0x2c')]=_[_0xf0ca('0x2d')](_0xd883a4[_0xf0ca('0x2c')]);_0x4f132d['filters']=_[_0xf0ca('0x2f')](_0x4f132d[_0xf0ca('0x2b')],_0x4f132d['query']);_0x8200f3[_0xf0ca('0x30')]=_[_0xf0ca('0x2f')](_0x4f132d['model'],qs[_0xf0ca('0x31')](_0xd883a4['query'][_0xf0ca('0x31')]));_0x8200f3['attributes']=_0x8200f3[_0xf0ca('0x30')][_0xf0ca('0x32')]?_0x8200f3[_0xf0ca('0x30')]:_0x4f132d[_0xf0ca('0x2b')];_0x8200f3[_0xf0ca('0x34')]=qs[_0xf0ca('0x35')](_0xd883a4[_0xf0ca('0x2c')][_0xf0ca('0x35')]);_0x8200f3[_0xf0ca('0x36')]=qs[_0xf0ca('0x2e')](_[_0xf0ca('0x37')](_0xd883a4[_0xf0ca('0x2c')],_0x4f132d[_0xf0ca('0x2e')]));if(_0xd883a4[_0xf0ca('0x2c')]['filter']){_0x8200f3[_0xf0ca('0x36')]=_[_0xf0ca('0x38')](_0x8200f3[_0xf0ca('0x36')],{'$or':_[_0xf0ca('0x28')](_0x8200f3[_0xf0ca('0x30')],function(_0x51d319){var _0x4fe440={};_0x4fe440[_0x51d319]={'$like':'%'+_0xd883a4['query']['filter']+'%'};return _0x4fe440;})});}_0x8200f3=_[_0xf0ca('0x38')]({},_0x8200f3,_0xd883a4[_0xf0ca('0x3f')]);return _0x4c4e50[_0xf0ca('0x44')](_0x8200f3);}})[_0xf0ca('0x22')](function(_0x568ad0){if(_0x568ad0){_0x2333f5=_0x568ad0[_0xf0ca('0x32')];if(!_0xd883a4['query'][_0xf0ca('0x33')](_0xf0ca('0x47'))){_0x8200f3['limit']=qs[_0xf0ca('0x19')](_0xd883a4[_0xf0ca('0x2c')][_0xf0ca('0x19')]);_0x8200f3['offset']=qs[_0xf0ca('0x1b')](_0xd883a4['query'][_0xf0ca('0x1b')]);}return _0x4c4e50[_0xf0ca('0x44')](_0x8200f3);}})[_0xf0ca('0x22')](function(_0x3c4796){if(_0x3c4796){return _0x3c4796?{'count':_0x2333f5,'rows':_0x3c4796}:null;}})[_0xf0ca('0x22')](respondWithResult(_0x121690,null))[_0xf0ca('0x41')](handleError(_0x121690,null));};exports[_0xf0ca('0x48')]=function(_0x1ecae9,_0x24c9a0,_0x4e1824){if(_0x1ecae9[_0xf0ca('0x43')]['id']){delete _0x1ecae9['body']['id'];}return db[_0xf0ca('0x29')]['findOne']({'where':{'id':_0x1ecae9[_0xf0ca('0x3d')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x24c9a0,null))[_0xf0ca('0x22')](function(_0x526bb6){if(_0x526bb6){_0x1ecae9[_0xf0ca('0x43')][_0xf0ca('0x49')]=_0x526bb6['id'];_0x1ecae9[_0xf0ca('0x43')][_0xf0ca('0x4a')]=integrations[_0xf0ca('0x4b')](_0x1ecae9[_0xf0ca('0x43')]['channel'],_0x1ecae9[_0xf0ca('0x43')]['type']);_0x1ecae9['body']['Descriptions']=integrations['getDescriptions'](_0x1ecae9[_0xf0ca('0x43')][_0xf0ca('0x4c')],_0x1ecae9[_0xf0ca('0x43')][_0xf0ca('0x2a')]);return db[_0xf0ca('0x46')][_0xf0ca('0x42')](_0x1ecae9[_0xf0ca('0x43')],{'include':[{'model':db[_0xf0ca('0x4d')],'as':'Subjects'},{'model':db[_0xf0ca('0x4d')],'as':_0xf0ca('0x4e')}]});}return null;})[_0xf0ca('0x22')](respondWithResult(_0x24c9a0,null))[_0xf0ca('0x41')](handleError(_0x24c9a0,null));};exports[_0xf0ca('0x4f')]=function(_0x1b9995,_0x5b81c6,_0x1a9e7f){var _0x329964='';return db[_0xf0ca('0x29')][_0xf0ca('0x45')]({'where':{'id':_0x1b9995['params']['id']},'attributes':['id','remoteUri',_0xf0ca('0x50')]})[_0xf0ca('0x22')](handleEntityNotFound(_0x5b81c6,null))[_0xf0ca('0x22')](function(_0x1062eb){if(_0x1062eb){_0x329964=_0x1062eb[_0xf0ca('0x51')];var _0x146257=_0x329964[_0xf0ca('0x52')](-0x1);if(_0x146257==='/'){_0x329964=_0x329964[_0xf0ca('0x53')](0x0,_0x329964[_0xf0ca('0x54')](_0x146257));}return rp({'method':_0xf0ca('0x55'),'uri':util[_0xf0ca('0x56')](_0xf0ca('0x57'),_0x329964,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xf0ca('0x56')](_0xf0ca('0x58'),new Buffer(util['format'](_0xf0ca('0x59'),_0x1062eb['apiKey']))[_0xf0ca('0x5a')](_0xf0ca('0x5b')))},'json':!![]});}})[_0xf0ca('0x22')](function(_0x54f54a){if(_0x54f54a){var _0x478262=[_0xf0ca('0x5c'),_0xf0ca('0x5d'),_0xf0ca('0x5e'),'description',_0xf0ca('0x16'),_0xf0ca('0x5f'),_0xf0ca('0x60'),'source','ticket_type',_0xf0ca('0x60'),'company'];_['remove'](_0x54f54a,function(_0x213706){return _0x478262[_0xf0ca('0x61')](_0x213706[_0xf0ca('0x25')])||!_0x213706[_0xf0ca('0x62')]&&_0x213706['type']!==_0xf0ca('0x63')&&_0x213706[_0xf0ca('0x2a')]!==_0xf0ca('0x64');});return{'count':_0x54f54a[_0xf0ca('0x32')],'rows':_[_0xf0ca('0x28')](_0x54f54a,function(_0x541c62){return{'id':_0x541c62[_0xf0ca('0x25')],'name':_0x541c62[_0xf0ca('0x65')],'custom':!_0x541c62[_0xf0ca('0x62')],'options':_0x541c62[_0xf0ca('0x66')]?_[_0xf0ca('0x28')](_0x541c62['choices'],function(_0x457a03){return{'name':_[_0xf0ca('0x67')](_0x457a03),'value':_0x457a03};}):[]};})};}})[_0xf0ca('0x22')](respondWithResult(_0x5b81c6,null))[_0xf0ca('0x41')](function(_0xa9b023){var _0x46b878=_0x1b9995[_0xf0ca('0x2c')]['test']?0x1f4:_0xa9b023[_0xf0ca('0x68')]||0x1f4;logger[_0xf0ca('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xf0ca('0x4f'),_0x46b878,JSON['stringify'](_0xa9b023));delete _0xa9b023[_0xf0ca('0x25')];if(_0x46b878===0x191){_0x46b878=0x190;}_0x5b81c6[_0xf0ca('0x16')](_0x46b878)[_0xf0ca('0x26')](_0x1b9995[_0xf0ca('0x2c')][_0xf0ca('0x69')]?{'message':_0xf0ca('0x6a'),'statusCode':_0xa9b023[_0xf0ca('0x68')]}:_0xa9b023);});}; \ No newline at end of file +var _0xe3ed=['lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','priority','group','source','company','remove','includes','default','custom_dropdown','choices','capitalize','test','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','set','apply','reject','save','update','then','destroy','end','error','name','index','FreshdeskAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring'];(function(_0x29d68b,_0x21a0fb){var _0x4fea2e=function(_0x10df34){while(--_0x10df34){_0x29d68b['push'](_0x29d68b['shift']());}};_0x4fea2e(++_0x21a0fb);}(_0xe3ed,0x8d));var _0xde3e=function(_0x47d818,_0x1e2ba2){_0x47d818=_0x47d818-0x0;var _0x86b94f=_0xe3ed[_0x47d818];return _0x86b94f;};'use strict';var emlformat=require(_0xde3e('0x0'));var rimraf=require(_0xde3e('0x1'));var zipdir=require(_0xde3e('0x2'));var jsonpatch=require(_0xde3e('0x3'));var rp=require(_0xde3e('0x4'));var moment=require(_0xde3e('0x5'));var BPromise=require(_0xde3e('0x6'));var Mustache=require(_0xde3e('0x7'));var util=require('util');var path=require(_0xde3e('0x8'));var sox=require(_0xde3e('0x9'));var csv=require('to-csv');var ejs=require(_0xde3e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde3e('0xb'));var squel=require(_0xde3e('0xc'));var crypto=require('crypto');var jsforce=require(_0xde3e('0xd'));var deskjs=require(_0xde3e('0xe'));var toCsv=require(_0xde3e('0xf'));var querystring=require(_0xde3e('0x10'));var Papa=require(_0xde3e('0x11'));var Redis=require('ioredis');var authService=require(_0xde3e('0x12'));var qs=require(_0xde3e('0x13'));var as=require(_0xde3e('0x14'));var hardwareService=require(_0xde3e('0x15'));var logger=require('../../config/logger')(_0xde3e('0x16'));var utils=require(_0xde3e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde3e('0x18'));var db=require(_0xde3e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x22ffc2,_0x4e0f23){_0x4e0f23=_0x4e0f23||0xcc;return function(_0x2cdf9c){if(_0x2cdf9c){return _0x22ffc2[_0xde3e('0x1a')](_0x4e0f23);}return _0x22ffc2[_0xde3e('0x1b')](_0x4e0f23)['end']();};}function respondWithResult(_0x167fa7,_0x1fee7b){_0x1fee7b=_0x1fee7b||0xc8;return function(_0x5ddb5a){if(_0x5ddb5a){return _0x167fa7['status'](_0x1fee7b)[_0xde3e('0x1c')](_0x5ddb5a);}};}function respondWithFilteredResult(_0x11db96,_0x6543f7){return function(_0x552fc4){if(_0x552fc4){var _0x5d4cd9=typeof _0x6543f7[_0xde3e('0x1d')]==='undefined'&&typeof _0x6543f7['limit']===_0xde3e('0x1e');var _0x1c8c82=_0x552fc4['count'];var _0x460d69=_0x5d4cd9?0x0:_0x6543f7[_0xde3e('0x1d')];var _0x264603=_0x5d4cd9?_0x552fc4['count']:_0x6543f7['offset']+_0x6543f7['limit'];var _0xf12c37;if(_0x264603>=_0x1c8c82){_0x264603=_0x1c8c82;_0xf12c37=0xc8;}else{_0xf12c37=0xce;}_0x11db96[_0xde3e('0x1b')](_0xf12c37);return _0x11db96[_0xde3e('0x1f')]('Content-Range',_0x460d69+'-'+_0x264603+'/'+_0x1c8c82)[_0xde3e('0x1c')](_0x552fc4);}return null;};}function patchUpdates(_0x11dd22){return function(_0x41808c){try{jsonpatch[_0xde3e('0x20')](_0x41808c,_0x11dd22,!![]);}catch(_0x2adb17){return BPromise[_0xde3e('0x21')](_0x2adb17);}return _0x41808c[_0xde3e('0x22')]();};}function saveUpdates(_0x1eda88,_0x443e8d){return function(_0x5a1c6c){if(_0x5a1c6c){return _0x5a1c6c[_0xde3e('0x23')](_0x1eda88)[_0xde3e('0x24')](function(_0x37615f){return _0x37615f;});}return null;};}function removeEntity(_0x57df9e,_0x361511){return function(_0x179189){if(_0x179189){return _0x179189[_0xde3e('0x25')]()['then'](function(){_0x57df9e[_0xde3e('0x1b')](0xcc)[_0xde3e('0x26')]();});}};}function handleEntityNotFound(_0x1d9432,_0xd795ac){return function(_0x19a8be){if(!_0x19a8be){_0x1d9432['sendStatus'](0x194);}return _0x19a8be;};}function handleError(_0x5313cb,_0x6c0db0){_0x6c0db0=_0x6c0db0||0x1f4;return function(_0x27ee92){logger[_0xde3e('0x27')](_0x27ee92['stack']);if(_0x27ee92[_0xde3e('0x28')]){delete _0x27ee92[_0xde3e('0x28')];}_0x5313cb['status'](_0x6c0db0)['send'](_0x27ee92);};}exports[_0xde3e('0x29')]=function(_0x3c83c8,_0x582c8d){var _0x2e4c62={},_0x5b5433={},_0x46db9d={'count':0x0,'rows':[]};var _0x5d4742=_['map'](db[_0xde3e('0x2a')]['rawAttributes'],function(_0x49c77a){return{'name':_0x49c77a[_0xde3e('0x2b')],'type':_0x49c77a[_0xde3e('0x2c')][_0xde3e('0x2d')]};});_0x5b5433[_0xde3e('0x2e')]=_[_0xde3e('0x2f')](_0x5d4742,_0xde3e('0x28'));_0x5b5433[_0xde3e('0x30')]=_[_0xde3e('0x31')](_0x3c83c8[_0xde3e('0x30')]);_0x5b5433[_0xde3e('0x32')]=_[_0xde3e('0x33')](_0x5b5433[_0xde3e('0x2e')],_0x5b5433[_0xde3e('0x30')]);_0x2e4c62[_0xde3e('0x34')]=_[_0xde3e('0x33')](_0x5b5433[_0xde3e('0x2e')],qs[_0xde3e('0x35')](_0x3c83c8['query'][_0xde3e('0x35')]));_0x2e4c62[_0xde3e('0x34')]=_0x2e4c62[_0xde3e('0x34')][_0xde3e('0x36')]?_0x2e4c62[_0xde3e('0x34')]:_0x5b5433[_0xde3e('0x2e')];if(!_0x3c83c8[_0xde3e('0x30')][_0xde3e('0x37')]('nolimit')){_0x2e4c62['limit']=qs[_0xde3e('0x38')](_0x3c83c8['query']['limit']);_0x2e4c62[_0xde3e('0x1d')]=qs[_0xde3e('0x1d')](_0x3c83c8[_0xde3e('0x30')][_0xde3e('0x1d')]);}_0x2e4c62[_0xde3e('0x39')]=qs[_0xde3e('0x3a')](_0x3c83c8['query']['sort']);_0x2e4c62[_0xde3e('0x3b')]=qs[_0xde3e('0x32')](_[_0xde3e('0x3c')](_0x3c83c8[_0xde3e('0x30')],_0x5b5433[_0xde3e('0x32')]),_0x5d4742);if(_0x3c83c8[_0xde3e('0x30')]['filter']){_0x2e4c62[_0xde3e('0x3b')]=_['merge'](_0x2e4c62[_0xde3e('0x3b')],{'$or':_[_0xde3e('0x2f')](_0x5d4742,function(_0x213564){if(_0x213564[_0xde3e('0x2c')]!=='VIRTUAL'){var _0x41a3c8={};_0x41a3c8[_0x213564[_0xde3e('0x28')]]={'$like':'%'+_0x3c83c8['query'][_0xde3e('0x3d')]+'%'};return _0x41a3c8;}})});}_0x2e4c62=_[_0xde3e('0x3e')]({},_0x2e4c62,_0x3c83c8[_0xde3e('0x3f')]);var _0x3afad0={'where':_0x2e4c62[_0xde3e('0x3b')]};return db[_0xde3e('0x2a')][_0xde3e('0x40')](_0x3afad0)[_0xde3e('0x24')](function(_0x83aca8){_0x46db9d[_0xde3e('0x40')]=_0x83aca8;if(_0x3c83c8['query'][_0xde3e('0x41')]){_0x2e4c62['include']=[{'all':!![]}];}return db[_0xde3e('0x2a')][_0xde3e('0x42')](_0x2e4c62);})[_0xde3e('0x24')](function(_0x41785d){_0x46db9d[_0xde3e('0x43')]=_0x41785d;return _0x46db9d;})[_0xde3e('0x24')](respondWithFilteredResult(_0x582c8d,_0x2e4c62))[_0xde3e('0x44')](handleError(_0x582c8d,null));};exports['show']=function(_0x23dc36,_0x1ae831){var _0x2d2ab7={'raw':![],'where':{'id':_0x23dc36[_0xde3e('0x45')]['id']}},_0x568217={};_0x568217[_0xde3e('0x2e')]=_[_0xde3e('0x31')](db['FreshdeskAccount'][_0xde3e('0x46')]);_0x568217[_0xde3e('0x30')]=_[_0xde3e('0x31')](_0x23dc36[_0xde3e('0x30')]);_0x568217['filters']=_[_0xde3e('0x33')](_0x568217[_0xde3e('0x2e')],_0x568217['query']);_0x2d2ab7[_0xde3e('0x34')]=_[_0xde3e('0x33')](_0x568217[_0xde3e('0x2e')],qs['fields'](_0x23dc36[_0xde3e('0x30')]['fields']));_0x2d2ab7['attributes']=_0x2d2ab7['attributes']['length']?_0x2d2ab7[_0xde3e('0x34')]:_0x568217[_0xde3e('0x2e')];if(_0x23dc36[_0xde3e('0x30')]['includeAll']){_0x2d2ab7[_0xde3e('0x47')]=[{'all':!![]}];}_0x2d2ab7=_['merge']({},_0x2d2ab7,_0x23dc36[_0xde3e('0x3f')]);return db['FreshdeskAccount']['find'](_0x2d2ab7)[_0xde3e('0x24')](handleEntityNotFound(_0x1ae831,null))['then'](respondWithResult(_0x1ae831,null))['catch'](handleError(_0x1ae831,null));};exports[_0xde3e('0x48')]=function(_0xbe6f36,_0x634a7a){return db[_0xde3e('0x2a')][_0xde3e('0x48')](_0xbe6f36[_0xde3e('0x49')],{})['then'](respondWithResult(_0x634a7a,0xc9))['catch'](handleError(_0x634a7a,null));};exports[_0xde3e('0x23')]=function(_0x66449d,_0x2f2001){if(_0x66449d['body']['id']){delete _0x66449d[_0xde3e('0x49')]['id'];}return db[_0xde3e('0x2a')]['find']({'where':{'id':_0x66449d[_0xde3e('0x45')]['id']}})[_0xde3e('0x24')](handleEntityNotFound(_0x2f2001,null))[_0xde3e('0x24')](saveUpdates(_0x66449d['body'],null))[_0xde3e('0x24')](respondWithResult(_0x2f2001,null))[_0xde3e('0x44')](handleError(_0x2f2001,null));};exports[_0xde3e('0x25')]=function(_0x652b39,_0x341f73){return db[_0xde3e('0x2a')][_0xde3e('0x4a')]({'where':{'id':_0x652b39[_0xde3e('0x45')]['id']}})['then'](handleEntityNotFound(_0x341f73,null))[_0xde3e('0x24')](removeEntity(_0x341f73,null))['catch'](handleError(_0x341f73,null));};exports[_0xde3e('0x4b')]=function(_0x450343,_0x3cbf58,_0x2e1fd7){var _0x2a9054={};var _0x2e4b24={};var _0x4b25c6;var _0x3118fd;return db['FreshdeskAccount'][_0xde3e('0x4c')]({'where':{'id':_0x450343[_0xde3e('0x45')]['id']}})[_0xde3e('0x24')](handleEntityNotFound(_0x3cbf58,null))['then'](function(_0x556025){if(_0x556025){_0x4b25c6=_0x556025;_0x2e4b24[_0xde3e('0x2e')]=_[_0xde3e('0x31')](db[_0xde3e('0x4d')][_0xde3e('0x46')]);_0x2e4b24[_0xde3e('0x30')]=_[_0xde3e('0x31')](_0x450343[_0xde3e('0x30')]);_0x2e4b24[_0xde3e('0x32')]=_[_0xde3e('0x33')](_0x2e4b24[_0xde3e('0x2e')],_0x2e4b24[_0xde3e('0x30')]);_0x2a9054['attributes']=_[_0xde3e('0x33')](_0x2e4b24['model'],qs[_0xde3e('0x35')](_0x450343[_0xde3e('0x30')][_0xde3e('0x35')]));_0x2a9054[_0xde3e('0x34')]=_0x2a9054['attributes'][_0xde3e('0x36')]?_0x2a9054[_0xde3e('0x34')]:_0x2e4b24[_0xde3e('0x2e')];_0x2a9054[_0xde3e('0x39')]=qs[_0xde3e('0x3a')](_0x450343[_0xde3e('0x30')][_0xde3e('0x3a')]);_0x2a9054[_0xde3e('0x3b')]=qs[_0xde3e('0x32')](_[_0xde3e('0x3c')](_0x450343[_0xde3e('0x30')],_0x2e4b24[_0xde3e('0x32')]));if(_0x450343[_0xde3e('0x30')]['filter']){_0x2a9054[_0xde3e('0x3b')]=_[_0xde3e('0x3e')](_0x2a9054[_0xde3e('0x3b')],{'$or':_[_0xde3e('0x2f')](_0x2a9054[_0xde3e('0x34')],function(_0x22def6){var _0x2dd312={};_0x2dd312[_0x22def6]={'$like':'%'+_0x450343[_0xde3e('0x30')]['filter']+'%'};return _0x2dd312;})});}_0x2a9054=_[_0xde3e('0x3e')]({},_0x2a9054,_0x450343[_0xde3e('0x3f')]);return _0x4b25c6[_0xde3e('0x4b')](_0x2a9054);}})[_0xde3e('0x24')](function(_0x1d6ba2){if(_0x1d6ba2){_0x3118fd=_0x1d6ba2[_0xde3e('0x36')];if(!_0x450343[_0xde3e('0x30')]['hasOwnProperty']('nolimit')){_0x2a9054['limit']=qs[_0xde3e('0x38')](_0x450343[_0xde3e('0x30')][_0xde3e('0x38')]);_0x2a9054[_0xde3e('0x1d')]=qs[_0xde3e('0x1d')](_0x450343[_0xde3e('0x30')][_0xde3e('0x1d')]);}return _0x4b25c6[_0xde3e('0x4b')](_0x2a9054);}})[_0xde3e('0x24')](function(_0x1f52e7){if(_0x1f52e7){return _0x1f52e7?{'count':_0x3118fd,'rows':_0x1f52e7}:null;}})['then'](respondWithResult(_0x3cbf58,null))[_0xde3e('0x44')](handleError(_0x3cbf58,null));};exports[_0xde3e('0x4e')]=function(_0x4c1e6c,_0x4a154f,_0x169051){if(_0x4c1e6c[_0xde3e('0x49')]['id']){delete _0x4c1e6c[_0xde3e('0x49')]['id'];}return db[_0xde3e('0x2a')][_0xde3e('0x4c')]({'where':{'id':_0x4c1e6c[_0xde3e('0x45')]['id']}})[_0xde3e('0x24')](handleEntityNotFound(_0x4a154f,null))[_0xde3e('0x24')](function(_0x44844c){if(_0x44844c){_0x4c1e6c[_0xde3e('0x49')]['AccountId']=_0x44844c['id'];_0x4c1e6c[_0xde3e('0x49')][_0xde3e('0x4f')]=integrations[_0xde3e('0x50')](_0x4c1e6c['body']['channel'],_0x4c1e6c[_0xde3e('0x49')]['type']);_0x4c1e6c[_0xde3e('0x49')]['Descriptions']=integrations[_0xde3e('0x51')](_0x4c1e6c[_0xde3e('0x49')]['channel'],_0x4c1e6c['body'][_0xde3e('0x2c')]);return db['FreshdeskConfiguration'][_0xde3e('0x48')](_0x4c1e6c[_0xde3e('0x49')],{'include':[{'model':db[_0xde3e('0x52')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0xde3e('0x24')](respondWithResult(_0x4a154f,null))[_0xde3e('0x44')](handleError(_0x4a154f,null));};exports['getFields']=function(_0x35395a,_0x54ab58,_0x4907e9){var _0x3a7775='';return db[_0xde3e('0x2a')][_0xde3e('0x4c')]({'where':{'id':_0x35395a['params']['id']},'attributes':['id',_0xde3e('0x53'),_0xde3e('0x54')]})['then'](handleEntityNotFound(_0x54ab58,null))[_0xde3e('0x24')](function(_0x1a5e3e){if(_0x1a5e3e){_0x3a7775=_0x1a5e3e[_0xde3e('0x53')];var _0x4b9dec=_0x3a7775[_0xde3e('0x55')](-0x1);if(_0x4b9dec==='/'){_0x3a7775=_0x3a7775[_0xde3e('0x56')](0x0,_0x3a7775[_0xde3e('0x57')](_0x4b9dec));}return rp({'method':_0xde3e('0x58'),'uri':util[_0xde3e('0x59')](_0xde3e('0x5a'),_0x3a7775,_0xde3e('0x5b')),'headers':{'Authorization':util[_0xde3e('0x59')](_0xde3e('0x5c'),new Buffer(util['format']('%s:X',_0x1a5e3e[_0xde3e('0x54')]))[_0xde3e('0x5d')](_0xde3e('0x5e')))},'json':!![]});}})[_0xde3e('0x24')](function(_0x5bc57a){if(_0x5bc57a){var _0x2867a5=[_0xde3e('0x5f'),_0xde3e('0x60'),_0xde3e('0x61'),_0xde3e('0x62'),_0xde3e('0x1b'),_0xde3e('0x63'),_0xde3e('0x64'),_0xde3e('0x65'),'ticket_type',_0xde3e('0x64'),_0xde3e('0x66')];_[_0xde3e('0x67')](_0x5bc57a,function(_0x230c48){return _0x2867a5[_0xde3e('0x68')](_0x230c48[_0xde3e('0x28')])||!_0x230c48[_0xde3e('0x69')]&&_0x230c48['type']!=='custom_text'&&_0x230c48[_0xde3e('0x2c')]!==_0xde3e('0x6a');});return{'count':_0x5bc57a['length'],'rows':_['map'](_0x5bc57a,function(_0x26f746){return{'id':_0x26f746[_0xde3e('0x28')],'name':_0x26f746['label'],'custom':!_0x26f746[_0xde3e('0x69')],'options':_0x26f746[_0xde3e('0x6b')]?_[_0xde3e('0x2f')](_0x26f746[_0xde3e('0x6b')],function(_0x5b0bfe){return{'name':_[_0xde3e('0x6c')](_0x5b0bfe),'value':_0x5b0bfe};}):[]};})};}})[_0xde3e('0x24')](respondWithResult(_0x54ab58,null))['catch'](function(_0x1d4d9d){var _0x5ce470=_0x35395a[_0xde3e('0x30')][_0xde3e('0x6d')]?0x1f4:_0x1d4d9d['statusCode']||0x1f4;logger[_0xde3e('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xde3e('0x6e'),_0x5ce470,JSON[_0xde3e('0x6f')](_0x1d4d9d));delete _0x1d4d9d[_0xde3e('0x28')];if(_0x5ce470===0x191){_0x5ce470=0x190;}_0x54ab58[_0xde3e('0x1b')](_0x5ce470)['send'](_0x35395a['query']['test']?{'message':_0xde3e('0x70'),'statusCode':_0x1d4d9d[_0xde3e('0x71')]}:_0x1d4d9d);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index a99ef31..5b454de 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 _0x860b=['moment','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','util','../../config/logger'];(function(_0xb5004c,_0x34011d){var _0x2caf4f=function(_0x5e3395){while(--_0x5e3395){_0xb5004c['push'](_0xb5004c['shift']());}};_0x2caf4f(++_0x34011d);}(_0x860b,0x19c));var _0xb860=function(_0x124f58,_0x5780ed){_0x124f58=_0x124f58-0x0;var _0x5c4f18=_0x860b[_0x124f58];return _0x5c4f18;};'use strict';var _=require('lodash');var util=require(_0xb860('0x0'));var logger=require(_0xb860('0x1'))('api');var moment=require(_0xb860('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb860('0x3'));var config=require(_0xb860('0x4'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xb860('0x5'));module[_0xb860('0x6')]=function(_0x519b75,_0xe6970c){return _0x519b75[_0xb860('0x7')](_0xb860('0x8'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd449=['int_freshdesk_accounts','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0xd449,0x175));var _0x9d44=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xd449[_0x5e42a7];return _0x36d21b;};'use strict';var _=require('lodash');var util=require(_0x9d44('0x0'));var logger=require(_0x9d44('0x1'))(_0x9d44('0x2'));var moment=require(_0x9d44('0x3'));var BPromise=require('bluebird');var rp=require(_0x9d44('0x4'));var fs=require('fs');var path=require(_0x9d44('0x5'));var rimraf=require('rimraf');var config=require(_0x9d44('0x6'));var attributes=require(_0x9d44('0x7'));var integrations=require(_0x9d44('0x8'));module[_0x9d44('0x9')]=function(_0x4a2678,_0x23153d){return _0x4a2678[_0x9d44('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x9d44('0xb'),'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 3f63661..619b5ea 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 _0x43f3=['findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowFreshdeskAccount','find','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','GetFreshdeskAccount','FreshdeskAccount'];(function(_0x4b8fc7,_0x5022fc){var _0x249f4a=function(_0x1b25d4){while(--_0x1b25d4){_0x4b8fc7['push'](_0x4b8fc7['shift']());}};_0x249f4a(++_0x5022fc);}(_0x43f3,0x16d));var _0x343f=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x43f3[_0x101e7b];return _0x4995c0;};'use strict';var _=require('lodash');var util=require(_0x343f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x343f('0x1'));var db=require(_0x343f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x343f('0x3'))(_0x343f('0x4'));var config=require(_0x343f('0x5'));var jayson=require(_0x343f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5f25d8,_0x165811,_0x59d386){return new BPromise(function(_0x1865b0,_0x299643){return client[_0x343f('0x7')](_0x5f25d8,_0x59d386)[_0x343f('0x8')](function(_0x541771){logger[_0x343f('0x9')]('FreshdeskAccount,\x20%s,\x20%s',_0x165811,_0x343f('0xa'));logger[_0x343f('0xb')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x165811,'request\x20sent',JSON['stringify'](_0x541771));if(_0x541771[_0x343f('0xc')]){if(_0x541771[_0x343f('0xc')][_0x343f('0xd')]===0x1f4){logger[_0x343f('0xc')](_0x343f('0xe'),_0x165811,_0x541771[_0x343f('0xc')][_0x343f('0xf')]);return _0x299643(_0x541771[_0x343f('0xc')][_0x343f('0xf')]);}logger['error'](_0x343f('0xe'),_0x165811,_0x541771[_0x343f('0xc')][_0x343f('0xf')]);return _0x1865b0(_0x541771['error'][_0x343f('0xf')]);}else{logger['info'](_0x343f('0xe'),_0x165811,'request\x20sent');_0x1865b0(_0x541771[_0x343f('0x10')]['message']);}})['catch'](function(_0x3700ec){logger['error'](_0x343f('0xe'),_0x165811,_0x3700ec);_0x299643(_0x3700ec);});});}exports[_0x343f('0x11')]=function(_0x2c544c){var _0x1ade0b=this;return new Promise(function(_0x536882,_0x1b07c5){return db[_0x343f('0x12')][_0x343f('0x13')]({'raw':_0x2c544c[_0x343f('0x14')]?_0x2c544c[_0x343f('0x14')][_0x343f('0x15')]===undefined?!![]:![]:!![],'where':_0x2c544c['options']?_0x2c544c[_0x343f('0x14')][_0x343f('0x16')]||null:null,'attributes':_0x2c544c['options']?_0x2c544c[_0x343f('0x14')][_0x343f('0x17')]||null:null,'limit':_0x2c544c['options']?_0x2c544c[_0x343f('0x14')][_0x343f('0x18')]||null:null,'include':_0x2c544c['options']?_0x2c544c[_0x343f('0x14')][_0x343f('0x19')]?_[_0x343f('0x1a')](_0x2c544c[_0x343f('0x14')]['include'],function(_0x4dfe0c){return{'model':db[_0x4dfe0c[_0x343f('0x1b')]],'as':_0x4dfe0c['as'],'attributes':_0x4dfe0c[_0x343f('0x17')],'include':_0x4dfe0c[_0x343f('0x19')]?_[_0x343f('0x1a')](_0x4dfe0c[_0x343f('0x19')],function(_0x136ed7){return{'model':db[_0x136ed7[_0x343f('0x1b')]],'as':_0x136ed7['as'],'attributes':_0x136ed7[_0x343f('0x17')],'include':_0x136ed7[_0x343f('0x19')]?_[_0x343f('0x1a')](_0x136ed7[_0x343f('0x19')],function(_0x17ca5c){return{'model':db[_0x17ca5c[_0x343f('0x1b')]],'as':_0x17ca5c['as'],'attributes':_0x17ca5c[_0x343f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x343f('0x8')](function(_0xd97058){logger[_0x343f('0x9')](_0x343f('0x11'),_0x2c544c);logger[_0x343f('0xb')](_0x343f('0x11'),_0x2c544c,JSON[_0x343f('0x1c')](_0xd97058));_0x536882(_0xd97058);})[_0x343f('0x1d')](function(_0x5dfcaf){logger[_0x343f('0xc')](_0x343f('0x11'),_0x5dfcaf['message'],_0x2c544c);_0x1b07c5(_0x1ade0b[_0x343f('0xc')](0x1f4,_0x5dfcaf[_0x343f('0xf')]));});});};exports[_0x343f('0x1e')]=function(_0x3b0a63){var _0x1605a9=this;return new Promise(function(_0x43032f,_0x51833a){return db[_0x343f('0x12')][_0x343f('0x1f')]({'raw':_0x3b0a63[_0x343f('0x14')]?_0x3b0a63[_0x343f('0x14')][_0x343f('0x15')]===undefined?!![]:![]:!![],'where':_0x3b0a63['options']?_0x3b0a63['options'][_0x343f('0x16')]||null:null,'attributes':_0x3b0a63[_0x343f('0x14')]?_0x3b0a63['options'][_0x343f('0x17')]||null:null,'include':_0x3b0a63['options']?_0x3b0a63[_0x343f('0x14')][_0x343f('0x19')]?_[_0x343f('0x1a')](_0x3b0a63[_0x343f('0x14')][_0x343f('0x19')],function(_0x383390){return{'model':db[_0x383390['model']],'as':_0x383390['as'],'attributes':_0x383390['attributes'],'include':_0x383390[_0x343f('0x19')]?_[_0x343f('0x1a')](_0x383390[_0x343f('0x19')],function(_0xd2e24a){return{'model':db[_0xd2e24a[_0x343f('0x1b')]],'as':_0xd2e24a['as'],'attributes':_0xd2e24a[_0x343f('0x17')],'include':_0xd2e24a[_0x343f('0x19')]?_[_0x343f('0x1a')](_0xd2e24a[_0x343f('0x19')],function(_0x2818fe){return{'model':db[_0x2818fe[_0x343f('0x1b')]],'as':_0x2818fe['as'],'attributes':_0x2818fe[_0x343f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x343f('0x8')](function(_0x2b6649){logger[_0x343f('0x9')](_0x343f('0x1e'),_0x3b0a63);logger[_0x343f('0xb')](_0x343f('0x1e'),_0x3b0a63,JSON[_0x343f('0x1c')](_0x2b6649));_0x43032f(_0x2b6649);})[_0x343f('0x1d')](function(_0x380197){logger[_0x343f('0xc')](_0x343f('0x1e'),_0x380197[_0x343f('0xf')],_0x3b0a63);_0x51833a(_0x1605a9[_0x343f('0xc')](0x1f4,_0x380197[_0x343f('0xf')]));});});}; \ No newline at end of file +var _0x8098=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find'];(function(_0x399251,_0x3188da){var _0x41cc5c=function(_0x5819ec){while(--_0x5819ec){_0x399251['push'](_0x399251['shift']());}};_0x41cc5c(++_0x3188da);}(_0x8098,0x1ba));var _0x8809=function(_0x199c16,_0x577ee8){_0x199c16=_0x199c16-0x0;var _0x490c09=_0x8098[_0x199c16];return _0x490c09;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8809('0x0'));var BPromise=require(_0x8809('0x1'));var rs=require(_0x8809('0x2'));var fs=require('fs');var Redis=require(_0x8809('0x3'));var db=require(_0x8809('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8809('0x5'))(_0x8809('0x6'));var config=require(_0x8809('0x7'));var jayson=require(_0x8809('0x8'));var client=jayson['client'][_0x8809('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2af39c,_0x54880c,_0x3f4bee){return new BPromise(function(_0x3fd084,_0x181e8b){return client[_0x8809('0xa')](_0x2af39c,_0x3f4bee)[_0x8809('0xb')](function(_0x34f85f){logger[_0x8809('0xc')](_0x8809('0xd'),_0x54880c,_0x8809('0xe'));logger[_0x8809('0xf')](_0x8809('0x10'),_0x54880c,_0x8809('0xe'),JSON[_0x8809('0x11')](_0x34f85f));if(_0x34f85f[_0x8809('0x12')]){if(_0x34f85f[_0x8809('0x12')][_0x8809('0x13')]===0x1f4){logger['error'](_0x8809('0xd'),_0x54880c,_0x34f85f[_0x8809('0x12')]['message']);return _0x181e8b(_0x34f85f[_0x8809('0x12')][_0x8809('0x14')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x54880c,_0x34f85f[_0x8809('0x12')][_0x8809('0x14')]);return _0x3fd084(_0x34f85f[_0x8809('0x12')][_0x8809('0x14')]);}else{logger[_0x8809('0xc')](_0x8809('0xd'),_0x54880c,_0x8809('0xe'));_0x3fd084(_0x34f85f['result'][_0x8809('0x14')]);}})[_0x8809('0x15')](function(_0x494814){logger[_0x8809('0x12')](_0x8809('0xd'),_0x54880c,_0x494814);_0x181e8b(_0x494814);});});}exports['GetFreshdeskAccount']=function(_0x3b0562){var _0x8ec527=this;return new Promise(function(_0x7ec1a6,_0x17289e){return db[_0x8809('0x16')]['findAll']({'raw':_0x3b0562['options']?_0x3b0562[_0x8809('0x17')][_0x8809('0x18')]===undefined?!![]:![]:!![],'where':_0x3b0562[_0x8809('0x17')]?_0x3b0562[_0x8809('0x17')][_0x8809('0x19')]||null:null,'attributes':_0x3b0562[_0x8809('0x17')]?_0x3b0562[_0x8809('0x17')][_0x8809('0x1a')]||null:null,'limit':_0x3b0562[_0x8809('0x17')]?_0x3b0562[_0x8809('0x17')][_0x8809('0x1b')]||null:null,'include':_0x3b0562[_0x8809('0x17')]?_0x3b0562[_0x8809('0x17')]['include']?_['map'](_0x3b0562[_0x8809('0x17')][_0x8809('0x1c')],function(_0x521840){return{'model':db[_0x521840['model']],'as':_0x521840['as'],'attributes':_0x521840['attributes'],'include':_0x521840[_0x8809('0x1c')]?_[_0x8809('0x1d')](_0x521840[_0x8809('0x1c')],function(_0x2bbf26){return{'model':db[_0x2bbf26[_0x8809('0x1e')]],'as':_0x2bbf26['as'],'attributes':_0x2bbf26[_0x8809('0x1a')],'include':_0x2bbf26[_0x8809('0x1c')]?_[_0x8809('0x1d')](_0x2bbf26[_0x8809('0x1c')],function(_0x6e5dc8){return{'model':db[_0x6e5dc8[_0x8809('0x1e')]],'as':_0x6e5dc8['as'],'attributes':_0x6e5dc8[_0x8809('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c7cbf){logger[_0x8809('0xc')](_0x8809('0x1f'),_0x3b0562);logger['debug'](_0x8809('0x1f'),_0x3b0562,JSON[_0x8809('0x11')](_0x5c7cbf));_0x7ec1a6(_0x5c7cbf);})[_0x8809('0x15')](function(_0x296187){logger[_0x8809('0x12')]('GetFreshdeskAccount',_0x296187[_0x8809('0x14')],_0x3b0562);_0x17289e(_0x8ec527['error'](0x1f4,_0x296187[_0x8809('0x14')]));});});};exports[_0x8809('0x20')]=function(_0x5f5d5d){var _0x2c505c=this;return new Promise(function(_0x4cd927,_0x1e3edf){return db[_0x8809('0x16')][_0x8809('0x21')]({'raw':_0x5f5d5d[_0x8809('0x17')]?_0x5f5d5d[_0x8809('0x17')][_0x8809('0x18')]===undefined?!![]:![]:!![],'where':_0x5f5d5d['options']?_0x5f5d5d['options'][_0x8809('0x19')]||null:null,'attributes':_0x5f5d5d[_0x8809('0x17')]?_0x5f5d5d[_0x8809('0x17')][_0x8809('0x1a')]||null:null,'include':_0x5f5d5d[_0x8809('0x17')]?_0x5f5d5d['options'][_0x8809('0x1c')]?_['map'](_0x5f5d5d['options'][_0x8809('0x1c')],function(_0x5efc32){return{'model':db[_0x5efc32[_0x8809('0x1e')]],'as':_0x5efc32['as'],'attributes':_0x5efc32['attributes'],'include':_0x5efc32[_0x8809('0x1c')]?_[_0x8809('0x1d')](_0x5efc32[_0x8809('0x1c')],function(_0x85ebcd){return{'model':db[_0x85ebcd[_0x8809('0x1e')]],'as':_0x85ebcd['as'],'attributes':_0x85ebcd[_0x8809('0x1a')],'include':_0x85ebcd['include']?_[_0x8809('0x1d')](_0x85ebcd[_0x8809('0x1c')],function(_0x5b7b13){return{'model':db[_0x5b7b13[_0x8809('0x1e')]],'as':_0x5b7b13['as'],'attributes':_0x5b7b13[_0x8809('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8809('0xb')](function(_0x2f584f){logger[_0x8809('0xc')](_0x8809('0x20'),_0x5f5d5d);logger['debug'](_0x8809('0x20'),_0x5f5d5d,JSON[_0x8809('0x11')](_0x2f584f));_0x4cd927(_0x2f584f);})[_0x8809('0x15')](function(_0x2af931){logger[_0x8809('0x12')](_0x8809('0x20'),_0x2af931[_0x8809('0x14')],_0x5f5d5d);_0x1e3edf(_0x2c505c[_0x8809('0x12')](0x1f4,_0x2af931['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6039a5f..49f661d 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 _0x7777=['getDescriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','/:id','/:id/fields','getFields','get','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x1d16c3,_0xadb5e8){var _0x1e2495=function(_0x5bacf8){while(--_0x5bacf8){_0x1d16c3['push'](_0x1d16c3['shift']());}};_0x1e2495(++_0xadb5e8);}(_0x7777,0x1c2));var _0x7777=function(_0x4489b6,_0x47c466){_0x4489b6=_0x4489b6-0x0;var _0x13a4bb=_0x7777[_0x4489b6];return _0x13a4bb;};'use strict';var multer=require(_0x7777('0x0'));var util=require(_0x7777('0x1'));var path=require(_0x7777('0x2'));var timeout=require(_0x7777('0x3'));var express=require(_0x7777('0x4'));var router=express[_0x7777('0x5')]();var fs_extra=require(_0x7777('0x6'));var auth=require(_0x7777('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7777('0x8'));router['get']('/',auth[_0x7777('0x9')](),controller[_0x7777('0xa')]);router['get'](_0x7777('0xb'),auth[_0x7777('0x9')](),controller['show']);router['get'](_0x7777('0xc'),auth[_0x7777('0x9')](),controller[_0x7777('0xd')]);router[_0x7777('0xe')](_0x7777('0xf'),auth[_0x7777('0x9')](),controller[_0x7777('0x10')]);router[_0x7777('0xe')](_0x7777('0x11'),auth[_0x7777('0x9')](),controller[_0x7777('0x12')]);router[_0x7777('0xe')](_0x7777('0x13'),auth[_0x7777('0x9')](),controller[_0x7777('0x14')]);router[_0x7777('0x15')]('/',auth[_0x7777('0x9')](),controller['create']);router['post'](_0x7777('0x13'),auth['isAuthenticated'](),controller[_0x7777('0x16')]);router['put'](_0x7777('0xb'),auth[_0x7777('0x9')](),controller[_0x7777('0x17')]);router[_0x7777('0x18')](_0x7777('0xb'),auth[_0x7777('0x9')](),controller[_0x7777('0x19')]);module['exports']=router; \ No newline at end of file +var _0x7598=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','exports','util','path'];(function(_0x4cc03b,_0x299f1c){var _0xf0358c=function(_0x3d0da8){while(--_0x3d0da8){_0x4cc03b['push'](_0x4cc03b['shift']());}};_0xf0358c(++_0x299f1c);}(_0x7598,0x106));var _0x8759=function(_0x43eb88,_0x93d4e1){_0x43eb88=_0x43eb88-0x0;var _0x387881=_0x7598[_0x43eb88];return _0x387881;};'use strict';var multer=require('multer');var util=require(_0x8759('0x0'));var path=require(_0x8759('0x1'));var timeout=require('connect-timeout');var express=require(_0x8759('0x2'));var router=express[_0x8759('0x3')]();var fs_extra=require(_0x8759('0x4'));var auth=require(_0x8759('0x5'));var interaction=require(_0x8759('0x6'));var config=require(_0x8759('0x7'));var controller=require(_0x8759('0x8'));router[_0x8759('0x9')]('/',auth[_0x8759('0xa')](),controller[_0x8759('0xb')]);router[_0x8759('0x9')](_0x8759('0xc'),auth[_0x8759('0xa')](),controller[_0x8759('0xd')]);router[_0x8759('0x9')]('/:id/fields',auth[_0x8759('0xa')](),controller['getFields']);router[_0x8759('0x9')](_0x8759('0xe'),auth[_0x8759('0xa')](),controller['getSubjects']);router[_0x8759('0x9')](_0x8759('0xf'),auth[_0x8759('0xa')](),controller['getDescriptions']);router['get'](_0x8759('0x10'),auth[_0x8759('0xa')](),controller[_0x8759('0x11')]);router['post']('/',auth[_0x8759('0xa')](),controller['create']);router[_0x8759('0x12')]('/:id/tags',auth[_0x8759('0xa')](),controller[_0x8759('0x13')]);router['put'](_0x8759('0xc'),auth[_0x8759('0xa')](),controller[_0x8759('0x14')]);router[_0x8759('0x15')](_0x8759('0xc'),auth[_0x8759('0xa')](),controller[_0x8759('0x16')]);module[_0x8759('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 24605d4..40a108c 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 _0x82c6=['sequelize','exports','STRING'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x82c6,0x168));var _0x682c=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x82c6[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x682c('0x0'));module[_0x682c('0x1')]={'name':{'type':Sequelize[_0x682c('0x2')]},'description':{'type':Sequelize[_0x682c('0x2')]}}; \ No newline at end of file +var _0x74bb=['sequelize','STRING'];(function(_0x350a64,_0x592f1d){var _0x445cc0=function(_0x15496f){while(--_0x15496f){_0x350a64['push'](_0x350a64['shift']());}};_0x445cc0(++_0x592f1d);}(_0x74bb,0xa2));var _0xb74b=function(_0x59e893,_0x3adcb9){_0x59e893=_0x59e893-0x0;var _0x56046e=_0x74bb[_0x59e893];return _0x56046e;};'use strict';var Sequelize=require(_0xb74b('0x0'));module['exports']={'name':{'type':Sequelize[_0xb74b('0x1')]},'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 96d6253..75179fc 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 _0xe6c1=['params','model','create','body','find','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','options','getDescriptions','nolimit','Tag','getTags','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0xe6c1,0x16c));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x1e6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e6c('0x1'));var jsonpatch=require(_0x1e6c('0x2'));var rp=require(_0x1e6c('0x3'));var moment=require(_0x1e6c('0x4'));var BPromise=require(_0x1e6c('0x5'));var Mustache=require('mustache');var util=require(_0x1e6c('0x6'));var path=require(_0x1e6c('0x7'));var sox=require(_0x1e6c('0x8'));var csv=require(_0x1e6c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e6c('0xa'));var _=require('lodash');var squel=require(_0x1e6c('0xb'));var crypto=require(_0x1e6c('0xc'));var jsforce=require(_0x1e6c('0xd'));var deskjs=require(_0x1e6c('0xe'));var toCsv=require(_0x1e6c('0x9'));var querystring=require(_0x1e6c('0xf'));var Papa=require(_0x1e6c('0x10'));var Redis=require(_0x1e6c('0x11'));var authService=require(_0x1e6c('0x12'));var qs=require(_0x1e6c('0x13'));var as=require(_0x1e6c('0x14'));var hardwareService=require(_0x1e6c('0x15'));var logger=require(_0x1e6c('0x16'))(_0x1e6c('0x17'));var utils=require('../../config/utils');var config=require(_0x1e6c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e6c('0x19'))['db'];function respondWithStatusCode(_0x3e918e,_0x2bce5f){_0x2bce5f=_0x2bce5f||0xcc;return function(_0x19a69f){if(_0x19a69f){return _0x3e918e['sendStatus'](_0x2bce5f);}return _0x3e918e['status'](_0x2bce5f)[_0x1e6c('0x1a')]();};}function respondWithResult(_0x34a1fe,_0x2d7669){_0x2d7669=_0x2d7669||0xc8;return function(_0x32a38d){if(_0x32a38d){return _0x34a1fe[_0x1e6c('0x1b')](_0x2d7669)[_0x1e6c('0x1c')](_0x32a38d);}};}function respondWithFilteredResult(_0x2ac520,_0x4054d4){return function(_0x5e2bfd){if(_0x5e2bfd){var _0x34ea0a=typeof _0x4054d4[_0x1e6c('0x1d')]===_0x1e6c('0x1e')&&typeof _0x4054d4['limit']===_0x1e6c('0x1e');var _0x2120ab=_0x5e2bfd[_0x1e6c('0x1f')];var _0x3f0c6e=_0x34ea0a?0x0:_0x4054d4[_0x1e6c('0x1d')];var _0x29fd61=_0x34ea0a?_0x5e2bfd[_0x1e6c('0x1f')]:_0x4054d4[_0x1e6c('0x1d')]+_0x4054d4[_0x1e6c('0x20')];var _0x197c39;if(_0x29fd61>=_0x2120ab){_0x29fd61=_0x2120ab;_0x197c39=0xc8;}else{_0x197c39=0xce;}_0x2ac520[_0x1e6c('0x1b')](_0x197c39);return _0x2ac520[_0x1e6c('0x21')](_0x1e6c('0x22'),_0x3f0c6e+'-'+_0x29fd61+'/'+_0x2120ab)[_0x1e6c('0x1c')](_0x5e2bfd);}return null;};}function patchUpdates(_0x5264d9){return function(_0x351222){try{jsonpatch['apply'](_0x351222,_0x5264d9,!![]);}catch(_0x1fc892){return BPromise[_0x1e6c('0x23')](_0x1fc892);}return _0x351222[_0x1e6c('0x24')]();};}function saveUpdates(_0xcd97cc,_0x3ba018){return function(_0x1ac599){if(_0x1ac599){return _0x1ac599[_0x1e6c('0x25')](_0xcd97cc)[_0x1e6c('0x26')](function(_0x5c090c){return _0x5c090c;});}return null;};}function removeEntity(_0x459bdc,_0x2aa706){return function(_0xe99419){if(_0xe99419){return _0xe99419[_0x1e6c('0x27')]()[_0x1e6c('0x26')](function(){_0x459bdc[_0x1e6c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x320174,_0x5279fc){return function(_0x5c069f){if(!_0x5c069f){_0x320174[_0x1e6c('0x28')](0x194);}return _0x5c069f;};}function handleError(_0x3bbf4a,_0x509c43){_0x509c43=_0x509c43||0x1f4;return function(_0x42e531){logger[_0x1e6c('0x29')](_0x42e531[_0x1e6c('0x2a')]);if(_0x42e531[_0x1e6c('0x2b')]){delete _0x42e531[_0x1e6c('0x2b')];}_0x3bbf4a[_0x1e6c('0x1b')](_0x509c43)[_0x1e6c('0x2c')](_0x42e531);};}exports[_0x1e6c('0x2d')]=function(_0x27e044,_0x535e5f){var _0x1cdbef={},_0x4b8a55={},_0x1a9a9a={'count':0x0,'rows':[]};var _0x10663e=_['map'](db[_0x1e6c('0x2e')][_0x1e6c('0x2f')],function(_0xb42765){return{'name':_0xb42765[_0x1e6c('0x30')],'type':_0xb42765[_0x1e6c('0x31')][_0x1e6c('0x32')]};});_0x4b8a55['model']=_[_0x1e6c('0x33')](_0x10663e,_0x1e6c('0x2b'));_0x4b8a55['query']=_[_0x1e6c('0x34')](_0x27e044[_0x1e6c('0x35')]);_0x4b8a55[_0x1e6c('0x36')]=_[_0x1e6c('0x37')](_0x4b8a55['model'],_0x4b8a55[_0x1e6c('0x35')]);_0x1cdbef['attributes']=_['intersection'](_0x4b8a55['model'],qs[_0x1e6c('0x38')](_0x27e044[_0x1e6c('0x35')][_0x1e6c('0x38')]));_0x1cdbef[_0x1e6c('0x39')]=_0x1cdbef['attributes'][_0x1e6c('0x3a')]?_0x1cdbef['attributes']:_0x4b8a55['model'];if(!_0x27e044['query']['hasOwnProperty']('nolimit')){_0x1cdbef[_0x1e6c('0x20')]=qs['limit'](_0x27e044[_0x1e6c('0x35')][_0x1e6c('0x20')]);_0x1cdbef[_0x1e6c('0x1d')]=qs['offset'](_0x27e044['query'][_0x1e6c('0x1d')]);}_0x1cdbef[_0x1e6c('0x3b')]=qs['sort'](_0x27e044[_0x1e6c('0x35')][_0x1e6c('0x3c')]);_0x1cdbef[_0x1e6c('0x3d')]=qs[_0x1e6c('0x36')](_[_0x1e6c('0x3e')](_0x27e044[_0x1e6c('0x35')],_0x4b8a55[_0x1e6c('0x36')]),_0x10663e);if(_0x27e044[_0x1e6c('0x35')][_0x1e6c('0x3f')]){_0x1cdbef[_0x1e6c('0x3d')]=_[_0x1e6c('0x40')](_0x1cdbef['where'],{'$or':_[_0x1e6c('0x33')](_0x10663e,function(_0x1b95c1){if(_0x1b95c1['type']!==_0x1e6c('0x41')){var _0xebf4ac={};_0xebf4ac[_0x1b95c1[_0x1e6c('0x2b')]]={'$like':'%'+_0x27e044[_0x1e6c('0x35')][_0x1e6c('0x3f')]+'%'};return _0xebf4ac;}})});}_0x1cdbef=_['merge']({},_0x1cdbef,_0x27e044['options']);var _0xd77168={'where':_0x1cdbef[_0x1e6c('0x3d')]};return db[_0x1e6c('0x2e')]['count'](_0xd77168)[_0x1e6c('0x26')](function(_0x1553c8){_0x1a9a9a[_0x1e6c('0x1f')]=_0x1553c8;if(_0x27e044[_0x1e6c('0x35')][_0x1e6c('0x42')]){_0x1cdbef[_0x1e6c('0x43')]=[{'all':!![]}];}return db[_0x1e6c('0x2e')][_0x1e6c('0x44')](_0x1cdbef);})[_0x1e6c('0x26')](function(_0x3ca1b1){_0x1a9a9a[_0x1e6c('0x45')]=_0x3ca1b1;return _0x1a9a9a;})[_0x1e6c('0x26')](respondWithFilteredResult(_0x535e5f,_0x1cdbef))[_0x1e6c('0x46')](handleError(_0x535e5f,null));};exports['show']=function(_0x743877,_0x181385){var _0x15f74c={'raw':![],'where':{'id':_0x743877[_0x1e6c('0x47')]['id']}},_0x4fc0b0={};_0x4fc0b0['model']=_[_0x1e6c('0x34')](db[_0x1e6c('0x2e')]['rawAttributes']);_0x4fc0b0['query']=_[_0x1e6c('0x34')](_0x743877[_0x1e6c('0x35')]);_0x4fc0b0[_0x1e6c('0x36')]=_[_0x1e6c('0x37')](_0x4fc0b0[_0x1e6c('0x48')],_0x4fc0b0[_0x1e6c('0x35')]);_0x15f74c[_0x1e6c('0x39')]=_[_0x1e6c('0x37')](_0x4fc0b0['model'],qs['fields'](_0x743877[_0x1e6c('0x35')][_0x1e6c('0x38')]));_0x15f74c[_0x1e6c('0x39')]=_0x15f74c[_0x1e6c('0x39')]['length']?_0x15f74c[_0x1e6c('0x39')]:_0x4fc0b0[_0x1e6c('0x48')];if(_0x743877['query'][_0x1e6c('0x42')]){_0x15f74c['include']=[{'all':!![]}];}_0x15f74c=_[_0x1e6c('0x40')]({},_0x15f74c,_0x743877['options']);return db[_0x1e6c('0x2e')]['find'](_0x15f74c)['then'](handleEntityNotFound(_0x181385,null))['then'](respondWithResult(_0x181385,null))[_0x1e6c('0x46')](handleError(_0x181385,null));};exports[_0x1e6c('0x49')]=function(_0x20c998,_0x5729cc){return db[_0x1e6c('0x2e')]['create'](_0x20c998[_0x1e6c('0x4a')],{})[_0x1e6c('0x26')](respondWithResult(_0x5729cc,0xc9))[_0x1e6c('0x46')](handleError(_0x5729cc,null));};exports[_0x1e6c('0x25')]=function(_0x5e97f3,_0x2d97b4){if(_0x5e97f3[_0x1e6c('0x4a')]['id']){delete _0x5e97f3['body']['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x5e97f3[_0x1e6c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d97b4,null))[_0x1e6c('0x26')](saveUpdates(_0x5e97f3[_0x1e6c('0x4a')],null))[_0x1e6c('0x26')](respondWithResult(_0x2d97b4,null))[_0x1e6c('0x46')](handleError(_0x2d97b4,null));};exports[_0x1e6c('0x27')]=function(_0x36ddb7,_0x5169f2){return db['FreshdeskConfiguration'][_0x1e6c('0x4b')]({'where':{'id':_0x36ddb7[_0x1e6c('0x47')]['id']}})[_0x1e6c('0x26')](handleEntityNotFound(_0x5169f2,null))[_0x1e6c('0x26')](removeEntity(_0x5169f2,null))[_0x1e6c('0x46')](handleError(_0x5169f2,null));};exports[_0x1e6c('0x4c')]=function(_0x2b2e54,_0x4f9240,_0x4c4eba){var _0x25264e={};var _0x42f4fc={};var _0x46efe8;var _0x130e38;return db[_0x1e6c('0x2e')][_0x1e6c('0x4d')]({'where':{'id':_0x2b2e54['params']['id']}})[_0x1e6c('0x26')](handleEntityNotFound(_0x4f9240,null))[_0x1e6c('0x26')](function(_0x56c1b2){if(_0x56c1b2){_0x46efe8=_0x56c1b2;_0x42f4fc['model']=_[_0x1e6c('0x34')](db[_0x1e6c('0x4e')]['rawAttributes']);_0x42f4fc['query']=_['keys'](_0x2b2e54[_0x1e6c('0x35')]);_0x42f4fc['filters']=_[_0x1e6c('0x37')](_0x42f4fc[_0x1e6c('0x48')],_0x42f4fc[_0x1e6c('0x35')]);_0x25264e[_0x1e6c('0x39')]=_[_0x1e6c('0x37')](_0x42f4fc[_0x1e6c('0x48')],qs[_0x1e6c('0x38')](_0x2b2e54[_0x1e6c('0x35')][_0x1e6c('0x38')]));_0x25264e[_0x1e6c('0x39')]=_0x25264e[_0x1e6c('0x39')]['length']?_0x25264e['attributes']:_0x42f4fc[_0x1e6c('0x48')];_0x25264e[_0x1e6c('0x3b')]=qs[_0x1e6c('0x3c')](_0x2b2e54['query'][_0x1e6c('0x3c')]);_0x25264e['where']=qs['filters'](_[_0x1e6c('0x3e')](_0x2b2e54[_0x1e6c('0x35')],_0x42f4fc['filters']));if(_0x2b2e54['query'][_0x1e6c('0x3f')]){_0x25264e[_0x1e6c('0x3d')]=_[_0x1e6c('0x40')](_0x25264e[_0x1e6c('0x3d')],{'$or':_[_0x1e6c('0x33')](_0x25264e[_0x1e6c('0x39')],function(_0x28ca02){var _0x185b36={};_0x185b36[_0x28ca02]={'$like':'%'+_0x2b2e54[_0x1e6c('0x35')]['filter']+'%'};return _0x185b36;})});}_0x25264e=_[_0x1e6c('0x40')]({},_0x25264e,_0x2b2e54['options']);return _0x46efe8[_0x1e6c('0x4c')](_0x25264e);}})[_0x1e6c('0x26')](function(_0x28c291){if(_0x28c291){_0x130e38=_0x28c291[_0x1e6c('0x3a')];if(!_0x2b2e54[_0x1e6c('0x35')][_0x1e6c('0x4f')]('nolimit')){_0x25264e[_0x1e6c('0x20')]=qs[_0x1e6c('0x20')](_0x2b2e54[_0x1e6c('0x35')][_0x1e6c('0x20')]);_0x25264e[_0x1e6c('0x1d')]=qs[_0x1e6c('0x1d')](_0x2b2e54['query'][_0x1e6c('0x1d')]);}return _0x46efe8[_0x1e6c('0x4c')](_0x25264e);}})[_0x1e6c('0x26')](function(_0x410733){if(_0x410733){return _0x410733?{'count':_0x130e38,'rows':_0x410733}:null;}})[_0x1e6c('0x26')](respondWithResult(_0x4f9240,null))[_0x1e6c('0x46')](handleError(_0x4f9240,null));};exports[_0x1e6c('0x50')]=function(_0x39dc3c,_0x1c0f85,_0x394ac0){var _0x23c581={};var _0x292ecd={};var _0x5f37dc;var _0x117475;return db['FreshdeskConfiguration'][_0x1e6c('0x4d')]({'where':{'id':_0x39dc3c[_0x1e6c('0x47')]['id']}})[_0x1e6c('0x26')](handleEntityNotFound(_0x1c0f85,null))['then'](function(_0x5dc2bb){if(_0x5dc2bb){_0x5f37dc=_0x5dc2bb;_0x292ecd[_0x1e6c('0x48')]=_[_0x1e6c('0x34')](db['FreshdeskField'][_0x1e6c('0x2f')]);_0x292ecd[_0x1e6c('0x35')]=_[_0x1e6c('0x34')](_0x39dc3c[_0x1e6c('0x35')]);_0x292ecd[_0x1e6c('0x36')]=_[_0x1e6c('0x37')](_0x292ecd['model'],_0x292ecd[_0x1e6c('0x35')]);_0x23c581[_0x1e6c('0x39')]=_[_0x1e6c('0x37')](_0x292ecd[_0x1e6c('0x48')],qs[_0x1e6c('0x38')](_0x39dc3c['query'][_0x1e6c('0x38')]));_0x23c581[_0x1e6c('0x39')]=_0x23c581['attributes'][_0x1e6c('0x3a')]?_0x23c581[_0x1e6c('0x39')]:_0x292ecd[_0x1e6c('0x48')];_0x23c581[_0x1e6c('0x3b')]=qs[_0x1e6c('0x3c')](_0x39dc3c[_0x1e6c('0x35')][_0x1e6c('0x3c')]);_0x23c581['where']=qs[_0x1e6c('0x36')](_[_0x1e6c('0x3e')](_0x39dc3c[_0x1e6c('0x35')],_0x292ecd[_0x1e6c('0x36')]));if(_0x39dc3c[_0x1e6c('0x35')][_0x1e6c('0x3f')]){_0x23c581[_0x1e6c('0x3d')]=_[_0x1e6c('0x40')](_0x23c581[_0x1e6c('0x3d')],{'$or':_[_0x1e6c('0x33')](_0x23c581[_0x1e6c('0x39')],function(_0x3b4c4e){var _0x352d98={};_0x352d98[_0x3b4c4e]={'$like':'%'+_0x39dc3c[_0x1e6c('0x35')][_0x1e6c('0x3f')]+'%'};return _0x352d98;})});}_0x23c581=_[_0x1e6c('0x40')]({},_0x23c581,_0x39dc3c[_0x1e6c('0x51')]);return _0x5f37dc[_0x1e6c('0x50')](_0x23c581);}})[_0x1e6c('0x26')](function(_0x18ce7d){if(_0x18ce7d){_0x117475=_0x18ce7d[_0x1e6c('0x3a')];if(!_0x39dc3c[_0x1e6c('0x35')][_0x1e6c('0x4f')]('nolimit')){_0x23c581['limit']=qs['limit'](_0x39dc3c[_0x1e6c('0x35')][_0x1e6c('0x20')]);_0x23c581[_0x1e6c('0x1d')]=qs[_0x1e6c('0x1d')](_0x39dc3c[_0x1e6c('0x35')]['offset']);}return _0x5f37dc[_0x1e6c('0x50')](_0x23c581);}})[_0x1e6c('0x26')](function(_0x3e32b3){if(_0x3e32b3){return _0x3e32b3?{'count':_0x117475,'rows':_0x3e32b3}:null;}})[_0x1e6c('0x26')](respondWithResult(_0x1c0f85,null))[_0x1e6c('0x46')](handleError(_0x1c0f85,null));};exports[_0x1e6c('0x52')]=function(_0x2ea473,_0x532723,_0x53b8f3){var _0x4e5400={};var _0x36058f={};var _0x46f221;var _0x28af14;return db['FreshdeskConfiguration'][_0x1e6c('0x4d')]({'where':{'id':_0x2ea473[_0x1e6c('0x47')]['id']}})[_0x1e6c('0x26')](handleEntityNotFound(_0x532723,null))[_0x1e6c('0x26')](function(_0x5f0427){if(_0x5f0427){_0x46f221=_0x5f0427;_0x36058f['model']=_['keys'](db[_0x1e6c('0x4e')][_0x1e6c('0x2f')]);_0x36058f[_0x1e6c('0x35')]=_[_0x1e6c('0x34')](_0x2ea473[_0x1e6c('0x35')]);_0x36058f[_0x1e6c('0x36')]=_['intersection'](_0x36058f['model'],_0x36058f['query']);_0x4e5400[_0x1e6c('0x39')]=_['intersection'](_0x36058f[_0x1e6c('0x48')],qs[_0x1e6c('0x38')](_0x2ea473[_0x1e6c('0x35')][_0x1e6c('0x38')]));_0x4e5400[_0x1e6c('0x39')]=_0x4e5400[_0x1e6c('0x39')][_0x1e6c('0x3a')]?_0x4e5400[_0x1e6c('0x39')]:_0x36058f[_0x1e6c('0x48')];_0x4e5400['order']=qs[_0x1e6c('0x3c')](_0x2ea473[_0x1e6c('0x35')]['sort']);_0x4e5400['where']=qs[_0x1e6c('0x36')](_['pick'](_0x2ea473[_0x1e6c('0x35')],_0x36058f[_0x1e6c('0x36')]));if(_0x2ea473['query']['filter']){_0x4e5400['where']=_[_0x1e6c('0x40')](_0x4e5400[_0x1e6c('0x3d')],{'$or':_[_0x1e6c('0x33')](_0x4e5400[_0x1e6c('0x39')],function(_0x17936b){var _0x273ac1={};_0x273ac1[_0x17936b]={'$like':'%'+_0x2ea473['query'][_0x1e6c('0x3f')]+'%'};return _0x273ac1;})});}_0x4e5400=_[_0x1e6c('0x40')]({},_0x4e5400,_0x2ea473[_0x1e6c('0x51')]);return _0x46f221['getDescriptions'](_0x4e5400);}})['then'](function(_0x13b39e){if(_0x13b39e){_0x28af14=_0x13b39e[_0x1e6c('0x3a')];if(!_0x2ea473[_0x1e6c('0x35')]['hasOwnProperty'](_0x1e6c('0x53'))){_0x4e5400[_0x1e6c('0x20')]=qs[_0x1e6c('0x20')](_0x2ea473['query'][_0x1e6c('0x20')]);_0x4e5400[_0x1e6c('0x1d')]=qs[_0x1e6c('0x1d')](_0x2ea473[_0x1e6c('0x35')][_0x1e6c('0x1d')]);}return _0x46f221['getDescriptions'](_0x4e5400);}})[_0x1e6c('0x26')](function(_0x498465){if(_0x498465){return _0x498465?{'count':_0x28af14,'rows':_0x498465}:null;}})[_0x1e6c('0x26')](respondWithResult(_0x532723,null))[_0x1e6c('0x46')](handleError(_0x532723,null));};exports['getTags']=function(_0x4a6f70,_0x556102,_0xb9fa44){var _0x551457={};var _0x416ab4={};var _0x14f5fb;var _0x1a27e6;return db[_0x1e6c('0x2e')][_0x1e6c('0x4d')]({'where':{'id':_0x4a6f70[_0x1e6c('0x47')]['id']}})[_0x1e6c('0x26')](handleEntityNotFound(_0x556102,null))[_0x1e6c('0x26')](function(_0x475be7){if(_0x475be7){_0x14f5fb=_0x475be7;_0x416ab4[_0x1e6c('0x48')]=_[_0x1e6c('0x34')](db[_0x1e6c('0x54')][_0x1e6c('0x2f')]);_0x416ab4[_0x1e6c('0x35')]=_[_0x1e6c('0x34')](_0x4a6f70[_0x1e6c('0x35')]);_0x416ab4[_0x1e6c('0x36')]=_[_0x1e6c('0x37')](_0x416ab4['model'],_0x416ab4['query']);_0x551457[_0x1e6c('0x39')]=_[_0x1e6c('0x37')](_0x416ab4[_0x1e6c('0x48')],qs['fields'](_0x4a6f70[_0x1e6c('0x35')][_0x1e6c('0x38')]));_0x551457['attributes']=_0x551457['attributes'][_0x1e6c('0x3a')]?_0x551457['attributes']:_0x416ab4[_0x1e6c('0x48')];_0x551457[_0x1e6c('0x3b')]=qs[_0x1e6c('0x3c')](_0x4a6f70[_0x1e6c('0x35')][_0x1e6c('0x3c')]);_0x551457[_0x1e6c('0x3d')]=qs[_0x1e6c('0x36')](_[_0x1e6c('0x3e')](_0x4a6f70[_0x1e6c('0x35')],_0x416ab4[_0x1e6c('0x36')]));if(_0x4a6f70[_0x1e6c('0x35')][_0x1e6c('0x3f')]){_0x551457[_0x1e6c('0x3d')]=_[_0x1e6c('0x40')](_0x551457['where'],{'$or':_[_0x1e6c('0x33')](_0x551457[_0x1e6c('0x39')],function(_0x4c69eb){var _0x12a5b7={};_0x12a5b7[_0x4c69eb]={'$like':'%'+_0x4a6f70[_0x1e6c('0x35')][_0x1e6c('0x3f')]+'%'};return _0x12a5b7;})});}_0x551457=_['merge']({},_0x551457,_0x4a6f70[_0x1e6c('0x51')]);return _0x14f5fb[_0x1e6c('0x55')](_0x551457);}})[_0x1e6c('0x26')](function(_0x29c52c){if(_0x29c52c){_0x1a27e6=_0x29c52c[_0x1e6c('0x3a')];if(!_0x4a6f70['query'][_0x1e6c('0x4f')]('nolimit')){_0x551457[_0x1e6c('0x20')]=qs[_0x1e6c('0x20')](_0x4a6f70[_0x1e6c('0x35')][_0x1e6c('0x20')]);_0x551457[_0x1e6c('0x1d')]=qs[_0x1e6c('0x1d')](_0x4a6f70[_0x1e6c('0x35')][_0x1e6c('0x1d')]);}return _0x14f5fb[_0x1e6c('0x55')](_0x551457);}})[_0x1e6c('0x26')](function(_0x291ffc){if(_0x291ffc){return _0x291ffc?{'count':_0x1a27e6,'rows':_0x291ffc}:null;}})[_0x1e6c('0x26')](respondWithResult(_0x556102,null))[_0x1e6c('0x46')](handleError(_0x556102,null));};exports[_0x1e6c('0x56')]=function(_0x2eff62,_0x2dd844,_0x2705e0){if(_0x2eff62['body']['id']){delete _0x2eff62[_0x1e6c('0x4a')]['id'];}return db[_0x1e6c('0x2e')][_0x1e6c('0x4d')]({'where':{'id':_0x2eff62['params']['id']}})[_0x1e6c('0x26')](handleEntityNotFound(_0x2dd844,null))[_0x1e6c('0x26')](function(_0x50a5d0){if(_0x50a5d0){return _0x50a5d0[_0x1e6c('0x56')](_0x2eff62[_0x1e6c('0x4a')]['ids']||[]);}return null;})[_0x1e6c('0x26')](respondWithResult(_0x2dd844,null))[_0x1e6c('0x46')](handleError(_0x2dd844,null));}; \ No newline at end of file +var _0xaa31=['apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','FreshdeskConfiguration','include','findAll','rows','catch','keys','length','create','body','params','find','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x54f7c4,_0x458526){var _0x1ba6d4=function(_0xf7d362){while(--_0xf7d362){_0x54f7c4['push'](_0x54f7c4['shift']());}};_0x1ba6d4(++_0x458526);}(_0xaa31,0x128));var _0x1aa3=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xaa31[_0xef8146];return _0x5a6cb0;};'use strict';var emlformat=require(_0x1aa3('0x0'));var rimraf=require(_0x1aa3('0x1'));var zipdir=require(_0x1aa3('0x2'));var jsonpatch=require(_0x1aa3('0x3'));var rp=require('request-promise');var moment=require(_0x1aa3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1aa3('0x5'));var path=require(_0x1aa3('0x6'));var sox=require(_0x1aa3('0x7'));var csv=require('to-csv');var ejs=require(_0x1aa3('0x8'));var fs=require('fs');var fs_extra=require(_0x1aa3('0x9'));var _=require(_0x1aa3('0xa'));var squel=require('squel');var crypto=require(_0x1aa3('0xb'));var jsforce=require(_0x1aa3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1aa3('0xd'));var querystring=require(_0x1aa3('0xe'));var Papa=require(_0x1aa3('0xf'));var Redis=require(_0x1aa3('0x10'));var authService=require(_0x1aa3('0x11'));var qs=require(_0x1aa3('0x12'));var as=require(_0x1aa3('0x13'));var hardwareService=require(_0x1aa3('0x14'));var logger=require(_0x1aa3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1aa3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1aa3('0x17'))['db'];function respondWithStatusCode(_0x2874bf,_0x2dfd87){_0x2dfd87=_0x2dfd87||0xcc;return function(_0x5dda20){if(_0x5dda20){return _0x2874bf[_0x1aa3('0x18')](_0x2dfd87);}return _0x2874bf[_0x1aa3('0x19')](_0x2dfd87)['end']();};}function respondWithResult(_0x584a71,_0x453c36){_0x453c36=_0x453c36||0xc8;return function(_0x402812){if(_0x402812){return _0x584a71[_0x1aa3('0x19')](_0x453c36)[_0x1aa3('0x1a')](_0x402812);}};}function respondWithFilteredResult(_0x21bdba,_0x6dd2b0){return function(_0x2136ad){if(_0x2136ad){var _0xce1851=typeof _0x6dd2b0[_0x1aa3('0x1b')]===_0x1aa3('0x1c')&&typeof _0x6dd2b0[_0x1aa3('0x1d')]===_0x1aa3('0x1c');var _0x237275=_0x2136ad['count'];var _0x38e748=_0xce1851?0x0:_0x6dd2b0['offset'];var _0x5c686e=_0xce1851?_0x2136ad[_0x1aa3('0x1e')]:_0x6dd2b0[_0x1aa3('0x1b')]+_0x6dd2b0[_0x1aa3('0x1d')];var _0xedf2d2;if(_0x5c686e>=_0x237275){_0x5c686e=_0x237275;_0xedf2d2=0xc8;}else{_0xedf2d2=0xce;}_0x21bdba['status'](_0xedf2d2);return _0x21bdba['set'](_0x1aa3('0x1f'),_0x38e748+'-'+_0x5c686e+'/'+_0x237275)[_0x1aa3('0x1a')](_0x2136ad);}return null;};}function patchUpdates(_0x32b2c4){return function(_0x384b9d){try{jsonpatch[_0x1aa3('0x20')](_0x384b9d,_0x32b2c4,!![]);}catch(_0x586c48){return BPromise[_0x1aa3('0x21')](_0x586c48);}return _0x384b9d[_0x1aa3('0x22')]();};}function saveUpdates(_0x4da6a4,_0x19ac90){return function(_0x4604b4){if(_0x4604b4){return _0x4604b4[_0x1aa3('0x23')](_0x4da6a4)[_0x1aa3('0x24')](function(_0xe94851){return _0xe94851;});}return null;};}function removeEntity(_0x5223ed,_0x46a37d){return function(_0x42668f){if(_0x42668f){return _0x42668f[_0x1aa3('0x25')]()[_0x1aa3('0x24')](function(){_0x5223ed[_0x1aa3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5719c0,_0x225ae7){return function(_0x59df20){if(!_0x59df20){_0x5719c0[_0x1aa3('0x18')](0x194);}return _0x59df20;};}function handleError(_0x1ee55e,_0x5f2fb6){_0x5f2fb6=_0x5f2fb6||0x1f4;return function(_0x1d9885){logger[_0x1aa3('0x26')](_0x1d9885[_0x1aa3('0x27')]);if(_0x1d9885[_0x1aa3('0x28')]){delete _0x1d9885['name'];}_0x1ee55e[_0x1aa3('0x19')](_0x5f2fb6)['send'](_0x1d9885);};}exports[_0x1aa3('0x29')]=function(_0x5b1738,_0x43342d){var _0x2cfe74={},_0x41bdcb={},_0x5270f3={'count':0x0,'rows':[]};var _0x11b7bd=_[_0x1aa3('0x2a')](db['FreshdeskConfiguration'][_0x1aa3('0x2b')],function(_0x5a440e){return{'name':_0x5a440e[_0x1aa3('0x2c')],'type':_0x5a440e[_0x1aa3('0x2d')][_0x1aa3('0x2e')]};});_0x41bdcb[_0x1aa3('0x2f')]=_[_0x1aa3('0x2a')](_0x11b7bd,'name');_0x41bdcb['query']=_['keys'](_0x5b1738[_0x1aa3('0x30')]);_0x41bdcb[_0x1aa3('0x31')]=_[_0x1aa3('0x32')](_0x41bdcb[_0x1aa3('0x2f')],_0x41bdcb[_0x1aa3('0x30')]);_0x2cfe74[_0x1aa3('0x33')]=_[_0x1aa3('0x32')](_0x41bdcb['model'],qs['fields'](_0x5b1738[_0x1aa3('0x30')][_0x1aa3('0x34')]));_0x2cfe74[_0x1aa3('0x33')]=_0x2cfe74['attributes']['length']?_0x2cfe74[_0x1aa3('0x33')]:_0x41bdcb[_0x1aa3('0x2f')];if(!_0x5b1738[_0x1aa3('0x30')][_0x1aa3('0x35')](_0x1aa3('0x36'))){_0x2cfe74[_0x1aa3('0x1d')]=qs[_0x1aa3('0x1d')](_0x5b1738[_0x1aa3('0x30')][_0x1aa3('0x1d')]);_0x2cfe74[_0x1aa3('0x1b')]=qs[_0x1aa3('0x1b')](_0x5b1738[_0x1aa3('0x30')][_0x1aa3('0x1b')]);}_0x2cfe74[_0x1aa3('0x37')]=qs['sort'](_0x5b1738[_0x1aa3('0x30')][_0x1aa3('0x38')]);_0x2cfe74[_0x1aa3('0x39')]=qs['filters'](_[_0x1aa3('0x3a')](_0x5b1738[_0x1aa3('0x30')],_0x41bdcb[_0x1aa3('0x31')]),_0x11b7bd);if(_0x5b1738[_0x1aa3('0x30')]['filter']){_0x2cfe74[_0x1aa3('0x39')]=_[_0x1aa3('0x3b')](_0x2cfe74['where'],{'$or':_['map'](_0x11b7bd,function(_0x3a00ad){if(_0x3a00ad['type']!==_0x1aa3('0x3c')){var _0x2c7ec8={};_0x2c7ec8[_0x3a00ad[_0x1aa3('0x28')]]={'$like':'%'+_0x5b1738[_0x1aa3('0x30')][_0x1aa3('0x3d')]+'%'};return _0x2c7ec8;}})});}_0x2cfe74=_[_0x1aa3('0x3b')]({},_0x2cfe74,_0x5b1738[_0x1aa3('0x3e')]);var _0x52d501={'where':_0x2cfe74[_0x1aa3('0x39')]};return db[_0x1aa3('0x3f')][_0x1aa3('0x1e')](_0x52d501)[_0x1aa3('0x24')](function(_0x4f08de){_0x5270f3[_0x1aa3('0x1e')]=_0x4f08de;if(_0x5b1738[_0x1aa3('0x30')]['includeAll']){_0x2cfe74[_0x1aa3('0x40')]=[{'all':!![]}];}return db[_0x1aa3('0x3f')][_0x1aa3('0x41')](_0x2cfe74);})[_0x1aa3('0x24')](function(_0x14d7c6){_0x5270f3[_0x1aa3('0x42')]=_0x14d7c6;return _0x5270f3;})[_0x1aa3('0x24')](respondWithFilteredResult(_0x43342d,_0x2cfe74))[_0x1aa3('0x43')](handleError(_0x43342d,null));};exports['show']=function(_0x316b30,_0x6695f5){var _0x8a27dc={'raw':![],'where':{'id':_0x316b30['params']['id']}},_0xda2b92={};_0xda2b92[_0x1aa3('0x2f')]=_[_0x1aa3('0x44')](db[_0x1aa3('0x3f')]['rawAttributes']);_0xda2b92[_0x1aa3('0x30')]=_[_0x1aa3('0x44')](_0x316b30['query']);_0xda2b92[_0x1aa3('0x31')]=_[_0x1aa3('0x32')](_0xda2b92[_0x1aa3('0x2f')],_0xda2b92[_0x1aa3('0x30')]);_0x8a27dc['attributes']=_[_0x1aa3('0x32')](_0xda2b92[_0x1aa3('0x2f')],qs[_0x1aa3('0x34')](_0x316b30['query'][_0x1aa3('0x34')]));_0x8a27dc[_0x1aa3('0x33')]=_0x8a27dc[_0x1aa3('0x33')][_0x1aa3('0x45')]?_0x8a27dc[_0x1aa3('0x33')]:_0xda2b92[_0x1aa3('0x2f')];if(_0x316b30['query']['includeAll']){_0x8a27dc[_0x1aa3('0x40')]=[{'all':!![]}];}_0x8a27dc=_[_0x1aa3('0x3b')]({},_0x8a27dc,_0x316b30['options']);return db[_0x1aa3('0x3f')]['find'](_0x8a27dc)[_0x1aa3('0x24')](handleEntityNotFound(_0x6695f5,null))[_0x1aa3('0x24')](respondWithResult(_0x6695f5,null))['catch'](handleError(_0x6695f5,null));};exports[_0x1aa3('0x46')]=function(_0x315a57,_0x18a230){return db[_0x1aa3('0x3f')]['create'](_0x315a57[_0x1aa3('0x47')],{})[_0x1aa3('0x24')](respondWithResult(_0x18a230,0xc9))[_0x1aa3('0x43')](handleError(_0x18a230,null));};exports['update']=function(_0x27072e,_0x51260e){if(_0x27072e[_0x1aa3('0x47')]['id']){delete _0x27072e[_0x1aa3('0x47')]['id'];}return db[_0x1aa3('0x3f')]['find']({'where':{'id':_0x27072e[_0x1aa3('0x48')]['id']}})['then'](handleEntityNotFound(_0x51260e,null))[_0x1aa3('0x24')](saveUpdates(_0x27072e[_0x1aa3('0x47')],null))[_0x1aa3('0x24')](respondWithResult(_0x51260e,null))[_0x1aa3('0x43')](handleError(_0x51260e,null));};exports['destroy']=function(_0xd6f910,_0x4f1e1b){return db[_0x1aa3('0x3f')][_0x1aa3('0x49')]({'where':{'id':_0xd6f910[_0x1aa3('0x48')]['id']}})[_0x1aa3('0x24')](handleEntityNotFound(_0x4f1e1b,null))[_0x1aa3('0x24')](removeEntity(_0x4f1e1b,null))['catch'](handleError(_0x4f1e1b,null));};exports[_0x1aa3('0x4a')]=function(_0x4de2a7,_0x56ff4f,_0x5ce92f){var _0x2a78e5={};var _0x1aef69={};var _0x507545;var _0x3a1f43;return db[_0x1aa3('0x3f')][_0x1aa3('0x4b')]({'where':{'id':_0x4de2a7['params']['id']}})[_0x1aa3('0x24')](handleEntityNotFound(_0x56ff4f,null))[_0x1aa3('0x24')](function(_0x1ef20b){if(_0x1ef20b){_0x507545=_0x1ef20b;_0x1aef69[_0x1aa3('0x2f')]=_['keys'](db['FreshdeskField'][_0x1aa3('0x2b')]);_0x1aef69['query']=_[_0x1aa3('0x44')](_0x4de2a7[_0x1aa3('0x30')]);_0x1aef69['filters']=_[_0x1aa3('0x32')](_0x1aef69['model'],_0x1aef69[_0x1aa3('0x30')]);_0x2a78e5[_0x1aa3('0x33')]=_[_0x1aa3('0x32')](_0x1aef69[_0x1aa3('0x2f')],qs[_0x1aa3('0x34')](_0x4de2a7[_0x1aa3('0x30')]['fields']));_0x2a78e5['attributes']=_0x2a78e5['attributes']['length']?_0x2a78e5[_0x1aa3('0x33')]:_0x1aef69[_0x1aa3('0x2f')];_0x2a78e5[_0x1aa3('0x37')]=qs[_0x1aa3('0x38')](_0x4de2a7['query'][_0x1aa3('0x38')]);_0x2a78e5[_0x1aa3('0x39')]=qs[_0x1aa3('0x31')](_[_0x1aa3('0x3a')](_0x4de2a7[_0x1aa3('0x30')],_0x1aef69[_0x1aa3('0x31')]));if(_0x4de2a7[_0x1aa3('0x30')]['filter']){_0x2a78e5['where']=_[_0x1aa3('0x3b')](_0x2a78e5['where'],{'$or':_[_0x1aa3('0x2a')](_0x2a78e5[_0x1aa3('0x33')],function(_0x3ab7cf){var _0x59911b={};_0x59911b[_0x3ab7cf]={'$like':'%'+_0x4de2a7[_0x1aa3('0x30')]['filter']+'%'};return _0x59911b;})});}_0x2a78e5=_[_0x1aa3('0x3b')]({},_0x2a78e5,_0x4de2a7[_0x1aa3('0x3e')]);return _0x507545[_0x1aa3('0x4a')](_0x2a78e5);}})[_0x1aa3('0x24')](function(_0x17ab43){if(_0x17ab43){_0x3a1f43=_0x17ab43[_0x1aa3('0x45')];if(!_0x4de2a7[_0x1aa3('0x30')]['hasOwnProperty'](_0x1aa3('0x36'))){_0x2a78e5[_0x1aa3('0x1d')]=qs[_0x1aa3('0x1d')](_0x4de2a7[_0x1aa3('0x30')]['limit']);_0x2a78e5[_0x1aa3('0x1b')]=qs[_0x1aa3('0x1b')](_0x4de2a7[_0x1aa3('0x30')][_0x1aa3('0x1b')]);}return _0x507545[_0x1aa3('0x4a')](_0x2a78e5);}})['then'](function(_0x2a92c9){if(_0x2a92c9){return _0x2a92c9?{'count':_0x3a1f43,'rows':_0x2a92c9}:null;}})[_0x1aa3('0x24')](respondWithResult(_0x56ff4f,null))['catch'](handleError(_0x56ff4f,null));};exports[_0x1aa3('0x4c')]=function(_0x2a7cfa,_0x46afa1,_0x3e0d22){var _0x53ae16={};var _0x3cea60={};var _0x2b5a2c;var _0x2f8402;return db[_0x1aa3('0x3f')][_0x1aa3('0x4b')]({'where':{'id':_0x2a7cfa['params']['id']}})['then'](handleEntityNotFound(_0x46afa1,null))[_0x1aa3('0x24')](function(_0x7adadc){if(_0x7adadc){_0x2b5a2c=_0x7adadc;_0x3cea60[_0x1aa3('0x2f')]=_[_0x1aa3('0x44')](db[_0x1aa3('0x4d')][_0x1aa3('0x2b')]);_0x3cea60[_0x1aa3('0x30')]=_[_0x1aa3('0x44')](_0x2a7cfa[_0x1aa3('0x30')]);_0x3cea60[_0x1aa3('0x31')]=_[_0x1aa3('0x32')](_0x3cea60[_0x1aa3('0x2f')],_0x3cea60[_0x1aa3('0x30')]);_0x53ae16[_0x1aa3('0x33')]=_[_0x1aa3('0x32')](_0x3cea60['model'],qs['fields'](_0x2a7cfa[_0x1aa3('0x30')][_0x1aa3('0x34')]));_0x53ae16[_0x1aa3('0x33')]=_0x53ae16[_0x1aa3('0x33')]['length']?_0x53ae16[_0x1aa3('0x33')]:_0x3cea60[_0x1aa3('0x2f')];_0x53ae16[_0x1aa3('0x37')]=qs[_0x1aa3('0x38')](_0x2a7cfa[_0x1aa3('0x30')][_0x1aa3('0x38')]);_0x53ae16[_0x1aa3('0x39')]=qs[_0x1aa3('0x31')](_[_0x1aa3('0x3a')](_0x2a7cfa[_0x1aa3('0x30')],_0x3cea60['filters']));if(_0x2a7cfa[_0x1aa3('0x30')][_0x1aa3('0x3d')]){_0x53ae16[_0x1aa3('0x39')]=_[_0x1aa3('0x3b')](_0x53ae16['where'],{'$or':_[_0x1aa3('0x2a')](_0x53ae16[_0x1aa3('0x33')],function(_0xcd735e){var _0x5ed430={};_0x5ed430[_0xcd735e]={'$like':'%'+_0x2a7cfa['query'][_0x1aa3('0x3d')]+'%'};return _0x5ed430;})});}_0x53ae16=_[_0x1aa3('0x3b')]({},_0x53ae16,_0x2a7cfa[_0x1aa3('0x3e')]);return _0x2b5a2c[_0x1aa3('0x4c')](_0x53ae16);}})[_0x1aa3('0x24')](function(_0x1a1bf0){if(_0x1a1bf0){_0x2f8402=_0x1a1bf0[_0x1aa3('0x45')];if(!_0x2a7cfa[_0x1aa3('0x30')]['hasOwnProperty']('nolimit')){_0x53ae16['limit']=qs[_0x1aa3('0x1d')](_0x2a7cfa['query'][_0x1aa3('0x1d')]);_0x53ae16[_0x1aa3('0x1b')]=qs[_0x1aa3('0x1b')](_0x2a7cfa[_0x1aa3('0x30')][_0x1aa3('0x1b')]);}return _0x2b5a2c[_0x1aa3('0x4c')](_0x53ae16);}})[_0x1aa3('0x24')](function(_0x2a000b){if(_0x2a000b){return _0x2a000b?{'count':_0x2f8402,'rows':_0x2a000b}:null;}})[_0x1aa3('0x24')](respondWithResult(_0x46afa1,null))[_0x1aa3('0x43')](handleError(_0x46afa1,null));};exports[_0x1aa3('0x4e')]=function(_0x5f4426,_0x745f73,_0x4cc241){var _0x38d3c0={};var _0x45b99c={};var _0x865286;var _0x38c7d6;return db[_0x1aa3('0x3f')][_0x1aa3('0x4b')]({'where':{'id':_0x5f4426[_0x1aa3('0x48')]['id']}})[_0x1aa3('0x24')](handleEntityNotFound(_0x745f73,null))['then'](function(_0x23a2a3){if(_0x23a2a3){_0x865286=_0x23a2a3;_0x45b99c[_0x1aa3('0x2f')]=_[_0x1aa3('0x44')](db[_0x1aa3('0x4d')]['rawAttributes']);_0x45b99c[_0x1aa3('0x30')]=_['keys'](_0x5f4426['query']);_0x45b99c[_0x1aa3('0x31')]=_[_0x1aa3('0x32')](_0x45b99c[_0x1aa3('0x2f')],_0x45b99c['query']);_0x38d3c0['attributes']=_[_0x1aa3('0x32')](_0x45b99c[_0x1aa3('0x2f')],qs[_0x1aa3('0x34')](_0x5f4426[_0x1aa3('0x30')][_0x1aa3('0x34')]));_0x38d3c0[_0x1aa3('0x33')]=_0x38d3c0[_0x1aa3('0x33')][_0x1aa3('0x45')]?_0x38d3c0[_0x1aa3('0x33')]:_0x45b99c[_0x1aa3('0x2f')];_0x38d3c0[_0x1aa3('0x37')]=qs['sort'](_0x5f4426['query'][_0x1aa3('0x38')]);_0x38d3c0[_0x1aa3('0x39')]=qs[_0x1aa3('0x31')](_['pick'](_0x5f4426['query'],_0x45b99c[_0x1aa3('0x31')]));if(_0x5f4426[_0x1aa3('0x30')][_0x1aa3('0x3d')]){_0x38d3c0[_0x1aa3('0x39')]=_[_0x1aa3('0x3b')](_0x38d3c0[_0x1aa3('0x39')],{'$or':_[_0x1aa3('0x2a')](_0x38d3c0[_0x1aa3('0x33')],function(_0x23d77b){var _0x59d162={};_0x59d162[_0x23d77b]={'$like':'%'+_0x5f4426[_0x1aa3('0x30')][_0x1aa3('0x3d')]+'%'};return _0x59d162;})});}_0x38d3c0=_[_0x1aa3('0x3b')]({},_0x38d3c0,_0x5f4426['options']);return _0x865286[_0x1aa3('0x4e')](_0x38d3c0);}})[_0x1aa3('0x24')](function(_0x2134ee){if(_0x2134ee){_0x38c7d6=_0x2134ee[_0x1aa3('0x45')];if(!_0x5f4426[_0x1aa3('0x30')][_0x1aa3('0x35')](_0x1aa3('0x36'))){_0x38d3c0[_0x1aa3('0x1d')]=qs['limit'](_0x5f4426['query']['limit']);_0x38d3c0[_0x1aa3('0x1b')]=qs[_0x1aa3('0x1b')](_0x5f4426[_0x1aa3('0x30')][_0x1aa3('0x1b')]);}return _0x865286[_0x1aa3('0x4e')](_0x38d3c0);}})[_0x1aa3('0x24')](function(_0x277d4c){if(_0x277d4c){return _0x277d4c?{'count':_0x38c7d6,'rows':_0x277d4c}:null;}})[_0x1aa3('0x24')](respondWithResult(_0x745f73,null))[_0x1aa3('0x43')](handleError(_0x745f73,null));};exports['getTags']=function(_0xe65834,_0x50f287,_0x15cd93){var _0x5ba558={};var _0x5e41fa={};var _0x195fc5;var _0x2ea400;return db[_0x1aa3('0x3f')][_0x1aa3('0x4b')]({'where':{'id':_0xe65834[_0x1aa3('0x48')]['id']}})[_0x1aa3('0x24')](handleEntityNotFound(_0x50f287,null))[_0x1aa3('0x24')](function(_0x1d3cfb){if(_0x1d3cfb){_0x195fc5=_0x1d3cfb;_0x5e41fa[_0x1aa3('0x2f')]=_['keys'](db['Tag']['rawAttributes']);_0x5e41fa[_0x1aa3('0x30')]=_['keys'](_0xe65834[_0x1aa3('0x30')]);_0x5e41fa[_0x1aa3('0x31')]=_[_0x1aa3('0x32')](_0x5e41fa['model'],_0x5e41fa[_0x1aa3('0x30')]);_0x5ba558[_0x1aa3('0x33')]=_[_0x1aa3('0x32')](_0x5e41fa['model'],qs[_0x1aa3('0x34')](_0xe65834['query'][_0x1aa3('0x34')]));_0x5ba558[_0x1aa3('0x33')]=_0x5ba558[_0x1aa3('0x33')][_0x1aa3('0x45')]?_0x5ba558[_0x1aa3('0x33')]:_0x5e41fa[_0x1aa3('0x2f')];_0x5ba558[_0x1aa3('0x37')]=qs['sort'](_0xe65834['query'][_0x1aa3('0x38')]);_0x5ba558[_0x1aa3('0x39')]=qs['filters'](_[_0x1aa3('0x3a')](_0xe65834['query'],_0x5e41fa[_0x1aa3('0x31')]));if(_0xe65834[_0x1aa3('0x30')][_0x1aa3('0x3d')]){_0x5ba558[_0x1aa3('0x39')]=_[_0x1aa3('0x3b')](_0x5ba558['where'],{'$or':_['map'](_0x5ba558[_0x1aa3('0x33')],function(_0x1f6587){var _0x1d4854={};_0x1d4854[_0x1f6587]={'$like':'%'+_0xe65834[_0x1aa3('0x30')][_0x1aa3('0x3d')]+'%'};return _0x1d4854;})});}_0x5ba558=_[_0x1aa3('0x3b')]({},_0x5ba558,_0xe65834[_0x1aa3('0x3e')]);return _0x195fc5[_0x1aa3('0x4f')](_0x5ba558);}})[_0x1aa3('0x24')](function(_0x1938b5){if(_0x1938b5){_0x2ea400=_0x1938b5['length'];if(!_0xe65834[_0x1aa3('0x30')][_0x1aa3('0x35')](_0x1aa3('0x36'))){_0x5ba558[_0x1aa3('0x1d')]=qs[_0x1aa3('0x1d')](_0xe65834[_0x1aa3('0x30')][_0x1aa3('0x1d')]);_0x5ba558[_0x1aa3('0x1b')]=qs['offset'](_0xe65834[_0x1aa3('0x30')][_0x1aa3('0x1b')]);}return _0x195fc5[_0x1aa3('0x4f')](_0x5ba558);}})['then'](function(_0x38729c){if(_0x38729c){return _0x38729c?{'count':_0x2ea400,'rows':_0x38729c}:null;}})[_0x1aa3('0x24')](respondWithResult(_0x50f287,null))['catch'](handleError(_0x50f287,null));};exports[_0x1aa3('0x50')]=function(_0x1a5a6e,_0x218757,_0x10e680){if(_0x1a5a6e['body']['id']){delete _0x1a5a6e[_0x1aa3('0x47')]['id'];}return db[_0x1aa3('0x3f')][_0x1aa3('0x4b')]({'where':{'id':_0x1a5a6e['params']['id']}})[_0x1aa3('0x24')](handleEntityNotFound(_0x218757,null))[_0x1aa3('0x24')](function(_0xae50e6){if(_0xae50e6){return _0xae50e6[_0x1aa3('0x50')](_0x1a5a6e[_0x1aa3('0x47')][_0x1aa3('0x51')]||[]);}return null;})['then'](respondWithResult(_0x218757,null))['catch'](handleError(_0x218757,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f89fad9..b436113 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 _0x192d=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x50db53,_0x3dba48){var _0x28a3c8=function(_0x5269e9){while(--_0x5269e9){_0x50db53['push'](_0x50db53['shift']());}};_0x28a3c8(++_0x3dba48);}(_0x192d,0x14e));var _0xd192=function(_0x1b0ad0,_0x523ac7){_0x1b0ad0=_0x1b0ad0-0x0;var _0x139dd1=_0x192d[_0x1b0ad0];return _0x139dd1;};'use strict';var _=require(_0xd192('0x0'));var util=require(_0xd192('0x1'));var logger=require(_0xd192('0x2'))(_0xd192('0x3'));var moment=require(_0xd192('0x4'));var BPromise=require(_0xd192('0x5'));var rp=require(_0xd192('0x6'));var fs=require('fs');var path=require(_0xd192('0x7'));var rimraf=require('rimraf');var config=require(_0xd192('0x8'));var attributes=require(_0xd192('0x9'));module[_0xd192('0xa')]=function(_0x1d16c1,_0x4e4412){return _0x1d16c1[_0xd192('0xb')](_0xd192('0xc'),attributes,{'tableName':_0xd192('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb201=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0xb50908,_0x34bae3){var _0x5bee69=function(_0x2b9b20){while(--_0x2b9b20){_0xb50908['push'](_0xb50908['shift']());}};_0x5bee69(++_0x34bae3);}(_0xb201,0xe3));var _0x1b20=function(_0xc5a76e,_0x2b37f7){_0xc5a76e=_0xc5a76e-0x0;var _0x3dcbb6=_0xb201[_0xc5a76e];return _0x3dcbb6;};'use strict';var _=require(_0x1b20('0x0'));var util=require(_0x1b20('0x1'));var logger=require(_0x1b20('0x2'))(_0x1b20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b20('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b20('0x5'));var config=require(_0x1b20('0x6'));var attributes=require(_0x1b20('0x7'));module[_0x1b20('0x8')]=function(_0x1186a9,_0x3b26bc){return _0x1186a9[_0x1b20('0x9')](_0x1b20('0xa'),attributes,{'tableName':_0x1b20('0xb'),'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 3cf4b3a..842b672 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 _0xd501=['catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd501,0x9b));var _0x1d50=function(_0x29f071,_0x149323){_0x29f071=_0x29f071-0x0;var _0x18a34a=_0xd501[_0x29f071];return _0x18a34a;};'use strict';var _=require('lodash');var util=require(_0x1d50('0x0'));var moment=require(_0x1d50('0x1'));var BPromise=require('bluebird');var rs=require(_0x1d50('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d50('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d50('0x4'))(_0x1d50('0x5'));var config=require(_0x1d50('0x6'));var jayson=require(_0x1d50('0x7'));var client=jayson[_0x1d50('0x8')][_0x1d50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe22ebf,_0x566966,_0x4f1864){return new BPromise(function(_0x36f0b2,_0x400259){return client[_0x1d50('0xa')](_0xe22ebf,_0x4f1864)[_0x1d50('0xb')](function(_0x6c8d2d){logger[_0x1d50('0xc')](_0x1d50('0xd'),_0x566966,_0x1d50('0xe'));logger[_0x1d50('0xf')](_0x1d50('0x10'),_0x566966,_0x1d50('0xe'),JSON['stringify'](_0x6c8d2d));if(_0x6c8d2d[_0x1d50('0x11')]){if(_0x6c8d2d[_0x1d50('0x11')][_0x1d50('0x12')]===0x1f4){logger[_0x1d50('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x566966,_0x6c8d2d[_0x1d50('0x11')]['message']);return _0x400259(_0x6c8d2d[_0x1d50('0x11')]['message']);}logger[_0x1d50('0x11')](_0x1d50('0xd'),_0x566966,_0x6c8d2d[_0x1d50('0x11')][_0x1d50('0x13')]);return _0x36f0b2(_0x6c8d2d[_0x1d50('0x11')]['message']);}else{logger[_0x1d50('0xc')](_0x1d50('0xd'),_0x566966,_0x1d50('0xe'));_0x36f0b2(_0x6c8d2d[_0x1d50('0x14')][_0x1d50('0x13')]);}})[_0x1d50('0x15')](function(_0x1c548b){logger[_0x1d50('0x11')](_0x1d50('0xd'),_0x566966,_0x1c548b);_0x400259(_0x1c548b);});});} \ No newline at end of file +var _0xa682=['stringify','error','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2a51a4,_0x4fb2ff){var _0x1499ca=function(_0x357950){while(--_0x357950){_0x2a51a4['push'](_0x2a51a4['shift']());}};_0x1499ca(++_0x4fb2ff);}(_0xa682,0x121));var _0x2a68=function(_0xfe1471,_0x4880ac){_0xfe1471=_0xfe1471-0x0;var _0x40d289=_0xa682[_0xfe1471];return _0x40d289;};'use strict';var _=require(_0x2a68('0x0'));var util=require('util');var moment=require(_0x2a68('0x1'));var BPromise=require(_0x2a68('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a68('0x3'))['db'];var utils=require(_0x2a68('0x4'));var logger=require('../../config/logger')(_0x2a68('0x5'));var config=require(_0x2a68('0x6'));var jayson=require(_0x2a68('0x7'));var client=jayson[_0x2a68('0x8')][_0x2a68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9de827,_0x4735e0,_0x18389f){return new BPromise(function(_0x50a22e,_0x5a7e42){return client['request'](_0x9de827,_0x18389f)[_0x2a68('0xa')](function(_0x23544a){logger[_0x2a68('0xb')](_0x2a68('0xc'),_0x4735e0,'request\x20sent');logger['debug'](_0x2a68('0xd'),_0x4735e0,_0x2a68('0xe'),JSON[_0x2a68('0xf')](_0x23544a));if(_0x23544a[_0x2a68('0x10')]){if(_0x23544a[_0x2a68('0x10')]['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4735e0,_0x23544a[_0x2a68('0x10')]['message']);return _0x5a7e42(_0x23544a[_0x2a68('0x10')][_0x2a68('0x11')]);}logger[_0x2a68('0x10')](_0x2a68('0xc'),_0x4735e0,_0x23544a[_0x2a68('0x10')][_0x2a68('0x11')]);return _0x50a22e(_0x23544a['error'][_0x2a68('0x11')]);}else{logger[_0x2a68('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4735e0,_0x2a68('0xe'));_0x50a22e(_0x23544a[_0x2a68('0x12')]['message']);}})['catch'](function(_0x2c8adb){logger[_0x2a68('0x10')](_0x2a68('0xc'),_0x4735e0,_0x2c8adb);_0x5a7e42(_0x2c8adb);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 4aa9133..e1dff64 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 _0xe1ce=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create'];(function(_0x3a1b35,_0x43f746){var _0x27fd53=function(_0x398150){while(--_0x398150){_0x3a1b35['push'](_0x3a1b35['shift']());}};_0x27fd53(++_0x43f746);}(_0xe1ce,0x1a3));var _0xee1c=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xe1ce[_0x576170];return _0x397c70;};'use strict';var multer=require(_0xee1c('0x0'));var util=require('util');var path=require(_0xee1c('0x1'));var timeout=require(_0xee1c('0x2'));var express=require(_0xee1c('0x3'));var router=express[_0xee1c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xee1c('0x5'));var interaction=require(_0xee1c('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xee1c('0x7')]('/',auth[_0xee1c('0x8')](),controller['index']);router[_0xee1c('0x7')](_0xee1c('0x9'),auth[_0xee1c('0x8')](),controller[_0xee1c('0xa')]);router[_0xee1c('0xb')]('/',auth[_0xee1c('0x8')](),controller[_0xee1c('0xc')]);router['put'](_0xee1c('0x9'),auth['isAuthenticated'](),controller[_0xee1c('0xd')]);router['delete']('/:id',auth[_0xee1c('0x8')](),controller[_0xee1c('0xe')]);module[_0xee1c('0xf')]=router; \ No newline at end of file +var _0x219f=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','index','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x6f7c73,_0x4d79f0){var _0x4aa18f=function(_0x3bcf88){while(--_0x3bcf88){_0x6f7c73['push'](_0x6f7c73['shift']());}};_0x4aa18f(++_0x4d79f0);}(_0x219f,0x167));var _0xf219=function(_0x532228,_0x3272fd){_0x532228=_0x532228-0x0;var _0x216fd3=_0x219f[_0x532228];return _0x216fd3;};'use strict';var multer=require(_0xf219('0x0'));var util=require('util');var path=require(_0xf219('0x1'));var timeout=require('connect-timeout');var express=require(_0xf219('0x2'));var router=express[_0xf219('0x3')]();var fs_extra=require(_0xf219('0x4'));var auth=require(_0xf219('0x5'));var interaction=require(_0xf219('0x6'));var config=require('../../config/environment');var controller=require(_0xf219('0x7'));router[_0xf219('0x8')]('/',auth['isAuthenticated'](),controller[_0xf219('0x9')]);router[_0xf219('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf219('0xa')](),controller[_0xf219('0xb')]);router[_0xf219('0xc')](_0xf219('0xd'),auth[_0xf219('0xa')](),controller[_0xf219('0xe')]);router[_0xf219('0xf')](_0xf219('0xd'),auth[_0xf219('0xa')](),controller[_0xf219('0x10')]);module[_0xf219('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index b74a87e..06d5253 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 _0x5a0b=['customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x4e0463,_0x28e3f0){var _0x527981=function(_0x1f6a6e){while(--_0x1f6a6e){_0x4e0463['push'](_0x4e0463['shift']());}};_0x527981(++_0x28e3f0);}(_0x5a0b,0x13c));var _0xb5a0=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x5a0b[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require(_0xb5a0('0x0'));module[_0xb5a0('0x1')]={'type':{'type':Sequelize[_0xb5a0('0x2')]('string',_0xb5a0('0x3'),_0xb5a0('0x4'),_0xb5a0('0x5'),_0xb5a0('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb5a0('0x7')]},'keyType':{'type':Sequelize[_0xb5a0('0x2')](_0xb5a0('0x8'),'variable',_0xb5a0('0x4'))},'keyContent':{'type':Sequelize[_0xb5a0('0x7')]},'idField':{'type':Sequelize[_0xb5a0('0x7')]},'nameField':{'type':Sequelize[_0xb5a0('0x7')]},'customField':{'type':Sequelize[_0xb5a0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1f5d=['keyValue','string','STRING','sequelize','exports','customVariable'];(function(_0x40dc91,_0x25f021){var _0x566f91=function(_0x46742e){while(--_0x46742e){_0x40dc91['push'](_0x40dc91['shift']());}};_0x566f91(++_0x25f021);}(_0x1f5d,0x141));var _0xd1f5=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x1f5d[_0x585133];return _0x18254a;};'use strict';var Sequelize=require(_0xd1f5('0x0'));module[_0xd1f5('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xd1f5('0x2'),_0xd1f5('0x3'),'picklist'),'defaultValue':_0xd1f5('0x4')},'content':{'type':Sequelize[_0xd1f5('0x5')]},'key':{'type':Sequelize[_0xd1f5('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xd1f5('0x4'),'variable',_0xd1f5('0x2'))},'keyContent':{'type':Sequelize[_0xd1f5('0x5')]},'idField':{'type':Sequelize[_0xd1f5('0x5')]},'nameField':{'type':Sequelize[_0xd1f5('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd1f5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 9f99f2e..79472dd 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 _0x4ea3=['count','set','Content-Range','reject','save','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','fields','query','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','FreshdeskField','includeAll','include','rows','catch','show','params','find','create','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'];(function(_0x5b1438,_0xf76622){var _0x22865b=function(_0x140c30){while(--_0x140c30){_0x5b1438['push'](_0x5b1438['shift']());}};_0x22865b(++_0xf76622);}(_0x4ea3,0x70));var _0x34ea=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x4ea3[_0x6131cd];return _0x47e916;};'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(){_0x12e7e9[_0x34ea('0x18')](0xcc)[_0x34ea('0x19')]();});}};}function handleEntityNotFound(_0x5b5885,_0x56f320){return function(_0x564d1b){if(!_0x564d1b){_0x5b5885[_0x34ea('0x17')](0x194);}return _0x564d1b;};}function handleError(_0x187306,_0x37c214){_0x37c214=_0x37c214||0x1f4;return function(_0x4204d7){logger['error'](_0x4204d7[_0x34ea('0x26')]);if(_0x4204d7[_0x34ea('0x27')]){delete _0x4204d7[_0x34ea('0x27')];}_0x187306['status'](_0x37c214)['send'](_0x4204d7);};}exports['index']=function(_0x4d4360,_0x2942ce){var _0x6227db={},_0x859b7e={},_0x162081={'count':0x0,'rows':[]};var _0x56c9dd=_[_0x34ea('0x28')](db['FreshdeskField'][_0x34ea('0x29')],function(_0x4f2b77){return{'name':_0x4f2b77[_0x34ea('0x2a')],'type':_0x4f2b77[_0x34ea('0x2b')][_0x34ea('0x2c')]};});_0x859b7e['model']=_[_0x34ea('0x28')](_0x56c9dd,_0x34ea('0x27'));_0x859b7e['query']=_[_0x34ea('0x2d')](_0x4d4360['query']);_0x859b7e[_0x34ea('0x2e')]=_[_0x34ea('0x2f')](_0x859b7e[_0x34ea('0x30')],_0x859b7e['query']);_0x6227db['attributes']=_[_0x34ea('0x2f')](_0x859b7e['model'],qs[_0x34ea('0x31')](_0x4d4360[_0x34ea('0x32')]['fields']));_0x6227db[_0x34ea('0x33')]=_0x6227db[_0x34ea('0x33')][_0x34ea('0x34')]?_0x6227db[_0x34ea('0x33')]:_0x859b7e['model'];if(!_0x4d4360['query']['hasOwnProperty'](_0x34ea('0x35'))){_0x6227db[_0x34ea('0x1d')]=qs[_0x34ea('0x1d')](_0x4d4360['query']['limit']);_0x6227db['offset']=qs[_0x34ea('0x1b')](_0x4d4360[_0x34ea('0x32')]['offset']);}_0x6227db[_0x34ea('0x36')]=qs[_0x34ea('0x37')](_0x4d4360[_0x34ea('0x32')][_0x34ea('0x37')]);_0x6227db[_0x34ea('0x38')]=qs[_0x34ea('0x2e')](_['pick'](_0x4d4360[_0x34ea('0x32')],_0x859b7e[_0x34ea('0x2e')]),_0x56c9dd);if(_0x4d4360[_0x34ea('0x32')][_0x34ea('0x39')]){_0x6227db['where']=_['merge'](_0x6227db[_0x34ea('0x38')],{'$or':_[_0x34ea('0x28')](_0x56c9dd,function(_0xf39615){if(_0xf39615[_0x34ea('0x2b')]!==_0x34ea('0x3a')){var _0x4c696f={};_0x4c696f[_0xf39615[_0x34ea('0x27')]]={'$like':'%'+_0x4d4360[_0x34ea('0x32')][_0x34ea('0x39')]+'%'};return _0x4c696f;}})});}_0x6227db=_[_0x34ea('0x3b')]({},_0x6227db,_0x4d4360[_0x34ea('0x3c')]);var _0x4743f1={'where':_0x6227db[_0x34ea('0x38')]};return db[_0x34ea('0x3d')][_0x34ea('0x1e')](_0x4743f1)[_0x34ea('0x24')](function(_0x448bc0){_0x162081[_0x34ea('0x1e')]=_0x448bc0;if(_0x4d4360[_0x34ea('0x32')][_0x34ea('0x3e')]){_0x6227db[_0x34ea('0x3f')]=[{'all':!![]}];}return db[_0x34ea('0x3d')]['findAll'](_0x6227db);})[_0x34ea('0x24')](function(_0x4ae353){_0x162081[_0x34ea('0x40')]=_0x4ae353;return _0x162081;})[_0x34ea('0x24')](respondWithFilteredResult(_0x2942ce,_0x6227db))[_0x34ea('0x41')](handleError(_0x2942ce,null));};exports[_0x34ea('0x42')]=function(_0x2a57b5,_0x1b785b){var _0x35d81d={'raw':!![],'where':{'id':_0x2a57b5[_0x34ea('0x43')]['id']}},_0x17ba01={};_0x17ba01['model']=_[_0x34ea('0x2d')](db['FreshdeskField'][_0x34ea('0x29')]);_0x17ba01[_0x34ea('0x32')]=_[_0x34ea('0x2d')](_0x2a57b5[_0x34ea('0x32')]);_0x17ba01[_0x34ea('0x2e')]=_[_0x34ea('0x2f')](_0x17ba01['model'],_0x17ba01[_0x34ea('0x32')]);_0x35d81d[_0x34ea('0x33')]=_['intersection'](_0x17ba01[_0x34ea('0x30')],qs[_0x34ea('0x31')](_0x2a57b5[_0x34ea('0x32')][_0x34ea('0x31')]));_0x35d81d[_0x34ea('0x33')]=_0x35d81d['attributes'][_0x34ea('0x34')]?_0x35d81d[_0x34ea('0x33')]:_0x17ba01[_0x34ea('0x30')];if(_0x2a57b5[_0x34ea('0x32')][_0x34ea('0x3e')]){_0x35d81d[_0x34ea('0x3f')]=[{'all':!![]}];}_0x35d81d=_['merge']({},_0x35d81d,_0x2a57b5['options']);return db[_0x34ea('0x3d')][_0x34ea('0x44')](_0x35d81d)[_0x34ea('0x24')](handleEntityNotFound(_0x1b785b,null))['then'](respondWithResult(_0x1b785b,null))[_0x34ea('0x41')](handleError(_0x1b785b,null));};exports['create']=function(_0x16e9b7,_0x4cc586){return db[_0x34ea('0x3d')][_0x34ea('0x45')](_0x16e9b7[_0x34ea('0x46')],{})['then'](respondWithResult(_0x4cc586,0xc9))[_0x34ea('0x41')](handleError(_0x4cc586,null));};exports['update']=function(_0x404a59,_0x3fb739){if(_0x404a59[_0x34ea('0x46')]['id']){delete _0x404a59[_0x34ea('0x46')]['id'];}return db['FreshdeskField'][_0x34ea('0x44')]({'where':{'id':_0x404a59[_0x34ea('0x43')]['id']}})[_0x34ea('0x24')](handleEntityNotFound(_0x3fb739,null))[_0x34ea('0x24')](saveUpdates(_0x404a59[_0x34ea('0x46')],null))[_0x34ea('0x24')](respondWithResult(_0x3fb739,null))[_0x34ea('0x41')](handleError(_0x3fb739,null));};exports['destroy']=function(_0x1059dc,_0x224c53){return db[_0x34ea('0x3d')][_0x34ea('0x44')]({'where':{'id':_0x1059dc[_0x34ea('0x43')]['id']}})[_0x34ea('0x24')](handleEntityNotFound(_0x224c53,null))[_0x34ea('0x24')](removeEntity(_0x224c53,null))[_0x34ea('0x41')](handleError(_0x224c53,null));}; \ No newline at end of file +var _0x5ff3=['json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','sendStatus','error','name','index','map','FreshdeskField','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','keys','rawAttributes','find','catch','create','body','params','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','status','end'];(function(_0x38daf4,_0x43be28){var _0x168476=function(_0xcd95f7){while(--_0xcd95f7){_0x38daf4['push'](_0x38daf4['shift']());}};_0x168476(++_0x43be28);}(_0x5ff3,0x17d));var _0x35ff=function(_0x5109f9,_0x359a84){_0x5109f9=_0x5109f9-0x0;var _0x179727=_0x5ff3[_0x5109f9];return _0x179727;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35ff('0x1'));var rp=require('request-promise');var moment=require(_0x35ff('0x2'));var BPromise=require(_0x35ff('0x3'));var Mustache=require(_0x35ff('0x4'));var util=require(_0x35ff('0x5'));var path=require('path');var sox=require(_0x35ff('0x6'));var csv=require(_0x35ff('0x7'));var ejs=require(_0x35ff('0x8'));var fs=require('fs');var fs_extra=require(_0x35ff('0x9'));var _=require(_0x35ff('0xa'));var squel=require('squel');var crypto=require(_0x35ff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x35ff('0xc'));var toCsv=require(_0x35ff('0x7'));var querystring=require(_0x35ff('0xd'));var Papa=require('papaparse');var Redis=require(_0x35ff('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x35ff('0xf'));var as=require(_0x35ff('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x35ff('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x35ff('0x12'))['db'];function respondWithStatusCode(_0x3c5f4b,_0x5bda40){_0x5bda40=_0x5bda40||0xcc;return function(_0x842930){if(_0x842930){return _0x3c5f4b['sendStatus'](_0x5bda40);}return _0x3c5f4b[_0x35ff('0x13')](_0x5bda40)[_0x35ff('0x14')]();};}function respondWithResult(_0x3db454,_0x4d1d41){_0x4d1d41=_0x4d1d41||0xc8;return function(_0xff8ac){if(_0xff8ac){return _0x3db454[_0x35ff('0x13')](_0x4d1d41)[_0x35ff('0x15')](_0xff8ac);}};}function respondWithFilteredResult(_0x3e24dd,_0x438199){return function(_0x3dff65){if(_0x3dff65){var _0x2d4a88=typeof _0x438199[_0x35ff('0x16')]===_0x35ff('0x17')&&typeof _0x438199[_0x35ff('0x18')]===_0x35ff('0x17');var _0x3430e2=_0x3dff65[_0x35ff('0x19')];var _0x16c803=_0x2d4a88?0x0:_0x438199[_0x35ff('0x16')];var _0x5f470e=_0x2d4a88?_0x3dff65[_0x35ff('0x19')]:_0x438199[_0x35ff('0x16')]+_0x438199[_0x35ff('0x18')];var _0x1c0d8c;if(_0x5f470e>=_0x3430e2){_0x5f470e=_0x3430e2;_0x1c0d8c=0xc8;}else{_0x1c0d8c=0xce;}_0x3e24dd['status'](_0x1c0d8c);return _0x3e24dd['set'](_0x35ff('0x1a'),_0x16c803+'-'+_0x5f470e+'/'+_0x3430e2)[_0x35ff('0x15')](_0x3dff65);}return null;};}function patchUpdates(_0x4c8dd4){return function(_0x238f65){try{jsonpatch[_0x35ff('0x1b')](_0x238f65,_0x4c8dd4,!![]);}catch(_0x3a87bc){return BPromise[_0x35ff('0x1c')](_0x3a87bc);}return _0x238f65['save']();};}function saveUpdates(_0x3d60b4,_0x55274b){return function(_0x7cc20a){if(_0x7cc20a){return _0x7cc20a[_0x35ff('0x1d')](_0x3d60b4)[_0x35ff('0x1e')](function(_0x16a5a0){return _0x16a5a0;});}return null;};}function removeEntity(_0x396cc2,_0x2b3782){return function(_0x347cec){if(_0x347cec){return _0x347cec['destroy']()[_0x35ff('0x1e')](function(){_0x396cc2[_0x35ff('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x426e4e,_0x5ad0c6){return function(_0x4c46b7){if(!_0x4c46b7){_0x426e4e[_0x35ff('0x1f')](0x194);}return _0x4c46b7;};}function handleError(_0x9e2789,_0x95b9e2){_0x95b9e2=_0x95b9e2||0x1f4;return function(_0x11a5eb){logger[_0x35ff('0x20')](_0x11a5eb['stack']);if(_0x11a5eb[_0x35ff('0x21')]){delete _0x11a5eb[_0x35ff('0x21')];}_0x9e2789[_0x35ff('0x13')](_0x95b9e2)['send'](_0x11a5eb);};}exports[_0x35ff('0x22')]=function(_0x1f51c5,_0x3b4331){var _0x6d5407={},_0x47fcb5={},_0x61b554={'count':0x0,'rows':[]};var _0x1afc98=_[_0x35ff('0x23')](db[_0x35ff('0x24')]['rawAttributes'],function(_0x3f9440){return{'name':_0x3f9440['fieldName'],'type':_0x3f9440[_0x35ff('0x25')][_0x35ff('0x26')]};});_0x47fcb5[_0x35ff('0x27')]=_[_0x35ff('0x23')](_0x1afc98,'name');_0x47fcb5[_0x35ff('0x28')]=_['keys'](_0x1f51c5[_0x35ff('0x28')]);_0x47fcb5[_0x35ff('0x29')]=_['intersection'](_0x47fcb5['model'],_0x47fcb5[_0x35ff('0x28')]);_0x6d5407[_0x35ff('0x2a')]=_['intersection'](_0x47fcb5[_0x35ff('0x27')],qs[_0x35ff('0x2b')](_0x1f51c5['query'][_0x35ff('0x2b')]));_0x6d5407[_0x35ff('0x2a')]=_0x6d5407[_0x35ff('0x2a')][_0x35ff('0x2c')]?_0x6d5407[_0x35ff('0x2a')]:_0x47fcb5[_0x35ff('0x27')];if(!_0x1f51c5[_0x35ff('0x28')][_0x35ff('0x2d')](_0x35ff('0x2e'))){_0x6d5407[_0x35ff('0x18')]=qs[_0x35ff('0x18')](_0x1f51c5[_0x35ff('0x28')][_0x35ff('0x18')]);_0x6d5407['offset']=qs[_0x35ff('0x16')](_0x1f51c5['query'][_0x35ff('0x16')]);}_0x6d5407[_0x35ff('0x2f')]=qs[_0x35ff('0x30')](_0x1f51c5[_0x35ff('0x28')][_0x35ff('0x30')]);_0x6d5407['where']=qs[_0x35ff('0x29')](_[_0x35ff('0x31')](_0x1f51c5[_0x35ff('0x28')],_0x47fcb5[_0x35ff('0x29')]),_0x1afc98);if(_0x1f51c5[_0x35ff('0x28')]['filter']){_0x6d5407[_0x35ff('0x32')]=_[_0x35ff('0x33')](_0x6d5407[_0x35ff('0x32')],{'$or':_['map'](_0x1afc98,function(_0x4b98d2){if(_0x4b98d2[_0x35ff('0x25')]!==_0x35ff('0x34')){var _0x1f2a53={};_0x1f2a53[_0x4b98d2[_0x35ff('0x21')]]={'$like':'%'+_0x1f51c5[_0x35ff('0x28')][_0x35ff('0x35')]+'%'};return _0x1f2a53;}})});}_0x6d5407=_[_0x35ff('0x33')]({},_0x6d5407,_0x1f51c5[_0x35ff('0x36')]);var _0x5dc229={'where':_0x6d5407['where']};return db['FreshdeskField'][_0x35ff('0x19')](_0x5dc229)[_0x35ff('0x1e')](function(_0x10088a){_0x61b554[_0x35ff('0x19')]=_0x10088a;if(_0x1f51c5[_0x35ff('0x28')]['includeAll']){_0x6d5407[_0x35ff('0x37')]=[{'all':!![]}];}return db[_0x35ff('0x24')][_0x35ff('0x38')](_0x6d5407);})[_0x35ff('0x1e')](function(_0x117ee6){_0x61b554[_0x35ff('0x39')]=_0x117ee6;return _0x61b554;})['then'](respondWithFilteredResult(_0x3b4331,_0x6d5407))['catch'](handleError(_0x3b4331,null));};exports[_0x35ff('0x3a')]=function(_0x1fb1ed,_0x14d741){var _0x21b123={'raw':!![],'where':{'id':_0x1fb1ed['params']['id']}},_0x4b1e3e={};_0x4b1e3e[_0x35ff('0x27')]=_[_0x35ff('0x3b')](db[_0x35ff('0x24')][_0x35ff('0x3c')]);_0x4b1e3e[_0x35ff('0x28')]=_[_0x35ff('0x3b')](_0x1fb1ed[_0x35ff('0x28')]);_0x4b1e3e['filters']=_['intersection'](_0x4b1e3e[_0x35ff('0x27')],_0x4b1e3e[_0x35ff('0x28')]);_0x21b123[_0x35ff('0x2a')]=_['intersection'](_0x4b1e3e[_0x35ff('0x27')],qs[_0x35ff('0x2b')](_0x1fb1ed['query']['fields']));_0x21b123[_0x35ff('0x2a')]=_0x21b123['attributes'][_0x35ff('0x2c')]?_0x21b123[_0x35ff('0x2a')]:_0x4b1e3e['model'];if(_0x1fb1ed[_0x35ff('0x28')]['includeAll']){_0x21b123['include']=[{'all':!![]}];}_0x21b123=_[_0x35ff('0x33')]({},_0x21b123,_0x1fb1ed[_0x35ff('0x36')]);return db[_0x35ff('0x24')][_0x35ff('0x3d')](_0x21b123)[_0x35ff('0x1e')](handleEntityNotFound(_0x14d741,null))[_0x35ff('0x1e')](respondWithResult(_0x14d741,null))[_0x35ff('0x3e')](handleError(_0x14d741,null));};exports[_0x35ff('0x3f')]=function(_0x10a290,_0xee99f9){return db[_0x35ff('0x24')][_0x35ff('0x3f')](_0x10a290['body'],{})[_0x35ff('0x1e')](respondWithResult(_0xee99f9,0xc9))[_0x35ff('0x3e')](handleError(_0xee99f9,null));};exports[_0x35ff('0x1d')]=function(_0x2d26e2,_0x506def){if(_0x2d26e2['body']['id']){delete _0x2d26e2[_0x35ff('0x40')]['id'];}return db['FreshdeskField'][_0x35ff('0x3d')]({'where':{'id':_0x2d26e2[_0x35ff('0x41')]['id']}})[_0x35ff('0x1e')](handleEntityNotFound(_0x506def,null))[_0x35ff('0x1e')](saveUpdates(_0x2d26e2[_0x35ff('0x40')],null))[_0x35ff('0x1e')](respondWithResult(_0x506def,null))[_0x35ff('0x3e')](handleError(_0x506def,null));};exports[_0x35ff('0x42')]=function(_0x3be5fc,_0x535cc8){return db['FreshdeskField'][_0x35ff('0x3d')]({'where':{'id':_0x3be5fc['params']['id']}})[_0x35ff('0x1e')](handleEntityNotFound(_0x535cc8,null))[_0x35ff('0x1e')](removeEntity(_0x535cc8,null))[_0x35ff('0x3e')](handleError(_0x535cc8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index aa2c205..bd5bd96 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 _0xdbf9=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskField.attributes','exports','define'];(function(_0x5c6aa1,_0x5792a2){var _0x23b899=function(_0x336149){while(--_0x336149){_0x5c6aa1['push'](_0x5c6aa1['shift']());}};_0x23b899(++_0x5792a2);}(_0xdbf9,0x146));var _0x9dbf=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xdbf9[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x9dbf('0x0'));var util=require('util');var logger=require(_0x9dbf('0x1'))(_0x9dbf('0x2'));var moment=require(_0x9dbf('0x3'));var BPromise=require(_0x9dbf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9dbf('0x5'));var rimraf=require('rimraf');var config=require(_0x9dbf('0x6'));var attributes=require(_0x9dbf('0x7'));module[_0x9dbf('0x8')]=function(_0x3be0e2,_0x5bd66c){return _0x3be0e2[_0x9dbf('0x9')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x9dbf('0xa'),_0x9dbf('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2f4=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x3bbb82,_0x132a9d){var _0x594c0c=function(_0x53533f){while(--_0x53533f){_0x3bbb82['push'](_0x3bbb82['shift']());}};_0x594c0c(++_0x132a9d);}(_0xb2f4,0x14f));var _0x4b2f=function(_0x380df2,_0x281a15){_0x380df2=_0x380df2-0x0;var _0x47f4df=_0xb2f4[_0x380df2];return _0x47f4df;};'use strict';var _=require(_0x4b2f('0x0'));var util=require(_0x4b2f('0x1'));var logger=require(_0x4b2f('0x2'))(_0x4b2f('0x3'));var moment=require(_0x4b2f('0x4'));var BPromise=require(_0x4b2f('0x5'));var rp=require(_0x4b2f('0x6'));var fs=require('fs');var path=require(_0x4b2f('0x7'));var rimraf=require(_0x4b2f('0x8'));var config=require(_0x4b2f('0x9'));var attributes=require(_0x4b2f('0xa'));module[_0x4b2f('0xb')]=function(_0x316ad4,_0x24ea9d){return _0x316ad4[_0x4b2f('0xc')]('FreshdeskField',attributes,{'tableName':_0x4b2f('0xd'),'paranoid':![],'indexes':[{'name':_0x4b2f('0xe'),'fields':[_0x4b2f('0xf'),_0x4b2f('0x10')],'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 d0ed708..a4f03f9 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 _0x6329=['bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x2ec50e,_0x3252d9){var _0x4d01ac=function(_0x3c5651){while(--_0x3c5651){_0x2ec50e['push'](_0x2ec50e['shift']());}};_0x4d01ac(++_0x3252d9);}(_0x6329,0x16d));var _0x9632=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6329[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x9632('0x0'));var util=require(_0x9632('0x1'));var moment=require(_0x9632('0x2'));var BPromise=require(_0x9632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9632('0x4'));var logger=require(_0x9632('0x5'))(_0x9632('0x6'));var config=require(_0x9632('0x7'));var jayson=require(_0x9632('0x8'));var client=jayson[_0x9632('0x9')][_0x9632('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b76b2,_0x2d7e60,_0x5a3de2){return new BPromise(function(_0x1e2566,_0x426b15){return client[_0x9632('0xb')](_0x2b76b2,_0x5a3de2)[_0x9632('0xc')](function(_0xf0ab94){logger[_0x9632('0xd')](_0x9632('0xe'),_0x2d7e60,'request\x20sent');logger[_0x9632('0xf')](_0x9632('0x10'),_0x2d7e60,_0x9632('0x11'),JSON['stringify'](_0xf0ab94));if(_0xf0ab94[_0x9632('0x12')]){if(_0xf0ab94[_0x9632('0x12')][_0x9632('0x13')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x2d7e60,_0xf0ab94[_0x9632('0x12')][_0x9632('0x14')]);return _0x426b15(_0xf0ab94[_0x9632('0x12')][_0x9632('0x14')]);}logger['error'](_0x9632('0xe'),_0x2d7e60,_0xf0ab94[_0x9632('0x12')][_0x9632('0x14')]);return _0x1e2566(_0xf0ab94[_0x9632('0x12')][_0x9632('0x14')]);}else{logger['info'](_0x9632('0xe'),_0x2d7e60,'request\x20sent');_0x1e2566(_0xf0ab94[_0x9632('0x15')]['message']);}})[_0x9632('0x16')](function(_0x157b2e){logger[_0x9632('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x2d7e60,_0x157b2e);_0x426b15(_0x157b2e);});});} \ No newline at end of file +var _0xdb25=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xdb25,0x1d0));var _0x5db2=function(_0x27f3ed,_0x16a8b1){_0x27f3ed=_0x27f3ed-0x0;var _0x26266e=_0xdb25[_0x27f3ed];return _0x26266e;};'use strict';var _=require(_0x5db2('0x0'));var util=require('util');var moment=require(_0x5db2('0x1'));var BPromise=require(_0x5db2('0x2'));var rs=require(_0x5db2('0x3'));var fs=require('fs');var Redis=require(_0x5db2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5db2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5db2('0x6'));var jayson=require(_0x5db2('0x7'));var client=jayson[_0x5db2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x491bd3,_0x3e29a2,_0x1ad750){return new BPromise(function(_0x592b08,_0x3ee249){return client[_0x5db2('0x9')](_0x491bd3,_0x1ad750)[_0x5db2('0xa')](function(_0x194d68){logger[_0x5db2('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x3e29a2,_0x5db2('0xc'));logger[_0x5db2('0xd')](_0x5db2('0xe'),_0x3e29a2,_0x5db2('0xc'),JSON[_0x5db2('0xf')](_0x194d68));if(_0x194d68[_0x5db2('0x10')]){if(_0x194d68[_0x5db2('0x10')][_0x5db2('0x11')]===0x1f4){logger[_0x5db2('0x10')](_0x5db2('0x12'),_0x3e29a2,_0x194d68['error'][_0x5db2('0x13')]);return _0x3ee249(_0x194d68['error']['message']);}logger[_0x5db2('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x3e29a2,_0x194d68['error']['message']);return _0x592b08(_0x194d68['error'][_0x5db2('0x13')]);}else{logger[_0x5db2('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x3e29a2,_0x5db2('0xc'));_0x592b08(_0x194d68['result']['message']);}})[_0x5db2('0x14')](function(_0x4df309){logger[_0x5db2('0x10')](_0x5db2('0x12'),_0x3e29a2,_0x4df309);_0x3ee249(_0x4df309);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 33339c9..a4be3e4 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 _0xe605=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','/:id','update','delete'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe605,0x92));var _0x5e60=function(_0x2ee35b,_0x308cae){_0x2ee35b=_0x2ee35b-0x0;var _0xeb08e0=_0xe605[_0x2ee35b];return _0xeb08e0;};'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['get']('/:id/configurations',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['post']('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x10')](_0x5e60('0x11'),auth[_0x5e60('0xb')](),controller['addConfiguration']);router[_0x5e60('0x12')](_0x5e60('0x13'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x14')]);router[_0x5e60('0x15')](_0x5e60('0x13'),auth['isAuthenticated'](),controller[_0x5e60('0x16')]);module[_0x5e60('0x17')]=router; \ No newline at end of file +var _0xd8b0=['/:id','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x529996,_0x45fa5c){var _0x19e85c=function(_0x284311){while(--_0x284311){_0x529996['push'](_0x529996['shift']());}};_0x19e85c(++_0x45fa5c);}(_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('./intFreshsalesAccount.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x15')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);module[_0x0d8b('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 dbc31e2..873a27f 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 _0x6d11=['exports','STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6d11,0xbf));var _0x16d1=function(_0x406876,_0x4e0b70){_0x406876=_0x406876-0x0;var _0x221ac7=_0x6d11[_0x406876];return _0x221ac7;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x16d1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x16d1('0x2')]},'remoteUri':{'type':Sequelize[_0x16d1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xffd6=['exports','STRING','username','sequelize'];(function(_0x382a9c,_0x23045b){var _0x4b0e43=function(_0xbddbf1){while(--_0xbddbf1){_0x382a9c['push'](_0x382a9c['shift']());}};_0x4b0e43(++_0x23045b);}(_0xffd6,0x97));var _0x6ffd=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xffd6[_0x4bb581];return _0x316bf5;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6ffd('0x3')},'apiKey':{'type':Sequelize[_0x6ffd('0x2')]},'remoteUri':{'type':Sequelize[_0x6ffd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6ffd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 01817aa..3552170 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 _0x20f4=['Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','slice','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','apiKey','Requested\x20Resource\x20not\x20Found','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','find','create','body','catch','destroy','getConfigurations','findOne','FreshsalesConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x20f4,0xe0));var _0x420f=function(_0xbb9af7,_0x1f8228){_0xbb9af7=_0xbb9af7-0x0;var _0x21fdda=_0x20f4[_0xbb9af7];return _0x21fdda;};'use strict';var emlformat=require(_0x420f('0x0'));var rimraf=require(_0x420f('0x1'));var zipdir=require(_0x420f('0x2'));var jsonpatch=require(_0x420f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x420f('0x4'));var Mustache=require(_0x420f('0x5'));var util=require(_0x420f('0x6'));var path=require(_0x420f('0x7'));var sox=require('sox');var csv=require(_0x420f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x420f('0x9'));var _=require(_0x420f('0xa'));var squel=require('squel');var crypto=require(_0x420f('0xb'));var jsforce=require(_0x420f('0xc'));var deskjs=require(_0x420f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x420f('0xe'));var Redis=require(_0x420f('0xf'));var authService=require(_0x420f('0x10'));var qs=require(_0x420f('0x11'));var as=require(_0x420f('0x12'));var hardwareService=require(_0x420f('0x13'));var logger=require(_0x420f('0x14'))(_0x420f('0x15'));var utils=require(_0x420f('0x16'));var config=require(_0x420f('0x17'));var licenseUtil=require(_0x420f('0x18'));var db=require(_0x420f('0x19'))['db'];var integrations=require(_0x420f('0x1a'));function respondWithStatusCode(_0x2043d5,_0x1a9919){_0x1a9919=_0x1a9919||0xcc;return function(_0x258566){if(_0x258566){return _0x2043d5[_0x420f('0x1b')](_0x1a9919);}return _0x2043d5[_0x420f('0x1c')](_0x1a9919)[_0x420f('0x1d')]();};}function respondWithResult(_0x5cf8ae,_0x15517c){_0x15517c=_0x15517c||0xc8;return function(_0x5a1fd1){if(_0x5a1fd1){return _0x5cf8ae[_0x420f('0x1c')](_0x15517c)[_0x420f('0x1e')](_0x5a1fd1);}};}function respondWithFilteredResult(_0x4c782c,_0x4b6056){return function(_0x2ce6c3){if(_0x2ce6c3){var _0xb72a43=typeof _0x4b6056[_0x420f('0x1f')]===_0x420f('0x20')&&typeof _0x4b6056[_0x420f('0x21')]===_0x420f('0x20');var _0xa6f323=_0x2ce6c3[_0x420f('0x22')];var _0x7f0746=_0xb72a43?0x0:_0x4b6056[_0x420f('0x1f')];var _0x33628a=_0xb72a43?_0x2ce6c3['count']:_0x4b6056[_0x420f('0x1f')]+_0x4b6056[_0x420f('0x21')];var _0x1a10a0;if(_0x33628a>=_0xa6f323){_0x33628a=_0xa6f323;_0x1a10a0=0xc8;}else{_0x1a10a0=0xce;}_0x4c782c[_0x420f('0x1c')](_0x1a10a0);return _0x4c782c[_0x420f('0x23')](_0x420f('0x24'),_0x7f0746+'-'+_0x33628a+'/'+_0xa6f323)[_0x420f('0x1e')](_0x2ce6c3);}return null;};}function patchUpdates(_0x2917f7){return function(_0x2743c5){try{jsonpatch['apply'](_0x2743c5,_0x2917f7,!![]);}catch(_0x217e69){return BPromise[_0x420f('0x25')](_0x217e69);}return _0x2743c5['save']();};}function saveUpdates(_0x192b9e,_0x57ef50){return function(_0x15907f){if(_0x15907f){return _0x15907f[_0x420f('0x26')](_0x192b9e)[_0x420f('0x27')](function(_0x51fe7d){return _0x51fe7d;});}return null;};}function removeEntity(_0x2fa93f,_0x47246f){return function(_0x2b276f){if(_0x2b276f){return _0x2b276f['destroy']()[_0x420f('0x27')](function(){_0x2fa93f[_0x420f('0x1c')](0xcc)[_0x420f('0x1d')]();});}};}function handleEntityNotFound(_0x4e4280,_0x63d07e){return function(_0xf451d4){if(!_0xf451d4){_0x4e4280['sendStatus'](0x194);}return _0xf451d4;};}function handleError(_0x30566d,_0xaffa28){_0xaffa28=_0xaffa28||0x1f4;return function(_0x1e09cd){logger[_0x420f('0x28')](_0x1e09cd[_0x420f('0x29')]);if(_0x1e09cd[_0x420f('0x2a')]){delete _0x1e09cd[_0x420f('0x2a')];}_0x30566d[_0x420f('0x1c')](_0xaffa28)[_0x420f('0x2b')](_0x1e09cd);};}exports[_0x420f('0x2c')]=function(_0x511758,_0x262b7f){var _0x173955={},_0x363631={},_0x1e1997={'count':0x0,'rows':[]};var _0x440473=_[_0x420f('0x2d')](db[_0x420f('0x2e')][_0x420f('0x2f')],function(_0x101692){return{'name':_0x101692['fieldName'],'type':_0x101692['type'][_0x420f('0x30')]};});_0x363631['model']=_[_0x420f('0x2d')](_0x440473,'name');_0x363631[_0x420f('0x31')]=_['keys'](_0x511758[_0x420f('0x31')]);_0x363631[_0x420f('0x32')]=_['intersection'](_0x363631['model'],_0x363631[_0x420f('0x31')]);_0x173955['attributes']=_[_0x420f('0x33')](_0x363631[_0x420f('0x34')],qs[_0x420f('0x35')](_0x511758[_0x420f('0x31')][_0x420f('0x35')]));_0x173955['attributes']=_0x173955[_0x420f('0x36')][_0x420f('0x37')]?_0x173955['attributes']:_0x363631['model'];if(!_0x511758[_0x420f('0x31')][_0x420f('0x38')](_0x420f('0x39'))){_0x173955[_0x420f('0x21')]=qs[_0x420f('0x21')](_0x511758[_0x420f('0x31')]['limit']);_0x173955[_0x420f('0x1f')]=qs['offset'](_0x511758[_0x420f('0x31')][_0x420f('0x1f')]);}_0x173955[_0x420f('0x3a')]=qs['sort'](_0x511758[_0x420f('0x31')]['sort']);_0x173955[_0x420f('0x3b')]=qs['filters'](_[_0x420f('0x3c')](_0x511758[_0x420f('0x31')],_0x363631['filters']),_0x440473);if(_0x511758['query'][_0x420f('0x3d')]){_0x173955[_0x420f('0x3b')]=_['merge'](_0x173955[_0x420f('0x3b')],{'$or':_[_0x420f('0x2d')](_0x440473,function(_0x4470e0){if(_0x4470e0[_0x420f('0x3e')]!==_0x420f('0x3f')){var _0xeae0d={};_0xeae0d[_0x4470e0['name']]={'$like':'%'+_0x511758[_0x420f('0x31')][_0x420f('0x3d')]+'%'};return _0xeae0d;}})});}_0x173955=_[_0x420f('0x40')]({},_0x173955,_0x511758[_0x420f('0x41')]);var _0x2039bc={'where':_0x173955[_0x420f('0x3b')]};return db[_0x420f('0x2e')][_0x420f('0x22')](_0x2039bc)[_0x420f('0x27')](function(_0x2fe874){_0x1e1997['count']=_0x2fe874;if(_0x511758[_0x420f('0x31')][_0x420f('0x42')]){_0x173955[_0x420f('0x43')]=[{'all':!![]}];}return db[_0x420f('0x2e')][_0x420f('0x44')](_0x173955);})[_0x420f('0x27')](function(_0x2c0a75){_0x1e1997[_0x420f('0x45')]=_0x2c0a75;return _0x1e1997;})[_0x420f('0x27')](respondWithFilteredResult(_0x262b7f,_0x173955))['catch'](handleError(_0x262b7f,null));};exports['show']=function(_0x3c95db,_0x415cfb){var _0x29da91={'raw':![],'where':{'id':_0x3c95db[_0x420f('0x46')]['id']}},_0x5de8f1={};_0x5de8f1[_0x420f('0x34')]=_[_0x420f('0x47')](db[_0x420f('0x2e')][_0x420f('0x2f')]);_0x5de8f1[_0x420f('0x31')]=_['keys'](_0x3c95db['query']);_0x5de8f1['filters']=_[_0x420f('0x33')](_0x5de8f1[_0x420f('0x34')],_0x5de8f1[_0x420f('0x31')]);_0x29da91[_0x420f('0x36')]=_['intersection'](_0x5de8f1['model'],qs[_0x420f('0x35')](_0x3c95db['query'][_0x420f('0x35')]));_0x29da91[_0x420f('0x36')]=_0x29da91[_0x420f('0x36')][_0x420f('0x37')]?_0x29da91[_0x420f('0x36')]:_0x5de8f1[_0x420f('0x34')];if(_0x3c95db[_0x420f('0x31')][_0x420f('0x42')]){_0x29da91['include']=[{'all':!![]}];}_0x29da91=_[_0x420f('0x40')]({},_0x29da91,_0x3c95db['options']);return db[_0x420f('0x2e')][_0x420f('0x48')](_0x29da91)['then'](handleEntityNotFound(_0x415cfb,null))['then'](respondWithResult(_0x415cfb,null))['catch'](handleError(_0x415cfb,null));};exports['create']=function(_0x2eb594,_0x230e9d){return db['FreshsalesAccount'][_0x420f('0x49')](_0x2eb594[_0x420f('0x4a')],{})[_0x420f('0x27')](respondWithResult(_0x230e9d,0xc9))[_0x420f('0x4b')](handleError(_0x230e9d,null));};exports['update']=function(_0x587d3f,_0x3ef62d){if(_0x587d3f[_0x420f('0x4a')]['id']){delete _0x587d3f[_0x420f('0x4a')]['id'];}return db['FreshsalesAccount'][_0x420f('0x48')]({'where':{'id':_0x587d3f[_0x420f('0x46')]['id']}})[_0x420f('0x27')](handleEntityNotFound(_0x3ef62d,null))[_0x420f('0x27')](saveUpdates(_0x587d3f[_0x420f('0x4a')],null))[_0x420f('0x27')](respondWithResult(_0x3ef62d,null))['catch'](handleError(_0x3ef62d,null));};exports[_0x420f('0x4c')]=function(_0x5e5451,_0x8dbfb5){return db['FreshsalesAccount'][_0x420f('0x48')]({'where':{'id':_0x5e5451[_0x420f('0x46')]['id']}})['then'](handleEntityNotFound(_0x8dbfb5,null))[_0x420f('0x27')](removeEntity(_0x8dbfb5,null))['catch'](handleError(_0x8dbfb5,null));};exports[_0x420f('0x4d')]=function(_0x9a015e,_0x932ff1,_0xc77a96){var _0x144037={};var _0x9757d9={};var _0x8091d0;var _0x573b14;return db[_0x420f('0x2e')][_0x420f('0x4e')]({'where':{'id':_0x9a015e[_0x420f('0x46')]['id']}})['then'](handleEntityNotFound(_0x932ff1,null))[_0x420f('0x27')](function(_0x4d43eb){if(_0x4d43eb){_0x8091d0=_0x4d43eb;_0x9757d9[_0x420f('0x34')]=_[_0x420f('0x47')](db[_0x420f('0x4f')][_0x420f('0x2f')]);_0x9757d9[_0x420f('0x31')]=_[_0x420f('0x47')](_0x9a015e[_0x420f('0x31')]);_0x9757d9[_0x420f('0x32')]=_[_0x420f('0x33')](_0x9757d9[_0x420f('0x34')],_0x9757d9['query']);_0x144037['attributes']=_[_0x420f('0x33')](_0x9757d9['model'],qs['fields'](_0x9a015e[_0x420f('0x31')][_0x420f('0x35')]));_0x144037[_0x420f('0x36')]=_0x144037[_0x420f('0x36')]['length']?_0x144037[_0x420f('0x36')]:_0x9757d9[_0x420f('0x34')];_0x144037['order']=qs['sort'](_0x9a015e['query'][_0x420f('0x50')]);_0x144037[_0x420f('0x3b')]=qs[_0x420f('0x32')](_['pick'](_0x9a015e[_0x420f('0x31')],_0x9757d9[_0x420f('0x32')]));if(_0x9a015e['query'][_0x420f('0x3d')]){_0x144037[_0x420f('0x3b')]=_[_0x420f('0x40')](_0x144037[_0x420f('0x3b')],{'$or':_['map'](_0x144037[_0x420f('0x36')],function(_0x51e4a5){var _0xd7423b={};_0xd7423b[_0x51e4a5]={'$like':'%'+_0x9a015e[_0x420f('0x31')][_0x420f('0x3d')]+'%'};return _0xd7423b;})});}_0x144037=_[_0x420f('0x40')]({},_0x144037,_0x9a015e[_0x420f('0x41')]);return _0x8091d0[_0x420f('0x4d')](_0x144037);}})['then'](function(_0x478f74){if(_0x478f74){_0x573b14=_0x478f74[_0x420f('0x37')];if(!_0x9a015e[_0x420f('0x31')][_0x420f('0x38')](_0x420f('0x39'))){_0x144037['limit']=qs[_0x420f('0x21')](_0x9a015e[_0x420f('0x31')]['limit']);_0x144037['offset']=qs[_0x420f('0x1f')](_0x9a015e[_0x420f('0x31')][_0x420f('0x1f')]);}return _0x8091d0[_0x420f('0x4d')](_0x144037);}})[_0x420f('0x27')](function(_0x435eed){if(_0x435eed){return _0x435eed?{'count':_0x573b14,'rows':_0x435eed}:null;}})['then'](respondWithResult(_0x932ff1,null))[_0x420f('0x4b')](handleError(_0x932ff1,null));};exports[_0x420f('0x51')]=function(_0x2cfa16,_0x3bd449,_0x1e86d7){if(_0x2cfa16['body']['id']){delete _0x2cfa16['body']['id'];}return db[_0x420f('0x2e')][_0x420f('0x4e')]({'where':{'id':_0x2cfa16[_0x420f('0x46')]['id']}})[_0x420f('0x27')](handleEntityNotFound(_0x3bd449,null))[_0x420f('0x27')](function(_0x348967){if(_0x348967){_0x2cfa16['body'][_0x420f('0x52')]=_0x348967['id'];_0x2cfa16[_0x420f('0x4a')][_0x420f('0x53')]=integrations[_0x420f('0x54')](_0x2cfa16['body']['channel'],_0x2cfa16[_0x420f('0x4a')]['type']);_0x2cfa16[_0x420f('0x4a')][_0x420f('0x55')]=integrations[_0x420f('0x56')](_0x2cfa16[_0x420f('0x4a')][_0x420f('0x57')],_0x2cfa16[_0x420f('0x4a')]['type']);return db['FreshsalesConfiguration'][_0x420f('0x49')](_0x2cfa16[_0x420f('0x4a')],{'include':[{'model':db[_0x420f('0x58')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x420f('0x55')}]});}return null;})['then'](respondWithResult(_0x3bd449,null))[_0x420f('0x4b')](handleError(_0x3bd449,null));};exports[_0x420f('0x59')]=function(_0x464079,_0x150062,_0x329b41){var _0x246f36='';var _0x4864aa='';return db[_0x420f('0x2e')][_0x420f('0x4e')]({'where':{'id':_0x464079[_0x420f('0x46')]['id']},'attributes':['id',_0x420f('0x5a'),_0x420f('0x5b'),'apiKey']})['then'](handleEntityNotFound(_0x150062,null))[_0x420f('0x27')](function(_0xb7505f){if(_0xb7505f){_0x4864aa=_0xb7505f['username'];_0x246f36=_0xb7505f['remoteUri'];var _0x20b839=_0xb7505f[_0x420f('0x5b')][_0x420f('0x5c')](-0x1);if(_0x20b839==='/'){_0x246f36=_0x246f36['substring'](0x0,_0x246f36[_0x420f('0x5d')](_0x20b839));}return rp({'method':_0x420f('0x5e'),'uri':util[_0x420f('0x5f')]('%s%s',_0x246f36,_0x420f('0x60')),'headers':{'Authorization':_0x420f('0x61')+_0xb7505f[_0x420f('0x62')]},'json':!![]});}})[_0x420f('0x27')](function(_0x337440){if(_0x337440){var _0x134458=_0x337440['users'];var _0x36c229=![];var _0x367342=null;for(_0x367342=0x0;_0x367342<_0x134458[_0x420f('0x37')];_0x367342++){if(_0x134458[_0x367342]['email']===_0x4864aa){_0x36c229=!![];}}if(_0x36c229){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x420f('0x63')});}}})[_0x420f('0x27')](respondWithResult(_0x150062,null))['catch'](function(_0x139349){var _0x5add36=_0x464079[_0x420f('0x31')][_0x420f('0x64')]?0x1f4:_0x139349[_0x420f('0x65')]||0x1f4;logger[_0x420f('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x420f('0x59'),_0x5add36,JSON['stringify'](_0x139349));delete _0x139349[_0x420f('0x2a')];if(_0x5add36===0x191){_0x5add36=0x190;}_0x150062[_0x420f('0x1c')](_0x5add36)[_0x420f('0x2b')](_0x464079[_0x420f('0x31')][_0x420f('0x64')]?{'message':_0x420f('0x66'),'statusCode':_0x139349['statusCode']}:_0x139349);});}; \ No newline at end of file +var _0xe1a0=['order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','rawAttributes','options','create','body','FreshsalesConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','format','users','email','Requested\x20Resource\x20not\x20Found','test','stringify','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','then','end','error','name','index','map','FreshsalesAccount','fieldName','type','model','intersection','attributes','fields','length','query','hasOwnProperty'];(function(_0x121b71,_0x8bd4fc){var _0x327fdc=function(_0x891855){while(--_0x891855){_0x121b71['push'](_0x121b71['shift']());}};_0x327fdc(++_0x8bd4fc);}(_0xe1a0,0x154));var _0x0e1a=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0xe1a0[_0x4d21ff];return _0x22b554;};'use strict';var emlformat=require(_0x0e1a('0x0'));var rimraf=require(_0x0e1a('0x1'));var zipdir=require(_0x0e1a('0x2'));var jsonpatch=require(_0x0e1a('0x3'));var rp=require(_0x0e1a('0x4'));var moment=require(_0x0e1a('0x5'));var BPromise=require(_0x0e1a('0x6'));var Mustache=require(_0x0e1a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0e1a('0x8'));var csv=require(_0x0e1a('0x9'));var ejs=require(_0x0e1a('0xa'));var fs=require('fs');var fs_extra=require(_0x0e1a('0xb'));var _=require(_0x0e1a('0xc'));var squel=require(_0x0e1a('0xd'));var crypto=require(_0x0e1a('0xe'));var jsforce=require(_0x0e1a('0xf'));var deskjs=require(_0x0e1a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0e1a('0x11'));var Papa=require(_0x0e1a('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e1a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e1a('0x14'));var logger=require(_0x0e1a('0x15'))(_0x0e1a('0x16'));var utils=require(_0x0e1a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0e1a('0x18'));var db=require(_0x0e1a('0x19'))['db'];var integrations=require(_0x0e1a('0x1a'));function respondWithStatusCode(_0x88bee6,_0xd7476){_0xd7476=_0xd7476||0xcc;return function(_0x302469){if(_0x302469){return _0x88bee6[_0x0e1a('0x1b')](_0xd7476);}return _0x88bee6[_0x0e1a('0x1c')](_0xd7476)['end']();};}function respondWithResult(_0x3876bc,_0xea2e2){_0xea2e2=_0xea2e2||0xc8;return function(_0x4399e3){if(_0x4399e3){return _0x3876bc[_0x0e1a('0x1c')](_0xea2e2)['json'](_0x4399e3);}};}function respondWithFilteredResult(_0x2ef7b4,_0x2cf13c){return function(_0x5c696b){if(_0x5c696b){var _0x5b304a=typeof _0x2cf13c[_0x0e1a('0x1d')]===_0x0e1a('0x1e')&&typeof _0x2cf13c['limit']==='undefined';var _0x313324=_0x5c696b[_0x0e1a('0x1f')];var _0x5c917f=_0x5b304a?0x0:_0x2cf13c[_0x0e1a('0x1d')];var _0x524391=_0x5b304a?_0x5c696b['count']:_0x2cf13c[_0x0e1a('0x1d')]+_0x2cf13c[_0x0e1a('0x20')];var _0x9661d8;if(_0x524391>=_0x313324){_0x524391=_0x313324;_0x9661d8=0xc8;}else{_0x9661d8=0xce;}_0x2ef7b4[_0x0e1a('0x1c')](_0x9661d8);return _0x2ef7b4[_0x0e1a('0x21')]('Content-Range',_0x5c917f+'-'+_0x524391+'/'+_0x313324)[_0x0e1a('0x22')](_0x5c696b);}return null;};}function patchUpdates(_0x13744d){return function(_0x56716b){try{jsonpatch[_0x0e1a('0x23')](_0x56716b,_0x13744d,!![]);}catch(_0x12c1bd){return BPromise[_0x0e1a('0x24')](_0x12c1bd);}return _0x56716b[_0x0e1a('0x25')]();};}function saveUpdates(_0xd8d753,_0x3a2243){return function(_0x4afb4e){if(_0x4afb4e){return _0x4afb4e[_0x0e1a('0x26')](_0xd8d753)['then'](function(_0x59c657){return _0x59c657;});}return null;};}function removeEntity(_0x4a8644,_0x39a487){return function(_0x4e39c1){if(_0x4e39c1){return _0x4e39c1[_0x0e1a('0x27')]()[_0x0e1a('0x28')](function(){_0x4a8644['status'](0xcc)[_0x0e1a('0x29')]();});}};}function handleEntityNotFound(_0x2e34b8,_0x5c29b3){return function(_0x224c12){if(!_0x224c12){_0x2e34b8[_0x0e1a('0x1b')](0x194);}return _0x224c12;};}function handleError(_0x133be8,_0xe9e9ad){_0xe9e9ad=_0xe9e9ad||0x1f4;return function(_0x4a51b7){logger[_0x0e1a('0x2a')](_0x4a51b7['stack']);if(_0x4a51b7[_0x0e1a('0x2b')]){delete _0x4a51b7[_0x0e1a('0x2b')];}_0x133be8[_0x0e1a('0x1c')](_0xe9e9ad)['send'](_0x4a51b7);};}exports[_0x0e1a('0x2c')]=function(_0x125cbd,_0x5d1d5e){var _0x49981a={},_0x285776={},_0x388a62={'count':0x0,'rows':[]};var _0x5846fd=_[_0x0e1a('0x2d')](db[_0x0e1a('0x2e')]['rawAttributes'],function(_0x296697){return{'name':_0x296697[_0x0e1a('0x2f')],'type':_0x296697[_0x0e1a('0x30')]['key']};});_0x285776[_0x0e1a('0x31')]=_[_0x0e1a('0x2d')](_0x5846fd,_0x0e1a('0x2b'));_0x285776['query']=_['keys'](_0x125cbd['query']);_0x285776['filters']=_[_0x0e1a('0x32')](_0x285776['model'],_0x285776['query']);_0x49981a[_0x0e1a('0x33')]=_[_0x0e1a('0x32')](_0x285776['model'],qs[_0x0e1a('0x34')](_0x125cbd['query']['fields']));_0x49981a[_0x0e1a('0x33')]=_0x49981a[_0x0e1a('0x33')][_0x0e1a('0x35')]?_0x49981a['attributes']:_0x285776[_0x0e1a('0x31')];if(!_0x125cbd[_0x0e1a('0x36')][_0x0e1a('0x37')]('nolimit')){_0x49981a[_0x0e1a('0x20')]=qs[_0x0e1a('0x20')](_0x125cbd[_0x0e1a('0x36')][_0x0e1a('0x20')]);_0x49981a[_0x0e1a('0x1d')]=qs['offset'](_0x125cbd[_0x0e1a('0x36')][_0x0e1a('0x1d')]);}_0x49981a[_0x0e1a('0x38')]=qs[_0x0e1a('0x39')](_0x125cbd[_0x0e1a('0x36')][_0x0e1a('0x39')]);_0x49981a['where']=qs[_0x0e1a('0x3a')](_[_0x0e1a('0x3b')](_0x125cbd[_0x0e1a('0x36')],_0x285776['filters']),_0x5846fd);if(_0x125cbd[_0x0e1a('0x36')]['filter']){_0x49981a[_0x0e1a('0x3c')]=_[_0x0e1a('0x3d')](_0x49981a[_0x0e1a('0x3c')],{'$or':_[_0x0e1a('0x2d')](_0x5846fd,function(_0x1dc76d){if(_0x1dc76d[_0x0e1a('0x30')]!==_0x0e1a('0x3e')){var _0x4ccd8d={};_0x4ccd8d[_0x1dc76d[_0x0e1a('0x2b')]]={'$like':'%'+_0x125cbd['query'][_0x0e1a('0x3f')]+'%'};return _0x4ccd8d;}})});}_0x49981a=_[_0x0e1a('0x3d')]({},_0x49981a,_0x125cbd['options']);var _0xdc5ca={'where':_0x49981a[_0x0e1a('0x3c')]};return db[_0x0e1a('0x2e')][_0x0e1a('0x1f')](_0xdc5ca)[_0x0e1a('0x28')](function(_0x189d12){_0x388a62[_0x0e1a('0x1f')]=_0x189d12;if(_0x125cbd[_0x0e1a('0x36')][_0x0e1a('0x40')]){_0x49981a[_0x0e1a('0x41')]=[{'all':!![]}];}return db[_0x0e1a('0x2e')]['findAll'](_0x49981a);})[_0x0e1a('0x28')](function(_0x1c01fe){_0x388a62[_0x0e1a('0x42')]=_0x1c01fe;return _0x388a62;})[_0x0e1a('0x28')](respondWithFilteredResult(_0x5d1d5e,_0x49981a))[_0x0e1a('0x43')](handleError(_0x5d1d5e,null));};exports[_0x0e1a('0x44')]=function(_0x514494,_0x344834){var _0x5871da={'raw':![],'where':{'id':_0x514494[_0x0e1a('0x45')]['id']}},_0x3c0b7d={};_0x3c0b7d['model']=_[_0x0e1a('0x46')](db[_0x0e1a('0x2e')][_0x0e1a('0x47')]);_0x3c0b7d[_0x0e1a('0x36')]=_[_0x0e1a('0x46')](_0x514494[_0x0e1a('0x36')]);_0x3c0b7d[_0x0e1a('0x3a')]=_[_0x0e1a('0x32')](_0x3c0b7d[_0x0e1a('0x31')],_0x3c0b7d[_0x0e1a('0x36')]);_0x5871da[_0x0e1a('0x33')]=_['intersection'](_0x3c0b7d[_0x0e1a('0x31')],qs['fields'](_0x514494['query'][_0x0e1a('0x34')]));_0x5871da[_0x0e1a('0x33')]=_0x5871da['attributes'][_0x0e1a('0x35')]?_0x5871da['attributes']:_0x3c0b7d['model'];if(_0x514494['query'][_0x0e1a('0x40')]){_0x5871da['include']=[{'all':!![]}];}_0x5871da=_[_0x0e1a('0x3d')]({},_0x5871da,_0x514494[_0x0e1a('0x48')]);return db[_0x0e1a('0x2e')]['find'](_0x5871da)[_0x0e1a('0x28')](handleEntityNotFound(_0x344834,null))[_0x0e1a('0x28')](respondWithResult(_0x344834,null))['catch'](handleError(_0x344834,null));};exports['create']=function(_0x2ffc8c,_0x513b89){return db[_0x0e1a('0x2e')][_0x0e1a('0x49')](_0x2ffc8c[_0x0e1a('0x4a')],{})['then'](respondWithResult(_0x513b89,0xc9))[_0x0e1a('0x43')](handleError(_0x513b89,null));};exports[_0x0e1a('0x26')]=function(_0x20ee1c,_0x10bf59){if(_0x20ee1c['body']['id']){delete _0x20ee1c[_0x0e1a('0x4a')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x20ee1c[_0x0e1a('0x45')]['id']}})[_0x0e1a('0x28')](handleEntityNotFound(_0x10bf59,null))['then'](saveUpdates(_0x20ee1c[_0x0e1a('0x4a')],null))[_0x0e1a('0x28')](respondWithResult(_0x10bf59,null))[_0x0e1a('0x43')](handleError(_0x10bf59,null));};exports['destroy']=function(_0x563d51,_0x5a2e8b){return db['FreshsalesAccount']['find']({'where':{'id':_0x563d51[_0x0e1a('0x45')]['id']}})[_0x0e1a('0x28')](handleEntityNotFound(_0x5a2e8b,null))[_0x0e1a('0x28')](removeEntity(_0x5a2e8b,null))['catch'](handleError(_0x5a2e8b,null));};exports['getConfigurations']=function(_0x13ae7c,_0x29e930,_0x3352ff){var _0x5da50c={};var _0x29c42f={};var _0x161069;var _0x1f59e2;return db[_0x0e1a('0x2e')]['findOne']({'where':{'id':_0x13ae7c[_0x0e1a('0x45')]['id']}})[_0x0e1a('0x28')](handleEntityNotFound(_0x29e930,null))['then'](function(_0x4aafa6){if(_0x4aafa6){_0x161069=_0x4aafa6;_0x29c42f[_0x0e1a('0x31')]=_[_0x0e1a('0x46')](db[_0x0e1a('0x4b')][_0x0e1a('0x47')]);_0x29c42f[_0x0e1a('0x36')]=_[_0x0e1a('0x46')](_0x13ae7c[_0x0e1a('0x36')]);_0x29c42f[_0x0e1a('0x3a')]=_[_0x0e1a('0x32')](_0x29c42f['model'],_0x29c42f['query']);_0x5da50c['attributes']=_[_0x0e1a('0x32')](_0x29c42f[_0x0e1a('0x31')],qs[_0x0e1a('0x34')](_0x13ae7c['query'][_0x0e1a('0x34')]));_0x5da50c[_0x0e1a('0x33')]=_0x5da50c[_0x0e1a('0x33')][_0x0e1a('0x35')]?_0x5da50c['attributes']:_0x29c42f['model'];_0x5da50c[_0x0e1a('0x38')]=qs[_0x0e1a('0x39')](_0x13ae7c[_0x0e1a('0x36')][_0x0e1a('0x39')]);_0x5da50c[_0x0e1a('0x3c')]=qs[_0x0e1a('0x3a')](_[_0x0e1a('0x3b')](_0x13ae7c[_0x0e1a('0x36')],_0x29c42f[_0x0e1a('0x3a')]));if(_0x13ae7c[_0x0e1a('0x36')][_0x0e1a('0x3f')]){_0x5da50c['where']=_[_0x0e1a('0x3d')](_0x5da50c['where'],{'$or':_[_0x0e1a('0x2d')](_0x5da50c[_0x0e1a('0x33')],function(_0x3cce18){var _0x95df76={};_0x95df76[_0x3cce18]={'$like':'%'+_0x13ae7c[_0x0e1a('0x36')][_0x0e1a('0x3f')]+'%'};return _0x95df76;})});}_0x5da50c=_[_0x0e1a('0x3d')]({},_0x5da50c,_0x13ae7c['options']);return _0x161069[_0x0e1a('0x4c')](_0x5da50c);}})[_0x0e1a('0x28')](function(_0x5b66f4){if(_0x5b66f4){_0x1f59e2=_0x5b66f4['length'];if(!_0x13ae7c[_0x0e1a('0x36')][_0x0e1a('0x37')](_0x0e1a('0x4d'))){_0x5da50c[_0x0e1a('0x20')]=qs[_0x0e1a('0x20')](_0x13ae7c[_0x0e1a('0x36')][_0x0e1a('0x20')]);_0x5da50c[_0x0e1a('0x1d')]=qs[_0x0e1a('0x1d')](_0x13ae7c[_0x0e1a('0x36')][_0x0e1a('0x1d')]);}return _0x161069[_0x0e1a('0x4c')](_0x5da50c);}})[_0x0e1a('0x28')](function(_0x1951f7){if(_0x1951f7){return _0x1951f7?{'count':_0x1f59e2,'rows':_0x1951f7}:null;}})[_0x0e1a('0x28')](respondWithResult(_0x29e930,null))[_0x0e1a('0x43')](handleError(_0x29e930,null));};exports[_0x0e1a('0x4e')]=function(_0x26034a,_0x398538,_0x492657){if(_0x26034a['body']['id']){delete _0x26034a[_0x0e1a('0x4a')]['id'];}return db[_0x0e1a('0x2e')]['findOne']({'where':{'id':_0x26034a[_0x0e1a('0x45')]['id']}})[_0x0e1a('0x28')](handleEntityNotFound(_0x398538,null))['then'](function(_0x2406a5){if(_0x2406a5){_0x26034a[_0x0e1a('0x4a')][_0x0e1a('0x4f')]=_0x2406a5['id'];_0x26034a[_0x0e1a('0x4a')]['Subjects']=integrations[_0x0e1a('0x50')](_0x26034a[_0x0e1a('0x4a')][_0x0e1a('0x51')],_0x26034a[_0x0e1a('0x4a')][_0x0e1a('0x30')]);_0x26034a[_0x0e1a('0x4a')][_0x0e1a('0x52')]=integrations[_0x0e1a('0x53')](_0x26034a[_0x0e1a('0x4a')][_0x0e1a('0x51')],_0x26034a[_0x0e1a('0x4a')][_0x0e1a('0x30')]);return db[_0x0e1a('0x4b')][_0x0e1a('0x49')](_0x26034a['body'],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x0e1a('0x52')}]});}return null;})[_0x0e1a('0x28')](respondWithResult(_0x398538,null))[_0x0e1a('0x43')](handleError(_0x398538,null));};exports[_0x0e1a('0x54')]=function(_0x50e5b8,_0x527134,_0x2c4630){var _0x37034a='';var _0x5be79c='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x50e5b8[_0x0e1a('0x45')]['id']},'attributes':['id','username',_0x0e1a('0x55'),_0x0e1a('0x56')]})[_0x0e1a('0x28')](handleEntityNotFound(_0x527134,null))[_0x0e1a('0x28')](function(_0x363fc2){if(_0x363fc2){_0x5be79c=_0x363fc2[_0x0e1a('0x57')];_0x37034a=_0x363fc2['remoteUri'];var _0x490269=_0x363fc2[_0x0e1a('0x55')][_0x0e1a('0x58')](-0x1);if(_0x490269==='/'){_0x37034a=_0x37034a[_0x0e1a('0x59')](0x0,_0x37034a[_0x0e1a('0x5a')](_0x490269));}return rp({'method':'GET','uri':util[_0x0e1a('0x5b')]('%s%s',_0x37034a,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x363fc2['apiKey']},'json':!![]});}})[_0x0e1a('0x28')](function(_0x4fc98a){if(_0x4fc98a){var _0x1d4796=_0x4fc98a[_0x0e1a('0x5c')];var _0x3cdf31=![];var _0x3829af=null;for(_0x3829af=0x0;_0x3829af<_0x1d4796[_0x0e1a('0x35')];_0x3829af++){if(_0x1d4796[_0x3829af][_0x0e1a('0x5d')]===_0x5be79c){_0x3cdf31=!![];}}if(_0x3cdf31){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0e1a('0x5e')});}}})[_0x0e1a('0x28')](respondWithResult(_0x527134,null))[_0x0e1a('0x43')](function(_0x123b02){var _0xc01f3=_0x50e5b8[_0x0e1a('0x36')][_0x0e1a('0x5f')]?0x1f4:_0x123b02['statusCode']||0x1f4;logger[_0x0e1a('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x0e1a('0x54'),_0xc01f3,JSON[_0x0e1a('0x60')](_0x123b02));delete _0x123b02[_0x0e1a('0x2b')];if(_0xc01f3===0x191){_0xc01f3=0x190;}_0x527134['status'](_0xc01f3)[_0x0e1a('0x61')](_0x50e5b8[_0x0e1a('0x36')][_0x0e1a('0x5f')]?{'message':'Wrong\x20credentials','statusCode':_0x123b02[_0x0e1a('0x62')]}:_0x123b02);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f4b4536..4ed4b17 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 _0x6a55=['define','FreshsalesAccount','int_freshsales_accounts','lodash','moment','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0x6a55,0xdb));var _0x56a5=function(_0x3b22e9,_0x354406){_0x3b22e9=_0x3b22e9-0x0;var _0x230314=_0x6a55[_0x3b22e9];return _0x230314;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x56a5('0x4'));module[_0x56a5('0x5')]=function(_0x42d164,_0x293ea1){return _0x42d164[_0x56a5('0x6')](_0x56a5('0x7'),attributes,{'tableName':_0x56a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb145=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x323abb,_0x37c6ce){var _0x18f2ce=function(_0xfb6565){while(--_0xfb6565){_0x323abb['push'](_0x323abb['shift']());}};_0x18f2ce(++_0x37c6ce);}(_0xb145,0xa3));var _0x5b14=function(_0x367310,_0x460860){_0x367310=_0x367310-0x0;var _0x22bce5=_0xb145[_0x367310];return _0x22bce5;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var logger=require(_0x5b14('0x1'))(_0x5b14('0x2'));var moment=require(_0x5b14('0x3'));var BPromise=require(_0x5b14('0x4'));var rp=require(_0x5b14('0x5'));var fs=require('fs');var path=require(_0x5b14('0x6'));var rimraf=require(_0x5b14('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b14('0x8'));var integrations=require(_0x5b14('0x9'));module[_0x5b14('0xa')]=function(_0x4d82ad,_0x50fd91){return _0x4d82ad[_0x5b14('0xb')](_0x5b14('0xc'),attributes,{'tableName':_0x5b14('0xd'),'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 69b661f..00866ee 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 _0xb145=['stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetFreshsalesAccount','where','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb145,0xa3));var _0x5b14=function(_0x316dad,_0x233dad){_0x316dad=_0x316dad-0x0;var _0x3bcbd6=_0xb145[_0x316dad];return _0x3bcbd6;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});}exports['GetFreshsalesAccount']=function(_0x48d395){var _0x58bf3c=this;return new Promise(function(_0x3f397d,_0x3035b5){return db[_0x5b14('0x17')][_0x5b14('0x18')]({'raw':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x48d395['options']?_0x48d395['options']['where']||null:null,'attributes':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'limit':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1c')]||null:null,'include':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x48d395['options'][_0x5b14('0x1d')],function(_0x54073f){return{'model':db[_0x54073f['model']],'as':_0x54073f['as'],'attributes':_0x54073f['attributes'],'include':_0x54073f['include']?_[_0x5b14('0x1e')](_0x54073f[_0x5b14('0x1d')],function(_0x153a25){return{'model':db[_0x153a25['model']],'as':_0x153a25['as'],'attributes':_0x153a25[_0x5b14('0x1b')],'include':_0x153a25[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x153a25[_0x5b14('0x1d')],function(_0xe6851b){return{'model':db[_0xe6851b[_0x5b14('0x1f')]],'as':_0xe6851b['as'],'attributes':_0xe6851b[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5b14('0x20')](function(_0x296d65){logger[_0x5b14('0xd')](_0x5b14('0x21'),_0x48d395);logger[_0x5b14('0xf')](_0x5b14('0x21'),_0x48d395,JSON[_0x5b14('0x11')](_0x296d65));_0x3f397d(_0x296d65);})['catch'](function(_0x370fcd){logger[_0x5b14('0x12')]('GetFreshsalesAccount',_0x370fcd['message'],_0x48d395);_0x3035b5(_0x58bf3c[_0x5b14('0x12')](0x1f4,_0x370fcd[_0x5b14('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x4c1f0e){var _0x21b43b=this;return new Promise(function(_0x4d3905,_0x38c665){return db[_0x5b14('0x17')]['find']({'raw':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e['options'][_0x5b14('0x22')]||null:null,'attributes':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'include':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e[_0x5b14('0x19')]['include']?_[_0x5b14('0x1e')](_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1d')],function(_0x37f62c){return{'model':db[_0x37f62c['model']],'as':_0x37f62c['as'],'attributes':_0x37f62c[_0x5b14('0x1b')],'include':_0x37f62c[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x37f62c['include'],function(_0x2fe74d){return{'model':db[_0x2fe74d['model']],'as':_0x2fe74d['as'],'attributes':_0x2fe74d[_0x5b14('0x1b')],'include':_0x2fe74d[_0x5b14('0x1d')]?_['map'](_0x2fe74d[_0x5b14('0x1d')],function(_0x2a83d4){return{'model':db[_0x2a83d4['model']],'as':_0x2a83d4['as'],'attributes':_0x2a83d4[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ce6bb){logger[_0x5b14('0xd')](_0x5b14('0x23'),_0x4c1f0e);logger[_0x5b14('0xf')]('ShowFreshsalesAccount',_0x4c1f0e,JSON[_0x5b14('0x11')](_0x1ce6bb));_0x4d3905(_0x1ce6bb);})[_0x5b14('0x16')](function(_0x15d4c4){logger[_0x5b14('0x12')](_0x5b14('0x23'),_0x15d4c4[_0x5b14('0x14')],_0x4c1f0e);_0x38c665(_0x21b43b[_0x5b14('0x12')](0x1f4,_0x15d4c4[_0x5b14('0x14')]));});});}; \ No newline at end of file +var _0x1893=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowFreshsalesAccount','find','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x16d097,_0x570971){var _0x5a3779=function(_0x18f389){while(--_0x18f389){_0x16d097['push'](_0x16d097['shift']());}};_0x5a3779(++_0x570971);}(_0x1893,0xa2));var _0x3189=function(_0x3813ad,_0x2eff01){_0x3813ad=_0x3813ad-0x0;var _0x16ed55=_0x1893[_0x3813ad];return _0x16ed55;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});}exports[_0x3189('0x15')]=function(_0xf8aed7){var _0x22c7ba=this;return new Promise(function(_0x9905c4,_0x4c4d9b){return db[_0x3189('0x16')][_0x3189('0x17')]({'raw':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x19')]===undefined?!![]:![]:!![],'where':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7[_0x3189('0x18')][_0x3189('0x1a')]||null:null,'attributes':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x1b')]||null:null,'limit':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7[_0x3189('0x18')]['limit']||null:null,'include':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x1c')]?_[_0x3189('0x1d')](_0xf8aed7[_0x3189('0x18')][_0x3189('0x1c')],function(_0x1cbe33){return{'model':db[_0x1cbe33[_0x3189('0x1e')]],'as':_0x1cbe33['as'],'attributes':_0x1cbe33['attributes'],'include':_0x1cbe33['include']?_[_0x3189('0x1d')](_0x1cbe33[_0x3189('0x1c')],function(_0x1dc1c8){return{'model':db[_0x1dc1c8[_0x3189('0x1e')]],'as':_0x1dc1c8['as'],'attributes':_0x1dc1c8[_0x3189('0x1b')],'include':_0x1dc1c8[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x1dc1c8[_0x3189('0x1c')],function(_0x17b540){return{'model':db[_0x17b540[_0x3189('0x1e')]],'as':_0x17b540['as'],'attributes':_0x17b540['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5aa34a){logger[_0x3189('0x14')](_0x3189('0x15'),_0xf8aed7);logger[_0x3189('0xe')](_0x3189('0x15'),_0xf8aed7,JSON[_0x3189('0x10')](_0x5aa34a));_0x9905c4(_0x5aa34a);})[_0x3189('0x1f')](function(_0x4d453a){logger[_0x3189('0x11')](_0x3189('0x15'),_0x4d453a['message'],_0xf8aed7);_0x4c4d9b(_0x22c7ba[_0x3189('0x11')](0x1f4,_0x4d453a[_0x3189('0x13')]));});});};exports[_0x3189('0x20')]=function(_0x5c7a36){var _0x168dc2=this;return new Promise(function(_0x32bba1,_0x23798e){return db['FreshsalesAccount'][_0x3189('0x21')]({'raw':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options'][_0x3189('0x19')]===undefined?!![]:![]:!![],'where':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36[_0x3189('0x18')][_0x3189('0x1a')]||null:null,'attributes':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options']['attributes']||null:null,'include':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options'][_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x5c7a36[_0x3189('0x18')][_0x3189('0x1c')],function(_0x231d72){return{'model':db[_0x231d72[_0x3189('0x1e')]],'as':_0x231d72['as'],'attributes':_0x231d72[_0x3189('0x1b')],'include':_0x231d72[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x231d72['include'],function(_0x453e4b){return{'model':db[_0x453e4b[_0x3189('0x1e')]],'as':_0x453e4b['as'],'attributes':_0x453e4b[_0x3189('0x1b')],'include':_0x453e4b[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x453e4b[_0x3189('0x1c')],function(_0xd1ee0){return{'model':db[_0xd1ee0['model']],'as':_0xd1ee0['as'],'attributes':_0xd1ee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3189('0x22')](function(_0x580064){logger[_0x3189('0x14')](_0x3189('0x20'),_0x5c7a36);logger['debug'](_0x3189('0x20'),_0x5c7a36,JSON[_0x3189('0x10')](_0x580064));_0x32bba1(_0x580064);})[_0x3189('0x1f')](function(_0x254135){logger['error'](_0x3189('0x20'),_0x254135['message'],_0x5c7a36);_0x23798e(_0x168dc2['error'](0x1f4,_0x254135[_0x3189('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3c8bcb3..02633ea 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 _0xcd29=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','create','put','update','delete','destroy','exports'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xcd29,0x177));var _0x9cd2=function(_0x34889e,_0x46a622){_0x34889e=_0x34889e-0x0;var _0x66ca4d=_0xcd29[_0x34889e];return _0x66ca4d;};'use strict';var multer=require(_0x9cd2('0x0'));var util=require(_0x9cd2('0x1'));var path=require(_0x9cd2('0x2'));var timeout=require('connect-timeout');var express=require(_0x9cd2('0x3'));var router=express[_0x9cd2('0x4')]();var fs_extra=require(_0x9cd2('0x5'));var auth=require(_0x9cd2('0x6'));var interaction=require(_0x9cd2('0x7'));var config=require('../../config/environment');var controller=require(_0x9cd2('0x8'));router[_0x9cd2('0x9')]('/',auth[_0x9cd2('0xa')](),controller[_0x9cd2('0xb')]);router[_0x9cd2('0x9')](_0x9cd2('0xc'),auth[_0x9cd2('0xa')](),controller[_0x9cd2('0xd')]);router[_0x9cd2('0x9')](_0x9cd2('0xe'),auth[_0x9cd2('0xa')](),controller[_0x9cd2('0xf')]);router['get'](_0x9cd2('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x9cd2('0x9')](_0x9cd2('0x11'),auth[_0x9cd2('0xa')](),controller[_0x9cd2('0x12')]);router['post']('/',auth[_0x9cd2('0xa')](),controller[_0x9cd2('0x13')]);router[_0x9cd2('0x14')](_0x9cd2('0xc'),auth['isAuthenticated'](),controller[_0x9cd2('0x15')]);router[_0x9cd2('0x16')](_0x9cd2('0xc'),auth[_0x9cd2('0xa')](),controller[_0x9cd2('0x17')]);module[_0x9cd2('0x18')]=router; \ No newline at end of file +var _0x458c=['destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','show','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','update','delete','/:id'];(function(_0x3c9bdf,_0x3b30cd){var _0x5664a6=function(_0x4ea55c){while(--_0x4ea55c){_0x3c9bdf['push'](_0x3c9bdf['shift']());}};_0x5664a6(++_0x3b30cd);}(_0x458c,0x12d));var _0xc458=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x458c[_0x45c48f];return _0xaf5037;};'use strict';var multer=require('multer');var util=require(_0xc458('0x0'));var path=require(_0xc458('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc458('0x2')]();var fs_extra=require(_0xc458('0x3'));var auth=require(_0xc458('0x4'));var interaction=require(_0xc458('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc458('0x6')]);router[_0xc458('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc458('0x8')]);router['get'](_0xc458('0x9'),auth[_0xc458('0xa')](),controller[_0xc458('0xb')]);router['get'](_0xc458('0xc'),auth[_0xc458('0xa')](),controller[_0xc458('0xd')]);router['get'](_0xc458('0xe'),auth['isAuthenticated'](),controller[_0xc458('0xf')]);router[_0xc458('0x10')]('/',auth['isAuthenticated'](),controller[_0xc458('0x11')]);router['put']('/:id',auth[_0xc458('0xa')](),controller[_0xc458('0x12')]);router[_0xc458('0x13')](_0xc458('0x14'),auth['isAuthenticated'](),controller[_0xc458('0x15')]);module[_0xc458('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 28040bb..2552b5d 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 _0xf358=['exports','STRING','sequelize'];(function(_0x46ce21,_0x254327){var _0x4901ba=function(_0x528f1c){while(--_0x528f1c){_0x46ce21['push'](_0x46ce21['shift']());}};_0x4901ba(++_0x254327);}(_0xf358,0x185));var _0x8f35=function(_0x2fc542,_0x2b2d2c){_0x2fc542=_0x2fc542-0x0;var _0x39073a=_0xf358[_0x2fc542];return _0x39073a;};'use strict';var Sequelize=require(_0x8f35('0x0'));module[_0x8f35('0x1')]={'name':{'type':Sequelize[_0x8f35('0x2')]},'description':{'type':Sequelize[_0x8f35('0x2')]}}; \ No newline at end of file +var _0x8497=['STRING','exports'];(function(_0x3872f9,_0x4d9ccd){var _0x10e421=function(_0x4a3a14){while(--_0x4a3a14){_0x3872f9['push'](_0x3872f9['shift']());}};_0x10e421(++_0x4d9ccd);}(_0x8497,0xc1));var _0x7849=function(_0x171fc4,_0x7ec171){_0x171fc4=_0x171fc4-0x0;var _0x3aee00=_0x8497[_0x171fc4];return _0x3aee00;};'use strict';var Sequelize=require('sequelize');module[_0x7849('0x0')]={'name':{'type':Sequelize[_0x7849('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 78d022e..9e70072 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 _0xb3f4=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','name','send','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','create','update','body','find','FreshsalesField','order','filter','getSubjects','getDescriptions','getFields','findOne','options'];(function(_0xb7dc62,_0x351e32){var _0x3f3df3=function(_0x43afee){while(--_0x43afee){_0xb7dc62['push'](_0xb7dc62['shift']());}};_0x3f3df3(++_0x351e32);}(_0xb3f4,0x1ce));var _0x4b3f=function(_0x447b2f,_0x4bf9cf){_0x447b2f=_0x447b2f-0x0;var _0x4463b4=_0xb3f4[_0x447b2f];return _0x4463b4;};'use strict';var emlformat=require(_0x4b3f('0x0'));var rimraf=require(_0x4b3f('0x1'));var zipdir=require(_0x4b3f('0x2'));var jsonpatch=require(_0x4b3f('0x3'));var rp=require(_0x4b3f('0x4'));var moment=require('moment');var BPromise=require(_0x4b3f('0x5'));var Mustache=require(_0x4b3f('0x6'));var util=require('util');var path=require(_0x4b3f('0x7'));var sox=require('sox');var csv=require(_0x4b3f('0x8'));var ejs=require(_0x4b3f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b3f('0xa'));var squel=require('squel');var crypto=require(_0x4b3f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b3f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4b3f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4b3f('0xe'));var qs=require(_0x4b3f('0xf'));var as=require(_0x4b3f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b3f('0x11'));var utils=require('../../config/utils');var config=require(_0x4b3f('0x12'));var licenseUtil=require(_0x4b3f('0x13'));var db=require(_0x4b3f('0x14'))['db'];function respondWithStatusCode(_0x552512,_0x216ba8){_0x216ba8=_0x216ba8||0xcc;return function(_0x36a1bd){if(_0x36a1bd){return _0x552512[_0x4b3f('0x15')](_0x216ba8);}return _0x552512[_0x4b3f('0x16')](_0x216ba8)[_0x4b3f('0x17')]();};}function respondWithResult(_0x45360e,_0x122941){_0x122941=_0x122941||0xc8;return function(_0x2bf5b0){if(_0x2bf5b0){return _0x45360e['status'](_0x122941)[_0x4b3f('0x18')](_0x2bf5b0);}};}function respondWithFilteredResult(_0x550a86,_0x519cfb){return function(_0x84783a){if(_0x84783a){var _0x4d2d1a=typeof _0x519cfb[_0x4b3f('0x19')]===_0x4b3f('0x1a')&&typeof _0x519cfb['limit']===_0x4b3f('0x1a');var _0x31a37c=_0x84783a[_0x4b3f('0x1b')];var _0x45693c=_0x4d2d1a?0x0:_0x519cfb[_0x4b3f('0x19')];var _0x1e7051=_0x4d2d1a?_0x84783a[_0x4b3f('0x1b')]:_0x519cfb[_0x4b3f('0x19')]+_0x519cfb[_0x4b3f('0x1c')];var _0x3fb4f6;if(_0x1e7051>=_0x31a37c){_0x1e7051=_0x31a37c;_0x3fb4f6=0xc8;}else{_0x3fb4f6=0xce;}_0x550a86[_0x4b3f('0x16')](_0x3fb4f6);return _0x550a86[_0x4b3f('0x1d')](_0x4b3f('0x1e'),_0x45693c+'-'+_0x1e7051+'/'+_0x31a37c)['json'](_0x84783a);}return null;};}function patchUpdates(_0xe5d9a0){return function(_0x19e84a){try{jsonpatch['apply'](_0x19e84a,_0xe5d9a0,!![]);}catch(_0x2c88e2){return BPromise[_0x4b3f('0x1f')](_0x2c88e2);}return _0x19e84a[_0x4b3f('0x20')]();};}function saveUpdates(_0x23d92d,_0xee975f){return function(_0x4b1e31){if(_0x4b1e31){return _0x4b1e31['update'](_0x23d92d)[_0x4b3f('0x21')](function(_0x4de271){return _0x4de271;});}return null;};}function removeEntity(_0x4b49dd,_0x25409d){return function(_0x368593){if(_0x368593){return _0x368593[_0x4b3f('0x22')]()[_0x4b3f('0x21')](function(){_0x4b49dd[_0x4b3f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7ae6,_0x18061c){return function(_0x141bcf){if(!_0x141bcf){_0x4e7ae6[_0x4b3f('0x15')](0x194);}return _0x141bcf;};}function handleError(_0x222c11,_0x36ced4){_0x36ced4=_0x36ced4||0x1f4;return function(_0x44864d){logger[_0x4b3f('0x23')](_0x44864d['stack']);if(_0x44864d[_0x4b3f('0x24')]){delete _0x44864d['name'];}_0x222c11[_0x4b3f('0x16')](_0x36ced4)[_0x4b3f('0x25')](_0x44864d);};}exports['index']=function(_0x5c1371,_0x1df840){var _0x1911bd={},_0x564194={},_0x19df6f={'count':0x0,'rows':[]};var _0x17763b=_[_0x4b3f('0x26')](db[_0x4b3f('0x27')]['rawAttributes'],function(_0x49826d){return{'name':_0x49826d[_0x4b3f('0x28')],'type':_0x49826d[_0x4b3f('0x29')][_0x4b3f('0x2a')]};});_0x564194[_0x4b3f('0x2b')]=_[_0x4b3f('0x26')](_0x17763b,_0x4b3f('0x24'));_0x564194[_0x4b3f('0x2c')]=_[_0x4b3f('0x2d')](_0x5c1371[_0x4b3f('0x2c')]);_0x564194[_0x4b3f('0x2e')]=_['intersection'](_0x564194[_0x4b3f('0x2b')],_0x564194['query']);_0x1911bd[_0x4b3f('0x2f')]=_[_0x4b3f('0x30')](_0x564194['model'],qs[_0x4b3f('0x31')](_0x5c1371[_0x4b3f('0x2c')][_0x4b3f('0x31')]));_0x1911bd['attributes']=_0x1911bd[_0x4b3f('0x2f')][_0x4b3f('0x32')]?_0x1911bd[_0x4b3f('0x2f')]:_0x564194[_0x4b3f('0x2b')];if(!_0x5c1371[_0x4b3f('0x2c')][_0x4b3f('0x33')](_0x4b3f('0x34'))){_0x1911bd[_0x4b3f('0x1c')]=qs[_0x4b3f('0x1c')](_0x5c1371[_0x4b3f('0x2c')][_0x4b3f('0x1c')]);_0x1911bd[_0x4b3f('0x19')]=qs[_0x4b3f('0x19')](_0x5c1371[_0x4b3f('0x2c')][_0x4b3f('0x19')]);}_0x1911bd['order']=qs[_0x4b3f('0x35')](_0x5c1371[_0x4b3f('0x2c')][_0x4b3f('0x35')]);_0x1911bd[_0x4b3f('0x36')]=qs[_0x4b3f('0x2e')](_[_0x4b3f('0x37')](_0x5c1371[_0x4b3f('0x2c')],_0x564194['filters']),_0x17763b);if(_0x5c1371['query']['filter']){_0x1911bd[_0x4b3f('0x36')]=_[_0x4b3f('0x38')](_0x1911bd[_0x4b3f('0x36')],{'$or':_[_0x4b3f('0x26')](_0x17763b,function(_0x345634){if(_0x345634[_0x4b3f('0x29')]!==_0x4b3f('0x39')){var _0x546c09={};_0x546c09[_0x345634[_0x4b3f('0x24')]]={'$like':'%'+_0x5c1371[_0x4b3f('0x2c')]['filter']+'%'};return _0x546c09;}})});}_0x1911bd=_['merge']({},_0x1911bd,_0x5c1371['options']);var _0x9e31df={'where':_0x1911bd[_0x4b3f('0x36')]};return db['FreshsalesConfiguration'][_0x4b3f('0x1b')](_0x9e31df)[_0x4b3f('0x21')](function(_0x284e79){_0x19df6f[_0x4b3f('0x1b')]=_0x284e79;if(_0x5c1371[_0x4b3f('0x2c')][_0x4b3f('0x3a')]){_0x1911bd['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x4b3f('0x3b')](_0x1911bd);})[_0x4b3f('0x21')](function(_0x4eb0ef){_0x19df6f[_0x4b3f('0x3c')]=_0x4eb0ef;return _0x19df6f;})['then'](respondWithFilteredResult(_0x1df840,_0x1911bd))[_0x4b3f('0x3d')](handleError(_0x1df840,null));};exports[_0x4b3f('0x3e')]=function(_0x18d77a,_0x5744a6){var _0x1846f4={'raw':![],'where':{'id':_0x18d77a[_0x4b3f('0x3f')]['id']}},_0x4ac138={};_0x4ac138['model']=_[_0x4b3f('0x2d')](db[_0x4b3f('0x27')][_0x4b3f('0x40')]);_0x4ac138['query']=_[_0x4b3f('0x2d')](_0x18d77a[_0x4b3f('0x2c')]);_0x4ac138[_0x4b3f('0x2e')]=_[_0x4b3f('0x30')](_0x4ac138['model'],_0x4ac138[_0x4b3f('0x2c')]);_0x1846f4[_0x4b3f('0x2f')]=_[_0x4b3f('0x30')](_0x4ac138['model'],qs[_0x4b3f('0x31')](_0x18d77a['query']['fields']));_0x1846f4[_0x4b3f('0x2f')]=_0x1846f4[_0x4b3f('0x2f')][_0x4b3f('0x32')]?_0x1846f4['attributes']:_0x4ac138['model'];if(_0x18d77a[_0x4b3f('0x2c')][_0x4b3f('0x3a')]){_0x1846f4['include']=[{'all':!![]}];}_0x1846f4=_[_0x4b3f('0x38')]({},_0x1846f4,_0x18d77a['options']);return db[_0x4b3f('0x27')]['find'](_0x1846f4)[_0x4b3f('0x21')](handleEntityNotFound(_0x5744a6,null))[_0x4b3f('0x21')](respondWithResult(_0x5744a6,null))['catch'](handleError(_0x5744a6,null));};exports[_0x4b3f('0x41')]=function(_0x5a90da,_0x4b2eb0){return db[_0x4b3f('0x27')][_0x4b3f('0x41')](_0x5a90da['body'],{})['then'](respondWithResult(_0x4b2eb0,0xc9))[_0x4b3f('0x3d')](handleError(_0x4b2eb0,null));};exports[_0x4b3f('0x42')]=function(_0x6125ca,_0x2247bf){if(_0x6125ca['body']['id']){delete _0x6125ca[_0x4b3f('0x43')]['id'];}return db[_0x4b3f('0x27')][_0x4b3f('0x44')]({'where':{'id':_0x6125ca[_0x4b3f('0x3f')]['id']}})[_0x4b3f('0x21')](handleEntityNotFound(_0x2247bf,null))['then'](saveUpdates(_0x6125ca[_0x4b3f('0x43')],null))[_0x4b3f('0x21')](respondWithResult(_0x2247bf,null))[_0x4b3f('0x3d')](handleError(_0x2247bf,null));};exports['destroy']=function(_0x4745f1,_0x422de7){return db[_0x4b3f('0x27')][_0x4b3f('0x44')]({'where':{'id':_0x4745f1[_0x4b3f('0x3f')]['id']}})[_0x4b3f('0x21')](handleEntityNotFound(_0x422de7,null))[_0x4b3f('0x21')](removeEntity(_0x422de7,null))['catch'](handleError(_0x422de7,null));};exports['getSubjects']=function(_0x54ff3b,_0x23a613,_0x11294b){var _0x9d8834={};var _0x30fdd1={};var _0x2f8b19;var _0x22c80f;return db[_0x4b3f('0x27')]['findOne']({'where':{'id':_0x54ff3b['params']['id']}})[_0x4b3f('0x21')](handleEntityNotFound(_0x23a613,null))['then'](function(_0x2ab188){if(_0x2ab188){_0x2f8b19=_0x2ab188;_0x30fdd1[_0x4b3f('0x2b')]=_['keys'](db[_0x4b3f('0x45')][_0x4b3f('0x40')]);_0x30fdd1['query']=_[_0x4b3f('0x2d')](_0x54ff3b[_0x4b3f('0x2c')]);_0x30fdd1[_0x4b3f('0x2e')]=_[_0x4b3f('0x30')](_0x30fdd1[_0x4b3f('0x2b')],_0x30fdd1['query']);_0x9d8834[_0x4b3f('0x2f')]=_[_0x4b3f('0x30')](_0x30fdd1[_0x4b3f('0x2b')],qs[_0x4b3f('0x31')](_0x54ff3b['query'][_0x4b3f('0x31')]));_0x9d8834[_0x4b3f('0x2f')]=_0x9d8834[_0x4b3f('0x2f')][_0x4b3f('0x32')]?_0x9d8834['attributes']:_0x30fdd1[_0x4b3f('0x2b')];_0x9d8834[_0x4b3f('0x46')]=qs[_0x4b3f('0x35')](_0x54ff3b[_0x4b3f('0x2c')][_0x4b3f('0x35')]);_0x9d8834['where']=qs[_0x4b3f('0x2e')](_[_0x4b3f('0x37')](_0x54ff3b['query'],_0x30fdd1['filters']));if(_0x54ff3b[_0x4b3f('0x2c')][_0x4b3f('0x47')]){_0x9d8834[_0x4b3f('0x36')]=_[_0x4b3f('0x38')](_0x9d8834[_0x4b3f('0x36')],{'$or':_['map'](_0x9d8834['attributes'],function(_0x513c41){var _0x57781d={};_0x57781d[_0x513c41]={'$like':'%'+_0x54ff3b[_0x4b3f('0x2c')][_0x4b3f('0x47')]+'%'};return _0x57781d;})});}_0x9d8834=_[_0x4b3f('0x38')]({},_0x9d8834,_0x54ff3b['options']);return _0x2f8b19[_0x4b3f('0x48')](_0x9d8834);}})[_0x4b3f('0x21')](function(_0x40e869){if(_0x40e869){_0x22c80f=_0x40e869['length'];if(!_0x54ff3b[_0x4b3f('0x2c')][_0x4b3f('0x33')](_0x4b3f('0x34'))){_0x9d8834[_0x4b3f('0x1c')]=qs['limit'](_0x54ff3b[_0x4b3f('0x2c')][_0x4b3f('0x1c')]);_0x9d8834[_0x4b3f('0x19')]=qs[_0x4b3f('0x19')](_0x54ff3b[_0x4b3f('0x2c')]['offset']);}return _0x2f8b19[_0x4b3f('0x48')](_0x9d8834);}})[_0x4b3f('0x21')](function(_0x3550ae){if(_0x3550ae){return _0x3550ae?{'count':_0x22c80f,'rows':_0x3550ae}:null;}})[_0x4b3f('0x21')](respondWithResult(_0x23a613,null))['catch'](handleError(_0x23a613,null));};exports[_0x4b3f('0x49')]=function(_0x4298ab,_0x3e6d29,_0x3bfaf8){var _0x49a7b9={};var _0xa5ca29={};var _0x3130a7;var _0x42294d;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4298ab[_0x4b3f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3e6d29,null))[_0x4b3f('0x21')](function(_0x18e675){if(_0x18e675){_0x3130a7=_0x18e675;_0xa5ca29[_0x4b3f('0x2b')]=_[_0x4b3f('0x2d')](db[_0x4b3f('0x45')][_0x4b3f('0x40')]);_0xa5ca29['query']=_[_0x4b3f('0x2d')](_0x4298ab['query']);_0xa5ca29[_0x4b3f('0x2e')]=_[_0x4b3f('0x30')](_0xa5ca29[_0x4b3f('0x2b')],_0xa5ca29[_0x4b3f('0x2c')]);_0x49a7b9['attributes']=_[_0x4b3f('0x30')](_0xa5ca29[_0x4b3f('0x2b')],qs[_0x4b3f('0x31')](_0x4298ab[_0x4b3f('0x2c')][_0x4b3f('0x31')]));_0x49a7b9[_0x4b3f('0x2f')]=_0x49a7b9[_0x4b3f('0x2f')]['length']?_0x49a7b9[_0x4b3f('0x2f')]:_0xa5ca29['model'];_0x49a7b9['order']=qs[_0x4b3f('0x35')](_0x4298ab['query'][_0x4b3f('0x35')]);_0x49a7b9['where']=qs[_0x4b3f('0x2e')](_[_0x4b3f('0x37')](_0x4298ab[_0x4b3f('0x2c')],_0xa5ca29[_0x4b3f('0x2e')]));if(_0x4298ab[_0x4b3f('0x2c')][_0x4b3f('0x47')]){_0x49a7b9['where']=_[_0x4b3f('0x38')](_0x49a7b9['where'],{'$or':_[_0x4b3f('0x26')](_0x49a7b9['attributes'],function(_0x7abf2d){var _0x20c941={};_0x20c941[_0x7abf2d]={'$like':'%'+_0x4298ab[_0x4b3f('0x2c')]['filter']+'%'};return _0x20c941;})});}_0x49a7b9=_[_0x4b3f('0x38')]({},_0x49a7b9,_0x4298ab['options']);return _0x3130a7[_0x4b3f('0x49')](_0x49a7b9);}})[_0x4b3f('0x21')](function(_0x11dad9){if(_0x11dad9){_0x42294d=_0x11dad9[_0x4b3f('0x32')];if(!_0x4298ab[_0x4b3f('0x2c')][_0x4b3f('0x33')](_0x4b3f('0x34'))){_0x49a7b9[_0x4b3f('0x1c')]=qs[_0x4b3f('0x1c')](_0x4298ab[_0x4b3f('0x2c')]['limit']);_0x49a7b9['offset']=qs[_0x4b3f('0x19')](_0x4298ab[_0x4b3f('0x2c')][_0x4b3f('0x19')]);}return _0x3130a7[_0x4b3f('0x49')](_0x49a7b9);}})[_0x4b3f('0x21')](function(_0x4c85f6){if(_0x4c85f6){return _0x4c85f6?{'count':_0x42294d,'rows':_0x4c85f6}:null;}})['then'](respondWithResult(_0x3e6d29,null))[_0x4b3f('0x3d')](handleError(_0x3e6d29,null));};exports[_0x4b3f('0x4a')]=function(_0x41b673,_0x46a68b,_0x3ed44b){var _0x302fe0={};var _0x3eebb6={};var _0xf2d4c7;var _0x11fdf0;return db[_0x4b3f('0x27')][_0x4b3f('0x4b')]({'where':{'id':_0x41b673[_0x4b3f('0x3f')]['id']}})[_0x4b3f('0x21')](handleEntityNotFound(_0x46a68b,null))[_0x4b3f('0x21')](function(_0xcf37d){if(_0xcf37d){_0xf2d4c7=_0xcf37d;_0x3eebb6[_0x4b3f('0x2b')]=_[_0x4b3f('0x2d')](db['FreshsalesField']['rawAttributes']);_0x3eebb6[_0x4b3f('0x2c')]=_['keys'](_0x41b673[_0x4b3f('0x2c')]);_0x3eebb6[_0x4b3f('0x2e')]=_[_0x4b3f('0x30')](_0x3eebb6['model'],_0x3eebb6[_0x4b3f('0x2c')]);_0x302fe0[_0x4b3f('0x2f')]=_['intersection'](_0x3eebb6['model'],qs['fields'](_0x41b673[_0x4b3f('0x2c')][_0x4b3f('0x31')]));_0x302fe0['attributes']=_0x302fe0[_0x4b3f('0x2f')][_0x4b3f('0x32')]?_0x302fe0['attributes']:_0x3eebb6['model'];_0x302fe0[_0x4b3f('0x46')]=qs[_0x4b3f('0x35')](_0x41b673[_0x4b3f('0x2c')]['sort']);_0x302fe0[_0x4b3f('0x36')]=qs[_0x4b3f('0x2e')](_[_0x4b3f('0x37')](_0x41b673[_0x4b3f('0x2c')],_0x3eebb6['filters']));if(_0x41b673['query']['filter']){_0x302fe0[_0x4b3f('0x36')]=_[_0x4b3f('0x38')](_0x302fe0[_0x4b3f('0x36')],{'$or':_[_0x4b3f('0x26')](_0x302fe0['attributes'],function(_0x203542){var _0x334749={};_0x334749[_0x203542]={'$like':'%'+_0x41b673[_0x4b3f('0x2c')]['filter']+'%'};return _0x334749;})});}_0x302fe0=_[_0x4b3f('0x38')]({},_0x302fe0,_0x41b673[_0x4b3f('0x4c')]);return _0xf2d4c7[_0x4b3f('0x4a')](_0x302fe0);}})[_0x4b3f('0x21')](function(_0xafa25b){if(_0xafa25b){_0x11fdf0=_0xafa25b[_0x4b3f('0x32')];if(!_0x41b673['query'][_0x4b3f('0x33')](_0x4b3f('0x34'))){_0x302fe0['limit']=qs[_0x4b3f('0x1c')](_0x41b673[_0x4b3f('0x2c')][_0x4b3f('0x1c')]);_0x302fe0[_0x4b3f('0x19')]=qs['offset'](_0x41b673['query']['offset']);}return _0xf2d4c7[_0x4b3f('0x4a')](_0x302fe0);}})[_0x4b3f('0x21')](function(_0x5f438c){if(_0x5f438c){return _0x5f438c?{'count':_0x11fdf0,'rows':_0x5f438c}:null;}})['then'](respondWithResult(_0x46a68b,null))['catch'](handleError(_0x46a68b,null));}; \ No newline at end of file +var _0x7a8d=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','FreshsalesConfiguration','include','findAll','rows','catch','show','params','includeAll','create','body','find','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7a8d,0x185));var _0xd7a8=function(_0x41eac7,_0x825acf){_0x41eac7=_0x41eac7-0x0;var _0x27a606=_0x7a8d[_0x41eac7];return _0x27a606;};'use strict';var emlformat=require(_0xd7a8('0x0'));var rimraf=require(_0xd7a8('0x1'));var zipdir=require(_0xd7a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7a8('0x3'));var moment=require('moment');var BPromise=require(_0xd7a8('0x4'));var Mustache=require(_0xd7a8('0x5'));var util=require('util');var path=require(_0xd7a8('0x6'));var sox=require(_0xd7a8('0x7'));var csv=require(_0xd7a8('0x8'));var ejs=require(_0xd7a8('0x9'));var fs=require('fs');var fs_extra=require(_0xd7a8('0xa'));var _=require('lodash');var squel=require(_0xd7a8('0xb'));var crypto=require(_0xd7a8('0xc'));var jsforce=require(_0xd7a8('0xd'));var deskjs=require(_0xd7a8('0xe'));var toCsv=require(_0xd7a8('0x8'));var querystring=require(_0xd7a8('0xf'));var Papa=require(_0xd7a8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd7a8('0x11'));var as=require(_0xd7a8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7a8('0x13'))(_0xd7a8('0x14'));var utils=require('../../config/utils');var config=require(_0xd7a8('0x15'));var licenseUtil=require(_0xd7a8('0x16'));var db=require(_0xd7a8('0x17'))['db'];function respondWithStatusCode(_0x3e223b,_0x5ee930){_0x5ee930=_0x5ee930||0xcc;return function(_0x55b5af){if(_0x55b5af){return _0x3e223b['sendStatus'](_0x5ee930);}return _0x3e223b[_0xd7a8('0x18')](_0x5ee930)[_0xd7a8('0x19')]();};}function respondWithResult(_0x2a3da5,_0x1a726a){_0x1a726a=_0x1a726a||0xc8;return function(_0xeb3405){if(_0xeb3405){return _0x2a3da5['status'](_0x1a726a)[_0xd7a8('0x1a')](_0xeb3405);}};}function respondWithFilteredResult(_0x4bd8a4,_0x279f19){return function(_0x330cb9){if(_0x330cb9){var _0x2ce4c7=typeof _0x279f19[_0xd7a8('0x1b')]===_0xd7a8('0x1c')&&typeof _0x279f19[_0xd7a8('0x1d')]===_0xd7a8('0x1c');var _0x2548e6=_0x330cb9[_0xd7a8('0x1e')];var _0x299e92=_0x2ce4c7?0x0:_0x279f19[_0xd7a8('0x1b')];var _0x236032=_0x2ce4c7?_0x330cb9[_0xd7a8('0x1e')]:_0x279f19[_0xd7a8('0x1b')]+_0x279f19[_0xd7a8('0x1d')];var _0x259d44;if(_0x236032>=_0x2548e6){_0x236032=_0x2548e6;_0x259d44=0xc8;}else{_0x259d44=0xce;}_0x4bd8a4['status'](_0x259d44);return _0x4bd8a4[_0xd7a8('0x1f')](_0xd7a8('0x20'),_0x299e92+'-'+_0x236032+'/'+_0x2548e6)[_0xd7a8('0x1a')](_0x330cb9);}return null;};}function patchUpdates(_0x315364){return function(_0xef0bbd){try{jsonpatch[_0xd7a8('0x21')](_0xef0bbd,_0x315364,!![]);}catch(_0x379b36){return BPromise[_0xd7a8('0x22')](_0x379b36);}return _0xef0bbd['save']();};}function saveUpdates(_0x2f2dff,_0x11a093){return function(_0x32140a){if(_0x32140a){return _0x32140a[_0xd7a8('0x23')](_0x2f2dff)[_0xd7a8('0x24')](function(_0x2d8ec8){return _0x2d8ec8;});}return null;};}function removeEntity(_0xcfed4f,_0x2c8827){return function(_0x39c80f){if(_0x39c80f){return _0x39c80f[_0xd7a8('0x25')]()[_0xd7a8('0x24')](function(){_0xcfed4f[_0xd7a8('0x18')](0xcc)[_0xd7a8('0x19')]();});}};}function handleEntityNotFound(_0x2744ee,_0x1191d0){return function(_0x7116d3){if(!_0x7116d3){_0x2744ee[_0xd7a8('0x26')](0x194);}return _0x7116d3;};}function handleError(_0x277f7e,_0x31d79d){_0x31d79d=_0x31d79d||0x1f4;return function(_0x406e8e){logger[_0xd7a8('0x27')](_0x406e8e[_0xd7a8('0x28')]);if(_0x406e8e[_0xd7a8('0x29')]){delete _0x406e8e['name'];}_0x277f7e['status'](_0x31d79d)[_0xd7a8('0x2a')](_0x406e8e);};}exports[_0xd7a8('0x2b')]=function(_0x28831c,_0x2b5e5b){var _0xad1358={},_0x21109c={},_0xa145a9={'count':0x0,'rows':[]};var _0x40fedd=_[_0xd7a8('0x2c')](db['FreshsalesConfiguration'][_0xd7a8('0x2d')],function(_0x27e79f){return{'name':_0x27e79f['fieldName'],'type':_0x27e79f[_0xd7a8('0x2e')][_0xd7a8('0x2f')]};});_0x21109c[_0xd7a8('0x30')]=_[_0xd7a8('0x2c')](_0x40fedd,_0xd7a8('0x29'));_0x21109c['query']=_[_0xd7a8('0x31')](_0x28831c['query']);_0x21109c['filters']=_[_0xd7a8('0x32')](_0x21109c[_0xd7a8('0x30')],_0x21109c[_0xd7a8('0x33')]);_0xad1358[_0xd7a8('0x34')]=_[_0xd7a8('0x32')](_0x21109c[_0xd7a8('0x30')],qs[_0xd7a8('0x35')](_0x28831c[_0xd7a8('0x33')][_0xd7a8('0x35')]));_0xad1358[_0xd7a8('0x34')]=_0xad1358['attributes'][_0xd7a8('0x36')]?_0xad1358[_0xd7a8('0x34')]:_0x21109c['model'];if(!_0x28831c['query'][_0xd7a8('0x37')](_0xd7a8('0x38'))){_0xad1358['limit']=qs[_0xd7a8('0x1d')](_0x28831c[_0xd7a8('0x33')][_0xd7a8('0x1d')]);_0xad1358[_0xd7a8('0x1b')]=qs[_0xd7a8('0x1b')](_0x28831c[_0xd7a8('0x33')][_0xd7a8('0x1b')]);}_0xad1358[_0xd7a8('0x39')]=qs['sort'](_0x28831c[_0xd7a8('0x33')][_0xd7a8('0x3a')]);_0xad1358[_0xd7a8('0x3b')]=qs[_0xd7a8('0x3c')](_[_0xd7a8('0x3d')](_0x28831c[_0xd7a8('0x33')],_0x21109c[_0xd7a8('0x3c')]),_0x40fedd);if(_0x28831c[_0xd7a8('0x33')]['filter']){_0xad1358['where']=_[_0xd7a8('0x3e')](_0xad1358['where'],{'$or':_[_0xd7a8('0x2c')](_0x40fedd,function(_0x39ceb1){if(_0x39ceb1[_0xd7a8('0x2e')]!==_0xd7a8('0x3f')){var _0x3a0843={};_0x3a0843[_0x39ceb1['name']]={'$like':'%'+_0x28831c[_0xd7a8('0x33')][_0xd7a8('0x40')]+'%'};return _0x3a0843;}})});}_0xad1358=_[_0xd7a8('0x3e')]({},_0xad1358,_0x28831c[_0xd7a8('0x41')]);var _0x3a26c={'where':_0xad1358['where']};return db[_0xd7a8('0x42')][_0xd7a8('0x1e')](_0x3a26c)[_0xd7a8('0x24')](function(_0x1128ad){_0xa145a9[_0xd7a8('0x1e')]=_0x1128ad;if(_0x28831c[_0xd7a8('0x33')]['includeAll']){_0xad1358[_0xd7a8('0x43')]=[{'all':!![]}];}return db[_0xd7a8('0x42')][_0xd7a8('0x44')](_0xad1358);})[_0xd7a8('0x24')](function(_0x263b6e){_0xa145a9[_0xd7a8('0x45')]=_0x263b6e;return _0xa145a9;})[_0xd7a8('0x24')](respondWithFilteredResult(_0x2b5e5b,_0xad1358))[_0xd7a8('0x46')](handleError(_0x2b5e5b,null));};exports[_0xd7a8('0x47')]=function(_0x2ab73d,_0x1fb82c){var _0x945292={'raw':![],'where':{'id':_0x2ab73d[_0xd7a8('0x48')]['id']}},_0x22272f={};_0x22272f[_0xd7a8('0x30')]=_['keys'](db[_0xd7a8('0x42')][_0xd7a8('0x2d')]);_0x22272f['query']=_[_0xd7a8('0x31')](_0x2ab73d[_0xd7a8('0x33')]);_0x22272f[_0xd7a8('0x3c')]=_[_0xd7a8('0x32')](_0x22272f[_0xd7a8('0x30')],_0x22272f[_0xd7a8('0x33')]);_0x945292['attributes']=_[_0xd7a8('0x32')](_0x22272f[_0xd7a8('0x30')],qs[_0xd7a8('0x35')](_0x2ab73d[_0xd7a8('0x33')][_0xd7a8('0x35')]));_0x945292[_0xd7a8('0x34')]=_0x945292[_0xd7a8('0x34')][_0xd7a8('0x36')]?_0x945292[_0xd7a8('0x34')]:_0x22272f['model'];if(_0x2ab73d['query'][_0xd7a8('0x49')]){_0x945292['include']=[{'all':!![]}];}_0x945292=_[_0xd7a8('0x3e')]({},_0x945292,_0x2ab73d[_0xd7a8('0x41')]);return db[_0xd7a8('0x42')]['find'](_0x945292)[_0xd7a8('0x24')](handleEntityNotFound(_0x1fb82c,null))['then'](respondWithResult(_0x1fb82c,null))[_0xd7a8('0x46')](handleError(_0x1fb82c,null));};exports['create']=function(_0x470b02,_0x46898f){return db['FreshsalesConfiguration'][_0xd7a8('0x4a')](_0x470b02['body'],{})['then'](respondWithResult(_0x46898f,0xc9))[_0xd7a8('0x46')](handleError(_0x46898f,null));};exports[_0xd7a8('0x23')]=function(_0x3daffc,_0x3812f9){if(_0x3daffc[_0xd7a8('0x4b')]['id']){delete _0x3daffc['body']['id'];}return db[_0xd7a8('0x42')][_0xd7a8('0x4c')]({'where':{'id':_0x3daffc[_0xd7a8('0x48')]['id']}})[_0xd7a8('0x24')](handleEntityNotFound(_0x3812f9,null))[_0xd7a8('0x24')](saveUpdates(_0x3daffc[_0xd7a8('0x4b')],null))[_0xd7a8('0x24')](respondWithResult(_0x3812f9,null))['catch'](handleError(_0x3812f9,null));};exports[_0xd7a8('0x25')]=function(_0x5de325,_0x57e2c2){return db[_0xd7a8('0x42')]['find']({'where':{'id':_0x5de325[_0xd7a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x57e2c2,null))['then'](removeEntity(_0x57e2c2,null))[_0xd7a8('0x46')](handleError(_0x57e2c2,null));};exports['getSubjects']=function(_0x185ec7,_0x525b91,_0x1e7b3c){var _0x17eccf={};var _0x4133ab={};var _0x5c91b2;var _0x51f26b;return db[_0xd7a8('0x42')][_0xd7a8('0x4d')]({'where':{'id':_0x185ec7[_0xd7a8('0x48')]['id']}})[_0xd7a8('0x24')](handleEntityNotFound(_0x525b91,null))[_0xd7a8('0x24')](function(_0x458267){if(_0x458267){_0x5c91b2=_0x458267;_0x4133ab[_0xd7a8('0x30')]=_['keys'](db[_0xd7a8('0x4e')]['rawAttributes']);_0x4133ab[_0xd7a8('0x33')]=_['keys'](_0x185ec7[_0xd7a8('0x33')]);_0x4133ab[_0xd7a8('0x3c')]=_[_0xd7a8('0x32')](_0x4133ab[_0xd7a8('0x30')],_0x4133ab[_0xd7a8('0x33')]);_0x17eccf[_0xd7a8('0x34')]=_[_0xd7a8('0x32')](_0x4133ab['model'],qs[_0xd7a8('0x35')](_0x185ec7[_0xd7a8('0x33')][_0xd7a8('0x35')]));_0x17eccf[_0xd7a8('0x34')]=_0x17eccf['attributes'][_0xd7a8('0x36')]?_0x17eccf[_0xd7a8('0x34')]:_0x4133ab[_0xd7a8('0x30')];_0x17eccf['order']=qs['sort'](_0x185ec7[_0xd7a8('0x33')][_0xd7a8('0x3a')]);_0x17eccf['where']=qs[_0xd7a8('0x3c')](_[_0xd7a8('0x3d')](_0x185ec7['query'],_0x4133ab[_0xd7a8('0x3c')]));if(_0x185ec7['query'][_0xd7a8('0x40')]){_0x17eccf[_0xd7a8('0x3b')]=_['merge'](_0x17eccf[_0xd7a8('0x3b')],{'$or':_['map'](_0x17eccf['attributes'],function(_0x3a4b6e){var _0x547117={};_0x547117[_0x3a4b6e]={'$like':'%'+_0x185ec7[_0xd7a8('0x33')][_0xd7a8('0x40')]+'%'};return _0x547117;})});}_0x17eccf=_[_0xd7a8('0x3e')]({},_0x17eccf,_0x185ec7[_0xd7a8('0x41')]);return _0x5c91b2[_0xd7a8('0x4f')](_0x17eccf);}})['then'](function(_0x180022){if(_0x180022){_0x51f26b=_0x180022[_0xd7a8('0x36')];if(!_0x185ec7['query']['hasOwnProperty'](_0xd7a8('0x38'))){_0x17eccf[_0xd7a8('0x1d')]=qs[_0xd7a8('0x1d')](_0x185ec7[_0xd7a8('0x33')][_0xd7a8('0x1d')]);_0x17eccf['offset']=qs[_0xd7a8('0x1b')](_0x185ec7[_0xd7a8('0x33')][_0xd7a8('0x1b')]);}return _0x5c91b2[_0xd7a8('0x4f')](_0x17eccf);}})[_0xd7a8('0x24')](function(_0x8453e7){if(_0x8453e7){return _0x8453e7?{'count':_0x51f26b,'rows':_0x8453e7}:null;}})[_0xd7a8('0x24')](respondWithResult(_0x525b91,null))[_0xd7a8('0x46')](handleError(_0x525b91,null));};exports[_0xd7a8('0x50')]=function(_0xc548d0,_0x98ba86,_0x32ac56){var _0x50b548={};var _0xe919e2={};var _0x14d8a4;var _0x17b976;return db[_0xd7a8('0x42')][_0xd7a8('0x4d')]({'where':{'id':_0xc548d0['params']['id']}})[_0xd7a8('0x24')](handleEntityNotFound(_0x98ba86,null))[_0xd7a8('0x24')](function(_0x262b56){if(_0x262b56){_0x14d8a4=_0x262b56;_0xe919e2[_0xd7a8('0x30')]=_['keys'](db[_0xd7a8('0x4e')][_0xd7a8('0x2d')]);_0xe919e2[_0xd7a8('0x33')]=_[_0xd7a8('0x31')](_0xc548d0[_0xd7a8('0x33')]);_0xe919e2[_0xd7a8('0x3c')]=_[_0xd7a8('0x32')](_0xe919e2[_0xd7a8('0x30')],_0xe919e2['query']);_0x50b548['attributes']=_[_0xd7a8('0x32')](_0xe919e2['model'],qs[_0xd7a8('0x35')](_0xc548d0['query'][_0xd7a8('0x35')]));_0x50b548[_0xd7a8('0x34')]=_0x50b548[_0xd7a8('0x34')][_0xd7a8('0x36')]?_0x50b548['attributes']:_0xe919e2[_0xd7a8('0x30')];_0x50b548['order']=qs[_0xd7a8('0x3a')](_0xc548d0[_0xd7a8('0x33')][_0xd7a8('0x3a')]);_0x50b548[_0xd7a8('0x3b')]=qs[_0xd7a8('0x3c')](_[_0xd7a8('0x3d')](_0xc548d0[_0xd7a8('0x33')],_0xe919e2[_0xd7a8('0x3c')]));if(_0xc548d0[_0xd7a8('0x33')][_0xd7a8('0x40')]){_0x50b548[_0xd7a8('0x3b')]=_[_0xd7a8('0x3e')](_0x50b548[_0xd7a8('0x3b')],{'$or':_[_0xd7a8('0x2c')](_0x50b548[_0xd7a8('0x34')],function(_0x31a82b){var _0x33dd88={};_0x33dd88[_0x31a82b]={'$like':'%'+_0xc548d0[_0xd7a8('0x33')][_0xd7a8('0x40')]+'%'};return _0x33dd88;})});}_0x50b548=_[_0xd7a8('0x3e')]({},_0x50b548,_0xc548d0['options']);return _0x14d8a4[_0xd7a8('0x50')](_0x50b548);}})[_0xd7a8('0x24')](function(_0x2b47cb){if(_0x2b47cb){_0x17b976=_0x2b47cb[_0xd7a8('0x36')];if(!_0xc548d0['query'][_0xd7a8('0x37')](_0xd7a8('0x38'))){_0x50b548[_0xd7a8('0x1d')]=qs[_0xd7a8('0x1d')](_0xc548d0[_0xd7a8('0x33')][_0xd7a8('0x1d')]);_0x50b548['offset']=qs['offset'](_0xc548d0[_0xd7a8('0x33')][_0xd7a8('0x1b')]);}return _0x14d8a4[_0xd7a8('0x50')](_0x50b548);}})[_0xd7a8('0x24')](function(_0x33812e){if(_0x33812e){return _0x33812e?{'count':_0x17b976,'rows':_0x33812e}:null;}})[_0xd7a8('0x24')](respondWithResult(_0x98ba86,null))[_0xd7a8('0x46')](handleError(_0x98ba86,null));};exports[_0xd7a8('0x51')]=function(_0xfe8863,_0x60f0e2,_0x5017ce){var _0x4b83a5={};var _0x541c0f={};var _0x4bf10c;var _0x1212a6;return db[_0xd7a8('0x42')][_0xd7a8('0x4d')]({'where':{'id':_0xfe8863[_0xd7a8('0x48')]['id']}})[_0xd7a8('0x24')](handleEntityNotFound(_0x60f0e2,null))[_0xd7a8('0x24')](function(_0x26bf0e){if(_0x26bf0e){_0x4bf10c=_0x26bf0e;_0x541c0f[_0xd7a8('0x30')]=_[_0xd7a8('0x31')](db[_0xd7a8('0x4e')][_0xd7a8('0x2d')]);_0x541c0f[_0xd7a8('0x33')]=_[_0xd7a8('0x31')](_0xfe8863['query']);_0x541c0f[_0xd7a8('0x3c')]=_['intersection'](_0x541c0f[_0xd7a8('0x30')],_0x541c0f['query']);_0x4b83a5['attributes']=_[_0xd7a8('0x32')](_0x541c0f[_0xd7a8('0x30')],qs['fields'](_0xfe8863['query'][_0xd7a8('0x35')]));_0x4b83a5[_0xd7a8('0x34')]=_0x4b83a5['attributes'][_0xd7a8('0x36')]?_0x4b83a5['attributes']:_0x541c0f['model'];_0x4b83a5[_0xd7a8('0x39')]=qs[_0xd7a8('0x3a')](_0xfe8863['query'][_0xd7a8('0x3a')]);_0x4b83a5[_0xd7a8('0x3b')]=qs[_0xd7a8('0x3c')](_['pick'](_0xfe8863['query'],_0x541c0f['filters']));if(_0xfe8863[_0xd7a8('0x33')][_0xd7a8('0x40')]){_0x4b83a5[_0xd7a8('0x3b')]=_[_0xd7a8('0x3e')](_0x4b83a5['where'],{'$or':_[_0xd7a8('0x2c')](_0x4b83a5[_0xd7a8('0x34')],function(_0x514615){var _0x351c21={};_0x351c21[_0x514615]={'$like':'%'+_0xfe8863[_0xd7a8('0x33')][_0xd7a8('0x40')]+'%'};return _0x351c21;})});}_0x4b83a5=_[_0xd7a8('0x3e')]({},_0x4b83a5,_0xfe8863[_0xd7a8('0x41')]);return _0x4bf10c['getFields'](_0x4b83a5);}})[_0xd7a8('0x24')](function(_0x34d198){if(_0x34d198){_0x1212a6=_0x34d198[_0xd7a8('0x36')];if(!_0xfe8863['query'][_0xd7a8('0x37')](_0xd7a8('0x38'))){_0x4b83a5[_0xd7a8('0x1d')]=qs[_0xd7a8('0x1d')](_0xfe8863['query'][_0xd7a8('0x1d')]);_0x4b83a5[_0xd7a8('0x1b')]=qs[_0xd7a8('0x1b')](_0xfe8863['query'][_0xd7a8('0x1b')]);}return _0x4bf10c['getFields'](_0x4b83a5);}})[_0xd7a8('0x24')](function(_0x2b9e66){if(_0x2b9e66){return _0x2b9e66?{'count':_0x1212a6,'rows':_0x2b9e66}:null;}})[_0xd7a8('0x24')](respondWithResult(_0x60f0e2,null))[_0xd7a8('0x46')](handleError(_0x60f0e2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 3affbaa..d6ad82e 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 _0x4d90=['define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x4d90,0x136));var _0x04d9=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x4d90[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x04d9('0x0'));var util=require(_0x04d9('0x1'));var logger=require(_0x04d9('0x2'))(_0x04d9('0x3'));var moment=require(_0x04d9('0x4'));var BPromise=require(_0x04d9('0x5'));var rp=require(_0x04d9('0x6'));var fs=require('fs');var path=require(_0x04d9('0x7'));var rimraf=require(_0x04d9('0x8'));var config=require(_0x04d9('0x9'));var attributes=require(_0x04d9('0xa'));module[_0x04d9('0xb')]=function(_0x4c20dc,_0x582c28){return _0x4c20dc[_0x04d9('0xc')](_0x04d9('0xd'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb111=['api','bluebird','request-promise','path','exports','define','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x302f55,_0x31872f){var _0x55ca94=function(_0x477ac3){while(--_0x477ac3){_0x302f55['push'](_0x302f55['shift']());}};_0x55ca94(++_0x31872f);}(_0xb111,0x1bf));var _0x1b11=function(_0x2506ac,_0xf002b5){_0x2506ac=_0x2506ac-0x0;var _0xa99340=_0xb111[_0x2506ac];return _0xa99340;};'use strict';var _=require(_0x1b11('0x0'));var util=require(_0x1b11('0x1'));var logger=require(_0x1b11('0x2'))(_0x1b11('0x3'));var moment=require('moment');var BPromise=require(_0x1b11('0x4'));var rp=require(_0x1b11('0x5'));var fs=require('fs');var path=require(_0x1b11('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x1b11('0x7')]=function(_0x2021b5,_0xd5789f){return _0x2021b5[_0x1b11('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x1b11('0x9'),'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 21a89e1..e57dfe2 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 _0x1b13=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message','info'];(function(_0x2dc99f,_0x5cbdf1){var _0xe5524b=function(_0x1df012){while(--_0x1df012){_0x2dc99f['push'](_0x2dc99f['shift']());}};_0xe5524b(++_0x5cbdf1);}(_0x1b13,0x152));var _0x31b1=function(_0xa3bd02,_0x198b5f){_0xa3bd02=_0xa3bd02-0x0;var _0x2cc55=_0x1b13[_0xa3bd02];return _0x2cc55;};'use strict';var _=require('lodash');var util=require(_0x31b1('0x0'));var moment=require('moment');var BPromise=require(_0x31b1('0x1'));var rs=require(_0x31b1('0x2'));var fs=require('fs');var Redis=require(_0x31b1('0x3'));var db=require(_0x31b1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31b1('0x5'))(_0x31b1('0x6'));var config=require(_0x31b1('0x7'));var jayson=require(_0x31b1('0x8'));var client=jayson['client'][_0x31b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x784511,_0x143756,_0x590b5d){return new BPromise(function(_0x2ce56f,_0x2f6184){return client[_0x31b1('0xa')](_0x784511,_0x590b5d)['then'](function(_0x4e456d){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x143756,_0x31b1('0xb'));logger[_0x31b1('0xc')](_0x31b1('0xd'),_0x143756,_0x31b1('0xb'),JSON[_0x31b1('0xe')](_0x4e456d));if(_0x4e456d[_0x31b1('0xf')]){if(_0x4e456d['error']['code']===0x1f4){logger['error'](_0x31b1('0x10'),_0x143756,_0x4e456d[_0x31b1('0xf')][_0x31b1('0x11')]);return _0x2f6184(_0x4e456d[_0x31b1('0xf')]['message']);}logger[_0x31b1('0xf')](_0x31b1('0x10'),_0x143756,_0x4e456d[_0x31b1('0xf')][_0x31b1('0x11')]);return _0x2ce56f(_0x4e456d['error'][_0x31b1('0x11')]);}else{logger[_0x31b1('0x12')](_0x31b1('0x10'),_0x143756,_0x31b1('0xb'));_0x2ce56f(_0x4e456d[_0x31b1('0x13')][_0x31b1('0x11')]);}})[_0x31b1('0x14')](function(_0x3e823d){logger['error'](_0x31b1('0x10'),_0x143756,_0x3e823d);_0x2f6184(_0x3e823d);});});} \ No newline at end of file +var _0xeb7c=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c2501,_0x3cc108){var _0x52ac41=function(_0x6d60a8){while(--_0x6d60a8){_0x3c2501['push'](_0x3c2501['shift']());}};_0x52ac41(++_0x3cc108);}(_0xeb7c,0x101));var _0xceb7=function(_0x1c61c0,_0x2085e8){_0x1c61c0=_0x1c61c0-0x0;var _0x43ca03=_0xeb7c[_0x1c61c0];return _0x43ca03;};'use strict';var _=require(_0xceb7('0x0'));var util=require(_0xceb7('0x1'));var moment=require(_0xceb7('0x2'));var BPromise=require(_0xceb7('0x3'));var rs=require(_0xceb7('0x4'));var fs=require('fs');var Redis=require(_0xceb7('0x5'));var db=require(_0xceb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xceb7('0x7'))(_0xceb7('0x8'));var config=require('../../config/environment');var jayson=require(_0xceb7('0x9'));var client=jayson['client'][_0xceb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x285b57,_0x38c7e1,_0x2da802){return new BPromise(function(_0x188e12,_0x33b039){return client['request'](_0x285b57,_0x2da802)[_0xceb7('0xb')](function(_0x4f2fd6){logger[_0xceb7('0xc')](_0xceb7('0xd'),_0x38c7e1,_0xceb7('0xe'));logger[_0xceb7('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x38c7e1,_0xceb7('0xe'),JSON['stringify'](_0x4f2fd6));if(_0x4f2fd6['error']){if(_0x4f2fd6[_0xceb7('0x10')][_0xceb7('0x11')]===0x1f4){logger[_0xceb7('0x10')](_0xceb7('0xd'),_0x38c7e1,_0x4f2fd6[_0xceb7('0x10')][_0xceb7('0x12')]);return _0x33b039(_0x4f2fd6[_0xceb7('0x10')]['message']);}logger['error'](_0xceb7('0xd'),_0x38c7e1,_0x4f2fd6[_0xceb7('0x10')][_0xceb7('0x12')]);return _0x188e12(_0x4f2fd6['error'][_0xceb7('0x12')]);}else{logger[_0xceb7('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x38c7e1,_0xceb7('0xe'));_0x188e12(_0x4f2fd6[_0xceb7('0x13')][_0xceb7('0x12')]);}})[_0xceb7('0x14')](function(_0x15dd50){logger[_0xceb7('0x10')](_0xceb7('0xd'),_0x38c7e1,_0x15dd50);_0x33b039(_0x15dd50);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b2ff972..1202517 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 _0x32ef=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','delete'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0x32ef,0xf9));var _0xf32e=function(_0x3ae1ba,_0x5ca779){_0x3ae1ba=_0x3ae1ba-0x0;var _0x2c4fd0=_0x32ef[_0x3ae1ba];return _0x2c4fd0;};'use strict';var multer=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var path=require(_0xf32e('0x2'));var timeout=require(_0xf32e('0x3'));var express=require(_0xf32e('0x4'));var router=express[_0xf32e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf32e('0x6'));var interaction=require(_0xf32e('0x7'));var config=require('../../config/environment');var controller=require(_0xf32e('0x8'));router[_0xf32e('0x9')]('/',auth[_0xf32e('0xa')](),controller[_0xf32e('0xb')]);router[_0xf32e('0x9')](_0xf32e('0xc'),auth['isAuthenticated'](),controller[_0xf32e('0xd')]);router['post']('/',auth[_0xf32e('0xa')](),controller[_0xf32e('0xe')]);router[_0xf32e('0xf')](_0xf32e('0xc'),auth[_0xf32e('0xa')](),controller['update']);router[_0xf32e('0x10')](_0xf32e('0xc'),auth[_0xf32e('0xa')](),controller[_0xf32e('0x11')]);module[_0xf32e('0x12')]=router; \ No newline at end of file +var _0x0eec=['get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x426076,_0xfdf5d2){var _0x1e9565=function(_0x38832a){while(--_0x38832a){_0x426076['push'](_0x426076['shift']());}};_0x1e9565(++_0xfdf5d2);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc0ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc0ee('0x1'));var express=require(_0xc0ee('0x2'));var router=express[_0xc0ee('0x3')]();var fs_extra=require(_0xc0ee('0x4'));var auth=require(_0xc0ee('0x5'));var interaction=require(_0xc0ee('0x6'));var config=require(_0xc0ee('0x7'));var controller=require('./intFreshsalesField.controller');router[_0xc0ee('0x8')]('/',auth['isAuthenticated'](),controller[_0xc0ee('0x9')]);router[_0xc0ee('0x8')](_0xc0ee('0xa'),auth[_0xc0ee('0xb')](),controller[_0xc0ee('0xc')]);router[_0xc0ee('0xd')]('/',auth[_0xc0ee('0xb')](),controller['create']);router[_0xc0ee('0xe')](_0xc0ee('0xa'),auth[_0xc0ee('0xb')](),controller[_0xc0ee('0xf')]);router[_0xc0ee('0x10')](_0xc0ee('0xa'),auth[_0xc0ee('0xb')](),controller['destroy']);module[_0xc0ee('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 4c169f4..e558e5e 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 _0x2c4b=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x216008,_0x2d1023){var _0x4d384f=function(_0x3fd7e2){while(--_0x3fd7e2){_0x216008['push'](_0x216008['shift']());}};_0x4d384f(++_0x2d1023);}(_0x2c4b,0x6a));var _0xb2c4=function(_0x4bcf49,_0x422ef0){_0x4bcf49=_0x4bcf49-0x0;var _0x3a523e=_0x2c4b[_0x4bcf49];return _0x3a523e;};'use strict';var Sequelize=require(_0xb2c4('0x0'));module[_0xb2c4('0x1')]={'type':{'type':Sequelize[_0xb2c4('0x2')](_0xb2c4('0x3'),_0xb2c4('0x4'),_0xb2c4('0x5'),_0xb2c4('0x6'),_0xb2c4('0x7')),'defaultValue':_0xb2c4('0x3')},'content':{'type':Sequelize[_0xb2c4('0x8')]},'key':{'type':Sequelize[_0xb2c4('0x8')]},'keyType':{'type':Sequelize[_0xb2c4('0x2')](_0xb2c4('0x3'),_0xb2c4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb2c4('0x8')]},'idField':{'type':Sequelize[_0xb2c4('0x8')]},'nameField':{'type':Sequelize[_0xb2c4('0x8')]},'customField':{'type':Sequelize[_0xb2c4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb2c4('0x8')]}}; \ No newline at end of file +var _0x05a3=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x1f5249,_0x5c4c86){var _0x20e223=function(_0x15eb45){while(--_0x15eb45){_0x1f5249['push'](_0x1f5249['shift']());}};_0x20e223(++_0x5c4c86);}(_0x05a3,0x17f));var _0x305a=function(_0x4d29a3,_0x4162fb){_0x4d29a3=_0x4d29a3-0x0;var _0x565bcf=_0x05a3[_0x4d29a3];return _0x565bcf;};'use strict';var Sequelize=require(_0x305a('0x0'));module['exports']={'type':{'type':Sequelize[_0x305a('0x1')](_0x305a('0x2'),_0x305a('0x3'),_0x305a('0x4'),_0x305a('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x305a('0x6')]},'key':{'type':Sequelize[_0x305a('0x6')]},'keyType':{'type':Sequelize[_0x305a('0x1')](_0x305a('0x2'),_0x305a('0x3'),_0x305a('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x305a('0x6')]},'nameField':{'type':Sequelize[_0x305a('0x6')]},'customField':{'type':Sequelize[_0x305a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 94f153f..7c1553c 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 _0x14ae=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','set','apply','save','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','catch','create','update','body','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/license/hardware','api'];(function(_0x40ba7c,_0x3622f5){var _0x59b6b6=function(_0x3bd990){while(--_0x3bd990){_0x40ba7c['push'](_0x40ba7c['shift']());}};_0x59b6b6(++_0x3622f5);}(_0x14ae,0x1e9));var _0xe14a=function(_0x4918d0,_0x443259){_0x4918d0=_0x4918d0-0x0;var _0xe52b64=_0x14ae[_0x4918d0];return _0xe52b64;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe14a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe14a('0x1'));var moment=require(_0xe14a('0x2'));var BPromise=require(_0xe14a('0x3'));var Mustache=require(_0xe14a('0x4'));var util=require(_0xe14a('0x5'));var path=require(_0xe14a('0x6'));var sox=require(_0xe14a('0x7'));var csv=require(_0xe14a('0x8'));var ejs=require(_0xe14a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe14a('0xa'));var squel=require(_0xe14a('0xb'));var crypto=require(_0xe14a('0xc'));var jsforce=require(_0xe14a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe14a('0x8'));var querystring=require(_0xe14a('0xe'));var Papa=require(_0xe14a('0xf'));var Redis=require(_0xe14a('0x10'));var authService=require(_0xe14a('0x11'));var qs=require(_0xe14a('0x12'));var as=require(_0xe14a('0x13'));var hardwareService=require(_0xe14a('0x14'));var logger=require('../../config/logger')(_0xe14a('0x15'));var utils=require(_0xe14a('0x16'));var config=require(_0xe14a('0x17'));var licenseUtil=require(_0xe14a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x203b25,_0xad1ec7){_0xad1ec7=_0xad1ec7||0xcc;return function(_0xcda4d3){if(_0xcda4d3){return _0x203b25[_0xe14a('0x19')](_0xad1ec7);}return _0x203b25[_0xe14a('0x1a')](_0xad1ec7)[_0xe14a('0x1b')]();};}function respondWithResult(_0x294b1e,_0x18c904){_0x18c904=_0x18c904||0xc8;return function(_0x43af54){if(_0x43af54){return _0x294b1e[_0xe14a('0x1a')](_0x18c904)['json'](_0x43af54);}};}function respondWithFilteredResult(_0x3e7036,_0x9f05af){return function(_0x215929){if(_0x215929){var _0x335974=typeof _0x9f05af['offset']===_0xe14a('0x1c')&&typeof _0x9f05af[_0xe14a('0x1d')]===_0xe14a('0x1c');var _0xfef0b9=_0x215929['count'];var _0x505b63=_0x335974?0x0:_0x9f05af[_0xe14a('0x1e')];var _0x40ae94=_0x335974?_0x215929[_0xe14a('0x1f')]:_0x9f05af['offset']+_0x9f05af[_0xe14a('0x1d')];var _0x25da3f;if(_0x40ae94>=_0xfef0b9){_0x40ae94=_0xfef0b9;_0x25da3f=0xc8;}else{_0x25da3f=0xce;}_0x3e7036[_0xe14a('0x1a')](_0x25da3f);return _0x3e7036[_0xe14a('0x20')]('Content-Range',_0x505b63+'-'+_0x40ae94+'/'+_0xfef0b9)['json'](_0x215929);}return null;};}function patchUpdates(_0x52de8e){return function(_0x19411b){try{jsonpatch[_0xe14a('0x21')](_0x19411b,_0x52de8e,!![]);}catch(_0x8a4a36){return BPromise['reject'](_0x8a4a36);}return _0x19411b[_0xe14a('0x22')]();};}function saveUpdates(_0x340d06,_0x2db5ae){return function(_0x4192fc){if(_0x4192fc){return _0x4192fc['update'](_0x340d06)[_0xe14a('0x23')](function(_0x5df8c3){return _0x5df8c3;});}return null;};}function removeEntity(_0x2d6434,_0x4a325e){return function(_0x42d865){if(_0x42d865){return _0x42d865[_0xe14a('0x24')]()[_0xe14a('0x23')](function(){_0x2d6434['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x368eb3,_0x26c823){return function(_0x3b0039){if(!_0x3b0039){_0x368eb3[_0xe14a('0x19')](0x194);}return _0x3b0039;};}function handleError(_0xde29f0,_0x2028ea){_0x2028ea=_0x2028ea||0x1f4;return function(_0xdb354b){logger[_0xe14a('0x25')](_0xdb354b[_0xe14a('0x26')]);if(_0xdb354b['name']){delete _0xdb354b[_0xe14a('0x27')];}_0xde29f0[_0xe14a('0x1a')](_0x2028ea)[_0xe14a('0x28')](_0xdb354b);};}exports[_0xe14a('0x29')]=function(_0x44c77f,_0x599dbf){var _0x12d735={},_0x53c103={},_0xb633db={'count':0x0,'rows':[]};var _0x1aad7c=_[_0xe14a('0x2a')](db[_0xe14a('0x2b')][_0xe14a('0x2c')],function(_0x2c5dfe){return{'name':_0x2c5dfe['fieldName'],'type':_0x2c5dfe[_0xe14a('0x2d')]['key']};});_0x53c103[_0xe14a('0x2e')]=_['map'](_0x1aad7c,_0xe14a('0x27'));_0x53c103[_0xe14a('0x2f')]=_[_0xe14a('0x30')](_0x44c77f[_0xe14a('0x2f')]);_0x53c103['filters']=_[_0xe14a('0x31')](_0x53c103[_0xe14a('0x2e')],_0x53c103[_0xe14a('0x2f')]);_0x12d735[_0xe14a('0x32')]=_['intersection'](_0x53c103[_0xe14a('0x2e')],qs[_0xe14a('0x33')](_0x44c77f['query'][_0xe14a('0x33')]));_0x12d735['attributes']=_0x12d735['attributes'][_0xe14a('0x34')]?_0x12d735['attributes']:_0x53c103[_0xe14a('0x2e')];if(!_0x44c77f[_0xe14a('0x2f')][_0xe14a('0x35')](_0xe14a('0x36'))){_0x12d735[_0xe14a('0x1d')]=qs[_0xe14a('0x1d')](_0x44c77f['query'][_0xe14a('0x1d')]);_0x12d735[_0xe14a('0x1e')]=qs[_0xe14a('0x1e')](_0x44c77f[_0xe14a('0x2f')][_0xe14a('0x1e')]);}_0x12d735['order']=qs[_0xe14a('0x37')](_0x44c77f['query'][_0xe14a('0x37')]);_0x12d735[_0xe14a('0x38')]=qs[_0xe14a('0x39')](_[_0xe14a('0x3a')](_0x44c77f[_0xe14a('0x2f')],_0x53c103[_0xe14a('0x39')]),_0x1aad7c);if(_0x44c77f[_0xe14a('0x2f')][_0xe14a('0x3b')]){_0x12d735['where']=_[_0xe14a('0x3c')](_0x12d735[_0xe14a('0x38')],{'$or':_[_0xe14a('0x2a')](_0x1aad7c,function(_0x5929fb){if(_0x5929fb[_0xe14a('0x2d')]!==_0xe14a('0x3d')){var _0x4885eb={};_0x4885eb[_0x5929fb[_0xe14a('0x27')]]={'$like':'%'+_0x44c77f[_0xe14a('0x2f')][_0xe14a('0x3b')]+'%'};return _0x4885eb;}})});}_0x12d735=_['merge']({},_0x12d735,_0x44c77f[_0xe14a('0x3e')]);var _0x2a6665={'where':_0x12d735[_0xe14a('0x38')]};return db[_0xe14a('0x2b')][_0xe14a('0x1f')](_0x2a6665)[_0xe14a('0x23')](function(_0x23a3c6){_0xb633db[_0xe14a('0x1f')]=_0x23a3c6;if(_0x44c77f[_0xe14a('0x2f')][_0xe14a('0x3f')]){_0x12d735['include']=[{'all':!![]}];}return db[_0xe14a('0x2b')][_0xe14a('0x40')](_0x12d735);})[_0xe14a('0x23')](function(_0x39e6c0){_0xb633db['rows']=_0x39e6c0;return _0xb633db;})[_0xe14a('0x23')](respondWithFilteredResult(_0x599dbf,_0x12d735))['catch'](handleError(_0x599dbf,null));};exports[_0xe14a('0x41')]=function(_0x5d1722,_0x1c53ce){var _0x2f1046={'raw':!![],'where':{'id':_0x5d1722[_0xe14a('0x42')]['id']}},_0x823358={};_0x823358['model']=_['keys'](db[_0xe14a('0x2b')][_0xe14a('0x2c')]);_0x823358[_0xe14a('0x2f')]=_[_0xe14a('0x30')](_0x5d1722[_0xe14a('0x2f')]);_0x823358[_0xe14a('0x39')]=_[_0xe14a('0x31')](_0x823358[_0xe14a('0x2e')],_0x823358['query']);_0x2f1046['attributes']=_['intersection'](_0x823358['model'],qs[_0xe14a('0x33')](_0x5d1722[_0xe14a('0x2f')]['fields']));_0x2f1046['attributes']=_0x2f1046[_0xe14a('0x32')][_0xe14a('0x34')]?_0x2f1046['attributes']:_0x823358[_0xe14a('0x2e')];if(_0x5d1722[_0xe14a('0x2f')][_0xe14a('0x3f')]){_0x2f1046[_0xe14a('0x43')]=[{'all':!![]}];}_0x2f1046=_[_0xe14a('0x3c')]({},_0x2f1046,_0x5d1722[_0xe14a('0x3e')]);return db[_0xe14a('0x2b')][_0xe14a('0x44')](_0x2f1046)[_0xe14a('0x23')](handleEntityNotFound(_0x1c53ce,null))[_0xe14a('0x23')](respondWithResult(_0x1c53ce,null))[_0xe14a('0x45')](handleError(_0x1c53ce,null));};exports[_0xe14a('0x46')]=function(_0x263b2a,_0x239c20){return db[_0xe14a('0x2b')][_0xe14a('0x46')](_0x263b2a['body'],{})[_0xe14a('0x23')](respondWithResult(_0x239c20,0xc9))[_0xe14a('0x45')](handleError(_0x239c20,null));};exports[_0xe14a('0x47')]=function(_0x28bdda,_0x360368){if(_0x28bdda[_0xe14a('0x48')]['id']){delete _0x28bdda[_0xe14a('0x48')]['id'];}return db[_0xe14a('0x2b')][_0xe14a('0x44')]({'where':{'id':_0x28bdda[_0xe14a('0x42')]['id']}})[_0xe14a('0x23')](handleEntityNotFound(_0x360368,null))['then'](saveUpdates(_0x28bdda[_0xe14a('0x48')],null))['then'](respondWithResult(_0x360368,null))['catch'](handleError(_0x360368,null));};exports[_0xe14a('0x24')]=function(_0x242e23,_0x1474ff){return db['FreshsalesField']['find']({'where':{'id':_0x242e23[_0xe14a('0x42')]['id']}})['then'](handleEntityNotFound(_0x1474ff,null))[_0xe14a('0x23')](removeEntity(_0x1474ff,null))['catch'](handleError(_0x1474ff,null));}; \ No newline at end of file +var _0x0b07=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshsalesField','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','create','body','find','params','rimraf','zip-dir','fast-json-patch'];(function(_0x3fe052,_0x3ed7aa){var _0x49d60f=function(_0x5ec19e){while(--_0x5ec19e){_0x3fe052['push'](_0x3fe052['shift']());}};_0x49d60f(++_0x3ed7aa);}(_0x0b07,0x1b3));var _0x70b0=function(_0x1d5a32,_0x47974a){_0x1d5a32=_0x1d5a32-0x0;var _0x361ca0=_0x0b07[_0x1d5a32];return _0x361ca0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x70b0('0x0'));var zipdir=require(_0x70b0('0x1'));var jsonpatch=require(_0x70b0('0x2'));var rp=require('request-promise');var moment=require(_0x70b0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x70b0('0x4'));var util=require(_0x70b0('0x5'));var path=require(_0x70b0('0x6'));var sox=require(_0x70b0('0x7'));var csv=require(_0x70b0('0x8'));var ejs=require(_0x70b0('0x9'));var fs=require('fs');var fs_extra=require(_0x70b0('0xa'));var _=require('lodash');var squel=require(_0x70b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x70b0('0xc'));var deskjs=require(_0x70b0('0xd'));var toCsv=require(_0x70b0('0x8'));var querystring=require(_0x70b0('0xe'));var Papa=require(_0x70b0('0xf'));var Redis=require('ioredis');var authService=require(_0x70b0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x70b0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x70b0('0x12'))(_0x70b0('0x13'));var utils=require(_0x70b0('0x14'));var config=require(_0x70b0('0x15'));var licenseUtil=require(_0x70b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x576900,_0x430314){_0x430314=_0x430314||0xcc;return function(_0x5df74b){if(_0x5df74b){return _0x576900[_0x70b0('0x17')](_0x430314);}return _0x576900['status'](_0x430314)[_0x70b0('0x18')]();};}function respondWithResult(_0x187171,_0x207e62){_0x207e62=_0x207e62||0xc8;return function(_0x4b2cf6){if(_0x4b2cf6){return _0x187171[_0x70b0('0x19')](_0x207e62)['json'](_0x4b2cf6);}};}function respondWithFilteredResult(_0x373487,_0x207836){return function(_0x491fac){if(_0x491fac){var _0x417efe=typeof _0x207836[_0x70b0('0x1a')]===_0x70b0('0x1b')&&typeof _0x207836[_0x70b0('0x1c')]===_0x70b0('0x1b');var _0x18bb52=_0x491fac[_0x70b0('0x1d')];var _0x5868c0=_0x417efe?0x0:_0x207836[_0x70b0('0x1a')];var _0x34a601=_0x417efe?_0x491fac[_0x70b0('0x1d')]:_0x207836['offset']+_0x207836[_0x70b0('0x1c')];var _0x279cb7;if(_0x34a601>=_0x18bb52){_0x34a601=_0x18bb52;_0x279cb7=0xc8;}else{_0x279cb7=0xce;}_0x373487[_0x70b0('0x19')](_0x279cb7);return _0x373487['set'](_0x70b0('0x1e'),_0x5868c0+'-'+_0x34a601+'/'+_0x18bb52)['json'](_0x491fac);}return null;};}function patchUpdates(_0x2650c6){return function(_0x37d1c4){try{jsonpatch[_0x70b0('0x1f')](_0x37d1c4,_0x2650c6,!![]);}catch(_0x209eea){return BPromise[_0x70b0('0x20')](_0x209eea);}return _0x37d1c4[_0x70b0('0x21')]();};}function saveUpdates(_0x23ace5,_0x3996d8){return function(_0x15bb54){if(_0x15bb54){return _0x15bb54[_0x70b0('0x22')](_0x23ace5)[_0x70b0('0x23')](function(_0x573f3b){return _0x573f3b;});}return null;};}function removeEntity(_0x55a76f,_0x4eb1d3){return function(_0x3ed30e){if(_0x3ed30e){return _0x3ed30e[_0x70b0('0x24')]()['then'](function(){_0x55a76f['status'](0xcc)[_0x70b0('0x18')]();});}};}function handleEntityNotFound(_0x7cee28,_0x517706){return function(_0x3e55f8){if(!_0x3e55f8){_0x7cee28[_0x70b0('0x17')](0x194);}return _0x3e55f8;};}function handleError(_0x1fb2a6,_0x1bba14){_0x1bba14=_0x1bba14||0x1f4;return function(_0x5c06e1){logger[_0x70b0('0x25')](_0x5c06e1[_0x70b0('0x26')]);if(_0x5c06e1[_0x70b0('0x27')]){delete _0x5c06e1[_0x70b0('0x27')];}_0x1fb2a6[_0x70b0('0x19')](_0x1bba14)['send'](_0x5c06e1);};}exports[_0x70b0('0x28')]=function(_0xf0920f,_0x4844a2){var _0x2a7237={},_0x3c1c86={},_0x1deaa6={'count':0x0,'rows':[]};var _0x50df3d=_[_0x70b0('0x29')](db[_0x70b0('0x2a')]['rawAttributes'],function(_0x351c9d){return{'name':_0x351c9d[_0x70b0('0x2b')],'type':_0x351c9d[_0x70b0('0x2c')][_0x70b0('0x2d')]};});_0x3c1c86[_0x70b0('0x2e')]=_[_0x70b0('0x29')](_0x50df3d,_0x70b0('0x27'));_0x3c1c86[_0x70b0('0x2f')]=_['keys'](_0xf0920f[_0x70b0('0x2f')]);_0x3c1c86[_0x70b0('0x30')]=_[_0x70b0('0x31')](_0x3c1c86[_0x70b0('0x2e')],_0x3c1c86[_0x70b0('0x2f')]);_0x2a7237['attributes']=_[_0x70b0('0x31')](_0x3c1c86[_0x70b0('0x2e')],qs[_0x70b0('0x32')](_0xf0920f[_0x70b0('0x2f')][_0x70b0('0x32')]));_0x2a7237[_0x70b0('0x33')]=_0x2a7237[_0x70b0('0x33')]['length']?_0x2a7237[_0x70b0('0x33')]:_0x3c1c86[_0x70b0('0x2e')];if(!_0xf0920f[_0x70b0('0x2f')]['hasOwnProperty'](_0x70b0('0x34'))){_0x2a7237[_0x70b0('0x1c')]=qs[_0x70b0('0x1c')](_0xf0920f[_0x70b0('0x2f')][_0x70b0('0x1c')]);_0x2a7237[_0x70b0('0x1a')]=qs[_0x70b0('0x1a')](_0xf0920f['query'][_0x70b0('0x1a')]);}_0x2a7237[_0x70b0('0x35')]=qs[_0x70b0('0x36')](_0xf0920f[_0x70b0('0x2f')]['sort']);_0x2a7237[_0x70b0('0x37')]=qs[_0x70b0('0x30')](_[_0x70b0('0x38')](_0xf0920f['query'],_0x3c1c86[_0x70b0('0x30')]),_0x50df3d);if(_0xf0920f[_0x70b0('0x2f')][_0x70b0('0x39')]){_0x2a7237['where']=_['merge'](_0x2a7237[_0x70b0('0x37')],{'$or':_[_0x70b0('0x29')](_0x50df3d,function(_0x854ef){if(_0x854ef[_0x70b0('0x2c')]!=='VIRTUAL'){var _0x49d022={};_0x49d022[_0x854ef[_0x70b0('0x27')]]={'$like':'%'+_0xf0920f['query'][_0x70b0('0x39')]+'%'};return _0x49d022;}})});}_0x2a7237=_[_0x70b0('0x3a')]({},_0x2a7237,_0xf0920f[_0x70b0('0x3b')]);var _0x5d81ce={'where':_0x2a7237[_0x70b0('0x37')]};return db[_0x70b0('0x2a')][_0x70b0('0x1d')](_0x5d81ce)[_0x70b0('0x23')](function(_0x4ae6fc){_0x1deaa6[_0x70b0('0x1d')]=_0x4ae6fc;if(_0xf0920f[_0x70b0('0x2f')][_0x70b0('0x3c')]){_0x2a7237[_0x70b0('0x3d')]=[{'all':!![]}];}return db[_0x70b0('0x2a')][_0x70b0('0x3e')](_0x2a7237);})['then'](function(_0x5e9a5b){_0x1deaa6[_0x70b0('0x3f')]=_0x5e9a5b;return _0x1deaa6;})[_0x70b0('0x23')](respondWithFilteredResult(_0x4844a2,_0x2a7237))[_0x70b0('0x40')](handleError(_0x4844a2,null));};exports[_0x70b0('0x41')]=function(_0x3dafd3,_0x5143a0){var _0x3f61af={'raw':!![],'where':{'id':_0x3dafd3['params']['id']}},_0x3e6fb9={};_0x3e6fb9[_0x70b0('0x2e')]=_[_0x70b0('0x42')](db[_0x70b0('0x2a')][_0x70b0('0x43')]);_0x3e6fb9[_0x70b0('0x2f')]=_[_0x70b0('0x42')](_0x3dafd3[_0x70b0('0x2f')]);_0x3e6fb9[_0x70b0('0x30')]=_['intersection'](_0x3e6fb9[_0x70b0('0x2e')],_0x3e6fb9[_0x70b0('0x2f')]);_0x3f61af[_0x70b0('0x33')]=_['intersection'](_0x3e6fb9[_0x70b0('0x2e')],qs[_0x70b0('0x32')](_0x3dafd3[_0x70b0('0x2f')][_0x70b0('0x32')]));_0x3f61af[_0x70b0('0x33')]=_0x3f61af['attributes'][_0x70b0('0x44')]?_0x3f61af['attributes']:_0x3e6fb9[_0x70b0('0x2e')];if(_0x3dafd3[_0x70b0('0x2f')][_0x70b0('0x3c')]){_0x3f61af[_0x70b0('0x3d')]=[{'all':!![]}];}_0x3f61af=_[_0x70b0('0x3a')]({},_0x3f61af,_0x3dafd3[_0x70b0('0x3b')]);return db[_0x70b0('0x2a')]['find'](_0x3f61af)['then'](handleEntityNotFound(_0x5143a0,null))['then'](respondWithResult(_0x5143a0,null))[_0x70b0('0x40')](handleError(_0x5143a0,null));};exports[_0x70b0('0x45')]=function(_0x219026,_0x199f22){return db[_0x70b0('0x2a')][_0x70b0('0x45')](_0x219026['body'],{})['then'](respondWithResult(_0x199f22,0xc9))[_0x70b0('0x40')](handleError(_0x199f22,null));};exports[_0x70b0('0x22')]=function(_0x9254d9,_0x575077){if(_0x9254d9['body']['id']){delete _0x9254d9[_0x70b0('0x46')]['id'];}return db[_0x70b0('0x2a')][_0x70b0('0x47')]({'where':{'id':_0x9254d9[_0x70b0('0x48')]['id']}})[_0x70b0('0x23')](handleEntityNotFound(_0x575077,null))['then'](saveUpdates(_0x9254d9[_0x70b0('0x46')],null))[_0x70b0('0x23')](respondWithResult(_0x575077,null))[_0x70b0('0x40')](handleError(_0x575077,null));};exports[_0x70b0('0x24')]=function(_0x502318,_0x1243fc){return db[_0x70b0('0x2a')][_0x70b0('0x47')]({'where':{'id':_0x502318[_0x70b0('0x48')]['id']}})['then'](handleEntityNotFound(_0x1243fc,null))['then'](removeEntity(_0x1243fc,null))[_0x70b0('0x40')](handleError(_0x1243fc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 003f73b..ee4f206 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 _0xd448=['../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xd448,0x172));var _0x8d44=function(_0x575941,_0x4023a6){_0x575941=_0x575941-0x0;var _0xe3076c=_0xd448[_0x575941];return _0xe3076c;};'use strict';var _=require('lodash');var util=require(_0x8d44('0x0'));var logger=require(_0x8d44('0x1'))(_0x8d44('0x2'));var moment=require(_0x8d44('0x3'));var BPromise=require(_0x8d44('0x4'));var rp=require(_0x8d44('0x5'));var fs=require('fs');var path=require(_0x8d44('0x6'));var rimraf=require(_0x8d44('0x7'));var config=require(_0x8d44('0x8'));var attributes=require(_0x8d44('0x9'));module['exports']=function(_0x41ae8e,_0x5032bc){return _0x41ae8e['define'](_0x8d44('0xa'),attributes,{'tableName':_0x8d44('0xb'),'paranoid':![],'indexes':[{'name':_0x8d44('0xc'),'fields':[_0x8d44('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b63=['FreshsalesField','freshsales_unique_index','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x28ab01,_0x4fae50){var _0x56e061=function(_0x5124df){while(--_0x5124df){_0x28ab01['push'](_0x28ab01['shift']());}};_0x56e061(++_0x4fae50);}(_0x0b63,0xe7));var _0x30b6=function(_0x2daa74,_0x1ef7a9){_0x2daa74=_0x2daa74-0x0;var _0x454b8e=_0x0b63[_0x2daa74];return _0x454b8e;};'use strict';var _=require(_0x30b6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x30b6('0x1'));var moment=require(_0x30b6('0x2'));var BPromise=require(_0x30b6('0x3'));var rp=require(_0x30b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30b6('0x5'));var config=require(_0x30b6('0x6'));var attributes=require(_0x30b6('0x7'));module[_0x30b6('0x8')]=function(_0x2670c6,_0x2fddeb){return _0x2670c6['define'](_0x30b6('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x30b6('0xa'),'fields':['idField',_0x30b6('0xb')],'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 bb7f3b2..5078229 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 _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x220c24,_0x458cab){var _0x35fac5=function(_0x3f1a38){while(--_0x3f1a38){_0x220c24['push'](_0x220c24['shift']());}};_0x35fac5(++_0x458cab);}(_0xafc4,0x69));var _0x4afc=function(_0x43a5c5,_0x4db0fd){_0x43a5c5=_0x43a5c5-0x0;var _0x53b4fa=_0xafc4[_0x43a5c5];return _0x53b4fa;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file +var _0x5d58=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x234995,_0x48c007){var _0x5115f0=function(_0x7f8704){while(--_0x7f8704){_0x234995['push'](_0x234995['shift']());}};_0x5115f0(++_0x48c007);}(_0x5d58,0x187));var _0x85d5=function(_0xc4558,_0x3bf609){_0xc4558=_0xc4558-0x0;var _0x2f7d01=_0x5d58[_0xc4558];return _0x2f7d01;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46e7b4,_0x5f47ec,_0x98c963){return new BPromise(function(_0x3fecca,_0x4ca293){return client[_0x85d5('0x7')](_0x46e7b4,_0x98c963)['then'](function(_0x1098be){logger[_0x85d5('0x8')](_0x85d5('0x9'),_0x5f47ec,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f47ec,_0x85d5('0xa'),JSON[_0x85d5('0xb')](_0x1098be));if(_0x1098be[_0x85d5('0xc')]){if(_0x1098be[_0x85d5('0xc')][_0x85d5('0xd')]===0x1f4){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be['error']['message']);return _0x4ca293(_0x1098be['error'][_0x85d5('0xe')]);}logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);return _0x3fecca(_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);}else{logger['info'](_0x85d5('0x9'),_0x5f47ec,_0x85d5('0xa'));_0x3fecca(_0x1098be[_0x85d5('0xf')][_0x85d5('0xe')]);}})[_0x85d5('0x10')](function(_0x3dc83c){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x3dc83c);_0x4ca293(_0x3dc83c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 251a83e..99e40fc 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(_0x3e2f61,_0x13ddcf){var _0x368e24=function(_0x3df444){while(--_0x3df444){_0x3e2f61['push'](_0x3e2f61['shift']());}};_0x368e24(++_0x13ddcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 _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(_0x335f76,_0x3c89af){var _0x336ff8=function(_0x3d935d){while(--_0x3d935d){_0x335f76['push'](_0x335f76['shift']());}};_0x336ff8(++_0x3c89af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 5f31f6e..e36202e 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 _0xb8cb=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x166760,_0x3d120e){var _0x40b54e=function(_0x259213){while(--_0x259213){_0x166760['push'](_0x166760['shift']());}};_0x40b54e(++_0x3d120e);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x2e7e16,_0x34798e){_0x2e7e16=_0x2e7e16-0x0;var _0x23cbed=_0xb8cb[_0x2e7e16];return _0x23cbed;};'use strict';var Sequelize=require(_0xbb8c('0x0'));module[_0xbb8c('0x1')]={'name':{'type':Sequelize[_0xbb8c('0x2')]},'description':{'type':Sequelize[_0xbb8c('0x2')]},'username':{'type':Sequelize[_0xbb8c('0x2')],'unique':_0xbb8c('0x3')},'remoteUri':{'type':Sequelize[_0xbb8c('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbb8c('0x2')]},'clientSecret':{'type':Sequelize[_0xbb8c('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbb8c('0x4')](_0xbb8c('0x5'),_0xbb8c('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x15e8=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x41d45e,_0x38de05){var _0x5ce9cc=function(_0x48a7ae){while(--_0x48a7ae){_0x41d45e['push'](_0x41d45e['shift']());}};_0x5ce9cc(++_0x38de05);}(_0x15e8,0x13d));var _0x815e=function(_0x1d00eb,_0x3386de){_0x1d00eb=_0x1d00eb-0x0;var _0x4dd547=_0x15e8[_0x1d00eb];return _0x4dd547;};'use strict';var Sequelize=require('sequelize');module[_0x815e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x815e('0x1')]},'username':{'type':Sequelize[_0x815e('0x1')],'unique':_0x815e('0x2')},'remoteUri':{'type':Sequelize[_0x815e('0x1')]},'password':{'type':Sequelize[_0x815e('0x1')]},'clientId':{'type':Sequelize[_0x815e('0x1')]},'clientSecret':{'type':Sequelize[_0x815e('0x1')]},'securityToken':{'type':Sequelize[_0x815e('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x815e('0x3')](_0x815e('0x4'),_0x815e('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 33c0c5d..21283d3 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 _0x9770=['find','getConfigurations','SalesforceConfiguration','sort','options','hasOwnProperty','addConfiguration','findOne','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','securityToken','remoteUri','substring','Connection','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','textarea','phone','remove','includes','label','custom','picklistValues','True','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','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','offset','undefined','limit','count','set','json','reject','save','then','destroy','end','error','name','send','index','map','SalesforceAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','filter','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','include','merge','catch','body','update'];(function(_0x170adc,_0x5105d4){var _0x3cfb94=function(_0x36f084){while(--_0x36f084){_0x170adc['push'](_0x170adc['shift']());}};_0x3cfb94(++_0x5105d4);}(_0x9770,0x19f));var _0x0977=function(_0x5b5c6b,_0x34c984){_0x5b5c6b=_0x5b5c6b-0x0;var _0x13c41f=_0x9770[_0x5b5c6b];return _0x13c41f;};'use strict';var emlformat=require(_0x0977('0x0'));var rimraf=require(_0x0977('0x1'));var zipdir=require(_0x0977('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0977('0x3'));var moment=require(_0x0977('0x4'));var BPromise=require(_0x0977('0x5'));var Mustache=require(_0x0977('0x6'));var util=require(_0x0977('0x7'));var path=require(_0x0977('0x8'));var sox=require(_0x0977('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0977('0xa'));var _=require(_0x0977('0xb'));var squel=require(_0x0977('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0977('0xd'));var toCsv=require(_0x0977('0xe'));var querystring=require(_0x0977('0xf'));var Papa=require('papaparse');var Redis=require(_0x0977('0x10'));var authService=require(_0x0977('0x11'));var qs=require(_0x0977('0x12'));var as=require(_0x0977('0x13'));var hardwareService=require(_0x0977('0x14'));var logger=require(_0x0977('0x15'))(_0x0977('0x16'));var utils=require(_0x0977('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0977('0x18'));var db=require(_0x0977('0x19'))['db'];var integrations=require(_0x0977('0x1a'));function respondWithStatusCode(_0x117626,_0x445c40){_0x445c40=_0x445c40||0xcc;return function(_0x401581){if(_0x401581){return _0x117626[_0x0977('0x1b')](_0x445c40);}return _0x117626[_0x0977('0x1c')](_0x445c40)['end']();};}function respondWithResult(_0x380d7a,_0xe6c777){_0xe6c777=_0xe6c777||0xc8;return function(_0x5a6d50){if(_0x5a6d50){return _0x380d7a[_0x0977('0x1c')](_0xe6c777)['json'](_0x5a6d50);}};}function respondWithFilteredResult(_0x330984,_0x3f47e8){return function(_0x5b14e8){if(_0x5b14e8){var _0x2d1875=typeof _0x3f47e8[_0x0977('0x1d')]===_0x0977('0x1e')&&typeof _0x3f47e8[_0x0977('0x1f')]===_0x0977('0x1e');var _0x328566=_0x5b14e8[_0x0977('0x20')];var _0x3627c3=_0x2d1875?0x0:_0x3f47e8['offset'];var _0x135290=_0x2d1875?_0x5b14e8[_0x0977('0x20')]:_0x3f47e8[_0x0977('0x1d')]+_0x3f47e8[_0x0977('0x1f')];var _0x153de1;if(_0x135290>=_0x328566){_0x135290=_0x328566;_0x153de1=0xc8;}else{_0x153de1=0xce;}_0x330984[_0x0977('0x1c')](_0x153de1);return _0x330984[_0x0977('0x21')]('Content-Range',_0x3627c3+'-'+_0x135290+'/'+_0x328566)[_0x0977('0x22')](_0x5b14e8);}return null;};}function patchUpdates(_0x4056a4){return function(_0x559c02){try{jsonpatch['apply'](_0x559c02,_0x4056a4,!![]);}catch(_0x421913){return BPromise[_0x0977('0x23')](_0x421913);}return _0x559c02[_0x0977('0x24')]();};}function saveUpdates(_0x4ba011,_0x4f647d){return function(_0xea9fba){if(_0xea9fba){return _0xea9fba['update'](_0x4ba011)[_0x0977('0x25')](function(_0x1a2fb5){return _0x1a2fb5;});}return null;};}function removeEntity(_0x4e9618,_0x55d29c){return function(_0x45033){if(_0x45033){return _0x45033[_0x0977('0x26')]()[_0x0977('0x25')](function(){_0x4e9618[_0x0977('0x1c')](0xcc)[_0x0977('0x27')]();});}};}function handleEntityNotFound(_0x272d5f,_0x40ca3a){return function(_0x35ffcc){if(!_0x35ffcc){_0x272d5f[_0x0977('0x1b')](0x194);}return _0x35ffcc;};}function handleError(_0x2f4444,_0x4a2cbb){_0x4a2cbb=_0x4a2cbb||0x1f4;return function(_0x41aba2){logger[_0x0977('0x28')](_0x41aba2['stack']);if(_0x41aba2[_0x0977('0x29')]){delete _0x41aba2['name'];}_0x2f4444[_0x0977('0x1c')](_0x4a2cbb)[_0x0977('0x2a')](_0x41aba2);};}exports[_0x0977('0x2b')]=function(_0x31a79b,_0x45726f){var _0x4ae16a={},_0x3d0cc8={},_0x4323de={'count':0x0,'rows':[]};var _0x327650=_[_0x0977('0x2c')](db[_0x0977('0x2d')]['rawAttributes'],function(_0x2b85a9){return{'name':_0x2b85a9[_0x0977('0x2e')],'type':_0x2b85a9[_0x0977('0x2f')][_0x0977('0x30')]};});_0x3d0cc8['model']=_[_0x0977('0x2c')](_0x327650,'name');_0x3d0cc8[_0x0977('0x31')]=_[_0x0977('0x32')](_0x31a79b['query']);_0x3d0cc8[_0x0977('0x33')]=_[_0x0977('0x34')](_0x3d0cc8['model'],_0x3d0cc8['query']);_0x4ae16a['attributes']=_[_0x0977('0x34')](_0x3d0cc8[_0x0977('0x35')],qs[_0x0977('0x36')](_0x31a79b[_0x0977('0x31')][_0x0977('0x36')]));_0x4ae16a[_0x0977('0x37')]=_0x4ae16a[_0x0977('0x37')][_0x0977('0x38')]?_0x4ae16a[_0x0977('0x37')]:_0x3d0cc8[_0x0977('0x35')];if(!_0x31a79b[_0x0977('0x31')]['hasOwnProperty'](_0x0977('0x39'))){_0x4ae16a[_0x0977('0x1f')]=qs['limit'](_0x31a79b[_0x0977('0x31')]['limit']);_0x4ae16a[_0x0977('0x1d')]=qs['offset'](_0x31a79b[_0x0977('0x31')]['offset']);}_0x4ae16a[_0x0977('0x3a')]=qs['sort'](_0x31a79b[_0x0977('0x31')]['sort']);_0x4ae16a[_0x0977('0x3b')]=qs[_0x0977('0x33')](_['pick'](_0x31a79b['query'],_0x3d0cc8[_0x0977('0x33')]),_0x327650);if(_0x31a79b[_0x0977('0x31')][_0x0977('0x3c')]){_0x4ae16a[_0x0977('0x3b')]=_['merge'](_0x4ae16a[_0x0977('0x3b')],{'$or':_[_0x0977('0x2c')](_0x327650,function(_0x2efedc){if(_0x2efedc[_0x0977('0x2f')]!==_0x0977('0x3d')){var _0x30387b={};_0x30387b[_0x2efedc[_0x0977('0x29')]]={'$like':'%'+_0x31a79b[_0x0977('0x31')]['filter']+'%'};return _0x30387b;}})});}_0x4ae16a=_['merge']({},_0x4ae16a,_0x31a79b['options']);var _0x26c791={'where':_0x4ae16a['where']};return db[_0x0977('0x2d')][_0x0977('0x20')](_0x26c791)[_0x0977('0x25')](function(_0x329e34){_0x4323de['count']=_0x329e34;if(_0x31a79b[_0x0977('0x31')][_0x0977('0x3e')]){_0x4ae16a['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x0977('0x3f')](_0x4ae16a);})[_0x0977('0x25')](function(_0x1df056){_0x4323de[_0x0977('0x40')]=_0x1df056;return _0x4323de;})[_0x0977('0x25')](respondWithFilteredResult(_0x45726f,_0x4ae16a))['catch'](handleError(_0x45726f,null));};exports[_0x0977('0x41')]=function(_0x4b3a7c,_0x199262){var _0x18bd99={'raw':![],'where':{'id':_0x4b3a7c[_0x0977('0x42')]['id']}},_0x4d5e7c={};_0x4d5e7c[_0x0977('0x35')]=_['keys'](db['SalesforceAccount'][_0x0977('0x43')]);_0x4d5e7c[_0x0977('0x31')]=_[_0x0977('0x32')](_0x4b3a7c[_0x0977('0x31')]);_0x4d5e7c[_0x0977('0x33')]=_['intersection'](_0x4d5e7c[_0x0977('0x35')],_0x4d5e7c[_0x0977('0x31')]);_0x18bd99[_0x0977('0x37')]=_['intersection'](_0x4d5e7c['model'],qs[_0x0977('0x36')](_0x4b3a7c[_0x0977('0x31')]['fields']));_0x18bd99[_0x0977('0x37')]=_0x18bd99[_0x0977('0x37')][_0x0977('0x38')]?_0x18bd99[_0x0977('0x37')]:_0x4d5e7c[_0x0977('0x35')];if(_0x4b3a7c[_0x0977('0x31')][_0x0977('0x3e')]){_0x18bd99[_0x0977('0x44')]=[{'all':!![]}];}_0x18bd99=_[_0x0977('0x45')]({},_0x18bd99,_0x4b3a7c['options']);return db[_0x0977('0x2d')]['find'](_0x18bd99)[_0x0977('0x25')](handleEntityNotFound(_0x199262,null))[_0x0977('0x25')](respondWithResult(_0x199262,null))[_0x0977('0x46')](handleError(_0x199262,null));};exports['create']=function(_0x3412e1,_0x5bc754){return db['SalesforceAccount']['create'](_0x3412e1[_0x0977('0x47')],{})[_0x0977('0x25')](respondWithResult(_0x5bc754,0xc9))[_0x0977('0x46')](handleError(_0x5bc754,null));};exports[_0x0977('0x48')]=function(_0x39ce31,_0x1129ad){if(_0x39ce31['body']['id']){delete _0x39ce31[_0x0977('0x47')]['id'];}return db[_0x0977('0x2d')]['find']({'where':{'id':_0x39ce31['params']['id']}})[_0x0977('0x25')](handleEntityNotFound(_0x1129ad,null))[_0x0977('0x25')](saveUpdates(_0x39ce31[_0x0977('0x47')],null))[_0x0977('0x25')](respondWithResult(_0x1129ad,null))[_0x0977('0x46')](handleError(_0x1129ad,null));};exports['destroy']=function(_0x646d7f,_0x1b4acc){return db[_0x0977('0x2d')][_0x0977('0x49')]({'where':{'id':_0x646d7f[_0x0977('0x42')]['id']}})[_0x0977('0x25')](handleEntityNotFound(_0x1b4acc,null))[_0x0977('0x25')](removeEntity(_0x1b4acc,null))[_0x0977('0x46')](handleError(_0x1b4acc,null));};exports[_0x0977('0x4a')]=function(_0x37c766,_0x15b119,_0x44ff37){var _0x4f0122={};var _0x248c4a={};var _0x4eab7a;var _0xd505b1;return db[_0x0977('0x2d')]['findOne']({'where':{'id':_0x37c766[_0x0977('0x42')]['id']}})[_0x0977('0x25')](handleEntityNotFound(_0x15b119,null))[_0x0977('0x25')](function(_0x42ab61){if(_0x42ab61){_0x4eab7a=_0x42ab61;_0x248c4a[_0x0977('0x35')]=_['keys'](db[_0x0977('0x4b')][_0x0977('0x43')]);_0x248c4a[_0x0977('0x31')]=_[_0x0977('0x32')](_0x37c766[_0x0977('0x31')]);_0x248c4a[_0x0977('0x33')]=_[_0x0977('0x34')](_0x248c4a[_0x0977('0x35')],_0x248c4a[_0x0977('0x31')]);_0x4f0122[_0x0977('0x37')]=_[_0x0977('0x34')](_0x248c4a[_0x0977('0x35')],qs[_0x0977('0x36')](_0x37c766[_0x0977('0x31')][_0x0977('0x36')]));_0x4f0122[_0x0977('0x37')]=_0x4f0122[_0x0977('0x37')]['length']?_0x4f0122[_0x0977('0x37')]:_0x248c4a[_0x0977('0x35')];_0x4f0122[_0x0977('0x3a')]=qs[_0x0977('0x4c')](_0x37c766[_0x0977('0x31')][_0x0977('0x4c')]);_0x4f0122['where']=qs[_0x0977('0x33')](_['pick'](_0x37c766[_0x0977('0x31')],_0x248c4a['filters']));if(_0x37c766['query']['filter']){_0x4f0122[_0x0977('0x3b')]=_[_0x0977('0x45')](_0x4f0122[_0x0977('0x3b')],{'$or':_[_0x0977('0x2c')](_0x4f0122[_0x0977('0x37')],function(_0x1ede31){var _0x27054f={};_0x27054f[_0x1ede31]={'$like':'%'+_0x37c766[_0x0977('0x31')][_0x0977('0x3c')]+'%'};return _0x27054f;})});}_0x4f0122=_[_0x0977('0x45')]({},_0x4f0122,_0x37c766[_0x0977('0x4d')]);return _0x4eab7a[_0x0977('0x4a')](_0x4f0122);}})[_0x0977('0x25')](function(_0x5e63d7){if(_0x5e63d7){_0xd505b1=_0x5e63d7['length'];if(!_0x37c766[_0x0977('0x31')][_0x0977('0x4e')](_0x0977('0x39'))){_0x4f0122[_0x0977('0x1f')]=qs[_0x0977('0x1f')](_0x37c766[_0x0977('0x31')][_0x0977('0x1f')]);_0x4f0122[_0x0977('0x1d')]=qs['offset'](_0x37c766[_0x0977('0x31')][_0x0977('0x1d')]);}return _0x4eab7a[_0x0977('0x4a')](_0x4f0122);}})[_0x0977('0x25')](function(_0x43e24a){if(_0x43e24a){return _0x43e24a?{'count':_0xd505b1,'rows':_0x43e24a}:null;}})[_0x0977('0x25')](respondWithResult(_0x15b119,null))['catch'](handleError(_0x15b119,null));};exports[_0x0977('0x4f')]=function(_0x1de4fc,_0x9b063,_0x2aecae){if(_0x1de4fc[_0x0977('0x47')]['id']){delete _0x1de4fc[_0x0977('0x47')]['id'];}return db[_0x0977('0x2d')][_0x0977('0x50')]({'where':{'id':_0x1de4fc['params']['id']}})[_0x0977('0x25')](handleEntityNotFound(_0x9b063,null))[_0x0977('0x25')](function(_0x2ee8b5){if(_0x2ee8b5){_0x1de4fc[_0x0977('0x47')]['AccountId']=_0x2ee8b5['id'];_0x1de4fc['body'][_0x0977('0x51')]=integrations['getSubjects'](_0x1de4fc[_0x0977('0x47')][_0x0977('0x52')],_0x1de4fc[_0x0977('0x47')][_0x0977('0x2f')]);_0x1de4fc[_0x0977('0x47')][_0x0977('0x53')]=integrations[_0x0977('0x54')](_0x1de4fc['body'][_0x0977('0x52')],_0x1de4fc[_0x0977('0x47')][_0x0977('0x2f')]);return db['SalesforceConfiguration']['create'](_0x1de4fc['body'],{'include':[{'model':db[_0x0977('0x55')],'as':_0x0977('0x51')},{'model':db[_0x0977('0x55')],'as':_0x0977('0x53')}]});}return null;})[_0x0977('0x25')](respondWithResult(_0x9b063,null))[_0x0977('0x46')](handleError(_0x9b063,null));};exports[_0x0977('0x56')]=function(_0x14391e,_0x57a896,_0xef274c){var _0x3bbeb3;var _0x20f0cd='';var _0x1b13ac=_0x0977('0x57');return db[_0x0977('0x2d')][_0x0977('0x50')]({'where':{'id':_0x14391e[_0x0977('0x42')]['id']},'attributes':['id','remoteUri',_0x0977('0x58'),_0x0977('0x59'),'username','password',_0x0977('0x5a')]})[_0x0977('0x25')](handleEntityNotFound(_0x57a896,null))['then'](function(_0x4e2f56){if(_0x4e2f56){_0x20f0cd=_0x4e2f56[_0x0977('0x5b')];var _0x2a6490=_0x20f0cd['slice'](-0x1);if(_0x2a6490==='/'){_0x20f0cd=_0x20f0cd[_0x0977('0x5c')](0x0,_0x20f0cd['lastIndexOf'](_0x2a6490));}_0x3bbeb3=new jsforce[(_0x0977('0x5d'))]({'oauth2':{'loginUrl':_0x20f0cd,'clientId':_0x4e2f56[_0x0977('0x58')],'clientSecret':_0x4e2f56[_0x0977('0x59')]}});return _0x3bbeb3[_0x0977('0x5e')](_0x4e2f56[_0x0977('0x5f')],_0x4e2f56['password'][_0x0977('0x60')](_0x4e2f56[_0x0977('0x5a')]));}})[_0x0977('0x25')](function(_0x57bd46){if(_0x57bd46){if(!_[_0x0977('0x61')](_0x14391e[_0x0977('0x31')][_0x0977('0x62')])){_0x1b13ac=_0x14391e['query'][_0x0977('0x62')];}return _0x3bbeb3[_0x0977('0x63')](_0x1b13ac)[_0x0977('0x64')]();}})['then'](function(_0x12599b){var _0x19c5ef=[_0x0977('0x65'),'ActivityDate',_0x0977('0x66'),_0x0977('0x67'),_0x0977('0x68'),_0x0977('0x69')];var _0x1376f5=[_0x0977('0x6a'),_0x0977('0x6b'),'picklist',_0x0977('0x6c'),'email',_0x0977('0x6d'),_0x0977('0x6e')];if(_0x12599b){_[_0x0977('0x6f')](_0x12599b['fields'],function(_0x2f2a49){return _0x19c5ef[_0x0977('0x70')](_0x2f2a49[_0x0977('0x29')])||!_0x1376f5[_0x0977('0x70')](_0x2f2a49[_0x0977('0x2f')]);});return{'count':_0x12599b[_0x0977('0x36')]['length'],'rows':_[_0x0977('0x2c')](_0x12599b['fields'],function(_0x31c960){return{'id':_0x31c960['name'],'name':_0x31c960[_0x0977('0x71')],'custom':_0x31c960[_0x0977('0x72')],'options':_0x31c960[_0x0977('0x73')]['length']>0x0?_[_0x0977('0x2c')](_0x31c960[_0x0977('0x73')],function(_0x14fa27){return{'name':_0x14fa27[_0x0977('0x71')],'value':_0x14fa27['value']};}):_0x31c960[_0x0977('0x2f')]==_0x0977('0x6c')?[{'name':_0x0977('0x74'),'value':'true'},{'name':_0x0977('0x75'),'value':'false'}]:[]};})};}})[_0x0977('0x25')](respondWithResult(_0x57a896,null))[_0x0977('0x46')](function(_0xe4fca6){var _0x2fe7e9=_0x14391e[_0x0977('0x31')][_0x0977('0x76')]?0x1f4:_0xe4fca6[_0x0977('0x77')]||0x1f4;logger[_0x0977('0x28')](_0x0977('0x78'),_0x0977('0x56'),_0x2fe7e9,JSON['stringify'](_0xe4fca6));delete _0xe4fca6[_0x0977('0x29')];if(_0x2fe7e9===0x191){_0x2fe7e9=0x190;}_0x57a896[_0x0977('0x1c')](_0x2fe7e9)[_0x0977('0x2a')](_0x14391e['query']['test']?{'message':_0x0977('0x79'),'statusCode':_0xe4fca6[_0x0977('0x77')]}:_0xe4fca6);});}; \ No newline at end of file +var _0xe241=['update','then','destroy','error','stack','name','map','SalesforceAccount','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','create','body','catch','find','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','int','picklist','email','textarea','includes','label','custom','picklistValues','value','boolean','true','false','test','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0xe241,0xcc));var _0x1e24=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe241[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x1e24('0x0'));var rimraf=require(_0x1e24('0x1'));var zipdir=require(_0x1e24('0x2'));var jsonpatch=require(_0x1e24('0x3'));var rp=require(_0x1e24('0x4'));var moment=require('moment');var BPromise=require(_0x1e24('0x5'));var Mustache=require(_0x1e24('0x6'));var util=require(_0x1e24('0x7'));var path=require(_0x1e24('0x8'));var sox=require(_0x1e24('0x9'));var csv=require('to-csv');var ejs=require(_0x1e24('0xa'));var fs=require('fs');var fs_extra=require(_0x1e24('0xb'));var _=require('lodash');var squel=require(_0x1e24('0xc'));var crypto=require(_0x1e24('0xd'));var jsforce=require(_0x1e24('0xe'));var deskjs=require(_0x1e24('0xf'));var toCsv=require(_0x1e24('0x10'));var querystring=require(_0x1e24('0x11'));var Papa=require(_0x1e24('0x12'));var Redis=require('ioredis');var authService=require(_0x1e24('0x13'));var qs=require(_0x1e24('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e24('0x15'));var logger=require('../../config/logger')(_0x1e24('0x16'));var utils=require(_0x1e24('0x17'));var config=require(_0x1e24('0x18'));var licenseUtil=require(_0x1e24('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1e24('0x1a'));function respondWithStatusCode(_0x26d847,_0x160576){_0x160576=_0x160576||0xcc;return function(_0x327d09){if(_0x327d09){return _0x26d847[_0x1e24('0x1b')](_0x160576);}return _0x26d847[_0x1e24('0x1c')](_0x160576)[_0x1e24('0x1d')]();};}function respondWithResult(_0x2c4bef,_0x55a14c){_0x55a14c=_0x55a14c||0xc8;return function(_0x5b821c){if(_0x5b821c){return _0x2c4bef[_0x1e24('0x1c')](_0x55a14c)['json'](_0x5b821c);}};}function respondWithFilteredResult(_0x12ed5c,_0x3ff109){return function(_0x1538b1){if(_0x1538b1){var _0x3d9e7b=typeof _0x3ff109[_0x1e24('0x1e')]===_0x1e24('0x1f')&&typeof _0x3ff109['limit']==='undefined';var _0x42eb68=_0x1538b1[_0x1e24('0x20')];var _0x426686=_0x3d9e7b?0x0:_0x3ff109['offset'];var _0x51772d=_0x3d9e7b?_0x1538b1[_0x1e24('0x20')]:_0x3ff109[_0x1e24('0x1e')]+_0x3ff109[_0x1e24('0x21')];var _0x50ce04;if(_0x51772d>=_0x42eb68){_0x51772d=_0x42eb68;_0x50ce04=0xc8;}else{_0x50ce04=0xce;}_0x12ed5c[_0x1e24('0x1c')](_0x50ce04);return _0x12ed5c[_0x1e24('0x22')](_0x1e24('0x23'),_0x426686+'-'+_0x51772d+'/'+_0x42eb68)[_0x1e24('0x24')](_0x1538b1);}return null;};}function patchUpdates(_0x1088ac){return function(_0x24777a){try{jsonpatch['apply'](_0x24777a,_0x1088ac,!![]);}catch(_0x50103a){return BPromise['reject'](_0x50103a);}return _0x24777a[_0x1e24('0x25')]();};}function saveUpdates(_0x227c78,_0x51bbc6){return function(_0x2b2be0){if(_0x2b2be0){return _0x2b2be0[_0x1e24('0x26')](_0x227c78)[_0x1e24('0x27')](function(_0x2b1390){return _0x2b1390;});}return null;};}function removeEntity(_0x47c5a1,_0x4c7a8b){return function(_0x5f4b6d){if(_0x5f4b6d){return _0x5f4b6d[_0x1e24('0x28')]()['then'](function(){_0x47c5a1['status'](0xcc)[_0x1e24('0x1d')]();});}};}function handleEntityNotFound(_0x56ba76,_0x3f3666){return function(_0x3ed5f5){if(!_0x3ed5f5){_0x56ba76['sendStatus'](0x194);}return _0x3ed5f5;};}function handleError(_0x2cbf32,_0x22b3ad){_0x22b3ad=_0x22b3ad||0x1f4;return function(_0x5e2b88){logger[_0x1e24('0x29')](_0x5e2b88[_0x1e24('0x2a')]);if(_0x5e2b88[_0x1e24('0x2b')]){delete _0x5e2b88['name'];}_0x2cbf32[_0x1e24('0x1c')](_0x22b3ad)['send'](_0x5e2b88);};}exports['index']=function(_0xad7c70,_0x5c19d9){var _0x5db350={},_0x384c49={},_0x3fba19={'count':0x0,'rows':[]};var _0x1417eb=_[_0x1e24('0x2c')](db[_0x1e24('0x2d')][_0x1e24('0x2e')],function(_0x1d65b4){return{'name':_0x1d65b4['fieldName'],'type':_0x1d65b4[_0x1e24('0x2f')][_0x1e24('0x30')]};});_0x384c49['model']=_[_0x1e24('0x2c')](_0x1417eb,'name');_0x384c49[_0x1e24('0x31')]=_['keys'](_0xad7c70[_0x1e24('0x31')]);_0x384c49['filters']=_[_0x1e24('0x32')](_0x384c49[_0x1e24('0x33')],_0x384c49[_0x1e24('0x31')]);_0x5db350[_0x1e24('0x34')]=_[_0x1e24('0x32')](_0x384c49['model'],qs[_0x1e24('0x35')](_0xad7c70[_0x1e24('0x31')][_0x1e24('0x35')]));_0x5db350[_0x1e24('0x34')]=_0x5db350[_0x1e24('0x34')][_0x1e24('0x36')]?_0x5db350['attributes']:_0x384c49['model'];if(!_0xad7c70['query'][_0x1e24('0x37')](_0x1e24('0x38'))){_0x5db350[_0x1e24('0x21')]=qs[_0x1e24('0x21')](_0xad7c70[_0x1e24('0x31')]['limit']);_0x5db350[_0x1e24('0x1e')]=qs[_0x1e24('0x1e')](_0xad7c70[_0x1e24('0x31')][_0x1e24('0x1e')]);}_0x5db350[_0x1e24('0x39')]=qs[_0x1e24('0x3a')](_0xad7c70[_0x1e24('0x31')][_0x1e24('0x3a')]);_0x5db350[_0x1e24('0x3b')]=qs['filters'](_[_0x1e24('0x3c')](_0xad7c70['query'],_0x384c49[_0x1e24('0x3d')]),_0x1417eb);if(_0xad7c70['query'][_0x1e24('0x3e')]){_0x5db350[_0x1e24('0x3b')]=_[_0x1e24('0x3f')](_0x5db350['where'],{'$or':_[_0x1e24('0x2c')](_0x1417eb,function(_0x27c155){if(_0x27c155[_0x1e24('0x2f')]!==_0x1e24('0x40')){var _0x4fcc08={};_0x4fcc08[_0x27c155[_0x1e24('0x2b')]]={'$like':'%'+_0xad7c70[_0x1e24('0x31')]['filter']+'%'};return _0x4fcc08;}})});}_0x5db350=_[_0x1e24('0x3f')]({},_0x5db350,_0xad7c70[_0x1e24('0x41')]);var _0x3170bf={'where':_0x5db350[_0x1e24('0x3b')]};return db['SalesforceAccount'][_0x1e24('0x20')](_0x3170bf)[_0x1e24('0x27')](function(_0x5664e4){_0x3fba19[_0x1e24('0x20')]=_0x5664e4;if(_0xad7c70['query'][_0x1e24('0x42')]){_0x5db350[_0x1e24('0x43')]=[{'all':!![]}];}return db[_0x1e24('0x2d')][_0x1e24('0x44')](_0x5db350);})['then'](function(_0x117db8){_0x3fba19[_0x1e24('0x45')]=_0x117db8;return _0x3fba19;})[_0x1e24('0x27')](respondWithFilteredResult(_0x5c19d9,_0x5db350))['catch'](handleError(_0x5c19d9,null));};exports[_0x1e24('0x46')]=function(_0x6cb8f6,_0x445f60){var _0x1ae78c={'raw':![],'where':{'id':_0x6cb8f6[_0x1e24('0x47')]['id']}},_0x38227b={};_0x38227b[_0x1e24('0x33')]=_[_0x1e24('0x48')](db['SalesforceAccount']['rawAttributes']);_0x38227b['query']=_[_0x1e24('0x48')](_0x6cb8f6[_0x1e24('0x31')]);_0x38227b['filters']=_[_0x1e24('0x32')](_0x38227b['model'],_0x38227b['query']);_0x1ae78c['attributes']=_[_0x1e24('0x32')](_0x38227b[_0x1e24('0x33')],qs[_0x1e24('0x35')](_0x6cb8f6['query'][_0x1e24('0x35')]));_0x1ae78c[_0x1e24('0x34')]=_0x1ae78c[_0x1e24('0x34')][_0x1e24('0x36')]?_0x1ae78c[_0x1e24('0x34')]:_0x38227b[_0x1e24('0x33')];if(_0x6cb8f6[_0x1e24('0x31')][_0x1e24('0x42')]){_0x1ae78c[_0x1e24('0x43')]=[{'all':!![]}];}_0x1ae78c=_[_0x1e24('0x3f')]({},_0x1ae78c,_0x6cb8f6[_0x1e24('0x41')]);return db[_0x1e24('0x2d')]['find'](_0x1ae78c)[_0x1e24('0x27')](handleEntityNotFound(_0x445f60,null))['then'](respondWithResult(_0x445f60,null))['catch'](handleError(_0x445f60,null));};exports['create']=function(_0x3ba21d,_0x365ee9){return db[_0x1e24('0x2d')][_0x1e24('0x49')](_0x3ba21d[_0x1e24('0x4a')],{})[_0x1e24('0x27')](respondWithResult(_0x365ee9,0xc9))[_0x1e24('0x4b')](handleError(_0x365ee9,null));};exports[_0x1e24('0x26')]=function(_0x34173c,_0x143ec6){if(_0x34173c[_0x1e24('0x4a')]['id']){delete _0x34173c[_0x1e24('0x4a')]['id'];}return db['SalesforceAccount'][_0x1e24('0x4c')]({'where':{'id':_0x34173c['params']['id']}})['then'](handleEntityNotFound(_0x143ec6,null))[_0x1e24('0x27')](saveUpdates(_0x34173c[_0x1e24('0x4a')],null))[_0x1e24('0x27')](respondWithResult(_0x143ec6,null))['catch'](handleError(_0x143ec6,null));};exports[_0x1e24('0x28')]=function(_0x39e766,_0x3225d0){return db[_0x1e24('0x2d')][_0x1e24('0x4c')]({'where':{'id':_0x39e766[_0x1e24('0x47')]['id']}})[_0x1e24('0x27')](handleEntityNotFound(_0x3225d0,null))[_0x1e24('0x27')](removeEntity(_0x3225d0,null))[_0x1e24('0x4b')](handleError(_0x3225d0,null));};exports['getConfigurations']=function(_0x36cc6e,_0x36b856,_0x51dce9){var _0x49c1ff={};var _0x49b790={};var _0x509086;var _0x315f63;return db[_0x1e24('0x2d')][_0x1e24('0x4d')]({'where':{'id':_0x36cc6e[_0x1e24('0x47')]['id']}})[_0x1e24('0x27')](handleEntityNotFound(_0x36b856,null))[_0x1e24('0x27')](function(_0x3b5fdd){if(_0x3b5fdd){_0x509086=_0x3b5fdd;_0x49b790[_0x1e24('0x33')]=_[_0x1e24('0x48')](db[_0x1e24('0x4e')][_0x1e24('0x2e')]);_0x49b790[_0x1e24('0x31')]=_[_0x1e24('0x48')](_0x36cc6e[_0x1e24('0x31')]);_0x49b790[_0x1e24('0x3d')]=_[_0x1e24('0x32')](_0x49b790['model'],_0x49b790['query']);_0x49c1ff[_0x1e24('0x34')]=_['intersection'](_0x49b790[_0x1e24('0x33')],qs[_0x1e24('0x35')](_0x36cc6e[_0x1e24('0x31')]['fields']));_0x49c1ff['attributes']=_0x49c1ff[_0x1e24('0x34')][_0x1e24('0x36')]?_0x49c1ff['attributes']:_0x49b790[_0x1e24('0x33')];_0x49c1ff['order']=qs['sort'](_0x36cc6e[_0x1e24('0x31')]['sort']);_0x49c1ff[_0x1e24('0x3b')]=qs[_0x1e24('0x3d')](_[_0x1e24('0x3c')](_0x36cc6e[_0x1e24('0x31')],_0x49b790[_0x1e24('0x3d')]));if(_0x36cc6e[_0x1e24('0x31')]['filter']){_0x49c1ff[_0x1e24('0x3b')]=_['merge'](_0x49c1ff[_0x1e24('0x3b')],{'$or':_[_0x1e24('0x2c')](_0x49c1ff[_0x1e24('0x34')],function(_0x551759){var _0x894227={};_0x894227[_0x551759]={'$like':'%'+_0x36cc6e[_0x1e24('0x31')]['filter']+'%'};return _0x894227;})});}_0x49c1ff=_['merge']({},_0x49c1ff,_0x36cc6e[_0x1e24('0x41')]);return _0x509086[_0x1e24('0x4f')](_0x49c1ff);}})[_0x1e24('0x27')](function(_0x311b60){if(_0x311b60){_0x315f63=_0x311b60[_0x1e24('0x36')];if(!_0x36cc6e[_0x1e24('0x31')][_0x1e24('0x37')](_0x1e24('0x38'))){_0x49c1ff[_0x1e24('0x21')]=qs['limit'](_0x36cc6e[_0x1e24('0x31')][_0x1e24('0x21')]);_0x49c1ff['offset']=qs['offset'](_0x36cc6e[_0x1e24('0x31')][_0x1e24('0x1e')]);}return _0x509086[_0x1e24('0x4f')](_0x49c1ff);}})['then'](function(_0x19dc3c){if(_0x19dc3c){return _0x19dc3c?{'count':_0x315f63,'rows':_0x19dc3c}:null;}})[_0x1e24('0x27')](respondWithResult(_0x36b856,null))[_0x1e24('0x4b')](handleError(_0x36b856,null));};exports[_0x1e24('0x50')]=function(_0x27f790,_0x2f6b97,_0xf1ef0d){if(_0x27f790[_0x1e24('0x4a')]['id']){delete _0x27f790['body']['id'];}return db[_0x1e24('0x2d')][_0x1e24('0x4d')]({'where':{'id':_0x27f790[_0x1e24('0x47')]['id']}})[_0x1e24('0x27')](handleEntityNotFound(_0x2f6b97,null))[_0x1e24('0x27')](function(_0x35ebd8){if(_0x35ebd8){_0x27f790['body']['AccountId']=_0x35ebd8['id'];_0x27f790[_0x1e24('0x4a')][_0x1e24('0x51')]=integrations['getSubjects'](_0x27f790['body'][_0x1e24('0x52')],_0x27f790[_0x1e24('0x4a')][_0x1e24('0x2f')]);_0x27f790[_0x1e24('0x4a')][_0x1e24('0x53')]=integrations[_0x1e24('0x54')](_0x27f790[_0x1e24('0x4a')][_0x1e24('0x52')],_0x27f790[_0x1e24('0x4a')][_0x1e24('0x2f')]);return db[_0x1e24('0x4e')][_0x1e24('0x49')](_0x27f790['body'],{'include':[{'model':db[_0x1e24('0x55')],'as':'Subjects'},{'model':db[_0x1e24('0x55')],'as':_0x1e24('0x53')}]});}return null;})[_0x1e24('0x27')](respondWithResult(_0x2f6b97,null))['catch'](handleError(_0x2f6b97,null));};exports[_0x1e24('0x56')]=function(_0x1d78d6,_0x36193b,_0xac2760){var _0x2bc087;var _0x45302e='';var _0x28da6b=_0x1e24('0x57');return db[_0x1e24('0x2d')]['findOne']({'where':{'id':_0x1d78d6[_0x1e24('0x47')]['id']},'attributes':['id',_0x1e24('0x58'),_0x1e24('0x59'),_0x1e24('0x5a'),_0x1e24('0x5b'),_0x1e24('0x5c'),_0x1e24('0x5d')]})['then'](handleEntityNotFound(_0x36193b,null))['then'](function(_0x1978cd){if(_0x1978cd){_0x45302e=_0x1978cd[_0x1e24('0x58')];var _0x50ee19=_0x45302e[_0x1e24('0x5e')](-0x1);if(_0x50ee19==='/'){_0x45302e=_0x45302e['substring'](0x0,_0x45302e[_0x1e24('0x5f')](_0x50ee19));}_0x2bc087=new jsforce['Connection']({'oauth2':{'loginUrl':_0x45302e,'clientId':_0x1978cd[_0x1e24('0x59')],'clientSecret':_0x1978cd[_0x1e24('0x5a')]}});return _0x2bc087[_0x1e24('0x60')](_0x1978cd[_0x1e24('0x5b')],_0x1978cd[_0x1e24('0x5c')][_0x1e24('0x61')](_0x1978cd[_0x1e24('0x5d')]));}})['then'](function(_0x2e6c08){if(_0x2e6c08){if(!_['isNil'](_0x1d78d6[_0x1e24('0x31')][_0x1e24('0x62')])){_0x28da6b=_0x1d78d6[_0x1e24('0x31')][_0x1e24('0x62')];}return _0x2bc087[_0x1e24('0x63')](_0x28da6b)[_0x1e24('0x64')]();}})[_0x1e24('0x27')](function(_0x126f8e){var _0x10e596=[_0x1e24('0x65'),_0x1e24('0x66'),_0x1e24('0x67'),_0x1e24('0x68'),'Subject',_0x1e24('0x69')];var _0x109289=['string',_0x1e24('0x6a'),_0x1e24('0x6b'),'boolean',_0x1e24('0x6c'),_0x1e24('0x6d'),'phone'];if(_0x126f8e){_['remove'](_0x126f8e[_0x1e24('0x35')],function(_0x4cadfd){return _0x10e596['includes'](_0x4cadfd[_0x1e24('0x2b')])||!_0x109289[_0x1e24('0x6e')](_0x4cadfd['type']);});return{'count':_0x126f8e[_0x1e24('0x35')][_0x1e24('0x36')],'rows':_[_0x1e24('0x2c')](_0x126f8e['fields'],function(_0x2fee95){return{'id':_0x2fee95[_0x1e24('0x2b')],'name':_0x2fee95[_0x1e24('0x6f')],'custom':_0x2fee95[_0x1e24('0x70')],'options':_0x2fee95[_0x1e24('0x71')][_0x1e24('0x36')]>0x0?_[_0x1e24('0x2c')](_0x2fee95[_0x1e24('0x71')],function(_0x427e0d){return{'name':_0x427e0d[_0x1e24('0x6f')],'value':_0x427e0d[_0x1e24('0x72')]};}):_0x2fee95[_0x1e24('0x2f')]==_0x1e24('0x73')?[{'name':'True','value':_0x1e24('0x74')},{'name':'False','value':_0x1e24('0x75')}]:[]};})};}})[_0x1e24('0x27')](respondWithResult(_0x36193b,null))['catch'](function(_0x501758){var _0xc97f1f=_0x1d78d6[_0x1e24('0x31')][_0x1e24('0x76')]?0x1f4:_0x501758['statusCode']||0x1f4;logger[_0x1e24('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x1e24('0x56'),_0xc97f1f,JSON[_0x1e24('0x77')](_0x501758));delete _0x501758[_0x1e24('0x2b')];if(_0xc97f1f===0x191){_0xc97f1f=0x190;}_0x36193b[_0x1e24('0x1c')](_0xc97f1f)['send'](_0x1d78d6[_0x1e24('0x31')]['test']?{'message':_0x1e24('0x78'),'statusCode':_0x501758['statusCode']}:_0x501758);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 711019c..d237915 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 _0x4905=['define','SalesforceAccount','int_salesforce_accounts','util','api','moment','bluebird','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x13c8d4,_0x56c017){var _0x5ce405=function(_0x470ba7){while(--_0x470ba7){_0x13c8d4['push'](_0x13c8d4['shift']());}};_0x5ce405(++_0x56c017);}(_0x4905,0xcf));var _0x5490=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x4905[_0x175a55];return _0x167adf;};'use strict';var _=require('lodash');var util=require(_0x5490('0x0'));var logger=require('../../config/logger')(_0x5490('0x1'));var moment=require(_0x5490('0x2'));var BPromise=require(_0x5490('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5490('0x4'));var rimraf=require('rimraf');var config=require(_0x5490('0x5'));var attributes=require(_0x5490('0x6'));var integrations=require(_0x5490('0x7'));module[_0x5490('0x8')]=function(_0x39bae8,_0x38428f){return _0x39bae8[_0x5490('0x9')](_0x5490('0xa'),attributes,{'tableName':_0x5490('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb8=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','../../config/logger','moment','bluebird','request-promise'];(function(_0x3ff6c6,_0x5be87a){var _0x533eb2=function(_0x2585ec){while(--_0x2585ec){_0x3ff6c6['push'](_0x3ff6c6['shift']());}};_0x533eb2(++_0x5be87a);}(_0xadb8,0x1d0));var _0x8adb=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0xadb8[_0x211fef];return _0x5447bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x8adb('0x8')]=function(_0x1a5f36,_0x9f435){return _0x1a5f36[_0x8adb('0x9')](_0x8adb('0xa'),attributes,{'tableName':_0x8adb('0xb'),'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 5e2deed..7a4d574 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 _0x6370=['then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','SalesforceAccount,\x20%s,\x20%s','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','include','map','model','stringify','ShowSalesforceAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0x6370,0x103));var _0x0637=function(_0x3c7e74,_0x431a67){_0x3c7e74=_0x3c7e74-0x0;var _0x5e7924=_0x6370[_0x3c7e74];return _0x5e7924;};'use strict';var _=require(_0x0637('0x0'));var util=require(_0x0637('0x1'));var moment=require('moment');var BPromise=require(_0x0637('0x2'));var rs=require(_0x0637('0x3'));var fs=require('fs');var Redis=require(_0x0637('0x4'));var db=require(_0x0637('0x5'))['db'];var utils=require(_0x0637('0x6'));var logger=require(_0x0637('0x7'))(_0x0637('0x8'));var config=require(_0x0637('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0637('0xa')][_0x0637('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x207907,_0x11e6a9,_0x50727b){return new BPromise(function(_0x10eed8,_0x52e4c5){return client[_0x0637('0xc')](_0x207907,_0x50727b)[_0x0637('0xd')](function(_0x3a71d9){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x11e6a9,_0x0637('0xe'));logger[_0x0637('0xf')](_0x0637('0x10'),_0x11e6a9,_0x0637('0xe'),JSON['stringify'](_0x3a71d9));if(_0x3a71d9[_0x0637('0x11')]){if(_0x3a71d9[_0x0637('0x11')][_0x0637('0x12')]===0x1f4){logger[_0x0637('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x11e6a9,_0x3a71d9['error'][_0x0637('0x13')]);return _0x52e4c5(_0x3a71d9[_0x0637('0x11')]['message']);}logger[_0x0637('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x11e6a9,_0x3a71d9[_0x0637('0x11')]['message']);return _0x10eed8(_0x3a71d9[_0x0637('0x11')][_0x0637('0x13')]);}else{logger[_0x0637('0x14')](_0x0637('0x15'),_0x11e6a9,_0x0637('0xe'));_0x10eed8(_0x3a71d9[_0x0637('0x16')][_0x0637('0x13')]);}})[_0x0637('0x17')](function(_0x42c977){logger[_0x0637('0x11')](_0x0637('0x15'),_0x11e6a9,_0x42c977);_0x52e4c5(_0x42c977);});});}exports[_0x0637('0x18')]=function(_0x26cf59){var _0x22b8d9=this;return new Promise(function(_0xf3c338,_0x964618){return db[_0x0637('0x19')]['findAll']({'raw':_0x26cf59[_0x0637('0x1a')]?_0x26cf59[_0x0637('0x1a')][_0x0637('0x1b')]===undefined?!![]:![]:!![],'where':_0x26cf59[_0x0637('0x1a')]?_0x26cf59['options']['where']||null:null,'attributes':_0x26cf59[_0x0637('0x1a')]?_0x26cf59[_0x0637('0x1a')][_0x0637('0x1c')]||null:null,'limit':_0x26cf59[_0x0637('0x1a')]?_0x26cf59[_0x0637('0x1a')]['limit']||null:null,'include':_0x26cf59[_0x0637('0x1a')]?_0x26cf59[_0x0637('0x1a')][_0x0637('0x1d')]?_[_0x0637('0x1e')](_0x26cf59[_0x0637('0x1a')][_0x0637('0x1d')],function(_0x20e76f){return{'model':db[_0x20e76f[_0x0637('0x1f')]],'as':_0x20e76f['as'],'attributes':_0x20e76f['attributes'],'include':_0x20e76f['include']?_[_0x0637('0x1e')](_0x20e76f['include'],function(_0x24e901){return{'model':db[_0x24e901[_0x0637('0x1f')]],'as':_0x24e901['as'],'attributes':_0x24e901[_0x0637('0x1c')],'include':_0x24e901[_0x0637('0x1d')]?_['map'](_0x24e901['include'],function(_0x5ff4af){return{'model':db[_0x5ff4af[_0x0637('0x1f')]],'as':_0x5ff4af['as'],'attributes':_0x5ff4af[_0x0637('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41540b){logger['info'](_0x0637('0x18'),_0x26cf59);logger[_0x0637('0xf')](_0x0637('0x18'),_0x26cf59,JSON[_0x0637('0x20')](_0x41540b));_0xf3c338(_0x41540b);})[_0x0637('0x17')](function(_0xdc9714){logger[_0x0637('0x11')]('GetSalesforceAccount',_0xdc9714[_0x0637('0x13')],_0x26cf59);_0x964618(_0x22b8d9[_0x0637('0x11')](0x1f4,_0xdc9714[_0x0637('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x50c32d){var _0x1fe2dc=this;return new Promise(function(_0x55fc9f,_0x38b23f){return db[_0x0637('0x19')]['find']({'raw':_0x50c32d[_0x0637('0x1a')]?_0x50c32d[_0x0637('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x50c32d['options']?_0x50c32d['options']['where']||null:null,'attributes':_0x50c32d[_0x0637('0x1a')]?_0x50c32d[_0x0637('0x1a')][_0x0637('0x1c')]||null:null,'include':_0x50c32d[_0x0637('0x1a')]?_0x50c32d[_0x0637('0x1a')][_0x0637('0x1d')]?_[_0x0637('0x1e')](_0x50c32d[_0x0637('0x1a')][_0x0637('0x1d')],function(_0x5ef5f5){return{'model':db[_0x5ef5f5[_0x0637('0x1f')]],'as':_0x5ef5f5['as'],'attributes':_0x5ef5f5[_0x0637('0x1c')],'include':_0x5ef5f5[_0x0637('0x1d')]?_[_0x0637('0x1e')](_0x5ef5f5[_0x0637('0x1d')],function(_0x23cd91){return{'model':db[_0x23cd91['model']],'as':_0x23cd91['as'],'attributes':_0x23cd91[_0x0637('0x1c')],'include':_0x23cd91['include']?_[_0x0637('0x1e')](_0x23cd91[_0x0637('0x1d')],function(_0x2d1aae){return{'model':db[_0x2d1aae[_0x0637('0x1f')]],'as':_0x2d1aae['as'],'attributes':_0x2d1aae[_0x0637('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0637('0xd')](function(_0x3b6f07){logger['info'](_0x0637('0x21'),_0x50c32d);logger[_0x0637('0xf')](_0x0637('0x21'),_0x50c32d,JSON[_0x0637('0x20')](_0x3b6f07));_0x55fc9f(_0x3b6f07);})[_0x0637('0x17')](function(_0x12fb91){logger['error']('ShowSalesforceAccount',_0x12fb91[_0x0637('0x13')],_0x50c32d);_0x38b23f(_0x1fe2dc[_0x0637('0x11')](0x1f4,_0x12fb91[_0x0637('0x13')]));});});}; \ No newline at end of file +var _0x9a0d=['client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','ShowSalesforceAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x150ce1,_0x26110d){var _0x58e09b=function(_0x2338db){while(--_0x2338db){_0x150ce1['push'](_0x150ce1['shift']());}};_0x58e09b(++_0x26110d);}(_0x9a0d,0x1ee));var _0xd9a0=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0x9a0d[_0x138d06];return _0x1a01eb;};'use strict';var _=require(_0xd9a0('0x0'));var util=require('util');var moment=require(_0xd9a0('0x1'));var BPromise=require(_0xd9a0('0x2'));var rs=require(_0xd9a0('0x3'));var fs=require('fs');var Redis=require(_0xd9a0('0x4'));var db=require(_0xd9a0('0x5'))['db'];var utils=require(_0xd9a0('0x6'));var logger=require(_0xd9a0('0x7'))('rpc');var config=require(_0xd9a0('0x8'));var jayson=require(_0xd9a0('0x9'));var client=jayson[_0xd9a0('0xa')][_0xd9a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4862de,_0x422d77,_0x3e3e27){return new BPromise(function(_0x2a0560,_0x17e5fc){return client[_0xd9a0('0xc')](_0x4862de,_0x3e3e27)['then'](function(_0x116c0e){logger[_0xd9a0('0xd')](_0xd9a0('0xe'),_0x422d77,_0xd9a0('0xf'));logger[_0xd9a0('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x422d77,_0xd9a0('0xf'),JSON['stringify'](_0x116c0e));if(_0x116c0e['error']){if(_0x116c0e[_0xd9a0('0x11')][_0xd9a0('0x12')]===0x1f4){logger[_0xd9a0('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x422d77,_0x116c0e['error'][_0xd9a0('0x13')]);return _0x17e5fc(_0x116c0e[_0xd9a0('0x11')][_0xd9a0('0x13')]);}logger[_0xd9a0('0x11')](_0xd9a0('0xe'),_0x422d77,_0x116c0e[_0xd9a0('0x11')][_0xd9a0('0x13')]);return _0x2a0560(_0x116c0e[_0xd9a0('0x11')][_0xd9a0('0x13')]);}else{logger[_0xd9a0('0xd')](_0xd9a0('0xe'),_0x422d77,_0xd9a0('0xf'));_0x2a0560(_0x116c0e[_0xd9a0('0x14')][_0xd9a0('0x13')]);}})[_0xd9a0('0x15')](function(_0x50b08c){logger['error'](_0xd9a0('0xe'),_0x422d77,_0x50b08c);_0x17e5fc(_0x50b08c);});});}exports[_0xd9a0('0x16')]=function(_0x3448f2){var _0x70720d=this;return new Promise(function(_0x531645,_0x150129){return db[_0xd9a0('0x17')][_0xd9a0('0x18')]({'raw':_0x3448f2['options']?_0x3448f2[_0xd9a0('0x19')][_0xd9a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x3448f2['options']?_0x3448f2['options']['where']||null:null,'attributes':_0x3448f2['options']?_0x3448f2[_0xd9a0('0x19')][_0xd9a0('0x1b')]||null:null,'limit':_0x3448f2[_0xd9a0('0x19')]?_0x3448f2[_0xd9a0('0x19')][_0xd9a0('0x1c')]||null:null,'include':_0x3448f2['options']?_0x3448f2[_0xd9a0('0x19')]['include']?_[_0xd9a0('0x1d')](_0x3448f2[_0xd9a0('0x19')][_0xd9a0('0x1e')],function(_0x14caea){return{'model':db[_0x14caea[_0xd9a0('0x1f')]],'as':_0x14caea['as'],'attributes':_0x14caea['attributes'],'include':_0x14caea['include']?_[_0xd9a0('0x1d')](_0x14caea[_0xd9a0('0x1e')],function(_0x5e0daf){return{'model':db[_0x5e0daf[_0xd9a0('0x1f')]],'as':_0x5e0daf['as'],'attributes':_0x5e0daf[_0xd9a0('0x1b')],'include':_0x5e0daf[_0xd9a0('0x1e')]?_[_0xd9a0('0x1d')](_0x5e0daf[_0xd9a0('0x1e')],function(_0x37c7ed){return{'model':db[_0x37c7ed['model']],'as':_0x37c7ed['as'],'attributes':_0x37c7ed[_0xd9a0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550ae1){logger[_0xd9a0('0xd')](_0xd9a0('0x16'),_0x3448f2);logger[_0xd9a0('0x10')](_0xd9a0('0x16'),_0x3448f2,JSON[_0xd9a0('0x20')](_0x550ae1));_0x531645(_0x550ae1);})['catch'](function(_0x1f93ac){logger['error'](_0xd9a0('0x16'),_0x1f93ac[_0xd9a0('0x13')],_0x3448f2);_0x150129(_0x70720d[_0xd9a0('0x11')](0x1f4,_0x1f93ac[_0xd9a0('0x13')]));});});};exports[_0xd9a0('0x21')]=function(_0x205f92){var _0x2f3ab6=this;return new Promise(function(_0x519936,_0x5e485e){return db[_0xd9a0('0x17')][_0xd9a0('0x22')]({'raw':_0x205f92[_0xd9a0('0x19')]?_0x205f92[_0xd9a0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x205f92[_0xd9a0('0x19')]?_0x205f92[_0xd9a0('0x19')][_0xd9a0('0x23')]||null:null,'attributes':_0x205f92[_0xd9a0('0x19')]?_0x205f92[_0xd9a0('0x19')][_0xd9a0('0x1b')]||null:null,'include':_0x205f92['options']?_0x205f92[_0xd9a0('0x19')][_0xd9a0('0x1e')]?_[_0xd9a0('0x1d')](_0x205f92[_0xd9a0('0x19')][_0xd9a0('0x1e')],function(_0x1b2912){return{'model':db[_0x1b2912[_0xd9a0('0x1f')]],'as':_0x1b2912['as'],'attributes':_0x1b2912['attributes'],'include':_0x1b2912['include']?_[_0xd9a0('0x1d')](_0x1b2912[_0xd9a0('0x1e')],function(_0x136379){return{'model':db[_0x136379[_0xd9a0('0x1f')]],'as':_0x136379['as'],'attributes':_0x136379[_0xd9a0('0x1b')],'include':_0x136379['include']?_['map'](_0x136379[_0xd9a0('0x1e')],function(_0x4b3408){return{'model':db[_0x4b3408[_0xd9a0('0x1f')]],'as':_0x4b3408['as'],'attributes':_0x4b3408['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e9b3e){logger['info'](_0xd9a0('0x21'),_0x205f92);logger[_0xd9a0('0x10')](_0xd9a0('0x21'),_0x205f92,JSON['stringify'](_0x4e9b3e));_0x519936(_0x4e9b3e);})[_0xd9a0('0x15')](function(_0x49d275){logger[_0xd9a0('0x11')](_0xd9a0('0x21'),_0x49d275[_0xd9a0('0x13')],_0x205f92);_0x5e485e(_0x2f3ab6[_0xd9a0('0x11')](0x1f4,_0x49d275['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b543710..9470da4 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x34e9d5,_0x1024ae){var _0x8a00ee=function(_0x603328){while(--_0x603328){_0x34e9d5['push'](_0x34e9d5['shift']());}};_0x8a00ee(++_0x1024ae);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a1e13,_0xff2238){_0x5a1e13=_0x5a1e13-0x0;var _0x248220=_0x5f2f[_0x5a1e13];return _0x248220;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xdb28,0x106));var _0x8db2=function(_0x2437fb,_0x1fb0ee){_0x2437fb=_0x2437fb-0x0;var _0x53c809=_0xdb28[_0x2437fb];return _0x53c809;};'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('./intSalesforceConfiguration.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['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index a31aec7..0cb9323 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 _0xc344=['account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead'];(function(_0x28daff,_0x130f0e){var _0x235abd=function(_0x278fe5){while(--_0x278fe5){_0x28daff['push'](_0x28daff['shift']());}};_0x235abd(++_0x130f0e);}(_0xc344,0x117));var _0x4c34=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xc344[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x4c34('0x0'));module[_0x4c34('0x1')]={'name':{'type':Sequelize[_0x4c34('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4c34('0x3')](_0x4c34('0x4'),_0x4c34('0x5')),'defaultValue':_0x4c34('0x4')},'moduleSearch':{'type':Sequelize[_0x4c34('0x3')](_0x4c34('0x6'),_0x4c34('0x7'),_0x4c34('0x8'),_0x4c34('0x9'),_0x4c34('0xa')),'defaultValue':_0x4c34('0x6')},'moduleCreate':{'type':Sequelize[_0x4c34('0x3')](_0x4c34('0xb'),_0x4c34('0x7'),_0x4c34('0x8'),_0x4c34('0xa')),'defaultValue':_0x4c34('0x8')},'leadId':{'type':Sequelize[_0x4c34('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x4c34('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x4c34('0x2')]}}; \ No newline at end of file +var _0x197c=['account','sequelize','exports','STRING','ENUM','Task','Case','contact','lead','account_contact_lead','contact_lead','nothing'];(function(_0x395cea,_0x1d3b1e){var _0x15576b=function(_0x36399e){while(--_0x36399e){_0x395cea['push'](_0x395cea['shift']());}};_0x15576b(++_0x1d3b1e);}(_0x197c,0xc1));var _0xc197=function(_0x10a00b,_0x2a3c2a){_0x10a00b=_0x10a00b-0x0;var _0x349213=_0x197c[_0x10a00b];return _0x349213;};'use strict';var Sequelize=require(_0xc197('0x0'));module[_0xc197('0x1')]={'name':{'type':Sequelize[_0xc197('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xc197('0x3')](_0xc197('0x4'),_0xc197('0x5')),'defaultValue':_0xc197('0x4')},'moduleSearch':{'type':Sequelize[_0xc197('0x3')]('contact_lead',_0xc197('0x6'),_0xc197('0x7'),_0xc197('0x8'),'account'),'defaultValue':_0xc197('0x9')},'moduleCreate':{'type':Sequelize[_0xc197('0x3')](_0xc197('0xa'),_0xc197('0x6'),_0xc197('0x7'),_0xc197('0xb')),'defaultValue':_0xc197('0x7')},'leadId':{'type':Sequelize[_0xc197('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xc197('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xc197('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xc197('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index b71ab23..5b7dcb7 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 _0x58dc=['rows','catch','show','params','rawAttributes','include','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','name','index','map','SalesforceConfiguration','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x58dc,0x199));var _0xc58d=function(_0x37bae9,_0x163213){_0x37bae9=_0x37bae9-0x0;var _0x2a37c8=_0x58dc[_0x37bae9];return _0x2a37c8;};'use strict';var emlformat=require(_0xc58d('0x0'));var rimraf=require(_0xc58d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc58d('0x2'));var rp=require(_0xc58d('0x3'));var moment=require(_0xc58d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc58d('0x5'));var util=require(_0xc58d('0x6'));var path=require(_0xc58d('0x7'));var sox=require(_0xc58d('0x8'));var csv=require(_0xc58d('0x9'));var ejs=require(_0xc58d('0xa'));var fs=require('fs');var fs_extra=require(_0xc58d('0xb'));var _=require(_0xc58d('0xc'));var squel=require('squel');var crypto=require(_0xc58d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc58d('0xe'));var toCsv=require(_0xc58d('0x9'));var querystring=require(_0xc58d('0xf'));var Papa=require(_0xc58d('0x10'));var Redis=require(_0xc58d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc58d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc58d('0x13'))('api');var utils=require(_0xc58d('0x14'));var config=require(_0xc58d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc58d('0x16'))['db'];function respondWithStatusCode(_0x210f1a,_0x5a3baa){_0x5a3baa=_0x5a3baa||0xcc;return function(_0x323375){if(_0x323375){return _0x210f1a[_0xc58d('0x17')](_0x5a3baa);}return _0x210f1a[_0xc58d('0x18')](_0x5a3baa)[_0xc58d('0x19')]();};}function respondWithResult(_0x2e5e3c,_0xb7b206){_0xb7b206=_0xb7b206||0xc8;return function(_0x4122fc){if(_0x4122fc){return _0x2e5e3c[_0xc58d('0x18')](_0xb7b206)[_0xc58d('0x1a')](_0x4122fc);}};}function respondWithFilteredResult(_0x118a40,_0x3be8e5){return function(_0x25619f){if(_0x25619f){var _0x157440=typeof _0x3be8e5[_0xc58d('0x1b')]===_0xc58d('0x1c')&&typeof _0x3be8e5['limit']===_0xc58d('0x1c');var _0x5352f9=_0x25619f['count'];var _0x49c17e=_0x157440?0x0:_0x3be8e5['offset'];var _0x3ffc8e=_0x157440?_0x25619f[_0xc58d('0x1d')]:_0x3be8e5[_0xc58d('0x1b')]+_0x3be8e5[_0xc58d('0x1e')];var _0x14e5cc;if(_0x3ffc8e>=_0x5352f9){_0x3ffc8e=_0x5352f9;_0x14e5cc=0xc8;}else{_0x14e5cc=0xce;}_0x118a40[_0xc58d('0x18')](_0x14e5cc);return _0x118a40[_0xc58d('0x1f')](_0xc58d('0x20'),_0x49c17e+'-'+_0x3ffc8e+'/'+_0x5352f9)[_0xc58d('0x1a')](_0x25619f);}return null;};}function patchUpdates(_0x43a737){return function(_0x34fbdf){try{jsonpatch[_0xc58d('0x21')](_0x34fbdf,_0x43a737,!![]);}catch(_0x45d2e9){return BPromise['reject'](_0x45d2e9);}return _0x34fbdf['save']();};}function saveUpdates(_0x457e59,_0xb94010){return function(_0x230bab){if(_0x230bab){return _0x230bab[_0xc58d('0x22')](_0x457e59)[_0xc58d('0x23')](function(_0x299c1){return _0x299c1;});}return null;};}function removeEntity(_0x362a90,_0x17b676){return function(_0x15b055){if(_0x15b055){return _0x15b055[_0xc58d('0x24')]()[_0xc58d('0x23')](function(){_0x362a90[_0xc58d('0x18')](0xcc)[_0xc58d('0x19')]();});}};}function handleEntityNotFound(_0x33f653,_0x1c9cdc){return function(_0x2c2cb7){if(!_0x2c2cb7){_0x33f653['sendStatus'](0x194);}return _0x2c2cb7;};}function handleError(_0x231497,_0x3a295a){_0x3a295a=_0x3a295a||0x1f4;return function(_0x5f5871){logger[_0xc58d('0x25')](_0x5f5871['stack']);if(_0x5f5871[_0xc58d('0x26')]){delete _0x5f5871[_0xc58d('0x26')];}_0x231497[_0xc58d('0x18')](_0x3a295a)['send'](_0x5f5871);};}exports[_0xc58d('0x27')]=function(_0x58638c,_0x2b5c9b){var _0xaf2907={},_0xbaebaa={},_0x175e32={'count':0x0,'rows':[]};var _0x2b40b1=_[_0xc58d('0x28')](db[_0xc58d('0x29')]['rawAttributes'],function(_0x482111){return{'name':_0x482111[_0xc58d('0x2a')],'type':_0x482111[_0xc58d('0x2b')][_0xc58d('0x2c')]};});_0xbaebaa['model']=_[_0xc58d('0x28')](_0x2b40b1,_0xc58d('0x26'));_0xbaebaa['query']=_[_0xc58d('0x2d')](_0x58638c[_0xc58d('0x2e')]);_0xbaebaa[_0xc58d('0x2f')]=_[_0xc58d('0x30')](_0xbaebaa['model'],_0xbaebaa[_0xc58d('0x2e')]);_0xaf2907[_0xc58d('0x31')]=_[_0xc58d('0x30')](_0xbaebaa[_0xc58d('0x32')],qs[_0xc58d('0x33')](_0x58638c[_0xc58d('0x2e')]['fields']));_0xaf2907[_0xc58d('0x31')]=_0xaf2907[_0xc58d('0x31')][_0xc58d('0x34')]?_0xaf2907[_0xc58d('0x31')]:_0xbaebaa[_0xc58d('0x32')];if(!_0x58638c[_0xc58d('0x2e')][_0xc58d('0x35')](_0xc58d('0x36'))){_0xaf2907[_0xc58d('0x1e')]=qs[_0xc58d('0x1e')](_0x58638c[_0xc58d('0x2e')][_0xc58d('0x1e')]);_0xaf2907[_0xc58d('0x1b')]=qs['offset'](_0x58638c[_0xc58d('0x2e')][_0xc58d('0x1b')]);}_0xaf2907[_0xc58d('0x37')]=qs['sort'](_0x58638c[_0xc58d('0x2e')][_0xc58d('0x38')]);_0xaf2907[_0xc58d('0x39')]=qs[_0xc58d('0x2f')](_[_0xc58d('0x3a')](_0x58638c[_0xc58d('0x2e')],_0xbaebaa['filters']),_0x2b40b1);if(_0x58638c[_0xc58d('0x2e')]['filter']){_0xaf2907['where']=_['merge'](_0xaf2907[_0xc58d('0x39')],{'$or':_[_0xc58d('0x28')](_0x2b40b1,function(_0x54ef96){if(_0x54ef96[_0xc58d('0x2b')]!==_0xc58d('0x3b')){var _0x4dea89={};_0x4dea89[_0x54ef96[_0xc58d('0x26')]]={'$like':'%'+_0x58638c[_0xc58d('0x2e')][_0xc58d('0x3c')]+'%'};return _0x4dea89;}})});}_0xaf2907=_[_0xc58d('0x3d')]({},_0xaf2907,_0x58638c[_0xc58d('0x3e')]);var _0x503933={'where':_0xaf2907[_0xc58d('0x39')]};return db[_0xc58d('0x29')][_0xc58d('0x1d')](_0x503933)['then'](function(_0x4d16b6){_0x175e32[_0xc58d('0x1d')]=_0x4d16b6;if(_0x58638c[_0xc58d('0x2e')][_0xc58d('0x3f')]){_0xaf2907['include']=[{'all':!![]}];}return db[_0xc58d('0x29')][_0xc58d('0x40')](_0xaf2907);})[_0xc58d('0x23')](function(_0x1fb37a){_0x175e32[_0xc58d('0x41')]=_0x1fb37a;return _0x175e32;})[_0xc58d('0x23')](respondWithFilteredResult(_0x2b5c9b,_0xaf2907))[_0xc58d('0x42')](handleError(_0x2b5c9b,null));};exports[_0xc58d('0x43')]=function(_0x2d794a,_0x550f7b){var _0x5a2f10={'raw':![],'where':{'id':_0x2d794a[_0xc58d('0x44')]['id']}},_0x12d86c={};_0x12d86c['model']=_[_0xc58d('0x2d')](db[_0xc58d('0x29')][_0xc58d('0x45')]);_0x12d86c[_0xc58d('0x2e')]=_[_0xc58d('0x2d')](_0x2d794a[_0xc58d('0x2e')]);_0x12d86c[_0xc58d('0x2f')]=_[_0xc58d('0x30')](_0x12d86c[_0xc58d('0x32')],_0x12d86c[_0xc58d('0x2e')]);_0x5a2f10[_0xc58d('0x31')]=_[_0xc58d('0x30')](_0x12d86c[_0xc58d('0x32')],qs[_0xc58d('0x33')](_0x2d794a[_0xc58d('0x2e')]['fields']));_0x5a2f10[_0xc58d('0x31')]=_0x5a2f10['attributes'][_0xc58d('0x34')]?_0x5a2f10[_0xc58d('0x31')]:_0x12d86c['model'];if(_0x2d794a[_0xc58d('0x2e')][_0xc58d('0x3f')]){_0x5a2f10[_0xc58d('0x46')]=[{'all':!![]}];}_0x5a2f10=_[_0xc58d('0x3d')]({},_0x5a2f10,_0x2d794a['options']);return db['SalesforceConfiguration'][_0xc58d('0x47')](_0x5a2f10)[_0xc58d('0x23')](handleEntityNotFound(_0x550f7b,null))[_0xc58d('0x23')](respondWithResult(_0x550f7b,null))[_0xc58d('0x42')](handleError(_0x550f7b,null));};exports[_0xc58d('0x48')]=function(_0x3fb87c,_0x3b4693){return db[_0xc58d('0x29')]['create'](_0x3fb87c[_0xc58d('0x49')],{})[_0xc58d('0x23')](respondWithResult(_0x3b4693,0xc9))[_0xc58d('0x42')](handleError(_0x3b4693,null));};exports['update']=function(_0x33c378,_0x2736d8){if(_0x33c378[_0xc58d('0x49')]['id']){delete _0x33c378[_0xc58d('0x49')]['id'];}return db[_0xc58d('0x29')][_0xc58d('0x47')]({'where':{'id':_0x33c378[_0xc58d('0x44')]['id']}})[_0xc58d('0x23')](handleEntityNotFound(_0x2736d8,null))[_0xc58d('0x23')](saveUpdates(_0x33c378[_0xc58d('0x49')],null))['then'](respondWithResult(_0x2736d8,null))[_0xc58d('0x42')](handleError(_0x2736d8,null));};exports[_0xc58d('0x24')]=function(_0x2f1190,_0x27e6ed){return db[_0xc58d('0x29')][_0xc58d('0x47')]({'where':{'id':_0x2f1190[_0xc58d('0x44')]['id']}})[_0xc58d('0x23')](handleEntityNotFound(_0x27e6ed,null))['then'](removeEntity(_0x27e6ed,null))['catch'](handleError(_0x27e6ed,null));};exports[_0xc58d('0x4a')]=function(_0x116ed6,_0x4dabde,_0x3f67c5){var _0x194400={};var _0x2b91cd={};var _0x46d324;var _0x2fdebd;return db[_0xc58d('0x29')][_0xc58d('0x4b')]({'where':{'id':_0x116ed6[_0xc58d('0x44')]['id']}})[_0xc58d('0x23')](handleEntityNotFound(_0x4dabde,null))[_0xc58d('0x23')](function(_0x38d5c3){if(_0x38d5c3){_0x46d324=_0x38d5c3;_0x2b91cd[_0xc58d('0x32')]=_[_0xc58d('0x2d')](db[_0xc58d('0x4c')][_0xc58d('0x45')]);_0x2b91cd[_0xc58d('0x2e')]=_['keys'](_0x116ed6[_0xc58d('0x2e')]);_0x2b91cd['filters']=_[_0xc58d('0x30')](_0x2b91cd[_0xc58d('0x32')],_0x2b91cd['query']);_0x194400[_0xc58d('0x31')]=_[_0xc58d('0x30')](_0x2b91cd[_0xc58d('0x32')],qs['fields'](_0x116ed6[_0xc58d('0x2e')]['fields']));_0x194400['attributes']=_0x194400[_0xc58d('0x31')][_0xc58d('0x34')]?_0x194400[_0xc58d('0x31')]:_0x2b91cd[_0xc58d('0x32')];_0x194400[_0xc58d('0x37')]=qs[_0xc58d('0x38')](_0x116ed6[_0xc58d('0x2e')][_0xc58d('0x38')]);_0x194400[_0xc58d('0x39')]=qs[_0xc58d('0x2f')](_[_0xc58d('0x3a')](_0x116ed6[_0xc58d('0x2e')],_0x2b91cd['filters']));if(_0x116ed6[_0xc58d('0x2e')]['filter']){_0x194400[_0xc58d('0x39')]=_[_0xc58d('0x3d')](_0x194400['where'],{'$or':_[_0xc58d('0x28')](_0x194400[_0xc58d('0x31')],function(_0x522699){var _0x20a7a8={};_0x20a7a8[_0x522699]={'$like':'%'+_0x116ed6[_0xc58d('0x2e')][_0xc58d('0x3c')]+'%'};return _0x20a7a8;})});}_0x194400=_['merge']({},_0x194400,_0x116ed6[_0xc58d('0x3e')]);return _0x46d324[_0xc58d('0x4a')](_0x194400);}})[_0xc58d('0x23')](function(_0x358fa0){if(_0x358fa0){_0x2fdebd=_0x358fa0['length'];if(!_0x116ed6['query']['hasOwnProperty'](_0xc58d('0x36'))){_0x194400[_0xc58d('0x1e')]=qs[_0xc58d('0x1e')](_0x116ed6[_0xc58d('0x2e')][_0xc58d('0x1e')]);_0x194400[_0xc58d('0x1b')]=qs['offset'](_0x116ed6['query'][_0xc58d('0x1b')]);}return _0x46d324[_0xc58d('0x4a')](_0x194400);}})[_0xc58d('0x23')](function(_0x2f1012){if(_0x2f1012){return _0x2f1012?{'count':_0x2fdebd,'rows':_0x2f1012}:null;}})[_0xc58d('0x23')](respondWithResult(_0x4dabde,null))['catch'](handleError(_0x4dabde,null));};exports[_0xc58d('0x4d')]=function(_0x4f7a11,_0x5a888c,_0x245c01){var _0x2753e0={};var _0x231e73={};var _0x13da06;var _0x52b9b9;return db[_0xc58d('0x29')]['findOne']({'where':{'id':_0x4f7a11['params']['id']}})['then'](handleEntityNotFound(_0x5a888c,null))[_0xc58d('0x23')](function(_0x546f6d){if(_0x546f6d){_0x13da06=_0x546f6d;_0x231e73[_0xc58d('0x32')]=_[_0xc58d('0x2d')](db['SalesforceField'][_0xc58d('0x45')]);_0x231e73['query']=_[_0xc58d('0x2d')](_0x4f7a11[_0xc58d('0x2e')]);_0x231e73[_0xc58d('0x2f')]=_['intersection'](_0x231e73[_0xc58d('0x32')],_0x231e73['query']);_0x2753e0[_0xc58d('0x31')]=_[_0xc58d('0x30')](_0x231e73['model'],qs[_0xc58d('0x33')](_0x4f7a11[_0xc58d('0x2e')][_0xc58d('0x33')]));_0x2753e0[_0xc58d('0x31')]=_0x2753e0[_0xc58d('0x31')][_0xc58d('0x34')]?_0x2753e0[_0xc58d('0x31')]:_0x231e73[_0xc58d('0x32')];_0x2753e0['order']=qs[_0xc58d('0x38')](_0x4f7a11[_0xc58d('0x2e')][_0xc58d('0x38')]);_0x2753e0[_0xc58d('0x39')]=qs[_0xc58d('0x2f')](_[_0xc58d('0x3a')](_0x4f7a11[_0xc58d('0x2e')],_0x231e73[_0xc58d('0x2f')]));if(_0x4f7a11['query'][_0xc58d('0x3c')]){_0x2753e0[_0xc58d('0x39')]=_[_0xc58d('0x3d')](_0x2753e0[_0xc58d('0x39')],{'$or':_['map'](_0x2753e0[_0xc58d('0x31')],function(_0x3432b9){var _0x57c748={};_0x57c748[_0x3432b9]={'$like':'%'+_0x4f7a11[_0xc58d('0x2e')]['filter']+'%'};return _0x57c748;})});}_0x2753e0=_['merge']({},_0x2753e0,_0x4f7a11['options']);return _0x13da06[_0xc58d('0x4d')](_0x2753e0);}})[_0xc58d('0x23')](function(_0x56ed5c){if(_0x56ed5c){_0x52b9b9=_0x56ed5c['length'];if(!_0x4f7a11[_0xc58d('0x2e')][_0xc58d('0x35')](_0xc58d('0x36'))){_0x2753e0[_0xc58d('0x1e')]=qs['limit'](_0x4f7a11[_0xc58d('0x2e')][_0xc58d('0x1e')]);_0x2753e0[_0xc58d('0x1b')]=qs[_0xc58d('0x1b')](_0x4f7a11[_0xc58d('0x2e')]['offset']);}return _0x13da06[_0xc58d('0x4d')](_0x2753e0);}})[_0xc58d('0x23')](function(_0x109033){if(_0x109033){return _0x109033?{'count':_0x52b9b9,'rows':_0x109033}:null;}})['then'](respondWithResult(_0x5a888c,null))['catch'](handleError(_0x5a888c,null));};exports['getDescriptions']=function(_0x19c1cc,_0x3f4bd5,_0x3afc8a){var _0x83cc4e={};var _0x35b1e7={};var _0x155b25;var _0x49f0e2;return db[_0xc58d('0x29')][_0xc58d('0x4b')]({'where':{'id':_0x19c1cc['params']['id']}})[_0xc58d('0x23')](handleEntityNotFound(_0x3f4bd5,null))[_0xc58d('0x23')](function(_0x385af6){if(_0x385af6){_0x155b25=_0x385af6;_0x35b1e7['model']=_[_0xc58d('0x2d')](db['SalesforceField'][_0xc58d('0x45')]);_0x35b1e7[_0xc58d('0x2e')]=_[_0xc58d('0x2d')](_0x19c1cc['query']);_0x35b1e7['filters']=_[_0xc58d('0x30')](_0x35b1e7[_0xc58d('0x32')],_0x35b1e7['query']);_0x83cc4e[_0xc58d('0x31')]=_[_0xc58d('0x30')](_0x35b1e7[_0xc58d('0x32')],qs[_0xc58d('0x33')](_0x19c1cc['query'][_0xc58d('0x33')]));_0x83cc4e[_0xc58d('0x31')]=_0x83cc4e[_0xc58d('0x31')]['length']?_0x83cc4e[_0xc58d('0x31')]:_0x35b1e7[_0xc58d('0x32')];_0x83cc4e['order']=qs[_0xc58d('0x38')](_0x19c1cc[_0xc58d('0x2e')][_0xc58d('0x38')]);_0x83cc4e[_0xc58d('0x39')]=qs[_0xc58d('0x2f')](_[_0xc58d('0x3a')](_0x19c1cc[_0xc58d('0x2e')],_0x35b1e7['filters']));if(_0x19c1cc[_0xc58d('0x2e')][_0xc58d('0x3c')]){_0x83cc4e[_0xc58d('0x39')]=_[_0xc58d('0x3d')](_0x83cc4e[_0xc58d('0x39')],{'$or':_['map'](_0x83cc4e['attributes'],function(_0x5e5e3a){var _0x5145b0={};_0x5145b0[_0x5e5e3a]={'$like':'%'+_0x19c1cc[_0xc58d('0x2e')][_0xc58d('0x3c')]+'%'};return _0x5145b0;})});}_0x83cc4e=_['merge']({},_0x83cc4e,_0x19c1cc[_0xc58d('0x3e')]);return _0x155b25[_0xc58d('0x4e')](_0x83cc4e);}})['then'](function(_0x772330){if(_0x772330){_0x49f0e2=_0x772330[_0xc58d('0x34')];if(!_0x19c1cc[_0xc58d('0x2e')][_0xc58d('0x35')](_0xc58d('0x36'))){_0x83cc4e[_0xc58d('0x1e')]=qs[_0xc58d('0x1e')](_0x19c1cc[_0xc58d('0x2e')][_0xc58d('0x1e')]);_0x83cc4e[_0xc58d('0x1b')]=qs[_0xc58d('0x1b')](_0x19c1cc[_0xc58d('0x2e')][_0xc58d('0x1b')]);}return _0x155b25[_0xc58d('0x4e')](_0x83cc4e);}})[_0xc58d('0x23')](function(_0x31ab99){if(_0x31ab99){return _0x31ab99?{'count':_0x49f0e2,'rows':_0x31ab99}:null;}})['then'](respondWithResult(_0x3f4bd5,null))[_0xc58d('0x42')](handleError(_0x3f4bd5,null));}; \ No newline at end of file +var _0x83f1=['find','create','body','findOne','SalesforceField','getFields','nolimit','catch','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','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','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','show','params','keys','includeAll'];(function(_0x29db98,_0x546288){var _0x1ea00a=function(_0x378d55){while(--_0x378d55){_0x29db98['push'](_0x29db98['shift']());}};_0x1ea00a(++_0x546288);}(_0x83f1,0xa8));var _0x183f=function(_0x27a239,_0x2531bd){_0x27a239=_0x27a239-0x0;var _0x26c6f9=_0x83f1[_0x27a239];return _0x26c6f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x183f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x183f('0x1'));var rp=require(_0x183f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x183f('0x3'));var util=require('util');var path=require(_0x183f('0x4'));var sox=require(_0x183f('0x5'));var csv=require(_0x183f('0x6'));var ejs=require(_0x183f('0x7'));var fs=require('fs');var fs_extra=require(_0x183f('0x8'));var _=require('lodash');var squel=require(_0x183f('0x9'));var crypto=require('crypto');var jsforce=require(_0x183f('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x183f('0xb'));var Redis=require(_0x183f('0xc'));var authService=require(_0x183f('0xd'));var qs=require(_0x183f('0xe'));var as=require(_0x183f('0xf'));var hardwareService=require(_0x183f('0x10'));var logger=require('../../config/logger')(_0x183f('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x183f('0x12'));var db=require(_0x183f('0x13'))['db'];function respondWithStatusCode(_0x125f8c,_0x5c25eb){_0x5c25eb=_0x5c25eb||0xcc;return function(_0x2e41aa){if(_0x2e41aa){return _0x125f8c[_0x183f('0x14')](_0x5c25eb);}return _0x125f8c[_0x183f('0x15')](_0x5c25eb)[_0x183f('0x16')]();};}function respondWithResult(_0xfbafbb,_0x21155c){_0x21155c=_0x21155c||0xc8;return function(_0x2b5827){if(_0x2b5827){return _0xfbafbb[_0x183f('0x15')](_0x21155c)[_0x183f('0x17')](_0x2b5827);}};}function respondWithFilteredResult(_0x5ec14d,_0x410293){return function(_0x5a6747){if(_0x5a6747){var _0x4a0d4f=typeof _0x410293[_0x183f('0x18')]===_0x183f('0x19')&&typeof _0x410293[_0x183f('0x1a')]===_0x183f('0x19');var _0x16953f=_0x5a6747[_0x183f('0x1b')];var _0x5b8d07=_0x4a0d4f?0x0:_0x410293['offset'];var _0x1fa418=_0x4a0d4f?_0x5a6747[_0x183f('0x1b')]:_0x410293[_0x183f('0x18')]+_0x410293['limit'];var _0xfcb735;if(_0x1fa418>=_0x16953f){_0x1fa418=_0x16953f;_0xfcb735=0xc8;}else{_0xfcb735=0xce;}_0x5ec14d['status'](_0xfcb735);return _0x5ec14d[_0x183f('0x1c')](_0x183f('0x1d'),_0x5b8d07+'-'+_0x1fa418+'/'+_0x16953f)[_0x183f('0x17')](_0x5a6747);}return null;};}function patchUpdates(_0x3addd4){return function(_0x1ad46a){try{jsonpatch[_0x183f('0x1e')](_0x1ad46a,_0x3addd4,!![]);}catch(_0x4d0c26){return BPromise[_0x183f('0x1f')](_0x4d0c26);}return _0x1ad46a[_0x183f('0x20')]();};}function saveUpdates(_0x11cdae,_0x26950a){return function(_0x39b8d3){if(_0x39b8d3){return _0x39b8d3[_0x183f('0x21')](_0x11cdae)['then'](function(_0x5d8b6f){return _0x5d8b6f;});}return null;};}function removeEntity(_0x15f744,_0x4e75a6){return function(_0x1f1881){if(_0x1f1881){return _0x1f1881[_0x183f('0x22')]()['then'](function(){_0x15f744['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ba657,_0xe248e4){return function(_0x46cf3b){if(!_0x46cf3b){_0x5ba657['sendStatus'](0x194);}return _0x46cf3b;};}function handleError(_0x291327,_0x149cfc){_0x149cfc=_0x149cfc||0x1f4;return function(_0x513f18){logger[_0x183f('0x23')](_0x513f18[_0x183f('0x24')]);if(_0x513f18[_0x183f('0x25')]){delete _0x513f18['name'];}_0x291327[_0x183f('0x15')](_0x149cfc)[_0x183f('0x26')](_0x513f18);};}exports[_0x183f('0x27')]=function(_0x4c235c,_0x889644){var _0x3de834={},_0x2a8868={},_0x256b2c={'count':0x0,'rows':[]};var _0x405d61=_[_0x183f('0x28')](db[_0x183f('0x29')][_0x183f('0x2a')],function(_0x401435){return{'name':_0x401435[_0x183f('0x2b')],'type':_0x401435[_0x183f('0x2c')]['key']};});_0x2a8868['model']=_[_0x183f('0x28')](_0x405d61,_0x183f('0x25'));_0x2a8868[_0x183f('0x2d')]=_['keys'](_0x4c235c['query']);_0x2a8868[_0x183f('0x2e')]=_[_0x183f('0x2f')](_0x2a8868[_0x183f('0x30')],_0x2a8868[_0x183f('0x2d')]);_0x3de834[_0x183f('0x31')]=_[_0x183f('0x2f')](_0x2a8868[_0x183f('0x30')],qs[_0x183f('0x32')](_0x4c235c[_0x183f('0x2d')][_0x183f('0x32')]));_0x3de834[_0x183f('0x31')]=_0x3de834['attributes'][_0x183f('0x33')]?_0x3de834[_0x183f('0x31')]:_0x2a8868[_0x183f('0x30')];if(!_0x4c235c['query'][_0x183f('0x34')]('nolimit')){_0x3de834[_0x183f('0x1a')]=qs[_0x183f('0x1a')](_0x4c235c[_0x183f('0x2d')][_0x183f('0x1a')]);_0x3de834[_0x183f('0x18')]=qs['offset'](_0x4c235c[_0x183f('0x2d')][_0x183f('0x18')]);}_0x3de834[_0x183f('0x35')]=qs['sort'](_0x4c235c['query'][_0x183f('0x36')]);_0x3de834[_0x183f('0x37')]=qs['filters'](_[_0x183f('0x38')](_0x4c235c[_0x183f('0x2d')],_0x2a8868[_0x183f('0x2e')]),_0x405d61);if(_0x4c235c['query'][_0x183f('0x39')]){_0x3de834['where']=_[_0x183f('0x3a')](_0x3de834[_0x183f('0x37')],{'$or':_[_0x183f('0x28')](_0x405d61,function(_0x2f5e50){if(_0x2f5e50[_0x183f('0x2c')]!==_0x183f('0x3b')){var _0x4e557f={};_0x4e557f[_0x2f5e50['name']]={'$like':'%'+_0x4c235c['query'][_0x183f('0x39')]+'%'};return _0x4e557f;}})});}_0x3de834=_[_0x183f('0x3a')]({},_0x3de834,_0x4c235c[_0x183f('0x3c')]);var _0x418867={'where':_0x3de834[_0x183f('0x37')]};return db['SalesforceConfiguration'][_0x183f('0x1b')](_0x418867)[_0x183f('0x3d')](function(_0x1ff558){_0x256b2c[_0x183f('0x1b')]=_0x1ff558;if(_0x4c235c['query']['includeAll']){_0x3de834[_0x183f('0x3e')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x183f('0x3f')](_0x3de834);})[_0x183f('0x3d')](function(_0x4821d3){_0x256b2c[_0x183f('0x40')]=_0x4821d3;return _0x256b2c;})['then'](respondWithFilteredResult(_0x889644,_0x3de834))['catch'](handleError(_0x889644,null));};exports[_0x183f('0x41')]=function(_0x529e65,_0x556766){var _0x7f865d={'raw':![],'where':{'id':_0x529e65[_0x183f('0x42')]['id']}},_0x53c751={};_0x53c751['model']=_[_0x183f('0x43')](db[_0x183f('0x29')]['rawAttributes']);_0x53c751[_0x183f('0x2d')]=_[_0x183f('0x43')](_0x529e65['query']);_0x53c751[_0x183f('0x2e')]=_[_0x183f('0x2f')](_0x53c751[_0x183f('0x30')],_0x53c751['query']);_0x7f865d[_0x183f('0x31')]=_[_0x183f('0x2f')](_0x53c751[_0x183f('0x30')],qs['fields'](_0x529e65[_0x183f('0x2d')][_0x183f('0x32')]));_0x7f865d['attributes']=_0x7f865d[_0x183f('0x31')]['length']?_0x7f865d[_0x183f('0x31')]:_0x53c751[_0x183f('0x30')];if(_0x529e65['query'][_0x183f('0x44')]){_0x7f865d[_0x183f('0x3e')]=[{'all':!![]}];}_0x7f865d=_[_0x183f('0x3a')]({},_0x7f865d,_0x529e65[_0x183f('0x3c')]);return db['SalesforceConfiguration'][_0x183f('0x45')](_0x7f865d)[_0x183f('0x3d')](handleEntityNotFound(_0x556766,null))[_0x183f('0x3d')](respondWithResult(_0x556766,null))['catch'](handleError(_0x556766,null));};exports['create']=function(_0x4fc826,_0x4b3203){return db['SalesforceConfiguration'][_0x183f('0x46')](_0x4fc826[_0x183f('0x47')],{})[_0x183f('0x3d')](respondWithResult(_0x4b3203,0xc9))['catch'](handleError(_0x4b3203,null));};exports[_0x183f('0x21')]=function(_0x3c086a,_0x2d93b4){if(_0x3c086a['body']['id']){delete _0x3c086a[_0x183f('0x47')]['id'];}return db[_0x183f('0x29')][_0x183f('0x45')]({'where':{'id':_0x3c086a[_0x183f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d93b4,null))[_0x183f('0x3d')](saveUpdates(_0x3c086a[_0x183f('0x47')],null))[_0x183f('0x3d')](respondWithResult(_0x2d93b4,null))['catch'](handleError(_0x2d93b4,null));};exports[_0x183f('0x22')]=function(_0x5ac385,_0x58d21b){return db['SalesforceConfiguration'][_0x183f('0x45')]({'where':{'id':_0x5ac385[_0x183f('0x42')]['id']}})[_0x183f('0x3d')](handleEntityNotFound(_0x58d21b,null))[_0x183f('0x3d')](removeEntity(_0x58d21b,null))['catch'](handleError(_0x58d21b,null));};exports['getFields']=function(_0x3e1bdd,_0x1ab71f,_0x20fbee){var _0x275c3f={};var _0x5bf410={};var _0x1e808c;var _0x351cb5;return db[_0x183f('0x29')][_0x183f('0x48')]({'where':{'id':_0x3e1bdd['params']['id']}})['then'](handleEntityNotFound(_0x1ab71f,null))['then'](function(_0x11bf26){if(_0x11bf26){_0x1e808c=_0x11bf26;_0x5bf410['model']=_['keys'](db[_0x183f('0x49')]['rawAttributes']);_0x5bf410['query']=_[_0x183f('0x43')](_0x3e1bdd['query']);_0x5bf410['filters']=_[_0x183f('0x2f')](_0x5bf410[_0x183f('0x30')],_0x5bf410['query']);_0x275c3f[_0x183f('0x31')]=_[_0x183f('0x2f')](_0x5bf410[_0x183f('0x30')],qs['fields'](_0x3e1bdd[_0x183f('0x2d')][_0x183f('0x32')]));_0x275c3f['attributes']=_0x275c3f[_0x183f('0x31')][_0x183f('0x33')]?_0x275c3f[_0x183f('0x31')]:_0x5bf410[_0x183f('0x30')];_0x275c3f[_0x183f('0x35')]=qs[_0x183f('0x36')](_0x3e1bdd['query'][_0x183f('0x36')]);_0x275c3f[_0x183f('0x37')]=qs['filters'](_['pick'](_0x3e1bdd[_0x183f('0x2d')],_0x5bf410[_0x183f('0x2e')]));if(_0x3e1bdd[_0x183f('0x2d')][_0x183f('0x39')]){_0x275c3f['where']=_['merge'](_0x275c3f[_0x183f('0x37')],{'$or':_[_0x183f('0x28')](_0x275c3f[_0x183f('0x31')],function(_0x387ecd){var _0x333a04={};_0x333a04[_0x387ecd]={'$like':'%'+_0x3e1bdd[_0x183f('0x2d')][_0x183f('0x39')]+'%'};return _0x333a04;})});}_0x275c3f=_['merge']({},_0x275c3f,_0x3e1bdd[_0x183f('0x3c')]);return _0x1e808c[_0x183f('0x4a')](_0x275c3f);}})[_0x183f('0x3d')](function(_0x4c3519){if(_0x4c3519){_0x351cb5=_0x4c3519[_0x183f('0x33')];if(!_0x3e1bdd[_0x183f('0x2d')][_0x183f('0x34')](_0x183f('0x4b'))){_0x275c3f['limit']=qs[_0x183f('0x1a')](_0x3e1bdd['query'][_0x183f('0x1a')]);_0x275c3f[_0x183f('0x18')]=qs[_0x183f('0x18')](_0x3e1bdd[_0x183f('0x2d')]['offset']);}return _0x1e808c[_0x183f('0x4a')](_0x275c3f);}})[_0x183f('0x3d')](function(_0x3f0bfd){if(_0x3f0bfd){return _0x3f0bfd?{'count':_0x351cb5,'rows':_0x3f0bfd}:null;}})[_0x183f('0x3d')](respondWithResult(_0x1ab71f,null))[_0x183f('0x4c')](handleError(_0x1ab71f,null));};exports[_0x183f('0x4d')]=function(_0x5bbe06,_0x2d725f,_0x3ca12a){var _0x45efcb={};var _0x16e2fb={};var _0x4057e6;var _0x31d49c;return db[_0x183f('0x29')][_0x183f('0x48')]({'where':{'id':_0x5bbe06[_0x183f('0x42')]['id']}})[_0x183f('0x3d')](handleEntityNotFound(_0x2d725f,null))[_0x183f('0x3d')](function(_0x455e11){if(_0x455e11){_0x4057e6=_0x455e11;_0x16e2fb[_0x183f('0x30')]=_[_0x183f('0x43')](db[_0x183f('0x49')][_0x183f('0x2a')]);_0x16e2fb['query']=_[_0x183f('0x43')](_0x5bbe06[_0x183f('0x2d')]);_0x16e2fb[_0x183f('0x2e')]=_[_0x183f('0x2f')](_0x16e2fb[_0x183f('0x30')],_0x16e2fb[_0x183f('0x2d')]);_0x45efcb['attributes']=_['intersection'](_0x16e2fb[_0x183f('0x30')],qs[_0x183f('0x32')](_0x5bbe06[_0x183f('0x2d')][_0x183f('0x32')]));_0x45efcb['attributes']=_0x45efcb[_0x183f('0x31')]['length']?_0x45efcb[_0x183f('0x31')]:_0x16e2fb[_0x183f('0x30')];_0x45efcb[_0x183f('0x35')]=qs[_0x183f('0x36')](_0x5bbe06['query'][_0x183f('0x36')]);_0x45efcb['where']=qs[_0x183f('0x2e')](_[_0x183f('0x38')](_0x5bbe06['query'],_0x16e2fb[_0x183f('0x2e')]));if(_0x5bbe06[_0x183f('0x2d')]['filter']){_0x45efcb[_0x183f('0x37')]=_[_0x183f('0x3a')](_0x45efcb['where'],{'$or':_['map'](_0x45efcb[_0x183f('0x31')],function(_0x1e71f5){var _0x5d6267={};_0x5d6267[_0x1e71f5]={'$like':'%'+_0x5bbe06[_0x183f('0x2d')][_0x183f('0x39')]+'%'};return _0x5d6267;})});}_0x45efcb=_[_0x183f('0x3a')]({},_0x45efcb,_0x5bbe06[_0x183f('0x3c')]);return _0x4057e6[_0x183f('0x4d')](_0x45efcb);}})['then'](function(_0x184545){if(_0x184545){_0x31d49c=_0x184545[_0x183f('0x33')];if(!_0x5bbe06['query'][_0x183f('0x34')](_0x183f('0x4b'))){_0x45efcb[_0x183f('0x1a')]=qs['limit'](_0x5bbe06[_0x183f('0x2d')][_0x183f('0x1a')]);_0x45efcb[_0x183f('0x18')]=qs[_0x183f('0x18')](_0x5bbe06[_0x183f('0x2d')][_0x183f('0x18')]);}return _0x4057e6[_0x183f('0x4d')](_0x45efcb);}})[_0x183f('0x3d')](function(_0x26547d){if(_0x26547d){return _0x26547d?{'count':_0x31d49c,'rows':_0x26547d}:null;}})[_0x183f('0x3d')](respondWithResult(_0x2d725f,null))[_0x183f('0x4c')](handleError(_0x2d725f,null));};exports['getDescriptions']=function(_0x211830,_0x4b3c46,_0x2a77c6){var _0x13b600={};var _0x189caa={};var _0x1217b8;var _0x559513;return db[_0x183f('0x29')][_0x183f('0x48')]({'where':{'id':_0x211830[_0x183f('0x42')]['id']}})[_0x183f('0x3d')](handleEntityNotFound(_0x4b3c46,null))[_0x183f('0x3d')](function(_0x3e9beb){if(_0x3e9beb){_0x1217b8=_0x3e9beb;_0x189caa['model']=_[_0x183f('0x43')](db[_0x183f('0x49')][_0x183f('0x2a')]);_0x189caa[_0x183f('0x2d')]=_['keys'](_0x211830[_0x183f('0x2d')]);_0x189caa[_0x183f('0x2e')]=_[_0x183f('0x2f')](_0x189caa[_0x183f('0x30')],_0x189caa['query']);_0x13b600[_0x183f('0x31')]=_[_0x183f('0x2f')](_0x189caa['model'],qs[_0x183f('0x32')](_0x211830['query'][_0x183f('0x32')]));_0x13b600['attributes']=_0x13b600[_0x183f('0x31')][_0x183f('0x33')]?_0x13b600[_0x183f('0x31')]:_0x189caa[_0x183f('0x30')];_0x13b600['order']=qs[_0x183f('0x36')](_0x211830['query'][_0x183f('0x36')]);_0x13b600[_0x183f('0x37')]=qs[_0x183f('0x2e')](_['pick'](_0x211830[_0x183f('0x2d')],_0x189caa[_0x183f('0x2e')]));if(_0x211830[_0x183f('0x2d')]['filter']){_0x13b600[_0x183f('0x37')]=_['merge'](_0x13b600[_0x183f('0x37')],{'$or':_[_0x183f('0x28')](_0x13b600[_0x183f('0x31')],function(_0x3ca480){var _0x565eb8={};_0x565eb8[_0x3ca480]={'$like':'%'+_0x211830['query'][_0x183f('0x39')]+'%'};return _0x565eb8;})});}_0x13b600=_[_0x183f('0x3a')]({},_0x13b600,_0x211830[_0x183f('0x3c')]);return _0x1217b8[_0x183f('0x4e')](_0x13b600);}})[_0x183f('0x3d')](function(_0x41d364){if(_0x41d364){_0x559513=_0x41d364[_0x183f('0x33')];if(!_0x211830[_0x183f('0x2d')][_0x183f('0x34')]('nolimit')){_0x13b600[_0x183f('0x1a')]=qs[_0x183f('0x1a')](_0x211830[_0x183f('0x2d')]['limit']);_0x13b600['offset']=qs['offset'](_0x211830[_0x183f('0x2d')][_0x183f('0x18')]);}return _0x1217b8[_0x183f('0x4e')](_0x13b600);}})[_0x183f('0x3d')](function(_0x1b2361){if(_0x1b2361){return _0x1b2361?{'count':_0x559513,'rows':_0x1b2361}:null;}})[_0x183f('0x3d')](respondWithResult(_0x4b3c46,null))[_0x183f('0x4c')](handleError(_0x4b3c46,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 790692c..03b6dcd 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 _0xc38e=['path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x133b33,_0x4683ba){var _0xbd298d=function(_0x3a6dc9){while(--_0x3a6dc9){_0x133b33['push'](_0x133b33['shift']());}};_0xbd298d(++_0x4683ba);}(_0xc38e,0x1db));var _0xec38=function(_0x3022b7,_0x558e74){_0x3022b7=_0x3022b7-0x0;var _0x30a13b=_0xc38e[_0x3022b7];return _0x30a13b;};'use strict';var _=require(_0xec38('0x0'));var util=require(_0xec38('0x1'));var logger=require(_0xec38('0x2'))('api');var moment=require(_0xec38('0x3'));var BPromise=require(_0xec38('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec38('0x5'));var rimraf=require(_0xec38('0x6'));var config=require(_0xec38('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xec38('0x8')]=function(_0x3f35ef,_0x477cb3){return _0x3f35ef[_0xec38('0x9')](_0xec38('0xa'),attributes,{'tableName':_0xec38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f9a=['path','rimraf','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x37725a,_0x57438c){var _0x2e15de=function(_0x356e58){while(--_0x356e58){_0x37725a['push'](_0x37725a['shift']());}};_0x2e15de(++_0x57438c);}(_0x0f9a,0x14a));var _0xa0f9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0f9a[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0xa0f9('0x0'));var logger=require(_0xa0f9('0x1'))(_0xa0f9('0x2'));var moment=require(_0xa0f9('0x3'));var BPromise=require(_0xa0f9('0x4'));var rp=require(_0xa0f9('0x5'));var fs=require('fs');var path=require(_0xa0f9('0x6'));var rimraf=require(_0xa0f9('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0f9('0x8'));module[_0xa0f9('0x9')]=function(_0x5ef62a,_0x4dd6b9){return _0x5ef62a['define'](_0xa0f9('0xa'),attributes,{'tableName':_0xa0f9('0xb'),'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 a46e87b..11bc33c 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 _0x41bb=['then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4dbff0,_0xd80451){var _0xf762b6=function(_0x3b5c4f){while(--_0x3b5c4f){_0x4dbff0['push'](_0x4dbff0['shift']());}};_0xf762b6(++_0xd80451);}(_0x41bb,0xf0));var _0xb41b=function(_0x2bc6ba,_0x29a548){_0x2bc6ba=_0x2bc6ba-0x0;var _0x37741f=_0x41bb[_0x2bc6ba];return _0x37741f;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require(_0xb41b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))(_0xb41b('0x7'));var config=require('../../config/environment');var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')][_0xb41b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b74c,_0x41f97f,_0x2e0f66){return new BPromise(function(_0x286f70,_0x4e273b){return client[_0xb41b('0xb')](_0x14b74c,_0x2e0f66)[_0xb41b('0xc')](function(_0x15b426){logger['info'](_0xb41b('0xd'),_0x41f97f,_0xb41b('0xe'));logger['debug'](_0xb41b('0xf'),_0x41f97f,_0xb41b('0xe'),JSON['stringify'](_0x15b426));if(_0x15b426[_0xb41b('0x10')]){if(_0x15b426['error'][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x41f97f,_0x15b426[_0xb41b('0x10')]['message']);return _0x4e273b(_0x15b426['error']['message']);}logger['error'](_0xb41b('0xd'),_0x41f97f,_0x15b426[_0xb41b('0x10')][_0xb41b('0x12')]);return _0x286f70(_0x15b426['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0x13')](_0xb41b('0xd'),_0x41f97f,_0xb41b('0xe'));_0x286f70(_0x15b426[_0xb41b('0x14')][_0xb41b('0x12')]);}})['catch'](function(_0x3b0325){logger['error'](_0xb41b('0xd'),_0x41f97f,_0x3b0325);_0x4e273b(_0x3b0325);});});} \ No newline at end of file +var _0xdb92=['error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0xdb92,0xea));var _0x2db9=function(_0x20813a,_0x3a3212){_0x20813a=_0x20813a-0x0;var _0x269542=_0xdb92[_0x20813a];return _0x269542;};'use strict';var _=require(_0x2db9('0x0'));var util=require(_0x2db9('0x1'));var moment=require('moment');var BPromise=require(_0x2db9('0x2'));var rs=require(_0x2db9('0x3'));var fs=require('fs');var Redis=require(_0x2db9('0x4'));var db=require(_0x2db9('0x5'))['db'];var utils=require(_0x2db9('0x6'));var logger=require('../../config/logger')(_0x2db9('0x7'));var config=require(_0x2db9('0x8'));var jayson=require(_0x2db9('0x9'));var client=jayson[_0x2db9('0xa')][_0x2db9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1edc02,_0x2f2490,_0x395fcc){return new BPromise(function(_0x2b9deb,_0x4fa44f){return client[_0x2db9('0xc')](_0x1edc02,_0x395fcc)['then'](function(_0x4989fa){logger[_0x2db9('0xd')](_0x2db9('0xe'),_0x2f2490,_0x2db9('0xf'));logger[_0x2db9('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x2f2490,_0x2db9('0xf'),JSON[_0x2db9('0x11')](_0x4989fa));if(_0x4989fa[_0x2db9('0x12')]){if(_0x4989fa[_0x2db9('0x12')]['code']===0x1f4){logger[_0x2db9('0x12')](_0x2db9('0xe'),_0x2f2490,_0x4989fa[_0x2db9('0x12')][_0x2db9('0x13')]);return _0x4fa44f(_0x4989fa[_0x2db9('0x12')][_0x2db9('0x13')]);}logger[_0x2db9('0x12')](_0x2db9('0xe'),_0x2f2490,_0x4989fa[_0x2db9('0x12')][_0x2db9('0x13')]);return _0x2b9deb(_0x4989fa[_0x2db9('0x12')][_0x2db9('0x13')]);}else{logger[_0x2db9('0xd')](_0x2db9('0xe'),_0x2f2490,'request\x20sent');_0x2b9deb(_0x4989fa['result'][_0x2db9('0x13')]);}})[_0x2db9('0x14')](function(_0x2c1bb5){logger[_0x2db9('0x12')](_0x2db9('0xe'),_0x2f2490,_0x2c1bb5);_0x4fa44f(_0x2c1bb5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e94cdd0..88b85ea 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 _0xb3cc=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x39f11d,_0x14b150){var _0x4edf74=function(_0x42eea3){while(--_0x42eea3){_0x39f11d['push'](_0x39f11d['shift']());}};_0x4edf74(++_0x14b150);}(_0xb3cc,0xd3));var _0xcb3c=function(_0x254085,_0x42a67a){_0x254085=_0x254085-0x0;var _0x274248=_0xb3cc[_0x254085];return _0x274248;};'use strict';var multer=require(_0xcb3c('0x0'));var util=require('util');var path=require(_0xcb3c('0x1'));var timeout=require(_0xcb3c('0x2'));var express=require(_0xcb3c('0x3'));var router=express[_0xcb3c('0x4')]();var fs_extra=require(_0xcb3c('0x5'));var auth=require(_0xcb3c('0x6'));var interaction=require(_0xcb3c('0x7'));var config=require(_0xcb3c('0x8'));var controller=require(_0xcb3c('0x9'));router[_0xcb3c('0xa')]('/',auth[_0xcb3c('0xb')](),controller[_0xcb3c('0xc')]);router[_0xcb3c('0xa')](_0xcb3c('0xd'),auth['isAuthenticated'](),controller[_0xcb3c('0xe')]);router['post']('/',auth[_0xcb3c('0xb')](),controller[_0xcb3c('0xf')]);router[_0xcb3c('0x10')](_0xcb3c('0xd'),auth[_0xcb3c('0xb')](),controller[_0xcb3c('0x11')]);router[_0xcb3c('0x12')]('/:id',auth[_0xcb3c('0xb')](),controller[_0xcb3c('0x13')]);module[_0xcb3c('0x14')]=router; \ No newline at end of file +var _0x213f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','path'];(function(_0x5bf46c,_0x1fe508){var _0x5a37c4=function(_0x2cf2c3){while(--_0x2cf2c3){_0x5bf46c['push'](_0x5bf46c['shift']());}};_0x5a37c4(++_0x1fe508);}(_0x213f,0x18b));var _0xf213=function(_0x11d7dc,_0x2ccadc){_0x11d7dc=_0x11d7dc-0x0;var _0x2565fd=_0x213f[_0x11d7dc];return _0x2565fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf213('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf213('0x1')]();var fs_extra=require(_0xf213('0x2'));var auth=require(_0xf213('0x3'));var interaction=require(_0xf213('0x4'));var config=require(_0xf213('0x5'));var controller=require(_0xf213('0x6'));router['get']('/',auth[_0xf213('0x7')](),controller[_0xf213('0x8')]);router[_0xf213('0x9')](_0xf213('0xa'),auth['isAuthenticated'](),controller[_0xf213('0xb')]);router['post']('/',auth[_0xf213('0x7')](),controller[_0xf213('0xc')]);router[_0xf213('0xd')](_0xf213('0xa'),auth[_0xf213('0x7')](),controller[_0xf213('0xe')]);router[_0xf213('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf213('0x10')]);module[_0xf213('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 591c49f..e31f5bf 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 _0x63b7=['variable','customVariable','keyValue','picklist','STRING','string','sequelize','ENUM'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x63b7,0x136));var _0x763b=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x63b7[_0x130705];return _0x1fa991;};'use strict';var Sequelize=require(_0x763b('0x0'));module['exports']={'type':{'type':Sequelize[_0x763b('0x1')]('string',_0x763b('0x2'),_0x763b('0x3'),_0x763b('0x4'),_0x763b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x763b('0x6')]},'key':{'type':Sequelize[_0x763b('0x6')]},'keyType':{'type':Sequelize[_0x763b('0x1')](_0x763b('0x7'),'variable',_0x763b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x763b('0x6')]}}; \ No newline at end of file +var _0x705f=['exports','ENUM','string','customVariable','keyValue','STRING','variable','sequelize'];(function(_0xf07428,_0x1ebe43){var _0x3fe667=function(_0x3f20dc){while(--_0x3f20dc){_0xf07428['push'](_0xf07428['shift']());}};_0x3fe667(++_0x1ebe43);}(_0x705f,0xc7));var _0xf705=function(_0x158cfc,_0x3ff9e0){_0x158cfc=_0x158cfc-0x0;var _0x38baee=_0x705f[_0x158cfc];return _0x38baee;};'use strict';var Sequelize=require(_0xf705('0x0'));module[_0xf705('0x1')]={'type':{'type':Sequelize[_0xf705('0x2')](_0xf705('0x3'),'variable',_0xf705('0x4'),_0xf705('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf705('0x6')]},'keyType':{'type':Sequelize[_0xf705('0x2')](_0xf705('0x3'),_0xf705('0x7'),_0xf705('0x4'))},'keyContent':{'type':Sequelize[_0xf705('0x6')]},'idField':{'type':Sequelize[_0xf705('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 69f5047..8de4304 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 _0x1fcb=['request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1fcb,0x18c));var _0xb1fc=function(_0x115773,_0x4c8f58){_0x115773=_0x115773-0x0;var _0x3dbff5=_0x1fcb[_0x115773];return _0x3dbff5;};'use strict';var emlformat=require(_0xb1fc('0x0'));var rimraf=require(_0xb1fc('0x1'));var zipdir=require(_0xb1fc('0x2'));var jsonpatch=require(_0xb1fc('0x3'));var rp=require(_0xb1fc('0x4'));var moment=require('moment');var BPromise=require(_0xb1fc('0x5'));var Mustache=require(_0xb1fc('0x6'));var util=require(_0xb1fc('0x7'));var path=require(_0xb1fc('0x8'));var sox=require(_0xb1fc('0x9'));var csv=require('to-csv');var ejs=require(_0xb1fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb1fc('0xb'));var crypto=require(_0xb1fc('0xc'));var jsforce=require(_0xb1fc('0xd'));var deskjs=require(_0xb1fc('0xe'));var toCsv=require(_0xb1fc('0xf'));var querystring=require(_0xb1fc('0x10'));var Papa=require('papaparse');var Redis=require(_0xb1fc('0x11'));var authService=require(_0xb1fc('0x12'));var qs=require(_0xb1fc('0x13'));var as=require(_0xb1fc('0x14'));var hardwareService=require(_0xb1fc('0x15'));var logger=require(_0xb1fc('0x16'))(_0xb1fc('0x17'));var utils=require(_0xb1fc('0x18'));var config=require(_0xb1fc('0x19'));var licenseUtil=require(_0xb1fc('0x1a'));var db=require(_0xb1fc('0x1b'))['db'];function respondWithStatusCode(_0x1c6d86,_0x588576){_0x588576=_0x588576||0xcc;return function(_0x5e3478){if(_0x5e3478){return _0x1c6d86[_0xb1fc('0x1c')](_0x588576);}return _0x1c6d86['status'](_0x588576)[_0xb1fc('0x1d')]();};}function respondWithResult(_0x440d8b,_0x4a8448){_0x4a8448=_0x4a8448||0xc8;return function(_0x908293){if(_0x908293){return _0x440d8b[_0xb1fc('0x1e')](_0x4a8448)[_0xb1fc('0x1f')](_0x908293);}};}function respondWithFilteredResult(_0x19c1b8,_0x5b8a08){return function(_0x21e5ad){if(_0x21e5ad){var _0x27d2ae=typeof _0x5b8a08[_0xb1fc('0x20')]===_0xb1fc('0x21')&&typeof _0x5b8a08[_0xb1fc('0x22')]==='undefined';var _0x2722fb=_0x21e5ad[_0xb1fc('0x23')];var _0x2c5f7a=_0x27d2ae?0x0:_0x5b8a08['offset'];var _0x42c467=_0x27d2ae?_0x21e5ad['count']:_0x5b8a08['offset']+_0x5b8a08[_0xb1fc('0x22')];var _0x1d76ff;if(_0x42c467>=_0x2722fb){_0x42c467=_0x2722fb;_0x1d76ff=0xc8;}else{_0x1d76ff=0xce;}_0x19c1b8[_0xb1fc('0x1e')](_0x1d76ff);return _0x19c1b8[_0xb1fc('0x24')](_0xb1fc('0x25'),_0x2c5f7a+'-'+_0x42c467+'/'+_0x2722fb)[_0xb1fc('0x1f')](_0x21e5ad);}return null;};}function patchUpdates(_0x477c42){return function(_0x2dde78){try{jsonpatch[_0xb1fc('0x26')](_0x2dde78,_0x477c42,!![]);}catch(_0x116de5){return BPromise[_0xb1fc('0x27')](_0x116de5);}return _0x2dde78[_0xb1fc('0x28')]();};}function saveUpdates(_0x1e35a9,_0x1d0dfc){return function(_0x44d8f4){if(_0x44d8f4){return _0x44d8f4[_0xb1fc('0x29')](_0x1e35a9)[_0xb1fc('0x2a')](function(_0x291578){return _0x291578;});}return null;};}function removeEntity(_0x52f142,_0x20b7d4){return function(_0x43960e){if(_0x43960e){return _0x43960e[_0xb1fc('0x2b')]()[_0xb1fc('0x2a')](function(){_0x52f142[_0xb1fc('0x1e')](0xcc)[_0xb1fc('0x1d')]();});}};}function handleEntityNotFound(_0x498a2c,_0x42dd92){return function(_0x316a65){if(!_0x316a65){_0x498a2c[_0xb1fc('0x1c')](0x194);}return _0x316a65;};}function handleError(_0x4668bc,_0x5364d7){_0x5364d7=_0x5364d7||0x1f4;return function(_0x258ca8){logger[_0xb1fc('0x2c')](_0x258ca8[_0xb1fc('0x2d')]);if(_0x258ca8[_0xb1fc('0x2e')]){delete _0x258ca8[_0xb1fc('0x2e')];}_0x4668bc[_0xb1fc('0x1e')](_0x5364d7)['send'](_0x258ca8);};}exports[_0xb1fc('0x2f')]=function(_0x180581,_0x4f3ea4){var _0x5a422c={},_0x78a026={},_0x1dc6c0={'count':0x0,'rows':[]};var _0x18637a=_[_0xb1fc('0x30')](db[_0xb1fc('0x31')][_0xb1fc('0x32')],function(_0x5db03e){return{'name':_0x5db03e[_0xb1fc('0x33')],'type':_0x5db03e[_0xb1fc('0x34')][_0xb1fc('0x35')]};});_0x78a026[_0xb1fc('0x36')]=_[_0xb1fc('0x30')](_0x18637a,_0xb1fc('0x2e'));_0x78a026[_0xb1fc('0x37')]=_[_0xb1fc('0x38')](_0x180581[_0xb1fc('0x37')]);_0x78a026[_0xb1fc('0x39')]=_[_0xb1fc('0x3a')](_0x78a026[_0xb1fc('0x36')],_0x78a026[_0xb1fc('0x37')]);_0x5a422c[_0xb1fc('0x3b')]=_['intersection'](_0x78a026['model'],qs[_0xb1fc('0x3c')](_0x180581['query'][_0xb1fc('0x3c')]));_0x5a422c[_0xb1fc('0x3b')]=_0x5a422c[_0xb1fc('0x3b')]['length']?_0x5a422c[_0xb1fc('0x3b')]:_0x78a026[_0xb1fc('0x36')];if(!_0x180581[_0xb1fc('0x37')][_0xb1fc('0x3d')](_0xb1fc('0x3e'))){_0x5a422c['limit']=qs[_0xb1fc('0x22')](_0x180581['query'][_0xb1fc('0x22')]);_0x5a422c[_0xb1fc('0x20')]=qs[_0xb1fc('0x20')](_0x180581[_0xb1fc('0x37')]['offset']);}_0x5a422c[_0xb1fc('0x3f')]=qs[_0xb1fc('0x40')](_0x180581[_0xb1fc('0x37')][_0xb1fc('0x40')]);_0x5a422c[_0xb1fc('0x41')]=qs['filters'](_['pick'](_0x180581[_0xb1fc('0x37')],_0x78a026[_0xb1fc('0x39')]),_0x18637a);if(_0x180581[_0xb1fc('0x37')][_0xb1fc('0x42')]){_0x5a422c[_0xb1fc('0x41')]=_[_0xb1fc('0x43')](_0x5a422c[_0xb1fc('0x41')],{'$or':_['map'](_0x18637a,function(_0x4a4724){if(_0x4a4724[_0xb1fc('0x34')]!==_0xb1fc('0x44')){var _0x494fff={};_0x494fff[_0x4a4724[_0xb1fc('0x2e')]]={'$like':'%'+_0x180581['query'][_0xb1fc('0x42')]+'%'};return _0x494fff;}})});}_0x5a422c=_['merge']({},_0x5a422c,_0x180581[_0xb1fc('0x45')]);var _0x4f986b={'where':_0x5a422c[_0xb1fc('0x41')]};return db[_0xb1fc('0x31')][_0xb1fc('0x23')](_0x4f986b)[_0xb1fc('0x2a')](function(_0x4b92b9){_0x1dc6c0[_0xb1fc('0x23')]=_0x4b92b9;if(_0x180581['query']['includeAll']){_0x5a422c[_0xb1fc('0x46')]=[{'all':!![]}];}return db[_0xb1fc('0x31')][_0xb1fc('0x47')](_0x5a422c);})[_0xb1fc('0x2a')](function(_0x240770){_0x1dc6c0[_0xb1fc('0x48')]=_0x240770;return _0x1dc6c0;})[_0xb1fc('0x2a')](respondWithFilteredResult(_0x4f3ea4,_0x5a422c))['catch'](handleError(_0x4f3ea4,null));};exports[_0xb1fc('0x49')]=function(_0x723301,_0xeabdf9){var _0x30fd05={'raw':!![],'where':{'id':_0x723301[_0xb1fc('0x4a')]['id']}},_0xef1ba1={};_0xef1ba1[_0xb1fc('0x36')]=_[_0xb1fc('0x38')](db[_0xb1fc('0x31')][_0xb1fc('0x32')]);_0xef1ba1[_0xb1fc('0x37')]=_['keys'](_0x723301[_0xb1fc('0x37')]);_0xef1ba1[_0xb1fc('0x39')]=_[_0xb1fc('0x3a')](_0xef1ba1[_0xb1fc('0x36')],_0xef1ba1['query']);_0x30fd05[_0xb1fc('0x3b')]=_['intersection'](_0xef1ba1[_0xb1fc('0x36')],qs[_0xb1fc('0x3c')](_0x723301[_0xb1fc('0x37')][_0xb1fc('0x3c')]));_0x30fd05[_0xb1fc('0x3b')]=_0x30fd05['attributes'][_0xb1fc('0x4b')]?_0x30fd05[_0xb1fc('0x3b')]:_0xef1ba1['model'];if(_0x723301[_0xb1fc('0x37')][_0xb1fc('0x4c')]){_0x30fd05[_0xb1fc('0x46')]=[{'all':!![]}];}_0x30fd05=_['merge']({},_0x30fd05,_0x723301[_0xb1fc('0x45')]);return db[_0xb1fc('0x31')][_0xb1fc('0x4d')](_0x30fd05)[_0xb1fc('0x2a')](handleEntityNotFound(_0xeabdf9,null))[_0xb1fc('0x2a')](respondWithResult(_0xeabdf9,null))[_0xb1fc('0x4e')](handleError(_0xeabdf9,null));};exports['create']=function(_0x472262,_0x4a0cb7){return db[_0xb1fc('0x31')]['create'](_0x472262[_0xb1fc('0x4f')],{})[_0xb1fc('0x2a')](respondWithResult(_0x4a0cb7,0xc9))[_0xb1fc('0x4e')](handleError(_0x4a0cb7,null));};exports[_0xb1fc('0x29')]=function(_0x43f4a5,_0x38686f){if(_0x43f4a5[_0xb1fc('0x4f')]['id']){delete _0x43f4a5['body']['id'];}return db[_0xb1fc('0x31')][_0xb1fc('0x4d')]({'where':{'id':_0x43f4a5[_0xb1fc('0x4a')]['id']}})[_0xb1fc('0x2a')](handleEntityNotFound(_0x38686f,null))[_0xb1fc('0x2a')](saveUpdates(_0x43f4a5['body'],null))[_0xb1fc('0x2a')](respondWithResult(_0x38686f,null))[_0xb1fc('0x4e')](handleError(_0x38686f,null));};exports['destroy']=function(_0x2f77b6,_0x120b58){return db[_0xb1fc('0x31')][_0xb1fc('0x4d')]({'where':{'id':_0x2f77b6['params']['id']}})[_0xb1fc('0x2a')](handleEntityNotFound(_0x120b58,null))['then'](removeEntity(_0x120b58,null))[_0xb1fc('0x4e')](handleError(_0x120b58,null));}; \ No newline at end of file +var _0xb85c=['include','findAll','rows','catch','show','params','intersection','create','body','find','rimraf','fast-json-patch','moment','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x16e66b,_0x2b65eb){var _0x42751a=function(_0x21bed9){while(--_0x21bed9){_0x16e66b['push'](_0x16e66b['shift']());}};_0x42751a(++_0x2b65eb);}(_0xb85c,0x168));var _0xcb85=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xb85c[_0x4d8ed9];return _0x1e2140;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb85('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb85('0x1'));var rp=require('request-promise');var moment=require(_0xcb85('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xcb85('0x3'));var util=require('util');var path=require(_0xcb85('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcb85('0x5'));var fs=require('fs');var fs_extra=require(_0xcb85('0x6'));var _=require(_0xcb85('0x7'));var squel=require(_0xcb85('0x8'));var crypto=require('crypto');var jsforce=require(_0xcb85('0x9'));var deskjs=require(_0xcb85('0xa'));var toCsv=require(_0xcb85('0xb'));var querystring=require(_0xcb85('0xc'));var Papa=require(_0xcb85('0xd'));var Redis=require(_0xcb85('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xcb85('0xf'));var as=require(_0xcb85('0x10'));var hardwareService=require(_0xcb85('0x11'));var logger=require(_0xcb85('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xcb85('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb85('0x14'))['db'];function respondWithStatusCode(_0x58ab7c,_0x1fe88f){_0x1fe88f=_0x1fe88f||0xcc;return function(_0x44f51a){if(_0x44f51a){return _0x58ab7c['sendStatus'](_0x1fe88f);}return _0x58ab7c[_0xcb85('0x15')](_0x1fe88f)['end']();};}function respondWithResult(_0x40b02e,_0x234807){_0x234807=_0x234807||0xc8;return function(_0x68a99d){if(_0x68a99d){return _0x40b02e[_0xcb85('0x15')](_0x234807)[_0xcb85('0x16')](_0x68a99d);}};}function respondWithFilteredResult(_0x32966f,_0x54455d){return function(_0x3a262f){if(_0x3a262f){var _0x5ca19c=typeof _0x54455d[_0xcb85('0x17')]===_0xcb85('0x18')&&typeof _0x54455d[_0xcb85('0x19')]==='undefined';var _0xbacda6=_0x3a262f[_0xcb85('0x1a')];var _0x54e9d8=_0x5ca19c?0x0:_0x54455d['offset'];var _0x52ef0a=_0x5ca19c?_0x3a262f[_0xcb85('0x1a')]:_0x54455d[_0xcb85('0x17')]+_0x54455d[_0xcb85('0x19')];var _0x16f3c8;if(_0x52ef0a>=_0xbacda6){_0x52ef0a=_0xbacda6;_0x16f3c8=0xc8;}else{_0x16f3c8=0xce;}_0x32966f[_0xcb85('0x15')](_0x16f3c8);return _0x32966f['set']('Content-Range',_0x54e9d8+'-'+_0x52ef0a+'/'+_0xbacda6)[_0xcb85('0x16')](_0x3a262f);}return null;};}function patchUpdates(_0x5a23ec){return function(_0x40c8a6){try{jsonpatch[_0xcb85('0x1b')](_0x40c8a6,_0x5a23ec,!![]);}catch(_0x11f3cf){return BPromise[_0xcb85('0x1c')](_0x11f3cf);}return _0x40c8a6[_0xcb85('0x1d')]();};}function saveUpdates(_0x181219,_0x5ee0b0){return function(_0x53d357){if(_0x53d357){return _0x53d357[_0xcb85('0x1e')](_0x181219)[_0xcb85('0x1f')](function(_0x5393e1){return _0x5393e1;});}return null;};}function removeEntity(_0x2f8014,_0x4fb5c5){return function(_0x28c488){if(_0x28c488){return _0x28c488[_0xcb85('0x20')]()[_0xcb85('0x1f')](function(){_0x2f8014[_0xcb85('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36e1a4,_0x1a6f11){return function(_0x2d5dc6){if(!_0x2d5dc6){_0x36e1a4[_0xcb85('0x21')](0x194);}return _0x2d5dc6;};}function handleError(_0x27b13,_0x3a14e4){_0x3a14e4=_0x3a14e4||0x1f4;return function(_0x42b045){logger['error'](_0x42b045[_0xcb85('0x22')]);if(_0x42b045['name']){delete _0x42b045[_0xcb85('0x23')];}_0x27b13['status'](_0x3a14e4)[_0xcb85('0x24')](_0x42b045);};}exports[_0xcb85('0x25')]=function(_0xbe9df3,_0x59c584){var _0x467a03={},_0x549ac7={},_0x429599={'count':0x0,'rows':[]};var _0x3e6218=_[_0xcb85('0x26')](db[_0xcb85('0x27')][_0xcb85('0x28')],function(_0x5c7c40){return{'name':_0x5c7c40[_0xcb85('0x29')],'type':_0x5c7c40[_0xcb85('0x2a')][_0xcb85('0x2b')]};});_0x549ac7[_0xcb85('0x2c')]=_[_0xcb85('0x26')](_0x3e6218,_0xcb85('0x23'));_0x549ac7[_0xcb85('0x2d')]=_[_0xcb85('0x2e')](_0xbe9df3[_0xcb85('0x2d')]);_0x549ac7[_0xcb85('0x2f')]=_['intersection'](_0x549ac7[_0xcb85('0x2c')],_0x549ac7[_0xcb85('0x2d')]);_0x467a03[_0xcb85('0x30')]=_['intersection'](_0x549ac7[_0xcb85('0x2c')],qs[_0xcb85('0x31')](_0xbe9df3[_0xcb85('0x2d')][_0xcb85('0x31')]));_0x467a03[_0xcb85('0x30')]=_0x467a03[_0xcb85('0x30')][_0xcb85('0x32')]?_0x467a03[_0xcb85('0x30')]:_0x549ac7['model'];if(!_0xbe9df3[_0xcb85('0x2d')][_0xcb85('0x33')]('nolimit')){_0x467a03[_0xcb85('0x19')]=qs[_0xcb85('0x19')](_0xbe9df3[_0xcb85('0x2d')][_0xcb85('0x19')]);_0x467a03['offset']=qs[_0xcb85('0x17')](_0xbe9df3['query']['offset']);}_0x467a03[_0xcb85('0x34')]=qs[_0xcb85('0x35')](_0xbe9df3[_0xcb85('0x2d')][_0xcb85('0x35')]);_0x467a03['where']=qs[_0xcb85('0x2f')](_['pick'](_0xbe9df3['query'],_0x549ac7['filters']),_0x3e6218);if(_0xbe9df3[_0xcb85('0x2d')][_0xcb85('0x36')]){_0x467a03[_0xcb85('0x37')]=_[_0xcb85('0x38')](_0x467a03[_0xcb85('0x37')],{'$or':_[_0xcb85('0x26')](_0x3e6218,function(_0x14c890){if(_0x14c890[_0xcb85('0x2a')]!==_0xcb85('0x39')){var _0x4c3b17={};_0x4c3b17[_0x14c890[_0xcb85('0x23')]]={'$like':'%'+_0xbe9df3[_0xcb85('0x2d')][_0xcb85('0x36')]+'%'};return _0x4c3b17;}})});}_0x467a03=_[_0xcb85('0x38')]({},_0x467a03,_0xbe9df3[_0xcb85('0x3a')]);var _0x277a12={'where':_0x467a03[_0xcb85('0x37')]};return db[_0xcb85('0x27')][_0xcb85('0x1a')](_0x277a12)['then'](function(_0x521e3c){_0x429599[_0xcb85('0x1a')]=_0x521e3c;if(_0xbe9df3[_0xcb85('0x2d')][_0xcb85('0x3b')]){_0x467a03[_0xcb85('0x3c')]=[{'all':!![]}];}return db['SalesforceField'][_0xcb85('0x3d')](_0x467a03);})[_0xcb85('0x1f')](function(_0x10d574){_0x429599[_0xcb85('0x3e')]=_0x10d574;return _0x429599;})[_0xcb85('0x1f')](respondWithFilteredResult(_0x59c584,_0x467a03))[_0xcb85('0x3f')](handleError(_0x59c584,null));};exports[_0xcb85('0x40')]=function(_0x53155c,_0xde35ea){var _0x228951={'raw':!![],'where':{'id':_0x53155c[_0xcb85('0x41')]['id']}},_0x5c607e={};_0x5c607e[_0xcb85('0x2c')]=_[_0xcb85('0x2e')](db[_0xcb85('0x27')][_0xcb85('0x28')]);_0x5c607e[_0xcb85('0x2d')]=_[_0xcb85('0x2e')](_0x53155c[_0xcb85('0x2d')]);_0x5c607e[_0xcb85('0x2f')]=_['intersection'](_0x5c607e[_0xcb85('0x2c')],_0x5c607e[_0xcb85('0x2d')]);_0x228951[_0xcb85('0x30')]=_[_0xcb85('0x42')](_0x5c607e['model'],qs[_0xcb85('0x31')](_0x53155c['query'][_0xcb85('0x31')]));_0x228951[_0xcb85('0x30')]=_0x228951[_0xcb85('0x30')][_0xcb85('0x32')]?_0x228951[_0xcb85('0x30')]:_0x5c607e['model'];if(_0x53155c[_0xcb85('0x2d')][_0xcb85('0x3b')]){_0x228951[_0xcb85('0x3c')]=[{'all':!![]}];}_0x228951=_['merge']({},_0x228951,_0x53155c[_0xcb85('0x3a')]);return db[_0xcb85('0x27')]['find'](_0x228951)['then'](handleEntityNotFound(_0xde35ea,null))[_0xcb85('0x1f')](respondWithResult(_0xde35ea,null))[_0xcb85('0x3f')](handleError(_0xde35ea,null));};exports[_0xcb85('0x43')]=function(_0x2573b6,_0xaa8f3){return db['SalesforceField']['create'](_0x2573b6['body'],{})[_0xcb85('0x1f')](respondWithResult(_0xaa8f3,0xc9))[_0xcb85('0x3f')](handleError(_0xaa8f3,null));};exports[_0xcb85('0x1e')]=function(_0x3c692c,_0x27284f){if(_0x3c692c[_0xcb85('0x44')]['id']){delete _0x3c692c['body']['id'];}return db[_0xcb85('0x27')][_0xcb85('0x45')]({'where':{'id':_0x3c692c[_0xcb85('0x41')]['id']}})[_0xcb85('0x1f')](handleEntityNotFound(_0x27284f,null))['then'](saveUpdates(_0x3c692c[_0xcb85('0x44')],null))['then'](respondWithResult(_0x27284f,null))[_0xcb85('0x3f')](handleError(_0x27284f,null));};exports[_0xcb85('0x20')]=function(_0x554296,_0x23a68d){return db['SalesforceField'][_0xcb85('0x45')]({'where':{'id':_0x554296[_0xcb85('0x41')]['id']}})['then'](handleEntityNotFound(_0x23a68d,null))[_0xcb85('0x1f')](removeEntity(_0x23a68d,null))[_0xcb85('0x3f')](handleError(_0x23a68d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 4af5e41..900d3a5 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 _0xb5b5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api'];(function(_0x174e87,_0x466406){var _0x2eda9f=function(_0x22b8cb){while(--_0x22b8cb){_0x174e87['push'](_0x174e87['shift']());}};_0x2eda9f(++_0x466406);}(_0xb5b5,0x18d));var _0x5b5b=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xb5b5[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x5b5b('0x0'));var util=require(_0x5b5b('0x1'));var logger=require('../../config/logger')(_0x5b5b('0x2'));var moment=require(_0x5b5b('0x3'));var BPromise=require(_0x5b5b('0x4'));var rp=require(_0x5b5b('0x5'));var fs=require('fs');var path=require(_0x5b5b('0x6'));var rimraf=require(_0x5b5b('0x7'));var config=require(_0x5b5b('0x8'));var attributes=require(_0x5b5b('0x9'));module['exports']=function(_0x6118cd,_0x14c3e2){return _0x6118cd[_0x5b5b('0xa')](_0x5b5b('0xb'),attributes,{'tableName':_0x5b5b('0xc'),'paranoid':![],'indexes':[{'name':_0x5b5b('0xd'),'fields':[_0x5b5b('0xe'),_0x5b5b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdef=['SalesforceField','int_salesforce_fields','salesforce_unique_index','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xcdef,0x11b));var _0xfcde=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcdef[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xfcde('0x0'));var util=require('util');var logger=require(_0xfcde('0x1'))(_0xfcde('0x2'));var moment=require(_0xfcde('0x3'));var BPromise=require(_0xfcde('0x4'));var rp=require(_0xfcde('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcde('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x548b5a,_0x4cf982){return _0x548b5a['define'](_0xfcde('0x7'),attributes,{'tableName':_0xfcde('0x8'),'paranoid':![],'indexes':[{'name':_0xfcde('0x9'),'fields':['idField','FieldId'],'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 5943edb..69c01d0 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 _0xa09f=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message'];(function(_0x55a2ec,_0x1ff1d0){var _0x1bf5af=function(_0x2e92c9){while(--_0x2e92c9){_0x55a2ec['push'](_0x55a2ec['shift']());}};_0x1bf5af(++_0x1ff1d0);}(_0xa09f,0x136));var _0xfa09=function(_0x51ac01,_0x55d78d){_0x51ac01=_0x51ac01-0x0;var _0x32ea60=_0xa09f[_0x51ac01];return _0x32ea60;};'use strict';var _=require(_0xfa09('0x0'));var util=require(_0xfa09('0x1'));var moment=require(_0xfa09('0x2'));var BPromise=require('bluebird');var rs=require(_0xfa09('0x3'));var fs=require('fs');var Redis=require(_0xfa09('0x4'));var db=require(_0xfa09('0x5'))['db'];var utils=require(_0xfa09('0x6'));var logger=require('../../config/logger')(_0xfa09('0x7'));var config=require(_0xfa09('0x8'));var jayson=require(_0xfa09('0x9'));var client=jayson[_0xfa09('0xa')][_0xfa09('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e6662,_0x20e8bf,_0x3661c5){return new BPromise(function(_0x48b878,_0x3edcf5){return client['request'](_0x1e6662,_0x3661c5)['then'](function(_0x2f9ff2){logger[_0xfa09('0xc')]('SalesforceField,\x20%s,\x20%s',_0x20e8bf,_0xfa09('0xd'));logger['debug'](_0xfa09('0xe'),_0x20e8bf,'request\x20sent',JSON[_0xfa09('0xf')](_0x2f9ff2));if(_0x2f9ff2[_0xfa09('0x10')]){if(_0x2f9ff2[_0xfa09('0x10')][_0xfa09('0x11')]===0x1f4){logger['error'](_0xfa09('0x12'),_0x20e8bf,_0x2f9ff2[_0xfa09('0x10')][_0xfa09('0x13')]);return _0x3edcf5(_0x2f9ff2[_0xfa09('0x10')][_0xfa09('0x13')]);}logger[_0xfa09('0x10')](_0xfa09('0x12'),_0x20e8bf,_0x2f9ff2[_0xfa09('0x10')][_0xfa09('0x13')]);return _0x48b878(_0x2f9ff2[_0xfa09('0x10')]['message']);}else{logger[_0xfa09('0xc')]('SalesforceField,\x20%s,\x20%s',_0x20e8bf,_0xfa09('0xd'));_0x48b878(_0x2f9ff2[_0xfa09('0x14')][_0xfa09('0x13')]);}})[_0xfa09('0x15')](function(_0x18c36f){logger['error'](_0xfa09('0x12'),_0x20e8bf,_0x18c36f);_0x3edcf5(_0x18c36f);});});} \ No newline at end of file +var _0x9f35=['bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3f540f,_0x53006f){var _0xfc95a6=function(_0xeca93){while(--_0xeca93){_0x3f540f['push'](_0x3f540f['shift']());}};_0xfc95a6(++_0x53006f);}(_0x9f35,0x18c));var _0x59f3=function(_0x22b826,_0x5e4207){_0x22b826=_0x22b826-0x0;var _0x2d863e=_0x9f35[_0x22b826];return _0x2d863e;};'use strict';var _=require(_0x59f3('0x0'));var util=require(_0x59f3('0x1'));var moment=require(_0x59f3('0x2'));var BPromise=require(_0x59f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x59f3('0x4'));var logger=require(_0x59f3('0x5'))(_0x59f3('0x6'));var config=require('../../config/environment');var jayson=require(_0x59f3('0x7'));var client=jayson[_0x59f3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fb590,_0x546d2b,_0x261cd5){return new BPromise(function(_0x1eedb6,_0x1d1b1d){return client[_0x59f3('0x9')](_0x3fb590,_0x261cd5)[_0x59f3('0xa')](function(_0x1a6c16){logger[_0x59f3('0xb')]('SalesforceField,\x20%s,\x20%s',_0x546d2b,'request\x20sent');logger[_0x59f3('0xc')](_0x59f3('0xd'),_0x546d2b,'request\x20sent',JSON[_0x59f3('0xe')](_0x1a6c16));if(_0x1a6c16[_0x59f3('0xf')]){if(_0x1a6c16[_0x59f3('0xf')][_0x59f3('0x10')]===0x1f4){logger[_0x59f3('0xf')](_0x59f3('0x11'),_0x546d2b,_0x1a6c16['error'][_0x59f3('0x12')]);return _0x1d1b1d(_0x1a6c16['error']['message']);}logger[_0x59f3('0xf')](_0x59f3('0x11'),_0x546d2b,_0x1a6c16[_0x59f3('0xf')][_0x59f3('0x12')]);return _0x1eedb6(_0x1a6c16[_0x59f3('0xf')]['message']);}else{logger[_0x59f3('0xb')](_0x59f3('0x11'),_0x546d2b,'request\x20sent');_0x1eedb6(_0x1a6c16[_0x59f3('0x13')][_0x59f3('0x12')]);}})[_0x59f3('0x14')](function(_0x43c79f){logger[_0x59f3('0xf')](_0x59f3('0x11'),_0x546d2b,_0x43c79f);_0x1d1b1d(_0x43c79f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6c55c49..accd6dc 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 _0xc125=['getFields','post','create','addConfiguration','delete','/:id','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x4c0e14,_0xbe722b){var _0x534dcd=function(_0x447e95){while(--_0x447e95){_0x4c0e14['push'](_0x4c0e14['shift']());}};_0x534dcd(++_0xbe722b);}(_0xc125,0x150));var _0x5c12=function(_0x5d848f,_0xedc45e){_0x5d848f=_0x5d848f-0x0;var _0x350da2=_0xc125[_0x5d848f];return _0x350da2;};'use strict';var multer=require('multer');var util=require(_0x5c12('0x0'));var path=require('path');var timeout=require(_0x5c12('0x1'));var express=require(_0x5c12('0x2'));var router=express[_0x5c12('0x3')]();var fs_extra=require(_0x5c12('0x4'));var auth=require(_0x5c12('0x5'));var interaction=require(_0x5c12('0x6'));var config=require(_0x5c12('0x7'));var controller=require(_0x5c12('0x8'));router[_0x5c12('0x9')]('/',auth[_0x5c12('0xa')](),controller[_0x5c12('0xb')]);router[_0x5c12('0x9')]('/:id',auth[_0x5c12('0xa')](),controller[_0x5c12('0xc')]);router['get'](_0x5c12('0xd'),auth[_0x5c12('0xa')](),controller[_0x5c12('0xe')]);router[_0x5c12('0x9')](_0x5c12('0xf'),auth[_0x5c12('0xa')](),controller[_0x5c12('0x10')]);router[_0x5c12('0x11')]('/',auth['isAuthenticated'](),controller[_0x5c12('0x12')]);router[_0x5c12('0x11')](_0x5c12('0xd'),auth[_0x5c12('0xa')](),controller[_0x5c12('0x13')]);router['put']('/:id',auth[_0x5c12('0xa')](),controller['update']);router[_0x5c12('0x14')](_0x5c12('0x15'),auth[_0x5c12('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd138=['get','getFields','post','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../config/environment','/:id','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x1f146c,_0xfb86d6){var _0x2354fb=function(_0x2078d0){while(--_0x2078d0){_0x1f146c['push'](_0x1f146c['shift']());}};_0x2354fb(++_0xfb86d6);}(_0xd138,0x1dc));var _0x8d13=function(_0x4b627a,_0x390c28){_0x4b627a=_0x4b627a-0x0;var _0x2fe234=_0xd138[_0x4b627a];return _0x2fe234;};'use strict';var multer=require(_0x8d13('0x0'));var util=require(_0x8d13('0x1'));var path=require(_0x8d13('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8d13('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8d13('0x4'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8d13('0x5'),auth[_0x8d13('0x6')](),controller[_0x8d13('0x7')]);router['get'](_0x8d13('0x8'),auth['isAuthenticated'](),controller[_0x8d13('0x9')]);router[_0x8d13('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8d13('0xb')]);router[_0x8d13('0xc')]('/',auth[_0x8d13('0x6')](),controller['create']);router[_0x8d13('0xc')](_0x8d13('0x8'),auth[_0x8d13('0x6')](),controller['addConfiguration']);router[_0x8d13('0xd')](_0x8d13('0x5'),auth[_0x8d13('0x6')](),controller[_0x8d13('0xe')]);router[_0x8d13('0xf')](_0x8d13('0x5'),auth[_0x8d13('0x6')](),controller[_0x8d13('0x10')]);module[_0x8d13('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index f1e2333..1868e6e 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 _0xba6a=['sequelize','exports','STRING','remoteUri'];(function(_0x33448e,_0x197c5a){var _0x51c67d=function(_0x47e345){while(--_0x47e345){_0x33448e['push'](_0x33448e['shift']());}};_0x51c67d(++_0x197c5a);}(_0xba6a,0x198));var _0xaba6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xba6a[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0xaba6('0x0'));module[_0xaba6('0x1')]={'name':{'type':Sequelize[_0xaba6('0x2')]},'description':{'type':Sequelize[_0xaba6('0x2')]},'username':{'type':Sequelize[_0xaba6('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xaba6('0x2')]},'email':{'type':Sequelize[_0xaba6('0x2')]},'remoteUri':{'type':Sequelize[_0xaba6('0x2')],'unique':_0xaba6('0x3')},'serverUrl':{'type':Sequelize[_0xaba6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xadb7=['remoteUri','sequelize','exports','STRING','username'];(function(_0x1ef746,_0x57effb){var _0x2ea2a5=function(_0x508c40){while(--_0x508c40){_0x1ef746['push'](_0x1ef746['shift']());}};_0x2ea2a5(++_0x57effb);}(_0xadb7,0x1b9));var _0x7adb=function(_0x4ac370,_0x190fba){_0x4ac370=_0x4ac370-0x0;var _0x5824f8=_0xadb7[_0x4ac370];return _0x5824f8;};'use strict';var Sequelize=require(_0x7adb('0x0'));module[_0x7adb('0x1')]={'name':{'type':Sequelize[_0x7adb('0x2')]},'description':{'type':Sequelize[_0x7adb('0x2')]},'username':{'type':Sequelize[_0x7adb('0x2')],'unique':_0x7adb('0x3')},'password':{'type':Sequelize[_0x7adb('0x2')]},'email':{'type':Sequelize[_0x7adb('0x2')]},'remoteUri':{'type':Sequelize[_0x7adb('0x2')],'unique':_0x7adb('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7534d92..5b85b12 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 _0xbf7b=['work_notes_list','business_service','rfc','time_worked','expected_start','business_duration','work_end','reopened_time','resolved_at','caller_id','work_notes','correlation_display','assignment_group','additional_assignee_list','description','calendar_duration','close_notes','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','findOne','password','slice','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','concat','ServiceNow\x20error:\x20','statusCode','error','send','Wrong\x20credentials','boolean','True','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','index','ServicenowAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','getConfigurations','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','delivery_plan','impact'];(function(_0x23e4f1,_0x16563e){var _0x20a4e7=function(_0x3bfa53){while(--_0x3bfa53){_0x23e4f1['push'](_0x23e4f1['shift']());}};_0x20a4e7(++_0x16563e);}(_0xbf7b,0x1a2));var _0xbbf7=function(_0x34f5d2,_0x4d1438){_0x34f5d2=_0x34f5d2-0x0;var _0x9cc9c5=_0xbf7b[_0x34f5d2];return _0x9cc9c5;};'use strict';var emlformat=require(_0xbbf7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbf7('0x1'));var jsonpatch=require(_0xbbf7('0x2'));var rp=require('request-promise');var moment=require(_0xbbf7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbbf7('0x4'));var path=require(_0xbbf7('0x5'));var sox=require(_0xbbf7('0x6'));var csv=require(_0xbbf7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbf7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbbf7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xbbf7('0xa'));var toCsv=require(_0xbbf7('0x7'));var querystring=require(_0xbbf7('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbbf7('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xbbf7('0xd'));var hardwareService=require(_0xbbf7('0xe'));var logger=require(_0xbbf7('0xf'))(_0xbbf7('0x10'));var utils=require(_0xbbf7('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xbbf7('0x12'));var db=require(_0xbbf7('0x13'))['db'];var integrations=require(_0xbbf7('0x14'));function respondWithStatusCode(_0x243688,_0x38247c){_0x38247c=_0x38247c||0xcc;return function(_0x5bec3f){if(_0x5bec3f){return _0x243688[_0xbbf7('0x15')](_0x38247c);}return _0x243688['status'](_0x38247c)[_0xbbf7('0x16')]();};}function respondWithResult(_0x444a06,_0x271044){_0x271044=_0x271044||0xc8;return function(_0x2e152b){if(_0x2e152b){return _0x444a06[_0xbbf7('0x17')](_0x271044)['json'](_0x2e152b);}};}function respondWithFilteredResult(_0x145ad4,_0x2588e7){return function(_0x3413ca){if(_0x3413ca){var _0x4aa426=typeof _0x2588e7[_0xbbf7('0x18')]===_0xbbf7('0x19')&&typeof _0x2588e7[_0xbbf7('0x1a')]==='undefined';var _0x31eae5=_0x3413ca[_0xbbf7('0x1b')];var _0x3a38a8=_0x4aa426?0x0:_0x2588e7['offset'];var _0x40cdf5=_0x4aa426?_0x3413ca['count']:_0x2588e7[_0xbbf7('0x18')]+_0x2588e7[_0xbbf7('0x1a')];var _0x3b750f;if(_0x40cdf5>=_0x31eae5){_0x40cdf5=_0x31eae5;_0x3b750f=0xc8;}else{_0x3b750f=0xce;}_0x145ad4['status'](_0x3b750f);return _0x145ad4[_0xbbf7('0x1c')](_0xbbf7('0x1d'),_0x3a38a8+'-'+_0x40cdf5+'/'+_0x31eae5)['json'](_0x3413ca);}return null;};}function patchUpdates(_0x2d7363){return function(_0x343ba7){try{jsonpatch['apply'](_0x343ba7,_0x2d7363,!![]);}catch(_0x464738){return BPromise[_0xbbf7('0x1e')](_0x464738);}return _0x343ba7[_0xbbf7('0x1f')]();};}function saveUpdates(_0x4a4c0d,_0x35a096){return function(_0xa976ea){if(_0xa976ea){return _0xa976ea['update'](_0x4a4c0d)[_0xbbf7('0x20')](function(_0x49a071){return _0x49a071;});}return null;};}function removeEntity(_0x5159bf,_0xba5614){return function(_0x21e973){if(_0x21e973){return _0x21e973[_0xbbf7('0x21')]()['then'](function(){_0x5159bf[_0xbbf7('0x17')](0xcc)[_0xbbf7('0x16')]();});}};}function handleEntityNotFound(_0x162a55,_0x41cd86){return function(_0x309a58){if(!_0x309a58){_0x162a55[_0xbbf7('0x15')](0x194);}return _0x309a58;};}function handleError(_0x59d080,_0x1e762f){_0x1e762f=_0x1e762f||0x1f4;return function(_0x2b4e98){logger['error'](_0x2b4e98[_0xbbf7('0x22')]);if(_0x2b4e98['name']){delete _0x2b4e98[_0xbbf7('0x23')];}_0x59d080[_0xbbf7('0x17')](_0x1e762f)['send'](_0x2b4e98);};}exports[_0xbbf7('0x24')]=function(_0x64d53e,_0x176eb8){var _0x1c9e3f={},_0x41b5de={},_0x4c519d={'count':0x0,'rows':[]};var _0x32b791=_['map'](db[_0xbbf7('0x25')][_0xbbf7('0x26')],function(_0x3b3e91){return{'name':_0x3b3e91[_0xbbf7('0x27')],'type':_0x3b3e91['type'][_0xbbf7('0x28')]};});_0x41b5de[_0xbbf7('0x29')]=_[_0xbbf7('0x2a')](_0x32b791,_0xbbf7('0x23'));_0x41b5de['query']=_['keys'](_0x64d53e[_0xbbf7('0x2b')]);_0x41b5de[_0xbbf7('0x2c')]=_['intersection'](_0x41b5de['model'],_0x41b5de[_0xbbf7('0x2b')]);_0x1c9e3f['attributes']=_[_0xbbf7('0x2d')](_0x41b5de[_0xbbf7('0x29')],qs[_0xbbf7('0x2e')](_0x64d53e['query'][_0xbbf7('0x2e')]));_0x1c9e3f['attributes']=_0x1c9e3f[_0xbbf7('0x2f')][_0xbbf7('0x30')]?_0x1c9e3f['attributes']:_0x41b5de[_0xbbf7('0x29')];if(!_0x64d53e[_0xbbf7('0x2b')][_0xbbf7('0x31')](_0xbbf7('0x32'))){_0x1c9e3f[_0xbbf7('0x1a')]=qs['limit'](_0x64d53e[_0xbbf7('0x2b')][_0xbbf7('0x1a')]);_0x1c9e3f['offset']=qs[_0xbbf7('0x18')](_0x64d53e[_0xbbf7('0x2b')][_0xbbf7('0x18')]);}_0x1c9e3f[_0xbbf7('0x33')]=qs[_0xbbf7('0x34')](_0x64d53e[_0xbbf7('0x2b')]['sort']);_0x1c9e3f['where']=qs[_0xbbf7('0x2c')](_[_0xbbf7('0x35')](_0x64d53e[_0xbbf7('0x2b')],_0x41b5de[_0xbbf7('0x2c')]),_0x32b791);if(_0x64d53e[_0xbbf7('0x2b')]['filter']){_0x1c9e3f[_0xbbf7('0x36')]=_[_0xbbf7('0x37')](_0x1c9e3f[_0xbbf7('0x36')],{'$or':_[_0xbbf7('0x2a')](_0x32b791,function(_0x1f02d0){if(_0x1f02d0[_0xbbf7('0x38')]!=='VIRTUAL'){var _0x4a32e5={};_0x4a32e5[_0x1f02d0[_0xbbf7('0x23')]]={'$like':'%'+_0x64d53e[_0xbbf7('0x2b')][_0xbbf7('0x39')]+'%'};return _0x4a32e5;}})});}_0x1c9e3f=_[_0xbbf7('0x37')]({},_0x1c9e3f,_0x64d53e[_0xbbf7('0x3a')]);var _0x3fe470={'where':_0x1c9e3f[_0xbbf7('0x36')]};return db[_0xbbf7('0x25')][_0xbbf7('0x1b')](_0x3fe470)['then'](function(_0x3a7c57){_0x4c519d[_0xbbf7('0x1b')]=_0x3a7c57;if(_0x64d53e[_0xbbf7('0x2b')][_0xbbf7('0x3b')]){_0x1c9e3f[_0xbbf7('0x3c')]=[{'all':!![]}];}return db[_0xbbf7('0x25')][_0xbbf7('0x3d')](_0x1c9e3f);})['then'](function(_0x10f3a3){_0x4c519d['rows']=_0x10f3a3;return _0x4c519d;})[_0xbbf7('0x20')](respondWithFilteredResult(_0x176eb8,_0x1c9e3f))[_0xbbf7('0x3e')](handleError(_0x176eb8,null));};exports[_0xbbf7('0x3f')]=function(_0x699cc7,_0x41ed78){var _0x504b2c={'raw':![],'where':{'id':_0x699cc7[_0xbbf7('0x40')]['id']}},_0x567405={};_0x567405[_0xbbf7('0x29')]=_[_0xbbf7('0x41')](db[_0xbbf7('0x25')][_0xbbf7('0x26')]);_0x567405[_0xbbf7('0x2b')]=_['keys'](_0x699cc7[_0xbbf7('0x2b')]);_0x567405[_0xbbf7('0x2c')]=_[_0xbbf7('0x2d')](_0x567405[_0xbbf7('0x29')],_0x567405[_0xbbf7('0x2b')]);_0x504b2c[_0xbbf7('0x2f')]=_['intersection'](_0x567405[_0xbbf7('0x29')],qs[_0xbbf7('0x2e')](_0x699cc7[_0xbbf7('0x2b')][_0xbbf7('0x2e')]));_0x504b2c['attributes']=_0x504b2c[_0xbbf7('0x2f')][_0xbbf7('0x30')]?_0x504b2c[_0xbbf7('0x2f')]:_0x567405[_0xbbf7('0x29')];if(_0x699cc7[_0xbbf7('0x2b')][_0xbbf7('0x3b')]){_0x504b2c[_0xbbf7('0x3c')]=[{'all':!![]}];}_0x504b2c=_[_0xbbf7('0x37')]({},_0x504b2c,_0x699cc7['options']);return db[_0xbbf7('0x25')][_0xbbf7('0x42')](_0x504b2c)['then'](handleEntityNotFound(_0x41ed78,null))[_0xbbf7('0x20')](respondWithResult(_0x41ed78,null))['catch'](handleError(_0x41ed78,null));};exports[_0xbbf7('0x43')]=function(_0x50ca88,_0x3b9b6c){return db[_0xbbf7('0x25')][_0xbbf7('0x43')](_0x50ca88[_0xbbf7('0x44')],{})[_0xbbf7('0x20')](respondWithResult(_0x3b9b6c,0xc9))[_0xbbf7('0x3e')](handleError(_0x3b9b6c,null));};exports[_0xbbf7('0x45')]=function(_0x3f733a,_0xdeb860){if(_0x3f733a['body']['id']){delete _0x3f733a[_0xbbf7('0x44')]['id'];}return db['ServicenowAccount'][_0xbbf7('0x42')]({'where':{'id':_0x3f733a['params']['id']}})['then'](handleEntityNotFound(_0xdeb860,null))['then'](saveUpdates(_0x3f733a[_0xbbf7('0x44')],null))['then'](respondWithResult(_0xdeb860,null))['catch'](handleError(_0xdeb860,null));};exports[_0xbbf7('0x21')]=function(_0x401845,_0x3dd8cd){return db[_0xbbf7('0x25')][_0xbbf7('0x42')]({'where':{'id':_0x401845[_0xbbf7('0x40')]['id']}})[_0xbbf7('0x20')](handleEntityNotFound(_0x3dd8cd,null))[_0xbbf7('0x20')](removeEntity(_0x3dd8cd,null))['catch'](handleError(_0x3dd8cd,null));};exports[_0xbbf7('0x46')]=function(_0x2665b1,_0xa576c6,_0x10101e){var _0x5726e5={};var _0x17b3bb={};var _0x5c241c;var _0x31f35d;return db['ServicenowAccount']['findOne']({'where':{'id':_0x2665b1[_0xbbf7('0x40')]['id']}})[_0xbbf7('0x20')](handleEntityNotFound(_0xa576c6,null))[_0xbbf7('0x20')](function(_0x450cc3){if(_0x450cc3){_0x5c241c=_0x450cc3;_0x17b3bb['model']=_[_0xbbf7('0x41')](db[_0xbbf7('0x47')][_0xbbf7('0x26')]);_0x17b3bb[_0xbbf7('0x2b')]=_[_0xbbf7('0x41')](_0x2665b1['query']);_0x17b3bb[_0xbbf7('0x2c')]=_['intersection'](_0x17b3bb[_0xbbf7('0x29')],_0x17b3bb['query']);_0x5726e5[_0xbbf7('0x2f')]=_[_0xbbf7('0x2d')](_0x17b3bb[_0xbbf7('0x29')],qs['fields'](_0x2665b1[_0xbbf7('0x2b')]['fields']));_0x5726e5[_0xbbf7('0x2f')]=_0x5726e5[_0xbbf7('0x2f')][_0xbbf7('0x30')]?_0x5726e5[_0xbbf7('0x2f')]:_0x17b3bb[_0xbbf7('0x29')];_0x5726e5[_0xbbf7('0x33')]=qs[_0xbbf7('0x34')](_0x2665b1[_0xbbf7('0x2b')]['sort']);_0x5726e5[_0xbbf7('0x36')]=qs[_0xbbf7('0x2c')](_[_0xbbf7('0x35')](_0x2665b1[_0xbbf7('0x2b')],_0x17b3bb['filters']));if(_0x2665b1[_0xbbf7('0x2b')][_0xbbf7('0x39')]){_0x5726e5['where']=_['merge'](_0x5726e5[_0xbbf7('0x36')],{'$or':_[_0xbbf7('0x2a')](_0x5726e5[_0xbbf7('0x2f')],function(_0x3a92a6){var _0x3b8d53={};_0x3b8d53[_0x3a92a6]={'$like':'%'+_0x2665b1[_0xbbf7('0x2b')]['filter']+'%'};return _0x3b8d53;})});}_0x5726e5=_['merge']({},_0x5726e5,_0x2665b1[_0xbbf7('0x3a')]);return _0x5c241c[_0xbbf7('0x46')](_0x5726e5);}})[_0xbbf7('0x20')](function(_0x34dbf8){if(_0x34dbf8){_0x31f35d=_0x34dbf8['length'];if(!_0x2665b1[_0xbbf7('0x2b')][_0xbbf7('0x31')](_0xbbf7('0x32'))){_0x5726e5[_0xbbf7('0x1a')]=qs[_0xbbf7('0x1a')](_0x2665b1[_0xbbf7('0x2b')][_0xbbf7('0x1a')]);_0x5726e5['offset']=qs[_0xbbf7('0x18')](_0x2665b1[_0xbbf7('0x2b')]['offset']);}return _0x5c241c[_0xbbf7('0x46')](_0x5726e5);}})[_0xbbf7('0x20')](function(_0x2aec0b){if(_0x2aec0b){return _0x2aec0b?{'count':_0x31f35d,'rows':_0x2aec0b}:null;}})[_0xbbf7('0x20')](respondWithResult(_0xa576c6,null))[_0xbbf7('0x3e')](handleError(_0xa576c6,null));};exports[_0xbbf7('0x48')]=function(_0x1c5656,_0x3ab440,_0x1824db){if(_0x1c5656[_0xbbf7('0x44')]['id']){delete _0x1c5656[_0xbbf7('0x44')]['id'];}return db[_0xbbf7('0x25')]['findOne']({'where':{'id':_0x1c5656[_0xbbf7('0x40')]['id']}})[_0xbbf7('0x20')](handleEntityNotFound(_0x3ab440,null))['then'](function(_0x43ad27){if(_0x43ad27){_0x1c5656[_0xbbf7('0x44')]['AccountId']=_0x43ad27['id'];_0x1c5656[_0xbbf7('0x44')][_0xbbf7('0x49')]=integrations[_0xbbf7('0x4a')](_0x1c5656[_0xbbf7('0x44')][_0xbbf7('0x4b')],_0x1c5656['body'][_0xbbf7('0x38')]);_0x1c5656[_0xbbf7('0x44')][_0xbbf7('0x4c')]=integrations['getDescriptions'](_0x1c5656['body'][_0xbbf7('0x4b')],_0x1c5656['body'][_0xbbf7('0x38')]);return db['ServicenowConfiguration'][_0xbbf7('0x43')](_0x1c5656[_0xbbf7('0x44')],{'include':[{'model':db[_0xbbf7('0x4d')],'as':_0xbbf7('0x49')},{'model':db['ServicenowField'],'as':_0xbbf7('0x4c')}]});}return null;})['then'](respondWithResult(_0x3ab440,null))[_0xbbf7('0x3e')](handleError(_0x3ab440,null));};exports[_0xbbf7('0x4e')]=function(_0x33b1d6,_0x25486c,_0x43c083){var _0x5f478a=[_0xbbf7('0x4f'),'hold_reason',_0xbbf7('0x50'),_0xbbf7('0x51'),_0xbbf7('0x52'),_0xbbf7('0x53'),_0xbbf7('0x54'),_0xbbf7('0x55'),_0xbbf7('0x56')];var _0x1ee9bb=[_0xbbf7('0x57'),_0xbbf7('0x4f'),_0xbbf7('0x58'),_0xbbf7('0x59'),_0xbbf7('0x5a'),_0xbbf7('0x5b'),_0xbbf7('0x5c'),_0xbbf7('0x5d'),_0xbbf7('0x5e'),'number','resolved_by',_0xbbf7('0x5f'),_0xbbf7('0x60'),'user_input',_0xbbf7('0x61'),_0xbbf7('0x62'),'state',_0xbbf7('0x63'),_0xbbf7('0x50'),_0xbbf7('0x33'),_0xbbf7('0x64'),_0xbbf7('0x65'),'cmdb_ci',_0xbbf7('0x66'),_0xbbf7('0x67'),'active',_0xbbf7('0x68'),_0xbbf7('0x69'),'priority','sys_domain_path',_0xbbf7('0x6a'),_0xbbf7('0x6b'),_0xbbf7('0x6c'),'opened_at',_0xbbf7('0x6d'),'group_list',_0xbbf7('0x6e'),_0xbbf7('0x6f'),_0xbbf7('0x70'),_0xbbf7('0x71'),'approval_set','subcategory',_0xbbf7('0x72'),'short_description',_0xbbf7('0x52'),_0xbbf7('0x73'),'delivery_task','work_start',_0xbbf7('0x74'),'business_stc',_0xbbf7('0x75'),_0xbbf7('0x76'),_0xbbf7('0x77'),'notify','sys_class_name',_0xbbf7('0x78'),'closed_by','follow_up',_0xbbf7('0x79'),'sys_id',_0xbbf7('0x7a'),_0xbbf7('0x7b'),_0xbbf7('0x54'),_0xbbf7('0x7c'),_0xbbf7('0x7d'),_0xbbf7('0x7e'),_0xbbf7('0x7f'),_0xbbf7('0x80'),_0xbbf7('0x81'),_0xbbf7('0x55'),'comments',_0xbbf7('0x82'),'approval',_0xbbf7('0x83'),_0xbbf7('0x84'),_0xbbf7('0x85'),_0xbbf7('0x86'),_0xbbf7('0x87'),_0xbbf7('0x88'),_0xbbf7('0x89'),_0xbbf7('0x8a'),'location',_0xbbf7('0x56')];var _0x52c601='';var _0x37dc14='';var _0x5e281b=[];var _0x3b4496='';var _0x1f9d03='';var _0x29f521=[];var _0x1590b4='';var _0x57442c='';var _0x2d859f={};var _0x221dd6='';return db['ServicenowAccount'][_0xbbf7('0x8b')]({'where':{'id':_0x33b1d6['params']['id']},'attributes':['id','username',_0xbbf7('0x8c'),'email','remoteUri','serverUrl']})[_0xbbf7('0x20')](handleEntityNotFound(_0x25486c,null))[_0xbbf7('0x20')](function(_0x3c1430){if(_0x3c1430){_0x221dd6=_0x3c1430['remoteUri'];var _0x4abbd9=_0x221dd6[_0xbbf7('0x8d')](-0x1);if(_0x4abbd9==='/'){_0x221dd6=_0x221dd6[_0xbbf7('0x8e')](0x0,_0x221dd6[_0xbbf7('0x8f')](_0x4abbd9));}_0x57442c=util[_0xbbf7('0x90')]('%s/api/now/doc/table/schema/',_0x221dd6);_0x1590b4=util[_0xbbf7('0x90')](_0xbbf7('0x91'),_0x221dd6);_0x2d859f={'user':_0x3c1430[_0xbbf7('0x92')],'pass':_0x3c1430[_0xbbf7('0x8c')]};var _0x2e9cb0={'method':_0xbbf7('0x93'),'uri':_0x57442c+_0xbbf7('0x94'),'auth':_0x2d859f,'json':!![]};return rp(_0x2e9cb0);}})['then'](function(_0x23cce0){if(_0x23cce0[_0xbbf7('0x95')][_0xbbf7('0x30')]>0x0){_0x52c601=_0x23cce0['result'];}console[_0xbbf7('0x96')](_0xbbf7('0x97'),_0x52c601);_0x29f521=[];_0x37dc14=Object[_0xbbf7('0x98')]([],_0x52c601);_[_0xbbf7('0x99')](_0x37dc14,function(_0x66a493){return!_0x5f478a['includes'](_0x66a493[_0xbbf7('0x23')]);});_0x37dc14[_0xbbf7('0x9a')](function(_0x51362f){var _0x56f9c2=createFieldObject(_0x1590b4,_0x2d859f,_0x51362f[_0xbbf7('0x9b')],_0x51362f[_0xbbf7('0x23')],_0x51362f[_0xbbf7('0x9c')],![]);_0x29f521[_0xbbf7('0x9d')](_0x56f9c2);});return Promise[_0xbbf7('0x9e')](_0x29f521);})[_0xbbf7('0x20')](function(_0x2eab53){_0x5e281b=_0x2eab53;_0x3b4496=Object['assign']([],_0x52c601);console['log'](_0xbbf7('0x9f'),_0x52c601);_['remove'](_0x3b4496,function(_0x9578a4){return _0x1ee9bb[_0xbbf7('0xa0')](_0x9578a4['name']);});console[_0xbbf7('0x96')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3b4496);_0x29f521=[];_0x3b4496['forEach'](function(_0x15cbff){var _0x4ce7e6=createFieldObject(_0x1590b4,_0x2d859f,_0x15cbff['internalType'],_0x15cbff['name'],_0x15cbff[_0xbbf7('0x9c')],!![]);_0x29f521[_0xbbf7('0x9d')](_0x4ce7e6);});return Promise[_0xbbf7('0x9e')](_0x29f521);})[_0xbbf7('0x20')](function(_0x5a6c7a){_0x1f9d03=_0x5a6c7a;var _0x254757=_0x5e281b[_0xbbf7('0xa1')](_0x1f9d03);return{'count':_0x254757['length'],'rows':_0x254757};})[_0xbbf7('0x20')](respondWithResult(_0x25486c,null))[_0xbbf7('0x3e')](function(_0x3d5fab){console['log'](_0xbbf7('0xa2')+_0x3d5fab);var _0x596c60=_0x33b1d6[_0xbbf7('0x2b')]['test']?0x1f4:_0x3d5fab[_0xbbf7('0xa3')]||0x1f4;logger[_0xbbf7('0xa4')](_0x3d5fab['stack']);delete _0x3d5fab[_0xbbf7('0x23')];if(_0x596c60===0x191){_0x596c60=0x190;}_0x25486c['status'](_0x596c60)[_0xbbf7('0xa5')](_0x33b1d6[_0xbbf7('0x2b')]['test']?{'message':_0xbbf7('0xa6'),'statusCode':_0x3d5fab['statusCode']}:_0x3d5fab);});};function createFieldObject(_0x4e21c3,_0x22e47d,_0x5b2a77,_0x1929f5,_0xa10a16,_0x493e25){return new Promise(function(_0x5ee404,_0x50a560){var _0x6ce921={'id':_0x1929f5,'name':_0xa10a16,'custom':_0x493e25};if(_0x5b2a77===_0xbbf7('0xa7')){_0x6ce921[_0xbbf7('0x3a')]=[{'name':_0xbbf7('0xa8'),'value':'true'},{'name':_0xbbf7('0xa9'),'value':'false'}];_0x5ee404(_0x6ce921);}else{var _0xc39b18={'method':_0xbbf7('0x93'),'uri':_0x4e21c3+_0xbbf7('0xaa')+_0x1929f5,'auth':_0x22e47d,'json':!![]};return rp(_0xc39b18)[_0xbbf7('0x20')](function(_0x6f2642){var _0x159c4e=[];if(_0x6f2642[_0xbbf7('0x95')][_0xbbf7('0x30')]>0x0){_0x6f2642[_0xbbf7('0x95')][_0xbbf7('0x9a')](function(_0x95eb00){if(_0x95eb00[_0xbbf7('0xab')]===_0xbbf7('0xac')){var _0x51e303={'name':_0x95eb00['label'],'value':_0x95eb00[_0xbbf7('0xad')]};_0x159c4e['push'](_0x51e303);}});}_0x6ce921['options']=_0x159c4e;if(_0x6ce921[_0xbbf7('0x3a')][_0xbbf7('0x30')]>0x0){_0x5ee404(_0x6ce921);}else{if(_0x493e25==![]){_0x5ee404();}else{_0x5ee404(_0x6ce921);}}});}});} \ No newline at end of file +var _0xc43c=['sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','cmdb_ci','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','group_list','work_end','resolved_at','caller_id','approval_set','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','username','remoteUri','lastIndexOf','format','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','error','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','destroy','then','stack','name','send','index','map','ServicenowAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','getConfigurations','findOne','ServicenowConfiguration','sort','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by'];(function(_0x28d8c7,_0x585fe6){var _0x379e68=function(_0x406f22){while(--_0x406f22){_0x28d8c7['push'](_0x28d8c7['shift']());}};_0x379e68(++_0x585fe6);}(_0xc43c,0x1ab));var _0xcc43=function(_0x19e00d,_0x183dbc){_0x19e00d=_0x19e00d-0x0;var _0x1ed889=_0xc43c[_0x19e00d];return _0x1ed889;};'use strict';var emlformat=require(_0xcc43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc43('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc43('0x2'));var moment=require(_0xcc43('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc43('0x4'));var util=require(_0xcc43('0x5'));var path=require(_0xcc43('0x6'));var sox=require('sox');var csv=require(_0xcc43('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc43('0x8'));var _=require(_0xcc43('0x9'));var squel=require(_0xcc43('0xa'));var crypto=require(_0xcc43('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcc43('0xc'));var Papa=require(_0xcc43('0xd'));var Redis=require(_0xcc43('0xe'));var authService=require(_0xcc43('0xf'));var qs=require(_0xcc43('0x10'));var as=require(_0xcc43('0x11'));var hardwareService=require(_0xcc43('0x12'));var logger=require(_0xcc43('0x13'))('api');var utils=require(_0xcc43('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcc43('0x15'));var db=require(_0xcc43('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b0947,_0x4830f3){_0x4830f3=_0x4830f3||0xcc;return function(_0x3656bb){if(_0x3656bb){return _0x5b0947['sendStatus'](_0x4830f3);}return _0x5b0947[_0xcc43('0x17')](_0x4830f3)[_0xcc43('0x18')]();};}function respondWithResult(_0xcd22d9,_0x527fbe){_0x527fbe=_0x527fbe||0xc8;return function(_0x44b5e8){if(_0x44b5e8){return _0xcd22d9['status'](_0x527fbe)['json'](_0x44b5e8);}};}function respondWithFilteredResult(_0x1bbecd,_0x22e4b8){return function(_0x5386b1){if(_0x5386b1){var _0x25be6d=typeof _0x22e4b8[_0xcc43('0x19')]===_0xcc43('0x1a')&&typeof _0x22e4b8[_0xcc43('0x1b')]==='undefined';var _0x1b2a2a=_0x5386b1[_0xcc43('0x1c')];var _0x282774=_0x25be6d?0x0:_0x22e4b8[_0xcc43('0x19')];var _0x53a601=_0x25be6d?_0x5386b1[_0xcc43('0x1c')]:_0x22e4b8[_0xcc43('0x19')]+_0x22e4b8[_0xcc43('0x1b')];var _0x3dba29;if(_0x53a601>=_0x1b2a2a){_0x53a601=_0x1b2a2a;_0x3dba29=0xc8;}else{_0x3dba29=0xce;}_0x1bbecd[_0xcc43('0x17')](_0x3dba29);return _0x1bbecd[_0xcc43('0x1d')]('Content-Range',_0x282774+'-'+_0x53a601+'/'+_0x1b2a2a)[_0xcc43('0x1e')](_0x5386b1);}return null;};}function patchUpdates(_0x11689f){return function(_0x27f9ad){try{jsonpatch[_0xcc43('0x1f')](_0x27f9ad,_0x11689f,!![]);}catch(_0x50b923){return BPromise[_0xcc43('0x20')](_0x50b923);}return _0x27f9ad[_0xcc43('0x21')]();};}function saveUpdates(_0x187419,_0x2f5dea){return function(_0x428b86){if(_0x428b86){return _0x428b86['update'](_0x187419)['then'](function(_0x1cb1fe){return _0x1cb1fe;});}return null;};}function removeEntity(_0x55dfdb,_0x237bb3){return function(_0x2218fe){if(_0x2218fe){return _0x2218fe[_0xcc43('0x22')]()[_0xcc43('0x23')](function(){_0x55dfdb[_0xcc43('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0163,_0x4d43f8){return function(_0x1923d7){if(!_0x1923d7){_0x4b0163['sendStatus'](0x194);}return _0x1923d7;};}function handleError(_0x555528,_0x114dcf){_0x114dcf=_0x114dcf||0x1f4;return function(_0x81e57e){logger['error'](_0x81e57e[_0xcc43('0x24')]);if(_0x81e57e[_0xcc43('0x25')]){delete _0x81e57e['name'];}_0x555528[_0xcc43('0x17')](_0x114dcf)[_0xcc43('0x26')](_0x81e57e);};}exports[_0xcc43('0x27')]=function(_0x2bf7f0,_0x15d8ff){var _0x5c518a={},_0x31774c={},_0x29decd={'count':0x0,'rows':[]};var _0x8e6286=_[_0xcc43('0x28')](db[_0xcc43('0x29')][_0xcc43('0x2a')],function(_0x5142ea){return{'name':_0x5142ea['fieldName'],'type':_0x5142ea[_0xcc43('0x2b')][_0xcc43('0x2c')]};});_0x31774c[_0xcc43('0x2d')]=_['map'](_0x8e6286,'name');_0x31774c[_0xcc43('0x2e')]=_[_0xcc43('0x2f')](_0x2bf7f0[_0xcc43('0x2e')]);_0x31774c[_0xcc43('0x30')]=_[_0xcc43('0x31')](_0x31774c[_0xcc43('0x2d')],_0x31774c[_0xcc43('0x2e')]);_0x5c518a[_0xcc43('0x32')]=_[_0xcc43('0x31')](_0x31774c['model'],qs[_0xcc43('0x33')](_0x2bf7f0[_0xcc43('0x2e')][_0xcc43('0x33')]));_0x5c518a[_0xcc43('0x32')]=_0x5c518a[_0xcc43('0x32')]['length']?_0x5c518a['attributes']:_0x31774c[_0xcc43('0x2d')];if(!_0x2bf7f0[_0xcc43('0x2e')][_0xcc43('0x34')](_0xcc43('0x35'))){_0x5c518a[_0xcc43('0x1b')]=qs[_0xcc43('0x1b')](_0x2bf7f0[_0xcc43('0x2e')][_0xcc43('0x1b')]);_0x5c518a[_0xcc43('0x19')]=qs[_0xcc43('0x19')](_0x2bf7f0[_0xcc43('0x2e')][_0xcc43('0x19')]);}_0x5c518a[_0xcc43('0x36')]=qs['sort'](_0x2bf7f0['query']['sort']);_0x5c518a['where']=qs[_0xcc43('0x30')](_['pick'](_0x2bf7f0[_0xcc43('0x2e')],_0x31774c[_0xcc43('0x30')]),_0x8e6286);if(_0x2bf7f0[_0xcc43('0x2e')][_0xcc43('0x37')]){_0x5c518a['where']=_['merge'](_0x5c518a[_0xcc43('0x38')],{'$or':_[_0xcc43('0x28')](_0x8e6286,function(_0x5a5fcb){if(_0x5a5fcb[_0xcc43('0x2b')]!==_0xcc43('0x39')){var _0xd59c2b={};_0xd59c2b[_0x5a5fcb['name']]={'$like':'%'+_0x2bf7f0[_0xcc43('0x2e')]['filter']+'%'};return _0xd59c2b;}})});}_0x5c518a=_[_0xcc43('0x3a')]({},_0x5c518a,_0x2bf7f0[_0xcc43('0x3b')]);var _0x41f742={'where':_0x5c518a[_0xcc43('0x38')]};return db[_0xcc43('0x29')][_0xcc43('0x1c')](_0x41f742)['then'](function(_0x368111){_0x29decd[_0xcc43('0x1c')]=_0x368111;if(_0x2bf7f0[_0xcc43('0x2e')][_0xcc43('0x3c')]){_0x5c518a[_0xcc43('0x3d')]=[{'all':!![]}];}return db[_0xcc43('0x29')][_0xcc43('0x3e')](_0x5c518a);})[_0xcc43('0x23')](function(_0x495f6a){_0x29decd[_0xcc43('0x3f')]=_0x495f6a;return _0x29decd;})['then'](respondWithFilteredResult(_0x15d8ff,_0x5c518a))[_0xcc43('0x40')](handleError(_0x15d8ff,null));};exports[_0xcc43('0x41')]=function(_0x341fdb,_0x4f95de){var _0x5c6b6={'raw':![],'where':{'id':_0x341fdb['params']['id']}},_0x9397f8={};_0x9397f8[_0xcc43('0x2d')]=_[_0xcc43('0x2f')](db[_0xcc43('0x29')][_0xcc43('0x2a')]);_0x9397f8[_0xcc43('0x2e')]=_[_0xcc43('0x2f')](_0x341fdb[_0xcc43('0x2e')]);_0x9397f8['filters']=_[_0xcc43('0x31')](_0x9397f8[_0xcc43('0x2d')],_0x9397f8['query']);_0x5c6b6[_0xcc43('0x32')]=_['intersection'](_0x9397f8[_0xcc43('0x2d')],qs[_0xcc43('0x33')](_0x341fdb[_0xcc43('0x2e')][_0xcc43('0x33')]));_0x5c6b6[_0xcc43('0x32')]=_0x5c6b6['attributes'][_0xcc43('0x42')]?_0x5c6b6[_0xcc43('0x32')]:_0x9397f8[_0xcc43('0x2d')];if(_0x341fdb[_0xcc43('0x2e')][_0xcc43('0x3c')]){_0x5c6b6[_0xcc43('0x3d')]=[{'all':!![]}];}_0x5c6b6=_[_0xcc43('0x3a')]({},_0x5c6b6,_0x341fdb[_0xcc43('0x3b')]);return db['ServicenowAccount'][_0xcc43('0x43')](_0x5c6b6)[_0xcc43('0x23')](handleEntityNotFound(_0x4f95de,null))[_0xcc43('0x23')](respondWithResult(_0x4f95de,null))[_0xcc43('0x40')](handleError(_0x4f95de,null));};exports[_0xcc43('0x44')]=function(_0x325f36,_0x6293ca){return db[_0xcc43('0x29')]['create'](_0x325f36[_0xcc43('0x45')],{})['then'](respondWithResult(_0x6293ca,0xc9))[_0xcc43('0x40')](handleError(_0x6293ca,null));};exports[_0xcc43('0x46')]=function(_0x841648,_0x3fc409){if(_0x841648[_0xcc43('0x45')]['id']){delete _0x841648[_0xcc43('0x45')]['id'];}return db[_0xcc43('0x29')][_0xcc43('0x43')]({'where':{'id':_0x841648[_0xcc43('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fc409,null))[_0xcc43('0x23')](saveUpdates(_0x841648[_0xcc43('0x45')],null))[_0xcc43('0x23')](respondWithResult(_0x3fc409,null))[_0xcc43('0x40')](handleError(_0x3fc409,null));};exports[_0xcc43('0x22')]=function(_0x561efa,_0x55a1e0){return db[_0xcc43('0x29')]['find']({'where':{'id':_0x561efa[_0xcc43('0x47')]['id']}})[_0xcc43('0x23')](handleEntityNotFound(_0x55a1e0,null))['then'](removeEntity(_0x55a1e0,null))['catch'](handleError(_0x55a1e0,null));};exports[_0xcc43('0x48')]=function(_0x635e5d,_0x1c904,_0x19e730){var _0x1967dc={};var _0x20ed4a={};var _0x1abb03;var _0x3f35dd;return db[_0xcc43('0x29')][_0xcc43('0x49')]({'where':{'id':_0x635e5d[_0xcc43('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c904,null))[_0xcc43('0x23')](function(_0x3afe6a){if(_0x3afe6a){_0x1abb03=_0x3afe6a;_0x20ed4a[_0xcc43('0x2d')]=_[_0xcc43('0x2f')](db[_0xcc43('0x4a')][_0xcc43('0x2a')]);_0x20ed4a[_0xcc43('0x2e')]=_[_0xcc43('0x2f')](_0x635e5d[_0xcc43('0x2e')]);_0x20ed4a['filters']=_['intersection'](_0x20ed4a['model'],_0x20ed4a[_0xcc43('0x2e')]);_0x1967dc[_0xcc43('0x32')]=_['intersection'](_0x20ed4a[_0xcc43('0x2d')],qs[_0xcc43('0x33')](_0x635e5d[_0xcc43('0x2e')][_0xcc43('0x33')]));_0x1967dc[_0xcc43('0x32')]=_0x1967dc['attributes'][_0xcc43('0x42')]?_0x1967dc['attributes']:_0x20ed4a[_0xcc43('0x2d')];_0x1967dc[_0xcc43('0x36')]=qs[_0xcc43('0x4b')](_0x635e5d['query'][_0xcc43('0x4b')]);_0x1967dc[_0xcc43('0x38')]=qs[_0xcc43('0x30')](_[_0xcc43('0x4c')](_0x635e5d[_0xcc43('0x2e')],_0x20ed4a[_0xcc43('0x30')]));if(_0x635e5d['query'][_0xcc43('0x37')]){_0x1967dc[_0xcc43('0x38')]=_[_0xcc43('0x3a')](_0x1967dc['where'],{'$or':_['map'](_0x1967dc[_0xcc43('0x32')],function(_0x509fd5){var _0x1ebd13={};_0x1ebd13[_0x509fd5]={'$like':'%'+_0x635e5d[_0xcc43('0x2e')][_0xcc43('0x37')]+'%'};return _0x1ebd13;})});}_0x1967dc=_[_0xcc43('0x3a')]({},_0x1967dc,_0x635e5d[_0xcc43('0x3b')]);return _0x1abb03[_0xcc43('0x48')](_0x1967dc);}})[_0xcc43('0x23')](function(_0x3f08b6){if(_0x3f08b6){_0x3f35dd=_0x3f08b6['length'];if(!_0x635e5d[_0xcc43('0x2e')][_0xcc43('0x34')](_0xcc43('0x35'))){_0x1967dc[_0xcc43('0x1b')]=qs[_0xcc43('0x1b')](_0x635e5d[_0xcc43('0x2e')]['limit']);_0x1967dc['offset']=qs[_0xcc43('0x19')](_0x635e5d[_0xcc43('0x2e')][_0xcc43('0x19')]);}return _0x1abb03[_0xcc43('0x48')](_0x1967dc);}})[_0xcc43('0x23')](function(_0x75fb82){if(_0x75fb82){return _0x75fb82?{'count':_0x3f35dd,'rows':_0x75fb82}:null;}})[_0xcc43('0x23')](respondWithResult(_0x1c904,null))[_0xcc43('0x40')](handleError(_0x1c904,null));};exports['addConfiguration']=function(_0x45a577,_0x2099a2,_0x31eedf){if(_0x45a577[_0xcc43('0x45')]['id']){delete _0x45a577[_0xcc43('0x45')]['id'];}return db['ServicenowAccount'][_0xcc43('0x49')]({'where':{'id':_0x45a577[_0xcc43('0x47')]['id']}})[_0xcc43('0x23')](handleEntityNotFound(_0x2099a2,null))['then'](function(_0x2c2ba9){if(_0x2c2ba9){_0x45a577['body'][_0xcc43('0x4d')]=_0x2c2ba9['id'];_0x45a577[_0xcc43('0x45')][_0xcc43('0x4e')]=integrations[_0xcc43('0x4f')](_0x45a577[_0xcc43('0x45')][_0xcc43('0x50')],_0x45a577[_0xcc43('0x45')][_0xcc43('0x2b')]);_0x45a577[_0xcc43('0x45')][_0xcc43('0x51')]=integrations[_0xcc43('0x52')](_0x45a577['body'][_0xcc43('0x50')],_0x45a577[_0xcc43('0x45')][_0xcc43('0x2b')]);return db[_0xcc43('0x4a')][_0xcc43('0x44')](_0x45a577[_0xcc43('0x45')],{'include':[{'model':db[_0xcc43('0x53')],'as':_0xcc43('0x4e')},{'model':db['ServicenowField'],'as':_0xcc43('0x51')}]});}return null;})['then'](respondWithResult(_0x2099a2,null))['catch'](handleError(_0x2099a2,null));};exports[_0xcc43('0x54')]=function(_0x3073f7,_0x491c15,_0x50785c){var _0x3a0023=['made_sla',_0xcc43('0x55'),_0xcc43('0x56'),_0xcc43('0x57'),_0xcc43('0x58'),_0xcc43('0x59'),_0xcc43('0x5a'),_0xcc43('0x5b'),_0xcc43('0x5c')];var _0x168e72=[_0xcc43('0x5d'),'made_sla',_0xcc43('0x5e'),_0xcc43('0x5f'),_0xcc43('0x60'),_0xcc43('0x61'),_0xcc43('0x62'),'hold_reason',_0xcc43('0x63'),'number',_0xcc43('0x64'),_0xcc43('0x65'),_0xcc43('0x66'),_0xcc43('0x67'),_0xcc43('0x68'),'sys_domain',_0xcc43('0x69'),_0xcc43('0x6a'),_0xcc43('0x56'),_0xcc43('0x36'),_0xcc43('0x6b'),'closed_at',_0xcc43('0x6c'),'delivery_plan',_0xcc43('0x6d'),_0xcc43('0x6e'),_0xcc43('0x6f'),_0xcc43('0x70'),_0xcc43('0x71'),'sys_domain_path',_0xcc43('0x72'),_0xcc43('0x73'),_0xcc43('0x74'),'opened_at','business_duration',_0xcc43('0x75'),_0xcc43('0x76'),'reopened_time',_0xcc43('0x77'),_0xcc43('0x78'),_0xcc43('0x79'),'subcategory','work_notes','short_description',_0xcc43('0x58'),_0xcc43('0x7a'),_0xcc43('0x7b'),_0xcc43('0x7c'),_0xcc43('0x7d'),_0xcc43('0x7e'),_0xcc43('0x7f'),_0xcc43('0x80'),'calendar_duration',_0xcc43('0x59'),'sys_class_name',_0xcc43('0x81'),_0xcc43('0x82'),_0xcc43('0x83'),_0xcc43('0x84'),_0xcc43('0x85'),_0xcc43('0x86'),_0xcc43('0x87'),'incident_state',_0xcc43('0x88'),'problem_id',_0xcc43('0x89'),_0xcc43('0x8a'),_0xcc43('0x8b'),_0xcc43('0x8c'),_0xcc43('0x5b'),'comments','sla_due',_0xcc43('0x8d'),_0xcc43('0x8e'),_0xcc43('0x8f'),'sys_mod_count',_0xcc43('0x90'),_0xcc43('0x91'),_0xcc43('0x92'),_0xcc43('0x93'),'correlation_id','location','category'];var _0x28a9f6='';var _0x3d68ec='';var _0x3a9d91=[];var _0x2e9e12='';var _0x55779b='';var _0x4b476d=[];var _0x556ef1='';var _0x2a521a='';var _0x442d23={};var _0x5175fb='';return db['ServicenowAccount'][_0xcc43('0x49')]({'where':{'id':_0x3073f7[_0xcc43('0x47')]['id']},'attributes':['id',_0xcc43('0x94'),'password','email',_0xcc43('0x95'),'serverUrl']})[_0xcc43('0x23')](handleEntityNotFound(_0x491c15,null))[_0xcc43('0x23')](function(_0x2cc111){if(_0x2cc111){_0x5175fb=_0x2cc111[_0xcc43('0x95')];var _0x3a8d9a=_0x5175fb['slice'](-0x1);if(_0x3a8d9a==='/'){_0x5175fb=_0x5175fb['substring'](0x0,_0x5175fb[_0xcc43('0x96')](_0x3a8d9a));}_0x2a521a=util[_0xcc43('0x97')]('%s/api/now/doc/table/schema/',_0x5175fb);_0x556ef1=util['format'](_0xcc43('0x98'),_0x5175fb);_0x442d23={'user':_0x2cc111[_0xcc43('0x94')],'pass':_0x2cc111[_0xcc43('0x99')]};var _0x4ace63={'method':_0xcc43('0x9a'),'uri':_0x2a521a+_0xcc43('0x9b'),'auth':_0x442d23,'json':!![]};return rp(_0x4ace63);}})[_0xcc43('0x23')](function(_0x357dfb){if(_0x357dfb[_0xcc43('0x9c')][_0xcc43('0x42')]>0x0){_0x28a9f6=_0x357dfb[_0xcc43('0x9c')];}console[_0xcc43('0x9d')](_0xcc43('0x9e'),_0x28a9f6);_0x4b476d=[];_0x3d68ec=Object[_0xcc43('0x9f')]([],_0x28a9f6);_[_0xcc43('0xa0')](_0x3d68ec,function(_0x1b01cc){return!_0x3a0023[_0xcc43('0xa1')](_0x1b01cc[_0xcc43('0x25')]);});_0x3d68ec[_0xcc43('0xa2')](function(_0x641088){var _0x153d2a=createFieldObject(_0x556ef1,_0x442d23,_0x641088[_0xcc43('0xa3')],_0x641088[_0xcc43('0x25')],_0x641088[_0xcc43('0xa4')],![]);_0x4b476d[_0xcc43('0xa5')](_0x153d2a);});return Promise['all'](_0x4b476d);})[_0xcc43('0x23')](function(_0x4e2b3e){_0x3a9d91=_0x4e2b3e;_0x2e9e12=Object[_0xcc43('0x9f')]([],_0x28a9f6);console['log']('TCL:\x20_object',_0x28a9f6);_[_0xcc43('0xa0')](_0x2e9e12,function(_0x2084a1){return _0x168e72[_0xcc43('0xa1')](_0x2084a1[_0xcc43('0x25')]);});console[_0xcc43('0x9d')](_0xcc43('0xa6'),_0x2e9e12);_0x4b476d=[];_0x2e9e12['forEach'](function(_0x5f17ec){var _0x29e6aa=createFieldObject(_0x556ef1,_0x442d23,_0x5f17ec[_0xcc43('0xa3')],_0x5f17ec[_0xcc43('0x25')],_0x5f17ec[_0xcc43('0xa4')],!![]);_0x4b476d[_0xcc43('0xa5')](_0x29e6aa);});return Promise['all'](_0x4b476d);})[_0xcc43('0x23')](function(_0x35e3b4){_0x55779b=_0x35e3b4;var _0x85e8b7=_0x3a9d91[_0xcc43('0xa7')](_0x55779b);return{'count':_0x85e8b7['length'],'rows':_0x85e8b7};})[_0xcc43('0x23')](respondWithResult(_0x491c15,null))[_0xcc43('0x40')](function(_0x44dca4){console[_0xcc43('0x9d')]('ServiceNow\x20error:\x20'+_0x44dca4);var _0x8f7156=_0x3073f7['query'][_0xcc43('0xa8')]?0x1f4:_0x44dca4[_0xcc43('0xa9')]||0x1f4;logger[_0xcc43('0xaa')](_0x44dca4[_0xcc43('0x24')]);delete _0x44dca4[_0xcc43('0x25')];if(_0x8f7156===0x191){_0x8f7156=0x190;}_0x491c15[_0xcc43('0x17')](_0x8f7156)['send'](_0x3073f7['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x44dca4[_0xcc43('0xa9')]}:_0x44dca4);});};function createFieldObject(_0x3cdf8f,_0x2f94e1,_0xa83c22,_0x2c392a,_0x24f618,_0x10a8ef){return new Promise(function(_0x448f82,_0x1fae68){var _0x5b5694={'id':_0x2c392a,'name':_0x24f618,'custom':_0x10a8ef};if(_0xa83c22==='boolean'){_0x5b5694[_0xcc43('0x3b')]=[{'name':'True','value':'true'},{'name':_0xcc43('0xab'),'value':'false'}];_0x448f82(_0x5b5694);}else{var _0x518eed={'method':_0xcc43('0x9a'),'uri':_0x3cdf8f+_0xcc43('0xac')+_0x2c392a,'auth':_0x2f94e1,'json':!![]};return rp(_0x518eed)[_0xcc43('0x23')](function(_0x430670){var _0x42de78=[];if(_0x430670[_0xcc43('0x9c')][_0xcc43('0x42')]>0x0){_0x430670['result'][_0xcc43('0xa2')](function(_0x1be3c9){if(_0x1be3c9[_0xcc43('0xad')]===_0xcc43('0xae')){var _0x4b37f1={'name':_0x1be3c9[_0xcc43('0xa4')],'value':_0x1be3c9[_0xcc43('0xaf')]};_0x42de78['push'](_0x4b37f1);}});}_0x5b5694[_0xcc43('0x3b')]=_0x42de78;if(_0x5b5694[_0xcc43('0x3b')][_0xcc43('0x42')]>0x0){_0x448f82(_0x5b5694);}else{if(_0x10a8ef==![]){_0x448f82();}else{_0x448f82(_0x5b5694);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 1ecfd23..feeb181 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 _0xe14b=['bluebird','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','moment'];(function(_0xa59b64,_0x185b2a){var _0x296409=function(_0x4c2bc0){while(--_0x4c2bc0){_0xa59b64['push'](_0xa59b64['shift']());}};_0x296409(++_0x185b2a);}(_0xe14b,0x93));var _0xbe14=function(_0x1b058f,_0x5eeb2c){_0x1b058f=_0x1b058f-0x0;var _0x2148df=_0xe14b[_0x1b058f];return _0x2148df;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));var integrations=require(_0xbe14('0x6'));module[_0xbe14('0x7')]=function(_0x1ff100,_0x1d9ade){return _0x1ff100[_0xbe14('0x8')](_0xbe14('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x5496,0x175));var _0x6549=function(_0x277354,_0xbcfe2b){_0x277354=_0x277354-0x0;var _0x12d2b4=_0x5496[_0x277354];return _0x12d2b4;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'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 b2bbb28..139088f 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 _0x93ba=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','include','map','model','attributes','then','debug','stringify','ShowServicenowAccount','find','lodash','util'];(function(_0x218672,_0x12c654){var _0x4f12f3=function(_0x38676e){while(--_0x38676e){_0x218672['push'](_0x218672['shift']());}};_0x4f12f3(++_0x12c654);}(_0x93ba,0x8a));var _0xa93b=function(_0x530000,_0x57c11d){_0x530000=_0x530000-0x0;var _0x56a45e=_0x93ba[_0x530000];return _0x56a45e;};'use strict';var _=require(_0xa93b('0x0'));var util=require(_0xa93b('0x1'));var moment=require(_0xa93b('0x2'));var BPromise=require('bluebird');var rs=require(_0xa93b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa93b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa93b('0x5'))(_0xa93b('0x6'));var config=require(_0xa93b('0x7'));var jayson=require(_0xa93b('0x8'));var client=jayson[_0xa93b('0x9')][_0xa93b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1218be,_0x4e5ac0,_0x398ce8){return new BPromise(function(_0x2d362b,_0x1fbd6a){return client[_0xa93b('0xb')](_0x1218be,_0x398ce8)['then'](function(_0x4ef31b){logger[_0xa93b('0xc')](_0xa93b('0xd'),_0x4e5ac0,'request\x20sent');logger['debug'](_0xa93b('0xe'),_0x4e5ac0,_0xa93b('0xf'),JSON['stringify'](_0x4ef31b));if(_0x4ef31b[_0xa93b('0x10')]){if(_0x4ef31b['error']['code']===0x1f4){logger[_0xa93b('0x10')](_0xa93b('0xd'),_0x4e5ac0,_0x4ef31b[_0xa93b('0x10')][_0xa93b('0x11')]);return _0x1fbd6a(_0x4ef31b['error'][_0xa93b('0x11')]);}logger[_0xa93b('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x4e5ac0,_0x4ef31b[_0xa93b('0x10')][_0xa93b('0x11')]);return _0x2d362b(_0x4ef31b[_0xa93b('0x10')][_0xa93b('0x11')]);}else{logger[_0xa93b('0xc')](_0xa93b('0xd'),_0x4e5ac0,_0xa93b('0xf'));_0x2d362b(_0x4ef31b[_0xa93b('0x12')]['message']);}})[_0xa93b('0x13')](function(_0x4a36e0){logger[_0xa93b('0x10')](_0xa93b('0xd'),_0x4e5ac0,_0x4a36e0);_0x1fbd6a(_0x4a36e0);});});}exports[_0xa93b('0x14')]=function(_0x4dbae6){var _0x7d343d=this;return new Promise(function(_0xee877,_0x243445){return db[_0xa93b('0x15')]['findAll']({'raw':_0x4dbae6[_0xa93b('0x16')]?_0x4dbae6['options'][_0xa93b('0x17')]===undefined?!![]:![]:!![],'where':_0x4dbae6[_0xa93b('0x16')]?_0x4dbae6[_0xa93b('0x16')][_0xa93b('0x18')]||null:null,'attributes':_0x4dbae6[_0xa93b('0x16')]?_0x4dbae6[_0xa93b('0x16')]['attributes']||null:null,'limit':_0x4dbae6[_0xa93b('0x16')]?_0x4dbae6[_0xa93b('0x16')][_0xa93b('0x19')]||null:null,'include':_0x4dbae6[_0xa93b('0x16')]?_0x4dbae6[_0xa93b('0x16')][_0xa93b('0x1a')]?_[_0xa93b('0x1b')](_0x4dbae6[_0xa93b('0x16')]['include'],function(_0x1f68e8){return{'model':db[_0x1f68e8[_0xa93b('0x1c')]],'as':_0x1f68e8['as'],'attributes':_0x1f68e8[_0xa93b('0x1d')],'include':_0x1f68e8[_0xa93b('0x1a')]?_[_0xa93b('0x1b')](_0x1f68e8[_0xa93b('0x1a')],function(_0x18440c){return{'model':db[_0x18440c[_0xa93b('0x1c')]],'as':_0x18440c['as'],'attributes':_0x18440c['attributes'],'include':_0x18440c[_0xa93b('0x1a')]?_[_0xa93b('0x1b')](_0x18440c[_0xa93b('0x1a')],function(_0xcde9f5){return{'model':db[_0xcde9f5[_0xa93b('0x1c')]],'as':_0xcde9f5['as'],'attributes':_0xcde9f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xa93b('0x1e')](function(_0x5e0b71){logger[_0xa93b('0xc')](_0xa93b('0x14'),_0x4dbae6);logger[_0xa93b('0x1f')](_0xa93b('0x14'),_0x4dbae6,JSON[_0xa93b('0x20')](_0x5e0b71));_0xee877(_0x5e0b71);})[_0xa93b('0x13')](function(_0x3b14a0){logger[_0xa93b('0x10')]('GetServicenowAccount',_0x3b14a0[_0xa93b('0x11')],_0x4dbae6);_0x243445(_0x7d343d[_0xa93b('0x10')](0x1f4,_0x3b14a0['message']));});});};exports[_0xa93b('0x21')]=function(_0x5def70){var _0x5655a2=this;return new Promise(function(_0x47110b,_0x464b3b){return db[_0xa93b('0x15')][_0xa93b('0x22')]({'raw':_0x5def70[_0xa93b('0x16')]?_0x5def70[_0xa93b('0x16')][_0xa93b('0x17')]===undefined?!![]:![]:!![],'where':_0x5def70[_0xa93b('0x16')]?_0x5def70[_0xa93b('0x16')]['where']||null:null,'attributes':_0x5def70[_0xa93b('0x16')]?_0x5def70['options'][_0xa93b('0x1d')]||null:null,'include':_0x5def70['options']?_0x5def70[_0xa93b('0x16')][_0xa93b('0x1a')]?_[_0xa93b('0x1b')](_0x5def70['options'][_0xa93b('0x1a')],function(_0x1ca206){return{'model':db[_0x1ca206[_0xa93b('0x1c')]],'as':_0x1ca206['as'],'attributes':_0x1ca206['attributes'],'include':_0x1ca206[_0xa93b('0x1a')]?_[_0xa93b('0x1b')](_0x1ca206[_0xa93b('0x1a')],function(_0x1430a6){return{'model':db[_0x1430a6[_0xa93b('0x1c')]],'as':_0x1430a6['as'],'attributes':_0x1430a6['attributes'],'include':_0x1430a6[_0xa93b('0x1a')]?_[_0xa93b('0x1b')](_0x1430a6['include'],function(_0x809edd){return{'model':db[_0x809edd[_0xa93b('0x1c')]],'as':_0x809edd['as'],'attributes':_0x809edd[_0xa93b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa93b('0x1e')](function(_0x2b98ff){logger[_0xa93b('0xc')](_0xa93b('0x21'),_0x5def70);logger[_0xa93b('0x1f')](_0xa93b('0x21'),_0x5def70,JSON[_0xa93b('0x20')](_0x2b98ff));_0x47110b(_0x2b98ff);})[_0xa93b('0x13')](function(_0x578580){logger[_0xa93b('0x10')](_0xa93b('0x21'),_0x578580['message'],_0x5def70);_0x464b3b(_0x5655a2[_0xa93b('0x10')](0x1f4,_0x578580[_0xa93b('0x11')]));});});}; \ No newline at end of file +var _0x0265=['options','raw','where','limit','include','model','attributes','map','debug','stringify','find','ShowServicenowAccount','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount'];(function(_0x48c4d3,_0x589372){var _0x210893=function(_0x829e7c){while(--_0x829e7c){_0x48c4d3['push'](_0x48c4d3['shift']());}};_0x210893(++_0x589372);}(_0x0265,0x90));var _0x5026=function(_0x31c82f,_0x2d7fc1){_0x31c82f=_0x31c82f-0x0;var _0x419d13=_0x0265[_0x31c82f];return _0x419d13;};'use strict';var _=require('lodash');var util=require(_0x5026('0x0'));var moment=require('moment');var BPromise=require(_0x5026('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5026('0x2'));var db=require(_0x5026('0x3'))['db'];var utils=require(_0x5026('0x4'));var logger=require(_0x5026('0x5'))(_0x5026('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5026('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16aaa2,_0x4d7010,_0x2c4b44){return new BPromise(function(_0x30b079,_0x353aaf){return client[_0x5026('0x8')](_0x16aaa2,_0x2c4b44)[_0x5026('0x9')](function(_0x48515f){logger[_0x5026('0xa')](_0x5026('0xb'),_0x4d7010,_0x5026('0xc'));logger['debug'](_0x5026('0xd'),_0x4d7010,_0x5026('0xc'),JSON['stringify'](_0x48515f));if(_0x48515f[_0x5026('0xe')]){if(_0x48515f[_0x5026('0xe')][_0x5026('0xf')]===0x1f4){logger[_0x5026('0xe')](_0x5026('0xb'),_0x4d7010,_0x48515f[_0x5026('0xe')][_0x5026('0x10')]);return _0x353aaf(_0x48515f[_0x5026('0xe')][_0x5026('0x10')]);}logger['error'](_0x5026('0xb'),_0x4d7010,_0x48515f['error'][_0x5026('0x10')]);return _0x30b079(_0x48515f[_0x5026('0xe')][_0x5026('0x10')]);}else{logger[_0x5026('0xa')](_0x5026('0xb'),_0x4d7010,_0x5026('0xc'));_0x30b079(_0x48515f[_0x5026('0x11')][_0x5026('0x10')]);}})[_0x5026('0x12')](function(_0x50a0f7){logger[_0x5026('0xe')](_0x5026('0xb'),_0x4d7010,_0x50a0f7);_0x353aaf(_0x50a0f7);});});}exports[_0x5026('0x13')]=function(_0x4f59eb){var _0x48cf80=this;return new Promise(function(_0x572a97,_0x2ecefd){return db[_0x5026('0x14')]['findAll']({'raw':_0x4f59eb['options']?_0x4f59eb[_0x5026('0x15')][_0x5026('0x16')]===undefined?!![]:![]:!![],'where':_0x4f59eb[_0x5026('0x15')]?_0x4f59eb[_0x5026('0x15')][_0x5026('0x17')]||null:null,'attributes':_0x4f59eb[_0x5026('0x15')]?_0x4f59eb[_0x5026('0x15')]['attributes']||null:null,'limit':_0x4f59eb[_0x5026('0x15')]?_0x4f59eb[_0x5026('0x15')][_0x5026('0x18')]||null:null,'include':_0x4f59eb[_0x5026('0x15')]?_0x4f59eb[_0x5026('0x15')][_0x5026('0x19')]?_['map'](_0x4f59eb[_0x5026('0x15')][_0x5026('0x19')],function(_0x40d836){return{'model':db[_0x40d836[_0x5026('0x1a')]],'as':_0x40d836['as'],'attributes':_0x40d836[_0x5026('0x1b')],'include':_0x40d836[_0x5026('0x19')]?_[_0x5026('0x1c')](_0x40d836['include'],function(_0x1652d2){return{'model':db[_0x1652d2[_0x5026('0x1a')]],'as':_0x1652d2['as'],'attributes':_0x1652d2[_0x5026('0x1b')],'include':_0x1652d2[_0x5026('0x19')]?_[_0x5026('0x1c')](_0x1652d2[_0x5026('0x19')],function(_0x23e498){return{'model':db[_0x23e498[_0x5026('0x1a')]],'as':_0x23e498['as'],'attributes':_0x23e498[_0x5026('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5026('0x9')](function(_0x5c569b){logger[_0x5026('0xa')](_0x5026('0x13'),_0x4f59eb);logger[_0x5026('0x1d')]('GetServicenowAccount',_0x4f59eb,JSON[_0x5026('0x1e')](_0x5c569b));_0x572a97(_0x5c569b);})[_0x5026('0x12')](function(_0x214bb5){logger[_0x5026('0xe')](_0x5026('0x13'),_0x214bb5['message'],_0x4f59eb);_0x2ecefd(_0x48cf80[_0x5026('0xe')](0x1f4,_0x214bb5[_0x5026('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x12690b){var _0x3018d4=this;return new Promise(function(_0x3d7a69,_0x486cf7){return db[_0x5026('0x14')][_0x5026('0x1f')]({'raw':_0x12690b['options']?_0x12690b['options'][_0x5026('0x16')]===undefined?!![]:![]:!![],'where':_0x12690b[_0x5026('0x15')]?_0x12690b['options'][_0x5026('0x17')]||null:null,'attributes':_0x12690b['options']?_0x12690b[_0x5026('0x15')][_0x5026('0x1b')]||null:null,'include':_0x12690b['options']?_0x12690b[_0x5026('0x15')]['include']?_[_0x5026('0x1c')](_0x12690b[_0x5026('0x15')]['include'],function(_0x486638){return{'model':db[_0x486638['model']],'as':_0x486638['as'],'attributes':_0x486638[_0x5026('0x1b')],'include':_0x486638['include']?_[_0x5026('0x1c')](_0x486638[_0x5026('0x19')],function(_0x3d86f4){return{'model':db[_0x3d86f4['model']],'as':_0x3d86f4['as'],'attributes':_0x3d86f4[_0x5026('0x1b')],'include':_0x3d86f4[_0x5026('0x19')]?_[_0x5026('0x1c')](_0x3d86f4[_0x5026('0x19')],function(_0x2dda82){return{'model':db[_0x2dda82[_0x5026('0x1a')]],'as':_0x2dda82['as'],'attributes':_0x2dda82[_0x5026('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5026('0x9')](function(_0x4b937d){logger[_0x5026('0xa')]('ShowServicenowAccount',_0x12690b);logger[_0x5026('0x1d')](_0x5026('0x20'),_0x12690b,JSON['stringify'](_0x4b937d));_0x3d7a69(_0x4b937d);})['catch'](function(_0x1ac7a4){logger[_0x5026('0xe')]('ShowServicenowAccount',_0x1ac7a4[_0x5026('0x10')],_0x12690b);_0x486cf7(_0x3018d4['error'](0x1f4,_0x1ac7a4[_0x5026('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 9e978ce..9d0a568 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 _0xd3c8=['getDescriptions','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0xd3c8,0x19d));var _0x8d3c=function(_0x125bb5,_0xc9e346){_0x125bb5=_0x125bb5-0x0;var _0x531de6=_0xd3c8[_0x125bb5];return _0x531de6;};'use strict';var multer=require(_0x8d3c('0x0'));var util=require(_0x8d3c('0x1'));var path=require(_0x8d3c('0x2'));var timeout=require(_0x8d3c('0x3'));var express=require(_0x8d3c('0x4'));var router=express['Router']();var fs_extra=require(_0x8d3c('0x5'));var auth=require(_0x8d3c('0x6'));var interaction=require(_0x8d3c('0x7'));var config=require(_0x8d3c('0x8'));var controller=require(_0x8d3c('0x9'));router[_0x8d3c('0xa')]('/',auth[_0x8d3c('0xb')](),controller[_0x8d3c('0xc')]);router['get']('/:id',auth[_0x8d3c('0xb')](),controller[_0x8d3c('0xd')]);router[_0x8d3c('0xa')](_0x8d3c('0xe'),auth[_0x8d3c('0xb')](),controller[_0x8d3c('0xf')]);router[_0x8d3c('0xa')](_0x8d3c('0x10'),auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x11')]);router[_0x8d3c('0xa')](_0x8d3c('0x12'),auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x13')]);router[_0x8d3c('0x14')]('/',auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x15')]);router[_0x8d3c('0x16')]('/:id',auth[_0x8d3c('0xb')](),controller['update']);router[_0x8d3c('0x17')](_0x8d3c('0x18'),auth[_0x8d3c('0xb')](),controller[_0x8d3c('0x19')]);module[_0x8d3c('0x1a')]=router; \ No newline at end of file +var _0xefe9=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xefe9,0x1d2));var _0x9efe=function(_0x4b9b90,_0x954d2f){_0x4b9b90=_0x4b9b90-0x0;var _0x46ea74=_0xefe9[_0x4b9b90];return _0x46ea74;};'use strict';var multer=require(_0x9efe('0x0'));var util=require(_0x9efe('0x1'));var path=require(_0x9efe('0x2'));var timeout=require(_0x9efe('0x3'));var express=require(_0x9efe('0x4'));var router=express['Router']();var fs_extra=require(_0x9efe('0x5'));var auth=require(_0x9efe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9efe('0x7'));var controller=require(_0x9efe('0x8'));router[_0x9efe('0x9')]('/',auth[_0x9efe('0xa')](),controller[_0x9efe('0xb')]);router[_0x9efe('0x9')](_0x9efe('0xc'),auth[_0x9efe('0xa')](),controller[_0x9efe('0xd')]);router[_0x9efe('0x9')](_0x9efe('0xe'),auth['isAuthenticated'](),controller[_0x9efe('0xf')]);router[_0x9efe('0x9')](_0x9efe('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x9efe('0x9')](_0x9efe('0x11'),auth[_0x9efe('0xa')](),controller[_0x9efe('0x12')]);router['post']('/',auth[_0x9efe('0xa')](),controller[_0x9efe('0x13')]);router[_0x9efe('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9efe('0x15')](_0x9efe('0xc'),auth[_0x9efe('0xa')](),controller[_0x9efe('0x16')]);module[_0x9efe('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index a953c8f..0b2c01f 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 _0xfae4=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfae4,0x103));var _0x4fae=function(_0x1ba117,_0x5e8726){_0x1ba117=_0x1ba117-0x0;var _0xb37d34=_0xfae4[_0x1ba117];return _0xb37d34;};'use strict';var Sequelize=require(_0x4fae('0x0'));module[_0x4fae('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4fae('0x2')]}}; \ No newline at end of file +var _0xa63c=['STRING','sequelize','exports'];(function(_0x49f7d5,_0x21ea58){var _0x4256ec=function(_0x46d121){while(--_0x46d121){_0x49f7d5['push'](_0x49f7d5['shift']());}};_0x4256ec(++_0x21ea58);}(_0xa63c,0x1ab));var _0xca63=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa63c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xca63('0x0'));module[_0xca63('0x1')]={'name':{'type':Sequelize[_0xca63('0x2')]},'description':{'type':Sequelize[_0xca63('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 7976a87..ec56bfc 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 _0x4c39=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','destroy','error','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x17e8d7,_0x2e4eb9){var _0x16fcb7=function(_0x43c946){while(--_0x43c946){_0x17e8d7['push'](_0x17e8d7['shift']());}};_0x16fcb7(++_0x2e4eb9);}(_0x4c39,0x8e));var _0x94c3=function(_0xf1402a,_0x187f5c){_0xf1402a=_0xf1402a-0x0;var _0x4f7ead=_0x4c39[_0xf1402a];return _0x4f7ead;};'use strict';var emlformat=require(_0x94c3('0x0'));var rimraf=require(_0x94c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x94c3('0x2'));var moment=require(_0x94c3('0x3'));var BPromise=require(_0x94c3('0x4'));var Mustache=require(_0x94c3('0x5'));var util=require(_0x94c3('0x6'));var path=require(_0x94c3('0x7'));var sox=require('sox');var csv=require(_0x94c3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94c3('0x9'));var squel=require(_0x94c3('0xa'));var crypto=require(_0x94c3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x94c3('0xc'));var toCsv=require(_0x94c3('0x8'));var querystring=require(_0x94c3('0xd'));var Papa=require(_0x94c3('0xe'));var Redis=require(_0x94c3('0xf'));var authService=require(_0x94c3('0x10'));var qs=require(_0x94c3('0x11'));var as=require(_0x94c3('0x12'));var hardwareService=require(_0x94c3('0x13'));var logger=require('../../config/logger')(_0x94c3('0x14'));var utils=require('../../config/utils');var config=require(_0x94c3('0x15'));var licenseUtil=require(_0x94c3('0x16'));var db=require(_0x94c3('0x17'))['db'];function respondWithStatusCode(_0x293d7c,_0x1562bf){_0x1562bf=_0x1562bf||0xcc;return function(_0x361d67){if(_0x361d67){return _0x293d7c[_0x94c3('0x18')](_0x1562bf);}return _0x293d7c[_0x94c3('0x19')](_0x1562bf)[_0x94c3('0x1a')]();};}function respondWithResult(_0x355442,_0x4bd9be){_0x4bd9be=_0x4bd9be||0xc8;return function(_0x27d98b){if(_0x27d98b){return _0x355442['status'](_0x4bd9be)['json'](_0x27d98b);}};}function respondWithFilteredResult(_0x3e0c6f,_0x29c416){return function(_0x1793d3){if(_0x1793d3){var _0x40b031=typeof _0x29c416['offset']===_0x94c3('0x1b')&&typeof _0x29c416[_0x94c3('0x1c')]==='undefined';var _0x320970=_0x1793d3[_0x94c3('0x1d')];var _0xd95046=_0x40b031?0x0:_0x29c416[_0x94c3('0x1e')];var _0x1bee9a=_0x40b031?_0x1793d3['count']:_0x29c416[_0x94c3('0x1e')]+_0x29c416['limit'];var _0x372242;if(_0x1bee9a>=_0x320970){_0x1bee9a=_0x320970;_0x372242=0xc8;}else{_0x372242=0xce;}_0x3e0c6f[_0x94c3('0x19')](_0x372242);return _0x3e0c6f['set'](_0x94c3('0x1f'),_0xd95046+'-'+_0x1bee9a+'/'+_0x320970)[_0x94c3('0x20')](_0x1793d3);}return null;};}function patchUpdates(_0x2850b6){return function(_0x2af804){try{jsonpatch[_0x94c3('0x21')](_0x2af804,_0x2850b6,!![]);}catch(_0x24df2e){return BPromise['reject'](_0x24df2e);}return _0x2af804[_0x94c3('0x22')]();};}function saveUpdates(_0x2b507d,_0xb5edbd){return function(_0x32ab3e){if(_0x32ab3e){return _0x32ab3e[_0x94c3('0x23')](_0x2b507d)[_0x94c3('0x24')](function(_0x5cfe72){return _0x5cfe72;});}return null;};}function removeEntity(_0x27a87c,_0x16d0f3){return function(_0x1410e5){if(_0x1410e5){return _0x1410e5[_0x94c3('0x25')]()[_0x94c3('0x24')](function(){_0x27a87c[_0x94c3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x295db3,_0x1cb0e1){return function(_0x2e357e){if(!_0x2e357e){_0x295db3[_0x94c3('0x18')](0x194);}return _0x2e357e;};}function handleError(_0x1a0218,_0x1e1ac9){_0x1e1ac9=_0x1e1ac9||0x1f4;return function(_0x16eda7){logger[_0x94c3('0x26')](_0x16eda7['stack']);if(_0x16eda7[_0x94c3('0x27')]){delete _0x16eda7[_0x94c3('0x27')];}_0x1a0218[_0x94c3('0x19')](_0x1e1ac9)['send'](_0x16eda7);};}exports[_0x94c3('0x28')]=function(_0x358400,_0x5e35c4){var _0x103b7d={},_0x54ecb4={},_0x292aa7={'count':0x0,'rows':[]};var _0x2c5679=_[_0x94c3('0x29')](db[_0x94c3('0x2a')][_0x94c3('0x2b')],function(_0x1e7434){return{'name':_0x1e7434[_0x94c3('0x2c')],'type':_0x1e7434[_0x94c3('0x2d')][_0x94c3('0x2e')]};});_0x54ecb4[_0x94c3('0x2f')]=_['map'](_0x2c5679,_0x94c3('0x27'));_0x54ecb4[_0x94c3('0x30')]=_[_0x94c3('0x31')](_0x358400[_0x94c3('0x30')]);_0x54ecb4[_0x94c3('0x32')]=_[_0x94c3('0x33')](_0x54ecb4[_0x94c3('0x2f')],_0x54ecb4[_0x94c3('0x30')]);_0x103b7d[_0x94c3('0x34')]=_[_0x94c3('0x33')](_0x54ecb4[_0x94c3('0x2f')],qs[_0x94c3('0x35')](_0x358400['query'][_0x94c3('0x35')]));_0x103b7d['attributes']=_0x103b7d[_0x94c3('0x34')][_0x94c3('0x36')]?_0x103b7d['attributes']:_0x54ecb4[_0x94c3('0x2f')];if(!_0x358400['query'][_0x94c3('0x37')](_0x94c3('0x38'))){_0x103b7d[_0x94c3('0x1c')]=qs[_0x94c3('0x1c')](_0x358400['query'][_0x94c3('0x1c')]);_0x103b7d[_0x94c3('0x1e')]=qs[_0x94c3('0x1e')](_0x358400[_0x94c3('0x30')][_0x94c3('0x1e')]);}_0x103b7d[_0x94c3('0x39')]=qs[_0x94c3('0x3a')](_0x358400[_0x94c3('0x30')][_0x94c3('0x3a')]);_0x103b7d['where']=qs[_0x94c3('0x32')](_[_0x94c3('0x3b')](_0x358400[_0x94c3('0x30')],_0x54ecb4[_0x94c3('0x32')]),_0x2c5679);if(_0x358400[_0x94c3('0x30')][_0x94c3('0x3c')]){_0x103b7d['where']=_[_0x94c3('0x3d')](_0x103b7d[_0x94c3('0x3e')],{'$or':_[_0x94c3('0x29')](_0x2c5679,function(_0x39488f){if(_0x39488f[_0x94c3('0x2d')]!==_0x94c3('0x3f')){var _0x29ef64={};_0x29ef64[_0x39488f[_0x94c3('0x27')]]={'$like':'%'+_0x358400[_0x94c3('0x30')][_0x94c3('0x3c')]+'%'};return _0x29ef64;}})});}_0x103b7d=_[_0x94c3('0x3d')]({},_0x103b7d,_0x358400[_0x94c3('0x40')]);var _0x125f13={'where':_0x103b7d['where']};return db[_0x94c3('0x2a')][_0x94c3('0x1d')](_0x125f13)[_0x94c3('0x24')](function(_0x2fde77){_0x292aa7['count']=_0x2fde77;if(_0x358400[_0x94c3('0x30')][_0x94c3('0x41')]){_0x103b7d[_0x94c3('0x42')]=[{'all':!![]}];}return db[_0x94c3('0x2a')][_0x94c3('0x43')](_0x103b7d);})[_0x94c3('0x24')](function(_0xb1d2e0){_0x292aa7[_0x94c3('0x44')]=_0xb1d2e0;return _0x292aa7;})[_0x94c3('0x24')](respondWithFilteredResult(_0x5e35c4,_0x103b7d))[_0x94c3('0x45')](handleError(_0x5e35c4,null));};exports[_0x94c3('0x46')]=function(_0xb6989f,_0x4225bd){var _0x14096c={'raw':![],'where':{'id':_0xb6989f[_0x94c3('0x47')]['id']}},_0x5530b7={};_0x5530b7['model']=_[_0x94c3('0x31')](db[_0x94c3('0x2a')][_0x94c3('0x2b')]);_0x5530b7[_0x94c3('0x30')]=_[_0x94c3('0x31')](_0xb6989f[_0x94c3('0x30')]);_0x5530b7['filters']=_[_0x94c3('0x33')](_0x5530b7[_0x94c3('0x2f')],_0x5530b7['query']);_0x14096c['attributes']=_[_0x94c3('0x33')](_0x5530b7[_0x94c3('0x2f')],qs[_0x94c3('0x35')](_0xb6989f[_0x94c3('0x30')][_0x94c3('0x35')]));_0x14096c['attributes']=_0x14096c[_0x94c3('0x34')][_0x94c3('0x36')]?_0x14096c[_0x94c3('0x34')]:_0x5530b7[_0x94c3('0x2f')];if(_0xb6989f['query'][_0x94c3('0x41')]){_0x14096c[_0x94c3('0x42')]=[{'all':!![]}];}_0x14096c=_[_0x94c3('0x3d')]({},_0x14096c,_0xb6989f[_0x94c3('0x40')]);return db['ServicenowConfiguration'][_0x94c3('0x48')](_0x14096c)[_0x94c3('0x24')](handleEntityNotFound(_0x4225bd,null))['then'](respondWithResult(_0x4225bd,null))[_0x94c3('0x45')](handleError(_0x4225bd,null));};exports['create']=function(_0x5d598f,_0x17b6e8){return db[_0x94c3('0x2a')]['create'](_0x5d598f[_0x94c3('0x49')],{})[_0x94c3('0x24')](respondWithResult(_0x17b6e8,0xc9))[_0x94c3('0x45')](handleError(_0x17b6e8,null));};exports[_0x94c3('0x23')]=function(_0x335671,_0x5b4056){if(_0x335671[_0x94c3('0x49')]['id']){delete _0x335671[_0x94c3('0x49')]['id'];}return db[_0x94c3('0x2a')][_0x94c3('0x48')]({'where':{'id':_0x335671['params']['id']}})[_0x94c3('0x24')](handleEntityNotFound(_0x5b4056,null))[_0x94c3('0x24')](saveUpdates(_0x335671['body'],null))[_0x94c3('0x24')](respondWithResult(_0x5b4056,null))[_0x94c3('0x45')](handleError(_0x5b4056,null));};exports[_0x94c3('0x25')]=function(_0xa03da8,_0x1323c6){return db[_0x94c3('0x2a')][_0x94c3('0x48')]({'where':{'id':_0xa03da8[_0x94c3('0x47')]['id']}})[_0x94c3('0x24')](handleEntityNotFound(_0x1323c6,null))[_0x94c3('0x24')](removeEntity(_0x1323c6,null))['catch'](handleError(_0x1323c6,null));};exports['getFields']=function(_0x4694be,_0x559971,_0x5f4edd){var _0x3d0666={};var _0x20c876={};var _0x2c1fdc;var _0x3b22d3;return db[_0x94c3('0x2a')][_0x94c3('0x4a')]({'where':{'id':_0x4694be[_0x94c3('0x47')]['id']}})[_0x94c3('0x24')](handleEntityNotFound(_0x559971,null))[_0x94c3('0x24')](function(_0x551ef4){if(_0x551ef4){_0x2c1fdc=_0x551ef4;_0x20c876[_0x94c3('0x2f')]=_[_0x94c3('0x31')](db[_0x94c3('0x4b')][_0x94c3('0x2b')]);_0x20c876[_0x94c3('0x30')]=_[_0x94c3('0x31')](_0x4694be['query']);_0x20c876['filters']=_[_0x94c3('0x33')](_0x20c876['model'],_0x20c876[_0x94c3('0x30')]);_0x3d0666[_0x94c3('0x34')]=_[_0x94c3('0x33')](_0x20c876[_0x94c3('0x2f')],qs[_0x94c3('0x35')](_0x4694be[_0x94c3('0x30')][_0x94c3('0x35')]));_0x3d0666['attributes']=_0x3d0666[_0x94c3('0x34')][_0x94c3('0x36')]?_0x3d0666['attributes']:_0x20c876[_0x94c3('0x2f')];_0x3d0666[_0x94c3('0x39')]=qs['sort'](_0x4694be[_0x94c3('0x30')][_0x94c3('0x3a')]);_0x3d0666[_0x94c3('0x3e')]=qs[_0x94c3('0x32')](_[_0x94c3('0x3b')](_0x4694be[_0x94c3('0x30')],_0x20c876[_0x94c3('0x32')]));if(_0x4694be[_0x94c3('0x30')][_0x94c3('0x3c')]){_0x3d0666[_0x94c3('0x3e')]=_[_0x94c3('0x3d')](_0x3d0666['where'],{'$or':_[_0x94c3('0x29')](_0x3d0666['attributes'],function(_0x37b299){var _0x3f637a={};_0x3f637a[_0x37b299]={'$like':'%'+_0x4694be[_0x94c3('0x30')][_0x94c3('0x3c')]+'%'};return _0x3f637a;})});}_0x3d0666=_[_0x94c3('0x3d')]({},_0x3d0666,_0x4694be[_0x94c3('0x40')]);return _0x2c1fdc[_0x94c3('0x4c')](_0x3d0666);}})['then'](function(_0x47e1cd){if(_0x47e1cd){_0x3b22d3=_0x47e1cd[_0x94c3('0x36')];if(!_0x4694be[_0x94c3('0x30')][_0x94c3('0x37')](_0x94c3('0x38'))){_0x3d0666[_0x94c3('0x1c')]=qs[_0x94c3('0x1c')](_0x4694be[_0x94c3('0x30')]['limit']);_0x3d0666[_0x94c3('0x1e')]=qs[_0x94c3('0x1e')](_0x4694be[_0x94c3('0x30')][_0x94c3('0x1e')]);}return _0x2c1fdc[_0x94c3('0x4c')](_0x3d0666);}})[_0x94c3('0x24')](function(_0x739dc){if(_0x739dc){return _0x739dc?{'count':_0x3b22d3,'rows':_0x739dc}:null;}})[_0x94c3('0x24')](respondWithResult(_0x559971,null))['catch'](handleError(_0x559971,null));};exports['getSubjects']=function(_0x4ccf27,_0x43fb30,_0x3c1e06){var _0x259c93={};var _0x1f7a8f={};var _0x16d06b;var _0x3a5c8d;return db[_0x94c3('0x2a')]['findOne']({'where':{'id':_0x4ccf27['params']['id']}})['then'](handleEntityNotFound(_0x43fb30,null))['then'](function(_0x5b5e7d){if(_0x5b5e7d){_0x16d06b=_0x5b5e7d;_0x1f7a8f[_0x94c3('0x2f')]=_[_0x94c3('0x31')](db['ServicenowField'][_0x94c3('0x2b')]);_0x1f7a8f[_0x94c3('0x30')]=_[_0x94c3('0x31')](_0x4ccf27['query']);_0x1f7a8f[_0x94c3('0x32')]=_[_0x94c3('0x33')](_0x1f7a8f['model'],_0x1f7a8f[_0x94c3('0x30')]);_0x259c93[_0x94c3('0x34')]=_[_0x94c3('0x33')](_0x1f7a8f[_0x94c3('0x2f')],qs[_0x94c3('0x35')](_0x4ccf27['query'][_0x94c3('0x35')]));_0x259c93['attributes']=_0x259c93[_0x94c3('0x34')][_0x94c3('0x36')]?_0x259c93[_0x94c3('0x34')]:_0x1f7a8f['model'];_0x259c93[_0x94c3('0x39')]=qs[_0x94c3('0x3a')](_0x4ccf27[_0x94c3('0x30')][_0x94c3('0x3a')]);_0x259c93[_0x94c3('0x3e')]=qs[_0x94c3('0x32')](_[_0x94c3('0x3b')](_0x4ccf27[_0x94c3('0x30')],_0x1f7a8f[_0x94c3('0x32')]));if(_0x4ccf27[_0x94c3('0x30')][_0x94c3('0x3c')]){_0x259c93[_0x94c3('0x3e')]=_[_0x94c3('0x3d')](_0x259c93[_0x94c3('0x3e')],{'$or':_['map'](_0x259c93[_0x94c3('0x34')],function(_0xe969a4){var _0x26c1e9={};_0x26c1e9[_0xe969a4]={'$like':'%'+_0x4ccf27['query'][_0x94c3('0x3c')]+'%'};return _0x26c1e9;})});}_0x259c93=_[_0x94c3('0x3d')]({},_0x259c93,_0x4ccf27['options']);return _0x16d06b[_0x94c3('0x4d')](_0x259c93);}})[_0x94c3('0x24')](function(_0x458d21){if(_0x458d21){_0x3a5c8d=_0x458d21['length'];if(!_0x4ccf27[_0x94c3('0x30')][_0x94c3('0x37')](_0x94c3('0x38'))){_0x259c93[_0x94c3('0x1c')]=qs['limit'](_0x4ccf27['query'][_0x94c3('0x1c')]);_0x259c93['offset']=qs[_0x94c3('0x1e')](_0x4ccf27[_0x94c3('0x30')][_0x94c3('0x1e')]);}return _0x16d06b['getSubjects'](_0x259c93);}})[_0x94c3('0x24')](function(_0xf5b1c3){if(_0xf5b1c3){return _0xf5b1c3?{'count':_0x3a5c8d,'rows':_0xf5b1c3}:null;}})[_0x94c3('0x24')](respondWithResult(_0x43fb30,null))['catch'](handleError(_0x43fb30,null));};exports[_0x94c3('0x4e')]=function(_0x20b8ee,_0x522339,_0x10d1c9){var _0x1e0480={};var _0x4daf86={};var _0x1e223f;var _0x24666f;return db[_0x94c3('0x2a')][_0x94c3('0x4a')]({'where':{'id':_0x20b8ee['params']['id']}})[_0x94c3('0x24')](handleEntityNotFound(_0x522339,null))['then'](function(_0x25f49b){if(_0x25f49b){_0x1e223f=_0x25f49b;_0x4daf86['model']=_[_0x94c3('0x31')](db['ServicenowField'][_0x94c3('0x2b')]);_0x4daf86[_0x94c3('0x30')]=_[_0x94c3('0x31')](_0x20b8ee[_0x94c3('0x30')]);_0x4daf86[_0x94c3('0x32')]=_[_0x94c3('0x33')](_0x4daf86[_0x94c3('0x2f')],_0x4daf86[_0x94c3('0x30')]);_0x1e0480[_0x94c3('0x34')]=_[_0x94c3('0x33')](_0x4daf86['model'],qs[_0x94c3('0x35')](_0x20b8ee[_0x94c3('0x30')][_0x94c3('0x35')]));_0x1e0480[_0x94c3('0x34')]=_0x1e0480[_0x94c3('0x34')][_0x94c3('0x36')]?_0x1e0480[_0x94c3('0x34')]:_0x4daf86[_0x94c3('0x2f')];_0x1e0480[_0x94c3('0x39')]=qs[_0x94c3('0x3a')](_0x20b8ee[_0x94c3('0x30')][_0x94c3('0x3a')]);_0x1e0480[_0x94c3('0x3e')]=qs[_0x94c3('0x32')](_[_0x94c3('0x3b')](_0x20b8ee[_0x94c3('0x30')],_0x4daf86[_0x94c3('0x32')]));if(_0x20b8ee['query'][_0x94c3('0x3c')]){_0x1e0480[_0x94c3('0x3e')]=_[_0x94c3('0x3d')](_0x1e0480[_0x94c3('0x3e')],{'$or':_[_0x94c3('0x29')](_0x1e0480[_0x94c3('0x34')],function(_0x4bdb71){var _0xb3ef73={};_0xb3ef73[_0x4bdb71]={'$like':'%'+_0x20b8ee[_0x94c3('0x30')][_0x94c3('0x3c')]+'%'};return _0xb3ef73;})});}_0x1e0480=_[_0x94c3('0x3d')]({},_0x1e0480,_0x20b8ee['options']);return _0x1e223f[_0x94c3('0x4e')](_0x1e0480);}})[_0x94c3('0x24')](function(_0x583b7b){if(_0x583b7b){_0x24666f=_0x583b7b[_0x94c3('0x36')];if(!_0x20b8ee[_0x94c3('0x30')]['hasOwnProperty'](_0x94c3('0x38'))){_0x1e0480[_0x94c3('0x1c')]=qs[_0x94c3('0x1c')](_0x20b8ee[_0x94c3('0x30')][_0x94c3('0x1c')]);_0x1e0480[_0x94c3('0x1e')]=qs[_0x94c3('0x1e')](_0x20b8ee['query'][_0x94c3('0x1e')]);}return _0x1e223f['getDescriptions'](_0x1e0480);}})[_0x94c3('0x24')](function(_0x296c08){if(_0x296c08){return _0x296c08?{'count':_0x24666f,'rows':_0x296c08}:null;}})[_0x94c3('0x24')](respondWithResult(_0x522339,null))[_0x94c3('0x45')](handleError(_0x522339,null));}; \ No newline at end of file +var _0xd6c2=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowConfiguration','rawAttributes','model','query','keys','filters','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','params','intersection','include','options','find','catch','create','body','getFields','findOne','order','hasOwnProperty','getSubjects','getDescriptions','ServicenowField','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x2b7389,_0x58311b){var _0xe5d9da=function(_0xecec75){while(--_0xecec75){_0x2b7389['push'](_0x2b7389['shift']());}};_0xe5d9da(++_0x58311b);}(_0xd6c2,0x172));var _0x2d6c=function(_0x203f03,_0x4fe4a5){_0x203f03=_0x203f03-0x0;var _0x2ec2a5=_0xd6c2[_0x203f03];return _0x2ec2a5;};'use strict';var emlformat=require(_0x2d6c('0x0'));var rimraf=require(_0x2d6c('0x1'));var zipdir=require(_0x2d6c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d6c('0x3'));var moment=require(_0x2d6c('0x4'));var BPromise=require(_0x2d6c('0x5'));var Mustache=require('mustache');var util=require(_0x2d6c('0x6'));var path=require(_0x2d6c('0x7'));var sox=require(_0x2d6c('0x8'));var csv=require(_0x2d6c('0x9'));var ejs=require(_0x2d6c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d6c('0xb'));var squel=require('squel');var crypto=require(_0x2d6c('0xc'));var jsforce=require(_0x2d6c('0xd'));var deskjs=require(_0x2d6c('0xe'));var toCsv=require(_0x2d6c('0x9'));var querystring=require(_0x2d6c('0xf'));var Papa=require('papaparse');var Redis=require(_0x2d6c('0x10'));var authService=require(_0x2d6c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2d6c('0x12'));var hardwareService=require(_0x2d6c('0x13'));var logger=require(_0x2d6c('0x14'))(_0x2d6c('0x15'));var utils=require(_0x2d6c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d6c('0x17'))['db'];function respondWithStatusCode(_0x47a290,_0x19dd81){_0x19dd81=_0x19dd81||0xcc;return function(_0x5dd63c){if(_0x5dd63c){return _0x47a290[_0x2d6c('0x18')](_0x19dd81);}return _0x47a290[_0x2d6c('0x19')](_0x19dd81)['end']();};}function respondWithResult(_0x31b5a6,_0x3264f5){_0x3264f5=_0x3264f5||0xc8;return function(_0x5e80db){if(_0x5e80db){return _0x31b5a6[_0x2d6c('0x19')](_0x3264f5)['json'](_0x5e80db);}};}function respondWithFilteredResult(_0x1cc8bb,_0x1839b3){return function(_0x12446f){if(_0x12446f){var _0x20b4a5=typeof _0x1839b3[_0x2d6c('0x1a')]===_0x2d6c('0x1b')&&typeof _0x1839b3[_0x2d6c('0x1c')]===_0x2d6c('0x1b');var _0x3aba5b=_0x12446f[_0x2d6c('0x1d')];var _0x1ad69f=_0x20b4a5?0x0:_0x1839b3[_0x2d6c('0x1a')];var _0x5d7e63=_0x20b4a5?_0x12446f[_0x2d6c('0x1d')]:_0x1839b3[_0x2d6c('0x1a')]+_0x1839b3[_0x2d6c('0x1c')];var _0x52a6ad;if(_0x5d7e63>=_0x3aba5b){_0x5d7e63=_0x3aba5b;_0x52a6ad=0xc8;}else{_0x52a6ad=0xce;}_0x1cc8bb[_0x2d6c('0x19')](_0x52a6ad);return _0x1cc8bb[_0x2d6c('0x1e')](_0x2d6c('0x1f'),_0x1ad69f+'-'+_0x5d7e63+'/'+_0x3aba5b)[_0x2d6c('0x20')](_0x12446f);}return null;};}function patchUpdates(_0x196599){return function(_0x485d7f){try{jsonpatch['apply'](_0x485d7f,_0x196599,!![]);}catch(_0x37deda){return BPromise[_0x2d6c('0x21')](_0x37deda);}return _0x485d7f[_0x2d6c('0x22')]();};}function saveUpdates(_0x4aeb23,_0x23cc97){return function(_0x4eb2a0){if(_0x4eb2a0){return _0x4eb2a0[_0x2d6c('0x23')](_0x4aeb23)[_0x2d6c('0x24')](function(_0x43427a){return _0x43427a;});}return null;};}function removeEntity(_0x288b19,_0x2890fc){return function(_0x583102){if(_0x583102){return _0x583102[_0x2d6c('0x25')]()[_0x2d6c('0x24')](function(){_0x288b19[_0x2d6c('0x19')](0xcc)[_0x2d6c('0x26')]();});}};}function handleEntityNotFound(_0x3274ab,_0x161250){return function(_0x1a7879){if(!_0x1a7879){_0x3274ab['sendStatus'](0x194);}return _0x1a7879;};}function handleError(_0x431135,_0x46e144){_0x46e144=_0x46e144||0x1f4;return function(_0x22ad2e){logger[_0x2d6c('0x27')](_0x22ad2e['stack']);if(_0x22ad2e[_0x2d6c('0x28')]){delete _0x22ad2e[_0x2d6c('0x28')];}_0x431135[_0x2d6c('0x19')](_0x46e144)[_0x2d6c('0x29')](_0x22ad2e);};}exports[_0x2d6c('0x2a')]=function(_0x2b42c1,_0x298050){var _0x171be3={},_0x2e33dc={},_0x2b584a={'count':0x0,'rows':[]};var _0x334c48=_[_0x2d6c('0x2b')](db[_0x2d6c('0x2c')][_0x2d6c('0x2d')],function(_0x5283a8){return{'name':_0x5283a8['fieldName'],'type':_0x5283a8['type']['key']};});_0x2e33dc[_0x2d6c('0x2e')]=_[_0x2d6c('0x2b')](_0x334c48,_0x2d6c('0x28'));_0x2e33dc[_0x2d6c('0x2f')]=_[_0x2d6c('0x30')](_0x2b42c1[_0x2d6c('0x2f')]);_0x2e33dc[_0x2d6c('0x31')]=_['intersection'](_0x2e33dc[_0x2d6c('0x2e')],_0x2e33dc[_0x2d6c('0x2f')]);_0x171be3['attributes']=_['intersection'](_0x2e33dc[_0x2d6c('0x2e')],qs[_0x2d6c('0x32')](_0x2b42c1[_0x2d6c('0x2f')][_0x2d6c('0x32')]));_0x171be3[_0x2d6c('0x33')]=_0x171be3[_0x2d6c('0x33')][_0x2d6c('0x34')]?_0x171be3[_0x2d6c('0x33')]:_0x2e33dc[_0x2d6c('0x2e')];if(!_0x2b42c1[_0x2d6c('0x2f')]['hasOwnProperty'](_0x2d6c('0x35'))){_0x171be3[_0x2d6c('0x1c')]=qs['limit'](_0x2b42c1[_0x2d6c('0x2f')]['limit']);_0x171be3[_0x2d6c('0x1a')]=qs[_0x2d6c('0x1a')](_0x2b42c1['query']['offset']);}_0x171be3['order']=qs[_0x2d6c('0x36')](_0x2b42c1['query']['sort']);_0x171be3[_0x2d6c('0x37')]=qs[_0x2d6c('0x31')](_[_0x2d6c('0x38')](_0x2b42c1[_0x2d6c('0x2f')],_0x2e33dc[_0x2d6c('0x31')]),_0x334c48);if(_0x2b42c1[_0x2d6c('0x2f')][_0x2d6c('0x39')]){_0x171be3[_0x2d6c('0x37')]=_[_0x2d6c('0x3a')](_0x171be3[_0x2d6c('0x37')],{'$or':_[_0x2d6c('0x2b')](_0x334c48,function(_0x168655){if(_0x168655[_0x2d6c('0x3b')]!==_0x2d6c('0x3c')){var _0x541da2={};_0x541da2[_0x168655[_0x2d6c('0x28')]]={'$like':'%'+_0x2b42c1['query'][_0x2d6c('0x39')]+'%'};return _0x541da2;}})});}_0x171be3=_[_0x2d6c('0x3a')]({},_0x171be3,_0x2b42c1['options']);var _0x715899={'where':_0x171be3[_0x2d6c('0x37')]};return db[_0x2d6c('0x2c')][_0x2d6c('0x1d')](_0x715899)[_0x2d6c('0x24')](function(_0x41c270){_0x2b584a['count']=_0x41c270;if(_0x2b42c1[_0x2d6c('0x2f')][_0x2d6c('0x3d')]){_0x171be3['include']=[{'all':!![]}];}return db[_0x2d6c('0x2c')]['findAll'](_0x171be3);})[_0x2d6c('0x24')](function(_0x50e5b6){_0x2b584a['rows']=_0x50e5b6;return _0x2b584a;})[_0x2d6c('0x24')](respondWithFilteredResult(_0x298050,_0x171be3))['catch'](handleError(_0x298050,null));};exports['show']=function(_0x299262,_0x81f0ef){var _0x3791d7={'raw':![],'where':{'id':_0x299262[_0x2d6c('0x3e')]['id']}},_0x20c38c={};_0x20c38c[_0x2d6c('0x2e')]=_[_0x2d6c('0x30')](db[_0x2d6c('0x2c')][_0x2d6c('0x2d')]);_0x20c38c['query']=_[_0x2d6c('0x30')](_0x299262[_0x2d6c('0x2f')]);_0x20c38c[_0x2d6c('0x31')]=_[_0x2d6c('0x3f')](_0x20c38c[_0x2d6c('0x2e')],_0x20c38c[_0x2d6c('0x2f')]);_0x3791d7[_0x2d6c('0x33')]=_[_0x2d6c('0x3f')](_0x20c38c[_0x2d6c('0x2e')],qs[_0x2d6c('0x32')](_0x299262[_0x2d6c('0x2f')][_0x2d6c('0x32')]));_0x3791d7[_0x2d6c('0x33')]=_0x3791d7[_0x2d6c('0x33')][_0x2d6c('0x34')]?_0x3791d7[_0x2d6c('0x33')]:_0x20c38c[_0x2d6c('0x2e')];if(_0x299262[_0x2d6c('0x2f')][_0x2d6c('0x3d')]){_0x3791d7[_0x2d6c('0x40')]=[{'all':!![]}];}_0x3791d7=_[_0x2d6c('0x3a')]({},_0x3791d7,_0x299262[_0x2d6c('0x41')]);return db[_0x2d6c('0x2c')][_0x2d6c('0x42')](_0x3791d7)[_0x2d6c('0x24')](handleEntityNotFound(_0x81f0ef,null))['then'](respondWithResult(_0x81f0ef,null))[_0x2d6c('0x43')](handleError(_0x81f0ef,null));};exports['create']=function(_0x394c2b,_0x3aeab0){return db[_0x2d6c('0x2c')][_0x2d6c('0x44')](_0x394c2b[_0x2d6c('0x45')],{})['then'](respondWithResult(_0x3aeab0,0xc9))[_0x2d6c('0x43')](handleError(_0x3aeab0,null));};exports['update']=function(_0x3671ed,_0xf29307){if(_0x3671ed[_0x2d6c('0x45')]['id']){delete _0x3671ed['body']['id'];}return db['ServicenowConfiguration'][_0x2d6c('0x42')]({'where':{'id':_0x3671ed['params']['id']}})['then'](handleEntityNotFound(_0xf29307,null))[_0x2d6c('0x24')](saveUpdates(_0x3671ed[_0x2d6c('0x45')],null))['then'](respondWithResult(_0xf29307,null))[_0x2d6c('0x43')](handleError(_0xf29307,null));};exports['destroy']=function(_0x1df6a2,_0x2c3379){return db[_0x2d6c('0x2c')][_0x2d6c('0x42')]({'where':{'id':_0x1df6a2['params']['id']}})['then'](handleEntityNotFound(_0x2c3379,null))[_0x2d6c('0x24')](removeEntity(_0x2c3379,null))[_0x2d6c('0x43')](handleError(_0x2c3379,null));};exports[_0x2d6c('0x46')]=function(_0x216a91,_0x480a17,_0x138b3f){var _0x1c1da7={};var _0x3d9377={};var _0x3ed8ae;var _0x24f472;return db[_0x2d6c('0x2c')][_0x2d6c('0x47')]({'where':{'id':_0x216a91[_0x2d6c('0x3e')]['id']}})[_0x2d6c('0x24')](handleEntityNotFound(_0x480a17,null))[_0x2d6c('0x24')](function(_0x40fda5){if(_0x40fda5){_0x3ed8ae=_0x40fda5;_0x3d9377[_0x2d6c('0x2e')]=_[_0x2d6c('0x30')](db['ServicenowField'][_0x2d6c('0x2d')]);_0x3d9377[_0x2d6c('0x2f')]=_[_0x2d6c('0x30')](_0x216a91[_0x2d6c('0x2f')]);_0x3d9377['filters']=_[_0x2d6c('0x3f')](_0x3d9377[_0x2d6c('0x2e')],_0x3d9377['query']);_0x1c1da7['attributes']=_[_0x2d6c('0x3f')](_0x3d9377['model'],qs[_0x2d6c('0x32')](_0x216a91['query']['fields']));_0x1c1da7['attributes']=_0x1c1da7[_0x2d6c('0x33')][_0x2d6c('0x34')]?_0x1c1da7[_0x2d6c('0x33')]:_0x3d9377[_0x2d6c('0x2e')];_0x1c1da7[_0x2d6c('0x48')]=qs[_0x2d6c('0x36')](_0x216a91[_0x2d6c('0x2f')][_0x2d6c('0x36')]);_0x1c1da7['where']=qs[_0x2d6c('0x31')](_[_0x2d6c('0x38')](_0x216a91[_0x2d6c('0x2f')],_0x3d9377['filters']));if(_0x216a91[_0x2d6c('0x2f')]['filter']){_0x1c1da7['where']=_[_0x2d6c('0x3a')](_0x1c1da7['where'],{'$or':_[_0x2d6c('0x2b')](_0x1c1da7['attributes'],function(_0x52d289){var _0x236baa={};_0x236baa[_0x52d289]={'$like':'%'+_0x216a91[_0x2d6c('0x2f')][_0x2d6c('0x39')]+'%'};return _0x236baa;})});}_0x1c1da7=_[_0x2d6c('0x3a')]({},_0x1c1da7,_0x216a91[_0x2d6c('0x41')]);return _0x3ed8ae[_0x2d6c('0x46')](_0x1c1da7);}})[_0x2d6c('0x24')](function(_0xe4d51f){if(_0xe4d51f){_0x24f472=_0xe4d51f[_0x2d6c('0x34')];if(!_0x216a91['query'][_0x2d6c('0x49')](_0x2d6c('0x35'))){_0x1c1da7[_0x2d6c('0x1c')]=qs[_0x2d6c('0x1c')](_0x216a91['query'][_0x2d6c('0x1c')]);_0x1c1da7['offset']=qs[_0x2d6c('0x1a')](_0x216a91[_0x2d6c('0x2f')]['offset']);}return _0x3ed8ae[_0x2d6c('0x46')](_0x1c1da7);}})['then'](function(_0x49667c){if(_0x49667c){return _0x49667c?{'count':_0x24f472,'rows':_0x49667c}:null;}})['then'](respondWithResult(_0x480a17,null))[_0x2d6c('0x43')](handleError(_0x480a17,null));};exports[_0x2d6c('0x4a')]=function(_0x57686a,_0x395a13,_0x1e4d9d){var _0x383347={};var _0xf9a157={};var _0x32b671;var _0x28278e;return db[_0x2d6c('0x2c')][_0x2d6c('0x47')]({'where':{'id':_0x57686a['params']['id']}})['then'](handleEntityNotFound(_0x395a13,null))[_0x2d6c('0x24')](function(_0x2d87d6){if(_0x2d87d6){_0x32b671=_0x2d87d6;_0xf9a157[_0x2d6c('0x2e')]=_[_0x2d6c('0x30')](db['ServicenowField'][_0x2d6c('0x2d')]);_0xf9a157[_0x2d6c('0x2f')]=_['keys'](_0x57686a[_0x2d6c('0x2f')]);_0xf9a157[_0x2d6c('0x31')]=_[_0x2d6c('0x3f')](_0xf9a157['model'],_0xf9a157[_0x2d6c('0x2f')]);_0x383347[_0x2d6c('0x33')]=_[_0x2d6c('0x3f')](_0xf9a157[_0x2d6c('0x2e')],qs[_0x2d6c('0x32')](_0x57686a[_0x2d6c('0x2f')][_0x2d6c('0x32')]));_0x383347['attributes']=_0x383347[_0x2d6c('0x33')][_0x2d6c('0x34')]?_0x383347[_0x2d6c('0x33')]:_0xf9a157[_0x2d6c('0x2e')];_0x383347[_0x2d6c('0x48')]=qs[_0x2d6c('0x36')](_0x57686a['query'][_0x2d6c('0x36')]);_0x383347[_0x2d6c('0x37')]=qs[_0x2d6c('0x31')](_[_0x2d6c('0x38')](_0x57686a[_0x2d6c('0x2f')],_0xf9a157[_0x2d6c('0x31')]));if(_0x57686a[_0x2d6c('0x2f')][_0x2d6c('0x39')]){_0x383347[_0x2d6c('0x37')]=_[_0x2d6c('0x3a')](_0x383347[_0x2d6c('0x37')],{'$or':_['map'](_0x383347[_0x2d6c('0x33')],function(_0x220428){var _0x3e3832={};_0x3e3832[_0x220428]={'$like':'%'+_0x57686a['query'][_0x2d6c('0x39')]+'%'};return _0x3e3832;})});}_0x383347=_[_0x2d6c('0x3a')]({},_0x383347,_0x57686a[_0x2d6c('0x41')]);return _0x32b671['getSubjects'](_0x383347);}})[_0x2d6c('0x24')](function(_0x14b460){if(_0x14b460){_0x28278e=_0x14b460[_0x2d6c('0x34')];if(!_0x57686a[_0x2d6c('0x2f')]['hasOwnProperty'](_0x2d6c('0x35'))){_0x383347[_0x2d6c('0x1c')]=qs[_0x2d6c('0x1c')](_0x57686a[_0x2d6c('0x2f')][_0x2d6c('0x1c')]);_0x383347[_0x2d6c('0x1a')]=qs['offset'](_0x57686a[_0x2d6c('0x2f')][_0x2d6c('0x1a')]);}return _0x32b671[_0x2d6c('0x4a')](_0x383347);}})[_0x2d6c('0x24')](function(_0x31f236){if(_0x31f236){return _0x31f236?{'count':_0x28278e,'rows':_0x31f236}:null;}})['then'](respondWithResult(_0x395a13,null))[_0x2d6c('0x43')](handleError(_0x395a13,null));};exports[_0x2d6c('0x4b')]=function(_0x17b8b9,_0x3c02e7,_0x153f39){var _0x3ab516={};var _0x3bfa9a={};var _0x506a0d;var _0x2f64df;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x17b8b9['params']['id']}})[_0x2d6c('0x24')](handleEntityNotFound(_0x3c02e7,null))[_0x2d6c('0x24')](function(_0x4dfbaa){if(_0x4dfbaa){_0x506a0d=_0x4dfbaa;_0x3bfa9a[_0x2d6c('0x2e')]=_['keys'](db[_0x2d6c('0x4c')][_0x2d6c('0x2d')]);_0x3bfa9a[_0x2d6c('0x2f')]=_[_0x2d6c('0x30')](_0x17b8b9[_0x2d6c('0x2f')]);_0x3bfa9a[_0x2d6c('0x31')]=_[_0x2d6c('0x3f')](_0x3bfa9a[_0x2d6c('0x2e')],_0x3bfa9a['query']);_0x3ab516[_0x2d6c('0x33')]=_[_0x2d6c('0x3f')](_0x3bfa9a[_0x2d6c('0x2e')],qs[_0x2d6c('0x32')](_0x17b8b9[_0x2d6c('0x2f')]['fields']));_0x3ab516[_0x2d6c('0x33')]=_0x3ab516[_0x2d6c('0x33')][_0x2d6c('0x34')]?_0x3ab516['attributes']:_0x3bfa9a[_0x2d6c('0x2e')];_0x3ab516['order']=qs['sort'](_0x17b8b9[_0x2d6c('0x2f')][_0x2d6c('0x36')]);_0x3ab516[_0x2d6c('0x37')]=qs[_0x2d6c('0x31')](_[_0x2d6c('0x38')](_0x17b8b9[_0x2d6c('0x2f')],_0x3bfa9a[_0x2d6c('0x31')]));if(_0x17b8b9[_0x2d6c('0x2f')][_0x2d6c('0x39')]){_0x3ab516[_0x2d6c('0x37')]=_[_0x2d6c('0x3a')](_0x3ab516['where'],{'$or':_[_0x2d6c('0x2b')](_0x3ab516[_0x2d6c('0x33')],function(_0x29877b){var _0x48d4ae={};_0x48d4ae[_0x29877b]={'$like':'%'+_0x17b8b9[_0x2d6c('0x2f')][_0x2d6c('0x39')]+'%'};return _0x48d4ae;})});}_0x3ab516=_[_0x2d6c('0x3a')]({},_0x3ab516,_0x17b8b9[_0x2d6c('0x41')]);return _0x506a0d[_0x2d6c('0x4b')](_0x3ab516);}})[_0x2d6c('0x24')](function(_0x2ba70e){if(_0x2ba70e){_0x2f64df=_0x2ba70e[_0x2d6c('0x34')];if(!_0x17b8b9['query'][_0x2d6c('0x49')]('nolimit')){_0x3ab516[_0x2d6c('0x1c')]=qs[_0x2d6c('0x1c')](_0x17b8b9['query'][_0x2d6c('0x1c')]);_0x3ab516[_0x2d6c('0x1a')]=qs[_0x2d6c('0x1a')](_0x17b8b9[_0x2d6c('0x2f')][_0x2d6c('0x1a')]);}return _0x506a0d['getDescriptions'](_0x3ab516);}})['then'](function(_0x4fe97f){if(_0x4fe97f){return _0x4fe97f?{'count':_0x2f64df,'rows':_0x4fe97f}:null;}})['then'](respondWithResult(_0x3c02e7,null))[_0x2d6c('0x43')](handleError(_0x3c02e7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0ef251b..06d4ac2 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 _0x2b65=['api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x265174,_0x45ab1b){var _0x5afe9e=function(_0x259f2e){while(--_0x259f2e){_0x265174['push'](_0x265174['shift']());}};_0x5afe9e(++_0x45ab1b);}(_0x2b65,0x131));var _0x52b6=function(_0xeec31d,_0x189f0c){_0xeec31d=_0xeec31d-0x0;var _0x5915e1=_0x2b65[_0xeec31d];return _0x5915e1;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var logger=require(_0x52b6('0x2'))(_0x52b6('0x3'));var moment=require(_0x52b6('0x4'));var BPromise=require(_0x52b6('0x5'));var rp=require(_0x52b6('0x6'));var fs=require('fs');var path=require(_0x52b6('0x7'));var rimraf=require('rimraf');var config=require(_0x52b6('0x8'));var attributes=require(_0x52b6('0x9'));module[_0x52b6('0xa')]=function(_0x2c643d,_0x25593f){return _0x2c643d[_0x52b6('0xb')](_0x52b6('0xc'),attributes,{'tableName':_0x52b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfef3=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1131d6,_0x11257a){var _0x3a4e6e=function(_0x21acf7){while(--_0x21acf7){_0x1131d6['push'](_0x1131d6['shift']());}};_0x3a4e6e(++_0x11257a);}(_0xfef3,0x118));var _0x3fef=function(_0x11a7c9,_0x2de6e8){_0x11a7c9=_0x11a7c9-0x0;var _0x2bf3d8=_0xfef3[_0x11a7c9];return _0x2bf3d8;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var logger=require(_0x3fef('0x1'))('api');var moment=require(_0x3fef('0x2'));var BPromise=require(_0x3fef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fef('0x4'));var rimraf=require(_0x3fef('0x5'));var config=require('../../config/environment');var attributes=require(_0x3fef('0x6'));module[_0x3fef('0x7')]=function(_0x5dd9fb,_0x319a2a){return _0x5dd9fb[_0x3fef('0x8')](_0x3fef('0x9'),attributes,{'tableName':_0x3fef('0xa'),'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 bf1c0ba..de5e255 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 _0xe55d=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x14b0e3,_0xfc2e74){var _0x105940=function(_0x185947){while(--_0x185947){_0x14b0e3['push'](_0x14b0e3['shift']());}};_0x105940(++_0xfc2e74);}(_0xe55d,0x126));var _0xde55=function(_0x173481,_0xd9300f){_0x173481=_0x173481-0x0;var _0x2f1fdf=_0xe55d[_0x173481];return _0x2f1fdf;};'use strict';var _=require(_0xde55('0x0'));var util=require(_0xde55('0x1'));var moment=require('moment');var BPromise=require(_0xde55('0x2'));var rs=require(_0xde55('0x3'));var fs=require('fs');var Redis=require(_0xde55('0x4'));var db=require(_0xde55('0x5'))['db'];var utils=require(_0xde55('0x6'));var logger=require(_0xde55('0x7'))('rpc');var config=require(_0xde55('0x8'));var jayson=require(_0xde55('0x9'));var client=jayson[_0xde55('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e7b53,_0x1468f2,_0x1e342e){return new BPromise(function(_0x2094bb,_0x22cbd8){return client[_0xde55('0xb')](_0x1e7b53,_0x1e342e)['then'](function(_0x11aa16){logger[_0xde55('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1468f2,'request\x20sent');logger[_0xde55('0xd')](_0xde55('0xe'),_0x1468f2,'request\x20sent',JSON[_0xde55('0xf')](_0x11aa16));if(_0x11aa16[_0xde55('0x10')]){if(_0x11aa16['error'][_0xde55('0x11')]===0x1f4){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16['error'][_0xde55('0x13')]);return _0x22cbd8(_0x11aa16[_0xde55('0x10')][_0xde55('0x13')]);}logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16[_0xde55('0x10')]['message']);return _0x2094bb(_0x11aa16['error'][_0xde55('0x13')]);}else{logger[_0xde55('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1468f2,_0xde55('0x14'));_0x2094bb(_0x11aa16[_0xde55('0x15')][_0xde55('0x13')]);}})[_0xde55('0x16')](function(_0x2f4a77){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x2f4a77);_0x22cbd8(_0x2f4a77);});});} \ No newline at end of file +var _0xb032=['then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xb032,0x84));var _0x2b03=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xb032[_0x5e9a69];return _0x5979c8;};'use strict';var _=require(_0x2b03('0x0'));var util=require('util');var moment=require(_0x2b03('0x1'));var BPromise=require(_0x2b03('0x2'));var rs=require(_0x2b03('0x3'));var fs=require('fs');var Redis=require(_0x2b03('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b03('0x5'));var logger=require(_0x2b03('0x6'))(_0x2b03('0x7'));var config=require(_0x2b03('0x8'));var jayson=require(_0x2b03('0x9'));var client=jayson[_0x2b03('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14db2a,_0x2f811b,_0x369212){return new BPromise(function(_0x24cc52,_0x4df225){return client[_0x2b03('0xb')](_0x14db2a,_0x369212)[_0x2b03('0xc')](function(_0xe323d6){logger['info'](_0x2b03('0xd'),_0x2f811b,_0x2b03('0xe'));logger[_0x2b03('0xf')](_0x2b03('0x10'),_0x2f811b,_0x2b03('0xe'),JSON[_0x2b03('0x11')](_0xe323d6));if(_0xe323d6[_0x2b03('0x12')]){if(_0xe323d6[_0x2b03('0x12')][_0x2b03('0x13')]===0x1f4){logger[_0x2b03('0x12')](_0x2b03('0xd'),_0x2f811b,_0xe323d6['error'][_0x2b03('0x14')]);return _0x4df225(_0xe323d6[_0x2b03('0x12')][_0x2b03('0x14')]);}logger[_0x2b03('0x12')](_0x2b03('0xd'),_0x2f811b,_0xe323d6[_0x2b03('0x12')][_0x2b03('0x14')]);return _0x24cc52(_0xe323d6[_0x2b03('0x12')][_0x2b03('0x14')]);}else{logger[_0x2b03('0x15')](_0x2b03('0xd'),_0x2f811b,_0x2b03('0xe'));_0x24cc52(_0xe323d6[_0x2b03('0x16')][_0x2b03('0x14')]);}})[_0x2b03('0x17')](function(_0x1bb2b7){logger[_0x2b03('0x12')](_0x2b03('0xd'),_0x2f811b,_0x1bb2b7);_0x4df225(_0x1bb2b7);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index daf214e..4e1e970 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 _0xf7a9=['get','isAuthenticated','index','show','post','create','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf7a9,0x149));var _0x9f7a=function(_0x46b60d,_0x525166){_0x46b60d=_0x46b60d-0x0;var _0xbbf95b=_0xf7a9[_0x46b60d];return _0xbbf95b;};'use strict';var multer=require('multer');var util=require(_0x9f7a('0x0'));var path=require(_0x9f7a('0x1'));var timeout=require(_0x9f7a('0x2'));var express=require(_0x9f7a('0x3'));var router=express['Router']();var fs_extra=require(_0x9f7a('0x4'));var auth=require(_0x9f7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f7a('0x6'));var controller=require('./intServicenowField.controller');router[_0x9f7a('0x7')]('/',auth[_0x9f7a('0x8')](),controller[_0x9f7a('0x9')]);router[_0x9f7a('0x7')]('/:id',auth[_0x9f7a('0x8')](),controller[_0x9f7a('0xa')]);router[_0x9f7a('0xb')]('/',auth[_0x9f7a('0x8')](),controller[_0x9f7a('0xc')]);router['put'](_0x9f7a('0xd'),auth[_0x9f7a('0x8')](),controller['update']);router['delete'](_0x9f7a('0xd'),auth[_0x9f7a('0x8')](),controller[_0x9f7a('0xe')]);module[_0x9f7a('0xf')]=router; \ No newline at end of file +var _0xdd07=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','multer','util'];(function(_0x4a9475,_0x59726c){var _0x250070=function(_0x5b13c4){while(--_0x5b13c4){_0x4a9475['push'](_0x4a9475['shift']());}};_0x250070(++_0x59726c);}(_0xdd07,0xb9));var _0x7dd0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdd07[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x7dd0('0x0'));var util=require(_0x7dd0('0x1'));var path=require('path');var timeout=require(_0x7dd0('0x2'));var express=require('express');var router=express[_0x7dd0('0x3')]();var fs_extra=require(_0x7dd0('0x4'));var auth=require(_0x7dd0('0x5'));var interaction=require(_0x7dd0('0x6'));var config=require(_0x7dd0('0x7'));var controller=require(_0x7dd0('0x8'));router[_0x7dd0('0x9')]('/',auth[_0x7dd0('0xa')](),controller[_0x7dd0('0xb')]);router[_0x7dd0('0x9')](_0x7dd0('0xc'),auth[_0x7dd0('0xa')](),controller['show']);router['post']('/',auth[_0x7dd0('0xa')](),controller[_0x7dd0('0xd')]);router[_0x7dd0('0xe')]('/:id',auth[_0x7dd0('0xa')](),controller[_0x7dd0('0xf')]);router[_0x7dd0('0x10')](_0x7dd0('0xc'),auth[_0x7dd0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f3777ac..413d45f 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 _0xd5f3=['BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM'];(function(_0x433bf8,_0x323382){var _0x5c8da9=function(_0x50367e){while(--_0x50367e){_0x433bf8['push'](_0x433bf8['shift']());}};_0x5c8da9(++_0x323382);}(_0xd5f3,0x1a5));var _0x3d5f=function(_0x2c9d38,_0x41dfd1){_0x2c9d38=_0x2c9d38-0x0;var _0x2a0a11=_0xd5f3[_0x2c9d38];return _0x2a0a11;};'use strict';var Sequelize=require(_0x3d5f('0x0'));module[_0x3d5f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x3d5f('0x2'),_0x3d5f('0x3'),_0x3d5f('0x4'),_0x3d5f('0x5')),'defaultValue':_0x3d5f('0x6')},'content':{'type':Sequelize[_0x3d5f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3d5f('0x8')](_0x3d5f('0x6'),_0x3d5f('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x3d5f('0x7')]},'idField':{'type':Sequelize[_0x3d5f('0x7')]},'nameField':{'type':Sequelize[_0x3d5f('0x7')]},'customField':{'type':Sequelize[_0x3d5f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3d5f('0x7')]}}; \ No newline at end of file +var _0x9afa=['picklist','STRING','ENUM','string','sequelize','exports','customVariable','keyValue'];(function(_0x123f8e,_0x4c3886){var _0x53782c=function(_0x3b5ad4){while(--_0x3b5ad4){_0x123f8e['push'](_0x123f8e['shift']());}};_0x53782c(++_0x4c3886);}(_0x9afa,0x1d4));var _0xa9af=function(_0x59fa5c,_0x46020a){_0x59fa5c=_0x59fa5c-0x0;var _0x1d12ee=_0x9afa[_0x59fa5c];return _0x1d12ee;};'use strict';var Sequelize=require(_0xa9af('0x0'));module[_0xa9af('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xa9af('0x2'),_0xa9af('0x3'),_0xa9af('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa9af('0x5')]},'key':{'type':Sequelize[_0xa9af('0x5')]},'keyType':{'type':Sequelize[_0xa9af('0x6')](_0xa9af('0x7'),'variable',_0xa9af('0x2'))},'keyContent':{'type':Sequelize[_0xa9af('0x5')]},'idField':{'type':Sequelize[_0xa9af('0x5')]},'nameField':{'type':Sequelize[_0xa9af('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'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 967166e..5946475 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 _0xf8d8=['../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x268ad0,_0x50c35b){var _0x4619ea=function(_0x51b35f){while(--_0x51b35f){_0x268ad0['push'](_0x268ad0['shift']());}};_0x4619ea(++_0x50c35b);}(_0xf8d8,0xfb));var _0x8f8d=function(_0x41a596,_0x9963c){_0x41a596=_0x41a596-0x0;var _0x48cad1=_0xf8d8[_0x41a596];return _0x48cad1;};'use strict';var emlformat=require(_0x8f8d('0x0'));var rimraf=require(_0x8f8d('0x1'));var zipdir=require(_0x8f8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8f8d('0x3'));var Mustache=require(_0x8f8d('0x4'));var util=require('util');var path=require(_0x8f8d('0x5'));var sox=require(_0x8f8d('0x6'));var csv=require(_0x8f8d('0x7'));var ejs=require(_0x8f8d('0x8'));var fs=require('fs');var fs_extra=require(_0x8f8d('0x9'));var _=require(_0x8f8d('0xa'));var squel=require(_0x8f8d('0xb'));var crypto=require(_0x8f8d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8f8d('0xd'));var toCsv=require(_0x8f8d('0x7'));var querystring=require(_0x8f8d('0xe'));var Papa=require(_0x8f8d('0xf'));var Redis=require('ioredis');var authService=require(_0x8f8d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8f8d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f8d('0x12'));var utils=require('../../config/utils');var config=require(_0x8f8d('0x13'));var licenseUtil=require(_0x8f8d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x154e5e,_0x680b5){_0x680b5=_0x680b5||0xcc;return function(_0x41d514){if(_0x41d514){return _0x154e5e[_0x8f8d('0x15')](_0x680b5);}return _0x154e5e[_0x8f8d('0x16')](_0x680b5)['end']();};}function respondWithResult(_0x132b8,_0x3c3560){_0x3c3560=_0x3c3560||0xc8;return function(_0x124be0){if(_0x124be0){return _0x132b8[_0x8f8d('0x16')](_0x3c3560)[_0x8f8d('0x17')](_0x124be0);}};}function respondWithFilteredResult(_0x3ec605,_0xa91f84){return function(_0x598778){if(_0x598778){var _0x528df3=typeof _0xa91f84[_0x8f8d('0x18')]===_0x8f8d('0x19')&&typeof _0xa91f84['limit']===_0x8f8d('0x19');var _0x12c3e9=_0x598778[_0x8f8d('0x1a')];var _0x57ae2b=_0x528df3?0x0:_0xa91f84[_0x8f8d('0x18')];var _0x57cd76=_0x528df3?_0x598778[_0x8f8d('0x1a')]:_0xa91f84[_0x8f8d('0x18')]+_0xa91f84[_0x8f8d('0x1b')];var _0x118bde;if(_0x57cd76>=_0x12c3e9){_0x57cd76=_0x12c3e9;_0x118bde=0xc8;}else{_0x118bde=0xce;}_0x3ec605['status'](_0x118bde);return _0x3ec605[_0x8f8d('0x1c')](_0x8f8d('0x1d'),_0x57ae2b+'-'+_0x57cd76+'/'+_0x12c3e9)[_0x8f8d('0x17')](_0x598778);}return null;};}function patchUpdates(_0x460851){return function(_0x4580e3){try{jsonpatch['apply'](_0x4580e3,_0x460851,!![]);}catch(_0x50b25c){return BPromise[_0x8f8d('0x1e')](_0x50b25c);}return _0x4580e3[_0x8f8d('0x1f')]();};}function saveUpdates(_0x2e6c19,_0x27cc78){return function(_0x4b2440){if(_0x4b2440){return _0x4b2440['update'](_0x2e6c19)[_0x8f8d('0x20')](function(_0x172952){return _0x172952;});}return null;};}function removeEntity(_0x449ea2,_0x398d66){return function(_0x29d1ce){if(_0x29d1ce){return _0x29d1ce[_0x8f8d('0x21')]()[_0x8f8d('0x20')](function(){_0x449ea2[_0x8f8d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0a54,_0x5e4ce6){return function(_0x283bf5){if(!_0x283bf5){_0x3e0a54[_0x8f8d('0x15')](0x194);}return _0x283bf5;};}function handleError(_0x9320ff,_0xa506e7){_0xa506e7=_0xa506e7||0x1f4;return function(_0x1e3f41){logger['error'](_0x1e3f41[_0x8f8d('0x22')]);if(_0x1e3f41[_0x8f8d('0x23')]){delete _0x1e3f41['name'];}_0x9320ff[_0x8f8d('0x16')](_0xa506e7)[_0x8f8d('0x24')](_0x1e3f41);};}exports[_0x8f8d('0x25')]=function(_0x6dba17,_0x2c97cc){var _0xed5dbd={},_0x2231ea={},_0x593432={'count':0x0,'rows':[]};var _0x1ada39=_[_0x8f8d('0x26')](db[_0x8f8d('0x27')][_0x8f8d('0x28')],function(_0x269751){return{'name':_0x269751[_0x8f8d('0x29')],'type':_0x269751[_0x8f8d('0x2a')]['key']};});_0x2231ea[_0x8f8d('0x2b')]=_['map'](_0x1ada39,'name');_0x2231ea[_0x8f8d('0x2c')]=_[_0x8f8d('0x2d')](_0x6dba17[_0x8f8d('0x2c')]);_0x2231ea[_0x8f8d('0x2e')]=_[_0x8f8d('0x2f')](_0x2231ea[_0x8f8d('0x2b')],_0x2231ea['query']);_0xed5dbd[_0x8f8d('0x30')]=_['intersection'](_0x2231ea[_0x8f8d('0x2b')],qs[_0x8f8d('0x31')](_0x6dba17[_0x8f8d('0x2c')][_0x8f8d('0x31')]));_0xed5dbd[_0x8f8d('0x30')]=_0xed5dbd[_0x8f8d('0x30')]['length']?_0xed5dbd['attributes']:_0x2231ea[_0x8f8d('0x2b')];if(!_0x6dba17[_0x8f8d('0x2c')]['hasOwnProperty']('nolimit')){_0xed5dbd[_0x8f8d('0x1b')]=qs[_0x8f8d('0x1b')](_0x6dba17[_0x8f8d('0x2c')]['limit']);_0xed5dbd['offset']=qs[_0x8f8d('0x18')](_0x6dba17['query'][_0x8f8d('0x18')]);}_0xed5dbd[_0x8f8d('0x32')]=qs[_0x8f8d('0x33')](_0x6dba17[_0x8f8d('0x2c')]['sort']);_0xed5dbd['where']=qs[_0x8f8d('0x2e')](_['pick'](_0x6dba17[_0x8f8d('0x2c')],_0x2231ea['filters']),_0x1ada39);if(_0x6dba17[_0x8f8d('0x2c')][_0x8f8d('0x34')]){_0xed5dbd[_0x8f8d('0x35')]=_[_0x8f8d('0x36')](_0xed5dbd[_0x8f8d('0x35')],{'$or':_[_0x8f8d('0x26')](_0x1ada39,function(_0x332cc3){if(_0x332cc3[_0x8f8d('0x2a')]!==_0x8f8d('0x37')){var _0x2b73f0={};_0x2b73f0[_0x332cc3[_0x8f8d('0x23')]]={'$like':'%'+_0x6dba17[_0x8f8d('0x2c')][_0x8f8d('0x34')]+'%'};return _0x2b73f0;}})});}_0xed5dbd=_['merge']({},_0xed5dbd,_0x6dba17[_0x8f8d('0x38')]);var _0x517bbd={'where':_0xed5dbd['where']};return db[_0x8f8d('0x27')][_0x8f8d('0x1a')](_0x517bbd)[_0x8f8d('0x20')](function(_0xfca3cc){_0x593432['count']=_0xfca3cc;if(_0x6dba17[_0x8f8d('0x2c')]['includeAll']){_0xed5dbd[_0x8f8d('0x39')]=[{'all':!![]}];}return db[_0x8f8d('0x27')][_0x8f8d('0x3a')](_0xed5dbd);})[_0x8f8d('0x20')](function(_0x361078){_0x593432[_0x8f8d('0x3b')]=_0x361078;return _0x593432;})[_0x8f8d('0x20')](respondWithFilteredResult(_0x2c97cc,_0xed5dbd))[_0x8f8d('0x3c')](handleError(_0x2c97cc,null));};exports[_0x8f8d('0x3d')]=function(_0x2fec16,_0x1de240){var _0x512614={'raw':!![],'where':{'id':_0x2fec16['params']['id']}},_0x395701={};_0x395701['model']=_[_0x8f8d('0x2d')](db['ServicenowField'][_0x8f8d('0x28')]);_0x395701['query']=_['keys'](_0x2fec16[_0x8f8d('0x2c')]);_0x395701[_0x8f8d('0x2e')]=_[_0x8f8d('0x2f')](_0x395701[_0x8f8d('0x2b')],_0x395701[_0x8f8d('0x2c')]);_0x512614[_0x8f8d('0x30')]=_['intersection'](_0x395701[_0x8f8d('0x2b')],qs['fields'](_0x2fec16[_0x8f8d('0x2c')][_0x8f8d('0x31')]));_0x512614[_0x8f8d('0x30')]=_0x512614[_0x8f8d('0x30')][_0x8f8d('0x3e')]?_0x512614[_0x8f8d('0x30')]:_0x395701[_0x8f8d('0x2b')];if(_0x2fec16[_0x8f8d('0x2c')][_0x8f8d('0x3f')]){_0x512614[_0x8f8d('0x39')]=[{'all':!![]}];}_0x512614=_[_0x8f8d('0x36')]({},_0x512614,_0x2fec16[_0x8f8d('0x38')]);return db[_0x8f8d('0x27')][_0x8f8d('0x40')](_0x512614)[_0x8f8d('0x20')](handleEntityNotFound(_0x1de240,null))['then'](respondWithResult(_0x1de240,null))[_0x8f8d('0x3c')](handleError(_0x1de240,null));};exports[_0x8f8d('0x41')]=function(_0x5a17b9,_0x15e89e){return db[_0x8f8d('0x27')][_0x8f8d('0x41')](_0x5a17b9['body'],{})['then'](respondWithResult(_0x15e89e,0xc9))[_0x8f8d('0x3c')](handleError(_0x15e89e,null));};exports['update']=function(_0x2a1023,_0x20ae30){if(_0x2a1023[_0x8f8d('0x42')]['id']){delete _0x2a1023[_0x8f8d('0x42')]['id'];}return db['ServicenowField'][_0x8f8d('0x40')]({'where':{'id':_0x2a1023['params']['id']}})[_0x8f8d('0x20')](handleEntityNotFound(_0x20ae30,null))[_0x8f8d('0x20')](saveUpdates(_0x2a1023[_0x8f8d('0x42')],null))[_0x8f8d('0x20')](respondWithResult(_0x20ae30,null))[_0x8f8d('0x3c')](handleError(_0x20ae30,null));};exports[_0x8f8d('0x21')]=function(_0x38124e,_0x15ae11){return db[_0x8f8d('0x27')][_0x8f8d('0x40')]({'where':{'id':_0x38124e['params']['id']}})[_0x8f8d('0x20')](handleEntityNotFound(_0x15ae11,null))[_0x8f8d('0x20')](removeEntity(_0x15ae11,null))[_0x8f8d('0x3c')](handleError(_0x15ae11,null));}; \ No newline at end of file +var _0xb464=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xb464,0x1e4));var _0x4b46=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0xb464[_0x38fb0d];return _0x30a5d6;};'use strict';var emlformat=require(_0x4b46('0x0'));var rimraf=require(_0x4b46('0x1'));var zipdir=require(_0x4b46('0x2'));var jsonpatch=require(_0x4b46('0x3'));var rp=require(_0x4b46('0x4'));var moment=require('moment');var BPromise=require(_0x4b46('0x5'));var Mustache=require(_0x4b46('0x6'));var util=require(_0x4b46('0x7'));var path=require(_0x4b46('0x8'));var sox=require(_0x4b46('0x9'));var csv=require(_0x4b46('0xa'));var ejs=require(_0x4b46('0xb'));var fs=require('fs');var fs_extra=require(_0x4b46('0xc'));var _=require('lodash');var squel=require(_0x4b46('0xd'));var crypto=require(_0x4b46('0xe'));var jsforce=require(_0x4b46('0xf'));var deskjs=require(_0x4b46('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4b46('0x11'));var Redis=require(_0x4b46('0x12'));var authService=require(_0x4b46('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b46('0x14'));var logger=require(_0x4b46('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4b46('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b46('0x17'))['db'];function respondWithStatusCode(_0x2b8d93,_0x5a8cde){_0x5a8cde=_0x5a8cde||0xcc;return function(_0xf75edd){if(_0xf75edd){return _0x2b8d93[_0x4b46('0x18')](_0x5a8cde);}return _0x2b8d93['status'](_0x5a8cde)[_0x4b46('0x19')]();};}function respondWithResult(_0x1a4c89,_0x38eb68){_0x38eb68=_0x38eb68||0xc8;return function(_0x581226){if(_0x581226){return _0x1a4c89[_0x4b46('0x1a')](_0x38eb68)[_0x4b46('0x1b')](_0x581226);}};}function respondWithFilteredResult(_0x45f613,_0x5c6d32){return function(_0x3de9e9){if(_0x3de9e9){var _0x652ec2=typeof _0x5c6d32[_0x4b46('0x1c')]===_0x4b46('0x1d')&&typeof _0x5c6d32[_0x4b46('0x1e')]===_0x4b46('0x1d');var _0x46ead8=_0x3de9e9['count'];var _0x3e97cf=_0x652ec2?0x0:_0x5c6d32[_0x4b46('0x1c')];var _0x967735=_0x652ec2?_0x3de9e9['count']:_0x5c6d32[_0x4b46('0x1c')]+_0x5c6d32['limit'];var _0x44495b;if(_0x967735>=_0x46ead8){_0x967735=_0x46ead8;_0x44495b=0xc8;}else{_0x44495b=0xce;}_0x45f613[_0x4b46('0x1a')](_0x44495b);return _0x45f613[_0x4b46('0x1f')](_0x4b46('0x20'),_0x3e97cf+'-'+_0x967735+'/'+_0x46ead8)[_0x4b46('0x1b')](_0x3de9e9);}return null;};}function patchUpdates(_0x425767){return function(_0x32115b){try{jsonpatch[_0x4b46('0x21')](_0x32115b,_0x425767,!![]);}catch(_0x5eeaf1){return BPromise[_0x4b46('0x22')](_0x5eeaf1);}return _0x32115b[_0x4b46('0x23')]();};}function saveUpdates(_0x118eb3,_0x21c761){return function(_0x2af835){if(_0x2af835){return _0x2af835[_0x4b46('0x24')](_0x118eb3)[_0x4b46('0x25')](function(_0x1fda19){return _0x1fda19;});}return null;};}function removeEntity(_0x274928,_0x3ba4d1){return function(_0x5a537c){if(_0x5a537c){return _0x5a537c[_0x4b46('0x26')]()['then'](function(){_0x274928[_0x4b46('0x1a')](0xcc)[_0x4b46('0x19')]();});}};}function handleEntityNotFound(_0x1a1cd8,_0x6a30fd){return function(_0x4d8b50){if(!_0x4d8b50){_0x1a1cd8[_0x4b46('0x18')](0x194);}return _0x4d8b50;};}function handleError(_0x319ec9,_0x5dd5c2){_0x5dd5c2=_0x5dd5c2||0x1f4;return function(_0x1ea841){logger[_0x4b46('0x27')](_0x1ea841[_0x4b46('0x28')]);if(_0x1ea841[_0x4b46('0x29')]){delete _0x1ea841[_0x4b46('0x29')];}_0x319ec9['status'](_0x5dd5c2)[_0x4b46('0x2a')](_0x1ea841);};}exports[_0x4b46('0x2b')]=function(_0x3316c9,_0xda11cd){var _0x29b13c={},_0x2e6b0c={},_0x1774cd={'count':0x0,'rows':[]};var _0x3831ab=_[_0x4b46('0x2c')](db[_0x4b46('0x2d')][_0x4b46('0x2e')],function(_0x339c7d){return{'name':_0x339c7d[_0x4b46('0x2f')],'type':_0x339c7d[_0x4b46('0x30')][_0x4b46('0x31')]};});_0x2e6b0c['model']=_['map'](_0x3831ab,_0x4b46('0x29'));_0x2e6b0c[_0x4b46('0x32')]=_[_0x4b46('0x33')](_0x3316c9[_0x4b46('0x32')]);_0x2e6b0c[_0x4b46('0x34')]=_[_0x4b46('0x35')](_0x2e6b0c[_0x4b46('0x36')],_0x2e6b0c[_0x4b46('0x32')]);_0x29b13c[_0x4b46('0x37')]=_[_0x4b46('0x35')](_0x2e6b0c[_0x4b46('0x36')],qs[_0x4b46('0x38')](_0x3316c9[_0x4b46('0x32')]['fields']));_0x29b13c[_0x4b46('0x37')]=_0x29b13c[_0x4b46('0x37')]['length']?_0x29b13c['attributes']:_0x2e6b0c[_0x4b46('0x36')];if(!_0x3316c9[_0x4b46('0x32')][_0x4b46('0x39')](_0x4b46('0x3a'))){_0x29b13c[_0x4b46('0x1e')]=qs[_0x4b46('0x1e')](_0x3316c9[_0x4b46('0x32')]['limit']);_0x29b13c['offset']=qs['offset'](_0x3316c9['query']['offset']);}_0x29b13c[_0x4b46('0x3b')]=qs[_0x4b46('0x3c')](_0x3316c9[_0x4b46('0x32')][_0x4b46('0x3c')]);_0x29b13c[_0x4b46('0x3d')]=qs['filters'](_['pick'](_0x3316c9[_0x4b46('0x32')],_0x2e6b0c[_0x4b46('0x34')]),_0x3831ab);if(_0x3316c9[_0x4b46('0x32')][_0x4b46('0x3e')]){_0x29b13c['where']=_[_0x4b46('0x3f')](_0x29b13c[_0x4b46('0x3d')],{'$or':_[_0x4b46('0x2c')](_0x3831ab,function(_0x14b238){if(_0x14b238[_0x4b46('0x30')]!==_0x4b46('0x40')){var _0x445fa0={};_0x445fa0[_0x14b238[_0x4b46('0x29')]]={'$like':'%'+_0x3316c9['query']['filter']+'%'};return _0x445fa0;}})});}_0x29b13c=_[_0x4b46('0x3f')]({},_0x29b13c,_0x3316c9[_0x4b46('0x41')]);var _0xfe3f2={'where':_0x29b13c[_0x4b46('0x3d')]};return db[_0x4b46('0x2d')][_0x4b46('0x42')](_0xfe3f2)['then'](function(_0x5de03a){_0x1774cd[_0x4b46('0x42')]=_0x5de03a;if(_0x3316c9[_0x4b46('0x32')]['includeAll']){_0x29b13c[_0x4b46('0x43')]=[{'all':!![]}];}return db[_0x4b46('0x2d')][_0x4b46('0x44')](_0x29b13c);})['then'](function(_0xb96090){_0x1774cd[_0x4b46('0x45')]=_0xb96090;return _0x1774cd;})[_0x4b46('0x25')](respondWithFilteredResult(_0xda11cd,_0x29b13c))[_0x4b46('0x46')](handleError(_0xda11cd,null));};exports[_0x4b46('0x47')]=function(_0xc31ca5,_0x2373fa){var _0x260759={'raw':!![],'where':{'id':_0xc31ca5[_0x4b46('0x48')]['id']}},_0x1c75dc={};_0x1c75dc['model']=_[_0x4b46('0x33')](db[_0x4b46('0x2d')][_0x4b46('0x2e')]);_0x1c75dc[_0x4b46('0x32')]=_[_0x4b46('0x33')](_0xc31ca5[_0x4b46('0x32')]);_0x1c75dc['filters']=_[_0x4b46('0x35')](_0x1c75dc['model'],_0x1c75dc[_0x4b46('0x32')]);_0x260759[_0x4b46('0x37')]=_[_0x4b46('0x35')](_0x1c75dc['model'],qs['fields'](_0xc31ca5[_0x4b46('0x32')][_0x4b46('0x38')]));_0x260759['attributes']=_0x260759[_0x4b46('0x37')][_0x4b46('0x49')]?_0x260759[_0x4b46('0x37')]:_0x1c75dc[_0x4b46('0x36')];if(_0xc31ca5[_0x4b46('0x32')]['includeAll']){_0x260759[_0x4b46('0x43')]=[{'all':!![]}];}_0x260759=_[_0x4b46('0x3f')]({},_0x260759,_0xc31ca5[_0x4b46('0x41')]);return db[_0x4b46('0x2d')][_0x4b46('0x4a')](_0x260759)['then'](handleEntityNotFound(_0x2373fa,null))[_0x4b46('0x25')](respondWithResult(_0x2373fa,null))[_0x4b46('0x46')](handleError(_0x2373fa,null));};exports[_0x4b46('0x4b')]=function(_0x1f100b,_0x51a617){return db[_0x4b46('0x2d')][_0x4b46('0x4b')](_0x1f100b[_0x4b46('0x4c')],{})[_0x4b46('0x25')](respondWithResult(_0x51a617,0xc9))[_0x4b46('0x46')](handleError(_0x51a617,null));};exports[_0x4b46('0x24')]=function(_0x2989e2,_0x162828){if(_0x2989e2[_0x4b46('0x4c')]['id']){delete _0x2989e2[_0x4b46('0x4c')]['id'];}return db[_0x4b46('0x2d')][_0x4b46('0x4a')]({'where':{'id':_0x2989e2[_0x4b46('0x48')]['id']}})[_0x4b46('0x25')](handleEntityNotFound(_0x162828,null))[_0x4b46('0x25')](saveUpdates(_0x2989e2['body'],null))['then'](respondWithResult(_0x162828,null))[_0x4b46('0x46')](handleError(_0x162828,null));};exports[_0x4b46('0x26')]=function(_0x323bc6,_0xbb9541){return db[_0x4b46('0x2d')][_0x4b46('0x4a')]({'where':{'id':_0x323bc6['params']['id']}})[_0x4b46('0x25')](handleEntityNotFound(_0xbb9541,null))[_0x4b46('0x25')](removeEntity(_0xbb9541,null))[_0x4b46('0x46')](handleError(_0xbb9541,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 1f2165e..3108150 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 _0xdfd1=['../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x40f4d3,_0x2c163c){var _0x342be1=function(_0x26c186){while(--_0x26c186){_0x40f4d3['push'](_0x40f4d3['shift']());}};_0x342be1(++_0x2c163c);}(_0xdfd1,0x1e4));var _0x1dfd=function(_0x2dbc43,_0x1b9116){_0x2dbc43=_0x2dbc43-0x0;var _0x4f9ab1=_0xdfd1[_0x2dbc43];return _0x4f9ab1;};'use strict';var _=require('lodash');var util=require(_0x1dfd('0x0'));var logger=require(_0x1dfd('0x1'))(_0x1dfd('0x2'));var moment=require(_0x1dfd('0x3'));var BPromise=require(_0x1dfd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1dfd('0x5'));var config=require(_0x1dfd('0x6'));var attributes=require(_0x1dfd('0x7'));module[_0x1dfd('0x8')]=function(_0x5a80da,_0x5523cf){return _0x5a80da[_0x1dfd('0x9')](_0x1dfd('0xa'),attributes,{'tableName':_0x1dfd('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1dfd('0xc'),_0x1dfd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x899c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField'];(function(_0x1994f1,_0x2a8b7e){var _0x37cece=function(_0x5ae0ed){while(--_0x5ae0ed){_0x1994f1['push'](_0x1994f1['shift']());}};_0x37cece(++_0x2a8b7e);}(_0x899c,0xe4));var _0xc899=function(_0x28c7a7,_0x55a356){_0x28c7a7=_0x28c7a7-0x0;var _0x50610f=_0x899c[_0x28c7a7];return _0x50610f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc899('0x0'));var moment=require(_0xc899('0x1'));var BPromise=require(_0xc899('0x2'));var rp=require(_0xc899('0x3'));var fs=require('fs');var path=require(_0xc899('0x4'));var rimraf=require(_0xc899('0x5'));var config=require(_0xc899('0x6'));var attributes=require(_0xc899('0x7'));module[_0xc899('0x8')]=function(_0x3235be,_0x103cbf){return _0x3235be[_0xc899('0x9')]('ServicenowField',attributes,{'tableName':_0xc899('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xc899('0xb'),'FieldId'],'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 387c89b..9bc1aa7 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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x112c4c,_0x460cab){var _0x43b3cd=function(_0x2a1783){while(--_0x2a1783){_0x112c4c['push'](_0x112c4c['shift']());}};_0x43b3cd(++_0x460cab);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x57e45e,_0xeaa38){_0x57e45e=_0x57e45e-0x0;var _0x4c6754=_0x9ffd[_0x57e45e];return _0x4c6754;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xac4a,0x13f));var _0xaac4=function(_0x4dac70,_0x500afa){_0x4dac70=_0x4dac70-0x0;var _0x457210=_0xac4a[_0x4dac70];return _0x457210;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 79be40e..852fcf8 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x48b8c8,_0x152f2d){var _0x47d10d=function(_0xa26a22){while(--_0xa26a22){_0x48b8c8['push'](_0x48b8c8['shift']());}};_0x47d10d(++_0x152f2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5caa45,_0x1ee715){var _0xd15322=function(_0x4aa4ac){while(--_0x4aa4ac){_0x5caa45['push'](_0x5caa45['shift']());}};_0xd15322(++_0x1ee715);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 a0cb5df..0fd451f 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(_0x2961f0,_0x16acaf){var _0x52d23a=function(_0x144513){while(--_0x144513){_0x2961f0['push'](_0x2961f0['shift']());}};_0x52d23a(++_0x16acaf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x1aabd0,_0x483cf0){var _0x37063f=function(_0x909e77){while(--_0x909e77){_0x1aabd0['push'](_0x1aabd0['shift']());}};_0x37063f(++_0x483cf0);}(_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')]={'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 c87b6bb..2ee6f8c 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 _0xe8d3=['findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmConfiguration','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','direction','username','password','remoteUri','slice','substring','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','POST','get_module_fields','values','module_fields','remove','label','endsWith','value','test','statusCode','error','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','mustache','util','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getConfigurations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe8d3,0x176));var _0x3e8d=function(_0x28a545,_0x41fb37){_0x28a545=_0x28a545-0x0;var _0x488483=_0xe8d3[_0x28a545];return _0x488483;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e8d('0x0'));var zipdir=require(_0x3e8d('0x1'));var jsonpatch=require(_0x3e8d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3e8d('0x3'));var util=require(_0x3e8d('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3e8d('0x5'));var fs=require('fs');var fs_extra=require(_0x3e8d('0x6'));var _=require(_0x3e8d('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3e8d('0x8'));var toCsv=require('to-csv');var querystring=require(_0x3e8d('0x9'));var Papa=require(_0x3e8d('0xa'));var Redis=require('ioredis');var authService=require(_0x3e8d('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x3e8d('0xc'));var hardwareService=require(_0x3e8d('0xd'));var logger=require(_0x3e8d('0xe'))(_0x3e8d('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3e8d('0x10'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x382f0f,_0x4271dd){_0x4271dd=_0x4271dd||0xcc;return function(_0x20b4cb){if(_0x20b4cb){return _0x382f0f[_0x3e8d('0x11')](_0x4271dd);}return _0x382f0f['status'](_0x4271dd)[_0x3e8d('0x12')]();};}function respondWithResult(_0x2c7d8e,_0x5d31c7){_0x5d31c7=_0x5d31c7||0xc8;return function(_0x4d62a3){if(_0x4d62a3){return _0x2c7d8e[_0x3e8d('0x13')](_0x5d31c7)[_0x3e8d('0x14')](_0x4d62a3);}};}function respondWithFilteredResult(_0x158ef8,_0x7b8ac9){return function(_0x575e8d){if(_0x575e8d){var _0x2a467b=typeof _0x7b8ac9[_0x3e8d('0x15')]===_0x3e8d('0x16')&&typeof _0x7b8ac9['limit']==='undefined';var _0x31781d=_0x575e8d[_0x3e8d('0x17')];var _0x23d5ff=_0x2a467b?0x0:_0x7b8ac9[_0x3e8d('0x15')];var _0x336f5c=_0x2a467b?_0x575e8d[_0x3e8d('0x17')]:_0x7b8ac9['offset']+_0x7b8ac9[_0x3e8d('0x18')];var _0x12cbf4;if(_0x336f5c>=_0x31781d){_0x336f5c=_0x31781d;_0x12cbf4=0xc8;}else{_0x12cbf4=0xce;}_0x158ef8['status'](_0x12cbf4);return _0x158ef8[_0x3e8d('0x19')](_0x3e8d('0x1a'),_0x23d5ff+'-'+_0x336f5c+'/'+_0x31781d)[_0x3e8d('0x14')](_0x575e8d);}return null;};}function patchUpdates(_0x1e2dde){return function(_0x2bc0f9){try{jsonpatch[_0x3e8d('0x1b')](_0x2bc0f9,_0x1e2dde,!![]);}catch(_0x26140a){return BPromise[_0x3e8d('0x1c')](_0x26140a);}return _0x2bc0f9[_0x3e8d('0x1d')]();};}function saveUpdates(_0x381117,_0x3caad8){return function(_0x8cd8d7){if(_0x8cd8d7){return _0x8cd8d7[_0x3e8d('0x1e')](_0x381117)[_0x3e8d('0x1f')](function(_0x3d7f9d){return _0x3d7f9d;});}return null;};}function removeEntity(_0x5cf75e,_0x5734c6){return function(_0x2982fd){if(_0x2982fd){return _0x2982fd[_0x3e8d('0x20')]()[_0x3e8d('0x1f')](function(){_0x5cf75e[_0x3e8d('0x13')](0xcc)[_0x3e8d('0x12')]();});}};}function handleEntityNotFound(_0x189ca5,_0xfd539b){return function(_0x34ce65){if(!_0x34ce65){_0x189ca5[_0x3e8d('0x11')](0x194);}return _0x34ce65;};}function handleError(_0x1d1e3d,_0x1b3e22){_0x1b3e22=_0x1b3e22||0x1f4;return function(_0x22eb7e){logger['error'](_0x22eb7e['stack']);if(_0x22eb7e[_0x3e8d('0x21')]){delete _0x22eb7e[_0x3e8d('0x21')];}_0x1d1e3d[_0x3e8d('0x13')](_0x1b3e22)[_0x3e8d('0x22')](_0x22eb7e);};}exports['index']=function(_0x5398c5,_0x224e97){var _0x595e51={},_0x5909b2={},_0x458366={'count':0x0,'rows':[]};var _0x3e92ce=_['map'](db[_0x3e8d('0x23')][_0x3e8d('0x24')],function(_0x23fc6f){return{'name':_0x23fc6f[_0x3e8d('0x25')],'type':_0x23fc6f[_0x3e8d('0x26')][_0x3e8d('0x27')]};});_0x5909b2[_0x3e8d('0x28')]=_[_0x3e8d('0x29')](_0x3e92ce,_0x3e8d('0x21'));_0x5909b2['query']=_['keys'](_0x5398c5[_0x3e8d('0x2a')]);_0x5909b2['filters']=_[_0x3e8d('0x2b')](_0x5909b2['model'],_0x5909b2[_0x3e8d('0x2a')]);_0x595e51[_0x3e8d('0x2c')]=_[_0x3e8d('0x2b')](_0x5909b2[_0x3e8d('0x28')],qs[_0x3e8d('0x2d')](_0x5398c5[_0x3e8d('0x2a')][_0x3e8d('0x2d')]));_0x595e51['attributes']=_0x595e51[_0x3e8d('0x2c')][_0x3e8d('0x2e')]?_0x595e51[_0x3e8d('0x2c')]:_0x5909b2['model'];if(!_0x5398c5[_0x3e8d('0x2a')][_0x3e8d('0x2f')]('nolimit')){_0x595e51['limit']=qs[_0x3e8d('0x18')](_0x5398c5['query'][_0x3e8d('0x18')]);_0x595e51[_0x3e8d('0x15')]=qs[_0x3e8d('0x15')](_0x5398c5[_0x3e8d('0x2a')][_0x3e8d('0x15')]);}_0x595e51['order']=qs[_0x3e8d('0x30')](_0x5398c5[_0x3e8d('0x2a')][_0x3e8d('0x30')]);_0x595e51[_0x3e8d('0x31')]=qs[_0x3e8d('0x32')](_['pick'](_0x5398c5[_0x3e8d('0x2a')],_0x5909b2[_0x3e8d('0x32')]),_0x3e92ce);if(_0x5398c5[_0x3e8d('0x2a')][_0x3e8d('0x33')]){_0x595e51['where']=_[_0x3e8d('0x34')](_0x595e51[_0x3e8d('0x31')],{'$or':_[_0x3e8d('0x29')](_0x3e92ce,function(_0x5b1be7){if(_0x5b1be7[_0x3e8d('0x26')]!=='VIRTUAL'){var _0x3f8f5b={};_0x3f8f5b[_0x5b1be7[_0x3e8d('0x21')]]={'$like':'%'+_0x5398c5[_0x3e8d('0x2a')]['filter']+'%'};return _0x3f8f5b;}})});}_0x595e51=_['merge']({},_0x595e51,_0x5398c5[_0x3e8d('0x35')]);var _0x15ae23={'where':_0x595e51[_0x3e8d('0x31')]};return db[_0x3e8d('0x23')][_0x3e8d('0x17')](_0x15ae23)[_0x3e8d('0x1f')](function(_0x4f72e3){_0x458366[_0x3e8d('0x17')]=_0x4f72e3;if(_0x5398c5[_0x3e8d('0x2a')][_0x3e8d('0x36')]){_0x595e51[_0x3e8d('0x37')]=[{'all':!![]}];}return db[_0x3e8d('0x23')][_0x3e8d('0x38')](_0x595e51);})['then'](function(_0x67b539){_0x458366[_0x3e8d('0x39')]=_0x67b539;return _0x458366;})[_0x3e8d('0x1f')](respondWithFilteredResult(_0x224e97,_0x595e51))['catch'](handleError(_0x224e97,null));};exports[_0x3e8d('0x3a')]=function(_0x2294fd,_0x5e223e){var _0x5723d7={'raw':![],'where':{'id':_0x2294fd[_0x3e8d('0x3b')]['id']}},_0x259c34={};_0x259c34[_0x3e8d('0x28')]=_['keys'](db[_0x3e8d('0x23')][_0x3e8d('0x24')]);_0x259c34[_0x3e8d('0x2a')]=_[_0x3e8d('0x3c')](_0x2294fd[_0x3e8d('0x2a')]);_0x259c34[_0x3e8d('0x32')]=_[_0x3e8d('0x2b')](_0x259c34[_0x3e8d('0x28')],_0x259c34[_0x3e8d('0x2a')]);_0x5723d7['attributes']=_[_0x3e8d('0x2b')](_0x259c34[_0x3e8d('0x28')],qs[_0x3e8d('0x2d')](_0x2294fd[_0x3e8d('0x2a')][_0x3e8d('0x2d')]));_0x5723d7[_0x3e8d('0x2c')]=_0x5723d7[_0x3e8d('0x2c')][_0x3e8d('0x2e')]?_0x5723d7['attributes']:_0x259c34[_0x3e8d('0x28')];if(_0x2294fd[_0x3e8d('0x2a')][_0x3e8d('0x36')]){_0x5723d7[_0x3e8d('0x37')]=[{'all':!![]}];}_0x5723d7=_['merge']({},_0x5723d7,_0x2294fd[_0x3e8d('0x35')]);return db[_0x3e8d('0x23')][_0x3e8d('0x3d')](_0x5723d7)[_0x3e8d('0x1f')](handleEntityNotFound(_0x5e223e,null))[_0x3e8d('0x1f')](respondWithResult(_0x5e223e,null))[_0x3e8d('0x3e')](handleError(_0x5e223e,null));};exports['create']=function(_0x15fc1,_0x583e25){return db[_0x3e8d('0x23')][_0x3e8d('0x3f')](_0x15fc1[_0x3e8d('0x40')],{})[_0x3e8d('0x1f')](respondWithResult(_0x583e25,0xc9))[_0x3e8d('0x3e')](handleError(_0x583e25,null));};exports[_0x3e8d('0x1e')]=function(_0x20c9f4,_0x4d8ceb){if(_0x20c9f4[_0x3e8d('0x40')]['id']){delete _0x20c9f4[_0x3e8d('0x40')]['id'];}return db['SugarcrmAccount'][_0x3e8d('0x3d')]({'where':{'id':_0x20c9f4[_0x3e8d('0x3b')]['id']}})[_0x3e8d('0x1f')](handleEntityNotFound(_0x4d8ceb,null))[_0x3e8d('0x1f')](saveUpdates(_0x20c9f4[_0x3e8d('0x40')],null))[_0x3e8d('0x1f')](respondWithResult(_0x4d8ceb,null))[_0x3e8d('0x3e')](handleError(_0x4d8ceb,null));};exports[_0x3e8d('0x20')]=function(_0xb26b0d,_0x9ecf9){return db[_0x3e8d('0x23')]['find']({'where':{'id':_0xb26b0d[_0x3e8d('0x3b')]['id']}})[_0x3e8d('0x1f')](handleEntityNotFound(_0x9ecf9,null))['then'](removeEntity(_0x9ecf9,null))[_0x3e8d('0x3e')](handleError(_0x9ecf9,null));};exports[_0x3e8d('0x41')]=function(_0x326ec5,_0x403e65,_0x560539){var _0x2ce636={};var _0x21576f={};var _0x97e5e7;var _0x33b774;return db[_0x3e8d('0x23')][_0x3e8d('0x42')]({'where':{'id':_0x326ec5['params']['id']}})['then'](handleEntityNotFound(_0x403e65,null))['then'](function(_0x236423){if(_0x236423){_0x97e5e7=_0x236423;_0x21576f['model']=_[_0x3e8d('0x3c')](db['SugarcrmConfiguration'][_0x3e8d('0x24')]);_0x21576f[_0x3e8d('0x2a')]=_[_0x3e8d('0x3c')](_0x326ec5[_0x3e8d('0x2a')]);_0x21576f[_0x3e8d('0x32')]=_[_0x3e8d('0x2b')](_0x21576f[_0x3e8d('0x28')],_0x21576f[_0x3e8d('0x2a')]);_0x2ce636[_0x3e8d('0x2c')]=_[_0x3e8d('0x2b')](_0x21576f['model'],qs[_0x3e8d('0x2d')](_0x326ec5[_0x3e8d('0x2a')][_0x3e8d('0x2d')]));_0x2ce636[_0x3e8d('0x2c')]=_0x2ce636[_0x3e8d('0x2c')]['length']?_0x2ce636['attributes']:_0x21576f[_0x3e8d('0x28')];_0x2ce636['order']=qs['sort'](_0x326ec5['query'][_0x3e8d('0x30')]);_0x2ce636[_0x3e8d('0x31')]=qs[_0x3e8d('0x32')](_['pick'](_0x326ec5[_0x3e8d('0x2a')],_0x21576f[_0x3e8d('0x32')]));if(_0x326ec5[_0x3e8d('0x2a')][_0x3e8d('0x33')]){_0x2ce636[_0x3e8d('0x31')]=_['merge'](_0x2ce636[_0x3e8d('0x31')],{'$or':_[_0x3e8d('0x29')](_0x2ce636['attributes'],function(_0x17d817){var _0x3e6ca4={};_0x3e6ca4[_0x17d817]={'$like':'%'+_0x326ec5[_0x3e8d('0x2a')][_0x3e8d('0x33')]+'%'};return _0x3e6ca4;})});}_0x2ce636=_['merge']({},_0x2ce636,_0x326ec5['options']);return _0x97e5e7[_0x3e8d('0x41')](_0x2ce636);}})[_0x3e8d('0x1f')](function(_0x885616){if(_0x885616){_0x33b774=_0x885616[_0x3e8d('0x2e')];if(!_0x326ec5[_0x3e8d('0x2a')][_0x3e8d('0x2f')](_0x3e8d('0x43'))){_0x2ce636[_0x3e8d('0x18')]=qs[_0x3e8d('0x18')](_0x326ec5[_0x3e8d('0x2a')][_0x3e8d('0x18')]);_0x2ce636[_0x3e8d('0x15')]=qs[_0x3e8d('0x15')](_0x326ec5[_0x3e8d('0x2a')][_0x3e8d('0x15')]);}return _0x97e5e7[_0x3e8d('0x41')](_0x2ce636);}})['then'](function(_0x3eac0f){if(_0x3eac0f){return _0x3eac0f?{'count':_0x33b774,'rows':_0x3eac0f}:null;}})[_0x3e8d('0x1f')](respondWithResult(_0x403e65,null))[_0x3e8d('0x3e')](handleError(_0x403e65,null));};exports[_0x3e8d('0x44')]=function(_0x18139e,_0x4760e1,_0x1ed7b1){if(_0x18139e[_0x3e8d('0x40')]['id']){delete _0x18139e[_0x3e8d('0x40')]['id'];}return db[_0x3e8d('0x23')]['findOne']({'where':{'id':_0x18139e['params']['id']}})[_0x3e8d('0x1f')](handleEntityNotFound(_0x4760e1,null))[_0x3e8d('0x1f')](function(_0x4c6b68){if(_0x4c6b68){_0x18139e[_0x3e8d('0x40')][_0x3e8d('0x45')]=_0x4c6b68['id'];_0x18139e[_0x3e8d('0x40')][_0x3e8d('0x46')]=integrations[_0x3e8d('0x47')](_0x18139e[_0x3e8d('0x40')][_0x3e8d('0x48')],_0x18139e['body'][_0x3e8d('0x26')]);_0x18139e['body']['Descriptions']=integrations[_0x3e8d('0x49')](_0x18139e[_0x3e8d('0x40')][_0x3e8d('0x48')],_0x18139e[_0x3e8d('0x40')][_0x3e8d('0x26')]);return db[_0x3e8d('0x4a')]['create'](_0x18139e[_0x3e8d('0x40')],{'include':[{'model':db['SugarcrmField'],'as':_0x3e8d('0x46')},{'model':db['SugarcrmField'],'as':_0x3e8d('0x4b')}]});}return null;})['then'](respondWithResult(_0x4760e1,null))[_0x3e8d('0x3e')](handleError(_0x4760e1,null));};exports[_0x3e8d('0x4c')]=function(_0x364d61,_0x5cd8a4,_0x434193){var _0x134b20='';var _0x32280e=['id',_0x3e8d('0x21'),_0x3e8d('0x4d'),_0x3e8d('0x4e'),_0x3e8d('0x4f'),_0x3e8d('0x50'),'duration_hours',_0x3e8d('0x51'),_0x3e8d('0x52'),'parent_type','parent_name',_0x3e8d('0x53')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x364d61[_0x3e8d('0x3b')]['id']},'attributes':['id',_0x3e8d('0x54'),_0x3e8d('0x55'),_0x3e8d('0x56')]})[_0x3e8d('0x1f')](handleEntityNotFound(_0x5cd8a4,null))[_0x3e8d('0x1f')](function(_0x487e99){if(_0x487e99){_0x134b20=_0x487e99[_0x3e8d('0x56')];var _0x5bb7b7=_0x134b20[_0x3e8d('0x57')](-0x1);if(_0x5bb7b7==='/'){_0x134b20=_0x134b20[_0x3e8d('0x58')](0x0,_0x134b20['lastIndexOf'](_0x5bb7b7));}return rp({'method':'POST','uri':util[_0x3e8d('0x59')](_0x3e8d('0x5a'),_0x134b20,_0x3e8d('0x5b')),'json':!![],'form':{'method':_0x3e8d('0x5c'),'input_type':_0x3e8d('0x5d'),'response_type':_0x3e8d('0x5d'),'rest_data':JSON[_0x3e8d('0x5e')]({'user_auth':{'user_name':_0x487e99[_0x3e8d('0x54')],'password':_0x487e99[_0x3e8d('0x55')],'encryption':_0x3e8d('0x5f')},'application':_0x3e8d('0x60')})}});}})[_0x3e8d('0x1f')](function(_0x43e59c){if(_0x43e59c&&_0x43e59c[_0x3e8d('0x21')]!=='Invalid\x20Login'&&_0x43e59c[_0x3e8d('0x21')]!==_0x3e8d('0x61')){return rp({'method':_0x3e8d('0x62'),'uri':util[_0x3e8d('0x59')](_0x3e8d('0x5a'),_0x134b20,_0x3e8d('0x5b')),'json':!![],'form':{'method':_0x3e8d('0x63'),'input_type':_0x3e8d('0x5d'),'response_type':'JSON','rest_data':JSON[_0x3e8d('0x5e')]({'session':_0x43e59c['id'],'module_name':'Calls'})}})[_0x3e8d('0x1f')](function(_0x2eac2f){if(_0x2eac2f){var _0x13a648=_[_0x3e8d('0x64')](_0x2eac2f[_0x3e8d('0x65')]);_[_0x3e8d('0x66')](_0x13a648,function(_0x47d08e){return _0x32280e['includes'](_0x47d08e[_0x3e8d('0x21')]);});return{'count':_0x13a648['length'],'rows':_[_0x3e8d('0x29')](_0x13a648,function(_0x3aa006){return{'id':_0x3aa006[_0x3e8d('0x21')],'name':_0x3aa006[_0x3e8d('0x67')],'custom':_[_0x3e8d('0x68')](_0x3aa006[_0x3e8d('0x21')],'_c')?!![]:![],'options':_0x3aa006[_0x3e8d('0x35')]?_[_0x3e8d('0x29')](_[_0x3e8d('0x64')](_0x3aa006[_0x3e8d('0x35')]),function(_0x31a2d5){return{'name':_0x31a2d5[_0x3e8d('0x69')],'value':_0x31a2d5[_0x3e8d('0x21')]};}):[]};})};}})['then'](respondWithResult(_0x5cd8a4,null))[_0x3e8d('0x3e')](function(_0x5ed7b9){var _0x59ad66=_0x364d61[_0x3e8d('0x2a')][_0x3e8d('0x6a')]?0x1f4:_0x5ed7b9[_0x3e8d('0x6b')]||0x1f4;logger[_0x3e8d('0x6c')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x59ad66,JSON[_0x3e8d('0x5e')](_0x5ed7b9));delete _0x5ed7b9[_0x3e8d('0x21')];if(_0x59ad66===0x191){_0x59ad66=0x190;}_0x5cd8a4[_0x3e8d('0x13')](_0x59ad66)[_0x3e8d('0x22')](_0x364d61[_0x3e8d('0x2a')][_0x3e8d('0x6a')]?{'message':_0x3e8d('0x6d'),'statusCode':_0x5ed7b9['statusCode']}:_0x5ed7b9);});}else{var _0x1483bf=0x1f4;_0x5cd8a4[_0x3e8d('0x13')](_0x1483bf)[_0x3e8d('0x22')]({'message':_0x3e8d('0x6d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x195e=['Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','endsWith','value','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','SugarcrmAccount','include','findAll','rows','params','keys','length','options','create','body','catch','find','findOne','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','substring','lastIndexOf','format','%s%s','JSON','stringify','username','password','PLAIN','xCALLY\x20Motion\x20Integration'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x195e,0x1db));var _0xe195=function(_0x5113e0,_0x56cb81){_0x5113e0=_0x5113e0-0x0;var _0x9551e5=_0x195e[_0x5113e0];return _0x9551e5;};'use strict';var emlformat=require(_0xe195('0x0'));var rimraf=require(_0xe195('0x1'));var zipdir=require(_0xe195('0x2'));var jsonpatch=require(_0xe195('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe195('0x4'));var util=require(_0xe195('0x5'));var path=require('path');var sox=require(_0xe195('0x6'));var csv=require(_0xe195('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe195('0x8'));var squel=require(_0xe195('0x9'));var crypto=require(_0xe195('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe195('0xb'));var toCsv=require(_0xe195('0x7'));var querystring=require(_0xe195('0xc'));var Papa=require(_0xe195('0xd'));var Redis=require('ioredis');var authService=require(_0xe195('0xe'));var qs=require(_0xe195('0xf'));var as=require(_0xe195('0x10'));var hardwareService=require(_0xe195('0x11'));var logger=require(_0xe195('0x12'))('api');var utils=require(_0xe195('0x13'));var config=require(_0xe195('0x14'));var licenseUtil=require(_0xe195('0x15'));var db=require(_0xe195('0x16'))['db'];var integrations=require(_0xe195('0x17'));function respondWithStatusCode(_0x1176b1,_0x1e3f8e){_0x1e3f8e=_0x1e3f8e||0xcc;return function(_0xcc7510){if(_0xcc7510){return _0x1176b1[_0xe195('0x18')](_0x1e3f8e);}return _0x1176b1[_0xe195('0x19')](_0x1e3f8e)[_0xe195('0x1a')]();};}function respondWithResult(_0x1d530d,_0x3d3f50){_0x3d3f50=_0x3d3f50||0xc8;return function(_0x132421){if(_0x132421){return _0x1d530d[_0xe195('0x19')](_0x3d3f50)['json'](_0x132421);}};}function respondWithFilteredResult(_0x2a9efe,_0x5d261b){return function(_0x458a4c){if(_0x458a4c){var _0x5c0909=typeof _0x5d261b[_0xe195('0x1b')]===_0xe195('0x1c')&&typeof _0x5d261b[_0xe195('0x1d')]===_0xe195('0x1c');var _0x3c3bac=_0x458a4c[_0xe195('0x1e')];var _0x3137bb=_0x5c0909?0x0:_0x5d261b[_0xe195('0x1b')];var _0x1d9b35=_0x5c0909?_0x458a4c['count']:_0x5d261b[_0xe195('0x1b')]+_0x5d261b['limit'];var _0x2c3ecb;if(_0x1d9b35>=_0x3c3bac){_0x1d9b35=_0x3c3bac;_0x2c3ecb=0xc8;}else{_0x2c3ecb=0xce;}_0x2a9efe[_0xe195('0x19')](_0x2c3ecb);return _0x2a9efe[_0xe195('0x1f')]('Content-Range',_0x3137bb+'-'+_0x1d9b35+'/'+_0x3c3bac)['json'](_0x458a4c);}return null;};}function patchUpdates(_0x359107){return function(_0x17e220){try{jsonpatch[_0xe195('0x20')](_0x17e220,_0x359107,!![]);}catch(_0x5d819e){return BPromise[_0xe195('0x21')](_0x5d819e);}return _0x17e220[_0xe195('0x22')]();};}function saveUpdates(_0x504f9e,_0x1dd88f){return function(_0x536bbe){if(_0x536bbe){return _0x536bbe[_0xe195('0x23')](_0x504f9e)[_0xe195('0x24')](function(_0x292bce){return _0x292bce;});}return null;};}function removeEntity(_0x1aa72b,_0x56ba2c){return function(_0x53247f){if(_0x53247f){return _0x53247f[_0xe195('0x25')]()[_0xe195('0x24')](function(){_0x1aa72b[_0xe195('0x19')](0xcc)[_0xe195('0x1a')]();});}};}function handleEntityNotFound(_0x7150c6,_0x452543){return function(_0x40070a){if(!_0x40070a){_0x7150c6[_0xe195('0x18')](0x194);}return _0x40070a;};}function handleError(_0xf180a1,_0x466585){_0x466585=_0x466585||0x1f4;return function(_0xd0e8c0){logger['error'](_0xd0e8c0['stack']);if(_0xd0e8c0[_0xe195('0x26')]){delete _0xd0e8c0['name'];}_0xf180a1['status'](_0x466585)['send'](_0xd0e8c0);};}exports[_0xe195('0x27')]=function(_0x59de1,_0x26fb6d){var _0x17c3f0={},_0x18601d={},_0x1a6f11={'count':0x0,'rows':[]};var _0x38399c=_[_0xe195('0x28')](db['SugarcrmAccount'][_0xe195('0x29')],function(_0x2f91b6){return{'name':_0x2f91b6[_0xe195('0x2a')],'type':_0x2f91b6[_0xe195('0x2b')][_0xe195('0x2c')]};});_0x18601d[_0xe195('0x2d')]=_[_0xe195('0x28')](_0x38399c,_0xe195('0x26'));_0x18601d[_0xe195('0x2e')]=_['keys'](_0x59de1[_0xe195('0x2e')]);_0x18601d[_0xe195('0x2f')]=_[_0xe195('0x30')](_0x18601d[_0xe195('0x2d')],_0x18601d[_0xe195('0x2e')]);_0x17c3f0[_0xe195('0x31')]=_['intersection'](_0x18601d[_0xe195('0x2d')],qs[_0xe195('0x32')](_0x59de1[_0xe195('0x2e')][_0xe195('0x32')]));_0x17c3f0[_0xe195('0x31')]=_0x17c3f0['attributes']['length']?_0x17c3f0[_0xe195('0x31')]:_0x18601d[_0xe195('0x2d')];if(!_0x59de1[_0xe195('0x2e')][_0xe195('0x33')](_0xe195('0x34'))){_0x17c3f0[_0xe195('0x1d')]=qs['limit'](_0x59de1[_0xe195('0x2e')][_0xe195('0x1d')]);_0x17c3f0[_0xe195('0x1b')]=qs[_0xe195('0x1b')](_0x59de1['query']['offset']);}_0x17c3f0[_0xe195('0x35')]=qs[_0xe195('0x36')](_0x59de1[_0xe195('0x2e')][_0xe195('0x36')]);_0x17c3f0[_0xe195('0x37')]=qs[_0xe195('0x2f')](_[_0xe195('0x38')](_0x59de1['query'],_0x18601d['filters']),_0x38399c);if(_0x59de1[_0xe195('0x2e')]['filter']){_0x17c3f0[_0xe195('0x37')]=_['merge'](_0x17c3f0[_0xe195('0x37')],{'$or':_[_0xe195('0x28')](_0x38399c,function(_0x15a35c){if(_0x15a35c[_0xe195('0x2b')]!==_0xe195('0x39')){var _0x431a17={};_0x431a17[_0x15a35c[_0xe195('0x26')]]={'$like':'%'+_0x59de1['query'][_0xe195('0x3a')]+'%'};return _0x431a17;}})});}_0x17c3f0=_[_0xe195('0x3b')]({},_0x17c3f0,_0x59de1['options']);var _0x5d9929={'where':_0x17c3f0[_0xe195('0x37')]};return db[_0xe195('0x3c')][_0xe195('0x1e')](_0x5d9929)['then'](function(_0x2ba034){_0x1a6f11['count']=_0x2ba034;if(_0x59de1['query']['includeAll']){_0x17c3f0[_0xe195('0x3d')]=[{'all':!![]}];}return db[_0xe195('0x3c')][_0xe195('0x3e')](_0x17c3f0);})[_0xe195('0x24')](function(_0x5b68ea){_0x1a6f11[_0xe195('0x3f')]=_0x5b68ea;return _0x1a6f11;})[_0xe195('0x24')](respondWithFilteredResult(_0x26fb6d,_0x17c3f0))['catch'](handleError(_0x26fb6d,null));};exports['show']=function(_0x10ffef,_0x5d7087){var _0x2c43a6={'raw':![],'where':{'id':_0x10ffef[_0xe195('0x40')]['id']}},_0x4a9635={};_0x4a9635['model']=_['keys'](db[_0xe195('0x3c')]['rawAttributes']);_0x4a9635['query']=_[_0xe195('0x41')](_0x10ffef[_0xe195('0x2e')]);_0x4a9635[_0xe195('0x2f')]=_[_0xe195('0x30')](_0x4a9635[_0xe195('0x2d')],_0x4a9635[_0xe195('0x2e')]);_0x2c43a6[_0xe195('0x31')]=_[_0xe195('0x30')](_0x4a9635[_0xe195('0x2d')],qs[_0xe195('0x32')](_0x10ffef['query']['fields']));_0x2c43a6[_0xe195('0x31')]=_0x2c43a6[_0xe195('0x31')][_0xe195('0x42')]?_0x2c43a6[_0xe195('0x31')]:_0x4a9635['model'];if(_0x10ffef['query']['includeAll']){_0x2c43a6[_0xe195('0x3d')]=[{'all':!![]}];}_0x2c43a6=_['merge']({},_0x2c43a6,_0x10ffef[_0xe195('0x43')]);return db['SugarcrmAccount']['find'](_0x2c43a6)[_0xe195('0x24')](handleEntityNotFound(_0x5d7087,null))[_0xe195('0x24')](respondWithResult(_0x5d7087,null))['catch'](handleError(_0x5d7087,null));};exports['create']=function(_0x56b534,_0x37d339){return db[_0xe195('0x3c')][_0xe195('0x44')](_0x56b534[_0xe195('0x45')],{})[_0xe195('0x24')](respondWithResult(_0x37d339,0xc9))[_0xe195('0x46')](handleError(_0x37d339,null));};exports[_0xe195('0x23')]=function(_0x5a8ffd,_0x1ab991){if(_0x5a8ffd['body']['id']){delete _0x5a8ffd['body']['id'];}return db[_0xe195('0x3c')][_0xe195('0x47')]({'where':{'id':_0x5a8ffd[_0xe195('0x40')]['id']}})[_0xe195('0x24')](handleEntityNotFound(_0x1ab991,null))['then'](saveUpdates(_0x5a8ffd[_0xe195('0x45')],null))[_0xe195('0x24')](respondWithResult(_0x1ab991,null))[_0xe195('0x46')](handleError(_0x1ab991,null));};exports[_0xe195('0x25')]=function(_0x3e4f86,_0x46aa67){return db[_0xe195('0x3c')]['find']({'where':{'id':_0x3e4f86[_0xe195('0x40')]['id']}})['then'](handleEntityNotFound(_0x46aa67,null))[_0xe195('0x24')](removeEntity(_0x46aa67,null))[_0xe195('0x46')](handleError(_0x46aa67,null));};exports['getConfigurations']=function(_0x4c4c15,_0x33bae5,_0x536bf9){var _0x4d6a02={};var _0x17768d={};var _0x511ffc;var _0x4d7290;return db[_0xe195('0x3c')][_0xe195('0x48')]({'where':{'id':_0x4c4c15[_0xe195('0x40')]['id']}})[_0xe195('0x24')](handleEntityNotFound(_0x33bae5,null))[_0xe195('0x24')](function(_0x4f0103){if(_0x4f0103){_0x511ffc=_0x4f0103;_0x17768d[_0xe195('0x2d')]=_[_0xe195('0x41')](db['SugarcrmConfiguration'][_0xe195('0x29')]);_0x17768d['query']=_[_0xe195('0x41')](_0x4c4c15[_0xe195('0x2e')]);_0x17768d[_0xe195('0x2f')]=_[_0xe195('0x30')](_0x17768d['model'],_0x17768d['query']);_0x4d6a02[_0xe195('0x31')]=_[_0xe195('0x30')](_0x17768d[_0xe195('0x2d')],qs[_0xe195('0x32')](_0x4c4c15[_0xe195('0x2e')][_0xe195('0x32')]));_0x4d6a02[_0xe195('0x31')]=_0x4d6a02[_0xe195('0x31')]['length']?_0x4d6a02[_0xe195('0x31')]:_0x17768d[_0xe195('0x2d')];_0x4d6a02['order']=qs[_0xe195('0x36')](_0x4c4c15['query'][_0xe195('0x36')]);_0x4d6a02[_0xe195('0x37')]=qs[_0xe195('0x2f')](_[_0xe195('0x38')](_0x4c4c15[_0xe195('0x2e')],_0x17768d[_0xe195('0x2f')]));if(_0x4c4c15[_0xe195('0x2e')][_0xe195('0x3a')]){_0x4d6a02['where']=_[_0xe195('0x3b')](_0x4d6a02[_0xe195('0x37')],{'$or':_['map'](_0x4d6a02[_0xe195('0x31')],function(_0x1fef8c){var _0x5167e7={};_0x5167e7[_0x1fef8c]={'$like':'%'+_0x4c4c15[_0xe195('0x2e')]['filter']+'%'};return _0x5167e7;})});}_0x4d6a02=_['merge']({},_0x4d6a02,_0x4c4c15[_0xe195('0x43')]);return _0x511ffc[_0xe195('0x49')](_0x4d6a02);}})[_0xe195('0x24')](function(_0x503bf2){if(_0x503bf2){_0x4d7290=_0x503bf2[_0xe195('0x42')];if(!_0x4c4c15[_0xe195('0x2e')][_0xe195('0x33')](_0xe195('0x34'))){_0x4d6a02['limit']=qs[_0xe195('0x1d')](_0x4c4c15[_0xe195('0x2e')][_0xe195('0x1d')]);_0x4d6a02['offset']=qs[_0xe195('0x1b')](_0x4c4c15[_0xe195('0x2e')][_0xe195('0x1b')]);}return _0x511ffc[_0xe195('0x49')](_0x4d6a02);}})[_0xe195('0x24')](function(_0x221af2){if(_0x221af2){return _0x221af2?{'count':_0x4d7290,'rows':_0x221af2}:null;}})[_0xe195('0x24')](respondWithResult(_0x33bae5,null))[_0xe195('0x46')](handleError(_0x33bae5,null));};exports['addConfiguration']=function(_0x4d239a,_0x91cb50,_0x4b7141){if(_0x4d239a[_0xe195('0x45')]['id']){delete _0x4d239a['body']['id'];}return db[_0xe195('0x3c')][_0xe195('0x48')]({'where':{'id':_0x4d239a[_0xe195('0x40')]['id']}})[_0xe195('0x24')](handleEntityNotFound(_0x91cb50,null))[_0xe195('0x24')](function(_0x4d9879){if(_0x4d9879){_0x4d239a[_0xe195('0x45')][_0xe195('0x4a')]=_0x4d9879['id'];_0x4d239a[_0xe195('0x45')][_0xe195('0x4b')]=integrations[_0xe195('0x4c')](_0x4d239a['body'][_0xe195('0x4d')],_0x4d239a[_0xe195('0x45')][_0xe195('0x2b')]);_0x4d239a['body'][_0xe195('0x4e')]=integrations[_0xe195('0x4f')](_0x4d239a[_0xe195('0x45')][_0xe195('0x4d')],_0x4d239a['body']['type']);return db[_0xe195('0x50')][_0xe195('0x44')](_0x4d239a[_0xe195('0x45')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0xe195('0x51')],'as':_0xe195('0x4e')}]});}return null;})[_0xe195('0x24')](respondWithResult(_0x91cb50,null))[_0xe195('0x46')](handleError(_0x91cb50,null));};exports['getFields']=function(_0x398193,_0x68c045,_0x51b364){var _0x43b0b1='';var _0x416a8c=['id','name',_0xe195('0x52'),'created_by',_0xe195('0x53'),_0xe195('0x54'),_0xe195('0x55'),_0xe195('0x56'),_0xe195('0x57'),'parent_type',_0xe195('0x58'),_0xe195('0x59')];return db[_0xe195('0x3c')][_0xe195('0x48')]({'where':{'id':_0x398193[_0xe195('0x40')]['id']},'attributes':['id','username','password','remoteUri']})['then'](handleEntityNotFound(_0x68c045,null))[_0xe195('0x24')](function(_0x4ece66){if(_0x4ece66){_0x43b0b1=_0x4ece66['remoteUri'];var _0x2d018a=_0x43b0b1['slice'](-0x1);if(_0x2d018a==='/'){_0x43b0b1=_0x43b0b1[_0xe195('0x5a')](0x0,_0x43b0b1[_0xe195('0x5b')](_0x2d018a));}return rp({'method':'POST','uri':util[_0xe195('0x5c')](_0xe195('0x5d'),_0x43b0b1,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xe195('0x5e'),'rest_data':JSON[_0xe195('0x5f')]({'user_auth':{'user_name':_0x4ece66[_0xe195('0x60')],'password':_0x4ece66[_0xe195('0x61')],'encryption':_0xe195('0x62')},'application':_0xe195('0x63')})}});}})['then'](function(_0x13b97c){if(_0x13b97c&&_0x13b97c[_0xe195('0x26')]!==_0xe195('0x64')&&_0x13b97c[_0xe195('0x26')]!==_0xe195('0x65')){return rp({'method':'POST','uri':util[_0xe195('0x5c')](_0xe195('0x5d'),_0x43b0b1,_0xe195('0x66')),'json':!![],'form':{'method':_0xe195('0x67'),'input_type':_0xe195('0x5e'),'response_type':_0xe195('0x5e'),'rest_data':JSON[_0xe195('0x5f')]({'session':_0x13b97c['id'],'module_name':_0xe195('0x68')})}})[_0xe195('0x24')](function(_0xbb6fdc){if(_0xbb6fdc){var _0x2390a8=_[_0xe195('0x69')](_0xbb6fdc[_0xe195('0x6a')]);_['remove'](_0x2390a8,function(_0x1cbbf1){return _0x416a8c['includes'](_0x1cbbf1['name']);});return{'count':_0x2390a8[_0xe195('0x42')],'rows':_['map'](_0x2390a8,function(_0x57edb5){return{'id':_0x57edb5['name'],'name':_0x57edb5['label'],'custom':_[_0xe195('0x6b')](_0x57edb5[_0xe195('0x26')],'_c')?!![]:![],'options':_0x57edb5[_0xe195('0x43')]?_[_0xe195('0x28')](_['values'](_0x57edb5['options']),function(_0x34d422){return{'name':_0x34d422[_0xe195('0x6c')],'value':_0x34d422[_0xe195('0x26')]};}):[]};})};}})[_0xe195('0x24')](respondWithResult(_0x68c045,null))['catch'](function(_0x2a8a8b){var _0x1e3f33=_0x398193[_0xe195('0x2e')]['test']?0x1f4:_0x2a8a8b['statusCode']||0x1f4;logger['error'](_0xe195('0x6d'),_0xe195('0x6e'),_0x1e3f33,JSON[_0xe195('0x5f')](_0x2a8a8b));delete _0x2a8a8b[_0xe195('0x26')];if(_0x1e3f33===0x191){_0x1e3f33=0x190;}_0x68c045[_0xe195('0x19')](_0x1e3f33)[_0xe195('0x6f')](_0x398193[_0xe195('0x2e')][_0xe195('0x70')]?{'message':_0xe195('0x71'),'statusCode':_0x2a8a8b[_0xe195('0x72')]}:_0x2a8a8b);});}else{var _0xbe61d9=0x1f4;_0x68c045[_0xe195('0x19')](_0xbe61d9)[_0xe195('0x6f')]({'message':_0xe195('0x71'),'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 e867b38..64df89b 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 _0x0ab9=['define','int_sugarcrm_accounts','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x358e20,_0x500e27){var _0x398976=function(_0x58d99d){while(--_0x58d99d){_0x358e20['push'](_0x358e20['shift']());}};_0x398976(++_0x500e27);}(_0x0ab9,0x157));var _0x90ab=function(_0x5e9c7f,_0x4ab254){_0x5e9c7f=_0x5e9c7f-0x0;var _0x582366=_0x0ab9[_0x5e9c7f];return _0x582366;};'use strict';var _=require(_0x90ab('0x0'));var util=require('util');var logger=require(_0x90ab('0x1'))('api');var moment=require('moment');var BPromise=require(_0x90ab('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90ab('0x3'));var rimraf=require(_0x90ab('0x4'));var config=require(_0x90ab('0x5'));var attributes=require(_0x90ab('0x6'));var integrations=require(_0x90ab('0x7'));module[_0x90ab('0x8')]=function(_0x1b7760,_0x3594af){return _0x1b7760[_0x90ab('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x90ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4171=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','../../config/logger','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4171,0xcf));var _0x1417=function(_0x68f811,_0x3cb9e6){_0x68f811=_0x68f811-0x0;var _0x43f7c2=_0x4171[_0x68f811];return _0x43f7c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1417('0x0'))('api');var moment=require(_0x1417('0x1'));var BPromise=require(_0x1417('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1417('0x3'));var rimraf=require(_0x1417('0x4'));var config=require(_0x1417('0x5'));var attributes=require(_0x1417('0x6'));var integrations=require(_0x1417('0x7'));module['exports']=function(_0x48e296,_0x130817){return _0x48e296[_0x1417('0x8')](_0x1417('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','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 2f25713..4627c34 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 _0xe809=['then','SugarcrmAccount,\x20%s,\x20%s','debug','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','info','stringify','ShowSugarcrmAccount','find','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','request'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xe809,0x1a9));var _0x9e80=function(_0xcc2978,_0x4eeb93){_0xcc2978=_0xcc2978-0x0;var _0x46746c=_0xe809[_0xcc2978];return _0x46746c;};'use strict';var _=require(_0x9e80('0x0'));var util=require(_0x9e80('0x1'));var moment=require('moment');var BPromise=require(_0x9e80('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e80('0x3'))['db'];var utils=require(_0x9e80('0x4'));var logger=require(_0x9e80('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9e80('0x6')][_0x9e80('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x676a4b,_0x152b31,_0x483edf){return new BPromise(function(_0x1756d6,_0x3f60e6){return client[_0x9e80('0x8')](_0x676a4b,_0x483edf)[_0x9e80('0x9')](function(_0x4661dd){logger['info'](_0x9e80('0xa'),_0x152b31,'request\x20sent');logger[_0x9e80('0xb')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x152b31,'request\x20sent',JSON['stringify'](_0x4661dd));if(_0x4661dd['error']){if(_0x4661dd[_0x9e80('0xc')][_0x9e80('0xd')]===0x1f4){logger[_0x9e80('0xc')](_0x9e80('0xa'),_0x152b31,_0x4661dd[_0x9e80('0xc')]['message']);return _0x3f60e6(_0x4661dd['error'][_0x9e80('0xe')]);}logger[_0x9e80('0xc')](_0x9e80('0xa'),_0x152b31,_0x4661dd[_0x9e80('0xc')]['message']);return _0x1756d6(_0x4661dd[_0x9e80('0xc')]['message']);}else{logger['info'](_0x9e80('0xa'),_0x152b31,'request\x20sent');_0x1756d6(_0x4661dd['result']['message']);}})[_0x9e80('0xf')](function(_0x2adf9b){logger[_0x9e80('0xc')](_0x9e80('0xa'),_0x152b31,_0x2adf9b);_0x3f60e6(_0x2adf9b);});});}exports[_0x9e80('0x10')]=function(_0x30d4d8){var _0x202e0e=this;return new Promise(function(_0x4e7d43,_0x378579){return db[_0x9e80('0x11')][_0x9e80('0x12')]({'raw':_0x30d4d8[_0x9e80('0x13')]?_0x30d4d8['options'][_0x9e80('0x14')]===undefined?!![]:![]:!![],'where':_0x30d4d8[_0x9e80('0x13')]?_0x30d4d8['options']['where']||null:null,'attributes':_0x30d4d8[_0x9e80('0x13')]?_0x30d4d8[_0x9e80('0x13')][_0x9e80('0x15')]||null:null,'limit':_0x30d4d8[_0x9e80('0x13')]?_0x30d4d8[_0x9e80('0x13')][_0x9e80('0x16')]||null:null,'include':_0x30d4d8[_0x9e80('0x13')]?_0x30d4d8['options'][_0x9e80('0x17')]?_[_0x9e80('0x18')](_0x30d4d8[_0x9e80('0x13')][_0x9e80('0x17')],function(_0x27478a){return{'model':db[_0x27478a['model']],'as':_0x27478a['as'],'attributes':_0x27478a['attributes'],'include':_0x27478a[_0x9e80('0x17')]?_['map'](_0x27478a[_0x9e80('0x17')],function(_0x1cb1d3){return{'model':db[_0x1cb1d3['model']],'as':_0x1cb1d3['as'],'attributes':_0x1cb1d3[_0x9e80('0x15')],'include':_0x1cb1d3['include']?_[_0x9e80('0x18')](_0x1cb1d3[_0x9e80('0x17')],function(_0x484cc7){return{'model':db[_0x484cc7[_0x9e80('0x19')]],'as':_0x484cc7['as'],'attributes':_0x484cc7['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e80('0x9')](function(_0x5d53c2){logger[_0x9e80('0x1a')](_0x9e80('0x10'),_0x30d4d8);logger[_0x9e80('0xb')](_0x9e80('0x10'),_0x30d4d8,JSON[_0x9e80('0x1b')](_0x5d53c2));_0x4e7d43(_0x5d53c2);})[_0x9e80('0xf')](function(_0x3a793d){logger[_0x9e80('0xc')](_0x9e80('0x10'),_0x3a793d[_0x9e80('0xe')],_0x30d4d8);_0x378579(_0x202e0e[_0x9e80('0xc')](0x1f4,_0x3a793d['message']));});});};exports[_0x9e80('0x1c')]=function(_0x17604d){var _0x2df029=this;return new Promise(function(_0x587885,_0x80a4b2){return db['SugarcrmAccount'][_0x9e80('0x1d')]({'raw':_0x17604d['options']?_0x17604d[_0x9e80('0x13')][_0x9e80('0x14')]===undefined?!![]:![]:!![],'where':_0x17604d['options']?_0x17604d[_0x9e80('0x13')][_0x9e80('0x1e')]||null:null,'attributes':_0x17604d[_0x9e80('0x13')]?_0x17604d[_0x9e80('0x13')][_0x9e80('0x15')]||null:null,'include':_0x17604d[_0x9e80('0x13')]?_0x17604d['options']['include']?_[_0x9e80('0x18')](_0x17604d['options'][_0x9e80('0x17')],function(_0x1c8b15){return{'model':db[_0x1c8b15[_0x9e80('0x19')]],'as':_0x1c8b15['as'],'attributes':_0x1c8b15[_0x9e80('0x15')],'include':_0x1c8b15[_0x9e80('0x17')]?_[_0x9e80('0x18')](_0x1c8b15[_0x9e80('0x17')],function(_0x3f275e){return{'model':db[_0x3f275e[_0x9e80('0x19')]],'as':_0x3f275e['as'],'attributes':_0x3f275e['attributes'],'include':_0x3f275e[_0x9e80('0x17')]?_['map'](_0x3f275e['include'],function(_0x5adfad){return{'model':db[_0x5adfad[_0x9e80('0x19')]],'as':_0x5adfad['as'],'attributes':_0x5adfad['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e80('0x9')](function(_0x243025){logger[_0x9e80('0x1a')](_0x9e80('0x1c'),_0x17604d);logger[_0x9e80('0xb')](_0x9e80('0x1c'),_0x17604d,JSON[_0x9e80('0x1b')](_0x243025));_0x587885(_0x243025);})[_0x9e80('0xf')](function(_0x17011f){logger[_0x9e80('0xc')](_0x9e80('0x1c'),_0x17011f[_0x9e80('0xe')],_0x17604d);_0x80a4b2(_0x2df029[_0x9e80('0xc')](0x1f4,_0x17011f[_0x9e80('0xe')]));});});}; \ No newline at end of file +var _0x033a=['http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','map','include','model','ShowSugarcrmAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x41453c,_0x241b3d){var _0x39f9d5=function(_0x28c1a1){while(--_0x28c1a1){_0x41453c['push'](_0x41453c['shift']());}};_0x39f9d5(++_0x241b3d);}(_0x033a,0xd7));var _0xa033=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x033a[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0xa033('0x0'));var util=require(_0xa033('0x1'));var moment=require(_0xa033('0x2'));var BPromise=require(_0xa033('0x3'));var rs=require(_0xa033('0x4'));var fs=require('fs');var Redis=require(_0xa033('0x5'));var db=require(_0xa033('0x6'))['db'];var utils=require(_0xa033('0x7'));var logger=require(_0xa033('0x8'))(_0xa033('0x9'));var config=require(_0xa033('0xa'));var jayson=require(_0xa033('0xb'));var client=jayson[_0xa033('0xc')][_0xa033('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x8cc5c5,_0x1f979a,_0x29cc4e){return new BPromise(function(_0x4876ba,_0x49df3e){return client['request'](_0x8cc5c5,_0x29cc4e)[_0xa033('0xe')](function(_0x3aa5cb){logger['info'](_0xa033('0xf'),_0x1f979a,_0xa033('0x10'));logger[_0xa033('0x11')](_0xa033('0x12'),_0x1f979a,'request\x20sent',JSON[_0xa033('0x13')](_0x3aa5cb));if(_0x3aa5cb[_0xa033('0x14')]){if(_0x3aa5cb[_0xa033('0x14')][_0xa033('0x15')]===0x1f4){logger[_0xa033('0x14')](_0xa033('0xf'),_0x1f979a,_0x3aa5cb[_0xa033('0x14')][_0xa033('0x16')]);return _0x49df3e(_0x3aa5cb['error'][_0xa033('0x16')]);}logger[_0xa033('0x14')](_0xa033('0xf'),_0x1f979a,_0x3aa5cb['error'][_0xa033('0x16')]);return _0x4876ba(_0x3aa5cb[_0xa033('0x14')]['message']);}else{logger[_0xa033('0x17')](_0xa033('0xf'),_0x1f979a,_0xa033('0x10'));_0x4876ba(_0x3aa5cb['result'][_0xa033('0x16')]);}})[_0xa033('0x18')](function(_0x3abc8e){logger[_0xa033('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f979a,_0x3abc8e);_0x49df3e(_0x3abc8e);});});}exports[_0xa033('0x19')]=function(_0x3df52b){var _0x54ac98=this;return new Promise(function(_0x34e018,_0x33b481){return db[_0xa033('0x1a')][_0xa033('0x1b')]({'raw':_0x3df52b[_0xa033('0x1c')]?_0x3df52b[_0xa033('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3df52b['options']?_0x3df52b[_0xa033('0x1c')][_0xa033('0x1d')]||null:null,'attributes':_0x3df52b[_0xa033('0x1c')]?_0x3df52b[_0xa033('0x1c')][_0xa033('0x1e')]||null:null,'limit':_0x3df52b[_0xa033('0x1c')]?_0x3df52b[_0xa033('0x1c')][_0xa033('0x1f')]||null:null,'include':_0x3df52b['options']?_0x3df52b[_0xa033('0x1c')]['include']?_[_0xa033('0x20')](_0x3df52b[_0xa033('0x1c')][_0xa033('0x21')],function(_0x3d88e1){return{'model':db[_0x3d88e1[_0xa033('0x22')]],'as':_0x3d88e1['as'],'attributes':_0x3d88e1[_0xa033('0x1e')],'include':_0x3d88e1[_0xa033('0x21')]?_[_0xa033('0x20')](_0x3d88e1[_0xa033('0x21')],function(_0x3e3dc9){return{'model':db[_0x3e3dc9['model']],'as':_0x3e3dc9['as'],'attributes':_0x3e3dc9[_0xa033('0x1e')],'include':_0x3e3dc9[_0xa033('0x21')]?_[_0xa033('0x20')](_0x3e3dc9[_0xa033('0x21')],function(_0x11d014){return{'model':db[_0x11d014[_0xa033('0x22')]],'as':_0x11d014['as'],'attributes':_0x11d014[_0xa033('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa033('0xe')](function(_0x4d22d7){logger[_0xa033('0x17')](_0xa033('0x19'),_0x3df52b);logger[_0xa033('0x11')](_0xa033('0x19'),_0x3df52b,JSON[_0xa033('0x13')](_0x4d22d7));_0x34e018(_0x4d22d7);})[_0xa033('0x18')](function(_0x12d4e3){logger[_0xa033('0x14')](_0xa033('0x19'),_0x12d4e3['message'],_0x3df52b);_0x33b481(_0x54ac98['error'](0x1f4,_0x12d4e3['message']));});});};exports[_0xa033('0x23')]=function(_0x9dc315){var _0x3e9af9=this;return new Promise(function(_0x3806b4,_0x139870){return db[_0xa033('0x1a')][_0xa033('0x24')]({'raw':_0x9dc315[_0xa033('0x1c')]?_0x9dc315['options'][_0xa033('0x25')]===undefined?!![]:![]:!![],'where':_0x9dc315[_0xa033('0x1c')]?_0x9dc315[_0xa033('0x1c')][_0xa033('0x1d')]||null:null,'attributes':_0x9dc315['options']?_0x9dc315[_0xa033('0x1c')]['attributes']||null:null,'include':_0x9dc315[_0xa033('0x1c')]?_0x9dc315[_0xa033('0x1c')][_0xa033('0x21')]?_['map'](_0x9dc315[_0xa033('0x1c')][_0xa033('0x21')],function(_0x1e5173){return{'model':db[_0x1e5173[_0xa033('0x22')]],'as':_0x1e5173['as'],'attributes':_0x1e5173['attributes'],'include':_0x1e5173[_0xa033('0x21')]?_[_0xa033('0x20')](_0x1e5173[_0xa033('0x21')],function(_0x36aa5c){return{'model':db[_0x36aa5c[_0xa033('0x22')]],'as':_0x36aa5c['as'],'attributes':_0x36aa5c[_0xa033('0x1e')],'include':_0x36aa5c[_0xa033('0x21')]?_[_0xa033('0x20')](_0x36aa5c[_0xa033('0x21')],function(_0x40ebb4){return{'model':db[_0x40ebb4[_0xa033('0x22')]],'as':_0x40ebb4['as'],'attributes':_0x40ebb4[_0xa033('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x313489){logger[_0xa033('0x17')]('ShowSugarcrmAccount',_0x9dc315);logger[_0xa033('0x11')](_0xa033('0x23'),_0x9dc315,JSON[_0xa033('0x13')](_0x313489));_0x3806b4(_0x313489);})[_0xa033('0x18')](function(_0x1823f8){logger[_0xa033('0x14')](_0xa033('0x23'),_0x1823f8[_0xa033('0x16')],_0x9dc315);_0x139870(_0x3e9af9[_0xa033('0x14')](0x1f4,_0x1823f8['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 805f955..a1befcb 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 _0x4bd8=['Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','multer','util','path','express'];(function(_0x482966,_0x2f8013){var _0x13c61f=function(_0x30c5d6){while(--_0x30c5d6){_0x482966['push'](_0x482966['shift']());}};_0x13c61f(++_0x2f8013);}(_0x4bd8,0xf3));var _0x84bd=function(_0x1574ab,_0x44ab87){_0x1574ab=_0x1574ab-0x0;var _0xddd88b=_0x4bd8[_0x1574ab];return _0xddd88b;};'use strict';var multer=require(_0x84bd('0x0'));var util=require(_0x84bd('0x1'));var path=require(_0x84bd('0x2'));var timeout=require('connect-timeout');var express=require(_0x84bd('0x3'));var router=express[_0x84bd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x84bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x84bd('0x6'));var controller=require(_0x84bd('0x7'));router[_0x84bd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x84bd('0x9'),auth[_0x84bd('0xa')](),controller['show']);router[_0x84bd('0x8')](_0x84bd('0xb'),auth[_0x84bd('0xa')](),controller['getFields']);router[_0x84bd('0x8')](_0x84bd('0xc'),auth['isAuthenticated'](),controller[_0x84bd('0xd')]);router['get'](_0x84bd('0xe'),auth[_0x84bd('0xa')](),controller[_0x84bd('0xf')]);router[_0x84bd('0x10')]('/',auth[_0x84bd('0xa')](),controller['create']);router[_0x84bd('0x11')]('/:id',auth[_0x84bd('0xa')](),controller['update']);router[_0x84bd('0x12')](_0x84bd('0x9'),auth[_0x84bd('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x36bc=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','/:id','show','get','/:id/fields'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x36bc,0x1a8));var _0xc36b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x36bc[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0xc36b('0x0'));var util=require('util');var path=require(_0xc36b('0x1'));var timeout=require(_0xc36b('0x2'));var express=require(_0xc36b('0x3'));var router=express['Router']();var fs_extra=require(_0xc36b('0x4'));var auth=require(_0xc36b('0x5'));var interaction=require(_0xc36b('0x6'));var config=require('../../config/environment');var controller=require(_0xc36b('0x7'));router['get']('/',auth[_0xc36b('0x8')](),controller['index']);router['get'](_0xc36b('0x9'),auth[_0xc36b('0x8')](),controller[_0xc36b('0xa')]);router[_0xc36b('0xb')](_0xc36b('0xc'),auth[_0xc36b('0x8')](),controller['getFields']);router[_0xc36b('0xb')](_0xc36b('0xd'),auth[_0xc36b('0x8')](),controller[_0xc36b('0xe')]);router['get'](_0xc36b('0xf'),auth[_0xc36b('0x8')](),controller[_0xc36b('0x10')]);router['post']('/',auth[_0xc36b('0x8')](),controller[_0xc36b('0x11')]);router[_0xc36b('0x12')](_0xc36b('0x9'),auth['isAuthenticated'](),controller[_0xc36b('0x13')]);router[_0xc36b('0x14')](_0xc36b('0x9'),auth[_0xc36b('0x8')](),controller[_0xc36b('0x15')]);module[_0xc36b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 0d17370..1611570 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 _0x6e7c=['exports','STRING','sequelize'];(function(_0x1db45a,_0x51a0c3){var _0x4ecbb8=function(_0x30b0b3){while(--_0x30b0b3){_0x1db45a['push'](_0x1db45a['shift']());}};_0x4ecbb8(++_0x51a0c3);}(_0x6e7c,0x1b5));var _0xc6e7=function(_0x5317f6,_0x2ff56d){_0x5317f6=_0x5317f6-0x0;var _0xcf8f59=_0x6e7c[_0x5317f6];return _0xcf8f59;};'use strict';var Sequelize=require(_0xc6e7('0x0'));module[_0xc6e7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc6e7('0x2')]}}; \ No newline at end of file +var _0x1a57=['STRING','exports'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0x1a57,0x1bf));var _0x71a5=function(_0x44694f,_0x3ce45b){_0x44694f=_0x44694f-0x0;var _0x2b0e70=_0x1a57[_0x44694f];return _0x2b0e70;};'use strict';var Sequelize=require('sequelize');module[_0x71a5('0x0')]={'name':{'type':Sequelize[_0x71a5('0x1')]},'description':{'type':Sequelize[_0x71a5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index fb4e0e5..23778c3 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 _0xa867=['merge','filter','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','SugarcrmField','order','getFields','findOne','params','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','status','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x4f19a4,_0x196c04){var _0x535456=function(_0x1af461){while(--_0x1af461){_0x4f19a4['push'](_0x4f19a4['shift']());}};_0x535456(++_0x196c04);}(_0xa867,0xae));var _0x7a86=function(_0x182417,_0x15d8b6){_0x182417=_0x182417-0x0;var _0xc754fc=_0xa867[_0x182417];return _0xc754fc;};'use strict';var emlformat=require(_0x7a86('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7a86('0x1'));var rp=require(_0x7a86('0x2'));var moment=require(_0x7a86('0x3'));var BPromise=require(_0x7a86('0x4'));var Mustache=require('mustache');var util=require(_0x7a86('0x5'));var path=require(_0x7a86('0x6'));var sox=require(_0x7a86('0x7'));var csv=require(_0x7a86('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a86('0x9'));var _=require(_0x7a86('0xa'));var squel=require('squel');var crypto=require(_0x7a86('0xb'));var jsforce=require(_0x7a86('0xc'));var deskjs=require(_0x7a86('0xd'));var toCsv=require(_0x7a86('0x8'));var querystring=require('querystring');var Papa=require(_0x7a86('0xe'));var Redis=require(_0x7a86('0xf'));var authService=require(_0x7a86('0x10'));var qs=require(_0x7a86('0x11'));var as=require(_0x7a86('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a86('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a86('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb3cbdd,_0x3ba76d){_0x3ba76d=_0x3ba76d||0xcc;return function(_0x42c39d){if(_0x42c39d){return _0xb3cbdd['sendStatus'](_0x3ba76d);}return _0xb3cbdd[_0x7a86('0x15')](_0x3ba76d)['end']();};}function respondWithResult(_0x5e0d9d,_0x32bbe2){_0x32bbe2=_0x32bbe2||0xc8;return function(_0xa2d317){if(_0xa2d317){return _0x5e0d9d['status'](_0x32bbe2)[_0x7a86('0x16')](_0xa2d317);}};}function respondWithFilteredResult(_0x4419c3,_0x80338a){return function(_0x3699ab){if(_0x3699ab){var _0x52a687=typeof _0x80338a[_0x7a86('0x17')]==='undefined'&&typeof _0x80338a['limit']===_0x7a86('0x18');var _0x1a01db=_0x3699ab['count'];var _0x4ae5b2=_0x52a687?0x0:_0x80338a[_0x7a86('0x17')];var _0x191ac1=_0x52a687?_0x3699ab[_0x7a86('0x19')]:_0x80338a[_0x7a86('0x17')]+_0x80338a['limit'];var _0x1e1e2b;if(_0x191ac1>=_0x1a01db){_0x191ac1=_0x1a01db;_0x1e1e2b=0xc8;}else{_0x1e1e2b=0xce;}_0x4419c3['status'](_0x1e1e2b);return _0x4419c3[_0x7a86('0x1a')](_0x7a86('0x1b'),_0x4ae5b2+'-'+_0x191ac1+'/'+_0x1a01db)[_0x7a86('0x16')](_0x3699ab);}return null;};}function patchUpdates(_0x387fff){return function(_0x23ba9f){try{jsonpatch['apply'](_0x23ba9f,_0x387fff,!![]);}catch(_0x26dd37){return BPromise[_0x7a86('0x1c')](_0x26dd37);}return _0x23ba9f[_0x7a86('0x1d')]();};}function saveUpdates(_0x3529df,_0x3eb2b8){return function(_0x336ada){if(_0x336ada){return _0x336ada['update'](_0x3529df)[_0x7a86('0x1e')](function(_0x4002eb){return _0x4002eb;});}return null;};}function removeEntity(_0x5d81cc,_0x4edbf5){return function(_0x530f1e){if(_0x530f1e){return _0x530f1e[_0x7a86('0x1f')]()[_0x7a86('0x1e')](function(){_0x5d81cc[_0x7a86('0x15')](0xcc)[_0x7a86('0x20')]();});}};}function handleEntityNotFound(_0x1f18c5,_0x2acea9){return function(_0x33060f){if(!_0x33060f){_0x1f18c5[_0x7a86('0x21')](0x194);}return _0x33060f;};}function handleError(_0x18205d,_0x8f13c8){_0x8f13c8=_0x8f13c8||0x1f4;return function(_0x313c9a){logger[_0x7a86('0x22')](_0x313c9a[_0x7a86('0x23')]);if(_0x313c9a[_0x7a86('0x24')]){delete _0x313c9a[_0x7a86('0x24')];}_0x18205d[_0x7a86('0x15')](_0x8f13c8)[_0x7a86('0x25')](_0x313c9a);};}exports[_0x7a86('0x26')]=function(_0x22609d,_0x52da38){var _0x5876ce={},_0x12901a={},_0x3dbf3b={'count':0x0,'rows':[]};var _0x31cf91=_[_0x7a86('0x27')](db[_0x7a86('0x28')][_0x7a86('0x29')],function(_0x89a63){return{'name':_0x89a63['fieldName'],'type':_0x89a63[_0x7a86('0x2a')][_0x7a86('0x2b')]};});_0x12901a['model']=_[_0x7a86('0x27')](_0x31cf91,'name');_0x12901a['query']=_['keys'](_0x22609d[_0x7a86('0x2c')]);_0x12901a[_0x7a86('0x2d')]=_[_0x7a86('0x2e')](_0x12901a[_0x7a86('0x2f')],_0x12901a[_0x7a86('0x2c')]);_0x5876ce[_0x7a86('0x30')]=_[_0x7a86('0x2e')](_0x12901a[_0x7a86('0x2f')],qs[_0x7a86('0x31')](_0x22609d[_0x7a86('0x2c')]['fields']));_0x5876ce[_0x7a86('0x30')]=_0x5876ce[_0x7a86('0x30')][_0x7a86('0x32')]?_0x5876ce['attributes']:_0x12901a[_0x7a86('0x2f')];if(!_0x22609d[_0x7a86('0x2c')][_0x7a86('0x33')](_0x7a86('0x34'))){_0x5876ce[_0x7a86('0x35')]=qs[_0x7a86('0x35')](_0x22609d[_0x7a86('0x2c')][_0x7a86('0x35')]);_0x5876ce[_0x7a86('0x17')]=qs['offset'](_0x22609d[_0x7a86('0x2c')][_0x7a86('0x17')]);}_0x5876ce['order']=qs[_0x7a86('0x36')](_0x22609d[_0x7a86('0x2c')]['sort']);_0x5876ce[_0x7a86('0x37')]=qs['filters'](_[_0x7a86('0x38')](_0x22609d[_0x7a86('0x2c')],_0x12901a[_0x7a86('0x2d')]),_0x31cf91);if(_0x22609d[_0x7a86('0x2c')]['filter']){_0x5876ce['where']=_[_0x7a86('0x39')](_0x5876ce[_0x7a86('0x37')],{'$or':_[_0x7a86('0x27')](_0x31cf91,function(_0x1d550f){if(_0x1d550f[_0x7a86('0x2a')]!=='VIRTUAL'){var _0x3575ad={};_0x3575ad[_0x1d550f['name']]={'$like':'%'+_0x22609d[_0x7a86('0x2c')][_0x7a86('0x3a')]+'%'};return _0x3575ad;}})});}_0x5876ce=_['merge']({},_0x5876ce,_0x22609d[_0x7a86('0x3b')]);var _0x5d67c8={'where':_0x5876ce['where']};return db['SugarcrmConfiguration'][_0x7a86('0x19')](_0x5d67c8)[_0x7a86('0x1e')](function(_0x1a8485){_0x3dbf3b[_0x7a86('0x19')]=_0x1a8485;if(_0x22609d[_0x7a86('0x2c')][_0x7a86('0x3c')]){_0x5876ce[_0x7a86('0x3d')]=[{'all':!![]}];}return db[_0x7a86('0x28')][_0x7a86('0x3e')](_0x5876ce);})[_0x7a86('0x1e')](function(_0x3911c8){_0x3dbf3b[_0x7a86('0x3f')]=_0x3911c8;return _0x3dbf3b;})[_0x7a86('0x1e')](respondWithFilteredResult(_0x52da38,_0x5876ce))['catch'](handleError(_0x52da38,null));};exports[_0x7a86('0x40')]=function(_0x116e92,_0x3ef363){var _0x217a96={'raw':![],'where':{'id':_0x116e92['params']['id']}},_0x408ce2={};_0x408ce2[_0x7a86('0x2f')]=_[_0x7a86('0x41')](db[_0x7a86('0x28')][_0x7a86('0x29')]);_0x408ce2[_0x7a86('0x2c')]=_[_0x7a86('0x41')](_0x116e92['query']);_0x408ce2[_0x7a86('0x2d')]=_[_0x7a86('0x2e')](_0x408ce2['model'],_0x408ce2['query']);_0x217a96[_0x7a86('0x30')]=_[_0x7a86('0x2e')](_0x408ce2[_0x7a86('0x2f')],qs[_0x7a86('0x31')](_0x116e92['query'][_0x7a86('0x31')]));_0x217a96['attributes']=_0x217a96[_0x7a86('0x30')][_0x7a86('0x32')]?_0x217a96[_0x7a86('0x30')]:_0x408ce2['model'];if(_0x116e92['query'][_0x7a86('0x3c')]){_0x217a96['include']=[{'all':!![]}];}_0x217a96=_[_0x7a86('0x39')]({},_0x217a96,_0x116e92[_0x7a86('0x3b')]);return db['SugarcrmConfiguration'][_0x7a86('0x42')](_0x217a96)[_0x7a86('0x1e')](handleEntityNotFound(_0x3ef363,null))[_0x7a86('0x1e')](respondWithResult(_0x3ef363,null))[_0x7a86('0x43')](handleError(_0x3ef363,null));};exports[_0x7a86('0x44')]=function(_0x5449ea,_0x309a6e){return db[_0x7a86('0x28')][_0x7a86('0x44')](_0x5449ea[_0x7a86('0x45')],{})['then'](respondWithResult(_0x309a6e,0xc9))[_0x7a86('0x43')](handleError(_0x309a6e,null));};exports['update']=function(_0x4af362,_0x2339a5){if(_0x4af362[_0x7a86('0x45')]['id']){delete _0x4af362[_0x7a86('0x45')]['id'];}return db[_0x7a86('0x28')][_0x7a86('0x42')]({'where':{'id':_0x4af362['params']['id']}})[_0x7a86('0x1e')](handleEntityNotFound(_0x2339a5,null))[_0x7a86('0x1e')](saveUpdates(_0x4af362['body'],null))[_0x7a86('0x1e')](respondWithResult(_0x2339a5,null))[_0x7a86('0x43')](handleError(_0x2339a5,null));};exports[_0x7a86('0x1f')]=function(_0x327261,_0x4ed321){return db[_0x7a86('0x28')]['find']({'where':{'id':_0x327261['params']['id']}})['then'](handleEntityNotFound(_0x4ed321,null))[_0x7a86('0x1e')](removeEntity(_0x4ed321,null))[_0x7a86('0x43')](handleError(_0x4ed321,null));};exports['getFields']=function(_0x4a8846,_0x42cfa9,_0x57d5c0){var _0x7014a3={};var _0x17120c={};var _0x2b4da2;var _0x274585;return db[_0x7a86('0x28')]['findOne']({'where':{'id':_0x4a8846['params']['id']}})['then'](handleEntityNotFound(_0x42cfa9,null))[_0x7a86('0x1e')](function(_0x56f6fa){if(_0x56f6fa){_0x2b4da2=_0x56f6fa;_0x17120c[_0x7a86('0x2f')]=_['keys'](db[_0x7a86('0x46')]['rawAttributes']);_0x17120c[_0x7a86('0x2c')]=_['keys'](_0x4a8846[_0x7a86('0x2c')]);_0x17120c[_0x7a86('0x2d')]=_['intersection'](_0x17120c['model'],_0x17120c[_0x7a86('0x2c')]);_0x7014a3[_0x7a86('0x30')]=_[_0x7a86('0x2e')](_0x17120c['model'],qs[_0x7a86('0x31')](_0x4a8846[_0x7a86('0x2c')][_0x7a86('0x31')]));_0x7014a3['attributes']=_0x7014a3[_0x7a86('0x30')][_0x7a86('0x32')]?_0x7014a3[_0x7a86('0x30')]:_0x17120c[_0x7a86('0x2f')];_0x7014a3[_0x7a86('0x47')]=qs[_0x7a86('0x36')](_0x4a8846[_0x7a86('0x2c')][_0x7a86('0x36')]);_0x7014a3[_0x7a86('0x37')]=qs[_0x7a86('0x2d')](_[_0x7a86('0x38')](_0x4a8846[_0x7a86('0x2c')],_0x17120c['filters']));if(_0x4a8846[_0x7a86('0x2c')][_0x7a86('0x3a')]){_0x7014a3[_0x7a86('0x37')]=_[_0x7a86('0x39')](_0x7014a3[_0x7a86('0x37')],{'$or':_['map'](_0x7014a3[_0x7a86('0x30')],function(_0x457ea1){var _0x302822={};_0x302822[_0x457ea1]={'$like':'%'+_0x4a8846[_0x7a86('0x2c')][_0x7a86('0x3a')]+'%'};return _0x302822;})});}_0x7014a3=_[_0x7a86('0x39')]({},_0x7014a3,_0x4a8846[_0x7a86('0x3b')]);return _0x2b4da2[_0x7a86('0x48')](_0x7014a3);}})['then'](function(_0x9a3234){if(_0x9a3234){_0x274585=_0x9a3234[_0x7a86('0x32')];if(!_0x4a8846[_0x7a86('0x2c')][_0x7a86('0x33')](_0x7a86('0x34'))){_0x7014a3[_0x7a86('0x35')]=qs[_0x7a86('0x35')](_0x4a8846[_0x7a86('0x2c')][_0x7a86('0x35')]);_0x7014a3['offset']=qs[_0x7a86('0x17')](_0x4a8846[_0x7a86('0x2c')][_0x7a86('0x17')]);}return _0x2b4da2[_0x7a86('0x48')](_0x7014a3);}})['then'](function(_0xce5dce){if(_0xce5dce){return _0xce5dce?{'count':_0x274585,'rows':_0xce5dce}:null;}})[_0x7a86('0x1e')](respondWithResult(_0x42cfa9,null))[_0x7a86('0x43')](handleError(_0x42cfa9,null));};exports['getSubjects']=function(_0x77cab4,_0x5c5ba2,_0x2f6a44){var _0x29724a={};var _0x343652={};var _0x36c5ec;var _0x2154a3;return db[_0x7a86('0x28')][_0x7a86('0x49')]({'where':{'id':_0x77cab4[_0x7a86('0x4a')]['id']}})[_0x7a86('0x1e')](handleEntityNotFound(_0x5c5ba2,null))[_0x7a86('0x1e')](function(_0x25e596){if(_0x25e596){_0x36c5ec=_0x25e596;_0x343652[_0x7a86('0x2f')]=_[_0x7a86('0x41')](db['SugarcrmField']['rawAttributes']);_0x343652[_0x7a86('0x2c')]=_[_0x7a86('0x41')](_0x77cab4['query']);_0x343652[_0x7a86('0x2d')]=_[_0x7a86('0x2e')](_0x343652['model'],_0x343652['query']);_0x29724a[_0x7a86('0x30')]=_[_0x7a86('0x2e')](_0x343652[_0x7a86('0x2f')],qs[_0x7a86('0x31')](_0x77cab4[_0x7a86('0x2c')][_0x7a86('0x31')]));_0x29724a[_0x7a86('0x30')]=_0x29724a['attributes'][_0x7a86('0x32')]?_0x29724a[_0x7a86('0x30')]:_0x343652[_0x7a86('0x2f')];_0x29724a[_0x7a86('0x47')]=qs['sort'](_0x77cab4[_0x7a86('0x2c')]['sort']);_0x29724a[_0x7a86('0x37')]=qs[_0x7a86('0x2d')](_[_0x7a86('0x38')](_0x77cab4[_0x7a86('0x2c')],_0x343652[_0x7a86('0x2d')]));if(_0x77cab4[_0x7a86('0x2c')][_0x7a86('0x3a')]){_0x29724a[_0x7a86('0x37')]=_[_0x7a86('0x39')](_0x29724a[_0x7a86('0x37')],{'$or':_['map'](_0x29724a[_0x7a86('0x30')],function(_0x18e56c){var _0x185f79={};_0x185f79[_0x18e56c]={'$like':'%'+_0x77cab4[_0x7a86('0x2c')][_0x7a86('0x3a')]+'%'};return _0x185f79;})});}_0x29724a=_[_0x7a86('0x39')]({},_0x29724a,_0x77cab4[_0x7a86('0x3b')]);return _0x36c5ec[_0x7a86('0x4b')](_0x29724a);}})[_0x7a86('0x1e')](function(_0x10750b){if(_0x10750b){_0x2154a3=_0x10750b[_0x7a86('0x32')];if(!_0x77cab4['query'][_0x7a86('0x33')]('nolimit')){_0x29724a[_0x7a86('0x35')]=qs[_0x7a86('0x35')](_0x77cab4[_0x7a86('0x2c')][_0x7a86('0x35')]);_0x29724a[_0x7a86('0x17')]=qs[_0x7a86('0x17')](_0x77cab4[_0x7a86('0x2c')][_0x7a86('0x17')]);}return _0x36c5ec[_0x7a86('0x4b')](_0x29724a);}})[_0x7a86('0x1e')](function(_0x5eef24){if(_0x5eef24){return _0x5eef24?{'count':_0x2154a3,'rows':_0x5eef24}:null;}})['then'](respondWithResult(_0x5c5ba2,null))['catch'](handleError(_0x5c5ba2,null));};exports[_0x7a86('0x4c')]=function(_0x5bff36,_0x22cd13,_0x3e7559){var _0x178398={};var _0x53cb69={};var _0x584932;var _0x23257c;return db[_0x7a86('0x28')][_0x7a86('0x49')]({'where':{'id':_0x5bff36[_0x7a86('0x4a')]['id']}})[_0x7a86('0x1e')](handleEntityNotFound(_0x22cd13,null))[_0x7a86('0x1e')](function(_0x1e210e){if(_0x1e210e){_0x584932=_0x1e210e;_0x53cb69[_0x7a86('0x2f')]=_['keys'](db['SugarcrmField'][_0x7a86('0x29')]);_0x53cb69[_0x7a86('0x2c')]=_['keys'](_0x5bff36[_0x7a86('0x2c')]);_0x53cb69['filters']=_[_0x7a86('0x2e')](_0x53cb69[_0x7a86('0x2f')],_0x53cb69['query']);_0x178398[_0x7a86('0x30')]=_['intersection'](_0x53cb69['model'],qs[_0x7a86('0x31')](_0x5bff36[_0x7a86('0x2c')][_0x7a86('0x31')]));_0x178398['attributes']=_0x178398[_0x7a86('0x30')][_0x7a86('0x32')]?_0x178398[_0x7a86('0x30')]:_0x53cb69[_0x7a86('0x2f')];_0x178398[_0x7a86('0x47')]=qs[_0x7a86('0x36')](_0x5bff36[_0x7a86('0x2c')][_0x7a86('0x36')]);_0x178398[_0x7a86('0x37')]=qs[_0x7a86('0x2d')](_[_0x7a86('0x38')](_0x5bff36[_0x7a86('0x2c')],_0x53cb69[_0x7a86('0x2d')]));if(_0x5bff36['query'][_0x7a86('0x3a')]){_0x178398[_0x7a86('0x37')]=_[_0x7a86('0x39')](_0x178398[_0x7a86('0x37')],{'$or':_[_0x7a86('0x27')](_0x178398[_0x7a86('0x30')],function(_0x4426b5){var _0x4a10fe={};_0x4a10fe[_0x4426b5]={'$like':'%'+_0x5bff36[_0x7a86('0x2c')][_0x7a86('0x3a')]+'%'};return _0x4a10fe;})});}_0x178398=_['merge']({},_0x178398,_0x5bff36[_0x7a86('0x3b')]);return _0x584932['getDescriptions'](_0x178398);}})['then'](function(_0x12f239){if(_0x12f239){_0x23257c=_0x12f239[_0x7a86('0x32')];if(!_0x5bff36[_0x7a86('0x2c')][_0x7a86('0x33')](_0x7a86('0x34'))){_0x178398[_0x7a86('0x35')]=qs[_0x7a86('0x35')](_0x5bff36[_0x7a86('0x2c')][_0x7a86('0x35')]);_0x178398[_0x7a86('0x17')]=qs[_0x7a86('0x17')](_0x5bff36[_0x7a86('0x2c')][_0x7a86('0x17')]);}return _0x584932[_0x7a86('0x4c')](_0x178398);}})[_0x7a86('0x1e')](function(_0x59bb27){if(_0x59bb27){return _0x59bb27?{'count':_0x23257c,'rows':_0x59bb27}:null;}})[_0x7a86('0x1e')](respondWithResult(_0x22cd13,null))[_0x7a86('0x43')](handleError(_0x22cd13,null));}; \ No newline at end of file +var _0x52af=['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','end','json','offset','count','limit','set','reject','save','update','then','destroy','status','sendStatus','error','stack','name','send','index','map','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','SugarcrmConfiguration','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','getFields','SugarcrmField','rawAttributes','getSubjects','findOne','pick','getDescriptions','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x8ded35,_0x148864){var _0x1f5408=function(_0x50ad22){while(--_0x50ad22){_0x8ded35['push'](_0x8ded35['shift']());}};_0x1f5408(++_0x148864);}(_0x52af,0xe7));var _0xf52a=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x52af[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf52a('0x0'));var rp=require(_0xf52a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf52a('0x2'));var util=require(_0xf52a('0x3'));var path=require(_0xf52a('0x4'));var sox=require('sox');var csv=require(_0xf52a('0x5'));var ejs=require(_0xf52a('0x6'));var fs=require('fs');var fs_extra=require(_0xf52a('0x7'));var _=require(_0xf52a('0x8'));var squel=require(_0xf52a('0x9'));var crypto=require(_0xf52a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf52a('0xb'));var toCsv=require(_0xf52a('0x5'));var querystring=require(_0xf52a('0xc'));var Papa=require(_0xf52a('0xd'));var Redis=require('ioredis');var authService=require(_0xf52a('0xe'));var qs=require(_0xf52a('0xf'));var as=require(_0xf52a('0x10'));var hardwareService=require(_0xf52a('0x11'));var logger=require(_0xf52a('0x12'))(_0xf52a('0x13'));var utils=require(_0xf52a('0x14'));var config=require(_0xf52a('0x15'));var licenseUtil=require(_0xf52a('0x16'));var db=require(_0xf52a('0x17'))['db'];function respondWithStatusCode(_0x4e3fe5,_0x4bb142){_0x4bb142=_0x4bb142||0xcc;return function(_0x1b2eff){if(_0x1b2eff){return _0x4e3fe5['sendStatus'](_0x4bb142);}return _0x4e3fe5['status'](_0x4bb142)[_0xf52a('0x18')]();};}function respondWithResult(_0x2a1708,_0x2f2cbf){_0x2f2cbf=_0x2f2cbf||0xc8;return function(_0x887880){if(_0x887880){return _0x2a1708['status'](_0x2f2cbf)[_0xf52a('0x19')](_0x887880);}};}function respondWithFilteredResult(_0x32032f,_0x2aa5a2){return function(_0x442a85){if(_0x442a85){var _0x18368b=typeof _0x2aa5a2[_0xf52a('0x1a')]==='undefined'&&typeof _0x2aa5a2['limit']==='undefined';var _0x32d173=_0x442a85[_0xf52a('0x1b')];var _0x2f590a=_0x18368b?0x0:_0x2aa5a2[_0xf52a('0x1a')];var _0x1ba641=_0x18368b?_0x442a85[_0xf52a('0x1b')]:_0x2aa5a2['offset']+_0x2aa5a2[_0xf52a('0x1c')];var _0x518980;if(_0x1ba641>=_0x32d173){_0x1ba641=_0x32d173;_0x518980=0xc8;}else{_0x518980=0xce;}_0x32032f['status'](_0x518980);return _0x32032f[_0xf52a('0x1d')]('Content-Range',_0x2f590a+'-'+_0x1ba641+'/'+_0x32d173)[_0xf52a('0x19')](_0x442a85);}return null;};}function patchUpdates(_0x3e4d18){return function(_0x314963){try{jsonpatch['apply'](_0x314963,_0x3e4d18,!![]);}catch(_0x4600e7){return BPromise[_0xf52a('0x1e')](_0x4600e7);}return _0x314963[_0xf52a('0x1f')]();};}function saveUpdates(_0x1e694b,_0x3820b0){return function(_0x16e1cc){if(_0x16e1cc){return _0x16e1cc[_0xf52a('0x20')](_0x1e694b)[_0xf52a('0x21')](function(_0xd5e0a1){return _0xd5e0a1;});}return null;};}function removeEntity(_0x5ed6cc,_0x516518){return function(_0x57a41b){if(_0x57a41b){return _0x57a41b[_0xf52a('0x22')]()[_0xf52a('0x21')](function(){_0x5ed6cc[_0xf52a('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf57803,_0xa055dd){return function(_0x53413f){if(!_0x53413f){_0xf57803[_0xf52a('0x24')](0x194);}return _0x53413f;};}function handleError(_0x3f19fb,_0xfd203c){_0xfd203c=_0xfd203c||0x1f4;return function(_0x31ef85){logger[_0xf52a('0x25')](_0x31ef85[_0xf52a('0x26')]);if(_0x31ef85['name']){delete _0x31ef85[_0xf52a('0x27')];}_0x3f19fb[_0xf52a('0x23')](_0xfd203c)[_0xf52a('0x28')](_0x31ef85);};}exports[_0xf52a('0x29')]=function(_0x7c130c,_0x2208dc){var _0x1764f1={},_0xa878b8={},_0x2ba7b6={'count':0x0,'rows':[]};var _0x4df835=_[_0xf52a('0x2a')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x1b1654){return{'name':_0x1b1654['fieldName'],'type':_0x1b1654['type'][_0xf52a('0x2b')]};});_0xa878b8[_0xf52a('0x2c')]=_[_0xf52a('0x2a')](_0x4df835,_0xf52a('0x27'));_0xa878b8['query']=_['keys'](_0x7c130c[_0xf52a('0x2d')]);_0xa878b8[_0xf52a('0x2e')]=_[_0xf52a('0x2f')](_0xa878b8['model'],_0xa878b8[_0xf52a('0x2d')]);_0x1764f1[_0xf52a('0x30')]=_[_0xf52a('0x2f')](_0xa878b8[_0xf52a('0x2c')],qs[_0xf52a('0x31')](_0x7c130c[_0xf52a('0x2d')]['fields']));_0x1764f1[_0xf52a('0x30')]=_0x1764f1['attributes']['length']?_0x1764f1['attributes']:_0xa878b8['model'];if(!_0x7c130c[_0xf52a('0x2d')][_0xf52a('0x32')](_0xf52a('0x33'))){_0x1764f1['limit']=qs[_0xf52a('0x1c')](_0x7c130c[_0xf52a('0x2d')][_0xf52a('0x1c')]);_0x1764f1[_0xf52a('0x1a')]=qs[_0xf52a('0x1a')](_0x7c130c['query']['offset']);}_0x1764f1[_0xf52a('0x34')]=qs[_0xf52a('0x35')](_0x7c130c[_0xf52a('0x2d')][_0xf52a('0x35')]);_0x1764f1['where']=qs[_0xf52a('0x2e')](_['pick'](_0x7c130c[_0xf52a('0x2d')],_0xa878b8[_0xf52a('0x2e')]),_0x4df835);if(_0x7c130c[_0xf52a('0x2d')][_0xf52a('0x36')]){_0x1764f1[_0xf52a('0x37')]=_[_0xf52a('0x38')](_0x1764f1[_0xf52a('0x37')],{'$or':_[_0xf52a('0x2a')](_0x4df835,function(_0x16bea7){if(_0x16bea7[_0xf52a('0x39')]!==_0xf52a('0x3a')){var _0x2d5e48={};_0x2d5e48[_0x16bea7[_0xf52a('0x27')]]={'$like':'%'+_0x7c130c[_0xf52a('0x2d')]['filter']+'%'};return _0x2d5e48;}})});}_0x1764f1=_['merge']({},_0x1764f1,_0x7c130c[_0xf52a('0x3b')]);var _0x19d4f0={'where':_0x1764f1['where']};return db[_0xf52a('0x3c')][_0xf52a('0x1b')](_0x19d4f0)[_0xf52a('0x21')](function(_0x2fe892){_0x2ba7b6[_0xf52a('0x1b')]=_0x2fe892;if(_0x7c130c['query'][_0xf52a('0x3d')]){_0x1764f1['include']=[{'all':!![]}];}return db[_0xf52a('0x3c')][_0xf52a('0x3e')](_0x1764f1);})[_0xf52a('0x21')](function(_0x21e49f){_0x2ba7b6[_0xf52a('0x3f')]=_0x21e49f;return _0x2ba7b6;})[_0xf52a('0x21')](respondWithFilteredResult(_0x2208dc,_0x1764f1))[_0xf52a('0x40')](handleError(_0x2208dc,null));};exports[_0xf52a('0x41')]=function(_0x1acf7a,_0x4f9c1e){var _0x430e88={'raw':![],'where':{'id':_0x1acf7a[_0xf52a('0x42')]['id']}},_0x559b25={};_0x559b25['model']=_[_0xf52a('0x43')](db[_0xf52a('0x3c')]['rawAttributes']);_0x559b25[_0xf52a('0x2d')]=_[_0xf52a('0x43')](_0x1acf7a[_0xf52a('0x2d')]);_0x559b25[_0xf52a('0x2e')]=_['intersection'](_0x559b25[_0xf52a('0x2c')],_0x559b25[_0xf52a('0x2d')]);_0x430e88[_0xf52a('0x30')]=_[_0xf52a('0x2f')](_0x559b25[_0xf52a('0x2c')],qs[_0xf52a('0x31')](_0x1acf7a[_0xf52a('0x2d')][_0xf52a('0x31')]));_0x430e88[_0xf52a('0x30')]=_0x430e88[_0xf52a('0x30')][_0xf52a('0x44')]?_0x430e88[_0xf52a('0x30')]:_0x559b25[_0xf52a('0x2c')];if(_0x1acf7a[_0xf52a('0x2d')][_0xf52a('0x3d')]){_0x430e88[_0xf52a('0x45')]=[{'all':!![]}];}_0x430e88=_[_0xf52a('0x38')]({},_0x430e88,_0x1acf7a['options']);return db[_0xf52a('0x3c')][_0xf52a('0x46')](_0x430e88)['then'](handleEntityNotFound(_0x4f9c1e,null))[_0xf52a('0x21')](respondWithResult(_0x4f9c1e,null))[_0xf52a('0x40')](handleError(_0x4f9c1e,null));};exports['create']=function(_0x11138f,_0x3d138f){return db[_0xf52a('0x3c')][_0xf52a('0x47')](_0x11138f[_0xf52a('0x48')],{})[_0xf52a('0x21')](respondWithResult(_0x3d138f,0xc9))[_0xf52a('0x40')](handleError(_0x3d138f,null));};exports[_0xf52a('0x20')]=function(_0x5ab9c1,_0x1e80fd){if(_0x5ab9c1[_0xf52a('0x48')]['id']){delete _0x5ab9c1[_0xf52a('0x48')]['id'];}return db[_0xf52a('0x3c')][_0xf52a('0x46')]({'where':{'id':_0x5ab9c1['params']['id']}})[_0xf52a('0x21')](handleEntityNotFound(_0x1e80fd,null))[_0xf52a('0x21')](saveUpdates(_0x5ab9c1[_0xf52a('0x48')],null))['then'](respondWithResult(_0x1e80fd,null))[_0xf52a('0x40')](handleError(_0x1e80fd,null));};exports[_0xf52a('0x22')]=function(_0x3ea604,_0x117666){return db[_0xf52a('0x3c')][_0xf52a('0x46')]({'where':{'id':_0x3ea604['params']['id']}})[_0xf52a('0x21')](handleEntityNotFound(_0x117666,null))['then'](removeEntity(_0x117666,null))[_0xf52a('0x40')](handleError(_0x117666,null));};exports[_0xf52a('0x49')]=function(_0x3baf22,_0x1e5ad3,_0xf5819b){var _0x3420db={};var _0x38bf74={};var _0x5da9cf;var _0x1cb173;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3baf22[_0xf52a('0x42')]['id']}})[_0xf52a('0x21')](handleEntityNotFound(_0x1e5ad3,null))['then'](function(_0x2594b8){if(_0x2594b8){_0x5da9cf=_0x2594b8;_0x38bf74[_0xf52a('0x2c')]=_[_0xf52a('0x43')](db[_0xf52a('0x4a')][_0xf52a('0x4b')]);_0x38bf74['query']=_['keys'](_0x3baf22[_0xf52a('0x2d')]);_0x38bf74[_0xf52a('0x2e')]=_['intersection'](_0x38bf74[_0xf52a('0x2c')],_0x38bf74[_0xf52a('0x2d')]);_0x3420db['attributes']=_[_0xf52a('0x2f')](_0x38bf74[_0xf52a('0x2c')],qs[_0xf52a('0x31')](_0x3baf22['query'][_0xf52a('0x31')]));_0x3420db['attributes']=_0x3420db[_0xf52a('0x30')]['length']?_0x3420db['attributes']:_0x38bf74[_0xf52a('0x2c')];_0x3420db[_0xf52a('0x34')]=qs[_0xf52a('0x35')](_0x3baf22[_0xf52a('0x2d')][_0xf52a('0x35')]);_0x3420db['where']=qs[_0xf52a('0x2e')](_['pick'](_0x3baf22['query'],_0x38bf74[_0xf52a('0x2e')]));if(_0x3baf22['query'][_0xf52a('0x36')]){_0x3420db[_0xf52a('0x37')]=_['merge'](_0x3420db[_0xf52a('0x37')],{'$or':_[_0xf52a('0x2a')](_0x3420db[_0xf52a('0x30')],function(_0x416a54){var _0x3d2576={};_0x3d2576[_0x416a54]={'$like':'%'+_0x3baf22[_0xf52a('0x2d')][_0xf52a('0x36')]+'%'};return _0x3d2576;})});}_0x3420db=_[_0xf52a('0x38')]({},_0x3420db,_0x3baf22[_0xf52a('0x3b')]);return _0x5da9cf[_0xf52a('0x49')](_0x3420db);}})[_0xf52a('0x21')](function(_0x7cb40){if(_0x7cb40){_0x1cb173=_0x7cb40['length'];if(!_0x3baf22[_0xf52a('0x2d')]['hasOwnProperty'](_0xf52a('0x33'))){_0x3420db[_0xf52a('0x1c')]=qs[_0xf52a('0x1c')](_0x3baf22[_0xf52a('0x2d')][_0xf52a('0x1c')]);_0x3420db[_0xf52a('0x1a')]=qs[_0xf52a('0x1a')](_0x3baf22['query'][_0xf52a('0x1a')]);}return _0x5da9cf[_0xf52a('0x49')](_0x3420db);}})[_0xf52a('0x21')](function(_0x2888bd){if(_0x2888bd){return _0x2888bd?{'count':_0x1cb173,'rows':_0x2888bd}:null;}})[_0xf52a('0x21')](respondWithResult(_0x1e5ad3,null))[_0xf52a('0x40')](handleError(_0x1e5ad3,null));};exports[_0xf52a('0x4c')]=function(_0x29bb0c,_0x13e2fc,_0x26a230){var _0x148cf3={};var _0x1dfc64={};var _0x63c5b6;var _0x5240fa;return db['SugarcrmConfiguration'][_0xf52a('0x4d')]({'where':{'id':_0x29bb0c['params']['id']}})['then'](handleEntityNotFound(_0x13e2fc,null))['then'](function(_0x50e12f){if(_0x50e12f){_0x63c5b6=_0x50e12f;_0x1dfc64[_0xf52a('0x2c')]=_[_0xf52a('0x43')](db['SugarcrmField']['rawAttributes']);_0x1dfc64['query']=_[_0xf52a('0x43')](_0x29bb0c[_0xf52a('0x2d')]);_0x1dfc64['filters']=_['intersection'](_0x1dfc64[_0xf52a('0x2c')],_0x1dfc64[_0xf52a('0x2d')]);_0x148cf3[_0xf52a('0x30')]=_['intersection'](_0x1dfc64[_0xf52a('0x2c')],qs[_0xf52a('0x31')](_0x29bb0c[_0xf52a('0x2d')]['fields']));_0x148cf3[_0xf52a('0x30')]=_0x148cf3[_0xf52a('0x30')]['length']?_0x148cf3[_0xf52a('0x30')]:_0x1dfc64[_0xf52a('0x2c')];_0x148cf3['order']=qs[_0xf52a('0x35')](_0x29bb0c[_0xf52a('0x2d')][_0xf52a('0x35')]);_0x148cf3[_0xf52a('0x37')]=qs['filters'](_[_0xf52a('0x4e')](_0x29bb0c['query'],_0x1dfc64[_0xf52a('0x2e')]));if(_0x29bb0c[_0xf52a('0x2d')][_0xf52a('0x36')]){_0x148cf3['where']=_['merge'](_0x148cf3['where'],{'$or':_['map'](_0x148cf3[_0xf52a('0x30')],function(_0x3487c5){var _0x184290={};_0x184290[_0x3487c5]={'$like':'%'+_0x29bb0c[_0xf52a('0x2d')][_0xf52a('0x36')]+'%'};return _0x184290;})});}_0x148cf3=_[_0xf52a('0x38')]({},_0x148cf3,_0x29bb0c[_0xf52a('0x3b')]);return _0x63c5b6[_0xf52a('0x4c')](_0x148cf3);}})['then'](function(_0x2c671a){if(_0x2c671a){_0x5240fa=_0x2c671a[_0xf52a('0x44')];if(!_0x29bb0c['query'][_0xf52a('0x32')](_0xf52a('0x33'))){_0x148cf3[_0xf52a('0x1c')]=qs[_0xf52a('0x1c')](_0x29bb0c[_0xf52a('0x2d')][_0xf52a('0x1c')]);_0x148cf3['offset']=qs[_0xf52a('0x1a')](_0x29bb0c[_0xf52a('0x2d')]['offset']);}return _0x63c5b6[_0xf52a('0x4c')](_0x148cf3);}})[_0xf52a('0x21')](function(_0x519297){if(_0x519297){return _0x519297?{'count':_0x5240fa,'rows':_0x519297}:null;}})[_0xf52a('0x21')](respondWithResult(_0x13e2fc,null))[_0xf52a('0x40')](handleError(_0x13e2fc,null));};exports['getDescriptions']=function(_0x228fd0,_0x593a6a,_0x275f5e){var _0x385336={};var _0x10a69a={};var _0x8fb063;var _0x1dc7f0;return db[_0xf52a('0x3c')][_0xf52a('0x4d')]({'where':{'id':_0x228fd0['params']['id']}})[_0xf52a('0x21')](handleEntityNotFound(_0x593a6a,null))['then'](function(_0x540a64){if(_0x540a64){_0x8fb063=_0x540a64;_0x10a69a[_0xf52a('0x2c')]=_['keys'](db[_0xf52a('0x4a')][_0xf52a('0x4b')]);_0x10a69a[_0xf52a('0x2d')]=_['keys'](_0x228fd0[_0xf52a('0x2d')]);_0x10a69a[_0xf52a('0x2e')]=_[_0xf52a('0x2f')](_0x10a69a[_0xf52a('0x2c')],_0x10a69a[_0xf52a('0x2d')]);_0x385336['attributes']=_[_0xf52a('0x2f')](_0x10a69a[_0xf52a('0x2c')],qs[_0xf52a('0x31')](_0x228fd0[_0xf52a('0x2d')][_0xf52a('0x31')]));_0x385336[_0xf52a('0x30')]=_0x385336[_0xf52a('0x30')][_0xf52a('0x44')]?_0x385336['attributes']:_0x10a69a[_0xf52a('0x2c')];_0x385336[_0xf52a('0x34')]=qs[_0xf52a('0x35')](_0x228fd0[_0xf52a('0x2d')][_0xf52a('0x35')]);_0x385336[_0xf52a('0x37')]=qs[_0xf52a('0x2e')](_[_0xf52a('0x4e')](_0x228fd0[_0xf52a('0x2d')],_0x10a69a[_0xf52a('0x2e')]));if(_0x228fd0[_0xf52a('0x2d')][_0xf52a('0x36')]){_0x385336[_0xf52a('0x37')]=_[_0xf52a('0x38')](_0x385336['where'],{'$or':_[_0xf52a('0x2a')](_0x385336[_0xf52a('0x30')],function(_0x52c4aa){var _0x574bdb={};_0x574bdb[_0x52c4aa]={'$like':'%'+_0x228fd0[_0xf52a('0x2d')][_0xf52a('0x36')]+'%'};return _0x574bdb;})});}_0x385336=_['merge']({},_0x385336,_0x228fd0[_0xf52a('0x3b')]);return _0x8fb063[_0xf52a('0x4f')](_0x385336);}})['then'](function(_0x4b08e0){if(_0x4b08e0){_0x1dc7f0=_0x4b08e0['length'];if(!_0x228fd0[_0xf52a('0x2d')][_0xf52a('0x32')]('nolimit')){_0x385336[_0xf52a('0x1c')]=qs[_0xf52a('0x1c')](_0x228fd0[_0xf52a('0x2d')][_0xf52a('0x1c')]);_0x385336[_0xf52a('0x1a')]=qs[_0xf52a('0x1a')](_0x228fd0[_0xf52a('0x2d')][_0xf52a('0x1a')]);}return _0x8fb063[_0xf52a('0x4f')](_0x385336);}})[_0xf52a('0x21')](function(_0x3c78b9){if(_0x3c78b9){return _0x3c78b9?{'count':_0x1dc7f0,'rows':_0x3c78b9}:null;}})[_0xf52a('0x21')](respondWithResult(_0x593a6a,null))['catch'](handleError(_0x593a6a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4e09f03..7ccec03 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 _0xfa6a=['bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment'];(function(_0x4c4cc7,_0x4cc20a){var _0x1a296a=function(_0x4c416e){while(--_0x4c416e){_0x4c4cc7['push'](_0x4c4cc7['shift']());}};_0x1a296a(++_0x4cc20a);}(_0xfa6a,0x98));var _0xafa6=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xfa6a[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0xafa6('0x0'));var util=require(_0xafa6('0x1'));var logger=require('../../config/logger')(_0xafa6('0x2'));var moment=require(_0xafa6('0x3'));var BPromise=require(_0xafa6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafa6('0x5'));var rimraf=require(_0xafa6('0x6'));var config=require(_0xafa6('0x7'));var attributes=require(_0xafa6('0x8'));module[_0xafa6('0x9')]=function(_0x52d414,_0x24758b){return _0x52d414['define'](_0xafa6('0xa'),attributes,{'tableName':_0xafa6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b3a=['moment','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0x2c482b,_0x3fe3d3){var _0xb774b8=function(_0x145425){while(--_0x145425){_0x2c482b['push'](_0x2c482b['shift']());}};_0xb774b8(++_0x3fe3d3);}(_0x6b3a,0xbf));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6b3('0x0'));var util=require(_0xa6b3('0x1'));var logger=require(_0xa6b3('0x2'))(_0xa6b3('0x3'));var moment=require(_0xa6b3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6b3('0x5'));var rimraf=require(_0xa6b3('0x6'));var config=require(_0xa6b3('0x7'));var attributes=require(_0xa6b3('0x8'));module[_0xa6b3('0x9')]=function(_0x5db83a,_0x3cc6d8){return _0x5db83a[_0xa6b3('0xa')](_0xa6b3('0xb'),attributes,{'tableName':_0xa6b3('0xc'),'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 46061ae..29497ce 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 _0x8242=['request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x4b21b9,_0x4d08e2){var _0x49f513=function(_0x513e6b){while(--_0x513e6b){_0x4b21b9['push'](_0x4b21b9['shift']());}};_0x49f513(++_0x4d08e2);}(_0x8242,0xa3));var _0x2824=function(_0x1510a1,_0x510040){_0x1510a1=_0x1510a1-0x0;var _0x5dc0ca=_0x8242[_0x1510a1];return _0x5dc0ca;};'use strict';var _=require(_0x2824('0x0'));var util=require(_0x2824('0x1'));var moment=require('moment');var BPromise=require(_0x2824('0x2'));var rs=require(_0x2824('0x3'));var fs=require('fs');var Redis=require(_0x2824('0x4'));var db=require(_0x2824('0x5'))['db'];var utils=require(_0x2824('0x6'));var logger=require(_0x2824('0x7'))('rpc');var config=require(_0x2824('0x8'));var jayson=require(_0x2824('0x9'));var client=jayson[_0x2824('0xa')][_0x2824('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a0fe6,_0x2559e5,_0x443ec2){return new BPromise(function(_0x3a6728,_0x952fd0){return client['request'](_0x4a0fe6,_0x443ec2)[_0x2824('0xc')](function(_0x307fc2){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2559e5,_0x2824('0xd'));logger['debug'](_0x2824('0xe'),_0x2559e5,'request\x20sent',JSON[_0x2824('0xf')](_0x307fc2));if(_0x307fc2['error']){if(_0x307fc2[_0x2824('0x10')][_0x2824('0x11')]===0x1f4){logger[_0x2824('0x10')](_0x2824('0x12'),_0x2559e5,_0x307fc2[_0x2824('0x10')][_0x2824('0x13')]);return _0x952fd0(_0x307fc2[_0x2824('0x10')][_0x2824('0x13')]);}logger[_0x2824('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2559e5,_0x307fc2[_0x2824('0x10')][_0x2824('0x13')]);return _0x3a6728(_0x307fc2[_0x2824('0x10')]['message']);}else{logger[_0x2824('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2559e5,'request\x20sent');_0x3a6728(_0x307fc2['result'][_0x2824('0x13')]);}})[_0x2824('0x15')](function(_0x533fda){logger[_0x2824('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2559e5,_0x533fda);_0x952fd0(_0x533fda);});});} \ No newline at end of file +var _0x8dc1=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x2c53c8,_0x3f4592){var _0x10e6a2=function(_0x373f2c){while(--_0x373f2c){_0x2c53c8['push'](_0x2c53c8['shift']());}};_0x10e6a2(++_0x3f4592);}(_0x8dc1,0x1b7));var _0x18dc=function(_0x23bf67,_0x564d3d){_0x23bf67=_0x23bf67-0x0;var _0x8f2df5=_0x8dc1[_0x23bf67];return _0x8f2df5;};'use strict';var _=require('lodash');var util=require(_0x18dc('0x0'));var moment=require('moment');var BPromise=require(_0x18dc('0x1'));var rs=require(_0x18dc('0x2'));var fs=require('fs');var Redis=require(_0x18dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x18dc('0x4'));var logger=require('../../config/logger')(_0x18dc('0x5'));var config=require(_0x18dc('0x6'));var jayson=require(_0x18dc('0x7'));var client=jayson[_0x18dc('0x8')][_0x18dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x444945,_0x599132,_0x347161){return new BPromise(function(_0x2292cd,_0x10d638){return client[_0x18dc('0xa')](_0x444945,_0x347161)[_0x18dc('0xb')](function(_0x2a9b64){logger[_0x18dc('0xc')](_0x18dc('0xd'),_0x599132,_0x18dc('0xe'));logger[_0x18dc('0xf')](_0x18dc('0x10'),_0x599132,_0x18dc('0xe'),JSON[_0x18dc('0x11')](_0x2a9b64));if(_0x2a9b64[_0x18dc('0x12')]){if(_0x2a9b64[_0x18dc('0x12')][_0x18dc('0x13')]===0x1f4){logger[_0x18dc('0x12')](_0x18dc('0xd'),_0x599132,_0x2a9b64[_0x18dc('0x12')][_0x18dc('0x14')]);return _0x10d638(_0x2a9b64['error'][_0x18dc('0x14')]);}logger[_0x18dc('0x12')](_0x18dc('0xd'),_0x599132,_0x2a9b64[_0x18dc('0x12')][_0x18dc('0x14')]);return _0x2292cd(_0x2a9b64[_0x18dc('0x12')][_0x18dc('0x14')]);}else{logger[_0x18dc('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x599132,_0x18dc('0xe'));_0x2292cd(_0x2a9b64['result'][_0x18dc('0x14')]);}})[_0x18dc('0x15')](function(_0x217e8e){logger[_0x18dc('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x599132,_0x217e8e);_0x10d638(_0x217e8e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 411e198..19e0ef1 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 _0xedf4=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x3c741b,_0x1bee2f){var _0x4ef92f=function(_0x1261d9){while(--_0x1261d9){_0x3c741b['push'](_0x3c741b['shift']());}};_0x4ef92f(++_0x1bee2f);}(_0xedf4,0x137));var _0x4edf=function(_0xf17476,_0x18f69d){_0xf17476=_0xf17476-0x0;var _0x1bde9f=_0xedf4[_0xf17476];return _0x1bde9f;};'use strict';var multer=require(_0x4edf('0x0'));var util=require(_0x4edf('0x1'));var path=require(_0x4edf('0x2'));var timeout=require(_0x4edf('0x3'));var express=require(_0x4edf('0x4'));var router=express['Router']();var fs_extra=require(_0x4edf('0x5'));var auth=require(_0x4edf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4edf('0x7'));var controller=require(_0x4edf('0x8'));router[_0x4edf('0x9')]('/',auth[_0x4edf('0xa')](),controller[_0x4edf('0xb')]);router[_0x4edf('0x9')](_0x4edf('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4edf('0xd')]('/',auth['isAuthenticated'](),controller[_0x4edf('0xe')]);router[_0x4edf('0xf')](_0x4edf('0xc'),auth[_0x4edf('0xa')](),controller[_0x4edf('0x10')]);router[_0x4edf('0x11')]('/:id',auth[_0x4edf('0xa')](),controller[_0x4edf('0x12')]);module[_0x4edf('0x13')]=router; \ No newline at end of file +var _0x7f5f=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','multer','util','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x1d2773,_0x4915f7){var _0xb4640d=function(_0x27a8c9){while(--_0x27a8c9){_0x1d2773['push'](_0x1d2773['shift']());}};_0xb4640d(++_0x4915f7);}(_0x7f5f,0x15a));var _0xf7f5=function(_0xfd9e4e,_0x287c72){_0xfd9e4e=_0xfd9e4e-0x0;var _0x148917=_0x7f5f[_0xfd9e4e];return _0x148917;};'use strict';var multer=require(_0xf7f5('0x0'));var util=require(_0xf7f5('0x1'));var path=require('path');var timeout=require(_0xf7f5('0x2'));var express=require('express');var router=express[_0xf7f5('0x3')]();var fs_extra=require(_0xf7f5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf7f5('0x5'));var controller=require(_0xf7f5('0x6'));router[_0xf7f5('0x7')]('/',auth[_0xf7f5('0x8')](),controller[_0xf7f5('0x9')]);router['get'](_0xf7f5('0xa'),auth[_0xf7f5('0x8')](),controller['show']);router[_0xf7f5('0xb')]('/',auth[_0xf7f5('0x8')](),controller[_0xf7f5('0xc')]);router[_0xf7f5('0xd')](_0xf7f5('0xa'),auth[_0xf7f5('0x8')](),controller[_0xf7f5('0xe')]);router[_0xf7f5('0xf')](_0xf7f5('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index c58c5ca..33f1855 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 _0x7098=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x1b30a,_0x3338b4){var _0x2ca877=function(_0x1974f6){while(--_0x1974f6){_0x1b30a['push'](_0x1b30a['shift']());}};_0x2ca877(++_0x3338b4);}(_0x7098,0x1d5));var _0x8709=function(_0x106617,_0xb0c9a){_0x106617=_0x106617-0x0;var _0x33f9a9=_0x7098[_0x106617];return _0x33f9a9;};'use strict';var Sequelize=require(_0x8709('0x0'));module['exports']={'type':{'type':Sequelize[_0x8709('0x1')](_0x8709('0x2'),_0x8709('0x3'),_0x8709('0x4'),_0x8709('0x5'),'picklist'),'defaultValue':_0x8709('0x2')},'content':{'type':Sequelize[_0x8709('0x6')]},'key':{'type':Sequelize[_0x8709('0x6')]},'keyType':{'type':Sequelize[_0x8709('0x1')](_0x8709('0x2'),'variable',_0x8709('0x4'))},'keyContent':{'type':Sequelize[_0x8709('0x6')]},'idField':{'type':Sequelize[_0x8709('0x6')]},'nameField':{'type':Sequelize[_0x8709('0x6')]},'customField':{'type':Sequelize[_0x8709('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa2f9=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x56da54,_0x4dd4c5){var _0x4acd7f=function(_0x53238b){while(--_0x53238b){_0x56da54['push'](_0x56da54['shift']());}};_0x4acd7f(++_0x4dd4c5);}(_0xa2f9,0x12a));var _0x9a2f=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0xa2f9[_0xe6e78c];return _0x2a09c8;};'use strict';var Sequelize=require(_0x9a2f('0x0'));module[_0x9a2f('0x1')]={'type':{'type':Sequelize[_0x9a2f('0x2')](_0x9a2f('0x3'),_0x9a2f('0x4'),_0x9a2f('0x5'),_0x9a2f('0x6'),_0x9a2f('0x7')),'defaultValue':_0x9a2f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9a2f('0x8')]},'keyType':{'type':Sequelize[_0x9a2f('0x2')]('string',_0x9a2f('0x4'),_0x9a2f('0x5'))},'keyContent':{'type':Sequelize[_0x9a2f('0x8')]},'idField':{'type':Sequelize[_0x9a2f('0x8')]},'nameField':{'type':Sequelize[_0x9a2f('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9a2f('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index ae2e758..96cc9f5 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 _0x854b=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','length','options','find','create','body','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x297269,_0x568256){var _0x4ba584=function(_0x5869df){while(--_0x5869df){_0x297269['push'](_0x297269['shift']());}};_0x4ba584(++_0x568256);}(_0x854b,0x1b0));var _0xb854=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x854b[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb854('0x0'));var rp=require('request-promise');var moment=require(_0xb854('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xb854('0x2'));var util=require(_0xb854('0x3'));var path=require(_0xb854('0x4'));var sox=require(_0xb854('0x5'));var csv=require('to-csv');var ejs=require(_0xb854('0x6'));var fs=require('fs');var fs_extra=require(_0xb854('0x7'));var _=require(_0xb854('0x8'));var squel=require(_0xb854('0x9'));var crypto=require(_0xb854('0xa'));var jsforce=require(_0xb854('0xb'));var deskjs=require(_0xb854('0xc'));var toCsv=require(_0xb854('0xd'));var querystring=require(_0xb854('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb854('0xf'));var as=require(_0xb854('0x10'));var hardwareService=require(_0xb854('0x11'));var logger=require(_0xb854('0x12'))(_0xb854('0x13'));var utils=require('../../config/utils');var config=require(_0xb854('0x14'));var licenseUtil=require(_0xb854('0x15'));var db=require(_0xb854('0x16'))['db'];function respondWithStatusCode(_0x679a72,_0x1f2d7d){_0x1f2d7d=_0x1f2d7d||0xcc;return function(_0x5ae8f3){if(_0x5ae8f3){return _0x679a72[_0xb854('0x17')](_0x1f2d7d);}return _0x679a72[_0xb854('0x18')](_0x1f2d7d)[_0xb854('0x19')]();};}function respondWithResult(_0x466b74,_0x2c2fcf){_0x2c2fcf=_0x2c2fcf||0xc8;return function(_0x109eda){if(_0x109eda){return _0x466b74['status'](_0x2c2fcf)[_0xb854('0x1a')](_0x109eda);}};}function respondWithFilteredResult(_0x3bf4ca,_0x332c2d){return function(_0x3b0544){if(_0x3b0544){var _0x306d1b=typeof _0x332c2d[_0xb854('0x1b')]==='undefined'&&typeof _0x332c2d[_0xb854('0x1c')]==='undefined';var _0x1741a8=_0x3b0544[_0xb854('0x1d')];var _0x5416cd=_0x306d1b?0x0:_0x332c2d['offset'];var _0x4d1ef4=_0x306d1b?_0x3b0544['count']:_0x332c2d[_0xb854('0x1b')]+_0x332c2d[_0xb854('0x1c')];var _0x42d692;if(_0x4d1ef4>=_0x1741a8){_0x4d1ef4=_0x1741a8;_0x42d692=0xc8;}else{_0x42d692=0xce;}_0x3bf4ca['status'](_0x42d692);return _0x3bf4ca[_0xb854('0x1e')](_0xb854('0x1f'),_0x5416cd+'-'+_0x4d1ef4+'/'+_0x1741a8)[_0xb854('0x1a')](_0x3b0544);}return null;};}function patchUpdates(_0x3ee9ec){return function(_0x171abf){try{jsonpatch['apply'](_0x171abf,_0x3ee9ec,!![]);}catch(_0x1fce43){return BPromise[_0xb854('0x20')](_0x1fce43);}return _0x171abf['save']();};}function saveUpdates(_0x3a1269,_0x4cc509){return function(_0x1049e2){if(_0x1049e2){return _0x1049e2[_0xb854('0x21')](_0x3a1269)[_0xb854('0x22')](function(_0x59cd40){return _0x59cd40;});}return null;};}function removeEntity(_0x248407,_0x621f6){return function(_0x1421b3){if(_0x1421b3){return _0x1421b3[_0xb854('0x23')]()[_0xb854('0x22')](function(){_0x248407[_0xb854('0x18')](0xcc)[_0xb854('0x19')]();});}};}function handleEntityNotFound(_0x422609,_0x7158dc){return function(_0x5de109){if(!_0x5de109){_0x422609['sendStatus'](0x194);}return _0x5de109;};}function handleError(_0x25a422,_0x487c4e){_0x487c4e=_0x487c4e||0x1f4;return function(_0x58aee2){logger[_0xb854('0x24')](_0x58aee2[_0xb854('0x25')]);if(_0x58aee2[_0xb854('0x26')]){delete _0x58aee2[_0xb854('0x26')];}_0x25a422[_0xb854('0x18')](_0x487c4e)[_0xb854('0x27')](_0x58aee2);};}exports[_0xb854('0x28')]=function(_0x2ff260,_0x4fe062){var _0x5379db={},_0xdcedbf={},_0x33931e={'count':0x0,'rows':[]};var _0x776086=_[_0xb854('0x29')](db[_0xb854('0x2a')][_0xb854('0x2b')],function(_0x4db5a1){return{'name':_0x4db5a1[_0xb854('0x2c')],'type':_0x4db5a1[_0xb854('0x2d')][_0xb854('0x2e')]};});_0xdcedbf[_0xb854('0x2f')]=_['map'](_0x776086,_0xb854('0x26'));_0xdcedbf['query']=_[_0xb854('0x30')](_0x2ff260[_0xb854('0x31')]);_0xdcedbf[_0xb854('0x32')]=_[_0xb854('0x33')](_0xdcedbf[_0xb854('0x2f')],_0xdcedbf[_0xb854('0x31')]);_0x5379db['attributes']=_[_0xb854('0x33')](_0xdcedbf[_0xb854('0x2f')],qs[_0xb854('0x34')](_0x2ff260[_0xb854('0x31')][_0xb854('0x34')]));_0x5379db['attributes']=_0x5379db['attributes']['length']?_0x5379db[_0xb854('0x35')]:_0xdcedbf['model'];if(!_0x2ff260[_0xb854('0x31')][_0xb854('0x36')](_0xb854('0x37'))){_0x5379db[_0xb854('0x1c')]=qs[_0xb854('0x1c')](_0x2ff260[_0xb854('0x31')][_0xb854('0x1c')]);_0x5379db[_0xb854('0x1b')]=qs['offset'](_0x2ff260[_0xb854('0x31')][_0xb854('0x1b')]);}_0x5379db[_0xb854('0x38')]=qs[_0xb854('0x39')](_0x2ff260['query'][_0xb854('0x39')]);_0x5379db[_0xb854('0x3a')]=qs['filters'](_[_0xb854('0x3b')](_0x2ff260[_0xb854('0x31')],_0xdcedbf[_0xb854('0x32')]),_0x776086);if(_0x2ff260[_0xb854('0x31')][_0xb854('0x3c')]){_0x5379db[_0xb854('0x3a')]=_[_0xb854('0x3d')](_0x5379db[_0xb854('0x3a')],{'$or':_[_0xb854('0x29')](_0x776086,function(_0x5a8840){if(_0x5a8840[_0xb854('0x2d')]!==_0xb854('0x3e')){var _0x1def3c={};_0x1def3c[_0x5a8840[_0xb854('0x26')]]={'$like':'%'+_0x2ff260[_0xb854('0x31')][_0xb854('0x3c')]+'%'};return _0x1def3c;}})});}_0x5379db=_[_0xb854('0x3d')]({},_0x5379db,_0x2ff260['options']);var _0x4c7767={'where':_0x5379db['where']};return db['SugarcrmField'][_0xb854('0x1d')](_0x4c7767)[_0xb854('0x22')](function(_0x1043db){_0x33931e[_0xb854('0x1d')]=_0x1043db;if(_0x2ff260[_0xb854('0x31')][_0xb854('0x3f')]){_0x5379db['include']=[{'all':!![]}];}return db[_0xb854('0x2a')]['findAll'](_0x5379db);})[_0xb854('0x22')](function(_0xac2b9e){_0x33931e[_0xb854('0x40')]=_0xac2b9e;return _0x33931e;})[_0xb854('0x22')](respondWithFilteredResult(_0x4fe062,_0x5379db))[_0xb854('0x41')](handleError(_0x4fe062,null));};exports[_0xb854('0x42')]=function(_0x59ce40,_0x4d2007){var _0x43bd9e={'raw':!![],'where':{'id':_0x59ce40[_0xb854('0x43')]['id']}},_0x32f820={};_0x32f820[_0xb854('0x2f')]=_[_0xb854('0x30')](db['SugarcrmField']['rawAttributes']);_0x32f820[_0xb854('0x31')]=_['keys'](_0x59ce40[_0xb854('0x31')]);_0x32f820['filters']=_['intersection'](_0x32f820[_0xb854('0x2f')],_0x32f820[_0xb854('0x31')]);_0x43bd9e[_0xb854('0x35')]=_[_0xb854('0x33')](_0x32f820[_0xb854('0x2f')],qs[_0xb854('0x34')](_0x59ce40[_0xb854('0x31')][_0xb854('0x34')]));_0x43bd9e[_0xb854('0x35')]=_0x43bd9e[_0xb854('0x35')][_0xb854('0x44')]?_0x43bd9e[_0xb854('0x35')]:_0x32f820[_0xb854('0x2f')];if(_0x59ce40['query'][_0xb854('0x3f')]){_0x43bd9e['include']=[{'all':!![]}];}_0x43bd9e=_['merge']({},_0x43bd9e,_0x59ce40[_0xb854('0x45')]);return db[_0xb854('0x2a')][_0xb854('0x46')](_0x43bd9e)['then'](handleEntityNotFound(_0x4d2007,null))['then'](respondWithResult(_0x4d2007,null))[_0xb854('0x41')](handleError(_0x4d2007,null));};exports[_0xb854('0x47')]=function(_0x31212f,_0xd99177){return db['SugarcrmField'][_0xb854('0x47')](_0x31212f[_0xb854('0x48')],{})[_0xb854('0x22')](respondWithResult(_0xd99177,0xc9))[_0xb854('0x41')](handleError(_0xd99177,null));};exports['update']=function(_0x168a97,_0x3904a1){if(_0x168a97[_0xb854('0x48')]['id']){delete _0x168a97[_0xb854('0x48')]['id'];}return db[_0xb854('0x2a')][_0xb854('0x46')]({'where':{'id':_0x168a97[_0xb854('0x43')]['id']}})[_0xb854('0x22')](handleEntityNotFound(_0x3904a1,null))[_0xb854('0x22')](saveUpdates(_0x168a97['body'],null))[_0xb854('0x22')](respondWithResult(_0x3904a1,null))['catch'](handleError(_0x3904a1,null));};exports[_0xb854('0x23')]=function(_0x13324b,_0x23b8ff){return db[_0xb854('0x2a')][_0xb854('0x46')]({'where':{'id':_0x13324b[_0xb854('0x43')]['id']}})['then'](handleEntityNotFound(_0x23b8ff,null))['then'](removeEntity(_0x23b8ff,null))[_0xb854('0x41')](handleError(_0x23b8ff,null));}; \ No newline at end of file +var _0x46ce=['destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','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','json','offset','undefined','limit','count','set','apply','update','then'];(function(_0x43c8a8,_0x5917bf){var _0x548de6=function(_0x4ab272){while(--_0x4ab272){_0x43c8a8['push'](_0x43c8a8['shift']());}};_0x548de6(++_0x5917bf);}(_0x46ce,0x101));var _0xe46c=function(_0x109920,_0x36102e){_0x109920=_0x109920-0x0;var _0x4ed9f5=_0x46ce[_0x109920];return _0x4ed9f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe46c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe46c('0x1'));var moment=require(_0xe46c('0x2'));var BPromise=require(_0xe46c('0x3'));var Mustache=require(_0xe46c('0x4'));var util=require('util');var path=require(_0xe46c('0x5'));var sox=require(_0xe46c('0x6'));var csv=require(_0xe46c('0x7'));var ejs=require(_0xe46c('0x8'));var fs=require('fs');var fs_extra=require(_0xe46c('0x9'));var _=require('lodash');var squel=require(_0xe46c('0xa'));var crypto=require('crypto');var jsforce=require(_0xe46c('0xb'));var deskjs=require(_0xe46c('0xc'));var toCsv=require(_0xe46c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe46c('0xd'));var authService=require(_0xe46c('0xe'));var qs=require(_0xe46c('0xf'));var as=require(_0xe46c('0x10'));var hardwareService=require(_0xe46c('0x11'));var logger=require(_0xe46c('0x12'))(_0xe46c('0x13'));var utils=require(_0xe46c('0x14'));var config=require(_0xe46c('0x15'));var licenseUtil=require(_0xe46c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x143afb,_0x312476){_0x312476=_0x312476||0xcc;return function(_0x46c17a){if(_0x46c17a){return _0x143afb[_0xe46c('0x17')](_0x312476);}return _0x143afb[_0xe46c('0x18')](_0x312476)[_0xe46c('0x19')]();};}function respondWithResult(_0x227c9c,_0x143388){_0x143388=_0x143388||0xc8;return function(_0x45edc0){if(_0x45edc0){return _0x227c9c[_0xe46c('0x18')](_0x143388)[_0xe46c('0x1a')](_0x45edc0);}};}function respondWithFilteredResult(_0x5c5d97,_0x25ea0a){return function(_0x3408d1){if(_0x3408d1){var _0xa26891=typeof _0x25ea0a[_0xe46c('0x1b')]===_0xe46c('0x1c')&&typeof _0x25ea0a[_0xe46c('0x1d')]==='undefined';var _0x6c0f29=_0x3408d1[_0xe46c('0x1e')];var _0x3dcd1d=_0xa26891?0x0:_0x25ea0a[_0xe46c('0x1b')];var _0x51da07=_0xa26891?_0x3408d1[_0xe46c('0x1e')]:_0x25ea0a['offset']+_0x25ea0a[_0xe46c('0x1d')];var _0x531acb;if(_0x51da07>=_0x6c0f29){_0x51da07=_0x6c0f29;_0x531acb=0xc8;}else{_0x531acb=0xce;}_0x5c5d97[_0xe46c('0x18')](_0x531acb);return _0x5c5d97[_0xe46c('0x1f')]('Content-Range',_0x3dcd1d+'-'+_0x51da07+'/'+_0x6c0f29)[_0xe46c('0x1a')](_0x3408d1);}return null;};}function patchUpdates(_0x317da2){return function(_0x34a76e){try{jsonpatch[_0xe46c('0x20')](_0x34a76e,_0x317da2,!![]);}catch(_0x538929){return BPromise['reject'](_0x538929);}return _0x34a76e['save']();};}function saveUpdates(_0x1c36e5,_0xe98462){return function(_0x44ff59){if(_0x44ff59){return _0x44ff59[_0xe46c('0x21')](_0x1c36e5)[_0xe46c('0x22')](function(_0x4d5021){return _0x4d5021;});}return null;};}function removeEntity(_0x2fc75e,_0x2cba5b){return function(_0x1615e9){if(_0x1615e9){return _0x1615e9[_0xe46c('0x23')]()[_0xe46c('0x22')](function(){_0x2fc75e[_0xe46c('0x18')](0xcc)[_0xe46c('0x19')]();});}};}function handleEntityNotFound(_0x25e606,_0x2aca2a){return function(_0x3ec373){if(!_0x3ec373){_0x25e606['sendStatus'](0x194);}return _0x3ec373;};}function handleError(_0x4bb5cb,_0x3f2872){_0x3f2872=_0x3f2872||0x1f4;return function(_0x4c2591){logger[_0xe46c('0x24')](_0x4c2591[_0xe46c('0x25')]);if(_0x4c2591[_0xe46c('0x26')]){delete _0x4c2591[_0xe46c('0x26')];}_0x4bb5cb[_0xe46c('0x18')](_0x3f2872)[_0xe46c('0x27')](_0x4c2591);};}exports['index']=function(_0x204084,_0x299c82){var _0x50c1ab={},_0x2c9191={},_0x21a172={'count':0x0,'rows':[]};var _0x11418c=_[_0xe46c('0x28')](db[_0xe46c('0x29')][_0xe46c('0x2a')],function(_0x25e116){return{'name':_0x25e116[_0xe46c('0x2b')],'type':_0x25e116[_0xe46c('0x2c')][_0xe46c('0x2d')]};});_0x2c9191[_0xe46c('0x2e')]=_[_0xe46c('0x28')](_0x11418c,_0xe46c('0x26'));_0x2c9191[_0xe46c('0x2f')]=_['keys'](_0x204084['query']);_0x2c9191[_0xe46c('0x30')]=_[_0xe46c('0x31')](_0x2c9191[_0xe46c('0x2e')],_0x2c9191[_0xe46c('0x2f')]);_0x50c1ab[_0xe46c('0x32')]=_['intersection'](_0x2c9191['model'],qs[_0xe46c('0x33')](_0x204084[_0xe46c('0x2f')][_0xe46c('0x33')]));_0x50c1ab[_0xe46c('0x32')]=_0x50c1ab[_0xe46c('0x32')][_0xe46c('0x34')]?_0x50c1ab['attributes']:_0x2c9191['model'];if(!_0x204084[_0xe46c('0x2f')][_0xe46c('0x35')](_0xe46c('0x36'))){_0x50c1ab[_0xe46c('0x1d')]=qs[_0xe46c('0x1d')](_0x204084[_0xe46c('0x2f')][_0xe46c('0x1d')]);_0x50c1ab[_0xe46c('0x1b')]=qs[_0xe46c('0x1b')](_0x204084[_0xe46c('0x2f')]['offset']);}_0x50c1ab[_0xe46c('0x37')]=qs['sort'](_0x204084[_0xe46c('0x2f')][_0xe46c('0x38')]);_0x50c1ab[_0xe46c('0x39')]=qs[_0xe46c('0x30')](_['pick'](_0x204084[_0xe46c('0x2f')],_0x2c9191['filters']),_0x11418c);if(_0x204084[_0xe46c('0x2f')][_0xe46c('0x3a')]){_0x50c1ab[_0xe46c('0x39')]=_['merge'](_0x50c1ab[_0xe46c('0x39')],{'$or':_['map'](_0x11418c,function(_0x1bf4b3){if(_0x1bf4b3[_0xe46c('0x2c')]!==_0xe46c('0x3b')){var _0x5bdccc={};_0x5bdccc[_0x1bf4b3[_0xe46c('0x26')]]={'$like':'%'+_0x204084[_0xe46c('0x2f')]['filter']+'%'};return _0x5bdccc;}})});}_0x50c1ab=_[_0xe46c('0x3c')]({},_0x50c1ab,_0x204084[_0xe46c('0x3d')]);var _0x57bfa0={'where':_0x50c1ab['where']};return db['SugarcrmField']['count'](_0x57bfa0)[_0xe46c('0x22')](function(_0x4931f6){_0x21a172[_0xe46c('0x1e')]=_0x4931f6;if(_0x204084[_0xe46c('0x2f')][_0xe46c('0x3e')]){_0x50c1ab[_0xe46c('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0xe46c('0x40')](_0x50c1ab);})[_0xe46c('0x22')](function(_0x420e41){_0x21a172[_0xe46c('0x41')]=_0x420e41;return _0x21a172;})[_0xe46c('0x22')](respondWithFilteredResult(_0x299c82,_0x50c1ab))[_0xe46c('0x42')](handleError(_0x299c82,null));};exports[_0xe46c('0x43')]=function(_0xe6db9c,_0xd9ca09){var _0x2e0ad1={'raw':!![],'where':{'id':_0xe6db9c['params']['id']}},_0x38ad3d={};_0x38ad3d[_0xe46c('0x2e')]=_[_0xe46c('0x44')](db[_0xe46c('0x29')][_0xe46c('0x2a')]);_0x38ad3d[_0xe46c('0x2f')]=_[_0xe46c('0x44')](_0xe6db9c[_0xe46c('0x2f')]);_0x38ad3d[_0xe46c('0x30')]=_[_0xe46c('0x31')](_0x38ad3d[_0xe46c('0x2e')],_0x38ad3d['query']);_0x2e0ad1[_0xe46c('0x32')]=_[_0xe46c('0x31')](_0x38ad3d[_0xe46c('0x2e')],qs['fields'](_0xe6db9c[_0xe46c('0x2f')]['fields']));_0x2e0ad1[_0xe46c('0x32')]=_0x2e0ad1[_0xe46c('0x32')][_0xe46c('0x34')]?_0x2e0ad1[_0xe46c('0x32')]:_0x38ad3d[_0xe46c('0x2e')];if(_0xe6db9c[_0xe46c('0x2f')][_0xe46c('0x3e')]){_0x2e0ad1[_0xe46c('0x3f')]=[{'all':!![]}];}_0x2e0ad1=_[_0xe46c('0x3c')]({},_0x2e0ad1,_0xe6db9c['options']);return db['SugarcrmField'][_0xe46c('0x45')](_0x2e0ad1)[_0xe46c('0x22')](handleEntityNotFound(_0xd9ca09,null))[_0xe46c('0x22')](respondWithResult(_0xd9ca09,null))[_0xe46c('0x42')](handleError(_0xd9ca09,null));};exports[_0xe46c('0x46')]=function(_0x7c48f8,_0x37fe8f){return db[_0xe46c('0x29')]['create'](_0x7c48f8[_0xe46c('0x47')],{})[_0xe46c('0x22')](respondWithResult(_0x37fe8f,0xc9))[_0xe46c('0x42')](handleError(_0x37fe8f,null));};exports[_0xe46c('0x21')]=function(_0x3e6312,_0x44ecff){if(_0x3e6312[_0xe46c('0x47')]['id']){delete _0x3e6312[_0xe46c('0x47')]['id'];}return db[_0xe46c('0x29')][_0xe46c('0x45')]({'where':{'id':_0x3e6312[_0xe46c('0x48')]['id']}})[_0xe46c('0x22')](handleEntityNotFound(_0x44ecff,null))[_0xe46c('0x22')](saveUpdates(_0x3e6312[_0xe46c('0x47')],null))[_0xe46c('0x22')](respondWithResult(_0x44ecff,null))[_0xe46c('0x42')](handleError(_0x44ecff,null));};exports[_0xe46c('0x23')]=function(_0x405427,_0x1519de){return db['SugarcrmField'][_0xe46c('0x45')]({'where':{'id':_0x405427[_0xe46c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1519de,null))['then'](removeEntity(_0x1519de,null))[_0xe46c('0x42')](handleError(_0x1519de,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7c04db3..04c2bbd 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 _0xf2f6=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0xf2f6,0x18e));var _0x6f2f=function(_0x2d5f7f,_0x16d175){_0x2d5f7f=_0x2d5f7f-0x0;var _0x4461c0=_0xf2f6[_0x2d5f7f];return _0x4461c0;};'use strict';var _=require(_0x6f2f('0x0'));var util=require(_0x6f2f('0x1'));var logger=require(_0x6f2f('0x2'))(_0x6f2f('0x3'));var moment=require('moment');var BPromise=require(_0x6f2f('0x4'));var rp=require(_0x6f2f('0x5'));var fs=require('fs');var path=require(_0x6f2f('0x6'));var rimraf=require(_0x6f2f('0x7'));var config=require(_0x6f2f('0x8'));var attributes=require(_0x6f2f('0x9'));module[_0x6f2f('0xa')]=function(_0x4f278d,_0x426205){return _0x4f278d[_0x6f2f('0xb')](_0x6f2f('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x6f2f('0xd'),'fields':[_0x6f2f('0xe'),_0x6f2f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84f6=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x54cec2,_0x5dd20f){var _0x26dbbd=function(_0x1e5bc2){while(--_0x1e5bc2){_0x54cec2['push'](_0x54cec2['shift']());}};_0x26dbbd(++_0x5dd20f);}(_0x84f6,0x1d4));var _0x684f=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0x84f6[_0x375492];return _0x18ba5b;};'use strict';var _=require('lodash');var util=require(_0x684f('0x0'));var logger=require(_0x684f('0x1'))(_0x684f('0x2'));var moment=require('moment');var BPromise=require(_0x684f('0x3'));var rp=require(_0x684f('0x4'));var fs=require('fs');var path=require(_0x684f('0x5'));var rimraf=require(_0x684f('0x6'));var config=require(_0x684f('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x3b8ab7,_0x3091c9){return _0x3b8ab7[_0x684f('0x8')](_0x684f('0x9'),attributes,{'tableName':_0x684f('0xa'),'paranoid':![],'indexes':[{'name':_0x684f('0xb'),'fields':[_0x684f('0xc'),_0x684f('0xd')],'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 f145143..82f3669 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 _0x34b0=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x34b0,0x142));var _0x034b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x34b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x034b('0x0'));var util=require(_0x034b('0x1'));var moment=require(_0x034b('0x2'));var BPromise=require(_0x034b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x034b('0x4'))['db'];var utils=require(_0x034b('0x5'));var logger=require(_0x034b('0x6'))(_0x034b('0x7'));var config=require(_0x034b('0x8'));var jayson=require(_0x034b('0x9'));var client=jayson[_0x034b('0xa')][_0x034b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53478d,_0x1ae850,_0x1130c8){return new BPromise(function(_0x261bc2,_0x5cc91c){return client[_0x034b('0xc')](_0x53478d,_0x1130c8)[_0x034b('0xd')](function(_0x435baf){logger[_0x034b('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x1ae850,_0x034b('0xf'));logger[_0x034b('0x10')](_0x034b('0x11'),_0x1ae850,_0x034b('0xf'),JSON[_0x034b('0x12')](_0x435baf));if(_0x435baf[_0x034b('0x13')]){if(_0x435baf[_0x034b('0x13')][_0x034b('0x14')]===0x1f4){logger['error'](_0x034b('0x15'),_0x1ae850,_0x435baf[_0x034b('0x13')][_0x034b('0x16')]);return _0x5cc91c(_0x435baf[_0x034b('0x13')][_0x034b('0x16')]);}logger['error'](_0x034b('0x15'),_0x1ae850,_0x435baf[_0x034b('0x13')][_0x034b('0x16')]);return _0x261bc2(_0x435baf[_0x034b('0x13')]['message']);}else{logger[_0x034b('0xe')](_0x034b('0x15'),_0x1ae850,_0x034b('0xf'));_0x261bc2(_0x435baf[_0x034b('0x17')]['message']);}})[_0x034b('0x18')](function(_0x502391){logger['error'](_0x034b('0x15'),_0x1ae850,_0x502391);_0x5cc91c(_0x502391);});});} \ No newline at end of file +var _0x9831=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3d59ee,_0x193901){var _0x5e4582=function(_0x3e16b9){while(--_0x3e16b9){_0x3d59ee['push'](_0x3d59ee['shift']());}};_0x5e4582(++_0x193901);}(_0x9831,0xb9));var _0x1983=function(_0x2f6e5a,_0xfa394f){_0x2f6e5a=_0x2f6e5a-0x0;var _0x3773ea=_0x9831[_0x2f6e5a];return _0x3773ea;};'use strict';var _=require(_0x1983('0x0'));var util=require(_0x1983('0x1'));var moment=require('moment');var BPromise=require(_0x1983('0x2'));var rs=require(_0x1983('0x3'));var fs=require('fs');var Redis=require(_0x1983('0x4'));var db=require(_0x1983('0x5'))['db'];var utils=require(_0x1983('0x6'));var logger=require(_0x1983('0x7'))(_0x1983('0x8'));var config=require(_0x1983('0x9'));var jayson=require(_0x1983('0xa'));var client=jayson[_0x1983('0xb')][_0x1983('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8a0678,_0x27421a,_0x38b1cf){return new BPromise(function(_0x2a60e8,_0x37f755){return client[_0x1983('0xd')](_0x8a0678,_0x38b1cf)[_0x1983('0xe')](function(_0x1fa94b){logger['info'](_0x1983('0xf'),_0x27421a,_0x1983('0x10'));logger[_0x1983('0x11')](_0x1983('0x12'),_0x27421a,'request\x20sent',JSON['stringify'](_0x1fa94b));if(_0x1fa94b[_0x1983('0x13')]){if(_0x1fa94b[_0x1983('0x13')][_0x1983('0x14')]===0x1f4){logger[_0x1983('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x27421a,_0x1fa94b[_0x1983('0x13')][_0x1983('0x15')]);return _0x37f755(_0x1fa94b['error'][_0x1983('0x15')]);}logger['error'](_0x1983('0xf'),_0x27421a,_0x1fa94b['error'][_0x1983('0x15')]);return _0x2a60e8(_0x1fa94b[_0x1983('0x13')][_0x1983('0x15')]);}else{logger[_0x1983('0x16')](_0x1983('0xf'),_0x27421a,'request\x20sent');_0x2a60e8(_0x1fa94b[_0x1983('0x17')]['message']);}})[_0x1983('0x18')](function(_0x79ad99){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x27421a,_0x79ad99);_0x37f755(_0x79ad99);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 7960637..6ba1daf 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 _0xbefb=['get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x995198,_0xd33e9c){var _0xe3b3b7=function(_0x4021ca){while(--_0x4021ca){_0x995198['push'](_0x995198['shift']());}};_0xe3b3b7(++_0xd33e9c);}(_0xbefb,0x13c));var _0xbbef=function(_0xefba11,_0x273890){_0xefba11=_0xefba11-0x0;var _0x2afdef=_0xbefb[_0xefba11];return _0x2afdef;};'use strict';var multer=require(_0xbbef('0x0'));var util=require(_0xbbef('0x1'));var path=require('path');var timeout=require(_0xbbef('0x2'));var express=require(_0xbbef('0x3'));var router=express['Router']();var fs_extra=require(_0xbbef('0x4'));var auth=require(_0xbbef('0x5'));var interaction=require(_0xbbef('0x6'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xbbef('0x7')](),controller['index']);router[_0xbbef('0x8')](_0xbbef('0x9'),auth[_0xbbef('0x7')](),controller['show']);router[_0xbbef('0x8')](_0xbbef('0xa'),auth[_0xbbef('0x7')](),controller[_0xbbef('0xb')]);router['get'](_0xbbef('0xc'),auth['isAuthenticated'](),controller[_0xbbef('0xd')]);router[_0xbbef('0xe')]('/',auth[_0xbbef('0x7')](),controller['create']);router['post'](_0xbbef('0xa'),auth[_0xbbef('0x7')](),controller[_0xbbef('0xf')]);router['put']('/:id',auth[_0xbbef('0x7')](),controller[_0xbbef('0x10')]);router['delete'](_0xbbef('0x9'),auth[_0xbbef('0x7')](),controller['destroy']);module[_0xbbef('0x11')]=router; \ No newline at end of file +var _0x4a81=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','delete','destroy','multer'];(function(_0x56b034,_0xb96f9b){var _0x25f338=function(_0x4134cd){while(--_0x4134cd){_0x56b034['push'](_0x56b034['shift']());}};_0x25f338(++_0xb96f9b);}(_0x4a81,0x1b7));var _0x14a8=function(_0x4c00b0,_0x14f19c){_0x4c00b0=_0x4c00b0-0x0;var _0x56787b=_0x4a81[_0x4c00b0];return _0x56787b;};'use strict';var multer=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var path=require(_0x14a8('0x2'));var timeout=require(_0x14a8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x14a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x14a8('0x5'));var config=require(_0x14a8('0x6'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x14a8('0x7')](),controller['index']);router[_0x14a8('0x8')]('/:id',auth[_0x14a8('0x7')](),controller[_0x14a8('0x9')]);router[_0x14a8('0x8')](_0x14a8('0xa'),auth[_0x14a8('0x7')](),controller['getConfigurations']);router['get'](_0x14a8('0xb'),auth[_0x14a8('0x7')](),controller[_0x14a8('0xc')]);router['post']('/',auth[_0x14a8('0x7')](),controller[_0x14a8('0xd')]);router[_0x14a8('0xe')](_0x14a8('0xa'),auth[_0x14a8('0x7')](),controller[_0x14a8('0xf')]);router[_0x14a8('0x10')](_0x14a8('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x14a8('0x12')](_0x14a8('0x11'),auth['isAuthenticated'](),controller[_0x14a8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index e2ede19..0357c3a 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 _0x162d=['exports','STRING','HelpDesk','sequelize'];(function(_0x44138f,_0x4c5a10){var _0x1da9fb=function(_0x424306){while(--_0x424306){_0x44138f['push'](_0x44138f['shift']());}};_0x1da9fb(++_0x4c5a10);}(_0x162d,0x103));var _0xd162=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x162d[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xd162('0x0'));module[_0xd162('0x1')]={'name':{'type':Sequelize[_0xd162('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd162('0x2')]},'username':{'type':Sequelize[_0xd162('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd162('0x2')],'allowNull':![],'defaultValue':_0xd162('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd162('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x81f2=['STRING','HelpDesk','exports'];(function(_0x210157,_0x27d65a){var _0x3b44a2=function(_0x378824){while(--_0x378824){_0x210157['push'](_0x210157['shift']());}};_0x3b44a2(++_0x27d65a);}(_0x81f2,0x1d9));var _0x281f=function(_0x41a4bb,_0x36b115){_0x41a4bb=_0x41a4bb-0x0;var _0x4d4239=_0x81f2[_0x41a4bb];return _0x4d4239;};'use strict';var Sequelize=require('sequelize');module[_0x281f('0x0')]={'name':{'type':Sequelize[_0x281f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x281f('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x281f('0x1')],'allowNull':![],'defaultValue':_0x281f('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x281f('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x281f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 53f6e1a..625e1cc 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 _0x2b25=['attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VtigerAccount','rows','catch','show','params','keys','intersection','create','body','find','getConfigurations','findOne','VtigerConfiguration','sort','AccountId','Subjects','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','sessionName','autogenerated','reference','includes','false','label','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','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','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','fields'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x2b25,0x1b8));var _0x52b2=function(_0x512738,_0x52ef6b){_0x512738=_0x512738-0x0;var _0x1bdb2b=_0x2b25[_0x512738];return _0x1bdb2b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52b2('0x0'));var zipdir=require(_0x52b2('0x1'));var jsonpatch=require(_0x52b2('0x2'));var rp=require(_0x52b2('0x3'));var moment=require('moment');var BPromise=require(_0x52b2('0x4'));var Mustache=require('mustache');var util=require(_0x52b2('0x5'));var path=require('path');var sox=require(_0x52b2('0x6'));var csv=require(_0x52b2('0x7'));var ejs=require(_0x52b2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52b2('0x9'));var squel=require(_0x52b2('0xa'));var crypto=require(_0x52b2('0xb'));var jsforce=require(_0x52b2('0xc'));var deskjs=require(_0x52b2('0xd'));var toCsv=require(_0x52b2('0x7'));var querystring=require(_0x52b2('0xe'));var Papa=require(_0x52b2('0xf'));var Redis=require(_0x52b2('0x10'));var authService=require(_0x52b2('0x11'));var qs=require(_0x52b2('0x12'));var as=require(_0x52b2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52b2('0x14'))(_0x52b2('0x15'));var utils=require(_0x52b2('0x16'));var config=require(_0x52b2('0x17'));var licenseUtil=require(_0x52b2('0x18'));var db=require(_0x52b2('0x19'))['db'];var integrations=require(_0x52b2('0x1a'));function respondWithStatusCode(_0x2ab246,_0x2dd64a){_0x2dd64a=_0x2dd64a||0xcc;return function(_0x37a57d){if(_0x37a57d){return _0x2ab246['sendStatus'](_0x2dd64a);}return _0x2ab246[_0x52b2('0x1b')](_0x2dd64a)['end']();};}function respondWithResult(_0x52a57c,_0x1fa9c3){_0x1fa9c3=_0x1fa9c3||0xc8;return function(_0x4d58a5){if(_0x4d58a5){return _0x52a57c[_0x52b2('0x1b')](_0x1fa9c3)['json'](_0x4d58a5);}};}function respondWithFilteredResult(_0x50dd1e,_0x44aef8){return function(_0xedcb0d){if(_0xedcb0d){var _0x155cff=typeof _0x44aef8['offset']===_0x52b2('0x1c')&&typeof _0x44aef8[_0x52b2('0x1d')]===_0x52b2('0x1c');var _0x27b8db=_0xedcb0d[_0x52b2('0x1e')];var _0x2fe90e=_0x155cff?0x0:_0x44aef8[_0x52b2('0x1f')];var _0x2852e7=_0x155cff?_0xedcb0d['count']:_0x44aef8[_0x52b2('0x1f')]+_0x44aef8[_0x52b2('0x1d')];var _0x4dfae2;if(_0x2852e7>=_0x27b8db){_0x2852e7=_0x27b8db;_0x4dfae2=0xc8;}else{_0x4dfae2=0xce;}_0x50dd1e[_0x52b2('0x1b')](_0x4dfae2);return _0x50dd1e[_0x52b2('0x20')](_0x52b2('0x21'),_0x2fe90e+'-'+_0x2852e7+'/'+_0x27b8db)[_0x52b2('0x22')](_0xedcb0d);}return null;};}function patchUpdates(_0x572512){return function(_0x486df4){try{jsonpatch[_0x52b2('0x23')](_0x486df4,_0x572512,!![]);}catch(_0x5fa7c0){return BPromise[_0x52b2('0x24')](_0x5fa7c0);}return _0x486df4[_0x52b2('0x25')]();};}function saveUpdates(_0x5b356b,_0x329dfb){return function(_0x2773bb){if(_0x2773bb){return _0x2773bb[_0x52b2('0x26')](_0x5b356b)['then'](function(_0x1e4f4e){return _0x1e4f4e;});}return null;};}function removeEntity(_0x3c8aff,_0x3e4400){return function(_0xb547e1){if(_0xb547e1){return _0xb547e1[_0x52b2('0x27')]()[_0x52b2('0x28')](function(){_0x3c8aff['status'](0xcc)[_0x52b2('0x29')]();});}};}function handleEntityNotFound(_0x46284f,_0x5bc212){return function(_0x12748e){if(!_0x12748e){_0x46284f['sendStatus'](0x194);}return _0x12748e;};}function handleError(_0xe3ceac,_0x293d9d){_0x293d9d=_0x293d9d||0x1f4;return function(_0x5422e6){logger[_0x52b2('0x2a')](_0x5422e6[_0x52b2('0x2b')]);if(_0x5422e6[_0x52b2('0x2c')]){delete _0x5422e6[_0x52b2('0x2c')];}_0xe3ceac[_0x52b2('0x1b')](_0x293d9d)[_0x52b2('0x2d')](_0x5422e6);};}exports[_0x52b2('0x2e')]=function(_0x458b98,_0x146279){var _0x250412={},_0x5c2148={},_0xf8ee87={'count':0x0,'rows':[]};var _0x327f96=_[_0x52b2('0x2f')](db['VtigerAccount'][_0x52b2('0x30')],function(_0x4ccb34){return{'name':_0x4ccb34[_0x52b2('0x31')],'type':_0x4ccb34[_0x52b2('0x32')][_0x52b2('0x33')]};});_0x5c2148[_0x52b2('0x34')]=_[_0x52b2('0x2f')](_0x327f96,_0x52b2('0x2c'));_0x5c2148[_0x52b2('0x35')]=_['keys'](_0x458b98[_0x52b2('0x35')]);_0x5c2148[_0x52b2('0x36')]=_['intersection'](_0x5c2148['model'],_0x5c2148['query']);_0x250412['attributes']=_['intersection'](_0x5c2148['model'],qs[_0x52b2('0x37')](_0x458b98[_0x52b2('0x35')][_0x52b2('0x37')]));_0x250412['attributes']=_0x250412[_0x52b2('0x38')][_0x52b2('0x39')]?_0x250412['attributes']:_0x5c2148['model'];if(!_0x458b98[_0x52b2('0x35')][_0x52b2('0x3a')](_0x52b2('0x3b'))){_0x250412[_0x52b2('0x1d')]=qs[_0x52b2('0x1d')](_0x458b98[_0x52b2('0x35')]['limit']);_0x250412[_0x52b2('0x1f')]=qs['offset'](_0x458b98[_0x52b2('0x35')][_0x52b2('0x1f')]);}_0x250412[_0x52b2('0x3c')]=qs['sort'](_0x458b98[_0x52b2('0x35')]['sort']);_0x250412[_0x52b2('0x3d')]=qs['filters'](_[_0x52b2('0x3e')](_0x458b98[_0x52b2('0x35')],_0x5c2148[_0x52b2('0x36')]),_0x327f96);if(_0x458b98[_0x52b2('0x35')][_0x52b2('0x3f')]){_0x250412[_0x52b2('0x3d')]=_[_0x52b2('0x40')](_0x250412['where'],{'$or':_['map'](_0x327f96,function(_0x5c116f){if(_0x5c116f[_0x52b2('0x32')]!==_0x52b2('0x41')){var _0x1e84af={};_0x1e84af[_0x5c116f[_0x52b2('0x2c')]]={'$like':'%'+_0x458b98['query'][_0x52b2('0x3f')]+'%'};return _0x1e84af;}})});}_0x250412=_[_0x52b2('0x40')]({},_0x250412,_0x458b98[_0x52b2('0x42')]);var _0x5d4a81={'where':_0x250412['where']};return db['VtigerAccount']['count'](_0x5d4a81)[_0x52b2('0x28')](function(_0x610ac3){_0xf8ee87[_0x52b2('0x1e')]=_0x610ac3;if(_0x458b98[_0x52b2('0x35')][_0x52b2('0x43')]){_0x250412[_0x52b2('0x44')]=[{'all':!![]}];}return db[_0x52b2('0x45')]['findAll'](_0x250412);})[_0x52b2('0x28')](function(_0xc939db){_0xf8ee87[_0x52b2('0x46')]=_0xc939db;return _0xf8ee87;})[_0x52b2('0x28')](respondWithFilteredResult(_0x146279,_0x250412))[_0x52b2('0x47')](handleError(_0x146279,null));};exports[_0x52b2('0x48')]=function(_0x578310,_0x5b9aaa){var _0x10331a={'raw':![],'where':{'id':_0x578310[_0x52b2('0x49')]['id']}},_0x361a72={};_0x361a72[_0x52b2('0x34')]=_[_0x52b2('0x4a')](db[_0x52b2('0x45')][_0x52b2('0x30')]);_0x361a72[_0x52b2('0x35')]=_['keys'](_0x578310[_0x52b2('0x35')]);_0x361a72[_0x52b2('0x36')]=_[_0x52b2('0x4b')](_0x361a72[_0x52b2('0x34')],_0x361a72[_0x52b2('0x35')]);_0x10331a['attributes']=_['intersection'](_0x361a72[_0x52b2('0x34')],qs[_0x52b2('0x37')](_0x578310[_0x52b2('0x35')][_0x52b2('0x37')]));_0x10331a['attributes']=_0x10331a[_0x52b2('0x38')]['length']?_0x10331a[_0x52b2('0x38')]:_0x361a72[_0x52b2('0x34')];if(_0x578310[_0x52b2('0x35')][_0x52b2('0x43')]){_0x10331a[_0x52b2('0x44')]=[{'all':!![]}];}_0x10331a=_['merge']({},_0x10331a,_0x578310[_0x52b2('0x42')]);return db[_0x52b2('0x45')]['find'](_0x10331a)[_0x52b2('0x28')](handleEntityNotFound(_0x5b9aaa,null))['then'](respondWithResult(_0x5b9aaa,null))['catch'](handleError(_0x5b9aaa,null));};exports[_0x52b2('0x4c')]=function(_0x5af10,_0x2f040d){return db[_0x52b2('0x45')][_0x52b2('0x4c')](_0x5af10[_0x52b2('0x4d')],{})[_0x52b2('0x28')](respondWithResult(_0x2f040d,0xc9))[_0x52b2('0x47')](handleError(_0x2f040d,null));};exports[_0x52b2('0x26')]=function(_0x174e58,_0x4a3f71){if(_0x174e58[_0x52b2('0x4d')]['id']){delete _0x174e58['body']['id'];}return db[_0x52b2('0x45')][_0x52b2('0x4e')]({'where':{'id':_0x174e58[_0x52b2('0x49')]['id']}})[_0x52b2('0x28')](handleEntityNotFound(_0x4a3f71,null))['then'](saveUpdates(_0x174e58[_0x52b2('0x4d')],null))[_0x52b2('0x28')](respondWithResult(_0x4a3f71,null))['catch'](handleError(_0x4a3f71,null));};exports[_0x52b2('0x27')]=function(_0x25b402,_0x34c669){return db['VtigerAccount'][_0x52b2('0x4e')]({'where':{'id':_0x25b402[_0x52b2('0x49')]['id']}})[_0x52b2('0x28')](handleEntityNotFound(_0x34c669,null))['then'](removeEntity(_0x34c669,null))[_0x52b2('0x47')](handleError(_0x34c669,null));};exports[_0x52b2('0x4f')]=function(_0x4691d7,_0x31b460,_0x1c1dae){var _0x2323b8={};var _0x4bf0ee={};var _0xdbb9d3;var _0x136a1d;return db[_0x52b2('0x45')][_0x52b2('0x50')]({'where':{'id':_0x4691d7[_0x52b2('0x49')]['id']}})[_0x52b2('0x28')](handleEntityNotFound(_0x31b460,null))[_0x52b2('0x28')](function(_0x15c752){if(_0x15c752){_0xdbb9d3=_0x15c752;_0x4bf0ee['model']=_[_0x52b2('0x4a')](db[_0x52b2('0x51')]['rawAttributes']);_0x4bf0ee[_0x52b2('0x35')]=_[_0x52b2('0x4a')](_0x4691d7[_0x52b2('0x35')]);_0x4bf0ee['filters']=_[_0x52b2('0x4b')](_0x4bf0ee[_0x52b2('0x34')],_0x4bf0ee[_0x52b2('0x35')]);_0x2323b8[_0x52b2('0x38')]=_[_0x52b2('0x4b')](_0x4bf0ee['model'],qs['fields'](_0x4691d7['query'][_0x52b2('0x37')]));_0x2323b8['attributes']=_0x2323b8['attributes'][_0x52b2('0x39')]?_0x2323b8['attributes']:_0x4bf0ee[_0x52b2('0x34')];_0x2323b8[_0x52b2('0x3c')]=qs[_0x52b2('0x52')](_0x4691d7[_0x52b2('0x35')][_0x52b2('0x52')]);_0x2323b8[_0x52b2('0x3d')]=qs[_0x52b2('0x36')](_[_0x52b2('0x3e')](_0x4691d7[_0x52b2('0x35')],_0x4bf0ee[_0x52b2('0x36')]));if(_0x4691d7[_0x52b2('0x35')][_0x52b2('0x3f')]){_0x2323b8[_0x52b2('0x3d')]=_[_0x52b2('0x40')](_0x2323b8[_0x52b2('0x3d')],{'$or':_[_0x52b2('0x2f')](_0x2323b8[_0x52b2('0x38')],function(_0x32a616){var _0x21e9e0={};_0x21e9e0[_0x32a616]={'$like':'%'+_0x4691d7[_0x52b2('0x35')][_0x52b2('0x3f')]+'%'};return _0x21e9e0;})});}_0x2323b8=_[_0x52b2('0x40')]({},_0x2323b8,_0x4691d7[_0x52b2('0x42')]);return _0xdbb9d3['getConfigurations'](_0x2323b8);}})['then'](function(_0x3cda20){if(_0x3cda20){_0x136a1d=_0x3cda20[_0x52b2('0x39')];if(!_0x4691d7['query']['hasOwnProperty'](_0x52b2('0x3b'))){_0x2323b8[_0x52b2('0x1d')]=qs[_0x52b2('0x1d')](_0x4691d7[_0x52b2('0x35')][_0x52b2('0x1d')]);_0x2323b8['offset']=qs[_0x52b2('0x1f')](_0x4691d7[_0x52b2('0x35')][_0x52b2('0x1f')]);}return _0xdbb9d3[_0x52b2('0x4f')](_0x2323b8);}})[_0x52b2('0x28')](function(_0x3d2aab){if(_0x3d2aab){return _0x3d2aab?{'count':_0x136a1d,'rows':_0x3d2aab}:null;}})['then'](respondWithResult(_0x31b460,null))[_0x52b2('0x47')](handleError(_0x31b460,null));};exports['addConfiguration']=function(_0x4ef347,_0x416e49,_0x3e8f76){if(_0x4ef347['body']['id']){delete _0x4ef347['body']['id'];}return db[_0x52b2('0x45')][_0x52b2('0x50')]({'where':{'id':_0x4ef347[_0x52b2('0x49')]['id']}})[_0x52b2('0x28')](handleEntityNotFound(_0x416e49,null))[_0x52b2('0x28')](function(_0x24055c){if(_0x24055c){_0x4ef347[_0x52b2('0x4d')][_0x52b2('0x53')]=_0x24055c['id'];_0x4ef347['body'][_0x52b2('0x54')]=integrations['getSubjects'](_0x4ef347['body']['channel'],_0x4ef347['body'][_0x52b2('0x32')]);_0x4ef347[_0x52b2('0x4d')][_0x52b2('0x55')]=integrations[_0x52b2('0x56')](_0x4ef347[_0x52b2('0x4d')]['channel'],_0x4ef347[_0x52b2('0x4d')][_0x52b2('0x32')]);return db['VtigerConfiguration'][_0x52b2('0x4c')](_0x4ef347[_0x52b2('0x4d')],{'include':[{'model':db[_0x52b2('0x57')],'as':_0x52b2('0x54')},{'model':db[_0x52b2('0x57')],'as':_0x52b2('0x55')}]});}return null;})['then'](respondWithResult(_0x416e49,null))['catch'](handleError(_0x416e49,null));};var md5=require(_0x52b2('0x58'));exports[_0x52b2('0x59')]=function(_0x3e83bd,_0x3a6ce4,_0xf32c6c){var _0x16bbaf=null;var _0x55b666=null;var _0x12729e=null;var _0x5d3f22=null;var _0x497e70='';return db['VtigerAccount']['findOne']({'where':{'id':_0x3e83bd[_0x52b2('0x49')]['id']},'attributes':['id',_0x52b2('0x2c'),_0x52b2('0x5a'),_0x52b2('0x5b'),_0x52b2('0x5c'),_0x52b2('0x5d'),_0x52b2('0x5e'),_0x52b2('0x5f')]})['then'](handleEntityNotFound(_0x3a6ce4,null))[_0x52b2('0x28')](function(_0x1de263){if(_0x1de263){_0x16bbaf=_0x1de263[_0x52b2('0x5a')];_0x55b666=_0x1de263[_0x52b2('0x5f')];_0x12729e=_0x1de263[_0x52b2('0x5c')];_0x497e70=_0x1de263['remoteUri'];var _0x4a6ef5=_0x497e70[_0x52b2('0x60')](-0x1);if(_0x4a6ef5==='/'){_0x497e70=_0x497e70[_0x52b2('0x61')](0x0,_0x497e70[_0x52b2('0x62')](_0x4a6ef5));}_0x5d3f22=util[_0x52b2('0x63')](_0x52b2('0x64'),_0x497e70);var _0x14d9b7={'method':_0x52b2('0x65'),'uri':_0x5d3f22,'qs':{'operation':_0x52b2('0x66'),'username':_0x1de263[_0x52b2('0x5a')]},'json':!![]};return rp(_0x14d9b7);}})[_0x52b2('0x28')](function(_0x4dceea){if(_0x4dceea[_0x52b2('0x67')]){var _0x4a2ca3={'method':_0x52b2('0x68'),'uri':_0x5d3f22,'form':{'operation':_0x52b2('0x69'),'username':_0x16bbaf,'accessKey':md5(_0x4dceea[_0x52b2('0x6a')]['token']+_0x55b666)},'json':!![]};return rp(_0x4a2ca3);}})[_0x52b2('0x28')](function(_0x3a3a66){if(_0x3a3a66[_0x52b2('0x67')]){var _0x3576df={'method':_0x52b2('0x65'),'uri':_0x5d3f22,'qs':{'operation':_0x52b2('0x6b'),'username':_0x16bbaf,'sessionName':_0x3a3a66[_0x52b2('0x6a')][_0x52b2('0x6c')],'elementType':_0x12729e},'json':!![]};return rp(_0x3576df);}})[_0x52b2('0x28')](function(_0x31d130){if(_0x31d130['success']){var _0x2fc5de=[_0x52b2('0x6d'),_0x52b2('0x6e'),'owner'];_['remove'](_0x31d130[_0x52b2('0x6a')][_0x52b2('0x37')],function(_0x20612d){return _0x2fc5de[_0x52b2('0x6f')](_0x20612d[_0x52b2('0x32')][_0x52b2('0x2c')]);});_['remove'](_0x31d130[_0x52b2('0x6a')]['fields'],function(_0x3cfadc){return _0x3cfadc['editable']===_0x52b2('0x70');});return{'count':_0x31d130[_0x52b2('0x6a')][_0x52b2('0x37')][_0x52b2('0x39')],'rows':_[_0x52b2('0x2f')](_0x31d130[_0x52b2('0x6a')][_0x52b2('0x37')],function(_0x368b37){return{'id':_0x368b37[_0x52b2('0x2c')],'name':_0x368b37[_0x52b2('0x71')],'custom':_['startsWith'](_0x368b37[_0x52b2('0x2c')],_0x52b2('0x72'))?!![]:![],'options':_0x368b37['type'][_0x52b2('0x2c')]===_0x52b2('0x73')&&_0x368b37[_0x52b2('0x32')][_0x52b2('0x74')][_0x52b2('0x39')]>0x0?_['map'](_0x368b37[_0x52b2('0x32')]['picklistValues'],function(_0x247acd){return{'name':_0x247acd[_0x52b2('0x71')],'value':_0x247acd[_0x52b2('0x75')]};}):[]};})};}})[_0x52b2('0x28')](respondWithResult(_0x3a6ce4,null))[_0x52b2('0x47')](function(_0x4ae94b){console[_0x52b2('0x76')]('vTiger\x20error:\x20'+_0x4ae94b);var _0x5697be=_0x3e83bd[_0x52b2('0x35')][_0x52b2('0x77')]?0x1f4:_0x4ae94b[_0x52b2('0x78')]||0x1f4;logger[_0x52b2('0x2a')](_0x52b2('0x79'),_0x52b2('0x59'),_0x5697be,JSON[_0x52b2('0x7a')](_0x4ae94b));delete _0x4ae94b['name'];if(_0x5697be===0x191){_0x5697be=0x190;}_0x3a6ce4['status'](_0x5697be)[_0x52b2('0x2d')](_0x3e83bd['query'][_0x52b2('0x77')]?{'message':_0x52b2('0x7b'),'statusCode':_0x4ae94b[_0x52b2('0x78')]}:_0x4ae94b);});}; \ No newline at end of file +var _0x3423=['moduleName','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/webservice.php','POST','result','token','success','describe','autogenerated','reference','owner','remove','includes','editable','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','fs-extra','squel','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','then','destroy','error','stack','send','map','VtigerAccount','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','name','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','findOne','VtigerConfiguration','rawAttributes','hasOwnProperty','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','type','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username'];(function(_0x3c71cd,_0x2961ba){var _0x5c8372=function(_0x1327fc){while(--_0x1327fc){_0x3c71cd['push'](_0x3c71cd['shift']());}};_0x5c8372(++_0x2961ba);}(_0x3423,0x1ee));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3342('0x0'));var zipdir=require(_0x3342('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3342('0x2'));var Mustache=require(_0x3342('0x3'));var util=require('util');var path=require(_0x3342('0x4'));var sox=require(_0x3342('0x5'));var csv=require(_0x3342('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3342('0x7'));var _=require('lodash');var squel=require(_0x3342('0x8'));var crypto=require('crypto');var jsforce=require(_0x3342('0x9'));var deskjs=require(_0x3342('0xa'));var toCsv=require(_0x3342('0x6'));var querystring=require(_0x3342('0xb'));var Papa=require('papaparse');var Redis=require(_0x3342('0xc'));var authService=require(_0x3342('0xd'));var qs=require(_0x3342('0xe'));var as=require(_0x3342('0xf'));var hardwareService=require(_0x3342('0x10'));var logger=require(_0x3342('0x11'))(_0x3342('0x12'));var utils=require('../../config/utils');var config=require(_0x3342('0x13'));var licenseUtil=require(_0x3342('0x14'));var db=require(_0x3342('0x15'))['db'];var integrations=require(_0x3342('0x16'));function respondWithStatusCode(_0x2a9b7d,_0x3c5e64){_0x3c5e64=_0x3c5e64||0xcc;return function(_0x28a4ad){if(_0x28a4ad){return _0x2a9b7d[_0x3342('0x17')](_0x3c5e64);}return _0x2a9b7d[_0x3342('0x18')](_0x3c5e64)[_0x3342('0x19')]();};}function respondWithResult(_0x269d61,_0x3aaac0){_0x3aaac0=_0x3aaac0||0xc8;return function(_0x46956e){if(_0x46956e){return _0x269d61['status'](_0x3aaac0)[_0x3342('0x1a')](_0x46956e);}};}function respondWithFilteredResult(_0x108481,_0x35068a){return function(_0x1e56e7){if(_0x1e56e7){var _0x3cc27e=typeof _0x35068a['offset']==='undefined'&&typeof _0x35068a['limit']===_0x3342('0x1b');var _0x28eba1=_0x1e56e7[_0x3342('0x1c')];var _0x9862=_0x3cc27e?0x0:_0x35068a[_0x3342('0x1d')];var _0x363854=_0x3cc27e?_0x1e56e7[_0x3342('0x1c')]:_0x35068a[_0x3342('0x1d')]+_0x35068a['limit'];var _0x205976;if(_0x363854>=_0x28eba1){_0x363854=_0x28eba1;_0x205976=0xc8;}else{_0x205976=0xce;}_0x108481['status'](_0x205976);return _0x108481[_0x3342('0x1e')](_0x3342('0x1f'),_0x9862+'-'+_0x363854+'/'+_0x28eba1)[_0x3342('0x1a')](_0x1e56e7);}return null;};}function patchUpdates(_0x59eccd){return function(_0x2043fc){try{jsonpatch['apply'](_0x2043fc,_0x59eccd,!![]);}catch(_0x133269){return BPromise[_0x3342('0x20')](_0x133269);}return _0x2043fc['save']();};}function saveUpdates(_0x18cf4d,_0x2d4ef0){return function(_0x48f220){if(_0x48f220){return _0x48f220['update'](_0x18cf4d)[_0x3342('0x21')](function(_0x388773){return _0x388773;});}return null;};}function removeEntity(_0x596bf0,_0xd97e9){return function(_0x1264e9){if(_0x1264e9){return _0x1264e9[_0x3342('0x22')]()[_0x3342('0x21')](function(){_0x596bf0[_0x3342('0x18')](0xcc)[_0x3342('0x19')]();});}};}function handleEntityNotFound(_0x1cfb59,_0x474fb6){return function(_0x33e970){if(!_0x33e970){_0x1cfb59[_0x3342('0x17')](0x194);}return _0x33e970;};}function handleError(_0x3ba461,_0x586271){_0x586271=_0x586271||0x1f4;return function(_0x28e8be){logger[_0x3342('0x23')](_0x28e8be[_0x3342('0x24')]);if(_0x28e8be['name']){delete _0x28e8be['name'];}_0x3ba461[_0x3342('0x18')](_0x586271)[_0x3342('0x25')](_0x28e8be);};}exports['index']=function(_0x3f16ef,_0x5f04fa){var _0x371cb9={},_0x4214aa={},_0x5295eb={'count':0x0,'rows':[]};var _0x121ce2=_[_0x3342('0x26')](db[_0x3342('0x27')]['rawAttributes'],function(_0x2175c7){return{'name':_0x2175c7['fieldName'],'type':_0x2175c7['type'][_0x3342('0x28')]};});_0x4214aa[_0x3342('0x29')]=_[_0x3342('0x26')](_0x121ce2,'name');_0x4214aa[_0x3342('0x2a')]=_[_0x3342('0x2b')](_0x3f16ef['query']);_0x4214aa[_0x3342('0x2c')]=_[_0x3342('0x2d')](_0x4214aa[_0x3342('0x29')],_0x4214aa[_0x3342('0x2a')]);_0x371cb9[_0x3342('0x2e')]=_[_0x3342('0x2d')](_0x4214aa[_0x3342('0x29')],qs[_0x3342('0x2f')](_0x3f16ef[_0x3342('0x2a')]['fields']));_0x371cb9[_0x3342('0x2e')]=_0x371cb9[_0x3342('0x2e')][_0x3342('0x30')]?_0x371cb9[_0x3342('0x2e')]:_0x4214aa[_0x3342('0x29')];if(!_0x3f16ef[_0x3342('0x2a')]['hasOwnProperty']('nolimit')){_0x371cb9[_0x3342('0x31')]=qs[_0x3342('0x31')](_0x3f16ef[_0x3342('0x2a')]['limit']);_0x371cb9[_0x3342('0x1d')]=qs[_0x3342('0x1d')](_0x3f16ef[_0x3342('0x2a')][_0x3342('0x1d')]);}_0x371cb9[_0x3342('0x32')]=qs[_0x3342('0x33')](_0x3f16ef[_0x3342('0x2a')]['sort']);_0x371cb9[_0x3342('0x34')]=qs[_0x3342('0x2c')](_[_0x3342('0x35')](_0x3f16ef[_0x3342('0x2a')],_0x4214aa['filters']),_0x121ce2);if(_0x3f16ef[_0x3342('0x2a')][_0x3342('0x36')]){_0x371cb9[_0x3342('0x34')]=_[_0x3342('0x37')](_0x371cb9['where'],{'$or':_[_0x3342('0x26')](_0x121ce2,function(_0x3e6018){if(_0x3e6018['type']!=='VIRTUAL'){var _0x4b3c7a={};_0x4b3c7a[_0x3e6018[_0x3342('0x38')]]={'$like':'%'+_0x3f16ef[_0x3342('0x2a')]['filter']+'%'};return _0x4b3c7a;}})});}_0x371cb9=_[_0x3342('0x37')]({},_0x371cb9,_0x3f16ef[_0x3342('0x39')]);var _0x4758ec={'where':_0x371cb9['where']};return db[_0x3342('0x27')][_0x3342('0x1c')](_0x4758ec)[_0x3342('0x21')](function(_0x29d3e4){_0x5295eb['count']=_0x29d3e4;if(_0x3f16ef[_0x3342('0x2a')][_0x3342('0x3a')]){_0x371cb9[_0x3342('0x3b')]=[{'all':!![]}];}return db[_0x3342('0x27')][_0x3342('0x3c')](_0x371cb9);})[_0x3342('0x21')](function(_0x536a32){_0x5295eb[_0x3342('0x3d')]=_0x536a32;return _0x5295eb;})[_0x3342('0x21')](respondWithFilteredResult(_0x5f04fa,_0x371cb9))['catch'](handleError(_0x5f04fa,null));};exports[_0x3342('0x3e')]=function(_0x417516,_0x5c417b){var _0x3cf9c7={'raw':![],'where':{'id':_0x417516[_0x3342('0x3f')]['id']}},_0x54d1ab={};_0x54d1ab['model']=_[_0x3342('0x2b')](db['VtigerAccount']['rawAttributes']);_0x54d1ab[_0x3342('0x2a')]=_[_0x3342('0x2b')](_0x417516['query']);_0x54d1ab[_0x3342('0x2c')]=_[_0x3342('0x2d')](_0x54d1ab['model'],_0x54d1ab[_0x3342('0x2a')]);_0x3cf9c7[_0x3342('0x2e')]=_['intersection'](_0x54d1ab[_0x3342('0x29')],qs[_0x3342('0x2f')](_0x417516['query'][_0x3342('0x2f')]));_0x3cf9c7['attributes']=_0x3cf9c7[_0x3342('0x2e')][_0x3342('0x30')]?_0x3cf9c7[_0x3342('0x2e')]:_0x54d1ab[_0x3342('0x29')];if(_0x417516['query'][_0x3342('0x3a')]){_0x3cf9c7['include']=[{'all':!![]}];}_0x3cf9c7=_['merge']({},_0x3cf9c7,_0x417516[_0x3342('0x39')]);return db[_0x3342('0x27')][_0x3342('0x40')](_0x3cf9c7)[_0x3342('0x21')](handleEntityNotFound(_0x5c417b,null))[_0x3342('0x21')](respondWithResult(_0x5c417b,null))[_0x3342('0x41')](handleError(_0x5c417b,null));};exports[_0x3342('0x42')]=function(_0x2dae00,_0x401cd4){return db['VtigerAccount'][_0x3342('0x42')](_0x2dae00[_0x3342('0x43')],{})[_0x3342('0x21')](respondWithResult(_0x401cd4,0xc9))[_0x3342('0x41')](handleError(_0x401cd4,null));};exports[_0x3342('0x44')]=function(_0x4487f2,_0x13b254){if(_0x4487f2[_0x3342('0x43')]['id']){delete _0x4487f2[_0x3342('0x43')]['id'];}return db[_0x3342('0x27')][_0x3342('0x40')]({'where':{'id':_0x4487f2['params']['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x13b254,null))[_0x3342('0x21')](saveUpdates(_0x4487f2['body'],null))[_0x3342('0x21')](respondWithResult(_0x13b254,null))[_0x3342('0x41')](handleError(_0x13b254,null));};exports['destroy']=function(_0x596986,_0x65a196){return db['VtigerAccount'][_0x3342('0x40')]({'where':{'id':_0x596986[_0x3342('0x3f')]['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x65a196,null))['then'](removeEntity(_0x65a196,null))[_0x3342('0x41')](handleError(_0x65a196,null));};exports['getConfigurations']=function(_0x2c9a7a,_0x40b05e,_0x1d921d){var _0x36e09a={};var _0xeab102={};var _0x47ff55;var _0x4f533c;return db[_0x3342('0x27')][_0x3342('0x45')]({'where':{'id':_0x2c9a7a['params']['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x40b05e,null))[_0x3342('0x21')](function(_0x4cb1bc){if(_0x4cb1bc){_0x47ff55=_0x4cb1bc;_0xeab102[_0x3342('0x29')]=_[_0x3342('0x2b')](db[_0x3342('0x46')][_0x3342('0x47')]);_0xeab102['query']=_[_0x3342('0x2b')](_0x2c9a7a['query']);_0xeab102[_0x3342('0x2c')]=_[_0x3342('0x2d')](_0xeab102[_0x3342('0x29')],_0xeab102['query']);_0x36e09a[_0x3342('0x2e')]=_[_0x3342('0x2d')](_0xeab102[_0x3342('0x29')],qs[_0x3342('0x2f')](_0x2c9a7a[_0x3342('0x2a')][_0x3342('0x2f')]));_0x36e09a[_0x3342('0x2e')]=_0x36e09a[_0x3342('0x2e')][_0x3342('0x30')]?_0x36e09a[_0x3342('0x2e')]:_0xeab102[_0x3342('0x29')];_0x36e09a['order']=qs[_0x3342('0x33')](_0x2c9a7a[_0x3342('0x2a')]['sort']);_0x36e09a[_0x3342('0x34')]=qs[_0x3342('0x2c')](_[_0x3342('0x35')](_0x2c9a7a['query'],_0xeab102[_0x3342('0x2c')]));if(_0x2c9a7a[_0x3342('0x2a')]['filter']){_0x36e09a[_0x3342('0x34')]=_[_0x3342('0x37')](_0x36e09a[_0x3342('0x34')],{'$or':_[_0x3342('0x26')](_0x36e09a[_0x3342('0x2e')],function(_0x8a66b0){var _0x5b720c={};_0x5b720c[_0x8a66b0]={'$like':'%'+_0x2c9a7a[_0x3342('0x2a')][_0x3342('0x36')]+'%'};return _0x5b720c;})});}_0x36e09a=_[_0x3342('0x37')]({},_0x36e09a,_0x2c9a7a[_0x3342('0x39')]);return _0x47ff55['getConfigurations'](_0x36e09a);}})['then'](function(_0x2df9e0){if(_0x2df9e0){_0x4f533c=_0x2df9e0['length'];if(!_0x2c9a7a[_0x3342('0x2a')][_0x3342('0x48')](_0x3342('0x49'))){_0x36e09a['limit']=qs[_0x3342('0x31')](_0x2c9a7a['query']['limit']);_0x36e09a[_0x3342('0x1d')]=qs[_0x3342('0x1d')](_0x2c9a7a[_0x3342('0x2a')][_0x3342('0x1d')]);}return _0x47ff55[_0x3342('0x4a')](_0x36e09a);}})[_0x3342('0x21')](function(_0x3bffaa){if(_0x3bffaa){return _0x3bffaa?{'count':_0x4f533c,'rows':_0x3bffaa}:null;}})[_0x3342('0x21')](respondWithResult(_0x40b05e,null))['catch'](handleError(_0x40b05e,null));};exports[_0x3342('0x4b')]=function(_0x2c2547,_0x230f2c,_0x20e3f4){if(_0x2c2547[_0x3342('0x43')]['id']){delete _0x2c2547['body']['id'];}return db[_0x3342('0x27')][_0x3342('0x45')]({'where':{'id':_0x2c2547[_0x3342('0x3f')]['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x230f2c,null))[_0x3342('0x21')](function(_0x46713d){if(_0x46713d){_0x2c2547[_0x3342('0x43')][_0x3342('0x4c')]=_0x46713d['id'];_0x2c2547[_0x3342('0x43')][_0x3342('0x4d')]=integrations['getSubjects'](_0x2c2547[_0x3342('0x43')]['channel'],_0x2c2547[_0x3342('0x43')][_0x3342('0x4e')]);_0x2c2547[_0x3342('0x43')][_0x3342('0x4f')]=integrations[_0x3342('0x50')](_0x2c2547[_0x3342('0x43')][_0x3342('0x51')],_0x2c2547[_0x3342('0x43')][_0x3342('0x4e')]);return db[_0x3342('0x46')][_0x3342('0x42')](_0x2c2547['body'],{'include':[{'model':db[_0x3342('0x52')],'as':_0x3342('0x4d')},{'model':db[_0x3342('0x52')],'as':_0x3342('0x4f')}]});}return null;})['then'](respondWithResult(_0x230f2c,null))[_0x3342('0x41')](handleError(_0x230f2c,null));};var md5=require(_0x3342('0x53'));exports[_0x3342('0x54')]=function(_0x6d82ce,_0x9a1cea,_0x54a3c7){var _0x110778=null;var _0x12dde8=null;var _0x55350b=null;var _0x3c4e8e=null;var _0x3f3767='';return db[_0x3342('0x27')][_0x3342('0x45')]({'where':{'id':_0x6d82ce[_0x3342('0x3f')]['id']},'attributes':['id',_0x3342('0x38'),_0x3342('0x55'),'description',_0x3342('0x56'),_0x3342('0x57'),_0x3342('0x58'),'accessKey']})[_0x3342('0x21')](handleEntityNotFound(_0x9a1cea,null))[_0x3342('0x21')](function(_0x343c37){if(_0x343c37){_0x110778=_0x343c37[_0x3342('0x55')];_0x12dde8=_0x343c37['accessKey'];_0x55350b=_0x343c37[_0x3342('0x56')];_0x3f3767=_0x343c37[_0x3342('0x57')];var _0x27a640=_0x3f3767[_0x3342('0x59')](-0x1);if(_0x27a640==='/'){_0x3f3767=_0x3f3767[_0x3342('0x5a')](0x0,_0x3f3767[_0x3342('0x5b')](_0x27a640));}_0x3c4e8e=util['format'](_0x3342('0x5c'),_0x3f3767);var _0x2ac436={'method':'GET','uri':_0x3c4e8e,'qs':{'operation':'getchallenge','username':_0x343c37[_0x3342('0x55')]},'json':!![]};return rp(_0x2ac436);}})[_0x3342('0x21')](function(_0x2781f1){if(_0x2781f1['success']){var _0x23b726={'method':_0x3342('0x5d'),'uri':_0x3c4e8e,'form':{'operation':'login','username':_0x110778,'accessKey':md5(_0x2781f1[_0x3342('0x5e')][_0x3342('0x5f')]+_0x12dde8)},'json':!![]};return rp(_0x23b726);}})[_0x3342('0x21')](function(_0x5c89c7){if(_0x5c89c7[_0x3342('0x60')]){var _0x51b42a={'method':'GET','uri':_0x3c4e8e,'qs':{'operation':_0x3342('0x61'),'username':_0x110778,'sessionName':_0x5c89c7[_0x3342('0x5e')]['sessionName'],'elementType':_0x55350b},'json':!![]};return rp(_0x51b42a);}})[_0x3342('0x21')](function(_0x5bd694){if(_0x5bd694['success']){var _0x2f353a=[_0x3342('0x62'),_0x3342('0x63'),_0x3342('0x64')];_[_0x3342('0x65')](_0x5bd694[_0x3342('0x5e')]['fields'],function(_0x41de42){return _0x2f353a[_0x3342('0x66')](_0x41de42[_0x3342('0x4e')][_0x3342('0x38')]);});_[_0x3342('0x65')](_0x5bd694[_0x3342('0x5e')][_0x3342('0x2f')],function(_0xaf3505){return _0xaf3505[_0x3342('0x67')]==='false';});return{'count':_0x5bd694[_0x3342('0x5e')][_0x3342('0x2f')][_0x3342('0x30')],'rows':_['map'](_0x5bd694['result'][_0x3342('0x2f')],function(_0x4def90){return{'id':_0x4def90[_0x3342('0x38')],'name':_0x4def90[_0x3342('0x68')],'custom':_[_0x3342('0x69')](_0x4def90[_0x3342('0x38')],_0x3342('0x6a'))?!![]:![],'options':_0x4def90[_0x3342('0x4e')][_0x3342('0x38')]==='picklist'&&_0x4def90['type']['picklistValues'][_0x3342('0x30')]>0x0?_[_0x3342('0x26')](_0x4def90['type'][_0x3342('0x6b')],function(_0x4bceba){return{'name':_0x4bceba[_0x3342('0x68')],'value':_0x4bceba[_0x3342('0x6c')]};}):[]};})};}})['then'](respondWithResult(_0x9a1cea,null))['catch'](function(_0x2f39bd){console[_0x3342('0x6d')](_0x3342('0x6e')+_0x2f39bd);var _0x3b1fe7=_0x6d82ce['query'][_0x3342('0x6f')]?0x1f4:_0x2f39bd[_0x3342('0x70')]||0x1f4;logger['error'](_0x3342('0x71'),_0x3342('0x54'),_0x3b1fe7,JSON[_0x3342('0x72')](_0x2f39bd));delete _0x2f39bd[_0x3342('0x38')];if(_0x3b1fe7===0x191){_0x3b1fe7=0x190;}_0x9a1cea[_0x3342('0x18')](_0x3b1fe7)['send'](_0x6d82ce[_0x3342('0x2a')][_0x3342('0x6f')]?{'message':_0x3342('0x73'),'statusCode':_0x2f39bd[_0x3342('0x70')]}:_0x2f39bd);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e906968..7162b98 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 _0x6f64=['exports','define','VtigerAccount','int_vtiger_accounts','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x2def8f,_0x50683b){var _0x15dd2a=function(_0x373067){while(--_0x373067){_0x2def8f['push'](_0x2def8f['shift']());}};_0x15dd2a(++_0x50683b);}(_0x6f64,0x19c));var _0x46f6=function(_0x1b2d57,_0x4fccb7){_0x1b2d57=_0x1b2d57-0x0;var _0x5d46dd=_0x6f64[_0x1b2d57];return _0x5d46dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x46f6('0x0'))(_0x46f6('0x1'));var moment=require(_0x46f6('0x2'));var BPromise=require('bluebird');var rp=require(_0x46f6('0x3'));var fs=require('fs');var path=require(_0x46f6('0x4'));var rimraf=require(_0x46f6('0x5'));var config=require('../../config/environment');var attributes=require(_0x46f6('0x6'));var integrations=require(_0x46f6('0x7'));module[_0x46f6('0x8')]=function(_0x4b6d23,_0x1657be){return _0x4b6d23[_0x46f6('0x9')](_0x46f6('0xa'),attributes,{'tableName':_0x46f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeb9=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x4af856,_0x3990fd){var _0xdb6d15=function(_0x45af83){while(--_0x45af83){_0x4af856['push'](_0x4af856['shift']());}};_0xdb6d15(++_0x3990fd);}(_0xbeb9,0x19d));var _0x9beb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbeb9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9beb('0x0'));var util=require(_0x9beb('0x1'));var logger=require(_0x9beb('0x2'))(_0x9beb('0x3'));var moment=require('moment');var BPromise=require(_0x9beb('0x4'));var rp=require(_0x9beb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9beb('0x6'));var config=require(_0x9beb('0x7'));var attributes=require(_0x9beb('0x8'));var integrations=require(_0x9beb('0x9'));module[_0x9beb('0xa')]=function(_0x47cfd2,_0x3e0eb4){return _0x47cfd2[_0x9beb('0xb')](_0x9beb('0xc'),attributes,{'tableName':_0x9beb('0xd'),'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 8bf5b47..5d252d2 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 _0x0abf=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowVtigerAccount','then','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s'];(function(_0xbd4f1f,_0x4193fe){var _0x3fb02e=function(_0x4a2473){while(--_0x4a2473){_0xbd4f1f['push'](_0xbd4f1f['shift']());}};_0x3fb02e(++_0x4193fe);}(_0x0abf,0xe8));var _0xf0ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0abf[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')]({'raw':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1a')]||null:null,'attributes':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')]['attributes']||null:null,'limit':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1b')]||null:null,'include':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x18bb37){return{'model':db[_0x18bb37[_0xf0ab('0x1e')]],'as':_0x18bb37['as'],'attributes':_0x18bb37['attributes'],'include':_0x18bb37['include']?_['map'](_0x18bb37[_0xf0ab('0x1c')],function(_0x4f0caf){return{'model':db[_0x4f0caf[_0xf0ab('0x1e')]],'as':_0x4f0caf['as'],'attributes':_0x4f0caf[_0xf0ab('0x1f')],'include':_0x4f0caf['include']?_[_0xf0ab('0x1d')](_0x4f0caf[_0xf0ab('0x1c')],function(_0x10bf5f){return{'model':db[_0x10bf5f[_0xf0ab('0x1e')]],'as':_0x10bf5f['as'],'attributes':_0x10bf5f[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0da7){logger['info']('GetVtigerAccount',_0x1803f0);logger[_0xf0ab('0x20')](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x2d0da7));_0x776619(_0x2d0da7);})[_0xf0ab('0x14')](function(_0x43476c){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x43476c[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x43476c[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x21')]=function(_0x199753){var _0x58cbe1=this;return new Promise(function(_0x1e1ffb,_0x35973a){return db['VtigerAccount']['find']({'raw':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x199753['options']?_0x199753['options'][_0xf0ab('0x1a')]||null:null,'attributes':_0x199753['options']?_0x199753[_0xf0ab('0x18')]['attributes']||null:null,'include':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')]['include']?_['map'](_0x199753[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x2a3fac){return{'model':db[_0x2a3fac[_0xf0ab('0x1e')]],'as':_0x2a3fac['as'],'attributes':_0x2a3fac[_0xf0ab('0x1f')],'include':_0x2a3fac[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a3fac[_0xf0ab('0x1c')],function(_0x2a2f5d){return{'model':db[_0x2a2f5d[_0xf0ab('0x1e')]],'as':_0x2a2f5d['as'],'attributes':_0x2a2f5d[_0xf0ab('0x1f')],'include':_0x2a2f5d[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a2f5d[_0xf0ab('0x1c')],function(_0x5d8443){return{'model':db[_0x5d8443[_0xf0ab('0x1e')]],'as':_0x5d8443['as'],'attributes':_0x5d8443[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf0ab('0x22')](function(_0x5c9192){logger[_0xf0ab('0xb')](_0xf0ab('0x21'),_0x199753);logger[_0xf0ab('0x20')]('ShowVtigerAccount',_0x199753,JSON[_0xf0ab('0xe')](_0x5c9192));_0x1e1ffb(_0x5c9192);})['catch'](function(_0xda3971){logger['error'](_0xf0ab('0x21'),_0xda3971[_0xf0ab('0x11')],_0x199753);_0x35973a(_0x58cbe1[_0xf0ab('0xf')](0x1f4,_0xda3971[_0xf0ab('0x11')]));});});}; \ No newline at end of file +var _0x0972=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','ShowVtigerAccount','util','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x1f1590,_0x37dd0){var _0x1f19fe=function(_0x267e6f){while(--_0x267e6f){_0x1f1590['push'](_0x1f1590['shift']());}};_0x1f19fe(++_0x37dd0);}(_0x0972,0x64));var _0x2097=function(_0x30617c,_0x3b3fdb){_0x30617c=_0x30617c-0x0;var _0x44d5ef=_0x0972[_0x30617c];return _0x44d5ef;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4f21,_0x59739f,_0x332aac){return new BPromise(function(_0x1e661a,_0x11d263){return client[_0x2097('0xa')](_0x2b4f21,_0x332aac)[_0x2097('0xb')](function(_0x59d947){logger[_0x2097('0xc')](_0x2097('0xd'),_0x59739f,_0x2097('0xe'));logger[_0x2097('0xf')](_0x2097('0x10'),_0x59739f,_0x2097('0xe'),JSON[_0x2097('0x11')](_0x59d947));if(_0x59d947[_0x2097('0x12')]){if(_0x59d947[_0x2097('0x12')][_0x2097('0x13')]===0x1f4){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x11d263(_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);}logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x1e661a(_0x59d947['error'][_0x2097('0x14')]);}else{logger[_0x2097('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x59739f,'request\x20sent');_0x1e661a(_0x59d947['result'][_0x2097('0x14')]);}})['catch'](function(_0x28c35c){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x28c35c);_0x11d263(_0x28c35c);});});}exports[_0x2097('0x15')]=function(_0x44c584){var _0x53e2b4=this;return new Promise(function(_0x324652,_0x140094){return db[_0x2097('0x16')][_0x2097('0x17')]({'raw':_0x44c584[_0x2097('0x18')]?_0x44c584[_0x2097('0x18')][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x44c584[_0x2097('0x18')]?_0x44c584['options']['where']||null:null,'attributes':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1a')]||null:null,'limit':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1b')]||null:null,'include':_0x44c584['options']?_0x44c584[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x44c584[_0x2097('0x18')][_0x2097('0x1c')],function(_0x35047b){return{'model':db[_0x35047b['model']],'as':_0x35047b['as'],'attributes':_0x35047b[_0x2097('0x1a')],'include':_0x35047b['include']?_[_0x2097('0x1d')](_0x35047b[_0x2097('0x1c')],function(_0x345875){return{'model':db[_0x345875[_0x2097('0x1e')]],'as':_0x345875['as'],'attributes':_0x345875['attributes'],'include':_0x345875[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x345875['include'],function(_0x1229fc){return{'model':db[_0x1229fc['model']],'as':_0x1229fc['as'],'attributes':_0x1229fc[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbc0339){logger[_0x2097('0xc')](_0x2097('0x15'),_0x44c584);logger[_0x2097('0xf')](_0x2097('0x15'),_0x44c584,JSON[_0x2097('0x11')](_0xbc0339));_0x324652(_0xbc0339);})[_0x2097('0x1f')](function(_0x4b443d){logger[_0x2097('0x12')](_0x2097('0x15'),_0x4b443d['message'],_0x44c584);_0x140094(_0x53e2b4[_0x2097('0x12')](0x1f4,_0x4b443d[_0x2097('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4d0916){var _0x312c77=this;return new Promise(function(_0x11b051,_0x1649c8){return db[_0x2097('0x16')][_0x2097('0x20')]({'raw':_0x4d0916[_0x2097('0x18')]?_0x4d0916['options'][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x4d0916['options']?_0x4d0916[_0x2097('0x18')][_0x2097('0x21')]||null:null,'attributes':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1a')]||null:null,'include':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x4d0916['options'][_0x2097('0x1c')],function(_0x40baed){return{'model':db[_0x40baed[_0x2097('0x1e')]],'as':_0x40baed['as'],'attributes':_0x40baed['attributes'],'include':_0x40baed[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x40baed[_0x2097('0x1c')],function(_0x396162){return{'model':db[_0x396162['model']],'as':_0x396162['as'],'attributes':_0x396162['attributes'],'include':_0x396162['include']?_[_0x2097('0x1d')](_0x396162[_0x2097('0x1c')],function(_0x4123b7){return{'model':db[_0x4123b7[_0x2097('0x1e')]],'as':_0x4123b7['as'],'attributes':_0x4123b7[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2097('0xb')](function(_0x49b724){logger[_0x2097('0xc')](_0x2097('0x22'),_0x4d0916);logger[_0x2097('0xf')](_0x2097('0x22'),_0x4d0916,JSON[_0x2097('0x11')](_0x49b724));_0x11b051(_0x49b724);})[_0x2097('0x1f')](function(_0x52b937){logger[_0x2097('0x12')](_0x2097('0x22'),_0x52b937[_0x2097('0x14')],_0x4d0916);_0x1649c8(_0x312c77['error'](0x1f4,_0x52b937['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 7ab9529..bc824ed 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 _0x1a4a=['../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5ebf15,_0x46db29){var _0x532fcf=function(_0x393754){while(--_0x393754){_0x5ebf15['push'](_0x5ebf15['shift']());}};_0x532fcf(++_0x46db29);}(_0x1a4a,0x124));var _0xa1a4=function(_0x480def,_0x592118){_0x480def=_0x480def-0x0;var _0x11e60a=_0x1a4a[_0x480def];return _0x11e60a;};'use strict';var multer=require(_0xa1a4('0x0'));var util=require('util');var path=require(_0xa1a4('0x1'));var timeout=require(_0xa1a4('0x2'));var express=require(_0xa1a4('0x3'));var router=express[_0xa1a4('0x4')]();var fs_extra=require(_0xa1a4('0x5'));var auth=require(_0xa1a4('0x6'));var interaction=require(_0xa1a4('0x7'));var config=require(_0xa1a4('0x8'));var controller=require(_0xa1a4('0x9'));router[_0xa1a4('0xa')]('/',auth[_0xa1a4('0xb')](),controller['index']);router[_0xa1a4('0xa')](_0xa1a4('0xc'),auth[_0xa1a4('0xb')](),controller[_0xa1a4('0xd')]);router[_0xa1a4('0xa')](_0xa1a4('0xe'),auth[_0xa1a4('0xb')](),controller[_0xa1a4('0xf')]);router[_0xa1a4('0xa')](_0xa1a4('0x10'),auth[_0xa1a4('0xb')](),controller['getSubjects']);router[_0xa1a4('0xa')](_0xa1a4('0x11'),auth[_0xa1a4('0xb')](),controller[_0xa1a4('0x12')]);router['post']('/',auth[_0xa1a4('0xb')](),controller['create']);router[_0xa1a4('0x13')]('/:id',auth[_0xa1a4('0xb')](),controller[_0xa1a4('0x14')]);router[_0xa1a4('0x15')](_0xa1a4('0xc'),auth[_0xa1a4('0xb')](),controller['destroy']);module[_0xa1a4('0x16')]=router; \ No newline at end of file +var _0x4d39=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','delete','destroy','exports','path','connect-timeout'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x4d39,0xb2));var _0x94d3=function(_0x17b3d2,_0x4507a4){_0x17b3d2=_0x17b3d2-0x0;var _0x285ddf=_0x4d39[_0x17b3d2];return _0x285ddf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x94d3('0x0'));var timeout=require(_0x94d3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x94d3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x94d3('0x3'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0x94d3('0x4')]('/',auth[_0x94d3('0x5')](),controller[_0x94d3('0x6')]);router['get'](_0x94d3('0x7'),auth[_0x94d3('0x5')](),controller['show']);router['get'](_0x94d3('0x8'),auth['isAuthenticated'](),controller[_0x94d3('0x9')]);router[_0x94d3('0x4')](_0x94d3('0xa'),auth[_0x94d3('0x5')](),controller['getSubjects']);router[_0x94d3('0x4')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x94d3('0xb')]);router[_0x94d3('0xc')]('/',auth['isAuthenticated'](),controller[_0x94d3('0xd')]);router[_0x94d3('0xe')](_0x94d3('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x94d3('0xf')](_0x94d3('0x7'),auth[_0x94d3('0x5')](),controller[_0x94d3('0x10')]);module[_0x94d3('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 9e9128e..af3eb52 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 _0xe303=['exports','STRING','sequelize'];(function(_0x438f3f,_0xe90f31){var _0x1f541f=function(_0x41dd0d){while(--_0x41dd0d){_0x438f3f['push'](_0x438f3f['shift']());}};_0x1f541f(++_0xe90f31);}(_0xe303,0x19d));var _0x3e30=function(_0x5b7bf2,_0x4b4264){_0x5b7bf2=_0x5b7bf2-0x0;var _0x404a6c=_0xe303[_0x5b7bf2];return _0x404a6c;};'use strict';var Sequelize=require(_0x3e30('0x0'));module[_0x3e30('0x1')]={'name':{'type':Sequelize[_0x3e30('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf7cd=['exports','STRING','sequelize'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xf7cd,0x122));var _0xdf7c=function(_0x4a0c50,_0x57e9a1){_0x4a0c50=_0x4a0c50-0x0;var _0x5b8b5a=_0xf7cd[_0x4a0c50];return _0x5b8b5a;};'use strict';var Sequelize=require(_0xdf7c('0x0'));module[_0xdf7c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdf7c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 39b26e4..e13a709 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 _0x5f86=['limit','count','set','reject','save','then','end','sendStatus','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','filters','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','keys','intersection','fields','include','find','create','update','body','params','getFields','VtigerField','nolimit','findOne','getSubjects','getDescriptions','rimraf','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','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x4866fd,_0x476258){var _0xd5beca=function(_0x3b24fe){while(--_0x3b24fe){_0x4866fd['push'](_0x4866fd['shift']());}};_0xd5beca(++_0x476258);}(_0x5f86,0x81));var _0x65f8=function(_0x24a96d,_0x1b24f0){_0x24a96d=_0x24a96d-0x0;var _0x1772c5=_0x5f86[_0x24a96d];return _0x1772c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x65f8('0x1'));var moment=require(_0x65f8('0x2'));var BPromise=require(_0x65f8('0x3'));var Mustache=require(_0x65f8('0x4'));var util=require(_0x65f8('0x5'));var path=require(_0x65f8('0x6'));var sox=require(_0x65f8('0x7'));var csv=require(_0x65f8('0x8'));var ejs=require(_0x65f8('0x9'));var fs=require('fs');var fs_extra=require(_0x65f8('0xa'));var _=require(_0x65f8('0xb'));var squel=require(_0x65f8('0xc'));var crypto=require(_0x65f8('0xd'));var jsforce=require(_0x65f8('0xe'));var deskjs=require(_0x65f8('0xf'));var toCsv=require(_0x65f8('0x8'));var querystring=require(_0x65f8('0x10'));var Papa=require(_0x65f8('0x11'));var Redis=require(_0x65f8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x65f8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65f8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x65f8('0x15'));var config=require(_0x65f8('0x16'));var licenseUtil=require(_0x65f8('0x17'));var db=require(_0x65f8('0x18'))['db'];function respondWithStatusCode(_0x701288,_0xdb584e){_0xdb584e=_0xdb584e||0xcc;return function(_0x2bbe78){if(_0x2bbe78){return _0x701288['sendStatus'](_0xdb584e);}return _0x701288['status'](_0xdb584e)['end']();};}function respondWithResult(_0x453563,_0x313dec){_0x313dec=_0x313dec||0xc8;return function(_0x2e9e9c){if(_0x2e9e9c){return _0x453563[_0x65f8('0x19')](_0x313dec)[_0x65f8('0x1a')](_0x2e9e9c);}};}function respondWithFilteredResult(_0x1a6ecc,_0x374cbd){return function(_0x317c51){if(_0x317c51){var _0x24a5c4=typeof _0x374cbd[_0x65f8('0x1b')]===_0x65f8('0x1c')&&typeof _0x374cbd[_0x65f8('0x1d')]===_0x65f8('0x1c');var _0x6ccc46=_0x317c51[_0x65f8('0x1e')];var _0x31fca5=_0x24a5c4?0x0:_0x374cbd[_0x65f8('0x1b')];var _0x36ab8b=_0x24a5c4?_0x317c51[_0x65f8('0x1e')]:_0x374cbd['offset']+_0x374cbd[_0x65f8('0x1d')];var _0x1d5419;if(_0x36ab8b>=_0x6ccc46){_0x36ab8b=_0x6ccc46;_0x1d5419=0xc8;}else{_0x1d5419=0xce;}_0x1a6ecc[_0x65f8('0x19')](_0x1d5419);return _0x1a6ecc[_0x65f8('0x1f')]('Content-Range',_0x31fca5+'-'+_0x36ab8b+'/'+_0x6ccc46)[_0x65f8('0x1a')](_0x317c51);}return null;};}function patchUpdates(_0x20491a){return function(_0x16ea55){try{jsonpatch['apply'](_0x16ea55,_0x20491a,!![]);}catch(_0xf9af33){return BPromise[_0x65f8('0x20')](_0xf9af33);}return _0x16ea55[_0x65f8('0x21')]();};}function saveUpdates(_0xbc98f4,_0x6ca8b0){return function(_0x41eda5){if(_0x41eda5){return _0x41eda5['update'](_0xbc98f4)[_0x65f8('0x22')](function(_0x251783){return _0x251783;});}return null;};}function removeEntity(_0x546e17,_0x3ce982){return function(_0x3fbc91){if(_0x3fbc91){return _0x3fbc91['destroy']()[_0x65f8('0x22')](function(){_0x546e17['status'](0xcc)[_0x65f8('0x23')]();});}};}function handleEntityNotFound(_0x329b38,_0x56714f){return function(_0x42a960){if(!_0x42a960){_0x329b38[_0x65f8('0x24')](0x194);}return _0x42a960;};}function handleError(_0x3b91b5,_0xc4f6f3){_0xc4f6f3=_0xc4f6f3||0x1f4;return function(_0x19eb0c){logger[_0x65f8('0x25')](_0x19eb0c[_0x65f8('0x26')]);if(_0x19eb0c[_0x65f8('0x27')]){delete _0x19eb0c['name'];}_0x3b91b5[_0x65f8('0x19')](_0xc4f6f3)['send'](_0x19eb0c);};}exports[_0x65f8('0x28')]=function(_0x458ec9,_0x5a732f){var _0x30a404={},_0x18176b={},_0x5613fb={'count':0x0,'rows':[]};var _0x50c361=_[_0x65f8('0x29')](db[_0x65f8('0x2a')][_0x65f8('0x2b')],function(_0x3ea967){return{'name':_0x3ea967[_0x65f8('0x2c')],'type':_0x3ea967['type'][_0x65f8('0x2d')]};});_0x18176b[_0x65f8('0x2e')]=_['map'](_0x50c361,_0x65f8('0x27'));_0x18176b[_0x65f8('0x2f')]=_['keys'](_0x458ec9[_0x65f8('0x2f')]);_0x18176b[_0x65f8('0x30')]=_['intersection'](_0x18176b['model'],_0x18176b[_0x65f8('0x2f')]);_0x30a404[_0x65f8('0x31')]=_['intersection'](_0x18176b[_0x65f8('0x2e')],qs['fields'](_0x458ec9[_0x65f8('0x2f')]['fields']));_0x30a404[_0x65f8('0x31')]=_0x30a404[_0x65f8('0x31')][_0x65f8('0x32')]?_0x30a404[_0x65f8('0x31')]:_0x18176b[_0x65f8('0x2e')];if(!_0x458ec9[_0x65f8('0x2f')][_0x65f8('0x33')]('nolimit')){_0x30a404['limit']=qs[_0x65f8('0x1d')](_0x458ec9[_0x65f8('0x2f')][_0x65f8('0x1d')]);_0x30a404[_0x65f8('0x1b')]=qs['offset'](_0x458ec9[_0x65f8('0x2f')][_0x65f8('0x1b')]);}_0x30a404[_0x65f8('0x34')]=qs[_0x65f8('0x35')](_0x458ec9[_0x65f8('0x2f')][_0x65f8('0x35')]);_0x30a404['where']=qs[_0x65f8('0x30')](_[_0x65f8('0x36')](_0x458ec9['query'],_0x18176b[_0x65f8('0x30')]),_0x50c361);if(_0x458ec9[_0x65f8('0x2f')][_0x65f8('0x37')]){_0x30a404[_0x65f8('0x38')]=_[_0x65f8('0x39')](_0x30a404[_0x65f8('0x38')],{'$or':_['map'](_0x50c361,function(_0x34010b){if(_0x34010b['type']!==_0x65f8('0x3a')){var _0xf6716c={};_0xf6716c[_0x34010b['name']]={'$like':'%'+_0x458ec9[_0x65f8('0x2f')][_0x65f8('0x37')]+'%'};return _0xf6716c;}})});}_0x30a404=_[_0x65f8('0x39')]({},_0x30a404,_0x458ec9[_0x65f8('0x3b')]);var _0x4221e5={'where':_0x30a404[_0x65f8('0x38')]};return db[_0x65f8('0x2a')][_0x65f8('0x1e')](_0x4221e5)[_0x65f8('0x22')](function(_0x2ce455){_0x5613fb[_0x65f8('0x1e')]=_0x2ce455;if(_0x458ec9['query']['includeAll']){_0x30a404['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x65f8('0x3c')](_0x30a404);})[_0x65f8('0x22')](function(_0x47cdf6){_0x5613fb[_0x65f8('0x3d')]=_0x47cdf6;return _0x5613fb;})[_0x65f8('0x22')](respondWithFilteredResult(_0x5a732f,_0x30a404))[_0x65f8('0x3e')](handleError(_0x5a732f,null));};exports[_0x65f8('0x3f')]=function(_0x25f24c,_0x52239a){var _0x5d7db1={'raw':![],'where':{'id':_0x25f24c['params']['id']}},_0x540175={};_0x540175[_0x65f8('0x2e')]=_[_0x65f8('0x40')](db[_0x65f8('0x2a')][_0x65f8('0x2b')]);_0x540175[_0x65f8('0x2f')]=_[_0x65f8('0x40')](_0x25f24c[_0x65f8('0x2f')]);_0x540175[_0x65f8('0x30')]=_[_0x65f8('0x41')](_0x540175[_0x65f8('0x2e')],_0x540175['query']);_0x5d7db1['attributes']=_[_0x65f8('0x41')](_0x540175['model'],qs[_0x65f8('0x42')](_0x25f24c['query'][_0x65f8('0x42')]));_0x5d7db1['attributes']=_0x5d7db1[_0x65f8('0x31')][_0x65f8('0x32')]?_0x5d7db1[_0x65f8('0x31')]:_0x540175[_0x65f8('0x2e')];if(_0x25f24c[_0x65f8('0x2f')]['includeAll']){_0x5d7db1[_0x65f8('0x43')]=[{'all':!![]}];}_0x5d7db1=_[_0x65f8('0x39')]({},_0x5d7db1,_0x25f24c[_0x65f8('0x3b')]);return db[_0x65f8('0x2a')][_0x65f8('0x44')](_0x5d7db1)['then'](handleEntityNotFound(_0x52239a,null))['then'](respondWithResult(_0x52239a,null))[_0x65f8('0x3e')](handleError(_0x52239a,null));};exports[_0x65f8('0x45')]=function(_0x49b51c,_0x5b48aa){return db[_0x65f8('0x2a')][_0x65f8('0x45')](_0x49b51c['body'],{})[_0x65f8('0x22')](respondWithResult(_0x5b48aa,0xc9))[_0x65f8('0x3e')](handleError(_0x5b48aa,null));};exports[_0x65f8('0x46')]=function(_0x4dca9e,_0x13948b){if(_0x4dca9e[_0x65f8('0x47')]['id']){delete _0x4dca9e['body']['id'];}return db[_0x65f8('0x2a')][_0x65f8('0x44')]({'where':{'id':_0x4dca9e[_0x65f8('0x48')]['id']}})[_0x65f8('0x22')](handleEntityNotFound(_0x13948b,null))[_0x65f8('0x22')](saveUpdates(_0x4dca9e['body'],null))[_0x65f8('0x22')](respondWithResult(_0x13948b,null))[_0x65f8('0x3e')](handleError(_0x13948b,null));};exports['destroy']=function(_0x5a4564,_0x47b249){return db['VtigerConfiguration']['find']({'where':{'id':_0x5a4564[_0x65f8('0x48')]['id']}})[_0x65f8('0x22')](handleEntityNotFound(_0x47b249,null))[_0x65f8('0x22')](removeEntity(_0x47b249,null))[_0x65f8('0x3e')](handleError(_0x47b249,null));};exports[_0x65f8('0x49')]=function(_0x479b4b,_0x2b9daa,_0x369798){var _0x5c0334={};var _0x1de709={};var _0x5ec25b;var _0x105e12;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x479b4b[_0x65f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b9daa,null))[_0x65f8('0x22')](function(_0x513dfd){if(_0x513dfd){_0x5ec25b=_0x513dfd;_0x1de709[_0x65f8('0x2e')]=_['keys'](db[_0x65f8('0x4a')][_0x65f8('0x2b')]);_0x1de709[_0x65f8('0x2f')]=_['keys'](_0x479b4b[_0x65f8('0x2f')]);_0x1de709[_0x65f8('0x30')]=_[_0x65f8('0x41')](_0x1de709[_0x65f8('0x2e')],_0x1de709[_0x65f8('0x2f')]);_0x5c0334[_0x65f8('0x31')]=_['intersection'](_0x1de709['model'],qs[_0x65f8('0x42')](_0x479b4b[_0x65f8('0x2f')]['fields']));_0x5c0334[_0x65f8('0x31')]=_0x5c0334[_0x65f8('0x31')][_0x65f8('0x32')]?_0x5c0334['attributes']:_0x1de709[_0x65f8('0x2e')];_0x5c0334[_0x65f8('0x34')]=qs[_0x65f8('0x35')](_0x479b4b['query']['sort']);_0x5c0334[_0x65f8('0x38')]=qs[_0x65f8('0x30')](_[_0x65f8('0x36')](_0x479b4b[_0x65f8('0x2f')],_0x1de709[_0x65f8('0x30')]));if(_0x479b4b['query'][_0x65f8('0x37')]){_0x5c0334[_0x65f8('0x38')]=_[_0x65f8('0x39')](_0x5c0334[_0x65f8('0x38')],{'$or':_[_0x65f8('0x29')](_0x5c0334['attributes'],function(_0x29504c){var _0x398633={};_0x398633[_0x29504c]={'$like':'%'+_0x479b4b[_0x65f8('0x2f')][_0x65f8('0x37')]+'%'};return _0x398633;})});}_0x5c0334=_[_0x65f8('0x39')]({},_0x5c0334,_0x479b4b[_0x65f8('0x3b')]);return _0x5ec25b[_0x65f8('0x49')](_0x5c0334);}})[_0x65f8('0x22')](function(_0x1d2427){if(_0x1d2427){_0x105e12=_0x1d2427[_0x65f8('0x32')];if(!_0x479b4b['query'][_0x65f8('0x33')](_0x65f8('0x4b'))){_0x5c0334['limit']=qs['limit'](_0x479b4b['query'][_0x65f8('0x1d')]);_0x5c0334['offset']=qs[_0x65f8('0x1b')](_0x479b4b[_0x65f8('0x2f')]['offset']);}return _0x5ec25b['getFields'](_0x5c0334);}})[_0x65f8('0x22')](function(_0x59ee50){if(_0x59ee50){return _0x59ee50?{'count':_0x105e12,'rows':_0x59ee50}:null;}})[_0x65f8('0x22')](respondWithResult(_0x2b9daa,null))[_0x65f8('0x3e')](handleError(_0x2b9daa,null));};exports['getSubjects']=function(_0x187cfc,_0x467367,_0x17be9f){var _0x4e15e6={};var _0x35c448={};var _0x12bfc8;var _0x33ea57;return db['VtigerConfiguration'][_0x65f8('0x4c')]({'where':{'id':_0x187cfc[_0x65f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x467367,null))[_0x65f8('0x22')](function(_0x46a30d){if(_0x46a30d){_0x12bfc8=_0x46a30d;_0x35c448[_0x65f8('0x2e')]=_[_0x65f8('0x40')](db[_0x65f8('0x4a')][_0x65f8('0x2b')]);_0x35c448[_0x65f8('0x2f')]=_[_0x65f8('0x40')](_0x187cfc[_0x65f8('0x2f')]);_0x35c448[_0x65f8('0x30')]=_[_0x65f8('0x41')](_0x35c448['model'],_0x35c448[_0x65f8('0x2f')]);_0x4e15e6['attributes']=_['intersection'](_0x35c448[_0x65f8('0x2e')],qs['fields'](_0x187cfc[_0x65f8('0x2f')][_0x65f8('0x42')]));_0x4e15e6[_0x65f8('0x31')]=_0x4e15e6[_0x65f8('0x31')][_0x65f8('0x32')]?_0x4e15e6[_0x65f8('0x31')]:_0x35c448['model'];_0x4e15e6[_0x65f8('0x34')]=qs[_0x65f8('0x35')](_0x187cfc[_0x65f8('0x2f')]['sort']);_0x4e15e6[_0x65f8('0x38')]=qs[_0x65f8('0x30')](_[_0x65f8('0x36')](_0x187cfc['query'],_0x35c448[_0x65f8('0x30')]));if(_0x187cfc[_0x65f8('0x2f')][_0x65f8('0x37')]){_0x4e15e6[_0x65f8('0x38')]=_[_0x65f8('0x39')](_0x4e15e6['where'],{'$or':_[_0x65f8('0x29')](_0x4e15e6['attributes'],function(_0x2430a4){var _0x2614f7={};_0x2614f7[_0x2430a4]={'$like':'%'+_0x187cfc[_0x65f8('0x2f')]['filter']+'%'};return _0x2614f7;})});}_0x4e15e6=_[_0x65f8('0x39')]({},_0x4e15e6,_0x187cfc['options']);return _0x12bfc8['getSubjects'](_0x4e15e6);}})[_0x65f8('0x22')](function(_0x562061){if(_0x562061){_0x33ea57=_0x562061[_0x65f8('0x32')];if(!_0x187cfc[_0x65f8('0x2f')]['hasOwnProperty'](_0x65f8('0x4b'))){_0x4e15e6[_0x65f8('0x1d')]=qs[_0x65f8('0x1d')](_0x187cfc[_0x65f8('0x2f')][_0x65f8('0x1d')]);_0x4e15e6[_0x65f8('0x1b')]=qs[_0x65f8('0x1b')](_0x187cfc[_0x65f8('0x2f')][_0x65f8('0x1b')]);}return _0x12bfc8[_0x65f8('0x4d')](_0x4e15e6);}})['then'](function(_0x4d7e99){if(_0x4d7e99){return _0x4d7e99?{'count':_0x33ea57,'rows':_0x4d7e99}:null;}})[_0x65f8('0x22')](respondWithResult(_0x467367,null))['catch'](handleError(_0x467367,null));};exports[_0x65f8('0x4e')]=function(_0x1a59fc,_0x1939eb,_0x5f12cf){var _0x49569d={};var _0x5d3a74={};var _0x256e0d;var _0x48cc2a;return db[_0x65f8('0x2a')]['findOne']({'where':{'id':_0x1a59fc['params']['id']}})['then'](handleEntityNotFound(_0x1939eb,null))[_0x65f8('0x22')](function(_0x4aa7c7){if(_0x4aa7c7){_0x256e0d=_0x4aa7c7;_0x5d3a74[_0x65f8('0x2e')]=_[_0x65f8('0x40')](db['VtigerField'][_0x65f8('0x2b')]);_0x5d3a74[_0x65f8('0x2f')]=_[_0x65f8('0x40')](_0x1a59fc[_0x65f8('0x2f')]);_0x5d3a74[_0x65f8('0x30')]=_['intersection'](_0x5d3a74[_0x65f8('0x2e')],_0x5d3a74[_0x65f8('0x2f')]);_0x49569d[_0x65f8('0x31')]=_[_0x65f8('0x41')](_0x5d3a74[_0x65f8('0x2e')],qs[_0x65f8('0x42')](_0x1a59fc[_0x65f8('0x2f')][_0x65f8('0x42')]));_0x49569d[_0x65f8('0x31')]=_0x49569d[_0x65f8('0x31')]['length']?_0x49569d[_0x65f8('0x31')]:_0x5d3a74['model'];_0x49569d['order']=qs['sort'](_0x1a59fc['query'][_0x65f8('0x35')]);_0x49569d[_0x65f8('0x38')]=qs[_0x65f8('0x30')](_[_0x65f8('0x36')](_0x1a59fc[_0x65f8('0x2f')],_0x5d3a74[_0x65f8('0x30')]));if(_0x1a59fc[_0x65f8('0x2f')][_0x65f8('0x37')]){_0x49569d[_0x65f8('0x38')]=_[_0x65f8('0x39')](_0x49569d[_0x65f8('0x38')],{'$or':_[_0x65f8('0x29')](_0x49569d[_0x65f8('0x31')],function(_0xf2cee8){var _0x102472={};_0x102472[_0xf2cee8]={'$like':'%'+_0x1a59fc[_0x65f8('0x2f')][_0x65f8('0x37')]+'%'};return _0x102472;})});}_0x49569d=_[_0x65f8('0x39')]({},_0x49569d,_0x1a59fc[_0x65f8('0x3b')]);return _0x256e0d[_0x65f8('0x4e')](_0x49569d);}})[_0x65f8('0x22')](function(_0x16fd0c){if(_0x16fd0c){_0x48cc2a=_0x16fd0c[_0x65f8('0x32')];if(!_0x1a59fc[_0x65f8('0x2f')][_0x65f8('0x33')](_0x65f8('0x4b'))){_0x49569d['limit']=qs['limit'](_0x1a59fc[_0x65f8('0x2f')][_0x65f8('0x1d')]);_0x49569d['offset']=qs[_0x65f8('0x1b')](_0x1a59fc['query'][_0x65f8('0x1b')]);}return _0x256e0d[_0x65f8('0x4e')](_0x49569d);}})[_0x65f8('0x22')](function(_0x5a1b1a){if(_0x5a1b1a){return _0x5a1b1a?{'count':_0x48cc2a,'rows':_0x5a1b1a}:null;}})[_0x65f8('0x22')](respondWithResult(_0x1939eb,null))[_0x65f8('0x3e')](handleError(_0x1939eb,null));}; \ No newline at end of file +var _0x357b=['hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','filter','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes'];(function(_0xdd5b46,_0x1ee134){var _0xbd60bc=function(_0x461687){while(--_0x461687){_0xdd5b46['push'](_0xdd5b46['shift']());}};_0xbd60bc(++_0x1ee134);}(_0x357b,0x164));var _0xb357=function(_0x4872a8,_0x51271a){_0x4872a8=_0x4872a8-0x0;var _0x5a435c=_0x357b[_0x4872a8];return _0x5a435c;};'use strict';var emlformat=require(_0xb357('0x0'));var rimraf=require(_0xb357('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb357('0x2'));var rp=require('request-promise');var moment=require(_0xb357('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb357('0x4'));var util=require('util');var path=require(_0xb357('0x5'));var sox=require(_0xb357('0x6'));var csv=require('to-csv');var ejs=require(_0xb357('0x7'));var fs=require('fs');var fs_extra=require(_0xb357('0x8'));var _=require(_0xb357('0x9'));var squel=require(_0xb357('0xa'));var crypto=require('crypto');var jsforce=require(_0xb357('0xb'));var deskjs=require(_0xb357('0xc'));var toCsv=require(_0xb357('0xd'));var querystring=require(_0xb357('0xe'));var Papa=require(_0xb357('0xf'));var Redis=require(_0xb357('0x10'));var authService=require(_0xb357('0x11'));var qs=require(_0xb357('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb357('0x13'));var logger=require('../../config/logger')(_0xb357('0x14'));var utils=require('../../config/utils');var config=require(_0xb357('0x15'));var licenseUtil=require(_0xb357('0x16'));var db=require(_0xb357('0x17'))['db'];function respondWithStatusCode(_0x9fe438,_0x22107a){_0x22107a=_0x22107a||0xcc;return function(_0xd3c7bc){if(_0xd3c7bc){return _0x9fe438[_0xb357('0x18')](_0x22107a);}return _0x9fe438['status'](_0x22107a)[_0xb357('0x19')]();};}function respondWithResult(_0x48d388,_0x4214d5){_0x4214d5=_0x4214d5||0xc8;return function(_0x357474){if(_0x357474){return _0x48d388[_0xb357('0x1a')](_0x4214d5)[_0xb357('0x1b')](_0x357474);}};}function respondWithFilteredResult(_0x4f5fec,_0x2ea922){return function(_0x2ed5c7){if(_0x2ed5c7){var _0x3159ca=typeof _0x2ea922[_0xb357('0x1c')]===_0xb357('0x1d')&&typeof _0x2ea922['limit']==='undefined';var _0x47da91=_0x2ed5c7[_0xb357('0x1e')];var _0x2f1536=_0x3159ca?0x0:_0x2ea922[_0xb357('0x1c')];var _0x4a0201=_0x3159ca?_0x2ed5c7[_0xb357('0x1e')]:_0x2ea922[_0xb357('0x1c')]+_0x2ea922['limit'];var _0x36c3f5;if(_0x4a0201>=_0x47da91){_0x4a0201=_0x47da91;_0x36c3f5=0xc8;}else{_0x36c3f5=0xce;}_0x4f5fec[_0xb357('0x1a')](_0x36c3f5);return _0x4f5fec[_0xb357('0x1f')](_0xb357('0x20'),_0x2f1536+'-'+_0x4a0201+'/'+_0x47da91)[_0xb357('0x1b')](_0x2ed5c7);}return null;};}function patchUpdates(_0x2e15e5){return function(_0x18b8aa){try{jsonpatch[_0xb357('0x21')](_0x18b8aa,_0x2e15e5,!![]);}catch(_0x301c1e){return BPromise['reject'](_0x301c1e);}return _0x18b8aa[_0xb357('0x22')]();};}function saveUpdates(_0x23c16d,_0x50a80e){return function(_0x17adde){if(_0x17adde){return _0x17adde[_0xb357('0x23')](_0x23c16d)[_0xb357('0x24')](function(_0x486762){return _0x486762;});}return null;};}function removeEntity(_0x974d00,_0x5072da){return function(_0x3d45e7){if(_0x3d45e7){return _0x3d45e7[_0xb357('0x25')]()['then'](function(){_0x974d00[_0xb357('0x1a')](0xcc)[_0xb357('0x19')]();});}};}function handleEntityNotFound(_0x377be2,_0x1cb70a){return function(_0x4fc13b){if(!_0x4fc13b){_0x377be2[_0xb357('0x18')](0x194);}return _0x4fc13b;};}function handleError(_0x313b13,_0x3dd495){_0x3dd495=_0x3dd495||0x1f4;return function(_0x3d2ae3){logger[_0xb357('0x26')](_0x3d2ae3['stack']);if(_0x3d2ae3['name']){delete _0x3d2ae3[_0xb357('0x27')];}_0x313b13[_0xb357('0x1a')](_0x3dd495)[_0xb357('0x28')](_0x3d2ae3);};}exports[_0xb357('0x29')]=function(_0x1cc5d5,_0x5b5a4c){var _0x249edd={},_0xca613a={},_0x86bb44={'count':0x0,'rows':[]};var _0x1ac6a4=_[_0xb357('0x2a')](db[_0xb357('0x2b')][_0xb357('0x2c')],function(_0x2ca1d7){return{'name':_0x2ca1d7[_0xb357('0x2d')],'type':_0x2ca1d7[_0xb357('0x2e')][_0xb357('0x2f')]};});_0xca613a[_0xb357('0x30')]=_[_0xb357('0x2a')](_0x1ac6a4,_0xb357('0x27'));_0xca613a['query']=_[_0xb357('0x31')](_0x1cc5d5['query']);_0xca613a['filters']=_[_0xb357('0x32')](_0xca613a['model'],_0xca613a[_0xb357('0x33')]);_0x249edd['attributes']=_['intersection'](_0xca613a['model'],qs[_0xb357('0x34')](_0x1cc5d5[_0xb357('0x33')][_0xb357('0x34')]));_0x249edd[_0xb357('0x35')]=_0x249edd['attributes']['length']?_0x249edd[_0xb357('0x35')]:_0xca613a[_0xb357('0x30')];if(!_0x1cc5d5[_0xb357('0x33')][_0xb357('0x36')](_0xb357('0x37'))){_0x249edd[_0xb357('0x38')]=qs['limit'](_0x1cc5d5[_0xb357('0x33')][_0xb357('0x38')]);_0x249edd[_0xb357('0x1c')]=qs[_0xb357('0x1c')](_0x1cc5d5[_0xb357('0x33')][_0xb357('0x1c')]);}_0x249edd[_0xb357('0x39')]=qs[_0xb357('0x3a')](_0x1cc5d5[_0xb357('0x33')][_0xb357('0x3a')]);_0x249edd[_0xb357('0x3b')]=qs[_0xb357('0x3c')](_[_0xb357('0x3d')](_0x1cc5d5[_0xb357('0x33')],_0xca613a[_0xb357('0x3c')]),_0x1ac6a4);if(_0x1cc5d5[_0xb357('0x33')]['filter']){_0x249edd[_0xb357('0x3b')]=_[_0xb357('0x3e')](_0x249edd[_0xb357('0x3b')],{'$or':_['map'](_0x1ac6a4,function(_0x3b35cf){if(_0x3b35cf[_0xb357('0x2e')]!==_0xb357('0x3f')){var _0x44cef9={};_0x44cef9[_0x3b35cf[_0xb357('0x27')]]={'$like':'%'+_0x1cc5d5['query']['filter']+'%'};return _0x44cef9;}})});}_0x249edd=_['merge']({},_0x249edd,_0x1cc5d5[_0xb357('0x40')]);var _0x16cfe6={'where':_0x249edd['where']};return db[_0xb357('0x2b')][_0xb357('0x1e')](_0x16cfe6)[_0xb357('0x24')](function(_0x4098ac){_0x86bb44['count']=_0x4098ac;if(_0x1cc5d5[_0xb357('0x33')][_0xb357('0x41')]){_0x249edd[_0xb357('0x42')]=[{'all':!![]}];}return db[_0xb357('0x2b')][_0xb357('0x43')](_0x249edd);})['then'](function(_0x37d509){_0x86bb44[_0xb357('0x44')]=_0x37d509;return _0x86bb44;})[_0xb357('0x24')](respondWithFilteredResult(_0x5b5a4c,_0x249edd))[_0xb357('0x45')](handleError(_0x5b5a4c,null));};exports[_0xb357('0x46')]=function(_0x5c717a,_0x431215){var _0x1ab3c9={'raw':![],'where':{'id':_0x5c717a[_0xb357('0x47')]['id']}},_0x7b1b13={};_0x7b1b13[_0xb357('0x30')]=_[_0xb357('0x31')](db[_0xb357('0x2b')][_0xb357('0x2c')]);_0x7b1b13[_0xb357('0x33')]=_[_0xb357('0x31')](_0x5c717a[_0xb357('0x33')]);_0x7b1b13[_0xb357('0x3c')]=_[_0xb357('0x32')](_0x7b1b13['model'],_0x7b1b13[_0xb357('0x33')]);_0x1ab3c9[_0xb357('0x35')]=_['intersection'](_0x7b1b13[_0xb357('0x30')],qs[_0xb357('0x34')](_0x5c717a[_0xb357('0x33')][_0xb357('0x34')]));_0x1ab3c9[_0xb357('0x35')]=_0x1ab3c9[_0xb357('0x35')][_0xb357('0x48')]?_0x1ab3c9[_0xb357('0x35')]:_0x7b1b13[_0xb357('0x30')];if(_0x5c717a[_0xb357('0x33')][_0xb357('0x41')]){_0x1ab3c9[_0xb357('0x42')]=[{'all':!![]}];}_0x1ab3c9=_['merge']({},_0x1ab3c9,_0x5c717a[_0xb357('0x40')]);return db[_0xb357('0x2b')][_0xb357('0x49')](_0x1ab3c9)[_0xb357('0x24')](handleEntityNotFound(_0x431215,null))[_0xb357('0x24')](respondWithResult(_0x431215,null))[_0xb357('0x45')](handleError(_0x431215,null));};exports['create']=function(_0x1de398,_0x5050c9){return db['VtigerConfiguration'][_0xb357('0x4a')](_0x1de398[_0xb357('0x4b')],{})['then'](respondWithResult(_0x5050c9,0xc9))[_0xb357('0x45')](handleError(_0x5050c9,null));};exports[_0xb357('0x23')]=function(_0x5f56c8,_0x5d10e2){if(_0x5f56c8['body']['id']){delete _0x5f56c8[_0xb357('0x4b')]['id'];}return db[_0xb357('0x2b')][_0xb357('0x49')]({'where':{'id':_0x5f56c8[_0xb357('0x47')]['id']}})[_0xb357('0x24')](handleEntityNotFound(_0x5d10e2,null))[_0xb357('0x24')](saveUpdates(_0x5f56c8[_0xb357('0x4b')],null))[_0xb357('0x24')](respondWithResult(_0x5d10e2,null))[_0xb357('0x45')](handleError(_0x5d10e2,null));};exports['destroy']=function(_0xa05bde,_0x1135fd){return db[_0xb357('0x2b')][_0xb357('0x49')]({'where':{'id':_0xa05bde[_0xb357('0x47')]['id']}})[_0xb357('0x24')](handleEntityNotFound(_0x1135fd,null))['then'](removeEntity(_0x1135fd,null))[_0xb357('0x45')](handleError(_0x1135fd,null));};exports[_0xb357('0x4c')]=function(_0x551c0b,_0x520ea4,_0x322f5a){var _0x5a78c6={};var _0x392c9a={};var _0x9f5c86;var _0x26397b;return db[_0xb357('0x2b')][_0xb357('0x4d')]({'where':{'id':_0x551c0b[_0xb357('0x47')]['id']}})['then'](handleEntityNotFound(_0x520ea4,null))[_0xb357('0x24')](function(_0x51ec22){if(_0x51ec22){_0x9f5c86=_0x51ec22;_0x392c9a['model']=_[_0xb357('0x31')](db['VtigerField'][_0xb357('0x2c')]);_0x392c9a[_0xb357('0x33')]=_['keys'](_0x551c0b['query']);_0x392c9a[_0xb357('0x3c')]=_[_0xb357('0x32')](_0x392c9a[_0xb357('0x30')],_0x392c9a[_0xb357('0x33')]);_0x5a78c6[_0xb357('0x35')]=_[_0xb357('0x32')](_0x392c9a[_0xb357('0x30')],qs[_0xb357('0x34')](_0x551c0b[_0xb357('0x33')]['fields']));_0x5a78c6[_0xb357('0x35')]=_0x5a78c6[_0xb357('0x35')][_0xb357('0x48')]?_0x5a78c6['attributes']:_0x392c9a[_0xb357('0x30')];_0x5a78c6[_0xb357('0x39')]=qs[_0xb357('0x3a')](_0x551c0b[_0xb357('0x33')]['sort']);_0x5a78c6[_0xb357('0x3b')]=qs[_0xb357('0x3c')](_[_0xb357('0x3d')](_0x551c0b['query'],_0x392c9a[_0xb357('0x3c')]));if(_0x551c0b[_0xb357('0x33')][_0xb357('0x4e')]){_0x5a78c6[_0xb357('0x3b')]=_[_0xb357('0x3e')](_0x5a78c6['where'],{'$or':_[_0xb357('0x2a')](_0x5a78c6[_0xb357('0x35')],function(_0x488ffa){var _0x76b10f={};_0x76b10f[_0x488ffa]={'$like':'%'+_0x551c0b[_0xb357('0x33')][_0xb357('0x4e')]+'%'};return _0x76b10f;})});}_0x5a78c6=_[_0xb357('0x3e')]({},_0x5a78c6,_0x551c0b[_0xb357('0x40')]);return _0x9f5c86[_0xb357('0x4c')](_0x5a78c6);}})[_0xb357('0x24')](function(_0x14acbe){if(_0x14acbe){_0x26397b=_0x14acbe[_0xb357('0x48')];if(!_0x551c0b['query']['hasOwnProperty'](_0xb357('0x37'))){_0x5a78c6[_0xb357('0x38')]=qs['limit'](_0x551c0b[_0xb357('0x33')][_0xb357('0x38')]);_0x5a78c6[_0xb357('0x1c')]=qs[_0xb357('0x1c')](_0x551c0b['query'][_0xb357('0x1c')]);}return _0x9f5c86[_0xb357('0x4c')](_0x5a78c6);}})[_0xb357('0x24')](function(_0x378a83){if(_0x378a83){return _0x378a83?{'count':_0x26397b,'rows':_0x378a83}:null;}})[_0xb357('0x24')](respondWithResult(_0x520ea4,null))[_0xb357('0x45')](handleError(_0x520ea4,null));};exports[_0xb357('0x4f')]=function(_0x14818d,_0x26098d,_0x184bf1){var _0xb2ff57={};var _0x31e9e6={};var _0x46561f;var _0x4a2cce;return db[_0xb357('0x2b')][_0xb357('0x4d')]({'where':{'id':_0x14818d['params']['id']}})[_0xb357('0x24')](handleEntityNotFound(_0x26098d,null))[_0xb357('0x24')](function(_0x17fce4){if(_0x17fce4){_0x46561f=_0x17fce4;_0x31e9e6[_0xb357('0x30')]=_[_0xb357('0x31')](db[_0xb357('0x50')][_0xb357('0x2c')]);_0x31e9e6[_0xb357('0x33')]=_[_0xb357('0x31')](_0x14818d[_0xb357('0x33')]);_0x31e9e6[_0xb357('0x3c')]=_['intersection'](_0x31e9e6[_0xb357('0x30')],_0x31e9e6[_0xb357('0x33')]);_0xb2ff57[_0xb357('0x35')]=_[_0xb357('0x32')](_0x31e9e6[_0xb357('0x30')],qs['fields'](_0x14818d['query']['fields']));_0xb2ff57['attributes']=_0xb2ff57[_0xb357('0x35')][_0xb357('0x48')]?_0xb2ff57[_0xb357('0x35')]:_0x31e9e6[_0xb357('0x30')];_0xb2ff57[_0xb357('0x39')]=qs[_0xb357('0x3a')](_0x14818d[_0xb357('0x33')][_0xb357('0x3a')]);_0xb2ff57[_0xb357('0x3b')]=qs['filters'](_[_0xb357('0x3d')](_0x14818d[_0xb357('0x33')],_0x31e9e6[_0xb357('0x3c')]));if(_0x14818d[_0xb357('0x33')][_0xb357('0x4e')]){_0xb2ff57['where']=_['merge'](_0xb2ff57[_0xb357('0x3b')],{'$or':_[_0xb357('0x2a')](_0xb2ff57['attributes'],function(_0x8f2d37){var _0x123f08={};_0x123f08[_0x8f2d37]={'$like':'%'+_0x14818d['query']['filter']+'%'};return _0x123f08;})});}_0xb2ff57=_[_0xb357('0x3e')]({},_0xb2ff57,_0x14818d[_0xb357('0x40')]);return _0x46561f[_0xb357('0x4f')](_0xb2ff57);}})[_0xb357('0x24')](function(_0x15e045){if(_0x15e045){_0x4a2cce=_0x15e045['length'];if(!_0x14818d[_0xb357('0x33')][_0xb357('0x36')](_0xb357('0x37'))){_0xb2ff57[_0xb357('0x38')]=qs[_0xb357('0x38')](_0x14818d[_0xb357('0x33')][_0xb357('0x38')]);_0xb2ff57[_0xb357('0x1c')]=qs['offset'](_0x14818d[_0xb357('0x33')][_0xb357('0x1c')]);}return _0x46561f[_0xb357('0x4f')](_0xb2ff57);}})[_0xb357('0x24')](function(_0x15a6ce){if(_0x15a6ce){return _0x15a6ce?{'count':_0x4a2cce,'rows':_0x15a6ce}:null;}})[_0xb357('0x24')](respondWithResult(_0x26098d,null))[_0xb357('0x45')](handleError(_0x26098d,null));};exports['getDescriptions']=function(_0x2f9960,_0x4969aa,_0x3e8d45){var _0x30b351={};var _0xc3e09e={};var _0x1c956f;var _0x578bec;return db['VtigerConfiguration'][_0xb357('0x4d')]({'where':{'id':_0x2f9960[_0xb357('0x47')]['id']}})[_0xb357('0x24')](handleEntityNotFound(_0x4969aa,null))[_0xb357('0x24')](function(_0xfa3717){if(_0xfa3717){_0x1c956f=_0xfa3717;_0xc3e09e[_0xb357('0x30')]=_[_0xb357('0x31')](db['VtigerField'][_0xb357('0x2c')]);_0xc3e09e[_0xb357('0x33')]=_['keys'](_0x2f9960[_0xb357('0x33')]);_0xc3e09e[_0xb357('0x3c')]=_[_0xb357('0x32')](_0xc3e09e[_0xb357('0x30')],_0xc3e09e[_0xb357('0x33')]);_0x30b351[_0xb357('0x35')]=_[_0xb357('0x32')](_0xc3e09e['model'],qs[_0xb357('0x34')](_0x2f9960[_0xb357('0x33')][_0xb357('0x34')]));_0x30b351['attributes']=_0x30b351[_0xb357('0x35')][_0xb357('0x48')]?_0x30b351[_0xb357('0x35')]:_0xc3e09e[_0xb357('0x30')];_0x30b351[_0xb357('0x39')]=qs['sort'](_0x2f9960[_0xb357('0x33')][_0xb357('0x3a')]);_0x30b351['where']=qs[_0xb357('0x3c')](_['pick'](_0x2f9960[_0xb357('0x33')],_0xc3e09e[_0xb357('0x3c')]));if(_0x2f9960[_0xb357('0x33')][_0xb357('0x4e')]){_0x30b351[_0xb357('0x3b')]=_['merge'](_0x30b351[_0xb357('0x3b')],{'$or':_['map'](_0x30b351[_0xb357('0x35')],function(_0x427cc5){var _0x2778f4={};_0x2778f4[_0x427cc5]={'$like':'%'+_0x2f9960[_0xb357('0x33')][_0xb357('0x4e')]+'%'};return _0x2778f4;})});}_0x30b351=_[_0xb357('0x3e')]({},_0x30b351,_0x2f9960[_0xb357('0x40')]);return _0x1c956f['getDescriptions'](_0x30b351);}})[_0xb357('0x24')](function(_0x25567d){if(_0x25567d){_0x578bec=_0x25567d[_0xb357('0x48')];if(!_0x2f9960[_0xb357('0x33')][_0xb357('0x36')](_0xb357('0x37'))){_0x30b351[_0xb357('0x38')]=qs['limit'](_0x2f9960[_0xb357('0x33')][_0xb357('0x38')]);_0x30b351[_0xb357('0x1c')]=qs['offset'](_0x2f9960['query'][_0xb357('0x1c')]);}return _0x1c956f[_0xb357('0x51')](_0x30b351);}})[_0xb357('0x24')](function(_0xaf115a){if(_0xaf115a){return _0xaf115a?{'count':_0x578bec,'rows':_0xaf115a}:null;}})[_0xb357('0x24')](respondWithResult(_0x4969aa,null))[_0xb357('0x45')](handleError(_0x4969aa,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 8f44e21..b96daa7 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 _0x7bd9=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','VtigerConfiguration'];(function(_0x3d71ba,_0x49a38b){var _0x5e0ed0=function(_0x4d0bfb){while(--_0x4d0bfb){_0x3d71ba['push'](_0x3d71ba['shift']());}};_0x5e0ed0(++_0x49a38b);}(_0x7bd9,0x12c));var _0x97bd=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7bd9[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require(_0x97bd('0x0'));var logger=require(_0x97bd('0x1'))('api');var moment=require(_0x97bd('0x2'));var BPromise=require(_0x97bd('0x3'));var rp=require(_0x97bd('0x4'));var fs=require('fs');var path=require(_0x97bd('0x5'));var rimraf=require('rimraf');var config=require(_0x97bd('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x97bd('0x7')]=function(_0x4dda89,_0x74879a){return _0x4dda89[_0x97bd('0x8')](_0x97bd('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e1f=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2a57be,_0x5534eb){var _0x5018b8=function(_0x5a1b6e){while(--_0x5a1b6e){_0x2a57be['push'](_0x2a57be['shift']());}};_0x5018b8(++_0x5534eb);}(_0x6e1f,0x1cc));var _0xf6e1=function(_0x569cbb,_0x111eb4){_0x569cbb=_0x569cbb-0x0;var _0x39dc33=_0x6e1f[_0x569cbb];return _0x39dc33;};'use strict';var _=require(_0xf6e1('0x0'));var util=require(_0xf6e1('0x1'));var logger=require(_0xf6e1('0x2'))('api');var moment=require(_0xf6e1('0x3'));var BPromise=require(_0xf6e1('0x4'));var rp=require(_0xf6e1('0x5'));var fs=require('fs');var path=require(_0xf6e1('0x6'));var rimraf=require('rimraf');var config=require(_0xf6e1('0x7'));var attributes=require(_0xf6e1('0x8'));module[_0xf6e1('0x9')]=function(_0x2576fd,_0x3a9d47){return _0x2576fd[_0xf6e1('0xa')](_0xf6e1('0xb'),attributes,{'tableName':_0xf6e1('0xc'),'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 3b3e305..a2505be 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 _0x5a98=['jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x38a8f1,_0xb7d50b){var _0x597a64=function(_0x9cf344){while(--_0x9cf344){_0x38a8f1['push'](_0x38a8f1['shift']());}};_0x597a64(++_0xb7d50b);}(_0x5a98,0x152));var _0x85a9=function(_0x56e613,_0x5cd019){_0x56e613=_0x56e613-0x0;var _0x303225=_0x5a98[_0x56e613];return _0x303225;};'use strict';var _=require(_0x85a9('0x0'));var util=require(_0x85a9('0x1'));var moment=require('moment');var BPromise=require(_0x85a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85a9('0x3'))['db'];var utils=require(_0x85a9('0x4'));var logger=require(_0x85a9('0x5'))(_0x85a9('0x6'));var config=require('../../config/environment');var jayson=require(_0x85a9('0x7'));var client=jayson[_0x85a9('0x8')][_0x85a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ea60e,_0x4246ff,_0x135178){return new BPromise(function(_0x56d61f,_0x5a8cd0){return client[_0x85a9('0xa')](_0x3ea60e,_0x135178)[_0x85a9('0xb')](function(_0x6a0c9c){logger[_0x85a9('0xc')](_0x85a9('0xd'),_0x4246ff,_0x85a9('0xe'));logger[_0x85a9('0xf')](_0x85a9('0x10'),_0x4246ff,_0x85a9('0xe'),JSON[_0x85a9('0x11')](_0x6a0c9c));if(_0x6a0c9c[_0x85a9('0x12')]){if(_0x6a0c9c[_0x85a9('0x12')][_0x85a9('0x13')]===0x1f4){logger[_0x85a9('0x12')](_0x85a9('0xd'),_0x4246ff,_0x6a0c9c[_0x85a9('0x12')]['message']);return _0x5a8cd0(_0x6a0c9c['error']['message']);}logger[_0x85a9('0x12')](_0x85a9('0xd'),_0x4246ff,_0x6a0c9c[_0x85a9('0x12')][_0x85a9('0x14')]);return _0x56d61f(_0x6a0c9c[_0x85a9('0x12')][_0x85a9('0x14')]);}else{logger[_0x85a9('0xc')](_0x85a9('0xd'),_0x4246ff,_0x85a9('0xe'));_0x56d61f(_0x6a0c9c[_0x85a9('0x15')]['message']);}})[_0x85a9('0x16')](function(_0x133cb8){logger['error'](_0x85a9('0xd'),_0x4246ff,_0x133cb8);_0x5a8cd0(_0x133cb8);});});} \ No newline at end of file +var _0x9388=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x12a679,_0x1d6edd){var _0x1454d7=function(_0xe726f){while(--_0xe726f){_0x12a679['push'](_0x12a679['shift']());}};_0x1454d7(++_0x1d6edd);}(_0x9388,0x1e8));var _0x8938=function(_0x5a4567,_0x3d85fe){_0x5a4567=_0x5a4567-0x0;var _0x14fa61=_0x9388[_0x5a4567];return _0x14fa61;};'use strict';var _=require(_0x8938('0x0'));var util=require(_0x8938('0x1'));var moment=require(_0x8938('0x2'));var BPromise=require(_0x8938('0x3'));var rs=require(_0x8938('0x4'));var fs=require('fs');var Redis=require(_0x8938('0x5'));var db=require(_0x8938('0x6'))['db'];var utils=require(_0x8938('0x7'));var logger=require(_0x8938('0x8'))(_0x8938('0x9'));var config=require('../../config/environment');var jayson=require(_0x8938('0xa'));var client=jayson[_0x8938('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb30b,_0x1c1d23,_0x4c8e24){return new BPromise(function(_0x12dcc9,_0x35a9a5){return client[_0x8938('0xc')](_0x5bb30b,_0x4c8e24)[_0x8938('0xd')](function(_0x2230e2){logger['info'](_0x8938('0xe'),_0x1c1d23,_0x8938('0xf'));logger[_0x8938('0x10')](_0x8938('0x11'),_0x1c1d23,_0x8938('0xf'),JSON[_0x8938('0x12')](_0x2230e2));if(_0x2230e2[_0x8938('0x13')]){if(_0x2230e2[_0x8938('0x13')][_0x8938('0x14')]===0x1f4){logger[_0x8938('0x13')](_0x8938('0xe'),_0x1c1d23,_0x2230e2[_0x8938('0x13')][_0x8938('0x15')]);return _0x35a9a5(_0x2230e2[_0x8938('0x13')][_0x8938('0x15')]);}logger[_0x8938('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c1d23,_0x2230e2['error']['message']);return _0x12dcc9(_0x2230e2['error'][_0x8938('0x15')]);}else{logger[_0x8938('0x16')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c1d23,_0x8938('0xf'));_0x12dcc9(_0x2230e2[_0x8938('0x17')][_0x8938('0x15')]);}})['catch'](function(_0xa5f933){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1c1d23,_0xa5f933);_0x35a9a5(_0xa5f933);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5fa4799..88a47b9 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 _0xa082=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3386cd,_0x172c11){var _0x1fa4d1=function(_0x9ab96a){while(--_0x9ab96a){_0x3386cd['push'](_0x3386cd['shift']());}};_0x1fa4d1(++_0x172c11);}(_0xa082,0xba));var _0x2a08=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xa082[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x2a08('0x0'));var util=require(_0x2a08('0x1'));var path=require(_0x2a08('0x2'));var timeout=require(_0x2a08('0x3'));var express=require(_0x2a08('0x4'));var router=express['Router']();var fs_extra=require(_0x2a08('0x5'));var auth=require(_0x2a08('0x6'));var interaction=require(_0x2a08('0x7'));var config=require(_0x2a08('0x8'));var controller=require(_0x2a08('0x9'));router[_0x2a08('0xa')]('/',auth[_0x2a08('0xb')](),controller[_0x2a08('0xc')]);router[_0x2a08('0xa')]('/:id',auth[_0x2a08('0xb')](),controller[_0x2a08('0xd')]);router['post']('/',auth[_0x2a08('0xb')](),controller['create']);router['put'](_0x2a08('0xe'),auth[_0x2a08('0xb')](),controller[_0x2a08('0xf')]);router[_0x2a08('0x10')](_0x2a08('0xe'),auth[_0x2a08('0xb')](),controller[_0x2a08('0x11')]);module[_0x2a08('0x12')]=router; \ No newline at end of file +var _0x2bc8=['create','put','update','destroy','multer','path','connect-timeout','express','../../components/interaction/service','index','get','/:id','isAuthenticated','post'];(function(_0x5aba89,_0x1b008a){var _0x10ce7d=function(_0x2f7dc5){while(--_0x2f7dc5){_0x5aba89['push'](_0x5aba89['shift']());}};_0x10ce7d(++_0x1b008a);}(_0x2bc8,0x82));var _0x82bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x82bc('0x0'));var util=require('util');var path=require(_0x82bc('0x1'));var timeout=require(_0x82bc('0x2'));var express=require(_0x82bc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x82bc('0x4'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x82bc('0x5')]);router[_0x82bc('0x6')](_0x82bc('0x7'),auth[_0x82bc('0x8')](),controller['show']);router[_0x82bc('0x9')]('/',auth['isAuthenticated'](),controller[_0x82bc('0xa')]);router[_0x82bc('0xb')](_0x82bc('0x7'),auth['isAuthenticated'](),controller[_0x82bc('0xc')]);router['delete']('/:id',auth[_0x82bc('0x8')](),controller[_0x82bc('0xd')]);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 23728f9..d5693f7 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 _0xc827=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0xe965c5,_0x291f4e){var _0x413797=function(_0x2642a1){while(--_0x2642a1){_0xe965c5['push'](_0xe965c5['shift']());}};_0x413797(++_0x291f4e);}(_0xc827,0x10f));var _0x7c82=function(_0x12b111,_0x237957){_0x12b111=_0x12b111-0x0;var _0x205329=_0xc827[_0x12b111];return _0x205329;};'use strict';var Sequelize=require(_0x7c82('0x0'));module[_0x7c82('0x1')]={'type':{'type':Sequelize[_0x7c82('0x2')]('string','variable',_0x7c82('0x3'),_0x7c82('0x4'),'picklist'),'defaultValue':_0x7c82('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7c82('0x6')]},'keyType':{'type':Sequelize[_0x7c82('0x2')](_0x7c82('0x5'),_0x7c82('0x7'),_0x7c82('0x3'))},'keyContent':{'type':Sequelize[_0x7c82('0x6')]},'idField':{'type':Sequelize[_0x7c82('0x6')]},'nameField':{'type':Sequelize[_0x7c82('0x6')]},'customField':{'type':Sequelize[_0x7c82('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c82('0x6')]}}; \ No newline at end of file +var _0x8bcc=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x5db5cf,_0x168562){var _0x2f13fa=function(_0x4a9985){while(--_0x4a9985){_0x5db5cf['push'](_0x5db5cf['shift']());}};_0x2f13fa(++_0x168562);}(_0x8bcc,0x199));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc8bc('0x0'));module[_0xc8bc('0x1')]={'type':{'type':Sequelize[_0xc8bc('0x2')](_0xc8bc('0x3'),_0xc8bc('0x4'),_0xc8bc('0x5'),_0xc8bc('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc8bc('0x7')]},'key':{'type':Sequelize[_0xc8bc('0x7')]},'keyType':{'type':Sequelize[_0xc8bc('0x2')](_0xc8bc('0x3'),_0xc8bc('0x4'),_0xc8bc('0x5'))},'keyContent':{'type':Sequelize[_0xc8bc('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc8bc('0x7')]},'customField':{'type':Sequelize[_0xc8bc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc8bc('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index d579b05..9917dd8 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 _0xb16e=['papaparse','ioredis','../../components/auth/service','../../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','save','update','then','name','send','map','fieldName','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VtigerField','includeAll','include','findAll','rows','show','params','rawAttributes','fields','options','find','create','body','catch','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','querystring'];(function(_0x436a7c,_0x129419){var _0x104f55=function(_0x1baf95){while(--_0x1baf95){_0x436a7c['push'](_0x436a7c['shift']());}};_0x104f55(++_0x129419);}(_0xb16e,0x149));var _0xeb16=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0xb16e[_0x173f10];return _0x53142d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb16('0x0'));var zipdir=require(_0xeb16('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb16('0x2'));var BPromise=require(_0xeb16('0x3'));var Mustache=require(_0xeb16('0x4'));var util=require('util');var path=require('path');var sox=require(_0xeb16('0x5'));var csv=require(_0xeb16('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb16('0x7'));var _=require('lodash');var squel=require(_0xeb16('0x8'));var crypto=require(_0xeb16('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeb16('0x6'));var querystring=require(_0xeb16('0xa'));var Papa=require(_0xeb16('0xb'));var Redis=require(_0xeb16('0xc'));var authService=require(_0xeb16('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xeb16('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb16('0xf'))(_0xeb16('0x10'));var utils=require(_0xeb16('0x11'));var config=require(_0xeb16('0x12'));var licenseUtil=require(_0xeb16('0x13'));var db=require(_0xeb16('0x14'))['db'];function respondWithStatusCode(_0x41444e,_0x2e1feb){_0x2e1feb=_0x2e1feb||0xcc;return function(_0x2a6e83){if(_0x2a6e83){return _0x41444e[_0xeb16('0x15')](_0x2e1feb);}return _0x41444e[_0xeb16('0x16')](_0x2e1feb)[_0xeb16('0x17')]();};}function respondWithResult(_0x421725,_0x50ea29){_0x50ea29=_0x50ea29||0xc8;return function(_0x3d8156){if(_0x3d8156){return _0x421725[_0xeb16('0x16')](_0x50ea29)[_0xeb16('0x18')](_0x3d8156);}};}function respondWithFilteredResult(_0x46252e,_0xce7040){return function(_0x5733aa){if(_0x5733aa){var _0x45fecf=typeof _0xce7040[_0xeb16('0x19')]==='undefined'&&typeof _0xce7040[_0xeb16('0x1a')]===_0xeb16('0x1b');var _0x5dd7ec=_0x5733aa['count'];var _0x5b8936=_0x45fecf?0x0:_0xce7040[_0xeb16('0x19')];var _0x3e504f=_0x45fecf?_0x5733aa[_0xeb16('0x1c')]:_0xce7040[_0xeb16('0x19')]+_0xce7040[_0xeb16('0x1a')];var _0x55e744;if(_0x3e504f>=_0x5dd7ec){_0x3e504f=_0x5dd7ec;_0x55e744=0xc8;}else{_0x55e744=0xce;}_0x46252e[_0xeb16('0x16')](_0x55e744);return _0x46252e[_0xeb16('0x1d')](_0xeb16('0x1e'),_0x5b8936+'-'+_0x3e504f+'/'+_0x5dd7ec)['json'](_0x5733aa);}return null;};}function patchUpdates(_0x46a72b){return function(_0x1b802d){try{jsonpatch['apply'](_0x1b802d,_0x46a72b,!![]);}catch(_0x110a30){return BPromise['reject'](_0x110a30);}return _0x1b802d[_0xeb16('0x1f')]();};}function saveUpdates(_0x2109c2,_0x107dbe){return function(_0x365e15){if(_0x365e15){return _0x365e15[_0xeb16('0x20')](_0x2109c2)['then'](function(_0x2e2248){return _0x2e2248;});}return null;};}function removeEntity(_0x511ec1,_0x414046){return function(_0x9ad8cd){if(_0x9ad8cd){return _0x9ad8cd['destroy']()[_0xeb16('0x21')](function(){_0x511ec1[_0xeb16('0x16')](0xcc)[_0xeb16('0x17')]();});}};}function handleEntityNotFound(_0x1a60e7,_0x4a34ae){return function(_0x20ff86){if(!_0x20ff86){_0x1a60e7['sendStatus'](0x194);}return _0x20ff86;};}function handleError(_0x13ce1d,_0x2747bd){_0x2747bd=_0x2747bd||0x1f4;return function(_0x5ef606){logger['error'](_0x5ef606['stack']);if(_0x5ef606[_0xeb16('0x22')]){delete _0x5ef606[_0xeb16('0x22')];}_0x13ce1d[_0xeb16('0x16')](_0x2747bd)[_0xeb16('0x23')](_0x5ef606);};}exports['index']=function(_0x26ce0a,_0x553ec9){var _0xf8dde3={},_0x270dd7={},_0x441d15={'count':0x0,'rows':[]};var _0x4aa66e=_[_0xeb16('0x24')](db['VtigerField']['rawAttributes'],function(_0x26e837){return{'name':_0x26e837[_0xeb16('0x25')],'type':_0x26e837['type']['key']};});_0x270dd7['model']=_[_0xeb16('0x24')](_0x4aa66e,_0xeb16('0x22'));_0x270dd7[_0xeb16('0x26')]=_[_0xeb16('0x27')](_0x26ce0a[_0xeb16('0x26')]);_0x270dd7['filters']=_[_0xeb16('0x28')](_0x270dd7[_0xeb16('0x29')],_0x270dd7[_0xeb16('0x26')]);_0xf8dde3[_0xeb16('0x2a')]=_[_0xeb16('0x28')](_0x270dd7[_0xeb16('0x29')],qs['fields'](_0x26ce0a[_0xeb16('0x26')]['fields']));_0xf8dde3[_0xeb16('0x2a')]=_0xf8dde3[_0xeb16('0x2a')][_0xeb16('0x2b')]?_0xf8dde3[_0xeb16('0x2a')]:_0x270dd7[_0xeb16('0x29')];if(!_0x26ce0a[_0xeb16('0x26')][_0xeb16('0x2c')](_0xeb16('0x2d'))){_0xf8dde3[_0xeb16('0x1a')]=qs[_0xeb16('0x1a')](_0x26ce0a['query']['limit']);_0xf8dde3[_0xeb16('0x19')]=qs[_0xeb16('0x19')](_0x26ce0a[_0xeb16('0x26')]['offset']);}_0xf8dde3[_0xeb16('0x2e')]=qs[_0xeb16('0x2f')](_0x26ce0a[_0xeb16('0x26')]['sort']);_0xf8dde3[_0xeb16('0x30')]=qs['filters'](_[_0xeb16('0x31')](_0x26ce0a[_0xeb16('0x26')],_0x270dd7['filters']),_0x4aa66e);if(_0x26ce0a[_0xeb16('0x26')][_0xeb16('0x32')]){_0xf8dde3[_0xeb16('0x30')]=_[_0xeb16('0x33')](_0xf8dde3['where'],{'$or':_[_0xeb16('0x24')](_0x4aa66e,function(_0x26379c){if(_0x26379c[_0xeb16('0x34')]!==_0xeb16('0x35')){var _0x324d78={};_0x324d78[_0x26379c[_0xeb16('0x22')]]={'$like':'%'+_0x26ce0a[_0xeb16('0x26')][_0xeb16('0x32')]+'%'};return _0x324d78;}})});}_0xf8dde3=_['merge']({},_0xf8dde3,_0x26ce0a['options']);var _0x2cb773={'where':_0xf8dde3[_0xeb16('0x30')]};return db[_0xeb16('0x36')]['count'](_0x2cb773)[_0xeb16('0x21')](function(_0x494227){_0x441d15[_0xeb16('0x1c')]=_0x494227;if(_0x26ce0a['query'][_0xeb16('0x37')]){_0xf8dde3[_0xeb16('0x38')]=[{'all':!![]}];}return db[_0xeb16('0x36')][_0xeb16('0x39')](_0xf8dde3);})[_0xeb16('0x21')](function(_0xb6860d){_0x441d15[_0xeb16('0x3a')]=_0xb6860d;return _0x441d15;})['then'](respondWithFilteredResult(_0x553ec9,_0xf8dde3))['catch'](handleError(_0x553ec9,null));};exports[_0xeb16('0x3b')]=function(_0x40d830,_0x420080){var _0x203577={'raw':!![],'where':{'id':_0x40d830[_0xeb16('0x3c')]['id']}},_0x377ce2={};_0x377ce2['model']=_[_0xeb16('0x27')](db[_0xeb16('0x36')][_0xeb16('0x3d')]);_0x377ce2[_0xeb16('0x26')]=_[_0xeb16('0x27')](_0x40d830[_0xeb16('0x26')]);_0x377ce2['filters']=_[_0xeb16('0x28')](_0x377ce2['model'],_0x377ce2[_0xeb16('0x26')]);_0x203577[_0xeb16('0x2a')]=_[_0xeb16('0x28')](_0x377ce2[_0xeb16('0x29')],qs[_0xeb16('0x3e')](_0x40d830[_0xeb16('0x26')][_0xeb16('0x3e')]));_0x203577['attributes']=_0x203577['attributes'][_0xeb16('0x2b')]?_0x203577[_0xeb16('0x2a')]:_0x377ce2[_0xeb16('0x29')];if(_0x40d830['query']['includeAll']){_0x203577[_0xeb16('0x38')]=[{'all':!![]}];}_0x203577=_[_0xeb16('0x33')]({},_0x203577,_0x40d830[_0xeb16('0x3f')]);return db[_0xeb16('0x36')][_0xeb16('0x40')](_0x203577)[_0xeb16('0x21')](handleEntityNotFound(_0x420080,null))['then'](respondWithResult(_0x420080,null))['catch'](handleError(_0x420080,null));};exports[_0xeb16('0x41')]=function(_0x1ac82b,_0x40599f){return db[_0xeb16('0x36')][_0xeb16('0x41')](_0x1ac82b[_0xeb16('0x42')],{})[_0xeb16('0x21')](respondWithResult(_0x40599f,0xc9))[_0xeb16('0x43')](handleError(_0x40599f,null));};exports[_0xeb16('0x20')]=function(_0x5736b0,_0x585425){if(_0x5736b0[_0xeb16('0x42')]['id']){delete _0x5736b0[_0xeb16('0x42')]['id'];}return db[_0xeb16('0x36')][_0xeb16('0x40')]({'where':{'id':_0x5736b0[_0xeb16('0x3c')]['id']}})['then'](handleEntityNotFound(_0x585425,null))[_0xeb16('0x21')](saveUpdates(_0x5736b0[_0xeb16('0x42')],null))[_0xeb16('0x21')](respondWithResult(_0x585425,null))[_0xeb16('0x43')](handleError(_0x585425,null));};exports['destroy']=function(_0x5367ef,_0x1d4718){return db[_0xeb16('0x36')][_0xeb16('0x40')]({'where':{'id':_0x5367ef['params']['id']}})[_0xeb16('0x21')](handleEntityNotFound(_0x1d4718,null))[_0xeb16('0x21')](removeEntity(_0x1d4718,null))['catch'](handleError(_0x1d4718,null));}; \ No newline at end of file +var _0x06cb=['jsforce','desk.js','to-csv','querystring','papaparse','../../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','apply','reject','save','update','then','destroy','sendStatus','name','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','catch','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x06cb,0xd5));var _0xb06c=function(_0x432a2a,_0x56943d){_0x432a2a=_0x432a2a-0x0;var _0x5925c5=_0x06cb[_0x432a2a];return _0x5925c5;};'use strict';var emlformat=require(_0xb06c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb06c('0x1'));var rp=require(_0xb06c('0x2'));var moment=require(_0xb06c('0x3'));var BPromise=require(_0xb06c('0x4'));var Mustache=require(_0xb06c('0x5'));var util=require(_0xb06c('0x6'));var path=require(_0xb06c('0x7'));var sox=require(_0xb06c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb06c('0x9'));var squel=require(_0xb06c('0xa'));var crypto=require(_0xb06c('0xb'));var jsforce=require(_0xb06c('0xc'));var deskjs=require(_0xb06c('0xd'));var toCsv=require(_0xb06c('0xe'));var querystring=require(_0xb06c('0xf'));var Papa=require(_0xb06c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb06c('0x11'));var hardwareService=require(_0xb06c('0x12'));var logger=require(_0xb06c('0x13'))(_0xb06c('0x14'));var utils=require(_0xb06c('0x15'));var config=require(_0xb06c('0x16'));var licenseUtil=require(_0xb06c('0x17'));var db=require(_0xb06c('0x18'))['db'];function respondWithStatusCode(_0x225e53,_0xa3ea2c){_0xa3ea2c=_0xa3ea2c||0xcc;return function(_0x3884e7){if(_0x3884e7){return _0x225e53['sendStatus'](_0xa3ea2c);}return _0x225e53[_0xb06c('0x19')](_0xa3ea2c)[_0xb06c('0x1a')]();};}function respondWithResult(_0x46ed8c,_0x116433){_0x116433=_0x116433||0xc8;return function(_0x2178a4){if(_0x2178a4){return _0x46ed8c[_0xb06c('0x19')](_0x116433)[_0xb06c('0x1b')](_0x2178a4);}};}function respondWithFilteredResult(_0x54f816,_0x37d31d){return function(_0x1ff78b){if(_0x1ff78b){var _0x299939=typeof _0x37d31d[_0xb06c('0x1c')]===_0xb06c('0x1d')&&typeof _0x37d31d[_0xb06c('0x1e')]===_0xb06c('0x1d');var _0x40bc25=_0x1ff78b[_0xb06c('0x1f')];var _0x1b39c8=_0x299939?0x0:_0x37d31d[_0xb06c('0x1c')];var _0x49a6a6=_0x299939?_0x1ff78b['count']:_0x37d31d['offset']+_0x37d31d[_0xb06c('0x1e')];var _0x2ba204;if(_0x49a6a6>=_0x40bc25){_0x49a6a6=_0x40bc25;_0x2ba204=0xc8;}else{_0x2ba204=0xce;}_0x54f816[_0xb06c('0x19')](_0x2ba204);return _0x54f816[_0xb06c('0x20')](_0xb06c('0x21'),_0x1b39c8+'-'+_0x49a6a6+'/'+_0x40bc25)['json'](_0x1ff78b);}return null;};}function patchUpdates(_0x1b805c){return function(_0x2b4b83){try{jsonpatch[_0xb06c('0x22')](_0x2b4b83,_0x1b805c,!![]);}catch(_0x15bbd0){return BPromise[_0xb06c('0x23')](_0x15bbd0);}return _0x2b4b83[_0xb06c('0x24')]();};}function saveUpdates(_0x1bd5a8,_0x54723d){return function(_0x1f8c49){if(_0x1f8c49){return _0x1f8c49[_0xb06c('0x25')](_0x1bd5a8)[_0xb06c('0x26')](function(_0x419f20){return _0x419f20;});}return null;};}function removeEntity(_0x28b263,_0x4eb6b7){return function(_0x497756){if(_0x497756){return _0x497756[_0xb06c('0x27')]()[_0xb06c('0x26')](function(){_0x28b263[_0xb06c('0x19')](0xcc)[_0xb06c('0x1a')]();});}};}function handleEntityNotFound(_0x126b46,_0x13a405){return function(_0x4d9973){if(!_0x4d9973){_0x126b46[_0xb06c('0x28')](0x194);}return _0x4d9973;};}function handleError(_0x4e1b50,_0x1b4621){_0x1b4621=_0x1b4621||0x1f4;return function(_0x3615e8){logger['error'](_0x3615e8['stack']);if(_0x3615e8[_0xb06c('0x29')]){delete _0x3615e8[_0xb06c('0x29')];}_0x4e1b50[_0xb06c('0x19')](_0x1b4621)['send'](_0x3615e8);};}exports[_0xb06c('0x2a')]=function(_0x34e427,_0x31d8fe){var _0xf38401={},_0x3e2d75={},_0x212607={'count':0x0,'rows':[]};var _0x313d9f=_['map'](db[_0xb06c('0x2b')][_0xb06c('0x2c')],function(_0x573d6a){return{'name':_0x573d6a[_0xb06c('0x2d')],'type':_0x573d6a[_0xb06c('0x2e')][_0xb06c('0x2f')]};});_0x3e2d75[_0xb06c('0x30')]=_[_0xb06c('0x31')](_0x313d9f,_0xb06c('0x29'));_0x3e2d75[_0xb06c('0x32')]=_[_0xb06c('0x33')](_0x34e427[_0xb06c('0x32')]);_0x3e2d75[_0xb06c('0x34')]=_[_0xb06c('0x35')](_0x3e2d75[_0xb06c('0x30')],_0x3e2d75[_0xb06c('0x32')]);_0xf38401['attributes']=_[_0xb06c('0x35')](_0x3e2d75[_0xb06c('0x30')],qs[_0xb06c('0x36')](_0x34e427['query'][_0xb06c('0x36')]));_0xf38401[_0xb06c('0x37')]=_0xf38401[_0xb06c('0x37')][_0xb06c('0x38')]?_0xf38401['attributes']:_0x3e2d75[_0xb06c('0x30')];if(!_0x34e427[_0xb06c('0x32')][_0xb06c('0x39')](_0xb06c('0x3a'))){_0xf38401['limit']=qs[_0xb06c('0x1e')](_0x34e427[_0xb06c('0x32')]['limit']);_0xf38401['offset']=qs['offset'](_0x34e427[_0xb06c('0x32')]['offset']);}_0xf38401['order']=qs['sort'](_0x34e427[_0xb06c('0x32')][_0xb06c('0x3b')]);_0xf38401[_0xb06c('0x3c')]=qs[_0xb06c('0x34')](_[_0xb06c('0x3d')](_0x34e427['query'],_0x3e2d75[_0xb06c('0x34')]),_0x313d9f);if(_0x34e427[_0xb06c('0x32')][_0xb06c('0x3e')]){_0xf38401[_0xb06c('0x3c')]=_[_0xb06c('0x3f')](_0xf38401['where'],{'$or':_['map'](_0x313d9f,function(_0x7a2a65){if(_0x7a2a65[_0xb06c('0x2e')]!==_0xb06c('0x40')){var _0xfa6e1f={};_0xfa6e1f[_0x7a2a65[_0xb06c('0x29')]]={'$like':'%'+_0x34e427[_0xb06c('0x32')]['filter']+'%'};return _0xfa6e1f;}})});}_0xf38401=_[_0xb06c('0x3f')]({},_0xf38401,_0x34e427['options']);var _0x2b3547={'where':_0xf38401['where']};return db['VtigerField'][_0xb06c('0x1f')](_0x2b3547)['then'](function(_0x2cdc4){_0x212607[_0xb06c('0x1f')]=_0x2cdc4;if(_0x34e427[_0xb06c('0x32')][_0xb06c('0x41')]){_0xf38401[_0xb06c('0x42')]=[{'all':!![]}];}return db[_0xb06c('0x2b')][_0xb06c('0x43')](_0xf38401);})[_0xb06c('0x26')](function(_0x34ed15){_0x212607[_0xb06c('0x44')]=_0x34ed15;return _0x212607;})[_0xb06c('0x26')](respondWithFilteredResult(_0x31d8fe,_0xf38401))['catch'](handleError(_0x31d8fe,null));};exports[_0xb06c('0x45')]=function(_0x1a3e80,_0x3c976a){var _0x18abad={'raw':!![],'where':{'id':_0x1a3e80[_0xb06c('0x46')]['id']}},_0x5146f8={};_0x5146f8[_0xb06c('0x30')]=_['keys'](db[_0xb06c('0x2b')][_0xb06c('0x2c')]);_0x5146f8['query']=_[_0xb06c('0x33')](_0x1a3e80[_0xb06c('0x32')]);_0x5146f8['filters']=_[_0xb06c('0x35')](_0x5146f8['model'],_0x5146f8[_0xb06c('0x32')]);_0x18abad[_0xb06c('0x37')]=_['intersection'](_0x5146f8[_0xb06c('0x30')],qs['fields'](_0x1a3e80[_0xb06c('0x32')][_0xb06c('0x36')]));_0x18abad[_0xb06c('0x37')]=_0x18abad[_0xb06c('0x37')][_0xb06c('0x38')]?_0x18abad['attributes']:_0x5146f8[_0xb06c('0x30')];if(_0x1a3e80['query']['includeAll']){_0x18abad[_0xb06c('0x42')]=[{'all':!![]}];}_0x18abad=_[_0xb06c('0x3f')]({},_0x18abad,_0x1a3e80['options']);return db[_0xb06c('0x2b')][_0xb06c('0x47')](_0x18abad)[_0xb06c('0x26')](handleEntityNotFound(_0x3c976a,null))[_0xb06c('0x26')](respondWithResult(_0x3c976a,null))['catch'](handleError(_0x3c976a,null));};exports['create']=function(_0x38f27c,_0xac4322){return db[_0xb06c('0x2b')][_0xb06c('0x48')](_0x38f27c['body'],{})['then'](respondWithResult(_0xac4322,0xc9))[_0xb06c('0x49')](handleError(_0xac4322,null));};exports[_0xb06c('0x25')]=function(_0xbc0c18,_0x597a5f){if(_0xbc0c18[_0xb06c('0x4a')]['id']){delete _0xbc0c18[_0xb06c('0x4a')]['id'];}return db[_0xb06c('0x2b')][_0xb06c('0x47')]({'where':{'id':_0xbc0c18['params']['id']}})['then'](handleEntityNotFound(_0x597a5f,null))[_0xb06c('0x26')](saveUpdates(_0xbc0c18[_0xb06c('0x4a')],null))[_0xb06c('0x26')](respondWithResult(_0x597a5f,null))[_0xb06c('0x49')](handleError(_0x597a5f,null));};exports[_0xb06c('0x27')]=function(_0x44ff10,_0x145f47){return db[_0xb06c('0x2b')][_0xb06c('0x47')]({'where':{'id':_0x44ff10['params']['id']}})[_0xb06c('0x26')](handleEntityNotFound(_0x145f47,null))[_0xb06c('0x26')](removeEntity(_0x145f47,null))[_0xb06c('0x49')](handleError(_0x145f47,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6b222c9..1f3f75e 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 _0x89e2=['idField','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','int_vtiger_fields','vtiger_unique_index'];(function(_0x72ab02,_0x4d248a){var _0x4e1979=function(_0x1c95a2){while(--_0x1c95a2){_0x72ab02['push'](_0x72ab02['shift']());}};_0x4e1979(++_0x4d248a);}(_0x89e2,0xcd));var _0x289e=function(_0x26a188,_0x94dae5){_0x26a188=_0x26a188-0x0;var _0x57e7fb=_0x89e2[_0x26a188];return _0x57e7fb;};'use strict';var _=require('lodash');var util=require(_0x289e('0x0'));var logger=require(_0x289e('0x1'))(_0x289e('0x2'));var moment=require(_0x289e('0x3'));var BPromise=require('bluebird');var rp=require(_0x289e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x289e('0x5'));var config=require(_0x289e('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x289e('0x7')]=function(_0x175857,_0x6097ac){return _0x175857[_0x289e('0x8')]('VtigerField',attributes,{'tableName':_0x289e('0x9'),'paranoid':![],'indexes':[{'name':_0x289e('0xa'),'fields':[_0x289e('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe843=['api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x1b54ec,_0x2e6cdc){var _0x4c9373=function(_0x5e74a3){while(--_0x5e74a3){_0x1b54ec['push'](_0x1b54ec['shift']());}};_0x4c9373(++_0x2e6cdc);}(_0xe843,0x13d));var _0x3e84=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe843[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3e84('0x0'));var util=require(_0x3e84('0x1'));var logger=require(_0x3e84('0x2'))(_0x3e84('0x3'));var moment=require(_0x3e84('0x4'));var BPromise=require(_0x3e84('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e84('0x6'));var rimraf=require(_0x3e84('0x7'));var config=require(_0x3e84('0x8'));var attributes=require(_0x3e84('0x9'));module[_0x3e84('0xa')]=function(_0x5cb38a,_0x27c4c3){return _0x5cb38a[_0x3e84('0xb')](_0x3e84('0xc'),attributes,{'tableName':_0x3e84('0xd'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x3e84('0xe'),_0x3e84('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 a435bfd..278bcc1 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 _0xd9eb=['lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2ced79,_0x4eefc6){var _0xdc8150=function(_0x2d1e8d){while(--_0x2d1e8d){_0x2ced79['push'](_0x2ced79['shift']());}};_0xdc8150(++_0x4eefc6);}(_0xd9eb,0x165));var _0xbd9e=function(_0x57baae,_0x4fbee0){_0x57baae=_0x57baae-0x0;var _0x33dde6=_0xd9eb[_0x57baae];return _0x33dde6;};'use strict';var _=require(_0xbd9e('0x0'));var util=require('util');var moment=require(_0xbd9e('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd9e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd9e('0x3'))['db'];var utils=require(_0xbd9e('0x4'));var logger=require(_0xbd9e('0x5'))(_0xbd9e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd9e('0x7')][_0xbd9e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18b84f,_0xd81b52,_0x80ee3){return new BPromise(function(_0x45a973,_0x52b32b){return client['request'](_0x18b84f,_0x80ee3)[_0xbd9e('0x9')](function(_0x5a4c7b){logger[_0xbd9e('0xa')](_0xbd9e('0xb'),_0xd81b52,'request\x20sent');logger[_0xbd9e('0xc')](_0xbd9e('0xd'),_0xd81b52,'request\x20sent',JSON[_0xbd9e('0xe')](_0x5a4c7b));if(_0x5a4c7b['error']){if(_0x5a4c7b[_0xbd9e('0xf')][_0xbd9e('0x10')]===0x1f4){logger[_0xbd9e('0xf')]('VtigerField,\x20%s,\x20%s',_0xd81b52,_0x5a4c7b[_0xbd9e('0xf')][_0xbd9e('0x11')]);return _0x52b32b(_0x5a4c7b['error'][_0xbd9e('0x11')]);}logger[_0xbd9e('0xf')](_0xbd9e('0xb'),_0xd81b52,_0x5a4c7b[_0xbd9e('0xf')][_0xbd9e('0x11')]);return _0x45a973(_0x5a4c7b[_0xbd9e('0xf')][_0xbd9e('0x11')]);}else{logger[_0xbd9e('0xa')](_0xbd9e('0xb'),_0xd81b52,_0xbd9e('0x12'));_0x45a973(_0x5a4c7b[_0xbd9e('0x13')][_0xbd9e('0x11')]);}})[_0xbd9e('0x14')](function(_0x3a92e0){logger[_0xbd9e('0xf')](_0xbd9e('0xb'),_0xd81b52,_0x3a92e0);_0x52b32b(_0x3a92e0);});});} \ No newline at end of file +var _0x7e33=['error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x7e33,0xd4));var _0x37e3=function(_0x5ecf94,_0x26289d){_0x5ecf94=_0x5ecf94-0x0;var _0x807052=_0x7e33[_0x5ecf94];return _0x807052;};'use strict';var _=require('lodash');var util=require(_0x37e3('0x0'));var moment=require(_0x37e3('0x1'));var BPromise=require(_0x37e3('0x2'));var rs=require(_0x37e3('0x3'));var fs=require('fs');var Redis=require(_0x37e3('0x4'));var db=require(_0x37e3('0x5'))['db'];var utils=require(_0x37e3('0x6'));var logger=require(_0x37e3('0x7'))(_0x37e3('0x8'));var config=require(_0x37e3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x37e3('0xa')][_0x37e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4290fc,_0x40da02,_0x292bbd){return new BPromise(function(_0xca73f0,_0x1a884d){return client[_0x37e3('0xc')](_0x4290fc,_0x292bbd)['then'](function(_0x460954){logger['info'](_0x37e3('0xd'),_0x40da02,_0x37e3('0xe'));logger[_0x37e3('0xf')](_0x37e3('0x10'),_0x40da02,'request\x20sent',JSON[_0x37e3('0x11')](_0x460954));if(_0x460954['error']){if(_0x460954[_0x37e3('0x12')][_0x37e3('0x13')]===0x1f4){logger[_0x37e3('0x12')](_0x37e3('0xd'),_0x40da02,_0x460954[_0x37e3('0x12')][_0x37e3('0x14')]);return _0x1a884d(_0x460954[_0x37e3('0x12')][_0x37e3('0x14')]);}logger[_0x37e3('0x12')](_0x37e3('0xd'),_0x40da02,_0x460954['error'][_0x37e3('0x14')]);return _0xca73f0(_0x460954['error'][_0x37e3('0x14')]);}else{logger[_0x37e3('0x15')]('VtigerField,\x20%s,\x20%s',_0x40da02,_0x37e3('0xe'));_0xca73f0(_0x460954[_0x37e3('0x16')][_0x37e3('0x14')]);}})['catch'](function(_0x569eff){logger[_0x37e3('0x12')](_0x37e3('0xd'),_0x40da02,_0x569eff);_0x1a884d(_0x569eff);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 8dcdf82..4da73e8 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 _0x3725=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3725,0xc1));var _0x5372=function(_0x481ada,_0x2a7e05){_0x481ada=_0x481ada-0x0;var _0x402e57=_0x3725[_0x481ada];return _0x402e57;};'use strict';var multer=require(_0x5372('0x0'));var util=require(_0x5372('0x1'));var path=require(_0x5372('0x2'));var timeout=require(_0x5372('0x3'));var express=require(_0x5372('0x4'));var router=express[_0x5372('0x5')]();var fs_extra=require(_0x5372('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5372('0x7'));var controller=require(_0x5372('0x8'));router[_0x5372('0x9')]('/',auth[_0x5372('0xa')](),controller[_0x5372('0xb')]);router[_0x5372('0x9')](_0x5372('0xc'),auth[_0x5372('0xa')](),controller[_0x5372('0xd')]);router[_0x5372('0x9')](_0x5372('0xe'),auth[_0x5372('0xa')](),controller[_0x5372('0xf')]);router[_0x5372('0x9')]('/:id/fields',auth[_0x5372('0xa')](),controller[_0x5372('0x10')]);router[_0x5372('0x11')]('/',auth['isAuthenticated'](),controller[_0x5372('0x12')]);router[_0x5372('0x11')](_0x5372('0xe'),auth[_0x5372('0xa')](),controller[_0x5372('0x13')]);router[_0x5372('0x14')](_0x5372('0xc'),auth[_0x5372('0xa')](),controller[_0x5372('0x15')]);router[_0x5372('0x16')](_0x5372('0xc'),auth[_0x5372('0xa')](),controller[_0x5372('0x17')]);module[_0x5372('0x18')]=router; \ No newline at end of file +var _0x0007=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0007,0x1ee));var _0x7000=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x0007[_0x574ce3];return _0x3447a0;};'use strict';var multer=require(_0x7000('0x0'));var util=require(_0x7000('0x1'));var path=require(_0x7000('0x2'));var timeout=require('connect-timeout');var express=require(_0x7000('0x3'));var router=express[_0x7000('0x4')]();var fs_extra=require(_0x7000('0x5'));var auth=require(_0x7000('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7000('0x7'));var controller=require(_0x7000('0x8'));router[_0x7000('0x9')]('/',auth[_0x7000('0xa')](),controller[_0x7000('0xb')]);router[_0x7000('0x9')](_0x7000('0xc'),auth['isAuthenticated'](),controller[_0x7000('0xd')]);router[_0x7000('0x9')](_0x7000('0xe'),auth[_0x7000('0xa')](),controller[_0x7000('0xf')]);router[_0x7000('0x9')]('/:id/fields',auth[_0x7000('0xa')](),controller[_0x7000('0x10')]);router[_0x7000('0x11')]('/',auth[_0x7000('0xa')](),controller[_0x7000('0x12')]);router[_0x7000('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7000('0x13')]);router[_0x7000('0x14')](_0x7000('0xc'),auth['isAuthenticated'](),controller[_0x7000('0x15')]);router[_0x7000('0x16')]('/:id',auth[_0x7000('0xa')](),controller[_0x7000('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index df4c834..b8060c8 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 _0x89fb=['password','newTab','integrationTab','exports','STRING','username','remoteUri','ENUM'];(function(_0x3f17dd,_0x308dcd){var _0x214e83=function(_0x39a2a3){while(--_0x39a2a3){_0x3f17dd['push'](_0x3f17dd['shift']());}};_0x214e83(++_0x308dcd);}(_0x89fb,0x14b));var _0xb89f=function(_0x385ab0,_0x3606f0){_0x385ab0=_0x385ab0-0x0;var _0x26837f=_0x89fb[_0x385ab0];return _0x26837f;};'use strict';var Sequelize=require('sequelize');module[_0xb89f('0x0')]={'name':{'type':Sequelize[_0xb89f('0x1')]},'description':{'type':Sequelize[_0xb89f('0x1')]},'username':{'type':Sequelize[_0xb89f('0x1')],'unique':_0xb89f('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xb89f('0x1')]},'remoteUri':{'type':Sequelize[_0xb89f('0x1')],'unique':_0xb89f('0x3')},'authType':{'type':Sequelize[_0xb89f('0x4')](_0xb89f('0x5'),'token'),'defaultValue':_0xb89f('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb89f('0x4')]('integrationTab',_0xb89f('0x6')),'defaultValue':_0xb89f('0x7')}}; \ No newline at end of file +var _0x1623=['password','integrationTab','newTab','sequelize','STRING','username','ENUM','token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x8aced0,_0x33103a){_0x8aced0=_0x8aced0-0x0;var _0x53e205=_0x1623[_0x8aced0];return _0x53e205;};'use strict';var Sequelize=require(_0x3162('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3162('0x1')]},'username':{'type':Sequelize[_0x3162('0x1')],'unique':_0x3162('0x2')},'password':{'type':Sequelize[_0x3162('0x1')]},'token':{'type':Sequelize[_0x3162('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x3162('0x3')]('password',_0x3162('0x4')),'defaultValue':_0x3162('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3162('0x3')](_0x3162('0x6'),_0x3162('0x7')),'defaultValue':_0x3162('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index ed32c0b..223deb9 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 _0x236c=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','fields','order','nolimit','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','%s:%s','toString','Basic\x20%s','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format'];(function(_0x75e2c9,_0x50b412){var _0x388ddb=function(_0x2c5269){while(--_0x2c5269){_0x75e2c9['push'](_0x75e2c9['shift']());}};_0x388ddb(++_0x50b412);}(_0x236c,0x155));var _0xc236=function(_0x230415,_0x21afd5){_0x230415=_0x230415-0x0;var _0x340f7a=_0x236c[_0x230415];return _0x340f7a;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b9638,_0x5bce83){_0x5bce83=_0x5bce83||0xcc;return function(_0x599d36){if(_0x599d36){return _0x5b9638[_0xc236('0x18')](_0x5bce83);}return _0x5b9638[_0xc236('0x19')](_0x5bce83)[_0xc236('0x1a')]();};}function respondWithResult(_0x71bce2,_0x5052db){_0x5052db=_0x5052db||0xc8;return function(_0x13a42b){if(_0x13a42b){return _0x71bce2['status'](_0x5052db)['json'](_0x13a42b);}};}function respondWithFilteredResult(_0x9a65e8,_0x32f2fd){return function(_0x443a46){if(_0x443a46){var _0x1aeafc=typeof _0x32f2fd[_0xc236('0x1b')]==='undefined'&&typeof _0x32f2fd['limit']==='undefined';var _0x3f5884=_0x443a46[_0xc236('0x1c')];var _0x11ec65=_0x1aeafc?0x0:_0x32f2fd['offset'];var _0x13b432=_0x1aeafc?_0x443a46['count']:_0x32f2fd['offset']+_0x32f2fd[_0xc236('0x1d')];var _0x30adeb;if(_0x13b432>=_0x3f5884){_0x13b432=_0x3f5884;_0x30adeb=0xc8;}else{_0x30adeb=0xce;}_0x9a65e8[_0xc236('0x19')](_0x30adeb);return _0x9a65e8[_0xc236('0x1e')](_0xc236('0x1f'),_0x11ec65+'-'+_0x13b432+'/'+_0x3f5884)[_0xc236('0x20')](_0x443a46);}return null;};}function patchUpdates(_0x3f0e2f){return function(_0x27c96a){try{jsonpatch[_0xc236('0x21')](_0x27c96a,_0x3f0e2f,!![]);}catch(_0x32876d){return BPromise[_0xc236('0x22')](_0x32876d);}return _0x27c96a['save']();};}function saveUpdates(_0x208c3f,_0x34d73a){return function(_0x3bd41b){if(_0x3bd41b){return _0x3bd41b[_0xc236('0x23')](_0x208c3f)[_0xc236('0x24')](function(_0x21fab8){return _0x21fab8;});}return null;};}function removeEntity(_0x3a315b,_0xf921e6){return function(_0x1d65e2){if(_0x1d65e2){return _0x1d65e2[_0xc236('0x25')]()[_0xc236('0x24')](function(){_0x3a315b['status'](0xcc)[_0xc236('0x1a')]();});}};}function handleEntityNotFound(_0x21d78f,_0x356042){return function(_0x9017ec){if(!_0x9017ec){_0x21d78f['sendStatus'](0x194);}return _0x9017ec;};}function handleError(_0x42f248,_0x5da4b2){_0x5da4b2=_0x5da4b2||0x1f4;return function(_0x5351bc){logger[_0xc236('0x26')](_0x5351bc['stack']);if(_0x5351bc[_0xc236('0x27')]){delete _0x5351bc['name'];}_0x42f248[_0xc236('0x19')](_0x5da4b2)['send'](_0x5351bc);};}exports[_0xc236('0x28')]=function(_0x1d144b,_0x4f5175){var _0x5a61b5={},_0x265c8d={},_0x1fd31d={'count':0x0,'rows':[]};var _0x1f4995=_[_0xc236('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x28ffa5){return{'name':_0x28ffa5['fieldName'],'type':_0x28ffa5[_0xc236('0x2a')]['key']};});_0x265c8d[_0xc236('0x2b')]=_[_0xc236('0x29')](_0x1f4995,'name');_0x265c8d['query']=_[_0xc236('0x2c')](_0x1d144b[_0xc236('0x2d')]);_0x265c8d[_0xc236('0x2e')]=_[_0xc236('0x2f')](_0x265c8d[_0xc236('0x2b')],_0x265c8d[_0xc236('0x2d')]);_0x5a61b5[_0xc236('0x30')]=_[_0xc236('0x2f')](_0x265c8d[_0xc236('0x2b')],qs['fields'](_0x1d144b['query']['fields']));_0x5a61b5[_0xc236('0x30')]=_0x5a61b5[_0xc236('0x30')][_0xc236('0x31')]?_0x5a61b5[_0xc236('0x30')]:_0x265c8d[_0xc236('0x2b')];if(!_0x1d144b[_0xc236('0x2d')][_0xc236('0x32')]('nolimit')){_0x5a61b5[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x1d144b[_0xc236('0x2d')]['limit']);_0x5a61b5[_0xc236('0x1b')]=qs[_0xc236('0x1b')](_0x1d144b[_0xc236('0x2d')][_0xc236('0x1b')]);}_0x5a61b5['order']=qs[_0xc236('0x33')](_0x1d144b[_0xc236('0x2d')][_0xc236('0x33')]);_0x5a61b5[_0xc236('0x34')]=qs[_0xc236('0x2e')](_[_0xc236('0x35')](_0x1d144b[_0xc236('0x2d')],_0x265c8d[_0xc236('0x2e')]),_0x1f4995);if(_0x1d144b[_0xc236('0x2d')][_0xc236('0x36')]){_0x5a61b5[_0xc236('0x34')]=_[_0xc236('0x37')](_0x5a61b5[_0xc236('0x34')],{'$or':_[_0xc236('0x29')](_0x1f4995,function(_0x12e802){if(_0x12e802[_0xc236('0x2a')]!==_0xc236('0x38')){var _0x4f5490={};_0x4f5490[_0x12e802['name']]={'$like':'%'+_0x1d144b['query']['filter']+'%'};return _0x4f5490;}})});}_0x5a61b5=_[_0xc236('0x37')]({},_0x5a61b5,_0x1d144b['options']);var _0x35905c={'where':_0x5a61b5[_0xc236('0x34')]};return db[_0xc236('0x39')][_0xc236('0x1c')](_0x35905c)[_0xc236('0x24')](function(_0x3b95ec){_0x1fd31d[_0xc236('0x1c')]=_0x3b95ec;if(_0x1d144b[_0xc236('0x2d')][_0xc236('0x3a')]){_0x5a61b5[_0xc236('0x3b')]=[{'all':!![]}];}return db[_0xc236('0x39')][_0xc236('0x3c')](_0x5a61b5);})[_0xc236('0x24')](function(_0x3df25e){_0x1fd31d[_0xc236('0x3d')]=_0x3df25e;return _0x1fd31d;})['then'](respondWithFilteredResult(_0x4f5175,_0x5a61b5))[_0xc236('0x3e')](handleError(_0x4f5175,null));};exports[_0xc236('0x3f')]=function(_0x506ba0,_0xb90a83){var _0x5b0bc5={'raw':![],'where':{'id':_0x506ba0['params']['id']}},_0x1cecc5={};_0x1cecc5[_0xc236('0x2b')]=_[_0xc236('0x2c')](db[_0xc236('0x39')]['rawAttributes']);_0x1cecc5[_0xc236('0x2d')]=_[_0xc236('0x2c')](_0x506ba0[_0xc236('0x2d')]);_0x1cecc5['filters']=_[_0xc236('0x2f')](_0x1cecc5[_0xc236('0x2b')],_0x1cecc5[_0xc236('0x2d')]);_0x5b0bc5[_0xc236('0x30')]=_[_0xc236('0x2f')](_0x1cecc5[_0xc236('0x2b')],qs['fields'](_0x506ba0[_0xc236('0x2d')]['fields']));_0x5b0bc5[_0xc236('0x30')]=_0x5b0bc5[_0xc236('0x30')][_0xc236('0x31')]?_0x5b0bc5[_0xc236('0x30')]:_0x1cecc5[_0xc236('0x2b')];if(_0x506ba0[_0xc236('0x2d')][_0xc236('0x3a')]){_0x5b0bc5['include']=[{'all':!![]}];}_0x5b0bc5=_[_0xc236('0x37')]({},_0x5b0bc5,_0x506ba0['options']);return db[_0xc236('0x39')][_0xc236('0x40')](_0x5b0bc5)['then'](handleEntityNotFound(_0xb90a83,null))[_0xc236('0x24')](respondWithResult(_0xb90a83,null))[_0xc236('0x3e')](handleError(_0xb90a83,null));};exports[_0xc236('0x41')]=function(_0x161890,_0x181dd6){return db[_0xc236('0x39')][_0xc236('0x41')](_0x161890['body'],{})['then'](respondWithResult(_0x181dd6,0xc9))[_0xc236('0x3e')](handleError(_0x181dd6,null));};exports[_0xc236('0x23')]=function(_0x510f7f,_0xcfaa44){if(_0x510f7f[_0xc236('0x42')]['id']){delete _0x510f7f[_0xc236('0x42')]['id'];}return db[_0xc236('0x39')][_0xc236('0x40')]({'where':{'id':_0x510f7f[_0xc236('0x43')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0xcfaa44,null))[_0xc236('0x24')](saveUpdates(_0x510f7f[_0xc236('0x42')],null))['then'](respondWithResult(_0xcfaa44,null))[_0xc236('0x3e')](handleError(_0xcfaa44,null));};exports[_0xc236('0x25')]=function(_0x41b7d5,_0x447a83){return db[_0xc236('0x39')][_0xc236('0x40')]({'where':{'id':_0x41b7d5[_0xc236('0x43')]['id']}})['then'](handleEntityNotFound(_0x447a83,null))[_0xc236('0x24')](removeEntity(_0x447a83,null))[_0xc236('0x3e')](handleError(_0x447a83,null));};exports[_0xc236('0x44')]=function(_0x16ff63,_0x4860d8,_0xa34c01){var _0x3e6da6={};var _0xad71ea={};var _0x2f3d08;var _0x9d81c8;return db['ZendeskAccount'][_0xc236('0x45')]({'where':{'id':_0x16ff63['params']['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x4860d8,null))[_0xc236('0x24')](function(_0x3f9e85){if(_0x3f9e85){_0x2f3d08=_0x3f9e85;_0xad71ea[_0xc236('0x2b')]=_[_0xc236('0x2c')](db['ZendeskConfiguration']['rawAttributes']);_0xad71ea[_0xc236('0x2d')]=_[_0xc236('0x2c')](_0x16ff63[_0xc236('0x2d')]);_0xad71ea[_0xc236('0x2e')]=_[_0xc236('0x2f')](_0xad71ea[_0xc236('0x2b')],_0xad71ea[_0xc236('0x2d')]);_0x3e6da6[_0xc236('0x30')]=_[_0xc236('0x2f')](_0xad71ea[_0xc236('0x2b')],qs['fields'](_0x16ff63['query'][_0xc236('0x46')]));_0x3e6da6[_0xc236('0x30')]=_0x3e6da6[_0xc236('0x30')][_0xc236('0x31')]?_0x3e6da6['attributes']:_0xad71ea[_0xc236('0x2b')];_0x3e6da6[_0xc236('0x47')]=qs['sort'](_0x16ff63[_0xc236('0x2d')][_0xc236('0x33')]);_0x3e6da6[_0xc236('0x34')]=qs[_0xc236('0x2e')](_['pick'](_0x16ff63[_0xc236('0x2d')],_0xad71ea[_0xc236('0x2e')]));if(_0x16ff63[_0xc236('0x2d')][_0xc236('0x36')]){_0x3e6da6[_0xc236('0x34')]=_[_0xc236('0x37')](_0x3e6da6[_0xc236('0x34')],{'$or':_['map'](_0x3e6da6[_0xc236('0x30')],function(_0x4c99a4){var _0x4289c5={};_0x4289c5[_0x4c99a4]={'$like':'%'+_0x16ff63[_0xc236('0x2d')][_0xc236('0x36')]+'%'};return _0x4289c5;})});}_0x3e6da6=_[_0xc236('0x37')]({},_0x3e6da6,_0x16ff63['options']);return _0x2f3d08[_0xc236('0x44')](_0x3e6da6);}})[_0xc236('0x24')](function(_0x379e99){if(_0x379e99){_0x9d81c8=_0x379e99['length'];if(!_0x16ff63[_0xc236('0x2d')][_0xc236('0x32')](_0xc236('0x48'))){_0x3e6da6[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x16ff63[_0xc236('0x2d')]['limit']);_0x3e6da6['offset']=qs[_0xc236('0x1b')](_0x16ff63[_0xc236('0x2d')][_0xc236('0x1b')]);}return _0x2f3d08[_0xc236('0x44')](_0x3e6da6);}})[_0xc236('0x24')](function(_0x4649a3){if(_0x4649a3){return _0x4649a3?{'count':_0x9d81c8,'rows':_0x4649a3}:null;}})[_0xc236('0x24')](respondWithResult(_0x4860d8,null))['catch'](handleError(_0x4860d8,null));};exports['addConfiguration']=function(_0x4b59d3,_0x119710,_0x3c11da){if(_0x4b59d3[_0xc236('0x42')]['id']){delete _0x4b59d3[_0xc236('0x42')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x4b59d3['params']['id']}})['then'](handleEntityNotFound(_0x119710,null))[_0xc236('0x24')](function(_0x5df2ba){if(_0x5df2ba){_0x4b59d3[_0xc236('0x42')]['AccountId']=_0x5df2ba['id'];_0x4b59d3[_0xc236('0x42')][_0xc236('0x49')]=integrations[_0xc236('0x4a')](_0x4b59d3[_0xc236('0x42')][_0xc236('0x4b')],_0x4b59d3[_0xc236('0x42')][_0xc236('0x2a')]);_0x4b59d3['body'][_0xc236('0x4c')]=integrations['getDescriptions'](_0x4b59d3[_0xc236('0x42')][_0xc236('0x4b')],_0x4b59d3[_0xc236('0x42')][_0xc236('0x2a')]);return db[_0xc236('0x4d')][_0xc236('0x41')](_0x4b59d3['body'],{'include':[{'model':db[_0xc236('0x4e')],'as':_0xc236('0x49')},{'model':db['ZendeskField'],'as':_0xc236('0x4c')}]});}return null;})[_0xc236('0x24')](respondWithResult(_0x119710,null))[_0xc236('0x3e')](handleError(_0x119710,null));};exports['getFields']=function(_0x226573,_0x45fe5a,_0x5897a1){var _0x2c8f89='';return db[_0xc236('0x39')][_0xc236('0x45')]({'where':{'id':_0x226573[_0xc236('0x43')]['id']},'attributes':['id',_0xc236('0x4f'),_0xc236('0x50'),_0xc236('0x51'),_0xc236('0x52'),_0xc236('0x53')]})['then'](handleEntityNotFound(_0x45fe5a,null))[_0xc236('0x24')](function(_0x2b9fd8){if(_0x2b9fd8){_0x2c8f89=_0x2b9fd8[_0xc236('0x53')];var _0x5d395b=_0x2c8f89[_0xc236('0x54')](-0x1);if(_0x5d395b==='/'){_0x2c8f89=_0x2c8f89[_0xc236('0x55')](0x0,_0x2c8f89[_0xc236('0x56')](_0x5d395b));}var _0x4ef002={'method':'GET','uri':util[_0xc236('0x57')]('%s/%s',_0x2c8f89,_0xc236('0x58')),'json':!![]};switch(_0x2b9fd8['authType']){case _0xc236('0x50'):_0x4ef002[_0xc236('0x59')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xc236('0x5a'),_0x2b9fd8['username'],_0x2b9fd8[_0xc236('0x50')]))[_0xc236('0x5b')]('base64'))};break;case _0xc236('0x51'):_0x4ef002[_0xc236('0x59')]={'Authorization':util['format'](_0xc236('0x5c'),new Buffer(util[_0xc236('0x57')](_0xc236('0x5d'),_0x2b9fd8[_0xc236('0x4f')],_0x2b9fd8['token']))[_0xc236('0x5b')](_0xc236('0x5e')))};break;default:throw new db[(_0xc236('0x5f'))][(_0xc236('0x60'))](_0xc236('0x61'));}return rp(_0x4ef002);}})[_0xc236('0x24')](function(_0x141497){if(_0x141497){var _0x509f3b=['subject',_0xc236('0x62'),_0xc236('0x63'),_0xc236('0x64')];_[_0xc236('0x65')](_0x141497[_0xc236('0x58')],function(_0x49e417){return _0x509f3b[_0xc236('0x66')](_0x49e417[_0xc236('0x2a')]);});return{'count':_0x141497['ticket_fields']['length'],'rows':_[_0xc236('0x29')](_0x141497['ticket_fields'],function(_0x35e0d8){return{'id':_0x35e0d8['id'],'name':_0x35e0d8[_0xc236('0x67')]>0x7?_0x35e0d8[_0xc236('0x68')]:_0x35e0d8['type'],'custom':_0x35e0d8[_0xc236('0x67')]>0x7?!![]:![],'options':_0x35e0d8['system_field_options']?_0x35e0d8[_0xc236('0x69')]:_0x35e0d8[_0xc236('0x6a')]?_0x35e0d8[_0xc236('0x6a')]:[]};})};}})[_0xc236('0x24')](respondWithResult(_0x45fe5a,null))['catch'](function(_0x41c76d){var _0x22b942=_0x226573['query'][_0xc236('0x6b')]?0x1f4:_0x41c76d[_0xc236('0x6c')]||0x1f4;logger[_0xc236('0x26')](_0xc236('0x6d'),_0xc236('0x6e'),_0x22b942,JSON[_0xc236('0x6f')](_0x41c76d));delete _0x41c76d[_0xc236('0x27')];if(_0x22b942===0x191){_0x22b942=0x190;}_0x45fe5a['status'](_0x22b942)[_0xc236('0x70')](_0x226573[_0xc236('0x2d')][_0xc236('0x6b')]?{'message':_0xc236('0x71'),'statusCode':_0x41c76d['statusCode']}:_0x41c76d);});}; \ No newline at end of file +var _0x4cf8=['sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','options','find','create','body','ZendeskConfiguration','fields','getConfigurations','nolimit','findOne','Subjects','channel','ZendeskField','username','password','token','authType','remoteUri','slice','substring','format','ticket_fields','headers','Basic\x20%s','base64','toString','Unknown\x20authentication\x20type','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order'];(function(_0x27f614,_0x2b0fdc){var _0x533fe0=function(_0x2f42f5){while(--_0x2f42f5){_0x27f614['push'](_0x27f614['shift']());}};_0x533fe0(++_0x2b0fdc);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0x4cf8[_0x51e79c];return _0x2467be;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];var integrations=require(_0x84cf('0x18'));function respondWithStatusCode(_0x33f83e,_0x172d04){_0x172d04=_0x172d04||0xcc;return function(_0x214ca0){if(_0x214ca0){return _0x33f83e[_0x84cf('0x19')](_0x172d04);}return _0x33f83e[_0x84cf('0x1a')](_0x172d04)[_0x84cf('0x1b')]();};}function respondWithResult(_0x250a19,_0x2fc41f){_0x2fc41f=_0x2fc41f||0xc8;return function(_0x385027){if(_0x385027){return _0x250a19[_0x84cf('0x1a')](_0x2fc41f)[_0x84cf('0x1c')](_0x385027);}};}function respondWithFilteredResult(_0x27261b,_0x167c3e){return function(_0x464e70){if(_0x464e70){var _0x240edf=typeof _0x167c3e[_0x84cf('0x1d')]==='undefined'&&typeof _0x167c3e[_0x84cf('0x1e')]===_0x84cf('0x1f');var _0xfa6641=_0x464e70[_0x84cf('0x20')];var _0x1dad1a=_0x240edf?0x0:_0x167c3e[_0x84cf('0x1d')];var _0xe6b5b6=_0x240edf?_0x464e70['count']:_0x167c3e['offset']+_0x167c3e[_0x84cf('0x1e')];var _0x1990c7;if(_0xe6b5b6>=_0xfa6641){_0xe6b5b6=_0xfa6641;_0x1990c7=0xc8;}else{_0x1990c7=0xce;}_0x27261b[_0x84cf('0x1a')](_0x1990c7);return _0x27261b[_0x84cf('0x21')](_0x84cf('0x22'),_0x1dad1a+'-'+_0xe6b5b6+'/'+_0xfa6641)['json'](_0x464e70);}return null;};}function patchUpdates(_0x39a37b){return function(_0x448b5d){try{jsonpatch[_0x84cf('0x23')](_0x448b5d,_0x39a37b,!![]);}catch(_0x33b72e){return BPromise[_0x84cf('0x24')](_0x33b72e);}return _0x448b5d['save']();};}function saveUpdates(_0x42fa45,_0x160f86){return function(_0x475b19){if(_0x475b19){return _0x475b19[_0x84cf('0x25')](_0x42fa45)[_0x84cf('0x26')](function(_0x29e9e1){return _0x29e9e1;});}return null;};}function removeEntity(_0x7feb4,_0x4c9d1c){return function(_0x2b2c90){if(_0x2b2c90){return _0x2b2c90[_0x84cf('0x27')]()[_0x84cf('0x26')](function(){_0x7feb4[_0x84cf('0x1a')](0xcc)[_0x84cf('0x1b')]();});}};}function handleEntityNotFound(_0x44d4bf,_0x3c7eda){return function(_0xa44c81){if(!_0xa44c81){_0x44d4bf[_0x84cf('0x19')](0x194);}return _0xa44c81;};}function handleError(_0x6797c0,_0x5179c1){_0x5179c1=_0x5179c1||0x1f4;return function(_0x83f20b){logger[_0x84cf('0x28')](_0x83f20b[_0x84cf('0x29')]);if(_0x83f20b[_0x84cf('0x2a')]){delete _0x83f20b['name'];}_0x6797c0[_0x84cf('0x1a')](_0x5179c1)['send'](_0x83f20b);};}exports[_0x84cf('0x2b')]=function(_0x4092fd,_0x43b41b){var _0xc15298={},_0x51adcf={},_0x20de4b={'count':0x0,'rows':[]};var _0x2e4653=_[_0x84cf('0x2c')](db[_0x84cf('0x2d')][_0x84cf('0x2e')],function(_0x31dbf5){return{'name':_0x31dbf5[_0x84cf('0x2f')],'type':_0x31dbf5[_0x84cf('0x30')][_0x84cf('0x31')]};});_0x51adcf['model']=_['map'](_0x2e4653,_0x84cf('0x2a'));_0x51adcf[_0x84cf('0x32')]=_[_0x84cf('0x33')](_0x4092fd[_0x84cf('0x32')]);_0x51adcf[_0x84cf('0x34')]=_[_0x84cf('0x35')](_0x51adcf[_0x84cf('0x36')],_0x51adcf[_0x84cf('0x32')]);_0xc15298['attributes']=_[_0x84cf('0x35')](_0x51adcf[_0x84cf('0x36')],qs['fields'](_0x4092fd[_0x84cf('0x32')]['fields']));_0xc15298[_0x84cf('0x37')]=_0xc15298[_0x84cf('0x37')][_0x84cf('0x38')]?_0xc15298[_0x84cf('0x37')]:_0x51adcf[_0x84cf('0x36')];if(!_0x4092fd['query'][_0x84cf('0x39')]('nolimit')){_0xc15298['limit']=qs[_0x84cf('0x1e')](_0x4092fd[_0x84cf('0x32')]['limit']);_0xc15298[_0x84cf('0x1d')]=qs[_0x84cf('0x1d')](_0x4092fd[_0x84cf('0x32')][_0x84cf('0x1d')]);}_0xc15298[_0x84cf('0x3a')]=qs[_0x84cf('0x3b')](_0x4092fd['query'][_0x84cf('0x3b')]);_0xc15298[_0x84cf('0x3c')]=qs[_0x84cf('0x34')](_[_0x84cf('0x3d')](_0x4092fd[_0x84cf('0x32')],_0x51adcf[_0x84cf('0x34')]),_0x2e4653);if(_0x4092fd['query'][_0x84cf('0x3e')]){_0xc15298['where']=_[_0x84cf('0x3f')](_0xc15298[_0x84cf('0x3c')],{'$or':_[_0x84cf('0x2c')](_0x2e4653,function(_0x373d62){if(_0x373d62[_0x84cf('0x30')]!==_0x84cf('0x40')){var _0x263ceb={};_0x263ceb[_0x373d62[_0x84cf('0x2a')]]={'$like':'%'+_0x4092fd[_0x84cf('0x32')]['filter']+'%'};return _0x263ceb;}})});}_0xc15298=_[_0x84cf('0x3f')]({},_0xc15298,_0x4092fd['options']);var _0xfb50c1={'where':_0xc15298[_0x84cf('0x3c')]};return db['ZendeskAccount'][_0x84cf('0x20')](_0xfb50c1)['then'](function(_0x3b248a){_0x20de4b['count']=_0x3b248a;if(_0x4092fd[_0x84cf('0x32')]['includeAll']){_0xc15298[_0x84cf('0x41')]=[{'all':!![]}];}return db[_0x84cf('0x2d')]['findAll'](_0xc15298);})[_0x84cf('0x26')](function(_0x426ddb){_0x20de4b[_0x84cf('0x42')]=_0x426ddb;return _0x20de4b;})['then'](respondWithFilteredResult(_0x43b41b,_0xc15298))[_0x84cf('0x43')](handleError(_0x43b41b,null));};exports['show']=function(_0x1c84e0,_0x58b539){var _0x56b0e5={'raw':![],'where':{'id':_0x1c84e0[_0x84cf('0x44')]['id']}},_0x59c4d7={};_0x59c4d7[_0x84cf('0x36')]=_['keys'](db[_0x84cf('0x2d')]['rawAttributes']);_0x59c4d7[_0x84cf('0x32')]=_[_0x84cf('0x33')](_0x1c84e0['query']);_0x59c4d7[_0x84cf('0x34')]=_['intersection'](_0x59c4d7[_0x84cf('0x36')],_0x59c4d7['query']);_0x56b0e5['attributes']=_['intersection'](_0x59c4d7['model'],qs['fields'](_0x1c84e0['query']['fields']));_0x56b0e5[_0x84cf('0x37')]=_0x56b0e5[_0x84cf('0x37')][_0x84cf('0x38')]?_0x56b0e5[_0x84cf('0x37')]:_0x59c4d7['model'];if(_0x1c84e0[_0x84cf('0x32')]['includeAll']){_0x56b0e5[_0x84cf('0x41')]=[{'all':!![]}];}_0x56b0e5=_[_0x84cf('0x3f')]({},_0x56b0e5,_0x1c84e0[_0x84cf('0x45')]);return db[_0x84cf('0x2d')][_0x84cf('0x46')](_0x56b0e5)[_0x84cf('0x26')](handleEntityNotFound(_0x58b539,null))['then'](respondWithResult(_0x58b539,null))[_0x84cf('0x43')](handleError(_0x58b539,null));};exports[_0x84cf('0x47')]=function(_0x4a4cf7,_0xb2b8ae){return db[_0x84cf('0x2d')][_0x84cf('0x47')](_0x4a4cf7['body'],{})['then'](respondWithResult(_0xb2b8ae,0xc9))['catch'](handleError(_0xb2b8ae,null));};exports[_0x84cf('0x25')]=function(_0x104421,_0x25d4f8){if(_0x104421[_0x84cf('0x48')]['id']){delete _0x104421[_0x84cf('0x48')]['id'];}return db[_0x84cf('0x2d')]['find']({'where':{'id':_0x104421[_0x84cf('0x44')]['id']}})['then'](handleEntityNotFound(_0x25d4f8,null))[_0x84cf('0x26')](saveUpdates(_0x104421['body'],null))['then'](respondWithResult(_0x25d4f8,null))[_0x84cf('0x43')](handleError(_0x25d4f8,null));};exports[_0x84cf('0x27')]=function(_0x426df1,_0x55e24e){return db['ZendeskAccount'][_0x84cf('0x46')]({'where':{'id':_0x426df1[_0x84cf('0x44')]['id']}})[_0x84cf('0x26')](handleEntityNotFound(_0x55e24e,null))[_0x84cf('0x26')](removeEntity(_0x55e24e,null))[_0x84cf('0x43')](handleError(_0x55e24e,null));};exports['getConfigurations']=function(_0xcfe28f,_0x225fc2,_0x5e4af1){var _0x33145e={};var _0x5baea8={};var _0x4fd496;var _0x147194;return db[_0x84cf('0x2d')]['findOne']({'where':{'id':_0xcfe28f['params']['id']}})[_0x84cf('0x26')](handleEntityNotFound(_0x225fc2,null))[_0x84cf('0x26')](function(_0x2f739a){if(_0x2f739a){_0x4fd496=_0x2f739a;_0x5baea8[_0x84cf('0x36')]=_[_0x84cf('0x33')](db[_0x84cf('0x49')][_0x84cf('0x2e')]);_0x5baea8[_0x84cf('0x32')]=_['keys'](_0xcfe28f[_0x84cf('0x32')]);_0x5baea8[_0x84cf('0x34')]=_['intersection'](_0x5baea8['model'],_0x5baea8[_0x84cf('0x32')]);_0x33145e[_0x84cf('0x37')]=_[_0x84cf('0x35')](_0x5baea8[_0x84cf('0x36')],qs[_0x84cf('0x4a')](_0xcfe28f[_0x84cf('0x32')][_0x84cf('0x4a')]));_0x33145e['attributes']=_0x33145e[_0x84cf('0x37')]['length']?_0x33145e[_0x84cf('0x37')]:_0x5baea8['model'];_0x33145e[_0x84cf('0x3a')]=qs[_0x84cf('0x3b')](_0xcfe28f['query'][_0x84cf('0x3b')]);_0x33145e[_0x84cf('0x3c')]=qs['filters'](_[_0x84cf('0x3d')](_0xcfe28f['query'],_0x5baea8['filters']));if(_0xcfe28f['query']['filter']){_0x33145e[_0x84cf('0x3c')]=_[_0x84cf('0x3f')](_0x33145e[_0x84cf('0x3c')],{'$or':_[_0x84cf('0x2c')](_0x33145e['attributes'],function(_0x32aa8b){var _0x3c1c55={};_0x3c1c55[_0x32aa8b]={'$like':'%'+_0xcfe28f['query'][_0x84cf('0x3e')]+'%'};return _0x3c1c55;})});}_0x33145e=_[_0x84cf('0x3f')]({},_0x33145e,_0xcfe28f[_0x84cf('0x45')]);return _0x4fd496[_0x84cf('0x4b')](_0x33145e);}})[_0x84cf('0x26')](function(_0x273711){if(_0x273711){_0x147194=_0x273711[_0x84cf('0x38')];if(!_0xcfe28f[_0x84cf('0x32')]['hasOwnProperty'](_0x84cf('0x4c'))){_0x33145e['limit']=qs[_0x84cf('0x1e')](_0xcfe28f[_0x84cf('0x32')][_0x84cf('0x1e')]);_0x33145e[_0x84cf('0x1d')]=qs[_0x84cf('0x1d')](_0xcfe28f['query'][_0x84cf('0x1d')]);}return _0x4fd496[_0x84cf('0x4b')](_0x33145e);}})[_0x84cf('0x26')](function(_0x4ebb4b){if(_0x4ebb4b){return _0x4ebb4b?{'count':_0x147194,'rows':_0x4ebb4b}:null;}})[_0x84cf('0x26')](respondWithResult(_0x225fc2,null))[_0x84cf('0x43')](handleError(_0x225fc2,null));};exports['addConfiguration']=function(_0x84d9cb,_0x482958,_0x26f8d4){if(_0x84d9cb[_0x84cf('0x48')]['id']){delete _0x84d9cb['body']['id'];}return db[_0x84cf('0x2d')][_0x84cf('0x4d')]({'where':{'id':_0x84d9cb['params']['id']}})[_0x84cf('0x26')](handleEntityNotFound(_0x482958,null))[_0x84cf('0x26')](function(_0x262ae1){if(_0x262ae1){_0x84d9cb[_0x84cf('0x48')]['AccountId']=_0x262ae1['id'];_0x84d9cb[_0x84cf('0x48')][_0x84cf('0x4e')]=integrations['getSubjects'](_0x84d9cb['body']['channel'],_0x84d9cb[_0x84cf('0x48')][_0x84cf('0x30')]);_0x84d9cb[_0x84cf('0x48')]['Descriptions']=integrations['getDescriptions'](_0x84d9cb[_0x84cf('0x48')][_0x84cf('0x4f')],_0x84d9cb[_0x84cf('0x48')][_0x84cf('0x30')]);return db[_0x84cf('0x49')][_0x84cf('0x47')](_0x84d9cb[_0x84cf('0x48')],{'include':[{'model':db[_0x84cf('0x50')],'as':'Subjects'},{'model':db[_0x84cf('0x50')],'as':'Descriptions'}]});}return null;})[_0x84cf('0x26')](respondWithResult(_0x482958,null))[_0x84cf('0x43')](handleError(_0x482958,null));};exports['getFields']=function(_0x5b154a,_0x282c17,_0x31e622){var _0x373a25='';return db[_0x84cf('0x2d')][_0x84cf('0x4d')]({'where':{'id':_0x5b154a['params']['id']},'attributes':['id',_0x84cf('0x51'),_0x84cf('0x52'),_0x84cf('0x53'),_0x84cf('0x54'),'remoteUri']})[_0x84cf('0x26')](handleEntityNotFound(_0x282c17,null))['then'](function(_0x4bfa38){if(_0x4bfa38){_0x373a25=_0x4bfa38[_0x84cf('0x55')];var _0x292202=_0x373a25[_0x84cf('0x56')](-0x1);if(_0x292202==='/'){_0x373a25=_0x373a25[_0x84cf('0x57')](0x0,_0x373a25['lastIndexOf'](_0x292202));}var _0x5c8e79={'method':'GET','uri':util[_0x84cf('0x58')]('%s/%s',_0x373a25,_0x84cf('0x59')),'json':!![]};switch(_0x4bfa38[_0x84cf('0x54')]){case _0x84cf('0x52'):_0x5c8e79[_0x84cf('0x5a')]={'Authorization':util['format'](_0x84cf('0x5b'),new Buffer(util[_0x84cf('0x58')]('%s:%s',_0x4bfa38[_0x84cf('0x51')],_0x4bfa38['password']))['toString'](_0x84cf('0x5c')))};break;case _0x84cf('0x53'):_0x5c8e79['headers']={'Authorization':util['format'](_0x84cf('0x5b'),new Buffer(util['format']('%s/token:%s',_0x4bfa38['username'],_0x4bfa38[_0x84cf('0x53')]))[_0x84cf('0x5d')](_0x84cf('0x5c')))};break;default:throw new db['Sequelize']['ValidationError'](_0x84cf('0x5e'));}return rp(_0x5c8e79);}})[_0x84cf('0x26')](function(_0x4393a0){if(_0x4393a0){var _0x4686e2=['subject','description','group',_0x84cf('0x5f')];_[_0x84cf('0x60')](_0x4393a0[_0x84cf('0x59')],function(_0x4fc2f2){return _0x4686e2[_0x84cf('0x61')](_0x4fc2f2[_0x84cf('0x30')]);});return{'count':_0x4393a0[_0x84cf('0x59')][_0x84cf('0x38')],'rows':_[_0x84cf('0x2c')](_0x4393a0['ticket_fields'],function(_0x1ffa84){return{'id':_0x1ffa84['id'],'name':_0x1ffa84[_0x84cf('0x62')]>0x7?_0x1ffa84[_0x84cf('0x63')]:_0x1ffa84['type'],'custom':_0x1ffa84[_0x84cf('0x62')]>0x7?!![]:![],'options':_0x1ffa84[_0x84cf('0x64')]?_0x1ffa84['system_field_options']:_0x1ffa84[_0x84cf('0x65')]?_0x1ffa84[_0x84cf('0x65')]:[]};})};}})[_0x84cf('0x26')](respondWithResult(_0x282c17,null))[_0x84cf('0x43')](function(_0x538a77){var _0x4f1fbb=_0x5b154a[_0x84cf('0x32')][_0x84cf('0x66')]?0x1f4:_0x538a77['statusCode']||0x1f4;logger['error'](_0x84cf('0x67'),_0x84cf('0x68'),_0x4f1fbb,JSON[_0x84cf('0x69')](_0x538a77));delete _0x538a77[_0x84cf('0x2a')];if(_0x4f1fbb===0x191){_0x4f1fbb=0x190;}_0x282c17[_0x84cf('0x1a')](_0x4f1fbb)[_0x84cf('0x6a')](_0x5b154a[_0x84cf('0x32')][_0x84cf('0x66')]?{'message':'Wrong\x20credentials','statusCode':_0x538a77[_0x84cf('0x6b')]}:_0x538a77);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 85a8dfb..e2616cd 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 _0xf875=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf875,0x107));var _0x5f87=function(_0x3268d9,_0x30e9c4){_0x3268d9=_0x3268d9-0x0;var _0x1b5024=_0xf875[_0x3268d9];return _0x1b5024;};'use strict';var _=require(_0x5f87('0x0'));var util=require(_0x5f87('0x1'));var logger=require(_0x5f87('0x2'))('api');var moment=require(_0x5f87('0x3'));var BPromise=require(_0x5f87('0x4'));var rp=require(_0x5f87('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f87('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f87('0x7'));var integrations=require(_0x5f87('0x8'));module['exports']=function(_0xaa0d6,_0xa6ffe7){return _0xaa0d6[_0x5f87('0x9')](_0x5f87('0xa'),attributes,{'tableName':_0x5f87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaead=['bluebird','request-promise','rimraf','exports','define','ZendeskAccount','int_zendesk_accounts','util','api'];(function(_0xf285c1,_0x420382){var _0x1598a0=function(_0x3e96df){while(--_0x3e96df){_0xf285c1['push'](_0xf285c1['shift']());}};_0x1598a0(++_0x420382);}(_0xaead,0x97));var _0xdaea=function(_0x4c43bc,_0x2a48c7){_0x4c43bc=_0x4c43bc-0x0;var _0x247a74=_0xaead[_0x4c43bc];return _0x247a74;};'use strict';var _=require('lodash');var util=require(_0xdaea('0x0'));var logger=require('../../config/logger')(_0xdaea('0x1'));var moment=require('moment');var BPromise=require(_0xdaea('0x2'));var rp=require(_0xdaea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaea('0x4'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xdaea('0x5')]=function(_0x575663,_0x2bdaa6){return _0x575663[_0xdaea('0x6')](_0xdaea('0x7'),attributes,{'tableName':_0xdaea('0x8'),'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 e5946c6..061a450 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 _0x768e=['GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowZendeskAccount','ZendeskAccount','find','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x575c7a,_0x205e8b){var _0x1455fa=function(_0x4f4b1d){while(--_0x4f4b1d){_0x575c7a['push'](_0x575c7a['shift']());}};_0x1455fa(++_0x205e8b);}(_0x768e,0x9b));var _0xe768=function(_0x3546d8,_0x4c568a){_0x3546d8=_0x3546d8-0x0;var _0x1b1b01=_0x768e[_0x3546d8];return _0x1b1b01;};'use strict';var _=require(_0xe768('0x0'));var util=require(_0xe768('0x1'));var moment=require(_0xe768('0x2'));var BPromise=require(_0xe768('0x3'));var rs=require(_0xe768('0x4'));var fs=require('fs');var Redis=require(_0xe768('0x5'));var db=require(_0xe768('0x6'))['db'];var utils=require(_0xe768('0x7'));var logger=require(_0xe768('0x8'))(_0xe768('0x9'));var config=require(_0xe768('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe768('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x499844,_0x30ed7a,_0x32223e){return new BPromise(function(_0xb7330d,_0x2592cd){return client['request'](_0x499844,_0x32223e)[_0xe768('0xc')](function(_0x1cee13){logger['info'](_0xe768('0xd'),_0x30ed7a,_0xe768('0xe'));logger[_0xe768('0xf')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x30ed7a,'request\x20sent',JSON[_0xe768('0x10')](_0x1cee13));if(_0x1cee13[_0xe768('0x11')]){if(_0x1cee13[_0xe768('0x11')][_0xe768('0x12')]===0x1f4){logger['error'](_0xe768('0xd'),_0x30ed7a,_0x1cee13[_0xe768('0x11')]['message']);return _0x2592cd(_0x1cee13[_0xe768('0x11')][_0xe768('0x13')]);}logger[_0xe768('0x11')](_0xe768('0xd'),_0x30ed7a,_0x1cee13['error'][_0xe768('0x13')]);return _0xb7330d(_0x1cee13[_0xe768('0x11')][_0xe768('0x13')]);}else{logger['info'](_0xe768('0xd'),_0x30ed7a,_0xe768('0xe'));_0xb7330d(_0x1cee13['result'][_0xe768('0x13')]);}})['catch'](function(_0xde7dba){logger[_0xe768('0x11')](_0xe768('0xd'),_0x30ed7a,_0xde7dba);_0x2592cd(_0xde7dba);});});}exports[_0xe768('0x14')]=function(_0x288ff){var _0x1500e8=this;return new Promise(function(_0x36353b,_0x200651){return db['ZendeskAccount'][_0xe768('0x15')]({'raw':_0x288ff['options']?_0x288ff[_0xe768('0x16')][_0xe768('0x17')]===undefined?!![]:![]:!![],'where':_0x288ff[_0xe768('0x16')]?_0x288ff[_0xe768('0x16')][_0xe768('0x18')]||null:null,'attributes':_0x288ff['options']?_0x288ff['options'][_0xe768('0x19')]||null:null,'limit':_0x288ff[_0xe768('0x16')]?_0x288ff['options'][_0xe768('0x1a')]||null:null,'include':_0x288ff[_0xe768('0x16')]?_0x288ff[_0xe768('0x16')][_0xe768('0x1b')]?_['map'](_0x288ff['options']['include'],function(_0x5ec40f){return{'model':db[_0x5ec40f[_0xe768('0x1c')]],'as':_0x5ec40f['as'],'attributes':_0x5ec40f['attributes'],'include':_0x5ec40f['include']?_[_0xe768('0x1d')](_0x5ec40f[_0xe768('0x1b')],function(_0x576f91){return{'model':db[_0x576f91['model']],'as':_0x576f91['as'],'attributes':_0x576f91[_0xe768('0x19')],'include':_0x576f91[_0xe768('0x1b')]?_['map'](_0x576f91[_0xe768('0x1b')],function(_0x18b4ff){return{'model':db[_0x18b4ff[_0xe768('0x1c')]],'as':_0x18b4ff['as'],'attributes':_0x18b4ff[_0xe768('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe768('0xc')](function(_0x464c86){logger['info']('GetZendeskAccount',_0x288ff);logger[_0xe768('0xf')](_0xe768('0x14'),_0x288ff,JSON['stringify'](_0x464c86));_0x36353b(_0x464c86);})[_0xe768('0x1e')](function(_0x3f11da){logger[_0xe768('0x11')](_0xe768('0x14'),_0x3f11da['message'],_0x288ff);_0x200651(_0x1500e8['error'](0x1f4,_0x3f11da[_0xe768('0x13')]));});});};exports[_0xe768('0x1f')]=function(_0x4baa97){var _0x3a77dc=this;return new Promise(function(_0x24fb69,_0x5a2077){return db[_0xe768('0x20')][_0xe768('0x21')]({'raw':_0x4baa97[_0xe768('0x16')]?_0x4baa97['options'][_0xe768('0x17')]===undefined?!![]:![]:!![],'where':_0x4baa97[_0xe768('0x16')]?_0x4baa97[_0xe768('0x16')]['where']||null:null,'attributes':_0x4baa97[_0xe768('0x16')]?_0x4baa97[_0xe768('0x16')]['attributes']||null:null,'include':_0x4baa97[_0xe768('0x16')]?_0x4baa97[_0xe768('0x16')]['include']?_[_0xe768('0x1d')](_0x4baa97['options'][_0xe768('0x1b')],function(_0x251ddf){return{'model':db[_0x251ddf[_0xe768('0x1c')]],'as':_0x251ddf['as'],'attributes':_0x251ddf['attributes'],'include':_0x251ddf[_0xe768('0x1b')]?_['map'](_0x251ddf[_0xe768('0x1b')],function(_0x59f3a9){return{'model':db[_0x59f3a9['model']],'as':_0x59f3a9['as'],'attributes':_0x59f3a9[_0xe768('0x19')],'include':_0x59f3a9[_0xe768('0x1b')]?_[_0xe768('0x1d')](_0x59f3a9['include'],function(_0xf10748){return{'model':db[_0xf10748[_0xe768('0x1c')]],'as':_0xf10748['as'],'attributes':_0xf10748[_0xe768('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe768('0xc')](function(_0x494510){logger[_0xe768('0x22')](_0xe768('0x1f'),_0x4baa97);logger[_0xe768('0xf')](_0xe768('0x1f'),_0x4baa97,JSON[_0xe768('0x10')](_0x494510));_0x24fb69(_0x494510);})[_0xe768('0x1e')](function(_0x144ac0){logger[_0xe768('0x11')](_0xe768('0x1f'),_0x144ac0['message'],_0x4baa97);_0x5a2077(_0x3a77dc[_0xe768('0x11')](0x1f4,_0x144ac0[_0xe768('0x13')]));});});}; \ No newline at end of file +var _0x14e4=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','find'];(function(_0x3f9395,_0x1632ab){var _0x469b9e=function(_0x3161b3){while(--_0x3161b3){_0x3f9395['push'](_0x3f9395['shift']());}};_0x469b9e(++_0x1632ab);}(_0x14e4,0x144));var _0x414e=function(_0x21c7b0,_0x1ca2e3){_0x21c7b0=_0x21c7b0-0x0;var _0x2907f1=_0x14e4[_0x21c7b0];return _0x2907f1;};'use strict';var _=require(_0x414e('0x0'));var util=require(_0x414e('0x1'));var moment=require(_0x414e('0x2'));var BPromise=require(_0x414e('0x3'));var rs=require(_0x414e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x414e('0x5'))['db'];var utils=require(_0x414e('0x6'));var logger=require(_0x414e('0x7'))(_0x414e('0x8'));var config=require('../../config/environment');var jayson=require(_0x414e('0x9'));var client=jayson[_0x414e('0xa')][_0x414e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ca803,_0x466fac,_0x2f1da7){return new BPromise(function(_0x540f36,_0x1043a6){return client['request'](_0x4ca803,_0x2f1da7)[_0x414e('0xc')](function(_0x1e291e){logger[_0x414e('0xd')](_0x414e('0xe'),_0x466fac,_0x414e('0xf'));logger[_0x414e('0x10')](_0x414e('0x11'),_0x466fac,_0x414e('0xf'),JSON[_0x414e('0x12')](_0x1e291e));if(_0x1e291e[_0x414e('0x13')]){if(_0x1e291e[_0x414e('0x13')][_0x414e('0x14')]===0x1f4){logger['error'](_0x414e('0xe'),_0x466fac,_0x1e291e[_0x414e('0x13')][_0x414e('0x15')]);return _0x1043a6(_0x1e291e[_0x414e('0x13')][_0x414e('0x15')]);}logger[_0x414e('0x13')](_0x414e('0xe'),_0x466fac,_0x1e291e['error'][_0x414e('0x15')]);return _0x540f36(_0x1e291e[_0x414e('0x13')][_0x414e('0x15')]);}else{logger[_0x414e('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x466fac,_0x414e('0xf'));_0x540f36(_0x1e291e['result']['message']);}})[_0x414e('0x16')](function(_0x3e7b64){logger[_0x414e('0x13')](_0x414e('0xe'),_0x466fac,_0x3e7b64);_0x1043a6(_0x3e7b64);});});}exports[_0x414e('0x17')]=function(_0xe3420a){var _0x51ef3d=this;return new Promise(function(_0x1a20ed,_0x435c08){return db[_0x414e('0x18')][_0x414e('0x19')]({'raw':_0xe3420a[_0x414e('0x1a')]?_0xe3420a[_0x414e('0x1a')][_0x414e('0x1b')]===undefined?!![]:![]:!![],'where':_0xe3420a[_0x414e('0x1a')]?_0xe3420a['options'][_0x414e('0x1c')]||null:null,'attributes':_0xe3420a['options']?_0xe3420a[_0x414e('0x1a')][_0x414e('0x1d')]||null:null,'limit':_0xe3420a[_0x414e('0x1a')]?_0xe3420a[_0x414e('0x1a')][_0x414e('0x1e')]||null:null,'include':_0xe3420a[_0x414e('0x1a')]?_0xe3420a['options'][_0x414e('0x1f')]?_[_0x414e('0x20')](_0xe3420a[_0x414e('0x1a')][_0x414e('0x1f')],function(_0x45551e){return{'model':db[_0x45551e['model']],'as':_0x45551e['as'],'attributes':_0x45551e[_0x414e('0x1d')],'include':_0x45551e['include']?_[_0x414e('0x20')](_0x45551e[_0x414e('0x1f')],function(_0x2eeaad){return{'model':db[_0x2eeaad['model']],'as':_0x2eeaad['as'],'attributes':_0x2eeaad['attributes'],'include':_0x2eeaad[_0x414e('0x1f')]?_['map'](_0x2eeaad[_0x414e('0x1f')],function(_0x5720b0){return{'model':db[_0x5720b0[_0x414e('0x21')]],'as':_0x5720b0['as'],'attributes':_0x5720b0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x275582){logger[_0x414e('0xd')](_0x414e('0x17'),_0xe3420a);logger[_0x414e('0x10')]('GetZendeskAccount',_0xe3420a,JSON['stringify'](_0x275582));_0x1a20ed(_0x275582);})[_0x414e('0x16')](function(_0x574fd9){logger[_0x414e('0x13')](_0x414e('0x17'),_0x574fd9[_0x414e('0x15')],_0xe3420a);_0x435c08(_0x51ef3d['error'](0x1f4,_0x574fd9[_0x414e('0x15')]));});});};exports[_0x414e('0x22')]=function(_0x1d33df){var _0x2dc774=this;return new Promise(function(_0x220db8,_0x3bb586){return db[_0x414e('0x18')][_0x414e('0x23')]({'raw':_0x1d33df['options']?_0x1d33df[_0x414e('0x1a')][_0x414e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d33df['options']?_0x1d33df[_0x414e('0x1a')]['where']||null:null,'attributes':_0x1d33df[_0x414e('0x1a')]?_0x1d33df[_0x414e('0x1a')][_0x414e('0x1d')]||null:null,'include':_0x1d33df[_0x414e('0x1a')]?_0x1d33df[_0x414e('0x1a')][_0x414e('0x1f')]?_[_0x414e('0x20')](_0x1d33df[_0x414e('0x1a')][_0x414e('0x1f')],function(_0x519888){return{'model':db[_0x519888[_0x414e('0x21')]],'as':_0x519888['as'],'attributes':_0x519888[_0x414e('0x1d')],'include':_0x519888[_0x414e('0x1f')]?_[_0x414e('0x20')](_0x519888['include'],function(_0x16fb90){return{'model':db[_0x16fb90[_0x414e('0x21')]],'as':_0x16fb90['as'],'attributes':_0x16fb90['attributes'],'include':_0x16fb90['include']?_[_0x414e('0x20')](_0x16fb90[_0x414e('0x1f')],function(_0x2005de){return{'model':db[_0x2005de[_0x414e('0x21')]],'as':_0x2005de['as'],'attributes':_0x2005de[_0x414e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x414e('0xc')](function(_0x20540b){logger[_0x414e('0xd')](_0x414e('0x22'),_0x1d33df);logger[_0x414e('0x10')](_0x414e('0x22'),_0x1d33df,JSON[_0x414e('0x12')](_0x20540b));_0x220db8(_0x20540b);})['catch'](function(_0x2d0f00){logger[_0x414e('0x13')]('ShowZendeskAccount',_0x2d0f00[_0x414e('0x15')],_0x1d33df);_0x3bb586(_0x2dc774[_0x414e('0x13')](0x1f4,_0x2d0f00[_0x414e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 58422f7..5f81b51 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 _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x17152b,_0x34c6ef){var _0x3d8633=function(_0x2a5839){while(--_0x2a5839){_0x17152b['push'](_0x17152b['shift']());}};_0x3d8633(++_0x34c6ef);}(_0x757a,0xde));var _0xa757=function(_0x972b4b,_0x43c19f){_0x972b4b=_0x972b4b-0x0;var _0xbfeece=_0x757a[_0x972b4b];return _0xbfeece;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x5866d1,_0xa6dc72){var _0x30071f=function(_0x482390){while(--_0x482390){_0x5866d1['push'](_0x5866d1['shift']());}};_0x30071f(++_0xa6dc72);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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('./intZendeskConfiguration.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/descriptions',auth[_0x0d8b('0x7')](),controller['getDescriptions']);router[_0x0d8b('0x9')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller['update']);router[_0x0d8b('0x16')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x17')]);module[_0x0d8b('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 6d99fec..6781de5 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 _0xdd41=['sequelize','exports','STRING'];(function(_0x219c6c,_0x7a4b97){var _0x4802ab=function(_0x54f333){while(--_0x54f333){_0x219c6c['push'](_0x219c6c['shift']());}};_0x4802ab(++_0x7a4b97);}(_0xdd41,0x1cb));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1dd4('0x0'));module[_0x1dd4('0x1')]={'name':{'type':Sequelize[_0x1dd4('0x2')]},'description':{'type':Sequelize[_0x1dd4('0x2')]}}; \ No newline at end of file +var _0xd6b8=['STRING','sequelize','exports'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0xd6b8,0x1ea));var _0x8d6b=function(_0x41a9ab,_0x34a3d3){_0x41a9ab=_0x41a9ab-0x0;var _0x5d27c0=_0xd6b8[_0x41a9ab];return _0x5d27c0;};'use strict';var Sequelize=require(_0x8d6b('0x0'));module[_0x8d6b('0x1')]={'name':{'type':Sequelize[_0x8d6b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 15465b4..c5b7283 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 _0x8517=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','ZendeskConfiguration','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','rows','catch','params','includeAll','find','create','body','pick','getFields','getSubjects','ZendeskField','getDescriptions','getTags','findOne','Tag','setTags','ids','eml-format','rimraf','moment','bluebird','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x48069d,_0x4f7fdf){var _0x5d3218=function(_0xbdfd8d){while(--_0xbdfd8d){_0x48069d['push'](_0x48069d['shift']());}};_0x5d3218(++_0x4f7fdf);}(_0x8517,0x138));var _0x7851=function(_0x574e3c,_0x106ac4){_0x574e3c=_0x574e3c-0x0;var _0x54bee2=_0x8517[_0x574e3c];return _0x54bee2;};'use strict';var emlformat=require(_0x7851('0x0'));var rimraf=require(_0x7851('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7851('0x2'));var BPromise=require(_0x7851('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7851('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7851('0x5'));var fs=require('fs');var fs_extra=require(_0x7851('0x6'));var _=require(_0x7851('0x7'));var squel=require(_0x7851('0x8'));var crypto=require('crypto');var jsforce=require(_0x7851('0x9'));var deskjs=require(_0x7851('0xa'));var toCsv=require(_0x7851('0xb'));var querystring=require(_0x7851('0xc'));var Papa=require('papaparse');var Redis=require(_0x7851('0xd'));var authService=require(_0x7851('0xe'));var qs=require(_0x7851('0xf'));var as=require(_0x7851('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7851('0x11'))(_0x7851('0x12'));var utils=require(_0x7851('0x13'));var config=require(_0x7851('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x201a38,_0x5d9cca){_0x5d9cca=_0x5d9cca||0xcc;return function(_0xd1d1f8){if(_0xd1d1f8){return _0x201a38[_0x7851('0x15')](_0x5d9cca);}return _0x201a38[_0x7851('0x16')](_0x5d9cca)[_0x7851('0x17')]();};}function respondWithResult(_0x29ee77,_0x39d90e){_0x39d90e=_0x39d90e||0xc8;return function(_0x41f866){if(_0x41f866){return _0x29ee77[_0x7851('0x16')](_0x39d90e)[_0x7851('0x18')](_0x41f866);}};}function respondWithFilteredResult(_0x46c8f8,_0x5d5e6d){return function(_0x5decc3){if(_0x5decc3){var _0x3bc838=typeof _0x5d5e6d['offset']==='undefined'&&typeof _0x5d5e6d[_0x7851('0x19')]===_0x7851('0x1a');var _0x546051=_0x5decc3['count'];var _0x309fa0=_0x3bc838?0x0:_0x5d5e6d[_0x7851('0x1b')];var _0x5bf919=_0x3bc838?_0x5decc3[_0x7851('0x1c')]:_0x5d5e6d[_0x7851('0x1b')]+_0x5d5e6d['limit'];var _0x182367;if(_0x5bf919>=_0x546051){_0x5bf919=_0x546051;_0x182367=0xc8;}else{_0x182367=0xce;}_0x46c8f8[_0x7851('0x16')](_0x182367);return _0x46c8f8[_0x7851('0x1d')](_0x7851('0x1e'),_0x309fa0+'-'+_0x5bf919+'/'+_0x546051)[_0x7851('0x18')](_0x5decc3);}return null;};}function patchUpdates(_0x2b6151){return function(_0xb9b936){try{jsonpatch[_0x7851('0x1f')](_0xb9b936,_0x2b6151,!![]);}catch(_0x4fe5dc){return BPromise[_0x7851('0x20')](_0x4fe5dc);}return _0xb9b936[_0x7851('0x21')]();};}function saveUpdates(_0x1b0793,_0x244986){return function(_0x419a3d){if(_0x419a3d){return _0x419a3d[_0x7851('0x22')](_0x1b0793)[_0x7851('0x23')](function(_0x16bbfa){return _0x16bbfa;});}return null;};}function removeEntity(_0x530ca1,_0x953cc0){return function(_0x586350){if(_0x586350){return _0x586350[_0x7851('0x24')]()[_0x7851('0x23')](function(){_0x530ca1[_0x7851('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f444,_0x1b4c23){return function(_0x1b6d47){if(!_0x1b6d47){_0x26f444[_0x7851('0x15')](0x194);}return _0x1b6d47;};}function handleError(_0x338c71,_0x39f46a){_0x39f46a=_0x39f46a||0x1f4;return function(_0x4a9ce3){logger[_0x7851('0x25')](_0x4a9ce3[_0x7851('0x26')]);if(_0x4a9ce3[_0x7851('0x27')]){delete _0x4a9ce3[_0x7851('0x27')];}_0x338c71[_0x7851('0x16')](_0x39f46a)[_0x7851('0x28')](_0x4a9ce3);};}exports['index']=function(_0x3cda16,_0x2b7dc8){var _0x29de3c={},_0x306660={},_0x2460cc={'count':0x0,'rows':[]};var _0x23d9ed=_['map'](db[_0x7851('0x29')][_0x7851('0x2a')],function(_0x4ea0c6){return{'name':_0x4ea0c6['fieldName'],'type':_0x4ea0c6[_0x7851('0x2b')][_0x7851('0x2c')]};});_0x306660[_0x7851('0x2d')]=_[_0x7851('0x2e')](_0x23d9ed,_0x7851('0x27'));_0x306660['query']=_[_0x7851('0x2f')](_0x3cda16[_0x7851('0x30')]);_0x306660[_0x7851('0x31')]=_[_0x7851('0x32')](_0x306660[_0x7851('0x2d')],_0x306660[_0x7851('0x30')]);_0x29de3c['attributes']=_['intersection'](_0x306660[_0x7851('0x2d')],qs[_0x7851('0x33')](_0x3cda16['query'][_0x7851('0x33')]));_0x29de3c[_0x7851('0x34')]=_0x29de3c[_0x7851('0x34')][_0x7851('0x35')]?_0x29de3c['attributes']:_0x306660[_0x7851('0x2d')];if(!_0x3cda16['query'][_0x7851('0x36')](_0x7851('0x37'))){_0x29de3c[_0x7851('0x19')]=qs[_0x7851('0x19')](_0x3cda16[_0x7851('0x30')][_0x7851('0x19')]);_0x29de3c[_0x7851('0x1b')]=qs[_0x7851('0x1b')](_0x3cda16[_0x7851('0x30')][_0x7851('0x1b')]);}_0x29de3c[_0x7851('0x38')]=qs[_0x7851('0x39')](_0x3cda16[_0x7851('0x30')][_0x7851('0x39')]);_0x29de3c[_0x7851('0x3a')]=qs[_0x7851('0x31')](_['pick'](_0x3cda16[_0x7851('0x30')],_0x306660[_0x7851('0x31')]),_0x23d9ed);if(_0x3cda16[_0x7851('0x30')]['filter']){_0x29de3c[_0x7851('0x3a')]=_['merge'](_0x29de3c[_0x7851('0x3a')],{'$or':_[_0x7851('0x2e')](_0x23d9ed,function(_0x590bf6){if(_0x590bf6['type']!==_0x7851('0x3b')){var _0x15b0ed={};_0x15b0ed[_0x590bf6[_0x7851('0x27')]]={'$like':'%'+_0x3cda16['query'][_0x7851('0x3c')]+'%'};return _0x15b0ed;}})});}_0x29de3c=_[_0x7851('0x3d')]({},_0x29de3c,_0x3cda16[_0x7851('0x3e')]);var _0x2acac3={'where':_0x29de3c[_0x7851('0x3a')]};return db[_0x7851('0x29')]['count'](_0x2acac3)[_0x7851('0x23')](function(_0x13a039){_0x2460cc['count']=_0x13a039;if(_0x3cda16[_0x7851('0x30')]['includeAll']){_0x29de3c[_0x7851('0x3f')]=[{'all':!![]}];}return db[_0x7851('0x29')]['findAll'](_0x29de3c);})['then'](function(_0x4e1377){_0x2460cc[_0x7851('0x40')]=_0x4e1377;return _0x2460cc;})[_0x7851('0x23')](respondWithFilteredResult(_0x2b7dc8,_0x29de3c))[_0x7851('0x41')](handleError(_0x2b7dc8,null));};exports['show']=function(_0x5225b7,_0x4cbc43){var _0x479899={'raw':![],'where':{'id':_0x5225b7[_0x7851('0x42')]['id']}},_0x11a67c={};_0x11a67c[_0x7851('0x2d')]=_[_0x7851('0x2f')](db[_0x7851('0x29')]['rawAttributes']);_0x11a67c['query']=_[_0x7851('0x2f')](_0x5225b7['query']);_0x11a67c['filters']=_['intersection'](_0x11a67c[_0x7851('0x2d')],_0x11a67c[_0x7851('0x30')]);_0x479899['attributes']=_[_0x7851('0x32')](_0x11a67c[_0x7851('0x2d')],qs['fields'](_0x5225b7[_0x7851('0x30')][_0x7851('0x33')]));_0x479899[_0x7851('0x34')]=_0x479899[_0x7851('0x34')][_0x7851('0x35')]?_0x479899[_0x7851('0x34')]:_0x11a67c[_0x7851('0x2d')];if(_0x5225b7[_0x7851('0x30')][_0x7851('0x43')]){_0x479899[_0x7851('0x3f')]=[{'all':!![]}];}_0x479899=_[_0x7851('0x3d')]({},_0x479899,_0x5225b7['options']);return db[_0x7851('0x29')][_0x7851('0x44')](_0x479899)[_0x7851('0x23')](handleEntityNotFound(_0x4cbc43,null))[_0x7851('0x23')](respondWithResult(_0x4cbc43,null))['catch'](handleError(_0x4cbc43,null));};exports['create']=function(_0x43b1e1,_0x49dda3){return db['ZendeskConfiguration'][_0x7851('0x45')](_0x43b1e1[_0x7851('0x46')],{})[_0x7851('0x23')](respondWithResult(_0x49dda3,0xc9))[_0x7851('0x41')](handleError(_0x49dda3,null));};exports[_0x7851('0x22')]=function(_0x2a46cf,_0x194515){if(_0x2a46cf[_0x7851('0x46')]['id']){delete _0x2a46cf['body']['id'];}return db[_0x7851('0x29')][_0x7851('0x44')]({'where':{'id':_0x2a46cf[_0x7851('0x42')]['id']}})[_0x7851('0x23')](handleEntityNotFound(_0x194515,null))[_0x7851('0x23')](saveUpdates(_0x2a46cf[_0x7851('0x46')],null))[_0x7851('0x23')](respondWithResult(_0x194515,null))[_0x7851('0x41')](handleError(_0x194515,null));};exports[_0x7851('0x24')]=function(_0x56bfbc,_0x3498e4){return db[_0x7851('0x29')][_0x7851('0x44')]({'where':{'id':_0x56bfbc[_0x7851('0x42')]['id']}})[_0x7851('0x23')](handleEntityNotFound(_0x3498e4,null))[_0x7851('0x23')](removeEntity(_0x3498e4,null))[_0x7851('0x41')](handleError(_0x3498e4,null));};exports['getFields']=function(_0x4560f4,_0x3c5923,_0x6763f7){var _0x243561={};var _0x51b001={};var _0x2a0e87;var _0x5d1ffe;return db[_0x7851('0x29')]['findOne']({'where':{'id':_0x4560f4['params']['id']}})[_0x7851('0x23')](handleEntityNotFound(_0x3c5923,null))[_0x7851('0x23')](function(_0x57d016){if(_0x57d016){_0x2a0e87=_0x57d016;_0x51b001[_0x7851('0x2d')]=_['keys'](db['ZendeskField'][_0x7851('0x2a')]);_0x51b001[_0x7851('0x30')]=_[_0x7851('0x2f')](_0x4560f4[_0x7851('0x30')]);_0x51b001[_0x7851('0x31')]=_[_0x7851('0x32')](_0x51b001[_0x7851('0x2d')],_0x51b001[_0x7851('0x30')]);_0x243561['attributes']=_[_0x7851('0x32')](_0x51b001[_0x7851('0x2d')],qs[_0x7851('0x33')](_0x4560f4[_0x7851('0x30')]['fields']));_0x243561[_0x7851('0x34')]=_0x243561[_0x7851('0x34')][_0x7851('0x35')]?_0x243561['attributes']:_0x51b001[_0x7851('0x2d')];_0x243561[_0x7851('0x38')]=qs[_0x7851('0x39')](_0x4560f4['query']['sort']);_0x243561[_0x7851('0x3a')]=qs[_0x7851('0x31')](_[_0x7851('0x47')](_0x4560f4[_0x7851('0x30')],_0x51b001['filters']));if(_0x4560f4[_0x7851('0x30')][_0x7851('0x3c')]){_0x243561[_0x7851('0x3a')]=_[_0x7851('0x3d')](_0x243561[_0x7851('0x3a')],{'$or':_[_0x7851('0x2e')](_0x243561['attributes'],function(_0xa2664c){var _0x3b5cfd={};_0x3b5cfd[_0xa2664c]={'$like':'%'+_0x4560f4[_0x7851('0x30')][_0x7851('0x3c')]+'%'};return _0x3b5cfd;})});}_0x243561=_[_0x7851('0x3d')]({},_0x243561,_0x4560f4[_0x7851('0x3e')]);return _0x2a0e87['getFields'](_0x243561);}})[_0x7851('0x23')](function(_0x57f4a8){if(_0x57f4a8){_0x5d1ffe=_0x57f4a8['length'];if(!_0x4560f4[_0x7851('0x30')][_0x7851('0x36')](_0x7851('0x37'))){_0x243561[_0x7851('0x19')]=qs[_0x7851('0x19')](_0x4560f4[_0x7851('0x30')]['limit']);_0x243561[_0x7851('0x1b')]=qs[_0x7851('0x1b')](_0x4560f4[_0x7851('0x30')]['offset']);}return _0x2a0e87[_0x7851('0x48')](_0x243561);}})[_0x7851('0x23')](function(_0x288691){if(_0x288691){return _0x288691?{'count':_0x5d1ffe,'rows':_0x288691}:null;}})[_0x7851('0x23')](respondWithResult(_0x3c5923,null))[_0x7851('0x41')](handleError(_0x3c5923,null));};exports[_0x7851('0x49')]=function(_0x4788cc,_0x37d4cf,_0x335b35){var _0x410b65={};var _0x32b23f={};var _0x1dab11;var _0x356041;return db[_0x7851('0x29')]['findOne']({'where':{'id':_0x4788cc[_0x7851('0x42')]['id']}})[_0x7851('0x23')](handleEntityNotFound(_0x37d4cf,null))[_0x7851('0x23')](function(_0x2b1d35){if(_0x2b1d35){_0x1dab11=_0x2b1d35;_0x32b23f['model']=_[_0x7851('0x2f')](db[_0x7851('0x4a')][_0x7851('0x2a')]);_0x32b23f[_0x7851('0x30')]=_[_0x7851('0x2f')](_0x4788cc[_0x7851('0x30')]);_0x32b23f[_0x7851('0x31')]=_[_0x7851('0x32')](_0x32b23f['model'],_0x32b23f[_0x7851('0x30')]);_0x410b65[_0x7851('0x34')]=_[_0x7851('0x32')](_0x32b23f[_0x7851('0x2d')],qs[_0x7851('0x33')](_0x4788cc[_0x7851('0x30')][_0x7851('0x33')]));_0x410b65[_0x7851('0x34')]=_0x410b65['attributes'][_0x7851('0x35')]?_0x410b65[_0x7851('0x34')]:_0x32b23f['model'];_0x410b65[_0x7851('0x38')]=qs[_0x7851('0x39')](_0x4788cc[_0x7851('0x30')]['sort']);_0x410b65[_0x7851('0x3a')]=qs[_0x7851('0x31')](_['pick'](_0x4788cc[_0x7851('0x30')],_0x32b23f[_0x7851('0x31')]));if(_0x4788cc[_0x7851('0x30')][_0x7851('0x3c')]){_0x410b65['where']=_[_0x7851('0x3d')](_0x410b65[_0x7851('0x3a')],{'$or':_['map'](_0x410b65[_0x7851('0x34')],function(_0x4f689b){var _0x2b7d93={};_0x2b7d93[_0x4f689b]={'$like':'%'+_0x4788cc[_0x7851('0x30')][_0x7851('0x3c')]+'%'};return _0x2b7d93;})});}_0x410b65=_[_0x7851('0x3d')]({},_0x410b65,_0x4788cc['options']);return _0x1dab11[_0x7851('0x49')](_0x410b65);}})[_0x7851('0x23')](function(_0x4922d8){if(_0x4922d8){_0x356041=_0x4922d8[_0x7851('0x35')];if(!_0x4788cc[_0x7851('0x30')][_0x7851('0x36')](_0x7851('0x37'))){_0x410b65['limit']=qs['limit'](_0x4788cc[_0x7851('0x30')][_0x7851('0x19')]);_0x410b65['offset']=qs[_0x7851('0x1b')](_0x4788cc[_0x7851('0x30')][_0x7851('0x1b')]);}return _0x1dab11[_0x7851('0x49')](_0x410b65);}})[_0x7851('0x23')](function(_0x57b8b3){if(_0x57b8b3){return _0x57b8b3?{'count':_0x356041,'rows':_0x57b8b3}:null;}})[_0x7851('0x23')](respondWithResult(_0x37d4cf,null))['catch'](handleError(_0x37d4cf,null));};exports[_0x7851('0x4b')]=function(_0x24576e,_0x35db57,_0x349a78){var _0x1b2137={};var _0x34f899={};var _0x20daf2;var _0x3dc7d6;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x24576e['params']['id']}})['then'](handleEntityNotFound(_0x35db57,null))[_0x7851('0x23')](function(_0x319db8){if(_0x319db8){_0x20daf2=_0x319db8;_0x34f899['model']=_[_0x7851('0x2f')](db[_0x7851('0x4a')]['rawAttributes']);_0x34f899[_0x7851('0x30')]=_['keys'](_0x24576e[_0x7851('0x30')]);_0x34f899[_0x7851('0x31')]=_['intersection'](_0x34f899[_0x7851('0x2d')],_0x34f899[_0x7851('0x30')]);_0x1b2137[_0x7851('0x34')]=_['intersection'](_0x34f899[_0x7851('0x2d')],qs[_0x7851('0x33')](_0x24576e[_0x7851('0x30')]['fields']));_0x1b2137[_0x7851('0x34')]=_0x1b2137[_0x7851('0x34')][_0x7851('0x35')]?_0x1b2137[_0x7851('0x34')]:_0x34f899[_0x7851('0x2d')];_0x1b2137[_0x7851('0x38')]=qs[_0x7851('0x39')](_0x24576e[_0x7851('0x30')][_0x7851('0x39')]);_0x1b2137[_0x7851('0x3a')]=qs[_0x7851('0x31')](_['pick'](_0x24576e[_0x7851('0x30')],_0x34f899['filters']));if(_0x24576e[_0x7851('0x30')]['filter']){_0x1b2137['where']=_[_0x7851('0x3d')](_0x1b2137[_0x7851('0x3a')],{'$or':_[_0x7851('0x2e')](_0x1b2137[_0x7851('0x34')],function(_0x58eb3d){var _0x92954b={};_0x92954b[_0x58eb3d]={'$like':'%'+_0x24576e[_0x7851('0x30')]['filter']+'%'};return _0x92954b;})});}_0x1b2137=_[_0x7851('0x3d')]({},_0x1b2137,_0x24576e[_0x7851('0x3e')]);return _0x20daf2[_0x7851('0x4b')](_0x1b2137);}})['then'](function(_0x253932){if(_0x253932){_0x3dc7d6=_0x253932[_0x7851('0x35')];if(!_0x24576e[_0x7851('0x30')][_0x7851('0x36')](_0x7851('0x37'))){_0x1b2137[_0x7851('0x19')]=qs[_0x7851('0x19')](_0x24576e[_0x7851('0x30')][_0x7851('0x19')]);_0x1b2137[_0x7851('0x1b')]=qs[_0x7851('0x1b')](_0x24576e['query'][_0x7851('0x1b')]);}return _0x20daf2[_0x7851('0x4b')](_0x1b2137);}})[_0x7851('0x23')](function(_0x388540){if(_0x388540){return _0x388540?{'count':_0x3dc7d6,'rows':_0x388540}:null;}})[_0x7851('0x23')](respondWithResult(_0x35db57,null))[_0x7851('0x41')](handleError(_0x35db57,null));};exports[_0x7851('0x4c')]=function(_0x2b7859,_0x750efb,_0x42e4e5){var _0x37fe5b={};var _0x372202={};var _0x12592f;var _0xba50b9;return db[_0x7851('0x29')][_0x7851('0x4d')]({'where':{'id':_0x2b7859[_0x7851('0x42')]['id']}})[_0x7851('0x23')](handleEntityNotFound(_0x750efb,null))[_0x7851('0x23')](function(_0x4feaa4){if(_0x4feaa4){_0x12592f=_0x4feaa4;_0x372202[_0x7851('0x2d')]=_['keys'](db[_0x7851('0x4e')][_0x7851('0x2a')]);_0x372202[_0x7851('0x30')]=_[_0x7851('0x2f')](_0x2b7859[_0x7851('0x30')]);_0x372202['filters']=_[_0x7851('0x32')](_0x372202['model'],_0x372202[_0x7851('0x30')]);_0x37fe5b['attributes']=_[_0x7851('0x32')](_0x372202[_0x7851('0x2d')],qs[_0x7851('0x33')](_0x2b7859[_0x7851('0x30')][_0x7851('0x33')]));_0x37fe5b['attributes']=_0x37fe5b[_0x7851('0x34')][_0x7851('0x35')]?_0x37fe5b[_0x7851('0x34')]:_0x372202[_0x7851('0x2d')];_0x37fe5b[_0x7851('0x38')]=qs[_0x7851('0x39')](_0x2b7859['query']['sort']);_0x37fe5b[_0x7851('0x3a')]=qs[_0x7851('0x31')](_[_0x7851('0x47')](_0x2b7859[_0x7851('0x30')],_0x372202[_0x7851('0x31')]));if(_0x2b7859[_0x7851('0x30')][_0x7851('0x3c')]){_0x37fe5b[_0x7851('0x3a')]=_['merge'](_0x37fe5b[_0x7851('0x3a')],{'$or':_[_0x7851('0x2e')](_0x37fe5b[_0x7851('0x34')],function(_0x3cd7e5){var _0xf301c1={};_0xf301c1[_0x3cd7e5]={'$like':'%'+_0x2b7859[_0x7851('0x30')][_0x7851('0x3c')]+'%'};return _0xf301c1;})});}_0x37fe5b=_[_0x7851('0x3d')]({},_0x37fe5b,_0x2b7859[_0x7851('0x3e')]);return _0x12592f[_0x7851('0x4c')](_0x37fe5b);}})[_0x7851('0x23')](function(_0x3dde12){if(_0x3dde12){_0xba50b9=_0x3dde12[_0x7851('0x35')];if(!_0x2b7859[_0x7851('0x30')]['hasOwnProperty'](_0x7851('0x37'))){_0x37fe5b[_0x7851('0x19')]=qs[_0x7851('0x19')](_0x2b7859[_0x7851('0x30')][_0x7851('0x19')]);_0x37fe5b[_0x7851('0x1b')]=qs[_0x7851('0x1b')](_0x2b7859['query'][_0x7851('0x1b')]);}return _0x12592f[_0x7851('0x4c')](_0x37fe5b);}})['then'](function(_0x473511){if(_0x473511){return _0x473511?{'count':_0xba50b9,'rows':_0x473511}:null;}})[_0x7851('0x23')](respondWithResult(_0x750efb,null))[_0x7851('0x41')](handleError(_0x750efb,null));};exports[_0x7851('0x4f')]=function(_0x3bfbb8,_0x1b45a1,_0x11e447){if(_0x3bfbb8[_0x7851('0x46')]['id']){delete _0x3bfbb8[_0x7851('0x46')]['id'];}return db[_0x7851('0x29')]['findOne']({'where':{'id':_0x3bfbb8[_0x7851('0x42')]['id']}})[_0x7851('0x23')](handleEntityNotFound(_0x1b45a1,null))['then'](function(_0x4beec1){if(_0x4beec1){return _0x4beec1[_0x7851('0x4f')](_0x3bfbb8[_0x7851('0x46')][_0x7851('0x50')]||[]);}return null;})[_0x7851('0x23')](respondWithResult(_0x1b45a1,null))[_0x7851('0x41')](handleError(_0x1b45a1,null));}; \ No newline at end of file +var _0x7255=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','then','destroy','end','stack','send','index','rawAttributes','fieldName','key','model','map','name','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','ZendeskConfiguration','includeAll','include','rows','catch','show','params','fields','length','create','body','find','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','ids','eml-format','rimraf','fast-json-patch'];(function(_0x2e34bb,_0x15450c){var _0x2b6b7d=function(_0x5afaf9){while(--_0x5afaf9){_0x2e34bb['push'](_0x2e34bb['shift']());}};_0x2b6b7d(++_0x15450c);}(_0x7255,0xf3));var _0x5725=function(_0x279d06,_0x3bc312){_0x279d06=_0x279d06-0x0;var _0x2f997b=_0x7255[_0x279d06];return _0x2f997b;};'use strict';var emlformat=require(_0x5725('0x0'));var rimraf=require(_0x5725('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5725('0x2'));var rp=require(_0x5725('0x3'));var moment=require(_0x5725('0x4'));var BPromise=require(_0x5725('0x5'));var Mustache=require(_0x5725('0x6'));var util=require('util');var path=require(_0x5725('0x7'));var sox=require(_0x5725('0x8'));var csv=require(_0x5725('0x9'));var ejs=require(_0x5725('0xa'));var fs=require('fs');var fs_extra=require(_0x5725('0xb'));var _=require(_0x5725('0xc'));var squel=require(_0x5725('0xd'));var crypto=require('crypto');var jsforce=require(_0x5725('0xe'));var deskjs=require(_0x5725('0xf'));var toCsv=require(_0x5725('0x9'));var querystring=require(_0x5725('0x10'));var Papa=require('papaparse');var Redis=require(_0x5725('0x11'));var authService=require(_0x5725('0x12'));var qs=require(_0x5725('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5725('0x14'));var logger=require(_0x5725('0x15'))(_0x5725('0x16'));var utils=require(_0x5725('0x17'));var config=require(_0x5725('0x18'));var licenseUtil=require(_0x5725('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9b66,_0x4b7e29){_0x4b7e29=_0x4b7e29||0xcc;return function(_0x2a865b){if(_0x2a865b){return _0x3d9b66[_0x5725('0x1a')](_0x4b7e29);}return _0x3d9b66[_0x5725('0x1b')](_0x4b7e29)['end']();};}function respondWithResult(_0xa2d3d3,_0x1a0084){_0x1a0084=_0x1a0084||0xc8;return function(_0x885542){if(_0x885542){return _0xa2d3d3['status'](_0x1a0084)['json'](_0x885542);}};}function respondWithFilteredResult(_0x425ea8,_0x20edd5){return function(_0x4fde9f){if(_0x4fde9f){var _0x24aa1c=typeof _0x20edd5[_0x5725('0x1c')]==='undefined'&&typeof _0x20edd5[_0x5725('0x1d')]===_0x5725('0x1e');var _0x5efb36=_0x4fde9f[_0x5725('0x1f')];var _0x91b8dd=_0x24aa1c?0x0:_0x20edd5['offset'];var _0x2b5717=_0x24aa1c?_0x4fde9f[_0x5725('0x1f')]:_0x20edd5[_0x5725('0x1c')]+_0x20edd5[_0x5725('0x1d')];var _0x656cd5;if(_0x2b5717>=_0x5efb36){_0x2b5717=_0x5efb36;_0x656cd5=0xc8;}else{_0x656cd5=0xce;}_0x425ea8['status'](_0x656cd5);return _0x425ea8[_0x5725('0x20')](_0x5725('0x21'),_0x91b8dd+'-'+_0x2b5717+'/'+_0x5efb36)[_0x5725('0x22')](_0x4fde9f);}return null;};}function patchUpdates(_0x2bb596){return function(_0x329442){try{jsonpatch['apply'](_0x329442,_0x2bb596,!![]);}catch(_0x43e5d){return BPromise['reject'](_0x43e5d);}return _0x329442['save']();};}function saveUpdates(_0x211e7d,_0x4e7025){return function(_0x1ba7f3){if(_0x1ba7f3){return _0x1ba7f3['update'](_0x211e7d)[_0x5725('0x23')](function(_0x3811ac){return _0x3811ac;});}return null;};}function removeEntity(_0x35c29c,_0x2fd1ef){return function(_0x294285){if(_0x294285){return _0x294285[_0x5725('0x24')]()['then'](function(){_0x35c29c[_0x5725('0x1b')](0xcc)[_0x5725('0x25')]();});}};}function handleEntityNotFound(_0x132365,_0x56c9e6){return function(_0x48f0d9){if(!_0x48f0d9){_0x132365[_0x5725('0x1a')](0x194);}return _0x48f0d9;};}function handleError(_0x2692b0,_0x230d47){_0x230d47=_0x230d47||0x1f4;return function(_0xbdd49b){logger['error'](_0xbdd49b[_0x5725('0x26')]);if(_0xbdd49b['name']){delete _0xbdd49b['name'];}_0x2692b0['status'](_0x230d47)[_0x5725('0x27')](_0xbdd49b);};}exports[_0x5725('0x28')]=function(_0x5c5fec,_0x3ff696){var _0x7a1b87={},_0x25f54c={},_0x4e5410={'count':0x0,'rows':[]};var _0x22d878=_['map'](db['ZendeskConfiguration'][_0x5725('0x29')],function(_0x379e18){return{'name':_0x379e18[_0x5725('0x2a')],'type':_0x379e18['type'][_0x5725('0x2b')]};});_0x25f54c[_0x5725('0x2c')]=_[_0x5725('0x2d')](_0x22d878,_0x5725('0x2e'));_0x25f54c['query']=_[_0x5725('0x2f')](_0x5c5fec[_0x5725('0x30')]);_0x25f54c[_0x5725('0x31')]=_[_0x5725('0x32')](_0x25f54c['model'],_0x25f54c[_0x5725('0x30')]);_0x7a1b87[_0x5725('0x33')]=_[_0x5725('0x32')](_0x25f54c['model'],qs['fields'](_0x5c5fec['query']['fields']));_0x7a1b87[_0x5725('0x33')]=_0x7a1b87[_0x5725('0x33')]['length']?_0x7a1b87[_0x5725('0x33')]:_0x25f54c[_0x5725('0x2c')];if(!_0x5c5fec[_0x5725('0x30')][_0x5725('0x34')](_0x5725('0x35'))){_0x7a1b87['limit']=qs[_0x5725('0x1d')](_0x5c5fec[_0x5725('0x30')][_0x5725('0x1d')]);_0x7a1b87[_0x5725('0x1c')]=qs['offset'](_0x5c5fec[_0x5725('0x30')][_0x5725('0x1c')]);}_0x7a1b87[_0x5725('0x36')]=qs[_0x5725('0x37')](_0x5c5fec['query'][_0x5725('0x37')]);_0x7a1b87[_0x5725('0x38')]=qs['filters'](_[_0x5725('0x39')](_0x5c5fec[_0x5725('0x30')],_0x25f54c[_0x5725('0x31')]),_0x22d878);if(_0x5c5fec[_0x5725('0x30')][_0x5725('0x3a')]){_0x7a1b87[_0x5725('0x38')]=_['merge'](_0x7a1b87[_0x5725('0x38')],{'$or':_[_0x5725('0x2d')](_0x22d878,function(_0x5170a2){if(_0x5170a2[_0x5725('0x3b')]!==_0x5725('0x3c')){var _0x1eb8e1={};_0x1eb8e1[_0x5170a2[_0x5725('0x2e')]]={'$like':'%'+_0x5c5fec[_0x5725('0x30')][_0x5725('0x3a')]+'%'};return _0x1eb8e1;}})});}_0x7a1b87=_[_0x5725('0x3d')]({},_0x7a1b87,_0x5c5fec[_0x5725('0x3e')]);var _0x42891e={'where':_0x7a1b87['where']};return db[_0x5725('0x3f')][_0x5725('0x1f')](_0x42891e)[_0x5725('0x23')](function(_0x75142f){_0x4e5410['count']=_0x75142f;if(_0x5c5fec[_0x5725('0x30')][_0x5725('0x40')]){_0x7a1b87[_0x5725('0x41')]=[{'all':!![]}];}return db[_0x5725('0x3f')]['findAll'](_0x7a1b87);})[_0x5725('0x23')](function(_0x9dd08f){_0x4e5410[_0x5725('0x42')]=_0x9dd08f;return _0x4e5410;})[_0x5725('0x23')](respondWithFilteredResult(_0x3ff696,_0x7a1b87))[_0x5725('0x43')](handleError(_0x3ff696,null));};exports[_0x5725('0x44')]=function(_0x3ba41a,_0x2a86a9){var _0x2597d0={'raw':![],'where':{'id':_0x3ba41a[_0x5725('0x45')]['id']}},_0x4aac71={};_0x4aac71['model']=_[_0x5725('0x2f')](db['ZendeskConfiguration'][_0x5725('0x29')]);_0x4aac71[_0x5725('0x30')]=_['keys'](_0x3ba41a['query']);_0x4aac71[_0x5725('0x31')]=_[_0x5725('0x32')](_0x4aac71['model'],_0x4aac71['query']);_0x2597d0[_0x5725('0x33')]=_['intersection'](_0x4aac71[_0x5725('0x2c')],qs[_0x5725('0x46')](_0x3ba41a[_0x5725('0x30')]['fields']));_0x2597d0[_0x5725('0x33')]=_0x2597d0[_0x5725('0x33')][_0x5725('0x47')]?_0x2597d0['attributes']:_0x4aac71[_0x5725('0x2c')];if(_0x3ba41a['query'][_0x5725('0x40')]){_0x2597d0['include']=[{'all':!![]}];}_0x2597d0=_[_0x5725('0x3d')]({},_0x2597d0,_0x3ba41a[_0x5725('0x3e')]);return db['ZendeskConfiguration']['find'](_0x2597d0)['then'](handleEntityNotFound(_0x2a86a9,null))[_0x5725('0x23')](respondWithResult(_0x2a86a9,null))[_0x5725('0x43')](handleError(_0x2a86a9,null));};exports[_0x5725('0x48')]=function(_0x141d13,_0x493c9c){return db[_0x5725('0x3f')][_0x5725('0x48')](_0x141d13['body'],{})[_0x5725('0x23')](respondWithResult(_0x493c9c,0xc9))[_0x5725('0x43')](handleError(_0x493c9c,null));};exports['update']=function(_0x5199f4,_0x482afa){if(_0x5199f4[_0x5725('0x49')]['id']){delete _0x5199f4[_0x5725('0x49')]['id'];}return db[_0x5725('0x3f')][_0x5725('0x4a')]({'where':{'id':_0x5199f4[_0x5725('0x45')]['id']}})[_0x5725('0x23')](handleEntityNotFound(_0x482afa,null))['then'](saveUpdates(_0x5199f4['body'],null))[_0x5725('0x23')](respondWithResult(_0x482afa,null))[_0x5725('0x43')](handleError(_0x482afa,null));};exports['destroy']=function(_0x51bd16,_0xd4d471){return db[_0x5725('0x3f')][_0x5725('0x4a')]({'where':{'id':_0x51bd16[_0x5725('0x45')]['id']}})[_0x5725('0x23')](handleEntityNotFound(_0xd4d471,null))[_0x5725('0x23')](removeEntity(_0xd4d471,null))[_0x5725('0x43')](handleError(_0xd4d471,null));};exports[_0x5725('0x4b')]=function(_0xc0e7f,_0x510582,_0x30be93){var _0x286299={};var _0x133ead={};var _0x36e474;var _0x5d213e;return db[_0x5725('0x3f')][_0x5725('0x4c')]({'where':{'id':_0xc0e7f[_0x5725('0x45')]['id']}})[_0x5725('0x23')](handleEntityNotFound(_0x510582,null))['then'](function(_0x2649c0){if(_0x2649c0){_0x36e474=_0x2649c0;_0x133ead[_0x5725('0x2c')]=_[_0x5725('0x2f')](db[_0x5725('0x4d')][_0x5725('0x29')]);_0x133ead[_0x5725('0x30')]=_[_0x5725('0x2f')](_0xc0e7f[_0x5725('0x30')]);_0x133ead[_0x5725('0x31')]=_[_0x5725('0x32')](_0x133ead['model'],_0x133ead[_0x5725('0x30')]);_0x286299[_0x5725('0x33')]=_['intersection'](_0x133ead[_0x5725('0x2c')],qs[_0x5725('0x46')](_0xc0e7f['query']['fields']));_0x286299[_0x5725('0x33')]=_0x286299[_0x5725('0x33')]['length']?_0x286299['attributes']:_0x133ead['model'];_0x286299['order']=qs[_0x5725('0x37')](_0xc0e7f[_0x5725('0x30')][_0x5725('0x37')]);_0x286299[_0x5725('0x38')]=qs[_0x5725('0x31')](_[_0x5725('0x39')](_0xc0e7f[_0x5725('0x30')],_0x133ead[_0x5725('0x31')]));if(_0xc0e7f[_0x5725('0x30')][_0x5725('0x3a')]){_0x286299[_0x5725('0x38')]=_[_0x5725('0x3d')](_0x286299[_0x5725('0x38')],{'$or':_[_0x5725('0x2d')](_0x286299[_0x5725('0x33')],function(_0x26d970){var _0x37978e={};_0x37978e[_0x26d970]={'$like':'%'+_0xc0e7f['query'][_0x5725('0x3a')]+'%'};return _0x37978e;})});}_0x286299=_['merge']({},_0x286299,_0xc0e7f[_0x5725('0x3e')]);return _0x36e474[_0x5725('0x4b')](_0x286299);}})[_0x5725('0x23')](function(_0x35e5a5){if(_0x35e5a5){_0x5d213e=_0x35e5a5[_0x5725('0x47')];if(!_0xc0e7f[_0x5725('0x30')][_0x5725('0x34')](_0x5725('0x35'))){_0x286299[_0x5725('0x1d')]=qs[_0x5725('0x1d')](_0xc0e7f[_0x5725('0x30')][_0x5725('0x1d')]);_0x286299['offset']=qs[_0x5725('0x1c')](_0xc0e7f[_0x5725('0x30')]['offset']);}return _0x36e474['getFields'](_0x286299);}})[_0x5725('0x23')](function(_0x1e3ba2){if(_0x1e3ba2){return _0x1e3ba2?{'count':_0x5d213e,'rows':_0x1e3ba2}:null;}})[_0x5725('0x23')](respondWithResult(_0x510582,null))[_0x5725('0x43')](handleError(_0x510582,null));};exports[_0x5725('0x4e')]=function(_0x20f47c,_0x742a2a,_0x3688a1){var _0x575555={};var _0x5995ea={};var _0x4ab6fd;var _0xcbf376;return db[_0x5725('0x3f')][_0x5725('0x4c')]({'where':{'id':_0x20f47c[_0x5725('0x45')]['id']}})[_0x5725('0x23')](handleEntityNotFound(_0x742a2a,null))[_0x5725('0x23')](function(_0x393529){if(_0x393529){_0x4ab6fd=_0x393529;_0x5995ea[_0x5725('0x2c')]=_[_0x5725('0x2f')](db[_0x5725('0x4d')][_0x5725('0x29')]);_0x5995ea[_0x5725('0x30')]=_['keys'](_0x20f47c['query']);_0x5995ea[_0x5725('0x31')]=_[_0x5725('0x32')](_0x5995ea[_0x5725('0x2c')],_0x5995ea[_0x5725('0x30')]);_0x575555[_0x5725('0x33')]=_[_0x5725('0x32')](_0x5995ea[_0x5725('0x2c')],qs[_0x5725('0x46')](_0x20f47c[_0x5725('0x30')][_0x5725('0x46')]));_0x575555[_0x5725('0x33')]=_0x575555['attributes']['length']?_0x575555[_0x5725('0x33')]:_0x5995ea[_0x5725('0x2c')];_0x575555[_0x5725('0x36')]=qs[_0x5725('0x37')](_0x20f47c[_0x5725('0x30')][_0x5725('0x37')]);_0x575555['where']=qs[_0x5725('0x31')](_['pick'](_0x20f47c[_0x5725('0x30')],_0x5995ea[_0x5725('0x31')]));if(_0x20f47c['query']['filter']){_0x575555['where']=_[_0x5725('0x3d')](_0x575555['where'],{'$or':_['map'](_0x575555[_0x5725('0x33')],function(_0x363424){var _0xcf236e={};_0xcf236e[_0x363424]={'$like':'%'+_0x20f47c[_0x5725('0x30')][_0x5725('0x3a')]+'%'};return _0xcf236e;})});}_0x575555=_['merge']({},_0x575555,_0x20f47c['options']);return _0x4ab6fd[_0x5725('0x4e')](_0x575555);}})[_0x5725('0x23')](function(_0x21868b){if(_0x21868b){_0xcbf376=_0x21868b['length'];if(!_0x20f47c['query']['hasOwnProperty'](_0x5725('0x35'))){_0x575555['limit']=qs[_0x5725('0x1d')](_0x20f47c[_0x5725('0x30')]['limit']);_0x575555[_0x5725('0x1c')]=qs[_0x5725('0x1c')](_0x20f47c[_0x5725('0x30')]['offset']);}return _0x4ab6fd[_0x5725('0x4e')](_0x575555);}})[_0x5725('0x23')](function(_0x4f3349){if(_0x4f3349){return _0x4f3349?{'count':_0xcbf376,'rows':_0x4f3349}:null;}})['then'](respondWithResult(_0x742a2a,null))['catch'](handleError(_0x742a2a,null));};exports[_0x5725('0x4f')]=function(_0x470489,_0x43ad7e,_0x2d2c25){var _0x335c2a={};var _0x16e73f={};var _0x493bc7;var _0xb7fa3;return db[_0x5725('0x3f')][_0x5725('0x4c')]({'where':{'id':_0x470489[_0x5725('0x45')]['id']}})[_0x5725('0x23')](handleEntityNotFound(_0x43ad7e,null))['then'](function(_0x1920ba){if(_0x1920ba){_0x493bc7=_0x1920ba;_0x16e73f[_0x5725('0x2c')]=_[_0x5725('0x2f')](db[_0x5725('0x4d')][_0x5725('0x29')]);_0x16e73f['query']=_[_0x5725('0x2f')](_0x470489[_0x5725('0x30')]);_0x16e73f[_0x5725('0x31')]=_[_0x5725('0x32')](_0x16e73f[_0x5725('0x2c')],_0x16e73f[_0x5725('0x30')]);_0x335c2a[_0x5725('0x33')]=_[_0x5725('0x32')](_0x16e73f[_0x5725('0x2c')],qs['fields'](_0x470489[_0x5725('0x30')][_0x5725('0x46')]));_0x335c2a[_0x5725('0x33')]=_0x335c2a[_0x5725('0x33')]['length']?_0x335c2a[_0x5725('0x33')]:_0x16e73f[_0x5725('0x2c')];_0x335c2a['order']=qs['sort'](_0x470489[_0x5725('0x30')][_0x5725('0x37')]);_0x335c2a[_0x5725('0x38')]=qs['filters'](_[_0x5725('0x39')](_0x470489['query'],_0x16e73f[_0x5725('0x31')]));if(_0x470489[_0x5725('0x30')]['filter']){_0x335c2a[_0x5725('0x38')]=_[_0x5725('0x3d')](_0x335c2a['where'],{'$or':_[_0x5725('0x2d')](_0x335c2a[_0x5725('0x33')],function(_0x33325a){var _0x57b8d7={};_0x57b8d7[_0x33325a]={'$like':'%'+_0x470489[_0x5725('0x30')][_0x5725('0x3a')]+'%'};return _0x57b8d7;})});}_0x335c2a=_[_0x5725('0x3d')]({},_0x335c2a,_0x470489[_0x5725('0x3e')]);return _0x493bc7[_0x5725('0x4f')](_0x335c2a);}})[_0x5725('0x23')](function(_0x3f8780){if(_0x3f8780){_0xb7fa3=_0x3f8780['length'];if(!_0x470489[_0x5725('0x30')][_0x5725('0x34')](_0x5725('0x35'))){_0x335c2a[_0x5725('0x1d')]=qs[_0x5725('0x1d')](_0x470489[_0x5725('0x30')][_0x5725('0x1d')]);_0x335c2a[_0x5725('0x1c')]=qs[_0x5725('0x1c')](_0x470489['query']['offset']);}return _0x493bc7[_0x5725('0x4f')](_0x335c2a);}})[_0x5725('0x23')](function(_0x34c0d0){if(_0x34c0d0){return _0x34c0d0?{'count':_0xb7fa3,'rows':_0x34c0d0}:null;}})[_0x5725('0x23')](respondWithResult(_0x43ad7e,null))[_0x5725('0x43')](handleError(_0x43ad7e,null));};exports[_0x5725('0x50')]=function(_0x56fce4,_0x5f04dc,_0x28f2ff){var _0x31e21f={};var _0x409f4f={};var _0x5e93ca;var _0x402784;return db[_0x5725('0x3f')][_0x5725('0x4c')]({'where':{'id':_0x56fce4['params']['id']}})[_0x5725('0x23')](handleEntityNotFound(_0x5f04dc,null))[_0x5725('0x23')](function(_0x2647b3){if(_0x2647b3){_0x5e93ca=_0x2647b3;_0x409f4f['model']=_[_0x5725('0x2f')](db['Tag'][_0x5725('0x29')]);_0x409f4f[_0x5725('0x30')]=_['keys'](_0x56fce4[_0x5725('0x30')]);_0x409f4f[_0x5725('0x31')]=_[_0x5725('0x32')](_0x409f4f['model'],_0x409f4f[_0x5725('0x30')]);_0x31e21f[_0x5725('0x33')]=_[_0x5725('0x32')](_0x409f4f[_0x5725('0x2c')],qs['fields'](_0x56fce4[_0x5725('0x30')]['fields']));_0x31e21f['attributes']=_0x31e21f[_0x5725('0x33')][_0x5725('0x47')]?_0x31e21f['attributes']:_0x409f4f[_0x5725('0x2c')];_0x31e21f[_0x5725('0x36')]=qs[_0x5725('0x37')](_0x56fce4['query'][_0x5725('0x37')]);_0x31e21f[_0x5725('0x38')]=qs[_0x5725('0x31')](_['pick'](_0x56fce4['query'],_0x409f4f[_0x5725('0x31')]));if(_0x56fce4[_0x5725('0x30')]['filter']){_0x31e21f[_0x5725('0x38')]=_[_0x5725('0x3d')](_0x31e21f[_0x5725('0x38')],{'$or':_['map'](_0x31e21f[_0x5725('0x33')],function(_0x2f36bc){var _0xa79041={};_0xa79041[_0x2f36bc]={'$like':'%'+_0x56fce4[_0x5725('0x30')]['filter']+'%'};return _0xa79041;})});}_0x31e21f=_[_0x5725('0x3d')]({},_0x31e21f,_0x56fce4[_0x5725('0x3e')]);return _0x5e93ca['getTags'](_0x31e21f);}})['then'](function(_0x439905){if(_0x439905){_0x402784=_0x439905[_0x5725('0x47')];if(!_0x56fce4[_0x5725('0x30')]['hasOwnProperty'](_0x5725('0x35'))){_0x31e21f[_0x5725('0x1d')]=qs[_0x5725('0x1d')](_0x56fce4[_0x5725('0x30')]['limit']);_0x31e21f['offset']=qs[_0x5725('0x1c')](_0x56fce4[_0x5725('0x30')][_0x5725('0x1c')]);}return _0x5e93ca[_0x5725('0x50')](_0x31e21f);}})['then'](function(_0x126b62){if(_0x126b62){return _0x126b62?{'count':_0x402784,'rows':_0x126b62}:null;}})['then'](respondWithResult(_0x5f04dc,null))[_0x5725('0x43')](handleError(_0x5f04dc,null));};exports['setTags']=function(_0x3ea909,_0x1ff6fa,_0x3054c0){if(_0x3ea909['body']['id']){delete _0x3ea909[_0x5725('0x49')]['id'];}return db['ZendeskConfiguration'][_0x5725('0x4c')]({'where':{'id':_0x3ea909['params']['id']}})['then'](handleEntityNotFound(_0x1ff6fa,null))[_0x5725('0x23')](function(_0x237b3a){if(_0x237b3a){return _0x237b3a['setTags'](_0x3ea909['body'][_0x5725('0x51')]||[]);}return null;})[_0x5725('0x23')](respondWithResult(_0x1ff6fa,null))['catch'](handleError(_0x1ff6fa,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 5ff48ac..15ca6b0 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 _0x93e9=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0x152106,_0x11079a){var _0x4b20ba=function(_0x2d2a7d){while(--_0x2d2a7d){_0x152106['push'](_0x152106['shift']());}};_0x4b20ba(++_0x11079a);}(_0x93e9,0xcc));var _0x993e=function(_0x51f35b,_0x283125){_0x51f35b=_0x51f35b-0x0;var _0x1858da=_0x93e9[_0x51f35b];return _0x1858da;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4f4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x1016df,_0x384371){_0x1016df=_0x1016df-0x0;var _0x45e3ac=_0xd4f4[_0x1016df];return _0x45e3ac;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var logger=require(_0x4d4f('0x2'))(_0x4d4f('0x3'));var moment=require(_0x4d4f('0x4'));var BPromise=require(_0x4d4f('0x5'));var rp=require(_0x4d4f('0x6'));var fs=require('fs');var path=require(_0x4d4f('0x7'));var rimraf=require(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var attributes=require(_0x4d4f('0xa'));module['exports']=function(_0x5f451b,_0x5e38d2){return _0x5f451b[_0x4d4f('0xb')](_0x4d4f('0xc'),attributes,{'tableName':_0x4d4f('0xd'),'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 b152041..45dfc56 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 _0xe93d=['stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe93d,0x166));var _0xde93=function(_0x191eee,_0x527ec8){_0x191eee=_0x191eee-0x0;var _0x17c11b=_0xe93d[_0x191eee];return _0x17c11b;};'use strict';var _=require(_0xde93('0x0'));var util=require('util');var moment=require(_0xde93('0x1'));var BPromise=require('bluebird');var rs=require(_0xde93('0x2'));var fs=require('fs');var Redis=require(_0xde93('0x3'));var db=require(_0xde93('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde93('0x5'));var config=require(_0xde93('0x6'));var jayson=require(_0xde93('0x7'));var client=jayson[_0xde93('0x8')][_0xde93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54f18a,_0x1b1eef,_0x35720d){return new BPromise(function(_0x380bdb,_0x43dbd2){return client[_0xde93('0xa')](_0x54f18a,_0x35720d)[_0xde93('0xb')](function(_0xb6022f){logger['info'](_0xde93('0xc'),_0x1b1eef,_0xde93('0xd'));logger[_0xde93('0xe')](_0xde93('0xf'),_0x1b1eef,_0xde93('0xd'),JSON[_0xde93('0x10')](_0xb6022f));if(_0xb6022f[_0xde93('0x11')]){if(_0xb6022f['error'][_0xde93('0x12')]===0x1f4){logger[_0xde93('0x11')](_0xde93('0xc'),_0x1b1eef,_0xb6022f[_0xde93('0x11')]['message']);return _0x43dbd2(_0xb6022f[_0xde93('0x11')][_0xde93('0x13')]);}logger['error'](_0xde93('0xc'),_0x1b1eef,_0xb6022f['error'][_0xde93('0x13')]);return _0x380bdb(_0xb6022f[_0xde93('0x11')][_0xde93('0x13')]);}else{logger[_0xde93('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1b1eef,_0xde93('0xd'));_0x380bdb(_0xb6022f[_0xde93('0x15')]['message']);}})['catch'](function(_0x13d54e){logger['error'](_0xde93('0xc'),_0x1b1eef,_0x13d54e);_0x43dbd2(_0x13d54e);});});} \ No newline at end of file +var _0x511f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','../../mysqldb'];(function(_0x2615de,_0x479786){var _0x14bb5a=function(_0x29e032){while(--_0x29e032){_0x2615de['push'](_0x2615de['shift']());}};_0x14bb5a(++_0x479786);}(_0x511f,0x1a0));var _0xf511=function(_0x50d741,_0x5789e4){_0x50d741=_0x50d741-0x0;var _0x3b8086=_0x511f[_0x50d741];return _0x3b8086;};'use strict';var _=require(_0xf511('0x0'));var util=require(_0xf511('0x1'));var moment=require('moment');var BPromise=require(_0xf511('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf511('0x3'))['db'];var utils=require(_0xf511('0x4'));var logger=require(_0xf511('0x5'))(_0xf511('0x6'));var config=require(_0xf511('0x7'));var jayson=require(_0xf511('0x8'));var client=jayson[_0xf511('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a9cce,_0x50f70b,_0xefdfe3){return new BPromise(function(_0x30f0ad,_0x3be115){return client[_0xf511('0xa')](_0x3a9cce,_0xefdfe3)[_0xf511('0xb')](function(_0x4f8dc7){logger[_0xf511('0xc')](_0xf511('0xd'),_0x50f70b,_0xf511('0xe'));logger[_0xf511('0xf')](_0xf511('0x10'),_0x50f70b,'request\x20sent',JSON[_0xf511('0x11')](_0x4f8dc7));if(_0x4f8dc7['error']){if(_0x4f8dc7[_0xf511('0x12')][_0xf511('0x13')]===0x1f4){logger[_0xf511('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x50f70b,_0x4f8dc7[_0xf511('0x12')][_0xf511('0x14')]);return _0x3be115(_0x4f8dc7['error'][_0xf511('0x14')]);}logger[_0xf511('0x12')](_0xf511('0xd'),_0x50f70b,_0x4f8dc7['error'][_0xf511('0x14')]);return _0x30f0ad(_0x4f8dc7[_0xf511('0x12')]['message']);}else{logger[_0xf511('0xc')](_0xf511('0xd'),_0x50f70b,_0xf511('0xe'));_0x30f0ad(_0x4f8dc7['result'][_0xf511('0x14')]);}})['catch'](function(_0x1f3ce8){logger[_0xf511('0x12')](_0xf511('0xd'),_0x50f70b,_0x1f3ce8);_0x3be115(_0x1f3ce8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index abe4f9a..8502730 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 _0x6424=['create','put','update','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x3aac10,_0x33082f){var _0xf0bfcf=function(_0x4e7c5b){while(--_0x4e7c5b){_0x3aac10['push'](_0x3aac10['shift']());}};_0xf0bfcf(++_0x33082f);}(_0x6424,0x1b8));var _0x4642=function(_0xf39a72,_0x5ba64c){_0xf39a72=_0xf39a72-0x0;var _0x16d845=_0x6424[_0xf39a72];return _0x16d845;};'use strict';var multer=require('multer');var util=require(_0x4642('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4642('0x1'));var router=express['Router']();var fs_extra=require(_0x4642('0x2'));var auth=require(_0x4642('0x3'));var interaction=require(_0x4642('0x4'));var config=require(_0x4642('0x5'));var controller=require('./intZendeskField.controller');router[_0x4642('0x6')]('/',auth[_0x4642('0x7')](),controller[_0x4642('0x8')]);router['get'](_0x4642('0x9'),auth[_0x4642('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4642('0xa')]);router[_0x4642('0xb')](_0x4642('0x9'),auth[_0x4642('0x7')](),controller[_0x4642('0xc')]);router['delete'](_0x4642('0x9'),auth[_0x4642('0x7')](),controller[_0x4642('0xd')]);module[_0x4642('0xe')]=router; \ No newline at end of file +var _0xc8c6=['put','update','/:id','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','show','create'];(function(_0x34b9a2,_0x305f6d){var _0x401ee2=function(_0xae6c53){while(--_0xae6c53){_0x34b9a2['push'](_0x34b9a2['shift']());}};_0x401ee2(++_0x305f6d);}(_0xc8c6,0x103));var _0x6c8c=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xc8c6[_0xc8a931];return _0x28bd27;};'use strict';var multer=require(_0x6c8c('0x0'));var util=require(_0x6c8c('0x1'));var path=require(_0x6c8c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c8c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c8c('0x4'));var auth=require(_0x6c8c('0x5'));var interaction=require(_0x6c8c('0x6'));var config=require('../../config/environment');var controller=require(_0x6c8c('0x7'));router[_0x6c8c('0x8')]('/',auth[_0x6c8c('0x9')](),controller[_0x6c8c('0xa')]);router[_0x6c8c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6c8c('0xb')]);router['post']('/',auth[_0x6c8c('0x9')](),controller[_0x6c8c('0xc')]);router[_0x6c8c('0xd')]('/:id',auth[_0x6c8c('0x9')](),controller[_0x6c8c('0xe')]);router['delete'](_0x6c8c('0xf'),auth[_0x6c8c('0x9')](),controller['destroy']);module[_0x6c8c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index e2900c3..bd5d54e 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 _0x63c1=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','exports'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x63c1,0x98));var _0x163c=function(_0x4ad998,_0x1a6334){_0x4ad998=_0x4ad998-0x0;var _0x5c9d34=_0x63c1[_0x4ad998];return _0x5c9d34;};'use strict';var Sequelize=require('sequelize');module[_0x163c('0x0')]={'type':{'type':Sequelize['ENUM'](_0x163c('0x1'),_0x163c('0x2'),_0x163c('0x3'),_0x163c('0x4'),_0x163c('0x5')),'defaultValue':_0x163c('0x1')},'content':{'type':Sequelize[_0x163c('0x6')]},'key':{'type':Sequelize[_0x163c('0x6')]},'keyType':{'type':Sequelize[_0x163c('0x7')](_0x163c('0x1'),_0x163c('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x163c('0x6')]},'idField':{'type':Sequelize[_0x163c('0x6')]},'nameField':{'type':Sequelize[_0x163c('0x6')]},'customField':{'type':Sequelize[_0x163c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x163c('0x6')]}}; \ No newline at end of file +var _0x524e=['sequelize','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x24be16,_0x41939c){var _0x1630b4=function(_0x35eab8){while(--_0x35eab8){_0x24be16['push'](_0x24be16['shift']());}};_0x1630b4(++_0x41939c);}(_0x524e,0x98));var _0xe524=function(_0x2728ba,_0x8e9253){_0x2728ba=_0x2728ba-0x0;var _0x4e9c3b=_0x524e[_0x2728ba];return _0x4e9c3b;};'use strict';var Sequelize=require(_0xe524('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xe524('0x1'),_0xe524('0x2'),_0xe524('0x3'),_0xe524('0x4'),_0xe524('0x5')),'defaultValue':_0xe524('0x1')},'content':{'type':Sequelize[_0xe524('0x6')]},'key':{'type':Sequelize[_0xe524('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xe524('0x3'))},'keyContent':{'type':Sequelize[_0xe524('0x6')]},'idField':{'type':Sequelize[_0xe524('0x6')]},'nameField':{'type':Sequelize[_0xe524('0x6')]},'customField':{'type':Sequelize[_0xe524('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe524('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a272d3f..ab63d5c 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 _0x07a5=['reject','save','update','then','sendStatus','error','stack','send','index','ZendeskField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x07a5,0x1e8));var _0x507a=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0x07a5[_0x26d9b3];return _0x15c226;};'use strict';var emlformat=require(_0x507a('0x0'));var rimraf=require(_0x507a('0x1'));var zipdir=require(_0x507a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x507a('0x3'));var moment=require(_0x507a('0x4'));var BPromise=require(_0x507a('0x5'));var Mustache=require('mustache');var util=require(_0x507a('0x6'));var path=require('path');var sox=require(_0x507a('0x7'));var csv=require(_0x507a('0x8'));var ejs=require(_0x507a('0x9'));var fs=require('fs');var fs_extra=require(_0x507a('0xa'));var _=require(_0x507a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x507a('0xc'));var deskjs=require(_0x507a('0xd'));var toCsv=require(_0x507a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x507a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x507a('0xf'));var logger=require('../../config/logger')(_0x507a('0x10'));var utils=require(_0x507a('0x11'));var config=require(_0x507a('0x12'));var licenseUtil=require(_0x507a('0x13'));var db=require(_0x507a('0x14'))['db'];function respondWithStatusCode(_0x15614f,_0x5a794e){_0x5a794e=_0x5a794e||0xcc;return function(_0x35a632){if(_0x35a632){return _0x15614f['sendStatus'](_0x5a794e);}return _0x15614f[_0x507a('0x15')](_0x5a794e)[_0x507a('0x16')]();};}function respondWithResult(_0x4f5365,_0xd910c8){_0xd910c8=_0xd910c8||0xc8;return function(_0x43fc17){if(_0x43fc17){return _0x4f5365['status'](_0xd910c8)[_0x507a('0x17')](_0x43fc17);}};}function respondWithFilteredResult(_0xceac9a,_0x22319c){return function(_0x59e9f5){if(_0x59e9f5){var _0x5277c8=typeof _0x22319c[_0x507a('0x18')]===_0x507a('0x19')&&typeof _0x22319c[_0x507a('0x1a')]===_0x507a('0x19');var _0x59ee05=_0x59e9f5['count'];var _0x16154c=_0x5277c8?0x0:_0x22319c[_0x507a('0x18')];var _0x288008=_0x5277c8?_0x59e9f5[_0x507a('0x1b')]:_0x22319c[_0x507a('0x18')]+_0x22319c[_0x507a('0x1a')];var _0x451869;if(_0x288008>=_0x59ee05){_0x288008=_0x59ee05;_0x451869=0xc8;}else{_0x451869=0xce;}_0xceac9a['status'](_0x451869);return _0xceac9a[_0x507a('0x1c')](_0x507a('0x1d'),_0x16154c+'-'+_0x288008+'/'+_0x59ee05)['json'](_0x59e9f5);}return null;};}function patchUpdates(_0x24b802){return function(_0x5de8b3){try{jsonpatch['apply'](_0x5de8b3,_0x24b802,!![]);}catch(_0x5f2137){return BPromise[_0x507a('0x1e')](_0x5f2137);}return _0x5de8b3[_0x507a('0x1f')]();};}function saveUpdates(_0x1e0291,_0x254252){return function(_0x1488c8){if(_0x1488c8){return _0x1488c8[_0x507a('0x20')](_0x1e0291)[_0x507a('0x21')](function(_0xe779d8){return _0xe779d8;});}return null;};}function removeEntity(_0x6d80c2,_0x2b4172){return function(_0xefb60c){if(_0xefb60c){return _0xefb60c['destroy']()[_0x507a('0x21')](function(){_0x6d80c2[_0x507a('0x15')](0xcc)[_0x507a('0x16')]();});}};}function handleEntityNotFound(_0x1e213c,_0x1bb330){return function(_0x506076){if(!_0x506076){_0x1e213c[_0x507a('0x22')](0x194);}return _0x506076;};}function handleError(_0x4f7c35,_0x38c30b){_0x38c30b=_0x38c30b||0x1f4;return function(_0x588bb6){logger[_0x507a('0x23')](_0x588bb6[_0x507a('0x24')]);if(_0x588bb6['name']){delete _0x588bb6['name'];}_0x4f7c35[_0x507a('0x15')](_0x38c30b)[_0x507a('0x25')](_0x588bb6);};}exports[_0x507a('0x26')]=function(_0x5e5bb4,_0x180ebd){var _0x3780ae={},_0x5350a9={},_0x181feb={'count':0x0,'rows':[]};var _0x267bf5=_['map'](db[_0x507a('0x27')][_0x507a('0x28')],function(_0xb4110e){return{'name':_0xb4110e[_0x507a('0x29')],'type':_0xb4110e[_0x507a('0x2a')][_0x507a('0x2b')]};});_0x5350a9[_0x507a('0x2c')]=_['map'](_0x267bf5,_0x507a('0x2d'));_0x5350a9[_0x507a('0x2e')]=_[_0x507a('0x2f')](_0x5e5bb4[_0x507a('0x2e')]);_0x5350a9[_0x507a('0x30')]=_[_0x507a('0x31')](_0x5350a9[_0x507a('0x2c')],_0x5350a9[_0x507a('0x2e')]);_0x3780ae['attributes']=_[_0x507a('0x31')](_0x5350a9[_0x507a('0x2c')],qs[_0x507a('0x32')](_0x5e5bb4['query']['fields']));_0x3780ae[_0x507a('0x33')]=_0x3780ae[_0x507a('0x33')][_0x507a('0x34')]?_0x3780ae[_0x507a('0x33')]:_0x5350a9[_0x507a('0x2c')];if(!_0x5e5bb4[_0x507a('0x2e')][_0x507a('0x35')](_0x507a('0x36'))){_0x3780ae[_0x507a('0x1a')]=qs['limit'](_0x5e5bb4[_0x507a('0x2e')][_0x507a('0x1a')]);_0x3780ae[_0x507a('0x18')]=qs[_0x507a('0x18')](_0x5e5bb4['query'][_0x507a('0x18')]);}_0x3780ae[_0x507a('0x37')]=qs[_0x507a('0x38')](_0x5e5bb4[_0x507a('0x2e')][_0x507a('0x38')]);_0x3780ae[_0x507a('0x39')]=qs[_0x507a('0x30')](_[_0x507a('0x3a')](_0x5e5bb4[_0x507a('0x2e')],_0x5350a9[_0x507a('0x30')]),_0x267bf5);if(_0x5e5bb4['query'][_0x507a('0x3b')]){_0x3780ae[_0x507a('0x39')]=_[_0x507a('0x3c')](_0x3780ae[_0x507a('0x39')],{'$or':_[_0x507a('0x3d')](_0x267bf5,function(_0x455eaf){if(_0x455eaf[_0x507a('0x2a')]!==_0x507a('0x3e')){var _0x588d87={};_0x588d87[_0x455eaf[_0x507a('0x2d')]]={'$like':'%'+_0x5e5bb4[_0x507a('0x2e')][_0x507a('0x3b')]+'%'};return _0x588d87;}})});}_0x3780ae=_[_0x507a('0x3c')]({},_0x3780ae,_0x5e5bb4[_0x507a('0x3f')]);var _0x192378={'where':_0x3780ae[_0x507a('0x39')]};return db[_0x507a('0x27')]['count'](_0x192378)[_0x507a('0x21')](function(_0x4a4f62){_0x181feb[_0x507a('0x1b')]=_0x4a4f62;if(_0x5e5bb4[_0x507a('0x2e')][_0x507a('0x40')]){_0x3780ae[_0x507a('0x41')]=[{'all':!![]}];}return db[_0x507a('0x27')][_0x507a('0x42')](_0x3780ae);})['then'](function(_0x25beae){_0x181feb['rows']=_0x25beae;return _0x181feb;})[_0x507a('0x21')](respondWithFilteredResult(_0x180ebd,_0x3780ae))[_0x507a('0x43')](handleError(_0x180ebd,null));};exports[_0x507a('0x44')]=function(_0x3fa81d,_0x152a35){var _0x3eb5f4={'raw':!![],'where':{'id':_0x3fa81d[_0x507a('0x45')]['id']}},_0x395384={};_0x395384[_0x507a('0x2c')]=_[_0x507a('0x2f')](db['ZendeskField']['rawAttributes']);_0x395384[_0x507a('0x2e')]=_[_0x507a('0x2f')](_0x3fa81d[_0x507a('0x2e')]);_0x395384[_0x507a('0x30')]=_['intersection'](_0x395384[_0x507a('0x2c')],_0x395384[_0x507a('0x2e')]);_0x3eb5f4[_0x507a('0x33')]=_[_0x507a('0x31')](_0x395384[_0x507a('0x2c')],qs['fields'](_0x3fa81d[_0x507a('0x2e')][_0x507a('0x32')]));_0x3eb5f4[_0x507a('0x33')]=_0x3eb5f4[_0x507a('0x33')]['length']?_0x3eb5f4[_0x507a('0x33')]:_0x395384[_0x507a('0x2c')];if(_0x3fa81d[_0x507a('0x2e')][_0x507a('0x40')]){_0x3eb5f4[_0x507a('0x41')]=[{'all':!![]}];}_0x3eb5f4=_[_0x507a('0x3c')]({},_0x3eb5f4,_0x3fa81d[_0x507a('0x3f')]);return db[_0x507a('0x27')][_0x507a('0x46')](_0x3eb5f4)['then'](handleEntityNotFound(_0x152a35,null))[_0x507a('0x21')](respondWithResult(_0x152a35,null))[_0x507a('0x43')](handleError(_0x152a35,null));};exports[_0x507a('0x47')]=function(_0x3fdfc6,_0x5a0ee1){return db[_0x507a('0x27')]['create'](_0x3fdfc6[_0x507a('0x48')],{})[_0x507a('0x21')](respondWithResult(_0x5a0ee1,0xc9))['catch'](handleError(_0x5a0ee1,null));};exports['update']=function(_0x3ba341,_0xb9983){if(_0x3ba341[_0x507a('0x48')]['id']){delete _0x3ba341['body']['id'];}return db[_0x507a('0x27')]['find']({'where':{'id':_0x3ba341['params']['id']}})[_0x507a('0x21')](handleEntityNotFound(_0xb9983,null))[_0x507a('0x21')](saveUpdates(_0x3ba341[_0x507a('0x48')],null))[_0x507a('0x21')](respondWithResult(_0xb9983,null))[_0x507a('0x43')](handleError(_0xb9983,null));};exports[_0x507a('0x49')]=function(_0x2c39e9,_0x21b379){return db[_0x507a('0x27')][_0x507a('0x46')]({'where':{'id':_0x2c39e9['params']['id']}})[_0x507a('0x21')](handleEntityNotFound(_0x21b379,null))['then'](removeEntity(_0x21b379,null))['catch'](handleError(_0x21b379,null));}; \ No newline at end of file +var _0xaf80=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','includeAll','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x4a8c28,_0x2b0254){var _0x1ee153=function(_0xb8cf9e){while(--_0xb8cf9e){_0x4a8c28['push'](_0x4a8c28['shift']());}};_0x1ee153(++_0x2b0254);}(_0xaf80,0x1ef));var _0x0af8=function(_0x1d80c1,_0x15353a){_0x1d80c1=_0x1d80c1-0x0;var _0x529dd0=_0xaf80[_0x1d80c1];return _0x529dd0;};'use strict';var emlformat=require(_0x0af8('0x0'));var rimraf=require(_0x0af8('0x1'));var zipdir=require(_0x0af8('0x2'));var jsonpatch=require(_0x0af8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0af8('0x4'));var util=require(_0x0af8('0x5'));var path=require(_0x0af8('0x6'));var sox=require(_0x0af8('0x7'));var csv=require(_0x0af8('0x8'));var ejs=require(_0x0af8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0af8('0xa'));var crypto=require('crypto');var jsforce=require(_0x0af8('0xb'));var deskjs=require(_0x0af8('0xc'));var toCsv=require(_0x0af8('0x8'));var querystring=require('querystring');var Papa=require(_0x0af8('0xd'));var Redis=require(_0x0af8('0xe'));var authService=require(_0x0af8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0af8('0x10'));var logger=require(_0x0af8('0x11'))(_0x0af8('0x12'));var utils=require(_0x0af8('0x13'));var config=require(_0x0af8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0af8('0x15'))['db'];function respondWithStatusCode(_0x2d5892,_0x465135){_0x465135=_0x465135||0xcc;return function(_0x31d390){if(_0x31d390){return _0x2d5892[_0x0af8('0x16')](_0x465135);}return _0x2d5892[_0x0af8('0x17')](_0x465135)[_0x0af8('0x18')]();};}function respondWithResult(_0x58a9a8,_0x58ef18){_0x58ef18=_0x58ef18||0xc8;return function(_0x420432){if(_0x420432){return _0x58a9a8[_0x0af8('0x17')](_0x58ef18)[_0x0af8('0x19')](_0x420432);}};}function respondWithFilteredResult(_0x216f0b,_0x2a42a4){return function(_0x1997b8){if(_0x1997b8){var _0x4755cb=typeof _0x2a42a4[_0x0af8('0x1a')]==='undefined'&&typeof _0x2a42a4['limit']==='undefined';var _0x3294ce=_0x1997b8[_0x0af8('0x1b')];var _0x54e946=_0x4755cb?0x0:_0x2a42a4[_0x0af8('0x1a')];var _0x230a68=_0x4755cb?_0x1997b8[_0x0af8('0x1b')]:_0x2a42a4['offset']+_0x2a42a4['limit'];var _0x50b8fa;if(_0x230a68>=_0x3294ce){_0x230a68=_0x3294ce;_0x50b8fa=0xc8;}else{_0x50b8fa=0xce;}_0x216f0b[_0x0af8('0x17')](_0x50b8fa);return _0x216f0b[_0x0af8('0x1c')]('Content-Range',_0x54e946+'-'+_0x230a68+'/'+_0x3294ce)[_0x0af8('0x19')](_0x1997b8);}return null;};}function patchUpdates(_0x4891e6){return function(_0x5cbf28){try{jsonpatch[_0x0af8('0x1d')](_0x5cbf28,_0x4891e6,!![]);}catch(_0x2e0b36){return BPromise[_0x0af8('0x1e')](_0x2e0b36);}return _0x5cbf28[_0x0af8('0x1f')]();};}function saveUpdates(_0x162e95,_0x52778f){return function(_0x592523){if(_0x592523){return _0x592523[_0x0af8('0x20')](_0x162e95)[_0x0af8('0x21')](function(_0x4b0492){return _0x4b0492;});}return null;};}function removeEntity(_0x300474,_0x320d0c){return function(_0x404b25){if(_0x404b25){return _0x404b25[_0x0af8('0x22')]()[_0x0af8('0x21')](function(){_0x300474['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6306,_0x3b2a80){return function(_0x359583){if(!_0x359583){_0x1c6306[_0x0af8('0x16')](0x194);}return _0x359583;};}function handleError(_0x510efc,_0x500fd5){_0x500fd5=_0x500fd5||0x1f4;return function(_0x315ad){logger[_0x0af8('0x23')](_0x315ad[_0x0af8('0x24')]);if(_0x315ad[_0x0af8('0x25')]){delete _0x315ad[_0x0af8('0x25')];}_0x510efc[_0x0af8('0x17')](_0x500fd5)[_0x0af8('0x26')](_0x315ad);};}exports['index']=function(_0x34aa8b,_0xf898cc){var _0x1a7fdf={},_0x20eab4={},_0x1b94cf={'count':0x0,'rows':[]};var _0x231230=_[_0x0af8('0x27')](db[_0x0af8('0x28')][_0x0af8('0x29')],function(_0x270b49){return{'name':_0x270b49[_0x0af8('0x2a')],'type':_0x270b49['type'][_0x0af8('0x2b')]};});_0x20eab4['model']=_[_0x0af8('0x27')](_0x231230,'name');_0x20eab4[_0x0af8('0x2c')]=_[_0x0af8('0x2d')](_0x34aa8b['query']);_0x20eab4[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],_0x20eab4['query']);_0x1a7fdf[_0x0af8('0x31')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],qs['fields'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x32')]));_0x1a7fdf[_0x0af8('0x31')]=_0x1a7fdf[_0x0af8('0x31')][_0x0af8('0x33')]?_0x1a7fdf[_0x0af8('0x31')]:_0x20eab4['model'];if(!_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x34')](_0x0af8('0x35'))){_0x1a7fdf[_0x0af8('0x36')]=qs[_0x0af8('0x36')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x36')]);_0x1a7fdf[_0x0af8('0x1a')]=qs[_0x0af8('0x1a')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x1a')]);}_0x1a7fdf[_0x0af8('0x37')]=qs['sort'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x38')]);_0x1a7fdf[_0x0af8('0x39')]=qs[_0x0af8('0x2e')](_[_0x0af8('0x3a')](_0x34aa8b[_0x0af8('0x2c')],_0x20eab4[_0x0af8('0x2e')]),_0x231230);if(_0x34aa8b['query'][_0x0af8('0x3b')]){_0x1a7fdf[_0x0af8('0x39')]=_[_0x0af8('0x3c')](_0x1a7fdf['where'],{'$or':_[_0x0af8('0x27')](_0x231230,function(_0x1082de){if(_0x1082de[_0x0af8('0x3d')]!=='VIRTUAL'){var _0x6781fe={};_0x6781fe[_0x1082de[_0x0af8('0x25')]]={'$like':'%'+_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x3b')]+'%'};return _0x6781fe;}})});}_0x1a7fdf=_[_0x0af8('0x3c')]({},_0x1a7fdf,_0x34aa8b[_0x0af8('0x3e')]);var _0x258872={'where':_0x1a7fdf['where']};return db['ZendeskField'][_0x0af8('0x1b')](_0x258872)[_0x0af8('0x21')](function(_0x5bc8f5){_0x1b94cf[_0x0af8('0x1b')]=_0x5bc8f5;if(_0x34aa8b[_0x0af8('0x2c')]['includeAll']){_0x1a7fdf[_0x0af8('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0x0af8('0x40')](_0x1a7fdf);})[_0x0af8('0x21')](function(_0x510bec){_0x1b94cf[_0x0af8('0x41')]=_0x510bec;return _0x1b94cf;})[_0x0af8('0x21')](respondWithFilteredResult(_0xf898cc,_0x1a7fdf))['catch'](handleError(_0xf898cc,null));};exports[_0x0af8('0x42')]=function(_0x496ea4,_0x2e15ec){var _0x423eee={'raw':!![],'where':{'id':_0x496ea4['params']['id']}},_0x141d2f={};_0x141d2f['model']=_[_0x0af8('0x2d')](db[_0x0af8('0x28')][_0x0af8('0x29')]);_0x141d2f[_0x0af8('0x2c')]=_['keys'](_0x496ea4[_0x0af8('0x2c')]);_0x141d2f[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x141d2f['model'],_0x141d2f[_0x0af8('0x2c')]);_0x423eee[_0x0af8('0x31')]=_['intersection'](_0x141d2f[_0x0af8('0x30')],qs['fields'](_0x496ea4[_0x0af8('0x2c')]['fields']));_0x423eee['attributes']=_0x423eee['attributes'][_0x0af8('0x33')]?_0x423eee['attributes']:_0x141d2f[_0x0af8('0x30')];if(_0x496ea4['query'][_0x0af8('0x43')]){_0x423eee[_0x0af8('0x3f')]=[{'all':!![]}];}_0x423eee=_[_0x0af8('0x3c')]({},_0x423eee,_0x496ea4[_0x0af8('0x3e')]);return db[_0x0af8('0x28')]['find'](_0x423eee)['then'](handleEntityNotFound(_0x2e15ec,null))[_0x0af8('0x21')](respondWithResult(_0x2e15ec,null))[_0x0af8('0x44')](handleError(_0x2e15ec,null));};exports[_0x0af8('0x45')]=function(_0x24a104,_0x3d86e2){return db[_0x0af8('0x28')][_0x0af8('0x45')](_0x24a104['body'],{})['then'](respondWithResult(_0x3d86e2,0xc9))[_0x0af8('0x44')](handleError(_0x3d86e2,null));};exports[_0x0af8('0x20')]=function(_0x394525,_0x3c57dd){if(_0x394525['body']['id']){delete _0x394525[_0x0af8('0x46')]['id'];}return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x394525[_0x0af8('0x48')]['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0x3c57dd,null))[_0x0af8('0x21')](saveUpdates(_0x394525['body'],null))[_0x0af8('0x21')](respondWithResult(_0x3c57dd,null))['catch'](handleError(_0x3c57dd,null));};exports[_0x0af8('0x22')]=function(_0x4a43e3,_0xeddce9){return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x4a43e3['params']['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0xeddce9,null))[_0x0af8('0x21')](removeEntity(_0xeddce9,null))['catch'](handleError(_0xeddce9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index bdf642a..34095b5 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 _0x7692=['zendesk_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7692,0xce));var _0x2769=function(_0x486a95,_0x18bed7){_0x486a95=_0x486a95-0x0;var _0x1cc0ec=_0x7692[_0x486a95];return _0x1cc0ec;};'use strict';var _=require(_0x2769('0x0'));var util=require(_0x2769('0x1'));var logger=require(_0x2769('0x2'))('api');var moment=require(_0x2769('0x3'));var BPromise=require(_0x2769('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2769('0x5'));var rimraf=require(_0x2769('0x6'));var config=require(_0x2769('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x2769('0x8')]=function(_0x3f2a54,_0x34192a){return _0x3f2a54[_0x2769('0x9')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x2769('0xa'),'fields':[_0x2769('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd91f=['define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports'];(function(_0xa7a66b,_0x59a98f){var _0x1fd05a=function(_0x1ca86d){while(--_0x1ca86d){_0xa7a66b['push'](_0xa7a66b['shift']());}};_0x1fd05a(++_0x59a98f);}(_0xd91f,0x75));var _0xfd91=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0xd91f[_0xe719ec];return _0x4842a1;};'use strict';var _=require(_0xfd91('0x0'));var util=require('util');var logger=require(_0xfd91('0x1'))('api');var moment=require(_0xfd91('0x2'));var BPromise=require('bluebird');var rp=require(_0xfd91('0x3'));var fs=require('fs');var path=require(_0xfd91('0x4'));var rimraf=require(_0xfd91('0x5'));var config=require(_0xfd91('0x6'));var attributes=require(_0xfd91('0x7'));module[_0xfd91('0x8')]=function(_0x59b918,_0x3405c6){return _0x59b918[_0xfd91('0x9')](_0xfd91('0xa'),attributes,{'tableName':_0xfd91('0xb'),'paranoid':![],'indexes':[{'name':_0xfd91('0xc'),'fields':['idField',_0xfd91('0xd')],'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 b7549cf..d42789c 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 _0xa8a5=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch'];(function(_0x35dfca,_0x385d9e){var _0x60b0d9=function(_0x262edd){while(--_0x262edd){_0x35dfca['push'](_0x35dfca['shift']());}};_0x60b0d9(++_0x385d9e);}(_0xa8a5,0x1e3));var _0x5a8a=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xa8a5[_0x35b18a];return _0x4db1bd;};'use strict';var _=require(_0x5a8a('0x0'));var util=require(_0x5a8a('0x1'));var moment=require(_0x5a8a('0x2'));var BPromise=require(_0x5a8a('0x3'));var rs=require(_0x5a8a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a8a('0x5'))['db'];var utils=require(_0x5a8a('0x6'));var logger=require(_0x5a8a('0x7'))('rpc');var config=require(_0x5a8a('0x8'));var jayson=require(_0x5a8a('0x9'));var client=jayson[_0x5a8a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45b71a,_0x15ea12,_0x2c8aac){return new BPromise(function(_0x266c48,_0x2ef5d9){return client['request'](_0x45b71a,_0x2c8aac)[_0x5a8a('0xb')](function(_0x13c3c7){logger[_0x5a8a('0xc')]('ZendeskField,\x20%s,\x20%s',_0x15ea12,_0x5a8a('0xd'));logger['debug'](_0x5a8a('0xe'),_0x15ea12,_0x5a8a('0xd'),JSON['stringify'](_0x13c3c7));if(_0x13c3c7['error']){if(_0x13c3c7[_0x5a8a('0xf')][_0x5a8a('0x10')]===0x1f4){logger[_0x5a8a('0xf')](_0x5a8a('0x11'),_0x15ea12,_0x13c3c7[_0x5a8a('0xf')][_0x5a8a('0x12')]);return _0x2ef5d9(_0x13c3c7[_0x5a8a('0xf')]['message']);}logger[_0x5a8a('0xf')](_0x5a8a('0x11'),_0x15ea12,_0x13c3c7[_0x5a8a('0xf')][_0x5a8a('0x12')]);return _0x266c48(_0x13c3c7[_0x5a8a('0xf')][_0x5a8a('0x12')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x15ea12,_0x5a8a('0xd'));_0x266c48(_0x13c3c7[_0x5a8a('0x13')][_0x5a8a('0x12')]);}})[_0x5a8a('0x14')](function(_0x38a1bc){logger['error'](_0x5a8a('0x11'),_0x15ea12,_0x38a1bc);_0x2ef5d9(_0x38a1bc);});});} \ No newline at end of file +var _0x2e1f=['debug','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2e1f,0xee));var _0xf2e1=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x2e1f[_0x264545];return _0x114d10;};'use strict';var _=require(_0xf2e1('0x0'));var util=require(_0xf2e1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf2e1('0x2'));var fs=require('fs');var Redis=require(_0xf2e1('0x3'));var db=require(_0xf2e1('0x4'))['db'];var utils=require(_0xf2e1('0x5'));var logger=require(_0xf2e1('0x6'))(_0xf2e1('0x7'));var config=require(_0xf2e1('0x8'));var jayson=require(_0xf2e1('0x9'));var client=jayson['client'][_0xf2e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a282d,_0x501770,_0x212373){return new BPromise(function(_0x594e24,_0x162f0f){return client[_0xf2e1('0xb')](_0x3a282d,_0x212373)['then'](function(_0x1cb8c5){logger[_0xf2e1('0xc')]('ZendeskField,\x20%s,\x20%s',_0x501770,_0xf2e1('0xd'));logger[_0xf2e1('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x501770,'request\x20sent',JSON[_0xf2e1('0xf')](_0x1cb8c5));if(_0x1cb8c5[_0xf2e1('0x10')]){if(_0x1cb8c5[_0xf2e1('0x10')][_0xf2e1('0x11')]===0x1f4){logger[_0xf2e1('0x10')](_0xf2e1('0x12'),_0x501770,_0x1cb8c5[_0xf2e1('0x10')][_0xf2e1('0x13')]);return _0x162f0f(_0x1cb8c5[_0xf2e1('0x10')][_0xf2e1('0x13')]);}logger[_0xf2e1('0x10')](_0xf2e1('0x12'),_0x501770,_0x1cb8c5[_0xf2e1('0x10')][_0xf2e1('0x13')]);return _0x594e24(_0x1cb8c5[_0xf2e1('0x10')][_0xf2e1('0x13')]);}else{logger[_0xf2e1('0xc')](_0xf2e1('0x12'),_0x501770,_0xf2e1('0xd'));_0x594e24(_0x1cb8c5['result'][_0xf2e1('0x13')]);}})[_0xf2e1('0x14')](function(_0x5facc3){logger['error'](_0xf2e1('0x12'),_0x501770,_0x5facc3);_0x162f0f(_0x5facc3);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 5fec452..8944577 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 _0x5502=['fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3c34a6,_0x1446b5){var _0x42e1ea=function(_0x2257df){while(--_0x2257df){_0x3c34a6['push'](_0x3c34a6['shift']());}};_0x42e1ea(++_0x1446b5);}(_0x5502,0x10b));var _0x2550=function(_0x58d6f1,_0x1c3944){_0x58d6f1=_0x58d6f1-0x0;var _0x269bbe=_0x5502[_0x58d6f1];return _0x269bbe;};'use strict';var multer=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var path=require(_0x2550('0x2'));var timeout=require(_0x2550('0x3'));var express=require(_0x2550('0x4'));var router=express[_0x2550('0x5')]();var fs_extra=require(_0x2550('0x6'));var auth=require(_0x2550('0x7'));var interaction=require(_0x2550('0x8'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x2550('0x9')]('/',auth['isAuthenticated'](),controller[_0x2550('0xa')]);router[_0x2550('0x9')](_0x2550('0xb'),auth[_0x2550('0xc')](),controller[_0x2550('0xd')]);router[_0x2550('0x9')]('/:id/configurations',auth[_0x2550('0xc')](),controller[_0x2550('0xe')]);router['get'](_0x2550('0xf'),auth[_0x2550('0xc')](),controller[_0x2550('0x10')]);router['post']('/',auth[_0x2550('0xc')](),controller['create']);router['post']('/:id/configurations',auth[_0x2550('0xc')](),controller['addConfiguration']);router['put']('/:id',auth[_0x2550('0xc')](),controller[_0x2550('0x11')]);router[_0x2550('0x12')](_0x2550('0xb'),auth[_0x2550('0xc')](),controller[_0x2550('0x13')]);module[_0x2550('0x14')]=router; \ No newline at end of file +var _0xa338=['put','update','delete','exports','express','Router','fs-extra','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0xa338,0xa6));var _0x8a33=function(_0x5483c3,_0x418d8d){_0x5483c3=_0x5483c3-0x0;var _0x19ef72=_0xa338[_0x5483c3];return _0x19ef72;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8a33('0x0'));var router=express[_0x8a33('0x1')]();var fs_extra=require(_0x8a33('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8a33('0x3'));var config=require('../../config/environment');var controller=require(_0x8a33('0x4'));router['get']('/',auth[_0x8a33('0x5')](),controller['index']);router['get'](_0x8a33('0x6'),auth[_0x8a33('0x5')](),controller[_0x8a33('0x7')]);router[_0x8a33('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8a33('0x9')]);router[_0x8a33('0x8')](_0x8a33('0xa'),auth['isAuthenticated'](),controller[_0x8a33('0xb')]);router['post']('/',auth[_0x8a33('0x5')](),controller['create']);router[_0x8a33('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8a33('0xd')]);router[_0x8a33('0xe')](_0x8a33('0x6'),auth[_0x8a33('0x5')](),controller[_0x8a33('0xf')]);router[_0x8a33('0x10')](_0x8a33('0x6'),auth[_0x8a33('0x5')](),controller['destroy']);module[_0x8a33('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 3b1fa80..e3eff40 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 _0xe5b3=['STRING','exports'];(function(_0x5611fb,_0x5b37f6){var _0xb39a3d=function(_0x3eaa11){while(--_0x3eaa11){_0x5611fb['push'](_0x5611fb['shift']());}};_0xb39a3d(++_0x5b37f6);}(_0xe5b3,0x133));var _0x3e5b=function(_0x338762,_0xb7cad2){_0x338762=_0x338762-0x0;var _0x529283=_0xe5b3[_0x338762];return _0x529283;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file +var _0x4522=['STRING'];(function(_0x20fa11,_0x48b0ca){var _0x2759c1=function(_0x45ac84){while(--_0x45ac84){_0x20fa11['push'](_0x20fa11['shift']());}};_0x2759c1(++_0x48b0ca);}(_0x4522,0x1a0));var _0x2452=function(_0x1feb85,_0x64e1fb){_0x1feb85=_0x1feb85-0x0;var _0x4487c2=_0x4522[_0x1feb85];return _0x4487c2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a13b44a..6849010 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 _0x0231=['Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','length','find','create','body','getConfigurations','pick','hasOwnProperty','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','refreshToken','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time'];(function(_0x5b5781,_0x1f8aae){var _0x21f9be=function(_0x3fed7d){while(--_0x3fed7d){_0x5b5781['push'](_0x5b5781['shift']());}};_0x21f9be(++_0x1f8aae);}(_0x0231,0x107));var _0x1023=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0231[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x1023('0x0'));var rimraf=require(_0x1023('0x1'));var zipdir=require(_0x1023('0x2'));var jsonpatch=require(_0x1023('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1023('0x4'));var Mustache=require(_0x1023('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1023('0x6'));var csv=require(_0x1023('0x7'));var ejs=require(_0x1023('0x8'));var fs=require('fs');var fs_extra=require(_0x1023('0x9'));var _=require(_0x1023('0xa'));var squel=require('squel');var crypto=require(_0x1023('0xb'));var jsforce=require(_0x1023('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1023('0x7'));var querystring=require(_0x1023('0xd'));var Papa=require(_0x1023('0xe'));var Redis=require(_0x1023('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1023('0x10'));var logger=require(_0x1023('0x11'))(_0x1023('0x12'));var utils=require(_0x1023('0x13'));var config=require(_0x1023('0x14'));var licenseUtil=require(_0x1023('0x15'));var db=require(_0x1023('0x16'))['db'];var integrations=require(_0x1023('0x17'));function respondWithStatusCode(_0x8d1c1e,_0x67bf93){_0x67bf93=_0x67bf93||0xcc;return function(_0x3ecdb2){if(_0x3ecdb2){return _0x8d1c1e[_0x1023('0x18')](_0x67bf93);}return _0x8d1c1e[_0x1023('0x19')](_0x67bf93)[_0x1023('0x1a')]();};}function respondWithResult(_0x17cca8,_0x40f71e){_0x40f71e=_0x40f71e||0xc8;return function(_0x20f4c8){if(_0x20f4c8){return _0x17cca8['status'](_0x40f71e)['json'](_0x20f4c8);}};}function respondWithFilteredResult(_0xc6a6bf,_0x4f6904){return function(_0x4af0aa){if(_0x4af0aa){var _0x2f1691=typeof _0x4f6904[_0x1023('0x1b')]===_0x1023('0x1c')&&typeof _0x4f6904[_0x1023('0x1d')]===_0x1023('0x1c');var _0x98200a=_0x4af0aa[_0x1023('0x1e')];var _0x177bef=_0x2f1691?0x0:_0x4f6904[_0x1023('0x1b')];var _0x3302e=_0x2f1691?_0x4af0aa[_0x1023('0x1e')]:_0x4f6904[_0x1023('0x1b')]+_0x4f6904[_0x1023('0x1d')];var _0x55dea5;if(_0x3302e>=_0x98200a){_0x3302e=_0x98200a;_0x55dea5=0xc8;}else{_0x55dea5=0xce;}_0xc6a6bf[_0x1023('0x19')](_0x55dea5);return _0xc6a6bf[_0x1023('0x1f')](_0x1023('0x20'),_0x177bef+'-'+_0x3302e+'/'+_0x98200a)[_0x1023('0x21')](_0x4af0aa);}return null;};}function patchUpdates(_0x46e44d){return function(_0x8f8ec5){try{jsonpatch['apply'](_0x8f8ec5,_0x46e44d,!![]);}catch(_0x117c21){return BPromise[_0x1023('0x22')](_0x117c21);}return _0x8f8ec5[_0x1023('0x23')]();};}function saveUpdates(_0x341212,_0x1b6291){return function(_0x5c0911){if(_0x5c0911){return _0x5c0911[_0x1023('0x24')](_0x341212)[_0x1023('0x25')](function(_0x3e5402){return _0x3e5402;});}return null;};}function removeEntity(_0x30c56f,_0x489c3a){return function(_0x3f241f){if(_0x3f241f){return _0x3f241f[_0x1023('0x26')]()[_0x1023('0x25')](function(){_0x30c56f[_0x1023('0x19')](0xcc)[_0x1023('0x1a')]();});}};}function handleEntityNotFound(_0x4a04ca,_0x56d5d1){return function(_0x2651aa){if(!_0x2651aa){_0x4a04ca[_0x1023('0x18')](0x194);}return _0x2651aa;};}function handleError(_0x39c928,_0x5ee410){_0x5ee410=_0x5ee410||0x1f4;return function(_0x6b435){logger[_0x1023('0x27')](_0x6b435[_0x1023('0x28')]);if(_0x6b435[_0x1023('0x29')]){delete _0x6b435[_0x1023('0x29')];}_0x39c928['status'](_0x5ee410)[_0x1023('0x2a')](_0x6b435);};}exports[_0x1023('0x2b')]=function(_0x443c62,_0x6cf399){var _0x1c155c={},_0x5bbad9={},_0x2f9950={'count':0x0,'rows':[]};var _0x2f781e=_[_0x1023('0x2c')](db[_0x1023('0x2d')][_0x1023('0x2e')],function(_0x4b7956){return{'name':_0x4b7956['fieldName'],'type':_0x4b7956[_0x1023('0x2f')][_0x1023('0x30')]};});_0x5bbad9['model']=_[_0x1023('0x2c')](_0x2f781e,_0x1023('0x29'));_0x5bbad9['query']=_[_0x1023('0x31')](_0x443c62[_0x1023('0x32')]);_0x5bbad9[_0x1023('0x33')]=_[_0x1023('0x34')](_0x5bbad9[_0x1023('0x35')],_0x5bbad9[_0x1023('0x32')]);_0x1c155c[_0x1023('0x36')]=_[_0x1023('0x34')](_0x5bbad9[_0x1023('0x35')],qs[_0x1023('0x37')](_0x443c62[_0x1023('0x32')][_0x1023('0x37')]));_0x1c155c[_0x1023('0x36')]=_0x1c155c['attributes']['length']?_0x1c155c[_0x1023('0x36')]:_0x5bbad9[_0x1023('0x35')];if(!_0x443c62[_0x1023('0x32')]['hasOwnProperty'](_0x1023('0x38'))){_0x1c155c[_0x1023('0x1d')]=qs['limit'](_0x443c62[_0x1023('0x32')][_0x1023('0x1d')]);_0x1c155c[_0x1023('0x1b')]=qs[_0x1023('0x1b')](_0x443c62[_0x1023('0x32')][_0x1023('0x1b')]);}_0x1c155c[_0x1023('0x39')]=qs[_0x1023('0x3a')](_0x443c62[_0x1023('0x32')]['sort']);_0x1c155c[_0x1023('0x3b')]=qs[_0x1023('0x33')](_['pick'](_0x443c62[_0x1023('0x32')],_0x5bbad9[_0x1023('0x33')]),_0x2f781e);if(_0x443c62['query']['filter']){_0x1c155c[_0x1023('0x3b')]=_[_0x1023('0x3c')](_0x1c155c[_0x1023('0x3b')],{'$or':_['map'](_0x2f781e,function(_0x393957){if(_0x393957[_0x1023('0x2f')]!==_0x1023('0x3d')){var _0x5db4e0={};_0x5db4e0[_0x393957[_0x1023('0x29')]]={'$like':'%'+_0x443c62[_0x1023('0x32')][_0x1023('0x3e')]+'%'};return _0x5db4e0;}})});}_0x1c155c=_[_0x1023('0x3c')]({},_0x1c155c,_0x443c62[_0x1023('0x3f')]);var _0x29a907={'where':_0x1c155c[_0x1023('0x3b')]};return db[_0x1023('0x2d')][_0x1023('0x1e')](_0x29a907)[_0x1023('0x25')](function(_0x123051){_0x2f9950['count']=_0x123051;if(_0x443c62[_0x1023('0x32')][_0x1023('0x40')]){_0x1c155c[_0x1023('0x41')]=[{'all':!![]}];}return db[_0x1023('0x2d')]['findAll'](_0x1c155c);})[_0x1023('0x25')](function(_0x565551){_0x2f9950[_0x1023('0x42')]=_0x565551;return _0x2f9950;})[_0x1023('0x25')](respondWithFilteredResult(_0x6cf399,_0x1c155c))[_0x1023('0x43')](handleError(_0x6cf399,null));};exports['show']=function(_0x256ba1,_0x19ae9d){var _0x586990={'raw':![],'where':{'id':_0x256ba1[_0x1023('0x44')]['id']}},_0x5c3ccf={};_0x5c3ccf[_0x1023('0x35')]=_[_0x1023('0x31')](db['ZohoAccount'][_0x1023('0x2e')]);_0x5c3ccf['query']=_[_0x1023('0x31')](_0x256ba1[_0x1023('0x32')]);_0x5c3ccf[_0x1023('0x33')]=_[_0x1023('0x34')](_0x5c3ccf[_0x1023('0x35')],_0x5c3ccf[_0x1023('0x32')]);_0x586990[_0x1023('0x36')]=_[_0x1023('0x34')](_0x5c3ccf[_0x1023('0x35')],qs['fields'](_0x256ba1[_0x1023('0x32')][_0x1023('0x37')]));_0x586990[_0x1023('0x36')]=_0x586990[_0x1023('0x36')][_0x1023('0x45')]?_0x586990['attributes']:_0x5c3ccf[_0x1023('0x35')];if(_0x256ba1[_0x1023('0x32')][_0x1023('0x40')]){_0x586990[_0x1023('0x41')]=[{'all':!![]}];}_0x586990=_[_0x1023('0x3c')]({},_0x586990,_0x256ba1[_0x1023('0x3f')]);return db[_0x1023('0x2d')][_0x1023('0x46')](_0x586990)['then'](handleEntityNotFound(_0x19ae9d,null))[_0x1023('0x25')](respondWithResult(_0x19ae9d,null))[_0x1023('0x43')](handleError(_0x19ae9d,null));};exports[_0x1023('0x47')]=function(_0x3c7a74,_0x3572b7){return db[_0x1023('0x2d')]['create'](_0x3c7a74['body'],{})[_0x1023('0x25')](respondWithResult(_0x3572b7,0xc9))[_0x1023('0x43')](handleError(_0x3572b7,null));};exports[_0x1023('0x24')]=function(_0x5224d5,_0xd55bcd){if(_0x5224d5[_0x1023('0x48')]['id']){delete _0x5224d5['body']['id'];}return db['ZohoAccount'][_0x1023('0x46')]({'where':{'id':_0x5224d5['params']['id']}})[_0x1023('0x25')](handleEntityNotFound(_0xd55bcd,null))['then'](saveUpdates(_0x5224d5[_0x1023('0x48')],null))[_0x1023('0x25')](respondWithResult(_0xd55bcd,null))[_0x1023('0x43')](handleError(_0xd55bcd,null));};exports[_0x1023('0x26')]=function(_0x3b0ebe,_0xc14917){return db['ZohoAccount']['find']({'where':{'id':_0x3b0ebe[_0x1023('0x44')]['id']}})[_0x1023('0x25')](handleEntityNotFound(_0xc14917,null))[_0x1023('0x25')](removeEntity(_0xc14917,null))[_0x1023('0x43')](handleError(_0xc14917,null));};exports[_0x1023('0x49')]=function(_0x1b5c60,_0x5d87ef,_0x5a9986){var _0x583fa2={};var _0x68b1e6={};var _0x45448b;var _0x189e52;return db[_0x1023('0x2d')]['findOne']({'where':{'id':_0x1b5c60[_0x1023('0x44')]['id']}})[_0x1023('0x25')](handleEntityNotFound(_0x5d87ef,null))['then'](function(_0xa848a6){if(_0xa848a6){_0x45448b=_0xa848a6;_0x68b1e6['model']=_[_0x1023('0x31')](db['ZohoConfiguration'][_0x1023('0x2e')]);_0x68b1e6[_0x1023('0x32')]=_[_0x1023('0x31')](_0x1b5c60[_0x1023('0x32')]);_0x68b1e6[_0x1023('0x33')]=_['intersection'](_0x68b1e6[_0x1023('0x35')],_0x68b1e6[_0x1023('0x32')]);_0x583fa2[_0x1023('0x36')]=_[_0x1023('0x34')](_0x68b1e6[_0x1023('0x35')],qs[_0x1023('0x37')](_0x1b5c60[_0x1023('0x32')][_0x1023('0x37')]));_0x583fa2[_0x1023('0x36')]=_0x583fa2[_0x1023('0x36')][_0x1023('0x45')]?_0x583fa2[_0x1023('0x36')]:_0x68b1e6[_0x1023('0x35')];_0x583fa2[_0x1023('0x39')]=qs[_0x1023('0x3a')](_0x1b5c60[_0x1023('0x32')][_0x1023('0x3a')]);_0x583fa2[_0x1023('0x3b')]=qs[_0x1023('0x33')](_[_0x1023('0x4a')](_0x1b5c60[_0x1023('0x32')],_0x68b1e6[_0x1023('0x33')]));if(_0x1b5c60['query'][_0x1023('0x3e')]){_0x583fa2[_0x1023('0x3b')]=_[_0x1023('0x3c')](_0x583fa2[_0x1023('0x3b')],{'$or':_[_0x1023('0x2c')](_0x583fa2[_0x1023('0x36')],function(_0x48cc85){var _0x2150db={};_0x2150db[_0x48cc85]={'$like':'%'+_0x1b5c60[_0x1023('0x32')]['filter']+'%'};return _0x2150db;})});}_0x583fa2=_['merge']({},_0x583fa2,_0x1b5c60[_0x1023('0x3f')]);return _0x45448b[_0x1023('0x49')](_0x583fa2);}})[_0x1023('0x25')](function(_0x2dc922){if(_0x2dc922){_0x189e52=_0x2dc922[_0x1023('0x45')];if(!_0x1b5c60[_0x1023('0x32')][_0x1023('0x4b')]('nolimit')){_0x583fa2[_0x1023('0x1d')]=qs[_0x1023('0x1d')](_0x1b5c60['query'][_0x1023('0x1d')]);_0x583fa2[_0x1023('0x1b')]=qs[_0x1023('0x1b')](_0x1b5c60[_0x1023('0x32')][_0x1023('0x1b')]);}return _0x45448b[_0x1023('0x49')](_0x583fa2);}})[_0x1023('0x25')](function(_0x42187c){if(_0x42187c){return _0x42187c?{'count':_0x189e52,'rows':_0x42187c}:null;}})['then'](respondWithResult(_0x5d87ef,null))['catch'](handleError(_0x5d87ef,null));};exports[_0x1023('0x4c')]=function(_0x54b39b,_0x35721a,_0x5b633d){if(_0x54b39b[_0x1023('0x48')]['id']){delete _0x54b39b['body']['id'];}return db[_0x1023('0x2d')][_0x1023('0x4d')]({'where':{'id':_0x54b39b[_0x1023('0x44')]['id']}})[_0x1023('0x25')](handleEntityNotFound(_0x35721a,null))[_0x1023('0x25')](function(_0x5e1dee){if(_0x5e1dee){_0x54b39b['body']['AccountId']=_0x5e1dee['id'];_0x54b39b['body']['Subjects']=integrations[_0x1023('0x4e')](_0x54b39b[_0x1023('0x48')][_0x1023('0x4f')],_0x54b39b[_0x1023('0x48')][_0x1023('0x2f')]);_0x54b39b[_0x1023('0x48')][_0x1023('0x50')]=integrations[_0x1023('0x51')](_0x54b39b[_0x1023('0x48')]['channel'],_0x54b39b[_0x1023('0x48')]['type']);return db[_0x1023('0x52')][_0x1023('0x47')](_0x54b39b[_0x1023('0x48')],{'include':[{'model':db[_0x1023('0x53')],'as':_0x1023('0x54')},{'model':db[_0x1023('0x53')],'as':'Descriptions'}]});}return null;})[_0x1023('0x25')](respondWithResult(_0x35721a,null))[_0x1023('0x43')](handleError(_0x35721a,null));};function getAccessToken(_0x594789){return new Promise(function(_0x296967,_0x1be1d4){var _0x567785;switch(_0x594789['zone']){case'US':_0x567785=_0x1023('0x55');break;case'AU':_0x567785='https://accounts.zoho.com.au';break;case'EU':_0x567785='https://accounts.zoho.eu';break;case'IN':_0x567785='https://accounts.zoho.in';break;case'CN':_0x567785='https://accounts.zoho.com.cn';break;default:_0x567785=_0x1023('0x56');break;}var _0x334297={'method':'POST','uri':_0x567785+_0x1023('0x57'),'qs':{'refresh_token':_0x594789['refreshToken'],'client_id':_0x594789['clientId'],'client_secret':_0x594789[_0x1023('0x58')],'grant_type':_0x1023('0x59')},'json':!![]};return rp(_0x334297)[_0x1023('0x25')](function(_0x4fabfe){if(_0x4fabfe[_0x1023('0x5a')]){_0x296967(_0x4fabfe[_0x1023('0x5a')]);}else{_0x1be1d4(_0x1023('0x5b'));}})[_0x1023('0x43')](function(_0x3c0ed5){_0x1be1d4(_0x3c0ed5);});});}exports[_0x1023('0x5c')]=function(_0x1948d5,_0x5001bb,_0x4713d7){var _0x199958,_0x2e7855,_0x4da83f,_0x4591a2,_0x5b32f9;return db[_0x1023('0x2d')][_0x1023('0x4d')]({'where':{'id':_0x1948d5[_0x1023('0x44')]['id']},'attributes':['id',_0x1023('0x5d'),'zone',_0x1023('0x5e'),_0x1023('0x58'),_0x1023('0x5f'),'code',_0x1023('0x60')]})[_0x1023('0x25')](handleEntityNotFound(_0x5001bb,null))[_0x1023('0x25')](function(_0x44e6c6){_0x5b32f9=_0x44e6c6;_0x199958=_0x5b32f9['host'];_0x2e7855=_0x199958==='zoho.eu'?'eu':_0x1023('0x61');_0x4da83f=_0x5b32f9[_0x1023('0x5f')];var _0x4a63f9=_0x4da83f[_0x1023('0x62')](-0x1);if(_0x4a63f9==='/'||_0x4a63f9==='\x5c'||_0x4a63f9===':'){_0x4da83f=_0x4da83f[_0x1023('0x63')](0x0,_0x4da83f[_0x1023('0x64')](_0x4a63f9));}if(!_0x5b32f9[_0x1023('0x60')]){throw new Error(_0x1023('0x65'));}return getAccessToken(_0x5b32f9);})[_0x1023('0x25')](function(_0x95bd0b){if(_0x95bd0b){return rp({'method':_0x1023('0x66'),'uri':util['format'](_0x1023('0x67'),_0x2e7855),'qs':{'module':_0x1023('0x68')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x95bd0b},'json':!![]});}})[_0x1023('0x25')](function(_0x153695){if(_0x153695){if(_0x153695[_0x1023('0x69')]&&_0x153695[_0x1023('0x69')][_0x1023('0x27')]){throw new Error(_0x153695['response']['error'][_0x1023('0x6a')]);}var _0x18c7d3=[];var _0x1a2b0=[];var _0x359b4c=['Owner','Subject',_0x1023('0x6b'),_0x1023('0x6c'),_0x1023('0x6d'),_0x1023('0x6e'),_0x1023('0x6f'),_0x1023('0x70')];_0x1a2b0=_[_0x1023('0x71')](_0x153695[_0x1023('0x37')],function(_0x126fd4){return _0x359b4c[_0x1023('0x72')](_0x126fd4[_0x1023('0x73')]);});for(var _0x534e8e=0x0;_0x534e8e<_0x1a2b0['length'];_0x534e8e++){if(_0x1a2b0[_0x534e8e][_0x1023('0x74')]===![]){_0x18c7d3[_0x1023('0x75')]({'id':_0x1a2b0[_0x534e8e]['id'],'name':_0x1a2b0[_0x534e8e][_0x1023('0x76')],'custom':_0x1a2b0[_0x534e8e][_0x1023('0x77')],'options':_0x1a2b0[_0x534e8e]['data_type']==='picklist'&&_0x1a2b0[_0x534e8e][_0x1023('0x78')][_0x1023('0x45')]>-0x1?_[_0x1023('0x2c')](_0x1a2b0[_0x534e8e][_0x1023('0x78')],function(_0x30163e){return{'name':_0x30163e,'value':_0x30163e};}):[]});}}return{'count':_0x18c7d3[_0x1023('0x45')],'rows':_0x18c7d3};}else{return{'count':0x0,'rows':[]};}})[_0x1023('0x25')](respondWithResult(_0x5001bb,null))[_0x1023('0x43')](function(_0x4bbbc9){var _0x58385e=_0x1948d5[_0x1023('0x32')]['test']?0x1f4:_0x4bbbc9[_0x1023('0x79')]||0x1f4;logger[_0x1023('0x27')](_0x1023('0x7a'),_0x1023('0x5c'),_0x58385e,JSON[_0x1023('0x7b')](_0x4bbbc9));delete _0x4bbbc9[_0x1023('0x29')];if(_0x58385e===0x191){_0x58385e=0x190;}_0x5001bb[_0x1023('0x19')](_0x58385e)[_0x1023('0x2a')](_0x1948d5[_0x1023('0x32')]['test']?{'message':_0x1023('0x7c'),'statusCode':_0x4bbbc9[_0x1023('0x79')]}:_0x4bbbc9);});}; \ No newline at end of file +var _0x047d=['update','then','destroy','error','stack','name','send','map','ZohoAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','options','rows','catch','keys','includeAll','include','find','create','body','params','findOne','ZohoConfiguration','length','order','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','serverUrl','host','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Description','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','push','display_label','picklist','pick_list_values','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x047d,0x150));var _0xd047=function(_0x48f30b,_0x35066d){_0x48f30b=_0x48f30b-0x0;var _0x1fc587=_0x047d[_0x48f30b];return _0x1fc587;};'use strict';var emlformat=require(_0xd047('0x0'));var rimraf=require(_0xd047('0x1'));var zipdir=require(_0xd047('0x2'));var jsonpatch=require(_0xd047('0x3'));var rp=require(_0xd047('0x4'));var moment=require(_0xd047('0x5'));var BPromise=require(_0xd047('0x6'));var Mustache=require(_0xd047('0x7'));var util=require(_0xd047('0x8'));var path=require(_0xd047('0x9'));var sox=require('sox');var csv=require(_0xd047('0xa'));var ejs=require(_0xd047('0xb'));var fs=require('fs');var fs_extra=require(_0xd047('0xc'));var _=require(_0xd047('0xd'));var squel=require(_0xd047('0xe'));var crypto=require(_0xd047('0xf'));var jsforce=require(_0xd047('0x10'));var deskjs=require(_0xd047('0x11'));var toCsv=require(_0xd047('0xa'));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(_0xd047('0x12'));var hardwareService=require(_0xd047('0x13'));var logger=require(_0xd047('0x14'))(_0xd047('0x15'));var utils=require(_0xd047('0x16'));var config=require(_0xd047('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd047('0x18'))['db'];var integrations=require(_0xd047('0x19'));function respondWithStatusCode(_0x2f3b21,_0x1d7eb5){_0x1d7eb5=_0x1d7eb5||0xcc;return function(_0x4bd2ab){if(_0x4bd2ab){return _0x2f3b21[_0xd047('0x1a')](_0x1d7eb5);}return _0x2f3b21[_0xd047('0x1b')](_0x1d7eb5)[_0xd047('0x1c')]();};}function respondWithResult(_0x4117c8,_0x4840e3){_0x4840e3=_0x4840e3||0xc8;return function(_0x139d19){if(_0x139d19){return _0x4117c8[_0xd047('0x1b')](_0x4840e3)[_0xd047('0x1d')](_0x139d19);}};}function respondWithFilteredResult(_0x2ebfb7,_0x1e8b6b){return function(_0x51d08d){if(_0x51d08d){var _0x2e4428=typeof _0x1e8b6b[_0xd047('0x1e')]===_0xd047('0x1f')&&typeof _0x1e8b6b[_0xd047('0x20')]==='undefined';var _0x394373=_0x51d08d[_0xd047('0x21')];var _0x1ddc7b=_0x2e4428?0x0:_0x1e8b6b[_0xd047('0x1e')];var _0x23a177=_0x2e4428?_0x51d08d[_0xd047('0x21')]:_0x1e8b6b[_0xd047('0x1e')]+_0x1e8b6b[_0xd047('0x20')];var _0x22e76c;if(_0x23a177>=_0x394373){_0x23a177=_0x394373;_0x22e76c=0xc8;}else{_0x22e76c=0xce;}_0x2ebfb7[_0xd047('0x1b')](_0x22e76c);return _0x2ebfb7[_0xd047('0x22')](_0xd047('0x23'),_0x1ddc7b+'-'+_0x23a177+'/'+_0x394373)[_0xd047('0x1d')](_0x51d08d);}return null;};}function patchUpdates(_0x1c05e9){return function(_0x51f55f){try{jsonpatch[_0xd047('0x24')](_0x51f55f,_0x1c05e9,!![]);}catch(_0x58ca9e){return BPromise[_0xd047('0x25')](_0x58ca9e);}return _0x51f55f[_0xd047('0x26')]();};}function saveUpdates(_0x1cc9c0,_0x1f070b){return function(_0x328b39){if(_0x328b39){return _0x328b39[_0xd047('0x27')](_0x1cc9c0)[_0xd047('0x28')](function(_0x4d7866){return _0x4d7866;});}return null;};}function removeEntity(_0x37c506,_0x13c666){return function(_0x607e78){if(_0x607e78){return _0x607e78[_0xd047('0x29')]()[_0xd047('0x28')](function(){_0x37c506[_0xd047('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa474b,_0x27e5fd){return function(_0x46076a){if(!_0x46076a){_0xaa474b['sendStatus'](0x194);}return _0x46076a;};}function handleError(_0x46c8e9,_0x3484fb){_0x3484fb=_0x3484fb||0x1f4;return function(_0x1dc0d7){logger[_0xd047('0x2a')](_0x1dc0d7[_0xd047('0x2b')]);if(_0x1dc0d7[_0xd047('0x2c')]){delete _0x1dc0d7['name'];}_0x46c8e9[_0xd047('0x1b')](_0x3484fb)[_0xd047('0x2d')](_0x1dc0d7);};}exports['index']=function(_0x52e4b1,_0x571e52){var _0x3fe158={},_0xcac2c9={},_0x3b0f4d={'count':0x0,'rows':[]};var _0x41b435=_[_0xd047('0x2e')](db[_0xd047('0x2f')][_0xd047('0x30')],function(_0x277910){return{'name':_0x277910['fieldName'],'type':_0x277910[_0xd047('0x31')][_0xd047('0x32')]};});_0xcac2c9[_0xd047('0x33')]=_[_0xd047('0x2e')](_0x41b435,_0xd047('0x2c'));_0xcac2c9[_0xd047('0x34')]=_['keys'](_0x52e4b1[_0xd047('0x34')]);_0xcac2c9[_0xd047('0x35')]=_[_0xd047('0x36')](_0xcac2c9['model'],_0xcac2c9['query']);_0x3fe158[_0xd047('0x37')]=_[_0xd047('0x36')](_0xcac2c9[_0xd047('0x33')],qs[_0xd047('0x38')](_0x52e4b1[_0xd047('0x34')][_0xd047('0x38')]));_0x3fe158['attributes']=_0x3fe158[_0xd047('0x37')]['length']?_0x3fe158[_0xd047('0x37')]:_0xcac2c9[_0xd047('0x33')];if(!_0x52e4b1[_0xd047('0x34')][_0xd047('0x39')]('nolimit')){_0x3fe158[_0xd047('0x20')]=qs[_0xd047('0x20')](_0x52e4b1[_0xd047('0x34')]['limit']);_0x3fe158[_0xd047('0x1e')]=qs[_0xd047('0x1e')](_0x52e4b1[_0xd047('0x34')][_0xd047('0x1e')]);}_0x3fe158['order']=qs['sort'](_0x52e4b1[_0xd047('0x34')][_0xd047('0x3a')]);_0x3fe158[_0xd047('0x3b')]=qs[_0xd047('0x35')](_['pick'](_0x52e4b1[_0xd047('0x34')],_0xcac2c9[_0xd047('0x35')]),_0x41b435);if(_0x52e4b1[_0xd047('0x34')][_0xd047('0x3c')]){_0x3fe158['where']=_['merge'](_0x3fe158['where'],{'$or':_[_0xd047('0x2e')](_0x41b435,function(_0x504763){if(_0x504763['type']!=='VIRTUAL'){var _0x2cca61={};_0x2cca61[_0x504763[_0xd047('0x2c')]]={'$like':'%'+_0x52e4b1[_0xd047('0x34')]['filter']+'%'};return _0x2cca61;}})});}_0x3fe158=_[_0xd047('0x3d')]({},_0x3fe158,_0x52e4b1[_0xd047('0x3e')]);var _0x580973={'where':_0x3fe158[_0xd047('0x3b')]};return db[_0xd047('0x2f')]['count'](_0x580973)[_0xd047('0x28')](function(_0x1897e8){_0x3b0f4d[_0xd047('0x21')]=_0x1897e8;if(_0x52e4b1[_0xd047('0x34')]['includeAll']){_0x3fe158['include']=[{'all':!![]}];}return db[_0xd047('0x2f')]['findAll'](_0x3fe158);})[_0xd047('0x28')](function(_0x201b4d){_0x3b0f4d[_0xd047('0x3f')]=_0x201b4d;return _0x3b0f4d;})['then'](respondWithFilteredResult(_0x571e52,_0x3fe158))[_0xd047('0x40')](handleError(_0x571e52,null));};exports['show']=function(_0x183a04,_0x39536d){var _0x1ccad2={'raw':![],'where':{'id':_0x183a04['params']['id']}},_0x407bbc={};_0x407bbc[_0xd047('0x33')]=_[_0xd047('0x41')](db[_0xd047('0x2f')][_0xd047('0x30')]);_0x407bbc['query']=_[_0xd047('0x41')](_0x183a04[_0xd047('0x34')]);_0x407bbc[_0xd047('0x35')]=_['intersection'](_0x407bbc[_0xd047('0x33')],_0x407bbc['query']);_0x1ccad2[_0xd047('0x37')]=_['intersection'](_0x407bbc[_0xd047('0x33')],qs['fields'](_0x183a04['query'][_0xd047('0x38')]));_0x1ccad2['attributes']=_0x1ccad2[_0xd047('0x37')]['length']?_0x1ccad2['attributes']:_0x407bbc['model'];if(_0x183a04[_0xd047('0x34')][_0xd047('0x42')]){_0x1ccad2[_0xd047('0x43')]=[{'all':!![]}];}_0x1ccad2=_[_0xd047('0x3d')]({},_0x1ccad2,_0x183a04[_0xd047('0x3e')]);return db[_0xd047('0x2f')][_0xd047('0x44')](_0x1ccad2)['then'](handleEntityNotFound(_0x39536d,null))[_0xd047('0x28')](respondWithResult(_0x39536d,null))['catch'](handleError(_0x39536d,null));};exports['create']=function(_0x3a6006,_0x4345c3){return db[_0xd047('0x2f')][_0xd047('0x45')](_0x3a6006['body'],{})['then'](respondWithResult(_0x4345c3,0xc9))[_0xd047('0x40')](handleError(_0x4345c3,null));};exports[_0xd047('0x27')]=function(_0x5e5006,_0x5b9a92){if(_0x5e5006[_0xd047('0x46')]['id']){delete _0x5e5006[_0xd047('0x46')]['id'];}return db['ZohoAccount'][_0xd047('0x44')]({'where':{'id':_0x5e5006[_0xd047('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b9a92,null))[_0xd047('0x28')](saveUpdates(_0x5e5006[_0xd047('0x46')],null))['then'](respondWithResult(_0x5b9a92,null))[_0xd047('0x40')](handleError(_0x5b9a92,null));};exports[_0xd047('0x29')]=function(_0xb48eef,_0x3d6d1b){return db[_0xd047('0x2f')][_0xd047('0x44')]({'where':{'id':_0xb48eef[_0xd047('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d6d1b,null))[_0xd047('0x28')](removeEntity(_0x3d6d1b,null))[_0xd047('0x40')](handleError(_0x3d6d1b,null));};exports['getConfigurations']=function(_0x679e57,_0x2f4c5e,_0x339ec4){var _0x27484c={};var _0x1994a7={};var _0x34c507;var _0xf9788;return db[_0xd047('0x2f')][_0xd047('0x48')]({'where':{'id':_0x679e57[_0xd047('0x47')]['id']}})[_0xd047('0x28')](handleEntityNotFound(_0x2f4c5e,null))[_0xd047('0x28')](function(_0x56a075){if(_0x56a075){_0x34c507=_0x56a075;_0x1994a7[_0xd047('0x33')]=_[_0xd047('0x41')](db[_0xd047('0x49')][_0xd047('0x30')]);_0x1994a7['query']=_[_0xd047('0x41')](_0x679e57[_0xd047('0x34')]);_0x1994a7[_0xd047('0x35')]=_['intersection'](_0x1994a7[_0xd047('0x33')],_0x1994a7[_0xd047('0x34')]);_0x27484c[_0xd047('0x37')]=_[_0xd047('0x36')](_0x1994a7[_0xd047('0x33')],qs[_0xd047('0x38')](_0x679e57['query'][_0xd047('0x38')]));_0x27484c[_0xd047('0x37')]=_0x27484c[_0xd047('0x37')][_0xd047('0x4a')]?_0x27484c['attributes']:_0x1994a7['model'];_0x27484c[_0xd047('0x4b')]=qs['sort'](_0x679e57[_0xd047('0x34')][_0xd047('0x3a')]);_0x27484c[_0xd047('0x3b')]=qs['filters'](_[_0xd047('0x4c')](_0x679e57[_0xd047('0x34')],_0x1994a7[_0xd047('0x35')]));if(_0x679e57[_0xd047('0x34')][_0xd047('0x3c')]){_0x27484c['where']=_[_0xd047('0x3d')](_0x27484c[_0xd047('0x3b')],{'$or':_[_0xd047('0x2e')](_0x27484c['attributes'],function(_0x1d6910){var _0x49c59b={};_0x49c59b[_0x1d6910]={'$like':'%'+_0x679e57[_0xd047('0x34')]['filter']+'%'};return _0x49c59b;})});}_0x27484c=_[_0xd047('0x3d')]({},_0x27484c,_0x679e57[_0xd047('0x3e')]);return _0x34c507['getConfigurations'](_0x27484c);}})[_0xd047('0x28')](function(_0x122acd){if(_0x122acd){_0xf9788=_0x122acd[_0xd047('0x4a')];if(!_0x679e57[_0xd047('0x34')][_0xd047('0x39')]('nolimit')){_0x27484c['limit']=qs[_0xd047('0x20')](_0x679e57[_0xd047('0x34')]['limit']);_0x27484c[_0xd047('0x1e')]=qs['offset'](_0x679e57[_0xd047('0x34')][_0xd047('0x1e')]);}return _0x34c507[_0xd047('0x4d')](_0x27484c);}})['then'](function(_0x432cf5){if(_0x432cf5){return _0x432cf5?{'count':_0xf9788,'rows':_0x432cf5}:null;}})[_0xd047('0x28')](respondWithResult(_0x2f4c5e,null))[_0xd047('0x40')](handleError(_0x2f4c5e,null));};exports[_0xd047('0x4e')]=function(_0x1e2e54,_0x39eec9,_0x19fa6f){if(_0x1e2e54[_0xd047('0x46')]['id']){delete _0x1e2e54[_0xd047('0x46')]['id'];}return db['ZohoAccount'][_0xd047('0x48')]({'where':{'id':_0x1e2e54[_0xd047('0x47')]['id']}})[_0xd047('0x28')](handleEntityNotFound(_0x39eec9,null))[_0xd047('0x28')](function(_0x10403e){if(_0x10403e){_0x1e2e54[_0xd047('0x46')][_0xd047('0x4f')]=_0x10403e['id'];_0x1e2e54[_0xd047('0x46')][_0xd047('0x50')]=integrations[_0xd047('0x51')](_0x1e2e54[_0xd047('0x46')][_0xd047('0x52')],_0x1e2e54[_0xd047('0x46')][_0xd047('0x31')]);_0x1e2e54[_0xd047('0x46')]['Descriptions']=integrations['getDescriptions'](_0x1e2e54[_0xd047('0x46')][_0xd047('0x52')],_0x1e2e54[_0xd047('0x46')][_0xd047('0x31')]);return db[_0xd047('0x49')][_0xd047('0x45')](_0x1e2e54[_0xd047('0x46')],{'include':[{'model':db[_0xd047('0x53')],'as':_0xd047('0x50')},{'model':db['ZohoField'],'as':_0xd047('0x54')}]});}return null;})[_0xd047('0x28')](respondWithResult(_0x39eec9,null))['catch'](handleError(_0x39eec9,null));};function getAccessToken(_0x47ac6f){return new Promise(function(_0x32783c,_0x4ba648){var _0x2dd130;switch(_0x47ac6f[_0xd047('0x55')]){case'US':_0x2dd130=_0xd047('0x56');break;case'AU':_0x2dd130='https://accounts.zoho.com.au';break;case'EU':_0x2dd130=_0xd047('0x57');break;case'IN':_0x2dd130=_0xd047('0x58');break;case'CN':_0x2dd130='https://accounts.zoho.com.cn';break;default:_0x2dd130='https://accounts.zoho.eu';break;}var _0x44a660={'method':_0xd047('0x59'),'uri':_0x2dd130+_0xd047('0x5a'),'qs':{'refresh_token':_0x47ac6f[_0xd047('0x5b')],'client_id':_0x47ac6f[_0xd047('0x5c')],'client_secret':_0x47ac6f[_0xd047('0x5d')],'grant_type':_0xd047('0x5e')},'json':!![]};return rp(_0x44a660)['then'](function(_0x5600e3){if(_0x5600e3[_0xd047('0x5f')]){_0x32783c(_0x5600e3[_0xd047('0x5f')]);}else{_0x4ba648('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xd047('0x40')](function(_0x25c4c3){_0x4ba648(_0x25c4c3);});});}exports[_0xd047('0x60')]=function(_0x8b1956,_0x161ce4,_0x8ac82b){var _0xe178f9,_0x152a6e,_0x5b2677,_0x26335d,_0x2b3553;return db[_0xd047('0x2f')][_0xd047('0x48')]({'where':{'id':_0x8b1956[_0xd047('0x47')]['id']},'attributes':['id','host',_0xd047('0x55'),_0xd047('0x5c'),'clientSecret',_0xd047('0x61'),'code',_0xd047('0x5b')]})[_0xd047('0x28')](handleEntityNotFound(_0x161ce4,null))[_0xd047('0x28')](function(_0x2a76fd){_0x2b3553=_0x2a76fd;_0xe178f9=_0x2b3553[_0xd047('0x62')];_0x152a6e=_0xe178f9===_0xd047('0x63')?'eu':_0xd047('0x64');_0x5b2677=_0x2b3553[_0xd047('0x61')];var _0x514377=_0x5b2677[_0xd047('0x65')](-0x1);if(_0x514377==='/'||_0x514377==='\x5c'||_0x514377===':'){_0x5b2677=_0x5b2677[_0xd047('0x66')](0x0,_0x5b2677['lastIndexOf'](_0x514377));}if(!_0x2b3553[_0xd047('0x5b')]){throw new Error(_0xd047('0x67'));}return getAccessToken(_0x2b3553);})[_0xd047('0x28')](function(_0x3eefd2){if(_0x3eefd2){return rp({'method':_0xd047('0x68'),'uri':util[_0xd047('0x69')](_0xd047('0x6a'),_0x152a6e),'qs':{'module':'Calls'},'headers':{'Authorization':_0xd047('0x6b')+_0x3eefd2},'json':!![]});}})['then'](function(_0x120290){if(_0x120290){if(_0x120290[_0xd047('0x6c')]&&_0x120290[_0xd047('0x6c')][_0xd047('0x2a')]){throw new Error(_0x120290[_0xd047('0x6c')]['error']['message']);}var _0x20a017=[];var _0x1cce72=[];var _0x32ec9c=[_0xd047('0x6d'),'Subject',_0xd047('0x6e'),'WhoId',_0xd047('0x6f'),_0xd047('0x70'),'Call_Start_Time',_0xd047('0x71')];_0x1cce72=_[_0xd047('0x72')](_0x120290[_0xd047('0x38')],function(_0x2f4da8){return _0x32ec9c[_0xd047('0x73')](_0x2f4da8[_0xd047('0x74')]);});for(var _0x10f658=0x0;_0x10f658<_0x1cce72[_0xd047('0x4a')];_0x10f658++){if(_0x1cce72[_0x10f658]['system_mandatory']===![]){_0x20a017[_0xd047('0x75')]({'id':_0x1cce72[_0x10f658]['id'],'name':_0x1cce72[_0x10f658][_0xd047('0x76')],'custom':_0x1cce72[_0x10f658]['custom_field'],'options':_0x1cce72[_0x10f658]['data_type']===_0xd047('0x77')&&_0x1cce72[_0x10f658][_0xd047('0x78')][_0xd047('0x4a')]>-0x1?_[_0xd047('0x2e')](_0x1cce72[_0x10f658]['pick_list_values'],function(_0x1aed43){return{'name':_0x1aed43,'value':_0x1aed43};}):[]});}}return{'count':_0x20a017['length'],'rows':_0x20a017};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x161ce4,null))[_0xd047('0x40')](function(_0x10a02f){var _0x52cdf7=_0x8b1956[_0xd047('0x34')][_0xd047('0x79')]?0x1f4:_0x10a02f['statusCode']||0x1f4;logger[_0xd047('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xd047('0x60'),_0x52cdf7,JSON[_0xd047('0x7a')](_0x10a02f));delete _0x10a02f[_0xd047('0x2c')];if(_0x52cdf7===0x191){_0x52cdf7=0x190;}_0x161ce4[_0xd047('0x1b')](_0x52cdf7)[_0xd047('0x2d')](_0x8b1956[_0xd047('0x34')][_0xd047('0x79')]?{'message':_0xd047('0x7b'),'statusCode':_0x10a02f[_0xd047('0x7c')]}:_0x10a02f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 39132f0..6493b05 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 _0x755b=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','https://accounts.zoho.com.au','authorization_code','inspect','lodash'];(function(_0x1ea6b8,_0x2b7db6){var _0x697a2=function(_0x4057d8){while(--_0x4057d8){_0x1ea6b8['push'](_0x1ea6b8['shift']());}};_0x697a2(++_0x2b7db6);}(_0x755b,0x15f));var _0xb755=function(_0x4c5437,_0x22da64){_0x4c5437=_0x4c5437-0x0;var _0x221689=_0x755b[_0x4c5437];return _0x221689;};'use strict';var _=require(_0xb755('0x0'));var util=require(_0xb755('0x1'));var logger=require(_0xb755('0x2'))(_0xb755('0x3'));var moment=require('moment');var BPromise=require(_0xb755('0x4'));var rp=require(_0xb755('0x5'));var fs=require('fs');var path=require(_0xb755('0x6'));var rimraf=require(_0xb755('0x7'));var config=require(_0xb755('0x8'));var attributes=require(_0xb755('0x9'));var integrations=require(_0xb755('0xa'));module[_0xb755('0xb')]=function(_0x234094,_0x3a203c){return _0x234094[_0xb755('0xc')](_0xb755('0xd'),attributes,{'tableName':_0xb755('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f42f0,_0x4ad002,_0xb3e658){if(_0x3f42f0[_0xb755('0xf')](_0xb755('0x10'))||_0x3f42f0[_0xb755('0xf')](_0xb755('0x11'))||_0x3f42f0[_0xb755('0xf')](_0xb755('0x12'))||_0x3f42f0['changed'](_0xb755('0x13'))||_0x3f42f0['changed']('code')||_0x3f42f0[_0xb755('0xf')](_0xb755('0x14'))){var _0x3910ba,_0x27cb1a;_0x3910ba=_0x3f42f0[_0xb755('0x11')];var _0x2d8fc3=_0x3910ba['slice'](-0x1);if(_0x2d8fc3==='/'||_0x2d8fc3==='\x5c'||_0x2d8fc3===':'){_0x3910ba=_0x3910ba[_0xb755('0x15')](0x0,_0x3910ba[_0xb755('0x16')](_0x2d8fc3));}switch(_0x3f42f0['zone']){case'US':_0x27cb1a=_0xb755('0x17');break;case'AU':_0x27cb1a='https://accounts.zoho.com.au';break;case'IN':_0x27cb1a=_0xb755('0x18');break;case'CN':_0x27cb1a=_0xb755('0x19');break;default:_0x27cb1a=_0xb755('0x1a');break;}var _0x26a7aa={'method':_0xb755('0x1b'),'uri':_0x27cb1a+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3f42f0[_0xb755('0x12')],'client_secret':_0x3f42f0['clientSecret'],'redirect_uri':_0x3f42f0['serverUrl'],'code':_0x3f42f0[_0xb755('0x1c')]},'headers':{'Content-Type':_0xb755('0x1d')}};return rp(_0x26a7aa)[_0xb755('0x1e')](function(_0xca1cec){var _0x54f83d=JSON[_0xb755('0x1f')](_0xca1cec);if(_0x54f83d['refresh_token']){_0x3f42f0[_0xb755('0x20')]=_0x54f83d[_0xb755('0x21')];logger[_0xb755('0x22')](util['format'](_0xb755('0x23'),_0x3f42f0[_0xb755('0x24')],_0x3f42f0['id']));}else{logger[_0xb755('0x25')](util[_0xb755('0x26')](_0xb755('0x27'),_0x3f42f0[_0xb755('0x24')],_0x3f42f0['id']),util['inspect'](_0x54f83d,{'showHidden':![],'depth':null}));}return _0xb3e658(null,_0x4ad002);})[_0xb755('0x28')](function(_0x28c412){logger[_0xb755('0x25')](util['format'](_0xb755('0x27'),_0x3f42f0[_0xb755('0x24')],_0x3f42f0['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xb3e658(_0x28c412);});}else{return _0xb3e658(null,_0x4ad002);}},'beforeUpdate':function(_0x7ef7d,_0x47e43b,_0x1d8cb1){if(_0x7ef7d[_0xb755('0xf')](_0xb755('0x10'))||_0x7ef7d[_0xb755('0xf')](_0xb755('0x11'))||_0x7ef7d['changed'](_0xb755('0x12'))||_0x7ef7d['changed']('clientSecret')||_0x7ef7d[_0xb755('0xf')](_0xb755('0x1c'))||_0x7ef7d[_0xb755('0xf')](_0xb755('0x14'))){var _0x5f1c60,_0x2e9f24;_0x5f1c60=_0x7ef7d[_0xb755('0x11')];var _0x443178=_0x5f1c60['slice'](-0x1);if(_0x443178==='/'||_0x443178==='\x5c'||_0x443178===':'){_0x5f1c60=_0x5f1c60[_0xb755('0x15')](0x0,_0x5f1c60[_0xb755('0x16')](_0x443178));}switch(_0x7ef7d['zone']){case'US':_0x2e9f24=_0xb755('0x17');break;case'AU':_0x2e9f24=_0xb755('0x29');break;case'IN':_0x2e9f24=_0xb755('0x18');break;case'CN':_0x2e9f24=_0xb755('0x19');break;default:_0x2e9f24=_0xb755('0x1a');break;}var _0x59c2e7={'method':'POST','uri':_0x2e9f24+'/oauth/v2/token','form':{'grant_type':_0xb755('0x2a'),'client_id':_0x7ef7d[_0xb755('0x12')],'client_secret':_0x7ef7d[_0xb755('0x13')],'redirect_uri':_0x7ef7d['serverUrl'],'code':_0x7ef7d[_0xb755('0x1c')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x59c2e7)[_0xb755('0x1e')](function(_0xec4dbd){var _0x3177b1=JSON[_0xb755('0x1f')](_0xec4dbd);if(_0x3177b1[_0xb755('0x21')]){_0x7ef7d[_0xb755('0x20')]=_0x3177b1[_0xb755('0x21')];logger[_0xb755('0x22')](util[_0xb755('0x26')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x7ef7d['name'],_0x7ef7d['id']));}else{logger[_0xb755('0x25')](util[_0xb755('0x26')](_0xb755('0x27'),_0x7ef7d[_0xb755('0x24')],_0x7ef7d['id']),util[_0xb755('0x2b')](_0x3177b1,{'showHidden':![],'depth':null}));}return _0x1d8cb1(null,_0x47e43b);})[_0xb755('0x28')](function(_0x1bd09b){logger[_0xb755('0x25')](util[_0xb755('0x26')](_0xb755('0x27'),_0x7ef7d[_0xb755('0x24')],_0x7ef7d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1d8cb1(_0x1bd09b);});}else{return _0x1d8cb1(null,_0x47e43b);}}}});}; \ No newline at end of file +var _0xd028=['refreshToken','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','code','substring','lastIndexOf','authorization_code','then'];(function(_0x1ea279,_0x260b59){var _0x34b047=function(_0x46ded8){while(--_0x46ded8){_0x1ea279['push'](_0x1ea279['shift']());}};_0x34b047(++_0x260b59);}(_0xd028,0x1cf));var _0x8d02=function(_0x5ada76,_0x28992e){_0x5ada76=_0x5ada76-0x0;var _0x56aaa6=_0xd028[_0x5ada76];return _0x56aaa6;};'use strict';var _=require(_0x8d02('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8d02('0x1'));var moment=require(_0x8d02('0x2'));var BPromise=require(_0x8d02('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d02('0x4'));var rimraf=require(_0x8d02('0x5'));var config=require(_0x8d02('0x6'));var attributes=require(_0x8d02('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x8d02('0x8')]=function(_0xb5cc7,_0x5f5b23){return _0xb5cc7[_0x8d02('0x9')]('ZohoAccount',attributes,{'tableName':_0x8d02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5cfe34,_0x30f060,_0x9a20f4){if(_0x5cfe34[_0x8d02('0xb')](_0x8d02('0xc'))||_0x5cfe34['changed'](_0x8d02('0xd'))||_0x5cfe34[_0x8d02('0xb')](_0x8d02('0xe'))||_0x5cfe34['changed'](_0x8d02('0xf'))||_0x5cfe34[_0x8d02('0xb')]('code')||_0x5cfe34['changed'](_0x8d02('0x10'))){var _0x4f1cd3,_0x1eaf2c;_0x4f1cd3=_0x5cfe34[_0x8d02('0xd')];var _0x20d80d=_0x4f1cd3[_0x8d02('0x11')](-0x1);if(_0x20d80d==='/'||_0x20d80d==='\x5c'||_0x20d80d===':'){_0x4f1cd3=_0x4f1cd3['substring'](0x0,_0x4f1cd3['lastIndexOf'](_0x20d80d));}switch(_0x5cfe34[_0x8d02('0xc')]){case'US':_0x1eaf2c=_0x8d02('0x12');break;case'AU':_0x1eaf2c=_0x8d02('0x13');break;case'IN':_0x1eaf2c=_0x8d02('0x14');break;case'CN':_0x1eaf2c=_0x8d02('0x15');break;default:_0x1eaf2c=_0x8d02('0x16');break;}var _0x4a0c28={'method':_0x8d02('0x17'),'uri':_0x1eaf2c+_0x8d02('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x5cfe34[_0x8d02('0xe')],'client_secret':_0x5cfe34[_0x8d02('0xf')],'redirect_uri':_0x5cfe34[_0x8d02('0xd')],'code':_0x5cfe34['code']},'headers':{'Content-Type':_0x8d02('0x19')}};return rp(_0x4a0c28)['then'](function(_0x32da70){var _0x44f674=JSON[_0x8d02('0x1a')](_0x32da70);if(_0x44f674[_0x8d02('0x1b')]){_0x5cfe34['refreshToken']=_0x44f674['refresh_token'];logger[_0x8d02('0x1c')](util[_0x8d02('0x1d')](_0x8d02('0x1e'),_0x5cfe34[_0x8d02('0x1f')],_0x5cfe34['id']));}else{logger[_0x8d02('0x20')](util[_0x8d02('0x1d')](_0x8d02('0x21'),_0x5cfe34[_0x8d02('0x1f')],_0x5cfe34['id']),util[_0x8d02('0x22')](_0x44f674,{'showHidden':![],'depth':null}));}return _0x9a20f4(null,_0x30f060);})[_0x8d02('0x23')](function(_0x5ce1c6){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5cfe34[_0x8d02('0x1f')],_0x5cfe34['id']),util[_0x8d02('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x9a20f4(_0x5ce1c6);});}else{return _0x9a20f4(null,_0x30f060);}},'beforeUpdate':function(_0x1f93d6,_0x5cb92b,_0x36fcf8){if(_0x1f93d6['changed'](_0x8d02('0xc'))||_0x1f93d6[_0x8d02('0xb')](_0x8d02('0xd'))||_0x1f93d6[_0x8d02('0xb')]('clientId')||_0x1f93d6[_0x8d02('0xb')](_0x8d02('0xf'))||_0x1f93d6['changed'](_0x8d02('0x24'))||_0x1f93d6[_0x8d02('0xb')]('host')){var _0x33dad0,_0xa438a3;_0x33dad0=_0x1f93d6[_0x8d02('0xd')];var _0x2e28b3=_0x33dad0['slice'](-0x1);if(_0x2e28b3==='/'||_0x2e28b3==='\x5c'||_0x2e28b3===':'){_0x33dad0=_0x33dad0[_0x8d02('0x25')](0x0,_0x33dad0[_0x8d02('0x26')](_0x2e28b3));}switch(_0x1f93d6['zone']){case'US':_0xa438a3=_0x8d02('0x12');break;case'AU':_0xa438a3=_0x8d02('0x13');break;case'IN':_0xa438a3='https://accounts.zoho.in';break;case'CN':_0xa438a3=_0x8d02('0x15');break;default:_0xa438a3=_0x8d02('0x16');break;}var _0x1ffb30={'method':_0x8d02('0x17'),'uri':_0xa438a3+'/oauth/v2/token','form':{'grant_type':_0x8d02('0x27'),'client_id':_0x1f93d6[_0x8d02('0xe')],'client_secret':_0x1f93d6[_0x8d02('0xf')],'redirect_uri':_0x1f93d6[_0x8d02('0xd')],'code':_0x1f93d6[_0x8d02('0x24')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1ffb30)[_0x8d02('0x28')](function(_0x650814){var _0x44e8c8=JSON['parse'](_0x650814);if(_0x44e8c8[_0x8d02('0x1b')]){_0x1f93d6[_0x8d02('0x29')]=_0x44e8c8[_0x8d02('0x1b')];logger['info'](util[_0x8d02('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f93d6[_0x8d02('0x1f')],_0x1f93d6['id']));}else{logger['error'](util[_0x8d02('0x1d')](_0x8d02('0x21'),_0x1f93d6[_0x8d02('0x1f')],_0x1f93d6['id']),util['inspect'](_0x44e8c8,{'showHidden':![],'depth':null}));}return _0x36fcf8(null,_0x5cb92b);})[_0x8d02('0x23')](function(_0x2bf194){logger[_0x8d02('0x20')](util[_0x8d02('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f93d6[_0x8d02('0x1f')],_0x1f93d6['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x36fcf8(_0x2bf194);});}else{return _0x36fcf8(null,_0x5cb92b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 468d4e2..64da27b 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 _0xccde=['error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','findAll','options','raw','attributes','limit','map','include','model','debug','catch','ShowZohoAccount','ZohoAccount','find','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify'];(function(_0xb511c4,_0x5532ba){var _0x5b539d=function(_0xbc61d8){while(--_0xbc61d8){_0xb511c4['push'](_0xb511c4['shift']());}};_0x5b539d(++_0x5532ba);}(_0xccde,0x1e1));var _0xeccd=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0xccde[_0x26bf51];return _0x503415;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var moment=require(_0xeccd('0x1'));var BPromise=require('bluebird');var rs=require(_0xeccd('0x2'));var fs=require('fs');var Redis=require(_0xeccd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeccd('0x4'))(_0xeccd('0x5'));var config=require(_0xeccd('0x6'));var jayson=require(_0xeccd('0x7'));var client=jayson[_0xeccd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x338742,_0x130f1c,_0x1b622f){return new BPromise(function(_0x1eebfb,_0x4b068e){return client[_0xeccd('0x9')](_0x338742,_0x1b622f)[_0xeccd('0xa')](function(_0x9dccd){logger[_0xeccd('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x130f1c,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'),JSON[_0xeccd('0xd')](_0x9dccd));if(_0x9dccd[_0xeccd('0xe')]){if(_0x9dccd[_0xeccd('0xe')][_0xeccd('0xf')]===0x1f4){logger['error'](_0xeccd('0x10'),_0x130f1c,_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);return _0x4b068e(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}logger[_0xeccd('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x130f1c,_0x9dccd['error'][_0xeccd('0x11')]);return _0x1eebfb(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}else{logger[_0xeccd('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'));_0x1eebfb(_0x9dccd[_0xeccd('0x12')]['message']);}})['catch'](function(_0x42e47e){logger[_0xeccd('0xe')](_0xeccd('0x10'),_0x130f1c,_0x42e47e);_0x4b068e(_0x42e47e);});});}exports[_0xeccd('0x13')]=function(_0xb0fad7){var _0x360d25=this;return new Promise(function(_0x466d98,_0x17596a){return db['ZohoAccount'][_0xeccd('0x14')]({'raw':_0xb0fad7[_0xeccd('0x15')]?_0xb0fad7[_0xeccd('0x15')][_0xeccd('0x16')]===undefined?!![]:![]:!![],'where':_0xb0fad7[_0xeccd('0x15')]?_0xb0fad7[_0xeccd('0x15')]['where']||null:null,'attributes':_0xb0fad7['options']?_0xb0fad7['options'][_0xeccd('0x17')]||null:null,'limit':_0xb0fad7['options']?_0xb0fad7[_0xeccd('0x15')][_0xeccd('0x18')]||null:null,'include':_0xb0fad7['options']?_0xb0fad7[_0xeccd('0x15')]['include']?_[_0xeccd('0x19')](_0xb0fad7[_0xeccd('0x15')][_0xeccd('0x1a')],function(_0x4537e1){return{'model':db[_0x4537e1[_0xeccd('0x1b')]],'as':_0x4537e1['as'],'attributes':_0x4537e1['attributes'],'include':_0x4537e1[_0xeccd('0x1a')]?_['map'](_0x4537e1[_0xeccd('0x1a')],function(_0x244d22){return{'model':db[_0x244d22[_0xeccd('0x1b')]],'as':_0x244d22['as'],'attributes':_0x244d22[_0xeccd('0x17')],'include':_0x244d22['include']?_[_0xeccd('0x19')](_0x244d22[_0xeccd('0x1a')],function(_0x12dd7a){return{'model':db[_0x12dd7a[_0xeccd('0x1b')]],'as':_0x12dd7a['as'],'attributes':_0x12dd7a['attributes']};}):[]};}):[]};}):[]:[]})[_0xeccd('0xa')](function(_0x4240df){logger[_0xeccd('0xb')](_0xeccd('0x13'),_0xb0fad7);logger[_0xeccd('0x1c')](_0xeccd('0x13'),_0xb0fad7,JSON[_0xeccd('0xd')](_0x4240df));_0x466d98(_0x4240df);})[_0xeccd('0x1d')](function(_0x283cd7){logger['error'](_0xeccd('0x13'),_0x283cd7['message'],_0xb0fad7);_0x17596a(_0x360d25[_0xeccd('0xe')](0x1f4,_0x283cd7[_0xeccd('0x11')]));});});};exports[_0xeccd('0x1e')]=function(_0x28d25a){var _0x330f8d=this;return new Promise(function(_0x46dabd,_0x49858a){return db[_0xeccd('0x1f')][_0xeccd('0x20')]({'raw':_0x28d25a[_0xeccd('0x15')]?_0x28d25a[_0xeccd('0x15')][_0xeccd('0x16')]===undefined?!![]:![]:!![],'where':_0x28d25a[_0xeccd('0x15')]?_0x28d25a[_0xeccd('0x15')]['where']||null:null,'attributes':_0x28d25a[_0xeccd('0x15')]?_0x28d25a[_0xeccd('0x15')]['attributes']||null:null,'include':_0x28d25a[_0xeccd('0x15')]?_0x28d25a[_0xeccd('0x15')]['include']?_[_0xeccd('0x19')](_0x28d25a[_0xeccd('0x15')][_0xeccd('0x1a')],function(_0x160528){return{'model':db[_0x160528[_0xeccd('0x1b')]],'as':_0x160528['as'],'attributes':_0x160528[_0xeccd('0x17')],'include':_0x160528[_0xeccd('0x1a')]?_[_0xeccd('0x19')](_0x160528[_0xeccd('0x1a')],function(_0x5a6c21){return{'model':db[_0x5a6c21['model']],'as':_0x5a6c21['as'],'attributes':_0x5a6c21[_0xeccd('0x17')],'include':_0x5a6c21[_0xeccd('0x1a')]?_[_0xeccd('0x19')](_0x5a6c21[_0xeccd('0x1a')],function(_0x593083){return{'model':db[_0x593083[_0xeccd('0x1b')]],'as':_0x593083['as'],'attributes':_0x593083[_0xeccd('0x17')]};}):[]};}):[]};}):[]:[]})[_0xeccd('0xa')](function(_0x3b0d2d){logger[_0xeccd('0xb')](_0xeccd('0x1e'),_0x28d25a);logger[_0xeccd('0x1c')]('ShowZohoAccount',_0x28d25a,JSON[_0xeccd('0xd')](_0x3b0d2d));_0x46dabd(_0x3b0d2d);})['catch'](function(_0x3cf322){logger[_0xeccd('0xe')](_0xeccd('0x1e'),_0x3cf322['message'],_0x28d25a);_0x49858a(_0x330f8d[_0xeccd('0xe')](0x1f4,_0x3cf322[_0xeccd('0x11')]));});});}; \ No newline at end of file +var _0x288a=['limit','include','map','model','debug','ShowZohoAccount','ZohoAccount','raw','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZohoAccount','findAll','options','where','attributes'];(function(_0x4ac50f,_0xce9588){var _0x4b98fb=function(_0x19dee4){while(--_0x19dee4){_0x4ac50f['push'](_0x4ac50f['shift']());}};_0x4b98fb(++_0xce9588);}(_0x288a,0x188));var _0xa288=function(_0x4bef16,_0x5383bb){_0x4bef16=_0x4bef16-0x0;var _0x47b213=_0x288a[_0x4bef16];return _0x47b213;};'use strict';var _=require('lodash');var util=require(_0xa288('0x0'));var moment=require(_0xa288('0x1'));var BPromise=require(_0xa288('0x2'));var rs=require(_0xa288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa288('0x4'));var logger=require('../../config/logger')(_0xa288('0x5'));var config=require(_0xa288('0x6'));var jayson=require(_0xa288('0x7'));var client=jayson['client'][_0xa288('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xaee90c,_0x156720,_0x57f445){return new BPromise(function(_0x14e4a6,_0x1e8412){return client[_0xa288('0x9')](_0xaee90c,_0x57f445)[_0xa288('0xa')](function(_0x1a0c06){logger[_0xa288('0xb')](_0xa288('0xc'),_0x156720,_0xa288('0xd'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x156720,'request\x20sent',JSON[_0xa288('0xe')](_0x1a0c06));if(_0x1a0c06[_0xa288('0xf')]){if(_0x1a0c06['error'][_0xa288('0x10')]===0x1f4){logger[_0xa288('0xf')](_0xa288('0xc'),_0x156720,_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);return _0x1e8412(_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);}logger[_0xa288('0xf')](_0xa288('0xc'),_0x156720,_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);return _0x14e4a6(_0x1a0c06[_0xa288('0xf')][_0xa288('0x11')]);}else{logger[_0xa288('0xb')](_0xa288('0xc'),_0x156720,_0xa288('0xd'));_0x14e4a6(_0x1a0c06['result'][_0xa288('0x11')]);}})[_0xa288('0x12')](function(_0x299ede){logger[_0xa288('0xf')](_0xa288('0xc'),_0x156720,_0x299ede);_0x1e8412(_0x299ede);});});}exports[_0xa288('0x13')]=function(_0x49d93c){var _0x2adc53=this;return new Promise(function(_0x3f14b7,_0x56bd2d){return db['ZohoAccount'][_0xa288('0x14')]({'raw':_0x49d93c[_0xa288('0x15')]?_0x49d93c[_0xa288('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x49d93c[_0xa288('0x15')]?_0x49d93c[_0xa288('0x15')][_0xa288('0x16')]||null:null,'attributes':_0x49d93c['options']?_0x49d93c[_0xa288('0x15')][_0xa288('0x17')]||null:null,'limit':_0x49d93c[_0xa288('0x15')]?_0x49d93c[_0xa288('0x15')][_0xa288('0x18')]||null:null,'include':_0x49d93c['options']?_0x49d93c['options'][_0xa288('0x19')]?_[_0xa288('0x1a')](_0x49d93c[_0xa288('0x15')][_0xa288('0x19')],function(_0x4895bb){return{'model':db[_0x4895bb[_0xa288('0x1b')]],'as':_0x4895bb['as'],'attributes':_0x4895bb[_0xa288('0x17')],'include':_0x4895bb[_0xa288('0x19')]?_[_0xa288('0x1a')](_0x4895bb[_0xa288('0x19')],function(_0x23f7b8){return{'model':db[_0x23f7b8[_0xa288('0x1b')]],'as':_0x23f7b8['as'],'attributes':_0x23f7b8[_0xa288('0x17')],'include':_0x23f7b8[_0xa288('0x19')]?_[_0xa288('0x1a')](_0x23f7b8[_0xa288('0x19')],function(_0xffc6b4){return{'model':db[_0xffc6b4[_0xa288('0x1b')]],'as':_0xffc6b4['as'],'attributes':_0xffc6b4[_0xa288('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa288('0xa')](function(_0x5878fb){logger['info'](_0xa288('0x13'),_0x49d93c);logger[_0xa288('0x1c')](_0xa288('0x13'),_0x49d93c,JSON[_0xa288('0xe')](_0x5878fb));_0x3f14b7(_0x5878fb);})[_0xa288('0x12')](function(_0x3bbbc8){logger[_0xa288('0xf')](_0xa288('0x13'),_0x3bbbc8[_0xa288('0x11')],_0x49d93c);_0x56bd2d(_0x2adc53[_0xa288('0xf')](0x1f4,_0x3bbbc8[_0xa288('0x11')]));});});};exports[_0xa288('0x1d')]=function(_0xba620d){var _0x307c5b=this;return new Promise(function(_0x1c0b93,_0x3080d8){return db[_0xa288('0x1e')]['find']({'raw':_0xba620d[_0xa288('0x15')]?_0xba620d['options'][_0xa288('0x1f')]===undefined?!![]:![]:!![],'where':_0xba620d[_0xa288('0x15')]?_0xba620d[_0xa288('0x15')]['where']||null:null,'attributes':_0xba620d[_0xa288('0x15')]?_0xba620d[_0xa288('0x15')][_0xa288('0x17')]||null:null,'include':_0xba620d[_0xa288('0x15')]?_0xba620d[_0xa288('0x15')][_0xa288('0x19')]?_[_0xa288('0x1a')](_0xba620d[_0xa288('0x15')][_0xa288('0x19')],function(_0x5b37f8){return{'model':db[_0x5b37f8['model']],'as':_0x5b37f8['as'],'attributes':_0x5b37f8['attributes'],'include':_0x5b37f8[_0xa288('0x19')]?_['map'](_0x5b37f8[_0xa288('0x19')],function(_0x15f103){return{'model':db[_0x15f103[_0xa288('0x1b')]],'as':_0x15f103['as'],'attributes':_0x15f103[_0xa288('0x17')],'include':_0x15f103[_0xa288('0x19')]?_[_0xa288('0x1a')](_0x15f103['include'],function(_0x5b0a8b){return{'model':db[_0x5b0a8b['model']],'as':_0x5b0a8b['as'],'attributes':_0x5b0a8b[_0xa288('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa288('0xa')](function(_0x539821){logger[_0xa288('0xb')](_0xa288('0x1d'),_0xba620d);logger['debug'](_0xa288('0x1d'),_0xba620d,JSON[_0xa288('0xe')](_0x539821));_0x1c0b93(_0x539821);})[_0xa288('0x12')](function(_0xc80e41){logger[_0xa288('0xf')](_0xa288('0x1d'),_0xc80e41['message'],_0xba620d);_0x3080d8(_0x307c5b[_0xa288('0xf')](0x1f4,_0xc80e41[_0xa288('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 16eea64..ba30fbb 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 _0x5fa8=['show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x50e584,_0x47a56a){var _0x52be26=function(_0x59b073){while(--_0x59b073){_0x50e584['push'](_0x50e584['shift']());}};_0x52be26(++_0x47a56a);}(_0x5fa8,0x1ed));var _0x85fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fa8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x85fa('0x0'));var util=require(_0x85fa('0x1'));var path=require(_0x85fa('0x2'));var timeout=require('connect-timeout');var express=require(_0x85fa('0x3'));var router=express[_0x85fa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x85fa('0x5'));var interaction=require(_0x85fa('0x6'));var config=require(_0x85fa('0x7'));var controller=require(_0x85fa('0x8'));router[_0x85fa('0x9')]('/',auth[_0x85fa('0xa')](),controller[_0x85fa('0xb')]);router[_0x85fa('0x9')](_0x85fa('0xc'),auth[_0x85fa('0xa')](),controller[_0x85fa('0xd')]);router[_0x85fa('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x85fa('0xe')]);router[_0x85fa('0x9')](_0x85fa('0xf'),auth[_0x85fa('0xa')](),controller['getSubjects']);router[_0x85fa('0x9')](_0x85fa('0x10'),auth['isAuthenticated'](),controller[_0x85fa('0x11')]);router['post']('/',auth[_0x85fa('0xa')](),controller[_0x85fa('0x12')]);router[_0x85fa('0x13')](_0x85fa('0xc'),auth[_0x85fa('0xa')](),controller[_0x85fa('0x14')]);router[_0x85fa('0x15')](_0x85fa('0xc'),auth['isAuthenticated'](),controller[_0x85fa('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe94f=['/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xe94f,0xfb));var _0xfe94=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xe94f[_0x4c0622];return _0x1799d8;};'use strict';var multer=require(_0xfe94('0x0'));var util=require(_0xfe94('0x1'));var path=require(_0xfe94('0x2'));var timeout=require(_0xfe94('0x3'));var express=require(_0xfe94('0x4'));var router=express[_0xfe94('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfe94('0x6'));var interaction=require(_0xfe94('0x7'));var config=require(_0xfe94('0x8'));var controller=require(_0xfe94('0x9'));router[_0xfe94('0xa')]('/',auth[_0xfe94('0xb')](),controller[_0xfe94('0xc')]);router[_0xfe94('0xa')](_0xfe94('0xd'),auth[_0xfe94('0xb')](),controller['show']);router[_0xfe94('0xa')](_0xfe94('0xe'),auth[_0xfe94('0xb')](),controller[_0xfe94('0xf')]);router[_0xfe94('0xa')](_0xfe94('0x10'),auth[_0xfe94('0xb')](),controller[_0xfe94('0x11')]);router[_0xfe94('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xfe94('0x12')]);router['post']('/',auth[_0xfe94('0xb')](),controller[_0xfe94('0x13')]);router['put'](_0xfe94('0xd'),auth[_0xfe94('0xb')](),controller[_0xfe94('0x14')]);router['delete'](_0xfe94('0xd'),auth[_0xfe94('0xb')](),controller['destroy']);module[_0xfe94('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2ff92e7..2029e1a 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 _0x28dc=['contact','contact_lead','exports','STRING','lead','ENUM'];(function(_0x5807ce,_0x2370c9){var _0x1553ba=function(_0x160887){while(--_0x160887){_0x5807ce['push'](_0x5807ce['shift']());}};_0x1553ba(++_0x2370c9);}(_0x28dc,0xe6));var _0xc28d=function(_0x3388d8,_0x256024){_0x3388d8=_0x3388d8-0x0;var _0x2bbe73=_0x28dc[_0x3388d8];return _0x2bbe73;};'use strict';var Sequelize=require('sequelize');module[_0xc28d('0x0')]={'name':{'type':Sequelize[_0xc28d('0x1')]},'moduleCreate':{'type':Sequelize['ENUM']('lead','contact','nothing'),'defaultValue':_0xc28d('0x2')},'moduleSearch':{'type':Sequelize[_0xc28d('0x3')]('contact_lead',_0xc28d('0x4'),'lead'),'defaultValue':_0xc28d('0x5')},'description':{'type':Sequelize[_0xc28d('0x1')]}}; \ No newline at end of file +var _0xfd0f=['exports','ENUM','lead','contact','contact_lead','STRING','sequelize'];(function(_0x3fc0ba,_0x599b3e){var _0x2ecb22=function(_0x306914){while(--_0x306914){_0x3fc0ba['push'](_0x3fc0ba['shift']());}};_0x2ecb22(++_0x599b3e);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x5c472c,_0x77fab5){_0x5c472c=_0x5c472c-0x0;var _0x28def7=_0xfd0f[_0x5c472c];return _0x28def7;};'use strict';var Sequelize=require(_0xffd0('0x0'));module[_0xffd0('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xffd0('0x2')](_0xffd0('0x3'),_0xffd0('0x4'),'nothing'),'defaultValue':_0xffd0('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xffd0('0x5'),_0xffd0('0x4'),_0xffd0('0x3')),'defaultValue':_0xffd0('0x5')},'description':{'type':Sequelize[_0xffd0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c7c09a7..0e57107 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 _0x4001=['nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','ZohoConfiguration','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x44984b,_0x327f80){var _0x1c0ff1=function(_0x1816f4){while(--_0x1816f4){_0x44984b['push'](_0x44984b['shift']());}};_0x1c0ff1(++_0x327f80);}(_0x4001,0x1b1));var _0x1400=function(_0x498d4f,_0x6e928e){_0x498d4f=_0x498d4f-0x0;var _0x1c81a8=_0x4001[_0x498d4f];return _0x1c81a8;};'use strict';var emlformat=require(_0x1400('0x0'));var rimraf=require(_0x1400('0x1'));var zipdir=require(_0x1400('0x2'));var jsonpatch=require(_0x1400('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1400('0x4'));var Mustache=require(_0x1400('0x5'));var util=require(_0x1400('0x6'));var path=require(_0x1400('0x7'));var sox=require(_0x1400('0x8'));var csv=require(_0x1400('0x9'));var ejs=require(_0x1400('0xa'));var fs=require('fs');var fs_extra=require(_0x1400('0xb'));var _=require(_0x1400('0xc'));var squel=require(_0x1400('0xd'));var crypto=require('crypto');var jsforce=require(_0x1400('0xe'));var deskjs=require(_0x1400('0xf'));var toCsv=require(_0x1400('0x9'));var querystring=require(_0x1400('0x10'));var Papa=require(_0x1400('0x11'));var Redis=require(_0x1400('0x12'));var authService=require(_0x1400('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1400('0x14'));var logger=require(_0x1400('0x15'))('api');var utils=require(_0x1400('0x16'));var config=require(_0x1400('0x17'));var licenseUtil=require(_0x1400('0x18'));var db=require(_0x1400('0x19'))['db'];function respondWithStatusCode(_0x24f1ce,_0x2ddb74){_0x2ddb74=_0x2ddb74||0xcc;return function(_0x42538e){if(_0x42538e){return _0x24f1ce[_0x1400('0x1a')](_0x2ddb74);}return _0x24f1ce[_0x1400('0x1b')](_0x2ddb74)[_0x1400('0x1c')]();};}function respondWithResult(_0x409340,_0x1c4627){_0x1c4627=_0x1c4627||0xc8;return function(_0x38dcb7){if(_0x38dcb7){return _0x409340['status'](_0x1c4627)[_0x1400('0x1d')](_0x38dcb7);}};}function respondWithFilteredResult(_0x33b223,_0x2118f9){return function(_0x3441a0){if(_0x3441a0){var _0xa144b1=typeof _0x2118f9[_0x1400('0x1e')]===_0x1400('0x1f')&&typeof _0x2118f9[_0x1400('0x20')]===_0x1400('0x1f');var _0x51a86d=_0x3441a0[_0x1400('0x21')];var _0x6793fb=_0xa144b1?0x0:_0x2118f9[_0x1400('0x1e')];var _0x3496ce=_0xa144b1?_0x3441a0[_0x1400('0x21')]:_0x2118f9[_0x1400('0x1e')]+_0x2118f9[_0x1400('0x20')];var _0x330229;if(_0x3496ce>=_0x51a86d){_0x3496ce=_0x51a86d;_0x330229=0xc8;}else{_0x330229=0xce;}_0x33b223[_0x1400('0x1b')](_0x330229);return _0x33b223[_0x1400('0x22')](_0x1400('0x23'),_0x6793fb+'-'+_0x3496ce+'/'+_0x51a86d)[_0x1400('0x1d')](_0x3441a0);}return null;};}function patchUpdates(_0x1ecf48){return function(_0x14a365){try{jsonpatch[_0x1400('0x24')](_0x14a365,_0x1ecf48,!![]);}catch(_0x1b6d9d){return BPromise[_0x1400('0x25')](_0x1b6d9d);}return _0x14a365['save']();};}function saveUpdates(_0xedfe7f,_0x197a08){return function(_0x39f70a){if(_0x39f70a){return _0x39f70a[_0x1400('0x26')](_0xedfe7f)[_0x1400('0x27')](function(_0x549b61){return _0x549b61;});}return null;};}function removeEntity(_0x4dd1ed,_0x1a2ef7){return function(_0x2f1057){if(_0x2f1057){return _0x2f1057[_0x1400('0x28')]()[_0x1400('0x27')](function(){_0x4dd1ed[_0x1400('0x1b')](0xcc)[_0x1400('0x1c')]();});}};}function handleEntityNotFound(_0x1e1a60,_0x5d48af){return function(_0x5f4737){if(!_0x5f4737){_0x1e1a60[_0x1400('0x1a')](0x194);}return _0x5f4737;};}function handleError(_0x5e84bc,_0x32c0b0){_0x32c0b0=_0x32c0b0||0x1f4;return function(_0x515219){logger[_0x1400('0x29')](_0x515219[_0x1400('0x2a')]);if(_0x515219[_0x1400('0x2b')]){delete _0x515219[_0x1400('0x2b')];}_0x5e84bc[_0x1400('0x1b')](_0x32c0b0)['send'](_0x515219);};}exports[_0x1400('0x2c')]=function(_0x2804fb,_0x51f49d){var _0x10ceab={},_0x3691dc={},_0x20c234={'count':0x0,'rows':[]};var _0x4be043=_['map'](db['ZohoConfiguration'][_0x1400('0x2d')],function(_0x2a0a1f){return{'name':_0x2a0a1f[_0x1400('0x2e')],'type':_0x2a0a1f[_0x1400('0x2f')][_0x1400('0x30')]};});_0x3691dc['model']=_[_0x1400('0x31')](_0x4be043,_0x1400('0x2b'));_0x3691dc[_0x1400('0x32')]=_[_0x1400('0x33')](_0x2804fb[_0x1400('0x32')]);_0x3691dc[_0x1400('0x34')]=_[_0x1400('0x35')](_0x3691dc[_0x1400('0x36')],_0x3691dc[_0x1400('0x32')]);_0x10ceab[_0x1400('0x37')]=_[_0x1400('0x35')](_0x3691dc[_0x1400('0x36')],qs[_0x1400('0x38')](_0x2804fb[_0x1400('0x32')][_0x1400('0x38')]));_0x10ceab['attributes']=_0x10ceab[_0x1400('0x37')][_0x1400('0x39')]?_0x10ceab[_0x1400('0x37')]:_0x3691dc['model'];if(!_0x2804fb[_0x1400('0x32')][_0x1400('0x3a')](_0x1400('0x3b'))){_0x10ceab[_0x1400('0x20')]=qs[_0x1400('0x20')](_0x2804fb[_0x1400('0x32')]['limit']);_0x10ceab['offset']=qs[_0x1400('0x1e')](_0x2804fb[_0x1400('0x32')][_0x1400('0x1e')]);}_0x10ceab[_0x1400('0x3c')]=qs[_0x1400('0x3d')](_0x2804fb[_0x1400('0x32')][_0x1400('0x3d')]);_0x10ceab['where']=qs[_0x1400('0x34')](_[_0x1400('0x3e')](_0x2804fb[_0x1400('0x32')],_0x3691dc[_0x1400('0x34')]),_0x4be043);if(_0x2804fb[_0x1400('0x32')][_0x1400('0x3f')]){_0x10ceab['where']=_['merge'](_0x10ceab['where'],{'$or':_[_0x1400('0x31')](_0x4be043,function(_0x289cce){if(_0x289cce['type']!==_0x1400('0x40')){var _0x411d87={};_0x411d87[_0x289cce[_0x1400('0x2b')]]={'$like':'%'+_0x2804fb[_0x1400('0x32')][_0x1400('0x3f')]+'%'};return _0x411d87;}})});}_0x10ceab=_[_0x1400('0x41')]({},_0x10ceab,_0x2804fb[_0x1400('0x42')]);var _0x22da38={'where':_0x10ceab[_0x1400('0x43')]};return db[_0x1400('0x44')][_0x1400('0x21')](_0x22da38)['then'](function(_0x575b7b){_0x20c234[_0x1400('0x21')]=_0x575b7b;if(_0x2804fb[_0x1400('0x32')][_0x1400('0x45')]){_0x10ceab[_0x1400('0x46')]=[{'all':!![]}];}return db[_0x1400('0x44')][_0x1400('0x47')](_0x10ceab);})['then'](function(_0x1833b7){_0x20c234[_0x1400('0x48')]=_0x1833b7;return _0x20c234;})[_0x1400('0x27')](respondWithFilteredResult(_0x51f49d,_0x10ceab))[_0x1400('0x49')](handleError(_0x51f49d,null));};exports['show']=function(_0x5b8efd,_0x532ccc){var _0x2342d6={'raw':![],'where':{'id':_0x5b8efd[_0x1400('0x4a')]['id']}},_0x173347={};_0x173347[_0x1400('0x36')]=_[_0x1400('0x33')](db[_0x1400('0x44')][_0x1400('0x2d')]);_0x173347[_0x1400('0x32')]=_[_0x1400('0x33')](_0x5b8efd[_0x1400('0x32')]);_0x173347[_0x1400('0x34')]=_[_0x1400('0x35')](_0x173347[_0x1400('0x36')],_0x173347[_0x1400('0x32')]);_0x2342d6[_0x1400('0x37')]=_[_0x1400('0x35')](_0x173347[_0x1400('0x36')],qs[_0x1400('0x38')](_0x5b8efd[_0x1400('0x32')][_0x1400('0x38')]));_0x2342d6[_0x1400('0x37')]=_0x2342d6[_0x1400('0x37')]['length']?_0x2342d6['attributes']:_0x173347[_0x1400('0x36')];if(_0x5b8efd[_0x1400('0x32')][_0x1400('0x45')]){_0x2342d6[_0x1400('0x46')]=[{'all':!![]}];}_0x2342d6=_['merge']({},_0x2342d6,_0x5b8efd[_0x1400('0x42')]);return db[_0x1400('0x44')][_0x1400('0x4b')](_0x2342d6)[_0x1400('0x27')](handleEntityNotFound(_0x532ccc,null))[_0x1400('0x27')](respondWithResult(_0x532ccc,null))[_0x1400('0x49')](handleError(_0x532ccc,null));};exports[_0x1400('0x4c')]=function(_0x330354,_0x3d2769){return db[_0x1400('0x44')][_0x1400('0x4c')](_0x330354[_0x1400('0x4d')],{})['then'](respondWithResult(_0x3d2769,0xc9))[_0x1400('0x49')](handleError(_0x3d2769,null));};exports[_0x1400('0x26')]=function(_0x432933,_0xb70c66){if(_0x432933[_0x1400('0x4d')]['id']){delete _0x432933[_0x1400('0x4d')]['id'];}return db[_0x1400('0x44')][_0x1400('0x4b')]({'where':{'id':_0x432933[_0x1400('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb70c66,null))[_0x1400('0x27')](saveUpdates(_0x432933[_0x1400('0x4d')],null))[_0x1400('0x27')](respondWithResult(_0xb70c66,null))[_0x1400('0x49')](handleError(_0xb70c66,null));};exports[_0x1400('0x28')]=function(_0x8bf071,_0x4c391e){return db[_0x1400('0x44')]['find']({'where':{'id':_0x8bf071[_0x1400('0x4a')]['id']}})[_0x1400('0x27')](handleEntityNotFound(_0x4c391e,null))[_0x1400('0x27')](removeEntity(_0x4c391e,null))['catch'](handleError(_0x4c391e,null));};exports[_0x1400('0x4e')]=function(_0x46a5e2,_0x58cd40,_0x5eda1d){var _0x505347={};var _0x441b0e={};var _0x44c595;var _0x189a11;return db[_0x1400('0x44')][_0x1400('0x4f')]({'where':{'id':_0x46a5e2[_0x1400('0x4a')]['id']}})[_0x1400('0x27')](handleEntityNotFound(_0x58cd40,null))[_0x1400('0x27')](function(_0x2cc26e){if(_0x2cc26e){_0x44c595=_0x2cc26e;_0x441b0e['model']=_[_0x1400('0x33')](db[_0x1400('0x50')]['rawAttributes']);_0x441b0e[_0x1400('0x32')]=_[_0x1400('0x33')](_0x46a5e2[_0x1400('0x32')]);_0x441b0e[_0x1400('0x34')]=_['intersection'](_0x441b0e[_0x1400('0x36')],_0x441b0e[_0x1400('0x32')]);_0x505347[_0x1400('0x37')]=_['intersection'](_0x441b0e[_0x1400('0x36')],qs[_0x1400('0x38')](_0x46a5e2[_0x1400('0x32')]['fields']));_0x505347['attributes']=_0x505347['attributes'][_0x1400('0x39')]?_0x505347[_0x1400('0x37')]:_0x441b0e[_0x1400('0x36')];_0x505347[_0x1400('0x3c')]=qs[_0x1400('0x3d')](_0x46a5e2[_0x1400('0x32')][_0x1400('0x3d')]);_0x505347[_0x1400('0x43')]=qs[_0x1400('0x34')](_[_0x1400('0x3e')](_0x46a5e2[_0x1400('0x32')],_0x441b0e['filters']));if(_0x46a5e2[_0x1400('0x32')][_0x1400('0x3f')]){_0x505347[_0x1400('0x43')]=_['merge'](_0x505347[_0x1400('0x43')],{'$or':_[_0x1400('0x31')](_0x505347['attributes'],function(_0x4b2a0f){var _0x8bc869={};_0x8bc869[_0x4b2a0f]={'$like':'%'+_0x46a5e2[_0x1400('0x32')][_0x1400('0x3f')]+'%'};return _0x8bc869;})});}_0x505347=_[_0x1400('0x41')]({},_0x505347,_0x46a5e2[_0x1400('0x42')]);return _0x44c595[_0x1400('0x4e')](_0x505347);}})[_0x1400('0x27')](function(_0x41feca){if(_0x41feca){_0x189a11=_0x41feca[_0x1400('0x39')];if(!_0x46a5e2[_0x1400('0x32')][_0x1400('0x3a')]('nolimit')){_0x505347[_0x1400('0x20')]=qs['limit'](_0x46a5e2[_0x1400('0x32')][_0x1400('0x20')]);_0x505347[_0x1400('0x1e')]=qs[_0x1400('0x1e')](_0x46a5e2[_0x1400('0x32')][_0x1400('0x1e')]);}return _0x44c595[_0x1400('0x4e')](_0x505347);}})[_0x1400('0x27')](function(_0x306e7f){if(_0x306e7f){return _0x306e7f?{'count':_0x189a11,'rows':_0x306e7f}:null;}})['then'](respondWithResult(_0x58cd40,null))[_0x1400('0x49')](handleError(_0x58cd40,null));};exports['getSubjects']=function(_0x26eb6e,_0x2fccd1,_0x39d294){var _0xcec32d={};var _0x4f78ce={};var _0x448cc3;var _0x3de9b2;return db['ZohoConfiguration'][_0x1400('0x4f')]({'where':{'id':_0x26eb6e['params']['id']}})[_0x1400('0x27')](handleEntityNotFound(_0x2fccd1,null))[_0x1400('0x27')](function(_0x2cc21a){if(_0x2cc21a){_0x448cc3=_0x2cc21a;_0x4f78ce['model']=_['keys'](db['ZohoField']['rawAttributes']);_0x4f78ce[_0x1400('0x32')]=_[_0x1400('0x33')](_0x26eb6e[_0x1400('0x32')]);_0x4f78ce['filters']=_[_0x1400('0x35')](_0x4f78ce[_0x1400('0x36')],_0x4f78ce[_0x1400('0x32')]);_0xcec32d[_0x1400('0x37')]=_['intersection'](_0x4f78ce[_0x1400('0x36')],qs['fields'](_0x26eb6e[_0x1400('0x32')][_0x1400('0x38')]));_0xcec32d[_0x1400('0x37')]=_0xcec32d[_0x1400('0x37')][_0x1400('0x39')]?_0xcec32d[_0x1400('0x37')]:_0x4f78ce[_0x1400('0x36')];_0xcec32d[_0x1400('0x3c')]=qs[_0x1400('0x3d')](_0x26eb6e[_0x1400('0x32')][_0x1400('0x3d')]);_0xcec32d[_0x1400('0x43')]=qs['filters'](_[_0x1400('0x3e')](_0x26eb6e[_0x1400('0x32')],_0x4f78ce[_0x1400('0x34')]));if(_0x26eb6e[_0x1400('0x32')][_0x1400('0x3f')]){_0xcec32d[_0x1400('0x43')]=_[_0x1400('0x41')](_0xcec32d[_0x1400('0x43')],{'$or':_[_0x1400('0x31')](_0xcec32d[_0x1400('0x37')],function(_0x353924){var _0x58cf9c={};_0x58cf9c[_0x353924]={'$like':'%'+_0x26eb6e['query'][_0x1400('0x3f')]+'%'};return _0x58cf9c;})});}_0xcec32d=_[_0x1400('0x41')]({},_0xcec32d,_0x26eb6e[_0x1400('0x42')]);return _0x448cc3['getSubjects'](_0xcec32d);}})['then'](function(_0xd4a6f8){if(_0xd4a6f8){_0x3de9b2=_0xd4a6f8[_0x1400('0x39')];if(!_0x26eb6e[_0x1400('0x32')]['hasOwnProperty'](_0x1400('0x3b'))){_0xcec32d['limit']=qs['limit'](_0x26eb6e[_0x1400('0x32')][_0x1400('0x20')]);_0xcec32d[_0x1400('0x1e')]=qs['offset'](_0x26eb6e[_0x1400('0x32')][_0x1400('0x1e')]);}return _0x448cc3['getSubjects'](_0xcec32d);}})['then'](function(_0x513614){if(_0x513614){return _0x513614?{'count':_0x3de9b2,'rows':_0x513614}:null;}})[_0x1400('0x27')](respondWithResult(_0x2fccd1,null))[_0x1400('0x49')](handleError(_0x2fccd1,null));};exports[_0x1400('0x51')]=function(_0x24c42c,_0x3c36db,_0xfbc1d6){var _0x57c6ba={};var _0x54e0eb={};var _0xe3d7b6;var _0x3e1449;return db['ZohoConfiguration'][_0x1400('0x4f')]({'where':{'id':_0x24c42c[_0x1400('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c36db,null))[_0x1400('0x27')](function(_0x3b4f59){if(_0x3b4f59){_0xe3d7b6=_0x3b4f59;_0x54e0eb['model']=_[_0x1400('0x33')](db['ZohoField']['rawAttributes']);_0x54e0eb['query']=_[_0x1400('0x33')](_0x24c42c[_0x1400('0x32')]);_0x54e0eb[_0x1400('0x34')]=_[_0x1400('0x35')](_0x54e0eb[_0x1400('0x36')],_0x54e0eb[_0x1400('0x32')]);_0x57c6ba['attributes']=_[_0x1400('0x35')](_0x54e0eb[_0x1400('0x36')],qs[_0x1400('0x38')](_0x24c42c[_0x1400('0x32')][_0x1400('0x38')]));_0x57c6ba[_0x1400('0x37')]=_0x57c6ba[_0x1400('0x37')][_0x1400('0x39')]?_0x57c6ba[_0x1400('0x37')]:_0x54e0eb[_0x1400('0x36')];_0x57c6ba[_0x1400('0x3c')]=qs[_0x1400('0x3d')](_0x24c42c[_0x1400('0x32')][_0x1400('0x3d')]);_0x57c6ba['where']=qs[_0x1400('0x34')](_[_0x1400('0x3e')](_0x24c42c['query'],_0x54e0eb['filters']));if(_0x24c42c[_0x1400('0x32')][_0x1400('0x3f')]){_0x57c6ba[_0x1400('0x43')]=_['merge'](_0x57c6ba[_0x1400('0x43')],{'$or':_[_0x1400('0x31')](_0x57c6ba['attributes'],function(_0x229430){var _0x19bc69={};_0x19bc69[_0x229430]={'$like':'%'+_0x24c42c[_0x1400('0x32')][_0x1400('0x3f')]+'%'};return _0x19bc69;})});}_0x57c6ba=_['merge']({},_0x57c6ba,_0x24c42c[_0x1400('0x42')]);return _0xe3d7b6[_0x1400('0x51')](_0x57c6ba);}})[_0x1400('0x27')](function(_0x39cda6){if(_0x39cda6){_0x3e1449=_0x39cda6[_0x1400('0x39')];if(!_0x24c42c['query'][_0x1400('0x3a')](_0x1400('0x3b'))){_0x57c6ba[_0x1400('0x20')]=qs[_0x1400('0x20')](_0x24c42c['query'][_0x1400('0x20')]);_0x57c6ba[_0x1400('0x1e')]=qs[_0x1400('0x1e')](_0x24c42c['query'][_0x1400('0x1e')]);}return _0xe3d7b6[_0x1400('0x51')](_0x57c6ba);}})[_0x1400('0x27')](function(_0x1946fc){if(_0x1946fc){return _0x1946fc?{'count':_0x3e1449,'rows':_0x1946fc}:null;}})[_0x1400('0x27')](respondWithResult(_0x3c36db,null))[_0x1400('0x49')](handleError(_0x3c36db,null));}; \ No newline at end of file +var _0xb67a=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','name','index','map','ZohoConfiguration','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','eml-format','zip-dir','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','api'];(function(_0x4bc235,_0x17570f){var _0x403090=function(_0x552a7a){while(--_0x552a7a){_0x4bc235['push'](_0x4bc235['shift']());}};_0x403090(++_0x17570f);}(_0xb67a,0x1c9));var _0xab67=function(_0x7ff21e,_0x36ea9b){_0x7ff21e=_0x7ff21e-0x0;var _0x571cd5=_0xb67a[_0x7ff21e];return _0x571cd5;};'use strict';var emlformat=require(_0xab67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xab67('0x1'));var jsonpatch=require(_0xab67('0x2'));var rp=require(_0xab67('0x3'));var moment=require(_0xab67('0x4'));var BPromise=require(_0xab67('0x5'));var Mustache=require(_0xab67('0x6'));var util=require('util');var path=require(_0xab67('0x7'));var sox=require(_0xab67('0x8'));var csv=require(_0xab67('0x9'));var ejs=require(_0xab67('0xa'));var fs=require('fs');var fs_extra=require(_0xab67('0xb'));var _=require(_0xab67('0xc'));var squel=require(_0xab67('0xd'));var crypto=require(_0xab67('0xe'));var jsforce=require(_0xab67('0xf'));var deskjs=require(_0xab67('0x10'));var toCsv=require(_0xab67('0x9'));var querystring=require('querystring');var Papa=require(_0xab67('0x11'));var Redis=require(_0xab67('0x12'));var authService=require(_0xab67('0x13'));var qs=require(_0xab67('0x14'));var as=require(_0xab67('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab67('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xab67('0x17'));var db=require(_0xab67('0x18'))['db'];function respondWithStatusCode(_0x2c331c,_0x2464d2){_0x2464d2=_0x2464d2||0xcc;return function(_0x12ad6a){if(_0x12ad6a){return _0x2c331c[_0xab67('0x19')](_0x2464d2);}return _0x2c331c[_0xab67('0x1a')](_0x2464d2)[_0xab67('0x1b')]();};}function respondWithResult(_0xcab64e,_0x674a6a){_0x674a6a=_0x674a6a||0xc8;return function(_0x5fc986){if(_0x5fc986){return _0xcab64e[_0xab67('0x1a')](_0x674a6a)[_0xab67('0x1c')](_0x5fc986);}};}function respondWithFilteredResult(_0x3a365b,_0x4a314c){return function(_0x263519){if(_0x263519){var _0x1cc464=typeof _0x4a314c['offset']===_0xab67('0x1d')&&typeof _0x4a314c['limit']===_0xab67('0x1d');var _0x31bdec=_0x263519['count'];var _0x1ae7de=_0x1cc464?0x0:_0x4a314c[_0xab67('0x1e')];var _0x370e69=_0x1cc464?_0x263519[_0xab67('0x1f')]:_0x4a314c[_0xab67('0x1e')]+_0x4a314c[_0xab67('0x20')];var _0x2e4e77;if(_0x370e69>=_0x31bdec){_0x370e69=_0x31bdec;_0x2e4e77=0xc8;}else{_0x2e4e77=0xce;}_0x3a365b[_0xab67('0x1a')](_0x2e4e77);return _0x3a365b[_0xab67('0x21')](_0xab67('0x22'),_0x1ae7de+'-'+_0x370e69+'/'+_0x31bdec)[_0xab67('0x1c')](_0x263519);}return null;};}function patchUpdates(_0x26cb77){return function(_0x52ca75){try{jsonpatch[_0xab67('0x23')](_0x52ca75,_0x26cb77,!![]);}catch(_0x24f131){return BPromise[_0xab67('0x24')](_0x24f131);}return _0x52ca75['save']();};}function saveUpdates(_0x2e68a9,_0x4295ac){return function(_0x250591){if(_0x250591){return _0x250591[_0xab67('0x25')](_0x2e68a9)['then'](function(_0x5877ad){return _0x5877ad;});}return null;};}function removeEntity(_0x479eda,_0x57c09b){return function(_0xeebd15){if(_0xeebd15){return _0xeebd15['destroy']()[_0xab67('0x26')](function(){_0x479eda[_0xab67('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a297b,_0x309894){return function(_0x3a59f0){if(!_0x3a59f0){_0x5a297b['sendStatus'](0x194);}return _0x3a59f0;};}function handleError(_0x457e91,_0x59d69f){_0x59d69f=_0x59d69f||0x1f4;return function(_0x3bc2e8){logger['error'](_0x3bc2e8['stack']);if(_0x3bc2e8['name']){delete _0x3bc2e8[_0xab67('0x27')];}_0x457e91[_0xab67('0x1a')](_0x59d69f)['send'](_0x3bc2e8);};}exports[_0xab67('0x28')]=function(_0x1993d8,_0x1f0d62){var _0x17587a={},_0x46a4ec={},_0x40b0e4={'count':0x0,'rows':[]};var _0x299bde=_[_0xab67('0x29')](db[_0xab67('0x2a')][_0xab67('0x2b')],function(_0x505632){return{'name':_0x505632[_0xab67('0x2c')],'type':_0x505632['type']['key']};});_0x46a4ec[_0xab67('0x2d')]=_['map'](_0x299bde,_0xab67('0x27'));_0x46a4ec[_0xab67('0x2e')]=_['keys'](_0x1993d8[_0xab67('0x2e')]);_0x46a4ec[_0xab67('0x2f')]=_[_0xab67('0x30')](_0x46a4ec[_0xab67('0x2d')],_0x46a4ec[_0xab67('0x2e')]);_0x17587a['attributes']=_[_0xab67('0x30')](_0x46a4ec[_0xab67('0x2d')],qs['fields'](_0x1993d8[_0xab67('0x2e')][_0xab67('0x31')]));_0x17587a[_0xab67('0x32')]=_0x17587a['attributes'][_0xab67('0x33')]?_0x17587a['attributes']:_0x46a4ec[_0xab67('0x2d')];if(!_0x1993d8[_0xab67('0x2e')][_0xab67('0x34')](_0xab67('0x35'))){_0x17587a[_0xab67('0x20')]=qs[_0xab67('0x20')](_0x1993d8['query'][_0xab67('0x20')]);_0x17587a[_0xab67('0x1e')]=qs[_0xab67('0x1e')](_0x1993d8['query']['offset']);}_0x17587a['order']=qs[_0xab67('0x36')](_0x1993d8[_0xab67('0x2e')]['sort']);_0x17587a[_0xab67('0x37')]=qs[_0xab67('0x2f')](_[_0xab67('0x38')](_0x1993d8[_0xab67('0x2e')],_0x46a4ec[_0xab67('0x2f')]),_0x299bde);if(_0x1993d8[_0xab67('0x2e')]['filter']){_0x17587a[_0xab67('0x37')]=_[_0xab67('0x39')](_0x17587a['where'],{'$or':_[_0xab67('0x29')](_0x299bde,function(_0x1c21ed){if(_0x1c21ed[_0xab67('0x3a')]!==_0xab67('0x3b')){var _0x552156={};_0x552156[_0x1c21ed[_0xab67('0x27')]]={'$like':'%'+_0x1993d8['query'][_0xab67('0x3c')]+'%'};return _0x552156;}})});}_0x17587a=_[_0xab67('0x39')]({},_0x17587a,_0x1993d8[_0xab67('0x3d')]);var _0x1b547f={'where':_0x17587a['where']};return db['ZohoConfiguration'][_0xab67('0x1f')](_0x1b547f)[_0xab67('0x26')](function(_0x56ff0f){_0x40b0e4['count']=_0x56ff0f;if(_0x1993d8[_0xab67('0x2e')][_0xab67('0x3e')]){_0x17587a[_0xab67('0x3f')]=[{'all':!![]}];}return db[_0xab67('0x2a')][_0xab67('0x40')](_0x17587a);})['then'](function(_0x282c99){_0x40b0e4[_0xab67('0x41')]=_0x282c99;return _0x40b0e4;})[_0xab67('0x26')](respondWithFilteredResult(_0x1f0d62,_0x17587a))['catch'](handleError(_0x1f0d62,null));};exports[_0xab67('0x42')]=function(_0x8fe941,_0x46f713){var _0x12a3a3={'raw':![],'where':{'id':_0x8fe941[_0xab67('0x43')]['id']}},_0x58098f={};_0x58098f[_0xab67('0x2d')]=_[_0xab67('0x44')](db[_0xab67('0x2a')]['rawAttributes']);_0x58098f[_0xab67('0x2e')]=_[_0xab67('0x44')](_0x8fe941[_0xab67('0x2e')]);_0x58098f[_0xab67('0x2f')]=_['intersection'](_0x58098f[_0xab67('0x2d')],_0x58098f[_0xab67('0x2e')]);_0x12a3a3[_0xab67('0x32')]=_['intersection'](_0x58098f[_0xab67('0x2d')],qs[_0xab67('0x31')](_0x8fe941['query'][_0xab67('0x31')]));_0x12a3a3[_0xab67('0x32')]=_0x12a3a3[_0xab67('0x32')][_0xab67('0x33')]?_0x12a3a3['attributes']:_0x58098f['model'];if(_0x8fe941[_0xab67('0x2e')][_0xab67('0x3e')]){_0x12a3a3[_0xab67('0x3f')]=[{'all':!![]}];}_0x12a3a3=_[_0xab67('0x39')]({},_0x12a3a3,_0x8fe941['options']);return db['ZohoConfiguration'][_0xab67('0x45')](_0x12a3a3)[_0xab67('0x26')](handleEntityNotFound(_0x46f713,null))[_0xab67('0x26')](respondWithResult(_0x46f713,null))[_0xab67('0x46')](handleError(_0x46f713,null));};exports[_0xab67('0x47')]=function(_0x597ba6,_0x540a3f){return db[_0xab67('0x2a')]['create'](_0x597ba6[_0xab67('0x48')],{})[_0xab67('0x26')](respondWithResult(_0x540a3f,0xc9))[_0xab67('0x46')](handleError(_0x540a3f,null));};exports[_0xab67('0x25')]=function(_0x2d50c0,_0x3b1c67){if(_0x2d50c0['body']['id']){delete _0x2d50c0['body']['id'];}return db['ZohoConfiguration'][_0xab67('0x45')]({'where':{'id':_0x2d50c0[_0xab67('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b1c67,null))[_0xab67('0x26')](saveUpdates(_0x2d50c0[_0xab67('0x48')],null))[_0xab67('0x26')](respondWithResult(_0x3b1c67,null))[_0xab67('0x46')](handleError(_0x3b1c67,null));};exports[_0xab67('0x49')]=function(_0x4d0b0c,_0x17ef09){return db[_0xab67('0x2a')][_0xab67('0x45')]({'where':{'id':_0x4d0b0c[_0xab67('0x43')]['id']}})[_0xab67('0x26')](handleEntityNotFound(_0x17ef09,null))[_0xab67('0x26')](removeEntity(_0x17ef09,null))[_0xab67('0x46')](handleError(_0x17ef09,null));};exports[_0xab67('0x4a')]=function(_0x1e5d13,_0x52303b,_0x1a4b84){var _0x530103={};var _0xd396a9={};var _0x5691fd;var _0x37e0c6;return db[_0xab67('0x2a')][_0xab67('0x4b')]({'where':{'id':_0x1e5d13['params']['id']}})[_0xab67('0x26')](handleEntityNotFound(_0x52303b,null))[_0xab67('0x26')](function(_0x1197ff){if(_0x1197ff){_0x5691fd=_0x1197ff;_0xd396a9[_0xab67('0x2d')]=_['keys'](db[_0xab67('0x4c')][_0xab67('0x2b')]);_0xd396a9[_0xab67('0x2e')]=_[_0xab67('0x44')](_0x1e5d13[_0xab67('0x2e')]);_0xd396a9[_0xab67('0x2f')]=_[_0xab67('0x30')](_0xd396a9['model'],_0xd396a9[_0xab67('0x2e')]);_0x530103['attributes']=_[_0xab67('0x30')](_0xd396a9[_0xab67('0x2d')],qs[_0xab67('0x31')](_0x1e5d13[_0xab67('0x2e')][_0xab67('0x31')]));_0x530103[_0xab67('0x32')]=_0x530103[_0xab67('0x32')][_0xab67('0x33')]?_0x530103['attributes']:_0xd396a9['model'];_0x530103[_0xab67('0x4d')]=qs[_0xab67('0x36')](_0x1e5d13[_0xab67('0x2e')][_0xab67('0x36')]);_0x530103['where']=qs['filters'](_[_0xab67('0x38')](_0x1e5d13[_0xab67('0x2e')],_0xd396a9[_0xab67('0x2f')]));if(_0x1e5d13['query'][_0xab67('0x3c')]){_0x530103[_0xab67('0x37')]=_[_0xab67('0x39')](_0x530103[_0xab67('0x37')],{'$or':_[_0xab67('0x29')](_0x530103[_0xab67('0x32')],function(_0x44abf1){var _0x94858b={};_0x94858b[_0x44abf1]={'$like':'%'+_0x1e5d13[_0xab67('0x2e')]['filter']+'%'};return _0x94858b;})});}_0x530103=_['merge']({},_0x530103,_0x1e5d13['options']);return _0x5691fd['getFields'](_0x530103);}})[_0xab67('0x26')](function(_0x59dd9e){if(_0x59dd9e){_0x37e0c6=_0x59dd9e[_0xab67('0x33')];if(!_0x1e5d13[_0xab67('0x2e')]['hasOwnProperty'](_0xab67('0x35'))){_0x530103[_0xab67('0x20')]=qs['limit'](_0x1e5d13[_0xab67('0x2e')][_0xab67('0x20')]);_0x530103['offset']=qs[_0xab67('0x1e')](_0x1e5d13[_0xab67('0x2e')][_0xab67('0x1e')]);}return _0x5691fd[_0xab67('0x4a')](_0x530103);}})['then'](function(_0x226cf8){if(_0x226cf8){return _0x226cf8?{'count':_0x37e0c6,'rows':_0x226cf8}:null;}})[_0xab67('0x26')](respondWithResult(_0x52303b,null))[_0xab67('0x46')](handleError(_0x52303b,null));};exports[_0xab67('0x4e')]=function(_0x31f21f,_0x7de885,_0x52c866){var _0x195099={};var _0x204912={};var _0x3a9e72;var _0x4f557c;return db[_0xab67('0x2a')][_0xab67('0x4b')]({'where':{'id':_0x31f21f[_0xab67('0x43')]['id']}})['then'](handleEntityNotFound(_0x7de885,null))[_0xab67('0x26')](function(_0xafcc37){if(_0xafcc37){_0x3a9e72=_0xafcc37;_0x204912[_0xab67('0x2d')]=_[_0xab67('0x44')](db[_0xab67('0x4c')][_0xab67('0x2b')]);_0x204912[_0xab67('0x2e')]=_[_0xab67('0x44')](_0x31f21f[_0xab67('0x2e')]);_0x204912[_0xab67('0x2f')]=_['intersection'](_0x204912[_0xab67('0x2d')],_0x204912[_0xab67('0x2e')]);_0x195099[_0xab67('0x32')]=_[_0xab67('0x30')](_0x204912[_0xab67('0x2d')],qs[_0xab67('0x31')](_0x31f21f[_0xab67('0x2e')][_0xab67('0x31')]));_0x195099['attributes']=_0x195099['attributes'][_0xab67('0x33')]?_0x195099['attributes']:_0x204912['model'];_0x195099['order']=qs[_0xab67('0x36')](_0x31f21f[_0xab67('0x2e')][_0xab67('0x36')]);_0x195099['where']=qs[_0xab67('0x2f')](_[_0xab67('0x38')](_0x31f21f[_0xab67('0x2e')],_0x204912[_0xab67('0x2f')]));if(_0x31f21f['query'][_0xab67('0x3c')]){_0x195099['where']=_[_0xab67('0x39')](_0x195099[_0xab67('0x37')],{'$or':_[_0xab67('0x29')](_0x195099[_0xab67('0x32')],function(_0xe9904f){var _0x59a617={};_0x59a617[_0xe9904f]={'$like':'%'+_0x31f21f[_0xab67('0x2e')]['filter']+'%'};return _0x59a617;})});}_0x195099=_[_0xab67('0x39')]({},_0x195099,_0x31f21f[_0xab67('0x3d')]);return _0x3a9e72[_0xab67('0x4e')](_0x195099);}})[_0xab67('0x26')](function(_0x4d9ee3){if(_0x4d9ee3){_0x4f557c=_0x4d9ee3[_0xab67('0x33')];if(!_0x31f21f[_0xab67('0x2e')][_0xab67('0x34')](_0xab67('0x35'))){_0x195099['limit']=qs[_0xab67('0x20')](_0x31f21f[_0xab67('0x2e')][_0xab67('0x20')]);_0x195099['offset']=qs[_0xab67('0x1e')](_0x31f21f[_0xab67('0x2e')][_0xab67('0x1e')]);}return _0x3a9e72['getSubjects'](_0x195099);}})[_0xab67('0x26')](function(_0x3d2ed1){if(_0x3d2ed1){return _0x3d2ed1?{'count':_0x4f557c,'rows':_0x3d2ed1}:null;}})[_0xab67('0x26')](respondWithResult(_0x7de885,null))[_0xab67('0x46')](handleError(_0x7de885,null));};exports[_0xab67('0x4f')]=function(_0x90799d,_0x3bff5e,_0x1b8ad3){var _0x5b0e6a={};var _0x1e320f={};var _0x9174c9;var _0x48f3e7;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x90799d[_0xab67('0x43')]['id']}})[_0xab67('0x26')](handleEntityNotFound(_0x3bff5e,null))[_0xab67('0x26')](function(_0x4eb208){if(_0x4eb208){_0x9174c9=_0x4eb208;_0x1e320f[_0xab67('0x2d')]=_[_0xab67('0x44')](db[_0xab67('0x4c')][_0xab67('0x2b')]);_0x1e320f[_0xab67('0x2e')]=_['keys'](_0x90799d[_0xab67('0x2e')]);_0x1e320f[_0xab67('0x2f')]=_[_0xab67('0x30')](_0x1e320f[_0xab67('0x2d')],_0x1e320f[_0xab67('0x2e')]);_0x5b0e6a['attributes']=_['intersection'](_0x1e320f[_0xab67('0x2d')],qs['fields'](_0x90799d[_0xab67('0x2e')][_0xab67('0x31')]));_0x5b0e6a[_0xab67('0x32')]=_0x5b0e6a['attributes'][_0xab67('0x33')]?_0x5b0e6a['attributes']:_0x1e320f[_0xab67('0x2d')];_0x5b0e6a[_0xab67('0x4d')]=qs[_0xab67('0x36')](_0x90799d[_0xab67('0x2e')][_0xab67('0x36')]);_0x5b0e6a['where']=qs[_0xab67('0x2f')](_[_0xab67('0x38')](_0x90799d[_0xab67('0x2e')],_0x1e320f[_0xab67('0x2f')]));if(_0x90799d[_0xab67('0x2e')][_0xab67('0x3c')]){_0x5b0e6a[_0xab67('0x37')]=_[_0xab67('0x39')](_0x5b0e6a[_0xab67('0x37')],{'$or':_[_0xab67('0x29')](_0x5b0e6a['attributes'],function(_0x2772e5){var _0x4d420c={};_0x4d420c[_0x2772e5]={'$like':'%'+_0x90799d[_0xab67('0x2e')]['filter']+'%'};return _0x4d420c;})});}_0x5b0e6a=_[_0xab67('0x39')]({},_0x5b0e6a,_0x90799d[_0xab67('0x3d')]);return _0x9174c9[_0xab67('0x4f')](_0x5b0e6a);}})['then'](function(_0x1cf267){if(_0x1cf267){_0x48f3e7=_0x1cf267[_0xab67('0x33')];if(!_0x90799d['query'][_0xab67('0x34')](_0xab67('0x35'))){_0x5b0e6a['limit']=qs[_0xab67('0x20')](_0x90799d[_0xab67('0x2e')][_0xab67('0x20')]);_0x5b0e6a[_0xab67('0x1e')]=qs[_0xab67('0x1e')](_0x90799d['query'][_0xab67('0x1e')]);}return _0x9174c9[_0xab67('0x4f')](_0x5b0e6a);}})['then'](function(_0xa17e6f){if(_0xa17e6f){return _0xa17e6f?{'count':_0x48f3e7,'rows':_0xa17e6f}:null;}})[_0xab67('0x26')](respondWithResult(_0x3bff5e,null))['catch'](handleError(_0x3bff5e,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ac663ac..174f5cf 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 _0x1a7d=['../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','request-promise','rimraf'];(function(_0x8e56a8,_0x19c3a8){var _0x52b96a=function(_0x3c6109){while(--_0x3c6109){_0x8e56a8['push'](_0x8e56a8['shift']());}};_0x52b96a(++_0x19c3a8);}(_0x1a7d,0x11d));var _0xd1a7=function(_0x3a9612,_0x43323b){_0x3a9612=_0x3a9612-0x0;var _0x10907f=_0x1a7d[_0x3a9612];return _0x10907f;};'use strict';var _=require('lodash');var util=require(_0xd1a7('0x0'));var logger=require(_0xd1a7('0x1'))(_0xd1a7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd1a7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1a7('0x4'));var config=require(_0xd1a7('0x5'));var attributes=require(_0xd1a7('0x6'));module['exports']=function(_0x2a2413,_0x2c8287){return _0x2a2413[_0xd1a7('0x7')](_0xd1a7('0x8'),attributes,{'tableName':_0xd1a7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x156b=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define'];(function(_0x2b3800,_0x586d01){var _0x25a792=function(_0x515835){while(--_0x515835){_0x2b3800['push'](_0x2b3800['shift']());}};_0x25a792(++_0x586d01);}(_0x156b,0x146));var _0xb156=function(_0x299eb8,_0x2a3c76){_0x299eb8=_0x299eb8-0x0;var _0x59ee49=_0x156b[_0x299eb8];return _0x59ee49;};'use strict';var _=require(_0xb156('0x0'));var util=require(_0xb156('0x1'));var logger=require(_0xb156('0x2'))(_0xb156('0x3'));var moment=require(_0xb156('0x4'));var BPromise=require(_0xb156('0x5'));var rp=require(_0xb156('0x6'));var fs=require('fs');var path=require(_0xb156('0x7'));var rimraf=require(_0xb156('0x8'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x3a45f3,_0x543681){return _0x3a45f3[_0xb156('0x9')](_0xb156('0xa'),attributes,{'tableName':_0xb156('0xb'),'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 cec0019..e20e45a 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 _0xa0a4=['client','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x405514,_0x6b0f){var _0x1b2eca=function(_0x2cf844){while(--_0x2cf844){_0x405514['push'](_0x405514['shift']());}};_0x1b2eca(++_0x6b0f);}(_0xa0a4,0x12d));var _0x4a0a=function(_0xd3dd9f,_0x304c28){_0xd3dd9f=_0xd3dd9f-0x0;var _0x1155af=_0xa0a4[_0xd3dd9f];return _0x1155af;};'use strict';var _=require(_0x4a0a('0x0'));var util=require(_0x4a0a('0x1'));var moment=require('moment');var BPromise=require(_0x4a0a('0x2'));var rs=require(_0x4a0a('0x3'));var fs=require('fs');var Redis=require(_0x4a0a('0x4'));var db=require(_0x4a0a('0x5'))['db'];var utils=require(_0x4a0a('0x6'));var logger=require(_0x4a0a('0x7'))(_0x4a0a('0x8'));var config=require(_0x4a0a('0x9'));var jayson=require(_0x4a0a('0xa'));var client=jayson[_0x4a0a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59708e,_0x16db3b,_0x554ae2){return new BPromise(function(_0x55057b,_0x41a40c){return client['request'](_0x59708e,_0x554ae2)[_0x4a0a('0xc')](function(_0x4d042b){logger[_0x4a0a('0xd')](_0x4a0a('0xe'),_0x16db3b,_0x4a0a('0xf'));logger[_0x4a0a('0x10')](_0x4a0a('0x11'),_0x16db3b,_0x4a0a('0xf'),JSON[_0x4a0a('0x12')](_0x4d042b));if(_0x4d042b[_0x4a0a('0x13')]){if(_0x4d042b[_0x4a0a('0x13')][_0x4a0a('0x14')]===0x1f4){logger[_0x4a0a('0x13')](_0x4a0a('0xe'),_0x16db3b,_0x4d042b['error'][_0x4a0a('0x15')]);return _0x41a40c(_0x4d042b[_0x4a0a('0x13')][_0x4a0a('0x15')]);}logger['error'](_0x4a0a('0xe'),_0x16db3b,_0x4d042b['error'][_0x4a0a('0x15')]);return _0x55057b(_0x4d042b[_0x4a0a('0x13')][_0x4a0a('0x15')]);}else{logger[_0x4a0a('0xd')](_0x4a0a('0xe'),_0x16db3b,_0x4a0a('0xf'));_0x55057b(_0x4d042b[_0x4a0a('0x16')][_0x4a0a('0x15')]);}})[_0x4a0a('0x17')](function(_0x16a5ba){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x16db3b,_0x16a5ba);_0x41a40c(_0x16a5ba);});});} \ No newline at end of file +var _0x6326=['request\x20sent','debug','stringify','error','code','message','result','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x1e9b13,_0x78c34b){var _0x27254f=function(_0x3aa64d){while(--_0x3aa64d){_0x1e9b13['push'](_0x1e9b13['shift']());}};_0x27254f(++_0x78c34b);}(_0x6326,0x197));var _0x6632=function(_0x173e75,_0x50ea70){_0x173e75=_0x173e75-0x0;var _0x4fd13f=_0x6326[_0x173e75];return _0x4fd13f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6632('0x0'));var BPromise=require('bluebird');var rs=require(_0x6632('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6632('0x2'))['db'];var utils=require(_0x6632('0x3'));var logger=require(_0x6632('0x4'))('rpc');var config=require(_0x6632('0x5'));var jayson=require(_0x6632('0x6'));var client=jayson[_0x6632('0x7')][_0x6632('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd24a74,_0x422b8e,_0x33815e){return new BPromise(function(_0x34b186,_0x14ef40){return client[_0x6632('0x9')](_0xd24a74,_0x33815e)[_0x6632('0xa')](function(_0x585741){logger[_0x6632('0xb')](_0x6632('0xc'),_0x422b8e,_0x6632('0xd'));logger[_0x6632('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x422b8e,_0x6632('0xd'),JSON[_0x6632('0xf')](_0x585741));if(_0x585741[_0x6632('0x10')]){if(_0x585741['error'][_0x6632('0x11')]===0x1f4){logger['error'](_0x6632('0xc'),_0x422b8e,_0x585741[_0x6632('0x10')][_0x6632('0x12')]);return _0x14ef40(_0x585741[_0x6632('0x10')][_0x6632('0x12')]);}logger[_0x6632('0x10')](_0x6632('0xc'),_0x422b8e,_0x585741[_0x6632('0x10')][_0x6632('0x12')]);return _0x34b186(_0x585741[_0x6632('0x10')]['message']);}else{logger[_0x6632('0xb')](_0x6632('0xc'),_0x422b8e,_0x6632('0xd'));_0x34b186(_0x585741[_0x6632('0x13')][_0x6632('0x12')]);}})['catch'](function(_0x51e521){logger[_0x6632('0x10')](_0x6632('0xc'),_0x422b8e,_0x51e521);_0x14ef40(_0x51e521);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 17fbbc5..8cfd087 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 _0x37de=['destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','show','create','put','/:id','delete','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37de,0x181));var _0xe37d=function(_0x51b255,_0x2a91cf){_0x51b255=_0x51b255-0x0;var _0x43bd02=_0x37de[_0x51b255];return _0x43bd02;};'use strict';var multer=require(_0xe37d('0x0'));var util=require(_0xe37d('0x1'));var path=require(_0xe37d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe37d('0x3')]();var fs_extra=require(_0xe37d('0x4'));var auth=require(_0xe37d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe37d('0x6'));var controller=require(_0xe37d('0x7'));router[_0xe37d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe37d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe37d('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe37d('0xa')]);router[_0xe37d('0xb')](_0xe37d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe37d('0xd')](_0xe37d('0xc'),auth[_0xe37d('0xe')](),controller[_0xe37d('0xf')]);module['exports']=router; \ No newline at end of file +var _0xcf73=['fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','index','isAuthenticated','create','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x10359d,_0x5588d8){var _0x72924e=function(_0xad24e3){while(--_0xad24e3){_0x10359d['push'](_0x10359d['shift']());}};_0x72924e(++_0x5588d8);}(_0xcf73,0x10b));var _0x3cf7=function(_0xd0775,_0x29656d){_0xd0775=_0xd0775-0x0;var _0x1658fa=_0xcf73[_0xd0775];return _0x1658fa;};'use strict';var multer=require('multer');var util=require(_0x3cf7('0x0'));var path=require(_0x3cf7('0x1'));var timeout=require(_0x3cf7('0x2'));var express=require(_0x3cf7('0x3'));var router=express[_0x3cf7('0x4')]();var fs_extra=require(_0x3cf7('0x5'));var auth=require(_0x3cf7('0x6'));var interaction=require(_0x3cf7('0x7'));var config=require('../../config/environment');var controller=require(_0x3cf7('0x8'));router[_0x3cf7('0x9')]('/',auth['isAuthenticated'](),controller[_0x3cf7('0xa')]);router[_0x3cf7('0x9')]('/:id',auth[_0x3cf7('0xb')](),controller['show']);router['post']('/',auth[_0x3cf7('0xb')](),controller[_0x3cf7('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3cf7('0xd')]);router[_0x3cf7('0xe')]('/:id',auth[_0x3cf7('0xb')](),controller[_0x3cf7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index faf07da..c5c21ab 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 _0x86f0=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x1cb370,_0x3a3127){var _0x3cdda4=function(_0x190159){while(--_0x190159){_0x1cb370['push'](_0x1cb370['shift']());}};_0x3cdda4(++_0x3a3127);}(_0x86f0,0x1a6));var _0x086f=function(_0x567531,_0x2b5e72){_0x567531=_0x567531-0x0;var _0x58b729=_0x86f0[_0x567531];return _0x58b729;};'use strict';var Sequelize=require(_0x086f('0x0'));module[_0x086f('0x1')]={'type':{'type':Sequelize[_0x086f('0x2')](_0x086f('0x3'),'variable',_0x086f('0x4'),_0x086f('0x5'),_0x086f('0x6')),'defaultValue':_0x086f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x086f('0x7')]},'keyType':{'type':Sequelize[_0x086f('0x2')](_0x086f('0x3'),_0x086f('0x8'),_0x086f('0x4'))},'keyContent':{'type':Sequelize[_0x086f('0x7')]},'idField':{'type':Sequelize[_0x086f('0x7')]},'nameField':{'type':Sequelize[_0x086f('0x7')]},'customField':{'type':Sequelize[_0x086f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x086f('0x7')]}}; \ No newline at end of file +var _0xf186=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2595a0,_0x1f734e){var _0xa5821a=function(_0x55173b){while(--_0x55173b){_0x2595a0['push'](_0x2595a0['shift']());}};_0xa5821a(++_0x1f734e);}(_0xf186,0x1df));var _0x6f18=function(_0x365600,_0x566b90){_0x365600=_0x365600-0x0;var _0x56f128=_0xf186[_0x365600];return _0x56f128;};'use strict';var Sequelize=require(_0x6f18('0x0'));module['exports']={'type':{'type':Sequelize[_0x6f18('0x1')](_0x6f18('0x2'),_0x6f18('0x3'),_0x6f18('0x4'),_0x6f18('0x5'),_0x6f18('0x6')),'defaultValue':_0x6f18('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6f18('0x7')]},'keyType':{'type':Sequelize[_0x6f18('0x1')](_0x6f18('0x2'),_0x6f18('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6f18('0x7')]},'idField':{'type':Sequelize[_0x6f18('0x7')]},'nameField':{'type':Sequelize[_0x6f18('0x7')]},'customField':{'type':Sequelize[_0x6f18('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6f18('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 1b61d89..860a744 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 _0xc97e=['limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','type','key','query','intersection','fields','attributes','length','model','nolimit','sort','where','pick','filter','merge','options','ZohoField','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined'];(function(_0x4649c4,_0x4c8c1a){var _0x4166e2=function(_0x3e571f){while(--_0x3e571f){_0x4649c4['push'](_0x4649c4['shift']());}};_0x4166e2(++_0x4c8c1a);}(_0xc97e,0x148));var _0xec97=function(_0x524e1b,_0x39e1dc){_0x524e1b=_0x524e1b-0x0;var _0x274648=_0xc97e[_0x524e1b];return _0x274648;};'use strict';var emlformat=require(_0xec97('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec97('0x1'));var jsonpatch=require(_0xec97('0x2'));var rp=require(_0xec97('0x3'));var moment=require('moment');var BPromise=require(_0xec97('0x4'));var Mustache=require(_0xec97('0x5'));var util=require(_0xec97('0x6'));var path=require('path');var sox=require(_0xec97('0x7'));var csv=require(_0xec97('0x8'));var ejs=require(_0xec97('0x9'));var fs=require('fs');var fs_extra=require(_0xec97('0xa'));var _=require(_0xec97('0xb'));var squel=require('squel');var crypto=require(_0xec97('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xec97('0xd'));var toCsv=require(_0xec97('0x8'));var querystring=require(_0xec97('0xe'));var Papa=require(_0xec97('0xf'));var Redis=require('ioredis');var authService=require(_0xec97('0x10'));var qs=require(_0xec97('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec97('0x12'));var logger=require('../../config/logger')(_0xec97('0x13'));var utils=require(_0xec97('0x14'));var config=require(_0xec97('0x15'));var licenseUtil=require(_0xec97('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x480e7d,_0x548f7c){_0x548f7c=_0x548f7c||0xcc;return function(_0x436a63){if(_0x436a63){return _0x480e7d[_0xec97('0x17')](_0x548f7c);}return _0x480e7d[_0xec97('0x18')](_0x548f7c)['end']();};}function respondWithResult(_0x439911,_0xccc8d4){_0xccc8d4=_0xccc8d4||0xc8;return function(_0x14323e){if(_0x14323e){return _0x439911[_0xec97('0x18')](_0xccc8d4)['json'](_0x14323e);}};}function respondWithFilteredResult(_0x4d80cf,_0x6bd110){return function(_0xe5e840){if(_0xe5e840){var _0x93c445=typeof _0x6bd110[_0xec97('0x19')]===_0xec97('0x1a')&&typeof _0x6bd110[_0xec97('0x1b')]===_0xec97('0x1a');var _0x1993c3=_0xe5e840[_0xec97('0x1c')];var _0x44ed00=_0x93c445?0x0:_0x6bd110['offset'];var _0x1c2f7c=_0x93c445?_0xe5e840['count']:_0x6bd110[_0xec97('0x19')]+_0x6bd110[_0xec97('0x1b')];var _0x4bbbf3;if(_0x1c2f7c>=_0x1993c3){_0x1c2f7c=_0x1993c3;_0x4bbbf3=0xc8;}else{_0x4bbbf3=0xce;}_0x4d80cf['status'](_0x4bbbf3);return _0x4d80cf[_0xec97('0x1d')](_0xec97('0x1e'),_0x44ed00+'-'+_0x1c2f7c+'/'+_0x1993c3)[_0xec97('0x1f')](_0xe5e840);}return null;};}function patchUpdates(_0x28f452){return function(_0x2776ae){try{jsonpatch[_0xec97('0x20')](_0x2776ae,_0x28f452,!![]);}catch(_0x419c9b){return BPromise[_0xec97('0x21')](_0x419c9b);}return _0x2776ae['save']();};}function saveUpdates(_0x3380ce,_0x4fae54){return function(_0x411437){if(_0x411437){return _0x411437[_0xec97('0x22')](_0x3380ce)[_0xec97('0x23')](function(_0x8700bd){return _0x8700bd;});}return null;};}function removeEntity(_0x34ed87,_0x253c46){return function(_0x2d348b){if(_0x2d348b){return _0x2d348b[_0xec97('0x24')]()[_0xec97('0x23')](function(){_0x34ed87[_0xec97('0x18')](0xcc)[_0xec97('0x25')]();});}};}function handleEntityNotFound(_0x2bdd00,_0x357ae1){return function(_0x16f81e){if(!_0x16f81e){_0x2bdd00[_0xec97('0x17')](0x194);}return _0x16f81e;};}function handleError(_0x3d55f4,_0x30d46e){_0x30d46e=_0x30d46e||0x1f4;return function(_0x3ca1fb){logger[_0xec97('0x26')](_0x3ca1fb['stack']);if(_0x3ca1fb['name']){delete _0x3ca1fb[_0xec97('0x27')];}_0x3d55f4['status'](_0x30d46e)[_0xec97('0x28')](_0x3ca1fb);};}exports[_0xec97('0x29')]=function(_0x562f77,_0x5d5e7a){var _0x541b39={},_0x1c10e0={},_0x266398={'count':0x0,'rows':[]};var _0x11f685=_[_0xec97('0x2a')](db['ZohoField']['rawAttributes'],function(_0x47771a){return{'name':_0x47771a['fieldName'],'type':_0x47771a[_0xec97('0x2b')][_0xec97('0x2c')]};});_0x1c10e0['model']=_[_0xec97('0x2a')](_0x11f685,'name');_0x1c10e0[_0xec97('0x2d')]=_['keys'](_0x562f77[_0xec97('0x2d')]);_0x1c10e0['filters']=_['intersection'](_0x1c10e0['model'],_0x1c10e0['query']);_0x541b39['attributes']=_[_0xec97('0x2e')](_0x1c10e0['model'],qs[_0xec97('0x2f')](_0x562f77[_0xec97('0x2d')][_0xec97('0x2f')]));_0x541b39['attributes']=_0x541b39[_0xec97('0x30')][_0xec97('0x31')]?_0x541b39[_0xec97('0x30')]:_0x1c10e0[_0xec97('0x32')];if(!_0x562f77[_0xec97('0x2d')]['hasOwnProperty'](_0xec97('0x33'))){_0x541b39[_0xec97('0x1b')]=qs[_0xec97('0x1b')](_0x562f77[_0xec97('0x2d')][_0xec97('0x1b')]);_0x541b39['offset']=qs['offset'](_0x562f77[_0xec97('0x2d')][_0xec97('0x19')]);}_0x541b39['order']=qs[_0xec97('0x34')](_0x562f77['query']['sort']);_0x541b39[_0xec97('0x35')]=qs['filters'](_[_0xec97('0x36')](_0x562f77[_0xec97('0x2d')],_0x1c10e0['filters']),_0x11f685);if(_0x562f77[_0xec97('0x2d')]['filter']){_0x541b39[_0xec97('0x35')]=_['merge'](_0x541b39[_0xec97('0x35')],{'$or':_[_0xec97('0x2a')](_0x11f685,function(_0x59bd09){if(_0x59bd09[_0xec97('0x2b')]!=='VIRTUAL'){var _0x4b4ba5={};_0x4b4ba5[_0x59bd09[_0xec97('0x27')]]={'$like':'%'+_0x562f77[_0xec97('0x2d')][_0xec97('0x37')]+'%'};return _0x4b4ba5;}})});}_0x541b39=_[_0xec97('0x38')]({},_0x541b39,_0x562f77[_0xec97('0x39')]);var _0xc16468={'where':_0x541b39[_0xec97('0x35')]};return db[_0xec97('0x3a')][_0xec97('0x1c')](_0xc16468)[_0xec97('0x23')](function(_0x3afd13){_0x266398[_0xec97('0x1c')]=_0x3afd13;if(_0x562f77[_0xec97('0x2d')]['includeAll']){_0x541b39[_0xec97('0x3b')]=[{'all':!![]}];}return db[_0xec97('0x3a')][_0xec97('0x3c')](_0x541b39);})[_0xec97('0x23')](function(_0x5b6590){_0x266398[_0xec97('0x3d')]=_0x5b6590;return _0x266398;})[_0xec97('0x23')](respondWithFilteredResult(_0x5d5e7a,_0x541b39))[_0xec97('0x3e')](handleError(_0x5d5e7a,null));};exports[_0xec97('0x3f')]=function(_0x4413d4,_0x5d6bb3){var _0x3e814d={'raw':!![],'where':{'id':_0x4413d4['params']['id']}},_0x1313b0={};_0x1313b0[_0xec97('0x32')]=_[_0xec97('0x40')](db['ZohoField'][_0xec97('0x41')]);_0x1313b0[_0xec97('0x2d')]=_[_0xec97('0x40')](_0x4413d4[_0xec97('0x2d')]);_0x1313b0['filters']=_[_0xec97('0x2e')](_0x1313b0[_0xec97('0x32')],_0x1313b0[_0xec97('0x2d')]);_0x3e814d[_0xec97('0x30')]=_[_0xec97('0x2e')](_0x1313b0[_0xec97('0x32')],qs[_0xec97('0x2f')](_0x4413d4[_0xec97('0x2d')][_0xec97('0x2f')]));_0x3e814d[_0xec97('0x30')]=_0x3e814d[_0xec97('0x30')]['length']?_0x3e814d[_0xec97('0x30')]:_0x1313b0[_0xec97('0x32')];if(_0x4413d4[_0xec97('0x2d')][_0xec97('0x42')]){_0x3e814d['include']=[{'all':!![]}];}_0x3e814d=_[_0xec97('0x38')]({},_0x3e814d,_0x4413d4['options']);return db['ZohoField'][_0xec97('0x43')](_0x3e814d)[_0xec97('0x23')](handleEntityNotFound(_0x5d6bb3,null))[_0xec97('0x23')](respondWithResult(_0x5d6bb3,null))[_0xec97('0x3e')](handleError(_0x5d6bb3,null));};exports[_0xec97('0x44')]=function(_0x1d108b,_0x461bde){return db[_0xec97('0x3a')][_0xec97('0x44')](_0x1d108b['body'],{})[_0xec97('0x23')](respondWithResult(_0x461bde,0xc9))['catch'](handleError(_0x461bde,null));};exports[_0xec97('0x22')]=function(_0x396f8d,_0x226472){if(_0x396f8d['body']['id']){delete _0x396f8d[_0xec97('0x45')]['id'];}return db[_0xec97('0x3a')][_0xec97('0x43')]({'where':{'id':_0x396f8d[_0xec97('0x46')]['id']}})[_0xec97('0x23')](handleEntityNotFound(_0x226472,null))['then'](saveUpdates(_0x396f8d[_0xec97('0x45')],null))[_0xec97('0x23')](respondWithResult(_0x226472,null))[_0xec97('0x3e')](handleError(_0x226472,null));};exports[_0xec97('0x24')]=function(_0x5c8766,_0xf87aac){return db['ZohoField'][_0xec97('0x43')]({'where':{'id':_0x5c8766[_0xec97('0x46')]['id']}})[_0xec97('0x23')](handleEntityNotFound(_0xf87aac,null))[_0xec97('0x23')](removeEntity(_0xf87aac,null))[_0xec97('0x3e')](handleError(_0xf87aac,null));}; \ No newline at end of file +var _0x13c9=['sort','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order'];(function(_0x472c77,_0x2e49cc){var _0x122da1=function(_0x124f23){while(--_0x124f23){_0x472c77['push'](_0x472c77['shift']());}};_0x122da1(++_0x2e49cc);}(_0x13c9,0x1c1));var _0x913c=function(_0x5a9bc7,_0x2b6611){_0x5a9bc7=_0x5a9bc7-0x0;var _0x3d6dd9=_0x13c9[_0x5a9bc7];return _0x3d6dd9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x913c('0x0'));var zipdir=require(_0x913c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x913c('0x2'));var moment=require(_0x913c('0x3'));var BPromise=require(_0x913c('0x4'));var Mustache=require('mustache');var util=require(_0x913c('0x5'));var path=require(_0x913c('0x6'));var sox=require(_0x913c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x913c('0x8'));var _=require('lodash');var squel=require(_0x913c('0x9'));var crypto=require(_0x913c('0xa'));var jsforce=require(_0x913c('0xb'));var deskjs=require(_0x913c('0xc'));var toCsv=require(_0x913c('0xd'));var querystring=require(_0x913c('0xe'));var Papa=require(_0x913c('0xf'));var Redis=require(_0x913c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x913c('0x11'));var as=require(_0x913c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x913c('0x13'))(_0x913c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x913c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53e215,_0x28f048){_0x28f048=_0x28f048||0xcc;return function(_0x1edfef){if(_0x1edfef){return _0x53e215[_0x913c('0x16')](_0x28f048);}return _0x53e215['status'](_0x28f048)[_0x913c('0x17')]();};}function respondWithResult(_0x292d24,_0x42d6ce){_0x42d6ce=_0x42d6ce||0xc8;return function(_0x294a7e){if(_0x294a7e){return _0x292d24[_0x913c('0x18')](_0x42d6ce)['json'](_0x294a7e);}};}function respondWithFilteredResult(_0x2b12fa,_0x5f4791){return function(_0x21e73c){if(_0x21e73c){var _0x488602=typeof _0x5f4791[_0x913c('0x19')]==='undefined'&&typeof _0x5f4791[_0x913c('0x1a')]===_0x913c('0x1b');var _0x380707=_0x21e73c[_0x913c('0x1c')];var _0x5f4aa5=_0x488602?0x0:_0x5f4791['offset'];var _0x4cca44=_0x488602?_0x21e73c[_0x913c('0x1c')]:_0x5f4791['offset']+_0x5f4791[_0x913c('0x1a')];var _0x4fa1e8;if(_0x4cca44>=_0x380707){_0x4cca44=_0x380707;_0x4fa1e8=0xc8;}else{_0x4fa1e8=0xce;}_0x2b12fa['status'](_0x4fa1e8);return _0x2b12fa[_0x913c('0x1d')](_0x913c('0x1e'),_0x5f4aa5+'-'+_0x4cca44+'/'+_0x380707)[_0x913c('0x1f')](_0x21e73c);}return null;};}function patchUpdates(_0x3218b7){return function(_0x54abf1){try{jsonpatch[_0x913c('0x20')](_0x54abf1,_0x3218b7,!![]);}catch(_0x17cbd2){return BPromise[_0x913c('0x21')](_0x17cbd2);}return _0x54abf1[_0x913c('0x22')]();};}function saveUpdates(_0x11ce83,_0x59ac77){return function(_0x101213){if(_0x101213){return _0x101213[_0x913c('0x23')](_0x11ce83)[_0x913c('0x24')](function(_0x31bea0){return _0x31bea0;});}return null;};}function removeEntity(_0xf81001,_0xcf4b43){return function(_0x51fa29){if(_0x51fa29){return _0x51fa29[_0x913c('0x25')]()['then'](function(){_0xf81001['status'](0xcc)[_0x913c('0x17')]();});}};}function handleEntityNotFound(_0x4bd3fa,_0x3eadc6){return function(_0x30c89a){if(!_0x30c89a){_0x4bd3fa[_0x913c('0x16')](0x194);}return _0x30c89a;};}function handleError(_0x44b586,_0x2093c0){_0x2093c0=_0x2093c0||0x1f4;return function(_0x5d1023){logger[_0x913c('0x26')](_0x5d1023['stack']);if(_0x5d1023[_0x913c('0x27')]){delete _0x5d1023[_0x913c('0x27')];}_0x44b586[_0x913c('0x18')](_0x2093c0)[_0x913c('0x28')](_0x5d1023);};}exports[_0x913c('0x29')]=function(_0x2a5af0,_0x53cd99){var _0x4e65b3={},_0xf06d83={},_0x312bf1={'count':0x0,'rows':[]};var _0x4efc8e=_[_0x913c('0x2a')](db['ZohoField'][_0x913c('0x2b')],function(_0x4f026a){return{'name':_0x4f026a['fieldName'],'type':_0x4f026a[_0x913c('0x2c')][_0x913c('0x2d')]};});_0xf06d83[_0x913c('0x2e')]=_[_0x913c('0x2a')](_0x4efc8e,_0x913c('0x27'));_0xf06d83[_0x913c('0x2f')]=_[_0x913c('0x30')](_0x2a5af0['query']);_0xf06d83[_0x913c('0x31')]=_[_0x913c('0x32')](_0xf06d83[_0x913c('0x2e')],_0xf06d83[_0x913c('0x2f')]);_0x4e65b3[_0x913c('0x33')]=_[_0x913c('0x32')](_0xf06d83[_0x913c('0x2e')],qs[_0x913c('0x34')](_0x2a5af0[_0x913c('0x2f')]['fields']));_0x4e65b3[_0x913c('0x33')]=_0x4e65b3[_0x913c('0x33')][_0x913c('0x35')]?_0x4e65b3[_0x913c('0x33')]:_0xf06d83[_0x913c('0x2e')];if(!_0x2a5af0[_0x913c('0x2f')]['hasOwnProperty']('nolimit')){_0x4e65b3['limit']=qs[_0x913c('0x1a')](_0x2a5af0[_0x913c('0x2f')]['limit']);_0x4e65b3[_0x913c('0x19')]=qs[_0x913c('0x19')](_0x2a5af0[_0x913c('0x2f')][_0x913c('0x19')]);}_0x4e65b3[_0x913c('0x36')]=qs[_0x913c('0x37')](_0x2a5af0['query']['sort']);_0x4e65b3[_0x913c('0x38')]=qs[_0x913c('0x31')](_[_0x913c('0x39')](_0x2a5af0[_0x913c('0x2f')],_0xf06d83[_0x913c('0x31')]),_0x4efc8e);if(_0x2a5af0[_0x913c('0x2f')][_0x913c('0x3a')]){_0x4e65b3[_0x913c('0x38')]=_[_0x913c('0x3b')](_0x4e65b3[_0x913c('0x38')],{'$or':_[_0x913c('0x2a')](_0x4efc8e,function(_0x3c4804){if(_0x3c4804[_0x913c('0x2c')]!==_0x913c('0x3c')){var _0x30085d={};_0x30085d[_0x3c4804[_0x913c('0x27')]]={'$like':'%'+_0x2a5af0['query'][_0x913c('0x3a')]+'%'};return _0x30085d;}})});}_0x4e65b3=_['merge']({},_0x4e65b3,_0x2a5af0[_0x913c('0x3d')]);var _0x2a92a3={'where':_0x4e65b3[_0x913c('0x38')]};return db[_0x913c('0x3e')]['count'](_0x2a92a3)['then'](function(_0x399fe0){_0x312bf1[_0x913c('0x1c')]=_0x399fe0;if(_0x2a5af0[_0x913c('0x2f')][_0x913c('0x3f')]){_0x4e65b3[_0x913c('0x40')]=[{'all':!![]}];}return db[_0x913c('0x3e')][_0x913c('0x41')](_0x4e65b3);})[_0x913c('0x24')](function(_0x389e72){_0x312bf1[_0x913c('0x42')]=_0x389e72;return _0x312bf1;})[_0x913c('0x24')](respondWithFilteredResult(_0x53cd99,_0x4e65b3))[_0x913c('0x43')](handleError(_0x53cd99,null));};exports['show']=function(_0x2938b1,_0x1ddcbb){var _0x428f2b={'raw':!![],'where':{'id':_0x2938b1[_0x913c('0x44')]['id']}},_0x430eff={};_0x430eff[_0x913c('0x2e')]=_[_0x913c('0x30')](db[_0x913c('0x3e')][_0x913c('0x2b')]);_0x430eff[_0x913c('0x2f')]=_[_0x913c('0x30')](_0x2938b1[_0x913c('0x2f')]);_0x430eff[_0x913c('0x31')]=_[_0x913c('0x32')](_0x430eff['model'],_0x430eff[_0x913c('0x2f')]);_0x428f2b[_0x913c('0x33')]=_['intersection'](_0x430eff[_0x913c('0x2e')],qs[_0x913c('0x34')](_0x2938b1['query'][_0x913c('0x34')]));_0x428f2b[_0x913c('0x33')]=_0x428f2b[_0x913c('0x33')][_0x913c('0x35')]?_0x428f2b[_0x913c('0x33')]:_0x430eff[_0x913c('0x2e')];if(_0x2938b1['query'][_0x913c('0x3f')]){_0x428f2b[_0x913c('0x40')]=[{'all':!![]}];}_0x428f2b=_[_0x913c('0x3b')]({},_0x428f2b,_0x2938b1[_0x913c('0x3d')]);return db[_0x913c('0x3e')][_0x913c('0x45')](_0x428f2b)[_0x913c('0x24')](handleEntityNotFound(_0x1ddcbb,null))[_0x913c('0x24')](respondWithResult(_0x1ddcbb,null))['catch'](handleError(_0x1ddcbb,null));};exports[_0x913c('0x46')]=function(_0xe8d785,_0x18b0bf){return db[_0x913c('0x3e')][_0x913c('0x46')](_0xe8d785[_0x913c('0x47')],{})[_0x913c('0x24')](respondWithResult(_0x18b0bf,0xc9))[_0x913c('0x43')](handleError(_0x18b0bf,null));};exports[_0x913c('0x23')]=function(_0x4492ea,_0x57dd8f){if(_0x4492ea[_0x913c('0x47')]['id']){delete _0x4492ea['body']['id'];}return db[_0x913c('0x3e')]['find']({'where':{'id':_0x4492ea['params']['id']}})[_0x913c('0x24')](handleEntityNotFound(_0x57dd8f,null))[_0x913c('0x24')](saveUpdates(_0x4492ea[_0x913c('0x47')],null))[_0x913c('0x24')](respondWithResult(_0x57dd8f,null))[_0x913c('0x43')](handleError(_0x57dd8f,null));};exports[_0x913c('0x25')]=function(_0x43e329,_0x2f616c){return db[_0x913c('0x3e')][_0x913c('0x45')]({'where':{'id':_0x43e329[_0x913c('0x44')]['id']}})[_0x913c('0x24')](handleEntityNotFound(_0x2f616c,null))[_0x913c('0x24')](removeEntity(_0x2f616c,null))['catch'](handleError(_0x2f616c,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0bff70b..008c050 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 _0x5496=['moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x30355a,_0x440018){var _0x141897=function(_0x3800e2){while(--_0x3800e2){_0x30355a['push'](_0x30355a['shift']());}};_0x141897(++_0x440018);}(_0x5496,0x175));var _0x6549=function(_0xb79a47,_0xc7a854){_0xb79a47=_0xb79a47-0x0;var _0x35bb3e=_0x5496[_0xb79a47];return _0x35bb3e;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('ZohoField',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x1d2d23,_0x3751a7){var _0x2e5d46=function(_0x29dbd0){while(--_0x29dbd0){_0x1d2d23['push'](_0x1d2d23['shift']());}};_0x2e5d46(++_0x3751a7);}(_0xd117,0x182));var _0x7d11=function(_0x27250c,_0x3e6637){_0x27250c=_0x27250c-0x0;var _0x7e3095=_0xd117[_0x27250c];return _0x7e3095;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xf'),_0x7d11('0x10')],'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 1d1356f..8f6d2f0 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 _0xf85f=['message','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4c58ca,_0x7771a0){var _0x211591=function(_0x55298d){while(--_0x55298d){_0x4c58ca['push'](_0x4c58ca['shift']());}};_0x211591(++_0x7771a0);}(_0xf85f,0x95));var _0xff85=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xf85f[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xff85('0x0'));var util=require(_0xff85('0x1'));var moment=require(_0xff85('0x2'));var BPromise=require(_0xff85('0x3'));var rs=require(_0xff85('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff85('0x5'))['db'];var utils=require(_0xff85('0x6'));var logger=require(_0xff85('0x7'))(_0xff85('0x8'));var config=require(_0xff85('0x9'));var jayson=require(_0xff85('0xa'));var client=jayson[_0xff85('0xb')][_0xff85('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3dd1bd,_0x346d33,_0x2fcb96){return new BPromise(function(_0x2b3167,_0x145e30){return client['request'](_0x3dd1bd,_0x2fcb96)['then'](function(_0x3f4b21){logger['info'](_0xff85('0xd'),_0x346d33,_0xff85('0xe'));logger[_0xff85('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x346d33,_0xff85('0xe'),JSON[_0xff85('0x10')](_0x3f4b21));if(_0x3f4b21[_0xff85('0x11')]){if(_0x3f4b21[_0xff85('0x11')][_0xff85('0x12')]===0x1f4){logger[_0xff85('0x11')](_0xff85('0xd'),_0x346d33,_0x3f4b21[_0xff85('0x11')][_0xff85('0x13')]);return _0x145e30(_0x3f4b21[_0xff85('0x11')][_0xff85('0x13')]);}logger[_0xff85('0x11')](_0xff85('0xd'),_0x346d33,_0x3f4b21[_0xff85('0x11')][_0xff85('0x13')]);return _0x2b3167(_0x3f4b21[_0xff85('0x11')]['message']);}else{logger[_0xff85('0x14')](_0xff85('0xd'),_0x346d33,'request\x20sent');_0x2b3167(_0x3f4b21['result'][_0xff85('0x13')]);}})['catch'](function(_0x3ad157){logger[_0xff85('0x11')](_0xff85('0xd'),_0x346d33,_0x3ad157);_0x145e30(_0x3ad157);});});} \ No newline at end of file +var _0xdf2a=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0xdf2a,0x16e));var _0xadf2=function(_0x630d45,_0x1f2401){_0x630d45=_0x630d45-0x0;var _0x23b899=_0xdf2a[_0x630d45];return _0x23b899;};'use strict';var _=require('lodash');var util=require(_0xadf2('0x0'));var moment=require(_0xadf2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadf2('0x2'));var db=require(_0xadf2('0x3'))['db'];var utils=require(_0xadf2('0x4'));var logger=require('../../config/logger')(_0xadf2('0x5'));var config=require(_0xadf2('0x6'));var jayson=require(_0xadf2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ac36,_0x50c825,_0x3eb09f){return new BPromise(function(_0x34b91c,_0x4f3e32){return client[_0xadf2('0x8')](_0x5ac36,_0x3eb09f)[_0xadf2('0x9')](function(_0x1dc804){logger[_0xadf2('0xa')](_0xadf2('0xb'),_0x50c825,_0xadf2('0xc'));logger[_0xadf2('0xd')](_0xadf2('0xe'),_0x50c825,_0xadf2('0xc'),JSON[_0xadf2('0xf')](_0x1dc804));if(_0x1dc804[_0xadf2('0x10')]){if(_0x1dc804[_0xadf2('0x10')][_0xadf2('0x11')]===0x1f4){logger[_0xadf2('0x10')]('ZohoField,\x20%s,\x20%s',_0x50c825,_0x1dc804[_0xadf2('0x10')]['message']);return _0x4f3e32(_0x1dc804['error']['message']);}logger[_0xadf2('0x10')](_0xadf2('0xb'),_0x50c825,_0x1dc804[_0xadf2('0x10')]['message']);return _0x34b91c(_0x1dc804[_0xadf2('0x10')][_0xadf2('0x12')]);}else{logger[_0xadf2('0xa')]('ZohoField,\x20%s,\x20%s',_0x50c825,'request\x20sent');_0x34b91c(_0x1dc804[_0xadf2('0x13')]['message']);}})[_0xadf2('0x14')](function(_0x5e171f){logger[_0xadf2('0x10')](_0xadf2('0xb'),_0x50c825,_0x5e171f);_0x4f3e32(_0x5e171f);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 938a745..561e7af 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2a1fba,_0x22840f){var _0x3e15dd=function(_0x2c3405){while(--_0x2c3405){_0x2a1fba['push'](_0x2a1fba['shift']());}};_0x3e15dd(++_0x22840f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0xcb91[_0x2ba740];return _0x358bda;};'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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x24d0a2,_0x3d3ff3){var _0x10e950=function(_0xff96e2){while(--_0xff96e2){_0x24d0a2['push'](_0x24d0a2['shift']());}};_0x10e950(++_0x3d3ff3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 9276c0b..41b1808 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 _0x5dda=['INTEGER','state','sequelize','unique_name_and_version','STRING'];(function(_0x1fc7b5,_0x5d4779){var _0x3ef5db=function(_0x1622cf){while(--_0x1622cf){_0x1fc7b5['push'](_0x1fc7b5['shift']());}};_0x3ef5db(++_0x5d4779);}(_0x5dda,0xed));var _0xa5dd=function(_0x105246,_0xa9ba1d){_0x105246=_0x105246-0x0;var _0x46b9c6=_0x5dda[_0x105246];return _0x46b9c6;};'use strict';var Sequelize=require(_0xa5dd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa5dd('0x1')},'version':{'type':Sequelize[_0xa5dd('0x2')],'allowNull':![],'unique':_0xa5dd('0x1')},'main':{'type':Sequelize[_0xa5dd('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xa5dd('0x2')]},'path':{'type':Sequelize[_0xa5dd('0x2')]},'type':{'type':Sequelize[_0xa5dd('0x2')]},'size':{'type':Sequelize[_0xa5dd('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xa5dd('0x2')]},'logo':{'type':Sequelize[_0xa5dd('0x2')]},'state':{'type':Sequelize[_0xa5dd('0x2')],'unique':_0xa5dd('0x4')},'description':{'type':Sequelize[_0xa5dd('0x2')]},'title':{'type':Sequelize[_0xa5dd('0x2')]},'remoteUri':{'type':Sequelize[_0xa5dd('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x2be1=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x5dfd74,_0x27247f){var _0x351a61=function(_0x1da21b){while(--_0x1da21b){_0x5dfd74['push'](_0x5dfd74['shift']());}};_0x351a61(++_0x27247f);}(_0x2be1,0x196));var _0x12be=function(_0x27c3f0,_0x198aa2){_0x27c3f0=_0x27c3f0-0x0;var _0x11e51c=_0x2be1[_0x27c3f0];return _0x11e51c;};'use strict';var Sequelize=require(_0x12be('0x0'));module[_0x12be('0x1')]={'name':{'type':Sequelize[_0x12be('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x12be('0x3')},'main':{'type':Sequelize[_0x12be('0x2')],'defaultValue':_0x12be('0x4')},'filename':{'type':Sequelize[_0x12be('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x12be('0x2')]},'size':{'type':Sequelize[_0x12be('0x5')]},'active':{'type':Sequelize[_0x12be('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x12be('0x2')]},'logo':{'type':Sequelize[_0x12be('0x2')]},'state':{'type':Sequelize[_0x12be('0x2')],'unique':_0x12be('0x7')},'description':{'type':Sequelize[_0x12be('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x12be('0x2')]},'link':{'type':Sequelize[_0x12be('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 4e0d8f8..56ce974 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 _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x2d984c,_0x11435a){var _0x2bde96=function(_0x11a83f){while(--_0x11a83f){_0x2d984c['push'](_0x2d984c['shift']());}};_0x2bde96(++_0x11435a);}(_0x7096,0x10c));var _0x6709=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7096[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file +var _0x57ca=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','Integration','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','rimraf','zip-dir','request-promise','moment'];(function(_0x348e7d,_0x17c567){var _0x25ef1d=function(_0x2596a1){while(--_0x2596a1){_0x348e7d['push'](_0x348e7d['shift']());}};_0x25ef1d(++_0x17c567);}(_0x57ca,0x108));var _0xa57c=function(_0x154749,_0x4a64f6){_0x154749=_0x154749-0x0;var _0x17ed14=_0x57ca[_0x154749];return _0x17ed14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['Integration']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['Integration'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 574caeb..d674140 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 _0x9d6b=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','integrations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d6b,0x84));var _0xb9d6=function(_0x1bbb64,_0x13df57){_0x1bbb64=_0x1bbb64-0x0;var _0x489eb7=_0x9d6b[_0x1bbb64];return _0x489eb7;};'use strict';var _=require(_0xb9d6('0x0'));var util=require(_0xb9d6('0x1'));var logger=require(_0xb9d6('0x2'))(_0xb9d6('0x3'));var moment=require('moment');var BPromise=require(_0xb9d6('0x4'));var rp=require(_0xb9d6('0x5'));var fs=require('fs');var path=require(_0xb9d6('0x6'));var rimraf=require(_0xb9d6('0x7'));var config=require('../../config/environment');var attributes=require(_0xb9d6('0x8'));module[_0xb9d6('0x9')]=function(_0x2c3c92,_0x103280){return _0x2c3c92[_0xb9d6('0xa')]('Integration',attributes,{'tableName':_0xb9d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe842=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','api'];(function(_0x486986,_0x366cd2){var _0x3ed0c0=function(_0x4bad4b){while(--_0x4bad4b){_0x486986['push'](_0x486986['shift']());}};_0x3ed0c0(++_0x366cd2);}(_0xe842,0xce));var _0x2e84=function(_0x3144b3,_0x45f961){_0x3144b3=_0x3144b3-0x0;var _0x2517a9=_0xe842[_0x3144b3];return _0x2517a9;};'use strict';var _=require(_0x2e84('0x0'));var util=require(_0x2e84('0x1'));var logger=require(_0x2e84('0x2'))(_0x2e84('0x3'));var moment=require(_0x2e84('0x4'));var BPromise=require(_0x2e84('0x5'));var rp=require(_0x2e84('0x6'));var fs=require('fs');var path=require(_0x2e84('0x7'));var rimraf=require(_0x2e84('0x8'));var config=require(_0x2e84('0x9'));var attributes=require('./integration.attributes');module[_0x2e84('0xa')]=function(_0x508cde,_0x36a3cc){return _0x508cde[_0x2e84('0xb')](_0x2e84('0xc'),attributes,{'tableName':_0x2e84('0xd'),'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 3e8e72c..2258c53 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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x865d60,_0x584f0a){var _0x4d67d8=function(_0x1e6ebe){while(--_0x1e6ebe){_0x865d60['push'](_0x865d60['shift']());}};_0x4d67d8(++_0x584f0a);}(_0x2542,0x169));var _0x2254=function(_0x30bca5,_0x2f8729){_0x30bca5=_0x30bca5-0x0;var _0x323b05=_0x2542[_0x30bca5];return _0x323b05;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2dda4d,_0x46d702){var _0x4580f4=function(_0x2c1989){while(--_0x2c1989){_0x2dda4d['push'](_0x2dda4d['shift']());}};_0x4580f4(++_0x46d702);}(_0x896e,0x1e9));var _0xe896=function(_0x4fcdcc,_0xd90c11){_0x4fcdcc=_0x4fcdcc-0x0;var _0x3f60c4=_0x896e[_0x4fcdcc];return _0x3f60c4;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 8f16c1a..f75d0b8 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3e7e24,_0x5b6fcb){_0x3e7e24=_0x3e7e24-0x0;var _0x224111=_0x5f2f[_0x3e7e24];return _0x224111;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x51b851,_0x5d059b){var _0x4f8362=function(_0x2ded43){while(--_0x2ded43){_0x51b851['push'](_0x51b851['shift']());}};_0x4f8362(++_0x5d059b);}(_0x2542,0x169));var _0x2254=function(_0x1583e0,_0x9eed2e){_0x1583e0=_0x1583e0-0x0;var _0x3ccde5=_0x2542[_0x1583e0];return _0x3ccde5;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 06d3152..1f7dec1 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 _0x73ed=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x73ed,0x1a4));var _0xd73e=function(_0x3da61a,_0x18cea9){_0x3da61a=_0x3da61a-0x0;var _0x3a471b=_0x73ed[_0x3da61a];return _0x3a471b;};'use strict';var Sequelize=require(_0xd73e('0x0'));module[_0xd73e('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xd73e('0x2')]},'exitStatus':{'type':Sequelize[_0xd73e('0x2')]},'ticketId':{'type':Sequelize[_0xd73e('0x2')]},'integrationId':{'type':Sequelize[_0xd73e('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd73e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd73e('0x2')]},'queue':{'type':Sequelize[_0xd73e('0x2')]},'interface':{'type':Sequelize[_0xd73e('0x2')]},'membername':{'type':Sequelize[_0xd73e('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd73e('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd73e('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xd73e('0x3')]},'agentacw':{'type':Sequelize[_0xd73e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd73e('0x3')]},'reason':{'type':Sequelize[_0xd73e('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xd73e('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd73e('0x4')]},'agentdump':{'type':Sequelize[_0xd73e('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd73e('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd73e('0x2')]},'channelstate':{'type':Sequelize[_0xd73e('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd73e('0x2')]},'language':{'type':Sequelize[_0xd73e('0x2')]},'accountcode':{'type':Sequelize[_0xd73e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd73e('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd73e('0x2')]},'destchannelstate':{'type':Sequelize[_0xd73e('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd73e('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd73e('0x2')]},'destcontext':{'type':Sequelize[_0xd73e('0x2')]},'destexten':{'type':Sequelize[_0xd73e('0x2')]},'destpriority':{'type':Sequelize[_0xd73e('0x2')]},'destuniqueid':{'type':Sequelize[_0xd73e('0x2')]},'messageId':{'type':Sequelize[_0xd73e('0x2')]},'inReplyTo':{'type':Sequelize[_0xd73e('0x2')]},'subject':{'type':Sequelize[_0xd73e('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd73e('0x2')]},'cc':{'type':Sequelize[_0xd73e('0x2')]},'attachment':{'type':Sequelize[_0xd73e('0x6')]},'html':{'type':Sequelize[_0xd73e('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xd73e('0x7')]('SENT',_0xd73e('0x8'),_0xd73e('0x9'),'FAILED')},'url':{'type':Sequelize[_0xd73e('0x2')]},'app':{'type':Sequelize[_0xd73e('0x2')]},'appdata':{'type':Sequelize[_0xd73e('0x2')]},'projectId':{'type':Sequelize[_0xd73e('0x3')]}}; \ No newline at end of file +var _0x5bf5=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5bf5,0x17f));var _0x55bf=function(_0x3c93fe,_0x216ea7){_0x3c93fe=_0x3c93fe-0x0;var _0xdb6c4a=_0x5bf5[_0x3c93fe];return _0xdb6c4a;};'use strict';var Sequelize=require(_0x55bf('0x0'));module['exports']={'integration':{'type':Sequelize[_0x55bf('0x1')]},'eventChannel':{'type':Sequelize[_0x55bf('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x55bf('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x55bf('0x1')]},'calleridname':{'type':Sequelize[_0x55bf('0x1')]},'queue':{'type':Sequelize[_0x55bf('0x1')]},'interface':{'type':Sequelize[_0x55bf('0x1')]},'membername':{'type':Sequelize[_0x55bf('0x1')]},'agentcalledAt':{'type':Sequelize[_0x55bf('0x3')]},'agentconnectAt':{'type':Sequelize[_0x55bf('0x3')]},'holdtime':{'type':Sequelize[_0x55bf('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x55bf('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x55bf('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x55bf('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x55bf('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x55bf('0x3')]},'lastevent':{'type':Sequelize[_0x55bf('0x1')]},'channel':{'type':Sequelize[_0x55bf('0x1')]},'channelstate':{'type':Sequelize[_0x55bf('0x2')]},'channelstatedesc':{'type':Sequelize[_0x55bf('0x1')]},'connectedlinenum':{'type':Sequelize[_0x55bf('0x1')]},'connectedlinename':{'type':Sequelize[_0x55bf('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x55bf('0x1')]},'context':{'type':Sequelize[_0x55bf('0x1')]},'exten':{'type':Sequelize[_0x55bf('0x1')]},'priority':{'type':Sequelize[_0x55bf('0x1')]},'destchannel':{'type':Sequelize[_0x55bf('0x1')]},'destchannelstate':{'type':Sequelize[_0x55bf('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x55bf('0x1')]},'destcalleridnum':{'type':Sequelize[_0x55bf('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x55bf('0x1')]},'destlanguage':{'type':Sequelize[_0x55bf('0x1')]},'destaccountcode':{'type':Sequelize[_0x55bf('0x1')]},'destcontext':{'type':Sequelize[_0x55bf('0x1')]},'destexten':{'type':Sequelize[_0x55bf('0x1')]},'destpriority':{'type':Sequelize[_0x55bf('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x55bf('0x1')]},'subject':{'type':Sequelize[_0x55bf('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x55bf('0x1')]},'cc':{'type':Sequelize[_0x55bf('0x1')]},'attachment':{'type':Sequelize[_0x55bf('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x55bf('0x5')]},'status':{'type':Sequelize[_0x55bf('0x6')](_0x55bf('0x7'),_0x55bf('0x8'),_0x55bf('0x9'),_0x55bf('0xa'))},'url':{'type':Sequelize[_0x55bf('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x55bf('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f5c9aa5..a6d01e5 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 _0x4131=['find','body','params','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','then','destroy','error','name','index','map','rawAttributes','fieldName','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','type','VIRTUAL','where','IntegrationReport','includeAll','catch','show','keys','length','include','options'];(function(_0x33c859,_0x23e448){var _0x639cbb=function(_0x2062bd){while(--_0x2062bd){_0x33c859['push'](_0x33c859['shift']());}};_0x639cbb(++_0x23e448);}(_0x4131,0x110));var _0x1413=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x4131[_0x55677b];return _0x104b88;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1413('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1413('0x1'));var moment=require(_0x1413('0x2'));var BPromise=require(_0x1413('0x3'));var Mustache=require(_0x1413('0x4'));var util=require(_0x1413('0x5'));var path=require(_0x1413('0x6'));var sox=require(_0x1413('0x7'));var csv=require(_0x1413('0x8'));var ejs=require(_0x1413('0x9'));var fs=require('fs');var fs_extra=require(_0x1413('0xa'));var _=require('lodash');var squel=require(_0x1413('0xb'));var crypto=require(_0x1413('0xc'));var jsforce=require(_0x1413('0xd'));var deskjs=require(_0x1413('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1413('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1413('0x10'));var as=require(_0x1413('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1413('0x12'));var utils=require(_0x1413('0x13'));var config=require(_0x1413('0x14'));var licenseUtil=require(_0x1413('0x15'));var db=require(_0x1413('0x16'))['db'];function respondWithStatusCode(_0x3d4e95,_0x96e4b1){_0x96e4b1=_0x96e4b1||0xcc;return function(_0x463042){if(_0x463042){return _0x3d4e95[_0x1413('0x17')](_0x96e4b1);}return _0x3d4e95[_0x1413('0x18')](_0x96e4b1)[_0x1413('0x19')]();};}function respondWithResult(_0x4e801d,_0x4e5ac7){_0x4e5ac7=_0x4e5ac7||0xc8;return function(_0x35a11b){if(_0x35a11b){return _0x4e801d['status'](_0x4e5ac7)[_0x1413('0x1a')](_0x35a11b);}};}function respondWithFilteredResult(_0x4d9404,_0x32b9c0){return function(_0x4734c2){if(_0x4734c2){var _0x5d94b8=typeof _0x32b9c0['offset']===_0x1413('0x1b')&&typeof _0x32b9c0[_0x1413('0x1c')]===_0x1413('0x1b');var _0x58fcb5=_0x4734c2['count'];var _0x5a9a1a=_0x5d94b8?0x0:_0x32b9c0[_0x1413('0x1d')];var _0x4fefcc=_0x5d94b8?_0x4734c2[_0x1413('0x1e')]:_0x32b9c0['offset']+_0x32b9c0[_0x1413('0x1c')];var _0x517785;if(_0x4fefcc>=_0x58fcb5){_0x4fefcc=_0x58fcb5;_0x517785=0xc8;}else{_0x517785=0xce;}_0x4d9404[_0x1413('0x18')](_0x517785);return _0x4d9404[_0x1413('0x1f')]('Content-Range',_0x5a9a1a+'-'+_0x4fefcc+'/'+_0x58fcb5)[_0x1413('0x1a')](_0x4734c2);}return null;};}function patchUpdates(_0x3701d5){return function(_0x5e3225){try{jsonpatch['apply'](_0x5e3225,_0x3701d5,!![]);}catch(_0x54f798){return BPromise['reject'](_0x54f798);}return _0x5e3225['save']();};}function saveUpdates(_0x34a19f,_0x336215){return function(_0x594b18){if(_0x594b18){return _0x594b18['update'](_0x34a19f)[_0x1413('0x20')](function(_0x194456){return _0x194456;});}return null;};}function removeEntity(_0xae128c,_0x23fbcd){return function(_0x3fee12){if(_0x3fee12){return _0x3fee12[_0x1413('0x21')]()['then'](function(){_0xae128c[_0x1413('0x18')](0xcc)[_0x1413('0x19')]();});}};}function handleEntityNotFound(_0x2d42e9,_0x6cf2c3){return function(_0x270b39){if(!_0x270b39){_0x2d42e9[_0x1413('0x17')](0x194);}return _0x270b39;};}function handleError(_0x3f0550,_0x4cb462){_0x4cb462=_0x4cb462||0x1f4;return function(_0x222abe){logger[_0x1413('0x22')](_0x222abe['stack']);if(_0x222abe[_0x1413('0x23')]){delete _0x222abe[_0x1413('0x23')];}_0x3f0550['status'](_0x4cb462)['send'](_0x222abe);};}exports[_0x1413('0x24')]=function(_0x104a2c,_0x476f8c){var _0x2ad502={},_0x1e56e9={},_0x25c92b={'count':0x0,'rows':[]};var _0x3b8a54=_[_0x1413('0x25')](db['IntegrationReport'][_0x1413('0x26')],function(_0x25b576){return{'name':_0x25b576[_0x1413('0x27')],'type':_0x25b576['type']['key']};});_0x1e56e9['model']=_[_0x1413('0x25')](_0x3b8a54,'name');_0x1e56e9['query']=_['keys'](_0x104a2c[_0x1413('0x28')]);_0x1e56e9['filters']=_[_0x1413('0x29')](_0x1e56e9['model'],_0x1e56e9['query']);_0x2ad502[_0x1413('0x2a')]=_[_0x1413('0x29')](_0x1e56e9[_0x1413('0x2b')],qs['fields'](_0x104a2c[_0x1413('0x28')][_0x1413('0x2c')]));_0x2ad502[_0x1413('0x2a')]=_0x2ad502[_0x1413('0x2a')]['length']?_0x2ad502[_0x1413('0x2a')]:_0x1e56e9[_0x1413('0x2b')];if(!_0x104a2c['query'][_0x1413('0x2d')](_0x1413('0x2e'))){_0x2ad502[_0x1413('0x1c')]=qs[_0x1413('0x1c')](_0x104a2c[_0x1413('0x28')][_0x1413('0x1c')]);_0x2ad502[_0x1413('0x1d')]=qs[_0x1413('0x1d')](_0x104a2c[_0x1413('0x28')][_0x1413('0x1d')]);}_0x2ad502[_0x1413('0x2f')]=qs[_0x1413('0x30')](_0x104a2c['query'][_0x1413('0x30')]);_0x2ad502['where']=qs['filters'](_['pick'](_0x104a2c[_0x1413('0x28')],_0x1e56e9[_0x1413('0x31')]),_0x3b8a54);if(_0x104a2c[_0x1413('0x28')][_0x1413('0x32')]){_0x2ad502['where']=_[_0x1413('0x33')](_0x2ad502['where'],{'$or':_['map'](_0x3b8a54,function(_0x3fbbde){if(_0x3fbbde[_0x1413('0x34')]!==_0x1413('0x35')){var _0x5ad869={};_0x5ad869[_0x3fbbde[_0x1413('0x23')]]={'$like':'%'+_0x104a2c[_0x1413('0x28')][_0x1413('0x32')]+'%'};return _0x5ad869;}})});}_0x2ad502=_[_0x1413('0x33')]({},_0x2ad502,_0x104a2c['options']);var _0x4fc45d={'where':_0x2ad502[_0x1413('0x36')]};return db[_0x1413('0x37')]['count'](_0x4fc45d)['then'](function(_0x519519){_0x25c92b[_0x1413('0x1e')]=_0x519519;if(_0x104a2c[_0x1413('0x28')][_0x1413('0x38')]){_0x2ad502['include']=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x2ad502);})[_0x1413('0x20')](function(_0x208e96){_0x25c92b['rows']=_0x208e96;return _0x25c92b;})['then'](respondWithFilteredResult(_0x476f8c,_0x2ad502))[_0x1413('0x39')](handleError(_0x476f8c,null));};exports[_0x1413('0x3a')]=function(_0x557c2e,_0x3f4ae1){var _0x2c7415={'raw':![],'where':{'id':_0x557c2e['params']['id']}},_0x18319d={};_0x18319d[_0x1413('0x2b')]=_[_0x1413('0x3b')](db['IntegrationReport'][_0x1413('0x26')]);_0x18319d['query']=_[_0x1413('0x3b')](_0x557c2e[_0x1413('0x28')]);_0x18319d[_0x1413('0x31')]=_[_0x1413('0x29')](_0x18319d[_0x1413('0x2b')],_0x18319d['query']);_0x2c7415[_0x1413('0x2a')]=_['intersection'](_0x18319d['model'],qs[_0x1413('0x2c')](_0x557c2e[_0x1413('0x28')][_0x1413('0x2c')]));_0x2c7415[_0x1413('0x2a')]=_0x2c7415[_0x1413('0x2a')][_0x1413('0x3c')]?_0x2c7415[_0x1413('0x2a')]:_0x18319d[_0x1413('0x2b')];if(_0x557c2e[_0x1413('0x28')][_0x1413('0x38')]){_0x2c7415[_0x1413('0x3d')]=[{'all':!![]}];}_0x2c7415=_[_0x1413('0x33')]({},_0x2c7415,_0x557c2e[_0x1413('0x3e')]);return db['IntegrationReport'][_0x1413('0x3f')](_0x2c7415)['then'](handleEntityNotFound(_0x3f4ae1,null))[_0x1413('0x20')](respondWithResult(_0x3f4ae1,null))[_0x1413('0x39')](handleError(_0x3f4ae1,null));};exports['create']=function(_0x25b676,_0xa22c66){return db['IntegrationReport']['create'](_0x25b676[_0x1413('0x40')],{})[_0x1413('0x20')](respondWithResult(_0xa22c66,0xc9))[_0x1413('0x39')](handleError(_0xa22c66,null));};exports['update']=function(_0x1c490b,_0x327699){if(_0x1c490b[_0x1413('0x40')]['id']){delete _0x1c490b['body']['id'];}return db[_0x1413('0x37')][_0x1413('0x3f')]({'where':{'id':_0x1c490b[_0x1413('0x41')]['id']}})[_0x1413('0x20')](handleEntityNotFound(_0x327699,null))['then'](saveUpdates(_0x1c490b[_0x1413('0x40')],null))[_0x1413('0x20')](respondWithResult(_0x327699,null))[_0x1413('0x39')](handleError(_0x327699,null));};exports['destroy']=function(_0x486438,_0x1c78fc){return db[_0x1413('0x37')][_0x1413('0x3f')]({'where':{'id':_0x486438[_0x1413('0x41')]['id']}})['then'](handleEntityNotFound(_0x1c78fc,null))['then'](removeEntity(_0x1c78fc,null))['catch'](handleError(_0x1c78fc,null));};exports[_0x1413('0x42')]=function(_0x47d363,_0xc01f32){return db[_0x1413('0x37')][_0x1413('0x42')]()[_0x1413('0x20')](respondWithResult(_0xc01f32,null))['catch'](handleError(_0xc01f32,null));}; \ No newline at end of file +var _0x0dde=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','error','send','index','map','IntegrationReport','rawAttributes','fieldName','model','name','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xf5314d,_0x4ee827){var _0x7a0979=function(_0x44f913){while(--_0x44f913){_0xf5314d['push'](_0xf5314d['shift']());}};_0x7a0979(++_0x4ee827);}(_0x0dde,0xc5));var _0xe0dd=function(_0x53cc66,_0x5162fc){_0x53cc66=_0x53cc66-0x0;var _0x6effae=_0x0dde[_0x53cc66];return _0x6effae;};'use strict';var emlformat=require(_0xe0dd('0x0'));var rimraf=require(_0xe0dd('0x1'));var zipdir=require(_0xe0dd('0x2'));var jsonpatch=require(_0xe0dd('0x3'));var rp=require(_0xe0dd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe0dd('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe0dd('0x6'));var csv=require(_0xe0dd('0x7'));var ejs=require(_0xe0dd('0x8'));var fs=require('fs');var fs_extra=require(_0xe0dd('0x9'));var _=require('lodash');var squel=require(_0xe0dd('0xa'));var crypto=require('crypto');var jsforce=require(_0xe0dd('0xb'));var deskjs=require(_0xe0dd('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe0dd('0xd'));var Papa=require(_0xe0dd('0xe'));var Redis=require(_0xe0dd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe0dd('0x10'));var as=require(_0xe0dd('0x11'));var hardwareService=require(_0xe0dd('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe0dd('0x13'));var config=require(_0xe0dd('0x14'));var licenseUtil=require(_0xe0dd('0x15'));var db=require(_0xe0dd('0x16'))['db'];function respondWithStatusCode(_0x2319a0,_0x33f484){_0x33f484=_0x33f484||0xcc;return function(_0x440f5f){if(_0x440f5f){return _0x2319a0[_0xe0dd('0x17')](_0x33f484);}return _0x2319a0['status'](_0x33f484)[_0xe0dd('0x18')]();};}function respondWithResult(_0x4a566d,_0x2631b2){_0x2631b2=_0x2631b2||0xc8;return function(_0x3db1d9){if(_0x3db1d9){return _0x4a566d[_0xe0dd('0x19')](_0x2631b2)[_0xe0dd('0x1a')](_0x3db1d9);}};}function respondWithFilteredResult(_0x53bfd1,_0x16dea5){return function(_0x119d0f){if(_0x119d0f){var _0x349ab9=typeof _0x16dea5[_0xe0dd('0x1b')]==='undefined'&&typeof _0x16dea5[_0xe0dd('0x1c')]===_0xe0dd('0x1d');var _0xd2fb0a=_0x119d0f['count'];var _0xe01a8=_0x349ab9?0x0:_0x16dea5['offset'];var _0xa3a679=_0x349ab9?_0x119d0f[_0xe0dd('0x1e')]:_0x16dea5[_0xe0dd('0x1b')]+_0x16dea5['limit'];var _0x157ba1;if(_0xa3a679>=_0xd2fb0a){_0xa3a679=_0xd2fb0a;_0x157ba1=0xc8;}else{_0x157ba1=0xce;}_0x53bfd1['status'](_0x157ba1);return _0x53bfd1[_0xe0dd('0x1f')](_0xe0dd('0x20'),_0xe01a8+'-'+_0xa3a679+'/'+_0xd2fb0a)[_0xe0dd('0x1a')](_0x119d0f);}return null;};}function patchUpdates(_0x33665b){return function(_0x569062){try{jsonpatch['apply'](_0x569062,_0x33665b,!![]);}catch(_0x32dfab){return BPromise[_0xe0dd('0x21')](_0x32dfab);}return _0x569062['save']();};}function saveUpdates(_0x324427,_0x5499f1){return function(_0x159fb4){if(_0x159fb4){return _0x159fb4[_0xe0dd('0x22')](_0x324427)['then'](function(_0x5462a2){return _0x5462a2;});}return null;};}function removeEntity(_0x56f298,_0x49b3d1){return function(_0xd9da87){if(_0xd9da87){return _0xd9da87['destroy']()[_0xe0dd('0x23')](function(){_0x56f298['status'](0xcc)[_0xe0dd('0x18')]();});}};}function handleEntityNotFound(_0x363d59,_0x4d472d){return function(_0x42441f){if(!_0x42441f){_0x363d59[_0xe0dd('0x17')](0x194);}return _0x42441f;};}function handleError(_0x2bb880,_0x266ccc){_0x266ccc=_0x266ccc||0x1f4;return function(_0x2f070c){logger[_0xe0dd('0x24')](_0x2f070c['stack']);if(_0x2f070c['name']){delete _0x2f070c['name'];}_0x2bb880['status'](_0x266ccc)[_0xe0dd('0x25')](_0x2f070c);};}exports[_0xe0dd('0x26')]=function(_0x4a8c44,_0x1c6170){var _0x154195={},_0x12e019={},_0x52c5f1={'count':0x0,'rows':[]};var _0xa26a75=_[_0xe0dd('0x27')](db[_0xe0dd('0x28')][_0xe0dd('0x29')],function(_0x47f654){return{'name':_0x47f654[_0xe0dd('0x2a')],'type':_0x47f654['type']['key']};});_0x12e019[_0xe0dd('0x2b')]=_[_0xe0dd('0x27')](_0xa26a75,_0xe0dd('0x2c'));_0x12e019[_0xe0dd('0x2d')]=_[_0xe0dd('0x2e')](_0x4a8c44[_0xe0dd('0x2d')]);_0x12e019['filters']=_[_0xe0dd('0x2f')](_0x12e019[_0xe0dd('0x2b')],_0x12e019['query']);_0x154195['attributes']=_[_0xe0dd('0x2f')](_0x12e019[_0xe0dd('0x2b')],qs[_0xe0dd('0x30')](_0x4a8c44[_0xe0dd('0x2d')]['fields']));_0x154195['attributes']=_0x154195['attributes'][_0xe0dd('0x31')]?_0x154195[_0xe0dd('0x32')]:_0x12e019[_0xe0dd('0x2b')];if(!_0x4a8c44[_0xe0dd('0x2d')][_0xe0dd('0x33')](_0xe0dd('0x34'))){_0x154195[_0xe0dd('0x1c')]=qs[_0xe0dd('0x1c')](_0x4a8c44['query'][_0xe0dd('0x1c')]);_0x154195[_0xe0dd('0x1b')]=qs['offset'](_0x4a8c44[_0xe0dd('0x2d')][_0xe0dd('0x1b')]);}_0x154195[_0xe0dd('0x35')]=qs['sort'](_0x4a8c44[_0xe0dd('0x2d')][_0xe0dd('0x36')]);_0x154195[_0xe0dd('0x37')]=qs['filters'](_[_0xe0dd('0x38')](_0x4a8c44[_0xe0dd('0x2d')],_0x12e019[_0xe0dd('0x39')]),_0xa26a75);if(_0x4a8c44[_0xe0dd('0x2d')]['filter']){_0x154195['where']=_[_0xe0dd('0x3a')](_0x154195[_0xe0dd('0x37')],{'$or':_[_0xe0dd('0x27')](_0xa26a75,function(_0x5bd203){if(_0x5bd203['type']!==_0xe0dd('0x3b')){var _0x18ae4e={};_0x18ae4e[_0x5bd203[_0xe0dd('0x2c')]]={'$like':'%'+_0x4a8c44[_0xe0dd('0x2d')][_0xe0dd('0x3c')]+'%'};return _0x18ae4e;}})});}_0x154195=_[_0xe0dd('0x3a')]({},_0x154195,_0x4a8c44[_0xe0dd('0x3d')]);var _0x1416b7={'where':_0x154195[_0xe0dd('0x37')]};return db[_0xe0dd('0x28')][_0xe0dd('0x1e')](_0x1416b7)[_0xe0dd('0x23')](function(_0x37145e){_0x52c5f1[_0xe0dd('0x1e')]=_0x37145e;if(_0x4a8c44[_0xe0dd('0x2d')][_0xe0dd('0x3e')]){_0x154195[_0xe0dd('0x3f')]=[{'all':!![]}];}return db[_0xe0dd('0x28')][_0xe0dd('0x40')](_0x154195);})['then'](function(_0x570ff4){_0x52c5f1[_0xe0dd('0x41')]=_0x570ff4;return _0x52c5f1;})[_0xe0dd('0x23')](respondWithFilteredResult(_0x1c6170,_0x154195))['catch'](handleError(_0x1c6170,null));};exports[_0xe0dd('0x42')]=function(_0x218161,_0x4022a1){var _0x29aee3={'raw':![],'where':{'id':_0x218161[_0xe0dd('0x43')]['id']}},_0x217668={};_0x217668['model']=_[_0xe0dd('0x2e')](db['IntegrationReport'][_0xe0dd('0x29')]);_0x217668['query']=_['keys'](_0x218161[_0xe0dd('0x2d')]);_0x217668[_0xe0dd('0x39')]=_['intersection'](_0x217668['model'],_0x217668['query']);_0x29aee3[_0xe0dd('0x32')]=_['intersection'](_0x217668[_0xe0dd('0x2b')],qs['fields'](_0x218161[_0xe0dd('0x2d')]['fields']));_0x29aee3[_0xe0dd('0x32')]=_0x29aee3[_0xe0dd('0x32')]['length']?_0x29aee3[_0xe0dd('0x32')]:_0x217668[_0xe0dd('0x2b')];if(_0x218161[_0xe0dd('0x2d')][_0xe0dd('0x3e')]){_0x29aee3['include']=[{'all':!![]}];}_0x29aee3=_[_0xe0dd('0x3a')]({},_0x29aee3,_0x218161[_0xe0dd('0x3d')]);return db[_0xe0dd('0x28')]['find'](_0x29aee3)[_0xe0dd('0x23')](handleEntityNotFound(_0x4022a1,null))[_0xe0dd('0x23')](respondWithResult(_0x4022a1,null))[_0xe0dd('0x44')](handleError(_0x4022a1,null));};exports['create']=function(_0xe75abc,_0xe8665){return db[_0xe0dd('0x28')]['create'](_0xe75abc['body'],{})['then'](respondWithResult(_0xe8665,0xc9))[_0xe0dd('0x44')](handleError(_0xe8665,null));};exports['update']=function(_0x44a116,_0x202aad){if(_0x44a116[_0xe0dd('0x45')]['id']){delete _0x44a116[_0xe0dd('0x45')]['id'];}return db['IntegrationReport'][_0xe0dd('0x46')]({'where':{'id':_0x44a116[_0xe0dd('0x43')]['id']}})['then'](handleEntityNotFound(_0x202aad,null))[_0xe0dd('0x23')](saveUpdates(_0x44a116[_0xe0dd('0x45')],null))[_0xe0dd('0x23')](respondWithResult(_0x202aad,null))['catch'](handleError(_0x202aad,null));};exports['destroy']=function(_0x18b81f,_0x397301){return db[_0xe0dd('0x28')][_0xe0dd('0x46')]({'where':{'id':_0x18b81f[_0xe0dd('0x43')]['id']}})[_0xe0dd('0x23')](handleEntityNotFound(_0x397301,null))['then'](removeEntity(_0x397301,null))[_0xe0dd('0x44')](handleError(_0x397301,null));};exports[_0xe0dd('0x47')]=function(_0x137008,_0x2066b2){return db[_0xe0dd('0x28')]['describe']()[_0xe0dd('0x23')](respondWithResult(_0x2066b2,null))[_0xe0dd('0x44')](handleError(_0x2066b2,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 835040a..441cd58 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 _0x73ec=['util','../../config/logger','api','moment','request-promise','path','rimraf','./integrationReport.attributes','IntegrationReport','lodash'];(function(_0x4f3db1,_0x141597){var _0xfc054d=function(_0x127e72){while(--_0x127e72){_0x4f3db1['push'](_0x4f3db1['shift']());}};_0xfc054d(++_0x141597);}(_0x73ec,0xb3));var _0xc73e=function(_0x40b0a6,_0x337a67){_0x40b0a6=_0x40b0a6-0x0;var _0x2c94d5=_0x73ec[_0x40b0a6];return _0x2c94d5;};'use strict';var _=require(_0xc73e('0x0'));var util=require(_0xc73e('0x1'));var logger=require(_0xc73e('0x2'))(_0xc73e('0x3'));var moment=require(_0xc73e('0x4'));var BPromise=require('bluebird');var rp=require(_0xc73e('0x5'));var fs=require('fs');var path=require(_0xc73e('0x6'));var rimraf=require(_0xc73e('0x7'));var config=require('../../config/environment');var attributes=require(_0xc73e('0x8'));module['exports']=function(_0x1610f7,_0xd55f7a){return _0x1610f7['define'](_0xc73e('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ffb=['IntegrationReport','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4561dc,_0xc869){var _0x814679=function(_0x110477){while(--_0x110477){_0x4561dc['push'](_0x4561dc['shift']());}};_0x814679(++_0xc869);}(_0x9ffb,0xdd));var _0xb9ff=function(_0x52233d,_0x3a9c4f){_0x52233d=_0x52233d-0x0;var _0x4432c5=_0x9ffb[_0x52233d];return _0x4432c5;};'use strict';var _=require(_0xb9ff('0x0'));var util=require(_0xb9ff('0x1'));var logger=require(_0xb9ff('0x2'))('api');var moment=require(_0xb9ff('0x3'));var BPromise=require('bluebird');var rp=require(_0xb9ff('0x4'));var fs=require('fs');var path=require(_0xb9ff('0x5'));var rimraf=require(_0xb9ff('0x6'));var config=require(_0xb9ff('0x7'));var attributes=require('./integrationReport.attributes');module[_0xb9ff('0x8')]=function(_0x435c90,_0x1e8b2c){return _0x435c90[_0xb9ff('0x9')](_0xb9ff('0xa'),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 dcce8bc..718e5e1 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 _0x326f=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b1413,_0x1bee2d){var _0x357291=function(_0x4f97b4){while(--_0x4f97b4){_0x4b1413['push'](_0x4b1413['shift']());}};_0x357291(++_0x1bee2d);}(_0x326f,0xd1));var _0xf326=function(_0x143bd7,_0xfbca3c){_0x143bd7=_0x143bd7-0x0;var _0x364a1e=_0x326f[_0x143bd7];return _0x364a1e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','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','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1aeaa9,_0xba18e){_0x1aeaa9=_0x1aeaa9-0x0;var _0x5413bd=_0xc2c7[_0x1aeaa9];return _0x5413bd;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index f9a0a6b..c222832 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 _0x8f6b=['Router','../../components/auth/service','../../components/interaction/service','./interval.controller','isAuthenticated','get','show','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','/:id','update','delete','destroy','multer','util','path','express'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x8f6b,0x146));var _0xb8f6=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x8f6b[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0xb8f6('0x0'));var util=require(_0xb8f6('0x1'));var path=require(_0xb8f6('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8f6('0x3'));var router=express[_0xb8f6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb8f6('0x5'));var interaction=require(_0xb8f6('0x6'));var config=require('../../config/environment');var controller=require(_0xb8f6('0x7'));router['get']('/',auth[_0xb8f6('0x8')](),controller['index']);router[_0xb8f6('0x9')]('/:id',auth[_0xb8f6('0x8')](),controller[_0xb8f6('0xa')]);router['get']('/:id/sub_intervals',auth[_0xb8f6('0x8')](),controller[_0xb8f6('0xb')]);router[_0xb8f6('0xc')]('/',auth[_0xb8f6('0x8')](),controller[_0xb8f6('0xd')]);router[_0xb8f6('0xc')](_0xb8f6('0xe'),auth[_0xb8f6('0x8')](),controller[_0xb8f6('0xf')]);router[_0xb8f6('0xc')](_0xb8f6('0x10'),auth[_0xb8f6('0x8')](),controller['addIntervals']);router[_0xb8f6('0x11')](_0xb8f6('0x12'),auth['isAuthenticated'](),controller[_0xb8f6('0x13')]);router[_0xb8f6('0x14')](_0xb8f6('0x12'),auth['isAuthenticated'](),controller[_0xb8f6('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5a9e=['show','/:id/sub_intervals','isAuthenticated','getIntervals','create','post','/:id/sub_intervals/create_many','addIntervals','put','/:id','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x53b4cc,_0x43ed3b){var _0x12efa1=function(_0x4b78e2){while(--_0x4b78e2){_0x53b4cc['push'](_0x53b4cc['shift']());}};_0x12efa1(++_0x43ed3b);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x5a9e[_0x430459];return _0x3a2439;};'use strict';var multer=require('multer');var util=require(_0xe5a9('0x0'));var path=require(_0xe5a9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe5a9('0x2')]();var fs_extra=require(_0xe5a9('0x3'));var auth=require(_0xe5a9('0x4'));var interaction=require(_0xe5a9('0x5'));var config=require(_0xe5a9('0x6'));var controller=require('./interval.controller');router[_0xe5a9('0x7')]('/',auth['isAuthenticated'](),controller[_0xe5a9('0x8')]);router[_0xe5a9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe5a9('0x9')]);router[_0xe5a9('0x7')](_0xe5a9('0xa'),auth[_0xe5a9('0xb')](),controller[_0xe5a9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe5a9('0xd')]);router['post'](_0xe5a9('0xa'),auth['isAuthenticated'](),controller['addInterval']);router[_0xe5a9('0xe')](_0xe5a9('0xf'),auth[_0xe5a9('0xb')](),controller[_0xe5a9('0x10')]);router[_0xe5a9('0x11')](_0xe5a9('0x12'),auth[_0xe5a9('0xb')](),controller['update']);router[_0xe5a9('0x13')](_0xe5a9('0x12'),auth[_0xe5a9('0xb')](),controller[_0xe5a9('0x14')]);module[_0xe5a9('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index ed08f38..f674470 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 _0x1ab9=['sequelize','exports','STRING'];(function(_0x573df0,_0x5b1298){var _0x5c5d3f=function(_0x7b10c6){while(--_0x7b10c6){_0x573df0['push'](_0x573df0['shift']());}};_0x5c5d3f(++_0x5b1298);}(_0x1ab9,0x1c2));var _0x91ab=function(_0x1fb038,_0xc3f69b){_0x1fb038=_0x1fb038-0x0;var _0x1600dc=_0x1ab9[_0x1fb038];return _0x1600dc;};'use strict';var Sequelize=require(_0x91ab('0x0'));module[_0x91ab('0x1')]={'name':{'type':Sequelize[_0x91ab('0x2')]},'description':{'type':Sequelize[_0x91ab('0x2')]},'interval':{'type':Sequelize[_0x91ab('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb284=['STRING','sequelize','exports'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xb284,0x76));var _0x4b28=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb284[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4b28('0x0'));module[_0x4b28('0x1')]={'name':{'type':Sequelize[_0x4b28('0x2')]},'description':{'type':Sequelize[_0x4b28('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 a188215..73ee7b2 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 _0x2dc1=['addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','get','Intervals','UserProfileResource','status','error','stack','name','index','map','Interval','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','catch','show','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','findOne'];(function(_0x32470e,_0x41d1b3){var _0x35ddef=function(_0x12d85f){while(--_0x12d85f){_0x32470e['push'](_0x32470e['shift']());}};_0x35ddef(++_0x41d1b3);}(_0x2dc1,0x119));var _0x12dc=function(_0x4885db,_0x135160){_0x4885db=_0x4885db-0x0;var _0x431dc6=_0x2dc1[_0x4885db];return _0x431dc6;};'use strict';var emlformat=require(_0x12dc('0x0'));var rimraf=require(_0x12dc('0x1'));var zipdir=require(_0x12dc('0x2'));var jsonpatch=require(_0x12dc('0x3'));var rp=require(_0x12dc('0x4'));var moment=require(_0x12dc('0x5'));var BPromise=require(_0x12dc('0x6'));var Mustache=require('mustache');var util=require(_0x12dc('0x7'));var path=require(_0x12dc('0x8'));var sox=require(_0x12dc('0x9'));var csv=require(_0x12dc('0xa'));var ejs=require(_0x12dc('0xb'));var fs=require('fs');var fs_extra=require(_0x12dc('0xc'));var _=require(_0x12dc('0xd'));var squel=require('squel');var crypto=require(_0x12dc('0xe'));var jsforce=require(_0x12dc('0xf'));var deskjs=require(_0x12dc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x12dc('0x11'));var Papa=require(_0x12dc('0x12'));var Redis=require(_0x12dc('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x12dc('0x14'));var as=require(_0x12dc('0x15'));var hardwareService=require(_0x12dc('0x16'));var logger=require('../../config/logger')(_0x12dc('0x17'));var utils=require(_0x12dc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x12dc('0x19'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x38edb6,_0x44cf7b){_0x44cf7b=_0x44cf7b||0xcc;return function(_0xf83de1){if(_0xf83de1){return _0x38edb6[_0x12dc('0x1a')](_0x44cf7b);}return _0x38edb6['status'](_0x44cf7b)[_0x12dc('0x1b')]();};}function respondWithResult(_0x4cb88f,_0x5650c3){_0x5650c3=_0x5650c3||0xc8;return function(_0xa91b32){if(_0xa91b32){return _0x4cb88f['status'](_0x5650c3)['json'](_0xa91b32);}};}function respondWithFilteredResult(_0x56908c,_0xbc5492){return function(_0x2f3e26){if(_0x2f3e26){var _0x371ed1=typeof _0xbc5492[_0x12dc('0x1c')]===_0x12dc('0x1d')&&typeof _0xbc5492[_0x12dc('0x1e')]===_0x12dc('0x1d');var _0x4aa584=_0x2f3e26[_0x12dc('0x1f')];var _0x32a161=_0x371ed1?0x0:_0xbc5492['offset'];var _0x17f6b5=_0x371ed1?_0x2f3e26[_0x12dc('0x1f')]:_0xbc5492[_0x12dc('0x1c')]+_0xbc5492[_0x12dc('0x1e')];var _0x392ade;if(_0x17f6b5>=_0x4aa584){_0x17f6b5=_0x4aa584;_0x392ade=0xc8;}else{_0x392ade=0xce;}_0x56908c['status'](_0x392ade);return _0x56908c[_0x12dc('0x20')](_0x12dc('0x21'),_0x32a161+'-'+_0x17f6b5+'/'+_0x4aa584)[_0x12dc('0x22')](_0x2f3e26);}return null;};}function patchUpdates(_0x3ba317){return function(_0x1a47e0){try{jsonpatch[_0x12dc('0x23')](_0x1a47e0,_0x3ba317,!![]);}catch(_0x3792df){return BPromise['reject'](_0x3792df);}return _0x1a47e0['save']();};}function saveUpdates(_0x4ed040,_0x2990ab){return function(_0x2cfaa1){if(_0x2cfaa1){return _0x2cfaa1[_0x12dc('0x24')](_0x4ed040)[_0x12dc('0x25')](function(_0x266833){return _0x266833;});}return null;};}function removeEntity(_0x1514dc,_0x5e494f){return function(_0x55ba8b){if(_0x55ba8b){return _0x55ba8b[_0x12dc('0x26')]()[_0x12dc('0x25')](function(){var _0x124c17=_0x55ba8b[_0x12dc('0x27')]({'plain':!![]});var _0x56c18d=_0x12dc('0x28');return db[_0x12dc('0x29')][_0x12dc('0x26')]({'where':{'type':_0x56c18d,'resourceId':_0x124c17['id']}})[_0x12dc('0x25')](function(){return _0x55ba8b;});})[_0x12dc('0x25')](function(){_0x1514dc[_0x12dc('0x2a')](0xcc)[_0x12dc('0x1b')]();});}};}function handleEntityNotFound(_0x2d8a92,_0x4d360b){return function(_0x4b5eeb){if(!_0x4b5eeb){_0x2d8a92[_0x12dc('0x1a')](0x194);}return _0x4b5eeb;};}function handleError(_0x333f88,_0x52d22a){_0x52d22a=_0x52d22a||0x1f4;return function(_0xb0b0c8){logger[_0x12dc('0x2b')](_0xb0b0c8[_0x12dc('0x2c')]);if(_0xb0b0c8[_0x12dc('0x2d')]){delete _0xb0b0c8[_0x12dc('0x2d')];}_0x333f88[_0x12dc('0x2a')](_0x52d22a)['send'](_0xb0b0c8);};}exports[_0x12dc('0x2e')]=function(_0x265a43,_0x3b39a0){var _0xf1032c={},_0x1bca2e={},_0x5c44d6={'count':0x0,'rows':[]};var _0xf31d6d=_[_0x12dc('0x2f')](db[_0x12dc('0x30')][_0x12dc('0x31')],function(_0x3e4884){return{'name':_0x3e4884[_0x12dc('0x32')],'type':_0x3e4884['type']['key']};});_0x1bca2e[_0x12dc('0x33')]=_[_0x12dc('0x2f')](_0xf31d6d,_0x12dc('0x2d'));_0x1bca2e[_0x12dc('0x34')]=_[_0x12dc('0x35')](_0x265a43[_0x12dc('0x34')]);_0x1bca2e[_0x12dc('0x36')]=_['intersection'](_0x1bca2e['model'],_0x1bca2e[_0x12dc('0x34')]);_0xf1032c[_0x12dc('0x37')]=_[_0x12dc('0x38')](_0x1bca2e[_0x12dc('0x33')],qs['fields'](_0x265a43[_0x12dc('0x34')]['fields']));_0xf1032c['attributes']=_0xf1032c['attributes'][_0x12dc('0x39')]?_0xf1032c['attributes']:_0x1bca2e[_0x12dc('0x33')];if(!_0x265a43['query'][_0x12dc('0x3a')](_0x12dc('0x3b'))){_0xf1032c[_0x12dc('0x1e')]=qs[_0x12dc('0x1e')](_0x265a43[_0x12dc('0x34')][_0x12dc('0x1e')]);_0xf1032c[_0x12dc('0x1c')]=qs[_0x12dc('0x1c')](_0x265a43[_0x12dc('0x34')]['offset']);}_0xf1032c[_0x12dc('0x3c')]=qs[_0x12dc('0x3d')](_0x265a43[_0x12dc('0x34')][_0x12dc('0x3d')]);_0xf1032c[_0x12dc('0x3e')]=qs['filters'](_[_0x12dc('0x3f')](_0x265a43['query'],_0x1bca2e['filters']),_0xf31d6d);if(_0x265a43[_0x12dc('0x34')][_0x12dc('0x40')]){_0xf1032c[_0x12dc('0x3e')]=_[_0x12dc('0x41')](_0xf1032c['where'],{'$or':_[_0x12dc('0x2f')](_0xf31d6d,function(_0x4e522d){if(_0x4e522d[_0x12dc('0x42')]!=='VIRTUAL'){var _0xd7dd8d={};_0xd7dd8d[_0x4e522d['name']]={'$like':'%'+_0x265a43[_0x12dc('0x34')][_0x12dc('0x40')]+'%'};return _0xd7dd8d;}})});}_0xf1032c=_[_0x12dc('0x41')]({},_0xf1032c,_0x265a43[_0x12dc('0x43')]);var _0x560d36={'where':_0xf1032c['where']};return db[_0x12dc('0x30')][_0x12dc('0x1f')](_0x560d36)['then'](function(_0x10d50e){_0x5c44d6['count']=_0x10d50e;if(_0x265a43['query'][_0x12dc('0x44')]){_0xf1032c['include']=[{'all':!![]}];}return db[_0x12dc('0x30')][_0x12dc('0x45')](_0xf1032c);})[_0x12dc('0x25')](function(_0x592038){_0x5c44d6['rows']=_0x592038;return _0x5c44d6;})[_0x12dc('0x25')](respondWithFilteredResult(_0x3b39a0,_0xf1032c))[_0x12dc('0x46')](handleError(_0x3b39a0,null));};exports[_0x12dc('0x47')]=function(_0x2f8fff,_0x5cd3f4){var _0x4cee43={'raw':!![],'where':{'id':_0x2f8fff['params']['id']}},_0x293097={};_0x293097[_0x12dc('0x33')]=_[_0x12dc('0x35')](db[_0x12dc('0x30')]['rawAttributes']);_0x293097[_0x12dc('0x34')]=_['keys'](_0x2f8fff['query']);_0x293097[_0x12dc('0x36')]=_[_0x12dc('0x38')](_0x293097['model'],_0x293097[_0x12dc('0x34')]);_0x4cee43[_0x12dc('0x37')]=_[_0x12dc('0x38')](_0x293097[_0x12dc('0x33')],qs[_0x12dc('0x48')](_0x2f8fff[_0x12dc('0x34')]['fields']));_0x4cee43[_0x12dc('0x37')]=_0x4cee43[_0x12dc('0x37')]['length']?_0x4cee43['attributes']:_0x293097[_0x12dc('0x33')];if(_0x2f8fff[_0x12dc('0x34')]['includeAll']){_0x4cee43[_0x12dc('0x49')]=[{'all':!![]}];}_0x4cee43=_[_0x12dc('0x41')]({},_0x4cee43,_0x2f8fff[_0x12dc('0x43')]);return db['Interval'][_0x12dc('0x4a')](_0x4cee43)[_0x12dc('0x25')](handleEntityNotFound(_0x5cd3f4,null))[_0x12dc('0x25')](respondWithResult(_0x5cd3f4,null))['catch'](handleError(_0x5cd3f4,null));};exports[_0x12dc('0x4b')]=function(_0x28efd8,_0x286973){return db['Interval'][_0x12dc('0x4b')](_0x28efd8[_0x12dc('0x4c')],{})[_0x12dc('0x25')](function(_0x4c8a4c){var _0xc104ad=_0x28efd8[_0x12dc('0x4d')][_0x12dc('0x27')]({'plain':!![]});if(!_0xc104ad)throw new Error(_0x12dc('0x4e'));if(_0xc104ad[_0x12dc('0x4f')]===_0x12dc('0x4d')){var _0x164d5c=_0x4c8a4c[_0x12dc('0x27')]({'plain':!![]});var _0x53c0df=_0x12dc('0x28');return db[_0x12dc('0x50')]['find']({'where':{'name':_0x53c0df,'userProfileId':_0xc104ad[_0x12dc('0x51')]},'raw':!![]})[_0x12dc('0x25')](function(_0x1ac600){if(_0x1ac600&&_0x1ac600['autoAssociation']===0x0){return db[_0x12dc('0x29')][_0x12dc('0x4b')]({'name':_0x164d5c[_0x12dc('0x2d')],'resourceId':_0x164d5c['id'],'type':_0x1ac600['name'],'sectionId':_0x1ac600['id']},{})[_0x12dc('0x25')](function(){return _0x4c8a4c;});}else{return _0x4c8a4c;}})[_0x12dc('0x46')](function(_0x5a01c1){logger[_0x12dc('0x2b')](_0x12dc('0x52'),_0x5a01c1);throw _0x5a01c1;});}return _0x4c8a4c;})[_0x12dc('0x25')](respondWithResult(_0x286973,0xc9))['catch'](handleError(_0x286973,null));};exports[_0x12dc('0x24')]=function(_0x3c77b0,_0x458ba1){if(_0x3c77b0[_0x12dc('0x4c')]['id']){delete _0x3c77b0[_0x12dc('0x4c')]['id'];}return db[_0x12dc('0x30')]['find']({'where':{'id':_0x3c77b0[_0x12dc('0x53')]['id']}})[_0x12dc('0x25')](handleEntityNotFound(_0x458ba1,null))[_0x12dc('0x25')](saveUpdates(_0x3c77b0[_0x12dc('0x4c')],null))['then'](respondWithResult(_0x458ba1,null))[_0x12dc('0x46')](handleError(_0x458ba1,null));};exports[_0x12dc('0x26')]=function(_0xb55c6f,_0xcbb6cb){return db[_0x12dc('0x30')][_0x12dc('0x4a')]({'where':{'id':_0xb55c6f[_0x12dc('0x53')]['id']}})[_0x12dc('0x25')](handleEntityNotFound(_0xcbb6cb,null))['then'](removeEntity(_0xcbb6cb,null))[_0x12dc('0x46')](handleError(_0xcbb6cb,null));};exports[_0x12dc('0x54')]=function(_0x54fdee,_0x339ae2,_0x13ca68){if(_0x54fdee[_0x12dc('0x4c')]['id']){delete _0x54fdee[_0x12dc('0x4c')]['id'];}return db[_0x12dc('0x30')][_0x12dc('0x4a')]({'where':{'id':_0x54fdee[_0x12dc('0x53')]['id']}})['then'](handleEntityNotFound(_0x339ae2,null))[_0x12dc('0x25')](function(_0x130b18){if(_0x130b18){_0x54fdee[_0x12dc('0x4c')]['IntervalId']=_0x130b18['id'];return db[_0x12dc('0x30')][_0x12dc('0x4b')](_0x54fdee[_0x12dc('0x4c')]);}})[_0x12dc('0x25')](respondWithResult(_0x339ae2,null))['catch'](handleError(_0x339ae2,null));};exports[_0x12dc('0x55')]=function(_0x25dd35,_0x2fbfc2,_0x14d68d){var _0x5e7359={};var _0x1ecb17={};var _0x323152;var _0x2b3fca;return db[_0x12dc('0x30')][_0x12dc('0x56')]({'where':{'id':_0x25dd35[_0x12dc('0x53')]['id']}})[_0x12dc('0x25')](handleEntityNotFound(_0x2fbfc2,null))['then'](function(_0x55322f){if(_0x55322f){_0x323152=_0x55322f;_0x1ecb17[_0x12dc('0x33')]=_[_0x12dc('0x35')](db[_0x12dc('0x30')][_0x12dc('0x31')]);_0x1ecb17[_0x12dc('0x34')]=_[_0x12dc('0x35')](_0x25dd35[_0x12dc('0x34')]);_0x1ecb17[_0x12dc('0x36')]=_[_0x12dc('0x38')](_0x1ecb17[_0x12dc('0x33')],_0x1ecb17['query']);_0x5e7359[_0x12dc('0x37')]=_[_0x12dc('0x38')](_0x1ecb17[_0x12dc('0x33')],qs[_0x12dc('0x48')](_0x25dd35[_0x12dc('0x34')][_0x12dc('0x48')]));_0x5e7359[_0x12dc('0x37')]=_0x5e7359[_0x12dc('0x37')][_0x12dc('0x39')]?_0x5e7359[_0x12dc('0x37')]:_0x1ecb17[_0x12dc('0x33')];_0x5e7359[_0x12dc('0x3c')]=qs[_0x12dc('0x3d')](_0x25dd35[_0x12dc('0x34')]['sort']);_0x5e7359[_0x12dc('0x3e')]=qs[_0x12dc('0x36')](_['pick'](_0x25dd35[_0x12dc('0x34')],_0x1ecb17['filters']));if(_0x25dd35[_0x12dc('0x34')][_0x12dc('0x40')]){_0x5e7359[_0x12dc('0x3e')]=_['merge'](_0x5e7359[_0x12dc('0x3e')],{'$or':_[_0x12dc('0x2f')](_0x5e7359['attributes'],function(_0x5b5e83){var _0x41448e={};_0x41448e[_0x5b5e83]={'$like':'%'+_0x25dd35['query'][_0x12dc('0x40')]+'%'};return _0x41448e;})});}_0x5e7359=_[_0x12dc('0x41')]({},_0x5e7359,_0x25dd35[_0x12dc('0x43')]);return _0x323152[_0x12dc('0x55')](_0x5e7359);}})['then'](function(_0x4823ac){if(_0x4823ac){_0x2b3fca=_0x4823ac['length'];if(!_0x25dd35['query']['hasOwnProperty'](_0x12dc('0x3b'))){_0x5e7359[_0x12dc('0x1e')]=qs[_0x12dc('0x1e')](_0x25dd35[_0x12dc('0x34')][_0x12dc('0x1e')]);_0x5e7359[_0x12dc('0x1c')]=qs['offset'](_0x25dd35[_0x12dc('0x34')][_0x12dc('0x1c')]);}return _0x323152[_0x12dc('0x55')](_0x5e7359);}})['then'](function(_0x3ffc2e){if(_0x3ffc2e){return _0x3ffc2e?{'count':_0x2b3fca,'rows':_0x3ffc2e}:null;}})[_0x12dc('0x25')](respondWithResult(_0x2fbfc2,null))['catch'](handleError(_0x2fbfc2,null));};exports[_0x12dc('0x57')]=function(_0x42ffd7,_0x5aef1c,_0x530369){return db[_0x12dc('0x30')][_0x12dc('0x56')]({'where':{'id':_0x42ffd7[_0x12dc('0x53')]['id']}})['then'](handleEntityNotFound(_0x5aef1c,null))[_0x12dc('0x25')](function(_0x2d11a1){if(_0x2d11a1){return db[_0x12dc('0x58')][_0x12dc('0x59')](function(_0x428d37){return db['Interval'][_0x12dc('0x26')]({'where':{'IntervalId':_0x42ffd7['params']['id']},'transaction':_0x428d37})['then'](function(_0x590f99){var _0x2a83a7=_[_0x12dc('0x2f')](_0x42ffd7[_0x12dc('0x4c')],function(_0xbc7477){delete _0xbc7477['id'];_0xbc7477[_0x12dc('0x5a')]=_0x42ffd7[_0x12dc('0x53')]['id'];return _0xbc7477;});return db[_0x12dc('0x30')][_0x12dc('0x5b')](_0x2a83a7,{'transaction':_0x428d37});});})[_0x12dc('0x25')](function(){return db[_0x12dc('0x30')][_0x12dc('0x45')]({'where':{'IntervalId':_0x42ffd7[_0x12dc('0x53')]['id']}});});}})[_0x12dc('0x25')](respondWithResult(_0x5aef1c,null))[_0x12dc('0x46')](handleError(_0x5aef1c,null));}; \ No newline at end of file +var _0x8d66=['update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','index','Interval','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','length','include','find','catch','create','body','user','UserProfileSection','autoAssociation','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','IntervalId','findAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject'];(function(_0xf87bbf,_0x3180af){var _0x322140=function(_0xb03a01){while(--_0xb03a01){_0xf87bbf['push'](_0xf87bbf['shift']());}};_0x322140(++_0x3180af);}(_0x8d66,0xda));var _0x68d6=function(_0x1e611f,_0x432715){_0x1e611f=_0x1e611f-0x0;var _0x411867=_0x8d66[_0x1e611f];return _0x411867;};'use strict';var emlformat=require(_0x68d6('0x0'));var rimraf=require(_0x68d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68d6('0x2'));var rp=require(_0x68d6('0x3'));var moment=require('moment');var BPromise=require(_0x68d6('0x4'));var Mustache=require(_0x68d6('0x5'));var util=require(_0x68d6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x68d6('0x7'));var ejs=require(_0x68d6('0x8'));var fs=require('fs');var fs_extra=require(_0x68d6('0x9'));var _=require(_0x68d6('0xa'));var squel=require('squel');var crypto=require(_0x68d6('0xb'));var jsforce=require(_0x68d6('0xc'));var deskjs=require(_0x68d6('0xd'));var toCsv=require(_0x68d6('0x7'));var querystring=require(_0x68d6('0xe'));var Papa=require(_0x68d6('0xf'));var Redis=require(_0x68d6('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68d6('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x68d6('0x12'));var config=require(_0x68d6('0x13'));var licenseUtil=require(_0x68d6('0x14'));var db=require(_0x68d6('0x15'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2f36b1,_0x2b4c39){_0x2b4c39=_0x2b4c39||0xcc;return function(_0x1f9614){if(_0x1f9614){return _0x2f36b1[_0x68d6('0x16')](_0x2b4c39);}return _0x2f36b1[_0x68d6('0x17')](_0x2b4c39)['end']();};}function respondWithResult(_0x4cbb6d,_0x4f58c5){_0x4f58c5=_0x4f58c5||0xc8;return function(_0x224599){if(_0x224599){return _0x4cbb6d['status'](_0x4f58c5)['json'](_0x224599);}};}function respondWithFilteredResult(_0xd92a2d,_0x5caf67){return function(_0x1d350b){if(_0x1d350b){var _0x54f11e=typeof _0x5caf67[_0x68d6('0x18')]===_0x68d6('0x19')&&typeof _0x5caf67[_0x68d6('0x1a')]===_0x68d6('0x19');var _0xe3fba6=_0x1d350b[_0x68d6('0x1b')];var _0x53d978=_0x54f11e?0x0:_0x5caf67['offset'];var _0x5163b2=_0x54f11e?_0x1d350b[_0x68d6('0x1b')]:_0x5caf67[_0x68d6('0x18')]+_0x5caf67[_0x68d6('0x1a')];var _0x212b11;if(_0x5163b2>=_0xe3fba6){_0x5163b2=_0xe3fba6;_0x212b11=0xc8;}else{_0x212b11=0xce;}_0xd92a2d[_0x68d6('0x17')](_0x212b11);return _0xd92a2d['set']('Content-Range',_0x53d978+'-'+_0x5163b2+'/'+_0xe3fba6)[_0x68d6('0x1c')](_0x1d350b);}return null;};}function patchUpdates(_0x3ede94){return function(_0xee6d15){try{jsonpatch[_0x68d6('0x1d')](_0xee6d15,_0x3ede94,!![]);}catch(_0x479423){return BPromise[_0x68d6('0x1e')](_0x479423);}return _0xee6d15['save']();};}function saveUpdates(_0x4a0868,_0x35f302){return function(_0x36a0b5){if(_0x36a0b5){return _0x36a0b5[_0x68d6('0x1f')](_0x4a0868)[_0x68d6('0x20')](function(_0x3ace90){return _0x3ace90;});}return null;};}function removeEntity(_0x1d7b07,_0x37c411){return function(_0x2e77a8){if(_0x2e77a8){return _0x2e77a8[_0x68d6('0x21')]()['then'](function(){var _0x413747=_0x2e77a8[_0x68d6('0x22')]({'plain':!![]});var _0x527f31=_0x68d6('0x23');return db[_0x68d6('0x24')]['destroy']({'where':{'type':_0x527f31,'resourceId':_0x413747['id']}})[_0x68d6('0x20')](function(){return _0x2e77a8;});})[_0x68d6('0x20')](function(){_0x1d7b07['status'](0xcc)[_0x68d6('0x25')]();});}};}function handleEntityNotFound(_0x5665d0,_0x4db7d8){return function(_0x5f4e5c){if(!_0x5f4e5c){_0x5665d0[_0x68d6('0x16')](0x194);}return _0x5f4e5c;};}function handleError(_0x15fa4e,_0x313cb3){_0x313cb3=_0x313cb3||0x1f4;return function(_0x4b0002){logger[_0x68d6('0x26')](_0x4b0002[_0x68d6('0x27')]);if(_0x4b0002[_0x68d6('0x28')]){delete _0x4b0002['name'];}_0x15fa4e[_0x68d6('0x17')](_0x313cb3)['send'](_0x4b0002);};}exports[_0x68d6('0x29')]=function(_0x2d9a45,_0x1bf5fd){var _0x47b9eb={},_0x4748ac={},_0x4fe58d={'count':0x0,'rows':[]};var _0x3ac411=_['map'](db[_0x68d6('0x2a')][_0x68d6('0x2b')],function(_0x3f7ad3){return{'name':_0x3f7ad3['fieldName'],'type':_0x3f7ad3[_0x68d6('0x2c')][_0x68d6('0x2d')]};});_0x4748ac[_0x68d6('0x2e')]=_[_0x68d6('0x2f')](_0x3ac411,'name');_0x4748ac[_0x68d6('0x30')]=_[_0x68d6('0x31')](_0x2d9a45[_0x68d6('0x30')]);_0x4748ac['filters']=_[_0x68d6('0x32')](_0x4748ac[_0x68d6('0x2e')],_0x4748ac[_0x68d6('0x30')]);_0x47b9eb[_0x68d6('0x33')]=_[_0x68d6('0x32')](_0x4748ac[_0x68d6('0x2e')],qs[_0x68d6('0x34')](_0x2d9a45[_0x68d6('0x30')][_0x68d6('0x34')]));_0x47b9eb[_0x68d6('0x33')]=_0x47b9eb[_0x68d6('0x33')]['length']?_0x47b9eb[_0x68d6('0x33')]:_0x4748ac[_0x68d6('0x2e')];if(!_0x2d9a45[_0x68d6('0x30')][_0x68d6('0x35')]('nolimit')){_0x47b9eb['limit']=qs['limit'](_0x2d9a45[_0x68d6('0x30')][_0x68d6('0x1a')]);_0x47b9eb[_0x68d6('0x18')]=qs[_0x68d6('0x18')](_0x2d9a45[_0x68d6('0x30')][_0x68d6('0x18')]);}_0x47b9eb[_0x68d6('0x36')]=qs[_0x68d6('0x37')](_0x2d9a45[_0x68d6('0x30')][_0x68d6('0x37')]);_0x47b9eb['where']=qs['filters'](_['pick'](_0x2d9a45[_0x68d6('0x30')],_0x4748ac[_0x68d6('0x38')]),_0x3ac411);if(_0x2d9a45[_0x68d6('0x30')][_0x68d6('0x39')]){_0x47b9eb[_0x68d6('0x3a')]=_['merge'](_0x47b9eb[_0x68d6('0x3a')],{'$or':_['map'](_0x3ac411,function(_0x4dfd40){if(_0x4dfd40['type']!==_0x68d6('0x3b')){var _0x133c2d={};_0x133c2d[_0x4dfd40[_0x68d6('0x28')]]={'$like':'%'+_0x2d9a45[_0x68d6('0x30')][_0x68d6('0x39')]+'%'};return _0x133c2d;}})});}_0x47b9eb=_[_0x68d6('0x3c')]({},_0x47b9eb,_0x2d9a45[_0x68d6('0x3d')]);var _0x280997={'where':_0x47b9eb['where']};return db[_0x68d6('0x2a')][_0x68d6('0x1b')](_0x280997)['then'](function(_0x425432){_0x4fe58d[_0x68d6('0x1b')]=_0x425432;if(_0x2d9a45[_0x68d6('0x30')][_0x68d6('0x3e')]){_0x47b9eb['include']=[{'all':!![]}];}return db[_0x68d6('0x2a')]['findAll'](_0x47b9eb);})[_0x68d6('0x20')](function(_0x3040bb){_0x4fe58d[_0x68d6('0x3f')]=_0x3040bb;return _0x4fe58d;})[_0x68d6('0x20')](respondWithFilteredResult(_0x1bf5fd,_0x47b9eb))['catch'](handleError(_0x1bf5fd,null));};exports[_0x68d6('0x40')]=function(_0x4331be,_0x15076c){var _0x4d35c2={'raw':!![],'where':{'id':_0x4331be[_0x68d6('0x41')]['id']}},_0x517d1b={};_0x517d1b['model']=_[_0x68d6('0x31')](db[_0x68d6('0x2a')]['rawAttributes']);_0x517d1b[_0x68d6('0x30')]=_[_0x68d6('0x31')](_0x4331be[_0x68d6('0x30')]);_0x517d1b[_0x68d6('0x38')]=_['intersection'](_0x517d1b[_0x68d6('0x2e')],_0x517d1b['query']);_0x4d35c2[_0x68d6('0x33')]=_[_0x68d6('0x32')](_0x517d1b[_0x68d6('0x2e')],qs[_0x68d6('0x34')](_0x4331be['query'][_0x68d6('0x34')]));_0x4d35c2[_0x68d6('0x33')]=_0x4d35c2['attributes'][_0x68d6('0x42')]?_0x4d35c2['attributes']:_0x517d1b['model'];if(_0x4331be[_0x68d6('0x30')][_0x68d6('0x3e')]){_0x4d35c2[_0x68d6('0x43')]=[{'all':!![]}];}_0x4d35c2=_[_0x68d6('0x3c')]({},_0x4d35c2,_0x4331be[_0x68d6('0x3d')]);return db[_0x68d6('0x2a')][_0x68d6('0x44')](_0x4d35c2)['then'](handleEntityNotFound(_0x15076c,null))[_0x68d6('0x20')](respondWithResult(_0x15076c,null))[_0x68d6('0x45')](handleError(_0x15076c,null));};exports[_0x68d6('0x46')]=function(_0x244b53,_0x45a3b4){return db[_0x68d6('0x2a')]['create'](_0x244b53[_0x68d6('0x47')],{})[_0x68d6('0x20')](function(_0x3b37b8){var _0x3a1786=_0x244b53[_0x68d6('0x48')][_0x68d6('0x22')]({'plain':!![]});if(!_0x3a1786)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a1786['role']===_0x68d6('0x48')){var _0x1168cf=_0x3b37b8[_0x68d6('0x22')]({'plain':!![]});var _0x5f027c=_0x68d6('0x23');return db[_0x68d6('0x49')][_0x68d6('0x44')]({'where':{'name':_0x5f027c,'userProfileId':_0x3a1786['userProfileId']},'raw':!![]})[_0x68d6('0x20')](function(_0x29120f){if(_0x29120f&&_0x29120f[_0x68d6('0x4a')]===0x0){return db[_0x68d6('0x24')][_0x68d6('0x46')]({'name':_0x1168cf[_0x68d6('0x28')],'resourceId':_0x1168cf['id'],'type':_0x29120f[_0x68d6('0x28')],'sectionId':_0x29120f['id']},{})['then'](function(){return _0x3b37b8;});}else{return _0x3b37b8;}})[_0x68d6('0x45')](function(_0x52091c){logger[_0x68d6('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52091c);throw _0x52091c;});}return _0x3b37b8;})[_0x68d6('0x20')](respondWithResult(_0x45a3b4,0xc9))['catch'](handleError(_0x45a3b4,null));};exports[_0x68d6('0x1f')]=function(_0x331ed4,_0x3e3220){if(_0x331ed4[_0x68d6('0x47')]['id']){delete _0x331ed4[_0x68d6('0x47')]['id'];}return db['Interval'][_0x68d6('0x44')]({'where':{'id':_0x331ed4[_0x68d6('0x41')]['id']}})[_0x68d6('0x20')](handleEntityNotFound(_0x3e3220,null))[_0x68d6('0x20')](saveUpdates(_0x331ed4[_0x68d6('0x47')],null))['then'](respondWithResult(_0x3e3220,null))[_0x68d6('0x45')](handleError(_0x3e3220,null));};exports['destroy']=function(_0x3c5eee,_0x3e56d5){return db[_0x68d6('0x2a')][_0x68d6('0x44')]({'where':{'id':_0x3c5eee['params']['id']}})[_0x68d6('0x20')](handleEntityNotFound(_0x3e56d5,null))[_0x68d6('0x20')](removeEntity(_0x3e56d5,null))['catch'](handleError(_0x3e56d5,null));};exports['addInterval']=function(_0x5a8736,_0x3d6a33,_0x2a97dc){if(_0x5a8736[_0x68d6('0x47')]['id']){delete _0x5a8736[_0x68d6('0x47')]['id'];}return db[_0x68d6('0x2a')]['find']({'where':{'id':_0x5a8736[_0x68d6('0x41')]['id']}})[_0x68d6('0x20')](handleEntityNotFound(_0x3d6a33,null))[_0x68d6('0x20')](function(_0x53750a){if(_0x53750a){_0x5a8736[_0x68d6('0x47')]['IntervalId']=_0x53750a['id'];return db[_0x68d6('0x2a')][_0x68d6('0x46')](_0x5a8736[_0x68d6('0x47')]);}})['then'](respondWithResult(_0x3d6a33,null))[_0x68d6('0x45')](handleError(_0x3d6a33,null));};exports[_0x68d6('0x4b')]=function(_0x44c4b3,_0x31998d,_0x537da5){var _0x232a75={};var _0xc603df={};var _0x4b09fc;var _0x1798c9;return db[_0x68d6('0x2a')][_0x68d6('0x4c')]({'where':{'id':_0x44c4b3[_0x68d6('0x41')]['id']}})['then'](handleEntityNotFound(_0x31998d,null))[_0x68d6('0x20')](function(_0x2ddd02){if(_0x2ddd02){_0x4b09fc=_0x2ddd02;_0xc603df[_0x68d6('0x2e')]=_['keys'](db[_0x68d6('0x2a')][_0x68d6('0x2b')]);_0xc603df['query']=_[_0x68d6('0x31')](_0x44c4b3[_0x68d6('0x30')]);_0xc603df[_0x68d6('0x38')]=_[_0x68d6('0x32')](_0xc603df[_0x68d6('0x2e')],_0xc603df['query']);_0x232a75[_0x68d6('0x33')]=_[_0x68d6('0x32')](_0xc603df[_0x68d6('0x2e')],qs[_0x68d6('0x34')](_0x44c4b3[_0x68d6('0x30')][_0x68d6('0x34')]));_0x232a75[_0x68d6('0x33')]=_0x232a75[_0x68d6('0x33')][_0x68d6('0x42')]?_0x232a75[_0x68d6('0x33')]:_0xc603df[_0x68d6('0x2e')];_0x232a75['order']=qs[_0x68d6('0x37')](_0x44c4b3[_0x68d6('0x30')][_0x68d6('0x37')]);_0x232a75['where']=qs[_0x68d6('0x38')](_['pick'](_0x44c4b3[_0x68d6('0x30')],_0xc603df[_0x68d6('0x38')]));if(_0x44c4b3[_0x68d6('0x30')][_0x68d6('0x39')]){_0x232a75[_0x68d6('0x3a')]=_[_0x68d6('0x3c')](_0x232a75[_0x68d6('0x3a')],{'$or':_[_0x68d6('0x2f')](_0x232a75[_0x68d6('0x33')],function(_0x3531a0){var _0xff1e47={};_0xff1e47[_0x3531a0]={'$like':'%'+_0x44c4b3[_0x68d6('0x30')][_0x68d6('0x39')]+'%'};return _0xff1e47;})});}_0x232a75=_[_0x68d6('0x3c')]({},_0x232a75,_0x44c4b3[_0x68d6('0x3d')]);return _0x4b09fc['getIntervals'](_0x232a75);}})[_0x68d6('0x20')](function(_0x4ea4ce){if(_0x4ea4ce){_0x1798c9=_0x4ea4ce[_0x68d6('0x42')];if(!_0x44c4b3[_0x68d6('0x30')]['hasOwnProperty'](_0x68d6('0x4d'))){_0x232a75[_0x68d6('0x1a')]=qs['limit'](_0x44c4b3[_0x68d6('0x30')][_0x68d6('0x1a')]);_0x232a75[_0x68d6('0x18')]=qs[_0x68d6('0x18')](_0x44c4b3[_0x68d6('0x30')][_0x68d6('0x18')]);}return _0x4b09fc[_0x68d6('0x4b')](_0x232a75);}})[_0x68d6('0x20')](function(_0x13eed4){if(_0x13eed4){return _0x13eed4?{'count':_0x1798c9,'rows':_0x13eed4}:null;}})[_0x68d6('0x20')](respondWithResult(_0x31998d,null))[_0x68d6('0x45')](handleError(_0x31998d,null));};exports[_0x68d6('0x4e')]=function(_0x3407fb,_0x556bc9,_0x5e2011){return db[_0x68d6('0x2a')][_0x68d6('0x4c')]({'where':{'id':_0x3407fb['params']['id']}})[_0x68d6('0x20')](handleEntityNotFound(_0x556bc9,null))[_0x68d6('0x20')](function(_0x2b5233){if(_0x2b5233){return db[_0x68d6('0x4f')][_0x68d6('0x50')](function(_0x255c78){return db[_0x68d6('0x2a')]['destroy']({'where':{'IntervalId':_0x3407fb[_0x68d6('0x41')]['id']},'transaction':_0x255c78})[_0x68d6('0x20')](function(_0xea9722){var _0x29520b=_[_0x68d6('0x2f')](_0x3407fb[_0x68d6('0x47')],function(_0x51b9a2){delete _0x51b9a2['id'];_0x51b9a2[_0x68d6('0x51')]=_0x3407fb['params']['id'];return _0x51b9a2;});return db[_0x68d6('0x2a')]['bulkCreate'](_0x29520b,{'transaction':_0x255c78});});})['then'](function(){return db[_0x68d6('0x2a')][_0x68d6('0x52')]({'where':{'IntervalId':_0x3407fb[_0x68d6('0x41')]['id']}});});}})[_0x68d6('0x20')](respondWithResult(_0x556bc9,null))['catch'](handleError(_0x556bc9,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c75343a..34b9bb9 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 _0x513e=['rimraf','../../config/environment','./interval.attributes','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x513e,0x138));var _0xe513=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x513e[_0x11946c];return _0x383935;};'use strict';var _=require(_0xe513('0x0'));var util=require(_0xe513('0x1'));var logger=require(_0xe513('0x2'))(_0xe513('0x3'));var moment=require(_0xe513('0x4'));var BPromise=require(_0xe513('0x5'));var rp=require(_0xe513('0x6'));var fs=require('fs');var path=require(_0xe513('0x7'));var rimraf=require(_0xe513('0x8'));var config=require(_0xe513('0x9'));var attributes=require(_0xe513('0xa'));var extensions=require('../../components/extensions/rewrite');module[_0xe513('0xb')]=function(_0x4cf910,_0x2dd1bd){return _0x4cf910[_0xe513('0xc')](_0xe513('0xd'),attributes,{'tableName':_0xe513('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x395486,_0x28f456){extensions[_0xe513('0xf')](_0x4cf910,_0x395486);},'afterBulkCreate':function(_0x3d0e6c,_0x18bbdf,_0x25c604){_0x25c604();extensions['rewrite'](_0x4cf910,_0x3d0e6c[0x0]);},'afterUpdate':function(_0x10e058,_0x2cb153){extensions[_0xe513('0xf')](_0x4cf910,_0x10e058);},'afterDestroy':function(_0x542090,_0x439eb7){extensions[_0xe513('0xf')](_0x4cf910,_0x542090);}}});}; \ No newline at end of file +var _0x041e=['Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define'];(function(_0x320cf5,_0x2dc6b1){var _0x411545=function(_0x4fc8f9){while(--_0x4fc8f9){_0x320cf5['push'](_0x320cf5['shift']());}};_0x411545(++_0x2dc6b1);}(_0x041e,0x73));var _0xe041=function(_0x3d194d,_0x1a245f){_0x3d194d=_0x3d194d-0x0;var _0x284729=_0x041e[_0x3d194d];return _0x284729;};'use strict';var _=require(_0xe041('0x0'));var util=require(_0xe041('0x1'));var logger=require(_0xe041('0x2'))(_0xe041('0x3'));var moment=require(_0xe041('0x4'));var BPromise=require(_0xe041('0x5'));var rp=require(_0xe041('0x6'));var fs=require('fs');var path=require(_0xe041('0x7'));var rimraf=require(_0xe041('0x8'));var config=require(_0xe041('0x9'));var attributes=require('./interval.attributes');var extensions=require(_0xe041('0xa'));module[_0xe041('0xb')]=function(_0x44af5f,_0x5c8b1e){return _0x44af5f[_0xe041('0xc')](_0xe041('0xd'),attributes,{'tableName':_0xe041('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x576e38,_0x23a7b1){extensions[_0xe041('0xf')](_0x44af5f,_0x576e38);},'afterBulkCreate':function(_0x330a44,_0x1aeff8,_0xa7dd2a){_0xa7dd2a();extensions[_0xe041('0xf')](_0x44af5f,_0x330a44[0x0]);},'afterUpdate':function(_0x57ce26,_0x4bb76e){extensions[_0xe041('0xf')](_0x44af5f,_0x57ce26);},'afterDestroy':function(_0x556b50,_0x258a75){extensions['rewrite'](_0x44af5f,_0x556b50);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7bde72f..538c390 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 _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 14f514c..85df365 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x0b0e[_0x1d128e];return _0x3d5236;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index fac9cca..8fc4cb1 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 _0x98c7=['bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','customfield_11500','email','fields','customfield_11501','oldToken','newToken','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','utf8','end','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body'];(function(_0x2d9bc8,_0x539d37){var _0x2b96ac=function(_0x3cb660){while(--_0x3cb660){_0x2d9bc8['push'](_0x2d9bc8['shift']());}};_0x2b96ac(++_0x539d37);}(_0x98c7,0xb0));var _0x798c=function(_0x722103,_0x5732f3){_0x722103=_0x722103-0x0;var _0x3e2435=_0x98c7[_0x722103];return _0x3e2435;};'use strict';var BPromise=require(_0x798c('0x0'));var https=require(_0x798c('0x1'));var logger=require(_0x798c('0x2'))(_0x798c('0x3'));var USERNAME=_0x798c('0x4');var PASSWORD=_0x798c('0x5');function openIssue(_0x3a8c2a,_0xa6e4e5){var _0x3ad170={'fields':{'project':{'key':_0x3a8c2a[_0x798c('0x6')]||_0x798c('0x7')},'summary':(_0x3a8c2a[_0x798c('0x8')]||_0x798c('0x9'))+'\x20from\x20'+_0x3a8c2a['ip'],'description':_0x3a8c2a[_0x798c('0xa')]||JSON[_0x798c('0xb')](_0x3a8c2a),'issuetype':{'name':_0x3a8c2a[_0x798c('0xc')]||'Bug'}}};_0x3ad170['fields'][_0x798c('0xd')]=_0x3a8c2a[_0x798c('0xe')];_0x3ad170[_0x798c('0xf')][_0x798c('0x10')]=_0x3a8c2a[_0x798c('0x11')];_0x3ad170[_0x798c('0xf')]['customfield_11502']=_0x3a8c2a[_0x798c('0x12')];_0x3ad170[_0x798c('0xf')][_0x798c('0x13')]=_0x3a8c2a['name'];_0x3ad170[_0x798c('0xf')][_0x798c('0x14')]=_0x3a8c2a[_0x798c('0x15')];_0x3ad170['fields']['customfield_10102']=_0x3a8c2a['ip'];var _0x548b65={'host':_0x798c('0x16'),'port':0x1bb,'path':_0x798c('0x17'),'method':_0x798c('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x798c('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x798c('0x1a')](_0x798c('0x1b'))}};var _0x512464=JSON[_0x798c('0xb')](_0x3ad170);var _0x40bd07=https['request'](_0x548b65,function(_0x4c8d22){_0x4c8d22['setEncoding'](_0x798c('0x1c'));var _0x4e0bae='';_0x4c8d22['on']('data',function(_0x24cd93){_0x4e0bae+=_0x24cd93;});_0x4c8d22['on'](_0x798c('0x1d'),function(){if(_0xa6e4e5){return _0xa6e4e5['status'](_0x4c8d22['statusCode'])[_0x798c('0x1e')](JSON[_0x798c('0x1f')](_0x4e0bae));}});});_0x40bd07['on'](_0x798c('0x20'),function(_0x4a9150){if(_0xa6e4e5){return _0xa6e4e5[_0x798c('0x21')](0x1f4)[_0x798c('0x1e')]({'errors':[{'message':_0x798c('0x22'),'type':_0x798c('0x23')}]});}});_0x40bd07[_0x798c('0x24')](_0x512464);_0x40bd07[_0x798c('0x1d')]();}exports[_0x798c('0x25')]=openIssue;exports['send']=function(_0x2fe1c4,_0x4519b7){_0x2fe1c4['body']['ip']=_0x2fe1c4[_0x798c('0x26')][_0x798c('0x27')]||_0x2fe1c4[_0x798c('0x28')][_0x798c('0x29')]||_0x2fe1c4['socket'][_0x798c('0x29')]||_0x2fe1c4[_0x798c('0x28')][_0x798c('0x2a')][_0x798c('0x29')];return openIssue(_0x2fe1c4[_0x798c('0x2b')],_0x4519b7);}; \ No newline at end of file +var _0x91bd=['customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','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','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','MOTGUI','summary','\x20from\x20','description','stringify','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken'];(function(_0x3ea454,_0x2e63b0){var _0x1a4c00=function(_0x19eede){while(--_0x19eede){_0x3ea454['push'](_0x3ea454['shift']());}};_0x1a4c00(++_0x2e63b0);}(_0x91bd,0x1b3));var _0xd91b=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x91bd[_0x2adbeb];return _0x5e18a6;};'use strict';var BPromise=require(_0xd91b('0x0'));var https=require(_0xd91b('0x1'));var logger=require('../../config/logger')(_0xd91b('0x2'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x4c7f2b,_0x1427d8){var _0x542d63={'fields':{'project':{'key':_0x4c7f2b['key']||_0xd91b('0x3')},'summary':(_0x4c7f2b[_0xd91b('0x4')]||'Report')+_0xd91b('0x5')+_0x4c7f2b['ip'],'description':_0x4c7f2b[_0xd91b('0x6')]||JSON[_0xd91b('0x7')](_0x4c7f2b),'issuetype':{'name':_0x4c7f2b['issuetype']||'Bug'}}};_0x542d63[_0xd91b('0x8')][_0xd91b('0x9')]=_0x4c7f2b[_0xd91b('0xa')];_0x542d63[_0xd91b('0x8')][_0xd91b('0xb')]=_0x4c7f2b[_0xd91b('0xc')];_0x542d63[_0xd91b('0x8')][_0xd91b('0xd')]=_0x4c7f2b[_0xd91b('0xe')];_0x542d63[_0xd91b('0x8')][_0xd91b('0xf')]=_0x4c7f2b[_0xd91b('0x10')];_0x542d63[_0xd91b('0x8')][_0xd91b('0x11')]=_0x4c7f2b[_0xd91b('0x12')];_0x542d63[_0xd91b('0x8')][_0xd91b('0x13')]=_0x4c7f2b['ip'];var _0x4ceb2d={'host':_0xd91b('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xd91b('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xd91b('0x16'),'Authorization':_0xd91b('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xd91b('0x18')](_0xd91b('0x19'))}};var _0x431b06=JSON[_0xd91b('0x7')](_0x542d63);var _0x515ff3=https[_0xd91b('0x1a')](_0x4ceb2d,function(_0x3d500b){_0x3d500b[_0xd91b('0x1b')](_0xd91b('0x1c'));var _0x4fd445='';_0x3d500b['on'](_0xd91b('0x1d'),function(_0x33d8ec){_0x4fd445+=_0x33d8ec;});_0x3d500b['on'](_0xd91b('0x1e'),function(){if(_0x1427d8){return _0x1427d8[_0xd91b('0x1f')](_0x3d500b[_0xd91b('0x20')])[_0xd91b('0x21')](JSON[_0xd91b('0x22')](_0x4fd445));}});});_0x515ff3['on'](_0xd91b('0x23'),function(_0xd4e1e8){if(_0x1427d8){return _0x1427d8['status'](0x1f4)['json']({'errors':[{'message':_0xd91b('0x24'),'type':'api.jira'}]});}});_0x515ff3[_0xd91b('0x25')](_0x431b06);_0x515ff3[_0xd91b('0x1e')]();}exports[_0xd91b('0x26')]=openIssue;exports['send']=function(_0x281f5e,_0xc35a3e){_0x281f5e[_0xd91b('0x27')]['ip']=_0x281f5e[_0xd91b('0x28')][_0xd91b('0x29')]||_0x281f5e[_0xd91b('0x2a')][_0xd91b('0x2b')]||_0x281f5e['socket']['remoteAddress']||_0x281f5e[_0xd91b('0x2a')][_0xd91b('0x2c')][_0xd91b('0x2b')];return openIssue(_0x281f5e[_0xd91b('0x27')],_0xc35a3e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 5774a7a..5cb3790 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 _0xbdb7=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get','describe','show','post','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4d13b7,_0x16a458){var _0x4a6741=function(_0x1c7626){while(--_0x1c7626){_0x4d13b7['push'](_0x4d13b7['shift']());}};_0x4a6741(++_0x16a458);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x182454,_0x4c25dd){_0x182454=_0x182454-0x0;var _0x262191=_0xbdb7[_0x182454];return _0x262191;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')]('/',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')](_0x7bdb('0x12'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0x14')]);module[_0x7bdb('0x15')]=router; \ No newline at end of file +var _0x750a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','exports','util','express','Router'];(function(_0x4b9cd5,_0x55aee4){var _0x58f242=function(_0x4ea72c){while(--_0x4ea72c){_0x4b9cd5['push'](_0x4b9cd5['shift']());}};_0x58f242(++_0x55aee4);}(_0x750a,0x140));var _0xa750=function(_0x527986,_0x3726f7){_0x527986=_0x527986-0x0;var _0x45abd9=_0x750a[_0x527986];return _0x45abd9;};'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['describe']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0xe')]('/',auth['isAuthenticated'](),controller[_0xa750('0xf')]);router[_0xa750('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa750('0x11')]);router['delete'](_0xa750('0xc'),auth[_0xa750('0x9')](),controller['destroy']);module[_0xa750('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index c235b76..eed4f47 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(_0x57b366,_0xaa2a){_0x57b366=_0x57b366-0x0;var _0x3f94e2=_0x7a54[_0x57b366];return _0x3f94e2;};'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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x1e88e9,_0x4d42bf){_0x1e88e9=_0x1e88e9-0x0;var _0x3edbda=_0x7a54[_0x1e88e9];return _0x3edbda;};'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 59e8da3..7971694 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 _0x86f4=['bluebird','util','path','to-csv','ejs','fs-extra','lodash','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','JscriptyAnswerReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2e6c39,_0x4931ff){var _0x34f21=function(_0x3602c8){while(--_0x3602c8){_0x2e6c39['push'](_0x2e6c39['shift']());}};_0x34f21(++_0x4931ff);}(_0x86f4,0x18a));var _0x486f=function(_0x280ef0,_0x5ef63b){_0x280ef0=_0x280ef0-0x0;var _0x173bd9=_0x86f4[_0x280ef0];return _0x173bd9;};'use strict';var emlformat=require(_0x486f('0x0'));var rimraf=require(_0x486f('0x1'));var zipdir=require(_0x486f('0x2'));var jsonpatch=require(_0x486f('0x3'));var rp=require(_0x486f('0x4'));var moment=require(_0x486f('0x5'));var BPromise=require(_0x486f('0x6'));var Mustache=require('mustache');var util=require(_0x486f('0x7'));var path=require(_0x486f('0x8'));var sox=require('sox');var csv=require(_0x486f('0x9'));var ejs=require(_0x486f('0xa'));var fs=require('fs');var fs_extra=require(_0x486f('0xb'));var _=require(_0x486f('0xc'));var squel=require(_0x486f('0xd'));var crypto=require(_0x486f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x486f('0xf'));var toCsv=require(_0x486f('0x9'));var querystring=require(_0x486f('0x10'));var Papa=require(_0x486f('0x11'));var Redis=require(_0x486f('0x12'));var authService=require(_0x486f('0x13'));var qs=require(_0x486f('0x14'));var as=require(_0x486f('0x15'));var hardwareService=require(_0x486f('0x16'));var logger=require(_0x486f('0x17'))(_0x486f('0x18'));var utils=require(_0x486f('0x19'));var config=require(_0x486f('0x1a'));var licenseUtil=require(_0x486f('0x1b'));var db=require(_0x486f('0x1c'))['db'];function respondWithStatusCode(_0x4312fb,_0x1c4e55){_0x1c4e55=_0x1c4e55||0xcc;return function(_0x4eb4f9){if(_0x4eb4f9){return _0x4312fb[_0x486f('0x1d')](_0x1c4e55);}return _0x4312fb['status'](_0x1c4e55)[_0x486f('0x1e')]();};}function respondWithResult(_0x2cc608,_0x1ac871){_0x1ac871=_0x1ac871||0xc8;return function(_0x50bee8){if(_0x50bee8){return _0x2cc608['status'](_0x1ac871)[_0x486f('0x1f')](_0x50bee8);}};}function respondWithFilteredResult(_0x3a4fef,_0x51334f){return function(_0x16830e){if(_0x16830e){var _0x2ab753=typeof _0x51334f[_0x486f('0x20')]==='undefined'&&typeof _0x51334f['limit']===_0x486f('0x21');var _0x3eeae0=_0x16830e[_0x486f('0x22')];var _0x39bfac=_0x2ab753?0x0:_0x51334f['offset'];var _0x59deb8=_0x2ab753?_0x16830e[_0x486f('0x22')]:_0x51334f[_0x486f('0x20')]+_0x51334f[_0x486f('0x23')];var _0x20a1f7;if(_0x59deb8>=_0x3eeae0){_0x59deb8=_0x3eeae0;_0x20a1f7=0xc8;}else{_0x20a1f7=0xce;}_0x3a4fef[_0x486f('0x24')](_0x20a1f7);return _0x3a4fef[_0x486f('0x25')](_0x486f('0x26'),_0x39bfac+'-'+_0x59deb8+'/'+_0x3eeae0)[_0x486f('0x1f')](_0x16830e);}return null;};}function patchUpdates(_0xe0b1cc){return function(_0x3d79bc){try{jsonpatch[_0x486f('0x27')](_0x3d79bc,_0xe0b1cc,!![]);}catch(_0x4ccac0){return BPromise[_0x486f('0x28')](_0x4ccac0);}return _0x3d79bc[_0x486f('0x29')]();};}function saveUpdates(_0x26a909,_0x4a0eb5){return function(_0x4d784e){if(_0x4d784e){return _0x4d784e[_0x486f('0x2a')](_0x26a909)[_0x486f('0x2b')](function(_0x16a530){return _0x16a530;});}return null;};}function removeEntity(_0x14b309,_0x351f81){return function(_0x26822b){if(_0x26822b){return _0x26822b[_0x486f('0x2c')]()[_0x486f('0x2b')](function(){_0x14b309[_0x486f('0x24')](0xcc)[_0x486f('0x1e')]();});}};}function handleEntityNotFound(_0x2e983b,_0x71a26f){return function(_0x387462){if(!_0x387462){_0x2e983b[_0x486f('0x1d')](0x194);}return _0x387462;};}function handleError(_0x8b3277,_0x30b322){_0x30b322=_0x30b322||0x1f4;return function(_0x6f1e8e){logger[_0x486f('0x2d')](_0x6f1e8e[_0x486f('0x2e')]);if(_0x6f1e8e[_0x486f('0x2f')]){delete _0x6f1e8e[_0x486f('0x2f')];}_0x8b3277[_0x486f('0x24')](_0x30b322)['send'](_0x6f1e8e);};}exports['index']=function(_0x52fb3a,_0x5b4718){var _0x173512={},_0x5c994a={},_0x2003a3={'count':0x0,'rows':[]};var _0x3ffa45=_['map'](db[_0x486f('0x30')]['rawAttributes'],function(_0x1f9dee){return{'name':_0x1f9dee[_0x486f('0x31')],'type':_0x1f9dee[_0x486f('0x32')][_0x486f('0x33')]};});_0x5c994a[_0x486f('0x34')]=_[_0x486f('0x35')](_0x3ffa45,'name');_0x5c994a[_0x486f('0x36')]=_[_0x486f('0x37')](_0x52fb3a[_0x486f('0x36')]);_0x5c994a[_0x486f('0x38')]=_[_0x486f('0x39')](_0x5c994a[_0x486f('0x34')],_0x5c994a[_0x486f('0x36')]);_0x173512[_0x486f('0x3a')]=_['intersection'](_0x5c994a[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x52fb3a['query'][_0x486f('0x3b')]));_0x173512[_0x486f('0x3a')]=_0x173512[_0x486f('0x3a')][_0x486f('0x3c')]?_0x173512[_0x486f('0x3a')]:_0x5c994a['model'];if(!_0x52fb3a[_0x486f('0x36')][_0x486f('0x3d')](_0x486f('0x3e'))){_0x173512[_0x486f('0x23')]=qs[_0x486f('0x23')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x23')]);_0x173512['offset']=qs[_0x486f('0x20')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x20')]);}_0x173512['order']=qs['sort'](_0x52fb3a[_0x486f('0x36')][_0x486f('0x3f')]);_0x173512['where']=qs[_0x486f('0x38')](_['pick'](_0x52fb3a[_0x486f('0x36')],_0x5c994a[_0x486f('0x38')]),_0x3ffa45);if(_0x52fb3a['query']['filter']){_0x173512[_0x486f('0x40')]=_[_0x486f('0x41')](_0x173512[_0x486f('0x40')],{'$or':_[_0x486f('0x35')](_0x3ffa45,function(_0xdedd85){if(_0xdedd85[_0x486f('0x32')]!==_0x486f('0x42')){var _0x1742e0={};_0x1742e0[_0xdedd85[_0x486f('0x2f')]]={'$like':'%'+_0x52fb3a[_0x486f('0x36')][_0x486f('0x43')]+'%'};return _0x1742e0;}})});}_0x173512=_[_0x486f('0x41')]({},_0x173512,_0x52fb3a[_0x486f('0x44')]);var _0x43d9be={'where':_0x173512['where']};return db[_0x486f('0x30')][_0x486f('0x22')](_0x43d9be)['then'](function(_0x12f7dc){_0x2003a3[_0x486f('0x22')]=_0x12f7dc;if(_0x52fb3a[_0x486f('0x36')][_0x486f('0x45')]){_0x173512[_0x486f('0x46')]=[{'all':!![]}];}return db[_0x486f('0x30')][_0x486f('0x47')](_0x173512);})[_0x486f('0x2b')](function(_0x3205e0){_0x2003a3['rows']=_0x3205e0;return _0x2003a3;})['then'](respondWithFilteredResult(_0x5b4718,_0x173512))[_0x486f('0x48')](handleError(_0x5b4718,null));};exports[_0x486f('0x49')]=function(_0x3cf897,_0x42ef68){var _0x2937a6={'raw':!![],'where':{'id':_0x3cf897[_0x486f('0x4a')]['id']}},_0x250979={};_0x250979[_0x486f('0x34')]=_[_0x486f('0x37')](db['JscriptyAnswerReport'][_0x486f('0x4b')]);_0x250979[_0x486f('0x36')]=_[_0x486f('0x37')](_0x3cf897[_0x486f('0x36')]);_0x250979['filters']=_[_0x486f('0x39')](_0x250979['model'],_0x250979[_0x486f('0x36')]);_0x2937a6[_0x486f('0x3a')]=_[_0x486f('0x39')](_0x250979[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x3cf897[_0x486f('0x36')]['fields']));_0x2937a6['attributes']=_0x2937a6[_0x486f('0x3a')][_0x486f('0x3c')]?_0x2937a6[_0x486f('0x3a')]:_0x250979[_0x486f('0x34')];if(_0x3cf897['query'][_0x486f('0x45')]){_0x2937a6[_0x486f('0x46')]=[{'all':!![]}];}_0x2937a6=_[_0x486f('0x41')]({},_0x2937a6,_0x3cf897['options']);return db[_0x486f('0x30')][_0x486f('0x4c')](_0x2937a6)[_0x486f('0x2b')](handleEntityNotFound(_0x42ef68,null))[_0x486f('0x2b')](respondWithResult(_0x42ef68,null))[_0x486f('0x48')](handleError(_0x42ef68,null));};exports[_0x486f('0x4d')]=function(_0xb65e98,_0x21f222){return db['JscriptyAnswerReport'][_0x486f('0x4d')](_0xb65e98['body'],{})[_0x486f('0x2b')](respondWithResult(_0x21f222,0xc9))[_0x486f('0x48')](handleError(_0x21f222,null));};exports[_0x486f('0x2a')]=function(_0x1055cf,_0x34033e){if(_0x1055cf[_0x486f('0x4e')]['id']){delete _0x1055cf['body']['id'];}return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x1055cf[_0x486f('0x4a')]['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x34033e,null))[_0x486f('0x2b')](saveUpdates(_0x1055cf[_0x486f('0x4e')],null))[_0x486f('0x2b')](respondWithResult(_0x34033e,null))[_0x486f('0x48')](handleError(_0x34033e,null));};exports[_0x486f('0x2c')]=function(_0x5cd989,_0x300de9){return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x5cd989['params']['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x300de9,null))[_0x486f('0x2b')](removeEntity(_0x300de9,null))[_0x486f('0x48')](handleError(_0x300de9,null));};exports['describe']=function(_0x195c9c,_0x372d2f){return db[_0x486f('0x30')][_0x486f('0x4f')]()['then'](respondWithResult(_0x372d2f,null))['catch'](handleError(_0x372d2f,null));}; \ No newline at end of file +var _0xfc17=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','JscriptyAnswerReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x219f28,_0x19bba4){var _0x202646=function(_0x36d924){while(--_0x36d924){_0x219f28['push'](_0x219f28['shift']());}};_0x202646(++_0x19bba4);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x3d5260,_0x5dd5eb){_0x3d5260=_0x3d5260-0x0;var _0x24b423=_0xfc17[_0x3d5260];return _0x24b423;};'use strict';var emlformat=require(_0x7fc1('0x0'));var rimraf=require(_0x7fc1('0x1'));var zipdir=require(_0x7fc1('0x2'));var jsonpatch=require(_0x7fc1('0x3'));var rp=require('request-promise');var moment=require(_0x7fc1('0x4'));var BPromise=require(_0x7fc1('0x5'));var Mustache=require(_0x7fc1('0x6'));var util=require(_0x7fc1('0x7'));var path=require(_0x7fc1('0x8'));var sox=require(_0x7fc1('0x9'));var csv=require('to-csv');var ejs=require(_0x7fc1('0xa'));var fs=require('fs');var fs_extra=require(_0x7fc1('0xb'));var _=require(_0x7fc1('0xc'));var squel=require(_0x7fc1('0xd'));var crypto=require(_0x7fc1('0xe'));var jsforce=require(_0x7fc1('0xf'));var deskjs=require(_0x7fc1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7fc1('0x11'));var Papa=require(_0x7fc1('0x12'));var Redis=require(_0x7fc1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7fc1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fc1('0x15'))(_0x7fc1('0x16'));var utils=require(_0x7fc1('0x17'));var config=require(_0x7fc1('0x18'));var licenseUtil=require(_0x7fc1('0x19'));var db=require(_0x7fc1('0x1a'))['db'];function respondWithStatusCode(_0x53277f,_0x3a7c8e){_0x3a7c8e=_0x3a7c8e||0xcc;return function(_0x902325){if(_0x902325){return _0x53277f[_0x7fc1('0x1b')](_0x3a7c8e);}return _0x53277f[_0x7fc1('0x1c')](_0x3a7c8e)[_0x7fc1('0x1d')]();};}function respondWithResult(_0x5651f2,_0x54a204){_0x54a204=_0x54a204||0xc8;return function(_0x881462){if(_0x881462){return _0x5651f2[_0x7fc1('0x1c')](_0x54a204)[_0x7fc1('0x1e')](_0x881462);}};}function respondWithFilteredResult(_0x391de7,_0x432825){return function(_0x3c4671){if(_0x3c4671){var _0x3d8e82=typeof _0x432825[_0x7fc1('0x1f')]===_0x7fc1('0x20')&&typeof _0x432825[_0x7fc1('0x21')]==='undefined';var _0x419170=_0x3c4671['count'];var _0x30fc04=_0x3d8e82?0x0:_0x432825[_0x7fc1('0x1f')];var _0x535ae1=_0x3d8e82?_0x3c4671[_0x7fc1('0x22')]:_0x432825[_0x7fc1('0x1f')]+_0x432825['limit'];var _0x25d384;if(_0x535ae1>=_0x419170){_0x535ae1=_0x419170;_0x25d384=0xc8;}else{_0x25d384=0xce;}_0x391de7[_0x7fc1('0x1c')](_0x25d384);return _0x391de7[_0x7fc1('0x23')](_0x7fc1('0x24'),_0x30fc04+'-'+_0x535ae1+'/'+_0x419170)[_0x7fc1('0x1e')](_0x3c4671);}return null;};}function patchUpdates(_0x1c249d){return function(_0x3e7c92){try{jsonpatch[_0x7fc1('0x25')](_0x3e7c92,_0x1c249d,!![]);}catch(_0x327569){return BPromise[_0x7fc1('0x26')](_0x327569);}return _0x3e7c92['save']();};}function saveUpdates(_0x49a44f,_0x2390b8){return function(_0x5e10cd){if(_0x5e10cd){return _0x5e10cd[_0x7fc1('0x27')](_0x49a44f)[_0x7fc1('0x28')](function(_0x253ae9){return _0x253ae9;});}return null;};}function removeEntity(_0x3683f4,_0x56c5d6){return function(_0x38b5b5){if(_0x38b5b5){return _0x38b5b5[_0x7fc1('0x29')]()[_0x7fc1('0x28')](function(){_0x3683f4['status'](0xcc)[_0x7fc1('0x1d')]();});}};}function handleEntityNotFound(_0x252b18,_0x5ddc11){return function(_0x4b24d6){if(!_0x4b24d6){_0x252b18[_0x7fc1('0x1b')](0x194);}return _0x4b24d6;};}function handleError(_0x293a2a,_0x1f58ca){_0x1f58ca=_0x1f58ca||0x1f4;return function(_0x2ae7db){logger['error'](_0x2ae7db[_0x7fc1('0x2a')]);if(_0x2ae7db[_0x7fc1('0x2b')]){delete _0x2ae7db[_0x7fc1('0x2b')];}_0x293a2a[_0x7fc1('0x1c')](_0x1f58ca)['send'](_0x2ae7db);};}exports[_0x7fc1('0x2c')]=function(_0x583e60,_0x1f7fce){var _0x22a3c1={},_0x34ec70={},_0x231913={'count':0x0,'rows':[]};var _0x2317f5=_['map'](db[_0x7fc1('0x2d')]['rawAttributes'],function(_0x55b4f1){return{'name':_0x55b4f1[_0x7fc1('0x2e')],'type':_0x55b4f1[_0x7fc1('0x2f')][_0x7fc1('0x30')]};});_0x34ec70[_0x7fc1('0x31')]=_[_0x7fc1('0x32')](_0x2317f5,_0x7fc1('0x2b'));_0x34ec70[_0x7fc1('0x33')]=_[_0x7fc1('0x34')](_0x583e60[_0x7fc1('0x33')]);_0x34ec70[_0x7fc1('0x35')]=_[_0x7fc1('0x36')](_0x34ec70[_0x7fc1('0x31')],_0x34ec70[_0x7fc1('0x33')]);_0x22a3c1[_0x7fc1('0x37')]=_[_0x7fc1('0x36')](_0x34ec70[_0x7fc1('0x31')],qs['fields'](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x38')]));_0x22a3c1[_0x7fc1('0x37')]=_0x22a3c1[_0x7fc1('0x37')][_0x7fc1('0x39')]?_0x22a3c1[_0x7fc1('0x37')]:_0x34ec70['model'];if(!_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x3a')]('nolimit')){_0x22a3c1[_0x7fc1('0x21')]=qs[_0x7fc1('0x21')](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x21')]);_0x22a3c1[_0x7fc1('0x1f')]=qs['offset'](_0x583e60['query'][_0x7fc1('0x1f')]);}_0x22a3c1[_0x7fc1('0x3b')]=qs[_0x7fc1('0x3c')](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x3c')]);_0x22a3c1[_0x7fc1('0x3d')]=qs[_0x7fc1('0x35')](_[_0x7fc1('0x3e')](_0x583e60['query'],_0x34ec70[_0x7fc1('0x35')]),_0x2317f5);if(_0x583e60[_0x7fc1('0x33')]['filter']){_0x22a3c1[_0x7fc1('0x3d')]=_[_0x7fc1('0x3f')](_0x22a3c1[_0x7fc1('0x3d')],{'$or':_['map'](_0x2317f5,function(_0x57ef4c){if(_0x57ef4c[_0x7fc1('0x2f')]!==_0x7fc1('0x40')){var _0xafc8b0={};_0xafc8b0[_0x57ef4c['name']]={'$like':'%'+_0x583e60['query']['filter']+'%'};return _0xafc8b0;}})});}_0x22a3c1=_[_0x7fc1('0x3f')]({},_0x22a3c1,_0x583e60[_0x7fc1('0x41')]);var _0x32607c={'where':_0x22a3c1[_0x7fc1('0x3d')]};return db['JscriptyAnswerReport']['count'](_0x32607c)[_0x7fc1('0x28')](function(_0xf26d98){_0x231913[_0x7fc1('0x22')]=_0xf26d98;if(_0x583e60['query']['includeAll']){_0x22a3c1['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x22a3c1);})[_0x7fc1('0x28')](function(_0x54749f){_0x231913[_0x7fc1('0x42')]=_0x54749f;return _0x231913;})[_0x7fc1('0x28')](respondWithFilteredResult(_0x1f7fce,_0x22a3c1))['catch'](handleError(_0x1f7fce,null));};exports[_0x7fc1('0x43')]=function(_0x16ad03,_0x111d51){var _0x3282dd={'raw':!![],'where':{'id':_0x16ad03[_0x7fc1('0x44')]['id']}},_0x56b853={};_0x56b853['model']=_[_0x7fc1('0x34')](db[_0x7fc1('0x2d')][_0x7fc1('0x45')]);_0x56b853[_0x7fc1('0x33')]=_['keys'](_0x16ad03[_0x7fc1('0x33')]);_0x56b853[_0x7fc1('0x35')]=_['intersection'](_0x56b853[_0x7fc1('0x31')],_0x56b853[_0x7fc1('0x33')]);_0x3282dd['attributes']=_[_0x7fc1('0x36')](_0x56b853[_0x7fc1('0x31')],qs['fields'](_0x16ad03[_0x7fc1('0x33')][_0x7fc1('0x38')]));_0x3282dd[_0x7fc1('0x37')]=_0x3282dd['attributes'][_0x7fc1('0x39')]?_0x3282dd[_0x7fc1('0x37')]:_0x56b853[_0x7fc1('0x31')];if(_0x16ad03[_0x7fc1('0x33')]['includeAll']){_0x3282dd['include']=[{'all':!![]}];}_0x3282dd=_[_0x7fc1('0x3f')]({},_0x3282dd,_0x16ad03[_0x7fc1('0x41')]);return db[_0x7fc1('0x2d')][_0x7fc1('0x46')](_0x3282dd)[_0x7fc1('0x28')](handleEntityNotFound(_0x111d51,null))[_0x7fc1('0x28')](respondWithResult(_0x111d51,null))[_0x7fc1('0x47')](handleError(_0x111d51,null));};exports[_0x7fc1('0x48')]=function(_0x419ea1,_0x4c4606){return db['JscriptyAnswerReport']['create'](_0x419ea1[_0x7fc1('0x49')],{})[_0x7fc1('0x28')](respondWithResult(_0x4c4606,0xc9))[_0x7fc1('0x47')](handleError(_0x4c4606,null));};exports[_0x7fc1('0x27')]=function(_0x4bcd63,_0xafd821){if(_0x4bcd63[_0x7fc1('0x49')]['id']){delete _0x4bcd63[_0x7fc1('0x49')]['id'];}return db[_0x7fc1('0x2d')]['find']({'where':{'id':_0x4bcd63[_0x7fc1('0x44')]['id']}})[_0x7fc1('0x28')](handleEntityNotFound(_0xafd821,null))[_0x7fc1('0x28')](saveUpdates(_0x4bcd63[_0x7fc1('0x49')],null))[_0x7fc1('0x28')](respondWithResult(_0xafd821,null))[_0x7fc1('0x47')](handleError(_0xafd821,null));};exports[_0x7fc1('0x29')]=function(_0x4d27db,_0x3d5f40){return db['JscriptyAnswerReport'][_0x7fc1('0x46')]({'where':{'id':_0x4d27db['params']['id']}})[_0x7fc1('0x28')](handleEntityNotFound(_0x3d5f40,null))[_0x7fc1('0x28')](removeEntity(_0x3d5f40,null))['catch'](handleError(_0x3d5f40,null));};exports[_0x7fc1('0x4a')]=function(_0x3b492a,_0x509959){return db[_0x7fc1('0x2d')][_0x7fc1('0x4a')]()[_0x7fc1('0x28')](respondWithResult(_0x509959,null))[_0x7fc1('0x47')](handleError(_0x509959,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index b0f0326..aef4f9e 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 _0xc582=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xc582,0x12e));var _0x2c58=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xc582[_0x497b1e];return _0x3f72e1;};'use strict';var _=require(_0x2c58('0x0'));var util=require(_0x2c58('0x1'));var logger=require(_0x2c58('0x2'))(_0x2c58('0x3'));var moment=require(_0x2c58('0x4'));var BPromise=require('bluebird');var rp=require(_0x2c58('0x5'));var fs=require('fs');var path=require(_0x2c58('0x6'));var rimraf=require(_0x2c58('0x7'));var config=require(_0x2c58('0x8'));var attributes=require(_0x2c58('0x9'));module[_0x2c58('0xa')]=function(_0x4258ca,_0x42219f){return _0x4258ca[_0x2c58('0xb')](_0x2c58('0xc'),attributes,{'tableName':_0x2c58('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1768=['path','rimraf','../../config/environment','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x4f9617,_0x16a10a){var _0x55b7d0=function(_0x43824a){while(--_0x43824a){_0x4f9617['push'](_0x4f9617['shift']());}};_0x55b7d0(++_0x16a10a);}(_0x1768,0xf8));var _0x8176=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x1768[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x8176('0x0'));var util=require(_0x8176('0x1'));var logger=require(_0x8176('0x2'))(_0x8176('0x3'));var moment=require(_0x8176('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8176('0x5'));var rimraf=require(_0x8176('0x6'));var config=require(_0x8176('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x8176('0x8')]=function(_0x3ca651,_0xedf805){return _0x3ca651['define'](_0x8176('0x9'),attributes,{'tableName':_0x8176('0xa'),'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 5b67cf5..79248e4 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 _0x2934=['http','request','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3774b7,_0x4652cc){var _0x46de6e=function(_0x24f406){while(--_0x24f406){_0x3774b7['push'](_0x3774b7['shift']());}};_0x46de6e(++_0x4652cc);}(_0x2934,0xba));var _0x4293=function(_0x4a81ab,_0x10ea30){_0x4a81ab=_0x4a81ab-0x0;var _0x52f046=_0x2934[_0x4a81ab];return _0x52f046;};'use strict';var _=require(_0x4293('0x0'));var util=require(_0x4293('0x1'));var moment=require(_0x4293('0x2'));var BPromise=require(_0x4293('0x3'));var rs=require(_0x4293('0x4'));var fs=require('fs');var Redis=require(_0x4293('0x5'));var db=require(_0x4293('0x6'))['db'];var utils=require(_0x4293('0x7'));var logger=require(_0x4293('0x8'))(_0x4293('0x9'));var config=require(_0x4293('0xa'));var jayson=require(_0x4293('0xb'));var client=jayson['client'][_0x4293('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x360791,_0x32ff52,_0xbbf42c){return new BPromise(function(_0x408fb1,_0x3b8b45){return client[_0x4293('0xd')](_0x360791,_0xbbf42c)['then'](function(_0x4e1dec){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x32ff52,_0x4293('0xe'));logger[_0x4293('0xf')](_0x4293('0x10'),_0x32ff52,_0x4293('0xe'),JSON[_0x4293('0x11')](_0x4e1dec));if(_0x4e1dec[_0x4293('0x12')]){if(_0x4e1dec[_0x4293('0x12')]['code']===0x1f4){logger['error'](_0x4293('0x13'),_0x32ff52,_0x4e1dec[_0x4293('0x12')]['message']);return _0x3b8b45(_0x4e1dec[_0x4293('0x12')][_0x4293('0x14')]);}logger[_0x4293('0x12')](_0x4293('0x13'),_0x32ff52,_0x4e1dec[_0x4293('0x12')][_0x4293('0x14')]);return _0x408fb1(_0x4e1dec[_0x4293('0x12')]['message']);}else{logger['info'](_0x4293('0x13'),_0x32ff52,'request\x20sent');_0x408fb1(_0x4e1dec['result']['message']);}})[_0x4293('0x15')](function(_0x50cd53){logger['error'](_0x4293('0x13'),_0x32ff52,_0x50cd53);_0x3b8b45(_0x50cd53);});});} \ No newline at end of file +var _0xdb6d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x7d5b1b,_0x20e692){var _0x51988c=function(_0x4b8e77){while(--_0x4b8e77){_0x7d5b1b['push'](_0x7d5b1b['shift']());}};_0x51988c(++_0x20e692);}(_0xdb6d,0xe6));var _0xddb6=function(_0x352f6b,_0x368cf0){_0x352f6b=_0x352f6b-0x0;var _0x10df19=_0xdb6d[_0x352f6b];return _0x10df19;};'use strict';var _=require(_0xddb6('0x0'));var util=require(_0xddb6('0x1'));var moment=require(_0xddb6('0x2'));var BPromise=require(_0xddb6('0x3'));var rs=require(_0xddb6('0x4'));var fs=require('fs');var Redis=require(_0xddb6('0x5'));var db=require(_0xddb6('0x6'))['db'];var utils=require(_0xddb6('0x7'));var logger=require(_0xddb6('0x8'))(_0xddb6('0x9'));var config=require(_0xddb6('0xa'));var jayson=require(_0xddb6('0xb'));var client=jayson[_0xddb6('0xc')][_0xddb6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xa3bed3,_0x22925f,_0x385b5d){return new BPromise(function(_0xb40652,_0x387bbc){return client[_0xddb6('0xe')](_0xa3bed3,_0x385b5d)[_0xddb6('0xf')](function(_0x244585){logger['info'](_0xddb6('0x10'),_0x22925f,'request\x20sent');logger[_0xddb6('0x11')](_0xddb6('0x12'),_0x22925f,_0xddb6('0x13'),JSON[_0xddb6('0x14')](_0x244585));if(_0x244585[_0xddb6('0x15')]){if(_0x244585[_0xddb6('0x15')]['code']===0x1f4){logger[_0xddb6('0x15')](_0xddb6('0x10'),_0x22925f,_0x244585[_0xddb6('0x15')][_0xddb6('0x16')]);return _0x387bbc(_0x244585['error'][_0xddb6('0x16')]);}logger[_0xddb6('0x15')](_0xddb6('0x10'),_0x22925f,_0x244585['error'][_0xddb6('0x16')]);return _0xb40652(_0x244585[_0xddb6('0x15')][_0xddb6('0x16')]);}else{logger[_0xddb6('0x17')](_0xddb6('0x10'),_0x22925f,_0xddb6('0x13'));_0xb40652(_0x244585[_0xddb6('0x18')][_0xddb6('0x16')]);}})[_0xddb6('0x19')](function(_0x440658){logger[_0xddb6('0x15')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x22925f,_0x440658);_0x387bbc(_0x440658);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index a7aa80c..c898a63 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 _0x1eac=['isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','clone','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x51b244,_0x2cd01b){var _0xc5f056=function(_0x5da870){while(--_0x5da870){_0x51b244['push'](_0x51b244['shift']());}};_0xc5f056(++_0x2cd01b);}(_0x1eac,0x1b0));var _0xc1ea=function(_0x4878b0,_0x10c851){_0x4878b0=_0x4878b0-0x0;var _0x486895=_0x1eac[_0x4878b0];return _0x486895;};'use strict';var multer=require(_0xc1ea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc1ea('0x1'));var express=require(_0xc1ea('0x2'));var router=express[_0xc1ea('0x3')]();var fs_extra=require(_0xc1ea('0x4'));var auth=require(_0xc1ea('0x5'));var interaction=require(_0xc1ea('0x6'));var config=require(_0xc1ea('0x7'));var controller=require(_0xc1ea('0x8'));router[_0xc1ea('0x9')]('/',auth[_0xc1ea('0xa')](),controller[_0xc1ea('0xb')]);router['get'](_0xc1ea('0xc'),auth[_0xc1ea('0xa')](),controller[_0xc1ea('0xd')]);router['get']('/:id/sessions',auth[_0xc1ea('0xa')](),controller[_0xc1ea('0xe')]);router['get'](_0xc1ea('0xf'),auth[_0xc1ea('0xa')](),controller[_0xc1ea('0x10')]);router[_0xc1ea('0x9')](_0xc1ea('0x11'),auth[_0xc1ea('0xa')](),timeout('30s'),controller[_0xc1ea('0x12')]);router[_0xc1ea('0x13')]('/',auth[_0xc1ea('0xa')](),controller[_0xc1ea('0x14')]);router[_0xc1ea('0x13')](_0xc1ea('0x15'),auth[_0xc1ea('0xa')](),controller[_0xc1ea('0x16')]);router[_0xc1ea('0x17')](_0xc1ea('0xc'),auth[_0xc1ea('0xa')](),controller[_0xc1ea('0x18')]);router['delete']('/:id',auth[_0xc1ea('0xa')](),controller['destroy']);module[_0xc1ea('0x19')]=router; \ No newline at end of file +var _0x786e=['getSummary','post','create','/:id/clone','clone','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x786e,0x1d4));var _0xe786=function(_0x38e870,_0x3d2e6a){_0x38e870=_0x38e870-0x0;var _0x2dabbe=_0x786e[_0x38e870];return _0x2dabbe;};'use strict';var multer=require(_0xe786('0x0'));var util=require(_0xe786('0x1'));var path=require('path');var timeout=require(_0xe786('0x2'));var express=require(_0xe786('0x3'));var router=express[_0xe786('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe786('0x5'));var interaction=require(_0xe786('0x6'));var config=require(_0xe786('0x7'));var controller=require(_0xe786('0x8'));router['get']('/',auth[_0xe786('0x9')](),controller[_0xe786('0xa')]);router[_0xe786('0xb')](_0xe786('0xc'),auth[_0xe786('0x9')](),controller[_0xe786('0xd')]);router[_0xe786('0xb')]('/:id/sessions',auth[_0xe786('0x9')](),controller[_0xe786('0xe')]);router[_0xe786('0xb')](_0xe786('0xf'),auth['isAuthenticated'](),controller[_0xe786('0x10')]);router['get'](_0xe786('0x11'),auth[_0xe786('0x9')](),timeout('30s'),controller[_0xe786('0x12')]);router[_0xe786('0x13')]('/',auth['isAuthenticated'](),controller[_0xe786('0x14')]);router['post'](_0xe786('0x15'),auth[_0xe786('0x9')](),controller[_0xe786('0x16')]);router[_0xe786('0x17')]('/:id',auth[_0xe786('0x9')](),controller['update']);router[_0xe786('0x18')](_0xe786('0xc'),auth['isAuthenticated'](),controller[_0xe786('0x19')]);module[_0xe786('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ee391ce..a8eb509 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 _0xf18f=['isObjectLike','setDataValue','formData','stringify','format','description','BOOLEAN','lodash','util','STRING','TEXT','long'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf18f,0x19f));var _0xff18=function(_0x5ed248,_0x236fc6){_0x5ed248=_0x5ed248-0x0;var _0x3085e2=_0xf18f[_0x5ed248];return _0x3085e2;};'use strict';var Sequelize=require('sequelize');var _=require(_0xff18('0x0'));var util=require(_0xff18('0x1'));module['exports']={'name':{'type':Sequelize[_0xff18('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xff18('0x2')]},'formData':{'type':Sequelize[_0xff18('0x3')](_0xff18('0x4')),'set':function(_0x30db47){if(_[_0xff18('0x5')](_0x30db47)){this[_0xff18('0x6')](_0xff18('0x7'),JSON[_0xff18('0x8')](_0x30db47));}else if(_['isString'](_0x30db47)){this['setDataValue'](_0xff18('0x7'),_0x30db47);}else{this[_0xff18('0x6')](_0xff18('0x7'),util[_0xff18('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue']('name')||'',this['getDataValue'](_0xff18('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xff18('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xcf46=['lodash','util','exports','STRING','TEXT','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcf46,0xaf));var _0x6cf4=function(_0x34db39,_0x10c78c){_0x34db39=_0x34db39-0x0;var _0x140567=_0xcf46[_0x34db39];return _0x140567;};'use strict';var Sequelize=require(_0x6cf4('0x0'));var _=require(_0x6cf4('0x1'));var util=require(_0x6cf4('0x2'));module[_0x6cf4('0x3')]={'name':{'type':Sequelize[_0x6cf4('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x6cf4('0x4')]},'formData':{'type':Sequelize[_0x6cf4('0x5')]('long'),'set':function(_0x353dad){if(_[_0x6cf4('0x6')](_0x353dad)){this[_0x6cf4('0x7')]('formData',JSON[_0x6cf4('0x8')](_0x353dad));}else if(_[_0x6cf4('0x9')](_0x353dad)){this[_0x6cf4('0x7')](_0x6cf4('0xa'),_0x353dad);}else{this[_0x6cf4('0x7')](_0x6cf4('0xa'),util[_0x6cf4('0xb')](_0x6cf4('0xc'),this[_0x6cf4('0xd')](_0x6cf4('0xe'))||'',this[_0x6cf4('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6cf4('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6cf4('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 1e2c289..dac1be9 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 _0xd844=['request-promise','mustache','util','path','sox','ejs','squel','desk.js','to-csv','papaparse','../../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','count','limit','Content-Range','apply','save','then','destroy','get','UserProfileResource','end','error','name','index','map','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','JscriptyProject','includeAll','include','findAll','rows','show','intersection','length','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','find','omit','createdAt','updatedAt','Projects','UserProfileSection','update','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','startTime','starttime','parse','JscriptyQuestionReport','hasOwnProperty','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','eml-format','rimraf','fast-json-patch'];(function(_0x595324,_0x5c25fc){var _0x506510=function(_0x52bc6f){while(--_0x52bc6f){_0x595324['push'](_0x595324['shift']());}};_0x506510(++_0x5c25fc);}(_0xd844,0x6d));var _0x4d84=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd844[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x4d84('0x0'));var rimraf=require(_0x4d84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d84('0x2'));var rp=require(_0x4d84('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4d84('0x4'));var util=require(_0x4d84('0x5'));var path=require(_0x4d84('0x6'));var sox=require(_0x4d84('0x7'));var csv=require('to-csv');var ejs=require(_0x4d84('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d84('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d84('0xa'));var toCsv=require(_0x4d84('0xb'));var querystring=require('querystring');var Papa=require(_0x4d84('0xc'));var Redis=require('ioredis');var authService=require(_0x4d84('0xd'));var qs=require(_0x4d84('0xe'));var as=require(_0x4d84('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d84('0x10'))(_0x4d84('0x11'));var utils=require(_0x4d84('0x12'));var config=require(_0x4d84('0x13'));var licenseUtil=require(_0x4d84('0x14'));var db=require(_0x4d84('0x15'))['db'];function respondWithStatusCode(_0x406715,_0x3d744a){_0x3d744a=_0x3d744a||0xcc;return function(_0x12dad2){if(_0x12dad2){return _0x406715[_0x4d84('0x16')](_0x3d744a);}return _0x406715[_0x4d84('0x17')](_0x3d744a)['end']();};}function respondWithResult(_0x2634fa,_0x50f820){_0x50f820=_0x50f820||0xc8;return function(_0x34765d){if(_0x34765d){return _0x2634fa[_0x4d84('0x17')](_0x50f820)[_0x4d84('0x18')](_0x34765d);}};}function respondWithFilteredResult(_0x286f9f,_0x5d499c){return function(_0x1df099){if(_0x1df099){var _0x4ee2fe=typeof _0x5d499c[_0x4d84('0x19')]===_0x4d84('0x1a')&&typeof _0x5d499c['limit']==='undefined';var _0x47076e=_0x1df099['count'];var _0x4128d1=_0x4ee2fe?0x0:_0x5d499c[_0x4d84('0x19')];var _0x12349a=_0x4ee2fe?_0x1df099[_0x4d84('0x1b')]:_0x5d499c['offset']+_0x5d499c[_0x4d84('0x1c')];var _0x304346;if(_0x12349a>=_0x47076e){_0x12349a=_0x47076e;_0x304346=0xc8;}else{_0x304346=0xce;}_0x286f9f[_0x4d84('0x17')](_0x304346);return _0x286f9f['set'](_0x4d84('0x1d'),_0x4128d1+'-'+_0x12349a+'/'+_0x47076e)[_0x4d84('0x18')](_0x1df099);}return null;};}function patchUpdates(_0x53639b){return function(_0x27fdf2){try{jsonpatch[_0x4d84('0x1e')](_0x27fdf2,_0x53639b,!![]);}catch(_0x3de4df){return BPromise['reject'](_0x3de4df);}return _0x27fdf2[_0x4d84('0x1f')]();};}function saveUpdates(_0x1b2507,_0x29928e){return function(_0x2fc7dd){if(_0x2fc7dd){return _0x2fc7dd['update'](_0x1b2507)[_0x4d84('0x20')](function(_0x4cdba6){return _0x4cdba6;});}return null;};}function removeEntity(_0x229c8d,_0x5ebe25){return function(_0x48794f){if(_0x48794f){return _0x48794f[_0x4d84('0x21')]()[_0x4d84('0x20')](function(){var _0x5d95e=_0x48794f[_0x4d84('0x22')]({'plain':!![]});var _0xbd7401='Projects';return db[_0x4d84('0x23')]['destroy']({'where':{'type':_0xbd7401,'resourceId':_0x5d95e['id']}})[_0x4d84('0x20')](function(){return _0x48794f;});})[_0x4d84('0x20')](function(){_0x229c8d['status'](0xcc)[_0x4d84('0x24')]();});}};}function handleEntityNotFound(_0x2a73dc,_0x31fdc9){return function(_0x19cdcf){if(!_0x19cdcf){_0x2a73dc[_0x4d84('0x16')](0x194);}return _0x19cdcf;};}function handleError(_0x5e794c,_0x36092e){_0x36092e=_0x36092e||0x1f4;return function(_0x2014a6){logger[_0x4d84('0x25')](_0x2014a6['stack']);if(_0x2014a6['name']){delete _0x2014a6[_0x4d84('0x26')];}_0x5e794c[_0x4d84('0x17')](_0x36092e)['send'](_0x2014a6);};}exports[_0x4d84('0x27')]=function(_0x5b447b,_0x492e61){var _0x37f532={},_0x5c3dc9={},_0x1d7866={'count':0x0,'rows':[]};var _0xefc64a=_[_0x4d84('0x28')](db['JscriptyProject'][_0x4d84('0x29')],function(_0x13688f){return{'name':_0x13688f[_0x4d84('0x2a')],'type':_0x13688f[_0x4d84('0x2b')][_0x4d84('0x2c')]};});_0x5c3dc9['model']=_[_0x4d84('0x28')](_0xefc64a,_0x4d84('0x26'));_0x5c3dc9[_0x4d84('0x2d')]=_[_0x4d84('0x2e')](_0x5b447b[_0x4d84('0x2d')]);_0x5c3dc9['filters']=_['intersection'](_0x5c3dc9['model'],_0x5c3dc9['query']);_0x37f532['attributes']=_['intersection'](_0x5c3dc9[_0x4d84('0x2f')],qs['fields'](_0x5b447b[_0x4d84('0x2d')][_0x4d84('0x30')]));_0x37f532['attributes']=_0x37f532[_0x4d84('0x31')]['length']?_0x37f532['attributes']:_0x5c3dc9[_0x4d84('0x2f')];if(!_0x5b447b[_0x4d84('0x2d')]['hasOwnProperty'](_0x4d84('0x32'))){_0x37f532[_0x4d84('0x1c')]=qs[_0x4d84('0x1c')](_0x5b447b[_0x4d84('0x2d')][_0x4d84('0x1c')]);_0x37f532[_0x4d84('0x19')]=qs[_0x4d84('0x19')](_0x5b447b['query'][_0x4d84('0x19')]);}_0x37f532[_0x4d84('0x33')]=qs[_0x4d84('0x34')](_0x5b447b['query'][_0x4d84('0x34')]);_0x37f532[_0x4d84('0x35')]=qs['filters'](_[_0x4d84('0x36')](_0x5b447b['query'],_0x5c3dc9[_0x4d84('0x37')]),_0xefc64a);if(_0x5b447b['query'][_0x4d84('0x38')]){_0x37f532[_0x4d84('0x35')]=_[_0x4d84('0x39')](_0x37f532[_0x4d84('0x35')],{'$or':_[_0x4d84('0x28')](_0xefc64a,function(_0x212993){if(_0x212993['type']!==_0x4d84('0x3a')){var _0x86fa1a={};_0x86fa1a[_0x212993[_0x4d84('0x26')]]={'$like':'%'+_0x5b447b['query'][_0x4d84('0x38')]+'%'};return _0x86fa1a;}})});}_0x37f532=_[_0x4d84('0x39')]({},_0x37f532,_0x5b447b['options']);var _0x30b0c7={'where':_0x37f532[_0x4d84('0x35')]};return db[_0x4d84('0x3b')][_0x4d84('0x1b')](_0x30b0c7)[_0x4d84('0x20')](function(_0x710612){_0x1d7866['count']=_0x710612;if(_0x5b447b[_0x4d84('0x2d')][_0x4d84('0x3c')]){_0x37f532[_0x4d84('0x3d')]=[{'all':!![]}];}return db[_0x4d84('0x3b')][_0x4d84('0x3e')](_0x37f532);})['then'](function(_0xbf42c1){_0x1d7866[_0x4d84('0x3f')]=_0xbf42c1;return _0x1d7866;})[_0x4d84('0x20')](respondWithFilteredResult(_0x492e61,_0x37f532))['catch'](handleError(_0x492e61,null));};exports[_0x4d84('0x40')]=function(_0x15132b,_0x216179){var _0x4c3f01={'raw':![],'where':{'id':_0x15132b['params']['id']}},_0x1f0e8d={};_0x1f0e8d[_0x4d84('0x2f')]=_[_0x4d84('0x2e')](db[_0x4d84('0x3b')]['rawAttributes']);_0x1f0e8d['query']=_[_0x4d84('0x2e')](_0x15132b[_0x4d84('0x2d')]);_0x1f0e8d[_0x4d84('0x37')]=_[_0x4d84('0x41')](_0x1f0e8d[_0x4d84('0x2f')],_0x1f0e8d['query']);_0x4c3f01[_0x4d84('0x31')]=_[_0x4d84('0x41')](_0x1f0e8d[_0x4d84('0x2f')],qs[_0x4d84('0x30')](_0x15132b[_0x4d84('0x2d')][_0x4d84('0x30')]));_0x4c3f01[_0x4d84('0x31')]=_0x4c3f01[_0x4d84('0x31')][_0x4d84('0x42')]?_0x4c3f01[_0x4d84('0x31')]:_0x1f0e8d[_0x4d84('0x2f')];if(_0x15132b[_0x4d84('0x2d')]['includeAll']){_0x4c3f01[_0x4d84('0x3d')]=[{'all':!![]}];}_0x4c3f01=_[_0x4d84('0x39')]({},_0x4c3f01,_0x15132b[_0x4d84('0x43')]);return db[_0x4d84('0x3b')]['find'](_0x4c3f01)[_0x4d84('0x20')](handleEntityNotFound(_0x216179,null))['then'](respondWithResult(_0x216179,null))[_0x4d84('0x44')](handleError(_0x216179,null));};exports[_0x4d84('0x45')]=function(_0x3e0989,_0x58e2d5){return db[_0x4d84('0x3b')][_0x4d84('0x45')](_0x3e0989[_0x4d84('0x46')],{})[_0x4d84('0x20')](function(_0x26c8ce){var _0x1a1906=_0x3e0989[_0x4d84('0x47')][_0x4d84('0x22')]({'plain':!![]});if(!_0x1a1906)throw new Error(_0x4d84('0x48'));if(_0x1a1906[_0x4d84('0x49')]===_0x4d84('0x47')){var _0x314116=_0x26c8ce[_0x4d84('0x22')]({'plain':!![]});var _0x3c8997='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x3c8997,'userProfileId':_0x1a1906[_0x4d84('0x4a')]},'raw':!![]})[_0x4d84('0x20')](function(_0xf4954b){if(_0xf4954b&&_0xf4954b['autoAssociation']===0x0){return db[_0x4d84('0x23')][_0x4d84('0x45')]({'name':_0x314116[_0x4d84('0x26')],'resourceId':_0x314116['id'],'type':_0xf4954b[_0x4d84('0x26')],'sectionId':_0xf4954b['id']},{})[_0x4d84('0x20')](function(){return _0x26c8ce;});}else{return _0x26c8ce;}})[_0x4d84('0x44')](function(_0x22dc20){logger[_0x4d84('0x25')](_0x4d84('0x4b'),_0x22dc20);throw _0x22dc20;});}return _0x26c8ce;})[_0x4d84('0x20')](respondWithResult(_0x58e2d5,0xc9))['catch'](handleError(_0x58e2d5,null));};exports[_0x4d84('0x4c')]=function(_0x4963b5,_0x344b6c){var _0x452176={'where':{'id':_0x4963b5[_0x4d84('0x4d')]['id']}},_0x45381a={};_0x45381a[_0x4d84('0x2f')]=_[_0x4d84('0x2e')](db[_0x4d84('0x3b')]['rawAttributes']);_0x452176[_0x4d84('0x31')]=_[_0x4d84('0x41')](_0x45381a['model'],qs[_0x4d84('0x30')](_0x4963b5[_0x4d84('0x2d')][_0x4d84('0x30')]));_0x452176['attributes']=_0x452176[_0x4d84('0x31')][_0x4d84('0x42')]?_0x452176['attributes']:_0x45381a[_0x4d84('0x2f')];if(_0x4963b5['query'][_0x4d84('0x3c')]){_0x452176[_0x4d84('0x3d')]=[{'all':!![]}];}_0x452176=_['merge']({},_0x452176,_0x4963b5[_0x4d84('0x43')]);return db[_0x4d84('0x3b')][_0x4d84('0x4e')](_0x452176)[_0x4d84('0x20')](handleEntityNotFound(_0x344b6c,null))[_0x4d84('0x20')](function(_0xf28e1b){if(_0xf28e1b){var _0x517f36=_0xf28e1b[_0x4d84('0x22')]({'plain':!![]});_0x517f36=qs[_0x4d84('0x4f')](_0x517f36,['id',_0x4d84('0x50'),'updatedAt']);_0x4963b5['body']=_[_0x4d84('0x4f')](_0x4963b5[_0x4d84('0x46')],['id',_0x4d84('0x50'),_0x4d84('0x51')]);return db[_0x4d84('0x3b')][_0x4d84('0x45')](_[_0x4d84('0x39')](_0x517f36,_0x4963b5[_0x4d84('0x46')]),{'include':_0x4963b5[_0x4d84('0x2d')][_0x4d84('0x3c')]?[{'all':!![]}]:undefined})['then'](function(_0x3bc23c){var _0x558ee=_0x4963b5['user'][_0x4d84('0x22')]({'plain':!![]});if(!_0x558ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x558ee[_0x4d84('0x49')]==='user'){var _0x2c0091=_0x3bc23c[_0x4d84('0x22')]({'plain':!![]});var _0x373c50=_0x4d84('0x52');return db[_0x4d84('0x53')][_0x4d84('0x4e')]({'where':{'name':_0x373c50,'userProfileId':_0x558ee[_0x4d84('0x4a')]},'raw':!![]})[_0x4d84('0x20')](function(_0x393e6f){if(_0x393e6f&&_0x393e6f['autoAssociation']===0x0){return db[_0x4d84('0x23')]['create']({'name':_0x2c0091['name'],'resourceId':_0x2c0091['id'],'type':_0x393e6f[_0x4d84('0x26')],'sectionId':_0x393e6f['id']},{})[_0x4d84('0x20')](function(){return _0x3bc23c;});}else{return _0x3bc23c;}})[_0x4d84('0x44')](function(_0x317f63){logger['error'](_0x4d84('0x4b'),_0x317f63);throw _0x317f63;});}return _0x3bc23c;});}})['then'](respondWithResult(_0x344b6c,0xc9))[_0x4d84('0x44')](handleError(_0x344b6c,null));};exports[_0x4d84('0x54')]=function(_0x5ac685,_0x11b628){if(_0x5ac685[_0x4d84('0x46')]['id']){delete _0x5ac685['body']['id'];}return db['JscriptyProject'][_0x4d84('0x4e')]({'where':{'id':_0x5ac685[_0x4d84('0x4d')]['id']}})[_0x4d84('0x20')](handleEntityNotFound(_0x11b628,null))[_0x4d84('0x20')](saveUpdates(_0x5ac685[_0x4d84('0x46')],null))[_0x4d84('0x20')](respondWithResult(_0x11b628,null))[_0x4d84('0x44')](handleError(_0x11b628,null));};exports['destroy']=function(_0x5aa4ea,_0x363661){return db[_0x4d84('0x3b')][_0x4d84('0x4e')]({'where':{'id':_0x5aa4ea['params']['id']}})[_0x4d84('0x20')](handleEntityNotFound(_0x363661,null))['then'](removeEntity(_0x363661,null))['catch'](handleError(_0x363661,null));};exports['getSessions']=function(_0x1209d3,_0x266369,_0x31bdba){var _0x173f12={'raw':!![],'where':{}};var _0x3fd8e1={};var _0x57028d={'count':0x0,'rows':[]};return db[_0x4d84('0x3b')][_0x4d84('0x55')]({'where':{'id':_0x1209d3[_0x4d84('0x4d')]['id']}})[_0x4d84('0x20')](handleEntityNotFound(_0x266369,null))[_0x4d84('0x20')](function(_0x1235c5){if(_0x1235c5){_0x3fd8e1[_0x4d84('0x2f')]=_[_0x4d84('0x2e')](db[_0x4d84('0x56')]['rawAttributes']);_0x3fd8e1['query']=_['keys'](_0x1209d3[_0x4d84('0x2d')]);_0x3fd8e1['filters']=_[_0x4d84('0x41')](_0x3fd8e1['model'],_0x3fd8e1['query']);_0x173f12[_0x4d84('0x31')]=_[_0x4d84('0x41')](_0x3fd8e1[_0x4d84('0x2f')],qs[_0x4d84('0x30')](_0x1209d3[_0x4d84('0x2d')][_0x4d84('0x30')]));_0x173f12[_0x4d84('0x31')]=_0x173f12[_0x4d84('0x31')][_0x4d84('0x42')]?_0x173f12[_0x4d84('0x31')]:_0x3fd8e1['model'];if(!_0x1209d3['query']['hasOwnProperty'](_0x4d84('0x32'))){_0x173f12['limit']=qs[_0x4d84('0x1c')](_0x1209d3[_0x4d84('0x2d')][_0x4d84('0x1c')]);_0x173f12['offset']=qs[_0x4d84('0x19')](_0x1209d3[_0x4d84('0x2d')]['offset']);}_0x173f12['order']=qs['sort'](_0x1209d3['query'][_0x4d84('0x34')]);_0x173f12['where']=qs[_0x4d84('0x37')](_[_0x4d84('0x36')](_0x1209d3[_0x4d84('0x2d')],_0x3fd8e1[_0x4d84('0x37')]));_0x173f12['where'][_0x4d84('0x57')]=_0x1235c5['id'];if(_0x1209d3[_0x4d84('0x2d')]['filter']){_0x173f12[_0x4d84('0x35')]=_[_0x4d84('0x39')](_0x173f12[_0x4d84('0x35')],{'$or':_[_0x4d84('0x28')](_0x173f12['attributes'],function(_0x3c6fa2){var _0x59799a={};_0x59799a[_0x3c6fa2]={'$like':'%'+_0x1209d3[_0x4d84('0x2d')][_0x4d84('0x38')]+'%'};return _0x59799a;})});}_0x173f12=_[_0x4d84('0x39')]({},_0x173f12,_0x1209d3[_0x4d84('0x43')]);return db['JscriptySessionReport'][_0x4d84('0x1b')]({'where':_0x173f12['where']})[_0x4d84('0x20')](function(_0x4cc2b6){_0x57028d[_0x4d84('0x1b')]=_0x4cc2b6;if(_0x1209d3['query'][_0x4d84('0x3c')]){_0x173f12['include']=[{'all':!![]}];}return db[_0x4d84('0x56')][_0x4d84('0x3e')](_0x173f12);})[_0x4d84('0x20')](function(_0x437592){_0x57028d[_0x4d84('0x3f')]=_0x437592;return _0x57028d;});}})[_0x4d84('0x20')](respondWithFilteredResult(_0x266369,_0x173f12))[_0x4d84('0x44')](handleError(_0x266369,null));};exports['getAnswers']=function(_0x132810,_0x4fd348,_0x3b331c){var _0x23bbbd={'raw':!![],'where':{}};var _0x932259={};var _0x3cdb74={'count':0x0,'rows':[]};return db[_0x4d84('0x3b')][_0x4d84('0x55')]({'where':{'id':_0x132810['params']['id']}})['then'](handleEntityNotFound(_0x4fd348,null))['then'](function(_0x40b21d){if(_0x40b21d){_0x932259['model']=_[_0x4d84('0x2e')](db[_0x4d84('0x58')]['rawAttributes']);_0x932259[_0x4d84('0x2d')]=_['keys'](_0x132810[_0x4d84('0x2d')]);_0x932259[_0x4d84('0x37')]=_[_0x4d84('0x41')](_0x932259[_0x4d84('0x2f')],_0x932259[_0x4d84('0x2d')]);_0x23bbbd[_0x4d84('0x31')]=_[_0x4d84('0x41')](_0x932259[_0x4d84('0x2f')],qs[_0x4d84('0x30')](_0x132810['query'][_0x4d84('0x30')]));_0x23bbbd['attributes']=_0x23bbbd[_0x4d84('0x31')][_0x4d84('0x42')]?_0x23bbbd[_0x4d84('0x31')]:_0x932259[_0x4d84('0x2f')];if(!_0x132810['query']['hasOwnProperty'](_0x4d84('0x32'))){_0x23bbbd['limit']=qs[_0x4d84('0x1c')](_0x132810[_0x4d84('0x2d')][_0x4d84('0x1c')]);_0x23bbbd[_0x4d84('0x19')]=qs[_0x4d84('0x19')](_0x132810[_0x4d84('0x2d')][_0x4d84('0x19')]);}_0x23bbbd[_0x4d84('0x33')]=qs['sort'](_0x132810['query'][_0x4d84('0x34')]);_0x23bbbd[_0x4d84('0x35')]=qs[_0x4d84('0x37')](_[_0x4d84('0x36')](_0x132810[_0x4d84('0x2d')],_0x932259['filters']));_0x23bbbd[_0x4d84('0x35')][_0x4d84('0x57')]=_0x40b21d['id'];if(_0x132810[_0x4d84('0x2d')][_0x4d84('0x38')]){_0x23bbbd['where']=_['merge'](_0x23bbbd[_0x4d84('0x35')],{'$or':_[_0x4d84('0x28')](_0x23bbbd[_0x4d84('0x31')],function(_0x49b8b2){var _0x3ef174={};_0x3ef174[_0x49b8b2]={'$like':'%'+_0x132810['query']['filter']+'%'};return _0x3ef174;})});}_0x23bbbd=_['merge']({},_0x23bbbd,_0x132810[_0x4d84('0x43')]);return db[_0x4d84('0x58')][_0x4d84('0x1b')]({'where':_0x23bbbd[_0x4d84('0x35')]})[_0x4d84('0x20')](function(_0x27ff12){_0x3cdb74['count']=_0x27ff12;if(_0x132810[_0x4d84('0x2d')][_0x4d84('0x3c')]){_0x23bbbd[_0x4d84('0x3d')]=[{'all':!![]}];}return db[_0x4d84('0x58')]['findAll'](_0x23bbbd);})[_0x4d84('0x20')](function(_0x24bc7d){_0x3cdb74[_0x4d84('0x3f')]=_0x24bc7d;return _0x3cdb74;});}})[_0x4d84('0x20')](respondWithFilteredResult(_0x4fd348,_0x23bbbd))[_0x4d84('0x44')](handleError(_0x4fd348,null));};function char(_0x54c5f6){return _0x4d84('0x59')===typeof _0x54c5f6?String[_0x4d84('0x5a')][_0x4d84('0x1e')](null,arguments):_0x54c5f6;}function needsEncapsulation(_0x5d984a){return!!_0x5d984a&&(_0x5d984a['toString']()[_0x4d84('0x5b')](char(0xd))>=0x0||_0x5d984a[_0x4d84('0x5c')]()[_0x4d84('0x5b')](char(0xa))>=0x0||_0x5d984a[_0x4d84('0x5c')]()[_0x4d84('0x5b')](char(0x2c))>=0x0||_0x5d984a[_0x4d84('0x5c')]()[_0x4d84('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x41ff38){var _0x5e3370=char(0x22),_0x56386f='\x5c'+char(0x22),_0x30039e=_0x41ff38[_0x4d84('0x5c')]()[_0x4d84('0x5d')](new RegExp(_0x5e3370,'g'),_0x56386f);return _0x5e3370+_0x30039e+_0x5e3370;}exports['getSummary']=function(_0xdbb71a,_0x3e80cf,_0x4bd0b3){var _0x4d6c20,_0x5119c6;var _0x33ae95={'where':{'ProjectId':_0xdbb71a[_0x4d84('0x4d')]['id']}};if(_0xdbb71a[_0x4d84('0x2d')][_0x4d84('0x5e')]){_0x33ae95[_0x4d84('0x35')][_0x4d84('0x5f')]=JSON[_0x4d84('0x60')](_0xdbb71a['query'][_0x4d84('0x5e')]);}return db['JscriptySessionReport'][_0x4d84('0x3e')](_0x33ae95)[_0x4d84('0x20')](handleEntityNotFound(_0x3e80cf,null))['then'](function(_0x1a074d){if(_0x1a074d){_0x4d6c20=_0x1a074d;return db[_0x4d84('0x61')][_0x4d84('0x3e')]({'where':{'SessionId':{'$in':_[_0x4d84('0x28')](_0x4d6c20,'id')},'ProjectId':_0xdbb71a['params']['id']},'order':'-createdAt'});}})[_0x4d84('0x20')](handleEntityNotFound(_0x3e80cf,null))['then'](function(_0x52aede){if(_0x52aede){_0x5119c6=_0x52aede;var _0x37feaf={};for(var _0x5f1b20=0x0,_0x39d2f7=_0x5119c6[_0x4d84('0x42')];_0x5f1b20<_0x39d2f7;_0x5f1b20++){if(!_0x37feaf[_0x4d84('0x62')](_0x5119c6[_0x5f1b20][_0x4d84('0x63')])){_0x37feaf[_0x5119c6[_0x5f1b20][_0x4d84('0x63')]]=needsEncapsulation(_0x5119c6[_0x5f1b20][_0x4d84('0x64')])?encapsulate(_0x5119c6[_0x5f1b20][_0x4d84('0x64')]):_0x5119c6[_0x5f1b20][_0x4d84('0x64')];}}var _0x5cc985=[],_0x2c517b={};for(var _0x293ba0=0x0,_0x8a3030=_0x4d6c20[_0x4d84('0x42')];_0x293ba0<_0x8a3030;_0x293ba0++){_0x2c517b={'ProjectId':_0xdbb71a[_0x4d84('0x4d')]['id'],'SessionId':_0x4d6c20[_0x293ba0]['id'],'StartTime':moment(_0x4d6c20[_0x293ba0]['starttime'])['format'](_0x4d84('0x65'))};for(var _0x4d3131=0x0,_0x95ffaa=_0x5119c6[_0x4d84('0x42')];_0x4d3131<_0x95ffaa;_0x4d3131++){if(_0x5119c6[_0x4d3131][_0x4d84('0x66')]==_0x4d6c20[_0x293ba0]['id']&&_0x37feaf[_0x4d84('0x62')](_0x5119c6[_0x4d3131][_0x4d84('0x63')])){_0x2c517b[_0x37feaf[_0x5119c6[_0x4d3131][_0x4d84('0x63')]]]=_0x5119c6[_0x4d3131][_0x4d84('0x67')];}}for(var _0x262f59 in _0x37feaf){if(!_0x2c517b[_0x4d84('0x62')](_0x37feaf[_0x262f59])){_0x2c517b[_0x37feaf[_0x262f59]]=null;}}_0x5cc985['push'](_0x2c517b);}return _0x5cc985;}})['then'](function(_0x55b6f4){if(!_['isEmpty'](_0x55b6f4)){var _0x365653=toCsv(_0x55b6f4);var _0x43ecae=Date['now']();fs[_0x4d84('0x68')](util['format'](_0x4d84('0x69'),_0xdbb71a[_0x4d84('0x4d')]['id'],_0x43ecae),_0x365653);_0x3e80cf['setHeader'](_0x4d84('0x6a'),_0x4d84('0x6b')+util[_0x4d84('0x6c')](_0x4d84('0x6d'),_0xdbb71a[_0x4d84('0x4d')]['id'],_0x43ecae));_0x3e80cf[_0x4d84('0x6e')](_0x4d84('0x6f'),'text/csv');return _0x3e80cf['download'](util[_0x4d84('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xdbb71a[_0x4d84('0x4d')]['id'],_0x43ecae));}else{return _0x3e80cf['sendStatus'](0xcc);}})['catch'](handleError(_0x3e80cf,null));}; \ No newline at end of file +var _0x0699=['text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','undefined','limit','offset','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','count','include','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','UserProfileSection','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','JscriptySessionReport','nolimit','findAll','rows','getAnswers','findOne','JscriptyAnswerReport','pick','ProjectId','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','format','setHeader'];(function(_0x27ff8d,_0x57f86c){var _0x15a95b=function(_0x2e591c){while(--_0x2e591c){_0x27ff8d['push'](_0x27ff8d['shift']());}};_0x15a95b(++_0x57f86c);}(_0x0699,0x1db));var _0x9069=function(_0x5ac348,_0x13d18c){_0x5ac348=_0x5ac348-0x0;var _0x4a490c=_0x0699[_0x5ac348];return _0x4a490c;};'use strict';var emlformat=require(_0x9069('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9069('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9069('0x2'));var moment=require(_0x9069('0x3'));var BPromise=require(_0x9069('0x4'));var Mustache=require(_0x9069('0x5'));var util=require('util');var path=require(_0x9069('0x6'));var sox=require(_0x9069('0x7'));var csv=require(_0x9069('0x8'));var ejs=require(_0x9069('0x9'));var fs=require('fs');var fs_extra=require(_0x9069('0xa'));var _=require(_0x9069('0xb'));var squel=require(_0x9069('0xc'));var crypto=require(_0x9069('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9069('0x8'));var querystring=require(_0x9069('0xe'));var Papa=require(_0x9069('0xf'));var Redis=require(_0x9069('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9069('0x11'));var as=require(_0x9069('0x12'));var hardwareService=require(_0x9069('0x13'));var logger=require(_0x9069('0x14'))(_0x9069('0x15'));var utils=require(_0x9069('0x16'));var config=require(_0x9069('0x17'));var licenseUtil=require(_0x9069('0x18'));var db=require(_0x9069('0x19'))['db'];function respondWithStatusCode(_0x5d47ae,_0x46537d){_0x46537d=_0x46537d||0xcc;return function(_0x195996){if(_0x195996){return _0x5d47ae['sendStatus'](_0x46537d);}return _0x5d47ae[_0x9069('0x1a')](_0x46537d)[_0x9069('0x1b')]();};}function respondWithResult(_0xef9ddc,_0x41fe2c){_0x41fe2c=_0x41fe2c||0xc8;return function(_0x505c57){if(_0x505c57){return _0xef9ddc['status'](_0x41fe2c)[_0x9069('0x1c')](_0x505c57);}};}function respondWithFilteredResult(_0x596ea0,_0x3a23ce){return function(_0x3118ec){if(_0x3118ec){var _0x1864bc=typeof _0x3a23ce['offset']===_0x9069('0x1d')&&typeof _0x3a23ce[_0x9069('0x1e')]===_0x9069('0x1d');var _0x147788=_0x3118ec['count'];var _0x346b07=_0x1864bc?0x0:_0x3a23ce[_0x9069('0x1f')];var _0xb2bc45=_0x1864bc?_0x3118ec['count']:_0x3a23ce[_0x9069('0x1f')]+_0x3a23ce['limit'];var _0x28637c;if(_0xb2bc45>=_0x147788){_0xb2bc45=_0x147788;_0x28637c=0xc8;}else{_0x28637c=0xce;}_0x596ea0[_0x9069('0x1a')](_0x28637c);return _0x596ea0['set']('Content-Range',_0x346b07+'-'+_0xb2bc45+'/'+_0x147788)[_0x9069('0x1c')](_0x3118ec);}return null;};}function patchUpdates(_0x5d805a){return function(_0x574275){try{jsonpatch[_0x9069('0x20')](_0x574275,_0x5d805a,!![]);}catch(_0x2d0d91){return BPromise[_0x9069('0x21')](_0x2d0d91);}return _0x574275[_0x9069('0x22')]();};}function saveUpdates(_0x372875,_0x45157e){return function(_0xfc92e7){if(_0xfc92e7){return _0xfc92e7['update'](_0x372875)[_0x9069('0x23')](function(_0x2300e9){return _0x2300e9;});}return null;};}function removeEntity(_0x56de68,_0x326ba4){return function(_0x4b7d9e){if(_0x4b7d9e){return _0x4b7d9e[_0x9069('0x24')]()[_0x9069('0x23')](function(){var _0xc72b88=_0x4b7d9e[_0x9069('0x25')]({'plain':!![]});var _0x2a8f86='Projects';return db[_0x9069('0x26')][_0x9069('0x24')]({'where':{'type':_0x2a8f86,'resourceId':_0xc72b88['id']}})['then'](function(){return _0x4b7d9e;});})[_0x9069('0x23')](function(){_0x56de68['status'](0xcc)[_0x9069('0x1b')]();});}};}function handleEntityNotFound(_0x380c7e,_0x52a107){return function(_0x5dcdaa){if(!_0x5dcdaa){_0x380c7e[_0x9069('0x27')](0x194);}return _0x5dcdaa;};}function handleError(_0x2728b4,_0x327613){_0x327613=_0x327613||0x1f4;return function(_0x13d226){logger[_0x9069('0x28')](_0x13d226[_0x9069('0x29')]);if(_0x13d226[_0x9069('0x2a')]){delete _0x13d226[_0x9069('0x2a')];}_0x2728b4[_0x9069('0x1a')](_0x327613)[_0x9069('0x2b')](_0x13d226);};}exports[_0x9069('0x2c')]=function(_0x5d3155,_0x13c769){var _0x51591f={},_0x1dee34={},_0x935844={'count':0x0,'rows':[]};var _0x4b84cb=_[_0x9069('0x2d')](db[_0x9069('0x2e')][_0x9069('0x2f')],function(_0x1220de){return{'name':_0x1220de[_0x9069('0x30')],'type':_0x1220de[_0x9069('0x31')][_0x9069('0x32')]};});_0x1dee34[_0x9069('0x33')]=_[_0x9069('0x2d')](_0x4b84cb,_0x9069('0x2a'));_0x1dee34['query']=_[_0x9069('0x34')](_0x5d3155[_0x9069('0x35')]);_0x1dee34['filters']=_[_0x9069('0x36')](_0x1dee34['model'],_0x1dee34['query']);_0x51591f[_0x9069('0x37')]=_[_0x9069('0x36')](_0x1dee34[_0x9069('0x33')],qs[_0x9069('0x38')](_0x5d3155[_0x9069('0x35')]['fields']));_0x51591f['attributes']=_0x51591f[_0x9069('0x37')][_0x9069('0x39')]?_0x51591f[_0x9069('0x37')]:_0x1dee34['model'];if(!_0x5d3155[_0x9069('0x35')][_0x9069('0x3a')]('nolimit')){_0x51591f[_0x9069('0x1e')]=qs['limit'](_0x5d3155[_0x9069('0x35')][_0x9069('0x1e')]);_0x51591f[_0x9069('0x1f')]=qs['offset'](_0x5d3155[_0x9069('0x35')]['offset']);}_0x51591f[_0x9069('0x3b')]=qs[_0x9069('0x3c')](_0x5d3155[_0x9069('0x35')]['sort']);_0x51591f[_0x9069('0x3d')]=qs[_0x9069('0x3e')](_['pick'](_0x5d3155['query'],_0x1dee34[_0x9069('0x3e')]),_0x4b84cb);if(_0x5d3155[_0x9069('0x35')][_0x9069('0x3f')]){_0x51591f[_0x9069('0x3d')]=_[_0x9069('0x40')](_0x51591f[_0x9069('0x3d')],{'$or':_[_0x9069('0x2d')](_0x4b84cb,function(_0x4b2e9b){if(_0x4b2e9b[_0x9069('0x31')]!=='VIRTUAL'){var _0x3800de={};_0x3800de[_0x4b2e9b[_0x9069('0x2a')]]={'$like':'%'+_0x5d3155[_0x9069('0x35')][_0x9069('0x3f')]+'%'};return _0x3800de;}})});}_0x51591f=_[_0x9069('0x40')]({},_0x51591f,_0x5d3155[_0x9069('0x41')]);var _0x5e7a31={'where':_0x51591f['where']};return db[_0x9069('0x2e')][_0x9069('0x42')](_0x5e7a31)[_0x9069('0x23')](function(_0x58e082){_0x935844[_0x9069('0x42')]=_0x58e082;if(_0x5d3155['query']['includeAll']){_0x51591f[_0x9069('0x43')]=[{'all':!![]}];}return db[_0x9069('0x2e')]['findAll'](_0x51591f);})['then'](function(_0x4ff4b9){_0x935844['rows']=_0x4ff4b9;return _0x935844;})[_0x9069('0x23')](respondWithFilteredResult(_0x13c769,_0x51591f))[_0x9069('0x44')](handleError(_0x13c769,null));};exports[_0x9069('0x45')]=function(_0x2313a8,_0x5948f4){var _0x5ba8bd={'raw':![],'where':{'id':_0x2313a8[_0x9069('0x46')]['id']}},_0x275ba2={};_0x275ba2[_0x9069('0x33')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x275ba2[_0x9069('0x35')]=_[_0x9069('0x34')](_0x2313a8['query']);_0x275ba2[_0x9069('0x3e')]=_[_0x9069('0x36')](_0x275ba2[_0x9069('0x33')],_0x275ba2[_0x9069('0x35')]);_0x5ba8bd[_0x9069('0x37')]=_['intersection'](_0x275ba2['model'],qs[_0x9069('0x38')](_0x2313a8[_0x9069('0x35')][_0x9069('0x38')]));_0x5ba8bd[_0x9069('0x37')]=_0x5ba8bd['attributes'][_0x9069('0x39')]?_0x5ba8bd[_0x9069('0x37')]:_0x275ba2[_0x9069('0x33')];if(_0x2313a8['query'][_0x9069('0x47')]){_0x5ba8bd[_0x9069('0x43')]=[{'all':!![]}];}_0x5ba8bd=_[_0x9069('0x40')]({},_0x5ba8bd,_0x2313a8[_0x9069('0x41')]);return db[_0x9069('0x2e')][_0x9069('0x48')](_0x5ba8bd)['then'](handleEntityNotFound(_0x5948f4,null))[_0x9069('0x23')](respondWithResult(_0x5948f4,null))['catch'](handleError(_0x5948f4,null));};exports[_0x9069('0x49')]=function(_0x2598be,_0x54e2ce){return db['JscriptyProject'][_0x9069('0x49')](_0x2598be[_0x9069('0x4a')],{})['then'](function(_0x5b26cb){var _0x4ab37e=_0x2598be['user'][_0x9069('0x25')]({'plain':!![]});if(!_0x4ab37e)throw new Error(_0x9069('0x4b'));if(_0x4ab37e[_0x9069('0x4c')]===_0x9069('0x4d')){var _0x2e8f2c=_0x5b26cb[_0x9069('0x25')]({'plain':!![]});var _0x16c91c=_0x9069('0x4e');return db[_0x9069('0x4f')][_0x9069('0x48')]({'where':{'name':_0x16c91c,'userProfileId':_0x4ab37e['userProfileId']},'raw':!![]})[_0x9069('0x23')](function(_0x6a081e){if(_0x6a081e&&_0x6a081e[_0x9069('0x50')]===0x0){return db['UserProfileResource'][_0x9069('0x49')]({'name':_0x2e8f2c[_0x9069('0x2a')],'resourceId':_0x2e8f2c['id'],'type':_0x6a081e['name'],'sectionId':_0x6a081e['id']},{})['then'](function(){return _0x5b26cb;});}else{return _0x5b26cb;}})[_0x9069('0x44')](function(_0x13136e){logger[_0x9069('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13136e);throw _0x13136e;});}return _0x5b26cb;})[_0x9069('0x23')](respondWithResult(_0x54e2ce,0xc9))[_0x9069('0x44')](handleError(_0x54e2ce,null));};exports[_0x9069('0x51')]=function(_0x2f7c9f,_0x23383c){var _0x43da52={'where':{'id':_0x2f7c9f[_0x9069('0x46')]['id']}},_0x336f7a={};_0x336f7a[_0x9069('0x33')]=_[_0x9069('0x34')](db[_0x9069('0x2e')][_0x9069('0x2f')]);_0x43da52[_0x9069('0x37')]=_[_0x9069('0x36')](_0x336f7a[_0x9069('0x33')],qs[_0x9069('0x38')](_0x2f7c9f[_0x9069('0x35')][_0x9069('0x38')]));_0x43da52[_0x9069('0x37')]=_0x43da52['attributes'][_0x9069('0x39')]?_0x43da52['attributes']:_0x336f7a[_0x9069('0x33')];if(_0x2f7c9f['query']['includeAll']){_0x43da52[_0x9069('0x43')]=[{'all':!![]}];}_0x43da52=_[_0x9069('0x40')]({},_0x43da52,_0x2f7c9f[_0x9069('0x41')]);return db['JscriptyProject']['find'](_0x43da52)[_0x9069('0x23')](handleEntityNotFound(_0x23383c,null))[_0x9069('0x23')](function(_0x5e5b3f){if(_0x5e5b3f){var _0x436fe3=_0x5e5b3f[_0x9069('0x25')]({'plain':!![]});_0x436fe3=qs[_0x9069('0x52')](_0x436fe3,['id',_0x9069('0x53'),'updatedAt']);_0x2f7c9f[_0x9069('0x4a')]=_[_0x9069('0x52')](_0x2f7c9f['body'],['id',_0x9069('0x53'),_0x9069('0x54')]);return db[_0x9069('0x2e')]['create'](_[_0x9069('0x40')](_0x436fe3,_0x2f7c9f[_0x9069('0x4a')]),{'include':_0x2f7c9f['query'][_0x9069('0x47')]?[{'all':!![]}]:undefined})[_0x9069('0x23')](function(_0x33dcf1){var _0xf9718f=_0x2f7c9f['user'][_0x9069('0x25')]({'plain':!![]});if(!_0xf9718f)throw new Error(_0x9069('0x4b'));if(_0xf9718f['role']===_0x9069('0x4d')){var _0x42c483=_0x33dcf1['get']({'plain':!![]});var _0x5e6a37=_0x9069('0x4e');return db['UserProfileSection'][_0x9069('0x48')]({'where':{'name':_0x5e6a37,'userProfileId':_0xf9718f['userProfileId']},'raw':!![]})[_0x9069('0x23')](function(_0x2f3fe0){if(_0x2f3fe0&&_0x2f3fe0[_0x9069('0x50')]===0x0){return db[_0x9069('0x26')][_0x9069('0x49')]({'name':_0x42c483[_0x9069('0x2a')],'resourceId':_0x42c483['id'],'type':_0x2f3fe0['name'],'sectionId':_0x2f3fe0['id']},{})[_0x9069('0x23')](function(){return _0x33dcf1;});}else{return _0x33dcf1;}})[_0x9069('0x44')](function(_0x1ac8cb){logger[_0x9069('0x28')](_0x9069('0x55'),_0x1ac8cb);throw _0x1ac8cb;});}return _0x33dcf1;});}})['then'](respondWithResult(_0x23383c,0xc9))['catch'](handleError(_0x23383c,null));};exports[_0x9069('0x56')]=function(_0x11784d,_0x3e24bc){if(_0x11784d[_0x9069('0x4a')]['id']){delete _0x11784d[_0x9069('0x4a')]['id'];}return db[_0x9069('0x2e')][_0x9069('0x48')]({'where':{'id':_0x11784d[_0x9069('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e24bc,null))['then'](saveUpdates(_0x11784d[_0x9069('0x4a')],null))[_0x9069('0x23')](respondWithResult(_0x3e24bc,null))['catch'](handleError(_0x3e24bc,null));};exports[_0x9069('0x24')]=function(_0x4808e3,_0x315176){return db[_0x9069('0x2e')]['find']({'where':{'id':_0x4808e3[_0x9069('0x46')]['id']}})['then'](handleEntityNotFound(_0x315176,null))['then'](removeEntity(_0x315176,null))[_0x9069('0x44')](handleError(_0x315176,null));};exports['getSessions']=function(_0x5b9942,_0x5734e6,_0x3cb0c5){var _0x3a4ab2={'raw':!![],'where':{}};var _0x54ba25={};var _0x4130f6={'count':0x0,'rows':[]};return db[_0x9069('0x2e')]['findOne']({'where':{'id':_0x5b9942[_0x9069('0x46')]['id']}})[_0x9069('0x23')](handleEntityNotFound(_0x5734e6,null))[_0x9069('0x23')](function(_0x4f4bc7){if(_0x4f4bc7){_0x54ba25[_0x9069('0x33')]=_[_0x9069('0x34')](db[_0x9069('0x57')]['rawAttributes']);_0x54ba25[_0x9069('0x35')]=_[_0x9069('0x34')](_0x5b9942[_0x9069('0x35')]);_0x54ba25['filters']=_[_0x9069('0x36')](_0x54ba25[_0x9069('0x33')],_0x54ba25[_0x9069('0x35')]);_0x3a4ab2['attributes']=_[_0x9069('0x36')](_0x54ba25[_0x9069('0x33')],qs[_0x9069('0x38')](_0x5b9942[_0x9069('0x35')][_0x9069('0x38')]));_0x3a4ab2[_0x9069('0x37')]=_0x3a4ab2['attributes'][_0x9069('0x39')]?_0x3a4ab2['attributes']:_0x54ba25[_0x9069('0x33')];if(!_0x5b9942[_0x9069('0x35')][_0x9069('0x3a')](_0x9069('0x58'))){_0x3a4ab2['limit']=qs[_0x9069('0x1e')](_0x5b9942[_0x9069('0x35')][_0x9069('0x1e')]);_0x3a4ab2[_0x9069('0x1f')]=qs['offset'](_0x5b9942[_0x9069('0x35')]['offset']);}_0x3a4ab2[_0x9069('0x3b')]=qs[_0x9069('0x3c')](_0x5b9942[_0x9069('0x35')][_0x9069('0x3c')]);_0x3a4ab2['where']=qs[_0x9069('0x3e')](_['pick'](_0x5b9942[_0x9069('0x35')],_0x54ba25[_0x9069('0x3e')]));_0x3a4ab2[_0x9069('0x3d')]['ProjectId']=_0x4f4bc7['id'];if(_0x5b9942[_0x9069('0x35')]['filter']){_0x3a4ab2[_0x9069('0x3d')]=_[_0x9069('0x40')](_0x3a4ab2[_0x9069('0x3d')],{'$or':_['map'](_0x3a4ab2['attributes'],function(_0x25f148){var _0xc13ef5={};_0xc13ef5[_0x25f148]={'$like':'%'+_0x5b9942['query'][_0x9069('0x3f')]+'%'};return _0xc13ef5;})});}_0x3a4ab2=_[_0x9069('0x40')]({},_0x3a4ab2,_0x5b9942['options']);return db[_0x9069('0x57')][_0x9069('0x42')]({'where':_0x3a4ab2[_0x9069('0x3d')]})[_0x9069('0x23')](function(_0x1fca34){_0x4130f6['count']=_0x1fca34;if(_0x5b9942['query'][_0x9069('0x47')]){_0x3a4ab2['include']=[{'all':!![]}];}return db[_0x9069('0x57')][_0x9069('0x59')](_0x3a4ab2);})[_0x9069('0x23')](function(_0x2ec177){_0x4130f6[_0x9069('0x5a')]=_0x2ec177;return _0x4130f6;});}})[_0x9069('0x23')](respondWithFilteredResult(_0x5734e6,_0x3a4ab2))[_0x9069('0x44')](handleError(_0x5734e6,null));};exports[_0x9069('0x5b')]=function(_0xeb4f3b,_0x2ac7d3,_0x292f2e){var _0x2e756f={'raw':!![],'where':{}};var _0x4cc456={};var _0x1dfb67={'count':0x0,'rows':[]};return db[_0x9069('0x2e')][_0x9069('0x5c')]({'where':{'id':_0xeb4f3b['params']['id']}})['then'](handleEntityNotFound(_0x2ac7d3,null))[_0x9069('0x23')](function(_0xbef43f){if(_0xbef43f){_0x4cc456['model']=_['keys'](db[_0x9069('0x5d')][_0x9069('0x2f')]);_0x4cc456[_0x9069('0x35')]=_[_0x9069('0x34')](_0xeb4f3b['query']);_0x4cc456[_0x9069('0x3e')]=_[_0x9069('0x36')](_0x4cc456[_0x9069('0x33')],_0x4cc456[_0x9069('0x35')]);_0x2e756f[_0x9069('0x37')]=_[_0x9069('0x36')](_0x4cc456[_0x9069('0x33')],qs[_0x9069('0x38')](_0xeb4f3b['query'][_0x9069('0x38')]));_0x2e756f[_0x9069('0x37')]=_0x2e756f[_0x9069('0x37')]['length']?_0x2e756f[_0x9069('0x37')]:_0x4cc456[_0x9069('0x33')];if(!_0xeb4f3b[_0x9069('0x35')][_0x9069('0x3a')](_0x9069('0x58'))){_0x2e756f[_0x9069('0x1e')]=qs[_0x9069('0x1e')](_0xeb4f3b[_0x9069('0x35')][_0x9069('0x1e')]);_0x2e756f[_0x9069('0x1f')]=qs[_0x9069('0x1f')](_0xeb4f3b[_0x9069('0x35')][_0x9069('0x1f')]);}_0x2e756f[_0x9069('0x3b')]=qs['sort'](_0xeb4f3b[_0x9069('0x35')][_0x9069('0x3c')]);_0x2e756f[_0x9069('0x3d')]=qs['filters'](_[_0x9069('0x5e')](_0xeb4f3b[_0x9069('0x35')],_0x4cc456['filters']));_0x2e756f[_0x9069('0x3d')][_0x9069('0x5f')]=_0xbef43f['id'];if(_0xeb4f3b['query'][_0x9069('0x3f')]){_0x2e756f[_0x9069('0x3d')]=_[_0x9069('0x40')](_0x2e756f['where'],{'$or':_[_0x9069('0x2d')](_0x2e756f[_0x9069('0x37')],function(_0x2a5449){var _0x29ce28={};_0x29ce28[_0x2a5449]={'$like':'%'+_0xeb4f3b[_0x9069('0x35')]['filter']+'%'};return _0x29ce28;})});}_0x2e756f=_[_0x9069('0x40')]({},_0x2e756f,_0xeb4f3b['options']);return db['JscriptyAnswerReport'][_0x9069('0x42')]({'where':_0x2e756f[_0x9069('0x3d')]})[_0x9069('0x23')](function(_0x42b265){_0x1dfb67[_0x9069('0x42')]=_0x42b265;if(_0xeb4f3b['query'][_0x9069('0x47')]){_0x2e756f['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x9069('0x59')](_0x2e756f);})[_0x9069('0x23')](function(_0x133c0f){_0x1dfb67['rows']=_0x133c0f;return _0x1dfb67;});}})[_0x9069('0x23')](respondWithFilteredResult(_0x2ac7d3,_0x2e756f))['catch'](handleError(_0x2ac7d3,null));};function char(_0x2db3f6){return'number'===typeof _0x2db3f6?String[_0x9069('0x60')][_0x9069('0x20')](null,arguments):_0x2db3f6;}function needsEncapsulation(_0x24d7cc){return!!_0x24d7cc&&(_0x24d7cc['toString']()['indexOf'](char(0xd))>=0x0||_0x24d7cc[_0x9069('0x61')]()['indexOf'](char(0xa))>=0x0||_0x24d7cc[_0x9069('0x61')]()[_0x9069('0x62')](char(0x2c))>=0x0||_0x24d7cc[_0x9069('0x61')]()[_0x9069('0x62')](char(0x22))>=0x0);}function encapsulate(_0x125da1){var _0x1d6602=char(0x22),_0x27e95b='\x5c'+char(0x22),_0x33206c=_0x125da1['toString']()[_0x9069('0x63')](new RegExp(_0x1d6602,'g'),_0x27e95b);return _0x1d6602+_0x33206c+_0x1d6602;}exports[_0x9069('0x64')]=function(_0x2acdb0,_0x2b6b22,_0x311383){var _0x5f2640,_0x4621b7;var _0x46f2ff={'where':{'ProjectId':_0x2acdb0[_0x9069('0x46')]['id']}};if(_0x2acdb0['query'][_0x9069('0x65')]){_0x46f2ff['where'][_0x9069('0x66')]=JSON[_0x9069('0x67')](_0x2acdb0[_0x9069('0x35')][_0x9069('0x65')]);}return db[_0x9069('0x57')]['findAll'](_0x46f2ff)[_0x9069('0x23')](handleEntityNotFound(_0x2b6b22,null))[_0x9069('0x23')](function(_0xe4e026){if(_0xe4e026){_0x5f2640=_0xe4e026;return db[_0x9069('0x68')][_0x9069('0x59')]({'where':{'SessionId':{'$in':_[_0x9069('0x2d')](_0x5f2640,'id')},'ProjectId':_0x2acdb0[_0x9069('0x46')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x2b6b22,null))['then'](function(_0x101908){if(_0x101908){_0x4621b7=_0x101908;var _0xae5442={};for(var _0x179985=0x0,_0x33a334=_0x4621b7[_0x9069('0x39')];_0x179985<_0x33a334;_0x179985++){if(!_0xae5442[_0x9069('0x3a')](_0x4621b7[_0x179985][_0x9069('0x69')])){_0xae5442[_0x4621b7[_0x179985][_0x9069('0x69')]]=needsEncapsulation(_0x4621b7[_0x179985][_0x9069('0x6a')])?encapsulate(_0x4621b7[_0x179985][_0x9069('0x6a')]):_0x4621b7[_0x179985][_0x9069('0x6a')];}}var _0x23f3f2=[],_0x4ba920={};for(var _0x523be3=0x0,_0x3387d3=_0x5f2640[_0x9069('0x39')];_0x523be3<_0x3387d3;_0x523be3++){_0x4ba920={'ProjectId':_0x2acdb0[_0x9069('0x46')]['id'],'SessionId':_0x5f2640[_0x523be3]['id'],'StartTime':moment(_0x5f2640[_0x523be3]['starttime'])['format'](_0x9069('0x6b'))};for(var _0x20b360=0x0,_0x5c4344=_0x4621b7[_0x9069('0x39')];_0x20b360<_0x5c4344;_0x20b360++){if(_0x4621b7[_0x20b360]['SessionId']==_0x5f2640[_0x523be3]['id']&&_0xae5442['hasOwnProperty'](_0x4621b7[_0x20b360][_0x9069('0x69')])){_0x4ba920[_0xae5442[_0x4621b7[_0x20b360][_0x9069('0x69')]]]=_0x4621b7[_0x20b360][_0x9069('0x6c')];}}for(var _0x258ead in _0xae5442){if(!_0x4ba920[_0x9069('0x3a')](_0xae5442[_0x258ead])){_0x4ba920[_0xae5442[_0x258ead]]=null;}}_0x23f3f2[_0x9069('0x6d')](_0x4ba920);}return _0x23f3f2;}})[_0x9069('0x23')](function(_0x4799e8){if(!_[_0x9069('0x6e')](_0x4799e8)){var _0x2e010d=toCsv(_0x4799e8);var _0x4d6d5c=Date[_0x9069('0x6f')]();fs[_0x9069('0x70')](util[_0x9069('0x71')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2acdb0[_0x9069('0x46')]['id'],_0x4d6d5c),_0x2e010d);_0x2b6b22[_0x9069('0x72')]('Content-disposition','attachment;\x20filename='+util[_0x9069('0x71')]('Jscripty_Project_%d_Summary_%s.csv',_0x2acdb0[_0x9069('0x46')]['id'],_0x4d6d5c));_0x2b6b22['setHeader']('Content-type',_0x9069('0x73'));return _0x2b6b22[_0x9069('0x74')](util[_0x9069('0x71')](_0x9069('0x75'),_0x2acdb0[_0x9069('0x46')]['id'],_0x4d6d5c));}else{return _0x2b6b22[_0x9069('0x27')](0xcc);}})[_0x9069('0x44')](handleError(_0x2b6b22,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 2c091f5..e246e30 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 _0x3bd7=['JscriptyProject','../../config/logger','api','moment','request-promise','path','rimraf','./jscriptyProject.attributes'];(function(_0x1eeb14,_0x3bdb98){var _0x5b52e9=function(_0x19e0e9){while(--_0x19e0e9){_0x1eeb14['push'](_0x1eeb14['shift']());}};_0x5b52e9(++_0x3bdb98);}(_0x3bd7,0x199));var _0x73bd=function(_0x403cff,_0x1cf463){_0x403cff=_0x403cff-0x0;var _0x5a7c56=_0x3bd7[_0x403cff];return _0x5a7c56;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x73bd('0x0'))(_0x73bd('0x1'));var moment=require(_0x73bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x73bd('0x3'));var fs=require('fs');var path=require(_0x73bd('0x4'));var rimraf=require(_0x73bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x73bd('0x6'));module['exports']=function(_0xe20fe9,_0x1aa5e1){return _0xe20fe9['define'](_0x73bd('0x7'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29d4=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','../../config/logger','api'];(function(_0x108333,_0x24f712){var _0x4eb8be=function(_0x3dc1a7){while(--_0x3dc1a7){_0x108333['push'](_0x108333['shift']());}};_0x4eb8be(++_0x24f712);}(_0x29d4,0x1a1));var _0x429d=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x29d4[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var BPromise=require(_0x429d('0x4'));var rp=require(_0x429d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var attributes=require(_0x429d('0x8'));module[_0x429d('0x9')]=function(_0x1c55aa,_0xa71445){return _0x1c55aa[_0x429d('0xa')](_0x429d('0xb'),attributes,{'tableName':'jscripty_projects','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 a80a512..c2a2f88 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x4b0bbb,_0x19f57c){var _0x5f489e=function(_0x1c3248){while(--_0x1c3248){_0x4b0bbb['push'](_0x4b0bbb['shift']());}};_0x5f489e(++_0x19f57c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0xcb91[_0x10c16d];return _0x5896f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x5a776c,_0x225df6){var _0x176265=function(_0x439ffc){while(--_0x439ffc){_0x5a776c['push'](_0x5a776c['shift']());}};_0x176265(++_0x225df6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0xcb91[_0x21af3a];return _0x268a49;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 5ba3306..2759f41 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 _0x3b3b=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','multer','path'];(function(_0x4beab9,_0x54b7db){var _0x37564c=function(_0x586b82){while(--_0x586b82){_0x4beab9['push'](_0x4beab9['shift']());}};_0x37564c(++_0x54b7db);}(_0x3b3b,0xb2));var _0xb3b3=function(_0x27c99f,_0x38009d){_0x27c99f=_0x27c99f-0x0;var _0x548449=_0x3b3b[_0x27c99f];return _0x548449;};'use strict';var multer=require(_0xb3b3('0x0'));var util=require('util');var path=require(_0xb3b3('0x1'));var timeout=require(_0xb3b3('0x2'));var express=require(_0xb3b3('0x3'));var router=express['Router']();var fs_extra=require(_0xb3b3('0x4'));var auth=require(_0xb3b3('0x5'));var interaction=require(_0xb3b3('0x6'));var config=require(_0xb3b3('0x7'));var controller=require(_0xb3b3('0x8'));router['get']('/',auth[_0xb3b3('0x9')](),controller[_0xb3b3('0xa')]);router['get']('/describe',auth[_0xb3b3('0x9')](),controller['describe']);router[_0xb3b3('0xb')](_0xb3b3('0xc'),auth[_0xb3b3('0x9')](),controller[_0xb3b3('0xd')]);router['post']('/',auth[_0xb3b3('0x9')](),controller[_0xb3b3('0xe')]);router['put'](_0xb3b3('0xc'),auth['isAuthenticated'](),controller[_0xb3b3('0xf')]);router[_0xb3b3('0x10')](_0xb3b3('0xc'),auth[_0xb3b3('0x9')](),controller[_0xb3b3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4e9d=['../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','exports','path','express','Router','fs-extra'];(function(_0x309f92,_0x32938e){var _0x298625=function(_0x2ca5f2){while(--_0x2ca5f2){_0x309f92['push'](_0x309f92['shift']());}};_0x298625(++_0x32938e);}(_0x4e9d,0x1ac));var _0xd4e9=function(_0x2b18c9,_0x49659f){_0x2b18c9=_0x2b18c9-0x0;var _0x8b913c=_0x4e9d[_0x2b18c9];return _0x8b913c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd4e9('0x0'));var timeout=require('connect-timeout');var express=require(_0xd4e9('0x1'));var router=express[_0xd4e9('0x2')]();var fs_extra=require(_0xd4e9('0x3'));var auth=require(_0xd4e9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd4e9('0x5'));var controller=require(_0xd4e9('0x6'));router[_0xd4e9('0x7')]('/',auth[_0xd4e9('0x8')](),controller[_0xd4e9('0x9')]);router[_0xd4e9('0x7')](_0xd4e9('0xa'),auth[_0xd4e9('0x8')](),controller[_0xd4e9('0xb')]);router['get'](_0xd4e9('0xc'),auth['isAuthenticated'](),controller[_0xd4e9('0xd')]);router[_0xd4e9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd4e9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd4e9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd4e9('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index e23b464..3b266be 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x103dee,_0xadce2){_0x103dee=_0x103dee-0x0;var _0x1edea2=_0x7a54[_0x103dee];return _0x1edea2;};'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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x5532fc,_0x54fdd7){_0x5532fc=_0x5532fc-0x0;var _0x106414=_0x7a54[_0x5532fc];return _0x106414;};'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 cfd4fe9..f76a020 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 _0xddad=['send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','catch','params','keys','length','includeAll','options','find','create','body','describe','eml-format','rimraf','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','name'];(function(_0x59c7e5,_0x41c52f){var _0x1a353d=function(_0x35345c){while(--_0x35345c){_0x59c7e5['push'](_0x59c7e5['shift']());}};_0x1a353d(++_0x41c52f);}(_0xddad,0xa9));var _0xddda=function(_0x59a40c,_0x35999f){_0x59a40c=_0x59a40c-0x0;var _0x3cf340=_0xddad[_0x59a40c];return _0x3cf340;};'use strict';var emlformat=require(_0xddda('0x0'));var rimraf=require(_0xddda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xddda('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xddda('0x3'));var path=require(_0xddda('0x4'));var sox=require(_0xddda('0x5'));var csv=require(_0xddda('0x6'));var ejs=require(_0xddda('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xddda('0x8'));var crypto=require(_0xddda('0x9'));var jsforce=require(_0xddda('0xa'));var deskjs=require(_0xddda('0xb'));var toCsv=require(_0xddda('0x6'));var querystring=require('querystring');var Papa=require(_0xddda('0xc'));var Redis=require(_0xddda('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xddda('0xe'));var as=require(_0xddda('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xddda('0x10'));var utils=require('../../config/utils');var config=require(_0xddda('0x11'));var licenseUtil=require(_0xddda('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b2bc3,_0x47f525){_0x47f525=_0x47f525||0xcc;return function(_0x15032b){if(_0x15032b){return _0x5b2bc3[_0xddda('0x13')](_0x47f525);}return _0x5b2bc3[_0xddda('0x14')](_0x47f525)[_0xddda('0x15')]();};}function respondWithResult(_0x1c05b7,_0x2a6b51){_0x2a6b51=_0x2a6b51||0xc8;return function(_0x1ee8b5){if(_0x1ee8b5){return _0x1c05b7['status'](_0x2a6b51)[_0xddda('0x16')](_0x1ee8b5);}};}function respondWithFilteredResult(_0x3e4174,_0x37fe97){return function(_0x410187){if(_0x410187){var _0x10b261=typeof _0x37fe97[_0xddda('0x17')]==='undefined'&&typeof _0x37fe97[_0xddda('0x18')]===_0xddda('0x19');var _0x552ab1=_0x410187['count'];var _0x24688e=_0x10b261?0x0:_0x37fe97[_0xddda('0x17')];var _0x5b2a2a=_0x10b261?_0x410187[_0xddda('0x1a')]:_0x37fe97[_0xddda('0x17')]+_0x37fe97[_0xddda('0x18')];var _0x5a959b;if(_0x5b2a2a>=_0x552ab1){_0x5b2a2a=_0x552ab1;_0x5a959b=0xc8;}else{_0x5a959b=0xce;}_0x3e4174[_0xddda('0x14')](_0x5a959b);return _0x3e4174[_0xddda('0x1b')](_0xddda('0x1c'),_0x24688e+'-'+_0x5b2a2a+'/'+_0x552ab1)[_0xddda('0x16')](_0x410187);}return null;};}function patchUpdates(_0x397950){return function(_0x24a08a){try{jsonpatch[_0xddda('0x1d')](_0x24a08a,_0x397950,!![]);}catch(_0x40588c){return BPromise[_0xddda('0x1e')](_0x40588c);}return _0x24a08a['save']();};}function saveUpdates(_0x2f0345,_0x1097ad){return function(_0x473ab3){if(_0x473ab3){return _0x473ab3[_0xddda('0x1f')](_0x2f0345)['then'](function(_0xa62e3c){return _0xa62e3c;});}return null;};}function removeEntity(_0x4637c8,_0x35b26d){return function(_0x3b361a){if(_0x3b361a){return _0x3b361a['destroy']()[_0xddda('0x20')](function(){_0x4637c8[_0xddda('0x14')](0xcc)[_0xddda('0x15')]();});}};}function handleEntityNotFound(_0x2c07dc,_0x374c84){return function(_0x394a1c){if(!_0x394a1c){_0x2c07dc['sendStatus'](0x194);}return _0x394a1c;};}function handleError(_0x31a8b7,_0x2f04d4){_0x2f04d4=_0x2f04d4||0x1f4;return function(_0x57376a){logger[_0xddda('0x21')](_0x57376a['stack']);if(_0x57376a[_0xddda('0x22')]){delete _0x57376a[_0xddda('0x22')];}_0x31a8b7[_0xddda('0x14')](_0x2f04d4)[_0xddda('0x23')](_0x57376a);};}exports[_0xddda('0x24')]=function(_0x4cf9d4,_0x227e07){var _0x56813d={},_0x5e1b78={},_0x5a66ee={'count':0x0,'rows':[]};var _0x41ba03=_['map'](db[_0xddda('0x25')][_0xddda('0x26')],function(_0x527112){return{'name':_0x527112[_0xddda('0x27')],'type':_0x527112[_0xddda('0x28')]['key']};});_0x5e1b78[_0xddda('0x29')]=_[_0xddda('0x2a')](_0x41ba03,'name');_0x5e1b78['query']=_['keys'](_0x4cf9d4[_0xddda('0x2b')]);_0x5e1b78[_0xddda('0x2c')]=_[_0xddda('0x2d')](_0x5e1b78[_0xddda('0x29')],_0x5e1b78['query']);_0x56813d[_0xddda('0x2e')]=_[_0xddda('0x2d')](_0x5e1b78[_0xddda('0x29')],qs['fields'](_0x4cf9d4['query'][_0xddda('0x2f')]));_0x56813d[_0xddda('0x2e')]=_0x56813d[_0xddda('0x2e')]['length']?_0x56813d[_0xddda('0x2e')]:_0x5e1b78[_0xddda('0x29')];if(!_0x4cf9d4['query']['hasOwnProperty'](_0xddda('0x30'))){_0x56813d['limit']=qs[_0xddda('0x18')](_0x4cf9d4[_0xddda('0x2b')]['limit']);_0x56813d[_0xddda('0x17')]=qs['offset'](_0x4cf9d4[_0xddda('0x2b')]['offset']);}_0x56813d[_0xddda('0x31')]=qs[_0xddda('0x32')](_0x4cf9d4[_0xddda('0x2b')][_0xddda('0x32')]);_0x56813d[_0xddda('0x33')]=qs[_0xddda('0x2c')](_[_0xddda('0x34')](_0x4cf9d4[_0xddda('0x2b')],_0x5e1b78[_0xddda('0x2c')]),_0x41ba03);if(_0x4cf9d4[_0xddda('0x2b')]['filter']){_0x56813d[_0xddda('0x33')]=_[_0xddda('0x35')](_0x56813d[_0xddda('0x33')],{'$or':_['map'](_0x41ba03,function(_0x457044){if(_0x457044[_0xddda('0x28')]!==_0xddda('0x36')){var _0x1d5496={};_0x1d5496[_0x457044[_0xddda('0x22')]]={'$like':'%'+_0x4cf9d4['query'][_0xddda('0x37')]+'%'};return _0x1d5496;}})});}_0x56813d=_['merge']({},_0x56813d,_0x4cf9d4['options']);var _0x3f066e={'where':_0x56813d[_0xddda('0x33')]};return db[_0xddda('0x25')][_0xddda('0x1a')](_0x3f066e)[_0xddda('0x20')](function(_0x578fcf){_0x5a66ee[_0xddda('0x1a')]=_0x578fcf;if(_0x4cf9d4[_0xddda('0x2b')]['includeAll']){_0x56813d[_0xddda('0x38')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xddda('0x39')](_0x56813d);})[_0xddda('0x20')](function(_0x35e620){_0x5a66ee['rows']=_0x35e620;return _0x5a66ee;})['then'](respondWithFilteredResult(_0x227e07,_0x56813d))[_0xddda('0x3a')](handleError(_0x227e07,null));};exports['show']=function(_0x1f0126,_0x5cc1a6){var _0x4df06a={'raw':!![],'where':{'id':_0x1f0126[_0xddda('0x3b')]['id']}},_0x4ff539={};_0x4ff539['model']=_['keys'](db['JscriptyQuestionReport']['rawAttributes']);_0x4ff539[_0xddda('0x2b')]=_[_0xddda('0x3c')](_0x1f0126['query']);_0x4ff539[_0xddda('0x2c')]=_[_0xddda('0x2d')](_0x4ff539[_0xddda('0x29')],_0x4ff539[_0xddda('0x2b')]);_0x4df06a['attributes']=_[_0xddda('0x2d')](_0x4ff539[_0xddda('0x29')],qs[_0xddda('0x2f')](_0x1f0126[_0xddda('0x2b')][_0xddda('0x2f')]));_0x4df06a[_0xddda('0x2e')]=_0x4df06a[_0xddda('0x2e')][_0xddda('0x3d')]?_0x4df06a['attributes']:_0x4ff539[_0xddda('0x29')];if(_0x1f0126[_0xddda('0x2b')][_0xddda('0x3e')]){_0x4df06a[_0xddda('0x38')]=[{'all':!![]}];}_0x4df06a=_[_0xddda('0x35')]({},_0x4df06a,_0x1f0126[_0xddda('0x3f')]);return db[_0xddda('0x25')][_0xddda('0x40')](_0x4df06a)['then'](handleEntityNotFound(_0x5cc1a6,null))[_0xddda('0x20')](respondWithResult(_0x5cc1a6,null))[_0xddda('0x3a')](handleError(_0x5cc1a6,null));};exports[_0xddda('0x41')]=function(_0x174d4e,_0x5e24fb){return db['JscriptyQuestionReport'][_0xddda('0x41')](_0x174d4e[_0xddda('0x42')],{})[_0xddda('0x20')](respondWithResult(_0x5e24fb,0xc9))[_0xddda('0x3a')](handleError(_0x5e24fb,null));};exports[_0xddda('0x1f')]=function(_0x6447ae,_0x2e1b58){if(_0x6447ae[_0xddda('0x42')]['id']){delete _0x6447ae[_0xddda('0x42')]['id'];}return db[_0xddda('0x25')][_0xddda('0x40')]({'where':{'id':_0x6447ae['params']['id']}})[_0xddda('0x20')](handleEntityNotFound(_0x2e1b58,null))[_0xddda('0x20')](saveUpdates(_0x6447ae[_0xddda('0x42')],null))['then'](respondWithResult(_0x2e1b58,null))['catch'](handleError(_0x2e1b58,null));};exports['destroy']=function(_0x3f2644,_0x36fb4a){return db[_0xddda('0x25')][_0xddda('0x40')]({'where':{'id':_0x3f2644[_0xddda('0x3b')]['id']}})[_0xddda('0x20')](handleEntityNotFound(_0x36fb4a,null))['then'](removeEntity(_0x36fb4a,null))[_0xddda('0x3a')](handleError(_0x36fb4a,null));};exports['describe']=function(_0x2bd33d,_0x25c427){return db[_0xddda('0x25')][_0xddda('0x43')]()[_0xddda('0x20')](respondWithResult(_0x25c427,null))[_0xddda('0x3a')](handleError(_0x25c427,null));}; \ No newline at end of file +var _0x9895=['count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x2b1e9d,_0x27d9c6){var _0x512473=function(_0x332872){while(--_0x332872){_0x2b1e9d['push'](_0x2b1e9d['shift']());}};_0x512473(++_0x27d9c6);}(_0x9895,0x113));var _0x5989=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9895[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x5989('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5989('0x1'));var jsonpatch=require(_0x5989('0x2'));var rp=require(_0x5989('0x3'));var moment=require(_0x5989('0x4'));var BPromise=require(_0x5989('0x5'));var Mustache=require('mustache');var util=require(_0x5989('0x6'));var path=require(_0x5989('0x7'));var sox=require(_0x5989('0x8'));var csv=require(_0x5989('0x9'));var ejs=require(_0x5989('0xa'));var fs=require('fs');var fs_extra=require(_0x5989('0xb'));var _=require('lodash');var squel=require(_0x5989('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5989('0xd'));var toCsv=require(_0x5989('0x9'));var querystring=require(_0x5989('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5989('0xf'));var qs=require(_0x5989('0x10'));var as=require(_0x5989('0x11'));var hardwareService=require(_0x5989('0x12'));var logger=require('../../config/logger')(_0x5989('0x13'));var utils=require(_0x5989('0x14'));var config=require(_0x5989('0x15'));var licenseUtil=require(_0x5989('0x16'));var db=require(_0x5989('0x17'))['db'];function respondWithStatusCode(_0x568c76,_0x132e0c){_0x132e0c=_0x132e0c||0xcc;return function(_0x139e14){if(_0x139e14){return _0x568c76['sendStatus'](_0x132e0c);}return _0x568c76[_0x5989('0x18')](_0x132e0c)[_0x5989('0x19')]();};}function respondWithResult(_0x454c82,_0x1b89ee){_0x1b89ee=_0x1b89ee||0xc8;return function(_0x53e311){if(_0x53e311){return _0x454c82[_0x5989('0x18')](_0x1b89ee)[_0x5989('0x1a')](_0x53e311);}};}function respondWithFilteredResult(_0x31542c,_0x10da02){return function(_0x2cbb02){if(_0x2cbb02){var _0x3d4b18=typeof _0x10da02[_0x5989('0x1b')]===_0x5989('0x1c')&&typeof _0x10da02['limit']==='undefined';var _0x1f597e=_0x2cbb02[_0x5989('0x1d')];var _0x2042c7=_0x3d4b18?0x0:_0x10da02[_0x5989('0x1b')];var _0x373b50=_0x3d4b18?_0x2cbb02[_0x5989('0x1d')]:_0x10da02['offset']+_0x10da02['limit'];var _0x3d9a9c;if(_0x373b50>=_0x1f597e){_0x373b50=_0x1f597e;_0x3d9a9c=0xc8;}else{_0x3d9a9c=0xce;}_0x31542c['status'](_0x3d9a9c);return _0x31542c[_0x5989('0x1e')](_0x5989('0x1f'),_0x2042c7+'-'+_0x373b50+'/'+_0x1f597e)[_0x5989('0x1a')](_0x2cbb02);}return null;};}function patchUpdates(_0x6360e0){return function(_0x2b4669){try{jsonpatch['apply'](_0x2b4669,_0x6360e0,!![]);}catch(_0x173a65){return BPromise[_0x5989('0x20')](_0x173a65);}return _0x2b4669[_0x5989('0x21')]();};}function saveUpdates(_0x5630df,_0xf793f7){return function(_0x41f498){if(_0x41f498){return _0x41f498[_0x5989('0x22')](_0x5630df)[_0x5989('0x23')](function(_0x4d354b){return _0x4d354b;});}return null;};}function removeEntity(_0x24649c,_0x3eda1f){return function(_0x138997){if(_0x138997){return _0x138997[_0x5989('0x24')]()['then'](function(){_0x24649c[_0x5989('0x18')](0xcc)[_0x5989('0x19')]();});}};}function handleEntityNotFound(_0x280484,_0x3757d1){return function(_0x3e1707){if(!_0x3e1707){_0x280484[_0x5989('0x25')](0x194);}return _0x3e1707;};}function handleError(_0x35ef80,_0x474098){_0x474098=_0x474098||0x1f4;return function(_0x403b6c){logger[_0x5989('0x26')](_0x403b6c[_0x5989('0x27')]);if(_0x403b6c['name']){delete _0x403b6c[_0x5989('0x28')];}_0x35ef80[_0x5989('0x18')](_0x474098)[_0x5989('0x29')](_0x403b6c);};}exports[_0x5989('0x2a')]=function(_0x3c695a,_0x567af7){var _0x3d4603={},_0xbed24c={},_0x5b941a={'count':0x0,'rows':[]};var _0x2cc8db=_[_0x5989('0x2b')](db['JscriptyQuestionReport'][_0x5989('0x2c')],function(_0x130336){return{'name':_0x130336[_0x5989('0x2d')],'type':_0x130336['type'][_0x5989('0x2e')]};});_0xbed24c['model']=_[_0x5989('0x2b')](_0x2cc8db,_0x5989('0x28'));_0xbed24c[_0x5989('0x2f')]=_[_0x5989('0x30')](_0x3c695a[_0x5989('0x2f')]);_0xbed24c['filters']=_['intersection'](_0xbed24c[_0x5989('0x31')],_0xbed24c[_0x5989('0x2f')]);_0x3d4603[_0x5989('0x32')]=_[_0x5989('0x33')](_0xbed24c[_0x5989('0x31')],qs[_0x5989('0x34')](_0x3c695a[_0x5989('0x2f')][_0x5989('0x34')]));_0x3d4603[_0x5989('0x32')]=_0x3d4603[_0x5989('0x32')][_0x5989('0x35')]?_0x3d4603[_0x5989('0x32')]:_0xbed24c[_0x5989('0x31')];if(!_0x3c695a['query'][_0x5989('0x36')]('nolimit')){_0x3d4603['limit']=qs[_0x5989('0x37')](_0x3c695a[_0x5989('0x2f')][_0x5989('0x37')]);_0x3d4603[_0x5989('0x1b')]=qs[_0x5989('0x1b')](_0x3c695a[_0x5989('0x2f')][_0x5989('0x1b')]);}_0x3d4603[_0x5989('0x38')]=qs['sort'](_0x3c695a[_0x5989('0x2f')][_0x5989('0x39')]);_0x3d4603['where']=qs[_0x5989('0x3a')](_[_0x5989('0x3b')](_0x3c695a[_0x5989('0x2f')],_0xbed24c['filters']),_0x2cc8db);if(_0x3c695a[_0x5989('0x2f')][_0x5989('0x3c')]){_0x3d4603[_0x5989('0x3d')]=_['merge'](_0x3d4603[_0x5989('0x3d')],{'$or':_[_0x5989('0x2b')](_0x2cc8db,function(_0x2f5de1){if(_0x2f5de1['type']!=='VIRTUAL'){var _0x4b233c={};_0x4b233c[_0x2f5de1['name']]={'$like':'%'+_0x3c695a[_0x5989('0x2f')][_0x5989('0x3c')]+'%'};return _0x4b233c;}})});}_0x3d4603=_[_0x5989('0x3e')]({},_0x3d4603,_0x3c695a[_0x5989('0x3f')]);var _0x6dafa4={'where':_0x3d4603[_0x5989('0x3d')]};return db[_0x5989('0x40')][_0x5989('0x1d')](_0x6dafa4)[_0x5989('0x23')](function(_0x29a37e){_0x5b941a[_0x5989('0x1d')]=_0x29a37e;if(_0x3c695a[_0x5989('0x2f')][_0x5989('0x41')]){_0x3d4603[_0x5989('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5989('0x43')](_0x3d4603);})[_0x5989('0x23')](function(_0xecbe76){_0x5b941a[_0x5989('0x44')]=_0xecbe76;return _0x5b941a;})[_0x5989('0x23')](respondWithFilteredResult(_0x567af7,_0x3d4603))[_0x5989('0x45')](handleError(_0x567af7,null));};exports[_0x5989('0x46')]=function(_0x3bfc8c,_0x30d856){var _0xdecb5={'raw':!![],'where':{'id':_0x3bfc8c[_0x5989('0x47')]['id']}},_0x270d5c={};_0x270d5c['model']=_[_0x5989('0x30')](db['JscriptyQuestionReport'][_0x5989('0x2c')]);_0x270d5c[_0x5989('0x2f')]=_[_0x5989('0x30')](_0x3bfc8c['query']);_0x270d5c[_0x5989('0x3a')]=_['intersection'](_0x270d5c['model'],_0x270d5c[_0x5989('0x2f')]);_0xdecb5['attributes']=_[_0x5989('0x33')](_0x270d5c[_0x5989('0x31')],qs['fields'](_0x3bfc8c['query'][_0x5989('0x34')]));_0xdecb5[_0x5989('0x32')]=_0xdecb5[_0x5989('0x32')][_0x5989('0x35')]?_0xdecb5[_0x5989('0x32')]:_0x270d5c[_0x5989('0x31')];if(_0x3bfc8c[_0x5989('0x2f')][_0x5989('0x41')]){_0xdecb5[_0x5989('0x42')]=[{'all':!![]}];}_0xdecb5=_[_0x5989('0x3e')]({},_0xdecb5,_0x3bfc8c[_0x5989('0x3f')]);return db[_0x5989('0x40')][_0x5989('0x48')](_0xdecb5)[_0x5989('0x23')](handleEntityNotFound(_0x30d856,null))[_0x5989('0x23')](respondWithResult(_0x30d856,null))[_0x5989('0x45')](handleError(_0x30d856,null));};exports[_0x5989('0x49')]=function(_0x132032,_0x149b3e){return db[_0x5989('0x40')][_0x5989('0x49')](_0x132032[_0x5989('0x4a')],{})['then'](respondWithResult(_0x149b3e,0xc9))[_0x5989('0x45')](handleError(_0x149b3e,null));};exports[_0x5989('0x22')]=function(_0x2ad8d8,_0x32ae66){if(_0x2ad8d8['body']['id']){delete _0x2ad8d8[_0x5989('0x4a')]['id'];}return db[_0x5989('0x40')][_0x5989('0x48')]({'where':{'id':_0x2ad8d8[_0x5989('0x47')]['id']}})['then'](handleEntityNotFound(_0x32ae66,null))['then'](saveUpdates(_0x2ad8d8[_0x5989('0x4a')],null))[_0x5989('0x23')](respondWithResult(_0x32ae66,null))[_0x5989('0x45')](handleError(_0x32ae66,null));};exports[_0x5989('0x24')]=function(_0x2a5ffd,_0x1a5215){return db[_0x5989('0x40')][_0x5989('0x48')]({'where':{'id':_0x2a5ffd[_0x5989('0x47')]['id']}})[_0x5989('0x23')](handleEntityNotFound(_0x1a5215,null))[_0x5989('0x23')](removeEntity(_0x1a5215,null))['catch'](handleError(_0x1a5215,null));};exports[_0x5989('0x4b')]=function(_0x3e8769,_0x343cb4){return db['JscriptyQuestionReport'][_0x5989('0x4b')]()[_0x5989('0x23')](respondWithResult(_0x343cb4,null))[_0x5989('0x45')](handleError(_0x343cb4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 27d5f94..ca041a3 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 _0xacdf=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','moment','bluebird','path','../../config/environment'];(function(_0x43ffba,_0x3d2fd9){var _0x3ed16d=function(_0x374376){while(--_0x374376){_0x43ffba['push'](_0x43ffba['shift']());}};_0x3ed16d(++_0x3d2fd9);}(_0xacdf,0x199));var _0xfacd=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xacdf[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var util=require(_0xfacd('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xfacd('0x1'));var BPromise=require(_0xfacd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfacd('0x3'));var rimraf=require('rimraf');var config=require(_0xfacd('0x4'));var attributes=require(_0xfacd('0x5'));module[_0xfacd('0x6')]=function(_0x5ba2aa,_0x1cb349){return _0x5ba2aa[_0xfacd('0x7')](_0xfacd('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd917=['rimraf','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','bluebird','request-promise'];(function(_0x3c049c,_0xc6a23c){var _0x1c85f7=function(_0x37d604){while(--_0x37d604){_0x3c049c['push'](_0x3c049c['shift']());}};_0x1c85f7(++_0xc6a23c);}(_0xd917,0x68));var _0x7d91=function(_0x3d3f14,_0x4fedf9){_0x3d3f14=_0x3d3f14-0x0;var _0x2e66e5=_0xd917[_0x3d3f14];return _0x2e66e5;};'use strict';var _=require(_0x7d91('0x0'));var util=require(_0x7d91('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7d91('0x2'));var rp=require(_0x7d91('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d91('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d91('0x5'));module['exports']=function(_0x3daf19,_0xf30140){return _0x3daf19[_0x7d91('0x6')](_0x7d91('0x7'),attributes,{'tableName':_0x7d91('0x8'),'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 010c19a..05f1202 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 _0x4d43=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x540913,_0x2d9042){var _0x29e344=function(_0x52bcd1){while(--_0x52bcd1){_0x540913['push'](_0x540913['shift']());}};_0x29e344(++_0x2d9042);}(_0x4d43,0x183));var _0x34d4=function(_0x166120,_0x1cb5d1){_0x166120=_0x166120-0x0;var _0x4dffd2=_0x4d43[_0x166120];return _0x4dffd2;};'use strict';var _=require(_0x34d4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x34d4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34d4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x34d4('0x3'));var logger=require(_0x34d4('0x4'))(_0x34d4('0x5'));var config=require(_0x34d4('0x6'));var jayson=require(_0x34d4('0x7'));var client=jayson[_0x34d4('0x8')][_0x34d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49c42e,_0x7d0e89,_0xcb5ea6){return new BPromise(function(_0x3d50ae,_0x25ea01){return client['request'](_0x49c42e,_0xcb5ea6)['then'](function(_0x24539c){logger[_0x34d4('0xa')](_0x34d4('0xb'),_0x7d0e89,_0x34d4('0xc'));logger['debug'](_0x34d4('0xd'),_0x7d0e89,_0x34d4('0xc'),JSON[_0x34d4('0xe')](_0x24539c));if(_0x24539c[_0x34d4('0xf')]){if(_0x24539c[_0x34d4('0xf')][_0x34d4('0x10')]===0x1f4){logger['error'](_0x34d4('0xb'),_0x7d0e89,_0x24539c['error'][_0x34d4('0x11')]);return _0x25ea01(_0x24539c[_0x34d4('0xf')][_0x34d4('0x11')]);}logger[_0x34d4('0xf')](_0x34d4('0xb'),_0x7d0e89,_0x24539c[_0x34d4('0xf')][_0x34d4('0x11')]);return _0x3d50ae(_0x24539c[_0x34d4('0xf')][_0x34d4('0x11')]);}else{logger['info'](_0x34d4('0xb'),_0x7d0e89,_0x34d4('0xc'));_0x3d50ae(_0x24539c[_0x34d4('0x12')][_0x34d4('0x11')]);}})[_0x34d4('0x13')](function(_0x3d5d12){logger[_0x34d4('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x7d0e89,_0x3d5d12);_0x25ea01(_0x3d5d12);});});} \ No newline at end of file +var _0x28e4=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x34e5f1,_0x2007a3){var _0x1588f8=function(_0x217b9a){while(--_0x217b9a){_0x34e5f1['push'](_0x34e5f1['shift']());}};_0x1588f8(++_0x2007a3);}(_0x28e4,0xc7));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x428e('0x0'));var util=require('util');var moment=require(_0x428e('0x1'));var BPromise=require(_0x428e('0x2'));var rs=require(_0x428e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x428e('0x4'))['db'];var utils=require(_0x428e('0x5'));var logger=require(_0x428e('0x6'))(_0x428e('0x7'));var config=require(_0x428e('0x8'));var jayson=require(_0x428e('0x9'));var client=jayson[_0x428e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aea6a,_0x2daeb5,_0x229bd9){return new BPromise(function(_0x58d0cc,_0x21c271){return client[_0x428e('0xb')](_0x2aea6a,_0x229bd9)[_0x428e('0xc')](function(_0x15fb60){logger['info'](_0x428e('0xd'),_0x2daeb5,_0x428e('0xe'));logger[_0x428e('0xf')](_0x428e('0x10'),_0x2daeb5,'request\x20sent',JSON['stringify'](_0x15fb60));if(_0x15fb60[_0x428e('0x11')]){if(_0x15fb60[_0x428e('0x11')][_0x428e('0x12')]===0x1f4){logger[_0x428e('0x11')](_0x428e('0xd'),_0x2daeb5,_0x15fb60[_0x428e('0x11')]['message']);return _0x21c271(_0x15fb60['error'][_0x428e('0x13')]);}logger[_0x428e('0x11')](_0x428e('0xd'),_0x2daeb5,_0x15fb60[_0x428e('0x11')]['message']);return _0x58d0cc(_0x15fb60['error'][_0x428e('0x13')]);}else{logger['info'](_0x428e('0xd'),_0x2daeb5,_0x428e('0xe'));_0x58d0cc(_0x15fb60[_0x428e('0x14')][_0x428e('0x13')]);}})[_0x428e('0x15')](function(_0x1a526d){logger[_0x428e('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2daeb5,_0x1a526d);_0x21c271(_0x1a526d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a688647..1326f09 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 _0x6ec1=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','/:id','isAuthenticated','show','/:id/questions','post','create','put','update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x6ec1,0x9a));var _0x16ec=function(_0x5be0ab,_0x279c70){_0x5be0ab=_0x5be0ab-0x0;var _0xdf3e38=_0x6ec1[_0x5be0ab];return _0xdf3e38;};'use strict';var multer=require(_0x16ec('0x0'));var util=require('util');var path=require(_0x16ec('0x1'));var timeout=require(_0x16ec('0x2'));var express=require(_0x16ec('0x3'));var router=express['Router']();var fs_extra=require(_0x16ec('0x4'));var auth=require(_0x16ec('0x5'));var interaction=require(_0x16ec('0x6'));var config=require(_0x16ec('0x7'));var controller=require(_0x16ec('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x16ec('0x9')](_0x16ec('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x16ec('0x9')](_0x16ec('0xb'),auth[_0x16ec('0xc')](),controller[_0x16ec('0xd')]);router[_0x16ec('0x9')](_0x16ec('0xe'),auth[_0x16ec('0xc')](),controller['getQuestions']);router[_0x16ec('0xf')]('/',auth[_0x16ec('0xc')](),controller[_0x16ec('0x10')]);router[_0x16ec('0x11')]('/:id',auth[_0x16ec('0xc')](),controller[_0x16ec('0x12')]);router['delete'](_0x16ec('0xb'),auth[_0x16ec('0xc')](),controller[_0x16ec('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa75a=['create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/:id','show','/:id/questions','getQuestions','post'];(function(_0x558ac9,_0x2cbe01){var _0x30f7c7=function(_0x245572){while(--_0x245572){_0x558ac9['push'](_0x558ac9['shift']());}};_0x30f7c7(++_0x2cbe01);}(_0xa75a,0xc2));var _0xaa75=function(_0x5a2a22,_0x1f3dc8){_0x5a2a22=_0x5a2a22-0x0;var _0xf9f942=_0xa75a[_0x5a2a22];return _0xf9f942;};'use strict';var multer=require(_0xaa75('0x0'));var util=require(_0xaa75('0x1'));var path=require(_0xaa75('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa75('0x3'));var router=express[_0xaa75('0x4')]();var fs_extra=require(_0xaa75('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaa75('0x6'));var config=require(_0xaa75('0x7'));var controller=require(_0xaa75('0x8'));router[_0xaa75('0x9')]('/',auth[_0xaa75('0xa')](),controller['index']);router['get']('/describe',auth[_0xaa75('0xa')](),controller['describe']);router[_0xaa75('0x9')](_0xaa75('0xb'),auth[_0xaa75('0xa')](),controller[_0xaa75('0xc')]);router[_0xaa75('0x9')](_0xaa75('0xd'),auth[_0xaa75('0xa')](),controller[_0xaa75('0xe')]);router[_0xaa75('0xf')]('/',auth[_0xaa75('0xa')](),controller[_0xaa75('0x10')]);router[_0xaa75('0x11')](_0xaa75('0xb'),auth['isAuthenticated'](),controller[_0xaa75('0x12')]);router[_0xaa75('0x13')](_0xaa75('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa75('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9d4a35b..6ac2272 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 _0x97db=['endtime','DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x97db,0x1b4));var _0xb97d=function(_0x2dad7e,_0x3bec65){_0x2dad7e=_0x2dad7e-0x0;var _0x156ac3=_0x97db[_0x2dad7e];return _0x156ac3;};'use strict';var moment=require(_0xb97d('0x0'));var Sequelize=require(_0xb97d('0x1'));module[_0xb97d('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5dd79c){this[_0xb97d('0x3')](_0xb97d('0x4'),_0x5dd79c);this[_0xb97d('0x3')](_0xb97d('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xb97d('0x6')]},'membername':{'type':Sequelize[_0xb97d('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb97d('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb97d('0x7')]},'completed':{'type':Sequelize[_0xb97d('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x5b4c=['STRING','BOOLEAN','moment','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0x5b4c,0x17e));var _0xc5b4=function(_0x4a37c9,_0x2f98e6){_0x4a37c9=_0x4a37c9-0x0;var _0x4f771e=_0x5b4c[_0x4a37c9];return _0x4f771e;};'use strict';var moment=require(_0xc5b4('0x0'));var Sequelize=require('sequelize');module[_0xc5b4('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x2fc425){this[_0xc5b4('0x2')](_0xc5b4('0x3'),_0x2fc425);this[_0xc5b4('0x2')](_0xc5b4('0x4'),moment()[_0xc5b4('0x5')](_0xc5b4('0x6')));}},'endtime':{'type':Sequelize[_0xc5b4('0x7')]},'membername':{'type':Sequelize[_0xc5b4('0x8')]},'projectname':{'type':Sequelize[_0xc5b4('0x8')]},'queue':{'type':Sequelize[_0xc5b4('0x8')]},'uniqueid':{'type':Sequelize[_0xc5b4('0x8')]},'calleridname':{'type':Sequelize[_0xc5b4('0x8')]},'calleridnum':{'type':Sequelize[_0xc5b4('0x8')]},'completed':{'type':Sequelize[_0xc5b4('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 3ec5595..b0ab0f9 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 _0xc5dc=['filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','update','body','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','SessionId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','then','end','error','stack','name','index','JscriptySessionReport','rawAttributes','type','key','model','query'];(function(_0x195b37,_0x4cb059){var _0x1b78b4=function(_0x88296c){while(--_0x88296c){_0x195b37['push'](_0x195b37['shift']());}};_0x1b78b4(++_0x4cb059);}(_0xc5dc,0x169));var _0xcc5d=function(_0x4025bd,_0x3379ff){_0x4025bd=_0x4025bd-0x0;var _0x5985b8=_0xc5dc[_0x4025bd];return _0x5985b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc5d('0x0'));var zipdir=require(_0xcc5d('0x1'));var jsonpatch=require(_0xcc5d('0x2'));var rp=require(_0xcc5d('0x3'));var moment=require(_0xcc5d('0x4'));var BPromise=require(_0xcc5d('0x5'));var Mustache=require(_0xcc5d('0x6'));var util=require(_0xcc5d('0x7'));var path=require(_0xcc5d('0x8'));var sox=require(_0xcc5d('0x9'));var csv=require(_0xcc5d('0xa'));var ejs=require(_0xcc5d('0xb'));var fs=require('fs');var fs_extra=require(_0xcc5d('0xc'));var _=require(_0xcc5d('0xd'));var squel=require(_0xcc5d('0xe'));var crypto=require(_0xcc5d('0xf'));var jsforce=require(_0xcc5d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc5d('0xa'));var querystring=require(_0xcc5d('0x11'));var Papa=require('papaparse');var Redis=require(_0xcc5d('0x12'));var authService=require(_0xcc5d('0x13'));var qs=require(_0xcc5d('0x14'));var as=require(_0xcc5d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc5d('0x16'))(_0xcc5d('0x17'));var utils=require(_0xcc5d('0x18'));var config=require(_0xcc5d('0x19'));var licenseUtil=require(_0xcc5d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4466b5,_0x1a8349){_0x1a8349=_0x1a8349||0xcc;return function(_0x126e87){if(_0x126e87){return _0x4466b5[_0xcc5d('0x1b')](_0x1a8349);}return _0x4466b5[_0xcc5d('0x1c')](_0x1a8349)['end']();};}function respondWithResult(_0x38d06d,_0x3a6365){_0x3a6365=_0x3a6365||0xc8;return function(_0x233a30){if(_0x233a30){return _0x38d06d[_0xcc5d('0x1c')](_0x3a6365)[_0xcc5d('0x1d')](_0x233a30);}};}function respondWithFilteredResult(_0x50cb83,_0x4f4536){return function(_0x211a1f){if(_0x211a1f){var _0x55747e=typeof _0x4f4536[_0xcc5d('0x1e')]===_0xcc5d('0x1f')&&typeof _0x4f4536['limit']===_0xcc5d('0x1f');var _0x25cbc3=_0x211a1f[_0xcc5d('0x20')];var _0x413afd=_0x55747e?0x0:_0x4f4536[_0xcc5d('0x1e')];var _0x36e640=_0x55747e?_0x211a1f[_0xcc5d('0x20')]:_0x4f4536['offset']+_0x4f4536[_0xcc5d('0x21')];var _0x4d61e8;if(_0x36e640>=_0x25cbc3){_0x36e640=_0x25cbc3;_0x4d61e8=0xc8;}else{_0x4d61e8=0xce;}_0x50cb83[_0xcc5d('0x1c')](_0x4d61e8);return _0x50cb83[_0xcc5d('0x22')]('Content-Range',_0x413afd+'-'+_0x36e640+'/'+_0x25cbc3)[_0xcc5d('0x1d')](_0x211a1f);}return null;};}function patchUpdates(_0x4e467d){return function(_0x55780f){try{jsonpatch['apply'](_0x55780f,_0x4e467d,!![]);}catch(_0x215358){return BPromise[_0xcc5d('0x23')](_0x215358);}return _0x55780f[_0xcc5d('0x24')]();};}function saveUpdates(_0x40ec06,_0x3801c8){return function(_0x5b9f8e){if(_0x5b9f8e){return _0x5b9f8e['update'](_0x40ec06)[_0xcc5d('0x25')](function(_0x2296bf){return _0x2296bf;});}return null;};}function removeEntity(_0x222baa,_0xd7c9f9){return function(_0x43f272){if(_0x43f272){return _0x43f272['destroy']()[_0xcc5d('0x25')](function(){_0x222baa['status'](0xcc)[_0xcc5d('0x26')]();});}};}function handleEntityNotFound(_0x187687,_0x28d18b){return function(_0x11f2c5){if(!_0x11f2c5){_0x187687[_0xcc5d('0x1b')](0x194);}return _0x11f2c5;};}function handleError(_0x396d76,_0x5901a1){_0x5901a1=_0x5901a1||0x1f4;return function(_0x4fb7af){logger[_0xcc5d('0x27')](_0x4fb7af[_0xcc5d('0x28')]);if(_0x4fb7af[_0xcc5d('0x29')]){delete _0x4fb7af[_0xcc5d('0x29')];}_0x396d76[_0xcc5d('0x1c')](_0x5901a1)['send'](_0x4fb7af);};}exports[_0xcc5d('0x2a')]=function(_0x3fa985,_0x43e14a){var _0x5dbdea={},_0x290465={},_0x147c49={'count':0x0,'rows':[]};var _0x4e0221=_['map'](db[_0xcc5d('0x2b')][_0xcc5d('0x2c')],function(_0xfae64c){return{'name':_0xfae64c['fieldName'],'type':_0xfae64c[_0xcc5d('0x2d')][_0xcc5d('0x2e')]};});_0x290465[_0xcc5d('0x2f')]=_['map'](_0x4e0221,'name');_0x290465[_0xcc5d('0x30')]=_['keys'](_0x3fa985[_0xcc5d('0x30')]);_0x290465[_0xcc5d('0x31')]=_[_0xcc5d('0x32')](_0x290465['model'],_0x290465[_0xcc5d('0x30')]);_0x5dbdea[_0xcc5d('0x33')]=_[_0xcc5d('0x32')](_0x290465[_0xcc5d('0x2f')],qs[_0xcc5d('0x34')](_0x3fa985[_0xcc5d('0x30')][_0xcc5d('0x34')]));_0x5dbdea[_0xcc5d('0x33')]=_0x5dbdea['attributes']['length']?_0x5dbdea[_0xcc5d('0x33')]:_0x290465['model'];if(!_0x3fa985[_0xcc5d('0x30')][_0xcc5d('0x35')]('nolimit')){_0x5dbdea[_0xcc5d('0x21')]=qs['limit'](_0x3fa985[_0xcc5d('0x30')][_0xcc5d('0x21')]);_0x5dbdea['offset']=qs[_0xcc5d('0x1e')](_0x3fa985['query']['offset']);}_0x5dbdea[_0xcc5d('0x36')]=qs[_0xcc5d('0x37')](_0x3fa985[_0xcc5d('0x30')][_0xcc5d('0x37')]);_0x5dbdea['where']=qs[_0xcc5d('0x31')](_[_0xcc5d('0x38')](_0x3fa985[_0xcc5d('0x30')],_0x290465[_0xcc5d('0x31')]),_0x4e0221);if(_0x3fa985['query'][_0xcc5d('0x39')]){_0x5dbdea[_0xcc5d('0x3a')]=_[_0xcc5d('0x3b')](_0x5dbdea[_0xcc5d('0x3a')],{'$or':_[_0xcc5d('0x3c')](_0x4e0221,function(_0x3d2e6a){if(_0x3d2e6a[_0xcc5d('0x2d')]!==_0xcc5d('0x3d')){var _0x293717={};_0x293717[_0x3d2e6a['name']]={'$like':'%'+_0x3fa985[_0xcc5d('0x30')][_0xcc5d('0x39')]+'%'};return _0x293717;}})});}_0x5dbdea=_[_0xcc5d('0x3b')]({},_0x5dbdea,_0x3fa985[_0xcc5d('0x3e')]);var _0x4ab400={'where':_0x5dbdea[_0xcc5d('0x3a')]};return db[_0xcc5d('0x2b')][_0xcc5d('0x20')](_0x4ab400)[_0xcc5d('0x25')](function(_0x39ae42){_0x147c49[_0xcc5d('0x20')]=_0x39ae42;if(_0x3fa985[_0xcc5d('0x30')][_0xcc5d('0x3f')]){_0x5dbdea[_0xcc5d('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xcc5d('0x41')](_0x5dbdea);})[_0xcc5d('0x25')](function(_0x41da09){_0x147c49[_0xcc5d('0x42')]=_0x41da09;return _0x147c49;})[_0xcc5d('0x25')](respondWithFilteredResult(_0x43e14a,_0x5dbdea))['catch'](handleError(_0x43e14a,null));};exports[_0xcc5d('0x43')]=function(_0x1dcd52,_0x46e96c){var _0x15e731={'raw':!![],'where':{'id':_0x1dcd52[_0xcc5d('0x44')]['id']}},_0x25cedc={};_0x25cedc[_0xcc5d('0x2f')]=_['keys'](db[_0xcc5d('0x2b')][_0xcc5d('0x2c')]);_0x25cedc[_0xcc5d('0x30')]=_[_0xcc5d('0x45')](_0x1dcd52['query']);_0x25cedc[_0xcc5d('0x31')]=_[_0xcc5d('0x32')](_0x25cedc[_0xcc5d('0x2f')],_0x25cedc[_0xcc5d('0x30')]);_0x15e731[_0xcc5d('0x33')]=_[_0xcc5d('0x32')](_0x25cedc[_0xcc5d('0x2f')],qs[_0xcc5d('0x34')](_0x1dcd52[_0xcc5d('0x30')]['fields']));_0x15e731[_0xcc5d('0x33')]=_0x15e731['attributes'][_0xcc5d('0x46')]?_0x15e731[_0xcc5d('0x33')]:_0x25cedc[_0xcc5d('0x2f')];if(_0x1dcd52[_0xcc5d('0x30')][_0xcc5d('0x3f')]){_0x15e731[_0xcc5d('0x40')]=[{'all':!![]}];}_0x15e731=_[_0xcc5d('0x3b')]({},_0x15e731,_0x1dcd52[_0xcc5d('0x3e')]);return db[_0xcc5d('0x2b')][_0xcc5d('0x47')](_0x15e731)[_0xcc5d('0x25')](handleEntityNotFound(_0x46e96c,null))[_0xcc5d('0x25')](respondWithResult(_0x46e96c,null))[_0xcc5d('0x48')](handleError(_0x46e96c,null));};exports[_0xcc5d('0x49')]=function(_0x5b12c9,_0x39a15b){return db['JscriptySessionReport'][_0xcc5d('0x49')](_0x5b12c9['body'],{})[_0xcc5d('0x25')](respondWithResult(_0x39a15b,0xc9))['catch'](handleError(_0x39a15b,null));};exports[_0xcc5d('0x4a')]=function(_0x33196a,_0x12967f){if(_0x33196a[_0xcc5d('0x4b')]['id']){delete _0x33196a[_0xcc5d('0x4b')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x33196a[_0xcc5d('0x44')]['id']}})[_0xcc5d('0x25')](handleEntityNotFound(_0x12967f,null))[_0xcc5d('0x25')](saveUpdates(_0x33196a[_0xcc5d('0x4b')],null))[_0xcc5d('0x25')](respondWithResult(_0x12967f,null))['catch'](handleError(_0x12967f,null));};exports['destroy']=function(_0x18f3da,_0x40de1d){return db[_0xcc5d('0x2b')][_0xcc5d('0x47')]({'where':{'id':_0x18f3da['params']['id']}})['then'](handleEntityNotFound(_0x40de1d,null))[_0xcc5d('0x25')](removeEntity(_0x40de1d,null))[_0xcc5d('0x48')](handleError(_0x40de1d,null));};exports[_0xcc5d('0x4c')]=function(_0x3f28db,_0x11e2cf){return db[_0xcc5d('0x2b')][_0xcc5d('0x4c')]()['then'](respondWithResult(_0x11e2cf,null))['catch'](handleError(_0x11e2cf,null));};exports[_0xcc5d('0x4d')]=function(_0x4dd28f,_0x20cee8,_0x4b3bfb){var _0x529c46={'raw':!![],'where':{}};var _0x122ba5={};var _0x3419b5={'count':0x0,'rows':[]};return db[_0xcc5d('0x2b')][_0xcc5d('0x4e')]({'where':{'id':_0x4dd28f[_0xcc5d('0x44')]['id']}})[_0xcc5d('0x25')](handleEntityNotFound(_0x20cee8,null))['then'](function(_0x173402){if(_0x173402){_0x122ba5[_0xcc5d('0x2f')]=_[_0xcc5d('0x45')](db[_0xcc5d('0x4f')]['rawAttributes']);_0x122ba5['query']=_['keys'](_0x4dd28f[_0xcc5d('0x30')]);_0x122ba5[_0xcc5d('0x31')]=_['intersection'](_0x122ba5[_0xcc5d('0x2f')],_0x122ba5[_0xcc5d('0x30')]);_0x529c46[_0xcc5d('0x33')]=_[_0xcc5d('0x32')](_0x122ba5[_0xcc5d('0x2f')],qs[_0xcc5d('0x34')](_0x4dd28f[_0xcc5d('0x30')]['fields']));_0x529c46[_0xcc5d('0x33')]=_0x529c46[_0xcc5d('0x33')][_0xcc5d('0x46')]?_0x529c46[_0xcc5d('0x33')]:_0x122ba5[_0xcc5d('0x2f')];if(!_0x4dd28f[_0xcc5d('0x30')][_0xcc5d('0x35')](_0xcc5d('0x50'))){_0x529c46[_0xcc5d('0x21')]=qs[_0xcc5d('0x21')](_0x4dd28f['query']['limit']);_0x529c46[_0xcc5d('0x1e')]=qs[_0xcc5d('0x1e')](_0x4dd28f[_0xcc5d('0x30')][_0xcc5d('0x1e')]);}_0x529c46[_0xcc5d('0x36')]=qs[_0xcc5d('0x37')](_0x4dd28f[_0xcc5d('0x30')]['sort']);_0x529c46[_0xcc5d('0x3a')]=qs['filters'](_[_0xcc5d('0x38')](_0x4dd28f[_0xcc5d('0x30')],_0x122ba5[_0xcc5d('0x31')]));_0x529c46[_0xcc5d('0x3a')][_0xcc5d('0x51')]=_0x173402['id'];if(_0x4dd28f[_0xcc5d('0x30')]['filter']){_0x529c46[_0xcc5d('0x3a')]=_[_0xcc5d('0x3b')](_0x529c46[_0xcc5d('0x3a')],{'$or':_[_0xcc5d('0x3c')](_0x529c46[_0xcc5d('0x33')],function(_0x3383cd){var _0x500b1f={};_0x500b1f[_0x3383cd]={'$like':'%'+_0x4dd28f['query']['filter']+'%'};return _0x500b1f;})});}_0x529c46=_['merge']({},_0x529c46,_0x4dd28f['options']);return db[_0xcc5d('0x4f')][_0xcc5d('0x20')]({'where':_0x529c46[_0xcc5d('0x3a')]})[_0xcc5d('0x25')](function(_0x1df78d){_0x3419b5[_0xcc5d('0x20')]=_0x1df78d;if(_0x4dd28f[_0xcc5d('0x30')][_0xcc5d('0x3f')]){_0x529c46['include']=[{'all':!![]}];}return db[_0xcc5d('0x4f')][_0xcc5d('0x41')](_0x529c46);})[_0xcc5d('0x25')](function(_0x95f236){_0x3419b5[_0xcc5d('0x42')]=_0x95f236;return _0x3419b5;});}})[_0xcc5d('0x25')](respondWithFilteredResult(_0x20cee8,_0x529c46))[_0xcc5d('0x48')](handleError(_0x20cee8,null));}; \ No newline at end of file +var _0x5927=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','JscriptySessionReport','includeAll','rows','catch','show','params','include','options','find','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x1cf311,_0xa92991){var _0x1b3f71=function(_0x471e18){while(--_0x471e18){_0x1cf311['push'](_0x1cf311['shift']());}};_0x1b3f71(++_0xa92991);}(_0x5927,0x10a));var _0x7592=function(_0x31880d,_0x4f0ff3){_0x31880d=_0x31880d-0x0;var _0x423823=_0x5927[_0x31880d];return _0x423823;};'use strict';var emlformat=require(_0x7592('0x0'));var rimraf=require(_0x7592('0x1'));var zipdir=require(_0x7592('0x2'));var jsonpatch=require(_0x7592('0x3'));var rp=require(_0x7592('0x4'));var moment=require(_0x7592('0x5'));var BPromise=require(_0x7592('0x6'));var Mustache=require('mustache');var util=require(_0x7592('0x7'));var path=require('path');var sox=require(_0x7592('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7592('0x9'));var _=require(_0x7592('0xa'));var squel=require('squel');var crypto=require(_0x7592('0xb'));var jsforce=require(_0x7592('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7592('0xd'));var Papa=require(_0x7592('0xe'));var Redis=require(_0x7592('0xf'));var authService=require(_0x7592('0x10'));var qs=require(_0x7592('0x11'));var as=require(_0x7592('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7592('0x13'));var utils=require(_0x7592('0x14'));var config=require(_0x7592('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252b3e,_0x3e04ce){_0x3e04ce=_0x3e04ce||0xcc;return function(_0x47c662){if(_0x47c662){return _0x252b3e[_0x7592('0x16')](_0x3e04ce);}return _0x252b3e[_0x7592('0x17')](_0x3e04ce)[_0x7592('0x18')]();};}function respondWithResult(_0x256681,_0x12b53f){_0x12b53f=_0x12b53f||0xc8;return function(_0x2e3901){if(_0x2e3901){return _0x256681[_0x7592('0x17')](_0x12b53f)[_0x7592('0x19')](_0x2e3901);}};}function respondWithFilteredResult(_0x3f3cb9,_0x1a419e){return function(_0x3157c7){if(_0x3157c7){var _0x361ac9=typeof _0x1a419e[_0x7592('0x1a')]==='undefined'&&typeof _0x1a419e[_0x7592('0x1b')]===_0x7592('0x1c');var _0x13e16f=_0x3157c7['count'];var _0x4261ed=_0x361ac9?0x0:_0x1a419e[_0x7592('0x1a')];var _0x35c02b=_0x361ac9?_0x3157c7[_0x7592('0x1d')]:_0x1a419e[_0x7592('0x1a')]+_0x1a419e[_0x7592('0x1b')];var _0x2e62ff;if(_0x35c02b>=_0x13e16f){_0x35c02b=_0x13e16f;_0x2e62ff=0xc8;}else{_0x2e62ff=0xce;}_0x3f3cb9['status'](_0x2e62ff);return _0x3f3cb9['set'](_0x7592('0x1e'),_0x4261ed+'-'+_0x35c02b+'/'+_0x13e16f)[_0x7592('0x19')](_0x3157c7);}return null;};}function patchUpdates(_0x2ec8e3){return function(_0x58ca66){try{jsonpatch[_0x7592('0x1f')](_0x58ca66,_0x2ec8e3,!![]);}catch(_0x1c2c1c){return BPromise[_0x7592('0x20')](_0x1c2c1c);}return _0x58ca66[_0x7592('0x21')]();};}function saveUpdates(_0x5858d0,_0x2f9e60){return function(_0x409f90){if(_0x409f90){return _0x409f90[_0x7592('0x22')](_0x5858d0)[_0x7592('0x23')](function(_0x3ae150){return _0x3ae150;});}return null;};}function removeEntity(_0x12607c,_0x442368){return function(_0x4b26a4){if(_0x4b26a4){return _0x4b26a4[_0x7592('0x24')]()['then'](function(){_0x12607c[_0x7592('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dc08d,_0x145492){return function(_0x515f91){if(!_0x515f91){_0x3dc08d['sendStatus'](0x194);}return _0x515f91;};}function handleError(_0x5c5504,_0x3b3500){_0x3b3500=_0x3b3500||0x1f4;return function(_0x51d1f7){logger[_0x7592('0x25')](_0x51d1f7[_0x7592('0x26')]);if(_0x51d1f7[_0x7592('0x27')]){delete _0x51d1f7['name'];}_0x5c5504[_0x7592('0x17')](_0x3b3500)[_0x7592('0x28')](_0x51d1f7);};}exports[_0x7592('0x29')]=function(_0x487624,_0x574ec8){var _0x1da51d={},_0x2d6dec={},_0x58a867={'count':0x0,'rows':[]};var _0x3fcd1a=_[_0x7592('0x2a')](db['JscriptySessionReport'][_0x7592('0x2b')],function(_0x105f60){return{'name':_0x105f60[_0x7592('0x2c')],'type':_0x105f60['type'][_0x7592('0x2d')]};});_0x2d6dec[_0x7592('0x2e')]=_[_0x7592('0x2a')](_0x3fcd1a,_0x7592('0x27'));_0x2d6dec[_0x7592('0x2f')]=_[_0x7592('0x30')](_0x487624['query']);_0x2d6dec[_0x7592('0x31')]=_[_0x7592('0x32')](_0x2d6dec[_0x7592('0x2e')],_0x2d6dec[_0x7592('0x2f')]);_0x1da51d[_0x7592('0x33')]=_['intersection'](_0x2d6dec[_0x7592('0x2e')],qs[_0x7592('0x34')](_0x487624[_0x7592('0x2f')][_0x7592('0x34')]));_0x1da51d[_0x7592('0x33')]=_0x1da51d['attributes'][_0x7592('0x35')]?_0x1da51d['attributes']:_0x2d6dec['model'];if(!_0x487624[_0x7592('0x2f')][_0x7592('0x36')](_0x7592('0x37'))){_0x1da51d['limit']=qs[_0x7592('0x1b')](_0x487624[_0x7592('0x2f')][_0x7592('0x1b')]);_0x1da51d[_0x7592('0x1a')]=qs[_0x7592('0x1a')](_0x487624['query']['offset']);}_0x1da51d[_0x7592('0x38')]=qs[_0x7592('0x39')](_0x487624['query']['sort']);_0x1da51d['where']=qs[_0x7592('0x31')](_['pick'](_0x487624[_0x7592('0x2f')],_0x2d6dec['filters']),_0x3fcd1a);if(_0x487624[_0x7592('0x2f')][_0x7592('0x3a')]){_0x1da51d['where']=_[_0x7592('0x3b')](_0x1da51d[_0x7592('0x3c')],{'$or':_[_0x7592('0x2a')](_0x3fcd1a,function(_0x53e074){if(_0x53e074[_0x7592('0x3d')]!==_0x7592('0x3e')){var _0x560499={};_0x560499[_0x53e074[_0x7592('0x27')]]={'$like':'%'+_0x487624[_0x7592('0x2f')][_0x7592('0x3a')]+'%'};return _0x560499;}})});}_0x1da51d=_[_0x7592('0x3b')]({},_0x1da51d,_0x487624['options']);var _0x5cc57b={'where':_0x1da51d[_0x7592('0x3c')]};return db[_0x7592('0x3f')][_0x7592('0x1d')](_0x5cc57b)[_0x7592('0x23')](function(_0x575790){_0x58a867[_0x7592('0x1d')]=_0x575790;if(_0x487624[_0x7592('0x2f')][_0x7592('0x40')]){_0x1da51d['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1da51d);})['then'](function(_0x4571ca){_0x58a867[_0x7592('0x41')]=_0x4571ca;return _0x58a867;})['then'](respondWithFilteredResult(_0x574ec8,_0x1da51d))[_0x7592('0x42')](handleError(_0x574ec8,null));};exports[_0x7592('0x43')]=function(_0x1066cd,_0x82f2d8){var _0x19d2d6={'raw':!![],'where':{'id':_0x1066cd[_0x7592('0x44')]['id']}},_0x5f1e25={};_0x5f1e25[_0x7592('0x2e')]=_[_0x7592('0x30')](db[_0x7592('0x3f')]['rawAttributes']);_0x5f1e25[_0x7592('0x2f')]=_['keys'](_0x1066cd[_0x7592('0x2f')]);_0x5f1e25['filters']=_[_0x7592('0x32')](_0x5f1e25[_0x7592('0x2e')],_0x5f1e25[_0x7592('0x2f')]);_0x19d2d6[_0x7592('0x33')]=_['intersection'](_0x5f1e25[_0x7592('0x2e')],qs[_0x7592('0x34')](_0x1066cd['query'][_0x7592('0x34')]));_0x19d2d6[_0x7592('0x33')]=_0x19d2d6['attributes'][_0x7592('0x35')]?_0x19d2d6['attributes']:_0x5f1e25['model'];if(_0x1066cd[_0x7592('0x2f')][_0x7592('0x40')]){_0x19d2d6[_0x7592('0x45')]=[{'all':!![]}];}_0x19d2d6=_['merge']({},_0x19d2d6,_0x1066cd[_0x7592('0x46')]);return db[_0x7592('0x3f')][_0x7592('0x47')](_0x19d2d6)[_0x7592('0x23')](handleEntityNotFound(_0x82f2d8,null))[_0x7592('0x23')](respondWithResult(_0x82f2d8,null))['catch'](handleError(_0x82f2d8,null));};exports[_0x7592('0x48')]=function(_0x40ce65,_0x348990){return db[_0x7592('0x3f')][_0x7592('0x48')](_0x40ce65[_0x7592('0x49')],{})[_0x7592('0x23')](respondWithResult(_0x348990,0xc9))[_0x7592('0x42')](handleError(_0x348990,null));};exports[_0x7592('0x22')]=function(_0xc34ad5,_0x4d6b85){if(_0xc34ad5[_0x7592('0x49')]['id']){delete _0xc34ad5[_0x7592('0x49')]['id'];}return db[_0x7592('0x3f')][_0x7592('0x47')]({'where':{'id':_0xc34ad5[_0x7592('0x44')]['id']}})[_0x7592('0x23')](handleEntityNotFound(_0x4d6b85,null))[_0x7592('0x23')](saveUpdates(_0xc34ad5[_0x7592('0x49')],null))[_0x7592('0x23')](respondWithResult(_0x4d6b85,null))[_0x7592('0x42')](handleError(_0x4d6b85,null));};exports[_0x7592('0x24')]=function(_0x5dbdde,_0x35fd92){return db[_0x7592('0x3f')][_0x7592('0x47')]({'where':{'id':_0x5dbdde[_0x7592('0x44')]['id']}})[_0x7592('0x23')](handleEntityNotFound(_0x35fd92,null))[_0x7592('0x23')](removeEntity(_0x35fd92,null))[_0x7592('0x42')](handleError(_0x35fd92,null));};exports[_0x7592('0x4a')]=function(_0x1ff057,_0x9f31e4){return db[_0x7592('0x3f')][_0x7592('0x4a')]()[_0x7592('0x23')](respondWithResult(_0x9f31e4,null))['catch'](handleError(_0x9f31e4,null));};exports[_0x7592('0x4b')]=function(_0x655fd3,_0x2d0fbf,_0x43f8ea){var _0x30bde1={'raw':!![],'where':{}};var _0x1c1a06={};var _0xe34c4c={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x655fd3[_0x7592('0x44')]['id']}})['then'](handleEntityNotFound(_0x2d0fbf,null))[_0x7592('0x23')](function(_0x233157){if(_0x233157){_0x1c1a06[_0x7592('0x2e')]=_['keys'](db[_0x7592('0x4c')]['rawAttributes']);_0x1c1a06[_0x7592('0x2f')]=_['keys'](_0x655fd3[_0x7592('0x2f')]);_0x1c1a06[_0x7592('0x31')]=_[_0x7592('0x32')](_0x1c1a06[_0x7592('0x2e')],_0x1c1a06['query']);_0x30bde1['attributes']=_['intersection'](_0x1c1a06[_0x7592('0x2e')],qs['fields'](_0x655fd3[_0x7592('0x2f')][_0x7592('0x34')]));_0x30bde1[_0x7592('0x33')]=_0x30bde1['attributes'][_0x7592('0x35')]?_0x30bde1[_0x7592('0x33')]:_0x1c1a06[_0x7592('0x2e')];if(!_0x655fd3[_0x7592('0x2f')][_0x7592('0x36')](_0x7592('0x37'))){_0x30bde1[_0x7592('0x1b')]=qs['limit'](_0x655fd3[_0x7592('0x2f')][_0x7592('0x1b')]);_0x30bde1[_0x7592('0x1a')]=qs[_0x7592('0x1a')](_0x655fd3[_0x7592('0x2f')]['offset']);}_0x30bde1['order']=qs['sort'](_0x655fd3[_0x7592('0x2f')][_0x7592('0x39')]);_0x30bde1[_0x7592('0x3c')]=qs[_0x7592('0x31')](_['pick'](_0x655fd3[_0x7592('0x2f')],_0x1c1a06[_0x7592('0x31')]));_0x30bde1[_0x7592('0x3c')][_0x7592('0x4d')]=_0x233157['id'];if(_0x655fd3[_0x7592('0x2f')][_0x7592('0x3a')]){_0x30bde1[_0x7592('0x3c')]=_[_0x7592('0x3b')](_0x30bde1[_0x7592('0x3c')],{'$or':_[_0x7592('0x2a')](_0x30bde1['attributes'],function(_0x26ccb3){var _0x725ffa={};_0x725ffa[_0x26ccb3]={'$like':'%'+_0x655fd3[_0x7592('0x2f')][_0x7592('0x3a')]+'%'};return _0x725ffa;})});}_0x30bde1=_[_0x7592('0x3b')]({},_0x30bde1,_0x655fd3[_0x7592('0x46')]);return db[_0x7592('0x4c')]['count']({'where':_0x30bde1[_0x7592('0x3c')]})[_0x7592('0x23')](function(_0x3cf71f){_0xe34c4c[_0x7592('0x1d')]=_0x3cf71f;if(_0x655fd3[_0x7592('0x2f')]['includeAll']){_0x30bde1[_0x7592('0x45')]=[{'all':!![]}];}return db[_0x7592('0x4c')][_0x7592('0x4e')](_0x30bde1);})[_0x7592('0x23')](function(_0x236302){_0xe34c4c[_0x7592('0x41')]=_0x236302;return _0xe34c4c;});}})[_0x7592('0x23')](respondWithFilteredResult(_0x2d0fbf,_0x30bde1))[_0x7592('0x42')](handleError(_0x2d0fbf,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 214e374..52d361f 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 _0x7bd0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x2db2a4,_0x5dd457){var _0x4d8573=function(_0x33775c){while(--_0x33775c){_0x2db2a4['push'](_0x2db2a4['shift']());}};_0x4d8573(++_0x5dd457);}(_0x7bd0,0x111));var _0x07bd=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0x7bd0[_0x40aaa4];return _0x4e21e5;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var logger=require(_0x07bd('0x2'))(_0x07bd('0x3'));var moment=require(_0x07bd('0x4'));var BPromise=require(_0x07bd('0x5'));var rp=require(_0x07bd('0x6'));var fs=require('fs');var path=require(_0x07bd('0x7'));var rimraf=require('rimraf');var config=require(_0x07bd('0x8'));var attributes=require(_0x07bd('0x9'));module[_0x07bd('0xa')]=function(_0x313548,_0x3e8349){return _0x313548[_0x07bd('0xb')](_0x07bd('0xc'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x46ed,0x168));var _0xd46e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x46ed[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'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 33e52b7..5c97943 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 _0x9f0e=['../../config/environment','jayson/promise','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x186940,_0x289e25){var _0x20f150=function(_0x2315de){while(--_0x2315de){_0x186940['push'](_0x186940['shift']());}};_0x20f150(++_0x289e25);}(_0x9f0e,0x116));var _0xe9f0=function(_0x57fac0,_0x3481ea){_0x57fac0=_0x57fac0-0x0;var _0x10b064=_0x9f0e[_0x57fac0];return _0x10b064;};'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')]('JscriptySessionReport,\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);});});} \ No newline at end of file +var _0x8e3f=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x493150,_0x107958){var _0x3fe8da=function(_0xce7a75){while(--_0xce7a75){_0x493150['push'](_0x493150['shift']());}};_0x3fe8da(++_0x107958);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f0c057f..092a59a 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 _0xfdb3=['index','/:id','isAuthenticated','update','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get'];(function(_0x437ea9,_0x55c4cd){var _0x5c04b4=function(_0x8d7a4a){while(--_0x8d7a4a){_0x437ea9['push'](_0x437ea9['shift']());}};_0x5c04b4(++_0x55c4cd);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x73ee91,_0x4963fd){_0x73ee91=_0x73ee91-0x0;var _0x28c421=_0xfdb3[_0x73ee91];return _0x28c421;};'use strict';var multer=require(_0x3fdb('0x0'));var util=require(_0x3fdb('0x1'));var path=require('path');var timeout=require(_0x3fdb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3fdb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3fdb('0x4'));var config=require(_0x3fdb('0x5'));var controller=require(_0x3fdb('0x6'));router[_0x3fdb('0x7')]('/',controller[_0x3fdb('0x8')]);router['put'](_0x3fdb('0x9'),auth[_0x3fdb('0xa')](),controller[_0x3fdb('0xb')]);module['exports']=router; \ No newline at end of file +var _0x83c8=['index','put','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x83c8,0x8a));var _0x883c=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x83c8[_0x48b810];return _0x23c17d;};'use strict';var multer=require(_0x883c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x883c('0x1'));var express=require('express');var router=express[_0x883c('0x2')]();var fs_extra=require(_0x883c('0x3'));var auth=require(_0x883c('0x4'));var interaction=require(_0x883c('0x5'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0x883c('0x6')]);router[_0x883c('0x7')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x883c('0x8')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index f8da035..6e6b335 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 _0x6b68=['sequelize','TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b68,0x16b));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x86b6('0x0'));module['exports']={'license':{'type':Sequelize[_0x86b6('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x86b6('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb80f=['TEXT','STRING','INTEGER','exports'];(function(_0x375aea,_0x5e07f6){var _0x51de20=function(_0x2c4e7e){while(--_0x2c4e7e){_0x375aea['push'](_0x375aea['shift']());}};_0x51de20(++_0x5e07f6);}(_0xb80f,0x193));var _0xfb80=function(_0x1ce599,_0x3f08fb){_0x1ce599=_0x1ce599-0x0;var _0x19d4e7=_0xb80f[_0x1ce599];return _0x19d4e7;};'use strict';var Sequelize=require('sequelize');module[_0xfb80('0x0')]={'license':{'type':Sequelize[_0xfb80('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xfb80('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xfb80('0x3')],'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 37726c3..59aa3ea 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 _0xc4aa=['zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}var utilLicense=require(_0xac4a('0x15'));exports[_0xac4a('0x2a')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={'raw':!![],'where':{'id':0x1}},_0x47f49c={};_0x47f49c[_0xac4a('0x2b')]=_[_0xac4a('0x2c')](db[_0xac4a('0x2d')]['rawAttributes']);_0x47f49c['query']=_[_0xac4a('0x2c')](_0x2772fe[_0xac4a('0x2e')]);_0x47f49c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x47f49c[_0xac4a('0x2b')],_0x47f49c['query']);_0x4a5a9e[_0xac4a('0x31')]=_['intersection'](_0x47f49c[_0xac4a('0x2b')],qs['fields'](_0x2772fe[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x4a5a9e[_0xac4a('0x31')]=_0x4a5a9e[_0xac4a('0x31')][_0xac4a('0x33')]?_0x4a5a9e[_0xac4a('0x31')]:_0x47f49c[_0xac4a('0x2b')];_0x4a5a9e=_[_0xac4a('0x34')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x35')]);return utilLicense[_0xac4a('0x36')](_0x4a5a9e)[_0xac4a('0x24')](respondWithResult(_0x116700,null))[_0xac4a('0x37')](handleError(_0x116700,null));};exports[_0xac4a('0x23')]=function(_0x1a9d4e,_0x5634e2){if(_0x1a9d4e[_0xac4a('0x38')]['id']){delete _0x1a9d4e[_0xac4a('0x38')]['id'];}return db['License'][_0xac4a('0x39')]({'where':{'id':_0x1a9d4e[_0xac4a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5634e2,null))['then'](function(_0x11f0be){var _0x1ba096=_0x11f0be[_0xac4a('0x3b')]({'plain':!![]});return utilLicense[_0xac4a('0x3c')](_0x1ba096,_0x1a9d4e['body'][_0xac4a('0x3d')]);})[_0xac4a('0x24')](function(_0x4e7630){if(!_0x4e7630[_0xac4a('0x3e')]){return saveUpdates(_0x1a9d4e[_0xac4a('0x38')],null);}return _0x4e7630;})[_0xac4a('0x24')](respondWithResult(_0x5634e2,null))['catch'](handleError(_0x5634e2,null));}; \ No newline at end of file +var _0xf494=['fields','length','merge','options','getLicense','body','License','find','params','get','key','demo','catch','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','undefined','limit','count','set','apply','save','update','then','error','stack','name','../../config/license/util','index','model','rawAttributes','query','keys','filters','intersection','attributes'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xf494,0x1c6));var _0x4f49=function(_0x55bd50,_0x1d1cc7){_0x55bd50=_0x55bd50-0x0;var _0x30fba0=_0xf494[_0x55bd50];return _0x30fba0;};'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'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}var utilLicense=require(_0x4f49('0x29'));exports[_0x4f49('0x2a')]=function(_0x605c91,_0x560050){var _0x3cbfbd={'raw':!![],'where':{'id':0x1}},_0x206203={};_0x206203[_0x4f49('0x2b')]=_['keys'](db['License'][_0x4f49('0x2c')]);_0x206203[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x605c91['query']);_0x206203[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],_0x206203[_0x4f49('0x2d')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],qs[_0x4f49('0x32')](_0x605c91[_0x4f49('0x2d')][_0x4f49('0x32')]));_0x3cbfbd[_0x4f49('0x31')]=_0x3cbfbd[_0x4f49('0x31')][_0x4f49('0x33')]?_0x3cbfbd[_0x4f49('0x31')]:_0x206203[_0x4f49('0x2b')];_0x3cbfbd=_[_0x4f49('0x34')]({},_0x3cbfbd,_0x605c91[_0x4f49('0x35')]);return utilLicense[_0x4f49('0x36')](_0x3cbfbd)[_0x4f49('0x25')](respondWithResult(_0x560050,null))['catch'](handleError(_0x560050,null));};exports[_0x4f49('0x24')]=function(_0x46b7ba,_0x24f568){if(_0x46b7ba[_0x4f49('0x37')]['id']){delete _0x46b7ba[_0x4f49('0x37')]['id'];}return db[_0x4f49('0x38')][_0x4f49('0x39')]({'where':{'id':_0x46b7ba[_0x4f49('0x3a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x24f568,null))[_0x4f49('0x25')](function(_0x44e6a0){var _0x343365=_0x44e6a0[_0x4f49('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x343365,_0x46b7ba[_0x4f49('0x37')][_0x4f49('0x3c')]);})[_0x4f49('0x25')](function(_0x26014f){if(!_0x26014f[_0x4f49('0x3d')]){return saveUpdates(_0x46b7ba[_0x4f49('0x37')],null);}return _0x26014f;})[_0x4f49('0x25')](respondWithResult(_0x24f568,null))[_0x4f49('0x3e')](handleError(_0x24f568,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 83a58a0..96f420f 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 _0xc4e0=['bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','moment'];(function(_0x2f6699,_0x48d1ff){var _0x51a15d=function(_0x2f5120){while(--_0x2f5120){_0x2f6699['push'](_0x2f6699['shift']());}};_0x51a15d(++_0x48d1ff);}(_0xc4e0,0xbf));var _0x0c4e=function(_0x14e4c6,_0x9f6ab0){_0x14e4c6=_0x14e4c6-0x0;var _0x489fd0=_0xc4e0[_0x14e4c6];return _0x489fd0;};'use strict';var _=require(_0x0c4e('0x0'));var util=require(_0x0c4e('0x1'));var logger=require(_0x0c4e('0x2'))('api');var moment=require(_0x0c4e('0x3'));var BPromise=require(_0x0c4e('0x4'));var rp=require(_0x0c4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c4e('0x6'));var config=require(_0x0c4e('0x7'));var attributes=require(_0x0c4e('0x8'));module[_0x0c4e('0x9')]=function(_0x1091e5,_0x378067){return _0x1091e5[_0x0c4e('0xa')](_0x0c4e('0xb'),attributes,{'tableName':_0x0c4e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00df=['./license.attributes','define','License','license','util','api','moment','request-promise','path','../../config/environment'];(function(_0x41f7b2,_0x58547b){var _0x19ec6d=function(_0x11f687){while(--_0x11f687){_0x41f7b2['push'](_0x41f7b2['shift']());}};_0x19ec6d(++_0x58547b);}(_0x00df,0x11c));var _0xf00d=function(_0x12882e,_0x468db5){_0x12882e=_0x12882e-0x0;var _0x141b26=_0x00df[_0x12882e];return _0x141b26;};'use strict';var _=require('lodash');var util=require(_0xf00d('0x0'));var logger=require('../../config/logger')(_0xf00d('0x1'));var moment=require(_0xf00d('0x2'));var BPromise=require('bluebird');var rp=require(_0xf00d('0x3'));var fs=require('fs');var path=require(_0xf00d('0x4'));var rimraf=require('rimraf');var config=require(_0xf00d('0x5'));var attributes=require(_0xf00d('0x6'));module['exports']=function(_0x5b0d81,_0x2a52c3){return _0x5b0d81[_0xf00d('0x7')](_0xf00d('0x8'),attributes,{'tableName':_0xf00d('0x9'),'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 eeacc8c..b9bb5fb 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 _0x1b16=['client','request','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5a6602,_0x365b9c){var _0x3ed51d=function(_0xfa7770){while(--_0xfa7770){_0x5a6602['push'](_0x5a6602['shift']());}};_0x3ed51d(++_0x365b9c);}(_0x1b16,0x137));var _0x61b1=function(_0x24dfa2,_0x25ca34){_0x24dfa2=_0x24dfa2-0x0;var _0x2d8366=_0x1b16[_0x24dfa2];return _0x2d8366;};'use strict';var _=require(_0x61b1('0x0'));var util=require(_0x61b1('0x1'));var moment=require(_0x61b1('0x2'));var BPromise=require(_0x61b1('0x3'));var rs=require(_0x61b1('0x4'));var fs=require('fs');var Redis=require(_0x61b1('0x5'));var db=require(_0x61b1('0x6'))['db'];var utils=require(_0x61b1('0x7'));var logger=require(_0x61b1('0x8'))('rpc');var config=require(_0x61b1('0x9'));var jayson=require(_0x61b1('0xa'));var client=jayson[_0x61b1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x416466,_0x1cc698,_0x350654){return new BPromise(function(_0x29697e,_0x55f52a){return client[_0x61b1('0xc')](_0x416466,_0x350654)['then'](function(_0x17c08c){logger['info'](_0x61b1('0xd'),_0x1cc698,_0x61b1('0xe'));logger[_0x61b1('0xf')](_0x61b1('0x10'),_0x1cc698,_0x61b1('0xe'),JSON[_0x61b1('0x11')](_0x17c08c));if(_0x17c08c['error']){if(_0x17c08c[_0x61b1('0x12')][_0x61b1('0x13')]===0x1f4){logger[_0x61b1('0x12')](_0x61b1('0xd'),_0x1cc698,_0x17c08c[_0x61b1('0x12')][_0x61b1('0x14')]);return _0x55f52a(_0x17c08c['error'][_0x61b1('0x14')]);}logger['error'](_0x61b1('0xd'),_0x1cc698,_0x17c08c['error'][_0x61b1('0x14')]);return _0x29697e(_0x17c08c['error'][_0x61b1('0x14')]);}else{logger[_0x61b1('0x15')](_0x61b1('0xd'),_0x1cc698,_0x61b1('0xe'));_0x29697e(_0x17c08c['result']['message']);}})[_0x61b1('0x16')](function(_0x9ab55b){logger['error'](_0x61b1('0xd'),_0x1cc698,_0x9ab55b);_0x55f52a(_0x9ab55b);});});} \ No newline at end of file +var _0xdd36=['code','License,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x11af1c,_0x21d5e4){var _0x32602b=function(_0xffe6dd){while(--_0xffe6dd){_0x11af1c['push'](_0x11af1c['shift']());}};_0x32602b(++_0x21d5e4);}(_0xdd36,0x8f));var _0x6dd3=function(_0x1f7d17,_0x96ee5f){_0x1f7d17=_0x1f7d17-0x0;var _0x38850d=_0xdd36[_0x1f7d17];return _0x38850d;};'use strict';var _=require(_0x6dd3('0x0'));var util=require(_0x6dd3('0x1'));var moment=require(_0x6dd3('0x2'));var BPromise=require('bluebird');var rs=require(_0x6dd3('0x3'));var fs=require('fs');var Redis=require(_0x6dd3('0x4'));var db=require(_0x6dd3('0x5'))['db'];var utils=require(_0x6dd3('0x6'));var logger=require('../../config/logger')(_0x6dd3('0x7'));var config=require(_0x6dd3('0x8'));var jayson=require(_0x6dd3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16c6fb,_0x1065eb,_0x1b483e){return new BPromise(function(_0x1b197e,_0x27102e){return client[_0x6dd3('0xa')](_0x16c6fb,_0x1b483e)[_0x6dd3('0xb')](function(_0x5b5081){logger[_0x6dd3('0xc')]('License,\x20%s,\x20%s',_0x1065eb,'request\x20sent');logger['debug'](_0x6dd3('0xd'),_0x1065eb,_0x6dd3('0xe'),JSON[_0x6dd3('0xf')](_0x5b5081));if(_0x5b5081[_0x6dd3('0x10')]){if(_0x5b5081[_0x6dd3('0x10')][_0x6dd3('0x11')]===0x1f4){logger[_0x6dd3('0x10')](_0x6dd3('0x12'),_0x1065eb,_0x5b5081[_0x6dd3('0x10')][_0x6dd3('0x13')]);return _0x27102e(_0x5b5081['error'][_0x6dd3('0x13')]);}logger['error']('License,\x20%s,\x20%s',_0x1065eb,_0x5b5081[_0x6dd3('0x10')][_0x6dd3('0x13')]);return _0x1b197e(_0x5b5081[_0x6dd3('0x10')][_0x6dd3('0x13')]);}else{logger['info'](_0x6dd3('0x12'),_0x1065eb,_0x6dd3('0xe'));_0x1b197e(_0x5b5081['result']['message']);}})['catch'](function(_0x1276d5){logger[_0x6dd3('0x10')](_0x6dd3('0x12'),_0x1065eb,_0x1276d5);_0x27102e(_0x1276d5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 7722a2f..241bbe1 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 _0x31cb=['get','/describe','describe','/:id','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','post','addDisposition','addAnswer','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','/:id/dispositions','removeDispositions','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated'];(function(_0x458949,_0x2c04a3){var _0x2dda20=function(_0x4300ba){while(--_0x4300ba){_0x458949['push'](_0x458949['shift']());}};_0x2dda20(++_0x2c04a3);}(_0x31cb,0xd7));var _0xb31c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x31cb[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xb31c('0x0'));var util=require(_0xb31c('0x1'));var path=require(_0xb31c('0x2'));var timeout=require(_0xb31c('0x3'));var express=require(_0xb31c('0x4'));var router=express['Router']();var fs_extra=require(_0xb31c('0x5'));var auth=require(_0xb31c('0x6'));var interaction=require(_0xb31c('0x7'));var config=require('../../config/environment');var controller=require(_0xb31c('0x8'));router['get']('/',auth[_0xb31c('0x9')](),controller['index']);router[_0xb31c('0xa')](_0xb31c('0xb'),auth['isAuthenticated'](),controller[_0xb31c('0xc')]);router[_0xb31c('0xa')](_0xb31c('0xd'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xb31c('0xa')](_0xb31c('0xe'),auth['isAuthenticated'](),controller[_0xb31c('0xf')]);router[_0xb31c('0xa')](_0xb31c('0x10'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x11')]);router[_0xb31c('0xa')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xb31c('0x12')]);router[_0xb31c('0xa')](_0xb31c('0x13'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x14')]);router[_0xb31c('0xa')](_0xb31c('0x15'),auth[_0xb31c('0x9')](),controller['getApplications']);router['get'](_0xb31c('0x16'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x17')]);router[_0xb31c('0xa')]('/:id/verify',auth['isAuthenticated'](),controller['verifySmtp']);router[_0xb31c('0xa')](_0xb31c('0x18'),auth[_0xb31c('0x9')](),controller['getAgents']);router[_0xb31c('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xb31c('0x1a')]);router[_0xb31c('0x19')]('/:id/canned_answers',auth[_0xb31c('0x9')](),controller[_0xb31c('0x1b')]);router[_0xb31c('0x19')]('/',auth[_0xb31c('0x9')](),controller['create']);router['post'](_0xb31c('0x10'),auth['isAuthenticated'](),controller[_0xb31c('0x1c')]);router[_0xb31c('0x19')](_0xb31c('0x1d'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x1e')]);router[_0xb31c('0x19')](_0xb31c('0x13'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x1f')]);router[_0xb31c('0x19')](_0xb31c('0x15'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x20')]);router['post'](_0xb31c('0x21'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x22')]);router['post'](_0xb31c('0x18'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x23')]);router[_0xb31c('0x24')](_0xb31c('0xd'),auth['isAuthenticated'](),controller[_0xb31c('0x25')]);router[_0xb31c('0x26')](_0xb31c('0x27'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x28')]);router[_0xb31c('0x26')](_0xb31c('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xb31c('0x26')](_0xb31c('0x10'),auth[_0xb31c('0x9')](),controller['removeImap']);router['delete']('/:id/out_servers',auth[_0xb31c('0x9')](),controller[_0xb31c('0x29')]);router[_0xb31c('0x26')](_0xb31c('0xd'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x2a')]);router[_0xb31c('0x26')](_0xb31c('0x18'),auth[_0xb31c('0x9')](),controller[_0xb31c('0x2b')]);module[_0xb31c('0x2c')]=router; \ No newline at end of file +var _0x195e=['getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','/:id/in_servers','addImap','addSmtp','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','getImap','/:id/out_servers','/:id/interactions'];(function(_0x312230,_0x16192b){var _0x307572=function(_0x41a70b){while(--_0x41a70b){_0x312230['push'](_0x312230['shift']());}};_0x307572(++_0x16192b);}(_0x195e,0x1bf));var _0xe195=function(_0x2cfc94,_0xcf3d5b){_0x2cfc94=_0x2cfc94-0x0;var _0x3ac30a=_0x195e[_0x2cfc94];return _0x3ac30a;};'use strict';var multer=require(_0xe195('0x0'));var util=require('util');var path=require(_0xe195('0x1'));var timeout=require('connect-timeout');var express=require(_0xe195('0x2'));var router=express['Router']();var fs_extra=require(_0xe195('0x3'));var auth=require(_0xe195('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe195('0x5'));var controller=require(_0xe195('0x6'));router[_0xe195('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe195('0x7')]('/describe',auth[_0xe195('0x8')](),controller['describe']);router['get']('/:id',auth[_0xe195('0x8')](),controller['show']);router['get'](_0xe195('0x9'),auth[_0xe195('0x8')](),controller[_0xe195('0xa')]);router['get']('/:id/canned_answers',auth[_0xe195('0x8')](),controller[_0xe195('0xb')]);router[_0xe195('0x7')]('/:id/in_servers',auth[_0xe195('0x8')](),controller[_0xe195('0xc')]);router[_0xe195('0x7')](_0xe195('0xd'),auth[_0xe195('0x8')](),controller['getSmtp']);router['get'](_0xe195('0xe'),auth[_0xe195('0x8')](),controller[_0xe195('0xf')]);router[_0xe195('0x7')](_0xe195('0x10'),auth[_0xe195('0x8')](),controller[_0xe195('0x11')]);router[_0xe195('0x7')](_0xe195('0x12'),auth[_0xe195('0x8')](),controller[_0xe195('0x13')]);router[_0xe195('0x7')](_0xe195('0x14'),auth[_0xe195('0x8')](),controller['verifySmtp']);router[_0xe195('0x7')](_0xe195('0x15'),auth[_0xe195('0x8')](),controller[_0xe195('0x16')]);router[_0xe195('0x17')](_0xe195('0x9'),auth[_0xe195('0x8')](),controller[_0xe195('0x18')]);router[_0xe195('0x17')](_0xe195('0x19'),auth[_0xe195('0x8')](),controller[_0xe195('0x1a')]);router[_0xe195('0x17')]('/',auth[_0xe195('0x8')](),controller[_0xe195('0x1b')]);router[_0xe195('0x17')](_0xe195('0x1c'),auth[_0xe195('0x8')](),controller[_0xe195('0x1d')]);router[_0xe195('0x17')](_0xe195('0xd'),auth['isAuthenticated'](),controller[_0xe195('0x1e')]);router[_0xe195('0x17')](_0xe195('0xe'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xe195('0x17')](_0xe195('0x10'),auth[_0xe195('0x8')](),controller['addApplications']);router[_0xe195('0x17')]('/:id/send',auth[_0xe195('0x8')](),controller['send']);router[_0xe195('0x17')](_0xe195('0x15'),auth[_0xe195('0x8')](),controller[_0xe195('0x1f')]);router[_0xe195('0x20')](_0xe195('0x21'),auth[_0xe195('0x8')](),controller[_0xe195('0x22')]);router[_0xe195('0x23')](_0xe195('0x9'),auth[_0xe195('0x8')](),controller[_0xe195('0x24')]);router['delete'](_0xe195('0x19'),auth['isAuthenticated'](),controller[_0xe195('0x25')]);router['delete'](_0xe195('0x1c'),auth[_0xe195('0x8')](),controller[_0xe195('0x26')]);router[_0xe195('0x23')]('/:id/out_servers',auth[_0xe195('0x8')](),controller[_0xe195('0x27')]);router[_0xe195('0x23')](_0xe195('0x21'),auth[_0xe195('0x8')](),controller[_0xe195('0x28')]);router[_0xe195('0x23')](_0xe195('0x15'),auth[_0xe195('0x8')](),controller[_0xe195('0x29')]);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 21ce3b0..704a20a 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 _0xd6d2=['exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','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','mandatoryDisposition','sequelize'];(function(_0x1f2d86,_0x1dd5e2){var _0x5f1494=function(_0x325c04){while(--_0x325c04){_0x1f2d86['push'](_0x1f2d86['shift']());}};_0x5f1494(++_0x1dd5e2);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x2ae479,_0x30f932){_0x2ae479=_0x2ae479-0x0;var _0x392bab=_0xd6d2[_0x2ae479];return _0x392bab;};'use strict';var Sequelize=require(_0x2d6d('0x0'));module[_0x2d6d('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2d6d('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x2d6d('0x4')]},'markAsUnread':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2d6d('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x2d6d('0x5')](0x2)[_0x2d6d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2d6d('0x4')],'defaultValue':function(){return _0x2d6d('0x7');}},'notificationSound':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2d6d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2d6d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2d6d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2d6d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2d6d('0x3')],'defaultValue':![],'comment':_0x2d6d('0x9'),'set':function(_0x3cc2fa){if(!_0x3cc2fa)this[_0x2d6d('0xa')]('mandatoryDispositionPauseId',null);this[_0x2d6d('0xa')](_0x2d6d('0xb'),_0x3cc2fa);}}}; \ No newline at end of file +var _0x33c5=['mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','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','setDataValue'];(function(_0x28f0b6,_0x290a14){var _0x44156e=function(_0x4e57de){while(--_0x4e57de){_0x28f0b6['push'](_0x28f0b6['shift']());}};_0x44156e(++_0x290a14);}(_0x33c5,0xe6));var _0x533c=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x33c5[_0x494d1f];return _0x457b6e;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'description':{'type':Sequelize[_0x533c('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x533c('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x533c('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x533c('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x533c('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x533c('0x1')],'allowNull':![],'defaultValue':_0x533c('0x4')},'fontSize':{'type':Sequelize[_0x533c('0x5')](0x2)[_0x533c('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x533c('0x3')],'defaultValue':function(){return _0x533c('0x7');}},'notificationSound':{'type':Sequelize[_0x533c('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x533c('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x533c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x533c('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x533c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x533c('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x533c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x533c('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x533c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x533c('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x6eeb6d){if(!_0x6eeb6d)this[_0x533c('0x9')](_0x533c('0xa'),null);this[_0x533c('0x9')](_0x533c('0xb'),_0x6eeb6d);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 9a702dc..56b0a1e 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 _0xab64=['MailAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','MailServerIn','keys','find','update','body','describe','addDisposition','MailAccountId','create','getDispositions','nolimit','order','pick','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','findOne','findAll','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','List\x20not\x20found','subject','attach','out','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','zip-dir','request-promise','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab64,0x84));var _0x4ab6=function(_0x251f67,_0x4f7011){_0x251f67=_0x251f67-0x0;var _0x1feebd=_0xab64[_0x251f67];return _0x1feebd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ab6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ab6('0x1'));var moment=require('moment');var BPromise=require(_0x4ab6('0x2'));var Mustache=require(_0x4ab6('0x3'));var util=require(_0x4ab6('0x4'));var path=require(_0x4ab6('0x5'));var sox=require(_0x4ab6('0x6'));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(_0x4ab6('0x7'));var crypto=require(_0x4ab6('0x8'));var jsforce=require(_0x4ab6('0x9'));var deskjs=require(_0x4ab6('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4ab6('0xb'));var Papa=require(_0x4ab6('0xc'));var htmlToText=require(_0x4ab6('0xd'));var juice=require(_0x4ab6('0xe'));var Redis=require(_0x4ab6('0xf'));var authService=require(_0x4ab6('0x10'));var qs=require(_0x4ab6('0x11'));var as=require(_0x4ab6('0x12'));var hardwareService=require(_0x4ab6('0x13'));var logger=require(_0x4ab6('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4ab6('0x15'));var licenseUtil=require(_0x4ab6('0x16'));var db=require(_0x4ab6('0x17'))['db'];config[_0x4ab6('0x18')]=_[_0x4ab6('0x19')](config['redis'],{'host':_0x4ab6('0x1a'),'port':0x18eb});var socket=require(_0x4ab6('0x1b'))(new Redis(config[_0x4ab6('0x18')]));require(_0x4ab6('0x1c'))[_0x4ab6('0x1d')](socket);var jayson=require(_0x4ab6('0x1e'));var client=jayson[_0x4ab6('0x1f')][_0x4ab6('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x10a2a5,_0x50fce0,_0x534bf4,_0xe149e0){return new BPromise(function(_0x299d4d,_0x42677a){var _0x397d85=_0xe149e0||client;return _0x397d85[_0x4ab6('0x21')](_0x10a2a5,_0x534bf4)[_0x4ab6('0x22')](function(_0x4444a7){logger['info'](_0x4ab6('0x23'),_0x50fce0,_0x4ab6('0x24'));logger['debug'](_0x4ab6('0x25'),_0x50fce0,_0x4ab6('0x24'),JSON[_0x4ab6('0x26')](_0x4444a7));if(_0x4444a7[_0x4ab6('0x27')]){if(_0x4444a7[_0x4ab6('0x27')][_0x4ab6('0x28')]===0x1f4){logger[_0x4ab6('0x27')](_0x4ab6('0x23'),_0x50fce0,_0x4444a7['error']['message']);return _0x42677a(_0x4444a7[_0x4ab6('0x27')]['message']);}logger[_0x4ab6('0x27')](_0x4ab6('0x23'),_0x50fce0,_0x4444a7['error'][_0x4ab6('0x29')]);return _0x299d4d(_0x4444a7['error'][_0x4ab6('0x29')]);}else{logger[_0x4ab6('0x2a')](_0x4ab6('0x23'),_0x50fce0,'request\x20sent');_0x299d4d(_0x4444a7[_0x4ab6('0x2b')][_0x4ab6('0x29')]);}})[_0x4ab6('0x2c')](function(_0x4786a4){logger['error'](_0x4ab6('0x23'),_0x50fce0,_0x4786a4);_0x42677a(_0x4786a4);});});}function respondWithStatusCode(_0x7b4e57,_0x2bad42){_0x2bad42=_0x2bad42||0xcc;return function(_0x366789){if(_0x366789){return _0x7b4e57[_0x4ab6('0x2d')](_0x2bad42);}return _0x7b4e57[_0x4ab6('0x2e')](_0x2bad42)[_0x4ab6('0x2f')]();};}function respondWithResult(_0x1ae09a,_0x12b220){_0x12b220=_0x12b220||0xc8;return function(_0x287d91){if(_0x287d91){return _0x1ae09a[_0x4ab6('0x2e')](_0x12b220)[_0x4ab6('0x30')](_0x287d91);}};}function respondWithFilteredResult(_0x58b95a,_0x3c1b7e){return function(_0x15dc0e){if(_0x15dc0e){var _0x1673ff=typeof _0x3c1b7e[_0x4ab6('0x31')]===_0x4ab6('0x32')&&typeof _0x3c1b7e[_0x4ab6('0x33')]===_0x4ab6('0x32');var _0x2ee227=_0x15dc0e[_0x4ab6('0x34')];var _0xfaba22=_0x1673ff?0x0:_0x3c1b7e[_0x4ab6('0x31')];var _0x4e551a=_0x1673ff?_0x15dc0e[_0x4ab6('0x34')]:_0x3c1b7e[_0x4ab6('0x31')]+_0x3c1b7e[_0x4ab6('0x33')];var _0x1f68ad;if(_0x4e551a>=_0x2ee227){_0x4e551a=_0x2ee227;_0x1f68ad=0xc8;}else{_0x1f68ad=0xce;}_0x58b95a[_0x4ab6('0x2e')](_0x1f68ad);return _0x58b95a[_0x4ab6('0x35')](_0x4ab6('0x36'),_0xfaba22+'-'+_0x4e551a+'/'+_0x2ee227)['json'](_0x15dc0e);}return null;};}function patchUpdates(_0x12a8bb){return function(_0x557c6f){try{jsonpatch[_0x4ab6('0x37')](_0x557c6f,_0x12a8bb,!![]);}catch(_0x5bd6ba){return BPromise[_0x4ab6('0x38')](_0x5bd6ba);}return _0x557c6f[_0x4ab6('0x39')]();};}function saveUpdates(_0xafe75e,_0x233482){return function(_0x3a1deb){if(_0x3a1deb){return _0x3a1deb['update'](_0xafe75e)[_0x4ab6('0x22')](function(_0x1ce507){return _0x1ce507;});}return null;};}function removeEntity(_0x1d1ac1,_0x5b1b0a){return function(_0x515f96){if(_0x515f96){return _0x515f96[_0x4ab6('0x3a')]()[_0x4ab6('0x22')](function(){var _0x282e07=_0x515f96[_0x4ab6('0x3b')]({'plain':!![]});var _0x4f77bf=_0x4ab6('0x3c');return db[_0x4ab6('0x3d')][_0x4ab6('0x3a')]({'where':{'type':_0x4f77bf,'resourceId':_0x282e07['id']}})['then'](function(){return _0x515f96;});})[_0x4ab6('0x22')](function(){_0x1d1ac1[_0x4ab6('0x2e')](0xcc)[_0x4ab6('0x2f')]();});}};}function handleEntityNotFound(_0x3e32d9,_0x270578){return function(_0x2f93c0){if(!_0x2f93c0){_0x3e32d9[_0x4ab6('0x2d')](0x194);}return _0x2f93c0;};}function handleError(_0x1b44ba,_0x12919e){_0x12919e=_0x12919e||0x1f4;return function(_0x5f3949){logger[_0x4ab6('0x27')](_0x5f3949[_0x4ab6('0x3e')]);if(_0x5f3949['name']){delete _0x5f3949[_0x4ab6('0x3f')];}_0x1b44ba[_0x4ab6('0x2e')](_0x12919e)[_0x4ab6('0x40')](_0x5f3949);};}exports[_0x4ab6('0x41')]=function(_0x47a5a7,_0x342c68){var _0x13760e={'include':[{'model':db['MailServerIn'],'as':_0x4ab6('0x42')},{'model':db[_0x4ab6('0x43')],'as':_0x4ab6('0x44')},{'model':db[_0x4ab6('0x45')],'as':_0x4ab6('0x46')}]},_0x2f0fb1={},_0x372cb5={'count':0x0,'rows':[]};var _0x484675=_[_0x4ab6('0x47')](db[_0x4ab6('0x48')][_0x4ab6('0x49')],function(_0x184b97){return{'name':_0x184b97[_0x4ab6('0x4a')],'type':_0x184b97[_0x4ab6('0x4b')][_0x4ab6('0x4c')]};});_0x2f0fb1[_0x4ab6('0x4d')]=_[_0x4ab6('0x47')](_0x484675,_0x4ab6('0x3f'));_0x2f0fb1[_0x4ab6('0x4e')]=_['keys'](_0x47a5a7[_0x4ab6('0x4e')]);_0x2f0fb1[_0x4ab6('0x4f')]=_[_0x4ab6('0x50')](_0x2f0fb1[_0x4ab6('0x4d')],_0x2f0fb1[_0x4ab6('0x4e')]);_0x13760e['attributes']=_[_0x4ab6('0x50')](_0x2f0fb1[_0x4ab6('0x4d')],qs[_0x4ab6('0x51')](_0x47a5a7[_0x4ab6('0x4e')][_0x4ab6('0x51')]));_0x13760e[_0x4ab6('0x52')]=_0x13760e[_0x4ab6('0x52')][_0x4ab6('0x53')]?_0x13760e[_0x4ab6('0x52')]:_0x2f0fb1[_0x4ab6('0x4d')];if(!_0x47a5a7[_0x4ab6('0x4e')][_0x4ab6('0x54')]('nolimit')){_0x13760e[_0x4ab6('0x33')]=qs[_0x4ab6('0x33')](_0x47a5a7[_0x4ab6('0x4e')][_0x4ab6('0x33')]);_0x13760e[_0x4ab6('0x31')]=qs['offset'](_0x47a5a7[_0x4ab6('0x4e')][_0x4ab6('0x31')]);}_0x13760e['order']=qs[_0x4ab6('0x55')](_0x47a5a7['query'][_0x4ab6('0x55')]);_0x13760e[_0x4ab6('0x56')]=qs[_0x4ab6('0x4f')](_['pick'](_0x47a5a7['query'],_0x2f0fb1[_0x4ab6('0x4f')]),_0x484675);if(_0x47a5a7[_0x4ab6('0x4e')][_0x4ab6('0x57')]){_0x13760e[_0x4ab6('0x56')]=_['merge'](_0x13760e[_0x4ab6('0x56')],{'$or':_[_0x4ab6('0x47')](_0x484675,function(_0x3bbf66){if(_0x3bbf66[_0x4ab6('0x4b')]!==_0x4ab6('0x58')){var _0x21786e={};_0x21786e[_0x3bbf66[_0x4ab6('0x3f')]]={'$like':'%'+_0x47a5a7[_0x4ab6('0x4e')][_0x4ab6('0x57')]+'%'};return _0x21786e;}})});}_0x13760e=_[_0x4ab6('0x59')]({},_0x13760e,_0x47a5a7[_0x4ab6('0x5a')]);var _0x43e292={'where':_0x13760e[_0x4ab6('0x56')]};return db[_0x4ab6('0x48')][_0x4ab6('0x34')](_0x43e292)[_0x4ab6('0x22')](function(_0x1deb1a){_0x372cb5[_0x4ab6('0x34')]=_0x1deb1a;if(_0x47a5a7[_0x4ab6('0x4e')][_0x4ab6('0x5b')]){_0x13760e[_0x4ab6('0x5c')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x13760e);})[_0x4ab6('0x22')](function(_0x53bcd5){_0x372cb5[_0x4ab6('0x5d')]=_0x53bcd5;return _0x372cb5;})[_0x4ab6('0x22')](respondWithFilteredResult(_0x342c68,_0x13760e))[_0x4ab6('0x2c')](handleError(_0x342c68,null));};exports[_0x4ab6('0x5e')]=function(_0x531725,_0x44d118){var _0x3a1538={'raw':![],'where':{'id':_0x531725[_0x4ab6('0x5f')]['id']},'include':[{'model':db[_0x4ab6('0x60')],'as':'Imap'},{'model':db[_0x4ab6('0x43')],'as':'Smtp'},{'model':db[_0x4ab6('0x45')],'as':_0x4ab6('0x46')}]},_0x1f7d20={};_0x1f7d20[_0x4ab6('0x4d')]=_[_0x4ab6('0x61')](db[_0x4ab6('0x48')]['rawAttributes']);_0x1f7d20[_0x4ab6('0x4e')]=_[_0x4ab6('0x61')](_0x531725[_0x4ab6('0x4e')]);_0x1f7d20[_0x4ab6('0x4f')]=_[_0x4ab6('0x50')](_0x1f7d20['model'],_0x1f7d20[_0x4ab6('0x4e')]);_0x3a1538['attributes']=_[_0x4ab6('0x50')](_0x1f7d20[_0x4ab6('0x4d')],qs[_0x4ab6('0x51')](_0x531725[_0x4ab6('0x4e')][_0x4ab6('0x51')]));_0x3a1538[_0x4ab6('0x52')]=_0x3a1538[_0x4ab6('0x52')][_0x4ab6('0x53')]?_0x3a1538[_0x4ab6('0x52')]:_0x1f7d20[_0x4ab6('0x4d')];if(_0x531725[_0x4ab6('0x4e')][_0x4ab6('0x5b')]){_0x3a1538[_0x4ab6('0x5c')]=[{'all':!![]}];}_0x3a1538=_[_0x4ab6('0x59')]({},_0x3a1538,_0x531725[_0x4ab6('0x5a')]);return db[_0x4ab6('0x48')][_0x4ab6('0x62')](_0x3a1538)[_0x4ab6('0x22')](handleEntityNotFound(_0x44d118,null))[_0x4ab6('0x22')](respondWithResult(_0x44d118,null))[_0x4ab6('0x2c')](handleError(_0x44d118,null));};exports[_0x4ab6('0x63')]=function(_0x44560e,_0x489e4f){if(_0x44560e[_0x4ab6('0x64')]['id']){delete _0x44560e[_0x4ab6('0x64')]['id'];}return db[_0x4ab6('0x48')][_0x4ab6('0x62')]({'where':{'id':_0x44560e['params']['id']},'include':[{'model':db[_0x4ab6('0x60')],'as':_0x4ab6('0x42')},{'model':db[_0x4ab6('0x43')],'as':_0x4ab6('0x44')},{'model':db[_0x4ab6('0x45')],'as':_0x4ab6('0x46')}]})['then'](handleEntityNotFound(_0x489e4f,null))[_0x4ab6('0x22')](saveUpdates(_0x44560e[_0x4ab6('0x64')],null))[_0x4ab6('0x22')](function(_0x29f054){if(_0x29f054&&_0x44560e[_0x4ab6('0x64')][_0x4ab6('0x42')]){return db[_0x4ab6('0x60')]['update'](_0x44560e[_0x4ab6('0x64')][_0x4ab6('0x42')],{'where':{'MailAccountId':_0x29f054['id']}})[_0x4ab6('0x22')](function(){return _0x29f054;});}return _0x29f054;})[_0x4ab6('0x22')](function(_0x2298de){if(_0x2298de&&_0x44560e[_0x4ab6('0x64')]['Smtp']){return db[_0x4ab6('0x43')][_0x4ab6('0x63')](_0x44560e[_0x4ab6('0x64')][_0x4ab6('0x44')],{'where':{'MailAccountId':_0x2298de['id']}})[_0x4ab6('0x22')](function(){return _0x2298de;});}return _0x2298de;})[_0x4ab6('0x22')](respondWithResult(_0x489e4f,null))['catch'](handleError(_0x489e4f,null));};exports[_0x4ab6('0x65')]=function(_0x3c8fcb,_0x1b93bf){return db[_0x4ab6('0x48')][_0x4ab6('0x65')]()['then'](respondWithResult(_0x1b93bf,null))[_0x4ab6('0x2c')](handleError(_0x1b93bf,null));};exports[_0x4ab6('0x66')]=function(_0x3a2be1,_0x482954,_0x31264e){if(_0x3a2be1[_0x4ab6('0x64')]['id']){delete _0x3a2be1[_0x4ab6('0x64')]['id'];}return db[_0x4ab6('0x48')]['find']({'where':{'id':_0x3a2be1[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x482954,null))[_0x4ab6('0x22')](function(_0x4e1695){if(_0x4e1695){_0x3a2be1[_0x4ab6('0x64')][_0x4ab6('0x67')]=_0x4e1695['id'];return db['Disposition'][_0x4ab6('0x68')](_0x3a2be1[_0x4ab6('0x64')]);}})[_0x4ab6('0x22')](respondWithResult(_0x482954,null))[_0x4ab6('0x2c')](handleError(_0x482954,null));};exports[_0x4ab6('0x69')]=function(_0x11689d,_0x1948d2,_0x58bbc2){var _0x55fcec={'raw':![],'where':{}};var _0x5095d4={};var _0x50fc2a={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x11689d[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x1948d2,null))[_0x4ab6('0x22')](function(_0x5d5627){if(_0x5d5627){_0x5095d4[_0x4ab6('0x4d')]=_[_0x4ab6('0x61')](db['Disposition'][_0x4ab6('0x49')]);_0x5095d4[_0x4ab6('0x4e')]=_[_0x4ab6('0x61')](_0x11689d[_0x4ab6('0x4e')]);_0x5095d4[_0x4ab6('0x4f')]=_[_0x4ab6('0x50')](_0x5095d4[_0x4ab6('0x4d')],_0x5095d4[_0x4ab6('0x4e')]);_0x55fcec[_0x4ab6('0x52')]=_[_0x4ab6('0x50')](_0x5095d4[_0x4ab6('0x4d')],qs[_0x4ab6('0x51')](_0x11689d[_0x4ab6('0x4e')][_0x4ab6('0x51')]));_0x55fcec[_0x4ab6('0x52')]=_0x55fcec[_0x4ab6('0x52')][_0x4ab6('0x53')]?_0x55fcec[_0x4ab6('0x52')]:_0x5095d4['model'];if(!_0x11689d['query'][_0x4ab6('0x54')](_0x4ab6('0x6a'))){_0x55fcec[_0x4ab6('0x33')]=qs[_0x4ab6('0x33')](_0x11689d[_0x4ab6('0x4e')][_0x4ab6('0x33')]);_0x55fcec[_0x4ab6('0x31')]=qs[_0x4ab6('0x31')](_0x11689d[_0x4ab6('0x4e')][_0x4ab6('0x31')]);}_0x55fcec[_0x4ab6('0x6b')]=qs['sort'](_0x11689d[_0x4ab6('0x4e')][_0x4ab6('0x55')]);_0x55fcec[_0x4ab6('0x56')]=qs[_0x4ab6('0x4f')](_[_0x4ab6('0x6c')](_0x11689d[_0x4ab6('0x4e')],_0x5095d4[_0x4ab6('0x4f')]));_0x55fcec['where']['MailAccountId']=_0x5d5627['id'];if(_0x11689d[_0x4ab6('0x4e')][_0x4ab6('0x57')]){_0x55fcec[_0x4ab6('0x56')]=_[_0x4ab6('0x59')](_0x55fcec[_0x4ab6('0x56')],{'$or':_[_0x4ab6('0x47')](_0x55fcec[_0x4ab6('0x52')],function(_0x304771){var _0x2e5b71={};_0x2e5b71[_0x304771]={'$like':'%'+_0x11689d[_0x4ab6('0x4e')][_0x4ab6('0x57')]+'%'};return _0x2e5b71;})});}_0x55fcec=_[_0x4ab6('0x59')]({},_0x55fcec,_0x11689d[_0x4ab6('0x5a')]);return db['Disposition'][_0x4ab6('0x34')]({'where':_0x55fcec[_0x4ab6('0x56')]})[_0x4ab6('0x22')](function(_0x548a2a){_0x50fc2a[_0x4ab6('0x34')]=_0x548a2a;if(_0x11689d[_0x4ab6('0x4e')]['includeAll']){_0x55fcec['include']=[{'all':!![]}];}return db[_0x4ab6('0x6d')]['findAll'](_0x55fcec);})[_0x4ab6('0x22')](function(_0x4e1e50){_0x50fc2a[_0x4ab6('0x5d')]=_0x4e1e50;return _0x50fc2a;});}})[_0x4ab6('0x22')](respondWithFilteredResult(_0x1948d2,_0x55fcec))[_0x4ab6('0x2c')](handleError(_0x1948d2,null));};exports[_0x4ab6('0x6e')]=function(_0x247d7d,_0x2f9bc0,_0x4e92b5){return db[_0x4ab6('0x48')][_0x4ab6('0x62')]({'where':{'id':_0x247d7d[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x2f9bc0,null))['then'](function(_0x44d7a9){if(_0x44d7a9){return _0x44d7a9[_0x4ab6('0x6e')](_0x247d7d[_0x4ab6('0x4e')][_0x4ab6('0x6f')]);}})[_0x4ab6('0x22')](respondWithStatusCode(_0x2f9bc0,null))['catch'](handleError(_0x2f9bc0,null));};exports['addAnswer']=function(_0x292e2,_0x516699,_0x41d065){if(_0x292e2[_0x4ab6('0x64')]['id']){delete _0x292e2[_0x4ab6('0x64')]['id'];}return db['MailAccount'][_0x4ab6('0x62')]({'where':{'id':_0x292e2[_0x4ab6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x516699,null))['then'](function(_0x3673f7){if(_0x3673f7){_0x292e2[_0x4ab6('0x64')][_0x4ab6('0x67')]=_0x3673f7['id'];return db[_0x4ab6('0x70')][_0x4ab6('0x68')](_0x292e2['body']);}})[_0x4ab6('0x22')](respondWithResult(_0x516699,null))[_0x4ab6('0x2c')](handleError(_0x516699,null));};exports[_0x4ab6('0x71')]=function(_0x1abe1b,_0x34bfb4,_0x263d1e){var _0x1d907f={'raw':![],'where':{}};var _0x26d8bd={};var _0x281e4c={'count':0x0,'rows':[]};return db[_0x4ab6('0x48')][_0x4ab6('0x72')]({'where':{'id':_0x1abe1b[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x34bfb4,null))[_0x4ab6('0x22')](function(_0x414312){if(_0x414312){_0x26d8bd[_0x4ab6('0x4d')]=_[_0x4ab6('0x61')](db['CannedAnswer']['rawAttributes']);_0x26d8bd[_0x4ab6('0x4e')]=_['keys'](_0x1abe1b['query']);_0x26d8bd[_0x4ab6('0x4f')]=_[_0x4ab6('0x50')](_0x26d8bd[_0x4ab6('0x4d')],_0x26d8bd[_0x4ab6('0x4e')]);_0x1d907f[_0x4ab6('0x52')]=_[_0x4ab6('0x50')](_0x26d8bd[_0x4ab6('0x4d')],qs[_0x4ab6('0x51')](_0x1abe1b[_0x4ab6('0x4e')][_0x4ab6('0x51')]));_0x1d907f[_0x4ab6('0x52')]=_0x1d907f[_0x4ab6('0x52')]['length']?_0x1d907f['attributes']:_0x26d8bd['model'];if(!_0x1abe1b[_0x4ab6('0x4e')]['hasOwnProperty'](_0x4ab6('0x6a'))){_0x1d907f[_0x4ab6('0x33')]=qs[_0x4ab6('0x33')](_0x1abe1b[_0x4ab6('0x4e')]['limit']);_0x1d907f[_0x4ab6('0x31')]=qs['offset'](_0x1abe1b['query']['offset']);}_0x1d907f[_0x4ab6('0x6b')]=qs[_0x4ab6('0x55')](_0x1abe1b['query'][_0x4ab6('0x55')]);_0x1d907f[_0x4ab6('0x56')]=qs[_0x4ab6('0x4f')](_['pick'](_0x1abe1b[_0x4ab6('0x4e')],_0x26d8bd['filters']));_0x1d907f[_0x4ab6('0x56')][_0x4ab6('0x67')]=_0x414312['id'];if(_0x1abe1b[_0x4ab6('0x4e')]['filter']){_0x1d907f[_0x4ab6('0x56')]=_[_0x4ab6('0x59')](_0x1d907f[_0x4ab6('0x56')],{'$or':_['map'](_0x1d907f[_0x4ab6('0x52')],function(_0x454017){var _0x325449={};_0x325449[_0x454017]={'$like':'%'+_0x1abe1b['query'][_0x4ab6('0x57')]+'%'};return _0x325449;})});}_0x1d907f=_['merge']({},_0x1d907f,_0x1abe1b[_0x4ab6('0x5a')]);return db[_0x4ab6('0x70')]['count']({'where':_0x1d907f[_0x4ab6('0x56')]})['then'](function(_0x4be039){_0x281e4c[_0x4ab6('0x34')]=_0x4be039;if(_0x1abe1b[_0x4ab6('0x4e')]['includeAll']){_0x1d907f[_0x4ab6('0x5c')]=[{'all':!![]}];}return db[_0x4ab6('0x70')][_0x4ab6('0x73')](_0x1d907f);})[_0x4ab6('0x22')](function(_0x7f13b5){_0x281e4c[_0x4ab6('0x5d')]=_0x7f13b5;return _0x281e4c;});}})[_0x4ab6('0x22')](respondWithFilteredResult(_0x34bfb4,_0x1d907f))[_0x4ab6('0x2c')](handleError(_0x34bfb4,null));};exports[_0x4ab6('0x74')]=function(_0x38792d,_0x290016,_0xf2fa2){return db[_0x4ab6('0x48')][_0x4ab6('0x62')]({'where':{'id':_0x38792d[_0x4ab6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x290016,null))['then'](function(_0x49a712){if(_0x49a712){return _0x49a712[_0x4ab6('0x74')](_0x38792d[_0x4ab6('0x4e')][_0x4ab6('0x6f')]);}})[_0x4ab6('0x22')](respondWithStatusCode(_0x290016,null))['catch'](handleError(_0x290016,null));};exports[_0x4ab6('0x68')]=function(_0x475968,_0x3bd387){var _0x5c99f0={'name':_0x475968['body'][_0x4ab6('0x3f')],'key':_0x475968[_0x4ab6('0x64')][_0x4ab6('0x4c')],'email':_0x475968[_0x4ab6('0x64')][_0x4ab6('0x75')],'ListId':_0x475968[_0x4ab6('0x64')][_0x4ab6('0x76')],'active':!_[_0x4ab6('0x77')](_0x475968['body'][_0x4ab6('0x78')])?_0x475968[_0x4ab6('0x64')]['active']:!![],'description':_0x475968[_0x4ab6('0x64')][_0x4ab6('0x79')]||null,'Imap':{},'Smtp':{}};if(_[_0x4ab6('0x77')](_0x475968[_0x4ab6('0x64')][_0x4ab6('0x7a')])){if(_0x475968[_0x4ab6('0x64')][_0x4ab6('0x7b')]){_0x5c99f0[_0x4ab6('0x42')][_0x4ab6('0x7c')]=_0x5c99f0[_0x4ab6('0x44')][_0x4ab6('0x7c')]=_0x475968[_0x4ab6('0x64')][_0x4ab6('0x7d')];_0x5c99f0[_0x4ab6('0x42')][_0x4ab6('0x7e')]=_0x5c99f0[_0x4ab6('0x44')]['pass']=_0x475968['body'][_0x4ab6('0x7f')];}else{_0x5c99f0[_0x4ab6('0x42')][_0x4ab6('0x80')]=_0x5c99f0['Smtp'][_0x4ab6('0x80')]=![];}_0x5c99f0[_0x4ab6('0x42')][_0x4ab6('0x81')]=_0x475968[_0x4ab6('0x64')][_0x4ab6('0x42')][_0x4ab6('0x81')];_0x5c99f0[_0x4ab6('0x42')][_0x4ab6('0x82')]=_0x475968[_0x4ab6('0x64')][_0x4ab6('0x42')]['port'];_0x5c99f0[_0x4ab6('0x44')][_0x4ab6('0x81')]=_0x475968['body'][_0x4ab6('0x44')]['host'];_0x5c99f0[_0x4ab6('0x44')][_0x4ab6('0x82')]=_0x475968[_0x4ab6('0x64')][_0x4ab6('0x44')][_0x4ab6('0x82')];}else{_0x5c99f0[_0x4ab6('0x42')][_0x4ab6('0x83')]=_0x5c99f0['Smtp']['service']=_0x475968[_0x4ab6('0x64')][_0x4ab6('0x7a')];_0x5c99f0[_0x4ab6('0x42')]['user']=_0x5c99f0[_0x4ab6('0x44')][_0x4ab6('0x7c')]=_0x475968[_0x4ab6('0x64')][_0x4ab6('0x7d')];_0x5c99f0[_0x4ab6('0x42')][_0x4ab6('0x7e')]=_0x5c99f0[_0x4ab6('0x44')][_0x4ab6('0x84')]=_0x475968[_0x4ab6('0x64')]['cpassword'];}return db['MailAccount'][_0x4ab6('0x68')](_0x5c99f0,{'include':[{'model':db[_0x4ab6('0x43')],'as':_0x4ab6('0x44')},{'model':db[_0x4ab6('0x60')],'as':_0x4ab6('0x42')}]})[_0x4ab6('0x22')](function(_0x2391b5){var _0x810036=_0x475968[_0x4ab6('0x7c')][_0x4ab6('0x3b')]({'plain':!![]});if(!_0x810036)throw new Error(_0x4ab6('0x85'));if(_0x810036['role']===_0x4ab6('0x7c')){var _0x447f42=_0x2391b5['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x4ab6('0x3c'),'userProfileId':_0x810036[_0x4ab6('0x86')]},'raw':!![]})[_0x4ab6('0x22')](function(_0x5a6a1b){if(_0x5a6a1b&&_0x5a6a1b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x447f42[_0x4ab6('0x3f')],'resourceId':_0x447f42['id'],'type':_0x5a6a1b[_0x4ab6('0x3f')],'sectionId':_0x5a6a1b['id']},{})[_0x4ab6('0x22')](function(){return _0x2391b5;});}else{return _0x2391b5;}})[_0x4ab6('0x2c')](function(_0x583b40){logger[_0x4ab6('0x27')](_0x4ab6('0x87'),_0x583b40);throw _0x583b40;});}return _0x2391b5;})['then'](respondWithResult(_0x3bd387,0xc9))[_0x4ab6('0x2c')](handleError(_0x3bd387,null));};exports[_0x4ab6('0x88')]=function(_0x2b51b5,_0xee7d8e,_0x364c8f){return db[_0x4ab6('0x48')][_0x4ab6('0x72')]({'where':{'id':_0x2b51b5['params']['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0xee7d8e,null))[_0x4ab6('0x22')](function(_0xda244a){if(_0xda244a){return _0xda244a['getImap']();}return null;})['then'](respondWithResult(_0xee7d8e,null))['catch'](handleError(_0xee7d8e,null));};exports[_0x4ab6('0x89')]=function(_0x2d6c27,_0x1ebaab,_0x46b483){if(_0x2d6c27['body']['id']){delete _0x2d6c27[_0x4ab6('0x64')]['id'];}return db[_0x4ab6('0x48')]['find']({'where':{'id':_0x2d6c27['params']['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x1ebaab,null))['then'](function(_0x14ef14){if(_0x14ef14){_0x2d6c27[_0x4ab6('0x64')]['MailAccountId']=_0x14ef14['id'];return db['MailServerIn']['create'](_0x2d6c27['body']);}})['then'](respondWithResult(_0x1ebaab,null))[_0x4ab6('0x2c')](handleError(_0x1ebaab,null));};exports[_0x4ab6('0x8a')]=function(_0x5711c1,_0x5a6e9c,_0x29368d){return db['MailAccount'][_0x4ab6('0x72')]({'where':{'id':_0x5711c1['params']['id']}})['then'](handleEntityNotFound(_0x5a6e9c,null))[_0x4ab6('0x22')](function(_0x3d515f){if(_0x3d515f){return _0x3d515f[_0x4ab6('0x8b')](null);}return null;})[_0x4ab6('0x22')](respondWithStatusCode(_0x5a6e9c,null))[_0x4ab6('0x2c')](handleError(_0x5a6e9c,null));};exports[_0x4ab6('0x8c')]=function(_0x53ab84,_0x5b4c17,_0x29fe81){return db['MailAccount'][_0x4ab6('0x72')]({'where':{'id':_0x53ab84[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x5b4c17,null))[_0x4ab6('0x22')](function(_0x2825b3){if(_0x2825b3){return _0x2825b3[_0x4ab6('0x8c')]();}return null;})[_0x4ab6('0x22')](respondWithResult(_0x5b4c17,null))['catch'](handleError(_0x5b4c17,null));};exports[_0x4ab6('0x8d')]=function(_0x451b23,_0x59d28c,_0x16af51){if(_0x451b23['body']['id']){delete _0x451b23[_0x4ab6('0x64')]['id'];}return db[_0x4ab6('0x48')]['find']({'where':{'id':_0x451b23[_0x4ab6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x59d28c,null))[_0x4ab6('0x22')](function(_0x2c33a1){if(_0x2c33a1){_0x451b23[_0x4ab6('0x64')]['MailAccountId']=_0x2c33a1['id'];return db[_0x4ab6('0x43')][_0x4ab6('0x68')](_0x451b23[_0x4ab6('0x64')]);}})['then'](respondWithResult(_0x59d28c,null))[_0x4ab6('0x2c')](handleError(_0x59d28c,null));};exports[_0x4ab6('0x8e')]=function(_0x4e00ca,_0x215551,_0x31c387){return db[_0x4ab6('0x48')][_0x4ab6('0x72')]({'where':{'id':_0x4e00ca[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x215551,null))[_0x4ab6('0x22')](function(_0xa4f9ec){if(_0xa4f9ec){return _0xa4f9ec[_0x4ab6('0x8f')](null);}return null;})[_0x4ab6('0x22')](respondWithStatusCode(_0x215551,null))['catch'](handleError(_0x215551,null));};exports[_0x4ab6('0x90')]=function(_0x5868fb,_0x22c7e6,_0x4419a3){return db[_0x4ab6('0x91')][_0x4ab6('0x62')]({'where':{'id':_0x5868fb['params']['id']}})['then'](handleEntityNotFound(_0x22c7e6,null))[_0x4ab6('0x22')](function(_0x11ad14){if(_0x11ad14){return _0x11ad14[_0x4ab6('0x90')](_0x5868fb[_0x4ab6('0x64')]['ids'],_['omit'](_0x5868fb[_0x4ab6('0x64')],[_0x4ab6('0x6f'),'id'])||{});}})[_0x4ab6('0x22')](respondWithResult(_0x22c7e6,null))[_0x4ab6('0x2c')](handleError(_0x22c7e6,null));};exports[_0x4ab6('0x92')]=function(_0x74ff19,_0xd505ce,_0x20d4f1){var _0x249e7c={'raw':![],'where':{}};var _0x139612={};var _0x9d7f03={'count':0x0,'rows':[]};return db[_0x4ab6('0x48')][_0x4ab6('0x72')]({'where':{'id':_0x74ff19['params']['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0xd505ce,null))[_0x4ab6('0x22')](function(_0x23bf95){if(_0x23bf95){_0x139612['model']=_[_0x4ab6('0x61')](db['MailInteraction'][_0x4ab6('0x49')]);_0x139612['query']=_['keys'](_0x74ff19['query']);_0x139612[_0x4ab6('0x4f')]=_['intersection'](_0x139612[_0x4ab6('0x4d')],_0x139612[_0x4ab6('0x4e')]);_0x249e7c[_0x4ab6('0x52')]=_['intersection'](_0x139612[_0x4ab6('0x4d')],qs[_0x4ab6('0x51')](_0x74ff19['query'][_0x4ab6('0x51')]));_0x249e7c[_0x4ab6('0x52')]=_0x249e7c[_0x4ab6('0x52')]['length']?_0x249e7c['attributes']:_0x139612[_0x4ab6('0x4d')];if(!_0x74ff19[_0x4ab6('0x4e')][_0x4ab6('0x54')](_0x4ab6('0x6a'))){_0x249e7c[_0x4ab6('0x33')]=qs[_0x4ab6('0x33')](_0x74ff19[_0x4ab6('0x4e')]['limit']);_0x249e7c[_0x4ab6('0x31')]=qs[_0x4ab6('0x31')](_0x74ff19[_0x4ab6('0x4e')][_0x4ab6('0x31')]);}_0x249e7c['order']=qs[_0x4ab6('0x55')](_0x74ff19[_0x4ab6('0x4e')]['sort']);_0x249e7c[_0x4ab6('0x56')]=qs[_0x4ab6('0x4f')](_[_0x4ab6('0x6c')](_0x74ff19[_0x4ab6('0x4e')],_0x139612[_0x4ab6('0x4f')]));_0x249e7c[_0x4ab6('0x56')]['MailAccountId']=_0x23bf95['id'];if(_0x74ff19[_0x4ab6('0x4e')][_0x4ab6('0x57')]){_0x249e7c[_0x4ab6('0x56')]=_[_0x4ab6('0x59')](_0x249e7c[_0x4ab6('0x56')],{'$or':_['map'](_0x249e7c[_0x4ab6('0x52')],function(_0x2d207e){var _0x5e9b80={};_0x5e9b80[_0x2d207e]={'$like':'%'+_0x74ff19[_0x4ab6('0x4e')][_0x4ab6('0x57')]+'%'};return _0x5e9b80;})});}_0x249e7c=_[_0x4ab6('0x59')]({},_0x249e7c,_0x74ff19[_0x4ab6('0x5a')]);return db[_0x4ab6('0x91')]['count']({'where':_0x249e7c[_0x4ab6('0x56')]})[_0x4ab6('0x22')](function(_0x20da02){_0x9d7f03[_0x4ab6('0x34')]=_0x20da02;if(_0x74ff19[_0x4ab6('0x4e')]['includeAll']){_0x249e7c[_0x4ab6('0x5c')]=[{'model':db[_0x4ab6('0x93')],'as':_0x4ab6('0x94'),'required':![]},{'model':db[_0x4ab6('0x95')],'as':_0x4ab6('0x96'),'attributes':[_0x4ab6('0x3f'),'fullname',_0x4ab6('0x97')],'required':![]},{'model':db[_0x4ab6('0x98')],'as':_0x4ab6('0x99'),'attributes':['id','name',_0x4ab6('0x9a')],'where':_0x74ff19['query'][_0x4ab6('0x9b')]?{'id':_0x74ff19[_0x4ab6('0x4e')]['tag']}:undefined,'required':_0x74ff19['query'][_0x4ab6('0x9b')]?!![]:![]}];}return db[_0x4ab6('0x91')][_0x4ab6('0x73')](_0x249e7c);})[_0x4ab6('0x22')](function(_0x37e177){_0x9d7f03[_0x4ab6('0x5d')]=_0x37e177;return _0x9d7f03;});}})[_0x4ab6('0x22')](respondWithFilteredResult(_0xd505ce,_0x249e7c))['catch'](handleError(_0xd505ce,null));};exports[_0x4ab6('0x9c')]=function(_0x5596b2,_0x178ea2,_0x252950){return db[_0x4ab6('0x48')][_0x4ab6('0x72')]({'where':{'id':_0x5596b2[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x178ea2,null))['then'](function(_0x4c62cc){if(_0x4c62cc){return db[_0x4ab6('0x9d')]['transaction'](function(_0x455514){return db[_0x4ab6('0x9e')]['destroy']({'where':{'MailAccountId':_0x5596b2[_0x4ab6('0x5f')]['id']},'transaction':_0x455514})[_0x4ab6('0x22')](function(_0x5eb5ae){var _0x2f7493=_[_0x4ab6('0x47')](_0x5596b2[_0x4ab6('0x64')],function(_0x541111){_0x541111[_0x4ab6('0x67')]=_0x5596b2[_0x4ab6('0x5f')]['id'];return _0x541111;});return db[_0x4ab6('0x9e')][_0x4ab6('0x9f')](_0x2f7493,{'transaction':_0x455514});});})['then'](function(){return db['MailApplication'][_0x4ab6('0xa0')]({'where':{'MailAccountId':_0x5596b2[_0x4ab6('0x5f')]['id']},'order':_0x4ab6('0xa1')});});}})[_0x4ab6('0x22')](respondWithResult(_0x178ea2,null))[_0x4ab6('0x2c')](handleError(_0x178ea2,null));};exports[_0x4ab6('0xa2')]=function(_0x19bb34,_0x3f1232,_0x499d45){var _0x26d2b0={};var _0x4381b3={};var _0x506d00;var _0x2179c9;return db[_0x4ab6('0x48')]['findOne']({'where':{'id':_0x19bb34[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x3f1232,null))['then'](function(_0x22270b){if(_0x22270b){_0x506d00=_0x22270b;_0x4381b3['model']=_[_0x4ab6('0x61')](db[_0x4ab6('0x9e')][_0x4ab6('0x49')]);_0x4381b3[_0x4ab6('0x4e')]=_['keys'](_0x19bb34['query']);_0x4381b3[_0x4ab6('0x4f')]=_[_0x4ab6('0x50')](_0x4381b3[_0x4ab6('0x4d')],_0x4381b3['query']);_0x26d2b0[_0x4ab6('0x52')]=_['intersection'](_0x4381b3[_0x4ab6('0x4d')],qs[_0x4ab6('0x51')](_0x19bb34[_0x4ab6('0x4e')][_0x4ab6('0x51')]));_0x26d2b0[_0x4ab6('0x52')]=_0x26d2b0['attributes']['length']?_0x26d2b0['attributes']:_0x4381b3['model'];_0x26d2b0[_0x4ab6('0x6b')]=qs['sort'](_0x19bb34[_0x4ab6('0x4e')]['sort']);_0x26d2b0[_0x4ab6('0x56')]=qs[_0x4ab6('0x4f')](_['pick'](_0x19bb34['query'],_0x4381b3['filters']));if(_0x19bb34['query'][_0x4ab6('0x57')]){_0x26d2b0[_0x4ab6('0x56')]=_['merge'](_0x26d2b0['where'],{'$or':_[_0x4ab6('0x47')](_0x26d2b0[_0x4ab6('0x52')],function(_0x5974db){var _0x486979={};_0x486979[_0x5974db]={'$like':'%'+_0x19bb34[_0x4ab6('0x4e')][_0x4ab6('0x57')]+'%'};return _0x486979;})});}_0x26d2b0=_[_0x4ab6('0x59')]({},_0x26d2b0,_0x19bb34[_0x4ab6('0x5a')]);return _0x506d00[_0x4ab6('0xa2')](_0x26d2b0);}})[_0x4ab6('0x22')](function(_0x346b15){if(_0x346b15){_0x2179c9=_0x346b15[_0x4ab6('0x53')];if(!_0x19bb34[_0x4ab6('0x4e')][_0x4ab6('0x54')](_0x4ab6('0x6a'))){_0x26d2b0[_0x4ab6('0x33')]=qs[_0x4ab6('0x33')](_0x19bb34[_0x4ab6('0x4e')][_0x4ab6('0x33')]);_0x26d2b0['offset']=qs['offset'](_0x19bb34[_0x4ab6('0x4e')]['offset']);}return _0x506d00[_0x4ab6('0xa2')](_0x26d2b0);}})[_0x4ab6('0x22')](function(_0x2bffed){if(_0x2bffed){return _0x2bffed?{'count':_0x2179c9,'rows':_0x2bffed}:null;}})['then'](respondWithResult(_0x3f1232,null))['catch'](handleError(_0x3f1232,null));};exports[_0x4ab6('0xa3')]=function(_0x4e9c31,_0x7c62cf,_0x48fc8d){var _0x42f3f0={'raw':!![],'where':{}};var _0xf66a19={};var _0x4f575f={'count':0x0,'rows':[]};return db['MailAccount'][_0x4ab6('0x72')]({'where':{'id':_0x4e9c31['params']['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x7c62cf,null))[_0x4ab6('0x22')](function(_0x4c4550){if(_0x4c4550){_0xf66a19['model']=_[_0x4ab6('0x61')](db[_0x4ab6('0xa4')][_0x4ab6('0x49')]);_0xf66a19[_0x4ab6('0x4e')]=_['keys'](_0x4e9c31['query']);_0xf66a19[_0x4ab6('0x4f')]=_[_0x4ab6('0x50')](_0xf66a19['model'],_0xf66a19['query']);_0x42f3f0[_0x4ab6('0x52')]=_[_0x4ab6('0x50')](_0xf66a19[_0x4ab6('0x4d')],qs[_0x4ab6('0x51')](_0x4e9c31['query'][_0x4ab6('0x51')]));_0x42f3f0[_0x4ab6('0x52')]=_0x42f3f0[_0x4ab6('0x52')][_0x4ab6('0x53')]?_0x42f3f0[_0x4ab6('0x52')]:_0xf66a19['model'];if(!_0x4e9c31[_0x4ab6('0x4e')][_0x4ab6('0x54')](_0x4ab6('0x6a'))){_0x42f3f0[_0x4ab6('0x33')]=qs[_0x4ab6('0x33')](_0x4e9c31[_0x4ab6('0x4e')]['limit']);_0x42f3f0[_0x4ab6('0x31')]=qs['offset'](_0x4e9c31[_0x4ab6('0x4e')][_0x4ab6('0x31')]);}_0x42f3f0[_0x4ab6('0x6b')]=qs[_0x4ab6('0x55')](_0x4e9c31['query'][_0x4ab6('0x55')]);_0x42f3f0[_0x4ab6('0x56')]=qs[_0x4ab6('0x4f')](_[_0x4ab6('0x6c')](_0x4e9c31['query'],_0xf66a19['filters']));_0x42f3f0[_0x4ab6('0x56')][_0x4ab6('0x67')]=_0x4c4550['id'];if(_0x4e9c31[_0x4ab6('0x4e')][_0x4ab6('0x57')]){_0x42f3f0[_0x4ab6('0x56')]=_[_0x4ab6('0x59')](_0x42f3f0[_0x4ab6('0x56')],{'$or':_[_0x4ab6('0x47')](_0x42f3f0[_0x4ab6('0x52')],function(_0x40546d){var _0x279b26={};_0x279b26[_0x40546d]={'$like':'%'+_0x4e9c31[_0x4ab6('0x4e')][_0x4ab6('0x57')]+'%'};return _0x279b26;})});}if(_0x4e9c31[_0x4ab6('0x4e')]['$gte']){var _0x3bf2a2=_0x4e9c31[_0x4ab6('0x4e')][_0x4ab6('0xa5')][_0x4ab6('0xa6')](',');var _0x266b2a={};_0x266b2a[_0x3bf2a2[0x0]]={'$gte':moment(_0x3bf2a2[0x1])[_0x4ab6('0xa7')](_0x4ab6('0xa8'))};_0x42f3f0[_0x4ab6('0x56')]=_['merge'](_0x42f3f0['where'],_0x266b2a);}_0x42f3f0=_[_0x4ab6('0x59')]({},_0x42f3f0,_0x4e9c31[_0x4ab6('0x5a')]);return db[_0x4ab6('0xa4')][_0x4ab6('0x34')]({'where':_0x42f3f0[_0x4ab6('0x56')]})['then'](function(_0x1ed8d8){_0x4f575f['count']=_0x1ed8d8;if(_0x4e9c31[_0x4ab6('0x4e')][_0x4ab6('0x5b')]){_0x42f3f0[_0x4ab6('0x5c')]=[{'all':!![]}];}return db[_0x4ab6('0xa4')][_0x4ab6('0x73')](_0x42f3f0);})[_0x4ab6('0x22')](function(_0x22c06a){if(_0x4e9c31[_0x4ab6('0x4e')][_0x4ab6('0xa9')]===_0x4ab6('0xaa')){for(var _0x18a0d7=0x0;_0x18a0d7<_0x22c06a[_0x4ab6('0x53')];_0x18a0d7++){_0x22c06a[_0x18a0d7][_0x4ab6('0x64')]=juice(_0x22c06a[_0x18a0d7]['body']);}}_0x4f575f[_0x4ab6('0x5d')]=_0x22c06a;return _0x4f575f;});}})[_0x4ab6('0x22')](respondWithFilteredResult(_0x7c62cf,_0x42f3f0))[_0x4ab6('0x2c')](handleError(_0x7c62cf,null));};exports[_0x4ab6('0x40')]=function(_0x17d64a,_0x260fc9,_0x5c567a){var _0x45a9e5,_0x20b41c={},_0x118eac;if(_0x17d64a[_0x4ab6('0x64')]['to']){_0x118eac=_0x17d64a['body']['to']['split'](',')[0x0];}return db[_0x4ab6('0x48')]['find']({'where':{'id':_0x17d64a['params']['id']},'include':[{'model':db[_0x4ab6('0xab')],'as':_0x4ab6('0xac'),'include':[{'model':db['CmContact'],'as':_0x4ab6('0xad'),'where':{'email':_0x118eac},'limit':0x1,'order':[[_0x4ab6('0xae'),_0x4ab6('0xaf')]]}]},{'model':db[_0x4ab6('0x43')],'as':_0x4ab6('0x44'),'raw':!![]}]})[_0x4ab6('0x22')](handleEntityNotFound(_0x260fc9,null))[_0x4ab6('0x22')](function(_0x5c07eb){if(_0x5c07eb){_0x45a9e5=_0x5c07eb;if(_0x5c07eb['Smtp']){if(_[_0x4ab6('0x77')](_0x17d64a[_0x4ab6('0x64')]['from'])){_0x17d64a['body'][_0x4ab6('0xb0')]=util['format'](_0x4ab6('0xb1'),_0x5c07eb[_0x4ab6('0x3f')],_0x5c07eb[_0x4ab6('0x75')]||_0x5c07eb[_0x4ab6('0x44')][_0x4ab6('0x7c')]);}if(_0x17d64a[_0x4ab6('0x64')][_0x4ab6('0xb2')]&&_0x17d64a[_0x4ab6('0x64')][_0x4ab6('0xb2')][_0x4ab6('0x53')]){for(var _0x9c6846=0x0;_0x9c6846<_0x17d64a[_0x4ab6('0x64')]['attachments']['length'];_0x9c6846+=0x1){_0x17d64a['body'][_0x4ab6('0xb2')][_0x9c6846]={'filename':_0x17d64a[_0x4ab6('0x64')][_0x4ab6('0xb2')][_0x9c6846][_0x4ab6('0x3f')],'path':path[_0x4ab6('0xb3')](config[_0x4ab6('0xb4')],'server/files/attachments',_0x17d64a[_0x4ab6('0x64')][_0x4ab6('0xb2')][_0x9c6846][_0x4ab6('0xb5')])};}}var _0x34dccb={'tls':{'rejectUnauthorized':![]}};if(_[_0x4ab6('0x77')](_0x5c07eb['Smtp'][_0x4ab6('0x83')])){if(_0x5c07eb[_0x4ab6('0x44')][_0x4ab6('0x80')]){_0x34dccb[_0x4ab6('0xb6')]={'user':_0x5c07eb[_0x4ab6('0x44')][_0x4ab6('0x7c')],'pass':_0x5c07eb[_0x4ab6('0x44')]['pass']};}_0x34dccb[_0x4ab6('0x81')]=_0x5c07eb[_0x4ab6('0x44')][_0x4ab6('0x81')];_0x34dccb[_0x4ab6('0x82')]=_0x5c07eb[_0x4ab6('0x44')][_0x4ab6('0x82')];_0x34dccb[_0x4ab6('0xb7')]=_0x5c07eb[_0x4ab6('0x44')][_0x4ab6('0xb7')];}else{_0x34dccb[_0x4ab6('0x83')]=_0x5c07eb[_0x4ab6('0x44')][_0x4ab6('0x83')];_0x34dccb[_0x4ab6('0xb6')]={'user':_0x5c07eb[_0x4ab6('0x44')][_0x4ab6('0x7c')],'pass':_0x5c07eb[_0x4ab6('0x44')][_0x4ab6('0x84')]};}return respondWithRpcPromise(_0x4ab6('0xb8'),'sendMail',{'account':_0x34dccb,'message':_0x17d64a[_0x4ab6('0x64')]});}else{throw new Error(_0x4ab6('0xb9'));}}})[_0x4ab6('0x22')](function(_0x32645a){if(_0x32645a){_0x20b41c=_0x32645a;if(_0x45a9e5[_0x4ab6('0xac')]){if(_0x45a9e5[_0x4ab6('0xac')][_0x4ab6('0xad')][_0x4ab6('0x53')]){return _0x45a9e5['List'][_0x4ab6('0xad')][0x0];}else{return db[_0x4ab6('0x93')][_0x4ab6('0x68')](_[_0x4ab6('0x19')](_0x17d64a[_0x4ab6('0x64')],{'firstName':_0x17d64a[_0x4ab6('0x64')]['to'],'email':_0x17d64a[_0x4ab6('0x64')]['to'],'phone':_0x17d64a[_0x4ab6('0x64')]['to'],'ListId':_0x45a9e5[_0x4ab6('0x76')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x4ab6('0x22')](function(_0x3e7d94){if(_0x3e7d94){var _0x25abc8={'UserId':_0x17d64a[_0x4ab6('0x7c')]['id'],'ContactId':_0x3e7d94['id'],'MailAccountId':_0x45a9e5['id'],'inReplyTo':_0x20b41c['messageId'],'to':_0x17d64a[_0x4ab6('0x64')][_0x4ab6('0xb0')],'cc':_0x17d64a['body']['cc'],'subject':_0x17d64a[_0x4ab6('0x64')][_0x4ab6('0xba')],'attach':_0x17d64a['body'][_0x4ab6('0xbb')],'firstMsgDirection':_0x4ab6('0xbc'),'lastMsgAt':moment()[_0x4ab6('0xa7')](_0x4ab6('0xa8')),'lastMsgDirection':'out','Messages':[_[_0x4ab6('0x59')](_0x17d64a[_0x4ab6('0x64')],{'messageId':_0x20b41c[_0x4ab6('0xbd')],'sentAt':moment()[_0x4ab6('0xa7')](_0x4ab6('0xa8')),'read':!![],'MailAccountId':_0x45a9e5['id'],'UserId':_0x17d64a[_0x4ab6('0x7c')]['id'],'ContactId':_0x3e7d94['id']})]};if(_0x17d64a['body'][_0x4ab6('0xbe')]){_0x25abc8=_[_0x4ab6('0x59')](_0x25abc8,_0x17d64a['body'][_0x4ab6('0xbe')]);}return db[_0x4ab6('0x91')][_0x4ab6('0x68')](_0x25abc8,{'include':[{'model':db[_0x4ab6('0xa4')],'as':'Messages'}]});}})['then'](respondWithResult(_0x260fc9,null))['catch'](handleError(_0x260fc9,null));};exports[_0x4ab6('0xbf')]=function(_0x458c8c,_0x56c8a9,_0x469dd3){return db[_0x4ab6('0x48')][_0x4ab6('0x62')]({'where':{'id':_0x458c8c[_0x4ab6('0x5f')]['id']},'include':[{'model':db[_0x4ab6('0x43')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x56c8a9,null))[_0x4ab6('0x22')](function(_0x2e8a44){if(_0x2e8a44&&_0x2e8a44[_0x4ab6('0x44')]){var _0x463601={'id':_0x2e8a44['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2e8a44[_0x4ab6('0x44')]['service']){_0x463601[_0x4ab6('0x83')]=_0x2e8a44[_0x4ab6('0x44')][_0x4ab6('0x83')];}else{_0x463601[_0x4ab6('0x81')]=_0x2e8a44[_0x4ab6('0x44')][_0x4ab6('0x81')];_0x463601[_0x4ab6('0x82')]=_0x2e8a44[_0x4ab6('0x44')]['port'];_0x463601['secure']=_0x2e8a44[_0x4ab6('0x44')][_0x4ab6('0xb7')];}if(_0x2e8a44[_0x4ab6('0x44')][_0x4ab6('0x80')]){_0x463601['auth']={'user':_0x2e8a44[_0x4ab6('0x44')][_0x4ab6('0x7c')],'pass':_0x2e8a44['Smtp'][_0x4ab6('0x84')]};}return respondWithRpcPromise(_0x4ab6('0xc0'),_0x4ab6('0xbf'),{'account':_0x463601});}})['then'](respondWithResult(_0x56c8a9,null))[_0x4ab6('0x2c')](handleError(_0x56c8a9,null));};exports['destroy']=function(_0x1574ec,_0x2fb5c6){return db[_0x4ab6('0x48')][_0x4ab6('0x62')]({'where':{'id':_0x1574ec[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x2fb5c6,null))[_0x4ab6('0x22')](function(_0x496528){if(_0x496528&&_0x496528['service']){throw new db[(_0x4ab6('0xc1'))][(_0x4ab6('0xc2'))](_0x4ab6('0xc3'));}return _0x496528;})[_0x4ab6('0x22')](removeEntity(_0x2fb5c6,null))['catch'](handleError(_0x2fb5c6,null));};exports[_0x4ab6('0xc4')]=function(_0x178415,_0x30b9a5,_0xfb37a6){return db[_0x4ab6('0x48')][_0x4ab6('0x62')]({'where':{'id':_0x178415[_0x4ab6('0x5f')]['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x30b9a5,null))['then'](function(_0x4a65a0){if(_0x4a65a0){return _0x4a65a0[_0x4ab6('0xc4')](_0x178415[_0x4ab6('0x64')][_0x4ab6('0x6f')],_[_0x4ab6('0xc5')](_0x178415[_0x4ab6('0x64')],['ids','id'])||{})['spread'](function(_0xbd79d0){for(var _0x2ed24d=0x0;_0x2ed24d<_0x178415[_0x4ab6('0x64')][_0x4ab6('0x6f')][_0x4ab6('0x53')];_0x2ed24d+=0x1){socket[_0x4ab6('0xc6')](_0x4ab6('0xc7'),{'UserId':Number(_0x178415['body'][_0x4ab6('0x6f')][_0x2ed24d]),'MailAccountId':Number(_0x178415[_0x4ab6('0x5f')]['id'])});}return _0xbd79d0;});}})[_0x4ab6('0x22')](respondWithResult(_0x30b9a5,null))[_0x4ab6('0x2c')](handleError(_0x30b9a5,null));};exports['removeAgents']=function(_0x3d0430,_0x96a9,_0x37790d){return db['MailAccount'][_0x4ab6('0x62')]({'where':{'id':_0x3d0430['params']['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x96a9,null))[_0x4ab6('0x22')](function(_0x4ddd16){if(_0x4ddd16){return _0x4ddd16[_0x4ab6('0xc8')](_0x3d0430[_0x4ab6('0x4e')][_0x4ab6('0x6f')])[_0x4ab6('0x22')](function(){if(_[_0x4ab6('0xc9')](_0x3d0430[_0x4ab6('0x4e')][_0x4ab6('0x6f')])){for(var _0x4e5cd1=0x0;_0x4e5cd1<_0x3d0430[_0x4ab6('0x4e')][_0x4ab6('0x6f')][_0x4ab6('0x53')];_0x4e5cd1+=0x1){socket['emit'](_0x4ab6('0xca'),{'UserId':Number(_0x3d0430['query'][_0x4ab6('0x6f')][_0x4e5cd1]),'MailAccountId':Number(_0x3d0430[_0x4ab6('0x5f')]['id'])});}}else{socket[_0x4ab6('0xc6')](_0x4ab6('0xca'),{'UserId':Number(_0x3d0430[_0x4ab6('0x4e')][_0x4ab6('0x6f')]),'MailAccountId':Number(_0x3d0430['params']['id'])});}});}})[_0x4ab6('0x22')](respondWithStatusCode(_0x96a9,null))['catch'](handleError(_0x96a9,null));};exports[_0x4ab6('0xcb')]=function(_0x19771f,_0x39c2d7,_0x44f82d){var _0x1c3279={};var _0xea00fe={};var _0x54ef47;var _0x171f46;return db[_0x4ab6('0x48')]['findOne']({'where':{'id':_0x19771f['params']['id']}})[_0x4ab6('0x22')](handleEntityNotFound(_0x39c2d7,null))['then'](function(_0x233891){if(_0x233891){_0x54ef47=_0x233891;_0xea00fe[_0x4ab6('0x4d')]=_['keys'](db[_0x4ab6('0x95')][_0x4ab6('0x49')]);_0xea00fe['query']=_[_0x4ab6('0x61')](_0x19771f[_0x4ab6('0x4e')]);_0xea00fe[_0x4ab6('0x4f')]=_[_0x4ab6('0x50')](_0xea00fe[_0x4ab6('0x4d')],_0xea00fe[_0x4ab6('0x4e')]);_0x1c3279[_0x4ab6('0x52')]=_[_0x4ab6('0x50')](_0xea00fe['model'],qs[_0x4ab6('0x51')](_0x19771f[_0x4ab6('0x4e')][_0x4ab6('0x51')]));_0x1c3279[_0x4ab6('0x52')]=_0x1c3279['attributes'][_0x4ab6('0x53')]?_0x1c3279[_0x4ab6('0x52')]:_0xea00fe['model'];_0x1c3279[_0x4ab6('0x6b')]=qs[_0x4ab6('0x55')](_0x19771f[_0x4ab6('0x4e')][_0x4ab6('0x55')]);_0x1c3279[_0x4ab6('0x56')]=qs[_0x4ab6('0x4f')](_[_0x4ab6('0x6c')](_0x19771f[_0x4ab6('0x4e')],_0xea00fe['filters']));if(_0x19771f[_0x4ab6('0x4e')]['filter']){_0x1c3279[_0x4ab6('0x56')]=_['merge'](_0x1c3279['where'],{'$or':_['map'](_0x1c3279['attributes'],function(_0x3d8b76){var _0x28af0e={};_0x28af0e[_0x3d8b76]={'$like':'%'+_0x19771f['query'][_0x4ab6('0x57')]+'%'};return _0x28af0e;})});}_0x1c3279=_[_0x4ab6('0x59')]({},_0x1c3279,_0x19771f[_0x4ab6('0x5a')]);return _0x54ef47[_0x4ab6('0xcb')](_0x1c3279);}})[_0x4ab6('0x22')](function(_0x2ed113){if(_0x2ed113){_0x171f46=_0x2ed113[_0x4ab6('0x53')];if(!_0x19771f['query'][_0x4ab6('0x54')](_0x4ab6('0x6a'))){_0x1c3279[_0x4ab6('0x33')]=qs[_0x4ab6('0x33')](_0x19771f[_0x4ab6('0x4e')]['limit']);_0x1c3279[_0x4ab6('0x31')]=qs[_0x4ab6('0x31')](_0x19771f[_0x4ab6('0x4e')]['offset']);}return _0x54ef47[_0x4ab6('0xcb')](_0x1c3279);}})['then'](function(_0x2f9e71){if(_0x2f9e71){return _0x2f9e71?{'count':_0x171f46,'rows':_0x2f9e71}:null;}})[_0x4ab6('0x22')](respondWithResult(_0x39c2d7,null))[_0x4ab6('0x2c')](handleError(_0x39c2d7,null));}; \ No newline at end of file +var _0x6525=['bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','html-to-text','juice','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','show','params','Smtp','mandatoryDispositionPause','MailAccount','find','body','MailServerIn','describe','addDisposition','MailAccountId','create','findOne','Disposition','pick','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','email','ListId','isNil','active','description','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','internal','color','addApplications','sequelize','transaction','MailApplication'];(function(_0x4b215e,_0x159f2b){var _0x416b25=function(_0x285c4f){while(--_0x285c4f){_0x4b215e['push'](_0x4b215e['shift']());}};_0x416b25(++_0x159f2b);}(_0x6525,0x1ac));var _0x5652=function(_0x21c69c,_0x1b7535){_0x21c69c=_0x21c69c-0x0;var _0x2acd03=_0x6525[_0x21c69c];return _0x2acd03;};'use strict';var emlformat=require(_0x5652('0x0'));var rimraf=require(_0x5652('0x1'));var zipdir=require(_0x5652('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5652('0x3'));var Mustache=require(_0x5652('0x4'));var util=require(_0x5652('0x5'));var path=require(_0x5652('0x6'));var sox=require(_0x5652('0x7'));var csv=require(_0x5652('0x8'));var ejs=require(_0x5652('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5652('0xa'));var deskjs=require(_0x5652('0xb'));var toCsv=require(_0x5652('0x8'));var querystring=require('querystring');var Papa=require(_0x5652('0xc'));var htmlToText=require(_0x5652('0xd'));var juice=require(_0x5652('0xe'));var Redis=require(_0x5652('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5652('0x10'));var logger=require(_0x5652('0x11'))('api');var utils=require(_0x5652('0x12'));var config=require(_0x5652('0x13'));var licenseUtil=require(_0x5652('0x14'));var db=require(_0x5652('0x15'))['db'];config[_0x5652('0x16')]=_[_0x5652('0x17')](config[_0x5652('0x16')],{'host':_0x5652('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5652('0x16')]));require(_0x5652('0x19'))[_0x5652('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5652('0x1b')][_0x5652('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x5583f9,_0x5b977e,_0x2e2454,_0x2ff898){return new BPromise(function(_0x59597a,_0x3acca9){var _0x36bc43=_0x2ff898||client;return _0x36bc43['request'](_0x5583f9,_0x2e2454)[_0x5652('0x1d')](function(_0x2fad71){logger[_0x5652('0x1e')](_0x5652('0x1f'),_0x5b977e,_0x5652('0x20'));logger[_0x5652('0x21')](_0x5652('0x22'),_0x5b977e,'request\x20sent',JSON[_0x5652('0x23')](_0x2fad71));if(_0x2fad71['error']){if(_0x2fad71[_0x5652('0x24')][_0x5652('0x25')]===0x1f4){logger[_0x5652('0x24')](_0x5652('0x1f'),_0x5b977e,_0x2fad71[_0x5652('0x24')][_0x5652('0x26')]);return _0x3acca9(_0x2fad71[_0x5652('0x24')][_0x5652('0x26')]);}logger[_0x5652('0x24')](_0x5652('0x1f'),_0x5b977e,_0x2fad71[_0x5652('0x24')][_0x5652('0x26')]);return _0x59597a(_0x2fad71['error'][_0x5652('0x26')]);}else{logger['info'](_0x5652('0x1f'),_0x5b977e,_0x5652('0x20'));_0x59597a(_0x2fad71[_0x5652('0x27')]['message']);}})[_0x5652('0x28')](function(_0x1a1ade){logger[_0x5652('0x24')]('MailAccount,\x20%s,\x20%s',_0x5b977e,_0x1a1ade);_0x3acca9(_0x1a1ade);});});}function respondWithStatusCode(_0xe1871a,_0x509d9c){_0x509d9c=_0x509d9c||0xcc;return function(_0x13c12e){if(_0x13c12e){return _0xe1871a[_0x5652('0x29')](_0x509d9c);}return _0xe1871a['status'](_0x509d9c)['end']();};}function respondWithResult(_0x3ee3ae,_0x231ca9){_0x231ca9=_0x231ca9||0xc8;return function(_0x5f3ea2){if(_0x5f3ea2){return _0x3ee3ae[_0x5652('0x2a')](_0x231ca9)['json'](_0x5f3ea2);}};}function respondWithFilteredResult(_0x2af6ca,_0x2de10c){return function(_0x204661){if(_0x204661){var _0x4c6557=typeof _0x2de10c['offset']===_0x5652('0x2b')&&typeof _0x2de10c[_0x5652('0x2c')]==='undefined';var _0x202beb=_0x204661[_0x5652('0x2d')];var _0x58bf07=_0x4c6557?0x0:_0x2de10c[_0x5652('0x2e')];var _0x426c1f=_0x4c6557?_0x204661[_0x5652('0x2d')]:_0x2de10c[_0x5652('0x2e')]+_0x2de10c[_0x5652('0x2c')];var _0x195954;if(_0x426c1f>=_0x202beb){_0x426c1f=_0x202beb;_0x195954=0xc8;}else{_0x195954=0xce;}_0x2af6ca[_0x5652('0x2a')](_0x195954);return _0x2af6ca[_0x5652('0x2f')](_0x5652('0x30'),_0x58bf07+'-'+_0x426c1f+'/'+_0x202beb)['json'](_0x204661);}return null;};}function patchUpdates(_0x15e39d){return function(_0x4be8a3){try{jsonpatch[_0x5652('0x31')](_0x4be8a3,_0x15e39d,!![]);}catch(_0x596d93){return BPromise[_0x5652('0x32')](_0x596d93);}return _0x4be8a3[_0x5652('0x33')]();};}function saveUpdates(_0x334269,_0x5e140e){return function(_0x58ca08){if(_0x58ca08){return _0x58ca08[_0x5652('0x34')](_0x334269)[_0x5652('0x1d')](function(_0x46f1ae){return _0x46f1ae;});}return null;};}function removeEntity(_0x2160e7,_0x6330e9){return function(_0x5d76c7){if(_0x5d76c7){return _0x5d76c7[_0x5652('0x35')]()[_0x5652('0x1d')](function(){var _0x1c3e33=_0x5d76c7[_0x5652('0x36')]({'plain':!![]});var _0x4acbf9='MailAccounts';return db[_0x5652('0x37')][_0x5652('0x35')]({'where':{'type':_0x4acbf9,'resourceId':_0x1c3e33['id']}})['then'](function(){return _0x5d76c7;});})[_0x5652('0x1d')](function(){_0x2160e7[_0x5652('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x598c75,_0x33e8eb){return function(_0x43a3b5){if(!_0x43a3b5){_0x598c75[_0x5652('0x29')](0x194);}return _0x43a3b5;};}function handleError(_0x193153,_0x5b946f){_0x5b946f=_0x5b946f||0x1f4;return function(_0x1e0a32){logger[_0x5652('0x24')](_0x1e0a32[_0x5652('0x38')]);if(_0x1e0a32[_0x5652('0x39')]){delete _0x1e0a32['name'];}_0x193153['status'](_0x5b946f)[_0x5652('0x3a')](_0x1e0a32);};}exports[_0x5652('0x3b')]=function(_0x34f31e,_0x528515){var _0x8a9ebe={'include':[{'model':db['MailServerIn'],'as':_0x5652('0x3c')},{'model':db[_0x5652('0x3d')],'as':'Smtp'},{'model':db[_0x5652('0x3e')],'as':'mandatoryDispositionPause'}]},_0x52901b={},_0x830499={'count':0x0,'rows':[]};var _0x24de86=_[_0x5652('0x3f')](db['MailAccount'][_0x5652('0x40')],function(_0x27993d){return{'name':_0x27993d[_0x5652('0x41')],'type':_0x27993d[_0x5652('0x42')][_0x5652('0x43')]};});_0x52901b[_0x5652('0x44')]=_[_0x5652('0x3f')](_0x24de86,_0x5652('0x39'));_0x52901b[_0x5652('0x45')]=_[_0x5652('0x46')](_0x34f31e[_0x5652('0x45')]);_0x52901b['filters']=_['intersection'](_0x52901b[_0x5652('0x44')],_0x52901b[_0x5652('0x45')]);_0x8a9ebe[_0x5652('0x47')]=_[_0x5652('0x48')](_0x52901b[_0x5652('0x44')],qs[_0x5652('0x49')](_0x34f31e[_0x5652('0x45')][_0x5652('0x49')]));_0x8a9ebe[_0x5652('0x47')]=_0x8a9ebe[_0x5652('0x47')][_0x5652('0x4a')]?_0x8a9ebe[_0x5652('0x47')]:_0x52901b['model'];if(!_0x34f31e['query'][_0x5652('0x4b')](_0x5652('0x4c'))){_0x8a9ebe[_0x5652('0x2c')]=qs['limit'](_0x34f31e[_0x5652('0x45')][_0x5652('0x2c')]);_0x8a9ebe[_0x5652('0x2e')]=qs[_0x5652('0x2e')](_0x34f31e['query'][_0x5652('0x2e')]);}_0x8a9ebe[_0x5652('0x4d')]=qs['sort'](_0x34f31e[_0x5652('0x45')][_0x5652('0x4e')]);_0x8a9ebe[_0x5652('0x4f')]=qs['filters'](_['pick'](_0x34f31e['query'],_0x52901b[_0x5652('0x50')]),_0x24de86);if(_0x34f31e[_0x5652('0x45')][_0x5652('0x51')]){_0x8a9ebe[_0x5652('0x4f')]=_[_0x5652('0x52')](_0x8a9ebe[_0x5652('0x4f')],{'$or':_[_0x5652('0x3f')](_0x24de86,function(_0x1eb5ec){if(_0x1eb5ec[_0x5652('0x42')]!==_0x5652('0x53')){var _0x3449ae={};_0x3449ae[_0x1eb5ec[_0x5652('0x39')]]={'$like':'%'+_0x34f31e['query'][_0x5652('0x51')]+'%'};return _0x3449ae;}})});}_0x8a9ebe=_['merge']({},_0x8a9ebe,_0x34f31e[_0x5652('0x54')]);var _0x4e1f53={'where':_0x8a9ebe[_0x5652('0x4f')]};return db['MailAccount'][_0x5652('0x2d')](_0x4e1f53)[_0x5652('0x1d')](function(_0x370be4){_0x830499['count']=_0x370be4;if(_0x34f31e[_0x5652('0x45')][_0x5652('0x55')]){_0x8a9ebe[_0x5652('0x56')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x8a9ebe);})[_0x5652('0x1d')](function(_0x4d42f1){_0x830499['rows']=_0x4d42f1;return _0x830499;})[_0x5652('0x1d')](respondWithFilteredResult(_0x528515,_0x8a9ebe))['catch'](handleError(_0x528515,null));};exports[_0x5652('0x57')]=function(_0x5b4f27,_0x40982c){var _0x5084a0={'raw':![],'where':{'id':_0x5b4f27[_0x5652('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x5652('0x3c')},{'model':db[_0x5652('0x3d')],'as':_0x5652('0x59')},{'model':db[_0x5652('0x3e')],'as':_0x5652('0x5a')}]},_0xf244a7={};_0xf244a7[_0x5652('0x44')]=_[_0x5652('0x46')](db[_0x5652('0x5b')][_0x5652('0x40')]);_0xf244a7[_0x5652('0x45')]=_['keys'](_0x5b4f27[_0x5652('0x45')]);_0xf244a7[_0x5652('0x50')]=_['intersection'](_0xf244a7['model'],_0xf244a7['query']);_0x5084a0['attributes']=_[_0x5652('0x48')](_0xf244a7[_0x5652('0x44')],qs[_0x5652('0x49')](_0x5b4f27[_0x5652('0x45')]['fields']));_0x5084a0[_0x5652('0x47')]=_0x5084a0[_0x5652('0x47')]['length']?_0x5084a0[_0x5652('0x47')]:_0xf244a7[_0x5652('0x44')];if(_0x5b4f27[_0x5652('0x45')][_0x5652('0x55')]){_0x5084a0['include']=[{'all':!![]}];}_0x5084a0=_['merge']({},_0x5084a0,_0x5b4f27[_0x5652('0x54')]);return db['MailAccount'][_0x5652('0x5c')](_0x5084a0)[_0x5652('0x1d')](handleEntityNotFound(_0x40982c,null))['then'](respondWithResult(_0x40982c,null))[_0x5652('0x28')](handleError(_0x40982c,null));};exports[_0x5652('0x34')]=function(_0x16bf9e,_0x37ee46){if(_0x16bf9e[_0x5652('0x5d')]['id']){delete _0x16bf9e[_0x5652('0x5d')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x16bf9e[_0x5652('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x5652('0x3c')},{'model':db[_0x5652('0x3d')],'as':_0x5652('0x59')},{'model':db[_0x5652('0x3e')],'as':_0x5652('0x5a')}]})[_0x5652('0x1d')](handleEntityNotFound(_0x37ee46,null))['then'](saveUpdates(_0x16bf9e[_0x5652('0x5d')],null))[_0x5652('0x1d')](function(_0x45d7d6){if(_0x45d7d6&&_0x16bf9e[_0x5652('0x5d')][_0x5652('0x3c')]){return db[_0x5652('0x5e')][_0x5652('0x34')](_0x16bf9e[_0x5652('0x5d')][_0x5652('0x3c')],{'where':{'MailAccountId':_0x45d7d6['id']}})[_0x5652('0x1d')](function(){return _0x45d7d6;});}return _0x45d7d6;})[_0x5652('0x1d')](function(_0x459dcc){if(_0x459dcc&&_0x16bf9e['body'][_0x5652('0x59')]){return db['MailServerOut'][_0x5652('0x34')](_0x16bf9e[_0x5652('0x5d')][_0x5652('0x59')],{'where':{'MailAccountId':_0x459dcc['id']}})[_0x5652('0x1d')](function(){return _0x459dcc;});}return _0x459dcc;})[_0x5652('0x1d')](respondWithResult(_0x37ee46,null))[_0x5652('0x28')](handleError(_0x37ee46,null));};exports[_0x5652('0x5f')]=function(_0x153f08,_0x4d5837){return db['MailAccount'][_0x5652('0x5f')]()[_0x5652('0x1d')](respondWithResult(_0x4d5837,null))['catch'](handleError(_0x4d5837,null));};exports[_0x5652('0x60')]=function(_0xcb1d0a,_0x5286e0,_0xc9abda){if(_0xcb1d0a[_0x5652('0x5d')]['id']){delete _0xcb1d0a['body']['id'];}return db[_0x5652('0x5b')][_0x5652('0x5c')]({'where':{'id':_0xcb1d0a[_0x5652('0x58')]['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x5286e0,null))['then'](function(_0x2f22e7){if(_0x2f22e7){_0xcb1d0a[_0x5652('0x5d')][_0x5652('0x61')]=_0x2f22e7['id'];return db['Disposition'][_0x5652('0x62')](_0xcb1d0a[_0x5652('0x5d')]);}})[_0x5652('0x1d')](respondWithResult(_0x5286e0,null))['catch'](handleError(_0x5286e0,null));};exports['getDispositions']=function(_0x48e896,_0x5e9947,_0x8bc928){var _0x1c0013={'raw':![],'where':{}};var _0x3d593a={};var _0x4d4800={'count':0x0,'rows':[]};return db['MailAccount'][_0x5652('0x63')]({'where':{'id':_0x48e896[_0x5652('0x58')]['id']}})['then'](handleEntityNotFound(_0x5e9947,null))[_0x5652('0x1d')](function(_0x1072b5){if(_0x1072b5){_0x3d593a['model']=_[_0x5652('0x46')](db[_0x5652('0x64')][_0x5652('0x40')]);_0x3d593a['query']=_['keys'](_0x48e896[_0x5652('0x45')]);_0x3d593a['filters']=_[_0x5652('0x48')](_0x3d593a[_0x5652('0x44')],_0x3d593a[_0x5652('0x45')]);_0x1c0013[_0x5652('0x47')]=_[_0x5652('0x48')](_0x3d593a[_0x5652('0x44')],qs[_0x5652('0x49')](_0x48e896[_0x5652('0x45')][_0x5652('0x49')]));_0x1c0013['attributes']=_0x1c0013['attributes'][_0x5652('0x4a')]?_0x1c0013[_0x5652('0x47')]:_0x3d593a[_0x5652('0x44')];if(!_0x48e896[_0x5652('0x45')][_0x5652('0x4b')]('nolimit')){_0x1c0013[_0x5652('0x2c')]=qs[_0x5652('0x2c')](_0x48e896[_0x5652('0x45')]['limit']);_0x1c0013[_0x5652('0x2e')]=qs[_0x5652('0x2e')](_0x48e896[_0x5652('0x45')][_0x5652('0x2e')]);}_0x1c0013[_0x5652('0x4d')]=qs[_0x5652('0x4e')](_0x48e896[_0x5652('0x45')][_0x5652('0x4e')]);_0x1c0013[_0x5652('0x4f')]=qs[_0x5652('0x50')](_[_0x5652('0x65')](_0x48e896['query'],_0x3d593a[_0x5652('0x50')]));_0x1c0013[_0x5652('0x4f')][_0x5652('0x61')]=_0x1072b5['id'];if(_0x48e896[_0x5652('0x45')][_0x5652('0x51')]){_0x1c0013[_0x5652('0x4f')]=_['merge'](_0x1c0013[_0x5652('0x4f')],{'$or':_[_0x5652('0x3f')](_0x1c0013[_0x5652('0x47')],function(_0x5a44a6){var _0x18d51b={};_0x18d51b[_0x5a44a6]={'$like':'%'+_0x48e896['query'][_0x5652('0x51')]+'%'};return _0x18d51b;})});}_0x1c0013=_[_0x5652('0x52')]({},_0x1c0013,_0x48e896[_0x5652('0x54')]);return db[_0x5652('0x64')][_0x5652('0x2d')]({'where':_0x1c0013[_0x5652('0x4f')]})[_0x5652('0x1d')](function(_0x59eb06){_0x4d4800[_0x5652('0x2d')]=_0x59eb06;if(_0x48e896[_0x5652('0x45')]['includeAll']){_0x1c0013[_0x5652('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x5652('0x66')](_0x1c0013);})['then'](function(_0x939fce){_0x4d4800[_0x5652('0x67')]=_0x939fce;return _0x4d4800;});}})['then'](respondWithFilteredResult(_0x5e9947,_0x1c0013))['catch'](handleError(_0x5e9947,null));};exports[_0x5652('0x68')]=function(_0x17d57b,_0x1776f8,_0x3fc920){return db['MailAccount']['find']({'where':{'id':_0x17d57b[_0x5652('0x58')]['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x1776f8,null))['then'](function(_0x2c4f58){if(_0x2c4f58){return _0x2c4f58['removeDispositions'](_0x17d57b[_0x5652('0x45')][_0x5652('0x69')]);}})[_0x5652('0x1d')](respondWithStatusCode(_0x1776f8,null))[_0x5652('0x28')](handleError(_0x1776f8,null));};exports[_0x5652('0x6a')]=function(_0x50b429,_0x3a9fdf,_0x42b046){if(_0x50b429['body']['id']){delete _0x50b429[_0x5652('0x5d')]['id'];}return db[_0x5652('0x5b')]['find']({'where':{'id':_0x50b429['params']['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x3a9fdf,null))[_0x5652('0x1d')](function(_0x14d744){if(_0x14d744){_0x50b429[_0x5652('0x5d')][_0x5652('0x61')]=_0x14d744['id'];return db[_0x5652('0x6b')][_0x5652('0x62')](_0x50b429['body']);}})[_0x5652('0x1d')](respondWithResult(_0x3a9fdf,null))[_0x5652('0x28')](handleError(_0x3a9fdf,null));};exports[_0x5652('0x6c')]=function(_0x2e0538,_0x2a495c,_0x4b333e){var _0xcf009a={'raw':![],'where':{}};var _0x3eedfe={};var _0x17a8a4={'count':0x0,'rows':[]};return db[_0x5652('0x5b')][_0x5652('0x63')]({'where':{'id':_0x2e0538[_0x5652('0x58')]['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x2a495c,null))[_0x5652('0x1d')](function(_0x1bd162){if(_0x1bd162){_0x3eedfe[_0x5652('0x44')]=_[_0x5652('0x46')](db['CannedAnswer']['rawAttributes']);_0x3eedfe[_0x5652('0x45')]=_['keys'](_0x2e0538['query']);_0x3eedfe[_0x5652('0x50')]=_[_0x5652('0x48')](_0x3eedfe[_0x5652('0x44')],_0x3eedfe['query']);_0xcf009a[_0x5652('0x47')]=_['intersection'](_0x3eedfe[_0x5652('0x44')],qs['fields'](_0x2e0538['query'][_0x5652('0x49')]));_0xcf009a[_0x5652('0x47')]=_0xcf009a[_0x5652('0x47')]['length']?_0xcf009a[_0x5652('0x47')]:_0x3eedfe['model'];if(!_0x2e0538[_0x5652('0x45')][_0x5652('0x4b')](_0x5652('0x4c'))){_0xcf009a[_0x5652('0x2c')]=qs['limit'](_0x2e0538['query'][_0x5652('0x2c')]);_0xcf009a[_0x5652('0x2e')]=qs['offset'](_0x2e0538[_0x5652('0x45')][_0x5652('0x2e')]);}_0xcf009a['order']=qs[_0x5652('0x4e')](_0x2e0538[_0x5652('0x45')][_0x5652('0x4e')]);_0xcf009a['where']=qs[_0x5652('0x50')](_['pick'](_0x2e0538['query'],_0x3eedfe[_0x5652('0x50')]));_0xcf009a[_0x5652('0x4f')][_0x5652('0x61')]=_0x1bd162['id'];if(_0x2e0538[_0x5652('0x45')][_0x5652('0x51')]){_0xcf009a[_0x5652('0x4f')]=_[_0x5652('0x52')](_0xcf009a[_0x5652('0x4f')],{'$or':_[_0x5652('0x3f')](_0xcf009a[_0x5652('0x47')],function(_0x42426f){var _0x1a73ff={};_0x1a73ff[_0x42426f]={'$like':'%'+_0x2e0538[_0x5652('0x45')][_0x5652('0x51')]+'%'};return _0x1a73ff;})});}_0xcf009a=_[_0x5652('0x52')]({},_0xcf009a,_0x2e0538[_0x5652('0x54')]);return db[_0x5652('0x6b')][_0x5652('0x2d')]({'where':_0xcf009a[_0x5652('0x4f')]})[_0x5652('0x1d')](function(_0x4fc3b8){_0x17a8a4[_0x5652('0x2d')]=_0x4fc3b8;if(_0x2e0538[_0x5652('0x45')]['includeAll']){_0xcf009a[_0x5652('0x56')]=[{'all':!![]}];}return db[_0x5652('0x6b')][_0x5652('0x66')](_0xcf009a);})[_0x5652('0x1d')](function(_0x5d5adf){_0x17a8a4[_0x5652('0x67')]=_0x5d5adf;return _0x17a8a4;});}})[_0x5652('0x1d')](respondWithFilteredResult(_0x2a495c,_0xcf009a))[_0x5652('0x28')](handleError(_0x2a495c,null));};exports['removeAnswers']=function(_0xede866,_0x41b539,_0x22a4fc){return db[_0x5652('0x5b')]['find']({'where':{'id':_0xede866[_0x5652('0x58')]['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x41b539,null))[_0x5652('0x1d')](function(_0x259b1e){if(_0x259b1e){return _0x259b1e['removeAnswers'](_0xede866['query']['ids']);}})[_0x5652('0x1d')](respondWithStatusCode(_0x41b539,null))[_0x5652('0x28')](handleError(_0x41b539,null));};exports[_0x5652('0x62')]=function(_0x5bd8bf,_0x27797c){var _0x123091={'name':_0x5bd8bf['body'][_0x5652('0x39')],'key':_0x5bd8bf['body'][_0x5652('0x43')],'email':_0x5bd8bf[_0x5652('0x5d')][_0x5652('0x6d')],'ListId':_0x5bd8bf[_0x5652('0x5d')][_0x5652('0x6e')],'active':!_[_0x5652('0x6f')](_0x5bd8bf['body'][_0x5652('0x70')])?_0x5bd8bf[_0x5652('0x5d')][_0x5652('0x70')]:!![],'description':_0x5bd8bf['body'][_0x5652('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0x5652('0x6f')](_0x5bd8bf[_0x5652('0x5d')][_0x5652('0x72')])){if(_0x5bd8bf[_0x5652('0x5d')]['cauthentication']){_0x123091[_0x5652('0x3c')][_0x5652('0x73')]=_0x123091[_0x5652('0x59')][_0x5652('0x73')]=_0x5bd8bf[_0x5652('0x5d')][_0x5652('0x74')];_0x123091[_0x5652('0x3c')][_0x5652('0x75')]=_0x123091[_0x5652('0x59')][_0x5652('0x76')]=_0x5bd8bf[_0x5652('0x5d')][_0x5652('0x77')];}else{_0x123091[_0x5652('0x3c')][_0x5652('0x78')]=_0x123091[_0x5652('0x59')]['authentication']=![];}_0x123091[_0x5652('0x3c')][_0x5652('0x79')]=_0x5bd8bf[_0x5652('0x5d')]['Imap'][_0x5652('0x79')];_0x123091[_0x5652('0x3c')][_0x5652('0x7a')]=_0x5bd8bf[_0x5652('0x5d')][_0x5652('0x3c')]['port'];_0x123091[_0x5652('0x59')][_0x5652('0x79')]=_0x5bd8bf['body'][_0x5652('0x59')][_0x5652('0x79')];_0x123091[_0x5652('0x59')][_0x5652('0x7a')]=_0x5bd8bf['body'][_0x5652('0x59')][_0x5652('0x7a')];}else{_0x123091[_0x5652('0x3c')][_0x5652('0x7b')]=_0x123091[_0x5652('0x59')][_0x5652('0x7b')]=_0x5bd8bf[_0x5652('0x5d')][_0x5652('0x72')];_0x123091[_0x5652('0x3c')][_0x5652('0x73')]=_0x123091[_0x5652('0x59')]['user']=_0x5bd8bf['body'][_0x5652('0x74')];_0x123091[_0x5652('0x3c')][_0x5652('0x75')]=_0x123091['Smtp'][_0x5652('0x76')]=_0x5bd8bf[_0x5652('0x5d')][_0x5652('0x77')];}return db[_0x5652('0x5b')][_0x5652('0x62')](_0x123091,{'include':[{'model':db['MailServerOut'],'as':_0x5652('0x59')},{'model':db[_0x5652('0x5e')],'as':_0x5652('0x3c')}]})[_0x5652('0x1d')](function(_0x359221){var _0x34da72=_0x5bd8bf[_0x5652('0x73')][_0x5652('0x36')]({'plain':!![]});if(!_0x34da72)throw new Error(_0x5652('0x7c'));if(_0x34da72[_0x5652('0x7d')]===_0x5652('0x73')){var _0x4e80f5=_0x359221[_0x5652('0x36')]({'plain':!![]});return db[_0x5652('0x7e')][_0x5652('0x5c')]({'where':{'name':_0x5652('0x7f'),'userProfileId':_0x34da72[_0x5652('0x80')]},'raw':!![]})['then'](function(_0x1bb302){if(_0x1bb302&&_0x1bb302[_0x5652('0x81')]===0x0){return db[_0x5652('0x37')]['create']({'name':_0x4e80f5[_0x5652('0x39')],'resourceId':_0x4e80f5['id'],'type':_0x1bb302[_0x5652('0x39')],'sectionId':_0x1bb302['id']},{})[_0x5652('0x1d')](function(){return _0x359221;});}else{return _0x359221;}})[_0x5652('0x28')](function(_0x4e6825){logger[_0x5652('0x24')](_0x5652('0x82'),_0x4e6825);throw _0x4e6825;});}return _0x359221;})[_0x5652('0x1d')](respondWithResult(_0x27797c,0xc9))[_0x5652('0x28')](handleError(_0x27797c,null));};exports[_0x5652('0x83')]=function(_0x5e812d,_0x397fb5,_0x5dd031){return db[_0x5652('0x5b')][_0x5652('0x63')]({'where':{'id':_0x5e812d[_0x5652('0x58')]['id']}})['then'](handleEntityNotFound(_0x397fb5,null))[_0x5652('0x1d')](function(_0x5a8b76){if(_0x5a8b76){return _0x5a8b76[_0x5652('0x83')]();}return null;})['then'](respondWithResult(_0x397fb5,null))[_0x5652('0x28')](handleError(_0x397fb5,null));};exports[_0x5652('0x84')]=function(_0x49347b,_0x1efe1a,_0x34a6bf){if(_0x49347b[_0x5652('0x5d')]['id']){delete _0x49347b['body']['id'];}return db[_0x5652('0x5b')][_0x5652('0x5c')]({'where':{'id':_0x49347b[_0x5652('0x58')]['id']}})['then'](handleEntityNotFound(_0x1efe1a,null))[_0x5652('0x1d')](function(_0x265af0){if(_0x265af0){_0x49347b[_0x5652('0x5d')][_0x5652('0x61')]=_0x265af0['id'];return db[_0x5652('0x5e')][_0x5652('0x62')](_0x49347b[_0x5652('0x5d')]);}})[_0x5652('0x1d')](respondWithResult(_0x1efe1a,null))[_0x5652('0x28')](handleError(_0x1efe1a,null));};exports[_0x5652('0x85')]=function(_0x2322a4,_0x1ef37f,_0x29cf3a){return db[_0x5652('0x5b')][_0x5652('0x63')]({'where':{'id':_0x2322a4[_0x5652('0x58')]['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x1ef37f,null))[_0x5652('0x1d')](function(_0x380103){if(_0x380103){return _0x380103[_0x5652('0x86')](null);}return null;})[_0x5652('0x1d')](respondWithStatusCode(_0x1ef37f,null))[_0x5652('0x28')](handleError(_0x1ef37f,null));};exports[_0x5652('0x87')]=function(_0x236a1f,_0x293b16,_0x4d8165){return db[_0x5652('0x5b')][_0x5652('0x63')]({'where':{'id':_0x236a1f['params']['id']}})['then'](handleEntityNotFound(_0x293b16,null))['then'](function(_0x4461f5){if(_0x4461f5){return _0x4461f5[_0x5652('0x87')]();}return null;})[_0x5652('0x1d')](respondWithResult(_0x293b16,null))[_0x5652('0x28')](handleError(_0x293b16,null));};exports[_0x5652('0x88')]=function(_0x3e8d21,_0x3de32c,_0x2595b7){if(_0x3e8d21[_0x5652('0x5d')]['id']){delete _0x3e8d21[_0x5652('0x5d')]['id'];}return db[_0x5652('0x5b')][_0x5652('0x5c')]({'where':{'id':_0x3e8d21[_0x5652('0x58')]['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x3de32c,null))[_0x5652('0x1d')](function(_0x58650f){if(_0x58650f){_0x3e8d21[_0x5652('0x5d')][_0x5652('0x61')]=_0x58650f['id'];return db['MailServerOut']['create'](_0x3e8d21['body']);}})['then'](respondWithResult(_0x3de32c,null))[_0x5652('0x28')](handleError(_0x3de32c,null));};exports[_0x5652('0x89')]=function(_0x56fae7,_0x2f8cb3,_0xc73ad5){return db[_0x5652('0x5b')][_0x5652('0x63')]({'where':{'id':_0x56fae7[_0x5652('0x58')]['id']}})['then'](handleEntityNotFound(_0x2f8cb3,null))[_0x5652('0x1d')](function(_0x2943c3){if(_0x2943c3){return _0x2943c3['setSmtp'](null);}return null;})[_0x5652('0x1d')](respondWithStatusCode(_0x2f8cb3,null))[_0x5652('0x28')](handleError(_0x2f8cb3,null));};exports[_0x5652('0x8a')]=function(_0x5cb7e3,_0x3b6c9a,_0x8bfb6e){return db['MailInteraction'][_0x5652('0x5c')]({'where':{'id':_0x5cb7e3['params']['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x3b6c9a,null))[_0x5652('0x1d')](function(_0x3f17f6){if(_0x3f17f6){return _0x3f17f6[_0x5652('0x8a')](_0x5cb7e3[_0x5652('0x5d')][_0x5652('0x69')],_['omit'](_0x5cb7e3[_0x5652('0x5d')],['ids','id'])||{});}})['then'](respondWithResult(_0x3b6c9a,null))[_0x5652('0x28')](handleError(_0x3b6c9a,null));};exports[_0x5652('0x8b')]=function(_0x809603,_0x5ee0a8,_0x3fd891){var _0x2c7693={'raw':![],'where':{}};var _0x157839={};var _0x33caf9={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x809603[_0x5652('0x58')]['id']}})['then'](handleEntityNotFound(_0x5ee0a8,null))[_0x5652('0x1d')](function(_0x2f9dc7){if(_0x2f9dc7){_0x157839[_0x5652('0x44')]=_[_0x5652('0x46')](db[_0x5652('0x8c')][_0x5652('0x40')]);_0x157839[_0x5652('0x45')]=_['keys'](_0x809603[_0x5652('0x45')]);_0x157839['filters']=_[_0x5652('0x48')](_0x157839[_0x5652('0x44')],_0x157839['query']);_0x2c7693['attributes']=_[_0x5652('0x48')](_0x157839[_0x5652('0x44')],qs[_0x5652('0x49')](_0x809603[_0x5652('0x45')]['fields']));_0x2c7693['attributes']=_0x2c7693[_0x5652('0x47')][_0x5652('0x4a')]?_0x2c7693[_0x5652('0x47')]:_0x157839[_0x5652('0x44')];if(!_0x809603[_0x5652('0x45')][_0x5652('0x4b')](_0x5652('0x4c'))){_0x2c7693['limit']=qs[_0x5652('0x2c')](_0x809603[_0x5652('0x45')][_0x5652('0x2c')]);_0x2c7693[_0x5652('0x2e')]=qs['offset'](_0x809603[_0x5652('0x45')][_0x5652('0x2e')]);}_0x2c7693['order']=qs[_0x5652('0x4e')](_0x809603[_0x5652('0x45')]['sort']);_0x2c7693[_0x5652('0x4f')]=qs[_0x5652('0x50')](_['pick'](_0x809603[_0x5652('0x45')],_0x157839[_0x5652('0x50')]));_0x2c7693[_0x5652('0x4f')][_0x5652('0x61')]=_0x2f9dc7['id'];if(_0x809603['query'][_0x5652('0x51')]){_0x2c7693[_0x5652('0x4f')]=_['merge'](_0x2c7693[_0x5652('0x4f')],{'$or':_[_0x5652('0x3f')](_0x2c7693[_0x5652('0x47')],function(_0x543c35){var _0x383e2a={};_0x383e2a[_0x543c35]={'$like':'%'+_0x809603['query'][_0x5652('0x51')]+'%'};return _0x383e2a;})});}_0x2c7693=_[_0x5652('0x52')]({},_0x2c7693,_0x809603[_0x5652('0x54')]);return db['MailInteraction']['count']({'where':_0x2c7693[_0x5652('0x4f')]})[_0x5652('0x1d')](function(_0xf1c2c9){_0x33caf9['count']=_0xf1c2c9;if(_0x809603[_0x5652('0x45')][_0x5652('0x55')]){_0x2c7693[_0x5652('0x56')]=[{'model':db[_0x5652('0x8d')],'as':_0x5652('0x8e'),'required':![]},{'model':db['User'],'as':_0x5652('0x8f'),'attributes':[_0x5652('0x39'),_0x5652('0x90'),_0x5652('0x91')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5652('0x39'),_0x5652('0x92')],'where':_0x809603[_0x5652('0x45')]['tag']?{'id':_0x809603[_0x5652('0x45')]['tag']}:undefined,'required':_0x809603['query']['tag']?!![]:![]}];}return db[_0x5652('0x8c')][_0x5652('0x66')](_0x2c7693);})['then'](function(_0x23476c){_0x33caf9[_0x5652('0x67')]=_0x23476c;return _0x33caf9;});}})[_0x5652('0x1d')](respondWithFilteredResult(_0x5ee0a8,_0x2c7693))['catch'](handleError(_0x5ee0a8,null));};exports[_0x5652('0x93')]=function(_0x49c2d2,_0x55f481,_0x14ef17){return db[_0x5652('0x5b')][_0x5652('0x63')]({'where':{'id':_0x49c2d2['params']['id']}})['then'](handleEntityNotFound(_0x55f481,null))[_0x5652('0x1d')](function(_0x189dd2){if(_0x189dd2){return db[_0x5652('0x94')][_0x5652('0x95')](function(_0x125ee1){return db[_0x5652('0x96')][_0x5652('0x35')]({'where':{'MailAccountId':_0x49c2d2[_0x5652('0x58')]['id']},'transaction':_0x125ee1})['then'](function(_0x5b2a7d){var _0x271ea2=_[_0x5652('0x3f')](_0x49c2d2['body'],function(_0xffc656){_0xffc656[_0x5652('0x61')]=_0x49c2d2[_0x5652('0x58')]['id'];return _0xffc656;});return db[_0x5652('0x96')][_0x5652('0x97')](_0x271ea2,{'transaction':_0x125ee1});});})[_0x5652('0x1d')](function(){return db['MailApplication'][_0x5652('0x98')]({'where':{'MailAccountId':_0x49c2d2[_0x5652('0x58')]['id']},'order':_0x5652('0x99')});});}})['then'](respondWithResult(_0x55f481,null))['catch'](handleError(_0x55f481,null));};exports['getApplications']=function(_0x246aea,_0x15df02,_0x4df6d0){var _0x30caa4={};var _0x16240d={};var _0x40ca38;var _0x438f12;return db[_0x5652('0x5b')][_0x5652('0x63')]({'where':{'id':_0x246aea[_0x5652('0x58')]['id']}})['then'](handleEntityNotFound(_0x15df02,null))[_0x5652('0x1d')](function(_0x16b640){if(_0x16b640){_0x40ca38=_0x16b640;_0x16240d[_0x5652('0x44')]=_[_0x5652('0x46')](db[_0x5652('0x96')][_0x5652('0x40')]);_0x16240d[_0x5652('0x45')]=_[_0x5652('0x46')](_0x246aea[_0x5652('0x45')]);_0x16240d['filters']=_['intersection'](_0x16240d[_0x5652('0x44')],_0x16240d['query']);_0x30caa4[_0x5652('0x47')]=_[_0x5652('0x48')](_0x16240d[_0x5652('0x44')],qs['fields'](_0x246aea[_0x5652('0x45')][_0x5652('0x49')]));_0x30caa4[_0x5652('0x47')]=_0x30caa4[_0x5652('0x47')][_0x5652('0x4a')]?_0x30caa4[_0x5652('0x47')]:_0x16240d[_0x5652('0x44')];_0x30caa4[_0x5652('0x4d')]=qs[_0x5652('0x4e')](_0x246aea[_0x5652('0x45')][_0x5652('0x4e')]);_0x30caa4[_0x5652('0x4f')]=qs['filters'](_[_0x5652('0x65')](_0x246aea[_0x5652('0x45')],_0x16240d[_0x5652('0x50')]));if(_0x246aea[_0x5652('0x45')][_0x5652('0x51')]){_0x30caa4[_0x5652('0x4f')]=_['merge'](_0x30caa4['where'],{'$or':_['map'](_0x30caa4[_0x5652('0x47')],function(_0xa4a76){var _0xe23357={};_0xe23357[_0xa4a76]={'$like':'%'+_0x246aea[_0x5652('0x45')]['filter']+'%'};return _0xe23357;})});}_0x30caa4=_['merge']({},_0x30caa4,_0x246aea[_0x5652('0x54')]);return _0x40ca38['getApplications'](_0x30caa4);}})['then'](function(_0x42e3ba){if(_0x42e3ba){_0x438f12=_0x42e3ba[_0x5652('0x4a')];if(!_0x246aea['query'][_0x5652('0x4b')]('nolimit')){_0x30caa4[_0x5652('0x2c')]=qs[_0x5652('0x2c')](_0x246aea[_0x5652('0x45')]['limit']);_0x30caa4[_0x5652('0x2e')]=qs[_0x5652('0x2e')](_0x246aea['query'][_0x5652('0x2e')]);}return _0x40ca38[_0x5652('0x9a')](_0x30caa4);}})[_0x5652('0x1d')](function(_0x785885){if(_0x785885){return _0x785885?{'count':_0x438f12,'rows':_0x785885}:null;}})[_0x5652('0x1d')](respondWithResult(_0x15df02,null))[_0x5652('0x28')](handleError(_0x15df02,null));};exports[_0x5652('0x9b')]=function(_0xf2a9ad,_0x2c6f58,_0x299e22){var _0x28caef={'raw':!![],'where':{}};var _0xf9c03e={};var _0x158df6={'count':0x0,'rows':[]};return db[_0x5652('0x5b')][_0x5652('0x63')]({'where':{'id':_0xf2a9ad['params']['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x2c6f58,null))[_0x5652('0x1d')](function(_0xbc58dd){if(_0xbc58dd){_0xf9c03e['model']=_[_0x5652('0x46')](db['MailMessage'][_0x5652('0x40')]);_0xf9c03e[_0x5652('0x45')]=_[_0x5652('0x46')](_0xf2a9ad[_0x5652('0x45')]);_0xf9c03e['filters']=_[_0x5652('0x48')](_0xf9c03e[_0x5652('0x44')],_0xf9c03e[_0x5652('0x45')]);_0x28caef[_0x5652('0x47')]=_[_0x5652('0x48')](_0xf9c03e[_0x5652('0x44')],qs[_0x5652('0x49')](_0xf2a9ad['query'][_0x5652('0x49')]));_0x28caef['attributes']=_0x28caef[_0x5652('0x47')][_0x5652('0x4a')]?_0x28caef['attributes']:_0xf9c03e[_0x5652('0x44')];if(!_0xf2a9ad[_0x5652('0x45')][_0x5652('0x4b')]('nolimit')){_0x28caef['limit']=qs[_0x5652('0x2c')](_0xf2a9ad[_0x5652('0x45')][_0x5652('0x2c')]);_0x28caef[_0x5652('0x2e')]=qs[_0x5652('0x2e')](_0xf2a9ad['query'][_0x5652('0x2e')]);}_0x28caef[_0x5652('0x4d')]=qs[_0x5652('0x4e')](_0xf2a9ad[_0x5652('0x45')]['sort']);_0x28caef[_0x5652('0x4f')]=qs[_0x5652('0x50')](_[_0x5652('0x65')](_0xf2a9ad['query'],_0xf9c03e['filters']));_0x28caef[_0x5652('0x4f')][_0x5652('0x61')]=_0xbc58dd['id'];if(_0xf2a9ad[_0x5652('0x45')][_0x5652('0x51')]){_0x28caef['where']=_[_0x5652('0x52')](_0x28caef[_0x5652('0x4f')],{'$or':_[_0x5652('0x3f')](_0x28caef['attributes'],function(_0x22c7ca){var _0xc8b9bd={};_0xc8b9bd[_0x22c7ca]={'$like':'%'+_0xf2a9ad[_0x5652('0x45')][_0x5652('0x51')]+'%'};return _0xc8b9bd;})});}if(_0xf2a9ad[_0x5652('0x45')][_0x5652('0x9c')]){var _0x31cbf8=_0xf2a9ad[_0x5652('0x45')][_0x5652('0x9c')][_0x5652('0x9d')](',');var _0x8facf3={};_0x8facf3[_0x31cbf8[0x0]]={'$gte':moment(_0x31cbf8[0x1])[_0x5652('0x9e')](_0x5652('0x9f'))};_0x28caef['where']=_[_0x5652('0x52')](_0x28caef[_0x5652('0x4f')],_0x8facf3);}_0x28caef=_['merge']({},_0x28caef,_0xf2a9ad[_0x5652('0x54')]);return db[_0x5652('0xa0')]['count']({'where':_0x28caef['where']})[_0x5652('0x1d')](function(_0x48110e){_0x158df6['count']=_0x48110e;if(_0xf2a9ad['query'][_0x5652('0x55')]){_0x28caef[_0x5652('0x56')]=[{'all':!![]}];}return db[_0x5652('0xa0')]['findAll'](_0x28caef);})[_0x5652('0x1d')](function(_0x2eb4bd){if(_0xf2a9ad[_0x5652('0x45')][_0x5652('0xa1')]==='true'){for(var _0x4f1665=0x0;_0x4f1665<_0x2eb4bd[_0x5652('0x4a')];_0x4f1665++){_0x2eb4bd[_0x4f1665][_0x5652('0x5d')]=juice(_0x2eb4bd[_0x4f1665]['body']);}}_0x158df6[_0x5652('0x67')]=_0x2eb4bd;return _0x158df6;});}})[_0x5652('0x1d')](respondWithFilteredResult(_0x2c6f58,_0x28caef))['catch'](handleError(_0x2c6f58,null));};exports[_0x5652('0x3a')]=function(_0x46e375,_0x1f9a73,_0x327da6){var _0x1bda5c,_0x372471={},_0x21b9b8;if(_0x46e375['body']['to']){_0x21b9b8=_0x46e375[_0x5652('0x5d')]['to'][_0x5652('0x9d')](',')[0x0];}return db[_0x5652('0x5b')]['find']({'where':{'id':_0x46e375[_0x5652('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x5652('0xa2'),'include':[{'model':db[_0x5652('0x8d')],'as':_0x5652('0xa3'),'where':{'email':_0x21b9b8},'limit':0x1,'order':[[_0x5652('0xa4'),_0x5652('0xa5')]]}]},{'model':db[_0x5652('0x3d')],'as':_0x5652('0x59'),'raw':!![]}]})[_0x5652('0x1d')](handleEntityNotFound(_0x1f9a73,null))[_0x5652('0x1d')](function(_0x158fec){if(_0x158fec){_0x1bda5c=_0x158fec;if(_0x158fec[_0x5652('0x59')]){if(_['isNil'](_0x46e375[_0x5652('0x5d')][_0x5652('0xa6')])){_0x46e375[_0x5652('0x5d')][_0x5652('0xa6')]=util[_0x5652('0x9e')](_0x5652('0xa7'),_0x158fec[_0x5652('0x39')],_0x158fec[_0x5652('0x6d')]||_0x158fec[_0x5652('0x59')]['user']);}if(_0x46e375[_0x5652('0x5d')][_0x5652('0xa8')]&&_0x46e375[_0x5652('0x5d')]['attachments'][_0x5652('0x4a')]){for(var _0x26cfb8=0x0;_0x26cfb8<_0x46e375['body'][_0x5652('0xa8')][_0x5652('0x4a')];_0x26cfb8+=0x1){_0x46e375[_0x5652('0x5d')][_0x5652('0xa8')][_0x26cfb8]={'filename':_0x46e375[_0x5652('0x5d')][_0x5652('0xa8')][_0x26cfb8][_0x5652('0x39')],'path':path[_0x5652('0xa9')](config['root'],'server/files/attachments',_0x46e375[_0x5652('0x5d')][_0x5652('0xa8')][_0x26cfb8]['basename'])};}}var _0x26ebd1={'tls':{'rejectUnauthorized':![]}};if(_[_0x5652('0x6f')](_0x158fec[_0x5652('0x59')][_0x5652('0x7b')])){if(_0x158fec['Smtp'][_0x5652('0x78')]){_0x26ebd1[_0x5652('0xaa')]={'user':_0x158fec['Smtp'][_0x5652('0x73')],'pass':_0x158fec[_0x5652('0x59')][_0x5652('0x76')]};}_0x26ebd1[_0x5652('0x79')]=_0x158fec[_0x5652('0x59')]['host'];_0x26ebd1[_0x5652('0x7a')]=_0x158fec[_0x5652('0x59')][_0x5652('0x7a')];_0x26ebd1[_0x5652('0xab')]=_0x158fec[_0x5652('0x59')]['secure'];}else{_0x26ebd1[_0x5652('0x7b')]=_0x158fec[_0x5652('0x59')][_0x5652('0x7b')];_0x26ebd1[_0x5652('0xaa')]={'user':_0x158fec['Smtp'][_0x5652('0x73')],'pass':_0x158fec[_0x5652('0x59')][_0x5652('0x76')]};}return respondWithRpcPromise(_0x5652('0xac'),_0x5652('0xad'),{'account':_0x26ebd1,'message':_0x46e375[_0x5652('0x5d')]});}else{throw new Error(_0x5652('0xae'));}}})[_0x5652('0x1d')](function(_0x1f9c0b){if(_0x1f9c0b){_0x372471=_0x1f9c0b;if(_0x1bda5c[_0x5652('0xa2')]){if(_0x1bda5c[_0x5652('0xa2')]['Contacts'][_0x5652('0x4a')]){return _0x1bda5c[_0x5652('0xa2')][_0x5652('0xa3')][0x0];}else{return db[_0x5652('0x8d')][_0x5652('0x62')](_[_0x5652('0x17')](_0x46e375[_0x5652('0x5d')],{'firstName':_0x46e375[_0x5652('0x5d')]['to'],'email':_0x46e375['body']['to'],'phone':_0x46e375[_0x5652('0x5d')]['to'],'ListId':_0x1bda5c[_0x5652('0x6e')]}));}}else{throw new Error(_0x5652('0xae'));}}})['then'](function(_0x1495d4){if(_0x1495d4){var _0x5e314e={'UserId':_0x46e375[_0x5652('0x73')]['id'],'ContactId':_0x1495d4['id'],'MailAccountId':_0x1bda5c['id'],'inReplyTo':_0x372471[_0x5652('0xaf')],'to':_0x46e375['body']['from'],'cc':_0x46e375['body']['cc'],'subject':_0x46e375[_0x5652('0x5d')][_0x5652('0xb0')],'attach':_0x46e375['body'][_0x5652('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x5652('0x9e')](_0x5652('0x9f')),'lastMsgDirection':_0x5652('0xb2'),'Messages':[_['merge'](_0x46e375[_0x5652('0x5d')],{'messageId':_0x372471[_0x5652('0xaf')],'sentAt':moment()[_0x5652('0x9e')](_0x5652('0x9f')),'read':!![],'MailAccountId':_0x1bda5c['id'],'UserId':_0x46e375[_0x5652('0x73')]['id'],'ContactId':_0x1495d4['id']})]};if(_0x46e375[_0x5652('0x5d')][_0x5652('0xb3')]){_0x5e314e=_[_0x5652('0x52')](_0x5e314e,_0x46e375['body'][_0x5652('0xb3')]);}return db['MailInteraction'][_0x5652('0x62')](_0x5e314e,{'include':[{'model':db[_0x5652('0xa0')],'as':_0x5652('0xb4')}]});}})[_0x5652('0x1d')](respondWithResult(_0x1f9a73,null))[_0x5652('0x28')](handleError(_0x1f9a73,null));};exports[_0x5652('0xb5')]=function(_0x19cdb5,_0x249b04,_0x2d37b0){return db[_0x5652('0x5b')][_0x5652('0x5c')]({'where':{'id':_0x19cdb5[_0x5652('0x58')]['id']},'include':[{'model':db[_0x5652('0x3d')],'as':_0x5652('0x59'),'raw':!![]}]})[_0x5652('0x1d')](handleEntityNotFound(_0x249b04,null))[_0x5652('0x1d')](function(_0x44b14a){if(_0x44b14a&&_0x44b14a['Smtp']){var _0xb4531={'id':_0x44b14a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x44b14a[_0x5652('0x59')]['service']){_0xb4531[_0x5652('0x7b')]=_0x44b14a[_0x5652('0x59')][_0x5652('0x7b')];}else{_0xb4531[_0x5652('0x79')]=_0x44b14a[_0x5652('0x59')][_0x5652('0x79')];_0xb4531[_0x5652('0x7a')]=_0x44b14a['Smtp'][_0x5652('0x7a')];_0xb4531['secure']=_0x44b14a[_0x5652('0x59')]['secure'];}if(_0x44b14a[_0x5652('0x59')][_0x5652('0x78')]){_0xb4531[_0x5652('0xaa')]={'user':_0x44b14a['Smtp'][_0x5652('0x73')],'pass':_0x44b14a['Smtp']['pass']};}return respondWithRpcPromise('VerifySmtp',_0x5652('0xb5'),{'account':_0xb4531});}})[_0x5652('0x1d')](respondWithResult(_0x249b04,null))[_0x5652('0x28')](handleError(_0x249b04,null));};exports[_0x5652('0x35')]=function(_0x4813fd,_0x132411){return db[_0x5652('0x5b')]['find']({'where':{'id':_0x4813fd[_0x5652('0x58')]['id']}})['then'](handleEntityNotFound(_0x132411,null))[_0x5652('0x1d')](function(_0x5847fe){if(_0x5847fe&&_0x5847fe[_0x5652('0x7b')]){throw new db[(_0x5652('0xb6'))][(_0x5652('0xb7'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x5847fe;})[_0x5652('0x1d')](removeEntity(_0x132411,null))[_0x5652('0x28')](handleError(_0x132411,null));};exports[_0x5652('0xb8')]=function(_0x43a6e1,_0x198f8c,_0x2d99f6){return db[_0x5652('0x5b')][_0x5652('0x5c')]({'where':{'id':_0x43a6e1[_0x5652('0x58')]['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x198f8c,null))['then'](function(_0x2a13a1){if(_0x2a13a1){return _0x2a13a1[_0x5652('0xb8')](_0x43a6e1[_0x5652('0x5d')][_0x5652('0x69')],_[_0x5652('0xb9')](_0x43a6e1[_0x5652('0x5d')],[_0x5652('0x69'),'id'])||{})[_0x5652('0xba')](function(_0x3930b6){for(var _0xaccb34=0x0;_0xaccb34<_0x43a6e1['body']['ids'][_0x5652('0x4a')];_0xaccb34+=0x1){socket[_0x5652('0xbb')](_0x5652('0xbc'),{'UserId':Number(_0x43a6e1['body'][_0x5652('0x69')][_0xaccb34]),'MailAccountId':Number(_0x43a6e1[_0x5652('0x58')]['id'])});}return _0x3930b6;});}})['then'](respondWithResult(_0x198f8c,null))[_0x5652('0x28')](handleError(_0x198f8c,null));};exports[_0x5652('0xbd')]=function(_0x241a7e,_0x275f84,_0x29cc05){return db['MailAccount'][_0x5652('0x5c')]({'where':{'id':_0x241a7e[_0x5652('0x58')]['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x275f84,null))['then'](function(_0x11457f){if(_0x11457f){return _0x11457f[_0x5652('0xbd')](_0x241a7e[_0x5652('0x45')]['ids'])[_0x5652('0x1d')](function(){if(_['isArray'](_0x241a7e['query'][_0x5652('0x69')])){for(var _0x46ff13=0x0;_0x46ff13<_0x241a7e[_0x5652('0x45')][_0x5652('0x69')][_0x5652('0x4a')];_0x46ff13+=0x1){socket[_0x5652('0xbb')](_0x5652('0xbe'),{'UserId':Number(_0x241a7e[_0x5652('0x45')][_0x5652('0x69')][_0x46ff13]),'MailAccountId':Number(_0x241a7e[_0x5652('0x58')]['id'])});}}else{socket[_0x5652('0xbb')](_0x5652('0xbe'),{'UserId':Number(_0x241a7e['query'][_0x5652('0x69')]),'MailAccountId':Number(_0x241a7e['params']['id'])});}});}})[_0x5652('0x1d')](respondWithStatusCode(_0x275f84,null))[_0x5652('0x28')](handleError(_0x275f84,null));};exports[_0x5652('0xbf')]=function(_0x825266,_0x1f17d9,_0x55a60b){var _0x89f96e={};var _0x3a689e={};var _0x311303;var _0x3bf2bb;return db['MailAccount'][_0x5652('0x63')]({'where':{'id':_0x825266[_0x5652('0x58')]['id']}})[_0x5652('0x1d')](handleEntityNotFound(_0x1f17d9,null))[_0x5652('0x1d')](function(_0xc6a2bb){if(_0xc6a2bb){_0x311303=_0xc6a2bb;_0x3a689e['model']=_[_0x5652('0x46')](db[_0x5652('0xc0')][_0x5652('0x40')]);_0x3a689e[_0x5652('0x45')]=_[_0x5652('0x46')](_0x825266[_0x5652('0x45')]);_0x3a689e['filters']=_['intersection'](_0x3a689e['model'],_0x3a689e[_0x5652('0x45')]);_0x89f96e[_0x5652('0x47')]=_[_0x5652('0x48')](_0x3a689e[_0x5652('0x44')],qs[_0x5652('0x49')](_0x825266[_0x5652('0x45')][_0x5652('0x49')]));_0x89f96e['attributes']=_0x89f96e['attributes'][_0x5652('0x4a')]?_0x89f96e[_0x5652('0x47')]:_0x3a689e['model'];_0x89f96e['order']=qs['sort'](_0x825266['query'][_0x5652('0x4e')]);_0x89f96e[_0x5652('0x4f')]=qs[_0x5652('0x50')](_[_0x5652('0x65')](_0x825266['query'],_0x3a689e[_0x5652('0x50')]));if(_0x825266[_0x5652('0x45')][_0x5652('0x51')]){_0x89f96e[_0x5652('0x4f')]=_[_0x5652('0x52')](_0x89f96e[_0x5652('0x4f')],{'$or':_[_0x5652('0x3f')](_0x89f96e[_0x5652('0x47')],function(_0x142619){var _0x1bbe04={};_0x1bbe04[_0x142619]={'$like':'%'+_0x825266['query'][_0x5652('0x51')]+'%'};return _0x1bbe04;})});}_0x89f96e=_[_0x5652('0x52')]({},_0x89f96e,_0x825266[_0x5652('0x54')]);return _0x311303[_0x5652('0xbf')](_0x89f96e);}})[_0x5652('0x1d')](function(_0x523f0d){if(_0x523f0d){_0x3bf2bb=_0x523f0d[_0x5652('0x4a')];if(!_0x825266[_0x5652('0x45')][_0x5652('0x4b')](_0x5652('0x4c'))){_0x89f96e[_0x5652('0x2c')]=qs[_0x5652('0x2c')](_0x825266[_0x5652('0x45')]['limit']);_0x89f96e[_0x5652('0x2e')]=qs[_0x5652('0x2e')](_0x825266[_0x5652('0x45')][_0x5652('0x2e')]);}return _0x311303['getAgents'](_0x89f96e);}})[_0x5652('0x1d')](function(_0x5921f0){if(_0x5921f0){return _0x5921f0?{'count':_0x3bf2bb,'rows':_0x5921f0}:null;}})[_0x5652('0x1d')](respondWithResult(_0x1f17d9,null))[_0x5652('0x28')](handleError(_0x1f17d9,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b2b28e8..eb4b7a0 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 _0xad1b=['../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0xad1b,0x131));var _0xbad1=function(_0x49756a,_0x2bc007){_0x49756a=_0x49756a-0x0;var _0x125085=_0xad1b[_0x49756a];return _0x125085;};'use strict';var EventEmitter=require(_0xbad1('0x0'));var MailAccount=require(_0xbad1('0x1'))['db'][_0xbad1('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xbad1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbad1('0x4'),'afterDestroy':_0xbad1('0x5')};function emitEvent(_0x1bfd8e){return function(_0x5e7292,_0x1623e7,_0x47af0d){MailAccountEvents[_0xbad1('0x6')](_0x1bfd8e+':'+_0x5e7292['id'],_0x5e7292);MailAccountEvents['emit'](_0x1bfd8e,_0x5e7292);_0x47af0d(null);};}for(var e in events){if(events[_0xbad1('0x7')](e)){var event=events[e];MailAccount[_0xbad1('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x6d5e=['MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x33b2e9,_0x3b20ef){var _0x18cb55=function(_0xe24ba7){while(--_0xe24ba7){_0x33b2e9['push'](_0x33b2e9['shift']());}};_0x18cb55(++_0x3b20ef);}(_0x6d5e,0x103));var _0xe6d5=function(_0x19d36a,_0x41aa74){_0x19d36a=_0x19d36a-0x0;var _0x3ac96e=_0x6d5e[_0x19d36a];return _0x3ac96e;};'use strict';var EventEmitter=require(_0xe6d5('0x0'));var MailAccount=require(_0xe6d5('0x1'))['db'][_0xe6d5('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe6d5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe6d5('0x4'),'afterDestroy':_0xe6d5('0x5')};function emitEvent(_0x37033a){return function(_0x55595e,_0x3db670,_0x2d3422){MailAccountEvents[_0xe6d5('0x6')](_0x37033a+':'+_0x55595e['id'],_0x55595e);MailAccountEvents['emit'](_0x37033a,_0x55595e);_0x2d3422(null);};}for(var e in events){if(events[_0xe6d5('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xe6d5('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 5cc5a31..b7fa050 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 _0x2279=['define','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports'];(function(_0x578d9b,_0x486d55){var _0x26bdda=function(_0x247bd0){while(--_0x247bd0){_0x578d9b['push'](_0x578d9b['shift']());}};_0x26bdda(++_0x486d55);}(_0x2279,0x1d4));var _0x9227=function(_0x9c759d,_0x380ca6){_0x9c759d=_0x9c759d-0x0;var _0x496c2c=_0x2279[_0x9c759d];return _0x496c2c;};'use strict';var _=require(_0x9227('0x0'));var util=require(_0x9227('0x1'));var logger=require(_0x9227('0x2'))(_0x9227('0x3'));var moment=require(_0x9227('0x4'));var BPromise=require(_0x9227('0x5'));var rp=require(_0x9227('0x6'));var fs=require('fs');var path=require(_0x9227('0x7'));var rimraf=require(_0x9227('0x8'));var config=require(_0x9227('0x9'));var attributes=require(_0x9227('0xa'));module[_0x9227('0xb')]=function(_0x2bccd7,_0x2d275f){return _0x2bccd7[_0x9227('0xc')](_0x9227('0xd'),attributes,{'tableName':_0x9227('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb27e=['path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','util','api','moment'];(function(_0x41203c,_0x14a6de){var _0x579b41=function(_0x379f36){while(--_0x379f36){_0x41203c['push'](_0x41203c['shift']());}};_0x579b41(++_0x14a6de);}(_0xb27e,0xe4));var _0xeb27=function(_0x730e87,_0x16aca0){_0x730e87=_0x730e87-0x0;var _0x31aae2=_0xb27e[_0x730e87];return _0x31aae2;};'use strict';var _=require('lodash');var util=require(_0xeb27('0x0'));var logger=require('../../config/logger')(_0xeb27('0x1'));var moment=require(_0xeb27('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb27('0x3'));var rimraf=require(_0xeb27('0x4'));var config=require(_0xeb27('0x5'));var attributes=require(_0xeb27('0x6'));module[_0xeb27('0x7')]=function(_0x346cf9,_0x408612){return _0x346cf9[_0xeb27('0x8')](_0xeb27('0x9'),attributes,{'tableName':_0xeb27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 4c7bf39..462d782 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 _0xf87e=['*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetMailAccount','stringify','ShowMailAccount','then','NotifyMailAccount','body','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','get','omit','applications','list','orderBy','priority','asc','autoclose','push','close','length','create','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','interaction','created','MailMessage','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent'];(function(_0x46f35e,_0x5ca47c){var _0xe9b1c1=function(_0x470d88){while(--_0x470d88){_0x46f35e['push'](_0x46f35e['shift']());}};_0xe9b1c1(++_0x5ca47c);}(_0xf87e,0x14d));var _0xef87=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xf87e[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xef87('0x0'));var util=require(_0xef87('0x1'));var moment=require(_0xef87('0x2'));var BPromise=require(_0xef87('0x3'));var rs=require(_0xef87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef87('0x5'))['db'];var utils=require(_0xef87('0x6'));var logger=require(_0xef87('0x7'))('rpc');var config=require(_0xef87('0x8'));var jayson=require(_0xef87('0x9'));var client=jayson[_0xef87('0xa')][_0xef87('0xb')]({'port':0x232c});config[_0xef87('0xc')]=_[_0xef87('0xd')](config['redis'],{'host':_0xef87('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef87('0xc')]));require(_0xef87('0xf'))[_0xef87('0x10')](socket);function respondWithRpcPromise(_0x570fc6,_0x4f29cf,_0x15c1ec){return new BPromise(function(_0x18ef98,_0x45f470){return client[_0xef87('0x11')](_0x570fc6,_0x15c1ec)['then'](function(_0x10ca5b){logger[_0xef87('0x12')](_0xef87('0x13'),_0x4f29cf,'request\x20sent');logger[_0xef87('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4f29cf,_0xef87('0x15'),JSON['stringify'](_0x10ca5b));if(_0x10ca5b[_0xef87('0x16')]){if(_0x10ca5b[_0xef87('0x16')][_0xef87('0x17')]===0x1f4){logger[_0xef87('0x16')](_0xef87('0x13'),_0x4f29cf,_0x10ca5b[_0xef87('0x16')][_0xef87('0x18')]);return _0x45f470(_0x10ca5b[_0xef87('0x16')][_0xef87('0x18')]);}logger[_0xef87('0x16')](_0xef87('0x13'),_0x4f29cf,_0x10ca5b['error'][_0xef87('0x18')]);return _0x18ef98(_0x10ca5b[_0xef87('0x16')][_0xef87('0x18')]);}else{logger[_0xef87('0x12')](_0xef87('0x13'),_0x4f29cf,_0xef87('0x15'));_0x18ef98(_0x10ca5b[_0xef87('0x19')]['message']);}})[_0xef87('0x1a')](function(_0x3fe088){logger[_0xef87('0x16')](_0xef87('0x13'),_0x4f29cf,_0x3fe088);_0x45f470(_0x3fe088);});});}exports['GetMailAccount']=function(_0x1ba3e8){var _0x4413b8=this;return new Promise(function(_0x252e52,_0xff0148){return db[_0xef87('0x1b')][_0xef87('0x1c')]({'raw':_0x1ba3e8[_0xef87('0x1d')]?_0x1ba3e8[_0xef87('0x1d')][_0xef87('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ba3e8['options']?_0x1ba3e8[_0xef87('0x1d')][_0xef87('0x1f')]||null:null,'attributes':_0x1ba3e8[_0xef87('0x1d')]?_0x1ba3e8['options'][_0xef87('0x20')]||null:null,'limit':_0x1ba3e8[_0xef87('0x1d')]?_0x1ba3e8[_0xef87('0x1d')][_0xef87('0x21')]||null:null,'include':_0x1ba3e8[_0xef87('0x1d')]?_0x1ba3e8[_0xef87('0x1d')][_0xef87('0x22')]?_[_0xef87('0x23')](_0x1ba3e8[_0xef87('0x1d')][_0xef87('0x22')],function(_0x43841c){return{'model':db[_0x43841c['model']],'as':_0x43841c['as'],'attributes':_0x43841c[_0xef87('0x20')],'include':_0x43841c[_0xef87('0x22')]?_['map'](_0x43841c['include'],function(_0x3c9000){return{'model':db[_0x3c9000['model']],'as':_0x3c9000['as'],'attributes':_0x3c9000[_0xef87('0x20')],'include':_0x3c9000[_0xef87('0x22')]?_[_0xef87('0x23')](_0x3c9000[_0xef87('0x22')],function(_0x247c4f){return{'model':db[_0x247c4f[_0xef87('0x24')]],'as':_0x247c4f['as'],'attributes':_0x247c4f[_0xef87('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d1f67){logger[_0xef87('0x12')](_0xef87('0x25'),_0x1ba3e8);logger['debug'](_0xef87('0x25'),_0x1ba3e8,JSON[_0xef87('0x26')](_0x2d1f67));_0x252e52(_0x2d1f67);})[_0xef87('0x1a')](function(_0x237b73){logger[_0xef87('0x16')](_0xef87('0x25'),_0x237b73[_0xef87('0x18')],_0x1ba3e8);_0xff0148(_0x4413b8[_0xef87('0x16')](0x1f4,_0x237b73[_0xef87('0x18')]));});});};exports[_0xef87('0x27')]=function(_0x58565a){var _0x5775a2=this;return new Promise(function(_0x13681d,_0x58d7ac){return db[_0xef87('0x1b')]['find']({'raw':_0x58565a['options']?_0x58565a[_0xef87('0x1d')][_0xef87('0x1e')]===undefined?!![]:![]:!![],'where':_0x58565a[_0xef87('0x1d')]?_0x58565a[_0xef87('0x1d')][_0xef87('0x1f')]||null:null,'attributes':_0x58565a['options']?_0x58565a[_0xef87('0x1d')][_0xef87('0x20')]||null:null,'include':_0x58565a[_0xef87('0x1d')]?_0x58565a['options'][_0xef87('0x22')]?_[_0xef87('0x23')](_0x58565a[_0xef87('0x1d')][_0xef87('0x22')],function(_0x13055f){return{'model':db[_0x13055f[_0xef87('0x24')]],'as':_0x13055f['as'],'attributes':_0x13055f[_0xef87('0x20')],'include':_0x13055f[_0xef87('0x22')]?_[_0xef87('0x23')](_0x13055f['include'],function(_0x439c4b){return{'model':db[_0x439c4b[_0xef87('0x24')]],'as':_0x439c4b['as'],'attributes':_0x439c4b['attributes'],'include':_0x439c4b[_0xef87('0x22')]?_[_0xef87('0x23')](_0x439c4b[_0xef87('0x22')],function(_0x4c0a5c){return{'model':db[_0x4c0a5c[_0xef87('0x24')]],'as':_0x4c0a5c['as'],'attributes':_0x4c0a5c[_0xef87('0x20')]};}):[]};}):[]};}):[]:[]})[_0xef87('0x28')](function(_0x2940b3){logger['info'](_0xef87('0x27'),_0x58565a);logger[_0xef87('0x14')](_0xef87('0x27'),_0x58565a,JSON[_0xef87('0x26')](_0x2940b3));_0x13681d(_0x2940b3);})[_0xef87('0x1a')](function(_0x493acb){logger[_0xef87('0x16')](_0xef87('0x27'),_0x493acb[_0xef87('0x18')],_0x58565a);_0x58d7ac(_0x5775a2['error'](0x1f4,_0x493acb['message']));});});};exports[_0xef87('0x29')]=function(_0x5771df){var _0x37a51a=this;return new Promise(function(_0x69d5f,_0x68fe37){var _0x46f27f={'body':_0x5771df[_0xef87('0x2a')],'channel':'mail'};var _0x61cc3d=_[_0xef87('0x2b')](_['keys'](db[_0xef87('0x2c')][_0xef87('0x2d')]),[_0xef87('0x2e'),_0xef87('0x2f'),_0xef87('0x30'),'ListId']);var _0x4824b7=![];if(_0x5771df['body']['id']){delete _0x5771df[_0xef87('0x2a')]['id'];}if(_[_0xef87('0x31')](_0x5771df[_0xef87('0x2a')][_0xef87('0x32')])){return _0x68fe37(_0x37a51a['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xef87('0x31')](_0x5771df['body']['body'])||_0x5771df['body'][_0xef87('0x2a')]===''){return _0x68fe37(_0x37a51a[_0xef87('0x16')](0x1f4,_0xef87('0x33')));}if(_[_0xef87('0x31')](_0x5771df[_0xef87('0x2a')]['mapKey'])){return _0x68fe37(_0x37a51a['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x61cc3d));}if(!_[_0xef87('0x34')](_0x61cc3d,_0x5771df[_0xef87('0x2a')][_0xef87('0x35')])){return _0x68fe37(_0x37a51a[_0xef87('0x16')](0x1f4,_0xef87('0x36')+_0x61cc3d));}var _0xc8f378={};_0xc8f378[_0x5771df['body'][_0xef87('0x35')]]=_0x5771df['body']['from'];return db[_0xef87('0x1b')][_0xef87('0x37')]({'where':{'id':_0x5771df[_0xef87('0x38')]['id']},'include':[{'model':db[_0xef87('0x39')],'as':_0xef87('0x3a'),'include':[{'model':db[_0xef87('0x2c')],'as':_0xef87('0x3b'),'where':_0xc8f378,'limit':0x1,'order':[[_0xef87('0x2f'),_0xef87('0x3c')]]}]},{'model':db[_0xef87('0x3d')],'as':_0xef87('0x3e')},{'model':db['MailServerOut'],'as':_0xef87('0x3f')}]})[_0xef87('0x28')](function(_0x1d2d93){if(_0x1d2d93&&_0x1d2d93['List']){var _0x84bcb0=_0x1d2d93[_0xef87('0x40')]({'plain':!![]});_0x46f27f[_0xef87('0x38')]=_[_0xef87('0x41')](_0x84bcb0,[_0xef87('0x3e'),_0xef87('0x3a')]);_0x46f27f[_0xef87('0x42')]=_0x84bcb0[_0xef87('0x3e')];_0x46f27f[_0xef87('0x43')]=_0x84bcb0[_0xef87('0x3a')];_0x46f27f[_0xef87('0x42')]=_[_0xef87('0x44')](_0x46f27f[_0xef87('0x42')],[_0xef87('0x45')],[_0xef87('0x46')]);if(_0x46f27f[_0xef87('0x38')]&&_0x46f27f[_0xef87('0x38')][_0xef87('0x47')]){_0x46f27f[_0xef87('0x42')][_0xef87('0x48')]({'id':0x0,'priority':_0x46f27f[_0xef87('0x42')]['length']+0x1,'app':_0xef87('0x49'),'appdata':_0xef87('0x47'),'interval':'*,*,*,*'});}if(_0x46f27f[_0xef87('0x38')][_0xef87('0x3e')]){delete _0x46f27f[_0xef87('0x38')][_0xef87('0x3e')];}if(_0x46f27f[_0xef87('0x38')][_0xef87('0x3a')]){delete _0x46f27f['account'][_0xef87('0x3a')];}if(_0x84bcb0['List'][_0xef87('0x3b')][_0xef87('0x4a')]){return _0x84bcb0[_0xef87('0x3a')][_0xef87('0x3b')][0x0];}var _0x2a196f=_[_0xef87('0xd')](_0x5771df['body'],{'firstName':_0x5771df[_0xef87('0x2a')]['from'],'ListId':_0x84bcb0['ListId']});_0x2a196f[_0x5771df[_0xef87('0x2a')]['mapKey']]=_0x5771df['body'][_0xef87('0x32')];return db[_0xef87('0x2c')][_0xef87('0x4b')](_0x2a196f);}else{throw new Error('List\x20not\x20found');}})[_0xef87('0x28')](function(_0x37edbf){_0x46f27f[_0xef87('0x4c')]=_0x37edbf;if(_0x37edbf){if(!_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x4d')]){_0x5771df['body'][_0xef87('0x18')][_0xef87('0x4d')]=rs[_0xef87('0x4e')]()+'\x20'+_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x32')];}var _0x3af75a={'ContactId':_0x37edbf['id'],'MailAccountId':_0x5771df[_0xef87('0x38')]['id'],'inReplyTo':_0x5771df['body'][_0xef87('0x18')][_0xef87('0x4d')],'to':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x32')],'cc':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')]['cc'],'subject':_0x5771df['body']['message']['subject'],'attach':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x4f')],'lastMsgAt':moment()[_0xef87('0x50')](_0xef87('0x51')),'lastMsgDirection':'in'};return db[_0xef87('0x52')][_0xef87('0x37')]({'where':{'closed':![],'MailAccountId':_0x5771df['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xef87('0x53'),'attributes':['messageId'],'where':{'messageId':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x54')]}}]})['then'](function(_0x40efd1){if(_0x40efd1){return[_0x40efd1,![]];}return db[_0xef87('0x52')][_0xef87('0x4b')](_0x3af75a)[_0xef87('0x28')](function(_0x2a6f78){return[_0x2a6f78,!![]];});});}else{throw new Error(_0xef87('0x55'));}})[_0xef87('0x56')](function(_0x10c8f1,_0x37a005){if(_0x10c8f1){_0x4824b7=_0x37a005;if(!_0x37a005){return _0x10c8f1[_0xef87('0x57')]({'inReplyTo':_0x5771df['body'][_0xef87('0x18')][_0xef87('0x4d')],'to':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x32')],'cc':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')]['cc'],'subject':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x58')],'attach':_0x10c8f1[_0xef87('0x4f')]?_0x10c8f1[_0xef87('0x4f')]:_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x4f')],'substatus':null,'substatusAt':moment()[_0xef87('0x50')](_0xef87('0x51')),'lastMsgAt':moment()['format'](_0xef87('0x51')),'lastMsgDirection':'in'});}else{return _0x10c8f1;}}})['then'](function(_0x2dfa1c){_0x46f27f[_0xef87('0x59')]=_0x2dfa1c[_0xef87('0x40')]({'plain':!![]});_0x46f27f[_0xef87('0x59')][_0xef87('0x5a')]=_0x4824b7;return db[_0xef87('0x5b')]['create']({'body':_0x5771df[_0xef87('0x2a')][_0xef87('0x2a')],'MailAccountId':_0x5771df[_0xef87('0x38')]['id'],'MailInteractionId':_0x2dfa1c['id'],'direction':'in','ContactId':_0x46f27f[_0xef87('0x4c')]['id'],'messageId':_0x5771df['body'][_0xef87('0x18')][_0xef87('0x4d')],'from':_0x5771df['body'][_0xef87('0x18')][_0xef87('0x32')],'to':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')]['to'],'cc':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')]['cc'],'subject':_0x5771df[_0xef87('0x2a')]['message'][_0xef87('0x58')],'attach':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x4f')],'Attachments':_0x5771df[_0xef87('0x2a')]['message'][_0xef87('0x5c')],'originTo':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x5d')],'originCc':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x5e')],'bcc':_0x5771df[_0xef87('0x2a')]['message'][_0xef87('0x5f')],'ChatWebsiteId':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x60')]||null,'originChannel':_0x5771df[_0xef87('0x2a')][_0xef87('0x18')][_0xef87('0x61')]||'Email','ChatOfflineMessageId':_0x5771df[_0xef87('0x2a')]['message'][_0xef87('0x62')]||null},{'include':[{'model':db[_0xef87('0x63')],'as':_0xef87('0x64')}]});})[_0xef87('0x28')](function(_0x21475b){_0x46f27f[_0xef87('0x18')]=_0x21475b;if(_0x46f27f[_0xef87('0x59')][_0xef87('0x65')]){return db[_0xef87('0x66')][_0xef87('0x37')]({'attributes':['id','name'],'where':{'id':_0x46f27f[_0xef87('0x59')][_0xef87('0x65')]}})['then'](function(_0x4717c2){if(_0x4717c2){_0x46f27f[_0xef87('0x42')][_0xef87('0x67')]({'id':0x0,'priority':0x0,'app':_0xef87('0x68'),'appdata':_0x4717c2[_0xef87('0x69')]+','+(_0x46f27f[_0xef87('0x38')][_0xef87('0x6a')]||0xa),'interval':_0xef87('0x6b')});}return respondWithRpcPromise(_0xef87('0x6c'),_0xef87('0x6d'),_0x46f27f);});}return respondWithRpcPromise(_0xef87('0x6c'),'startRouting',_0x46f27f);})[_0xef87('0x28')](function(_0x1945b9){_0x69d5f(_0x1945b9);})[_0xef87('0x1a')](function(_0x407ab1){_0x68fe37(_0x37a51a[_0xef87('0x16')](0x1f4,_0x407ab1[_0xef87('0x18')]));});});}; \ No newline at end of file +var _0x8bb2=['update','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','localhost','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowMailAccount','find','NotifyMailAccount','mail','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','isNil','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','List','CmContact','Contacts','DESC','MailServerOut','get','account','applications','Applications','list','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Contact\x20not\x20found'];(function(_0x22d4fd,_0x1ef268){var _0x443d9f=function(_0x1c0874){while(--_0x1c0874){_0x22d4fd['push'](_0x22d4fd['shift']());}};_0x443d9f(++_0x1ef268);}(_0x8bb2,0x1a3));var _0x28bb=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x8bb2[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require(_0x28bb('0x0'));var util=require(_0x28bb('0x1'));var moment=require(_0x28bb('0x2'));var BPromise=require(_0x28bb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28bb('0x4'));var db=require(_0x28bb('0x5'))['db'];var utils=require(_0x28bb('0x6'));var logger=require(_0x28bb('0x7'))(_0x28bb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x28bb('0x9')]({'port':0x232c});config[_0x28bb('0xa')]=_['defaults'](config[_0x28bb('0xa')],{'host':_0x28bb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28bb('0xa')]));require('./mailAccount.socket')[_0x28bb('0xc')](socket);function respondWithRpcPromise(_0x1fd8c5,_0xb4ba85,_0x2798a5){return new BPromise(function(_0x2273af,_0x51b931){return client[_0x28bb('0xd')](_0x1fd8c5,_0x2798a5)[_0x28bb('0xe')](function(_0x33d031){logger['info'](_0x28bb('0xf'),_0xb4ba85,_0x28bb('0x10'));logger['debug'](_0x28bb('0x11'),_0xb4ba85,_0x28bb('0x10'),JSON[_0x28bb('0x12')](_0x33d031));if(_0x33d031['error']){if(_0x33d031[_0x28bb('0x13')]['code']===0x1f4){logger[_0x28bb('0x13')]('MailAccount,\x20%s,\x20%s',_0xb4ba85,_0x33d031[_0x28bb('0x13')][_0x28bb('0x14')]);return _0x51b931(_0x33d031[_0x28bb('0x13')][_0x28bb('0x14')]);}logger[_0x28bb('0x13')](_0x28bb('0xf'),_0xb4ba85,_0x33d031[_0x28bb('0x13')]['message']);return _0x2273af(_0x33d031[_0x28bb('0x13')][_0x28bb('0x14')]);}else{logger[_0x28bb('0x15')]('MailAccount,\x20%s,\x20%s',_0xb4ba85,'request\x20sent');_0x2273af(_0x33d031[_0x28bb('0x16')][_0x28bb('0x14')]);}})[_0x28bb('0x17')](function(_0x57d0a2){logger[_0x28bb('0x13')]('MailAccount,\x20%s,\x20%s',_0xb4ba85,_0x57d0a2);_0x51b931(_0x57d0a2);});});}exports[_0x28bb('0x18')]=function(_0x15bfda){var _0x55511d=this;return new Promise(function(_0x14d2c5,_0x4173cd){return db[_0x28bb('0x19')][_0x28bb('0x1a')]({'raw':_0x15bfda[_0x28bb('0x1b')]?_0x15bfda[_0x28bb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x15bfda[_0x28bb('0x1b')]?_0x15bfda[_0x28bb('0x1b')][_0x28bb('0x1c')]||null:null,'attributes':_0x15bfda[_0x28bb('0x1b')]?_0x15bfda['options'][_0x28bb('0x1d')]||null:null,'limit':_0x15bfda['options']?_0x15bfda['options'][_0x28bb('0x1e')]||null:null,'include':_0x15bfda[_0x28bb('0x1b')]?_0x15bfda[_0x28bb('0x1b')][_0x28bb('0x1f')]?_[_0x28bb('0x20')](_0x15bfda[_0x28bb('0x1b')][_0x28bb('0x1f')],function(_0x21f492){return{'model':db[_0x21f492[_0x28bb('0x21')]],'as':_0x21f492['as'],'attributes':_0x21f492[_0x28bb('0x1d')],'include':_0x21f492['include']?_['map'](_0x21f492[_0x28bb('0x1f')],function(_0x3fd996){return{'model':db[_0x3fd996[_0x28bb('0x21')]],'as':_0x3fd996['as'],'attributes':_0x3fd996['attributes'],'include':_0x3fd996[_0x28bb('0x1f')]?_['map'](_0x3fd996[_0x28bb('0x1f')],function(_0x258075){return{'model':db[_0x258075[_0x28bb('0x21')]],'as':_0x258075['as'],'attributes':_0x258075[_0x28bb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x28bb('0xe')](function(_0xb9ef07){logger[_0x28bb('0x15')]('GetMailAccount',_0x15bfda);logger[_0x28bb('0x22')](_0x28bb('0x18'),_0x15bfda,JSON[_0x28bb('0x12')](_0xb9ef07));_0x14d2c5(_0xb9ef07);})[_0x28bb('0x17')](function(_0x1d555d){logger[_0x28bb('0x13')]('GetMailAccount',_0x1d555d[_0x28bb('0x14')],_0x15bfda);_0x4173cd(_0x55511d[_0x28bb('0x13')](0x1f4,_0x1d555d[_0x28bb('0x14')]));});});};exports[_0x28bb('0x23')]=function(_0x1a4afa){var _0x5dab41=this;return new Promise(function(_0x20eccf,_0x9315bd){return db[_0x28bb('0x19')][_0x28bb('0x24')]({'raw':_0x1a4afa[_0x28bb('0x1b')]?_0x1a4afa['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a4afa[_0x28bb('0x1b')]?_0x1a4afa[_0x28bb('0x1b')][_0x28bb('0x1c')]||null:null,'attributes':_0x1a4afa[_0x28bb('0x1b')]?_0x1a4afa['options'][_0x28bb('0x1d')]||null:null,'include':_0x1a4afa[_0x28bb('0x1b')]?_0x1a4afa[_0x28bb('0x1b')][_0x28bb('0x1f')]?_[_0x28bb('0x20')](_0x1a4afa[_0x28bb('0x1b')]['include'],function(_0x1bc119){return{'model':db[_0x1bc119['model']],'as':_0x1bc119['as'],'attributes':_0x1bc119[_0x28bb('0x1d')],'include':_0x1bc119[_0x28bb('0x1f')]?_[_0x28bb('0x20')](_0x1bc119[_0x28bb('0x1f')],function(_0x4c3ec5){return{'model':db[_0x4c3ec5[_0x28bb('0x21')]],'as':_0x4c3ec5['as'],'attributes':_0x4c3ec5['attributes'],'include':_0x4c3ec5['include']?_[_0x28bb('0x20')](_0x4c3ec5[_0x28bb('0x1f')],function(_0x50c5c1){return{'model':db[_0x50c5c1['model']],'as':_0x50c5c1['as'],'attributes':_0x50c5c1[_0x28bb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x28bb('0xe')](function(_0x3254ad){logger[_0x28bb('0x15')](_0x28bb('0x23'),_0x1a4afa);logger['debug'](_0x28bb('0x23'),_0x1a4afa,JSON[_0x28bb('0x12')](_0x3254ad));_0x20eccf(_0x3254ad);})[_0x28bb('0x17')](function(_0x1ccd80){logger[_0x28bb('0x13')](_0x28bb('0x23'),_0x1ccd80[_0x28bb('0x14')],_0x1a4afa);_0x9315bd(_0x5dab41[_0x28bb('0x13')](0x1f4,_0x1ccd80[_0x28bb('0x14')]));});});};exports[_0x28bb('0x25')]=function(_0x49b198){var _0x5c6599=this;return new Promise(function(_0x251498,_0x128899){var _0x508845={'body':_0x49b198['body'],'channel':_0x28bb('0x26')};var _0x537da1=_['difference'](_[_0x28bb('0x27')](db['CmContact'][_0x28bb('0x28')]),[_0x28bb('0x29'),_0x28bb('0x2a'),_0x28bb('0x2b'),_0x28bb('0x2c')]);var _0x2cf38a=![];if(_0x49b198[_0x28bb('0x2d')]['id']){delete _0x49b198[_0x28bb('0x2d')]['id'];}if(_['isNil'](_0x49b198[_0x28bb('0x2d')][_0x28bb('0x2e')])){return _0x128899(_0x5c6599[_0x28bb('0x13')](0x1f4,_0x28bb('0x2f')));}if(_[_0x28bb('0x30')](_0x49b198[_0x28bb('0x2d')][_0x28bb('0x2d')])||_0x49b198[_0x28bb('0x2d')][_0x28bb('0x2d')]===''){return _0x128899(_0x5c6599[_0x28bb('0x13')](0x1f4,_0x28bb('0x31')));}if(_[_0x28bb('0x30')](_0x49b198[_0x28bb('0x2d')][_0x28bb('0x32')])){return _0x128899(_0x5c6599[_0x28bb('0x13')](0x1f4,_0x28bb('0x33')+_0x537da1));}if(!_['includes'](_0x537da1,_0x49b198[_0x28bb('0x2d')][_0x28bb('0x32')])){return _0x128899(_0x5c6599[_0x28bb('0x13')](0x1f4,_0x28bb('0x34')+_0x537da1));}var _0x46af6b={};_0x46af6b[_0x49b198[_0x28bb('0x2d')][_0x28bb('0x32')]]=_0x49b198[_0x28bb('0x2d')]['from'];return db['MailAccount'][_0x28bb('0x24')]({'where':{'id':_0x49b198['account']['id']},'include':[{'model':db[_0x28bb('0x35')],'as':_0x28bb('0x36'),'include':[{'model':db[_0x28bb('0x37')],'as':_0x28bb('0x38'),'where':_0x46af6b,'limit':0x1,'order':[[_0x28bb('0x2a'),_0x28bb('0x39')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x28bb('0x3a')],'as':'Smtp'}]})[_0x28bb('0xe')](function(_0x56d1c3){if(_0x56d1c3&&_0x56d1c3[_0x28bb('0x36')]){var _0x388617=_0x56d1c3[_0x28bb('0x3b')]({'plain':!![]});_0x508845[_0x28bb('0x3c')]=_['omit'](_0x388617,['Applications',_0x28bb('0x36')]);_0x508845[_0x28bb('0x3d')]=_0x388617[_0x28bb('0x3e')];_0x508845[_0x28bb('0x3f')]=_0x388617['List'];_0x508845[_0x28bb('0x3d')]=_['orderBy'](_0x508845[_0x28bb('0x3d')],['priority'],[_0x28bb('0x40')]);if(_0x508845[_0x28bb('0x3c')]&&_0x508845['account'][_0x28bb('0x41')]){_0x508845[_0x28bb('0x3d')][_0x28bb('0x42')]({'id':0x0,'priority':_0x508845[_0x28bb('0x3d')][_0x28bb('0x43')]+0x1,'app':_0x28bb('0x44'),'appdata':_0x28bb('0x41'),'interval':_0x28bb('0x45')});}if(_0x508845[_0x28bb('0x3c')]['Applications']){delete _0x508845[_0x28bb('0x3c')][_0x28bb('0x3e')];}if(_0x508845[_0x28bb('0x3c')]['List']){delete _0x508845[_0x28bb('0x3c')][_0x28bb('0x36')];}if(_0x388617[_0x28bb('0x36')][_0x28bb('0x38')][_0x28bb('0x43')]){return _0x388617['List'][_0x28bb('0x38')][0x0];}var _0x2b31a6=_['defaults'](_0x49b198[_0x28bb('0x2d')],{'firstName':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x2e')],'ListId':_0x388617[_0x28bb('0x2c')]});_0x2b31a6[_0x49b198['body'][_0x28bb('0x32')]]=_0x49b198[_0x28bb('0x2d')]['from'];return db['CmContact'][_0x28bb('0x46')](_0x2b31a6);}else{throw new Error(_0x28bb('0x47'));}})[_0x28bb('0xe')](function(_0x585c6e){_0x508845['contact']=_0x585c6e;if(_0x585c6e){if(!_0x49b198['body']['message']['messageId']){_0x49b198[_0x28bb('0x2d')]['message'][_0x28bb('0x48')]=rs[_0x28bb('0x49')]()+'\x20'+_0x49b198['body'][_0x28bb('0x14')][_0x28bb('0x2e')];}var _0x5207bb={'ContactId':_0x585c6e['id'],'MailAccountId':_0x49b198['account']['id'],'inReplyTo':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')]['messageId'],'to':_0x49b198['body']['message'][_0x28bb('0x2e')],'cc':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')]['cc'],'subject':_0x49b198['body'][_0x28bb('0x14')][_0x28bb('0x4a')],'attach':_0x49b198['body'][_0x28bb('0x14')][_0x28bb('0x4b')],'lastMsgAt':moment()[_0x28bb('0x4c')](_0x28bb('0x4d')),'lastMsgDirection':'in'};return db[_0x28bb('0x4e')][_0x28bb('0x24')]({'where':{'closed':![],'MailAccountId':_0x49b198[_0x28bb('0x3c')]['id']},'include':[{'model':db[_0x28bb('0x4f')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')]['inReplyTo']}}]})[_0x28bb('0xe')](function(_0x3ea360){if(_0x3ea360){return[_0x3ea360,![]];}return db[_0x28bb('0x4e')][_0x28bb('0x46')](_0x5207bb)[_0x28bb('0xe')](function(_0x2e0ef8){return[_0x2e0ef8,!![]];});});}else{throw new Error(_0x28bb('0x50'));}})['spread'](function(_0x406cf0,_0x44be73){if(_0x406cf0){_0x2cf38a=_0x44be73;if(!_0x44be73){return _0x406cf0[_0x28bb('0x51')]({'inReplyTo':_0x49b198['body']['message'][_0x28bb('0x48')],'to':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')]['from'],'cc':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')]['cc'],'subject':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')][_0x28bb('0x4a')],'attach':_0x406cf0[_0x28bb('0x4b')]?_0x406cf0['attach']:_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')][_0x28bb('0x4b')],'substatus':null,'substatusAt':moment()['format'](_0x28bb('0x4d')),'lastMsgAt':moment()[_0x28bb('0x4c')](_0x28bb('0x4d')),'lastMsgDirection':'in'});}else{return _0x406cf0;}}})[_0x28bb('0xe')](function(_0x426ac1){_0x508845[_0x28bb('0x52')]=_0x426ac1[_0x28bb('0x3b')]({'plain':!![]});_0x508845['interaction'][_0x28bb('0x53')]=_0x2cf38a;return db[_0x28bb('0x4f')][_0x28bb('0x46')]({'body':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x2d')],'MailAccountId':_0x49b198[_0x28bb('0x3c')]['id'],'MailInteractionId':_0x426ac1['id'],'direction':'in','ContactId':_0x508845['contact']['id'],'messageId':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')][_0x28bb('0x48')],'from':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')][_0x28bb('0x2e')],'to':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')]['to'],'cc':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')]['cc'],'subject':_0x49b198[_0x28bb('0x2d')]['message'][_0x28bb('0x4a')],'attach':_0x49b198[_0x28bb('0x2d')]['message']['attach'],'Attachments':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')][_0x28bb('0x54')],'originTo':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')][_0x28bb('0x55')],'originCc':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')]['originCc'],'bcc':_0x49b198['body'][_0x28bb('0x14')][_0x28bb('0x56')],'ChatWebsiteId':_0x49b198['body'][_0x28bb('0x14')][_0x28bb('0x57')]||null,'originChannel':_0x49b198[_0x28bb('0x2d')][_0x28bb('0x14')][_0x28bb('0x58')]||_0x28bb('0x59'),'ChatOfflineMessageId':_0x49b198['body']['message'][_0x28bb('0x5a')]||null},{'include':[{'model':db['Attachment'],'as':_0x28bb('0x5b')}]});})['then'](function(_0x2d9456){_0x508845[_0x28bb('0x14')]=_0x2d9456;if(_0x508845['interaction'][_0x28bb('0x5c')]){return db[_0x28bb('0x5d')][_0x28bb('0x24')]({'attributes':['id',_0x28bb('0x5e')],'where':{'id':_0x508845[_0x28bb('0x52')]['UserId']}})[_0x28bb('0xe')](function(_0x4d501f){if(_0x4d501f){_0x508845[_0x28bb('0x3d')][_0x28bb('0x5f')]({'id':0x0,'priority':0x0,'app':_0x28bb('0x60'),'appdata':_0x4d501f[_0x28bb('0x5e')]+','+(_0x508845[_0x28bb('0x3c')][_0x28bb('0x61')]||0xa),'interval':_0x28bb('0x45')});}return respondWithRpcPromise(_0x28bb('0x62'),_0x28bb('0x63'),_0x508845);});}return respondWithRpcPromise(_0x28bb('0x62'),'startRouting',_0x508845);})[_0x28bb('0xe')](function(_0x257bcc){_0x251498(_0x257bcc);})[_0x28bb('0x17')](function(_0x227ae9){_0x128899(_0x5c6599[_0x28bb('0x13')](0x1f4,_0x227ae9[_0x28bb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 53e8a99..6b08e14 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 _0x40bc=['./mailAccount.events','save','removeListener'];(function(_0x4b41fc,_0x1623f5){var _0x22a296=function(_0x1602c6){while(--_0x1602c6){_0x4b41fc['push'](_0x4b41fc['shift']());}};_0x22a296(++_0x1623f5);}(_0x40bc,0x10e));var _0xc40b=function(_0x18a686,_0x23efc2){_0x18a686=_0x18a686-0x0;var _0x6eb364=_0x40bc[_0x18a686];return _0x6eb364;};'use strict';var MailAccountEvents=require(_0xc40b('0x0'));var events=[_0xc40b('0x1'),'remove','update'];function createListener(_0x1c7aed,_0x40f989){return function(_0x945711){_0x40f989['emit'](_0x1c7aed,_0x945711);};}function removeListener(_0x5a76ae,_0x255ebc){return function(){MailAccountEvents[_0xc40b('0x2')](_0x5a76ae,_0x255ebc);};}exports['register']=function(_0x4bb225){for(var _0x1a29fe=0x0,_0x3ad2a0=events['length'];_0x1a29fe<_0x3ad2a0;_0x1a29fe++){var _0x50c987=events[_0x1a29fe];var _0x2fedab=createListener('mailAccount:'+_0x50c987,_0x4bb225);MailAccountEvents['on'](_0x50c987,_0x2fedab);}}; \ No newline at end of file +var _0x7309=['remove','emit','register','mailAccount:','save'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x7309,0x18f));var _0x9730=function(_0x2d8822,_0xb51a9d){_0x2d8822=_0x2d8822-0x0;var _0x9828a1=_0x7309[_0x2d8822];return _0x9828a1;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x9730('0x0'),_0x9730('0x1'),'update'];function createListener(_0x447c3b,_0x23df49){return function(_0x41138e){_0x23df49[_0x9730('0x2')](_0x447c3b,_0x41138e);};}function removeListener(_0x13e265,_0x357f7a){return function(){MailAccountEvents['removeListener'](_0x13e265,_0x357f7a);};}exports[_0x9730('0x3')]=function(_0x446466){for(var _0x4c8f5a=0x0,_0x1266bf=events['length'];_0x4c8f5a<_0x1266bf;_0x4c8f5a++){var _0x3163b9=events[_0x4c8f5a];var _0x37e041=createListener(_0x9730('0x4')+_0x3163b9,_0x446466);MailAccountEvents['on'](_0x3163b9,_0x37e041);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d6dceff..56c04e7 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 _0x1c22=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','put','update','delete','isAuthenticated','destroy','exports'];(function(_0x5d52a4,_0x54e8d1){var _0x55dfcd=function(_0x38a301){while(--_0x38a301){_0x5d52a4['push'](_0x5d52a4['shift']());}};_0x55dfcd(++_0x54e8d1);}(_0x1c22,0x90));var _0x21c2=function(_0x5759f8,_0x6d946c){_0x5759f8=_0x5759f8-0x0;var _0x1a88dc=_0x1c22[_0x5759f8];return _0x1a88dc;};'use strict';var multer=require(_0x21c2('0x0'));var util=require(_0x21c2('0x1'));var path=require(_0x21c2('0x2'));var timeout=require(_0x21c2('0x3'));var express=require(_0x21c2('0x4'));var router=express[_0x21c2('0x5')]();var fs_extra=require(_0x21c2('0x6'));var auth=require(_0x21c2('0x7'));var interaction=require(_0x21c2('0x8'));var config=require(_0x21c2('0x9'));var controller=require(_0x21c2('0xa'));router['get'](_0x21c2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x21c2('0xc')](_0x21c2('0xb'),auth['isAuthenticated'](),controller[_0x21c2('0xd')]);router[_0x21c2('0xe')](_0x21c2('0xb'),auth[_0x21c2('0xf')](),controller[_0x21c2('0x10')]);module[_0x21c2('0x11')]=router; \ No newline at end of file +var _0x5abd=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','put'];(function(_0x52e40f,_0x239b35){var _0x2291bd=function(_0x143740){while(--_0x143740){_0x52e40f['push'](_0x52e40f['shift']());}};_0x2291bd(++_0x239b35);}(_0x5abd,0x1cd));var _0xd5ab=function(_0x359fe4,_0x50f9e4){_0x359fe4=_0x359fe4-0x0;var _0x32e4a3=_0x5abd[_0x359fe4];return _0x32e4a3;};'use strict';var multer=require(_0xd5ab('0x0'));var util=require(_0xd5ab('0x1'));var path=require(_0xd5ab('0x2'));var timeout=require(_0xd5ab('0x3'));var express=require(_0xd5ab('0x4'));var router=express['Router']();var fs_extra=require(_0xd5ab('0x5'));var auth=require(_0xd5ab('0x6'));var interaction=require(_0xd5ab('0x7'));var config=require(_0xd5ab('0x8'));var controller=require(_0xd5ab('0x9'));router[_0xd5ab('0xa')]('/:id',auth[_0xd5ab('0xb')](),controller[_0xd5ab('0xc')]);router[_0xd5ab('0xd')](_0xd5ab('0xe'),auth['isAuthenticated'](),controller[_0xd5ab('0xf')]);router[_0xd5ab('0x10')](_0xd5ab('0xe'),auth[_0xd5ab('0xb')](),controller[_0xd5ab('0x11')]);module[_0xd5ab('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e1c8671..437a2e3 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 _0xb9ac=['TEXT','sequelize','exports','STRING','noop'];(function(_0x4c840e,_0x47bbf6){var _0xd22165=function(_0x51996c){while(--_0x51996c){_0x4c840e['push'](_0x4c840e['shift']());}};_0xd22165(++_0x47bbf6);}(_0xb9ac,0x169));var _0xcb9a=function(_0x194fea,_0x453677){_0x194fea=_0x194fea-0x0;var _0x40f3b8=_0xb9ac[_0x194fea];return _0x40f3b8;};'use strict';var Sequelize=require(_0xcb9a('0x0'));module[_0xcb9a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xcb9a('0x2')],'allowNull':![],'defaultValue':_0xcb9a('0x3')},'appdata':{'type':Sequelize[_0xcb9a('0x4')]()},'description':{'type':Sequelize[_0xcb9a('0x2')]},'interval':{'type':Sequelize[_0xcb9a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5e96=['*,*,*,*','sequelize','INTEGER','STRING','TEXT'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x5e96,0x169));var _0x65e9=function(_0x232a41,_0x51ede7){_0x232a41=_0x232a41-0x0;var _0x47857c=_0x5e96[_0x232a41];return _0x47857c;};'use strict';var Sequelize=require(_0x65e9('0x0'));module['exports']={'priority':{'type':Sequelize[_0x65e9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x65e9('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x65e9('0x3')]()},'description':{'type':Sequelize[_0x65e9('0x2')]},'interval':{'type':Sequelize[_0x65e9('0x2')],'defaultValue':_0x65e9('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2895928..8d52245 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 _0xedd9=['query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','show','params','keys','MailApplication','rawAttributes'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xedd9,0xfc));var _0x9edd=function(_0x203a8e,_0x307806){_0x203a8e=_0x203a8e-0x0;var _0x35c998=_0xedd9[_0x203a8e];return _0x35c998;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={'raw':!![],'where':{'id':_0x52746a[_0x9edd('0x27')]['id']}},_0x2ae8dd={};_0x2ae8dd['model']=_[_0x9edd('0x28')](db[_0x9edd('0x29')][_0x9edd('0x2a')]);_0x2ae8dd[_0x9edd('0x2b')]=_[_0x9edd('0x28')](_0x52746a[_0x9edd('0x2b')]);_0x2ae8dd[_0x9edd('0x2c')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],_0x2ae8dd[_0x9edd('0x2b')]);_0x28cfae[_0x9edd('0x2f')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],qs[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2b')]['fields']));_0x28cfae[_0x9edd('0x2f')]=_0x28cfae[_0x9edd('0x2f')][_0x9edd('0x31')]?_0x28cfae['attributes']:_0x2ae8dd[_0x9edd('0x2e')];if(_0x52746a[_0x9edd('0x2b')][_0x9edd('0x32')]){_0x28cfae[_0x9edd('0x33')]=[{'all':!![]}];}_0x28cfae=_[_0x9edd('0x34')]({},_0x28cfae,_0x52746a[_0x9edd('0x35')]);return db[_0x9edd('0x29')][_0x9edd('0x36')](_0x28cfae)[_0x9edd('0x21')](handleEntityNotFound(_0x238b22,null))[_0x9edd('0x21')](respondWithResult(_0x238b22,null))[_0x9edd('0x37')](handleError(_0x238b22,null));};exports[_0x9edd('0x38')]=function(_0x27eb7e,_0x14f780){if(_0x27eb7e['body']['id']){delete _0x27eb7e[_0x9edd('0x39')]['id'];}return db['MailApplication'][_0x9edd('0x36')]({'where':{'id':_0x27eb7e[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x14f780,null))[_0x9edd('0x21')](saveUpdates(_0x27eb7e[_0x9edd('0x39')],null))['then'](respondWithResult(_0x14f780,null))[_0x9edd('0x37')](handleError(_0x14f780,null));};exports[_0x9edd('0x3a')]=function(_0x2b3469,_0x38e9be){return db[_0x9edd('0x29')][_0x9edd('0x36')]({'where':{'id':_0x2b3469[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x38e9be,null))[_0x9edd('0x21')](removeEntity(_0x38e9be,null))[_0x9edd('0x37')](handleError(_0x38e9be,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x51f593,_0x38d2ec){_0x51f593=_0x51f593-0x0;var _0x4ccfbf=_0xbdb7[_0x51f593];return _0x4ccfbf;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3693671..892d164 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 _0xa58c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci'];(function(_0x22fc05,_0x100e36){var _0x4ca086=function(_0x267b6d){while(--_0x267b6d){_0x22fc05['push'](_0x22fc05['shift']());}};_0x4ca086(++_0x100e36);}(_0xa58c,0xf7));var _0xca58=function(_0x4c119d,_0x35ba6c){_0x4c119d=_0x4c119d-0x0;var _0x37ee10=_0xa58c[_0x4c119d];return _0x37ee10;};'use strict';var _=require(_0xca58('0x0'));var util=require(_0xca58('0x1'));var logger=require('../../config/logger')(_0xca58('0x2'));var moment=require(_0xca58('0x3'));var BPromise=require(_0xca58('0x4'));var rp=require(_0xca58('0x5'));var fs=require('fs');var path=require(_0xca58('0x6'));var rimraf=require(_0xca58('0x7'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0xca58('0x8')]=function(_0x479be0,_0x25015e){return _0x479be0[_0xca58('0x9')](_0xca58('0xa'),attributes,{'tableName':_0xca58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xca58('0xc')});}; \ No newline at end of file +var _0x65dd=['api','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x65dd,0x1c5));var _0xd65d=function(_0xc1cffa,_0x1e2c88){_0xc1cffa=_0xc1cffa-0x0;var _0x4c349e=_0x65dd[_0xc1cffa];return _0x4c349e;};'use strict';var _=require(_0xd65d('0x0'));var util=require('util');var logger=require(_0xd65d('0x1'))(_0xd65d('0x2'));var moment=require(_0xd65d('0x3'));var BPromise=require(_0xd65d('0x4'));var rp=require(_0xd65d('0x5'));var fs=require('fs');var path=require(_0xd65d('0x6'));var rimraf=require('rimraf');var config=require(_0xd65d('0x7'));var attributes=require(_0xd65d('0x8'));module[_0xd65d('0x9')]=function(_0x564c8e,_0x2df676){return _0x564c8e[_0xd65d('0xa')](_0xd65d('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd65d('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 32ca4ed..742d43c 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 _0x622a=['body','options','raw','attributes','limit','UpdateMailApplication','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xec8abe,_0x2ee29d){var _0x42101a=function(_0x211ba0){while(--_0x211ba0){_0xec8abe['push'](_0xec8abe['shift']());}};_0x42101a(++_0x2ee29d);}(_0x622a,0xae));var _0xa622=function(_0x3e9b7c,_0x395957){_0x3e9b7c=_0x3e9b7c-0x0;var _0x2921ce=_0x622a[_0x3e9b7c];return _0x2921ce;};'use strict';var _=require(_0xa622('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa622('0x1'));var rs=require(_0xa622('0x2'));var fs=require('fs');var Redis=require(_0xa622('0x3'));var db=require(_0xa622('0x4'))['db'];var utils=require(_0xa622('0x5'));var logger=require(_0xa622('0x6'))(_0xa622('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa622('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59e67f,_0x4ecf93,_0xdd8d91){return new BPromise(function(_0x2a308a,_0x32c326){return client[_0xa622('0x9')](_0x59e67f,_0xdd8d91)[_0xa622('0xa')](function(_0x202a82){logger[_0xa622('0xb')](_0xa622('0xc'),_0x4ecf93,_0xa622('0xd'));logger[_0xa622('0xe')](_0xa622('0xf'),_0x4ecf93,'request\x20sent',JSON[_0xa622('0x10')](_0x202a82));if(_0x202a82[_0xa622('0x11')]){if(_0x202a82[_0xa622('0x11')][_0xa622('0x12')]===0x1f4){logger['error'](_0xa622('0xc'),_0x4ecf93,_0x202a82[_0xa622('0x11')][_0xa622('0x13')]);return _0x32c326(_0x202a82[_0xa622('0x11')][_0xa622('0x13')]);}logger['error'](_0xa622('0xc'),_0x4ecf93,_0x202a82[_0xa622('0x11')][_0xa622('0x13')]);return _0x2a308a(_0x202a82[_0xa622('0x11')][_0xa622('0x13')]);}else{logger[_0xa622('0xb')]('MailApplication,\x20%s,\x20%s',_0x4ecf93,_0xa622('0xd'));_0x2a308a(_0x202a82[_0xa622('0x14')]['message']);}})[_0xa622('0x15')](function(_0x98fb34){logger['error'](_0xa622('0xc'),_0x4ecf93,_0x98fb34);_0x32c326(_0x98fb34);});});}exports['UpdateMailApplication']=function(_0x3ad864){var _0x192ee5=this;return new Promise(function(_0x413d0d,_0x58ccc9){return db['MailApplication']['update'](_0x3ad864[_0xa622('0x16')],{'raw':_0x3ad864[_0xa622('0x17')]?_0x3ad864[_0xa622('0x17')][_0xa622('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad864['options']?_0x3ad864[_0xa622('0x17')]['where']||null:null,'attributes':_0x3ad864[_0xa622('0x17')]?_0x3ad864['options'][_0xa622('0x19')]||null:null,'limit':_0x3ad864[_0xa622('0x17')]?_0x3ad864['options'][_0xa622('0x1a')]||null:null})[_0xa622('0xa')](function(_0x3ec460){logger[_0xa622('0xb')](_0xa622('0x1b'),_0x3ad864);logger[_0xa622('0xe')](_0xa622('0x1b'),_0x3ad864,JSON[_0xa622('0x10')](_0x3ec460));_0x413d0d(_0x3ec460);})[_0xa622('0x15')](function(_0x35a070){logger[_0xa622('0x11')]('UpdateMailApplication',_0x35a070[_0xa622('0x13')],_0x3ad864);_0x58ccc9(_0x192ee5[_0xa622('0x11')](0x1f4,_0x35a070[_0xa622('0x13')]));});});}; \ No newline at end of file +var _0xda1d=['debug','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x57df1b,_0x57c7dd){var _0x476a12=function(_0x518e93){while(--_0x518e93){_0x57df1b['push'](_0x57df1b['shift']());}};_0x476a12(++_0x57c7dd);}(_0xda1d,0x9b));var _0xdda1=function(_0x2aec53,_0x41fd7e){_0x2aec53=_0x2aec53-0x0;var _0x2a84fd=_0xda1d[_0x2aec53];return _0x2a84fd;};'use strict';var _=require(_0xdda1('0x0'));var util=require('util');var moment=require(_0xdda1('0x1'));var BPromise=require(_0xdda1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdda1('0x3'))['db'];var utils=require(_0xdda1('0x4'));var logger=require(_0xdda1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdda1('0x6'));var client=jayson[_0xdda1('0x7')][_0xdda1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x485ac3,_0x1bb529,_0x52c025){return new BPromise(function(_0x59c50f,_0x45d43f){return client[_0xdda1('0x9')](_0x485ac3,_0x52c025)[_0xdda1('0xa')](function(_0x39635f){logger[_0xdda1('0xb')]('MailApplication,\x20%s,\x20%s',_0x1bb529,_0xdda1('0xc'));logger[_0xdda1('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1bb529,_0xdda1('0xc'),JSON[_0xdda1('0xe')](_0x39635f));if(_0x39635f[_0xdda1('0xf')]){if(_0x39635f[_0xdda1('0xf')][_0xdda1('0x10')]===0x1f4){logger[_0xdda1('0xf')](_0xdda1('0x11'),_0x1bb529,_0x39635f['error'][_0xdda1('0x12')]);return _0x45d43f(_0x39635f[_0xdda1('0xf')][_0xdda1('0x12')]);}logger['error'](_0xdda1('0x11'),_0x1bb529,_0x39635f[_0xdda1('0xf')][_0xdda1('0x12')]);return _0x59c50f(_0x39635f[_0xdda1('0xf')][_0xdda1('0x12')]);}else{logger[_0xdda1('0xb')](_0xdda1('0x11'),_0x1bb529,_0xdda1('0xc'));_0x59c50f(_0x39635f[_0xdda1('0x13')][_0xdda1('0x12')]);}})[_0xdda1('0x14')](function(_0x2c4ec2){logger[_0xdda1('0xf')]('MailApplication,\x20%s,\x20%s',_0x1bb529,_0x2c4ec2);_0x45d43f(_0x2c4ec2);});});}exports[_0xdda1('0x15')]=function(_0xf6fa0c){var _0x1ed5c2=this;return new Promise(function(_0x126421,_0xe9e40f){return db[_0xdda1('0x16')][_0xdda1('0x17')](_0xf6fa0c['body'],{'raw':_0xf6fa0c[_0xdda1('0x18')]?_0xf6fa0c[_0xdda1('0x18')][_0xdda1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf6fa0c[_0xdda1('0x18')]?_0xf6fa0c[_0xdda1('0x18')]['where']||null:null,'attributes':_0xf6fa0c[_0xdda1('0x18')]?_0xf6fa0c[_0xdda1('0x18')][_0xdda1('0x1a')]||null:null,'limit':_0xf6fa0c['options']?_0xf6fa0c[_0xdda1('0x18')][_0xdda1('0x1b')]||null:null})[_0xdda1('0xa')](function(_0x573583){logger[_0xdda1('0xb')](_0xdda1('0x15'),_0xf6fa0c);logger[_0xdda1('0xd')](_0xdda1('0x15'),_0xf6fa0c,JSON[_0xdda1('0xe')](_0x573583));_0x126421(_0x573583);})['catch'](function(_0x53e0a2){logger[_0xdda1('0xf')](_0xdda1('0x15'),_0x53e0a2[_0xdda1('0x12')],_0xf6fa0c);_0xe9e40f(_0x1ed5c2['error'](0x1f4,_0x53e0a2[_0xdda1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8559c20..d9649a1 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 _0x1319=['destroy','delete','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update'];(function(_0x1536f6,_0x48bf1e){var _0x335b81=function(_0x4f585e){while(--_0x4f585e){_0x1536f6['push'](_0x1536f6['shift']());}};_0x335b81(++_0x48bf1e);}(_0x1319,0xf3));var _0x9131=function(_0xc1ab6d,_0x5a67b2){_0xc1ab6d=_0xc1ab6d-0x0;var _0x1e682a=_0x1319[_0xc1ab6d];return _0x1e682a;};'use strict';var express=require(_0x9131('0x0'));var router=express[_0x9131('0x1')]();var auth=require(_0x9131('0x2'));var interaction=require(_0x9131('0x3'));var controller=require('./mailInteraction.controller');router[_0x9131('0x4')]('/',auth[_0x9131('0x5')](),controller['index']);router[_0x9131('0x4')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9131('0x4')](_0x9131('0x6'),auth[_0x9131('0x5')](),controller['show']);router[_0x9131('0x4')]('/:id/messages',auth[_0x9131('0x5')](),controller[_0x9131('0x7')]);router[_0x9131('0x4')](_0x9131('0x8'),auth[_0x9131('0x5')](),controller[_0x9131('0x9')]);router[_0x9131('0xa')]('/',auth[_0x9131('0x5')](),controller[_0x9131('0xb')]);router[_0x9131('0xa')](_0x9131('0xc'),auth[_0x9131('0x5')](),controller['addMessage']);router[_0x9131('0xa')](_0x9131('0xd'),auth[_0x9131('0x5')](),interaction[_0x9131('0xe')](_0x9131('0xf'),_0x9131('0x10')),controller[_0x9131('0x11')]);router[_0x9131('0x12')](_0x9131('0x6'),auth[_0x9131('0x5')](),interaction[_0x9131('0xe')](_0x9131('0xf'),_0x9131('0x13')),controller[_0x9131('0x14')]);router['delete'](_0x9131('0x6'),auth[_0x9131('0x5')](),interaction['tracked'](_0x9131('0xf'),'mailinteraction:destroy'),controller[_0x9131('0x15')]);router[_0x9131('0x16')](_0x9131('0xd'),auth[_0x9131('0x5')](),controller['removeTags']);module[_0x9131('0x17')]=router; \ No newline at end of file +var _0x580e=['post','create','addMessage','/:id/tags','mail','/:id','mailinteraction:update','update','delete','tracked','mailinteraction:destroy','destroy','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','index','/describe','isAuthenticated','describe','get','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x19700a,_0x5d55ca){var _0x23ce5d=function(_0x4113e0){while(--_0x4113e0){_0x19700a['push'](_0x19700a['shift']());}};_0x23ce5d(++_0x5d55ca);}(_0x580e,0x1a2));var _0xe580=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x580e[_0x40a045];return _0x1a687c;};'use strict';var express=require(_0xe580('0x0'));var router=express['Router']();var auth=require(_0xe580('0x1'));var interaction=require(_0xe580('0x2'));var controller=require(_0xe580('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0xe580('0x4')]);router['get'](_0xe580('0x5'),auth[_0xe580('0x6')](),controller[_0xe580('0x7')]);router[_0xe580('0x8')]('/:id',auth[_0xe580('0x6')](),controller[_0xe580('0x9')]);router[_0xe580('0x8')](_0xe580('0xa'),auth[_0xe580('0x6')](),controller[_0xe580('0xb')]);router[_0xe580('0x8')](_0xe580('0xc'),auth[_0xe580('0x6')](),controller[_0xe580('0xd')]);router[_0xe580('0xe')]('/',auth[_0xe580('0x6')](),controller[_0xe580('0xf')]);router[_0xe580('0xe')](_0xe580('0xa'),auth[_0xe580('0x6')](),controller[_0xe580('0x10')]);router['post'](_0xe580('0x11'),auth[_0xe580('0x6')](),interaction['tracked'](_0xe580('0x12'),'mailinteraction:addtags'),controller['addTags']);router['put'](_0xe580('0x13'),auth[_0xe580('0x6')](),interaction['tracked']('mail',_0xe580('0x14')),controller[_0xe580('0x15')]);router[_0xe580('0x16')](_0xe580('0x13'),auth[_0xe580('0x6')](),interaction[_0xe580('0x17')](_0xe580('0x12'),_0xe580('0x18')),controller[_0xe580('0x19')]);router[_0xe580('0x16')]('/:id/tags',auth[_0xe580('0x6')](),controller['removeTags']);module[_0xe580('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 029f79d..73eadc4 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 _0x457b=['ENUM','out','sequelize','iconv','exports','STRING','long','TEXT','BOOLEAN','DATE'];(function(_0x5e215a,_0x14e233){var _0x5d3809=function(_0xb851dc){while(--_0xb851dc){_0x5e215a['push'](_0x5e215a['shift']());}};_0x5d3809(++_0x14e233);}(_0x457b,0x142));var _0xb457=function(_0x42e6ce,_0x511000){_0x42e6ce=_0x42e6ce-0x0;var _0xbe41a7=_0x457b[_0x42e6ce];return _0xbe41a7;};'use strict';var Sequelize=require(_0xb457('0x0'));var iconv=require(_0xb457('0x1'));module[_0xb457('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb457('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb457('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0xb457('0x4'))},'subject':{'type':Sequelize[_0xb457('0x5')]()},'attach':{'type':Sequelize[_0xb457('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb457('0x7')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb457('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb457('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb457('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x26bb=['BOOLEAN','STRING','TEXT','DATE','ENUM','out','sequelize','iconv'];(function(_0xa94f09,_0x1fa848){var _0x4b538b=function(_0x3a6c7e){while(--_0x3a6c7e){_0xa94f09['push'](_0xa94f09['shift']());}};_0x4b538b(++_0x1fa848);}(_0x26bb,0x8e));var _0xb26b=function(_0x2f7d76,_0x283285){_0x2f7d76=_0x2f7d76-0x0;var _0x2a2570=_0x26bb[_0x2f7d76];return _0x2a2570;};'use strict';var Sequelize=require(_0xb26b('0x0'));var iconv=require(_0xb26b('0x1'));module['exports']={'closed':{'type':Sequelize[_0xb26b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb26b('0x3')]},'secondDisposition':{'type':Sequelize[_0xb26b('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb26b('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb26b('0x3')](0x1fe)},'to':{'type':Sequelize[_0xb26b('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xb26b('0x4')]()},'attach':{'type':Sequelize[_0xb26b('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb26b('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xb26b('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xb26b('0x6')]('in',_0xb26b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb26b('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xb26b('0x6')]('in',_0xb26b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb26b('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c3bdb2a..f40b0df 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 _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x46a563,_0x586712){_0x46a563=_0x46a563-0x0;var _0x10aa22=_0xb10b[_0x46a563];return _0x10aa22;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file +var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','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?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0xa2a133,_0x4a1180){var _0xf06e5e=function(_0x480c2a){while(--_0x480c2a){_0xa2a133['push'](_0xa2a133['shift']());}};_0xf06e5e(++_0x4a1180);}(_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 moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 7d9306f..91c4246 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 _0x6366=['unreadMessages','length','emit','catch','hook','exports','../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','findAll'];(function(_0x5d995d,_0x4e835b){var _0x4c97c0=function(_0x5c6378){while(--_0x5c6378){_0x5d995d['push'](_0x5d995d['shift']());}};_0x4c97c0(++_0x4e835b);}(_0x6366,0x105));var _0x6636=function(_0x740eac,_0x2d7e60){_0x740eac=_0x740eac-0x0;var _0x4c3b38=_0x6366[_0x740eac];return _0x4c3b38;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x6636('0x0'))['db'][_0x6636('0x1')];var MailMessage=require(_0x6636('0x0'))['db'][_0x6636('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6636('0x3'),'afterUpdate':_0x6636('0x4'),'afterDestroy':_0x6636('0x5')};function emitEvent(_0xb8f98f){return function(_0x591e08,_0x1f538f,_0x3239c8){_0x591e08[_0x6636('0x6')]({'attributes':['id'],'raw':!![]})[_0x6636('0x7')](function(_0x33e5c5){_0x591e08[_0x6636('0x8')](_0x6636('0x9'),_0x33e5c5['map'](function(_0x7446a4){return{'id':_0x7446a4['id']};}));return MailMessage[_0x6636('0xa')]({'where':{'MailInteractionId':_0x591e08['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x282039){_0x591e08['setDataValue'](_0x6636('0xb'),_0x282039[_0x6636('0xc')]);MailInteractionEvents[_0x6636('0xd')](_0xb8f98f+':'+_0x591e08['id'],_0x591e08);MailInteractionEvents[_0x6636('0xd')](_0xb8f98f,_0x591e08);_0x3239c8(null);})[_0x6636('0xe')](_0x3239c8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x6636('0xf')](e,emitEvent(event));}}module[_0x6636('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x9a13=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','remove','getUsers','Users','findAll','then','setDataValue','unreadMessages'];(function(_0x3b59a6,_0xa95bc5){var _0x3ec4dd=function(_0x5f2aa9){while(--_0x5f2aa9){_0x3b59a6['push'](_0x3b59a6['shift']());}};_0x3ec4dd(++_0xa95bc5);}(_0x9a13,0xc0));var _0x39a1=function(_0x232551,_0x49bcbd){_0x232551=_0x232551-0x0;var _0x5905e2=_0x9a13[_0x232551];return _0x5905e2;};'use strict';var EventEmitter=require(_0x39a1('0x0'));var MailInteraction=require(_0x39a1('0x1'))['db'][_0x39a1('0x2')];var MailMessage=require(_0x39a1('0x1'))['db'][_0x39a1('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x39a1('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x39a1('0x5')};function emitEvent(_0x43fa35){return function(_0x4fa3cc,_0x5b3be6,_0x55c455){_0x4fa3cc[_0x39a1('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x289cc9){_0x4fa3cc['setDataValue'](_0x39a1('0x7'),_0x289cc9['map'](function(_0x22a539){return{'id':_0x22a539['id']};}));return MailMessage[_0x39a1('0x8')]({'where':{'MailInteractionId':_0x4fa3cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x39a1('0x9')](function(_0x84e5d3){_0x4fa3cc[_0x39a1('0xa')](_0x39a1('0xb'),_0x84e5d3[_0x39a1('0xc')]);MailInteractionEvents[_0x39a1('0xd')](_0x43fa35+':'+_0x4fa3cc['id'],_0x4fa3cc);MailInteractionEvents[_0x39a1('0xd')](_0x43fa35,_0x4fa3cc);_0x55c455(null);})['catch'](_0x55c455(null));};}for(var e in events){if(events[_0x39a1('0xe')](e)){var event=events[e];MailInteraction[_0x39a1('0xf')](e,emitEvent(event));}}module[_0x39a1('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 5a13736..d5d626e 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 _0x5fa9=['fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','models','get','MailMessage','then','catch','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fa9,0xfa));var _0x95fa=function(_0x34ebf3,_0x5935c5){_0x34ebf3=_0x34ebf3-0x0;var _0x3a634d=_0x5fa9[_0x34ebf3];return _0x3a634d;};'use strict';var _=require(_0x95fa('0x0'));var util=require(_0x95fa('0x1'));var logger=require('../../config/logger')(_0x95fa('0x2'));var moment=require(_0x95fa('0x3'));var BPromise=require(_0x95fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95fa('0x5'));var rimraf=require('rimraf');var config=require(_0x95fa('0x6'));var attributes=require(_0x95fa('0x7'));module['exports']=function(_0x2c6933,_0x3c30a3){return _0x2c6933['define'](_0x95fa('0x8'),attributes,{'tableName':_0x95fa('0x9'),'paranoid':![],'indexes':[{'name':_0x95fa('0xa'),'fields':[_0x95fa('0xb'),'to'],'type':_0x95fa('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c95d2,_0x39ae89,_0x348597){if(_0x3c95d2[_0x95fa('0xd')]){_0x3c95d2[_0x95fa('0xe')]=moment()[_0x95fa('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3c95d2[_0x95fa('0x10')]){_0x3c95d2[_0x95fa('0x11')]=moment()[_0x95fa('0xf')](_0x95fa('0x12'));}_0x348597(null,_0x39ae89);},'beforeUpdate':function(_0x3edb96,_0x37468e,_0x17fb18){if(_0x3edb96[_0x95fa('0x13')](_0x95fa('0xd'))){_0x3edb96[_0x95fa('0xe')]=_0x3edb96[_0x95fa('0xd')]?moment()[_0x95fa('0xf')](_0x95fa('0x12')):null;}if(_0x3edb96[_0x95fa('0x13')](_0x95fa('0x10'))){_0x3edb96[_0x95fa('0x11')]=moment()[_0x95fa('0xf')](_0x95fa('0x12'));_0x3edb96[_0x95fa('0xd')]=null;_0x3edb96[_0x95fa('0xe')]=null;}_0x17fb18(null,_0x3edb96);},'afterUpdate':function(_0xeb9696,_0x2cd743,_0x583e4b){var _0x14d053=_0x2c6933[_0x95fa('0x14')];var _0x85209c=_0xeb9696[_0x95fa('0x15')]({'plain':!![]});if(_0x85209c[_0x95fa('0x10')]){return _0x14d053[_0x95fa('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x85209c['id']}})[_0x95fa('0x17')](function(){_0x583e4b();})[_0x95fa('0x18')](function(_0x1d1ac4){_0x583e4b(_0x1d1ac4);});}else{_0x583e4b();}}},'charset':'utf8mb4','collate':_0x95fa('0x19')});}; \ No newline at end of file +var _0x2240=['MailInteraction','mail_interactions','subject','substatusAt','format','closed','closedAt','substatus','YYYY-MM-DD\x20HH:mm:ss','models','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1276f9,_0x2539a0){var _0x18a7cc=function(_0x1bb02b){while(--_0x1bb02b){_0x1276f9['push'](_0x1276f9['shift']());}};_0x18a7cc(++_0x2539a0);}(_0x2240,0x18a));var _0x0224=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x2240[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x0224('0x0'));var util=require(_0x0224('0x1'));var logger=require(_0x0224('0x2'))(_0x0224('0x3'));var moment=require(_0x0224('0x4'));var BPromise=require('bluebird');var rp=require(_0x0224('0x5'));var fs=require('fs');var path=require(_0x0224('0x6'));var rimraf=require(_0x0224('0x7'));var config=require(_0x0224('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x0224('0x9')]=function(_0x54360c,_0x2a6e71){return _0x54360c[_0x0224('0xa')](_0x0224('0xb'),attributes,{'tableName':_0x0224('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x0224('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x48df85,_0x1597d3,_0x3d5452){if(_0x48df85['substatus']){_0x48df85[_0x0224('0xe')]=moment()[_0x0224('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x48df85[_0x0224('0x10')]){_0x48df85[_0x0224('0x11')]=moment()[_0x0224('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3d5452(null,_0x1597d3);},'beforeUpdate':function(_0x2be8c0,_0x8cf581,_0x3b4f2b){if(_0x2be8c0['changed'](_0x0224('0x12'))){_0x2be8c0[_0x0224('0xe')]=_0x2be8c0[_0x0224('0x12')]?moment()['format'](_0x0224('0x13')):null;}if(_0x2be8c0['changed'](_0x0224('0x10'))){_0x2be8c0['closedAt']=moment()[_0x0224('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x2be8c0['substatus']=null;_0x2be8c0['substatusAt']=null;}_0x3b4f2b(null,_0x2be8c0);},'afterUpdate':function(_0x53aaef,_0x3e38a5,_0x8ceadf){var _0x578013=_0x54360c[_0x0224('0x14')];var _0x17e81e=_0x53aaef[_0x0224('0x15')]({'plain':!![]});if(_0x17e81e[_0x0224('0x10')]){return _0x578013[_0x0224('0x16')][_0x0224('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x17e81e['id']}})['then'](function(){_0x8ceadf();})[_0x0224('0x18')](function(_0x260635){_0x8ceadf(_0x260635);});}else{_0x8ceadf();}}},'charset':_0x0224('0x19'),'collate':_0x0224('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ad67cdd..11a1239 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 _0xd0d8=['info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','update','body','options','raw','where','limit','UpdateMailInteraction','stringify','AddTagsToMailInteraction','MailInteraction','addTags','ids','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','localhost','socket.io-emitter','./mailInteraction.socket','then'];(function(_0x37ae7a,_0x49a30e){var _0x31a211=function(_0x151615){while(--_0x151615){_0x37ae7a['push'](_0x37ae7a['shift']());}};_0x31a211(++_0x49a30e);}(_0xd0d8,0xa7));var _0x8d0d=function(_0x4af6a0,_0x522121){_0x4af6a0=_0x4af6a0-0x0;var _0x4c2b23=_0xd0d8[_0x4af6a0];return _0x4c2b23;};'use strict';var _=require(_0x8d0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8d0d('0x1'));var rs=require(_0x8d0d('0x2'));var fs=require('fs');var Redis=require(_0x8d0d('0x3'));var db=require(_0x8d0d('0x4'))['db'];var utils=require(_0x8d0d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8d0d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8d0d('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x8d0d('0x8')],{'host':_0x8d0d('0x9'),'port':0x18eb});var socket=require(_0x8d0d('0xa'))(new Redis(config[_0x8d0d('0x8')]));require(_0x8d0d('0xb'))['register'](socket);function respondWithRpcPromise(_0x135268,_0x33d8fa,_0x440958){return new BPromise(function(_0x3beff3,_0x34a6ff){return client['request'](_0x135268,_0x440958)[_0x8d0d('0xc')](function(_0x50d63b){logger[_0x8d0d('0xd')](_0x8d0d('0xe'),_0x33d8fa,_0x8d0d('0xf'));logger[_0x8d0d('0x10')](_0x8d0d('0x11'),_0x33d8fa,_0x8d0d('0xf'),JSON['stringify'](_0x50d63b));if(_0x50d63b[_0x8d0d('0x12')]){if(_0x50d63b[_0x8d0d('0x12')][_0x8d0d('0x13')]===0x1f4){logger[_0x8d0d('0x12')]('MailInteraction,\x20%s,\x20%s',_0x33d8fa,_0x50d63b[_0x8d0d('0x12')][_0x8d0d('0x14')]);return _0x34a6ff(_0x50d63b[_0x8d0d('0x12')][_0x8d0d('0x14')]);}logger[_0x8d0d('0x12')](_0x8d0d('0xe'),_0x33d8fa,_0x50d63b['error'][_0x8d0d('0x14')]);return _0x3beff3(_0x50d63b[_0x8d0d('0x12')][_0x8d0d('0x14')]);}else{logger[_0x8d0d('0xd')]('MailInteraction,\x20%s,\x20%s',_0x33d8fa,_0x8d0d('0xf'));_0x3beff3(_0x50d63b['result'][_0x8d0d('0x14')]);}})[_0x8d0d('0x15')](function(_0xf55e37){logger[_0x8d0d('0x12')](_0x8d0d('0xe'),_0x33d8fa,_0xf55e37);_0x34a6ff(_0xf55e37);});});}exports['UpdateMailInteraction']=function(_0x405ce5){var _0x28bef3=this;return new Promise(function(_0x1e3404,_0x5e71a3){return db['MailInteraction'][_0x8d0d('0x16')](_0x405ce5[_0x8d0d('0x17')],{'raw':_0x405ce5[_0x8d0d('0x18')]?_0x405ce5['options'][_0x8d0d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x405ce5[_0x8d0d('0x18')]?_0x405ce5['options'][_0x8d0d('0x1a')]||null:null,'attributes':_0x405ce5[_0x8d0d('0x18')]?_0x405ce5[_0x8d0d('0x18')]['attributes']||null:null,'limit':_0x405ce5[_0x8d0d('0x18')]?_0x405ce5[_0x8d0d('0x18')][_0x8d0d('0x1b')]||null:null})['then'](function(_0x28ad17){logger['info'](_0x8d0d('0x1c'),_0x405ce5);logger[_0x8d0d('0x10')](_0x8d0d('0x1c'),_0x405ce5,JSON[_0x8d0d('0x1d')](_0x28ad17));_0x1e3404(_0x28ad17);})[_0x8d0d('0x15')](function(_0x22cea0){logger[_0x8d0d('0x12')](_0x8d0d('0x1c'),_0x22cea0[_0x8d0d('0x14')],_0x405ce5);_0x5e71a3(_0x28bef3[_0x8d0d('0x12')](0x1f4,_0x22cea0[_0x8d0d('0x14')]));});});};exports[_0x8d0d('0x1e')]=function(_0x1076a1){return new Promise(function(_0x429c7e,_0x3570fd){return db[_0x8d0d('0x1f')]['find']({'where':_0x1076a1[_0x8d0d('0x18')]?_0x1076a1[_0x8d0d('0x18')]['where']||null:null})[_0x8d0d('0xc')](function(_0x561a45){if(_0x561a45){return _0x561a45[_0x8d0d('0x20')](_0x1076a1[_0x8d0d('0x17')][_0x8d0d('0x21')],_['omit'](_0x1076a1[_0x8d0d('0x17')],[_0x8d0d('0x21'),'id'])||{});}})[_0x8d0d('0x22')](function(_0x3d2d29){logger[_0x8d0d('0xd')](_0x8d0d('0x23'),_0x1076a1);logger[_0x8d0d('0x10')]('AddTags',_0x1076a1,JSON[_0x8d0d('0x1d')](_0x3d2d29));_0x429c7e(_0x3d2d29);})['catch'](function(_0x37969d){logger[_0x8d0d('0x12')](_0x8d0d('0x23'),_0x37969d['message'],_0x1076a1);_0x3570fd(_this[_0x8d0d('0x12')](0x1f4,_0x37969d[_0x8d0d('0x14')]));});});}; \ No newline at end of file +var _0x4300=['request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','debug','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s'];(function(_0x3d3348,_0x31aac8){var _0x15016e=function(_0x3a85c4){while(--_0x3a85c4){_0x3d3348['push'](_0x3d3348['shift']());}};_0x15016e(++_0x31aac8);}(_0x4300,0x1a6));var _0x0430=function(_0x470ef9,_0x17794b){_0x470ef9=_0x470ef9-0x0;var _0x3260dd=_0x4300[_0x470ef9];return _0x3260dd;};'use strict';var _=require(_0x0430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0430('0x1'));var db=require(_0x0430('0x2'))['db'];var utils=require(_0x0430('0x3'));var logger=require(_0x0430('0x4'))(_0x0430('0x5'));var config=require('../../config/environment');var jayson=require(_0x0430('0x6'));var client=jayson['client'][_0x0430('0x7')]({'port':0x232a});config['redis']=_[_0x0430('0x8')](config[_0x0430('0x9')],{'host':_0x0430('0xa'),'port':0x18eb});var socket=require(_0x0430('0xb'))(new Redis(config[_0x0430('0x9')]));require(_0x0430('0xc'))[_0x0430('0xd')](socket);function respondWithRpcPromise(_0x3af75c,_0x26bd9d,_0x4972da){return new BPromise(function(_0x1db2e7,_0x364f7f){return client[_0x0430('0xe')](_0x3af75c,_0x4972da)[_0x0430('0xf')](function(_0x45e336){logger[_0x0430('0x10')](_0x0430('0x11'),_0x26bd9d,_0x0430('0x12'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x26bd9d,_0x0430('0x12'),JSON[_0x0430('0x13')](_0x45e336));if(_0x45e336[_0x0430('0x14')]){if(_0x45e336[_0x0430('0x14')][_0x0430('0x15')]===0x1f4){logger[_0x0430('0x14')](_0x0430('0x11'),_0x26bd9d,_0x45e336['error'][_0x0430('0x16')]);return _0x364f7f(_0x45e336[_0x0430('0x14')][_0x0430('0x16')]);}logger[_0x0430('0x14')]('MailInteraction,\x20%s,\x20%s',_0x26bd9d,_0x45e336['error']['message']);return _0x1db2e7(_0x45e336[_0x0430('0x14')]['message']);}else{logger['info'](_0x0430('0x11'),_0x26bd9d,_0x0430('0x12'));_0x1db2e7(_0x45e336[_0x0430('0x17')][_0x0430('0x16')]);}})[_0x0430('0x18')](function(_0x5ed513){logger['error'](_0x0430('0x11'),_0x26bd9d,_0x5ed513);_0x364f7f(_0x5ed513);});});}exports[_0x0430('0x19')]=function(_0x35ffdb){var _0x39fd58=this;return new Promise(function(_0x5f3c68,_0x4d3af1){return db[_0x0430('0x1a')][_0x0430('0x1b')](_0x35ffdb[_0x0430('0x1c')],{'raw':_0x35ffdb[_0x0430('0x1d')]?_0x35ffdb[_0x0430('0x1d')][_0x0430('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35ffdb['options']?_0x35ffdb[_0x0430('0x1d')][_0x0430('0x1f')]||null:null,'attributes':_0x35ffdb[_0x0430('0x1d')]?_0x35ffdb[_0x0430('0x1d')]['attributes']||null:null,'limit':_0x35ffdb[_0x0430('0x1d')]?_0x35ffdb[_0x0430('0x1d')][_0x0430('0x20')]||null:null})[_0x0430('0xf')](function(_0x133785){logger[_0x0430('0x10')](_0x0430('0x19'),_0x35ffdb);logger[_0x0430('0x21')](_0x0430('0x19'),_0x35ffdb,JSON['stringify'](_0x133785));_0x5f3c68(_0x133785);})[_0x0430('0x18')](function(_0x531611){logger['error'](_0x0430('0x19'),_0x531611[_0x0430('0x16')],_0x35ffdb);_0x4d3af1(_0x39fd58['error'](0x1f4,_0x531611[_0x0430('0x16')]));});});};exports[_0x0430('0x22')]=function(_0x3c0f13){return new Promise(function(_0x3b20d1,_0x2b94e4){return db[_0x0430('0x1a')][_0x0430('0x23')]({'where':_0x3c0f13[_0x0430('0x1d')]?_0x3c0f13[_0x0430('0x1d')]['where']||null:null})['then'](function(_0x5960d2){if(_0x5960d2){return _0x5960d2[_0x0430('0x24')](_0x3c0f13['body'][_0x0430('0x25')],_['omit'](_0x3c0f13['body'],[_0x0430('0x25'),'id'])||{});}})[_0x0430('0x26')](function(_0x22f425){logger[_0x0430('0x10')]('AddTags',_0x3c0f13);logger['debug'](_0x0430('0x27'),_0x3c0f13,JSON[_0x0430('0x13')](_0x22f425));_0x3b20d1(_0x22f425);})['catch'](function(_0x582eec){logger[_0x0430('0x14')](_0x0430('0x27'),_0x582eec[_0x0430('0x16')],_0x3c0f13);_0x2b94e4(_this[_0x0430('0x14')](0x1f4,_0x582eec[_0x0430('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 3a2a283..bca6f6b 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 _0x7188=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7188,0x72));var _0x8718=function(_0x2af99e,_0x3b12b2){_0x2af99e=_0x2af99e-0x0;var _0x167bef=_0x7188[_0x2af99e];return _0x167bef;};'use strict';var MailInteractionEvents=require(_0x8718('0x0'));var events=[_0x8718('0x1'),_0x8718('0x2'),_0x8718('0x3')];function createListener(_0x455307,_0x2c510d){return function(_0xa44d20){_0x2c510d[_0x8718('0x4')](_0x455307,_0xa44d20);};}function removeListener(_0x4b6940,_0x2a5425){return function(){MailInteractionEvents[_0x8718('0x5')](_0x4b6940,_0x2a5425);};}exports[_0x8718('0x6')]=function(_0x285172){for(var _0x248841=0x0,_0x21611f=events[_0x8718('0x7')];_0x248841<_0x21611f;_0x248841++){var _0x526220=events[_0x248841];var _0x5e625c=createListener(_0x8718('0x8')+_0x526220,_0x285172);MailInteractionEvents['on'](_0x526220,_0x5e625c);}}; \ No newline at end of file +var _0xae0d=['emit','removeListener','mailInteraction:','./mailInteraction.events','save','remove','update'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xae0d,0x13e));var _0xdae0=function(_0x3f6276,_0x31e9dd){_0x3f6276=_0x3f6276-0x0;var _0x3f7dce=_0xae0d[_0x3f6276];return _0x3f7dce;};'use strict';var MailInteractionEvents=require(_0xdae0('0x0'));var events=[_0xdae0('0x1'),_0xdae0('0x2'),_0xdae0('0x3')];function createListener(_0x365604,_0xd36b38){return function(_0x4f7de9){_0xd36b38[_0xdae0('0x4')](_0x365604,_0x4f7de9);};}function removeListener(_0x119294,_0xa03127){return function(){MailInteractionEvents[_0xdae0('0x5')](_0x119294,_0xa03127);};}exports['register']=function(_0x334f6c){for(var _0x3ed2d8=0x0,_0x49ff85=events['length'];_0x3ed2d8<_0x49ff85;_0x3ed2d8++){var _0x1fb219=events[_0x3ed2d8];var _0x30a7f4=createListener(_0xdae0('0x6')+_0x1fb219,_0x334f6c);MailInteractionEvents['on'](_0x1fb219,_0x30a7f4);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a121b77..1a5ba2c 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 _0x4ded=['tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','post'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4ded,0xf3));var _0xd4de=function(_0x4cad8b,_0x9fbef4){_0x4cad8b=_0x4cad8b-0x0;var _0x395c6b=_0x4ded[_0x4cad8b];return _0x395c6b;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var fs_extra=require(_0xd4de('0x6'));var auth=require(_0xd4de('0x7'));var interaction=require(_0xd4de('0x8'));var config=require('../../config/environment');var controller=require(_0xd4de('0x9'));router[_0xd4de('0xa')]('/',auth[_0xd4de('0xb')](),controller[_0xd4de('0xc')]);router[_0xd4de('0xa')]('/describe',auth[_0xd4de('0xb')](),controller[_0xd4de('0xd')]);router[_0xd4de('0xa')](_0xd4de('0xe'),auth['isAuthenticated'](),controller[_0xd4de('0xf')]);router[_0xd4de('0xa')](_0xd4de('0x10'),auth[_0xd4de('0xb')](),controller['download']);router[_0xd4de('0x11')]('/',auth[_0xd4de('0xb')](),interaction[_0xd4de('0x12')](_0xd4de('0x13'),_0xd4de('0x14')),controller[_0xd4de('0x15')]);router[_0xd4de('0x16')](_0xd4de('0xe'),auth['isAuthenticated'](),controller[_0xd4de('0x17')]);router[_0xd4de('0x16')](_0xd4de('0x18'),auth[_0xd4de('0xb')](),controller[_0xd4de('0x19')]);router[_0xd4de('0x16')](_0xd4de('0x1a'),auth[_0xd4de('0xb')](),controller['reject']);router['delete']('/:id',auth[_0xd4de('0xb')](),controller[_0xd4de('0x1b')]);module[_0xd4de('0x1c')]=router; \ No newline at end of file +var _0xafc2=['update','accept','reject','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','mailmessage:create','put'];(function(_0x57adb1,_0x4e542c){var _0x2bc74a=function(_0x390fde){while(--_0x390fde){_0x57adb1['push'](_0x57adb1['shift']());}};_0x2bc74a(++_0x4e542c);}(_0xafc2,0x10e));var _0x2afc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xafc2[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x2afc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2afc('0x1'));var express=require('express');var router=express[_0x2afc('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2afc('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2afc('0x4'));var controller=require(_0x2afc('0x5'));router[_0x2afc('0x6')]('/',auth['isAuthenticated'](),controller[_0x2afc('0x7')]);router[_0x2afc('0x6')](_0x2afc('0x8'),auth[_0x2afc('0x9')](),controller[_0x2afc('0xa')]);router['get'](_0x2afc('0xb'),auth[_0x2afc('0x9')](),controller[_0x2afc('0xc')]);router[_0x2afc('0x6')](_0x2afc('0xd'),auth[_0x2afc('0x9')](),controller[_0x2afc('0xe')]);router[_0x2afc('0xf')]('/',auth[_0x2afc('0x9')](),interaction['tracked']('mail',_0x2afc('0x10')),controller['create']);router[_0x2afc('0x11')](_0x2afc('0xb'),auth['isAuthenticated'](),controller[_0x2afc('0x12')]);router[_0x2afc('0x11')]('/:id/accept',auth[_0x2afc('0x9')](),controller[_0x2afc('0x13')]);router['put']('/:id/reject',auth[_0x2afc('0x9')](),controller[_0x2afc('0x14')]);router[_0x2afc('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2afc('0x16')]);module[_0x2afc('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index fe99726..72254ca 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 _0x8cb7=['TEXT','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email','Chat','sequelize','lodash','exports','long'];(function(_0x17670e,_0x1ec106){var _0x54d284=function(_0x289d05){while(--_0x289d05){_0x17670e['push'](_0x17670e['shift']());}};_0x54d284(++_0x1ec106);}(_0x8cb7,0x6c));var _0x78cb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8cb7[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x78cb('0x0'));var _=require(_0x78cb('0x1'));module[_0x78cb('0x2')]={'body':{'type':Sequelize['TEXT'](_0x78cb('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x78cb('0x4')](_0x78cb('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x78cb('0x6')]('in','out'),'defaultValue':_0x78cb('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x78cb('0x8')]},'to':{'type':Sequelize[_0x78cb('0x4')](_0x78cb('0x3'))},'cc':{'type':Sequelize[_0x78cb('0x4')](_0x78cb('0x3'))},'bcc':{'type':Sequelize[_0x78cb('0x4')](_0x78cb('0x3'))},'subject':{'type':Sequelize[_0x78cb('0x4')]},'sentAt':{'type':Sequelize[_0x78cb('0x9')]},'attach':{'type':Sequelize[_0x78cb('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x78cb('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x78cb('0x4')]('long')},'originChannel':{'type':Sequelize[_0x78cb('0x6')](_0x78cb('0xc'),_0x78cb('0xd')),'defaultValue':_0x78cb('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x09ac=['BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat','lodash','exports','TEXT','medium'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x09ac,0x14e));var _0xc09a=function(_0x2fb511,_0x41cf72){_0x2fb511=_0x2fb511-0x0;var _0x44d001=_0x09ac[_0x2fb511];return _0x44d001;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc09a('0x0'));module[_0xc09a('0x1')]={'body':{'type':Sequelize[_0xc09a('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc09a('0x2')](_0xc09a('0x3'))},'read':{'type':Sequelize[_0xc09a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc09a('0x5')]('in','out'),'defaultValue':_0xc09a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc09a('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0xc09a('0x2')](_0xc09a('0x8'))},'bcc':{'type':Sequelize[_0xc09a('0x2')]('long')},'subject':{'type':Sequelize[_0xc09a('0x2')]},'sentAt':{'type':Sequelize[_0xc09a('0x9')]},'attach':{'type':Sequelize[_0xc09a('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc09a('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc09a('0x9')]},'originTo':{'type':Sequelize[_0xc09a('0x2')](_0xc09a('0x8'))},'originCc':{'type':Sequelize['TEXT'](_0xc09a('0x8'))},'originChannel':{'type':Sequelize[_0xc09a('0x5')](_0xc09a('0xb'),_0xc09a('0xc')),'defaultValue':_0xc09a('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0f68879..757645c 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 _0x9c44=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','MailInteractionId','RejectMessage','rejectMessage','Sequelize','User','fullname','interface','reject','fromString','rejectmessage','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','writeFileSync','download','bluebird','util','path','lodash','ioredis','html-to-text','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','count','set','Content-Range','json','update','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','body','find','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','DESC','Smtp','isNil','service','host','port','secure','user','pass','auth','attachments','root','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','accept','mail','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage'];(function(_0x41594a,_0x268515){var _0x2d578a=function(_0x4a529e){while(--_0x4a529e){_0x41594a['push'](_0x41594a['shift']());}};_0x2d578a(++_0x268515);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x49c4('0x0'));var util=require(_0x49c4('0x1'));var path=require(_0x49c4('0x2'));var fs=require('fs');var _=require(_0x49c4('0x3'));var Redis=require(_0x49c4('0x4'));var htmlToText=require(_0x49c4('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x49c4('0x6'));var interaction_log=require('../../config/logger')(_0x49c4('0x7'));var config=require(_0x49c4('0x8'));var db=require(_0x49c4('0x9'))['db'];config[_0x49c4('0xa')]=_[_0x49c4('0xb')](config['redis'],{'host':_0x49c4('0xc'),'port':0x18eb});var socket=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xa')]));require(_0x49c4('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x49c4('0xf')][_0x49c4('0x10')]({'port':0x232c});var client9003=jayson['client'][_0x49c4('0x10')]({'port':0x232b});var client9002=jayson[_0x49c4('0xf')]['http']({'port':0x232a});function respondWithRpcPromise(_0x536d42,_0x1d19bf,_0x6d1b08,_0x5487cd){return new BPromise(function(_0x7df3a9,_0x403bfb){var _0x5f2fd9=_0x5487cd||client;return _0x5f2fd9[_0x49c4('0x11')](_0x536d42,_0x6d1b08)[_0x49c4('0x12')](function(_0x21f15a){logger[_0x49c4('0x13')](_0x49c4('0x14'),_0x1d19bf,_0x49c4('0x15'));logger[_0x49c4('0x16')](_0x49c4('0x17'),_0x1d19bf,'request\x20sent',JSON[_0x49c4('0x18')](_0x21f15a));if(_0x21f15a[_0x49c4('0x19')]){if(_0x21f15a[_0x49c4('0x19')][_0x49c4('0x1a')]===0x1f4){logger[_0x49c4('0x19')]('MailMessage,\x20%s,\x20%s',_0x1d19bf,_0x21f15a[_0x49c4('0x19')][_0x49c4('0x1b')]);return _0x403bfb(_0x21f15a['error']['message']);}logger[_0x49c4('0x19')](_0x49c4('0x14'),_0x1d19bf,_0x21f15a[_0x49c4('0x19')]['message']);return _0x7df3a9(_0x21f15a[_0x49c4('0x19')]['message']);}else{logger[_0x49c4('0x13')](_0x49c4('0x14'),_0x1d19bf,_0x49c4('0x15'));_0x7df3a9(_0x21f15a[_0x49c4('0x1c')][_0x49c4('0x1b')]);}})[_0x49c4('0x1d')](function(_0x280893){logger[_0x49c4('0x19')](_0x49c4('0x14'),_0x1d19bf,_0x280893);_0x403bfb(_0x280893);});});}function respondWithResult(_0x578447,_0x527126){_0x527126=_0x527126||0xc8;return function(_0x57f502){if(_0x57f502){return _0x578447[_0x49c4('0x1e')](_0x527126)['json'](_0x57f502);}};}function respondWithFilteredResult(_0x592bb8,_0x2263ae){return function(_0x15581b){if(_0x15581b){var _0x26c640=typeof _0x2263ae[_0x49c4('0x1f')]==='undefined'&&typeof _0x2263ae['limit']===_0x49c4('0x20');var _0x9cb797=_0x15581b['count'];var _0x207358=_0x26c640?0x0:_0x2263ae[_0x49c4('0x1f')];var _0x210159=_0x26c640?_0x15581b[_0x49c4('0x21')]:_0x2263ae['offset']+_0x2263ae['limit'];var _0x449960;if(_0x210159>=_0x9cb797){_0x210159=_0x9cb797;_0x449960=0xc8;}else{_0x449960=0xce;}_0x592bb8['status'](_0x449960);return _0x592bb8[_0x49c4('0x22')](_0x49c4('0x23'),_0x207358+'-'+_0x210159+'/'+_0x9cb797)[_0x49c4('0x24')](_0x15581b);}return null;};}function saveUpdates(_0x372a47){return function(_0x5987ae){if(_0x5987ae){return _0x5987ae[_0x49c4('0x25')](_0x372a47)[_0x49c4('0x12')](function(_0x46e04d){return _0x46e04d;});}return null;};}function removeEntity(_0x4f28a2){return function(_0x6329b3){if(_0x6329b3){return _0x6329b3[_0x49c4('0x26')]()[_0x49c4('0x12')](function(){_0x4f28a2[_0x49c4('0x1e')](0xcc)[_0x49c4('0x27')]();});}};}function handleEntityNotFound(_0x2cbd88){return function(_0x46f7ea){if(!_0x46f7ea){_0x2cbd88['sendStatus'](0x194);}return _0x46f7ea;};}function handleError(_0x4f4495,_0x59eb84){_0x59eb84=_0x59eb84||0x1f4;return function(_0x134928){logger[_0x49c4('0x19')](_0x134928[_0x49c4('0x28')]);if(_0x134928[_0x49c4('0x29')]){delete _0x134928[_0x49c4('0x29')];}_0x4f4495['status'](_0x59eb84)[_0x49c4('0x2a')](_0x134928);};}exports[_0x49c4('0x2b')]=function(_0x2e7a69,_0x24bba9){var _0x58e252={},_0x57a29c={},_0xce57ef={'count':0x0,'rows':[]};var _0x9a1bed=_[_0x49c4('0x2c')](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x4a0c7a){return{'name':_0x4a0c7a[_0x49c4('0x2f')],'type':_0x4a0c7a[_0x49c4('0x30')][_0x49c4('0x31')]};});_0x57a29c['model']=_['map'](_0x9a1bed,_0x49c4('0x29'));_0x57a29c[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x2e7a69[_0x49c4('0x32')]);_0x57a29c[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x57a29c[_0x49c4('0x36')],_0x57a29c[_0x49c4('0x32')]);_0x58e252[_0x49c4('0x37')]=_['intersection'](_0x57a29c[_0x49c4('0x36')],qs['fields'](_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x38')]));_0x58e252[_0x49c4('0x37')]=_0x58e252[_0x49c4('0x37')]['length']?_0x58e252[_0x49c4('0x37')]:_0x57a29c[_0x49c4('0x36')];if(!_0x2e7a69[_0x49c4('0x32')]['hasOwnProperty'](_0x49c4('0x39'))){_0x58e252[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x58e252[_0x49c4('0x1f')]=qs[_0x49c4('0x1f')](_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x1f')]);}_0x58e252[_0x49c4('0x3b')]=qs[_0x49c4('0x3c')](_0x2e7a69['query'][_0x49c4('0x3c')]);_0x58e252[_0x49c4('0x3d')]=qs[_0x49c4('0x34')](_[_0x49c4('0x3e')](_0x2e7a69[_0x49c4('0x32')],_0x57a29c[_0x49c4('0x34')]),_0x9a1bed);if(_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x3f')]){_0x58e252[_0x49c4('0x3d')]=_[_0x49c4('0x40')](_0x58e252[_0x49c4('0x3d')],{'$or':_[_0x49c4('0x2c')](_0x9a1bed,function(_0x326142){if(_0x326142['type']!==_0x49c4('0x41')){var _0x49829e={};_0x49829e[_0x326142[_0x49c4('0x29')]]={'$like':'%'+_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x3f')]+'%'};return _0x49829e;}})});}_0x58e252=_[_0x49c4('0x40')]({},_0x58e252,_0x2e7a69[_0x49c4('0x42')]);var _0x281b83={'where':_0x58e252['where']};return db['MailMessage'][_0x49c4('0x21')](_0x281b83)[_0x49c4('0x12')](function(_0x38349b){_0xce57ef[_0x49c4('0x21')]=_0x38349b;if(_0x2e7a69['query'][_0x49c4('0x43')]){_0x58e252[_0x49c4('0x44')]=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x45')](_0x58e252);})[_0x49c4('0x12')](function(_0x3bde49){_0xce57ef[_0x49c4('0x46')]=_0x3bde49;return _0xce57ef;})[_0x49c4('0x12')](respondWithFilteredResult(_0x24bba9,_0x58e252))[_0x49c4('0x1d')](handleError(_0x24bba9,null));};exports['show']=function(_0x2ad771,_0x4d27d0){var _0x33696e={'raw':!![],'where':{'id':_0x2ad771[_0x49c4('0x47')]['id']}},_0x628423={};_0x628423[_0x49c4('0x36')]=_[_0x49c4('0x33')](db['MailMessage'][_0x49c4('0x2e')]);_0x628423[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x2ad771[_0x49c4('0x32')]);_0x628423[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x628423[_0x49c4('0x36')],_0x628423['query']);_0x33696e[_0x49c4('0x37')]=_['intersection'](_0x628423[_0x49c4('0x36')],qs[_0x49c4('0x38')](_0x2ad771[_0x49c4('0x32')][_0x49c4('0x38')]));_0x33696e[_0x49c4('0x37')]=_0x33696e[_0x49c4('0x37')][_0x49c4('0x48')]?_0x33696e['attributes']:_0x628423[_0x49c4('0x36')];if(_0x2ad771[_0x49c4('0x32')]['includeAll']){_0x33696e[_0x49c4('0x44')]=[{'all':!![]}];}_0x33696e=_[_0x49c4('0x40')]({},_0x33696e,_0x2ad771[_0x49c4('0x42')]);return db[_0x49c4('0x2d')]['find'](_0x33696e)['then'](handleEntityNotFound(_0x4d27d0,null))[_0x49c4('0x12')](respondWithResult(_0x4d27d0,null))['catch'](handleError(_0x4d27d0,null));};exports[_0x49c4('0x25')]=function(_0x1f941f,_0x3811b2){if(_0x1f941f[_0x49c4('0x49')]['id']){delete _0x1f941f[_0x49c4('0x49')]['id'];}return db[_0x49c4('0x2d')][_0x49c4('0x4a')]({'where':{'id':_0x1f941f['params']['id']}})[_0x49c4('0x12')](handleEntityNotFound(_0x3811b2,null))[_0x49c4('0x12')](saveUpdates(_0x1f941f[_0x49c4('0x49')],null))[_0x49c4('0x12')](respondWithResult(_0x3811b2,null))[_0x49c4('0x1d')](handleError(_0x3811b2,null));};exports[_0x49c4('0x26')]=function(_0x156748,_0x25d174){return db[_0x49c4('0x2d')][_0x49c4('0x4a')]({'where':{'id':_0x156748['params']['id']}})['then'](handleEntityNotFound(_0x25d174,null))[_0x49c4('0x12')](removeEntity(_0x25d174,null))[_0x49c4('0x1d')](handleError(_0x25d174,null));};exports['describe']=function(_0x59a8bc,_0x77163d){return db['MailMessage']['describe']()[_0x49c4('0x12')](respondWithResult(_0x77163d,null))[_0x49c4('0x1d')](handleError(_0x77163d,null));};exports[_0x49c4('0x4b')]=function(_0x38c480,_0x2884ca){return db[_0x49c4('0x2d')][_0x49c4('0x4b')](_0x38c480['body'])[_0x49c4('0x12')](function(_0xcc6a2b){if(_0xcc6a2b){if(_0xcc6a2b[_0x49c4('0x4c')]===_0x49c4('0x4d')&&!_0xcc6a2b[_0x49c4('0x4e')]){var _0xa431d,_0x5d24f3,_0x5c7ddd;if(_0x38c480[_0x49c4('0x49')]['to']){_0x5d24f3=_0x38c480[_0x49c4('0x49')]['to'][_0x49c4('0x4f')](',')[0x0];}return db[_0x49c4('0x50')][_0x49c4('0x51')]({'where':{'id':_0xcc6a2b[_0x49c4('0x52')]},'include':[{'model':db[_0x49c4('0x53')],'as':'List','include':[{'model':db[_0x49c4('0x54')],'as':_0x49c4('0x55'),'where':{'email':_0x5d24f3},'limit':0x1,'order':[['updatedAt',_0x49c4('0x56')]]}]},{'model':db['MailServerOut'],'as':_0x49c4('0x57'),'raw':!![]}]})[_0x49c4('0x12')](function(_0x9eaa84){_0xa431d=_0x9eaa84;if(_0xa431d&&_0xa431d[_0x49c4('0x57')]){var _0x845f7e={'tls':{'rejectUnauthorized':![]}};if(_[_0x49c4('0x58')](_0xa431d[_0x49c4('0x57')][_0x49c4('0x59')])){_0x845f7e['host']=_0xa431d[_0x49c4('0x57')][_0x49c4('0x5a')];_0x845f7e['port']=_0xa431d[_0x49c4('0x57')][_0x49c4('0x5b')];_0x845f7e['secure']=_0xa431d[_0x49c4('0x57')][_0x49c4('0x5c')];if(_0xa431d['Smtp']['authentication']){_0x845f7e['auth']={'user':_0xa431d['Smtp'][_0x49c4('0x5d')],'pass':_0xa431d['Smtp'][_0x49c4('0x5e')]};}}else{_0x845f7e[_0x49c4('0x59')]=_0xa431d['Smtp'][_0x49c4('0x59')];_0x845f7e[_0x49c4('0x5f')]={'user':_0xa431d['Smtp'][_0x49c4('0x5d')],'pass':_0xa431d[_0x49c4('0x57')][_0x49c4('0x5e')]};_0x845f7e[_0x49c4('0x5c')]=_0xa431d['Smtp'][_0x49c4('0x5c')];}if(_0x38c480[_0x49c4('0x49')][_0x49c4('0x60')]&&_0x38c480[_0x49c4('0x49')]['attachments'][_0x49c4('0x48')]){for(var _0x4a93bc=0x0;_0x4a93bc<_0x38c480['body']['attachments']['length'];_0x4a93bc+=0x1){_0x38c480[_0x49c4('0x49')][_0x49c4('0x60')][_0x4a93bc]={'filename':_0x38c480[_0x49c4('0x49')][_0x49c4('0x60')][_0x4a93bc]['name'],'path':path['join'](config[_0x49c4('0x61')],_0x49c4('0x62'),_0x38c480[_0x49c4('0x49')][_0x49c4('0x60')][_0x4a93bc][_0x49c4('0x63')])};}}_0x5c7ddd={'account':_0x845f7e,'message':_0x38c480[_0x49c4('0x49')]};return;}})[_0x49c4('0x12')](function(){if(_0xa431d[_0x49c4('0x64')]){if(_0xa431d['List'][_0x49c4('0x55')]['length']){return _0xa431d[_0x49c4('0x64')][_0x49c4('0x55')][0x0];}else{return db[_0x49c4('0x54')][_0x49c4('0x4b')](_[_0x49c4('0xb')](_0x38c480[_0x49c4('0x49')],{'firstName':_0x38c480[_0x49c4('0x49')]['to'],'email':_0x38c480[_0x49c4('0x49')]['to'],'phone':_0x38c480[_0x49c4('0x49')]['to'],'ListId':_0xa431d[_0x49c4('0x65')]}));}}else{throw new Error(_0x49c4('0x66'));}})[_0x49c4('0x12')](function(){if(_0x5c7ddd){return respondWithRpcPromise(_0x49c4('0x67'),_0x49c4('0x68'),_0x5c7ddd,client9003)[_0x49c4('0x12')](function(_0x453cf2){return _0xcc6a2b[_0x49c4('0x25')]({'read':!![],'messageId':_0x453cf2[_0x49c4('0x69')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x49c4('0x1d')](function(_0x16b3e8){logger['error']('%s',JSON[_0x49c4('0x18')](_0x16b3e8));return _0xcc6a2b;});}return _0xcc6a2b;});}return _0xcc6a2b;}})[_0x49c4('0x12')](respondWithResult(_0x2884ca,0xc9))[_0x49c4('0x1d')](handleError(_0x2884ca,null));};exports[_0x49c4('0x6a')]=function(_0x4d6aaa,_0x5a14a5){var _0x4a85d4={'agent':{},'channel':_0x49c4('0x6b')};if(_0x4d6aaa[_0x49c4('0x49')]['id']){delete _0x4d6aaa[_0x49c4('0x49')]['id'];}_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x6c')]=!![];_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x6d')]=moment()[_0x49c4('0x6e')](_0x49c4('0x6f'));_0x4d6aaa['body'][_0x49c4('0x70')]=_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x70')]||_0x4d6aaa['user']['id'];_0x4a85d4[_0x49c4('0x71')]['id']=_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x70')];return db[_0x49c4('0x2d')][_0x49c4('0x4a')]({'where':{'id':_0x4d6aaa[_0x49c4('0x47')]['id'],'UserId':null}})[_0x49c4('0x12')](handleEntityNotFound(_0x5a14a5,null))[_0x49c4('0x12')](saveUpdates(_0x4d6aaa['body'],null))[_0x49c4('0x12')](function(_0x20e2d5){if(_0x20e2d5){_0x4a85d4[_0x49c4('0x1b')]=_0x20e2d5[_0x49c4('0x72')]({'plain':!![]});return db[_0x49c4('0x73')]['find']({'where':{'id':_0x20e2d5['MailInteractionId']}});}return null;})[_0x49c4('0x12')](handleEntityNotFound(_0x5a14a5,null))['then'](function(_0x34cf49){if(_0x34cf49){return _0x34cf49['update']({'UserId':_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x70')],'read1stAt':_[_0x49c4('0x58')](_0x34cf49[_0x49c4('0x74')])?moment()['format'](_0x49c4('0x6f')):undefined});}return null;})[_0x49c4('0x12')](function(_0x2ceada){if(_0x2ceada){_0x4a85d4[_0x49c4('0x75')]=_0x2ceada[_0x49c4('0x72')]({'plain':!![]});interaction_log[_0x49c4('0x13')](_0x49c4('0x76'),_0x4d6aaa[_0x49c4('0x5d')]['id'],_0x4d6aaa[_0x49c4('0x5d')][_0x49c4('0x29')],_0x4d6aaa['user'][_0x49c4('0x77')],_0x4a85d4[_0x49c4('0x75')]['id'],_0x4d6aaa['body']?JSON[_0x49c4('0x18')](_0x4d6aaa['body']):_0x49c4('0x78'));return respondWithRpcPromise(_0x49c4('0x79'),_0x49c4('0x7a'),_0x4a85d4);}return null;})[_0x49c4('0x12')](function(_0x2c32c0){var _0x58b90c=_0x49c4('0x7b')+_0x2c32c0[_0x49c4('0x1b')]['ContactId'];return db[_0x49c4('0x7c')][_0x49c4('0x32')](_0x58b90c,{'type':db['Sequelize'][_0x49c4('0x7d')][_0x49c4('0x7e')],'raw':!![]})['then'](function(_0x37fef1){return _0x37fef1;});})[_0x49c4('0x12')](function(_0x25989a){if(_0x25989a){_0x4a85d4[_0x49c4('0x1b')]['contact']=_0x25989a[0x0];if(!_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x70')])return;return db['User'][_0x49c4('0x4a')]({'where':{'id':_0x4d6aaa['body']['UserId'],'role':_0x49c4('0x71')},'attributes':['id','name','fullname',_0x49c4('0x7f'),_0x49c4('0x80')],'raw':!![]});}return null;})['then'](function(_0x23e684){if(!_0x23e684)return null;_0x4a85d4['message']['agent']=_0x23e684;return _0x4a85d4;})['then'](function(_0x10d107){if(_0x10d107){if(_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x81')]){_0x4a85d4[_0x49c4('0x1b')]['interface']=util['format'](_0x49c4('0x82'),_0x4d6aaa['user'][_0x49c4('0x29')]);_0x4a85d4['message'][_0x49c4('0x83')]=_0x4a85d4[_0x49c4('0x83')];_0x4a85d4[_0x49c4('0x1b')][_0x49c4('0x84')]=_0x49c4('0x6a');_0x4a85d4[_0x49c4('0x1b')][_0x49c4('0x49')]=htmlToText['fromString'](_0x4a85d4[_0x49c4('0x1b')][_0x49c4('0x49')]);return respondWithRpcPromise(_0x49c4('0x85'),_0x49c4('0x85'),{'event':_0x49c4('0x86'),'message':_0x4a85d4['message']},client9002)[_0x49c4('0x12')](function(){return _0x4a85d4;});}return _0x4a85d4;}return null;})[_0x49c4('0x12')](respondWithResult(_0x5a14a5,null))[_0x49c4('0x1d')](handleError(_0x5a14a5,null));};exports['reject']=function(_0x530ff2,_0xbfff7){var _0x27b31d={'agent':{},'channel':_0x49c4('0x6b')};if(_0x530ff2[_0x49c4('0x49')]['id']){delete _0x530ff2[_0x49c4('0x49')]['id'];}_0x530ff2['body'][_0x49c4('0x70')]=_0x530ff2[_0x49c4('0x49')][_0x49c4('0x70')]||_0x530ff2[_0x49c4('0x5d')]['id'];_0x27b31d['agent']['id']=_0x530ff2['body'][_0x49c4('0x70')];return db[_0x49c4('0x2d')][_0x49c4('0x4a')]({'where':{'id':_0x530ff2[_0x49c4('0x47')]['id'],'UserId':null}})[_0x49c4('0x12')](handleEntityNotFound(_0xbfff7,null))['then'](function(_0x389edb){if(_0x389edb){_0x27b31d[_0x49c4('0x1b')]=_0x389edb[_0x49c4('0x72')]({'plain':!![]});return db[_0x49c4('0x73')][_0x49c4('0x4a')]({'where':{'id':_0x389edb[_0x49c4('0x87')]}});}return null;})['then'](handleEntityNotFound(_0xbfff7,null))[_0x49c4('0x12')](function(_0x1c90ba){if(_0x1c90ba){_0x27b31d[_0x49c4('0x75')]=_0x1c90ba[_0x49c4('0x72')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x530ff2[_0x49c4('0x5d')]['id'],_0x530ff2['user'][_0x49c4('0x29')],_0x530ff2['user'][_0x49c4('0x77')],_0x27b31d[_0x49c4('0x75')]['id'],_0x530ff2[_0x49c4('0x49')]?JSON[_0x49c4('0x18')](_0x530ff2['body']):'null');return respondWithRpcPromise(_0x49c4('0x88'),_0x49c4('0x89'),_0x27b31d);}return null;})[_0x49c4('0x12')](function(_0x5f0116){var _0x4c0e9c=_0x49c4('0x7b')+_0x5f0116['message']['ContactId'];return db[_0x49c4('0x7c')]['query'](_0x4c0e9c,{'type':db[_0x49c4('0x8a')][_0x49c4('0x7d')]['SELECT'],'raw':!![]})[_0x49c4('0x12')](function(_0x45474e){return _0x45474e;});})['then'](function(_0x5428a9){if(_0x5428a9){_0x27b31d[_0x49c4('0x1b')]['contact']=_0x5428a9[0x0];if(!_0x530ff2[_0x49c4('0x49')][_0x49c4('0x70')])return;return db[_0x49c4('0x8b')][_0x49c4('0x4a')]({'where':{'id':_0x530ff2[_0x49c4('0x49')][_0x49c4('0x70')],'role':_0x49c4('0x71')},'attributes':['id','name',_0x49c4('0x8c'),_0x49c4('0x7f'),_0x49c4('0x80')],'raw':!![]});}return null;})[_0x49c4('0x12')](function(_0x3107c9){if(!_0x3107c9)return null;_0x27b31d['message'][_0x49c4('0x71')]=_0x3107c9;return _0x27b31d;})['then'](function(_0xb66e67){if(_0xb66e67){_0xb66e67[_0x49c4('0x1b')][_0x49c4('0x8d')]=util[_0x49c4('0x6e')]('SIP/%s',_0x530ff2[_0x49c4('0x5d')][_0x49c4('0x29')]);_0xb66e67[_0x49c4('0x1b')][_0x49c4('0x83')]=_0x27b31d[_0x49c4('0x83')];_0xb66e67[_0x49c4('0x1b')]['event']=_0x49c4('0x8e');_0xb66e67['message'][_0x49c4('0x49')]=htmlToText[_0x49c4('0x8f')](_0x27b31d[_0x49c4('0x1b')][_0x49c4('0x49')]);respondWithRpcPromise('EventManager',_0x49c4('0x85'),{'event':_0x49c4('0x90'),'message':_0xb66e67['message']},client9002);return _0x27b31d;}return null;})[_0x49c4('0x12')](respondWithResult(_0xbfff7,null))[_0x49c4('0x1d')](handleError(_0xbfff7,null));};exports['download']=function(_0x562f47,_0x25f1c7){var _0x3e5915=moment()[_0x49c4('0x91')]()[_0x49c4('0x92')]();var _0x32afd4=path[_0x49c4('0x93')](config[_0x49c4('0x61')],_0x49c4('0x94'),_0x49c4('0x95'),_0x49c4('0x96'));var _0x269613=path['join'](config['root'],_0x49c4('0x94'),_0x49c4('0x95'),_0x49c4('0x60'));var _0x5be042=util[_0x49c4('0x6e')](_0x49c4('0x97'),_0x3e5915);return db['MailMessage'][_0x49c4('0x4a')]({'where':{'id':_0x562f47['params']['id']},'attributes':['id',_0x49c4('0x49'),_0x49c4('0x98'),'to','cc',_0x49c4('0x99'),_0x49c4('0x9a'),'createdAt'],'include':_0x562f47[_0x49c4('0x32')][_0x49c4('0x60')]?[{'model':db[_0x49c4('0x9b')],'as':_0x49c4('0x9c')}]:undefined})[_0x49c4('0x12')](handleEntityNotFound(_0x25f1c7,null))['then'](function(_0x5a4e00){if(_0x5a4e00){var _0x5f4d82=_0x5a4e00;var _0x1856c7={'from':_0x5f4d82[_0x49c4('0x98')],'to':_0x5f4d82['to'],'subject':_0x5f4d82[_0x49c4('0x9a')],'html':_0x5f4d82[_0x49c4('0x49')],'headers':{'Date':moment(_0x5f4d82[_0x49c4('0x9d')])['format'](_0x49c4('0x9e'))},'attachments':[]};if(_0x5a4e00['cc']){_0x1856c7[_0x49c4('0x9f')]['Cc']=_0x5a4e00['cc'];}if(_0x5a4e00[_0x49c4('0x99')]){_0x1856c7[_0x49c4('0x9f')]['Bcc']=_0x5a4e00[_0x49c4('0x99')];}return new BPromise(function(_0x5bfccd,_0x10fa42){if(_0x5a4e00[_0x49c4('0x9c')]){for(var _0x2fda4f=0x0;_0x2fda4f<_0x5a4e00['Attachments'][_0x49c4('0x48')];_0x2fda4f++){var _0x9b622d=_0x5a4e00[_0x49c4('0x9c')][_0x2fda4f];var _0x494c7f=path[_0x49c4('0x93')](_0x269613,_0x9b622d[_0x49c4('0x63')]);if(fs[_0x49c4('0xa0')](_0x494c7f)){_0x1856c7['attachments'][_0x49c4('0xa1')]({'name':_0x9b622d['name'],'contentType':_0x9b622d['type'],'data':fs[_0x49c4('0xa2')](_0x494c7f)});}}}emlformat[_0x49c4('0xa3')](_0x1856c7,function(_0x4ef4aa,_0x815b34){if(_0x4ef4aa)return _0x10fa42(_0x4ef4aa);fs[_0x49c4('0xa4')](path[_0x49c4('0x93')](_0x32afd4,_0x5be042),_0x815b34);return _0x5bfccd(_0x815b34);});});}})[_0x49c4('0x12')](function(_0x10f5fc){if(_0x10f5fc){return _0x25f1c7[_0x49c4('0xa5')](path[_0x49c4('0x93')](_0x32afd4,_0x5be042),_0x5be042,function(_0x219133){if(!_0x219133)fs['unlinkSync'](path['join'](_0x32afd4,_0x5be042));});}})[_0x49c4('0x1d')](handleError(_0x25f1c7,null));}; \ No newline at end of file +var _0xedd9=['params','describe','create','secret','split','MailAccount','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','port','secure','authentication','auth','service','user','pass','attachments','join','server/files/attachments','defaults','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','agent','UserId','MailInteraction','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','sequelize','Sequelize','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','reject','fromString','rejectmessage','unix','toString','root','server','files','tmp','message-%s.eml','from','subject','createdAt','headers','bcc','Bcc','Attachments','basename','existsSync','readFileSync','build','download','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','redis','localhost','socket.io-emitter','register','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','json','undefined','limit','count','offset','Content-Range','update','then','destroy','status','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','filters','find','body'];(function(_0x1b8281,_0x4d3992){var _0x293345=function(_0x494f7f){while(--_0x494f7f){_0x1b8281['push'](_0x1b8281['shift']());}};_0x293345(++_0x4d3992);}(_0xedd9,0xfc));var _0x9edd=function(_0x18eefa,_0x568c6f){_0x18eefa=_0x18eefa-0x0;var _0x21c3d1=_0xedd9[_0x18eefa];return _0x21c3d1;};'use strict';var emlformat=require('eml-format');var moment=require(_0x9edd('0x0'));var BPromise=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var path=require(_0x9edd('0x3'));var fs=require('fs');var _=require(_0x9edd('0x4'));var Redis=require(_0x9edd('0x5'));var htmlToText=require(_0x9edd('0x6'));var qs=require(_0x9edd('0x7'));var logger=require('../../config/logger')(_0x9edd('0x8'));var interaction_log=require(_0x9edd('0x9'))(_0x9edd('0xa'));var config=require(_0x9edd('0xb'));var db=require('../../mysqldb')['db'];config[_0x9edd('0xc')]=_['defaults'](config[_0x9edd('0xc')],{'host':_0x9edd('0xd'),'port':0x18eb});var socket=require(_0x9edd('0xe'))(new Redis(config[_0x9edd('0xc')]));require('./mailMessage.socket')[_0x9edd('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9edd('0x10')][_0x9edd('0x11')]({'port':0x232c});var client9003=jayson['client'][_0x9edd('0x11')]({'port':0x232b});var client9002=jayson[_0x9edd('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30c0d7,_0x1b73d1,_0x25e64c,_0xfd544a){return new BPromise(function(_0x287ddd,_0x3a7b84){var _0xfca576=_0xfd544a||client;return _0xfca576[_0x9edd('0x12')](_0x30c0d7,_0x25e64c)['then'](function(_0x176bfa){logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x1b73d1,_0x9edd('0x15'));logger[_0x9edd('0x16')](_0x9edd('0x17'),_0x1b73d1,_0x9edd('0x15'),JSON[_0x9edd('0x18')](_0x176bfa));if(_0x176bfa['error']){if(_0x176bfa[_0x9edd('0x19')][_0x9edd('0x1a')]===0x1f4){logger[_0x9edd('0x19')]('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x176bfa[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x3a7b84(_0x176bfa[_0x9edd('0x19')]['message']);}logger[_0x9edd('0x19')]('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x176bfa[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x287ddd(_0x176bfa['error']['message']);}else{logger[_0x9edd('0x13')]('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x9edd('0x15'));_0x287ddd(_0x176bfa['result']['message']);}})[_0x9edd('0x1c')](function(_0x1c46a8){logger['error']('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x1c46a8);_0x3a7b84(_0x1c46a8);});});}function respondWithResult(_0x341d67,_0x186186){_0x186186=_0x186186||0xc8;return function(_0x477878){if(_0x477878){return _0x341d67['status'](_0x186186)[_0x9edd('0x1d')](_0x477878);}};}function respondWithFilteredResult(_0x1dca43,_0x44a6c1){return function(_0x2ca65f){if(_0x2ca65f){var _0x339a0d=typeof _0x44a6c1['offset']===_0x9edd('0x1e')&&typeof _0x44a6c1[_0x9edd('0x1f')]===_0x9edd('0x1e');var _0x2f9f86=_0x2ca65f[_0x9edd('0x20')];var _0x4d507f=_0x339a0d?0x0:_0x44a6c1['offset'];var _0x3276ee=_0x339a0d?_0x2ca65f[_0x9edd('0x20')]:_0x44a6c1[_0x9edd('0x21')]+_0x44a6c1[_0x9edd('0x1f')];var _0x3c2227;if(_0x3276ee>=_0x2f9f86){_0x3276ee=_0x2f9f86;_0x3c2227=0xc8;}else{_0x3c2227=0xce;}_0x1dca43['status'](_0x3c2227);return _0x1dca43['set'](_0x9edd('0x22'),_0x4d507f+'-'+_0x3276ee+'/'+_0x2f9f86)[_0x9edd('0x1d')](_0x2ca65f);}return null;};}function saveUpdates(_0x1c762c){return function(_0x52746a){if(_0x52746a){return _0x52746a[_0x9edd('0x23')](_0x1c762c)[_0x9edd('0x24')](function(_0x2ae8dd){return _0x2ae8dd;});}return null;};}function removeEntity(_0x41af53){return function(_0x5eccfb){if(_0x5eccfb){return _0x5eccfb[_0x9edd('0x25')]()[_0x9edd('0x24')](function(){_0x41af53[_0x9edd('0x26')](0xcc)[_0x9edd('0x27')]();});}};}function handleEntityNotFound(_0xbbf08f){return function(_0x42e664){if(!_0x42e664){_0xbbf08f[_0x9edd('0x28')](0x194);}return _0x42e664;};}function handleError(_0x1fba7b,_0x19b6c1){_0x19b6c1=_0x19b6c1||0x1f4;return function(_0x1c2e2b){logger[_0x9edd('0x19')](_0x1c2e2b[_0x9edd('0x29')]);if(_0x1c2e2b[_0x9edd('0x2a')]){delete _0x1c2e2b[_0x9edd('0x2a')];}_0x1fba7b[_0x9edd('0x26')](_0x19b6c1)['send'](_0x1c2e2b);};}exports[_0x9edd('0x2b')]=function(_0x259259,_0x267c74){var _0x5d1707={},_0x2d2f88={},_0x3990fb={'count':0x0,'rows':[]};var _0xde9b13=_[_0x9edd('0x2c')](db[_0x9edd('0x2d')][_0x9edd('0x2e')],function(_0x473068){return{'name':_0x473068[_0x9edd('0x2f')],'type':_0x473068[_0x9edd('0x30')][_0x9edd('0x31')]};});_0x2d2f88[_0x9edd('0x32')]=_[_0x9edd('0x2c')](_0xde9b13,_0x9edd('0x2a'));_0x2d2f88[_0x9edd('0x33')]=_['keys'](_0x259259[_0x9edd('0x33')]);_0x2d2f88['filters']=_[_0x9edd('0x34')](_0x2d2f88[_0x9edd('0x32')],_0x2d2f88[_0x9edd('0x33')]);_0x5d1707[_0x9edd('0x35')]=_[_0x9edd('0x34')](_0x2d2f88['model'],qs[_0x9edd('0x36')](_0x259259[_0x9edd('0x33')][_0x9edd('0x36')]));_0x5d1707[_0x9edd('0x35')]=_0x5d1707[_0x9edd('0x35')][_0x9edd('0x37')]?_0x5d1707[_0x9edd('0x35')]:_0x2d2f88[_0x9edd('0x32')];if(!_0x259259[_0x9edd('0x33')][_0x9edd('0x38')]('nolimit')){_0x5d1707[_0x9edd('0x1f')]=qs['limit'](_0x259259[_0x9edd('0x33')]['limit']);_0x5d1707[_0x9edd('0x21')]=qs[_0x9edd('0x21')](_0x259259[_0x9edd('0x33')]['offset']);}_0x5d1707[_0x9edd('0x39')]=qs[_0x9edd('0x3a')](_0x259259[_0x9edd('0x33')]['sort']);_0x5d1707[_0x9edd('0x3b')]=qs['filters'](_[_0x9edd('0x3c')](_0x259259[_0x9edd('0x33')],_0x2d2f88['filters']),_0xde9b13);if(_0x259259[_0x9edd('0x33')][_0x9edd('0x3d')]){_0x5d1707[_0x9edd('0x3b')]=_[_0x9edd('0x3e')](_0x5d1707['where'],{'$or':_[_0x9edd('0x2c')](_0xde9b13,function(_0x5bbdf8){if(_0x5bbdf8[_0x9edd('0x30')]!==_0x9edd('0x3f')){var _0x587d74={};_0x587d74[_0x5bbdf8[_0x9edd('0x2a')]]={'$like':'%'+_0x259259['query']['filter']+'%'};return _0x587d74;}})});}_0x5d1707=_[_0x9edd('0x3e')]({},_0x5d1707,_0x259259[_0x9edd('0x40')]);var _0x1f276b={'where':_0x5d1707[_0x9edd('0x3b')]};return db[_0x9edd('0x2d')][_0x9edd('0x20')](_0x1f276b)[_0x9edd('0x24')](function(_0x75efbe){_0x3990fb[_0x9edd('0x20')]=_0x75efbe;if(_0x259259[_0x9edd('0x33')][_0x9edd('0x41')]){_0x5d1707[_0x9edd('0x42')]=[{'all':!![]}];}return db[_0x9edd('0x2d')][_0x9edd('0x43')](_0x5d1707);})[_0x9edd('0x24')](function(_0x5416f8){_0x3990fb[_0x9edd('0x44')]=_0x5416f8;return _0x3990fb;})[_0x9edd('0x24')](respondWithFilteredResult(_0x267c74,_0x5d1707))[_0x9edd('0x1c')](handleError(_0x267c74,null));};exports[_0x9edd('0x45')]=function(_0x241929,_0x3ecdfd){var _0x10d41e={'raw':!![],'where':{'id':_0x241929['params']['id']}},_0x4e9ad1={};_0x4e9ad1['model']=_[_0x9edd('0x46')](db['MailMessage'][_0x9edd('0x2e')]);_0x4e9ad1[_0x9edd('0x33')]=_[_0x9edd('0x46')](_0x241929[_0x9edd('0x33')]);_0x4e9ad1[_0x9edd('0x47')]=_['intersection'](_0x4e9ad1[_0x9edd('0x32')],_0x4e9ad1[_0x9edd('0x33')]);_0x10d41e[_0x9edd('0x35')]=_['intersection'](_0x4e9ad1[_0x9edd('0x32')],qs[_0x9edd('0x36')](_0x241929[_0x9edd('0x33')][_0x9edd('0x36')]));_0x10d41e[_0x9edd('0x35')]=_0x10d41e[_0x9edd('0x35')]['length']?_0x10d41e[_0x9edd('0x35')]:_0x4e9ad1[_0x9edd('0x32')];if(_0x241929['query'][_0x9edd('0x41')]){_0x10d41e[_0x9edd('0x42')]=[{'all':!![]}];}_0x10d41e=_['merge']({},_0x10d41e,_0x241929[_0x9edd('0x40')]);return db[_0x9edd('0x2d')][_0x9edd('0x48')](_0x10d41e)['then'](handleEntityNotFound(_0x3ecdfd,null))[_0x9edd('0x24')](respondWithResult(_0x3ecdfd,null))[_0x9edd('0x1c')](handleError(_0x3ecdfd,null));};exports[_0x9edd('0x23')]=function(_0x28c7bd,_0x53f6e3){if(_0x28c7bd[_0x9edd('0x49')]['id']){delete _0x28c7bd[_0x9edd('0x49')]['id'];}return db[_0x9edd('0x2d')]['find']({'where':{'id':_0x28c7bd[_0x9edd('0x4a')]['id']}})[_0x9edd('0x24')](handleEntityNotFound(_0x53f6e3,null))['then'](saveUpdates(_0x28c7bd[_0x9edd('0x49')],null))['then'](respondWithResult(_0x53f6e3,null))[_0x9edd('0x1c')](handleError(_0x53f6e3,null));};exports[_0x9edd('0x25')]=function(_0x24245f,_0x3fcdf5){return db[_0x9edd('0x2d')][_0x9edd('0x48')]({'where':{'id':_0x24245f[_0x9edd('0x4a')]['id']}})[_0x9edd('0x24')](handleEntityNotFound(_0x3fcdf5,null))[_0x9edd('0x24')](removeEntity(_0x3fcdf5,null))[_0x9edd('0x1c')](handleError(_0x3fcdf5,null));};exports[_0x9edd('0x4b')]=function(_0x5a3b1d,_0x161bea){return db[_0x9edd('0x2d')][_0x9edd('0x4b')]()['then'](respondWithResult(_0x161bea,null))[_0x9edd('0x1c')](handleError(_0x161bea,null));};exports['create']=function(_0x54d83d,_0x54ecfa){return db[_0x9edd('0x2d')][_0x9edd('0x4c')](_0x54d83d[_0x9edd('0x49')])[_0x9edd('0x24')](function(_0x48a900){if(_0x48a900){if(_0x48a900['direction']==='out'&&!_0x48a900[_0x9edd('0x4d')]){var _0x5f666b,_0xd5090a,_0x1091ff;if(_0x54d83d[_0x9edd('0x49')]['to']){_0xd5090a=_0x54d83d[_0x9edd('0x49')]['to'][_0x9edd('0x4e')](',')[0x0];}return db[_0x9edd('0x4f')]['findOne']({'where':{'id':_0x48a900[_0x9edd('0x50')]},'include':[{'model':db['CmList'],'as':_0x9edd('0x51'),'include':[{'model':db[_0x9edd('0x52')],'as':'Contacts','where':{'email':_0xd5090a},'limit':0x1,'order':[[_0x9edd('0x53'),_0x9edd('0x54')]]}]},{'model':db[_0x9edd('0x55')],'as':'Smtp','raw':!![]}]})[_0x9edd('0x24')](function(_0x2e1ce3){_0x5f666b=_0x2e1ce3;if(_0x5f666b&&_0x5f666b[_0x9edd('0x56')]){var _0x15ebfa={'tls':{'rejectUnauthorized':![]}};if(_[_0x9edd('0x57')](_0x5f666b[_0x9edd('0x56')]['service'])){_0x15ebfa['host']=_0x5f666b[_0x9edd('0x56')]['host'];_0x15ebfa[_0x9edd('0x58')]=_0x5f666b[_0x9edd('0x56')][_0x9edd('0x58')];_0x15ebfa[_0x9edd('0x59')]=_0x5f666b['Smtp'][_0x9edd('0x59')];if(_0x5f666b['Smtp'][_0x9edd('0x5a')]){_0x15ebfa[_0x9edd('0x5b')]={'user':_0x5f666b[_0x9edd('0x56')]['user'],'pass':_0x5f666b[_0x9edd('0x56')]['pass']};}}else{_0x15ebfa[_0x9edd('0x5c')]=_0x5f666b[_0x9edd('0x56')]['service'];_0x15ebfa[_0x9edd('0x5b')]={'user':_0x5f666b['Smtp'][_0x9edd('0x5d')],'pass':_0x5f666b[_0x9edd('0x56')][_0x9edd('0x5e')]};_0x15ebfa['secure']=_0x5f666b[_0x9edd('0x56')][_0x9edd('0x59')];}if(_0x54d83d[_0x9edd('0x49')][_0x9edd('0x5f')]&&_0x54d83d[_0x9edd('0x49')]['attachments']['length']){for(var _0x2e1a96=0x0;_0x2e1a96<_0x54d83d[_0x9edd('0x49')]['attachments']['length'];_0x2e1a96+=0x1){_0x54d83d['body'][_0x9edd('0x5f')][_0x2e1a96]={'filename':_0x54d83d['body']['attachments'][_0x2e1a96][_0x9edd('0x2a')],'path':path[_0x9edd('0x60')](config['root'],_0x9edd('0x61'),_0x54d83d[_0x9edd('0x49')][_0x9edd('0x5f')][_0x2e1a96]['basename'])};}}_0x1091ff={'account':_0x15ebfa,'message':_0x54d83d[_0x9edd('0x49')]};return;}})['then'](function(){if(_0x5f666b[_0x9edd('0x51')]){if(_0x5f666b[_0x9edd('0x51')]['Contacts'][_0x9edd('0x37')]){return _0x5f666b[_0x9edd('0x51')]['Contacts'][0x0];}else{return db[_0x9edd('0x52')][_0x9edd('0x4c')](_[_0x9edd('0x62')](_0x54d83d[_0x9edd('0x49')],{'firstName':_0x54d83d['body']['to'],'email':_0x54d83d[_0x9edd('0x49')]['to'],'phone':_0x54d83d['body']['to'],'ListId':_0x5f666b[_0x9edd('0x63')]}));}}else{throw new Error(_0x9edd('0x64'));}})[_0x9edd('0x24')](function(){if(_0x1091ff){return respondWithRpcPromise('SendMail',_0x9edd('0x65'),_0x1091ff,client9003)[_0x9edd('0x24')](function(_0x130dba){return _0x48a900[_0x9edd('0x23')]({'read':!![],'messageId':_0x130dba[_0x9edd('0x66')],'sentAt':moment()[_0x9edd('0x67')](_0x9edd('0x68'))});})['catch'](function(_0x5e29d0){logger[_0x9edd('0x19')]('%s',JSON[_0x9edd('0x18')](_0x5e29d0));return _0x48a900;});}return _0x48a900;});}return _0x48a900;}})[_0x9edd('0x24')](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x1c')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x69')]=function(_0x52f6f3,_0x2e40c8){var _0x5d56a={'agent':{},'channel':_0x9edd('0x6a')};if(_0x52f6f3['body']['id']){delete _0x52f6f3[_0x9edd('0x49')]['id'];}_0x52f6f3[_0x9edd('0x49')]['read']=!![];_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6b')]=moment()['format'](_0x9edd('0x68'));_0x52f6f3[_0x9edd('0x49')]['UserId']=_0x52f6f3[_0x9edd('0x49')]['UserId']||_0x52f6f3['user']['id'];_0x5d56a[_0x9edd('0x6c')]['id']=_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')];return db['MailMessage'][_0x9edd('0x48')]({'where':{'id':_0x52f6f3[_0x9edd('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2e40c8,null))[_0x9edd('0x24')](saveUpdates(_0x52f6f3[_0x9edd('0x49')],null))[_0x9edd('0x24')](function(_0x1ad198){if(_0x1ad198){_0x5d56a['message']=_0x1ad198['get']({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'id':_0x1ad198[_0x9edd('0x6f')]}});}return null;})[_0x9edd('0x24')](handleEntityNotFound(_0x2e40c8,null))[_0x9edd('0x24')](function(_0x3cfd35){if(_0x3cfd35){return _0x3cfd35[_0x9edd('0x23')]({'UserId':_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')],'read1stAt':_[_0x9edd('0x57')](_0x3cfd35[_0x9edd('0x70')])?moment()['format'](_0x9edd('0x68')):undefined});}return null;})[_0x9edd('0x24')](function(_0x2c7562){if(_0x2c7562){_0x5d56a[_0x9edd('0x71')]=_0x2c7562[_0x9edd('0x72')]({'plain':!![]});interaction_log[_0x9edd('0x13')](_0x9edd('0x73'),_0x52f6f3['user']['id'],_0x52f6f3[_0x9edd('0x5d')][_0x9edd('0x2a')],_0x52f6f3['user'][_0x9edd('0x74')],_0x5d56a[_0x9edd('0x71')]['id'],_0x52f6f3['body']?JSON[_0x9edd('0x18')](_0x52f6f3[_0x9edd('0x49')]):_0x9edd('0x75'));return respondWithRpcPromise('AcceptMessage',_0x9edd('0x76'),_0x5d56a);}return null;})[_0x9edd('0x24')](function(_0x3f04d3){var _0x5a7de3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f04d3['message']['ContactId'];return db[_0x9edd('0x77')][_0x9edd('0x33')](_0x5a7de3,{'type':db[_0x9edd('0x78')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x56d794){return _0x56d794;});})[_0x9edd('0x24')](function(_0x20762d){if(_0x20762d){_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x79')]=_0x20762d[0x0];if(!_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')])return;return db[_0x9edd('0x7a')][_0x9edd('0x48')]({'where':{'id':_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')],'role':_0x9edd('0x6c')},'attributes':['id','name',_0x9edd('0x7b'),_0x9edd('0x7c'),_0x9edd('0x7d')],'raw':!![]});}return null;})[_0x9edd('0x24')](function(_0x104afc){if(!_0x104afc)return null;_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x6c')]=_0x104afc;return _0x5d56a;})[_0x9edd('0x24')](function(_0x4a7889){if(_0x4a7889){if(_0x52f6f3['body'][_0x9edd('0x7e')]){_0x5d56a['message'][_0x9edd('0x7f')]=util['format'](_0x9edd('0x80'),_0x52f6f3[_0x9edd('0x5d')]['name']);_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x81')]=_0x5d56a['channel'];_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x82')]=_0x9edd('0x69');_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x49')]=htmlToText['fromString'](_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x49')]);return respondWithRpcPromise(_0x9edd('0x83'),_0x9edd('0x83'),{'event':_0x9edd('0x84'),'message':_0x5d56a['message']},client9002)['then'](function(){return _0x5d56a;});}return _0x5d56a;}return null;})['then'](respondWithResult(_0x2e40c8,null))['catch'](handleError(_0x2e40c8,null));};exports['reject']=function(_0x2da088,_0x5d566e){var _0x58cb3f={'agent':{},'channel':_0x9edd('0x6a')};if(_0x2da088[_0x9edd('0x49')]['id']){delete _0x2da088[_0x9edd('0x49')]['id'];}_0x2da088[_0x9edd('0x49')][_0x9edd('0x6d')]=_0x2da088[_0x9edd('0x49')][_0x9edd('0x6d')]||_0x2da088[_0x9edd('0x5d')]['id'];_0x58cb3f[_0x9edd('0x6c')]['id']=_0x2da088[_0x9edd('0x49')]['UserId'];return db[_0x9edd('0x2d')][_0x9edd('0x48')]({'where':{'id':_0x2da088[_0x9edd('0x4a')]['id'],'UserId':null}})[_0x9edd('0x24')](handleEntityNotFound(_0x5d566e,null))[_0x9edd('0x24')](function(_0x23e925){if(_0x23e925){_0x58cb3f[_0x9edd('0x1b')]=_0x23e925[_0x9edd('0x72')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x23e925[_0x9edd('0x6f')]}});}return null;})[_0x9edd('0x24')](handleEntityNotFound(_0x5d566e,null))[_0x9edd('0x24')](function(_0x120d0f){if(_0x120d0f){_0x58cb3f[_0x9edd('0x71')]=_0x120d0f[_0x9edd('0x72')]({'plain':!![]});interaction_log[_0x9edd('0x13')](_0x9edd('0x85'),_0x2da088[_0x9edd('0x5d')]['id'],_0x2da088[_0x9edd('0x5d')][_0x9edd('0x2a')],_0x2da088[_0x9edd('0x5d')][_0x9edd('0x74')],_0x58cb3f[_0x9edd('0x71')]['id'],_0x2da088['body']?JSON[_0x9edd('0x18')](_0x2da088[_0x9edd('0x49')]):'null');return respondWithRpcPromise(_0x9edd('0x86'),_0x9edd('0x87'),_0x58cb3f);}return null;})[_0x9edd('0x24')](function(_0x2b4d4c){var _0x559503=_0x9edd('0x88')+_0x2b4d4c[_0x9edd('0x1b')][_0x9edd('0x89')];return db[_0x9edd('0x77')][_0x9edd('0x33')](_0x559503,{'type':db['Sequelize'][_0x9edd('0x8a')][_0x9edd('0x8b')],'raw':!![]})[_0x9edd('0x24')](function(_0x4633eb){return _0x4633eb;});})[_0x9edd('0x24')](function(_0x59927d){if(_0x59927d){_0x58cb3f['message'][_0x9edd('0x79')]=_0x59927d[0x0];if(!_0x2da088['body'][_0x9edd('0x6d')])return;return db['User'][_0x9edd('0x48')]({'where':{'id':_0x2da088[_0x9edd('0x49')][_0x9edd('0x6d')],'role':_0x9edd('0x6c')},'attributes':['id',_0x9edd('0x2a'),_0x9edd('0x7b'),'email',_0x9edd('0x7d')],'raw':!![]});}return null;})[_0x9edd('0x24')](function(_0x3aae72){if(!_0x3aae72)return null;_0x58cb3f[_0x9edd('0x1b')][_0x9edd('0x6c')]=_0x3aae72;return _0x58cb3f;})[_0x9edd('0x24')](function(_0x2f8fb6){if(_0x2f8fb6){_0x2f8fb6[_0x9edd('0x1b')]['interface']=util[_0x9edd('0x67')](_0x9edd('0x80'),_0x2da088[_0x9edd('0x5d')][_0x9edd('0x2a')]);_0x2f8fb6[_0x9edd('0x1b')][_0x9edd('0x81')]=_0x58cb3f[_0x9edd('0x81')];_0x2f8fb6[_0x9edd('0x1b')][_0x9edd('0x82')]=_0x9edd('0x8c');_0x2f8fb6[_0x9edd('0x1b')][_0x9edd('0x49')]=htmlToText[_0x9edd('0x8d')](_0x58cb3f[_0x9edd('0x1b')][_0x9edd('0x49')]);respondWithRpcPromise(_0x9edd('0x83'),_0x9edd('0x83'),{'event':_0x9edd('0x8e'),'message':_0x2f8fb6[_0x9edd('0x1b')]},client9002);return _0x58cb3f;}return null;})[_0x9edd('0x24')](respondWithResult(_0x5d566e,null))[_0x9edd('0x1c')](handleError(_0x5d566e,null));};exports['download']=function(_0xa704eb,_0x553018){var _0x4ca7e4=moment()[_0x9edd('0x8f')]()[_0x9edd('0x90')]();var _0x220c00=path[_0x9edd('0x60')](config[_0x9edd('0x91')],_0x9edd('0x92'),_0x9edd('0x93'),_0x9edd('0x94'));var _0x3e5a45=path[_0x9edd('0x60')](config['root'],_0x9edd('0x92'),_0x9edd('0x93'),'attachments');var _0x568067=util[_0x9edd('0x67')](_0x9edd('0x95'),_0x4ca7e4);return db[_0x9edd('0x2d')][_0x9edd('0x48')]({'where':{'id':_0xa704eb['params']['id']},'attributes':['id','body',_0x9edd('0x96'),'to','cc','bcc',_0x9edd('0x97'),_0x9edd('0x98')],'include':_0xa704eb[_0x9edd('0x33')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x9edd('0x24')](handleEntityNotFound(_0x553018,null))[_0x9edd('0x24')](function(_0x7b0fc8){if(_0x7b0fc8){var _0x5bfbfd=_0x7b0fc8;var _0xb2e72={'from':_0x5bfbfd[_0x9edd('0x96')],'to':_0x5bfbfd['to'],'subject':_0x5bfbfd['subject'],'html':_0x5bfbfd[_0x9edd('0x49')],'headers':{'Date':moment(_0x5bfbfd[_0x9edd('0x98')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x7b0fc8['cc']){_0xb2e72[_0x9edd('0x99')]['Cc']=_0x7b0fc8['cc'];}if(_0x7b0fc8[_0x9edd('0x9a')]){_0xb2e72['headers'][_0x9edd('0x9b')]=_0x7b0fc8[_0x9edd('0x9a')];}return new BPromise(function(_0x54c6a0,_0x201d76){if(_0x7b0fc8['Attachments']){for(var _0x308a0f=0x0;_0x308a0f<_0x7b0fc8[_0x9edd('0x9c')][_0x9edd('0x37')];_0x308a0f++){var _0x742e13=_0x7b0fc8[_0x9edd('0x9c')][_0x308a0f];var _0x3e6426=path['join'](_0x3e5a45,_0x742e13[_0x9edd('0x9d')]);if(fs[_0x9edd('0x9e')](_0x3e6426)){_0xb2e72[_0x9edd('0x5f')]['push']({'name':_0x742e13[_0x9edd('0x2a')],'contentType':_0x742e13['type'],'data':fs[_0x9edd('0x9f')](_0x3e6426)});}}}emlformat[_0x9edd('0xa0')](_0xb2e72,function(_0x25da04,_0x41b0ea){if(_0x25da04)return _0x201d76(_0x25da04);fs['writeFileSync'](path['join'](_0x220c00,_0x568067),_0x41b0ea);return _0x54c6a0(_0x41b0ea);});});}})['then'](function(_0x12dcfa){if(_0x12dcfa){return _0x553018[_0x9edd('0xa1')](path[_0x9edd('0x60')](_0x220c00,_0x568067),_0x568067,function(_0x50af78){if(!_0x50af78)fs[_0x9edd('0xa2')](path[_0x9edd('0x60')](_0x220c00,_0x568067));});}})[_0x9edd('0x1c')](handleError(_0x553018,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6827fd3..62fc513 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 _0x4add=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0x4add,0x12b));var _0xd4ad=function(_0x480da8,_0x262636){_0x480da8=_0x480da8-0x0;var _0x427820=_0x4add[_0x480da8];return _0x427820;};'use strict';var EventEmitter=require(_0xd4ad('0x0'));var MailMessage=require(_0xd4ad('0x1'))['db'][_0xd4ad('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd4ad('0x3')](0x0);var events={'afterCreate':_0xd4ad('0x4'),'afterUpdate':_0xd4ad('0x5'),'afterDestroy':_0xd4ad('0x6')};function emitEvent(_0x14e98b){return function(_0x18ce55,_0x4760fd,_0x34b084){MailMessageEvents[_0xd4ad('0x7')](_0x14e98b+':'+_0x18ce55['id'],_0x18ce55);MailMessageEvents['emit'](_0x14e98b,_0x18ce55);_0x34b084(null);};}for(var e in events){if(events[_0xd4ad('0x8')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xd4ad('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x2dbe=['events','../../mysqldb','MailMessage','setMaxListeners','remove','emit','hasOwnProperty','exports'];(function(_0x5e55b6,_0x1f20e1){var _0x3854ed=function(_0x3ab0bf){while(--_0x3ab0bf){_0x5e55b6['push'](_0x5e55b6['shift']());}};_0x3854ed(++_0x1f20e1);}(_0x2dbe,0x80));var _0xe2db=function(_0x3d4856,_0x3e36a1){_0x3d4856=_0x3d4856-0x0;var _0x2d99c9=_0x2dbe[_0x3d4856];return _0x2d99c9;};'use strict';var EventEmitter=require(_0xe2db('0x0'));var MailMessage=require(_0xe2db('0x1'))['db'][_0xe2db('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe2db('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe2db('0x4')};function emitEvent(_0x4f6405){return function(_0x5b4230,_0x1a777d,_0x1e5533){MailMessageEvents[_0xe2db('0x5')](_0x4f6405+':'+_0x5b4230['id'],_0x5b4230);MailMessageEvents['emit'](_0x4f6405,_0x5b4230);_0x1e5533(null);};}for(var e in events){if(events[_0xe2db('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xe2db('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 a02db56..f6e02f6 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 _0x3db0=['fromString','body','models','get','toLowerCase','out','secret','then','createdAt','direction','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','subject','FULLTEXT'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x3db0,0x1dc));var _0x03db=function(_0x4f192e,_0x4d1756){_0x4f192e=_0x4f192e-0x0;var _0x49294d=_0x3db0[_0x4f192e];return _0x49294d;};'use strict';var _=require('lodash');var util=require(_0x03db('0x0'));var logger=require(_0x03db('0x1'))(_0x03db('0x2'));var moment=require(_0x03db('0x3'));var BPromise=require(_0x03db('0x4'));var rp=require('request-promise');var htmlToText=require(_0x03db('0x5'));var fs=require('fs');var path=require(_0x03db('0x6'));var rimraf=require(_0x03db('0x7'));var config=require(_0x03db('0x8'));var attributes=require(_0x03db('0x9'));module[_0x03db('0xa')]=function(_0x5379f4,_0x235607){return _0x5379f4[_0x03db('0xb')](_0x03db('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x03db('0xd'),'fields':[_0x03db('0xd')]},{'name':_0x03db('0xe'),'fields':['plainBody',_0x03db('0xf')],'type':_0x03db('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x101d3f,_0x1607c3,_0x54bae5){if(_0x101d3f['body']){_0x101d3f['plainBody']=htmlToText[_0x03db('0x11')](_0x101d3f[_0x03db('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x54bae5(null,_0x1607c3);},'afterCreate':function(_0xceecd3,_0x57afec,_0x19bf8f){var _0xd85c10=_0x5379f4[_0x03db('0x13')];var _0x38c920=_0xceecd3[_0x03db('0x14')]({'plain':!![]});if(_0x38c920['direction']['toLowerCase']()==='in'||_0x38c920['direction'][_0x03db('0x15')]()===_0x03db('0x16')&&!_0x38c920[_0x03db('0x17')]&&!_['isNil'](_0x38c920['UserId'])){_0xd85c10['MailInteraction']['findOne']({'where':{'id':_0x38c920['MailInteractionId']}})[_0x03db('0x18')](function(_0x5ef31f){if(_0x5ef31f){_0x5ef31f['update']({'lastMsgAt':_0x38c920[_0x03db('0x19')],'lastMsgDirection':_0x38c920[_0x03db('0x1a')]['toLowerCase']()});}})['catch'](function(_0x13b289){console[_0x03db('0x1b')](_0x13b289);});}_0x19bf8f();}},'charset':'utf8mb4','collate':_0x03db('0x1c')});}; \ No newline at end of file +var _0xbc3a=['then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','MailInteractionId'];(function(_0x477872,_0x36bfa8){var _0x5c6115=function(_0x42b0bf){while(--_0x42b0bf){_0x477872['push'](_0x477872['shift']());}};_0x5c6115(++_0x36bfa8);}(_0xbc3a,0xb4));var _0xabc3=function(_0x381b7a,_0x12989f){_0x381b7a=_0x381b7a-0x0;var _0x43b539=_0xbc3a[_0x381b7a];return _0x43b539;};'use strict';var _=require(_0xabc3('0x0'));var util=require(_0xabc3('0x1'));var logger=require(_0xabc3('0x2'))(_0xabc3('0x3'));var moment=require(_0xabc3('0x4'));var BPromise=require('bluebird');var rp=require(_0xabc3('0x5'));var htmlToText=require(_0xabc3('0x6'));var fs=require('fs');var path=require(_0xabc3('0x7'));var rimraf=require(_0xabc3('0x8'));var config=require(_0xabc3('0x9'));var attributes=require(_0xabc3('0xa'));module[_0xabc3('0xb')]=function(_0x128aa6,_0x57dc1f){return _0x128aa6[_0xabc3('0xc')](_0xabc3('0xd'),attributes,{'tableName':_0xabc3('0xe'),'paranoid':![],'indexes':[{'name':_0xabc3('0xf'),'fields':['messageId']},{'name':_0xabc3('0x10'),'fields':[_0xabc3('0x11'),_0xabc3('0x12')],'type':_0xabc3('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x472e14,_0x42dc60,_0x7aaf7d){if(_0x472e14['body']){_0x472e14[_0xabc3('0x11')]=htmlToText['fromString'](_0x472e14[_0xabc3('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x7aaf7d(null,_0x42dc60);},'afterCreate':function(_0x41099a,_0x3d7644,_0x1e4aec){var _0x50f0a0=_0x128aa6['models'];var _0x1b35d6=_0x41099a[_0xabc3('0x15')]({'plain':!![]});if(_0x1b35d6[_0xabc3('0x16')][_0xabc3('0x17')]()==='in'||_0x1b35d6[_0xabc3('0x16')][_0xabc3('0x17')]()===_0xabc3('0x18')&&!_0x1b35d6['secret']&&!_[_0xabc3('0x19')](_0x1b35d6[_0xabc3('0x1a')])){_0x50f0a0[_0xabc3('0x1b')][_0xabc3('0x1c')]({'where':{'id':_0x1b35d6[_0xabc3('0x1d')]}})[_0xabc3('0x1e')](function(_0x84565){if(_0x84565){_0x84565['update']({'lastMsgAt':_0x1b35d6[_0xabc3('0x1f')],'lastMsgDirection':_0x1b35d6[_0xabc3('0x16')][_0xabc3('0x17')]()});}})[_0xabc3('0x20')](function(_0x26885f){console[_0xabc3('0x21')](_0x26885f);});}_0x1e4aec();}},'charset':'utf8mb4','collate':_0xabc3('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1d61ead..ab60688 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 _0x6cb4=['result','catch','CreateMailMessage','MailMessage','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6cb4,0xff));var _0x46cb=function(_0x32bd56,_0x5588c5){_0x32bd56=_0x32bd56-0x0;var _0x396c0f=_0x6cb4[_0x32bd56];return _0x396c0f;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./mailMessage.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});}exports[_0x46cb('0x1b')]=function(_0x32e9fe){var _0x90cd50=this;return new Promise(function(_0xfc9064,_0x149483){return db[_0x46cb('0x1c')][_0x46cb('0x1d')](_0x32e9fe[_0x46cb('0x1e')],{'raw':_0x32e9fe[_0x46cb('0x1f')]?_0x32e9fe[_0x46cb('0x1f')][_0x46cb('0x20')]===undefined?!![]:![]:!![]})[_0x46cb('0x11')](function(_0x41ecd2){logger[_0x46cb('0x21')](_0x46cb('0x1b'),_0x32e9fe);logger[_0x46cb('0x13')](_0x46cb('0x1b'),_0x32e9fe,JSON[_0x46cb('0x22')](_0x41ecd2));_0xfc9064(_0x41ecd2);})[_0x46cb('0x1a')](function(_0x5a1338){logger['error'](_0x46cb('0x1b'),_0x5a1338[_0x46cb('0x18')],_0x32e9fe);_0x149483(_0x90cd50[_0x46cb('0x15')](0x1f4,_0x5a1338[_0x46cb('0x18')]));});});}; \ No newline at end of file +var _0xf7b4=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','lodash','bluebird'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xf7b4,0x152));var _0x4f7b=function(_0x1a06c4,_0x17d0e0){_0x1a06c4=_0x1a06c4-0x0;var _0x1bf57b=_0xf7b4[_0x1a06c4];return _0x1bf57b;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});config[_0x4f7b('0xa')]=_[_0x4f7b('0xb')](config[_0x4f7b('0xa')],{'host':_0x4f7b('0xc'),'port':0x18eb});var socket=require(_0x4f7b('0xd'))(new Redis(config[_0x4f7b('0xa')]));require('./mailMessage.socket')[_0x4f7b('0xe')](socket);function respondWithRpcPromise(_0x1016e0,_0x479208,_0xdd1aab){return new BPromise(function(_0x3a3d6c,_0x408e01){return client[_0x4f7b('0xf')](_0x1016e0,_0xdd1aab)[_0x4f7b('0x10')](function(_0x55d69f){logger[_0x4f7b('0x11')]('MailMessage,\x20%s,\x20%s',_0x479208,'request\x20sent');logger[_0x4f7b('0x12')](_0x4f7b('0x13'),_0x479208,_0x4f7b('0x14'),JSON[_0x4f7b('0x15')](_0x55d69f));if(_0x55d69f['error']){if(_0x55d69f[_0x4f7b('0x16')][_0x4f7b('0x17')]===0x1f4){logger[_0x4f7b('0x16')](_0x4f7b('0x18'),_0x479208,_0x55d69f[_0x4f7b('0x16')][_0x4f7b('0x19')]);return _0x408e01(_0x55d69f[_0x4f7b('0x16')][_0x4f7b('0x19')]);}logger[_0x4f7b('0x16')](_0x4f7b('0x18'),_0x479208,_0x55d69f[_0x4f7b('0x16')][_0x4f7b('0x19')]);return _0x3a3d6c(_0x55d69f['error'][_0x4f7b('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x479208,_0x4f7b('0x14'));_0x3a3d6c(_0x55d69f[_0x4f7b('0x1a')]['message']);}})[_0x4f7b('0x1b')](function(_0x24c460){logger[_0x4f7b('0x16')](_0x4f7b('0x18'),_0x479208,_0x24c460);_0x408e01(_0x24c460);});});}exports['CreateMailMessage']=function(_0x1daa79){var _0x5adacb=this;return new Promise(function(_0x41cf36,_0x12374b){return db[_0x4f7b('0x1c')][_0x4f7b('0x1d')](_0x1daa79[_0x4f7b('0x1e')],{'raw':_0x1daa79[_0x4f7b('0x1f')]?_0x1daa79[_0x4f7b('0x1f')][_0x4f7b('0x20')]===undefined?!![]:![]:!![]})[_0x4f7b('0x10')](function(_0x5508bd){logger[_0x4f7b('0x11')](_0x4f7b('0x21'),_0x1daa79);logger[_0x4f7b('0x12')]('CreateMailMessage',_0x1daa79,JSON[_0x4f7b('0x15')](_0x5508bd));_0x41cf36(_0x5508bd);})[_0x4f7b('0x1b')](function(_0x5d22f4){logger[_0x4f7b('0x16')]('CreateMailMessage',_0x5d22f4[_0x4f7b('0x19')],_0x1daa79);_0x12374b(_0x5adacb[_0x4f7b('0x16')](0x1f4,_0x5d22f4[_0x4f7b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 485fc28..ae0dc39 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 _0xfe48=['update','register','length','./mailMessage.events','save','remove'];(function(_0x45b609,_0x1b0233){var _0x416a8e=function(_0x275e6b){while(--_0x275e6b){_0x45b609['push'](_0x45b609['shift']());}};_0x416a8e(++_0x1b0233);}(_0xfe48,0x183));var _0x8fe4=function(_0x188bda,_0x1fef30){_0x188bda=_0x188bda-0x0;var _0xb6d1b0=_0xfe48[_0x188bda];return _0xb6d1b0;};'use strict';var MailMessageEvents=require(_0x8fe4('0x0'));var events=[_0x8fe4('0x1'),_0x8fe4('0x2'),_0x8fe4('0x3')];function createListener(_0x4405bd,_0x290be3){return function(_0x24ad3a){_0x290be3['emit'](_0x4405bd,_0x24ad3a);};}function removeListener(_0x2634c5,_0x18085c){return function(){MailMessageEvents['removeListener'](_0x2634c5,_0x18085c);};}exports[_0x8fe4('0x4')]=function(_0x4be034){for(var _0x19b0ea=0x0,_0x1f48a8=events[_0x8fe4('0x5')];_0x19b0ea<_0x1f48a8;_0x19b0ea++){var _0x116475=events[_0x19b0ea];var _0x2847ba=createListener('mailMessage:'+_0x116475,_0x4be034);MailMessageEvents['on'](_0x116475,_0x2847ba);}}; \ No newline at end of file +var _0x1cea=['remove','update','emit','length','./mailMessage.events','save'];(function(_0x1b68ff,_0x5e68a2){var _0x4b3b07=function(_0x465dd9){while(--_0x465dd9){_0x1b68ff['push'](_0x1b68ff['shift']());}};_0x4b3b07(++_0x5e68a2);}(_0x1cea,0x142));var _0xa1ce=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x1cea[_0x2dc343];return _0x51eac5;};'use strict';var MailMessageEvents=require(_0xa1ce('0x0'));var events=[_0xa1ce('0x1'),_0xa1ce('0x2'),_0xa1ce('0x3')];function createListener(_0x466fa5,_0x35f617){return function(_0xc8bf2b){_0x35f617[_0xa1ce('0x4')](_0x466fa5,_0xc8bf2b);};}function removeListener(_0x4725b6,_0x3b3c9f){return function(){MailMessageEvents['removeListener'](_0x4725b6,_0x3b3c9f);};}exports['register']=function(_0x5f1fa0){for(var _0xd97ffe=0x0,_0x1cd99f=events[_0xa1ce('0x5')];_0xd97ffe<_0x1cd99f;_0xd97ffe++){var _0xa77293=events[_0xd97ffe];var _0x27e542=createListener('mailMessage:'+_0xa77293,_0x5f1fa0);MailMessageEvents['on'](_0xa77293,_0x27e542);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0cfb464..fecc363 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 _0xcc8f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express'];(function(_0x27225d,_0x329a3c){var _0x39944d=function(_0x3c04ca){while(--_0x3c04ca){_0x27225d['push'](_0x27225d['shift']());}};_0x39944d(++_0x329a3c);}(_0xcc8f,0x164));var _0xfcc8=function(_0x57aab6,_0x18f41b){_0x57aab6=_0x57aab6-0x0;var _0x101dc0=_0xcc8f[_0x57aab6];return _0x101dc0;};'use strict';var multer=require(_0xfcc8('0x0'));var util=require('util');var path=require(_0xfcc8('0x1'));var timeout=require(_0xfcc8('0x2'));var express=require(_0xfcc8('0x3'));var router=express[_0xfcc8('0x4')]();var fs_extra=require(_0xfcc8('0x5'));var auth=require(_0xfcc8('0x6'));var interaction=require(_0xfcc8('0x7'));var config=require(_0xfcc8('0x8'));var controller=require(_0xfcc8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xfcc8('0xa')]);router[_0xfcc8('0xb')](_0xfcc8('0xc'),auth[_0xfcc8('0xd')](),controller[_0xfcc8('0xe')]);router[_0xfcc8('0xb')](_0xfcc8('0xf'),auth[_0xfcc8('0xd')](),controller[_0xfcc8('0x10')]);router[_0xfcc8('0xb')]('/:id/members',auth[_0xfcc8('0xd')](),controller[_0xfcc8('0x11')]);router[_0xfcc8('0xb')](_0xfcc8('0x12'),auth[_0xfcc8('0xd')](),controller[_0xfcc8('0x13')]);router[_0xfcc8('0xb')]('/:id/users',auth[_0xfcc8('0xd')](),controller[_0xfcc8('0x14')]);router[_0xfcc8('0x15')]('/',auth[_0xfcc8('0xd')](),controller[_0xfcc8('0x16')]);router[_0xfcc8('0x15')](_0xfcc8('0x12'),auth[_0xfcc8('0xd')](),controller['addTeams']);router[_0xfcc8('0x15')](_0xfcc8('0x17'),auth[_0xfcc8('0xd')](),controller[_0xfcc8('0x18')]);router['put'](_0xfcc8('0xf'),auth[_0xfcc8('0xd')](),controller[_0xfcc8('0x19')]);router[_0xfcc8('0x1a')](_0xfcc8('0xf'),auth[_0xfcc8('0xd')](),controller[_0xfcc8('0x1b')]);router[_0xfcc8('0x1a')]('/:id/teams',auth[_0xfcc8('0xd')](),controller['removeTeams']);router[_0xfcc8('0x1a')](_0xfcc8('0x17'),auth['isAuthenticated'](),controller[_0xfcc8('0x1c')]);module[_0xfcc8('0x1d')]=router; \ No newline at end of file +var _0x2167=['isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','put','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get'];(function(_0x2ed6ca,_0x5b5967){var _0x4ddeab=function(_0x3cdad9){while(--_0x3cdad9){_0x2ed6ca['push'](_0x2ed6ca['shift']());}};_0x4ddeab(++_0x5b5967);}(_0x2167,0x66));var _0x7216=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x2167[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0x7216('0x0'));var util=require(_0x7216('0x1'));var path=require('path');var timeout=require(_0x7216('0x2'));var express=require(_0x7216('0x3'));var router=express[_0x7216('0x4')]();var fs_extra=require(_0x7216('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7216('0x6'));var config=require(_0x7216('0x7'));var controller=require(_0x7216('0x8'));router[_0x7216('0x9')]('/',auth[_0x7216('0xa')](),controller[_0x7216('0xb')]);router[_0x7216('0x9')](_0x7216('0xc'),auth[_0x7216('0xa')](),controller[_0x7216('0xd')]);router[_0x7216('0x9')](_0x7216('0xe'),auth[_0x7216('0xa')](),controller[_0x7216('0xf')]);router[_0x7216('0x9')](_0x7216('0x10'),auth[_0x7216('0xa')](),controller[_0x7216('0x11')]);router[_0x7216('0x9')](_0x7216('0x12'),auth[_0x7216('0xa')](),controller['getTeams']);router[_0x7216('0x9')](_0x7216('0x13'),auth[_0x7216('0xa')](),controller[_0x7216('0x14')]);router[_0x7216('0x15')]('/',auth[_0x7216('0xa')](),controller['create']);router[_0x7216('0x15')](_0x7216('0x12'),auth['isAuthenticated'](),controller[_0x7216('0x16')]);router[_0x7216('0x15')](_0x7216('0x13'),auth[_0x7216('0xa')](),controller['addAgents']);router[_0x7216('0x17')](_0x7216('0xe'),auth[_0x7216('0xa')](),controller['update']);router[_0x7216('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7216('0x18')](_0x7216('0x12'),auth['isAuthenticated'](),controller[_0x7216('0x19')]);router[_0x7216('0x18')](_0x7216('0x13'),auth[_0x7216('0xa')](),controller[_0x7216('0x1a')]);module[_0x7216('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 82b800a..81cb65c 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 _0x0f8f=['sequelize','STRING','INTEGER','rrmemory','beepall'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x0f8f,0x195));var _0xf0f8=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0x0f8f[_0x4884a7];return _0x56b60e;};'use strict';var Sequelize=require(_0xf0f8('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0f8('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf0f8('0x1')]},'timeout':{'type':Sequelize[_0xf0f8('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf0f8('0x3'),_0xf0f8('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x9ffc=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x1da154,_0xc9a712){var _0xa63061=function(_0x592b6b){while(--_0x592b6b){_0x1da154['push'](_0x1da154['shift']());}};_0xa63061(++_0xc9a712);}(_0x9ffc,0xaf));var _0xc9ff=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x9ffc[_0x4733d3];return _0x1b9a44;};'use strict';var Sequelize=require(_0xc9ff('0x0'));module[_0xc9ff('0x1')]={'name':{'type':Sequelize[_0xc9ff('0x2')],'unique':_0xc9ff('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc9ff('0x2')]},'timeout':{'type':Sequelize[_0xc9ff('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc9ff('0x5')]('rrmemory',_0xc9ff('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index fac8f36..202610a 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 _0x613f=['count','set','Content-Range','apply','reject','save','update','then','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','includeAll','findAll','show','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','params','destroy','describe','findOne','UserMailQueue','length','MailQueueId','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','Agents','online','voicePause','interface','flatMap','addTeams','findOrCreate','forEach','emit','removeTeams','ids','User','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit'];(function(_0xb96a9b,_0x1c0e4f){var _0x4da4d4=function(_0x557a59){while(--_0x557a59){_0xb96a9b['push'](_0xb96a9b['shift']());}};_0x4da4d4(++_0x1c0e4f);}(_0x613f,0x6d));var _0xf613=function(_0x296b1b,_0x4e097f){_0x296b1b=_0x296b1b-0x0;var _0x1f09a7=_0x613f[_0x296b1b];return _0x1f09a7;};'use strict';var emlformat=require(_0xf613('0x0'));var rimraf=require(_0xf613('0x1'));var zipdir=require(_0xf613('0x2'));var jsonpatch=require(_0xf613('0x3'));var rp=require(_0xf613('0x4'));var moment=require(_0xf613('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf613('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf613('0x7'));var csv=require(_0xf613('0x8'));var ejs=require(_0xf613('0x9'));var fs=require('fs');var fs_extra=require(_0xf613('0xa'));var _=require(_0xf613('0xb'));var squel=require(_0xf613('0xc'));var crypto=require(_0xf613('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf613('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf613('0xf'));var Papa=require('papaparse');var Redis=require(_0xf613('0x10'));var authService=require(_0xf613('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf613('0x12'));var hardwareService=require(_0xf613('0x13'));var logger=require(_0xf613('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf613('0x15'));var db=require(_0xf613('0x16'))['db'];config[_0xf613('0x17')]=_[_0xf613('0x18')](config[_0xf613('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xf613('0x19'))(new Redis(config[_0xf613('0x17')]));require(_0xf613('0x1a'))[_0xf613('0x1b')](socket);function respondWithStatusCode(_0x509303,_0x86fab7){_0x86fab7=_0x86fab7||0xcc;return function(_0x34f79f){if(_0x34f79f){return _0x509303['sendStatus'](_0x86fab7);}return _0x509303[_0xf613('0x1c')](_0x86fab7)[_0xf613('0x1d')]();};}function respondWithResult(_0x3ede1a,_0x3e528c){_0x3e528c=_0x3e528c||0xc8;return function(_0x3cb0b6){if(_0x3cb0b6){return _0x3ede1a[_0xf613('0x1c')](_0x3e528c)[_0xf613('0x1e')](_0x3cb0b6);}};}function respondWithFilteredResult(_0xb188,_0x2b465a){return function(_0x1018b3){if(_0x1018b3){var _0x4c01c2=typeof _0x2b465a[_0xf613('0x1f')]===_0xf613('0x20')&&typeof _0x2b465a[_0xf613('0x21')]===_0xf613('0x20');var _0xd366ac=_0x1018b3[_0xf613('0x22')];var _0x4c9fef=_0x4c01c2?0x0:_0x2b465a['offset'];var _0x1ac91b=_0x4c01c2?_0x1018b3['count']:_0x2b465a[_0xf613('0x1f')]+_0x2b465a['limit'];var _0x58c2af;if(_0x1ac91b>=_0xd366ac){_0x1ac91b=_0xd366ac;_0x58c2af=0xc8;}else{_0x58c2af=0xce;}_0xb188['status'](_0x58c2af);return _0xb188[_0xf613('0x23')](_0xf613('0x24'),_0x4c9fef+'-'+_0x1ac91b+'/'+_0xd366ac)['json'](_0x1018b3);}return null;};}function patchUpdates(_0x1b2d55){return function(_0x224577){try{jsonpatch[_0xf613('0x25')](_0x224577,_0x1b2d55,!![]);}catch(_0x24a460){return BPromise[_0xf613('0x26')](_0x24a460);}return _0x224577[_0xf613('0x27')]();};}function saveUpdates(_0x3289cc,_0x2f82b6){return function(_0x40d64c){if(_0x40d64c){return _0x40d64c[_0xf613('0x28')](_0x3289cc)[_0xf613('0x29')](function(_0xea3914){return _0xea3914;});}return null;};}function removeEntity(_0x2986bc,_0x17f963){return function(_0x5156b2){if(_0x5156b2){return _0x5156b2['destroy']()['then'](function(){var _0x1d4af5=_0x5156b2[_0xf613('0x2a')]({'plain':!![]});var _0x5dd3c9=_0xf613('0x2b');return db[_0xf613('0x2c')]['destroy']({'where':{'type':_0x5dd3c9,'resourceId':_0x1d4af5['id']}})['then'](function(){return _0x5156b2;});})[_0xf613('0x29')](function(){_0x2986bc[_0xf613('0x1c')](0xcc)[_0xf613('0x1d')]();});}};}function handleEntityNotFound(_0xbe54a5,_0x16f977){return function(_0x56c1c4){if(!_0x56c1c4){_0xbe54a5[_0xf613('0x2d')](0x194);}return _0x56c1c4;};}function handleError(_0x486fe2,_0x3d0ef8){_0x3d0ef8=_0x3d0ef8||0x1f4;return function(_0xf301fd){logger[_0xf613('0x2e')](_0xf301fd[_0xf613('0x2f')]);if(_0xf301fd[_0xf613('0x30')]){delete _0xf301fd[_0xf613('0x30')];}_0x486fe2[_0xf613('0x1c')](_0x3d0ef8)[_0xf613('0x31')](_0xf301fd);};}exports[_0xf613('0x32')]=function(_0x38f916,_0x1a8348){var _0x4fa854={},_0x455a0f={},_0x8f4de6={'count':0x0,'rows':[]};var _0x1e3653=_['map'](db[_0xf613('0x33')][_0xf613('0x34')],function(_0x3293b5){return{'name':_0x3293b5[_0xf613('0x35')],'type':_0x3293b5['type'][_0xf613('0x36')]};});_0x455a0f[_0xf613('0x37')]=_['map'](_0x1e3653,'name');_0x455a0f[_0xf613('0x38')]=_[_0xf613('0x39')](_0x38f916[_0xf613('0x38')]);_0x455a0f['filters']=_[_0xf613('0x3a')](_0x455a0f[_0xf613('0x37')],_0x455a0f[_0xf613('0x38')]);_0x4fa854[_0xf613('0x3b')]=_[_0xf613('0x3a')](_0x455a0f[_0xf613('0x37')],qs[_0xf613('0x3c')](_0x38f916[_0xf613('0x38')]['fields']));_0x4fa854[_0xf613('0x3b')]=_0x4fa854['attributes']['length']?_0x4fa854['attributes']:_0x455a0f[_0xf613('0x37')];if(!_0x38f916[_0xf613('0x38')][_0xf613('0x3d')](_0xf613('0x3e'))){_0x4fa854[_0xf613('0x21')]=qs[_0xf613('0x21')](_0x38f916[_0xf613('0x38')][_0xf613('0x21')]);_0x4fa854[_0xf613('0x1f')]=qs[_0xf613('0x1f')](_0x38f916[_0xf613('0x38')][_0xf613('0x1f')]);}_0x4fa854[_0xf613('0x3f')]=qs[_0xf613('0x40')](_0x38f916[_0xf613('0x38')][_0xf613('0x40')]);_0x4fa854[_0xf613('0x41')]=qs[_0xf613('0x42')](_[_0xf613('0x43')](_0x38f916['query'],_0x455a0f[_0xf613('0x42')]),_0x1e3653);if(_0x38f916[_0xf613('0x38')][_0xf613('0x44')]){_0x4fa854['where']=_['merge'](_0x4fa854['where'],{'$or':_[_0xf613('0x45')](_0x1e3653,function(_0x2a97ab){if(_0x2a97ab['type']!==_0xf613('0x46')){var _0x56ad47={};_0x56ad47[_0x2a97ab[_0xf613('0x30')]]={'$like':'%'+_0x38f916[_0xf613('0x38')]['filter']+'%'};return _0x56ad47;}})});}_0x4fa854=_[_0xf613('0x47')]({},_0x4fa854,_0x38f916['options']);var _0x59842f={'where':_0x4fa854['where']};return db[_0xf613('0x33')][_0xf613('0x22')](_0x59842f)[_0xf613('0x29')](function(_0x2f3820){_0x8f4de6[_0xf613('0x22')]=_0x2f3820;if(_0x38f916[_0xf613('0x38')][_0xf613('0x48')]){_0x4fa854['include']=[{'all':!![]}];}return db[_0xf613('0x33')][_0xf613('0x49')](_0x4fa854);})[_0xf613('0x29')](function(_0x9e56ff){_0x8f4de6['rows']=_0x9e56ff;return _0x8f4de6;})[_0xf613('0x29')](respondWithFilteredResult(_0x1a8348,_0x4fa854))['catch'](handleError(_0x1a8348,null));};exports[_0xf613('0x4a')]=function(_0x42f2ac,_0x3a3ef0){var _0x45e9b2={'raw':!![],'where':{'id':_0x42f2ac['params']['id']}},_0x53b30d={};_0x53b30d[_0xf613('0x37')]=_[_0xf613('0x39')](db[_0xf613('0x33')]['rawAttributes']);_0x53b30d[_0xf613('0x38')]=_[_0xf613('0x39')](_0x42f2ac[_0xf613('0x38')]);_0x53b30d[_0xf613('0x42')]=_[_0xf613('0x3a')](_0x53b30d[_0xf613('0x37')],_0x53b30d[_0xf613('0x38')]);_0x45e9b2[_0xf613('0x3b')]=_[_0xf613('0x3a')](_0x53b30d['model'],qs[_0xf613('0x3c')](_0x42f2ac[_0xf613('0x38')][_0xf613('0x3c')]));_0x45e9b2['attributes']=_0x45e9b2[_0xf613('0x3b')]['length']?_0x45e9b2[_0xf613('0x3b')]:_0x53b30d[_0xf613('0x37')];if(_0x42f2ac[_0xf613('0x38')][_0xf613('0x48')]){_0x45e9b2[_0xf613('0x4b')]=[{'all':!![]}];}_0x45e9b2=_[_0xf613('0x47')]({},_0x45e9b2,_0x42f2ac[_0xf613('0x4c')]);return db[_0xf613('0x33')][_0xf613('0x4d')](_0x45e9b2)['then'](handleEntityNotFound(_0x3a3ef0,null))[_0xf613('0x29')](respondWithResult(_0x3a3ef0,null))[_0xf613('0x4e')](handleError(_0x3a3ef0,null));};exports[_0xf613('0x4f')]=function(_0x32d79a,_0x5ec123){return db[_0xf613('0x33')]['create'](_0x32d79a[_0xf613('0x50')],{})['then'](function(_0x25c060){var _0x5f5748=_0x32d79a[_0xf613('0x51')][_0xf613('0x2a')]({'plain':!![]});if(!_0x5f5748)throw new Error(_0xf613('0x52'));if(_0x5f5748['role']==='user'){var _0x4ebb8f=_0x25c060['get']({'plain':!![]});var _0x473b3d='MailQueues';return db[_0xf613('0x53')][_0xf613('0x4d')]({'where':{'name':_0x473b3d,'userProfileId':_0x5f5748[_0xf613('0x54')]},'raw':!![]})['then'](function(_0x48eb54){if(_0x48eb54&&_0x48eb54['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4ebb8f['name'],'resourceId':_0x4ebb8f['id'],'type':_0x48eb54[_0xf613('0x30')],'sectionId':_0x48eb54['id']},{})[_0xf613('0x29')](function(){return _0x25c060;});}else{return _0x25c060;}})[_0xf613('0x4e')](function(_0x5e810b){logger[_0xf613('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e810b);throw _0x5e810b;});}return _0x25c060;})['then'](respondWithResult(_0x5ec123,0xc9))[_0xf613('0x4e')](handleError(_0x5ec123,null));};exports[_0xf613('0x28')]=function(_0x28e80a,_0x56996e){if(_0x28e80a[_0xf613('0x50')]['id']){delete _0x28e80a[_0xf613('0x50')]['id'];}return db['MailQueue'][_0xf613('0x4d')]({'where':{'id':_0x28e80a[_0xf613('0x55')]['id']}})['then'](handleEntityNotFound(_0x56996e,null))[_0xf613('0x29')](saveUpdates(_0x28e80a[_0xf613('0x50')],null))[_0xf613('0x29')](respondWithResult(_0x56996e,null))[_0xf613('0x4e')](handleError(_0x56996e,null));};exports[_0xf613('0x56')]=function(_0x1f8a3c,_0xca2e64){return db['MailQueue']['find']({'where':{'id':_0x1f8a3c[_0xf613('0x55')]['id']}})[_0xf613('0x29')](handleEntityNotFound(_0xca2e64,null))[_0xf613('0x29')](removeEntity(_0xca2e64,null))[_0xf613('0x4e')](handleError(_0xca2e64,null));};exports[_0xf613('0x57')]=function(_0x1867f5,_0x3fec2a){return db[_0xf613('0x33')][_0xf613('0x57')]()['then'](respondWithResult(_0x3fec2a,null))[_0xf613('0x4e')](handleError(_0x3fec2a,null));};exports['getMembers']=function(_0x6a98bf,_0x54ac02,_0x5263cd){var _0x45ed38={'raw':!![],'where':{}},_0x416ca8={},_0x244cd5;return db['MailQueue'][_0xf613('0x58')]({'where':{'id':_0x6a98bf[_0xf613('0x55')]['id']}})[_0xf613('0x29')](handleEntityNotFound(_0x54ac02,null))[_0xf613('0x29')](function(_0x34b7a9){if(_0x34b7a9){_0x244cd5=_0x34b7a9[_0xf613('0x2a')]({'plain':!![]});_0x416ca8[_0xf613('0x37')]=_[_0xf613('0x39')](db[_0xf613('0x59')][_0xf613('0x34')]);_0x416ca8['query']=_[_0xf613('0x39')](_0x6a98bf['query']);_0x416ca8[_0xf613('0x42')]=_['intersection'](_0x416ca8[_0xf613('0x37')],_0x416ca8['query']);_0x45ed38[_0xf613('0x3b')]=_[_0xf613('0x3a')](_0x416ca8['model'],qs[_0xf613('0x3c')](_0x6a98bf['query'][_0xf613('0x3c')]));_0x45ed38[_0xf613('0x3b')]=_0x45ed38[_0xf613('0x3b')][_0xf613('0x5a')]?_0x45ed38['attributes']:_0x416ca8[_0xf613('0x37')];if(!_0x6a98bf[_0xf613('0x38')][_0xf613('0x3d')]('nolimit')){_0x45ed38[_0xf613('0x21')]=qs[_0xf613('0x21')](_0x6a98bf[_0xf613('0x38')]['limit']);_0x45ed38[_0xf613('0x1f')]=qs[_0xf613('0x1f')](_0x6a98bf[_0xf613('0x38')][_0xf613('0x1f')]);}_0x45ed38[_0xf613('0x3f')]=qs['sort'](_0x6a98bf[_0xf613('0x38')]['sort']);_0x45ed38['where']=qs[_0xf613('0x42')](_['pick'](_0x6a98bf[_0xf613('0x38')],_0x416ca8[_0xf613('0x42')]));_0x45ed38[_0xf613('0x41')][_0xf613('0x5b')]=_0x34b7a9['id'];if(_0x6a98bf[_0xf613('0x38')]['filter']){_0x45ed38[_0xf613('0x41')]=_[_0xf613('0x47')](_0x45ed38[_0xf613('0x41')],{'$or':_[_0xf613('0x45')](_0x45ed38['attributes'],function(_0x51ba26){var _0x5088ea={};_0x5088ea[_0x51ba26]={'$like':'%'+_0x6a98bf[_0xf613('0x38')][_0xf613('0x44')]+'%'};return _0x5088ea;})});}_0x45ed38=_[_0xf613('0x47')]({},_0x45ed38,_0x6a98bf[_0xf613('0x4c')]);return db[_0xf613('0x59')]['findAll'](_0x45ed38);}})[_0xf613('0x29')](function(_0x2e7686){if(_0x2e7686){return db['User'][_0xf613('0x5c')]({'where':{'id':_[_0xf613('0x45')](_0x2e7686,_0xf613('0x5d')),'role':_0xf613('0x5e')},'attributes':['id',_0xf613('0x30'),_0xf613('0x5f'),_0xf613('0x60'),_0xf613('0x61')]});}})[_0xf613('0x29')](function(_0x14f9d6){if(_0x14f9d6){return{'count':_0x14f9d6[_0xf613('0x22')],'rows':_[_0xf613('0x45')](_0x14f9d6[_0xf613('0x62')],function(_0x36a27b){return{'membername':_0x36a27b[_0xf613('0x30')],'UserId':_0x36a27b['id'],'queue_name':_0x244cd5['name'],'MailQueueId':_0x244cd5['id'],'interface':util[_0xf613('0x63')]('%s/%s',_0xf613('0x64'),_0x36a27b[_0xf613('0x30')]),'penalty':0x0,'paused':_0x36a27b[_0xf613('0x5f')],'createdAt':_0x36a27b[_0xf613('0x61')],'updatedAt':_0x36a27b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf613('0x29')](respondWithFilteredResult(_0x54ac02,_0x45ed38))['catch'](handleError(_0x54ac02,null));};exports[_0xf613('0x65')]=function(_0x116724,_0x140924,_0x2619d9){var _0x3bc2ed={};var _0x37257a={};var _0x302125;var _0x26cc80;return db['MailQueue'][_0xf613('0x58')]({'where':{'id':_0x116724['params']['id']}})[_0xf613('0x29')](handleEntityNotFound(_0x140924,null))[_0xf613('0x29')](function(_0x2a7a26){if(_0x2a7a26){_0x302125=_0x2a7a26;_0x37257a[_0xf613('0x37')]=_[_0xf613('0x39')](db[_0xf613('0x66')][_0xf613('0x34')]);_0x37257a[_0xf613('0x38')]=_[_0xf613('0x39')](_0x116724[_0xf613('0x38')]);_0x37257a[_0xf613('0x42')]=_['intersection'](_0x37257a[_0xf613('0x37')],_0x37257a[_0xf613('0x38')]);_0x3bc2ed[_0xf613('0x3b')]=_['intersection'](_0x37257a[_0xf613('0x37')],qs[_0xf613('0x3c')](_0x116724['query']['fields']));_0x3bc2ed[_0xf613('0x3b')]=_0x3bc2ed[_0xf613('0x3b')][_0xf613('0x5a')]?_0x3bc2ed[_0xf613('0x3b')]:_0x37257a[_0xf613('0x37')];_0x3bc2ed[_0xf613('0x3f')]=qs[_0xf613('0x40')](_0x116724['query']['sort']);_0x3bc2ed['where']=qs[_0xf613('0x42')](_[_0xf613('0x43')](_0x116724[_0xf613('0x38')],_0x37257a[_0xf613('0x42')]));if(_0x116724['query'][_0xf613('0x44')]){_0x3bc2ed[_0xf613('0x41')]=_[_0xf613('0x47')](_0x3bc2ed[_0xf613('0x41')],{'$or':_[_0xf613('0x45')](_0x3bc2ed['attributes'],function(_0x422b2f){var _0x51de1a={};_0x51de1a[_0x422b2f]={'$like':'%'+_0x116724['query'][_0xf613('0x44')]+'%'};return _0x51de1a;})});}_0x3bc2ed=_[_0xf613('0x47')]({},_0x3bc2ed,_0x116724['options']);return _0x302125[_0xf613('0x65')](_0x3bc2ed);}})[_0xf613('0x29')](function(_0x441dbb){if(_0x441dbb){_0x26cc80=_0x441dbb['length'];if(!_0x116724[_0xf613('0x38')][_0xf613('0x3d')](_0xf613('0x3e'))){_0x3bc2ed['limit']=qs['limit'](_0x116724[_0xf613('0x38')][_0xf613('0x21')]);_0x3bc2ed[_0xf613('0x1f')]=qs[_0xf613('0x1f')](_0x116724[_0xf613('0x38')][_0xf613('0x1f')]);}return _0x302125[_0xf613('0x65')](_0x3bc2ed);}})[_0xf613('0x29')](function(_0x705b86){if(_0x705b86){return _0x705b86?{'count':_0x26cc80,'rows':_0x705b86}:null;}})[_0xf613('0x29')](respondWithResult(_0x140924,null))['catch'](handleError(_0x140924,null));};exports['addTeams']=function(_0x43814a,_0x21ac7d,_0x44a749){var _0x252cdf=_0x43814a['body']['ids'];return db[_0xf613('0x66')][_0xf613('0x49')]({'where':{'id':_0x252cdf},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf613('0x67'),'attributes':['id',_0xf613('0x30'),_0xf613('0x68'),_0xf613('0x69'),_0xf613('0x6a')],'raw':!![]}]})[_0xf613('0x29')](function(_0x2b453d){if(_0x2b453d){var _0x2b1534=_[_0xf613('0x6b')](_0x2b453d,function(_0x56f0af){var _0x4bd5f8=_0x56f0af[_0xf613('0x2a')]({'plain':!![]});return _0x4bd5f8[_0xf613('0x67')];});return db[_0xf613('0x33')][_0xf613('0x4d')]({'where':{'id':_0x43814a[_0xf613('0x55')]['id']}})[_0xf613('0x29')](function(_0x4be382){return db['sequelize']['transaction'](function(_0x157460){return _0x4be382[_0xf613('0x6c')](_0x252cdf,{'transaction':_0x157460})[_0xf613('0x29')](function(){return BPromise['each'](_0x2b1534,function(_0x5a6dae){return db[_0xf613('0x59')][_0xf613('0x6d')]({'where':{'UserId':_0x5a6dae['id'],'MailQueueId':_0x43814a[_0xf613('0x55')]['id']},'transaction':_0x157460});});})[_0xf613('0x29')](function(){_0x2b1534[_0xf613('0x6e')](function(_0x520f2d){socket[_0xf613('0x6f')]('userMailQueue:save',{'UserId':_0x520f2d['id'],'MailQueueId':_0x4be382['id']});});});});});}})[_0xf613('0x29')](respondWithStatusCode(_0x21ac7d,null))[_0xf613('0x4e')](handleError(_0x21ac7d,null));};exports[_0xf613('0x70')]=function(_0x1c9ab4,_0x59402e,_0x15db9e){return db[_0xf613('0x66')][_0xf613('0x49')]({'where':{'id':_0x1c9ab4[_0xf613('0x38')][_0xf613('0x71')]},'attributes':['id'],'include':[{'model':db[_0xf613('0x72')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x59402e,null))['then'](function(_0x50fe3e){var _0x4c7d80=_[_0xf613('0x45')](_0x50fe3e,'id');var _0x7cfce4=[];var _0x5ce25f=[];var _0x5e7dd2=squel['select']();_0x5e7dd2[_0xf613('0x73')](_0xf613('0x74'))['from'](_0xf613('0x75'),'tq')[_0xf613('0x76')](_0xf613('0x77'),'ut',_0xf613('0x78'))[_0xf613('0x41')](_0xf613('0x79'),_0x1c9ab4[_0xf613('0x55')]['id']);for(var _0x37a1aa=0x0;_0x37a1aa<_0x50fe3e[_0xf613('0x5a')];_0x37a1aa+=0x1){let _0xbbb711=_0x50fe3e[_0x37a1aa];for(var _0x52108b=0x0;_0x52108b<_0xbbb711[_0xf613('0x67')][_0xf613('0x5a')];_0x52108b+=0x1){let _0x47f0fd=_0xbbb711[_0xf613('0x67')][_0x52108b];var _0x45c2cb=_0x5e7dd2[_0xf613('0x7a')]();_0x45c2cb[_0xf613('0x41')](_0xf613('0x7b'),_0x47f0fd['id']);_0x5ce25f[_0xf613('0x7c')](db[_0xf613('0x7d')]['query'](_0x45c2cb['toString'](),{'type':db[_0xf613('0x7d')][_0xf613('0x7e')][_0xf613('0x7f')]})[_0xf613('0x29')](function(_0x517ba1){if(_0x517ba1['length']===0x1){return _0x47f0fd['id'];}else{var _0x3ea547=_[_0xf613('0x80')](_['map'](_0x517ba1,_0xf613('0x81')),function(_0x32b074){return _['includes'](_0x4c7d80,_0x32b074);});if(_0x3ea547){return _0x47f0fd['id'];}}}));}}return BPromise[_0xf613('0x82')](_0x5ce25f)[_0xf613('0x29')](function(_0x2c75aa){_0x7cfce4=_(_0x7cfce4)[_0xf613('0x83')](_0x2c75aa)[_0xf613('0x84')]()[_0xf613('0x85')]();return db[_0xf613('0x33')][_0xf613('0x4d')]({'where':{'id':_0x1c9ab4[_0xf613('0x55')]['id']}})[_0xf613('0x29')](function(_0x2f4ba2){return db[_0xf613('0x7d')]['transaction'](function(_0x350b4f){return _0x2f4ba2[_0xf613('0x70')](_0x1c9ab4[_0xf613('0x38')][_0xf613('0x71')],{'transaction':_0x350b4f})['then'](function(){if(!_[_0xf613('0x86')](_0x7cfce4)){return _0x2f4ba2[_0xf613('0x87')](_0x7cfce4,{'transaction':_0x350b4f});}})['then'](function(){_0x7cfce4[_0xf613('0x6e')](function(_0x462d45){socket[_0xf613('0x6f')](_0xf613('0x88'),{'UserId':_0x462d45,'MailQueueId':_0x2f4ba2['id']});});});});});});})[_0xf613('0x29')](respondWithStatusCode(_0x59402e,null))['catch'](handleError(_0x59402e,null));};exports[_0xf613('0x89')]=function(_0x5a8b7e,_0x1aba81,_0x4d7853){return db['MailQueue'][_0xf613('0x4d')]({'where':{'id':_0x5a8b7e['params']['id']}})[_0xf613('0x29')](handleEntityNotFound(_0x1aba81,null))[_0xf613('0x29')](function(_0x4d01fc){if(_0x4d01fc){return _0x4d01fc[_0xf613('0x89')](_0x5a8b7e[_0xf613('0x50')][_0xf613('0x71')],_[_0xf613('0x8a')](_0x5a8b7e['body'],['ids','id'])||{})[_0xf613('0x8b')](function(_0x30dd55){for(var _0x3cc38a=0x0;_0x3cc38a<_0x5a8b7e['body'][_0xf613('0x71')][_0xf613('0x5a')];_0x3cc38a+=0x1){socket[_0xf613('0x6f')](_0xf613('0x8c'),{'UserId':Number(_0x5a8b7e[_0xf613('0x50')][_0xf613('0x71')][_0x3cc38a]),'MailQueueId':Number(_0x5a8b7e[_0xf613('0x55')]['id'])});}return _0x30dd55;});}})[_0xf613('0x29')](respondWithResult(_0x1aba81,null))[_0xf613('0x4e')](handleError(_0x1aba81,null));};exports[_0xf613('0x87')]=function(_0x22916a,_0xaa9ed0,_0x21c5ea){return db[_0xf613('0x33')][_0xf613('0x4d')]({'where':{'id':_0x22916a[_0xf613('0x55')]['id']}})[_0xf613('0x29')](handleEntityNotFound(_0xaa9ed0,null))['then'](function(_0x35bfb6){if(_0x35bfb6){return _0x35bfb6['removeAgents'](_0x22916a[_0xf613('0x38')]['ids'])[_0xf613('0x29')](function(){if(_[_0xf613('0x8d')](_0x22916a[_0xf613('0x38')]['ids'])){for(var _0x5a964a=0x0;_0x5a964a<_0x22916a[_0xf613('0x38')][_0xf613('0x71')][_0xf613('0x5a')];_0x5a964a+=0x1){socket[_0xf613('0x6f')]('userMailQueue:remove',{'UserId':Number(_0x22916a[_0xf613('0x38')]['ids'][_0x5a964a]),'MailQueueId':Number(_0x22916a[_0xf613('0x55')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x22916a[_0xf613('0x38')]['ids']),'MailQueueId':Number(_0x22916a['params']['id'])});}});}})[_0xf613('0x29')](respondWithStatusCode(_0xaa9ed0,null))[_0xf613('0x4e')](handleError(_0xaa9ed0,null));};exports[_0xf613('0x8e')]=function(_0x2062bb,_0x430241,_0x2f96dc){var _0x4d052b={};var _0x1c07c8={};var _0x591f6a;var _0x279b3c;return db[_0xf613('0x33')][_0xf613('0x58')]({'where':{'id':_0x2062bb[_0xf613('0x55')]['id']}})[_0xf613('0x29')](handleEntityNotFound(_0x430241,null))[_0xf613('0x29')](function(_0x20fd86){if(_0x20fd86){_0x591f6a=_0x20fd86;_0x1c07c8[_0xf613('0x37')]=_[_0xf613('0x39')](db[_0xf613('0x72')][_0xf613('0x34')]);_0x1c07c8['query']=_[_0xf613('0x39')](_0x2062bb[_0xf613('0x38')]);_0x1c07c8[_0xf613('0x42')]=_[_0xf613('0x3a')](_0x1c07c8[_0xf613('0x37')],_0x1c07c8['query']);_0x4d052b[_0xf613('0x3b')]=_[_0xf613('0x3a')](_0x1c07c8[_0xf613('0x37')],qs[_0xf613('0x3c')](_0x2062bb[_0xf613('0x38')]['fields']));_0x4d052b[_0xf613('0x3b')]=_0x4d052b[_0xf613('0x3b')][_0xf613('0x5a')]?_0x4d052b['attributes']:_0x1c07c8[_0xf613('0x37')];_0x4d052b[_0xf613('0x3f')]=qs[_0xf613('0x40')](_0x2062bb[_0xf613('0x38')][_0xf613('0x40')]);_0x4d052b['where']=qs['filters'](_['pick'](_0x2062bb[_0xf613('0x38')],_0x1c07c8[_0xf613('0x42')]));if(_0x2062bb[_0xf613('0x38')][_0xf613('0x44')]){_0x4d052b[_0xf613('0x41')]=_['merge'](_0x4d052b[_0xf613('0x41')],{'$or':_[_0xf613('0x45')](_0x4d052b[_0xf613('0x3b')],function(_0x2024c8){var _0x3f5dcb={};_0x3f5dcb[_0x2024c8]={'$like':'%'+_0x2062bb['query'][_0xf613('0x44')]+'%'};return _0x3f5dcb;})});}_0x4d052b=_[_0xf613('0x47')]({},_0x4d052b,_0x2062bb[_0xf613('0x4c')]);return _0x591f6a[_0xf613('0x8e')](_0x4d052b);}})[_0xf613('0x29')](function(_0x1e1de4){if(_0x1e1de4){_0x279b3c=_0x1e1de4[_0xf613('0x5a')];if(!_0x2062bb[_0xf613('0x38')][_0xf613('0x3d')]('nolimit')){_0x4d052b['limit']=qs['limit'](_0x2062bb['query'][_0xf613('0x21')]);_0x4d052b[_0xf613('0x1f')]=qs[_0xf613('0x1f')](_0x2062bb['query'][_0xf613('0x1f')]);}return _0x591f6a['getAgents'](_0x4d052b);}})['then'](function(_0x57ec76){if(_0x57ec76){return _0x57ec76?{'count':_0x279b3c,'rows':_0x57ec76}:null;}})[_0xf613('0x29')](respondWithResult(_0x430241,null))['catch'](handleError(_0x430241,null));}; \ No newline at end of file +var _0x552c=['catch','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','body','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','Agents','online','voicePause','interface','sequelize','addTeams','each','findOrCreate','forEach','field','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','removeAgents','addAgents','spread','emit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','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','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x25f3b1,_0x772a11){var _0x9c05eb=function(_0x345f45){while(--_0x345f45){_0x25f3b1['push'](_0x25f3b1['shift']());}};_0x9c05eb(++_0x772a11);}(_0x552c,0xd2));var _0xc552=function(_0x4789e5,_0x2d7e4d){_0x4789e5=_0x4789e5-0x0;var _0x4f2bac=_0x552c[_0x4789e5];return _0x4f2bac;};'use strict';var emlformat=require(_0xc552('0x0'));var rimraf=require(_0xc552('0x1'));var zipdir=require(_0xc552('0x2'));var jsonpatch=require(_0xc552('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc552('0x4'));var Mustache=require('mustache');var util=require(_0xc552('0x5'));var path=require(_0xc552('0x6'));var sox=require(_0xc552('0x7'));var csv=require(_0xc552('0x8'));var ejs=require(_0xc552('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc552('0xa'));var squel=require(_0xc552('0xb'));var crypto=require(_0xc552('0xc'));var jsforce=require(_0xc552('0xd'));var deskjs=require(_0xc552('0xe'));var toCsv=require(_0xc552('0x8'));var querystring=require(_0xc552('0xf'));var Papa=require(_0xc552('0x10'));var Redis=require(_0xc552('0x11'));var authService=require(_0xc552('0x12'));var qs=require(_0xc552('0x13'));var as=require(_0xc552('0x14'));var hardwareService=require(_0xc552('0x15'));var logger=require(_0xc552('0x16'))(_0xc552('0x17'));var utils=require(_0xc552('0x18'));var config=require(_0xc552('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc552('0x1a'))['db'];config[_0xc552('0x1b')]=_['defaults'](config['redis'],{'host':_0xc552('0x1c'),'port':0x18eb});var socket=require(_0xc552('0x1d'))(new Redis(config[_0xc552('0x1b')]));require(_0xc552('0x1e'))[_0xc552('0x1f')](socket);function respondWithStatusCode(_0x3ed718,_0x12865c){_0x12865c=_0x12865c||0xcc;return function(_0x13f781){if(_0x13f781){return _0x3ed718[_0xc552('0x20')](_0x12865c);}return _0x3ed718[_0xc552('0x21')](_0x12865c)[_0xc552('0x22')]();};}function respondWithResult(_0x221875,_0x8eeeb6){_0x8eeeb6=_0x8eeeb6||0xc8;return function(_0x406241){if(_0x406241){return _0x221875[_0xc552('0x21')](_0x8eeeb6)[_0xc552('0x23')](_0x406241);}};}function respondWithFilteredResult(_0x510b8a,_0x4efd19){return function(_0x306786){if(_0x306786){var _0x196421=typeof _0x4efd19[_0xc552('0x24')]===_0xc552('0x25')&&typeof _0x4efd19[_0xc552('0x26')]===_0xc552('0x25');var _0x2bae51=_0x306786[_0xc552('0x27')];var _0x48ca12=_0x196421?0x0:_0x4efd19[_0xc552('0x24')];var _0x3e92ba=_0x196421?_0x306786[_0xc552('0x27')]:_0x4efd19[_0xc552('0x24')]+_0x4efd19[_0xc552('0x26')];var _0x2ef405;if(_0x3e92ba>=_0x2bae51){_0x3e92ba=_0x2bae51;_0x2ef405=0xc8;}else{_0x2ef405=0xce;}_0x510b8a[_0xc552('0x21')](_0x2ef405);return _0x510b8a[_0xc552('0x28')](_0xc552('0x29'),_0x48ca12+'-'+_0x3e92ba+'/'+_0x2bae51)[_0xc552('0x23')](_0x306786);}return null;};}function patchUpdates(_0x232214){return function(_0x2feb16){try{jsonpatch[_0xc552('0x2a')](_0x2feb16,_0x232214,!![]);}catch(_0x4174cc){return BPromise[_0xc552('0x2b')](_0x4174cc);}return _0x2feb16[_0xc552('0x2c')]();};}function saveUpdates(_0x41e368,_0x4274f8){return function(_0x48ea33){if(_0x48ea33){return _0x48ea33[_0xc552('0x2d')](_0x41e368)[_0xc552('0x2e')](function(_0x4e0ae7){return _0x4e0ae7;});}return null;};}function removeEntity(_0x3a5b43,_0x26e9eb){return function(_0x1df09a){if(_0x1df09a){return _0x1df09a[_0xc552('0x2f')]()[_0xc552('0x2e')](function(){var _0x46ff1c=_0x1df09a[_0xc552('0x30')]({'plain':!![]});var _0x1f497f=_0xc552('0x31');return db[_0xc552('0x32')][_0xc552('0x2f')]({'where':{'type':_0x1f497f,'resourceId':_0x46ff1c['id']}})[_0xc552('0x2e')](function(){return _0x1df09a;});})[_0xc552('0x2e')](function(){_0x3a5b43[_0xc552('0x21')](0xcc)[_0xc552('0x22')]();});}};}function handleEntityNotFound(_0xc555a7,_0x19a088){return function(_0x23c146){if(!_0x23c146){_0xc555a7[_0xc552('0x20')](0x194);}return _0x23c146;};}function handleError(_0x2f8a1b,_0x57614d){_0x57614d=_0x57614d||0x1f4;return function(_0x3f421f){logger['error'](_0x3f421f[_0xc552('0x33')]);if(_0x3f421f[_0xc552('0x34')]){delete _0x3f421f[_0xc552('0x34')];}_0x2f8a1b[_0xc552('0x21')](_0x57614d)[_0xc552('0x35')](_0x3f421f);};}exports[_0xc552('0x36')]=function(_0x22ba9d,_0x409822){var _0x412749={},_0x13c5c4={},_0x58b7d5={'count':0x0,'rows':[]};var _0x3ca96a=_[_0xc552('0x37')](db[_0xc552('0x38')][_0xc552('0x39')],function(_0x54aacc){return{'name':_0x54aacc[_0xc552('0x3a')],'type':_0x54aacc[_0xc552('0x3b')]['key']};});_0x13c5c4[_0xc552('0x3c')]=_[_0xc552('0x37')](_0x3ca96a,'name');_0x13c5c4[_0xc552('0x3d')]=_['keys'](_0x22ba9d[_0xc552('0x3d')]);_0x13c5c4[_0xc552('0x3e')]=_[_0xc552('0x3f')](_0x13c5c4[_0xc552('0x3c')],_0x13c5c4[_0xc552('0x3d')]);_0x412749[_0xc552('0x40')]=_['intersection'](_0x13c5c4[_0xc552('0x3c')],qs[_0xc552('0x41')](_0x22ba9d['query'][_0xc552('0x41')]));_0x412749[_0xc552('0x40')]=_0x412749[_0xc552('0x40')][_0xc552('0x42')]?_0x412749[_0xc552('0x40')]:_0x13c5c4[_0xc552('0x3c')];if(!_0x22ba9d[_0xc552('0x3d')][_0xc552('0x43')](_0xc552('0x44'))){_0x412749[_0xc552('0x26')]=qs[_0xc552('0x26')](_0x22ba9d['query'][_0xc552('0x26')]);_0x412749[_0xc552('0x24')]=qs[_0xc552('0x24')](_0x22ba9d[_0xc552('0x3d')][_0xc552('0x24')]);}_0x412749[_0xc552('0x45')]=qs[_0xc552('0x46')](_0x22ba9d['query'][_0xc552('0x46')]);_0x412749[_0xc552('0x47')]=qs['filters'](_[_0xc552('0x48')](_0x22ba9d[_0xc552('0x3d')],_0x13c5c4[_0xc552('0x3e')]),_0x3ca96a);if(_0x22ba9d['query'][_0xc552('0x49')]){_0x412749['where']=_[_0xc552('0x4a')](_0x412749[_0xc552('0x47')],{'$or':_[_0xc552('0x37')](_0x3ca96a,function(_0xedd976){if(_0xedd976[_0xc552('0x3b')]!=='VIRTUAL'){var _0x2cd915={};_0x2cd915[_0xedd976[_0xc552('0x34')]]={'$like':'%'+_0x22ba9d[_0xc552('0x3d')][_0xc552('0x49')]+'%'};return _0x2cd915;}})});}_0x412749=_[_0xc552('0x4a')]({},_0x412749,_0x22ba9d[_0xc552('0x4b')]);var _0x5daf37={'where':_0x412749[_0xc552('0x47')]};return db[_0xc552('0x38')][_0xc552('0x27')](_0x5daf37)[_0xc552('0x2e')](function(_0x1c05b4){_0x58b7d5[_0xc552('0x27')]=_0x1c05b4;if(_0x22ba9d[_0xc552('0x3d')][_0xc552('0x4c')]){_0x412749[_0xc552('0x4d')]=[{'all':!![]}];}return db[_0xc552('0x38')][_0xc552('0x4e')](_0x412749);})[_0xc552('0x2e')](function(_0xc20c3f){_0x58b7d5[_0xc552('0x4f')]=_0xc20c3f;return _0x58b7d5;})[_0xc552('0x2e')](respondWithFilteredResult(_0x409822,_0x412749))[_0xc552('0x50')](handleError(_0x409822,null));};exports[_0xc552('0x51')]=function(_0x4dbf24,_0x4af1ca){var _0x4b3ea6={'raw':!![],'where':{'id':_0x4dbf24[_0xc552('0x52')]['id']}},_0x5c4307={};_0x5c4307[_0xc552('0x3c')]=_['keys'](db[_0xc552('0x38')][_0xc552('0x39')]);_0x5c4307['query']=_[_0xc552('0x53')](_0x4dbf24[_0xc552('0x3d')]);_0x5c4307[_0xc552('0x3e')]=_['intersection'](_0x5c4307[_0xc552('0x3c')],_0x5c4307['query']);_0x4b3ea6[_0xc552('0x40')]=_['intersection'](_0x5c4307['model'],qs['fields'](_0x4dbf24['query'][_0xc552('0x41')]));_0x4b3ea6[_0xc552('0x40')]=_0x4b3ea6[_0xc552('0x40')]['length']?_0x4b3ea6[_0xc552('0x40')]:_0x5c4307[_0xc552('0x3c')];if(_0x4dbf24['query'][_0xc552('0x4c')]){_0x4b3ea6[_0xc552('0x4d')]=[{'all':!![]}];}_0x4b3ea6=_[_0xc552('0x4a')]({},_0x4b3ea6,_0x4dbf24[_0xc552('0x4b')]);return db[_0xc552('0x38')]['find'](_0x4b3ea6)[_0xc552('0x2e')](handleEntityNotFound(_0x4af1ca,null))[_0xc552('0x2e')](respondWithResult(_0x4af1ca,null))['catch'](handleError(_0x4af1ca,null));};exports[_0xc552('0x54')]=function(_0x5892f5,_0x1e90a4){return db[_0xc552('0x38')][_0xc552('0x54')](_0x5892f5['body'],{})[_0xc552('0x2e')](function(_0xf24529){var _0x44235f=_0x5892f5[_0xc552('0x55')]['get']({'plain':!![]});if(!_0x44235f)throw new Error(_0xc552('0x56'));if(_0x44235f[_0xc552('0x57')]===_0xc552('0x55')){var _0x1aed6a=_0xf24529[_0xc552('0x30')]({'plain':!![]});var _0x48895f=_0xc552('0x31');return db[_0xc552('0x58')][_0xc552('0x59')]({'where':{'name':_0x48895f,'userProfileId':_0x44235f[_0xc552('0x5a')]},'raw':!![]})['then'](function(_0x84b1a){if(_0x84b1a&&_0x84b1a[_0xc552('0x5b')]===0x0){return db[_0xc552('0x32')][_0xc552('0x54')]({'name':_0x1aed6a[_0xc552('0x34')],'resourceId':_0x1aed6a['id'],'type':_0x84b1a['name'],'sectionId':_0x84b1a['id']},{})[_0xc552('0x2e')](function(){return _0xf24529;});}else{return _0xf24529;}})[_0xc552('0x50')](function(_0x3ca733){logger[_0xc552('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ca733);throw _0x3ca733;});}return _0xf24529;})[_0xc552('0x2e')](respondWithResult(_0x1e90a4,0xc9))['catch'](handleError(_0x1e90a4,null));};exports[_0xc552('0x2d')]=function(_0x24466e,_0x6f4a0d){if(_0x24466e['body']['id']){delete _0x24466e['body']['id'];}return db[_0xc552('0x38')][_0xc552('0x59')]({'where':{'id':_0x24466e['params']['id']}})['then'](handleEntityNotFound(_0x6f4a0d,null))['then'](saveUpdates(_0x24466e[_0xc552('0x5d')],null))[_0xc552('0x2e')](respondWithResult(_0x6f4a0d,null))[_0xc552('0x50')](handleError(_0x6f4a0d,null));};exports['destroy']=function(_0x401ebc,_0x380ce7){return db[_0xc552('0x38')][_0xc552('0x59')]({'where':{'id':_0x401ebc[_0xc552('0x52')]['id']}})[_0xc552('0x2e')](handleEntityNotFound(_0x380ce7,null))['then'](removeEntity(_0x380ce7,null))[_0xc552('0x50')](handleError(_0x380ce7,null));};exports['describe']=function(_0x56e6c6,_0x1b29af){return db[_0xc552('0x38')][_0xc552('0x5e')]()[_0xc552('0x2e')](respondWithResult(_0x1b29af,null))['catch'](handleError(_0x1b29af,null));};exports[_0xc552('0x5f')]=function(_0x1cf8ad,_0x52597c,_0x3455b6){var _0x217690={'raw':!![],'where':{}},_0x4072a3={},_0x48f936;return db['MailQueue'][_0xc552('0x60')]({'where':{'id':_0x1cf8ad[_0xc552('0x52')]['id']}})['then'](handleEntityNotFound(_0x52597c,null))[_0xc552('0x2e')](function(_0x28ecdc){if(_0x28ecdc){_0x48f936=_0x28ecdc[_0xc552('0x30')]({'plain':!![]});_0x4072a3[_0xc552('0x3c')]=_[_0xc552('0x53')](db[_0xc552('0x61')][_0xc552('0x39')]);_0x4072a3[_0xc552('0x3d')]=_['keys'](_0x1cf8ad['query']);_0x4072a3[_0xc552('0x3e')]=_[_0xc552('0x3f')](_0x4072a3[_0xc552('0x3c')],_0x4072a3[_0xc552('0x3d')]);_0x217690[_0xc552('0x40')]=_[_0xc552('0x3f')](_0x4072a3[_0xc552('0x3c')],qs['fields'](_0x1cf8ad['query'][_0xc552('0x41')]));_0x217690[_0xc552('0x40')]=_0x217690['attributes'][_0xc552('0x42')]?_0x217690[_0xc552('0x40')]:_0x4072a3[_0xc552('0x3c')];if(!_0x1cf8ad[_0xc552('0x3d')][_0xc552('0x43')](_0xc552('0x44'))){_0x217690['limit']=qs[_0xc552('0x26')](_0x1cf8ad[_0xc552('0x3d')][_0xc552('0x26')]);_0x217690[_0xc552('0x24')]=qs[_0xc552('0x24')](_0x1cf8ad['query']['offset']);}_0x217690[_0xc552('0x45')]=qs[_0xc552('0x46')](_0x1cf8ad[_0xc552('0x3d')][_0xc552('0x46')]);_0x217690['where']=qs['filters'](_['pick'](_0x1cf8ad[_0xc552('0x3d')],_0x4072a3['filters']));_0x217690[_0xc552('0x47')][_0xc552('0x62')]=_0x28ecdc['id'];if(_0x1cf8ad[_0xc552('0x3d')][_0xc552('0x49')]){_0x217690[_0xc552('0x47')]=_['merge'](_0x217690[_0xc552('0x47')],{'$or':_['map'](_0x217690['attributes'],function(_0x4fc0a3){var _0x165605={};_0x165605[_0x4fc0a3]={'$like':'%'+_0x1cf8ad[_0xc552('0x3d')]['filter']+'%'};return _0x165605;})});}_0x217690=_[_0xc552('0x4a')]({},_0x217690,_0x1cf8ad[_0xc552('0x4b')]);return db[_0xc552('0x61')][_0xc552('0x4e')](_0x217690);}})[_0xc552('0x2e')](function(_0x171a19){if(_0x171a19){return db[_0xc552('0x63')][_0xc552('0x64')]({'where':{'id':_[_0xc552('0x37')](_0x171a19,_0xc552('0x65')),'role':_0xc552('0x66')},'attributes':['id',_0xc552('0x34'),_0xc552('0x67'),_0xc552('0x68'),_0xc552('0x69')]});}})['then'](function(_0x194024){if(_0x194024){return{'count':_0x194024[_0xc552('0x27')],'rows':_[_0xc552('0x37')](_0x194024[_0xc552('0x4f')],function(_0x5f324a){return{'membername':_0x5f324a['name'],'UserId':_0x5f324a['id'],'queue_name':_0x48f936[_0xc552('0x34')],'MailQueueId':_0x48f936['id'],'interface':util['format'](_0xc552('0x6a'),_0xc552('0x6b'),_0x5f324a[_0xc552('0x34')]),'penalty':0x0,'paused':_0x5f324a[_0xc552('0x67')],'createdAt':_0x5f324a['createdAt'],'updatedAt':_0x5f324a[_0xc552('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc552('0x2e')](respondWithFilteredResult(_0x52597c,_0x217690))['catch'](handleError(_0x52597c,null));};exports['getTeams']=function(_0x455161,_0x4f85a4,_0x160674){var _0x296f05={};var _0x545b59={};var _0x2ecdcb;var _0x442edb;return db[_0xc552('0x38')]['findOne']({'where':{'id':_0x455161[_0xc552('0x52')]['id']}})[_0xc552('0x2e')](handleEntityNotFound(_0x4f85a4,null))[_0xc552('0x2e')](function(_0x4744f7){if(_0x4744f7){_0x2ecdcb=_0x4744f7;_0x545b59[_0xc552('0x3c')]=_[_0xc552('0x53')](db['Team'][_0xc552('0x39')]);_0x545b59['query']=_[_0xc552('0x53')](_0x455161['query']);_0x545b59[_0xc552('0x3e')]=_['intersection'](_0x545b59[_0xc552('0x3c')],_0x545b59[_0xc552('0x3d')]);_0x296f05['attributes']=_['intersection'](_0x545b59[_0xc552('0x3c')],qs[_0xc552('0x41')](_0x455161['query'][_0xc552('0x41')]));_0x296f05['attributes']=_0x296f05[_0xc552('0x40')]['length']?_0x296f05['attributes']:_0x545b59[_0xc552('0x3c')];_0x296f05[_0xc552('0x45')]=qs[_0xc552('0x46')](_0x455161[_0xc552('0x3d')]['sort']);_0x296f05[_0xc552('0x47')]=qs[_0xc552('0x3e')](_['pick'](_0x455161['query'],_0x545b59[_0xc552('0x3e')]));if(_0x455161[_0xc552('0x3d')]['filter']){_0x296f05[_0xc552('0x47')]=_[_0xc552('0x4a')](_0x296f05[_0xc552('0x47')],{'$or':_['map'](_0x296f05['attributes'],function(_0x5eba02){var _0x2469ba={};_0x2469ba[_0x5eba02]={'$like':'%'+_0x455161[_0xc552('0x3d')][_0xc552('0x49')]+'%'};return _0x2469ba;})});}_0x296f05=_[_0xc552('0x4a')]({},_0x296f05,_0x455161[_0xc552('0x4b')]);return _0x2ecdcb[_0xc552('0x6c')](_0x296f05);}})[_0xc552('0x2e')](function(_0x3bd032){if(_0x3bd032){_0x442edb=_0x3bd032['length'];if(!_0x455161[_0xc552('0x3d')]['hasOwnProperty'](_0xc552('0x44'))){_0x296f05[_0xc552('0x26')]=qs[_0xc552('0x26')](_0x455161[_0xc552('0x3d')][_0xc552('0x26')]);_0x296f05['offset']=qs[_0xc552('0x24')](_0x455161[_0xc552('0x3d')]['offset']);}return _0x2ecdcb['getTeams'](_0x296f05);}})[_0xc552('0x2e')](function(_0x3a86bd){if(_0x3a86bd){return _0x3a86bd?{'count':_0x442edb,'rows':_0x3a86bd}:null;}})[_0xc552('0x2e')](respondWithResult(_0x4f85a4,null))[_0xc552('0x50')](handleError(_0x4f85a4,null));};exports['addTeams']=function(_0x3b2639,_0x502c21,_0x358b81){var _0x4f6ebd=_0x3b2639[_0xc552('0x5d')][_0xc552('0x6d')];return db[_0xc552('0x6e')][_0xc552('0x4e')]({'where':{'id':_0x4f6ebd},'attributes':['id'],'include':[{'model':db[_0xc552('0x63')],'as':_0xc552('0x6f'),'attributes':['id',_0xc552('0x34'),_0xc552('0x70'),_0xc552('0x71'),_0xc552('0x72')],'raw':!![]}]})[_0xc552('0x2e')](function(_0x385596){if(_0x385596){var _0x38e110=_['flatMap'](_0x385596,function(_0x18ee6b){var _0x3657a5=_0x18ee6b[_0xc552('0x30')]({'plain':!![]});return _0x3657a5['Agents'];});return db[_0xc552('0x38')][_0xc552('0x59')]({'where':{'id':_0x3b2639[_0xc552('0x52')]['id']}})[_0xc552('0x2e')](function(_0x540ae5){return db[_0xc552('0x73')]['transaction'](function(_0x1773e1){return _0x540ae5[_0xc552('0x74')](_0x4f6ebd,{'transaction':_0x1773e1})[_0xc552('0x2e')](function(){return BPromise[_0xc552('0x75')](_0x38e110,function(_0x31e4ba){return db[_0xc552('0x61')][_0xc552('0x76')]({'where':{'UserId':_0x31e4ba['id'],'MailQueueId':_0x3b2639[_0xc552('0x52')]['id']},'transaction':_0x1773e1});});})['then'](function(){_0x38e110[_0xc552('0x77')](function(_0x56b890){socket['emit']('userMailQueue:save',{'UserId':_0x56b890['id'],'MailQueueId':_0x540ae5['id']});});});});});}})[_0xc552('0x2e')](respondWithStatusCode(_0x502c21,null))['catch'](handleError(_0x502c21,null));};exports['removeTeams']=function(_0x3dba44,_0x34814a,_0x2f1d71){return db[_0xc552('0x6e')][_0xc552('0x4e')]({'where':{'id':_0x3dba44[_0xc552('0x3d')][_0xc552('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xc552('0x63')],'as':_0xc552('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xc552('0x2e')](handleEntityNotFound(_0x34814a,null))[_0xc552('0x2e')](function(_0xe057d9){var _0x96ef7d=_[_0xc552('0x37')](_0xe057d9,'id');var _0x2e3725=[];var _0x2b53ff=[];var _0x22554d=squel['select']();_0x22554d[_0xc552('0x78')](_0xc552('0x79'))['from'](_0xc552('0x7a'),'tq')['join'](_0xc552('0x7b'),'ut',_0xc552('0x7c'))[_0xc552('0x47')](_0xc552('0x7d'),_0x3dba44[_0xc552('0x52')]['id']);for(var _0x5d326e=0x0;_0x5d326e<_0xe057d9[_0xc552('0x42')];_0x5d326e+=0x1){let _0x4bfacc=_0xe057d9[_0x5d326e];for(var _0x16b5b2=0x0;_0x16b5b2<_0x4bfacc[_0xc552('0x6f')][_0xc552('0x42')];_0x16b5b2+=0x1){let _0x3c9cc1=_0x4bfacc[_0xc552('0x6f')][_0x16b5b2];var _0x4e8fb4=_0x22554d[_0xc552('0x7e')]();_0x4e8fb4[_0xc552('0x47')]('ut.UserId\x20=\x20?',_0x3c9cc1['id']);_0x2b53ff['push'](db[_0xc552('0x73')]['query'](_0x4e8fb4[_0xc552('0x7f')](),{'type':db[_0xc552('0x73')][_0xc552('0x80')][_0xc552('0x81')]})['then'](function(_0x441c97){if(_0x441c97[_0xc552('0x42')]===0x1){return _0x3c9cc1['id'];}else{var _0x15b453=_[_0xc552('0x82')](_[_0xc552('0x37')](_0x441c97,'TeamId'),function(_0x5ad726){return _[_0xc552('0x83')](_0x96ef7d,_0x5ad726);});if(_0x15b453){return _0x3c9cc1['id'];}}}));}}return BPromise[_0xc552('0x84')](_0x2b53ff)['then'](function(_0x238b3a){_0x2e3725=_(_0x2e3725)[_0xc552('0x85')](_0x238b3a)[_0xc552('0x86')]()[_0xc552('0x87')]();return db[_0xc552('0x38')]['find']({'where':{'id':_0x3dba44[_0xc552('0x52')]['id']}})['then'](function(_0xd61bf1){return db[_0xc552('0x73')]['transaction'](function(_0x3f5518){return _0xd61bf1[_0xc552('0x88')](_0x3dba44[_0xc552('0x3d')]['ids'],{'transaction':_0x3f5518})[_0xc552('0x2e')](function(){if(!_['isEmpty'](_0x2e3725)){return _0xd61bf1[_0xc552('0x89')](_0x2e3725,{'transaction':_0x3f5518});}})[_0xc552('0x2e')](function(){_0x2e3725['forEach'](function(_0x302c73){socket['emit']('userMailQueue:remove',{'UserId':_0x302c73,'MailQueueId':_0xd61bf1['id']});});});});});});})[_0xc552('0x2e')](respondWithStatusCode(_0x34814a,null))[_0xc552('0x50')](handleError(_0x34814a,null));};exports[_0xc552('0x8a')]=function(_0x4f1ce1,_0x36b9b1,_0x5be49b){return db[_0xc552('0x38')][_0xc552('0x59')]({'where':{'id':_0x4f1ce1['params']['id']}})['then'](handleEntityNotFound(_0x36b9b1,null))['then'](function(_0x3396b1){if(_0x3396b1){return _0x3396b1[_0xc552('0x8a')](_0x4f1ce1[_0xc552('0x5d')][_0xc552('0x6d')],_['omit'](_0x4f1ce1[_0xc552('0x5d')],[_0xc552('0x6d'),'id'])||{})[_0xc552('0x8b')](function(_0x50260f){for(var _0x14a266=0x0;_0x14a266<_0x4f1ce1[_0xc552('0x5d')][_0xc552('0x6d')][_0xc552('0x42')];_0x14a266+=0x1){socket[_0xc552('0x8c')](_0xc552('0x8d'),{'UserId':Number(_0x4f1ce1[_0xc552('0x5d')][_0xc552('0x6d')][_0x14a266]),'MailQueueId':Number(_0x4f1ce1[_0xc552('0x52')]['id'])});}return _0x50260f;});}})[_0xc552('0x2e')](respondWithResult(_0x36b9b1,null))[_0xc552('0x50')](handleError(_0x36b9b1,null));};exports[_0xc552('0x89')]=function(_0x4f22fb,_0xbd6c6,_0x4c48e2){return db['MailQueue'][_0xc552('0x59')]({'where':{'id':_0x4f22fb[_0xc552('0x52')]['id']}})['then'](handleEntityNotFound(_0xbd6c6,null))['then'](function(_0x38b81f){if(_0x38b81f){return _0x38b81f[_0xc552('0x89')](_0x4f22fb[_0xc552('0x3d')][_0xc552('0x6d')])[_0xc552('0x2e')](function(){if(_[_0xc552('0x8e')](_0x4f22fb[_0xc552('0x3d')][_0xc552('0x6d')])){for(var _0xb69040=0x0;_0xb69040<_0x4f22fb['query']['ids']['length'];_0xb69040+=0x1){socket[_0xc552('0x8c')](_0xc552('0x8f'),{'UserId':Number(_0x4f22fb[_0xc552('0x3d')]['ids'][_0xb69040]),'MailQueueId':Number(_0x4f22fb[_0xc552('0x52')]['id'])});}}else{socket['emit'](_0xc552('0x8f'),{'UserId':Number(_0x4f22fb[_0xc552('0x3d')][_0xc552('0x6d')]),'MailQueueId':Number(_0x4f22fb[_0xc552('0x52')]['id'])});}});}})[_0xc552('0x2e')](respondWithStatusCode(_0xbd6c6,null))[_0xc552('0x50')](handleError(_0xbd6c6,null));};exports[_0xc552('0x90')]=function(_0x473e3f,_0x361a32,_0x2f2831){var _0x3eb7ae={};var _0x18a097={};var _0x5aa542;var _0x338e7f;return db[_0xc552('0x38')]['findOne']({'where':{'id':_0x473e3f[_0xc552('0x52')]['id']}})[_0xc552('0x2e')](handleEntityNotFound(_0x361a32,null))[_0xc552('0x2e')](function(_0x3c3c63){if(_0x3c3c63){_0x5aa542=_0x3c3c63;_0x18a097['model']=_[_0xc552('0x53')](db[_0xc552('0x63')][_0xc552('0x39')]);_0x18a097[_0xc552('0x3d')]=_[_0xc552('0x53')](_0x473e3f[_0xc552('0x3d')]);_0x18a097[_0xc552('0x3e')]=_[_0xc552('0x3f')](_0x18a097[_0xc552('0x3c')],_0x18a097[_0xc552('0x3d')]);_0x3eb7ae['attributes']=_[_0xc552('0x3f')](_0x18a097[_0xc552('0x3c')],qs['fields'](_0x473e3f[_0xc552('0x3d')][_0xc552('0x41')]));_0x3eb7ae['attributes']=_0x3eb7ae[_0xc552('0x40')][_0xc552('0x42')]?_0x3eb7ae[_0xc552('0x40')]:_0x18a097[_0xc552('0x3c')];_0x3eb7ae[_0xc552('0x45')]=qs[_0xc552('0x46')](_0x473e3f[_0xc552('0x3d')][_0xc552('0x46')]);_0x3eb7ae['where']=qs[_0xc552('0x3e')](_['pick'](_0x473e3f[_0xc552('0x3d')],_0x18a097['filters']));if(_0x473e3f[_0xc552('0x3d')][_0xc552('0x49')]){_0x3eb7ae['where']=_[_0xc552('0x4a')](_0x3eb7ae[_0xc552('0x47')],{'$or':_[_0xc552('0x37')](_0x3eb7ae[_0xc552('0x40')],function(_0x30bc4c){var _0x5cb0ba={};_0x5cb0ba[_0x30bc4c]={'$like':'%'+_0x473e3f[_0xc552('0x3d')][_0xc552('0x49')]+'%'};return _0x5cb0ba;})});}_0x3eb7ae=_[_0xc552('0x4a')]({},_0x3eb7ae,_0x473e3f[_0xc552('0x4b')]);return _0x5aa542[_0xc552('0x90')](_0x3eb7ae);}})['then'](function(_0x24a9d3){if(_0x24a9d3){_0x338e7f=_0x24a9d3['length'];if(!_0x473e3f[_0xc552('0x3d')][_0xc552('0x43')](_0xc552('0x44'))){_0x3eb7ae[_0xc552('0x26')]=qs[_0xc552('0x26')](_0x473e3f[_0xc552('0x3d')][_0xc552('0x26')]);_0x3eb7ae['offset']=qs['offset'](_0x473e3f[_0xc552('0x3d')]['offset']);}return _0x5aa542['getAgents'](_0x3eb7ae);}})[_0xc552('0x2e')](function(_0x8675a4){if(_0x8675a4){return _0x8675a4?{'count':_0x338e7f,'rows':_0x8675a4}:null;}})[_0xc552('0x2e')](respondWithResult(_0x361a32,null))[_0xc552('0x50')](handleError(_0x361a32,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index d5f9bc3..e718df8 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 _0x2346=['MailQueue','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x216e4a,_0x220697){var _0x3e85b4=function(_0x1673c6){while(--_0x1673c6){_0x216e4a['push'](_0x216e4a['shift']());}};_0x3e85b4(++_0x220697);}(_0x2346,0x16f));var _0x6234=function(_0x53a8d3,_0x1a0799){_0x53a8d3=_0x53a8d3-0x0;var _0x15e434=_0x2346[_0x53a8d3];return _0x15e434;};'use strict';var EventEmitter=require(_0x6234('0x0'));var MailQueue=require(_0x6234('0x1'))['db'][_0x6234('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6234('0x3'),'afterUpdate':_0x6234('0x4'),'afterDestroy':'remove'};function emitEvent(_0xe7b297){return function(_0x444b63,_0x6c756a,_0x15ecaa){MailQueueEvents[_0x6234('0x5')](_0xe7b297+':'+_0x444b63['id'],_0x444b63);MailQueueEvents[_0x6234('0x5')](_0xe7b297,_0x444b63);_0x15ecaa(null);};}for(var e in events){if(events[_0x6234('0x6')](e)){var event=events[e];MailQueue[_0x6234('0x7')](e,emitEvent(event));}}module[_0x6234('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x55be=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5699e7,_0xb9ca23){var _0x1e8559=function(_0x127049){while(--_0x127049){_0x5699e7['push'](_0x5699e7['shift']());}};_0x1e8559(++_0xb9ca23);}(_0x55be,0xa3));var _0xe55b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x55be[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0xe55b('0x0'));var MailQueue=require(_0xe55b('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe55b('0x2')](0x0);var events={'afterCreate':_0xe55b('0x3'),'afterUpdate':_0xe55b('0x4'),'afterDestroy':_0xe55b('0x5')};function emitEvent(_0x5a0697){return function(_0x4da932,_0x5aaff8,_0xd19c8a){MailQueueEvents[_0xe55b('0x6')](_0x5a0697+':'+_0x4da932['id'],_0x4da932);MailQueueEvents[_0xe55b('0x6')](_0x5a0697,_0x4da932);_0xd19c8a(null);};}for(var e in events){if(events[_0xe55b('0x7')](e)){var event=events[e];MailQueue[_0xe55b('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index cfc4ca1..0029dab 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 _0x78c6=['exports','define','MailQueue','mail_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x2b35ca,_0x4943ce){var _0x68389e=function(_0x4e9d92){while(--_0x4e9d92){_0x2b35ca['push'](_0x2b35ca['shift']());}};_0x68389e(++_0x4943ce);}(_0x78c6,0x1d8));var _0x678c=function(_0x54f7b3,_0x51e88f){_0x54f7b3=_0x54f7b3-0x0;var _0x1eb8e1=_0x78c6[_0x54f7b3];return _0x1eb8e1;};'use strict';var _=require(_0x678c('0x0'));var util=require('util');var logger=require(_0x678c('0x1'))('api');var moment=require(_0x678c('0x2'));var BPromise=require(_0x678c('0x3'));var rp=require(_0x678c('0x4'));var fs=require('fs');var path=require(_0x678c('0x5'));var rimraf=require(_0x678c('0x6'));var config=require(_0x678c('0x7'));var attributes=require(_0x678c('0x8'));module[_0x678c('0x9')]=function(_0x22e731,_0x4cef14){return _0x22e731[_0x678c('0xa')](_0x678c('0xb'),attributes,{'tableName':_0x678c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6106=['api','moment','bluebird','request-promise','path','rimraf','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger'];(function(_0x65fcb6,_0x1870f6){var _0x52633d=function(_0x2dbd98){while(--_0x2dbd98){_0x65fcb6['push'](_0x65fcb6['shift']());}};_0x52633d(++_0x1870f6);}(_0x6106,0x101));var _0x6610=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x6106[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x6610('0x0'));var util=require(_0x6610('0x1'));var logger=require(_0x6610('0x2'))(_0x6610('0x3'));var moment=require(_0x6610('0x4'));var BPromise=require(_0x6610('0x5'));var rp=require(_0x6610('0x6'));var fs=require('fs');var path=require(_0x6610('0x7'));var rimraf=require(_0x6610('0x8'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x6610('0x9')]=function(_0x4f869c,_0x1b3370){return _0x4f869c[_0x6610('0xa')](_0x6610('0xb'),attributes,{'tableName':_0x6610('0xc'),'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 3470eba..05a7de8 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 _0x518c=['raw','include','model','attributes','map','MailQueue','find','ShowMailQueue','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetMailQueue','findAll','options'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x518c,0x150));var _0xc518=function(_0x15590d,_0x36937b){_0x15590d=_0x15590d-0x0;var _0x1e62e6=_0x518c[_0x15590d];return _0x1e62e6;};'use strict';var _=require(_0xc518('0x0'));var util=require(_0xc518('0x1'));var moment=require('moment');var BPromise=require(_0xc518('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc518('0x3'));var db=require(_0xc518('0x4'))['db'];var utils=require(_0xc518('0x5'));var logger=require(_0xc518('0x6'))(_0xc518('0x7'));var config=require(_0xc518('0x8'));var jayson=require(_0xc518('0x9'));var client=jayson['client'][_0xc518('0xa')]({'port':0x232a});config[_0xc518('0xb')]=_[_0xc518('0xc')](config[_0xc518('0xb')],{'host':_0xc518('0xd'),'port':0x18eb});var socket=require(_0xc518('0xe'))(new Redis(config[_0xc518('0xb')]));require(_0xc518('0xf'))[_0xc518('0x10')](socket);function respondWithRpcPromise(_0x46f098,_0x47c5e6,_0x86c473){return new BPromise(function(_0x3bfdc3,_0x259f26){return client[_0xc518('0x11')](_0x46f098,_0x86c473)[_0xc518('0x12')](function(_0x5c8891){logger[_0xc518('0x13')](_0xc518('0x14'),_0x47c5e6,_0xc518('0x15'));logger[_0xc518('0x16')](_0xc518('0x17'),_0x47c5e6,'request\x20sent',JSON[_0xc518('0x18')](_0x5c8891));if(_0x5c8891['error']){if(_0x5c8891['error'][_0xc518('0x19')]===0x1f4){logger[_0xc518('0x1a')](_0xc518('0x14'),_0x47c5e6,_0x5c8891[_0xc518('0x1a')]['message']);return _0x259f26(_0x5c8891[_0xc518('0x1a')][_0xc518('0x1b')]);}logger[_0xc518('0x1a')](_0xc518('0x14'),_0x47c5e6,_0x5c8891[_0xc518('0x1a')][_0xc518('0x1b')]);return _0x3bfdc3(_0x5c8891['error'][_0xc518('0x1b')]);}else{logger[_0xc518('0x13')]('MailQueue,\x20%s,\x20%s',_0x47c5e6,_0xc518('0x15'));_0x3bfdc3(_0x5c8891[_0xc518('0x1c')]['message']);}})[_0xc518('0x1d')](function(_0x123cbd){logger[_0xc518('0x1a')]('MailQueue,\x20%s,\x20%s',_0x47c5e6,_0x123cbd);_0x259f26(_0x123cbd);});});}exports[_0xc518('0x1e')]=function(_0x1eb782){var _0x2edeb3=this;return new Promise(function(_0x585c2c,_0x451dad){return db['MailQueue'][_0xc518('0x1f')]({'raw':_0x1eb782['options']?_0x1eb782[_0xc518('0x20')][_0xc518('0x21')]===undefined?!![]:![]:!![],'where':_0x1eb782[_0xc518('0x20')]?_0x1eb782[_0xc518('0x20')]['where']||null:null,'attributes':_0x1eb782[_0xc518('0x20')]?_0x1eb782[_0xc518('0x20')]['attributes']||null:null,'limit':_0x1eb782[_0xc518('0x20')]?_0x1eb782[_0xc518('0x20')]['limit']||null:null,'include':_0x1eb782[_0xc518('0x20')]?_0x1eb782[_0xc518('0x20')]['include']?_['map'](_0x1eb782[_0xc518('0x20')][_0xc518('0x22')],function(_0x375c38){return{'model':db[_0x375c38[_0xc518('0x23')]],'as':_0x375c38['as'],'attributes':_0x375c38[_0xc518('0x24')],'include':_0x375c38[_0xc518('0x22')]?_[_0xc518('0x25')](_0x375c38[_0xc518('0x22')],function(_0x4734be){return{'model':db[_0x4734be[_0xc518('0x23')]],'as':_0x4734be['as'],'attributes':_0x4734be[_0xc518('0x24')],'include':_0x4734be[_0xc518('0x22')]?_['map'](_0x4734be[_0xc518('0x22')],function(_0x2f6f46){return{'model':db[_0x2f6f46['model']],'as':_0x2f6f46['as'],'attributes':_0x2f6f46['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x13ca4e){logger[_0xc518('0x13')](_0xc518('0x1e'),_0x1eb782);logger[_0xc518('0x16')](_0xc518('0x1e'),_0x1eb782,JSON[_0xc518('0x18')](_0x13ca4e));_0x585c2c(_0x13ca4e);})[_0xc518('0x1d')](function(_0x4d4ee1){logger[_0xc518('0x1a')](_0xc518('0x1e'),_0x4d4ee1[_0xc518('0x1b')],_0x1eb782);_0x451dad(_0x2edeb3['error'](0x1f4,_0x4d4ee1[_0xc518('0x1b')]));});});};exports['ShowMailQueue']=function(_0x5b6555){var _0x37d895=this;return new Promise(function(_0x12574a,_0x50b8ea){return db[_0xc518('0x26')][_0xc518('0x27')]({'raw':_0x5b6555[_0xc518('0x20')]?_0x5b6555[_0xc518('0x20')][_0xc518('0x21')]===undefined?!![]:![]:!![],'where':_0x5b6555['options']?_0x5b6555[_0xc518('0x20')]['where']||null:null,'attributes':_0x5b6555['options']?_0x5b6555['options'][_0xc518('0x24')]||null:null,'include':_0x5b6555[_0xc518('0x20')]?_0x5b6555[_0xc518('0x20')]['include']?_['map'](_0x5b6555[_0xc518('0x20')][_0xc518('0x22')],function(_0x3a6737){return{'model':db[_0x3a6737['model']],'as':_0x3a6737['as'],'attributes':_0x3a6737[_0xc518('0x24')],'include':_0x3a6737[_0xc518('0x22')]?_[_0xc518('0x25')](_0x3a6737[_0xc518('0x22')],function(_0x24f77c){return{'model':db[_0x24f77c[_0xc518('0x23')]],'as':_0x24f77c['as'],'attributes':_0x24f77c[_0xc518('0x24')],'include':_0x24f77c[_0xc518('0x22')]?_[_0xc518('0x25')](_0x24f77c[_0xc518('0x22')],function(_0x1a47e3){return{'model':db[_0x1a47e3[_0xc518('0x23')]],'as':_0x1a47e3['as'],'attributes':_0x1a47e3[_0xc518('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc518('0x12')](function(_0x1e319a){logger[_0xc518('0x13')](_0xc518('0x28'),_0x5b6555);logger['debug'](_0xc518('0x28'),_0x5b6555,JSON[_0xc518('0x18')](_0x1e319a));_0x12574a(_0x1e319a);})[_0xc518('0x1d')](function(_0x9670fb){logger[_0xc518('0x1a')](_0xc518('0x28'),_0x9670fb['message'],_0x5b6555);_0x50b8ea(_0x37d895['error'](0x1f4,_0x9670fb[_0xc518('0x1b')]));});});}; \ No newline at end of file +var _0x7a4f=['socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','include','map','model','ShowMailQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x5ec02e,_0x11563c){var _0x468bd9=function(_0x4a8de3){while(--_0x4a8de3){_0x5ec02e['push'](_0x5ec02e['shift']());}};_0x468bd9(++_0x11563c);}(_0x7a4f,0x17a));var _0xf7a4=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x7a4f[_0xc77819];return _0x1c9434;};'use strict';var _=require('lodash');var util=require(_0xf7a4('0x0'));var moment=require(_0xf7a4('0x1'));var BPromise=require('bluebird');var rs=require(_0xf7a4('0x2'));var fs=require('fs');var Redis=require(_0xf7a4('0x3'));var db=require(_0xf7a4('0x4'))['db'];var utils=require(_0xf7a4('0x5'));var logger=require('../../config/logger')(_0xf7a4('0x6'));var config=require('../../config/environment');var jayson=require(_0xf7a4('0x7'));var client=jayson[_0xf7a4('0x8')]['http']({'port':0x232a});config[_0xf7a4('0x9')]=_[_0xf7a4('0xa')](config[_0xf7a4('0x9')],{'host':_0xf7a4('0xb'),'port':0x18eb});var socket=require(_0xf7a4('0xc'))(new Redis(config[_0xf7a4('0x9')]));require(_0xf7a4('0xd'))[_0xf7a4('0xe')](socket);function respondWithRpcPromise(_0x2f6f53,_0x180eb9,_0x3285e8){return new BPromise(function(_0x293078,_0x50e94a){return client[_0xf7a4('0xf')](_0x2f6f53,_0x3285e8)[_0xf7a4('0x10')](function(_0x55d31d){logger[_0xf7a4('0x11')](_0xf7a4('0x12'),_0x180eb9,'request\x20sent');logger[_0xf7a4('0x13')](_0xf7a4('0x14'),_0x180eb9,_0xf7a4('0x15'),JSON[_0xf7a4('0x16')](_0x55d31d));if(_0x55d31d[_0xf7a4('0x17')]){if(_0x55d31d[_0xf7a4('0x17')][_0xf7a4('0x18')]===0x1f4){logger[_0xf7a4('0x17')](_0xf7a4('0x12'),_0x180eb9,_0x55d31d['error'][_0xf7a4('0x19')]);return _0x50e94a(_0x55d31d[_0xf7a4('0x17')]['message']);}logger[_0xf7a4('0x17')]('MailQueue,\x20%s,\x20%s',_0x180eb9,_0x55d31d[_0xf7a4('0x17')][_0xf7a4('0x19')]);return _0x293078(_0x55d31d['error']['message']);}else{logger[_0xf7a4('0x11')]('MailQueue,\x20%s,\x20%s',_0x180eb9,_0xf7a4('0x15'));_0x293078(_0x55d31d['result'][_0xf7a4('0x19')]);}})[_0xf7a4('0x1a')](function(_0x400a1c){logger[_0xf7a4('0x17')](_0xf7a4('0x12'),_0x180eb9,_0x400a1c);_0x50e94a(_0x400a1c);});});}exports[_0xf7a4('0x1b')]=function(_0x5acaa8){var _0x42b65b=this;return new Promise(function(_0x18cd81,_0x484677){return db[_0xf7a4('0x1c')][_0xf7a4('0x1d')]({'raw':_0x5acaa8[_0xf7a4('0x1e')]?_0x5acaa8[_0xf7a4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5acaa8[_0xf7a4('0x1e')]?_0x5acaa8['options'][_0xf7a4('0x1f')]||null:null,'attributes':_0x5acaa8[_0xf7a4('0x1e')]?_0x5acaa8[_0xf7a4('0x1e')][_0xf7a4('0x20')]||null:null,'limit':_0x5acaa8[_0xf7a4('0x1e')]?_0x5acaa8[_0xf7a4('0x1e')]['limit']||null:null,'include':_0x5acaa8[_0xf7a4('0x1e')]?_0x5acaa8['options'][_0xf7a4('0x21')]?_[_0xf7a4('0x22')](_0x5acaa8['options'][_0xf7a4('0x21')],function(_0x3fce9b){return{'model':db[_0x3fce9b[_0xf7a4('0x23')]],'as':_0x3fce9b['as'],'attributes':_0x3fce9b[_0xf7a4('0x20')],'include':_0x3fce9b[_0xf7a4('0x21')]?_[_0xf7a4('0x22')](_0x3fce9b['include'],function(_0x4cb135){return{'model':db[_0x4cb135[_0xf7a4('0x23')]],'as':_0x4cb135['as'],'attributes':_0x4cb135['attributes'],'include':_0x4cb135['include']?_[_0xf7a4('0x22')](_0x4cb135['include'],function(_0xeef2d5){return{'model':db[_0xeef2d5['model']],'as':_0xeef2d5['as'],'attributes':_0xeef2d5[_0xf7a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf7a4('0x10')](function(_0x5f1eb3){logger[_0xf7a4('0x11')](_0xf7a4('0x1b'),_0x5acaa8);logger[_0xf7a4('0x13')](_0xf7a4('0x1b'),_0x5acaa8,JSON['stringify'](_0x5f1eb3));_0x18cd81(_0x5f1eb3);})[_0xf7a4('0x1a')](function(_0x1eea08){logger[_0xf7a4('0x17')](_0xf7a4('0x1b'),_0x1eea08[_0xf7a4('0x19')],_0x5acaa8);_0x484677(_0x42b65b[_0xf7a4('0x17')](0x1f4,_0x1eea08[_0xf7a4('0x19')]));});});};exports[_0xf7a4('0x24')]=function(_0x3b8af7){var _0x5bf888=this;return new Promise(function(_0x5020b7,_0x10f0ec){return db[_0xf7a4('0x1c')][_0xf7a4('0x25')]({'raw':_0x3b8af7[_0xf7a4('0x1e')]?_0x3b8af7[_0xf7a4('0x1e')][_0xf7a4('0x26')]===undefined?!![]:![]:!![],'where':_0x3b8af7[_0xf7a4('0x1e')]?_0x3b8af7[_0xf7a4('0x1e')][_0xf7a4('0x1f')]||null:null,'attributes':_0x3b8af7[_0xf7a4('0x1e')]?_0x3b8af7[_0xf7a4('0x1e')]['attributes']||null:null,'include':_0x3b8af7[_0xf7a4('0x1e')]?_0x3b8af7[_0xf7a4('0x1e')][_0xf7a4('0x21')]?_[_0xf7a4('0x22')](_0x3b8af7[_0xf7a4('0x1e')][_0xf7a4('0x21')],function(_0x5e972c){return{'model':db[_0x5e972c[_0xf7a4('0x23')]],'as':_0x5e972c['as'],'attributes':_0x5e972c[_0xf7a4('0x20')],'include':_0x5e972c[_0xf7a4('0x21')]?_[_0xf7a4('0x22')](_0x5e972c['include'],function(_0x352b2a){return{'model':db[_0x352b2a[_0xf7a4('0x23')]],'as':_0x352b2a['as'],'attributes':_0x352b2a[_0xf7a4('0x20')],'include':_0x352b2a[_0xf7a4('0x21')]?_[_0xf7a4('0x22')](_0x352b2a[_0xf7a4('0x21')],function(_0x52876e){return{'model':db[_0x52876e['model']],'as':_0x52876e['as'],'attributes':_0x52876e[_0xf7a4('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41285a){logger[_0xf7a4('0x11')](_0xf7a4('0x24'),_0x3b8af7);logger[_0xf7a4('0x13')](_0xf7a4('0x24'),_0x3b8af7,JSON[_0xf7a4('0x16')](_0x41285a));_0x5020b7(_0x41285a);})[_0xf7a4('0x1a')](function(_0x30d598){logger['error'](_0xf7a4('0x24'),_0x30d598[_0xf7a4('0x19')],_0x3b8af7);_0x10f0ec(_0x5bf888['error'](0x1f4,_0x30d598['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c967241..0a490b2 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 _0x1e9f=['update','emit','length','./mailQueue.events','remove'];(function(_0x4f959,_0x4b330e){var _0x3e32f9=function(_0x541715){while(--_0x541715){_0x4f959['push'](_0x4f959['shift']());}};_0x3e32f9(++_0x4b330e);}(_0x1e9f,0x107));var _0xf1e9=function(_0xd0d09,_0x377ae2){_0xd0d09=_0xd0d09-0x0;var _0x350abc=_0x1e9f[_0xd0d09];return _0x350abc;};'use strict';var MailQueueEvents=require(_0xf1e9('0x0'));var events=['save',_0xf1e9('0x1'),_0xf1e9('0x2')];function createListener(_0x13d590,_0x203e7b){return function(_0x5581d6){_0x203e7b[_0xf1e9('0x3')](_0x13d590,_0x5581d6);};}function removeListener(_0x5a9e8e,_0x1974d5){return function(){MailQueueEvents['removeListener'](_0x5a9e8e,_0x1974d5);};}exports['register']=function(_0x26d29b){for(var _0x56386d=0x0,_0x4eb1b6=events[_0xf1e9('0x4')];_0x56386d<_0x4eb1b6;_0x56386d++){var _0x37029b=events[_0x56386d];var _0x3002d4=createListener('mailQueue:'+_0x37029b,_0x26d29b);MailQueueEvents['on'](_0x37029b,_0x3002d4);}}; \ No newline at end of file +var _0xb19a=['emit','removeListener','register','length','./mailQueue.events','update'];(function(_0x1a7af5,_0x2b0f1b){var _0x209379=function(_0xb68e9b){while(--_0xb68e9b){_0x1a7af5['push'](_0x1a7af5['shift']());}};_0x209379(++_0x2b0f1b);}(_0xb19a,0xd0));var _0xab19=function(_0xa70c15,_0x11ae29){_0xa70c15=_0xa70c15-0x0;var _0x4b8c1a=_0xb19a[_0xa70c15];return _0x4b8c1a;};'use strict';var MailQueueEvents=require(_0xab19('0x0'));var events=['save','remove',_0xab19('0x1')];function createListener(_0x4b4fa0,_0x5c666f){return function(_0x2ad99b){_0x5c666f[_0xab19('0x2')](_0x4b4fa0,_0x2ad99b);};}function removeListener(_0x20333b,_0x3b7129){return function(){MailQueueEvents[_0xab19('0x3')](_0x20333b,_0x3b7129);};}exports[_0xab19('0x4')]=function(_0x907494){for(var _0x5e77f8=0x0,_0x9d5c1d=events[_0xab19('0x5')];_0x5e77f8<_0x9d5c1d;_0x5e77f8++){var _0x59d282=events[_0x5e77f8];var _0x300038=createListener('mailQueue:'+_0x59d282,_0x907494);MailQueueEvents['on'](_0x59d282,_0x300038);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d18f90d..0ca9cb2 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 _0x8b53=['../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','delete','/:id','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x16c9c7,_0x2c2a75){var _0x317a5d=function(_0x43a356){while(--_0x43a356){_0x16c9c7['push'](_0x16c9c7['shift']());}};_0x317a5d(++_0x2c2a75);}(_0x8b53,0x79));var _0x38b5=function(_0x2618a7,_0x40c556){_0x2618a7=_0x2618a7-0x0;var _0x4e8ea1=_0x8b53[_0x2618a7];return _0x4e8ea1;};'use strict';var multer=require(_0x38b5('0x0'));var util=require(_0x38b5('0x1'));var path=require(_0x38b5('0x2'));var timeout=require(_0x38b5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x38b5('0x4'));var auth=require(_0x38b5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x38b5('0x6'));router[_0x38b5('0x7')]('/',auth[_0x38b5('0x8')](),controller['index']);router[_0x38b5('0x7')](_0x38b5('0x9'),auth[_0x38b5('0x8')](),controller[_0x38b5('0xa')]);router[_0x38b5('0x7')]('/:id',auth[_0x38b5('0x8')](),controller[_0x38b5('0xb')]);router[_0x38b5('0xc')]('/',auth['isAuthenticated'](),controller[_0x38b5('0xd')]);router[_0x38b5('0xe')]('/:id',auth[_0x38b5('0x8')](),controller['update']);router[_0x38b5('0xf')](_0x38b5('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x38b5('0x11')]=router; \ No newline at end of file +var _0xfb2d=['post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x29d932,_0x97f2a7){var _0x5cd611=function(_0x33e548){while(--_0x33e548){_0x29d932['push'](_0x29d932['shift']());}};_0x5cd611(++_0x97f2a7);}(_0xfb2d,0xa6));var _0xdfb2=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0xfb2d[_0x5e3701];return _0x345dcf;};'use strict';var multer=require('multer');var util=require(_0xdfb2('0x0'));var path=require(_0xdfb2('0x1'));var timeout=require(_0xdfb2('0x2'));var express=require(_0xdfb2('0x3'));var router=express[_0xdfb2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdfb2('0x5'));var interaction=require(_0xdfb2('0x6'));var config=require('../../config/environment');var controller=require(_0xdfb2('0x7'));router[_0xdfb2('0x8')]('/',auth[_0xdfb2('0x9')](),controller[_0xdfb2('0xa')]);router[_0xdfb2('0x8')](_0xdfb2('0xb'),auth[_0xdfb2('0x9')](),controller[_0xdfb2('0xc')]);router['get'](_0xdfb2('0xd'),auth[_0xdfb2('0x9')](),controller['show']);router[_0xdfb2('0xe')]('/',auth[_0xdfb2('0x9')](),controller['create']);router[_0xdfb2('0xf')](_0xdfb2('0xd'),auth[_0xdfb2('0x9')](),controller[_0xdfb2('0x10')]);router[_0xdfb2('0x11')](_0xdfb2('0xd'),auth[_0xdfb2('0x9')](),controller[_0xdfb2('0x12')]);module[_0xdfb2('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index f6b2b35..ec087ee 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 _0xcca7=['DATE','moment','sequelize','exports','STRING'];(function(_0xb3275c,_0x2623c3){var _0x58e50b=function(_0x2303a3){while(--_0x2303a3){_0xb3275c['push'](_0xb3275c['shift']());}};_0x58e50b(++_0x2623c3);}(_0xcca7,0x1aa));var _0x7cca=function(_0x4beb5c,_0x36070e){_0x4beb5c=_0x4beb5c-0x0;var _0x2f3a87=_0xcca7[_0x4beb5c];return _0x2f3a87;};'use strict';var moment=require(_0x7cca('0x0'));var Sequelize=require(_0x7cca('0x1'));module[_0x7cca('0x2')]={'uniqueid':{'type':Sequelize[_0x7cca('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7cca('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7cca('0x4')]},'reason':{'type':Sequelize[_0x7cca('0x3')]}}; \ No newline at end of file +var _0x61df=['DATE','STRING'];(function(_0x4c6ca9,_0x523f2a){var _0x425a41=function(_0x1dc607){while(--_0x1dc607){_0x4c6ca9['push'](_0x4c6ca9['shift']());}};_0x425a41(++_0x523f2a);}(_0x61df,0xbd));var _0xf61d=function(_0x130cf7,_0x2ddb66){_0x130cf7=_0x130cf7-0x0;var _0x31b6f3=_0x61df[_0x130cf7];return _0x31b6f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf61d('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xf61d('0x0')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf61d('0x1')]},'acceptAt':{'type':Sequelize[_0xf61d('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf61d('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4cc4c1e..1ed2df5 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 _0xd4a2=['describe','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','MailQueueReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body'];(function(_0xdd408d,_0x2e9f6c){var _0x491544=function(_0x1513d4){while(--_0x1513d4){_0xdd408d['push'](_0xdd408d['shift']());}};_0x491544(++_0x2e9f6c);}(_0xd4a2,0x173));var _0x2d4a=function(_0x3b89f0,_0x49e20b){_0x3b89f0=_0x3b89f0-0x0;var _0x3f4170=_0xd4a2[_0x3b89f0];return _0x3f4170;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];function respondWithStatusCode(_0x45b9fb,_0x5ac803){_0x5ac803=_0x5ac803||0xcc;return function(_0x2f785f){if(_0x2f785f){return _0x45b9fb[_0x2d4a('0x17')](_0x5ac803);}return _0x45b9fb[_0x2d4a('0x18')](_0x5ac803)[_0x2d4a('0x19')]();};}function respondWithResult(_0x544622,_0x4be8b4){_0x4be8b4=_0x4be8b4||0xc8;return function(_0x2a1d0f){if(_0x2a1d0f){return _0x544622['status'](_0x4be8b4)[_0x2d4a('0x1a')](_0x2a1d0f);}};}function respondWithFilteredResult(_0x175bda,_0x11896d){return function(_0x3a3156){if(_0x3a3156){var _0x4c5287=typeof _0x11896d[_0x2d4a('0x1b')]==='undefined'&&typeof _0x11896d[_0x2d4a('0x1c')]==='undefined';var _0x435687=_0x3a3156[_0x2d4a('0x1d')];var _0x2188b2=_0x4c5287?0x0:_0x11896d[_0x2d4a('0x1b')];var _0x498956=_0x4c5287?_0x3a3156['count']:_0x11896d['offset']+_0x11896d[_0x2d4a('0x1c')];var _0x1966d1;if(_0x498956>=_0x435687){_0x498956=_0x435687;_0x1966d1=0xc8;}else{_0x1966d1=0xce;}_0x175bda[_0x2d4a('0x18')](_0x1966d1);return _0x175bda[_0x2d4a('0x1e')](_0x2d4a('0x1f'),_0x2188b2+'-'+_0x498956+'/'+_0x435687)[_0x2d4a('0x1a')](_0x3a3156);}return null;};}function patchUpdates(_0x56445a){return function(_0x49f378){try{jsonpatch[_0x2d4a('0x20')](_0x49f378,_0x56445a,!![]);}catch(_0x1f3e17){return BPromise[_0x2d4a('0x21')](_0x1f3e17);}return _0x49f378[_0x2d4a('0x22')]();};}function saveUpdates(_0x1a2d20,_0x2e7736){return function(_0x22dd0b){if(_0x22dd0b){return _0x22dd0b[_0x2d4a('0x23')](_0x1a2d20)['then'](function(_0x26e7b8){return _0x26e7b8;});}return null;};}function removeEntity(_0x3240a2,_0x2c3799){return function(_0x42d813){if(_0x42d813){return _0x42d813[_0x2d4a('0x24')]()[_0x2d4a('0x25')](function(){_0x3240a2[_0x2d4a('0x18')](0xcc)[_0x2d4a('0x19')]();});}};}function handleEntityNotFound(_0x54c910,_0x544b9b){return function(_0x5cc7d8){if(!_0x5cc7d8){_0x54c910[_0x2d4a('0x17')](0x194);}return _0x5cc7d8;};}function handleError(_0x5029f3,_0x410f7d){_0x410f7d=_0x410f7d||0x1f4;return function(_0x3a2fd3){logger[_0x2d4a('0x26')](_0x3a2fd3[_0x2d4a('0x27')]);if(_0x3a2fd3[_0x2d4a('0x28')]){delete _0x3a2fd3[_0x2d4a('0x28')];}_0x5029f3[_0x2d4a('0x18')](_0x410f7d)[_0x2d4a('0x29')](_0x3a2fd3);};}exports['index']=function(_0x436f53,_0x5ce262){var _0x221602={},_0x9bac28={},_0xc497ce={'count':0x0,'rows':[]};var _0x20b87d=_[_0x2d4a('0x2a')](db[_0x2d4a('0x2b')][_0x2d4a('0x2c')],function(_0x2e8063){return{'name':_0x2e8063['fieldName'],'type':_0x2e8063[_0x2d4a('0x2d')][_0x2d4a('0x2e')]};});_0x9bac28[_0x2d4a('0x2f')]=_[_0x2d4a('0x2a')](_0x20b87d,_0x2d4a('0x28'));_0x9bac28['query']=_[_0x2d4a('0x30')](_0x436f53[_0x2d4a('0x31')]);_0x9bac28[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],_0x9bac28['query']);_0x221602[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],qs[_0x2d4a('0x35')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x35')]));_0x221602['attributes']=_0x221602[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x221602[_0x2d4a('0x34')]:_0x9bac28[_0x2d4a('0x2f')];if(!_0x436f53[_0x2d4a('0x31')]['hasOwnProperty'](_0x2d4a('0x37'))){_0x221602[_0x2d4a('0x1c')]=qs['limit'](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1c')]);_0x221602[_0x2d4a('0x1b')]=qs[_0x2d4a('0x1b')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1b')]);}_0x221602['order']=qs[_0x2d4a('0x38')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x38')]);_0x221602[_0x2d4a('0x39')]=qs[_0x2d4a('0x32')](_[_0x2d4a('0x3a')](_0x436f53['query'],_0x9bac28['filters']),_0x20b87d);if(_0x436f53[_0x2d4a('0x31')]['filter']){_0x221602[_0x2d4a('0x39')]=_[_0x2d4a('0x3b')](_0x221602['where'],{'$or':_[_0x2d4a('0x2a')](_0x20b87d,function(_0x275598){if(_0x275598[_0x2d4a('0x2d')]!==_0x2d4a('0x3c')){var _0x67bce3={};_0x67bce3[_0x275598[_0x2d4a('0x28')]]={'$like':'%'+_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x3d')]+'%'};return _0x67bce3;}})});}_0x221602=_[_0x2d4a('0x3b')]({},_0x221602,_0x436f53[_0x2d4a('0x3e')]);var _0x3bb0cc={'where':_0x221602['where']};return db[_0x2d4a('0x2b')][_0x2d4a('0x1d')](_0x3bb0cc)[_0x2d4a('0x25')](function(_0x2f1635){_0xc497ce[_0x2d4a('0x1d')]=_0x2f1635;if(_0x436f53['query']['includeAll']){_0x221602['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x2d4a('0x3f')](_0x221602);})[_0x2d4a('0x25')](function(_0xf39020){_0xc497ce[_0x2d4a('0x40')]=_0xf39020;return _0xc497ce;})['then'](respondWithFilteredResult(_0x5ce262,_0x221602))[_0x2d4a('0x41')](handleError(_0x5ce262,null));};exports[_0x2d4a('0x42')]=function(_0x5e9704,_0x189d2a){var _0x13b0f0={'raw':!![],'where':{'id':_0x5e9704[_0x2d4a('0x43')]['id']}},_0x8a9375={};_0x8a9375[_0x2d4a('0x2f')]=_[_0x2d4a('0x30')](db['MailQueueReport'][_0x2d4a('0x2c')]);_0x8a9375[_0x2d4a('0x31')]=_[_0x2d4a('0x30')](_0x5e9704[_0x2d4a('0x31')]);_0x8a9375[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x8a9375['model'],_0x8a9375[_0x2d4a('0x31')]);_0x13b0f0[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x8a9375['model'],qs[_0x2d4a('0x35')](_0x5e9704['query'][_0x2d4a('0x35')]));_0x13b0f0[_0x2d4a('0x34')]=_0x13b0f0[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x13b0f0[_0x2d4a('0x34')]:_0x8a9375['model'];if(_0x5e9704['query'][_0x2d4a('0x44')]){_0x13b0f0[_0x2d4a('0x45')]=[{'all':!![]}];}_0x13b0f0=_['merge']({},_0x13b0f0,_0x5e9704[_0x2d4a('0x3e')]);return db['MailQueueReport'][_0x2d4a('0x46')](_0x13b0f0)[_0x2d4a('0x25')](handleEntityNotFound(_0x189d2a,null))[_0x2d4a('0x25')](respondWithResult(_0x189d2a,null))['catch'](handleError(_0x189d2a,null));};exports[_0x2d4a('0x47')]=function(_0x541b93,_0x3806b8){return db[_0x2d4a('0x2b')][_0x2d4a('0x47')](_0x541b93[_0x2d4a('0x48')],{})[_0x2d4a('0x25')](respondWithResult(_0x3806b8,0xc9))[_0x2d4a('0x41')](handleError(_0x3806b8,null));};exports[_0x2d4a('0x23')]=function(_0x2b2f4b,_0x1ffb96){if(_0x2b2f4b[_0x2d4a('0x48')]['id']){delete _0x2b2f4b[_0x2d4a('0x48')]['id'];}return db['MailQueueReport'][_0x2d4a('0x46')]({'where':{'id':_0x2b2f4b[_0x2d4a('0x43')]['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x1ffb96,null))[_0x2d4a('0x25')](saveUpdates(_0x2b2f4b[_0x2d4a('0x48')],null))['then'](respondWithResult(_0x1ffb96,null))[_0x2d4a('0x41')](handleError(_0x1ffb96,null));};exports[_0x2d4a('0x24')]=function(_0x2123e8,_0x440625){return db[_0x2d4a('0x2b')]['find']({'where':{'id':_0x2123e8['params']['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x440625,null))[_0x2d4a('0x25')](removeEntity(_0x440625,null))['catch'](handleError(_0x440625,null));};exports[_0x2d4a('0x49')]=function(_0x33f413,_0x7f0807){return db[_0x2d4a('0x2b')]['describe']()[_0x2d4a('0x25')](respondWithResult(_0x7f0807,null))['catch'](handleError(_0x7f0807,null));}; \ No newline at end of file +var _0xa6b0=['nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','keys','include','find','create','body','params','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','index','map','MailQueueReport','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x21b707,_0x4d0ec8){_0x21b707=_0x21b707-0x0;var _0x293f40=_0xa6b0[_0x21b707];return _0x293f40;};'use strict';var emlformat=require(_0x0a6b('0x0'));var rimraf=require(_0x0a6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a6b('0x2'));var moment=require(_0x0a6b('0x3'));var BPromise=require(_0x0a6b('0x4'));var Mustache=require('mustache');var util=require(_0x0a6b('0x5'));var path=require(_0x0a6b('0x6'));var sox=require(_0x0a6b('0x7'));var csv=require(_0x0a6b('0x8'));var ejs=require(_0x0a6b('0x9'));var fs=require('fs');var fs_extra=require(_0x0a6b('0xa'));var _=require(_0x0a6b('0xb'));var squel=require(_0x0a6b('0xc'));var crypto=require(_0x0a6b('0xd'));var jsforce=require(_0x0a6b('0xe'));var deskjs=require(_0x0a6b('0xf'));var toCsv=require(_0x0a6b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a6b('0x10'));var authService=require(_0x0a6b('0x11'));var qs=require(_0x0a6b('0x12'));var as=require(_0x0a6b('0x13'));var hardwareService=require(_0x0a6b('0x14'));var logger=require(_0x0a6b('0x15'))(_0x0a6b('0x16'));var utils=require(_0x0a6b('0x17'));var config=require(_0x0a6b('0x18'));var licenseUtil=require(_0x0a6b('0x19'));var db=require(_0x0a6b('0x1a'))['db'];function respondWithStatusCode(_0x890493,_0x244a7d){_0x244a7d=_0x244a7d||0xcc;return function(_0x3cd9a4){if(_0x3cd9a4){return _0x890493['sendStatus'](_0x244a7d);}return _0x890493['status'](_0x244a7d)[_0x0a6b('0x1b')]();};}function respondWithResult(_0x2f27d6,_0x2abc4e){_0x2abc4e=_0x2abc4e||0xc8;return function(_0x177e87){if(_0x177e87){return _0x2f27d6[_0x0a6b('0x1c')](_0x2abc4e)[_0x0a6b('0x1d')](_0x177e87);}};}function respondWithFilteredResult(_0x9bb98e,_0x19e84c){return function(_0x1205a3){if(_0x1205a3){var _0x9d7aba=typeof _0x19e84c['offset']===_0x0a6b('0x1e')&&typeof _0x19e84c[_0x0a6b('0x1f')]==='undefined';var _0x290f7f=_0x1205a3['count'];var _0xcb412=_0x9d7aba?0x0:_0x19e84c[_0x0a6b('0x20')];var _0x2cb10b=_0x9d7aba?_0x1205a3[_0x0a6b('0x21')]:_0x19e84c['offset']+_0x19e84c[_0x0a6b('0x1f')];var _0x296162;if(_0x2cb10b>=_0x290f7f){_0x2cb10b=_0x290f7f;_0x296162=0xc8;}else{_0x296162=0xce;}_0x9bb98e['status'](_0x296162);return _0x9bb98e[_0x0a6b('0x22')](_0x0a6b('0x23'),_0xcb412+'-'+_0x2cb10b+'/'+_0x290f7f)[_0x0a6b('0x1d')](_0x1205a3);}return null;};}function patchUpdates(_0x491936){return function(_0x3ae3f4){try{jsonpatch[_0x0a6b('0x24')](_0x3ae3f4,_0x491936,!![]);}catch(_0x4077c6){return BPromise['reject'](_0x4077c6);}return _0x3ae3f4[_0x0a6b('0x25')]();};}function saveUpdates(_0x531e4c,_0xe4c2b9){return function(_0x5e8206){if(_0x5e8206){return _0x5e8206[_0x0a6b('0x26')](_0x531e4c)['then'](function(_0x1e5065){return _0x1e5065;});}return null;};}function removeEntity(_0xdda188,_0x3d153f){return function(_0x5c77fb){if(_0x5c77fb){return _0x5c77fb[_0x0a6b('0x27')]()[_0x0a6b('0x28')](function(){_0xdda188[_0x0a6b('0x1c')](0xcc)[_0x0a6b('0x1b')]();});}};}function handleEntityNotFound(_0x3b12a2,_0x5b2229){return function(_0x3e6a1d){if(!_0x3e6a1d){_0x3b12a2[_0x0a6b('0x29')](0x194);}return _0x3e6a1d;};}function handleError(_0x19a653,_0x4ce9d4){_0x4ce9d4=_0x4ce9d4||0x1f4;return function(_0x3a9092){logger['error'](_0x3a9092[_0x0a6b('0x2a')]);if(_0x3a9092[_0x0a6b('0x2b')]){delete _0x3a9092[_0x0a6b('0x2b')];}_0x19a653['status'](_0x4ce9d4)['send'](_0x3a9092);};}exports[_0x0a6b('0x2c')]=function(_0xe01bba,_0x1aecc7){var _0x3d649e={},_0x1935a3={},_0x2bbcb1={'count':0x0,'rows':[]};var _0x486f0d=_[_0x0a6b('0x2d')](db[_0x0a6b('0x2e')]['rawAttributes'],function(_0x4744d1){return{'name':_0x4744d1['fieldName'],'type':_0x4744d1['type'][_0x0a6b('0x2f')]};});_0x1935a3[_0x0a6b('0x30')]=_[_0x0a6b('0x2d')](_0x486f0d,_0x0a6b('0x2b'));_0x1935a3[_0x0a6b('0x31')]=_['keys'](_0xe01bba['query']);_0x1935a3[_0x0a6b('0x32')]=_[_0x0a6b('0x33')](_0x1935a3[_0x0a6b('0x30')],_0x1935a3[_0x0a6b('0x31')]);_0x3d649e['attributes']=_[_0x0a6b('0x33')](_0x1935a3[_0x0a6b('0x30')],qs['fields'](_0xe01bba['query'][_0x0a6b('0x34')]));_0x3d649e[_0x0a6b('0x35')]=_0x3d649e['attributes'][_0x0a6b('0x36')]?_0x3d649e[_0x0a6b('0x35')]:_0x1935a3[_0x0a6b('0x30')];if(!_0xe01bba[_0x0a6b('0x31')][_0x0a6b('0x37')](_0x0a6b('0x38'))){_0x3d649e[_0x0a6b('0x1f')]=qs[_0x0a6b('0x1f')](_0xe01bba[_0x0a6b('0x31')][_0x0a6b('0x1f')]);_0x3d649e[_0x0a6b('0x20')]=qs[_0x0a6b('0x20')](_0xe01bba['query'][_0x0a6b('0x20')]);}_0x3d649e[_0x0a6b('0x39')]=qs['sort'](_0xe01bba[_0x0a6b('0x31')][_0x0a6b('0x3a')]);_0x3d649e[_0x0a6b('0x3b')]=qs[_0x0a6b('0x32')](_[_0x0a6b('0x3c')](_0xe01bba[_0x0a6b('0x31')],_0x1935a3[_0x0a6b('0x32')]),_0x486f0d);if(_0xe01bba[_0x0a6b('0x31')][_0x0a6b('0x3d')]){_0x3d649e['where']=_[_0x0a6b('0x3e')](_0x3d649e[_0x0a6b('0x3b')],{'$or':_[_0x0a6b('0x2d')](_0x486f0d,function(_0x2f7e4b){if(_0x2f7e4b[_0x0a6b('0x3f')]!==_0x0a6b('0x40')){var _0x25254d={};_0x25254d[_0x2f7e4b[_0x0a6b('0x2b')]]={'$like':'%'+_0xe01bba[_0x0a6b('0x31')]['filter']+'%'};return _0x25254d;}})});}_0x3d649e=_[_0x0a6b('0x3e')]({},_0x3d649e,_0xe01bba[_0x0a6b('0x41')]);var _0x3aa7d5={'where':_0x3d649e[_0x0a6b('0x3b')]};return db[_0x0a6b('0x2e')][_0x0a6b('0x21')](_0x3aa7d5)[_0x0a6b('0x28')](function(_0x127e20){_0x2bbcb1[_0x0a6b('0x21')]=_0x127e20;if(_0xe01bba['query'][_0x0a6b('0x42')]){_0x3d649e['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x0a6b('0x43')](_0x3d649e);})['then'](function(_0x556a28){_0x2bbcb1[_0x0a6b('0x44')]=_0x556a28;return _0x2bbcb1;})[_0x0a6b('0x28')](respondWithFilteredResult(_0x1aecc7,_0x3d649e))[_0x0a6b('0x45')](handleError(_0x1aecc7,null));};exports['show']=function(_0x445a7b,_0x4d32bf){var _0x531f94={'raw':!![],'where':{'id':_0x445a7b['params']['id']}},_0x1114f1={};_0x1114f1[_0x0a6b('0x30')]=_['keys'](db[_0x0a6b('0x2e')]['rawAttributes']);_0x1114f1['query']=_[_0x0a6b('0x46')](_0x445a7b[_0x0a6b('0x31')]);_0x1114f1[_0x0a6b('0x32')]=_[_0x0a6b('0x33')](_0x1114f1['model'],_0x1114f1[_0x0a6b('0x31')]);_0x531f94[_0x0a6b('0x35')]=_[_0x0a6b('0x33')](_0x1114f1[_0x0a6b('0x30')],qs[_0x0a6b('0x34')](_0x445a7b[_0x0a6b('0x31')][_0x0a6b('0x34')]));_0x531f94['attributes']=_0x531f94[_0x0a6b('0x35')][_0x0a6b('0x36')]?_0x531f94[_0x0a6b('0x35')]:_0x1114f1[_0x0a6b('0x30')];if(_0x445a7b[_0x0a6b('0x31')][_0x0a6b('0x42')]){_0x531f94[_0x0a6b('0x47')]=[{'all':!![]}];}_0x531f94=_[_0x0a6b('0x3e')]({},_0x531f94,_0x445a7b[_0x0a6b('0x41')]);return db['MailQueueReport'][_0x0a6b('0x48')](_0x531f94)[_0x0a6b('0x28')](handleEntityNotFound(_0x4d32bf,null))[_0x0a6b('0x28')](respondWithResult(_0x4d32bf,null))[_0x0a6b('0x45')](handleError(_0x4d32bf,null));};exports[_0x0a6b('0x49')]=function(_0x638ba8,_0x8f1372){return db['MailQueueReport']['create'](_0x638ba8[_0x0a6b('0x4a')],{})[_0x0a6b('0x28')](respondWithResult(_0x8f1372,0xc9))[_0x0a6b('0x45')](handleError(_0x8f1372,null));};exports[_0x0a6b('0x26')]=function(_0x2ca82a,_0x446187){if(_0x2ca82a[_0x0a6b('0x4a')]['id']){delete _0x2ca82a[_0x0a6b('0x4a')]['id'];}return db[_0x0a6b('0x2e')]['find']({'where':{'id':_0x2ca82a[_0x0a6b('0x4b')]['id']}})[_0x0a6b('0x28')](handleEntityNotFound(_0x446187,null))[_0x0a6b('0x28')](saveUpdates(_0x2ca82a[_0x0a6b('0x4a')],null))[_0x0a6b('0x28')](respondWithResult(_0x446187,null))['catch'](handleError(_0x446187,null));};exports[_0x0a6b('0x27')]=function(_0x3fd0df,_0x3aa85f){return db[_0x0a6b('0x2e')][_0x0a6b('0x48')]({'where':{'id':_0x3fd0df[_0x0a6b('0x4b')]['id']}})[_0x0a6b('0x28')](handleEntityNotFound(_0x3aa85f,null))[_0x0a6b('0x28')](removeEntity(_0x3aa85f,null))[_0x0a6b('0x45')](handleError(_0x3aa85f,null));};exports[_0x0a6b('0x4c')]=function(_0x5d8a4f,_0x4c81a7){return db[_0x0a6b('0x2e')]['describe']()[_0x0a6b('0x28')](respondWithResult(_0x4c81a7,null))['catch'](handleError(_0x4c81a7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 369da82..25c474c 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 _0xb3d8=['exports','define','MailQueueReport','uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x33831a,_0x2b4583){var _0x35e657=function(_0x47e428){while(--_0x47e428){_0x33831a['push'](_0x33831a['shift']());}};_0x35e657(++_0x2b4583);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x5e036f,_0xf202a5){_0x5e036f=_0x5e036f-0x0;var _0x1544c0=_0xb3d8[_0x5e036f];return _0x1544c0;};'use strict';var _=require('lodash');var util=require(_0x8b3d('0x0'));var logger=require(_0x8b3d('0x1'))(_0x8b3d('0x2'));var moment=require(_0x8b3d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b3d('0x4'));var rimraf=require(_0x8b3d('0x5'));var config=require(_0x8b3d('0x6'));var attributes=require(_0x8b3d('0x7'));module[_0x8b3d('0x8')]=function(_0x22d97b,_0x3b0f04){return _0x22d97b[_0x8b3d('0x9')](_0x8b3d('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x8b3d('0xb'),'fields':[_0x8b3d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa681=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x575847,_0x1c6c06){var _0x5603f1=function(_0x4afbbc){while(--_0x4afbbc){_0x575847['push'](_0x575847['shift']());}};_0x5603f1(++_0x1c6c06);}(_0xa681,0x10e));var _0x1a68=function(_0x94a030,_0x4c16ce){_0x94a030=_0x94a030-0x0;var _0x52b293=_0xa681[_0x94a030];return _0x52b293;};'use strict';var _=require(_0x1a68('0x0'));var util=require(_0x1a68('0x1'));var logger=require(_0x1a68('0x2'))(_0x1a68('0x3'));var moment=require(_0x1a68('0x4'));var BPromise=require(_0x1a68('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a68('0x6'));var rimraf=require('rimraf');var config=require(_0x1a68('0x7'));var attributes=require(_0x1a68('0x8'));module[_0x1a68('0x9')]=function(_0x154e5d,_0x44ee24){return _0x154e5d[_0x1a68('0xa')](_0x1a68('0xb'),attributes,{'tableName':_0x1a68('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1a68('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index fed741d..b722c37 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x47cb09,_0x62e42f){var _0x3b2a8f=function(_0x25e03a){while(--_0x25e03a){_0x47cb09['push'](_0x47cb09['shift']());}};_0x3b2a8f(++_0x62e42f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x443fe6,_0xcc1e25){var _0x1dfbee=function(_0x4263a0){while(--_0x4263a0){_0x443fe6['push'](_0x443fe6['shift']());}};_0x1dfbee(++_0xcc1e25);}(_0x2ef3,0xba));var _0x32ef=function(_0xcf1b87,_0x8214f){_0xcf1b87=_0xcf1b87-0x0;var _0x3c83ec=_0x2ef3[_0xcf1b87];return _0x3c83ec;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4c512a1..3ae98d4 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x401ed4,_0x77cf76){var _0x302d70=function(_0x2aa77e){while(--_0x2aa77e){_0x401ed4['push'](_0x401ed4['shift']());}};_0x302d70(++_0x77cf76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1edd51,_0x225edd){var _0x4b835a=function(_0x64daeb){while(--_0x64daeb){_0x1edd51['push'](_0x1edd51['shift']());}};_0x4b835a(++_0x225edd);}(_0xedd9,0xfc));var _0x9edd=function(_0x1bd284,_0x892d2b){_0x1bd284=_0x1bd284-0x0;var _0x81f771=_0xedd9[_0x1bd284];return _0x81f771;};'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');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4023f9d..7dca3e7 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 _0xa45c=['exports','BOOLEAN','STRING','INTEGER','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa45c,0x6d));var _0xca45=function(_0x3659aa,_0x457c82){_0x3659aa=_0x3659aa-0x0;var _0x48f50c=_0xa45c[_0x3659aa];return _0x48f50c;};'use strict';var Sequelize=require(_0xca45('0x0'));module[_0xca45('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xca45('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xca45('0x3')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xca45('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xca45('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xca45('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xca45('0x3')]}}; \ No newline at end of file +var _0x4bde=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x2cccdc,_0x6e213d){var _0x26bd34=function(_0xd172af){while(--_0xd172af){_0x2cccdc['push'](_0x2cccdc['shift']());}};_0x26bd34(++_0x6e213d);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x31fe44,_0x33271b){_0x31fe44=_0x31fe44-0x0;var _0x424745=_0x4bde[_0x31fe44];return _0x424745;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'description':{'type':Sequelize[_0xe4bd('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe4bd('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe4bd('0x2')]},'password':{'type':Sequelize[_0xe4bd('0x2')]},'port':{'type':Sequelize[_0xe4bd('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe4bd('0x2')],'defaultValue':_0xe4bd('0x5')},'connTimeout':{'type':Sequelize[_0xe4bd('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe4bd('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe4bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9b4f0eb..5bc7663 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 _0xc3ce=['mail_servers_in','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0x255840,_0x11891b){var _0x191236=function(_0x2e60a9){while(--_0x2e60a9){_0x255840['push'](_0x255840['shift']());}};_0x191236(++_0x11891b);}(_0xc3ce,0x121));var _0xec3c=function(_0x368103,_0x31453f){_0x368103=_0x368103-0x0;var _0xda6164=_0xc3ce[_0x368103];return _0xda6164;};'use strict';var _=require('lodash');var util=require(_0xec3c('0x0'));var logger=require('../../config/logger')(_0xec3c('0x1'));var moment=require(_0xec3c('0x2'));var BPromise=require(_0xec3c('0x3'));var rp=require(_0xec3c('0x4'));var fs=require('fs');var path=require(_0xec3c('0x5'));var rimraf=require('rimraf');var config=require(_0xec3c('0x6'));var attributes=require(_0xec3c('0x7'));module[_0xec3c('0x8')]=function(_0x577445,_0x3a2295){return _0x577445[_0xec3c('0x9')](_0xec3c('0xa'),attributes,{'tableName':_0xec3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadd5=['exports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x3afff0,_0x165e80){var _0x37b4c7=function(_0x4c51ca){while(--_0x4c51ca){_0x3afff0['push'](_0x3afff0['shift']());}};_0x37b4c7(++_0x165e80);}(_0xadd5,0xc7));var _0x5add=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadd5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5add('0x0'));var logger=require(_0x5add('0x1'))(_0x5add('0x2'));var moment=require(_0x5add('0x3'));var BPromise=require(_0x5add('0x4'));var rp=require(_0x5add('0x5'));var fs=require('fs');var path=require(_0x5add('0x6'));var rimraf=require(_0x5add('0x7'));var config=require(_0x5add('0x8'));var attributes=require(_0x5add('0x9'));module[_0x5add('0xa')]=function(_0x13e3e5,_0x302b1e){return _0x13e3e5['define']('MailServerIn',attributes,{'tableName':'mail_servers_in','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 f2a4692..9b41dee 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 _0xaa12=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','include','model','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s'];(function(_0x364cf8,_0x146b9b){var _0x6a59ee=function(_0x3d81eb){while(--_0x3d81eb){_0x364cf8['push'](_0x364cf8['shift']());}};_0x6a59ee(++_0x146b9b);}(_0xaa12,0xec));var _0x2aa1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xaa12[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2aa1('0x0'));var util=require('util');var moment=require(_0x2aa1('0x1'));var BPromise=require(_0x2aa1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2aa1('0x3'));var db=require(_0x2aa1('0x4'))['db'];var utils=require(_0x2aa1('0x5'));var logger=require(_0x2aa1('0x6'))(_0x2aa1('0x7'));var config=require(_0x2aa1('0x8'));var jayson=require(_0x2aa1('0x9'));var client=jayson[_0x2aa1('0xa')][_0x2aa1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x434daf,_0x5100e0,_0x23a396){return new BPromise(function(_0x1e3c57,_0x5d6eb3){return client[_0x2aa1('0xc')](_0x434daf,_0x23a396)[_0x2aa1('0xd')](function(_0xe0f97e){logger[_0x2aa1('0xe')](_0x2aa1('0xf'),_0x5100e0,_0x2aa1('0x10'));logger[_0x2aa1('0x11')](_0x2aa1('0x12'),_0x5100e0,_0x2aa1('0x10'),JSON['stringify'](_0xe0f97e));if(_0xe0f97e['error']){if(_0xe0f97e[_0x2aa1('0x13')][_0x2aa1('0x14')]===0x1f4){logger[_0x2aa1('0x13')]('MailServerIn,\x20%s,\x20%s',_0x5100e0,_0xe0f97e[_0x2aa1('0x13')]['message']);return _0x5d6eb3(_0xe0f97e[_0x2aa1('0x13')][_0x2aa1('0x15')]);}logger['error'](_0x2aa1('0xf'),_0x5100e0,_0xe0f97e[_0x2aa1('0x13')][_0x2aa1('0x15')]);return _0x1e3c57(_0xe0f97e[_0x2aa1('0x13')][_0x2aa1('0x15')]);}else{logger[_0x2aa1('0xe')](_0x2aa1('0xf'),_0x5100e0,_0x2aa1('0x10'));_0x1e3c57(_0xe0f97e[_0x2aa1('0x16')][_0x2aa1('0x15')]);}})[_0x2aa1('0x17')](function(_0x3cbd9c){logger[_0x2aa1('0x13')](_0x2aa1('0xf'),_0x5100e0,_0x3cbd9c);_0x5d6eb3(_0x3cbd9c);});});}exports[_0x2aa1('0x18')]=function(_0x2a2667){var _0x54c0d1=this;return new Promise(function(_0x185b15,_0x1a1ff0){return db[_0x2aa1('0x19')][_0x2aa1('0x1a')]({'raw':_0x2a2667[_0x2aa1('0x1b')]?_0x2a2667['options'][_0x2aa1('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a2667[_0x2aa1('0x1b')]?_0x2a2667['options'][_0x2aa1('0x1d')]||null:null,'attributes':_0x2a2667[_0x2aa1('0x1b')]?_0x2a2667[_0x2aa1('0x1b')][_0x2aa1('0x1e')]||null:null,'limit':_0x2a2667[_0x2aa1('0x1b')]?_0x2a2667[_0x2aa1('0x1b')][_0x2aa1('0x1f')]||null:null,'include':_0x2a2667[_0x2aa1('0x1b')]?_0x2a2667[_0x2aa1('0x1b')]['include']?_[_0x2aa1('0x20')](_0x2a2667[_0x2aa1('0x1b')][_0x2aa1('0x21')],function(_0x3861b6){return{'model':db[_0x3861b6[_0x2aa1('0x22')]],'as':_0x3861b6['as'],'attributes':_0x3861b6[_0x2aa1('0x1e')],'include':_0x3861b6[_0x2aa1('0x21')]?_['map'](_0x3861b6[_0x2aa1('0x21')],function(_0x511164){return{'model':db[_0x511164['model']],'as':_0x511164['as'],'attributes':_0x511164[_0x2aa1('0x1e')],'include':_0x511164[_0x2aa1('0x21')]?_[_0x2aa1('0x20')](_0x511164[_0x2aa1('0x21')],function(_0x243493){return{'model':db[_0x243493[_0x2aa1('0x22')]],'as':_0x243493['as'],'attributes':_0x243493['attributes']};}):[]};}):[]};}):[]:[]})[_0x2aa1('0xd')](function(_0x374776){logger[_0x2aa1('0xe')](_0x2aa1('0x18'),_0x2a2667);logger[_0x2aa1('0x11')](_0x2aa1('0x18'),_0x2a2667,JSON[_0x2aa1('0x23')](_0x374776));_0x185b15(_0x374776);})[_0x2aa1('0x17')](function(_0x2e18f1){logger[_0x2aa1('0x13')]('GetMailServerIn',_0x2e18f1[_0x2aa1('0x15')],_0x2a2667);_0x1a1ff0(_0x54c0d1[_0x2aa1('0x13')](0x1f4,_0x2e18f1[_0x2aa1('0x15')]));});});}; \ No newline at end of file +var _0xd0be=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetMailServerIn','MailServerIn','options','raw','attributes','limit','map','include','model'];(function(_0x3d75d4,_0x1952c8){var _0x452e55=function(_0x4a2b4a){while(--_0x4a2b4a){_0x3d75d4['push'](_0x3d75d4['shift']());}};_0x452e55(++_0x1952c8);}(_0xd0be,0x1a0));var _0xed0b=function(_0x2d6d24,_0xaf0aec){_0x2d6d24=_0x2d6d24-0x0;var _0x37607e=_0xd0be[_0x2d6d24];return _0x37607e;};'use strict';var _=require(_0xed0b('0x0'));var util=require(_0xed0b('0x1'));var moment=require(_0xed0b('0x2'));var BPromise=require(_0xed0b('0x3'));var rs=require(_0xed0b('0x4'));var fs=require('fs');var Redis=require(_0xed0b('0x5'));var db=require(_0xed0b('0x6'))['db'];var utils=require(_0xed0b('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xed0b('0x8'));var client=jayson[_0xed0b('0x9')][_0xed0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x234dcd,_0x20c99d,_0x3b8c09){return new BPromise(function(_0xa4213d,_0x1848f4){return client['request'](_0x234dcd,_0x3b8c09)[_0xed0b('0xb')](function(_0x529957){logger[_0xed0b('0xc')](_0xed0b('0xd'),_0x20c99d,_0xed0b('0xe'));logger[_0xed0b('0xf')](_0xed0b('0x10'),_0x20c99d,_0xed0b('0xe'),JSON[_0xed0b('0x11')](_0x529957));if(_0x529957['error']){if(_0x529957['error'][_0xed0b('0x12')]===0x1f4){logger[_0xed0b('0x13')]('MailServerIn,\x20%s,\x20%s',_0x20c99d,_0x529957['error'][_0xed0b('0x14')]);return _0x1848f4(_0x529957[_0xed0b('0x13')][_0xed0b('0x14')]);}logger[_0xed0b('0x13')](_0xed0b('0xd'),_0x20c99d,_0x529957['error']['message']);return _0xa4213d(_0x529957[_0xed0b('0x13')][_0xed0b('0x14')]);}else{logger['info'](_0xed0b('0xd'),_0x20c99d,_0xed0b('0xe'));_0xa4213d(_0x529957[_0xed0b('0x15')][_0xed0b('0x14')]);}})[_0xed0b('0x16')](function(_0x5aa35b){logger['error'](_0xed0b('0xd'),_0x20c99d,_0x5aa35b);_0x1848f4(_0x5aa35b);});});}exports[_0xed0b('0x17')]=function(_0x444f9b){var _0x3e22d3=this;return new Promise(function(_0x3b9307,_0x12600a){return db[_0xed0b('0x18')]['findAll']({'raw':_0x444f9b[_0xed0b('0x19')]?_0x444f9b[_0xed0b('0x19')][_0xed0b('0x1a')]===undefined?!![]:![]:!![],'where':_0x444f9b[_0xed0b('0x19')]?_0x444f9b[_0xed0b('0x19')]['where']||null:null,'attributes':_0x444f9b[_0xed0b('0x19')]?_0x444f9b[_0xed0b('0x19')][_0xed0b('0x1b')]||null:null,'limit':_0x444f9b['options']?_0x444f9b[_0xed0b('0x19')][_0xed0b('0x1c')]||null:null,'include':_0x444f9b[_0xed0b('0x19')]?_0x444f9b['options']['include']?_[_0xed0b('0x1d')](_0x444f9b[_0xed0b('0x19')][_0xed0b('0x1e')],function(_0x36bc17){return{'model':db[_0x36bc17[_0xed0b('0x1f')]],'as':_0x36bc17['as'],'attributes':_0x36bc17[_0xed0b('0x1b')],'include':_0x36bc17[_0xed0b('0x1e')]?_[_0xed0b('0x1d')](_0x36bc17[_0xed0b('0x1e')],function(_0x7f27a5){return{'model':db[_0x7f27a5[_0xed0b('0x1f')]],'as':_0x7f27a5['as'],'attributes':_0x7f27a5[_0xed0b('0x1b')],'include':_0x7f27a5[_0xed0b('0x1e')]?_['map'](_0x7f27a5['include'],function(_0xf4de62){return{'model':db[_0xf4de62[_0xed0b('0x1f')]],'as':_0xf4de62['as'],'attributes':_0xf4de62[_0xed0b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xed0b('0xb')](function(_0x54249f){logger[_0xed0b('0xc')](_0xed0b('0x17'),_0x444f9b);logger['debug'](_0xed0b('0x17'),_0x444f9b,JSON['stringify'](_0x54249f));_0x3b9307(_0x54249f);})[_0xed0b('0x16')](function(_0x4896c3){logger[_0xed0b('0x13')]('GetMailServerIn',_0x4896c3['message'],_0x444f9b);_0x12600a(_0x3e22d3[_0xed0b('0x13')](0x1f4,_0x4896c3[_0xed0b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 76883c3..7d787e8 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(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0x53ab4e,_0x203f14){_0x53ab4e=_0x53ab4e-0x0;var _0x1ee926=_0x7a54[_0x53ab4e];return _0x1ee926;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index b2aa98a..184e539 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 _0x191a=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x191a,0xaa));var _0xa191=function(_0x1d8035,_0x54d6ef){_0x1d8035=_0x1d8035-0x0;var _0x12f419=_0x191a[_0x1d8035];return _0x12f419;};'use strict';var Sequelize=require(_0xa191('0x0'));module[_0xa191('0x1')]={'description':{'type':Sequelize[_0xa191('0x2')]},'host':{'type':Sequelize[_0xa191('0x2')]},'user':{'type':Sequelize[_0xa191('0x2')]},'pass':{'type':Sequelize[_0xa191('0x2')]},'port':{'type':Sequelize[_0xa191('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xa191('0x2')]},'authentication':{'type':Sequelize[_0xa191('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x57ff=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x57ff,0x82));var _0xf57f=function(_0x56a0ba,_0x385c98){_0x56a0ba=_0x56a0ba-0x0;var _0x53e044=_0x57ff[_0x56a0ba];return _0x53e044;};'use strict';var Sequelize=require(_0xf57f('0x0'));module[_0xf57f('0x1')]={'description':{'type':Sequelize[_0xf57f('0x2')]},'host':{'type':Sequelize[_0xf57f('0x2')]},'user':{'type':Sequelize[_0xf57f('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf57f('0x3')]},'secure':{'type':Sequelize[_0xf57f('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xf57f('0x2')]},'authentication':{'type':Sequelize[_0xf57f('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 7b139ff..8ced33c 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 _0xf198=['type','key','query','filters','intersection','model','fields','attributes','length','nolimit','where','merge','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','include','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../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','then','destroy','error','stack','name','index','map','MailServerOut','rawAttributes'];(function(_0x5bb1bb,_0x4dbf56){var _0x2c73aa=function(_0x56b2af){while(--_0x56b2af){_0x5bb1bb['push'](_0x5bb1bb['shift']());}};_0x2c73aa(++_0x4dbf56);}(_0xf198,0x1be));var _0x8f19=function(_0x3710c2,_0x4aff48){_0x3710c2=_0x3710c2-0x0;var _0x4c815f=_0xf198[_0x3710c2];return _0x4c815f;};'use strict';var emlformat=require(_0x8f19('0x0'));var rimraf=require(_0x8f19('0x1'));var zipdir=require(_0x8f19('0x2'));var jsonpatch=require(_0x8f19('0x3'));var rp=require('request-promise');var moment=require(_0x8f19('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8f19('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8f19('0x6'));var csv=require(_0x8f19('0x7'));var ejs=require(_0x8f19('0x8'));var fs=require('fs');var fs_extra=require(_0x8f19('0x9'));var _=require(_0x8f19('0xa'));var squel=require(_0x8f19('0xb'));var crypto=require('crypto');var jsforce=require(_0x8f19('0xc'));var deskjs=require(_0x8f19('0xd'));var toCsv=require(_0x8f19('0x7'));var querystring=require('querystring');var Papa=require(_0x8f19('0xe'));var Redis=require(_0x8f19('0xf'));var authService=require(_0x8f19('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8f19('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f19('0x12'))('api');var utils=require(_0x8f19('0x13'));var config=require(_0x8f19('0x14'));var licenseUtil=require(_0x8f19('0x15'));var db=require(_0x8f19('0x16'))['db'];function respondWithStatusCode(_0x22b6bf,_0x1df648){_0x1df648=_0x1df648||0xcc;return function(_0x5478b1){if(_0x5478b1){return _0x22b6bf[_0x8f19('0x17')](_0x1df648);}return _0x22b6bf[_0x8f19('0x18')](_0x1df648)[_0x8f19('0x19')]();};}function respondWithResult(_0x270e22,_0x44034b){_0x44034b=_0x44034b||0xc8;return function(_0x44e54b){if(_0x44e54b){return _0x270e22[_0x8f19('0x18')](_0x44034b)[_0x8f19('0x1a')](_0x44e54b);}};}function respondWithFilteredResult(_0x104ae0,_0x1cb8f2){return function(_0x552030){if(_0x552030){var _0x50c6d9=typeof _0x1cb8f2[_0x8f19('0x1b')]===_0x8f19('0x1c')&&typeof _0x1cb8f2[_0x8f19('0x1d')]==='undefined';var _0x48e905=_0x552030[_0x8f19('0x1e')];var _0x2bd030=_0x50c6d9?0x0:_0x1cb8f2[_0x8f19('0x1b')];var _0x3ae76a=_0x50c6d9?_0x552030[_0x8f19('0x1e')]:_0x1cb8f2[_0x8f19('0x1b')]+_0x1cb8f2[_0x8f19('0x1d')];var _0x4fb01d;if(_0x3ae76a>=_0x48e905){_0x3ae76a=_0x48e905;_0x4fb01d=0xc8;}else{_0x4fb01d=0xce;}_0x104ae0['status'](_0x4fb01d);return _0x104ae0[_0x8f19('0x1f')](_0x8f19('0x20'),_0x2bd030+'-'+_0x3ae76a+'/'+_0x48e905)[_0x8f19('0x1a')](_0x552030);}return null;};}function patchUpdates(_0x438852){return function(_0x5db1f1){try{jsonpatch[_0x8f19('0x21')](_0x5db1f1,_0x438852,!![]);}catch(_0x8beb39){return BPromise[_0x8f19('0x22')](_0x8beb39);}return _0x5db1f1['save']();};}function saveUpdates(_0xe947de,_0x3c9a57){return function(_0x3f9043){if(_0x3f9043){return _0x3f9043['update'](_0xe947de)[_0x8f19('0x23')](function(_0x16d82d){return _0x16d82d;});}return null;};}function removeEntity(_0x4c2848,_0x1b91e6){return function(_0x1498cd){if(_0x1498cd){return _0x1498cd[_0x8f19('0x24')]()['then'](function(){_0x4c2848[_0x8f19('0x18')](0xcc)[_0x8f19('0x19')]();});}};}function handleEntityNotFound(_0x3f5f54,_0x3332b1){return function(_0x18401b){if(!_0x18401b){_0x3f5f54[_0x8f19('0x17')](0x194);}return _0x18401b;};}function handleError(_0x53de6b,_0x58458c){_0x58458c=_0x58458c||0x1f4;return function(_0x1c5626){logger[_0x8f19('0x25')](_0x1c5626[_0x8f19('0x26')]);if(_0x1c5626[_0x8f19('0x27')]){delete _0x1c5626[_0x8f19('0x27')];}_0x53de6b['status'](_0x58458c)['send'](_0x1c5626);};}exports[_0x8f19('0x28')]=function(_0x1ef9a1,_0x127f0e){var _0x2136ea={},_0x459173={},_0x3d39d6={'count':0x0,'rows':[]};var _0x5cfa41=_[_0x8f19('0x29')](db[_0x8f19('0x2a')][_0x8f19('0x2b')],function(_0x3d2196){return{'name':_0x3d2196['fieldName'],'type':_0x3d2196[_0x8f19('0x2c')][_0x8f19('0x2d')]};});_0x459173['model']=_[_0x8f19('0x29')](_0x5cfa41,_0x8f19('0x27'));_0x459173[_0x8f19('0x2e')]=_['keys'](_0x1ef9a1[_0x8f19('0x2e')]);_0x459173[_0x8f19('0x2f')]=_[_0x8f19('0x30')](_0x459173[_0x8f19('0x31')],_0x459173['query']);_0x2136ea['attributes']=_[_0x8f19('0x30')](_0x459173[_0x8f19('0x31')],qs[_0x8f19('0x32')](_0x1ef9a1[_0x8f19('0x2e')][_0x8f19('0x32')]));_0x2136ea[_0x8f19('0x33')]=_0x2136ea[_0x8f19('0x33')][_0x8f19('0x34')]?_0x2136ea['attributes']:_0x459173[_0x8f19('0x31')];if(!_0x1ef9a1[_0x8f19('0x2e')]['hasOwnProperty'](_0x8f19('0x35'))){_0x2136ea['limit']=qs[_0x8f19('0x1d')](_0x1ef9a1['query']['limit']);_0x2136ea[_0x8f19('0x1b')]=qs[_0x8f19('0x1b')](_0x1ef9a1[_0x8f19('0x2e')][_0x8f19('0x1b')]);}_0x2136ea['order']=qs['sort'](_0x1ef9a1['query']['sort']);_0x2136ea[_0x8f19('0x36')]=qs[_0x8f19('0x2f')](_['pick'](_0x1ef9a1[_0x8f19('0x2e')],_0x459173[_0x8f19('0x2f')]),_0x5cfa41);if(_0x1ef9a1['query']['filter']){_0x2136ea[_0x8f19('0x36')]=_[_0x8f19('0x37')](_0x2136ea[_0x8f19('0x36')],{'$or':_[_0x8f19('0x29')](_0x5cfa41,function(_0x1c1f6c){if(_0x1c1f6c['type']!==_0x8f19('0x38')){var _0x2f03fc={};_0x2f03fc[_0x1c1f6c[_0x8f19('0x27')]]={'$like':'%'+_0x1ef9a1[_0x8f19('0x2e')]['filter']+'%'};return _0x2f03fc;}})});}_0x2136ea=_['merge']({},_0x2136ea,_0x1ef9a1[_0x8f19('0x39')]);var _0x38d706={'where':_0x2136ea[_0x8f19('0x36')]};return db[_0x8f19('0x2a')][_0x8f19('0x1e')](_0x38d706)[_0x8f19('0x23')](function(_0x1a50dc){_0x3d39d6['count']=_0x1a50dc;if(_0x1ef9a1[_0x8f19('0x2e')]['includeAll']){_0x2136ea['include']=[{'all':!![]}];}return db[_0x8f19('0x2a')][_0x8f19('0x3a')](_0x2136ea);})['then'](function(_0x5e845){_0x3d39d6[_0x8f19('0x3b')]=_0x5e845;return _0x3d39d6;})['then'](respondWithFilteredResult(_0x127f0e,_0x2136ea))['catch'](handleError(_0x127f0e,null));};exports[_0x8f19('0x3c')]=function(_0x3d1cfe,_0x5d8317){var _0x3ea0ca={'raw':!![],'where':{'id':_0x3d1cfe[_0x8f19('0x3d')]['id']}},_0x262409={};_0x262409['model']=_[_0x8f19('0x3e')](db['MailServerOut'][_0x8f19('0x2b')]);_0x262409[_0x8f19('0x2e')]=_[_0x8f19('0x3e')](_0x3d1cfe[_0x8f19('0x2e')]);_0x262409[_0x8f19('0x2f')]=_[_0x8f19('0x30')](_0x262409[_0x8f19('0x31')],_0x262409['query']);_0x3ea0ca[_0x8f19('0x33')]=_[_0x8f19('0x30')](_0x262409[_0x8f19('0x31')],qs['fields'](_0x3d1cfe['query']['fields']));_0x3ea0ca[_0x8f19('0x33')]=_0x3ea0ca['attributes'][_0x8f19('0x34')]?_0x3ea0ca[_0x8f19('0x33')]:_0x262409[_0x8f19('0x31')];if(_0x3d1cfe[_0x8f19('0x2e')][_0x8f19('0x3f')]){_0x3ea0ca[_0x8f19('0x40')]=[{'all':!![]}];}_0x3ea0ca=_['merge']({},_0x3ea0ca,_0x3d1cfe[_0x8f19('0x39')]);return db[_0x8f19('0x2a')][_0x8f19('0x41')](_0x3ea0ca)['then'](handleEntityNotFound(_0x5d8317,null))[_0x8f19('0x23')](respondWithResult(_0x5d8317,null))['catch'](handleError(_0x5d8317,null));};exports[_0x8f19('0x42')]=function(_0x5b3a60,_0x2e3a78){return db[_0x8f19('0x2a')]['create'](_0x5b3a60[_0x8f19('0x43')],{})[_0x8f19('0x23')](respondWithResult(_0x2e3a78,0xc9))[_0x8f19('0x44')](handleError(_0x2e3a78,null));};exports[_0x8f19('0x45')]=function(_0x3fcb85,_0x4b5667){if(_0x3fcb85[_0x8f19('0x43')]['id']){delete _0x3fcb85[_0x8f19('0x43')]['id'];}return db[_0x8f19('0x2a')][_0x8f19('0x41')]({'where':{'id':_0x3fcb85[_0x8f19('0x3d')]['id']}})[_0x8f19('0x23')](handleEntityNotFound(_0x4b5667,null))[_0x8f19('0x23')](saveUpdates(_0x3fcb85[_0x8f19('0x43')],null))[_0x8f19('0x23')](respondWithResult(_0x4b5667,null))[_0x8f19('0x44')](handleError(_0x4b5667,null));};exports['destroy']=function(_0x16a1e7,_0x30f976){return db[_0x8f19('0x2a')]['find']({'where':{'id':_0x16a1e7[_0x8f19('0x3d')]['id']}})[_0x8f19('0x23')](handleEntityNotFound(_0x30f976,null))[_0x8f19('0x23')](removeEntity(_0x30f976,null))['catch'](handleError(_0x30f976,null));}; \ No newline at end of file +var _0x75c6=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','name','send','map','MailServerOut','rawAttributes','type','key','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','create','body','find','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x75c6,0x19b));var _0x675c=function(_0xf74ddb,_0x8383bd){_0xf74ddb=_0xf74ddb-0x0;var _0x44e4cd=_0x75c6[_0xf74ddb];return _0x44e4cd;};'use strict';var emlformat=require(_0x675c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x675c('0x1'));var moment=require(_0x675c('0x2'));var BPromise=require(_0x675c('0x3'));var Mustache=require(_0x675c('0x4'));var util=require(_0x675c('0x5'));var path=require(_0x675c('0x6'));var sox=require(_0x675c('0x7'));var csv=require(_0x675c('0x8'));var ejs=require(_0x675c('0x9'));var fs=require('fs');var fs_extra=require(_0x675c('0xa'));var _=require(_0x675c('0xb'));var squel=require('squel');var crypto=require(_0x675c('0xc'));var jsforce=require(_0x675c('0xd'));var deskjs=require(_0x675c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x675c('0xf'));var Papa=require(_0x675c('0x10'));var Redis=require(_0x675c('0x11'));var authService=require(_0x675c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x675c('0x13'));var logger=require('../../config/logger')(_0x675c('0x14'));var utils=require(_0x675c('0x15'));var config=require(_0x675c('0x16'));var licenseUtil=require(_0x675c('0x17'));var db=require(_0x675c('0x18'))['db'];function respondWithStatusCode(_0x5137db,_0x13d0ca){_0x13d0ca=_0x13d0ca||0xcc;return function(_0x2a9ab3){if(_0x2a9ab3){return _0x5137db[_0x675c('0x19')](_0x13d0ca);}return _0x5137db[_0x675c('0x1a')](_0x13d0ca)[_0x675c('0x1b')]();};}function respondWithResult(_0x2454d7,_0x206fd1){_0x206fd1=_0x206fd1||0xc8;return function(_0xb304ec){if(_0xb304ec){return _0x2454d7['status'](_0x206fd1)[_0x675c('0x1c')](_0xb304ec);}};}function respondWithFilteredResult(_0x57f5e1,_0x472d09){return function(_0x480bb7){if(_0x480bb7){var _0x116452=typeof _0x472d09[_0x675c('0x1d')]===_0x675c('0x1e')&&typeof _0x472d09[_0x675c('0x1f')]===_0x675c('0x1e');var _0xe73a58=_0x480bb7['count'];var _0x198ab3=_0x116452?0x0:_0x472d09[_0x675c('0x1d')];var _0x5c0910=_0x116452?_0x480bb7[_0x675c('0x20')]:_0x472d09[_0x675c('0x1d')]+_0x472d09[_0x675c('0x1f')];var _0x555e66;if(_0x5c0910>=_0xe73a58){_0x5c0910=_0xe73a58;_0x555e66=0xc8;}else{_0x555e66=0xce;}_0x57f5e1['status'](_0x555e66);return _0x57f5e1[_0x675c('0x21')](_0x675c('0x22'),_0x198ab3+'-'+_0x5c0910+'/'+_0xe73a58)['json'](_0x480bb7);}return null;};}function patchUpdates(_0x235610){return function(_0x406477){try{jsonpatch['apply'](_0x406477,_0x235610,!![]);}catch(_0x3324e5){return BPromise['reject'](_0x3324e5);}return _0x406477[_0x675c('0x23')]();};}function saveUpdates(_0x574d14,_0x3fd8aa){return function(_0x1e2c48){if(_0x1e2c48){return _0x1e2c48[_0x675c('0x24')](_0x574d14)['then'](function(_0x2f6a98){return _0x2f6a98;});}return null;};}function removeEntity(_0x1ec21b,_0xd00125){return function(_0x54e991){if(_0x54e991){return _0x54e991['destroy']()[_0x675c('0x25')](function(){_0x1ec21b[_0x675c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c23ee,_0x17f331){return function(_0x31bc9c){if(!_0x31bc9c){_0x5c23ee['sendStatus'](0x194);}return _0x31bc9c;};}function handleError(_0x2dfb9c,_0x4608cd){_0x4608cd=_0x4608cd||0x1f4;return function(_0x537444){logger[_0x675c('0x26')](_0x537444['stack']);if(_0x537444[_0x675c('0x27')]){delete _0x537444['name'];}_0x2dfb9c[_0x675c('0x1a')](_0x4608cd)[_0x675c('0x28')](_0x537444);};}exports['index']=function(_0x338763,_0xc97bcf){var _0x27b67c={},_0xb5eed7={},_0x1c9116={'count':0x0,'rows':[]};var _0x9ce3de=_[_0x675c('0x29')](db[_0x675c('0x2a')][_0x675c('0x2b')],function(_0x25d6cd){return{'name':_0x25d6cd['fieldName'],'type':_0x25d6cd[_0x675c('0x2c')][_0x675c('0x2d')]};});_0xb5eed7[_0x675c('0x2e')]=_[_0x675c('0x29')](_0x9ce3de,_0x675c('0x27'));_0xb5eed7[_0x675c('0x2f')]=_['keys'](_0x338763['query']);_0xb5eed7['filters']=_['intersection'](_0xb5eed7[_0x675c('0x2e')],_0xb5eed7[_0x675c('0x2f')]);_0x27b67c[_0x675c('0x30')]=_['intersection'](_0xb5eed7[_0x675c('0x2e')],qs[_0x675c('0x31')](_0x338763['query'][_0x675c('0x31')]));_0x27b67c[_0x675c('0x30')]=_0x27b67c[_0x675c('0x30')]['length']?_0x27b67c[_0x675c('0x30')]:_0xb5eed7['model'];if(!_0x338763[_0x675c('0x2f')][_0x675c('0x32')](_0x675c('0x33'))){_0x27b67c[_0x675c('0x1f')]=qs['limit'](_0x338763[_0x675c('0x2f')][_0x675c('0x1f')]);_0x27b67c[_0x675c('0x1d')]=qs[_0x675c('0x1d')](_0x338763[_0x675c('0x2f')]['offset']);}_0x27b67c[_0x675c('0x34')]=qs[_0x675c('0x35')](_0x338763[_0x675c('0x2f')]['sort']);_0x27b67c[_0x675c('0x36')]=qs[_0x675c('0x37')](_[_0x675c('0x38')](_0x338763[_0x675c('0x2f')],_0xb5eed7[_0x675c('0x37')]),_0x9ce3de);if(_0x338763[_0x675c('0x2f')][_0x675c('0x39')]){_0x27b67c[_0x675c('0x36')]=_['merge'](_0x27b67c[_0x675c('0x36')],{'$or':_['map'](_0x9ce3de,function(_0x471339){if(_0x471339[_0x675c('0x2c')]!=='VIRTUAL'){var _0x41708d={};_0x41708d[_0x471339[_0x675c('0x27')]]={'$like':'%'+_0x338763[_0x675c('0x2f')][_0x675c('0x39')]+'%'};return _0x41708d;}})});}_0x27b67c=_[_0x675c('0x3a')]({},_0x27b67c,_0x338763[_0x675c('0x3b')]);var _0x520d67={'where':_0x27b67c['where']};return db['MailServerOut']['count'](_0x520d67)[_0x675c('0x25')](function(_0x5e2527){_0x1c9116['count']=_0x5e2527;if(_0x338763['query'][_0x675c('0x3c')]){_0x27b67c[_0x675c('0x3d')]=[{'all':!![]}];}return db[_0x675c('0x2a')][_0x675c('0x3e')](_0x27b67c);})[_0x675c('0x25')](function(_0x4e57f4){_0x1c9116[_0x675c('0x3f')]=_0x4e57f4;return _0x1c9116;})[_0x675c('0x25')](respondWithFilteredResult(_0xc97bcf,_0x27b67c))[_0x675c('0x40')](handleError(_0xc97bcf,null));};exports[_0x675c('0x41')]=function(_0x94c4f6,_0x7f4383){var _0x1b3a32={'raw':!![],'where':{'id':_0x94c4f6[_0x675c('0x42')]['id']}},_0xad69d9={};_0xad69d9[_0x675c('0x2e')]=_['keys'](db[_0x675c('0x2a')][_0x675c('0x2b')]);_0xad69d9[_0x675c('0x2f')]=_['keys'](_0x94c4f6[_0x675c('0x2f')]);_0xad69d9[_0x675c('0x37')]=_[_0x675c('0x43')](_0xad69d9[_0x675c('0x2e')],_0xad69d9[_0x675c('0x2f')]);_0x1b3a32[_0x675c('0x30')]=_['intersection'](_0xad69d9[_0x675c('0x2e')],qs[_0x675c('0x31')](_0x94c4f6[_0x675c('0x2f')][_0x675c('0x31')]));_0x1b3a32[_0x675c('0x30')]=_0x1b3a32[_0x675c('0x30')][_0x675c('0x44')]?_0x1b3a32[_0x675c('0x30')]:_0xad69d9[_0x675c('0x2e')];if(_0x94c4f6[_0x675c('0x2f')][_0x675c('0x3c')]){_0x1b3a32[_0x675c('0x3d')]=[{'all':!![]}];}_0x1b3a32=_['merge']({},_0x1b3a32,_0x94c4f6[_0x675c('0x3b')]);return db[_0x675c('0x2a')]['find'](_0x1b3a32)['then'](handleEntityNotFound(_0x7f4383,null))[_0x675c('0x25')](respondWithResult(_0x7f4383,null))['catch'](handleError(_0x7f4383,null));};exports[_0x675c('0x45')]=function(_0x15554a,_0x57116f){return db['MailServerOut']['create'](_0x15554a[_0x675c('0x46')],{})['then'](respondWithResult(_0x57116f,0xc9))[_0x675c('0x40')](handleError(_0x57116f,null));};exports[_0x675c('0x24')]=function(_0x17088f,_0x562245){if(_0x17088f['body']['id']){delete _0x17088f['body']['id'];}return db[_0x675c('0x2a')][_0x675c('0x47')]({'where':{'id':_0x17088f['params']['id']}})[_0x675c('0x25')](handleEntityNotFound(_0x562245,null))[_0x675c('0x25')](saveUpdates(_0x17088f[_0x675c('0x46')],null))['then'](respondWithResult(_0x562245,null))[_0x675c('0x40')](handleError(_0x562245,null));};exports['destroy']=function(_0xfffa15,_0x36ba70){return db[_0x675c('0x2a')][_0x675c('0x47')]({'where':{'id':_0xfffa15['params']['id']}})[_0x675c('0x25')](handleEntityNotFound(_0x36ba70,null))[_0x675c('0x25')](removeEntity(_0x36ba70,null))['catch'](handleError(_0x36ba70,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c44b2c5..65dbc9f 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 _0x7100=['bluebird','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','util','../../config/logger','api','moment'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7100,0x104));var _0x0710=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x7100[_0x9df3d8];return _0x366da1;};'use strict';var _=require('lodash');var util=require(_0x0710('0x0'));var logger=require(_0x0710('0x1'))(_0x0710('0x2'));var moment=require(_0x0710('0x3'));var BPromise=require(_0x0710('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0710('0x5'));var rimraf=require('rimraf');var config=require(_0x0710('0x6'));var attributes=require(_0x0710('0x7'));module[_0x0710('0x8')]=function(_0x5d77d8,_0x43414b){return _0x5d77d8[_0x0710('0x9')](_0x0710('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x991c=['moment','request-promise','path','rimraf','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x991c,0x1b4));var _0xc991=function(_0x236c64,_0x9b42dd){_0x236c64=_0x236c64-0x0;var _0x5b35b5=_0x991c[_0x236c64];return _0x5b35b5;};'use strict';var _=require(_0xc991('0x0'));var util=require(_0xc991('0x1'));var logger=require(_0xc991('0x2'))(_0xc991('0x3'));var moment=require(_0xc991('0x4'));var BPromise=require('bluebird');var rp=require(_0xc991('0x5'));var fs=require('fs');var path=require(_0xc991('0x6'));var rimraf=require(_0xc991('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x4f375e,_0x2fc4f0){return _0x4f375e[_0xc991('0x8')](_0xc991('0x9'),attributes,{'tableName':_0xc991('0xa'),'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 7b49dd8..ef858cd 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4d4227,_0x10e725){var _0x53e70d=function(_0x1e1962){while(--_0x1e1962){_0x4d4227['push'](_0x4d4227['shift']());}};_0x53e70d(++_0x10e725);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x54d5ba,_0x1f1ba9){var _0x6a592e=function(_0x394f8d){while(--_0x394f8d){_0x54d5ba['push'](_0x54d5ba['shift']());}};_0x6a592e(++_0x1f1ba9);}(_0x2ef3,0xba));var _0x32ef=function(_0x10abcd,_0x2fd20b){_0x10abcd=_0x10abcd-0x0;var _0x22a5f3=_0x2ef3[_0x10abcd];return _0x22a5f3;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c90f34b..dca30ff 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 _0x3edc=['Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','multer','path','connect-timeout','express'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x3edc,0xf3));var _0xc3ed=function(_0x162802,_0x555c15){_0x162802=_0x162802-0x0;var _0x24d606=_0x3edc[_0x162802];return _0x24d606;};'use strict';var multer=require(_0xc3ed('0x0'));var util=require('util');var path=require(_0xc3ed('0x1'));var timeout=require(_0xc3ed('0x2'));var express=require(_0xc3ed('0x3'));var router=express[_0xc3ed('0x4')]();var fs_extra=require(_0xc3ed('0x5'));var auth=require(_0xc3ed('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc3ed('0x7'));var controller=require(_0xc3ed('0x8'));router[_0xc3ed('0x9')]('/',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0xb')]);router['get']('/describe',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0xc')]);router[_0xc3ed('0x9')](_0xc3ed('0xd'),auth[_0xc3ed('0xa')](),controller[_0xc3ed('0xe')]);router[_0xc3ed('0xf')]('/',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0x10')]);router['put'](_0xc3ed('0xd'),auth[_0xc3ed('0xa')](),controller[_0xc3ed('0x11')]);router[_0xc3ed('0x12')](_0xc3ed('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x31ec=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','create','put','update','/:id','destroy','exports','multer','path','Router'];(function(_0x1d57bc,_0x5c92dd){var _0x28b8e6=function(_0x1f6e8a){while(--_0x1f6e8a){_0x1d57bc['push'](_0x1d57bc['shift']());}};_0x28b8e6(++_0x5c92dd);}(_0x31ec,0x141));var _0xc31e=function(_0x1101c9,_0x56ece2){_0x1101c9=_0x1101c9-0x0;var _0x3fef5d=_0x31ec[_0x1101c9];return _0x3fef5d;};'use strict';var multer=require(_0xc31e('0x0'));var util=require('util');var path=require(_0xc31e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc31e('0x2')]();var fs_extra=require(_0xc31e('0x3'));var auth=require(_0xc31e('0x4'));var interaction=require(_0xc31e('0x5'));var config=require(_0xc31e('0x6'));var controller=require(_0xc31e('0x7'));router[_0xc31e('0x8')]('/',auth[_0xc31e('0x9')](),controller['index']);router['get'](_0xc31e('0xa'),auth[_0xc31e('0x9')](),controller[_0xc31e('0xb')]);router[_0xc31e('0x8')]('/:id',auth[_0xc31e('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc31e('0xc')]);router[_0xc31e('0xd')]('/:id',auth[_0xc31e('0x9')](),controller[_0xc31e('0xe')]);router['delete'](_0xc31e('0xf'),auth['isAuthenticated'](),controller[_0xc31e('0x10')]);module[_0xc31e('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index c670492..ed3cbb4 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 _0x4300=['sequelize'];(function(_0x19ecd5,_0x42f938){var _0x4fa962=function(_0x4e60ff){while(--_0x4e60ff){_0x19ecd5['push'](_0x19ecd5['shift']());}};_0x4fa962(++_0x42f938);}(_0x4300,0x1a6));var _0x0430=function(_0x175b76,_0x543c8e){_0x175b76=_0x175b76-0x0;var _0x4cc50e=_0x4300[_0x175b76];return _0x4cc50e;};'use strict';var Sequelize=require(_0x0430('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf072=['STRING','sequelize','exports'];(function(_0x20320f,_0x2280a5){var _0x3c95f0=function(_0x2fa027){while(--_0x2fa027){_0x20320f['push'](_0x20320f['shift']());}};_0x3c95f0(++_0x2280a5);}(_0xf072,0x1cf));var _0x2f07=function(_0x37855b,_0x553fe9){_0x37855b=_0x37855b-0x0;var _0x5b6157=_0xf072[_0x37855b];return _0x5b6157;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'name':{'type':Sequelize[_0x2f07('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2f07('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 9e35e9e..b62f749 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 _0x5c58=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','error','stack','map','MailSubstatus','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','then','catch','show','params','intersection','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x591f03,_0x375a57){var _0x561fb0=function(_0x114f82){while(--_0x114f82){_0x591f03['push'](_0x591f03['shift']());}};_0x561fb0(++_0x375a57);}(_0x5c58,0xd6));var _0x85c5=function(_0x1d9be5,_0x4bd8a5){_0x1d9be5=_0x1d9be5-0x0;var _0x2501c7=_0x5c58[_0x1d9be5];return _0x2501c7;};'use strict';var emlformat=require(_0x85c5('0x0'));var rimraf=require(_0x85c5('0x1'));var zipdir=require(_0x85c5('0x2'));var jsonpatch=require(_0x85c5('0x3'));var rp=require(_0x85c5('0x4'));var moment=require(_0x85c5('0x5'));var BPromise=require(_0x85c5('0x6'));var Mustache=require(_0x85c5('0x7'));var util=require(_0x85c5('0x8'));var path=require(_0x85c5('0x9'));var sox=require('sox');var csv=require(_0x85c5('0xa'));var ejs=require(_0x85c5('0xb'));var fs=require('fs');var fs_extra=require(_0x85c5('0xc'));var _=require('lodash');var squel=require(_0x85c5('0xd'));var crypto=require(_0x85c5('0xe'));var jsforce=require(_0x85c5('0xf'));var deskjs=require(_0x85c5('0x10'));var toCsv=require(_0x85c5('0xa'));var querystring=require(_0x85c5('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x85c5('0x12'));var as=require(_0x85c5('0x13'));var hardwareService=require(_0x85c5('0x14'));var logger=require(_0x85c5('0x15'))(_0x85c5('0x16'));var utils=require(_0x85c5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x85c5('0x18'));var db=require(_0x85c5('0x19'))['db'];function respondWithStatusCode(_0xf35ebe,_0x4aef2a){_0x4aef2a=_0x4aef2a||0xcc;return function(_0x77cbe4){if(_0x77cbe4){return _0xf35ebe[_0x85c5('0x1a')](_0x4aef2a);}return _0xf35ebe['status'](_0x4aef2a)['end']();};}function respondWithResult(_0x44c03f,_0x476dea){_0x476dea=_0x476dea||0xc8;return function(_0x593550){if(_0x593550){return _0x44c03f[_0x85c5('0x1b')](_0x476dea)[_0x85c5('0x1c')](_0x593550);}};}function respondWithFilteredResult(_0x437372,_0x545517){return function(_0x235149){if(_0x235149){var _0x373f76=typeof _0x545517['offset']==='undefined'&&typeof _0x545517['limit']==='undefined';var _0x256b22=_0x235149[_0x85c5('0x1d')];var _0x39dfc5=_0x373f76?0x0:_0x545517[_0x85c5('0x1e')];var _0x2e8b13=_0x373f76?_0x235149['count']:_0x545517['offset']+_0x545517[_0x85c5('0x1f')];var _0x55cedf;if(_0x2e8b13>=_0x256b22){_0x2e8b13=_0x256b22;_0x55cedf=0xc8;}else{_0x55cedf=0xce;}_0x437372[_0x85c5('0x1b')](_0x55cedf);return _0x437372['set'](_0x85c5('0x20'),_0x39dfc5+'-'+_0x2e8b13+'/'+_0x256b22)[_0x85c5('0x1c')](_0x235149);}return null;};}function patchUpdates(_0x47428f){return function(_0x48ad0a){try{jsonpatch[_0x85c5('0x21')](_0x48ad0a,_0x47428f,!![]);}catch(_0x18b32b){return BPromise[_0x85c5('0x22')](_0x18b32b);}return _0x48ad0a[_0x85c5('0x23')]();};}function saveUpdates(_0x24c91d,_0x19d5c6){return function(_0x49c483){if(_0x49c483){return _0x49c483[_0x85c5('0x24')](_0x24c91d)['then'](function(_0x13e1d4){return _0x13e1d4;});}return null;};}function removeEntity(_0x43cdec,_0x54b9d6){return function(_0x2ed80d){if(_0x2ed80d){return _0x2ed80d[_0x85c5('0x25')]()['then'](function(){_0x43cdec[_0x85c5('0x1b')](0xcc)[_0x85c5('0x26')]();});}};}function handleEntityNotFound(_0x2b87a2,_0x3aa47b){return function(_0xc7ef3a){if(!_0xc7ef3a){_0x2b87a2[_0x85c5('0x1a')](0x194);}return _0xc7ef3a;};}function handleError(_0x163214,_0xf087fc){_0xf087fc=_0xf087fc||0x1f4;return function(_0x37ff88){logger[_0x85c5('0x27')](_0x37ff88[_0x85c5('0x28')]);if(_0x37ff88['name']){delete _0x37ff88['name'];}_0x163214[_0x85c5('0x1b')](_0xf087fc)['send'](_0x37ff88);};}exports['index']=function(_0x2a2fe6,_0x4f13ba){var _0x17c2a8={},_0x39ffce={},_0x3fe1eb={'count':0x0,'rows':[]};var _0x2bdee6=_[_0x85c5('0x29')](db[_0x85c5('0x2a')][_0x85c5('0x2b')],function(_0x506b64){return{'name':_0x506b64[_0x85c5('0x2c')],'type':_0x506b64[_0x85c5('0x2d')][_0x85c5('0x2e')]};});_0x39ffce[_0x85c5('0x2f')]=_[_0x85c5('0x29')](_0x2bdee6,_0x85c5('0x30'));_0x39ffce[_0x85c5('0x31')]=_[_0x85c5('0x32')](_0x2a2fe6['query']);_0x39ffce[_0x85c5('0x33')]=_['intersection'](_0x39ffce[_0x85c5('0x2f')],_0x39ffce[_0x85c5('0x31')]);_0x17c2a8[_0x85c5('0x34')]=_['intersection'](_0x39ffce[_0x85c5('0x2f')],qs[_0x85c5('0x35')](_0x2a2fe6[_0x85c5('0x31')][_0x85c5('0x35')]));_0x17c2a8[_0x85c5('0x34')]=_0x17c2a8[_0x85c5('0x34')]['length']?_0x17c2a8[_0x85c5('0x34')]:_0x39ffce[_0x85c5('0x2f')];if(!_0x2a2fe6[_0x85c5('0x31')]['hasOwnProperty']('nolimit')){_0x17c2a8[_0x85c5('0x1f')]=qs[_0x85c5('0x1f')](_0x2a2fe6[_0x85c5('0x31')][_0x85c5('0x1f')]);_0x17c2a8[_0x85c5('0x1e')]=qs[_0x85c5('0x1e')](_0x2a2fe6[_0x85c5('0x31')][_0x85c5('0x1e')]);}_0x17c2a8[_0x85c5('0x36')]=qs[_0x85c5('0x37')](_0x2a2fe6[_0x85c5('0x31')][_0x85c5('0x37')]);_0x17c2a8['where']=qs[_0x85c5('0x33')](_[_0x85c5('0x38')](_0x2a2fe6[_0x85c5('0x31')],_0x39ffce['filters']),_0x2bdee6);if(_0x2a2fe6['query']['filter']){_0x17c2a8[_0x85c5('0x39')]=_[_0x85c5('0x3a')](_0x17c2a8[_0x85c5('0x39')],{'$or':_['map'](_0x2bdee6,function(_0x28bf4f){if(_0x28bf4f['type']!==_0x85c5('0x3b')){var _0x1be173={};_0x1be173[_0x28bf4f[_0x85c5('0x30')]]={'$like':'%'+_0x2a2fe6[_0x85c5('0x31')][_0x85c5('0x3c')]+'%'};return _0x1be173;}})});}_0x17c2a8=_[_0x85c5('0x3a')]({},_0x17c2a8,_0x2a2fe6[_0x85c5('0x3d')]);var _0x1044d0={'where':_0x17c2a8['where']};return db[_0x85c5('0x2a')][_0x85c5('0x1d')](_0x1044d0)['then'](function(_0x4d8aa5){_0x3fe1eb[_0x85c5('0x1d')]=_0x4d8aa5;if(_0x2a2fe6[_0x85c5('0x31')][_0x85c5('0x3e')]){_0x17c2a8[_0x85c5('0x3f')]=[{'all':!![]}];}return db[_0x85c5('0x2a')][_0x85c5('0x40')](_0x17c2a8);})[_0x85c5('0x41')](function(_0x1a6048){_0x3fe1eb['rows']=_0x1a6048;return _0x3fe1eb;})[_0x85c5('0x41')](respondWithFilteredResult(_0x4f13ba,_0x17c2a8))[_0x85c5('0x42')](handleError(_0x4f13ba,null));};exports[_0x85c5('0x43')]=function(_0x41a8a7,_0x9f0b76){var _0x125854={'raw':!![],'where':{'id':_0x41a8a7[_0x85c5('0x44')]['id']}},_0x262e0b={};_0x262e0b['model']=_[_0x85c5('0x32')](db[_0x85c5('0x2a')]['rawAttributes']);_0x262e0b[_0x85c5('0x31')]=_[_0x85c5('0x32')](_0x41a8a7['query']);_0x262e0b[_0x85c5('0x33')]=_[_0x85c5('0x45')](_0x262e0b[_0x85c5('0x2f')],_0x262e0b['query']);_0x125854[_0x85c5('0x34')]=_['intersection'](_0x262e0b[_0x85c5('0x2f')],qs[_0x85c5('0x35')](_0x41a8a7[_0x85c5('0x31')]['fields']));_0x125854[_0x85c5('0x34')]=_0x125854['attributes'][_0x85c5('0x46')]?_0x125854[_0x85c5('0x34')]:_0x262e0b[_0x85c5('0x2f')];if(_0x41a8a7['query'][_0x85c5('0x3e')]){_0x125854['include']=[{'all':!![]}];}_0x125854=_[_0x85c5('0x3a')]({},_0x125854,_0x41a8a7[_0x85c5('0x3d')]);return db[_0x85c5('0x2a')][_0x85c5('0x47')](_0x125854)[_0x85c5('0x41')](handleEntityNotFound(_0x9f0b76,null))[_0x85c5('0x41')](respondWithResult(_0x9f0b76,null))[_0x85c5('0x42')](handleError(_0x9f0b76,null));};exports[_0x85c5('0x48')]=function(_0x324b81,_0x1025b7){return db[_0x85c5('0x2a')][_0x85c5('0x48')](_0x324b81[_0x85c5('0x49')],{})[_0x85c5('0x41')](respondWithResult(_0x1025b7,0xc9))[_0x85c5('0x42')](handleError(_0x1025b7,null));};exports[_0x85c5('0x24')]=function(_0xac85fd,_0x12e2ab){if(_0xac85fd['body']['id']){delete _0xac85fd['body']['id'];}return db[_0x85c5('0x2a')][_0x85c5('0x47')]({'where':{'id':_0xac85fd[_0x85c5('0x44')]['id']}})[_0x85c5('0x41')](handleEntityNotFound(_0x12e2ab,null))[_0x85c5('0x41')](saveUpdates(_0xac85fd[_0x85c5('0x49')],null))[_0x85c5('0x41')](respondWithResult(_0x12e2ab,null))[_0x85c5('0x42')](handleError(_0x12e2ab,null));};exports[_0x85c5('0x25')]=function(_0x3e5767,_0x4ebe48){return db[_0x85c5('0x2a')][_0x85c5('0x47')]({'where':{'id':_0x3e5767[_0x85c5('0x44')]['id']}})[_0x85c5('0x41')](handleEntityNotFound(_0x4ebe48,null))[_0x85c5('0x41')](removeEntity(_0x4ebe48,null))[_0x85c5('0x42')](handleError(_0x4ebe48,null));};exports['describe']=function(_0x4a09e7,_0x391472){return db[_0x85c5('0x2a')][_0x85c5('0x4a')]()[_0x85c5('0x41')](respondWithResult(_0x391472,null))[_0x85c5('0x42')](handleError(_0x391472,null));}; \ No newline at end of file +var _0x8aa7=['index','MailSubstatus','fieldName','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','include','findAll','show','params','rawAttributes','options','catch','body','find','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','lodash','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','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x1c6e8e,_0x416a47){var _0x28370e=function(_0x4637bb){while(--_0x4637bb){_0x1c6e8e['push'](_0x1c6e8e['shift']());}};_0x28370e(++_0x416a47);}(_0x8aa7,0x18b));var _0x78aa=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x8aa7[_0x31cb5f];return _0x586042;};'use strict';var emlformat=require(_0x78aa('0x0'));var rimraf=require(_0x78aa('0x1'));var zipdir=require(_0x78aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x78aa('0x4'));var util=require('util');var path=require(_0x78aa('0x5'));var sox=require(_0x78aa('0x6'));var csv=require(_0x78aa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x78aa('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x78aa('0x9'));var deskjs=require(_0x78aa('0xa'));var toCsv=require(_0x78aa('0x7'));var querystring=require(_0x78aa('0xb'));var Papa=require(_0x78aa('0xc'));var Redis=require(_0x78aa('0xd'));var authService=require(_0x78aa('0xe'));var qs=require(_0x78aa('0xf'));var as=require(_0x78aa('0x10'));var hardwareService=require(_0x78aa('0x11'));var logger=require(_0x78aa('0x12'))(_0x78aa('0x13'));var utils=require(_0x78aa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x78aa('0x15'));var db=require(_0x78aa('0x16'))['db'];function respondWithStatusCode(_0xf914f0,_0x28297b){_0x28297b=_0x28297b||0xcc;return function(_0x561033){if(_0x561033){return _0xf914f0[_0x78aa('0x17')](_0x28297b);}return _0xf914f0[_0x78aa('0x18')](_0x28297b)[_0x78aa('0x19')]();};}function respondWithResult(_0x84f7aa,_0x1edf47){_0x1edf47=_0x1edf47||0xc8;return function(_0x47ecde){if(_0x47ecde){return _0x84f7aa[_0x78aa('0x18')](_0x1edf47)[_0x78aa('0x1a')](_0x47ecde);}};}function respondWithFilteredResult(_0x2e1c05,_0x5d2877){return function(_0x43ba5b){if(_0x43ba5b){var _0x2a3095=typeof _0x5d2877[_0x78aa('0x1b')]===_0x78aa('0x1c')&&typeof _0x5d2877[_0x78aa('0x1d')]==='undefined';var _0x282124=_0x43ba5b[_0x78aa('0x1e')];var _0x2fe622=_0x2a3095?0x0:_0x5d2877[_0x78aa('0x1b')];var _0x368460=_0x2a3095?_0x43ba5b[_0x78aa('0x1e')]:_0x5d2877[_0x78aa('0x1b')]+_0x5d2877[_0x78aa('0x1d')];var _0x1d9b60;if(_0x368460>=_0x282124){_0x368460=_0x282124;_0x1d9b60=0xc8;}else{_0x1d9b60=0xce;}_0x2e1c05[_0x78aa('0x18')](_0x1d9b60);return _0x2e1c05[_0x78aa('0x1f')](_0x78aa('0x20'),_0x2fe622+'-'+_0x368460+'/'+_0x282124)[_0x78aa('0x1a')](_0x43ba5b);}return null;};}function patchUpdates(_0x7a744b){return function(_0x29de6c){try{jsonpatch[_0x78aa('0x21')](_0x29de6c,_0x7a744b,!![]);}catch(_0x2cee50){return BPromise[_0x78aa('0x22')](_0x2cee50);}return _0x29de6c[_0x78aa('0x23')]();};}function saveUpdates(_0x3fc699,_0x115cca){return function(_0x2d80fd){if(_0x2d80fd){return _0x2d80fd[_0x78aa('0x24')](_0x3fc699)[_0x78aa('0x25')](function(_0x1d89c8){return _0x1d89c8;});}return null;};}function removeEntity(_0xc46efa,_0x1f87aa){return function(_0x2237ff){if(_0x2237ff){return _0x2237ff[_0x78aa('0x26')]()[_0x78aa('0x25')](function(){_0xc46efa[_0x78aa('0x18')](0xcc)[_0x78aa('0x19')]();});}};}function handleEntityNotFound(_0x413511,_0x1d2b12){return function(_0x536a33){if(!_0x536a33){_0x413511[_0x78aa('0x17')](0x194);}return _0x536a33;};}function handleError(_0x410bfa,_0xeeb6a7){_0xeeb6a7=_0xeeb6a7||0x1f4;return function(_0xb614e1){logger[_0x78aa('0x27')](_0xb614e1[_0x78aa('0x28')]);if(_0xb614e1[_0x78aa('0x29')]){delete _0xb614e1[_0x78aa('0x29')];}_0x410bfa[_0x78aa('0x18')](_0xeeb6a7)[_0x78aa('0x2a')](_0xb614e1);};}exports[_0x78aa('0x2b')]=function(_0x4e3e9e,_0x269bb3){var _0x2c8615={},_0x5385ce={},_0x5d7d58={'count':0x0,'rows':[]};var _0x4a218a=_['map'](db[_0x78aa('0x2c')]['rawAttributes'],function(_0x46135f){return{'name':_0x46135f[_0x78aa('0x2d')],'type':_0x46135f[_0x78aa('0x2e')][_0x78aa('0x2f')]};});_0x5385ce['model']=_[_0x78aa('0x30')](_0x4a218a,'name');_0x5385ce['query']=_[_0x78aa('0x31')](_0x4e3e9e['query']);_0x5385ce[_0x78aa('0x32')]=_[_0x78aa('0x33')](_0x5385ce[_0x78aa('0x34')],_0x5385ce[_0x78aa('0x35')]);_0x2c8615[_0x78aa('0x36')]=_[_0x78aa('0x33')](_0x5385ce['model'],qs[_0x78aa('0x37')](_0x4e3e9e[_0x78aa('0x35')][_0x78aa('0x37')]));_0x2c8615[_0x78aa('0x36')]=_0x2c8615[_0x78aa('0x36')][_0x78aa('0x38')]?_0x2c8615[_0x78aa('0x36')]:_0x5385ce[_0x78aa('0x34')];if(!_0x4e3e9e[_0x78aa('0x35')][_0x78aa('0x39')]('nolimit')){_0x2c8615['limit']=qs[_0x78aa('0x1d')](_0x4e3e9e[_0x78aa('0x35')]['limit']);_0x2c8615['offset']=qs[_0x78aa('0x1b')](_0x4e3e9e[_0x78aa('0x35')]['offset']);}_0x2c8615['order']=qs['sort'](_0x4e3e9e[_0x78aa('0x35')][_0x78aa('0x3a')]);_0x2c8615[_0x78aa('0x3b')]=qs[_0x78aa('0x32')](_['pick'](_0x4e3e9e[_0x78aa('0x35')],_0x5385ce[_0x78aa('0x32')]),_0x4a218a);if(_0x4e3e9e[_0x78aa('0x35')][_0x78aa('0x3c')]){_0x2c8615[_0x78aa('0x3b')]=_['merge'](_0x2c8615[_0x78aa('0x3b')],{'$or':_['map'](_0x4a218a,function(_0x42efda){if(_0x42efda[_0x78aa('0x2e')]!==_0x78aa('0x3d')){var _0x56378d={};_0x56378d[_0x42efda[_0x78aa('0x29')]]={'$like':'%'+_0x4e3e9e[_0x78aa('0x35')]['filter']+'%'};return _0x56378d;}})});}_0x2c8615=_[_0x78aa('0x3e')]({},_0x2c8615,_0x4e3e9e['options']);var _0x12ba11={'where':_0x2c8615[_0x78aa('0x3b')]};return db[_0x78aa('0x2c')]['count'](_0x12ba11)[_0x78aa('0x25')](function(_0x347428){_0x5d7d58[_0x78aa('0x1e')]=_0x347428;if(_0x4e3e9e[_0x78aa('0x35')]['includeAll']){_0x2c8615[_0x78aa('0x3f')]=[{'all':!![]}];}return db['MailSubstatus'][_0x78aa('0x40')](_0x2c8615);})[_0x78aa('0x25')](function(_0x468cb0){_0x5d7d58['rows']=_0x468cb0;return _0x5d7d58;})['then'](respondWithFilteredResult(_0x269bb3,_0x2c8615))['catch'](handleError(_0x269bb3,null));};exports[_0x78aa('0x41')]=function(_0x437e61,_0x6ed630){var _0x828703={'raw':!![],'where':{'id':_0x437e61[_0x78aa('0x42')]['id']}},_0x1a45b7={};_0x1a45b7[_0x78aa('0x34')]=_[_0x78aa('0x31')](db['MailSubstatus'][_0x78aa('0x43')]);_0x1a45b7[_0x78aa('0x35')]=_[_0x78aa('0x31')](_0x437e61[_0x78aa('0x35')]);_0x1a45b7[_0x78aa('0x32')]=_['intersection'](_0x1a45b7[_0x78aa('0x34')],_0x1a45b7['query']);_0x828703[_0x78aa('0x36')]=_[_0x78aa('0x33')](_0x1a45b7[_0x78aa('0x34')],qs[_0x78aa('0x37')](_0x437e61[_0x78aa('0x35')][_0x78aa('0x37')]));_0x828703[_0x78aa('0x36')]=_0x828703[_0x78aa('0x36')]['length']?_0x828703['attributes']:_0x1a45b7[_0x78aa('0x34')];if(_0x437e61[_0x78aa('0x35')]['includeAll']){_0x828703[_0x78aa('0x3f')]=[{'all':!![]}];}_0x828703=_[_0x78aa('0x3e')]({},_0x828703,_0x437e61[_0x78aa('0x44')]);return db[_0x78aa('0x2c')]['find'](_0x828703)[_0x78aa('0x25')](handleEntityNotFound(_0x6ed630,null))[_0x78aa('0x25')](respondWithResult(_0x6ed630,null))[_0x78aa('0x45')](handleError(_0x6ed630,null));};exports['create']=function(_0x1c789c,_0x199f0d){return db[_0x78aa('0x2c')]['create'](_0x1c789c[_0x78aa('0x46')],{})[_0x78aa('0x25')](respondWithResult(_0x199f0d,0xc9))['catch'](handleError(_0x199f0d,null));};exports[_0x78aa('0x24')]=function(_0x47e691,_0x264ab2){if(_0x47e691[_0x78aa('0x46')]['id']){delete _0x47e691[_0x78aa('0x46')]['id'];}return db[_0x78aa('0x2c')][_0x78aa('0x47')]({'where':{'id':_0x47e691[_0x78aa('0x42')]['id']}})[_0x78aa('0x25')](handleEntityNotFound(_0x264ab2,null))[_0x78aa('0x25')](saveUpdates(_0x47e691[_0x78aa('0x46')],null))[_0x78aa('0x25')](respondWithResult(_0x264ab2,null))[_0x78aa('0x45')](handleError(_0x264ab2,null));};exports[_0x78aa('0x26')]=function(_0x4a1882,_0x2e5e35){return db['MailSubstatus'][_0x78aa('0x47')]({'where':{'id':_0x4a1882[_0x78aa('0x42')]['id']}})[_0x78aa('0x25')](handleEntityNotFound(_0x2e5e35,null))['then'](removeEntity(_0x2e5e35,null))[_0x78aa('0x45')](handleError(_0x2e5e35,null));};exports[_0x78aa('0x48')]=function(_0x1d503,_0x58e4b1){return db[_0x78aa('0x2c')][_0x78aa('0x48')]()['then'](respondWithResult(_0x58e4b1,null))[_0x78aa('0x45')](handleError(_0x58e4b1,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index ed999db..53c0205 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 _0xa0bc=['request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','util','../../config/logger','moment','bluebird'];(function(_0x5ec08b,_0x59b590){var _0x4703a0=function(_0x4b9711){while(--_0x4b9711){_0x5ec08b['push'](_0x5ec08b['shift']());}};_0x4703a0(++_0x59b590);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var logger=require(_0xca0b('0x1'))('api');var moment=require(_0xca0b('0x2'));var BPromise=require(_0xca0b('0x3'));var rp=require(_0xca0b('0x4'));var fs=require('fs');var path=require(_0xca0b('0x5'));var rimraf=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var attributes=require(_0xca0b('0x8'));module[_0xca0b('0x9')]=function(_0x3cb084,_0x1aac00){return _0x3cb084[_0xca0b('0xa')](_0xca0b('0xb'),attributes,{'tableName':_0xca0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x962a=['./mailSubstatus.attributes','MailSubstatus','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x2e20e1,_0x1d55ee){var _0x511295=function(_0x2fe61e){while(--_0x2fe61e){_0x2e20e1['push'](_0x2e20e1['shift']());}};_0x511295(++_0x1d55ee);}(_0x962a,0x14f));var _0xa962=function(_0x54b53c,_0x2d5b3b){_0x54b53c=_0x54b53c-0x0;var _0x4f846e=_0x962a[_0x54b53c];return _0x4f846e;};'use strict';var _=require(_0xa962('0x0'));var util=require(_0xa962('0x1'));var logger=require(_0xa962('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa962('0x3'));var rp=require(_0xa962('0x4'));var fs=require('fs');var path=require(_0xa962('0x5'));var rimraf=require('rimraf');var config=require(_0xa962('0x6'));var attributes=require(_0xa962('0x7'));module['exports']=function(_0x87499b,_0x29b01f){return _0x87499b['define'](_0xa962('0x8'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index b2ce95b..34751e5 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 _0x3549=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x3549,0x179));var _0x9354=function(_0xb5c1e6,_0x14e1ec){_0xb5c1e6=_0xb5c1e6-0x0;var _0x5a90aa=_0x3549[_0xb5c1e6];return _0x5a90aa;};'use strict';var _=require(_0x9354('0x0'));var util=require(_0x9354('0x1'));var moment=require('moment');var BPromise=require(_0x9354('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9354('0x3'));var db=require(_0x9354('0x4'))['db'];var utils=require(_0x9354('0x5'));var logger=require(_0x9354('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9354('0x7')][_0x9354('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3faad0,_0x2b5b0e,_0x30eef0){return new BPromise(function(_0x4b16b8,_0x1b1ae8){return client[_0x9354('0x9')](_0x3faad0,_0x30eef0)[_0x9354('0xa')](function(_0x12aaf9){logger[_0x9354('0xb')](_0x9354('0xc'),_0x2b5b0e,'request\x20sent');logger[_0x9354('0xd')](_0x9354('0xe'),_0x2b5b0e,'request\x20sent',JSON[_0x9354('0xf')](_0x12aaf9));if(_0x12aaf9['error']){if(_0x12aaf9[_0x9354('0x10')][_0x9354('0x11')]===0x1f4){logger[_0x9354('0x10')](_0x9354('0xc'),_0x2b5b0e,_0x12aaf9['error'][_0x9354('0x12')]);return _0x1b1ae8(_0x12aaf9[_0x9354('0x10')]['message']);}logger[_0x9354('0x10')](_0x9354('0xc'),_0x2b5b0e,_0x12aaf9['error'][_0x9354('0x12')]);return _0x4b16b8(_0x12aaf9['error'][_0x9354('0x12')]);}else{logger[_0x9354('0xb')](_0x9354('0xc'),_0x2b5b0e,'request\x20sent');_0x4b16b8(_0x12aaf9[_0x9354('0x13')][_0x9354('0x12')]);}})[_0x9354('0x14')](function(_0x56a948){logger[_0x9354('0x10')](_0x9354('0xc'),_0x2b5b0e,_0x56a948);_0x1b1ae8(_0x56a948);});});} \ No newline at end of file +var _0x81fa=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x22ab6b,_0x578da4){var _0x42b586=function(_0xb82f81){while(--_0xb82f81){_0x22ab6b['push'](_0x22ab6b['shift']());}};_0x42b586(++_0x578da4);}(_0x81fa,0xab));var _0xa81f=function(_0x5eaefe,_0xc72159){_0x5eaefe=_0x5eaefe-0x0;var _0xe64929=_0x81fa[_0x5eaefe];return _0xe64929;};'use strict';var _=require(_0xa81f('0x0'));var util=require(_0xa81f('0x1'));var moment=require(_0xa81f('0x2'));var BPromise=require(_0xa81f('0x3'));var rs=require(_0xa81f('0x4'));var fs=require('fs');var Redis=require(_0xa81f('0x5'));var db=require(_0xa81f('0x6'))['db'];var utils=require(_0xa81f('0x7'));var logger=require(_0xa81f('0x8'))(_0xa81f('0x9'));var config=require('../../config/environment');var jayson=require(_0xa81f('0xa'));var client=jayson['client'][_0xa81f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x483d87,_0x4c227e,_0x440231){return new BPromise(function(_0x2da7d3,_0x32035f){return client[_0xa81f('0xc')](_0x483d87,_0x440231)[_0xa81f('0xd')](function(_0x10abea){logger[_0xa81f('0xe')](_0xa81f('0xf'),_0x4c227e,_0xa81f('0x10'));logger[_0xa81f('0x11')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4c227e,_0xa81f('0x10'),JSON['stringify'](_0x10abea));if(_0x10abea['error']){if(_0x10abea[_0xa81f('0x12')]['code']===0x1f4){logger[_0xa81f('0x12')](_0xa81f('0xf'),_0x4c227e,_0x10abea[_0xa81f('0x12')][_0xa81f('0x13')]);return _0x32035f(_0x10abea[_0xa81f('0x12')]['message']);}logger[_0xa81f('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x4c227e,_0x10abea[_0xa81f('0x12')][_0xa81f('0x13')]);return _0x2da7d3(_0x10abea['error'][_0xa81f('0x13')]);}else{logger[_0xa81f('0xe')](_0xa81f('0xf'),_0x4c227e,_0xa81f('0x10'));_0x2da7d3(_0x10abea[_0xa81f('0x14')][_0xa81f('0x13')]);}})['catch'](function(_0x2355e2){logger['error'](_0xa81f('0xf'),_0x4c227e,_0x2355e2);_0x32035f(_0x2355e2);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 57eb820..cd10b29 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 _0x51d0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','update','delete','exports','multer','path','express','Router'];(function(_0x2c77e7,_0x35a594){var _0x598f41=function(_0x15d7fb){while(--_0x15d7fb){_0x2c77e7['push'](_0x2c77e7['shift']());}};_0x598f41(++_0x35a594);}(_0x51d0,0x128));var _0x051d=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x51d0[_0x421196];return _0x2738af;};'use strict';var multer=require(_0x051d('0x0'));var util=require('util');var path=require(_0x051d('0x1'));var timeout=require('connect-timeout');var express=require(_0x051d('0x2'));var router=express[_0x051d('0x3')]();var fs_extra=require(_0x051d('0x4'));var auth=require(_0x051d('0x5'));var interaction=require(_0x051d('0x6'));var config=require(_0x051d('0x7'));var controller=require(_0x051d('0x8'));router[_0x051d('0x9')]('/',auth['isAuthenticated'](),controller[_0x051d('0xa')]);router[_0x051d('0x9')](_0x051d('0xb'),auth[_0x051d('0xc')](),controller[_0x051d('0xd')]);router['get'](_0x051d('0xe'),auth[_0x051d('0xc')](),controller[_0x051d('0xf')]);router['post']('/',auth[_0x051d('0xc')](),controller[_0x051d('0x10')]);router['put'](_0x051d('0xe'),auth[_0x051d('0xc')](),controller[_0x051d('0x11')]);router[_0x051d('0x12')](_0x051d('0xe'),auth[_0x051d('0xc')](),controller['destroy']);module[_0x051d('0x13')]=router; \ No newline at end of file +var _0x5078=['put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','/:id','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5078,0x100));var _0x8507=function(_0xf8b0d4,_0x13cdd2){_0xf8b0d4=_0xf8b0d4-0x0;var _0x323c68=_0x5078[_0xf8b0d4];return _0x323c68;};'use strict';var multer=require(_0x8507('0x0'));var util=require(_0x8507('0x1'));var path=require('path');var timeout=require(_0x8507('0x2'));var express=require(_0x8507('0x3'));var router=express[_0x8507('0x4')]();var fs_extra=require(_0x8507('0x5'));var auth=require(_0x8507('0x6'));var interaction=require(_0x8507('0x7'));var config=require(_0x8507('0x8'));var controller=require(_0x8507('0x9'));router['get']('/',auth[_0x8507('0xa')](),controller[_0x8507('0xb')]);router[_0x8507('0xc')](_0x8507('0xd'),auth[_0x8507('0xa')](),controller['describe']);router[_0x8507('0xc')](_0x8507('0xe'),auth[_0x8507('0xa')](),controller['show']);router[_0x8507('0xf')]('/',auth['isAuthenticated'](),controller[_0x8507('0x10')]);router[_0x8507('0x11')](_0x8507('0xe'),auth['isAuthenticated'](),controller[_0x8507('0x12')]);router[_0x8507('0x13')]('/:id',auth[_0x8507('0xa')](),controller['destroy']);module[_0x8507('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index cde320e..0195a12 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2d9fba,_0x1ba09d){var _0x98fbf2=function(_0x40bc31){while(--_0x40bc31){_0x2d9fba['push'](_0x2d9fba['shift']());}};_0x98fbf2(++_0x1ba09d);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x15bb1e,_0x1b9b51){var _0x3ebc3c=function(_0x59da22){while(--_0x59da22){_0x15bb1e['push'](_0x15bb1e['shift']());}};_0x3ebc3c(++_0x1b9b51);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xcb91[_0x5a79e2];return _0x266c45;};'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 5f268e2..15ea9cc 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 _0x55fa=['includeAll','include','params','keys','intersection','fields','catch','create','body','find','describe','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','then','sendStatus','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options'];(function(_0x46ee20,_0x58cd61){var _0x1871f1=function(_0x4d5035){while(--_0x4d5035){_0x46ee20['push'](_0x46ee20['shift']());}};_0x1871f1(++_0x58cd61);}(_0x55fa,0x11f));var _0xa55f=function(_0x3ec272,_0x59c7d3){_0x3ec272=_0x3ec272-0x0;var _0x311f6d=_0x55fa[_0x3ec272];return _0x311f6d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa55f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa55f('0x1'));var moment=require(_0xa55f('0x2'));var BPromise=require(_0xa55f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa55f('0x4'));var sox=require(_0xa55f('0x5'));var csv=require(_0xa55f('0x6'));var ejs=require(_0xa55f('0x7'));var fs=require('fs');var fs_extra=require(_0xa55f('0x8'));var _=require(_0xa55f('0x9'));var squel=require('squel');var crypto=require(_0xa55f('0xa'));var jsforce=require(_0xa55f('0xb'));var deskjs=require(_0xa55f('0xc'));var toCsv=require(_0xa55f('0x6'));var querystring=require(_0xa55f('0xd'));var Papa=require(_0xa55f('0xe'));var Redis=require(_0xa55f('0xf'));var authService=require(_0xa55f('0x10'));var qs=require(_0xa55f('0x11'));var as=require(_0xa55f('0x12'));var hardwareService=require(_0xa55f('0x13'));var logger=require('../../config/logger')(_0xa55f('0x14'));var utils=require(_0xa55f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa55f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57915a,_0x2083b3){_0x2083b3=_0x2083b3||0xcc;return function(_0x39352a){if(_0x39352a){return _0x57915a['sendStatus'](_0x2083b3);}return _0x57915a[_0xa55f('0x17')](_0x2083b3)[_0xa55f('0x18')]();};}function respondWithResult(_0x2d745e,_0x69cd3a){_0x69cd3a=_0x69cd3a||0xc8;return function(_0x45ec4c){if(_0x45ec4c){return _0x2d745e[_0xa55f('0x17')](_0x69cd3a)[_0xa55f('0x19')](_0x45ec4c);}};}function respondWithFilteredResult(_0x5b1099,_0x1efe21){return function(_0x4e9ad1){if(_0x4e9ad1){var _0x560695=typeof _0x1efe21[_0xa55f('0x1a')]===_0xa55f('0x1b')&&typeof _0x1efe21[_0xa55f('0x1c')]==='undefined';var _0x10445f=_0x4e9ad1[_0xa55f('0x1d')];var _0x1c9956=_0x560695?0x0:_0x1efe21[_0xa55f('0x1a')];var _0x467a0d=_0x560695?_0x4e9ad1[_0xa55f('0x1d')]:_0x1efe21[_0xa55f('0x1a')]+_0x1efe21[_0xa55f('0x1c')];var _0x647bc2;if(_0x467a0d>=_0x10445f){_0x467a0d=_0x10445f;_0x647bc2=0xc8;}else{_0x647bc2=0xce;}_0x5b1099[_0xa55f('0x17')](_0x647bc2);return _0x5b1099['set'](_0xa55f('0x1e'),_0x1c9956+'-'+_0x467a0d+'/'+_0x10445f)[_0xa55f('0x19')](_0x4e9ad1);}return null;};}function patchUpdates(_0x14fdb3){return function(_0x77b453){try{jsonpatch['apply'](_0x77b453,_0x14fdb3,!![]);}catch(_0x4a42a3){return BPromise[_0xa55f('0x1f')](_0x4a42a3);}return _0x77b453['save']();};}function saveUpdates(_0x234f24,_0x2e04aa){return function(_0x5ed16e){if(_0x5ed16e){return _0x5ed16e[_0xa55f('0x20')](_0x234f24)['then'](function(_0x435d92){return _0x435d92;});}return null;};}function removeEntity(_0x113e82,_0x4e4c9e){return function(_0x4c8b12){if(_0x4c8b12){return _0x4c8b12[_0xa55f('0x21')]()[_0xa55f('0x22')](function(){_0x113e82['status'](0xcc)[_0xa55f('0x18')]();});}};}function handleEntityNotFound(_0x5bd9aa,_0x273c69){return function(_0x13bfda){if(!_0x13bfda){_0x5bd9aa[_0xa55f('0x23')](0x194);}return _0x13bfda;};}function handleError(_0x5dabe2,_0x492673){_0x492673=_0x492673||0x1f4;return function(_0x25bf53){logger[_0xa55f('0x24')](_0x25bf53[_0xa55f('0x25')]);if(_0x25bf53[_0xa55f('0x26')]){delete _0x25bf53['name'];}_0x5dabe2['status'](_0x492673)['send'](_0x25bf53);};}exports[_0xa55f('0x27')]=function(_0x5807f1,_0x634f8e){var _0x1f3e61={},_0x1dd7b5={},_0x3cb0e9={'count':0x0,'rows':[]};var _0xdb650b=_[_0xa55f('0x28')](db[_0xa55f('0x29')][_0xa55f('0x2a')],function(_0x2ff7c9){return{'name':_0x2ff7c9[_0xa55f('0x2b')],'type':_0x2ff7c9[_0xa55f('0x2c')][_0xa55f('0x2d')]};});_0x1dd7b5[_0xa55f('0x2e')]=_['map'](_0xdb650b,_0xa55f('0x26'));_0x1dd7b5[_0xa55f('0x2f')]=_['keys'](_0x5807f1[_0xa55f('0x2f')]);_0x1dd7b5[_0xa55f('0x30')]=_['intersection'](_0x1dd7b5['model'],_0x1dd7b5[_0xa55f('0x2f')]);_0x1f3e61[_0xa55f('0x31')]=_['intersection'](_0x1dd7b5[_0xa55f('0x2e')],qs['fields'](_0x5807f1['query']['fields']));_0x1f3e61[_0xa55f('0x31')]=_0x1f3e61[_0xa55f('0x31')]['length']?_0x1f3e61[_0xa55f('0x31')]:_0x1dd7b5[_0xa55f('0x2e')];if(!_0x5807f1[_0xa55f('0x2f')][_0xa55f('0x32')](_0xa55f('0x33'))){_0x1f3e61[_0xa55f('0x1c')]=qs[_0xa55f('0x1c')](_0x5807f1[_0xa55f('0x2f')][_0xa55f('0x1c')]);_0x1f3e61[_0xa55f('0x1a')]=qs[_0xa55f('0x1a')](_0x5807f1[_0xa55f('0x2f')]['offset']);}_0x1f3e61[_0xa55f('0x34')]=qs[_0xa55f('0x35')](_0x5807f1[_0xa55f('0x2f')][_0xa55f('0x35')]);_0x1f3e61[_0xa55f('0x36')]=qs[_0xa55f('0x30')](_['pick'](_0x5807f1['query'],_0x1dd7b5[_0xa55f('0x30')]),_0xdb650b);if(_0x5807f1[_0xa55f('0x2f')][_0xa55f('0x37')]){_0x1f3e61[_0xa55f('0x36')]=_[_0xa55f('0x38')](_0x1f3e61[_0xa55f('0x36')],{'$or':_[_0xa55f('0x28')](_0xdb650b,function(_0x35f320){if(_0x35f320[_0xa55f('0x2c')]!=='VIRTUAL'){var _0x59abb9={};_0x59abb9[_0x35f320['name']]={'$like':'%'+_0x5807f1[_0xa55f('0x2f')][_0xa55f('0x37')]+'%'};return _0x59abb9;}})});}_0x1f3e61=_[_0xa55f('0x38')]({},_0x1f3e61,_0x5807f1[_0xa55f('0x39')]);var _0x140a08={'where':_0x1f3e61[_0xa55f('0x36')]};return db[_0xa55f('0x29')][_0xa55f('0x1d')](_0x140a08)[_0xa55f('0x22')](function(_0x1db652){_0x3cb0e9[_0xa55f('0x1d')]=_0x1db652;if(_0x5807f1[_0xa55f('0x2f')][_0xa55f('0x3a')]){_0x1f3e61[_0xa55f('0x3b')]=[{'all':!![]}];}return db[_0xa55f('0x29')]['findAll'](_0x1f3e61);})[_0xa55f('0x22')](function(_0x7e420){_0x3cb0e9['rows']=_0x7e420;return _0x3cb0e9;})[_0xa55f('0x22')](respondWithFilteredResult(_0x634f8e,_0x1f3e61))['catch'](handleError(_0x634f8e,null));};exports['show']=function(_0xfd2d7c,_0x414593){var _0xc5798e={'raw':!![],'where':{'id':_0xfd2d7c[_0xa55f('0x3c')]['id']}},_0x1a993c={};_0x1a993c[_0xa55f('0x2e')]=_[_0xa55f('0x3d')](db[_0xa55f('0x29')][_0xa55f('0x2a')]);_0x1a993c[_0xa55f('0x2f')]=_[_0xa55f('0x3d')](_0xfd2d7c[_0xa55f('0x2f')]);_0x1a993c[_0xa55f('0x30')]=_[_0xa55f('0x3e')](_0x1a993c[_0xa55f('0x2e')],_0x1a993c['query']);_0xc5798e[_0xa55f('0x31')]=_[_0xa55f('0x3e')](_0x1a993c[_0xa55f('0x2e')],qs[_0xa55f('0x3f')](_0xfd2d7c[_0xa55f('0x2f')]['fields']));_0xc5798e[_0xa55f('0x31')]=_0xc5798e[_0xa55f('0x31')]['length']?_0xc5798e[_0xa55f('0x31')]:_0x1a993c[_0xa55f('0x2e')];if(_0xfd2d7c[_0xa55f('0x2f')][_0xa55f('0x3a')]){_0xc5798e[_0xa55f('0x3b')]=[{'all':!![]}];}_0xc5798e=_[_0xa55f('0x38')]({},_0xc5798e,_0xfd2d7c[_0xa55f('0x39')]);return db[_0xa55f('0x29')]['find'](_0xc5798e)['then'](handleEntityNotFound(_0x414593,null))[_0xa55f('0x22')](respondWithResult(_0x414593,null))[_0xa55f('0x40')](handleError(_0x414593,null));};exports[_0xa55f('0x41')]=function(_0x1e7cf8,_0x755858){return db['MailTransferReport']['create'](_0x1e7cf8[_0xa55f('0x42')],{})['then'](respondWithResult(_0x755858,0xc9))[_0xa55f('0x40')](handleError(_0x755858,null));};exports[_0xa55f('0x20')]=function(_0x31f100,_0x5e0226){if(_0x31f100['body']['id']){delete _0x31f100[_0xa55f('0x42')]['id'];}return db[_0xa55f('0x29')][_0xa55f('0x43')]({'where':{'id':_0x31f100[_0xa55f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5e0226,null))['then'](saveUpdates(_0x31f100[_0xa55f('0x42')],null))['then'](respondWithResult(_0x5e0226,null))['catch'](handleError(_0x5e0226,null));};exports[_0xa55f('0x21')]=function(_0x3a8bb2,_0x349382){return db[_0xa55f('0x29')][_0xa55f('0x43')]({'where':{'id':_0x3a8bb2[_0xa55f('0x3c')]['id']}})[_0xa55f('0x22')](handleEntityNotFound(_0x349382,null))[_0xa55f('0x22')](removeEntity(_0x349382,null))['catch'](handleError(_0x349382,null));};exports[_0xa55f('0x44')]=function(_0x38aed1,_0x3bb184){return db[_0xa55f('0x29')][_0xa55f('0x44')]()['then'](respondWithResult(_0x3bb184,null))[_0xa55f('0x40')](handleError(_0x3bb184,null));}; \ No newline at end of file +var _0x59e8=['limit','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','map','MailTransferReport','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count'];(function(_0x130742,_0x334b19){var _0x3d2391=function(_0x22029d){while(--_0x22029d){_0x130742['push'](_0x130742['shift']());}};_0x3d2391(++_0x334b19);}(_0x59e8,0x138));var _0x859e=function(_0x1fa5ac,_0x815a90){_0x1fa5ac=_0x1fa5ac-0x0;var _0x25cdf3=_0x59e8[_0x1fa5ac];return _0x25cdf3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x859e('0x0'));var rp=require(_0x859e('0x1'));var moment=require('moment');var BPromise=require(_0x859e('0x2'));var Mustache=require('mustache');var util=require(_0x859e('0x3'));var path=require(_0x859e('0x4'));var sox=require(_0x859e('0x5'));var csv=require(_0x859e('0x6'));var ejs=require(_0x859e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x859e('0x8'));var squel=require(_0x859e('0x9'));var crypto=require(_0x859e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x859e('0x6'));var querystring=require('querystring');var Papa=require(_0x859e('0xb'));var Redis=require(_0x859e('0xc'));var authService=require(_0x859e('0xd'));var qs=require(_0x859e('0xe'));var as=require(_0x859e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x859e('0x10'))(_0x859e('0x11'));var utils=require(_0x859e('0x12'));var config=require(_0x859e('0x13'));var licenseUtil=require(_0x859e('0x14'));var db=require(_0x859e('0x15'))['db'];function respondWithStatusCode(_0x195643,_0x5c2f05){_0x5c2f05=_0x5c2f05||0xcc;return function(_0xb1a35a){if(_0xb1a35a){return _0x195643['sendStatus'](_0x5c2f05);}return _0x195643[_0x859e('0x16')](_0x5c2f05)[_0x859e('0x17')]();};}function respondWithResult(_0x1f39f8,_0x44e655){_0x44e655=_0x44e655||0xc8;return function(_0x5c212f){if(_0x5c212f){return _0x1f39f8[_0x859e('0x16')](_0x44e655)[_0x859e('0x18')](_0x5c212f);}};}function respondWithFilteredResult(_0x25fe95,_0x1f255f){return function(_0x4e8842){if(_0x4e8842){var _0x370b1a=typeof _0x1f255f[_0x859e('0x19')]===_0x859e('0x1a')&&typeof _0x1f255f['limit']===_0x859e('0x1a');var _0x22d9b7=_0x4e8842[_0x859e('0x1b')];var _0x41e046=_0x370b1a?0x0:_0x1f255f[_0x859e('0x19')];var _0x36c872=_0x370b1a?_0x4e8842[_0x859e('0x1b')]:_0x1f255f[_0x859e('0x19')]+_0x1f255f[_0x859e('0x1c')];var _0xbbea52;if(_0x36c872>=_0x22d9b7){_0x36c872=_0x22d9b7;_0xbbea52=0xc8;}else{_0xbbea52=0xce;}_0x25fe95[_0x859e('0x16')](_0xbbea52);return _0x25fe95['set'](_0x859e('0x1d'),_0x41e046+'-'+_0x36c872+'/'+_0x22d9b7)[_0x859e('0x18')](_0x4e8842);}return null;};}function patchUpdates(_0x150bd8){return function(_0x1649d6){try{jsonpatch['apply'](_0x1649d6,_0x150bd8,!![]);}catch(_0x833a85){return BPromise[_0x859e('0x1e')](_0x833a85);}return _0x1649d6[_0x859e('0x1f')]();};}function saveUpdates(_0x2b2eab,_0x37f2ed){return function(_0x1f9b58){if(_0x1f9b58){return _0x1f9b58[_0x859e('0x20')](_0x2b2eab)[_0x859e('0x21')](function(_0x30fe0d){return _0x30fe0d;});}return null;};}function removeEntity(_0x2bd9cc,_0x5db7b4){return function(_0x1f7961){if(_0x1f7961){return _0x1f7961[_0x859e('0x22')]()[_0x859e('0x21')](function(){_0x2bd9cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x514c4a,_0x40d9de){return function(_0x18cae8){if(!_0x18cae8){_0x514c4a[_0x859e('0x23')](0x194);}return _0x18cae8;};}function handleError(_0x47dda8,_0x397127){_0x397127=_0x397127||0x1f4;return function(_0x34ae7e){logger[_0x859e('0x24')](_0x34ae7e['stack']);if(_0x34ae7e[_0x859e('0x25')]){delete _0x34ae7e[_0x859e('0x25')];}_0x47dda8[_0x859e('0x16')](_0x397127)['send'](_0x34ae7e);};}exports['index']=function(_0x2dde9d,_0x418c5b){var _0x1084b1={},_0x2fb824={},_0x50b170={'count':0x0,'rows':[]};var _0x1c95db=_[_0x859e('0x26')](db[_0x859e('0x27')][_0x859e('0x28')],function(_0x5bd0b1){return{'name':_0x5bd0b1['fieldName'],'type':_0x5bd0b1[_0x859e('0x29')][_0x859e('0x2a')]};});_0x2fb824['model']=_[_0x859e('0x26')](_0x1c95db,'name');_0x2fb824['query']=_[_0x859e('0x2b')](_0x2dde9d['query']);_0x2fb824[_0x859e('0x2c')]=_[_0x859e('0x2d')](_0x2fb824[_0x859e('0x2e')],_0x2fb824[_0x859e('0x2f')]);_0x1084b1[_0x859e('0x30')]=_[_0x859e('0x2d')](_0x2fb824[_0x859e('0x2e')],qs['fields'](_0x2dde9d[_0x859e('0x2f')][_0x859e('0x31')]));_0x1084b1[_0x859e('0x30')]=_0x1084b1[_0x859e('0x30')][_0x859e('0x32')]?_0x1084b1[_0x859e('0x30')]:_0x2fb824[_0x859e('0x2e')];if(!_0x2dde9d['query'][_0x859e('0x33')](_0x859e('0x34'))){_0x1084b1['limit']=qs[_0x859e('0x1c')](_0x2dde9d['query'][_0x859e('0x1c')]);_0x1084b1[_0x859e('0x19')]=qs[_0x859e('0x19')](_0x2dde9d[_0x859e('0x2f')]['offset']);}_0x1084b1[_0x859e('0x35')]=qs['sort'](_0x2dde9d[_0x859e('0x2f')]['sort']);_0x1084b1[_0x859e('0x36')]=qs[_0x859e('0x2c')](_['pick'](_0x2dde9d['query'],_0x2fb824[_0x859e('0x2c')]),_0x1c95db);if(_0x2dde9d[_0x859e('0x2f')][_0x859e('0x37')]){_0x1084b1[_0x859e('0x36')]=_[_0x859e('0x38')](_0x1084b1[_0x859e('0x36')],{'$or':_['map'](_0x1c95db,function(_0xd0e792){if(_0xd0e792[_0x859e('0x29')]!=='VIRTUAL'){var _0x1d8e9b={};_0x1d8e9b[_0xd0e792['name']]={'$like':'%'+_0x2dde9d[_0x859e('0x2f')]['filter']+'%'};return _0x1d8e9b;}})});}_0x1084b1=_['merge']({},_0x1084b1,_0x2dde9d[_0x859e('0x39')]);var _0x5443dc={'where':_0x1084b1['where']};return db[_0x859e('0x27')][_0x859e('0x1b')](_0x5443dc)['then'](function(_0x3a63c2){_0x50b170[_0x859e('0x1b')]=_0x3a63c2;if(_0x2dde9d[_0x859e('0x2f')][_0x859e('0x3a')]){_0x1084b1[_0x859e('0x3b')]=[{'all':!![]}];}return db[_0x859e('0x27')][_0x859e('0x3c')](_0x1084b1);})[_0x859e('0x21')](function(_0xf49b9d){_0x50b170[_0x859e('0x3d')]=_0xf49b9d;return _0x50b170;})[_0x859e('0x21')](respondWithFilteredResult(_0x418c5b,_0x1084b1))[_0x859e('0x3e')](handleError(_0x418c5b,null));};exports['show']=function(_0x3e2e3d,_0x31ea61){var _0x4f60b8={'raw':!![],'where':{'id':_0x3e2e3d['params']['id']}},_0x1520f2={};_0x1520f2[_0x859e('0x2e')]=_['keys'](db[_0x859e('0x27')][_0x859e('0x28')]);_0x1520f2[_0x859e('0x2f')]=_[_0x859e('0x2b')](_0x3e2e3d['query']);_0x1520f2[_0x859e('0x2c')]=_[_0x859e('0x2d')](_0x1520f2['model'],_0x1520f2[_0x859e('0x2f')]);_0x4f60b8[_0x859e('0x30')]=_['intersection'](_0x1520f2[_0x859e('0x2e')],qs[_0x859e('0x31')](_0x3e2e3d[_0x859e('0x2f')]['fields']));_0x4f60b8[_0x859e('0x30')]=_0x4f60b8[_0x859e('0x30')][_0x859e('0x32')]?_0x4f60b8[_0x859e('0x30')]:_0x1520f2['model'];if(_0x3e2e3d[_0x859e('0x2f')][_0x859e('0x3a')]){_0x4f60b8[_0x859e('0x3b')]=[{'all':!![]}];}_0x4f60b8=_[_0x859e('0x38')]({},_0x4f60b8,_0x3e2e3d[_0x859e('0x39')]);return db[_0x859e('0x27')][_0x859e('0x3f')](_0x4f60b8)['then'](handleEntityNotFound(_0x31ea61,null))[_0x859e('0x21')](respondWithResult(_0x31ea61,null))[_0x859e('0x3e')](handleError(_0x31ea61,null));};exports[_0x859e('0x40')]=function(_0x5a6306,_0x12ed08){return db[_0x859e('0x27')][_0x859e('0x40')](_0x5a6306[_0x859e('0x41')],{})[_0x859e('0x21')](respondWithResult(_0x12ed08,0xc9))[_0x859e('0x3e')](handleError(_0x12ed08,null));};exports[_0x859e('0x20')]=function(_0x43dd8d,_0x520ed3){if(_0x43dd8d[_0x859e('0x41')]['id']){delete _0x43dd8d[_0x859e('0x41')]['id'];}return db['MailTransferReport'][_0x859e('0x3f')]({'where':{'id':_0x43dd8d['params']['id']}})[_0x859e('0x21')](handleEntityNotFound(_0x520ed3,null))['then'](saveUpdates(_0x43dd8d[_0x859e('0x41')],null))[_0x859e('0x21')](respondWithResult(_0x520ed3,null))['catch'](handleError(_0x520ed3,null));};exports[_0x859e('0x22')]=function(_0x7a6b63,_0x5e4c40){return db[_0x859e('0x27')][_0x859e('0x3f')]({'where':{'id':_0x7a6b63[_0x859e('0x42')]['id']}})[_0x859e('0x21')](handleEntityNotFound(_0x5e4c40,null))['then'](removeEntity(_0x5e4c40,null))[_0x859e('0x3e')](handleError(_0x5e4c40,null));};exports[_0x859e('0x43')]=function(_0x427da0,_0x4eb514){return db[_0x859e('0x27')]['describe']()['then'](respondWithResult(_0x4eb514,null))['catch'](handleError(_0x4eb514,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 5841afe..58b79ad 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 _0x4397=['path','rimraf','../../config/environment','./mailTransferReport.attributes','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1993f9,_0x186177){var _0x80dce7=function(_0x315818){while(--_0x315818){_0x1993f9['push'](_0x1993f9['shift']());}};_0x80dce7(++_0x186177);}(_0x4397,0xe4));var _0x7439=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x4397[_0x4bfade];return _0x272465;};'use strict';var _=require(_0x7439('0x0'));var util=require(_0x7439('0x1'));var logger=require(_0x7439('0x2'))(_0x7439('0x3'));var moment=require(_0x7439('0x4'));var BPromise=require('bluebird');var rp=require(_0x7439('0x5'));var fs=require('fs');var path=require(_0x7439('0x6'));var rimraf=require(_0x7439('0x7'));var config=require(_0x7439('0x8'));var attributes=require(_0x7439('0x9'));module['exports']=function(_0x53caf4,_0x44f245){return _0x53caf4[_0x7439('0xa')]('MailTransferReport',attributes,{'tableName':_0x7439('0xb'),'paranoid':![],'indexes':[{'name':_0x7439('0xc'),'fields':[_0x7439('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea31=['define','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0xea31,0x6b));var _0x1ea3=function(_0x30065c,_0x51410a){_0x30065c=_0x30065c-0x0;var _0x446f52=_0xea31[_0x30065c];return _0x446f52;};'use strict';var _=require(_0x1ea3('0x0'));var util=require('util');var logger=require(_0x1ea3('0x1'))(_0x1ea3('0x2'));var moment=require(_0x1ea3('0x3'));var BPromise=require(_0x1ea3('0x4'));var rp=require(_0x1ea3('0x5'));var fs=require('fs');var path=require(_0x1ea3('0x6'));var rimraf=require(_0x1ea3('0x7'));var config=require('../../config/environment');var attributes=require(_0x1ea3('0x8'));module[_0x1ea3('0x9')]=function(_0x6810da,_0x27c695){return _0x6810da[_0x1ea3('0xa')]('MailTransferReport',attributes,{'tableName':_0x1ea3('0xb'),'paranoid':![],'indexes':[{'name':_0x1ea3('0xc'),'fields':[_0x1ea3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7e22d3a..6dd09f5 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 _0xdc3c=['error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3047e4,_0x22394c){var _0x27195b=function(_0x29fd5f){while(--_0x29fd5f){_0x3047e4['push'](_0x3047e4['shift']());}};_0x27195b(++_0x22394c);}(_0xdc3c,0x1eb));var _0xcdc3=function(_0x497db1,_0xde6298){_0x497db1=_0x497db1-0x0;var _0x2d4d8c=_0xdc3c[_0x497db1];return _0x2d4d8c;};'use strict';var _=require('lodash');var util=require(_0xcdc3('0x0'));var moment=require(_0xcdc3('0x1'));var BPromise=require(_0xcdc3('0x2'));var rs=require(_0xcdc3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdc3('0x4'))['db'];var utils=require(_0xcdc3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcdc3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcdc3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25b8e7,_0x368e88,_0xb227e1){return new BPromise(function(_0x2c394a,_0x96069c){return client['request'](_0x25b8e7,_0xb227e1)[_0xcdc3('0x8')](function(_0xdd1ad1){logger[_0xcdc3('0x9')](_0xcdc3('0xa'),_0x368e88,_0xcdc3('0xb'));logger['debug'](_0xcdc3('0xc'),_0x368e88,_0xcdc3('0xb'),JSON['stringify'](_0xdd1ad1));if(_0xdd1ad1['error']){if(_0xdd1ad1[_0xcdc3('0xd')][_0xcdc3('0xe')]===0x1f4){logger[_0xcdc3('0xd')](_0xcdc3('0xa'),_0x368e88,_0xdd1ad1['error'][_0xcdc3('0xf')]);return _0x96069c(_0xdd1ad1[_0xcdc3('0xd')][_0xcdc3('0xf')]);}logger[_0xcdc3('0xd')](_0xcdc3('0xa'),_0x368e88,_0xdd1ad1[_0xcdc3('0xd')]['message']);return _0x2c394a(_0xdd1ad1[_0xcdc3('0xd')][_0xcdc3('0xf')]);}else{logger['info'](_0xcdc3('0xa'),_0x368e88,_0xcdc3('0xb'));_0x2c394a(_0xdd1ad1[_0xcdc3('0x10')]['message']);}})[_0xcdc3('0x11')](function(_0x5923bd){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x368e88,_0x5923bd);_0x96069c(_0x5923bd);});});} \ No newline at end of file +var _0xff4f=['http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0xff4f,0x156));var _0xfff4=function(_0x35b721,_0xc1366){_0x35b721=_0x35b721-0x0;var _0xfbfa24=_0xff4f[_0x35b721];return _0xfbfa24;};'use strict';var _=require(_0xfff4('0x0'));var util=require(_0xfff4('0x1'));var moment=require(_0xfff4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfff4('0x3'));var db=require(_0xfff4('0x4'))['db'];var utils=require(_0xfff4('0x5'));var logger=require('../../config/logger')(_0xfff4('0x6'));var config=require(_0xfff4('0x7'));var jayson=require(_0xfff4('0x8'));var client=jayson[_0xfff4('0x9')][_0xfff4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d18ed,_0x5965f9,_0x39c8ed){return new BPromise(function(_0x341589,_0x4e482b){return client[_0xfff4('0xb')](_0x3d18ed,_0x39c8ed)[_0xfff4('0xc')](function(_0x44ac7c){logger[_0xfff4('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x5965f9,_0xfff4('0xe'));logger[_0xfff4('0xf')](_0xfff4('0x10'),_0x5965f9,_0xfff4('0xe'),JSON['stringify'](_0x44ac7c));if(_0x44ac7c[_0xfff4('0x11')]){if(_0x44ac7c[_0xfff4('0x11')][_0xfff4('0x12')]===0x1f4){logger[_0xfff4('0x11')](_0xfff4('0x13'),_0x5965f9,_0x44ac7c[_0xfff4('0x11')][_0xfff4('0x14')]);return _0x4e482b(_0x44ac7c['error'][_0xfff4('0x14')]);}logger[_0xfff4('0x11')](_0xfff4('0x13'),_0x5965f9,_0x44ac7c[_0xfff4('0x11')]['message']);return _0x341589(_0x44ac7c['error'][_0xfff4('0x14')]);}else{logger['info'](_0xfff4('0x13'),_0x5965f9,_0xfff4('0xe'));_0x341589(_0x44ac7c['result'][_0xfff4('0x14')]);}})[_0xfff4('0x15')](function(_0x495dc4){logger[_0xfff4('0x11')](_0xfff4('0x13'),_0x5965f9,_0x495dc4);_0x4e482b(_0x495dc4);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 3d913c3..30f40cb 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 _0x4506=['delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','index','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x371d15,_0xd98587){var _0x32afdf=function(_0x587ba3){while(--_0x587ba3){_0x371d15['push'](_0x371d15['shift']());}};_0x32afdf(++_0xd98587);}(_0x4506,0x10c));var _0x6450=function(_0x741188,_0x2058d4){_0x741188=_0x741188-0x0;var _0x1c4766=_0x4506[_0x741188];return _0x1c4766;};'use strict';var multer=require(_0x6450('0x0'));var util=require(_0x6450('0x1'));var path=require('path');var timeout=require(_0x6450('0x2'));var express=require(_0x6450('0x3'));var router=express['Router']();var fs_extra=require(_0x6450('0x4'));var auth=require(_0x6450('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6450('0x6'));var controller=require(_0x6450('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6450('0x8')]);router[_0x6450('0x9')]('/describe',auth[_0x6450('0xa')](),controller[_0x6450('0xb')]);router[_0x6450('0x9')](_0x6450('0xc'),auth['isAuthenticated'](),controller[_0x6450('0xd')]);router[_0x6450('0xe')]('/',auth[_0x6450('0xa')](),controller['create']);router[_0x6450('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6450('0x10')]);router[_0x6450('0x11')](_0x6450('0xc'),auth[_0x6450('0xa')](),controller['destroy']);module[_0x6450('0x12')]=router; \ No newline at end of file +var _0xdb6b=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x462c25,_0x8c4f78){var _0x2e57b5=function(_0x1850c3){while(--_0x1850c3){_0x462c25['push'](_0x462c25['shift']());}};_0x2e57b5(++_0x8c4f78);}(_0xdb6b,0x172));var _0xbdb6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb6b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbdb6('0x0'));var util=require(_0xbdb6('0x1'));var path=require(_0xbdb6('0x2'));var timeout=require(_0xbdb6('0x3'));var express=require(_0xbdb6('0x4'));var router=express['Router']();var fs_extra=require(_0xbdb6('0x5'));var auth=require(_0xbdb6('0x6'));var interaction=require(_0xbdb6('0x7'));var config=require(_0xbdb6('0x8'));var controller=require(_0xbdb6('0x9'));router[_0xbdb6('0xa')]('/',auth[_0xbdb6('0xb')](),controller[_0xbdb6('0xc')]);router['get']('/describe',auth[_0xbdb6('0xb')](),controller[_0xbdb6('0xd')]);router[_0xbdb6('0xa')](_0xbdb6('0xe'),auth[_0xbdb6('0xb')](),controller[_0xbdb6('0xf')]);router['post']('/',auth[_0xbdb6('0xb')](),controller[_0xbdb6('0x10')]);router[_0xbdb6('0x11')](_0xbdb6('0xe'),auth[_0xbdb6('0xb')](),controller[_0xbdb6('0x12')]);router[_0xbdb6('0x13')](_0xbdb6('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xbdb6('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index be26b21..f506637 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 _0x6c6f=['duration','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x1c6674,_0x32de88){_0x1c6674=_0x1c6674-0x0;var _0x4c807f=_0x6c6f[_0x1c6674];return _0x4c807f;};'use strict';var Sequelize=require(_0xf6c6('0x0'));var moment=require(_0xf6c6('0x1'));module[_0xf6c6('0x2')]={'channel':{'type':Sequelize[_0xf6c6('0x3')]},'membername':{'type':Sequelize[_0xf6c6('0x3')]},'interface':{'type':Sequelize[_0xf6c6('0x3')]},'type':{'type':Sequelize[_0xf6c6('0x3')],'defaultValue':_0xf6c6('0x4'),'comment':_0xf6c6('0x5')},'duration':{'type':Sequelize[_0xf6c6('0x6')]},'enterAt':{'type':Sequelize[_0xf6c6('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x3b4e7b){var _0x4f8e34=moment(_0x3b4e7b);var _0x4c27f8=moment(this[_0xf6c6('0x8')]('enterAt'));var _0x308c42=_0x4f8e34[_0xf6c6('0x9')](_0x4c27f8,_0xf6c6('0xa'));this[_0xf6c6('0xb')](_0xf6c6('0xc'),_0x3b4e7b);this['setDataValue'](_0xf6c6('0xd'),_0x308c42||null);}},'data1':{'type':Sequelize[_0xf6c6('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xf6c6('0x3')],'comment':_0xf6c6('0xe')},'data3':{'type':Sequelize[_0xf6c6('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xf6c6('0x3')],'comment':_0xf6c6('0xf')},'data5':{'type':Sequelize[_0xf6c6('0x3')],'comment':_0xf6c6('0x10')},'role':{'type':Sequelize[_0xf6c6('0x3')]},'internal':{'type':Sequelize[_0xf6c6('0x6')]},'uniqueid':{'type':Sequelize[_0xf6c6('0x3')]}}; \ No newline at end of file +var _0x5640=['diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x4fb789,_0x6b8092){var _0x49b5e4=function(_0x256537){while(--_0x256537){_0x4fb789['push'](_0x4fb789['shift']());}};_0x49b5e4(++_0x6b8092);}(_0x5640,0x111));var _0x0564=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5640[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x0564('0x0'));var moment=require('moment');module[_0x0564('0x1')]={'channel':{'type':Sequelize[_0x0564('0x2')]},'membername':{'type':Sequelize[_0x0564('0x2')]},'interface':{'type':Sequelize[_0x0564('0x2')]},'type':{'type':Sequelize[_0x0564('0x2')],'defaultValue':_0x0564('0x3'),'comment':_0x0564('0x4')},'duration':{'type':Sequelize[_0x0564('0x5')]},'enterAt':{'type':Sequelize[_0x0564('0x6')]},'exitAt':{'type':Sequelize[_0x0564('0x6')],'set':function(_0x23566f){var _0x1260bf=moment(_0x23566f);var _0x3deac1=moment(this['getDataValue']('enterAt'));var _0x9e3a60=_0x1260bf[_0x0564('0x7')](_0x3deac1,_0x0564('0x8'));this[_0x0564('0x9')]('exitAt',_0x23566f);this[_0x0564('0x9')](_0x0564('0xa'),_0x9e3a60||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x0564('0xb')},'data2':{'type':Sequelize[_0x0564('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x0564('0x2')],'comment':_0x0564('0xc')},'data4':{'type':Sequelize[_0x0564('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x0564('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x0564('0x5')]},'uniqueid':{'type':Sequelize[_0x0564('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index db26f8d..d3d9d86 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x55ca,0x126));var _0xa55c=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x55ca[_0x387dc1];return _0x17567c;};'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(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +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(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x34e8,0x12c));var _0x834e=function(_0x43110e,_0x5cbde2){_0x43110e=_0x43110e-0x0;var _0x2ec1a5=_0x34e8[_0x43110e];return _0x2ec1a5;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 45239e5..9c98f5a 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 _0xafc8=['membername','interface','lodash','../../config/logger','moment','request-promise','path','rimraf','exports','define','MemberReport','report_member'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xafc8,0x7a));var _0x8afc=function(_0x3f583b,_0x3ba897){_0x3f583b=_0x3f583b-0x0;var _0x362b11=_0xafc8[_0x3f583b];return _0x362b11;};'use strict';var _=require(_0x8afc('0x0'));var util=require('util');var logger=require(_0x8afc('0x1'))('api');var moment=require(_0x8afc('0x2'));var BPromise=require('bluebird');var rp=require(_0x8afc('0x3'));var fs=require('fs');var path=require(_0x8afc('0x4'));var rimraf=require(_0x8afc('0x5'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x8afc('0x6')]=function(_0x130467,_0x543fc7){return _0x130467[_0x8afc('0x7')](_0x8afc('0x8'),attributes,{'tableName':_0x8afc('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x8afc('0xa'),_0x8afc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd20a=['rimraf','./memberReport.attributes','exports','define','report_member','membername_interface','interface','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4d5a55,_0x434f92){var _0x520249=function(_0x454eb0){while(--_0x454eb0){_0x4d5a55['push'](_0x4d5a55['shift']());}};_0x520249(++_0x434f92);}(_0xd20a,0xcb));var _0xad20=function(_0x1abd98,_0x4efa0b){_0x1abd98=_0x1abd98-0x0;var _0x547194=_0xd20a[_0x1abd98];return _0x547194;};'use strict';var _=require(_0xad20('0x0'));var util=require(_0xad20('0x1'));var logger=require('../../config/logger')(_0xad20('0x2'));var moment=require(_0xad20('0x3'));var BPromise=require(_0xad20('0x4'));var rp=require(_0xad20('0x5'));var fs=require('fs');var path=require(_0xad20('0x6'));var rimraf=require(_0xad20('0x7'));var config=require('../../config/environment');var attributes=require(_0xad20('0x8'));module[_0xad20('0x9')]=function(_0x48a683,_0x21d5c4){return _0x48a683[_0xad20('0xa')]('MemberReport',attributes,{'tableName':_0xad20('0xb'),'paranoid':![],'indexes':[{'name':_0xad20('0xc'),'fields':['membername',_0xad20('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 f8a7007..f0e70e6 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 _0xdb2a=['MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetMemberReport','findAll','options','raw','where','include','model','attributes','map','debug','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xdb2a,0x16f));var _0xadb2=function(_0x25ef05,_0xe7ff29){_0x25ef05=_0x25ef05-0x0;var _0x20aa37=_0xdb2a[_0x25ef05];return _0x20aa37;};'use strict';var _=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var moment=require(_0xadb2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb2('0x3'));var db=require(_0xadb2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xadb2('0x5'))('rpc');var config=require(_0xadb2('0x6'));var jayson=require(_0xadb2('0x7'));var client=jayson[_0xadb2('0x8')][_0xadb2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x338460,_0x50f98e,_0x25ef26){return new BPromise(function(_0x51453d,_0x173ed2){return client[_0xadb2('0xa')](_0x338460,_0x25ef26)[_0xadb2('0xb')](function(_0x5c279d){logger[_0xadb2('0xc')](_0xadb2('0xd'),_0x50f98e,_0xadb2('0xe'));logger['debug'](_0xadb2('0xf'),_0x50f98e,'request\x20sent',JSON[_0xadb2('0x10')](_0x5c279d));if(_0x5c279d['error']){if(_0x5c279d['error'][_0xadb2('0x11')]===0x1f4){logger[_0xadb2('0x12')](_0xadb2('0xd'),_0x50f98e,_0x5c279d[_0xadb2('0x12')]['message']);return _0x173ed2(_0x5c279d[_0xadb2('0x12')][_0xadb2('0x13')]);}logger[_0xadb2('0x12')](_0xadb2('0xd'),_0x50f98e,_0x5c279d[_0xadb2('0x12')][_0xadb2('0x13')]);return _0x51453d(_0x5c279d[_0xadb2('0x12')][_0xadb2('0x13')]);}else{logger[_0xadb2('0xc')]('MemberReport,\x20%s,\x20%s',_0x50f98e,_0xadb2('0xe'));_0x51453d(_0x5c279d[_0xadb2('0x14')]['message']);}})[_0xadb2('0x15')](function(_0x5b9662){logger[_0xadb2('0x12')](_0xadb2('0xd'),_0x50f98e,_0x5b9662);_0x173ed2(_0x5b9662);});});}exports[_0xadb2('0x16')]=function(_0x4c36f4){var _0x4f963c=this;return new Promise(function(_0x46f589,_0x16e5f5){return db['MemberReport'][_0xadb2('0x17')]({'raw':_0x4c36f4[_0xadb2('0x18')]?_0x4c36f4[_0xadb2('0x18')][_0xadb2('0x19')]===undefined?!![]:![]:!![],'where':_0x4c36f4[_0xadb2('0x18')]?_0x4c36f4[_0xadb2('0x18')][_0xadb2('0x1a')]||null:null,'attributes':_0x4c36f4[_0xadb2('0x18')]?_0x4c36f4[_0xadb2('0x18')]['attributes']||null:null,'limit':_0x4c36f4[_0xadb2('0x18')]?_0x4c36f4[_0xadb2('0x18')]['limit']||null:null,'include':_0x4c36f4[_0xadb2('0x18')]?_0x4c36f4[_0xadb2('0x18')][_0xadb2('0x1b')]?_['map'](_0x4c36f4[_0xadb2('0x18')]['include'],function(_0x2f6011){return{'model':db[_0x2f6011[_0xadb2('0x1c')]],'as':_0x2f6011['as'],'attributes':_0x2f6011[_0xadb2('0x1d')],'include':_0x2f6011[_0xadb2('0x1b')]?_[_0xadb2('0x1e')](_0x2f6011[_0xadb2('0x1b')],function(_0x20dd83){return{'model':db[_0x20dd83[_0xadb2('0x1c')]],'as':_0x20dd83['as'],'attributes':_0x20dd83[_0xadb2('0x1d')],'include':_0x20dd83[_0xadb2('0x1b')]?_['map'](_0x20dd83['include'],function(_0x16020b){return{'model':db[_0x16020b[_0xadb2('0x1c')]],'as':_0x16020b['as'],'attributes':_0x16020b[_0xadb2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xadb2('0xb')](function(_0x421f05){logger[_0xadb2('0xc')](_0xadb2('0x16'),_0x4c36f4);logger[_0xadb2('0x1f')](_0xadb2('0x16'),_0x4c36f4,JSON['stringify'](_0x421f05));_0x46f589(_0x421f05);})['catch'](function(_0x31fa00){logger['error']('GetMemberReport',_0x31fa00[_0xadb2('0x13')],_0x4c36f4);_0x16e5f5(_0x4f963c['error'](0x1f4,_0x31fa00['message']));});});};exports[_0xadb2('0x20')]=function(_0x45393e){var _0x2a16c3=this;return new Promise(function(_0x2c2428,_0x1dbd0a){return db[_0xadb2('0x21')][_0xadb2('0x22')](_0x45393e[_0xadb2('0x23')],{'raw':_0x45393e[_0xadb2('0x18')]?_0x45393e['options'][_0xadb2('0x19')]===undefined?!![]:![]:!![]})[_0xadb2('0xb')](function(_0x12c4fb){logger[_0xadb2('0xc')]('CreateMemberReport',_0x45393e);logger[_0xadb2('0x1f')]('CreateMemberReport',_0x45393e,JSON[_0xadb2('0x10')](_0x12c4fb));_0x2c2428(_0x12c4fb);})[_0xadb2('0x15')](function(_0xaa3a0a){logger[_0xadb2('0x12')](_0xadb2('0x20'),_0xaa3a0a[_0xadb2('0x13')],_0x45393e);_0x1dbd0a(_0x2a16c3['error'](0x1f4,_0xaa3a0a[_0xadb2('0x13')]));});});};exports[_0xadb2('0x24')]=function(_0x1008cb){var _0x411dcd=this;return new Promise(function(_0x448676,_0xf3a6a1){return db['MemberReport']['update'](_0x1008cb['body'],{'raw':_0x1008cb['options']?_0x1008cb[_0xadb2('0x18')][_0xadb2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1008cb[_0xadb2('0x18')]?_0x1008cb['options']['where']||null:null,'attributes':_0x1008cb[_0xadb2('0x18')]?_0x1008cb['options'][_0xadb2('0x1d')]||null:null,'limit':_0x1008cb[_0xadb2('0x18')]?_0x1008cb[_0xadb2('0x18')][_0xadb2('0x25')]||null:null})[_0xadb2('0xb')](function(_0x1e1127){logger[_0xadb2('0xc')]('UpdateMemberReport',_0x1008cb);logger[_0xadb2('0x1f')](_0xadb2('0x24'),_0x1008cb,JSON[_0xadb2('0x10')](_0x1e1127));_0x448676(_0x1e1127);})['catch'](function(_0x167799){logger[_0xadb2('0x12')](_0xadb2('0x24'),_0x167799['message'],_0x1008cb);_0xf3a6a1(_0x411dcd[_0xadb2('0x12')](0x1f4,_0x167799[_0xadb2('0x13')]));});});}; \ No newline at end of file +var _0xaa48=['result','GetMemberReport','findAll','raw','options','where','attributes','limit','include','model','map','debug','catch','CreateMemberReport','MemberReport','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2f5f2b,_0x7112b2){var _0xab6a83=function(_0x35f519){while(--_0x35f519){_0x2f5f2b['push'](_0x2f5f2b['shift']());}};_0xab6a83(++_0x7112b2);}(_0xaa48,0x15a));var _0x8aa4=function(_0x5167d5,_0x4b941f){_0x5167d5=_0x5167d5-0x0;var _0x4c33a8=_0xaa48[_0x5167d5];return _0x4c33a8;};'use strict';var _=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var moment=require(_0x8aa4('0x2'));var BPromise=require(_0x8aa4('0x3'));var rs=require(_0x8aa4('0x4'));var fs=require('fs');var Redis=require(_0x8aa4('0x5'));var db=require(_0x8aa4('0x6'))['db'];var utils=require(_0x8aa4('0x7'));var logger=require(_0x8aa4('0x8'))(_0x8aa4('0x9'));var config=require(_0x8aa4('0xa'));var jayson=require(_0x8aa4('0xb'));var client=jayson[_0x8aa4('0xc')][_0x8aa4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x17bf06,_0x111c1d,_0x37498b){return new BPromise(function(_0xa5c92e,_0x17b04d){return client['request'](_0x17bf06,_0x37498b)[_0x8aa4('0xe')](function(_0x1e7e28){logger['info'](_0x8aa4('0xf'),_0x111c1d,_0x8aa4('0x10'));logger['debug'](_0x8aa4('0x11'),_0x111c1d,_0x8aa4('0x10'),JSON[_0x8aa4('0x12')](_0x1e7e28));if(_0x1e7e28[_0x8aa4('0x13')]){if(_0x1e7e28[_0x8aa4('0x13')][_0x8aa4('0x14')]===0x1f4){logger[_0x8aa4('0x13')](_0x8aa4('0xf'),_0x111c1d,_0x1e7e28[_0x8aa4('0x13')][_0x8aa4('0x15')]);return _0x17b04d(_0x1e7e28['error']['message']);}logger[_0x8aa4('0x13')](_0x8aa4('0xf'),_0x111c1d,_0x1e7e28[_0x8aa4('0x13')][_0x8aa4('0x15')]);return _0xa5c92e(_0x1e7e28[_0x8aa4('0x13')][_0x8aa4('0x15')]);}else{logger[_0x8aa4('0x16')](_0x8aa4('0xf'),_0x111c1d,_0x8aa4('0x10'));_0xa5c92e(_0x1e7e28[_0x8aa4('0x17')]['message']);}})['catch'](function(_0x5d1819){logger[_0x8aa4('0x13')](_0x8aa4('0xf'),_0x111c1d,_0x5d1819);_0x17b04d(_0x5d1819);});});}exports[_0x8aa4('0x18')]=function(_0x37cc28){var _0x5313a6=this;return new Promise(function(_0xa765ce,_0x1659d3){return db['MemberReport'][_0x8aa4('0x19')]({'raw':_0x37cc28['options']?_0x37cc28['options'][_0x8aa4('0x1a')]===undefined?!![]:![]:!![],'where':_0x37cc28['options']?_0x37cc28[_0x8aa4('0x1b')][_0x8aa4('0x1c')]||null:null,'attributes':_0x37cc28['options']?_0x37cc28[_0x8aa4('0x1b')][_0x8aa4('0x1d')]||null:null,'limit':_0x37cc28['options']?_0x37cc28[_0x8aa4('0x1b')][_0x8aa4('0x1e')]||null:null,'include':_0x37cc28[_0x8aa4('0x1b')]?_0x37cc28[_0x8aa4('0x1b')][_0x8aa4('0x1f')]?_['map'](_0x37cc28['options']['include'],function(_0x4984f9){return{'model':db[_0x4984f9[_0x8aa4('0x20')]],'as':_0x4984f9['as'],'attributes':_0x4984f9['attributes'],'include':_0x4984f9[_0x8aa4('0x1f')]?_[_0x8aa4('0x21')](_0x4984f9[_0x8aa4('0x1f')],function(_0x387434){return{'model':db[_0x387434['model']],'as':_0x387434['as'],'attributes':_0x387434['attributes'],'include':_0x387434[_0x8aa4('0x1f')]?_['map'](_0x387434[_0x8aa4('0x1f')],function(_0x4145ed){return{'model':db[_0x4145ed['model']],'as':_0x4145ed['as'],'attributes':_0x4145ed[_0x8aa4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39ce27){logger['info'](_0x8aa4('0x18'),_0x37cc28);logger[_0x8aa4('0x22')](_0x8aa4('0x18'),_0x37cc28,JSON[_0x8aa4('0x12')](_0x39ce27));_0xa765ce(_0x39ce27);})[_0x8aa4('0x23')](function(_0x4ba8b8){logger['error']('GetMemberReport',_0x4ba8b8[_0x8aa4('0x15')],_0x37cc28);_0x1659d3(_0x5313a6[_0x8aa4('0x13')](0x1f4,_0x4ba8b8['message']));});});};exports[_0x8aa4('0x24')]=function(_0x1f452e){var _0x3e4595=this;return new Promise(function(_0x3633d1,_0x31443b){return db[_0x8aa4('0x25')]['create'](_0x1f452e[_0x8aa4('0x26')],{'raw':_0x1f452e['options']?_0x1f452e['options'][_0x8aa4('0x1a')]===undefined?!![]:![]:!![]})[_0x8aa4('0xe')](function(_0x1cecce){logger[_0x8aa4('0x16')](_0x8aa4('0x24'),_0x1f452e);logger['debug'](_0x8aa4('0x24'),_0x1f452e,JSON[_0x8aa4('0x12')](_0x1cecce));_0x3633d1(_0x1cecce);})[_0x8aa4('0x23')](function(_0x4ba360){logger['error']('CreateMemberReport',_0x4ba360['message'],_0x1f452e);_0x31443b(_0x3e4595[_0x8aa4('0x13')](0x1f4,_0x4ba360[_0x8aa4('0x15')]));});});};exports[_0x8aa4('0x27')]=function(_0x10d821){var _0x4e3eb0=this;return new Promise(function(_0x5e85a6,_0x1765b7){return db[_0x8aa4('0x25')][_0x8aa4('0x28')](_0x10d821[_0x8aa4('0x26')],{'raw':_0x10d821[_0x8aa4('0x1b')]?_0x10d821['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10d821[_0x8aa4('0x1b')]?_0x10d821[_0x8aa4('0x1b')][_0x8aa4('0x1c')]||null:null,'attributes':_0x10d821['options']?_0x10d821[_0x8aa4('0x1b')][_0x8aa4('0x1d')]||null:null,'limit':_0x10d821['options']?_0x10d821[_0x8aa4('0x1b')][_0x8aa4('0x1e')]||null:null})[_0x8aa4('0xe')](function(_0x54c6d9){logger[_0x8aa4('0x16')]('UpdateMemberReport',_0x10d821);logger['debug'](_0x8aa4('0x27'),_0x10d821,JSON['stringify'](_0x54c6d9));_0x5e85a6(_0x54c6d9);})[_0x8aa4('0x23')](function(_0x29d058){logger['error'](_0x8aa4('0x27'),_0x29d058[_0x8aa4('0x15')],_0x10d821);_0x1765b7(_0x4e3eb0[_0x8aa4('0x13')](0x1f4,_0x29d058[_0x8aa4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 3a986bc..1264a7e 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 _0x8ca9=['express','Router','fs-extra','../../config/environment','get','exports','multer','util','path','connect-timeout'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x8ca9,0x9c));var _0x98ca=function(_0x4c23cc,_0x46193e){_0x4c23cc=_0x4c23cc-0x0;var _0x1b1dc2=_0x8ca9[_0x4c23cc];return _0x1b1dc2;};'use strict';var multer=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var path=require(_0x98ca('0x2'));var timeout=require(_0x98ca('0x3'));var express=require(_0x98ca('0x4'));var router=express[_0x98ca('0x5')]();var fs_extra=require(_0x98ca('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x98ca('0x7'));var controller=require('./migration.controller');router[_0x98ca('0x8')]('/',controller['index']);module[_0x98ca('0x9')]=router; \ No newline at end of file +var _0x88e3=['get','index','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./migration.controller'];(function(_0x5efa4b,_0x40d22c){var _0x1b7f87=function(_0x4f765e){while(--_0x4f765e){_0x5efa4b['push'](_0x5efa4b['shift']());}};_0x1b7f87(++_0x40d22c);}(_0x88e3,0xa3));var _0x388e=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x88e3[_0x381379];return _0x3e1063;};'use strict';var multer=require('multer');var util=require(_0x388e('0x0'));var path=require(_0x388e('0x1'));var timeout=require(_0x388e('0x2'));var express=require(_0x388e('0x3'));var router=express['Router']();var fs_extra=require(_0x388e('0x4'));var auth=require(_0x388e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x388e('0x6'));router[_0x388e('0x7')]('/',controller[_0x388e('0x8')]);module[_0x388e('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index ce26268..949ef25 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 _0x4afd=['sequelize','STRING'];(function(_0x58c86a,_0x602654){var _0x2bb374=function(_0x1302a9){while(--_0x1302a9){_0x58c86a['push'](_0x58c86a['shift']());}};_0x2bb374(++_0x602654);}(_0x4afd,0xbe));var _0xd4af=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4afd[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xd4af('0x0'));module['exports']={'version':{'type':Sequelize[_0xd4af('0x1')],'unique':'version'}}; \ No newline at end of file +var _0x1a76=['STRING','version'];(function(_0x4a6fd0,_0x29621a){var _0x318b5a=function(_0x595e5a){while(--_0x595e5a){_0x4a6fd0['push'](_0x4a6fd0['shift']());}};_0x318b5a(++_0x29621a);}(_0x1a76,0x124));var _0x61a7=function(_0x5a401e,_0x2de782){_0x5a401e=_0x5a401e-0x0;var _0x2aa2cc=_0x1a76[_0x5a401e];return _0x2aa2cc;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x61a7('0x0')],'unique':_0x61a7('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index b1a1204..e9be7cb 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 _0xe787=['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','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','Migration','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0xe787,0x14d));var _0x7e78=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0xe787[_0x210603];return _0x1bcb7d;};'use strict';var emlformat=require(_0x7e78('0x0'));var rimraf=require(_0x7e78('0x1'));var zipdir=require(_0x7e78('0x2'));var jsonpatch=require(_0x7e78('0x3'));var rp=require(_0x7e78('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e78('0x5'));var util=require(_0x7e78('0x6'));var path=require(_0x7e78('0x7'));var sox=require(_0x7e78('0x8'));var csv=require(_0x7e78('0x9'));var ejs=require(_0x7e78('0xa'));var fs=require('fs');var fs_extra=require(_0x7e78('0xb'));var _=require(_0x7e78('0xc'));var squel=require(_0x7e78('0xd'));var crypto=require(_0x7e78('0xe'));var jsforce=require(_0x7e78('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7e78('0x9'));var querystring=require('querystring');var Papa=require(_0x7e78('0x10'));var Redis=require(_0x7e78('0x11'));var authService=require(_0x7e78('0x12'));var qs=require(_0x7e78('0x13'));var as=require(_0x7e78('0x14'));var hardwareService=require(_0x7e78('0x15'));var logger=require(_0x7e78('0x16'))(_0x7e78('0x17'));var utils=require(_0x7e78('0x18'));var config=require(_0x7e78('0x19'));var licenseUtil=require(_0x7e78('0x1a'));var db=require(_0x7e78('0x1b'))['db'];function respondWithStatusCode(_0x3758ce,_0x2cae6b){_0x2cae6b=_0x2cae6b||0xcc;return function(_0x32c605){if(_0x32c605){return _0x3758ce['sendStatus'](_0x2cae6b);}return _0x3758ce[_0x7e78('0x1c')](_0x2cae6b)[_0x7e78('0x1d')]();};}function respondWithResult(_0x42c664,_0x51415a){_0x51415a=_0x51415a||0xc8;return function(_0x399b79){if(_0x399b79){return _0x42c664[_0x7e78('0x1c')](_0x51415a)[_0x7e78('0x1e')](_0x399b79);}};}function respondWithFilteredResult(_0x295665,_0x18fae3){return function(_0x3a30b3){if(_0x3a30b3){var _0x2cc50f=typeof _0x18fae3['offset']===_0x7e78('0x1f')&&typeof _0x18fae3[_0x7e78('0x20')]==='undefined';var _0xcc45ad=_0x3a30b3[_0x7e78('0x21')];var _0x48eddb=_0x2cc50f?0x0:_0x18fae3[_0x7e78('0x22')];var _0x449a51=_0x2cc50f?_0x3a30b3['count']:_0x18fae3[_0x7e78('0x22')]+_0x18fae3[_0x7e78('0x20')];var _0x2f65d4;if(_0x449a51>=_0xcc45ad){_0x449a51=_0xcc45ad;_0x2f65d4=0xc8;}else{_0x2f65d4=0xce;}_0x295665[_0x7e78('0x1c')](_0x2f65d4);return _0x295665[_0x7e78('0x23')](_0x7e78('0x24'),_0x48eddb+'-'+_0x449a51+'/'+_0xcc45ad)[_0x7e78('0x1e')](_0x3a30b3);}return null;};}function patchUpdates(_0x5dd440){return function(_0x25c556){try{jsonpatch[_0x7e78('0x25')](_0x25c556,_0x5dd440,!![]);}catch(_0x208d6a){return BPromise[_0x7e78('0x26')](_0x208d6a);}return _0x25c556[_0x7e78('0x27')]();};}function saveUpdates(_0x445e56,_0xb8eb07){return function(_0x32e3fc){if(_0x32e3fc){return _0x32e3fc['update'](_0x445e56)[_0x7e78('0x28')](function(_0x1d9609){return _0x1d9609;});}return null;};}function removeEntity(_0x4da4e0,_0x36cb04){return function(_0x22ff5a){if(_0x22ff5a){return _0x22ff5a[_0x7e78('0x29')]()['then'](function(){_0x4da4e0[_0x7e78('0x1c')](0xcc)[_0x7e78('0x1d')]();});}};}function handleEntityNotFound(_0x4569cb,_0x80cd18){return function(_0x1622c4){if(!_0x1622c4){_0x4569cb[_0x7e78('0x2a')](0x194);}return _0x1622c4;};}function handleError(_0x19063b,_0x6e5481){_0x6e5481=_0x6e5481||0x1f4;return function(_0x4368af){logger[_0x7e78('0x2b')](_0x4368af[_0x7e78('0x2c')]);if(_0x4368af['name']){delete _0x4368af[_0x7e78('0x2d')];}_0x19063b['status'](_0x6e5481)['send'](_0x4368af);};}exports[_0x7e78('0x2e')]=function(_0x427284,_0x311b63){var _0x8c0807={},_0x5cfd36={},_0x4117a7={'count':0x0,'rows':[]};var _0x203eda=_[_0x7e78('0x2f')](db['Migration'][_0x7e78('0x30')],function(_0x40afa4){return{'name':_0x40afa4['fieldName'],'type':_0x40afa4['type'][_0x7e78('0x31')]};});_0x5cfd36[_0x7e78('0x32')]=_['map'](_0x203eda,_0x7e78('0x2d'));_0x5cfd36[_0x7e78('0x33')]=_[_0x7e78('0x34')](_0x427284[_0x7e78('0x33')]);_0x5cfd36[_0x7e78('0x35')]=_[_0x7e78('0x36')](_0x5cfd36['model'],_0x5cfd36['query']);_0x8c0807[_0x7e78('0x37')]=_[_0x7e78('0x36')](_0x5cfd36['model'],qs['fields'](_0x427284[_0x7e78('0x33')][_0x7e78('0x38')]));_0x8c0807[_0x7e78('0x37')]=_0x8c0807[_0x7e78('0x37')]['length']?_0x8c0807['attributes']:_0x5cfd36[_0x7e78('0x32')];if(!_0x427284['query'][_0x7e78('0x39')]('nolimit')){_0x8c0807[_0x7e78('0x20')]=qs[_0x7e78('0x20')](_0x427284['query'][_0x7e78('0x20')]);_0x8c0807[_0x7e78('0x22')]=qs['offset'](_0x427284[_0x7e78('0x33')][_0x7e78('0x22')]);}_0x8c0807[_0x7e78('0x3a')]=qs[_0x7e78('0x3b')](_0x427284[_0x7e78('0x33')][_0x7e78('0x3b')]);_0x8c0807[_0x7e78('0x3c')]=qs['filters'](_[_0x7e78('0x3d')](_0x427284['query'],_0x5cfd36['filters']),_0x203eda);if(_0x427284[_0x7e78('0x33')]['filter']){_0x8c0807[_0x7e78('0x3c')]=_[_0x7e78('0x3e')](_0x8c0807[_0x7e78('0x3c')],{'$or':_[_0x7e78('0x2f')](_0x203eda,function(_0x45ca67){if(_0x45ca67['type']!==_0x7e78('0x3f')){var _0x7e4786={};_0x7e4786[_0x45ca67[_0x7e78('0x2d')]]={'$like':'%'+_0x427284[_0x7e78('0x33')][_0x7e78('0x40')]+'%'};return _0x7e4786;}})});}_0x8c0807=_[_0x7e78('0x3e')]({},_0x8c0807,_0x427284[_0x7e78('0x41')]);var _0x5a896f={'where':_0x8c0807[_0x7e78('0x3c')]};return db[_0x7e78('0x42')][_0x7e78('0x21')](_0x5a896f)['then'](function(_0x459909){_0x4117a7[_0x7e78('0x21')]=_0x459909;if(_0x427284[_0x7e78('0x33')]['includeAll']){_0x8c0807[_0x7e78('0x43')]=[{'all':!![]}];}return db['Migration'][_0x7e78('0x44')](_0x8c0807);})['then'](function(_0x2f7087){_0x4117a7['rows']=_0x2f7087;return _0x4117a7;})['then'](respondWithFilteredResult(_0x311b63,_0x8c0807))[_0x7e78('0x45')](handleError(_0x311b63,null));}; \ No newline at end of file +var _0x3824=['eml-format','rimraf','zip-dir','fast-json-patch','moment','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/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x3824,0xcf));var _0x4382=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0x3824[_0x4cee4b];return _0x4d891d;};'use strict';var emlformat=require(_0x4382('0x0'));var rimraf=require(_0x4382('0x1'));var zipdir=require(_0x4382('0x2'));var jsonpatch=require(_0x4382('0x3'));var rp=require('request-promise');var moment=require(_0x4382('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4382('0x5'));var util=require(_0x4382('0x6'));var path=require(_0x4382('0x7'));var sox=require(_0x4382('0x8'));var csv=require(_0x4382('0x9'));var ejs=require(_0x4382('0xa'));var fs=require('fs');var fs_extra=require(_0x4382('0xb'));var _=require(_0x4382('0xc'));var squel=require(_0x4382('0xd'));var crypto=require(_0x4382('0xe'));var jsforce=require(_0x4382('0xf'));var deskjs=require(_0x4382('0x10'));var toCsv=require(_0x4382('0x9'));var querystring=require(_0x4382('0x11'));var Papa=require(_0x4382('0x12'));var Redis=require(_0x4382('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4382('0x14'));var as=require(_0x4382('0x15'));var hardwareService=require(_0x4382('0x16'));var logger=require(_0x4382('0x17'))(_0x4382('0x18'));var utils=require('../../config/utils');var config=require(_0x4382('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4382('0x1a'))['db'];function respondWithStatusCode(_0x3929a1,_0x2a3041){_0x2a3041=_0x2a3041||0xcc;return function(_0x4b4ce1){if(_0x4b4ce1){return _0x3929a1[_0x4382('0x1b')](_0x2a3041);}return _0x3929a1[_0x4382('0x1c')](_0x2a3041)[_0x4382('0x1d')]();};}function respondWithResult(_0x1ae762,_0x31600b){_0x31600b=_0x31600b||0xc8;return function(_0x1f256f){if(_0x1f256f){return _0x1ae762['status'](_0x31600b)[_0x4382('0x1e')](_0x1f256f);}};}function respondWithFilteredResult(_0x991ba0,_0x4a8397){return function(_0x451ed0){if(_0x451ed0){var _0x36cde4=typeof _0x4a8397[_0x4382('0x1f')]===_0x4382('0x20')&&typeof _0x4a8397[_0x4382('0x21')]===_0x4382('0x20');var _0x268216=_0x451ed0[_0x4382('0x22')];var _0x5d7af4=_0x36cde4?0x0:_0x4a8397['offset'];var _0x1363fd=_0x36cde4?_0x451ed0[_0x4382('0x22')]:_0x4a8397[_0x4382('0x1f')]+_0x4a8397['limit'];var _0x1ffd65;if(_0x1363fd>=_0x268216){_0x1363fd=_0x268216;_0x1ffd65=0xc8;}else{_0x1ffd65=0xce;}_0x991ba0[_0x4382('0x1c')](_0x1ffd65);return _0x991ba0['set'](_0x4382('0x23'),_0x5d7af4+'-'+_0x1363fd+'/'+_0x268216)[_0x4382('0x1e')](_0x451ed0);}return null;};}function patchUpdates(_0x102528){return function(_0x139087){try{jsonpatch[_0x4382('0x24')](_0x139087,_0x102528,!![]);}catch(_0x2f6217){return BPromise['reject'](_0x2f6217);}return _0x139087[_0x4382('0x25')]();};}function saveUpdates(_0x318f91,_0x39a240){return function(_0x51cb22){if(_0x51cb22){return _0x51cb22[_0x4382('0x26')](_0x318f91)[_0x4382('0x27')](function(_0x21c9fd){return _0x21c9fd;});}return null;};}function removeEntity(_0x111cf4,_0x40e95c){return function(_0x328822){if(_0x328822){return _0x328822['destroy']()[_0x4382('0x27')](function(){_0x111cf4[_0x4382('0x1c')](0xcc)[_0x4382('0x1d')]();});}};}function handleEntityNotFound(_0xb1f06,_0x17043c){return function(_0x2f4770){if(!_0x2f4770){_0xb1f06[_0x4382('0x1b')](0x194);}return _0x2f4770;};}function handleError(_0x34a863,_0x16e28d){_0x16e28d=_0x16e28d||0x1f4;return function(_0x6ba3db){logger['error'](_0x6ba3db[_0x4382('0x28')]);if(_0x6ba3db[_0x4382('0x29')]){delete _0x6ba3db['name'];}_0x34a863[_0x4382('0x1c')](_0x16e28d)[_0x4382('0x2a')](_0x6ba3db);};}exports[_0x4382('0x2b')]=function(_0x1ced8e,_0x4c4061){var _0x430ff2={},_0x2f29f9={},_0xfb2601={'count':0x0,'rows':[]};var _0x261c13=_['map'](db[_0x4382('0x2c')][_0x4382('0x2d')],function(_0x5207f9){return{'name':_0x5207f9[_0x4382('0x2e')],'type':_0x5207f9[_0x4382('0x2f')][_0x4382('0x30')]};});_0x2f29f9[_0x4382('0x31')]=_[_0x4382('0x32')](_0x261c13,_0x4382('0x29'));_0x2f29f9[_0x4382('0x33')]=_[_0x4382('0x34')](_0x1ced8e[_0x4382('0x33')]);_0x2f29f9[_0x4382('0x35')]=_[_0x4382('0x36')](_0x2f29f9[_0x4382('0x31')],_0x2f29f9[_0x4382('0x33')]);_0x430ff2[_0x4382('0x37')]=_['intersection'](_0x2f29f9[_0x4382('0x31')],qs[_0x4382('0x38')](_0x1ced8e[_0x4382('0x33')][_0x4382('0x38')]));_0x430ff2[_0x4382('0x37')]=_0x430ff2[_0x4382('0x37')][_0x4382('0x39')]?_0x430ff2[_0x4382('0x37')]:_0x2f29f9['model'];if(!_0x1ced8e[_0x4382('0x33')]['hasOwnProperty']('nolimit')){_0x430ff2[_0x4382('0x21')]=qs['limit'](_0x1ced8e[_0x4382('0x33')]['limit']);_0x430ff2[_0x4382('0x1f')]=qs[_0x4382('0x1f')](_0x1ced8e['query'][_0x4382('0x1f')]);}_0x430ff2[_0x4382('0x3a')]=qs['sort'](_0x1ced8e[_0x4382('0x33')][_0x4382('0x3b')]);_0x430ff2[_0x4382('0x3c')]=qs[_0x4382('0x35')](_[_0x4382('0x3d')](_0x1ced8e['query'],_0x2f29f9[_0x4382('0x35')]),_0x261c13);if(_0x1ced8e[_0x4382('0x33')][_0x4382('0x3e')]){_0x430ff2[_0x4382('0x3c')]=_['merge'](_0x430ff2[_0x4382('0x3c')],{'$or':_[_0x4382('0x32')](_0x261c13,function(_0x5278fa){if(_0x5278fa[_0x4382('0x2f')]!=='VIRTUAL'){var _0x54b260={};_0x54b260[_0x5278fa[_0x4382('0x29')]]={'$like':'%'+_0x1ced8e[_0x4382('0x33')][_0x4382('0x3e')]+'%'};return _0x54b260;}})});}_0x430ff2=_[_0x4382('0x3f')]({},_0x430ff2,_0x1ced8e[_0x4382('0x40')]);var _0x56fb6b={'where':_0x430ff2[_0x4382('0x3c')]};return db[_0x4382('0x2c')][_0x4382('0x22')](_0x56fb6b)[_0x4382('0x27')](function(_0x5e9d83){_0xfb2601[_0x4382('0x22')]=_0x5e9d83;if(_0x1ced8e[_0x4382('0x33')]['includeAll']){_0x430ff2[_0x4382('0x41')]=[{'all':!![]}];}return db[_0x4382('0x2c')][_0x4382('0x42')](_0x430ff2);})[_0x4382('0x27')](function(_0x1acce2){_0xfb2601[_0x4382('0x43')]=_0x1acce2;return _0xfb2601;})[_0x4382('0x27')](respondWithFilteredResult(_0x4c4061,_0x430ff2))[_0x4382('0x44')](handleError(_0x4c4061,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index eff71b0..74c29ed 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 _0x0545=['../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ebcf1,_0x6a43e){var _0x360daa=function(_0x3aa900){while(--_0x3aa900){_0x3ebcf1['push'](_0x3ebcf1['shift']());}};_0x360daa(++_0x6a43e);}(_0x0545,0x1a6));var _0x5054=function(_0x47083a,_0x5d5a10){_0x47083a=_0x47083a-0x0;var _0x113c3e=_0x0545[_0x47083a];return _0x113c3e;};'use strict';var _=require(_0x5054('0x0'));var util=require(_0x5054('0x1'));var logger=require(_0x5054('0x2'))(_0x5054('0x3'));var moment=require(_0x5054('0x4'));var BPromise=require(_0x5054('0x5'));var rp=require(_0x5054('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5054('0x7'));var attributes=require(_0x5054('0x8'));module[_0x5054('0x9')]=function(_0x4c907a,_0xe6d69e){return _0x4c907a[_0x5054('0xa')](_0x5054('0xb'),attributes,{'tableName':_0x5054('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x430e=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','Migration','migrations'];(function(_0x5699c3,_0x244277){var _0x51ad07=function(_0x539906){while(--_0x539906){_0x5699c3['push'](_0x5699c3['shift']());}};_0x51ad07(++_0x244277);}(_0x430e,0x13f));var _0xe430=function(_0x1599b5,_0x28b24b){_0x1599b5=_0x1599b5-0x0;var _0x22b161=_0x430e[_0x1599b5];return _0x22b161;};'use strict';var _=require(_0xe430('0x0'));var util=require('util');var logger=require(_0xe430('0x1'))(_0xe430('0x2'));var moment=require(_0xe430('0x3'));var BPromise=require(_0xe430('0x4'));var rp=require(_0xe430('0x5'));var fs=require('fs');var path=require(_0xe430('0x6'));var rimraf=require(_0xe430('0x7'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xe430('0x8')]=function(_0xa69dc2,_0x2903a3){return _0xa69dc2['define'](_0xe430('0x9'),attributes,{'tableName':_0xe430('0xa'),'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 21d165d..57b2cf5 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 _0x50c1=['message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x37870d,_0x356e02){var _0x1ae695=function(_0x508f6c){while(--_0x508f6c){_0x37870d['push'](_0x37870d['shift']());}};_0x1ae695(++_0x356e02);}(_0x50c1,0x1a5));var _0x150c=function(_0x5c0532,_0x1dbd47){_0x5c0532=_0x5c0532-0x0;var _0x30d5e6=_0x50c1[_0x5c0532];return _0x30d5e6;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x150c('0x1'));var rs=require(_0x150c('0x2'));var fs=require('fs');var Redis=require(_0x150c('0x3'));var db=require(_0x150c('0x4'))['db'];var utils=require(_0x150c('0x5'));var logger=require(_0x150c('0x6'))(_0x150c('0x7'));var config=require(_0x150c('0x8'));var jayson=require(_0x150c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x367215,_0x55833c,_0x5b10b4){return new BPromise(function(_0xb16344,_0x2c8053){return client[_0x150c('0xa')](_0x367215,_0x5b10b4)[_0x150c('0xb')](function(_0x17b609){logger[_0x150c('0xc')](_0x150c('0xd'),_0x55833c,_0x150c('0xe'));logger[_0x150c('0xf')](_0x150c('0x10'),_0x55833c,'request\x20sent',JSON[_0x150c('0x11')](_0x17b609));if(_0x17b609[_0x150c('0x12')]){if(_0x17b609[_0x150c('0x12')]['code']===0x1f4){logger[_0x150c('0x12')]('Migration,\x20%s,\x20%s',_0x55833c,_0x17b609['error'][_0x150c('0x13')]);return _0x2c8053(_0x17b609[_0x150c('0x12')][_0x150c('0x13')]);}logger[_0x150c('0x12')](_0x150c('0xd'),_0x55833c,_0x17b609[_0x150c('0x12')][_0x150c('0x13')]);return _0xb16344(_0x17b609[_0x150c('0x12')][_0x150c('0x13')]);}else{logger[_0x150c('0xc')](_0x150c('0xd'),_0x55833c,_0x150c('0xe'));_0xb16344(_0x17b609['result'][_0x150c('0x13')]);}})['catch'](function(_0x338759){logger['error']('Migration,\x20%s,\x20%s',_0x55833c,_0x338759);_0x2c8053(_0x338759);});});} \ No newline at end of file +var _0x8128=['message','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14de91,_0x18abe0){var _0x46fee0=function(_0x535e04){while(--_0x535e04){_0x14de91['push'](_0x14de91['shift']());}};_0x46fee0(++_0x18abe0);}(_0x8128,0x1b1));var _0x8812=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x8128[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x8812('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8812('0x1'));var rs=require(_0x8812('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8812('0x3'));var logger=require(_0x8812('0x4'))(_0x8812('0x5'));var config=require('../../config/environment');var jayson=require(_0x8812('0x6'));var client=jayson[_0x8812('0x7')][_0x8812('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16bafa,_0x480d1f,_0xfdd696){return new BPromise(function(_0x3d030b,_0x4e5012){return client['request'](_0x16bafa,_0xfdd696)['then'](function(_0x2bc882){logger[_0x8812('0x9')](_0x8812('0xa'),_0x480d1f,_0x8812('0xb'));logger[_0x8812('0xc')](_0x8812('0xd'),_0x480d1f,_0x8812('0xb'),JSON[_0x8812('0xe')](_0x2bc882));if(_0x2bc882[_0x8812('0xf')]){if(_0x2bc882['error'][_0x8812('0x10')]===0x1f4){logger[_0x8812('0xf')](_0x8812('0xa'),_0x480d1f,_0x2bc882[_0x8812('0xf')][_0x8812('0x11')]);return _0x4e5012(_0x2bc882[_0x8812('0xf')]['message']);}logger[_0x8812('0xf')](_0x8812('0xa'),_0x480d1f,_0x2bc882[_0x8812('0xf')]['message']);return _0x3d030b(_0x2bc882['error'][_0x8812('0x11')]);}else{logger[_0x8812('0x9')]('Migration,\x20%s,\x20%s',_0x480d1f,'request\x20sent');_0x3d030b(_0x2bc882['result']['message']);}})['catch'](function(_0xa2a8cc){logger['error'](_0x8812('0xa'),_0x480d1f,_0xa2a8cc);_0x4e5012(_0xa2a8cc);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 560c0d7..7a33d44 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 _0xb96d=['create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','post'];(function(_0x3d9205,_0x29be08){var _0x5dde45=function(_0x15e1f8){while(--_0x15e1f8){_0x3d9205['push'](_0x3d9205['shift']());}};_0x5dde45(++_0x29be08);}(_0xb96d,0x9e));var _0xdb96=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0xb96d[_0x368e09];return _0x14b7df;};'use strict';var multer=require('multer');var util=require(_0xdb96('0x0'));var path=require(_0xdb96('0x1'));var timeout=require(_0xdb96('0x2'));var express=require('express');var router=express[_0xdb96('0x3')]();var fs_extra=require(_0xdb96('0x4'));var auth=require(_0xdb96('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdb96('0x6'));router[_0xdb96('0x7')]('/',auth[_0xdb96('0x8')](),controller[_0xdb96('0x9')]);router['get'](_0xdb96('0xa'),auth[_0xdb96('0x8')](),controller['show']);router[_0xdb96('0xb')]('/',auth['isAuthenticated'](),controller[_0xdb96('0xc')]);router[_0xdb96('0xd')]('/:id',auth[_0xdb96('0x8')](),controller[_0xdb96('0xe')]);router['delete'](_0xdb96('0xa'),auth[_0xdb96('0x8')](),controller[_0xdb96('0xf')]);module[_0xdb96('0x10')]=router; \ No newline at end of file +var _0xa29a=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./network.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0xa232c0,_0x3aaa8b){var _0x2ce24e=function(_0x2ffbd7){while(--_0x2ffbd7){_0xa232c0['push'](_0xa232c0['shift']());}};_0x2ce24e(++_0x3aaa8b);}(_0xa29a,0x1ee));var _0xaa29=function(_0x54f2af,_0x5d680d){_0x54f2af=_0x54f2af-0x0;var _0xa460ef=_0xa29a[_0x54f2af];return _0xa460ef;};'use strict';var multer=require(_0xaa29('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa29('0x1'));var express=require(_0xaa29('0x2'));var router=express[_0xaa29('0x3')]();var fs_extra=require(_0xaa29('0x4'));var auth=require(_0xaa29('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaa29('0x6'));router[_0xaa29('0x7')]('/',auth['isAuthenticated'](),controller[_0xaa29('0x8')]);router[_0xaa29('0x7')](_0xaa29('0x9'),auth[_0xaa29('0xa')](),controller[_0xaa29('0xb')]);router[_0xaa29('0xc')]('/',auth[_0xaa29('0xa')](),controller[_0xaa29('0xd')]);router[_0xaa29('0xe')]('/:id',auth[_0xaa29('0xa')](),controller[_0xaa29('0xf')]);router[_0xaa29('0x10')]('/:id',auth[_0xaa29('0xa')](),controller[_0xaa29('0x11')]);module[_0xaa29('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index b4acee1..543a846 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 _0xec02=['turn','STRING','sequelize','ENUM','externip'];(function(_0x47e3f8,_0x517bcd){var _0x4742d5=function(_0x2a4f20){while(--_0x2a4f20){_0x47e3f8['push'](_0x47e3f8['shift']());}};_0x4742d5(++_0x517bcd);}(_0xec02,0xd9));var _0x2ec0=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xec02[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x2ec0('0x0'));module['exports']={'type':{'type':Sequelize[_0x2ec0('0x1')]('localnet',_0x2ec0('0x2'),'stun',_0x2ec0('0x3'))},'value':{'type':Sequelize[_0x2ec0('0x4')]},'username':{'type':Sequelize[_0x2ec0('0x4')]},'password':{'type':Sequelize[_0x2ec0('0x4')]}}; \ No newline at end of file +var _0xd4c5=['stun','STRING','exports','ENUM','localnet'];(function(_0x59db19,_0x30c1c6){var _0x5f0f09=function(_0x36e225){while(--_0x36e225){_0x59db19['push'](_0x59db19['shift']());}};_0x5f0f09(++_0x30c1c6);}(_0xd4c5,0xa7));var _0x5d4c=function(_0x54c941,_0x4da682){_0x54c941=_0x54c941-0x0;var _0x3a62b4=_0xd4c5[_0x54c941];return _0x3a62b4;};'use strict';var Sequelize=require('sequelize');module[_0x5d4c('0x0')]={'type':{'type':Sequelize[_0x5d4c('0x1')](_0x5d4c('0x2'),'externip',_0x5d4c('0x3'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5d4c('0x4')]},'password':{'type':Sequelize[_0x5d4c('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 96af546..8877011 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 _0x9ac8=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','http','request','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','transaction','body','findAll','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','TURN','server/files/templates/turn_multiple.ejs','update','catch','server/files/templates/stun_multiple.ejs','chan_sip.so','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x539c43,_0x12618e){var _0x5285fe=function(_0x50a65d){while(--_0x50a65d){_0x539c43['push'](_0x539c43['shift']());}};_0x5285fe(++_0x12618e);}(_0x9ac8,0x12d));var _0x89ac=function(_0x50e1d2,_0x3f15e8){_0x50e1d2=_0x50e1d2-0x0;var _0x4ab2f0=_0x9ac8[_0x50e1d2];return _0x4ab2f0;};'use strict';var emlformat=require(_0x89ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x89ac('0x1'));var jsonpatch=require(_0x89ac('0x2'));var rp=require('request-promise');var moment=require(_0x89ac('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89ac('0x4'));var util=require(_0x89ac('0x5'));var path=require(_0x89ac('0x6'));var sox=require(_0x89ac('0x7'));var csv=require(_0x89ac('0x8'));var ejs=require(_0x89ac('0x9'));var fs=require('fs');var fs_extra=require(_0x89ac('0xa'));var _=require(_0x89ac('0xb'));var squel=require(_0x89ac('0xc'));var crypto=require(_0x89ac('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x89ac('0xe'));var Papa=require('papaparse');var Redis=require(_0x89ac('0xf'));var authService=require(_0x89ac('0x10'));var qs=require(_0x89ac('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89ac('0x12'));var logger=require(_0x89ac('0x13'))(_0x89ac('0x14'));var utils=require(_0x89ac('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x89ac('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x89ac('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x20fed7,_0x11176d,_0x12567f,_0x12a7f6){return new BPromise(function(_0x849bd1,_0x3b7ae7){var _0x4dc5b7=_0x12a7f6||client;return _0x4dc5b7[_0x89ac('0x18')](_0x20fed7,_0x12567f)['then'](function(_0x442973){logger[_0x89ac('0x19')](_0x89ac('0x1a'),_0x11176d,'request\x20sent');logger[_0x89ac('0x1b')](_0x89ac('0x1c'),_0x11176d,_0x89ac('0x1d'),JSON[_0x89ac('0x1e')](_0x442973));if(_0x442973[_0x89ac('0x1f')]){if(_0x442973[_0x89ac('0x1f')][_0x89ac('0x20')]===0x1f4){logger['error'](_0x89ac('0x1a'),_0x11176d,_0x442973[_0x89ac('0x1f')][_0x89ac('0x21')]);return _0x3b7ae7(_0x442973[_0x89ac('0x1f')][_0x89ac('0x21')]);}logger['error']('Network,\x20%s,\x20%s',_0x11176d,_0x442973[_0x89ac('0x1f')][_0x89ac('0x21')]);return _0x849bd1(_0x442973['error'][_0x89ac('0x21')]);}else{logger[_0x89ac('0x19')](_0x89ac('0x1a'),_0x11176d,'request\x20sent');_0x849bd1(_0x442973[_0x89ac('0x22')]['message']);}})['catch'](function(_0x312e10){logger[_0x89ac('0x1f')](_0x89ac('0x1a'),_0x11176d,_0x312e10);_0x3b7ae7(_0x312e10);});});}function respondWithStatusCode(_0x375018,_0x39328c){_0x39328c=_0x39328c||0xcc;return function(_0x526474){if(_0x526474){return _0x375018[_0x89ac('0x23')](_0x39328c);}return _0x375018['status'](_0x39328c)[_0x89ac('0x24')]();};}function respondWithResult(_0x5065fa,_0xf01f93){_0xf01f93=_0xf01f93||0xc8;return function(_0x47750b){if(_0x47750b){return _0x5065fa[_0x89ac('0x25')](_0xf01f93)['json'](_0x47750b);}};}function respondWithFilteredResult(_0x143092,_0x4d9f59){return function(_0x3f7feb){if(_0x3f7feb){var _0x4d0275=typeof _0x4d9f59['offset']==='undefined'&&typeof _0x4d9f59[_0x89ac('0x26')]===_0x89ac('0x27');var _0x33debc=_0x3f7feb['count'];var _0x142c9f=_0x4d0275?0x0:_0x4d9f59[_0x89ac('0x28')];var _0x516285=_0x4d0275?_0x3f7feb[_0x89ac('0x29')]:_0x4d9f59[_0x89ac('0x28')]+_0x4d9f59['limit'];var _0x451976;if(_0x516285>=_0x33debc){_0x516285=_0x33debc;_0x451976=0xc8;}else{_0x451976=0xce;}_0x143092[_0x89ac('0x25')](_0x451976);return _0x143092[_0x89ac('0x2a')](_0x89ac('0x2b'),_0x142c9f+'-'+_0x516285+'/'+_0x33debc)['json'](_0x3f7feb);}return null;};}function patchUpdates(_0x24e0c3){return function(_0x47059b){try{jsonpatch[_0x89ac('0x2c')](_0x47059b,_0x24e0c3,!![]);}catch(_0x1695a7){return BPromise[_0x89ac('0x2d')](_0x1695a7);}return _0x47059b[_0x89ac('0x2e')]();};}function saveUpdates(_0x45d42e,_0x477d6f){return function(_0x2a05e5){if(_0x2a05e5){return _0x2a05e5['update'](_0x45d42e)['then'](function(_0xe6f19d){return _0xe6f19d;});}return null;};}function removeEntity(_0x4a88c9,_0x2b9d0b){return function(_0x22e34e){if(_0x22e34e){return _0x22e34e[_0x89ac('0x2f')]()[_0x89ac('0x30')](function(){_0x4a88c9['status'](0xcc)[_0x89ac('0x24')]();});}};}function handleEntityNotFound(_0x278a22,_0x543ed8){return function(_0x3c2ad4){if(!_0x3c2ad4){_0x278a22[_0x89ac('0x23')](0x194);}return _0x3c2ad4;};}function handleError(_0x12f86c,_0x3bc74b){_0x3bc74b=_0x3bc74b||0x1f4;return function(_0x427522){logger[_0x89ac('0x1f')](_0x427522[_0x89ac('0x31')]);if(_0x427522['name']){delete _0x427522[_0x89ac('0x32')];}_0x12f86c['status'](_0x3bc74b)[_0x89ac('0x33')](_0x427522);};}exports[_0x89ac('0x34')]=function(_0x110798,_0x3cfa78){var _0xc4372a={},_0x388fdc={},_0xf659c6={'count':0x0,'rows':[]};var _0x39b3f5=_[_0x89ac('0x35')](db[_0x89ac('0x36')][_0x89ac('0x37')],function(_0x5a36e8){return{'name':_0x5a36e8[_0x89ac('0x38')],'type':_0x5a36e8[_0x89ac('0x39')]['key']};});_0x388fdc[_0x89ac('0x3a')]=_[_0x89ac('0x35')](_0x39b3f5,_0x89ac('0x32'));_0x388fdc[_0x89ac('0x3b')]=_[_0x89ac('0x3c')](_0x110798[_0x89ac('0x3b')]);_0x388fdc[_0x89ac('0x3d')]=_[_0x89ac('0x3e')](_0x388fdc[_0x89ac('0x3a')],_0x388fdc['query']);_0xc4372a[_0x89ac('0x3f')]=_['intersection'](_0x388fdc[_0x89ac('0x3a')],qs[_0x89ac('0x40')](_0x110798[_0x89ac('0x3b')]['fields']));_0xc4372a[_0x89ac('0x3f')]=_0xc4372a[_0x89ac('0x3f')][_0x89ac('0x41')]?_0xc4372a[_0x89ac('0x3f')]:_0x388fdc[_0x89ac('0x3a')];if(!_0x110798[_0x89ac('0x3b')]['hasOwnProperty']('nolimit')){_0xc4372a['limit']=qs['limit'](_0x110798[_0x89ac('0x3b')]['limit']);_0xc4372a['offset']=qs['offset'](_0x110798[_0x89ac('0x3b')]['offset']);}_0xc4372a['order']=qs['sort'](_0x110798[_0x89ac('0x3b')][_0x89ac('0x42')]);_0xc4372a[_0x89ac('0x43')]=qs['filters'](_[_0x89ac('0x44')](_0x110798['query'],_0x388fdc['filters']),_0x39b3f5);if(_0x110798[_0x89ac('0x3b')][_0x89ac('0x45')]){_0xc4372a[_0x89ac('0x43')]=_[_0x89ac('0x46')](_0xc4372a[_0x89ac('0x43')],{'$or':_[_0x89ac('0x35')](_0x39b3f5,function(_0x1d65f3){if(_0x1d65f3[_0x89ac('0x39')]!==_0x89ac('0x47')){var _0x1e75ac={};_0x1e75ac[_0x1d65f3[_0x89ac('0x32')]]={'$like':'%'+_0x110798['query'][_0x89ac('0x45')]+'%'};return _0x1e75ac;}})});}_0xc4372a=_[_0x89ac('0x46')]({},_0xc4372a,_0x110798[_0x89ac('0x48')]);var _0x460def={'where':_0xc4372a[_0x89ac('0x43')]};return db[_0x89ac('0x36')][_0x89ac('0x29')](_0x460def)[_0x89ac('0x30')](function(_0x5dcda4){_0xf659c6['count']=_0x5dcda4;if(_0x110798['query'][_0x89ac('0x49')]){_0xc4372a[_0x89ac('0x4a')]=[{'all':!![]}];}return db['Network']['findAll'](_0xc4372a);})['then'](function(_0x5df68b){_0xf659c6[_0x89ac('0x4b')]=_0x5df68b;return _0xf659c6;})[_0x89ac('0x30')](respondWithFilteredResult(_0x3cfa78,_0xc4372a))['catch'](handleError(_0x3cfa78,null));};exports[_0x89ac('0x4c')]=function(_0x5d3c4c,_0x4fd6ec){var _0x279b21={'raw':!![],'where':{'id':_0x5d3c4c[_0x89ac('0x4d')]['id']}},_0x93ec00={};_0x93ec00[_0x89ac('0x3a')]=_[_0x89ac('0x3c')](db['Network']['rawAttributes']);_0x93ec00[_0x89ac('0x3b')]=_[_0x89ac('0x3c')](_0x5d3c4c[_0x89ac('0x3b')]);_0x93ec00[_0x89ac('0x3d')]=_['intersection'](_0x93ec00['model'],_0x93ec00[_0x89ac('0x3b')]);_0x279b21['attributes']=_[_0x89ac('0x3e')](_0x93ec00[_0x89ac('0x3a')],qs['fields'](_0x5d3c4c['query']['fields']));_0x279b21[_0x89ac('0x3f')]=_0x279b21[_0x89ac('0x3f')]['length']?_0x279b21['attributes']:_0x93ec00[_0x89ac('0x3a')];if(_0x5d3c4c[_0x89ac('0x3b')]['includeAll']){_0x279b21['include']=[{'all':!![]}];}_0x279b21=_['merge']({},_0x279b21,_0x5d3c4c[_0x89ac('0x48')]);return db['Network'][_0x89ac('0x4e')](_0x279b21)[_0x89ac('0x30')](handleEntityNotFound(_0x4fd6ec,null))['then'](respondWithResult(_0x4fd6ec,null))['catch'](handleError(_0x4fd6ec,null));};exports[_0x89ac('0x4f')]=function(_0x5953ac,_0x3fe538,_0x23840a){var _0x3b762c;return db['sequelize'][_0x89ac('0x50')](function(_0x5ce00c){return db[_0x89ac('0x36')][_0x89ac('0x4f')](_0x5953ac[_0x89ac('0x51')],{'raw':!![]})['then'](function(_0x295ec2){_0x3b762c=_0x295ec2;return db['Network'][_0x89ac('0x52')]({'where':{'type':_0x5953ac[_0x89ac('0x51')][_0x89ac('0x39')]},'raw':!![]});})[_0x89ac('0x30')](function(_0x563d78){if(_0x3b762c[_0x89ac('0x39')][_0x89ac('0x53')]()==_0x89ac('0x54')){var _0x2b7ba4=fs[_0x89ac('0x55')](path[_0x89ac('0x56')](config[_0x89ac('0x57')],'server/files/templates/stun_multiple.ejs'),_0x89ac('0x58'));var _0x1e1e74=ejs[_0x89ac('0x59')](_0x2b7ba4,{'networks':_0x563d78||[]});fs[_0x89ac('0x5a')](_0x89ac('0x5b'),_0x1e1e74);return respondWithRpcPromise(_0x89ac('0x5c'),_0x89ac('0x4f'),{'module':_0x89ac('0x5d')});}else if(_0x3b762c['type']['toUpperCase']()=='TURN'){var _0x57ec13=fs[_0x89ac('0x55')](path['join'](config[_0x89ac('0x57')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x1b99f7=ejs[_0x89ac('0x59')](_0x57ec13,{'networks':_0x563d78||[]});fs[_0x89ac('0x5a')](_0x89ac('0x5e'),_0x1b99f7);return respondWithRpcPromise('Reload',_0x89ac('0x4f'),{'module':_0x89ac('0x5d')});}else{var _0x1aed72=fs[_0x89ac('0x55')](path['join'](config[_0x89ac('0x57')],_0x89ac('0x5f')),_0x89ac('0x58'));var _0x2320da=ejs[_0x89ac('0x59')](_0x1aed72,{'networks':_0x563d78||[]});fs[_0x89ac('0x5a')](util[_0x89ac('0x60')](_0x89ac('0x61'),_0x5953ac[_0x89ac('0x51')][_0x89ac('0x39')][_0x89ac('0x62')]()),_0x2320da);return respondWithRpcPromise('Reload',_0x89ac('0x4f'),{'module':'chan_sip.so'});}return null;})[_0x89ac('0x30')](function(){return _0x3b762c;});})[_0x89ac('0x30')](respondWithResult(_0x3fe538,0xc9))['catch'](handleError(_0x3fe538,null));};exports['update']=function(_0xc493de,_0x12b618,_0x4dbd4d){var _0x2f6fee;return db['sequelize'][_0x89ac('0x50')](function(_0x115aed){return db[_0x89ac('0x36')][_0x89ac('0x4e')]({'where':{'id':_0xc493de[_0x89ac('0x4d')]['id']}})[_0x89ac('0x30')](handleEntityNotFound(_0x12b618,null))[_0x89ac('0x30')](saveUpdates(_0xc493de[_0x89ac('0x51')],null))[_0x89ac('0x30')](function(_0x438a8c){if(_0x438a8c){_0x2f6fee=_0x438a8c;return db[_0x89ac('0x36')][_0x89ac('0x52')]({'where':{'type':_0x2f6fee[_0x89ac('0x39')]},'raw':!![]});}return null;})['then'](function(_0x5b358b){if(_0x2f6fee[_0x89ac('0x39')]['toUpperCase']()==_0x89ac('0x54')){var _0x70f590=fs[_0x89ac('0x55')](path['join'](config[_0x89ac('0x57')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x4063ec=ejs[_0x89ac('0x59')](_0x70f590,{'networks':_0x5b358b||[]});fs[_0x89ac('0x5a')](_0x89ac('0x5b'),_0x4063ec);return respondWithRpcPromise(_0x89ac('0x5c'),'update',{'module':_0x89ac('0x5d')});}else if(_0x2f6fee[_0x89ac('0x39')]['toUpperCase']()==_0x89ac('0x63')){var _0x547c48=fs[_0x89ac('0x55')](path[_0x89ac('0x56')](config[_0x89ac('0x57')],_0x89ac('0x64')),_0x89ac('0x58'));var _0xb5d0e8=ejs['render'](_0x547c48,{'networks':_0x5b358b||[]});fs[_0x89ac('0x5a')]('/etc/asterisk/turn_xcally.conf',_0xb5d0e8);return respondWithRpcPromise('Reload',_0x89ac('0x65'),{'module':_0x89ac('0x5d')});}else{var _0x59929d=fs[_0x89ac('0x55')](path['join'](config[_0x89ac('0x57')],'server/files/templates/network.ejs'),'utf8');var _0x10a140=ejs[_0x89ac('0x59')](_0x59929d,{'networks':_0x5b358b||[]});fs[_0x89ac('0x5a')](util[_0x89ac('0x60')](_0x89ac('0x61'),_0xc493de[_0x89ac('0x51')][_0x89ac('0x39')][_0x89ac('0x62')]()),_0x10a140);return respondWithRpcPromise(_0x89ac('0x5c'),'update',{'module':'chan_sip.so'});}return null;})[_0x89ac('0x30')](function(_0x1b3e34){if(_0x1b3e34){return _0x2f6fee;}return null;});})['then'](respondWithResult(_0x12b618,null))[_0x89ac('0x66')](handleError(_0x12b618,null));};exports[_0x89ac('0x2f')]=function(_0x3b4a80,_0x2b5ea9,_0x2d520c){var _0x42c4a4;return db[_0x89ac('0x36')][_0x89ac('0x4e')]({'where':{'id':_0x3b4a80[_0x89ac('0x4d')]['id']}})['then'](function(_0x18cf6f){_0x42c4a4=_0x18cf6f;return _0x18cf6f;})[_0x89ac('0x30')](handleEntityNotFound(_0x2b5ea9,null))['then'](removeEntity(_0x2b5ea9,null))[_0x89ac('0x30')](function(){if(_0x42c4a4){return db[_0x89ac('0x36')]['findAll']({'where':{'type':_0x42c4a4['type']},'raw':!![]});}})[_0x89ac('0x30')](function(_0x18533a){if(_0x42c4a4[_0x89ac('0x39')][_0x89ac('0x53')]()==_0x89ac('0x54')){var _0x54b423=fs[_0x89ac('0x55')](path[_0x89ac('0x56')](config[_0x89ac('0x57')],_0x89ac('0x67')),_0x89ac('0x58'));var _0x3f1bfb=ejs[_0x89ac('0x59')](_0x54b423,{'networks':_0x18533a||[]});fs[_0x89ac('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x3f1bfb);return respondWithRpcPromise('Reload',_0x89ac('0x2f'),{'module':_0x89ac('0x5d')});}else if(_0x42c4a4[_0x89ac('0x39')]['toUpperCase']()==_0x89ac('0x63')){var _0x225bb1=fs[_0x89ac('0x55')](path['join'](config[_0x89ac('0x57')],_0x89ac('0x64')),_0x89ac('0x58'));var _0x4b4a5e=ejs[_0x89ac('0x59')](_0x225bb1,{'networks':_0x18533a||[]});fs[_0x89ac('0x5a')](_0x89ac('0x5e'),_0x4b4a5e);return respondWithRpcPromise(_0x89ac('0x5c'),_0x89ac('0x2f'),{'module':_0x89ac('0x5d')});}else{var _0x2637af=fs[_0x89ac('0x55')](path['join'](config[_0x89ac('0x57')],_0x89ac('0x5f')),'utf8');var _0x23dd03=ejs['render'](_0x2637af,{'networks':_0x18533a||[]});fs[_0x89ac('0x5a')](util['format'](_0x89ac('0x61'),_0x3b4a80['body'][_0x89ac('0x39')][_0x89ac('0x62')]()),_0x23dd03);return respondWithRpcPromise(_0x89ac('0x5c'),'destroy',{'module':_0x89ac('0x68')});}return null;})['catch'](handleError(_0x2b5ea9,null));}; \ No newline at end of file +var _0x7568=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','stack','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Network','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','Reload','readFileSync','render','format','toLowerCase','sequelize','transaction','STUN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x422c8c,_0xbf86e6){var _0x124d58=function(_0xad502f){while(--_0xad502f){_0x422c8c['push'](_0x422c8c['shift']());}};_0x124d58(++_0xbf86e6);}(_0x7568,0xd1));var _0x8756=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7568[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x8756('0x0'));var rimraf=require(_0x8756('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8756('0x2'));var rp=require(_0x8756('0x3'));var moment=require(_0x8756('0x4'));var BPromise=require(_0x8756('0x5'));var Mustache=require(_0x8756('0x6'));var util=require(_0x8756('0x7'));var path=require(_0x8756('0x8'));var sox=require(_0x8756('0x9'));var csv=require(_0x8756('0xa'));var ejs=require(_0x8756('0xb'));var fs=require('fs');var fs_extra=require(_0x8756('0xc'));var _=require(_0x8756('0xd'));var squel=require(_0x8756('0xe'));var crypto=require('crypto');var jsforce=require(_0x8756('0xf'));var deskjs=require(_0x8756('0x10'));var toCsv=require(_0x8756('0xa'));var querystring=require(_0x8756('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8756('0x12'));var qs=require(_0x8756('0x13'));var as=require(_0x8756('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8756('0x15'));var utils=require(_0x8756('0x16'));var config=require(_0x8756('0x17'));var licenseUtil=require(_0x8756('0x18'));var db=require(_0x8756('0x19'))['db'];var jayson=require(_0x8756('0x1a'));var client=jayson[_0x8756('0x1b')][_0x8756('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2073cb,_0x395401,_0x5ea71d,_0x86ad81){return new BPromise(function(_0x36321e,_0x39b019){var _0x1a3adb=_0x86ad81||client;return _0x1a3adb[_0x8756('0x1d')](_0x2073cb,_0x5ea71d)[_0x8756('0x1e')](function(_0x1f26e8){logger['info'](_0x8756('0x1f'),_0x395401,_0x8756('0x20'));logger[_0x8756('0x21')](_0x8756('0x22'),_0x395401,_0x8756('0x20'),JSON[_0x8756('0x23')](_0x1f26e8));if(_0x1f26e8[_0x8756('0x24')]){if(_0x1f26e8[_0x8756('0x24')][_0x8756('0x25')]===0x1f4){logger[_0x8756('0x24')]('Network,\x20%s,\x20%s',_0x395401,_0x1f26e8[_0x8756('0x24')][_0x8756('0x26')]);return _0x39b019(_0x1f26e8[_0x8756('0x24')][_0x8756('0x26')]);}logger[_0x8756('0x24')]('Network,\x20%s,\x20%s',_0x395401,_0x1f26e8['error'][_0x8756('0x26')]);return _0x36321e(_0x1f26e8[_0x8756('0x24')][_0x8756('0x26')]);}else{logger[_0x8756('0x27')]('Network,\x20%s,\x20%s',_0x395401,_0x8756('0x20'));_0x36321e(_0x1f26e8[_0x8756('0x28')][_0x8756('0x26')]);}})['catch'](function(_0x2ecb4b){logger[_0x8756('0x24')]('Network,\x20%s,\x20%s',_0x395401,_0x2ecb4b);_0x39b019(_0x2ecb4b);});});}function respondWithStatusCode(_0x2bc599,_0x531054){_0x531054=_0x531054||0xcc;return function(_0x71462a){if(_0x71462a){return _0x2bc599[_0x8756('0x29')](_0x531054);}return _0x2bc599[_0x8756('0x2a')](_0x531054)[_0x8756('0x2b')]();};}function respondWithResult(_0x4b5794,_0x49f84b){_0x49f84b=_0x49f84b||0xc8;return function(_0x195df6){if(_0x195df6){return _0x4b5794[_0x8756('0x2a')](_0x49f84b)[_0x8756('0x2c')](_0x195df6);}};}function respondWithFilteredResult(_0xdbd644,_0x56827d){return function(_0xd9f835){if(_0xd9f835){var _0x1cddb0=typeof _0x56827d[_0x8756('0x2d')]===_0x8756('0x2e')&&typeof _0x56827d[_0x8756('0x2f')]==='undefined';var _0x57914e=_0xd9f835[_0x8756('0x30')];var _0xca01ad=_0x1cddb0?0x0:_0x56827d['offset'];var _0x95eb96=_0x1cddb0?_0xd9f835[_0x8756('0x30')]:_0x56827d[_0x8756('0x2d')]+_0x56827d[_0x8756('0x2f')];var _0x1df318;if(_0x95eb96>=_0x57914e){_0x95eb96=_0x57914e;_0x1df318=0xc8;}else{_0x1df318=0xce;}_0xdbd644[_0x8756('0x2a')](_0x1df318);return _0xdbd644['set']('Content-Range',_0xca01ad+'-'+_0x95eb96+'/'+_0x57914e)['json'](_0xd9f835);}return null;};}function patchUpdates(_0x508610){return function(_0x199c0e){try{jsonpatch[_0x8756('0x31')](_0x199c0e,_0x508610,!![]);}catch(_0x8e5b52){return BPromise[_0x8756('0x32')](_0x8e5b52);}return _0x199c0e[_0x8756('0x33')]();};}function saveUpdates(_0x41a15c,_0x216bfa){return function(_0x264480){if(_0x264480){return _0x264480[_0x8756('0x34')](_0x41a15c)[_0x8756('0x1e')](function(_0xd7a245){return _0xd7a245;});}return null;};}function removeEntity(_0x5c88e2,_0x5342ca){return function(_0x5b2456){if(_0x5b2456){return _0x5b2456[_0x8756('0x35')]()[_0x8756('0x1e')](function(){_0x5c88e2['status'](0xcc)[_0x8756('0x2b')]();});}};}function handleEntityNotFound(_0x99d114,_0x539f47){return function(_0x2c7358){if(!_0x2c7358){_0x99d114['sendStatus'](0x194);}return _0x2c7358;};}function handleError(_0x90512d,_0x1cca96){_0x1cca96=_0x1cca96||0x1f4;return function(_0x5bd680){logger[_0x8756('0x24')](_0x5bd680[_0x8756('0x36')]);if(_0x5bd680['name']){delete _0x5bd680['name'];}_0x90512d['status'](_0x1cca96)['send'](_0x5bd680);};}exports['index']=function(_0x4b244c,_0xb950ee){var _0x554b60={},_0x165314={},_0x558bd8={'count':0x0,'rows':[]};var _0x341e0f=_['map'](db['Network']['rawAttributes'],function(_0x24dd64){return{'name':_0x24dd64['fieldName'],'type':_0x24dd64['type'][_0x8756('0x37')]};});_0x165314[_0x8756('0x38')]=_[_0x8756('0x39')](_0x341e0f,_0x8756('0x3a'));_0x165314['query']=_[_0x8756('0x3b')](_0x4b244c[_0x8756('0x3c')]);_0x165314[_0x8756('0x3d')]=_[_0x8756('0x3e')](_0x165314[_0x8756('0x38')],_0x165314[_0x8756('0x3c')]);_0x554b60[_0x8756('0x3f')]=_[_0x8756('0x3e')](_0x165314[_0x8756('0x38')],qs[_0x8756('0x40')](_0x4b244c[_0x8756('0x3c')][_0x8756('0x40')]));_0x554b60['attributes']=_0x554b60[_0x8756('0x3f')][_0x8756('0x41')]?_0x554b60['attributes']:_0x165314[_0x8756('0x38')];if(!_0x4b244c[_0x8756('0x3c')][_0x8756('0x42')](_0x8756('0x43'))){_0x554b60['limit']=qs[_0x8756('0x2f')](_0x4b244c[_0x8756('0x3c')][_0x8756('0x2f')]);_0x554b60['offset']=qs['offset'](_0x4b244c[_0x8756('0x3c')]['offset']);}_0x554b60[_0x8756('0x44')]=qs[_0x8756('0x45')](_0x4b244c[_0x8756('0x3c')][_0x8756('0x45')]);_0x554b60[_0x8756('0x46')]=qs['filters'](_[_0x8756('0x47')](_0x4b244c[_0x8756('0x3c')],_0x165314['filters']),_0x341e0f);if(_0x4b244c[_0x8756('0x3c')][_0x8756('0x48')]){_0x554b60['where']=_['merge'](_0x554b60['where'],{'$or':_['map'](_0x341e0f,function(_0x4b7f88){if(_0x4b7f88[_0x8756('0x49')]!==_0x8756('0x4a')){var _0x5e1e36={};_0x5e1e36[_0x4b7f88[_0x8756('0x3a')]]={'$like':'%'+_0x4b244c[_0x8756('0x3c')][_0x8756('0x48')]+'%'};return _0x5e1e36;}})});}_0x554b60=_[_0x8756('0x4b')]({},_0x554b60,_0x4b244c[_0x8756('0x4c')]);var _0x5d181e={'where':_0x554b60[_0x8756('0x46')]};return db[_0x8756('0x4d')][_0x8756('0x30')](_0x5d181e)[_0x8756('0x1e')](function(_0x3f521c){_0x558bd8[_0x8756('0x30')]=_0x3f521c;if(_0x4b244c[_0x8756('0x3c')]['includeAll']){_0x554b60['include']=[{'all':!![]}];}return db[_0x8756('0x4d')][_0x8756('0x4e')](_0x554b60);})[_0x8756('0x1e')](function(_0x408398){_0x558bd8[_0x8756('0x4f')]=_0x408398;return _0x558bd8;})[_0x8756('0x1e')](respondWithFilteredResult(_0xb950ee,_0x554b60))[_0x8756('0x50')](handleError(_0xb950ee,null));};exports[_0x8756('0x51')]=function(_0x37321e,_0x47fb0e){var _0x93614b={'raw':!![],'where':{'id':_0x37321e[_0x8756('0x52')]['id']}},_0x23c8da={};_0x23c8da[_0x8756('0x38')]=_[_0x8756('0x3b')](db[_0x8756('0x4d')][_0x8756('0x53')]);_0x23c8da[_0x8756('0x3c')]=_['keys'](_0x37321e[_0x8756('0x3c')]);_0x23c8da['filters']=_[_0x8756('0x3e')](_0x23c8da[_0x8756('0x38')],_0x23c8da[_0x8756('0x3c')]);_0x93614b['attributes']=_['intersection'](_0x23c8da[_0x8756('0x38')],qs['fields'](_0x37321e[_0x8756('0x3c')][_0x8756('0x40')]));_0x93614b['attributes']=_0x93614b['attributes'][_0x8756('0x41')]?_0x93614b[_0x8756('0x3f')]:_0x23c8da[_0x8756('0x38')];if(_0x37321e[_0x8756('0x3c')][_0x8756('0x54')]){_0x93614b['include']=[{'all':!![]}];}_0x93614b=_['merge']({},_0x93614b,_0x37321e[_0x8756('0x4c')]);return db[_0x8756('0x4d')][_0x8756('0x55')](_0x93614b)['then'](handleEntityNotFound(_0x47fb0e,null))[_0x8756('0x1e')](respondWithResult(_0x47fb0e,null))[_0x8756('0x50')](handleError(_0x47fb0e,null));};exports[_0x8756('0x56')]=function(_0x1f8c2f,_0x19423e,_0x19294c){var _0x1ee150;return db['sequelize']['transaction'](function(_0x4b574b){return db[_0x8756('0x4d')][_0x8756('0x56')](_0x1f8c2f[_0x8756('0x57')],{'raw':!![]})['then'](function(_0x3bb0dd){_0x1ee150=_0x3bb0dd;return db[_0x8756('0x4d')][_0x8756('0x4e')]({'where':{'type':_0x1f8c2f[_0x8756('0x57')]['type']},'raw':!![]});})[_0x8756('0x1e')](function(_0x1379ba){if(_0x1ee150[_0x8756('0x49')][_0x8756('0x58')]()=='STUN'){var _0x51ffd0=fs['readFileSync'](path[_0x8756('0x59')](config[_0x8756('0x5a')],_0x8756('0x5b')),_0x8756('0x5c'));var _0x539251=ejs['render'](_0x51ffd0,{'networks':_0x1379ba||[]});fs[_0x8756('0x5d')](_0x8756('0x5e'),_0x539251);return respondWithRpcPromise('Reload',_0x8756('0x56'),{'module':_0x8756('0x5f')});}else if(_0x1ee150['type'][_0x8756('0x58')]()==_0x8756('0x60')){var _0x2f2680=fs['readFileSync'](path[_0x8756('0x59')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x8756('0x5c'));var _0x4ec0ff=ejs['render'](_0x2f2680,{'networks':_0x1379ba||[]});fs[_0x8756('0x5d')](_0x8756('0x61'),_0x4ec0ff);return respondWithRpcPromise(_0x8756('0x62'),_0x8756('0x56'),{'module':_0x8756('0x5f')});}else{var _0x1d79c1=fs[_0x8756('0x63')](path[_0x8756('0x59')](config[_0x8756('0x5a')],'server/files/templates/network.ejs'),'utf8');var _0x4435e6=ejs[_0x8756('0x64')](_0x1d79c1,{'networks':_0x1379ba||[]});fs[_0x8756('0x5d')](util[_0x8756('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x1f8c2f[_0x8756('0x57')]['type'][_0x8756('0x66')]()),_0x4435e6);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}return null;})[_0x8756('0x1e')](function(){return _0x1ee150;});})[_0x8756('0x1e')](respondWithResult(_0x19423e,0xc9))[_0x8756('0x50')](handleError(_0x19423e,null));};exports['update']=function(_0x2cbb8f,_0x369864,_0x4adcd1){var _0x3cf4ad;return db[_0x8756('0x67')][_0x8756('0x68')](function(_0x4a6f06){return db[_0x8756('0x4d')][_0x8756('0x55')]({'where':{'id':_0x2cbb8f[_0x8756('0x52')]['id']}})[_0x8756('0x1e')](handleEntityNotFound(_0x369864,null))[_0x8756('0x1e')](saveUpdates(_0x2cbb8f['body'],null))[_0x8756('0x1e')](function(_0x1a9a02){if(_0x1a9a02){_0x3cf4ad=_0x1a9a02;return db['Network'][_0x8756('0x4e')]({'where':{'type':_0x3cf4ad[_0x8756('0x49')]},'raw':!![]});}return null;})[_0x8756('0x1e')](function(_0x4a1104){if(_0x3cf4ad[_0x8756('0x49')][_0x8756('0x58')]()==_0x8756('0x69')){var _0x5c49e8=fs[_0x8756('0x63')](path[_0x8756('0x59')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x580e18=ejs['render'](_0x5c49e8,{'networks':_0x4a1104||[]});fs[_0x8756('0x5d')]('/etc/asterisk/stun_xcally.conf',_0x580e18);return respondWithRpcPromise('Reload',_0x8756('0x34'),{'module':_0x8756('0x5f')});}else if(_0x3cf4ad[_0x8756('0x49')]['toUpperCase']()==_0x8756('0x60')){var _0x124dbf=fs[_0x8756('0x63')](path[_0x8756('0x59')](config[_0x8756('0x5a')],_0x8756('0x6a')),_0x8756('0x5c'));var _0xd74af1=ejs['render'](_0x124dbf,{'networks':_0x4a1104||[]});fs[_0x8756('0x5d')](_0x8756('0x61'),_0xd74af1);return respondWithRpcPromise(_0x8756('0x62'),_0x8756('0x34'),{'module':_0x8756('0x5f')});}else{var _0x2246e5=fs[_0x8756('0x63')](path[_0x8756('0x59')](config[_0x8756('0x5a')],_0x8756('0x6b')),_0x8756('0x5c'));var _0x147a5a=ejs[_0x8756('0x64')](_0x2246e5,{'networks':_0x4a1104||[]});fs['writeFileSync'](util[_0x8756('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x2cbb8f[_0x8756('0x57')][_0x8756('0x49')][_0x8756('0x66')]()),_0x147a5a);return respondWithRpcPromise(_0x8756('0x62'),_0x8756('0x34'),{'module':_0x8756('0x6c')});}return null;})['then'](function(_0x2ab896){if(_0x2ab896){return _0x3cf4ad;}return null;});})['then'](respondWithResult(_0x369864,null))['catch'](handleError(_0x369864,null));};exports['destroy']=function(_0x5530fe,_0x33343f,_0x308aa5){var _0x1fd5e5;return db['Network']['find']({'where':{'id':_0x5530fe['params']['id']}})[_0x8756('0x1e')](function(_0x287984){_0x1fd5e5=_0x287984;return _0x287984;})[_0x8756('0x1e')](handleEntityNotFound(_0x33343f,null))[_0x8756('0x1e')](removeEntity(_0x33343f,null))[_0x8756('0x1e')](function(){if(_0x1fd5e5){return db[_0x8756('0x4d')][_0x8756('0x4e')]({'where':{'type':_0x1fd5e5[_0x8756('0x49')]},'raw':!![]});}})[_0x8756('0x1e')](function(_0x3f7a15){if(_0x1fd5e5['type'][_0x8756('0x58')]()=='STUN'){var _0xe6f813=fs[_0x8756('0x63')](path['join'](config[_0x8756('0x5a')],_0x8756('0x5b')),'utf8');var _0xdbc9ef=ejs[_0x8756('0x64')](_0xe6f813,{'networks':_0x3f7a15||[]});fs['writeFileSync'](_0x8756('0x5e'),_0xdbc9ef);return respondWithRpcPromise(_0x8756('0x62'),_0x8756('0x35'),{'module':_0x8756('0x5f')});}else if(_0x1fd5e5['type']['toUpperCase']()==_0x8756('0x60')){var _0x2c8d7d=fs[_0x8756('0x63')](path[_0x8756('0x59')](config[_0x8756('0x5a')],_0x8756('0x6a')),'utf8');var _0x3fa03c=ejs[_0x8756('0x64')](_0x2c8d7d,{'networks':_0x3f7a15||[]});fs[_0x8756('0x5d')]('/etc/asterisk/turn_xcally.conf',_0x3fa03c);return respondWithRpcPromise(_0x8756('0x62'),'destroy',{'module':_0x8756('0x5f')});}else{var _0x256011=fs['readFileSync'](path['join'](config[_0x8756('0x5a')],_0x8756('0x6b')),_0x8756('0x5c'));var _0x136e3a=ejs['render'](_0x256011,{'networks':_0x3f7a15||[]});fs['writeFileSync'](util['format'](_0x8756('0x6d'),_0x5530fe[_0x8756('0x57')][_0x8756('0x49')]['toLowerCase']()),_0x136e3a);return respondWithRpcPromise(_0x8756('0x62'),_0x8756('0x35'),{'module':_0x8756('0x6c')});}return null;})[_0x8756('0x50')](handleError(_0x33343f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 05dbad4..00a72f8 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 _0x0102=['api','moment','./network.attributes','exports','Network','util','../../config/logger'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x0102,0x186));var _0x2010=function(_0x557c78,_0xa56c4f){_0x557c78=_0x557c78-0x0;var _0x367de5=_0x0102[_0x557c78];return _0x367de5;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var logger=require(_0x2010('0x1'))(_0x2010('0x2'));var moment=require(_0x2010('0x3'));var BPromise=require('bluebird');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(_0x2010('0x4'));module[_0x2010('0x5')]=function(_0x130725,_0x304264){return _0x130725['define'](_0x2010('0x6'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4483=['define','Network','network','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./network.attributes','exports'];(function(_0x6fe248,_0x446dfb){var _0x601d6e=function(_0xf1f93){while(--_0xf1f93){_0x6fe248['push'](_0x6fe248['shift']());}};_0x601d6e(++_0x446dfb);}(_0x4483,0x1a3));var _0x3448=function(_0x28681e,_0xdf3ec2){_0x28681e=_0x28681e-0x0;var _0x22e2cc=_0x4483[_0x28681e];return _0x22e2cc;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var logger=require(_0x3448('0x2'))('api');var moment=require(_0x3448('0x3'));var BPromise=require(_0x3448('0x4'));var rp=require(_0x3448('0x5'));var fs=require('fs');var path=require(_0x3448('0x6'));var rimraf=require(_0x3448('0x7'));var config=require('../../config/environment');var attributes=require(_0x3448('0x8'));module[_0x3448('0x9')]=function(_0x1b05db,_0xd3606d){return _0x1b05db[_0x3448('0xa')](_0x3448('0xb'),attributes,{'tableName':_0x3448('0xc'),'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 5a3e75a..f674e52 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 _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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x1a7e3f,_0x2b2b2b){_0x1a7e3f=_0x1a7e3f-0x0;var _0x3be9df=_0x7a54[_0x1a7e3f];return _0x3be9df;};'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 +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(_0x22d6d6,_0x5250c3){var _0x1dbb9d=function(_0x2a4a04){while(--_0x2a4a04){_0x22d6d6['push'](_0x22d6d6['shift']());}};_0x1dbb9d(++_0x5250c3);}(_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 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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 2ae3771..b351100 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 _0xd1bd=['getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/users','addAgents','/:id/send','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions'];(function(_0x1a1f18,_0xf947f8){var _0xc46323=function(_0x12bcd5){while(--_0x12bcd5){_0x1a1f18['push'](_0x1a1f18['shift']());}};_0xc46323(++_0xf947f8);}(_0xd1bd,0x76));var _0xdd1b=function(_0x2e4809,_0x365e2a){_0x2e4809=_0x2e4809-0x0;var _0x4e9161=_0xd1bd[_0x2e4809];return _0x4e9161;};'use strict';var multer=require(_0xdd1b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdd1b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdd1b('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdd1b('0x3'));var controller=require(_0xdd1b('0x4'));router[_0xdd1b('0x5')]('/',auth[_0xdd1b('0x6')](),controller[_0xdd1b('0x7')]);router[_0xdd1b('0x5')]('/describe',auth[_0xdd1b('0x6')](),controller[_0xdd1b('0x8')]);router['get'](_0xdd1b('0x9'),auth[_0xdd1b('0x6')](),controller[_0xdd1b('0xa')]);router['get'](_0xdd1b('0xb'),auth[_0xdd1b('0x6')](),controller[_0xdd1b('0xc')]);router[_0xdd1b('0x5')](_0xdd1b('0xd'),auth[_0xdd1b('0x6')](),controller[_0xdd1b('0xe')]);router[_0xdd1b('0x5')](_0xdd1b('0xf'),auth[_0xdd1b('0x6')](),controller[_0xdd1b('0x10')]);router[_0xdd1b('0x5')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xdd1b('0x11')]);router[_0xdd1b('0x5')]('/:id/users',auth[_0xdd1b('0x6')](),controller[_0xdd1b('0x12')]);router[_0xdd1b('0x13')]('/',auth[_0xdd1b('0x6')](),controller[_0xdd1b('0x14')]);router['post'](_0xdd1b('0xb'),auth[_0xdd1b('0x6')](),controller[_0xdd1b('0x15')]);router[_0xdd1b('0x13')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xdd1b('0x16')]);router[_0xdd1b('0x13')](_0xdd1b('0x17'),controller[_0xdd1b('0x18')]);router[_0xdd1b('0x13')]('/:id/applications',auth[_0xdd1b('0x6')](),controller['addApplications']);router[_0xdd1b('0x13')](_0xdd1b('0x19'),auth[_0xdd1b('0x6')](),controller[_0xdd1b('0x1a')]);router[_0xdd1b('0x13')](_0xdd1b('0x1b'),auth[_0xdd1b('0x6')](),controller['send']);router['put'](_0xdd1b('0x9'),auth[_0xdd1b('0x6')](),controller['update']);router[_0xdd1b('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xdd1b('0x1d')]);router[_0xdd1b('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xdd1b('0x1e')]);router['delete'](_0xdd1b('0xd'),auth[_0xdd1b('0x6')](),controller[_0xdd1b('0x1f')]);router[_0xdd1b('0x1c')](_0xdd1b('0x19'),auth['isAuthenticated'](),controller[_0xdd1b('0x20')]);module[_0xdd1b('0x21')]=router; \ No newline at end of file +var _0x7b01=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','/:id/applications','addApplications','addAgents','/:id/send','put','/:id','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b01,0x182));var _0x17b0=function(_0x425cd2,_0x4e246e){_0x425cd2=_0x425cd2-0x0;var _0x3618f8=_0x7b01[_0x425cd2];return _0x3618f8;};'use strict';var multer=require(_0x17b0('0x0'));var util=require(_0x17b0('0x1'));var path=require(_0x17b0('0x2'));var timeout=require(_0x17b0('0x3'));var express=require(_0x17b0('0x4'));var router=express[_0x17b0('0x5')]();var fs_extra=require(_0x17b0('0x6'));var auth=require(_0x17b0('0x7'));var interaction=require(_0x17b0('0x8'));var config=require('../../config/environment');var controller=require(_0x17b0('0x9'));router[_0x17b0('0xa')]('/',auth[_0x17b0('0xb')](),controller[_0x17b0('0xc')]);router['get'](_0x17b0('0xd'),auth[_0x17b0('0xb')](),controller['describe']);router[_0x17b0('0xa')]('/:id',auth[_0x17b0('0xb')](),controller[_0x17b0('0xe')]);router[_0x17b0('0xa')](_0x17b0('0xf'),auth[_0x17b0('0xb')](),controller[_0x17b0('0x10')]);router[_0x17b0('0xa')](_0x17b0('0x11'),auth[_0x17b0('0xb')](),controller['getAnswers']);router[_0x17b0('0xa')]('/:id/applications',auth[_0x17b0('0xb')](),controller[_0x17b0('0x12')]);router['get'](_0x17b0('0x13'),auth[_0x17b0('0xb')](),controller[_0x17b0('0x14')]);router[_0x17b0('0xa')](_0x17b0('0x15'),auth['isAuthenticated'](),controller[_0x17b0('0x16')]);router[_0x17b0('0x17')]('/',auth['isAuthenticated'](),controller[_0x17b0('0x18')]);router[_0x17b0('0x17')](_0x17b0('0xf'),auth[_0x17b0('0xb')](),controller[_0x17b0('0x19')]);router[_0x17b0('0x17')](_0x17b0('0x11'),auth['isAuthenticated'](),controller[_0x17b0('0x1a')]);router[_0x17b0('0x17')]('/:id/notify',controller[_0x17b0('0x1b')]);router['post'](_0x17b0('0x1c'),auth[_0x17b0('0xb')](),controller[_0x17b0('0x1d')]);router[_0x17b0('0x17')](_0x17b0('0x15'),auth[_0x17b0('0xb')](),controller[_0x17b0('0x1e')]);router[_0x17b0('0x17')](_0x17b0('0x1f'),auth[_0x17b0('0xb')](),controller['send']);router[_0x17b0('0x20')](_0x17b0('0x21'),auth[_0x17b0('0xb')](),controller[_0x17b0('0x22')]);router[_0x17b0('0x23')](_0x17b0('0x21'),auth['isAuthenticated'](),controller['destroy']);router[_0x17b0('0x23')](_0x17b0('0xf'),auth[_0x17b0('0xb')](),controller[_0x17b0('0x24')]);router[_0x17b0('0x23')](_0x17b0('0x11'),auth[_0x17b0('0xb')](),controller['removeAnswers']);router[_0x17b0('0x23')](_0x17b0('0x15'),auth['isAuthenticated'](),controller[_0x17b0('0x25')]);module[_0x17b0('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e9f80a3..7a8142c 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 _0x3235=['exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x3cdd09,_0x526ef3){var _0x2da112=function(_0x45f222){while(--_0x45f222){_0x3cdd09['push'](_0x3cdd09['shift']());}};_0x2da112(++_0x526ef3);}(_0x3235,0x17f));var _0x5323=function(_0x526407,_0x2d1739){_0x526407=_0x526407-0x0;var _0x1968b1=_0x3235[_0x526407];return _0x1968b1;};'use strict';var Sequelize=require(_0x5323('0x0'));var rs=require('randomstring');module[_0x5323('0x1')]={'name':{'type':Sequelize[_0x5323('0x2')],'unique':_0x5323('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5323('0x2')]},'token':{'type':Sequelize[_0x5323('0x2')],'defaultValue':function(){return rs[_0x5323('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5323('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5323('0x5')],'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[_0x5323('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5323('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5323('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5323('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5323('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5323('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5323('0x6')],'defaultValue':![],'comment':_0x5323('0x8'),'set':function(_0x2f6aca){if(!_0x2f6aca)this[_0x5323('0x9')](_0x5323('0xa'),null);this['setDataValue'](_0x5323('0xb'),_0x2f6aca);}}}; \ No newline at end of file +var _0x7128=['randomstring','name','STRING','generate','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','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x5526fc,_0x50cb07){var _0x3a36a4=function(_0x35e65f){while(--_0x35e65f){_0x5526fc['push'](_0x5526fc['shift']());}};_0x3a36a4(++_0x50cb07);}(_0x7128,0x83));var _0x8712=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x7128[_0x65c50e];return _0x4573e7;};'use strict';var Sequelize=require(_0x8712('0x0'));var rs=require(_0x8712('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8712('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8712('0x3')]},'token':{'type':Sequelize[_0x8712('0x3')],'defaultValue':function(){return rs[_0x8712('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8712('0x5')],'defaultValue':function(){return _0x8712('0x6');}},'notificationSound':{'type':Sequelize[_0x8712('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8712('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8712('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x8712('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8712('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8712('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8712('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8712('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x8712('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x50924e){if(!_0x50924e)this[_0x8712('0xa')](_0x8712('0xb'),null);this[_0x8712('0xa')]('mandatoryDisposition',_0x50924e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index dc0d8a9..db2dffe 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 _0x4e3e=['OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','map','OpenchannelAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','rawAttributes','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','isNil','from','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','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','defaults','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','user','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','request\x20sent','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e3e,0x14b));var _0xe4e3=function(_0x141177,_0x2944fc){_0x141177=_0x141177-0x0;var _0x3014ad=_0x4e3e[_0x141177];return _0x3014ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4e3('0x1'));var rp=require(_0xe4e3('0x2'));var moment=require(_0xe4e3('0x3'));var BPromise=require(_0xe4e3('0x4'));var Mustache=require(_0xe4e3('0x5'));var util=require(_0xe4e3('0x6'));var path=require(_0xe4e3('0x7'));var sox=require(_0xe4e3('0x8'));var csv=require(_0xe4e3('0x9'));var ejs=require(_0xe4e3('0xa'));var fs=require('fs');var fs_extra=require(_0xe4e3('0xb'));var _=require(_0xe4e3('0xc'));var squel=require(_0xe4e3('0xd'));var crypto=require(_0xe4e3('0xe'));var jsforce=require(_0xe4e3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe4e3('0x9'));var querystring=require(_0xe4e3('0x10'));var Papa=require(_0xe4e3('0x11'));var Redis=require(_0xe4e3('0x12'));var authService=require(_0xe4e3('0x13'));var qs=require(_0xe4e3('0x14'));var as=require(_0xe4e3('0x15'));var hardwareService=require(_0xe4e3('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe4e3('0x17'));var licenseUtil=require(_0xe4e3('0x18'));var db=require(_0xe4e3('0x19'))['db'];config[_0xe4e3('0x1a')]=_['defaults'](config['redis'],{'host':_0xe4e3('0x1b'),'port':0x18eb});var socket=require(_0xe4e3('0x1c'))(new Redis(config[_0xe4e3('0x1a')]));require(_0xe4e3('0x1d'))[_0xe4e3('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe4e3('0x1f')][_0xe4e3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3b1668,_0xd5cabe,_0x5164bc,_0x2d853c){return new BPromise(function(_0x15d73f,_0xe486e){var _0x109a1c=_0x2d853c||client;return _0x109a1c[_0xe4e3('0x21')](_0x3b1668,_0x5164bc)[_0xe4e3('0x22')](function(_0x4f7b4c){logger[_0xe4e3('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0xd5cabe,_0xe4e3('0x24'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xd5cabe,_0xe4e3('0x24'),JSON['stringify'](_0x4f7b4c));if(_0x4f7b4c[_0xe4e3('0x25')]){if(_0x4f7b4c[_0xe4e3('0x25')][_0xe4e3('0x26')]===0x1f4){logger[_0xe4e3('0x25')](_0xe4e3('0x27'),_0xd5cabe,_0x4f7b4c['error'][_0xe4e3('0x28')]);return _0xe486e(_0x4f7b4c[_0xe4e3('0x25')][_0xe4e3('0x28')]);}logger[_0xe4e3('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0xd5cabe,_0x4f7b4c[_0xe4e3('0x25')][_0xe4e3('0x28')]);return _0x15d73f(_0x4f7b4c['error'][_0xe4e3('0x28')]);}else{logger['info'](_0xe4e3('0x27'),_0xd5cabe,_0xe4e3('0x24'));_0x15d73f(_0x4f7b4c[_0xe4e3('0x29')][_0xe4e3('0x28')]);}})[_0xe4e3('0x2a')](function(_0x1065d8){logger[_0xe4e3('0x25')](_0xe4e3('0x27'),_0xd5cabe,_0x1065d8);_0xe486e(_0x1065d8);});});}function respondWithStatusCode(_0x2c4928,_0x50275f){_0x50275f=_0x50275f||0xcc;return function(_0x323e89){if(_0x323e89){return _0x2c4928[_0xe4e3('0x2b')](_0x50275f);}return _0x2c4928[_0xe4e3('0x2c')](_0x50275f)[_0xe4e3('0x2d')]();};}function respondWithResult(_0x186189,_0x30d7f4){_0x30d7f4=_0x30d7f4||0xc8;return function(_0x1d6a0b){if(_0x1d6a0b){return _0x186189[_0xe4e3('0x2c')](_0x30d7f4)[_0xe4e3('0x2e')](_0x1d6a0b);}};}function respondWithFilteredResult(_0x40fca5,_0x42466e){return function(_0x3645cb){if(_0x3645cb){var _0x3dfbf8=typeof _0x42466e[_0xe4e3('0x2f')]==='undefined'&&typeof _0x42466e['limit']==='undefined';var _0x33af01=_0x3645cb['count'];var _0x14dfe4=_0x3dfbf8?0x0:_0x42466e[_0xe4e3('0x2f')];var _0x1c958c=_0x3dfbf8?_0x3645cb[_0xe4e3('0x30')]:_0x42466e['offset']+_0x42466e['limit'];var _0x10740a;if(_0x1c958c>=_0x33af01){_0x1c958c=_0x33af01;_0x10740a=0xc8;}else{_0x10740a=0xce;}_0x40fca5[_0xe4e3('0x2c')](_0x10740a);return _0x40fca5[_0xe4e3('0x31')]('Content-Range',_0x14dfe4+'-'+_0x1c958c+'/'+_0x33af01)[_0xe4e3('0x2e')](_0x3645cb);}return null;};}function patchUpdates(_0x3d22d7){return function(_0x3ee116){try{jsonpatch[_0xe4e3('0x32')](_0x3ee116,_0x3d22d7,!![]);}catch(_0xf76b42){return BPromise[_0xe4e3('0x33')](_0xf76b42);}return _0x3ee116[_0xe4e3('0x34')]();};}function saveUpdates(_0x145e0b,_0x9992e0){return function(_0x1bac1c){if(_0x1bac1c){return _0x1bac1c[_0xe4e3('0x35')](_0x145e0b)[_0xe4e3('0x22')](function(_0x5bcd3f){return _0x5bcd3f;});}return null;};}function removeEntity(_0x329cc3,_0x4530d6){return function(_0x38ca4e){if(_0x38ca4e){return _0x38ca4e[_0xe4e3('0x36')]()[_0xe4e3('0x22')](function(){var _0x1b3b6e=_0x38ca4e[_0xe4e3('0x37')]({'plain':!![]});var _0x1b13ba='OpenchannelAccounts';return db[_0xe4e3('0x38')][_0xe4e3('0x36')]({'where':{'type':_0x1b13ba,'resourceId':_0x1b3b6e['id']}})['then'](function(){return _0x38ca4e;});})['then'](function(){_0x329cc3[_0xe4e3('0x2c')](0xcc)[_0xe4e3('0x2d')]();});}};}function handleEntityNotFound(_0x351340,_0x5e1b5c){return function(_0x20251b){if(!_0x20251b){_0x351340['sendStatus'](0x194);}return _0x20251b;};}function handleError(_0xd214d3,_0x2e5fe0){_0x2e5fe0=_0x2e5fe0||0x1f4;return function(_0x4fe68e){logger[_0xe4e3('0x25')](_0x4fe68e[_0xe4e3('0x39')]);if(_0x4fe68e[_0xe4e3('0x3a')]){delete _0x4fe68e[_0xe4e3('0x3a')];}_0xd214d3[_0xe4e3('0x2c')](_0x2e5fe0)[_0xe4e3('0x3b')](_0x4fe68e);};}exports[_0xe4e3('0x3c')]=function(_0x37184f,_0x376973){var _0x667c23={'include':[{'model':db[_0xe4e3('0x3d')],'as':'mandatoryDispositionPause'}]},_0x110244={},_0x3686a0={'count':0x0,'rows':[]};var _0x3152e6=_[_0xe4e3('0x3e')](db[_0xe4e3('0x3f')]['rawAttributes'],function(_0x4e27e8){return{'name':_0x4e27e8[_0xe4e3('0x40')],'type':_0x4e27e8['type'][_0xe4e3('0x41')]};});_0x110244[_0xe4e3('0x42')]=_['map'](_0x3152e6,_0xe4e3('0x3a'));_0x110244[_0xe4e3('0x43')]=_[_0xe4e3('0x44')](_0x37184f[_0xe4e3('0x43')]);_0x110244[_0xe4e3('0x45')]=_[_0xe4e3('0x46')](_0x110244[_0xe4e3('0x42')],_0x110244[_0xe4e3('0x43')]);_0x667c23['attributes']=_[_0xe4e3('0x46')](_0x110244[_0xe4e3('0x42')],qs[_0xe4e3('0x47')](_0x37184f[_0xe4e3('0x43')][_0xe4e3('0x47')]));_0x667c23[_0xe4e3('0x48')]=_0x667c23[_0xe4e3('0x48')][_0xe4e3('0x49')]?_0x667c23['attributes']:_0x110244[_0xe4e3('0x42')];if(!_0x37184f['query'][_0xe4e3('0x4a')](_0xe4e3('0x4b'))){_0x667c23[_0xe4e3('0x4c')]=qs[_0xe4e3('0x4c')](_0x37184f['query'][_0xe4e3('0x4c')]);_0x667c23[_0xe4e3('0x2f')]=qs[_0xe4e3('0x2f')](_0x37184f[_0xe4e3('0x43')][_0xe4e3('0x2f')]);}_0x667c23[_0xe4e3('0x4d')]=qs[_0xe4e3('0x4e')](_0x37184f[_0xe4e3('0x43')][_0xe4e3('0x4e')]);_0x667c23[_0xe4e3('0x4f')]=qs['filters'](_['pick'](_0x37184f[_0xe4e3('0x43')],_0x110244[_0xe4e3('0x45')]),_0x3152e6);if(_0x37184f['query']['filter']){_0x667c23[_0xe4e3('0x4f')]=_[_0xe4e3('0x50')](_0x667c23[_0xe4e3('0x4f')],{'$or':_[_0xe4e3('0x3e')](_0x3152e6,function(_0x21f657){if(_0x21f657[_0xe4e3('0x51')]!==_0xe4e3('0x52')){var _0x23f0c7={};_0x23f0c7[_0x21f657['name']]={'$like':'%'+_0x37184f[_0xe4e3('0x43')][_0xe4e3('0x53')]+'%'};return _0x23f0c7;}})});}_0x667c23=_[_0xe4e3('0x50')]({},_0x667c23,_0x37184f[_0xe4e3('0x54')]);var _0x1ab3e7={'where':_0x667c23[_0xe4e3('0x4f')]};return db[_0xe4e3('0x3f')][_0xe4e3('0x30')](_0x1ab3e7)[_0xe4e3('0x22')](function(_0xd7c492){_0x3686a0[_0xe4e3('0x30')]=_0xd7c492;if(_0x37184f[_0xe4e3('0x43')][_0xe4e3('0x55')]){_0x667c23['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0xe4e3('0x56')](_0x667c23);})[_0xe4e3('0x22')](function(_0xe6e2fe){_0x3686a0[_0xe4e3('0x57')]=_0xe6e2fe;return _0x3686a0;})[_0xe4e3('0x22')](respondWithFilteredResult(_0x376973,_0x667c23))['catch'](handleError(_0x376973,null));};exports[_0xe4e3('0x58')]=function(_0x21a6ef,_0x1a3433){var _0x9677c8={'raw':![],'where':{'id':_0x21a6ef[_0xe4e3('0x59')]['id']},'include':[{'model':db[_0xe4e3('0x3d')],'as':_0xe4e3('0x5a')}]},_0x24c60a={};_0x24c60a['model']=_['keys'](db[_0xe4e3('0x3f')]['rawAttributes']);_0x24c60a[_0xe4e3('0x43')]=_[_0xe4e3('0x44')](_0x21a6ef['query']);_0x24c60a[_0xe4e3('0x45')]=_['intersection'](_0x24c60a[_0xe4e3('0x42')],_0x24c60a[_0xe4e3('0x43')]);_0x9677c8[_0xe4e3('0x48')]=_['intersection'](_0x24c60a[_0xe4e3('0x42')],qs[_0xe4e3('0x47')](_0x21a6ef[_0xe4e3('0x43')][_0xe4e3('0x47')]));_0x9677c8[_0xe4e3('0x48')]=_0x9677c8[_0xe4e3('0x48')][_0xe4e3('0x49')]?_0x9677c8[_0xe4e3('0x48')]:_0x24c60a[_0xe4e3('0x42')];if(_0x21a6ef['query'][_0xe4e3('0x55')]){_0x9677c8[_0xe4e3('0x5b')]=[{'all':!![]}];}_0x9677c8=_[_0xe4e3('0x50')]({},_0x9677c8,_0x21a6ef['options']);return db[_0xe4e3('0x3f')][_0xe4e3('0x5c')](_0x9677c8)['then'](handleEntityNotFound(_0x1a3433,null))['then'](respondWithResult(_0x1a3433,null))[_0xe4e3('0x2a')](handleError(_0x1a3433,null));};exports[_0xe4e3('0x5d')]=function(_0x568bd9,_0x27cd7d){return db[_0xe4e3('0x3f')]['create'](_0x568bd9[_0xe4e3('0x5e')],{})[_0xe4e3('0x22')](function(_0x3b009d){var _0x11effe=_0x568bd9['user'][_0xe4e3('0x37')]({'plain':!![]});if(!_0x11effe)throw new Error(_0xe4e3('0x5f'));if(_0x11effe['role']==='user'){var _0x9fcc0b=_0x3b009d['get']({'plain':!![]});var _0x59e717='OpenchannelAccounts';return db[_0xe4e3('0x60')]['find']({'where':{'name':_0x59e717,'userProfileId':_0x11effe[_0xe4e3('0x61')]},'raw':!![]})[_0xe4e3('0x22')](function(_0x4565b0){if(_0x4565b0&&_0x4565b0[_0xe4e3('0x62')]===0x0){return db['UserProfileResource'][_0xe4e3('0x5d')]({'name':_0x9fcc0b['name'],'resourceId':_0x9fcc0b['id'],'type':_0x4565b0[_0xe4e3('0x3a')],'sectionId':_0x4565b0['id']},{})['then'](function(){return _0x3b009d;});}else{return _0x3b009d;}})[_0xe4e3('0x2a')](function(_0x39a584){logger[_0xe4e3('0x25')](_0xe4e3('0x63'),_0x39a584);throw _0x39a584;});}return _0x3b009d;})[_0xe4e3('0x22')](respondWithResult(_0x27cd7d,0xc9))[_0xe4e3('0x2a')](handleError(_0x27cd7d,null));};exports[_0xe4e3('0x35')]=function(_0x2f5187,_0x4f7e64){if(_0x2f5187[_0xe4e3('0x5e')]['id']){delete _0x2f5187['body']['id'];}return db[_0xe4e3('0x3f')][_0xe4e3('0x5c')]({'where':{'id':_0x2f5187[_0xe4e3('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xe4e3('0x5a')}]})[_0xe4e3('0x22')](handleEntityNotFound(_0x4f7e64,null))['then'](saveUpdates(_0x2f5187[_0xe4e3('0x5e')],null))[_0xe4e3('0x22')](respondWithResult(_0x4f7e64,null))[_0xe4e3('0x2a')](handleError(_0x4f7e64,null));};exports[_0xe4e3('0x36')]=function(_0x18ae00,_0xf63a3b){return db[_0xe4e3('0x3f')][_0xe4e3('0x5c')]({'where':{'id':_0x18ae00['params']['id']}})['then'](handleEntityNotFound(_0xf63a3b,null))[_0xe4e3('0x22')](removeEntity(_0xf63a3b,null))[_0xe4e3('0x2a')](handleError(_0xf63a3b,null));};exports[_0xe4e3('0x64')]=function(_0x3b6124,_0x39e4a8){return db[_0xe4e3('0x3f')]['describe']()[_0xe4e3('0x22')](respondWithResult(_0x39e4a8,null))[_0xe4e3('0x2a')](handleError(_0x39e4a8,null));};exports[_0xe4e3('0x65')]=function(_0x47f17d,_0xa4ce5f,_0x180fe2){if(_0x47f17d['body']['id']){delete _0x47f17d[_0xe4e3('0x5e')]['id'];}return db['OpenchannelAccount'][_0xe4e3('0x5c')]({'where':{'id':_0x47f17d[_0xe4e3('0x59')]['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0xa4ce5f,null))['then'](function(_0x55e00b){if(_0x55e00b){_0x47f17d['body'][_0xe4e3('0x66')]=_0x55e00b['id'];return db['Disposition'][_0xe4e3('0x5d')](_0x47f17d[_0xe4e3('0x5e')]);}})['then'](respondWithResult(_0xa4ce5f,null))[_0xe4e3('0x2a')](handleError(_0xa4ce5f,null));};exports['getDispositions']=function(_0x5f2d06,_0x2dd522,_0x134c16){var _0x54e31f={'raw':![],'where':{}};var _0x36c78d={};var _0x102da5={'count':0x0,'rows':[]};return db[_0xe4e3('0x3f')]['findOne']({'where':{'id':_0x5f2d06[_0xe4e3('0x59')]['id']}})['then'](handleEntityNotFound(_0x2dd522,null))['then'](function(_0x5a847f){if(_0x5a847f){_0x36c78d[_0xe4e3('0x42')]=_['keys'](db[_0xe4e3('0x67')][_0xe4e3('0x68')]);_0x36c78d[_0xe4e3('0x43')]=_[_0xe4e3('0x44')](_0x5f2d06[_0xe4e3('0x43')]);_0x36c78d[_0xe4e3('0x45')]=_[_0xe4e3('0x46')](_0x36c78d[_0xe4e3('0x42')],_0x36c78d[_0xe4e3('0x43')]);_0x54e31f[_0xe4e3('0x48')]=_[_0xe4e3('0x46')](_0x36c78d['model'],qs[_0xe4e3('0x47')](_0x5f2d06[_0xe4e3('0x43')]['fields']));_0x54e31f['attributes']=_0x54e31f[_0xe4e3('0x48')]['length']?_0x54e31f[_0xe4e3('0x48')]:_0x36c78d[_0xe4e3('0x42')];if(!_0x5f2d06['query'][_0xe4e3('0x4a')]('nolimit')){_0x54e31f[_0xe4e3('0x4c')]=qs[_0xe4e3('0x4c')](_0x5f2d06[_0xe4e3('0x43')]['limit']);_0x54e31f[_0xe4e3('0x2f')]=qs[_0xe4e3('0x2f')](_0x5f2d06[_0xe4e3('0x43')][_0xe4e3('0x2f')]);}_0x54e31f['order']=qs[_0xe4e3('0x4e')](_0x5f2d06[_0xe4e3('0x43')][_0xe4e3('0x4e')]);_0x54e31f[_0xe4e3('0x4f')]=qs[_0xe4e3('0x45')](_[_0xe4e3('0x69')](_0x5f2d06[_0xe4e3('0x43')],_0x36c78d[_0xe4e3('0x45')]));_0x54e31f[_0xe4e3('0x4f')][_0xe4e3('0x66')]=_0x5a847f['id'];if(_0x5f2d06[_0xe4e3('0x43')]['filter']){_0x54e31f[_0xe4e3('0x4f')]=_[_0xe4e3('0x50')](_0x54e31f[_0xe4e3('0x4f')],{'$or':_[_0xe4e3('0x3e')](_0x54e31f['attributes'],function(_0x1b3fca){var _0x560a30={};_0x560a30[_0x1b3fca]={'$like':'%'+_0x5f2d06[_0xe4e3('0x43')][_0xe4e3('0x53')]+'%'};return _0x560a30;})});}_0x54e31f=_[_0xe4e3('0x50')]({},_0x54e31f,_0x5f2d06['options']);return db[_0xe4e3('0x67')][_0xe4e3('0x30')]({'where':_0x54e31f[_0xe4e3('0x4f')]})[_0xe4e3('0x22')](function(_0x2a6ea4){_0x102da5['count']=_0x2a6ea4;if(_0x5f2d06[_0xe4e3('0x43')]['includeAll']){_0x54e31f[_0xe4e3('0x5b')]=[{'all':!![]}];}return db[_0xe4e3('0x67')]['findAll'](_0x54e31f);})['then'](function(_0x126a6e){_0x102da5['rows']=_0x126a6e;return _0x102da5;});}})[_0xe4e3('0x22')](respondWithFilteredResult(_0x2dd522,_0x54e31f))[_0xe4e3('0x2a')](handleError(_0x2dd522,null));};exports['removeDispositions']=function(_0x32e807,_0xc18514,_0x559cb2){return db[_0xe4e3('0x3f')][_0xe4e3('0x5c')]({'where':{'id':_0x32e807['params']['id']}})['then'](handleEntityNotFound(_0xc18514,null))[_0xe4e3('0x22')](function(_0x143d9d){if(_0x143d9d){return _0x143d9d[_0xe4e3('0x6a')](_0x32e807[_0xe4e3('0x43')][_0xe4e3('0x6b')]);}})[_0xe4e3('0x22')](respondWithStatusCode(_0xc18514,null))[_0xe4e3('0x2a')](handleError(_0xc18514,null));};exports[_0xe4e3('0x6c')]=function(_0x2f4b0d,_0x500df7,_0xd22628){if(_0x2f4b0d[_0xe4e3('0x5e')]['id']){delete _0x2f4b0d[_0xe4e3('0x5e')]['id'];}return db['OpenchannelAccount'][_0xe4e3('0x5c')]({'where':{'id':_0x2f4b0d[_0xe4e3('0x59')]['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0x500df7,null))[_0xe4e3('0x22')](function(_0x5dd4fc){if(_0x5dd4fc){_0x2f4b0d[_0xe4e3('0x5e')][_0xe4e3('0x66')]=_0x5dd4fc['id'];return db[_0xe4e3('0x6d')][_0xe4e3('0x5d')](_0x2f4b0d[_0xe4e3('0x5e')]);}})[_0xe4e3('0x22')](respondWithResult(_0x500df7,null))[_0xe4e3('0x2a')](handleError(_0x500df7,null));};exports[_0xe4e3('0x6e')]=function(_0x216cf1,_0xfb9e2d,_0x42cb7c){var _0x4de401={'raw':![],'where':{}};var _0x55c230={};var _0x53eefb={'count':0x0,'rows':[]};return db[_0xe4e3('0x3f')][_0xe4e3('0x6f')]({'where':{'id':_0x216cf1[_0xe4e3('0x59')]['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0xfb9e2d,null))[_0xe4e3('0x22')](function(_0x4df953){if(_0x4df953){_0x55c230['model']=_[_0xe4e3('0x44')](db[_0xe4e3('0x6d')][_0xe4e3('0x68')]);_0x55c230[_0xe4e3('0x43')]=_[_0xe4e3('0x44')](_0x216cf1[_0xe4e3('0x43')]);_0x55c230['filters']=_[_0xe4e3('0x46')](_0x55c230[_0xe4e3('0x42')],_0x55c230['query']);_0x4de401['attributes']=_[_0xe4e3('0x46')](_0x55c230['model'],qs[_0xe4e3('0x47')](_0x216cf1[_0xe4e3('0x43')]['fields']));_0x4de401[_0xe4e3('0x48')]=_0x4de401[_0xe4e3('0x48')]['length']?_0x4de401[_0xe4e3('0x48')]:_0x55c230[_0xe4e3('0x42')];if(!_0x216cf1['query'][_0xe4e3('0x4a')](_0xe4e3('0x4b'))){_0x4de401[_0xe4e3('0x4c')]=qs['limit'](_0x216cf1['query']['limit']);_0x4de401[_0xe4e3('0x2f')]=qs['offset'](_0x216cf1[_0xe4e3('0x43')][_0xe4e3('0x2f')]);}_0x4de401[_0xe4e3('0x4d')]=qs[_0xe4e3('0x4e')](_0x216cf1[_0xe4e3('0x43')][_0xe4e3('0x4e')]);_0x4de401[_0xe4e3('0x4f')]=qs[_0xe4e3('0x45')](_[_0xe4e3('0x69')](_0x216cf1['query'],_0x55c230[_0xe4e3('0x45')]));_0x4de401[_0xe4e3('0x4f')]['OpenchannelAccountId']=_0x4df953['id'];if(_0x216cf1[_0xe4e3('0x43')]['filter']){_0x4de401[_0xe4e3('0x4f')]=_['merge'](_0x4de401[_0xe4e3('0x4f')],{'$or':_[_0xe4e3('0x3e')](_0x4de401[_0xe4e3('0x48')],function(_0x55546b){var _0x593fb5={};_0x593fb5[_0x55546b]={'$like':'%'+_0x216cf1[_0xe4e3('0x43')][_0xe4e3('0x53')]+'%'};return _0x593fb5;})});}_0x4de401=_[_0xe4e3('0x50')]({},_0x4de401,_0x216cf1[_0xe4e3('0x54')]);return db[_0xe4e3('0x6d')]['count']({'where':_0x4de401[_0xe4e3('0x4f')]})[_0xe4e3('0x22')](function(_0x59adaf){_0x53eefb[_0xe4e3('0x30')]=_0x59adaf;if(_0x216cf1[_0xe4e3('0x43')][_0xe4e3('0x55')]){_0x4de401[_0xe4e3('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe4e3('0x56')](_0x4de401);})[_0xe4e3('0x22')](function(_0x4e44e8){_0x53eefb[_0xe4e3('0x57')]=_0x4e44e8;return _0x53eefb;});}})[_0xe4e3('0x22')](respondWithFilteredResult(_0xfb9e2d,_0x4de401))[_0xe4e3('0x2a')](handleError(_0xfb9e2d,null));};exports[_0xe4e3('0x70')]=function(_0x51311b,_0x51698b,_0x4dcd34){return db['OpenchannelAccount'][_0xe4e3('0x5c')]({'where':{'id':_0x51311b[_0xe4e3('0x59')]['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0x51698b,null))[_0xe4e3('0x22')](function(_0x21a9a7){if(_0x21a9a7){return _0x21a9a7['removeAnswers'](_0x51311b['query']['ids']);}})[_0xe4e3('0x22')](respondWithStatusCode(_0x51698b,null))[_0xe4e3('0x2a')](handleError(_0x51698b,null));};exports['notify']=function(_0x1a4dc3,_0x3250c0,_0x562944){var _0x3b41d1={'body':_0x1a4dc3['body'],'channel':'openchannel'};var _0x477538=[];var _0x1b30a4=[];var _0x1b8d9d={};var _0x3cc042=![];return db[_0xe4e3('0x71')][_0xe4e3('0x64')]()['then'](function(_0x53a8f4){if(!_0x53a8f4){throw new db[(_0xe4e3('0x72'))]['ValidationError'](_0xe4e3('0x73'));}_0x477538=_['difference'](_[_0xe4e3('0x44')](_0x53a8f4),[_0xe4e3('0x74'),_0xe4e3('0x75')]);_0x1b30a4=_['difference'](_[_0xe4e3('0x44')](_0x53a8f4),[_0xe4e3('0x74'),'updatedAt','CompanyId','ListId']);if(_0x1a4dc3[_0xe4e3('0x5e')]['id']){delete _0x1a4dc3[_0xe4e3('0x5e')]['id'];}if(_[_0xe4e3('0x76')](_0x1a4dc3['body'][_0xe4e3('0x77')])){throw new db[(_0xe4e3('0x72'))][(_0xe4e3('0x78'))](_0xe4e3('0x79'));}if(_['isNil'](_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x5e')])||_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x5e')]===''){throw new db[(_0xe4e3('0x72'))][(_0xe4e3('0x78'))](_0xe4e3('0x7a'));}if(_[_0xe4e3('0x76')](_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x7b')])){throw new db[(_0xe4e3('0x72'))][(_0xe4e3('0x78'))](_0xe4e3('0x7c')+_0x1b30a4);}if(!_[_0xe4e3('0x7d')](_0x1b30a4,_0x1a4dc3['body'][_0xe4e3('0x7b')])){throw new db[(_0xe4e3('0x72'))][(_0xe4e3('0x78'))](_0xe4e3('0x7e')+_0x1b30a4);}_0x1b8d9d[_0x1a4dc3[_0xe4e3('0x5e')]['mapKey']]=_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x77')];})[_0xe4e3('0x22')](function(){return db[_0xe4e3('0x3f')][_0xe4e3('0x5c')]({'where':{'id':_0x1a4dc3['params']['id']},'include':[{'model':db['CmList'],'as':_0xe4e3('0x7f'),'include':[{'model':db[_0xe4e3('0x71')],'as':_0xe4e3('0x80'),'where':_0x1b8d9d,'limit':0x1,'order':[[_0xe4e3('0x75'),_0xe4e3('0x81')]]}]},{'model':db[_0xe4e3('0x82')],'as':_0xe4e3('0x83')}]});})[_0xe4e3('0x22')](handleEntityNotFound(_0x3250c0,null))[_0xe4e3('0x22')](function(_0x477353){if(_0x477353&&_0x477353[_0xe4e3('0x7f')]){_0x3b41d1[_0xe4e3('0x84')]=_0x477353;_0x3b41d1[_0xe4e3('0x85')]=_0x477353[_0xe4e3('0x83')];_0x3b41d1['list']=_0x477353[_0xe4e3('0x7f')];_0x3b41d1[_0xe4e3('0x85')]=_[_0xe4e3('0x86')](_0x3b41d1[_0xe4e3('0x85')],[_0xe4e3('0x87')],['asc']);if(_0x3b41d1[_0xe4e3('0x84')][_0xe4e3('0x83')]){delete _0x3b41d1['account'][_0xe4e3('0x83')];}if(_0x3b41d1[_0xe4e3('0x84')][_0xe4e3('0x7f')]&&_0x3b41d1[_0xe4e3('0x84')][_0xe4e3('0x7f')][_0xe4e3('0x80')]['length']){return _0x3b41d1[_0xe4e3('0x84')][_0xe4e3('0x7f')][_0xe4e3('0x80')][0x0];}var _0x4f7c0f=_[_0xe4e3('0x88')](_0x1a4dc3[_0xe4e3('0x5e')],{'firstName':_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x77')],'ListId':_0x477353[_0xe4e3('0x89')]});_0x4f7c0f[_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x7b')]]=_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x77')];return db[_0xe4e3('0x71')][_0xe4e3('0x5d')](_0x4f7c0f,{'fields':_0x477538,'raw':!![]});}})[_0xe4e3('0x22')](handleEntityNotFound(_0x3250c0,null))[_0xe4e3('0x22')](function(_0x1f9053){_0x3b41d1[_0xe4e3('0x8a')]=_0x1f9053;if(_0x1f9053){var _0x52707d={'ContactId':_0x1f9053['id'],'OpenchannelAccountId':_0x1a4dc3[_0xe4e3('0x59')]['id'],'from':(_0x1f9053[_0xe4e3('0x8b')]||'')+'\x20'+(_0x1f9053[_0xe4e3('0x8c')]||'')};var _0x52d386={'OpenchannelAccountId':_0x1a4dc3[_0xe4e3('0x59')]['id'],'closed':![]};if(_0x1a4dc3[_0xe4e3('0x5e')]['threadId']){_0x52d386[_0xe4e3('0x8d')]=_0x1a4dc3['body'][_0xe4e3('0x8d')];return db[_0xe4e3('0x8e')]['find']({'where':_0x52d386})[_0xe4e3('0x22')](function(_0x25bb61){if(_0x25bb61){return[_0x25bb61,![]];}_0x52707d[_0xe4e3('0x8d')]=_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x8d')];_0x52707d[_0xe4e3('0x8f')]=_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x8f')];return db[_0xe4e3('0x8e')]['create'](_0x52707d)[_0xe4e3('0x22')](function(_0x18203d){return[_0x18203d,!![]];});});}else{_0x52d386[_0xe4e3('0x8d')]=null;}_0x52d386['ContactId']=_0x1f9053['id'];return db[_0xe4e3('0x8e')][_0xe4e3('0x5c')]({'where':_0x52d386})[_0xe4e3('0x22')](function(_0x164aff){if(_0x164aff){return[_0x164aff,![]];}return db['OpenchannelInteraction'][_0xe4e3('0x5d')](_0x52707d)[_0xe4e3('0x22')](function(_0x21eac4){return[_0x21eac4,!![]];});});}})[_0xe4e3('0x90')](function(_0x1c1291,_0x578845){if(_0x1c1291){_0x3cc042=_0x578845;if(!_0x578845){var _0x4f1ba7={'from':(_0x3b41d1['contact'][_0xe4e3('0x8b')]||'')+'\x20'+(_0x3b41d1['contact'][_0xe4e3('0x8c')]||'')};if(_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x8d')]&&_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x91')]&&_0x1a4dc3[_0xe4e3('0x5e')]['threadId']!=_0x1a4dc3['body'][_0xe4e3('0x91')]){_0x4f1ba7[_0xe4e3('0x8d')]=_0x1a4dc3['body']['messageId'];}return _0x1c1291[_0xe4e3('0x35')](_0x4f1ba7);}else{return _0x1c1291;}}})[_0xe4e3('0x22')](function(_0x1773d6){_0x3b41d1[_0xe4e3('0x92')]=_0x1773d6[_0xe4e3('0x37')]({'plain':!![]});_0x3b41d1[_0xe4e3('0x92')][_0xe4e3('0x93')]=_0x3cc042;if(_0x3b41d1['interaction'][_0xe4e3('0x93')]){if(_0x3b41d1['account'][_0xe4e3('0x94')]){_0x3b41d1[_0xe4e3('0x85')][_0xe4e3('0x95')]({'id':0x0,'priority':_0x3b41d1[_0xe4e3('0x85')]['length']+0x1,'app':'close','appdata':_0xe4e3('0x96'),'interval':'*,*,*,*'});}}return db[_0xe4e3('0x97')][_0xe4e3('0x5d')]({'body':_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x5e')],'OpenchannelAccountId':_0x1a4dc3[_0xe4e3('0x59')]['id'],'OpenchannelInteractionId':_0x1773d6['id'],'direction':'in','ContactId':_0x3b41d1[_0xe4e3('0x8a')]['id'],'AttachmentId':_0x1a4dc3[_0xe4e3('0x5e')][_0xe4e3('0x98')]});})[_0xe4e3('0x22')](function(_0x4b4c4b){_0x3b41d1['message']=_0x4b4c4b;if(_0x3b41d1[_0xe4e3('0x92')][_0xe4e3('0x99')]){return db[_0xe4e3('0x9a')][_0xe4e3('0x5c')]({'attributes':['id',_0xe4e3('0x3a')],'where':{'id':_0x3b41d1[_0xe4e3('0x92')][_0xe4e3('0x99')]}})['then'](function(_0xe8a9e3){if(_0xe8a9e3){_0x3b41d1[_0xe4e3('0x85')][_0xe4e3('0x9b')]({'id':0x0,'priority':0x0,'app':_0xe4e3('0x9c'),'appdata':_0xe8a9e3[_0xe4e3('0x3a')]+','+(_0x3b41d1[_0xe4e3('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0xe4e3('0x9d')});_0x3b41d1[_0xe4e3('0x9e')]=![];}return respondWithRpcPromise('Start',_0xe4e3('0x9f'),_0x3b41d1);});}return respondWithRpcPromise(_0xe4e3('0xa0'),_0xe4e3('0x9f'),_0x3b41d1);})['then'](function(_0x269865){respondWithRpcPromise(_0xe4e3('0xa1'),_0xe4e3('0xa1'),{'event':'notify','message':_0x269865},client9002);return _0x269865;})[_0xe4e3('0x22')](respondWithResult(_0x3250c0,null))['catch'](handleError(_0x3250c0,null));};exports[_0xe4e3('0xa2')]=function(_0x436ce4,_0x5421e7,_0xbf0ed4){return db[_0xe4e3('0x3f')][_0xe4e3('0x6f')]({'where':{'id':_0x436ce4['params']['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0x5421e7,null))[_0xe4e3('0x22')](function(_0x5547be){if(_0x5547be){return db[_0xe4e3('0xa3')][_0xe4e3('0xa4')](function(_0x24f0e4){return db[_0xe4e3('0x82')][_0xe4e3('0x36')]({'where':{'OpenchannelAccountId':_0x436ce4[_0xe4e3('0x59')]['id']},'transaction':_0x24f0e4})[_0xe4e3('0x22')](function(_0x218050){var _0x61beb2=_[_0xe4e3('0x3e')](_0x436ce4['body'],function(_0x39891b){_0x39891b[_0xe4e3('0x66')]=_0x436ce4[_0xe4e3('0x59')]['id'];return _0x39891b;});return db[_0xe4e3('0x82')]['bulkCreate'](_0x61beb2,{'transaction':_0x24f0e4});});})['then'](function(){return db[_0xe4e3('0x82')][_0xe4e3('0xa5')]({'where':{'OpenchannelAccountId':_0x436ce4[_0xe4e3('0x59')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x5421e7,null))['catch'](handleError(_0x5421e7,null));};exports[_0xe4e3('0xa6')]=function(_0x5eccc0,_0x16c7a8,_0x5c4222){var _0x29338a={};var _0x2cb031={};var _0x2e9858;var _0x45dc50;return db[_0xe4e3('0x3f')]['findOne']({'where':{'id':_0x5eccc0[_0xe4e3('0x59')]['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0x16c7a8,null))[_0xe4e3('0x22')](function(_0xf59ca8){if(_0xf59ca8){_0x2e9858=_0xf59ca8;_0x2cb031[_0xe4e3('0x42')]=_[_0xe4e3('0x44')](db[_0xe4e3('0x82')][_0xe4e3('0x68')]);_0x2cb031['query']=_[_0xe4e3('0x44')](_0x5eccc0[_0xe4e3('0x43')]);_0x2cb031['filters']=_[_0xe4e3('0x46')](_0x2cb031['model'],_0x2cb031[_0xe4e3('0x43')]);_0x29338a[_0xe4e3('0x48')]=_['intersection'](_0x2cb031[_0xe4e3('0x42')],qs[_0xe4e3('0x47')](_0x5eccc0[_0xe4e3('0x43')][_0xe4e3('0x47')]));_0x29338a[_0xe4e3('0x48')]=_0x29338a['attributes'][_0xe4e3('0x49')]?_0x29338a[_0xe4e3('0x48')]:_0x2cb031['model'];_0x29338a[_0xe4e3('0x4d')]=qs[_0xe4e3('0x4e')](_0x5eccc0[_0xe4e3('0x43')]['sort']);_0x29338a[_0xe4e3('0x4f')]=qs[_0xe4e3('0x45')](_[_0xe4e3('0x69')](_0x5eccc0[_0xe4e3('0x43')],_0x2cb031[_0xe4e3('0x45')]));if(_0x5eccc0[_0xe4e3('0x43')][_0xe4e3('0x53')]){_0x29338a[_0xe4e3('0x4f')]=_[_0xe4e3('0x50')](_0x29338a[_0xe4e3('0x4f')],{'$or':_[_0xe4e3('0x3e')](_0x29338a[_0xe4e3('0x48')],function(_0x5e7c00){var _0x2e8ba0={};_0x2e8ba0[_0x5e7c00]={'$like':'%'+_0x5eccc0[_0xe4e3('0x43')]['filter']+'%'};return _0x2e8ba0;})});}_0x29338a=_[_0xe4e3('0x50')]({},_0x29338a,_0x5eccc0[_0xe4e3('0x54')]);return _0x2e9858['getApplications'](_0x29338a);}})[_0xe4e3('0x22')](function(_0x5bcde7){if(_0x5bcde7){_0x45dc50=_0x5bcde7['length'];if(!_0x5eccc0[_0xe4e3('0x43')][_0xe4e3('0x4a')](_0xe4e3('0x4b'))){_0x29338a[_0xe4e3('0x4c')]=qs['limit'](_0x5eccc0[_0xe4e3('0x43')][_0xe4e3('0x4c')]);_0x29338a['offset']=qs[_0xe4e3('0x2f')](_0x5eccc0[_0xe4e3('0x43')][_0xe4e3('0x2f')]);}return _0x2e9858[_0xe4e3('0xa6')](_0x29338a);}})[_0xe4e3('0x22')](function(_0x5d852c){if(_0x5d852c){return _0x5d852c?{'count':_0x45dc50,'rows':_0x5d852c}:null;}})[_0xe4e3('0x22')](respondWithResult(_0x16c7a8,null))[_0xe4e3('0x2a')](handleError(_0x16c7a8,null));};exports[_0xe4e3('0xa7')]=function(_0x1fe6c5,_0x345774,_0x114ade){var _0x5a0b2={'raw':![],'where':{}};var _0x48521d={};var _0x440cbb={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe4e3('0x6f')]({'where':{'id':_0x1fe6c5[_0xe4e3('0x59')]['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0x345774,null))[_0xe4e3('0x22')](function(_0x2f825){if(_0x2f825){_0x48521d[_0xe4e3('0x42')]=_[_0xe4e3('0x44')](db[_0xe4e3('0x8e')][_0xe4e3('0x68')]);_0x48521d[_0xe4e3('0x43')]=_[_0xe4e3('0x44')](_0x1fe6c5[_0xe4e3('0x43')]);_0x48521d[_0xe4e3('0x45')]=_[_0xe4e3('0x46')](_0x48521d[_0xe4e3('0x42')],_0x48521d[_0xe4e3('0x43')]);_0x5a0b2[_0xe4e3('0x48')]=_['intersection'](_0x48521d['model'],qs[_0xe4e3('0x47')](_0x1fe6c5['query'][_0xe4e3('0x47')]));_0x5a0b2[_0xe4e3('0x48')]=_0x5a0b2[_0xe4e3('0x48')][_0xe4e3('0x49')]?_0x5a0b2[_0xe4e3('0x48')]:_0x48521d[_0xe4e3('0x42')];if(!_0x1fe6c5['query'][_0xe4e3('0x4a')](_0xe4e3('0x4b'))){_0x5a0b2[_0xe4e3('0x4c')]=qs[_0xe4e3('0x4c')](_0x1fe6c5['query'][_0xe4e3('0x4c')]);_0x5a0b2['offset']=qs[_0xe4e3('0x2f')](_0x1fe6c5['query']['offset']);}_0x5a0b2['order']=qs[_0xe4e3('0x4e')](_0x1fe6c5[_0xe4e3('0x43')][_0xe4e3('0x4e')]);_0x5a0b2[_0xe4e3('0x4f')]=qs['filters'](_[_0xe4e3('0x69')](_0x1fe6c5[_0xe4e3('0x43')],_0x48521d[_0xe4e3('0x45')]));_0x5a0b2[_0xe4e3('0x4f')]['OpenchannelAccountId']=_0x2f825['id'];if(_0x1fe6c5[_0xe4e3('0x43')][_0xe4e3('0x53')]){_0x5a0b2['where']=_[_0xe4e3('0x50')](_0x5a0b2[_0xe4e3('0x4f')],{'$or':_['map'](_0x5a0b2[_0xe4e3('0x48')],function(_0x36ae75){var _0x56e645={};_0x56e645[_0x36ae75]={'$like':'%'+_0x1fe6c5['query'][_0xe4e3('0x53')]+'%'};return _0x56e645;})});}_0x5a0b2=_[_0xe4e3('0x50')]({},_0x5a0b2,_0x1fe6c5[_0xe4e3('0x54')]);return db[_0xe4e3('0x8e')][_0xe4e3('0x30')]({'where':_0x5a0b2[_0xe4e3('0x4f')]})[_0xe4e3('0x22')](function(_0x1c5e0a){_0x440cbb[_0xe4e3('0x30')]=_0x1c5e0a;if(_0x1fe6c5[_0xe4e3('0x43')]['includeAll']){_0x5a0b2[_0xe4e3('0x5b')]=[{'model':db[_0xe4e3('0x71')],'as':_0xe4e3('0xa8'),'required':![]},{'model':db['User'],'as':_0xe4e3('0xa9'),'attributes':[_0xe4e3('0x3a'),_0xe4e3('0xaa'),_0xe4e3('0xab')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xe4e3('0x3a'),_0xe4e3('0xac')],'where':_0x1fe6c5[_0xe4e3('0x43')][_0xe4e3('0xad')]?{'id':_0x1fe6c5[_0xe4e3('0x43')][_0xe4e3('0xad')]}:undefined,'required':_0x1fe6c5[_0xe4e3('0x43')][_0xe4e3('0xad')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x5a0b2);})['then'](function(_0x4c2af4){_0x440cbb[_0xe4e3('0x57')]=_0x4c2af4;return _0x440cbb;});}})[_0xe4e3('0x22')](respondWithFilteredResult(_0x345774,_0x5a0b2))[_0xe4e3('0x2a')](handleError(_0x345774,null));};exports[_0xe4e3('0xae')]=function(_0x37a28e,_0x315bbf,_0x5f1cc0){return db[_0xe4e3('0x3f')][_0xe4e3('0x5c')]({'where':{'id':_0x37a28e[_0xe4e3('0x59')]['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0x315bbf,null))[_0xe4e3('0x22')](function(_0x2d3f5e){if(_0x2d3f5e){return _0x2d3f5e[_0xe4e3('0xae')](_0x37a28e[_0xe4e3('0x5e')][_0xe4e3('0x6b')],_[_0xe4e3('0xaf')](_0x37a28e[_0xe4e3('0x5e')],[_0xe4e3('0x6b'),'id'])||{})[_0xe4e3('0x90')](function(_0x4c6ae2){for(var _0x235f7c=0x0;_0x235f7c<_0x37a28e['body'][_0xe4e3('0x6b')][_0xe4e3('0x49')];_0x235f7c+=0x1){socket[_0xe4e3('0xb0')]('userOpenchannelAccount:save',{'UserId':Number(_0x37a28e['body'][_0xe4e3('0x6b')][_0x235f7c]),'OpenchannelAccountId':Number(_0x37a28e[_0xe4e3('0x59')]['id'])});}return _0x4c6ae2;});}})[_0xe4e3('0x22')](respondWithResult(_0x315bbf,null))[_0xe4e3('0x2a')](handleError(_0x315bbf,null));};exports[_0xe4e3('0xb1')]=function(_0x52f28c,_0x480458,_0x20f5c2){return db[_0xe4e3('0x3f')][_0xe4e3('0x5c')]({'where':{'id':_0x52f28c[_0xe4e3('0x59')]['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0x480458,null))['then'](function(_0x536b7b){if(_0x536b7b){return _0x536b7b[_0xe4e3('0xb1')](_0x52f28c['query'][_0xe4e3('0x6b')])[_0xe4e3('0x22')](function(){if(_['isArray'](_0x52f28c[_0xe4e3('0x43')][_0xe4e3('0x6b')])){for(var _0x36122c=0x0;_0x36122c<_0x52f28c[_0xe4e3('0x43')][_0xe4e3('0x6b')][_0xe4e3('0x49')];_0x36122c+=0x1){socket[_0xe4e3('0xb0')]('userOpenchannelAccount:remove',{'UserId':Number(_0x52f28c[_0xe4e3('0x43')][_0xe4e3('0x6b')][_0x36122c]),'OpenchannelAccountId':Number(_0x52f28c[_0xe4e3('0x59')]['id'])});}}else{socket[_0xe4e3('0xb0')](_0xe4e3('0xb2'),{'UserId':Number(_0x52f28c[_0xe4e3('0x43')][_0xe4e3('0x6b')]),'OpenchannelAccountId':Number(_0x52f28c[_0xe4e3('0x59')]['id'])});}});}})[_0xe4e3('0x22')](respondWithStatusCode(_0x480458,null))[_0xe4e3('0x2a')](handleError(_0x480458,null));};exports[_0xe4e3('0xb3')]=function(_0x159d71,_0x500b1d,_0x18d4ac){var _0x529527={};var _0x171278={};var _0x49df6b;var _0x5ed71b;return db[_0xe4e3('0x3f')][_0xe4e3('0x6f')]({'where':{'id':_0x159d71[_0xe4e3('0x59')]['id']}})['then'](handleEntityNotFound(_0x500b1d,null))[_0xe4e3('0x22')](function(_0x59ded6){if(_0x59ded6){_0x49df6b=_0x59ded6;_0x171278['model']=_[_0xe4e3('0x44')](db['User'][_0xe4e3('0x68')]);_0x171278['query']=_['keys'](_0x159d71[_0xe4e3('0x43')]);_0x171278['filters']=_[_0xe4e3('0x46')](_0x171278[_0xe4e3('0x42')],_0x171278[_0xe4e3('0x43')]);_0x529527[_0xe4e3('0x48')]=_[_0xe4e3('0x46')](_0x171278[_0xe4e3('0x42')],qs[_0xe4e3('0x47')](_0x159d71[_0xe4e3('0x43')][_0xe4e3('0x47')]));_0x529527[_0xe4e3('0x48')]=_0x529527[_0xe4e3('0x48')][_0xe4e3('0x49')]?_0x529527[_0xe4e3('0x48')]:_0x171278[_0xe4e3('0x42')];_0x529527['order']=qs['sort'](_0x159d71['query'][_0xe4e3('0x4e')]);_0x529527['where']=qs[_0xe4e3('0x45')](_[_0xe4e3('0x69')](_0x159d71[_0xe4e3('0x43')],_0x171278['filters']));if(_0x159d71[_0xe4e3('0x43')]['filter']){_0x529527[_0xe4e3('0x4f')]=_[_0xe4e3('0x50')](_0x529527['where'],{'$or':_[_0xe4e3('0x3e')](_0x529527[_0xe4e3('0x48')],function(_0x5ca214){var _0x1eaddd={};_0x1eaddd[_0x5ca214]={'$like':'%'+_0x159d71['query'][_0xe4e3('0x53')]+'%'};return _0x1eaddd;})});}_0x529527=_['merge']({},_0x529527,_0x159d71['options']);return _0x49df6b[_0xe4e3('0xb3')](_0x529527);}})[_0xe4e3('0x22')](function(_0x19f9b4){if(_0x19f9b4){_0x5ed71b=_0x19f9b4[_0xe4e3('0x49')];if(!_0x159d71[_0xe4e3('0x43')][_0xe4e3('0x4a')]('nolimit')){_0x529527['limit']=qs[_0xe4e3('0x4c')](_0x159d71[_0xe4e3('0x43')][_0xe4e3('0x4c')]);_0x529527['offset']=qs[_0xe4e3('0x2f')](_0x159d71[_0xe4e3('0x43')]['offset']);}return _0x49df6b[_0xe4e3('0xb3')](_0x529527);}})['then'](function(_0x346989){if(_0x346989){return _0x346989?{'count':_0x5ed71b,'rows':_0x346989}:null;}})['then'](respondWithResult(_0x500b1d,null))[_0xe4e3('0x2a')](handleError(_0x500b1d,null));};exports[_0xe4e3('0x3b')]=function(_0xe52834,_0x1ded92,_0x57af7b){var _0x376634,_0x40d4e4,_0x5f030b;if(_['isNil'](_0xe52834[_0xe4e3('0x5e')][_0xe4e3('0x5e')])||_0xe52834[_0xe4e3('0x5e')][_0xe4e3('0x5e')]===''){throw new db[(_0xe4e3('0x72'))][(_0xe4e3('0x78'))](_0xe4e3('0x7a'));}if(_['isNil'](_0xe52834[_0xe4e3('0x5e')]['to'])){}_0x376634=_0xe52834[_0xe4e3('0x5e')]['to'];return db[_0xe4e3('0x3f')][_0xe4e3('0x6f')]({'where':{'id':_0xe52834[_0xe4e3('0x59')]['id']}})[_0xe4e3('0x22')](handleEntityNotFound(_0x1ded92,null))[_0xe4e3('0x22')](function(_0xa98218){if(_0xa98218){return db[_0xe4e3('0x3f')]['find']({'where':{'id':_0xa98218['id']},'include':[{'model':db[_0xe4e3('0xb4')],'as':_0xe4e3('0x7f'),'include':[{'model':db[_0xe4e3('0x71')],'as':_0xe4e3('0x80'),'where':{[_0xa98218[_0xe4e3('0x7b')]]:_0x376634},'limit':0x1,'order':[[_0xe4e3('0x75'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1ded92,null))[_0xe4e3('0x22')](function(_0xa4b9b6){if(_0xa4b9b6&&_0xa4b9b6[_0xe4e3('0x7f')]){_0x40d4e4=_0xa4b9b6['get']({'plain':!![]});if(_0x40d4e4[_0xe4e3('0x7f')]&&_0x40d4e4[_0xe4e3('0x7f')][_0xe4e3('0x80')][_0xe4e3('0x49')]){return _0x40d4e4[_0xe4e3('0x7f')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0xe4e3('0x88')](_0xe52834[_0xe4e3('0x5e')],{'firstName':_0x376634,[_0xa4b9b6[_0xe4e3('0x7b')]]:_0x376634,'phone':_0x376634,'ListId':_0x40d4e4[_0xe4e3('0x89')]}));}})['then'](handleEntityNotFound(_0x1ded92,null))[_0xe4e3('0x22')](function(_0x6505da){if(_0x6505da){_0x5f030b=_0x6505da;return db[_0xe4e3('0x8e')][_0xe4e3('0x5c')]({'where':{'ContactId':_0x5f030b['id'],'closed':![],'OpenchannelAccountId':_0x40d4e4['id']}})[_0xe4e3('0x22')](function(_0xd086bd){if(_0xd086bd){return[_0xd086bd,![]];}return db[_0xe4e3('0x8e')][_0xe4e3('0x5d')]({'UserId':_0xe52834[_0xe4e3('0xb5')]['id'],'ContactId':_0x5f030b['id'],'OpenchannelAccountId':_0x40d4e4['id'],'lastMsgDirection':_0xe4e3('0xb6'),'Messages':[_[_0xe4e3('0x50')](_0xe52834[_0xe4e3('0x5e')],{'read':![],'body':_0xe52834['body']['body'],'OpenchannelAccountId':_0x40d4e4['id'],'UserId':_0xe52834[_0xe4e3('0xb5')]['id'],'ContactId':_0x5f030b['id']})]},{'include':[{'model':db[_0xe4e3('0x97')],'as':_0xe4e3('0xb7')}]})[_0xe4e3('0x22')](function(_0x28df8a){return[_0x28df8a,!![]];});});}})[_0xe4e3('0x90')](function(_0x2db0b4,_0x28b750){if(_0x28b750){return _0x2db0b4;}return db[_0xe4e3('0x97')][_0xe4e3('0x5d')](_[_0xe4e3('0x50')](_0xe52834[_0xe4e3('0x5e')],{'read':![],'body':_0xe52834['body'][_0xe4e3('0x5e')],'OpenchannelAccountId':_0x40d4e4['id'],'OpenchannelInteractionId':_0x2db0b4['id'],'UserId':_0xe52834[_0xe4e3('0xb5')]['id'],'ContactId':_0x5f030b['id']}))['then'](function(_0x2b0d44){_0x2db0b4[_0xe4e3('0xb8')][_0xe4e3('0xb7')]=[];_0x2db0b4[_0xe4e3('0xb8')][_0xe4e3('0xb7')][_0xe4e3('0x95')](_0x2b0d44[_0xe4e3('0xb8')]);return _0x2db0b4;});});}})[_0xe4e3('0x22')](respondWithResult(_0x1ded92,null))[_0xe4e3('0x2a')](handleError(_0x1ded92,null));}; \ No newline at end of file +var _0x7639=['agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelAccount','findAll','rows','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','CmContact','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','priority','asc','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','UserId','User','unshift'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x7639,0xdf));var _0x9763=function(_0x1ee1bb,_0x3eb737){_0x1ee1bb=_0x1ee1bb-0x0;var _0x39f74a=_0x7639[_0x1ee1bb];return _0x39f74a;};'use strict';var emlformat=require(_0x9763('0x0'));var rimraf=require(_0x9763('0x1'));var zipdir=require(_0x9763('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9763('0x3'));var BPromise=require(_0x9763('0x4'));var Mustache=require(_0x9763('0x5'));var util=require(_0x9763('0x6'));var path=require(_0x9763('0x7'));var sox=require('sox');var csv=require(_0x9763('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9763('0x9'));var _=require(_0x9763('0xa'));var squel=require(_0x9763('0xb'));var crypto=require(_0x9763('0xc'));var jsforce=require(_0x9763('0xd'));var deskjs=require(_0x9763('0xe'));var toCsv=require(_0x9763('0x8'));var querystring=require(_0x9763('0xf'));var Papa=require('papaparse');var Redis=require(_0x9763('0x10'));var authService=require(_0x9763('0x11'));var qs=require(_0x9763('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9763('0x13'));var logger=require(_0x9763('0x14'))(_0x9763('0x15'));var utils=require(_0x9763('0x16'));var config=require(_0x9763('0x17'));var licenseUtil=require(_0x9763('0x18'));var db=require('../../mysqldb')['db'];config[_0x9763('0x19')]=_[_0x9763('0x1a')](config[_0x9763('0x19')],{'host':_0x9763('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x9763('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9763('0x1d')][_0x9763('0x1e')]({'port':0x232c});var client9002=jayson[_0x9763('0x1d')][_0x9763('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4afbd7,_0x1930f5,_0x4eaddc,_0x2bc07b){return new BPromise(function(_0x20838b,_0x5162ab){var _0x2de427=_0x2bc07b||client;return _0x2de427['request'](_0x4afbd7,_0x4eaddc)[_0x9763('0x1f')](function(_0x30a8c9){logger[_0x9763('0x20')](_0x9763('0x21'),_0x1930f5,_0x9763('0x22'));logger[_0x9763('0x23')](_0x9763('0x24'),_0x1930f5,_0x9763('0x22'),JSON[_0x9763('0x25')](_0x30a8c9));if(_0x30a8c9[_0x9763('0x26')]){if(_0x30a8c9[_0x9763('0x26')][_0x9763('0x27')]===0x1f4){logger[_0x9763('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x1930f5,_0x30a8c9[_0x9763('0x26')][_0x9763('0x28')]);return _0x5162ab(_0x30a8c9[_0x9763('0x26')][_0x9763('0x28')]);}logger['error'](_0x9763('0x21'),_0x1930f5,_0x30a8c9['error'][_0x9763('0x28')]);return _0x20838b(_0x30a8c9[_0x9763('0x26')][_0x9763('0x28')]);}else{logger['info'](_0x9763('0x21'),_0x1930f5,'request\x20sent');_0x20838b(_0x30a8c9[_0x9763('0x29')]['message']);}})[_0x9763('0x2a')](function(_0x3c0c95){logger[_0x9763('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x1930f5,_0x3c0c95);_0x5162ab(_0x3c0c95);});});}function respondWithStatusCode(_0x5d0ff2,_0x3f4b01){_0x3f4b01=_0x3f4b01||0xcc;return function(_0x51e0f3){if(_0x51e0f3){return _0x5d0ff2[_0x9763('0x2b')](_0x3f4b01);}return _0x5d0ff2[_0x9763('0x2c')](_0x3f4b01)[_0x9763('0x2d')]();};}function respondWithResult(_0x4ae15c,_0x3031bb){_0x3031bb=_0x3031bb||0xc8;return function(_0x179518){if(_0x179518){return _0x4ae15c[_0x9763('0x2c')](_0x3031bb)[_0x9763('0x2e')](_0x179518);}};}function respondWithFilteredResult(_0x434d38,_0x5c6e82){return function(_0xc2cfa7){if(_0xc2cfa7){var _0x233274=typeof _0x5c6e82['offset']==='undefined'&&typeof _0x5c6e82[_0x9763('0x2f')]===_0x9763('0x30');var _0x5c8590=_0xc2cfa7[_0x9763('0x31')];var _0x49e7f7=_0x233274?0x0:_0x5c6e82['offset'];var _0x451368=_0x233274?_0xc2cfa7[_0x9763('0x31')]:_0x5c6e82[_0x9763('0x32')]+_0x5c6e82[_0x9763('0x2f')];var _0x55d4d6;if(_0x451368>=_0x5c8590){_0x451368=_0x5c8590;_0x55d4d6=0xc8;}else{_0x55d4d6=0xce;}_0x434d38[_0x9763('0x2c')](_0x55d4d6);return _0x434d38[_0x9763('0x33')](_0x9763('0x34'),_0x49e7f7+'-'+_0x451368+'/'+_0x5c8590)[_0x9763('0x2e')](_0xc2cfa7);}return null;};}function patchUpdates(_0xbf293c){return function(_0x4b7565){try{jsonpatch[_0x9763('0x35')](_0x4b7565,_0xbf293c,!![]);}catch(_0x3eda96){return BPromise[_0x9763('0x36')](_0x3eda96);}return _0x4b7565['save']();};}function saveUpdates(_0x4e5530,_0x4ff14e){return function(_0x47317c){if(_0x47317c){return _0x47317c['update'](_0x4e5530)['then'](function(_0x326c5){return _0x326c5;});}return null;};}function removeEntity(_0x4c79a6,_0x4ad5c2){return function(_0x5b1e20){if(_0x5b1e20){return _0x5b1e20[_0x9763('0x37')]()[_0x9763('0x1f')](function(){var _0x2a097f=_0x5b1e20[_0x9763('0x38')]({'plain':!![]});var _0x301ffe=_0x9763('0x39');return db[_0x9763('0x3a')][_0x9763('0x37')]({'where':{'type':_0x301ffe,'resourceId':_0x2a097f['id']}})[_0x9763('0x1f')](function(){return _0x5b1e20;});})[_0x9763('0x1f')](function(){_0x4c79a6[_0x9763('0x2c')](0xcc)[_0x9763('0x2d')]();});}};}function handleEntityNotFound(_0x4b3073,_0x25d359){return function(_0x194c7c){if(!_0x194c7c){_0x4b3073[_0x9763('0x2b')](0x194);}return _0x194c7c;};}function handleError(_0x528335,_0x3f1f41){_0x3f1f41=_0x3f1f41||0x1f4;return function(_0x4124b1){logger[_0x9763('0x26')](_0x4124b1[_0x9763('0x3b')]);if(_0x4124b1[_0x9763('0x3c')]){delete _0x4124b1[_0x9763('0x3c')];}_0x528335[_0x9763('0x2c')](_0x3f1f41)[_0x9763('0x3d')](_0x4124b1);};}exports[_0x9763('0x3e')]=function(_0x1a8d7a,_0x402893){var _0x32a465={'include':[{'model':db[_0x9763('0x3f')],'as':_0x9763('0x40')}]},_0x5cd8cd={},_0x32176f={'count':0x0,'rows':[]};var _0x40769b=_[_0x9763('0x41')](db['OpenchannelAccount'][_0x9763('0x42')],function(_0x90f947){return{'name':_0x90f947['fieldName'],'type':_0x90f947[_0x9763('0x43')]['key']};});_0x5cd8cd['model']=_[_0x9763('0x41')](_0x40769b,_0x9763('0x3c'));_0x5cd8cd[_0x9763('0x44')]=_[_0x9763('0x45')](_0x1a8d7a['query']);_0x5cd8cd['filters']=_['intersection'](_0x5cd8cd[_0x9763('0x46')],_0x5cd8cd[_0x9763('0x44')]);_0x32a465[_0x9763('0x47')]=_[_0x9763('0x48')](_0x5cd8cd[_0x9763('0x46')],qs[_0x9763('0x49')](_0x1a8d7a[_0x9763('0x44')][_0x9763('0x49')]));_0x32a465['attributes']=_0x32a465[_0x9763('0x47')][_0x9763('0x4a')]?_0x32a465[_0x9763('0x47')]:_0x5cd8cd[_0x9763('0x46')];if(!_0x1a8d7a['query'][_0x9763('0x4b')](_0x9763('0x4c'))){_0x32a465['limit']=qs[_0x9763('0x2f')](_0x1a8d7a['query'][_0x9763('0x2f')]);_0x32a465[_0x9763('0x32')]=qs['offset'](_0x1a8d7a[_0x9763('0x44')][_0x9763('0x32')]);}_0x32a465[_0x9763('0x4d')]=qs[_0x9763('0x4e')](_0x1a8d7a[_0x9763('0x44')][_0x9763('0x4e')]);_0x32a465[_0x9763('0x4f')]=qs[_0x9763('0x50')](_[_0x9763('0x51')](_0x1a8d7a[_0x9763('0x44')],_0x5cd8cd[_0x9763('0x50')]),_0x40769b);if(_0x1a8d7a[_0x9763('0x44')][_0x9763('0x52')]){_0x32a465[_0x9763('0x4f')]=_[_0x9763('0x53')](_0x32a465[_0x9763('0x4f')],{'$or':_[_0x9763('0x41')](_0x40769b,function(_0x22bbf4){if(_0x22bbf4[_0x9763('0x43')]!==_0x9763('0x54')){var _0xca17fd={};_0xca17fd[_0x22bbf4[_0x9763('0x3c')]]={'$like':'%'+_0x1a8d7a[_0x9763('0x44')][_0x9763('0x52')]+'%'};return _0xca17fd;}})});}_0x32a465=_[_0x9763('0x53')]({},_0x32a465,_0x1a8d7a[_0x9763('0x55')]);var _0x46e37f={'where':_0x32a465[_0x9763('0x4f')]};return db['OpenchannelAccount'][_0x9763('0x31')](_0x46e37f)['then'](function(_0xfddade){_0x32176f[_0x9763('0x31')]=_0xfddade;if(_0x1a8d7a[_0x9763('0x44')][_0x9763('0x56')]){_0x32a465[_0x9763('0x57')]=[{'all':!![]}];}return db[_0x9763('0x58')][_0x9763('0x59')](_0x32a465);})['then'](function(_0x1f62f9){_0x32176f[_0x9763('0x5a')]=_0x1f62f9;return _0x32176f;})[_0x9763('0x1f')](respondWithFilteredResult(_0x402893,_0x32a465))[_0x9763('0x2a')](handleError(_0x402893,null));};exports[_0x9763('0x5b')]=function(_0x4df4c2,_0xeb6aa9){var _0xda354d={'raw':![],'where':{'id':_0x4df4c2['params']['id']},'include':[{'model':db[_0x9763('0x3f')],'as':_0x9763('0x40')}]},_0x1eaebe={};_0x1eaebe[_0x9763('0x46')]=_[_0x9763('0x45')](db[_0x9763('0x58')]['rawAttributes']);_0x1eaebe[_0x9763('0x44')]=_[_0x9763('0x45')](_0x4df4c2['query']);_0x1eaebe[_0x9763('0x50')]=_['intersection'](_0x1eaebe[_0x9763('0x46')],_0x1eaebe[_0x9763('0x44')]);_0xda354d[_0x9763('0x47')]=_[_0x9763('0x48')](_0x1eaebe[_0x9763('0x46')],qs[_0x9763('0x49')](_0x4df4c2[_0x9763('0x44')][_0x9763('0x49')]));_0xda354d[_0x9763('0x47')]=_0xda354d['attributes'][_0x9763('0x4a')]?_0xda354d['attributes']:_0x1eaebe[_0x9763('0x46')];if(_0x4df4c2['query']['includeAll']){_0xda354d[_0x9763('0x57')]=[{'all':!![]}];}_0xda354d=_['merge']({},_0xda354d,_0x4df4c2[_0x9763('0x55')]);return db[_0x9763('0x58')][_0x9763('0x5c')](_0xda354d)[_0x9763('0x1f')](handleEntityNotFound(_0xeb6aa9,null))['then'](respondWithResult(_0xeb6aa9,null))[_0x9763('0x2a')](handleError(_0xeb6aa9,null));};exports[_0x9763('0x5d')]=function(_0x4d9958,_0x4eeda5){return db[_0x9763('0x58')][_0x9763('0x5d')](_0x4d9958[_0x9763('0x5e')],{})[_0x9763('0x1f')](function(_0x34d535){var _0x2a2790=_0x4d9958[_0x9763('0x5f')][_0x9763('0x38')]({'plain':!![]});if(!_0x2a2790)throw new Error(_0x9763('0x60'));if(_0x2a2790[_0x9763('0x61')]==='user'){var _0x4bcdc6=_0x34d535[_0x9763('0x38')]({'plain':!![]});var _0x54aea3=_0x9763('0x39');return db['UserProfileSection'][_0x9763('0x5c')]({'where':{'name':_0x54aea3,'userProfileId':_0x2a2790['userProfileId']},'raw':!![]})[_0x9763('0x1f')](function(_0x1b3b53){if(_0x1b3b53&&_0x1b3b53[_0x9763('0x62')]===0x0){return db[_0x9763('0x3a')]['create']({'name':_0x4bcdc6[_0x9763('0x3c')],'resourceId':_0x4bcdc6['id'],'type':_0x1b3b53[_0x9763('0x3c')],'sectionId':_0x1b3b53['id']},{})[_0x9763('0x1f')](function(){return _0x34d535;});}else{return _0x34d535;}})[_0x9763('0x2a')](function(_0x332cd2){logger[_0x9763('0x26')](_0x9763('0x63'),_0x332cd2);throw _0x332cd2;});}return _0x34d535;})[_0x9763('0x1f')](respondWithResult(_0x4eeda5,0xc9))[_0x9763('0x2a')](handleError(_0x4eeda5,null));};exports[_0x9763('0x64')]=function(_0x3f7b1e,_0xc4a85c){if(_0x3f7b1e[_0x9763('0x5e')]['id']){delete _0x3f7b1e[_0x9763('0x5e')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x3f7b1e[_0x9763('0x65')]['id']},'include':[{'model':db[_0x9763('0x3f')],'as':_0x9763('0x40')}]})[_0x9763('0x1f')](handleEntityNotFound(_0xc4a85c,null))[_0x9763('0x1f')](saveUpdates(_0x3f7b1e[_0x9763('0x5e')],null))[_0x9763('0x1f')](respondWithResult(_0xc4a85c,null))[_0x9763('0x2a')](handleError(_0xc4a85c,null));};exports['destroy']=function(_0x35851f,_0x10ff14){return db['OpenchannelAccount'][_0x9763('0x5c')]({'where':{'id':_0x35851f[_0x9763('0x65')]['id']}})['then'](handleEntityNotFound(_0x10ff14,null))[_0x9763('0x1f')](removeEntity(_0x10ff14,null))[_0x9763('0x2a')](handleError(_0x10ff14,null));};exports[_0x9763('0x66')]=function(_0x3cf663,_0x52c913){return db[_0x9763('0x58')]['describe']()['then'](respondWithResult(_0x52c913,null))[_0x9763('0x2a')](handleError(_0x52c913,null));};exports[_0x9763('0x67')]=function(_0x438c96,_0x1c655b,_0x562514){if(_0x438c96[_0x9763('0x5e')]['id']){delete _0x438c96[_0x9763('0x5e')]['id'];}return db['OpenchannelAccount'][_0x9763('0x5c')]({'where':{'id':_0x438c96['params']['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0x1c655b,null))[_0x9763('0x1f')](function(_0x5dfa40){if(_0x5dfa40){_0x438c96[_0x9763('0x5e')]['OpenchannelAccountId']=_0x5dfa40['id'];return db[_0x9763('0x68')][_0x9763('0x5d')](_0x438c96[_0x9763('0x5e')]);}})[_0x9763('0x1f')](respondWithResult(_0x1c655b,null))[_0x9763('0x2a')](handleError(_0x1c655b,null));};exports[_0x9763('0x69')]=function(_0x3cc5a9,_0x344504,_0x13a4b3){var _0x3b0031={'raw':![],'where':{}};var _0x2c4e86={};var _0x4aa386={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9763('0x6a')]({'where':{'id':_0x3cc5a9[_0x9763('0x65')]['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0x344504,null))[_0x9763('0x1f')](function(_0x14f9db){if(_0x14f9db){_0x2c4e86[_0x9763('0x46')]=_[_0x9763('0x45')](db[_0x9763('0x68')][_0x9763('0x42')]);_0x2c4e86['query']=_['keys'](_0x3cc5a9['query']);_0x2c4e86[_0x9763('0x50')]=_[_0x9763('0x48')](_0x2c4e86[_0x9763('0x46')],_0x2c4e86[_0x9763('0x44')]);_0x3b0031[_0x9763('0x47')]=_[_0x9763('0x48')](_0x2c4e86[_0x9763('0x46')],qs['fields'](_0x3cc5a9[_0x9763('0x44')][_0x9763('0x49')]));_0x3b0031[_0x9763('0x47')]=_0x3b0031[_0x9763('0x47')][_0x9763('0x4a')]?_0x3b0031['attributes']:_0x2c4e86['model'];if(!_0x3cc5a9[_0x9763('0x44')]['hasOwnProperty'](_0x9763('0x4c'))){_0x3b0031[_0x9763('0x2f')]=qs['limit'](_0x3cc5a9[_0x9763('0x44')][_0x9763('0x2f')]);_0x3b0031[_0x9763('0x32')]=qs[_0x9763('0x32')](_0x3cc5a9[_0x9763('0x44')][_0x9763('0x32')]);}_0x3b0031[_0x9763('0x4d')]=qs['sort'](_0x3cc5a9['query'][_0x9763('0x4e')]);_0x3b0031['where']=qs[_0x9763('0x50')](_['pick'](_0x3cc5a9[_0x9763('0x44')],_0x2c4e86[_0x9763('0x50')]));_0x3b0031['where'][_0x9763('0x6b')]=_0x14f9db['id'];if(_0x3cc5a9[_0x9763('0x44')][_0x9763('0x52')]){_0x3b0031[_0x9763('0x4f')]=_['merge'](_0x3b0031[_0x9763('0x4f')],{'$or':_[_0x9763('0x41')](_0x3b0031[_0x9763('0x47')],function(_0x4ad71d){var _0x43eaa4={};_0x43eaa4[_0x4ad71d]={'$like':'%'+_0x3cc5a9['query']['filter']+'%'};return _0x43eaa4;})});}_0x3b0031=_[_0x9763('0x53')]({},_0x3b0031,_0x3cc5a9[_0x9763('0x55')]);return db[_0x9763('0x68')][_0x9763('0x31')]({'where':_0x3b0031[_0x9763('0x4f')]})[_0x9763('0x1f')](function(_0x1c2059){_0x4aa386[_0x9763('0x31')]=_0x1c2059;if(_0x3cc5a9[_0x9763('0x44')][_0x9763('0x56')]){_0x3b0031['include']=[{'all':!![]}];}return db[_0x9763('0x68')]['findAll'](_0x3b0031);})[_0x9763('0x1f')](function(_0x488630){_0x4aa386[_0x9763('0x5a')]=_0x488630;return _0x4aa386;});}})[_0x9763('0x1f')](respondWithFilteredResult(_0x344504,_0x3b0031))[_0x9763('0x2a')](handleError(_0x344504,null));};exports[_0x9763('0x6c')]=function(_0x5452ec,_0xd41aa,_0x5ef4ad){return db['OpenchannelAccount']['find']({'where':{'id':_0x5452ec[_0x9763('0x65')]['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0xd41aa,null))[_0x9763('0x1f')](function(_0x51a215){if(_0x51a215){return _0x51a215['removeDispositions'](_0x5452ec[_0x9763('0x44')][_0x9763('0x6d')]);}})[_0x9763('0x1f')](respondWithStatusCode(_0xd41aa,null))[_0x9763('0x2a')](handleError(_0xd41aa,null));};exports[_0x9763('0x6e')]=function(_0x45f0de,_0x3b49fd,_0x147994){if(_0x45f0de[_0x9763('0x5e')]['id']){delete _0x45f0de[_0x9763('0x5e')]['id'];}return db[_0x9763('0x58')][_0x9763('0x5c')]({'where':{'id':_0x45f0de[_0x9763('0x65')]['id']}})['then'](handleEntityNotFound(_0x3b49fd,null))[_0x9763('0x1f')](function(_0x1786e2){if(_0x1786e2){_0x45f0de['body'][_0x9763('0x6b')]=_0x1786e2['id'];return db[_0x9763('0x6f')][_0x9763('0x5d')](_0x45f0de[_0x9763('0x5e')]);}})[_0x9763('0x1f')](respondWithResult(_0x3b49fd,null))['catch'](handleError(_0x3b49fd,null));};exports[_0x9763('0x70')]=function(_0x20912c,_0x1af527,_0x3f16c8){var _0x4a4f92={'raw':![],'where':{}};var _0x1b448a={};var _0xd319c8={'count':0x0,'rows':[]};return db[_0x9763('0x58')]['findOne']({'where':{'id':_0x20912c['params']['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0x1af527,null))[_0x9763('0x1f')](function(_0x2f25a2){if(_0x2f25a2){_0x1b448a[_0x9763('0x46')]=_[_0x9763('0x45')](db[_0x9763('0x6f')][_0x9763('0x42')]);_0x1b448a[_0x9763('0x44')]=_['keys'](_0x20912c[_0x9763('0x44')]);_0x1b448a['filters']=_[_0x9763('0x48')](_0x1b448a[_0x9763('0x46')],_0x1b448a['query']);_0x4a4f92['attributes']=_['intersection'](_0x1b448a[_0x9763('0x46')],qs[_0x9763('0x49')](_0x20912c[_0x9763('0x44')][_0x9763('0x49')]));_0x4a4f92[_0x9763('0x47')]=_0x4a4f92[_0x9763('0x47')][_0x9763('0x4a')]?_0x4a4f92[_0x9763('0x47')]:_0x1b448a['model'];if(!_0x20912c[_0x9763('0x44')]['hasOwnProperty'](_0x9763('0x4c'))){_0x4a4f92[_0x9763('0x2f')]=qs[_0x9763('0x2f')](_0x20912c['query']['limit']);_0x4a4f92[_0x9763('0x32')]=qs[_0x9763('0x32')](_0x20912c[_0x9763('0x44')][_0x9763('0x32')]);}_0x4a4f92[_0x9763('0x4d')]=qs[_0x9763('0x4e')](_0x20912c[_0x9763('0x44')][_0x9763('0x4e')]);_0x4a4f92[_0x9763('0x4f')]=qs['filters'](_[_0x9763('0x51')](_0x20912c['query'],_0x1b448a[_0x9763('0x50')]));_0x4a4f92[_0x9763('0x4f')][_0x9763('0x6b')]=_0x2f25a2['id'];if(_0x20912c[_0x9763('0x44')][_0x9763('0x52')]){_0x4a4f92[_0x9763('0x4f')]=_['merge'](_0x4a4f92['where'],{'$or':_[_0x9763('0x41')](_0x4a4f92['attributes'],function(_0x2e8f90){var _0x242084={};_0x242084[_0x2e8f90]={'$like':'%'+_0x20912c[_0x9763('0x44')]['filter']+'%'};return _0x242084;})});}_0x4a4f92=_[_0x9763('0x53')]({},_0x4a4f92,_0x20912c['options']);return db[_0x9763('0x6f')][_0x9763('0x31')]({'where':_0x4a4f92['where']})[_0x9763('0x1f')](function(_0x5887fa){_0xd319c8['count']=_0x5887fa;if(_0x20912c[_0x9763('0x44')][_0x9763('0x56')]){_0x4a4f92[_0x9763('0x57')]=[{'all':!![]}];}return db[_0x9763('0x6f')]['findAll'](_0x4a4f92);})[_0x9763('0x1f')](function(_0xa70e01){_0xd319c8['rows']=_0xa70e01;return _0xd319c8;});}})[_0x9763('0x1f')](respondWithFilteredResult(_0x1af527,_0x4a4f92))['catch'](handleError(_0x1af527,null));};exports[_0x9763('0x71')]=function(_0x4d6034,_0x2ff79a,_0x4caee8){return db[_0x9763('0x58')][_0x9763('0x5c')]({'where':{'id':_0x4d6034['params']['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0x2ff79a,null))[_0x9763('0x1f')](function(_0x2cef0d){if(_0x2cef0d){return _0x2cef0d['removeAnswers'](_0x4d6034[_0x9763('0x44')][_0x9763('0x6d')]);}})[_0x9763('0x1f')](respondWithStatusCode(_0x2ff79a,null))[_0x9763('0x2a')](handleError(_0x2ff79a,null));};exports[_0x9763('0x72')]=function(_0x41c685,_0x3d4dd1,_0x56ee40){var _0x4ad8d5={'body':_0x41c685[_0x9763('0x5e')],'channel':_0x9763('0x73')};var _0x5e51f5=[];var _0x180614=[];var _0x10e499={};var _0x6b975=![];return db['CmContact'][_0x9763('0x66')]()[_0x9763('0x1f')](function(_0x451238){if(!_0x451238){throw new db[(_0x9763('0x74'))][(_0x9763('0x75'))](_0x9763('0x76'));}_0x5e51f5=_[_0x9763('0x77')](_[_0x9763('0x45')](_0x451238),['createdAt','updatedAt']);_0x180614=_[_0x9763('0x77')](_[_0x9763('0x45')](_0x451238),[_0x9763('0x78'),_0x9763('0x79'),_0x9763('0x7a'),'ListId']);if(_0x41c685[_0x9763('0x5e')]['id']){delete _0x41c685[_0x9763('0x5e')]['id'];}if(_['isNil'](_0x41c685[_0x9763('0x5e')]['from'])){throw new db[(_0x9763('0x74'))][(_0x9763('0x75'))](_0x9763('0x7b'));}if(_[_0x9763('0x7c')](_0x41c685[_0x9763('0x5e')]['body'])||_0x41c685[_0x9763('0x5e')][_0x9763('0x5e')]===''){throw new db['Sequelize'][(_0x9763('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9763('0x7c')](_0x41c685['body'][_0x9763('0x7d')])){throw new db[(_0x9763('0x74'))][(_0x9763('0x75'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x180614);}if(!_['includes'](_0x180614,_0x41c685[_0x9763('0x5e')][_0x9763('0x7d')])){throw new db['Sequelize'][(_0x9763('0x75'))](_0x9763('0x7e')+_0x180614);}_0x10e499[_0x41c685[_0x9763('0x5e')][_0x9763('0x7d')]]=_0x41c685['body'][_0x9763('0x7f')];})[_0x9763('0x1f')](function(){return db['OpenchannelAccount'][_0x9763('0x5c')]({'where':{'id':_0x41c685[_0x9763('0x65')]['id']},'include':[{'model':db[_0x9763('0x80')],'as':'List','include':[{'model':db[_0x9763('0x81')],'as':_0x9763('0x82'),'where':_0x10e499,'limit':0x1,'order':[['updatedAt',_0x9763('0x83')]]}]},{'model':db[_0x9763('0x84')],'as':_0x9763('0x85')}]});})[_0x9763('0x1f')](handleEntityNotFound(_0x3d4dd1,null))[_0x9763('0x1f')](function(_0x32397c){if(_0x32397c&&_0x32397c[_0x9763('0x86')]){_0x4ad8d5[_0x9763('0x87')]=_0x32397c;_0x4ad8d5[_0x9763('0x88')]=_0x32397c[_0x9763('0x85')];_0x4ad8d5[_0x9763('0x89')]=_0x32397c[_0x9763('0x86')];_0x4ad8d5[_0x9763('0x88')]=_['orderBy'](_0x4ad8d5[_0x9763('0x88')],[_0x9763('0x8a')],[_0x9763('0x8b')]);if(_0x4ad8d5[_0x9763('0x87')][_0x9763('0x85')]){delete _0x4ad8d5['account'][_0x9763('0x85')];}if(_0x4ad8d5[_0x9763('0x87')][_0x9763('0x86')]&&_0x4ad8d5['account'][_0x9763('0x86')]['Contacts'][_0x9763('0x4a')]){return _0x4ad8d5[_0x9763('0x87')][_0x9763('0x86')]['Contacts'][0x0];}var _0x3ea599=_[_0x9763('0x1a')](_0x41c685[_0x9763('0x5e')],{'firstName':_0x41c685[_0x9763('0x5e')]['from'],'ListId':_0x32397c[_0x9763('0x8c')]});_0x3ea599[_0x41c685[_0x9763('0x5e')][_0x9763('0x7d')]]=_0x41c685[_0x9763('0x5e')][_0x9763('0x7f')];return db[_0x9763('0x81')][_0x9763('0x5d')](_0x3ea599,{'fields':_0x5e51f5,'raw':!![]});}})['then'](handleEntityNotFound(_0x3d4dd1,null))['then'](function(_0x5476d3){_0x4ad8d5[_0x9763('0x8d')]=_0x5476d3;if(_0x5476d3){var _0x586db4={'ContactId':_0x5476d3['id'],'OpenchannelAccountId':_0x41c685[_0x9763('0x65')]['id'],'from':(_0x5476d3[_0x9763('0x8e')]||'')+'\x20'+(_0x5476d3[_0x9763('0x8f')]||'')};var _0x171dee={'OpenchannelAccountId':_0x41c685[_0x9763('0x65')]['id'],'closed':![]};if(_0x41c685['body']['threadId']){_0x171dee[_0x9763('0x90')]=_0x41c685['body']['threadId'];return db[_0x9763('0x91')][_0x9763('0x5c')]({'where':_0x171dee})['then'](function(_0xc4b651){if(_0xc4b651){return[_0xc4b651,![]];}_0x586db4[_0x9763('0x90')]=_0x41c685[_0x9763('0x5e')][_0x9763('0x90')];_0x586db4[_0x9763('0x92')]=_0x41c685[_0x9763('0x5e')][_0x9763('0x92')];return db[_0x9763('0x91')][_0x9763('0x5d')](_0x586db4)[_0x9763('0x1f')](function(_0x1a2719){return[_0x1a2719,!![]];});});}else{_0x171dee[_0x9763('0x90')]=null;}_0x171dee[_0x9763('0x93')]=_0x5476d3['id'];return db[_0x9763('0x91')][_0x9763('0x5c')]({'where':_0x171dee})[_0x9763('0x1f')](function(_0x495c22){if(_0x495c22){return[_0x495c22,![]];}return db[_0x9763('0x91')][_0x9763('0x5d')](_0x586db4)[_0x9763('0x1f')](function(_0x1efa35){return[_0x1efa35,!![]];});});}})[_0x9763('0x94')](function(_0x1e2a81,_0x2aeeb3){if(_0x1e2a81){_0x6b975=_0x2aeeb3;if(!_0x2aeeb3){var _0xa9274c={'from':(_0x4ad8d5[_0x9763('0x8d')][_0x9763('0x8e')]||'')+'\x20'+(_0x4ad8d5[_0x9763('0x8d')]['lastName']||'')};if(_0x41c685[_0x9763('0x5e')][_0x9763('0x90')]&&_0x41c685[_0x9763('0x5e')]['messageId']&&_0x41c685['body']['threadId']!=_0x41c685[_0x9763('0x5e')][_0x9763('0x95')]){_0xa9274c['threadId']=_0x41c685[_0x9763('0x5e')][_0x9763('0x95')];}return _0x1e2a81[_0x9763('0x64')](_0xa9274c);}else{return _0x1e2a81;}}})[_0x9763('0x1f')](function(_0x1d693e){_0x4ad8d5[_0x9763('0x96')]=_0x1d693e[_0x9763('0x38')]({'plain':!![]});_0x4ad8d5['interaction'][_0x9763('0x97')]=_0x6b975;if(_0x4ad8d5[_0x9763('0x96')][_0x9763('0x97')]){if(_0x4ad8d5[_0x9763('0x87')]['autoclose']){_0x4ad8d5[_0x9763('0x88')][_0x9763('0x98')]({'id':0x0,'priority':_0x4ad8d5[_0x9763('0x88')][_0x9763('0x4a')]+0x1,'app':_0x9763('0x99'),'appdata':_0x9763('0x9a'),'interval':_0x9763('0x9b')});}}return db['OpenchannelMessage'][_0x9763('0x5d')]({'body':_0x41c685[_0x9763('0x5e')][_0x9763('0x5e')],'OpenchannelAccountId':_0x41c685[_0x9763('0x65')]['id'],'OpenchannelInteractionId':_0x1d693e['id'],'direction':'in','ContactId':_0x4ad8d5[_0x9763('0x8d')]['id'],'AttachmentId':_0x41c685[_0x9763('0x5e')]['AttachmentId']});})[_0x9763('0x1f')](function(_0x5897cd){_0x4ad8d5[_0x9763('0x28')]=_0x5897cd;if(_0x4ad8d5[_0x9763('0x96')][_0x9763('0x9c')]){return db[_0x9763('0x9d')][_0x9763('0x5c')]({'attributes':['id',_0x9763('0x3c')],'where':{'id':_0x4ad8d5[_0x9763('0x96')][_0x9763('0x9c')]}})[_0x9763('0x1f')](function(_0x2a37aa){if(_0x2a37aa){_0x4ad8d5[_0x9763('0x88')][_0x9763('0x9e')]({'id':0x0,'priority':0x0,'app':_0x9763('0x9f'),'appdata':_0x2a37aa[_0x9763('0x3c')]+','+(_0x4ad8d5[_0x9763('0x87')][_0x9763('0xa0')]||0xa),'interval':_0x9763('0x9b')});_0x4ad8d5[_0x9763('0xa1')]=![];}return respondWithRpcPromise(_0x9763('0xa2'),_0x9763('0xa3'),_0x4ad8d5);});}return respondWithRpcPromise(_0x9763('0xa2'),_0x9763('0xa3'),_0x4ad8d5);})['then'](function(_0x293649){respondWithRpcPromise(_0x9763('0xa4'),_0x9763('0xa4'),{'event':'notify','message':_0x293649},client9002);return _0x293649;})['then'](respondWithResult(_0x3d4dd1,null))[_0x9763('0x2a')](handleError(_0x3d4dd1,null));};exports['addApplications']=function(_0x2d3512,_0x5efc3f,_0x364fa5){return db[_0x9763('0x58')]['findOne']({'where':{'id':_0x2d3512[_0x9763('0x65')]['id']}})['then'](handleEntityNotFound(_0x5efc3f,null))['then'](function(_0x58cf81){if(_0x58cf81){return db[_0x9763('0xa5')][_0x9763('0xa6')](function(_0x2a756){return db[_0x9763('0x84')][_0x9763('0x37')]({'where':{'OpenchannelAccountId':_0x2d3512[_0x9763('0x65')]['id']},'transaction':_0x2a756})[_0x9763('0x1f')](function(_0x174da3){var _0x326617=_[_0x9763('0x41')](_0x2d3512[_0x9763('0x5e')],function(_0xbd5e74){_0xbd5e74[_0x9763('0x6b')]=_0x2d3512[_0x9763('0x65')]['id'];return _0xbd5e74;});return db[_0x9763('0x84')][_0x9763('0xa7')](_0x326617,{'transaction':_0x2a756});});})[_0x9763('0x1f')](function(){return db[_0x9763('0x84')][_0x9763('0xa8')]({'where':{'OpenchannelAccountId':_0x2d3512[_0x9763('0x65')]['id']},'order':_0x9763('0x8a')});});}})[_0x9763('0x1f')](respondWithResult(_0x5efc3f,null))[_0x9763('0x2a')](handleError(_0x5efc3f,null));};exports['getApplications']=function(_0x3f7c7e,_0x42d627,_0x21889e){var _0x24939d={};var _0x323334={};var _0x31e900;var _0x1ff54e;return db['OpenchannelAccount'][_0x9763('0x6a')]({'where':{'id':_0x3f7c7e[_0x9763('0x65')]['id']}})['then'](handleEntityNotFound(_0x42d627,null))[_0x9763('0x1f')](function(_0x298e2a){if(_0x298e2a){_0x31e900=_0x298e2a;_0x323334[_0x9763('0x46')]=_[_0x9763('0x45')](db[_0x9763('0x84')][_0x9763('0x42')]);_0x323334[_0x9763('0x44')]=_[_0x9763('0x45')](_0x3f7c7e[_0x9763('0x44')]);_0x323334[_0x9763('0x50')]=_['intersection'](_0x323334['model'],_0x323334[_0x9763('0x44')]);_0x24939d['attributes']=_[_0x9763('0x48')](_0x323334['model'],qs['fields'](_0x3f7c7e[_0x9763('0x44')][_0x9763('0x49')]));_0x24939d[_0x9763('0x47')]=_0x24939d[_0x9763('0x47')]['length']?_0x24939d[_0x9763('0x47')]:_0x323334[_0x9763('0x46')];_0x24939d[_0x9763('0x4d')]=qs[_0x9763('0x4e')](_0x3f7c7e[_0x9763('0x44')]['sort']);_0x24939d[_0x9763('0x4f')]=qs['filters'](_[_0x9763('0x51')](_0x3f7c7e[_0x9763('0x44')],_0x323334[_0x9763('0x50')]));if(_0x3f7c7e['query']['filter']){_0x24939d[_0x9763('0x4f')]=_['merge'](_0x24939d[_0x9763('0x4f')],{'$or':_[_0x9763('0x41')](_0x24939d[_0x9763('0x47')],function(_0x4869c9){var _0x34ebf7={};_0x34ebf7[_0x4869c9]={'$like':'%'+_0x3f7c7e[_0x9763('0x44')]['filter']+'%'};return _0x34ebf7;})});}_0x24939d=_[_0x9763('0x53')]({},_0x24939d,_0x3f7c7e['options']);return _0x31e900[_0x9763('0xa9')](_0x24939d);}})[_0x9763('0x1f')](function(_0x2aa1bb){if(_0x2aa1bb){_0x1ff54e=_0x2aa1bb[_0x9763('0x4a')];if(!_0x3f7c7e[_0x9763('0x44')][_0x9763('0x4b')](_0x9763('0x4c'))){_0x24939d[_0x9763('0x2f')]=qs[_0x9763('0x2f')](_0x3f7c7e['query'][_0x9763('0x2f')]);_0x24939d[_0x9763('0x32')]=qs[_0x9763('0x32')](_0x3f7c7e[_0x9763('0x44')]['offset']);}return _0x31e900[_0x9763('0xa9')](_0x24939d);}})[_0x9763('0x1f')](function(_0x11e31d){if(_0x11e31d){return _0x11e31d?{'count':_0x1ff54e,'rows':_0x11e31d}:null;}})[_0x9763('0x1f')](respondWithResult(_0x42d627,null))[_0x9763('0x2a')](handleError(_0x42d627,null));};exports[_0x9763('0xaa')]=function(_0x419674,_0x542c88,_0x1b872c){var _0x27677f={'raw':![],'where':{}};var _0x215fc6={};var _0x438057={'count':0x0,'rows':[]};return db[_0x9763('0x58')][_0x9763('0x6a')]({'where':{'id':_0x419674[_0x9763('0x65')]['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0x542c88,null))[_0x9763('0x1f')](function(_0x211e9d){if(_0x211e9d){_0x215fc6['model']=_[_0x9763('0x45')](db[_0x9763('0x91')][_0x9763('0x42')]);_0x215fc6[_0x9763('0x44')]=_[_0x9763('0x45')](_0x419674[_0x9763('0x44')]);_0x215fc6[_0x9763('0x50')]=_[_0x9763('0x48')](_0x215fc6[_0x9763('0x46')],_0x215fc6[_0x9763('0x44')]);_0x27677f[_0x9763('0x47')]=_[_0x9763('0x48')](_0x215fc6['model'],qs[_0x9763('0x49')](_0x419674[_0x9763('0x44')][_0x9763('0x49')]));_0x27677f[_0x9763('0x47')]=_0x27677f[_0x9763('0x47')]['length']?_0x27677f[_0x9763('0x47')]:_0x215fc6[_0x9763('0x46')];if(!_0x419674[_0x9763('0x44')][_0x9763('0x4b')]('nolimit')){_0x27677f[_0x9763('0x2f')]=qs[_0x9763('0x2f')](_0x419674['query'][_0x9763('0x2f')]);_0x27677f[_0x9763('0x32')]=qs[_0x9763('0x32')](_0x419674[_0x9763('0x44')][_0x9763('0x32')]);}_0x27677f[_0x9763('0x4d')]=qs[_0x9763('0x4e')](_0x419674[_0x9763('0x44')][_0x9763('0x4e')]);_0x27677f[_0x9763('0x4f')]=qs[_0x9763('0x50')](_['pick'](_0x419674[_0x9763('0x44')],_0x215fc6[_0x9763('0x50')]));_0x27677f['where']['OpenchannelAccountId']=_0x211e9d['id'];if(_0x419674[_0x9763('0x44')][_0x9763('0x52')]){_0x27677f[_0x9763('0x4f')]=_[_0x9763('0x53')](_0x27677f[_0x9763('0x4f')],{'$or':_[_0x9763('0x41')](_0x27677f[_0x9763('0x47')],function(_0x4daf37){var _0x3136e1={};_0x3136e1[_0x4daf37]={'$like':'%'+_0x419674['query'][_0x9763('0x52')]+'%'};return _0x3136e1;})});}_0x27677f=_[_0x9763('0x53')]({},_0x27677f,_0x419674[_0x9763('0x55')]);return db[_0x9763('0x91')][_0x9763('0x31')]({'where':_0x27677f[_0x9763('0x4f')]})[_0x9763('0x1f')](function(_0x48b8bb){_0x438057['count']=_0x48b8bb;if(_0x419674[_0x9763('0x44')][_0x9763('0x56')]){_0x27677f[_0x9763('0x57')]=[{'model':db[_0x9763('0x81')],'as':_0x9763('0xab'),'required':![]},{'model':db[_0x9763('0x9d')],'as':_0x9763('0xac'),'attributes':[_0x9763('0x3c'),'fullname',_0x9763('0xad')],'required':![]},{'model':db[_0x9763('0xae')],'as':_0x9763('0xaf'),'attributes':['id',_0x9763('0x3c'),_0x9763('0xb0')],'where':_0x419674[_0x9763('0x44')][_0x9763('0xb1')]?{'id':_0x419674['query']['tag']}:undefined,'required':_0x419674[_0x9763('0x44')][_0x9763('0xb1')]?!![]:![]}];}return db[_0x9763('0x91')][_0x9763('0x59')](_0x27677f);})['then'](function(_0x1f5082){_0x438057['rows']=_0x1f5082;return _0x438057;});}})[_0x9763('0x1f')](respondWithFilteredResult(_0x542c88,_0x27677f))[_0x9763('0x2a')](handleError(_0x542c88,null));};exports[_0x9763('0xb2')]=function(_0x3af06e,_0xd583f5,_0x49694a){return db[_0x9763('0x58')]['find']({'where':{'id':_0x3af06e[_0x9763('0x65')]['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0xd583f5,null))[_0x9763('0x1f')](function(_0xbf5d47){if(_0xbf5d47){return _0xbf5d47['addAgents'](_0x3af06e['body'][_0x9763('0x6d')],_[_0x9763('0xb3')](_0x3af06e[_0x9763('0x5e')],['ids','id'])||{})['spread'](function(_0x168c3f){for(var _0xb086cd=0x0;_0xb086cd<_0x3af06e[_0x9763('0x5e')][_0x9763('0x6d')][_0x9763('0x4a')];_0xb086cd+=0x1){socket['emit'](_0x9763('0xb4'),{'UserId':Number(_0x3af06e[_0x9763('0x5e')][_0x9763('0x6d')][_0xb086cd]),'OpenchannelAccountId':Number(_0x3af06e['params']['id'])});}return _0x168c3f;});}})[_0x9763('0x1f')](respondWithResult(_0xd583f5,null))[_0x9763('0x2a')](handleError(_0xd583f5,null));};exports[_0x9763('0xb5')]=function(_0x38f41b,_0x4919dd,_0x16105b){return db[_0x9763('0x58')][_0x9763('0x5c')]({'where':{'id':_0x38f41b[_0x9763('0x65')]['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0x4919dd,null))[_0x9763('0x1f')](function(_0xe5884e){if(_0xe5884e){return _0xe5884e[_0x9763('0xb5')](_0x38f41b['query'][_0x9763('0x6d')])[_0x9763('0x1f')](function(){if(_[_0x9763('0xb6')](_0x38f41b[_0x9763('0x44')][_0x9763('0x6d')])){for(var _0x260f55=0x0;_0x260f55<_0x38f41b[_0x9763('0x44')]['ids']['length'];_0x260f55+=0x1){socket[_0x9763('0xb7')](_0x9763('0xb8'),{'UserId':Number(_0x38f41b[_0x9763('0x44')][_0x9763('0x6d')][_0x260f55]),'OpenchannelAccountId':Number(_0x38f41b['params']['id'])});}}else{socket[_0x9763('0xb7')](_0x9763('0xb8'),{'UserId':Number(_0x38f41b['query']['ids']),'OpenchannelAccountId':Number(_0x38f41b[_0x9763('0x65')]['id'])});}});}})[_0x9763('0x1f')](respondWithStatusCode(_0x4919dd,null))['catch'](handleError(_0x4919dd,null));};exports['getAgents']=function(_0x40ebe6,_0x46afd8,_0x27b8a0){var _0x10adda={};var _0x1ee94f={};var _0x647721;var _0x5843ba;return db[_0x9763('0x58')]['findOne']({'where':{'id':_0x40ebe6[_0x9763('0x65')]['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0x46afd8,null))[_0x9763('0x1f')](function(_0xc951d9){if(_0xc951d9){_0x647721=_0xc951d9;_0x1ee94f[_0x9763('0x46')]=_['keys'](db['User'][_0x9763('0x42')]);_0x1ee94f[_0x9763('0x44')]=_[_0x9763('0x45')](_0x40ebe6[_0x9763('0x44')]);_0x1ee94f[_0x9763('0x50')]=_[_0x9763('0x48')](_0x1ee94f[_0x9763('0x46')],_0x1ee94f['query']);_0x10adda[_0x9763('0x47')]=_[_0x9763('0x48')](_0x1ee94f[_0x9763('0x46')],qs[_0x9763('0x49')](_0x40ebe6[_0x9763('0x44')][_0x9763('0x49')]));_0x10adda[_0x9763('0x47')]=_0x10adda['attributes'][_0x9763('0x4a')]?_0x10adda['attributes']:_0x1ee94f[_0x9763('0x46')];_0x10adda[_0x9763('0x4d')]=qs[_0x9763('0x4e')](_0x40ebe6['query'][_0x9763('0x4e')]);_0x10adda[_0x9763('0x4f')]=qs[_0x9763('0x50')](_['pick'](_0x40ebe6[_0x9763('0x44')],_0x1ee94f[_0x9763('0x50')]));if(_0x40ebe6[_0x9763('0x44')]['filter']){_0x10adda[_0x9763('0x4f')]=_[_0x9763('0x53')](_0x10adda[_0x9763('0x4f')],{'$or':_[_0x9763('0x41')](_0x10adda[_0x9763('0x47')],function(_0x44d878){var _0x6c352c={};_0x6c352c[_0x44d878]={'$like':'%'+_0x40ebe6[_0x9763('0x44')][_0x9763('0x52')]+'%'};return _0x6c352c;})});}_0x10adda=_[_0x9763('0x53')]({},_0x10adda,_0x40ebe6['options']);return _0x647721['getAgents'](_0x10adda);}})[_0x9763('0x1f')](function(_0x4eee08){if(_0x4eee08){_0x5843ba=_0x4eee08[_0x9763('0x4a')];if(!_0x40ebe6['query'][_0x9763('0x4b')](_0x9763('0x4c'))){_0x10adda['limit']=qs['limit'](_0x40ebe6[_0x9763('0x44')][_0x9763('0x2f')]);_0x10adda[_0x9763('0x32')]=qs['offset'](_0x40ebe6['query'][_0x9763('0x32')]);}return _0x647721[_0x9763('0xb9')](_0x10adda);}})[_0x9763('0x1f')](function(_0xce5e8c){if(_0xce5e8c){return _0xce5e8c?{'count':_0x5843ba,'rows':_0xce5e8c}:null;}})[_0x9763('0x1f')](respondWithResult(_0x46afd8,null))[_0x9763('0x2a')](handleError(_0x46afd8,null));};exports[_0x9763('0x3d')]=function(_0x20eee0,_0x1169f5,_0x2eed4d){var _0x226cde,_0x1e5b3d,_0x1f971c;if(_[_0x9763('0x7c')](_0x20eee0['body'][_0x9763('0x5e')])||_0x20eee0[_0x9763('0x5e')][_0x9763('0x5e')]===''){throw new db[(_0x9763('0x74'))][(_0x9763('0x75'))](_0x9763('0xba'));}if(_[_0x9763('0x7c')](_0x20eee0[_0x9763('0x5e')]['to'])){}_0x226cde=_0x20eee0[_0x9763('0x5e')]['to'];return db[_0x9763('0x58')][_0x9763('0x6a')]({'where':{'id':_0x20eee0[_0x9763('0x65')]['id']}})[_0x9763('0x1f')](handleEntityNotFound(_0x1169f5,null))[_0x9763('0x1f')](function(_0x3ce9bd){if(_0x3ce9bd){return db[_0x9763('0x58')][_0x9763('0x5c')]({'where':{'id':_0x3ce9bd['id']},'include':[{'model':db[_0x9763('0x80')],'as':_0x9763('0x86'),'include':[{'model':db[_0x9763('0x81')],'as':_0x9763('0x82'),'where':{[_0x3ce9bd[_0x9763('0x7d')]]:_0x226cde},'limit':0x1,'order':[[_0x9763('0x79'),_0x9763('0x83')]]}]}]})[_0x9763('0x1f')](handleEntityNotFound(_0x1169f5,null))[_0x9763('0x1f')](function(_0x106b71){if(_0x106b71&&_0x106b71[_0x9763('0x86')]){_0x1e5b3d=_0x106b71[_0x9763('0x38')]({'plain':!![]});if(_0x1e5b3d[_0x9763('0x86')]&&_0x1e5b3d[_0x9763('0x86')][_0x9763('0x82')][_0x9763('0x4a')]){return _0x1e5b3d['List']['Contacts'][0x0];}return db[_0x9763('0x81')][_0x9763('0x5d')](_['defaults'](_0x20eee0[_0x9763('0x5e')],{'firstName':_0x226cde,[_0x106b71[_0x9763('0x7d')]]:_0x226cde,'phone':_0x226cde,'ListId':_0x1e5b3d[_0x9763('0x8c')]}));}})['then'](handleEntityNotFound(_0x1169f5,null))[_0x9763('0x1f')](function(_0x10469e){if(_0x10469e){_0x1f971c=_0x10469e;return db[_0x9763('0x91')]['find']({'where':{'ContactId':_0x1f971c['id'],'closed':![],'OpenchannelAccountId':_0x1e5b3d['id']}})[_0x9763('0x1f')](function(_0x57e973){if(_0x57e973){return[_0x57e973,![]];}return db[_0x9763('0x91')][_0x9763('0x5d')]({'UserId':_0x20eee0['user']['id'],'ContactId':_0x1f971c['id'],'OpenchannelAccountId':_0x1e5b3d['id'],'lastMsgDirection':_0x9763('0xbb'),'Messages':[_['merge'](_0x20eee0[_0x9763('0x5e')],{'read':![],'body':_0x20eee0[_0x9763('0x5e')][_0x9763('0x5e')],'OpenchannelAccountId':_0x1e5b3d['id'],'UserId':_0x20eee0[_0x9763('0x5f')]['id'],'ContactId':_0x1f971c['id']})]},{'include':[{'model':db[_0x9763('0xbc')],'as':_0x9763('0xbd')}]})['then'](function(_0x11df77){return[_0x11df77,!![]];});});}})[_0x9763('0x94')](function(_0x318ca3,_0x55ec3e){if(_0x55ec3e){return _0x318ca3;}return db['OpenchannelMessage'][_0x9763('0x5d')](_[_0x9763('0x53')](_0x20eee0[_0x9763('0x5e')],{'read':![],'body':_0x20eee0[_0x9763('0x5e')][_0x9763('0x5e')],'OpenchannelAccountId':_0x1e5b3d['id'],'OpenchannelInteractionId':_0x318ca3['id'],'UserId':_0x20eee0[_0x9763('0x5f')]['id'],'ContactId':_0x1f971c['id']}))[_0x9763('0x1f')](function(_0x103576){_0x318ca3['dataValues'][_0x9763('0xbd')]=[];_0x318ca3[_0x9763('0xbe')][_0x9763('0xbd')]['push'](_0x103576[_0x9763('0xbe')]);return _0x318ca3;});});}})[_0x9763('0x1f')](respondWithResult(_0x1169f5,null))[_0x9763('0x2a')](handleError(_0x1169f5,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index add6e63..306b455 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 _0x9bde=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x2a4b5f,_0x30978b){var _0x16fc41=function(_0x4e5daa){while(--_0x4e5daa){_0x2a4b5f['push'](_0x2a4b5f['shift']());}};_0x16fc41(++_0x30978b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5b7fa4,_0x859011){_0x5b7fa4=_0x5b7fa4-0x0;var _0x3c7209=_0x9bde[_0x5b7fa4];return _0x3c7209;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xe9bd('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe9bd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9bd('0x2'),'afterDestroy':_0xe9bd('0x3')};function emitEvent(_0x131f6a){return function(_0x1c1b34,_0x10822d,_0x1a4d14){OpenchannelAccountEvents[_0xe9bd('0x4')](_0x131f6a+':'+_0x1c1b34['id'],_0x1c1b34);OpenchannelAccountEvents['emit'](_0x131f6a,_0x1c1b34);_0x1a4d14(null);};}for(var e in events){if(events[_0xe9bd('0x5')](e)){var event=events[e];OpenchannelAccount[_0xe9bd('0x6')](e,emitEvent(event));}}module[_0xe9bd('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb58b=['exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x21dfe5,_0x1c4265){var _0x51a41e=function(_0x3fc444){while(--_0x3fc444){_0x21dfe5['push'](_0x21dfe5['shift']());}};_0x51a41e(++_0x1c4265);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4cad04,_0x4787a1){_0x4cad04=_0x4cad04-0x0;var _0xbb7b5d=_0xb58b[_0x4cad04];return _0xbb7b5d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xbb58('0x0'))['db'][_0xbb58('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb58('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb58('0x3'),'afterDestroy':_0xbb58('0x4')};function emitEvent(_0x5c9ec5){return function(_0x226363,_0x546510,_0x2edb10){OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5+':'+_0x226363['id'],_0x226363);OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5,_0x226363);_0x2edb10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xbb58('0x6')](e,emitEvent(event));}}module[_0xbb58('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 918898e..49ea162 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(_0x16caec,_0xf13b23){var _0x5489b3=function(_0x5a8b86){while(--_0x5a8b86){_0x16caec['push'](_0x16caec['shift']());}};_0x5489b3(++_0xf13b23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x468933,_0x30188f){var _0x4f968c=function(_0x41e698){while(--_0x41e698){_0x468933['push'](_0x468933['shift']());}};_0x4f968c(++_0x30188f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 a05dfda..f7144d3 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 _0xa5fa=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x58a975,_0x4f7451){_0x58a975=_0x58a975-0x0;var _0x47f055=_0xa5fa[_0x58a975];return _0x47f055;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});config[_0xaa5f('0xb')]=_[_0xaa5f('0xc')](config[_0xaa5f('0xb')],{'host':_0xaa5f('0xd'),'port':0x18eb});var socket=require(_0xaa5f('0xe'))(new Redis(config[_0xaa5f('0xb')]));require('./openchannelAccount.socket')[_0xaa5f('0xf')](socket);function respondWithRpcPromise(_0x227ebb,_0x4d3d16,_0x538865){return new BPromise(function(_0x3fa93f,_0x4bb69d){return client['request'](_0x227ebb,_0x538865)[_0xaa5f('0x10')](function(_0x4d24d2){logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));logger[_0xaa5f('0x14')](_0xaa5f('0x15'),_0x4d3d16,'request\x20sent',JSON[_0xaa5f('0x16')](_0x4d24d2));if(_0x4d24d2['error']){if(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x18')]===0x1f4){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')]['message']);return _0x4bb69d(_0x4d24d2['error'][_0xaa5f('0x19')]);}logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);return _0x3fa93f(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);}else{logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));_0x3fa93f(_0x4d24d2[_0xaa5f('0x1a')][_0xaa5f('0x19')]);}})['catch'](function(_0x1c072){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x1c072);_0x4bb69d(_0x1c072);});});} \ No newline at end of file +var _0x7be1=['../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x7be1,0x165));var _0x17be=function(_0x3018eb,_0x570c63){_0x3018eb=_0x3018eb-0x0;var _0x23131f=_0x7be1[_0x3018eb];return _0x23131f;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var moment=require(_0x17be('0x2'));var BPromise=require('bluebird');var rs=require(_0x17be('0x3'));var fs=require('fs');var Redis=require(_0x17be('0x4'));var db=require(_0x17be('0x5'))['db'];var utils=require(_0x17be('0x6'));var logger=require(_0x17be('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17be('0x8')][_0x17be('0x9')]({'port':0x232a});config['redis']=_[_0x17be('0xa')](config[_0x17be('0xb')],{'host':_0x17be('0xc'),'port':0x18eb});var socket=require(_0x17be('0xd'))(new Redis(config[_0x17be('0xb')]));require(_0x17be('0xe'))['register'](socket);function respondWithRpcPromise(_0x41e383,_0x589cdb,_0x3d23c3){return new BPromise(function(_0x2c276e,_0x520a49){return client[_0x17be('0xf')](_0x41e383,_0x3d23c3)[_0x17be('0x10')](function(_0x1ee322){logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));logger['debug'](_0x17be('0x13'),_0x589cdb,'request\x20sent',JSON[_0x17be('0x14')](_0x1ee322));if(_0x1ee322[_0x17be('0x15')]){if(_0x1ee322[_0x17be('0x15')][_0x17be('0x16')]===0x1f4){logger[_0x17be('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x1ee322[_0x17be('0x15')]['message']);return _0x520a49(_0x1ee322['error'][_0x17be('0x17')]);}logger['error'](_0x17be('0x18'),_0x589cdb,_0x1ee322['error'][_0x17be('0x17')]);return _0x2c276e(_0x1ee322[_0x17be('0x15')]['message']);}else{logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));_0x2c276e(_0x1ee322['result'][_0x17be('0x17')]);}})[_0x17be('0x19')](function(_0x416f81){logger[_0x17be('0x15')](_0x17be('0x18'),_0x589cdb,_0x416f81);_0x520a49(_0x416f81);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 72825fa..25bb510 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 _0x0f88=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','register','length'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x0f88,0x1d9));var _0x80f8=function(_0x4dd0a7,_0xb4399f){_0x4dd0a7=_0x4dd0a7-0x0;var _0x487e9b=_0x0f88[_0x4dd0a7];return _0x487e9b;};'use strict';var OpenchannelAccountEvents=require(_0x80f8('0x0'));var events=[_0x80f8('0x1'),_0x80f8('0x2'),_0x80f8('0x3')];function createListener(_0x25bcba,_0x236dde){return function(_0x362cbf){_0x236dde[_0x80f8('0x4')](_0x25bcba,_0x362cbf);};}function removeListener(_0x4ede51,_0x1fc7b8){return function(){OpenchannelAccountEvents['removeListener'](_0x4ede51,_0x1fc7b8);};}exports[_0x80f8('0x5')]=function(_0x2ed778){for(var _0x1add64=0x0,_0x18cd5e=events[_0x80f8('0x6')];_0x1add64<_0x18cd5e;_0x1add64++){var _0x279479=events[_0x1add64];var _0x3d6ad3=createListener(_0x80f8('0x7')+_0x279479,_0x2ed778);OpenchannelAccountEvents['on'](_0x279479,_0x3d6ad3);}}; \ No newline at end of file +var _0x78f0=['remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x13c4eb,_0x5d218c){var _0x421546=function(_0x4d2494){while(--_0x4d2494){_0x13c4eb['push'](_0x13c4eb['shift']());}};_0x421546(++_0x5d218c);}(_0x78f0,0x15d));var _0x078f=function(_0x379969,_0x2ac8a3){_0x379969=_0x379969-0x0;var _0x304b57=_0x78f0[_0x379969];return _0x304b57;};'use strict';var OpenchannelAccountEvents=require(_0x078f('0x0'));var events=[_0x078f('0x1'),_0x078f('0x2'),_0x078f('0x3')];function createListener(_0x11b4c1,_0x2bde34){return function(_0x34a715){_0x2bde34[_0x078f('0x4')](_0x11b4c1,_0x34a715);};}function removeListener(_0x5785fd,_0x2f3d53){return function(){OpenchannelAccountEvents[_0x078f('0x5')](_0x5785fd,_0x2f3d53);};}exports[_0x078f('0x6')]=function(_0x7b5bcd){for(var _0x47cbe5=0x0,_0x728cfe=events[_0x078f('0x7')];_0x47cbe5<_0x728cfe;_0x47cbe5++){var _0x4a7db3=events[_0x47cbe5];var _0x2ef013=createListener(_0x078f('0x8')+_0x4a7db3,_0x7b5bcd);OpenchannelAccountEvents['on'](_0x4a7db3,_0x2ef013);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 821ae4b..31a5134 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 _0x14ce=['Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','create','put','delete','multer','util','path','connect-timeout','express'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0x14ce,0xdb));var _0xe14c=function(_0xdb82de,_0xddfb7){_0xdb82de=_0xdb82de-0x0;var _0x3e95fd=_0x14ce[_0xdb82de];return _0x3e95fd;};'use strict';var multer=require(_0xe14c('0x0'));var util=require(_0xe14c('0x1'));var path=require(_0xe14c('0x2'));var timeout=require(_0xe14c('0x3'));var express=require(_0xe14c('0x4'));var router=express[_0xe14c('0x5')]();var fs_extra=require(_0xe14c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe14c('0x7'));var config=require(_0xe14c('0x8'));var controller=require(_0xe14c('0x9'));router[_0xe14c('0xa')]('/',auth[_0xe14c('0xb')](),controller['index']);router[_0xe14c('0xa')](_0xe14c('0xc'),auth[_0xe14c('0xb')](),controller['show']);router['post']('/',auth[_0xe14c('0xb')](),controller[_0xe14c('0xd')]);router[_0xe14c('0xe')](_0xe14c('0xc'),auth[_0xe14c('0xb')](),controller['update']);router[_0xe14c('0xf')](_0xe14c('0xc'),auth[_0xe14c('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb8e8=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy'];(function(_0x55f07b,_0x319461){var _0x4c4171=function(_0x10620c){while(--_0x10620c){_0x55f07b['push'](_0x55f07b['shift']());}};_0x4c4171(++_0x319461);}(_0xb8e8,0x9a));var _0x8b8e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb8e8[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x8b8e('0x0'));var util=require(_0x8b8e('0x1'));var path=require(_0x8b8e('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b8e('0x3'));var router=express[_0x8b8e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b8e('0x5'));var interaction=require(_0x8b8e('0x6'));var config=require('../../config/environment');var controller=require(_0x8b8e('0x7'));router[_0x8b8e('0x8')]('/',auth[_0x8b8e('0x9')](),controller[_0x8b8e('0xa')]);router[_0x8b8e('0x8')](_0x8b8e('0xb'),auth[_0x8b8e('0x9')](),controller[_0x8b8e('0xc')]);router['post']('/',auth[_0x8b8e('0x9')](),controller['create']);router[_0x8b8e('0xd')](_0x8b8e('0xb'),auth[_0x8b8e('0x9')](),controller['update']);router[_0x8b8e('0xe')](_0x8b8e('0xb'),auth[_0x8b8e('0x9')](),controller[_0x8b8e('0xf')]);module[_0x8b8e('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 a23c2fc..c357b14 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 _0xae96=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x297609,_0x29ca69){var _0x3bcd11=function(_0x4f2932){while(--_0x4f2932){_0x297609['push'](_0x297609['shift']());}};_0x3bcd11(++_0x29ca69);}(_0xae96,0x136));var _0x6ae9=function(_0x41f227,_0x202f2b){_0x41f227=_0x41f227-0x0;var _0x4f1b02=_0xae96[_0x41f227];return _0x4f1b02;};'use strict';var Sequelize=require('sequelize');module[_0x6ae9('0x0')]={'priority':{'type':Sequelize[_0x6ae9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6ae9('0x2')],'allowNull':![],'defaultValue':_0x6ae9('0x3')},'appdata':{'type':Sequelize[_0x6ae9('0x4')]()},'description':{'type':Sequelize[_0x6ae9('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6ae9('0x5')}}; \ No newline at end of file +var _0xa621=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x488d85,_0x1c5655){var _0x5dd56c=function(_0xe3d65d){while(--_0xe3d65d){_0x488d85['push'](_0x488d85['shift']());}};_0x5dd56c(++_0x1c5655);}(_0xa621,0x1ab));var _0x1a62=function(_0x59bd0e,_0xf04778){_0x59bd0e=_0x59bd0e-0x0;var _0x5a488b=_0xa621[_0x59bd0e];return _0x5a488b;};'use strict';var Sequelize=require(_0x1a62('0x0'));module[_0x1a62('0x1')]={'priority':{'type':Sequelize[_0x1a62('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1a62('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1a62('0x3')]},'interval':{'type':Sequelize[_0x1a62('0x3')],'defaultValue':_0x1a62('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 5a9b509..4343663 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 _0x0bd6=['catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows'];(function(_0x4ab30e,_0x36b2a2){var _0x3a9f84=function(_0x9ce0d0){while(--_0x9ce0d0){_0x4ab30e['push'](_0x4ab30e['shift']());}};_0x3a9f84(++_0x36b2a2);}(_0x0bd6,0x174));var _0x60bd=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0bd6[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x60bd('0x0'));var rimraf=require(_0x60bd('0x1'));var zipdir=require(_0x60bd('0x2'));var jsonpatch=require(_0x60bd('0x3'));var rp=require(_0x60bd('0x4'));var moment=require('moment');var BPromise=require(_0x60bd('0x5'));var Mustache=require(_0x60bd('0x6'));var util=require(_0x60bd('0x7'));var path=require(_0x60bd('0x8'));var sox=require(_0x60bd('0x9'));var csv=require(_0x60bd('0xa'));var ejs=require(_0x60bd('0xb'));var fs=require('fs');var fs_extra=require(_0x60bd('0xc'));var _=require(_0x60bd('0xd'));var squel=require(_0x60bd('0xe'));var crypto=require(_0x60bd('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x60bd('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x60bd('0x11'));var Redis=require(_0x60bd('0x12'));var authService=require(_0x60bd('0x13'));var qs=require(_0x60bd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60bd('0x15'));var logger=require(_0x60bd('0x16'))(_0x60bd('0x17'));var utils=require('../../config/utils');var config=require(_0x60bd('0x18'));var licenseUtil=require(_0x60bd('0x19'));var db=require(_0x60bd('0x1a'))['db'];function respondWithStatusCode(_0x3f1b66,_0x4cefda){_0x4cefda=_0x4cefda||0xcc;return function(_0x1c14e1){if(_0x1c14e1){return _0x3f1b66['sendStatus'](_0x4cefda);}return _0x3f1b66[_0x60bd('0x1b')](_0x4cefda)['end']();};}function respondWithResult(_0x540e54,_0x526cd3){_0x526cd3=_0x526cd3||0xc8;return function(_0x97675){if(_0x97675){return _0x540e54[_0x60bd('0x1b')](_0x526cd3)[_0x60bd('0x1c')](_0x97675);}};}function respondWithFilteredResult(_0x1a01d3,_0x231e47){return function(_0x5bce7d){if(_0x5bce7d){var _0x19f943=typeof _0x231e47['offset']===_0x60bd('0x1d')&&typeof _0x231e47['limit']===_0x60bd('0x1d');var _0x1333cb=_0x5bce7d[_0x60bd('0x1e')];var _0x47840c=_0x19f943?0x0:_0x231e47[_0x60bd('0x1f')];var _0x51e5e6=_0x19f943?_0x5bce7d['count']:_0x231e47['offset']+_0x231e47[_0x60bd('0x20')];var _0x587d95;if(_0x51e5e6>=_0x1333cb){_0x51e5e6=_0x1333cb;_0x587d95=0xc8;}else{_0x587d95=0xce;}_0x1a01d3[_0x60bd('0x1b')](_0x587d95);return _0x1a01d3[_0x60bd('0x21')](_0x60bd('0x22'),_0x47840c+'-'+_0x51e5e6+'/'+_0x1333cb)[_0x60bd('0x1c')](_0x5bce7d);}return null;};}function patchUpdates(_0xa14355){return function(_0xabbed4){try{jsonpatch['apply'](_0xabbed4,_0xa14355,!![]);}catch(_0x489b8f){return BPromise[_0x60bd('0x23')](_0x489b8f);}return _0xabbed4['save']();};}function saveUpdates(_0x2d61af,_0x54774f){return function(_0x185804){if(_0x185804){return _0x185804[_0x60bd('0x24')](_0x2d61af)[_0x60bd('0x25')](function(_0x350824){return _0x350824;});}return null;};}function removeEntity(_0x529ab9,_0x513d94){return function(_0x950fae){if(_0x950fae){return _0x950fae[_0x60bd('0x26')]()[_0x60bd('0x25')](function(){_0x529ab9[_0x60bd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171673,_0x2bbfdd){return function(_0x3a01ae){if(!_0x3a01ae){_0x171673['sendStatus'](0x194);}return _0x3a01ae;};}function handleError(_0x3a1d49,_0x5f1b9c){_0x5f1b9c=_0x5f1b9c||0x1f4;return function(_0x37ee42){logger['error'](_0x37ee42[_0x60bd('0x27')]);if(_0x37ee42[_0x60bd('0x28')]){delete _0x37ee42[_0x60bd('0x28')];}_0x3a1d49[_0x60bd('0x1b')](_0x5f1b9c)[_0x60bd('0x29')](_0x37ee42);};}exports[_0x60bd('0x2a')]=function(_0x24565,_0x2f5096){var _0x331859={},_0x4a3808={},_0x123a27={'count':0x0,'rows':[]};var _0x29c7bd=_[_0x60bd('0x2b')](db[_0x60bd('0x2c')][_0x60bd('0x2d')],function(_0x1878d4){return{'name':_0x1878d4[_0x60bd('0x2e')],'type':_0x1878d4['type'][_0x60bd('0x2f')]};});_0x4a3808[_0x60bd('0x30')]=_[_0x60bd('0x2b')](_0x29c7bd,_0x60bd('0x28'));_0x4a3808[_0x60bd('0x31')]=_[_0x60bd('0x32')](_0x24565[_0x60bd('0x31')]);_0x4a3808['filters']=_[_0x60bd('0x33')](_0x4a3808['model'],_0x4a3808['query']);_0x331859['attributes']=_[_0x60bd('0x33')](_0x4a3808[_0x60bd('0x30')],qs[_0x60bd('0x34')](_0x24565[_0x60bd('0x31')][_0x60bd('0x34')]));_0x331859['attributes']=_0x331859[_0x60bd('0x35')][_0x60bd('0x36')]?_0x331859[_0x60bd('0x35')]:_0x4a3808[_0x60bd('0x30')];if(!_0x24565[_0x60bd('0x31')]['hasOwnProperty'](_0x60bd('0x37'))){_0x331859[_0x60bd('0x20')]=qs[_0x60bd('0x20')](_0x24565[_0x60bd('0x31')][_0x60bd('0x20')]);_0x331859['offset']=qs[_0x60bd('0x1f')](_0x24565[_0x60bd('0x31')][_0x60bd('0x1f')]);}_0x331859['order']=qs[_0x60bd('0x38')](_0x24565[_0x60bd('0x31')][_0x60bd('0x38')]);_0x331859[_0x60bd('0x39')]=qs[_0x60bd('0x3a')](_[_0x60bd('0x3b')](_0x24565['query'],_0x4a3808[_0x60bd('0x3a')]),_0x29c7bd);if(_0x24565[_0x60bd('0x31')][_0x60bd('0x3c')]){_0x331859['where']=_['merge'](_0x331859['where'],{'$or':_[_0x60bd('0x2b')](_0x29c7bd,function(_0x11423e){if(_0x11423e['type']!==_0x60bd('0x3d')){var _0x26bcef={};_0x26bcef[_0x11423e['name']]={'$like':'%'+_0x24565[_0x60bd('0x31')][_0x60bd('0x3c')]+'%'};return _0x26bcef;}})});}_0x331859=_[_0x60bd('0x3e')]({},_0x331859,_0x24565['options']);var _0x5053d7={'where':_0x331859[_0x60bd('0x39')]};return db['OpenchannelApplication'][_0x60bd('0x1e')](_0x5053d7)[_0x60bd('0x25')](function(_0x1ec466){_0x123a27[_0x60bd('0x1e')]=_0x1ec466;if(_0x24565[_0x60bd('0x31')]['includeAll']){_0x331859[_0x60bd('0x3f')]=[{'all':!![]}];}return db[_0x60bd('0x2c')][_0x60bd('0x40')](_0x331859);})[_0x60bd('0x25')](function(_0x70cdf9){_0x123a27[_0x60bd('0x41')]=_0x70cdf9;return _0x123a27;})[_0x60bd('0x25')](respondWithFilteredResult(_0x2f5096,_0x331859))[_0x60bd('0x42')](handleError(_0x2f5096,null));};exports[_0x60bd('0x43')]=function(_0x38f884,_0x485147){var _0x45b565={'raw':!![],'where':{'id':_0x38f884[_0x60bd('0x44')]['id']}},_0x258236={};_0x258236[_0x60bd('0x30')]=_['keys'](db[_0x60bd('0x2c')][_0x60bd('0x2d')]);_0x258236[_0x60bd('0x31')]=_[_0x60bd('0x32')](_0x38f884['query']);_0x258236[_0x60bd('0x3a')]=_[_0x60bd('0x33')](_0x258236[_0x60bd('0x30')],_0x258236[_0x60bd('0x31')]);_0x45b565[_0x60bd('0x35')]=_[_0x60bd('0x33')](_0x258236['model'],qs['fields'](_0x38f884[_0x60bd('0x31')][_0x60bd('0x34')]));_0x45b565[_0x60bd('0x35')]=_0x45b565[_0x60bd('0x35')]['length']?_0x45b565[_0x60bd('0x35')]:_0x258236['model'];if(_0x38f884['query']['includeAll']){_0x45b565[_0x60bd('0x3f')]=[{'all':!![]}];}_0x45b565=_['merge']({},_0x45b565,_0x38f884[_0x60bd('0x45')]);return db[_0x60bd('0x2c')]['find'](_0x45b565)[_0x60bd('0x25')](handleEntityNotFound(_0x485147,null))[_0x60bd('0x25')](respondWithResult(_0x485147,null))[_0x60bd('0x42')](handleError(_0x485147,null));};exports['create']=function(_0xc13c0,_0x5642b3){return db[_0x60bd('0x2c')][_0x60bd('0x46')](_0xc13c0[_0x60bd('0x47')],{})[_0x60bd('0x25')](respondWithResult(_0x5642b3,0xc9))[_0x60bd('0x42')](handleError(_0x5642b3,null));};exports[_0x60bd('0x24')]=function(_0x26b77a,_0x235695){if(_0x26b77a[_0x60bd('0x47')]['id']){delete _0x26b77a[_0x60bd('0x47')]['id'];}return db[_0x60bd('0x2c')][_0x60bd('0x48')]({'where':{'id':_0x26b77a[_0x60bd('0x44')]['id']}})['then'](handleEntityNotFound(_0x235695,null))[_0x60bd('0x25')](saveUpdates(_0x26b77a['body'],null))[_0x60bd('0x25')](respondWithResult(_0x235695,null))['catch'](handleError(_0x235695,null));};exports['destroy']=function(_0x3d0292,_0x52b7c1){return db[_0x60bd('0x2c')]['find']({'where':{'id':_0x3d0292[_0x60bd('0x44')]['id']}})[_0x60bd('0x25')](handleEntityNotFound(_0x52b7c1,null))['then'](removeEntity(_0x52b7c1,null))[_0x60bd('0x42')](handleError(_0x52b7c1,null));}; \ No newline at end of file +var _0x18a2=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','status','end','sendStatus','stack','name','send','index','map','OpenchannelApplication','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x18a2,0x158));var _0x218a=function(_0x53ff33,_0x461b30){_0x53ff33=_0x53ff33-0x0;var _0x448098=_0x18a2[_0x53ff33];return _0x448098;};'use strict';var emlformat=require(_0x218a('0x0'));var rimraf=require(_0x218a('0x1'));var zipdir=require(_0x218a('0x2'));var jsonpatch=require(_0x218a('0x3'));var rp=require(_0x218a('0x4'));var moment=require('moment');var BPromise=require(_0x218a('0x5'));var Mustache=require('mustache');var util=require(_0x218a('0x6'));var path=require(_0x218a('0x7'));var sox=require(_0x218a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x218a('0x9'));var _=require(_0x218a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x218a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x218a('0xc'));var Papa=require(_0x218a('0xd'));var Redis=require(_0x218a('0xe'));var authService=require(_0x218a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x218a('0x10'));var hardwareService=require(_0x218a('0x11'));var logger=require(_0x218a('0x12'))(_0x218a('0x13'));var utils=require('../../config/utils');var config=require(_0x218a('0x14'));var licenseUtil=require(_0x218a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b0666,_0x902de7){_0x902de7=_0x902de7||0xcc;return function(_0x26cd38){if(_0x26cd38){return _0x5b0666['sendStatus'](_0x902de7);}return _0x5b0666['status'](_0x902de7)['end']();};}function respondWithResult(_0x49a30e,_0x4ecdd6){_0x4ecdd6=_0x4ecdd6||0xc8;return function(_0x13b1c8){if(_0x13b1c8){return _0x49a30e['status'](_0x4ecdd6)[_0x218a('0x16')](_0x13b1c8);}};}function respondWithFilteredResult(_0x53ea7c,_0x1719af){return function(_0x268907){if(_0x268907){var _0x223bd1=typeof _0x1719af[_0x218a('0x17')]===_0x218a('0x18')&&typeof _0x1719af[_0x218a('0x19')]==='undefined';var _0x3f03eb=_0x268907['count'];var _0x2300a3=_0x223bd1?0x0:_0x1719af[_0x218a('0x17')];var _0x421ff2=_0x223bd1?_0x268907[_0x218a('0x1a')]:_0x1719af[_0x218a('0x17')]+_0x1719af['limit'];var _0x42b47a;if(_0x421ff2>=_0x3f03eb){_0x421ff2=_0x3f03eb;_0x42b47a=0xc8;}else{_0x42b47a=0xce;}_0x53ea7c['status'](_0x42b47a);return _0x53ea7c[_0x218a('0x1b')]('Content-Range',_0x2300a3+'-'+_0x421ff2+'/'+_0x3f03eb)['json'](_0x268907);}return null;};}function patchUpdates(_0x35bbf1){return function(_0x217e06){try{jsonpatch[_0x218a('0x1c')](_0x217e06,_0x35bbf1,!![]);}catch(_0x1a0b4e){return BPromise['reject'](_0x1a0b4e);}return _0x217e06[_0x218a('0x1d')]();};}function saveUpdates(_0x396f5c,_0xd699f0){return function(_0x2ff9b3){if(_0x2ff9b3){return _0x2ff9b3[_0x218a('0x1e')](_0x396f5c)[_0x218a('0x1f')](function(_0x633fff){return _0x633fff;});}return null;};}function removeEntity(_0x1e7587,_0xde9652){return function(_0x204d45){if(_0x204d45){return _0x204d45[_0x218a('0x20')]()['then'](function(){_0x1e7587[_0x218a('0x21')](0xcc)[_0x218a('0x22')]();});}};}function handleEntityNotFound(_0x14cc24,_0x12bed6){return function(_0x2da657){if(!_0x2da657){_0x14cc24[_0x218a('0x23')](0x194);}return _0x2da657;};}function handleError(_0x5cf3ec,_0x1389e7){_0x1389e7=_0x1389e7||0x1f4;return function(_0x36b645){logger['error'](_0x36b645[_0x218a('0x24')]);if(_0x36b645[_0x218a('0x25')]){delete _0x36b645[_0x218a('0x25')];}_0x5cf3ec[_0x218a('0x21')](_0x1389e7)[_0x218a('0x26')](_0x36b645);};}exports[_0x218a('0x27')]=function(_0x5685a0,_0x320b5e){var _0x5bf27c={},_0x7d48a3={},_0x3fa2b5={'count':0x0,'rows':[]};var _0x4ed61a=_[_0x218a('0x28')](db[_0x218a('0x29')]['rawAttributes'],function(_0x3f65b5){return{'name':_0x3f65b5['fieldName'],'type':_0x3f65b5[_0x218a('0x2a')][_0x218a('0x2b')]};});_0x7d48a3[_0x218a('0x2c')]=_['map'](_0x4ed61a,'name');_0x7d48a3[_0x218a('0x2d')]=_[_0x218a('0x2e')](_0x5685a0[_0x218a('0x2d')]);_0x7d48a3['filters']=_[_0x218a('0x2f')](_0x7d48a3[_0x218a('0x2c')],_0x7d48a3[_0x218a('0x2d')]);_0x5bf27c[_0x218a('0x30')]=_[_0x218a('0x2f')](_0x7d48a3['model'],qs[_0x218a('0x31')](_0x5685a0[_0x218a('0x2d')][_0x218a('0x31')]));_0x5bf27c['attributes']=_0x5bf27c[_0x218a('0x30')][_0x218a('0x32')]?_0x5bf27c[_0x218a('0x30')]:_0x7d48a3['model'];if(!_0x5685a0['query'][_0x218a('0x33')](_0x218a('0x34'))){_0x5bf27c[_0x218a('0x19')]=qs[_0x218a('0x19')](_0x5685a0[_0x218a('0x2d')]['limit']);_0x5bf27c[_0x218a('0x17')]=qs[_0x218a('0x17')](_0x5685a0['query'][_0x218a('0x17')]);}_0x5bf27c['order']=qs[_0x218a('0x35')](_0x5685a0[_0x218a('0x2d')]['sort']);_0x5bf27c[_0x218a('0x36')]=qs['filters'](_[_0x218a('0x37')](_0x5685a0['query'],_0x7d48a3[_0x218a('0x38')]),_0x4ed61a);if(_0x5685a0['query']['filter']){_0x5bf27c[_0x218a('0x36')]=_[_0x218a('0x39')](_0x5bf27c[_0x218a('0x36')],{'$or':_['map'](_0x4ed61a,function(_0x2a4544){if(_0x2a4544[_0x218a('0x2a')]!==_0x218a('0x3a')){var _0x38672b={};_0x38672b[_0x2a4544[_0x218a('0x25')]]={'$like':'%'+_0x5685a0[_0x218a('0x2d')][_0x218a('0x3b')]+'%'};return _0x38672b;}})});}_0x5bf27c=_['merge']({},_0x5bf27c,_0x5685a0[_0x218a('0x3c')]);var _0x3c7fd0={'where':_0x5bf27c[_0x218a('0x36')]};return db['OpenchannelApplication']['count'](_0x3c7fd0)[_0x218a('0x1f')](function(_0xb784ab){_0x3fa2b5[_0x218a('0x1a')]=_0xb784ab;if(_0x5685a0[_0x218a('0x2d')]['includeAll']){_0x5bf27c['include']=[{'all':!![]}];}return db[_0x218a('0x29')][_0x218a('0x3d')](_0x5bf27c);})[_0x218a('0x1f')](function(_0x1cf401){_0x3fa2b5[_0x218a('0x3e')]=_0x1cf401;return _0x3fa2b5;})[_0x218a('0x1f')](respondWithFilteredResult(_0x320b5e,_0x5bf27c))[_0x218a('0x3f')](handleError(_0x320b5e,null));};exports[_0x218a('0x40')]=function(_0x129e16,_0x49a483){var _0x4aa426={'raw':!![],'where':{'id':_0x129e16[_0x218a('0x41')]['id']}},_0x107b8a={};_0x107b8a[_0x218a('0x2c')]=_[_0x218a('0x2e')](db['OpenchannelApplication'][_0x218a('0x42')]);_0x107b8a[_0x218a('0x2d')]=_[_0x218a('0x2e')](_0x129e16[_0x218a('0x2d')]);_0x107b8a[_0x218a('0x38')]=_[_0x218a('0x2f')](_0x107b8a['model'],_0x107b8a[_0x218a('0x2d')]);_0x4aa426[_0x218a('0x30')]=_[_0x218a('0x2f')](_0x107b8a[_0x218a('0x2c')],qs[_0x218a('0x31')](_0x129e16[_0x218a('0x2d')][_0x218a('0x31')]));_0x4aa426['attributes']=_0x4aa426['attributes'][_0x218a('0x32')]?_0x4aa426[_0x218a('0x30')]:_0x107b8a[_0x218a('0x2c')];if(_0x129e16[_0x218a('0x2d')][_0x218a('0x43')]){_0x4aa426[_0x218a('0x44')]=[{'all':!![]}];}_0x4aa426=_['merge']({},_0x4aa426,_0x129e16[_0x218a('0x3c')]);return db[_0x218a('0x29')][_0x218a('0x45')](_0x4aa426)[_0x218a('0x1f')](handleEntityNotFound(_0x49a483,null))['then'](respondWithResult(_0x49a483,null))['catch'](handleError(_0x49a483,null));};exports[_0x218a('0x46')]=function(_0x1c25d7,_0x42c561){return db[_0x218a('0x29')][_0x218a('0x46')](_0x1c25d7['body'],{})[_0x218a('0x1f')](respondWithResult(_0x42c561,0xc9))[_0x218a('0x3f')](handleError(_0x42c561,null));};exports[_0x218a('0x1e')]=function(_0x33cc03,_0x1f7d23){if(_0x33cc03[_0x218a('0x47')]['id']){delete _0x33cc03[_0x218a('0x47')]['id'];}return db[_0x218a('0x29')][_0x218a('0x45')]({'where':{'id':_0x33cc03[_0x218a('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f7d23,null))[_0x218a('0x1f')](saveUpdates(_0x33cc03[_0x218a('0x47')],null))[_0x218a('0x1f')](respondWithResult(_0x1f7d23,null))['catch'](handleError(_0x1f7d23,null));};exports[_0x218a('0x20')]=function(_0xf512ef,_0x97cde1){return db[_0x218a('0x29')][_0x218a('0x45')]({'where':{'id':_0xf512ef[_0x218a('0x41')]['id']}})['then'](handleEntityNotFound(_0x97cde1,null))[_0x218a('0x1f')](removeEntity(_0x97cde1,null))[_0x218a('0x3f')](handleError(_0x97cde1,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 677526f..8e26603 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 _0xa8d2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x32aa4b,_0x4dd5f8){var _0xe115e0=function(_0x271196){while(--_0x271196){_0x32aa4b['push'](_0x32aa4b['shift']());}};_0xe115e0(++_0x4dd5f8);}(_0xa8d2,0x1a2));var _0x2a8d=function(_0x300591,_0x590ac9){_0x300591=_0x300591-0x0;var _0x3573ea=_0xa8d2[_0x300591];return _0x3573ea;};'use strict';var _=require(_0x2a8d('0x0'));var util=require(_0x2a8d('0x1'));var logger=require(_0x2a8d('0x2'))(_0x2a8d('0x3'));var moment=require(_0x2a8d('0x4'));var BPromise=require(_0x2a8d('0x5'));var rp=require(_0x2a8d('0x6'));var fs=require('fs');var path=require(_0x2a8d('0x7'));var rimraf=require(_0x2a8d('0x8'));var config=require(_0x2a8d('0x9'));var attributes=require(_0x2a8d('0xa'));module[_0x2a8d('0xb')]=function(_0x2a6fbd,_0x23fd15){return _0x2a6fbd['define']('OpenchannelApplication',attributes,{'tableName':_0x2a8d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2a8d('0xd')});}; \ No newline at end of file +var _0x2755=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x2829ee,_0x3c88ef){var _0x22a8ef=function(_0x3a0e60){while(--_0x3a0e60){_0x2829ee['push'](_0x2829ee['shift']());}};_0x22a8ef(++_0x3c88ef);}(_0x2755,0xb5));var _0x5275=function(_0x2260df,_0x219c5c){_0x2260df=_0x2260df-0x0;var _0x8f9320=_0x2755[_0x2260df];return _0x8f9320;};'use strict';var _=require('lodash');var util=require(_0x5275('0x0'));var logger=require(_0x5275('0x1'))(_0x5275('0x2'));var moment=require(_0x5275('0x3'));var BPromise=require(_0x5275('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5275('0x5'));var rimraf=require(_0x5275('0x6'));var config=require(_0x5275('0x7'));var attributes=require(_0x5275('0x8'));module['exports']=function(_0x27010a,_0x197fb9){return _0x27010a[_0x5275('0x9')](_0x5275('0xa'),attributes,{'tableName':_0x5275('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5275('0xc'),'collate':_0x5275('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 80b954d..60a2da5 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 _0x0e5d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateOpenchannelApplication','options','raw','where','attributes','limit','catch','lodash','util','moment'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0x0e5d,0x129));var _0xd0e5=function(_0x513adb,_0x6b44a0){_0x513adb=_0x513adb-0x0;var _0x1ba5ff=_0x0e5d[_0x513adb];return _0x1ba5ff;};'use strict';var _=require(_0xd0e5('0x0'));var util=require(_0xd0e5('0x1'));var moment=require(_0xd0e5('0x2'));var BPromise=require(_0xd0e5('0x3'));var rs=require(_0xd0e5('0x4'));var fs=require('fs');var Redis=require(_0xd0e5('0x5'));var db=require(_0xd0e5('0x6'))['db'];var utils=require(_0xd0e5('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xd0e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd0e5('0x9')][_0xd0e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0182,_0x209b00,_0xdc0e70){return new BPromise(function(_0x54f661,_0x108bf9){return client[_0xd0e5('0xb')](_0x2f0182,_0xdc0e70)[_0xd0e5('0xc')](function(_0x3cfcef){logger[_0xd0e5('0xd')](_0xd0e5('0xe'),_0x209b00,'request\x20sent');logger[_0xd0e5('0xf')](_0xd0e5('0x10'),_0x209b00,_0xd0e5('0x11'),JSON[_0xd0e5('0x12')](_0x3cfcef));if(_0x3cfcef[_0xd0e5('0x13')]){if(_0x3cfcef['error'][_0xd0e5('0x14')]===0x1f4){logger[_0xd0e5('0x13')](_0xd0e5('0xe'),_0x209b00,_0x3cfcef[_0xd0e5('0x13')][_0xd0e5('0x15')]);return _0x108bf9(_0x3cfcef[_0xd0e5('0x13')][_0xd0e5('0x15')]);}logger['error'](_0xd0e5('0xe'),_0x209b00,_0x3cfcef[_0xd0e5('0x13')][_0xd0e5('0x15')]);return _0x54f661(_0x3cfcef['error'][_0xd0e5('0x15')]);}else{logger[_0xd0e5('0xd')](_0xd0e5('0xe'),_0x209b00,_0xd0e5('0x11'));_0x54f661(_0x3cfcef[_0xd0e5('0x16')][_0xd0e5('0x15')]);}})['catch'](function(_0x4b98c8){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x209b00,_0x4b98c8);_0x108bf9(_0x4b98c8);});});}exports[_0xd0e5('0x17')]=function(_0x1ded47){var _0x5755f9=this;return new Promise(function(_0x22a7d1,_0x2dcdcd){return db['OpenchannelApplication']['update'](_0x1ded47['body'],{'raw':_0x1ded47[_0xd0e5('0x18')]?_0x1ded47[_0xd0e5('0x18')][_0xd0e5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ded47[_0xd0e5('0x18')]?_0x1ded47[_0xd0e5('0x18')][_0xd0e5('0x1a')]||null:null,'attributes':_0x1ded47[_0xd0e5('0x18')]?_0x1ded47[_0xd0e5('0x18')][_0xd0e5('0x1b')]||null:null,'limit':_0x1ded47[_0xd0e5('0x18')]?_0x1ded47[_0xd0e5('0x18')][_0xd0e5('0x1c')]||null:null})['then'](function(_0x14f8dd){logger[_0xd0e5('0xd')](_0xd0e5('0x17'),_0x1ded47);logger[_0xd0e5('0xf')](_0xd0e5('0x17'),_0x1ded47,JSON['stringify'](_0x14f8dd));_0x22a7d1(_0x14f8dd);})[_0xd0e5('0x1d')](function(_0x55e767){logger[_0xd0e5('0x13')](_0xd0e5('0x17'),_0x55e767[_0xd0e5('0x15')],_0x1ded47);_0x2dcdcd(_0x5755f9[_0xd0e5('0x13')](0x1f4,_0x55e767[_0xd0e5('0x15')]));});});}; \ No newline at end of file +var _0xcfbd=['message','request\x20sent','catch','UpdateOpenchannelApplication','body','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x4a046e,_0xfe96d2){var _0x17b271=function(_0x3d9130){while(--_0x3d9130){_0x4a046e['push'](_0x4a046e['shift']());}};_0x17b271(++_0xfe96d2);}(_0xcfbd,0x13d));var _0xdcfb=function(_0xbfc531,_0x4bc1a6){_0xbfc531=_0xbfc531-0x0;var _0x44fbed=_0xcfbd[_0xbfc531];return _0x44fbed;};'use strict';var _=require(_0xdcfb('0x0'));var util=require(_0xdcfb('0x1'));var moment=require('moment');var BPromise=require(_0xdcfb('0x2'));var rs=require(_0xdcfb('0x3'));var fs=require('fs');var Redis=require(_0xdcfb('0x4'));var db=require(_0xdcfb('0x5'))['db'];var utils=require(_0xdcfb('0x6'));var logger=require('../../config/logger')(_0xdcfb('0x7'));var config=require(_0xdcfb('0x8'));var jayson=require(_0xdcfb('0x9'));var client=jayson['client'][_0xdcfb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47dff0,_0x4da701,_0x2ca141){return new BPromise(function(_0x609d9,_0x1948ae){return client[_0xdcfb('0xb')](_0x47dff0,_0x2ca141)[_0xdcfb('0xc')](function(_0x269b77){logger[_0xdcfb('0xd')](_0xdcfb('0xe'),_0x4da701,'request\x20sent');logger[_0xdcfb('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x4da701,'request\x20sent',JSON[_0xdcfb('0x10')](_0x269b77));if(_0x269b77['error']){if(_0x269b77[_0xdcfb('0x11')][_0xdcfb('0x12')]===0x1f4){logger['error'](_0xdcfb('0xe'),_0x4da701,_0x269b77[_0xdcfb('0x11')]['message']);return _0x1948ae(_0x269b77[_0xdcfb('0x11')][_0xdcfb('0x13')]);}logger[_0xdcfb('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x4da701,_0x269b77['error'][_0xdcfb('0x13')]);return _0x609d9(_0x269b77[_0xdcfb('0x11')][_0xdcfb('0x13')]);}else{logger['info'](_0xdcfb('0xe'),_0x4da701,_0xdcfb('0x14'));_0x609d9(_0x269b77['result'][_0xdcfb('0x13')]);}})[_0xdcfb('0x15')](function(_0xd214b6){logger[_0xdcfb('0x11')](_0xdcfb('0xe'),_0x4da701,_0xd214b6);_0x1948ae(_0xd214b6);});});}exports[_0xdcfb('0x16')]=function(_0x3828b0){var _0x4cc1f9=this;return new Promise(function(_0x218446,_0x3d0afc){return db['OpenchannelApplication']['update'](_0x3828b0[_0xdcfb('0x17')],{'raw':_0x3828b0[_0xdcfb('0x18')]?_0x3828b0[_0xdcfb('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3828b0[_0xdcfb('0x18')]?_0x3828b0[_0xdcfb('0x18')][_0xdcfb('0x19')]||null:null,'attributes':_0x3828b0['options']?_0x3828b0[_0xdcfb('0x18')][_0xdcfb('0x1a')]||null:null,'limit':_0x3828b0['options']?_0x3828b0[_0xdcfb('0x18')][_0xdcfb('0x1b')]||null:null})[_0xdcfb('0xc')](function(_0x24dcd9){logger['info'](_0xdcfb('0x16'),_0x3828b0);logger['debug'](_0xdcfb('0x16'),_0x3828b0,JSON[_0xdcfb('0x10')](_0x24dcd9));_0x218446(_0x24dcd9);})[_0xdcfb('0x15')](function(_0x190bdd){logger[_0xdcfb('0x11')]('UpdateOpenchannelApplication',_0x190bdd[_0xdcfb('0x13')],_0x3828b0);_0x3d0afc(_0x4cc1f9['error'](0x1f4,_0x190bdd[_0xdcfb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b6f50b0..8874892 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 _0x6386=['../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x500d7f,_0x4924c2){var _0x2b9a8a=function(_0x453295){while(--_0x453295){_0x500d7f['push'](_0x500d7f['shift']());}};_0x2b9a8a(++_0x4924c2);}(_0x6386,0x130));var _0x6638=function(_0x368258,_0x5e4251){_0x368258=_0x368258-0x0;var _0x5e4857=_0x6386[_0x368258];return _0x5e4857;};'use strict';var multer=require('multer');var util=require(_0x6638('0x0'));var path=require(_0x6638('0x1'));var timeout=require(_0x6638('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6638('0x3'));var auth=require(_0x6638('0x4'));var interaction=require(_0x6638('0x5'));var config=require(_0x6638('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6638('0x7')]);router[_0x6638('0x8')](_0x6638('0x9'),auth[_0x6638('0xa')](),controller[_0x6638('0xb')]);router[_0x6638('0x8')](_0x6638('0xc'),auth['isAuthenticated'](),controller[_0x6638('0xd')]);router[_0x6638('0x8')](_0x6638('0xe'),auth[_0x6638('0xa')](),controller[_0x6638('0xf')]);router[_0x6638('0x8')](_0x6638('0x10'),auth['isAuthenticated'](),controller[_0x6638('0x11')]);router['post']('/',auth[_0x6638('0xa')](),controller[_0x6638('0x12')]);router[_0x6638('0x13')](_0x6638('0xe'),auth[_0x6638('0xa')](),controller['addMessage']);router[_0x6638('0x13')](_0x6638('0x14'),auth[_0x6638('0xa')](),interaction[_0x6638('0x15')](_0x6638('0x16'),_0x6638('0x17')),controller[_0x6638('0x18')]);router[_0x6638('0x19')](_0x6638('0xc'),auth['isAuthenticated'](),interaction[_0x6638('0x15')](_0x6638('0x16'),_0x6638('0x1a')),controller['update']);router[_0x6638('0x1b')]('/:id',auth[_0x6638('0xa')](),interaction[_0x6638('0x15')](_0x6638('0x16'),_0x6638('0x1c')),controller[_0x6638('0x1d')]);router[_0x6638('0x1b')]('/:id/tags',auth[_0x6638('0xa')](),controller[_0x6638('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x3100=['/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','put','openchannel','update','openchannelinteraction:destroy','destroy','delete','/:id/tags','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x3100,0x1b4));var _0x0310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3100[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x0310('0x0'));var path=require(_0x0310('0x1'));var timeout=require(_0x0310('0x2'));var express=require('express');var router=express[_0x0310('0x3')]();var fs_extra=require(_0x0310('0x4'));var auth=require(_0x0310('0x5'));var interaction=require(_0x0310('0x6'));var config=require(_0x0310('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0310('0x8')]);router[_0x0310('0x9')](_0x0310('0xa'),auth[_0x0310('0xb')](),controller['describe']);router[_0x0310('0x9')](_0x0310('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0310('0x9')](_0x0310('0xd'),auth[_0x0310('0xb')](),controller[_0x0310('0xe')]);router[_0x0310('0x9')](_0x0310('0xf'),auth[_0x0310('0xb')](),controller['download']);router[_0x0310('0x10')]('/',auth[_0x0310('0xb')](),controller[_0x0310('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x0310('0x12')]);router[_0x0310('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x0310('0x13')]('openchannel','openchannelinteraction:addtags'),controller['addTags']);router[_0x0310('0x14')](_0x0310('0xc'),auth[_0x0310('0xb')](),interaction[_0x0310('0x13')](_0x0310('0x15'),'openchannelinteraction:update'),controller[_0x0310('0x16')]);router['delete'](_0x0310('0xc'),auth[_0x0310('0xb')](),interaction['tracked'](_0x0310('0x15'),_0x0310('0x17')),controller[_0x0310('0x18')]);router[_0x0310('0x19')](_0x0310('0x1a'),auth['isAuthenticated'](),controller['removeTags']);module[_0x0310('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4f90784..32691a2 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 _0x6726=['BOOLEAN','STRING','DATE','ENUM','exports'];(function(_0x41ff2b,_0x25fbf9){var _0xd53b52=function(_0x3f2f2c){while(--_0x3f2f2c){_0x41ff2b['push'](_0x41ff2b['shift']());}};_0xd53b52(++_0x25fbf9);}(_0x6726,0xdb));var _0x6672=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x6726[_0x16ea87];return _0x6e7b1c;};'use strict';var Sequelize=require('sequelize');module[_0x6672('0x0')]={'closed':{'type':Sequelize[_0x6672('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6672('0x2')]},'secondDisposition':{'type':Sequelize[_0x6672('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6672('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x6672('0x2')]},'externalUrl':{'type':Sequelize[_0x6672('0x2')]},'lastMsgAt':{'type':Sequelize[_0x6672('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6672('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6672('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x6672('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x5900=['exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x5900,0xd2));var _0x0590=function(_0xf845cc,_0x7bce78){_0xf845cc=_0xf845cc-0x0;var _0x24da94=_0x5900[_0xf845cc];return _0x24da94;};'use strict';var Sequelize=require('sequelize');module[_0x0590('0x0')]={'closed':{'type':Sequelize[_0x0590('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0590('0x2')]},'secondDisposition':{'type':Sequelize[_0x0590('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0590('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0590('0x3')]},'threadId':{'type':Sequelize[_0x0590('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x0590('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0590('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0590('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x0590('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 23bb941..dedb77b 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 _0x3400=['to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','Tags','TagIds','forEach','push','catch','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','field','color','tools_tags','select','u.fullname','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','text','keys','some','compact','OpenchannelAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','i.*','c.firstName','c.lastName','c.email','Contact.phone','c.mobile','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','show','params','includeAll','include','options','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filter','format','findAll','setTags','emit','removeTags','download','unix','root','files','tmp','join','server','attachments','Contact','lastName','Attachment','Messages','createdAt','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','createReadStream','pipe','createWriteStream','basename','direction','out','System','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x2fdf04,_0x5d921c){var _0x21a69b=function(_0x541c75){while(--_0x541c75){_0x2fdf04['push'](_0x2fdf04['shift']());}};_0x21a69b(++_0x5d921c);}(_0x3400,0xe5));var _0x0340=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x3400[_0x166742];return _0xb7814a;};'use strict';var emlformat=require(_0x0340('0x0'));var rimraf=require(_0x0340('0x1'));var zipdir=require(_0x0340('0x2'));var jsonpatch=require(_0x0340('0x3'));var rp=require(_0x0340('0x4'));var moment=require(_0x0340('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0340('0x6'));var util=require(_0x0340('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0340('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0340('0x9'));var squel=require(_0x0340('0xa'));var crypto=require(_0x0340('0xb'));var jsforce=require(_0x0340('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0340('0x8'));var querystring=require(_0x0340('0xd'));var Papa=require(_0x0340('0xe'));var Redis=require(_0x0340('0xf'));var authService=require(_0x0340('0x10'));var qs=require(_0x0340('0x11'));var as=require(_0x0340('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x0340('0x13'));var logger=require(_0x0340('0x14'))(_0x0340('0x15'));var utils=require('../../config/utils');var config=require(_0x0340('0x16'));var licenseUtil=require(_0x0340('0x17'));var db=require(_0x0340('0x18'))['db'];config['redis']=_['defaults'](config[_0x0340('0x19')],{'host':_0x0340('0x1a'),'port':0x18eb});var socket=require(_0x0340('0x1b'))(new Redis(config[_0x0340('0x19')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5bfa25,_0x18eab9){_0x18eab9=_0x18eab9||0xcc;return function(_0x422b49){if(_0x422b49){return _0x5bfa25['sendStatus'](_0x18eab9);}return _0x5bfa25[_0x0340('0x1c')](_0x18eab9)[_0x0340('0x1d')]();};}function respondWithResult(_0x3b090f,_0x5e5368){_0x5e5368=_0x5e5368||0xc8;return function(_0x289797){if(_0x289797){return _0x3b090f['status'](_0x5e5368)['json'](_0x289797);}};}function respondWithFilteredResult(_0x9704eb,_0x427ca0){return function(_0x3bda5e){if(_0x3bda5e){var _0x18f434=typeof _0x427ca0[_0x0340('0x1e')]==='undefined'&&typeof _0x427ca0[_0x0340('0x1f')]===_0x0340('0x20');var _0x98c9c=_0x3bda5e[_0x0340('0x21')];var _0x3fcd22=_0x18f434?0x0:_0x427ca0[_0x0340('0x1e')];var _0x239516=_0x18f434?_0x3bda5e[_0x0340('0x21')]:_0x427ca0[_0x0340('0x1e')]+_0x427ca0[_0x0340('0x1f')];var _0x407f61;if(_0x239516>=_0x98c9c){_0x239516=_0x98c9c;_0x407f61=0xc8;}else{_0x407f61=0xce;}_0x9704eb['status'](_0x407f61);return _0x9704eb[_0x0340('0x22')](_0x0340('0x23'),_0x3fcd22+'-'+_0x239516+'/'+_0x98c9c)[_0x0340('0x24')](_0x3bda5e);}return null;};}function patchUpdates(_0x2fed31){return function(_0x5d316a){try{jsonpatch['apply'](_0x5d316a,_0x2fed31,!![]);}catch(_0x4a4d2d){return BPromise[_0x0340('0x25')](_0x4a4d2d);}return _0x5d316a[_0x0340('0x26')]();};}function saveUpdates(_0x50c683,_0x2e01b1){return function(_0x3e72b5){if(_0x3e72b5){return _0x3e72b5[_0x0340('0x27')](_0x50c683)[_0x0340('0x28')](function(_0x3fe9a6){return _0x3fe9a6;});}return null;};}function removeEntity(_0xa80183,_0x5ac712){return function(_0x19a8e9){if(_0x19a8e9){return _0x19a8e9[_0x0340('0x29')]()['then'](function(){_0xa80183[_0x0340('0x1c')](0xcc)[_0x0340('0x1d')]();});}};}function handleEntityNotFound(_0x55008a,_0xb09734){return function(_0x29e98e){if(!_0x29e98e){_0x55008a[_0x0340('0x2a')](0x194);}return _0x29e98e;};}function handleError(_0x55138b,_0x107254){_0x107254=_0x107254||0x1f4;return function(_0x54b941){logger[_0x0340('0x2b')](_0x54b941[_0x0340('0x2c')]);if(_0x54b941[_0x0340('0x2d')]){delete _0x54b941[_0x0340('0x2d')];}_0x55138b[_0x0340('0x1c')](_0x107254)[_0x0340('0x2e')](_0x54b941);};}function getInteractionUsers(_0x33449,_0x353c5e){return new BPromise(function(_0x3dd5cf,_0x243786){try{if(_0x353c5e[_0x33449['id']]){_0x33449[_0x0340('0x2f')]=_[_0x0340('0x30')](_0x353c5e[_0x33449['id']],function(_0xe40f2f){return{'id':_0xe40f2f['id'],'fullname':_0xe40f2f[_0x0340('0x31')]};});}}catch(_0x3bceb6){_0x243786(_0x3bceb6);}_0x3dd5cf(_0x33449);});}function getInteractionTags(_0x1e74d6,_0x3bbaa7){return new BPromise(function(_0x1e5724,_0x4705ad){try{if(_0x1e74d6['TagIds']){_0x1e74d6[_0x0340('0x32')]=[];_0x1e74d6[_0x0340('0x33')]['split'](',')[_0x0340('0x34')](function(_0x5a90de){_0x1e74d6['Tags'][_0x0340('0x35')](_0x3bbaa7[_0x5a90de]);});}delete _0x1e74d6[_0x0340('0x33')];}catch(_0x303df4){_0x4705ad(_0x303df4);}_0x1e5724(_0x1e74d6);});}function updateOpenchannelInteraction(_0x1eefab,_0x111b74,_0x337878){return new BPromise(function(_0x93ea67,_0x1e753f){return getInteractionUsers(_0x1eefab,_0x337878)['then'](function(_0x11a00f){return getInteractionTags(_0x11a00f,_0x111b74);})['then'](function(_0x179bf6){_0x93ea67(_0x179bf6);})[_0x0340('0x36')](function(_0x4c5ce5){_0x1e753f(_0x4c5ce5);});});}exports['index']=function(_0x171ccb,_0x45e48b){var _0x50ae4b={},_0x27489f={},_0x1f7fb8={'count':0x0,'rows':[]};var _0x16a877=_[_0x0340('0x30')](db[_0x0340('0x37')][_0x0340('0x38')],function(_0x16e09d){return{'name':_0x16e09d[_0x0340('0x39')],'type':_0x16e09d[_0x0340('0x3a')][_0x0340('0x3b')]};});_0x27489f[_0x0340('0x3c')]=_['map'](_0x16a877,_0x0340('0x2d'));_0x27489f[_0x0340('0x3d')]=_['keys'](_0x171ccb[_0x0340('0x3d')]);_0x27489f[_0x0340('0x3e')]=_[_0x0340('0x3f')](_0x27489f[_0x0340('0x3c')],_0x27489f['query']);_0x50ae4b['attributes']=_[_0x0340('0x3f')](_0x27489f[_0x0340('0x3c')],qs[_0x0340('0x40')](_0x171ccb[_0x0340('0x3d')][_0x0340('0x40')]));_0x50ae4b['attributes']=_0x50ae4b[_0x0340('0x41')]['length']?_0x50ae4b[_0x0340('0x41')]:_0x27489f[_0x0340('0x3c')];if(!_0x171ccb[_0x0340('0x3d')][_0x0340('0x42')](_0x0340('0x43'))){_0x50ae4b[_0x0340('0x1f')]=qs[_0x0340('0x1f')](_0x171ccb[_0x0340('0x3d')][_0x0340('0x1f')]);_0x50ae4b[_0x0340('0x1e')]=qs[_0x0340('0x1e')](_0x171ccb[_0x0340('0x3d')]['offset']);}_0x50ae4b[_0x0340('0x44')]=qs['sort'](_0x171ccb[_0x0340('0x3d')][_0x0340('0x45')]);_0x50ae4b[_0x0340('0x46')]=qs['filters'](_[_0x0340('0x47')](_0x171ccb[_0x0340('0x3d')],_0x27489f[_0x0340('0x3e')]),_0x16a877);var _0x290f16=[];var _0x1969ce=squel['select']()['field']('id')[_0x0340('0x48')](_0x0340('0x2d'))[_0x0340('0x48')](_0x0340('0x49'))['from'](_0x0340('0x4a'));var _0x5f1ebd=squel[_0x0340('0x4b')]()[_0x0340('0x48')]('u.id')[_0x0340('0x48')](_0x0340('0x4c'))[_0x0340('0x48')]('ui.OpenchannelInteractionId')[_0x0340('0x4d')](_0x0340('0x4e'),'ui')[_0x0340('0x4f')](_0x0340('0x50'),'u',_0x0340('0x51'));var _0x4fc761=squel[_0x0340('0x4b')]()[_0x0340('0x4d')]('openchannel_interactions','i')['left_join'](_0x0340('0x52'),'c',_0x0340('0x53'))[_0x0340('0x4f')]('users','o',_0x0340('0x54'))['left_join'](_0x0340('0x55'),'a',_0x0340('0x56'))[_0x0340('0x4f')]('openchannel_messages','me',_0x0340('0x57'))[_0x0340('0x4f')]('openchannel_interaction_has_tags','it',_0x0340('0x58'))[_0x0340('0x4f')]('tools_tags','t',_0x0340('0x59'));var _0x49b14a=squel[_0x0340('0x5a')]();var _0x1bb575=[];var _0x280dbe=squel[_0x0340('0x5a')]();var _0xaa2584;if(_0x171ccb[_0x0340('0x3d')][_0x0340('0x5b')]){_0xaa2584=as[_0x0340('0x5c')](_0x171ccb['query'][_0x0340('0x5b')]);var _0x53c0bd=_0xaa2584['sqlOperator'];for(var _0x5d1ae1=0x0;_0x5d1ae1<_0xaa2584[_0x0340('0x5d')][_0x0340('0x5e')];_0x5d1ae1++){var _0x45c59f=_0xaa2584[_0x0340('0x5d')][_0x5d1ae1];var _0x2b66f6='i';var _0x296689=_[_0x0340('0x5f')](_0x16a877,[_0x0340('0x2d'),_0x45c59f['field']]);if(!_0x296689){switch(_0x45c59f[_0x0340('0x48')]){case _0x0340('0x60'):if(_0x45c59f[_0x0340('0x61')]==0x1){_0x4fc761[_0x0340('0x62')]('`'+_0x45c59f[_0x0340('0x48')]+_0x0340('0x63'));}else{_0x4fc761[_0x0340('0x62')]('`'+_0x45c59f['field']+_0x0340('0x64'));}break;case'Contact':if(_0x45c59f[_0x0340('0x65')]===_0x0340('0x66')){if(_0x45c59f[_0x0340('0x61')]['split']('\x20')[_0x0340('0x5e')]>0x1){_0x49b14a[_0x53c0bd](_0x0340('0x67'),qs[_0x0340('0x68')](_0x45c59f[_0x0340('0x61')]),null);}else{var _0x598d4b='%'+_0x45c59f[_0x0340('0x61')]+'%';_0x49b14a[_0x53c0bd](_0x0340('0x69'),_0x598d4b,_0x598d4b,_0x598d4b);}}else{_0x296689=_['find'](_0x16a877,[_0x0340('0x2d'),_0x0340('0x6a')]);_0x45c59f[_0x0340('0x48')]=_0x0340('0x6a');_0x2b52f8=as['buildExpression'](_0x2b66f6,_0x296689[_0x0340('0x3a')],_0x45c59f);_0x49b14a[_0x53c0bd](_0x2b52f8['text'],_0x2b52f8['value'][_0x0340('0x6b')],_0x2b52f8['value']['end']);}break;case _0x0340('0x6c'):var _0x5453a3=_0x45c59f['value'][_0x0340('0x6d')](',')[_0x0340('0x30')](function(_0x4ad6f0){return Number(_0x4ad6f0);});_0x5453a3[_0x0340('0x34')](function(_0x5e3f51){_0x280dbe['or'](_0x0340('0x6e'),'%,'+_0x5e3f51+',%');});_0x1bb575=_[_0x0340('0x6f')](_0x1bb575,_0x5453a3);break;case _0x0340('0x70'):if(_0x45c59f[_0x0340('0x65')]===_0x0340('0x66')){_0x49b14a[_0x53c0bd]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x45c59f['value']+'%',null);}else{_0x296689=_['find'](_0x16a877,[_0x0340('0x2d'),_0x0340('0x71')]);_0x45c59f['field']=_0x0340('0x71');_0x2b52f8=as[_0x0340('0x72')](_0x2b66f6,_0x296689['type'],_0x45c59f);_0x49b14a[_0x53c0bd](_0x2b52f8[_0x0340('0x73')],_0x2b52f8['value'][_0x0340('0x6b')],_0x2b52f8[_0x0340('0x61')]['end']);}break;case'body':_0x2b52f8=as[_0x0340('0x72')]('me',null,_0x45c59f);_0x49b14a[_0x53c0bd](_0x2b52f8[_0x0340('0x73')],_0x2b52f8[_0x0340('0x61')]['start'],_0x2b52f8['value'][_0x0340('0x1d')]);break;}}else{var _0x2b52f8=as['buildExpression'](_0x2b66f6,_0x296689[_0x0340('0x3a')],_0x45c59f);_0x49b14a[_0x53c0bd](_0x2b52f8[_0x0340('0x73')],_0x2b52f8[_0x0340('0x61')]['start'],_0x2b52f8[_0x0340('0x61')][_0x0340('0x1d')]);}}}else{var _0xd92dc9=_(_0x171ccb['query'])[_0x0340('0x74')]()['map'](function(_0x16b619){return _[_0x0340('0x75')](_0x16a877,['name',_0x16b619])?_0x16b619:undefined;})[_0x0340('0x76')]()['value']();if(!_['isEmpty'](_0xd92dc9)){_0xd92dc9[_0x0340('0x34')](function(_0x2d6d6a){if(_0x2d6d6a===_0x0340('0x77')){_0x4fc761['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x0340('0x78')](_0x171ccb['query'][_0x2d6d6a]));}else if(_0x2d6d6a==='createdAt'){var _0x55d0d3=JSON[_0x0340('0x79')](_0x171ccb['query'][_0x2d6d6a])[_0x0340('0x7a')];var _0x1ac419=JSON[_0x0340('0x79')](_0x171ccb[_0x0340('0x3d')][_0x2d6d6a])[_0x0340('0x7b')];_0x4fc761[_0x0340('0x46')](_0x0340('0x7c'),_0x55d0d3,_0x1ac419);}else{if(_0x171ccb[_0x0340('0x3d')][_0x2d6d6a]==='null'){_0x4fc761['where']('i.'+_0x2d6d6a+_0x0340('0x7d'));}else{_0x4fc761[_0x0340('0x46')]('i.'+_0x2d6d6a+_0x0340('0x7e'),_0x171ccb[_0x0340('0x3d')][_0x2d6d6a]);}}});}if(_0x171ccb[_0x0340('0x3d')][_0x0340('0x7f')]){if(_0x171ccb[_0x0340('0x3d')][_0x0340('0x7f')]==0x1){_0x4fc761[_0x0340('0x62')](_0x0340('0x80'));}else{_0x4fc761[_0x0340('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x171ccb[_0x0340('0x3d')][_0x0340('0x81')]){_0x1bb575=_[_0x0340('0x82')](_0x171ccb[_0x0340('0x3d')]['tag'])?_0x171ccb[_0x0340('0x3d')][_0x0340('0x81')]:new Array(_0x171ccb['query'][_0x0340('0x81')]);_0x1bb575['forEach'](function(_0x2a8007){_0x280dbe['or'](_0x0340('0x6e'),'%,'+_0x2a8007+',%');});}if(_0x171ccb['query']['filter']){var _0x4dcdfe=_0x171ccb['query']['filter'][_0x0340('0x83')]('\x5c','\x5c\x5c')[_0x0340('0x83')](/'/g,'\x27\x27');if(qs[_0x0340('0x84')](_0x4dcdfe)){_0x49b14a['or']('i.id\x20LIKE\x20?',_0x4dcdfe+'%');}else{_0x49b14a['or'](_0x0340('0x85'),qs[_0x0340('0x68')](_0x4dcdfe))['or'](_0x0340('0x86'),_0x4dcdfe+'%')['or'](_0x0340('0x87'),_0x4dcdfe+'%');}}}_0x4fc761[_0x0340('0x46')](_0x49b14a);_0x4fc761[_0x0340('0x88')](_0x0340('0x89'));var _0x30131f={'type':db[_0x0340('0x8a')][_0x0340('0x8b')][_0x0340('0x8c')],'raw':!![]};var _0x5961db=_0x4fc761[_0x0340('0x8d')]();_0x5961db[_0x0340('0x48')]('i.id');_0x5961db['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x50ae4b['order']){_0x50ae4b[_0x0340('0x44')][_0x0340('0x34')](function(_0x1f02bd){var _0x3d5e92=_0x1f02bd[0x0]===_0x0340('0x8e')?_0x1f02bd[0x0]:'i.'+_0x1f02bd[0x0];_0x4fc761['order'](_0x3d5e92,_0x1f02bd[0x1]===_0x0340('0x8f')?![]:!![]);});}if(!_[_0x0340('0x90')](_0x1bb575)){_0x4fc761[_0x0340('0x62')](_0x280dbe);_0x5961db[_0x0340('0x46')](_0x0340('0x91'),_0x1bb575);}BPromise[_0x0340('0x92')]()['then'](function(){if(!_0xaa2584){if(_0x171ccb[_0x0340('0x3d')][_0x0340('0x77')])return;_0x5961db['where'](_0x0340('0x93'));_0x4fc761[_0x0340('0x46')](_0x0340('0x93'));return;}if(_0x171ccb[_0x0340('0x94')][_0x0340('0x95')]!==_0x0340('0x96'))return;return _0x171ccb[_0x0340('0x94')][_0x0340('0x97')]({'attributes':['id'],'raw':!![]})[_0x0340('0x28')](function(_0x3f3da8){if(_[_0x0340('0x90')](_0x3f3da8)){_0x5961db[_0x0340('0x46')](_0x0340('0x98'));_0x4fc761['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x5961db[_0x0340('0x46')](_0x0340('0x99'),_[_0x0340('0x30')](_0x3f3da8,'id'));_0x4fc761[_0x0340('0x46')](_0x0340('0x99'),_[_0x0340('0x30')](_0x3f3da8,'id'));}});})[_0x0340('0x28')](function(){if(_0x171ccb['user']['role']===_0x0340('0x96')&&!_0xaa2584&&!_0x171ccb['query'][_0x0340('0x77')])return[];return db[_0x0340('0x9a')][_0x0340('0x3d')](_0x5961db[_0x0340('0x9b')](),_0x30131f);})[_0x0340('0x28')](function(_0x2b238e){_0x1f7fb8['count']=_0x2b238e[_0x0340('0x5e')];if(_0x1f7fb8['count']===0x0)return[];return db['sequelize']['query'](_0x1969ce[_0x0340('0x9b')](),_0x30131f)['then'](function(_0xea1d14){_0x290f16=_[_0x0340('0x9c')](_0xea1d14,'id');_0x30131f=_[_0x0340('0x9d')](_0x30131f,{'model':db[_0x0340('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x171ccb['query']['fields']){_0x50ae4b['attributes']['forEach'](function(_0x137ea5){_0x4fc761[_0x0340('0x48')]('i.'+_0x137ea5);});}else{_0x4fc761['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0340('0x60'));_0x4fc761[_0x0340('0x48')](_0x0340('0x9e'),_0x0340('0x9f'));_0x4fc761[_0x0340('0x48')](_0x0340('0xa0'),_0x0340('0xa1'));_0x4fc761[_0x0340('0x48')](_0x0340('0xa2'),'contactName');_0x4fc761[_0x0340('0x48')](_0x0340('0xa3'));_0x4fc761[_0x0340('0x48')](_0x0340('0xa4'),'Contact.firstName');_0x4fc761['field'](_0x0340('0xa5'),'Contact.lastName');_0x4fc761['field'](_0x0340('0xa6'),'Contact.email');_0x4fc761[_0x0340('0x48')]('c.phone',_0x0340('0xa7'));_0x4fc761['field'](_0x0340('0xa8'),'Contact.mobile');_0x4fc761[_0x0340('0x48')]('c.fax','Contact.fax');_0x4fc761['field']('o.fullname',_0x0340('0xa9'));_0x4fc761['field']('o.internal',_0x0340('0xaa'));_0x4fc761[_0x0340('0x48')](_0x0340('0xab'),_0x0340('0x33'));}if(_0x50ae4b[_0x0340('0x1f')])_0x4fc761[_0x0340('0x1f')](_0x50ae4b[_0x0340('0x1f')]);if(_0x50ae4b['offset'])_0x4fc761[_0x0340('0x1e')](_0x50ae4b['offset']);return db[_0x0340('0x9a')][_0x0340('0x3d')](_0x4fc761[_0x0340('0x9b')](),_0x30131f);})[_0x0340('0x28')](function(_0x1aca3b){if(_0x1aca3b['length']>0x0)_0x5f1ebd['where'](_0x0340('0xac'),_['map'](_0x1aca3b,'id'));return db[_0x0340('0x9a')][_0x0340('0x3d')](_0x5f1ebd['toString'](),_0x30131f)[_0x0340('0x28')](function(_0x33b02c){var _0x267999=_['groupBy'](_0x33b02c,_0x0340('0xad'));var _0x24e9a6=[];_0x1aca3b['forEach'](function(_0x141418){_0x24e9a6['push'](updateOpenchannelInteraction(_0x141418,_0x290f16,_0x267999));});return BPromise[_0x0340('0xae')](_0x24e9a6);});});})['then'](function(_0x1d7b06){_0x1f7fb8[_0x0340('0xaf')]=_0x1d7b06;return _0x1f7fb8;})[_0x0340('0x28')](respondWithFilteredResult(_0x45e48b,_0x50ae4b))[_0x0340('0x36')](handleError(_0x45e48b,null));};exports[_0x0340('0xb0')]=function(_0x8d0f78,_0xbacf0d){var _0x394173={};if(_0x8d0f78[_0x0340('0x3d')][_0x0340('0x3a')]&&_0x8d0f78['query'][_0x0340('0x3a')]===_0x0340('0x4d')){_0x394173[_0x0340('0x4d')]=_0x8d0f78[_0x0340('0xb1')]['id'];}else{_0x394173['id']=_0x8d0f78[_0x0340('0xb1')]['id'];}var _0x201796={'raw':![],'where':_0x394173},_0x516fb0={};_0x516fb0[_0x0340('0x3c')]=_[_0x0340('0x74')](db[_0x0340('0x37')][_0x0340('0x38')]);_0x516fb0[_0x0340('0x3d')]=_[_0x0340('0x74')](_0x8d0f78['query']);_0x516fb0[_0x0340('0x3e')]=_[_0x0340('0x3f')](_0x516fb0[_0x0340('0x3c')],_0x516fb0[_0x0340('0x3d')]);_0x201796[_0x0340('0x41')]=_[_0x0340('0x3f')](_0x516fb0['model'],qs[_0x0340('0x40')](_0x8d0f78['query'][_0x0340('0x40')]));_0x201796[_0x0340('0x41')]=_0x201796[_0x0340('0x41')][_0x0340('0x5e')]?_0x201796[_0x0340('0x41')]:_0x516fb0['model'];if(_0x8d0f78['query'][_0x0340('0xb2')]){_0x201796[_0x0340('0xb3')]=[{'all':!![]}];}_0x201796=_['merge']({},_0x201796,_0x8d0f78[_0x0340('0xb4')]);return db[_0x0340('0x37')][_0x0340('0x5f')](_0x201796)[_0x0340('0x28')](handleEntityNotFound(_0xbacf0d,null))[_0x0340('0x28')](respondWithResult(_0xbacf0d,null))[_0x0340('0x36')](handleError(_0xbacf0d,null));};exports[_0x0340('0xb5')]=function(_0xf1941b,_0x488609){return db[_0x0340('0x37')]['create'](_0xf1941b['body'],{})[_0x0340('0x28')](respondWithResult(_0x488609,0xc9))[_0x0340('0x36')](handleError(_0x488609,null));};exports[_0x0340('0x27')]=function(_0x12670e,_0x5a0b33){if(_0x12670e[_0x0340('0xb6')]['id']){delete _0x12670e[_0x0340('0xb6')]['id'];}return db[_0x0340('0x37')][_0x0340('0x5f')]({'where':{'id':_0x12670e[_0x0340('0xb1')]['id']}})['then'](handleEntityNotFound(_0x5a0b33,null))[_0x0340('0x28')](saveUpdates(_0x12670e[_0x0340('0xb6')],null))[_0x0340('0x28')](respondWithResult(_0x5a0b33,null))[_0x0340('0x36')](handleError(_0x5a0b33,null));};exports[_0x0340('0x29')]=function(_0x8ce457,_0x247011){return db['OpenchannelInteraction'][_0x0340('0x5f')]({'where':{'id':_0x8ce457[_0x0340('0xb1')]['id']}})['then'](handleEntityNotFound(_0x247011,null))[_0x0340('0x28')](removeEntity(_0x247011,null))[_0x0340('0x36')](handleError(_0x247011,null));};exports[_0x0340('0xb7')]=function(_0x312194,_0x1e6f41){return db[_0x0340('0x37')][_0x0340('0xb7')]()[_0x0340('0x28')](respondWithResult(_0x1e6f41,null))[_0x0340('0x36')](handleError(_0x1e6f41,null));};exports[_0x0340('0xb8')]=function(_0x398ddb,_0x4e611e,_0x54e8ef){return db[_0x0340('0xb9')][_0x0340('0x5f')]({'where':{'id':_0x398ddb[_0x0340('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4e611e,null))[_0x0340('0x28')](function(_0x5b10be){if(_0x5b10be){return _0x5b10be[_0x0340('0xb8')](_0x398ddb[_0x0340('0xb6')][_0x0340('0xba')],_[_0x0340('0xbb')](_0x398ddb['body'],[_0x0340('0xba'),'id'])||{});}})[_0x0340('0x28')](respondWithResult(_0x4e611e,null))['catch'](handleError(_0x4e611e,null));};exports[_0x0340('0xbc')]=function(_0x564483,_0x41af21,_0x2ad067){var _0x3d66dd={'raw':![],'where':{}};var _0x351c6f={};var _0xd42b8={'count':0x0,'rows':[]};return db[_0x0340('0x37')][_0x0340('0xbd')]({'where':{'id':_0x564483['params']['id']}})['then'](handleEntityNotFound(_0x41af21,null))[_0x0340('0x28')](function(_0x50e6b2){if(_0x50e6b2){_0x351c6f[_0x0340('0x3c')]=_[_0x0340('0x74')](db['OpenchannelMessage'][_0x0340('0x38')]);_0x351c6f[_0x0340('0x3d')]=_[_0x0340('0x74')](_0x564483[_0x0340('0x3d')]);_0x351c6f[_0x0340('0x3e')]=_[_0x0340('0x3f')](_0x351c6f[_0x0340('0x3c')],_0x351c6f[_0x0340('0x3d')]);_0x3d66dd[_0x0340('0x41')]=_[_0x0340('0x3f')](_0x351c6f[_0x0340('0x3c')],qs['fields'](_0x564483['query']['fields']));_0x3d66dd[_0x0340('0x41')]=_0x3d66dd[_0x0340('0x41')][_0x0340('0x5e')]?_0x3d66dd[_0x0340('0x41')]:_0x351c6f['model'];if(!_0x564483[_0x0340('0x3d')]['hasOwnProperty'](_0x0340('0x43'))){_0x3d66dd['limit']=qs[_0x0340('0x1f')](_0x564483['query'][_0x0340('0x1f')]);_0x3d66dd[_0x0340('0x1e')]=qs[_0x0340('0x1e')](_0x564483[_0x0340('0x3d')]['offset']);}_0x3d66dd[_0x0340('0x44')]=qs['sort'](_0x564483[_0x0340('0x3d')]['sort']);_0x3d66dd['where']=qs[_0x0340('0x3e')](_[_0x0340('0x47')](_0x564483['query'],_0x351c6f[_0x0340('0x3e')]));_0x3d66dd[_0x0340('0x46')]['OpenchannelInteractionId']=_0x50e6b2['id'];if(_0x564483[_0x0340('0x3d')][_0x0340('0xbe')]){_0x3d66dd[_0x0340('0x46')]=_[_0x0340('0x9d')](_0x3d66dd[_0x0340('0x46')],{'$or':_['map'](_0x3d66dd[_0x0340('0x41')],function(_0x243f4b){var _0x54140d={};_0x54140d[_0x243f4b]={'$like':'%'+_0x564483[_0x0340('0x3d')]['filter']+'%'};return _0x54140d;})});}if(_0x564483[_0x0340('0x3d')][_0x0340('0x7a')]){var _0xf84fac=_0x564483[_0x0340('0x3d')][_0x0340('0x7a')][_0x0340('0x6d')](',');var _0x374e40={};_0x374e40[_0xf84fac[0x0]]={'$gte':moment(_0xf84fac[0x1])[_0x0340('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3d66dd[_0x0340('0x46')]=_[_0x0340('0x9d')](_0x3d66dd['where'],_0x374e40);}_0x3d66dd=_[_0x0340('0x9d')]({},_0x3d66dd,_0x564483[_0x0340('0xb4')]);return db[_0x0340('0xb9')][_0x0340('0x21')]({'where':_0x3d66dd[_0x0340('0x46')]})[_0x0340('0x28')](function(_0x235966){_0xd42b8[_0x0340('0x21')]=_0x235966;if(_0x564483['query'][_0x0340('0xb2')]){_0x3d66dd[_0x0340('0xb3')]=[{'all':!![]}];}return db[_0x0340('0xb9')][_0x0340('0xc0')](_0x3d66dd);})['then'](function(_0x4163d8){_0xd42b8['rows']=_0x4163d8;return _0xd42b8;});}})[_0x0340('0x28')](respondWithFilteredResult(_0x41af21,_0x3d66dd))[_0x0340('0x36')](handleError(_0x41af21,null));};exports['addTags']=function(_0x219ac6,_0x362dac,_0x350dfd){return db[_0x0340('0x37')][_0x0340('0x5f')]({'where':{'id':_0x219ac6[_0x0340('0xb1')]['id']}})[_0x0340('0x28')](handleEntityNotFound(_0x362dac,null))[_0x0340('0x28')](function(_0x358872){if(_0x358872){return _0x358872[_0x0340('0xc1')](_0x219ac6[_0x0340('0xb6')][_0x0340('0xba')],_[_0x0340('0xbb')](_0x219ac6['body'],['ids','id'])||{})['spread'](function(){return db[_0x0340('0x6c')][_0x0340('0xc0')]({'attributes':['id','name',_0x0340('0x49')],'where':{'id':_0x219ac6['body']['ids']}});})[_0x0340('0x28')](function(_0x200c67){socket[_0x0340('0xc2')]('openchannelInteractionTags:save',{'id':Number(_0x219ac6['params']['id']),'tags':_0x200c67||[]});return{'id':Number(_0x219ac6[_0x0340('0xb1')]['id']),'tags':_0x200c67||[]};});}})[_0x0340('0x28')](respondWithResult(_0x362dac,null))[_0x0340('0x36')](handleError(_0x362dac,null));};exports[_0x0340('0xc3')]=function(_0x2f9f98,_0x4d8826,_0x11ff12){return db[_0x0340('0x37')]['find']({'where':{'id':_0x2f9f98[_0x0340('0xb1')]['id']}})[_0x0340('0x28')](handleEntityNotFound(_0x4d8826,null))[_0x0340('0x28')](function(_0x3e1935){if(_0x3e1935){return _0x3e1935[_0x0340('0xc3')](_0x2f9f98[_0x0340('0x3d')][_0x0340('0xba')]);}})[_0x0340('0x28')](respondWithStatusCode(_0x4d8826,null))[_0x0340('0x36')](handleError(_0x4d8826,null));};exports[_0x0340('0xc4')]=function(_0x499964,_0x5f3874){var _0x45f3f6=moment()[_0x0340('0xc5')]()[_0x0340('0x9b')]();var _0x3c83f2=path['join'](config[_0x0340('0xc6')],'server',_0x0340('0xc7'),_0x0340('0xc8'));var _0x388957=path[_0x0340('0xc9')](config[_0x0340('0xc6')],_0x0340('0xca'),_0x0340('0xc7'),_0x0340('0xcb'));var _0x463912=path[_0x0340('0xc9')](_0x3c83f2,_0x45f3f6);var _0x3ac241=util[_0x0340('0xbf')]('transcript-%d-%s.zip',_0x499964[_0x0340('0xb1')]['id'],_0x45f3f6);var _0x368154=path['join'](_0x3c83f2,_0x3ac241);var _0x14d647=[];_0x14d647[_0x0340('0x35')]({'model':db['User'],'as':_0x0340('0x70'),'attributes':['id',_0x0340('0x31')],'raw':!![]});_0x14d647[_0x0340('0x35')]({'model':db['CmContact'],'as':_0x0340('0xcc'),'attributes':['id','firstName',_0x0340('0xcd')],'raw':!![]});if(_0x499964['query'][_0x0340('0xcb')]){_0x14d647[_0x0340('0x35')]({'model':db[_0x0340('0xce')],'as':_0x0340('0xce'),'raw':!![]});}var _0x1ff5ff=[{'model':db['OpenchannelMessage'],'as':_0x0340('0xcf'),'attributes':['id',_0x0340('0xb6'),_0x0340('0xd0'),'direction',_0x0340('0xd1'),_0x0340('0x7f')],'include':_0x14d647}];_0x1ff5ff[_0x0340('0x35')]({'model':db[_0x0340('0xd2')],'as':_0x0340('0xd3'),'attributes':['id',_0x0340('0x2d')]});_0x1ff5ff[_0x0340('0x35')]({'model':db[_0x0340('0x70')],'as':_0x0340('0xd4'),'attributes':['id',_0x0340('0x31')]});return db[_0x0340('0x37')][_0x0340('0x5f')]({'where':{'id':_0x499964[_0x0340('0xb1')]['id']},'include':_0x1ff5ff})[_0x0340('0x28')](handleEntityNotFound(_0x5f3874,null))[_0x0340('0x28')](function(_0x439da7){if(_0x439da7){var _0x3b29ff=_0x439da7[_0x0340('0xd5')]({'plain':!![]});fs[_0x0340('0xd6')](_0x463912);var _0xb3283={'channel':_0x0340('0xd7'),'account':_0x3b29ff['Account'][_0x0340('0x2d')],'agent':_0x3b29ff[_0x0340('0xd4')]?_0x3b29ff[_0x0340('0xd4')][_0x0340('0x31')]:'N.A.','createdAt':moment(_0x3b29ff[_0x0340('0xd0')])[_0x0340('0xbf')](_0x0340('0xd8'))['toString'](),'closedAt':_0x3b29ff[_0x0340('0xd9')]?moment(_0x3b29ff[_0x0340('0xda')])[_0x0340('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0340('0x9b')]():'','disposition':_0x3b29ff[_0x0340('0xdb')],'visibility':_0x3b29ff[_0x0340('0xdc')]?'Public':_0x0340('0xdd'),'messages':_(_0x3b29ff[_0x0340('0xcf')])[_0x0340('0xbe')]({'secret':![]})[_0x0340('0x30')](function(_0x4ec6c2){if(_0x4ec6c2['Attachment']){var _0x2165dd=path[_0x0340('0xc9')](_0x388957,_0x4ec6c2[_0x0340('0xce')]['basename']);if(fs['existsSync'](_0x2165dd)){fs[_0x0340('0xde')](_0x2165dd)[_0x0340('0xdf')](fs[_0x0340('0xe0')](path[_0x0340('0xc9')](_0x463912,_0x4ec6c2[_0x0340('0xce')][_0x0340('0xe1')])));}}return{'date':moment(_0x4ec6c2[_0x0340('0xd0')])['format'](_0x0340('0xd8'))[_0x0340('0x9b')](),'sender':_0x4ec6c2[_0x0340('0xe2')]===_0x0340('0xe3')?_0x4ec6c2['User']?_0x4ec6c2[_0x0340('0x70')][_0x0340('0x31')]:_0x0340('0xe4'):_0x4ec6c2[_0x0340('0xcc')]['firstName']+(_0x4ec6c2[_0x0340('0xcc')][_0x0340('0xcd')]?'\x20'+_0x4ec6c2['Contact']['lastName']:''),'body':_0x4ec6c2[_0x0340('0xce')]?_0x4ec6c2['Attachment'][_0x0340('0xe1')]:_0x4ec6c2[_0x0340('0xb6')],'direction':_0x4ec6c2[_0x0340('0xe2')]===_0x0340('0xe3')?'A':'C','secret':_0x4ec6c2[_0x0340('0xd1')],'read':_0x4ec6c2[_0x0340('0x7f')],'attachment':_0x4ec6c2[_0x0340('0xce')]};})[_0x0340('0x61')]()};return ejs[_0x0340('0xe5')](path[_0x0340('0xc9')](config['root'],_0x0340('0xca'),_0x0340('0xe6'),_0x0340('0xe7')),{'interaction':_0xb3283})[_0x0340('0x28')](function(_0x124e92){var _0x312f64=path[_0x0340('0xc9')](_0x463912,'transcript-'+_0x3b29ff['id']+'-'+_0x45f3f6+_0x0340('0xe8'));var _0x54a7a9={'path':_0x312f64,'channel':_0x0340('0xd7'),'interactionId':_0x3b29ff['id']};return pdf[_0x0340('0xe9')](_0x124e92,_0x54a7a9);})['then'](function(){return new BPromise(function(_0x2e9d19,_0x366371){zipdir(_0x463912,{'saveTo':_0x368154},function(_0xcfcb5c,_0x4790b2){if(_0xcfcb5c)return _0x366371(_0xcfcb5c);return _0x2e9d19(_0x4790b2);});})[_0x0340('0x28')](function(){return new BPromise(function(_0x35fcf0,_0x89ab2c){rimraf(_0x463912,function(_0x347edd){if(_0x347edd)_0x89ab2c(_0x347edd);return _0x35fcf0();});});})[_0x0340('0x28')](function(){return _0x5f3874[_0x0340('0xc4')](_0x368154,_0x3ac241,function(_0x17459d){if(_0x17459d){console[_0x0340('0xea')](_0x0340('0xeb'),_0x17459d);}else{fs[_0x0340('0xec')](_0x368154);}});});});}else{return _0x5f3874[_0x0340('0x2a')](0xc8);}})[_0x0340('0x36')](handleError(_0x5f3874,null));}; \ No newline at end of file +var _0x4fa2=['MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','UserId','keys','some','isEmpty','OpenchannelAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','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','i.*','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','show','params','fields','includeAll','include','options','create','body','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','rows','findAll','color','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','createdAt','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','threadId','Public','join','existsSync','createReadStream','basename','direction','out','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','reject','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring'];(function(_0x19efc8,_0xa8b500){var _0x1926ea=function(_0x466bbc){while(--_0x466bbc){_0x19efc8['push'](_0x19efc8['shift']());}};_0x1926ea(++_0xa8b500);}(_0x4fa2,0x16e));var _0x24fa=function(_0xfdec06,_0x9fa2f4){_0xfdec06=_0xfdec06-0x0;var _0x58a539=_0x4fa2[_0xfdec06];return _0x58a539;};'use strict';var emlformat=require(_0x24fa('0x0'));var rimraf=require(_0x24fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x24fa('0x2'));var rp=require(_0x24fa('0x3'));var moment=require(_0x24fa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x24fa('0x5'));var util=require(_0x24fa('0x6'));var path=require(_0x24fa('0x7'));var sox=require(_0x24fa('0x8'));var csv=require('to-csv');var ejs=require(_0x24fa('0x9'));var fs=require('fs');var fs_extra=require(_0x24fa('0xa'));var _=require(_0x24fa('0xb'));var squel=require(_0x24fa('0xc'));var crypto=require(_0x24fa('0xd'));var jsforce=require(_0x24fa('0xe'));var deskjs=require(_0x24fa('0xf'));var toCsv=require(_0x24fa('0x10'));var querystring=require(_0x24fa('0x11'));var Papa=require(_0x24fa('0x12'));var Redis=require(_0x24fa('0x13'));var authService=require(_0x24fa('0x14'));var qs=require(_0x24fa('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x24fa('0x16'))(_0x24fa('0x17'));var utils=require(_0x24fa('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fa('0x19'));var db=require('../../mysqldb')['db'];config[_0x24fa('0x1a')]=_['defaults'](config['redis'],{'host':_0x24fa('0x1b'),'port':0x18eb});var socket=require(_0x24fa('0x1c'))(new Redis(config[_0x24fa('0x1a')]));require(_0x24fa('0x1d'))[_0x24fa('0x1e')](socket);function respondWithStatusCode(_0x1d905f,_0x12c969){_0x12c969=_0x12c969||0xcc;return function(_0x4000fa){if(_0x4000fa){return _0x1d905f[_0x24fa('0x1f')](_0x12c969);}return _0x1d905f['status'](_0x12c969)[_0x24fa('0x20')]();};}function respondWithResult(_0x31bcd1,_0x5be4d4){_0x5be4d4=_0x5be4d4||0xc8;return function(_0x124dbd){if(_0x124dbd){return _0x31bcd1['status'](_0x5be4d4)[_0x24fa('0x21')](_0x124dbd);}};}function respondWithFilteredResult(_0x4f8f57,_0xde5153){return function(_0xdb9cbb){if(_0xdb9cbb){var _0x35f740=typeof _0xde5153['offset']===_0x24fa('0x22')&&typeof _0xde5153[_0x24fa('0x23')]===_0x24fa('0x22');var _0x2a7b05=_0xdb9cbb['count'];var _0x488a91=_0x35f740?0x0:_0xde5153[_0x24fa('0x24')];var _0x1dfeb2=_0x35f740?_0xdb9cbb[_0x24fa('0x25')]:_0xde5153[_0x24fa('0x24')]+_0xde5153[_0x24fa('0x23')];var _0xe7caff;if(_0x1dfeb2>=_0x2a7b05){_0x1dfeb2=_0x2a7b05;_0xe7caff=0xc8;}else{_0xe7caff=0xce;}_0x4f8f57[_0x24fa('0x26')](_0xe7caff);return _0x4f8f57[_0x24fa('0x27')](_0x24fa('0x28'),_0x488a91+'-'+_0x1dfeb2+'/'+_0x2a7b05)[_0x24fa('0x21')](_0xdb9cbb);}return null;};}function patchUpdates(_0x4ab738){return function(_0x1901d6){try{jsonpatch['apply'](_0x1901d6,_0x4ab738,!![]);}catch(_0x36ba71){return BPromise[_0x24fa('0x29')](_0x36ba71);}return _0x1901d6[_0x24fa('0x2a')]();};}function saveUpdates(_0x87380,_0x459515){return function(_0x25b09a){if(_0x25b09a){return _0x25b09a[_0x24fa('0x2b')](_0x87380)[_0x24fa('0x2c')](function(_0xab5e0f){return _0xab5e0f;});}return null;};}function removeEntity(_0x21960c,_0x287f72){return function(_0x39454e){if(_0x39454e){return _0x39454e[_0x24fa('0x2d')]()['then'](function(){_0x21960c[_0x24fa('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ee27d,_0xa16ec4){return function(_0x45ead6){if(!_0x45ead6){_0x2ee27d['sendStatus'](0x194);}return _0x45ead6;};}function handleError(_0x5b4a4b,_0x2aa41a){_0x2aa41a=_0x2aa41a||0x1f4;return function(_0x1dc49a){logger['error'](_0x1dc49a[_0x24fa('0x2e')]);if(_0x1dc49a['name']){delete _0x1dc49a[_0x24fa('0x2f')];}_0x5b4a4b[_0x24fa('0x26')](_0x2aa41a)[_0x24fa('0x30')](_0x1dc49a);};}function getInteractionUsers(_0x3dec07,_0x10e90b){return new BPromise(function(_0x112366,_0x1a8942){try{if(_0x10e90b[_0x3dec07['id']]){_0x3dec07[_0x24fa('0x31')]=_[_0x24fa('0x32')](_0x10e90b[_0x3dec07['id']],function(_0x2a0008){return{'id':_0x2a0008['id'],'fullname':_0x2a0008[_0x24fa('0x33')]};});}}catch(_0x33c1b6){_0x1a8942(_0x33c1b6);}_0x112366(_0x3dec07);});}function getInteractionTags(_0x203b24,_0x571d5f){return new BPromise(function(_0x5b46e2,_0x70aa5d){try{if(_0x203b24[_0x24fa('0x34')]){_0x203b24[_0x24fa('0x35')]=[];_0x203b24['TagIds'][_0x24fa('0x36')](',')[_0x24fa('0x37')](function(_0x2a0226){_0x203b24[_0x24fa('0x35')][_0x24fa('0x38')](_0x571d5f[_0x2a0226]);});}delete _0x203b24['TagIds'];}catch(_0x10da71){_0x70aa5d(_0x10da71);}_0x5b46e2(_0x203b24);});}function updateOpenchannelInteraction(_0x4d6d77,_0x3e30bd,_0x1a2c64){return new BPromise(function(_0x2eb3ae,_0x53ef20){return getInteractionUsers(_0x4d6d77,_0x1a2c64)[_0x24fa('0x2c')](function(_0x14352a){return getInteractionTags(_0x14352a,_0x3e30bd);})[_0x24fa('0x2c')](function(_0x22ee6f){_0x2eb3ae(_0x22ee6f);})[_0x24fa('0x39')](function(_0x1f82b1){_0x53ef20(_0x1f82b1);});});}exports[_0x24fa('0x3a')]=function(_0x396666,_0x31da64){var _0x745782={},_0x30d8f5={},_0x46e699={'count':0x0,'rows':[]};var _0x116dca=_[_0x24fa('0x32')](db[_0x24fa('0x3b')][_0x24fa('0x3c')],function(_0x3e5c47){return{'name':_0x3e5c47[_0x24fa('0x3d')],'type':_0x3e5c47[_0x24fa('0x3e')][_0x24fa('0x3f')]};});_0x30d8f5[_0x24fa('0x40')]=_[_0x24fa('0x32')](_0x116dca,_0x24fa('0x2f'));_0x30d8f5[_0x24fa('0x41')]=_['keys'](_0x396666[_0x24fa('0x41')]);_0x30d8f5['filters']=_[_0x24fa('0x42')](_0x30d8f5[_0x24fa('0x40')],_0x30d8f5[_0x24fa('0x41')]);_0x745782[_0x24fa('0x43')]=_[_0x24fa('0x42')](_0x30d8f5[_0x24fa('0x40')],qs['fields'](_0x396666[_0x24fa('0x41')]['fields']));_0x745782[_0x24fa('0x43')]=_0x745782[_0x24fa('0x43')][_0x24fa('0x44')]?_0x745782[_0x24fa('0x43')]:_0x30d8f5[_0x24fa('0x40')];if(!_0x396666['query'][_0x24fa('0x45')](_0x24fa('0x46'))){_0x745782[_0x24fa('0x23')]=qs[_0x24fa('0x23')](_0x396666['query'][_0x24fa('0x23')]);_0x745782[_0x24fa('0x24')]=qs['offset'](_0x396666[_0x24fa('0x41')]['offset']);}_0x745782[_0x24fa('0x47')]=qs[_0x24fa('0x48')](_0x396666[_0x24fa('0x41')]['sort']);_0x745782[_0x24fa('0x49')]=qs['filters'](_[_0x24fa('0x4a')](_0x396666[_0x24fa('0x41')],_0x30d8f5[_0x24fa('0x4b')]),_0x116dca);var _0x38ea47=[];var _0x3fde82=squel[_0x24fa('0x4c')]()[_0x24fa('0x4d')]('id')[_0x24fa('0x4d')](_0x24fa('0x2f'))[_0x24fa('0x4d')]('color')[_0x24fa('0x4e')](_0x24fa('0x4f'));var _0x1db351=squel[_0x24fa('0x4c')]()[_0x24fa('0x4d')]('u.id')['field'](_0x24fa('0x50'))['field'](_0x24fa('0x51'))['from'](_0x24fa('0x52'),'ui')['left_join'](_0x24fa('0x53'),'u',_0x24fa('0x54'));var _0x4844c1=squel['select']()[_0x24fa('0x4e')](_0x24fa('0x55'),'i')[_0x24fa('0x56')](_0x24fa('0x57'),'c',_0x24fa('0x58'))['left_join'](_0x24fa('0x53'),'o',_0x24fa('0x59'))['left_join'](_0x24fa('0x5a'),'a',_0x24fa('0x5b'))[_0x24fa('0x56')](_0x24fa('0x5c'),'me',_0x24fa('0x5d'))['left_join'](_0x24fa('0x5e'),'it',_0x24fa('0x5f'))[_0x24fa('0x56')](_0x24fa('0x4f'),'t',_0x24fa('0x60'));var _0x153723=squel[_0x24fa('0x61')]();var _0x31ba37=[];var _0x2ac110=squel[_0x24fa('0x61')]();var _0x144393;if(_0x396666[_0x24fa('0x41')][_0x24fa('0x62')]){_0x144393=as['parseSearch'](_0x396666[_0x24fa('0x41')]['search']);var _0x5a8150=_0x144393['sqlOperator'];for(var _0x459e16=0x0;_0x459e16<_0x144393[_0x24fa('0x63')]['length'];_0x459e16++){var _0x180648=_0x144393[_0x24fa('0x63')][_0x459e16];var _0x37d0cd='i';var _0x2977bb=_[_0x24fa('0x64')](_0x116dca,['name',_0x180648[_0x24fa('0x4d')]]);if(!_0x2977bb){switch(_0x180648[_0x24fa('0x4d')]){case _0x24fa('0x65'):if(_0x180648[_0x24fa('0x66')]==0x1){_0x4844c1[_0x24fa('0x67')]('`'+_0x180648[_0x24fa('0x4d')]+_0x24fa('0x68'));}else{_0x4844c1[_0x24fa('0x67')]('`'+_0x180648[_0x24fa('0x4d')]+'`\x20>\x200');}break;case _0x24fa('0x69'):if(_0x180648[_0x24fa('0x6a')]===_0x24fa('0x6b')){if(_0x180648[_0x24fa('0x66')][_0x24fa('0x36')]('\x20')[_0x24fa('0x44')]>0x1){_0x153723[_0x5a8150](_0x24fa('0x6c'),qs[_0x24fa('0x6d')](_0x180648[_0x24fa('0x66')]),null);}else{var _0x1985c1='%'+_0x180648['value']+'%';_0x153723[_0x5a8150](_0x24fa('0x6e'),_0x1985c1,_0x1985c1,_0x1985c1);}}else{_0x2977bb=_[_0x24fa('0x64')](_0x116dca,[_0x24fa('0x2f'),_0x24fa('0x6f')]);_0x180648[_0x24fa('0x4d')]=_0x24fa('0x6f');_0x2c5d4e=as[_0x24fa('0x70')](_0x37d0cd,_0x2977bb[_0x24fa('0x3e')],_0x180648);_0x153723[_0x5a8150](_0x2c5d4e[_0x24fa('0x71')],_0x2c5d4e['value'][_0x24fa('0x72')],_0x2c5d4e[_0x24fa('0x66')]['end']);}break;case _0x24fa('0x73'):var _0x23a220=_0x180648[_0x24fa('0x66')]['split'](',')[_0x24fa('0x32')](function(_0x196e1c){return Number(_0x196e1c);});_0x23a220[_0x24fa('0x37')](function(_0x2b2a81){_0x2ac110['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b2a81+',%');});_0x31ba37=_[_0x24fa('0x74')](_0x31ba37,_0x23a220);break;case'User':if(_0x180648[_0x24fa('0x6a')]===_0x24fa('0x6b')){_0x153723[_0x5a8150]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x180648[_0x24fa('0x66')]+'%',null);}else{_0x2977bb=_[_0x24fa('0x64')](_0x116dca,[_0x24fa('0x2f'),_0x24fa('0x75')]);_0x180648[_0x24fa('0x4d')]=_0x24fa('0x75');_0x2c5d4e=as['buildExpression'](_0x37d0cd,_0x2977bb['type'],_0x180648);_0x153723[_0x5a8150](_0x2c5d4e[_0x24fa('0x71')],_0x2c5d4e[_0x24fa('0x66')][_0x24fa('0x72')],_0x2c5d4e[_0x24fa('0x66')][_0x24fa('0x20')]);}break;case'body':_0x2c5d4e=as[_0x24fa('0x70')]('me',null,_0x180648);_0x153723[_0x5a8150](_0x2c5d4e[_0x24fa('0x71')],_0x2c5d4e[_0x24fa('0x66')][_0x24fa('0x72')],_0x2c5d4e[_0x24fa('0x66')]['end']);break;}}else{var _0x2c5d4e=as[_0x24fa('0x70')](_0x37d0cd,_0x2977bb['type'],_0x180648);_0x153723[_0x5a8150](_0x2c5d4e['text'],_0x2c5d4e[_0x24fa('0x66')][_0x24fa('0x72')],_0x2c5d4e[_0x24fa('0x66')][_0x24fa('0x20')]);}}}else{var _0x3f2050=_(_0x396666[_0x24fa('0x41')])[_0x24fa('0x76')]()['map'](function(_0x18d65c){return _[_0x24fa('0x77')](_0x116dca,[_0x24fa('0x2f'),_0x18d65c])?_0x18d65c:undefined;})['compact']()[_0x24fa('0x66')]();if(!_[_0x24fa('0x78')](_0x3f2050)){_0x3f2050[_0x24fa('0x37')](function(_0x184700){if(_0x184700===_0x24fa('0x79')){_0x4844c1[_0x24fa('0x49')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x24fa('0x7a')](_0x396666[_0x24fa('0x41')][_0x184700]));}else if(_0x184700==='createdAt'){var _0x496c84=JSON[_0x24fa('0x7b')](_0x396666[_0x24fa('0x41')][_0x184700])[_0x24fa('0x7c')];var _0x31d5f1=JSON[_0x24fa('0x7b')](_0x396666[_0x24fa('0x41')][_0x184700])[_0x24fa('0x7d')];_0x4844c1['where'](_0x24fa('0x7e'),_0x496c84,_0x31d5f1);}else{if(_0x396666[_0x24fa('0x41')][_0x184700]===_0x24fa('0x7f')){_0x4844c1['where']('i.'+_0x184700+'\x20IS\x20NULL');}else{_0x4844c1['where']('i.'+_0x184700+_0x24fa('0x80'),_0x396666[_0x24fa('0x41')][_0x184700]);}}});}if(_0x396666['query']['read']){if(_0x396666['query'][_0x24fa('0x81')]==0x1){_0x4844c1[_0x24fa('0x67')](_0x24fa('0x82'));}else{_0x4844c1[_0x24fa('0x67')](_0x24fa('0x83'));}}if(_0x396666['query'][_0x24fa('0x84')]){_0x31ba37=_[_0x24fa('0x85')](_0x396666[_0x24fa('0x41')][_0x24fa('0x84')])?_0x396666[_0x24fa('0x41')][_0x24fa('0x84')]:new Array(_0x396666[_0x24fa('0x41')][_0x24fa('0x84')]);_0x31ba37[_0x24fa('0x37')](function(_0x538f00){_0x2ac110['or'](_0x24fa('0x86'),'%,'+_0x538f00+',%');});}if(_0x396666[_0x24fa('0x41')]['filter']){var _0xa8e237=_0x396666[_0x24fa('0x41')][_0x24fa('0x87')][_0x24fa('0x88')]('\x5c','\x5c\x5c')[_0x24fa('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xa8e237)){_0x153723['or']('i.id\x20LIKE\x20?',_0xa8e237+'%');}else{_0x153723['or'](_0x24fa('0x89'),qs[_0x24fa('0x6d')](_0xa8e237))['or'](_0x24fa('0x8a'),_0xa8e237+'%')['or'](_0x24fa('0x8b'),_0xa8e237+'%');}}}_0x4844c1[_0x24fa('0x49')](_0x153723);_0x4844c1[_0x24fa('0x8c')](_0x24fa('0x8d'));var _0x1d7620={'type':db['Sequelize'][_0x24fa('0x8e')][_0x24fa('0x8f')],'raw':!![]};var _0x36f990=_0x4844c1['clone']();_0x36f990[_0x24fa('0x4d')](_0x24fa('0x8d'));_0x36f990['field'](_0x24fa('0x90'),_0x24fa('0x65'));if(_0x745782[_0x24fa('0x47')]){_0x745782[_0x24fa('0x47')]['forEach'](function(_0x358ff1){var _0x1ceb1a=_0x358ff1[0x0]===_0x24fa('0x91')?_0x358ff1[0x0]:'i.'+_0x358ff1[0x0];_0x4844c1['order'](_0x1ceb1a,_0x358ff1[0x1]==='DESC'?![]:!![]);});}if(!_[_0x24fa('0x78')](_0x31ba37)){_0x4844c1['having'](_0x2ac110);_0x36f990['where'](_0x24fa('0x92'),_0x31ba37);}BPromise[_0x24fa('0x93')]()[_0x24fa('0x2c')](function(){if(!_0x144393){if(_0x396666[_0x24fa('0x41')][_0x24fa('0x79')])return;_0x36f990[_0x24fa('0x49')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x4844c1[_0x24fa('0x49')](_0x24fa('0x94'));return;}if(_0x396666[_0x24fa('0x95')][_0x24fa('0x96')]!==_0x24fa('0x97'))return;return _0x396666['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x24f9b2){if(_[_0x24fa('0x78')](_0x24f9b2)){_0x36f990['where'](_0x24fa('0x98'));_0x4844c1['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x36f990[_0x24fa('0x49')](_0x24fa('0x99'),_['map'](_0x24f9b2,'id'));_0x4844c1[_0x24fa('0x49')](_0x24fa('0x99'),_[_0x24fa('0x32')](_0x24f9b2,'id'));}});})[_0x24fa('0x2c')](function(){if(_0x396666[_0x24fa('0x95')][_0x24fa('0x96')]===_0x24fa('0x97')&&!_0x144393&&!_0x396666[_0x24fa('0x41')]['OpenchannelAccountId'])return[];return db[_0x24fa('0x9a')][_0x24fa('0x41')](_0x36f990[_0x24fa('0x9b')](),_0x1d7620);})[_0x24fa('0x2c')](function(_0x28654f){_0x46e699[_0x24fa('0x25')]=_0x28654f[_0x24fa('0x44')];if(_0x46e699['count']===0x0)return[];return db[_0x24fa('0x9a')][_0x24fa('0x41')](_0x3fde82[_0x24fa('0x9b')](),_0x1d7620)[_0x24fa('0x2c')](function(_0x4a7d7c){_0x38ea47=_[_0x24fa('0x9c')](_0x4a7d7c,'id');_0x1d7620=_[_0x24fa('0x9d')](_0x1d7620,{'model':db[_0x24fa('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x396666[_0x24fa('0x41')]['fields']){_0x745782[_0x24fa('0x43')][_0x24fa('0x37')](function(_0x33b4a7){_0x4844c1[_0x24fa('0x4d')]('i.'+_0x33b4a7);});}else{_0x4844c1[_0x24fa('0x4d')](_0x24fa('0x90'),'unreadMessages');_0x4844c1[_0x24fa('0x4d')](_0x24fa('0x9e'),_0x24fa('0x9f'));_0x4844c1[_0x24fa('0x4d')](_0x24fa('0xa0'),'Account.mandatoryDisposition');_0x4844c1[_0x24fa('0x4d')](_0x24fa('0xa1'),_0x24fa('0x91'));_0x4844c1['field'](_0x24fa('0xa2'));_0x4844c1[_0x24fa('0x4d')]('c.firstName',_0x24fa('0xa3'));_0x4844c1[_0x24fa('0x4d')](_0x24fa('0xa4'),_0x24fa('0xa5'));_0x4844c1[_0x24fa('0x4d')]('c.email','Contact.email');_0x4844c1[_0x24fa('0x4d')](_0x24fa('0xa6'),_0x24fa('0xa7'));_0x4844c1[_0x24fa('0x4d')](_0x24fa('0xa8'),_0x24fa('0xa9'));_0x4844c1[_0x24fa('0x4d')](_0x24fa('0xaa'),_0x24fa('0xab'));_0x4844c1['field'](_0x24fa('0xac'),'Owner.fullname');_0x4844c1[_0x24fa('0x4d')](_0x24fa('0xad'),'Owner.internal');_0x4844c1[_0x24fa('0x4d')](_0x24fa('0xae'),_0x24fa('0x34'));}if(_0x745782[_0x24fa('0x23')])_0x4844c1['limit'](_0x745782['limit']);if(_0x745782['offset'])_0x4844c1['offset'](_0x745782[_0x24fa('0x24')]);return db[_0x24fa('0x9a')]['query'](_0x4844c1['toString'](),_0x1d7620);})['then'](function(_0x3c92e9){if(_0x3c92e9[_0x24fa('0x44')]>0x0)_0x1db351['where'](_0x24fa('0xaf'),_[_0x24fa('0x32')](_0x3c92e9,'id'));return db[_0x24fa('0x9a')]['query'](_0x1db351[_0x24fa('0x9b')](),_0x1d7620)['then'](function(_0xed902b){var _0x45ec71=_['groupBy'](_0xed902b,_0x24fa('0xb0'));var _0x12b59f=[];_0x3c92e9[_0x24fa('0x37')](function(_0x53c0c8){_0x12b59f[_0x24fa('0x38')](updateOpenchannelInteraction(_0x53c0c8,_0x38ea47,_0x45ec71));});return BPromise[_0x24fa('0xb1')](_0x12b59f);});});})[_0x24fa('0x2c')](function(_0xe457e9){_0x46e699['rows']=_0xe457e9;return _0x46e699;})[_0x24fa('0x2c')](respondWithFilteredResult(_0x31da64,_0x745782))[_0x24fa('0x39')](handleError(_0x31da64,null));};exports[_0x24fa('0xb2')]=function(_0x15b434,_0x50acc3){var _0xa594b={};if(_0x15b434[_0x24fa('0x41')][_0x24fa('0x3e')]&&_0x15b434[_0x24fa('0x41')][_0x24fa('0x3e')]===_0x24fa('0x4e')){_0xa594b['from']=_0x15b434[_0x24fa('0xb3')]['id'];}else{_0xa594b['id']=_0x15b434[_0x24fa('0xb3')]['id'];}var _0x2e472e={'raw':![],'where':_0xa594b},_0x115c1f={};_0x115c1f[_0x24fa('0x40')]=_[_0x24fa('0x76')](db['OpenchannelInteraction'][_0x24fa('0x3c')]);_0x115c1f['query']=_[_0x24fa('0x76')](_0x15b434[_0x24fa('0x41')]);_0x115c1f[_0x24fa('0x4b')]=_[_0x24fa('0x42')](_0x115c1f[_0x24fa('0x40')],_0x115c1f[_0x24fa('0x41')]);_0x2e472e[_0x24fa('0x43')]=_[_0x24fa('0x42')](_0x115c1f[_0x24fa('0x40')],qs[_0x24fa('0xb4')](_0x15b434[_0x24fa('0x41')][_0x24fa('0xb4')]));_0x2e472e['attributes']=_0x2e472e[_0x24fa('0x43')]['length']?_0x2e472e['attributes']:_0x115c1f['model'];if(_0x15b434[_0x24fa('0x41')][_0x24fa('0xb5')]){_0x2e472e[_0x24fa('0xb6')]=[{'all':!![]}];}_0x2e472e=_[_0x24fa('0x9d')]({},_0x2e472e,_0x15b434[_0x24fa('0xb7')]);return db[_0x24fa('0x3b')][_0x24fa('0x64')](_0x2e472e)[_0x24fa('0x2c')](handleEntityNotFound(_0x50acc3,null))[_0x24fa('0x2c')](respondWithResult(_0x50acc3,null))[_0x24fa('0x39')](handleError(_0x50acc3,null));};exports[_0x24fa('0xb8')]=function(_0x292668,_0x1ad3f4){return db['OpenchannelInteraction']['create'](_0x292668[_0x24fa('0xb9')],{})[_0x24fa('0x2c')](respondWithResult(_0x1ad3f4,0xc9))[_0x24fa('0x39')](handleError(_0x1ad3f4,null));};exports[_0x24fa('0x2b')]=function(_0xb55f1b,_0x258609){if(_0xb55f1b['body']['id']){delete _0xb55f1b[_0x24fa('0xb9')]['id'];}return db[_0x24fa('0x3b')][_0x24fa('0x64')]({'where':{'id':_0xb55f1b[_0x24fa('0xb3')]['id']}})[_0x24fa('0x2c')](handleEntityNotFound(_0x258609,null))[_0x24fa('0x2c')](saveUpdates(_0xb55f1b[_0x24fa('0xb9')],null))[_0x24fa('0x2c')](respondWithResult(_0x258609,null))[_0x24fa('0x39')](handleError(_0x258609,null));};exports['destroy']=function(_0x594f01,_0x139859){return db[_0x24fa('0x3b')][_0x24fa('0x64')]({'where':{'id':_0x594f01['params']['id']}})['then'](handleEntityNotFound(_0x139859,null))['then'](removeEntity(_0x139859,null))[_0x24fa('0x39')](handleError(_0x139859,null));};exports[_0x24fa('0xba')]=function(_0xd7e317,_0x50f43a){return db[_0x24fa('0x3b')][_0x24fa('0xba')]()[_0x24fa('0x2c')](respondWithResult(_0x50f43a,null))[_0x24fa('0x39')](handleError(_0x50f43a,null));};exports[_0x24fa('0xbb')]=function(_0x348201,_0x4d6eee,_0x1bdde1){return db['OpenchannelMessage'][_0x24fa('0x64')]({'where':{'id':_0x348201[_0x24fa('0xb3')]['id']}})[_0x24fa('0x2c')](handleEntityNotFound(_0x4d6eee,null))['then'](function(_0x51ad56){if(_0x51ad56){return _0x51ad56[_0x24fa('0xbb')](_0x348201['body'][_0x24fa('0xbc')],_[_0x24fa('0xbd')](_0x348201[_0x24fa('0xb9')],['ids','id'])||{});}})[_0x24fa('0x2c')](respondWithResult(_0x4d6eee,null))[_0x24fa('0x39')](handleError(_0x4d6eee,null));};exports[_0x24fa('0xbe')]=function(_0x481f01,_0x4afb26,_0x5f3f0b){var _0x322f4d={'raw':![],'where':{}};var _0xe28141={};var _0x3ddfc3={'count':0x0,'rows':[]};return db[_0x24fa('0x3b')][_0x24fa('0xbf')]({'where':{'id':_0x481f01[_0x24fa('0xb3')]['id']}})['then'](handleEntityNotFound(_0x4afb26,null))['then'](function(_0x249844){if(_0x249844){_0xe28141[_0x24fa('0x40')]=_[_0x24fa('0x76')](db[_0x24fa('0xc0')]['rawAttributes']);_0xe28141[_0x24fa('0x41')]=_[_0x24fa('0x76')](_0x481f01[_0x24fa('0x41')]);_0xe28141[_0x24fa('0x4b')]=_['intersection'](_0xe28141[_0x24fa('0x40')],_0xe28141['query']);_0x322f4d[_0x24fa('0x43')]=_['intersection'](_0xe28141[_0x24fa('0x40')],qs[_0x24fa('0xb4')](_0x481f01['query'][_0x24fa('0xb4')]));_0x322f4d[_0x24fa('0x43')]=_0x322f4d[_0x24fa('0x43')][_0x24fa('0x44')]?_0x322f4d[_0x24fa('0x43')]:_0xe28141[_0x24fa('0x40')];if(!_0x481f01[_0x24fa('0x41')][_0x24fa('0x45')](_0x24fa('0x46'))){_0x322f4d[_0x24fa('0x23')]=qs[_0x24fa('0x23')](_0x481f01[_0x24fa('0x41')][_0x24fa('0x23')]);_0x322f4d[_0x24fa('0x24')]=qs[_0x24fa('0x24')](_0x481f01['query'][_0x24fa('0x24')]);}_0x322f4d[_0x24fa('0x47')]=qs[_0x24fa('0x48')](_0x481f01[_0x24fa('0x41')][_0x24fa('0x48')]);_0x322f4d[_0x24fa('0x49')]=qs['filters'](_[_0x24fa('0x4a')](_0x481f01[_0x24fa('0x41')],_0xe28141[_0x24fa('0x4b')]));_0x322f4d[_0x24fa('0x49')]['OpenchannelInteractionId']=_0x249844['id'];if(_0x481f01[_0x24fa('0x41')]['filter']){_0x322f4d[_0x24fa('0x49')]=_[_0x24fa('0x9d')](_0x322f4d[_0x24fa('0x49')],{'$or':_[_0x24fa('0x32')](_0x322f4d[_0x24fa('0x43')],function(_0x578e77){var _0x5ba456={};_0x5ba456[_0x578e77]={'$like':'%'+_0x481f01['query'][_0x24fa('0x87')]+'%'};return _0x5ba456;})});}if(_0x481f01[_0x24fa('0x41')][_0x24fa('0x7c')]){var _0x3e9891=_0x481f01[_0x24fa('0x41')]['$gte'][_0x24fa('0x36')](',');var _0x5ee4d6={};_0x5ee4d6[_0x3e9891[0x0]]={'$gte':moment(_0x3e9891[0x1])[_0x24fa('0xc1')](_0x24fa('0xc2'))};_0x322f4d[_0x24fa('0x49')]=_[_0x24fa('0x9d')](_0x322f4d[_0x24fa('0x49')],_0x5ee4d6);}_0x322f4d=_[_0x24fa('0x9d')]({},_0x322f4d,_0x481f01[_0x24fa('0xb7')]);return db[_0x24fa('0xc0')]['count']({'where':_0x322f4d['where']})[_0x24fa('0x2c')](function(_0x494794){_0x3ddfc3[_0x24fa('0x25')]=_0x494794;if(_0x481f01[_0x24fa('0x41')]['includeAll']){_0x322f4d[_0x24fa('0xb6')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x322f4d);})[_0x24fa('0x2c')](function(_0x4c1d78){_0x3ddfc3[_0x24fa('0xc3')]=_0x4c1d78;return _0x3ddfc3;});}})[_0x24fa('0x2c')](respondWithFilteredResult(_0x4afb26,_0x322f4d))[_0x24fa('0x39')](handleError(_0x4afb26,null));};exports['addTags']=function(_0x4bc450,_0x5aabbc,_0x2c4216){return db[_0x24fa('0x3b')][_0x24fa('0x64')]({'where':{'id':_0x4bc450[_0x24fa('0xb3')]['id']}})['then'](handleEntityNotFound(_0x5aabbc,null))[_0x24fa('0x2c')](function(_0x9a1d24){if(_0x9a1d24){return _0x9a1d24['setTags'](_0x4bc450[_0x24fa('0xb9')][_0x24fa('0xbc')],_[_0x24fa('0xbd')](_0x4bc450['body'],['ids','id'])||{})['spread'](function(){return db[_0x24fa('0x73')][_0x24fa('0xc4')]({'attributes':['id',_0x24fa('0x2f'),_0x24fa('0xc5')],'where':{'id':_0x4bc450['body'][_0x24fa('0xbc')]}});})[_0x24fa('0x2c')](function(_0x3eab61){socket['emit'](_0x24fa('0xc6'),{'id':Number(_0x4bc450[_0x24fa('0xb3')]['id']),'tags':_0x3eab61||[]});return{'id':Number(_0x4bc450[_0x24fa('0xb3')]['id']),'tags':_0x3eab61||[]};});}})[_0x24fa('0x2c')](respondWithResult(_0x5aabbc,null))[_0x24fa('0x39')](handleError(_0x5aabbc,null));};exports[_0x24fa('0xc7')]=function(_0x35dfa3,_0xcb8741,_0x517809){return db[_0x24fa('0x3b')][_0x24fa('0x64')]({'where':{'id':_0x35dfa3[_0x24fa('0xb3')]['id']}})[_0x24fa('0x2c')](handleEntityNotFound(_0xcb8741,null))[_0x24fa('0x2c')](function(_0x5307ae){if(_0x5307ae){return _0x5307ae['removeTags'](_0x35dfa3[_0x24fa('0x41')]['ids']);}})[_0x24fa('0x2c')](respondWithStatusCode(_0xcb8741,null))[_0x24fa('0x39')](handleError(_0xcb8741,null));};exports[_0x24fa('0xc8')]=function(_0x42730d,_0x4d5454){var _0x37c579=moment()[_0x24fa('0xc9')]()[_0x24fa('0x9b')]();var _0x273747=path['join'](config[_0x24fa('0xca')],_0x24fa('0xcb'),_0x24fa('0xcc'),_0x24fa('0xcd'));var _0x401aab=path['join'](config[_0x24fa('0xca')],_0x24fa('0xcb'),_0x24fa('0xcc'),_0x24fa('0xce'));var _0x259de8=path['join'](_0x273747,_0x37c579);var _0x12520c=util['format'](_0x24fa('0xcf'),_0x42730d[_0x24fa('0xb3')]['id'],_0x37c579);var _0x56d0d2=path['join'](_0x273747,_0x12520c);var _0x3b5093=[];_0x3b5093['push']({'model':db[_0x24fa('0xd0')],'as':'User','attributes':['id',_0x24fa('0x33')],'raw':!![]});_0x3b5093[_0x24fa('0x38')]({'model':db[_0x24fa('0xd1')],'as':_0x24fa('0x69'),'attributes':['id',_0x24fa('0xd2'),_0x24fa('0xd3')],'raw':!![]});if(_0x42730d[_0x24fa('0x41')][_0x24fa('0xce')]){_0x3b5093[_0x24fa('0x38')]({'model':db[_0x24fa('0xd4')],'as':'Attachment','raw':!![]});}var _0x1b9492=[{'model':db[_0x24fa('0xc0')],'as':'Messages','attributes':['id','body',_0x24fa('0xd5'),'direction',_0x24fa('0xd6'),'read'],'include':_0x3b5093}];_0x1b9492[_0x24fa('0x38')]({'model':db[_0x24fa('0xd7')],'as':_0x24fa('0xd8'),'attributes':['id',_0x24fa('0x2f')]});_0x1b9492[_0x24fa('0x38')]({'model':db[_0x24fa('0xd0')],'as':'Owner','attributes':['id',_0x24fa('0x33')]});return db[_0x24fa('0x3b')][_0x24fa('0x64')]({'where':{'id':_0x42730d[_0x24fa('0xb3')]['id']},'include':_0x1b9492})[_0x24fa('0x2c')](handleEntityNotFound(_0x4d5454,null))[_0x24fa('0x2c')](function(_0xe93cf2){if(_0xe93cf2){var _0x1a43eb=_0xe93cf2[_0x24fa('0xd9')]({'plain':!![]});fs[_0x24fa('0xda')](_0x259de8);var _0x5136f7={'channel':_0x24fa('0xdb'),'account':_0x1a43eb[_0x24fa('0xd8')][_0x24fa('0x2f')],'agent':_0x1a43eb[_0x24fa('0xdc')]?_0x1a43eb[_0x24fa('0xdc')]['fullname']:_0x24fa('0xdd'),'createdAt':moment(_0x1a43eb[_0x24fa('0xd5')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1a43eb[_0x24fa('0xde')]?moment(_0x1a43eb['closedAt'])[_0x24fa('0xc1')](_0x24fa('0xc2'))[_0x24fa('0x9b')]():'','disposition':_0x1a43eb['disposition'],'visibility':_0x1a43eb[_0x24fa('0xdf')]?_0x24fa('0xe0'):'Private','messages':_(_0x1a43eb['Messages'])['filter']({'secret':![]})[_0x24fa('0x32')](function(_0xd0cd0b){if(_0xd0cd0b[_0x24fa('0xd4')]){var _0x23cc19=path[_0x24fa('0xe1')](_0x401aab,_0xd0cd0b[_0x24fa('0xd4')]['basename']);if(fs[_0x24fa('0xe2')](_0x23cc19)){fs[_0x24fa('0xe3')](_0x23cc19)['pipe'](fs['createWriteStream'](path[_0x24fa('0xe1')](_0x259de8,_0xd0cd0b[_0x24fa('0xd4')]['basename'])));}}return{'date':moment(_0xd0cd0b[_0x24fa('0xd5')])[_0x24fa('0xc1')](_0x24fa('0xc2'))[_0x24fa('0x9b')](),'sender':_0xd0cd0b['direction']==='out'?_0xd0cd0b[_0x24fa('0xd0')]?_0xd0cd0b[_0x24fa('0xd0')][_0x24fa('0x33')]:'System':_0xd0cd0b['Contact'][_0x24fa('0xd2')]+(_0xd0cd0b[_0x24fa('0x69')]['lastName']?'\x20'+_0xd0cd0b['Contact'][_0x24fa('0xd3')]:''),'body':_0xd0cd0b[_0x24fa('0xd4')]?_0xd0cd0b[_0x24fa('0xd4')][_0x24fa('0xe4')]:_0xd0cd0b[_0x24fa('0xb9')],'direction':_0xd0cd0b[_0x24fa('0xe5')]===_0x24fa('0xe6')?'A':'C','secret':_0xd0cd0b[_0x24fa('0xd6')],'read':_0xd0cd0b[_0x24fa('0x81')],'attachment':_0xd0cd0b[_0x24fa('0xd4')]};})['value']()};return ejs[_0x24fa('0xe7')](path['join'](config[_0x24fa('0xca')],_0x24fa('0xcb'),_0x24fa('0xe8'),_0x24fa('0xe9')),{'interaction':_0x5136f7})[_0x24fa('0x2c')](function(_0x5ccb94){var _0x557e73=path[_0x24fa('0xe1')](_0x259de8,'transcript-'+_0x1a43eb['id']+'-'+_0x37c579+'.pdf');var _0xaad5fd={'path':_0x557e73,'channel':_0x24fa('0xdb'),'interactionId':_0x1a43eb['id']};return pdf[_0x24fa('0xea')](_0x5ccb94,_0xaad5fd);})['then'](function(){return new BPromise(function(_0x3b9e38,_0x80bbf){zipdir(_0x259de8,{'saveTo':_0x56d0d2},function(_0x634513,_0x31dd42){if(_0x634513)return _0x80bbf(_0x634513);return _0x3b9e38(_0x31dd42);});})[_0x24fa('0x2c')](function(){return new BPromise(function(_0x239afd,_0x3b3360){rimraf(_0x259de8,function(_0x3f36aa){if(_0x3f36aa)_0x3b3360(_0x3f36aa);return _0x239afd();});});})[_0x24fa('0x2c')](function(){return _0x4d5454[_0x24fa('0xc8')](_0x56d0d2,_0x12520c,function(_0x48a0ca){if(_0x48a0ca){console[_0x24fa('0xeb')](_0x24fa('0xec'),_0x48a0ca);}else{fs['unlinkSync'](_0x56d0d2);}});});});}else{return _0x4d5454[_0x24fa('0x1f')](0xc8);}})['catch'](handleError(_0x4d5454,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0bdbe48..da2729f 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 _0xa084=['Users','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','remove','getUsers','then','setDataValue'];(function(_0x8dfaf4,_0x5a516b){var _0x3e5511=function(_0x1c3bf2){while(--_0x1c3bf2){_0x8dfaf4['push'](_0x8dfaf4['shift']());}};_0x3e5511(++_0x5a516b);}(_0xa084,0xc8));var _0x4a08=function(_0x245ea5,_0x2a6ee9){_0x245ea5=_0x245ea5-0x0;var _0x26b4c3=_0xa084[_0x245ea5];return _0x26b4c3;};'use strict';var EventEmitter=require(_0x4a08('0x0'));var OpenchannelInteraction=require(_0x4a08('0x1'))['db'][_0x4a08('0x2')];var OpenchannelMessage=require(_0x4a08('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4a08('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4a08('0x4')};function emitEvent(_0x336c6a){return function(_0x2d1537,_0x191182,_0xe78272){_0x2d1537[_0x4a08('0x5')]({'attributes':['id'],'raw':!![]})[_0x4a08('0x6')](function(_0x1810f2){_0x2d1537[_0x4a08('0x7')](_0x4a08('0x8'),_0x1810f2['map'](function(_0x4b7b18){return{'id':_0x4b7b18['id']};}));return OpenchannelMessage[_0x4a08('0x9')]({'where':{'OpenchannelInteractionId':_0x2d1537['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x428f62){_0x2d1537[_0x4a08('0x7')]('unreadMessages',_0x428f62[_0x4a08('0xa')]);OpenchannelInteractionEvents[_0x4a08('0xb')](_0x336c6a+':'+_0x2d1537['id'],_0x2d1537);OpenchannelInteractionEvents[_0x4a08('0xb')](_0x336c6a,_0x2d1537);_0xe78272(null);})[_0x4a08('0xc')](_0xe78272(null));};}for(var e in events){if(events[_0x4a08('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x4a08('0xe')](e,emitEvent(event));}}module[_0x4a08('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2ae7=['events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook','exports'];(function(_0x2adb04,_0x4d4356){var _0x3c1bca=function(_0x5e3b88){while(--_0x5e3b88){_0x2adb04['push'](_0x2adb04['shift']());}};_0x3c1bca(++_0x4d4356);}(_0x2ae7,0x1f0));var _0x72ae=function(_0xd506ba,_0x3fef95){_0xd506ba=_0xd506ba-0x0;var _0x45f1e1=_0x2ae7[_0xd506ba];return _0x45f1e1;};'use strict';var EventEmitter=require(_0x72ae('0x0'));var OpenchannelInteraction=require(_0x72ae('0x1'))['db'][_0x72ae('0x2')];var OpenchannelMessage=require(_0x72ae('0x1'))['db'][_0x72ae('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x72ae('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x72ae('0x5'),'afterDestroy':'remove'};function emitEvent(_0x17796a){return function(_0x4357a9,_0x1eb55a,_0x525cbf){_0x4357a9['getUsers']({'attributes':['id'],'raw':!![]})[_0x72ae('0x6')](function(_0x31c1db){_0x4357a9[_0x72ae('0x7')](_0x72ae('0x8'),_0x31c1db[_0x72ae('0x9')](function(_0x914038){return{'id':_0x914038['id']};}));return OpenchannelMessage[_0x72ae('0xa')]({'where':{'OpenchannelInteractionId':_0x4357a9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x72ae('0x6')](function(_0x83df0e){_0x4357a9[_0x72ae('0x7')](_0x72ae('0xb'),_0x83df0e['length']);OpenchannelInteractionEvents[_0x72ae('0xc')](_0x17796a+':'+_0x4357a9['id'],_0x4357a9);OpenchannelInteractionEvents[_0x72ae('0xc')](_0x17796a,_0x4357a9);_0x525cbf(null);})[_0x72ae('0xd')](_0x525cbf(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x72ae('0xe')](e,emitEvent(event));}}module[_0x72ae('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 5972bb9..bbd1b93 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 _0xba75=['format','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_interactions','closed','closedAt'];(function(_0x25d17d,_0x4d5bf3){var _0x43144f=function(_0x3aaa71){while(--_0x3aaa71){_0x25d17d['push'](_0x25d17d['shift']());}};_0x43144f(++_0x4d5bf3);}(_0xba75,0x1a5));var _0x5ba7=function(_0x9a7ea6,_0x1807a2){_0x9a7ea6=_0x9a7ea6-0x0;var _0x1c2040=_0xba75[_0x9a7ea6];return _0x1c2040;};'use strict';var _=require(_0x5ba7('0x0'));var util=require(_0x5ba7('0x1'));var logger=require('../../config/logger')(_0x5ba7('0x2'));var moment=require(_0x5ba7('0x3'));var BPromise=require('bluebird');var rp=require(_0x5ba7('0x4'));var fs=require('fs');var path=require(_0x5ba7('0x5'));var rimraf=require(_0x5ba7('0x6'));var config=require(_0x5ba7('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x5ba7('0x8')]=function(_0xaefb39,_0x4ec4ea){return _0xaefb39[_0x5ba7('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x5ba7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x55e367,_0x5250f8,_0x15b9f2){if(_0x55e367['changed'](_0x5ba7('0xb'))){_0x55e367[_0x5ba7('0xc')]=moment()[_0x5ba7('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x15b9f2(null,_0x55e367);}}});}; \ No newline at end of file +var _0xcea0=['OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x3bf4a4,_0x51c2b1){var _0x592a68=function(_0x4db027){while(--_0x4db027){_0x3bf4a4['push'](_0x3bf4a4['shift']());}};_0x592a68(++_0x51c2b1);}(_0xcea0,0x194));var _0x0cea=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xcea0[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x0cea('0x0'));var util=require(_0x0cea('0x1'));var logger=require(_0x0cea('0x2'))('api');var moment=require(_0x0cea('0x3'));var BPromise=require(_0x0cea('0x4'));var rp=require(_0x0cea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cea('0x6'));var config=require(_0x0cea('0x7'));var attributes=require(_0x0cea('0x8'));module[_0x0cea('0x9')]=function(_0x35dbd8,_0x5bffbf){return _0x35dbd8['define'](_0x0cea('0xa'),attributes,{'tableName':_0x0cea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0cea('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x2ef215,_0x341ee8,_0x4a525f){if(_0x2ef215[_0x0cea('0xd')](_0x0cea('0xe'))){_0x2ef215[_0x0cea('0xf')]=moment()[_0x0cea('0x10')](_0x0cea('0x11'));}_0x4a525f(null,_0x2ef215);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 87eabfb..a9aa125 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 _0xe55a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','OpenchannelInteraction','options','attributes','limit','UpdateOpenchannelInteraction','stringify','catch','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment'];(function(_0x36341c,_0x4133a7){var _0x144c6d=function(_0x5d658f){while(--_0x5d658f){_0x36341c['push'](_0x36341c['shift']());}};_0x144c6d(++_0x4133a7);}(_0xe55a,0xc6));var _0xae55=function(_0x19d501,_0x364820){_0x19d501=_0x19d501-0x0;var _0x293e33=_0xe55a[_0x19d501];return _0x293e33;};'use strict';var _=require(_0xae55('0x0'));var util=require('util');var moment=require(_0xae55('0x1'));var BPromise=require(_0xae55('0x2'));var rs=require(_0xae55('0x3'));var fs=require('fs');var Redis=require(_0xae55('0x4'));var db=require(_0xae55('0x5'))['db'];var utils=require(_0xae55('0x6'));var logger=require(_0xae55('0x7'))(_0xae55('0x8'));var config=require('../../config/environment');var jayson=require(_0xae55('0x9'));var client=jayson['client'][_0xae55('0xa')]({'port':0x232a});config[_0xae55('0xb')]=_['defaults'](config['redis'],{'host':_0xae55('0xc'),'port':0x18eb});var socket=require(_0xae55('0xd'))(new Redis(config[_0xae55('0xb')]));require(_0xae55('0xe'))['register'](socket);function respondWithRpcPromise(_0x45b7b7,_0x4d2390,_0x112e20){return new BPromise(function(_0x1989d4,_0x26c823){return client[_0xae55('0xf')](_0x45b7b7,_0x112e20)[_0xae55('0x10')](function(_0x3dd926){logger[_0xae55('0x11')](_0xae55('0x12'),_0x4d2390,_0xae55('0x13'));logger[_0xae55('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4d2390,'request\x20sent',JSON['stringify'](_0x3dd926));if(_0x3dd926[_0xae55('0x15')]){if(_0x3dd926['error'][_0xae55('0x16')]===0x1f4){logger[_0xae55('0x15')](_0xae55('0x12'),_0x4d2390,_0x3dd926[_0xae55('0x15')][_0xae55('0x17')]);return _0x26c823(_0x3dd926[_0xae55('0x15')][_0xae55('0x17')]);}logger[_0xae55('0x15')](_0xae55('0x12'),_0x4d2390,_0x3dd926[_0xae55('0x15')][_0xae55('0x17')]);return _0x1989d4(_0x3dd926[_0xae55('0x15')][_0xae55('0x17')]);}else{logger['info'](_0xae55('0x12'),_0x4d2390,'request\x20sent');_0x1989d4(_0x3dd926[_0xae55('0x18')]['message']);}})['catch'](function(_0x3fbbd7){logger['error'](_0xae55('0x12'),_0x4d2390,_0x3fbbd7);_0x26c823(_0x3fbbd7);});});}exports['UpdateOpenchannelInteraction']=function(_0x417586){var _0x2719c8=this;return new Promise(function(_0x2e7b2b,_0x4e4983){return db[_0xae55('0x19')]['update'](_0x417586['body'],{'raw':_0x417586['options']?_0x417586[_0xae55('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417586[_0xae55('0x1a')]?_0x417586[_0xae55('0x1a')]['where']||null:null,'attributes':_0x417586[_0xae55('0x1a')]?_0x417586[_0xae55('0x1a')][_0xae55('0x1b')]||null:null,'limit':_0x417586[_0xae55('0x1a')]?_0x417586[_0xae55('0x1a')][_0xae55('0x1c')]||null:null})[_0xae55('0x10')](function(_0x1964ea){logger[_0xae55('0x11')](_0xae55('0x1d'),_0x417586);logger[_0xae55('0x14')](_0xae55('0x1d'),_0x417586,JSON[_0xae55('0x1e')](_0x1964ea));_0x2e7b2b(_0x1964ea);})[_0xae55('0x1f')](function(_0x5e6aab){logger[_0xae55('0x15')](_0xae55('0x1d'),_0x5e6aab[_0xae55('0x17')],_0x417586);_0x4e4983(_0x2719c8[_0xae55('0x15')](0x1f4,_0x5e6aab['message']));});});};exports[_0xae55('0x20')]=function(_0x5a3370){return new Promise(function(_0x47eb27,_0x37b1a8){return db[_0xae55('0x19')][_0xae55('0x21')]({'where':_0x5a3370[_0xae55('0x1a')]?_0x5a3370[_0xae55('0x1a')]['where']||null:null})[_0xae55('0x10')](function(_0x459566){if(_0x459566){return _0x459566[_0xae55('0x22')](_0x5a3370[_0xae55('0x23')][_0xae55('0x24')],_[_0xae55('0x25')](_0x5a3370[_0xae55('0x23')],[_0xae55('0x24'),'id'])||{});}})[_0xae55('0x26')](function(_0x35f181){logger['info'](_0xae55('0x27'),_0x5a3370);logger[_0xae55('0x14')](_0xae55('0x27'),_0x5a3370,JSON[_0xae55('0x1e')](_0x35f181));_0x47eb27(_0x35f181);})[_0xae55('0x1f')](function(_0x3ca959){logger['error']('AddTags',_0x3ca959[_0xae55('0x17')],_0x5a3370);_0x37b1a8(_this[_0xae55('0x15')](0x1f4,_0x3ca959['message']));});});}; \ No newline at end of file +var _0x9d9e=['defaults','localhost','./openchannelInteraction.socket','register','then','request\x20sent','debug','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','info','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x5da63e,_0x4d3503){var _0x442aca=function(_0x6d5bca){while(--_0x6d5bca){_0x5da63e['push'](_0x5da63e['shift']());}};_0x442aca(++_0x4d3503);}(_0x9d9e,0x9f));var _0xe9d9=function(_0x1fd2e6,_0x319411){_0x1fd2e6=_0x1fd2e6-0x0;var _0x38284b=_0x9d9e[_0x1fd2e6];return _0x38284b;};'use strict';var _=require(_0xe9d9('0x0'));var util=require(_0xe9d9('0x1'));var moment=require(_0xe9d9('0x2'));var BPromise=require(_0xe9d9('0x3'));var rs=require(_0xe9d9('0x4'));var fs=require('fs');var Redis=require(_0xe9d9('0x5'));var db=require(_0xe9d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9d9('0x7'))(_0xe9d9('0x8'));var config=require('../../config/environment');var jayson=require(_0xe9d9('0x9'));var client=jayson[_0xe9d9('0xa')][_0xe9d9('0xb')]({'port':0x232a});config[_0xe9d9('0xc')]=_[_0xe9d9('0xd')](config['redis'],{'host':_0xe9d9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe9d9('0xf'))[_0xe9d9('0x10')](socket);function respondWithRpcPromise(_0x18a520,_0xf7222a,_0x206a19){return new BPromise(function(_0x304753,_0x5c5998){return client['request'](_0x18a520,_0x206a19)[_0xe9d9('0x11')](function(_0xbf932f){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xf7222a,_0xe9d9('0x12'));logger[_0xe9d9('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xf7222a,_0xe9d9('0x12'),JSON['stringify'](_0xbf932f));if(_0xbf932f[_0xe9d9('0x14')]){if(_0xbf932f[_0xe9d9('0x14')][_0xe9d9('0x15')]===0x1f4){logger[_0xe9d9('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0xf7222a,_0xbf932f[_0xe9d9('0x14')][_0xe9d9('0x16')]);return _0x5c5998(_0xbf932f[_0xe9d9('0x14')][_0xe9d9('0x16')]);}logger[_0xe9d9('0x14')](_0xe9d9('0x17'),_0xf7222a,_0xbf932f[_0xe9d9('0x14')]['message']);return _0x304753(_0xbf932f['error'][_0xe9d9('0x16')]);}else{logger[_0xe9d9('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0xf7222a,'request\x20sent');_0x304753(_0xbf932f['result'][_0xe9d9('0x16')]);}})[_0xe9d9('0x19')](function(_0x4e7254){logger['error'](_0xe9d9('0x17'),_0xf7222a,_0x4e7254);_0x5c5998(_0x4e7254);});});}exports[_0xe9d9('0x1a')]=function(_0x446c90){var _0x4a8a7e=this;return new Promise(function(_0x5c69e9,_0x169d90){return db[_0xe9d9('0x1b')][_0xe9d9('0x1c')](_0x446c90['body'],{'raw':_0x446c90['options']?_0x446c90[_0xe9d9('0x1d')][_0xe9d9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x446c90[_0xe9d9('0x1d')]?_0x446c90[_0xe9d9('0x1d')][_0xe9d9('0x1f')]||null:null,'attributes':_0x446c90[_0xe9d9('0x1d')]?_0x446c90[_0xe9d9('0x1d')][_0xe9d9('0x20')]||null:null,'limit':_0x446c90['options']?_0x446c90[_0xe9d9('0x1d')][_0xe9d9('0x21')]||null:null})[_0xe9d9('0x11')](function(_0x5bbf66){logger[_0xe9d9('0x18')]('UpdateOpenchannelInteraction',_0x446c90);logger[_0xe9d9('0x13')](_0xe9d9('0x1a'),_0x446c90,JSON[_0xe9d9('0x22')](_0x5bbf66));_0x5c69e9(_0x5bbf66);})[_0xe9d9('0x19')](function(_0x5b49dc){logger['error'](_0xe9d9('0x1a'),_0x5b49dc['message'],_0x446c90);_0x169d90(_0x4a8a7e[_0xe9d9('0x14')](0x1f4,_0x5b49dc[_0xe9d9('0x16')]));});});};exports[_0xe9d9('0x23')]=function(_0x5c6e56){return new Promise(function(_0x57bdd1,_0x524419){return db[_0xe9d9('0x1b')][_0xe9d9('0x24')]({'where':_0x5c6e56[_0xe9d9('0x1d')]?_0x5c6e56[_0xe9d9('0x1d')][_0xe9d9('0x1f')]||null:null})[_0xe9d9('0x11')](function(_0x4ba77d){if(_0x4ba77d){return _0x4ba77d[_0xe9d9('0x25')](_0x5c6e56[_0xe9d9('0x26')][_0xe9d9('0x27')],_[_0xe9d9('0x28')](_0x5c6e56[_0xe9d9('0x26')],[_0xe9d9('0x27'),'id'])||{});}})[_0xe9d9('0x29')](function(_0x115a03){logger[_0xe9d9('0x18')](_0xe9d9('0x2a'),_0x5c6e56);logger[_0xe9d9('0x13')]('AddTags',_0x5c6e56,JSON[_0xe9d9('0x22')](_0x115a03));_0x57bdd1(_0x115a03);})[_0xe9d9('0x19')](function(_0x2cd14d){logger[_0xe9d9('0x14')](_0xe9d9('0x2a'),_0x2cd14d[_0xe9d9('0x16')],_0x5c6e56);_0x524419(_this['error'](0x1f4,_0x2cd14d[_0xe9d9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b1ecc6f..8bb3d99 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 _0xd040=['remove','update','removeListener','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd040,0x166));var _0x0d04=function(_0x3b4241,_0x57dcb1){_0x3b4241=_0x3b4241-0x0;var _0x19942b=_0xd040[_0x3b4241];return _0x19942b;};'use strict';var OpenchannelInteractionEvents=require(_0x0d04('0x0'));var events=[_0x0d04('0x1'),_0x0d04('0x2'),_0x0d04('0x3')];function createListener(_0x12767e,_0x1f2513){return function(_0x5997db){_0x1f2513['emit'](_0x12767e,_0x5997db);};}function removeListener(_0x4d864a,_0x599b02){return function(){OpenchannelInteractionEvents[_0x0d04('0x4')](_0x4d864a,_0x599b02);};}exports['register']=function(_0x5182e6){for(var _0x4d684f=0x0,_0x4dabcf=events['length'];_0x4d684f<_0x4dabcf;_0x4d684f++){var _0x9a9bab=events[_0x4d684f];var _0x1a6a71=createListener(_0x0d04('0x5')+_0x9a9bab,_0x5182e6);OpenchannelInteractionEvents['on'](_0x9a9bab,_0x1a6a71);}}; \ No newline at end of file +var _0xa51a=['./openchannelInteraction.events','save','remove','emit','removeListener','length'];(function(_0xd76c0,_0xd6d52){var _0x2a2671=function(_0x31ee1c){while(--_0x31ee1c){_0xd76c0['push'](_0xd76c0['shift']());}};_0x2a2671(++_0xd6d52);}(_0xa51a,0x14a));var _0xaa51=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xa51a[_0x1e3c16];return _0x47a0c9;};'use strict';var OpenchannelInteractionEvents=require(_0xaa51('0x0'));var events=[_0xaa51('0x1'),_0xaa51('0x2'),'update'];function createListener(_0x4da64c,_0x324a24){return function(_0x545d57){_0x324a24[_0xaa51('0x3')](_0x4da64c,_0x545d57);};}function removeListener(_0x326547,_0x387dea){return function(){OpenchannelInteractionEvents[_0xaa51('0x4')](_0x326547,_0x387dea);};}exports['register']=function(_0x2f1947){for(var _0x3b2118=0x0,_0x39320b=events[_0xaa51('0x5')];_0x3b2118<_0x39320b;_0x3b2118++){var _0x38d178=events[_0x3b2118];var _0x2c6913=createListener('openchannelInteraction:'+_0x38d178,_0x2f1947);OpenchannelInteractionEvents['on'](_0x38d178,_0x2c6913);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8784b8f..da54985 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x2c94a5,_0x128193){var _0x472eac=function(_0x4ab9af){while(--_0x4ab9af){_0x2c94a5['push'](_0x2c94a5['shift']());}};_0x472eac(++_0x128193);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x13a7a2,_0x28589a){var _0x3e6e0a=function(_0x63de6f){while(--_0x63de6f){_0x13a7a2['push'](_0x13a7a2['shift']());}};_0x3e6e0a(++_0x28589a);}(_0xe706,0xa3));var _0x6e70=function(_0x56d591,_0x3191a3){_0x56d591=_0x56d591-0x0;var _0x4bf0ff=_0xe706[_0x56d591];return _0x4bf0ff;};'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')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 493737c..df58b83 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 _0x97db=['TEXT','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0xc95d4c,_0x5623b8){var _0x3ba08c=function(_0x45a276){while(--_0x45a276){_0xc95d4c['push'](_0xc95d4c['shift']());}};_0x3ba08c(++_0x5623b8);}(_0x97db,0x1b4));var _0xb97d=function(_0x5d4bfe,_0x154586){_0x5d4bfe=_0x5d4bfe-0x0;var _0x426790=_0x97db[_0x5d4bfe];return _0x426790;};'use strict';var Sequelize=require(_0xb97d('0x0'));module[_0xb97d('0x1')]={'body':{'type':Sequelize[_0xb97d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xb97d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb97d('0x4')]('in',_0xb97d('0x5')),'defaultValue':_0xb97d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb97d('0x2')]}}; \ No newline at end of file +var _0x63c6=['DATE','STRING','TEXT','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x50b2d4,_0x26874c){var _0x42f56b=function(_0x3c8190){while(--_0x3c8190){_0x50b2d4['push'](_0x50b2d4['shift']());}};_0x42f56b(++_0x26874c);}(_0x63c6,0xbb));var _0x663c=function(_0x58af75,_0x1a6a22){_0x58af75=_0x58af75-0x0;var _0x32a5ad=_0x63c6[_0x58af75];return _0x32a5ad;};'use strict';var Sequelize=require(_0x663c('0x0'));module[_0x663c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x663c('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x663c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x663c('0x3')]('in',_0x663c('0x4')),'defaultValue':_0x663c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x663c('0x5')]},'providerName':{'type':Sequelize[_0x663c('0x6')]},'providerResponse':{'type':Sequelize[_0x663c('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6915a33..737d1d2 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 _0xda5b=['map','OpenchannelMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','show','options','find','catch','create','body','params','describe','../../config/logger','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','event','EventManager','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','info','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','stack','name','send','index'];(function(_0x3ae93b,_0x2a999d){var _0x433c8a=function(_0x4e8d3a){while(--_0x4e8d3a){_0x3ae93b['push'](_0x3ae93b['shift']());}};_0x433c8a(++_0x2a999d);}(_0xda5b,0xc8));var _0xbda5=function(_0x2c7f80,_0x2b0052){_0x2c7f80=_0x2c7f80-0x0;var _0x11fe38=_0xda5b[_0x2c7f80];return _0x11fe38;};'use strict';var emlformat=require(_0xbda5('0x0'));var rimraf=require(_0xbda5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbda5('0x2'));var rp=require(_0xbda5('0x3'));var moment=require('moment');var BPromise=require(_0xbda5('0x4'));var Mustache=require('mustache');var util=require(_0xbda5('0x5'));var path=require(_0xbda5('0x6'));var sox=require(_0xbda5('0x7'));var csv=require(_0xbda5('0x8'));var ejs=require(_0xbda5('0x9'));var fs=require('fs');var fs_extra=require(_0xbda5('0xa'));var _=require(_0xbda5('0xb'));var squel=require(_0xbda5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbda5('0xd'));var toCsv=require(_0xbda5('0x8'));var querystring=require('querystring');var Papa=require(_0xbda5('0xe'));var Redis=require('ioredis');var authService=require(_0xbda5('0xf'));var qs=require(_0xbda5('0x10'));var as=require(_0xbda5('0x11'));var hardwareService=require(_0xbda5('0x12'));var logger=require('../../config/logger')(_0xbda5('0x13'));var utils=require(_0xbda5('0x14'));var config=require(_0xbda5('0x15'));var licenseUtil=require(_0xbda5('0x16'));var db=require(_0xbda5('0x17'))['db'];config[_0xbda5('0x18')]=_[_0xbda5('0x19')](config[_0xbda5('0x18')],{'host':_0xbda5('0x1a'),'port':0x18eb});var socket=require(_0xbda5('0x1b'))(new Redis(config[_0xbda5('0x18')]));require(_0xbda5('0x1c'))[_0xbda5('0x1d')](socket);var jayson=require(_0xbda5('0x1e'));var client=jayson[_0xbda5('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xbda5('0x1f')][_0xbda5('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5357a7,_0x374186,_0x2e5d70,_0x5ef727){return new BPromise(function(_0x237755,_0x11828d){var _0x214584=_0x5ef727||client;return _0x214584[_0xbda5('0x21')](_0x5357a7,_0x2e5d70)[_0xbda5('0x22')](function(_0x4cd02c){logger['info'](_0xbda5('0x23'),_0x374186,_0xbda5('0x24'));logger[_0xbda5('0x25')](_0xbda5('0x26'),_0x374186,_0xbda5('0x24'),JSON['stringify'](_0x4cd02c));if(_0x4cd02c[_0xbda5('0x27')]){if(_0x4cd02c[_0xbda5('0x27')]['code']===0x1f4){logger[_0xbda5('0x27')](_0xbda5('0x23'),_0x374186,_0x4cd02c['error'][_0xbda5('0x28')]);return _0x11828d(_0x4cd02c[_0xbda5('0x27')][_0xbda5('0x28')]);}logger['error'](_0xbda5('0x23'),_0x374186,_0x4cd02c[_0xbda5('0x27')]['message']);return _0x237755(_0x4cd02c['error']['message']);}else{logger[_0xbda5('0x29')](_0xbda5('0x23'),_0x374186,'request\x20sent');_0x237755(_0x4cd02c['result']['message']);}})['catch'](function(_0x56649d){logger[_0xbda5('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x374186,_0x56649d);_0x11828d(_0x56649d);});});}function respondWithStatusCode(_0x2a8cc9,_0x1203fe){_0x1203fe=_0x1203fe||0xcc;return function(_0x4dd91e){if(_0x4dd91e){return _0x2a8cc9[_0xbda5('0x2a')](_0x1203fe);}return _0x2a8cc9[_0xbda5('0x2b')](_0x1203fe)[_0xbda5('0x2c')]();};}function respondWithResult(_0x2dc568,_0x213f99){_0x213f99=_0x213f99||0xc8;return function(_0x2af686){if(_0x2af686){return _0x2dc568[_0xbda5('0x2b')](_0x213f99)['json'](_0x2af686);}};}function respondWithFilteredResult(_0x1ef716,_0x4bb53a){return function(_0x14aba7){if(_0x14aba7){var _0x240261=typeof _0x4bb53a[_0xbda5('0x2d')]==='undefined'&&typeof _0x4bb53a[_0xbda5('0x2e')]===_0xbda5('0x2f');var _0x439a40=_0x14aba7['count'];var _0x14cce6=_0x240261?0x0:_0x4bb53a[_0xbda5('0x2d')];var _0x3c441b=_0x240261?_0x14aba7[_0xbda5('0x30')]:_0x4bb53a['offset']+_0x4bb53a[_0xbda5('0x2e')];var _0x4ce8d0;if(_0x3c441b>=_0x439a40){_0x3c441b=_0x439a40;_0x4ce8d0=0xc8;}else{_0x4ce8d0=0xce;}_0x1ef716[_0xbda5('0x2b')](_0x4ce8d0);return _0x1ef716[_0xbda5('0x31')]('Content-Range',_0x14cce6+'-'+_0x3c441b+'/'+_0x439a40)[_0xbda5('0x32')](_0x14aba7);}return null;};}function patchUpdates(_0x1c6b5a){return function(_0x432406){try{jsonpatch[_0xbda5('0x33')](_0x432406,_0x1c6b5a,!![]);}catch(_0xf4a43c){return BPromise[_0xbda5('0x34')](_0xf4a43c);}return _0x432406[_0xbda5('0x35')]();};}function saveUpdates(_0x392f27,_0x475924){return function(_0x3da087){if(_0x3da087){return _0x3da087[_0xbda5('0x36')](_0x392f27)[_0xbda5('0x22')](function(_0x884aa1){return _0x884aa1;});}return null;};}function removeEntity(_0x1ec28c,_0x46e641){return function(_0x5215e7){if(_0x5215e7){return _0x5215e7[_0xbda5('0x37')]()[_0xbda5('0x22')](function(){_0x1ec28c[_0xbda5('0x2b')](0xcc)[_0xbda5('0x2c')]();});}};}function handleEntityNotFound(_0x149f8a,_0x2440e1){return function(_0x1cf0f7){if(!_0x1cf0f7){_0x149f8a[_0xbda5('0x2a')](0x194);}return _0x1cf0f7;};}function handleError(_0x1146d0,_0x53491b){_0x53491b=_0x53491b||0x1f4;return function(_0xad70bb){logger[_0xbda5('0x27')](_0xad70bb[_0xbda5('0x38')]);if(_0xad70bb[_0xbda5('0x39')]){delete _0xad70bb[_0xbda5('0x39')];}_0x1146d0[_0xbda5('0x2b')](_0x53491b)[_0xbda5('0x3a')](_0xad70bb);};}exports[_0xbda5('0x3b')]=function(_0x3c6e1d,_0x18be27){var _0x5a6a9c={},_0x3f023c={},_0x4f3642={'count':0x0,'rows':[]};var _0x18d8f3=_[_0xbda5('0x3c')](db[_0xbda5('0x3d')][_0xbda5('0x3e')],function(_0x27912e){return{'name':_0x27912e[_0xbda5('0x3f')],'type':_0x27912e['type']['key']};});_0x3f023c[_0xbda5('0x40')]=_[_0xbda5('0x3c')](_0x18d8f3,_0xbda5('0x39'));_0x3f023c[_0xbda5('0x41')]=_[_0xbda5('0x42')](_0x3c6e1d[_0xbda5('0x41')]);_0x3f023c[_0xbda5('0x43')]=_[_0xbda5('0x44')](_0x3f023c[_0xbda5('0x40')],_0x3f023c[_0xbda5('0x41')]);_0x5a6a9c[_0xbda5('0x45')]=_['intersection'](_0x3f023c[_0xbda5('0x40')],qs[_0xbda5('0x46')](_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x46')]));_0x5a6a9c[_0xbda5('0x45')]=_0x5a6a9c[_0xbda5('0x45')][_0xbda5('0x47')]?_0x5a6a9c['attributes']:_0x3f023c[_0xbda5('0x40')];if(!_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x48')](_0xbda5('0x49'))){_0x5a6a9c[_0xbda5('0x2e')]=qs[_0xbda5('0x2e')](_0x3c6e1d[_0xbda5('0x41')]['limit']);_0x5a6a9c['offset']=qs[_0xbda5('0x2d')](_0x3c6e1d[_0xbda5('0x41')]['offset']);}_0x5a6a9c[_0xbda5('0x4a')]=qs[_0xbda5('0x4b')](_0x3c6e1d[_0xbda5('0x41')]['sort']);_0x5a6a9c[_0xbda5('0x4c')]=qs[_0xbda5('0x43')](_['pick'](_0x3c6e1d['query'],_0x3f023c[_0xbda5('0x43')]),_0x18d8f3);if(_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x4d')]){_0x5a6a9c[_0xbda5('0x4c')]=_['merge'](_0x5a6a9c[_0xbda5('0x4c')],{'$or':_['map'](_0x18d8f3,function(_0x377336){if(_0x377336[_0xbda5('0x4e')]!==_0xbda5('0x4f')){var _0xd6355c={};_0xd6355c[_0x377336[_0xbda5('0x39')]]={'$like':'%'+_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x4d')]+'%'};return _0xd6355c;}})});}_0x5a6a9c=_[_0xbda5('0x50')]({},_0x5a6a9c,_0x3c6e1d['options']);var _0x28d391={'where':_0x5a6a9c[_0xbda5('0x4c')]};return db[_0xbda5('0x3d')][_0xbda5('0x30')](_0x28d391)[_0xbda5('0x22')](function(_0x53123f){_0x4f3642[_0xbda5('0x30')]=_0x53123f;if(_0x3c6e1d[_0xbda5('0x41')][_0xbda5('0x51')]){_0x5a6a9c[_0xbda5('0x52')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xbda5('0x53')](_0x5a6a9c);})[_0xbda5('0x22')](function(_0x9b97bd){_0x4f3642['rows']=_0x9b97bd;return _0x4f3642;})[_0xbda5('0x22')](respondWithFilteredResult(_0x18be27,_0x5a6a9c))['catch'](handleError(_0x18be27,null));};exports[_0xbda5('0x54')]=function(_0x4ab261,_0x4fb24d){var _0x18614f={'raw':!![],'where':{'id':_0x4ab261['params']['id']}},_0x4e2ad9={};_0x4e2ad9[_0xbda5('0x40')]=_['keys'](db[_0xbda5('0x3d')]['rawAttributes']);_0x4e2ad9[_0xbda5('0x41')]=_[_0xbda5('0x42')](_0x4ab261[_0xbda5('0x41')]);_0x4e2ad9[_0xbda5('0x43')]=_[_0xbda5('0x44')](_0x4e2ad9[_0xbda5('0x40')],_0x4e2ad9[_0xbda5('0x41')]);_0x18614f[_0xbda5('0x45')]=_['intersection'](_0x4e2ad9[_0xbda5('0x40')],qs[_0xbda5('0x46')](_0x4ab261[_0xbda5('0x41')][_0xbda5('0x46')]));_0x18614f[_0xbda5('0x45')]=_0x18614f[_0xbda5('0x45')][_0xbda5('0x47')]?_0x18614f[_0xbda5('0x45')]:_0x4e2ad9[_0xbda5('0x40')];if(_0x4ab261[_0xbda5('0x41')][_0xbda5('0x51')]){_0x18614f[_0xbda5('0x52')]=[{'all':!![]}];}_0x18614f=_[_0xbda5('0x50')]({},_0x18614f,_0x4ab261[_0xbda5('0x55')]);return db['OpenchannelMessage'][_0xbda5('0x56')](_0x18614f)[_0xbda5('0x22')](handleEntityNotFound(_0x4fb24d,null))[_0xbda5('0x22')](respondWithResult(_0x4fb24d,null))[_0xbda5('0x57')](handleError(_0x4fb24d,null));};exports[_0xbda5('0x58')]=function(_0x498f55,_0x2d8695){return db[_0xbda5('0x3d')][_0xbda5('0x58')](_0x498f55[_0xbda5('0x59')],{})[_0xbda5('0x22')](respondWithResult(_0x2d8695,0xc9))[_0xbda5('0x57')](handleError(_0x2d8695,null));};exports[_0xbda5('0x36')]=function(_0x3f2200,_0x18409d){if(_0x3f2200[_0xbda5('0x59')]['id']){delete _0x3f2200[_0xbda5('0x59')]['id'];}return db['OpenchannelMessage'][_0xbda5('0x56')]({'where':{'id':_0x3f2200[_0xbda5('0x5a')]['id']}})['then'](handleEntityNotFound(_0x18409d,null))[_0xbda5('0x22')](saveUpdates(_0x3f2200[_0xbda5('0x59')],null))[_0xbda5('0x22')](respondWithResult(_0x18409d,null))[_0xbda5('0x57')](handleError(_0x18409d,null));};exports[_0xbda5('0x37')]=function(_0xbbfe06,_0x3b1dc8){return db[_0xbda5('0x3d')][_0xbda5('0x56')]({'where':{'id':_0xbbfe06[_0xbda5('0x5a')]['id']}})[_0xbda5('0x22')](handleEntityNotFound(_0x3b1dc8,null))[_0xbda5('0x22')](removeEntity(_0x3b1dc8,null))[_0xbda5('0x57')](handleError(_0x3b1dc8,null));};exports['describe']=function(_0x18bf2d,_0x40efb4){return db['OpenchannelMessage'][_0xbda5('0x5b')]()[_0xbda5('0x22')](respondWithResult(_0x40efb4,null))[_0xbda5('0x57')](handleError(_0x40efb4,null));};var interaction_log=require(_0xbda5('0x5c'))('openchannel-interactions');exports[_0xbda5('0x5d')]=function(_0x226299,_0x4d37f7,_0x9790b0){var _0x1096dc={'agent':{},'channel':'openchannel'};if(_0x226299[_0xbda5('0x59')]['id']){delete _0x226299[_0xbda5('0x59')]['id'];}_0x226299[_0xbda5('0x59')]['read']=!![];_0x226299[_0xbda5('0x59')][_0xbda5('0x5e')]=moment()[_0xbda5('0x5f')](_0xbda5('0x60'));_0x226299[_0xbda5('0x59')][_0xbda5('0x61')]=_0x226299[_0xbda5('0x59')][_0xbda5('0x61')]||_0x226299[_0xbda5('0x62')]['id'];_0x1096dc[_0xbda5('0x63')]['id']=_0x226299[_0xbda5('0x59')]['UserId'];return db['OpenchannelMessage'][_0xbda5('0x56')]({'where':{'id':_0x226299[_0xbda5('0x5a')]['id'],'UserId':null}})[_0xbda5('0x22')](handleEntityNotFound(_0x4d37f7,null))['then'](saveUpdates(_0x226299[_0xbda5('0x59')],null))['then'](function(_0x296cc8){if(_0x296cc8){_0x1096dc[_0xbda5('0x28')]=_0x296cc8['get']({'plain':!![]});return db[_0xbda5('0x64')][_0xbda5('0x56')]({'where':{'id':_0x296cc8[_0xbda5('0x65')]}});}return null;})[_0xbda5('0x22')](handleEntityNotFound(_0x4d37f7,null))['then'](function(_0x1026ef){if(_0x1026ef){return _0x1026ef['update']({'UserId':_0x226299[_0xbda5('0x59')][_0xbda5('0x61')],'read1stAt':_[_0xbda5('0x66')](_0x1026ef[_0xbda5('0x67')])?moment()[_0xbda5('0x5f')](_0xbda5('0x60')):undefined});}return null;})[_0xbda5('0x22')](function(_0x4c8745){if(_0x4c8745){_0x1096dc['interaction']=_0x4c8745[_0xbda5('0x68')]({'plain':!![]});interaction_log[_0xbda5('0x29')](_0xbda5('0x69'),_0x226299[_0xbda5('0x62')]['id'],_0x226299[_0xbda5('0x62')]['name'],_0x226299[_0xbda5('0x62')][_0xbda5('0x6a')],_0x1096dc[_0xbda5('0x6b')]['id'],_0x226299[_0xbda5('0x59')]?JSON[_0xbda5('0x6c')](_0x226299[_0xbda5('0x59')]):_0xbda5('0x6d'));return respondWithRpcPromise(_0xbda5('0x6e'),'acceptMessage',_0x1096dc);}return null;})[_0xbda5('0x22')](function(_0x7b8b60){var _0x21438f=_0xbda5('0x6f')+_0x7b8b60['message']['ContactId'];return db[_0xbda5('0x70')][_0xbda5('0x41')](_0x21438f,{'type':db[_0xbda5('0x71')][_0xbda5('0x72')][_0xbda5('0x73')],'raw':!![]})['then'](function(_0xf13e4f){return _0xf13e4f;});})[_0xbda5('0x22')](function(_0x5d7643){if(_0x5d7643){_0x1096dc[_0xbda5('0x28')][_0xbda5('0x74')]=_0x5d7643[0x0];if(!_0x226299[_0xbda5('0x59')][_0xbda5('0x61')])return;return db[_0xbda5('0x75')][_0xbda5('0x56')]({'where':{'id':_0x226299[_0xbda5('0x59')][_0xbda5('0x61')],'role':_0xbda5('0x63')},'attributes':['id',_0xbda5('0x39'),_0xbda5('0x76'),_0xbda5('0x77'),_0xbda5('0x78')],'raw':!![]});}return null;})[_0xbda5('0x22')](function(_0x5180cd){if(!_0x5180cd)return null;_0x1096dc[_0xbda5('0x28')][_0xbda5('0x63')]=_0x5180cd;return _0x1096dc;})[_0xbda5('0x22')](function(_0x13dc3){if(_0x13dc3){if(_0x226299[_0xbda5('0x59')]['manual']){_0x1096dc[_0xbda5('0x28')][_0xbda5('0x79')]=util[_0xbda5('0x5f')]('SIP/%s',_0x226299[_0xbda5('0x62')][_0xbda5('0x39')]);_0x1096dc[_0xbda5('0x28')][_0xbda5('0x7a')]=_0x1096dc[_0xbda5('0x7a')];_0x1096dc['message'][_0xbda5('0x7b')]=_0xbda5('0x5d');return respondWithRpcPromise(_0xbda5('0x7c'),'EventManager',{'event':'acceptmessage','message':_0x1096dc[_0xbda5('0x28')]},client9002)['then'](function(){return _0x1096dc;});}return _0x1096dc;}return null;})['then'](respondWithResult(_0x4d37f7,null))[_0xbda5('0x57')](handleError(_0x4d37f7,null));};var interaction_log=require(_0xbda5('0x5c'))('openchannel-interactions');exports['reject']=function(_0x23e89a,_0x1b195a,_0x3a331e){var _0x2065d6={'agent':{},'channel':_0xbda5('0x7d')};if(_0x23e89a[_0xbda5('0x59')]['id']){delete _0x23e89a['body']['id'];}_0x23e89a[_0xbda5('0x59')]['UserId']=_0x23e89a[_0xbda5('0x59')][_0xbda5('0x61')]||_0x23e89a['user']['id'];_0x2065d6[_0xbda5('0x63')]['id']=_0x23e89a[_0xbda5('0x59')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x23e89a[_0xbda5('0x5a')]['id'],'UserId':null}})[_0xbda5('0x22')](handleEntityNotFound(_0x1b195a,null))[_0xbda5('0x22')](function(_0x311d44){if(_0x311d44){_0x2065d6['message']=_0x311d44['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xbda5('0x56')]({'where':{'id':_0x311d44[_0xbda5('0x65')]}});}return null;})[_0xbda5('0x22')](handleEntityNotFound(_0x1b195a,null))[_0xbda5('0x22')](function(_0x182120){if(_0x182120){_0x2065d6[_0xbda5('0x6b')]=_0x182120[_0xbda5('0x68')]({'plain':!![]});interaction_log['info'](_0xbda5('0x7e'),_0x23e89a[_0xbda5('0x62')]['id'],_0x23e89a[_0xbda5('0x62')][_0xbda5('0x39')],_0x23e89a[_0xbda5('0x62')]['role'],_0x2065d6[_0xbda5('0x6b')]['id'],_0x23e89a['body']?JSON['stringify'](_0x23e89a[_0xbda5('0x59')]):_0xbda5('0x6d'));return respondWithRpcPromise('RejectMessage',_0xbda5('0x7f'),_0x2065d6);}return null;})[_0xbda5('0x22')](function(_0x4f329f){var _0x4009cc='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4f329f[_0xbda5('0x28')]['ContactId'];return db[_0xbda5('0x70')][_0xbda5('0x41')](_0x4009cc,{'type':db[_0xbda5('0x71')][_0xbda5('0x72')][_0xbda5('0x73')],'raw':!![]})['then'](function(_0x618fba){return _0x618fba;});})['then'](function(_0x357164){if(_0x357164){_0x2065d6[_0xbda5('0x28')][_0xbda5('0x74')]=_0x357164[0x0];if(!_0x23e89a[_0xbda5('0x59')]['UserId'])return;return db[_0xbda5('0x75')][_0xbda5('0x56')]({'where':{'id':_0x23e89a['body']['UserId'],'role':_0xbda5('0x63')},'attributes':['id',_0xbda5('0x39'),_0xbda5('0x76'),_0xbda5('0x77'),_0xbda5('0x78')],'raw':!![]});}return null;})[_0xbda5('0x22')](function(_0x4bb14a){if(!_0x4bb14a)return null;_0x2065d6['message'][_0xbda5('0x63')]=_0x4bb14a;return _0x2065d6;})['then'](function(_0x197edd){if(_0x197edd){_0x197edd[_0xbda5('0x28')][_0xbda5('0x79')]=util[_0xbda5('0x5f')](_0xbda5('0x80'),_0x23e89a[_0xbda5('0x62')][_0xbda5('0x39')]);_0x197edd['message'][_0xbda5('0x7a')]=_0x2065d6[_0xbda5('0x7a')];_0x197edd[_0xbda5('0x28')][_0xbda5('0x7b')]=_0xbda5('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0xbda5('0x81'),'message':_0x197edd[_0xbda5('0x28')]},client9002);return _0x2065d6;}return null;})[_0xbda5('0x22')](respondWithResult(_0x1b195a,null))[_0xbda5('0x57')](handleError(_0x1b195a,null));}; \ No newline at end of file +var _0x4469=['findAll','rows','show','params','rawAttributes','include','merge','create','body','find','destroy','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','Sequelize','QueryTypes','SELECT','contact','agent','fullname','internal','interface','SIP/%s','channel','EventManager','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','User','email','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','stack','name','send','index','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','OpenchannelMessage','includeAll'];(function(_0x1df79c,_0x5ad8fd){var _0x2f23e4=function(_0x47836f){while(--_0x47836f){_0x1df79c['push'](_0x1df79c['shift']());}};_0x2f23e4(++_0x5ad8fd);}(_0x4469,0xb6));var _0x9446=function(_0x160e74,_0x297331){_0x160e74=_0x160e74-0x0;var _0x35aef7=_0x4469[_0x160e74];return _0x35aef7;};'use strict';var emlformat=require(_0x9446('0x0'));var rimraf=require(_0x9446('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9446('0x2'));var rp=require(_0x9446('0x3'));var moment=require(_0x9446('0x4'));var BPromise=require(_0x9446('0x5'));var Mustache=require(_0x9446('0x6'));var util=require('util');var path=require(_0x9446('0x7'));var sox=require('sox');var csv=require(_0x9446('0x8'));var ejs=require(_0x9446('0x9'));var fs=require('fs');var fs_extra=require(_0x9446('0xa'));var _=require(_0x9446('0xb'));var squel=require(_0x9446('0xc'));var crypto=require(_0x9446('0xd'));var jsforce=require(_0x9446('0xe'));var deskjs=require(_0x9446('0xf'));var toCsv=require(_0x9446('0x8'));var querystring=require(_0x9446('0x10'));var Papa=require('papaparse');var Redis=require(_0x9446('0x11'));var authService=require(_0x9446('0x12'));var qs=require(_0x9446('0x13'));var as=require(_0x9446('0x14'));var hardwareService=require(_0x9446('0x15'));var logger=require(_0x9446('0x16'))(_0x9446('0x17'));var utils=require('../../config/utils');var config=require(_0x9446('0x18'));var licenseUtil=require(_0x9446('0x19'));var db=require(_0x9446('0x1a'))['db'];config['redis']=_['defaults'](config[_0x9446('0x1b')],{'host':_0x9446('0x1c'),'port':0x18eb});var socket=require(_0x9446('0x1d'))(new Redis(config['redis']));require(_0x9446('0x1e'))[_0x9446('0x1f')](socket);var jayson=require(_0x9446('0x20'));var client=jayson[_0x9446('0x21')][_0x9446('0x22')]({'port':0x232c});var client9002=jayson[_0x9446('0x21')][_0x9446('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x50ab8b,_0x40a8ab,_0x15e226,_0x1f767b){return new BPromise(function(_0x61f0ab,_0x3a4620){var _0x4b625c=_0x1f767b||client;return _0x4b625c[_0x9446('0x23')](_0x50ab8b,_0x15e226)['then'](function(_0x1b1d05){logger[_0x9446('0x24')](_0x9446('0x25'),_0x40a8ab,_0x9446('0x26'));logger[_0x9446('0x27')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x40a8ab,_0x9446('0x26'),JSON[_0x9446('0x28')](_0x1b1d05));if(_0x1b1d05[_0x9446('0x29')]){if(_0x1b1d05[_0x9446('0x29')][_0x9446('0x2a')]===0x1f4){logger[_0x9446('0x29')](_0x9446('0x25'),_0x40a8ab,_0x1b1d05[_0x9446('0x29')][_0x9446('0x2b')]);return _0x3a4620(_0x1b1d05[_0x9446('0x29')]['message']);}logger[_0x9446('0x29')](_0x9446('0x25'),_0x40a8ab,_0x1b1d05[_0x9446('0x29')]['message']);return _0x61f0ab(_0x1b1d05[_0x9446('0x29')]['message']);}else{logger[_0x9446('0x24')](_0x9446('0x25'),_0x40a8ab,'request\x20sent');_0x61f0ab(_0x1b1d05['result'][_0x9446('0x2b')]);}})[_0x9446('0x2c')](function(_0x2ed984){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x40a8ab,_0x2ed984);_0x3a4620(_0x2ed984);});});}function respondWithStatusCode(_0x1be315,_0x20403d){_0x20403d=_0x20403d||0xcc;return function(_0x49a15a){if(_0x49a15a){return _0x1be315['sendStatus'](_0x20403d);}return _0x1be315[_0x9446('0x2d')](_0x20403d)[_0x9446('0x2e')]();};}function respondWithResult(_0x3da6dc,_0x36a7b9){_0x36a7b9=_0x36a7b9||0xc8;return function(_0x425a62){if(_0x425a62){return _0x3da6dc['status'](_0x36a7b9)[_0x9446('0x2f')](_0x425a62);}};}function respondWithFilteredResult(_0x426aa6,_0x2101ac){return function(_0x5d1400){if(_0x5d1400){var _0x1695e0=typeof _0x2101ac['offset']===_0x9446('0x30')&&typeof _0x2101ac[_0x9446('0x31')]===_0x9446('0x30');var _0x27b656=_0x5d1400[_0x9446('0x32')];var _0x58cd0d=_0x1695e0?0x0:_0x2101ac[_0x9446('0x33')];var _0x681add=_0x1695e0?_0x5d1400[_0x9446('0x32')]:_0x2101ac[_0x9446('0x33')]+_0x2101ac[_0x9446('0x31')];var _0x4517c2;if(_0x681add>=_0x27b656){_0x681add=_0x27b656;_0x4517c2=0xc8;}else{_0x4517c2=0xce;}_0x426aa6['status'](_0x4517c2);return _0x426aa6['set'](_0x9446('0x34'),_0x58cd0d+'-'+_0x681add+'/'+_0x27b656)[_0x9446('0x2f')](_0x5d1400);}return null;};}function patchUpdates(_0x217608){return function(_0x5f134d){try{jsonpatch[_0x9446('0x35')](_0x5f134d,_0x217608,!![]);}catch(_0x75adc3){return BPromise[_0x9446('0x36')](_0x75adc3);}return _0x5f134d[_0x9446('0x37')]();};}function saveUpdates(_0x364eab,_0x358298){return function(_0x2ff64a){if(_0x2ff64a){return _0x2ff64a[_0x9446('0x38')](_0x364eab)[_0x9446('0x39')](function(_0x3df8b6){return _0x3df8b6;});}return null;};}function removeEntity(_0x1f8f87,_0x1e5f1b){return function(_0x38bcc1){if(_0x38bcc1){return _0x38bcc1['destroy']()[_0x9446('0x39')](function(){_0x1f8f87[_0x9446('0x2d')](0xcc)[_0x9446('0x2e')]();});}};}function handleEntityNotFound(_0x2a12fc,_0x588af6){return function(_0x4d3f24){if(!_0x4d3f24){_0x2a12fc['sendStatus'](0x194);}return _0x4d3f24;};}function handleError(_0x544490,_0x53fb80){_0x53fb80=_0x53fb80||0x1f4;return function(_0x4f738b){logger[_0x9446('0x29')](_0x4f738b[_0x9446('0x3a')]);if(_0x4f738b[_0x9446('0x3b')]){delete _0x4f738b[_0x9446('0x3b')];}_0x544490['status'](_0x53fb80)[_0x9446('0x3c')](_0x4f738b);};}exports[_0x9446('0x3d')]=function(_0x459c4c,_0x2a88b6){var _0x15c291={},_0x5e7467={},_0x489dcb={'count':0x0,'rows':[]};var _0x1eb86c=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0x13a110){return{'name':_0x13a110[_0x9446('0x3e')],'type':_0x13a110[_0x9446('0x3f')][_0x9446('0x40')]};});_0x5e7467['model']=_['map'](_0x1eb86c,_0x9446('0x3b'));_0x5e7467[_0x9446('0x41')]=_[_0x9446('0x42')](_0x459c4c[_0x9446('0x41')]);_0x5e7467[_0x9446('0x43')]=_[_0x9446('0x44')](_0x5e7467[_0x9446('0x45')],_0x5e7467['query']);_0x15c291[_0x9446('0x46')]=_['intersection'](_0x5e7467[_0x9446('0x45')],qs[_0x9446('0x47')](_0x459c4c[_0x9446('0x41')][_0x9446('0x47')]));_0x15c291[_0x9446('0x46')]=_0x15c291[_0x9446('0x46')][_0x9446('0x48')]?_0x15c291[_0x9446('0x46')]:_0x5e7467[_0x9446('0x45')];if(!_0x459c4c[_0x9446('0x41')][_0x9446('0x49')](_0x9446('0x4a'))){_0x15c291[_0x9446('0x31')]=qs[_0x9446('0x31')](_0x459c4c['query'][_0x9446('0x31')]);_0x15c291['offset']=qs[_0x9446('0x33')](_0x459c4c[_0x9446('0x41')]['offset']);}_0x15c291[_0x9446('0x4b')]=qs[_0x9446('0x4c')](_0x459c4c['query']['sort']);_0x15c291[_0x9446('0x4d')]=qs[_0x9446('0x43')](_['pick'](_0x459c4c['query'],_0x5e7467['filters']),_0x1eb86c);if(_0x459c4c['query'][_0x9446('0x4e')]){_0x15c291[_0x9446('0x4d')]=_['merge'](_0x15c291[_0x9446('0x4d')],{'$or':_[_0x9446('0x4f')](_0x1eb86c,function(_0x1b68bb){if(_0x1b68bb[_0x9446('0x3f')]!=='VIRTUAL'){var _0x48ec02={};_0x48ec02[_0x1b68bb[_0x9446('0x3b')]]={'$like':'%'+_0x459c4c['query'][_0x9446('0x4e')]+'%'};return _0x48ec02;}})});}_0x15c291=_['merge']({},_0x15c291,_0x459c4c['options']);var _0x3e4da0={'where':_0x15c291[_0x9446('0x4d')]};return db[_0x9446('0x50')][_0x9446('0x32')](_0x3e4da0)['then'](function(_0x4c661d){_0x489dcb['count']=_0x4c661d;if(_0x459c4c['query'][_0x9446('0x51')]){_0x15c291['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x9446('0x52')](_0x15c291);})[_0x9446('0x39')](function(_0x3532c8){_0x489dcb[_0x9446('0x53')]=_0x3532c8;return _0x489dcb;})[_0x9446('0x39')](respondWithFilteredResult(_0x2a88b6,_0x15c291))['catch'](handleError(_0x2a88b6,null));};exports[_0x9446('0x54')]=function(_0x2b88ae,_0x325bf4){var _0x2fc9d2={'raw':!![],'where':{'id':_0x2b88ae[_0x9446('0x55')]['id']}},_0x37d061={};_0x37d061[_0x9446('0x45')]=_[_0x9446('0x42')](db[_0x9446('0x50')][_0x9446('0x56')]);_0x37d061[_0x9446('0x41')]=_['keys'](_0x2b88ae[_0x9446('0x41')]);_0x37d061['filters']=_[_0x9446('0x44')](_0x37d061[_0x9446('0x45')],_0x37d061[_0x9446('0x41')]);_0x2fc9d2[_0x9446('0x46')]=_[_0x9446('0x44')](_0x37d061['model'],qs[_0x9446('0x47')](_0x2b88ae[_0x9446('0x41')][_0x9446('0x47')]));_0x2fc9d2[_0x9446('0x46')]=_0x2fc9d2[_0x9446('0x46')][_0x9446('0x48')]?_0x2fc9d2[_0x9446('0x46')]:_0x37d061[_0x9446('0x45')];if(_0x2b88ae[_0x9446('0x41')][_0x9446('0x51')]){_0x2fc9d2[_0x9446('0x57')]=[{'all':!![]}];}_0x2fc9d2=_[_0x9446('0x58')]({},_0x2fc9d2,_0x2b88ae['options']);return db[_0x9446('0x50')]['find'](_0x2fc9d2)[_0x9446('0x39')](handleEntityNotFound(_0x325bf4,null))[_0x9446('0x39')](respondWithResult(_0x325bf4,null))[_0x9446('0x2c')](handleError(_0x325bf4,null));};exports['create']=function(_0x248af0,_0x40cccb){return db[_0x9446('0x50')][_0x9446('0x59')](_0x248af0[_0x9446('0x5a')],{})[_0x9446('0x39')](respondWithResult(_0x40cccb,0xc9))[_0x9446('0x2c')](handleError(_0x40cccb,null));};exports[_0x9446('0x38')]=function(_0x513f19,_0xdd0abf){if(_0x513f19[_0x9446('0x5a')]['id']){delete _0x513f19[_0x9446('0x5a')]['id'];}return db[_0x9446('0x50')][_0x9446('0x5b')]({'where':{'id':_0x513f19['params']['id']}})[_0x9446('0x39')](handleEntityNotFound(_0xdd0abf,null))['then'](saveUpdates(_0x513f19[_0x9446('0x5a')],null))['then'](respondWithResult(_0xdd0abf,null))[_0x9446('0x2c')](handleError(_0xdd0abf,null));};exports[_0x9446('0x5c')]=function(_0x3f6449,_0xe8ebc5){return db[_0x9446('0x50')]['find']({'where':{'id':_0x3f6449[_0x9446('0x55')]['id']}})['then'](handleEntityNotFound(_0xe8ebc5,null))[_0x9446('0x39')](removeEntity(_0xe8ebc5,null))[_0x9446('0x2c')](handleError(_0xe8ebc5,null));};exports[_0x9446('0x5d')]=function(_0x59b9f8,_0xe817bd){return db[_0x9446('0x50')]['describe']()['then'](respondWithResult(_0xe817bd,null))['catch'](handleError(_0xe817bd,null));};var interaction_log=require(_0x9446('0x16'))('openchannel-interactions');exports[_0x9446('0x5e')]=function(_0x16ec96,_0x371d11,_0x4876e2){var _0xebacb0={'agent':{},'channel':_0x9446('0x5f')};if(_0x16ec96['body']['id']){delete _0x16ec96['body']['id'];}_0x16ec96[_0x9446('0x5a')][_0x9446('0x60')]=!![];_0x16ec96[_0x9446('0x5a')][_0x9446('0x61')]=moment()[_0x9446('0x62')](_0x9446('0x63'));_0x16ec96['body'][_0x9446('0x64')]=_0x16ec96['body'][_0x9446('0x64')]||_0x16ec96['user']['id'];_0xebacb0['agent']['id']=_0x16ec96[_0x9446('0x5a')][_0x9446('0x64')];return db[_0x9446('0x50')][_0x9446('0x5b')]({'where':{'id':_0x16ec96[_0x9446('0x55')]['id'],'UserId':null}})[_0x9446('0x39')](handleEntityNotFound(_0x371d11,null))[_0x9446('0x39')](saveUpdates(_0x16ec96['body'],null))[_0x9446('0x39')](function(_0x456eae){if(_0x456eae){_0xebacb0[_0x9446('0x2b')]=_0x456eae[_0x9446('0x65')]({'plain':!![]});return db[_0x9446('0x66')][_0x9446('0x5b')]({'where':{'id':_0x456eae[_0x9446('0x67')]}});}return null;})[_0x9446('0x39')](handleEntityNotFound(_0x371d11,null))[_0x9446('0x39')](function(_0x4237c7){if(_0x4237c7){return _0x4237c7[_0x9446('0x38')]({'UserId':_0x16ec96[_0x9446('0x5a')]['UserId'],'read1stAt':_[_0x9446('0x68')](_0x4237c7[_0x9446('0x69')])?moment()['format'](_0x9446('0x63')):undefined});}return null;})[_0x9446('0x39')](function(_0x585da8){if(_0x585da8){_0xebacb0[_0x9446('0x6a')]=_0x585da8[_0x9446('0x65')]({'plain':!![]});interaction_log[_0x9446('0x24')](_0x9446('0x6b'),_0x16ec96['user']['id'],_0x16ec96[_0x9446('0x6c')][_0x9446('0x3b')],_0x16ec96[_0x9446('0x6c')][_0x9446('0x6d')],_0xebacb0[_0x9446('0x6a')]['id'],_0x16ec96['body']?JSON[_0x9446('0x28')](_0x16ec96[_0x9446('0x5a')]):_0x9446('0x6e'));return respondWithRpcPromise(_0x9446('0x6f'),'acceptMessage',_0xebacb0);}return null;})['then'](function(_0x1a9132){var _0x56e7db='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1a9132[_0x9446('0x2b')]['ContactId'];return db['sequelize']['query'](_0x56e7db,{'type':db[_0x9446('0x70')][_0x9446('0x71')][_0x9446('0x72')],'raw':!![]})[_0x9446('0x39')](function(_0xc5077a){return _0xc5077a;});})['then'](function(_0xd9be38){if(_0xd9be38){_0xebacb0[_0x9446('0x2b')][_0x9446('0x73')]=_0xd9be38[0x0];if(!_0x16ec96[_0x9446('0x5a')][_0x9446('0x64')])return;return db['User'][_0x9446('0x5b')]({'where':{'id':_0x16ec96['body'][_0x9446('0x64')],'role':_0x9446('0x74')},'attributes':['id',_0x9446('0x3b'),_0x9446('0x75'),'email',_0x9446('0x76')],'raw':!![]});}return null;})[_0x9446('0x39')](function(_0xd167a7){if(!_0xd167a7)return null;_0xebacb0['message'][_0x9446('0x74')]=_0xd167a7;return _0xebacb0;})[_0x9446('0x39')](function(_0x4d8403){if(_0x4d8403){if(_0x16ec96[_0x9446('0x5a')]['manual']){_0xebacb0[_0x9446('0x2b')][_0x9446('0x77')]=util['format'](_0x9446('0x78'),_0x16ec96[_0x9446('0x6c')][_0x9446('0x3b')]);_0xebacb0[_0x9446('0x2b')][_0x9446('0x79')]=_0xebacb0[_0x9446('0x79')];_0xebacb0['message']['event']=_0x9446('0x5e');return respondWithRpcPromise(_0x9446('0x7a'),_0x9446('0x7a'),{'event':'acceptmessage','message':_0xebacb0['message']},client9002)[_0x9446('0x39')](function(){return _0xebacb0;});}return _0xebacb0;}return null;})[_0x9446('0x39')](respondWithResult(_0x371d11,null))[_0x9446('0x2c')](handleError(_0x371d11,null));};var interaction_log=require('../../config/logger')(_0x9446('0x7b'));exports[_0x9446('0x36')]=function(_0x47ba92,_0x4f9e2f,_0x3c3773){var _0x4a6a5d={'agent':{},'channel':_0x9446('0x5f')};if(_0x47ba92['body']['id']){delete _0x47ba92[_0x9446('0x5a')]['id'];}_0x47ba92[_0x9446('0x5a')][_0x9446('0x64')]=_0x47ba92[_0x9446('0x5a')]['UserId']||_0x47ba92[_0x9446('0x6c')]['id'];_0x4a6a5d[_0x9446('0x74')]['id']=_0x47ba92['body'][_0x9446('0x64')];return db[_0x9446('0x50')][_0x9446('0x5b')]({'where':{'id':_0x47ba92[_0x9446('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4f9e2f,null))[_0x9446('0x39')](function(_0x462413){if(_0x462413){_0x4a6a5d[_0x9446('0x2b')]=_0x462413[_0x9446('0x65')]({'plain':!![]});return db[_0x9446('0x66')]['find']({'where':{'id':_0x462413[_0x9446('0x67')]}});}return null;})[_0x9446('0x39')](handleEntityNotFound(_0x4f9e2f,null))[_0x9446('0x39')](function(_0x54ca4d){if(_0x54ca4d){_0x4a6a5d[_0x9446('0x6a')]=_0x54ca4d['get']({'plain':!![]});interaction_log[_0x9446('0x24')](_0x9446('0x7c'),_0x47ba92[_0x9446('0x6c')]['id'],_0x47ba92[_0x9446('0x6c')][_0x9446('0x3b')],_0x47ba92[_0x9446('0x6c')]['role'],_0x4a6a5d[_0x9446('0x6a')]['id'],_0x47ba92['body']?JSON[_0x9446('0x28')](_0x47ba92[_0x9446('0x5a')]):_0x9446('0x6e'));return respondWithRpcPromise('RejectMessage',_0x9446('0x7d'),_0x4a6a5d);}return null;})['then'](function(_0x253c54){var _0x167bf0=_0x9446('0x7e')+_0x253c54[_0x9446('0x2b')][_0x9446('0x7f')];return db[_0x9446('0x80')][_0x9446('0x41')](_0x167bf0,{'type':db[_0x9446('0x70')]['QueryTypes'][_0x9446('0x72')],'raw':!![]})['then'](function(_0x454a95){return _0x454a95;});})[_0x9446('0x39')](function(_0x474891){if(_0x474891){_0x4a6a5d[_0x9446('0x2b')]['contact']=_0x474891[0x0];if(!_0x47ba92[_0x9446('0x5a')][_0x9446('0x64')])return;return db[_0x9446('0x81')][_0x9446('0x5b')]({'where':{'id':_0x47ba92[_0x9446('0x5a')][_0x9446('0x64')],'role':_0x9446('0x74')},'attributes':['id',_0x9446('0x3b'),_0x9446('0x75'),_0x9446('0x82'),_0x9446('0x76')],'raw':!![]});}return null;})['then'](function(_0xdae47c){if(!_0xdae47c)return null;_0x4a6a5d[_0x9446('0x2b')][_0x9446('0x74')]=_0xdae47c;return _0x4a6a5d;})[_0x9446('0x39')](function(_0x77f2e0){if(_0x77f2e0){_0x77f2e0[_0x9446('0x2b')][_0x9446('0x77')]=util['format'](_0x9446('0x78'),_0x47ba92['user']['name']);_0x77f2e0[_0x9446('0x2b')][_0x9446('0x79')]=_0x4a6a5d[_0x9446('0x79')];_0x77f2e0[_0x9446('0x2b')]['event']='reject';respondWithRpcPromise(_0x9446('0x7a'),_0x9446('0x7a'),{'event':_0x9446('0x83'),'message':_0x77f2e0[_0x9446('0x2b')]},client9002);return _0x4a6a5d;}return null;})[_0x9446('0x39')](respondWithResult(_0x4f9e2f,null))[_0x9446('0x2c')](handleError(_0x4f9e2f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index ce6dcff..e1ee0a9 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 _0x17b2=['hasOwnProperty','exports','OpenchannelMessage','save','remove','emit'];(function(_0x467726,_0x14657a){var _0x270dc1=function(_0x1c5691){while(--_0x1c5691){_0x467726['push'](_0x467726['shift']());}};_0x270dc1(++_0x14657a);}(_0x17b2,0xda));var _0x217b=function(_0x3c49fc,_0xca38fe){_0x3c49fc=_0x3c49fc-0x0;var _0x50f053=_0x17b2[_0x3c49fc];return _0x50f053;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x217b('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x217b('0x1'),'afterUpdate':'update','afterDestroy':_0x217b('0x2')};function emitEvent(_0x172c4c){return function(_0x3cd0e6,_0x1272ee,_0x4af519){OpenchannelMessageEvents[_0x217b('0x3')](_0x172c4c+':'+_0x3cd0e6['id'],_0x3cd0e6);OpenchannelMessageEvents[_0x217b('0x3')](_0x172c4c,_0x3cd0e6);_0x4af519(null);};}for(var e in events){if(events[_0x217b('0x4')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x217b('0x5')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xc8bb=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x5e5e55,_0x583a54){var _0xc903c9=function(_0x238654){while(--_0x238654){_0x5e5e55['push'](_0x5e5e55['shift']());}};_0xc903c9(++_0x583a54);}(_0xc8bb,0x79));var _0xbc8b=function(_0x325c86,_0x1c405f){_0x325c86=_0x325c86-0x0;var _0x231dde=_0xc8bb[_0x325c86];return _0x231dde;};'use strict';var EventEmitter=require(_0xbc8b('0x0'));var OpenchannelMessage=require(_0xbc8b('0x1'))['db'][_0xbc8b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbc8b('0x3'),'afterUpdate':_0xbc8b('0x4'),'afterDestroy':_0xbc8b('0x5')};function emitEvent(_0x2bf705){return function(_0x510e5d,_0x51d7e0,_0x70afb6){OpenchannelMessageEvents[_0xbc8b('0x6')](_0x2bf705+':'+_0x510e5d['id'],_0x510e5d);OpenchannelMessageEvents[_0xbc8b('0x6')](_0x2bf705,_0x510e5d);_0x70afb6(null);};}for(var e in events){if(events[_0xbc8b('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xbc8b('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 237ccf7..cb75b16 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 _0x8e3f=['get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','then','update','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('OpenchannelMessage',attributes,{'tableName':_0xf8e3('0xa'),'paranoid':![],'indexes':[{'name':_0xf8e3('0xb'),'fields':[_0xf8e3('0xc')],'type':_0xf8e3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38f8e8,_0x4055e2,_0x299a7e){var _0x2a3b59=_0xb21f8d[_0xf8e3('0xe')];var _0x2bc3cd=_0x38f8e8[_0xf8e3('0xf')]({'plain':!![]});if(_0x2bc3cd[_0xf8e3('0x10')]['toLowerCase']()==='in'||_0x2bc3cd[_0xf8e3('0x10')][_0xf8e3('0x11')]()===_0xf8e3('0x12')&&!_0x2bc3cd['secret']&&!_[_0xf8e3('0x13')](_0x2bc3cd[_0xf8e3('0x14')])){_0x2a3b59[_0xf8e3('0x15')][_0xf8e3('0x16')]({'where':{'id':_0x2bc3cd['OpenchannelInteractionId']}})[_0xf8e3('0x17')](function(_0xa856f5){if(_0xa856f5){_0xa856f5[_0xf8e3('0x18')]({'lastMsgAt':_0x2bc3cd['createdAt'],'lastMsgDirection':_0x2bc3cd[_0xf8e3('0x10')]['toLowerCase']()});}})[_0xf8e3('0x19')](function(_0x40c196){console[_0xf8e3('0x1a')](_0x40c196);});}if(_0x2bc3cd['direction']==='out'&&!_0x2bc3cd[_0xf8e3('0x1b')]){var _0x385dde;_0x2a3b59[_0xf8e3('0x1c')][_0xf8e3('0x1d')]()[_0xf8e3('0x17')](function(_0x11d4cc){return _0x2a3b59[_0xf8e3('0x1e')][_0xf8e3('0x1f')]({'where':{'id':_0x2bc3cd[_0xf8e3('0x20')]},'include':[{'model':_0x2a3b59[_0xf8e3('0x15')],'as':'Interactions','where':{'id':_0x2bc3cd[_0xf8e3('0x21')]},'limit':0x1,'include':[{'model':_0x2a3b59[_0xf8e3('0x1c')],'as':_0xf8e3('0x22'),'attributes':_[_0xf8e3('0x23')](_0x11d4cc)}]}]});})[_0xf8e3('0x17')](function(_0x11c58e){_0x385dde=_0x11c58e[_0xf8e3('0xf')]({'plain':!![]});if(_0x385dde&&_0x385dde[_0xf8e3('0x24')]){logger['info'](_0xf8e3('0x25'),_0xf8e3('0x26'),util[_0xf8e3('0x27')](_0xf8e3('0x28'),_0x2bc3cd['id'],_0x385dde['replyUri']));if(_0x385dde[_0xf8e3('0x29')]&&_0x385dde['Interactions'][_0xf8e3('0x2a')]){_0x2bc3cd[_0xf8e3('0x2b')]=_[_0xf8e3('0x2c')](_0x385dde[_0xf8e3('0x29')][0x0],_0xf8e3('0x22'));_0x2bc3cd[_0xf8e3('0x22')]=_0x385dde['Interactions'][0x0][_0xf8e3('0x22')];}var _0x4055e2={'method':_0xf8e3('0x2d'),'uri':encodeURI(_0x385dde[_0xf8e3('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4055e2[_0xf8e3('0x2e')]){case _0xf8e3('0x2f'):_0x4055e2['qs']=_0x2bc3cd;break;case _0xf8e3('0x2d'):_0x4055e2[_0xf8e3('0xc')]=_0x2bc3cd;break;}return rp(_0x4055e2)['then'](function(_0x356e0a){logger[_0xf8e3('0x30')](_0xf8e3('0x25'),_0xf8e3('0x26'),util[_0xf8e3('0x27')](_0xf8e3('0x31'),_0x2bc3cd['id'],_0x385dde[_0xf8e3('0x24')]));if(_0x356e0a[_0xf8e3('0xc')]['threadId']&&_0x356e0a[_0xf8e3('0xc')][_0xf8e3('0x32')]!=_0x2bc3cd[_0xf8e3('0x2b')][_0xf8e3('0x32')]){return _0x2a3b59['OpenchannelInteraction'][_0xf8e3('0x18')]({'threadId':_0x356e0a[_0xf8e3('0xc')][_0xf8e3('0x32')]},{'logging':!![],'where':{'id':_0x2bc3cd[_0xf8e3('0x2b')]['id']}});}else{return;}})[_0xf8e3('0x17')](function(){return _0x38f8e8[_0xf8e3('0x18')]({'read':!![]});})[_0xf8e3('0x19')](function(_0x18c8ae){logger['error'](_0xf8e3('0x25'),_0xf8e3('0x26'),util['inspect'](_0x18c8ae,{'showHidden':![],'depth':null}));_0x299a7e();});}else{_0x299a7e();}})['finally'](function(){_0x299a7e();});}else{_0x299a7e();}}},'charset':'utf8mb4','collate':_0xf8e3('0x33')});}; \ No newline at end of file +var _0x3266=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','define','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','OpenchannelInteractionId','createdAt','catch','error','OpenchannelAccount','find','OpenchannelAccountId','CmContact','Contact','keys','then','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Interaction','omit','method','POST','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x9be779,_0x3c5b4b){var _0x1cf800=function(_0xa39bc4){while(--_0xa39bc4){_0x9be779['push'](_0x9be779['shift']());}};_0x1cf800(++_0x3c5b4b);}(_0x3266,0x6a));var _0x6326=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x3266[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x6326('0xc')],'type':_0x6326('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x249eca,_0x1aee60,_0x37a23d){var _0x53c3e1=_0x25ecd8[_0x6326('0xe')];var _0x464a36=_0x249eca[_0x6326('0xf')]({'plain':!![]});if(_0x464a36[_0x6326('0x10')][_0x6326('0x11')]()==='in'||_0x464a36[_0x6326('0x10')][_0x6326('0x11')]()===_0x6326('0x12')&&!_0x464a36[_0x6326('0x13')]&&!_[_0x6326('0x14')](_0x464a36['UserId'])){_0x53c3e1['OpenchannelInteraction'][_0x6326('0x15')]({'where':{'id':_0x464a36[_0x6326('0x16')]}})['then'](function(_0x425878){if(_0x425878){_0x425878['update']({'lastMsgAt':_0x464a36[_0x6326('0x17')],'lastMsgDirection':_0x464a36[_0x6326('0x10')][_0x6326('0x11')]()});}})[_0x6326('0x18')](function(_0x1ed3a3){console[_0x6326('0x19')](_0x1ed3a3);});}if(_0x464a36['direction']===_0x6326('0x12')&&!_0x464a36['secret']){var _0x5945ee;_0x53c3e1['CmContact']['describe']()['then'](function(_0x58e960){return _0x53c3e1[_0x6326('0x1a')][_0x6326('0x1b')]({'where':{'id':_0x464a36[_0x6326('0x1c')]},'include':[{'model':_0x53c3e1['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x464a36[_0x6326('0x16')]},'limit':0x1,'include':[{'model':_0x53c3e1[_0x6326('0x1d')],'as':_0x6326('0x1e'),'attributes':_[_0x6326('0x1f')](_0x58e960)}]}]});})[_0x6326('0x20')](function(_0x25957a){_0x5945ee=_0x25957a[_0x6326('0xf')]({'plain':!![]});if(_0x5945ee&&_0x5945ee['replyUri']){logger[_0x6326('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x6326('0x22'),util[_0x6326('0x23')](_0x6326('0x24'),_0x464a36['id'],_0x5945ee[_0x6326('0x25')]));if(_0x5945ee[_0x6326('0x26')]&&_0x5945ee[_0x6326('0x26')][_0x6326('0x27')]){_0x464a36[_0x6326('0x28')]=_[_0x6326('0x29')](_0x5945ee[_0x6326('0x26')][0x0],_0x6326('0x1e'));_0x464a36['Contact']=_0x5945ee[_0x6326('0x26')][0x0][_0x6326('0x1e')];}var _0x1aee60={'method':'POST','uri':encodeURI(_0x5945ee['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1aee60[_0x6326('0x2a')]){case'GET':_0x1aee60['qs']=_0x464a36;break;case _0x6326('0x2b'):_0x1aee60[_0x6326('0xc')]=_0x464a36;break;}return rp(_0x1aee60)['then'](function(_0x15e33d){logger[_0x6326('0x21')](_0x6326('0x2c'),_0x6326('0x22'),util[_0x6326('0x23')](_0x6326('0x2d'),_0x464a36['id'],_0x5945ee[_0x6326('0x25')]));if(_0x15e33d[_0x6326('0xc')][_0x6326('0x2e')]&&_0x15e33d[_0x6326('0xc')][_0x6326('0x2e')]!=_0x464a36[_0x6326('0x28')][_0x6326('0x2e')]){return _0x53c3e1[_0x6326('0x2f')][_0x6326('0x30')]({'threadId':_0x15e33d[_0x6326('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x464a36[_0x6326('0x28')]['id']}});}else{return;}})[_0x6326('0x20')](function(){return _0x249eca[_0x6326('0x30')]({'read':!![]});})['catch'](function(_0x1bd9a6){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x6326('0x22'),util[_0x6326('0x31')](_0x1bd9a6,{'showHidden':![],'depth':null}));_0x37a23d();});}else{_0x37a23d();}})[_0x6326('0x32')](function(){_0x37a23d();});}else{_0x37a23d();}}},'charset':_0x6326('0x33'),'collate':_0x6326('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ceb2f41..66b0c94 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3587b1,_0x1692fd){var _0x1d69e4=function(_0x4f11c7){while(--_0x4f11c7){_0x3587b1['push'](_0x3587b1['shift']());}};_0x1d69e4(++_0x1692fd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'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});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x252884,_0x117ddf){var _0x4de0e6=function(_0x442519){while(--_0x442519){_0x252884['push'](_0x252884['shift']());}};_0x4de0e6(++_0x117ddf);}(_0xdb28,0x106));var _0x8db2=function(_0x1ef8b8,_0x18dc6a){_0x1ef8b8=_0x1ef8b8-0x0;var _0x515064=_0xdb28[_0x1ef8b8];return _0x515064;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 5357478..949503e 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 _0x72a2=['update','emit','length','save','remove'];(function(_0x531c2b,_0xe0f191){var _0x2a0816=function(_0x33beb9){while(--_0x33beb9){_0x531c2b['push'](_0x531c2b['shift']());}};_0x2a0816(++_0xe0f191);}(_0x72a2,0x161));var _0x272a=function(_0x2dba3c,_0x4ca11c){_0x2dba3c=_0x2dba3c-0x0;var _0x2073f7=_0x72a2[_0x2dba3c];return _0x2073f7;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x272a('0x0'),_0x272a('0x1'),_0x272a('0x2')];function createListener(_0x3fcb66,_0xdd3cbb){return function(_0x4c36b2){_0xdd3cbb[_0x272a('0x3')](_0x3fcb66,_0x4c36b2);};}function removeListener(_0x52287e,_0x1d154d){return function(){OpenchannelMessageEvents['removeListener'](_0x52287e,_0x1d154d);};}exports['register']=function(_0x4f628a){for(var _0x2ba5db=0x0,_0x43d188=events[_0x272a('0x4')];_0x2ba5db<_0x43d188;_0x2ba5db++){var _0x283070=events[_0x2ba5db];var _0x54dbfb=createListener('openchannelMessage:'+_0x283070,_0x4f628a);OpenchannelMessageEvents['on'](_0x283070,_0x54dbfb);}}; \ No newline at end of file +var _0x7bd5=['length','openchannelMessage:','./openchannelMessage.events','remove','update','emit','register'];(function(_0x4c35fd,_0x4c801b){var _0x190218=function(_0xaf0294){while(--_0xaf0294){_0x4c35fd['push'](_0x4c35fd['shift']());}};_0x190218(++_0x4c801b);}(_0x7bd5,0x8e));var _0x57bd=function(_0x2072f5,_0x1b5eb9){_0x2072f5=_0x2072f5-0x0;var _0x1893c4=_0x7bd5[_0x2072f5];return _0x1893c4;};'use strict';var OpenchannelMessageEvents=require(_0x57bd('0x0'));var events=['save',_0x57bd('0x1'),_0x57bd('0x2')];function createListener(_0x467218,_0x231b3e){return function(_0x5cbb6a){_0x231b3e[_0x57bd('0x3')](_0x467218,_0x5cbb6a);};}function removeListener(_0x49b3b6,_0x2f3491){return function(){OpenchannelMessageEvents['removeListener'](_0x49b3b6,_0x2f3491);};}exports[_0x57bd('0x4')]=function(_0x12ebc7){for(var _0x2f989=0x0,_0x5e18c1=events[_0x57bd('0x5')];_0x2f989<_0x5e18c1;_0x2f989++){var _0x390abc=events[_0x2f989];var _0x1c8fac=createListener(_0x57bd('0x6')+_0x390abc,_0x12ebc7);OpenchannelMessageEvents['on'](_0x390abc,_0x1c8fac);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 58b7703..15f7003 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 _0x28eb=['getAgents','create','addTeams','post','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','/describe','show','/:id/members','getMembers','get','/:id/teams','/:id/users'];(function(_0x4dc895,_0x36f280){var _0x25e2be=function(_0x533dbf){while(--_0x533dbf){_0x4dc895['push'](_0x4dc895['shift']());}};_0x25e2be(++_0x36f280);}(_0x28eb,0x1ec));var _0xb28e=function(_0x4a1647,_0x51a7ca){_0x4a1647=_0x4a1647-0x0;var _0x429446=_0x28eb[_0x4a1647];return _0x429446;};'use strict';var multer=require(_0xb28e('0x0'));var util=require(_0xb28e('0x1'));var path=require(_0xb28e('0x2'));var timeout=require(_0xb28e('0x3'));var express=require(_0xb28e('0x4'));var router=express['Router']();var fs_extra=require(_0xb28e('0x5'));var auth=require(_0xb28e('0x6'));var interaction=require(_0xb28e('0x7'));var config=require(_0xb28e('0x8'));var controller=require(_0xb28e('0x9'));router['get']('/',auth[_0xb28e('0xa')](),controller['index']);router['get'](_0xb28e('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xb28e('0xa')](),controller[_0xb28e('0xc')]);router['get'](_0xb28e('0xd'),auth[_0xb28e('0xa')](),controller[_0xb28e('0xe')]);router[_0xb28e('0xf')](_0xb28e('0x10'),auth[_0xb28e('0xa')](),controller['getTeams']);router[_0xb28e('0xf')](_0xb28e('0x11'),auth[_0xb28e('0xa')](),controller[_0xb28e('0x12')]);router['post']('/',auth[_0xb28e('0xa')](),controller[_0xb28e('0x13')]);router['post']('/:id/teams',auth[_0xb28e('0xa')](),controller[_0xb28e('0x14')]);router[_0xb28e('0x15')](_0xb28e('0x11'),auth[_0xb28e('0xa')](),controller[_0xb28e('0x16')]);router[_0xb28e('0x17')](_0xb28e('0x18'),auth[_0xb28e('0xa')](),controller[_0xb28e('0x19')]);router[_0xb28e('0x1a')]('/:id',auth[_0xb28e('0xa')](),controller[_0xb28e('0x1b')]);router['delete']('/:id/teams',auth[_0xb28e('0xa')](),controller['removeTeams']);router[_0xb28e('0x1a')]('/:id/users',auth[_0xb28e('0xa')](),controller[_0xb28e('0x1c')]);module[_0xb28e('0x1d')]=router; \ No newline at end of file +var _0xfff3=['getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1e7a5c,_0x28ffc0){var _0x5e806b=function(_0x22a0b8){while(--_0x22a0b8){_0x1e7a5c['push'](_0x1e7a5c['shift']());}};_0x5e806b(++_0x28ffc0);}(_0xfff3,0x10f));var _0x3fff=function(_0x3765a7,_0x4db1e5){_0x3765a7=_0x3765a7-0x0;var _0x382076=_0xfff3[_0x3765a7];return _0x382076;};'use strict';var multer=require(_0x3fff('0x0'));var util=require(_0x3fff('0x1'));var path=require(_0x3fff('0x2'));var timeout=require(_0x3fff('0x3'));var express=require(_0x3fff('0x4'));var router=express['Router']();var fs_extra=require(_0x3fff('0x5'));var auth=require(_0x3fff('0x6'));var interaction=require(_0x3fff('0x7'));var config=require(_0x3fff('0x8'));var controller=require(_0x3fff('0x9'));router[_0x3fff('0xa')]('/',auth[_0x3fff('0xb')](),controller[_0x3fff('0xc')]);router[_0x3fff('0xa')](_0x3fff('0xd'),auth[_0x3fff('0xb')](),controller[_0x3fff('0xe')]);router[_0x3fff('0xa')](_0x3fff('0xf'),auth['isAuthenticated'](),controller[_0x3fff('0x10')]);router[_0x3fff('0xa')]('/:id/members',auth[_0x3fff('0xb')](),controller[_0x3fff('0x11')]);router[_0x3fff('0xa')](_0x3fff('0x12'),auth[_0x3fff('0xb')](),controller['getTeams']);router[_0x3fff('0xa')](_0x3fff('0x13'),auth[_0x3fff('0xb')](),controller[_0x3fff('0x14')]);router[_0x3fff('0x15')]('/',auth[_0x3fff('0xb')](),controller[_0x3fff('0x16')]);router[_0x3fff('0x15')](_0x3fff('0x12'),auth[_0x3fff('0xb')](),controller[_0x3fff('0x17')]);router[_0x3fff('0x15')](_0x3fff('0x13'),auth[_0x3fff('0xb')](),controller[_0x3fff('0x18')]);router[_0x3fff('0x19')](_0x3fff('0xf'),auth[_0x3fff('0xb')](),controller[_0x3fff('0x1a')]);router[_0x3fff('0x1b')](_0x3fff('0xf'),auth['isAuthenticated'](),controller[_0x3fff('0x1c')]);router[_0x3fff('0x1b')](_0x3fff('0x12'),auth[_0x3fff('0xb')](),controller[_0x3fff('0x1d')]);router['delete'](_0x3fff('0x13'),auth['isAuthenticated'](),controller[_0x3fff('0x1e')]);module[_0x3fff('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 22b6c31..6641eaa 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 _0xe934=['roundrobin','sequelize','STRING','INTEGER','rrmemory','beepall'];(function(_0x4319bb,_0x5df318){var _0x215a86=function(_0x1ad1bd){while(--_0x1ad1bd){_0x4319bb['push'](_0x4319bb['shift']());}};_0x215a86(++_0x5df318);}(_0xe934,0x91));var _0x4e93=function(_0x49c008,_0x15dfd1){_0x49c008=_0x49c008-0x0;var _0x2626e4=_0xe934[_0x49c008];return _0x2626e4;};'use strict';var Sequelize=require(_0x4e93('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e93('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4e93('0x1')]},'timeout':{'type':Sequelize[_0x4e93('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4e93('0x3'),_0x4e93('0x4'),_0x4e93('0x5'))}}; \ No newline at end of file +var _0xf3eb=['ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x5ac6d6,_0x544811){var _0x22aecc=function(_0x116a36){while(--_0x116a36){_0x5ac6d6['push'](_0x5ac6d6['shift']());}};_0x22aecc(++_0x544811);}(_0xf3eb,0x1c0));var _0xbf3e=function(_0x1ec0bb,_0x37f39d){_0x1ec0bb=_0x1ec0bb-0x0;var _0xe102a0=_0xf3eb[_0x1ec0bb];return _0xe102a0;};'use strict';var Sequelize=require('sequelize');module[_0xbf3e('0x0')]={'name':{'type':Sequelize[_0xbf3e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbf3e('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbf3e('0x2')](_0xbf3e('0x3'),_0xbf3e('0x4'),_0xbf3e('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 74f105a..721cc7c 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 _0x76da=['describe','getMembers','findOne','rawAttributes','nolimit','order','pick','UserOpenchannelQueue','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','union','compact','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','hasOwnProperty','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','then','destroy','get','UserProfileResource','end','error','stack','index','map','OpenchannelQueue','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x76da,0x1d4));var _0xa76d=function(_0x449043,_0x8c2f93){_0x449043=_0x449043-0x0;var _0x18a5a=_0x76da[_0x449043];return _0x18a5a;};'use strict';var emlformat=require(_0xa76d('0x0'));var rimraf=require(_0xa76d('0x1'));var zipdir=require(_0xa76d('0x2'));var jsonpatch=require(_0xa76d('0x3'));var rp=require(_0xa76d('0x4'));var moment=require(_0xa76d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa76d('0x6'));var csv=require(_0xa76d('0x7'));var ejs=require(_0xa76d('0x8'));var fs=require('fs');var fs_extra=require(_0xa76d('0x9'));var _=require(_0xa76d('0xa'));var squel=require(_0xa76d('0xb'));var crypto=require(_0xa76d('0xc'));var jsforce=require(_0xa76d('0xd'));var deskjs=require(_0xa76d('0xe'));var toCsv=require(_0xa76d('0x7'));var querystring=require(_0xa76d('0xf'));var Papa=require(_0xa76d('0x10'));var Redis=require('ioredis');var authService=require(_0xa76d('0x11'));var qs=require(_0xa76d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa76d('0x13'));var logger=require(_0xa76d('0x14'))(_0xa76d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa76d('0x16'));var db=require('../../mysqldb')['db'];config[_0xa76d('0x17')]=_[_0xa76d('0x18')](config[_0xa76d('0x17')],{'host':_0xa76d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa76d('0x1a'))[_0xa76d('0x1b')](socket);function respondWithStatusCode(_0x69050c,_0x59fb0e){_0x59fb0e=_0x59fb0e||0xcc;return function(_0x17960a){if(_0x17960a){return _0x69050c[_0xa76d('0x1c')](_0x59fb0e);}return _0x69050c[_0xa76d('0x1d')](_0x59fb0e)['end']();};}function respondWithResult(_0x1061ce,_0x1e931b){_0x1e931b=_0x1e931b||0xc8;return function(_0x5a2795){if(_0x5a2795){return _0x1061ce['status'](_0x1e931b)[_0xa76d('0x1e')](_0x5a2795);}};}function respondWithFilteredResult(_0x493f61,_0x2d8824){return function(_0x451b67){if(_0x451b67){var _0x12aa7e=typeof _0x2d8824['offset']==='undefined'&&typeof _0x2d8824[_0xa76d('0x1f')]===_0xa76d('0x20');var _0x3b55bc=_0x451b67[_0xa76d('0x21')];var _0x25eac6=_0x12aa7e?0x0:_0x2d8824[_0xa76d('0x22')];var _0x3f98bc=_0x12aa7e?_0x451b67[_0xa76d('0x21')]:_0x2d8824[_0xa76d('0x22')]+_0x2d8824['limit'];var _0x50400e;if(_0x3f98bc>=_0x3b55bc){_0x3f98bc=_0x3b55bc;_0x50400e=0xc8;}else{_0x50400e=0xce;}_0x493f61[_0xa76d('0x1d')](_0x50400e);return _0x493f61['set'](_0xa76d('0x23'),_0x25eac6+'-'+_0x3f98bc+'/'+_0x3b55bc)['json'](_0x451b67);}return null;};}function patchUpdates(_0x481b6d){return function(_0x8a35db){try{jsonpatch[_0xa76d('0x24')](_0x8a35db,_0x481b6d,!![]);}catch(_0x47a8aa){return BPromise['reject'](_0x47a8aa);}return _0x8a35db['save']();};}function saveUpdates(_0x3cf98b,_0x59677f){return function(_0x4f9a48){if(_0x4f9a48){return _0x4f9a48['update'](_0x3cf98b)[_0xa76d('0x25')](function(_0x38032d){return _0x38032d;});}return null;};}function removeEntity(_0x27d168,_0x2a5065){return function(_0x477606){if(_0x477606){return _0x477606[_0xa76d('0x26')]()[_0xa76d('0x25')](function(){var _0x49369b=_0x477606[_0xa76d('0x27')]({'plain':!![]});var _0x23a940='OpenchannelQueues';return db[_0xa76d('0x28')][_0xa76d('0x26')]({'where':{'type':_0x23a940,'resourceId':_0x49369b['id']}})[_0xa76d('0x25')](function(){return _0x477606;});})[_0xa76d('0x25')](function(){_0x27d168[_0xa76d('0x1d')](0xcc)[_0xa76d('0x29')]();});}};}function handleEntityNotFound(_0x14b204,_0x1d9266){return function(_0x23001e){if(!_0x23001e){_0x14b204[_0xa76d('0x1c')](0x194);}return _0x23001e;};}function handleError(_0x12ca62,_0x462f09){_0x462f09=_0x462f09||0x1f4;return function(_0x105a08){logger[_0xa76d('0x2a')](_0x105a08[_0xa76d('0x2b')]);if(_0x105a08['name']){delete _0x105a08['name'];}_0x12ca62[_0xa76d('0x1d')](_0x462f09)['send'](_0x105a08);};}exports[_0xa76d('0x2c')]=function(_0xc01ca7,_0x14fcc0){var _0x572145={},_0x263b1b={},_0x2b292d={'count':0x0,'rows':[]};var _0x1ccf60=_[_0xa76d('0x2d')](db[_0xa76d('0x2e')]['rawAttributes'],function(_0x5db75e){return{'name':_0x5db75e[_0xa76d('0x2f')],'type':_0x5db75e[_0xa76d('0x30')][_0xa76d('0x31')]};});_0x263b1b[_0xa76d('0x32')]=_[_0xa76d('0x2d')](_0x1ccf60,_0xa76d('0x33'));_0x263b1b[_0xa76d('0x34')]=_[_0xa76d('0x35')](_0xc01ca7['query']);_0x263b1b[_0xa76d('0x36')]=_[_0xa76d('0x37')](_0x263b1b[_0xa76d('0x32')],_0x263b1b[_0xa76d('0x34')]);_0x572145[_0xa76d('0x38')]=_[_0xa76d('0x37')](_0x263b1b[_0xa76d('0x32')],qs[_0xa76d('0x39')](_0xc01ca7[_0xa76d('0x34')]['fields']));_0x572145[_0xa76d('0x38')]=_0x572145[_0xa76d('0x38')][_0xa76d('0x3a')]?_0x572145[_0xa76d('0x38')]:_0x263b1b[_0xa76d('0x32')];if(!_0xc01ca7[_0xa76d('0x34')]['hasOwnProperty']('nolimit')){_0x572145[_0xa76d('0x1f')]=qs[_0xa76d('0x1f')](_0xc01ca7[_0xa76d('0x34')][_0xa76d('0x1f')]);_0x572145[_0xa76d('0x22')]=qs[_0xa76d('0x22')](_0xc01ca7[_0xa76d('0x34')][_0xa76d('0x22')]);}_0x572145['order']=qs[_0xa76d('0x3b')](_0xc01ca7[_0xa76d('0x34')]['sort']);_0x572145[_0xa76d('0x3c')]=qs[_0xa76d('0x36')](_['pick'](_0xc01ca7[_0xa76d('0x34')],_0x263b1b[_0xa76d('0x36')]),_0x1ccf60);if(_0xc01ca7['query'][_0xa76d('0x3d')]){_0x572145[_0xa76d('0x3c')]=_['merge'](_0x572145[_0xa76d('0x3c')],{'$or':_[_0xa76d('0x2d')](_0x1ccf60,function(_0x14461b){if(_0x14461b[_0xa76d('0x30')]!=='VIRTUAL'){var _0x5c1d78={};_0x5c1d78[_0x14461b[_0xa76d('0x33')]]={'$like':'%'+_0xc01ca7[_0xa76d('0x34')][_0xa76d('0x3d')]+'%'};return _0x5c1d78;}})});}_0x572145=_[_0xa76d('0x3e')]({},_0x572145,_0xc01ca7[_0xa76d('0x3f')]);var _0x69895f={'where':_0x572145[_0xa76d('0x3c')]};return db[_0xa76d('0x2e')][_0xa76d('0x21')](_0x69895f)[_0xa76d('0x25')](function(_0x45bde7){_0x2b292d['count']=_0x45bde7;if(_0xc01ca7[_0xa76d('0x34')][_0xa76d('0x40')]){_0x572145[_0xa76d('0x41')]=[{'all':!![]}];}return db[_0xa76d('0x2e')]['findAll'](_0x572145);})['then'](function(_0x474d03){_0x2b292d[_0xa76d('0x42')]=_0x474d03;return _0x2b292d;})[_0xa76d('0x25')](respondWithFilteredResult(_0x14fcc0,_0x572145))[_0xa76d('0x43')](handleError(_0x14fcc0,null));};exports[_0xa76d('0x44')]=function(_0x1b26b4,_0x9386){var _0x3343fb={'raw':!![],'where':{'id':_0x1b26b4[_0xa76d('0x45')]['id']}},_0x50119f={};_0x50119f[_0xa76d('0x32')]=_['keys'](db[_0xa76d('0x2e')]['rawAttributes']);_0x50119f[_0xa76d('0x34')]=_['keys'](_0x1b26b4[_0xa76d('0x34')]);_0x50119f[_0xa76d('0x36')]=_[_0xa76d('0x37')](_0x50119f[_0xa76d('0x32')],_0x50119f[_0xa76d('0x34')]);_0x3343fb['attributes']=_[_0xa76d('0x37')](_0x50119f[_0xa76d('0x32')],qs[_0xa76d('0x39')](_0x1b26b4[_0xa76d('0x34')][_0xa76d('0x39')]));_0x3343fb[_0xa76d('0x38')]=_0x3343fb[_0xa76d('0x38')][_0xa76d('0x3a')]?_0x3343fb[_0xa76d('0x38')]:_0x50119f['model'];if(_0x1b26b4['query'][_0xa76d('0x40')]){_0x3343fb[_0xa76d('0x41')]=[{'all':!![]}];}_0x3343fb=_['merge']({},_0x3343fb,_0x1b26b4[_0xa76d('0x3f')]);return db[_0xa76d('0x2e')]['find'](_0x3343fb)[_0xa76d('0x25')](handleEntityNotFound(_0x9386,null))[_0xa76d('0x25')](respondWithResult(_0x9386,null))[_0xa76d('0x43')](handleError(_0x9386,null));};exports['create']=function(_0x47981f,_0x141a7a){return db[_0xa76d('0x2e')][_0xa76d('0x46')](_0x47981f[_0xa76d('0x47')],{})[_0xa76d('0x25')](function(_0x3a84b5){var _0x25adf3=_0x47981f[_0xa76d('0x48')][_0xa76d('0x27')]({'plain':!![]});if(!_0x25adf3)throw new Error(_0xa76d('0x49'));if(_0x25adf3[_0xa76d('0x4a')]===_0xa76d('0x48')){var _0x5bf515=_0x3a84b5[_0xa76d('0x27')]({'plain':!![]});var _0x3244a0=_0xa76d('0x4b');return db[_0xa76d('0x4c')][_0xa76d('0x4d')]({'where':{'name':_0x3244a0,'userProfileId':_0x25adf3[_0xa76d('0x4e')]},'raw':!![]})['then'](function(_0x49be10){if(_0x49be10&&_0x49be10[_0xa76d('0x4f')]===0x0){return db[_0xa76d('0x28')][_0xa76d('0x46')]({'name':_0x5bf515[_0xa76d('0x33')],'resourceId':_0x5bf515['id'],'type':_0x49be10['name'],'sectionId':_0x49be10['id']},{})[_0xa76d('0x25')](function(){return _0x3a84b5;});}else{return _0x3a84b5;}})[_0xa76d('0x43')](function(_0x57eb03){logger[_0xa76d('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57eb03);throw _0x57eb03;});}return _0x3a84b5;})['then'](respondWithResult(_0x141a7a,0xc9))[_0xa76d('0x43')](handleError(_0x141a7a,null));};exports['update']=function(_0x197125,_0x14882f){if(_0x197125[_0xa76d('0x47')]['id']){delete _0x197125[_0xa76d('0x47')]['id'];}return db['OpenchannelQueue'][_0xa76d('0x4d')]({'where':{'id':_0x197125[_0xa76d('0x45')]['id']}})[_0xa76d('0x25')](handleEntityNotFound(_0x14882f,null))[_0xa76d('0x25')](saveUpdates(_0x197125[_0xa76d('0x47')],null))[_0xa76d('0x25')](respondWithResult(_0x14882f,null))[_0xa76d('0x43')](handleError(_0x14882f,null));};exports[_0xa76d('0x26')]=function(_0x4f7bc9,_0x57a5a9){return db[_0xa76d('0x2e')]['find']({'where':{'id':_0x4f7bc9['params']['id']}})[_0xa76d('0x25')](handleEntityNotFound(_0x57a5a9,null))[_0xa76d('0x25')](removeEntity(_0x57a5a9,null))[_0xa76d('0x43')](handleError(_0x57a5a9,null));};exports[_0xa76d('0x50')]=function(_0x229973,_0x1fb136){return db[_0xa76d('0x2e')][_0xa76d('0x50')]()[_0xa76d('0x25')](respondWithResult(_0x1fb136,null))[_0xa76d('0x43')](handleError(_0x1fb136,null));};exports[_0xa76d('0x51')]=function(_0x536f6f,_0x36e34d,_0x5d20a9){var _0x137c51={'raw':!![],'where':{}},_0x4dfa94={},_0x3da4f8;return db[_0xa76d('0x2e')][_0xa76d('0x52')]({'where':{'id':_0x536f6f[_0xa76d('0x45')]['id']}})[_0xa76d('0x25')](handleEntityNotFound(_0x36e34d,null))['then'](function(_0x3ba7db){if(_0x3ba7db){_0x3da4f8=_0x3ba7db['get']({'plain':!![]});_0x4dfa94[_0xa76d('0x32')]=_[_0xa76d('0x35')](db['UserOpenchannelQueue'][_0xa76d('0x53')]);_0x4dfa94[_0xa76d('0x34')]=_[_0xa76d('0x35')](_0x536f6f[_0xa76d('0x34')]);_0x4dfa94[_0xa76d('0x36')]=_[_0xa76d('0x37')](_0x4dfa94['model'],_0x4dfa94[_0xa76d('0x34')]);_0x137c51[_0xa76d('0x38')]=_[_0xa76d('0x37')](_0x4dfa94[_0xa76d('0x32')],qs['fields'](_0x536f6f[_0xa76d('0x34')]['fields']));_0x137c51[_0xa76d('0x38')]=_0x137c51[_0xa76d('0x38')]['length']?_0x137c51[_0xa76d('0x38')]:_0x4dfa94[_0xa76d('0x32')];if(!_0x536f6f[_0xa76d('0x34')]['hasOwnProperty'](_0xa76d('0x54'))){_0x137c51[_0xa76d('0x1f')]=qs[_0xa76d('0x1f')](_0x536f6f[_0xa76d('0x34')][_0xa76d('0x1f')]);_0x137c51[_0xa76d('0x22')]=qs[_0xa76d('0x22')](_0x536f6f['query'][_0xa76d('0x22')]);}_0x137c51[_0xa76d('0x55')]=qs['sort'](_0x536f6f[_0xa76d('0x34')]['sort']);_0x137c51[_0xa76d('0x3c')]=qs['filters'](_[_0xa76d('0x56')](_0x536f6f[_0xa76d('0x34')],_0x4dfa94[_0xa76d('0x36')]));_0x137c51[_0xa76d('0x3c')]['OpenchannelQueueId']=_0x3ba7db['id'];if(_0x536f6f[_0xa76d('0x34')]['filter']){_0x137c51[_0xa76d('0x3c')]=_[_0xa76d('0x3e')](_0x137c51['where'],{'$or':_[_0xa76d('0x2d')](_0x137c51[_0xa76d('0x38')],function(_0x566e16){var _0x1521ca={};_0x1521ca[_0x566e16]={'$like':'%'+_0x536f6f[_0xa76d('0x34')][_0xa76d('0x3d')]+'%'};return _0x1521ca;})});}_0x137c51=_[_0xa76d('0x3e')]({},_0x137c51,_0x536f6f['options']);return db[_0xa76d('0x57')][_0xa76d('0x58')](_0x137c51);}})[_0xa76d('0x25')](function(_0x223b97){if(_0x223b97){return db[_0xa76d('0x59')][_0xa76d('0x5a')]({'where':{'id':_[_0xa76d('0x2d')](_0x223b97,_0xa76d('0x5b')),'role':_0xa76d('0x5c')},'attributes':['id',_0xa76d('0x33'),_0xa76d('0x5d'),_0xa76d('0x5e'),_0xa76d('0x5f')]});}})[_0xa76d('0x25')](function(_0x516d32){if(_0x516d32){return{'count':_0x516d32[_0xa76d('0x21')],'rows':_[_0xa76d('0x2d')](_0x516d32[_0xa76d('0x42')],function(_0x5257f2){return{'membername':_0x5257f2[_0xa76d('0x33')],'UserId':_0x5257f2['id'],'queue_name':_0x3da4f8['name'],'OpenchannelQueueId':_0x3da4f8['id'],'interface':util[_0xa76d('0x60')]('%s/%s',_0xa76d('0x61'),_0x5257f2['name']),'penalty':0x0,'paused':_0x5257f2[_0xa76d('0x5d')],'createdAt':_0x5257f2[_0xa76d('0x5f')],'updatedAt':_0x5257f2[_0xa76d('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa76d('0x25')](respondWithFilteredResult(_0x36e34d,_0x137c51))[_0xa76d('0x43')](handleError(_0x36e34d,null));};exports[_0xa76d('0x62')]=function(_0x1916d5,_0x211c26,_0x4cb372){var _0x475d42={};var _0x207ac7={};var _0x525051;var _0x294096;return db['OpenchannelQueue'][_0xa76d('0x52')]({'where':{'id':_0x1916d5['params']['id']}})[_0xa76d('0x25')](handleEntityNotFound(_0x211c26,null))[_0xa76d('0x25')](function(_0x47ac63){if(_0x47ac63){_0x525051=_0x47ac63;_0x207ac7[_0xa76d('0x32')]=_[_0xa76d('0x35')](db[_0xa76d('0x63')]['rawAttributes']);_0x207ac7['query']=_['keys'](_0x1916d5[_0xa76d('0x34')]);_0x207ac7['filters']=_[_0xa76d('0x37')](_0x207ac7[_0xa76d('0x32')],_0x207ac7['query']);_0x475d42['attributes']=_[_0xa76d('0x37')](_0x207ac7[_0xa76d('0x32')],qs[_0xa76d('0x39')](_0x1916d5['query'][_0xa76d('0x39')]));_0x475d42['attributes']=_0x475d42[_0xa76d('0x38')][_0xa76d('0x3a')]?_0x475d42[_0xa76d('0x38')]:_0x207ac7['model'];_0x475d42['order']=qs['sort'](_0x1916d5['query']['sort']);_0x475d42[_0xa76d('0x3c')]=qs[_0xa76d('0x36')](_[_0xa76d('0x56')](_0x1916d5[_0xa76d('0x34')],_0x207ac7['filters']));if(_0x1916d5[_0xa76d('0x34')][_0xa76d('0x3d')]){_0x475d42['where']=_[_0xa76d('0x3e')](_0x475d42['where'],{'$or':_[_0xa76d('0x2d')](_0x475d42['attributes'],function(_0x69af7b){var _0x4abe1f={};_0x4abe1f[_0x69af7b]={'$like':'%'+_0x1916d5['query']['filter']+'%'};return _0x4abe1f;})});}_0x475d42=_[_0xa76d('0x3e')]({},_0x475d42,_0x1916d5[_0xa76d('0x3f')]);return _0x525051[_0xa76d('0x62')](_0x475d42);}})[_0xa76d('0x25')](function(_0x90fc55){if(_0x90fc55){_0x294096=_0x90fc55['length'];if(!_0x1916d5['query']['hasOwnProperty'](_0xa76d('0x54'))){_0x475d42[_0xa76d('0x1f')]=qs[_0xa76d('0x1f')](_0x1916d5[_0xa76d('0x34')][_0xa76d('0x1f')]);_0x475d42['offset']=qs[_0xa76d('0x22')](_0x1916d5[_0xa76d('0x34')][_0xa76d('0x22')]);}return _0x525051[_0xa76d('0x62')](_0x475d42);}})[_0xa76d('0x25')](function(_0x43be8a){if(_0x43be8a){return _0x43be8a?{'count':_0x294096,'rows':_0x43be8a}:null;}})[_0xa76d('0x25')](respondWithResult(_0x211c26,null))[_0xa76d('0x43')](handleError(_0x211c26,null));};exports[_0xa76d('0x64')]=function(_0x2bfdb5,_0x3131e4,_0x3c3f8d){var _0xad155a=_0x2bfdb5[_0xa76d('0x47')][_0xa76d('0x65')];return db['Team'][_0xa76d('0x58')]({'where':{'id':_0xad155a},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa76d('0x66'),'attributes':['id',_0xa76d('0x33'),'online',_0xa76d('0x67'),_0xa76d('0x68')],'raw':!![]}]})[_0xa76d('0x25')](function(_0x3fba68){if(_0x3fba68){var _0x255c4=_[_0xa76d('0x69')](_0x3fba68,function(_0x49d84c){var _0x4dba71=_0x49d84c[_0xa76d('0x27')]({'plain':!![]});return _0x4dba71[_0xa76d('0x66')];});return db['OpenchannelQueue'][_0xa76d('0x4d')]({'where':{'id':_0x2bfdb5[_0xa76d('0x45')]['id']}})[_0xa76d('0x25')](function(_0x4409f6){return db[_0xa76d('0x6a')][_0xa76d('0x6b')](function(_0x29b54b){return _0x4409f6[_0xa76d('0x64')](_0xad155a,{'transaction':_0x29b54b})[_0xa76d('0x25')](function(){return BPromise[_0xa76d('0x6c')](_0x255c4,function(_0x25f4cd){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x25f4cd['id'],'OpenchannelQueueId':_0x2bfdb5[_0xa76d('0x45')]['id']},'transaction':_0x29b54b});});})[_0xa76d('0x25')](function(){_0x255c4[_0xa76d('0x6d')](function(_0x29bd7d){socket['emit'](_0xa76d('0x6e'),{'UserId':_0x29bd7d['id'],'OpenchannelQueueId':_0x4409f6['id']});});});});});}})[_0xa76d('0x25')](respondWithStatusCode(_0x3131e4,null))[_0xa76d('0x43')](handleError(_0x3131e4,null));};exports[_0xa76d('0x6f')]=function(_0x26c826,_0x2216e1,_0x17e3c7){return db[_0xa76d('0x63')][_0xa76d('0x58')]({'where':{'id':_0x26c826['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa76d('0x59')],'as':_0xa76d('0x66'),'attributes':['id'],'raw':!![]}]})[_0xa76d('0x25')](handleEntityNotFound(_0x2216e1,null))[_0xa76d('0x25')](function(_0x45c80a){var _0x17abb1=_[_0xa76d('0x2d')](_0x45c80a,'id');var _0x5db687=[];var _0x23b6ba=[];var _0x5a9e27=squel[_0xa76d('0x70')]();_0x5a9e27[_0xa76d('0x71')]('tq.TeamId')[_0xa76d('0x72')](_0xa76d('0x73'),'tq')[_0xa76d('0x74')](_0xa76d('0x75'),'ut',_0xa76d('0x76'))[_0xa76d('0x3c')]('OpenchannelQueueId\x20=\x20?',_0x26c826[_0xa76d('0x45')]['id']);for(var _0x465c09=0x0;_0x465c09<_0x45c80a['length'];_0x465c09+=0x1){let _0x565341=_0x45c80a[_0x465c09];for(var _0x3d93f4=0x0;_0x3d93f4<_0x565341[_0xa76d('0x66')][_0xa76d('0x3a')];_0x3d93f4+=0x1){let _0x533045=_0x565341[_0xa76d('0x66')][_0x3d93f4];var _0x1b6367=_0x5a9e27[_0xa76d('0x77')]();_0x1b6367[_0xa76d('0x3c')](_0xa76d('0x78'),_0x533045['id']);_0x23b6ba[_0xa76d('0x79')](db[_0xa76d('0x6a')][_0xa76d('0x34')](_0x1b6367[_0xa76d('0x7a')](),{'type':db[_0xa76d('0x6a')]['QueryTypes'][_0xa76d('0x7b')]})[_0xa76d('0x25')](function(_0x1f62e2){if(_0x1f62e2[_0xa76d('0x3a')]===0x1){return _0x533045['id'];}else{var _0x4df001=_['every'](_[_0xa76d('0x2d')](_0x1f62e2,_0xa76d('0x7c')),function(_0xa25365){return _[_0xa76d('0x7d')](_0x17abb1,_0xa25365);});if(_0x4df001){return _0x533045['id'];}}}));}}return BPromise['all'](_0x23b6ba)['then'](function(_0x3d0fe1){_0x5db687=_(_0x5db687)[_0xa76d('0x7e')](_0x3d0fe1)[_0xa76d('0x7f')]()['value']();return db[_0xa76d('0x2e')]['find']({'where':{'id':_0x26c826['params']['id']}})[_0xa76d('0x25')](function(_0x17645b){return db[_0xa76d('0x6a')]['transaction'](function(_0x235ddd){return _0x17645b[_0xa76d('0x6f')](_0x26c826['query'][_0xa76d('0x65')],{'transaction':_0x235ddd})['then'](function(){if(!_[_0xa76d('0x80')](_0x5db687)){return _0x17645b[_0xa76d('0x81')](_0x5db687,{'transaction':_0x235ddd});}})['then'](function(){_0x5db687[_0xa76d('0x6d')](function(_0x87d405){socket[_0xa76d('0x82')](_0xa76d('0x83'),{'UserId':_0x87d405,'OpenchannelQueueId':_0x17645b['id']});});});});});});})[_0xa76d('0x25')](respondWithStatusCode(_0x2216e1,null))['catch'](handleError(_0x2216e1,null));};exports[_0xa76d('0x84')]=function(_0x1bc75f,_0x4d952d,_0x12364c){return db[_0xa76d('0x2e')][_0xa76d('0x4d')]({'where':{'id':_0x1bc75f[_0xa76d('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d952d,null))[_0xa76d('0x25')](function(_0x27c751){if(_0x27c751){return _0x27c751[_0xa76d('0x84')](_0x1bc75f[_0xa76d('0x47')][_0xa76d('0x65')],_['omit'](_0x1bc75f[_0xa76d('0x47')],[_0xa76d('0x65'),'id'])||{})[_0xa76d('0x85')](function(_0x154e63){for(var _0x2e4c3c=0x0;_0x2e4c3c<_0x1bc75f[_0xa76d('0x47')][_0xa76d('0x65')][_0xa76d('0x3a')];_0x2e4c3c+=0x1){socket[_0xa76d('0x82')](_0xa76d('0x6e'),{'UserId':Number(_0x1bc75f['body']['ids'][_0x2e4c3c]),'OpenchannelQueueId':Number(_0x1bc75f['params']['id'])});}return _0x154e63;});}})[_0xa76d('0x25')](respondWithResult(_0x4d952d,null))['catch'](handleError(_0x4d952d,null));};exports[_0xa76d('0x81')]=function(_0x276fd6,_0x4b8609,_0x10018a){return db[_0xa76d('0x2e')][_0xa76d('0x4d')]({'where':{'id':_0x276fd6['params']['id']}})[_0xa76d('0x25')](handleEntityNotFound(_0x4b8609,null))[_0xa76d('0x25')](function(_0x3ffc22){if(_0x3ffc22){return _0x3ffc22[_0xa76d('0x81')](_0x276fd6['query'][_0xa76d('0x65')])[_0xa76d('0x25')](function(){if(_[_0xa76d('0x86')](_0x276fd6[_0xa76d('0x34')][_0xa76d('0x65')])){for(var _0x1d2dbe=0x0;_0x1d2dbe<_0x276fd6[_0xa76d('0x34')]['ids'][_0xa76d('0x3a')];_0x1d2dbe+=0x1){socket[_0xa76d('0x82')]('userOpenchannelQueue:remove',{'UserId':Number(_0x276fd6['query']['ids'][_0x1d2dbe]),'OpenchannelQueueId':Number(_0x276fd6[_0xa76d('0x45')]['id'])});}}else{socket[_0xa76d('0x82')](_0xa76d('0x83'),{'UserId':Number(_0x276fd6['query'][_0xa76d('0x65')]),'OpenchannelQueueId':Number(_0x276fd6[_0xa76d('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x4b8609,null))[_0xa76d('0x43')](handleError(_0x4b8609,null));};exports[_0xa76d('0x87')]=function(_0x27b1d6,_0x43ef6f,_0x13bedc){var _0x1fcf2c={};var _0xbae64e={};var _0x16853e;var _0xf6e4c;return db['OpenchannelQueue'][_0xa76d('0x52')]({'where':{'id':_0x27b1d6[_0xa76d('0x45')]['id']}})[_0xa76d('0x25')](handleEntityNotFound(_0x43ef6f,null))[_0xa76d('0x25')](function(_0x4bc199){if(_0x4bc199){_0x16853e=_0x4bc199;_0xbae64e[_0xa76d('0x32')]=_[_0xa76d('0x35')](db['User'][_0xa76d('0x53')]);_0xbae64e[_0xa76d('0x34')]=_['keys'](_0x27b1d6[_0xa76d('0x34')]);_0xbae64e[_0xa76d('0x36')]=_[_0xa76d('0x37')](_0xbae64e[_0xa76d('0x32')],_0xbae64e[_0xa76d('0x34')]);_0x1fcf2c[_0xa76d('0x38')]=_['intersection'](_0xbae64e[_0xa76d('0x32')],qs[_0xa76d('0x39')](_0x27b1d6[_0xa76d('0x34')][_0xa76d('0x39')]));_0x1fcf2c[_0xa76d('0x38')]=_0x1fcf2c['attributes'][_0xa76d('0x3a')]?_0x1fcf2c['attributes']:_0xbae64e['model'];_0x1fcf2c[_0xa76d('0x55')]=qs[_0xa76d('0x3b')](_0x27b1d6['query']['sort']);_0x1fcf2c[_0xa76d('0x3c')]=qs[_0xa76d('0x36')](_[_0xa76d('0x56')](_0x27b1d6[_0xa76d('0x34')],_0xbae64e[_0xa76d('0x36')]));if(_0x27b1d6[_0xa76d('0x34')][_0xa76d('0x3d')]){_0x1fcf2c[_0xa76d('0x3c')]=_[_0xa76d('0x3e')](_0x1fcf2c[_0xa76d('0x3c')],{'$or':_[_0xa76d('0x2d')](_0x1fcf2c[_0xa76d('0x38')],function(_0x114bbb){var _0x1685c2={};_0x1685c2[_0x114bbb]={'$like':'%'+_0x27b1d6[_0xa76d('0x34')]['filter']+'%'};return _0x1685c2;})});}_0x1fcf2c=_[_0xa76d('0x3e')]({},_0x1fcf2c,_0x27b1d6[_0xa76d('0x3f')]);return _0x16853e[_0xa76d('0x87')](_0x1fcf2c);}})[_0xa76d('0x25')](function(_0x388e10){if(_0x388e10){_0xf6e4c=_0x388e10['length'];if(!_0x27b1d6['query'][_0xa76d('0x88')](_0xa76d('0x54'))){_0x1fcf2c[_0xa76d('0x1f')]=qs['limit'](_0x27b1d6[_0xa76d('0x34')][_0xa76d('0x1f')]);_0x1fcf2c[_0xa76d('0x22')]=qs[_0xa76d('0x22')](_0x27b1d6['query'][_0xa76d('0x22')]);}return _0x16853e[_0xa76d('0x87')](_0x1fcf2c);}})[_0xa76d('0x25')](function(_0x1210fa){if(_0x1210fa){return _0x1210fa?{'count':_0xf6e4c,'rows':_0x1210fa}:null;}})[_0xa76d('0x25')](respondWithResult(_0x43ef6f,null))[_0xa76d('0x43')](handleError(_0x43ef6f,null));}; \ No newline at end of file +var _0x209b=['removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','user','get','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','length','nolimit','pick','OpenchannelQueueId','User','findAndCountAll','UserId','updatedAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','TeamId','includes','all','union','value','isEmpty'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x209b,0x1bd));var _0xb209=function(_0x302a64,_0x191bf6){_0x302a64=_0x302a64-0x0;var _0xc4c71e=_0x209b[_0x302a64];return _0xc4c71e;};'use strict';var emlformat=require(_0xb209('0x0'));var rimraf=require(_0xb209('0x1'));var zipdir=require(_0xb209('0x2'));var jsonpatch=require(_0xb209('0x3'));var rp=require(_0xb209('0x4'));var moment=require(_0xb209('0x5'));var BPromise=require(_0xb209('0x6'));var Mustache=require(_0xb209('0x7'));var util=require(_0xb209('0x8'));var path=require(_0xb209('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb209('0xa'));var fs=require('fs');var fs_extra=require(_0xb209('0xb'));var _=require('lodash');var squel=require(_0xb209('0xc'));var crypto=require(_0xb209('0xd'));var jsforce=require(_0xb209('0xe'));var deskjs=require(_0xb209('0xf'));var toCsv=require(_0xb209('0x10'));var querystring=require(_0xb209('0x11'));var Papa=require('papaparse');var Redis=require(_0xb209('0x12'));var authService=require(_0xb209('0x13'));var qs=require(_0xb209('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb209('0x15'));var logger=require('../../config/logger')(_0xb209('0x16'));var utils=require(_0xb209('0x17'));var config=require(_0xb209('0x18'));var licenseUtil=require(_0xb209('0x19'));var db=require(_0xb209('0x1a'))['db'];config['redis']=_[_0xb209('0x1b')](config[_0xb209('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xb209('0x1d'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xb209('0x1e')](socket);function respondWithStatusCode(_0x170e8a,_0xbc1fa3){_0xbc1fa3=_0xbc1fa3||0xcc;return function(_0x215582){if(_0x215582){return _0x170e8a[_0xb209('0x1f')](_0xbc1fa3);}return _0x170e8a[_0xb209('0x20')](_0xbc1fa3)[_0xb209('0x21')]();};}function respondWithResult(_0x327fbb,_0x5061c5){_0x5061c5=_0x5061c5||0xc8;return function(_0x36e097){if(_0x36e097){return _0x327fbb[_0xb209('0x20')](_0x5061c5)[_0xb209('0x22')](_0x36e097);}};}function respondWithFilteredResult(_0x511561,_0x1f403d){return function(_0x59e828){if(_0x59e828){var _0x51e526=typeof _0x1f403d[_0xb209('0x23')]===_0xb209('0x24')&&typeof _0x1f403d['limit']==='undefined';var _0x4d5a86=_0x59e828[_0xb209('0x25')];var _0x53a808=_0x51e526?0x0:_0x1f403d['offset'];var _0x598dc3=_0x51e526?_0x59e828[_0xb209('0x25')]:_0x1f403d['offset']+_0x1f403d['limit'];var _0x3b8d4a;if(_0x598dc3>=_0x4d5a86){_0x598dc3=_0x4d5a86;_0x3b8d4a=0xc8;}else{_0x3b8d4a=0xce;}_0x511561[_0xb209('0x20')](_0x3b8d4a);return _0x511561[_0xb209('0x26')](_0xb209('0x27'),_0x53a808+'-'+_0x598dc3+'/'+_0x4d5a86)[_0xb209('0x22')](_0x59e828);}return null;};}function patchUpdates(_0x183260){return function(_0x35a38b){try{jsonpatch[_0xb209('0x28')](_0x35a38b,_0x183260,!![]);}catch(_0x52d435){return BPromise[_0xb209('0x29')](_0x52d435);}return _0x35a38b[_0xb209('0x2a')]();};}function saveUpdates(_0x489647,_0x4de679){return function(_0x3bc218){if(_0x3bc218){return _0x3bc218[_0xb209('0x2b')](_0x489647)[_0xb209('0x2c')](function(_0x77738b){return _0x77738b;});}return null;};}function removeEntity(_0x26f005,_0xfd9cf7){return function(_0x322252){if(_0x322252){return _0x322252[_0xb209('0x2d')]()[_0xb209('0x2c')](function(){var _0x6c3539=_0x322252['get']({'plain':!![]});var _0x4c35f8=_0xb209('0x2e');return db[_0xb209('0x2f')][_0xb209('0x2d')]({'where':{'type':_0x4c35f8,'resourceId':_0x6c3539['id']}})['then'](function(){return _0x322252;});})[_0xb209('0x2c')](function(){_0x26f005[_0xb209('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x900df4,_0x22114c){return function(_0x1faa62){if(!_0x1faa62){_0x900df4[_0xb209('0x1f')](0x194);}return _0x1faa62;};}function handleError(_0x4c2e9f,_0x5950d9){_0x5950d9=_0x5950d9||0x1f4;return function(_0x5a5a4d){logger['error'](_0x5a5a4d[_0xb209('0x30')]);if(_0x5a5a4d[_0xb209('0x31')]){delete _0x5a5a4d[_0xb209('0x31')];}_0x4c2e9f[_0xb209('0x20')](_0x5950d9)[_0xb209('0x32')](_0x5a5a4d);};}exports[_0xb209('0x33')]=function(_0x1aadda,_0x301f7a){var _0x4fcbf8={},_0xcf9a1={},_0x4db5a4={'count':0x0,'rows':[]};var _0xe8adb=_['map'](db[_0xb209('0x34')][_0xb209('0x35')],function(_0x1af76e){return{'name':_0x1af76e[_0xb209('0x36')],'type':_0x1af76e['type']['key']};});_0xcf9a1[_0xb209('0x37')]=_[_0xb209('0x38')](_0xe8adb,_0xb209('0x31'));_0xcf9a1[_0xb209('0x39')]=_[_0xb209('0x3a')](_0x1aadda['query']);_0xcf9a1['filters']=_[_0xb209('0x3b')](_0xcf9a1[_0xb209('0x37')],_0xcf9a1[_0xb209('0x39')]);_0x4fcbf8[_0xb209('0x3c')]=_[_0xb209('0x3b')](_0xcf9a1[_0xb209('0x37')],qs['fields'](_0x1aadda[_0xb209('0x39')][_0xb209('0x3d')]));_0x4fcbf8[_0xb209('0x3c')]=_0x4fcbf8[_0xb209('0x3c')]['length']?_0x4fcbf8[_0xb209('0x3c')]:_0xcf9a1['model'];if(!_0x1aadda[_0xb209('0x39')][_0xb209('0x3e')]('nolimit')){_0x4fcbf8[_0xb209('0x3f')]=qs[_0xb209('0x3f')](_0x1aadda[_0xb209('0x39')][_0xb209('0x3f')]);_0x4fcbf8[_0xb209('0x23')]=qs['offset'](_0x1aadda[_0xb209('0x39')][_0xb209('0x23')]);}_0x4fcbf8[_0xb209('0x40')]=qs[_0xb209('0x41')](_0x1aadda[_0xb209('0x39')]['sort']);_0x4fcbf8['where']=qs['filters'](_['pick'](_0x1aadda[_0xb209('0x39')],_0xcf9a1[_0xb209('0x42')]),_0xe8adb);if(_0x1aadda['query'][_0xb209('0x43')]){_0x4fcbf8[_0xb209('0x44')]=_[_0xb209('0x45')](_0x4fcbf8[_0xb209('0x44')],{'$or':_['map'](_0xe8adb,function(_0x384cf6){if(_0x384cf6[_0xb209('0x46')]!==_0xb209('0x47')){var _0x83928f={};_0x83928f[_0x384cf6[_0xb209('0x31')]]={'$like':'%'+_0x1aadda[_0xb209('0x39')][_0xb209('0x43')]+'%'};return _0x83928f;}})});}_0x4fcbf8=_[_0xb209('0x45')]({},_0x4fcbf8,_0x1aadda[_0xb209('0x48')]);var _0x2f76dd={'where':_0x4fcbf8['where']};return db['OpenchannelQueue']['count'](_0x2f76dd)[_0xb209('0x2c')](function(_0x5a9550){_0x4db5a4[_0xb209('0x25')]=_0x5a9550;if(_0x1aadda[_0xb209('0x39')][_0xb209('0x49')]){_0x4fcbf8[_0xb209('0x4a')]=[{'all':!![]}];}return db[_0xb209('0x34')][_0xb209('0x4b')](_0x4fcbf8);})[_0xb209('0x2c')](function(_0x25d352){_0x4db5a4[_0xb209('0x4c')]=_0x25d352;return _0x4db5a4;})['then'](respondWithFilteredResult(_0x301f7a,_0x4fcbf8))['catch'](handleError(_0x301f7a,null));};exports[_0xb209('0x4d')]=function(_0x2c969d,_0x43da5b){var _0x2222d7={'raw':!![],'where':{'id':_0x2c969d['params']['id']}},_0x15e809={};_0x15e809[_0xb209('0x37')]=_['keys'](db['OpenchannelQueue'][_0xb209('0x35')]);_0x15e809['query']=_[_0xb209('0x3a')](_0x2c969d['query']);_0x15e809[_0xb209('0x42')]=_[_0xb209('0x3b')](_0x15e809[_0xb209('0x37')],_0x15e809[_0xb209('0x39')]);_0x2222d7['attributes']=_[_0xb209('0x3b')](_0x15e809[_0xb209('0x37')],qs[_0xb209('0x3d')](_0x2c969d[_0xb209('0x39')][_0xb209('0x3d')]));_0x2222d7[_0xb209('0x3c')]=_0x2222d7[_0xb209('0x3c')]['length']?_0x2222d7[_0xb209('0x3c')]:_0x15e809['model'];if(_0x2c969d[_0xb209('0x39')][_0xb209('0x49')]){_0x2222d7[_0xb209('0x4a')]=[{'all':!![]}];}_0x2222d7=_[_0xb209('0x45')]({},_0x2222d7,_0x2c969d[_0xb209('0x48')]);return db[_0xb209('0x34')][_0xb209('0x4e')](_0x2222d7)[_0xb209('0x2c')](handleEntityNotFound(_0x43da5b,null))[_0xb209('0x2c')](respondWithResult(_0x43da5b,null))[_0xb209('0x4f')](handleError(_0x43da5b,null));};exports['create']=function(_0xe541fc,_0x501d59){return db[_0xb209('0x34')][_0xb209('0x50')](_0xe541fc[_0xb209('0x51')],{})[_0xb209('0x2c')](function(_0x13dbf6){var _0x2fa9ed=_0xe541fc[_0xb209('0x52')][_0xb209('0x53')]({'plain':!![]});if(!_0x2fa9ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fa9ed[_0xb209('0x54')]===_0xb209('0x52')){var _0x55942a=_0x13dbf6[_0xb209('0x53')]({'plain':!![]});var _0x374e24='OpenchannelQueues';return db['UserProfileSection'][_0xb209('0x4e')]({'where':{'name':_0x374e24,'userProfileId':_0x2fa9ed[_0xb209('0x55')]},'raw':!![]})[_0xb209('0x2c')](function(_0x1b6c1d){if(_0x1b6c1d&&_0x1b6c1d[_0xb209('0x56')]===0x0){return db['UserProfileResource'][_0xb209('0x50')]({'name':_0x55942a[_0xb209('0x31')],'resourceId':_0x55942a['id'],'type':_0x1b6c1d[_0xb209('0x31')],'sectionId':_0x1b6c1d['id']},{})[_0xb209('0x2c')](function(){return _0x13dbf6;});}else{return _0x13dbf6;}})[_0xb209('0x4f')](function(_0x39163b){logger[_0xb209('0x57')](_0xb209('0x58'),_0x39163b);throw _0x39163b;});}return _0x13dbf6;})[_0xb209('0x2c')](respondWithResult(_0x501d59,0xc9))[_0xb209('0x4f')](handleError(_0x501d59,null));};exports[_0xb209('0x2b')]=function(_0x2aca22,_0x122b39){if(_0x2aca22[_0xb209('0x51')]['id']){delete _0x2aca22[_0xb209('0x51')]['id'];}return db[_0xb209('0x34')][_0xb209('0x4e')]({'where':{'id':_0x2aca22['params']['id']}})[_0xb209('0x2c')](handleEntityNotFound(_0x122b39,null))[_0xb209('0x2c')](saveUpdates(_0x2aca22[_0xb209('0x51')],null))[_0xb209('0x2c')](respondWithResult(_0x122b39,null))[_0xb209('0x4f')](handleError(_0x122b39,null));};exports[_0xb209('0x2d')]=function(_0x2eecce,_0x1f595f){return db[_0xb209('0x34')][_0xb209('0x4e')]({'where':{'id':_0x2eecce[_0xb209('0x59')]['id']}})['then'](handleEntityNotFound(_0x1f595f,null))['then'](removeEntity(_0x1f595f,null))[_0xb209('0x4f')](handleError(_0x1f595f,null));};exports[_0xb209('0x5a')]=function(_0x3d15a1,_0xcf9660){return db[_0xb209('0x34')]['describe']()[_0xb209('0x2c')](respondWithResult(_0xcf9660,null))[_0xb209('0x4f')](handleError(_0xcf9660,null));};exports[_0xb209('0x5b')]=function(_0x28a2ac,_0x554cc3,_0x271d5f){var _0x217c56={'raw':!![],'where':{}},_0x482c0a={},_0x1f610e;return db['OpenchannelQueue'][_0xb209('0x5c')]({'where':{'id':_0x28a2ac['params']['id']}})[_0xb209('0x2c')](handleEntityNotFound(_0x554cc3,null))['then'](function(_0x310b99){if(_0x310b99){_0x1f610e=_0x310b99[_0xb209('0x53')]({'plain':!![]});_0x482c0a[_0xb209('0x37')]=_['keys'](db[_0xb209('0x5d')][_0xb209('0x35')]);_0x482c0a[_0xb209('0x39')]=_['keys'](_0x28a2ac[_0xb209('0x39')]);_0x482c0a[_0xb209('0x42')]=_['intersection'](_0x482c0a['model'],_0x482c0a[_0xb209('0x39')]);_0x217c56[_0xb209('0x3c')]=_[_0xb209('0x3b')](_0x482c0a[_0xb209('0x37')],qs[_0xb209('0x3d')](_0x28a2ac['query'][_0xb209('0x3d')]));_0x217c56[_0xb209('0x3c')]=_0x217c56[_0xb209('0x3c')][_0xb209('0x5e')]?_0x217c56[_0xb209('0x3c')]:_0x482c0a[_0xb209('0x37')];if(!_0x28a2ac[_0xb209('0x39')]['hasOwnProperty'](_0xb209('0x5f'))){_0x217c56[_0xb209('0x3f')]=qs[_0xb209('0x3f')](_0x28a2ac['query'][_0xb209('0x3f')]);_0x217c56[_0xb209('0x23')]=qs[_0xb209('0x23')](_0x28a2ac[_0xb209('0x39')][_0xb209('0x23')]);}_0x217c56[_0xb209('0x40')]=qs['sort'](_0x28a2ac[_0xb209('0x39')][_0xb209('0x41')]);_0x217c56[_0xb209('0x44')]=qs[_0xb209('0x42')](_[_0xb209('0x60')](_0x28a2ac[_0xb209('0x39')],_0x482c0a[_0xb209('0x42')]));_0x217c56['where'][_0xb209('0x61')]=_0x310b99['id'];if(_0x28a2ac[_0xb209('0x39')][_0xb209('0x43')]){_0x217c56[_0xb209('0x44')]=_[_0xb209('0x45')](_0x217c56[_0xb209('0x44')],{'$or':_[_0xb209('0x38')](_0x217c56['attributes'],function(_0xff36cf){var _0x5587e1={};_0x5587e1[_0xff36cf]={'$like':'%'+_0x28a2ac[_0xb209('0x39')][_0xb209('0x43')]+'%'};return _0x5587e1;})});}_0x217c56=_['merge']({},_0x217c56,_0x28a2ac[_0xb209('0x48')]);return db[_0xb209('0x5d')][_0xb209('0x4b')](_0x217c56);}})[_0xb209('0x2c')](function(_0xafb53c){if(_0xafb53c){return db[_0xb209('0x62')][_0xb209('0x63')]({'where':{'id':_[_0xb209('0x38')](_0xafb53c,_0xb209('0x64')),'role':'agent'},'attributes':['id',_0xb209('0x31'),'openchannelPause',_0xb209('0x65'),'createdAt']});}})['then'](function(_0x1b4475){if(_0x1b4475){return{'count':_0x1b4475['count'],'rows':_[_0xb209('0x38')](_0x1b4475[_0xb209('0x4c')],function(_0x1dd9fd){return{'membername':_0x1dd9fd[_0xb209('0x31')],'UserId':_0x1dd9fd['id'],'queue_name':_0x1f610e['name'],'OpenchannelQueueId':_0x1f610e['id'],'interface':util[_0xb209('0x66')](_0xb209('0x67'),_0xb209('0x68'),_0x1dd9fd['name']),'penalty':0x0,'paused':_0x1dd9fd[_0xb209('0x69')],'createdAt':_0x1dd9fd['createdAt'],'updatedAt':_0x1dd9fd[_0xb209('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb209('0x2c')](respondWithFilteredResult(_0x554cc3,_0x217c56))['catch'](handleError(_0x554cc3,null));};exports[_0xb209('0x6a')]=function(_0x59b114,_0x576f65,_0x21e28f){var _0x4e422d={};var _0x27eaf1={};var _0x554fbe;var _0x5851bc;return db[_0xb209('0x34')][_0xb209('0x5c')]({'where':{'id':_0x59b114[_0xb209('0x59')]['id']}})['then'](handleEntityNotFound(_0x576f65,null))[_0xb209('0x2c')](function(_0x2e8415){if(_0x2e8415){_0x554fbe=_0x2e8415;_0x27eaf1[_0xb209('0x37')]=_['keys'](db[_0xb209('0x6b')][_0xb209('0x35')]);_0x27eaf1[_0xb209('0x39')]=_[_0xb209('0x3a')](_0x59b114[_0xb209('0x39')]);_0x27eaf1[_0xb209('0x42')]=_[_0xb209('0x3b')](_0x27eaf1[_0xb209('0x37')],_0x27eaf1['query']);_0x4e422d[_0xb209('0x3c')]=_[_0xb209('0x3b')](_0x27eaf1[_0xb209('0x37')],qs[_0xb209('0x3d')](_0x59b114[_0xb209('0x39')][_0xb209('0x3d')]));_0x4e422d[_0xb209('0x3c')]=_0x4e422d[_0xb209('0x3c')][_0xb209('0x5e')]?_0x4e422d['attributes']:_0x27eaf1[_0xb209('0x37')];_0x4e422d[_0xb209('0x40')]=qs['sort'](_0x59b114['query'][_0xb209('0x41')]);_0x4e422d[_0xb209('0x44')]=qs[_0xb209('0x42')](_[_0xb209('0x60')](_0x59b114[_0xb209('0x39')],_0x27eaf1[_0xb209('0x42')]));if(_0x59b114[_0xb209('0x39')][_0xb209('0x43')]){_0x4e422d['where']=_[_0xb209('0x45')](_0x4e422d[_0xb209('0x44')],{'$or':_[_0xb209('0x38')](_0x4e422d['attributes'],function(_0x537a17){var _0x223500={};_0x223500[_0x537a17]={'$like':'%'+_0x59b114[_0xb209('0x39')][_0xb209('0x43')]+'%'};return _0x223500;})});}_0x4e422d=_[_0xb209('0x45')]({},_0x4e422d,_0x59b114[_0xb209('0x48')]);return _0x554fbe[_0xb209('0x6a')](_0x4e422d);}})[_0xb209('0x2c')](function(_0x264509){if(_0x264509){_0x5851bc=_0x264509['length'];if(!_0x59b114[_0xb209('0x39')][_0xb209('0x3e')](_0xb209('0x5f'))){_0x4e422d['limit']=qs[_0xb209('0x3f')](_0x59b114['query']['limit']);_0x4e422d['offset']=qs[_0xb209('0x23')](_0x59b114[_0xb209('0x39')]['offset']);}return _0x554fbe['getTeams'](_0x4e422d);}})[_0xb209('0x2c')](function(_0x1b9020){if(_0x1b9020){return _0x1b9020?{'count':_0x5851bc,'rows':_0x1b9020}:null;}})[_0xb209('0x2c')](respondWithResult(_0x576f65,null))[_0xb209('0x4f')](handleError(_0x576f65,null));};exports['addTeams']=function(_0xe76f0e,_0x53732c,_0x39e17f){var _0x3c32f5=_0xe76f0e[_0xb209('0x51')]['ids'];return db[_0xb209('0x6b')][_0xb209('0x4b')]({'where':{'id':_0x3c32f5},'attributes':['id'],'include':[{'model':db[_0xb209('0x62')],'as':_0xb209('0x6c'),'attributes':['id','name',_0xb209('0x6d'),_0xb209('0x6e'),_0xb209('0x6f')],'raw':!![]}]})[_0xb209('0x2c')](function(_0x589ec8){if(_0x589ec8){var _0x4f272b=_[_0xb209('0x70')](_0x589ec8,function(_0x372c40){var _0x331205=_0x372c40[_0xb209('0x53')]({'plain':!![]});return _0x331205[_0xb209('0x6c')];});return db[_0xb209('0x34')]['find']({'where':{'id':_0xe76f0e[_0xb209('0x59')]['id']}})[_0xb209('0x2c')](function(_0x34fbd6){return db[_0xb209('0x71')][_0xb209('0x72')](function(_0x18bd7e){return _0x34fbd6[_0xb209('0x73')](_0x3c32f5,{'transaction':_0x18bd7e})[_0xb209('0x2c')](function(){return BPromise[_0xb209('0x74')](_0x4f272b,function(_0x3d7361){return db[_0xb209('0x5d')][_0xb209('0x75')]({'where':{'UserId':_0x3d7361['id'],'OpenchannelQueueId':_0xe76f0e[_0xb209('0x59')]['id']},'transaction':_0x18bd7e});});})['then'](function(){_0x4f272b[_0xb209('0x76')](function(_0x336c5d){socket[_0xb209('0x77')](_0xb209('0x78'),{'UserId':_0x336c5d['id'],'OpenchannelQueueId':_0x34fbd6['id']});});});});});}})['then'](respondWithStatusCode(_0x53732c,null))[_0xb209('0x4f')](handleError(_0x53732c,null));};exports[_0xb209('0x79')]=function(_0x6ab1d3,_0xc5cf77,_0x3b5cc4){return db[_0xb209('0x6b')]['findAll']({'where':{'id':_0x6ab1d3[_0xb209('0x39')][_0xb209('0x7a')]},'attributes':['id'],'include':[{'model':db[_0xb209('0x62')],'as':_0xb209('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xb209('0x2c')](handleEntityNotFound(_0xc5cf77,null))[_0xb209('0x2c')](function(_0x13be22){var _0x505673=_['map'](_0x13be22,'id');var _0x54e4d2=[];var _0x2d4e86=[];var _0x258ac7=squel['select']();_0x258ac7[_0xb209('0x7b')](_0xb209('0x7c'))[_0xb209('0x7d')](_0xb209('0x7e'),'tq')[_0xb209('0x7f')](_0xb209('0x80'),'ut',_0xb209('0x81'))['where']('OpenchannelQueueId\x20=\x20?',_0x6ab1d3[_0xb209('0x59')]['id']);for(var _0x41fd2a=0x0;_0x41fd2a<_0x13be22[_0xb209('0x5e')];_0x41fd2a+=0x1){let _0x170b9e=_0x13be22[_0x41fd2a];for(var _0x150d84=0x0;_0x150d84<_0x170b9e['Agents'][_0xb209('0x5e')];_0x150d84+=0x1){let _0x204031=_0x170b9e[_0xb209('0x6c')][_0x150d84];var _0x2f4560=_0x258ac7[_0xb209('0x82')]();_0x2f4560['where']('ut.UserId\x20=\x20?',_0x204031['id']);_0x2d4e86[_0xb209('0x83')](db[_0xb209('0x71')][_0xb209('0x39')](_0x2f4560[_0xb209('0x84')](),{'type':db[_0xb209('0x71')]['QueryTypes']['SELECT']})[_0xb209('0x2c')](function(_0x1a8989){if(_0x1a8989[_0xb209('0x5e')]===0x1){return _0x204031['id'];}else{var _0x4c79b8=_['every'](_[_0xb209('0x38')](_0x1a8989,_0xb209('0x85')),function(_0x9f3180){return _[_0xb209('0x86')](_0x505673,_0x9f3180);});if(_0x4c79b8){return _0x204031['id'];}}}));}}return BPromise[_0xb209('0x87')](_0x2d4e86)[_0xb209('0x2c')](function(_0x39beb4){_0x54e4d2=_(_0x54e4d2)[_0xb209('0x88')](_0x39beb4)['compact']()[_0xb209('0x89')]();return db['OpenchannelQueue'][_0xb209('0x4e')]({'where':{'id':_0x6ab1d3['params']['id']}})[_0xb209('0x2c')](function(_0x183c8e){return db[_0xb209('0x71')][_0xb209('0x72')](function(_0x869ebf){return _0x183c8e['removeTeams'](_0x6ab1d3['query'][_0xb209('0x7a')],{'transaction':_0x869ebf})['then'](function(){if(!_[_0xb209('0x8a')](_0x54e4d2)){return _0x183c8e[_0xb209('0x8b')](_0x54e4d2,{'transaction':_0x869ebf});}})[_0xb209('0x2c')](function(){_0x54e4d2[_0xb209('0x76')](function(_0x19caed){socket[_0xb209('0x77')](_0xb209('0x8c'),{'UserId':_0x19caed,'OpenchannelQueueId':_0x183c8e['id']});});});});});});})[_0xb209('0x2c')](respondWithStatusCode(_0xc5cf77,null))[_0xb209('0x4f')](handleError(_0xc5cf77,null));};exports[_0xb209('0x8d')]=function(_0x7166bf,_0xba177c,_0x3c04d6){return db[_0xb209('0x34')][_0xb209('0x4e')]({'where':{'id':_0x7166bf[_0xb209('0x59')]['id']}})[_0xb209('0x2c')](handleEntityNotFound(_0xba177c,null))[_0xb209('0x2c')](function(_0x907c2b){if(_0x907c2b){return _0x907c2b[_0xb209('0x8d')](_0x7166bf['body'][_0xb209('0x7a')],_[_0xb209('0x8e')](_0x7166bf[_0xb209('0x51')],['ids','id'])||{})[_0xb209('0x8f')](function(_0x4852ab){for(var _0x482383=0x0;_0x482383<_0x7166bf['body'][_0xb209('0x7a')][_0xb209('0x5e')];_0x482383+=0x1){socket[_0xb209('0x77')]('userOpenchannelQueue:save',{'UserId':Number(_0x7166bf[_0xb209('0x51')][_0xb209('0x7a')][_0x482383]),'OpenchannelQueueId':Number(_0x7166bf['params']['id'])});}return _0x4852ab;});}})[_0xb209('0x2c')](respondWithResult(_0xba177c,null))[_0xb209('0x4f')](handleError(_0xba177c,null));};exports[_0xb209('0x8b')]=function(_0x18feff,_0x29971d,_0x256737){return db['OpenchannelQueue'][_0xb209('0x4e')]({'where':{'id':_0x18feff[_0xb209('0x59')]['id']}})[_0xb209('0x2c')](handleEntityNotFound(_0x29971d,null))[_0xb209('0x2c')](function(_0x19c164){if(_0x19c164){return _0x19c164[_0xb209('0x8b')](_0x18feff[_0xb209('0x39')]['ids'])[_0xb209('0x2c')](function(){if(_[_0xb209('0x90')](_0x18feff[_0xb209('0x39')][_0xb209('0x7a')])){for(var _0x52eb8b=0x0;_0x52eb8b<_0x18feff[_0xb209('0x39')][_0xb209('0x7a')][_0xb209('0x5e')];_0x52eb8b+=0x1){socket[_0xb209('0x77')]('userOpenchannelQueue:remove',{'UserId':Number(_0x18feff[_0xb209('0x39')][_0xb209('0x7a')][_0x52eb8b]),'OpenchannelQueueId':Number(_0x18feff[_0xb209('0x59')]['id'])});}}else{socket[_0xb209('0x77')](_0xb209('0x8c'),{'UserId':Number(_0x18feff[_0xb209('0x39')]['ids']),'OpenchannelQueueId':Number(_0x18feff[_0xb209('0x59')]['id'])});}});}})[_0xb209('0x2c')](respondWithStatusCode(_0x29971d,null))[_0xb209('0x4f')](handleError(_0x29971d,null));};exports[_0xb209('0x91')]=function(_0x57cba2,_0x387aab,_0xa50e83){var _0x538c88={};var _0x1e5fca={};var _0x2ee361;var _0x110251;return db[_0xb209('0x34')][_0xb209('0x5c')]({'where':{'id':_0x57cba2[_0xb209('0x59')]['id']}})[_0xb209('0x2c')](handleEntityNotFound(_0x387aab,null))['then'](function(_0x2d7e42){if(_0x2d7e42){_0x2ee361=_0x2d7e42;_0x1e5fca[_0xb209('0x37')]=_[_0xb209('0x3a')](db[_0xb209('0x62')]['rawAttributes']);_0x1e5fca['query']=_['keys'](_0x57cba2[_0xb209('0x39')]);_0x1e5fca[_0xb209('0x42')]=_[_0xb209('0x3b')](_0x1e5fca[_0xb209('0x37')],_0x1e5fca[_0xb209('0x39')]);_0x538c88['attributes']=_[_0xb209('0x3b')](_0x1e5fca[_0xb209('0x37')],qs[_0xb209('0x3d')](_0x57cba2['query'][_0xb209('0x3d')]));_0x538c88[_0xb209('0x3c')]=_0x538c88['attributes'][_0xb209('0x5e')]?_0x538c88['attributes']:_0x1e5fca[_0xb209('0x37')];_0x538c88[_0xb209('0x40')]=qs[_0xb209('0x41')](_0x57cba2['query'][_0xb209('0x41')]);_0x538c88[_0xb209('0x44')]=qs[_0xb209('0x42')](_['pick'](_0x57cba2[_0xb209('0x39')],_0x1e5fca['filters']));if(_0x57cba2[_0xb209('0x39')]['filter']){_0x538c88[_0xb209('0x44')]=_[_0xb209('0x45')](_0x538c88[_0xb209('0x44')],{'$or':_[_0xb209('0x38')](_0x538c88[_0xb209('0x3c')],function(_0xf4270b){var _0x483fc5={};_0x483fc5[_0xf4270b]={'$like':'%'+_0x57cba2['query'][_0xb209('0x43')]+'%'};return _0x483fc5;})});}_0x538c88=_[_0xb209('0x45')]({},_0x538c88,_0x57cba2[_0xb209('0x48')]);return _0x2ee361['getAgents'](_0x538c88);}})['then'](function(_0x265bde){if(_0x265bde){_0x110251=_0x265bde[_0xb209('0x5e')];if(!_0x57cba2[_0xb209('0x39')]['hasOwnProperty'](_0xb209('0x5f'))){_0x538c88[_0xb209('0x3f')]=qs['limit'](_0x57cba2[_0xb209('0x39')][_0xb209('0x3f')]);_0x538c88[_0xb209('0x23')]=qs[_0xb209('0x23')](_0x57cba2[_0xb209('0x39')][_0xb209('0x23')]);}return _0x2ee361[_0xb209('0x91')](_0x538c88);}})[_0xb209('0x2c')](function(_0x53f2bc){if(_0x53f2bc){return _0x53f2bc?{'count':_0x110251,'rows':_0x53f2bc}:null;}})[_0xb209('0x2c')](respondWithResult(_0x387aab,null))[_0xb209('0x4f')](handleError(_0x387aab,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c6780cb..62f774b 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 _0x6e3a=['remove','emit','hasOwnProperty','hook','exports','OpenchannelQueue','setMaxListeners','update'];(function(_0x48bae4,_0x3502fe){var _0x210760=function(_0x3b273e){while(--_0x3b273e){_0x48bae4['push'](_0x48bae4['shift']());}};_0x210760(++_0x3502fe);}(_0x6e3a,0xdd));var _0xa6e3=function(_0x4921e5,_0x4b4f4f){_0x4921e5=_0x4921e5-0x0;var _0x562ac5=_0x6e3a[_0x4921e5];return _0x562ac5;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0xa6e3('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa6e3('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6e3('0x2'),'afterDestroy':_0xa6e3('0x3')};function emitEvent(_0x32c145){return function(_0x30163a,_0x4f4653,_0x279dc4){OpenchannelQueueEvents[_0xa6e3('0x4')](_0x32c145+':'+_0x30163a['id'],_0x30163a);OpenchannelQueueEvents['emit'](_0x32c145,_0x30163a);_0x279dc4(null);};}for(var e in events){if(events[_0xa6e3('0x5')](e)){var event=events[e];OpenchannelQueue[_0xa6e3('0x6')](e,emitEvent(event));}}module[_0xa6e3('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xe631=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x579042,_0x5a356f){var _0x3546af=function(_0x5a2689){while(--_0x5a2689){_0x579042['push'](_0x579042['shift']());}};_0x3546af(++_0x5a356f);}(_0xe631,0x1b9));var _0x1e63=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0xe631[_0x208505];return _0x1a985f;};'use strict';var EventEmitter=require(_0x1e63('0x0'));var OpenchannelQueue=require(_0x1e63('0x1'))['db'][_0x1e63('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1e63('0x3')](0x0);var events={'afterCreate':_0x1e63('0x4'),'afterUpdate':_0x1e63('0x5'),'afterDestroy':_0x1e63('0x6')};function emitEvent(_0x3f7533){return function(_0x25701a,_0x5ccb1a,_0x15789d){OpenchannelQueueEvents[_0x1e63('0x7')](_0x3f7533+':'+_0x25701a['id'],_0x25701a);OpenchannelQueueEvents[_0x1e63('0x7')](_0x3f7533,_0x25701a);_0x15789d(null);};}for(var e in events){if(events[_0x1e63('0x8')](e)){var event=events[e];OpenchannelQueue[_0x1e63('0x9')](e,emitEvent(event));}}module[_0x1e63('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index a63f1cf..9e2eb1c 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 _0xc4b8=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4b8,0x175));var _0x8c4b=function(_0x3e790d,_0x4065d0){_0x3e790d=_0x3e790d-0x0;var _0x3e48eb=_0xc4b8[_0x3e790d];return _0x3e48eb;};'use strict';var _=require(_0x8c4b('0x0'));var util=require(_0x8c4b('0x1'));var logger=require(_0x8c4b('0x2'))('api');var moment=require(_0x8c4b('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c4b('0x4'));var fs=require('fs');var path=require(_0x8c4b('0x5'));var rimraf=require(_0x8c4b('0x6'));var config=require(_0x8c4b('0x7'));var attributes=require(_0x8c4b('0x8'));module[_0x8c4b('0x9')]=function(_0x1caa53,_0x23b030){return _0x1caa53[_0x8c4b('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb8f=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','openchannel_queues','lodash','util'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcb8f,0xbe));var _0xfcb8=function(_0x30cfe4,_0x5bfea0){_0x30cfe4=_0x30cfe4-0x0;var _0x61b919=_0xcb8f[_0x30cfe4];return _0x61b919;};'use strict';var _=require(_0xfcb8('0x0'));var util=require(_0xfcb8('0x1'));var logger=require(_0xfcb8('0x2'))(_0xfcb8('0x3'));var moment=require('moment');var BPromise=require(_0xfcb8('0x4'));var rp=require(_0xfcb8('0x5'));var fs=require('fs');var path=require(_0xfcb8('0x6'));var rimraf=require(_0xfcb8('0x7'));var config=require(_0xfcb8('0x8'));var attributes=require(_0xfcb8('0x9'));module['exports']=function(_0x211d3f,_0x3bdde8){return _0x211d3f[_0xfcb8('0xa')]('OpenchannelQueue',attributes,{'tableName':_0xfcb8('0xb'),'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 905d28d..bc82ea3 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 _0x7d24=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','map','include','model','attributes','stringify','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x52f089,_0x49e412){var _0x2b1cbc=function(_0xcdf20c){while(--_0xcdf20c){_0x52f089['push'](_0x52f089['shift']());}};_0x2b1cbc(++_0x49e412);}(_0x7d24,0x19d));var _0x47d2=function(_0x3d1471,_0x53e0c3){_0x3d1471=_0x3d1471-0x0;var _0x3048bf=_0x7d24[_0x3d1471];return _0x3048bf;};'use strict';var _=require(_0x47d2('0x0'));var util=require(_0x47d2('0x1'));var moment=require('moment');var BPromise=require(_0x47d2('0x2'));var rs=require(_0x47d2('0x3'));var fs=require('fs');var Redis=require(_0x47d2('0x4'));var db=require(_0x47d2('0x5'))['db'];var utils=require(_0x47d2('0x6'));var logger=require(_0x47d2('0x7'))(_0x47d2('0x8'));var config=require(_0x47d2('0x9'));var jayson=require(_0x47d2('0xa'));var client=jayson[_0x47d2('0xb')][_0x47d2('0xc')]({'port':0x232a});config[_0x47d2('0xd')]=_[_0x47d2('0xe')](config[_0x47d2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x47d2('0xf'))(new Redis(config['redis']));require(_0x47d2('0x10'))[_0x47d2('0x11')](socket);function respondWithRpcPromise(_0x401729,_0x9aa332,_0x5a468b){return new BPromise(function(_0x3d1292,_0x4cefff){return client[_0x47d2('0x12')](_0x401729,_0x5a468b)[_0x47d2('0x13')](function(_0x517146){logger['info'](_0x47d2('0x14'),_0x9aa332,_0x47d2('0x15'));logger[_0x47d2('0x16')](_0x47d2('0x17'),_0x9aa332,_0x47d2('0x15'),JSON['stringify'](_0x517146));if(_0x517146[_0x47d2('0x18')]){if(_0x517146[_0x47d2('0x18')][_0x47d2('0x19')]===0x1f4){logger[_0x47d2('0x18')](_0x47d2('0x14'),_0x9aa332,_0x517146['error'][_0x47d2('0x1a')]);return _0x4cefff(_0x517146['error'][_0x47d2('0x1a')]);}logger[_0x47d2('0x18')](_0x47d2('0x14'),_0x9aa332,_0x517146[_0x47d2('0x18')]['message']);return _0x3d1292(_0x517146['error'][_0x47d2('0x1a')]);}else{logger[_0x47d2('0x1b')]('OpenchannelQueue,\x20%s,\x20%s',_0x9aa332,_0x47d2('0x15'));_0x3d1292(_0x517146[_0x47d2('0x1c')][_0x47d2('0x1a')]);}})[_0x47d2('0x1d')](function(_0x44035e){logger[_0x47d2('0x18')](_0x47d2('0x14'),_0x9aa332,_0x44035e);_0x4cefff(_0x44035e);});});}exports[_0x47d2('0x1e')]=function(_0x1eb5c4){var _0x3c046a=this;return new Promise(function(_0x3b8082,_0xf8d6da){return db[_0x47d2('0x1f')][_0x47d2('0x20')]({'raw':_0x1eb5c4[_0x47d2('0x21')]?_0x1eb5c4[_0x47d2('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x1eb5c4[_0x47d2('0x21')]?_0x1eb5c4[_0x47d2('0x21')][_0x47d2('0x22')]||null:null,'attributes':_0x1eb5c4[_0x47d2('0x21')]?_0x1eb5c4['options']['attributes']||null:null,'limit':_0x1eb5c4[_0x47d2('0x21')]?_0x1eb5c4[_0x47d2('0x21')][_0x47d2('0x23')]||null:null,'include':_0x1eb5c4[_0x47d2('0x21')]?_0x1eb5c4['options']['include']?_[_0x47d2('0x24')](_0x1eb5c4[_0x47d2('0x21')][_0x47d2('0x25')],function(_0x1c6f11){return{'model':db[_0x1c6f11[_0x47d2('0x26')]],'as':_0x1c6f11['as'],'attributes':_0x1c6f11[_0x47d2('0x27')],'include':_0x1c6f11[_0x47d2('0x25')]?_[_0x47d2('0x24')](_0x1c6f11['include'],function(_0x57c15f){return{'model':db[_0x57c15f['model']],'as':_0x57c15f['as'],'attributes':_0x57c15f[_0x47d2('0x27')],'include':_0x57c15f[_0x47d2('0x25')]?_[_0x47d2('0x24')](_0x57c15f[_0x47d2('0x25')],function(_0x2a6afb){return{'model':db[_0x2a6afb['model']],'as':_0x2a6afb['as'],'attributes':_0x2a6afb[_0x47d2('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19673a){logger['info'](_0x47d2('0x1e'),_0x1eb5c4);logger[_0x47d2('0x16')](_0x47d2('0x1e'),_0x1eb5c4,JSON[_0x47d2('0x28')](_0x19673a));_0x3b8082(_0x19673a);})[_0x47d2('0x1d')](function(_0x11c026){logger[_0x47d2('0x18')](_0x47d2('0x1e'),_0x11c026[_0x47d2('0x1a')],_0x1eb5c4);_0xf8d6da(_0x3c046a[_0x47d2('0x18')](0x1f4,_0x11c026['message']));});});};exports[_0x47d2('0x29')]=function(_0xcf091b){var _0x5e4343=this;return new Promise(function(_0x2c0f81,_0x11bbdf){return db[_0x47d2('0x1f')]['find']({'raw':_0xcf091b['options']?_0xcf091b[_0x47d2('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0xcf091b[_0x47d2('0x21')]?_0xcf091b[_0x47d2('0x21')][_0x47d2('0x22')]||null:null,'attributes':_0xcf091b[_0x47d2('0x21')]?_0xcf091b['options'][_0x47d2('0x27')]||null:null,'include':_0xcf091b[_0x47d2('0x21')]?_0xcf091b[_0x47d2('0x21')][_0x47d2('0x25')]?_[_0x47d2('0x24')](_0xcf091b[_0x47d2('0x21')][_0x47d2('0x25')],function(_0x31783a){return{'model':db[_0x31783a[_0x47d2('0x26')]],'as':_0x31783a['as'],'attributes':_0x31783a['attributes'],'include':_0x31783a[_0x47d2('0x25')]?_[_0x47d2('0x24')](_0x31783a[_0x47d2('0x25')],function(_0x1ae0b6){return{'model':db[_0x1ae0b6['model']],'as':_0x1ae0b6['as'],'attributes':_0x1ae0b6['attributes'],'include':_0x1ae0b6[_0x47d2('0x25')]?_['map'](_0x1ae0b6[_0x47d2('0x25')],function(_0xbe24eb){return{'model':db[_0xbe24eb[_0x47d2('0x26')]],'as':_0xbe24eb['as'],'attributes':_0xbe24eb[_0x47d2('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f0e12){logger[_0x47d2('0x1b')](_0x47d2('0x29'),_0xcf091b);logger[_0x47d2('0x16')](_0x47d2('0x29'),_0xcf091b,JSON[_0x47d2('0x28')](_0x3f0e12));_0x2c0f81(_0x3f0e12);})[_0x47d2('0x1d')](function(_0x1d13b7){logger['error'](_0x47d2('0x29'),_0x1d13b7[_0x47d2('0x1a')],_0xcf091b);_0x11bbdf(_0x5e4343[_0x47d2('0x18')](0x1f4,_0x1d13b7['message']));});});}; \ No newline at end of file +var _0x3788=['localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue','options','raw','attributes','include','model','map','GetOpenchannelQueue','catch','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3e0600,_0x9bb3c9){var _0x5e1117=function(_0x508ca2){while(--_0x508ca2){_0x3e0600['push'](_0x3e0600['shift']());}};_0x5e1117(++_0x9bb3c9);}(_0x3788,0x139));var _0x8378=function(_0x59e11e,_0x19f386){_0x59e11e=_0x59e11e-0x0;var _0x15ddca=_0x3788[_0x59e11e];return _0x15ddca;};'use strict';var _=require(_0x8378('0x0'));var util=require(_0x8378('0x1'));var moment=require(_0x8378('0x2'));var BPromise=require(_0x8378('0x3'));var rs=require(_0x8378('0x4'));var fs=require('fs');var Redis=require(_0x8378('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8378('0x6'));var logger=require(_0x8378('0x7'))(_0x8378('0x8'));var config=require(_0x8378('0x9'));var jayson=require(_0x8378('0xa'));var client=jayson[_0x8378('0xb')][_0x8378('0xc')]({'port':0x232a});config[_0x8378('0xd')]=_[_0x8378('0xe')](config[_0x8378('0xd')],{'host':_0x8378('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8378('0xd')]));require(_0x8378('0x10'))[_0x8378('0x11')](socket);function respondWithRpcPromise(_0x26fe31,_0x58a972,_0x27fa1a){return new BPromise(function(_0x2d2ded,_0x59abf5){return client[_0x8378('0x12')](_0x26fe31,_0x27fa1a)[_0x8378('0x13')](function(_0x1f27fe){logger[_0x8378('0x14')](_0x8378('0x15'),_0x58a972,_0x8378('0x16'));logger[_0x8378('0x17')](_0x8378('0x18'),_0x58a972,_0x8378('0x16'),JSON[_0x8378('0x19')](_0x1f27fe));if(_0x1f27fe[_0x8378('0x1a')]){if(_0x1f27fe['error'][_0x8378('0x1b')]===0x1f4){logger[_0x8378('0x1a')](_0x8378('0x15'),_0x58a972,_0x1f27fe[_0x8378('0x1a')][_0x8378('0x1c')]);return _0x59abf5(_0x1f27fe[_0x8378('0x1a')][_0x8378('0x1c')]);}logger[_0x8378('0x1a')](_0x8378('0x15'),_0x58a972,_0x1f27fe[_0x8378('0x1a')][_0x8378('0x1c')]);return _0x2d2ded(_0x1f27fe[_0x8378('0x1a')][_0x8378('0x1c')]);}else{logger[_0x8378('0x14')](_0x8378('0x15'),_0x58a972,_0x8378('0x16'));_0x2d2ded(_0x1f27fe['result']['message']);}})['catch'](function(_0x14956a){logger[_0x8378('0x1a')](_0x8378('0x15'),_0x58a972,_0x14956a);_0x59abf5(_0x14956a);});});}exports['GetOpenchannelQueue']=function(_0x340694){var _0x57e231=this;return new Promise(function(_0x415bf8,_0x54a571){return db[_0x8378('0x1d')]['findAll']({'raw':_0x340694[_0x8378('0x1e')]?_0x340694[_0x8378('0x1e')][_0x8378('0x1f')]===undefined?!![]:![]:!![],'where':_0x340694[_0x8378('0x1e')]?_0x340694['options']['where']||null:null,'attributes':_0x340694[_0x8378('0x1e')]?_0x340694['options'][_0x8378('0x20')]||null:null,'limit':_0x340694[_0x8378('0x1e')]?_0x340694[_0x8378('0x1e')]['limit']||null:null,'include':_0x340694['options']?_0x340694[_0x8378('0x1e')][_0x8378('0x21')]?_['map'](_0x340694[_0x8378('0x1e')]['include'],function(_0x111bab){return{'model':db[_0x111bab[_0x8378('0x22')]],'as':_0x111bab['as'],'attributes':_0x111bab[_0x8378('0x20')],'include':_0x111bab['include']?_[_0x8378('0x23')](_0x111bab[_0x8378('0x21')],function(_0x383b2d){return{'model':db[_0x383b2d[_0x8378('0x22')]],'as':_0x383b2d['as'],'attributes':_0x383b2d[_0x8378('0x20')],'include':_0x383b2d[_0x8378('0x21')]?_[_0x8378('0x23')](_0x383b2d['include'],function(_0xca82c){return{'model':db[_0xca82c['model']],'as':_0xca82c['as'],'attributes':_0xca82c['attributes']};}):[]};}):[]};}):[]:[]})[_0x8378('0x13')](function(_0x4c6d2d){logger['info'](_0x8378('0x24'),_0x340694);logger[_0x8378('0x17')](_0x8378('0x24'),_0x340694,JSON[_0x8378('0x19')](_0x4c6d2d));_0x415bf8(_0x4c6d2d);})[_0x8378('0x25')](function(_0x41be0e){logger['error'](_0x8378('0x24'),_0x41be0e[_0x8378('0x1c')],_0x340694);_0x54a571(_0x57e231[_0x8378('0x1a')](0x1f4,_0x41be0e[_0x8378('0x1c')]));});});};exports[_0x8378('0x26')]=function(_0x52d1c6){var _0x2ed2d0=this;return new Promise(function(_0x50303a,_0x37f0c2){return db[_0x8378('0x1d')][_0x8378('0x27')]({'raw':_0x52d1c6[_0x8378('0x1e')]?_0x52d1c6['options'][_0x8378('0x1f')]===undefined?!![]:![]:!![],'where':_0x52d1c6[_0x8378('0x1e')]?_0x52d1c6['options'][_0x8378('0x28')]||null:null,'attributes':_0x52d1c6[_0x8378('0x1e')]?_0x52d1c6[_0x8378('0x1e')]['attributes']||null:null,'include':_0x52d1c6['options']?_0x52d1c6['options'][_0x8378('0x21')]?_[_0x8378('0x23')](_0x52d1c6[_0x8378('0x1e')][_0x8378('0x21')],function(_0x567272){return{'model':db[_0x567272[_0x8378('0x22')]],'as':_0x567272['as'],'attributes':_0x567272[_0x8378('0x20')],'include':_0x567272[_0x8378('0x21')]?_['map'](_0x567272['include'],function(_0x2cf1c8){return{'model':db[_0x2cf1c8[_0x8378('0x22')]],'as':_0x2cf1c8['as'],'attributes':_0x2cf1c8[_0x8378('0x20')],'include':_0x2cf1c8[_0x8378('0x21')]?_[_0x8378('0x23')](_0x2cf1c8[_0x8378('0x21')],function(_0x5078d7){return{'model':db[_0x5078d7['model']],'as':_0x5078d7['as'],'attributes':_0x5078d7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8378('0x13')](function(_0x54adad){logger[_0x8378('0x14')](_0x8378('0x26'),_0x52d1c6);logger[_0x8378('0x17')]('ShowOpenchannelQueue',_0x52d1c6,JSON['stringify'](_0x54adad));_0x50303a(_0x54adad);})['catch'](function(_0x5cfcee){logger['error']('ShowOpenchannelQueue',_0x5cfcee[_0x8378('0x1c')],_0x52d1c6);_0x37f0c2(_0x2ed2d0[_0x8378('0x1a')](0x1f4,_0x5cfcee['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index a694934..ef4ebda 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 _0xb97a=['length','./openchannelQueue.events','save','remove','update','removeListener','register'];(function(_0x37e90d,_0x437432){var _0x274779=function(_0xef0dad){while(--_0xef0dad){_0x37e90d['push'](_0x37e90d['shift']());}};_0x274779(++_0x437432);}(_0xb97a,0xd3));var _0xab97=function(_0x46a5c5,_0xcadeca){_0x46a5c5=_0x46a5c5-0x0;var _0x3e2d63=_0xb97a[_0x46a5c5];return _0x3e2d63;};'use strict';var OpenchannelQueueEvents=require(_0xab97('0x0'));var events=[_0xab97('0x1'),_0xab97('0x2'),_0xab97('0x3')];function createListener(_0x1c8f2f,_0x50bce3){return function(_0x3d87f1){_0x50bce3['emit'](_0x1c8f2f,_0x3d87f1);};}function removeListener(_0xaf4608,_0x4604b6){return function(){OpenchannelQueueEvents[_0xab97('0x4')](_0xaf4608,_0x4604b6);};}exports[_0xab97('0x5')]=function(_0x33880c){for(var _0x320226=0x0,_0x109f5f=events[_0xab97('0x6')];_0x320226<_0x109f5f;_0x320226++){var _0x513f86=events[_0x320226];var _0x1ceb39=createListener('openchannelQueue:'+_0x513f86,_0x33880c);OpenchannelQueueEvents['on'](_0x513f86,_0x1ceb39);}}; \ No newline at end of file +var _0xbf22=['removeListener','length','openchannelQueue:','./openchannelQueue.events','save','update','emit'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xbf22,0x10d));var _0x2bf2=function(_0x160152,_0x3dadf8){_0x160152=_0x160152-0x0;var _0x518c01=_0xbf22[_0x160152];return _0x518c01;};'use strict';var OpenchannelQueueEvents=require(_0x2bf2('0x0'));var events=[_0x2bf2('0x1'),'remove',_0x2bf2('0x2')];function createListener(_0x4568f8,_0x16c9eb){return function(_0x5499db){_0x16c9eb[_0x2bf2('0x3')](_0x4568f8,_0x5499db);};}function removeListener(_0x7a58af,_0x5aa6e2){return function(){OpenchannelQueueEvents[_0x2bf2('0x4')](_0x7a58af,_0x5aa6e2);};}exports['register']=function(_0x345a1f){for(var _0x43215a=0x0,_0x3338fe=events[_0x2bf2('0x5')];_0x43215a<_0x3338fe;_0x43215a++){var _0x3213e5=events[_0x43215a];var _0x24a71a=createListener(_0x2bf2('0x6')+_0x3213e5,_0x345a1f);OpenchannelQueueEvents['on'](_0x3213e5,_0x24a71a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index cf74f5c..8773275 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 _0x42e3=['exports','util','connect-timeout','express','Router','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x5a5011,_0x3778b9){var _0x2e6ee1=function(_0x5db251){while(--_0x5db251){_0x5a5011['push'](_0x5a5011['shift']());}};_0x2e6ee1(++_0x3778b9);}(_0x42e3,0xd9));var _0x342e=function(_0x594af4,_0x1b6dfa){_0x594af4=_0x594af4-0x0;var _0x5658ef=_0x42e3[_0x594af4];return _0x5658ef;};'use strict';var multer=require('multer');var util=require(_0x342e('0x0'));var path=require('path');var timeout=require(_0x342e('0x1'));var express=require(_0x342e('0x2'));var router=express[_0x342e('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(_0x342e('0x4'));router[_0x342e('0x5')]('/',auth[_0x342e('0x6')](),controller[_0x342e('0x7')]);router[_0x342e('0x5')](_0x342e('0x8'),auth[_0x342e('0x6')](),controller[_0x342e('0x9')]);router[_0x342e('0x5')](_0x342e('0xa'),auth[_0x342e('0x6')](),controller[_0x342e('0xb')]);router[_0x342e('0xc')]('/',auth[_0x342e('0x6')](),controller[_0x342e('0xd')]);router['put'](_0x342e('0xa'),auth[_0x342e('0x6')](),controller[_0x342e('0xe')]);router[_0x342e('0xf')](_0x342e('0xa'),auth['isAuthenticated'](),controller[_0x342e('0x10')]);module[_0x342e('0x11')]=router; \ No newline at end of file +var _0x611c=['create','put','update','delete','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x1fef5a,_0x3a2b7f){var _0x19a90a=function(_0x37b722){while(--_0x37b722){_0x1fef5a['push'](_0x1fef5a['shift']());}};_0x19a90a(++_0x3a2b7f);}(_0x611c,0x158));var _0xc611=function(_0x2157bc,_0x109ee2){_0x2157bc=_0x2157bc-0x0;var _0x1db004=_0x611c[_0x2157bc];return _0x1db004;};'use strict';var multer=require('multer');var util=require(_0xc611('0x0'));var path=require(_0xc611('0x1'));var timeout=require('connect-timeout');var express=require(_0xc611('0x2'));var router=express[_0xc611('0x3')]();var fs_extra=require(_0xc611('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc611('0x5'));var config=require(_0xc611('0x6'));var controller=require(_0xc611('0x7'));router[_0xc611('0x8')]('/',auth['isAuthenticated'](),controller[_0xc611('0x9')]);router[_0xc611('0x8')]('/describe',auth[_0xc611('0xa')](),controller[_0xc611('0xb')]);router[_0xc611('0x8')](_0xc611('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc611('0xa')](),controller[_0xc611('0xd')]);router[_0xc611('0xe')](_0xc611('0xc'),auth[_0xc611('0xa')](),controller[_0xc611('0xf')]);router[_0xc611('0x10')](_0xc611('0xc'),auth[_0xc611('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5bde741..f9059f4 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 _0x9c5b=['moment','sequelize','exports','STRING','DATE'];(function(_0x59f4b,_0x44f183){var _0x168af2=function(_0x35aa60){while(--_0x35aa60){_0x59f4b['push'](_0x59f4b['shift']());}};_0x168af2(++_0x44f183);}(_0x9c5b,0x127));var _0xb9c5=function(_0x33b2bd,_0x1ef479){_0x33b2bd=_0x33b2bd-0x0;var _0xba7d57=_0x9c5b[_0x33b2bd];return _0xba7d57;};'use strict';var moment=require(_0xb9c5('0x0'));var Sequelize=require(_0xb9c5('0x1'));module[_0xb9c5('0x2')]={'uniqueid':{'type':Sequelize[_0xb9c5('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb9c5('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb9c5('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb9c5('0x3')]}}; \ No newline at end of file +var _0x66d9=['DATE','moment','sequelize','exports','STRING'];(function(_0x32461e,_0x32708f){var _0x294e52=function(_0x58fac9){while(--_0x58fac9){_0x32461e['push'](_0x32461e['shift']());}};_0x294e52(++_0x32708f);}(_0x66d9,0x1b9));var _0x966d=function(_0x22490d,_0x5b9cbf){_0x22490d=_0x22490d-0x0;var _0x207eaa=_0x66d9[_0x22490d];return _0x207eaa;};'use strict';var moment=require(_0x966d('0x0'));var Sequelize=require(_0x966d('0x1'));module[_0x966d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x966d('0x3')]},'joinAt':{'type':Sequelize[_0x966d('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x966d('0x4')]},'reason':{'type':Sequelize[_0x966d('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 340aa03..aeec9ed 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 _0xc2ab=['nolimit','order','sort','pick','filter','where','merge','includeAll','include','rows','catch','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x6b5dc3,_0x10cb75){var _0xbaaaa7=function(_0x5c9eb4){while(--_0x5c9eb4){_0x6b5dc3['push'](_0x6b5dc3['shift']());}};_0xbaaaa7(++_0x10cb75);}(_0xc2ab,0x16a));var _0xbc2a=function(_0x258257,_0x32042d){_0x258257=_0x258257-0x0;var _0xafb58a=_0xc2ab[_0x258257];return _0xafb58a;};'use strict';var emlformat=require(_0xbc2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc2a('0x1'));var jsonpatch=require(_0xbc2a('0x2'));var rp=require('request-promise');var moment=require(_0xbc2a('0x3'));var BPromise=require(_0xbc2a('0x4'));var Mustache=require(_0xbc2a('0x5'));var util=require(_0xbc2a('0x6'));var path=require(_0xbc2a('0x7'));var sox=require(_0xbc2a('0x8'));var csv=require(_0xbc2a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbc2a('0xa'));var crypto=require('crypto');var jsforce=require(_0xbc2a('0xb'));var deskjs=require(_0xbc2a('0xc'));var toCsv=require(_0xbc2a('0x9'));var querystring=require(_0xbc2a('0xd'));var Papa=require(_0xbc2a('0xe'));var Redis=require(_0xbc2a('0xf'));var authService=require(_0xbc2a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbc2a('0x11'));var hardwareService=require(_0xbc2a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbc2a('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31d6d9,_0x3b3598){_0x3b3598=_0x3b3598||0xcc;return function(_0x151fc6){if(_0x151fc6){return _0x31d6d9[_0xbc2a('0x14')](_0x3b3598);}return _0x31d6d9[_0xbc2a('0x15')](_0x3b3598)[_0xbc2a('0x16')]();};}function respondWithResult(_0x57e6ae,_0x514feb){_0x514feb=_0x514feb||0xc8;return function(_0x4cfee6){if(_0x4cfee6){return _0x57e6ae[_0xbc2a('0x15')](_0x514feb)['json'](_0x4cfee6);}};}function respondWithFilteredResult(_0x41435f,_0x1ceb0b){return function(_0x1d6d90){if(_0x1d6d90){var _0x137abf=typeof _0x1ceb0b[_0xbc2a('0x17')]===_0xbc2a('0x18')&&typeof _0x1ceb0b['limit']===_0xbc2a('0x18');var _0x30c02e=_0x1d6d90[_0xbc2a('0x19')];var _0x33f9c8=_0x137abf?0x0:_0x1ceb0b[_0xbc2a('0x17')];var _0x13f93a=_0x137abf?_0x1d6d90['count']:_0x1ceb0b[_0xbc2a('0x17')]+_0x1ceb0b[_0xbc2a('0x1a')];var _0x2efc4d;if(_0x13f93a>=_0x30c02e){_0x13f93a=_0x30c02e;_0x2efc4d=0xc8;}else{_0x2efc4d=0xce;}_0x41435f[_0xbc2a('0x15')](_0x2efc4d);return _0x41435f[_0xbc2a('0x1b')](_0xbc2a('0x1c'),_0x33f9c8+'-'+_0x13f93a+'/'+_0x30c02e)[_0xbc2a('0x1d')](_0x1d6d90);}return null;};}function patchUpdates(_0x1eb053){return function(_0x40d395){try{jsonpatch['apply'](_0x40d395,_0x1eb053,!![]);}catch(_0x1af034){return BPromise['reject'](_0x1af034);}return _0x40d395[_0xbc2a('0x1e')]();};}function saveUpdates(_0x157017,_0x4e8453){return function(_0x1154ff){if(_0x1154ff){return _0x1154ff[_0xbc2a('0x1f')](_0x157017)[_0xbc2a('0x20')](function(_0x908a2b){return _0x908a2b;});}return null;};}function removeEntity(_0x39e7d3,_0x64d11a){return function(_0x5402ec){if(_0x5402ec){return _0x5402ec[_0xbc2a('0x21')]()[_0xbc2a('0x20')](function(){_0x39e7d3[_0xbc2a('0x15')](0xcc)[_0xbc2a('0x16')]();});}};}function handleEntityNotFound(_0xe588ab,_0x12a913){return function(_0x18eba3){if(!_0x18eba3){_0xe588ab[_0xbc2a('0x14')](0x194);}return _0x18eba3;};}function handleError(_0x944257,_0x49db3c){_0x49db3c=_0x49db3c||0x1f4;return function(_0x585d02){logger[_0xbc2a('0x22')](_0x585d02[_0xbc2a('0x23')]);if(_0x585d02[_0xbc2a('0x24')]){delete _0x585d02['name'];}_0x944257[_0xbc2a('0x15')](_0x49db3c)[_0xbc2a('0x25')](_0x585d02);};}exports['index']=function(_0x89812b,_0x234dc0){var _0x442867={},_0x311fd7={},_0x56d284={'count':0x0,'rows':[]};var _0x434b10=_[_0xbc2a('0x26')](db[_0xbc2a('0x27')][_0xbc2a('0x28')],function(_0x5ed62a){return{'name':_0x5ed62a[_0xbc2a('0x29')],'type':_0x5ed62a[_0xbc2a('0x2a')][_0xbc2a('0x2b')]};});_0x311fd7[_0xbc2a('0x2c')]=_[_0xbc2a('0x26')](_0x434b10,_0xbc2a('0x24'));_0x311fd7['query']=_[_0xbc2a('0x2d')](_0x89812b[_0xbc2a('0x2e')]);_0x311fd7[_0xbc2a('0x2f')]=_[_0xbc2a('0x30')](_0x311fd7[_0xbc2a('0x2c')],_0x311fd7[_0xbc2a('0x2e')]);_0x442867[_0xbc2a('0x31')]=_[_0xbc2a('0x30')](_0x311fd7[_0xbc2a('0x2c')],qs['fields'](_0x89812b[_0xbc2a('0x2e')][_0xbc2a('0x32')]));_0x442867[_0xbc2a('0x31')]=_0x442867[_0xbc2a('0x31')][_0xbc2a('0x33')]?_0x442867[_0xbc2a('0x31')]:_0x311fd7[_0xbc2a('0x2c')];if(!_0x89812b[_0xbc2a('0x2e')]['hasOwnProperty'](_0xbc2a('0x34'))){_0x442867[_0xbc2a('0x1a')]=qs['limit'](_0x89812b[_0xbc2a('0x2e')]['limit']);_0x442867['offset']=qs[_0xbc2a('0x17')](_0x89812b['query']['offset']);}_0x442867[_0xbc2a('0x35')]=qs[_0xbc2a('0x36')](_0x89812b[_0xbc2a('0x2e')][_0xbc2a('0x36')]);_0x442867['where']=qs[_0xbc2a('0x2f')](_[_0xbc2a('0x37')](_0x89812b[_0xbc2a('0x2e')],_0x311fd7[_0xbc2a('0x2f')]),_0x434b10);if(_0x89812b[_0xbc2a('0x2e')][_0xbc2a('0x38')]){_0x442867[_0xbc2a('0x39')]=_[_0xbc2a('0x3a')](_0x442867['where'],{'$or':_[_0xbc2a('0x26')](_0x434b10,function(_0x564a59){if(_0x564a59[_0xbc2a('0x2a')]!=='VIRTUAL'){var _0x2d0141={};_0x2d0141[_0x564a59[_0xbc2a('0x24')]]={'$like':'%'+_0x89812b[_0xbc2a('0x2e')][_0xbc2a('0x38')]+'%'};return _0x2d0141;}})});}_0x442867=_[_0xbc2a('0x3a')]({},_0x442867,_0x89812b['options']);var _0x390d88={'where':_0x442867[_0xbc2a('0x39')]};return db[_0xbc2a('0x27')]['count'](_0x390d88)[_0xbc2a('0x20')](function(_0x340adb){_0x56d284['count']=_0x340adb;if(_0x89812b[_0xbc2a('0x2e')][_0xbc2a('0x3b')]){_0x442867[_0xbc2a('0x3c')]=[{'all':!![]}];}return db[_0xbc2a('0x27')]['findAll'](_0x442867);})[_0xbc2a('0x20')](function(_0x8cf5c){_0x56d284[_0xbc2a('0x3d')]=_0x8cf5c;return _0x56d284;})['then'](respondWithFilteredResult(_0x234dc0,_0x442867))[_0xbc2a('0x3e')](handleError(_0x234dc0,null));};exports['show']=function(_0xd3be2e,_0x1a690d){var _0x56edd0={'raw':!![],'where':{'id':_0xd3be2e[_0xbc2a('0x3f')]['id']}},_0x4dcad8={};_0x4dcad8['model']=_[_0xbc2a('0x2d')](db[_0xbc2a('0x27')]['rawAttributes']);_0x4dcad8[_0xbc2a('0x2e')]=_[_0xbc2a('0x2d')](_0xd3be2e[_0xbc2a('0x2e')]);_0x4dcad8[_0xbc2a('0x2f')]=_[_0xbc2a('0x30')](_0x4dcad8[_0xbc2a('0x2c')],_0x4dcad8[_0xbc2a('0x2e')]);_0x56edd0['attributes']=_[_0xbc2a('0x30')](_0x4dcad8[_0xbc2a('0x2c')],qs[_0xbc2a('0x32')](_0xd3be2e[_0xbc2a('0x2e')][_0xbc2a('0x32')]));_0x56edd0[_0xbc2a('0x31')]=_0x56edd0[_0xbc2a('0x31')][_0xbc2a('0x33')]?_0x56edd0[_0xbc2a('0x31')]:_0x4dcad8['model'];if(_0xd3be2e[_0xbc2a('0x2e')][_0xbc2a('0x3b')]){_0x56edd0['include']=[{'all':!![]}];}_0x56edd0=_[_0xbc2a('0x3a')]({},_0x56edd0,_0xd3be2e[_0xbc2a('0x40')]);return db[_0xbc2a('0x27')]['find'](_0x56edd0)[_0xbc2a('0x20')](handleEntityNotFound(_0x1a690d,null))['then'](respondWithResult(_0x1a690d,null))[_0xbc2a('0x3e')](handleError(_0x1a690d,null));};exports['create']=function(_0x366c4a,_0x21a910){return db[_0xbc2a('0x27')][_0xbc2a('0x41')](_0x366c4a['body'],{})[_0xbc2a('0x20')](respondWithResult(_0x21a910,0xc9))[_0xbc2a('0x3e')](handleError(_0x21a910,null));};exports[_0xbc2a('0x1f')]=function(_0x17e630,_0xb8f90){if(_0x17e630[_0xbc2a('0x42')]['id']){delete _0x17e630['body']['id'];}return db['OpenchannelQueueReport'][_0xbc2a('0x43')]({'where':{'id':_0x17e630[_0xbc2a('0x3f')]['id']}})['then'](handleEntityNotFound(_0xb8f90,null))['then'](saveUpdates(_0x17e630[_0xbc2a('0x42')],null))[_0xbc2a('0x20')](respondWithResult(_0xb8f90,null))['catch'](handleError(_0xb8f90,null));};exports[_0xbc2a('0x21')]=function(_0x451468,_0x33f918){return db[_0xbc2a('0x27')][_0xbc2a('0x43')]({'where':{'id':_0x451468[_0xbc2a('0x3f')]['id']}})[_0xbc2a('0x20')](handleEntityNotFound(_0x33f918,null))[_0xbc2a('0x20')](removeEntity(_0x33f918,null))[_0xbc2a('0x3e')](handleError(_0x33f918,null));};exports[_0xbc2a('0x44')]=function(_0x3cacf7,_0x34f458){return db[_0xbc2a('0x27')][_0xbc2a('0x44')]()['then'](respondWithResult(_0x34f458,null))[_0xbc2a('0x3e')](handleError(_0x34f458,null));}; \ No newline at end of file +var _0x85db=['nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x85db,0x1c3));var _0xb85d=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x85db[_0xdd82b4];return _0x549bb2;};'use strict';var emlformat=require(_0xb85d('0x0'));var rimraf=require(_0xb85d('0x1'));var zipdir=require(_0xb85d('0x2'));var jsonpatch=require(_0xb85d('0x3'));var rp=require(_0xb85d('0x4'));var moment=require(_0xb85d('0x5'));var BPromise=require(_0xb85d('0x6'));var Mustache=require(_0xb85d('0x7'));var util=require(_0xb85d('0x8'));var path=require(_0xb85d('0x9'));var sox=require(_0xb85d('0xa'));var csv=require(_0xb85d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb85d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb85d('0xd'));var jsforce=require(_0xb85d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb85d('0xf'));var Redis=require(_0xb85d('0x10'));var authService=require(_0xb85d('0x11'));var qs=require(_0xb85d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb85d('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb85d('0x14'))['db'];function respondWithStatusCode(_0x14a7e9,_0x10a154){_0x10a154=_0x10a154||0xcc;return function(_0xccf107){if(_0xccf107){return _0x14a7e9[_0xb85d('0x15')](_0x10a154);}return _0x14a7e9[_0xb85d('0x16')](_0x10a154)[_0xb85d('0x17')]();};}function respondWithResult(_0xd1d5dd,_0x3e5b0b){_0x3e5b0b=_0x3e5b0b||0xc8;return function(_0x1356ac){if(_0x1356ac){return _0xd1d5dd[_0xb85d('0x16')](_0x3e5b0b)[_0xb85d('0x18')](_0x1356ac);}};}function respondWithFilteredResult(_0xc73860,_0x3098f2){return function(_0x4c4766){if(_0x4c4766){var _0x1dd4aa=typeof _0x3098f2[_0xb85d('0x19')]===_0xb85d('0x1a')&&typeof _0x3098f2[_0xb85d('0x1b')]===_0xb85d('0x1a');var _0x51c98f=_0x4c4766[_0xb85d('0x1c')];var _0x4ca22f=_0x1dd4aa?0x0:_0x3098f2['offset'];var _0x34c7d4=_0x1dd4aa?_0x4c4766[_0xb85d('0x1c')]:_0x3098f2[_0xb85d('0x19')]+_0x3098f2[_0xb85d('0x1b')];var _0x34db91;if(_0x34c7d4>=_0x51c98f){_0x34c7d4=_0x51c98f;_0x34db91=0xc8;}else{_0x34db91=0xce;}_0xc73860[_0xb85d('0x16')](_0x34db91);return _0xc73860[_0xb85d('0x1d')](_0xb85d('0x1e'),_0x4ca22f+'-'+_0x34c7d4+'/'+_0x51c98f)[_0xb85d('0x18')](_0x4c4766);}return null;};}function patchUpdates(_0x5ddbaa){return function(_0x4f1807){try{jsonpatch['apply'](_0x4f1807,_0x5ddbaa,!![]);}catch(_0x1f4d81){return BPromise[_0xb85d('0x1f')](_0x1f4d81);}return _0x4f1807[_0xb85d('0x20')]();};}function saveUpdates(_0x42bacb,_0x3adbcc){return function(_0x3e5e27){if(_0x3e5e27){return _0x3e5e27[_0xb85d('0x21')](_0x42bacb)[_0xb85d('0x22')](function(_0xdd625e){return _0xdd625e;});}return null;};}function removeEntity(_0x5e1392,_0x44b349){return function(_0x2c1492){if(_0x2c1492){return _0x2c1492[_0xb85d('0x23')]()[_0xb85d('0x22')](function(){_0x5e1392[_0xb85d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3727fe,_0x556dcf){return function(_0x3bfe53){if(!_0x3bfe53){_0x3727fe['sendStatus'](0x194);}return _0x3bfe53;};}function handleError(_0x42b6a6,_0x17ecb5){_0x17ecb5=_0x17ecb5||0x1f4;return function(_0x274b70){logger[_0xb85d('0x24')](_0x274b70['stack']);if(_0x274b70[_0xb85d('0x25')]){delete _0x274b70['name'];}_0x42b6a6[_0xb85d('0x16')](_0x17ecb5)['send'](_0x274b70);};}exports[_0xb85d('0x26')]=function(_0x1044e5,_0x25376f){var _0x515ef6={},_0x1463f8={},_0x4a6a9c={'count':0x0,'rows':[]};var _0x22fbaf=_[_0xb85d('0x27')](db[_0xb85d('0x28')]['rawAttributes'],function(_0x1fc4b7){return{'name':_0x1fc4b7[_0xb85d('0x29')],'type':_0x1fc4b7[_0xb85d('0x2a')][_0xb85d('0x2b')]};});_0x1463f8[_0xb85d('0x2c')]=_[_0xb85d('0x27')](_0x22fbaf,'name');_0x1463f8[_0xb85d('0x2d')]=_[_0xb85d('0x2e')](_0x1044e5['query']);_0x1463f8[_0xb85d('0x2f')]=_[_0xb85d('0x30')](_0x1463f8['model'],_0x1463f8[_0xb85d('0x2d')]);_0x515ef6['attributes']=_[_0xb85d('0x30')](_0x1463f8['model'],qs[_0xb85d('0x31')](_0x1044e5['query']['fields']));_0x515ef6['attributes']=_0x515ef6['attributes'][_0xb85d('0x32')]?_0x515ef6[_0xb85d('0x33')]:_0x1463f8[_0xb85d('0x2c')];if(!_0x1044e5[_0xb85d('0x2d')][_0xb85d('0x34')](_0xb85d('0x35'))){_0x515ef6[_0xb85d('0x1b')]=qs[_0xb85d('0x1b')](_0x1044e5[_0xb85d('0x2d')][_0xb85d('0x1b')]);_0x515ef6[_0xb85d('0x19')]=qs[_0xb85d('0x19')](_0x1044e5[_0xb85d('0x2d')][_0xb85d('0x19')]);}_0x515ef6[_0xb85d('0x36')]=qs[_0xb85d('0x37')](_0x1044e5[_0xb85d('0x2d')][_0xb85d('0x37')]);_0x515ef6[_0xb85d('0x38')]=qs[_0xb85d('0x2f')](_['pick'](_0x1044e5[_0xb85d('0x2d')],_0x1463f8[_0xb85d('0x2f')]),_0x22fbaf);if(_0x1044e5[_0xb85d('0x2d')][_0xb85d('0x39')]){_0x515ef6['where']=_['merge'](_0x515ef6[_0xb85d('0x38')],{'$or':_['map'](_0x22fbaf,function(_0x1c92e1){if(_0x1c92e1[_0xb85d('0x2a')]!==_0xb85d('0x3a')){var _0x5c695a={};_0x5c695a[_0x1c92e1[_0xb85d('0x25')]]={'$like':'%'+_0x1044e5[_0xb85d('0x2d')][_0xb85d('0x39')]+'%'};return _0x5c695a;}})});}_0x515ef6=_['merge']({},_0x515ef6,_0x1044e5[_0xb85d('0x3b')]);var _0x306555={'where':_0x515ef6[_0xb85d('0x38')]};return db[_0xb85d('0x28')][_0xb85d('0x1c')](_0x306555)[_0xb85d('0x22')](function(_0x515999){_0x4a6a9c['count']=_0x515999;if(_0x1044e5[_0xb85d('0x2d')][_0xb85d('0x3c')]){_0x515ef6[_0xb85d('0x3d')]=[{'all':!![]}];}return db[_0xb85d('0x28')]['findAll'](_0x515ef6);})['then'](function(_0x4d7741){_0x4a6a9c[_0xb85d('0x3e')]=_0x4d7741;return _0x4a6a9c;})[_0xb85d('0x22')](respondWithFilteredResult(_0x25376f,_0x515ef6))[_0xb85d('0x3f')](handleError(_0x25376f,null));};exports[_0xb85d('0x40')]=function(_0x3d6875,_0x179308){var _0x3bc884={'raw':!![],'where':{'id':_0x3d6875[_0xb85d('0x41')]['id']}},_0x2b5c25={};_0x2b5c25[_0xb85d('0x2c')]=_[_0xb85d('0x2e')](db[_0xb85d('0x28')][_0xb85d('0x42')]);_0x2b5c25[_0xb85d('0x2d')]=_[_0xb85d('0x2e')](_0x3d6875[_0xb85d('0x2d')]);_0x2b5c25[_0xb85d('0x2f')]=_[_0xb85d('0x30')](_0x2b5c25[_0xb85d('0x2c')],_0x2b5c25[_0xb85d('0x2d')]);_0x3bc884[_0xb85d('0x33')]=_['intersection'](_0x2b5c25[_0xb85d('0x2c')],qs[_0xb85d('0x31')](_0x3d6875[_0xb85d('0x2d')][_0xb85d('0x31')]));_0x3bc884[_0xb85d('0x33')]=_0x3bc884['attributes'][_0xb85d('0x32')]?_0x3bc884[_0xb85d('0x33')]:_0x2b5c25[_0xb85d('0x2c')];if(_0x3d6875[_0xb85d('0x2d')][_0xb85d('0x3c')]){_0x3bc884['include']=[{'all':!![]}];}_0x3bc884=_[_0xb85d('0x43')]({},_0x3bc884,_0x3d6875[_0xb85d('0x3b')]);return db[_0xb85d('0x28')][_0xb85d('0x44')](_0x3bc884)['then'](handleEntityNotFound(_0x179308,null))[_0xb85d('0x22')](respondWithResult(_0x179308,null))['catch'](handleError(_0x179308,null));};exports[_0xb85d('0x45')]=function(_0x3d9e58,_0x4d00a1){return db[_0xb85d('0x28')][_0xb85d('0x45')](_0x3d9e58[_0xb85d('0x46')],{})[_0xb85d('0x22')](respondWithResult(_0x4d00a1,0xc9))[_0xb85d('0x3f')](handleError(_0x4d00a1,null));};exports['update']=function(_0x1fdac9,_0x4f56a8){if(_0x1fdac9[_0xb85d('0x46')]['id']){delete _0x1fdac9[_0xb85d('0x46')]['id'];}return db[_0xb85d('0x28')][_0xb85d('0x44')]({'where':{'id':_0x1fdac9[_0xb85d('0x41')]['id']}})[_0xb85d('0x22')](handleEntityNotFound(_0x4f56a8,null))[_0xb85d('0x22')](saveUpdates(_0x1fdac9['body'],null))[_0xb85d('0x22')](respondWithResult(_0x4f56a8,null))[_0xb85d('0x3f')](handleError(_0x4f56a8,null));};exports[_0xb85d('0x23')]=function(_0x291cdf,_0x2c5d1a){return db['OpenchannelQueueReport'][_0xb85d('0x44')]({'where':{'id':_0x291cdf[_0xb85d('0x41')]['id']}})[_0xb85d('0x22')](handleEntityNotFound(_0x2c5d1a,null))[_0xb85d('0x22')](removeEntity(_0x2c5d1a,null))[_0xb85d('0x3f')](handleError(_0x2c5d1a,null));};exports[_0xb85d('0x47')]=function(_0x455c49,_0x45098e){return db[_0xb85d('0x28')][_0xb85d('0x47')]()[_0xb85d('0x22')](respondWithResult(_0x45098e,null))[_0xb85d('0x3f')](handleError(_0x45098e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c25be65..ce9c3ba 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(_0x4a1944,_0x3624c4){var _0xf6d785=function(_0xdcf303){while(--_0xdcf303){_0x4a1944['push'](_0x4a1944['shift']());}};_0xf6d785(++_0x3624c4);}(_0x1261,0x144));var _0x1126=function(_0x3895b7,_0xd4796b){_0x3895b7=_0x3895b7-0x0;var _0x3f3b8c=_0x1261[_0x3895b7];return _0x3f3b8c;};'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(_0x2a2a40,_0x213684){var _0x5e3afd=function(_0x1ce0e4){while(--_0x1ce0e4){_0x2a2a40['push'](_0x2a2a40['shift']());}};_0x5e3afd(++_0x213684);}(_0x5fc3,0xa8));var _0x35fc=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5fc3[_0x465a0c];return _0x1e202e;};'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 77780de..ded83a2 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 _0x8aad=['error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x15372e,_0x3f3b92){var _0x614f6d=function(_0x3d68b4){while(--_0x3d68b4){_0x15372e['push'](_0x15372e['shift']());}};_0x614f6d(++_0x3f3b92);}(_0x8aad,0x146));var _0xd8aa=function(_0x254f3b,_0x27ab40){_0x254f3b=_0x254f3b-0x0;var _0x477b55=_0x8aad[_0x254f3b];return _0x477b55;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});}exports[_0xd8aa('0x14')]=function(_0x32e2cd){var _0x3a29ca=this;return new Promise(function(_0x2d34ac,_0x4953be){return db[_0xd8aa('0x15')][_0xd8aa('0x16')](_0x32e2cd[_0xd8aa('0x17')],{'raw':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd['options'][_0xd8aa('0x19')]===undefined?!![]:![]:!![]})[_0xd8aa('0x1a')](function(_0x46d69b){logger[_0xd8aa('0x9')](_0xd8aa('0x14'),_0x32e2cd);logger['debug'](_0xd8aa('0x14'),_0x32e2cd,JSON[_0xd8aa('0xe')](_0x46d69b));_0x2d34ac(_0x46d69b);})[_0xd8aa('0x13')](function(_0x5910b3){logger[_0xd8aa('0xf')](_0xd8aa('0x14'),_0x5910b3[_0xd8aa('0x11')],_0x32e2cd);_0x4953be(_0x3a29ca[_0xd8aa('0xf')](0x1f4,_0x5910b3[_0xd8aa('0x11')]));});});};exports[_0xd8aa('0x1b')]=function(_0x1f64f8){var _0x34d957=this;return new Promise(function(_0x375f64,_0x210176){return db[_0xd8aa('0x15')][_0xd8aa('0x1c')](_0x1f64f8[_0xd8aa('0x17')],{'raw':_0x1f64f8['options']?_0x1f64f8[_0xd8aa('0x18')][_0xd8aa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f64f8[_0xd8aa('0x18')]?_0x1f64f8[_0xd8aa('0x18')][_0xd8aa('0x1d')]||null:null,'attributes':_0x1f64f8[_0xd8aa('0x18')]?_0x1f64f8[_0xd8aa('0x18')][_0xd8aa('0x1e')]||null:null,'limit':_0x1f64f8[_0xd8aa('0x18')]?_0x1f64f8[_0xd8aa('0x18')]['limit']||null:null})[_0xd8aa('0x1a')](function(_0x34b792){logger[_0xd8aa('0x9')]('UpdateOpenchannelQueueReport',_0x1f64f8);logger[_0xd8aa('0xc')]('UpdateOpenchannelQueueReport',_0x1f64f8,JSON[_0xd8aa('0xe')](_0x34b792));_0x375f64(_0x34b792);})[_0xd8aa('0x13')](function(_0x37902c){logger[_0xd8aa('0xf')](_0xd8aa('0x1b'),_0x37902c[_0xd8aa('0x11')],_0x1f64f8);_0x210176(_0x34d957[_0xd8aa('0xf')](0x1f4,_0x37902c[_0xd8aa('0x11')]));});});}; \ No newline at end of file +var _0x7d25=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x3198ef,_0x32e339){var _0x138220=function(_0x489cc0){while(--_0x489cc0){_0x3198ef['push'](_0x3198ef['shift']());}};_0x138220(++_0x32e339);}(_0x7d25,0x8a));var _0x57d2=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x7d25[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')](_0x7d4cf1[_0x57d2('0x17')],{'raw':_0x7d4cf1[_0x57d2('0x18')]?_0x7d4cf1['options'][_0x57d2('0x19')]===undefined?!![]:![]:!![]})[_0x57d2('0x1a')](function(_0x55191e){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x55191e));_0x4a94e3(_0x55191e);})[_0x57d2('0x13')](function(_0x803c25){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x803c25[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x803c25[_0x57d2('0x11')]));});});};exports[_0x57d2('0x1b')]=function(_0x12ff19){var _0x473df2=this;return new Promise(function(_0x5327ea,_0x424ddc){return db[_0x57d2('0x15')][_0x57d2('0x1c')](_0x12ff19[_0x57d2('0x17')],{'raw':_0x12ff19[_0x57d2('0x18')]?_0x12ff19['options'][_0x57d2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12ff19[_0x57d2('0x18')]?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1d')]||null:null,'attributes':_0x12ff19[_0x57d2('0x18')]?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1e')]||null:null,'limit':_0x12ff19['options']?_0x12ff19[_0x57d2('0x18')][_0x57d2('0x1f')]||null:null})[_0x57d2('0x1a')](function(_0x1fe383){logger[_0x57d2('0x9')](_0x57d2('0x1b'),_0x12ff19);logger[_0x57d2('0xb')](_0x57d2('0x1b'),_0x12ff19,JSON[_0x57d2('0xe')](_0x1fe383));_0x5327ea(_0x1fe383);})[_0x57d2('0x13')](function(_0x574589){logger[_0x57d2('0xf')](_0x57d2('0x1b'),_0x574589[_0x57d2('0x11')],_0x12ff19);_0x424ddc(_0x473df2[_0x57d2('0xf')](0x1f4,_0x574589['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index cb917b5..0680387 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 _0x1d24=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1d24,0x1a2));var _0x41d2=function(_0x40d411,_0x4642f1){_0x40d411=_0x40d411-0x0;var _0x51fd22=_0x1d24[_0x40d411];return _0x51fd22;};'use strict';var multer=require(_0x41d2('0x0'));var util=require(_0x41d2('0x1'));var path=require(_0x41d2('0x2'));var timeout=require(_0x41d2('0x3'));var express=require(_0x41d2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x41d2('0x5'));var interaction=require(_0x41d2('0x6'));var config=require(_0x41d2('0x7'));var controller=require(_0x41d2('0x8'));router[_0x41d2('0x9')]('/',auth[_0x41d2('0xa')](),controller[_0x41d2('0xb')]);router[_0x41d2('0x9')](_0x41d2('0xc'),auth['isAuthenticated'](),controller[_0x41d2('0xd')]);router['get'](_0x41d2('0xe'),auth[_0x41d2('0xa')](),controller[_0x41d2('0xf')]);router[_0x41d2('0x10')]('/',auth[_0x41d2('0xa')](),controller[_0x41d2('0x11')]);router[_0x41d2('0x12')](_0x41d2('0xe'),auth[_0x41d2('0xa')](),controller['update']);router[_0x41d2('0x13')](_0x41d2('0xe'),auth[_0x41d2('0xa')](),controller[_0x41d2('0x14')]);module[_0x41d2('0x15')]=router; \ No newline at end of file +var _0xbbde=['update','delete','destroy','multer','util','path','express','fs-extra','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','put'];(function(_0x1427e5,_0x34526e){var _0x59bb5f=function(_0x353365){while(--_0x353365){_0x1427e5['push'](_0x1427e5['shift']());}};_0x59bb5f(++_0x34526e);}(_0xbbde,0xcf));var _0xebbd=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0xbbde[_0x5e4b85];return _0x5cd3cb;};'use strict';var multer=require(_0xebbd('0x0'));var util=require(_0xebbd('0x1'));var path=require(_0xebbd('0x2'));var timeout=require('connect-timeout');var express=require(_0xebbd('0x3'));var router=express['Router']();var fs_extra=require(_0xebbd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xebbd('0x5'));var controller=require(_0xebbd('0x6'));router[_0xebbd('0x7')]('/',auth[_0xebbd('0x8')](),controller[_0xebbd('0x9')]);router['get']('/describe',auth[_0xebbd('0x8')](),controller[_0xebbd('0xa')]);router[_0xebbd('0x7')](_0xebbd('0xb'),auth[_0xebbd('0x8')](),controller[_0xebbd('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xebbd('0xd')](_0xebbd('0xb'),auth[_0xebbd('0x8')](),controller[_0xebbd('0xe')]);router[_0xebbd('0xf')](_0xebbd('0xb'),auth[_0xebbd('0x8')](),controller[_0xebbd('0x10')]);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 3eb319f..75cb89e 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4d9799,_0x136a37){var _0x5abd14=function(_0x65ae56){while(--_0x65ae56){_0x4d9799['push'](_0x4d9799['shift']());}};_0x5abd14(++_0x136a37);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x4b84[_0x4d82ea];return _0x257f4a;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x579121,_0x27e9e2){var _0x38a4ae=function(_0x53e154){while(--_0x53e154){_0x579121['push'](_0x579121['shift']());}};_0x38a4ae(++_0x27e9e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 143afe5..13fe2ba 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 _0x9cdb=['fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','pick','filter','where','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','catch','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x9cdb,0x142));var _0xb9cd=function(_0x21ecf3,_0x3b4b99){_0x21ecf3=_0x21ecf3-0x0;var _0x3cf63a=_0x9cdb[_0x21ecf3];return _0x3cf63a;};'use strict';var emlformat=require(_0xb9cd('0x0'));var rimraf=require(_0xb9cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9cd('0x2'));var rp=require(_0xb9cd('0x3'));var moment=require(_0xb9cd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb9cd('0x5'));var sox=require(_0xb9cd('0x6'));var csv=require('to-csv');var ejs=require(_0xb9cd('0x7'));var fs=require('fs');var fs_extra=require(_0xb9cd('0x8'));var _=require('lodash');var squel=require(_0xb9cd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb9cd('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb9cd('0xb'));var Papa=require(_0xb9cd('0xc'));var Redis=require(_0xb9cd('0xd'));var authService=require(_0xb9cd('0xe'));var qs=require(_0xb9cd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9cd('0x10'));var logger=require(_0xb9cd('0x11'))(_0xb9cd('0x12'));var utils=require(_0xb9cd('0x13'));var config=require(_0xb9cd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9cd('0x15'))['db'];function respondWithStatusCode(_0x43f4c7,_0x417083){_0x417083=_0x417083||0xcc;return function(_0x30259c){if(_0x30259c){return _0x43f4c7['sendStatus'](_0x417083);}return _0x43f4c7[_0xb9cd('0x16')](_0x417083)[_0xb9cd('0x17')]();};}function respondWithResult(_0x196bdb,_0x3903db){_0x3903db=_0x3903db||0xc8;return function(_0x507d5d){if(_0x507d5d){return _0x196bdb[_0xb9cd('0x16')](_0x3903db)[_0xb9cd('0x18')](_0x507d5d);}};}function respondWithFilteredResult(_0x107616,_0x4f1509){return function(_0x48bea7){if(_0x48bea7){var _0x5d3250=typeof _0x4f1509[_0xb9cd('0x19')]===_0xb9cd('0x1a')&&typeof _0x4f1509['limit']==='undefined';var _0x13c6de=_0x48bea7[_0xb9cd('0x1b')];var _0x37e5ce=_0x5d3250?0x0:_0x4f1509[_0xb9cd('0x19')];var _0x3564f6=_0x5d3250?_0x48bea7['count']:_0x4f1509['offset']+_0x4f1509[_0xb9cd('0x1c')];var _0x4511b7;if(_0x3564f6>=_0x13c6de){_0x3564f6=_0x13c6de;_0x4511b7=0xc8;}else{_0x4511b7=0xce;}_0x107616[_0xb9cd('0x16')](_0x4511b7);return _0x107616['set'](_0xb9cd('0x1d'),_0x37e5ce+'-'+_0x3564f6+'/'+_0x13c6de)[_0xb9cd('0x18')](_0x48bea7);}return null;};}function patchUpdates(_0x15e9da){return function(_0x243096){try{jsonpatch['apply'](_0x243096,_0x15e9da,!![]);}catch(_0xc2dc40){return BPromise[_0xb9cd('0x1e')](_0xc2dc40);}return _0x243096[_0xb9cd('0x1f')]();};}function saveUpdates(_0x10c3fb,_0x37cbfc){return function(_0x11f49c){if(_0x11f49c){return _0x11f49c[_0xb9cd('0x20')](_0x10c3fb)[_0xb9cd('0x21')](function(_0x53302b){return _0x53302b;});}return null;};}function removeEntity(_0x5d082f,_0x38e286){return function(_0x15b553){if(_0x15b553){return _0x15b553[_0xb9cd('0x22')]()['then'](function(){_0x5d082f[_0xb9cd('0x16')](0xcc)[_0xb9cd('0x17')]();});}};}function handleEntityNotFound(_0x5b3b1a,_0x3b1432){return function(_0xb1294f){if(!_0xb1294f){_0x5b3b1a[_0xb9cd('0x23')](0x194);}return _0xb1294f;};}function handleError(_0x547af0,_0x3a371e){_0x3a371e=_0x3a371e||0x1f4;return function(_0x2c1726){logger[_0xb9cd('0x24')](_0x2c1726['stack']);if(_0x2c1726[_0xb9cd('0x25')]){delete _0x2c1726[_0xb9cd('0x25')];}_0x547af0[_0xb9cd('0x16')](_0x3a371e)[_0xb9cd('0x26')](_0x2c1726);};}exports['index']=function(_0x2c7ec9,_0x354a20){var _0x332a92={},_0x270eec={},_0x4adb50={'count':0x0,'rows':[]};var _0x2bc2c7=_['map'](db['OpenchannelTransferReport']['rawAttributes'],function(_0x43ffa1){return{'name':_0x43ffa1['fieldName'],'type':_0x43ffa1[_0xb9cd('0x27')]['key']};});_0x270eec[_0xb9cd('0x28')]=_[_0xb9cd('0x29')](_0x2bc2c7,_0xb9cd('0x25'));_0x270eec['query']=_[_0xb9cd('0x2a')](_0x2c7ec9[_0xb9cd('0x2b')]);_0x270eec[_0xb9cd('0x2c')]=_[_0xb9cd('0x2d')](_0x270eec[_0xb9cd('0x28')],_0x270eec[_0xb9cd('0x2b')]);_0x332a92[_0xb9cd('0x2e')]=_[_0xb9cd('0x2d')](_0x270eec['model'],qs['fields'](_0x2c7ec9[_0xb9cd('0x2b')][_0xb9cd('0x2f')]));_0x332a92[_0xb9cd('0x2e')]=_0x332a92[_0xb9cd('0x2e')][_0xb9cd('0x30')]?_0x332a92['attributes']:_0x270eec['model'];if(!_0x2c7ec9[_0xb9cd('0x2b')]['hasOwnProperty'](_0xb9cd('0x31'))){_0x332a92[_0xb9cd('0x1c')]=qs[_0xb9cd('0x1c')](_0x2c7ec9[_0xb9cd('0x2b')][_0xb9cd('0x1c')]);_0x332a92['offset']=qs[_0xb9cd('0x19')](_0x2c7ec9['query'][_0xb9cd('0x19')]);}_0x332a92['order']=qs['sort'](_0x2c7ec9['query']['sort']);_0x332a92['where']=qs['filters'](_[_0xb9cd('0x32')](_0x2c7ec9['query'],_0x270eec[_0xb9cd('0x2c')]),_0x2bc2c7);if(_0x2c7ec9[_0xb9cd('0x2b')][_0xb9cd('0x33')]){_0x332a92[_0xb9cd('0x34')]=_['merge'](_0x332a92[_0xb9cd('0x34')],{'$or':_['map'](_0x2bc2c7,function(_0x3c64d9){if(_0x3c64d9[_0xb9cd('0x27')]!==_0xb9cd('0x35')){var _0x58551d={};_0x58551d[_0x3c64d9['name']]={'$like':'%'+_0x2c7ec9[_0xb9cd('0x2b')][_0xb9cd('0x33')]+'%'};return _0x58551d;}})});}_0x332a92=_[_0xb9cd('0x36')]({},_0x332a92,_0x2c7ec9[_0xb9cd('0x37')]);var _0x1d769c={'where':_0x332a92['where']};return db[_0xb9cd('0x38')][_0xb9cd('0x1b')](_0x1d769c)['then'](function(_0x58012f){_0x4adb50[_0xb9cd('0x1b')]=_0x58012f;if(_0x2c7ec9[_0xb9cd('0x2b')][_0xb9cd('0x39')]){_0x332a92['include']=[{'all':!![]}];}return db[_0xb9cd('0x38')]['findAll'](_0x332a92);})[_0xb9cd('0x21')](function(_0x36587e){_0x4adb50['rows']=_0x36587e;return _0x4adb50;})[_0xb9cd('0x21')](respondWithFilteredResult(_0x354a20,_0x332a92))[_0xb9cd('0x3a')](handleError(_0x354a20,null));};exports['show']=function(_0x2c5e3b,_0x223b49){var _0x1f0f6c={'raw':!![],'where':{'id':_0x2c5e3b[_0xb9cd('0x3b')]['id']}},_0x404d8d={};_0x404d8d[_0xb9cd('0x28')]=_[_0xb9cd('0x2a')](db[_0xb9cd('0x38')][_0xb9cd('0x3c')]);_0x404d8d[_0xb9cd('0x2b')]=_[_0xb9cd('0x2a')](_0x2c5e3b[_0xb9cd('0x2b')]);_0x404d8d['filters']=_[_0xb9cd('0x2d')](_0x404d8d[_0xb9cd('0x28')],_0x404d8d[_0xb9cd('0x2b')]);_0x1f0f6c[_0xb9cd('0x2e')]=_[_0xb9cd('0x2d')](_0x404d8d['model'],qs[_0xb9cd('0x2f')](_0x2c5e3b['query']['fields']));_0x1f0f6c[_0xb9cd('0x2e')]=_0x1f0f6c['attributes']['length']?_0x1f0f6c[_0xb9cd('0x2e')]:_0x404d8d['model'];if(_0x2c5e3b[_0xb9cd('0x2b')][_0xb9cd('0x39')]){_0x1f0f6c[_0xb9cd('0x3d')]=[{'all':!![]}];}_0x1f0f6c=_[_0xb9cd('0x36')]({},_0x1f0f6c,_0x2c5e3b['options']);return db[_0xb9cd('0x38')][_0xb9cd('0x3e')](_0x1f0f6c)['then'](handleEntityNotFound(_0x223b49,null))[_0xb9cd('0x21')](respondWithResult(_0x223b49,null))[_0xb9cd('0x3a')](handleError(_0x223b49,null));};exports[_0xb9cd('0x3f')]=function(_0x5d5dfd,_0x5a16f6){return db[_0xb9cd('0x38')][_0xb9cd('0x3f')](_0x5d5dfd[_0xb9cd('0x40')],{})[_0xb9cd('0x21')](respondWithResult(_0x5a16f6,0xc9))[_0xb9cd('0x3a')](handleError(_0x5a16f6,null));};exports[_0xb9cd('0x20')]=function(_0x1667a8,_0x15ff07){if(_0x1667a8[_0xb9cd('0x40')]['id']){delete _0x1667a8[_0xb9cd('0x40')]['id'];}return db['OpenchannelTransferReport'][_0xb9cd('0x3e')]({'where':{'id':_0x1667a8[_0xb9cd('0x3b')]['id']}})[_0xb9cd('0x21')](handleEntityNotFound(_0x15ff07,null))['then'](saveUpdates(_0x1667a8[_0xb9cd('0x40')],null))[_0xb9cd('0x21')](respondWithResult(_0x15ff07,null))['catch'](handleError(_0x15ff07,null));};exports[_0xb9cd('0x22')]=function(_0x53a34d,_0x4ee66d){return db[_0xb9cd('0x38')][_0xb9cd('0x3e')]({'where':{'id':_0x53a34d[_0xb9cd('0x3b')]['id']}})[_0xb9cd('0x21')](handleEntityNotFound(_0x4ee66d,null))['then'](removeEntity(_0x4ee66d,null))['catch'](handleError(_0x4ee66d,null));};exports['describe']=function(_0x2bf0bd,_0x4c4561){return db[_0xb9cd('0x38')][_0xb9cd('0x41')]()[_0xb9cd('0x21')](respondWithResult(_0x4c4561,null))['catch'](handleError(_0x4c4561,null));}; \ No newline at end of file +var _0xa50a=['filters','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','findAll','rows','catch','show','keys','intersection','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query'];(function(_0x1c8181,_0x424b01){var _0x3d1cb=function(_0x270e8e){while(--_0x270e8e){_0x1c8181['push'](_0x1c8181['shift']());}};_0x3d1cb(++_0x424b01);}(_0xa50a,0x13c));var _0xaa50=function(_0x6bddc3,_0x36563e){_0x6bddc3=_0x6bddc3-0x0;var _0x868581=_0xa50a[_0x6bddc3];return _0x868581;};'use strict';var emlformat=require(_0xaa50('0x0'));var rimraf=require(_0xaa50('0x1'));var zipdir=require(_0xaa50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa50('0x3'));var moment=require('moment');var BPromise=require(_0xaa50('0x4'));var Mustache=require(_0xaa50('0x5'));var util=require(_0xaa50('0x6'));var path=require(_0xaa50('0x7'));var sox=require(_0xaa50('0x8'));var csv=require(_0xaa50('0x9'));var ejs=require(_0xaa50('0xa'));var fs=require('fs');var fs_extra=require(_0xaa50('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa50('0xc'));var jsforce=require(_0xaa50('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa50('0x9'));var querystring=require(_0xaa50('0xe'));var Papa=require(_0xaa50('0xf'));var Redis=require(_0xaa50('0x10'));var authService=require(_0xaa50('0x11'));var qs=require(_0xaa50('0x12'));var as=require(_0xaa50('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa50('0x14'));var utils=require(_0xaa50('0x15'));var config=require(_0xaa50('0x16'));var licenseUtil=require(_0xaa50('0x17'));var db=require(_0xaa50('0x18'))['db'];function respondWithStatusCode(_0x3f2026,_0x1cddd4){_0x1cddd4=_0x1cddd4||0xcc;return function(_0xaa2d39){if(_0xaa2d39){return _0x3f2026[_0xaa50('0x19')](_0x1cddd4);}return _0x3f2026[_0xaa50('0x1a')](_0x1cddd4)[_0xaa50('0x1b')]();};}function respondWithResult(_0x37dcd4,_0x50df60){_0x50df60=_0x50df60||0xc8;return function(_0x2901ae){if(_0x2901ae){return _0x37dcd4[_0xaa50('0x1a')](_0x50df60)[_0xaa50('0x1c')](_0x2901ae);}};}function respondWithFilteredResult(_0x4710e2,_0x29e7f1){return function(_0x2cced2){if(_0x2cced2){var _0x5b4b6e=typeof _0x29e7f1[_0xaa50('0x1d')]===_0xaa50('0x1e')&&typeof _0x29e7f1['limit']==='undefined';var _0x3e1bca=_0x2cced2[_0xaa50('0x1f')];var _0x24c625=_0x5b4b6e?0x0:_0x29e7f1[_0xaa50('0x1d')];var _0x2514ff=_0x5b4b6e?_0x2cced2[_0xaa50('0x1f')]:_0x29e7f1[_0xaa50('0x1d')]+_0x29e7f1[_0xaa50('0x20')];var _0x5dc8f1;if(_0x2514ff>=_0x3e1bca){_0x2514ff=_0x3e1bca;_0x5dc8f1=0xc8;}else{_0x5dc8f1=0xce;}_0x4710e2['status'](_0x5dc8f1);return _0x4710e2[_0xaa50('0x21')]('Content-Range',_0x24c625+'-'+_0x2514ff+'/'+_0x3e1bca)[_0xaa50('0x1c')](_0x2cced2);}return null;};}function patchUpdates(_0xe4f2aa){return function(_0x2cd4ed){try{jsonpatch['apply'](_0x2cd4ed,_0xe4f2aa,!![]);}catch(_0x16088d){return BPromise[_0xaa50('0x22')](_0x16088d);}return _0x2cd4ed['save']();};}function saveUpdates(_0x4a3830,_0x36bf8f){return function(_0x5bb56c){if(_0x5bb56c){return _0x5bb56c[_0xaa50('0x23')](_0x4a3830)[_0xaa50('0x24')](function(_0x1007e4){return _0x1007e4;});}return null;};}function removeEntity(_0x4c266d,_0xf863a1){return function(_0xcbb53f){if(_0xcbb53f){return _0xcbb53f[_0xaa50('0x25')]()[_0xaa50('0x24')](function(){_0x4c266d[_0xaa50('0x1a')](0xcc)[_0xaa50('0x1b')]();});}};}function handleEntityNotFound(_0x534d91,_0x11bcdf){return function(_0xc66a96){if(!_0xc66a96){_0x534d91[_0xaa50('0x19')](0x194);}return _0xc66a96;};}function handleError(_0x213d08,_0x25b404){_0x25b404=_0x25b404||0x1f4;return function(_0x2a592d){logger[_0xaa50('0x26')](_0x2a592d[_0xaa50('0x27')]);if(_0x2a592d[_0xaa50('0x28')]){delete _0x2a592d[_0xaa50('0x28')];}_0x213d08[_0xaa50('0x1a')](_0x25b404)[_0xaa50('0x29')](_0x2a592d);};}exports[_0xaa50('0x2a')]=function(_0x3ef93d,_0x283269){var _0xc9aa8b={},_0xca594c={},_0x50211b={'count':0x0,'rows':[]};var _0x17af56=_['map'](db['OpenchannelTransferReport'][_0xaa50('0x2b')],function(_0x3bbc67){return{'name':_0x3bbc67['fieldName'],'type':_0x3bbc67[_0xaa50('0x2c')][_0xaa50('0x2d')]};});_0xca594c[_0xaa50('0x2e')]=_[_0xaa50('0x2f')](_0x17af56,_0xaa50('0x28'));_0xca594c['query']=_['keys'](_0x3ef93d[_0xaa50('0x30')]);_0xca594c[_0xaa50('0x31')]=_['intersection'](_0xca594c['model'],_0xca594c[_0xaa50('0x30')]);_0xc9aa8b['attributes']=_['intersection'](_0xca594c[_0xaa50('0x2e')],qs['fields'](_0x3ef93d[_0xaa50('0x30')][_0xaa50('0x32')]));_0xc9aa8b[_0xaa50('0x33')]=_0xc9aa8b[_0xaa50('0x33')][_0xaa50('0x34')]?_0xc9aa8b['attributes']:_0xca594c[_0xaa50('0x2e')];if(!_0x3ef93d[_0xaa50('0x30')][_0xaa50('0x35')]('nolimit')){_0xc9aa8b[_0xaa50('0x20')]=qs['limit'](_0x3ef93d[_0xaa50('0x30')][_0xaa50('0x20')]);_0xc9aa8b[_0xaa50('0x1d')]=qs[_0xaa50('0x1d')](_0x3ef93d[_0xaa50('0x30')][_0xaa50('0x1d')]);}_0xc9aa8b[_0xaa50('0x36')]=qs[_0xaa50('0x37')](_0x3ef93d[_0xaa50('0x30')][_0xaa50('0x37')]);_0xc9aa8b['where']=qs['filters'](_['pick'](_0x3ef93d[_0xaa50('0x30')],_0xca594c[_0xaa50('0x31')]),_0x17af56);if(_0x3ef93d[_0xaa50('0x30')][_0xaa50('0x38')]){_0xc9aa8b[_0xaa50('0x39')]=_[_0xaa50('0x3a')](_0xc9aa8b[_0xaa50('0x39')],{'$or':_[_0xaa50('0x2f')](_0x17af56,function(_0x5e362a){if(_0x5e362a[_0xaa50('0x2c')]!==_0xaa50('0x3b')){var _0x4e4e15={};_0x4e4e15[_0x5e362a['name']]={'$like':'%'+_0x3ef93d[_0xaa50('0x30')][_0xaa50('0x38')]+'%'};return _0x4e4e15;}})});}_0xc9aa8b=_[_0xaa50('0x3a')]({},_0xc9aa8b,_0x3ef93d[_0xaa50('0x3c')]);var _0x1e68ed={'where':_0xc9aa8b['where']};return db[_0xaa50('0x3d')][_0xaa50('0x1f')](_0x1e68ed)[_0xaa50('0x24')](function(_0x42a7e0){_0x50211b[_0xaa50('0x1f')]=_0x42a7e0;if(_0x3ef93d[_0xaa50('0x30')][_0xaa50('0x3e')]){_0xc9aa8b['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xaa50('0x3f')](_0xc9aa8b);})[_0xaa50('0x24')](function(_0x368e69){_0x50211b[_0xaa50('0x40')]=_0x368e69;return _0x50211b;})[_0xaa50('0x24')](respondWithFilteredResult(_0x283269,_0xc9aa8b))[_0xaa50('0x41')](handleError(_0x283269,null));};exports[_0xaa50('0x42')]=function(_0x111635,_0x506d8f){var _0x8a69c5={'raw':!![],'where':{'id':_0x111635['params']['id']}},_0x3b6797={};_0x3b6797[_0xaa50('0x2e')]=_[_0xaa50('0x43')](db['OpenchannelTransferReport'][_0xaa50('0x2b')]);_0x3b6797['query']=_['keys'](_0x111635[_0xaa50('0x30')]);_0x3b6797['filters']=_[_0xaa50('0x44')](_0x3b6797[_0xaa50('0x2e')],_0x3b6797[_0xaa50('0x30')]);_0x8a69c5[_0xaa50('0x33')]=_[_0xaa50('0x44')](_0x3b6797[_0xaa50('0x2e')],qs[_0xaa50('0x32')](_0x111635[_0xaa50('0x30')][_0xaa50('0x32')]));_0x8a69c5[_0xaa50('0x33')]=_0x8a69c5[_0xaa50('0x33')]['length']?_0x8a69c5[_0xaa50('0x33')]:_0x3b6797[_0xaa50('0x2e')];if(_0x111635[_0xaa50('0x30')][_0xaa50('0x3e')]){_0x8a69c5['include']=[{'all':!![]}];}_0x8a69c5=_[_0xaa50('0x3a')]({},_0x8a69c5,_0x111635[_0xaa50('0x3c')]);return db['OpenchannelTransferReport'][_0xaa50('0x45')](_0x8a69c5)['then'](handleEntityNotFound(_0x506d8f,null))[_0xaa50('0x24')](respondWithResult(_0x506d8f,null))[_0xaa50('0x41')](handleError(_0x506d8f,null));};exports[_0xaa50('0x46')]=function(_0x2ea813,_0x23d419){return db['OpenchannelTransferReport']['create'](_0x2ea813[_0xaa50('0x47')],{})[_0xaa50('0x24')](respondWithResult(_0x23d419,0xc9))['catch'](handleError(_0x23d419,null));};exports[_0xaa50('0x23')]=function(_0x1f3d82,_0x2fa88d){if(_0x1f3d82[_0xaa50('0x47')]['id']){delete _0x1f3d82['body']['id'];}return db['OpenchannelTransferReport'][_0xaa50('0x45')]({'where':{'id':_0x1f3d82['params']['id']}})[_0xaa50('0x24')](handleEntityNotFound(_0x2fa88d,null))[_0xaa50('0x24')](saveUpdates(_0x1f3d82[_0xaa50('0x47')],null))['then'](respondWithResult(_0x2fa88d,null))[_0xaa50('0x41')](handleError(_0x2fa88d,null));};exports[_0xaa50('0x25')]=function(_0x596259,_0x538585){return db[_0xaa50('0x3d')][_0xaa50('0x45')]({'where':{'id':_0x596259[_0xaa50('0x48')]['id']}})['then'](handleEntityNotFound(_0x538585,null))[_0xaa50('0x24')](removeEntity(_0x538585,null))[_0xaa50('0x41')](handleError(_0x538585,null));};exports['describe']=function(_0x585045,_0x5a50aa){return db[_0xaa50('0x3d')]['describe']()[_0xaa50('0x24')](respondWithResult(_0x5a50aa,null))[_0xaa50('0x41')](handleError(_0x5a50aa,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d49d218..7d0ab6b 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 _0x9f3a=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x4a833a,_0x2bd3ea){var _0x3a7b1e=function(_0x507c13){while(--_0x507c13){_0x4a833a['push'](_0x4a833a['shift']());}};_0x3a7b1e(++_0x2bd3ea);}(_0x9f3a,0x79));var _0xa9f3=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0x9f3a[_0x28407a];return _0x8bd6ef;};'use strict';var _=require('lodash');var util=require(_0xa9f3('0x0'));var logger=require(_0xa9f3('0x1'))(_0xa9f3('0x2'));var moment=require(_0xa9f3('0x3'));var BPromise=require(_0xa9f3('0x4'));var rp=require(_0xa9f3('0x5'));var fs=require('fs');var path=require(_0xa9f3('0x6'));var rimraf=require(_0xa9f3('0x7'));var config=require(_0xa9f3('0x8'));var attributes=require(_0xa9f3('0x9'));module[_0xa9f3('0xa')]=function(_0x521352,_0xe374db){return _0x521352[_0xa9f3('0xb')](_0xa9f3('0xc'),attributes,{'tableName':_0xa9f3('0xd'),'paranoid':![],'indexes':[{'name':_0xa9f3('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd310=['api','request-promise','path','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xd310,0x132));var _0x0d31=function(_0x80f119,_0x55c441){_0x80f119=_0x80f119-0x0;var _0x2544bb=_0xd310[_0x80f119];return _0x2544bb;};'use strict';var _=require(_0x0d31('0x0'));var util=require(_0x0d31('0x1'));var logger=require('../../config/logger')(_0x0d31('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0d31('0x3'));var fs=require('fs');var path=require(_0x0d31('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0d31('0x5'));module[_0x0d31('0x6')]=function(_0x1c8283,_0x1ab2e0){return _0x1c8283[_0x0d31('0x7')](_0x0d31('0x8'),attributes,{'tableName':_0x0d31('0x9'),'paranoid':![],'indexes':[{'name':_0x0d31('0xa'),'fields':[_0x0d31('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index e50f9b3..34256fc 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 _0x56e7=['client','http','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x56e7,0x7b));var _0x756e=function(_0x386078,_0x49ad4f){_0x386078=_0x386078-0x0;var _0xd6675c=_0x56e7[_0x386078];return _0xd6675c;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var moment=require(_0x756e('0x1'));var BPromise=require('bluebird');var rs=require(_0x756e('0x2'));var fs=require('fs');var Redis=require(_0x756e('0x3'));var db=require(_0x756e('0x4'))['db'];var utils=require(_0x756e('0x5'));var logger=require(_0x756e('0x6'))(_0x756e('0x7'));var config=require(_0x756e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x756e('0x9')][_0x756e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26519d,_0xcf58ec,_0x5c8589){return new BPromise(function(_0x1c6a22,_0x5c2db4){return client[_0x756e('0xb')](_0x26519d,_0x5c8589)[_0x756e('0xc')](function(_0x313d92){logger[_0x756e('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xcf58ec,'request\x20sent');logger[_0x756e('0xe')](_0x756e('0xf'),_0xcf58ec,_0x756e('0x10'),JSON['stringify'](_0x313d92));if(_0x313d92[_0x756e('0x11')]){if(_0x313d92[_0x756e('0x11')]['code']===0x1f4){logger['error'](_0x756e('0x12'),_0xcf58ec,_0x313d92['error'][_0x756e('0x13')]);return _0x5c2db4(_0x313d92[_0x756e('0x11')][_0x756e('0x13')]);}logger[_0x756e('0x11')](_0x756e('0x12'),_0xcf58ec,_0x313d92['error']['message']);return _0x1c6a22(_0x313d92[_0x756e('0x11')][_0x756e('0x13')]);}else{logger[_0x756e('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xcf58ec,'request\x20sent');_0x1c6a22(_0x313d92[_0x756e('0x14')][_0x756e('0x13')]);}})[_0x756e('0x15')](function(_0x296b14){logger[_0x756e('0x11')](_0x756e('0x12'),_0xcf58ec,_0x296b14);_0x5c2db4(_0x296b14);});});} \ No newline at end of file +var _0x64f5=['result','catch','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x64f5,0x17e));var _0x564f=function(_0xd44fee,_0x2c5737){_0xd44fee=_0xd44fee-0x0;var _0x3e7ccb=_0x64f5[_0xd44fee];return _0x3e7ccb;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x564f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x564f('0x2'))['db'];var utils=require(_0x564f('0x3'));var logger=require('../../config/logger')(_0x564f('0x4'));var config=require(_0x564f('0x5'));var jayson=require(_0x564f('0x6'));var client=jayson[_0x564f('0x7')][_0x564f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d3dae,_0x26f14e,_0x28db5a){return new BPromise(function(_0x275bd6,_0x26fd74){return client[_0x564f('0x9')](_0x4d3dae,_0x28db5a)[_0x564f('0xa')](function(_0x2e2b5c){logger[_0x564f('0xb')](_0x564f('0xc'),_0x26f14e,_0x564f('0xd'));logger[_0x564f('0xe')](_0x564f('0xf'),_0x26f14e,_0x564f('0xd'),JSON['stringify'](_0x2e2b5c));if(_0x2e2b5c['error']){if(_0x2e2b5c[_0x564f('0x10')]['code']===0x1f4){logger[_0x564f('0x10')](_0x564f('0xc'),_0x26f14e,_0x2e2b5c[_0x564f('0x10')]['message']);return _0x26fd74(_0x2e2b5c[_0x564f('0x10')][_0x564f('0x11')]);}logger[_0x564f('0x10')](_0x564f('0xc'),_0x26f14e,_0x2e2b5c[_0x564f('0x10')]['message']);return _0x275bd6(_0x2e2b5c['error'][_0x564f('0x11')]);}else{logger[_0x564f('0xb')](_0x564f('0xc'),_0x26f14e,_0x564f('0xd'));_0x275bd6(_0x2e2b5c[_0x564f('0x12')][_0x564f('0x11')]);}})[_0x564f('0x13')](function(_0x15d9d7){logger[_0x564f('0x10')](_0x564f('0xc'),_0x26f14e,_0x15d9d7);_0x26fd74(_0x15d9d7);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d529342..5f92ef1 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 _0x11b5=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','destroy'];(function(_0x54e55e,_0x3ad3de){var _0x4f0e1e=function(_0xc0c299){while(--_0xc0c299){_0x54e55e['push'](_0x54e55e['shift']());}};_0x4f0e1e(++_0x3ad3de);}(_0x11b5,0x133));var _0x511b=function(_0x49a0ba,_0x3fd122){_0x49a0ba=_0x49a0ba-0x0;var _0x258a64=_0x11b5[_0x49a0ba];return _0x258a64;};'use strict';var multer=require(_0x511b('0x0'));var util=require(_0x511b('0x1'));var path=require(_0x511b('0x2'));var timeout=require(_0x511b('0x3'));var express=require('express');var router=express[_0x511b('0x4')]();var fs_extra=require(_0x511b('0x5'));var auth=require(_0x511b('0x6'));var interaction=require(_0x511b('0x7'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x511b('0x8')]('/',auth[_0x511b('0x9')](),controller['index']);router[_0x511b('0x8')](_0x511b('0xa'),auth[_0x511b('0x9')](),controller[_0x511b('0xb')]);router[_0x511b('0xc')]('/',auth[_0x511b('0x9')](),controller[_0x511b('0xd')]);router[_0x511b('0xe')](_0x511b('0xa'),auth[_0x511b('0x9')](),controller['update']);router['delete']('/:id',auth[_0x511b('0x9')](),controller[_0x511b('0xf')]);module[_0x511b('0x10')]=router; \ No newline at end of file +var _0x6344=['./pause.controller','get','index','/:id','isAuthenticated','post','create','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x562d39,_0x290f8d){var _0x4fdc2d=function(_0x53968e){while(--_0x53968e){_0x562d39['push'](_0x562d39['shift']());}};_0x4fdc2d(++_0x290f8d);}(_0x6344,0x196));var _0x4634=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6344[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4634('0x0'));var util=require(_0x4634('0x1'));var path=require('path');var timeout=require(_0x4634('0x2'));var express=require('express');var router=express[_0x4634('0x3')]();var fs_extra=require(_0x4634('0x4'));var auth=require(_0x4634('0x5'));var interaction=require(_0x4634('0x6'));var config=require(_0x4634('0x7'));var controller=require(_0x4634('0x8'));router[_0x4634('0x9')]('/',auth['isAuthenticated'](),controller[_0x4634('0xa')]);router[_0x4634('0x9')](_0x4634('0xb'),auth[_0x4634('0xc')](),controller['show']);router[_0x4634('0xd')]('/',auth[_0x4634('0xc')](),controller[_0x4634('0xe')]);router['put'](_0x4634('0xb'),auth[_0x4634('0xc')](),controller[_0x4634('0xf')]);router['delete']('/:id',auth[_0x4634('0xc')](),controller[_0x4634('0x10')]);module[_0x4634('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 659b0b7..117ffd0 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 _0x0a16=['name','sequelize','exports','STRING'];(function(_0x203ef2,_0x5cc83){var _0x2511ca=function(_0x16ff4b){while(--_0x16ff4b){_0x203ef2['push'](_0x203ef2['shift']());}};_0x2511ca(++_0x5cc83);}(_0x0a16,0x69));var _0x60a1=function(_0x147003,_0x36e2e3){_0x147003=_0x147003-0x0;var _0x5167b2=_0x0a16[_0x147003];return _0x5167b2;};'use strict';var Sequelize=require(_0x60a1('0x0'));module[_0x60a1('0x1')]={'name':{'type':Sequelize[_0x60a1('0x2')],'unique':_0x60a1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x60a1('0x2')]}}; \ No newline at end of file +var _0x1939=['sequelize','exports','STRING'];(function(_0x559854,_0x2056e1){var _0x5bf2b9=function(_0x5ed1a1){while(--_0x5ed1a1){_0x559854['push'](_0x559854['shift']());}};_0x5bf2b9(++_0x2056e1);}(_0x1939,0x9c));var _0x9193=function(_0x5d2a5d,_0x55d114){_0x5d2a5d=_0x5d2a5d-0x0;var _0x66550d=_0x1939[_0x5d2a5d];return _0x66550d;};'use strict';var Sequelize=require(_0x9193('0x0'));module[_0x9193('0x1')]={'name':{'type':Sequelize[_0x9193('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9193('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f6be79c..6b22061 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 _0xfe66=['../../config/environment','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x188741,_0x243906){var _0x5e9290=function(_0x90f20a){while(--_0x90f20a){_0x188741['push'](_0x188741['shift']());}};_0x5e9290(++_0x243906);}(_0xfe66,0x137));var _0x6fe6=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xfe66[_0x2ca9d4];return _0x258956;};'use strict';var emlformat=require(_0x6fe6('0x0'));var rimraf=require(_0x6fe6('0x1'));var zipdir=require(_0x6fe6('0x2'));var jsonpatch=require(_0x6fe6('0x3'));var rp=require('request-promise');var moment=require(_0x6fe6('0x4'));var BPromise=require(_0x6fe6('0x5'));var Mustache=require(_0x6fe6('0x6'));var util=require(_0x6fe6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6fe6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fe6('0x9'));var _=require(_0x6fe6('0xa'));var squel=require(_0x6fe6('0xb'));var crypto=require(_0x6fe6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6fe6('0x8'));var querystring=require(_0x6fe6('0xd'));var Papa=require(_0x6fe6('0xe'));var Redis=require(_0x6fe6('0xf'));var authService=require(_0x6fe6('0x10'));var qs=require(_0x6fe6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fe6('0x12'));var logger=require('../../config/logger')(_0x6fe6('0x13'));var utils=require(_0x6fe6('0x14'));var config=require(_0x6fe6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6fe6('0x16'))['db'];function respondWithStatusCode(_0x6e3cb5,_0x203193){_0x203193=_0x203193||0xcc;return function(_0x11184c){if(_0x11184c){return _0x6e3cb5[_0x6fe6('0x17')](_0x203193);}return _0x6e3cb5['status'](_0x203193)[_0x6fe6('0x18')]();};}function respondWithResult(_0x2e12f7,_0x43dc2a){_0x43dc2a=_0x43dc2a||0xc8;return function(_0x31e51c){if(_0x31e51c){return _0x2e12f7[_0x6fe6('0x19')](_0x43dc2a)['json'](_0x31e51c);}};}function respondWithFilteredResult(_0x4b704b,_0x37f003){return function(_0xdd7578){if(_0xdd7578){var _0x1b006f=typeof _0x37f003['offset']===_0x6fe6('0x1a')&&typeof _0x37f003['limit']===_0x6fe6('0x1a');var _0x12f58b=_0xdd7578[_0x6fe6('0x1b')];var _0x4a4f89=_0x1b006f?0x0:_0x37f003[_0x6fe6('0x1c')];var _0x49648d=_0x1b006f?_0xdd7578[_0x6fe6('0x1b')]:_0x37f003[_0x6fe6('0x1c')]+_0x37f003[_0x6fe6('0x1d')];var _0x1fb569;if(_0x49648d>=_0x12f58b){_0x49648d=_0x12f58b;_0x1fb569=0xc8;}else{_0x1fb569=0xce;}_0x4b704b[_0x6fe6('0x19')](_0x1fb569);return _0x4b704b[_0x6fe6('0x1e')](_0x6fe6('0x1f'),_0x4a4f89+'-'+_0x49648d+'/'+_0x12f58b)[_0x6fe6('0x20')](_0xdd7578);}return null;};}function patchUpdates(_0x16d0f9){return function(_0x33ad5a){try{jsonpatch[_0x6fe6('0x21')](_0x33ad5a,_0x16d0f9,!![]);}catch(_0x4623e9){return BPromise[_0x6fe6('0x22')](_0x4623e9);}return _0x33ad5a[_0x6fe6('0x23')]();};}function saveUpdates(_0x371035,_0x278c23){return function(_0x2a7b95){if(_0x2a7b95){return _0x2a7b95[_0x6fe6('0x24')](_0x371035)[_0x6fe6('0x25')](function(_0x2123ce){return _0x2123ce;});}return null;};}function removeEntity(_0x1e2ea3,_0x2d6148){return function(_0xc6c036){if(_0xc6c036){return _0xc6c036['destroy']()[_0x6fe6('0x25')](function(){var _0x176f3c=_0xc6c036[_0x6fe6('0x26')]({'plain':!![]});var _0x533935='Pauses';return db[_0x6fe6('0x27')][_0x6fe6('0x28')]({'where':{'type':_0x533935,'resourceId':_0x176f3c['id']}})[_0x6fe6('0x25')](function(){return _0xc6c036;});})['then'](function(){_0x1e2ea3[_0x6fe6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43d7af,_0x19573d){return function(_0x5f7d5f){if(!_0x5f7d5f){_0x43d7af['sendStatus'](0x194);}return _0x5f7d5f;};}function handleError(_0x2e8137,_0x5b6971){_0x5b6971=_0x5b6971||0x1f4;return function(_0x259487){logger[_0x6fe6('0x29')](_0x259487[_0x6fe6('0x2a')]);if(_0x259487[_0x6fe6('0x2b')]){delete _0x259487['name'];}_0x2e8137['status'](_0x5b6971)[_0x6fe6('0x2c')](_0x259487);};}exports['index']=function(_0x615ab0,_0x2973cf){var _0x35016e={},_0x2db335={},_0x483830={'count':0x0,'rows':[]};var _0x153ccf=_['map'](db['Pause'][_0x6fe6('0x2d')],function(_0x419a91){return{'name':_0x419a91[_0x6fe6('0x2e')],'type':_0x419a91[_0x6fe6('0x2f')][_0x6fe6('0x30')]};});_0x2db335[_0x6fe6('0x31')]=_[_0x6fe6('0x32')](_0x153ccf,'name');_0x2db335[_0x6fe6('0x33')]=_['keys'](_0x615ab0['query']);_0x2db335[_0x6fe6('0x34')]=_[_0x6fe6('0x35')](_0x2db335[_0x6fe6('0x31')],_0x2db335['query']);_0x35016e[_0x6fe6('0x36')]=_[_0x6fe6('0x35')](_0x2db335[_0x6fe6('0x31')],qs[_0x6fe6('0x37')](_0x615ab0[_0x6fe6('0x33')][_0x6fe6('0x37')]));_0x35016e[_0x6fe6('0x36')]=_0x35016e['attributes'][_0x6fe6('0x38')]?_0x35016e[_0x6fe6('0x36')]:_0x2db335[_0x6fe6('0x31')];if(!_0x615ab0[_0x6fe6('0x33')][_0x6fe6('0x39')](_0x6fe6('0x3a'))){_0x35016e[_0x6fe6('0x1d')]=qs[_0x6fe6('0x1d')](_0x615ab0[_0x6fe6('0x33')][_0x6fe6('0x1d')]);_0x35016e[_0x6fe6('0x1c')]=qs[_0x6fe6('0x1c')](_0x615ab0[_0x6fe6('0x33')][_0x6fe6('0x1c')]);}_0x35016e['order']=qs[_0x6fe6('0x3b')](_0x615ab0[_0x6fe6('0x33')][_0x6fe6('0x3b')]);_0x35016e[_0x6fe6('0x3c')]=qs[_0x6fe6('0x34')](_[_0x6fe6('0x3d')](_0x615ab0[_0x6fe6('0x33')],_0x2db335['filters']),_0x153ccf);if(_0x615ab0[_0x6fe6('0x33')][_0x6fe6('0x3e')]){_0x35016e[_0x6fe6('0x3c')]=_[_0x6fe6('0x3f')](_0x35016e[_0x6fe6('0x3c')],{'$or':_[_0x6fe6('0x32')](_0x153ccf,function(_0x53f09e){if(_0x53f09e[_0x6fe6('0x2f')]!==_0x6fe6('0x40')){var _0x486d59={};_0x486d59[_0x53f09e['name']]={'$like':'%'+_0x615ab0[_0x6fe6('0x33')][_0x6fe6('0x3e')]+'%'};return _0x486d59;}})});}_0x35016e=_[_0x6fe6('0x3f')]({},_0x35016e,_0x615ab0[_0x6fe6('0x41')]);var _0x313e06={'where':_0x35016e[_0x6fe6('0x3c')]};return db[_0x6fe6('0x42')][_0x6fe6('0x1b')](_0x313e06)[_0x6fe6('0x25')](function(_0x422382){_0x483830[_0x6fe6('0x1b')]=_0x422382;if(_0x615ab0[_0x6fe6('0x33')][_0x6fe6('0x43')]){_0x35016e[_0x6fe6('0x44')]=[{'all':!![]}];}return db['Pause'][_0x6fe6('0x45')](_0x35016e);})[_0x6fe6('0x25')](function(_0x4e6f6e){_0x483830[_0x6fe6('0x46')]=_0x4e6f6e;return _0x483830;})[_0x6fe6('0x25')](respondWithFilteredResult(_0x2973cf,_0x35016e))['catch'](handleError(_0x2973cf,null));};exports[_0x6fe6('0x47')]=function(_0x5b7666,_0xa25d5a){var _0x3c0b3e={'raw':!![],'where':{'id':_0x5b7666[_0x6fe6('0x48')]['id']}},_0x4e0fb9={};_0x4e0fb9[_0x6fe6('0x31')]=_[_0x6fe6('0x49')](db[_0x6fe6('0x42')][_0x6fe6('0x2d')]);_0x4e0fb9[_0x6fe6('0x33')]=_[_0x6fe6('0x49')](_0x5b7666[_0x6fe6('0x33')]);_0x4e0fb9['filters']=_['intersection'](_0x4e0fb9['model'],_0x4e0fb9[_0x6fe6('0x33')]);_0x3c0b3e[_0x6fe6('0x36')]=_[_0x6fe6('0x35')](_0x4e0fb9['model'],qs[_0x6fe6('0x37')](_0x5b7666['query'][_0x6fe6('0x37')]));_0x3c0b3e['attributes']=_0x3c0b3e[_0x6fe6('0x36')][_0x6fe6('0x38')]?_0x3c0b3e[_0x6fe6('0x36')]:_0x4e0fb9[_0x6fe6('0x31')];if(_0x5b7666[_0x6fe6('0x33')][_0x6fe6('0x43')]){_0x3c0b3e[_0x6fe6('0x44')]=[{'all':!![]}];}_0x3c0b3e=_['merge']({},_0x3c0b3e,_0x5b7666[_0x6fe6('0x41')]);return db[_0x6fe6('0x42')][_0x6fe6('0x4a')](_0x3c0b3e)['then'](handleEntityNotFound(_0xa25d5a,null))['then'](respondWithResult(_0xa25d5a,null))[_0x6fe6('0x4b')](handleError(_0xa25d5a,null));};exports[_0x6fe6('0x4c')]=function(_0x485815,_0x1322c8){return db['Pause']['create'](_0x485815[_0x6fe6('0x4d')],{})[_0x6fe6('0x25')](function(_0x4853c4){var _0xc8f4c2=_0x485815[_0x6fe6('0x4e')][_0x6fe6('0x26')]({'plain':!![]});if(!_0xc8f4c2)throw new Error(_0x6fe6('0x4f'));if(_0xc8f4c2['role']==='user'){var _0x5b12dd=_0x4853c4[_0x6fe6('0x26')]({'plain':!![]});var _0x44ac28=_0x6fe6('0x50');return db[_0x6fe6('0x51')][_0x6fe6('0x4a')]({'where':{'name':_0x44ac28,'userProfileId':_0xc8f4c2[_0x6fe6('0x52')]},'raw':!![]})[_0x6fe6('0x25')](function(_0x1b2a62){if(_0x1b2a62&&_0x1b2a62['autoAssociation']===0x0){return db[_0x6fe6('0x27')]['create']({'name':_0x5b12dd['name'],'resourceId':_0x5b12dd['id'],'type':_0x1b2a62[_0x6fe6('0x2b')],'sectionId':_0x1b2a62['id']},{})['then'](function(){return _0x4853c4;});}else{return _0x4853c4;}})[_0x6fe6('0x4b')](function(_0x2e4f4b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e4f4b);throw _0x2e4f4b;});}return _0x4853c4;})[_0x6fe6('0x25')](respondWithResult(_0x1322c8,0xc9))['catch'](handleError(_0x1322c8,null));};exports[_0x6fe6('0x24')]=function(_0x118060,_0x3ea2ea){if(_0x118060[_0x6fe6('0x4d')]['id']){delete _0x118060['body']['id'];}return db['Pause'][_0x6fe6('0x4a')]({'where':{'id':_0x118060[_0x6fe6('0x48')]['id']}})[_0x6fe6('0x25')](handleEntityNotFound(_0x3ea2ea,null))[_0x6fe6('0x25')](saveUpdates(_0x118060[_0x6fe6('0x4d')],null))[_0x6fe6('0x25')](respondWithResult(_0x3ea2ea,null))[_0x6fe6('0x4b')](handleError(_0x3ea2ea,null));};exports['destroy']=function(_0x8b8517,_0x15ec1e){return db[_0x6fe6('0x42')][_0x6fe6('0x4a')]({'where':{'id':_0x8b8517['params']['id']}})[_0x6fe6('0x25')](handleEntityNotFound(_0x15ec1e,null))['then'](removeEntity(_0x15ec1e,null))[_0x6fe6('0x4b')](handleError(_0x15ec1e,null));}; \ No newline at end of file +var _0xca80=['Content-Range','reject','then','Pauses','UserProfileResource','end','error','name','send','index','map','Pause','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set'];(function(_0x3460e3,_0x23d874){var _0x22a450=function(_0x2c1038){while(--_0x2c1038){_0x3460e3['push'](_0x3460e3['shift']());}};_0x22a450(++_0x23d874);}(_0xca80,0xd4));var _0x0ca8=function(_0x31dc7e,_0x2dd309){_0x31dc7e=_0x31dc7e-0x0;var _0x172eac=_0xca80[_0x31dc7e];return _0x172eac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ca8('0x0'));var zipdir=require(_0x0ca8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ca8('0x2'));var moment=require(_0x0ca8('0x3'));var BPromise=require(_0x0ca8('0x4'));var Mustache=require(_0x0ca8('0x5'));var util=require(_0x0ca8('0x6'));var path=require(_0x0ca8('0x7'));var sox=require(_0x0ca8('0x8'));var csv=require(_0x0ca8('0x9'));var ejs=require(_0x0ca8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ca8('0xb'));var squel=require(_0x0ca8('0xc'));var crypto=require('crypto');var jsforce=require(_0x0ca8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0ca8('0x9'));var querystring=require('querystring');var Papa=require(_0x0ca8('0xe'));var Redis=require('ioredis');var authService=require(_0x0ca8('0xf'));var qs=require(_0x0ca8('0x10'));var as=require(_0x0ca8('0x11'));var hardwareService=require(_0x0ca8('0x12'));var logger=require(_0x0ca8('0x13'))('api');var utils=require(_0x0ca8('0x14'));var config=require(_0x0ca8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ca8('0x16'))['db'];function respondWithStatusCode(_0x3be8b8,_0x4df7bd){_0x4df7bd=_0x4df7bd||0xcc;return function(_0xbb52e5){if(_0xbb52e5){return _0x3be8b8[_0x0ca8('0x17')](_0x4df7bd);}return _0x3be8b8[_0x0ca8('0x18')](_0x4df7bd)['end']();};}function respondWithResult(_0x1900d0,_0x273c2c){_0x273c2c=_0x273c2c||0xc8;return function(_0x24d3f8){if(_0x24d3f8){return _0x1900d0['status'](_0x273c2c)[_0x0ca8('0x19')](_0x24d3f8);}};}function respondWithFilteredResult(_0x431637,_0x15af92){return function(_0x3340a6){if(_0x3340a6){var _0x280bdb=typeof _0x15af92[_0x0ca8('0x1a')]===_0x0ca8('0x1b')&&typeof _0x15af92['limit']===_0x0ca8('0x1b');var _0x453e7d=_0x3340a6['count'];var _0x282289=_0x280bdb?0x0:_0x15af92[_0x0ca8('0x1a')];var _0x34ed9d=_0x280bdb?_0x3340a6[_0x0ca8('0x1c')]:_0x15af92[_0x0ca8('0x1a')]+_0x15af92[_0x0ca8('0x1d')];var _0x76fff0;if(_0x34ed9d>=_0x453e7d){_0x34ed9d=_0x453e7d;_0x76fff0=0xc8;}else{_0x76fff0=0xce;}_0x431637[_0x0ca8('0x18')](_0x76fff0);return _0x431637[_0x0ca8('0x1e')](_0x0ca8('0x1f'),_0x282289+'-'+_0x34ed9d+'/'+_0x453e7d)['json'](_0x3340a6);}return null;};}function patchUpdates(_0x464720){return function(_0x4fa865){try{jsonpatch['apply'](_0x4fa865,_0x464720,!![]);}catch(_0x19cfa1){return BPromise[_0x0ca8('0x20')](_0x19cfa1);}return _0x4fa865['save']();};}function saveUpdates(_0x33e277,_0x28538c){return function(_0x580185){if(_0x580185){return _0x580185['update'](_0x33e277)[_0x0ca8('0x21')](function(_0xb8ab12){return _0xb8ab12;});}return null;};}function removeEntity(_0x4e03e0,_0x386665){return function(_0xe83d27){if(_0xe83d27){return _0xe83d27['destroy']()[_0x0ca8('0x21')](function(){var _0x27bb59=_0xe83d27['get']({'plain':!![]});var _0x4ce842=_0x0ca8('0x22');return db[_0x0ca8('0x23')]['destroy']({'where':{'type':_0x4ce842,'resourceId':_0x27bb59['id']}})['then'](function(){return _0xe83d27;});})[_0x0ca8('0x21')](function(){_0x4e03e0[_0x0ca8('0x18')](0xcc)[_0x0ca8('0x24')]();});}};}function handleEntityNotFound(_0x14893a,_0x20b8be){return function(_0x4c0516){if(!_0x4c0516){_0x14893a[_0x0ca8('0x17')](0x194);}return _0x4c0516;};}function handleError(_0x328d3f,_0x37fd17){_0x37fd17=_0x37fd17||0x1f4;return function(_0x5d80db){logger[_0x0ca8('0x25')](_0x5d80db['stack']);if(_0x5d80db[_0x0ca8('0x26')]){delete _0x5d80db[_0x0ca8('0x26')];}_0x328d3f[_0x0ca8('0x18')](_0x37fd17)[_0x0ca8('0x27')](_0x5d80db);};}exports[_0x0ca8('0x28')]=function(_0x4b54b0,_0x5ca807){var _0x3909d7={},_0x6e3316={},_0x4c8fc3={'count':0x0,'rows':[]};var _0x6f049a=_[_0x0ca8('0x29')](db[_0x0ca8('0x2a')]['rawAttributes'],function(_0x2a7c4c){return{'name':_0x2a7c4c[_0x0ca8('0x2b')],'type':_0x2a7c4c['type'][_0x0ca8('0x2c')]};});_0x6e3316['model']=_['map'](_0x6f049a,_0x0ca8('0x26'));_0x6e3316[_0x0ca8('0x2d')]=_[_0x0ca8('0x2e')](_0x4b54b0['query']);_0x6e3316['filters']=_[_0x0ca8('0x2f')](_0x6e3316[_0x0ca8('0x30')],_0x6e3316[_0x0ca8('0x2d')]);_0x3909d7[_0x0ca8('0x31')]=_[_0x0ca8('0x2f')](_0x6e3316['model'],qs[_0x0ca8('0x32')](_0x4b54b0[_0x0ca8('0x2d')][_0x0ca8('0x32')]));_0x3909d7[_0x0ca8('0x31')]=_0x3909d7[_0x0ca8('0x31')][_0x0ca8('0x33')]?_0x3909d7[_0x0ca8('0x31')]:_0x6e3316[_0x0ca8('0x30')];if(!_0x4b54b0[_0x0ca8('0x2d')][_0x0ca8('0x34')]('nolimit')){_0x3909d7[_0x0ca8('0x1d')]=qs[_0x0ca8('0x1d')](_0x4b54b0[_0x0ca8('0x2d')][_0x0ca8('0x1d')]);_0x3909d7['offset']=qs[_0x0ca8('0x1a')](_0x4b54b0[_0x0ca8('0x2d')][_0x0ca8('0x1a')]);}_0x3909d7[_0x0ca8('0x35')]=qs['sort'](_0x4b54b0[_0x0ca8('0x2d')][_0x0ca8('0x36')]);_0x3909d7[_0x0ca8('0x37')]=qs[_0x0ca8('0x38')](_['pick'](_0x4b54b0[_0x0ca8('0x2d')],_0x6e3316[_0x0ca8('0x38')]),_0x6f049a);if(_0x4b54b0[_0x0ca8('0x2d')][_0x0ca8('0x39')]){_0x3909d7['where']=_[_0x0ca8('0x3a')](_0x3909d7[_0x0ca8('0x37')],{'$or':_[_0x0ca8('0x29')](_0x6f049a,function(_0x28014c){if(_0x28014c['type']!==_0x0ca8('0x3b')){var _0x10a279={};_0x10a279[_0x28014c[_0x0ca8('0x26')]]={'$like':'%'+_0x4b54b0[_0x0ca8('0x2d')][_0x0ca8('0x39')]+'%'};return _0x10a279;}})});}_0x3909d7=_[_0x0ca8('0x3a')]({},_0x3909d7,_0x4b54b0[_0x0ca8('0x3c')]);var _0x4515b5={'where':_0x3909d7[_0x0ca8('0x37')]};return db['Pause'][_0x0ca8('0x1c')](_0x4515b5)[_0x0ca8('0x21')](function(_0x7bda77){_0x4c8fc3[_0x0ca8('0x1c')]=_0x7bda77;if(_0x4b54b0[_0x0ca8('0x2d')][_0x0ca8('0x3d')]){_0x3909d7[_0x0ca8('0x3e')]=[{'all':!![]}];}return db[_0x0ca8('0x2a')][_0x0ca8('0x3f')](_0x3909d7);})['then'](function(_0x2fdd73){_0x4c8fc3[_0x0ca8('0x40')]=_0x2fdd73;return _0x4c8fc3;})[_0x0ca8('0x21')](respondWithFilteredResult(_0x5ca807,_0x3909d7))[_0x0ca8('0x41')](handleError(_0x5ca807,null));};exports[_0x0ca8('0x42')]=function(_0x18991a,_0xadddda){var _0x10a9ee={'raw':!![],'where':{'id':_0x18991a[_0x0ca8('0x43')]['id']}},_0x1efa29={};_0x1efa29[_0x0ca8('0x30')]=_[_0x0ca8('0x2e')](db[_0x0ca8('0x2a')][_0x0ca8('0x44')]);_0x1efa29[_0x0ca8('0x2d')]=_[_0x0ca8('0x2e')](_0x18991a[_0x0ca8('0x2d')]);_0x1efa29[_0x0ca8('0x38')]=_[_0x0ca8('0x2f')](_0x1efa29[_0x0ca8('0x30')],_0x1efa29[_0x0ca8('0x2d')]);_0x10a9ee[_0x0ca8('0x31')]=_[_0x0ca8('0x2f')](_0x1efa29[_0x0ca8('0x30')],qs[_0x0ca8('0x32')](_0x18991a[_0x0ca8('0x2d')][_0x0ca8('0x32')]));_0x10a9ee['attributes']=_0x10a9ee[_0x0ca8('0x31')][_0x0ca8('0x33')]?_0x10a9ee[_0x0ca8('0x31')]:_0x1efa29[_0x0ca8('0x30')];if(_0x18991a[_0x0ca8('0x2d')][_0x0ca8('0x3d')]){_0x10a9ee['include']=[{'all':!![]}];}_0x10a9ee=_[_0x0ca8('0x3a')]({},_0x10a9ee,_0x18991a[_0x0ca8('0x3c')]);return db[_0x0ca8('0x2a')][_0x0ca8('0x45')](_0x10a9ee)[_0x0ca8('0x21')](handleEntityNotFound(_0xadddda,null))[_0x0ca8('0x21')](respondWithResult(_0xadddda,null))[_0x0ca8('0x41')](handleError(_0xadddda,null));};exports[_0x0ca8('0x46')]=function(_0x151442,_0x3c61b7){return db[_0x0ca8('0x2a')][_0x0ca8('0x46')](_0x151442[_0x0ca8('0x47')],{})[_0x0ca8('0x21')](function(_0x418737){var _0x13c841=_0x151442[_0x0ca8('0x48')][_0x0ca8('0x49')]({'plain':!![]});if(!_0x13c841)throw new Error(_0x0ca8('0x4a'));if(_0x13c841[_0x0ca8('0x4b')]===_0x0ca8('0x48')){var _0x541e77=_0x418737[_0x0ca8('0x49')]({'plain':!![]});var _0x444000=_0x0ca8('0x22');return db[_0x0ca8('0x4c')][_0x0ca8('0x45')]({'where':{'name':_0x444000,'userProfileId':_0x13c841[_0x0ca8('0x4d')]},'raw':!![]})[_0x0ca8('0x21')](function(_0x47b160){if(_0x47b160&&_0x47b160[_0x0ca8('0x4e')]===0x0){return db[_0x0ca8('0x23')][_0x0ca8('0x46')]({'name':_0x541e77[_0x0ca8('0x26')],'resourceId':_0x541e77['id'],'type':_0x47b160[_0x0ca8('0x26')],'sectionId':_0x47b160['id']},{})[_0x0ca8('0x21')](function(){return _0x418737;});}else{return _0x418737;}})[_0x0ca8('0x41')](function(_0x3ce032){logger[_0x0ca8('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ce032);throw _0x3ce032;});}return _0x418737;})[_0x0ca8('0x21')](respondWithResult(_0x3c61b7,0xc9))[_0x0ca8('0x41')](handleError(_0x3c61b7,null));};exports[_0x0ca8('0x4f')]=function(_0x3c258,_0xf00bd3){if(_0x3c258[_0x0ca8('0x47')]['id']){delete _0x3c258[_0x0ca8('0x47')]['id'];}return db[_0x0ca8('0x2a')][_0x0ca8('0x45')]({'where':{'id':_0x3c258['params']['id']}})['then'](handleEntityNotFound(_0xf00bd3,null))[_0x0ca8('0x21')](saveUpdates(_0x3c258[_0x0ca8('0x47')],null))[_0x0ca8('0x21')](respondWithResult(_0xf00bd3,null))[_0x0ca8('0x41')](handleError(_0xf00bd3,null));};exports[_0x0ca8('0x50')]=function(_0x5bb833,_0x2cce94){return db['Pause'][_0x0ca8('0x45')]({'where':{'id':_0x5bb833[_0x0ca8('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cce94,null))[_0x0ca8('0x21')](removeEntity(_0x2cce94,null))['catch'](handleError(_0x2cce94,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f8ae4c5..6b6430e 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x143fca,_0x3e18ac){var _0x5726b5=function(_0x4a778b){while(--_0x4a778b){_0x143fca['push'](_0x143fca['shift']());}};_0x5726b5(++_0x3e18ac);}(_0x8ef6,0xf2));var _0x68ef=function(_0xe08a08,_0x1d190a){_0xe08a08=_0xe08a08-0x0;var _0x1b542f=_0x8ef6[_0xe08a08];return _0x1b542f;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'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 1e758e7..b1f57eb 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 _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(_0x5e926f,_0x42cbea){var _0x66e0f0=function(_0x22e55a){while(--_0x22e55a){_0x5e926f['push'](_0x5e926f['shift']());}};_0x66e0f0(++_0x42cbea);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e76e8,_0x41ec55){_0x1e76e8=_0x1e76e8-0x0;var _0x2d7a1f=_0xb10b[_0x1e76e8];return _0x2d7a1f;};'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 +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(_0x4760ea,_0x2545bf){var _0x251807=function(_0x143db4){while(--_0x143db4){_0x4760ea['push'](_0x4760ea['shift']());}};_0x251807(++_0x2545bf);}(_0x7a54,0x106));var _0x47a5=function(_0x12f358,_0x394841){_0x12f358=_0x12f358-0x0;var _0x18cf1c=_0x7a54[_0x12f358];return _0x18cf1c;};'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 diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index efa9e2b..92144e5 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 _0x68fc=['webhookPost','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','upload','/webhook'];(function(_0x4f587a,_0x320518){var _0x3eb07e=function(_0x4a04a5){while(--_0x4a04a5){_0x4f587a['push'](_0x4f587a['shift']());}};_0x3eb07e(++_0x320518);}(_0x68fc,0xa5));var _0xc68f=function(_0x8cd9c0,_0x4f16f7){_0x8cd9c0=_0x8cd9c0-0x0;var _0x4bd422=_0x68fc[_0x8cd9c0];return _0x4bd422;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc68f('0x5'));router[_0xc68f('0x6')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0x8')]);router['get']('/webhook',controller[_0xc68f('0x9')]);router[_0xc68f('0x6')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xb')]);router[_0xc68f('0x6')](_0xc68f('0xc'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xd')]);var upload=multer({'storage':multer[_0xc68f('0xe')]({'destination':function(_0x5777f9,_0x3b1a43,_0x29f1fe){_0x29f1fe(null,path[_0xc68f('0xf')](config[_0xc68f('0x10')],_0xc68f('0x11')));},'filename':function(_0x2a0a52,_0x3ccebe,_0x41aeb8){_0x3ccebe[_0xc68f('0x12')]=_0x3ccebe[_0xc68f('0x12')][_0xc68f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41aeb8(null,util['format'](_0xc68f('0x14'),path[_0xc68f('0x15')](_0x3ccebe[_0xc68f('0x12')],path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])),Date[_0xc68f('0x17')](),path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])));}})});router[_0xc68f('0x18')]('/',upload['single']('file'),controller[_0xc68f('0x19')]);router[_0xc68f('0x18')](_0xc68f('0x1a'),controller[_0xc68f('0x1b')]);router[_0xc68f('0x1c')](_0xc68f('0xa'),auth['isAuthenticated'](),controller[_0xc68f('0x1d')]);router[_0xc68f('0x1e')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0x1e')]);module[_0xc68f('0x1f')]=router; \ No newline at end of file +var _0xb332=['server/files/plugins','originalname','replace','format','basename','extname','now','post','single','file','upload','/:id','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','root'];(function(_0x25b483,_0x2e5db2){var _0x534772=function(_0x4c40c3){while(--_0x4c40c3){_0x25b483['push'](_0x25b483['shift']());}};_0x534772(++_0x2e5db2);}(_0xb332,0xd9));var _0x2b33=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0xb332[_0xaf25ae];return _0x49732d;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./plugin.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/webhook',controller['webhookGet']);router[_0x2b33('0x6')]('/:id',auth[_0x2b33('0x7')](),controller[_0x2b33('0x9')]);router[_0x2b33('0x6')](_0x2b33('0xa'),auth['isAuthenticated'](),controller[_0x2b33('0xb')]);var upload=multer({'storage':multer[_0x2b33('0xc')]({'destination':function(_0x1be19d,_0x1d83a6,_0x1989f3){_0x1989f3(null,path[_0x2b33('0xd')](config[_0x2b33('0xe')],_0x2b33('0xf')));},'filename':function(_0x1e0d36,_0x3969cb,_0xca2248){_0x3969cb['originalname']=_0x3969cb[_0x2b33('0x10')][_0x2b33('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xca2248(null,util[_0x2b33('0x12')]('%s-%s%s',path[_0x2b33('0x13')](_0x3969cb['originalname'],path[_0x2b33('0x14')](_0x3969cb[_0x2b33('0x10')])),Date[_0x2b33('0x15')](),path['extname'](_0x3969cb['originalname'])));}})});router[_0x2b33('0x16')]('/',upload[_0x2b33('0x17')](_0x2b33('0x18')),controller[_0x2b33('0x19')]);router[_0x2b33('0x16')]('/webhook',controller['webhookPost']);router['put'](_0x2b33('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0x2b33('0x1b')](_0x2b33('0x1a'),auth[_0x2b33('0x7')](),controller['delete']);module[_0x2b33('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 2bf0d79..27f35d7 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 _0x7407=['agentOnly','always','never','sequelize','exports','STRING','html','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly'];(function(_0x5cd863,_0x969d4c){var _0x4865dd=function(_0x19e2d3){while(--_0x19e2d3){_0x5cd863['push'](_0x5cd863['shift']());}};_0x4865dd(++_0x969d4c);}(_0x7407,0xff));var _0x7740=function(_0x499896,_0x589b7d){_0x499896=_0x499896-0x0;var _0x4de6f4=_0x7407[_0x499896];return _0x4de6f4;};'use strict';var Sequelize=require(_0x7740('0x0'));module[_0x7740('0x1')]={'name':{'type':Sequelize[_0x7740('0x2')]},'type':{'type':Sequelize['ENUM'](_0x7740('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x7740('0x4')]},'path':{'type':Sequelize[_0x7740('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x7740('0x5')],'defaultValue':0x0,'comment':_0x7740('0x6')},'sidebar':{'type':Sequelize[_0x7740('0x7')](_0x7740('0x8'),_0x7740('0x9'),_0x7740('0xa'),_0x7740('0xb')),'defaultValue':_0x7740('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x7740('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x7740('0x2')]},'scriptPath':{'type':Sequelize[_0x7740('0x2')]}}; \ No newline at end of file +var _0x7826=['sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x57768a,_0x184569){var _0xd5145a=function(_0xedcf19){while(--_0xedcf19){_0x57768a['push'](_0x57768a['shift']());}};_0xd5145a(++_0x184569);}(_0x7826,0x126));var _0x6782=function(_0xb29bef,_0x45aff1){_0xb29bef=_0xb29bef-0x0;var _0x878163=_0x7826[_0xb29bef];return _0x878163;};'use strict';var Sequelize=require(_0x6782('0x0'));module['exports']={'name':{'type':Sequelize[_0x6782('0x1')]},'type':{'type':Sequelize[_0x6782('0x2')](_0x6782('0x3'),_0x6782('0x4'))},'description':{'type':Sequelize[_0x6782('0x5')]},'version':{'type':Sequelize[_0x6782('0x5')]},'path':{'type':Sequelize[_0x6782('0x1')],'comment':_0x6782('0x6')},'active':{'type':Sequelize[_0x6782('0x7')],'defaultValue':0x0,'comment':_0x6782('0x8')},'sidebar':{'type':Sequelize[_0x6782('0x2')](_0x6782('0x9'),_0x6782('0xa'),_0x6782('0xb'),_0x6782('0xc')),'defaultValue':_0x6782('0xb'),'comment':_0x6782('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x6782('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x6782('0x1')]},'scriptPath':{'type':Sequelize[_0x6782('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index dc3871c..0360a55 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 _0x9954=['\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','port','%s%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','find','download','root','server/files/plugins','format','basename','createWriteStream','warning','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','join','node_modules/**/*','attachments/**/*','finalize','existsSync','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','create','body','role','user','get','Plugins','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified'];(function(_0x2fa30f,_0x1925fd){var _0x103b05=function(_0x48c702){while(--_0x48c702){_0x2fa30f['push'](_0x2fa30f['shift']());}};_0x103b05(++_0x1925fd);}(_0x9954,0x151));var _0x4995=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x9954[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require(_0x4995('0x0'));var rimraf=require(_0x4995('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4995('0x2'));var moment=require(_0x4995('0x3'));var BPromise=require(_0x4995('0x4'));var Mustache=require(_0x4995('0x5'));var util=require('util');var path=require(_0x4995('0x6'));var sox=require(_0x4995('0x7'));var csv=require('to-csv');var ejs=require(_0x4995('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4995('0x9'));var squel=require(_0x4995('0xa'));var crypto=require(_0x4995('0xb'));var jsforce=require(_0x4995('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4995('0xd'));var querystring=require(_0x4995('0xe'));var Papa=require('papaparse');var extract=require(_0x4995('0xf'));var rimraf=require('rimraf');var archiver=require(_0x4995('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4995('0x11'));var as=require(_0x4995('0x12'));var hardwareService=require(_0x4995('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4995('0x14'));var config=require(_0x4995('0x15'));var licenseUtil=require(_0x4995('0x16'));var db=require(_0x4995('0x17'))['db'];config[_0x4995('0x18')]=_[_0x4995('0x19')](config[_0x4995('0x18')],{'host':_0x4995('0x1a'),'port':0x18eb});var socket=require(_0x4995('0x1b'))(new Redis(config[_0x4995('0x18')]));require('./plugin.socket')[_0x4995('0x1c')](socket);function respondWithStatusCode(_0x33be22,_0xd53045){_0xd53045=_0xd53045||0xcc;return function(_0x3fe607){if(_0x3fe607){return _0x33be22['sendStatus'](_0xd53045);}return _0x33be22[_0x4995('0x1d')](_0xd53045)[_0x4995('0x1e')]();};}function respondWithResult(_0x484d6a,_0x5bb2fd){_0x5bb2fd=_0x5bb2fd||0xc8;return function(_0x4b33b1){if(_0x4b33b1){return _0x484d6a[_0x4995('0x1d')](_0x5bb2fd)['json'](_0x4b33b1);}};}function respondWithFilteredResult(_0x5e2347,_0x45f767){return function(_0x43ea17){if(_0x43ea17){var _0x365922=typeof _0x45f767['offset']==='undefined'&&typeof _0x45f767[_0x4995('0x1f')]===_0x4995('0x20');var _0x341960=_0x43ea17['count'];var _0x2f8b0e=_0x365922?0x0:_0x45f767['offset'];var _0x2cfb55=_0x365922?_0x43ea17[_0x4995('0x21')]:_0x45f767[_0x4995('0x22')]+_0x45f767[_0x4995('0x1f')];var _0x2512cf;if(_0x2cfb55>=_0x341960){_0x2cfb55=_0x341960;_0x2512cf=0xc8;}else{_0x2512cf=0xce;}_0x5e2347[_0x4995('0x1d')](_0x2512cf);return _0x5e2347[_0x4995('0x23')](_0x4995('0x24'),_0x2f8b0e+'-'+_0x2cfb55+'/'+_0x341960)[_0x4995('0x25')](_0x43ea17);}return null;};}function patchUpdates(_0x513f01){return function(_0x14994c){try{jsonpatch[_0x4995('0x26')](_0x14994c,_0x513f01,!![]);}catch(_0x58733f){return BPromise[_0x4995('0x27')](_0x58733f);}return _0x14994c[_0x4995('0x28')]();};}function saveUpdates(_0xba61c4,_0x5474b4){return function(_0x588e2e){if(_0x588e2e){return _0x588e2e[_0x4995('0x29')](_0xba61c4)[_0x4995('0x2a')](function(_0x3e25d0){return _0x3e25d0;});}return null;};}function removeEntity(_0xf274bc,_0x38c74d){return function(_0x1ffc98){if(_0x1ffc98){return _0x1ffc98[_0x4995('0x2b')]()[_0x4995('0x2a')](function(){var _0x16eafe=_0x1ffc98['get']({'plain':!![]});var _0x5b86d2='Plugins';return db[_0x4995('0x2c')][_0x4995('0x2b')]({'where':{'type':_0x5b86d2,'resourceId':_0x16eafe['id']}})['then'](function(){return _0x1ffc98;});})[_0x4995('0x2a')](function(){_0xf274bc[_0x4995('0x1d')](0xcc)[_0x4995('0x1e')]();});}};}function handleEntityNotFound(_0x30b9f7,_0x5a1741){return function(_0x219190){if(!_0x219190){_0x30b9f7[_0x4995('0x2d')](0x194);}return _0x219190;};}function handleError(_0x2b3d0e,_0x301b6a){_0x301b6a=_0x301b6a||0x1f4;return function(_0x4e2609){logger['error'](_0x4e2609[_0x4995('0x2e')]);if(_0x4e2609['name']){delete _0x4e2609[_0x4995('0x2f')];}_0x2b3d0e[_0x4995('0x1d')](_0x301b6a)[_0x4995('0x30')](_0x4e2609);};}exports[_0x4995('0x31')]=function(_0x52ec45,_0x3c77c4){var _0x4e8109={},_0x1856f2={},_0x101133={'count':0x0,'rows':[]};var _0x558d4d=_[_0x4995('0x32')](db[_0x4995('0x33')][_0x4995('0x34')],function(_0x4c671e){return{'name':_0x4c671e[_0x4995('0x35')],'type':_0x4c671e[_0x4995('0x36')]['key']};});_0x1856f2[_0x4995('0x37')]=_['map'](_0x558d4d,_0x4995('0x2f'));_0x1856f2[_0x4995('0x38')]=_[_0x4995('0x39')](_0x52ec45[_0x4995('0x38')]);_0x1856f2[_0x4995('0x3a')]=_[_0x4995('0x3b')](_0x1856f2[_0x4995('0x37')],_0x1856f2[_0x4995('0x38')]);_0x4e8109[_0x4995('0x3c')]=_[_0x4995('0x3b')](_0x1856f2['model'],qs[_0x4995('0x3d')](_0x52ec45[_0x4995('0x38')]['fields']));_0x4e8109[_0x4995('0x3c')]=_0x4e8109[_0x4995('0x3c')][_0x4995('0x3e')]?_0x4e8109[_0x4995('0x3c')]:_0x1856f2[_0x4995('0x37')];if(!_0x52ec45[_0x4995('0x38')][_0x4995('0x3f')](_0x4995('0x40'))){_0x4e8109['limit']=qs[_0x4995('0x1f')](_0x52ec45[_0x4995('0x38')][_0x4995('0x1f')]);_0x4e8109['offset']=qs['offset'](_0x52ec45[_0x4995('0x38')][_0x4995('0x22')]);}_0x4e8109[_0x4995('0x41')]=qs[_0x4995('0x42')](_0x52ec45[_0x4995('0x38')]['sort']);_0x4e8109[_0x4995('0x43')]=qs[_0x4995('0x3a')](_[_0x4995('0x44')](_0x52ec45[_0x4995('0x38')],_0x1856f2[_0x4995('0x3a')]),_0x558d4d);if(_0x52ec45[_0x4995('0x38')][_0x4995('0x45')]){_0x4e8109[_0x4995('0x43')]=_[_0x4995('0x46')](_0x4e8109['where'],{'$or':_[_0x4995('0x32')](_0x558d4d,function(_0xc17f65){if(_0xc17f65[_0x4995('0x36')]!==_0x4995('0x47')){var _0x52cf89={};_0x52cf89[_0xc17f65[_0x4995('0x2f')]]={'$like':'%'+_0x52ec45['query']['filter']+'%'};return _0x52cf89;}})});}_0x4e8109=_[_0x4995('0x46')]({},_0x4e8109,_0x52ec45['options']);var _0x2ef7ad={'where':_0x4e8109[_0x4995('0x43')]};return db[_0x4995('0x33')]['count'](_0x2ef7ad)[_0x4995('0x2a')](function(_0xc00ed3){_0x101133[_0x4995('0x21')]=_0xc00ed3;if(_0x52ec45[_0x4995('0x38')]['includeAll']){_0x4e8109[_0x4995('0x48')]=[{'all':!![]}];}return db[_0x4995('0x33')][_0x4995('0x49')](_0x4e8109);})[_0x4995('0x2a')](function(_0x43ca29){_0x101133[_0x4995('0x4a')]=_0x43ca29;return _0x101133;})[_0x4995('0x2a')](respondWithFilteredResult(_0x3c77c4,_0x4e8109))[_0x4995('0x4b')](handleError(_0x3c77c4,null));};exports[_0x4995('0x4c')]=function(_0x29e376,_0xcb59ee){var _0x4ad582={'raw':!![],'where':{'id':_0x29e376[_0x4995('0x4d')]['id']}},_0x4512dd={};_0x4512dd[_0x4995('0x37')]=_[_0x4995('0x39')](db[_0x4995('0x33')]['rawAttributes']);_0x4512dd[_0x4995('0x38')]=_[_0x4995('0x39')](_0x29e376[_0x4995('0x38')]);_0x4512dd[_0x4995('0x3a')]=_['intersection'](_0x4512dd[_0x4995('0x37')],_0x4512dd['query']);_0x4ad582[_0x4995('0x3c')]=_[_0x4995('0x3b')](_0x4512dd[_0x4995('0x37')],qs[_0x4995('0x3d')](_0x29e376[_0x4995('0x38')][_0x4995('0x3d')]));_0x4ad582[_0x4995('0x3c')]=_0x4ad582['attributes']['length']?_0x4ad582[_0x4995('0x3c')]:_0x4512dd[_0x4995('0x37')];if(_0x29e376[_0x4995('0x38')][_0x4995('0x4e')]){_0x4ad582[_0x4995('0x48')]=[{'all':!![]}];}_0x4ad582=_['merge']({},_0x4ad582,_0x29e376['options']);return db[_0x4995('0x33')][_0x4995('0x4f')](_0x4ad582)[_0x4995('0x2a')](handleEntityNotFound(_0xcb59ee,null))[_0x4995('0x2a')](respondWithResult(_0xcb59ee,null))[_0x4995('0x4b')](handleError(_0xcb59ee,null));};exports[_0x4995('0x50')]=function(_0x3744fe,_0x1e7aae,_0x1e7084){return db[_0x4995('0x33')][_0x4995('0x4f')]({'where':{'id':_0x3744fe[_0x4995('0x4d')]['id']},'attributes':[_0x4995('0x2f'),_0x4995('0x6')],'raw':!![]})[_0x4995('0x2a')](handleEntityNotFound(_0x1e7aae,null))[_0x4995('0x2a')](function(_0x2e9d2d){if(_0x2e9d2d){var _0x5aade9=path['join'](config[_0x4995('0x51')],_0x4995('0x52'),util[_0x4995('0x53')]('%s.zip',path[_0x4995('0x54')](_0x2e9d2d[_0x4995('0x6')])));var _0x9e8e4d=fs[_0x4995('0x55')](_0x5aade9);var _0x2d9b44=archiver('zip',{'zlib':{'level':0x9}});_0x2d9b44['on'](_0x4995('0x56'),function(_0x3777e2){if(_0x3777e2['code']===_0x4995('0x57')){logger[_0x4995('0x58')](_0x3777e2);}else{throw new db[(_0x4995('0x59'))][(_0x4995('0x5a'))](_0x4995('0x5b'));}});_0x2d9b44['on']('error',function(_0x136208){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2d9b44[_0x4995('0x5c')](_0x9e8e4d);_0x2d9b44['glob']('**/*',{'cwd':path[_0x4995('0x5d')](config[_0x4995('0x51')],_0x4995('0x52'),path['dirname'](_0x2e9d2d[_0x4995('0x6')])),'ignore':[path['join'](path['basename'](_0x2e9d2d[_0x4995('0x6')]),_0x4995('0x5e')),path[_0x4995('0x5d')](path[_0x4995('0x54')](_0x2e9d2d['path']),_0x4995('0x5f'))],'nodir':!![]})[_0x4995('0x60')]();_0x9e8e4d['on']('close',function(){if(!fs[_0x4995('0x61')](_0x5aade9)){throw new db['Sequelize']['Error']('Plugin\x20not\x20found');}return _0x1e7aae[_0x4995('0x50')](_0x5aade9,util[_0x4995('0x53')](_0x4995('0x62'),path[_0x4995('0x54')](_0x2e9d2d['path'])),function(_0x38dddd){if(_0x38dddd){throw new db[(_0x4995('0x59'))][(_0x4995('0x5a'))](_0x4995('0x63'));}fs['unlinkSync'](_0x5aade9);logger['info']('Download\x20completed');logger[_0x4995('0x64')](_0x4995('0x65'));});});}return null;})[_0x4995('0x4b')](handleError(_0x1e7aae,null));};exports[_0x4995('0x66')]=function(_0x62d9c4,_0x472380,_0x3b5058){var _0x136246=path[_0x4995('0x54')](_0x62d9c4[_0x4995('0x67')]['filename'],path[_0x4995('0x68')](_0x62d9c4[_0x4995('0x67')][_0x4995('0x69')]));var _0x3317d2=path[_0x4995('0x5d')](config[_0x4995('0x51')],'server/files/plugins',_0x62d9c4[_0x4995('0x67')][_0x4995('0x69')]);var _0x5b4597=path[_0x4995('0x5d')](config[_0x4995('0x51')],_0x4995('0x52'),_0x136246);logger[_0x4995('0x64')](_0x4995('0x6a'),_0x3317d2);logger[_0x4995('0x64')](_0x4995('0x6b'),_0x5b4597);try{fs['chmodSync'](_0x3317d2,parseInt(_0x4995('0x6c'),0x8));extract(_0x3317d2,{'dir':_0x5b4597},function(_0x2cb1bb){if(_0x2cb1bb){logger[_0x4995('0x58')](_0x2cb1bb);handleError(_0x2cb1bb,!![]);};var _0x47f7bd=fs['readdirSync'](_0x5b4597);if(_0x47f7bd['length']>0x1){removeReferences(_0x3317d2,_0x5b4597);logger[_0x4995('0x58')](_0x4995('0x6d'));return _0x3b5058(new Error('Invalid\x20plugin\x20structure'));}var _0x1ff9c4=fs[_0x4995('0x6e')](path['join'](_0x5b4597,_0x47f7bd[0x0]));if(_0x1ff9c4[_0x4995('0x6f')]()){removeReferences(_0x3317d2,_0x5b4597);logger[_0x4995('0x58')](_0x4995('0x6d'));return _0x3b5058(new Error(_0x4995('0x6d')));}if(_0x1ff9c4[_0x4995('0x70')]()){var _0x42f81e=fs['readdirSync'](path['join'](_0x5b4597,_0x47f7bd[0x0]));if(_0x42f81e[_0x4995('0x3e')]===0x0){removeReferences(_0x3317d2,_0x5b4597);logger['error'](_0x4995('0x6d'));return _0x3b5058(new Error(_0x4995('0x6d')));}var _0x50fabf=_0x42f81e['some'](function(_0x1bb76a){return _0x1bb76a===_0x4995('0x71');});if(!_0x50fabf){return _0x3b5058(new Error(_0x4995('0x72')));}var _0x41e777=fs[_0x4995('0x73')](path[_0x4995('0x5d')](_0x5b4597,_0x47f7bd[0x0],'manifest.json'));var _0x44c263=JSON[_0x4995('0x74')](_0x41e777);if(_0x4995('0x20')==typeof _0x44c263[_0x4995('0x2f')]){return _0x3b5058(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x44c263[_0x4995('0x36')]){return _0x3b5058(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x4995('0x20')==typeof _0x44c263[_0x4995('0x75')]){return _0x3b5058(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x44c263[_0x4995('0x76')]){return _0x3b5058(new Error(_0x4995('0x77')));}if(_0x44c263['type']===_0x4995('0x78')){if(_0x4995('0x20')==typeof _0x44c263[_0x4995('0x76')][_0x4995('0x79')]){return _0x3b5058(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x44c263[_0x4995('0x76')][_0x4995('0x79')][_0x4995('0x7a')]&&'undefined'==typeof _0x44c263[_0x4995('0x76')][_0x4995('0x79')][_0x4995('0x7b')]){return _0x3b5058(new Error(_0x4995('0x7c')));}}else if(_0x44c263[_0x4995('0x36')]==='script'){if(_0x4995('0x20')==typeof _0x44c263[_0x4995('0x76')]['scriptName']){return _0x3b5058(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x4995('0x20')==typeof _0x44c263[_0x4995('0x76')][_0x4995('0x7d')]){return _0x3b5058(new Error(_0x4995('0x7e')));}}else{return _0x3b5058(new Error(_0x4995('0x7f')));}var _0x4b1105=_0x44c263['name'];var _0x4cd7ed=_0x44c263[_0x4995('0x80')];var _0x229ac7=_0x44c263[_0x4995('0x36')];var _0x16bd38=_0x44c263[_0x4995('0x81')]?_0x44c263[_0x4995('0x81')]:_0x4995('0x82');var _0x3ddf35=_0x44c263[_0x4995('0x83')]?_0x44c263['icon']:'icon-apps';var _0x3a7b41='';var _0x390c76='';var _0x52deac='';var _0x12b348='';var _0x414509=_0x44c263[_0x4995('0x75')];if(_0x229ac7===_0x4995('0x78')){if(_0x4995('0x20')!=typeof _0x44c263[_0x4995('0x76')][_0x4995('0x79')][_0x4995('0x7a')]){var _0x520305=_0x44c263[_0x4995('0x76')]['views'][_0x4995('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x4995('0x84')](_0x520305)){_0x3a7b41=path[_0x4995('0x5d')](_0x4995('0x85'),_0x136246,_0x47f7bd[0x0],_0x520305);}else{_0x3a7b41=_0x520305;}}else{logger[_0x4995('0x64')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x4995('0x20')!=typeof _0x44c263[_0x4995('0x76')][_0x4995('0x79')][_0x4995('0x7b')]){var _0x200d31=_0x44c263['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x4995('0x84')](_0x200d31)){_0x390c76=path[_0x4995('0x5d')](_0x4995('0x85'),_0x136246,_0x47f7bd[0x0],_0x200d31);}else{_0x390c76=_0x200d31;}}else{logger['info'](_0x4995('0x86'));}}else if(_0x229ac7===_0x4995('0x87')){_0x52deac=_0x44c263[_0x4995('0x76')][_0x4995('0x88')];_0x12b348=_0x44c263[_0x4995('0x76')]['scriptPath'];if(_0x4995('0x20')!=typeof _0x44c263[_0x4995('0x76')]['views']){if(_0x4995('0x20')!=typeof _0x44c263['parameters']['views']['admin']){var _0x520305=_0x44c263[_0x4995('0x76')][_0x4995('0x79')][_0x4995('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x4995('0x84')](_0x520305)){_0x3a7b41=path[_0x4995('0x5d')](_0x4995('0x85'),_0x136246,_0x47f7bd[0x0],_0x520305);}else{_0x3a7b41=_0x520305;}}if(_0x4995('0x20')!=typeof _0x44c263[_0x4995('0x76')]['views'][_0x4995('0x7b')]){var _0x200d31=_0x44c263[_0x4995('0x76')][_0x4995('0x79')][_0x4995('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x4995('0x84')](_0x200d31)){_0x390c76=path[_0x4995('0x5d')](_0x4995('0x85'),_0x136246,_0x47f7bd[0x0],_0x200d31);}else{_0x390c76=_0x200d31;}}}}var _0xca4584={'name':_0x4b1105,'description':_0x4cd7ed,'path':path[_0x4995('0x5d')](_0x136246,_0x47f7bd[0x0]),'type':_0x229ac7,'sidebar':_0x16bd38,'icon':_0x3ddf35,'adminUrl':_0x3a7b41,'agentUrl':_0x390c76,'scriptName':_0x52deac,'scriptPath':_0x12b348,'version':_0x414509};removeReferences(_0x3317d2,null);return db['Plugin'][_0x4995('0x89')](_0xca4584)[_0x4995('0x2a')](function(_0x1a451c){var _0xed99a9={'role':_0x62d9c4[_0x4995('0x8a')][_0x4995('0x8b')],'userProfileId':_0x62d9c4[_0x4995('0x8a')]['userProfileId']};if(!_0xed99a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xed99a9[_0x4995('0x8b')]===_0x4995('0x8c')){var _0x5ecf0b=_0x1a451c[_0x4995('0x8d')]({'plain':!![]});return db['UserProfileSection'][_0x4995('0x4f')]({'where':{'name':_0x4995('0x8e'),'userProfileId':_0xed99a9[_0x4995('0x8f')]},'raw':!![]})['then'](function(_0x3babf8){if(_0x3babf8&&_0x3babf8['autoAssociation']===0x0){return db[_0x4995('0x2c')][_0x4995('0x89')]({'name':_0x5ecf0b[_0x4995('0x2f')],'resourceId':_0x5ecf0b['id'],'type':_0x3babf8[_0x4995('0x2f')],'sectionId':_0x3babf8['id']},{})['then'](function(){return _0x1a451c;});}else{return _0x1a451c;}})[_0x4995('0x4b')](function(_0x35d76e){logger[_0x4995('0x58')](_0x4995('0x90'),_0x35d76e);throw _0x35d76e;});}return _0x1a451c;})[_0x4995('0x2a')](respondWithResult(_0x472380,null))[_0x4995('0x4b')](handleError(_0x472380,null));}});}catch(_0x1408f){_0x472380[_0x4995('0x1d')](0x1f4)[_0x4995('0x30')](_0x1408f);}};function removeReferences(_0x5edfdc,_0x10031a){try{if(_0x5edfdc){fs['unlinkSync'](_0x5edfdc);logger['info']('Zip\x20archive\x20removed');}if(_0x10031a){rimraf(_0x10031a,function(){});logger[_0x4995('0x64')](_0x4995('0x91'));}}catch(_0x372cc9){logger[_0x4995('0x58')](_0x372cc9);}}exports[_0x4995('0x29')]=function(_0x47029a,_0xeb05d0,_0x571b2d){return db[_0x4995('0x33')]['find']({'where':{'id':_0x47029a['params']['id']}})['then'](handleEntityNotFound(_0xeb05d0,null))[_0x4995('0x2a')](saveUpdates(_0x47029a[_0x4995('0x8a')],null))[_0x4995('0x2a')](respondWithResult(_0xeb05d0,null))[_0x4995('0x4b')](handleError(_0xeb05d0,null));};exports['delete']=function(_0x125cf5,_0x31a82b,_0x2220d9){return db['Plugin'][_0x4995('0x4f')]({'where':{'id':_0x125cf5[_0x4995('0x4d')]['id']}})['then'](function(_0x2ab1d0){if(_0x2ab1d0){return _0x2ab1d0[_0x4995('0x2b')]();}})[_0x4995('0x2a')](function(_0x349144){rimraf(path[_0x4995('0x5d')](config[_0x4995('0x51')],_0x4995('0x52'),path[_0x4995('0x92')](_0x349144['path'])),function(){});return _0x349144;})[_0x4995('0x2a')](handleEntityNotFound(_0x31a82b,null))['then'](respondWithStatusCode(_0x31a82b,null))[_0x4995('0x4b')](handleError(_0x31a82b,null));};exports['webhookGet']=function(_0x3a4b98,_0x1a1e8a,_0x5e94fa){return BPromise[_0x4995('0x93')]()[_0x4995('0x2a')](function(){if(!_0x3a4b98['query'][_0x4995('0x6')]){throw new Error(_0x4995('0x94'));}if(!_0x3a4b98['query']['port']){throw new Error(_0x4995('0x95'));}var _0x22e8c6=_0x3a4b98[_0x4995('0x38')][_0x4995('0x96')]?_0x3a4b98[_0x4995('0x38')][_0x4995('0x96')]+':'+_0x3a4b98['query']['port']:_0x4995('0x97')+_0x3a4b98[_0x4995('0x38')]['port'];var _0x344da0=_0x3a4b98['query'][_0x4995('0x25')]?_0x3a4b98[_0x4995('0x38')][_0x4995('0x25')]:!![];var _0x586428=_0x3a4b98[_0x4995('0x38')][_0x4995('0x98')]?_0x3a4b98['query'][_0x4995('0x98')]:null;var _0x48eff0={'method':_0x3a4b98[_0x4995('0x99')],'uri':util[_0x4995('0x53')]('%s%s',_0x22e8c6,_0x3a4b98[_0x4995('0x38')][_0x4995('0x6')]),'json':_0x344da0,'resolveWithFullResponse':!![],'encoding':_0x586428,'qs':_0x3a4b98[_0x4995('0x38')]};if(_0x3a4b98[_0x4995('0x9a')]){_0x48eff0['headers']=_0x3a4b98[_0x4995('0x9a')];if(_0x48eff0[_0x4995('0x9a')][_0x4995('0x9b')]){delete _0x48eff0['headers'][_0x4995('0x9b')];}}if(_0x48eff0[_0x4995('0x9a')][_0x4995('0x9c')]){delete _0x48eff0[_0x4995('0x9a')][_0x4995('0x9c')];}return rp(_0x48eff0);})[_0x4995('0x2a')](function(_0x3fcb2b){if(_0x3fcb2b){_0x1a1e8a[_0x4995('0x23')](_0x3fcb2b[_0x4995('0x9a')]);logger['info'](_0x3fcb2b['body']);if(_[_0x4995('0x9d')](_0x3a4b98[_0x4995('0x38')][_0x4995('0x6')],_0x4995('0x50'))&&_0x3fcb2b[_0x4995('0x9e')]==0x1f4){return _0x1a1e8a[_0x4995('0x2d')](_0x3fcb2b['statusCode']);}else{return _0x1a1e8a[_0x4995('0x1d')](_0x3fcb2b[_0x4995('0x9e')])[_0x4995('0x30')](_0x3fcb2b[_0x4995('0x8a')]);}}else{return _0x1a1e8a['sendStatus'](0xc8);}})[_0x4995('0x4b')](handleError(_0x1a1e8a,null));};exports[_0x4995('0x9f')]=function(_0x341763,_0x36f94c,_0x53a066){return BPromise[_0x4995('0x93')]()[_0x4995('0x2a')](function(){if(!_0x341763[_0x4995('0x38')][_0x4995('0x6')]){throw new Error(_0x4995('0x94'));}if(!_0x341763['query'][_0x4995('0xa0')]){throw new Error(_0x4995('0x95'));}var _0x27a247=_0x341763[_0x4995('0x38')][_0x4995('0x96')]?_0x341763['query'][_0x4995('0x96')]+':'+_0x341763['query'][_0x4995('0xa0')]:'http://localhost:'+_0x341763[_0x4995('0x38')][_0x4995('0xa0')];var _0x4846cc=_0x341763[_0x4995('0x38')][_0x4995('0x25')]?_0x341763[_0x4995('0x38')][_0x4995('0x25')]:!![];var _0x12e19a=_0x341763[_0x4995('0x38')][_0x4995('0x98')]?_0x341763['query'][_0x4995('0x98')]:null;var _0x4e79ee={'method':_0x341763[_0x4995('0x99')],'uri':util[_0x4995('0x53')](_0x4995('0xa1'),_0x27a247,_0x341763[_0x4995('0x38')]['path']),'json':_0x4846cc,'resolveWithFullResponse':!![],'encoding':_0x12e19a,'body':_0x341763['body']};if(_0x341763[_0x4995('0x9a')]){_0x4e79ee['headers']=_0x341763['headers'];if(_0x4e79ee['headers'][_0x4995('0x9b')]){delete _0x4e79ee[_0x4995('0x9a')][_0x4995('0x9b')];}}if(_0x4e79ee[_0x4995('0x9a')][_0x4995('0x9c')]){delete _0x4e79ee[_0x4995('0x9a')][_0x4995('0x9c')];}return rp(_0x4e79ee);})[_0x4995('0x2a')](function(_0x537c0a){if(_0x537c0a){_0x36f94c['set'](_0x537c0a[_0x4995('0x9a')]);logger[_0x4995('0x64')](_0x537c0a[_0x4995('0x8a')]);return _0x36f94c[_0x4995('0x1d')](_0x537c0a[_0x4995('0x9e')])[_0x4995('0x30')](_0x537c0a[_0x4995('0x8a')]);}else{return _0x36f94c[_0x4995('0x2d')](0xc8);}})[_0x4995('0x4b')](handleError(_0x36f94c,null));}; \ No newline at end of file +var _0x4aca=['intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','options','include','catch','show','includeAll','find','params','root','server/files/plugins','format','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Sequelize','Plugin\x20not\x20found','download','%s.zip','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','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Plugin','fieldName','type','key','model','query','keys','filters'];(function(_0xf4d352,_0x31c9c6){var _0x360635=function(_0x488308){while(--_0x488308){_0xf4d352['push'](_0xf4d352['shift']());}};_0x360635(++_0x31c9c6);}(_0x4aca,0x1dd));var _0xa4ac=function(_0x2ce498,_0xd2eb9){_0x2ce498=_0x2ce498-0x0;var _0x5923f5=_0x4aca[_0x2ce498];return _0x5923f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4ac('0x0'));var zipdir=require(_0xa4ac('0x1'));var jsonpatch=require(_0xa4ac('0x2'));var rp=require(_0xa4ac('0x3'));var moment=require(_0xa4ac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa4ac('0x5'));var util=require(_0xa4ac('0x6'));var path=require(_0xa4ac('0x7'));var sox=require(_0xa4ac('0x8'));var csv=require('to-csv');var ejs=require(_0xa4ac('0x9'));var fs=require('fs');var fs_extra=require(_0xa4ac('0xa'));var _=require(_0xa4ac('0xb'));var squel=require(_0xa4ac('0xc'));var crypto=require(_0xa4ac('0xd'));var jsforce=require(_0xa4ac('0xe'));var deskjs=require(_0xa4ac('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa4ac('0x10'));var Papa=require(_0xa4ac('0x11'));var extract=require(_0xa4ac('0x12'));var rimraf=require(_0xa4ac('0x0'));var archiver=require(_0xa4ac('0x13'));var Redis=require(_0xa4ac('0x14'));var authService=require(_0xa4ac('0x15'));var qs=require(_0xa4ac('0x16'));var as=require(_0xa4ac('0x17'));var hardwareService=require(_0xa4ac('0x18'));var logger=require(_0xa4ac('0x19'))(_0xa4ac('0x1a'));var utils=require(_0xa4ac('0x1b'));var config=require(_0xa4ac('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4ac('0x1d'))['db'];config[_0xa4ac('0x1e')]=_['defaults'](config[_0xa4ac('0x1e')],{'host':_0xa4ac('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4ac('0x1e')]));require(_0xa4ac('0x20'))['register'](socket);function respondWithStatusCode(_0x2efcd5,_0x95b0f7){_0x95b0f7=_0x95b0f7||0xcc;return function(_0x542d93){if(_0x542d93){return _0x2efcd5[_0xa4ac('0x21')](_0x95b0f7);}return _0x2efcd5[_0xa4ac('0x22')](_0x95b0f7)[_0xa4ac('0x23')]();};}function respondWithResult(_0x5b76a6,_0x5be8cd){_0x5be8cd=_0x5be8cd||0xc8;return function(_0x30f4fe){if(_0x30f4fe){return _0x5b76a6['status'](_0x5be8cd)[_0xa4ac('0x24')](_0x30f4fe);}};}function respondWithFilteredResult(_0x54878f,_0x5792dc){return function(_0x38f08e){if(_0x38f08e){var _0x4d3ad5=typeof _0x5792dc['offset']===_0xa4ac('0x25')&&typeof _0x5792dc[_0xa4ac('0x26')]===_0xa4ac('0x25');var _0x10c35b=_0x38f08e[_0xa4ac('0x27')];var _0x361b9c=_0x4d3ad5?0x0:_0x5792dc['offset'];var _0x2cf9c0=_0x4d3ad5?_0x38f08e[_0xa4ac('0x27')]:_0x5792dc['offset']+_0x5792dc['limit'];var _0x4a3306;if(_0x2cf9c0>=_0x10c35b){_0x2cf9c0=_0x10c35b;_0x4a3306=0xc8;}else{_0x4a3306=0xce;}_0x54878f[_0xa4ac('0x22')](_0x4a3306);return _0x54878f[_0xa4ac('0x28')](_0xa4ac('0x29'),_0x361b9c+'-'+_0x2cf9c0+'/'+_0x10c35b)[_0xa4ac('0x24')](_0x38f08e);}return null;};}function patchUpdates(_0x4def5d){return function(_0x17ceec){try{jsonpatch[_0xa4ac('0x2a')](_0x17ceec,_0x4def5d,!![]);}catch(_0x2c0052){return BPromise[_0xa4ac('0x2b')](_0x2c0052);}return _0x17ceec[_0xa4ac('0x2c')]();};}function saveUpdates(_0x3f99cf,_0x13832c){return function(_0x16e8c3){if(_0x16e8c3){return _0x16e8c3[_0xa4ac('0x2d')](_0x3f99cf)[_0xa4ac('0x2e')](function(_0x12366d){return _0x12366d;});}return null;};}function removeEntity(_0x548025,_0x1249e3){return function(_0x58f1a4){if(_0x58f1a4){return _0x58f1a4[_0xa4ac('0x2f')]()[_0xa4ac('0x2e')](function(){var _0x4a9ed4=_0x58f1a4[_0xa4ac('0x30')]({'plain':!![]});var _0x2b3fa7='Plugins';return db[_0xa4ac('0x31')][_0xa4ac('0x2f')]({'where':{'type':_0x2b3fa7,'resourceId':_0x4a9ed4['id']}})[_0xa4ac('0x2e')](function(){return _0x58f1a4;});})[_0xa4ac('0x2e')](function(){_0x548025['status'](0xcc)[_0xa4ac('0x23')]();});}};}function handleEntityNotFound(_0x5afc06,_0x5d8441){return function(_0x3930e5){if(!_0x3930e5){_0x5afc06['sendStatus'](0x194);}return _0x3930e5;};}function handleError(_0x35ae23,_0xec7269){_0xec7269=_0xec7269||0x1f4;return function(_0x340250){logger[_0xa4ac('0x32')](_0x340250[_0xa4ac('0x33')]);if(_0x340250['name']){delete _0x340250[_0xa4ac('0x34')];}_0x35ae23['status'](_0xec7269)[_0xa4ac('0x35')](_0x340250);};}exports['index']=function(_0x51ef6e,_0x273681){var _0x112cfa={},_0x2a8f66={},_0x5efbab={'count':0x0,'rows':[]};var _0x3bd5e0=_[_0xa4ac('0x36')](db[_0xa4ac('0x37')]['rawAttributes'],function(_0x1775ea){return{'name':_0x1775ea[_0xa4ac('0x38')],'type':_0x1775ea[_0xa4ac('0x39')][_0xa4ac('0x3a')]};});_0x2a8f66[_0xa4ac('0x3b')]=_['map'](_0x3bd5e0,_0xa4ac('0x34'));_0x2a8f66[_0xa4ac('0x3c')]=_[_0xa4ac('0x3d')](_0x51ef6e[_0xa4ac('0x3c')]);_0x2a8f66[_0xa4ac('0x3e')]=_[_0xa4ac('0x3f')](_0x2a8f66[_0xa4ac('0x3b')],_0x2a8f66[_0xa4ac('0x3c')]);_0x112cfa[_0xa4ac('0x40')]=_[_0xa4ac('0x3f')](_0x2a8f66[_0xa4ac('0x3b')],qs[_0xa4ac('0x41')](_0x51ef6e[_0xa4ac('0x3c')][_0xa4ac('0x41')]));_0x112cfa['attributes']=_0x112cfa[_0xa4ac('0x40')][_0xa4ac('0x42')]?_0x112cfa[_0xa4ac('0x40')]:_0x2a8f66['model'];if(!_0x51ef6e[_0xa4ac('0x3c')][_0xa4ac('0x43')](_0xa4ac('0x44'))){_0x112cfa[_0xa4ac('0x26')]=qs[_0xa4ac('0x26')](_0x51ef6e[_0xa4ac('0x3c')][_0xa4ac('0x26')]);_0x112cfa[_0xa4ac('0x45')]=qs[_0xa4ac('0x45')](_0x51ef6e[_0xa4ac('0x3c')]['offset']);}_0x112cfa[_0xa4ac('0x46')]=qs[_0xa4ac('0x47')](_0x51ef6e[_0xa4ac('0x3c')][_0xa4ac('0x47')]);_0x112cfa[_0xa4ac('0x48')]=qs[_0xa4ac('0x3e')](_[_0xa4ac('0x49')](_0x51ef6e[_0xa4ac('0x3c')],_0x2a8f66[_0xa4ac('0x3e')]),_0x3bd5e0);if(_0x51ef6e[_0xa4ac('0x3c')]['filter']){_0x112cfa[_0xa4ac('0x48')]=_[_0xa4ac('0x4a')](_0x112cfa[_0xa4ac('0x48')],{'$or':_['map'](_0x3bd5e0,function(_0x3ec937){if(_0x3ec937[_0xa4ac('0x39')]!=='VIRTUAL'){var _0x135381={};_0x135381[_0x3ec937[_0xa4ac('0x34')]]={'$like':'%'+_0x51ef6e[_0xa4ac('0x3c')]['filter']+'%'};return _0x135381;}})});}_0x112cfa=_['merge']({},_0x112cfa,_0x51ef6e[_0xa4ac('0x4b')]);var _0x2058d0={'where':_0x112cfa[_0xa4ac('0x48')]};return db[_0xa4ac('0x37')]['count'](_0x2058d0)[_0xa4ac('0x2e')](function(_0x28599a){_0x5efbab['count']=_0x28599a;if(_0x51ef6e[_0xa4ac('0x3c')]['includeAll']){_0x112cfa[_0xa4ac('0x4c')]=[{'all':!![]}];}return db[_0xa4ac('0x37')]['findAll'](_0x112cfa);})[_0xa4ac('0x2e')](function(_0x465ab2){_0x5efbab['rows']=_0x465ab2;return _0x5efbab;})[_0xa4ac('0x2e')](respondWithFilteredResult(_0x273681,_0x112cfa))[_0xa4ac('0x4d')](handleError(_0x273681,null));};exports[_0xa4ac('0x4e')]=function(_0x39eb98,_0x2d9bfb){var _0x4f745b={'raw':!![],'where':{'id':_0x39eb98['params']['id']}},_0x28a500={};_0x28a500[_0xa4ac('0x3b')]=_[_0xa4ac('0x3d')](db[_0xa4ac('0x37')]['rawAttributes']);_0x28a500['query']=_['keys'](_0x39eb98[_0xa4ac('0x3c')]);_0x28a500[_0xa4ac('0x3e')]=_[_0xa4ac('0x3f')](_0x28a500[_0xa4ac('0x3b')],_0x28a500[_0xa4ac('0x3c')]);_0x4f745b[_0xa4ac('0x40')]=_['intersection'](_0x28a500[_0xa4ac('0x3b')],qs[_0xa4ac('0x41')](_0x39eb98['query'][_0xa4ac('0x41')]));_0x4f745b[_0xa4ac('0x40')]=_0x4f745b[_0xa4ac('0x40')][_0xa4ac('0x42')]?_0x4f745b[_0xa4ac('0x40')]:_0x28a500['model'];if(_0x39eb98[_0xa4ac('0x3c')][_0xa4ac('0x4f')]){_0x4f745b['include']=[{'all':!![]}];}_0x4f745b=_[_0xa4ac('0x4a')]({},_0x4f745b,_0x39eb98[_0xa4ac('0x4b')]);return db[_0xa4ac('0x37')]['find'](_0x4f745b)[_0xa4ac('0x2e')](handleEntityNotFound(_0x2d9bfb,null))[_0xa4ac('0x2e')](respondWithResult(_0x2d9bfb,null))[_0xa4ac('0x4d')](handleError(_0x2d9bfb,null));};exports['download']=function(_0x41ee47,_0x2cbfcc,_0x45f55b){return db[_0xa4ac('0x37')][_0xa4ac('0x50')]({'where':{'id':_0x41ee47[_0xa4ac('0x51')]['id']},'attributes':[_0xa4ac('0x34'),_0xa4ac('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x2cbfcc,null))[_0xa4ac('0x2e')](function(_0x3d9274){if(_0x3d9274){var _0x52b554=path['join'](config[_0xa4ac('0x52')],_0xa4ac('0x53'),util[_0xa4ac('0x54')]('%s.zip',path[_0xa4ac('0x55')](_0x3d9274['path'])));var _0x447232=fs[_0xa4ac('0x56')](_0x52b554);var _0xcbe4e9=archiver(_0xa4ac('0x57'),{'zlib':{'level':0x9}});_0xcbe4e9['on'](_0xa4ac('0x58'),function(_0xf94305){if(_0xf94305[_0xa4ac('0x59')]===_0xa4ac('0x5a')){logger[_0xa4ac('0x32')](_0xf94305);}else{throw new db['Sequelize'][(_0xa4ac('0x5b'))](_0xa4ac('0x5c'));}});_0xcbe4e9['on'](_0xa4ac('0x32'),function(_0x122de9){throw new db['Sequelize'][(_0xa4ac('0x5b'))](_0xa4ac('0x5c'));});_0xcbe4e9[_0xa4ac('0x5d')](_0x447232);_0xcbe4e9[_0xa4ac('0x5e')](_0xa4ac('0x5f'),{'cwd':path[_0xa4ac('0x60')](config[_0xa4ac('0x52')],'server/files/plugins',path['dirname'](_0x3d9274[_0xa4ac('0x7')])),'ignore':[path[_0xa4ac('0x60')](path[_0xa4ac('0x55')](_0x3d9274[_0xa4ac('0x7')]),_0xa4ac('0x61')),path['join'](path[_0xa4ac('0x55')](_0x3d9274['path']),_0xa4ac('0x62'))],'nodir':!![]})[_0xa4ac('0x63')]();_0x447232['on'](_0xa4ac('0x64'),function(){if(!fs[_0xa4ac('0x65')](_0x52b554)){throw new db[(_0xa4ac('0x66'))][(_0xa4ac('0x5b'))](_0xa4ac('0x67'));}return _0x2cbfcc[_0xa4ac('0x68')](_0x52b554,util['format'](_0xa4ac('0x69'),path['basename'](_0x3d9274[_0xa4ac('0x7')])),function(_0x46bb10){if(_0x46bb10){throw new db[(_0xa4ac('0x66'))][(_0xa4ac('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xa4ac('0x6a')](_0x52b554);logger[_0xa4ac('0x6b')](_0xa4ac('0x6c'));logger[_0xa4ac('0x6b')](_0xa4ac('0x6d'));});});}return null;})[_0xa4ac('0x4d')](handleError(_0x2cbfcc,null));};exports['upload']=function(_0xaddaf1,_0x2c4c25,_0x169057){var _0x1b771d=path['basename'](_0xaddaf1[_0xa4ac('0x6e')][_0xa4ac('0x6f')],path[_0xa4ac('0x70')](_0xaddaf1['file']['filename']));var _0x10d711=path['join'](config[_0xa4ac('0x52')],_0xa4ac('0x53'),_0xaddaf1['file'][_0xa4ac('0x6f')]);var _0x3feb1b=path['join'](config[_0xa4ac('0x52')],_0xa4ac('0x53'),_0x1b771d);logger[_0xa4ac('0x6b')](_0xa4ac('0x71'),_0x10d711);logger[_0xa4ac('0x6b')](_0xa4ac('0x72'),_0x3feb1b);try{fs[_0xa4ac('0x73')](_0x10d711,parseInt(_0xa4ac('0x74'),0x8));extract(_0x10d711,{'dir':_0x3feb1b},function(_0x41000a){if(_0x41000a){logger[_0xa4ac('0x32')](_0x41000a);handleError(_0x41000a,!![]);};var _0x2d19bf=fs[_0xa4ac('0x75')](_0x3feb1b);if(_0x2d19bf[_0xa4ac('0x42')]>0x1){removeReferences(_0x10d711,_0x3feb1b);logger[_0xa4ac('0x32')](_0xa4ac('0x76'));return _0x169057(new Error(_0xa4ac('0x76')));}var _0xec777e=fs[_0xa4ac('0x77')](path[_0xa4ac('0x60')](_0x3feb1b,_0x2d19bf[0x0]));if(_0xec777e[_0xa4ac('0x78')]()){removeReferences(_0x10d711,_0x3feb1b);logger[_0xa4ac('0x32')]('Invalid\x20plugin\x20structure');return _0x169057(new Error(_0xa4ac('0x76')));}if(_0xec777e[_0xa4ac('0x79')]()){var _0x2f50de=fs[_0xa4ac('0x75')](path[_0xa4ac('0x60')](_0x3feb1b,_0x2d19bf[0x0]));if(_0x2f50de['length']===0x0){removeReferences(_0x10d711,_0x3feb1b);logger[_0xa4ac('0x32')](_0xa4ac('0x76'));return _0x169057(new Error('Invalid\x20plugin\x20structure'));}var _0x14657c=_0x2f50de[_0xa4ac('0x7a')](function(_0x2c2f86){return _0x2c2f86===_0xa4ac('0x7b');});if(!_0x14657c){return _0x169057(new Error(_0xa4ac('0x7c')));}var _0x280a19=fs[_0xa4ac('0x7d')](path['join'](_0x3feb1b,_0x2d19bf[0x0],'manifest.json'));var _0x1c9093=JSON[_0xa4ac('0x7e')](_0x280a19);if(_0xa4ac('0x25')==typeof _0x1c9093['name']){return _0x169057(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xa4ac('0x25')==typeof _0x1c9093['type']){return _0x169057(new Error(_0xa4ac('0x7f')));}if(_0xa4ac('0x25')==typeof _0x1c9093[_0xa4ac('0x80')]){return _0x169057(new Error(_0xa4ac('0x81')));}if('undefined'==typeof _0x1c9093['parameters']){return _0x169057(new Error(_0xa4ac('0x82')));}if(_0x1c9093[_0xa4ac('0x39')]===_0xa4ac('0x83')){if(_0xa4ac('0x25')==typeof _0x1c9093['parameters'][_0xa4ac('0x84')]){return _0x169057(new Error(_0xa4ac('0x85')));}if(_0xa4ac('0x25')==typeof _0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x84')][_0xa4ac('0x87')]&&_0xa4ac('0x25')==typeof _0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x84')][_0xa4ac('0x88')]){return _0x169057(new Error(_0xa4ac('0x89')));}}else if(_0x1c9093['type']===_0xa4ac('0x8a')){if(_0xa4ac('0x25')==typeof _0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x8b')]){return _0x169057(new Error(_0xa4ac('0x8c')));}if(_0xa4ac('0x25')==typeof _0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x8d')]){return _0x169057(new Error(_0xa4ac('0x8e')));}}else{return _0x169057(new Error(_0xa4ac('0x8f')));}var _0x39cfd0=_0x1c9093[_0xa4ac('0x34')];var _0x26588c=_0x1c9093[_0xa4ac('0x90')];var _0x42b4e2=_0x1c9093['type'];var _0x3d7520=_0x1c9093['sidebar']?_0x1c9093['sidebar']:_0xa4ac('0x91');var _0x2803b9=_0x1c9093['icon']?_0x1c9093[_0xa4ac('0x92')]:_0xa4ac('0x93');var _0x6a2784='';var _0x11a024='';var _0x36c8c5='';var _0x26db49='';var _0x79879b=_0x1c9093['version'];if(_0x42b4e2===_0xa4ac('0x83')){if(_0xa4ac('0x25')!=typeof _0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x84')][_0xa4ac('0x87')]){var _0x40a089=_0x1c9093[_0xa4ac('0x86')]['views'][_0xa4ac('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xa4ac('0x94')](_0x40a089)){_0x6a2784=path[_0xa4ac('0x60')](_0xa4ac('0x95'),_0x1b771d,_0x2d19bf[0x0],_0x40a089);}else{_0x6a2784=_0x40a089;}}else{logger[_0xa4ac('0x6b')](_0xa4ac('0x96'));}if(_0xa4ac('0x25')!=typeof _0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x84')][_0xa4ac('0x88')]){var _0x585bee=_0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x84')][_0xa4ac('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xa4ac('0x94')](_0x585bee)){_0x11a024=path[_0xa4ac('0x60')]('plugins',_0x1b771d,_0x2d19bf[0x0],_0x585bee);}else{_0x11a024=_0x585bee;}}else{logger[_0xa4ac('0x6b')](_0xa4ac('0x97'));}}else if(_0x42b4e2===_0xa4ac('0x8a')){_0x36c8c5=_0x1c9093['parameters'][_0xa4ac('0x8b')];_0x26db49=_0x1c9093[_0xa4ac('0x86')]['scriptPath'];if(_0xa4ac('0x25')!=typeof _0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x84')]){if(_0xa4ac('0x25')!=typeof _0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x84')]['admin']){var _0x40a089=_0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x84')][_0xa4ac('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xa4ac('0x94')](_0x40a089)){_0x6a2784=path[_0xa4ac('0x60')](_0xa4ac('0x95'),_0x1b771d,_0x2d19bf[0x0],_0x40a089);}else{_0x6a2784=_0x40a089;}}if(_0xa4ac('0x25')!=typeof _0x1c9093[_0xa4ac('0x86')]['views']['agent']){var _0x585bee=_0x1c9093[_0xa4ac('0x86')][_0xa4ac('0x84')][_0xa4ac('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xa4ac('0x94')](_0x585bee)){_0x11a024=path['join'](_0xa4ac('0x95'),_0x1b771d,_0x2d19bf[0x0],_0x585bee);}else{_0x11a024=_0x585bee;}}}}var _0x5d6ddb={'name':_0x39cfd0,'description':_0x26588c,'path':path[_0xa4ac('0x60')](_0x1b771d,_0x2d19bf[0x0]),'type':_0x42b4e2,'sidebar':_0x3d7520,'icon':_0x2803b9,'adminUrl':_0x6a2784,'agentUrl':_0x11a024,'scriptName':_0x36c8c5,'scriptPath':_0x26db49,'version':_0x79879b};removeReferences(_0x10d711,null);return db[_0xa4ac('0x37')][_0xa4ac('0x98')](_0x5d6ddb)['then'](function(_0x40d39d){var _0x59bf26={'role':_0xaddaf1[_0xa4ac('0x99')][_0xa4ac('0x9a')],'userProfileId':_0xaddaf1[_0xa4ac('0x99')][_0xa4ac('0x9b')]};if(!_0x59bf26)throw new Error(_0xa4ac('0x9c'));if(_0x59bf26[_0xa4ac('0x9a')]===_0xa4ac('0x9d')){var _0x1708e7=_0x40d39d['get']({'plain':!![]});return db[_0xa4ac('0x9e')][_0xa4ac('0x50')]({'where':{'name':_0xa4ac('0x9f'),'userProfileId':_0x59bf26[_0xa4ac('0x9b')]},'raw':!![]})[_0xa4ac('0x2e')](function(_0x50429d){if(_0x50429d&&_0x50429d['autoAssociation']===0x0){return db[_0xa4ac('0x31')][_0xa4ac('0x98')]({'name':_0x1708e7[_0xa4ac('0x34')],'resourceId':_0x1708e7['id'],'type':_0x50429d[_0xa4ac('0x34')],'sectionId':_0x50429d['id']},{})[_0xa4ac('0x2e')](function(){return _0x40d39d;});}else{return _0x40d39d;}})['catch'](function(_0x277187){logger[_0xa4ac('0x32')](_0xa4ac('0xa0'),_0x277187);throw _0x277187;});}return _0x40d39d;})[_0xa4ac('0x2e')](respondWithResult(_0x2c4c25,null))[_0xa4ac('0x4d')](handleError(_0x2c4c25,null));}});}catch(_0x5407bf){_0x2c4c25[_0xa4ac('0x22')](0x1f4)[_0xa4ac('0x35')](_0x5407bf);}};function removeReferences(_0x16f755,_0x36b3f8){try{if(_0x16f755){fs['unlinkSync'](_0x16f755);logger[_0xa4ac('0x6b')](_0xa4ac('0xa1'));}if(_0x36b3f8){rimraf(_0x36b3f8,function(){});logger[_0xa4ac('0x6b')](_0xa4ac('0xa2'));}}catch(_0x2c5e4f){logger[_0xa4ac('0x32')](_0x2c5e4f);}}exports[_0xa4ac('0x2d')]=function(_0x53bc48,_0x387f7e,_0x2dbaec){return db['Plugin']['find']({'where':{'id':_0x53bc48[_0xa4ac('0x51')]['id']}})['then'](handleEntityNotFound(_0x387f7e,null))[_0xa4ac('0x2e')](saveUpdates(_0x53bc48[_0xa4ac('0x99')],null))[_0xa4ac('0x2e')](respondWithResult(_0x387f7e,null))[_0xa4ac('0x4d')](handleError(_0x387f7e,null));};exports[_0xa4ac('0xa3')]=function(_0x3d4348,_0x567808,_0x431106){return db['Plugin']['find']({'where':{'id':_0x3d4348[_0xa4ac('0x51')]['id']}})[_0xa4ac('0x2e')](function(_0x3fae51){if(_0x3fae51){return _0x3fae51['destroy']();}})[_0xa4ac('0x2e')](function(_0x181b5b){rimraf(path[_0xa4ac('0x60')](config['root'],_0xa4ac('0x53'),path['dirname'](_0x181b5b[_0xa4ac('0x7')])),function(){});return _0x181b5b;})[_0xa4ac('0x2e')](handleEntityNotFound(_0x567808,null))[_0xa4ac('0x2e')](respondWithStatusCode(_0x567808,null))[_0xa4ac('0x4d')](handleError(_0x567808,null));};exports[_0xa4ac('0xa4')]=function(_0x5e47e1,_0x3530d3,_0x25c9c8){return BPromise['resolve']()['then'](function(){if(!_0x5e47e1[_0xa4ac('0x3c')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5e47e1[_0xa4ac('0x3c')]['port']){throw new Error(_0xa4ac('0xa5'));}var _0x2fd64b=_0x5e47e1['query'][_0xa4ac('0xa6')]?_0x5e47e1[_0xa4ac('0x3c')][_0xa4ac('0xa6')]+':'+_0x5e47e1[_0xa4ac('0x3c')][_0xa4ac('0xa7')]:_0xa4ac('0xa8')+_0x5e47e1[_0xa4ac('0x3c')][_0xa4ac('0xa7')];var _0x48483d=_0x5e47e1['query'][_0xa4ac('0x24')]?_0x5e47e1[_0xa4ac('0x3c')][_0xa4ac('0x24')]:!![];var _0x23a0b9=_0x5e47e1['query'][_0xa4ac('0xa9')]?_0x5e47e1[_0xa4ac('0x3c')][_0xa4ac('0xa9')]:null;var _0x5ea4ce={'method':_0x5e47e1[_0xa4ac('0xaa')],'uri':util[_0xa4ac('0x54')](_0xa4ac('0xab'),_0x2fd64b,_0x5e47e1['query'][_0xa4ac('0x7')]),'json':_0x48483d,'resolveWithFullResponse':!![],'encoding':_0x23a0b9,'qs':_0x5e47e1[_0xa4ac('0x3c')]};if(_0x5e47e1[_0xa4ac('0xac')]){_0x5ea4ce[_0xa4ac('0xac')]=_0x5e47e1[_0xa4ac('0xac')];if(_0x5ea4ce['headers'][_0xa4ac('0xad')]){delete _0x5ea4ce[_0xa4ac('0xac')][_0xa4ac('0xad')];}}if(_0x5ea4ce[_0xa4ac('0xac')]['content-type']){delete _0x5ea4ce['headers'][_0xa4ac('0xae')];}return rp(_0x5ea4ce);})['then'](function(_0x542d9f){if(_0x542d9f){_0x3530d3[_0xa4ac('0x28')](_0x542d9f[_0xa4ac('0xac')]);logger[_0xa4ac('0x6b')](_0x542d9f['body']);if(_[_0xa4ac('0xaf')](_0x5e47e1[_0xa4ac('0x3c')][_0xa4ac('0x7')],_0xa4ac('0x68'))&&_0x542d9f[_0xa4ac('0xb0')]==0x1f4){return _0x3530d3[_0xa4ac('0x21')](_0x542d9f['statusCode']);}else{return _0x3530d3['status'](_0x542d9f['statusCode'])['send'](_0x542d9f[_0xa4ac('0x99')]);}}else{return _0x3530d3[_0xa4ac('0x21')](0xc8);}})[_0xa4ac('0x4d')](handleError(_0x3530d3,null));};exports[_0xa4ac('0xb1')]=function(_0x374f10,_0x22a757,_0x52553b){return BPromise[_0xa4ac('0xb2')]()[_0xa4ac('0x2e')](function(){if(!_0x374f10[_0xa4ac('0x3c')][_0xa4ac('0x7')]){throw new Error(_0xa4ac('0xb3'));}if(!_0x374f10[_0xa4ac('0x3c')][_0xa4ac('0xa7')]){throw new Error(_0xa4ac('0xa5'));}var _0x32b77c=_0x374f10[_0xa4ac('0x3c')][_0xa4ac('0xa6')]?_0x374f10[_0xa4ac('0x3c')][_0xa4ac('0xa6')]+':'+_0x374f10[_0xa4ac('0x3c')]['port']:_0xa4ac('0xa8')+_0x374f10[_0xa4ac('0x3c')][_0xa4ac('0xa7')];var _0x39529d=_0x374f10[_0xa4ac('0x3c')][_0xa4ac('0x24')]?_0x374f10[_0xa4ac('0x3c')][_0xa4ac('0x24')]:!![];var _0x2848ab=_0x374f10['query']['encoding']?_0x374f10[_0xa4ac('0x3c')][_0xa4ac('0xa9')]:null;var _0x4900ac={'method':_0x374f10['method'],'uri':util[_0xa4ac('0x54')]('%s%s',_0x32b77c,_0x374f10['query'][_0xa4ac('0x7')]),'json':_0x39529d,'resolveWithFullResponse':!![],'encoding':_0x2848ab,'body':_0x374f10[_0xa4ac('0x99')]};if(_0x374f10[_0xa4ac('0xac')]){_0x4900ac[_0xa4ac('0xac')]=_0x374f10[_0xa4ac('0xac')];if(_0x4900ac[_0xa4ac('0xac')][_0xa4ac('0xad')]){delete _0x4900ac[_0xa4ac('0xac')][_0xa4ac('0xad')];}}if(_0x4900ac[_0xa4ac('0xac')]['content-type']){delete _0x4900ac['headers'][_0xa4ac('0xae')];}return rp(_0x4900ac);})['then'](function(_0x40392d){if(_0x40392d){_0x22a757[_0xa4ac('0x28')](_0x40392d[_0xa4ac('0xac')]);logger[_0xa4ac('0x6b')](_0x40392d[_0xa4ac('0x99')]);return _0x22a757['status'](_0x40392d['statusCode'])[_0xa4ac('0x35')](_0x40392d[_0xa4ac('0x99')]);}else{return _0x22a757[_0xa4ac('0x21')](0xc8);}})['catch'](handleError(_0x22a757,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1bf19f4..5e11206 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 _0x018c=['hook','exports','events','../../mysqldb','Plugin','update','emit','hasOwnProperty'];(function(_0x15c14a,_0x41e20b){var _0x2eab4c=function(_0x5341ca){while(--_0x5341ca){_0x15c14a['push'](_0x15c14a['shift']());}};_0x2eab4c(++_0x41e20b);}(_0x018c,0xda));var _0xc018=function(_0x96a607,_0x166a2d){_0x96a607=_0x96a607-0x0;var _0x1052da=_0x018c[_0x96a607];return _0x1052da;};'use strict';var EventEmitter=require(_0xc018('0x0'));var Plugin=require(_0xc018('0x1'))['db'][_0xc018('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc018('0x3'),'afterDestroy':'remove'};function emitEvent(_0x197c30){return function(_0x263935,_0x455c37,_0x210679){PluginEvents['emit'](_0x197c30+':'+_0x263935['id'],_0x263935);PluginEvents[_0xc018('0x4')](_0x197c30,_0x263935);_0x210679(null);};}for(var e in events){if(events[_0xc018('0x5')](e)){var event=events[e];Plugin[_0xc018('0x6')](e,emitEvent(event));}}module[_0xc018('0x7')]=PluginEvents; \ No newline at end of file +var _0x4e83=['setMaxListeners','save','update','remove','emit','hook','exports','events','Plugin'];(function(_0x5b14da,_0x287e59){var _0x5589b9=function(_0x3d3137){while(--_0x3d3137){_0x5b14da['push'](_0x5b14da['shift']());}};_0x5589b9(++_0x287e59);}(_0x4e83,0x1ae));var _0x34e8=function(_0x20d4e7,_0x5f29f7){_0x20d4e7=_0x20d4e7-0x0;var _0x125131=_0x4e83[_0x20d4e7];return _0x125131;};'use strict';var EventEmitter=require(_0x34e8('0x0'));var Plugin=require('../../mysqldb')['db'][_0x34e8('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x34e8('0x2')](0x0);var events={'afterCreate':_0x34e8('0x3'),'afterUpdate':_0x34e8('0x4'),'afterDestroy':_0x34e8('0x5')};function emitEvent(_0x58fe4b){return function(_0x5dc841,_0x506eb2,_0x51fc5b){PluginEvents[_0x34e8('0x6')](_0x58fe4b+':'+_0x5dc841['id'],_0x5dc841);PluginEvents[_0x34e8('0x6')](_0x58fe4b,_0x5dc841);_0x51fc5b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x34e8('0x7')](e,emitEvent(event));}}module[_0x34e8('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 6a6ff9c..4541549 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 _0xc6a1=['bluebird','request-promise','path','rimraf','../../config/environment','define','Plugin','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x2d4101,_0x317baa){var _0x3d746f=function(_0x3f85b3){while(--_0x3f85b3){_0x2d4101['push'](_0x2d4101['shift']());}};_0x3d746f(++_0x317baa);}(_0xc6a1,0xb1));var _0x1c6a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc6a1[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x1c6a('0x0'));var util=require(_0x1c6a('0x1'));var logger=require(_0x1c6a('0x2'))(_0x1c6a('0x3'));var moment=require(_0x1c6a('0x4'));var BPromise=require(_0x1c6a('0x5'));var rp=require(_0x1c6a('0x6'));var fs=require('fs');var path=require(_0x1c6a('0x7'));var rimraf=require(_0x1c6a('0x8'));var config=require(_0x1c6a('0x9'));var attributes=require('./plugin.attributes');module['exports']=function(_0x20c4cb,_0x44875e){return _0x20c4cb[_0x1c6a('0xa')](_0x1c6a('0xb'),attributes,{'tableName':_0x1c6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbae=['../../config/logger','api','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins','lodash','util'];(function(_0x1d75f7,_0x139d5e){var _0x307f9a=function(_0x400ae1){while(--_0x400ae1){_0x1d75f7['push'](_0x1d75f7['shift']());}};_0x307f9a(++_0x139d5e);}(_0xcbae,0x1c5));var _0xecba=function(_0x870788,_0x484e2f){_0x870788=_0x870788-0x0;var _0xb28e6c=_0xcbae[_0x870788];return _0xb28e6c;};'use strict';var _=require(_0xecba('0x0'));var util=require(_0xecba('0x1'));var logger=require(_0xecba('0x2'))(_0xecba('0x3'));var moment=require('moment');var BPromise=require(_0xecba('0x4'));var rp=require(_0xecba('0x5'));var fs=require('fs');var path=require(_0xecba('0x6'));var rimraf=require(_0xecba('0x7'));var config=require('../../config/environment');var attributes=require(_0xecba('0x8'));module[_0xecba('0x9')]=function(_0x55ca5d,_0x7a390){return _0x55ca5d[_0xecba('0xa')](_0xecba('0xb'),attributes,{'tableName':_0xecba('0xc'),'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 0527948..14bc3a4 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 _0x63bf=['client','redis','localhost','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','info','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x41a0bc,_0xfa411c){var _0x41a54d=function(_0x531065){while(--_0x531065){_0x41a0bc['push'](_0x41a0bc['shift']());}};_0x41a54d(++_0xfa411c);}(_0x63bf,0xd7));var _0xf63b=function(_0x3da130,_0x236927){_0x3da130=_0x3da130-0x0;var _0x346dde=_0x63bf[_0x3da130];return _0x346dde;};'use strict';var _=require('lodash');var util=require(_0xf63b('0x0'));var moment=require(_0xf63b('0x1'));var BPromise=require('bluebird');var rs=require(_0xf63b('0x2'));var fs=require('fs');var Redis=require(_0xf63b('0x3'));var db=require(_0xf63b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf63b('0x5'))(_0xf63b('0x6'));var config=require(_0xf63b('0x7'));var jayson=require(_0xf63b('0x8'));var client=jayson[_0xf63b('0x9')]['http']({'port':0x232a});config[_0xf63b('0xa')]=_['defaults'](config['redis'],{'host':_0xf63b('0xb'),'port':0x18eb});var socket=require(_0xf63b('0xc'))(new Redis(config[_0xf63b('0xa')]));require(_0xf63b('0xd'))['register'](socket);function respondWithRpcPromise(_0x45b57a,_0x348c03,_0x1f51fc){return new BPromise(function(_0x1f2b4c,_0x1e1f69){return client[_0xf63b('0xe')](_0x45b57a,_0x1f51fc)[_0xf63b('0xf')](function(_0x3ed652){logger['info'](_0xf63b('0x10'),_0x348c03,_0xf63b('0x11'));logger['debug'](_0xf63b('0x12'),_0x348c03,_0xf63b('0x11'),JSON[_0xf63b('0x13')](_0x3ed652));if(_0x3ed652[_0xf63b('0x14')]){if(_0x3ed652['error'][_0xf63b('0x15')]===0x1f4){logger['error'](_0xf63b('0x10'),_0x348c03,_0x3ed652[_0xf63b('0x14')][_0xf63b('0x16')]);return _0x1e1f69(_0x3ed652['error'][_0xf63b('0x16')]);}logger[_0xf63b('0x14')](_0xf63b('0x10'),_0x348c03,_0x3ed652['error']['message']);return _0x1f2b4c(_0x3ed652[_0xf63b('0x14')][_0xf63b('0x16')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x348c03,_0xf63b('0x11'));_0x1f2b4c(_0x3ed652[_0xf63b('0x17')]['message']);}})[_0xf63b('0x18')](function(_0x1d8a47){logger['error'](_0xf63b('0x10'),_0x348c03,_0x1d8a47);_0x1e1f69(_0x1d8a47);});});}exports[_0xf63b('0x19')]=function(_0x110abd){var _0x529d12=this;return new Promise(function(_0xe98882,_0x36351b){return db[_0xf63b('0x1a')][_0xf63b('0x1b')](_0x110abd[_0xf63b('0x1c')],{'raw':_0x110abd['options']?_0x110abd[_0xf63b('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xf63b('0xf')](function(_0x290ff4){logger[_0xf63b('0x1e')](_0xf63b('0x19'),_0x110abd);logger[_0xf63b('0x1f')](_0xf63b('0x19'),_0x110abd,JSON[_0xf63b('0x13')](_0x290ff4));_0xe98882(_0x290ff4);})[_0xf63b('0x18')](function(_0x3a390d){logger[_0xf63b('0x14')](_0xf63b('0x19'),_0x3a390d[_0xf63b('0x16')],_0x110abd);_0x36351b(_0x529d12[_0xf63b('0x14')](0x1f4,_0x3a390d[_0xf63b('0x16')]));});});}; \ No newline at end of file +var _0xe62e=['Plugin,\x20%s,\x20%s','message','result','CreatePlugin','Plugin','create','options','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2e986d,_0x4b6b63){var _0x351c79=function(_0xf178c7){while(--_0xf178c7){_0x2e986d['push'](_0x2e986d['shift']());}};_0x351c79(++_0x4b6b63);}(_0xe62e,0x1ac));var _0xee62=function(_0xca41dc,_0x22936e){_0xca41dc=_0xca41dc-0x0;var _0x3e125c=_0xe62e[_0xca41dc];return _0x3e125c;};'use strict';var _=require(_0xee62('0x0'));var util=require(_0xee62('0x1'));var moment=require(_0xee62('0x2'));var BPromise=require(_0xee62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee62('0x4'));var db=require(_0xee62('0x5'))['db'];var utils=require(_0xee62('0x6'));var logger=require(_0xee62('0x7'))(_0xee62('0x8'));var config=require(_0xee62('0x9'));var jayson=require(_0xee62('0xa'));var client=jayson[_0xee62('0xb')][_0xee62('0xc')]({'port':0x232a});config[_0xee62('0xd')]=_['defaults'](config[_0xee62('0xd')],{'host':_0xee62('0xe'),'port':0x18eb});var socket=require(_0xee62('0xf'))(new Redis(config[_0xee62('0xd')]));require(_0xee62('0x10'))[_0xee62('0x11')](socket);function respondWithRpcPromise(_0x15be4d,_0x32336c,_0x220847){return new BPromise(function(_0x563e73,_0x5942e7){return client[_0xee62('0x12')](_0x15be4d,_0x220847)[_0xee62('0x13')](function(_0x42d56e){logger[_0xee62('0x14')]('Plugin,\x20%s,\x20%s',_0x32336c,_0xee62('0x15'));logger[_0xee62('0x16')](_0xee62('0x17'),_0x32336c,_0xee62('0x15'),JSON[_0xee62('0x18')](_0x42d56e));if(_0x42d56e[_0xee62('0x19')]){if(_0x42d56e[_0xee62('0x19')][_0xee62('0x1a')]===0x1f4){logger['error'](_0xee62('0x1b'),_0x32336c,_0x42d56e[_0xee62('0x19')][_0xee62('0x1c')]);return _0x5942e7(_0x42d56e['error']['message']);}logger['error'](_0xee62('0x1b'),_0x32336c,_0x42d56e['error']['message']);return _0x563e73(_0x42d56e['error'][_0xee62('0x1c')]);}else{logger[_0xee62('0x14')](_0xee62('0x1b'),_0x32336c,'request\x20sent');_0x563e73(_0x42d56e[_0xee62('0x1d')][_0xee62('0x1c')]);}})['catch'](function(_0xc83573){logger[_0xee62('0x19')](_0xee62('0x1b'),_0x32336c,_0xc83573);_0x5942e7(_0xc83573);});});}exports[_0xee62('0x1e')]=function(_0x485358){var _0x578f7f=this;return new Promise(function(_0x457f52,_0x41466b){return db[_0xee62('0x1f')][_0xee62('0x20')](_0x485358['body'],{'raw':_0x485358[_0xee62('0x21')]?_0x485358[_0xee62('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xee62('0x13')](function(_0x2f657e){logger[_0xee62('0x14')](_0xee62('0x1e'),_0x485358);logger[_0xee62('0x16')](_0xee62('0x1e'),_0x485358,JSON[_0xee62('0x18')](_0x2f657e));_0x457f52(_0x2f657e);})[_0xee62('0x22')](function(_0xbe797c){logger[_0xee62('0x19')]('CreatePlugin',_0xbe797c['message'],_0x485358);_0x41466b(_0x578f7f[_0xee62('0x19')](0x1f4,_0xbe797c[_0xee62('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4334680..0970d19 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 _0x7fde=['register','plugin:','./plugin.events','save','remove','emit'];(function(_0x48599f,_0x3339a0){var _0x5d889d=function(_0x29a408){while(--_0x29a408){_0x48599f['push'](_0x48599f['shift']());}};_0x5d889d(++_0x3339a0);}(_0x7fde,0x6e));var _0xe7fd=function(_0x4e195a,_0x5522ad){_0x4e195a=_0x4e195a-0x0;var _0x1671fb=_0x7fde[_0x4e195a];return _0x1671fb;};'use strict';var PluginEvents=require(_0xe7fd('0x0'));var events=[_0xe7fd('0x1'),_0xe7fd('0x2'),'update'];function createListener(_0x474d6f,_0x268c1d){return function(_0x26e01f){_0x268c1d[_0xe7fd('0x3')](_0x474d6f,_0x26e01f);};}function removeListener(_0x57917d,_0x23cb9e){return function(){PluginEvents['removeListener'](_0x57917d,_0x23cb9e);};}exports[_0xe7fd('0x4')]=function(_0x463631){for(var _0x3463f3=0x0,_0x1d1f07=events['length'];_0x3463f3<_0x1d1f07;_0x3463f3++){var _0x2c8025=events[_0x3463f3];var _0x3ddb68=createListener(_0xe7fd('0x5')+_0x2c8025,_0x463631);PluginEvents['on'](_0x2c8025,_0x3ddb68);}}; \ No newline at end of file +var _0x8f5f=['save','emit','removeListener','register','./plugin.events'];(function(_0x332005,_0x24edf1){var _0x4393e1=function(_0x352f93){while(--_0x352f93){_0x332005['push'](_0x332005['shift']());}};_0x4393e1(++_0x24edf1);}(_0x8f5f,0xcc));var _0xf8f5=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x8f5f[_0x1928c9];return _0x51b5fb;};'use strict';var PluginEvents=require(_0xf8f5('0x0'));var events=[_0xf8f5('0x1'),'remove','update'];function createListener(_0x3ed03e,_0xcbcb47){return function(_0x297618){_0xcbcb47[_0xf8f5('0x2')](_0x3ed03e,_0x297618);};}function removeListener(_0x304add,_0x569d81){return function(){PluginEvents[_0xf8f5('0x3')](_0x304add,_0x569d81);};}exports[_0xf8f5('0x4')]=function(_0x491499){for(var _0x15f64b=0x0,_0x57f001=events['length'];_0x15f64b<_0x57f001;_0x15f64b++){var _0x1374c4=events[_0x15f64b];var _0x1239fc=createListener('plugin:'+_0x1374c4,_0x491499);PluginEvents['on'](_0x1374c4,_0x1239fc);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e8ab0ed..0b82365 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(_0x544268,_0xdccfa4){var _0x55d643=function(_0x2a94f6){while(--_0x2a94f6){_0x544268['push'](_0x544268['shift']());}};_0x55d643(++_0xdccfa4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x43a14f,_0x1c7d05){var _0x1f96ef=function(_0x1e868a){while(--_0x1e868a){_0x43a14f['push'](_0x43a14f['shift']());}};_0x1f96ef(++_0x1c7d05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 13b2586..aa59d33 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 _0xcb91=['describe','create','body','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/logger','api','path','child_process','bluebird','sendStatus','json','name','status','send','npm\x20install','info','list','then','reject','express','length','catch','show'];(function(_0x47c309,_0x14c0cf){var _0x1d646e=function(_0x5daee3){while(--_0x5daee3){_0x47c309['push'](_0x47c309['shift']());}};_0x1d646e(++_0x14c0cf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xcb91[_0x80d733];return _0x435868;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var path=require(_0x1cb9('0x2'));var exec=require(_0x1cb9('0x3'))['exec'];var BPromise=require(_0x1cb9('0x4'));function handleEntityNotFound(_0x2c17b8,_0x545a34){return function(_0x13d5fd){if(!_0x13d5fd){_0x2c17b8[_0x1cb9('0x5')](0x194);;}return _0x13d5fd;};}function respondWithResult(_0x53ffbd,_0x226b69){_0x226b69=_0x226b69||0xc8;return function(_0x3f7deb){if(_0x3f7deb){return _0x53ffbd['status'](_0x226b69)[_0x1cb9('0x6')](_0x3f7deb);}return null;};}function handleError(_0x12567c,_0x59d1be){_0x59d1be=_0x59d1be||0x1f4;return function(_0x3ae0f1){logger['error'](_0x3ae0f1['stack']);if(_0x3ae0f1[_0x1cb9('0x7')]){delete _0x3ae0f1[_0x1cb9('0x7')];}_0x12567c[_0x1cb9('0x8')](_0x59d1be)[_0x1cb9('0x9')](_0x3ae0f1);};}function execChildProcess(){return new BPromise(function(_0x2fc627,_0x50ce71){exec(_0x1cb9('0xa'),function(_0x44a6b4,_0x3af35f,_0x3fdd83){logger[_0x1cb9('0xb')](_0x3af35f);logger['info'](_0x3fdd83);if(_0x44a6b4){logger['error'](_0x44a6b4);return _0x50ce71(_0x44a6b4);}return _0x2fc627(_0x3af35f);});});}exports['index']=function(_0x358866,_0x282bc6){return pm2[_0x1cb9('0xc')]()[_0x1cb9('0xd')](function(_0x56884d){if(_0x56884d){var _0x397727=_[_0x1cb9('0xe')](_0x56884d,function(_0x1b3cd7){return _0x1b3cd7[_0x1cb9('0x7')]===_0x1cb9('0xf')||_0x1b3cd7['name']==='motion2';});return{'rows':_0x397727,'count':_0x397727[_0x1cb9('0x10')]};}return null;})[_0x1cb9('0xd')](respondWithResult(_0x282bc6,null))[_0x1cb9('0x11')](handleError(_0x282bc6,null));};exports[_0x1cb9('0x12')]=function(_0x3e21e0,_0xf22920){return pm2[_0x1cb9('0x13')](_0x3e21e0['params']['id'])['then'](respondWithResult(_0xf22920,null))[_0x1cb9('0xd')](handleEntityNotFound(_0xf22920,null))[_0x1cb9('0x11')](handleError(_0xf22920,null));};exports[_0x1cb9('0x14')]=function(_0x31481a,_0x280a84){if(_0x31481a[_0x1cb9('0x15')][_0x1cb9('0x7')]&&_0x31481a['body']['script']){var _0x1a5a72=path['join'](__dirname,_0x1cb9('0x16'),_0x31481a[_0x1cb9('0x15')]['script']);var _0x599275=process[_0x1cb9('0x17')]();process[_0x1cb9('0x18')](path[_0x1cb9('0x19')](_0x1a5a72));return execChildProcess()[_0x1cb9('0xd')](function(_0x45b8d3){process[_0x1cb9('0x18')](_0x599275);return pm2['start']({'name':_0x31481a['body'][_0x1cb9('0x7')],'script':_0x1a5a72});})['then'](function(_0x10a419){pm2[_0x1cb9('0x1a')]();return _0x10a419[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x280a84,0xc9))[_0x1cb9('0x11')](handleError(_0x280a84,null));}else{return _0x280a84[_0x1cb9('0x8')](0x1f4)['send']({'message':_0x1cb9('0x1b')});}};exports[_0x1cb9('0x1c')]=function(_0x4c8d76,_0xd6891c){if(_0x4c8d76[_0x1cb9('0x15')]['id']){delete _0x4c8d76[_0x1cb9('0x15')]['id'];}var _0x1804fd={'online':_0x1cb9('0x1d'),'stopped':_0x1cb9('0x1e')};if(_0x1804fd[_0x1cb9('0x1f')](_0x4c8d76[_0x1cb9('0x15')][_0x1cb9('0x8')])){return pm2[_0x1804fd[_0x4c8d76[_0x1cb9('0x15')]['status']]](_0x4c8d76[_0x1cb9('0x20')]['id'])['then'](respondWithResult(_0xd6891c,0xc8))[_0x1cb9('0x11')](handleError(_0xd6891c,null));}else{return _0xd6891c['status'](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x21')});}};exports[_0x1cb9('0x22')]=function(_0x2038aa,_0x561d89){if(_0x2038aa[_0x1cb9('0x15')]['id']){delete _0x2038aa['body']['id'];}if(_0x2038aa[_0x1cb9('0x20')]['id']){return pm2[_0x1cb9('0x23')](_0x2038aa[_0x1cb9('0x20')]['id'])['then'](function(_0xae4c7a){pm2['dump']();return _0xae4c7a[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x561d89,null))['catch'](handleError(_0x561d89,null));}else{return _0x561d89[_0x1cb9('0x8')](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x24')});}}; \ No newline at end of file +var _0xb469=['motion2','show','create','body','join','../../files/plugins','chdir','dirname','start','dump','catch','status','update','restart','hasOwnProperty','params','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','error','stack','name','send','info','index','list','then','reject','express'];(function(_0x23fc9d,_0x5ea901){var _0xa81513=function(_0x2653d6){while(--_0x2653d6){_0x23fc9d['push'](_0x23fc9d['shift']());}};_0xa81513(++_0x5ea901);}(_0xb469,0x13b));var _0x9b46=function(_0x1d9d64,_0x54f30c){_0x1d9d64=_0x1d9d64-0x0;var _0x516e87=_0xb469[_0x1d9d64];return _0x516e87;};'use strict';var _=require(_0x9b46('0x0'));var pm2=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var path=require(_0x9b46('0x4'));var exec=require(_0x9b46('0x5'))[_0x9b46('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x31f853,_0x45322f){return function(_0x538fc4){if(!_0x538fc4){_0x31f853[_0x9b46('0x7')](0x194);;}return _0x538fc4;};}function respondWithResult(_0x405d1c,_0x50b49e){_0x50b49e=_0x50b49e||0xc8;return function(_0x1b2dd3){if(_0x1b2dd3){return _0x405d1c['status'](_0x50b49e)['json'](_0x1b2dd3);}return null;};}function handleError(_0x34c0de,_0x545b6c){_0x545b6c=_0x545b6c||0x1f4;return function(_0x402595){logger[_0x9b46('0x8')](_0x402595[_0x9b46('0x9')]);if(_0x402595['name']){delete _0x402595[_0x9b46('0xa')];}_0x34c0de['status'](_0x545b6c)[_0x9b46('0xb')](_0x402595);};}function execChildProcess(){return new BPromise(function(_0x568d9a,_0x2c29a7){exec('npm\x20install',function(_0x672157,_0x233b6b,_0x563de4){logger[_0x9b46('0xc')](_0x233b6b);logger[_0x9b46('0xc')](_0x563de4);if(_0x672157){logger['error'](_0x672157);return _0x2c29a7(_0x672157);}return _0x568d9a(_0x233b6b);});});}exports[_0x9b46('0xd')]=function(_0x2cfb35,_0x3d9618){return pm2[_0x9b46('0xe')]()[_0x9b46('0xf')](function(_0x35c5c1){if(_0x35c5c1){var _0x2136bc=_[_0x9b46('0x10')](_0x35c5c1,function(_0x3f2b28){return _0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x11')||_0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x12');});return{'rows':_0x2136bc,'count':_0x2136bc['length']};}return null;})['then'](respondWithResult(_0x3d9618,null))['catch'](handleError(_0x3d9618,null));};exports[_0x9b46('0x13')]=function(_0x5a380c,_0x29fec9){return pm2['describe'](_0x5a380c['params']['id'])[_0x9b46('0xf')](respondWithResult(_0x29fec9,null))['then'](handleEntityNotFound(_0x29fec9,null))['catch'](handleError(_0x29fec9,null));};exports[_0x9b46('0x14')]=function(_0x3a15cc,_0x5a0d25){if(_0x3a15cc[_0x9b46('0x15')][_0x9b46('0xa')]&&_0x3a15cc['body']['script']){var _0xbec2ea=path[_0x9b46('0x16')](__dirname,_0x9b46('0x17'),_0x3a15cc['body']['script']);var _0x2b3440=process['cwd']();process[_0x9b46('0x18')](path[_0x9b46('0x19')](_0xbec2ea));return execChildProcess()['then'](function(_0xadff19){process['chdir'](_0x2b3440);return pm2[_0x9b46('0x1a')]({'name':_0x3a15cc[_0x9b46('0x15')]['name'],'script':_0xbec2ea});})[_0x9b46('0xf')](function(_0x31ca63){pm2[_0x9b46('0x1b')]();return _0x31ca63[0x0];})[_0x9b46('0xf')](respondWithResult(_0x5a0d25,0xc9))[_0x9b46('0x1c')](handleError(_0x5a0d25,null));}else{return _0x5a0d25[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x9b46('0x1e')]=function(_0x3ac37e,_0x478105){if(_0x3ac37e[_0x9b46('0x15')]['id']){delete _0x3ac37e[_0x9b46('0x15')]['id'];}var _0x2a79a5={'online':_0x9b46('0x1f'),'stopped':'stop'};if(_0x2a79a5[_0x9b46('0x20')](_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')])){return pm2[_0x2a79a5[_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')]]](_0x3ac37e[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](respondWithResult(_0x478105,0xc8))[_0x9b46('0x1c')](handleError(_0x478105,null));}else{return _0x478105[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':_0x9b46('0x22')});}};exports['destroy']=function(_0x1f722d,_0x27f326){if(_0x1f722d[_0x9b46('0x15')]['id']){delete _0x1f722d[_0x9b46('0x15')]['id'];}if(_0x1f722d[_0x9b46('0x21')]['id']){return pm2[_0x9b46('0x23')](_0x1f722d[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](function(_0x3ab49a){pm2[_0x9b46('0x1b')]();return _0x3ab49a[0x0];})[_0x9b46('0xf')](respondWithResult(_0x27f326,null))['catch'](handleError(_0x27f326,null));}else{return _0x27f326[_0x9b46('0x1d')](0x1f4)['send']({'message':_0x9b46('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 1f7c71d..248b79b 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 _0x3870=['getQueues','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./realtime.controller','get','isAuthenticated'];(function(_0x47c0fb,_0x579bd8){var _0x5e55ef=function(_0x7187eb){while(--_0x7187eb){_0x47c0fb['push'](_0x47c0fb['shift']());}};_0x5e55ef(++_0x579bd8);}(_0x3870,0x146));var _0x0387=function(_0x21b54a,_0x3b4932){_0x21b54a=_0x21b54a-0x0;var _0x366f51=_0x3870[_0x21b54a];return _0x366f51;};'use strict';var multer=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var path=require(_0x0387('0x2'));var timeout=require('connect-timeout');var express=require(_0x0387('0x3'));var router=express['Router']();var fs_extra=require(_0x0387('0x4'));var auth=require(_0x0387('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0387('0x6'));var controller=require(_0x0387('0x7'));router[_0x0387('0x8')]('/queues',auth[_0x0387('0x9')](),controller[_0x0387('0xa')]);module[_0x0387('0xb')]=router; \ No newline at end of file +var _0x7461=['isAuthenticated','getQueues','exports','multer','util','path','connect-timeout','express','../../config/environment','./realtime.controller','get','/queues'];(function(_0x12fdd8,_0x4e548e){var _0x3e6622=function(_0x58a0fc){while(--_0x58a0fc){_0x12fdd8['push'](_0x12fdd8['shift']());}};_0x3e6622(++_0x4e548e);}(_0x7461,0xdb));var _0x1746=function(_0x119d25,_0x588c8){_0x119d25=_0x119d25-0x0;var _0x39cf30=_0x7461[_0x119d25];return _0x39cf30;};'use strict';var multer=require(_0x1746('0x0'));var util=require(_0x1746('0x1'));var path=require(_0x1746('0x2'));var timeout=require(_0x1746('0x3'));var express=require(_0x1746('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1746('0x5'));var controller=require(_0x1746('0x6'));router[_0x1746('0x7')](_0x1746('0x8'),auth[_0x1746('0x9')](),controller[_0x1746('0xa')]);module[_0x1746('0xb')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 372e550..ced4c77 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 _0x778f=['catch','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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/license/util','../../mysqldb','jayson/promise','client','request','then','Realtime,\x20%s,\x20%s','request\x20sent','debug','Realtime,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','json','offset','undefined','count','limit','set','reject','save','update','sendStatus','name','send','getQueues','mail','chat','openchannel','fax','voice','resolve','query','channel','includes','toLowerCase','startCase','Queue','map','rawAttributes','fieldName','key','user','role','userProfileId','type','outbound','QueueCampaigns','UserProfile','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','available','waiting','paused','push','pTalking','originated','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','loggedInDb','agents','find','rows','merge','pick','online','getMembers','length','UserId','User','QueueId','Pause','findAll','agent'];(function(_0x55f454,_0x382ac3){var _0x19278a=function(_0x13b1c8){while(--_0x13b1c8){_0x55f454['push'](_0x55f454['shift']());}};_0x19278a(++_0x382ac3);}(_0x778f,0xe7));var _0xf778=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x778f[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf778('0x0'));var rp=require(_0xf778('0x1'));var moment=require(_0xf778('0x2'));var BPromise=require(_0xf778('0x3'));var Mustache=require(_0xf778('0x4'));var util=require(_0xf778('0x5'));var path=require(_0xf778('0x6'));var sox=require('sox');var csv=require(_0xf778('0x7'));var ejs=require(_0xf778('0x8'));var fs=require('fs');var fs_extra=require(_0xf778('0x9'));var _=require('lodash');var squel=require(_0xf778('0xa'));var crypto=require(_0xf778('0xb'));var jsforce=require(_0xf778('0xc'));var deskjs=require(_0xf778('0xd'));var toCsv=require(_0xf778('0x7'));var querystring=require(_0xf778('0xe'));var Papa=require(_0xf778('0xf'));var Redis=require(_0xf778('0x10'));var authService=require(_0xf778('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf778('0x12'));var hardwareService=require(_0xf778('0x13'));var logger=require(_0xf778('0x14'))(_0xf778('0x15'));var utils=require(_0xf778('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf778('0x17'));var db=require(_0xf778('0x18'))['db'];var jayson=require(_0xf778('0x19'));var client=jayson[_0xf778('0x1a')]['http']({'port':0x232a});var routingClient=jayson[_0xf778('0x1a')]['http']({'port':0x232c});function respondWithRpcPromise(_0x35a6ba,_0x4e39a4,_0x3cc82c,_0x7786eb){return new BPromise(function(_0x20c78c,_0x1908e2){var _0x4f0a3c=_0x7786eb||client;return _0x4f0a3c[_0xf778('0x1b')](_0x35a6ba,_0x3cc82c)[_0xf778('0x1c')](function(_0x4005e9){logger['info'](_0xf778('0x1d'),_0x4e39a4,_0xf778('0x1e'));logger[_0xf778('0x1f')](_0xf778('0x20'),_0x4e39a4,'request\x20sent',JSON['stringify'](_0x4005e9));if(_0x4005e9['error']){if(_0x4005e9[_0xf778('0x21')][_0xf778('0x22')]===0x1f4){logger[_0xf778('0x21')](_0xf778('0x1d'),_0x4e39a4,_0x4005e9['error']['message']);return _0x1908e2(_0x4005e9[_0xf778('0x21')]['message']);}logger[_0xf778('0x21')]('Realtime,\x20%s,\x20%s',_0x4e39a4,_0x4005e9[_0xf778('0x21')]['message']);return _0x20c78c(_0x4005e9[_0xf778('0x21')][_0xf778('0x23')]);}else{logger[_0xf778('0x24')]('Realtime,\x20%s,\x20%s',_0x4e39a4,_0xf778('0x1e'));_0x20c78c(_0x4005e9[_0xf778('0x25')][_0xf778('0x23')]);}})['catch'](function(_0x34f5cd){logger[_0xf778('0x21')](_0xf778('0x1d'),_0x4e39a4,_0x34f5cd);_0x1908e2(_0x34f5cd);});});}function respondWithStatusCode(_0x45327b,_0x4f5b9d){_0x4f5b9d=_0x4f5b9d||0xcc;return function(_0xced7e3){if(_0xced7e3){return _0x45327b['sendStatus'](_0x4f5b9d);}return _0x45327b[_0xf778('0x26')](_0x4f5b9d)['end']();};}function respondWithResult(_0x58d822,_0x477e5e){_0x477e5e=_0x477e5e||0xc8;return function(_0x838ad1){if(_0x838ad1){return _0x58d822[_0xf778('0x26')](_0x477e5e)[_0xf778('0x27')](_0x838ad1);}};}function respondWithFilteredResult(_0x11406d,_0x560823){return function(_0x48eebb){if(_0x48eebb){var _0x1d7058=typeof _0x560823[_0xf778('0x28')]===_0xf778('0x29')&&typeof _0x560823['limit']===_0xf778('0x29');var _0x5f5d94=_0x48eebb[_0xf778('0x2a')];var _0x41f729=_0x1d7058?0x0:_0x560823['offset'];var _0x43645a=_0x1d7058?_0x48eebb[_0xf778('0x2a')]:_0x560823['offset']+_0x560823[_0xf778('0x2b')];var _0x56d7bb;if(_0x43645a>=_0x5f5d94){_0x43645a=_0x5f5d94;_0x56d7bb=0xc8;}else{_0x56d7bb=0xce;}_0x11406d[_0xf778('0x26')](_0x56d7bb);return _0x11406d[_0xf778('0x2c')]('Content-Range',_0x41f729+'-'+_0x43645a+'/'+_0x5f5d94)[_0xf778('0x27')](_0x48eebb);}return null;};}function patchUpdates(_0x122775){return function(_0x21019b){try{jsonpatch['apply'](_0x21019b,_0x122775,!![]);}catch(_0x3e3f5b){return BPromise[_0xf778('0x2d')](_0x3e3f5b);}return _0x21019b[_0xf778('0x2e')]();};}function saveUpdates(_0xe03afc,_0x41836e){return function(_0x463fda){if(_0x463fda){return _0x463fda[_0xf778('0x2f')](_0xe03afc)['then'](function(_0x414fcb){return _0x414fcb;});}return null;};}function removeEntity(_0x956b26,_0x2b352a){return function(_0x312dcc){if(_0x312dcc){return _0x312dcc['destroy']()[_0xf778('0x1c')](function(){_0x956b26[_0xf778('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4df7a2,_0x23ab67){return function(_0x372328){if(!_0x372328){_0x4df7a2[_0xf778('0x30')](0x194);}return _0x372328;};}function handleError(_0x77aeeb,_0x1ff5c5){_0x1ff5c5=_0x1ff5c5||0x1f4;return function(_0x57b90c){logger[_0xf778('0x21')](_0x57b90c['stack']);if(_0x57b90c[_0xf778('0x31')]){delete _0x57b90c[_0xf778('0x31')];}_0x77aeeb[_0xf778('0x26')](_0x1ff5c5)[_0xf778('0x32')](_0x57b90c);};}exports[_0xf778('0x33')]=function(_0x1c99f2,_0x5cab29){var _0x22d8cb=[_0xf778('0x34'),_0xf778('0x35'),'sms',_0xf778('0x36'),_0xf778('0x37'),'whatsapp',_0xf778('0x38')];var _0x3b3560={'count':0x0,'rows':[]},_0x2bed7d={},_0x32926d;Promise[_0xf778('0x39')]()['then'](function(){if(_0x1c99f2[_0xf778('0x3a')][_0xf778('0x3b')]){if(!_[_0xf778('0x3c')](_0x22d8cb,_0x1c99f2[_0xf778('0x3a')][_0xf778('0x3b')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x32926d=_0x1c99f2[_0xf778('0x3a')][_0xf778('0x3b')][_0xf778('0x3d')]();}var _0x2a646c=_[_0xf778('0x3e')](_0x32926d)+_0xf778('0x3f');var _0x32f1e0=_[_0xf778('0x40')](db[_0x2a646c][_0xf778('0x41')],function(_0x44407a){return{'name':_0x44407a[_0xf778('0x42')],'type':_0x44407a['type'][_0xf778('0x43')]};});_0x2bed7d=qs['getOptions'](_0x32f1e0,_0x1c99f2);if(_0x1c99f2[_0xf778('0x44')][_0xf778('0x45')]===_0xf778('0x44')){var _0x17a518={'params':{'id':_0x1c99f2[_0xf778('0x44')][_0xf778('0x46')]},'query':{'section':_0x32926d===_0xf778('0x38')&&_0x1c99f2[_0xf778('0x3a')][_0xf778('0x47')]===_0xf778('0x48')?_0xf778('0x49'):_[_0xf778('0x3e')](_0x32926d)+'Queues','type':_0x1c99f2['query'][_0xf778('0x47')],'nolimit':!![],'sort':_0xf778('0x31'),'filter':_0x1c99f2[_0xf778('0x3a')]['filter']}};return db[_0xf778('0x4a')]['getResources'](_0x17a518);}return db[_0x2a646c]['findAndCountAll'](_0x2bed7d);})[_0xf778('0x1c')](function(_0x1f286f){_0x3b3560['count']=_0x1f286f[_0xf778('0x2a')];var _0x12f0af=_0x32926d===_0xf778('0x38')?client:routingClient;return _0x12f0af[_0xf778('0x1b')](_[_0xf778('0x3e')](_0x32926d)+'Queues',_0x1c99f2)[_0xf778('0x1c')](function(_0x9a26c2){if(_0x9a26c2[_0xf778('0x21')])throw new Error(util[_0xf778('0x4b')](_0xf778('0x4c'),_0x32926d));var _0x59672f=_0x9a26c2[_0xf778('0x25')];var _0x56c4c1=[_0xf778('0x4d'),_0xf778('0x4e'),_0xf778('0x4f'),'talking',_0xf778('0x50')];if(_0x32926d===_0xf778('0x38')&&_0x1c99f2['query'][_0xf778('0x47')]===_0xf778('0x48')){_0x56c4c1[_0xf778('0x51')](_0xf778('0x52'),_0xf778('0x53'),_0xf778('0x23'),'dialActive',_0xf778('0x54'),_0xf778('0x55'),'startPredictive',_0xf778('0x56'),_0xf778('0x57'),_0xf778('0x58'),'erlangAbandonmentRate',_0xf778('0x59'),_0xf778('0x5a'),_0xf778('0x5b'),_0xf778('0x5c'),_0xf778('0x5d'),_0xf778('0x5e'),_0xf778('0x5f'),'predictiveIntervalDroppedCallsTimeout',_0xf778('0x60'),_0xf778('0x61'),_0xf778('0x62'));}var _0x18118b=_0x1f286f['rows'][_0xf778('0x40')](function(_0x445824){var _0x29c54f=_0x445824['get']({'plain':!![]});_0x29c54f[_0xf778('0x50')]=0x0;_0x29c54f[_0xf778('0x63')]=0x0;_0x29c54f['loggedIn']=0x0;_0x29c54f['available']=0x0;_0x29c54f[_0xf778('0x50')]=0x0;_0x29c54f[_0xf778('0x4f')]=0x0;if(_0x32926d===_0xf778('0x38')){_0x29c54f['talking']=0x0;if(_0x1c99f2[_0xf778('0x3a')][_0xf778('0x47')]===_0xf778('0x48')){_0x29c54f[_0xf778('0x52')]=0x0;_0x29c54f[_0xf778('0x53')]=0x0;}}_0x29c54f[_0xf778('0x64')]=[];var _0x5d7d63=_[_0xf778('0x65')](_0x59672f[_0xf778('0x66')],['id',_0x29c54f['id']]);if(_0x5d7d63)_[_0xf778('0x67')](_0x29c54f,_[_0xf778('0x68')](_0x5d7d63,_0x56c4c1));if(_0x32926d===_0xf778('0x38')){return _0x445824['getAgents']({'attributes':['id',_0xf778('0x31'),_0xf778('0x69')],'joinTableAttributes':[],'raw':!![]})[_0xf778('0x1c')](function(_0x1cbe7b){return _0x445824[_0xf778('0x6a')]({'raw':!![]})[_0xf778('0x1c')](function(_0x2dcb97){for(var _0x237de4=0x0;_0x237de4<_0x1cbe7b[_0xf778('0x6b')];_0x237de4++){var _0x4be440=_[_0xf778('0x65')](_0x2dcb97,[_0xf778('0x6c'),_0x1cbe7b[_0x237de4]['id']]);var _0x8f2616={'id':_0x1cbe7b[_0x237de4]['id'],'name':_0x1cbe7b[_0x237de4][_0xf778('0x31')],'online':Boolean(_0x1cbe7b[_0x237de4]['online']),'paused':_0x4be440?Boolean(_0x4be440[_0xf778('0x50')]):![]};if(_0x8f2616[_0xf778('0x69')])_0x29c54f[_0xf778('0x63')]++;if(_0x8f2616[_0xf778('0x50')])_0x29c54f[_0xf778('0x50')]++;_0x29c54f[_0xf778('0x64')][_0xf778('0x51')](_0x8f2616);}return _0x29c54f;});});}else{var _0x2cc64a=_0xf778('0x6d')+_[_0xf778('0x3e')](_0x32926d)+_0xf778('0x3f');var _0x369e28=_[_0xf778('0x3e')](_0x32926d)+_0xf778('0x6e');var _0x2a289a=_0x32926d+_0xf778('0x6f');return db[_0x2cc64a][_0xf778('0x70')]({'where':{['userQueueKey']:_0x445824['id']},'raw':!![]})['then'](function(_0x358861){return db[_0xf778('0x6d')][_0xf778('0x70')]({'attributes':['id',_0xf778('0x31'),_0xf778('0x69'),_0x2a289a],'where':{'id':_['map'](_0x358861,_0xf778('0x6c')),'role':_0xf778('0x71')},'raw':!![]});})[_0xf778('0x1c')](function(_0x488356){for(var _0x20550e=0x0;_0x20550e<_0x488356['length'];_0x20550e++){var _0x4e3c91={'id':_0x488356[_0x20550e]['id'],'name':_0x488356[_0x20550e][_0xf778('0x31')],'online':Boolean(_0x488356[_0x20550e]['online']),'paused':Boolean(_0x488356[_0x20550e][_0x2a289a])};if(_0x4e3c91[_0xf778('0x69')])_0x29c54f[_0xf778('0x63')]++;if(_0x4e3c91[_0xf778('0x50')])_0x29c54f[_0xf778('0x50')]++;_0x29c54f['agents']['push'](_0x4e3c91);}return _0x29c54f;});}});return Promise['all'](_0x18118b);});})[_0xf778('0x1c')](function(_0x409aec){_0x3b3560['rows']=_0x409aec;return _0x3b3560;})[_0xf778('0x1c')](respondWithFilteredResult(_0x5cab29,_0x2bed7d))[_0xf778('0x72')](handleError(_0x5cab29,null));}; \ No newline at end of file +var _0x3ed7=['fax','voice','resolve','query','channel','toLowerCase','Invalid\x20channel','startCase','Queue','type','key','user','userProfileId','outbound','QueueCampaigns','Queues','filter','UserProfile','findAndCountAll','format','loggedIn','waiting','talking','paused','push','pTalking','originated','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','available','agents','find','rows','pick','getAgents','online','getMembers','loggedInDb','Pause','findAll','User','UserId','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Realtime,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','json','limit','count','offset','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','getQueues','chat','sms','openchannel'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0x3ed7,0x1a8));var _0x73ed=function(_0x16fc91,_0x511f25){_0x16fc91=_0x16fc91-0x0;var _0x2f9973=_0x3ed7[_0x16fc91];return _0x2f9973;};'use strict';var emlformat=require(_0x73ed('0x0'));var rimraf=require(_0x73ed('0x1'));var zipdir=require(_0x73ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73ed('0x3'));var moment=require(_0x73ed('0x4'));var BPromise=require(_0x73ed('0x5'));var Mustache=require(_0x73ed('0x6'));var util=require(_0x73ed('0x7'));var path=require(_0x73ed('0x8'));var sox=require(_0x73ed('0x9'));var csv=require(_0x73ed('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73ed('0xb'));var _=require(_0x73ed('0xc'));var squel=require(_0x73ed('0xd'));var crypto=require(_0x73ed('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x73ed('0xf'));var toCsv=require(_0x73ed('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x73ed('0x10'));var authService=require(_0x73ed('0x11'));var qs=require(_0x73ed('0x12'));var as=require(_0x73ed('0x13'));var hardwareService=require(_0x73ed('0x14'));var logger=require(_0x73ed('0x15'))(_0x73ed('0x16'));var utils=require(_0x73ed('0x17'));var config=require(_0x73ed('0x18'));var licenseUtil=require(_0x73ed('0x19'));var db=require(_0x73ed('0x1a'))['db'];var jayson=require(_0x73ed('0x1b'));var client=jayson[_0x73ed('0x1c')][_0x73ed('0x1d')]({'port':0x232a});var routingClient=jayson['client'][_0x73ed('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x109029,_0x134b91,_0x1bfca6,_0xcfe78b){return new BPromise(function(_0x283c8e,_0x1c1bfd){var _0x59e4bb=_0xcfe78b||client;return _0x59e4bb[_0x73ed('0x1e')](_0x109029,_0x1bfca6)['then'](function(_0x2c31a3){logger[_0x73ed('0x1f')](_0x73ed('0x20'),_0x134b91,_0x73ed('0x21'));logger[_0x73ed('0x22')]('Realtime,\x20%s,\x20%s,\x20%s',_0x134b91,'request\x20sent',JSON[_0x73ed('0x23')](_0x2c31a3));if(_0x2c31a3[_0x73ed('0x24')]){if(_0x2c31a3['error'][_0x73ed('0x25')]===0x1f4){logger[_0x73ed('0x24')](_0x73ed('0x20'),_0x134b91,_0x2c31a3['error'][_0x73ed('0x26')]);return _0x1c1bfd(_0x2c31a3[_0x73ed('0x24')][_0x73ed('0x26')]);}logger[_0x73ed('0x24')]('Realtime,\x20%s,\x20%s',_0x134b91,_0x2c31a3[_0x73ed('0x24')][_0x73ed('0x26')]);return _0x283c8e(_0x2c31a3[_0x73ed('0x24')][_0x73ed('0x26')]);}else{logger['info']('Realtime,\x20%s,\x20%s',_0x134b91,_0x73ed('0x21'));_0x283c8e(_0x2c31a3['result'][_0x73ed('0x26')]);}})[_0x73ed('0x27')](function(_0x22a7a5){logger['error'](_0x73ed('0x20'),_0x134b91,_0x22a7a5);_0x1c1bfd(_0x22a7a5);});});}function respondWithStatusCode(_0x20222e,_0x271267){_0x271267=_0x271267||0xcc;return function(_0x412615){if(_0x412615){return _0x20222e['sendStatus'](_0x271267);}return _0x20222e[_0x73ed('0x28')](_0x271267)[_0x73ed('0x29')]();};}function respondWithResult(_0x1572c2,_0xcffdc8){_0xcffdc8=_0xcffdc8||0xc8;return function(_0x2bb2e4){if(_0x2bb2e4){return _0x1572c2[_0x73ed('0x28')](_0xcffdc8)[_0x73ed('0x2a')](_0x2bb2e4);}};}function respondWithFilteredResult(_0x4a6d7d,_0x2980b5){return function(_0x89678a){if(_0x89678a){var _0x347e05=typeof _0x2980b5['offset']==='undefined'&&typeof _0x2980b5[_0x73ed('0x2b')]==='undefined';var _0x3f3969=_0x89678a[_0x73ed('0x2c')];var _0x257583=_0x347e05?0x0:_0x2980b5['offset'];var _0x48dda4=_0x347e05?_0x89678a['count']:_0x2980b5[_0x73ed('0x2d')]+_0x2980b5[_0x73ed('0x2b')];var _0x29b296;if(_0x48dda4>=_0x3f3969){_0x48dda4=_0x3f3969;_0x29b296=0xc8;}else{_0x29b296=0xce;}_0x4a6d7d[_0x73ed('0x28')](_0x29b296);return _0x4a6d7d['set'](_0x73ed('0x2e'),_0x257583+'-'+_0x48dda4+'/'+_0x3f3969)[_0x73ed('0x2a')](_0x89678a);}return null;};}function patchUpdates(_0x417828){return function(_0x3e2ec5){try{jsonpatch[_0x73ed('0x2f')](_0x3e2ec5,_0x417828,!![]);}catch(_0x2a1a33){return BPromise[_0x73ed('0x30')](_0x2a1a33);}return _0x3e2ec5[_0x73ed('0x31')]();};}function saveUpdates(_0x17b34b,_0x5b3b90){return function(_0x1ca049){if(_0x1ca049){return _0x1ca049['update'](_0x17b34b)[_0x73ed('0x32')](function(_0x1f35f3){return _0x1f35f3;});}return null;};}function removeEntity(_0x474d2f,_0x1bac9a){return function(_0x30cd82){if(_0x30cd82){return _0x30cd82[_0x73ed('0x33')]()[_0x73ed('0x32')](function(){_0x474d2f[_0x73ed('0x28')](0xcc)[_0x73ed('0x29')]();});}};}function handleEntityNotFound(_0x126a1f,_0x2e33d4){return function(_0x4c5bf9){if(!_0x4c5bf9){_0x126a1f[_0x73ed('0x34')](0x194);}return _0x4c5bf9;};}function handleError(_0x9e97cd,_0x476a74){_0x476a74=_0x476a74||0x1f4;return function(_0x3420ec){logger[_0x73ed('0x24')](_0x3420ec[_0x73ed('0x35')]);if(_0x3420ec[_0x73ed('0x36')]){delete _0x3420ec[_0x73ed('0x36')];}_0x9e97cd[_0x73ed('0x28')](_0x476a74)[_0x73ed('0x37')](_0x3420ec);};}exports[_0x73ed('0x38')]=function(_0x4a371d,_0x2dc023){var _0x48cfd8=['mail',_0x73ed('0x39'),_0x73ed('0x3a'),_0x73ed('0x3b'),_0x73ed('0x3c'),'whatsapp',_0x73ed('0x3d')];var _0x56e58b={'count':0x0,'rows':[]},_0x4a8aac={},_0xb8ab96;Promise[_0x73ed('0x3e')]()[_0x73ed('0x32')](function(){if(_0x4a371d[_0x73ed('0x3f')][_0x73ed('0x40')]){if(!_['includes'](_0x48cfd8,_0x4a371d[_0x73ed('0x3f')][_0x73ed('0x40')][_0x73ed('0x41')]()))throw new Error(_0x73ed('0x42'));_0xb8ab96=_0x4a371d[_0x73ed('0x3f')]['channel']['toLowerCase']();}var _0x3ddd83=_[_0x73ed('0x43')](_0xb8ab96)+_0x73ed('0x44');var _0x183056=_['map'](db[_0x3ddd83]['rawAttributes'],function(_0x54d9c6){return{'name':_0x54d9c6['fieldName'],'type':_0x54d9c6[_0x73ed('0x45')][_0x73ed('0x46')]};});_0x4a8aac=qs['getOptions'](_0x183056,_0x4a371d);if(_0x4a371d[_0x73ed('0x47')]['role']==='user'){var _0x2d4b94={'params':{'id':_0x4a371d[_0x73ed('0x47')][_0x73ed('0x48')]},'query':{'section':_0xb8ab96===_0x73ed('0x3d')&&_0x4a371d[_0x73ed('0x3f')][_0x73ed('0x45')]===_0x73ed('0x49')?_0x73ed('0x4a'):_['startCase'](_0xb8ab96)+_0x73ed('0x4b'),'type':_0x4a371d[_0x73ed('0x3f')][_0x73ed('0x45')],'nolimit':!![],'sort':_0x73ed('0x36'),'filter':_0x4a371d[_0x73ed('0x3f')][_0x73ed('0x4c')]}};return db[_0x73ed('0x4d')]['getResources'](_0x2d4b94);}return db[_0x3ddd83][_0x73ed('0x4e')](_0x4a8aac);})[_0x73ed('0x32')](function(_0x1e1c56){_0x56e58b[_0x73ed('0x2c')]=_0x1e1c56['count'];var _0x3ef3a8=_0xb8ab96===_0x73ed('0x3d')?client:routingClient;return _0x3ef3a8[_0x73ed('0x1e')](_['startCase'](_0xb8ab96)+_0x73ed('0x4b'),_0x4a371d)['then'](function(_0x4cd3a5){if(_0x4cd3a5['error'])throw new Error(util[_0x73ed('0x4f')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0xb8ab96));var _0x2ab4b7=_0x4cd3a5['result'];var _0x1a7474=[_0x73ed('0x50'),'available',_0x73ed('0x51'),_0x73ed('0x52'),_0x73ed('0x53')];if(_0xb8ab96===_0x73ed('0x3d')&&_0x4a371d[_0x73ed('0x3f')][_0x73ed('0x45')]==='outbound'){_0x1a7474[_0x73ed('0x54')](_0x73ed('0x55'),_0x73ed('0x56'),'message',_0x73ed('0x57'),_0x73ed('0x58'),'Trunk',_0x73ed('0x59'),_0x73ed('0x5a'),_0x73ed('0x5b'),_0x73ed('0x5c'),_0x73ed('0x5d'),_0x73ed('0x5e'),_0x73ed('0x5f'),_0x73ed('0x60'),_0x73ed('0x61'),_0x73ed('0x62'),_0x73ed('0x63'),_0x73ed('0x64'),_0x73ed('0x65'),_0x73ed('0x66'),_0x73ed('0x67'),_0x73ed('0x68'));}var _0x1e327d=_0x1e1c56['rows'][_0x73ed('0x69')](function(_0x2d58d2){var _0x1d6dbe=_0x2d58d2[_0x73ed('0x6a')]({'plain':!![]});_0x1d6dbe['paused']=0x0;_0x1d6dbe['loggedInDb']=0x0;_0x1d6dbe[_0x73ed('0x50')]=0x0;_0x1d6dbe[_0x73ed('0x6b')]=0x0;_0x1d6dbe[_0x73ed('0x53')]=0x0;_0x1d6dbe[_0x73ed('0x51')]=0x0;if(_0xb8ab96===_0x73ed('0x3d')){_0x1d6dbe[_0x73ed('0x52')]=0x0;if(_0x4a371d['query'][_0x73ed('0x45')]==='outbound'){_0x1d6dbe[_0x73ed('0x55')]=0x0;_0x1d6dbe[_0x73ed('0x56')]=0x0;}}_0x1d6dbe[_0x73ed('0x6c')]=[];var _0x21b6cd=_[_0x73ed('0x6d')](_0x2ab4b7[_0x73ed('0x6e')],['id',_0x1d6dbe['id']]);if(_0x21b6cd)_['merge'](_0x1d6dbe,_[_0x73ed('0x6f')](_0x21b6cd,_0x1a7474));if(_0xb8ab96==='voice'){return _0x2d58d2[_0x73ed('0x70')]({'attributes':['id','name',_0x73ed('0x71')],'joinTableAttributes':[],'raw':!![]})[_0x73ed('0x32')](function(_0x551bbc){return _0x2d58d2[_0x73ed('0x72')]({'raw':!![]})[_0x73ed('0x32')](function(_0xb8595d){for(var _0xbfc440=0x0;_0xbfc440<_0x551bbc['length'];_0xbfc440++){var _0x452174=_[_0x73ed('0x6d')](_0xb8595d,['UserId',_0x551bbc[_0xbfc440]['id']]);var _0x8e376={'id':_0x551bbc[_0xbfc440]['id'],'name':_0x551bbc[_0xbfc440]['name'],'online':Boolean(_0x551bbc[_0xbfc440]['online']),'paused':_0x452174?Boolean(_0x452174[_0x73ed('0x53')]):![]};if(_0x8e376[_0x73ed('0x71')])_0x1d6dbe[_0x73ed('0x73')]++;if(_0x8e376[_0x73ed('0x53')])_0x1d6dbe['paused']++;_0x1d6dbe[_0x73ed('0x6c')]['push'](_0x8e376);}return _0x1d6dbe;});});}else{var _0xa4e8ad='User'+_['startCase'](_0xb8ab96)+'Queue';var _0x3f590c=_[_0x73ed('0x43')](_0xb8ab96)+'QueueId';var _0x46c933=_0xb8ab96+_0x73ed('0x74');return db[_0xa4e8ad][_0x73ed('0x75')]({'where':{['userQueueKey']:_0x2d58d2['id']},'raw':!![]})[_0x73ed('0x32')](function(_0xcd4e16){return db[_0x73ed('0x76')]['findAll']({'attributes':['id',_0x73ed('0x36'),'online',_0x46c933],'where':{'id':_[_0x73ed('0x69')](_0xcd4e16,_0x73ed('0x77')),'role':'agent'},'raw':!![]});})[_0x73ed('0x32')](function(_0x3a76ed){for(var _0x529ca4=0x0;_0x529ca4<_0x3a76ed['length'];_0x529ca4++){var _0x8b00b7={'id':_0x3a76ed[_0x529ca4]['id'],'name':_0x3a76ed[_0x529ca4][_0x73ed('0x36')],'online':Boolean(_0x3a76ed[_0x529ca4]['online']),'paused':Boolean(_0x3a76ed[_0x529ca4][_0x46c933])};if(_0x8b00b7[_0x73ed('0x71')])_0x1d6dbe[_0x73ed('0x73')]++;if(_0x8b00b7[_0x73ed('0x53')])_0x1d6dbe[_0x73ed('0x53')]++;_0x1d6dbe[_0x73ed('0x6c')][_0x73ed('0x54')](_0x8b00b7);}return _0x1d6dbe;});}});return Promise[_0x73ed('0x78')](_0x1e327d);});})[_0x73ed('0x32')](function(_0x35dac5){_0x56e58b[_0x73ed('0x6e')]=_0x35dac5;return _0x56e58b;})[_0x73ed('0x32')](respondWithFilteredResult(_0x2dc023,_0x4a8aac))['catch'](handleError(_0x2dc023,null));}; \ No newline at end of file diff --git a/server/api/realtime/realtime.model.js b/server/api/realtime/realtime.model.js index 048b8a6..1a03441 100644 --- a/server/api/realtime/realtime.model.js +++ b/server/api/realtime/realtime.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f24=['Realtime','lodash','util','../../config/logger','api','moment','request-promise','path','exports','define'];(function(_0x250efd,_0x22d8ea){var _0x2b5660=function(_0x59107d){while(--_0x59107d){_0x250efd['push'](_0x250efd['shift']());}};_0x2b5660(++_0x22d8ea);}(_0x8f24,0x6f));var _0x48f2=function(_0x41ff5e,_0x10fab1){_0x41ff5e=_0x41ff5e-0x0;var _0x31f4cd=_0x8f24[_0x41ff5e];return _0x31f4cd;};'use strict';var _=require(_0x48f2('0x0'));var util=require(_0x48f2('0x1'));var logger=require(_0x48f2('0x2'))(_0x48f2('0x3'));var moment=require(_0x48f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x48f2('0x5'));var fs=require('fs');var path=require(_0x48f2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');;module[_0x48f2('0x7')]=function(_0x458019,_0x2b04f9){return _0x458019[_0x48f2('0x8')](_0x48f2('0x9'),[],{});}; \ No newline at end of file +var _0xc1cf=['path','rimraf','../../config/environment','exports','Realtime','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2671e2,_0x34fc62){var _0x5e7be9=function(_0x4b0154){while(--_0x4b0154){_0x2671e2['push'](_0x2671e2['shift']());}};_0x5e7be9(++_0x34fc62);}(_0xc1cf,0x165));var _0xfc1c=function(_0x4b252d,_0x3c054d){_0x4b252d=_0x4b252d-0x0;var _0x3b62d1=_0xc1cf[_0x4b252d];return _0x3b62d1;};'use strict';var _=require(_0xfc1c('0x0'));var util=require(_0xfc1c('0x1'));var logger=require(_0xfc1c('0x2'))(_0xfc1c('0x3'));var moment=require(_0xfc1c('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc1c('0x5'));var fs=require('fs');var path=require(_0xfc1c('0x6'));var rimraf=require(_0xfc1c('0x7'));var config=require(_0xfc1c('0x8'));;module[_0xfc1c('0x9')]=function(_0x13b9e2,_0x440483){return _0x13b9e2['define'](_0xfc1c('0xa'),[],{});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index fd8bb0f..6da1db4 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x728a0d,_0x44ca89){var _0xc575ed=function(_0x418c03){while(--_0x418c03){_0x728a0d['push'](_0x728a0d['shift']());}};_0xc575ed(++_0x44ca89);}(_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(_0x433fc0,_0x3e3711){var _0x3956bb=function(_0x232b9d){while(--_0x232b9d){_0x433fc0['push'](_0x433fc0['shift']());}};_0x3956bb(++_0x3e3711);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e95bc7c..1074b96 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 _0x1ffe=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x5320de,_0x3883d8){var _0x9c3271=function(_0x3c09c9){while(--_0x3c09c9){_0x5320de['push'](_0x5320de['shift']());}};_0x9c3271(++_0x3883d8);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x56baa1,_0x5535a9){_0x56baa1=_0x56baa1-0x0;var _0x186f56=_0x1ffe[_0x56baa1];return _0x186f56;};'use strict';var Sequelize=require(_0xe1ff('0x0'));module[_0xe1ff('0x1')]={'state':{'type':Sequelize[_0xe1ff('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe1ff('0x3')]},'scheduledat':{'type':Sequelize[_0xe1ff('0x4')]},'uniqueid':{'type':Sequelize[_0xe1ff('0x3')]},'starttime':{'type':Sequelize[_0xe1ff('0x4')]},'responsetime':{'type':Sequelize[_0xe1ff('0x4')]},'ringtime':{'type':Sequelize[_0xe1ff('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xe1ff('0x3')]},'campaigntype':{'type':Sequelize[_0xe1ff('0x3')]},'membername':{'type':Sequelize[_0xe1ff('0x3')]}}; \ No newline at end of file +var _0x644f=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0xb6723c,_0x147da9){var _0x5d9aab=function(_0x3ebbf3){while(--_0x3ebbf3){_0xb6723c['push'](_0xb6723c['shift']());}};_0x5d9aab(++_0x147da9);}(_0x644f,0xc2));var _0xf644=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x644f[_0x378b4];return _0x11d07b;};'use strict';var Sequelize=require(_0xf644('0x0'));module[_0xf644('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf644('0x2')]},'uniqueid':{'type':Sequelize[_0xf644('0x3')]},'starttime':{'type':Sequelize[_0xf644('0x2')]},'responsetime':{'type':Sequelize[_0xf644('0x2')]},'ringtime':{'type':Sequelize[_0xf644('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf644('0x3')]},'campaigntype':{'type':Sequelize[_0xf644('0x3')]},'membername':{'type':Sequelize[_0xf644('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0e271b7..b7a3337 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 _0xef7e=['exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes'];(function(_0x5a891b,_0x1985d6){var _0x3a1027=function(_0x1dc4a7){while(--_0x1dc4a7){_0x5a891b['push'](_0x5a891b['shift']());}};_0x3a1027(++_0x1985d6);}(_0xef7e,0x1b4));var _0xeef7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xef7e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeef7('0x0'));var util=require('util');var logger=require(_0xeef7('0x1'))(_0xeef7('0x2'));var moment=require(_0xeef7('0x3'));var BPromise=require(_0xeef7('0x4'));var rp=require(_0xeef7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeef7('0x6'));var attributes=require(_0xeef7('0x7'));module[_0xeef7('0x8')]=function(_0x334e09,_0x1997f4){return _0x334e09[_0xeef7('0x9')](_0xeef7('0xa'),attributes,{'tableName':_0xeef7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf82e=['report_agent_preview','util','../../config/logger','api','moment','bluebird','request-promise','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x44f208,_0x15a36b){var _0x42ce64=function(_0x3a2337){while(--_0x3a2337){_0x44f208['push'](_0x44f208['shift']());}};_0x42ce64(++_0x15a36b);}(_0xf82e,0xb5));var _0xef82=function(_0x35d7e3,_0x2489dc){_0x35d7e3=_0x35d7e3-0x0;var _0xcd2635=_0xf82e[_0x35d7e3];return _0xcd2635;};'use strict';var _=require('lodash');var util=require(_0xef82('0x0'));var logger=require(_0xef82('0x1'))(_0xef82('0x2'));var moment=require(_0xef82('0x3'));var BPromise=require(_0xef82('0x4'));var rp=require(_0xef82('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef82('0x6'));module['exports']=function(_0x3cf5ef,_0x41a080){return _0x3cf5ef['define'](_0xef82('0x7'),attributes,{'tableName':_0xef82('0x8'),'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 551d88a..defc05e 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 _0x29b5=['../../config/logger','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ReportAgentPreview','create','options','CreateReportAgentPreview','catch','lodash','util','moment','randomstring','../../config/utils'];(function(_0x37cfb6,_0x4a9b59){var _0x5390ed=function(_0x506f0c){while(--_0x506f0c){_0x37cfb6['push'](_0x37cfb6['shift']());}};_0x5390ed(++_0x4a9b59);}(_0x29b5,0x103));var _0x529b=function(_0x507dfc,_0x1651c0){_0x507dfc=_0x507dfc-0x0;var _0x29d881=_0x29b5[_0x507dfc];return _0x29d881;};'use strict';var _=require(_0x529b('0x0'));var util=require(_0x529b('0x1'));var moment=require(_0x529b('0x2'));var BPromise=require('bluebird');var rs=require(_0x529b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x529b('0x4'));var logger=require(_0x529b('0x5'))('rpc');var config=require(_0x529b('0x6'));var jayson=require(_0x529b('0x7'));var client=jayson[_0x529b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x193107,_0xbc0054,_0x570de6){return new BPromise(function(_0x2542a8,_0x5b0750){return client['request'](_0x193107,_0x570de6)[_0x529b('0x9')](function(_0x20d390){logger[_0x529b('0xa')](_0x529b('0xb'),_0xbc0054,_0x529b('0xc'));logger['debug'](_0x529b('0xd'),_0xbc0054,_0x529b('0xc'),JSON[_0x529b('0xe')](_0x20d390));if(_0x20d390[_0x529b('0xf')]){if(_0x20d390[_0x529b('0xf')][_0x529b('0x10')]===0x1f4){logger[_0x529b('0xf')](_0x529b('0xb'),_0xbc0054,_0x20d390[_0x529b('0xf')][_0x529b('0x11')]);return _0x5b0750(_0x20d390['error'][_0x529b('0x11')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xbc0054,_0x20d390[_0x529b('0xf')]['message']);return _0x2542a8(_0x20d390[_0x529b('0xf')]['message']);}else{logger[_0x529b('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0xbc0054,_0x529b('0xc'));_0x2542a8(_0x20d390[_0x529b('0x12')]['message']);}})['catch'](function(_0xe96b8d){logger[_0x529b('0xf')](_0x529b('0xb'),_0xbc0054,_0xe96b8d);_0x5b0750(_0xe96b8d);});});}exports['CreateReportAgentPreview']=function(_0x55840f){var _0xc7a6f9=this;return new Promise(function(_0x52bc7d,_0x2609d5){return db[_0x529b('0x13')][_0x529b('0x14')](_0x55840f['body'],{'raw':_0x55840f[_0x529b('0x15')]?_0x55840f['options']['raw']===undefined?!![]:![]:!![]})[_0x529b('0x9')](function(_0x23e751){logger[_0x529b('0xa')](_0x529b('0x16'),_0x55840f);logger['debug'](_0x529b('0x16'),_0x55840f,JSON[_0x529b('0xe')](_0x23e751));_0x52bc7d(_0x23e751);})[_0x529b('0x17')](function(_0x242d1f){logger[_0x529b('0xf')](_0x529b('0x16'),_0x242d1f[_0x529b('0x11')],_0x55840f);_0x2609d5(_0xc7a6f9[_0x529b('0xf')](0x1f4,_0x242d1f[_0x529b('0x11')]));});});}; \ No newline at end of file +var _0x1c8e=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment'];(function(_0x41dc00,_0x80a32){var _0x5f511d=function(_0x1021c4){while(--_0x1021c4){_0x41dc00['push'](_0x41dc00['shift']());}};_0x5f511d(++_0x80a32);}(_0x1c8e,0x1e3));var _0xe1c8=function(_0x66b27c,_0x137ea3){_0x66b27c=_0x66b27c-0x0;var _0x1ba4a7=_0x1c8e[_0x66b27c];return _0x1ba4a7;};'use strict';var _=require(_0xe1c8('0x0'));var util=require(_0xe1c8('0x1'));var moment=require(_0xe1c8('0x2'));var BPromise=require(_0xe1c8('0x3'));var rs=require(_0xe1c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe1c8('0x5'));var logger=require(_0xe1c8('0x6'))(_0xe1c8('0x7'));var config=require(_0xe1c8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe1c8('0x9')][_0xe1c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a077b,_0xcff69b,_0x332673){return new BPromise(function(_0x382884,_0x4ea8ae){return client[_0xe1c8('0xb')](_0x2a077b,_0x332673)[_0xe1c8('0xc')](function(_0x216270){logger[_0xe1c8('0xd')](_0xe1c8('0xe'),_0xcff69b,_0xe1c8('0xf'));logger[_0xe1c8('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0xcff69b,_0xe1c8('0xf'),JSON[_0xe1c8('0x11')](_0x216270));if(_0x216270[_0xe1c8('0x12')]){if(_0x216270[_0xe1c8('0x12')]['code']===0x1f4){logger['error'](_0xe1c8('0xe'),_0xcff69b,_0x216270[_0xe1c8('0x12')]['message']);return _0x4ea8ae(_0x216270[_0xe1c8('0x12')][_0xe1c8('0x13')]);}logger[_0xe1c8('0x12')](_0xe1c8('0xe'),_0xcff69b,_0x216270['error'][_0xe1c8('0x13')]);return _0x382884(_0x216270[_0xe1c8('0x12')][_0xe1c8('0x13')]);}else{logger[_0xe1c8('0xd')](_0xe1c8('0xe'),_0xcff69b,_0xe1c8('0xf'));_0x382884(_0x216270['result'][_0xe1c8('0x13')]);}})[_0xe1c8('0x14')](function(_0x303418){logger[_0xe1c8('0x12')](_0xe1c8('0xe'),_0xcff69b,_0x303418);_0x4ea8ae(_0x303418);});});}exports[_0xe1c8('0x15')]=function(_0x1db674){var _0x5ca4fb=this;return new Promise(function(_0x1f98fb,_0x515c71){return db[_0xe1c8('0x16')][_0xe1c8('0x17')](_0x1db674[_0xe1c8('0x18')],{'raw':_0x1db674[_0xe1c8('0x19')]?_0x1db674[_0xe1c8('0x19')][_0xe1c8('0x1a')]===undefined?!![]:![]:!![]})[_0xe1c8('0xc')](function(_0x5800b1){logger[_0xe1c8('0xd')](_0xe1c8('0x15'),_0x1db674);logger[_0xe1c8('0x10')]('CreateReportAgentPreview',_0x1db674,JSON[_0xe1c8('0x11')](_0x5800b1));_0x1f98fb(_0x5800b1);})[_0xe1c8('0x14')](function(_0x32046c){logger[_0xe1c8('0x12')](_0xe1c8('0x15'),_0x32046c[_0xe1c8('0x13')],_0x1db674);_0x515c71(_0x5ca4fb[_0xe1c8('0x12')](0x1f4,_0x32046c['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 5012686..4abfb12 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 _0x8928=['/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x8928,0x83));var _0x8892=function(_0x4b17b8,_0x26aabe){_0x4b17b8=_0x4b17b8-0x0;var _0x414f8d=_0x8928[_0x4b17b8];return _0x414f8d;};'use strict';var multer=require(_0x8892('0x0'));var util=require(_0x8892('0x1'));var path=require(_0x8892('0x2'));var express=require('express');var router=express[_0x8892('0x3')]();var auth=require(_0x8892('0x4'));var controller=require(_0x8892('0x5'));router[_0x8892('0x6')](_0x8892('0x7'),auth[_0x8892('0x8')](),controller[_0x8892('0x9')]);router[_0x8892('0x6')](_0x8892('0xa'),auth[_0x8892('0x8')](),controller['voiceChannelMixMonitor']);router[_0x8892('0x6')](_0x8892('0xb'),auth[_0x8892('0x8')](),controller[_0x8892('0xc')]);router[_0x8892('0x6')](_0x8892('0xd'),auth[_0x8892('0x8')](),controller[_0x8892('0xe')]);router[_0x8892('0x6')]('/chat/queues',auth['isAuthenticated'](),controller[_0x8892('0xf')]);router['get']('/mail/queues',auth[_0x8892('0x8')](),controller[_0x8892('0x10')]);router[_0x8892('0x6')](_0x8892('0x11'),auth[_0x8892('0x8')](),controller[_0x8892('0x12')]);router['get'](_0x8892('0x13'),auth[_0x8892('0x8')](),controller[_0x8892('0x14')]);router[_0x8892('0x6')]('/sms/queues',auth[_0x8892('0x8')](),controller[_0x8892('0x15')]);router['get'](_0x8892('0x16'),auth['isAuthenticated'](),controller[_0x8892('0x17')]);router[_0x8892('0x6')](_0x8892('0x18'),auth[_0x8892('0x8')](),controller[_0x8892('0x19')]);router['get'](_0x8892('0x1a'),auth[_0x8892('0x8')](),controller[_0x8892('0x1b')]);router[_0x8892('0x6')](_0x8892('0x1c'),auth[_0x8892('0x8')](),controller[_0x8892('0x1d')]);router[_0x8892('0x6')](_0x8892('0x1e'),auth[_0x8892('0x8')](),controller[_0x8892('0x1f')]);router[_0x8892('0x6')](_0x8892('0x20'),auth['isAuthenticated'](),controller[_0x8892('0x21')]);router['get'](_0x8892('0x22'),auth[_0x8892('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0x8892('0x6')](_0x8892('0x23'),auth[_0x8892('0x8')](),controller[_0x8892('0x24')]);router[_0x8892('0x25')](_0x8892('0x23'),auth[_0x8892('0x8')](),controller[_0x8892('0x26')]);router[_0x8892('0x6')](_0x8892('0x27'),auth[_0x8892('0x8')](),controller[_0x8892('0x28')]);router[_0x8892('0x6')](_0x8892('0x29'),auth['isAuthenticated'](),controller[_0x8892('0x2a')]);router[_0x8892('0x6')](_0x8892('0x2b'),auth[_0x8892('0x8')](),controller[_0x8892('0x2c')]);router['put'](_0x8892('0x2d'),auth['isAuthenticated'](),controller[_0x8892('0x2e')]);router[_0x8892('0x6')](_0x8892('0x2f'),auth[_0x8892('0x8')](),controller[_0x8892('0x30')]);router[_0x8892('0x6')](_0x8892('0x31'),auth[_0x8892('0x8')](),controller[_0x8892('0x32')]);router[_0x8892('0x6')](_0x8892('0x33'),auth['isAuthenticated'](),controller['campaigns']);router[_0x8892('0x6')](_0x8892('0x34'),auth[_0x8892('0x8')](),controller[_0x8892('0x35')]);router[_0x8892('0x6')](_0x8892('0x36'),auth[_0x8892('0x8')](),controller[_0x8892('0x37')]);router[_0x8892('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router['get'](_0x8892('0x38'),auth[_0x8892('0x8')](),controller[_0x8892('0x39')]);router['get'](_0x8892('0x3a'),auth[_0x8892('0x8')](),controller[_0x8892('0x3b')]);router[_0x8892('0x6')](_0x8892('0x3c'),auth[_0x8892('0x8')](),controller[_0x8892('0x3d')]);router[_0x8892('0x6')](_0x8892('0x3e'),auth[_0x8892('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x8892('0x6')](_0x8892('0x3f'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router['post']('/mail/queues/:id/notify',auth[_0x8892('0x8')](),controller['queueNotify']('mail'));router['get'](_0x8892('0x40'),auth[_0x8892('0x8')](),controller[_0x8892('0x41')]);router[_0x8892('0x42')](_0x8892('0x43'),auth[_0x8892('0x8')](),controller[_0x8892('0x44')]('chat'));router['get'](_0x8892('0x45'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x8892('0x42')](_0x8892('0x46'),auth[_0x8892('0x8')](),controller['queueNotify'](_0x8892('0x47')));router[_0x8892('0x6')](_0x8892('0x48'),auth[_0x8892('0x8')](),controller[_0x8892('0x49')]);router[_0x8892('0x42')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x8892('0x44')](_0x8892('0x4a')));router[_0x8892('0x6')](_0x8892('0x4b'),auth['isAuthenticated'](),controller[_0x8892('0x4c')]);router[_0x8892('0x42')](_0x8892('0x4d'),auth[_0x8892('0x8')](),controller[_0x8892('0x44')](_0x8892('0x4e')));router[_0x8892('0x42')](_0x8892('0x4f'),auth[_0x8892('0x8')](),controller[_0x8892('0x44')](_0x8892('0x50')));router[_0x8892('0x6')](_0x8892('0x51'),auth['isAuthenticated'](),controller[_0x8892('0x52')]);router[_0x8892('0x6')](_0x8892('0x53'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x8892('0x42')](_0x8892('0x54'),auth[_0x8892('0x8')](),controller[_0x8892('0x55')]);module[_0x8892('0x56')]=router; \ No newline at end of file +var _0x88a5=['/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','queueNotify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','util','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesChannels'];(function(_0x4e8c36,_0x5f138b){var _0x4c33de=function(_0x57034d){while(--_0x57034d){_0x4e8c36['push'](_0x4e8c36['shift']());}};_0x4c33de(++_0x5f138b);}(_0x88a5,0x80));var _0x588a=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x88a5[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require('multer');var util=require(_0x588a('0x0'));var path=require('path');var express=require('express');var router=express[_0x588a('0x1')]();var auth=require(_0x588a('0x2'));var controller=require('./rpc.controller');router[_0x588a('0x3')](_0x588a('0x4'),auth[_0x588a('0x5')](),controller[_0x588a('0x6')]);router[_0x588a('0x3')](_0x588a('0x7'),auth[_0x588a('0x5')](),controller[_0x588a('0x8')]);router[_0x588a('0x3')](_0x588a('0x9'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router['get'](_0x588a('0xa'),auth['isAuthenticated'](),controller[_0x588a('0xb')]);router[_0x588a('0x3')](_0x588a('0xc'),auth[_0x588a('0x5')](),controller[_0x588a('0xd')]);router[_0x588a('0x3')]('/mail/queues',auth[_0x588a('0x5')](),controller[_0x588a('0xe')]);router[_0x588a('0x3')](_0x588a('0xf'),auth[_0x588a('0x5')](),controller[_0x588a('0x10')]);router[_0x588a('0x3')]('/openchannel/queues',auth[_0x588a('0x5')](),controller[_0x588a('0x11')]);router[_0x588a('0x3')](_0x588a('0x12'),auth[_0x588a('0x5')](),controller['smsQueues']);router[_0x588a('0x3')](_0x588a('0x13'),auth[_0x588a('0x5')](),controller[_0x588a('0x14')]);router['get'](_0x588a('0x15'),auth[_0x588a('0x5')](),controller['faxQueues']);router[_0x588a('0x3')](_0x588a('0x16'),auth[_0x588a('0x5')](),controller['voiceQueuesPreview']);router[_0x588a('0x3')]('/voice/queues/channels',auth[_0x588a('0x5')](),controller[_0x588a('0x17')]);router[_0x588a('0x3')](_0x588a('0x18'),auth[_0x588a('0x5')](),controller['voiceQueuesChannel']);router[_0x588a('0x3')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x588a('0x5')](),controller[_0x588a('0x19')]);router[_0x588a('0x3')](_0x588a('0x1a'),auth[_0x588a('0x5')](),controller[_0x588a('0x1b')]);router[_0x588a('0x3')](_0x588a('0x1c'),auth[_0x588a('0x5')](),controller['showVoiceQueues']);router[_0x588a('0x1d')](_0x588a('0x1c'),auth[_0x588a('0x5')](),controller[_0x588a('0x1e')]);router[_0x588a('0x3')]('/outbound',auth[_0x588a('0x5')](),controller[_0x588a('0x1f')]);router[_0x588a('0x3')](_0x588a('0x20'),auth[_0x588a('0x5')](),controller['outboundChannels']);router[_0x588a('0x3')](_0x588a('0x21'),auth[_0x588a('0x5')](),controller[_0x588a('0x22')]);router[_0x588a('0x1d')](_0x588a('0x23'),auth[_0x588a('0x5')](),controller[_0x588a('0x24')]);router[_0x588a('0x3')](_0x588a('0x25'),auth[_0x588a('0x5')](),controller[_0x588a('0x26')]);router[_0x588a('0x3')](_0x588a('0x27'),auth[_0x588a('0x5')](),controller[_0x588a('0x28')]);router['get']('/campaigns',auth['isAuthenticated'](),controller[_0x588a('0x29')]);router[_0x588a('0x3')](_0x588a('0x2a'),auth[_0x588a('0x5')](),controller[_0x588a('0x2b')]);router[_0x588a('0x3')](_0x588a('0x2c'),auth[_0x588a('0x5')](),controller[_0x588a('0x2d')]);router[_0x588a('0x3')](_0x588a('0x2e'),auth[_0x588a('0x5')](),controller[_0x588a('0x2f')]);router[_0x588a('0x3')](_0x588a('0x30'),auth[_0x588a('0x5')](),controller['openchannelQueuesWaitingInteractions']);router[_0x588a('0x3')]('/openchannel/queues/:id/waitinginteractions',auth[_0x588a('0x5')](),controller[_0x588a('0x31')]);router['get'](_0x588a('0x32'),auth[_0x588a('0x5')](),controller[_0x588a('0x33')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x588a('0x5')](),controller['whatsappQueuesWaitingInteractions']);router[_0x588a('0x3')](_0x588a('0x34'),auth[_0x588a('0x5')](),controller[_0x588a('0x35')]);router[_0x588a('0x36')](_0x588a('0x37'),auth[_0x588a('0x5')](),controller['queueNotify'](_0x588a('0x38')));router[_0x588a('0x3')](_0x588a('0x39'),auth[_0x588a('0x5')](),controller[_0x588a('0x3a')]);router[_0x588a('0x36')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('chat'));router[_0x588a('0x3')](_0x588a('0x3b'),auth['isAuthenticated'](),controller[_0x588a('0x3c')]);router['post'](_0x588a('0x3d'),auth[_0x588a('0x5')](),controller['queueNotify']('fax'));router[_0x588a('0x3')](_0x588a('0x3e'),auth[_0x588a('0x5')](),controller['showFaxQueues']);router[_0x588a('0x36')]('/openchannel/queues/:id/notify',auth[_0x588a('0x5')](),controller['queueNotify'](_0x588a('0x3f')));router[_0x588a('0x3')](_0x588a('0x40'),auth[_0x588a('0x5')](),controller[_0x588a('0x41')]);router[_0x588a('0x36')](_0x588a('0x42'),auth['isAuthenticated'](),controller[_0x588a('0x43')](_0x588a('0x44')));router[_0x588a('0x36')](_0x588a('0x45'),auth[_0x588a('0x5')](),controller[_0x588a('0x43')](_0x588a('0x46')));router[_0x588a('0x3')](_0x588a('0x47'),auth[_0x588a('0x5')](),controller[_0x588a('0x48')]);router[_0x588a('0x3')]('/whatsapp/queues/:id',auth[_0x588a('0x5')](),controller[_0x588a('0x49')]);router['post'](_0x588a('0x4a'),auth[_0x588a('0x5')](),controller[_0x588a('0x4b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 0271a93..3a97310 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 _0x7c09=['update','MessageId','agent','agentTransferTimeout','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','message','result','catch','status','json','sendStatus','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','InteractionId','From','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User'];(function(_0x359b3a,_0x5c3121){var _0x4f9d8c=function(_0x4784ae){while(--_0x4784ae){_0x359b3a['push'](_0x359b3a['shift']());}};_0x4f9d8c(++_0x5c3121);}(_0x7c09,0x102));var _0x97c0=function(_0x122f0a,_0x1190cd){_0x122f0a=_0x122f0a-0x0;var _0x3a2373=_0x7c09[_0x122f0a];return _0x3a2373;};'use strict';var BPromise=require('bluebird');var moment=require(_0x97c0('0x0'));var _=require(_0x97c0('0x1'));var util=require('util');var db=require(_0x97c0('0x2'))['db'];var logger=require(_0x97c0('0x3'))(_0x97c0('0x4'));var jayson=require(_0x97c0('0x5'));var amiClient=jayson[_0x97c0('0x6')][_0x97c0('0x7')]({'port':0x232a});var mailClient=jayson[_0x97c0('0x6')]['http']({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){var _0x57661a=_0x2c19fa?_0x2c19fa:amiClient;return _0x57661a[_0x97c0('0x8')](_0x46fdd9,_0x42c6c7)['then'](function(_0x2d5507){if(_0x2d5507[_0x97c0('0x9')]){if(_0x2d5507['error']['code']===0x1f4){return _0x293785(_0x2d5507[_0x97c0('0x9')][_0x97c0('0xa')]);}return _0x109bc8(_0x2d5507[_0x97c0('0x9')][_0x97c0('0xa')]);}else{_0x109bc8(_0x2d5507[_0x97c0('0xb')]);}})[_0x97c0('0xc')](function(_0x7fc93){_0x293785(_0x7fc93);});});}function respondWithResult(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xc8;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0xd')](_0x9ca3c1)[_0x97c0('0xe')](_0x2ecf34);}return _0x39a3b4[_0x97c0('0xf')](0x194);};}function handleError(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0x1f4;return function(_0x15b336){logger[_0x97c0('0x9')](_0x15b336['stack']);if(_0x15b336[_0x97c0('0x10')]){delete _0x15b336[_0x97c0('0x10')];}_0x514782[_0x97c0('0xd')](_0x3f2fc2)[_0x97c0('0x11')](_0x15b336);};}function findById(_0x482be5){return function(_0x13d46e){if(!_['isNil'](_0x482be5)&&!_[_0x97c0('0x12')](_0x13d46e)&&!_[_0x97c0('0x12')](_0x13d46e['rows'])){return _[_0x97c0('0x13')](_0x13d46e[_0x97c0('0x14')],function(_0x179d43){return _0x179d43['id']==_0x482be5;});}return null;};}exports[_0x97c0('0x15')]=function(_0x183e2e,_0x3e7a52){return respondWithRpcPromise(_0x97c0('0x16'),_0x183e2e[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x3e7a52,null))[_0x97c0('0xc')](handleError(_0x3e7a52,null));};exports['voiceChannelMixMonitor']=function(_0x554122,_0x2b74a2){return respondWithRpcPromise(_0x97c0('0x19'),_[_0x97c0('0x1a')](_0x554122['query'],_0x554122[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x2b74a2,null))[_0x97c0('0xc')](handleError(_0x2b74a2,null));};exports[_0x97c0('0x1c')]=function(_0x30fba2,_0x3a0bfb){return respondWithRpcPromise(_0x97c0('0x1d'),_['merge'](_0x30fba2[_0x97c0('0x17')],_0x30fba2[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x3a0bfb,null))[_0x97c0('0xc')](handleError(_0x3a0bfb,null));};exports['voiceQueues']=function(_0x2bda6c,_0x14cada){return respondWithRpcPromise('VoiceQueues',_0x2bda6c[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x14cada,null))[_0x97c0('0xc')](handleError(_0x14cada,null));};exports['showVoiceQueues']=function(_0x4f11ba,_0x51f258){return respondWithRpcPromise(_0x97c0('0x1e'),_0x4f11ba[_0x97c0('0x17')])[_0x97c0('0x18')](findById(_0x4f11ba[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x51f258,null))[_0x97c0('0xc')](handleError(_0x51f258,null));};exports['updateVoiceQueue']=function(_0x10e47e,_0x1c183f){return respondWithRpcPromise(_0x97c0('0x1f'),_['merge'](_0x10e47e[_0x97c0('0x20')],_0x10e47e[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x1c183f,null))[_0x97c0('0xc')](handleError(_0x1c183f,null));};exports[_0x97c0('0x21')]=function(_0x5c4e4e,_0x59abbb){return respondWithRpcPromise(_0x97c0('0x22'),_[_0x97c0('0x1a')](_0x5c4e4e[_0x97c0('0x17')],_0x5c4e4e['params']))[_0x97c0('0x18')](respondWithResult(_0x59abbb,null))[_0x97c0('0xc')](handleError(_0x59abbb,null));};exports['voiceQueuesChannels']=function(_0x30147b,_0x22833e){return respondWithRpcPromise(_0x97c0('0x23'),_0x30147b[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x22833e,null))[_0x97c0('0xc')](handleError(_0x22833e,null));};exports[_0x97c0('0x24')]=function(_0x1a6c4b,_0x30b927){return respondWithRpcPromise(_0x97c0('0x25'),_[_0x97c0('0x1a')](_0x1a6c4b[_0x97c0('0x17')],_0x1a6c4b[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x30b927,null))[_0x97c0('0xc')](handleError(_0x30b927,null));};exports['voiceQueuesChannelHangup']=function(_0x292560,_0x1548b6){return respondWithRpcPromise(_0x97c0('0x26'),_[_0x97c0('0x1a')](_0x292560[_0x97c0('0x17')],_0x292560[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x1548b6,null))[_0x97c0('0xc')](handleError(_0x1548b6,null));};exports['voiceQueuesChannelRedirect']=function(_0xd72d47,_0x4bf42a){return respondWithRpcPromise(_0x97c0('0x27'),_[_0x97c0('0x1a')](_0xd72d47[_0x97c0('0x17')],_0xd72d47[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x4bf42a,null))[_0x97c0('0xc')](handleError(_0x4bf42a,null));};exports[_0x97c0('0x28')]=function(_0x225ca4,_0x38f37a){return respondWithRpcPromise(_0x97c0('0x29'),_0x225ca4[_0x97c0('0x17')])['then'](respondWithResult(_0x38f37a,null))[_0x97c0('0xc')](handleError(_0x38f37a,null));};exports[_0x97c0('0x2a')]=function(_0x4d47b1,_0x137ee1){return respondWithRpcPromise(_0x97c0('0x2b'),_0x4d47b1[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x137ee1,null))['catch'](handleError(_0x137ee1,null));};exports[_0x97c0('0x2c')]=function(_0x4f1629,_0x1acf31){var _0x64cfcd;return respondWithRpcPromise('Agents',_0x4f1629[_0x97c0('0x17')])[_0x97c0('0x18')](function(_0xd728dd){_0x64cfcd=_0xd728dd;return respondWithRpcPromise(_0x97c0('0x2d'),_0x4f1629[_0x97c0('0x17')],routingClient);})[_0x97c0('0x18')](function(_0x36b3d0){return _[_0x97c0('0x1a')]({},_0x36b3d0,_0x64cfcd);})[_0x97c0('0x18')](respondWithResult(_0x1acf31,null))[_0x97c0('0xc')](handleError(_0x1acf31,null));};exports[_0x97c0('0x2e')]=function(_0x2cca4c,_0x1351d2){if(_0x2cca4c['body']&&_0x2cca4c[_0x97c0('0x20')][_0x97c0('0x2f')]&&_0x2cca4c[_0x97c0('0x30')]&&_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')]){for(var _0x375ebc in _0x2cca4c[_0x97c0('0x20')]['interaction']){if(_0x2cca4c['body'][_0x97c0('0x2f')][_0x97c0('0x31')](_0x375ebc)){db[_0x97c0('0x32')][_0x97c0('0x33')]({'where':{'channel':_0x375ebc,'membername':_0x2cca4c[_0x97c0('0x30')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x2cca4c['body'][_0x97c0('0x2f')][_0x375ebc]&&_0x2cca4c['body']['interaction'][_0x375ebc][_0x97c0('0x34')]?{'$notIn':_0x2cca4c[_0x97c0('0x20')][_0x97c0('0x2f')][_0x375ebc]}:{'$ne':null}}})[_0x97c0('0x18')](function(_0x2f538b){var _0x483656=moment()[_0x97c0('0x35')](_0x97c0('0x36'));for(var _0x342eeb=0x0,_0x10a8ea=_0x2f538b[_0x97c0('0x34')];_0x342eeb<_0x10a8ea;_0x342eeb+=0x1){_0x2f538b[_0x342eeb][_0x97c0('0x37')]({'exitAt':_0x483656});}});for(var _0x444e41=0x0;_0x444e41<_0x2cca4c[_0x97c0('0x20')][_0x97c0('0x2f')][_0x375ebc][_0x97c0('0x34')];_0x444e41+=0x1){db['MemberReport'][_0x97c0('0x38')]({'where':{'channel':_0x375ebc,'membername':_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')],'type':_0x97c0('0x39'),'uniqueid':_0x2cca4c['body']['interaction'][_0x375ebc][_0x444e41],'exitAt':null},'defaults':{'channel':_0x375ebc,'membername':_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')],'interface':_[_0x97c0('0x12')](_0x2cca4c['user'][_0x97c0('0x3a')])?util[_0x97c0('0x35')](_0x97c0('0x3b'),_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')]):_0x2cca4c['user'][_0x97c0('0x3a')],'type':_0x97c0('0x39'),'enterAt':moment()[_0x97c0('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x2cca4c[_0x97c0('0x30')]['internal'],'uniqueid':_0x2cca4c['body'][_0x97c0('0x2f')][_0x375ebc][_0x444e41]}});}}}}return respondWithRpcPromise(_0x97c0('0x3c'),{'id':_0x2cca4c[_0x97c0('0x1b')]['id'],'capacity':_0x2cca4c['body']['capacity']},routingClient)['then'](respondWithResult(_0x1351d2,null))[_0x97c0('0xc')](handleError(_0x1351d2,null));};exports[_0x97c0('0x3d')]=function(_0x3afef4,_0xdb2767){return respondWithRpcPromise(_0x97c0('0x3e'),_0x3afef4[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0xdb2767,null))['catch'](handleError(_0xdb2767,null));};exports[_0x97c0('0x3f')]=function(_0x3f074b,_0x20cd9c){return respondWithRpcPromise(_0x97c0('0x40'),_0x3f074b[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x20cd9c,null))['catch'](handleError(_0x20cd9c,null));};exports[_0x97c0('0x41')]=function(_0x86a497,_0x4fbc1e){return respondWithRpcPromise(_0x97c0('0x42'),_0x86a497[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x4fbc1e,null))[_0x97c0('0xc')](handleError(_0x4fbc1e,null));};exports[_0x97c0('0x43')]=function(_0x18992d,_0x47298f){return respondWithRpcPromise('ChatQueues',_0x18992d[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x47298f,null))[_0x97c0('0xc')](handleError(_0x47298f,null));};exports[_0x97c0('0x44')]=function(_0x154317,_0x2f1571){return respondWithRpcPromise(_0x97c0('0x45'),_0x154317[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](findById(_0x154317[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x2f1571,null))[_0x97c0('0xc')](handleError(_0x2f1571,null));};exports[_0x97c0('0x46')]=function(_0x57766f,_0x771495){return respondWithRpcPromise(_0x97c0('0x47'),_0x57766f[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x771495,null))[_0x97c0('0xc')](handleError(_0x771495,null));};exports[_0x97c0('0x48')]=function(_0x481f5b,_0x18a6c0){return respondWithRpcPromise(_0x97c0('0x47'),_0x481f5b['query'],routingClient)[_0x97c0('0x18')](findById(_0x481f5b[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x18a6c0,null))['catch'](handleError(_0x18a6c0,null));};exports[_0x97c0('0x49')]=function(_0x4c4fb2,_0x25c750){return respondWithRpcPromise(_0x97c0('0x4a'),_0x4c4fb2[_0x97c0('0x17')],mailClient)[_0x97c0('0x18')](respondWithResult(_0x25c750,null))[_0x97c0('0xc')](handleError(_0x25c750,null));};exports[_0x97c0('0x4b')]=function(_0x52643e,_0x3349df){return respondWithRpcPromise(_0x97c0('0x4c'),_0x52643e[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x3349df,null))['catch'](handleError(_0x3349df,null));};exports[_0x97c0('0x4d')]=function(_0x3795db,_0x102f68){return respondWithRpcPromise(_0x97c0('0x4c'),_0x3795db['query'],routingClient)[_0x97c0('0x18')](findById(_0x3795db[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x102f68,null))[_0x97c0('0xc')](handleError(_0x102f68,null));};exports['smsQueues']=function(_0x32881c,_0x3c4c27){return respondWithRpcPromise(_0x97c0('0x4e'),_0x32881c['query'],routingClient)[_0x97c0('0x18')](respondWithResult(_0x3c4c27,null))[_0x97c0('0xc')](handleError(_0x3c4c27,null));};exports[_0x97c0('0x4f')]=function(_0x32e392,_0x373c34){return respondWithRpcPromise(_0x97c0('0x4e'),_0x32e392[_0x97c0('0x17')],routingClient)['then'](findById(_0x32e392['params']['id']))[_0x97c0('0x18')](respondWithResult(_0x373c34,null))[_0x97c0('0xc')](handleError(_0x373c34,null));};exports['whatsappQueues']=function(_0x366a01,_0x5a4738){return respondWithRpcPromise('WhatsappQueues',_0x366a01[_0x97c0('0x17')],routingClient)['then'](respondWithResult(_0x5a4738,null))[_0x97c0('0xc')](handleError(_0x5a4738,null));};exports[_0x97c0('0x50')]=function(_0x56be23,_0x496336){return respondWithRpcPromise('WhatsappQueues',_0x56be23[_0x97c0('0x17')],routingClient)['then'](findById(_0x56be23[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x496336,null))[_0x97c0('0xc')](handleError(_0x496336,null));};exports[_0x97c0('0x51')]=function(_0x400a8d,_0x321460){return respondWithRpcPromise(_0x97c0('0x52'),_0x400a8d[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x321460,null))[_0x97c0('0xc')](handleError(_0x321460,null));};exports[_0x97c0('0x53')]=function(_0x536f72,_0x1c1182){return respondWithRpcPromise(_0x97c0('0x52'),_0x536f72[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](findById(_0x536f72[_0x97c0('0x1b')]['id']))['then'](respondWithResult(_0x1c1182,null))[_0x97c0('0xc')](handleError(_0x1c1182,null));};exports[_0x97c0('0x54')]=function(_0x579f54,_0x4116c9){return respondWithRpcPromise(_0x97c0('0x55'),_0x579f54[_0x97c0('0x17')])['then'](respondWithResult(_0x4116c9,null))[_0x97c0('0xc')](handleError(_0x4116c9,null));};exports[_0x97c0('0x56')]=function(_0x10f1aa,_0x165c72){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x10f1aa['query'],routingClient)['then'](respondWithResult(_0x165c72,null))[_0x97c0('0xc')](handleError(_0x165c72,null));};exports[_0x97c0('0x57')]=function(_0x442bba,_0x41f8e7){return respondWithRpcPromise(_0x97c0('0x58'),_0x442bba[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x41f8e7,null))[_0x97c0('0xc')](handleError(_0x41f8e7,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x52d9d9,_0x199abc){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x52d9d9['query'],routingClient)['then'](respondWithResult(_0x199abc,null))[_0x97c0('0xc')](handleError(_0x199abc,null));};exports[_0x97c0('0x59')]=function(_0x123a99,_0x30968e){return respondWithRpcPromise(_0x97c0('0x5a'),_0x123a99['query'],routingClient)['then'](function(_0x35ced3){if(_0x123a99[_0x97c0('0x17')][_0x97c0('0x5b')]!==undefined){var _0x3a8ac0=_(_0x35ced3['rows'])[_0x97c0('0x5c')]([_0x123a99['query'][_0x97c0('0x5b')],_0x123a99[_0x97c0('0x1b')]['id']])[_0x97c0('0x5d')](_0x97c0('0x5e'))[_0x97c0('0x5f')]()[_0x97c0('0x60')]();return _0x35ced3[_0x97c0('0x14')][_0x97c0('0x5c')](function(_0x465a92){return _0x3a8ac0[_0x97c0('0x61')](_0x465a92['queue_id'])>-0x1;});}else{return _0x35ced3[_0x97c0('0x14')]['filter'](function(_0x5b8ebd){return _0x5b8ebd[_0x97c0('0x5e')]===parseInt(_0x123a99[_0x97c0('0x1b')]['id']);});}})['then'](respondWithResult(_0x30968e,null))[_0x97c0('0xc')](handleError(_0x30968e,null));};exports['smsQueuesWaitingInteractions']=function(_0x1f2380,_0x24a81c){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1f2380[_0x97c0('0x17')],routingClient)['then'](respondWithResult(_0x24a81c,null))['catch'](handleError(_0x24a81c,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xab71f4,_0x12bb6e){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xab71f4[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x12bb6e,null))[_0x97c0('0xc')](handleError(_0x12bb6e,null));};exports[_0x97c0('0x62')]=function(_0x41b864,_0x11db50){return respondWithRpcPromise(_0x97c0('0x63'),_0x41b864[_0x97c0('0x17')],routingClient)['then'](respondWithResult(_0x11db50,null))[_0x97c0('0xc')](handleError(_0x11db50,null));};exports['queueNotify']=function(_0x597cd1){return function(_0x4062f8,_0x4f9307){var _0x3f69a6,_0x15f953;var _0x567e15=_[_0x97c0('0x64')](_0x597cd1);var _0x344d5f=_0x597cd1===_0x97c0('0x65')?_0x97c0('0x66'):_0x97c0('0x67');return db[_0x567e15+'Queue'][_0x97c0('0x68')]({'raw':!![],'where':{'id':_0x4062f8[_0x97c0('0x1b')]['id']}})[_0x97c0('0x18')](function(_0x58e7c0){if(_[_0x97c0('0x12')](_0x58e7c0)){throw new Error(_0x567e15+_0x97c0('0x69'));}_0x3f69a6=_0x58e7c0;return db[_0x567e15+_0x97c0('0x6a')][_0x97c0('0x68')]({'where':{'id':_0x4062f8['body'][_0x97c0('0x6b')]},'include':[{'model':db[_0x567e15+_0x97c0('0x6c')],'as':_0x97c0('0x6c')},{'model':db[_0x567e15+_0x344d5f],'as':_0x97c0('0x67')}]});})[_0x97c0('0x18')](function(_0x5828f7){if(_[_0x97c0('0x12')](_0x5828f7)){throw new Error(_0x567e15+_0x97c0('0x6d'));}_0x15f953=_0x5828f7;return _0x5828f7['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x372415={'uniqueid':_0x597cd1+'.'+_0x15f953['id']+'.'+_0x15f953[_0x97c0('0x6c')]['id'],'FromUserId':_0x4062f8[_0x97c0('0x30')]['id'],'type':'queue'};_0x372415[_0x567e15+'MessageId']=_0x15f953['id'];_0x372415[_0x567e15+_0x97c0('0x6e')]=_0x15f953['Interaction']['id'];_0x372415[_0x97c0('0x6f')+_0x567e15+_0x344d5f+'Id']=_0x15f953[_0x97c0('0x67')]['id'];_0x372415['To'+_0x567e15+_0x97c0('0x70')]=_0x3f69a6['id'];return db[_0x567e15+_0x97c0('0x71')][_0x97c0('0x72')](_0x372415);})[_0x97c0('0x18')](function(){return respondWithRpcPromise(_0x97c0('0x73'),{'channel':_0x597cd1,'interaction':_0x15f953['Interaction'],'message':_0x15f953,'account':_0x15f953[_0x97c0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x97c0('0x74'),'appdata':_0x3f69a6[_0x97c0('0x10')]+','+(_0x15f953[_0x97c0('0x67')][_0x97c0('0x75')]||0x12c),'interval':_0x97c0('0x76')}]},routingClient);})[_0x97c0('0x18')](respondWithResult(_0x4f9307,null))[_0x97c0('0xc')](handleError(_0x4f9307,null));};};exports[_0x97c0('0x77')]=function(_0x15b27f,_0x1cc32c){var _0x1b2e52,_0x3c4c8e;if(_[_0x97c0('0x12')](_0x15b27f['body'][_0x97c0('0x78')])){throw new Error(_0x97c0('0x79'));}var _0x2f9ffe=_0x15b27f[_0x97c0('0x20')]['channel'];var _0x1eb0c7=_[_0x97c0('0x64')](_0x2f9ffe);var _0x6b955=_0x2f9ffe===_0x97c0('0x65')?_0x97c0('0x66'):_0x97c0('0x67');return db[_0x97c0('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x15b27f[_0x97c0('0x1b')]['id'],'role':'agent'}})[_0x97c0('0x18')](function(_0x1822b5){if(_[_0x97c0('0x12')](_0x1822b5)){throw new Error('Agent\x20not\x20found');}_0x1b2e52=_0x1822b5;return db[_0x1eb0c7+_0x97c0('0x6a')][_0x97c0('0x68')]({'where':{'id':_0x15b27f[_0x97c0('0x20')][_0x97c0('0x6b')]},'include':[{'model':db[_0x1eb0c7+_0x97c0('0x6c')],'as':'Interaction'},{'model':db[_0x1eb0c7+_0x6b955],'as':_0x97c0('0x67')}]});})['then'](function(_0x2db5b0){if(_[_0x97c0('0x12')](_0x2db5b0)){throw new Error(_0x1eb0c7+'\x20Message\x20not\x20found');}_0x3c4c8e=_0x2db5b0;return _0x2db5b0[_0x97c0('0x7b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x97c0('0x18')](function(){var _0x1419cd={'uniqueid':_0x2f9ffe+'.'+_0x3c4c8e['id']+'.'+_0x3c4c8e[_0x97c0('0x6c')]['id'],'FromUserId':_0x15b27f[_0x97c0('0x30')]['id'],'type':_0x97c0('0x74'),'ToUserId':_0x1b2e52['id']};_0x1419cd[_0x1eb0c7+_0x97c0('0x7c')]=_0x3c4c8e['id'];_0x1419cd[_0x1eb0c7+_0x97c0('0x6e')]=_0x3c4c8e['Interaction']['id'];_0x1419cd[_0x97c0('0x6f')+_0x1eb0c7+_0x6b955+'Id']=_0x3c4c8e[_0x97c0('0x67')]['id'];return db[_0x1eb0c7+_0x97c0('0x71')]['create'](_0x1419cd);})['then'](function(){return respondWithRpcPromise(_0x97c0('0x73'),{'channel':_0x2f9ffe,'interaction':_0x3c4c8e[_0x97c0('0x6c')],'message':_0x3c4c8e,'account':_0x3c4c8e[_0x97c0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x97c0('0x7d'),'appdata':_0x1b2e52[_0x97c0('0x10')]+','+(_0x3c4c8e[_0x97c0('0x67')][_0x97c0('0x7e')]||0x12c),'interval':_0x97c0('0x76')}]},routingClient);})[_0x97c0('0x18')](respondWithResult(_0x1cc32c,null))[_0x97c0('0xc')](handleError(_0x1cc32c,null));}; \ No newline at end of file +var _0xee14=['telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','channel','Website','User','agent','Agent\x20not\x20found','\x20Message\x20not\x20found','*,*,*,*','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','INTERACTION','SIP/%s','AgentCapacity'];(function(_0x8688fd,_0x4484df){var _0x226ec0=function(_0x2c6cb7){while(--_0x2c6cb7){_0x8688fd['push'](_0x8688fd['shift']());}};_0x226ec0(++_0x4484df);}(_0xee14,0x13a));var _0x4ee1=function(_0x27dac8,_0xe2a960){_0x27dac8=_0x27dac8-0x0;var _0x4cfe42=_0xee14[_0x27dac8];return _0x4cfe42;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x4ee1('0x0'));var util=require(_0x4ee1('0x1'));var db=require(_0x4ee1('0x2'))['db'];var logger=require(_0x4ee1('0x3'))(_0x4ee1('0x4'));var jayson=require(_0x4ee1('0x5'));var amiClient=jayson[_0x4ee1('0x6')][_0x4ee1('0x7')]({'port':0x232a});var mailClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){var _0x1fd8c8=_0x187656?_0x187656:amiClient;return _0x1fd8c8['request'](_0x327c18,_0x3a45a3)[_0x4ee1('0x8')](function(_0x38be25){if(_0x38be25['error']){if(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xa')]===0x1f4){return _0xdfe9c1(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xb')]);}return _0x293d5f(_0x38be25['error'][_0x4ee1('0xb')]);}else{_0x293d5f(_0x38be25[_0x4ee1('0xc')]);}})[_0x4ee1('0xd')](function(_0x2d5d3c){_0xdfe9c1(_0x2d5d3c);});});}function respondWithResult(_0x2f864e,_0x174427){_0x174427=_0x174427||0xc8;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0xe')](_0x174427)[_0x4ee1('0xf')](_0x5616d6);}return _0x2f864e[_0x4ee1('0x10')](0x194);};}function handleError(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0x1f4;return function(_0x1c342a){logger[_0x4ee1('0x9')](_0x1c342a[_0x4ee1('0x11')]);if(_0x1c342a[_0x4ee1('0x12')]){delete _0x1c342a['name'];}_0x24a915[_0x4ee1('0xe')](_0x46d2c2)[_0x4ee1('0x13')](_0x1c342a);};}function findById(_0x34651b){return function(_0x1b1e0e){if(!_[_0x4ee1('0x14')](_0x34651b)&&!_[_0x4ee1('0x14')](_0x1b1e0e)&&!_[_0x4ee1('0x14')](_0x1b1e0e[_0x4ee1('0x15')])){return _[_0x4ee1('0x16')](_0x1b1e0e[_0x4ee1('0x15')],function(_0x274de5){return _0x274de5['id']==_0x34651b;});}return null;};}exports['voiceChannels']=function(_0x236215,_0x3db827){return respondWithRpcPromise(_0x4ee1('0x17'),_0x236215[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3db827,null))[_0x4ee1('0xd')](handleError(_0x3db827,null));};exports['voiceChannelMixMonitor']=function(_0x8a631f,_0x333e96){return respondWithRpcPromise(_0x4ee1('0x19'),_[_0x4ee1('0x1a')](_0x8a631f[_0x4ee1('0x18')],_0x8a631f[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x333e96,null))[_0x4ee1('0xd')](handleError(_0x333e96,null));};exports[_0x4ee1('0x1c')]=function(_0x3e5038,_0x4faaf6){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x4ee1('0x1a')](_0x3e5038[_0x4ee1('0x18')],_0x3e5038[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x4faaf6,null))[_0x4ee1('0xd')](handleError(_0x4faaf6,null));};exports[_0x4ee1('0x1d')]=function(_0x57d45d,_0x5cc0b5){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x57d45d[_0x4ee1('0x18')])['then'](respondWithResult(_0x5cc0b5,null))[_0x4ee1('0xd')](handleError(_0x5cc0b5,null));};exports[_0x4ee1('0x1f')]=function(_0x36654c,_0x215949){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x36654c[_0x4ee1('0x18')])[_0x4ee1('0x8')](findById(_0x36654c['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x215949,null))['catch'](handleError(_0x215949,null));};exports[_0x4ee1('0x20')]=function(_0x4ec408,_0x3dc870){return respondWithRpcPromise(_0x4ee1('0x21'),_[_0x4ee1('0x1a')](_0x4ec408[_0x4ee1('0x22')],_0x4ec408[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x3dc870,null))[_0x4ee1('0xd')](handleError(_0x3dc870,null));};exports['voiceQueuesPreview']=function(_0x121301,_0x3d5e6c){return respondWithRpcPromise(_0x4ee1('0x23'),_[_0x4ee1('0x1a')](_0x121301[_0x4ee1('0x18')],_0x121301['params']))[_0x4ee1('0x8')](respondWithResult(_0x3d5e6c,null))[_0x4ee1('0xd')](handleError(_0x3d5e6c,null));};exports[_0x4ee1('0x24')]=function(_0x2e37a3,_0x79f87c){return respondWithRpcPromise(_0x4ee1('0x25'),_0x2e37a3['query'])['then'](respondWithResult(_0x79f87c,null))[_0x4ee1('0xd')](handleError(_0x79f87c,null));};exports[_0x4ee1('0x26')]=function(_0x41ab60,_0x5a2f6f){return respondWithRpcPromise(_0x4ee1('0x27'),_[_0x4ee1('0x1a')](_0x41ab60[_0x4ee1('0x18')],_0x41ab60[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x5a2f6f,null))[_0x4ee1('0xd')](handleError(_0x5a2f6f,null));};exports[_0x4ee1('0x28')]=function(_0x199e11,_0x36898c){return respondWithRpcPromise(_0x4ee1('0x29'),_[_0x4ee1('0x1a')](_0x199e11[_0x4ee1('0x18')],_0x199e11[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x36898c,null))[_0x4ee1('0xd')](handleError(_0x36898c,null));};exports[_0x4ee1('0x2a')]=function(_0x882468,_0x50539f){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x4ee1('0x1a')](_0x882468[_0x4ee1('0x18')],_0x882468[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x50539f,null))['catch'](handleError(_0x50539f,null));};exports[_0x4ee1('0x2b')]=function(_0x2ed16f,_0x11721a){return respondWithRpcPromise(_0x4ee1('0x2c'),_0x2ed16f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x11721a,null))[_0x4ee1('0xd')](handleError(_0x11721a,null));};exports[_0x4ee1('0x2d')]=function(_0x59b5cc,_0x3b346e){return respondWithRpcPromise(_0x4ee1('0x2e'),_0x59b5cc[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3b346e,null))[_0x4ee1('0xd')](handleError(_0x3b346e,null));};exports[_0x4ee1('0x2f')]=function(_0x543b2e,_0x3e2ca7){var _0x37176a;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')])[_0x4ee1('0x8')](function(_0x352dc5){_0x37176a=_0x352dc5;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')],routingClient);})[_0x4ee1('0x8')](function(_0x29493d){return _[_0x4ee1('0x1a')]({},_0x29493d,_0x37176a);})[_0x4ee1('0x8')](respondWithResult(_0x3e2ca7,null))[_0x4ee1('0xd')](handleError(_0x3e2ca7,null));};exports['agentCapacity']=function(_0x3b3bed,_0x40a3e3){if(_0x3b3bed['body']&&_0x3b3bed[_0x4ee1('0x22')]['interaction']&&_0x3b3bed[_0x4ee1('0x31')]&&_0x3b3bed['user'][_0x4ee1('0x12')]){for(var _0xc7580c in _0x3b3bed['body'][_0x4ee1('0x32')]){if(_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0x4ee1('0x33')](_0xc7580c)){db['MemberReport'][_0x4ee1('0x34')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3b3bed['body'][_0x4ee1('0x32')][_0xc7580c]&&_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')]?{'$notIn':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c]}:{'$ne':null}}})['then'](function(_0xaa71d5){var _0x266add=moment()[_0x4ee1('0x36')](_0x4ee1('0x37'));for(var _0x5c5862=0x0,_0x3d6bf4=_0xaa71d5[_0x4ee1('0x35')];_0x5c5862<_0x3d6bf4;_0x5c5862+=0x1){_0xaa71d5[_0x5c5862]['updateAttributes']({'exitAt':_0x266add});}});for(var _0x21ebb8=0x0;_0x21ebb8<_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')];_0x21ebb8+=0x1){db[_0x4ee1('0x38')][_0x4ee1('0x39')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':_0x4ee1('0x3a'),'uniqueid':_0x3b3bed['body']['interaction'][_0xc7580c][_0x21ebb8],'exitAt':null},'defaults':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'interface':_[_0x4ee1('0x14')](_0x3b3bed[_0x4ee1('0x31')]['interface'])?util[_0x4ee1('0x36')](_0x4ee1('0x3b'),_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')]):_0x3b3bed[_0x4ee1('0x31')]['interface'],'type':_0x4ee1('0x3a'),'enterAt':moment()[_0x4ee1('0x36')](_0x4ee1('0x37')),'role':'agent','internal':_0x3b3bed[_0x4ee1('0x31')]['internal'],'uniqueid':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c][_0x21ebb8]}});}}}}return respondWithRpcPromise(_0x4ee1('0x3c'),{'id':_0x3b3bed['params']['id'],'capacity':_0x3b3bed[_0x4ee1('0x22')]['capacity']},routingClient)[_0x4ee1('0x8')](respondWithResult(_0x40a3e3,null))[_0x4ee1('0xd')](handleError(_0x40a3e3,null));};exports[_0x4ee1('0x3d')]=function(_0x5f4f78,_0x3368ed){return respondWithRpcPromise(_0x4ee1('0x3e'),_0x5f4f78[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3368ed,null))[_0x4ee1('0xd')](handleError(_0x3368ed,null));};exports[_0x4ee1('0x3f')]=function(_0x3f1c32,_0x517729){return respondWithRpcPromise('Trunks',_0x3f1c32[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x517729,null))[_0x4ee1('0xd')](handleError(_0x517729,null));};exports[_0x4ee1('0x40')]=function(_0x44e65f,_0x31e82d){return respondWithRpcPromise(_0x4ee1('0x41'),_0x44e65f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x31e82d,null))[_0x4ee1('0xd')](handleError(_0x31e82d,null));};exports[_0x4ee1('0x42')]=function(_0x2453ac,_0x3c2e42){return respondWithRpcPromise('ChatQueues',_0x2453ac[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x3c2e42,null))[_0x4ee1('0xd')](handleError(_0x3c2e42,null));};exports[_0x4ee1('0x43')]=function(_0x59bbca,_0x1e0aac){return respondWithRpcPromise(_0x4ee1('0x44'),_0x59bbca['query'],routingClient)['then'](findById(_0x59bbca[_0x4ee1('0x1b')]['id']))['then'](respondWithResult(_0x1e0aac,null))[_0x4ee1('0xd')](handleError(_0x1e0aac,null));};exports[_0x4ee1('0x45')]=function(_0x59ba70,_0x43489c){return respondWithRpcPromise(_0x4ee1('0x46'),_0x59ba70[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x43489c,null))[_0x4ee1('0xd')](handleError(_0x43489c,null));};exports[_0x4ee1('0x47')]=function(_0x11f619,_0x5f5694){return respondWithRpcPromise('MailQueues',_0x11f619[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x11f619['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x5f5694,null))[_0x4ee1('0xd')](handleError(_0x5f5694,null));};exports[_0x4ee1('0x48')]=function(_0x51e341,_0x1ad933){return respondWithRpcPromise('MailAccounts',_0x51e341[_0x4ee1('0x18')],mailClient)['then'](respondWithResult(_0x1ad933,null))['catch'](handleError(_0x1ad933,null));};exports[_0x4ee1('0x49')]=function(_0x16fcd0,_0x290451){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x16fcd0[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x290451,null))[_0x4ee1('0xd')](handleError(_0x290451,null));};exports[_0x4ee1('0x4b')]=function(_0x10f4e,_0x58eb1d){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x10f4e[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x10f4e[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x58eb1d,null))[_0x4ee1('0xd')](handleError(_0x58eb1d,null));};exports[_0x4ee1('0x4c')]=function(_0x20ca0b,_0x19fa31){return respondWithRpcPromise(_0x4ee1('0x4d'),_0x20ca0b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x19fa31,null))['catch'](handleError(_0x19fa31,null));};exports[_0x4ee1('0x4e')]=function(_0x5bf5e9,_0x25cfc3){return respondWithRpcPromise('SmsQueues',_0x5bf5e9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x5bf5e9[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x25cfc3,null))[_0x4ee1('0xd')](handleError(_0x25cfc3,null));};exports[_0x4ee1('0x4f')]=function(_0x342aa1,_0x447060){return respondWithRpcPromise(_0x4ee1('0x50'),_0x342aa1[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x447060,null))[_0x4ee1('0xd')](handleError(_0x447060,null));};exports['showWhatsappQueues']=function(_0x759888,_0x24308c){return respondWithRpcPromise(_0x4ee1('0x50'),_0x759888['query'],routingClient)['then'](findById(_0x759888[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x24308c,null))['catch'](handleError(_0x24308c,null));};exports[_0x4ee1('0x51')]=function(_0x431dfa,_0x3f8f94){return respondWithRpcPromise(_0x4ee1('0x52'),_0x431dfa[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x3f8f94,null))[_0x4ee1('0xd')](handleError(_0x3f8f94,null));};exports[_0x4ee1('0x53')]=function(_0x28e11c,_0x3824bf){return respondWithRpcPromise('FaxQueues',_0x28e11c[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x28e11c['params']['id']))['then'](respondWithResult(_0x3824bf,null))[_0x4ee1('0xd')](handleError(_0x3824bf,null));};exports[_0x4ee1('0x54')]=function(_0x19e095,_0x38e06){return respondWithRpcPromise(_0x4ee1('0x55'),_0x19e095[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x38e06,null))['catch'](handleError(_0x38e06,null));};exports[_0x4ee1('0x56')]=function(_0x39583b,_0x44af66){return respondWithRpcPromise(_0x4ee1('0x57'),_0x39583b[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x44af66,null))[_0x4ee1('0xd')](handleError(_0x44af66,null));};exports['mailQueuesWaitingInteractions']=function(_0x1d360f,_0x29371c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x1d360f['query'],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x29371c,null))[_0x4ee1('0xd')](handleError(_0x29371c,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2beb82,_0x5aacf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2beb82[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x5aacf1,null))[_0x4ee1('0xd')](handleError(_0x5aacf1,null));};exports[_0x4ee1('0x58')]=function(_0x37fa42,_0x38698a){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x37fa42[_0x4ee1('0x18')],routingClient)['then'](function(_0x57f66c){if(_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')]!==undefined){var _0x411c99=_(_0x57f66c[_0x4ee1('0x15')])[_0x4ee1('0x5a')]([_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')],_0x37fa42[_0x4ee1('0x1b')]['id']])['map'](_0x4ee1('0x5b'))[_0x4ee1('0x5c')]()['value']();return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0xcd0dd9){return _0x411c99[_0x4ee1('0x5d')](_0xcd0dd9[_0x4ee1('0x5b')])>-0x1;});}else{return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0x4dee3a){return _0x4dee3a[_0x4ee1('0x5b')]===parseInt(_0x37fa42['params']['id']);});}})[_0x4ee1('0x8')](respondWithResult(_0x38698a,null))[_0x4ee1('0xd')](handleError(_0x38698a,null));};exports[_0x4ee1('0x5e')]=function(_0x35a719,_0x48c51c){return respondWithRpcPromise(_0x4ee1('0x5f'),_0x35a719[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x48c51c,null))['catch'](handleError(_0x48c51c,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2ef7c9,_0x4b4ad5){return respondWithRpcPromise(_0x4ee1('0x60'),_0x2ef7c9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x4b4ad5,null))['catch'](handleError(_0x4b4ad5,null));};exports['faxQueuesWaitingInteractions']=function(_0x27fd3b,_0x1e2360){return respondWithRpcPromise(_0x4ee1('0x61'),_0x27fd3b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x1e2360,null))[_0x4ee1('0xd')](handleError(_0x1e2360,null));};exports[_0x4ee1('0x62')]=function(_0x5727ef){return function(_0x4a3201,_0x50645b){var _0x3fba19,_0x3a75a7;var _0x33f5af=_[_0x4ee1('0x63')](_0x5727ef);var _0x4db801=_0x5727ef===_0x4ee1('0x64')?'Website':_0x4ee1('0x65');return db[_0x33f5af+_0x4ee1('0x66')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x4a3201[_0x4ee1('0x1b')]['id']}})[_0x4ee1('0x8')](function(_0x190f59){if(_['isNil'](_0x190f59)){throw new Error(_0x33f5af+_0x4ee1('0x68'));}_0x3fba19=_0x190f59;return db[_0x33f5af+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x4a3201[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0x33f5af+_0x4ee1('0x6b')],'as':_0x4ee1('0x6b')},{'model':db[_0x33f5af+_0x4db801],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x207758){if(_[_0x4ee1('0x14')](_0x207758)){throw new Error(_0x33f5af+'\x20Message\x20not\x20found');}_0x3a75a7=_0x207758;return _0x207758[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x646878={'uniqueid':_0x5727ef+'.'+_0x3a75a7['id']+'.'+_0x3a75a7[_0x4ee1('0x6b')]['id'],'FromUserId':_0x4a3201[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d')};_0x646878[_0x33f5af+_0x4ee1('0x6e')]=_0x3a75a7['id'];_0x646878[_0x33f5af+_0x4ee1('0x6f')]=_0x3a75a7[_0x4ee1('0x6b')]['id'];_0x646878[_0x4ee1('0x70')+_0x33f5af+_0x4db801+'Id']=_0x3a75a7[_0x4ee1('0x65')]['id'];_0x646878['To'+_0x33f5af+_0x4ee1('0x71')]=_0x3fba19['id'];return db[_0x33f5af+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x646878);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x5727ef,'interaction':_0x3a75a7['Interaction'],'message':_0x3a75a7,'account':_0x3a75a7[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x6d'),'appdata':_0x3fba19['name']+','+(_0x3a75a7[_0x4ee1('0x65')][_0x4ee1('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x50645b,null))[_0x4ee1('0xd')](handleError(_0x50645b,null));};};exports['agentNotify']=function(_0x13a755,_0x1a00a4){var _0x47b854,_0x1700c6;if(_[_0x4ee1('0x14')](_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x2bc05a=_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')];var _0xc07f75=_[_0x4ee1('0x63')](_0x2bc05a);var _0x4315e9=_0x2bc05a===_0x4ee1('0x64')?_0x4ee1('0x77'):'Account';return db[_0x4ee1('0x78')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x13a755['params']['id'],'role':_0x4ee1('0x79')}})['then'](function(_0x5cf7fb){if(_[_0x4ee1('0x14')](_0x5cf7fb)){throw new Error(_0x4ee1('0x7a'));}_0x47b854=_0x5cf7fb;return db[_0xc07f75+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0xc07f75+'Interaction'],'as':_0x4ee1('0x6b')},{'model':db[_0xc07f75+_0x4315e9],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x17ae2d){if(_[_0x4ee1('0x14')](_0x17ae2d)){throw new Error(_0xc07f75+_0x4ee1('0x7b'));}_0x1700c6=_0x17ae2d;return _0x17ae2d[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x5076c6={'uniqueid':_0x2bc05a+'.'+_0x1700c6['id']+'.'+_0x1700c6[_0x4ee1('0x6b')]['id'],'FromUserId':_0x13a755[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d'),'ToUserId':_0x47b854['id']};_0x5076c6[_0xc07f75+_0x4ee1('0x6e')]=_0x1700c6['id'];_0x5076c6[_0xc07f75+_0x4ee1('0x6f')]=_0x1700c6['Interaction']['id'];_0x5076c6[_0x4ee1('0x70')+_0xc07f75+_0x4315e9+'Id']=_0x1700c6['Account']['id'];return db[_0xc07f75+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x5076c6);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x2bc05a,'interaction':_0x1700c6['Interaction'],'message':_0x1700c6,'account':_0x1700c6[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x79'),'appdata':_0x47b854['name']+','+(_0x1700c6[_0x4ee1('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x4ee1('0x7c')}]},routingClient);})[_0x4ee1('0x8')](respondWithResult(_0x1a00a4,null))['catch'](handleError(_0x1a00a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8cbf20d..29ca6e7 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 _0x9979=['delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','run','post','update'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0x9979,0xf0));var _0x9997=function(_0x4c6ae0,_0x497680){_0x4c6ae0=_0x4c6ae0-0x0;var _0x3f7fc4=_0x9979[_0x4c6ae0];return _0x3f7fc4;};'use strict';var multer=require(_0x9997('0x0'));var util=require(_0x9997('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9997('0x2'));var router=express['Router']();var fs_extra=require(_0x9997('0x3'));var auth=require(_0x9997('0x4'));var interaction=require(_0x9997('0x5'));var config=require(_0x9997('0x6'));var controller=require(_0x9997('0x7'));router[_0x9997('0x8')]('/',auth[_0x9997('0x9')](),controller[_0x9997('0xa')]);router[_0x9997('0x8')](_0x9997('0xb'),auth[_0x9997('0x9')](),controller['show']);router[_0x9997('0x8')]('/:id/run',auth[_0x9997('0x9')](),controller[_0x9997('0xc')]);router[_0x9997('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9997('0xb'),auth[_0x9997('0x9')](),controller[_0x9997('0xe')]);router[_0x9997('0xf')](_0x9997('0xb'),auth[_0x9997('0x9')](),controller['destroy']);module[_0x9997('0x10')]=router; \ No newline at end of file +var _0xf1b4=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','/:id','isAuthenticated','/:id/run','run','post','put','update','delete','destroy','connect-timeout'];(function(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0xf1b4,0x12f));var _0x4f1b=function(_0x909ff0,_0x2e74f2){_0x909ff0=_0x909ff0-0x0;var _0x4969b1=_0xf1b4[_0x909ff0];return _0x4969b1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4f1b('0x0'));var express=require(_0x4f1b('0x1'));var router=express['Router']();var fs_extra=require(_0x4f1b('0x2'));var auth=require(_0x4f1b('0x3'));var interaction=require(_0x4f1b('0x4'));var config=require('../../config/environment');var controller=require(_0x4f1b('0x5'));router[_0x4f1b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4f1b('0x6')](_0x4f1b('0x7'),auth[_0x4f1b('0x8')](),controller['show']);router[_0x4f1b('0x6')](_0x4f1b('0x9'),auth[_0x4f1b('0x8')](),controller[_0x4f1b('0xa')]);router[_0x4f1b('0xb')]('/',auth[_0x4f1b('0x8')](),controller['create']);router[_0x4f1b('0xc')]('/:id',auth[_0x4f1b('0x8')](),controller[_0x4f1b('0xd')]);router[_0x4f1b('0xe')](_0x4f1b('0x7'),auth['isAuthenticated'](),controller[_0x4f1b('0xf')]);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 dc2c318..54ec4fe 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 _0x1be5=['exports','STRING','BOOLEAN','DATE','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','custom','default','TEXT','sequelize'];(function(_0x2c45d3,_0x355a48){var _0x24a44f=function(_0x341bad){while(--_0x341bad){_0x2c45d3['push'](_0x2c45d3['shift']());}};_0x24a44f(++_0x355a48);}(_0x1be5,0x10f));var _0x51be=function(_0xb6396a,_0x5548a0){_0xb6396a=_0xb6396a-0x0;var _0x5382e1=_0x1be5[_0xb6396a];return _0x5382e1;};'use strict';var Sequelize=require(_0x51be('0x0'));module[_0x51be('0x1')]={'name':{'type':Sequelize[_0x51be('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x51be('0x2')]},'active':{'type':Sequelize[_0x51be('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x51be('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x51be('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x51be('0x5')](_0x51be('0x6'),_0x51be('0x7'),_0x51be('0x8'),_0x51be('0x9'),_0x51be('0xa'),_0x51be('0xb'),_0x51be('0xc')),'allowNull':![],'defaultValue':_0x51be('0xa')},'output':{'type':Sequelize[_0x51be('0x5')](_0x51be('0xd'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x51be('0xd')},'type':{'type':Sequelize[_0x51be('0x5')](_0x51be('0xe'),_0x51be('0xf')),'allowNull':![],'defaultValue':_0x51be('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x51be('0x2')]},'cc':{'type':Sequelize[_0x51be('0x10')]},'bcc':{'type':Sequelize[_0x51be('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x51be('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc9fc=['sequelize','exports','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','csv','pdf','custom','default','STRING','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc9fc,0xea));var _0xcc9f=function(_0x42b1d2,_0x554895){_0x42b1d2=_0x42b1d2-0x0;var _0x2b48e9=_0xc9fc[_0x42b1d2];return _0x2b48e9;};'use strict';var Sequelize=require(_0xcc9f('0x0'));module[_0xcc9f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xcc9f('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xcc9f('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xcc9f('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xcc9f('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcc9f('0x5')](_0xcc9f('0x6'),_0xcc9f('0x7'),_0xcc9f('0x8'),_0xcc9f('0x9'),_0xcc9f('0xa'),_0xcc9f('0xb'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xcc9f('0x5')](_0xcc9f('0xc'),_0xcc9f('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0xcc9f('0xc')},'type':{'type':Sequelize[_0xcc9f('0x5')](_0xcc9f('0xe'),_0xcc9f('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xcc9f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xcc9f('0x10')]},'cc':{'type':Sequelize[_0xcc9f('0x11')]},'bcc':{'type':Sequelize[_0xcc9f('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xcc9f('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 22e4271..8aaa616 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 _0xd8b5=['options','create','body','user','role','UserProfileSection','find','../../config/schedule','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','send','index','map','Schedule','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0xd8b5,0xaa));var _0x5d8b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd8b5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x5d8b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d8b('0x1'));var jsonpatch=require(_0x5d8b('0x2'));var rp=require('request-promise');var moment=require(_0x5d8b('0x3'));var BPromise=require(_0x5d8b('0x4'));var Mustache=require(_0x5d8b('0x5'));var util=require(_0x5d8b('0x6'));var path=require(_0x5d8b('0x7'));var sox=require(_0x5d8b('0x8'));var csv=require('to-csv');var ejs=require(_0x5d8b('0x9'));var fs=require('fs');var fs_extra=require(_0x5d8b('0xa'));var _=require(_0x5d8b('0xb'));var squel=require('squel');var crypto=require(_0x5d8b('0xc'));var jsforce=require(_0x5d8b('0xd'));var deskjs=require(_0x5d8b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5d8b('0xf'));var Papa=require('papaparse');var Redis=require(_0x5d8b('0x10'));var authService=require(_0x5d8b('0x11'));var qs=require(_0x5d8b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d8b('0x13'))('api');var utils=require(_0x5d8b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5d8b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31c2b5,_0x41c8a5){_0x41c8a5=_0x41c8a5||0xcc;return function(_0x572622){if(_0x572622){return _0x31c2b5[_0x5d8b('0x16')](_0x41c8a5);}return _0x31c2b5[_0x5d8b('0x17')](_0x41c8a5)['end']();};}function respondWithResult(_0x4e597f,_0x5bb82b){_0x5bb82b=_0x5bb82b||0xc8;return function(_0x4440b8){if(_0x4440b8){return _0x4e597f[_0x5d8b('0x17')](_0x5bb82b)[_0x5d8b('0x18')](_0x4440b8);}};}function respondWithFilteredResult(_0x174e08,_0x152478){return function(_0x7f4646){if(_0x7f4646){var _0x2b8091=typeof _0x152478[_0x5d8b('0x19')]===_0x5d8b('0x1a')&&typeof _0x152478[_0x5d8b('0x1b')]===_0x5d8b('0x1a');var _0x224ea3=_0x7f4646[_0x5d8b('0x1c')];var _0x518bce=_0x2b8091?0x0:_0x152478['offset'];var _0x2aa777=_0x2b8091?_0x7f4646['count']:_0x152478[_0x5d8b('0x19')]+_0x152478['limit'];var _0x167cab;if(_0x2aa777>=_0x224ea3){_0x2aa777=_0x224ea3;_0x167cab=0xc8;}else{_0x167cab=0xce;}_0x174e08[_0x5d8b('0x17')](_0x167cab);return _0x174e08[_0x5d8b('0x1d')](_0x5d8b('0x1e'),_0x518bce+'-'+_0x2aa777+'/'+_0x224ea3)[_0x5d8b('0x18')](_0x7f4646);}return null;};}function patchUpdates(_0x38d0f2){return function(_0x3dca35){try{jsonpatch[_0x5d8b('0x1f')](_0x3dca35,_0x38d0f2,!![]);}catch(_0x58118b){return BPromise[_0x5d8b('0x20')](_0x58118b);}return _0x3dca35[_0x5d8b('0x21')]();};}function saveUpdates(_0x21bff6,_0x16df93){return function(_0x238774){if(_0x238774){return _0x238774[_0x5d8b('0x22')](_0x21bff6)[_0x5d8b('0x23')](function(_0x2a6dbd){return _0x2a6dbd;});}return null;};}function removeEntity(_0x4cb303,_0x4aecf4){return function(_0x3ff1b2){if(_0x3ff1b2){return _0x3ff1b2[_0x5d8b('0x24')]()[_0x5d8b('0x23')](function(){var _0x2d9691=_0x3ff1b2[_0x5d8b('0x25')]({'plain':!![]});var _0x42b34c=_0x5d8b('0x26');return db[_0x5d8b('0x27')][_0x5d8b('0x24')]({'where':{'type':_0x42b34c,'resourceId':_0x2d9691['id']}})[_0x5d8b('0x23')](function(){return _0x3ff1b2;});})[_0x5d8b('0x23')](function(){_0x4cb303['status'](0xcc)[_0x5d8b('0x28')]();});}};}function handleEntityNotFound(_0x417aa5,_0x1f5e92){return function(_0x43995a){if(!_0x43995a){_0x417aa5[_0x5d8b('0x16')](0x194);}return _0x43995a;};}function handleError(_0x322c4b,_0x10ceb6){_0x10ceb6=_0x10ceb6||0x1f4;return function(_0x18daa8){logger[_0x5d8b('0x29')](_0x18daa8[_0x5d8b('0x2a')]);if(_0x18daa8[_0x5d8b('0x2b')]){delete _0x18daa8[_0x5d8b('0x2b')];}_0x322c4b[_0x5d8b('0x17')](_0x10ceb6)[_0x5d8b('0x2c')](_0x18daa8);};}exports[_0x5d8b('0x2d')]=function(_0x44dd80,_0x9cde6a){var _0x1225fe={},_0x372d60={},_0x296c47={'count':0x0,'rows':[]};var _0x19252e=_[_0x5d8b('0x2e')](db[_0x5d8b('0x2f')][_0x5d8b('0x30')],function(_0x27979a){return{'name':_0x27979a['fieldName'],'type':_0x27979a[_0x5d8b('0x31')][_0x5d8b('0x32')]};});_0x372d60[_0x5d8b('0x33')]=_[_0x5d8b('0x2e')](_0x19252e,_0x5d8b('0x2b'));_0x372d60[_0x5d8b('0x34')]=_[_0x5d8b('0x35')](_0x44dd80[_0x5d8b('0x34')]);_0x372d60['filters']=_[_0x5d8b('0x36')](_0x372d60['model'],_0x372d60[_0x5d8b('0x34')]);_0x1225fe['attributes']=_['intersection'](_0x372d60['model'],qs[_0x5d8b('0x37')](_0x44dd80[_0x5d8b('0x34')][_0x5d8b('0x37')]));_0x1225fe['attributes']=_0x1225fe[_0x5d8b('0x38')][_0x5d8b('0x39')]?_0x1225fe['attributes']:_0x372d60[_0x5d8b('0x33')];if(!_0x44dd80[_0x5d8b('0x34')][_0x5d8b('0x3a')]('nolimit')){_0x1225fe[_0x5d8b('0x1b')]=qs[_0x5d8b('0x1b')](_0x44dd80[_0x5d8b('0x34')][_0x5d8b('0x1b')]);_0x1225fe[_0x5d8b('0x19')]=qs[_0x5d8b('0x19')](_0x44dd80[_0x5d8b('0x34')][_0x5d8b('0x19')]);}_0x1225fe[_0x5d8b('0x3b')]=qs[_0x5d8b('0x3c')](_0x44dd80[_0x5d8b('0x34')][_0x5d8b('0x3c')]);_0x1225fe[_0x5d8b('0x3d')]=qs[_0x5d8b('0x3e')](_['pick'](_0x44dd80[_0x5d8b('0x34')],_0x372d60[_0x5d8b('0x3e')]),_0x19252e);if(_0x44dd80[_0x5d8b('0x34')]['filter']){_0x1225fe[_0x5d8b('0x3d')]=_[_0x5d8b('0x3f')](_0x1225fe[_0x5d8b('0x3d')],{'$or':_[_0x5d8b('0x2e')](_0x19252e,function(_0x5baf5b){if(_0x5baf5b[_0x5d8b('0x31')]!==_0x5d8b('0x40')){var _0x52f2e8={};_0x52f2e8[_0x5baf5b['name']]={'$like':'%'+_0x44dd80[_0x5d8b('0x34')][_0x5d8b('0x41')]+'%'};return _0x52f2e8;}})});}_0x1225fe=_[_0x5d8b('0x3f')]({},_0x1225fe,_0x44dd80['options']);var _0x4958b2={'where':_0x1225fe[_0x5d8b('0x3d')]};return db[_0x5d8b('0x2f')][_0x5d8b('0x1c')](_0x4958b2)[_0x5d8b('0x23')](function(_0x23508d){_0x296c47[_0x5d8b('0x1c')]=_0x23508d;if(_0x44dd80['query'][_0x5d8b('0x42')]){_0x1225fe[_0x5d8b('0x43')]=[{'all':!![]}];}return db[_0x5d8b('0x2f')][_0x5d8b('0x44')](_0x1225fe);})['then'](function(_0x2aa438){_0x296c47[_0x5d8b('0x45')]=_0x2aa438;return _0x296c47;})['then'](respondWithFilteredResult(_0x9cde6a,_0x1225fe))[_0x5d8b('0x46')](handleError(_0x9cde6a,null));};exports[_0x5d8b('0x47')]=function(_0x58cdcc,_0x5e3989){var _0x44dade={'raw':![],'where':{'id':_0x58cdcc[_0x5d8b('0x48')]['id']}},_0x4fc8a3={};_0x4fc8a3[_0x5d8b('0x33')]=_[_0x5d8b('0x35')](db[_0x5d8b('0x2f')][_0x5d8b('0x30')]);_0x4fc8a3['query']=_[_0x5d8b('0x35')](_0x58cdcc[_0x5d8b('0x34')]);_0x4fc8a3[_0x5d8b('0x3e')]=_[_0x5d8b('0x36')](_0x4fc8a3[_0x5d8b('0x33')],_0x4fc8a3[_0x5d8b('0x34')]);_0x44dade['attributes']=_[_0x5d8b('0x36')](_0x4fc8a3[_0x5d8b('0x33')],qs[_0x5d8b('0x37')](_0x58cdcc[_0x5d8b('0x34')]['fields']));_0x44dade[_0x5d8b('0x38')]=_0x44dade[_0x5d8b('0x38')][_0x5d8b('0x39')]?_0x44dade[_0x5d8b('0x38')]:_0x4fc8a3[_0x5d8b('0x33')];if(_0x58cdcc[_0x5d8b('0x34')]['includeAll']){_0x44dade[_0x5d8b('0x43')]=[{'all':!![]}];}_0x44dade=_['merge']({},_0x44dade,_0x58cdcc[_0x5d8b('0x49')]);return db[_0x5d8b('0x2f')]['find'](_0x44dade)[_0x5d8b('0x23')](handleEntityNotFound(_0x5e3989,null))[_0x5d8b('0x23')](respondWithResult(_0x5e3989,null))[_0x5d8b('0x46')](handleError(_0x5e3989,null));};exports[_0x5d8b('0x4a')]=function(_0xf51b81,_0x4b1563){return db[_0x5d8b('0x2f')][_0x5d8b('0x4a')](_0xf51b81[_0x5d8b('0x4b')],{})['then'](function(_0x8e12db){var _0x47f2af=_0xf51b81[_0x5d8b('0x4c')][_0x5d8b('0x25')]({'plain':!![]});if(!_0x47f2af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47f2af[_0x5d8b('0x4d')]===_0x5d8b('0x4c')){var _0x56744c=_0x8e12db[_0x5d8b('0x25')]({'plain':!![]});var _0x2748f8=_0x5d8b('0x26');return db[_0x5d8b('0x4e')][_0x5d8b('0x4f')]({'where':{'name':_0x2748f8,'userProfileId':_0x47f2af['userProfileId']},'raw':!![]})[_0x5d8b('0x23')](function(_0x133135){if(_0x133135&&_0x133135['autoAssociation']===0x0){return db[_0x5d8b('0x27')]['create']({'name':_0x56744c[_0x5d8b('0x2b')],'resourceId':_0x56744c['id'],'type':_0x133135[_0x5d8b('0x2b')],'sectionId':_0x133135['id']},{})[_0x5d8b('0x23')](function(){return _0x8e12db;});}else{return _0x8e12db;}})[_0x5d8b('0x46')](function(_0x4d6793){logger[_0x5d8b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d6793);throw _0x4d6793;});}return _0x8e12db;})[_0x5d8b('0x23')](respondWithResult(_0x4b1563,0xc9))[_0x5d8b('0x46')](handleError(_0x4b1563,null));};exports[_0x5d8b('0x22')]=function(_0x1cbf96,_0x2b10f8){if(_0x1cbf96[_0x5d8b('0x4b')]['id']){delete _0x1cbf96[_0x5d8b('0x4b')]['id'];}return db[_0x5d8b('0x2f')][_0x5d8b('0x4f')]({'where':{'id':_0x1cbf96[_0x5d8b('0x48')]['id']}})[_0x5d8b('0x23')](handleEntityNotFound(_0x2b10f8,null))['then'](saveUpdates(_0x1cbf96['body'],null))['then'](respondWithResult(_0x2b10f8,null))[_0x5d8b('0x46')](handleError(_0x2b10f8,null));};exports['destroy']=function(_0x55b2fe,_0x165f16){return db[_0x5d8b('0x2f')]['find']({'where':{'id':_0x55b2fe[_0x5d8b('0x48')]['id']}})[_0x5d8b('0x23')](handleEntityNotFound(_0x165f16,null))[_0x5d8b('0x23')](removeEntity(_0x165f16,null))[_0x5d8b('0x46')](handleError(_0x165f16,null));};exports['run']=function(_0xa3365a,_0x473ddf,_0x4011d3){var _0x4ead70=require(_0x5d8b('0x50'));return db[_0x5d8b('0x2f')]['find']({'where':{'id':_0xa3365a[_0x5d8b('0x48')]['id']},'raw':!![]})[_0x5d8b('0x23')](handleEntityNotFound(_0x473ddf,null))[_0x5d8b('0x23')](function(){_0x4ead70['run'](_0xa3365a[_0x5d8b('0x48')]['id']);})['then'](respondWithStatusCode(_0x473ddf,null))['catch'](handleError(_0x473ddf,null));}; \ No newline at end of file +var _0xefb6=['reject','save','update','destroy','Scheduler','UserProfileResource','then','stack','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Schedule','includeAll','findAll','show','params','include','find','catch','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xefb6,0x135));var _0x6efb=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xefb6[_0xf26c2e];return _0x46ecb4;};'use strict';var emlformat=require(_0x6efb('0x0'));var rimraf=require(_0x6efb('0x1'));var zipdir=require(_0x6efb('0x2'));var jsonpatch=require(_0x6efb('0x3'));var rp=require('request-promise');var moment=require(_0x6efb('0x4'));var BPromise=require(_0x6efb('0x5'));var Mustache=require(_0x6efb('0x6'));var util=require(_0x6efb('0x7'));var path=require(_0x6efb('0x8'));var sox=require(_0x6efb('0x9'));var csv=require('to-csv');var ejs=require(_0x6efb('0xa'));var fs=require('fs');var fs_extra=require(_0x6efb('0xb'));var _=require('lodash');var squel=require(_0x6efb('0xc'));var crypto=require(_0x6efb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6efb('0xe'));var querystring=require('querystring');var Papa=require(_0x6efb('0xf'));var Redis=require(_0x6efb('0x10'));var authService=require(_0x6efb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6efb('0x12'));var hardwareService=require(_0x6efb('0x13'));var logger=require(_0x6efb('0x14'))('api');var utils=require(_0x6efb('0x15'));var config=require(_0x6efb('0x16'));var licenseUtil=require(_0x6efb('0x17'));var db=require(_0x6efb('0x18'))['db'];function respondWithStatusCode(_0x826c24,_0x3c9413){_0x3c9413=_0x3c9413||0xcc;return function(_0x2e635f){if(_0x2e635f){return _0x826c24[_0x6efb('0x19')](_0x3c9413);}return _0x826c24[_0x6efb('0x1a')](_0x3c9413)[_0x6efb('0x1b')]();};}function respondWithResult(_0xd538c2,_0x73eb99){_0x73eb99=_0x73eb99||0xc8;return function(_0x5447bb){if(_0x5447bb){return _0xd538c2[_0x6efb('0x1a')](_0x73eb99)['json'](_0x5447bb);}};}function respondWithFilteredResult(_0x28dbaa,_0x2c34d4){return function(_0x503b0e){if(_0x503b0e){var _0x4137e4=typeof _0x2c34d4['offset']===_0x6efb('0x1c')&&typeof _0x2c34d4[_0x6efb('0x1d')]===_0x6efb('0x1c');var _0x1af171=_0x503b0e[_0x6efb('0x1e')];var _0x4a5996=_0x4137e4?0x0:_0x2c34d4[_0x6efb('0x1f')];var _0x30f03e=_0x4137e4?_0x503b0e[_0x6efb('0x1e')]:_0x2c34d4[_0x6efb('0x1f')]+_0x2c34d4[_0x6efb('0x1d')];var _0x4e47e2;if(_0x30f03e>=_0x1af171){_0x30f03e=_0x1af171;_0x4e47e2=0xc8;}else{_0x4e47e2=0xce;}_0x28dbaa[_0x6efb('0x1a')](_0x4e47e2);return _0x28dbaa['set'](_0x6efb('0x20'),_0x4a5996+'-'+_0x30f03e+'/'+_0x1af171)[_0x6efb('0x21')](_0x503b0e);}return null;};}function patchUpdates(_0x56a12d){return function(_0x9b4b09){try{jsonpatch[_0x6efb('0x22')](_0x9b4b09,_0x56a12d,!![]);}catch(_0x3514e4){return BPromise[_0x6efb('0x23')](_0x3514e4);}return _0x9b4b09[_0x6efb('0x24')]();};}function saveUpdates(_0x52e97b,_0x87e136){return function(_0x36b8a2){if(_0x36b8a2){return _0x36b8a2[_0x6efb('0x25')](_0x52e97b)['then'](function(_0x515267){return _0x515267;});}return null;};}function removeEntity(_0x1acf56,_0x889629){return function(_0x58005a){if(_0x58005a){return _0x58005a[_0x6efb('0x26')]()['then'](function(){var _0xbada91=_0x58005a['get']({'plain':!![]});var _0x20ec4a=_0x6efb('0x27');return db[_0x6efb('0x28')][_0x6efb('0x26')]({'where':{'type':_0x20ec4a,'resourceId':_0xbada91['id']}})[_0x6efb('0x29')](function(){return _0x58005a;});})[_0x6efb('0x29')](function(){_0x1acf56['status'](0xcc)[_0x6efb('0x1b')]();});}};}function handleEntityNotFound(_0x5cc75a,_0x1edf54){return function(_0x47cdfe){if(!_0x47cdfe){_0x5cc75a[_0x6efb('0x19')](0x194);}return _0x47cdfe;};}function handleError(_0x50d0d6,_0x24b570){_0x24b570=_0x24b570||0x1f4;return function(_0x33fe95){logger['error'](_0x33fe95[_0x6efb('0x2a')]);if(_0x33fe95['name']){delete _0x33fe95['name'];}_0x50d0d6['status'](_0x24b570)[_0x6efb('0x2b')](_0x33fe95);};}exports[_0x6efb('0x2c')]=function(_0x104963,_0x53df69){var _0x5072c9={},_0x484654={},_0x5d8c9={'count':0x0,'rows':[]};var _0x53c44e=_[_0x6efb('0x2d')](db['Schedule'][_0x6efb('0x2e')],function(_0x59a0eb){return{'name':_0x59a0eb['fieldName'],'type':_0x59a0eb[_0x6efb('0x2f')][_0x6efb('0x30')]};});_0x484654[_0x6efb('0x31')]=_[_0x6efb('0x2d')](_0x53c44e,_0x6efb('0x32'));_0x484654[_0x6efb('0x33')]=_[_0x6efb('0x34')](_0x104963[_0x6efb('0x33')]);_0x484654[_0x6efb('0x35')]=_[_0x6efb('0x36')](_0x484654[_0x6efb('0x31')],_0x484654['query']);_0x5072c9[_0x6efb('0x37')]=_[_0x6efb('0x36')](_0x484654[_0x6efb('0x31')],qs[_0x6efb('0x38')](_0x104963[_0x6efb('0x33')][_0x6efb('0x38')]));_0x5072c9['attributes']=_0x5072c9[_0x6efb('0x37')][_0x6efb('0x39')]?_0x5072c9[_0x6efb('0x37')]:_0x484654[_0x6efb('0x31')];if(!_0x104963[_0x6efb('0x33')][_0x6efb('0x3a')]('nolimit')){_0x5072c9[_0x6efb('0x1d')]=qs[_0x6efb('0x1d')](_0x104963['query'][_0x6efb('0x1d')]);_0x5072c9[_0x6efb('0x1f')]=qs['offset'](_0x104963[_0x6efb('0x33')]['offset']);}_0x5072c9[_0x6efb('0x3b')]=qs[_0x6efb('0x3c')](_0x104963['query'][_0x6efb('0x3c')]);_0x5072c9[_0x6efb('0x3d')]=qs['filters'](_[_0x6efb('0x3e')](_0x104963[_0x6efb('0x33')],_0x484654[_0x6efb('0x35')]),_0x53c44e);if(_0x104963[_0x6efb('0x33')][_0x6efb('0x3f')]){_0x5072c9[_0x6efb('0x3d')]=_[_0x6efb('0x40')](_0x5072c9[_0x6efb('0x3d')],{'$or':_[_0x6efb('0x2d')](_0x53c44e,function(_0x5ee87e){if(_0x5ee87e['type']!==_0x6efb('0x41')){var _0x31550c={};_0x31550c[_0x5ee87e['name']]={'$like':'%'+_0x104963['query'][_0x6efb('0x3f')]+'%'};return _0x31550c;}})});}_0x5072c9=_[_0x6efb('0x40')]({},_0x5072c9,_0x104963[_0x6efb('0x42')]);var _0x5d38a0={'where':_0x5072c9[_0x6efb('0x3d')]};return db[_0x6efb('0x43')][_0x6efb('0x1e')](_0x5d38a0)[_0x6efb('0x29')](function(_0x4c66b7){_0x5d8c9[_0x6efb('0x1e')]=_0x4c66b7;if(_0x104963[_0x6efb('0x33')][_0x6efb('0x44')]){_0x5072c9['include']=[{'all':!![]}];}return db[_0x6efb('0x43')][_0x6efb('0x45')](_0x5072c9);})[_0x6efb('0x29')](function(_0x123b0e){_0x5d8c9['rows']=_0x123b0e;return _0x5d8c9;})[_0x6efb('0x29')](respondWithFilteredResult(_0x53df69,_0x5072c9))['catch'](handleError(_0x53df69,null));};exports[_0x6efb('0x46')]=function(_0x24e452,_0x1c26f9){var _0x160997={'raw':![],'where':{'id':_0x24e452[_0x6efb('0x47')]['id']}},_0x160f46={};_0x160f46['model']=_['keys'](db[_0x6efb('0x43')][_0x6efb('0x2e')]);_0x160f46[_0x6efb('0x33')]=_[_0x6efb('0x34')](_0x24e452['query']);_0x160f46[_0x6efb('0x35')]=_[_0x6efb('0x36')](_0x160f46[_0x6efb('0x31')],_0x160f46['query']);_0x160997[_0x6efb('0x37')]=_[_0x6efb('0x36')](_0x160f46['model'],qs[_0x6efb('0x38')](_0x24e452[_0x6efb('0x33')]['fields']));_0x160997[_0x6efb('0x37')]=_0x160997['attributes'][_0x6efb('0x39')]?_0x160997[_0x6efb('0x37')]:_0x160f46['model'];if(_0x24e452[_0x6efb('0x33')][_0x6efb('0x44')]){_0x160997[_0x6efb('0x48')]=[{'all':!![]}];}_0x160997=_['merge']({},_0x160997,_0x24e452[_0x6efb('0x42')]);return db[_0x6efb('0x43')][_0x6efb('0x49')](_0x160997)[_0x6efb('0x29')](handleEntityNotFound(_0x1c26f9,null))[_0x6efb('0x29')](respondWithResult(_0x1c26f9,null))[_0x6efb('0x4a')](handleError(_0x1c26f9,null));};exports[_0x6efb('0x4b')]=function(_0x36ff9b,_0xf973c8){return db[_0x6efb('0x43')][_0x6efb('0x4b')](_0x36ff9b[_0x6efb('0x4c')],{})[_0x6efb('0x29')](function(_0xde50f6){var _0x3a430f=_0x36ff9b['user'][_0x6efb('0x4d')]({'plain':!![]});if(!_0x3a430f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a430f[_0x6efb('0x4e')]===_0x6efb('0x4f')){var _0x3b19a5=_0xde50f6[_0x6efb('0x4d')]({'plain':!![]});var _0x3643cb='Scheduler';return db[_0x6efb('0x50')]['find']({'where':{'name':_0x3643cb,'userProfileId':_0x3a430f[_0x6efb('0x51')]},'raw':!![]})['then'](function(_0x1a65bd){if(_0x1a65bd&&_0x1a65bd[_0x6efb('0x52')]===0x0){return db[_0x6efb('0x28')][_0x6efb('0x4b')]({'name':_0x3b19a5[_0x6efb('0x32')],'resourceId':_0x3b19a5['id'],'type':_0x1a65bd[_0x6efb('0x32')],'sectionId':_0x1a65bd['id']},{})[_0x6efb('0x29')](function(){return _0xde50f6;});}else{return _0xde50f6;}})[_0x6efb('0x4a')](function(_0x5c68fe){logger['error'](_0x6efb('0x53'),_0x5c68fe);throw _0x5c68fe;});}return _0xde50f6;})['then'](respondWithResult(_0xf973c8,0xc9))['catch'](handleError(_0xf973c8,null));};exports[_0x6efb('0x25')]=function(_0x33db07,_0x4b1632){if(_0x33db07[_0x6efb('0x4c')]['id']){delete _0x33db07[_0x6efb('0x4c')]['id'];}return db[_0x6efb('0x43')][_0x6efb('0x49')]({'where':{'id':_0x33db07[_0x6efb('0x47')]['id']}})[_0x6efb('0x29')](handleEntityNotFound(_0x4b1632,null))[_0x6efb('0x29')](saveUpdates(_0x33db07[_0x6efb('0x4c')],null))[_0x6efb('0x29')](respondWithResult(_0x4b1632,null))[_0x6efb('0x4a')](handleError(_0x4b1632,null));};exports['destroy']=function(_0x4156ab,_0x3633f6){return db[_0x6efb('0x43')]['find']({'where':{'id':_0x4156ab[_0x6efb('0x47')]['id']}})[_0x6efb('0x29')](handleEntityNotFound(_0x3633f6,null))['then'](removeEntity(_0x3633f6,null))['catch'](handleError(_0x3633f6,null));};exports[_0x6efb('0x54')]=function(_0x17846,_0x31c8fa,_0x1c9791){var _0x50d2ce=require(_0x6efb('0x55'));return db[_0x6efb('0x43')][_0x6efb('0x49')]({'where':{'id':_0x17846['params']['id']},'raw':!![]})[_0x6efb('0x29')](handleEntityNotFound(_0x31c8fa,null))[_0x6efb('0x29')](function(){_0x50d2ce[_0x6efb('0x54')](_0x17846[_0x6efb('0x47')]['id']);})[_0x6efb('0x29')](respondWithStatusCode(_0x31c8fa,null))[_0x6efb('0x4a')](handleError(_0x31c8fa,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 96d2a27..eac1609 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 _0x6cdd=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','lodash'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x6cdd,0x143));var _0xd6cd=function(_0x475576,_0x43267f){_0x475576=_0x475576-0x0;var _0x49bd08=_0x6cdd[_0x475576];return _0x49bd08;};'use strict';var _=require(_0xd6cd('0x0'));var util=require(_0xd6cd('0x1'));var logger=require(_0xd6cd('0x2'))(_0xd6cd('0x3'));var moment=require(_0xd6cd('0x4'));var BPromise=require(_0xd6cd('0x5'));var rp=require(_0xd6cd('0x6'));var fs=require('fs');var path=require(_0xd6cd('0x7'));var rimraf=require(_0xd6cd('0x8'));var config=require(_0xd6cd('0x9'));var attributes=require(_0xd6cd('0xa'));module[_0xd6cd('0xb')]=function(_0x438bde,_0x6e2c86){return _0x438bde['define']('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1171=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger'];(function(_0x28c3aa,_0x463307){var _0x4d0ede=function(_0x1c5a53){while(--_0x1c5a53){_0x28c3aa['push'](_0x28c3aa['shift']());}};_0x4d0ede(++_0x463307);}(_0x1171,0xcf));var _0x1117=function(_0x45c0da,_0x4f9492){_0x45c0da=_0x45c0da-0x0;var _0x51efff=_0x1171[_0x45c0da];return _0x51efff;};'use strict';var _=require(_0x1117('0x0'));var util=require(_0x1117('0x1'));var logger=require(_0x1117('0x2'))('api');var moment=require(_0x1117('0x3'));var BPromise=require(_0x1117('0x4'));var rp=require(_0x1117('0x5'));var fs=require('fs');var path=require(_0x1117('0x6'));var rimraf=require(_0x1117('0x7'));var config=require(_0x1117('0x8'));var attributes=require(_0x1117('0x9'));module[_0x1117('0xa')]=function(_0x30a4b0,_0x54e09b){return _0x30a4b0[_0x1117('0xb')](_0x1117('0xc'),attributes,{'tableName':_0x1117('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 7a75bcb..a444705 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 _0x6869=['jayson/promise','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x107844,_0x41926f){var _0x40c2b5=function(_0x2d0c58){while(--_0x2d0c58){_0x107844['push'](_0x107844['shift']());}};_0x40c2b5(++_0x41926f);}(_0x6869,0x160));var _0x9686=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6869[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x9686('0x0'));var util=require(_0x9686('0x1'));var moment=require(_0x9686('0x2'));var BPromise=require(_0x9686('0x3'));var rs=require(_0x9686('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9686('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9686('0x6'));var config=require(_0x9686('0x7'));var jayson=require(_0x9686('0x8'));var client=jayson[_0x9686('0x9')][_0x9686('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e93b2,_0x338bdf,_0x4fe9be){return new BPromise(function(_0x4db92b,_0x5d0360){return client[_0x9686('0xb')](_0x3e93b2,_0x4fe9be)[_0x9686('0xc')](function(_0x472f14){logger[_0x9686('0xd')]('Schedule,\x20%s,\x20%s',_0x338bdf,_0x9686('0xe'));logger[_0x9686('0xf')](_0x9686('0x10'),_0x338bdf,'request\x20sent',JSON[_0x9686('0x11')](_0x472f14));if(_0x472f14['error']){if(_0x472f14[_0x9686('0x12')][_0x9686('0x13')]===0x1f4){logger[_0x9686('0x12')](_0x9686('0x14'),_0x338bdf,_0x472f14[_0x9686('0x12')][_0x9686('0x15')]);return _0x5d0360(_0x472f14[_0x9686('0x12')]['message']);}logger[_0x9686('0x12')](_0x9686('0x14'),_0x338bdf,_0x472f14['error'][_0x9686('0x15')]);return _0x4db92b(_0x472f14[_0x9686('0x12')][_0x9686('0x15')]);}else{logger[_0x9686('0xd')]('Schedule,\x20%s,\x20%s',_0x338bdf,_0x9686('0xe'));_0x4db92b(_0x472f14[_0x9686('0x16')][_0x9686('0x15')]);}})[_0x9686('0x17')](function(_0x506788){logger[_0x9686('0x12')]('Schedule,\x20%s,\x20%s',_0x338bdf,_0x506788);_0x5d0360(_0x506788);});});} \ No newline at end of file +var _0x3882=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring'];(function(_0x5c84a6,_0xa1d637){var _0x37de3a=function(_0x404b37){while(--_0x404b37){_0x5c84a6['push'](_0x5c84a6['shift']());}};_0x37de3a(++_0xa1d637);}(_0x3882,0x183));var _0x2388=function(_0x409ab7,_0x554b51){_0x409ab7=_0x409ab7-0x0;var _0x32727b=_0x3882[_0x409ab7];return _0x32727b;};'use strict';var _=require(_0x2388('0x0'));var util=require(_0x2388('0x1'));var moment=require(_0x2388('0x2'));var BPromise=require('bluebird');var rs=require(_0x2388('0x3'));var fs=require('fs');var Redis=require(_0x2388('0x4'));var db=require(_0x2388('0x5'))['db'];var utils=require(_0x2388('0x6'));var logger=require('../../config/logger')(_0x2388('0x7'));var config=require(_0x2388('0x8'));var jayson=require(_0x2388('0x9'));var client=jayson[_0x2388('0xa')][_0x2388('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x332e8e,_0x2d0e50,_0x4b2153){return new BPromise(function(_0x2abb60,_0x52f173){return client[_0x2388('0xc')](_0x332e8e,_0x4b2153)[_0x2388('0xd')](function(_0x123695){logger[_0x2388('0xe')](_0x2388('0xf'),_0x2d0e50,'request\x20sent');logger[_0x2388('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x2d0e50,'request\x20sent',JSON['stringify'](_0x123695));if(_0x123695['error']){if(_0x123695[_0x2388('0x11')][_0x2388('0x12')]===0x1f4){logger[_0x2388('0x11')]('Schedule,\x20%s,\x20%s',_0x2d0e50,_0x123695[_0x2388('0x11')][_0x2388('0x13')]);return _0x52f173(_0x123695[_0x2388('0x11')][_0x2388('0x13')]);}logger[_0x2388('0x11')](_0x2388('0xf'),_0x2d0e50,_0x123695[_0x2388('0x11')]['message']);return _0x2abb60(_0x123695[_0x2388('0x11')][_0x2388('0x13')]);}else{logger[_0x2388('0xe')]('Schedule,\x20%s,\x20%s',_0x2d0e50,_0x2388('0x14'));_0x2abb60(_0x123695[_0x2388('0x15')]['message']);}})[_0x2388('0x16')](function(_0x517a96){logger[_0x2388('0x11')](_0x2388('0xf'),_0x2d0e50,_0x517a96);_0x52f173(_0x517a96);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2c7231d..9e9ced7 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 _0xf1ae=['get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','post','create','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x5e6a71,_0x2083d6){var _0x2b1418=function(_0x49e764){while(--_0x49e764){_0x5e6a71['push'](_0x5e6a71['shift']());}};_0x2b1418(++_0x2083d6);}(_0xf1ae,0x67));var _0xef1a=function(_0x3cada9,_0x4009e1){_0x3cada9=_0x3cada9-0x0;var _0x445690=_0xf1ae[_0x3cada9];return _0x445690;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xef1a('0x0'));var timeout=require(_0xef1a('0x1'));var express=require(_0xef1a('0x2'));var router=express[_0xef1a('0x3')]();var fs_extra=require(_0xef1a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xef1a('0x5')]('/',auth[_0xef1a('0x6')](),controller[_0xef1a('0x7')]);router['get'](_0xef1a('0x8'),auth[_0xef1a('0x6')](),controller['describe']);router[_0xef1a('0x5')](_0xef1a('0x9'),auth[_0xef1a('0x6')](),controller[_0xef1a('0xa')]);router[_0xef1a('0x5')](_0xef1a('0xb'),auth[_0xef1a('0x6')](),controller[_0xef1a('0xc')]);router[_0xef1a('0xd')]('/',auth[_0xef1a('0x6')](),controller[_0xef1a('0xe')]);router['put'](_0xef1a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xef1a('0xf')](_0xef1a('0x9'),auth[_0xef1a('0x6')](),controller[_0xef1a('0x10')]);module[_0xef1a('0x11')]=router; \ No newline at end of file +var _0x3640=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5b961f,_0x1deaea){var _0x2dc936=function(_0x1784e8){while(--_0x1784e8){_0x5b961f['push'](_0x5b961f['shift']());}};_0x2dc936(++_0x1deaea);}(_0x3640,0x67));var _0x0364=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x3640[_0x342700];return _0x53406f;};'use strict';var multer=require(_0x0364('0x0'));var util=require(_0x0364('0x1'));var path=require(_0x0364('0x2'));var timeout=require(_0x0364('0x3'));var express=require('express');var router=express[_0x0364('0x4')]();var fs_extra=require(_0x0364('0x5'));var auth=require(_0x0364('0x6'));var interaction=require(_0x0364('0x7'));var config=require(_0x0364('0x8'));var controller=require(_0x0364('0x9'));router[_0x0364('0xa')]('/',auth[_0x0364('0xb')](),controller[_0x0364('0xc')]);router[_0x0364('0xa')](_0x0364('0xd'),auth[_0x0364('0xb')](),controller[_0x0364('0xe')]);router['get'](_0x0364('0xf'),auth[_0x0364('0xb')](),controller[_0x0364('0x10')]);router[_0x0364('0xa')]('/:id/download',auth[_0x0364('0xb')](),controller['download']);router[_0x0364('0x11')]('/',auth[_0x0364('0xb')](),controller[_0x0364('0x12')]);router[_0x0364('0x13')](_0x0364('0xf'),auth[_0x0364('0xb')](),controller[_0x0364('0x14')]);router[_0x0364('0x15')](_0x0364('0xf'),auth[_0x0364('0xb')](),controller[_0x0364('0x16')]);module[_0x0364('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 9091cf7..daa76d7 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 _0x6f83=['subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6f83,0x72));var _0x36f8=function(_0x50a438,_0x286759){_0x50a438=_0x50a438-0x0;var _0x499fae=_0x6f83[_0x50a438];return _0x499fae;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x36f8('0x0'));var path=require(_0x36f8('0x1'));var config=require('../../config/environment');module[_0x36f8('0x2')]={'format':{'type':Sequelize[_0x36f8('0x3')],'get':function(){return this[_0x36f8('0x4')](_0x36f8('0x5'))?path[_0x36f8('0x6')](this[_0x36f8('0x4')](_0x36f8('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x36f8('0x7')]},'channel':{'type':Sequelize[_0x36f8('0x7')]},'value':{'type':Sequelize[_0x36f8('0x7')],'set':function(_0x27d94b){var _0x2c0367=_0x27d94b[_0x36f8('0x8')](/\\/g,'/');this[_0x36f8('0x9')](_0x36f8('0x5'),_0x2c0367);}},'rating':{'type':Sequelize[_0x36f8('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x48c7b2){this['setDataValue'](_0x36f8('0xb'),moment()[_0x36f8('0xc')](_0x48c7b2,'ms'));this[_0x36f8('0x9')](_0x36f8('0xd'),moment());this[_0x36f8('0x9')](_0x36f8('0xe'),_0x48c7b2);}},'startedAt':{'type':Sequelize[_0x36f8('0xf')],'get':function(){return moment(this[_0x36f8('0x4')](_0x36f8('0xb')))['format'](_0x36f8('0x10'))[_0x36f8('0x11')]();}},'closedAt':{'type':Sequelize[_0x36f8('0xf')],'get':function(){return moment(this[_0x36f8('0x4')]('closedAt'))[_0x36f8('0x12')](_0x36f8('0x10'))[_0x36f8('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x36f8('0x4')](_0x36f8('0x13')))[_0x36f8('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x36f8('0x11')]();}},'updatedAt':{'type':Sequelize[_0x36f8('0xf')],'get':function(){return moment(this[_0x36f8('0x4')](_0x36f8('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0x36f8('0x11')]();}}}; \ No newline at end of file +var _0x70e3=['getDataValue','value','STRING','INTEGER','setDataValue','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL'];(function(_0x4567dd,_0x5dfe79){var _0x255028=function(_0x2b8dd4){while(--_0x2b8dd4){_0x4567dd['push'](_0x4567dd['shift']());}};_0x255028(++_0x5dfe79);}(_0x70e3,0x9d));var _0x370e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x70e3[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x370e('0x0'));var moment=require(_0x370e('0x1'));var path=require(_0x370e('0x2'));var config=require(_0x370e('0x3'));module['exports']={'format':{'type':Sequelize[_0x370e('0x4')],'get':function(){return this[_0x370e('0x5')](_0x370e('0x6'))?path['extname'](this[_0x370e('0x5')](_0x370e('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x370e('0x7')]},'channel':{'type':Sequelize[_0x370e('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x3a2aaf){var _0x5f57ea=_0x3a2aaf['replace'](/\\/g,'/');this['setDataValue'](_0x370e('0x6'),_0x5f57ea);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x370e('0x8')],'set':function(_0x52d611){this[_0x370e('0x9')](_0x370e('0xa'),moment()['subtract'](_0x52d611,'ms'));this['setDataValue'](_0x370e('0xb'),moment());this[_0x370e('0x9')](_0x370e('0xc'),_0x52d611);}},'startedAt':{'type':Sequelize[_0x370e('0xd')],'get':function(){return moment(this[_0x370e('0x5')]('startedAt'))[_0x370e('0xe')](_0x370e('0xf'))[_0x370e('0x10')]();}},'closedAt':{'type':Sequelize[_0x370e('0xd')],'get':function(){return moment(this[_0x370e('0x5')](_0x370e('0xb')))[_0x370e('0xe')](_0x370e('0xf'))[_0x370e('0x10')]();}},'createdAt':{'type':Sequelize[_0x370e('0xd')],'get':function(){return moment(this[_0x370e('0x5')]('createdAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x370e('0x10')]();}},'updatedAt':{'type':Sequelize[_0x370e('0xd')],'get':function(){return moment(this[_0x370e('0x5')](_0x370e('0x11')))[_0x370e('0xe')](_0x370e('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index f2c2f64..d0ccf2b 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 _0x032e=['status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','send','rawAttributes','fieldName','type','model','differenceBy','map','format','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ScreenRecording','rows','catch','show','find','create','body','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','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','.cypher','unlinkSync','destroy','eml-format','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x58995e,_0x530098){var _0x1c29b8=function(_0x28da27){while(--_0x28da27){_0x58995e['push'](_0x58995e['shift']());}};_0x1c29b8(++_0x530098);}(_0x032e,0x124));var _0xe032=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x032e[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0xe032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe032('0x1'));var jsonpatch=require(_0xe032('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe032('0x3'));var Mustache=require(_0xe032('0x4'));var util=require(_0xe032('0x5'));var path=require(_0xe032('0x6'));var sox=require(_0xe032('0x7'));var csv=require(_0xe032('0x8'));var ejs=require(_0xe032('0x9'));var fs=require('fs');var fs_extra=require(_0xe032('0xa'));var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x8'));var querystring=require(_0xe032('0x10'));var Papa=require(_0xe032('0x11'));var Redis=require(_0xe032('0x12'));var authService=require(_0xe032('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe032('0x14'));var hardwareService=require(_0xe032('0x15'));var logger=require(_0xe032('0x16'))(_0xe032('0x17'));var utils=require(_0xe032('0x18'));var config=require(_0xe032('0x19'));var licenseUtil=require(_0xe032('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xcc;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0x1b')](_0x266d71);}return _0x646979['status'](_0x266d71)[_0xe032('0x1c')]();};}function respondWithResult(_0x2e267b,_0x176547){_0x176547=_0x176547||0xc8;return function(_0x422e96){if(_0x422e96){return _0x2e267b[_0xe032('0x1d')](_0x176547)[_0xe032('0x1e')](_0x422e96);}};}function respondWithFilteredResult(_0x2bf528,_0x4da5b7){return function(_0x231c35){if(_0x231c35){var _0x749018=typeof _0x4da5b7[_0xe032('0x1f')]===_0xe032('0x20')&&typeof _0x4da5b7[_0xe032('0x21')]===_0xe032('0x20');var _0x4cdab3=_0x231c35[_0xe032('0x22')];var _0x25cedb=_0x749018?0x0:_0x4da5b7[_0xe032('0x1f')];var _0x41d2a5=_0x749018?_0x231c35[_0xe032('0x22')]:_0x4da5b7['offset']+_0x4da5b7['limit'];var _0x484e6c;if(_0x41d2a5>=_0x4cdab3){_0x41d2a5=_0x4cdab3;_0x484e6c=0xc8;}else{_0x484e6c=0xce;}_0x2bf528[_0xe032('0x1d')](_0x484e6c);return _0x2bf528['set'](_0xe032('0x23'),_0x25cedb+'-'+_0x41d2a5+'/'+_0x4cdab3)[_0xe032('0x1e')](_0x231c35);}return null;};}function patchUpdates(_0x3f0257){return function(_0x2aa342){try{jsonpatch[_0xe032('0x24')](_0x2aa342,_0x3f0257,!![]);}catch(_0x256f71){return BPromise[_0xe032('0x25')](_0x256f71);}return _0x2aa342['save']();};}function saveUpdates(_0x32f8b6,_0x866c81){return function(_0x232e8f){if(_0x232e8f){return _0x232e8f[_0xe032('0x26')](_0x32f8b6)[_0xe032('0x27')](function(_0x33d89a){return _0x33d89a;});}return null;};}function removeEntity(_0x22831a,_0xe89aa7){return function(_0x499da5){if(_0x499da5){return _0x499da5['destroy']()['then'](function(){_0x22831a[_0xe032('0x1d')](0xcc)[_0xe032('0x1c')]();});}};}function handleEntityNotFound(_0x302559,_0x2a56e5){return function(_0x2bfe8f){if(!_0x2bfe8f){_0x302559[_0xe032('0x1b')](0x194);}return _0x2bfe8f;};}function handleError(_0x36ece7,_0x2b6ffa){_0x2b6ffa=_0x2b6ffa||0x1f4;return function(_0x4dcbf1){logger[_0xe032('0x28')](_0x4dcbf1['stack']);if(_0x4dcbf1[_0xe032('0x29')]){delete _0x4dcbf1[_0xe032('0x29')];}_0x36ece7[_0xe032('0x1d')](_0x2b6ffa)[_0xe032('0x2a')](_0x4dcbf1);};}exports['index']=function(_0x5573e4,_0x3e2575){var _0x38e7ea={},_0x469290={},_0xae116e={'count':0x0,'rows':[]};var _0x4e8b72=_['map'](db['ScreenRecording'][_0xe032('0x2b')],function(_0x1dd34f){return{'name':_0x1dd34f[_0xe032('0x2c')],'type':_0x1dd34f[_0xe032('0x2d')]['key']};});_0x469290[_0xe032('0x2e')]=_[_0xe032('0x2f')](_[_0xe032('0x30')](_0x4e8b72,_0xe032('0x29')),[_0xe032('0x31')]);_0x469290['query']=_[_0xe032('0x32')](_0x5573e4[_0xe032('0x33')]);_0x469290[_0xe032('0x34')]=_[_0xe032('0x35')](_0x469290['model'],_0x469290[_0xe032('0x33')]);_0x38e7ea['attributes']=_[_0xe032('0x35')](_0x469290['model'],qs[_0xe032('0x36')](_0x5573e4['query'][_0xe032('0x36')]));_0x38e7ea['attributes']=_0x38e7ea[_0xe032('0x37')][_0xe032('0x38')]?_0x38e7ea['attributes']:_0x469290[_0xe032('0x2e')];if(!_0x5573e4[_0xe032('0x33')][_0xe032('0x39')](_0xe032('0x3a'))){_0x38e7ea['limit']=qs[_0xe032('0x21')](_0x5573e4['query'][_0xe032('0x21')]);_0x38e7ea[_0xe032('0x1f')]=qs['offset'](_0x5573e4[_0xe032('0x33')][_0xe032('0x1f')]);}_0x38e7ea['order']=qs[_0xe032('0x3b')](_0x5573e4[_0xe032('0x33')][_0xe032('0x3b')]);_0x38e7ea[_0xe032('0x3c')]=qs[_0xe032('0x34')](_[_0xe032('0x3d')](_0x5573e4[_0xe032('0x33')],_0x469290[_0xe032('0x34')]),_0x4e8b72);if(_0x5573e4[_0xe032('0x33')][_0xe032('0x3e')]){_0x38e7ea[_0xe032('0x3c')]=_[_0xe032('0x3f')](_0x38e7ea[_0xe032('0x3c')],{'$or':_[_0xe032('0x30')](_0x4e8b72,function(_0x39af44){if(_0x39af44[_0xe032('0x2d')]!==_0xe032('0x40')){var _0x555914={};_0x555914[_0x39af44[_0xe032('0x29')]]={'$like':'%'+_0x5573e4['query'][_0xe032('0x3e')]+'%'};return _0x555914;}})});}_0x38e7ea=_[_0xe032('0x3f')]({},_0x38e7ea,_0x5573e4[_0xe032('0x41')]);var _0x119790={'where':_0x38e7ea[_0xe032('0x3c')]};return db['ScreenRecording'][_0xe032('0x22')](_0x119790)['then'](function(_0x46ea84){_0xae116e['count']=_0x46ea84;if(_0x5573e4[_0xe032('0x33')][_0xe032('0x42')]){_0x38e7ea[_0xe032('0x43')]=[{'all':!![]}];}return db[_0xe032('0x44')]['findAll'](_0x38e7ea);})[_0xe032('0x27')](function(_0x5a6450){_0xae116e[_0xe032('0x45')]=_0x5a6450;return _0xae116e;})[_0xe032('0x27')](respondWithFilteredResult(_0x3e2575,_0x38e7ea))[_0xe032('0x46')](handleError(_0x3e2575,null));};exports[_0xe032('0x47')]=function(_0x4b58eb,_0x513b0c){var _0x45345d={'raw':![],'where':{'id':_0x4b58eb['params']['id']}},_0x203021={};_0x203021[_0xe032('0x2e')]=_[_0xe032('0x32')](db[_0xe032('0x44')][_0xe032('0x2b')]);_0x203021[_0xe032('0x33')]=_['keys'](_0x4b58eb[_0xe032('0x33')]);_0x203021[_0xe032('0x34')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],_0x203021[_0xe032('0x33')]);_0x45345d[_0xe032('0x37')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],qs['fields'](_0x4b58eb['query'][_0xe032('0x36')]));_0x45345d['attributes']=_0x45345d[_0xe032('0x37')][_0xe032('0x38')]?_0x45345d[_0xe032('0x37')]:_0x203021[_0xe032('0x2e')];if(_0x4b58eb[_0xe032('0x33')][_0xe032('0x42')]){_0x45345d[_0xe032('0x43')]=[{'all':!![]}];}_0x45345d=_[_0xe032('0x3f')]({},_0x45345d,_0x4b58eb[_0xe032('0x41')]);return db['ScreenRecording'][_0xe032('0x48')](_0x45345d)['then'](handleEntityNotFound(_0x513b0c,null))['then'](respondWithResult(_0x513b0c,null))[_0xe032('0x46')](handleError(_0x513b0c,null));};exports[_0xe032('0x49')]=function(_0x62bfc8,_0x1e54d3){return db['ScreenRecording'][_0xe032('0x49')](_0x62bfc8[_0xe032('0x4a')],{})[_0xe032('0x27')](respondWithResult(_0x1e54d3,0xc9))[_0xe032('0x46')](handleError(_0x1e54d3,null));};exports[_0xe032('0x26')]=function(_0x233d9e,_0x3774bc){if(_0x233d9e['body']['id']){delete _0x233d9e[_0xe032('0x4a')]['id'];}delete _0x233d9e[_0xe032('0x4a')]['duration'];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4b')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4c')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4d')];return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x233d9e[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](handleEntityNotFound(_0x3774bc,null))[_0xe032('0x27')](saveUpdates(_0x233d9e[_0xe032('0x4a')],null))[_0xe032('0x27')](respondWithResult(_0x3774bc,null))[_0xe032('0x46')](handleError(_0x3774bc,null));};exports['describe']=function(_0x1c8b32,_0x53c8b2){return db[_0xe032('0x44')][_0xe032('0x4f')]()[_0xe032('0x27')](respondWithResult(_0x53c8b2,null))[_0xe032('0x46')](handleError(_0x53c8b2,null));};exports[_0xe032('0x50')]=function(_0x1b7a91,_0x2e29d3,_0xa98ee6){var _0x16c91e=require(_0xe032('0x51'));var _0x1b9012=![];var _0x564fe0={};if(_0x1b7a91[_0xe032('0x33')][_0xe032('0x2d')]&&_0x1b7a91['query'][_0xe032('0x2d')]==='uniqueid'){_0x564fe0[_0xe032('0x52')]=_0x1b7a91[_0xe032('0x4e')]['id'];}else{_0x564fe0['id']=_0x1b7a91[_0xe032('0x4e')]['id'];}return db[_0xe032('0x44')][_0xe032('0x48')]({'where':_0x564fe0,'attributes':['id','value'],'raw':!![]})[_0xe032('0x27')](handleEntityNotFound(_0x2e29d3,null))[_0xe032('0x27')](function(_0x1e1277){if(_0x1e1277){var _0x21a32f=path[_0xe032('0x53')](config[_0xe032('0x54')],_0xe032('0x55'),_0x1e1277['value']);var _0x3f46c0=util[_0xe032('0x31')](_0xe032('0x56'),_0x21a32f);if(fs[_0xe032('0x57')](_0x3f46c0)){_0x1b9012=!![];return _0x16c91e[_0xe032('0x58')](_0x3f46c0,_0x21a32f,config[_0xe032('0x59')][_0xe032('0x5a')])[_0xe032('0x27')](function(){return _0x1e1277;});}return _0x1e1277;}})[_0xe032('0x27')](function(_0x54c0b0){if(_0x54c0b0){var _0x795a58=path[_0xe032('0x53')](config[_0xe032('0x54')],'server/files/screen_recordings',_0x54c0b0[_0xe032('0x4d')]);if(!fs[_0xe032('0x57')](_0x795a58)){throw new db['Sequelize'][(_0xe032('0x5b'))](_0xe032('0x5c'));}if(_0x54c0b0[_0xe032('0x5d')]){return _0x2e29d3[_0xe032('0x50')](_0x795a58,_0x54c0b0[_0xe032('0x5d')]+path[_0xe032('0x5e')](_0x795a58),function(){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}else{return _0x2e29d3[_0xe032('0x50')](_0x795a58,function(_0x1aa18e){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}}})[_0xe032('0x46')](function(_0x505986){if(_0x505986[_0xe032('0x60')]===_0xe032('0x5c')){_0x2e29d3[_0xe032('0x1d')](0x194)[_0xe032('0x2a')](_0xe032('0x61'));}else{return handleError(_0x2e29d3,null);}});};exports['destroy']=function(_0x2b6ef8,_0x55e6b0){return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x2b6ef8[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](function(_0x3c5eb8){if(_[_0xe032('0x62')](_0x3c5eb8)){throw new ReferenceError(_0xe032('0x63'));}return _0x3c5eb8;})[_0xe032('0x27')](function(_0x22fd01){var _0x536510=path['join'](config['root'],_0xe032('0x55'),_0x22fd01[_0xe032('0x4d')]);logger[_0xe032('0x64')](_0xe032('0x65'),_0x536510);if(!_[_0xe032('0x62')](_0x22fd01[_0xe032('0x4d')])&&fs['existsSync'](_0x536510)){logger[_0xe032('0x64')](_0xe032('0x66')+_0x536510+_0xe032('0x67'));fs['unlinkSync'](_0x536510);}_0x536510=_0x536510+_0xe032('0x68');if(!_['isNil'](_0x22fd01[_0xe032('0x4d')])&&fs[_0xe032('0x57')](_0x536510)){logger['info']('File:\x20\x22'+_0x536510+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe032('0x69')](_0x536510);}return _0x22fd01;})['then'](function(_0x5157f7){if(!_0x5157f7)throw new InternalError();return _0x5157f7[_0xe032('0x6a')]();})[_0xe032('0x27')](function(){_0x55e6b0[_0xe032('0x1d')](0xcc)['end']();})[_0xe032('0x46')](handleError(_0x55e6b0,null));}; \ No newline at end of file +var _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0xb2edee,_0x5e08b3){var _0x21a7e3=function(_0x4a5ce0){while(--_0x4a5ce0){_0xb2edee['push'](_0xb2edee['shift']());}};_0x21a7e3(++_0x5e08b3);}(_0xe5b3,0x133));var _0x3e5b=function(_0x32a685,_0x55315c){_0x32a685=_0x32a685-0x0;var _0x4feac1=_0xe5b3[_0x32a685];return _0x4feac1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index de44a20..1bd41c4 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 _0x67a1=['../../config/environment','./screenRecording.attributes','exports','define','interactionid','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1919df,_0x32d3e1){var _0x58b65a=function(_0x4ff91e){while(--_0x4ff91e){_0x1919df['push'](_0x1919df['shift']());}};_0x58b65a(++_0x32d3e1);}(_0x67a1,0x10d));var _0x167a=function(_0x5e2e43,_0x364a8c){_0x5e2e43=_0x5e2e43-0x0;var _0x5eefac=_0x67a1[_0x5e2e43];return _0x5eefac;};'use strict';var _=require(_0x167a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x167a('0x1'));var moment=require(_0x167a('0x2'));var BPromise=require(_0x167a('0x3'));var rp=require(_0x167a('0x4'));var fs=require('fs');var path=require(_0x167a('0x5'));var rimraf=require(_0x167a('0x6'));var config=require(_0x167a('0x7'));var attributes=require(_0x167a('0x8'));module[_0x167a('0x9')]=function(_0x565d62,_0x2ea484){return _0x565d62[_0x167a('0xa')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x167a('0xb'),'fields':[_0x167a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x76c3=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','bluebird','path'];(function(_0x19be6a,_0x5b652d){var _0x3af785=function(_0xdb5a40){while(--_0xdb5a40){_0x19be6a['push'](_0x19be6a['shift']());}};_0x3af785(++_0x5b652d);}(_0x76c3,0xff));var _0x376c=function(_0x34d547,_0x21d2f8){_0x34d547=_0x34d547-0x0;var _0x552082=_0x76c3[_0x34d547];return _0x552082;};'use strict';var _=require('lodash');var util=require(_0x376c('0x0'));var logger=require(_0x376c('0x1'))(_0x376c('0x2'));var moment=require('moment');var BPromise=require(_0x376c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x376c('0x4'));var rimraf=require(_0x376c('0x5'));var config=require(_0x376c('0x6'));var attributes=require(_0x376c('0x7'));module[_0x376c('0x8')]=function(_0x394812,_0x4e6bad){return _0x394812[_0x376c('0x9')](_0x376c('0xa'),attributes,{'tableName':_0x376c('0xb'),'paranoid':![],'indexes':[{'name':_0x376c('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 854e8e0..02074ff 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 _0x8caa=['util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0x8caa,0x8b));var _0xa8ca=function(_0x3d2b6d,_0x1c710e){_0x3d2b6d=_0x3d2b6d-0x0;var _0x268764=_0x8caa[_0x3d2b6d];return _0x268764;};'use strict';var _=require(_0xa8ca('0x0'));var util=require(_0xa8ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8ca('0x2'));var db=require(_0xa8ca('0x3'))['db'];var utils=require(_0xa8ca('0x4'));var logger=require('../../config/logger')(_0xa8ca('0x5'));var config=require(_0xa8ca('0x6'));var jayson=require(_0xa8ca('0x7'));var client=jayson[_0xa8ca('0x8')][_0xa8ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x140da5,_0xfbc88f,_0x1bc921){return new BPromise(function(_0x3ca627,_0x3016cb){return client[_0xa8ca('0xa')](_0x140da5,_0x1bc921)['then'](function(_0x57fd5b){logger[_0xa8ca('0xb')](_0xa8ca('0xc'),_0xfbc88f,_0xa8ca('0xd'));logger['debug'](_0xa8ca('0xe'),_0xfbc88f,_0xa8ca('0xd'),JSON[_0xa8ca('0xf')](_0x57fd5b));if(_0x57fd5b['error']){if(_0x57fd5b[_0xa8ca('0x10')][_0xa8ca('0x11')]===0x1f4){logger[_0xa8ca('0x10')](_0xa8ca('0xc'),_0xfbc88f,_0x57fd5b[_0xa8ca('0x10')][_0xa8ca('0x12')]);return _0x3016cb(_0x57fd5b[_0xa8ca('0x10')][_0xa8ca('0x12')]);}logger[_0xa8ca('0x10')](_0xa8ca('0xc'),_0xfbc88f,_0x57fd5b[_0xa8ca('0x10')][_0xa8ca('0x12')]);return _0x3ca627(_0x57fd5b[_0xa8ca('0x10')][_0xa8ca('0x12')]);}else{logger['info'](_0xa8ca('0xc'),_0xfbc88f,_0xa8ca('0xd'));_0x3ca627(_0x57fd5b[_0xa8ca('0x13')][_0xa8ca('0x12')]);}})['catch'](function(_0x30cef2){logger[_0xa8ca('0x10')](_0xa8ca('0xc'),_0xfbc88f,_0x30cef2);_0x3016cb(_0x30cef2);});});} \ No newline at end of file +var _0xde4e=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x243567,_0x51ff67){var _0x1b5def=function(_0x1344e8){while(--_0x1344e8){_0x243567['push'](_0x243567['shift']());}};_0x1b5def(++_0x51ff67);}(_0xde4e,0x1cf));var _0xede4=function(_0x46d13f,_0x492b61){_0x46d13f=_0x46d13f-0x0;var _0x15fae2=_0xde4e[_0x46d13f];return _0x15fae2;};'use strict';var _=require(_0xede4('0x0'));var util=require(_0xede4('0x1'));var moment=require(_0xede4('0x2'));var BPromise=require(_0xede4('0x3'));var rs=require(_0xede4('0x4'));var fs=require('fs');var Redis=require(_0xede4('0x5'));var db=require(_0xede4('0x6'))['db'];var utils=require(_0xede4('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xede4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xede4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a287e,_0x54beac,_0x21be23){return new BPromise(function(_0x2bd164,_0x169ed5){return client[_0xede4('0xa')](_0x3a287e,_0x21be23)[_0xede4('0xb')](function(_0x41b78a){logger['info'](_0xede4('0xc'),_0x54beac,_0xede4('0xd'));logger[_0xede4('0xe')](_0xede4('0xf'),_0x54beac,'request\x20sent',JSON['stringify'](_0x41b78a));if(_0x41b78a['error']){if(_0x41b78a[_0xede4('0x10')][_0xede4('0x11')]===0x1f4){logger['error'](_0xede4('0xc'),_0x54beac,_0x41b78a[_0xede4('0x10')]['message']);return _0x169ed5(_0x41b78a[_0xede4('0x10')][_0xede4('0x12')]);}logger[_0xede4('0x10')](_0xede4('0xc'),_0x54beac,_0x41b78a[_0xede4('0x10')][_0xede4('0x12')]);return _0x2bd164(_0x41b78a[_0xede4('0x10')][_0xede4('0x12')]);}else{logger[_0xede4('0x13')](_0xede4('0xc'),_0x54beac,_0xede4('0xd'));_0x2bd164(_0x41b78a[_0xede4('0x14')][_0xede4('0x12')]);}})['catch'](function(_0x346000){logger[_0xede4('0x10')](_0xede4('0xc'),_0x54beac,_0x346000);_0x169ed5(_0x346000);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 82082f9..ec596e0 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 _0x774b=['addLogo','%s%s','logologin','originalname','addLogoLogin','format','file','addPreferred','favicon','/:id/favicon','addFavicon','put','/:id','isAuthenticated','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','join','root','server/files/images/logos/','logo','extname','post','single'];(function(_0x4bfc70,_0x14b719){var _0x2360b9=function(_0x41c33a){while(--_0x41c33a){_0x4bfc70['push'](_0x4bfc70['shift']());}};_0x2360b9(++_0x14b719);}(_0x774b,0x117));var _0xb774=function(_0x42360a,_0x4e6214){_0x42360a=_0x42360a-0x0;var _0x447113=_0x774b[_0x42360a];return _0x447113;};'use strict';var multer=require(_0xb774('0x0'));var util=require(_0xb774('0x1'));var path=require(_0xb774('0x2'));var timeout=require('connect-timeout');var express=require(_0xb774('0x3'));var router=express[_0xb774('0x4')]();var fs_extra=require(_0xb774('0x5'));var auth=require(_0xb774('0x6'));var interaction=require(_0xb774('0x7'));var config=require(_0xb774('0x8'));var controller=require(_0xb774('0x9'));router[_0xb774('0xa')]('/',auth['isAuthenticated'](),controller[_0xb774('0xb')]);router[_0xb774('0xa')](_0xb774('0xc'),controller['getDate']);router[_0xb774('0xa')]('/:id',controller['show']);router[_0xb774('0xa')](_0xb774('0xd'),controller[_0xb774('0xe')]);router[_0xb774('0xa')](_0xb774('0xf'),controller[_0xb774('0x10')]);router[_0xb774('0xa')](_0xb774('0x11'),controller[_0xb774('0x12')]);router[_0xb774('0xa')](_0xb774('0x13'),controller[_0xb774('0x14')]);router[_0xb774('0xa')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xb774('0x15')]({'destination':function(_0x49d208,_0x3fe57f,_0x12dfcd){_0x12dfcd(null,path[_0xb774('0x16')](config[_0xb774('0x17')],_0xb774('0x18')));},'filename':function(_0x42fca4,_0x1d2f17,_0x50a47a){_0x50a47a(null,util['format']('%s%s',_0xb774('0x19'),path[_0xb774('0x1a')](_0x1d2f17['originalname'])));}})});router[_0xb774('0x1b')](_0xb774('0xd'),upload[_0xb774('0x1c')]('file'),controller[_0xb774('0x1d')]);var upload=multer({'storage':multer[_0xb774('0x15')]({'destination':function(_0xd5c44c,_0x1ad244,_0x474964){_0x474964(null,path[_0xb774('0x16')](config[_0xb774('0x17')],_0xb774('0x18')));},'filename':function(_0x17ec4c,_0x1b27cd,_0x31f9f6){_0x31f9f6(null,util['format'](_0xb774('0x1e'),_0xb774('0x1f'),path[_0xb774('0x1a')](_0x1b27cd[_0xb774('0x20')])));}})});router['post'](_0xb774('0xf'),upload[_0xb774('0x1c')]('file'),controller[_0xb774('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ab0f3,_0x17d838,_0x23016e){_0x23016e(null,path[_0xb774('0x16')](config[_0xb774('0x17')],_0xb774('0x18')));},'filename':function(_0x5b7f5e,_0x27d32d,_0x8c86ad){_0x8c86ad(null,util[_0xb774('0x22')](_0xb774('0x1e'),'preferred',path[_0xb774('0x1a')](_0x27d32d[_0xb774('0x20')])));}})});router[_0xb774('0x1b')](_0xb774('0x13'),upload[_0xb774('0x1c')](_0xb774('0x23')),controller[_0xb774('0x24')]);var upload=multer({'storage':multer[_0xb774('0x15')]({'destination':function(_0x7f5d09,_0x5f48e2,_0xc595c3){_0xc595c3(null,path['join'](config['root'],_0xb774('0x18')));},'filename':function(_0x1471da,_0x42cb85,_0x2692ff){_0x2692ff(null,util['format'](_0xb774('0x1e'),_0xb774('0x25'),path[_0xb774('0x1a')](_0x42cb85[_0xb774('0x20')])));}})});router[_0xb774('0x1b')](_0xb774('0x26'),upload[_0xb774('0x1c')](_0xb774('0x23')),controller[_0xb774('0x27')]);router[_0xb774('0x28')](_0xb774('0x29'),auth[_0xb774('0x2a')](),controller[_0xb774('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x8742=['../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','logologin','file','addLogoLogin','preferred','/:id/preferred','favicon','addFavicon','put','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x8742,0x12c));var _0x2874=function(_0xd420bc,_0x30d7b4){_0xd420bc=_0xd420bc-0x0;var _0x44ac1f=_0x8742[_0xd420bc];return _0x44ac1f;};'use strict';var multer=require(_0x2874('0x0'));var util=require(_0x2874('0x1'));var path=require(_0x2874('0x2'));var timeout=require(_0x2874('0x3'));var express=require(_0x2874('0x4'));var router=express[_0x2874('0x5')]();var fs_extra=require(_0x2874('0x6'));var auth=require(_0x2874('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2874('0x8'));var controller=require(_0x2874('0x9'));router[_0x2874('0xa')]('/',auth[_0x2874('0xb')](),controller['index']);router['get'](_0x2874('0xc'),controller[_0x2874('0xd')]);router[_0x2874('0xa')]('/:id',controller[_0x2874('0xe')]);router[_0x2874('0xa')](_0x2874('0xf'),controller[_0x2874('0x10')]);router[_0x2874('0xa')](_0x2874('0x11'),controller[_0x2874('0x12')]);router['get']('/:id/gdpr',controller[_0x2874('0x13')]);router[_0x2874('0xa')]('/:id/preferred',controller[_0x2874('0x14')]);router[_0x2874('0xa')](_0x2874('0x15'),controller[_0x2874('0x16')]);var upload=multer({'storage':multer[_0x2874('0x17')]({'destination':function(_0x515b65,_0x8371a,_0x59e8ec){_0x59e8ec(null,path[_0x2874('0x18')](config[_0x2874('0x19')],_0x2874('0x1a')));},'filename':function(_0x3894cd,_0x39883f,_0x48de22){_0x48de22(null,util[_0x2874('0x1b')](_0x2874('0x1c'),_0x2874('0x1d'),path[_0x2874('0x1e')](_0x39883f[_0x2874('0x1f')])));}})});router[_0x2874('0x20')](_0x2874('0xf'),upload[_0x2874('0x21')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x2874('0x17')]({'destination':function(_0x6b4c37,_0x32e030,_0x5e80c3){_0x5e80c3(null,path[_0x2874('0x18')](config['root'],_0x2874('0x1a')));},'filename':function(_0xf35aab,_0x370dc5,_0x54e7eb){_0x54e7eb(null,util['format'](_0x2874('0x1c'),_0x2874('0x22'),path[_0x2874('0x1e')](_0x370dc5[_0x2874('0x1f')])));}})});router[_0x2874('0x20')](_0x2874('0x11'),upload[_0x2874('0x21')](_0x2874('0x23')),controller[_0x2874('0x24')]);var upload=multer({'storage':multer[_0x2874('0x17')]({'destination':function(_0x4bb80f,_0x29d663,_0x26a819){_0x26a819(null,path['join'](config[_0x2874('0x19')],_0x2874('0x1a')));},'filename':function(_0xf28637,_0x2509c1,_0x30afad){_0x30afad(null,util[_0x2874('0x1b')](_0x2874('0x1c'),_0x2874('0x25'),path['extname'](_0x2509c1[_0x2874('0x1f')])));}})});router[_0x2874('0x20')](_0x2874('0x26'),upload[_0x2874('0x21')](_0x2874('0x23')),controller['addPreferred']);var upload=multer({'storage':multer[_0x2874('0x17')]({'destination':function(_0xfe45b2,_0x147707,_0x3660b2){_0x3660b2(null,path[_0x2874('0x18')](config[_0x2874('0x19')],_0x2874('0x1a')));},'filename':function(_0x22feb9,_0x59165d,_0x1b75d0){_0x1b75d0(null,util[_0x2874('0x1b')]('%s%s',_0x2874('0x27'),path[_0x2874('0x1e')](_0x59165d[_0x2874('0x1f')])));}})});router[_0x2874('0x20')](_0x2874('0x15'),upload[_0x2874('0x21')](_0x2874('0x23')),controller[_0x2874('0x28')]);router[_0x2874('0x29')](_0x2874('0x2a'),auth['isAuthenticated'](),controller[_0x2874('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 907820d..6ee2a1b 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 _0x2ef3=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x830f10,_0x47f88a){var _0x412b2d=function(_0x572375){while(--_0x572375){_0x830f10['push'](_0x830f10['shift']());}};_0x412b2d(++_0x47f88a);}(_0x2ef3,0xba));var _0x32ef=function(_0x314206,_0x58106f){_0x314206=_0x314206-0x0;var _0x465e9c=_0x2ef3[_0x314206];return _0x465e9c;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'min_internal':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x32ef('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnusername':{'type':Sequelize[_0x32ef('0x5')]},'turnpassword':{'type':Sequelize[_0x32ef('0x5')]},'pageTitle':{'type':Sequelize[_0x32ef('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x8')},'enableEmailPreview':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x32ef('0x5')]},'defaultFavicon':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x32ef('0x2')]},'transcribeRegion':{'type':Sequelize[_0x32ef('0x5')]},'sentiment':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x32ef('0x5')]},'language':{'type':Sequelize[_0x32ef('0x5')]},'bucket':{'type':Sequelize[_0x32ef('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x32ef('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x12d79d,_0x3c4f12){var _0x5cbe01=function(_0x51cab0){while(--_0x51cab0){_0x12d79d['push'](_0x12d79d['shift']());}};_0x5cbe01(++_0x3c4f12);}(_0x1261,0x144));var _0x1126=function(_0x57062a,_0x123026){_0x57062a=_0x57062a-0x0;var _0xa178da=_0x1261[_0x57062a];return _0xa178da;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'min_internal':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x5')},'logo':{'type':Sequelize[_0x1126('0x4')]},'defaultLogo':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1126('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1126('0x4')]},'turnaddr':{'type':Sequelize[_0x1126('0x4')]},'turnusername':{'type':Sequelize[_0x1126('0x4')]},'turnpassword':{'type':Sequelize[_0x1126('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1126('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x7')},'chatTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1126('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1126('0x4')]},'defaultFavicon':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1126('0x1')]},'transcribeRegion':{'type':Sequelize[_0x1126('0x4')]},'sentiment':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1126('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1126('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1126('0x1')](0x2)[_0x1126('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index a286907..ccd2283 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 _0x53d5=['Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end','stack','send','Setting','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','merge','find','body','file','filename','addLogoLogin','getLicense','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','addPreferred','getPreferred','server/files/images/logos','default_preferred.png','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info'];(function(_0x55c97d,_0x228ffc){var _0x1d5112=function(_0x2ab908){while(--_0x2ab908){_0x55c97d['push'](_0x55c97d['shift']());}};_0x1d5112(++_0x228ffc);}(_0x53d5,0x1cc));var _0x553d=function(_0x83b4e,_0x47c407){_0x83b4e=_0x83b4e-0x0;var _0x2beec8=_0x53d5[_0x83b4e];return _0x2beec8;};'use strict';var emlformat=require(_0x553d('0x0'));var rimraf=require(_0x553d('0x1'));var zipdir=require(_0x553d('0x2'));var jsonpatch=require(_0x553d('0x3'));var rp=require(_0x553d('0x4'));var moment=require(_0x553d('0x5'));var BPromise=require(_0x553d('0x6'));var Mustache=require('mustache');var util=require(_0x553d('0x7'));var path=require(_0x553d('0x8'));var sox=require(_0x553d('0x9'));var csv=require(_0x553d('0xa'));var ejs=require(_0x553d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x553d('0xc'));var squel=require(_0x553d('0xd'));var crypto=require(_0x553d('0xe'));var jsforce=require(_0x553d('0xf'));var deskjs=require(_0x553d('0x10'));var toCsv=require(_0x553d('0xa'));var querystring=require(_0x553d('0x11'));var Papa=require(_0x553d('0x12'));var Redis=require(_0x553d('0x13'));var authService=require(_0x553d('0x14'));var qs=require(_0x553d('0x15'));var as=require(_0x553d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x553d('0x17'));var utils=require('../../config/utils');var config=require(_0x553d('0x18'));var licenseUtil=require(_0x553d('0x19'));var db=require(_0x553d('0x1a'))['db'];var jayson=require(_0x553d('0x1b'));var client=jayson[_0x553d('0x1c')][_0x553d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x44b9ee,_0x1713ed,_0x40e96e,_0x32b169){return new BPromise(function(_0x3cb13c,_0xd11e74){var _0x52ded8=_0x32b169||client;return _0x52ded8[_0x553d('0x1e')](_0x44b9ee,_0x40e96e)['then'](function(_0x1d4f35){logger[_0x553d('0x1f')](_0x553d('0x20'),_0x1713ed,'request\x20sent');logger['debug'](_0x553d('0x21'),_0x1713ed,_0x553d('0x22'),JSON[_0x553d('0x23')](_0x1d4f35));if(_0x1d4f35['error']){if(_0x1d4f35[_0x553d('0x24')][_0x553d('0x25')]===0x1f4){logger[_0x553d('0x24')](_0x553d('0x20'),_0x1713ed,_0x1d4f35[_0x553d('0x24')][_0x553d('0x26')]);return _0xd11e74(_0x1d4f35[_0x553d('0x24')][_0x553d('0x26')]);}logger[_0x553d('0x24')](_0x553d('0x20'),_0x1713ed,_0x1d4f35[_0x553d('0x24')]['message']);return _0x3cb13c(_0x1d4f35[_0x553d('0x24')][_0x553d('0x26')]);}else{logger['info'](_0x553d('0x20'),_0x1713ed,_0x553d('0x22'));_0x3cb13c(_0x1d4f35['result']['message']);}})['catch'](function(_0x55fbe1){logger[_0x553d('0x24')]('Setting,\x20%s,\x20%s',_0x1713ed,_0x55fbe1);_0xd11e74(_0x55fbe1);});});}function respondWithStatusCode(_0x82dd3a,_0xacc984){_0xacc984=_0xacc984||0xcc;return function(_0x2e4f1b){if(_0x2e4f1b){return _0x82dd3a[_0x553d('0x27')](_0xacc984);}return _0x82dd3a[_0x553d('0x28')](_0xacc984)['end']();};}function respondWithResult(_0x4cc34d,_0x2caed9){_0x2caed9=_0x2caed9||0xc8;return function(_0x491dc2){if(_0x491dc2){return _0x4cc34d[_0x553d('0x28')](_0x2caed9)[_0x553d('0x29')](_0x491dc2);}};}function respondWithFilteredResult(_0x517a1c,_0x677832){return function(_0x2c0484){if(_0x2c0484){var _0x2c4577=typeof _0x677832['offset']===_0x553d('0x2a')&&typeof _0x677832[_0x553d('0x2b')]===_0x553d('0x2a');var _0x54f0ed=_0x2c0484[_0x553d('0x2c')];var _0x39943d=_0x2c4577?0x0:_0x677832[_0x553d('0x2d')];var _0x50fbc3=_0x2c4577?_0x2c0484[_0x553d('0x2c')]:_0x677832[_0x553d('0x2d')]+_0x677832[_0x553d('0x2b')];var _0x5ce4ab;if(_0x50fbc3>=_0x54f0ed){_0x50fbc3=_0x54f0ed;_0x5ce4ab=0xc8;}else{_0x5ce4ab=0xce;}_0x517a1c[_0x553d('0x28')](_0x5ce4ab);return _0x517a1c['set'](_0x553d('0x2e'),_0x39943d+'-'+_0x50fbc3+'/'+_0x54f0ed)[_0x553d('0x29')](_0x2c0484);}return null;};}function patchUpdates(_0xe1a5b5){return function(_0x615816){try{jsonpatch[_0x553d('0x2f')](_0x615816,_0xe1a5b5,!![]);}catch(_0x1821c6){return BPromise[_0x553d('0x30')](_0x1821c6);}return _0x615816[_0x553d('0x31')]();};}function saveUpdates(_0x5acfce,_0x410fee){return function(_0x2b1698){if(_0x2b1698){return _0x2b1698[_0x553d('0x32')](_0x5acfce)[_0x553d('0x33')](function(_0x27fb09){return _0x27fb09;});}return null;};}function removeEntity(_0x40496e,_0x1e0f6d){return function(_0x335ee7){if(_0x335ee7){return _0x335ee7['destroy']()[_0x553d('0x33')](function(){_0x40496e[_0x553d('0x28')](0xcc)[_0x553d('0x34')]();});}};}function handleEntityNotFound(_0x56a056,_0x3b8c91){return function(_0x3d28ac){if(!_0x3d28ac){_0x56a056[_0x553d('0x27')](0x194);}return _0x3d28ac;};}function handleError(_0x1e3b7a,_0x17d081){_0x17d081=_0x17d081||0x1f4;return function(_0x2199e3){logger[_0x553d('0x24')](_0x2199e3[_0x553d('0x35')]);if(_0x2199e3['name']){delete _0x2199e3['name'];}_0x1e3b7a[_0x553d('0x28')](_0x17d081)[_0x553d('0x36')](_0x2199e3);};}exports['index']=function(_0x4d5b00,_0x5e6c3b){var _0x52f94c={},_0x99e11f={},_0x4e0fe8={'count':0x0,'rows':[]};var _0xbf85a1=_['map'](db[_0x553d('0x37')][_0x553d('0x38')],function(_0x51eca5){return{'name':_0x51eca5['fieldName'],'type':_0x51eca5[_0x553d('0x39')][_0x553d('0x3a')]};});_0x99e11f[_0x553d('0x3b')]=_[_0x553d('0x3c')](_0xbf85a1,'name');_0x99e11f[_0x553d('0x3d')]=_[_0x553d('0x3e')](_0x4d5b00['query']);_0x99e11f[_0x553d('0x3f')]=_['intersection'](_0x99e11f[_0x553d('0x3b')],_0x99e11f[_0x553d('0x3d')]);_0x52f94c[_0x553d('0x40')]=_[_0x553d('0x41')](_0x99e11f['model'],qs['fields'](_0x4d5b00[_0x553d('0x3d')][_0x553d('0x42')]));_0x52f94c[_0x553d('0x40')]=_0x52f94c[_0x553d('0x40')][_0x553d('0x43')]?_0x52f94c[_0x553d('0x40')]:_0x99e11f[_0x553d('0x3b')];if(!_0x4d5b00[_0x553d('0x3d')][_0x553d('0x44')](_0x553d('0x45'))){_0x52f94c['limit']=qs[_0x553d('0x2b')](_0x4d5b00[_0x553d('0x3d')]['limit']);_0x52f94c[_0x553d('0x2d')]=qs[_0x553d('0x2d')](_0x4d5b00['query'][_0x553d('0x2d')]);}_0x52f94c[_0x553d('0x46')]=qs[_0x553d('0x47')](_0x4d5b00[_0x553d('0x3d')][_0x553d('0x47')]);_0x52f94c[_0x553d('0x48')]=qs['filters'](_[_0x553d('0x49')](_0x4d5b00[_0x553d('0x3d')],_0x99e11f[_0x553d('0x3f')]),_0xbf85a1);if(_0x4d5b00['query'][_0x553d('0x4a')]){_0x52f94c[_0x553d('0x48')]=_['merge'](_0x52f94c[_0x553d('0x48')],{'$or':_[_0x553d('0x3c')](_0xbf85a1,function(_0x101530){if(_0x101530[_0x553d('0x39')]!==_0x553d('0x4b')){var _0x39d602={};_0x39d602[_0x101530[_0x553d('0x4c')]]={'$like':'%'+_0x4d5b00[_0x553d('0x3d')][_0x553d('0x4a')]+'%'};return _0x39d602;}})});}_0x52f94c=_['merge']({},_0x52f94c,_0x4d5b00[_0x553d('0x4d')]);var _0x541f4f={'where':_0x52f94c[_0x553d('0x48')]};return db['Setting'][_0x553d('0x2c')](_0x541f4f)[_0x553d('0x33')](function(_0x5c5e1d){_0x4e0fe8[_0x553d('0x2c')]=_0x5c5e1d;if(_0x4d5b00[_0x553d('0x3d')][_0x553d('0x4e')]){_0x52f94c[_0x553d('0x4f')]=[{'all':!![]}];}return db[_0x553d('0x37')]['findAll'](_0x52f94c);})[_0x553d('0x33')](function(_0x545dbf){_0x4e0fe8[_0x553d('0x50')]=_0x545dbf;return _0x4e0fe8;})[_0x553d('0x33')](respondWithFilteredResult(_0x5e6c3b,_0x52f94c))[_0x553d('0x51')](handleError(_0x5e6c3b,null));};exports[_0x553d('0x52')]=function(_0x3aad14,_0x120395){var _0xb6b182={'raw':![],'where':{'id':_0x3aad14[_0x553d('0x53')]['id']}},_0x29259a={};_0x29259a[_0x553d('0x3b')]=_[_0x553d('0x3e')](db[_0x553d('0x37')][_0x553d('0x38')]);_0x29259a[_0x553d('0x3d')]=_[_0x553d('0x3e')](_0x3aad14[_0x553d('0x3d')]);_0x29259a[_0x553d('0x3f')]=_['intersection'](_0x29259a[_0x553d('0x3b')],_0x29259a[_0x553d('0x3d')]);_0xb6b182[_0x553d('0x40')]=_[_0x553d('0x41')](_0x29259a['model'],qs['fields'](_0x3aad14[_0x553d('0x3d')][_0x553d('0x42')]));_0xb6b182[_0x553d('0x40')]=_0xb6b182[_0x553d('0x40')][_0x553d('0x43')]?_0xb6b182[_0x553d('0x40')]:_0x29259a[_0x553d('0x3b')];if(_0x3aad14[_0x553d('0x3d')][_0x553d('0x4e')]){_0xb6b182['include']=[{'all':!![]}];}_0xb6b182=_[_0x553d('0x54')]({},_0xb6b182,_0x3aad14[_0x553d('0x4d')]);return db[_0x553d('0x37')][_0x553d('0x55')](_0xb6b182)['then'](handleEntityNotFound(_0x120395,null))['then'](respondWithResult(_0x120395,null))[_0x553d('0x51')](handleError(_0x120395,null));};exports[_0x553d('0x32')]=function(_0x3d04e8,_0x437a2d){if(_0x3d04e8[_0x553d('0x56')]['id']){delete _0x3d04e8[_0x553d('0x56')]['id'];}return db[_0x553d('0x37')][_0x553d('0x55')]({'where':{'id':_0x3d04e8['params']['id']}})[_0x553d('0x33')](handleEntityNotFound(_0x437a2d,null))['then'](saveUpdates(_0x3d04e8[_0x553d('0x56')],null))['then'](respondWithResult(_0x437a2d,null))[_0x553d('0x51')](handleError(_0x437a2d,null));};exports['addLogo']=function(_0x543103,_0x45c924,_0x3de6ce){if(_0x543103['file']&&_0x543103[_0x553d('0x57')][_0x553d('0x58')]){_0x543103[_0x553d('0x56')]['logo']=_0x543103[_0x553d('0x57')][_0x553d('0x58')];}return db[_0x553d('0x37')]['find']({'where':{'id':_0x543103['params']['id']}})['then'](handleEntityNotFound(_0x45c924,null))[_0x553d('0x33')](saveUpdates(_0x543103['body'],null))[_0x553d('0x33')](respondWithResult(_0x45c924,null))[_0x553d('0x51')](handleError(_0x45c924,null));};exports[_0x553d('0x59')]=function(_0x2a6845,_0x22feb5,_0x50b4b8){if(_0x2a6845[_0x553d('0x57')]&&_0x2a6845[_0x553d('0x57')][_0x553d('0x58')]){_0x2a6845[_0x553d('0x56')]['loginLogo']=_0x2a6845[_0x553d('0x57')][_0x553d('0x58')];}return db[_0x553d('0x37')][_0x553d('0x55')]({'where':{'id':_0x2a6845[_0x553d('0x53')]['id']}})[_0x553d('0x33')](handleEntityNotFound(_0x22feb5,null))['then'](saveUpdates(_0x2a6845[_0x553d('0x56')],null))[_0x553d('0x33')](respondWithResult(_0x22feb5,null))[_0x553d('0x51')](handleError(_0x22feb5,null));};var utilLicense=require(_0x553d('0x19'));exports['getLogo']=function(_0x340593,_0x3c03c8,_0x455395){var _0x1e0c70='server/files/images/logos';var _0x1ef84b={'custom':![]};return utilLicense[_0x553d('0x5a')]()['then'](function(_0x46b95b){if(_0x46b95b){_0x1ef84b=_0x46b95b;}return db[_0x553d('0x37')][_0x553d('0x55')]({'where':{'id':_0x340593['params']['id']},'attributes':[_0x553d('0x5b'),_0x553d('0x5c'),_0x553d('0x5d'),_0x553d('0x5e'),_0x553d('0x5f'),_0x553d('0x60'),_0x553d('0x61'),_0x553d('0x62')],'raw':!![]});})[_0x553d('0x33')](handleEntityNotFound(_0x3c03c8,null))[_0x553d('0x33')](function(_0x399944){if(_0x399944){var _0x1c6358=_0x399944[_0x553d('0x5b')]&&fs[_0x553d('0x63')](path[_0x553d('0x64')](config[_0x553d('0x65')],_0x1e0c70,_[_0x553d('0x66')](_0x399944[_0x553d('0x5b')])))?path[_0x553d('0x64')](config[_0x553d('0x65')],_0x1e0c70,_[_0x553d('0x66')](_0x399944['logo'])):path[_0x553d('0x64')](config[_0x553d('0x65')],_0x1e0c70,_['toLower']('default_logo.svg'));var _0x5b778b=_0x553d('0x67')+_[_0x553d('0x68')](_0x553d('0x5b'));if(_0x399944[_0x5b778b]||!_0x1ef84b[_0x553d('0x69')]){_0x1c6358=path['join'](config[_0x553d('0x65')],_0x1e0c70,_[_0x553d('0x66')](_0x553d('0x6a')));}if(!fs[_0x553d('0x63')](_0x1c6358)){throw new db[(_0x553d('0x6b'))][(_0x553d('0x6c'))](_[_0x553d('0x68')](_0x553d('0x5b'))+_0x553d('0x6d'));}return _0x3c03c8[_0x553d('0x6e')](_0x1c6358);}})['catch'](handleError(_0x3c03c8,null));};var utilLicense=require('../../config/license/util');exports[_0x553d('0x6f')]=function(_0x4a2833,_0xf112d2,_0x2f9724){var _0x5d4842='server/files/images/logos';var _0x126477={'custom':![]};return utilLicense[_0x553d('0x5a')]()[_0x553d('0x33')](function(_0x33836f){if(_0x33836f){_0x126477=_0x33836f;}return db[_0x553d('0x37')][_0x553d('0x55')]({'where':{'id':_0x4a2833[_0x553d('0x53')]['id']},'attributes':['logo',_0x553d('0x5c'),'preferred',_0x553d('0x5e'),_0x553d('0x5f'),_0x553d('0x60'),_0x553d('0x61'),_0x553d('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0xf112d2,null))[_0x553d('0x33')](function(_0x3ac5d9){if(_0x3ac5d9){var _0x215fef=_0x3ac5d9[_0x553d('0x5c')]&&fs[_0x553d('0x63')](path[_0x553d('0x64')](config[_0x553d('0x65')],_0x5d4842,_[_0x553d('0x66')](_0x3ac5d9[_0x553d('0x5c')])))?path[_0x553d('0x64')](config['root'],_0x5d4842,_[_0x553d('0x66')](_0x3ac5d9[_0x553d('0x5c')])):path[_0x553d('0x64')](config[_0x553d('0x65')],_0x5d4842,_['toLower']('default_loginLogo.svg'));var _0x183254=_0x553d('0x67')+_['upperFirst'](_0x553d('0x5c'));if(_0x3ac5d9[_0x183254]||!_0x126477[_0x553d('0x69')]){_0x215fef=path[_0x553d('0x64')](config[_0x553d('0x65')],_0x5d4842,_[_0x553d('0x66')](_0x553d('0x70')));}if(!fs['existsSync'](_0x215fef)){throw new db[(_0x553d('0x6b'))][(_0x553d('0x6c'))](_[_0x553d('0x68')](_0x553d('0x5c'))+_0x553d('0x6d'));}return _0xf112d2[_0x553d('0x6e')](_0x215fef);}})[_0x553d('0x51')](handleError(_0xf112d2,null));};exports[_0x553d('0x71')]=function(_0x107a03,_0x47606c){return db['Setting'][_0x553d('0x55')]({'where':{'id':_0x107a03[_0x553d('0x53')]['id']},'attributes':['securePassword']})[_0x553d('0x33')](respondWithResult(_0x47606c,null))[_0x553d('0x51')](handleError(_0x47606c,null));};exports[_0x553d('0x72')]=function(_0x548a11,_0x7052e3,_0x41e2ab){if(_0x548a11[_0x553d('0x57')]&&_0x548a11[_0x553d('0x57')][_0x553d('0x58')]){_0x548a11[_0x553d('0x56')]['preferred']=_0x548a11[_0x553d('0x57')][_0x553d('0x58')];}return db['Setting'][_0x553d('0x55')]({'where':{'id':_0x548a11[_0x553d('0x53')]['id']}})['then'](handleEntityNotFound(_0x7052e3,null))[_0x553d('0x33')](saveUpdates(_0x548a11['body'],null))['then'](respondWithResult(_0x7052e3,null))['catch'](handleError(_0x7052e3,null));};var utilLicense=require('../../config/license/util');exports[_0x553d('0x73')]=function(_0x49bf0f,_0x454055,_0x2e1763){var _0x54a149=_0x553d('0x74');var _0x2a5ab9={'custom':![]};return utilLicense['getLicense']()[_0x553d('0x33')](function(_0x434d59){if(_0x434d59){_0x2a5ab9=_0x434d59;}return db[_0x553d('0x37')][_0x553d('0x55')]({'where':{'id':_0x49bf0f['params']['id']},'attributes':['logo',_0x553d('0x5c'),_0x553d('0x5d'),_0x553d('0x5e'),'defaultLogo',_0x553d('0x60'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x454055,null))[_0x553d('0x33')](function(_0x5b3cea){if(_0x5b3cea){var _0x7798f=_0x5b3cea[_0x553d('0x5d')]&&fs[_0x553d('0x63')](path['join'](config['root'],_0x54a149,_[_0x553d('0x66')](_0x5b3cea[_0x553d('0x5d')])))?path[_0x553d('0x64')](config['root'],_0x54a149,_[_0x553d('0x66')](_0x5b3cea['preferred'])):path[_0x553d('0x64')](config[_0x553d('0x65')],_0x54a149,_[_0x553d('0x66')](_0x553d('0x75')));var _0x13b387=_0x553d('0x67')+_['upperFirst']('preferred');if(_0x5b3cea[_0x13b387]||!_0x2a5ab9[_0x553d('0x69')]||!_0x2a5ab9[_0x553d('0x5d')]){_0x7798f=path[_0x553d('0x64')](config[_0x553d('0x65')],_0x54a149,_[_0x553d('0x66')](_0x553d('0x75')));}if(!fs[_0x553d('0x63')](_0x7798f)){throw new db[(_0x553d('0x6b'))][(_0x553d('0x6c'))](_[_0x553d('0x68')](_0x553d('0x5d'))+'\x20not\x20found');}return _0x454055[_0x553d('0x6e')](_0x7798f);}})[_0x553d('0x51')](handleError(_0x454055,null));};exports['addFavicon']=function(_0x1ba58c,_0x4748e3,_0x1424ee){if(_0x1ba58c[_0x553d('0x57')]&&_0x1ba58c['file'][_0x553d('0x58')]){_0x1ba58c['body'][_0x553d('0x5e')]=_0x1ba58c[_0x553d('0x57')]['filename'];}return db['Setting']['find']({'where':{'id':_0x1ba58c[_0x553d('0x53')]['id']}})[_0x553d('0x33')](handleEntityNotFound(_0x4748e3,null))[_0x553d('0x33')](saveUpdates(_0x1ba58c['body'],null))[_0x553d('0x33')](respondWithResult(_0x4748e3,null))[_0x553d('0x51')](handleError(_0x4748e3,null));};var utilLicense=require(_0x553d('0x19'));exports['getFavicon']=function(_0x58b736,_0x363f6c,_0x2d4d4d){var _0x215afa=_0x553d('0x74');var _0x38e923={'custom':![]};return utilLicense[_0x553d('0x5a')]()[_0x553d('0x33')](function(_0x1d52fd){if(_0x1d52fd){_0x38e923=_0x1d52fd;}return db[_0x553d('0x37')][_0x553d('0x55')]({'where':{'id':_0x58b736[_0x553d('0x53')]['id']},'attributes':[_0x553d('0x5b'),'loginLogo',_0x553d('0x5d'),_0x553d('0x5e'),_0x553d('0x5f'),_0x553d('0x60'),_0x553d('0x61'),_0x553d('0x62')],'raw':!![]});})[_0x553d('0x33')](handleEntityNotFound(_0x363f6c,null))[_0x553d('0x33')](function(_0x520dfb){if(_0x520dfb){var _0x12497c=_0x520dfb[_0x553d('0x5e')]&&fs[_0x553d('0x63')](path[_0x553d('0x64')](config['root'],_0x215afa,_['toLower'](_0x520dfb[_0x553d('0x5e')])))?path[_0x553d('0x64')](config[_0x553d('0x65')],_0x215afa,_['toLower'](_0x520dfb[_0x553d('0x5e')])):path[_0x553d('0x64')](config['root'],_0x215afa,_[_0x553d('0x66')](_0x553d('0x76')));var _0x39394d=_0x553d('0x67')+_[_0x553d('0x68')]('favicon');if(_0x520dfb[_0x39394d]||!_0x38e923[_0x553d('0x69')]){_0x12497c=path[_0x553d('0x64')](config[_0x553d('0x65')],_0x215afa,_[_0x553d('0x66')](_0x553d('0x76')));}if(!fs['existsSync'](_0x12497c)){throw new db[(_0x553d('0x6b'))][(_0x553d('0x6c'))](_[_0x553d('0x68')](_0x553d('0x5e'))+_0x553d('0x6d'));}return _0x363f6c[_0x553d('0x6e')](_0x12497c);}})[_0x553d('0x51')](handleError(_0x363f6c,null));};exports[_0x553d('0x77')]=function(_0x5148d8,_0x18d334){var _0x891705={'offset':moment()[_0x553d('0x78')]()};_0x891705[_0x553d('0x79')]=moment()[_0x553d('0x78')](_0x891705['offset'])['format'](_0x553d('0x7a'));return _0x18d334[_0x553d('0x28')](0xc8)['send'](_0x891705);}; \ No newline at end of file +var _0x4756=['sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','file','logo','filename','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','upperFirst','Sequelize','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','default','custom','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','Setting','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4756,0xa6));var _0x6475=function(_0x25dd09,_0x16cdcd){_0x25dd09=_0x25dd09-0x0;var _0x5520bb=_0x4756[_0x25dd09];return _0x5520bb;};'use strict';var emlformat=require(_0x6475('0x0'));var rimraf=require(_0x6475('0x1'));var zipdir=require(_0x6475('0x2'));var jsonpatch=require(_0x6475('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6475('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6475('0x5'));var fs=require('fs');var fs_extra=require(_0x6475('0x6'));var _=require(_0x6475('0x7'));var squel=require('squel');var crypto=require(_0x6475('0x8'));var jsforce=require(_0x6475('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6475('0xa'));var Papa=require(_0x6475('0xb'));var Redis=require(_0x6475('0xc'));var authService=require(_0x6475('0xd'));var qs=require(_0x6475('0xe'));var as=require(_0x6475('0xf'));var hardwareService=require(_0x6475('0x10'));var logger=require(_0x6475('0x11'))('api');var utils=require(_0x6475('0x12'));var config=require(_0x6475('0x13'));var licenseUtil=require(_0x6475('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6475('0x15')][_0x6475('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x427bff,_0x1ae4c9,_0x32bb88,_0x1258ed){return new BPromise(function(_0x53ddbd,_0x1b1dbc){var _0x47747c=_0x1258ed||client;return _0x47747c[_0x6475('0x17')](_0x427bff,_0x32bb88)[_0x6475('0x18')](function(_0xa02fd6){logger[_0x6475('0x19')](_0x6475('0x1a'),_0x1ae4c9,_0x6475('0x1b'));logger[_0x6475('0x1c')](_0x6475('0x1d'),_0x1ae4c9,_0x6475('0x1b'),JSON[_0x6475('0x1e')](_0xa02fd6));if(_0xa02fd6[_0x6475('0x1f')]){if(_0xa02fd6[_0x6475('0x1f')][_0x6475('0x20')]===0x1f4){logger[_0x6475('0x1f')]('Setting,\x20%s,\x20%s',_0x1ae4c9,_0xa02fd6[_0x6475('0x1f')][_0x6475('0x21')]);return _0x1b1dbc(_0xa02fd6[_0x6475('0x1f')]['message']);}logger[_0x6475('0x1f')](_0x6475('0x1a'),_0x1ae4c9,_0xa02fd6[_0x6475('0x1f')][_0x6475('0x21')]);return _0x53ddbd(_0xa02fd6[_0x6475('0x1f')][_0x6475('0x21')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x1ae4c9,'request\x20sent');_0x53ddbd(_0xa02fd6[_0x6475('0x22')][_0x6475('0x21')]);}})[_0x6475('0x23')](function(_0x563082){logger[_0x6475('0x1f')]('Setting,\x20%s,\x20%s',_0x1ae4c9,_0x563082);_0x1b1dbc(_0x563082);});});}function respondWithStatusCode(_0x5b5d89,_0x513ed7){_0x513ed7=_0x513ed7||0xcc;return function(_0x219715){if(_0x219715){return _0x5b5d89['sendStatus'](_0x513ed7);}return _0x5b5d89['status'](_0x513ed7)['end']();};}function respondWithResult(_0x5a83c2,_0x310115){_0x310115=_0x310115||0xc8;return function(_0x13c0c3){if(_0x13c0c3){return _0x5a83c2[_0x6475('0x24')](_0x310115)['json'](_0x13c0c3);}};}function respondWithFilteredResult(_0x18ef16,_0xce3662){return function(_0x23e096){if(_0x23e096){var _0x541035=typeof _0xce3662[_0x6475('0x25')]===_0x6475('0x26')&&typeof _0xce3662[_0x6475('0x27')]===_0x6475('0x26');var _0x189abb=_0x23e096[_0x6475('0x28')];var _0xb4a0fb=_0x541035?0x0:_0xce3662[_0x6475('0x25')];var _0x369088=_0x541035?_0x23e096[_0x6475('0x28')]:_0xce3662[_0x6475('0x25')]+_0xce3662[_0x6475('0x27')];var _0x5563ee;if(_0x369088>=_0x189abb){_0x369088=_0x189abb;_0x5563ee=0xc8;}else{_0x5563ee=0xce;}_0x18ef16[_0x6475('0x24')](_0x5563ee);return _0x18ef16[_0x6475('0x29')]('Content-Range',_0xb4a0fb+'-'+_0x369088+'/'+_0x189abb)[_0x6475('0x2a')](_0x23e096);}return null;};}function patchUpdates(_0x3d0058){return function(_0xcbe2e4){try{jsonpatch[_0x6475('0x2b')](_0xcbe2e4,_0x3d0058,!![]);}catch(_0x42a92b){return BPromise[_0x6475('0x2c')](_0x42a92b);}return _0xcbe2e4[_0x6475('0x2d')]();};}function saveUpdates(_0x31242f,_0xbe38f){return function(_0x31cdcb){if(_0x31cdcb){return _0x31cdcb[_0x6475('0x2e')](_0x31242f)[_0x6475('0x18')](function(_0x2c032a){return _0x2c032a;});}return null;};}function removeEntity(_0x141159,_0x5d0792){return function(_0x898a36){if(_0x898a36){return _0x898a36[_0x6475('0x2f')]()[_0x6475('0x18')](function(){_0x141159[_0x6475('0x24')](0xcc)[_0x6475('0x30')]();});}};}function handleEntityNotFound(_0x56b7be,_0x27f1a7){return function(_0x104736){if(!_0x104736){_0x56b7be[_0x6475('0x31')](0x194);}return _0x104736;};}function handleError(_0x15f68c,_0x323f70){_0x323f70=_0x323f70||0x1f4;return function(_0x3a1c42){logger[_0x6475('0x1f')](_0x3a1c42[_0x6475('0x32')]);if(_0x3a1c42[_0x6475('0x33')]){delete _0x3a1c42[_0x6475('0x33')];}_0x15f68c[_0x6475('0x24')](_0x323f70)[_0x6475('0x34')](_0x3a1c42);};}exports['index']=function(_0xf9192d,_0x8581fc){var _0x2c786c={},_0x3dfa3b={},_0x4ec718={'count':0x0,'rows':[]};var _0x2f96c2=_['map'](db[_0x6475('0x35')]['rawAttributes'],function(_0x4dd7ef){return{'name':_0x4dd7ef['fieldName'],'type':_0x4dd7ef[_0x6475('0x36')][_0x6475('0x37')]};});_0x3dfa3b[_0x6475('0x38')]=_[_0x6475('0x39')](_0x2f96c2,'name');_0x3dfa3b[_0x6475('0x3a')]=_[_0x6475('0x3b')](_0xf9192d['query']);_0x3dfa3b[_0x6475('0x3c')]=_[_0x6475('0x3d')](_0x3dfa3b[_0x6475('0x38')],_0x3dfa3b['query']);_0x2c786c[_0x6475('0x3e')]=_[_0x6475('0x3d')](_0x3dfa3b['model'],qs[_0x6475('0x3f')](_0xf9192d[_0x6475('0x3a')][_0x6475('0x3f')]));_0x2c786c[_0x6475('0x3e')]=_0x2c786c['attributes']['length']?_0x2c786c[_0x6475('0x3e')]:_0x3dfa3b[_0x6475('0x38')];if(!_0xf9192d[_0x6475('0x3a')][_0x6475('0x40')](_0x6475('0x41'))){_0x2c786c[_0x6475('0x27')]=qs[_0x6475('0x27')](_0xf9192d[_0x6475('0x3a')][_0x6475('0x27')]);_0x2c786c[_0x6475('0x25')]=qs[_0x6475('0x25')](_0xf9192d[_0x6475('0x3a')][_0x6475('0x25')]);}_0x2c786c['order']=qs[_0x6475('0x42')](_0xf9192d[_0x6475('0x3a')][_0x6475('0x42')]);_0x2c786c[_0x6475('0x43')]=qs['filters'](_['pick'](_0xf9192d[_0x6475('0x3a')],_0x3dfa3b[_0x6475('0x3c')]),_0x2f96c2);if(_0xf9192d[_0x6475('0x3a')]['filter']){_0x2c786c[_0x6475('0x43')]=_[_0x6475('0x44')](_0x2c786c[_0x6475('0x43')],{'$or':_['map'](_0x2f96c2,function(_0x2b4b7c){if(_0x2b4b7c[_0x6475('0x36')]!==_0x6475('0x45')){var _0x55b79b={};_0x55b79b[_0x2b4b7c[_0x6475('0x33')]]={'$like':'%'+_0xf9192d['query'][_0x6475('0x46')]+'%'};return _0x55b79b;}})});}_0x2c786c=_[_0x6475('0x44')]({},_0x2c786c,_0xf9192d[_0x6475('0x47')]);var _0x2e907c={'where':_0x2c786c[_0x6475('0x43')]};return db['Setting'][_0x6475('0x28')](_0x2e907c)[_0x6475('0x18')](function(_0x17cfc0){_0x4ec718['count']=_0x17cfc0;if(_0xf9192d[_0x6475('0x3a')][_0x6475('0x48')]){_0x2c786c[_0x6475('0x49')]=[{'all':!![]}];}return db['Setting'][_0x6475('0x4a')](_0x2c786c);})[_0x6475('0x18')](function(_0x5fc6ef){_0x4ec718[_0x6475('0x4b')]=_0x5fc6ef;return _0x4ec718;})[_0x6475('0x18')](respondWithFilteredResult(_0x8581fc,_0x2c786c))[_0x6475('0x23')](handleError(_0x8581fc,null));};exports['show']=function(_0x5d3431,_0x45722d){var _0xd5486c={'raw':![],'where':{'id':_0x5d3431[_0x6475('0x4c')]['id']}},_0x1e479c={};_0x1e479c[_0x6475('0x38')]=_[_0x6475('0x3b')](db['Setting']['rawAttributes']);_0x1e479c[_0x6475('0x3a')]=_[_0x6475('0x3b')](_0x5d3431[_0x6475('0x3a')]);_0x1e479c[_0x6475('0x3c')]=_[_0x6475('0x3d')](_0x1e479c[_0x6475('0x38')],_0x1e479c['query']);_0xd5486c['attributes']=_[_0x6475('0x3d')](_0x1e479c[_0x6475('0x38')],qs[_0x6475('0x3f')](_0x5d3431['query']['fields']));_0xd5486c[_0x6475('0x3e')]=_0xd5486c['attributes']['length']?_0xd5486c[_0x6475('0x3e')]:_0x1e479c[_0x6475('0x38')];if(_0x5d3431[_0x6475('0x3a')][_0x6475('0x48')]){_0xd5486c[_0x6475('0x49')]=[{'all':!![]}];}_0xd5486c=_[_0x6475('0x44')]({},_0xd5486c,_0x5d3431[_0x6475('0x47')]);return db[_0x6475('0x35')][_0x6475('0x4d')](_0xd5486c)[_0x6475('0x18')](handleEntityNotFound(_0x45722d,null))['then'](respondWithResult(_0x45722d,null))[_0x6475('0x23')](handleError(_0x45722d,null));};exports['update']=function(_0xe63dd1,_0x5ce0c0){if(_0xe63dd1[_0x6475('0x4e')]['id']){delete _0xe63dd1[_0x6475('0x4e')]['id'];}return db['Setting']['find']({'where':{'id':_0xe63dd1[_0x6475('0x4c')]['id']}})[_0x6475('0x18')](handleEntityNotFound(_0x5ce0c0,null))[_0x6475('0x18')](saveUpdates(_0xe63dd1[_0x6475('0x4e')],null))[_0x6475('0x18')](respondWithResult(_0x5ce0c0,null))[_0x6475('0x23')](handleError(_0x5ce0c0,null));};exports['addLogo']=function(_0x1b8f56,_0x302a23,_0x1fc24f){if(_0x1b8f56[_0x6475('0x4f')]&&_0x1b8f56[_0x6475('0x4f')]['filename']){_0x1b8f56['body'][_0x6475('0x50')]=_0x1b8f56[_0x6475('0x4f')][_0x6475('0x51')];}return db[_0x6475('0x35')]['find']({'where':{'id':_0x1b8f56['params']['id']}})[_0x6475('0x18')](handleEntityNotFound(_0x302a23,null))[_0x6475('0x18')](saveUpdates(_0x1b8f56['body'],null))[_0x6475('0x18')](respondWithResult(_0x302a23,null))[_0x6475('0x23')](handleError(_0x302a23,null));};exports[_0x6475('0x52')]=function(_0x19580f,_0x221f60,_0x34f6c4){if(_0x19580f['file']&&_0x19580f[_0x6475('0x4f')][_0x6475('0x51')]){_0x19580f[_0x6475('0x4e')][_0x6475('0x53')]=_0x19580f['file']['filename'];}return db[_0x6475('0x35')]['find']({'where':{'id':_0x19580f['params']['id']}})[_0x6475('0x18')](handleEntityNotFound(_0x221f60,null))[_0x6475('0x18')](saveUpdates(_0x19580f[_0x6475('0x4e')],null))[_0x6475('0x18')](respondWithResult(_0x221f60,null))[_0x6475('0x23')](handleError(_0x221f60,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x3821e6,_0x5ceb15,_0xf5dba6){var _0x4dbad0=_0x6475('0x54');var _0x56218f={'custom':![]};return utilLicense[_0x6475('0x55')]()[_0x6475('0x18')](function(_0x3ff3d0){if(_0x3ff3d0){_0x56218f=_0x3ff3d0;}return db[_0x6475('0x35')][_0x6475('0x4d')]({'where':{'id':_0x3821e6[_0x6475('0x4c')]['id']},'attributes':[_0x6475('0x50'),_0x6475('0x53'),_0x6475('0x56'),_0x6475('0x57'),_0x6475('0x58'),_0x6475('0x59'),_0x6475('0x5a'),_0x6475('0x5b')],'raw':!![]});})[_0x6475('0x18')](handleEntityNotFound(_0x5ceb15,null))['then'](function(_0x44d7c1){if(_0x44d7c1){var _0x2c09fe=_0x44d7c1[_0x6475('0x50')]&&fs[_0x6475('0x5c')](path[_0x6475('0x5d')](config['root'],_0x4dbad0,_[_0x6475('0x5e')](_0x44d7c1[_0x6475('0x50')])))?path[_0x6475('0x5d')](config[_0x6475('0x5f')],_0x4dbad0,_[_0x6475('0x5e')](_0x44d7c1[_0x6475('0x50')])):path[_0x6475('0x5d')](config[_0x6475('0x5f')],_0x4dbad0,_[_0x6475('0x5e')]('default_logo.svg'));var _0xb6b3f4='default'+_[_0x6475('0x60')]('logo');if(_0x44d7c1[_0xb6b3f4]||!_0x56218f['custom']){_0x2c09fe=path[_0x6475('0x5d')](config[_0x6475('0x5f')],_0x4dbad0,_[_0x6475('0x5e')]('default_logo.svg'));}if(!fs[_0x6475('0x5c')](_0x2c09fe)){throw new db[(_0x6475('0x61'))]['ValidationError'](_[_0x6475('0x60')]('logo')+_0x6475('0x62'));}return _0x5ceb15[_0x6475('0x63')](_0x2c09fe);}})[_0x6475('0x23')](handleError(_0x5ceb15,null));};var utilLicense=require('../../config/license/util');exports[_0x6475('0x64')]=function(_0x47ebc1,_0xba915d,_0xefcff2){var _0x2ae54b=_0x6475('0x54');var _0x21803a={'custom':![]};return utilLicense[_0x6475('0x55')]()['then'](function(_0x3dfa90){if(_0x3dfa90){_0x21803a=_0x3dfa90;}return db[_0x6475('0x35')]['find']({'where':{'id':_0x47ebc1[_0x6475('0x4c')]['id']},'attributes':['logo',_0x6475('0x53'),_0x6475('0x56'),_0x6475('0x57'),_0x6475('0x58'),_0x6475('0x59'),_0x6475('0x5a'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0xba915d,null))[_0x6475('0x18')](function(_0x186f91){if(_0x186f91){var _0xd39f9b=_0x186f91[_0x6475('0x53')]&&fs['existsSync'](path['join'](config[_0x6475('0x5f')],_0x2ae54b,_[_0x6475('0x5e')](_0x186f91[_0x6475('0x53')])))?path['join'](config['root'],_0x2ae54b,_[_0x6475('0x5e')](_0x186f91['loginLogo'])):path['join'](config[_0x6475('0x5f')],_0x2ae54b,_[_0x6475('0x5e')](_0x6475('0x65')));var _0x393ebe=_0x6475('0x66')+_[_0x6475('0x60')](_0x6475('0x53'));if(_0x186f91[_0x393ebe]||!_0x21803a[_0x6475('0x67')]){_0xd39f9b=path[_0x6475('0x5d')](config[_0x6475('0x5f')],_0x2ae54b,_[_0x6475('0x5e')]('default_loginLogo.svg'));}if(!fs[_0x6475('0x5c')](_0xd39f9b)){throw new db['Sequelize'][(_0x6475('0x68'))](_[_0x6475('0x60')](_0x6475('0x53'))+_0x6475('0x62'));}return _0xba915d[_0x6475('0x63')](_0xd39f9b);}})['catch'](handleError(_0xba915d,null));};exports[_0x6475('0x69')]=function(_0x382498,_0x2c9f3d){return db[_0x6475('0x35')]['find']({'where':{'id':_0x382498[_0x6475('0x4c')]['id']},'attributes':[_0x6475('0x6a')]})[_0x6475('0x18')](respondWithResult(_0x2c9f3d,null))[_0x6475('0x23')](handleError(_0x2c9f3d,null));};exports[_0x6475('0x6b')]=function(_0x43c0e3,_0x48f6d0,_0x30f72b){if(_0x43c0e3[_0x6475('0x4f')]&&_0x43c0e3[_0x6475('0x4f')][_0x6475('0x51')]){_0x43c0e3[_0x6475('0x4e')][_0x6475('0x56')]=_0x43c0e3[_0x6475('0x4f')][_0x6475('0x51')];}return db[_0x6475('0x35')][_0x6475('0x4d')]({'where':{'id':_0x43c0e3[_0x6475('0x4c')]['id']}})[_0x6475('0x18')](handleEntityNotFound(_0x48f6d0,null))[_0x6475('0x18')](saveUpdates(_0x43c0e3['body'],null))['then'](respondWithResult(_0x48f6d0,null))[_0x6475('0x23')](handleError(_0x48f6d0,null));};var utilLicense=require(_0x6475('0x14'));exports[_0x6475('0x6c')]=function(_0x20375f,_0xffc409,_0x3253dd){var _0x42fb58=_0x6475('0x54');var _0x438221={'custom':![]};return utilLicense[_0x6475('0x55')]()['then'](function(_0x4d7826){if(_0x4d7826){_0x438221=_0x4d7826;}return db[_0x6475('0x35')][_0x6475('0x4d')]({'where':{'id':_0x20375f[_0x6475('0x4c')]['id']},'attributes':[_0x6475('0x50'),_0x6475('0x53'),'preferred',_0x6475('0x57'),_0x6475('0x58'),_0x6475('0x59'),_0x6475('0x5a'),'defaultFavicon'],'raw':!![]});})[_0x6475('0x18')](handleEntityNotFound(_0xffc409,null))[_0x6475('0x18')](function(_0x7b9561){if(_0x7b9561){var _0x20444e=_0x7b9561[_0x6475('0x56')]&&fs[_0x6475('0x5c')](path[_0x6475('0x5d')](config[_0x6475('0x5f')],_0x42fb58,_['toLower'](_0x7b9561[_0x6475('0x56')])))?path['join'](config[_0x6475('0x5f')],_0x42fb58,_['toLower'](_0x7b9561[_0x6475('0x56')])):path[_0x6475('0x5d')](config['root'],_0x42fb58,_[_0x6475('0x5e')](_0x6475('0x6d')));var _0xbd43c7='default'+_[_0x6475('0x60')](_0x6475('0x56'));if(_0x7b9561[_0xbd43c7]||!_0x438221[_0x6475('0x67')]||!_0x438221[_0x6475('0x56')]){_0x20444e=path['join'](config[_0x6475('0x5f')],_0x42fb58,_[_0x6475('0x5e')]('default_preferred.png'));}if(!fs[_0x6475('0x5c')](_0x20444e)){throw new db[(_0x6475('0x61'))][(_0x6475('0x68'))](_[_0x6475('0x60')](_0x6475('0x56'))+_0x6475('0x62'));}return _0xffc409['download'](_0x20444e);}})['catch'](handleError(_0xffc409,null));};exports[_0x6475('0x6e')]=function(_0x358115,_0x487897,_0x1898dd){if(_0x358115['file']&&_0x358115[_0x6475('0x4f')][_0x6475('0x51')]){_0x358115['body'][_0x6475('0x57')]=_0x358115[_0x6475('0x4f')][_0x6475('0x51')];}return db[_0x6475('0x35')][_0x6475('0x4d')]({'where':{'id':_0x358115['params']['id']}})['then'](handleEntityNotFound(_0x487897,null))[_0x6475('0x18')](saveUpdates(_0x358115[_0x6475('0x4e')],null))[_0x6475('0x18')](respondWithResult(_0x487897,null))['catch'](handleError(_0x487897,null));};var utilLicense=require(_0x6475('0x14'));exports['getFavicon']=function(_0x2ebb53,_0x56b450,_0x5131d7){var _0x53d62a=_0x6475('0x54');var _0x45ee28={'custom':![]};return utilLicense[_0x6475('0x55')]()[_0x6475('0x18')](function(_0x10f605){if(_0x10f605){_0x45ee28=_0x10f605;}return db[_0x6475('0x35')][_0x6475('0x4d')]({'where':{'id':_0x2ebb53['params']['id']},'attributes':[_0x6475('0x50'),_0x6475('0x53'),_0x6475('0x56'),_0x6475('0x57'),_0x6475('0x58'),_0x6475('0x59'),_0x6475('0x5a'),'defaultFavicon'],'raw':!![]});})[_0x6475('0x18')](handleEntityNotFound(_0x56b450,null))['then'](function(_0x37fd06){if(_0x37fd06){var _0x49233b=_0x37fd06[_0x6475('0x57')]&&fs[_0x6475('0x5c')](path[_0x6475('0x5d')](config[_0x6475('0x5f')],_0x53d62a,_[_0x6475('0x5e')](_0x37fd06[_0x6475('0x57')])))?path['join'](config[_0x6475('0x5f')],_0x53d62a,_[_0x6475('0x5e')](_0x37fd06[_0x6475('0x57')])):path[_0x6475('0x5d')](config[_0x6475('0x5f')],_0x53d62a,_[_0x6475('0x5e')](_0x6475('0x6f')));var _0x1c4d13='default'+_[_0x6475('0x60')](_0x6475('0x57'));if(_0x37fd06[_0x1c4d13]||!_0x45ee28[_0x6475('0x67')]){_0x49233b=path[_0x6475('0x5d')](config[_0x6475('0x5f')],_0x53d62a,_['toLower']('default_favicon.ico'));}if(!fs[_0x6475('0x5c')](_0x49233b)){throw new db['Sequelize'][(_0x6475('0x68'))](_[_0x6475('0x60')](_0x6475('0x57'))+_0x6475('0x62'));}return _0x56b450[_0x6475('0x63')](_0x49233b);}})['catch'](handleError(_0x56b450,null));};exports[_0x6475('0x70')]=function(_0x61a899,_0x3f31e0){var _0x44dff1={'offset':moment()['utcOffset']()};_0x44dff1['now']=moment()[_0x6475('0x71')](_0x44dff1['offset'])[_0x6475('0x72')](_0x6475('0x73'));return _0x3f31e0['status'](0xc8)[_0x6475('0x34')](_0x44dff1);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index d6a9e00..4a67c5a 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x5f4fb7,_0x3fa79c){var _0x22864d=function(_0x4370bb){while(--_0x4370bb){_0x5f4fb7['push'](_0x5f4fb7['shift']());}};_0x22864d(++_0x3fa79c);}(_0xe14b,0x93));var _0xbe14=function(_0x420435,_0x3e370f){_0x420435=_0x420435-0x0;var _0x239a0a=_0xe14b[_0x420435];return _0x239a0a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0x55ca,0x126));var _0xa55c=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x55ca[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'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 87805c5..5db5a94 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 _0x0a22=['map','info','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','model'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x0a22,0x122));var _0x20a2=function(_0x13e14a,_0x3fdb2e){_0x13e14a=_0x13e14a-0x0;var _0x46f346=_0x0a22[_0x13e14a];return _0x46f346;};'use strict';var _=require(_0x20a2('0x0'));var util=require('util');var moment=require(_0x20a2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20a2('0x2'));var db=require(_0x20a2('0x3'))['db'];var utils=require(_0x20a2('0x4'));var logger=require(_0x20a2('0x5'))('rpc');var config=require(_0x20a2('0x6'));var jayson=require(_0x20a2('0x7'));var client=jayson[_0x20a2('0x8')][_0x20a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4060ee,_0x3864da,_0x4ada98){return new BPromise(function(_0x47d26d,_0x399f4c){return client[_0x20a2('0xa')](_0x4060ee,_0x4ada98)[_0x20a2('0xb')](function(_0x228009){logger['info'](_0x20a2('0xc'),_0x3864da,_0x20a2('0xd'));logger['debug'](_0x20a2('0xe'),_0x3864da,'request\x20sent',JSON[_0x20a2('0xf')](_0x228009));if(_0x228009[_0x20a2('0x10')]){if(_0x228009[_0x20a2('0x10')][_0x20a2('0x11')]===0x1f4){logger[_0x20a2('0x10')](_0x20a2('0xc'),_0x3864da,_0x228009['error'][_0x20a2('0x12')]);return _0x399f4c(_0x228009[_0x20a2('0x10')]['message']);}logger[_0x20a2('0x10')]('Setting,\x20%s,\x20%s',_0x3864da,_0x228009[_0x20a2('0x10')]['message']);return _0x47d26d(_0x228009['error']['message']);}else{logger['info'](_0x20a2('0xc'),_0x3864da,_0x20a2('0xd'));_0x47d26d(_0x228009[_0x20a2('0x13')]['message']);}})[_0x20a2('0x14')](function(_0x20dee6){logger[_0x20a2('0x10')]('Setting,\x20%s,\x20%s',_0x3864da,_0x20dee6);_0x399f4c(_0x20dee6);});});}exports[_0x20a2('0x15')]=function(_0x3db15e){var _0x229a3b=this;return new Promise(function(_0x3cfe04,_0x18942c){return db[_0x20a2('0x16')][_0x20a2('0x17')]({'raw':_0x3db15e[_0x20a2('0x18')]?_0x3db15e['options'][_0x20a2('0x19')]===undefined?!![]:![]:!![],'where':_0x3db15e[_0x20a2('0x18')]?_0x3db15e[_0x20a2('0x18')][_0x20a2('0x1a')]||null:null,'attributes':_0x3db15e[_0x20a2('0x18')]?_0x3db15e[_0x20a2('0x18')][_0x20a2('0x1b')]||null:null,'include':_0x3db15e[_0x20a2('0x18')]?_0x3db15e[_0x20a2('0x18')][_0x20a2('0x1c')]?_['map'](_0x3db15e[_0x20a2('0x18')][_0x20a2('0x1c')],function(_0x357413){return{'model':db[_0x357413['model']],'as':_0x357413['as'],'attributes':_0x357413[_0x20a2('0x1b')],'include':_0x357413[_0x20a2('0x1c')]?_['map'](_0x357413[_0x20a2('0x1c')],function(_0x4eaa04){return{'model':db[_0x4eaa04[_0x20a2('0x1d')]],'as':_0x4eaa04['as'],'attributes':_0x4eaa04[_0x20a2('0x1b')],'include':_0x4eaa04[_0x20a2('0x1c')]?_[_0x20a2('0x1e')](_0x4eaa04[_0x20a2('0x1c')],function(_0x41532d){return{'model':db[_0x41532d[_0x20a2('0x1d')]],'as':_0x41532d['as'],'attributes':_0x41532d[_0x20a2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x20a2('0xb')](function(_0x5a6022){logger[_0x20a2('0x1f')]('ShowSetting',_0x3db15e);logger['debug'](_0x20a2('0x15'),_0x3db15e,JSON[_0x20a2('0xf')](_0x5a6022));_0x3cfe04(_0x5a6022);})[_0x20a2('0x14')](function(_0x4817d2){logger[_0x20a2('0x10')]('ShowSetting',_0x4817d2[_0x20a2('0x12')],_0x3db15e);_0x18942c(_0x229a3b[_0x20a2('0x10')](0x1f4,_0x4817d2[_0x20a2('0x12')]));});});}; \ No newline at end of file +var _0xdf81=['request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ShowSetting','Setting','find','options','raw','include','map','model','attributes','debug','lodash','util','moment','../../mysqldb','../../config/utils','rpc','client','request','then','Setting,\x20%s,\x20%s'];(function(_0x3335f6,_0x485c1a){var _0x3d3925=function(_0x460da3){while(--_0x460da3){_0x3335f6['push'](_0x3335f6['shift']());}};_0x3d3925(++_0x485c1a);}(_0xdf81,0x1c1));var _0x1df8=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xdf81[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x1df8('0x0'));var util=require(_0x1df8('0x1'));var moment=require(_0x1df8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1df8('0x3'))['db'];var utils=require(_0x1df8('0x4'));var logger=require('../../config/logger')(_0x1df8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1df8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b691,_0x1f3150,_0x4bcfd3){return new BPromise(function(_0x1c8894,_0x2646fe){return client[_0x1df8('0x7')](_0x22b691,_0x4bcfd3)[_0x1df8('0x8')](function(_0x25a973){logger['info'](_0x1df8('0x9'),_0x1f3150,_0x1df8('0xa'));logger['debug'](_0x1df8('0xb'),_0x1f3150,_0x1df8('0xa'),JSON[_0x1df8('0xc')](_0x25a973));if(_0x25a973['error']){if(_0x25a973[_0x1df8('0xd')][_0x1df8('0xe')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x1f3150,_0x25a973[_0x1df8('0xd')][_0x1df8('0xf')]);return _0x2646fe(_0x25a973[_0x1df8('0xd')][_0x1df8('0xf')]);}logger['error'](_0x1df8('0x9'),_0x1f3150,_0x25a973[_0x1df8('0xd')][_0x1df8('0xf')]);return _0x1c8894(_0x25a973[_0x1df8('0xd')][_0x1df8('0xf')]);}else{logger[_0x1df8('0x10')](_0x1df8('0x9'),_0x1f3150,_0x1df8('0xa'));_0x1c8894(_0x25a973['result'][_0x1df8('0xf')]);}})['catch'](function(_0x1ceef4){logger[_0x1df8('0xd')](_0x1df8('0x9'),_0x1f3150,_0x1ceef4);_0x2646fe(_0x1ceef4);});});}exports[_0x1df8('0x11')]=function(_0x3361a2){var _0x27a865=this;return new Promise(function(_0x1276fd,_0x5cf7d9){return db[_0x1df8('0x12')][_0x1df8('0x13')]({'raw':_0x3361a2['options']?_0x3361a2[_0x1df8('0x14')][_0x1df8('0x15')]===undefined?!![]:![]:!![],'where':_0x3361a2['options']?_0x3361a2['options']['where']||null:null,'attributes':_0x3361a2[_0x1df8('0x14')]?_0x3361a2['options']['attributes']||null:null,'include':_0x3361a2[_0x1df8('0x14')]?_0x3361a2[_0x1df8('0x14')][_0x1df8('0x16')]?_[_0x1df8('0x17')](_0x3361a2['options'][_0x1df8('0x16')],function(_0x4ec3e5){return{'model':db[_0x4ec3e5[_0x1df8('0x18')]],'as':_0x4ec3e5['as'],'attributes':_0x4ec3e5['attributes'],'include':_0x4ec3e5[_0x1df8('0x16')]?_[_0x1df8('0x17')](_0x4ec3e5[_0x1df8('0x16')],function(_0x56d1c1){return{'model':db[_0x56d1c1[_0x1df8('0x18')]],'as':_0x56d1c1['as'],'attributes':_0x56d1c1[_0x1df8('0x19')],'include':_0x56d1c1[_0x1df8('0x16')]?_[_0x1df8('0x17')](_0x56d1c1[_0x1df8('0x16')],function(_0x442420){return{'model':db[_0x442420[_0x1df8('0x18')]],'as':_0x442420['as'],'attributes':_0x442420['attributes']};}):[]};}):[]};}):[]:[]})[_0x1df8('0x8')](function(_0x1d2beb){logger[_0x1df8('0x10')](_0x1df8('0x11'),_0x3361a2);logger[_0x1df8('0x1a')](_0x1df8('0x11'),_0x3361a2,JSON['stringify'](_0x1d2beb));_0x1276fd(_0x1d2beb);})['catch'](function(_0x2290db){logger[_0x1df8('0xd')]('ShowSetting',_0x2290db['message'],_0x3361a2);_0x5cf7d9(_0x27a865[_0x1df8('0xd')](0x1f4,_0x2290db[_0x1df8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index fe06f67..9422268 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 _0x55ca=['describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0x55ca,0x126));var _0xa55c=function(_0x487702,_0x49f5d4){_0x487702=_0x487702-0x0;var _0x5e7150=_0x55ca[_0x487702];return _0x5e7150;};'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')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);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['getApplications']);router['get'](_0xa55c('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xa55c('0x12'),controller[_0xa55c('0x13')]);router[_0xa55c('0x7')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x17')](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);router[_0xa55c('0x17')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller['addAnswer']);router[_0xa55c('0x17')](_0xa55c('0x19'),controller[_0xa55c('0x1a')]);router[_0xa55c('0x17')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['addApplications']);router['post'](_0xa55c('0x1b'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1c')]);router['post'](_0xa55c('0x12'),controller[_0xa55c('0x1d')]);router['post'](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1e')]);router[_0xa55c('0x1f')](_0xa55c('0xb'),auth['isAuthenticated'](),controller[_0xa55c('0x20')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x21')]);router['delete'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x22')]);router[_0xa55c('0x23')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x24')]);router[_0xa55c('0x23')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x25')]);module['exports']=router; \ No newline at end of file +var _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x40c90c,_0x46556e){var _0x28eaec=function(_0x21bd77){while(--_0x21bd77){_0x40c90c['push'](_0x40c90c['shift']());}};_0x28eaec(++_0x46556e);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2d8a95,_0x753c52){_0x2d8a95=_0x2d8a95-0x0;var _0x4d391e=_0x8ef6[_0x2d8a95];return _0x4d391e;};'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['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index a4e8b5a..7a10bf3 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 _0xfe4a=['csc','intelepeer','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','mandatoryDisposition','exports','STRING','name','generate','ENUM','skebby','clicksend','plivo','clickatell','bandwidth'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0xfe4a,0x1d1));var _0xafe4=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xfe4a[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xafe4('0x0')]={'name':{'type':Sequelize[_0xafe4('0x1')],'unique':_0xafe4('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xafe4('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xafe4('0x1')],'defaultValue':function(){return rs[_0xafe4('0x3')]();}},'phone':{'type':Sequelize[_0xafe4('0x1')]},'type':{'type':Sequelize[_0xafe4('0x4')]('twilio',_0xafe4('0x5'),'connectel',_0xafe4('0x6'),_0xafe4('0x7'),_0xafe4('0x8'),_0xafe4('0x9'),_0xafe4('0xa'),'infobip',_0xafe4('0xb'))},'accountSid':{'type':Sequelize[_0xafe4('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xafe4('0x1')]},'smsMethod':{'type':Sequelize[_0xafe4('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xafe4('0x1')]},'password':{'type':Sequelize[_0xafe4('0x1')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xafe4('0x1')]},'accountId':{'type':Sequelize[_0xafe4('0x1')]},'senderString':{'type':Sequelize[_0xafe4('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xafe4('0xc');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xafe4('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xafe4('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xafe4('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xafe4('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xafe4('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xafe4('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xafe4('0xe')],'comment':_0xafe4('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xafe4('0xd')],'defaultValue':![],'comment':_0xafe4('0x10'),'set':function(_0x3a9a3e){if(!_0x3a9a3e)this[_0xafe4('0x11')]('mandatoryDispositionPauseId',null);this[_0xafe4('0x11')](_0xafe4('0x12'),_0x3a9a3e);}}}; \ No newline at end of file +var _0x0e23=['mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','ENUM','connectel','clicksend','plivo','infobip','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x4dd8b2,_0x2bdc25){var _0x12cd5e=function(_0x187075){while(--_0x187075){_0x4dd8b2['push'](_0x4dd8b2['shift']());}};_0x12cd5e(++_0x2bdc25);}(_0x0e23,0x133));var _0x30e2=function(_0x3ddc5c,_0x22b1dc){_0x3ddc5c=_0x3ddc5c-0x0;var _0x310ccd=_0x0e23[_0x3ddc5c];return _0x310ccd;};'use strict';var Sequelize=require(_0x30e2('0x0'));var rs=require(_0x30e2('0x1'));module[_0x30e2('0x2')]={'name':{'type':Sequelize[_0x30e2('0x3')],'unique':_0x30e2('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x30e2('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x30e2('0x3')]},'type':{'type':Sequelize[_0x30e2('0x5')]('twilio','skebby',_0x30e2('0x6'),_0x30e2('0x7'),_0x30e2('0x8'),'clickatell','bandwidth','csc',_0x30e2('0x9'),'intelepeer')},'accountSid':{'type':Sequelize[_0x30e2('0x3')]},'authId':{'type':Sequelize[_0x30e2('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x30e2('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x30e2('0x3')]},'password':{'type':Sequelize[_0x30e2('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x30e2('0x3')]},'accountId':{'type':Sequelize[_0x30e2('0x3')]},'senderString':{'type':Sequelize[_0x30e2('0x3')]},'deliveryReport':{'type':Sequelize[_0x30e2('0xa')],'defaultValue':![]},'description':{'type':Sequelize[_0x30e2('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x30e2('0xb');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x30e2('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x30e2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x30e2('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x30e2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x30e2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x30e2('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x30e2('0xc')],'comment':_0x30e2('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x30e2('0xa')],'defaultValue':![],'comment':_0x30e2('0xe'),'set':function(_0x5ea8ea){if(!_0x5ea8ea)this[_0x30e2('0xf')](_0x30e2('0x10'),null);this[_0x30e2('0xf')]('mandatoryDisposition',_0x5ea8ea);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a69cc50..feefc84 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 _0x24e2=['http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','json','undefined','offset','count','limit','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','model','map','keys','filters','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','includeAll','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','create','getDispositions','findOne','intersection','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','Applications','account','applications','priority','asc','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','Sequelize','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','CmContact','list','omit','Contacts','contact','SmsInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','\x0a','sequelize','transaction','SmsApplication','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','DESC','defaults','out','Messages','spread','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','DELIVERED','groupName','redif','SmsAccount,\x20%s,\x20%s,\x20%s','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client'];(function(_0xf80d82,_0x52d4c1){var _0x219138=function(_0x3d3322){while(--_0x3d3322){_0xf80d82['push'](_0xf80d82['shift']());}};_0x219138(++_0x52d4c1);}(_0x24e2,0xc7));var _0x224e=function(_0x40c9ad,_0x120440){_0x40c9ad=_0x40c9ad-0x0;var _0x3c1e09=_0x24e2[_0x40c9ad];return _0x3c1e09;};'use strict';var emlformat=require(_0x224e('0x0'));var rimraf=require(_0x224e('0x1'));var zipdir=require(_0x224e('0x2'));var jsonpatch=require(_0x224e('0x3'));var rp=require('request-promise');var moment=require(_0x224e('0x4'));var BPromise=require(_0x224e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x224e('0x6'));var sox=require(_0x224e('0x7'));var csv=require(_0x224e('0x8'));var ejs=require(_0x224e('0x9'));var fs=require('fs');var fs_extra=require(_0x224e('0xa'));var _=require(_0x224e('0xb'));var squel=require(_0x224e('0xc'));var crypto=require(_0x224e('0xd'));var jsforce=require(_0x224e('0xe'));var deskjs=require(_0x224e('0xf'));var toCsv=require(_0x224e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x224e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x224e('0x11'));var hardwareService=require(_0x224e('0x12'));var logger=require(_0x224e('0x13'))(_0x224e('0x14'));var utils=require('../../config/utils');var config=require(_0x224e('0x15'));var licenseUtil=require(_0x224e('0x16'));var db=require(_0x224e('0x17'))['db'];config[_0x224e('0x18')]=_['defaults'](config[_0x224e('0x18')],{'host':_0x224e('0x19'),'port':0x18eb});var socket=require(_0x224e('0x1a'))(new Redis(config['redis']));require(_0x224e('0x1b'))[_0x224e('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x224e('0x1d')][_0x224e('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x1a1812,_0x331ffb,_0xc0ef4a,_0x4e2043){return new BPromise(function(_0x292ddd,_0x5a6f1e){var _0x4b8282=_0x4e2043||client;return _0x4b8282[_0x224e('0x1f')](_0x1a1812,_0xc0ef4a)[_0x224e('0x20')](function(_0x4d9166){logger[_0x224e('0x21')](_0x224e('0x22'),_0x331ffb,_0x224e('0x23'));logger[_0x224e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x331ffb,_0x224e('0x23'),JSON[_0x224e('0x25')](_0x4d9166));if(_0x4d9166[_0x224e('0x26')]){if(_0x4d9166[_0x224e('0x26')][_0x224e('0x27')]===0x1f4){logger[_0x224e('0x26')](_0x224e('0x22'),_0x331ffb,_0x4d9166[_0x224e('0x26')][_0x224e('0x28')]);return _0x5a6f1e(_0x4d9166[_0x224e('0x26')][_0x224e('0x28')]);}logger[_0x224e('0x26')](_0x224e('0x22'),_0x331ffb,_0x4d9166[_0x224e('0x26')][_0x224e('0x28')]);return _0x292ddd(_0x4d9166[_0x224e('0x26')][_0x224e('0x28')]);}else{logger[_0x224e('0x21')]('SmsAccount,\x20%s,\x20%s',_0x331ffb,'request\x20sent');_0x292ddd(_0x4d9166['result']['message']);}})['catch'](function(_0x1ed9f1){logger['error']('SmsAccount,\x20%s,\x20%s',_0x331ffb,_0x1ed9f1);_0x5a6f1e(_0x1ed9f1);});});}function respondWithStatusCode(_0x399b65,_0x284ca5){_0x284ca5=_0x284ca5||0xcc;return function(_0x35c0cc){if(_0x35c0cc){return _0x399b65[_0x224e('0x29')](_0x284ca5);}return _0x399b65[_0x224e('0x2a')](_0x284ca5)[_0x224e('0x2b')]();};}function respondWithResult(_0x561cbf,_0x112186){_0x112186=_0x112186||0xc8;return function(_0x476492){if(_0x476492){return _0x561cbf['status'](_0x112186)[_0x224e('0x2c')](_0x476492);}};}function respondWithFilteredResult(_0x4442d6,_0x569098){return function(_0x3cc648){if(_0x3cc648){var _0x40957c=typeof _0x569098['offset']===_0x224e('0x2d')&&typeof _0x569098['limit']===_0x224e('0x2d');var _0x301b50=_0x3cc648['count'];var _0x23f260=_0x40957c?0x0:_0x569098[_0x224e('0x2e')];var _0x5b08dc=_0x40957c?_0x3cc648[_0x224e('0x2f')]:_0x569098[_0x224e('0x2e')]+_0x569098[_0x224e('0x30')];var _0x15cb7b;if(_0x5b08dc>=_0x301b50){_0x5b08dc=_0x301b50;_0x15cb7b=0xc8;}else{_0x15cb7b=0xce;}_0x4442d6[_0x224e('0x2a')](_0x15cb7b);return _0x4442d6['set']('Content-Range',_0x23f260+'-'+_0x5b08dc+'/'+_0x301b50)[_0x224e('0x2c')](_0x3cc648);}return null;};}function patchUpdates(_0x8dfb9d){return function(_0x2a2c3e){try{jsonpatch['apply'](_0x2a2c3e,_0x8dfb9d,!![]);}catch(_0x50dbb4){return BPromise[_0x224e('0x31')](_0x50dbb4);}return _0x2a2c3e[_0x224e('0x32')]();};}function saveUpdates(_0x3b9618,_0x1ff98d){return function(_0x182924){if(_0x182924){return _0x182924[_0x224e('0x33')](_0x3b9618)[_0x224e('0x20')](function(_0xeab5e6){return _0xeab5e6;});}return null;};}function removeEntity(_0x509f04,_0x4a9628){return function(_0x21f588){if(_0x21f588){return _0x21f588[_0x224e('0x34')]()[_0x224e('0x20')](function(){var _0x32be1b=_0x21f588[_0x224e('0x35')]({'plain':!![]});var _0x3dc510=_0x224e('0x36');return db[_0x224e('0x37')][_0x224e('0x34')]({'where':{'type':_0x3dc510,'resourceId':_0x32be1b['id']}})[_0x224e('0x20')](function(){return _0x21f588;});})['then'](function(){_0x509f04[_0x224e('0x2a')](0xcc)[_0x224e('0x2b')]();});}};}function handleEntityNotFound(_0x2413be,_0x416502){return function(_0x3729ee){if(!_0x3729ee){_0x2413be[_0x224e('0x29')](0x194);}return _0x3729ee;};}function handleError(_0x210b48,_0x2f0cc8){_0x2f0cc8=_0x2f0cc8||0x1f4;return function(_0x2719f0){logger[_0x224e('0x26')](_0x2719f0[_0x224e('0x38')]);if(_0x2719f0[_0x224e('0x39')]){delete _0x2719f0[_0x224e('0x39')];}_0x210b48[_0x224e('0x2a')](_0x2f0cc8)[_0x224e('0x3a')](_0x2719f0);};}exports['index']=function(_0x48ff6d,_0x56e3af){var _0x2fb917={'include':[{'model':db[_0x224e('0x3b')],'as':_0x224e('0x3c')}]},_0x5ccd98={},_0x3893a7={'count':0x0,'rows':[]};var _0x209f58=_['map'](db[_0x224e('0x3d')][_0x224e('0x3e')],function(_0x3b2eb5){return{'name':_0x3b2eb5[_0x224e('0x3f')],'type':_0x3b2eb5[_0x224e('0x40')]['key']};});_0x5ccd98[_0x224e('0x41')]=_[_0x224e('0x42')](_0x209f58,_0x224e('0x39'));_0x5ccd98['query']=_[_0x224e('0x43')](_0x48ff6d['query']);_0x5ccd98[_0x224e('0x44')]=_['intersection'](_0x5ccd98['model'],_0x5ccd98[_0x224e('0x45')]);_0x2fb917[_0x224e('0x46')]=_['intersection'](_0x5ccd98[_0x224e('0x41')],qs[_0x224e('0x47')](_0x48ff6d[_0x224e('0x45')]['fields']));_0x2fb917['attributes']=_0x2fb917['attributes'][_0x224e('0x48')]?_0x2fb917[_0x224e('0x46')]:_0x5ccd98['model'];if(!_0x48ff6d['query'][_0x224e('0x49')]('nolimit')){_0x2fb917[_0x224e('0x30')]=qs[_0x224e('0x30')](_0x48ff6d[_0x224e('0x45')][_0x224e('0x30')]);_0x2fb917[_0x224e('0x2e')]=qs[_0x224e('0x2e')](_0x48ff6d[_0x224e('0x45')][_0x224e('0x2e')]);}_0x2fb917[_0x224e('0x4a')]=qs[_0x224e('0x4b')](_0x48ff6d[_0x224e('0x45')][_0x224e('0x4b')]);_0x2fb917[_0x224e('0x4c')]=qs[_0x224e('0x44')](_[_0x224e('0x4d')](_0x48ff6d[_0x224e('0x45')],_0x5ccd98[_0x224e('0x44')]),_0x209f58);if(_0x48ff6d['query'][_0x224e('0x4e')]){_0x2fb917[_0x224e('0x4c')]=_['merge'](_0x2fb917[_0x224e('0x4c')],{'$or':_[_0x224e('0x42')](_0x209f58,function(_0x2e2db3){if(_0x2e2db3[_0x224e('0x40')]!==_0x224e('0x4f')){var _0x18feb9={};_0x18feb9[_0x2e2db3[_0x224e('0x39')]]={'$like':'%'+_0x48ff6d['query']['filter']+'%'};return _0x18feb9;}})});}_0x2fb917=_[_0x224e('0x50')]({},_0x2fb917,_0x48ff6d[_0x224e('0x51')]);var _0x430b37={'where':_0x2fb917[_0x224e('0x4c')]};return db[_0x224e('0x3d')]['count'](_0x430b37)[_0x224e('0x20')](function(_0x240541){_0x3893a7[_0x224e('0x2f')]=_0x240541;if(_0x48ff6d[_0x224e('0x45')]['includeAll']){_0x2fb917['include']=[{'all':!![]}];}return db[_0x224e('0x3d')][_0x224e('0x52')](_0x2fb917);})[_0x224e('0x20')](function(_0x2df630){_0x3893a7[_0x224e('0x53')]=_0x2df630;return _0x3893a7;})[_0x224e('0x20')](respondWithFilteredResult(_0x56e3af,_0x2fb917))['catch'](handleError(_0x56e3af,null));};exports[_0x224e('0x54')]=function(_0x959844,_0x4e1605){var _0x345566={'raw':![],'where':{'id':_0x959844[_0x224e('0x55')]['id']},'include':[{'model':db[_0x224e('0x3b')],'as':'mandatoryDispositionPause'}]},_0x5ac9e={};_0x5ac9e['model']=_['keys'](db['SmsAccount'][_0x224e('0x3e')]);_0x5ac9e[_0x224e('0x45')]=_[_0x224e('0x43')](_0x959844[_0x224e('0x45')]);_0x5ac9e['filters']=_['intersection'](_0x5ac9e[_0x224e('0x41')],_0x5ac9e['query']);_0x345566[_0x224e('0x46')]=_['intersection'](_0x5ac9e[_0x224e('0x41')],qs['fields'](_0x959844[_0x224e('0x45')]['fields']));_0x345566[_0x224e('0x46')]=_0x345566[_0x224e('0x46')][_0x224e('0x48')]?_0x345566[_0x224e('0x46')]:_0x5ac9e[_0x224e('0x41')];if(_0x959844[_0x224e('0x45')][_0x224e('0x56')]){_0x345566[_0x224e('0x57')]=[{'all':!![]}];}_0x345566=_['merge']({},_0x345566,_0x959844[_0x224e('0x51')]);return db[_0x224e('0x3d')][_0x224e('0x58')](_0x345566)[_0x224e('0x20')](handleEntityNotFound(_0x4e1605,null))[_0x224e('0x20')](respondWithResult(_0x4e1605,null))['catch'](handleError(_0x4e1605,null));};exports['create']=function(_0x5b10ad,_0x2d200e){return db[_0x224e('0x3d')]['create'](_0x5b10ad[_0x224e('0x59')],{})[_0x224e('0x20')](function(_0x58e254){var _0x64c534=_0x5b10ad[_0x224e('0x5a')][_0x224e('0x35')]({'plain':!![]});if(!_0x64c534)throw new Error(_0x224e('0x5b'));if(_0x64c534['role']===_0x224e('0x5a')){var _0x3848df=_0x58e254['get']({'plain':!![]});var _0x22be84='SmsAccounts';return db[_0x224e('0x5c')]['find']({'where':{'name':_0x22be84,'userProfileId':_0x64c534[_0x224e('0x5d')]},'raw':!![]})[_0x224e('0x20')](function(_0x4dc3be){if(_0x4dc3be&&_0x4dc3be['autoAssociation']===0x0){return db[_0x224e('0x37')]['create']({'name':_0x3848df[_0x224e('0x39')],'resourceId':_0x3848df['id'],'type':_0x4dc3be[_0x224e('0x39')],'sectionId':_0x4dc3be['id']},{})[_0x224e('0x20')](function(){return _0x58e254;});}else{return _0x58e254;}})[_0x224e('0x5e')](function(_0x4033b4){logger[_0x224e('0x26')](_0x224e('0x5f'),_0x4033b4);throw _0x4033b4;});}return _0x58e254;})['then'](respondWithResult(_0x2d200e,0xc9))['catch'](handleError(_0x2d200e,null));};exports[_0x224e('0x33')]=function(_0x434c81,_0x297772){if(_0x434c81[_0x224e('0x59')]['id']){delete _0x434c81['body']['id'];}return db[_0x224e('0x3d')][_0x224e('0x58')]({'where':{'id':_0x434c81['params']['id']},'include':[{'model':db['Pause'],'as':_0x224e('0x3c')}]})[_0x224e('0x20')](handleEntityNotFound(_0x297772,null))[_0x224e('0x20')](saveUpdates(_0x434c81['body'],null))['then'](respondWithResult(_0x297772,null))[_0x224e('0x5e')](handleError(_0x297772,null));};exports[_0x224e('0x34')]=function(_0x123299,_0x13c77b){return db[_0x224e('0x3d')][_0x224e('0x58')]({'where':{'id':_0x123299[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x13c77b,null))['then'](removeEntity(_0x13c77b,null))[_0x224e('0x5e')](handleError(_0x13c77b,null));};exports['describe']=function(_0x1743db,_0x53ee2c){return db[_0x224e('0x3d')][_0x224e('0x60')]()[_0x224e('0x20')](respondWithResult(_0x53ee2c,null))[_0x224e('0x5e')](handleError(_0x53ee2c,null));};exports[_0x224e('0x61')]=function(_0xa98d95,_0x1c848e,_0x4d1ac2){if(_0xa98d95[_0x224e('0x59')]['id']){delete _0xa98d95[_0x224e('0x59')]['id'];}return db[_0x224e('0x3d')][_0x224e('0x58')]({'where':{'id':_0xa98d95['params']['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x1c848e,null))['then'](function(_0x42b7e6){if(_0x42b7e6){_0xa98d95[_0x224e('0x59')][_0x224e('0x62')]=_0x42b7e6['id'];return db[_0x224e('0x63')][_0x224e('0x64')](_0xa98d95['body']);}})[_0x224e('0x20')](respondWithResult(_0x1c848e,null))[_0x224e('0x5e')](handleError(_0x1c848e,null));};exports[_0x224e('0x65')]=function(_0x3e2495,_0x564da0,_0x5e7e95){var _0x58bace={'raw':![],'where':{}};var _0x480347={};var _0x2bce24={'count':0x0,'rows':[]};return db[_0x224e('0x3d')][_0x224e('0x66')]({'where':{'id':_0x3e2495[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x564da0,null))[_0x224e('0x20')](function(_0x33761a){if(_0x33761a){_0x480347['model']=_[_0x224e('0x43')](db[_0x224e('0x63')][_0x224e('0x3e')]);_0x480347['query']=_['keys'](_0x3e2495[_0x224e('0x45')]);_0x480347[_0x224e('0x44')]=_[_0x224e('0x67')](_0x480347[_0x224e('0x41')],_0x480347['query']);_0x58bace[_0x224e('0x46')]=_['intersection'](_0x480347[_0x224e('0x41')],qs[_0x224e('0x47')](_0x3e2495[_0x224e('0x45')]['fields']));_0x58bace[_0x224e('0x46')]=_0x58bace[_0x224e('0x46')][_0x224e('0x48')]?_0x58bace['attributes']:_0x480347['model'];if(!_0x3e2495['query'][_0x224e('0x49')](_0x224e('0x68'))){_0x58bace[_0x224e('0x30')]=qs[_0x224e('0x30')](_0x3e2495['query'][_0x224e('0x30')]);_0x58bace[_0x224e('0x2e')]=qs[_0x224e('0x2e')](_0x3e2495[_0x224e('0x45')][_0x224e('0x2e')]);}_0x58bace[_0x224e('0x4a')]=qs[_0x224e('0x4b')](_0x3e2495[_0x224e('0x45')][_0x224e('0x4b')]);_0x58bace['where']=qs[_0x224e('0x44')](_[_0x224e('0x4d')](_0x3e2495[_0x224e('0x45')],_0x480347[_0x224e('0x44')]));_0x58bace[_0x224e('0x4c')]['SmsAccountId']=_0x33761a['id'];if(_0x3e2495[_0x224e('0x45')][_0x224e('0x4e')]){_0x58bace[_0x224e('0x4c')]=_[_0x224e('0x50')](_0x58bace[_0x224e('0x4c')],{'$or':_[_0x224e('0x42')](_0x58bace['attributes'],function(_0x35ab07){var _0x46ec86={};_0x46ec86[_0x35ab07]={'$like':'%'+_0x3e2495[_0x224e('0x45')][_0x224e('0x4e')]+'%'};return _0x46ec86;})});}_0x58bace=_[_0x224e('0x50')]({},_0x58bace,_0x3e2495['options']);return db['Disposition'][_0x224e('0x2f')]({'where':_0x58bace[_0x224e('0x4c')]})['then'](function(_0x28dd23){_0x2bce24[_0x224e('0x2f')]=_0x28dd23;if(_0x3e2495['query']['includeAll']){_0x58bace[_0x224e('0x57')]=[{'all':!![]}];}return db[_0x224e('0x63')][_0x224e('0x52')](_0x58bace);})[_0x224e('0x20')](function(_0x33c6f3){_0x2bce24[_0x224e('0x53')]=_0x33c6f3;return _0x2bce24;});}})[_0x224e('0x20')](respondWithFilteredResult(_0x564da0,_0x58bace))[_0x224e('0x5e')](handleError(_0x564da0,null));};exports[_0x224e('0x69')]=function(_0x5b80ba,_0x350bdf,_0x106d6e){return db[_0x224e('0x3d')][_0x224e('0x58')]({'where':{'id':_0x5b80ba[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x350bdf,null))[_0x224e('0x20')](function(_0x253a94){if(_0x253a94){return _0x253a94[_0x224e('0x69')](_0x5b80ba[_0x224e('0x45')][_0x224e('0x6a')]);}})[_0x224e('0x20')](respondWithStatusCode(_0x350bdf,null))[_0x224e('0x5e')](handleError(_0x350bdf,null));};exports[_0x224e('0x6b')]=function(_0x1a5d0e,_0x3b0fa2,_0x400833){if(_0x1a5d0e[_0x224e('0x59')]['id']){delete _0x1a5d0e[_0x224e('0x59')]['id'];}return db['SmsAccount'][_0x224e('0x58')]({'where':{'id':_0x1a5d0e['params']['id']}})['then'](handleEntityNotFound(_0x3b0fa2,null))[_0x224e('0x20')](function(_0x3079e1){if(_0x3079e1){_0x1a5d0e[_0x224e('0x59')][_0x224e('0x62')]=_0x3079e1['id'];return db[_0x224e('0x6c')][_0x224e('0x64')](_0x1a5d0e[_0x224e('0x59')]);}})[_0x224e('0x20')](respondWithResult(_0x3b0fa2,null))[_0x224e('0x5e')](handleError(_0x3b0fa2,null));};exports[_0x224e('0x6d')]=function(_0x30dfe3,_0x15e1fd,_0x31cc39){var _0x181926={'raw':![],'where':{}};var _0x42bbc3={};var _0x1bfa2b={'count':0x0,'rows':[]};return db[_0x224e('0x3d')][_0x224e('0x66')]({'where':{'id':_0x30dfe3['params']['id']}})['then'](handleEntityNotFound(_0x15e1fd,null))['then'](function(_0x150eb7){if(_0x150eb7){_0x42bbc3['model']=_[_0x224e('0x43')](db['CannedAnswer'][_0x224e('0x3e')]);_0x42bbc3['query']=_[_0x224e('0x43')](_0x30dfe3[_0x224e('0x45')]);_0x42bbc3[_0x224e('0x44')]=_[_0x224e('0x67')](_0x42bbc3[_0x224e('0x41')],_0x42bbc3[_0x224e('0x45')]);_0x181926['attributes']=_[_0x224e('0x67')](_0x42bbc3[_0x224e('0x41')],qs[_0x224e('0x47')](_0x30dfe3[_0x224e('0x45')][_0x224e('0x47')]));_0x181926['attributes']=_0x181926[_0x224e('0x46')][_0x224e('0x48')]?_0x181926[_0x224e('0x46')]:_0x42bbc3[_0x224e('0x41')];if(!_0x30dfe3[_0x224e('0x45')][_0x224e('0x49')](_0x224e('0x68'))){_0x181926[_0x224e('0x30')]=qs[_0x224e('0x30')](_0x30dfe3[_0x224e('0x45')][_0x224e('0x30')]);_0x181926['offset']=qs[_0x224e('0x2e')](_0x30dfe3[_0x224e('0x45')][_0x224e('0x2e')]);}_0x181926['order']=qs[_0x224e('0x4b')](_0x30dfe3[_0x224e('0x45')][_0x224e('0x4b')]);_0x181926['where']=qs['filters'](_['pick'](_0x30dfe3['query'],_0x42bbc3[_0x224e('0x44')]));_0x181926[_0x224e('0x4c')]['SmsAccountId']=_0x150eb7['id'];if(_0x30dfe3[_0x224e('0x45')][_0x224e('0x4e')]){_0x181926['where']=_[_0x224e('0x50')](_0x181926[_0x224e('0x4c')],{'$or':_[_0x224e('0x42')](_0x181926[_0x224e('0x46')],function(_0x906334){var _0x3840e7={};_0x3840e7[_0x906334]={'$like':'%'+_0x30dfe3[_0x224e('0x45')][_0x224e('0x4e')]+'%'};return _0x3840e7;})});}_0x181926=_['merge']({},_0x181926,_0x30dfe3[_0x224e('0x51')]);return db[_0x224e('0x6c')]['count']({'where':_0x181926[_0x224e('0x4c')]})['then'](function(_0x4cc492){_0x1bfa2b[_0x224e('0x2f')]=_0x4cc492;if(_0x30dfe3['query'][_0x224e('0x56')]){_0x181926[_0x224e('0x57')]=[{'all':!![]}];}return db[_0x224e('0x6c')]['findAll'](_0x181926);})[_0x224e('0x20')](function(_0x2d318f){_0x1bfa2b[_0x224e('0x53')]=_0x2d318f;return _0x1bfa2b;});}})[_0x224e('0x20')](respondWithFilteredResult(_0x15e1fd,_0x181926))[_0x224e('0x5e')](handleError(_0x15e1fd,null));};exports[_0x224e('0x6e')]=function(_0x5d4c8c,_0xcc6970,_0x230fd0){return db['SmsAccount'][_0x224e('0x58')]({'where':{'id':_0x5d4c8c[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0xcc6970,null))[_0x224e('0x20')](function(_0x4c76f3){if(_0x4c76f3){return _0x4c76f3[_0x224e('0x6e')](_0x5d4c8c[_0x224e('0x45')][_0x224e('0x6a')]);}})[_0x224e('0x20')](respondWithStatusCode(_0xcc6970,null))[_0x224e('0x5e')](handleError(_0xcc6970,null));};exports[_0x224e('0x6f')]=function(_0x1681d2,_0x222246,_0x5211d4){var _0x3b5147={'channel':'sms'};var _0x3ca000=[];var _0x80a484=[];var _0x462d0d={};return db['SmsAccount'][_0x224e('0x58')]({'where':{'id':_0x1681d2['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x224e('0x70')}]})[_0x224e('0x20')](handleEntityNotFound(_0x222246,null))[_0x224e('0x20')](function(_0x41ac37){_0x3b5147[_0x224e('0x71')]=_0x41ac37;_0x3b5147[_0x224e('0x72')]=_['orderBy'](_0x41ac37[_0x224e('0x70')],[_0x224e('0x73')],[_0x224e('0x74')]);if(_0x3b5147[_0x224e('0x71')][_0x224e('0x70')]){delete _0x3b5147[_0x224e('0x71')][_0x224e('0x70')];}return db['CmContact'][_0x224e('0x60')]();})[_0x224e('0x20')](function(_0xddfc24){if(!_0xddfc24){throw new db['Sequelize'][(_0x224e('0x75'))]('no\x20available\x20attributes');}_0x3ca000=_[_0x224e('0x76')](_['keys'](_0xddfc24),[_0x224e('0x77'),'updatedAt']);_0x80a484=_[_0x224e('0x76')](_[_0x224e('0x43')](_0xddfc24),[_0x224e('0x77'),_0x224e('0x78'),_0x224e('0x79'),_0x224e('0x7a')]);_0x3b5147['body']={'mapKey':_0x224e('0x7b')};if(_0x3b5147[_0x224e('0x71')]['type']){switch(_0x3b5147[_0x224e('0x71')][_0x224e('0x40')]){case _0x224e('0x7c'):_0x3b5147['body'][_0x224e('0x7d')]=_0x1681d2['body'][_0x224e('0x7e')];_0x3b5147['body']['body']=_0x1681d2['body'][_0x224e('0x7f')];_0x3b5147[_0x224e('0x59')][_0x224e('0x80')]=_0x1681d2['body']['MessageSid'];break;case _0x224e('0x81'):_0x3b5147[_0x224e('0x59')][_0x224e('0x7d')]='+'+_0x1681d2[_0x224e('0x59')][_0x224e('0x82')];_0x3b5147['body']['body']=_0x1681d2[_0x224e('0x59')][_0x224e('0x83')];break;case _0x224e('0x84'):_0x3b5147['body'][_0x224e('0x7d')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x7d')];_0x3b5147[_0x224e('0x59')][_0x224e('0x59')]=_0x1681d2['body'][_0x224e('0x28')];break;case _0x224e('0x85'):_0x3b5147[_0x224e('0x59')][_0x224e('0x7d')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x7d')];_0x3b5147[_0x224e('0x59')][_0x224e('0x59')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x59')];_0x3b5147[_0x224e('0x59')][_0x224e('0x80')]=_0x1681d2[_0x224e('0x59')]['message_id'];break;case _0x224e('0x86'):_0x3b5147[_0x224e('0x59')]['from']=_0x1681d2[_0x224e('0x59')][_0x224e('0x7e')];_0x3b5147[_0x224e('0x59')]['body']=_0x1681d2[_0x224e('0x59')][_0x224e('0x87')];_0x3b5147[_0x224e('0x59')]['messageId']=_0x1681d2['body'][_0x224e('0x88')];break;case _0x224e('0x89'):_0x3b5147[_0x224e('0x59')][_0x224e('0x7d')]='+'+_0x1681d2['body'][_0x224e('0x8a')][0x0]['from'];_0x3b5147[_0x224e('0x59')][_0x224e('0x59')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x8a')][0x0]['text'];_0x3b5147[_0x224e('0x59')][_0x224e('0x80')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x8a')][0x0][_0x224e('0x80')];break;case _0x224e('0x8b'):_0x3b5147['body'][_0x224e('0x7d')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x8c')];_0x3b5147[_0x224e('0x59')][_0x224e('0x59')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x8d')][_0x224e('0x28')];break;case _0x224e('0x8e'):_0x3b5147[_0x224e('0x59')]['from']=_0x1681d2[_0x224e('0x59')][_0x224e('0x8f')];_0x3b5147['body'][_0x224e('0x59')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x83')];_0x3b5147[_0x224e('0x59')][_0x224e('0x80')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x90')];break;case _0x224e('0x91'):_0x3b5147[_0x224e('0x59')][_0x224e('0x80')]=_0x1681d2['body'][0x0][_0x224e('0x28')]['id'];_0x3b5147[_0x224e('0x59')]['from']=_0x1681d2[_0x224e('0x59')][0x0][_0x224e('0x28')][_0x224e('0x7d')];_0x3b5147[_0x224e('0x59')][_0x224e('0x59')]=_0x1681d2[_0x224e('0x59')][0x0][_0x224e('0x28')][_0x224e('0x83')];break;case _0x224e('0x92'):_0x3b5147[_0x224e('0x59')][_0x224e('0x7d')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x7d')];_0x3b5147[_0x224e('0x59')][_0x224e('0x59')]=_0x1681d2[_0x224e('0x59')]['message'];_0x3b5147[_0x224e('0x59')][_0x224e('0x80')]=_0x1681d2[_0x224e('0x59')][_0x224e('0x93')];break;}}if(_0x3b5147[_0x224e('0x59')]['id']){delete _0x3b5147['body']['id'];}if(_[_0x224e('0x94')](_0x3b5147['body'][_0x224e('0x7d')])){throw new db['Sequelize']['ValidationError'](_0x224e('0x95'));}if(_[_0x224e('0x94')](_0x3b5147[_0x224e('0x59')][_0x224e('0x59')])||_0x3b5147['body'][_0x224e('0x59')]===''){throw new db[(_0x224e('0x96'))][(_0x224e('0x75'))](_0x224e('0x97'));}if(_['isNil'](_0x3b5147[_0x224e('0x59')][_0x224e('0x98')])){throw new db[(_0x224e('0x96'))][(_0x224e('0x75'))](_0x224e('0x99')+_0x80a484);}if(!_[_0x224e('0x9a')](_0x80a484,_0x3b5147[_0x224e('0x59')]['mapKey'])){throw new db[(_0x224e('0x96'))]['ValidationError'](_0x224e('0x9b')+_0x80a484);}_0x462d0d[_0x3b5147['body'][_0x224e('0x98')]]=_0x3b5147[_0x224e('0x59')]['from'];return db['CmList'][_0x224e('0x58')]({'where':{'id':_0x3b5147[_0x224e('0x71')][_0x224e('0x7a')]},'include':[{'model':db[_0x224e('0x9c')],'as':'Contacts','where':_0x462d0d,'limit':0x1,'order':[[_0x224e('0x78'),'DESC']]}]});})[_0x224e('0x20')](handleEntityNotFound(_0x222246,null))['then'](function(_0x2e1409){if(_0x2e1409){_0x3b5147[_0x224e('0x9d')]=_[_0x224e('0x9e')](_0x2e1409,[_0x224e('0x9f')]);if(_0x2e1409['Contacts'][_0x224e('0x48')]){return _0x2e1409['Contacts'][0x0];}var _0x3b98c8=_['defaults'](_0x3b5147[_0x224e('0x59')],{'firstName':_0x3b5147[_0x224e('0x59')]['from'],'ListId':_0x2e1409['id']});_0x3b98c8[_0x3b5147['body']['mapKey']]=_0x3b5147[_0x224e('0x59')]['from'];return db[_0x224e('0x9c')]['create'](_0x3b98c8,{'fields':_0x3ca000,'raw':!![]});}})[_0x224e('0x20')](handleEntityNotFound(_0x222246,null))[_0x224e('0x20')](function(_0x4a27b6){if(_0x4a27b6){_0x3b5147[_0x224e('0xa0')]=_0x4a27b6;var _0x26c4b9={'ContactId':_0x4a27b6['id'],'phone':_0x3b5147[_0x224e('0x59')][_0x224e('0x7d')],'SmsAccountId':_0x1681d2[_0x224e('0x55')]['id']};var _0x5dbcb1={'ContactId':_0x4a27b6['id'],'SmsAccountId':_0x1681d2[_0x224e('0x55')]['id'],'closed':![]};return db[_0x224e('0xa1')][_0x224e('0x58')]({'where':_0x5dbcb1})[_0x224e('0x20')](function(_0x153257){if(_0x153257){return[_0x153257,![]];}return db[_0x224e('0xa1')][_0x224e('0x64')](_0x26c4b9)[_0x224e('0x20')](function(_0x821c88){return[_0x821c88,!![]];});});}})['spread'](function(_0x3968b0,_0x1a197d){_0x3b5147[_0x224e('0xa2')]=_0x3968b0[_0x224e('0x35')]({'plain':!![]});_0x3b5147['interaction']['created']=![];if(_0x1a197d){if(_0x3b5147['account'][_0x224e('0xa3')]){_0x3b5147['applications']['push']({'id':0x0,'priority':_0x3b5147[_0x224e('0x72')][_0x224e('0x48')]+0x1,'app':_0x224e('0xa4'),'appdata':_0x224e('0xa5'),'interval':_0x224e('0xa6')});}_0x3b5147[_0x224e('0xa2')][_0x224e('0xa7')]=!![];}return db[_0x224e('0xa8')][_0x224e('0x64')]({'phone':_0x3b5147['body']['from'],'messageId':_0x3b5147['body'][_0x224e('0x80')],'body':_0x3b5147['body']['body'],'SmsAccountId':_0x1681d2[_0x224e('0x55')]['id'],'SmsInteractionId':_0x3968b0['id'],'direction':'in','ContactId':_0x3968b0[_0x224e('0xa9')],'AttachmentId':_0x3b5147[_0x224e('0x59')][_0x224e('0xaa')]});})[_0x224e('0x20')](function(_0x4581b2){_0x3b5147['message']=_0x4581b2;if(_0x3b5147[_0x224e('0xa2')]['UserId']){return db[_0x224e('0xab')][_0x224e('0x58')]({'attributes':['id',_0x224e('0x39')],'where':{'id':_0x3b5147[_0x224e('0xa2')][_0x224e('0xac')]}})[_0x224e('0x20')](function(_0x16987d){if(_0x16987d){_0x3b5147[_0x224e('0x72')][_0x224e('0xad')]({'id':0x0,'priority':0x0,'app':_0x224e('0xae'),'appdata':_0x16987d[_0x224e('0x39')]+','+(_0x3b5147[_0x224e('0x71')][_0x224e('0xaf')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x3b5147);});}return respondWithRpcPromise(_0x224e('0xb0'),_0x224e('0xb1'),_0x3b5147);})['then'](function(_0x3e30cc){if(_0x3e30cc){var _0x5b03e7=0xc8;var _0xfd61ac=_0x224e('0xb2');logger[_0x224e('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfd61ac,_0x5b03e7,'entity\x20found');logger[_0x224e('0x24')](_0x224e('0xb3'),_0xfd61ac,_0x5b03e7,_0x224e('0xb4'),JSON['stringify'](_0x3e30cc));if(_0x3b5147[_0x224e('0x71')][_0x224e('0x40')]===_0x224e('0x7c')){return _0x222246[_0x224e('0x2a')](_0x5b03e7)['set'](_0x224e('0xb5'),'text/xml')[_0x224e('0x3a')](_0x224e('0xb6'));}else{return _0x222246[_0x224e('0x2a')](_0x5b03e7)[_0x224e('0x2c')](_0x3e30cc);}}})['catch'](handleError(_0x222246,null));};exports['addApplications']=function(_0x5ef624,_0x1bb1b4,_0x23660f){return db[_0x224e('0x3d')]['findOne']({'where':{'id':_0x5ef624[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x1bb1b4,null))['then'](function(_0x359438){if(_0x359438){return db[_0x224e('0xb7')][_0x224e('0xb8')](function(_0x26d40e){return db['SmsApplication'][_0x224e('0x34')]({'where':{'SmsAccountId':_0x5ef624['params']['id']},'transaction':_0x26d40e})[_0x224e('0x20')](function(_0x3049bd){var _0x304af1=_['map'](_0x5ef624[_0x224e('0x59')],function(_0xd05bb4){_0xd05bb4['SmsAccountId']=_0x5ef624[_0x224e('0x55')]['id'];return _0xd05bb4;});return db['SmsApplication']['bulkCreate'](_0x304af1,{'transaction':_0x26d40e});});})[_0x224e('0x20')](function(){return db[_0x224e('0xb9')]['findAndCountAll']({'where':{'SmsAccountId':_0x5ef624[_0x224e('0x55')]['id']},'order':'priority'});});}})[_0x224e('0x20')](respondWithResult(_0x1bb1b4,null))[_0x224e('0x5e')](handleError(_0x1bb1b4,null));};exports['getApplications']=function(_0x539b57,_0x6a8a0,_0x26d324){var _0x52fc34={};var _0x207dfb={};var _0x22b4a9;var _0x2cbbe0;return db['SmsAccount']['findOne']({'where':{'id':_0x539b57[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x6a8a0,null))['then'](function(_0x3008d0){if(_0x3008d0){_0x22b4a9=_0x3008d0;_0x207dfb[_0x224e('0x41')]=_[_0x224e('0x43')](db[_0x224e('0xb9')][_0x224e('0x3e')]);_0x207dfb[_0x224e('0x45')]=_[_0x224e('0x43')](_0x539b57[_0x224e('0x45')]);_0x207dfb[_0x224e('0x44')]=_['intersection'](_0x207dfb[_0x224e('0x41')],_0x207dfb['query']);_0x52fc34[_0x224e('0x46')]=_['intersection'](_0x207dfb['model'],qs['fields'](_0x539b57['query'][_0x224e('0x47')]));_0x52fc34[_0x224e('0x46')]=_0x52fc34['attributes'][_0x224e('0x48')]?_0x52fc34['attributes']:_0x207dfb[_0x224e('0x41')];_0x52fc34[_0x224e('0x4a')]=qs['sort'](_0x539b57[_0x224e('0x45')][_0x224e('0x4b')]);_0x52fc34[_0x224e('0x4c')]=qs[_0x224e('0x44')](_['pick'](_0x539b57[_0x224e('0x45')],_0x207dfb[_0x224e('0x44')]));if(_0x539b57[_0x224e('0x45')][_0x224e('0x4e')]){_0x52fc34[_0x224e('0x4c')]=_['merge'](_0x52fc34['where'],{'$or':_[_0x224e('0x42')](_0x52fc34[_0x224e('0x46')],function(_0x143668){var _0x4fab94={};_0x4fab94[_0x143668]={'$like':'%'+_0x539b57[_0x224e('0x45')][_0x224e('0x4e')]+'%'};return _0x4fab94;})});}_0x52fc34=_['merge']({},_0x52fc34,_0x539b57[_0x224e('0x51')]);return _0x22b4a9['getApplications'](_0x52fc34);}})['then'](function(_0x16b6cb){if(_0x16b6cb){_0x2cbbe0=_0x16b6cb['length'];if(!_0x539b57[_0x224e('0x45')]['hasOwnProperty'](_0x224e('0x68'))){_0x52fc34['limit']=qs['limit'](_0x539b57[_0x224e('0x45')][_0x224e('0x30')]);_0x52fc34[_0x224e('0x2e')]=qs['offset'](_0x539b57['query'][_0x224e('0x2e')]);}return _0x22b4a9[_0x224e('0xba')](_0x52fc34);}})[_0x224e('0x20')](function(_0x425db9){if(_0x425db9){return _0x425db9?{'count':_0x2cbbe0,'rows':_0x425db9}:null;}})[_0x224e('0x20')](respondWithResult(_0x6a8a0,null))[_0x224e('0x5e')](handleError(_0x6a8a0,null));};exports[_0x224e('0xbb')]=function(_0x1a545d,_0x3e77f2,_0x16c7e1){var _0x46e2e9={'raw':![],'where':{}};var _0x50ff8c={};var _0x226496={'count':0x0,'rows':[]};return db[_0x224e('0x3d')][_0x224e('0x66')]({'where':{'id':_0x1a545d[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x3e77f2,null))[_0x224e('0x20')](function(_0x2dd214){if(_0x2dd214){_0x50ff8c['model']=_[_0x224e('0x43')](db['SmsInteraction'][_0x224e('0x3e')]);_0x50ff8c[_0x224e('0x45')]=_[_0x224e('0x43')](_0x1a545d['query']);_0x50ff8c[_0x224e('0x44')]=_[_0x224e('0x67')](_0x50ff8c[_0x224e('0x41')],_0x50ff8c[_0x224e('0x45')]);_0x46e2e9[_0x224e('0x46')]=_['intersection'](_0x50ff8c['model'],qs[_0x224e('0x47')](_0x1a545d[_0x224e('0x45')][_0x224e('0x47')]));_0x46e2e9['attributes']=_0x46e2e9['attributes'][_0x224e('0x48')]?_0x46e2e9[_0x224e('0x46')]:_0x50ff8c[_0x224e('0x41')];if(!_0x1a545d[_0x224e('0x45')][_0x224e('0x49')](_0x224e('0x68'))){_0x46e2e9[_0x224e('0x30')]=qs[_0x224e('0x30')](_0x1a545d['query'][_0x224e('0x30')]);_0x46e2e9[_0x224e('0x2e')]=qs['offset'](_0x1a545d[_0x224e('0x45')][_0x224e('0x2e')]);}_0x46e2e9[_0x224e('0x4a')]=qs[_0x224e('0x4b')](_0x1a545d[_0x224e('0x45')]['sort']);_0x46e2e9[_0x224e('0x4c')]=qs['filters'](_[_0x224e('0x4d')](_0x1a545d[_0x224e('0x45')],_0x50ff8c[_0x224e('0x44')]));_0x46e2e9[_0x224e('0x4c')][_0x224e('0x62')]=_0x2dd214['id'];if(_0x1a545d[_0x224e('0x45')][_0x224e('0x4e')]){_0x46e2e9[_0x224e('0x4c')]=_[_0x224e('0x50')](_0x46e2e9[_0x224e('0x4c')],{'$or':_['map'](_0x46e2e9[_0x224e('0x46')],function(_0x3795d0){var _0xf15668={};_0xf15668[_0x3795d0]={'$like':'%'+_0x1a545d[_0x224e('0x45')][_0x224e('0x4e')]+'%'};return _0xf15668;})});}_0x46e2e9=_['merge']({},_0x46e2e9,_0x1a545d[_0x224e('0x51')]);return db[_0x224e('0xa1')]['count']({'where':_0x46e2e9['where']})[_0x224e('0x20')](function(_0x4775f8){_0x226496[_0x224e('0x2f')]=_0x4775f8;if(_0x1a545d[_0x224e('0x45')]['includeAll']){_0x46e2e9[_0x224e('0x57')]=[{'model':db[_0x224e('0x9c')],'as':'Contact','required':![]},{'model':db[_0x224e('0xab')],'as':_0x224e('0xbc'),'attributes':[_0x224e('0x39'),'fullname',_0x224e('0xbd')],'required':![]},{'model':db[_0x224e('0xbe')],'as':_0x224e('0xbf'),'attributes':['id',_0x224e('0x39'),_0x224e('0xc0')],'where':_0x1a545d[_0x224e('0x45')][_0x224e('0xc1')]?{'id':_0x1a545d[_0x224e('0x45')][_0x224e('0xc1')]}:undefined,'required':_0x1a545d[_0x224e('0x45')]['tag']?!![]:![]}];}return db[_0x224e('0xa1')]['findAll'](_0x46e2e9);})[_0x224e('0x20')](function(_0x22015e){_0x226496['rows']=_0x22015e;return _0x226496;});}})[_0x224e('0x20')](respondWithFilteredResult(_0x3e77f2,_0x46e2e9))[_0x224e('0x5e')](handleError(_0x3e77f2,null));};exports[_0x224e('0x3a')]=function(_0xdd3741,_0x2bd751,_0xb155d7){var _0x148bfa,_0x2d6b4d,_0x2fe019;if(_[_0x224e('0x94')](_0xdd3741[_0x224e('0x59')][_0x224e('0x59')])||_0xdd3741[_0x224e('0x59')][_0x224e('0x59')]===''){throw new db[(_0x224e('0x96'))][(_0x224e('0x75'))](_0x224e('0x97'));}if(_[_0x224e('0x94')](_0xdd3741[_0x224e('0x59')]['to'])){throw new db[(_0x224e('0x96'))][(_0x224e('0x75'))](_0x224e('0xc2'));}_0x148bfa=_0xdd3741['body']['to'];return db[_0x224e('0x3d')][_0x224e('0x58')]({'where':{'id':_0xdd3741[_0x224e('0x55')]['id']},'include':[{'model':db[_0x224e('0xc3')],'as':_0x224e('0xc4'),'include':[{'model':db[_0x224e('0x9c')],'as':_0x224e('0x9f'),'where':{'mobile':_0x148bfa},'limit':0x1,'order':[['updatedAt',_0x224e('0xc5')]]}]}]})['then'](handleEntityNotFound(_0x2bd751,null))[_0x224e('0x20')](function(_0x3ba72b){if(_0x3ba72b&&_0x3ba72b['List']){_0x2d6b4d=_0x3ba72b[_0x224e('0x35')]({'plain':!![]});if(_0x2d6b4d[_0x224e('0xc4')]&&_0x2d6b4d[_0x224e('0xc4')][_0x224e('0x9f')][_0x224e('0x48')]){return _0x2d6b4d[_0x224e('0xc4')][_0x224e('0x9f')][0x0];}return db[_0x224e('0x9c')][_0x224e('0x64')](_[_0x224e('0xc6')](_0xdd3741['body'],{'firstName':_0x148bfa,'mobile':_0x148bfa,'phone':_0x148bfa,'ListId':_0x2d6b4d[_0x224e('0x7a')]}));}})[_0x224e('0x20')](handleEntityNotFound(_0x2bd751,null))[_0x224e('0x20')](function(_0x4d5236){if(_0x4d5236){_0x2fe019=_0x4d5236;return db['SmsInteraction'][_0x224e('0x58')]({'where':{'ContactId':_0x2fe019['id'],'closed':![],'SmsAccountId':_0x2d6b4d['id']}})[_0x224e('0x20')](function(_0x3476f2){if(_0x3476f2){return[_0x3476f2,![]];}return db[_0x224e('0xa1')][_0x224e('0x64')]({'UserId':_0xdd3741[_0x224e('0x5a')]['id'],'ContactId':_0x2fe019['id'],'SmsAccountId':_0x2d6b4d['id'],'phone':_0x148bfa,'firstMsgDirection':_0x224e('0xc7'),'Messages':[_['merge'](_0xdd3741['body'],{'read':![],'body':_0xdd3741['body'][_0x224e('0x59')],'phone':_0x148bfa,'SmsAccountId':_0x2d6b4d['id'],'UserId':_0xdd3741[_0x224e('0x5a')]['id'],'ContactId':_0x2fe019['id']})]},{'include':[{'model':db[_0x224e('0xa8')],'as':_0x224e('0xc8')}]})['then'](function(_0x417faf){return[_0x417faf,!![]];});});}})[_0x224e('0xc9')](function(_0x3ccfa6,_0x20488e){if(_0x20488e){return _0x3ccfa6;}return db[_0x224e('0xa8')][_0x224e('0x64')](_[_0x224e('0x50')](_0xdd3741[_0x224e('0x59')],{'read':![],'body':_0xdd3741[_0x224e('0x59')][_0x224e('0x59')],'phone':_0x148bfa,'SmsAccountId':_0x2d6b4d['id'],'SmsInteractionId':_0x3ccfa6['id'],'UserId':_0xdd3741[_0x224e('0x5a')]['id'],'ContactId':_0x2fe019['id']}))[_0x224e('0x20')](function(_0x4e9114){_0x3ccfa6[_0x224e('0xca')]['Messages']=[];_0x3ccfa6[_0x224e('0xca')][_0x224e('0xc8')][_0x224e('0xcb')](_0x4e9114['dataValues']);return _0x3ccfa6;});})[_0x224e('0x20')](respondWithResult(_0x2bd751,null))['catch'](handleError(_0x2bd751,null));};exports[_0x224e('0x2a')]=function(_0x3d49d9,_0x550b3e,_0x37789a){if(_0x3d49d9['body']['id']){delete _0x3d49d9['body']['id'];}var _0x415a98,_0x289be8,_0x54823f;return db[_0x224e('0x3d')][_0x224e('0x58')]({'where':{'id':_0x3d49d9[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x550b3e,null))[_0x224e('0x20')](function(_0x51878e){if(_0x51878e){_0x54823f=_0x51878e;logger[_0x224e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x224e('0x2a'),_0x224e('0xcc'),_0x51878e[_0x224e('0x40')],util[_0x224e('0xcd')](_0x3d49d9[_0x224e('0x59')],{'showHidden':![],'depth':null}));switch(_0x51878e[_0x224e('0x40')]){case'skebby':if(_0x3d49d9['body'][_0x224e('0xce')]&&_0x3d49d9[_0x224e('0x59')]['status']){_0x289be8=_0x3d49d9[_0x224e('0x59')]['status'];return db['SmsMessage'][_0x224e('0x58')]({'where':{'messageId':_0x3d49d9['body'][_0x224e('0xce')]}});}break;case _0x224e('0x84'):if(_0x3d49d9['body'][_0x224e('0xcf')]&&_0x3d49d9[_0x224e('0x59')][_0x224e('0xd0')]){_0x289be8=_0x3d49d9[_0x224e('0x59')][_0x224e('0xd0')];return db[_0x224e('0xa8')][_0x224e('0x58')]({'where':{'messageId':_0x3d49d9['body'][_0x224e('0xcf')]}});}break;case _0x224e('0x85'):if(_0x3d49d9[_0x224e('0x59')][_0x224e('0xd1')]&&_0x3d49d9[_0x224e('0x59')][_0x224e('0xd2')]){_0x289be8=_0x3d49d9['body']['status_code'];return db[_0x224e('0xa8')][_0x224e('0x58')]({'where':{'messageId':_0x3d49d9[_0x224e('0x59')][_0x224e('0xd1')]}});}break;case'infobip':var _0x2eca29=_0x3d49d9[_0x224e('0x59')]['results'][0x0];if(_0x2eca29[_0x224e('0x80')]&&_0x2eca29[_0x224e('0x2a')]['groupName']===_0x224e('0xd3')){_0x289be8=_0x2eca29[_0x224e('0x2a')][_0x224e('0xd4')];return db[_0x224e('0xa8')][_0x224e('0x58')]({'where':{'messageId':_0x2eca29['messageId']}});}break;case'clickatell':if(_0x3d49d9[_0x224e('0x59')][_0x224e('0x80')]&&_0x3d49d9[_0x224e('0x59')]['status']){_0x289be8=_0x3d49d9[_0x224e('0x59')][_0x224e('0x2a')];return db[_0x224e('0xa8')][_0x224e('0x58')]({'where':{'messageId':_0x3d49d9[_0x224e('0x59')]['messageId']}});}break;case _0x224e('0x91'):if(_0x3d49d9[_0x224e('0x59')][0x0]['message']['id']){_0x289be8=_0x3d49d9[_0x224e('0x59')][0x0][_0x224e('0x40')];return db[_0x224e('0xa8')]['find']({'where':{'messageId':_0x3d49d9[_0x224e('0x59')][0x0][_0x224e('0x28')]['id']}});}break;case _0x224e('0x92'):if(_0x3d49d9[_0x224e('0x59')][_0x224e('0xd5')]&&_0x3d49d9['body'][_0x224e('0x2a')]){_0x289be8=_0x3d49d9['body'][_0x224e('0x2a')];return db['SmsMessage'][_0x224e('0x58')]({'where':{'messageId':_0x3d49d9[_0x224e('0x59')][_0x224e('0xd5')]}});}break;}}})[_0x224e('0x20')](handleEntityNotFound(_0x550b3e,null))[_0x224e('0x20')](function(_0x4f93e5){if(_0x4f93e5){_0x415a98=_0x4f93e5;switch(_0x54823f[_0x224e('0x40')]){case _0x224e('0x81'):if(_0x289be8===_0x224e('0xd3')){return _0x415a98[_0x224e('0x33')]({'read':!![]});}else{logger[_0x224e('0x26')](_0x224e('0xd6'),_0x224e('0x2a'),_0x224e('0x81'),util[_0x224e('0xcd')](_0x3d49d9[_0x224e('0x59')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x289be8==='1'){return _0x415a98[_0x224e('0x33')]({'read':!![]});}else{logger[_0x224e('0x26')](_0x224e('0xd6'),_0x224e('0x2a'),_0x224e('0x81'),util['inspect'](_0x3d49d9[_0x224e('0x59')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3d49d9[_0x224e('0x59')][_0x224e('0xd7')]&&_0x289be8>=0xc8&&_0x289be8<=0xce){return _0x415a98[_0x224e('0x33')]({'read':!![]});}else{logger[_0x224e('0x26')](_0x224e('0xd6'),_0x224e('0x2a'),'clicksend',util[_0x224e('0xcd')](_0x3d49d9[_0x224e('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x469921=_0x3d49d9[_0x224e('0x59')][_0x224e('0x8a')][0x0];if(_0x469921[_0x224e('0x2a')]['groupName']===_0x224e('0xd3')){return _0x415a98[_0x224e('0x33')]({'read':!![]});}else{logger['error'](_0x224e('0xd6'),_0x224e('0x2a'),_0x224e('0x89'),util[_0x224e('0xcd')](_0x3d49d9[_0x224e('0x59')],{'showHidden':![],'depth':null}));}break;case _0x224e('0x8e'):if(_0x289be8==_0x224e('0xd8')||_0x289be8=='RECEIVED_BY_RECIPIENT'){return _0x415a98[_0x224e('0x33')]({'read':!![]});}else{logger[_0x224e('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x224e('0x2a'),'clickatell',util['inspect'](_0x3d49d9[_0x224e('0x59')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x289be8==_0x224e('0xd9')){return _0x415a98[_0x224e('0x33')]({'read':!![]});}else{logger['error'](_0x224e('0xd6'),_0x224e('0x2a'),_0x224e('0x91'),util[_0x224e('0xcd')](_0x3d49d9['body'],{'showHidden':![],'depth':null}));}break;case _0x224e('0x92'):if(_0x289be8===_0x224e('0xda')||_0x289be8===_0x224e('0xdb')){return _0x415a98[_0x224e('0x33')]({'read':!![]});}else{logger[_0x224e('0x26')](_0x224e('0xd6'),'status','intelepeer',util[_0x224e('0xcd')](_0x3d49d9[_0x224e('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x415a98;}})[_0x224e('0x20')](respondWithResult(_0x550b3e,null))['catch'](handleError(_0x550b3e,null));};exports[_0x224e('0xdc')]=function(_0x3144ef,_0x51714d,_0x5bf33c){var _0x3fdfa4,_0x1019ca,_0x1f9365;return db[_0x224e('0x3d')][_0x224e('0x58')]({'where':{'id':_0x3144ef[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x51714d,null))[_0x224e('0x20')](function(_0x26dc44){if(_0x26dc44){_0x1f9365=_0x26dc44;logger[_0x224e('0x24')](_0x224e('0xd6'),_0x224e('0x2a'),'received\x20delivery\x20report\x20from',_0x26dc44['type'],util[_0x224e('0xcd')](_0x3144ef[_0x224e('0x45')],{'showHidden':![],'depth':null}));switch(_0x26dc44[_0x224e('0x40')]){case _0x224e('0x8b'):if(_0x3144ef[_0x224e('0x45')]['message-id']&&_0x3144ef['query'][_0x224e('0xdd')]){_0x1019ca=_0x3144ef[_0x224e('0x45')][_0x224e('0xdd')];return db[_0x224e('0xa8')][_0x224e('0x58')]({'where':{'messageId':_0x3144ef[_0x224e('0x45')][_0x224e('0xde')]}});}break;}}})[_0x224e('0x20')](handleEntityNotFound(_0x51714d,null))['then'](function(_0xbc240b){if(_0xbc240b){_0x3fdfa4=_0xbc240b;switch(_0x1f9365[_0x224e('0x40')]){case _0x224e('0x8b'):if(_0x1019ca==='2'||_0x1019ca==='6'){return _0x3fdfa4['update']({'read':!![]});}else{logger[_0x224e('0x26')](_0x224e('0xd6'),'status','csc',util[_0x224e('0xcd')](_0x3144ef[_0x224e('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x3fdfa4;}})[_0x224e('0x20')](respondWithResult(_0x51714d,null))[_0x224e('0x5e')](handleError(_0x51714d,null));};exports[_0x224e('0xdf')]=function(_0x2d9994,_0x41eece,_0x4b12b6){return db[_0x224e('0x3d')][_0x224e('0x58')]({'where':{'id':_0x2d9994[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x41eece,null))[_0x224e('0x20')](function(_0x35a79e){if(_0x35a79e){return _0x35a79e['addAgents'](_0x2d9994['body'][_0x224e('0x6a')],_['omit'](_0x2d9994[_0x224e('0x59')],[_0x224e('0x6a'),'id'])||{})[_0x224e('0xc9')](function(_0x5ca600){for(var _0x36347e=0x0;_0x36347e<_0x2d9994['body'][_0x224e('0x6a')][_0x224e('0x48')];_0x36347e+=0x1){socket[_0x224e('0xe0')](_0x224e('0xe1'),{'UserId':Number(_0x2d9994[_0x224e('0x59')][_0x224e('0x6a')][_0x36347e]),'SmsAccountId':Number(_0x2d9994[_0x224e('0x55')]['id'])});}return _0x5ca600;});}})[_0x224e('0x20')](respondWithResult(_0x41eece,null))['catch'](handleError(_0x41eece,null));};exports['removeAgents']=function(_0x4379a4,_0xd2f550,_0x41a2e3){return db['SmsAccount'][_0x224e('0x58')]({'where':{'id':_0x4379a4[_0x224e('0x55')]['id']}})['then'](handleEntityNotFound(_0xd2f550,null))['then'](function(_0x5c55ba){if(_0x5c55ba){return _0x5c55ba['removeAgents'](_0x4379a4['query'][_0x224e('0x6a')])['then'](function(){if(_[_0x224e('0xe2')](_0x4379a4[_0x224e('0x45')][_0x224e('0x6a')])){for(var _0x39c5eb=0x0;_0x39c5eb<_0x4379a4[_0x224e('0x45')][_0x224e('0x6a')]['length'];_0x39c5eb+=0x1){socket[_0x224e('0xe0')](_0x224e('0xe3'),{'UserId':Number(_0x4379a4[_0x224e('0x45')]['ids'][_0x39c5eb]),'SmsAccountId':Number(_0x4379a4[_0x224e('0x55')]['id'])});}}else{socket[_0x224e('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x4379a4[_0x224e('0x45')][_0x224e('0x6a')]),'SmsAccountId':Number(_0x4379a4[_0x224e('0x55')]['id'])});}});}})[_0x224e('0x20')](respondWithStatusCode(_0xd2f550,null))[_0x224e('0x5e')](handleError(_0xd2f550,null));};exports['getAgents']=function(_0x442800,_0x433935,_0x42535f){var _0x19d24b={};var _0x5a6eaf={};var _0x24ff6d;var _0x1f0de1;return db[_0x224e('0x3d')][_0x224e('0x66')]({'where':{'id':_0x442800[_0x224e('0x55')]['id']}})[_0x224e('0x20')](handleEntityNotFound(_0x433935,null))[_0x224e('0x20')](function(_0x598943){if(_0x598943){_0x24ff6d=_0x598943;_0x5a6eaf[_0x224e('0x41')]=_[_0x224e('0x43')](db[_0x224e('0xab')][_0x224e('0x3e')]);_0x5a6eaf[_0x224e('0x45')]=_[_0x224e('0x43')](_0x442800[_0x224e('0x45')]);_0x5a6eaf[_0x224e('0x44')]=_['intersection'](_0x5a6eaf['model'],_0x5a6eaf['query']);_0x19d24b[_0x224e('0x46')]=_[_0x224e('0x67')](_0x5a6eaf['model'],qs[_0x224e('0x47')](_0x442800[_0x224e('0x45')]['fields']));_0x19d24b[_0x224e('0x46')]=_0x19d24b[_0x224e('0x46')][_0x224e('0x48')]?_0x19d24b[_0x224e('0x46')]:_0x5a6eaf['model'];_0x19d24b[_0x224e('0x4a')]=qs[_0x224e('0x4b')](_0x442800['query'][_0x224e('0x4b')]);_0x19d24b[_0x224e('0x4c')]=qs['filters'](_['pick'](_0x442800[_0x224e('0x45')],_0x5a6eaf[_0x224e('0x44')]));if(_0x442800[_0x224e('0x45')][_0x224e('0x4e')]){_0x19d24b[_0x224e('0x4c')]=_[_0x224e('0x50')](_0x19d24b[_0x224e('0x4c')],{'$or':_[_0x224e('0x42')](_0x19d24b[_0x224e('0x46')],function(_0xe87e1c){var _0x347487={};_0x347487[_0xe87e1c]={'$like':'%'+_0x442800['query'][_0x224e('0x4e')]+'%'};return _0x347487;})});}_0x19d24b=_[_0x224e('0x50')]({},_0x19d24b,_0x442800['options']);return _0x24ff6d[_0x224e('0xe4')](_0x19d24b);}})['then'](function(_0x3b2e18){if(_0x3b2e18){_0x1f0de1=_0x3b2e18[_0x224e('0x48')];if(!_0x442800['query']['hasOwnProperty']('nolimit')){_0x19d24b[_0x224e('0x30')]=qs[_0x224e('0x30')](_0x442800[_0x224e('0x45')]['limit']);_0x19d24b[_0x224e('0x2e')]=qs[_0x224e('0x2e')](_0x442800[_0x224e('0x45')][_0x224e('0x2e')]);}return _0x24ff6d[_0x224e('0xe4')](_0x19d24b);}})['then'](function(_0x3a525b){if(_0x3a525b){return _0x3a525b?{'count':_0x1f0de1,'rows':_0x3a525b}:null;}})['then'](respondWithResult(_0x433935,null))[_0x224e('0x5e')](handleError(_0x433935,null));}; \ No newline at end of file +var _0x5581=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rawAttributes','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','skebby','sender','text','from','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','created','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','transaction','bulkCreate','priority','getApplications','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','status_code','infobip','groupName','DELIVERED','intelepeer','redif','connectel','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','bandwidth','ACCEPTD','state','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','SmsAccount','findAll','rows','show','Pause','mandatoryDispositionPause','keys','find','create','body','user','UserProfileSection','autoAssociation'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x5581,0x161));var _0x1558=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5581[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x1558('0x0'));var rimraf=require(_0x1558('0x1'));var zipdir=require(_0x1558('0x2'));var jsonpatch=require(_0x1558('0x3'));var rp=require(_0x1558('0x4'));var moment=require(_0x1558('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1558('0x6'));var util=require('util');var path=require(_0x1558('0x7'));var sox=require(_0x1558('0x8'));var csv=require(_0x1558('0x9'));var ejs=require(_0x1558('0xa'));var fs=require('fs');var fs_extra=require(_0x1558('0xb'));var _=require(_0x1558('0xc'));var squel=require(_0x1558('0xd'));var crypto=require('crypto');var jsforce=require(_0x1558('0xe'));var deskjs=require(_0x1558('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1558('0x10'));var Papa=require(_0x1558('0x11'));var Redis=require(_0x1558('0x12'));var authService=require(_0x1558('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1558('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1558('0x15'));var config=require(_0x1558('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1558('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1558('0x18'),'port':0x18eb});var socket=require(_0x1558('0x19'))(new Redis(config[_0x1558('0x1a')]));require(_0x1558('0x1b'))[_0x1558('0x1c')](socket);var jayson=require(_0x1558('0x1d'));var client=jayson[_0x1558('0x1e')][_0x1558('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x8c67ea,_0x41c4b1,_0x572896,_0x40447c){return new BPromise(function(_0x25bd3d,_0x1eba5e){var _0x262461=_0x40447c||client;return _0x262461['request'](_0x8c67ea,_0x572896)[_0x1558('0x20')](function(_0x29b845){logger[_0x1558('0x21')](_0x1558('0x22'),_0x41c4b1,_0x1558('0x23'));logger[_0x1558('0x24')](_0x1558('0x25'),_0x41c4b1,'request\x20sent',JSON[_0x1558('0x26')](_0x29b845));if(_0x29b845[_0x1558('0x27')]){if(_0x29b845[_0x1558('0x27')][_0x1558('0x28')]===0x1f4){logger['error'](_0x1558('0x22'),_0x41c4b1,_0x29b845['error'][_0x1558('0x29')]);return _0x1eba5e(_0x29b845['error']['message']);}logger['error'](_0x1558('0x22'),_0x41c4b1,_0x29b845[_0x1558('0x27')]['message']);return _0x25bd3d(_0x29b845['error'][_0x1558('0x29')]);}else{logger['info'](_0x1558('0x22'),_0x41c4b1,'request\x20sent');_0x25bd3d(_0x29b845['result'][_0x1558('0x29')]);}})[_0x1558('0x2a')](function(_0x469a3a){logger['error'](_0x1558('0x22'),_0x41c4b1,_0x469a3a);_0x1eba5e(_0x469a3a);});});}function respondWithStatusCode(_0x3482f6,_0x231769){_0x231769=_0x231769||0xcc;return function(_0x2062bc){if(_0x2062bc){return _0x3482f6[_0x1558('0x2b')](_0x231769);}return _0x3482f6[_0x1558('0x2c')](_0x231769)['end']();};}function respondWithResult(_0x3d75a6,_0x32523c){_0x32523c=_0x32523c||0xc8;return function(_0x186a3e){if(_0x186a3e){return _0x3d75a6[_0x1558('0x2c')](_0x32523c)[_0x1558('0x2d')](_0x186a3e);}};}function respondWithFilteredResult(_0x5c06da,_0x52b22e){return function(_0x1d6f7f){if(_0x1d6f7f){var _0x22d655=typeof _0x52b22e[_0x1558('0x2e')]===_0x1558('0x2f')&&typeof _0x52b22e[_0x1558('0x30')]===_0x1558('0x2f');var _0x241866=_0x1d6f7f[_0x1558('0x31')];var _0x354fb7=_0x22d655?0x0:_0x52b22e[_0x1558('0x2e')];var _0x3ac333=_0x22d655?_0x1d6f7f['count']:_0x52b22e[_0x1558('0x2e')]+_0x52b22e['limit'];var _0x5c0ffd;if(_0x3ac333>=_0x241866){_0x3ac333=_0x241866;_0x5c0ffd=0xc8;}else{_0x5c0ffd=0xce;}_0x5c06da['status'](_0x5c0ffd);return _0x5c06da[_0x1558('0x32')](_0x1558('0x33'),_0x354fb7+'-'+_0x3ac333+'/'+_0x241866)['json'](_0x1d6f7f);}return null;};}function patchUpdates(_0xba22b4){return function(_0x5f28f0){try{jsonpatch[_0x1558('0x34')](_0x5f28f0,_0xba22b4,!![]);}catch(_0x59e468){return BPromise[_0x1558('0x35')](_0x59e468);}return _0x5f28f0[_0x1558('0x36')]();};}function saveUpdates(_0x13057c,_0x475bed){return function(_0x491e5b){if(_0x491e5b){return _0x491e5b[_0x1558('0x37')](_0x13057c)[_0x1558('0x20')](function(_0x217ea2){return _0x217ea2;});}return null;};}function removeEntity(_0x1f3242,_0x18f43c){return function(_0x4762e8){if(_0x4762e8){return _0x4762e8[_0x1558('0x38')]()[_0x1558('0x20')](function(){var _0x3d5790=_0x4762e8[_0x1558('0x39')]({'plain':!![]});var _0x489b04=_0x1558('0x3a');return db[_0x1558('0x3b')]['destroy']({'where':{'type':_0x489b04,'resourceId':_0x3d5790['id']}})[_0x1558('0x20')](function(){return _0x4762e8;});})['then'](function(){_0x1f3242[_0x1558('0x2c')](0xcc)[_0x1558('0x3c')]();});}};}function handleEntityNotFound(_0x49d6ed,_0x5d21c0){return function(_0x233d22){if(!_0x233d22){_0x49d6ed[_0x1558('0x2b')](0x194);}return _0x233d22;};}function handleError(_0x210fdf,_0x363e48){_0x363e48=_0x363e48||0x1f4;return function(_0x144e56){logger['error'](_0x144e56[_0x1558('0x3d')]);if(_0x144e56[_0x1558('0x3e')]){delete _0x144e56[_0x1558('0x3e')];}_0x210fdf[_0x1558('0x2c')](_0x363e48)[_0x1558('0x3f')](_0x144e56);};}exports[_0x1558('0x40')]=function(_0x9acea5,_0x5dbb84){var _0x1eff12={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3ca591={},_0x3d06b6={'count':0x0,'rows':[]};var _0x23c0fc=_[_0x1558('0x41')](db['SmsAccount']['rawAttributes'],function(_0x150828){return{'name':_0x150828[_0x1558('0x42')],'type':_0x150828[_0x1558('0x43')][_0x1558('0x44')]};});_0x3ca591['model']=_[_0x1558('0x41')](_0x23c0fc,_0x1558('0x3e'));_0x3ca591[_0x1558('0x45')]=_['keys'](_0x9acea5[_0x1558('0x45')]);_0x3ca591[_0x1558('0x46')]=_[_0x1558('0x47')](_0x3ca591[_0x1558('0x48')],_0x3ca591['query']);_0x1eff12[_0x1558('0x49')]=_['intersection'](_0x3ca591[_0x1558('0x48')],qs[_0x1558('0x4a')](_0x9acea5[_0x1558('0x45')]['fields']));_0x1eff12[_0x1558('0x49')]=_0x1eff12[_0x1558('0x49')]['length']?_0x1eff12[_0x1558('0x49')]:_0x3ca591[_0x1558('0x48')];if(!_0x9acea5['query'][_0x1558('0x4b')](_0x1558('0x4c'))){_0x1eff12[_0x1558('0x30')]=qs[_0x1558('0x30')](_0x9acea5[_0x1558('0x45')][_0x1558('0x30')]);_0x1eff12[_0x1558('0x2e')]=qs[_0x1558('0x2e')](_0x9acea5[_0x1558('0x45')][_0x1558('0x2e')]);}_0x1eff12[_0x1558('0x4d')]=qs['sort'](_0x9acea5['query'][_0x1558('0x4e')]);_0x1eff12['where']=qs[_0x1558('0x46')](_[_0x1558('0x4f')](_0x9acea5['query'],_0x3ca591[_0x1558('0x46')]),_0x23c0fc);if(_0x9acea5['query'][_0x1558('0x50')]){_0x1eff12[_0x1558('0x51')]=_[_0x1558('0x52')](_0x1eff12[_0x1558('0x51')],{'$or':_['map'](_0x23c0fc,function(_0x367508){if(_0x367508[_0x1558('0x43')]!=='VIRTUAL'){var _0xcdba0a={};_0xcdba0a[_0x367508['name']]={'$like':'%'+_0x9acea5[_0x1558('0x45')]['filter']+'%'};return _0xcdba0a;}})});}_0x1eff12=_[_0x1558('0x52')]({},_0x1eff12,_0x9acea5[_0x1558('0x53')]);var _0x1b508a={'where':_0x1eff12[_0x1558('0x51')]};return db['SmsAccount'][_0x1558('0x31')](_0x1b508a)[_0x1558('0x20')](function(_0x2000ab){_0x3d06b6[_0x1558('0x31')]=_0x2000ab;if(_0x9acea5['query'][_0x1558('0x54')]){_0x1eff12[_0x1558('0x55')]=[{'all':!![]}];}return db[_0x1558('0x56')][_0x1558('0x57')](_0x1eff12);})['then'](function(_0x393c46){_0x3d06b6[_0x1558('0x58')]=_0x393c46;return _0x3d06b6;})[_0x1558('0x20')](respondWithFilteredResult(_0x5dbb84,_0x1eff12))[_0x1558('0x2a')](handleError(_0x5dbb84,null));};exports[_0x1558('0x59')]=function(_0xb855a7,_0x1c9135){var _0xd81e9a={'raw':![],'where':{'id':_0xb855a7['params']['id']},'include':[{'model':db[_0x1558('0x5a')],'as':_0x1558('0x5b')}]},_0x2af333={};_0x2af333[_0x1558('0x48')]=_[_0x1558('0x5c')](db[_0x1558('0x56')]['rawAttributes']);_0x2af333[_0x1558('0x45')]=_[_0x1558('0x5c')](_0xb855a7[_0x1558('0x45')]);_0x2af333['filters']=_[_0x1558('0x47')](_0x2af333[_0x1558('0x48')],_0x2af333[_0x1558('0x45')]);_0xd81e9a['attributes']=_[_0x1558('0x47')](_0x2af333[_0x1558('0x48')],qs[_0x1558('0x4a')](_0xb855a7[_0x1558('0x45')][_0x1558('0x4a')]));_0xd81e9a[_0x1558('0x49')]=_0xd81e9a[_0x1558('0x49')]['length']?_0xd81e9a[_0x1558('0x49')]:_0x2af333['model'];if(_0xb855a7[_0x1558('0x45')][_0x1558('0x54')]){_0xd81e9a[_0x1558('0x55')]=[{'all':!![]}];}_0xd81e9a=_[_0x1558('0x52')]({},_0xd81e9a,_0xb855a7[_0x1558('0x53')]);return db[_0x1558('0x56')][_0x1558('0x5d')](_0xd81e9a)[_0x1558('0x20')](handleEntityNotFound(_0x1c9135,null))[_0x1558('0x20')](respondWithResult(_0x1c9135,null))[_0x1558('0x2a')](handleError(_0x1c9135,null));};exports[_0x1558('0x5e')]=function(_0x247d7e,_0x2aa50c){return db[_0x1558('0x56')]['create'](_0x247d7e[_0x1558('0x5f')],{})[_0x1558('0x20')](function(_0x1559c6){var _0x5a5e86=_0x247d7e[_0x1558('0x60')]['get']({'plain':!![]});if(!_0x5a5e86)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a5e86['role']===_0x1558('0x60')){var _0x3c6f30=_0x1559c6[_0x1558('0x39')]({'plain':!![]});var _0x531bfa=_0x1558('0x3a');return db[_0x1558('0x61')][_0x1558('0x5d')]({'where':{'name':_0x531bfa,'userProfileId':_0x5a5e86['userProfileId']},'raw':!![]})['then'](function(_0x2bdff5){if(_0x2bdff5&&_0x2bdff5[_0x1558('0x62')]===0x0){return db[_0x1558('0x3b')][_0x1558('0x5e')]({'name':_0x3c6f30[_0x1558('0x3e')],'resourceId':_0x3c6f30['id'],'type':_0x2bdff5[_0x1558('0x3e')],'sectionId':_0x2bdff5['id']},{})[_0x1558('0x20')](function(){return _0x1559c6;});}else{return _0x1559c6;}})[_0x1558('0x2a')](function(_0x556846){logger[_0x1558('0x27')](_0x1558('0x63'),_0x556846);throw _0x556846;});}return _0x1559c6;})[_0x1558('0x20')](respondWithResult(_0x2aa50c,0xc9))[_0x1558('0x2a')](handleError(_0x2aa50c,null));};exports['update']=function(_0x232f86,_0x1ac953){if(_0x232f86[_0x1558('0x5f')]['id']){delete _0x232f86['body']['id'];}return db[_0x1558('0x56')]['find']({'where':{'id':_0x232f86[_0x1558('0x64')]['id']},'include':[{'model':db['Pause'],'as':_0x1558('0x5b')}]})[_0x1558('0x20')](handleEntityNotFound(_0x1ac953,null))[_0x1558('0x20')](saveUpdates(_0x232f86['body'],null))[_0x1558('0x20')](respondWithResult(_0x1ac953,null))['catch'](handleError(_0x1ac953,null));};exports[_0x1558('0x38')]=function(_0x1dc113,_0x599681){return db['SmsAccount'][_0x1558('0x5d')]({'where':{'id':_0x1dc113[_0x1558('0x64')]['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x599681,null))[_0x1558('0x20')](removeEntity(_0x599681,null))[_0x1558('0x2a')](handleError(_0x599681,null));};exports[_0x1558('0x65')]=function(_0x194f03,_0x33ed70){return db[_0x1558('0x56')]['describe']()[_0x1558('0x20')](respondWithResult(_0x33ed70,null))[_0x1558('0x2a')](handleError(_0x33ed70,null));};exports[_0x1558('0x66')]=function(_0x29fbcb,_0x59c732,_0x269563){if(_0x29fbcb[_0x1558('0x5f')]['id']){delete _0x29fbcb[_0x1558('0x5f')]['id'];}return db[_0x1558('0x56')][_0x1558('0x5d')]({'where':{'id':_0x29fbcb[_0x1558('0x64')]['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x59c732,null))[_0x1558('0x20')](function(_0x5b0f2a){if(_0x5b0f2a){_0x29fbcb[_0x1558('0x5f')][_0x1558('0x67')]=_0x5b0f2a['id'];return db[_0x1558('0x68')][_0x1558('0x5e')](_0x29fbcb[_0x1558('0x5f')]);}})[_0x1558('0x20')](respondWithResult(_0x59c732,null))['catch'](handleError(_0x59c732,null));};exports[_0x1558('0x69')]=function(_0x3962c5,_0x384151,_0x4b23a6){var _0x44a1b1={'raw':![],'where':{}};var _0x2f0b1b={};var _0x58118={'count':0x0,'rows':[]};return db[_0x1558('0x56')]['findOne']({'where':{'id':_0x3962c5[_0x1558('0x64')]['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x384151,null))[_0x1558('0x20')](function(_0x54f8db){if(_0x54f8db){_0x2f0b1b[_0x1558('0x48')]=_['keys'](db['Disposition']['rawAttributes']);_0x2f0b1b[_0x1558('0x45')]=_[_0x1558('0x5c')](_0x3962c5[_0x1558('0x45')]);_0x2f0b1b[_0x1558('0x46')]=_[_0x1558('0x47')](_0x2f0b1b[_0x1558('0x48')],_0x2f0b1b[_0x1558('0x45')]);_0x44a1b1[_0x1558('0x49')]=_[_0x1558('0x47')](_0x2f0b1b['model'],qs['fields'](_0x3962c5['query']['fields']));_0x44a1b1[_0x1558('0x49')]=_0x44a1b1['attributes'][_0x1558('0x6a')]?_0x44a1b1[_0x1558('0x49')]:_0x2f0b1b[_0x1558('0x48')];if(!_0x3962c5[_0x1558('0x45')]['hasOwnProperty'](_0x1558('0x4c'))){_0x44a1b1[_0x1558('0x30')]=qs[_0x1558('0x30')](_0x3962c5[_0x1558('0x45')][_0x1558('0x30')]);_0x44a1b1['offset']=qs[_0x1558('0x2e')](_0x3962c5['query']['offset']);}_0x44a1b1['order']=qs[_0x1558('0x4e')](_0x3962c5[_0x1558('0x45')]['sort']);_0x44a1b1[_0x1558('0x51')]=qs[_0x1558('0x46')](_[_0x1558('0x4f')](_0x3962c5[_0x1558('0x45')],_0x2f0b1b[_0x1558('0x46')]));_0x44a1b1['where'][_0x1558('0x67')]=_0x54f8db['id'];if(_0x3962c5[_0x1558('0x45')][_0x1558('0x50')]){_0x44a1b1[_0x1558('0x51')]=_['merge'](_0x44a1b1[_0x1558('0x51')],{'$or':_[_0x1558('0x41')](_0x44a1b1['attributes'],function(_0x2da294){var _0x19f14d={};_0x19f14d[_0x2da294]={'$like':'%'+_0x3962c5['query']['filter']+'%'};return _0x19f14d;})});}_0x44a1b1=_[_0x1558('0x52')]({},_0x44a1b1,_0x3962c5[_0x1558('0x53')]);return db[_0x1558('0x68')]['count']({'where':_0x44a1b1[_0x1558('0x51')]})['then'](function(_0x5b817a){_0x58118[_0x1558('0x31')]=_0x5b817a;if(_0x3962c5[_0x1558('0x45')]['includeAll']){_0x44a1b1['include']=[{'all':!![]}];}return db[_0x1558('0x68')][_0x1558('0x57')](_0x44a1b1);})['then'](function(_0x2f25a6){_0x58118[_0x1558('0x58')]=_0x2f25a6;return _0x58118;});}})[_0x1558('0x20')](respondWithFilteredResult(_0x384151,_0x44a1b1))[_0x1558('0x2a')](handleError(_0x384151,null));};exports[_0x1558('0x6b')]=function(_0x2157b2,_0x3806d2,_0x14a7de){return db[_0x1558('0x56')][_0x1558('0x5d')]({'where':{'id':_0x2157b2[_0x1558('0x64')]['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x3806d2,null))['then'](function(_0x294d62){if(_0x294d62){return _0x294d62['removeDispositions'](_0x2157b2['query'][_0x1558('0x6c')]);}})[_0x1558('0x20')](respondWithStatusCode(_0x3806d2,null))[_0x1558('0x2a')](handleError(_0x3806d2,null));};exports[_0x1558('0x6d')]=function(_0x5273de,_0x16dfb6,_0x3d16a9){if(_0x5273de[_0x1558('0x5f')]['id']){delete _0x5273de[_0x1558('0x5f')]['id'];}return db[_0x1558('0x56')][_0x1558('0x5d')]({'where':{'id':_0x5273de[_0x1558('0x64')]['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x16dfb6,null))[_0x1558('0x20')](function(_0x213774){if(_0x213774){_0x5273de['body'][_0x1558('0x67')]=_0x213774['id'];return db[_0x1558('0x6e')][_0x1558('0x5e')](_0x5273de[_0x1558('0x5f')]);}})[_0x1558('0x20')](respondWithResult(_0x16dfb6,null))[_0x1558('0x2a')](handleError(_0x16dfb6,null));};exports[_0x1558('0x6f')]=function(_0x286ce4,_0x442fed,_0x3969c7){var _0x12474f={'raw':![],'where':{}};var _0x2664fe={};var _0x201ee6={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1558('0x70')]({'where':{'id':_0x286ce4['params']['id']}})['then'](handleEntityNotFound(_0x442fed,null))[_0x1558('0x20')](function(_0x2b9585){if(_0x2b9585){_0x2664fe['model']=_['keys'](db['CannedAnswer'][_0x1558('0x71')]);_0x2664fe[_0x1558('0x45')]=_[_0x1558('0x5c')](_0x286ce4[_0x1558('0x45')]);_0x2664fe['filters']=_[_0x1558('0x47')](_0x2664fe['model'],_0x2664fe[_0x1558('0x45')]);_0x12474f[_0x1558('0x49')]=_['intersection'](_0x2664fe[_0x1558('0x48')],qs[_0x1558('0x4a')](_0x286ce4[_0x1558('0x45')]['fields']));_0x12474f['attributes']=_0x12474f[_0x1558('0x49')][_0x1558('0x6a')]?_0x12474f['attributes']:_0x2664fe[_0x1558('0x48')];if(!_0x286ce4[_0x1558('0x45')][_0x1558('0x4b')](_0x1558('0x4c'))){_0x12474f[_0x1558('0x30')]=qs[_0x1558('0x30')](_0x286ce4[_0x1558('0x45')][_0x1558('0x30')]);_0x12474f[_0x1558('0x2e')]=qs[_0x1558('0x2e')](_0x286ce4[_0x1558('0x45')][_0x1558('0x2e')]);}_0x12474f['order']=qs[_0x1558('0x4e')](_0x286ce4[_0x1558('0x45')][_0x1558('0x4e')]);_0x12474f[_0x1558('0x51')]=qs[_0x1558('0x46')](_[_0x1558('0x4f')](_0x286ce4[_0x1558('0x45')],_0x2664fe['filters']));_0x12474f[_0x1558('0x51')][_0x1558('0x67')]=_0x2b9585['id'];if(_0x286ce4['query'][_0x1558('0x50')]){_0x12474f['where']=_[_0x1558('0x52')](_0x12474f['where'],{'$or':_[_0x1558('0x41')](_0x12474f['attributes'],function(_0xe7bb92){var _0x1fe878={};_0x1fe878[_0xe7bb92]={'$like':'%'+_0x286ce4[_0x1558('0x45')][_0x1558('0x50')]+'%'};return _0x1fe878;})});}_0x12474f=_['merge']({},_0x12474f,_0x286ce4['options']);return db[_0x1558('0x6e')][_0x1558('0x31')]({'where':_0x12474f[_0x1558('0x51')]})['then'](function(_0x26d576){_0x201ee6[_0x1558('0x31')]=_0x26d576;if(_0x286ce4[_0x1558('0x45')][_0x1558('0x54')]){_0x12474f[_0x1558('0x55')]=[{'all':!![]}];}return db[_0x1558('0x6e')][_0x1558('0x57')](_0x12474f);})[_0x1558('0x20')](function(_0x28d35c){_0x201ee6[_0x1558('0x58')]=_0x28d35c;return _0x201ee6;});}})[_0x1558('0x20')](respondWithFilteredResult(_0x442fed,_0x12474f))[_0x1558('0x2a')](handleError(_0x442fed,null));};exports[_0x1558('0x72')]=function(_0x1b3fab,_0x1706d1,_0x324b16){return db[_0x1558('0x56')][_0x1558('0x5d')]({'where':{'id':_0x1b3fab['params']['id']}})['then'](handleEntityNotFound(_0x1706d1,null))[_0x1558('0x20')](function(_0x1b8628){if(_0x1b8628){return _0x1b8628[_0x1558('0x72')](_0x1b3fab[_0x1558('0x45')][_0x1558('0x6c')]);}})['then'](respondWithStatusCode(_0x1706d1,null))[_0x1558('0x2a')](handleError(_0x1706d1,null));};exports[_0x1558('0x73')]=function(_0x236579,_0xc448ef,_0x521475){var _0x30e029={'channel':_0x1558('0x74')};var _0x1002fb=[];var _0x22855c=[];var _0x5b396c={};return db[_0x1558('0x56')][_0x1558('0x5d')]({'where':{'id':_0x236579[_0x1558('0x64')]['id']},'include':[{'model':db[_0x1558('0x75')],'as':_0x1558('0x76')}]})[_0x1558('0x20')](handleEntityNotFound(_0xc448ef,null))[_0x1558('0x20')](function(_0xdf549f){_0x30e029[_0x1558('0x77')]=_0xdf549f;_0x30e029[_0x1558('0x78')]=_[_0x1558('0x79')](_0xdf549f['Applications'],['priority'],[_0x1558('0x7a')]);if(_0x30e029['account'][_0x1558('0x76')]){delete _0x30e029[_0x1558('0x77')][_0x1558('0x76')];}return db[_0x1558('0x7b')][_0x1558('0x65')]();})['then'](function(_0x233e29){if(!_0x233e29){throw new db[(_0x1558('0x7c'))][(_0x1558('0x7d'))](_0x1558('0x7e'));}_0x1002fb=_[_0x1558('0x7f')](_[_0x1558('0x5c')](_0x233e29),[_0x1558('0x80'),'updatedAt']);_0x22855c=_['difference'](_[_0x1558('0x5c')](_0x233e29),[_0x1558('0x80'),_0x1558('0x81'),_0x1558('0x82'),_0x1558('0x83')]);_0x30e029[_0x1558('0x5f')]={'mapKey':_0x1558('0x84')};if(_0x30e029[_0x1558('0x77')][_0x1558('0x43')]){switch(_0x30e029[_0x1558('0x77')]['type']){case _0x1558('0x85'):_0x30e029['body']['from']=_0x236579[_0x1558('0x5f')][_0x1558('0x86')];_0x30e029[_0x1558('0x5f')]['body']=_0x236579[_0x1558('0x5f')][_0x1558('0x87')];_0x30e029[_0x1558('0x5f')][_0x1558('0x88')]=_0x236579[_0x1558('0x5f')][_0x1558('0x89')];break;case _0x1558('0x8a'):_0x30e029['body']['from']='+'+_0x236579['body'][_0x1558('0x8b')];_0x30e029[_0x1558('0x5f')][_0x1558('0x5f')]=_0x236579['body'][_0x1558('0x8c')];break;case'connectel':_0x30e029[_0x1558('0x5f')][_0x1558('0x8d')]=_0x236579[_0x1558('0x5f')][_0x1558('0x8d')];_0x30e029[_0x1558('0x5f')][_0x1558('0x5f')]=_0x236579[_0x1558('0x5f')][_0x1558('0x29')];break;case _0x1558('0x8e'):_0x30e029[_0x1558('0x5f')][_0x1558('0x8d')]=_0x236579[_0x1558('0x5f')]['from'];_0x30e029['body']['body']=_0x236579[_0x1558('0x5f')][_0x1558('0x5f')];_0x30e029[_0x1558('0x5f')][_0x1558('0x88')]=_0x236579['body'][_0x1558('0x8f')];break;case _0x1558('0x90'):_0x30e029[_0x1558('0x5f')][_0x1558('0x8d')]=_0x236579[_0x1558('0x5f')]['From'];_0x30e029[_0x1558('0x5f')][_0x1558('0x5f')]=_0x236579[_0x1558('0x5f')][_0x1558('0x91')];_0x30e029[_0x1558('0x5f')][_0x1558('0x88')]=_0x236579[_0x1558('0x5f')][_0x1558('0x92')];break;case'infobip':_0x30e029[_0x1558('0x5f')][_0x1558('0x8d')]='+'+_0x236579[_0x1558('0x5f')][_0x1558('0x93')][0x0]['from'];_0x30e029['body']['body']=_0x236579[_0x1558('0x5f')][_0x1558('0x93')][0x0][_0x1558('0x8c')];_0x30e029[_0x1558('0x5f')][_0x1558('0x88')]=_0x236579[_0x1558('0x5f')][_0x1558('0x93')][0x0][_0x1558('0x88')];break;case _0x1558('0x94'):_0x30e029[_0x1558('0x5f')][_0x1558('0x8d')]=_0x236579[_0x1558('0x5f')][_0x1558('0x95')];_0x30e029[_0x1558('0x5f')][_0x1558('0x5f')]=_0x236579[_0x1558('0x5f')]['segmentedMessage'][_0x1558('0x29')];break;case _0x1558('0x96'):_0x30e029[_0x1558('0x5f')][_0x1558('0x8d')]=_0x236579[_0x1558('0x5f')][_0x1558('0x97')];_0x30e029['body'][_0x1558('0x5f')]=_0x236579[_0x1558('0x5f')][_0x1558('0x8c')];_0x30e029[_0x1558('0x5f')]['messageId']=_0x236579[_0x1558('0x5f')]['replyMessageId'];break;case'bandwidth':_0x30e029[_0x1558('0x5f')][_0x1558('0x88')]=_0x236579[_0x1558('0x5f')][0x0][_0x1558('0x29')]['id'];_0x30e029[_0x1558('0x5f')][_0x1558('0x8d')]=_0x236579[_0x1558('0x5f')][0x0][_0x1558('0x29')]['from'];_0x30e029[_0x1558('0x5f')][_0x1558('0x5f')]=_0x236579['body'][0x0][_0x1558('0x29')][_0x1558('0x8c')];break;case'intelepeer':_0x30e029[_0x1558('0x5f')]['from']=_0x236579[_0x1558('0x5f')]['from'];_0x30e029[_0x1558('0x5f')][_0x1558('0x5f')]=_0x236579[_0x1558('0x5f')][_0x1558('0x29')];_0x30e029['body']['messageId']=_0x236579[_0x1558('0x5f')][_0x1558('0x98')];break;}}if(_0x30e029[_0x1558('0x5f')]['id']){delete _0x30e029[_0x1558('0x5f')]['id'];}if(_[_0x1558('0x99')](_0x30e029['body'][_0x1558('0x8d')])){throw new db[(_0x1558('0x7c'))]['ValidationError'](_0x1558('0x9a'));}if(_[_0x1558('0x99')](_0x30e029[_0x1558('0x5f')][_0x1558('0x5f')])||_0x30e029['body'][_0x1558('0x5f')]===''){throw new db[(_0x1558('0x7c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x30e029['body']['mapKey'])){throw new db[(_0x1558('0x7c'))][(_0x1558('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22855c);}if(!_['includes'](_0x22855c,_0x30e029[_0x1558('0x5f')][_0x1558('0x9b')])){throw new db[(_0x1558('0x7c'))]['ValidationError'](_0x1558('0x9c')+_0x22855c);}_0x5b396c[_0x30e029['body']['mapKey']]=_0x30e029[_0x1558('0x5f')]['from'];return db['CmList'][_0x1558('0x5d')]({'where':{'id':_0x30e029[_0x1558('0x77')][_0x1558('0x83')]},'include':[{'model':db[_0x1558('0x7b')],'as':_0x1558('0x9d'),'where':_0x5b396c,'limit':0x1,'order':[['updatedAt',_0x1558('0x9e')]]}]});})['then'](handleEntityNotFound(_0xc448ef,null))['then'](function(_0x343781){if(_0x343781){_0x30e029[_0x1558('0x9f')]=_[_0x1558('0xa0')](_0x343781,[_0x1558('0x9d')]);if(_0x343781['Contacts'][_0x1558('0x6a')]){return _0x343781[_0x1558('0x9d')][0x0];}var _0x19b44e=_[_0x1558('0xa1')](_0x30e029['body'],{'firstName':_0x30e029[_0x1558('0x5f')][_0x1558('0x8d')],'ListId':_0x343781['id']});_0x19b44e[_0x30e029['body']['mapKey']]=_0x30e029[_0x1558('0x5f')][_0x1558('0x8d')];return db['CmContact'][_0x1558('0x5e')](_0x19b44e,{'fields':_0x1002fb,'raw':!![]});}})[_0x1558('0x20')](handleEntityNotFound(_0xc448ef,null))['then'](function(_0x499105){if(_0x499105){_0x30e029[_0x1558('0xa2')]=_0x499105;var _0x46a5d1={'ContactId':_0x499105['id'],'phone':_0x30e029['body'][_0x1558('0x8d')],'SmsAccountId':_0x236579['params']['id']};var _0x1d1ef3={'ContactId':_0x499105['id'],'SmsAccountId':_0x236579['params']['id'],'closed':![]};return db[_0x1558('0xa3')][_0x1558('0x5d')]({'where':_0x1d1ef3})[_0x1558('0x20')](function(_0x30ad1e){if(_0x30ad1e){return[_0x30ad1e,![]];}return db['SmsInteraction'][_0x1558('0x5e')](_0x46a5d1)[_0x1558('0x20')](function(_0x47a764){return[_0x47a764,!![]];});});}})[_0x1558('0xa4')](function(_0x9dd52e,_0xf42277){_0x30e029[_0x1558('0xa5')]=_0x9dd52e[_0x1558('0x39')]({'plain':!![]});_0x30e029[_0x1558('0xa5')]['created']=![];if(_0xf42277){if(_0x30e029[_0x1558('0x77')][_0x1558('0xa6')]){_0x30e029[_0x1558('0x78')][_0x1558('0xa7')]({'id':0x0,'priority':_0x30e029[_0x1558('0x78')][_0x1558('0x6a')]+0x1,'app':_0x1558('0xa8'),'appdata':_0x1558('0xa9'),'interval':'*,*,*,*'});}_0x30e029[_0x1558('0xa5')][_0x1558('0xaa')]=!![];}return db[_0x1558('0xab')][_0x1558('0x5e')]({'phone':_0x30e029['body'][_0x1558('0x8d')],'messageId':_0x30e029['body']['messageId'],'body':_0x30e029['body'][_0x1558('0x5f')],'SmsAccountId':_0x236579[_0x1558('0x64')]['id'],'SmsInteractionId':_0x9dd52e['id'],'direction':'in','ContactId':_0x9dd52e[_0x1558('0xac')],'AttachmentId':_0x30e029[_0x1558('0x5f')][_0x1558('0xad')]});})[_0x1558('0x20')](function(_0x4c52e3){_0x30e029[_0x1558('0x29')]=_0x4c52e3;if(_0x30e029[_0x1558('0xa5')]['UserId']){return db['User'][_0x1558('0x5d')]({'attributes':['id','name'],'where':{'id':_0x30e029[_0x1558('0xa5')][_0x1558('0xae')]}})[_0x1558('0x20')](function(_0x447b70){if(_0x447b70){_0x30e029[_0x1558('0x78')][_0x1558('0xaf')]({'id':0x0,'priority':0x0,'app':_0x1558('0xb0'),'appdata':_0x447b70['name']+','+(_0x30e029[_0x1558('0x77')][_0x1558('0xb1')]||0xa),'interval':_0x1558('0xb2')});}return respondWithRpcPromise(_0x1558('0xb3'),_0x1558('0xb4'),_0x30e029);});}return respondWithRpcPromise(_0x1558('0xb3'),'startRouting',_0x30e029);})[_0x1558('0x20')](function(_0x1b92da){if(_0x1b92da){var _0x4ea45c=0xc8;var _0x38d406=_0x1558('0xb5');logger[_0x1558('0x21')](_0x1558('0x25'),_0x38d406,_0x4ea45c,_0x1558('0xb6'));logger[_0x1558('0x24')](_0x1558('0xb7'),_0x38d406,_0x4ea45c,_0x1558('0xb6'),JSON[_0x1558('0x26')](_0x1b92da));if(_0x30e029[_0x1558('0x77')][_0x1558('0x43')]===_0x1558('0x85')){return _0xc448ef[_0x1558('0x2c')](_0x4ea45c)['set']('Content-Type','text/xml')[_0x1558('0x3f')]('\x0a');}else{return _0xc448ef[_0x1558('0x2c')](_0x4ea45c)[_0x1558('0x2d')](_0x1b92da);}}})[_0x1558('0x2a')](handleError(_0xc448ef,null));};exports['addApplications']=function(_0x8bc728,_0x3cda8a,_0x1f7d97){return db['SmsAccount'][_0x1558('0x70')]({'where':{'id':_0x8bc728['params']['id']}})['then'](handleEntityNotFound(_0x3cda8a,null))[_0x1558('0x20')](function(_0x1cbadf){if(_0x1cbadf){return db['sequelize'][_0x1558('0xb8')](function(_0x5cb1f9){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x8bc728['params']['id']},'transaction':_0x5cb1f9})[_0x1558('0x20')](function(_0x11e1a1){var _0x27f4bd=_[_0x1558('0x41')](_0x8bc728[_0x1558('0x5f')],function(_0xc561b3){_0xc561b3['SmsAccountId']=_0x8bc728['params']['id'];return _0xc561b3;});return db[_0x1558('0x75')][_0x1558('0xb9')](_0x27f4bd,{'transaction':_0x5cb1f9});});})[_0x1558('0x20')](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x8bc728[_0x1558('0x64')]['id']},'order':_0x1558('0xba')});});}})['then'](respondWithResult(_0x3cda8a,null))['catch'](handleError(_0x3cda8a,null));};exports[_0x1558('0xbb')]=function(_0x1cc2f2,_0x18d93e,_0x2cc7df){var _0x4faa62={};var _0x4968fe={};var _0x5418cc;var _0x41a969;return db[_0x1558('0x56')][_0x1558('0x70')]({'where':{'id':_0x1cc2f2[_0x1558('0x64')]['id']}})['then'](handleEntityNotFound(_0x18d93e,null))['then'](function(_0x3dd0b9){if(_0x3dd0b9){_0x5418cc=_0x3dd0b9;_0x4968fe['model']=_[_0x1558('0x5c')](db[_0x1558('0x75')][_0x1558('0x71')]);_0x4968fe[_0x1558('0x45')]=_[_0x1558('0x5c')](_0x1cc2f2['query']);_0x4968fe['filters']=_[_0x1558('0x47')](_0x4968fe[_0x1558('0x48')],_0x4968fe['query']);_0x4faa62['attributes']=_[_0x1558('0x47')](_0x4968fe[_0x1558('0x48')],qs[_0x1558('0x4a')](_0x1cc2f2[_0x1558('0x45')][_0x1558('0x4a')]));_0x4faa62[_0x1558('0x49')]=_0x4faa62[_0x1558('0x49')]['length']?_0x4faa62[_0x1558('0x49')]:_0x4968fe[_0x1558('0x48')];_0x4faa62[_0x1558('0x4d')]=qs[_0x1558('0x4e')](_0x1cc2f2['query'][_0x1558('0x4e')]);_0x4faa62[_0x1558('0x51')]=qs[_0x1558('0x46')](_[_0x1558('0x4f')](_0x1cc2f2[_0x1558('0x45')],_0x4968fe[_0x1558('0x46')]));if(_0x1cc2f2[_0x1558('0x45')]['filter']){_0x4faa62[_0x1558('0x51')]=_[_0x1558('0x52')](_0x4faa62[_0x1558('0x51')],{'$or':_[_0x1558('0x41')](_0x4faa62['attributes'],function(_0x4b1c58){var _0x1d700c={};_0x1d700c[_0x4b1c58]={'$like':'%'+_0x1cc2f2[_0x1558('0x45')][_0x1558('0x50')]+'%'};return _0x1d700c;})});}_0x4faa62=_[_0x1558('0x52')]({},_0x4faa62,_0x1cc2f2[_0x1558('0x53')]);return _0x5418cc[_0x1558('0xbb')](_0x4faa62);}})['then'](function(_0x1f5ffe){if(_0x1f5ffe){_0x41a969=_0x1f5ffe[_0x1558('0x6a')];if(!_0x1cc2f2[_0x1558('0x45')][_0x1558('0x4b')]('nolimit')){_0x4faa62[_0x1558('0x30')]=qs[_0x1558('0x30')](_0x1cc2f2[_0x1558('0x45')][_0x1558('0x30')]);_0x4faa62['offset']=qs['offset'](_0x1cc2f2[_0x1558('0x45')][_0x1558('0x2e')]);}return _0x5418cc['getApplications'](_0x4faa62);}})[_0x1558('0x20')](function(_0x12b052){if(_0x12b052){return _0x12b052?{'count':_0x41a969,'rows':_0x12b052}:null;}})[_0x1558('0x20')](respondWithResult(_0x18d93e,null))[_0x1558('0x2a')](handleError(_0x18d93e,null));};exports[_0x1558('0xbc')]=function(_0x439ac4,_0x27fd0,_0x10a112){var _0x3f4974={'raw':![],'where':{}};var _0x310efe={};var _0x2fe439={'count':0x0,'rows':[]};return db[_0x1558('0x56')][_0x1558('0x70')]({'where':{'id':_0x439ac4[_0x1558('0x64')]['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x27fd0,null))[_0x1558('0x20')](function(_0x311fc5){if(_0x311fc5){_0x310efe[_0x1558('0x48')]=_[_0x1558('0x5c')](db[_0x1558('0xa3')][_0x1558('0x71')]);_0x310efe['query']=_[_0x1558('0x5c')](_0x439ac4[_0x1558('0x45')]);_0x310efe[_0x1558('0x46')]=_['intersection'](_0x310efe[_0x1558('0x48')],_0x310efe[_0x1558('0x45')]);_0x3f4974[_0x1558('0x49')]=_[_0x1558('0x47')](_0x310efe[_0x1558('0x48')],qs[_0x1558('0x4a')](_0x439ac4[_0x1558('0x45')][_0x1558('0x4a')]));_0x3f4974[_0x1558('0x49')]=_0x3f4974[_0x1558('0x49')]['length']?_0x3f4974[_0x1558('0x49')]:_0x310efe['model'];if(!_0x439ac4[_0x1558('0x45')][_0x1558('0x4b')]('nolimit')){_0x3f4974[_0x1558('0x30')]=qs['limit'](_0x439ac4[_0x1558('0x45')][_0x1558('0x30')]);_0x3f4974['offset']=qs[_0x1558('0x2e')](_0x439ac4[_0x1558('0x45')][_0x1558('0x2e')]);}_0x3f4974['order']=qs[_0x1558('0x4e')](_0x439ac4[_0x1558('0x45')][_0x1558('0x4e')]);_0x3f4974['where']=qs[_0x1558('0x46')](_[_0x1558('0x4f')](_0x439ac4['query'],_0x310efe['filters']));_0x3f4974[_0x1558('0x51')]['SmsAccountId']=_0x311fc5['id'];if(_0x439ac4['query'][_0x1558('0x50')]){_0x3f4974[_0x1558('0x51')]=_[_0x1558('0x52')](_0x3f4974[_0x1558('0x51')],{'$or':_[_0x1558('0x41')](_0x3f4974[_0x1558('0x49')],function(_0x3c5fd7){var _0x44d5d4={};_0x44d5d4[_0x3c5fd7]={'$like':'%'+_0x439ac4[_0x1558('0x45')][_0x1558('0x50')]+'%'};return _0x44d5d4;})});}_0x3f4974=_[_0x1558('0x52')]({},_0x3f4974,_0x439ac4['options']);return db[_0x1558('0xa3')][_0x1558('0x31')]({'where':_0x3f4974[_0x1558('0x51')]})[_0x1558('0x20')](function(_0x5ce3d6){_0x2fe439[_0x1558('0x31')]=_0x5ce3d6;if(_0x439ac4['query'][_0x1558('0x54')]){_0x3f4974[_0x1558('0x55')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1558('0xbd')],'as':_0x1558('0xbe'),'attributes':[_0x1558('0x3e'),_0x1558('0xbf'),_0x1558('0xc0')],'required':![]},{'model':db[_0x1558('0xc1')],'as':_0x1558('0xc2'),'attributes':['id','name',_0x1558('0xc3')],'where':_0x439ac4['query'][_0x1558('0xc4')]?{'id':_0x439ac4['query'][_0x1558('0xc4')]}:undefined,'required':_0x439ac4[_0x1558('0x45')][_0x1558('0xc4')]?!![]:![]}];}return db[_0x1558('0xa3')][_0x1558('0x57')](_0x3f4974);})['then'](function(_0x121f50){_0x2fe439[_0x1558('0x58')]=_0x121f50;return _0x2fe439;});}})['then'](respondWithFilteredResult(_0x27fd0,_0x3f4974))[_0x1558('0x2a')](handleError(_0x27fd0,null));};exports[_0x1558('0x3f')]=function(_0x2ab6a0,_0x5c04a8,_0x13cf71){var _0x699b21,_0x1b2bed,_0x2e6497;if(_['isNil'](_0x2ab6a0['body'][_0x1558('0x5f')])||_0x2ab6a0[_0x1558('0x5f')][_0x1558('0x5f')]===''){throw new db[(_0x1558('0x7c'))]['ValidationError'](_0x1558('0xc5'));}if(_['isNil'](_0x2ab6a0[_0x1558('0x5f')]['to'])){throw new db[(_0x1558('0x7c'))][(_0x1558('0x7d'))]('to\x20is\x20mandatory');}_0x699b21=_0x2ab6a0[_0x1558('0x5f')]['to'];return db[_0x1558('0x56')][_0x1558('0x5d')]({'where':{'id':_0x2ab6a0[_0x1558('0x64')]['id']},'include':[{'model':db[_0x1558('0xc6')],'as':'List','include':[{'model':db[_0x1558('0x7b')],'as':_0x1558('0x9d'),'where':{'mobile':_0x699b21},'limit':0x1,'order':[['updatedAt',_0x1558('0x9e')]]}]}]})[_0x1558('0x20')](handleEntityNotFound(_0x5c04a8,null))[_0x1558('0x20')](function(_0x2f053a){if(_0x2f053a&&_0x2f053a[_0x1558('0xc7')]){_0x1b2bed=_0x2f053a[_0x1558('0x39')]({'plain':!![]});if(_0x1b2bed['List']&&_0x1b2bed['List'][_0x1558('0x9d')][_0x1558('0x6a')]){return _0x1b2bed[_0x1558('0xc7')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x1558('0xa1')](_0x2ab6a0[_0x1558('0x5f')],{'firstName':_0x699b21,'mobile':_0x699b21,'phone':_0x699b21,'ListId':_0x1b2bed[_0x1558('0x83')]}));}})[_0x1558('0x20')](handleEntityNotFound(_0x5c04a8,null))['then'](function(_0x3d62a3){if(_0x3d62a3){_0x2e6497=_0x3d62a3;return db[_0x1558('0xa3')][_0x1558('0x5d')]({'where':{'ContactId':_0x2e6497['id'],'closed':![],'SmsAccountId':_0x1b2bed['id']}})[_0x1558('0x20')](function(_0x5929a6){if(_0x5929a6){return[_0x5929a6,![]];}return db[_0x1558('0xa3')][_0x1558('0x5e')]({'UserId':_0x2ab6a0['user']['id'],'ContactId':_0x2e6497['id'],'SmsAccountId':_0x1b2bed['id'],'phone':_0x699b21,'firstMsgDirection':_0x1558('0xc8'),'Messages':[_[_0x1558('0x52')](_0x2ab6a0[_0x1558('0x5f')],{'read':![],'body':_0x2ab6a0[_0x1558('0x5f')][_0x1558('0x5f')],'phone':_0x699b21,'SmsAccountId':_0x1b2bed['id'],'UserId':_0x2ab6a0['user']['id'],'ContactId':_0x2e6497['id']})]},{'include':[{'model':db[_0x1558('0xab')],'as':'Messages'}]})['then'](function(_0x37fe2f){return[_0x37fe2f,!![]];});});}})['spread'](function(_0x3fc5db,_0x16a2d7){if(_0x16a2d7){return _0x3fc5db;}return db[_0x1558('0xab')][_0x1558('0x5e')](_[_0x1558('0x52')](_0x2ab6a0[_0x1558('0x5f')],{'read':![],'body':_0x2ab6a0[_0x1558('0x5f')]['body'],'phone':_0x699b21,'SmsAccountId':_0x1b2bed['id'],'SmsInteractionId':_0x3fc5db['id'],'UserId':_0x2ab6a0[_0x1558('0x60')]['id'],'ContactId':_0x2e6497['id']}))[_0x1558('0x20')](function(_0x3cf03c){_0x3fc5db['dataValues'][_0x1558('0xc9')]=[];_0x3fc5db[_0x1558('0xca')]['Messages']['push'](_0x3cf03c[_0x1558('0xca')]);return _0x3fc5db;});})[_0x1558('0x20')](respondWithResult(_0x5c04a8,null))[_0x1558('0x2a')](handleError(_0x5c04a8,null));};exports[_0x1558('0x2c')]=function(_0x3a89ca,_0x5e06ca,_0x208dd5){if(_0x3a89ca[_0x1558('0x5f')]['id']){delete _0x3a89ca[_0x1558('0x5f')]['id'];}var _0x58882c,_0x2c60a8,_0x42fdd9;return db['SmsAccount'][_0x1558('0x5d')]({'where':{'id':_0x3a89ca['params']['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x5e06ca,null))[_0x1558('0x20')](function(_0x7c4e38){if(_0x7c4e38){_0x42fdd9=_0x7c4e38;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1558('0x2c'),_0x1558('0xcb'),_0x7c4e38['type'],util[_0x1558('0xcc')](_0x3a89ca[_0x1558('0x5f')],{'showHidden':![],'depth':null}));switch(_0x7c4e38[_0x1558('0x43')]){case _0x1558('0x8a'):if(_0x3a89ca[_0x1558('0x5f')][_0x1558('0xcd')]&&_0x3a89ca[_0x1558('0x5f')][_0x1558('0x2c')]){_0x2c60a8=_0x3a89ca[_0x1558('0x5f')][_0x1558('0x2c')];return db[_0x1558('0xab')][_0x1558('0x5d')]({'where':{'messageId':_0x3a89ca[_0x1558('0x5f')][_0x1558('0xcd')]}});}break;case'connectel':if(_0x3a89ca[_0x1558('0x5f')][_0x1558('0xce')]&&_0x3a89ca[_0x1558('0x5f')]['statusInt']){_0x2c60a8=_0x3a89ca[_0x1558('0x5f')]['statusInt'];return db[_0x1558('0xab')]['find']({'where':{'messageId':_0x3a89ca[_0x1558('0x5f')][_0x1558('0xce')]}});}break;case _0x1558('0x8e'):if(_0x3a89ca[_0x1558('0x5f')][_0x1558('0x8f')]&&_0x3a89ca[_0x1558('0x5f')][_0x1558('0xcf')]){_0x2c60a8=_0x3a89ca[_0x1558('0x5f')][_0x1558('0xcf')];return db[_0x1558('0xab')][_0x1558('0x5d')]({'where':{'messageId':_0x3a89ca[_0x1558('0x5f')][_0x1558('0x8f')]}});}break;case _0x1558('0xd0'):var _0xd4b837=_0x3a89ca[_0x1558('0x5f')][_0x1558('0x93')][0x0];if(_0xd4b837[_0x1558('0x88')]&&_0xd4b837[_0x1558('0x2c')][_0x1558('0xd1')]===_0x1558('0xd2')){_0x2c60a8=_0xd4b837[_0x1558('0x2c')][_0x1558('0xd1')];return db[_0x1558('0xab')][_0x1558('0x5d')]({'where':{'messageId':_0xd4b837['messageId']}});}break;case _0x1558('0x96'):if(_0x3a89ca[_0x1558('0x5f')][_0x1558('0x88')]&&_0x3a89ca[_0x1558('0x5f')][_0x1558('0x2c')]){_0x2c60a8=_0x3a89ca[_0x1558('0x5f')][_0x1558('0x2c')];return db[_0x1558('0xab')][_0x1558('0x5d')]({'where':{'messageId':_0x3a89ca[_0x1558('0x5f')][_0x1558('0x88')]}});}break;case'bandwidth':if(_0x3a89ca[_0x1558('0x5f')][0x0]['message']['id']){_0x2c60a8=_0x3a89ca['body'][0x0][_0x1558('0x43')];return db[_0x1558('0xab')][_0x1558('0x5d')]({'where':{'messageId':_0x3a89ca[_0x1558('0x5f')][0x0][_0x1558('0x29')]['id']}});}break;case _0x1558('0xd3'):if(_0x3a89ca['body'][_0x1558('0xd4')]&&_0x3a89ca[_0x1558('0x5f')][_0x1558('0x2c')]){_0x2c60a8=_0x3a89ca[_0x1558('0x5f')][_0x1558('0x2c')];return db[_0x1558('0xab')][_0x1558('0x5d')]({'where':{'messageId':_0x3a89ca[_0x1558('0x5f')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x5e06ca,null))[_0x1558('0x20')](function(_0x1cbb54){if(_0x1cbb54){_0x58882c=_0x1cbb54;switch(_0x42fdd9[_0x1558('0x43')]){case _0x1558('0x8a'):if(_0x2c60a8==='DELIVERED'){return _0x58882c[_0x1558('0x37')]({'read':!![]});}else{logger[_0x1558('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0x1558('0xcc')](_0x3a89ca[_0x1558('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1558('0xd5'):if(_0x2c60a8==='1'){return _0x58882c['update']({'read':!![]});}else{logger[_0x1558('0x27')](_0x1558('0x25'),_0x1558('0x2c'),_0x1558('0x8a'),util[_0x1558('0xcc')](_0x3a89ca[_0x1558('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1558('0x8e'):if(!_0x3a89ca[_0x1558('0x5f')][_0x1558('0xd6')]&&_0x2c60a8>=0xc8&&_0x2c60a8<=0xce){return _0x58882c['update']({'read':!![]});}else{logger[_0x1558('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1558('0x2c'),_0x1558('0x8e'),util[_0x1558('0xcc')](_0x3a89ca[_0x1558('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1558('0xd0'):var _0x3f218c=_0x3a89ca[_0x1558('0x5f')][_0x1558('0x93')][0x0];if(_0x3f218c[_0x1558('0x2c')][_0x1558('0xd1')]==='DELIVERED'){return _0x58882c[_0x1558('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1558('0x2c'),'infobip',util[_0x1558('0xcc')](_0x3a89ca['body'],{'showHidden':![],'depth':null}));}break;case _0x1558('0x96'):if(_0x2c60a8==_0x1558('0xd7')||_0x2c60a8==_0x1558('0xd8')){return _0x58882c['update']({'read':!![]});}else{logger['error'](_0x1558('0x25'),_0x1558('0x2c'),'clickatell',util[_0x1558('0xcc')](_0x3a89ca['body'],{'showHidden':![],'depth':null}));}break;case _0x1558('0xd9'):if(_0x2c60a8=='message-delivered'){return _0x58882c[_0x1558('0x37')]({'read':!![]});}else{logger[_0x1558('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1558('0xd9'),util[_0x1558('0xcc')](_0x3a89ca['body'],{'showHidden':![],'depth':null}));}break;case _0x1558('0xd3'):if(_0x2c60a8==='DELIVRD'||_0x2c60a8===_0x1558('0xda')){return _0x58882c['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1558('0x2c'),'intelepeer',util[_0x1558('0xcc')](_0x3a89ca[_0x1558('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x58882c;}})[_0x1558('0x20')](respondWithResult(_0x5e06ca,null))[_0x1558('0x2a')](handleError(_0x5e06ca,null));};exports['statusGet']=function(_0xdffcc6,_0x5b76df,_0xfd1948){var _0x5f15ba,_0x2552cc,_0x2ff371;return db['SmsAccount'][_0x1558('0x5d')]({'where':{'id':_0xdffcc6[_0x1558('0x64')]['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x5b76df,null))[_0x1558('0x20')](function(_0x4ceaa4){if(_0x4ceaa4){_0x2ff371=_0x4ceaa4;logger[_0x1558('0x24')](_0x1558('0x25'),'status',_0x1558('0xcb'),_0x4ceaa4[_0x1558('0x43')],util['inspect'](_0xdffcc6[_0x1558('0x45')],{'showHidden':![],'depth':null}));switch(_0x4ceaa4['type']){case _0x1558('0x94'):if(_0xdffcc6[_0x1558('0x45')]['message-id']&&_0xdffcc6[_0x1558('0x45')]['state']){_0x2552cc=_0xdffcc6[_0x1558('0x45')][_0x1558('0xdb')];return db[_0x1558('0xab')][_0x1558('0x5d')]({'where':{'messageId':_0xdffcc6[_0x1558('0x45')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x5b76df,null))[_0x1558('0x20')](function(_0x1ea6ff){if(_0x1ea6ff){_0x5f15ba=_0x1ea6ff;switch(_0x2ff371['type']){case _0x1558('0x94'):if(_0x2552cc==='2'||_0x2552cc==='6'){return _0x5f15ba['update']({'read':!![]});}else{logger[_0x1558('0x27')](_0x1558('0x25'),_0x1558('0x2c'),_0x1558('0x94'),util['inspect'](_0xdffcc6[_0x1558('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x5f15ba;}})['then'](respondWithResult(_0x5b76df,null))[_0x1558('0x2a')](handleError(_0x5b76df,null));};exports['addAgents']=function(_0x16ef1a,_0xac6f6c,_0x3bd38e){return db[_0x1558('0x56')][_0x1558('0x5d')]({'where':{'id':_0x16ef1a[_0x1558('0x64')]['id']}})['then'](handleEntityNotFound(_0xac6f6c,null))[_0x1558('0x20')](function(_0xca3d11){if(_0xca3d11){return _0xca3d11[_0x1558('0xdc')](_0x16ef1a[_0x1558('0x5f')]['ids'],_[_0x1558('0xa0')](_0x16ef1a[_0x1558('0x5f')],[_0x1558('0x6c'),'id'])||{})[_0x1558('0xa4')](function(_0x2218a9){for(var _0x394aa2=0x0;_0x394aa2<_0x16ef1a['body'][_0x1558('0x6c')][_0x1558('0x6a')];_0x394aa2+=0x1){socket['emit'](_0x1558('0xdd'),{'UserId':Number(_0x16ef1a[_0x1558('0x5f')][_0x1558('0x6c')][_0x394aa2]),'SmsAccountId':Number(_0x16ef1a[_0x1558('0x64')]['id'])});}return _0x2218a9;});}})[_0x1558('0x20')](respondWithResult(_0xac6f6c,null))['catch'](handleError(_0xac6f6c,null));};exports[_0x1558('0xde')]=function(_0x3df507,_0x2fa706,_0x3ea0ab){return db[_0x1558('0x56')][_0x1558('0x5d')]({'where':{'id':_0x3df507[_0x1558('0x64')]['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x2fa706,null))[_0x1558('0x20')](function(_0x54248a){if(_0x54248a){return _0x54248a['removeAgents'](_0x3df507['query'][_0x1558('0x6c')])[_0x1558('0x20')](function(){if(_['isArray'](_0x3df507[_0x1558('0x45')][_0x1558('0x6c')])){for(var _0x566f87=0x0;_0x566f87<_0x3df507[_0x1558('0x45')][_0x1558('0x6c')]['length'];_0x566f87+=0x1){socket[_0x1558('0xdf')](_0x1558('0xe0'),{'UserId':Number(_0x3df507[_0x1558('0x45')]['ids'][_0x566f87]),'SmsAccountId':Number(_0x3df507[_0x1558('0x64')]['id'])});}}else{socket['emit'](_0x1558('0xe0'),{'UserId':Number(_0x3df507[_0x1558('0x45')][_0x1558('0x6c')]),'SmsAccountId':Number(_0x3df507[_0x1558('0x64')]['id'])});}});}})[_0x1558('0x20')](respondWithStatusCode(_0x2fa706,null))['catch'](handleError(_0x2fa706,null));};exports[_0x1558('0xe1')]=function(_0x557917,_0x5cc825,_0x3d15a1){var _0x29611b={};var _0x5dcb36={};var _0x18f8eb;var _0x4a734d;return db[_0x1558('0x56')]['findOne']({'where':{'id':_0x557917[_0x1558('0x64')]['id']}})[_0x1558('0x20')](handleEntityNotFound(_0x5cc825,null))[_0x1558('0x20')](function(_0x3584bc){if(_0x3584bc){_0x18f8eb=_0x3584bc;_0x5dcb36[_0x1558('0x48')]=_[_0x1558('0x5c')](db[_0x1558('0xbd')][_0x1558('0x71')]);_0x5dcb36['query']=_[_0x1558('0x5c')](_0x557917[_0x1558('0x45')]);_0x5dcb36[_0x1558('0x46')]=_[_0x1558('0x47')](_0x5dcb36['model'],_0x5dcb36[_0x1558('0x45')]);_0x29611b[_0x1558('0x49')]=_[_0x1558('0x47')](_0x5dcb36[_0x1558('0x48')],qs[_0x1558('0x4a')](_0x557917[_0x1558('0x45')][_0x1558('0x4a')]));_0x29611b['attributes']=_0x29611b[_0x1558('0x49')][_0x1558('0x6a')]?_0x29611b[_0x1558('0x49')]:_0x5dcb36[_0x1558('0x48')];_0x29611b[_0x1558('0x4d')]=qs[_0x1558('0x4e')](_0x557917[_0x1558('0x45')][_0x1558('0x4e')]);_0x29611b[_0x1558('0x51')]=qs['filters'](_[_0x1558('0x4f')](_0x557917[_0x1558('0x45')],_0x5dcb36['filters']));if(_0x557917[_0x1558('0x45')][_0x1558('0x50')]){_0x29611b[_0x1558('0x51')]=_[_0x1558('0x52')](_0x29611b[_0x1558('0x51')],{'$or':_['map'](_0x29611b[_0x1558('0x49')],function(_0x36bc7a){var _0xa695f={};_0xa695f[_0x36bc7a]={'$like':'%'+_0x557917['query'][_0x1558('0x50')]+'%'};return _0xa695f;})});}_0x29611b=_[_0x1558('0x52')]({},_0x29611b,_0x557917[_0x1558('0x53')]);return _0x18f8eb['getAgents'](_0x29611b);}})[_0x1558('0x20')](function(_0x2f14d1){if(_0x2f14d1){_0x4a734d=_0x2f14d1[_0x1558('0x6a')];if(!_0x557917['query'][_0x1558('0x4b')]('nolimit')){_0x29611b[_0x1558('0x30')]=qs['limit'](_0x557917[_0x1558('0x45')][_0x1558('0x30')]);_0x29611b['offset']=qs[_0x1558('0x2e')](_0x557917[_0x1558('0x45')][_0x1558('0x2e')]);}return _0x18f8eb[_0x1558('0xe1')](_0x29611b);}})['then'](function(_0x3b5f03){if(_0x3b5f03){return _0x3b5f03?{'count':_0x4a734d,'rows':_0x3b5f03}:null;}})[_0x1558('0x20')](respondWithResult(_0x5cc825,null))[_0x1558('0x2a')](handleError(_0x5cc825,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 53e697f..dd1286d 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 _0x93ae=['update','emit','hasOwnProperty','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0xda49c,_0x321e08){var _0x1b60bc=function(_0x33afc3){while(--_0x33afc3){_0xda49c['push'](_0xda49c['shift']());}};_0x1b60bc(++_0x321e08);}(_0x93ae,0xb9));var _0xe93a=function(_0x20fbd5,_0x2cf497){_0x20fbd5=_0x20fbd5-0x0;var _0x4e3df9=_0x93ae[_0x20fbd5];return _0x4e3df9;};'use strict';var EventEmitter=require(_0xe93a('0x0'));var SmsAccount=require(_0xe93a('0x1'))['db'][_0xe93a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe93a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe93a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x33fbb9){return function(_0x53fd57,_0x37b3dc,_0x53be49){SmsAccountEvents[_0xe93a('0x5')](_0x33fbb9+':'+_0x53fd57['id'],_0x53fd57);SmsAccountEvents['emit'](_0x33fbb9,_0x53fd57);_0x53be49(null);};}for(var e in events){if(events[_0xe93a('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x701b=['emit','hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners','save'];(function(_0x266e24,_0x1c7258){var _0x747968=function(_0x1aa0c4){while(--_0x1aa0c4){_0x266e24['push'](_0x266e24['shift']());}};_0x747968(++_0x1c7258);}(_0x701b,0x154));var _0xb701=function(_0x35fa39,_0x2ae286){_0x35fa39=_0x35fa39-0x0;var _0x2059e5=_0x701b[_0x35fa39];return _0x2059e5;};'use strict';var EventEmitter=require(_0xb701('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xb701('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb701('0x2')](0x0);var events={'afterCreate':_0xb701('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xd8c10e){return function(_0x32087f,_0x5424cd,_0x289653){SmsAccountEvents[_0xb701('0x4')](_0xd8c10e+':'+_0x32087f['id'],_0x32087f);SmsAccountEvents[_0xb701('0x4')](_0xd8c10e,_0x32087f);_0x289653(null);};}for(var e in events){if(events[_0xb701('0x5')](e)){var event=events[e];SmsAccount[_0xb701('0x6')](e,emitEvent(event));}}module[_0xb701('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 dc501bb..7ffbf05 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 _0x4d77=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d77,0x96));var _0x74d7=function(_0x177438,_0xc06846){_0x177438=_0x177438-0x0;var _0x272b7d=_0x4d77[_0x177438];return _0x272b7d;};'use strict';var _=require(_0x74d7('0x0'));var util=require('util');var logger=require(_0x74d7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x74d7('0x2'));var rp=require(_0x74d7('0x3'));var fs=require('fs');var path=require(_0x74d7('0x4'));var rimraf=require(_0x74d7('0x5'));var config=require('../../config/environment');var attributes=require(_0x74d7('0x6'));module[_0x74d7('0x7')]=function(_0x7f6ef0,_0x3c002c){return _0x7f6ef0[_0x74d7('0x8')](_0x74d7('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf789=['request-promise','../../config/environment','./smsAccount.attributes','exports','SmsAccount','lodash','util','api','moment','bluebird'];(function(_0x304047,_0x397959){var _0x21c154=function(_0x5e1d75){while(--_0x5e1d75){_0x304047['push'](_0x304047['shift']());}};_0x21c154(++_0x397959);}(_0xf789,0x1ef));var _0x9f78=function(_0x3bfdb6,_0x45f813){_0x3bfdb6=_0x3bfdb6-0x0;var _0x45ffdf=_0xf789[_0x3bfdb6];return _0x45ffdf;};'use strict';var _=require(_0x9f78('0x0'));var util=require(_0x9f78('0x1'));var logger=require('../../config/logger')(_0x9f78('0x2'));var moment=require(_0x9f78('0x3'));var BPromise=require(_0x9f78('0x4'));var rp=require(_0x9f78('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f78('0x6'));var attributes=require(_0x9f78('0x7'));module[_0x9f78('0x8')]=function(_0x1698ae,_0x5fce0){return _0x1698ae['define'](_0x9f78('0x9'),attributes,{'tableName':'sms_accounts','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 c8ed7e8..51bf87d 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 _0xcb77=['raw','where','include','map','model','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','ShowSmsAccount','SmsAccount','find','options'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xcb77,0x13e));var _0x7cb7=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0xcb77[_0x242a98];return _0x580999;};'use strict';var _=require(_0x7cb7('0x0'));var util=require(_0x7cb7('0x1'));var moment=require('moment');var BPromise=require(_0x7cb7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cb7('0x3'));var db=require(_0x7cb7('0x4'))['db'];var utils=require(_0x7cb7('0x5'));var logger=require(_0x7cb7('0x6'))(_0x7cb7('0x7'));var config=require(_0x7cb7('0x8'));var jayson=require(_0x7cb7('0x9'));var client=jayson[_0x7cb7('0xa')][_0x7cb7('0xb')]({'port':0x232a});config[_0x7cb7('0xc')]=_[_0x7cb7('0xd')](config[_0x7cb7('0xc')],{'host':_0x7cb7('0xe'),'port':0x18eb});var socket=require(_0x7cb7('0xf'))(new Redis(config['redis']));require(_0x7cb7('0x10'))['register'](socket);function respondWithRpcPromise(_0x14d1ae,_0x5d2994,_0x1f8d70){return new BPromise(function(_0x495794,_0x3988ac){return client[_0x7cb7('0x11')](_0x14d1ae,_0x1f8d70)[_0x7cb7('0x12')](function(_0x255ee5){logger[_0x7cb7('0x13')]('SmsAccount,\x20%s,\x20%s',_0x5d2994,_0x7cb7('0x14'));logger[_0x7cb7('0x15')](_0x7cb7('0x16'),_0x5d2994,_0x7cb7('0x14'),JSON[_0x7cb7('0x17')](_0x255ee5));if(_0x255ee5[_0x7cb7('0x18')]){if(_0x255ee5[_0x7cb7('0x18')][_0x7cb7('0x19')]===0x1f4){logger[_0x7cb7('0x18')](_0x7cb7('0x1a'),_0x5d2994,_0x255ee5[_0x7cb7('0x18')][_0x7cb7('0x1b')]);return _0x3988ac(_0x255ee5[_0x7cb7('0x18')][_0x7cb7('0x1b')]);}logger[_0x7cb7('0x18')](_0x7cb7('0x1a'),_0x5d2994,_0x255ee5[_0x7cb7('0x18')][_0x7cb7('0x1b')]);return _0x495794(_0x255ee5[_0x7cb7('0x18')][_0x7cb7('0x1b')]);}else{logger['info'](_0x7cb7('0x1a'),_0x5d2994,_0x7cb7('0x14'));_0x495794(_0x255ee5['result']['message']);}})[_0x7cb7('0x1c')](function(_0x40383a){logger[_0x7cb7('0x18')](_0x7cb7('0x1a'),_0x5d2994,_0x40383a);_0x3988ac(_0x40383a);});});}exports[_0x7cb7('0x1d')]=function(_0x404c63){var _0x2cefca=this;return new Promise(function(_0x4aba95,_0x518b95){return db[_0x7cb7('0x1e')][_0x7cb7('0x1f')]({'raw':_0x404c63[_0x7cb7('0x20')]?_0x404c63[_0x7cb7('0x20')][_0x7cb7('0x21')]===undefined?!![]:![]:!![],'where':_0x404c63[_0x7cb7('0x20')]?_0x404c63['options'][_0x7cb7('0x22')]||null:null,'attributes':_0x404c63['options']?_0x404c63[_0x7cb7('0x20')]['attributes']||null:null,'include':_0x404c63['options']?_0x404c63['options'][_0x7cb7('0x23')]?_[_0x7cb7('0x24')](_0x404c63[_0x7cb7('0x20')]['include'],function(_0x23e8cc){return{'model':db[_0x23e8cc[_0x7cb7('0x25')]],'as':_0x23e8cc['as'],'attributes':_0x23e8cc[_0x7cb7('0x26')],'include':_0x23e8cc['include']?_[_0x7cb7('0x24')](_0x23e8cc['include'],function(_0x189a2a){return{'model':db[_0x189a2a[_0x7cb7('0x25')]],'as':_0x189a2a['as'],'attributes':_0x189a2a[_0x7cb7('0x26')],'include':_0x189a2a[_0x7cb7('0x23')]?_['map'](_0x189a2a[_0x7cb7('0x23')],function(_0x48b8e5){return{'model':db[_0x48b8e5[_0x7cb7('0x25')]],'as':_0x48b8e5['as'],'attributes':_0x48b8e5[_0x7cb7('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd8acbc){logger[_0x7cb7('0x13')](_0x7cb7('0x1d'),_0x404c63);logger[_0x7cb7('0x15')](_0x7cb7('0x1d'),_0x404c63,JSON['stringify'](_0xd8acbc));_0x4aba95(_0xd8acbc);})[_0x7cb7('0x1c')](function(_0x3f340a){logger[_0x7cb7('0x18')](_0x7cb7('0x1d'),_0x3f340a[_0x7cb7('0x1b')],_0x404c63);_0x518b95(_0x2cefca[_0x7cb7('0x18')](0x1f4,_0x3f340a['message']));});});}; \ No newline at end of file +var _0xf075=['request\x20sent','stringify','error','code','message','result','catch','find','options','where','map','include','attributes','model','ShowSmsAccount','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf075,0x7b));var _0x5f07=function(_0x1888b4,_0x4ae973){_0x1888b4=_0x1888b4-0x0;var _0x59c063=_0xf075[_0x1888b4];return _0x59c063;};'use strict';var _=require(_0x5f07('0x0'));var util=require(_0x5f07('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f07('0x2'));var db=require(_0x5f07('0x3'))['db'];var utils=require(_0x5f07('0x4'));var logger=require(_0x5f07('0x5'))(_0x5f07('0x6'));var config=require(_0x5f07('0x7'));var jayson=require(_0x5f07('0x8'));var client=jayson[_0x5f07('0x9')][_0x5f07('0xa')]({'port':0x232a});config[_0x5f07('0xb')]=_['defaults'](config['redis'],{'host':_0x5f07('0xc'),'port':0x18eb});var socket=require(_0x5f07('0xd'))(new Redis(config[_0x5f07('0xb')]));require(_0x5f07('0xe'))[_0x5f07('0xf')](socket);function respondWithRpcPromise(_0x30e56d,_0x55bba2,_0x1a20af){return new BPromise(function(_0x1f2599,_0x33df94){return client[_0x5f07('0x10')](_0x30e56d,_0x1a20af)['then'](function(_0x35567d){logger[_0x5f07('0x11')](_0x5f07('0x12'),_0x55bba2,'request\x20sent');logger[_0x5f07('0x13')](_0x5f07('0x14'),_0x55bba2,_0x5f07('0x15'),JSON[_0x5f07('0x16')](_0x35567d));if(_0x35567d[_0x5f07('0x17')]){if(_0x35567d[_0x5f07('0x17')][_0x5f07('0x18')]===0x1f4){logger['error'](_0x5f07('0x12'),_0x55bba2,_0x35567d[_0x5f07('0x17')][_0x5f07('0x19')]);return _0x33df94(_0x35567d[_0x5f07('0x17')][_0x5f07('0x19')]);}logger[_0x5f07('0x17')](_0x5f07('0x12'),_0x55bba2,_0x35567d[_0x5f07('0x17')]['message']);return _0x1f2599(_0x35567d['error']['message']);}else{logger[_0x5f07('0x11')](_0x5f07('0x12'),_0x55bba2,_0x5f07('0x15'));_0x1f2599(_0x35567d[_0x5f07('0x1a')][_0x5f07('0x19')]);}})[_0x5f07('0x1b')](function(_0x8815bc){logger[_0x5f07('0x17')]('SmsAccount,\x20%s,\x20%s',_0x55bba2,_0x8815bc);_0x33df94(_0x8815bc);});});}exports['ShowSmsAccount']=function(_0x5df28c){var _0x331501=this;return new Promise(function(_0xa37b48,_0xecba27){return db['SmsAccount'][_0x5f07('0x1c')]({'raw':_0x5df28c['options']?_0x5df28c[_0x5f07('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5df28c[_0x5f07('0x1d')]?_0x5df28c['options'][_0x5f07('0x1e')]||null:null,'attributes':_0x5df28c[_0x5f07('0x1d')]?_0x5df28c[_0x5f07('0x1d')]['attributes']||null:null,'include':_0x5df28c[_0x5f07('0x1d')]?_0x5df28c[_0x5f07('0x1d')]['include']?_[_0x5f07('0x1f')](_0x5df28c[_0x5f07('0x1d')][_0x5f07('0x20')],function(_0x18d496){return{'model':db[_0x18d496['model']],'as':_0x18d496['as'],'attributes':_0x18d496[_0x5f07('0x21')],'include':_0x18d496[_0x5f07('0x20')]?_[_0x5f07('0x1f')](_0x18d496[_0x5f07('0x20')],function(_0x387c51){return{'model':db[_0x387c51[_0x5f07('0x22')]],'as':_0x387c51['as'],'attributes':_0x387c51[_0x5f07('0x21')],'include':_0x387c51[_0x5f07('0x20')]?_['map'](_0x387c51[_0x5f07('0x20')],function(_0xdbe28c){return{'model':db[_0xdbe28c[_0x5f07('0x22')]],'as':_0xdbe28c['as'],'attributes':_0xdbe28c[_0x5f07('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44011d){logger[_0x5f07('0x11')](_0x5f07('0x23'),_0x5df28c);logger[_0x5f07('0x13')]('ShowSmsAccount',_0x5df28c,JSON[_0x5f07('0x16')](_0x44011d));_0xa37b48(_0x44011d);})['catch'](function(_0x140201){logger[_0x5f07('0x17')](_0x5f07('0x23'),_0x140201['message'],_0x5df28c);_0xecba27(_0x331501['error'](0x1f4,_0x140201['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2f553c1..b9d64ad 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 6fde8ab..22b1d2a 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 _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(_0x309b7c,_0x1e8e3a){var _0x2b3f88=function(_0xa9361c){while(--_0xa9361c){_0x309b7c['push'](_0x309b7c['shift']());}};_0x2b3f88(++_0x1e8e3a);}(_0xedd9,0xfc));var _0x9edd=function(_0x2af063,_0x1c9153){_0x2af063=_0x2af063-0x0;var _0x108850=_0xedd9[_0x2af063];return _0x108850;};'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 +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x89de20,_0x182ee0){var _0x457d64=function(_0x17c327){while(--_0x17c327){_0x89de20['push'](_0x89de20['shift']());}};_0x457d64(++_0x182ee0);}(_0x3e74,0x175));var _0x43e7=function(_0xefc6d8,_0x3339fc){_0xefc6d8=_0xefc6d8-0x0;var _0x12949=_0x3e74[_0xefc6d8];return _0x12949;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 8c58d30..53a82a0 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 _0xf4af=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x577e6b,_0x386e5b){var _0x55367b=function(_0x5109d0){while(--_0x5109d0){_0x577e6b['push'](_0x577e6b['shift']());}};_0x55367b(++_0x386e5b);}(_0xf4af,0x96));var _0xff4a=function(_0x29fefa,_0x3c9ba0){_0x29fefa=_0x29fefa-0x0;var _0x530b05=_0xf4af[_0x29fefa];return _0x530b05;};'use strict';var Sequelize=require('sequelize');module[_0xff4a('0x0')]={'priority':{'type':Sequelize[_0xff4a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xff4a('0x2')],'allowNull':![],'defaultValue':_0xff4a('0x3')},'appdata':{'type':Sequelize[_0xff4a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xff4a('0x2')],'defaultValue':_0xff4a('0x5')}}; \ No newline at end of file +var _0x5e01=['noop','TEXT','sequelize','STRING'];(function(_0x1cc211,_0x4856f1){var _0x5df05a=function(_0xc641cb){while(--_0xc641cb){_0x1cc211['push'](_0x1cc211['shift']());}};_0x5df05a(++_0x4856f1);}(_0x5e01,0x72));var _0x15e0=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x5e01[_0x5d07ff];return _0x5226ad;};'use strict';var Sequelize=require(_0x15e0('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x15e0('0x1')],'allowNull':![],'defaultValue':_0x15e0('0x2')},'appdata':{'type':Sequelize[_0x15e0('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x15e0('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index f6d5b11..6423169 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 _0x877f=['includeAll','SmsApplication','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','order','sort','filter','where','merge','options'];(function(_0x3c8d98,_0x15ed9a){var _0x1b5dbf=function(_0x2509d3){while(--_0x2509d3){_0x3c8d98['push'](_0x3c8d98['shift']());}};_0x1b5dbf(++_0x15ed9a);}(_0x877f,0x1ee));var _0xf877=function(_0x200cc0,_0x576f55){_0x200cc0=_0x200cc0-0x0;var _0xc5c1d8=_0x877f[_0x200cc0];return _0xc5c1d8;};'use strict';var emlformat=require(_0xf877('0x0'));var rimraf=require(_0xf877('0x1'));var zipdir=require(_0xf877('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf877('0x3'));var moment=require(_0xf877('0x4'));var BPromise=require(_0xf877('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf877('0x6'));var sox=require(_0xf877('0x7'));var csv=require('to-csv');var ejs=require(_0xf877('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf877('0x9'));var squel=require('squel');var crypto=require(_0xf877('0xa'));var jsforce=require(_0xf877('0xb'));var deskjs=require(_0xf877('0xc'));var toCsv=require(_0xf877('0xd'));var querystring=require('querystring');var Papa=require(_0xf877('0xe'));var Redis=require(_0xf877('0xf'));var authService=require(_0xf877('0x10'));var qs=require(_0xf877('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf877('0x12'))(_0xf877('0x13'));var utils=require('../../config/utils');var config=require(_0xf877('0x14'));var licenseUtil=require(_0xf877('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40a6c9,_0x3faac0){_0x3faac0=_0x3faac0||0xcc;return function(_0x13bf51){if(_0x13bf51){return _0x40a6c9[_0xf877('0x16')](_0x3faac0);}return _0x40a6c9[_0xf877('0x17')](_0x3faac0)[_0xf877('0x18')]();};}function respondWithResult(_0x4c58dd,_0x3ea26a){_0x3ea26a=_0x3ea26a||0xc8;return function(_0xd7e745){if(_0xd7e745){return _0x4c58dd['status'](_0x3ea26a)[_0xf877('0x19')](_0xd7e745);}};}function respondWithFilteredResult(_0x2c9d48,_0x5f43a3){return function(_0x16beb7){if(_0x16beb7){var _0x3a9529=typeof _0x5f43a3[_0xf877('0x1a')]==='undefined'&&typeof _0x5f43a3[_0xf877('0x1b')]==='undefined';var _0x143f31=_0x16beb7['count'];var _0x939d5=_0x3a9529?0x0:_0x5f43a3['offset'];var _0x3cece2=_0x3a9529?_0x16beb7[_0xf877('0x1c')]:_0x5f43a3[_0xf877('0x1a')]+_0x5f43a3['limit'];var _0x52cef2;if(_0x3cece2>=_0x143f31){_0x3cece2=_0x143f31;_0x52cef2=0xc8;}else{_0x52cef2=0xce;}_0x2c9d48['status'](_0x52cef2);return _0x2c9d48['set'](_0xf877('0x1d'),_0x939d5+'-'+_0x3cece2+'/'+_0x143f31)['json'](_0x16beb7);}return null;};}function patchUpdates(_0x45791d){return function(_0x50c4a5){try{jsonpatch[_0xf877('0x1e')](_0x50c4a5,_0x45791d,!![]);}catch(_0x16575d){return BPromise[_0xf877('0x1f')](_0x16575d);}return _0x50c4a5[_0xf877('0x20')]();};}function saveUpdates(_0x2b60ec,_0x3c4c92){return function(_0x578a85){if(_0x578a85){return _0x578a85[_0xf877('0x21')](_0x2b60ec)[_0xf877('0x22')](function(_0x1c0cd3){return _0x1c0cd3;});}return null;};}function removeEntity(_0x24617f,_0x579e02){return function(_0x400a2b){if(_0x400a2b){return _0x400a2b[_0xf877('0x23')]()[_0xf877('0x22')](function(){_0x24617f['status'](0xcc)[_0xf877('0x18')]();});}};}function handleEntityNotFound(_0x5d9e9e,_0x5c8ccc){return function(_0x30bdc4){if(!_0x30bdc4){_0x5d9e9e[_0xf877('0x16')](0x194);}return _0x30bdc4;};}function handleError(_0xcf47f1,_0x1d98d7){_0x1d98d7=_0x1d98d7||0x1f4;return function(_0x1fd62b){logger[_0xf877('0x24')](_0x1fd62b[_0xf877('0x25')]);if(_0x1fd62b[_0xf877('0x26')]){delete _0x1fd62b[_0xf877('0x26')];}_0xcf47f1[_0xf877('0x17')](_0x1d98d7)[_0xf877('0x27')](_0x1fd62b);};}exports[_0xf877('0x28')]=function(_0x313570,_0x1a8b65){var _0x46a5e3={},_0x173dc9={},_0x3cfc9a={'count':0x0,'rows':[]};var _0x141249=_[_0xf877('0x29')](db['SmsApplication'][_0xf877('0x2a')],function(_0x4f7c24){return{'name':_0x4f7c24[_0xf877('0x2b')],'type':_0x4f7c24[_0xf877('0x2c')]['key']};});_0x173dc9[_0xf877('0x2d')]=_[_0xf877('0x29')](_0x141249,_0xf877('0x26'));_0x173dc9[_0xf877('0x2e')]=_[_0xf877('0x2f')](_0x313570[_0xf877('0x2e')]);_0x173dc9[_0xf877('0x30')]=_[_0xf877('0x31')](_0x173dc9[_0xf877('0x2d')],_0x173dc9['query']);_0x46a5e3['attributes']=_[_0xf877('0x31')](_0x173dc9['model'],qs[_0xf877('0x32')](_0x313570[_0xf877('0x2e')][_0xf877('0x32')]));_0x46a5e3[_0xf877('0x33')]=_0x46a5e3[_0xf877('0x33')]['length']?_0x46a5e3['attributes']:_0x173dc9['model'];if(!_0x313570[_0xf877('0x2e')]['hasOwnProperty']('nolimit')){_0x46a5e3['limit']=qs[_0xf877('0x1b')](_0x313570[_0xf877('0x2e')][_0xf877('0x1b')]);_0x46a5e3[_0xf877('0x1a')]=qs[_0xf877('0x1a')](_0x313570['query'][_0xf877('0x1a')]);}_0x46a5e3[_0xf877('0x34')]=qs[_0xf877('0x35')](_0x313570[_0xf877('0x2e')][_0xf877('0x35')]);_0x46a5e3['where']=qs['filters'](_['pick'](_0x313570[_0xf877('0x2e')],_0x173dc9[_0xf877('0x30')]),_0x141249);if(_0x313570[_0xf877('0x2e')][_0xf877('0x36')]){_0x46a5e3[_0xf877('0x37')]=_[_0xf877('0x38')](_0x46a5e3[_0xf877('0x37')],{'$or':_[_0xf877('0x29')](_0x141249,function(_0x35514e){if(_0x35514e[_0xf877('0x2c')]!=='VIRTUAL'){var _0x574a1d={};_0x574a1d[_0x35514e[_0xf877('0x26')]]={'$like':'%'+_0x313570[_0xf877('0x2e')][_0xf877('0x36')]+'%'};return _0x574a1d;}})});}_0x46a5e3=_[_0xf877('0x38')]({},_0x46a5e3,_0x313570[_0xf877('0x39')]);var _0x2efb38={'where':_0x46a5e3[_0xf877('0x37')]};return db['SmsApplication']['count'](_0x2efb38)[_0xf877('0x22')](function(_0x570c93){_0x3cfc9a[_0xf877('0x1c')]=_0x570c93;if(_0x313570[_0xf877('0x2e')][_0xf877('0x3a')]){_0x46a5e3['include']=[{'all':!![]}];}return db[_0xf877('0x3b')]['findAll'](_0x46a5e3);})[_0xf877('0x22')](function(_0x242ca2){_0x3cfc9a[_0xf877('0x3c')]=_0x242ca2;return _0x3cfc9a;})[_0xf877('0x22')](respondWithFilteredResult(_0x1a8b65,_0x46a5e3))[_0xf877('0x3d')](handleError(_0x1a8b65,null));};exports[_0xf877('0x3e')]=function(_0x540f27,_0x397d46){var _0x112a9f={'raw':!![],'where':{'id':_0x540f27[_0xf877('0x3f')]['id']}},_0x161a9a={};_0x161a9a['model']=_[_0xf877('0x2f')](db['SmsApplication'][_0xf877('0x2a')]);_0x161a9a[_0xf877('0x2e')]=_[_0xf877('0x2f')](_0x540f27[_0xf877('0x2e')]);_0x161a9a[_0xf877('0x30')]=_[_0xf877('0x31')](_0x161a9a[_0xf877('0x2d')],_0x161a9a[_0xf877('0x2e')]);_0x112a9f['attributes']=_[_0xf877('0x31')](_0x161a9a[_0xf877('0x2d')],qs[_0xf877('0x32')](_0x540f27['query'][_0xf877('0x32')]));_0x112a9f['attributes']=_0x112a9f[_0xf877('0x33')][_0xf877('0x40')]?_0x112a9f[_0xf877('0x33')]:_0x161a9a[_0xf877('0x2d')];if(_0x540f27[_0xf877('0x2e')]['includeAll']){_0x112a9f[_0xf877('0x41')]=[{'all':!![]}];}_0x112a9f=_[_0xf877('0x38')]({},_0x112a9f,_0x540f27['options']);return db[_0xf877('0x3b')][_0xf877('0x42')](_0x112a9f)[_0xf877('0x22')](handleEntityNotFound(_0x397d46,null))['then'](respondWithResult(_0x397d46,null))[_0xf877('0x3d')](handleError(_0x397d46,null));};exports['create']=function(_0xfd5786,_0x3eb9ba){return db[_0xf877('0x3b')][_0xf877('0x43')](_0xfd5786[_0xf877('0x44')],{})[_0xf877('0x22')](respondWithResult(_0x3eb9ba,0xc9))[_0xf877('0x3d')](handleError(_0x3eb9ba,null));};exports['update']=function(_0x14076d,_0x4cda68){if(_0x14076d['body']['id']){delete _0x14076d['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x14076d[_0xf877('0x3f')]['id']}})[_0xf877('0x22')](handleEntityNotFound(_0x4cda68,null))[_0xf877('0x22')](saveUpdates(_0x14076d['body'],null))[_0xf877('0x22')](respondWithResult(_0x4cda68,null))[_0xf877('0x3d')](handleError(_0x4cda68,null));};exports[_0xf877('0x23')]=function(_0x34e12b,_0x56cbc8){return db[_0xf877('0x3b')][_0xf877('0x42')]({'where':{'id':_0x34e12b[_0xf877('0x3f')]['id']}})[_0xf877('0x22')](handleEntityNotFound(_0x56cbc8,null))[_0xf877('0x22')](removeEntity(_0x56cbc8,null))[_0xf877('0x3d')](handleError(_0x56cbc8,null));}; \ No newline at end of file +var _0x557c=['stack','name','send','index','map','SmsApplication','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','save','destroy','then','error'];(function(_0x593f35,_0x1a365b){var _0x2e9122=function(_0x30c7ec){while(--_0x30c7ec){_0x593f35['push'](_0x593f35['shift']());}};_0x2e9122(++_0x1a365b);}(_0x557c,0x6e));var _0xc557=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x557c[_0x52666e];return _0x515330;};'use strict';var emlformat=require(_0xc557('0x0'));var rimraf=require(_0xc557('0x1'));var zipdir=require(_0xc557('0x2'));var jsonpatch=require(_0xc557('0x3'));var rp=require(_0xc557('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc557('0x5'));var util=require(_0xc557('0x6'));var path=require(_0xc557('0x7'));var sox=require(_0xc557('0x8'));var csv=require(_0xc557('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc557('0xa'));var squel=require(_0xc557('0xb'));var crypto=require(_0xc557('0xc'));var jsforce=require(_0xc557('0xd'));var deskjs=require(_0xc557('0xe'));var toCsv=require(_0xc557('0x9'));var querystring=require(_0xc557('0xf'));var Papa=require(_0xc557('0x10'));var Redis=require('ioredis');var authService=require(_0xc557('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc557('0x12'));var hardwareService=require(_0xc557('0x13'));var logger=require(_0xc557('0x14'))(_0xc557('0x15'));var utils=require(_0xc557('0x16'));var config=require(_0xc557('0x17'));var licenseUtil=require(_0xc557('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d14f1,_0x1cf02b){_0x1cf02b=_0x1cf02b||0xcc;return function(_0x50a423){if(_0x50a423){return _0x3d14f1[_0xc557('0x19')](_0x1cf02b);}return _0x3d14f1[_0xc557('0x1a')](_0x1cf02b)[_0xc557('0x1b')]();};}function respondWithResult(_0x36c6d2,_0x2a4df2){_0x2a4df2=_0x2a4df2||0xc8;return function(_0x36063e){if(_0x36063e){return _0x36c6d2['status'](_0x2a4df2)[_0xc557('0x1c')](_0x36063e);}};}function respondWithFilteredResult(_0x16a27a,_0x3fad00){return function(_0x98de5f){if(_0x98de5f){var _0x122e6b=typeof _0x3fad00[_0xc557('0x1d')]==='undefined'&&typeof _0x3fad00[_0xc557('0x1e')]==='undefined';var _0xfffcac=_0x98de5f[_0xc557('0x1f')];var _0x446aff=_0x122e6b?0x0:_0x3fad00['offset'];var _0x15a605=_0x122e6b?_0x98de5f[_0xc557('0x1f')]:_0x3fad00[_0xc557('0x1d')]+_0x3fad00[_0xc557('0x1e')];var _0x3f175d;if(_0x15a605>=_0xfffcac){_0x15a605=_0xfffcac;_0x3f175d=0xc8;}else{_0x3f175d=0xce;}_0x16a27a[_0xc557('0x1a')](_0x3f175d);return _0x16a27a[_0xc557('0x20')]('Content-Range',_0x446aff+'-'+_0x15a605+'/'+_0xfffcac)[_0xc557('0x1c')](_0x98de5f);}return null;};}function patchUpdates(_0x503e73){return function(_0x522f44){try{jsonpatch[_0xc557('0x21')](_0x522f44,_0x503e73,!![]);}catch(_0x21f2e2){return BPromise['reject'](_0x21f2e2);}return _0x522f44[_0xc557('0x22')]();};}function saveUpdates(_0x5dc0c8,_0x11284c){return function(_0x3476e6){if(_0x3476e6){return _0x3476e6['update'](_0x5dc0c8)['then'](function(_0x2eb7fe){return _0x2eb7fe;});}return null;};}function removeEntity(_0x24c8b7,_0x376260){return function(_0x46d331){if(_0x46d331){return _0x46d331[_0xc557('0x23')]()[_0xc557('0x24')](function(){_0x24c8b7[_0xc557('0x1a')](0xcc)[_0xc557('0x1b')]();});}};}function handleEntityNotFound(_0x3a36f6,_0x151ac){return function(_0x1bc703){if(!_0x1bc703){_0x3a36f6['sendStatus'](0x194);}return _0x1bc703;};}function handleError(_0x3759b5,_0xfba922){_0xfba922=_0xfba922||0x1f4;return function(_0x3b1c26){logger[_0xc557('0x25')](_0x3b1c26[_0xc557('0x26')]);if(_0x3b1c26[_0xc557('0x27')]){delete _0x3b1c26['name'];}_0x3759b5[_0xc557('0x1a')](_0xfba922)[_0xc557('0x28')](_0x3b1c26);};}exports[_0xc557('0x29')]=function(_0x473934,_0x50bdb9){var _0x593428={},_0x1132cc={},_0x11c292={'count':0x0,'rows':[]};var _0x267e11=_[_0xc557('0x2a')](db[_0xc557('0x2b')][_0xc557('0x2c')],function(_0x5ec086){return{'name':_0x5ec086['fieldName'],'type':_0x5ec086[_0xc557('0x2d')][_0xc557('0x2e')]};});_0x1132cc['model']=_[_0xc557('0x2a')](_0x267e11,_0xc557('0x27'));_0x1132cc[_0xc557('0x2f')]=_[_0xc557('0x30')](_0x473934[_0xc557('0x2f')]);_0x1132cc[_0xc557('0x31')]=_[_0xc557('0x32')](_0x1132cc['model'],_0x1132cc[_0xc557('0x2f')]);_0x593428[_0xc557('0x33')]=_[_0xc557('0x32')](_0x1132cc[_0xc557('0x34')],qs[_0xc557('0x35')](_0x473934['query']['fields']));_0x593428[_0xc557('0x33')]=_0x593428[_0xc557('0x33')][_0xc557('0x36')]?_0x593428[_0xc557('0x33')]:_0x1132cc[_0xc557('0x34')];if(!_0x473934['query'][_0xc557('0x37')]('nolimit')){_0x593428[_0xc557('0x1e')]=qs[_0xc557('0x1e')](_0x473934[_0xc557('0x2f')][_0xc557('0x1e')]);_0x593428['offset']=qs['offset'](_0x473934[_0xc557('0x2f')][_0xc557('0x1d')]);}_0x593428[_0xc557('0x38')]=qs[_0xc557('0x39')](_0x473934[_0xc557('0x2f')][_0xc557('0x39')]);_0x593428[_0xc557('0x3a')]=qs['filters'](_['pick'](_0x473934['query'],_0x1132cc[_0xc557('0x31')]),_0x267e11);if(_0x473934[_0xc557('0x2f')]['filter']){_0x593428[_0xc557('0x3a')]=_[_0xc557('0x3b')](_0x593428[_0xc557('0x3a')],{'$or':_[_0xc557('0x2a')](_0x267e11,function(_0x54a9fe){if(_0x54a9fe[_0xc557('0x2d')]!==_0xc557('0x3c')){var _0x489ea5={};_0x489ea5[_0x54a9fe[_0xc557('0x27')]]={'$like':'%'+_0x473934[_0xc557('0x2f')][_0xc557('0x3d')]+'%'};return _0x489ea5;}})});}_0x593428=_[_0xc557('0x3b')]({},_0x593428,_0x473934[_0xc557('0x3e')]);var _0x604089={'where':_0x593428['where']};return db[_0xc557('0x2b')]['count'](_0x604089)['then'](function(_0x37207d){_0x11c292[_0xc557('0x1f')]=_0x37207d;if(_0x473934['query'][_0xc557('0x3f')]){_0x593428['include']=[{'all':!![]}];}return db['SmsApplication'][_0xc557('0x40')](_0x593428);})[_0xc557('0x24')](function(_0x54d523){_0x11c292[_0xc557('0x41')]=_0x54d523;return _0x11c292;})[_0xc557('0x24')](respondWithFilteredResult(_0x50bdb9,_0x593428))[_0xc557('0x42')](handleError(_0x50bdb9,null));};exports[_0xc557('0x43')]=function(_0x4ddee6,_0x261943){var _0x3db1a8={'raw':!![],'where':{'id':_0x4ddee6[_0xc557('0x44')]['id']}},_0x35b8ec={};_0x35b8ec['model']=_['keys'](db[_0xc557('0x2b')][_0xc557('0x2c')]);_0x35b8ec[_0xc557('0x2f')]=_['keys'](_0x4ddee6[_0xc557('0x2f')]);_0x35b8ec[_0xc557('0x31')]=_[_0xc557('0x32')](_0x35b8ec['model'],_0x35b8ec[_0xc557('0x2f')]);_0x3db1a8[_0xc557('0x33')]=_[_0xc557('0x32')](_0x35b8ec[_0xc557('0x34')],qs[_0xc557('0x35')](_0x4ddee6[_0xc557('0x2f')][_0xc557('0x35')]));_0x3db1a8[_0xc557('0x33')]=_0x3db1a8[_0xc557('0x33')][_0xc557('0x36')]?_0x3db1a8['attributes']:_0x35b8ec[_0xc557('0x34')];if(_0x4ddee6['query'][_0xc557('0x3f')]){_0x3db1a8[_0xc557('0x45')]=[{'all':!![]}];}_0x3db1a8=_['merge']({},_0x3db1a8,_0x4ddee6[_0xc557('0x3e')]);return db['SmsApplication']['find'](_0x3db1a8)[_0xc557('0x24')](handleEntityNotFound(_0x261943,null))[_0xc557('0x24')](respondWithResult(_0x261943,null))['catch'](handleError(_0x261943,null));};exports[_0xc557('0x46')]=function(_0x26d2ad,_0x408bb3){return db[_0xc557('0x2b')][_0xc557('0x46')](_0x26d2ad[_0xc557('0x47')],{})[_0xc557('0x24')](respondWithResult(_0x408bb3,0xc9))['catch'](handleError(_0x408bb3,null));};exports[_0xc557('0x48')]=function(_0x2a6a6c,_0x5c3609){if(_0x2a6a6c['body']['id']){delete _0x2a6a6c['body']['id'];}return db['SmsApplication'][_0xc557('0x49')]({'where':{'id':_0x2a6a6c['params']['id']}})[_0xc557('0x24')](handleEntityNotFound(_0x5c3609,null))[_0xc557('0x24')](saveUpdates(_0x2a6a6c[_0xc557('0x47')],null))[_0xc557('0x24')](respondWithResult(_0x5c3609,null))['catch'](handleError(_0x5c3609,null));};exports[_0xc557('0x23')]=function(_0x2e4fd5,_0x6b0ec1){return db[_0xc557('0x2b')]['find']({'where':{'id':_0x2e4fd5[_0xc557('0x44')]['id']}})[_0xc557('0x24')](handleEntityNotFound(_0x6b0ec1,null))['then'](removeEntity(_0x6b0ec1,null))[_0xc557('0x42')](handleError(_0x6b0ec1,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index fa15bf5..96d61b7 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 _0x37ba=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0xff7c05,_0x2456ca){var _0x1c1ab9=function(_0x187d56){while(--_0x187d56){_0xff7c05['push'](_0xff7c05['shift']());}};_0x1c1ab9(++_0x2456ca);}(_0x37ba,0x113));var _0xa37b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x37ba[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xa37b('0x0'));var util=require('util');var logger=require(_0xa37b('0x1'))('api');var moment=require(_0xa37b('0x2'));var BPromise=require('bluebird');var rp=require(_0xa37b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa37b('0x4'));var config=require(_0xa37b('0x5'));var attributes=require(_0xa37b('0x6'));module[_0xa37b('0x7')]=function(_0x4e070c,_0x33fd7d){return _0x4e070c[_0xa37b('0x8')](_0xa37b('0x9'),attributes,{'tableName':_0xa37b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa37b('0xb'),'collate':_0xa37b('0xc')});}; \ No newline at end of file +var _0x048f=['sms_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication'];(function(_0x35bdcf,_0x21421c){var _0x5a4fc7=function(_0x374f22){while(--_0x374f22){_0x35bdcf['push'](_0x35bdcf['shift']());}};_0x5a4fc7(++_0x21421c);}(_0x048f,0x1e4));var _0xf048=function(_0x2b1bcf,_0x2c43d3){_0x2b1bcf=_0x2b1bcf-0x0;var _0xee11c0=_0x048f[_0x2b1bcf];return _0xee11c0;};'use strict';var _=require('lodash');var util=require(_0xf048('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf048('0x1'));var BPromise=require(_0xf048('0x2'));var rp=require(_0xf048('0x3'));var fs=require('fs');var path=require(_0xf048('0x4'));var rimraf=require(_0xf048('0x5'));var config=require(_0xf048('0x6'));var attributes=require(_0xf048('0x7'));module[_0xf048('0x8')]=function(_0x535615,_0x4f0c6e){return _0x535615['define'](_0xf048('0x9'),attributes,{'tableName':_0xf048('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf048('0xb'),'collate':_0xf048('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 558ed8c..7a4e650 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 _0x500c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x500c,0x188));var _0xc500=function(_0x394c65,_0x4c04b2){_0x394c65=_0x394c65-0x0;var _0x4c5359=_0x500c[_0x394c65];return _0x4c5359;};'use strict';var _=require(_0xc500('0x0'));var util=require(_0xc500('0x1'));var moment=require(_0xc500('0x2'));var BPromise=require(_0xc500('0x3'));var rs=require(_0xc500('0x4'));var fs=require('fs');var Redis=require(_0xc500('0x5'));var db=require(_0xc500('0x6'))['db'];var utils=require(_0xc500('0x7'));var logger=require(_0xc500('0x8'))(_0xc500('0x9'));var config=require(_0xc500('0xa'));var jayson=require(_0xc500('0xb'));var client=jayson[_0xc500('0xc')][_0xc500('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3bc410,_0x5dd365,_0x297252){return new BPromise(function(_0x480a10,_0x3cf7f9){return client[_0xc500('0xe')](_0x3bc410,_0x297252)[_0xc500('0xf')](function(_0x3b40f2){logger[_0xc500('0x10')](_0xc500('0x11'),_0x5dd365,'request\x20sent');logger[_0xc500('0x12')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x5dd365,_0xc500('0x13'),JSON['stringify'](_0x3b40f2));if(_0x3b40f2['error']){if(_0x3b40f2[_0xc500('0x14')][_0xc500('0x15')]===0x1f4){logger['error'](_0xc500('0x11'),_0x5dd365,_0x3b40f2[_0xc500('0x14')][_0xc500('0x16')]);return _0x3cf7f9(_0x3b40f2[_0xc500('0x14')][_0xc500('0x16')]);}logger[_0xc500('0x14')](_0xc500('0x11'),_0x5dd365,_0x3b40f2[_0xc500('0x14')]['message']);return _0x480a10(_0x3b40f2[_0xc500('0x14')][_0xc500('0x16')]);}else{logger['info'](_0xc500('0x11'),_0x5dd365,_0xc500('0x13'));_0x480a10(_0x3b40f2[_0xc500('0x17')][_0xc500('0x16')]);}})[_0xc500('0x18')](function(_0x369271){logger[_0xc500('0x14')]('SmsApplication,\x20%s,\x20%s',_0x5dd365,_0x369271);_0x3cf7f9(_0x369271);});});} \ No newline at end of file +var _0xb5f3=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring'];(function(_0x55e3e6,_0x1376e4){var _0x4f3722=function(_0xb385cf){while(--_0xb385cf){_0x55e3e6['push'](_0x55e3e6['shift']());}};_0x4f3722(++_0x1376e4);}(_0xb5f3,0x137));var _0x3b5f=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0xb5f3[_0x25c326];return _0x762452;};'use strict';var _=require(_0x3b5f('0x0'));var util=require(_0x3b5f('0x1'));var moment=require(_0x3b5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b5f('0x3'));var fs=require('fs');var Redis=require(_0x3b5f('0x4'));var db=require(_0x3b5f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b5f('0x6'));var config=require(_0x3b5f('0x7'));var jayson=require(_0x3b5f('0x8'));var client=jayson[_0x3b5f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2db4ad,_0x1b6d67,_0x4edb1a){return new BPromise(function(_0x2e213c,_0x48597e){return client[_0x3b5f('0xa')](_0x2db4ad,_0x4edb1a)[_0x3b5f('0xb')](function(_0x2c37f6){logger[_0x3b5f('0xc')]('SmsApplication,\x20%s,\x20%s',_0x1b6d67,_0x3b5f('0xd'));logger[_0x3b5f('0xe')](_0x3b5f('0xf'),_0x1b6d67,_0x3b5f('0xd'),JSON[_0x3b5f('0x10')](_0x2c37f6));if(_0x2c37f6['error']){if(_0x2c37f6['error']['code']===0x1f4){logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);return _0x48597e(_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);}logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x2c37f6['error'][_0x3b5f('0x13')]);return _0x2e213c(_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);}else{logger['info'](_0x3b5f('0x12'),_0x1b6d67,'request\x20sent');_0x2e213c(_0x2c37f6[_0x3b5f('0x14')][_0x3b5f('0x13')]);}})['catch'](function(_0x28b6c1){logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x28b6c1);_0x48597e(_0x28b6c1);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c6fc1c9..9ba2322 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 _0x7916=['smsinteraction:update','update','sms','destroy','delete','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','smsinteraction:addtags','put','/:id'];(function(_0x1b5080,_0x3e7cc9){var _0x195c87=function(_0x1ef917){while(--_0x1ef917){_0x1b5080['push'](_0x1b5080['shift']());}};_0x195c87(++_0x3e7cc9);}(_0x7916,0x128));var _0x6791=function(_0x360bb1,_0x379f81){_0x360bb1=_0x360bb1-0x0;var _0x5db939=_0x7916[_0x360bb1];return _0x5db939;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['get']('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0xc')]);router['get'](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router['get'](_0x6791('0xf'),auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);router[_0x6791('0x11')]('/',auth[_0x6791('0x8')](),controller[_0x6791('0x12')]);router[_0x6791('0x11')](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0x13')]);router[_0x6791('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x6791('0x14')]('sms',_0x6791('0x15')),controller['addTags']);router[_0x6791('0x16')](_0x6791('0x17'),auth['isAuthenticated'](),interaction[_0x6791('0x14')]('sms',_0x6791('0x18')),controller[_0x6791('0x19')]);router['delete'](_0x6791('0x17'),auth[_0x6791('0x8')](),interaction['tracked'](_0x6791('0x1a'),'smsinteraction:destroy'),controller[_0x6791('0x1b')]);router[_0x6791('0x1c')](_0x6791('0x1d'),auth[_0x6791('0x8')](),controller[_0x6791('0x1e')]);module[_0x6791('0x1f')]=router; \ No newline at end of file +var _0x6cb4=['./smsInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','/:id/download','create','post','/:id/messages','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x69df00,_0x2bb9a8){var _0x2e82bc=function(_0x4f512f){while(--_0x4f512f){_0x69df00['push'](_0x69df00['shift']());}};_0x2e82bc(++_0x2bb9a8);}(_0x6cb4,0xff));var _0x46cb=function(_0x134b20,_0x40f316){_0x134b20=_0x134b20-0x0;var _0x3ad08d=_0x6cb4[_0x134b20];return _0x3ad08d;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xb')](_0x46cb('0xe'),auth['isAuthenticated'](),controller[_0x46cb('0xf')]);router[_0x46cb('0xb')]('/:id/messages',auth[_0x46cb('0xa')](),controller[_0x46cb('0x10')]);router['get'](_0x46cb('0x11'),auth[_0x46cb('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x46cb('0x12')]);router[_0x46cb('0x13')](_0x46cb('0x14'),auth[_0x46cb('0xa')](),controller['addMessage']);router[_0x46cb('0x13')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')](_0x46cb('0x17'),_0x46cb('0x18')),controller[_0x46cb('0x19')]);router[_0x46cb('0x1a')](_0x46cb('0xe'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')]('sms',_0x46cb('0x1b')),controller['update']);router[_0x46cb('0x1c')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x46cb('0x17'),_0x46cb('0x1d')),controller[_0x46cb('0x1e')]);router[_0x46cb('0x1c')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),controller[_0x46cb('0x1f')]);module[_0x46cb('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 85d0f4d..f2fff7a 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 _0xf698=['ENUM','out','sequelize','moment','BOOLEAN','DATE','STRING'];(function(_0x2687ee,_0x224164){var _0x3da903=function(_0x475413){while(--_0x475413){_0x2687ee['push'](_0x2687ee['shift']());}};_0x3da903(++_0x224164);}(_0xf698,0x1de));var _0x8f69=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xf698[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x8f69('0x0'));var moment=require(_0x8f69('0x1'));module['exports']={'closed':{'type':Sequelize[_0x8f69('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8f69('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8f69('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8f69('0x4')]},'note':{'type':Sequelize[_0x8f69('0x4')]},'phone':{'type':Sequelize[_0x8f69('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8f69('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8f69('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8f69('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9865=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9865,0x1ba));var _0x5986=function(_0x2ebf64,_0x28d567){_0x2ebf64=_0x2ebf64-0x0;var _0x4b3e84=_0x9865[_0x2ebf64];return _0x4b3e84;};'use strict';var Sequelize=require(_0x5986('0x0'));var moment=require(_0x5986('0x1'));module[_0x5986('0x2')]={'closed':{'type':Sequelize[_0x5986('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5986('0x4')]},'disposition':{'type':Sequelize[_0x5986('0x5')]},'secondDisposition':{'type':Sequelize[_0x5986('0x5')]},'thirdDisposition':{'type':Sequelize[_0x5986('0x5')]},'note':{'type':Sequelize[_0x5986('0x5')]},'phone':{'type':Sequelize[_0x5986('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5986('0x6')]('in',_0x5986('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5986('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x5986('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index fcb9134..cb1415d 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 _0x287b=['o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','it.SmsInteractionId\x20=\x20i.id','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','catch','show','params','includeAll','include','options','create','describe','SmsMessage','addMessage','ids','omit','findOne','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','Tag','smsInteractionTags:save','removeTags','root','files','tmp','server','attachments','transcript-%d-%s.zip','join','fullname','lastName','Messages','direction','SmsAccount','Owner','get','mkdirSync','Sms','Account','N.A.','closed','closedAt','disposition','out','System','firstName','secret','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','index','SmsInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','ui.SmsInteractionId','left_join','users','sms_interactions','cm_contacts'];(function(_0x5d47f0,_0xc255dd){var _0x2d2a0f=function(_0x4da5d0){while(--_0x4da5d0){_0x5d47f0['push'](_0x5d47f0['shift']());}};_0x2d2a0f(++_0xc255dd);}(_0x287b,0x96));var _0xb287=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0x287b[_0x40b493];return _0x548365;};'use strict';var emlformat=require(_0xb287('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb287('0x1'));var jsonpatch=require(_0xb287('0x2'));var rp=require(_0xb287('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb287('0x4'));var util=require('util');var path=require(_0xb287('0x5'));var sox=require('sox');var csv=require(_0xb287('0x6'));var ejs=require(_0xb287('0x7'));var fs=require('fs');var fs_extra=require(_0xb287('0x8'));var _=require(_0xb287('0x9'));var squel=require(_0xb287('0xa'));var crypto=require(_0xb287('0xb'));var jsforce=require(_0xb287('0xc'));var deskjs=require(_0xb287('0xd'));var toCsv=require(_0xb287('0x6'));var querystring=require(_0xb287('0xe'));var Papa=require(_0xb287('0xf'));var Redis=require(_0xb287('0x10'));var authService=require(_0xb287('0x11'));var qs=require(_0xb287('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xb287('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb287('0x14'));var utils=require('../../config/utils');var config=require(_0xb287('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb287('0x16')]=_[_0xb287('0x17')](config[_0xb287('0x16')],{'host':_0xb287('0x18'),'port':0x18eb});var socket=require(_0xb287('0x19'))(new Redis(config['redis']));require(_0xb287('0x1a'))[_0xb287('0x1b')](socket);function respondWithStatusCode(_0x2768ed,_0x32a1aa){_0x32a1aa=_0x32a1aa||0xcc;return function(_0x2f2a91){if(_0x2f2a91){return _0x2768ed['sendStatus'](_0x32a1aa);}return _0x2768ed[_0xb287('0x1c')](_0x32a1aa)['end']();};}function respondWithResult(_0x28c5a5,_0x1e4df3){_0x1e4df3=_0x1e4df3||0xc8;return function(_0x304f8c){if(_0x304f8c){return _0x28c5a5[_0xb287('0x1c')](_0x1e4df3)[_0xb287('0x1d')](_0x304f8c);}};}function respondWithFilteredResult(_0x387f3c,_0x11dab7){return function(_0x4705b4){if(_0x4705b4){var _0x577fa0=typeof _0x11dab7[_0xb287('0x1e')]==='undefined'&&typeof _0x11dab7[_0xb287('0x1f')]===_0xb287('0x20');var _0x1a7d9c=_0x4705b4[_0xb287('0x21')];var _0x5dcb50=_0x577fa0?0x0:_0x11dab7[_0xb287('0x1e')];var _0x334268=_0x577fa0?_0x4705b4[_0xb287('0x21')]:_0x11dab7[_0xb287('0x1e')]+_0x11dab7[_0xb287('0x1f')];var _0x5c0b78;if(_0x334268>=_0x1a7d9c){_0x334268=_0x1a7d9c;_0x5c0b78=0xc8;}else{_0x5c0b78=0xce;}_0x387f3c[_0xb287('0x1c')](_0x5c0b78);return _0x387f3c[_0xb287('0x22')](_0xb287('0x23'),_0x5dcb50+'-'+_0x334268+'/'+_0x1a7d9c)[_0xb287('0x1d')](_0x4705b4);}return null;};}function patchUpdates(_0x280474){return function(_0x61e20a){try{jsonpatch[_0xb287('0x24')](_0x61e20a,_0x280474,!![]);}catch(_0x15a7b9){return BPromise[_0xb287('0x25')](_0x15a7b9);}return _0x61e20a['save']();};}function saveUpdates(_0x157da8,_0x64c4c5){return function(_0x55e5ce){if(_0x55e5ce){return _0x55e5ce[_0xb287('0x26')](_0x157da8)[_0xb287('0x27')](function(_0x580525){return _0x580525;});}return null;};}function removeEntity(_0xbc856b,_0x5127f5){return function(_0x18c648){if(_0x18c648){return _0x18c648[_0xb287('0x28')]()['then'](function(){_0xbc856b['status'](0xcc)[_0xb287('0x29')]();});}};}function handleEntityNotFound(_0x2591ea,_0xf163d2){return function(_0x51a9a7){if(!_0x51a9a7){_0x2591ea[_0xb287('0x2a')](0x194);}return _0x51a9a7;};}function handleError(_0x27f910,_0x2a0736){_0x2a0736=_0x2a0736||0x1f4;return function(_0x1ec71b){logger[_0xb287('0x2b')](_0x1ec71b[_0xb287('0x2c')]);if(_0x1ec71b[_0xb287('0x2d')]){delete _0x1ec71b['name'];}_0x27f910[_0xb287('0x1c')](_0x2a0736)[_0xb287('0x2e')](_0x1ec71b);};}function getInteractionUsers(_0x1d4a15,_0x36b846){return new BPromise(function(_0x114d56,_0x284c1a){try{if(_0x36b846[_0x1d4a15['id']]){_0x1d4a15[_0xb287('0x2f')]=_[_0xb287('0x30')](_0x36b846[_0x1d4a15['id']],function(_0x3347bc){return{'id':_0x3347bc['id'],'fullname':_0x3347bc['fullname']};});}}catch(_0x4d4150){_0x284c1a(_0x4d4150);}_0x114d56(_0x1d4a15);});}function getInteractionTags(_0x4878a4,_0x22fb5f){return new BPromise(function(_0x123e00,_0x8ccd34){try{if(_0x4878a4[_0xb287('0x31')]){_0x4878a4[_0xb287('0x32')]=[];_0x4878a4[_0xb287('0x31')][_0xb287('0x33')](',')[_0xb287('0x34')](function(_0x227354){_0x4878a4[_0xb287('0x32')][_0xb287('0x35')](_0x22fb5f[_0x227354]);});}delete _0x4878a4[_0xb287('0x31')];}catch(_0x469ca9){_0x8ccd34(_0x469ca9);}_0x123e00(_0x4878a4);});}function updateSmsInteraction(_0x33bed2,_0x56282e,_0x5002e3){return new BPromise(function(_0x5562ee,_0x2f2aaf){return getInteractionUsers(_0x33bed2,_0x5002e3)[_0xb287('0x27')](function(_0x87a800){return getInteractionTags(_0x87a800,_0x56282e);})[_0xb287('0x27')](function(_0x1067b0){_0x5562ee(_0x1067b0);})['catch'](function(_0x480ed9){_0x2f2aaf(_0x480ed9);});});}exports[_0xb287('0x36')]=function(_0x10285f,_0x39dea3){var _0x309a66={},_0x3b2b6c={},_0x41cd1a={'count':0x0,'rows':[]};var _0x41a9b1=_[_0xb287('0x30')](db[_0xb287('0x37')][_0xb287('0x38')],function(_0x38ee0f){return{'name':_0x38ee0f['fieldName'],'type':_0x38ee0f[_0xb287('0x39')][_0xb287('0x3a')]};});_0x3b2b6c[_0xb287('0x3b')]=_[_0xb287('0x30')](_0x41a9b1,_0xb287('0x2d'));_0x3b2b6c[_0xb287('0x3c')]=_[_0xb287('0x3d')](_0x10285f[_0xb287('0x3c')]);_0x3b2b6c[_0xb287('0x3e')]=_[_0xb287('0x3f')](_0x3b2b6c[_0xb287('0x3b')],_0x3b2b6c['query']);_0x309a66[_0xb287('0x40')]=_[_0xb287('0x3f')](_0x3b2b6c[_0xb287('0x3b')],qs[_0xb287('0x41')](_0x10285f['query'][_0xb287('0x41')]));_0x309a66[_0xb287('0x40')]=_0x309a66[_0xb287('0x40')][_0xb287('0x42')]?_0x309a66['attributes']:_0x3b2b6c[_0xb287('0x3b')];if(!_0x10285f[_0xb287('0x3c')][_0xb287('0x43')](_0xb287('0x44'))){_0x309a66[_0xb287('0x1f')]=qs[_0xb287('0x1f')](_0x10285f['query'][_0xb287('0x1f')]);_0x309a66[_0xb287('0x1e')]=qs[_0xb287('0x1e')](_0x10285f[_0xb287('0x3c')][_0xb287('0x1e')]);}_0x309a66[_0xb287('0x45')]=qs[_0xb287('0x46')](_0x10285f[_0xb287('0x3c')]['sort']);_0x309a66[_0xb287('0x47')]=qs[_0xb287('0x3e')](_[_0xb287('0x48')](_0x10285f['query'],_0x3b2b6c['filters']),_0x41a9b1);var _0x8af016=[];var _0x2fe4ef=squel[_0xb287('0x49')]()[_0xb287('0x4a')]('id')[_0xb287('0x4a')]('name')[_0xb287('0x4a')](_0xb287('0x4b'))[_0xb287('0x4c')](_0xb287('0x4d'));var _0x407ac8=squel[_0xb287('0x49')]()['field']('u.id')[_0xb287('0x4a')]('u.fullname')[_0xb287('0x4a')](_0xb287('0x4e'))[_0xb287('0x4c')]('user_has_sms_interactions','ui')[_0xb287('0x4f')](_0xb287('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x533518=squel[_0xb287('0x49')]()[_0xb287('0x4c')](_0xb287('0x51'),'i')[_0xb287('0x4f')](_0xb287('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb287('0x4f')](_0xb287('0x50'),'o',_0xb287('0x53'))[_0xb287('0x4f')](_0xb287('0x54'),'a',_0xb287('0x55'))['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0xb287('0x4f')]('sms_interaction_has_tags','it',_0xb287('0x56'))['left_join'](_0xb287('0x4d'),'t','t.id\x20=\x20it.TagId');var _0x48b065=squel[_0xb287('0x57')]();var _0x4c27dc=[];var _0x71c78a=squel['expr']();var _0x1d3ed6;if(_0x10285f[_0xb287('0x3c')]['search']){_0x1d3ed6=as[_0xb287('0x58')](_0x10285f['query'][_0xb287('0x59')]);var _0x1d7995=_0x1d3ed6['sqlOperator'];for(var _0x52d9b4=0x0;_0x52d9b4<_0x1d3ed6[_0xb287('0x5a')][_0xb287('0x42')];_0x52d9b4++){var _0x4ea31f=_0x1d3ed6[_0xb287('0x5a')][_0x52d9b4];var _0xe5b17d='i';var _0x2329a8=_[_0xb287('0x5b')](_0x41a9b1,[_0xb287('0x2d'),_0x4ea31f[_0xb287('0x4a')]]);if(!_0x2329a8){switch(_0x4ea31f[_0xb287('0x4a')]){case _0xb287('0x5c'):if(_0x4ea31f[_0xb287('0x5d')]==0x1){_0x533518[_0xb287('0x5e')]('`'+_0x4ea31f[_0xb287('0x4a')]+_0xb287('0x5f'));}else{_0x533518[_0xb287('0x5e')]('`'+_0x4ea31f['field']+_0xb287('0x60'));}break;case _0xb287('0x61'):if(_0x4ea31f[_0xb287('0x62')]===_0xb287('0x63')){if(_0x4ea31f[_0xb287('0x5d')][_0xb287('0x33')]('\x20')[_0xb287('0x42')]>0x1){_0x48b065[_0x1d7995](_0xb287('0x64'),qs[_0xb287('0x65')](_0x4ea31f[_0xb287('0x5d')]),null);}else{var _0x98c430='%'+_0x4ea31f[_0xb287('0x5d')]+'%';_0x48b065[_0x1d7995](_0xb287('0x66'),_0x98c430,_0x98c430,_0x98c430);}}else{_0x2329a8=_[_0xb287('0x5b')](_0x41a9b1,['name','ContactId']);_0x4ea31f[_0xb287('0x4a')]=_0xb287('0x67');_0x4ac5c6=as[_0xb287('0x68')](_0xe5b17d,_0x2329a8[_0xb287('0x39')],_0x4ea31f);_0x48b065[_0x1d7995](_0x4ac5c6[_0xb287('0x69')],_0x4ac5c6['value'][_0xb287('0x6a')],_0x4ac5c6[_0xb287('0x5d')][_0xb287('0x29')]);}break;case'Tag':var _0x3ef659=_0x4ea31f[_0xb287('0x5d')][_0xb287('0x33')](',')['map'](function(_0x5bcd65){return Number(_0x5bcd65);});_0x3ef659['forEach'](function(_0x3faddf){_0x71c78a['or'](_0xb287('0x6b'),'%,'+_0x3faddf+',%');});_0x4c27dc=_[_0xb287('0x6c')](_0x4c27dc,_0x3ef659);break;case _0xb287('0x6d'):if(_0x4ea31f['operator']==='$substring'){_0x48b065[_0x1d7995](_0xb287('0x6e'),'%'+_0x4ea31f[_0xb287('0x5d')]+'%',null);}else{_0x2329a8=_[_0xb287('0x5b')](_0x41a9b1,['name',_0xb287('0x6f')]);_0x4ea31f['field']=_0xb287('0x6f');_0x4ac5c6=as['buildExpression'](_0xe5b17d,_0x2329a8['type'],_0x4ea31f);_0x48b065[_0x1d7995](_0x4ac5c6['text'],_0x4ac5c6[_0xb287('0x5d')][_0xb287('0x6a')],_0x4ac5c6[_0xb287('0x5d')][_0xb287('0x29')]);}break;case _0xb287('0x70'):_0x4ac5c6=as[_0xb287('0x68')]('me',null,_0x4ea31f);_0x48b065[_0x1d7995](_0x4ac5c6['text'],_0x4ac5c6['value'][_0xb287('0x6a')],_0x4ac5c6[_0xb287('0x5d')][_0xb287('0x29')]);break;}}else{var _0x4ac5c6=as['buildExpression'](_0xe5b17d,_0x2329a8['type'],_0x4ea31f);_0x48b065[_0x1d7995](_0x4ac5c6[_0xb287('0x69')],_0x4ac5c6[_0xb287('0x5d')]['start'],_0x4ac5c6[_0xb287('0x5d')][_0xb287('0x29')]);}}}else{var _0x19a628=_(_0x10285f['query'])[_0xb287('0x3d')]()[_0xb287('0x30')](function(_0x4838d1){return _[_0xb287('0x71')](_0x41a9b1,['name',_0x4838d1])?_0x4838d1:undefined;})[_0xb287('0x72')]()[_0xb287('0x5d')]();if(!_[_0xb287('0x73')](_0x19a628)){_0x19a628[_0xb287('0x34')](function(_0x246f1e){if(_0x246f1e===_0xb287('0x74')){_0x533518['where'](_0xb287('0x75'),[]['concat'](_0x10285f[_0xb287('0x3c')][_0x246f1e]));}else if(_0x246f1e===_0xb287('0x76')){var _0x5e7dcf=JSON[_0xb287('0x77')](_0x10285f[_0xb287('0x3c')][_0x246f1e])[_0xb287('0x78')];var _0x76c974=JSON[_0xb287('0x77')](_0x10285f[_0xb287('0x3c')][_0x246f1e])[_0xb287('0x79')];_0x533518[_0xb287('0x47')](_0xb287('0x7a'),_0x5e7dcf,_0x76c974);}else{if(_0x10285f[_0xb287('0x3c')][_0x246f1e]===_0xb287('0x7b')){_0x533518[_0xb287('0x47')]('i.'+_0x246f1e+_0xb287('0x7c'));}else{_0x533518[_0xb287('0x47')]('i.'+_0x246f1e+_0xb287('0x7d'),_0x10285f[_0xb287('0x3c')][_0x246f1e]);}}});}if(_0x10285f[_0xb287('0x3c')][_0xb287('0x7e')]){if(_0x10285f[_0xb287('0x3c')]['read']==0x1){_0x533518[_0xb287('0x5e')](_0xb287('0x7f'));}else{_0x533518['having'](_0xb287('0x80'));}}if(_0x10285f[_0xb287('0x3c')][_0xb287('0x81')]){_0x4c27dc=_[_0xb287('0x82')](_0x10285f['query'][_0xb287('0x81')])?_0x10285f[_0xb287('0x3c')][_0xb287('0x81')]:new Array(_0x10285f['query'][_0xb287('0x81')]);_0x4c27dc['forEach'](function(_0x241c0e){_0x71c78a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x241c0e+',%');});}if(_0x10285f[_0xb287('0x3c')]['filter']){var _0x281de8=_0x10285f[_0xb287('0x3c')][_0xb287('0x83')]['replace']('\x5c','\x5c\x5c')[_0xb287('0x84')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x281de8)){_0x48b065['or'](_0xb287('0x85'),_0x281de8+'%')['or'](_0xb287('0x86'),_0x281de8+'%');}else{_0x48b065['or'](_0xb287('0x87'),qs[_0xb287('0x65')](_0x281de8))['or'](_0xb287('0x88'),_0x281de8+'%');}}}_0x533518['where'](_0x48b065);_0x533518[_0xb287('0x89')](_0xb287('0x8a'));var _0x2bcd4a={'type':db[_0xb287('0x8b')][_0xb287('0x8c')][_0xb287('0x8d')],'raw':!![]};var _0xc2fbcf=_0x533518[_0xb287('0x8e')]();_0xc2fbcf[_0xb287('0x4a')](_0xb287('0x8a'));_0xc2fbcf['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb287('0x5c'));if(_0x309a66[_0xb287('0x45')]){_0x309a66[_0xb287('0x45')]['forEach'](function(_0x520626){var _0x38f9f4=_0x520626[0x0]===_0xb287('0x8f')?_0x520626[0x0]:'i.'+_0x520626[0x0];_0x533518[_0xb287('0x45')](_0x38f9f4,_0x520626[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb287('0x73')](_0x4c27dc)){_0x533518['having'](_0x71c78a);_0xc2fbcf[_0xb287('0x47')]('t.id\x20IN\x20?',_0x4c27dc);}BPromise[_0xb287('0x90')]()[_0xb287('0x27')](function(){if(!_0x1d3ed6){if(_0x10285f[_0xb287('0x3c')]['SmsAccountId'])return;_0xc2fbcf[_0xb287('0x47')](_0xb287('0x91'));_0x533518[_0xb287('0x47')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x10285f[_0xb287('0x92')][_0xb287('0x93')]!==_0xb287('0x94'))return;return _0x10285f['user'][_0xb287('0x95')]({'attributes':['id'],'raw':!![]})[_0xb287('0x27')](function(_0x4a748b){if(_['isEmpty'](_0x4a748b)){_0xc2fbcf[_0xb287('0x47')]('i.SmsAccountId\x20IS\x20NULL');_0x533518[_0xb287('0x47')]('i.SmsAccountId\x20IS\x20NULL');}else{_0xc2fbcf[_0xb287('0x47')](_0xb287('0x75'),_['map'](_0x4a748b,'id'));_0x533518[_0xb287('0x47')](_0xb287('0x75'),_['map'](_0x4a748b,'id'));}});})[_0xb287('0x27')](function(){if(_0x10285f[_0xb287('0x92')][_0xb287('0x93')]===_0xb287('0x94')&&!_0x1d3ed6&&!_0x10285f[_0xb287('0x3c')][_0xb287('0x74')])return[];return db[_0xb287('0x96')][_0xb287('0x3c')](_0xc2fbcf['toString'](),_0x2bcd4a);})['then'](function(_0xd9c298){_0x41cd1a[_0xb287('0x21')]=_0xd9c298[_0xb287('0x42')];if(_0x41cd1a['count']===0x0)return[];return db[_0xb287('0x96')][_0xb287('0x3c')](_0x2fe4ef['toString'](),_0x2bcd4a)[_0xb287('0x27')](function(_0x320e7a){_0x8af016=_[_0xb287('0x97')](_0x320e7a,'id');_0x2bcd4a=_[_0xb287('0x98')](_0x2bcd4a,{'model':db[_0xb287('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10285f[_0xb287('0x3c')][_0xb287('0x41')]){_0x309a66[_0xb287('0x40')][_0xb287('0x34')](function(_0x4d544f){_0x533518['field']('i.'+_0x4d544f);});}else{_0x533518[_0xb287('0x4a')](_0xb287('0x99'),_0xb287('0x5c'));_0x533518[_0xb287('0x4a')](_0xb287('0x9a'),_0xb287('0x9b'));_0x533518[_0xb287('0x4a')]('a.mandatoryDisposition',_0xb287('0x9c'));_0x533518[_0xb287('0x4a')]('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');_0x533518[_0xb287('0x4a')](_0xb287('0x9d'));_0x533518[_0xb287('0x4a')](_0xb287('0x9e'),_0xb287('0x9f'));_0x533518[_0xb287('0x4a')](_0xb287('0xa0'),'Contact.lastName');_0x533518[_0xb287('0x4a')](_0xb287('0xa1'),_0xb287('0xa2'));_0x533518[_0xb287('0x4a')]('c.phone',_0xb287('0xa3'));_0x533518[_0xb287('0x4a')](_0xb287('0xa4'),_0xb287('0xa5'));_0x533518[_0xb287('0x4a')](_0xb287('0xa6'),_0xb287('0xa7'));_0x533518['field'](_0xb287('0xa8'),_0xb287('0xa9'));_0x533518[_0xb287('0x4a')](_0xb287('0xaa'),_0xb287('0xab'));_0x533518['field'](_0xb287('0xac'),'TagIds');}if(_0x309a66['limit'])_0x533518[_0xb287('0x1f')](_0x309a66['limit']);if(_0x309a66[_0xb287('0x1e')])_0x533518[_0xb287('0x1e')](_0x309a66[_0xb287('0x1e')]);return db[_0xb287('0x96')][_0xb287('0x3c')](_0x533518[_0xb287('0xad')](),_0x2bcd4a);})[_0xb287('0x27')](function(_0x5963da){if(_0x5963da['length']>0x0)_0x407ac8[_0xb287('0x47')](_0xb287('0xae'),_['map'](_0x5963da,'id'));return db[_0xb287('0x96')][_0xb287('0x3c')](_0x407ac8[_0xb287('0xad')](),_0x2bcd4a)[_0xb287('0x27')](function(_0x33be2b){var _0x118eaf=_[_0xb287('0xaf')](_0x33be2b,'SmsInteractionId');var _0x2896ab=[];_0x5963da[_0xb287('0x34')](function(_0x5272d0){_0x2896ab[_0xb287('0x35')](updateSmsInteraction(_0x5272d0,_0x8af016,_0x118eaf));});return BPromise[_0xb287('0xb0')](_0x2896ab);});});})[_0xb287('0x27')](function(_0x46b10f){_0x41cd1a[_0xb287('0xb1')]=_0x46b10f;return _0x41cd1a;})[_0xb287('0x27')](respondWithFilteredResult(_0x39dea3,_0x309a66))[_0xb287('0xb2')](handleError(_0x39dea3,null));};exports[_0xb287('0xb3')]=function(_0x5cd6d3,_0x5ac078){var _0x508d24={'raw':![],'where':{'id':_0x5cd6d3[_0xb287('0xb4')]['id']}},_0x50ea40={};_0x50ea40[_0xb287('0x3b')]=_[_0xb287('0x3d')](db[_0xb287('0x37')]['rawAttributes']);_0x50ea40[_0xb287('0x3c')]=_[_0xb287('0x3d')](_0x5cd6d3[_0xb287('0x3c')]);_0x50ea40[_0xb287('0x3e')]=_[_0xb287('0x3f')](_0x50ea40[_0xb287('0x3b')],_0x50ea40[_0xb287('0x3c')]);_0x508d24[_0xb287('0x40')]=_['intersection'](_0x50ea40[_0xb287('0x3b')],qs['fields'](_0x5cd6d3['query'][_0xb287('0x41')]));_0x508d24[_0xb287('0x40')]=_0x508d24[_0xb287('0x40')][_0xb287('0x42')]?_0x508d24['attributes']:_0x50ea40[_0xb287('0x3b')];if(_0x5cd6d3[_0xb287('0x3c')][_0xb287('0xb5')]){_0x508d24[_0xb287('0xb6')]=[{'all':!![]}];}_0x508d24=_[_0xb287('0x98')]({},_0x508d24,_0x5cd6d3[_0xb287('0xb7')]);return db['SmsInteraction'][_0xb287('0x5b')](_0x508d24)['then'](handleEntityNotFound(_0x5ac078,null))['then'](respondWithResult(_0x5ac078,null))[_0xb287('0xb2')](handleError(_0x5ac078,null));};exports[_0xb287('0xb8')]=function(_0x1a3f67,_0x23244b){return db[_0xb287('0x37')][_0xb287('0xb8')](_0x1a3f67['body'],{})['then'](respondWithResult(_0x23244b,0xc9))[_0xb287('0xb2')](handleError(_0x23244b,null));};exports[_0xb287('0x26')]=function(_0x57d2a9,_0x5b48ae){if(_0x57d2a9[_0xb287('0x70')]['id']){delete _0x57d2a9['body']['id'];}return db[_0xb287('0x37')][_0xb287('0x5b')]({'where':{'id':_0x57d2a9[_0xb287('0xb4')]['id']}})[_0xb287('0x27')](handleEntityNotFound(_0x5b48ae,null))['then'](saveUpdates(_0x57d2a9[_0xb287('0x70')],null))[_0xb287('0x27')](respondWithResult(_0x5b48ae,null))[_0xb287('0xb2')](handleError(_0x5b48ae,null));};exports['destroy']=function(_0x26ae6f,_0x5aba49){return db[_0xb287('0x37')][_0xb287('0x5b')]({'where':{'id':_0x26ae6f[_0xb287('0xb4')]['id']}})[_0xb287('0x27')](handleEntityNotFound(_0x5aba49,null))[_0xb287('0x27')](removeEntity(_0x5aba49,null))[_0xb287('0xb2')](handleError(_0x5aba49,null));};exports[_0xb287('0xb9')]=function(_0x565f50,_0x430afa){return db[_0xb287('0x37')][_0xb287('0xb9')]()['then'](respondWithResult(_0x430afa,null))[_0xb287('0xb2')](handleError(_0x430afa,null));};exports['addMessage']=function(_0x51f618,_0x3f6f38,_0x125e25){return db[_0xb287('0xba')][_0xb287('0x5b')]({'where':{'id':_0x51f618[_0xb287('0xb4')]['id']}})['then'](handleEntityNotFound(_0x3f6f38,null))[_0xb287('0x27')](function(_0x1c1bb9){if(_0x1c1bb9){return _0x1c1bb9[_0xb287('0xbb')](_0x51f618['body'][_0xb287('0xbc')],_[_0xb287('0xbd')](_0x51f618[_0xb287('0x70')],[_0xb287('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x3f6f38,null))[_0xb287('0xb2')](handleError(_0x3f6f38,null));};exports['getMessages']=function(_0x3d5138,_0x4fc5ef,_0x3e2436){var _0x133f2d={'raw':![],'where':{}};var _0x255a7f={};var _0x3f02db={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb287('0xbe')]({'where':{'id':_0x3d5138[_0xb287('0xb4')]['id']}})[_0xb287('0x27')](handleEntityNotFound(_0x4fc5ef,null))[_0xb287('0x27')](function(_0x8819e2){if(_0x8819e2){_0x255a7f[_0xb287('0x3b')]=_[_0xb287('0x3d')](db[_0xb287('0xba')][_0xb287('0x38')]);_0x255a7f[_0xb287('0x3c')]=_['keys'](_0x3d5138[_0xb287('0x3c')]);_0x255a7f[_0xb287('0x3e')]=_[_0xb287('0x3f')](_0x255a7f['model'],_0x255a7f['query']);_0x133f2d['attributes']=_[_0xb287('0x3f')](_0x255a7f[_0xb287('0x3b')],qs[_0xb287('0x41')](_0x3d5138[_0xb287('0x3c')][_0xb287('0x41')]));_0x133f2d[_0xb287('0x40')]=_0x133f2d[_0xb287('0x40')][_0xb287('0x42')]?_0x133f2d[_0xb287('0x40')]:_0x255a7f[_0xb287('0x3b')];if(!_0x3d5138[_0xb287('0x3c')][_0xb287('0x43')](_0xb287('0x44'))){_0x133f2d[_0xb287('0x1f')]=qs[_0xb287('0x1f')](_0x3d5138[_0xb287('0x3c')]['limit']);_0x133f2d[_0xb287('0x1e')]=qs[_0xb287('0x1e')](_0x3d5138[_0xb287('0x3c')][_0xb287('0x1e')]);}_0x133f2d['order']=qs[_0xb287('0x46')](_0x3d5138[_0xb287('0x3c')][_0xb287('0x46')]);_0x133f2d['where']=qs['filters'](_[_0xb287('0x48')](_0x3d5138[_0xb287('0x3c')],_0x255a7f['filters']));_0x133f2d[_0xb287('0x47')][_0xb287('0xbf')]=_0x8819e2['id'];if(_0x3d5138['query'][_0xb287('0x83')]){_0x133f2d[_0xb287('0x47')]=_[_0xb287('0x98')](_0x133f2d[_0xb287('0x47')],{'$or':_[_0xb287('0x30')](_0x133f2d['attributes'],function(_0x131f4b){var _0x8efae5={};_0x8efae5[_0x131f4b]={'$like':'%'+_0x3d5138[_0xb287('0x3c')][_0xb287('0x83')]+'%'};return _0x8efae5;})});}if(_0x3d5138[_0xb287('0x3c')][_0xb287('0x78')]){var _0x559a2b=_0x3d5138[_0xb287('0x3c')][_0xb287('0x78')][_0xb287('0x33')](',');var _0x36a889={};_0x36a889[_0x559a2b[0x0]]={'$gte':moment(_0x559a2b[0x1])[_0xb287('0xc0')](_0xb287('0xc1'))};_0x133f2d['where']=_[_0xb287('0x98')](_0x133f2d[_0xb287('0x47')],_0x36a889);}_0x133f2d=_[_0xb287('0x98')]({},_0x133f2d,_0x3d5138[_0xb287('0xb7')]);return db[_0xb287('0xba')][_0xb287('0x21')]({'where':_0x133f2d[_0xb287('0x47')]})[_0xb287('0x27')](function(_0x3ac2e1){_0x3f02db[_0xb287('0x21')]=_0x3ac2e1;if(_0x3d5138[_0xb287('0x3c')][_0xb287('0xb5')]){_0x133f2d[_0xb287('0xb6')]=[{'all':!![]}];}return db['SmsMessage'][_0xb287('0xc2')](_0x133f2d);})[_0xb287('0x27')](function(_0x34201e){_0x3f02db[_0xb287('0xb1')]=_0x34201e;return _0x3f02db;});}})['then'](respondWithFilteredResult(_0x4fc5ef,_0x133f2d))[_0xb287('0xb2')](handleError(_0x4fc5ef,null));};exports[_0xb287('0xc3')]=function(_0x5f03aa,_0x2cb7b3,_0x5a6b3a){return db[_0xb287('0x37')]['find']({'where':{'id':_0x5f03aa[_0xb287('0xb4')]['id']}})['then'](handleEntityNotFound(_0x2cb7b3,null))[_0xb287('0x27')](function(_0x2f0ce0){if(_0x2f0ce0){return _0x2f0ce0['setTags'](_0x5f03aa[_0xb287('0x70')]['ids'],_[_0xb287('0xbd')](_0x5f03aa[_0xb287('0x70')],[_0xb287('0xbc'),'id'])||{})[_0xb287('0xc4')](function(){return db[_0xb287('0xc5')][_0xb287('0xc2')]({'attributes':['id',_0xb287('0x2d'),_0xb287('0x4b')],'where':{'id':_0x5f03aa[_0xb287('0x70')][_0xb287('0xbc')]}});})['then'](function(_0x3d4e85){socket['emit'](_0xb287('0xc6'),{'id':Number(_0x5f03aa[_0xb287('0xb4')]['id']),'tags':_0x3d4e85||[]});return{'id':Number(_0x5f03aa[_0xb287('0xb4')]['id']),'tags':_0x3d4e85||[]};});}})[_0xb287('0x27')](respondWithResult(_0x2cb7b3,null))[_0xb287('0xb2')](handleError(_0x2cb7b3,null));};exports[_0xb287('0xc7')]=function(_0x33978b,_0x223ae0,_0x57ad99){return db[_0xb287('0x37')]['find']({'where':{'id':_0x33978b[_0xb287('0xb4')]['id']}})['then'](handleEntityNotFound(_0x223ae0,null))[_0xb287('0x27')](function(_0x19427e){if(_0x19427e){return _0x19427e[_0xb287('0xc7')](_0x33978b['query'][_0xb287('0xbc')]);}})[_0xb287('0x27')](respondWithStatusCode(_0x223ae0,null))[_0xb287('0xb2')](handleError(_0x223ae0,null));};exports['download']=function(_0x24aa0e,_0x2ad5d6){var _0x1cece6=moment()['unix']()[_0xb287('0xad')]();var _0x397e79=path['join'](config[_0xb287('0xc8')],'server',_0xb287('0xc9'),_0xb287('0xca'));var _0x2c2784=path['join'](config[_0xb287('0xc8')],_0xb287('0xcb'),_0xb287('0xc9'),_0xb287('0xcc'));var _0x28b2cd=path['join'](_0x397e79,_0x1cece6);var _0x28955a=util[_0xb287('0xc0')](_0xb287('0xcd'),_0x24aa0e[_0xb287('0xb4')]['id'],_0x1cece6);var _0x34f3fd=path[_0xb287('0xce')](_0x397e79,_0x28955a);var _0x17313e=[];_0x17313e[_0xb287('0x35')]({'model':db[_0xb287('0x6d')],'as':'User','attributes':['id',_0xb287('0xcf')],'raw':!![]});_0x17313e['push']({'model':db['CmContact'],'as':_0xb287('0x61'),'attributes':['id','firstName',_0xb287('0xd0')],'raw':!![]});var _0x4c32a7=[{'model':db[_0xb287('0xba')],'as':_0xb287('0xd1'),'attributes':['id','body',_0xb287('0x76'),_0xb287('0xd2'),'secret',_0xb287('0x7e')],'include':_0x17313e}];_0x4c32a7[_0xb287('0x35')]({'model':db[_0xb287('0xd3')],'as':'Account','attributes':['id',_0xb287('0x2d')]});_0x4c32a7[_0xb287('0x35')]({'model':db[_0xb287('0x6d')],'as':_0xb287('0xd4'),'attributes':['id','fullname']});return db[_0xb287('0x37')][_0xb287('0x5b')]({'where':{'id':_0x24aa0e['params']['id']},'include':_0x4c32a7})[_0xb287('0x27')](handleEntityNotFound(_0x2ad5d6,null))[_0xb287('0x27')](function(_0x37a7f8){if(_0x37a7f8){var _0x1aa22c=_0x37a7f8[_0xb287('0xd5')]({'plain':!![]});fs[_0xb287('0xd6')](_0x28b2cd);var _0xeb6ed5={'channel':_0xb287('0xd7'),'account':_0x1aa22c[_0xb287('0xd8')]['name'],'agent':_0x1aa22c[_0xb287('0xd4')]?_0x1aa22c[_0xb287('0xd4')][_0xb287('0xcf')]:_0xb287('0xd9'),'createdAt':moment(_0x1aa22c[_0xb287('0x76')])['format'](_0xb287('0xc1'))[_0xb287('0xad')](),'closedAt':_0x1aa22c[_0xb287('0xda')]?moment(_0x1aa22c[_0xb287('0xdb')])[_0xb287('0xc0')](_0xb287('0xc1'))[_0xb287('0xad')]():'','disposition':_0x1aa22c[_0xb287('0xdc')],'messages':_(_0x1aa22c['Messages'])['filter']({'secret':![]})['map'](function(_0x5d3558){return{'date':moment(_0x5d3558[_0xb287('0x76')])[_0xb287('0xc0')](_0xb287('0xc1'))[_0xb287('0xad')](),'sender':_0x5d3558[_0xb287('0xd2')]===_0xb287('0xdd')?_0x5d3558[_0xb287('0x6d')]?_0x5d3558['User'][_0xb287('0xcf')]:_0xb287('0xde'):_0x5d3558[_0xb287('0x61')][_0xb287('0xdf')]+(_0x5d3558[_0xb287('0x61')][_0xb287('0xd0')]?'\x20'+_0x5d3558[_0xb287('0x61')][_0xb287('0xd0')]:''),'body':_0x5d3558[_0xb287('0x70')],'direction':_0x5d3558['direction']==='out'?'A':'C','secret':_0x5d3558[_0xb287('0xe0')],'read':_0x5d3558[_0xb287('0x7e')]};})[_0xb287('0x5d')]()};return ejs[_0xb287('0xe1')](path[_0xb287('0xce')](config[_0xb287('0xc8')],_0xb287('0xcb'),_0xb287('0xe2'),'downloadInteraction.ejs'),{'interaction':_0xeb6ed5})[_0xb287('0x27')](function(_0x2e99ae){var _0x1c854a=path[_0xb287('0xce')](_0x28b2cd,_0xb287('0xe3')+_0x1aa22c['id']+'-'+_0x1cece6+_0xb287('0xe4'));var _0x359619={'path':_0x1c854a,'channel':'Sms','interactionId':_0x1aa22c['id']};return pdf[_0xb287('0xe5')](_0x2e99ae,_0x359619);})[_0xb287('0x27')](function(){return new BPromise(function(_0x270c0f,_0x2e709b){zipdir(_0x28b2cd,{'saveTo':_0x34f3fd},function(_0x46af75,_0x239d4e){if(_0x46af75)return _0x2e709b(_0x46af75);return _0x270c0f(_0x239d4e);});})['then'](function(){return new BPromise(function(_0x5dbac7,_0x422ee6){rimraf(_0x28b2cd,function(_0x16f842){if(_0x16f842)_0x422ee6(_0x16f842);return _0x5dbac7();});});})[_0xb287('0x27')](function(){return _0x2ad5d6['download'](_0x34f3fd,_0x28955a,function(_0x2824cf){if(_0x2824cf){console[_0xb287('0xe6')](_0xb287('0xe7'),_0x2824cf);}else{fs[_0xb287('0xe8')](_0x34f3fd);}});});});}else{return _0x2ad5d6[_0xb287('0x2a')](0xc8);}})['catch'](handleError(_0x2ad5d6,null));}; \ No newline at end of file +var _0xb6e3=['sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','text','keys','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','include','merge','options','describe','addMessage','ids','getMessages','findOne','SmsMessage','SmsInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','omit','spread','emit','removeTags','download','unix','root','server','join','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','SmsAccount','Account','Owner','mkdirSync','N.A.','closed','closedAt','direction','out','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end'];(function(_0x4cfa7b,_0x786ac7){var _0x2453ac=function(_0x12e3d6){while(--_0x12e3d6){_0x4cfa7b['push'](_0x4cfa7b['shift']());}};_0x2453ac(++_0x786ac7);}(_0xb6e3,0xbf));var _0x3b6e=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xb6e3[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require(_0x3b6e('0x0'));var rimraf=require(_0x3b6e('0x1'));var zipdir=require(_0x3b6e('0x2'));var jsonpatch=require(_0x3b6e('0x3'));var rp=require(_0x3b6e('0x4'));var moment=require(_0x3b6e('0x5'));var BPromise=require(_0x3b6e('0x6'));var Mustache=require(_0x3b6e('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3b6e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b6e('0x9'));var _=require(_0x3b6e('0xa'));var squel=require(_0x3b6e('0xb'));var crypto=require(_0x3b6e('0xc'));var jsforce=require(_0x3b6e('0xd'));var deskjs=require(_0x3b6e('0xe'));var toCsv=require(_0x3b6e('0xf'));var querystring=require(_0x3b6e('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3b6e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3b6e('0x12'));var pdf=require(_0x3b6e('0x13'));var hardwareService=require(_0x3b6e('0x14'));var logger=require(_0x3b6e('0x15'))(_0x3b6e('0x16'));var utils=require(_0x3b6e('0x17'));var config=require(_0x3b6e('0x18'));var licenseUtil=require(_0x3b6e('0x19'));var db=require(_0x3b6e('0x1a'))['db'];config[_0x3b6e('0x1b')]=_[_0x3b6e('0x1c')](config[_0x3b6e('0x1b')],{'host':_0x3b6e('0x1d'),'port':0x18eb});var socket=require(_0x3b6e('0x1e'))(new Redis(config[_0x3b6e('0x1b')]));require(_0x3b6e('0x1f'))['register'](socket);function respondWithStatusCode(_0x50bf45,_0x482d0e){_0x482d0e=_0x482d0e||0xcc;return function(_0x138846){if(_0x138846){return _0x50bf45['sendStatus'](_0x482d0e);}return _0x50bf45[_0x3b6e('0x20')](_0x482d0e)['end']();};}function respondWithResult(_0x17e302,_0x8b00a2){_0x8b00a2=_0x8b00a2||0xc8;return function(_0xa48a22){if(_0xa48a22){return _0x17e302[_0x3b6e('0x20')](_0x8b00a2)[_0x3b6e('0x21')](_0xa48a22);}};}function respondWithFilteredResult(_0x152de3,_0x3da222){return function(_0xef83d){if(_0xef83d){var _0xd6e115=typeof _0x3da222[_0x3b6e('0x22')]===_0x3b6e('0x23')&&typeof _0x3da222['limit']==='undefined';var _0x4183ac=_0xef83d['count'];var _0x46b778=_0xd6e115?0x0:_0x3da222[_0x3b6e('0x22')];var _0x3f244f=_0xd6e115?_0xef83d[_0x3b6e('0x24')]:_0x3da222[_0x3b6e('0x22')]+_0x3da222[_0x3b6e('0x25')];var _0x2db9c6;if(_0x3f244f>=_0x4183ac){_0x3f244f=_0x4183ac;_0x2db9c6=0xc8;}else{_0x2db9c6=0xce;}_0x152de3[_0x3b6e('0x20')](_0x2db9c6);return _0x152de3['set'](_0x3b6e('0x26'),_0x46b778+'-'+_0x3f244f+'/'+_0x4183ac)[_0x3b6e('0x21')](_0xef83d);}return null;};}function patchUpdates(_0x3da3d8){return function(_0x432996){try{jsonpatch[_0x3b6e('0x27')](_0x432996,_0x3da3d8,!![]);}catch(_0xad11aa){return BPromise[_0x3b6e('0x28')](_0xad11aa);}return _0x432996[_0x3b6e('0x29')]();};}function saveUpdates(_0x44561c,_0x3c1630){return function(_0x5b0536){if(_0x5b0536){return _0x5b0536[_0x3b6e('0x2a')](_0x44561c)[_0x3b6e('0x2b')](function(_0x884533){return _0x884533;});}return null;};}function removeEntity(_0x5085ce,_0x54f8e5){return function(_0x376f9b){if(_0x376f9b){return _0x376f9b[_0x3b6e('0x2c')]()[_0x3b6e('0x2b')](function(){_0x5085ce[_0x3b6e('0x20')](0xcc)[_0x3b6e('0x2d')]();});}};}function handleEntityNotFound(_0x3073b8,_0x191730){return function(_0x1a9db9){if(!_0x1a9db9){_0x3073b8[_0x3b6e('0x2e')](0x194);}return _0x1a9db9;};}function handleError(_0x5c24ac,_0x25e2db){_0x25e2db=_0x25e2db||0x1f4;return function(_0x143239){logger[_0x3b6e('0x2f')](_0x143239[_0x3b6e('0x30')]);if(_0x143239[_0x3b6e('0x31')]){delete _0x143239['name'];}_0x5c24ac[_0x3b6e('0x20')](_0x25e2db)[_0x3b6e('0x32')](_0x143239);};}function getInteractionUsers(_0x1362b8,_0x5ad4a4){return new BPromise(function(_0x465c5e,_0x1978ef){try{if(_0x5ad4a4[_0x1362b8['id']]){_0x1362b8[_0x3b6e('0x33')]=_[_0x3b6e('0x34')](_0x5ad4a4[_0x1362b8['id']],function(_0x1b8a06){return{'id':_0x1b8a06['id'],'fullname':_0x1b8a06[_0x3b6e('0x35')]};});}}catch(_0x38c5fb){_0x1978ef(_0x38c5fb);}_0x465c5e(_0x1362b8);});}function getInteractionTags(_0x34e8ef,_0x156133){return new BPromise(function(_0x21dc64,_0xc508df){try{if(_0x34e8ef[_0x3b6e('0x36')]){_0x34e8ef[_0x3b6e('0x37')]=[];_0x34e8ef[_0x3b6e('0x36')][_0x3b6e('0x38')](',')[_0x3b6e('0x39')](function(_0x566457){_0x34e8ef['Tags'][_0x3b6e('0x3a')](_0x156133[_0x566457]);});}delete _0x34e8ef[_0x3b6e('0x36')];}catch(_0x530601){_0xc508df(_0x530601);}_0x21dc64(_0x34e8ef);});}function updateSmsInteraction(_0x579c95,_0x423c44,_0x557de9){return new BPromise(function(_0x521547,_0x45470f){return getInteractionUsers(_0x579c95,_0x557de9)[_0x3b6e('0x2b')](function(_0x3d480e){return getInteractionTags(_0x3d480e,_0x423c44);})[_0x3b6e('0x2b')](function(_0x3a45b0){_0x521547(_0x3a45b0);})[_0x3b6e('0x3b')](function(_0x43c2f3){_0x45470f(_0x43c2f3);});});}exports[_0x3b6e('0x3c')]=function(_0x4cbdbc,_0x153fcb){var _0x4ce0e9={},_0x1909f4={},_0x4cac70={'count':0x0,'rows':[]};var _0x41a4d5=_['map'](db[_0x3b6e('0x3d')][_0x3b6e('0x3e')],function(_0x1135be){return{'name':_0x1135be[_0x3b6e('0x3f')],'type':_0x1135be[_0x3b6e('0x40')][_0x3b6e('0x41')]};});_0x1909f4['model']=_[_0x3b6e('0x34')](_0x41a4d5,_0x3b6e('0x31'));_0x1909f4['query']=_['keys'](_0x4cbdbc[_0x3b6e('0x42')]);_0x1909f4[_0x3b6e('0x43')]=_['intersection'](_0x1909f4[_0x3b6e('0x44')],_0x1909f4[_0x3b6e('0x42')]);_0x4ce0e9['attributes']=_[_0x3b6e('0x45')](_0x1909f4[_0x3b6e('0x44')],qs[_0x3b6e('0x46')](_0x4cbdbc[_0x3b6e('0x42')]['fields']));_0x4ce0e9[_0x3b6e('0x47')]=_0x4ce0e9['attributes'][_0x3b6e('0x48')]?_0x4ce0e9['attributes']:_0x1909f4[_0x3b6e('0x44')];if(!_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x49')](_0x3b6e('0x4a'))){_0x4ce0e9['limit']=qs['limit'](_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x25')]);_0x4ce0e9[_0x3b6e('0x22')]=qs[_0x3b6e('0x22')](_0x4cbdbc[_0x3b6e('0x42')]['offset']);}_0x4ce0e9[_0x3b6e('0x4b')]=qs[_0x3b6e('0x4c')](_0x4cbdbc['query'][_0x3b6e('0x4c')]);_0x4ce0e9[_0x3b6e('0x4d')]=qs[_0x3b6e('0x43')](_[_0x3b6e('0x4e')](_0x4cbdbc[_0x3b6e('0x42')],_0x1909f4[_0x3b6e('0x43')]),_0x41a4d5);var _0x3e7651=[];var _0x298531=squel[_0x3b6e('0x4f')]()[_0x3b6e('0x50')]('id')[_0x3b6e('0x50')]('name')[_0x3b6e('0x50')](_0x3b6e('0x51'))[_0x3b6e('0x52')](_0x3b6e('0x53'));var _0x1d83ad=squel[_0x3b6e('0x4f')]()[_0x3b6e('0x50')]('u.id')[_0x3b6e('0x50')](_0x3b6e('0x54'))[_0x3b6e('0x50')](_0x3b6e('0x55'))[_0x3b6e('0x52')](_0x3b6e('0x56'),'ui')[_0x3b6e('0x57')](_0x3b6e('0x58'),'u',_0x3b6e('0x59'));var _0x36be47=squel[_0x3b6e('0x4f')]()[_0x3b6e('0x52')](_0x3b6e('0x5a'),'i')[_0x3b6e('0x57')](_0x3b6e('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3b6e('0x57')](_0x3b6e('0x58'),'o',_0x3b6e('0x5c'))[_0x3b6e('0x57')](_0x3b6e('0x5d'),'a',_0x3b6e('0x5e'))[_0x3b6e('0x57')](_0x3b6e('0x5f'),'me',_0x3b6e('0x60'))[_0x3b6e('0x57')](_0x3b6e('0x61'),'it',_0x3b6e('0x62'))[_0x3b6e('0x57')](_0x3b6e('0x53'),'t','t.id\x20=\x20it.TagId');var _0x68564b=squel[_0x3b6e('0x63')]();var _0x46ae84=[];var _0x4a84a2=squel[_0x3b6e('0x63')]();var _0x43b5d7;if(_0x4cbdbc['query'][_0x3b6e('0x64')]){_0x43b5d7=as[_0x3b6e('0x65')](_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x64')]);var _0x58e201=_0x43b5d7['sqlOperator'];for(var _0x55b70a=0x0;_0x55b70a<_0x43b5d7[_0x3b6e('0x66')][_0x3b6e('0x48')];_0x55b70a++){var _0x1f806f=_0x43b5d7['conditions'][_0x55b70a];var _0xa15de2='i';var _0x25b308=_['find'](_0x41a4d5,[_0x3b6e('0x31'),_0x1f806f[_0x3b6e('0x50')]]);if(!_0x25b308){switch(_0x1f806f[_0x3b6e('0x50')]){case _0x3b6e('0x67'):if(_0x1f806f['value']==0x1){_0x36be47[_0x3b6e('0x68')]('`'+_0x1f806f[_0x3b6e('0x50')]+_0x3b6e('0x69'));}else{_0x36be47[_0x3b6e('0x68')]('`'+_0x1f806f[_0x3b6e('0x50')]+'`\x20>\x200');}break;case _0x3b6e('0x6a'):if(_0x1f806f[_0x3b6e('0x6b')]===_0x3b6e('0x6c')){if(_0x1f806f[_0x3b6e('0x6d')][_0x3b6e('0x38')]('\x20')[_0x3b6e('0x48')]>0x1){_0x68564b[_0x58e201]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b6e('0x6e')](_0x1f806f['value']),null);}else{var _0x2fe3bf='%'+_0x1f806f[_0x3b6e('0x6d')]+'%';_0x68564b[_0x58e201](_0x3b6e('0x6f'),_0x2fe3bf,_0x2fe3bf,_0x2fe3bf);}}else{_0x25b308=_[_0x3b6e('0x70')](_0x41a4d5,[_0x3b6e('0x31'),_0x3b6e('0x71')]);_0x1f806f[_0x3b6e('0x50')]='ContactId';_0x4338ab=as[_0x3b6e('0x72')](_0xa15de2,_0x25b308['type'],_0x1f806f);_0x68564b[_0x58e201](_0x4338ab['text'],_0x4338ab[_0x3b6e('0x6d')]['start'],_0x4338ab[_0x3b6e('0x6d')]['end']);}break;case'Tag':var _0x3000ea=_0x1f806f['value'][_0x3b6e('0x38')](',')[_0x3b6e('0x34')](function(_0x5519a2){return Number(_0x5519a2);});_0x3000ea[_0x3b6e('0x39')](function(_0xba808e){_0x4a84a2['or'](_0x3b6e('0x73'),'%,'+_0xba808e+',%');});_0x46ae84=_[_0x3b6e('0x74')](_0x46ae84,_0x3000ea);break;case _0x3b6e('0x75'):if(_0x1f806f[_0x3b6e('0x6b')]===_0x3b6e('0x6c')){_0x68564b[_0x58e201](_0x3b6e('0x76'),'%'+_0x1f806f['value']+'%',null);}else{_0x25b308=_[_0x3b6e('0x70')](_0x41a4d5,['name',_0x3b6e('0x77')]);_0x1f806f[_0x3b6e('0x50')]='UserId';_0x4338ab=as[_0x3b6e('0x72')](_0xa15de2,_0x25b308['type'],_0x1f806f);_0x68564b[_0x58e201](_0x4338ab['text'],_0x4338ab[_0x3b6e('0x6d')][_0x3b6e('0x78')],_0x4338ab[_0x3b6e('0x6d')]['end']);}break;case _0x3b6e('0x79'):_0x4338ab=as[_0x3b6e('0x72')]('me',null,_0x1f806f);_0x68564b[_0x58e201](_0x4338ab[_0x3b6e('0x7a')],_0x4338ab['value'][_0x3b6e('0x78')],_0x4338ab[_0x3b6e('0x6d')][_0x3b6e('0x2d')]);break;}}else{var _0x4338ab=as[_0x3b6e('0x72')](_0xa15de2,_0x25b308[_0x3b6e('0x40')],_0x1f806f);_0x68564b[_0x58e201](_0x4338ab[_0x3b6e('0x7a')],_0x4338ab[_0x3b6e('0x6d')]['start'],_0x4338ab['value']['end']);}}}else{var _0x1fb744=_(_0x4cbdbc[_0x3b6e('0x42')])[_0x3b6e('0x7b')]()[_0x3b6e('0x34')](function(_0x544c52){return _['some'](_0x41a4d5,[_0x3b6e('0x31'),_0x544c52])?_0x544c52:undefined;})[_0x3b6e('0x7c')]()[_0x3b6e('0x6d')]();if(!_['isEmpty'](_0x1fb744)){_0x1fb744['forEach'](function(_0x38b723){if(_0x38b723===_0x3b6e('0x7d')){_0x36be47[_0x3b6e('0x4d')](_0x3b6e('0x7e'),[][_0x3b6e('0x7f')](_0x4cbdbc[_0x3b6e('0x42')][_0x38b723]));}else if(_0x38b723===_0x3b6e('0x80')){var _0x91dba3=JSON['parse'](_0x4cbdbc[_0x3b6e('0x42')][_0x38b723])['$gte'];var _0x2fd138=JSON['parse'](_0x4cbdbc[_0x3b6e('0x42')][_0x38b723])[_0x3b6e('0x81')];_0x36be47['where'](_0x3b6e('0x82'),_0x91dba3,_0x2fd138);}else{if(_0x4cbdbc[_0x3b6e('0x42')][_0x38b723]===_0x3b6e('0x83')){_0x36be47[_0x3b6e('0x4d')]('i.'+_0x38b723+'\x20IS\x20NULL');}else{_0x36be47[_0x3b6e('0x4d')]('i.'+_0x38b723+'\x20=\x20?',_0x4cbdbc['query'][_0x38b723]);}}});}if(_0x4cbdbc[_0x3b6e('0x42')]['read']){if(_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x84')]==0x1){_0x36be47['having'](_0x3b6e('0x85'));}else{_0x36be47['having'](_0x3b6e('0x86'));}}if(_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x87')]){_0x46ae84=_[_0x3b6e('0x88')](_0x4cbdbc[_0x3b6e('0x42')]['tag'])?_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x87')]:new Array(_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x87')]);_0x46ae84[_0x3b6e('0x39')](function(_0x294ae){_0x4a84a2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x294ae+',%');});}if(_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x89')]){var _0x1af70a=_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x89')][_0x3b6e('0x8a')]('\x5c','\x5c\x5c')[_0x3b6e('0x8a')](/'/g,'\x27\x27');if(qs[_0x3b6e('0x8b')](_0x1af70a)){_0x68564b['or'](_0x3b6e('0x8c'),_0x1af70a+'%')['or']('i.phone\x20LIKE\x20?',_0x1af70a+'%');}else{_0x68564b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b6e('0x6e')](_0x1af70a))['or'](_0x3b6e('0x8d'),_0x1af70a+'%');}}}_0x36be47[_0x3b6e('0x4d')](_0x68564b);_0x36be47[_0x3b6e('0x8e')](_0x3b6e('0x8f'));var _0x4479f9={'type':db['Sequelize'][_0x3b6e('0x90')][_0x3b6e('0x91')],'raw':!![]};var _0x50069d=_0x36be47[_0x3b6e('0x92')]();_0x50069d[_0x3b6e('0x50')](_0x3b6e('0x8f'));_0x50069d[_0x3b6e('0x50')](_0x3b6e('0x93'),_0x3b6e('0x67'));if(_0x4ce0e9[_0x3b6e('0x4b')]){_0x4ce0e9['order'][_0x3b6e('0x39')](function(_0x46d1df){var _0x470c79=_0x46d1df[0x0]==='contactName'?_0x46d1df[0x0]:'i.'+_0x46d1df[0x0];_0x36be47['order'](_0x470c79,_0x46d1df[0x1]===_0x3b6e('0x94')?![]:!![]);});}if(!_[_0x3b6e('0x95')](_0x46ae84)){_0x36be47[_0x3b6e('0x68')](_0x4a84a2);_0x50069d[_0x3b6e('0x4d')](_0x3b6e('0x96'),_0x46ae84);}BPromise[_0x3b6e('0x97')]()['then'](function(){if(!_0x43b5d7){if(_0x4cbdbc[_0x3b6e('0x42')]['SmsAccountId'])return;_0x50069d[_0x3b6e('0x4d')](_0x3b6e('0x98'));_0x36be47['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4cbdbc[_0x3b6e('0x99')][_0x3b6e('0x9a')]!=='agent')return;return _0x4cbdbc[_0x3b6e('0x99')][_0x3b6e('0x9b')]({'attributes':['id'],'raw':!![]})[_0x3b6e('0x2b')](function(_0x47ddff){if(_[_0x3b6e('0x95')](_0x47ddff)){_0x50069d[_0x3b6e('0x4d')](_0x3b6e('0x9c'));_0x36be47[_0x3b6e('0x4d')](_0x3b6e('0x9c'));}else{_0x50069d[_0x3b6e('0x4d')](_0x3b6e('0x7e'),_[_0x3b6e('0x34')](_0x47ddff,'id'));_0x36be47[_0x3b6e('0x4d')](_0x3b6e('0x7e'),_[_0x3b6e('0x34')](_0x47ddff,'id'));}});})['then'](function(){if(_0x4cbdbc['user'][_0x3b6e('0x9a')]===_0x3b6e('0x9d')&&!_0x43b5d7&&!_0x4cbdbc[_0x3b6e('0x42')][_0x3b6e('0x7d')])return[];return db['sequelize'][_0x3b6e('0x42')](_0x50069d[_0x3b6e('0x9e')](),_0x4479f9);})[_0x3b6e('0x2b')](function(_0x51545c){_0x4cac70[_0x3b6e('0x24')]=_0x51545c[_0x3b6e('0x48')];if(_0x4cac70[_0x3b6e('0x24')]===0x0)return[];return db[_0x3b6e('0x9f')]['query'](_0x298531[_0x3b6e('0x9e')](),_0x4479f9)[_0x3b6e('0x2b')](function(_0x3a2f68){_0x3e7651=_[_0x3b6e('0xa0')](_0x3a2f68,'id');_0x4479f9=_['merge'](_0x4479f9,{'model':db[_0x3b6e('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4cbdbc['query']['fields']){_0x4ce0e9[_0x3b6e('0x47')][_0x3b6e('0x39')](function(_0x285915){_0x36be47[_0x3b6e('0x50')]('i.'+_0x285915);});}else{_0x36be47[_0x3b6e('0x50')](_0x3b6e('0x93'),_0x3b6e('0x67'));_0x36be47[_0x3b6e('0x50')](_0x3b6e('0xa1'),_0x3b6e('0xa2'));_0x36be47[_0x3b6e('0x50')]('a.mandatoryDisposition',_0x3b6e('0xa3'));_0x36be47['field'](_0x3b6e('0xa4'),_0x3b6e('0xa5'));_0x36be47[_0x3b6e('0x50')](_0x3b6e('0xa6'));_0x36be47[_0x3b6e('0x50')](_0x3b6e('0xa7'),_0x3b6e('0xa8'));_0x36be47['field'](_0x3b6e('0xa9'),_0x3b6e('0xaa'));_0x36be47[_0x3b6e('0x50')](_0x3b6e('0xab'),_0x3b6e('0xac'));_0x36be47[_0x3b6e('0x50')](_0x3b6e('0xad'),_0x3b6e('0xae'));_0x36be47[_0x3b6e('0x50')](_0x3b6e('0xaf'),_0x3b6e('0xb0'));_0x36be47['field'](_0x3b6e('0xb1'),_0x3b6e('0xb2'));_0x36be47[_0x3b6e('0x50')]('o.fullname',_0x3b6e('0xb3'));_0x36be47[_0x3b6e('0x50')](_0x3b6e('0xb4'),_0x3b6e('0xb5'));_0x36be47[_0x3b6e('0x50')](_0x3b6e('0xb6'),'TagIds');}if(_0x4ce0e9[_0x3b6e('0x25')])_0x36be47[_0x3b6e('0x25')](_0x4ce0e9[_0x3b6e('0x25')]);if(_0x4ce0e9['offset'])_0x36be47['offset'](_0x4ce0e9[_0x3b6e('0x22')]);return db[_0x3b6e('0x9f')]['query'](_0x36be47[_0x3b6e('0x9e')](),_0x4479f9);})[_0x3b6e('0x2b')](function(_0x992ea5){if(_0x992ea5['length']>0x0)_0x1d83ad['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x3b6e('0x34')](_0x992ea5,'id'));return db['sequelize']['query'](_0x1d83ad[_0x3b6e('0x9e')](),_0x4479f9)['then'](function(_0x24b753){var _0x5ac9d6=_[_0x3b6e('0xb7')](_0x24b753,'SmsInteractionId');var _0x2c0acf=[];_0x992ea5[_0x3b6e('0x39')](function(_0x11ae0c){_0x2c0acf[_0x3b6e('0x3a')](updateSmsInteraction(_0x11ae0c,_0x3e7651,_0x5ac9d6));});return BPromise[_0x3b6e('0xb8')](_0x2c0acf);});});})['then'](function(_0x3eb4b1){_0x4cac70[_0x3b6e('0xb9')]=_0x3eb4b1;return _0x4cac70;})['then'](respondWithFilteredResult(_0x153fcb,_0x4ce0e9))[_0x3b6e('0x3b')](handleError(_0x153fcb,null));};exports[_0x3b6e('0xba')]=function(_0x2cf6e6,_0x41f488){var _0x4b859={'raw':![],'where':{'id':_0x2cf6e6[_0x3b6e('0xbb')]['id']}},_0x34c4a1={};_0x34c4a1['model']=_['keys'](db[_0x3b6e('0x3d')][_0x3b6e('0x3e')]);_0x34c4a1['query']=_[_0x3b6e('0x7b')](_0x2cf6e6[_0x3b6e('0x42')]);_0x34c4a1[_0x3b6e('0x43')]=_['intersection'](_0x34c4a1[_0x3b6e('0x44')],_0x34c4a1[_0x3b6e('0x42')]);_0x4b859[_0x3b6e('0x47')]=_[_0x3b6e('0x45')](_0x34c4a1['model'],qs[_0x3b6e('0x46')](_0x2cf6e6[_0x3b6e('0x42')]['fields']));_0x4b859[_0x3b6e('0x47')]=_0x4b859['attributes']['length']?_0x4b859['attributes']:_0x34c4a1[_0x3b6e('0x44')];if(_0x2cf6e6[_0x3b6e('0x42')]['includeAll']){_0x4b859[_0x3b6e('0xbc')]=[{'all':!![]}];}_0x4b859=_[_0x3b6e('0xbd')]({},_0x4b859,_0x2cf6e6[_0x3b6e('0xbe')]);return db['SmsInteraction']['find'](_0x4b859)[_0x3b6e('0x2b')](handleEntityNotFound(_0x41f488,null))[_0x3b6e('0x2b')](respondWithResult(_0x41f488,null))[_0x3b6e('0x3b')](handleError(_0x41f488,null));};exports['create']=function(_0x240a0d,_0x18ce1c){return db['SmsInteraction']['create'](_0x240a0d['body'],{})[_0x3b6e('0x2b')](respondWithResult(_0x18ce1c,0xc9))['catch'](handleError(_0x18ce1c,null));};exports['update']=function(_0x379078,_0x5ab12e){if(_0x379078[_0x3b6e('0x79')]['id']){delete _0x379078[_0x3b6e('0x79')]['id'];}return db[_0x3b6e('0x3d')][_0x3b6e('0x70')]({'where':{'id':_0x379078['params']['id']}})[_0x3b6e('0x2b')](handleEntityNotFound(_0x5ab12e,null))['then'](saveUpdates(_0x379078[_0x3b6e('0x79')],null))[_0x3b6e('0x2b')](respondWithResult(_0x5ab12e,null))['catch'](handleError(_0x5ab12e,null));};exports['destroy']=function(_0x351dd9,_0x560310){return db[_0x3b6e('0x3d')][_0x3b6e('0x70')]({'where':{'id':_0x351dd9[_0x3b6e('0xbb')]['id']}})[_0x3b6e('0x2b')](handleEntityNotFound(_0x560310,null))[_0x3b6e('0x2b')](removeEntity(_0x560310,null))[_0x3b6e('0x3b')](handleError(_0x560310,null));};exports[_0x3b6e('0xbf')]=function(_0x471446,_0x373b49){return db['SmsInteraction'][_0x3b6e('0xbf')]()[_0x3b6e('0x2b')](respondWithResult(_0x373b49,null))[_0x3b6e('0x3b')](handleError(_0x373b49,null));};exports[_0x3b6e('0xc0')]=function(_0x54f62d,_0xdc9575,_0x2f7241){return db['SmsMessage']['find']({'where':{'id':_0x54f62d[_0x3b6e('0xbb')]['id']}})[_0x3b6e('0x2b')](handleEntityNotFound(_0xdc9575,null))['then'](function(_0x145ef3){if(_0x145ef3){return _0x145ef3[_0x3b6e('0xc0')](_0x54f62d[_0x3b6e('0x79')][_0x3b6e('0xc1')],_['omit'](_0x54f62d[_0x3b6e('0x79')],[_0x3b6e('0xc1'),'id'])||{});}})[_0x3b6e('0x2b')](respondWithResult(_0xdc9575,null))[_0x3b6e('0x3b')](handleError(_0xdc9575,null));};exports[_0x3b6e('0xc2')]=function(_0x16ad58,_0x2f1d58,_0xffe6fd){var _0x18cb6b={'raw':![],'where':{}};var _0x2360de={};var _0x230191={'count':0x0,'rows':[]};return db[_0x3b6e('0x3d')][_0x3b6e('0xc3')]({'where':{'id':_0x16ad58['params']['id']}})[_0x3b6e('0x2b')](handleEntityNotFound(_0x2f1d58,null))[_0x3b6e('0x2b')](function(_0x1e99c3){if(_0x1e99c3){_0x2360de[_0x3b6e('0x44')]=_['keys'](db[_0x3b6e('0xc4')]['rawAttributes']);_0x2360de[_0x3b6e('0x42')]=_[_0x3b6e('0x7b')](_0x16ad58[_0x3b6e('0x42')]);_0x2360de[_0x3b6e('0x43')]=_[_0x3b6e('0x45')](_0x2360de['model'],_0x2360de[_0x3b6e('0x42')]);_0x18cb6b['attributes']=_[_0x3b6e('0x45')](_0x2360de[_0x3b6e('0x44')],qs['fields'](_0x16ad58[_0x3b6e('0x42')][_0x3b6e('0x46')]));_0x18cb6b[_0x3b6e('0x47')]=_0x18cb6b['attributes'][_0x3b6e('0x48')]?_0x18cb6b[_0x3b6e('0x47')]:_0x2360de['model'];if(!_0x16ad58[_0x3b6e('0x42')][_0x3b6e('0x49')]('nolimit')){_0x18cb6b['limit']=qs[_0x3b6e('0x25')](_0x16ad58['query'][_0x3b6e('0x25')]);_0x18cb6b[_0x3b6e('0x22')]=qs[_0x3b6e('0x22')](_0x16ad58['query'][_0x3b6e('0x22')]);}_0x18cb6b[_0x3b6e('0x4b')]=qs['sort'](_0x16ad58[_0x3b6e('0x42')][_0x3b6e('0x4c')]);_0x18cb6b[_0x3b6e('0x4d')]=qs['filters'](_[_0x3b6e('0x4e')](_0x16ad58[_0x3b6e('0x42')],_0x2360de[_0x3b6e('0x43')]));_0x18cb6b[_0x3b6e('0x4d')][_0x3b6e('0xc5')]=_0x1e99c3['id'];if(_0x16ad58[_0x3b6e('0x42')][_0x3b6e('0x89')]){_0x18cb6b[_0x3b6e('0x4d')]=_[_0x3b6e('0xbd')](_0x18cb6b['where'],{'$or':_[_0x3b6e('0x34')](_0x18cb6b[_0x3b6e('0x47')],function(_0x2b14a0){var _0x4251bf={};_0x4251bf[_0x2b14a0]={'$like':'%'+_0x16ad58['query'][_0x3b6e('0x89')]+'%'};return _0x4251bf;})});}if(_0x16ad58['query'][_0x3b6e('0xc6')]){var _0x20fa8e=_0x16ad58[_0x3b6e('0x42')][_0x3b6e('0xc6')][_0x3b6e('0x38')](',');var _0x2f423a={};_0x2f423a[_0x20fa8e[0x0]]={'$gte':moment(_0x20fa8e[0x1])[_0x3b6e('0xc7')](_0x3b6e('0xc8'))};_0x18cb6b[_0x3b6e('0x4d')]=_[_0x3b6e('0xbd')](_0x18cb6b[_0x3b6e('0x4d')],_0x2f423a);}_0x18cb6b=_[_0x3b6e('0xbd')]({},_0x18cb6b,_0x16ad58[_0x3b6e('0xbe')]);return db['SmsMessage'][_0x3b6e('0x24')]({'where':_0x18cb6b['where']})[_0x3b6e('0x2b')](function(_0x3aab86){_0x230191[_0x3b6e('0x24')]=_0x3aab86;if(_0x16ad58['query'][_0x3b6e('0xc9')]){_0x18cb6b[_0x3b6e('0xbc')]=[{'all':!![]}];}return db[_0x3b6e('0xc4')][_0x3b6e('0xca')](_0x18cb6b);})[_0x3b6e('0x2b')](function(_0x1b1db9){_0x230191[_0x3b6e('0xb9')]=_0x1b1db9;return _0x230191;});}})['then'](respondWithFilteredResult(_0x2f1d58,_0x18cb6b))['catch'](handleError(_0x2f1d58,null));};exports['addTags']=function(_0x36fc3a,_0xc65a46,_0x870eae){return db[_0x3b6e('0x3d')][_0x3b6e('0x70')]({'where':{'id':_0x36fc3a[_0x3b6e('0xbb')]['id']}})[_0x3b6e('0x2b')](handleEntityNotFound(_0xc65a46,null))[_0x3b6e('0x2b')](function(_0x2dacef){if(_0x2dacef){return _0x2dacef[_0x3b6e('0xcb')](_0x36fc3a[_0x3b6e('0x79')][_0x3b6e('0xc1')],_[_0x3b6e('0xcc')](_0x36fc3a['body'],[_0x3b6e('0xc1'),'id'])||{})[_0x3b6e('0xcd')](function(){return db['Tag']['findAll']({'attributes':['id',_0x3b6e('0x31'),_0x3b6e('0x51')],'where':{'id':_0x36fc3a[_0x3b6e('0x79')][_0x3b6e('0xc1')]}});})['then'](function(_0x1e0653){socket[_0x3b6e('0xce')]('smsInteractionTags:save',{'id':Number(_0x36fc3a[_0x3b6e('0xbb')]['id']),'tags':_0x1e0653||[]});return{'id':Number(_0x36fc3a[_0x3b6e('0xbb')]['id']),'tags':_0x1e0653||[]};});}})[_0x3b6e('0x2b')](respondWithResult(_0xc65a46,null))[_0x3b6e('0x3b')](handleError(_0xc65a46,null));};exports[_0x3b6e('0xcf')]=function(_0x151f99,_0x268fec,_0x31532c){return db[_0x3b6e('0x3d')]['find']({'where':{'id':_0x151f99['params']['id']}})[_0x3b6e('0x2b')](handleEntityNotFound(_0x268fec,null))[_0x3b6e('0x2b')](function(_0x723cb5){if(_0x723cb5){return _0x723cb5[_0x3b6e('0xcf')](_0x151f99[_0x3b6e('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x268fec,null))['catch'](handleError(_0x268fec,null));};exports[_0x3b6e('0xd0')]=function(_0x24217b,_0x27d09f){var _0x367f6c=moment()[_0x3b6e('0xd1')]()[_0x3b6e('0x9e')]();var _0x4a4b60=path['join'](config[_0x3b6e('0xd2')],_0x3b6e('0xd3'),'files','tmp');var _0x150e2a=path[_0x3b6e('0xd4')](config['root'],_0x3b6e('0xd3'),'files',_0x3b6e('0xd5'));var _0x18327a=path[_0x3b6e('0xd4')](_0x4a4b60,_0x367f6c);var _0x1fe42d=util[_0x3b6e('0xc7')](_0x3b6e('0xd6'),_0x24217b['params']['id'],_0x367f6c);var _0x4dd846=path['join'](_0x4a4b60,_0x1fe42d);var _0x46d422=[];_0x46d422[_0x3b6e('0x3a')]({'model':db[_0x3b6e('0x75')],'as':'User','attributes':['id',_0x3b6e('0x35')],'raw':!![]});_0x46d422[_0x3b6e('0x3a')]({'model':db[_0x3b6e('0xd7')],'as':'Contact','attributes':['id',_0x3b6e('0xd8'),_0x3b6e('0xd9')],'raw':!![]});var _0x427396=[{'model':db[_0x3b6e('0xc4')],'as':_0x3b6e('0xda'),'attributes':['id',_0x3b6e('0x79'),_0x3b6e('0x80'),'direction','secret',_0x3b6e('0x84')],'include':_0x46d422}];_0x427396[_0x3b6e('0x3a')]({'model':db[_0x3b6e('0xdb')],'as':_0x3b6e('0xdc'),'attributes':['id',_0x3b6e('0x31')]});_0x427396[_0x3b6e('0x3a')]({'model':db[_0x3b6e('0x75')],'as':_0x3b6e('0xdd'),'attributes':['id',_0x3b6e('0x35')]});return db[_0x3b6e('0x3d')][_0x3b6e('0x70')]({'where':{'id':_0x24217b[_0x3b6e('0xbb')]['id']},'include':_0x427396})[_0x3b6e('0x2b')](handleEntityNotFound(_0x27d09f,null))[_0x3b6e('0x2b')](function(_0x316977){if(_0x316977){var _0x1d0207=_0x316977['get']({'plain':!![]});fs[_0x3b6e('0xde')](_0x18327a);var _0x478c08={'channel':'Sms','account':_0x1d0207[_0x3b6e('0xdc')][_0x3b6e('0x31')],'agent':_0x1d0207[_0x3b6e('0xdd')]?_0x1d0207[_0x3b6e('0xdd')]['fullname']:_0x3b6e('0xdf'),'createdAt':moment(_0x1d0207[_0x3b6e('0x80')])[_0x3b6e('0xc7')](_0x3b6e('0xc8'))[_0x3b6e('0x9e')](),'closedAt':_0x1d0207[_0x3b6e('0xe0')]?moment(_0x1d0207[_0x3b6e('0xe1')])['format'](_0x3b6e('0xc8'))[_0x3b6e('0x9e')]():'','disposition':_0x1d0207['disposition'],'messages':_(_0x1d0207[_0x3b6e('0xda')])[_0x3b6e('0x89')]({'secret':![]})[_0x3b6e('0x34')](function(_0x43f8bb){return{'date':moment(_0x43f8bb['createdAt'])[_0x3b6e('0xc7')](_0x3b6e('0xc8'))[_0x3b6e('0x9e')](),'sender':_0x43f8bb[_0x3b6e('0xe2')]===_0x3b6e('0xe3')?_0x43f8bb[_0x3b6e('0x75')]?_0x43f8bb[_0x3b6e('0x75')][_0x3b6e('0x35')]:'System':_0x43f8bb[_0x3b6e('0x6a')][_0x3b6e('0xd8')]+(_0x43f8bb[_0x3b6e('0x6a')][_0x3b6e('0xd9')]?'\x20'+_0x43f8bb[_0x3b6e('0x6a')][_0x3b6e('0xd9')]:''),'body':_0x43f8bb['body'],'direction':_0x43f8bb[_0x3b6e('0xe2')]===_0x3b6e('0xe3')?'A':'C','secret':_0x43f8bb[_0x3b6e('0xe4')],'read':_0x43f8bb[_0x3b6e('0x84')]};})[_0x3b6e('0x6d')]()};return ejs[_0x3b6e('0xe5')](path[_0x3b6e('0xd4')](config[_0x3b6e('0xd2')],'server',_0x3b6e('0xe6'),_0x3b6e('0xe7')),{'interaction':_0x478c08})[_0x3b6e('0x2b')](function(_0x201ef6){var _0x4c2d43=path['join'](_0x18327a,_0x3b6e('0xe8')+_0x1d0207['id']+'-'+_0x367f6c+_0x3b6e('0xe9'));var _0x508970={'path':_0x4c2d43,'channel':_0x3b6e('0xea'),'interactionId':_0x1d0207['id']};return pdf[_0x3b6e('0xeb')](_0x201ef6,_0x508970);})['then'](function(){return new BPromise(function(_0x1efde9,_0x40acb4){zipdir(_0x18327a,{'saveTo':_0x4dd846},function(_0x184ed6,_0x28add0){if(_0x184ed6)return _0x40acb4(_0x184ed6);return _0x1efde9(_0x28add0);});})[_0x3b6e('0x2b')](function(){return new BPromise(function(_0xdac8be,_0x258d86){rimraf(_0x18327a,function(_0x27a73f){if(_0x27a73f)_0x258d86(_0x27a73f);return _0xdac8be();});});})[_0x3b6e('0x2b')](function(){return _0x27d09f[_0x3b6e('0xd0')](_0x4dd846,_0x1fe42d,function(_0x294b63){if(_0x294b63){console[_0x3b6e('0xec')]('err',_0x294b63);}else{fs['unlinkSync'](_0x4dd846);}});});});}else{return _0x27d09f[_0x3b6e('0x2e')](0xc8);}})[_0x3b6e('0x3b')](handleError(_0x27d09f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 9dc5bea..31fbf9c 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 _0x0598=['catch','hasOwnProperty','events','../../mysqldb','save','update','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x451ce0,_0x3d5e2f){var _0x4808d2=function(_0x29ddc1){while(--_0x29ddc1){_0x451ce0['push'](_0x451ce0['shift']());}};_0x4808d2(++_0x3d5e2f);}(_0x0598,0x92));var _0x8059=function(_0x4ee115,_0x2d7156){_0x4ee115=_0x4ee115-0x0;var _0x543bbf=_0x0598[_0x4ee115];return _0x543bbf;};'use strict';var EventEmitter=require(_0x8059('0x0'));var SmsInteraction=require(_0x8059('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8059('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8059('0x2'),'afterUpdate':_0x8059('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54f42f){return function(_0x555fb5,_0x467206,_0xa7d7c1){_0x555fb5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x248273){_0x555fb5[_0x8059('0x4')](_0x8059('0x5'),_0x248273[_0x8059('0x6')](function(_0x5df268){return{'id':_0x5df268['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x555fb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8059('0x7')](function(_0x1bf5fd){_0x555fb5[_0x8059('0x4')](_0x8059('0x8'),_0x1bf5fd[_0x8059('0x9')]);SmsInteractionEvents['emit'](_0x54f42f+':'+_0x555fb5['id'],_0x555fb5);SmsInteractionEvents['emit'](_0x54f42f,_0x555fb5);_0xa7d7c1(null);})[_0x8059('0xa')](_0xa7d7c1(null));};}for(var e in events){if(events[_0x8059('0xb')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x236c=['length','emit','catch','hasOwnProperty','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','findAll','unreadMessages'];(function(_0x404972,_0x8d8a0b){var _0x267045=function(_0x18ed0e){while(--_0x18ed0e){_0x404972['push'](_0x404972['shift']());}};_0x267045(++_0x8d8a0b);}(_0x236c,0x155));var _0xc236=function(_0x5f1c0e,_0xe8642b){_0x5f1c0e=_0x5f1c0e-0x0;var _0x33d9ed=_0x236c[_0x5f1c0e];return _0x33d9ed;};'use strict';var EventEmitter=require(_0xc236('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xc236('0x1')];var SmsMessage=require(_0xc236('0x2'))['db'][_0xc236('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc236('0x4')](0x0);var events={'afterCreate':_0xc236('0x5'),'afterUpdate':'update','afterDestroy':_0xc236('0x6')};function emitEvent(_0x36e87d){return function(_0x33bc57,_0xd582f6,_0x23d3cc){_0x33bc57[_0xc236('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd612c6){_0x33bc57[_0xc236('0x8')]('Users',_0xd612c6['map'](function(_0x5cdee5){return{'id':_0x5cdee5['id']};}));return SmsMessage[_0xc236('0x9')]({'where':{'SmsInteractionId':_0x33bc57['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30a28d){_0x33bc57[_0xc236('0x8')](_0xc236('0xa'),_0x30a28d[_0xc236('0xb')]);SmsInteractionEvents[_0xc236('0xc')](_0x36e87d+':'+_0x33bc57['id'],_0x33bc57);SmsInteractionEvents['emit'](_0x36e87d,_0x33bc57);_0x23d3cc(null);})[_0xc236('0xd')](_0x23d3cc(null));};}for(var e in events){if(events[_0xc236('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc236('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 98960be..12bce88 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 _0x4223=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','SmsInteraction','sms_interactions'];(function(_0x40f720,_0x3a65b9){var _0xe0259f=function(_0x22b358){while(--_0x22b358){_0x40f720['push'](_0x40f720['shift']());}};_0xe0259f(++_0x3a65b9);}(_0x4223,0x19a));var _0x3422=function(_0x4b02db,_0x1d4d62){_0x4b02db=_0x4b02db-0x0;var _0x2bfd54=_0x4223[_0x4b02db];return _0x2bfd54;};'use strict';var _=require(_0x3422('0x0'));var util=require(_0x3422('0x1'));var logger=require('../../config/logger')(_0x3422('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3422('0x3'));var fs=require('fs');var path=require(_0x3422('0x4'));var rimraf=require(_0x3422('0x5'));var config=require(_0x3422('0x6'));var attributes=require(_0x3422('0x7'));module['exports']=function(_0x1724f3,_0x5298bc){return _0x1724f3['define'](_0x3422('0x8'),attributes,{'tableName':_0x3422('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd4cc92,_0x502c03,_0x2bbb72){if(_0xd4cc92[_0x3422('0xa')](_0x3422('0xb'))){_0xd4cc92['closedAt']=moment()[_0x3422('0xc')](_0x3422('0xd'));}_0x2bbb72(null,_0xd4cc92);}}});}; \ No newline at end of file +var _0xb9f5=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9f5,0xf1));var _0x5b9f=function(_0x519d77,_0x4e758e){_0x519d77=_0x519d77-0x0;var _0x56e79d=_0xb9f5[_0x519d77];return _0x56e79d;};'use strict';var _=require(_0x5b9f('0x0'));var util=require(_0x5b9f('0x1'));var logger=require('../../config/logger')(_0x5b9f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b9f('0x3'));var config=require(_0x5b9f('0x4'));var attributes=require(_0x5b9f('0x5'));module['exports']=function(_0x55a150,_0x38f8d6){return _0x55a150[_0x5b9f('0x6')](_0x5b9f('0x7'),attributes,{'tableName':_0x5b9f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13b572,_0x59c8de,_0x530fa1){if(_0x13b572[_0x5b9f('0x9')](_0x5b9f('0xa'))){_0x13b572[_0x5b9f('0xb')]=moment()[_0x5b9f('0xc')](_0x5b9f('0xd'));}_0x530fa1(null,_0x13b572);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 495cf79..b151da4 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 _0xc2a5=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','result','catch','SmsInteraction','options','where','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','ids','omit','body','AddTags','lodash','util'];(function(_0x506002,_0x17ad62){var _0x5a020c=function(_0xf907bc){while(--_0xf907bc){_0x506002['push'](_0x506002['shift']());}};_0x5a020c(++_0x17ad62);}(_0xc2a5,0x14e));var _0x5c2a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc2a5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5c2a('0x0'));var util=require(_0x5c2a('0x1'));var moment=require(_0x5c2a('0x2'));var BPromise=require(_0x5c2a('0x3'));var rs=require(_0x5c2a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c2a('0x5'))['db'];var utils=require(_0x5c2a('0x6'));var logger=require(_0x5c2a('0x7'))(_0x5c2a('0x8'));var config=require(_0x5c2a('0x9'));var jayson=require(_0x5c2a('0xa'));var client=jayson[_0x5c2a('0xb')][_0x5c2a('0xc')]({'port':0x232a});config['redis']=_[_0x5c2a('0xd')](config[_0x5c2a('0xe')],{'host':_0x5c2a('0xf'),'port':0x18eb});var socket=require(_0x5c2a('0x10'))(new Redis(config['redis']));require(_0x5c2a('0x11'))[_0x5c2a('0x12')](socket);function respondWithRpcPromise(_0x30d0cf,_0x14f08f,_0x2b17de){return new BPromise(function(_0x1cd1c2,_0x166b04){return client['request'](_0x30d0cf,_0x2b17de)['then'](function(_0x3aea6c){logger[_0x5c2a('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x14f08f,'request\x20sent');logger[_0x5c2a('0x14')](_0x5c2a('0x15'),_0x14f08f,'request\x20sent',JSON[_0x5c2a('0x16')](_0x3aea6c));if(_0x3aea6c['error']){if(_0x3aea6c[_0x5c2a('0x17')][_0x5c2a('0x18')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x14f08f,_0x3aea6c[_0x5c2a('0x17')][_0x5c2a('0x19')]);return _0x166b04(_0x3aea6c['error'][_0x5c2a('0x19')]);}logger['error'](_0x5c2a('0x1a'),_0x14f08f,_0x3aea6c['error'][_0x5c2a('0x19')]);return _0x1cd1c2(_0x3aea6c[_0x5c2a('0x17')]['message']);}else{logger['info'](_0x5c2a('0x1a'),_0x14f08f,'request\x20sent');_0x1cd1c2(_0x3aea6c[_0x5c2a('0x1b')][_0x5c2a('0x19')]);}})[_0x5c2a('0x1c')](function(_0x23bbc6){logger[_0x5c2a('0x17')](_0x5c2a('0x1a'),_0x14f08f,_0x23bbc6);_0x166b04(_0x23bbc6);});});}exports['UpdateSmsInteraction']=function(_0x1c8dd1){var _0x41a366=this;return new Promise(function(_0x4b8e81,_0x3d04e0){return db[_0x5c2a('0x1d')]['update'](_0x1c8dd1['body'],{'raw':_0x1c8dd1[_0x5c2a('0x1e')]?_0x1c8dd1[_0x5c2a('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c8dd1[_0x5c2a('0x1e')]?_0x1c8dd1[_0x5c2a('0x1e')][_0x5c2a('0x1f')]||null:null,'attributes':_0x1c8dd1[_0x5c2a('0x1e')]?_0x1c8dd1[_0x5c2a('0x1e')][_0x5c2a('0x20')]||null:null,'limit':_0x1c8dd1[_0x5c2a('0x1e')]?_0x1c8dd1[_0x5c2a('0x1e')][_0x5c2a('0x21')]||null:null})[_0x5c2a('0x22')](function(_0xead9c3){logger[_0x5c2a('0x13')](_0x5c2a('0x23'),_0x1c8dd1);logger[_0x5c2a('0x14')]('UpdateSmsInteraction',_0x1c8dd1,JSON[_0x5c2a('0x16')](_0xead9c3));_0x4b8e81(_0xead9c3);})[_0x5c2a('0x1c')](function(_0x544450){logger[_0x5c2a('0x17')](_0x5c2a('0x23'),_0x544450[_0x5c2a('0x19')],_0x1c8dd1);_0x3d04e0(_0x41a366[_0x5c2a('0x17')](0x1f4,_0x544450[_0x5c2a('0x19')]));});});};exports[_0x5c2a('0x24')]=function(_0x35aa21){return new Promise(function(_0x132af8,_0x20dc4c){return db['SmsInteraction'][_0x5c2a('0x25')]({'where':_0x35aa21['options']?_0x35aa21[_0x5c2a('0x1e')][_0x5c2a('0x1f')]||null:null})[_0x5c2a('0x22')](function(_0x2c3f65){if(_0x2c3f65){return _0x2c3f65['addTags'](_0x35aa21['body'][_0x5c2a('0x26')],_[_0x5c2a('0x27')](_0x35aa21[_0x5c2a('0x28')],[_0x5c2a('0x26'),'id'])||{});}})['spread'](function(_0x66e653){logger['info'](_0x5c2a('0x29'),_0x35aa21);logger['debug'](_0x5c2a('0x29'),_0x35aa21,JSON[_0x5c2a('0x16')](_0x66e653));_0x132af8(_0x66e653);})[_0x5c2a('0x1c')](function(_0x230bb){logger['error']('AddTags',_0x230bb[_0x5c2a('0x19')],_0x35aa21);_0x20dc4c(_this[_0x5c2a('0x17')](0x1f4,_0x230bb[_0x5c2a('0x19')]));});});}; \ No newline at end of file +var _0x2d49=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis'];(function(_0x247cb6,_0x136177){var _0x554363=function(_0x5c981f){while(--_0x5c981f){_0x247cb6['push'](_0x247cb6['shift']());}};_0x554363(++_0x136177);}(_0x2d49,0x154));var _0x92d4=function(_0x22b7b2,_0x55532a){_0x22b7b2=_0x22b7b2-0x0;var _0x5a6360=_0x2d49[_0x22b7b2];return _0x5a6360;};'use strict';var _=require(_0x92d4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x92d4('0x1'));var rs=require(_0x92d4('0x2'));var fs=require('fs');var Redis=require(_0x92d4('0x3'));var db=require(_0x92d4('0x4'))['db'];var utils=require(_0x92d4('0x5'));var logger=require(_0x92d4('0x6'))('rpc');var config=require(_0x92d4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x92d4('0x8')]['http']({'port':0x232a});config[_0x92d4('0x9')]=_[_0x92d4('0xa')](config[_0x92d4('0x9')],{'host':_0x92d4('0xb'),'port':0x18eb});var socket=require(_0x92d4('0xc'))(new Redis(config[_0x92d4('0x9')]));require(_0x92d4('0xd'))[_0x92d4('0xe')](socket);function respondWithRpcPromise(_0x5cab15,_0x1cb198,_0x4dff68){return new BPromise(function(_0x1990ba,_0x107b65){return client[_0x92d4('0xf')](_0x5cab15,_0x4dff68)[_0x92d4('0x10')](function(_0x373674){logger[_0x92d4('0x11')](_0x92d4('0x12'),_0x1cb198,'request\x20sent');logger[_0x92d4('0x13')](_0x92d4('0x14'),_0x1cb198,'request\x20sent',JSON[_0x92d4('0x15')](_0x373674));if(_0x373674[_0x92d4('0x16')]){if(_0x373674[_0x92d4('0x16')][_0x92d4('0x17')]===0x1f4){logger[_0x92d4('0x16')](_0x92d4('0x12'),_0x1cb198,_0x373674[_0x92d4('0x16')]['message']);return _0x107b65(_0x373674[_0x92d4('0x16')][_0x92d4('0x18')]);}logger[_0x92d4('0x16')](_0x92d4('0x12'),_0x1cb198,_0x373674[_0x92d4('0x16')][_0x92d4('0x18')]);return _0x1990ba(_0x373674[_0x92d4('0x16')][_0x92d4('0x18')]);}else{logger['info'](_0x92d4('0x12'),_0x1cb198,_0x92d4('0x19'));_0x1990ba(_0x373674[_0x92d4('0x1a')]['message']);}})['catch'](function(_0x4b7096){logger['error'](_0x92d4('0x12'),_0x1cb198,_0x4b7096);_0x107b65(_0x4b7096);});});}exports[_0x92d4('0x1b')]=function(_0x2a7d44){var _0x25b7f6=this;return new Promise(function(_0x4a019c,_0x1594fc){return db[_0x92d4('0x1c')][_0x92d4('0x1d')](_0x2a7d44[_0x92d4('0x1e')],{'raw':_0x2a7d44['options']?_0x2a7d44[_0x92d4('0x1f')][_0x92d4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a7d44[_0x92d4('0x1f')]?_0x2a7d44['options'][_0x92d4('0x21')]||null:null,'attributes':_0x2a7d44[_0x92d4('0x1f')]?_0x2a7d44['options'][_0x92d4('0x22')]||null:null,'limit':_0x2a7d44['options']?_0x2a7d44['options'][_0x92d4('0x23')]||null:null})[_0x92d4('0x10')](function(_0x2320c7){logger[_0x92d4('0x11')]('UpdateSmsInteraction',_0x2a7d44);logger[_0x92d4('0x13')]('UpdateSmsInteraction',_0x2a7d44,JSON[_0x92d4('0x15')](_0x2320c7));_0x4a019c(_0x2320c7);})[_0x92d4('0x24')](function(_0x743d81){logger['error'](_0x92d4('0x1b'),_0x743d81[_0x92d4('0x18')],_0x2a7d44);_0x1594fc(_0x25b7f6[_0x92d4('0x16')](0x1f4,_0x743d81[_0x92d4('0x18')]));});});};exports[_0x92d4('0x25')]=function(_0x1565b8){return new Promise(function(_0x2b4ec4,_0x48b838){return db[_0x92d4('0x1c')][_0x92d4('0x26')]({'where':_0x1565b8['options']?_0x1565b8[_0x92d4('0x1f')][_0x92d4('0x21')]||null:null})[_0x92d4('0x10')](function(_0x59c1fd){if(_0x59c1fd){return _0x59c1fd['addTags'](_0x1565b8[_0x92d4('0x1e')][_0x92d4('0x27')],_[_0x92d4('0x28')](_0x1565b8[_0x92d4('0x1e')],['ids','id'])||{});}})[_0x92d4('0x29')](function(_0x4d1b1e){logger['info'](_0x92d4('0x2a'),_0x1565b8);logger[_0x92d4('0x13')]('AddTags',_0x1565b8,JSON[_0x92d4('0x15')](_0x4d1b1e));_0x2b4ec4(_0x4d1b1e);})['catch'](function(_0x1f8053){logger[_0x92d4('0x16')](_0x92d4('0x2a'),_0x1f8053[_0x92d4('0x18')],_0x1565b8);_0x48b838(_this[_0x92d4('0x16')](0x1f4,_0x1f8053[_0x92d4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 60a78cc..1810813 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 _0x5e1d=['./smsInteraction.events','save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x5637d6,_0x55702d){var _0x42c886=function(_0x6181d1){while(--_0x6181d1){_0x5637d6['push'](_0x5637d6['shift']());}};_0x42c886(++_0x55702d);}(_0x5e1d,0xc8));var _0xd5e1=function(_0x2d1cf6,_0x3864fe){_0x2d1cf6=_0x2d1cf6-0x0;var _0x3d4d16=_0x5e1d[_0x2d1cf6];return _0x3d4d16;};'use strict';var SmsInteractionEvents=require(_0xd5e1('0x0'));var events=[_0xd5e1('0x1'),_0xd5e1('0x2'),_0xd5e1('0x3')];function createListener(_0x354d59,_0x1c7fc0){return function(_0x83511){_0x1c7fc0['emit'](_0x354d59,_0x83511);};}function removeListener(_0x10e866,_0x3b0ef3){return function(){SmsInteractionEvents[_0xd5e1('0x4')](_0x10e866,_0x3b0ef3);};}exports[_0xd5e1('0x5')]=function(_0x2a164c){for(var _0x53df64=0x0,_0x556a61=events[_0xd5e1('0x6')];_0x53df64<_0x556a61;_0x53df64++){var _0x17b581=events[_0x53df64];var _0x450b6a=createListener(_0xd5e1('0x7')+_0x17b581,_0x2a164c);SmsInteractionEvents['on'](_0x17b581,_0x450b6a);}}; \ No newline at end of file +var _0x18e9=['smsInteraction:','./smsInteraction.events','remove','update','removeListener','length'];(function(_0x1b7c56,_0x114f45){var _0x53b5ac=function(_0x137c89){while(--_0x137c89){_0x1b7c56['push'](_0x1b7c56['shift']());}};_0x53b5ac(++_0x114f45);}(_0x18e9,0x1b1));var _0x918e=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x18e9[_0x39872b];return _0x55fa18;};'use strict';var SmsInteractionEvents=require(_0x918e('0x0'));var events=['save',_0x918e('0x1'),_0x918e('0x2')];function createListener(_0x4e1815,_0x5685db){return function(_0x12e04c){_0x5685db['emit'](_0x4e1815,_0x12e04c);};}function removeListener(_0x4250ff,_0x1b7b3e){return function(){SmsInteractionEvents[_0x918e('0x3')](_0x4250ff,_0x1b7b3e);};}exports['register']=function(_0x1b1e87){for(var _0x19e548=0x0,_0xcf1323=events[_0x918e('0x4')];_0x19e548<_0xcf1323;_0x19e548++){var _0x5ebfc1=events[_0x19e548];var _0x4f5d0d=createListener(_0x918e('0x5')+_0x5ebfc1,_0x1b1e87);SmsInteractionEvents['on'](_0x5ebfc1,_0x4f5d0d);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1e8be28..be96139 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 _0x9ad9=['put','/:id/accept','accept','/:id/reject','reject','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','smsmessage:create','/:id/status','status'];(function(_0x3afafe,_0x3a0db3){var _0x39ac5b=function(_0x51b1c2){while(--_0x51b1c2){_0x3afafe['push'](_0x3afafe['shift']());}};_0x39ac5b(++_0x3a0db3);}(_0x9ad9,0xbc));var _0x99ad=function(_0x2e2d89,_0x4bb615){_0x2e2d89=_0x2e2d89-0x0;var _0x3aba90=_0x9ad9[_0x2e2d89];return _0x3aba90;};'use strict';var multer=require(_0x99ad('0x0'));var util=require('util');var path=require(_0x99ad('0x1'));var timeout=require(_0x99ad('0x2'));var express=require(_0x99ad('0x3'));var router=express[_0x99ad('0x4')]();var fs_extra=require(_0x99ad('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x99ad('0x6'));var config=require(_0x99ad('0x7'));var controller=require(_0x99ad('0x8'));router[_0x99ad('0x9')]('/',auth['isAuthenticated'](),controller[_0x99ad('0xa')]);router[_0x99ad('0x9')](_0x99ad('0xb'),auth[_0x99ad('0xc')](),controller[_0x99ad('0xd')]);router[_0x99ad('0x9')](_0x99ad('0xe'),auth[_0x99ad('0xc')](),controller[_0x99ad('0xf')]);router[_0x99ad('0x10')]('/',auth[_0x99ad('0xc')](),interaction['tracked']('sms',_0x99ad('0x11')),controller['create']);router[_0x99ad('0x10')](_0x99ad('0x12'),controller[_0x99ad('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x99ad('0x14')](_0x99ad('0x15'),auth[_0x99ad('0xc')](),controller[_0x99ad('0x16')]);router[_0x99ad('0x14')](_0x99ad('0x17'),auth[_0x99ad('0xc')](),controller[_0x99ad('0x18')]);router['delete'](_0x99ad('0xe'),auth['isAuthenticated'](),controller[_0x99ad('0x19')]);module['exports']=router; \ No newline at end of file +var _0x49db=['../../components/auth/service','../../components/interaction/service','./smsMessage.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x49db,0xc5));var _0xb49d=function(_0x27bb18,_0x41be78){_0x27bb18=_0x27bb18-0x0;var _0x3ca6fb=_0x49db[_0x27bb18];return _0x3ca6fb;};'use strict';var multer=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var path=require(_0xb49d('0x2'));var timeout=require(_0xb49d('0x3'));var express=require(_0xb49d('0x4'));var router=express['Router']();var fs_extra=require(_0xb49d('0x5'));var auth=require(_0xb49d('0x6'));var interaction=require(_0xb49d('0x7'));var config=require('../../config/environment');var controller=require(_0xb49d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb49d('0x9')]);router[_0xb49d('0xa')](_0xb49d('0xb'),auth['isAuthenticated'](),controller[_0xb49d('0xc')]);router[_0xb49d('0xa')](_0xb49d('0xd'),auth[_0xb49d('0xe')](),controller[_0xb49d('0xf')]);router[_0xb49d('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xb49d('0x11'),_0xb49d('0x12')),controller[_0xb49d('0x13')]);router[_0xb49d('0x10')](_0xb49d('0x14'),controller[_0xb49d('0x15')]);router[_0xb49d('0x16')](_0xb49d('0xd'),auth[_0xb49d('0xe')](),controller['update']);router[_0xb49d('0x16')](_0xb49d('0x17'),auth[_0xb49d('0xe')](),controller[_0xb49d('0x18')]);router['put'](_0xb49d('0x19'),auth[_0xb49d('0xe')](),controller['reject']);router[_0xb49d('0x1a')](_0xb49d('0xd'),auth[_0xb49d('0xe')](),controller[_0xb49d('0x1b')]);module[_0xb49d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2504078..3e2af90 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 _0xda7a=['STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x182f52,_0x463be0){var _0x3a4cd9=function(_0x37a483){while(--_0x37a483){_0x182f52['push'](_0x182f52['shift']());}};_0x3a4cd9(++_0x463be0);}(_0xda7a,0x15a));var _0xada7=function(_0x58b635,_0xc76a6b){_0x58b635=_0x58b635-0x0;var _0x552de0=_0xda7a[_0x58b635];return _0x552de0;};'use strict';var Sequelize=require(_0xada7('0x0'));module[_0xada7('0x1')]={'body':{'type':Sequelize[_0xada7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xada7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xada7('0x4')]('in','out'),'defaultValue':_0xada7('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xada7('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xada7('0x7')]},'secret':{'type':Sequelize[_0xada7('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xada7('0x6')]},'providerResponse':{'type':Sequelize[_0xada7('0x2')]}}; \ No newline at end of file +var _0x9bcc=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x144844,_0xd6f32c){var _0x5301dd=function(_0x244c07){while(--_0x244c07){_0x144844['push'](_0x144844['shift']());}};_0x5301dd(++_0xd6f32c);}(_0x9bcc,0x1b7));var _0xc9bc=function(_0x193206,_0x54249f){_0x193206=_0x193206-0x0;var _0x1785b7=_0x9bcc[_0x193206];return _0x1785b7;};'use strict';var Sequelize=require(_0xc9bc('0x0'));module[_0xc9bc('0x1')]={'body':{'type':Sequelize[_0xc9bc('0x2')](_0xc9bc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc9bc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc9bc('0x5')]('in',_0xc9bc('0x6')),'defaultValue':_0xc9bc('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc9bc('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc9bc('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc9bc('0x7')]},'providerResponse':{'type':Sequelize[_0xc9bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 35f026b..e39a074 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 _0xf1b7=['localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','SmsMessage','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','rows','keys','rawAttributes','includeAll','options','find','create','body','update','params','describe','sms-interactions','accept','sms','read','format','UserId','agent','get','SmsInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','info','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','email','manual','interface','SIP/%s','event','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','User','channel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','infobip','results','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','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'];(function(_0x2b6a8b,_0x1cea77){var _0x28ceb2=function(_0x156695){while(--_0x156695){_0x2b6a8b['push'](_0x2b6a8b['shift']());}};_0x28ceb2(++_0x1cea77);}(_0xf1b7,0x1ae));var _0x7f1b=function(_0x31c0db,_0x9c5a04){_0x31c0db=_0x31c0db-0x0;var _0x4c7d16=_0xf1b7[_0x31c0db];return _0x4c7d16;};'use strict';var emlformat=require(_0x7f1b('0x0'));var rimraf=require(_0x7f1b('0x1'));var zipdir=require(_0x7f1b('0x2'));var jsonpatch=require(_0x7f1b('0x3'));var rp=require(_0x7f1b('0x4'));var moment=require(_0x7f1b('0x5'));var BPromise=require(_0x7f1b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7f1b('0x7'));var sox=require(_0x7f1b('0x8'));var csv=require('to-csv');var ejs=require(_0x7f1b('0x9'));var fs=require('fs');var fs_extra=require(_0x7f1b('0xa'));var _=require(_0x7f1b('0xb'));var squel=require(_0x7f1b('0xc'));var crypto=require(_0x7f1b('0xd'));var jsforce=require(_0x7f1b('0xe'));var deskjs=require(_0x7f1b('0xf'));var toCsv=require(_0x7f1b('0x10'));var querystring=require(_0x7f1b('0x11'));var Papa=require(_0x7f1b('0x12'));var Redis=require(_0x7f1b('0x13'));var authService=require(_0x7f1b('0x14'));var qs=require(_0x7f1b('0x15'));var as=require(_0x7f1b('0x16'));var hardwareService=require(_0x7f1b('0x17'));var logger=require(_0x7f1b('0x18'))(_0x7f1b('0x19'));var utils=require(_0x7f1b('0x1a'));var config=require(_0x7f1b('0x1b'));var licenseUtil=require(_0x7f1b('0x1c'));var db=require(_0x7f1b('0x1d'))['db'];config[_0x7f1b('0x1e')]=_[_0x7f1b('0x1f')](config[_0x7f1b('0x1e')],{'host':_0x7f1b('0x20'),'port':0x18eb});var socket=require(_0x7f1b('0x21'))(new Redis(config['redis']));require(_0x7f1b('0x22'))[_0x7f1b('0x23')](socket);var jayson=require(_0x7f1b('0x24'));var client=jayson[_0x7f1b('0x25')][_0x7f1b('0x26')]({'port':0x232c});var client9002=jayson[_0x7f1b('0x25')][_0x7f1b('0x26')]({'port':0x232a});function respondWithRpcPromise(_0x273bfa,_0x198bbf,_0xf9adfe,_0x3ee975){return new BPromise(function(_0x1dbf4f,_0x4e5981){var _0x4e5415=_0x3ee975||client;return _0x4e5415[_0x7f1b('0x27')](_0x273bfa,_0xf9adfe)['then'](function(_0x520835){logger['info'](_0x7f1b('0x28'),_0x198bbf,_0x7f1b('0x29'));logger[_0x7f1b('0x2a')](_0x7f1b('0x2b'),_0x198bbf,_0x7f1b('0x29'),JSON[_0x7f1b('0x2c')](_0x520835));if(_0x520835[_0x7f1b('0x2d')]){if(_0x520835[_0x7f1b('0x2d')][_0x7f1b('0x2e')]===0x1f4){logger[_0x7f1b('0x2d')](_0x7f1b('0x28'),_0x198bbf,_0x520835['error'][_0x7f1b('0x2f')]);return _0x4e5981(_0x520835[_0x7f1b('0x2d')]['message']);}logger[_0x7f1b('0x2d')]('SmsMessage,\x20%s,\x20%s',_0x198bbf,_0x520835[_0x7f1b('0x2d')][_0x7f1b('0x2f')]);return _0x1dbf4f(_0x520835[_0x7f1b('0x2d')][_0x7f1b('0x2f')]);}else{logger['info'](_0x7f1b('0x28'),_0x198bbf,_0x7f1b('0x29'));_0x1dbf4f(_0x520835[_0x7f1b('0x30')][_0x7f1b('0x2f')]);}})[_0x7f1b('0x31')](function(_0x2f0949){logger[_0x7f1b('0x2d')](_0x7f1b('0x28'),_0x198bbf,_0x2f0949);_0x4e5981(_0x2f0949);});});}function respondWithStatusCode(_0x223d7e,_0x9f20cf){_0x9f20cf=_0x9f20cf||0xcc;return function(_0x455797){if(_0x455797){return _0x223d7e[_0x7f1b('0x32')](_0x9f20cf);}return _0x223d7e['status'](_0x9f20cf)[_0x7f1b('0x33')]();};}function respondWithResult(_0x142ed8,_0x4507ad){_0x4507ad=_0x4507ad||0xc8;return function(_0x92cb6e){if(_0x92cb6e){return _0x142ed8[_0x7f1b('0x34')](_0x4507ad)['json'](_0x92cb6e);}};}function respondWithFilteredResult(_0x36a9dc,_0x1acaf5){return function(_0x4a8aaa){if(_0x4a8aaa){var _0x1e0a39=typeof _0x1acaf5[_0x7f1b('0x35')]===_0x7f1b('0x36')&&typeof _0x1acaf5[_0x7f1b('0x37')]===_0x7f1b('0x36');var _0x28677f=_0x4a8aaa[_0x7f1b('0x38')];var _0x4c8923=_0x1e0a39?0x0:_0x1acaf5[_0x7f1b('0x35')];var _0x522056=_0x1e0a39?_0x4a8aaa[_0x7f1b('0x38')]:_0x1acaf5[_0x7f1b('0x35')]+_0x1acaf5[_0x7f1b('0x37')];var _0x1a335b;if(_0x522056>=_0x28677f){_0x522056=_0x28677f;_0x1a335b=0xc8;}else{_0x1a335b=0xce;}_0x36a9dc[_0x7f1b('0x34')](_0x1a335b);return _0x36a9dc['set'](_0x7f1b('0x39'),_0x4c8923+'-'+_0x522056+'/'+_0x28677f)[_0x7f1b('0x3a')](_0x4a8aaa);}return null;};}function patchUpdates(_0x1f511f){return function(_0x45f37e){try{jsonpatch[_0x7f1b('0x3b')](_0x45f37e,_0x1f511f,!![]);}catch(_0x2b251c){return BPromise[_0x7f1b('0x3c')](_0x2b251c);}return _0x45f37e[_0x7f1b('0x3d')]();};}function saveUpdates(_0x55ea36,_0x2843b3){return function(_0x195eb1){if(_0x195eb1){return _0x195eb1['update'](_0x55ea36)[_0x7f1b('0x3e')](function(_0xf5b5b4){return _0xf5b5b4;});}return null;};}function removeEntity(_0x3839a1,_0x11ebb1){return function(_0x2e4cc5){if(_0x2e4cc5){return _0x2e4cc5[_0x7f1b('0x3f')]()[_0x7f1b('0x3e')](function(){_0x3839a1['status'](0xcc)[_0x7f1b('0x33')]();});}};}function handleEntityNotFound(_0x5647e6,_0x55e87a){return function(_0x10d53e){if(!_0x10d53e){_0x5647e6['sendStatus'](0x194);}return _0x10d53e;};}function handleError(_0x577694,_0x1be0e9){_0x1be0e9=_0x1be0e9||0x1f4;return function(_0x2d1b49){logger[_0x7f1b('0x2d')](_0x2d1b49[_0x7f1b('0x40')]);if(_0x2d1b49['name']){delete _0x2d1b49[_0x7f1b('0x41')];}_0x577694[_0x7f1b('0x34')](_0x1be0e9)[_0x7f1b('0x42')](_0x2d1b49);};}exports[_0x7f1b('0x43')]=function(_0x4f2f57,_0x1b6932){var _0x5bf55d={},_0x17055b={},_0x5215ec={'count':0x0,'rows':[]};var _0x336f07=_[_0x7f1b('0x44')](db[_0x7f1b('0x45')]['rawAttributes'],function(_0x32f740){return{'name':_0x32f740[_0x7f1b('0x46')],'type':_0x32f740[_0x7f1b('0x47')]['key']};});_0x17055b[_0x7f1b('0x48')]=_[_0x7f1b('0x44')](_0x336f07,'name');_0x17055b[_0x7f1b('0x49')]=_['keys'](_0x4f2f57[_0x7f1b('0x49')]);_0x17055b[_0x7f1b('0x4a')]=_[_0x7f1b('0x4b')](_0x17055b[_0x7f1b('0x48')],_0x17055b[_0x7f1b('0x49')]);_0x5bf55d[_0x7f1b('0x4c')]=_[_0x7f1b('0x4b')](_0x17055b[_0x7f1b('0x48')],qs[_0x7f1b('0x4d')](_0x4f2f57[_0x7f1b('0x49')][_0x7f1b('0x4d')]));_0x5bf55d[_0x7f1b('0x4c')]=_0x5bf55d[_0x7f1b('0x4c')][_0x7f1b('0x4e')]?_0x5bf55d[_0x7f1b('0x4c')]:_0x17055b[_0x7f1b('0x48')];if(!_0x4f2f57[_0x7f1b('0x49')][_0x7f1b('0x4f')](_0x7f1b('0x50'))){_0x5bf55d[_0x7f1b('0x37')]=qs['limit'](_0x4f2f57['query'][_0x7f1b('0x37')]);_0x5bf55d[_0x7f1b('0x35')]=qs[_0x7f1b('0x35')](_0x4f2f57['query'][_0x7f1b('0x35')]);}_0x5bf55d[_0x7f1b('0x51')]=qs[_0x7f1b('0x52')](_0x4f2f57[_0x7f1b('0x49')][_0x7f1b('0x52')]);_0x5bf55d[_0x7f1b('0x53')]=qs[_0x7f1b('0x4a')](_[_0x7f1b('0x54')](_0x4f2f57['query'],_0x17055b[_0x7f1b('0x4a')]),_0x336f07);if(_0x4f2f57['query'][_0x7f1b('0x55')]){_0x5bf55d[_0x7f1b('0x53')]=_[_0x7f1b('0x56')](_0x5bf55d[_0x7f1b('0x53')],{'$or':_['map'](_0x336f07,function(_0x14ddb4){if(_0x14ddb4[_0x7f1b('0x47')]!==_0x7f1b('0x57')){var _0x4625e3={};_0x4625e3[_0x14ddb4['name']]={'$like':'%'+_0x4f2f57[_0x7f1b('0x49')][_0x7f1b('0x55')]+'%'};return _0x4625e3;}})});}_0x5bf55d=_['merge']({},_0x5bf55d,_0x4f2f57['options']);var _0x596c9d={'where':_0x5bf55d['where']};return db[_0x7f1b('0x45')][_0x7f1b('0x38')](_0x596c9d)['then'](function(_0x3cf9b3){_0x5215ec['count']=_0x3cf9b3;if(_0x4f2f57[_0x7f1b('0x49')]['includeAll']){_0x5bf55d['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x5bf55d);})['then'](function(_0x38bfd9){_0x5215ec[_0x7f1b('0x58')]=_0x38bfd9;return _0x5215ec;})[_0x7f1b('0x3e')](respondWithFilteredResult(_0x1b6932,_0x5bf55d))[_0x7f1b('0x31')](handleError(_0x1b6932,null));};exports['show']=function(_0x23650d,_0x367103){var _0x5c61b3={'raw':!![],'where':{'id':_0x23650d['params']['id']}},_0x1a5613={};_0x1a5613[_0x7f1b('0x48')]=_[_0x7f1b('0x59')](db[_0x7f1b('0x45')][_0x7f1b('0x5a')]);_0x1a5613[_0x7f1b('0x49')]=_[_0x7f1b('0x59')](_0x23650d[_0x7f1b('0x49')]);_0x1a5613[_0x7f1b('0x4a')]=_[_0x7f1b('0x4b')](_0x1a5613[_0x7f1b('0x48')],_0x1a5613[_0x7f1b('0x49')]);_0x5c61b3[_0x7f1b('0x4c')]=_['intersection'](_0x1a5613[_0x7f1b('0x48')],qs[_0x7f1b('0x4d')](_0x23650d['query'][_0x7f1b('0x4d')]));_0x5c61b3[_0x7f1b('0x4c')]=_0x5c61b3[_0x7f1b('0x4c')]['length']?_0x5c61b3[_0x7f1b('0x4c')]:_0x1a5613[_0x7f1b('0x48')];if(_0x23650d[_0x7f1b('0x49')][_0x7f1b('0x5b')]){_0x5c61b3['include']=[{'all':!![]}];}_0x5c61b3=_[_0x7f1b('0x56')]({},_0x5c61b3,_0x23650d[_0x7f1b('0x5c')]);return db['SmsMessage'][_0x7f1b('0x5d')](_0x5c61b3)[_0x7f1b('0x3e')](handleEntityNotFound(_0x367103,null))[_0x7f1b('0x3e')](respondWithResult(_0x367103,null))['catch'](handleError(_0x367103,null));};exports[_0x7f1b('0x5e')]=function(_0x4bd0a6,_0x3736d3){return db[_0x7f1b('0x45')][_0x7f1b('0x5e')](_0x4bd0a6[_0x7f1b('0x5f')],{})[_0x7f1b('0x3e')](respondWithResult(_0x3736d3,0xc9))['catch'](handleError(_0x3736d3,null));};exports[_0x7f1b('0x60')]=function(_0x650916,_0x529180){if(_0x650916[_0x7f1b('0x5f')]['id']){delete _0x650916[_0x7f1b('0x5f')]['id'];}return db['SmsMessage'][_0x7f1b('0x5d')]({'where':{'id':_0x650916[_0x7f1b('0x61')]['id']}})[_0x7f1b('0x3e')](handleEntityNotFound(_0x529180,null))[_0x7f1b('0x3e')](saveUpdates(_0x650916[_0x7f1b('0x5f')],null))[_0x7f1b('0x3e')](respondWithResult(_0x529180,null))[_0x7f1b('0x31')](handleError(_0x529180,null));};exports[_0x7f1b('0x3f')]=function(_0xbb303d,_0x35d872){return db['SmsMessage'][_0x7f1b('0x5d')]({'where':{'id':_0xbb303d[_0x7f1b('0x61')]['id']}})[_0x7f1b('0x3e')](handleEntityNotFound(_0x35d872,null))['then'](removeEntity(_0x35d872,null))[_0x7f1b('0x31')](handleError(_0x35d872,null));};exports[_0x7f1b('0x62')]=function(_0x3714e4,_0x1a80ab){return db[_0x7f1b('0x45')]['describe']()[_0x7f1b('0x3e')](respondWithResult(_0x1a80ab,null))['catch'](handleError(_0x1a80ab,null));};var interaction_log=require('../../config/logger')(_0x7f1b('0x63'));exports[_0x7f1b('0x64')]=function(_0x28505d,_0x16f91d,_0x398f12){var _0x220431={'agent':{},'channel':_0x7f1b('0x65')};if(_0x28505d['body']['id']){delete _0x28505d[_0x7f1b('0x5f')]['id'];}_0x28505d[_0x7f1b('0x5f')][_0x7f1b('0x66')]=!![];_0x28505d[_0x7f1b('0x5f')]['readAt']=moment()[_0x7f1b('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x28505d[_0x7f1b('0x5f')][_0x7f1b('0x68')]=_0x28505d[_0x7f1b('0x5f')][_0x7f1b('0x68')]||_0x28505d['user']['id'];_0x220431[_0x7f1b('0x69')]['id']=_0x28505d[_0x7f1b('0x5f')]['UserId'];return db[_0x7f1b('0x45')][_0x7f1b('0x5d')]({'where':{'id':_0x28505d[_0x7f1b('0x61')]['id'],'UserId':null}})[_0x7f1b('0x3e')](handleEntityNotFound(_0x16f91d,null))[_0x7f1b('0x3e')](saveUpdates(_0x28505d[_0x7f1b('0x5f')],null))[_0x7f1b('0x3e')](function(_0x39a7e3){if(_0x39a7e3){_0x220431[_0x7f1b('0x2f')]=_0x39a7e3[_0x7f1b('0x6a')]({'plain':!![]});return db[_0x7f1b('0x6b')][_0x7f1b('0x5d')]({'where':{'id':_0x39a7e3['SmsInteractionId']}});}return null;})[_0x7f1b('0x3e')](handleEntityNotFound(_0x16f91d,null))[_0x7f1b('0x3e')](function(_0x22c8b1){if(_0x22c8b1){return _0x22c8b1[_0x7f1b('0x60')]({'UserId':_0x28505d[_0x7f1b('0x5f')][_0x7f1b('0x68')],'read1stAt':_[_0x7f1b('0x6c')](_0x22c8b1[_0x7f1b('0x6d')])?moment()[_0x7f1b('0x67')](_0x7f1b('0x6e')):undefined});}return null;})[_0x7f1b('0x3e')](function(_0x27e4c5){if(_0x27e4c5){_0x220431['interaction']=_0x27e4c5[_0x7f1b('0x6a')]({'plain':!![]});interaction_log[_0x7f1b('0x6f')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x28505d[_0x7f1b('0x70')]['id'],_0x28505d[_0x7f1b('0x70')][_0x7f1b('0x41')],_0x28505d[_0x7f1b('0x70')][_0x7f1b('0x71')],_0x220431[_0x7f1b('0x72')]['id'],_0x28505d[_0x7f1b('0x5f')]?JSON['stringify'](_0x28505d['body']):_0x7f1b('0x73'));return respondWithRpcPromise(_0x7f1b('0x74'),_0x7f1b('0x75'),_0x220431);}return null;})['then'](function(_0x8f809f){var _0x53133e=_0x7f1b('0x76')+_0x8f809f[_0x7f1b('0x2f')][_0x7f1b('0x77')];return db['sequelize'][_0x7f1b('0x49')](_0x53133e,{'type':db[_0x7f1b('0x78')]['QueryTypes'][_0x7f1b('0x79')],'raw':!![]})[_0x7f1b('0x3e')](function(_0x3f0d20){return _0x3f0d20;});})[_0x7f1b('0x3e')](function(_0x3a3a20){if(_0x3a3a20){_0x220431[_0x7f1b('0x2f')][_0x7f1b('0x7a')]=_0x3a3a20[0x0];if(!_0x28505d[_0x7f1b('0x5f')][_0x7f1b('0x68')])return;return db['User']['find']({'where':{'id':_0x28505d[_0x7f1b('0x5f')][_0x7f1b('0x68')],'role':_0x7f1b('0x69')},'attributes':['id','name','fullname',_0x7f1b('0x7b'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4d3675){if(!_0x4d3675)return null;_0x220431[_0x7f1b('0x2f')][_0x7f1b('0x69')]=_0x4d3675;return _0x220431;})[_0x7f1b('0x3e')](function(_0x15d5b2){if(_0x15d5b2){if(_0x28505d['body'][_0x7f1b('0x7c')]){_0x220431[_0x7f1b('0x2f')][_0x7f1b('0x7d')]=util[_0x7f1b('0x67')](_0x7f1b('0x7e'),_0x28505d['user']['name']);_0x220431[_0x7f1b('0x2f')]['channel']=_0x220431['channel'];_0x220431[_0x7f1b('0x2f')][_0x7f1b('0x7f')]=_0x7f1b('0x64');return respondWithRpcPromise(_0x7f1b('0x80'),_0x7f1b('0x80'),{'event':_0x7f1b('0x81'),'message':_0x220431[_0x7f1b('0x2f')]},client9002)['then'](function(){return _0x220431;});}return _0x220431;}return null;})[_0x7f1b('0x3e')](respondWithResult(_0x16f91d,null))['catch'](handleError(_0x16f91d,null));};var interaction_log=require(_0x7f1b('0x18'))(_0x7f1b('0x63'));exports[_0x7f1b('0x3c')]=function(_0x5d33e5,_0x2a7e9c,_0x2c8cef){var _0x4cc48e={'agent':{},'channel':_0x7f1b('0x65')};if(_0x5d33e5[_0x7f1b('0x5f')]['id']){delete _0x5d33e5[_0x7f1b('0x5f')]['id'];}_0x5d33e5[_0x7f1b('0x5f')][_0x7f1b('0x68')]=_0x5d33e5[_0x7f1b('0x5f')][_0x7f1b('0x68')]||_0x5d33e5['user']['id'];_0x4cc48e[_0x7f1b('0x69')]['id']=_0x5d33e5[_0x7f1b('0x5f')][_0x7f1b('0x68')];return db[_0x7f1b('0x45')][_0x7f1b('0x5d')]({'where':{'id':_0x5d33e5[_0x7f1b('0x61')]['id'],'UserId':null}})[_0x7f1b('0x3e')](handleEntityNotFound(_0x2a7e9c,null))['then'](function(_0x52de28){if(_0x52de28){_0x4cc48e['message']=_0x52de28[_0x7f1b('0x6a')]({'plain':!![]});return db[_0x7f1b('0x6b')][_0x7f1b('0x5d')]({'where':{'id':_0x52de28[_0x7f1b('0x82')]}});}return null;})[_0x7f1b('0x3e')](handleEntityNotFound(_0x2a7e9c,null))[_0x7f1b('0x3e')](function(_0x387552){if(_0x387552){_0x4cc48e[_0x7f1b('0x72')]=_0x387552[_0x7f1b('0x6a')]({'plain':!![]});interaction_log[_0x7f1b('0x6f')](_0x7f1b('0x83'),_0x5d33e5['user']['id'],_0x5d33e5[_0x7f1b('0x70')]['name'],_0x5d33e5['user'][_0x7f1b('0x71')],_0x4cc48e[_0x7f1b('0x72')]['id'],_0x5d33e5['body']?JSON[_0x7f1b('0x2c')](_0x5d33e5[_0x7f1b('0x5f')]):'null');return respondWithRpcPromise(_0x7f1b('0x84'),'rejectMessage',_0x4cc48e);}return null;})[_0x7f1b('0x3e')](function(_0x5a9d50){var _0x2610a1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a9d50[_0x7f1b('0x2f')][_0x7f1b('0x77')];return db[_0x7f1b('0x85')][_0x7f1b('0x49')](_0x2610a1,{'type':db[_0x7f1b('0x78')]['QueryTypes']['SELECT'],'raw':!![]})[_0x7f1b('0x3e')](function(_0x207ec3){return _0x207ec3;});})[_0x7f1b('0x3e')](function(_0x15d31d){if(_0x15d31d){_0x4cc48e[_0x7f1b('0x2f')]['contact']=_0x15d31d[0x0];if(!_0x5d33e5[_0x7f1b('0x5f')]['UserId'])return;return db[_0x7f1b('0x86')][_0x7f1b('0x5d')]({'where':{'id':_0x5d33e5['body'][_0x7f1b('0x68')],'role':_0x7f1b('0x69')},'attributes':['id',_0x7f1b('0x41'),'fullname',_0x7f1b('0x7b'),'internal'],'raw':!![]});}return null;})[_0x7f1b('0x3e')](function(_0x59428d){if(!_0x59428d)return null;_0x4cc48e[_0x7f1b('0x2f')][_0x7f1b('0x69')]=_0x59428d;return _0x4cc48e;})[_0x7f1b('0x3e')](function(_0x168406){if(_0x168406){_0x168406[_0x7f1b('0x2f')][_0x7f1b('0x7d')]=util[_0x7f1b('0x67')](_0x7f1b('0x7e'),_0x5d33e5[_0x7f1b('0x70')][_0x7f1b('0x41')]);_0x168406[_0x7f1b('0x2f')][_0x7f1b('0x87')]=_0x4cc48e[_0x7f1b('0x87')];_0x168406[_0x7f1b('0x2f')]['event']=_0x7f1b('0x3c');respondWithRpcPromise(_0x7f1b('0x80'),_0x7f1b('0x80'),{'event':_0x7f1b('0x88'),'message':_0x168406[_0x7f1b('0x2f')]},client9002);return _0x4cc48e;}return null;})['then'](respondWithResult(_0x2a7e9c,null))['catch'](handleError(_0x2a7e9c,null));};exports[_0x7f1b('0x34')]=function(_0x909f9d,_0x48b423,_0x434c15){if(_0x909f9d[_0x7f1b('0x5f')]['id']){delete _0x909f9d[_0x7f1b('0x5f')]['id'];}var _0x510821;return db[_0x7f1b('0x45')][_0x7f1b('0x5d')]({'where':{'id':_0x909f9d[_0x7f1b('0x61')]['id']}})[_0x7f1b('0x3e')](handleEntityNotFound(_0x48b423,null))[_0x7f1b('0x3e')](function(_0x5da5f0){if(_0x5da5f0){_0x510821=_0x5da5f0;return db[_0x7f1b('0x89')]['find']({'where':{'id':_0x5da5f0[_0x7f1b('0x8a')]}});}})[_0x7f1b('0x3e')](handleEntityNotFound(_0x48b423,null))['then'](function(_0x1f356f){if(_0x1f356f){logger[_0x7f1b('0x2a')](_0x7f1b('0x2b'),_0x7f1b('0x34'),_0x7f1b('0x8b'),_0x1f356f['type'],util[_0x7f1b('0x8c')](_0x909f9d[_0x7f1b('0x5f')],{'showHidden':![],'depth':null}));switch(_0x1f356f[_0x7f1b('0x47')]){case _0x7f1b('0x8d'):if(_0x909f9d[_0x7f1b('0x5f')][_0x7f1b('0x8e')]&&_0x909f9d[_0x7f1b('0x5f')][_0x7f1b('0x8e')]===_0x510821[_0x7f1b('0x8f')]){return _0x510821[_0x7f1b('0x60')]({'read':!![]});}else{logger[_0x7f1b('0x2d')](_0x7f1b('0x90'),_0x7f1b('0x34'),_0x7f1b('0x8d'),util[_0x7f1b('0x8c')](_0x909f9d[_0x7f1b('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7f1b('0x91'):if(_0x909f9d[_0x7f1b('0x5f')][_0x7f1b('0x92')]&&_0x909f9d['body'][_0x7f1b('0x92')]===_0x510821[_0x7f1b('0x8f')]&&_['indexOf']([_0x7f1b('0x93'),_0x7f1b('0x94')],_0x909f9d['body'][_0x7f1b('0x95')])>=0x0){return _0x510821[_0x7f1b('0x60')]({'read':!![]});}else{logger['error'](_0x7f1b('0x90'),'status',_0x7f1b('0x96'),util['inspect'](_0x909f9d[_0x7f1b('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7f1b('0x97'):var _0x27bb5a=_0x909f9d[_0x7f1b('0x5f')][_0x7f1b('0x98')][0x0];if(_0x27bb5a[_0x7f1b('0x34')]['groupName']===_0x7f1b('0x99')){return _0x510821[_0x7f1b('0x60')]({'read':!![]});}else{logger[_0x7f1b('0x2d')](_0x7f1b('0x90'),_0x7f1b('0x34'),_0x7f1b('0x97'),util[_0x7f1b('0x8c')](_0x909f9d['body'],{'showHidden':![],'depth':null}));}break;}return _0x510821;}})['then'](respondWithResult(_0x48b423,null))[_0x7f1b('0x31')](handleError(_0x48b423,null));}; \ No newline at end of file +var _0xf5b1=['defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','stack','send','index','map','SmsMessage','rawAttributes','fieldName','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','include','find','create','body','destroy','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','fullname','rejectmessage','SmsAccount','SmsAccountId','debug','inspect','type','twilio','MessageSid','messageId','plivo','MessageUUID','sent','delivered','Status','plivio','infobip','results','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','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'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf5b1,0x7a));var _0x1f5b=function(_0x12c998,_0x1db642){_0x12c998=_0x12c998-0x0;var _0xbc0856=_0xf5b1[_0x12c998];return _0xbc0856;};'use strict';var emlformat=require(_0x1f5b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f5b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f5b('0x2'));var moment=require('moment');var BPromise=require(_0x1f5b('0x3'));var Mustache=require(_0x1f5b('0x4'));var util=require('util');var path=require(_0x1f5b('0x5'));var sox=require('sox');var csv=require(_0x1f5b('0x6'));var ejs=require(_0x1f5b('0x7'));var fs=require('fs');var fs_extra=require(_0x1f5b('0x8'));var _=require(_0x1f5b('0x9'));var squel=require(_0x1f5b('0xa'));var crypto=require('crypto');var jsforce=require(_0x1f5b('0xb'));var deskjs=require(_0x1f5b('0xc'));var toCsv=require(_0x1f5b('0x6'));var querystring=require(_0x1f5b('0xd'));var Papa=require(_0x1f5b('0xe'));var Redis=require(_0x1f5b('0xf'));var authService=require(_0x1f5b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1f5b('0x11'));var hardwareService=require(_0x1f5b('0x12'));var logger=require(_0x1f5b('0x13'))(_0x1f5b('0x14'));var utils=require(_0x1f5b('0x15'));var config=require(_0x1f5b('0x16'));var licenseUtil=require(_0x1f5b('0x17'));var db=require(_0x1f5b('0x18'))['db'];config[_0x1f5b('0x19')]=_[_0x1f5b('0x1a')](config[_0x1f5b('0x19')],{'host':_0x1f5b('0x1b'),'port':0x18eb});var socket=require(_0x1f5b('0x1c'))(new Redis(config[_0x1f5b('0x19')]));require(_0x1f5b('0x1d'))[_0x1f5b('0x1e')](socket);var jayson=require(_0x1f5b('0x1f'));var client=jayson[_0x1f5b('0x20')][_0x1f5b('0x21')]({'port':0x232c});var client9002=jayson[_0x1f5b('0x20')][_0x1f5b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4beda8,_0x207eb5,_0x17e405,_0x4affff){return new BPromise(function(_0x599326,_0x1b9cc8){var _0x595320=_0x4affff||client;return _0x595320[_0x1f5b('0x22')](_0x4beda8,_0x17e405)[_0x1f5b('0x23')](function(_0x1ec899){logger['info'](_0x1f5b('0x24'),_0x207eb5,'request\x20sent');logger['debug'](_0x1f5b('0x25'),_0x207eb5,_0x1f5b('0x26'),JSON[_0x1f5b('0x27')](_0x1ec899));if(_0x1ec899[_0x1f5b('0x28')]){if(_0x1ec899[_0x1f5b('0x28')][_0x1f5b('0x29')]===0x1f4){logger[_0x1f5b('0x28')](_0x1f5b('0x24'),_0x207eb5,_0x1ec899[_0x1f5b('0x28')][_0x1f5b('0x2a')]);return _0x1b9cc8(_0x1ec899[_0x1f5b('0x28')][_0x1f5b('0x2a')]);}logger[_0x1f5b('0x28')]('SmsMessage,\x20%s,\x20%s',_0x207eb5,_0x1ec899[_0x1f5b('0x28')][_0x1f5b('0x2a')]);return _0x599326(_0x1ec899[_0x1f5b('0x28')][_0x1f5b('0x2a')]);}else{logger[_0x1f5b('0x2b')](_0x1f5b('0x24'),_0x207eb5,'request\x20sent');_0x599326(_0x1ec899[_0x1f5b('0x2c')]['message']);}})[_0x1f5b('0x2d')](function(_0x5e3bd2){logger[_0x1f5b('0x28')](_0x1f5b('0x24'),_0x207eb5,_0x5e3bd2);_0x1b9cc8(_0x5e3bd2);});});}function respondWithStatusCode(_0x21db9f,_0x592f02){_0x592f02=_0x592f02||0xcc;return function(_0x50d1fa){if(_0x50d1fa){return _0x21db9f[_0x1f5b('0x2e')](_0x592f02);}return _0x21db9f[_0x1f5b('0x2f')](_0x592f02)[_0x1f5b('0x30')]();};}function respondWithResult(_0x2c9766,_0x17c2ce){_0x17c2ce=_0x17c2ce||0xc8;return function(_0x319246){if(_0x319246){return _0x2c9766[_0x1f5b('0x2f')](_0x17c2ce)[_0x1f5b('0x31')](_0x319246);}};}function respondWithFilteredResult(_0xaa83e9,_0x4e23f0){return function(_0x5f50f1){if(_0x5f50f1){var _0x5bfea0=typeof _0x4e23f0[_0x1f5b('0x32')]==='undefined'&&typeof _0x4e23f0[_0x1f5b('0x33')]==='undefined';var _0x20bd2b=_0x5f50f1[_0x1f5b('0x34')];var _0x26a9a6=_0x5bfea0?0x0:_0x4e23f0[_0x1f5b('0x32')];var _0x591ff2=_0x5bfea0?_0x5f50f1['count']:_0x4e23f0['offset']+_0x4e23f0['limit'];var _0xd53c69;if(_0x591ff2>=_0x20bd2b){_0x591ff2=_0x20bd2b;_0xd53c69=0xc8;}else{_0xd53c69=0xce;}_0xaa83e9['status'](_0xd53c69);return _0xaa83e9[_0x1f5b('0x35')]('Content-Range',_0x26a9a6+'-'+_0x591ff2+'/'+_0x20bd2b)['json'](_0x5f50f1);}return null;};}function patchUpdates(_0xfd50ca){return function(_0x23f226){try{jsonpatch[_0x1f5b('0x36')](_0x23f226,_0xfd50ca,!![]);}catch(_0x2f51e9){return BPromise[_0x1f5b('0x37')](_0x2f51e9);}return _0x23f226[_0x1f5b('0x38')]();};}function saveUpdates(_0x59de79,_0x231408){return function(_0x4f0833){if(_0x4f0833){return _0x4f0833[_0x1f5b('0x39')](_0x59de79)[_0x1f5b('0x23')](function(_0x134962){return _0x134962;});}return null;};}function removeEntity(_0x212bb0,_0x1aeaed){return function(_0x5e06e6){if(_0x5e06e6){return _0x5e06e6['destroy']()['then'](function(){_0x212bb0['status'](0xcc)[_0x1f5b('0x30')]();});}};}function handleEntityNotFound(_0x5770ba,_0x4fe245){return function(_0x19b549){if(!_0x19b549){_0x5770ba[_0x1f5b('0x2e')](0x194);}return _0x19b549;};}function handleError(_0x225a0c,_0x53c83c){_0x53c83c=_0x53c83c||0x1f4;return function(_0x4953e2){logger[_0x1f5b('0x28')](_0x4953e2[_0x1f5b('0x3a')]);if(_0x4953e2['name']){delete _0x4953e2['name'];}_0x225a0c[_0x1f5b('0x2f')](_0x53c83c)[_0x1f5b('0x3b')](_0x4953e2);};}exports[_0x1f5b('0x3c')]=function(_0x31f9d3,_0xbbe617){var _0x4270d5={},_0x398094={},_0x4b8f41={'count':0x0,'rows':[]};var _0x5381c5=_[_0x1f5b('0x3d')](db[_0x1f5b('0x3e')][_0x1f5b('0x3f')],function(_0xa5233e){return{'name':_0xa5233e[_0x1f5b('0x40')],'type':_0xa5233e['type']['key']};});_0x398094['model']=_[_0x1f5b('0x3d')](_0x5381c5,_0x1f5b('0x41'));_0x398094[_0x1f5b('0x42')]=_[_0x1f5b('0x43')](_0x31f9d3[_0x1f5b('0x42')]);_0x398094[_0x1f5b('0x44')]=_[_0x1f5b('0x45')](_0x398094[_0x1f5b('0x46')],_0x398094[_0x1f5b('0x42')]);_0x4270d5['attributes']=_[_0x1f5b('0x45')](_0x398094[_0x1f5b('0x46')],qs['fields'](_0x31f9d3[_0x1f5b('0x42')][_0x1f5b('0x47')]));_0x4270d5['attributes']=_0x4270d5[_0x1f5b('0x48')][_0x1f5b('0x49')]?_0x4270d5['attributes']:_0x398094[_0x1f5b('0x46')];if(!_0x31f9d3['query']['hasOwnProperty'](_0x1f5b('0x4a'))){_0x4270d5[_0x1f5b('0x33')]=qs[_0x1f5b('0x33')](_0x31f9d3[_0x1f5b('0x42')][_0x1f5b('0x33')]);_0x4270d5[_0x1f5b('0x32')]=qs[_0x1f5b('0x32')](_0x31f9d3[_0x1f5b('0x42')]['offset']);}_0x4270d5['order']=qs['sort'](_0x31f9d3['query'][_0x1f5b('0x4b')]);_0x4270d5[_0x1f5b('0x4c')]=qs[_0x1f5b('0x44')](_[_0x1f5b('0x4d')](_0x31f9d3[_0x1f5b('0x42')],_0x398094[_0x1f5b('0x44')]),_0x5381c5);if(_0x31f9d3[_0x1f5b('0x42')][_0x1f5b('0x4e')]){_0x4270d5[_0x1f5b('0x4c')]=_[_0x1f5b('0x4f')](_0x4270d5[_0x1f5b('0x4c')],{'$or':_[_0x1f5b('0x3d')](_0x5381c5,function(_0x5f3f6d){if(_0x5f3f6d['type']!==_0x1f5b('0x50')){var _0x4423d4={};_0x4423d4[_0x5f3f6d[_0x1f5b('0x41')]]={'$like':'%'+_0x31f9d3[_0x1f5b('0x42')][_0x1f5b('0x4e')]+'%'};return _0x4423d4;}})});}_0x4270d5=_[_0x1f5b('0x4f')]({},_0x4270d5,_0x31f9d3[_0x1f5b('0x51')]);var _0x50c060={'where':_0x4270d5[_0x1f5b('0x4c')]};return db[_0x1f5b('0x3e')][_0x1f5b('0x34')](_0x50c060)[_0x1f5b('0x23')](function(_0xdd2ca9){_0x4b8f41[_0x1f5b('0x34')]=_0xdd2ca9;if(_0x31f9d3[_0x1f5b('0x42')][_0x1f5b('0x52')]){_0x4270d5['include']=[{'all':!![]}];}return db[_0x1f5b('0x3e')][_0x1f5b('0x53')](_0x4270d5);})[_0x1f5b('0x23')](function(_0x2e2ca3){_0x4b8f41['rows']=_0x2e2ca3;return _0x4b8f41;})['then'](respondWithFilteredResult(_0xbbe617,_0x4270d5))[_0x1f5b('0x2d')](handleError(_0xbbe617,null));};exports['show']=function(_0x307de6,_0x43ecba){var _0x8fd5b1={'raw':!![],'where':{'id':_0x307de6[_0x1f5b('0x54')]['id']}},_0x2644b1={};_0x2644b1[_0x1f5b('0x46')]=_[_0x1f5b('0x43')](db[_0x1f5b('0x3e')]['rawAttributes']);_0x2644b1['query']=_[_0x1f5b('0x43')](_0x307de6[_0x1f5b('0x42')]);_0x2644b1[_0x1f5b('0x44')]=_[_0x1f5b('0x45')](_0x2644b1['model'],_0x2644b1['query']);_0x8fd5b1[_0x1f5b('0x48')]=_[_0x1f5b('0x45')](_0x2644b1['model'],qs[_0x1f5b('0x47')](_0x307de6[_0x1f5b('0x42')][_0x1f5b('0x47')]));_0x8fd5b1[_0x1f5b('0x48')]=_0x8fd5b1['attributes']['length']?_0x8fd5b1[_0x1f5b('0x48')]:_0x2644b1[_0x1f5b('0x46')];if(_0x307de6['query'][_0x1f5b('0x52')]){_0x8fd5b1[_0x1f5b('0x55')]=[{'all':!![]}];}_0x8fd5b1=_[_0x1f5b('0x4f')]({},_0x8fd5b1,_0x307de6[_0x1f5b('0x51')]);return db[_0x1f5b('0x3e')][_0x1f5b('0x56')](_0x8fd5b1)[_0x1f5b('0x23')](handleEntityNotFound(_0x43ecba,null))['then'](respondWithResult(_0x43ecba,null))[_0x1f5b('0x2d')](handleError(_0x43ecba,null));};exports[_0x1f5b('0x57')]=function(_0x55ec8f,_0x4b58e4){return db['SmsMessage'][_0x1f5b('0x57')](_0x55ec8f['body'],{})[_0x1f5b('0x23')](respondWithResult(_0x4b58e4,0xc9))[_0x1f5b('0x2d')](handleError(_0x4b58e4,null));};exports[_0x1f5b('0x39')]=function(_0x3ede13,_0xbe80c2){if(_0x3ede13[_0x1f5b('0x58')]['id']){delete _0x3ede13[_0x1f5b('0x58')]['id'];}return db[_0x1f5b('0x3e')][_0x1f5b('0x56')]({'where':{'id':_0x3ede13[_0x1f5b('0x54')]['id']}})[_0x1f5b('0x23')](handleEntityNotFound(_0xbe80c2,null))[_0x1f5b('0x23')](saveUpdates(_0x3ede13[_0x1f5b('0x58')],null))[_0x1f5b('0x23')](respondWithResult(_0xbe80c2,null))[_0x1f5b('0x2d')](handleError(_0xbe80c2,null));};exports[_0x1f5b('0x59')]=function(_0x160466,_0x51eb25){return db[_0x1f5b('0x3e')]['find']({'where':{'id':_0x160466[_0x1f5b('0x54')]['id']}})['then'](handleEntityNotFound(_0x51eb25,null))['then'](removeEntity(_0x51eb25,null))['catch'](handleError(_0x51eb25,null));};exports[_0x1f5b('0x5a')]=function(_0x1dc73c,_0x266b79){return db[_0x1f5b('0x3e')][_0x1f5b('0x5a')]()['then'](respondWithResult(_0x266b79,null))['catch'](handleError(_0x266b79,null));};var interaction_log=require(_0x1f5b('0x13'))('sms-interactions');exports[_0x1f5b('0x5b')]=function(_0x176832,_0x174a9e,_0x2dc66d){var _0x56de91={'agent':{},'channel':_0x1f5b('0x5c')};if(_0x176832['body']['id']){delete _0x176832['body']['id'];}_0x176832[_0x1f5b('0x58')][_0x1f5b('0x5d')]=!![];_0x176832[_0x1f5b('0x58')][_0x1f5b('0x5e')]=moment()[_0x1f5b('0x5f')](_0x1f5b('0x60'));_0x176832[_0x1f5b('0x58')]['UserId']=_0x176832[_0x1f5b('0x58')][_0x1f5b('0x61')]||_0x176832[_0x1f5b('0x62')]['id'];_0x56de91[_0x1f5b('0x63')]['id']=_0x176832['body'][_0x1f5b('0x61')];return db[_0x1f5b('0x3e')]['find']({'where':{'id':_0x176832[_0x1f5b('0x54')]['id'],'UserId':null}})[_0x1f5b('0x23')](handleEntityNotFound(_0x174a9e,null))[_0x1f5b('0x23')](saveUpdates(_0x176832['body'],null))[_0x1f5b('0x23')](function(_0x5d77b3){if(_0x5d77b3){_0x56de91[_0x1f5b('0x2a')]=_0x5d77b3[_0x1f5b('0x64')]({'plain':!![]});return db[_0x1f5b('0x65')][_0x1f5b('0x56')]({'where':{'id':_0x5d77b3[_0x1f5b('0x66')]}});}return null;})[_0x1f5b('0x23')](handleEntityNotFound(_0x174a9e,null))['then'](function(_0x42d725){if(_0x42d725){return _0x42d725[_0x1f5b('0x39')]({'UserId':_0x176832['body']['UserId'],'read1stAt':_[_0x1f5b('0x67')](_0x42d725['read1stAt'])?moment()[_0x1f5b('0x5f')](_0x1f5b('0x60')):undefined});}return null;})['then'](function(_0x5e3251){if(_0x5e3251){_0x56de91[_0x1f5b('0x68')]=_0x5e3251['get']({'plain':!![]});interaction_log[_0x1f5b('0x2b')](_0x1f5b('0x69'),_0x176832[_0x1f5b('0x62')]['id'],_0x176832[_0x1f5b('0x62')]['name'],_0x176832[_0x1f5b('0x62')]['role'],_0x56de91[_0x1f5b('0x68')]['id'],_0x176832['body']?JSON[_0x1f5b('0x27')](_0x176832[_0x1f5b('0x58')]):'null');return respondWithRpcPromise(_0x1f5b('0x6a'),_0x1f5b('0x6b'),_0x56de91);}return null;})[_0x1f5b('0x23')](function(_0x2dc844){var _0x3c473d=_0x1f5b('0x6c')+_0x2dc844['message'][_0x1f5b('0x6d')];return db[_0x1f5b('0x6e')][_0x1f5b('0x42')](_0x3c473d,{'type':db['Sequelize'][_0x1f5b('0x6f')][_0x1f5b('0x70')],'raw':!![]})['then'](function(_0x2c393d){return _0x2c393d;});})['then'](function(_0x1a7f6c){if(_0x1a7f6c){_0x56de91[_0x1f5b('0x2a')][_0x1f5b('0x71')]=_0x1a7f6c[0x0];if(!_0x176832['body'][_0x1f5b('0x61')])return;return db[_0x1f5b('0x72')][_0x1f5b('0x56')]({'where':{'id':_0x176832['body'][_0x1f5b('0x61')],'role':_0x1f5b('0x63')},'attributes':['id',_0x1f5b('0x41'),'fullname',_0x1f5b('0x73'),_0x1f5b('0x74')],'raw':!![]});}return null;})[_0x1f5b('0x23')](function(_0x300cb7){if(!_0x300cb7)return null;_0x56de91[_0x1f5b('0x2a')]['agent']=_0x300cb7;return _0x56de91;})[_0x1f5b('0x23')](function(_0x230a8e){if(_0x230a8e){if(_0x176832['body'][_0x1f5b('0x75')]){_0x56de91[_0x1f5b('0x2a')][_0x1f5b('0x76')]=util[_0x1f5b('0x5f')](_0x1f5b('0x77'),_0x176832[_0x1f5b('0x62')][_0x1f5b('0x41')]);_0x56de91['message'][_0x1f5b('0x78')]=_0x56de91[_0x1f5b('0x78')];_0x56de91['message'][_0x1f5b('0x79')]=_0x1f5b('0x5b');return respondWithRpcPromise('EventManager',_0x1f5b('0x7a'),{'event':_0x1f5b('0x7b'),'message':_0x56de91['message']},client9002)[_0x1f5b('0x23')](function(){return _0x56de91;});}return _0x56de91;}return null;})[_0x1f5b('0x23')](respondWithResult(_0x174a9e,null))[_0x1f5b('0x2d')](handleError(_0x174a9e,null));};var interaction_log=require(_0x1f5b('0x13'))('sms-interactions');exports['reject']=function(_0x4aac07,_0x823443,_0x5b5e93){var _0x5addcc={'agent':{},'channel':_0x1f5b('0x5c')};if(_0x4aac07[_0x1f5b('0x58')]['id']){delete _0x4aac07[_0x1f5b('0x58')]['id'];}_0x4aac07[_0x1f5b('0x58')][_0x1f5b('0x61')]=_0x4aac07[_0x1f5b('0x58')]['UserId']||_0x4aac07[_0x1f5b('0x62')]['id'];_0x5addcc[_0x1f5b('0x63')]['id']=_0x4aac07[_0x1f5b('0x58')][_0x1f5b('0x61')];return db[_0x1f5b('0x3e')]['find']({'where':{'id':_0x4aac07[_0x1f5b('0x54')]['id'],'UserId':null}})[_0x1f5b('0x23')](handleEntityNotFound(_0x823443,null))['then'](function(_0x3269db){if(_0x3269db){_0x5addcc['message']=_0x3269db[_0x1f5b('0x64')]({'plain':!![]});return db['SmsInteraction'][_0x1f5b('0x56')]({'where':{'id':_0x3269db['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x823443,null))[_0x1f5b('0x23')](function(_0x1fbb77){if(_0x1fbb77){_0x5addcc[_0x1f5b('0x68')]=_0x1fbb77[_0x1f5b('0x64')]({'plain':!![]});interaction_log[_0x1f5b('0x2b')](_0x1f5b('0x7c'),_0x4aac07[_0x1f5b('0x62')]['id'],_0x4aac07[_0x1f5b('0x62')][_0x1f5b('0x41')],_0x4aac07[_0x1f5b('0x62')]['role'],_0x5addcc[_0x1f5b('0x68')]['id'],_0x4aac07[_0x1f5b('0x58')]?JSON[_0x1f5b('0x27')](_0x4aac07[_0x1f5b('0x58')]):'null');return respondWithRpcPromise(_0x1f5b('0x7d'),_0x1f5b('0x7e'),_0x5addcc);}return null;})[_0x1f5b('0x23')](function(_0x380f01){var _0x3c2b7a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x380f01[_0x1f5b('0x2a')][_0x1f5b('0x6d')];return db[_0x1f5b('0x6e')][_0x1f5b('0x42')](_0x3c2b7a,{'type':db[_0x1f5b('0x7f')][_0x1f5b('0x6f')][_0x1f5b('0x70')],'raw':!![]})['then'](function(_0x3a04c2){return _0x3a04c2;});})[_0x1f5b('0x23')](function(_0xede869){if(_0xede869){_0x5addcc[_0x1f5b('0x2a')][_0x1f5b('0x71')]=_0xede869[0x0];if(!_0x4aac07['body']['UserId'])return;return db['User'][_0x1f5b('0x56')]({'where':{'id':_0x4aac07[_0x1f5b('0x58')][_0x1f5b('0x61')],'role':_0x1f5b('0x63')},'attributes':['id',_0x1f5b('0x41'),_0x1f5b('0x80'),_0x1f5b('0x73'),_0x1f5b('0x74')],'raw':!![]});}return null;})[_0x1f5b('0x23')](function(_0x12043c){if(!_0x12043c)return null;_0x5addcc[_0x1f5b('0x2a')][_0x1f5b('0x63')]=_0x12043c;return _0x5addcc;})[_0x1f5b('0x23')](function(_0x857a9d){if(_0x857a9d){_0x857a9d['message'][_0x1f5b('0x76')]=util[_0x1f5b('0x5f')](_0x1f5b('0x77'),_0x4aac07[_0x1f5b('0x62')][_0x1f5b('0x41')]);_0x857a9d[_0x1f5b('0x2a')][_0x1f5b('0x78')]=_0x5addcc[_0x1f5b('0x78')];_0x857a9d[_0x1f5b('0x2a')][_0x1f5b('0x79')]=_0x1f5b('0x37');respondWithRpcPromise(_0x1f5b('0x7a'),_0x1f5b('0x7a'),{'event':_0x1f5b('0x81'),'message':_0x857a9d['message']},client9002);return _0x5addcc;}return null;})[_0x1f5b('0x23')](respondWithResult(_0x823443,null))['catch'](handleError(_0x823443,null));};exports['status']=function(_0x3b43a3,_0x293db6,_0x32da0d){if(_0x3b43a3[_0x1f5b('0x58')]['id']){delete _0x3b43a3['body']['id'];}var _0x3e7398;return db[_0x1f5b('0x3e')]['find']({'where':{'id':_0x3b43a3[_0x1f5b('0x54')]['id']}})[_0x1f5b('0x23')](handleEntityNotFound(_0x293db6,null))[_0x1f5b('0x23')](function(_0x27107b){if(_0x27107b){_0x3e7398=_0x27107b;return db[_0x1f5b('0x82')][_0x1f5b('0x56')]({'where':{'id':_0x27107b[_0x1f5b('0x83')]}});}})[_0x1f5b('0x23')](handleEntityNotFound(_0x293db6,null))[_0x1f5b('0x23')](function(_0x5b1faa){if(_0x5b1faa){logger[_0x1f5b('0x84')](_0x1f5b('0x25'),_0x1f5b('0x2f'),'received\x20delivery\x20report\x20from',_0x5b1faa['type'],util[_0x1f5b('0x85')](_0x3b43a3['body'],{'showHidden':![],'depth':null}));switch(_0x5b1faa[_0x1f5b('0x86')]){case _0x1f5b('0x87'):if(_0x3b43a3['body'][_0x1f5b('0x88')]&&_0x3b43a3[_0x1f5b('0x58')]['MessageSid']===_0x3e7398[_0x1f5b('0x89')]){return _0x3e7398[_0x1f5b('0x39')]({'read':!![]});}else{logger[_0x1f5b('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1f5b('0x2f'),_0x1f5b('0x87'),util[_0x1f5b('0x85')](_0x3b43a3[_0x1f5b('0x58')],{'showHidden':![],'depth':null}));}break;case _0x1f5b('0x8a'):if(_0x3b43a3[_0x1f5b('0x58')][_0x1f5b('0x8b')]&&_0x3b43a3[_0x1f5b('0x58')]['MessageUUID']===_0x3e7398[_0x1f5b('0x89')]&&_['indexOf']([_0x1f5b('0x8c'),_0x1f5b('0x8d')],_0x3b43a3['body'][_0x1f5b('0x8e')])>=0x0){return _0x3e7398['update']({'read':!![]});}else{logger[_0x1f5b('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1f5b('0x8f'),util['inspect'](_0x3b43a3['body'],{'showHidden':![],'depth':null}));}break;case _0x1f5b('0x90'):var _0x1b3f7d=_0x3b43a3[_0x1f5b('0x58')][_0x1f5b('0x91')][0x0];if(_0x1b3f7d['status']['groupName']===_0x1f5b('0x92')){return _0x3e7398['update']({'read':!![]});}else{logger['error'](_0x1f5b('0x93'),_0x1f5b('0x2f'),'infobip',util[_0x1f5b('0x85')](_0x3b43a3[_0x1f5b('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3e7398;}})[_0x1f5b('0x23')](respondWithResult(_0x293db6,null))[_0x1f5b('0x2d')](handleError(_0x293db6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index baa6fcd..f2c2a34 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 _0x183c=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x201bb5,_0x4a87ea){var _0x282c30=function(_0x27da4d){while(--_0x27da4d){_0x201bb5['push'](_0x201bb5['shift']());}};_0x282c30(++_0x4a87ea);}(_0x183c,0x11c));var _0xc183=function(_0x11d167,_0x5df049){_0x11d167=_0x11d167-0x0;var _0x4bea20=_0x183c[_0x11d167];return _0x4bea20;};'use strict';var EventEmitter=require(_0xc183('0x0'));var SmsMessage=require(_0xc183('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc183('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc183('0x3'),'afterDestroy':_0xc183('0x4')};function emitEvent(_0x266036){return function(_0x4fd03c,_0x1f30d8,_0x5a2a6a){SmsMessageEvents['emit'](_0x266036+':'+_0x4fd03c['id'],_0x4fd03c);SmsMessageEvents['emit'](_0x266036,_0x4fd03c);_0x5a2a6a(null);};}for(var e in events){if(events[_0xc183('0x5')](e)){var event=events[e];SmsMessage[_0xc183('0x6')](e,emitEvent(event));}}module[_0xc183('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x403b=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save','update','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x403b,0xdf));var _0xb403=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x403b[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xb403('0x0'));var SmsMessage=require(_0xb403('0x1'))['db'][_0xb403('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb403('0x3'),'afterUpdate':_0xb403('0x4'),'afterDestroy':_0xb403('0x5')};function emitEvent(_0x1baaa1){return function(_0x5d0069,_0x5ae80d,_0x511470){SmsMessageEvents[_0xb403('0x6')](_0x1baaa1+':'+_0x5d0069['id'],_0x5d0069);SmsMessageEvents['emit'](_0x1baaa1,_0x5d0069);_0x511470(null);};}for(var e in events){if(events[_0xb403('0x7')](e)){var event=events[e];SmsMessage[_0xb403('0x8')](e,emitEvent(event));}}module[_0xb403('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a20d5ed..c2211a9 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 _0xf4eb=['UTF-8','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','Basic\x20%s','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','fti_sms_messages','body','FULLTEXT','get','toLowerCase','direction','out','UserId','SmsInteraction','findOne','SmsInteractionId','then','catch','error','secret','SmsAccount','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','sms','user_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','inspect','Missing\x20parameters:\x20username,\x20password','connectel','POST','requestid','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','http_code','data','head','clickSend','plivo','senderString','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','token','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','keys','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','uuid'];(function(_0x480b14,_0x397259){var _0x271f62=function(_0x3a47a1){while(--_0x3a47a1){_0x480b14['push'](_0x480b14['shift']());}};_0x271f62(++_0x397259);}(_0xf4eb,0xec));var _0xbf4e=function(_0x113cb0,_0x1e4879){_0x113cb0=_0x113cb0-0x0;var _0x7b6499=_0xf4eb[_0x113cb0];return _0x7b6499;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('SmsMessage',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xbf4e('0x8'),'fields':[_0xbf4e('0x9')],'type':_0xbf4e('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc86f04,_0x5da823,_0x22668b){var _0x177342=_0xa4dcf5['models'];var _0x4d9a07=_0xc86f04[_0xbf4e('0xb')]({'plain':!![]});if(_0x4d9a07['direction'][_0xbf4e('0xc')]()==='in'||_0x4d9a07[_0xbf4e('0xd')]['toLowerCase']()===_0xbf4e('0xe')&&!_0x4d9a07['secret']&&!_['isNil'](_0x4d9a07[_0xbf4e('0xf')])){_0x177342[_0xbf4e('0x10')][_0xbf4e('0x11')]({'where':{'id':_0x4d9a07[_0xbf4e('0x12')]}})[_0xbf4e('0x13')](function(_0x61bd54){if(_0x61bd54){_0x61bd54['update']({'lastMsgAt':_0x4d9a07['createdAt'],'lastMsgDirection':_0x4d9a07[_0xbf4e('0xd')][_0xbf4e('0xc')]()});}})[_0xbf4e('0x14')](function(_0x542909){console[_0xbf4e('0x15')](_0x542909);});}if(_0x4d9a07[_0xbf4e('0xd')]===_0xbf4e('0xe')&&!_0x4d9a07[_0xbf4e('0x16')]){var _0x5a631e;_0x177342[_0xbf4e('0x17')]['find']({'where':{'id':_0x4d9a07['SmsAccountId']},'raw':!![]})['then'](function(_0x4f8762){_0x5a631e=_0x4f8762;if(_0x5a631e&&_0x5a631e[_0xbf4e('0x18')]){switch(_0x5a631e[_0xbf4e('0x18')]){case _0xbf4e('0x19'):var _0x4d9c2a=require('twilio');if(_0x5a631e[_0xbf4e('0x1a')]&&_0x5a631e[_0xbf4e('0x1b')]&&_0x5a631e[_0xbf4e('0x1c')]){var _0x3a875b=new _0x4d9c2a(_0x5a631e[_0xbf4e('0x1a')],_0x5a631e[_0xbf4e('0x1b')]);_0x3a875b[_0xbf4e('0x1d')][_0xbf4e('0x1e')]({'body':_0x4d9a07[_0xbf4e('0x9')],'to':_0x4d9a07[_0xbf4e('0x1c')],'from':_0x5a631e[_0xbf4e('0x1c')],'statusCallback':_0x5a631e['remote']+_0xbf4e('0x1f')+_0x4d9a07['id']+_0xbf4e('0x20')+_0x5a631e['token']})[_0xbf4e('0x13')](function(_0x30994d){if(_0x30994d[_0xbf4e('0x21')]){return _0xc86f04[_0xbf4e('0x22')]({'messageId':_0x30994d[_0xbf4e('0x21')]});}})['catch'](function(_0x90635e){logger[_0xbf4e('0x15')](_0xbf4e('0x23'),'afterCreate',_0xbf4e('0x19'),util['inspect'](_0x90635e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbf4e('0x23'),'afterCreate',_0xbf4e('0x19'),_0xbf4e('0x24'));}break;case _0xbf4e('0x25'):var _0x41f918='https://api.skebby.it/API/v1.0/REST/';if(_0x5a631e[_0xbf4e('0x26')]&&_0x5a631e[_0xbf4e('0x27')]){var _0x43879d={'recipient':[_0x4d9a07['phone']],'message':_0x4d9a07[_0xbf4e('0x9')],'message_type':_0x5a631e['smsMethod']};if(_0x5a631e[_0xbf4e('0x28')]&&_0x5a631e[_0xbf4e('0x28')]!=='SI'){_0x43879d[_0xbf4e('0x29')]=_0x5a631e['phone'];}var _0x34b766={'url':_0x41f918+_0xbf4e('0x2a')+_0x5a631e[_0xbf4e('0x26')]+_0xbf4e('0x2b')+_0x5a631e[_0xbf4e('0x27')],'method':_0xbf4e('0x2c')};rp(_0x34b766)['then'](function(_0x35c82d){var _0x154576=_0x35c82d['split'](';');var _0x3d8959={'user_key':_0x154576[0x0],'session_key':_0x154576[0x1]};_0x34b766={'url':_0x41f918+_0xbf4e('0x2d'),'method':'POST','headers':{'user_key':_0x3d8959[_0xbf4e('0x2e')],'Session_key':_0x3d8959['session_key']},'json':!![],'body':_0x43879d};return rp(_0x34b766);})[_0xbf4e('0x13')](function(_0x59b161){if(_0x59b161[_0xbf4e('0x2f')]>=0x1){var _0x2f5a2b={'messageId':_0x59b161[_0xbf4e('0x30')]};if(_0x5a631e['smsMethod']!=='GP'||!_0x5a631e[_0xbf4e('0x31')]){_0x2f5a2b[_0xbf4e('0x32')]=!![];}return _0xc86f04[_0xbf4e('0x22')](_0x2f5a2b);}else{return logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),'skebby',util[_0xbf4e('0x34')](_0x59b161,{'showHidden':![],'depth':null}));}})[_0xbf4e('0x14')](function(_0x25b837){return logger[_0xbf4e('0x15')](_0xbf4e('0x23'),'afterCreate','skebby',util['inspect'](_0x25b837,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x25'),_0xbf4e('0x35'));}break;case _0xbf4e('0x36'):if(_0x5a631e[_0xbf4e('0x1b')]){var _0x17a7be={'recipient':_0x4d9a07[_0xbf4e('0x1c')],'message':_0x4d9a07[_0xbf4e('0x9')],'sender':_0x5a631e['senderString']||_0x5a631e['phone'],'authorization':_0x5a631e[_0xbf4e('0x1b')]};var _0x5da823={'method':_0xbf4e('0x37'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x17a7be,'json':!![]};rp(_0x5da823)[_0xbf4e('0x13')](function(_0x4e72a2){var _0x370d90={'messageId':_0x4e72a2[_0xbf4e('0x38')]};if(!_0x5a631e[_0xbf4e('0x31')]){_0x370d90[_0xbf4e('0x32')]=!![];}return _0xc86f04['update'](_0x370d90);})[_0xbf4e('0x14')](function(_0x78ab2d){logger[_0xbf4e('0x15')](_0xbf4e('0x23'),'afterCreate',_0xbf4e('0x36'),util[_0xbf4e('0x34')](_0x78ab2d,{'showHidden':![],'depth':null}));});}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x36'),_0xbf4e('0x39'));}break;case'clicksend':if(_0x5a631e[_0xbf4e('0x26')]&&_0x5a631e[_0xbf4e('0x27')]){var _0x17a7be={'messages':[{'source':'xCALLY\x20Motion','to':_0x4d9a07[_0xbf4e('0x1c')],'body':_0x4d9a07[_0xbf4e('0x9')],'from':_0x5a631e['senderString']||_0x5a631e['phone']}]};var _0x2e72cb=util[_0xbf4e('0x3a')](_0xbf4e('0x3b'),_0x5a631e[_0xbf4e('0x26')],_0x5a631e[_0xbf4e('0x27')]);var _0x5da823={'method':'POST','uri':_0xbf4e('0x3c'),'body':_0x17a7be,'headers':{'Authorization':util[_0xbf4e('0x3a')]('Basic\x20%s',new Buffer(_0x2e72cb)['toString']('base64'))},'json':!![]};rp(_0x5da823)['then'](function(_0x399cb9){if(_0x399cb9['http_code']>=0xc8&&_0x399cb9[_0xbf4e('0x3d')]<=0xce){if(_0x399cb9[_0xbf4e('0x3e')]&&_0x399cb9['data']['queued_count']>0x0){var _0x30dde9=_[_0xbf4e('0x3f')](_0x399cb9[_0xbf4e('0x3e')][_0xbf4e('0x1d')]);var _0x8ab634={'messageId':_0x30dde9['message_id']};if(!_0x5a631e[_0xbf4e('0x31')]){_0x8ab634[_0xbf4e('0x32')]=!![];}return _0xc86f04[_0xbf4e('0x22')](_0x8ab634);}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x40'),util[_0xbf4e('0x34')](_0x399cb9,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x40'),util[_0xbf4e('0x34')](_0x399cb9,{'showHidden':![],'depth':null}));}})[_0xbf4e('0x14')](function(_0x1198e8){logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x40'),util[_0xbf4e('0x34')](_0x1198e8,{'showHidden':![],'depth':null}));});}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x40'),_0xbf4e('0x35'));}break;case _0xbf4e('0x41'):if(_0x5a631e['authId']&&_0x5a631e[_0xbf4e('0x1b')]){var _0x17a7be={'dst':_0x4d9a07[_0xbf4e('0x1c')],'text':_0x4d9a07['body'],'src':_0x5a631e[_0xbf4e('0x42')]||_0x5a631e['phone'],'url':_0x5a631e['remote']+_0xbf4e('0x1f')+_0x4d9a07['id']+_0xbf4e('0x20')+_0x5a631e['token']};var _0x2e72cb=util[_0xbf4e('0x3a')](_0xbf4e('0x3b'),_0x5a631e[_0xbf4e('0x43')],_0x5a631e[_0xbf4e('0x1b')]);var _0x5da823={'method':_0xbf4e('0x37'),'uri':util[_0xbf4e('0x3a')](_0xbf4e('0x44'),_0x5a631e[_0xbf4e('0x43')]),'body':_0x17a7be,'headers':{'Authorization':util[_0xbf4e('0x3a')]('Basic\x20%s',new Buffer(_0x2e72cb)['toString'](_0xbf4e('0x45')))},'json':!![]};rp(_0x5da823)[_0xbf4e('0x13')](function(_0x3d0b4a){var _0x586f5d={'messageId':_0x3d0b4a[_0xbf4e('0x46')][0x0]};return _0xc86f04[_0xbf4e('0x22')](_0x586f5d);})['catch'](function(_0x545db7){logger[_0xbf4e('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbf4e('0x41'),util[_0xbf4e('0x34')](_0x545db7,{'showHidden':![],'depth':null}));});}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),'plivo',_0xbf4e('0x47'));}break;case'infobip':if(_0x5a631e[_0xbf4e('0x26')]&&_0x5a631e['password']){if(_0x5a631e[_0xbf4e('0x48')]){var _0x57a247={'method':_0xbf4e('0x37'),'uri':_0x5a631e[_0xbf4e('0x48')]+_0xbf4e('0x49'),'body':{'username':_0x5a631e[_0xbf4e('0x26')],'password':_0x5a631e[_0xbf4e('0x27')]},'json':!![]};return rp(_0x57a247)['then'](function(_0x55a17d){var _0x5a0f4a={'method':'POST','uri':_0x5a631e[_0xbf4e('0x48')]+_0xbf4e('0x4a'),'body':{'messages':[{'from':_0x5a631e['phone'],'destinations':[{'to':_0x4d9a07[_0xbf4e('0x1c')]}],'text':_0x4d9a07[_0xbf4e('0x9')],'notifyUrl':_0x5a631e[_0xbf4e('0x4b')]+_0xbf4e('0x1f')+_0x4d9a07['id']+_0xbf4e('0x20')+_0x5a631e[_0xbf4e('0x4c')],'notifyContentType':_0xbf4e('0x4d'),'callbackData':_0x5a631e['phone']+';'+_0x4d9a07[_0xbf4e('0x9')]}]},'headers':{'Authorization':_0xbf4e('0x4e')+_0x55a17d[_0xbf4e('0x4c')]},'json':!![]};return rp(_0x5a0f4a)['then'](function(_0x56338e){if(_0x56338e[_0xbf4e('0x1d')]){var _0x301d66={'messageId':_0x56338e[_0xbf4e('0x1d')][0x0]['messageId']};if(!_0x5a631e[_0xbf4e('0x31')]){_0x301d66[_0xbf4e('0x32')]=!![];}return _0xc86f04[_0xbf4e('0x22')](_0x301d66);}else{return logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x4f'),util[_0xbf4e('0x34')](_0x56338e,{'showHidden':![],'depth':null}));}});})[_0xbf4e('0x14')](function(_0x3025c5){return logger[_0xbf4e('0x15')](_0xbf4e('0x23'),'afterCreate',_0xbf4e('0x4f'),util['inspect'](_0x3025c5,{'showHidden':![],'depth':null}));});}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x4f'),_0xbf4e('0x50'));}}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),'infobip',_0xbf4e('0x35'));}break;case _0xbf4e('0x51'):var _0x22d5e1=require(_0xbf4e('0x52'));if(_0x5a631e[_0xbf4e('0x53')]){var _0x5f3deb={};_0x5f3deb[_0xbf4e('0x54')]=_0x5a631e[_0xbf4e('0x26')];_0x5f3deb[_0xbf4e('0x1c')]=_0x4d9a07[_0xbf4e('0x1c')];_0x5f3deb[_0xbf4e('0x29')]=_0x5a631e[_0xbf4e('0x1c')];_0x5f3deb['text']=_0x4d9a07[_0xbf4e('0x9')];_0x5f3deb['timestamp']=+new Date();var _0x21d6e3='';var _0x3d2ca7='';var _0x9335f7=Object[_0xbf4e('0x55')](_0x5f3deb);_0x9335f7['sort']();for(var _0x24fb65=0x0;_0x24fb65<_0x9335f7['length'];_0x24fb65++){if(_0x21d6e3!=''){_0x21d6e3+='&';}_0x21d6e3+=_0x9335f7[_0x24fb65]+'='+encodeURIComponent(_0x5f3deb[_0x9335f7[_0x24fb65]]);_0x3d2ca7+=_0x5f3deb[_0x9335f7[_0x24fb65]];}_0x3d2ca7+=_0x5a631e['apiKey'];_0x3d2ca7=_0x22d5e1[_0xbf4e('0x56')](_0xbf4e('0x57'))[_0xbf4e('0x22')](_0x3d2ca7)['digest'](_0xbf4e('0x58'));if(_0x21d6e3!==''){_0x21d6e3+='&';}_0x21d6e3+=_0xbf4e('0x59')+_0x3d2ca7;var _0x34b766={'method':_0xbf4e('0x2c'),'uri':_0x5a631e[_0xbf4e('0x48')]+_0xbf4e('0x5a')+_0x21d6e3,'json':!![]};return rp(_0x34b766)[_0xbf4e('0x13')](function(_0x260e3a){var _0xca79bd=Object[_0xbf4e('0x55')](_0x260e3a);if(_0x260e3a[_0xca79bd[0x0]][_0xbf4e('0x15')]&&parseInt(_0x260e3a[_0xca79bd[0x0]][_0xbf4e('0x15')])===0x0){var _0x52c527={'messageId':_0x260e3a[_0xca79bd[0x0]][_0xbf4e('0x5b')]};if(!_0x5a631e[_0xbf4e('0x31')]){_0x52c527[_0xbf4e('0x32')]=!![];}return _0xc86f04[_0xbf4e('0x22')](_0x52c527);}else{return logger['error'](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x51'),util[_0xbf4e('0x34')](_0x260e3a[_0xbf4e('0x15')],{'showHidden':![],'depth':null}));}})[_0xbf4e('0x14')](function(_0x31e1f7){return logger[_0xbf4e('0x15')](_0xbf4e('0x23'),'afterCreate',_0xbf4e('0x51'),util['inspect'](_0x31e1f7,{'showHidden':![],'depth':null}));});}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x51'),_0xbf4e('0x5c'));}break;case'clickatell':if(_0x5a631e[_0xbf4e('0x53')]){var _0x129f43={'method':_0xbf4e('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x5a631e[_0xbf4e('0x53')]},'body':{'content':_0x4d9a07[_0xbf4e('0x9')],'to':[_0x4d9a07[_0xbf4e('0x1c')]],'from':_0x5a631e['phone'],'binary':![],'clientMessageId':_0xbf4e('0x5d'),'charset':_0xbf4e('0x5e')},'json':!![]};rp(_0x129f43)[_0xbf4e('0x13')](function(_0x1cb0b8){if(!_0x1cb0b8[_0xbf4e('0x15')]){var _0x544a44={'messageId':_0x1cb0b8[_0xbf4e('0x1d')][0x0]['apiMessageId']};if(!_0x5a631e[_0xbf4e('0x31')]){_0x544a44['read']=!![];}return _0xc86f04[_0xbf4e('0x22')](_0x544a44);}else{return logger['error'](_0xbf4e('0x23'),'afterCreate',_0xbf4e('0x5f'),util[_0xbf4e('0x34')](_0x1cb0b8[_0xbf4e('0x15')],{'showHidden':![],'depth':null}));}})[_0xbf4e('0x14')](function(_0x272bf7){return logger[_0xbf4e('0x15')](_0xbf4e('0x23'),'afterCreate',_0xbf4e('0x5f'),util[_0xbf4e('0x34')](_0x272bf7,{'showHidden':![],'depth':null}));});}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x5f'),'Missing\x20parameters:\x20apiKey');}break;case _0xbf4e('0x60'):if(_0x5a631e[_0xbf4e('0x26')]&&_0x5a631e['password']){var _0x2e72cb=util[_0xbf4e('0x3a')](_0xbf4e('0x3b'),_0x5a631e[_0xbf4e('0x26')],_0x5a631e[_0xbf4e('0x27')]);var _0x5da823={'method':_0xbf4e('0x37'),'uri':_0xbf4e('0x61')+_0x5a631e[_0xbf4e('0x62')]+'/messages','body':{'to':[_0x4d9a07[_0xbf4e('0x1c')]],'text':_0x4d9a07[_0xbf4e('0x9')],'from':_0x5a631e[_0xbf4e('0x1c')],'applicationId':_0x5a631e['applicationId']},'headers':{'Authorization':util[_0xbf4e('0x3a')](_0xbf4e('0x63'),new Buffer(_0x2e72cb)['toString'](_0xbf4e('0x45')))},'json':!![]};rp(_0x5da823)[_0xbf4e('0x13')](function(_0x380d25){if(_0x380d25['id']){var _0xef121e={'messageId':_0x380d25['id']};return _0xc86f04[_0xbf4e('0x22')](_0xef121e);}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x60'),util[_0xbf4e('0x34')](_0x380d25,{'showHidden':![],'depth':null}));}})['catch'](function(_0x57ca27){logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x60'),util['inspect'](_0x57ca27,{'showHidden':![],'depth':null}));});}else{logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x60'),_0xbf4e('0x35'));}break;case _0xbf4e('0x64'):if(_0x5a631e[_0xbf4e('0x53')]){var _0x4af65a={};var _0x34b766={'method':_0xbf4e('0x37'),'uri':_0xbf4e('0x65'),'headers':{'Authorization':_0xbf4e('0x66')+_0x5a631e[_0xbf4e('0x53')],'Content-Type':_0xbf4e('0x4d')},'body':{'from':_0x5a631e['phone'],'to':_0x4d9a07[_0xbf4e('0x1c')],'text':_0x4d9a07[_0xbf4e('0x9')]},'json':!![]};return rp(_0x34b766)[_0xbf4e('0x13')](function(_0x47168b){if(_0x47168b[_0xbf4e('0x67')]==0xca){_0x4af65a[_0xbf4e('0x68')]=_0x47168b;var _0x2992b4={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xbf4e('0x66')+_0x5a631e[_0xbf4e('0x53')],'Content-Type':_0xbf4e('0x4d')},'body':{'refid':_0x4af65a[_0xbf4e('0x68')][_0xbf4e('0x69')]},'json':!![]};return rp(_0x2992b4)[_0xbf4e('0x13')](function(_0x38e3ee){_0x4af65a['status']=_0x38e3ee;var _0xb4f4a3={'messageId':_0x4af65a[_0xbf4e('0x68')][_0xbf4e('0x69')],'read':!![]};return _0xc86f04['update'](_0xb4f4a3);});}else{return logger['error'](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x64'),util['inspect'](_0x47168b,{'showHidden':![],'depth':null}));}})[_0xbf4e('0x14')](function(_0x18d860){return logger[_0xbf4e('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbf4e('0x33'),_0xbf4e('0x64'),util[_0xbf4e('0x34')](_0x18d860,{'showHidden':![],'depth':null}));});}else{return logger[_0xbf4e('0x15')](_0xbf4e('0x23'),_0xbf4e('0x33'),_0xbf4e('0x64'),_0xbf4e('0x6a'));}break;}}})[_0xbf4e('0x6b')](function(){_0x22668b();});}else{_0x22668b();}}},'charset':_0xbf4e('0x6c'),'collate':_0xbf4e('0x6d')});}; \ No newline at end of file +var _0xc560=['md5','hex','signature=','/external/get/send.php?','csc','clickatell','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','refid','status','message','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','UserId','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','find','type','twilio','accountSid','authToken','phone','remote','/api/sms/messages/','token','sid','update','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','username','smsMethod','sender','login?username=','password','GET','split','POST','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','clickSend','plivo','senderString','/status?token=','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','crypto','apiKey','text','timestamp','keys','createHash'];(function(_0x59312d,_0x52bb25){var _0x13ca66=function(_0x2d4a0c){while(--_0x2d4a0c){_0x59312d['push'](_0x59312d['shift']());}};_0x13ca66(++_0x52bb25);}(_0xc560,0x82));var _0x0c56=function(_0x52adcd,_0x25f2e5){_0x52adcd=_0x52adcd-0x0;var _0x313d2f=_0xc560[_0x52adcd];return _0x313d2f;};'use strict';var _=require(_0x0c56('0x0'));var util=require('util');var logger=require(_0x0c56('0x1'))('api');var moment=require(_0x0c56('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c56('0x3'));var rimraf=require(_0x0c56('0x4'));var config=require(_0x0c56('0x5'));var attributes=require(_0x0c56('0x6'));module['exports']=function(_0x2b5654,_0x2bc0a0){return _0x2b5654[_0x0c56('0x7')](_0x0c56('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x0c56('0x9'),'fields':['messageId']},{'name':_0x0c56('0xa'),'fields':[_0x0c56('0xb')],'type':_0x0c56('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x535444,_0x15979a,_0x41fd41){var _0x3651c6=_0x2b5654['models'];var _0x2dab08=_0x535444[_0x0c56('0xd')]({'plain':!![]});if(_0x2dab08[_0x0c56('0xe')][_0x0c56('0xf')]()==='in'||_0x2dab08[_0x0c56('0xe')][_0x0c56('0xf')]()===_0x0c56('0x10')&&!_0x2dab08['secret']&&!_['isNil'](_0x2dab08[_0x0c56('0x11')])){_0x3651c6[_0x0c56('0x12')][_0x0c56('0x13')]({'where':{'id':_0x2dab08[_0x0c56('0x14')]}})[_0x0c56('0x15')](function(_0xdc4827){if(_0xdc4827){_0xdc4827['update']({'lastMsgAt':_0x2dab08[_0x0c56('0x16')],'lastMsgDirection':_0x2dab08[_0x0c56('0xe')][_0x0c56('0xf')]()});}})[_0x0c56('0x17')](function(_0x5425){console['error'](_0x5425);});}if(_0x2dab08[_0x0c56('0xe')]==='out'&&!_0x2dab08['secret']){var _0x3ccdf7;_0x3651c6['SmsAccount'][_0x0c56('0x18')]({'where':{'id':_0x2dab08['SmsAccountId']},'raw':!![]})['then'](function(_0x224424){_0x3ccdf7=_0x224424;if(_0x3ccdf7&&_0x3ccdf7[_0x0c56('0x19')]){switch(_0x3ccdf7[_0x0c56('0x19')]){case _0x0c56('0x1a'):var _0x116735=require(_0x0c56('0x1a'));if(_0x3ccdf7[_0x0c56('0x1b')]&&_0x3ccdf7[_0x0c56('0x1c')]&&_0x3ccdf7[_0x0c56('0x1d')]){var _0x2c65c5=new _0x116735(_0x3ccdf7[_0x0c56('0x1b')],_0x3ccdf7[_0x0c56('0x1c')]);_0x2c65c5['messages']['create']({'body':_0x2dab08[_0x0c56('0xb')],'to':_0x2dab08[_0x0c56('0x1d')],'from':_0x3ccdf7[_0x0c56('0x1d')],'statusCallback':_0x3ccdf7[_0x0c56('0x1e')]+_0x0c56('0x1f')+_0x2dab08['id']+'/status?token='+_0x3ccdf7[_0x0c56('0x20')]})[_0x0c56('0x15')](function(_0x448bad){if(_0x448bad[_0x0c56('0x21')]){return _0x535444[_0x0c56('0x22')]({'messageId':_0x448bad['sid']});}})[_0x0c56('0x17')](function(_0x58e79d){logger[_0x0c56('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0c56('0x24'),_0x0c56('0x1a'),util[_0x0c56('0x25')](_0x58e79d,{'showHidden':![],'depth':null}));});}else{logger[_0x0c56('0x23')](_0x0c56('0x26'),'afterCreate',_0x0c56('0x1a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x0c56('0x27'):var _0x3a8f23='https://api.skebby.it/API/v1.0/REST/';if(_0x3ccdf7[_0x0c56('0x28')]&&_0x3ccdf7['password']){var _0x6acf19={'recipient':[_0x2dab08[_0x0c56('0x1d')]],'message':_0x2dab08[_0x0c56('0xb')],'message_type':_0x3ccdf7[_0x0c56('0x29')]};if(_0x3ccdf7[_0x0c56('0x29')]&&_0x3ccdf7[_0x0c56('0x29')]!=='SI'){_0x6acf19[_0x0c56('0x2a')]=_0x3ccdf7[_0x0c56('0x1d')];}var _0x45b70f={'url':_0x3a8f23+_0x0c56('0x2b')+_0x3ccdf7[_0x0c56('0x28')]+'&password='+_0x3ccdf7[_0x0c56('0x2c')],'method':_0x0c56('0x2d')};rp(_0x45b70f)[_0x0c56('0x15')](function(_0xa4a241){var _0x5c5a41=_0xa4a241[_0x0c56('0x2e')](';');var _0x10442e={'user_key':_0x5c5a41[0x0],'session_key':_0x5c5a41[0x1]};_0x45b70f={'url':_0x3a8f23+'sms','method':_0x0c56('0x2f'),'headers':{'user_key':_0x10442e['user_key'],'Session_key':_0x10442e[_0x0c56('0x30')]},'json':!![],'body':_0x6acf19};return rp(_0x45b70f);})[_0x0c56('0x15')](function(_0x1d83a0){if(_0x1d83a0[_0x0c56('0x31')]>=0x1){var _0x42fd9b={'messageId':_0x1d83a0[_0x0c56('0x32')]};if(_0x3ccdf7['smsMethod']!=='GP'||!_0x3ccdf7[_0x0c56('0x33')]){_0x42fd9b[_0x0c56('0x34')]=!![];}return _0x535444['update'](_0x42fd9b);}else{return logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x27'),util[_0x0c56('0x25')](_0x1d83a0,{'showHidden':![],'depth':null}));}})[_0x0c56('0x17')](function(_0x145ba2){return logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x27'),util['inspect'](_0x145ba2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x27'),_0x0c56('0x35'));}break;case'connectel':if(_0x3ccdf7[_0x0c56('0x1c')]){var _0x57220c={'recipient':_0x2dab08[_0x0c56('0x1d')],'message':_0x2dab08['body'],'sender':_0x3ccdf7['senderString']||_0x3ccdf7[_0x0c56('0x1d')],'authorization':_0x3ccdf7[_0x0c56('0x1c')]};var _0x15979a={'method':'POST','uri':_0x0c56('0x36'),'body':_0x57220c,'json':!![]};rp(_0x15979a)['then'](function(_0x9ea888){var _0xdd075c={'messageId':_0x9ea888[_0x0c56('0x37')]};if(!_0x3ccdf7[_0x0c56('0x33')]){_0xdd075c[_0x0c56('0x34')]=!![];}return _0x535444[_0x0c56('0x22')](_0xdd075c);})[_0x0c56('0x17')](function(_0x4fd945){logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),'connectel',util['inspect'](_0x4fd945,{'showHidden':![],'depth':null}));});}else{logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x38'),_0x0c56('0x39'));}break;case'clicksend':if(_0x3ccdf7[_0x0c56('0x28')]&&_0x3ccdf7[_0x0c56('0x2c')]){var _0x57220c={'messages':[{'source':'xCALLY\x20Motion','to':_0x2dab08[_0x0c56('0x1d')],'body':_0x2dab08[_0x0c56('0xb')],'from':_0x3ccdf7['senderString']||_0x3ccdf7[_0x0c56('0x1d')]}]};var _0x594fc9=util[_0x0c56('0x3a')]('%s:%s',_0x3ccdf7[_0x0c56('0x28')],_0x3ccdf7['password']);var _0x15979a={'method':'POST','uri':_0x0c56('0x3b'),'body':_0x57220c,'headers':{'Authorization':util[_0x0c56('0x3a')](_0x0c56('0x3c'),new Buffer(_0x594fc9)[_0x0c56('0x3d')](_0x0c56('0x3e')))},'json':!![]};rp(_0x15979a)[_0x0c56('0x15')](function(_0x264287){if(_0x264287[_0x0c56('0x3f')]>=0xc8&&_0x264287[_0x0c56('0x3f')]<=0xce){if(_0x264287[_0x0c56('0x40')]&&_0x264287[_0x0c56('0x40')][_0x0c56('0x41')]>0x0){var _0x28f537=_[_0x0c56('0x42')](_0x264287[_0x0c56('0x40')][_0x0c56('0x43')]);var _0x5dd815={'messageId':_0x28f537['message_id']};if(!_0x3ccdf7['deliveryReport']){_0x5dd815[_0x0c56('0x34')]=!![];}return _0x535444[_0x0c56('0x22')](_0x5dd815);}else{logger['error'](_0x0c56('0x26'),'afterCreate',_0x0c56('0x44'),util['inspect'](_0x264287,{'showHidden':![],'depth':null}));}}else{logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x44'),util[_0x0c56('0x25')](_0x264287,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2aa324){logger[_0x0c56('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0c56('0x44'),util[_0x0c56('0x25')](_0x2aa324,{'showHidden':![],'depth':null}));});}else{logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x44'),_0x0c56('0x35'));}break;case _0x0c56('0x45'):if(_0x3ccdf7['authId']&&_0x3ccdf7[_0x0c56('0x1c')]){var _0x57220c={'dst':_0x2dab08[_0x0c56('0x1d')],'text':_0x2dab08[_0x0c56('0xb')],'src':_0x3ccdf7[_0x0c56('0x46')]||_0x3ccdf7[_0x0c56('0x1d')],'url':_0x3ccdf7[_0x0c56('0x1e')]+'/api/sms/messages/'+_0x2dab08['id']+_0x0c56('0x47')+_0x3ccdf7[_0x0c56('0x20')]};var _0x594fc9=util[_0x0c56('0x3a')]('%s:%s',_0x3ccdf7[_0x0c56('0x48')],_0x3ccdf7['authToken']);var _0x15979a={'method':_0x0c56('0x2f'),'uri':util[_0x0c56('0x3a')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3ccdf7['authId']),'body':_0x57220c,'headers':{'Authorization':util['format'](_0x0c56('0x3c'),new Buffer(_0x594fc9)['toString']('base64'))},'json':!![]};rp(_0x15979a)['then'](function(_0x179d98){var _0x5369ed={'messageId':_0x179d98[_0x0c56('0x49')][0x0]};return _0x535444[_0x0c56('0x22')](_0x5369ed);})['catch'](function(_0x339ccc){logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x45'),util[_0x0c56('0x25')](_0x339ccc,{'showHidden':![],'depth':null}));});}else{logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x45'),_0x0c56('0x4a'));}break;case _0x0c56('0x4b'):if(_0x3ccdf7[_0x0c56('0x28')]&&_0x3ccdf7[_0x0c56('0x2c')]){if(_0x3ccdf7[_0x0c56('0x4c')]){var _0x1424e2={'method':_0x0c56('0x2f'),'uri':_0x3ccdf7[_0x0c56('0x4c')]+'/auth/1/session','body':{'username':_0x3ccdf7[_0x0c56('0x28')],'password':_0x3ccdf7[_0x0c56('0x2c')]},'json':!![]};return rp(_0x1424e2)[_0x0c56('0x15')](function(_0x20b396){var _0x4ae41e={'method':_0x0c56('0x2f'),'uri':_0x3ccdf7[_0x0c56('0x4c')]+_0x0c56('0x4d'),'body':{'messages':[{'from':_0x3ccdf7[_0x0c56('0x1d')],'destinations':[{'to':_0x2dab08[_0x0c56('0x1d')]}],'text':_0x2dab08['body'],'notifyUrl':_0x3ccdf7[_0x0c56('0x1e')]+_0x0c56('0x1f')+_0x2dab08['id']+_0x0c56('0x47')+_0x3ccdf7[_0x0c56('0x20')],'notifyContentType':_0x0c56('0x4e'),'callbackData':_0x3ccdf7[_0x0c56('0x1d')]+';'+_0x2dab08[_0x0c56('0xb')]}]},'headers':{'Authorization':_0x0c56('0x4f')+_0x20b396[_0x0c56('0x20')]},'json':!![]};return rp(_0x4ae41e)['then'](function(_0x18757b){if(_0x18757b[_0x0c56('0x43')]){var _0x861f2a={'messageId':_0x18757b[_0x0c56('0x43')][0x0][_0x0c56('0x9')]};if(!_0x3ccdf7[_0x0c56('0x33')]){_0x861f2a[_0x0c56('0x34')]=!![];}return _0x535444[_0x0c56('0x22')](_0x861f2a);}else{return logger[_0x0c56('0x23')](_0x0c56('0x26'),'afterCreate',_0x0c56('0x4b'),util[_0x0c56('0x25')](_0x18757b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x36c4b1){return logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x4b'),util[_0x0c56('0x25')](_0x36c4b1,{'showHidden':![],'depth':null}));});}else{logger[_0x0c56('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0c56('0x24'),_0x0c56('0x4b'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x4b'),_0x0c56('0x35'));}break;case'csc':var _0x2f2e43=require(_0x0c56('0x50'));if(_0x3ccdf7[_0x0c56('0x51')]){var _0x28d698={};_0x28d698['login']=_0x3ccdf7['username'];_0x28d698[_0x0c56('0x1d')]=_0x2dab08[_0x0c56('0x1d')];_0x28d698[_0x0c56('0x2a')]=_0x3ccdf7['phone'];_0x28d698[_0x0c56('0x52')]=_0x2dab08[_0x0c56('0xb')];_0x28d698[_0x0c56('0x53')]=+new Date();var _0x39a88a='';var _0xbbe790='';var _0x4c5812=Object[_0x0c56('0x54')](_0x28d698);_0x4c5812['sort']();for(var _0x3b0688=0x0;_0x3b0688<_0x4c5812['length'];_0x3b0688++){if(_0x39a88a!=''){_0x39a88a+='&';}_0x39a88a+=_0x4c5812[_0x3b0688]+'='+encodeURIComponent(_0x28d698[_0x4c5812[_0x3b0688]]);_0xbbe790+=_0x28d698[_0x4c5812[_0x3b0688]];}_0xbbe790+=_0x3ccdf7[_0x0c56('0x51')];_0xbbe790=_0x2f2e43[_0x0c56('0x55')](_0x0c56('0x56'))['update'](_0xbbe790)['digest'](_0x0c56('0x57'));if(_0x39a88a!==''){_0x39a88a+='&';}_0x39a88a+=_0x0c56('0x58')+_0xbbe790;var _0x45b70f={'method':_0x0c56('0x2d'),'uri':_0x3ccdf7[_0x0c56('0x4c')]+_0x0c56('0x59')+_0x39a88a,'json':!![]};return rp(_0x45b70f)[_0x0c56('0x15')](function(_0x5a9e5f){var _0x420cc5=Object[_0x0c56('0x54')](_0x5a9e5f);if(_0x5a9e5f[_0x420cc5[0x0]][_0x0c56('0x23')]&&parseInt(_0x5a9e5f[_0x420cc5[0x0]][_0x0c56('0x23')])===0x0){var _0x5e92e4={'messageId':_0x5a9e5f[_0x420cc5[0x0]]['id_sms']};if(!_0x3ccdf7[_0x0c56('0x33')]){_0x5e92e4[_0x0c56('0x34')]=!![];}return _0x535444[_0x0c56('0x22')](_0x5e92e4);}else{return logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x5a'),util[_0x0c56('0x25')](_0x5a9e5f[_0x0c56('0x23')],{'showHidden':![],'depth':null}));}})[_0x0c56('0x17')](function(_0x1002c9){return logger['error'](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x5a'),util[_0x0c56('0x25')](_0x1002c9,{'showHidden':![],'depth':null}));});}else{logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0x0c56('0x5b'):if(_0x3ccdf7['apiKey']){var _0x266315={'method':_0x0c56('0x2f'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3ccdf7[_0x0c56('0x51')]},'body':{'content':_0x2dab08[_0x0c56('0xb')],'to':[_0x2dab08[_0x0c56('0x1d')]],'from':_0x3ccdf7[_0x0c56('0x1d')],'binary':![],'clientMessageId':_0x0c56('0x5c'),'charset':'UTF-8'},'json':!![]};rp(_0x266315)['then'](function(_0x5bf2fd){if(!_0x5bf2fd['error']){var _0x3ede17={'messageId':_0x5bf2fd[_0x0c56('0x43')][0x0][_0x0c56('0x5d')]};if(!_0x3ccdf7[_0x0c56('0x33')]){_0x3ede17[_0x0c56('0x34')]=!![];}return _0x535444[_0x0c56('0x22')](_0x3ede17);}else{return logger[_0x0c56('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0c56('0x24'),_0x0c56('0x5b'),util['inspect'](_0x5bf2fd[_0x0c56('0x23')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x54f8b8){return logger[_0x0c56('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0c56('0x5b'),util[_0x0c56('0x25')](_0x54f8b8,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0c56('0x24'),_0x0c56('0x5b'),_0x0c56('0x5e'));}break;case _0x0c56('0x5f'):if(_0x3ccdf7['username']&&_0x3ccdf7[_0x0c56('0x2c')]){var _0x594fc9=util[_0x0c56('0x3a')]('%s:%s',_0x3ccdf7[_0x0c56('0x28')],_0x3ccdf7[_0x0c56('0x2c')]);var _0x15979a={'method':_0x0c56('0x2f'),'uri':_0x0c56('0x60')+_0x3ccdf7[_0x0c56('0x61')]+'/messages','body':{'to':[_0x2dab08[_0x0c56('0x1d')]],'text':_0x2dab08['body'],'from':_0x3ccdf7[_0x0c56('0x1d')],'applicationId':_0x3ccdf7['applicationId']},'headers':{'Authorization':util[_0x0c56('0x3a')](_0x0c56('0x3c'),new Buffer(_0x594fc9)[_0x0c56('0x3d')](_0x0c56('0x3e')))},'json':!![]};rp(_0x15979a)['then'](function(_0x4d24d7){if(_0x4d24d7['id']){var _0x42ffcd={'messageId':_0x4d24d7['id']};return _0x535444[_0x0c56('0x22')](_0x42ffcd);}else{logger[_0x0c56('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0c56('0x24'),_0x0c56('0x5f'),util[_0x0c56('0x25')](_0x4d24d7,{'showHidden':![],'depth':null}));}})[_0x0c56('0x17')](function(_0x17d3a4){logger[_0x0c56('0x23')](_0x0c56('0x26'),_0x0c56('0x24'),'bandwidth',util[_0x0c56('0x25')](_0x17d3a4,{'showHidden':![],'depth':null}));});}else{logger[_0x0c56('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x3ccdf7[_0x0c56('0x51')]){var _0x3a2514={};var _0x45b70f={'method':_0x0c56('0x2f'),'uri':_0x0c56('0x62'),'headers':{'Authorization':_0x0c56('0x63')+_0x3ccdf7['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x3ccdf7[_0x0c56('0x1d')],'to':_0x2dab08[_0x0c56('0x1d')],'text':_0x2dab08['body']},'json':!![]};return rp(_0x45b70f)[_0x0c56('0x15')](function(_0x3430){if(_0x3430[_0x0c56('0x64')]==0xca){_0x3a2514['message']=_0x3430;var _0x37ee61={'method':_0x0c56('0x2f'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x0c56('0x63')+_0x3ccdf7[_0x0c56('0x51')],'Content-Type':'application/json'},'body':{'refid':_0x3a2514['message'][_0x0c56('0x65')]},'json':!![]};return rp(_0x37ee61)[_0x0c56('0x15')](function(_0x453eb4){_0x3a2514[_0x0c56('0x66')]=_0x453eb4;var _0x17398e={'messageId':_0x3a2514[_0x0c56('0x67')]['refid'],'read':!![]};return _0x535444[_0x0c56('0x22')](_0x17398e);});}else{return logger[_0x0c56('0x23')](_0x0c56('0x26'),'afterCreate',_0x0c56('0x68'),util['inspect'](_0x3430,{'showHidden':![],'depth':null}));}})[_0x0c56('0x17')](function(_0x18c0db){return logger['error'](_0x0c56('0x26'),_0x0c56('0x24'),'intelepeer',util[_0x0c56('0x25')](_0x18c0db,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x0c56('0x26'),_0x0c56('0x24'),_0x0c56('0x68'),_0x0c56('0x69'));}break;}}})[_0x0c56('0x6a')](function(){_0x41fd41();});}else{_0x41fd41();}}},'charset':_0x0c56('0x6b'),'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 5e923a4..b32adec 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 _0xdaf3=['body','options','raw','stringify','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x19e425,_0x7f53c0){var _0x220e1d=function(_0x824c8){while(--_0x824c8){_0x19e425['push'](_0x19e425['shift']());}};_0x220e1d(++_0x7f53c0);}(_0xdaf3,0xf4));var _0x3daf=function(_0x347ea8,_0x2ac098){_0x347ea8=_0x347ea8-0x0;var _0x2e83f4=_0xdaf3[_0x347ea8];return _0x2e83f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3daf('0x0'));var rs=require(_0x3daf('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3daf('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3daf('0x3'));var config=require(_0x3daf('0x4'));var jayson=require(_0x3daf('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x3daf('0x6')]=_[_0x3daf('0x7')](config[_0x3daf('0x6')],{'host':_0x3daf('0x8'),'port':0x18eb});var socket=require(_0x3daf('0x9'))(new Redis(config[_0x3daf('0x6')]));require(_0x3daf('0xa'))[_0x3daf('0xb')](socket);function respondWithRpcPromise(_0x16c3b6,_0x446e6b,_0x3c387e){return new BPromise(function(_0x4b0de7,_0x44b301){return client[_0x3daf('0xc')](_0x16c3b6,_0x3c387e)[_0x3daf('0xd')](function(_0x2116b2){logger[_0x3daf('0xe')](_0x3daf('0xf'),_0x446e6b,_0x3daf('0x10'));logger[_0x3daf('0x11')](_0x3daf('0x12'),_0x446e6b,_0x3daf('0x10'),JSON['stringify'](_0x2116b2));if(_0x2116b2['error']){if(_0x2116b2['error']['code']===0x1f4){logger[_0x3daf('0x13')](_0x3daf('0xf'),_0x446e6b,_0x2116b2['error'][_0x3daf('0x14')]);return _0x44b301(_0x2116b2[_0x3daf('0x13')][_0x3daf('0x14')]);}logger[_0x3daf('0x13')](_0x3daf('0xf'),_0x446e6b,_0x2116b2['error'][_0x3daf('0x14')]);return _0x4b0de7(_0x2116b2[_0x3daf('0x13')][_0x3daf('0x14')]);}else{logger[_0x3daf('0xe')](_0x3daf('0xf'),_0x446e6b,_0x3daf('0x10'));_0x4b0de7(_0x2116b2[_0x3daf('0x15')][_0x3daf('0x14')]);}})[_0x3daf('0x16')](function(_0x3e8c87){logger[_0x3daf('0x13')](_0x3daf('0xf'),_0x446e6b,_0x3e8c87);_0x44b301(_0x3e8c87);});});}exports[_0x3daf('0x17')]=function(_0x4b56ca){var _0x5f2b84=this;return new Promise(function(_0x5425f5,_0x408324){return db[_0x3daf('0x18')][_0x3daf('0x19')](_0x4b56ca[_0x3daf('0x1a')],{'raw':_0x4b56ca[_0x3daf('0x1b')]?_0x4b56ca[_0x3daf('0x1b')][_0x3daf('0x1c')]===undefined?!![]:![]:!![]})[_0x3daf('0xd')](function(_0x20f60d){logger[_0x3daf('0xe')]('CreateSmsMessage',_0x4b56ca);logger[_0x3daf('0x11')](_0x3daf('0x17'),_0x4b56ca,JSON[_0x3daf('0x1d')](_0x20f60d));_0x5425f5(_0x20f60d);})[_0x3daf('0x16')](function(_0x210c3f){logger[_0x3daf('0x13')](_0x3daf('0x17'),_0x210c3f[_0x3daf('0x14')],_0x4b56ca);_0x408324(_0x5f2b84[_0x3daf('0x13')](0x1f4,_0x210c3f[_0x3daf('0x14')]));});});}; \ No newline at end of file +var _0x321a=['raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage','options'];(function(_0x15c7c9,_0x5b551b){var _0x177a30=function(_0x4f6fac){while(--_0x4f6fac){_0x15c7c9['push'](_0x15c7c9['shift']());}};_0x177a30(++_0x5b551b);}(_0x321a,0x141));var _0xa321=function(_0xa04daf,_0x25e602){_0xa04daf=_0xa04daf-0x0;var _0x3f7fa6=_0x321a[_0xa04daf];return _0x3f7fa6;};'use strict';var _=require('lodash');var util=require(_0xa321('0x0'));var moment=require(_0xa321('0x1'));var BPromise=require(_0xa321('0x2'));var rs=require(_0xa321('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa321('0x4'))['db'];var utils=require(_0xa321('0x5'));var logger=require('../../config/logger')(_0xa321('0x6'));var config=require(_0xa321('0x7'));var jayson=require(_0xa321('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa321('0x9')](config[_0xa321('0xa')],{'host':_0xa321('0xb'),'port':0x18eb});var socket=require(_0xa321('0xc'))(new Redis(config[_0xa321('0xa')]));require(_0xa321('0xd'))[_0xa321('0xe')](socket);function respondWithRpcPromise(_0x39e087,_0x2a94e0,_0x1c2c1d){return new BPromise(function(_0x39f3eb,_0x16fc59){return client[_0xa321('0xf')](_0x39e087,_0x1c2c1d)[_0xa321('0x10')](function(_0x60c7f4){logger[_0xa321('0x11')]('SmsMessage,\x20%s,\x20%s',_0x2a94e0,_0xa321('0x12'));logger[_0xa321('0x13')](_0xa321('0x14'),_0x2a94e0,_0xa321('0x12'),JSON[_0xa321('0x15')](_0x60c7f4));if(_0x60c7f4[_0xa321('0x16')]){if(_0x60c7f4[_0xa321('0x16')][_0xa321('0x17')]===0x1f4){logger[_0xa321('0x16')]('SmsMessage,\x20%s,\x20%s',_0x2a94e0,_0x60c7f4[_0xa321('0x16')][_0xa321('0x18')]);return _0x16fc59(_0x60c7f4[_0xa321('0x16')]['message']);}logger[_0xa321('0x16')](_0xa321('0x19'),_0x2a94e0,_0x60c7f4['error']['message']);return _0x39f3eb(_0x60c7f4['error']['message']);}else{logger[_0xa321('0x11')]('SmsMessage,\x20%s,\x20%s',_0x2a94e0,'request\x20sent');_0x39f3eb(_0x60c7f4[_0xa321('0x1a')][_0xa321('0x18')]);}})[_0xa321('0x1b')](function(_0x15323e){logger[_0xa321('0x16')](_0xa321('0x19'),_0x2a94e0,_0x15323e);_0x16fc59(_0x15323e);});});}exports[_0xa321('0x1c')]=function(_0xbbe078){var _0x484b31=this;return new Promise(function(_0x5516c8,_0x50fbae){return db[_0xa321('0x1d')]['create'](_0xbbe078['body'],{'raw':_0xbbe078[_0xa321('0x1e')]?_0xbbe078[_0xa321('0x1e')][_0xa321('0x1f')]===undefined?!![]:![]:!![]})[_0xa321('0x10')](function(_0x16c9e4){logger[_0xa321('0x11')](_0xa321('0x1c'),_0xbbe078);logger[_0xa321('0x13')]('CreateSmsMessage',_0xbbe078,JSON[_0xa321('0x15')](_0x16c9e4));_0x5516c8(_0x16c9e4);})[_0xa321('0x1b')](function(_0x3fc5b9){logger[_0xa321('0x16')](_0xa321('0x1c'),_0x3fc5b9['message'],_0xbbe078);_0x50fbae(_0x484b31[_0xa321('0x16')](0x1f4,_0x3fc5b9['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 622ba05..5e93d72 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 _0x2a4a=['save','remove','update','removeListener','./smsMessage.events'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x2a4a,0x1bc));var _0xa2a4=function(_0x59bfd2,_0x25201d){_0x59bfd2=_0x59bfd2-0x0;var _0x28303f=_0x2a4a[_0x59bfd2];return _0x28303f;};'use strict';var SmsMessageEvents=require(_0xa2a4('0x0'));var events=[_0xa2a4('0x1'),_0xa2a4('0x2'),_0xa2a4('0x3')];function createListener(_0x41bb83,_0x509dae){return function(_0x490fb1){_0x509dae['emit'](_0x41bb83,_0x490fb1);};}function removeListener(_0x367890,_0x4ece49){return function(){SmsMessageEvents[_0xa2a4('0x4')](_0x367890,_0x4ece49);};}exports['register']=function(_0x55b7cc){for(var _0x36c65c=0x0,_0x3c9f7f=events['length'];_0x36c65c<_0x3c9f7f;_0x36c65c++){var _0x5863fe=events[_0x36c65c];var _0x3231f4=createListener('smsMessage:'+_0x5863fe,_0x55b7cc);SmsMessageEvents['on'](_0x5863fe,_0x3231f4);}}; \ No newline at end of file +var _0xe245=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x52f16a,_0x40416f){var _0x537271=function(_0x4d74da){while(--_0x4d74da){_0x52f16a['push'](_0x52f16a['shift']());}};_0x537271(++_0x40416f);}(_0xe245,0x9e));var _0x5e24=function(_0x321c6d,_0x6e6f64){_0x321c6d=_0x321c6d-0x0;var _0x2f36da=_0xe245[_0x321c6d];return _0x2f36da;};'use strict';var SmsMessageEvents=require(_0x5e24('0x0'));var events=[_0x5e24('0x1'),_0x5e24('0x2'),_0x5e24('0x3')];function createListener(_0x118c23,_0x280df9){return function(_0x2a9a3c){_0x280df9[_0x5e24('0x4')](_0x118c23,_0x2a9a3c);};}function removeListener(_0x1dd36b,_0x111e7a){return function(){SmsMessageEvents[_0x5e24('0x5')](_0x1dd36b,_0x111e7a);};}exports[_0x5e24('0x6')]=function(_0x47f35a){for(var _0x56a6a2=0x0,_0x3a5008=events[_0x5e24('0x7')];_0x56a6a2<_0x3a5008;_0x56a6a2++){var _0x3b8a82=events[_0x56a6a2];var _0xa6c583=createListener(_0x5e24('0x8')+_0x3b8a82,_0x47f35a);SmsMessageEvents['on'](_0x3b8a82,_0xa6c583);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7e45ece..7e7b285 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 _0x8736=['removeAgents','exports','util','path','connect-timeout','express','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams'];(function(_0x185b2b,_0x469f29){var _0xde8600=function(_0x35de0f){while(--_0x35de0f){_0x185b2b['push'](_0x185b2b['shift']());}};_0xde8600(++_0x469f29);}(_0x8736,0xbf));var _0x6873=function(_0x401893,_0x1dc37b){_0x401893=_0x401893-0x0;var _0x8ba4ef=_0x8736[_0x401893];return _0x8ba4ef;};'use strict';var multer=require('multer');var util=require(_0x6873('0x0'));var path=require(_0x6873('0x1'));var timeout=require(_0x6873('0x2'));var express=require(_0x6873('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6873('0x4'));var controller=require(_0x6873('0x5'));router[_0x6873('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6873('0x6')](_0x6873('0x7'),auth[_0x6873('0x8')](),controller['describe']);router['get'](_0x6873('0x9'),auth['isAuthenticated'](),controller[_0x6873('0xa')]);router['get'](_0x6873('0xb'),auth['isAuthenticated'](),controller[_0x6873('0xc')]);router[_0x6873('0x6')](_0x6873('0xd'),auth[_0x6873('0x8')](),controller[_0x6873('0xe')]);router[_0x6873('0x6')]('/:id/users',auth[_0x6873('0x8')](),controller[_0x6873('0xf')]);router[_0x6873('0x10')]('/',auth[_0x6873('0x8')](),controller[_0x6873('0x11')]);router[_0x6873('0x10')](_0x6873('0xd'),auth['isAuthenticated'](),controller[_0x6873('0x12')]);router[_0x6873('0x10')](_0x6873('0x13'),auth[_0x6873('0x8')](),controller[_0x6873('0x14')]);router[_0x6873('0x15')](_0x6873('0x9'),auth[_0x6873('0x8')](),controller['update']);router[_0x6873('0x16')](_0x6873('0x9'),auth['isAuthenticated'](),controller[_0x6873('0x17')]);router['delete'](_0x6873('0xd'),auth[_0x6873('0x8')](),controller[_0x6873('0x18')]);router[_0x6873('0x16')](_0x6873('0x13'),auth[_0x6873('0x8')](),controller[_0x6873('0x19')]);module[_0x6873('0x1a')]=router; \ No newline at end of file +var _0x9136=['delete','removeTeams','removeAgents','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents'];(function(_0xa0ff20,_0x2d2d0f){var _0x27ec58=function(_0x40ffc6){while(--_0x40ffc6){_0xa0ff20['push'](_0xa0ff20['shift']());}};_0x27ec58(++_0x2d2d0f);}(_0x9136,0x8e));var _0x6913=function(_0x5df97e,_0x4ec12f){_0x5df97e=_0x5df97e-0x0;var _0x7e0bc9=_0x9136[_0x5df97e];return _0x7e0bc9;};'use strict';var multer=require('multer');var util=require(_0x6913('0x0'));var path=require(_0x6913('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6913('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6913('0x3'));var interaction=require(_0x6913('0x4'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x6913('0x5')]('/',auth[_0x6913('0x6')](),controller['index']);router[_0x6913('0x5')](_0x6913('0x7'),auth['isAuthenticated'](),controller[_0x6913('0x8')]);router[_0x6913('0x5')](_0x6913('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6913('0x5')](_0x6913('0xa'),auth[_0x6913('0x6')](),controller[_0x6913('0xb')]);router[_0x6913('0x5')](_0x6913('0xc'),auth[_0x6913('0x6')](),controller[_0x6913('0xd')]);router[_0x6913('0x5')](_0x6913('0xe'),auth[_0x6913('0x6')](),controller[_0x6913('0xf')]);router[_0x6913('0x10')]('/',auth[_0x6913('0x6')](),controller[_0x6913('0x11')]);router[_0x6913('0x10')](_0x6913('0xc'),auth[_0x6913('0x6')](),controller['addTeams']);router[_0x6913('0x10')]('/:id/users',auth[_0x6913('0x6')](),controller[_0x6913('0x12')]);router['put'](_0x6913('0x9'),auth[_0x6913('0x6')](),controller['update']);router[_0x6913('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x6913('0xc'),auth[_0x6913('0x6')](),controller[_0x6913('0x14')]);router[_0x6913('0x13')](_0x6913('0xe'),auth[_0x6913('0x6')](),controller[_0x6913('0x15')]);module[_0x6913('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index ec4dbb5..f980f27 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 _0xbc64=['exports','name','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x4bc432,_0x3245a7){var _0x46bd8e=function(_0x3e31c1){while(--_0x3e31c1){_0x4bc432['push'](_0x4bc432['shift']());}};_0x46bd8e(++_0x3245a7);}(_0xbc64,0xc4));var _0x4bc6=function(_0x102692,_0x2611a4){_0x102692=_0x102692-0x0;var _0x5935c9=_0xbc64[_0x102692];return _0x5935c9;};'use strict';var Sequelize=require('sequelize');module[_0x4bc6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x4bc6('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4bc6('0x2')]},'timeout':{'type':Sequelize[_0x4bc6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4bc6('0x4')](_0x4bc6('0x5'),'beepall',_0x4bc6('0x6'))}}; \ No newline at end of file +var _0x3dee=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x21a466,_0x6b26fe){var _0x4bf846=function(_0xbb0cc4){while(--_0xbb0cc4){_0x21a466['push'](_0x21a466['shift']());}};_0x4bf846(++_0x6b26fe);}(_0x3dee,0x168));var _0xe3de=function(_0x46bbb6,_0x59f258){_0x46bbb6=_0x46bbb6-0x0;var _0x9c41a3=_0x3dee[_0x46bbb6];return _0x9c41a3;};'use strict';var Sequelize=require(_0xe3de('0x0'));module[_0xe3de('0x1')]={'name':{'type':Sequelize[_0xe3de('0x2')],'unique':_0xe3de('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe3de('0x2')]},'timeout':{'type':Sequelize[_0xe3de('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe3de('0x5')](_0xe3de('0x6'),_0xe3de('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 30aa78a..1940a39 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 _0x5184=['isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','end','limit','undefined','count','offset','Content-Range','json','apply','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','SmsQueue','findAll','rows','catch','show','params','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','nolimit','order','pick','SmsQueueId','findAndCountAll','UserId','agent','smsPause','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','User','Agents','online','flatMap','sequelize','transaction','each','UserSmsQueue','findOrCreate','forEach','emit','removeTeams','select','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','includes','union','compact','value'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x5184,0x1b5));var _0x4518=function(_0x26b014,_0x31a4d9){_0x26b014=_0x26b014-0x0;var _0x4e8bac=_0x5184[_0x26b014];return _0x4e8bac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4518('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4518('0x1'));var rp=require(_0x4518('0x2'));var moment=require(_0x4518('0x3'));var BPromise=require(_0x4518('0x4'));var Mustache=require(_0x4518('0x5'));var util=require(_0x4518('0x6'));var path=require(_0x4518('0x7'));var sox=require(_0x4518('0x8'));var csv=require('to-csv');var ejs=require(_0x4518('0x9'));var fs=require('fs');var fs_extra=require(_0x4518('0xa'));var _=require(_0x4518('0xb'));var squel=require('squel');var crypto=require(_0x4518('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4518('0xd'));var toCsv=require(_0x4518('0xe'));var querystring=require(_0x4518('0xf'));var Papa=require(_0x4518('0x10'));var Redis=require(_0x4518('0x11'));var authService=require(_0x4518('0x12'));var qs=require(_0x4518('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4518('0x14'));var logger=require(_0x4518('0x15'))(_0x4518('0x16'));var utils=require(_0x4518('0x17'));var config=require(_0x4518('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4518('0x19'))['db'];config[_0x4518('0x1a')]=_[_0x4518('0x1b')](config[_0x4518('0x1a')],{'host':_0x4518('0x1c'),'port':0x18eb});var socket=require(_0x4518('0x1d'))(new Redis(config[_0x4518('0x1a')]));require(_0x4518('0x1e'))[_0x4518('0x1f')](socket);function respondWithStatusCode(_0x26558c,_0x163df4){_0x163df4=_0x163df4||0xcc;return function(_0x3af8e6){if(_0x3af8e6){return _0x26558c['sendStatus'](_0x163df4);}return _0x26558c[_0x4518('0x20')](_0x163df4)[_0x4518('0x21')]();};}function respondWithResult(_0x2e8937,_0x2b2de6){_0x2b2de6=_0x2b2de6||0xc8;return function(_0x35b5f2){if(_0x35b5f2){return _0x2e8937[_0x4518('0x20')](_0x2b2de6)['json'](_0x35b5f2);}};}function respondWithFilteredResult(_0x11cee9,_0x50a5c3){return function(_0x40e3de){if(_0x40e3de){var _0x301299=typeof _0x50a5c3['offset']==='undefined'&&typeof _0x50a5c3[_0x4518('0x22')]===_0x4518('0x23');var _0x23e346=_0x40e3de[_0x4518('0x24')];var _0x18f11e=_0x301299?0x0:_0x50a5c3[_0x4518('0x25')];var _0x404b15=_0x301299?_0x40e3de[_0x4518('0x24')]:_0x50a5c3['offset']+_0x50a5c3[_0x4518('0x22')];var _0x174acf;if(_0x404b15>=_0x23e346){_0x404b15=_0x23e346;_0x174acf=0xc8;}else{_0x174acf=0xce;}_0x11cee9['status'](_0x174acf);return _0x11cee9['set'](_0x4518('0x26'),_0x18f11e+'-'+_0x404b15+'/'+_0x23e346)[_0x4518('0x27')](_0x40e3de);}return null;};}function patchUpdates(_0x50e970){return function(_0x358600){try{jsonpatch[_0x4518('0x28')](_0x358600,_0x50e970,!![]);}catch(_0x37b306){return BPromise['reject'](_0x37b306);}return _0x358600[_0x4518('0x29')]();};}function saveUpdates(_0x3b50ee,_0x702067){return function(_0x384b3f){if(_0x384b3f){return _0x384b3f[_0x4518('0x2a')](_0x3b50ee)['then'](function(_0x573163){return _0x573163;});}return null;};}function removeEntity(_0x2cf520,_0x4f9f23){return function(_0x3cf325){if(_0x3cf325){return _0x3cf325[_0x4518('0x2b')]()[_0x4518('0x2c')](function(){var _0x512828=_0x3cf325[_0x4518('0x2d')]({'plain':!![]});var _0x212753='SmsQueues';return db[_0x4518('0x2e')][_0x4518('0x2b')]({'where':{'type':_0x212753,'resourceId':_0x512828['id']}})[_0x4518('0x2c')](function(){return _0x3cf325;});})['then'](function(){_0x2cf520[_0x4518('0x20')](0xcc)[_0x4518('0x21')]();});}};}function handleEntityNotFound(_0x55c54d,_0x2bd762){return function(_0x1e0e84){if(!_0x1e0e84){_0x55c54d[_0x4518('0x2f')](0x194);}return _0x1e0e84;};}function handleError(_0xc57e1f,_0xa3094c){_0xa3094c=_0xa3094c||0x1f4;return function(_0x3587ab){logger[_0x4518('0x30')](_0x3587ab[_0x4518('0x31')]);if(_0x3587ab[_0x4518('0x32')]){delete _0x3587ab[_0x4518('0x32')];}_0xc57e1f[_0x4518('0x20')](_0xa3094c)['send'](_0x3587ab);};}exports[_0x4518('0x33')]=function(_0xf8bf8a,_0x16f4e1){var _0x5aedfa={},_0x555d77={},_0x4c0911={'count':0x0,'rows':[]};var _0x29ca5d=_[_0x4518('0x34')](db['SmsQueue'][_0x4518('0x35')],function(_0x451449){return{'name':_0x451449[_0x4518('0x36')],'type':_0x451449['type']['key']};});_0x555d77[_0x4518('0x37')]=_[_0x4518('0x34')](_0x29ca5d,_0x4518('0x32'));_0x555d77['query']=_[_0x4518('0x38')](_0xf8bf8a[_0x4518('0x39')]);_0x555d77[_0x4518('0x3a')]=_[_0x4518('0x3b')](_0x555d77['model'],_0x555d77['query']);_0x5aedfa[_0x4518('0x3c')]=_[_0x4518('0x3b')](_0x555d77[_0x4518('0x37')],qs['fields'](_0xf8bf8a[_0x4518('0x39')][_0x4518('0x3d')]));_0x5aedfa['attributes']=_0x5aedfa[_0x4518('0x3c')]['length']?_0x5aedfa[_0x4518('0x3c')]:_0x555d77['model'];if(!_0xf8bf8a[_0x4518('0x39')][_0x4518('0x3e')]('nolimit')){_0x5aedfa[_0x4518('0x22')]=qs[_0x4518('0x22')](_0xf8bf8a[_0x4518('0x39')]['limit']);_0x5aedfa['offset']=qs[_0x4518('0x25')](_0xf8bf8a[_0x4518('0x39')][_0x4518('0x25')]);}_0x5aedfa['order']=qs[_0x4518('0x3f')](_0xf8bf8a[_0x4518('0x39')][_0x4518('0x3f')]);_0x5aedfa[_0x4518('0x40')]=qs[_0x4518('0x3a')](_['pick'](_0xf8bf8a['query'],_0x555d77[_0x4518('0x3a')]),_0x29ca5d);if(_0xf8bf8a[_0x4518('0x39')][_0x4518('0x41')]){_0x5aedfa[_0x4518('0x40')]=_['merge'](_0x5aedfa[_0x4518('0x40')],{'$or':_[_0x4518('0x34')](_0x29ca5d,function(_0x1398c5){if(_0x1398c5[_0x4518('0x42')]!==_0x4518('0x43')){var _0x355a12={};_0x355a12[_0x1398c5[_0x4518('0x32')]]={'$like':'%'+_0xf8bf8a[_0x4518('0x39')][_0x4518('0x41')]+'%'};return _0x355a12;}})});}_0x5aedfa=_[_0x4518('0x44')]({},_0x5aedfa,_0xf8bf8a[_0x4518('0x45')]);var _0x284446={'where':_0x5aedfa[_0x4518('0x40')]};return db['SmsQueue'][_0x4518('0x24')](_0x284446)['then'](function(_0x3ded81){_0x4c0911['count']=_0x3ded81;if(_0xf8bf8a['query'][_0x4518('0x46')]){_0x5aedfa[_0x4518('0x47')]=[{'all':!![]}];}return db[_0x4518('0x48')][_0x4518('0x49')](_0x5aedfa);})['then'](function(_0x5f23f0){_0x4c0911[_0x4518('0x4a')]=_0x5f23f0;return _0x4c0911;})['then'](respondWithFilteredResult(_0x16f4e1,_0x5aedfa))[_0x4518('0x4b')](handleError(_0x16f4e1,null));};exports[_0x4518('0x4c')]=function(_0x5a797e,_0x2f1ff3){var _0x4ad7de={'raw':!![],'where':{'id':_0x5a797e[_0x4518('0x4d')]['id']}},_0x2779be={};_0x2779be[_0x4518('0x37')]=_[_0x4518('0x38')](db[_0x4518('0x48')][_0x4518('0x35')]);_0x2779be[_0x4518('0x39')]=_['keys'](_0x5a797e[_0x4518('0x39')]);_0x2779be[_0x4518('0x3a')]=_[_0x4518('0x3b')](_0x2779be[_0x4518('0x37')],_0x2779be[_0x4518('0x39')]);_0x4ad7de[_0x4518('0x3c')]=_[_0x4518('0x3b')](_0x2779be[_0x4518('0x37')],qs[_0x4518('0x3d')](_0x5a797e[_0x4518('0x39')][_0x4518('0x3d')]));_0x4ad7de['attributes']=_0x4ad7de[_0x4518('0x3c')][_0x4518('0x4e')]?_0x4ad7de[_0x4518('0x3c')]:_0x2779be[_0x4518('0x37')];if(_0x5a797e[_0x4518('0x39')][_0x4518('0x46')]){_0x4ad7de[_0x4518('0x47')]=[{'all':!![]}];}_0x4ad7de=_[_0x4518('0x44')]({},_0x4ad7de,_0x5a797e[_0x4518('0x45')]);return db[_0x4518('0x48')]['find'](_0x4ad7de)[_0x4518('0x2c')](handleEntityNotFound(_0x2f1ff3,null))[_0x4518('0x2c')](respondWithResult(_0x2f1ff3,null))[_0x4518('0x4b')](handleError(_0x2f1ff3,null));};exports['create']=function(_0x3e8ac5,_0x15eabf){return db[_0x4518('0x48')][_0x4518('0x4f')](_0x3e8ac5['body'],{})['then'](function(_0x540a32){var _0x1e287a=_0x3e8ac5['user']['get']({'plain':!![]});if(!_0x1e287a)throw new Error(_0x4518('0x50'));if(_0x1e287a[_0x4518('0x51')]===_0x4518('0x52')){var _0x26ca42=_0x540a32[_0x4518('0x2d')]({'plain':!![]});var _0x3a21d0=_0x4518('0x53');return db[_0x4518('0x54')][_0x4518('0x55')]({'where':{'name':_0x3a21d0,'userProfileId':_0x1e287a['userProfileId']},'raw':!![]})['then'](function(_0x3cf36d){if(_0x3cf36d&&_0x3cf36d['autoAssociation']===0x0){return db[_0x4518('0x2e')][_0x4518('0x4f')]({'name':_0x26ca42['name'],'resourceId':_0x26ca42['id'],'type':_0x3cf36d[_0x4518('0x32')],'sectionId':_0x3cf36d['id']},{})[_0x4518('0x2c')](function(){return _0x540a32;});}else{return _0x540a32;}})[_0x4518('0x4b')](function(_0x445914){logger[_0x4518('0x30')](_0x4518('0x56'),_0x445914);throw _0x445914;});}return _0x540a32;})[_0x4518('0x2c')](respondWithResult(_0x15eabf,0xc9))[_0x4518('0x4b')](handleError(_0x15eabf,null));};exports[_0x4518('0x2a')]=function(_0x47dc99,_0x596e9f){if(_0x47dc99[_0x4518('0x57')]['id']){delete _0x47dc99[_0x4518('0x57')]['id'];}return db['SmsQueue'][_0x4518('0x55')]({'where':{'id':_0x47dc99['params']['id']}})[_0x4518('0x2c')](handleEntityNotFound(_0x596e9f,null))[_0x4518('0x2c')](saveUpdates(_0x47dc99[_0x4518('0x57')],null))[_0x4518('0x2c')](respondWithResult(_0x596e9f,null))[_0x4518('0x4b')](handleError(_0x596e9f,null));};exports[_0x4518('0x2b')]=function(_0x52fb05,_0x5765a4){return db['SmsQueue'][_0x4518('0x55')]({'where':{'id':_0x52fb05[_0x4518('0x4d')]['id']}})[_0x4518('0x2c')](handleEntityNotFound(_0x5765a4,null))[_0x4518('0x2c')](removeEntity(_0x5765a4,null))[_0x4518('0x4b')](handleError(_0x5765a4,null));};exports[_0x4518('0x58')]=function(_0x39d057,_0xb8c163){return db['SmsQueue'][_0x4518('0x58')]()[_0x4518('0x2c')](respondWithResult(_0xb8c163,null))[_0x4518('0x4b')](handleError(_0xb8c163,null));};exports[_0x4518('0x59')]=function(_0x3e8186,_0x323e46,_0xa4edc5){var _0x17fb02={'raw':!![],'where':{}},_0x3878c6={},_0x5adb96;return db[_0x4518('0x48')][_0x4518('0x5a')]({'where':{'id':_0x3e8186[_0x4518('0x4d')]['id']}})['then'](handleEntityNotFound(_0x323e46,null))[_0x4518('0x2c')](function(_0x4d8656){if(_0x4d8656){_0x5adb96=_0x4d8656[_0x4518('0x2d')]({'plain':!![]});_0x3878c6[_0x4518('0x37')]=_['keys'](db['UserSmsQueue']['rawAttributes']);_0x3878c6[_0x4518('0x39')]=_[_0x4518('0x38')](_0x3e8186[_0x4518('0x39')]);_0x3878c6[_0x4518('0x3a')]=_[_0x4518('0x3b')](_0x3878c6[_0x4518('0x37')],_0x3878c6['query']);_0x17fb02[_0x4518('0x3c')]=_[_0x4518('0x3b')](_0x3878c6[_0x4518('0x37')],qs[_0x4518('0x3d')](_0x3e8186[_0x4518('0x39')][_0x4518('0x3d')]));_0x17fb02[_0x4518('0x3c')]=_0x17fb02[_0x4518('0x3c')][_0x4518('0x4e')]?_0x17fb02[_0x4518('0x3c')]:_0x3878c6[_0x4518('0x37')];if(!_0x3e8186['query'][_0x4518('0x3e')](_0x4518('0x5b'))){_0x17fb02[_0x4518('0x22')]=qs['limit'](_0x3e8186[_0x4518('0x39')][_0x4518('0x22')]);_0x17fb02['offset']=qs[_0x4518('0x25')](_0x3e8186['query']['offset']);}_0x17fb02[_0x4518('0x5c')]=qs[_0x4518('0x3f')](_0x3e8186[_0x4518('0x39')][_0x4518('0x3f')]);_0x17fb02[_0x4518('0x40')]=qs[_0x4518('0x3a')](_[_0x4518('0x5d')](_0x3e8186[_0x4518('0x39')],_0x3878c6[_0x4518('0x3a')]));_0x17fb02[_0x4518('0x40')][_0x4518('0x5e')]=_0x4d8656['id'];if(_0x3e8186[_0x4518('0x39')]['filter']){_0x17fb02[_0x4518('0x40')]=_['merge'](_0x17fb02[_0x4518('0x40')],{'$or':_[_0x4518('0x34')](_0x17fb02[_0x4518('0x3c')],function(_0x59e4dd){var _0xd31c29={};_0xd31c29[_0x59e4dd]={'$like':'%'+_0x3e8186[_0x4518('0x39')][_0x4518('0x41')]+'%'};return _0xd31c29;})});}_0x17fb02=_['merge']({},_0x17fb02,_0x3e8186[_0x4518('0x45')]);return db['UserSmsQueue'][_0x4518('0x49')](_0x17fb02);}})[_0x4518('0x2c')](function(_0x2f8e45){if(_0x2f8e45){return db['User'][_0x4518('0x5f')]({'where':{'id':_[_0x4518('0x34')](_0x2f8e45,_0x4518('0x60')),'role':_0x4518('0x61')},'attributes':['id',_0x4518('0x32'),_0x4518('0x62'),'updatedAt','createdAt']});}})[_0x4518('0x2c')](function(_0x213ae7){if(_0x213ae7){return{'count':_0x213ae7['count'],'rows':_[_0x4518('0x34')](_0x213ae7[_0x4518('0x4a')],function(_0x85743a){return{'membername':_0x85743a[_0x4518('0x32')],'UserId':_0x85743a['id'],'queue_name':_0x5adb96[_0x4518('0x32')],'SmsQueueId':_0x5adb96['id'],'interface':util[_0x4518('0x63')](_0x4518('0x64'),_0x4518('0x65'),_0x85743a['name']),'penalty':0x0,'paused':_0x85743a[_0x4518('0x62')],'createdAt':_0x85743a['createdAt'],'updatedAt':_0x85743a[_0x4518('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4518('0x2c')](respondWithFilteredResult(_0x323e46,_0x17fb02))[_0x4518('0x4b')](handleError(_0x323e46,null));};exports[_0x4518('0x67')]=function(_0x5175d3,_0x3209ef,_0x49dc40){var _0x276542={};var _0x2d6f3f={};var _0x3d0717;var _0x16929f;return db[_0x4518('0x48')][_0x4518('0x5a')]({'where':{'id':_0x5175d3[_0x4518('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3209ef,null))[_0x4518('0x2c')](function(_0x15e291){if(_0x15e291){_0x3d0717=_0x15e291;_0x2d6f3f['model']=_['keys'](db[_0x4518('0x68')][_0x4518('0x35')]);_0x2d6f3f[_0x4518('0x39')]=_[_0x4518('0x38')](_0x5175d3[_0x4518('0x39')]);_0x2d6f3f['filters']=_[_0x4518('0x3b')](_0x2d6f3f['model'],_0x2d6f3f['query']);_0x276542[_0x4518('0x3c')]=_[_0x4518('0x3b')](_0x2d6f3f[_0x4518('0x37')],qs[_0x4518('0x3d')](_0x5175d3[_0x4518('0x39')][_0x4518('0x3d')]));_0x276542[_0x4518('0x3c')]=_0x276542[_0x4518('0x3c')]['length']?_0x276542[_0x4518('0x3c')]:_0x2d6f3f[_0x4518('0x37')];_0x276542[_0x4518('0x5c')]=qs['sort'](_0x5175d3[_0x4518('0x39')][_0x4518('0x3f')]);_0x276542[_0x4518('0x40')]=qs[_0x4518('0x3a')](_[_0x4518('0x5d')](_0x5175d3[_0x4518('0x39')],_0x2d6f3f[_0x4518('0x3a')]));if(_0x5175d3[_0x4518('0x39')][_0x4518('0x41')]){_0x276542[_0x4518('0x40')]=_[_0x4518('0x44')](_0x276542[_0x4518('0x40')],{'$or':_[_0x4518('0x34')](_0x276542[_0x4518('0x3c')],function(_0x44b7f5){var _0x20ccaf={};_0x20ccaf[_0x44b7f5]={'$like':'%'+_0x5175d3['query'][_0x4518('0x41')]+'%'};return _0x20ccaf;})});}_0x276542=_['merge']({},_0x276542,_0x5175d3['options']);return _0x3d0717[_0x4518('0x67')](_0x276542);}})[_0x4518('0x2c')](function(_0x3ff86f){if(_0x3ff86f){_0x16929f=_0x3ff86f[_0x4518('0x4e')];if(!_0x5175d3[_0x4518('0x39')]['hasOwnProperty'](_0x4518('0x5b'))){_0x276542[_0x4518('0x22')]=qs[_0x4518('0x22')](_0x5175d3[_0x4518('0x39')]['limit']);_0x276542[_0x4518('0x25')]=qs['offset'](_0x5175d3[_0x4518('0x39')][_0x4518('0x25')]);}return _0x3d0717[_0x4518('0x67')](_0x276542);}})['then'](function(_0x174290){if(_0x174290){return _0x174290?{'count':_0x16929f,'rows':_0x174290}:null;}})['then'](respondWithResult(_0x3209ef,null))['catch'](handleError(_0x3209ef,null));};exports[_0x4518('0x69')]=function(_0x14adca,_0x310447,_0x34579f){var _0x1f585d=_0x14adca[_0x4518('0x57')][_0x4518('0x6a')];return db[_0x4518('0x68')]['findAll']({'where':{'id':_0x1f585d},'attributes':['id'],'include':[{'model':db[_0x4518('0x6b')],'as':_0x4518('0x6c'),'attributes':['id',_0x4518('0x32'),_0x4518('0x6d'),'voicePause','interface'],'raw':!![]}]})[_0x4518('0x2c')](function(_0x442f60){if(_0x442f60){var _0xeb7411=_[_0x4518('0x6e')](_0x442f60,function(_0x29f809){var _0x506499=_0x29f809[_0x4518('0x2d')]({'plain':!![]});return _0x506499[_0x4518('0x6c')];});return db['SmsQueue'][_0x4518('0x55')]({'where':{'id':_0x14adca[_0x4518('0x4d')]['id']}})['then'](function(_0x5ad785){return db[_0x4518('0x6f')][_0x4518('0x70')](function(_0x1ec685){return _0x5ad785[_0x4518('0x69')](_0x1f585d,{'transaction':_0x1ec685})[_0x4518('0x2c')](function(){return BPromise[_0x4518('0x71')](_0xeb7411,function(_0x27d59a){return db[_0x4518('0x72')][_0x4518('0x73')]({'where':{'UserId':_0x27d59a['id'],'SmsQueueId':_0x14adca['params']['id']},'transaction':_0x1ec685});});})[_0x4518('0x2c')](function(){_0xeb7411[_0x4518('0x74')](function(_0x4aac5c){socket[_0x4518('0x75')]('userSmsQueue:save',{'UserId':_0x4aac5c['id'],'SmsQueueId':_0x5ad785['id']});});});});});}})[_0x4518('0x2c')](respondWithStatusCode(_0x310447,null))['catch'](handleError(_0x310447,null));};exports[_0x4518('0x76')]=function(_0x227f09,_0xf3f406,_0x2e606c){return db[_0x4518('0x68')][_0x4518('0x49')]({'where':{'id':_0x227f09['query'][_0x4518('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4518('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xf3f406,null))[_0x4518('0x2c')](function(_0x7b2784){var _0x2bffa1=_['map'](_0x7b2784,'id');var _0x50e461=[];var _0x5dd843=[];var _0x1817d1=squel[_0x4518('0x77')]();_0x1817d1['field']('tq.TeamId')[_0x4518('0x78')](_0x4518('0x79'),'tq')[_0x4518('0x7a')](_0x4518('0x7b'),'ut',_0x4518('0x7c'))[_0x4518('0x40')](_0x4518('0x7d'),_0x227f09[_0x4518('0x4d')]['id']);for(var _0x4b1418=0x0;_0x4b1418<_0x7b2784[_0x4518('0x4e')];_0x4b1418+=0x1){let _0x39101a=_0x7b2784[_0x4b1418];for(var _0x5d5f67=0x0;_0x5d5f67<_0x39101a[_0x4518('0x6c')][_0x4518('0x4e')];_0x5d5f67+=0x1){let _0x507776=_0x39101a[_0x4518('0x6c')][_0x5d5f67];var _0x121737=_0x1817d1[_0x4518('0x7e')]();_0x121737[_0x4518('0x40')](_0x4518('0x7f'),_0x507776['id']);_0x5dd843[_0x4518('0x80')](db[_0x4518('0x6f')]['query'](_0x121737['toString'](),{'type':db[_0x4518('0x6f')][_0x4518('0x81')]['SELECT']})[_0x4518('0x2c')](function(_0x248a8e){if(_0x248a8e[_0x4518('0x4e')]===0x1){return _0x507776['id'];}else{var _0x25d055=_[_0x4518('0x82')](_['map'](_0x248a8e,'TeamId'),function(_0x2995d3){return _[_0x4518('0x83')](_0x2bffa1,_0x2995d3);});if(_0x25d055){return _0x507776['id'];}}}));}}return BPromise['all'](_0x5dd843)[_0x4518('0x2c')](function(_0x131e53){_0x50e461=_(_0x50e461)[_0x4518('0x84')](_0x131e53)[_0x4518('0x85')]()[_0x4518('0x86')]();return db[_0x4518('0x48')][_0x4518('0x55')]({'where':{'id':_0x227f09['params']['id']}})[_0x4518('0x2c')](function(_0x3188c5){return db[_0x4518('0x6f')][_0x4518('0x70')](function(_0x58dd63){return _0x3188c5[_0x4518('0x76')](_0x227f09[_0x4518('0x39')]['ids'],{'transaction':_0x58dd63})[_0x4518('0x2c')](function(){if(!_[_0x4518('0x87')](_0x50e461)){return _0x3188c5[_0x4518('0x88')](_0x50e461,{'transaction':_0x58dd63});}})[_0x4518('0x2c')](function(){_0x50e461['forEach'](function(_0x2abf32){socket[_0x4518('0x75')](_0x4518('0x89'),{'UserId':_0x2abf32,'SmsQueueId':_0x3188c5['id']});});});});});});})[_0x4518('0x2c')](respondWithStatusCode(_0xf3f406,null))[_0x4518('0x4b')](handleError(_0xf3f406,null));};exports[_0x4518('0x8a')]=function(_0x564a5b,_0x2eead0,_0x58849f){return db['SmsQueue'][_0x4518('0x55')]({'where':{'id':_0x564a5b[_0x4518('0x4d')]['id']}})[_0x4518('0x2c')](handleEntityNotFound(_0x2eead0,null))[_0x4518('0x2c')](function(_0x3ac8ef){if(_0x3ac8ef){return _0x3ac8ef[_0x4518('0x8a')](_0x564a5b[_0x4518('0x57')]['ids'],_[_0x4518('0x8b')](_0x564a5b['body'],[_0x4518('0x6a'),'id'])||{})[_0x4518('0x8c')](function(_0x494bf3){for(var _0x15c29d=0x0;_0x15c29d<_0x564a5b[_0x4518('0x57')][_0x4518('0x6a')]['length'];_0x15c29d+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x564a5b[_0x4518('0x57')]['ids'][_0x15c29d]),'SmsQueueId':Number(_0x564a5b[_0x4518('0x4d')]['id'])});}return _0x494bf3;});}})['then'](respondWithResult(_0x2eead0,null))[_0x4518('0x4b')](handleError(_0x2eead0,null));};exports[_0x4518('0x88')]=function(_0x4b56bd,_0x469a95,_0x2b3c85){return db['SmsQueue'][_0x4518('0x55')]({'where':{'id':_0x4b56bd[_0x4518('0x4d')]['id']}})['then'](handleEntityNotFound(_0x469a95,null))[_0x4518('0x2c')](function(_0x122306){if(_0x122306){return _0x122306['removeAgents'](_0x4b56bd[_0x4518('0x39')]['ids'])[_0x4518('0x2c')](function(){if(_[_0x4518('0x8d')](_0x4b56bd['query'][_0x4518('0x6a')])){for(var _0x3f4cae=0x0;_0x3f4cae<_0x4b56bd[_0x4518('0x39')][_0x4518('0x6a')][_0x4518('0x4e')];_0x3f4cae+=0x1){socket[_0x4518('0x75')](_0x4518('0x89'),{'UserId':Number(_0x4b56bd[_0x4518('0x39')][_0x4518('0x6a')][_0x3f4cae]),'SmsQueueId':Number(_0x4b56bd[_0x4518('0x4d')]['id'])});}}else{socket[_0x4518('0x75')](_0x4518('0x89'),{'UserId':Number(_0x4b56bd[_0x4518('0x39')][_0x4518('0x6a')]),'SmsQueueId':Number(_0x4b56bd[_0x4518('0x4d')]['id'])});}});}})[_0x4518('0x2c')](respondWithStatusCode(_0x469a95,null))[_0x4518('0x4b')](handleError(_0x469a95,null));};exports[_0x4518('0x8e')]=function(_0x1da9df,_0x3530c3,_0x4baaa1){var _0x5cab5c={};var _0x1afc31={};var _0x161387;var _0xde2395;return db['SmsQueue'][_0x4518('0x5a')]({'where':{'id':_0x1da9df['params']['id']}})[_0x4518('0x2c')](handleEntityNotFound(_0x3530c3,null))[_0x4518('0x2c')](function(_0x3b9e5d){if(_0x3b9e5d){_0x161387=_0x3b9e5d;_0x1afc31[_0x4518('0x37')]=_['keys'](db[_0x4518('0x6b')][_0x4518('0x35')]);_0x1afc31[_0x4518('0x39')]=_[_0x4518('0x38')](_0x1da9df['query']);_0x1afc31[_0x4518('0x3a')]=_[_0x4518('0x3b')](_0x1afc31[_0x4518('0x37')],_0x1afc31[_0x4518('0x39')]);_0x5cab5c[_0x4518('0x3c')]=_['intersection'](_0x1afc31['model'],qs[_0x4518('0x3d')](_0x1da9df['query']['fields']));_0x5cab5c[_0x4518('0x3c')]=_0x5cab5c[_0x4518('0x3c')][_0x4518('0x4e')]?_0x5cab5c[_0x4518('0x3c')]:_0x1afc31[_0x4518('0x37')];_0x5cab5c[_0x4518('0x5c')]=qs['sort'](_0x1da9df[_0x4518('0x39')][_0x4518('0x3f')]);_0x5cab5c[_0x4518('0x40')]=qs[_0x4518('0x3a')](_[_0x4518('0x5d')](_0x1da9df[_0x4518('0x39')],_0x1afc31[_0x4518('0x3a')]));if(_0x1da9df['query']['filter']){_0x5cab5c[_0x4518('0x40')]=_[_0x4518('0x44')](_0x5cab5c['where'],{'$or':_[_0x4518('0x34')](_0x5cab5c[_0x4518('0x3c')],function(_0x3643cf){var _0x305fb2={};_0x305fb2[_0x3643cf]={'$like':'%'+_0x1da9df[_0x4518('0x39')][_0x4518('0x41')]+'%'};return _0x305fb2;})});}_0x5cab5c=_[_0x4518('0x44')]({},_0x5cab5c,_0x1da9df[_0x4518('0x45')]);return _0x161387[_0x4518('0x8e')](_0x5cab5c);}})['then'](function(_0x35eb05){if(_0x35eb05){_0xde2395=_0x35eb05[_0x4518('0x4e')];if(!_0x1da9df[_0x4518('0x39')]['hasOwnProperty'](_0x4518('0x5b'))){_0x5cab5c['limit']=qs[_0x4518('0x22')](_0x1da9df[_0x4518('0x39')][_0x4518('0x22')]);_0x5cab5c[_0x4518('0x25')]=qs['offset'](_0x1da9df[_0x4518('0x39')][_0x4518('0x25')]);}return _0x161387[_0x4518('0x8e')](_0x5cab5c);}})[_0x4518('0x2c')](function(_0x1dc10d){if(_0x1dc10d){return _0x1dc10d?{'count':_0xde2395,'rows':_0x1dc10d}:null;}})[_0x4518('0x2c')](respondWithResult(_0x3530c3,null))[_0x4518('0x4b')](handleError(_0x3530c3,null));}; \ No newline at end of file +var _0x087a=['interface','flatMap','find','sequelize','transaction','each','emit','removeTeams','ids','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','union','compact','value','removeAgents','forEach','userSmsQueue:remove','addAgents','spread','userSmsQueue:save','isArray','getAgents','eml-format','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./smsQueue.socket','sendStatus','status','end','json','limit','count','offset','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','show','params','rawAttributes','include','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getMembers','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','Team','Agents','online'];(function(_0xb5719a,_0x37546e){var _0x14dcfb=function(_0x229e72){while(--_0x229e72){_0xb5719a['push'](_0xb5719a['shift']());}};_0x14dcfb(++_0x37546e);}(_0x087a,0x1b0));var _0xa087=function(_0x2edcfd,_0x5e8fe2){_0x2edcfd=_0x2edcfd-0x0;var _0x1c0d60=_0x087a[_0x2edcfd];return _0x1c0d60;};'use strict';var emlformat=require(_0xa087('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa087('0x1'));var rp=require(_0xa087('0x2'));var moment=require('moment');var BPromise=require(_0xa087('0x3'));var Mustache=require('mustache');var util=require(_0xa087('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa087('0x5'));var ejs=require(_0xa087('0x6'));var fs=require('fs');var fs_extra=require(_0xa087('0x7'));var _=require('lodash');var squel=require(_0xa087('0x8'));var crypto=require(_0xa087('0x9'));var jsforce=require(_0xa087('0xa'));var deskjs=require(_0xa087('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa087('0xc'));var Redis=require(_0xa087('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa087('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa087('0xf'));var logger=require(_0xa087('0x10'))(_0xa087('0x11'));var utils=require(_0xa087('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa087('0x13'));var db=require('../../mysqldb')['db'];config[_0xa087('0x14')]=_[_0xa087('0x15')](config[_0xa087('0x14')],{'host':_0xa087('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa087('0x14')]));require(_0xa087('0x17'))['register'](socket);function respondWithStatusCode(_0x2fab5b,_0x13cf01){_0x13cf01=_0x13cf01||0xcc;return function(_0x15414b){if(_0x15414b){return _0x2fab5b[_0xa087('0x18')](_0x13cf01);}return _0x2fab5b[_0xa087('0x19')](_0x13cf01)[_0xa087('0x1a')]();};}function respondWithResult(_0x55d260,_0x21501e){_0x21501e=_0x21501e||0xc8;return function(_0x3e306f){if(_0x3e306f){return _0x55d260[_0xa087('0x19')](_0x21501e)[_0xa087('0x1b')](_0x3e306f);}};}function respondWithFilteredResult(_0xa12904,_0x3c9272){return function(_0xdd396b){if(_0xdd396b){var _0x42be71=typeof _0x3c9272['offset']==='undefined'&&typeof _0x3c9272[_0xa087('0x1c')]==='undefined';var _0x1cd240=_0xdd396b[_0xa087('0x1d')];var _0x1ce21f=_0x42be71?0x0:_0x3c9272[_0xa087('0x1e')];var _0x308f20=_0x42be71?_0xdd396b[_0xa087('0x1d')]:_0x3c9272[_0xa087('0x1e')]+_0x3c9272['limit'];var _0x442825;if(_0x308f20>=_0x1cd240){_0x308f20=_0x1cd240;_0x442825=0xc8;}else{_0x442825=0xce;}_0xa12904[_0xa087('0x19')](_0x442825);return _0xa12904['set']('Content-Range',_0x1ce21f+'-'+_0x308f20+'/'+_0x1cd240)[_0xa087('0x1b')](_0xdd396b);}return null;};}function patchUpdates(_0x5e0b95){return function(_0x311831){try{jsonpatch[_0xa087('0x1f')](_0x311831,_0x5e0b95,!![]);}catch(_0x20df58){return BPromise[_0xa087('0x20')](_0x20df58);}return _0x311831[_0xa087('0x21')]();};}function saveUpdates(_0x17aee7,_0x41fbd0){return function(_0x3d2c70){if(_0x3d2c70){return _0x3d2c70[_0xa087('0x22')](_0x17aee7)[_0xa087('0x23')](function(_0xa4ae00){return _0xa4ae00;});}return null;};}function removeEntity(_0x3d3a8f,_0x3cd376){return function(_0x5c2339){if(_0x5c2339){return _0x5c2339[_0xa087('0x24')]()['then'](function(){var _0x109c13=_0x5c2339[_0xa087('0x25')]({'plain':!![]});var _0x3541d0=_0xa087('0x26');return db[_0xa087('0x27')]['destroy']({'where':{'type':_0x3541d0,'resourceId':_0x109c13['id']}})[_0xa087('0x23')](function(){return _0x5c2339;});})[_0xa087('0x23')](function(){_0x3d3a8f[_0xa087('0x19')](0xcc)[_0xa087('0x1a')]();});}};}function handleEntityNotFound(_0x2d9738,_0x5a3c04){return function(_0x3006ee){if(!_0x3006ee){_0x2d9738[_0xa087('0x18')](0x194);}return _0x3006ee;};}function handleError(_0x4c2063,_0x179acb){_0x179acb=_0x179acb||0x1f4;return function(_0x5f9388){logger[_0xa087('0x28')](_0x5f9388[_0xa087('0x29')]);if(_0x5f9388[_0xa087('0x2a')]){delete _0x5f9388['name'];}_0x4c2063[_0xa087('0x19')](_0x179acb)[_0xa087('0x2b')](_0x5f9388);};}exports[_0xa087('0x2c')]=function(_0x10a0e2,_0x55924d){var _0x230ab3={},_0x47f825={},_0x439dc5={'count':0x0,'rows':[]};var _0x1879c1=_[_0xa087('0x2d')](db[_0xa087('0x2e')]['rawAttributes'],function(_0x29d0dc){return{'name':_0x29d0dc[_0xa087('0x2f')],'type':_0x29d0dc['type']['key']};});_0x47f825['model']=_[_0xa087('0x2d')](_0x1879c1,_0xa087('0x2a'));_0x47f825[_0xa087('0x30')]=_[_0xa087('0x31')](_0x10a0e2[_0xa087('0x30')]);_0x47f825['filters']=_[_0xa087('0x32')](_0x47f825[_0xa087('0x33')],_0x47f825['query']);_0x230ab3[_0xa087('0x34')]=_['intersection'](_0x47f825[_0xa087('0x33')],qs[_0xa087('0x35')](_0x10a0e2[_0xa087('0x30')][_0xa087('0x35')]));_0x230ab3[_0xa087('0x34')]=_0x230ab3['attributes'][_0xa087('0x36')]?_0x230ab3[_0xa087('0x34')]:_0x47f825[_0xa087('0x33')];if(!_0x10a0e2[_0xa087('0x30')][_0xa087('0x37')](_0xa087('0x38'))){_0x230ab3[_0xa087('0x1c')]=qs['limit'](_0x10a0e2[_0xa087('0x30')][_0xa087('0x1c')]);_0x230ab3[_0xa087('0x1e')]=qs['offset'](_0x10a0e2['query'][_0xa087('0x1e')]);}_0x230ab3['order']=qs[_0xa087('0x39')](_0x10a0e2[_0xa087('0x30')][_0xa087('0x39')]);_0x230ab3['where']=qs[_0xa087('0x3a')](_[_0xa087('0x3b')](_0x10a0e2['query'],_0x47f825[_0xa087('0x3a')]),_0x1879c1);if(_0x10a0e2['query']['filter']){_0x230ab3[_0xa087('0x3c')]=_[_0xa087('0x3d')](_0x230ab3[_0xa087('0x3c')],{'$or':_[_0xa087('0x2d')](_0x1879c1,function(_0x2adfd2){if(_0x2adfd2[_0xa087('0x3e')]!==_0xa087('0x3f')){var _0x2ea242={};_0x2ea242[_0x2adfd2['name']]={'$like':'%'+_0x10a0e2[_0xa087('0x30')][_0xa087('0x40')]+'%'};return _0x2ea242;}})});}_0x230ab3=_[_0xa087('0x3d')]({},_0x230ab3,_0x10a0e2['options']);var _0x48e3c0={'where':_0x230ab3[_0xa087('0x3c')]};return db[_0xa087('0x2e')][_0xa087('0x1d')](_0x48e3c0)[_0xa087('0x23')](function(_0x5840e9){_0x439dc5[_0xa087('0x1d')]=_0x5840e9;if(_0x10a0e2[_0xa087('0x30')][_0xa087('0x41')]){_0x230ab3['include']=[{'all':!![]}];}return db[_0xa087('0x2e')][_0xa087('0x42')](_0x230ab3);})[_0xa087('0x23')](function(_0x47ba5c){_0x439dc5[_0xa087('0x43')]=_0x47ba5c;return _0x439dc5;})[_0xa087('0x23')](respondWithFilteredResult(_0x55924d,_0x230ab3))['catch'](handleError(_0x55924d,null));};exports[_0xa087('0x44')]=function(_0x23fd68,_0x4803db){var _0x31c5ff={'raw':!![],'where':{'id':_0x23fd68[_0xa087('0x45')]['id']}},_0x3c2f47={};_0x3c2f47[_0xa087('0x33')]=_[_0xa087('0x31')](db[_0xa087('0x2e')][_0xa087('0x46')]);_0x3c2f47[_0xa087('0x30')]=_[_0xa087('0x31')](_0x23fd68[_0xa087('0x30')]);_0x3c2f47[_0xa087('0x3a')]=_['intersection'](_0x3c2f47[_0xa087('0x33')],_0x3c2f47[_0xa087('0x30')]);_0x31c5ff['attributes']=_['intersection'](_0x3c2f47[_0xa087('0x33')],qs['fields'](_0x23fd68[_0xa087('0x30')]['fields']));_0x31c5ff[_0xa087('0x34')]=_0x31c5ff['attributes'][_0xa087('0x36')]?_0x31c5ff[_0xa087('0x34')]:_0x3c2f47[_0xa087('0x33')];if(_0x23fd68['query'][_0xa087('0x41')]){_0x31c5ff[_0xa087('0x47')]=[{'all':!![]}];}_0x31c5ff=_[_0xa087('0x3d')]({},_0x31c5ff,_0x23fd68[_0xa087('0x48')]);return db[_0xa087('0x2e')]['find'](_0x31c5ff)['then'](handleEntityNotFound(_0x4803db,null))[_0xa087('0x23')](respondWithResult(_0x4803db,null))[_0xa087('0x49')](handleError(_0x4803db,null));};exports[_0xa087('0x4a')]=function(_0x3a32d4,_0x34748a){return db[_0xa087('0x2e')][_0xa087('0x4a')](_0x3a32d4[_0xa087('0x4b')],{})[_0xa087('0x23')](function(_0x1509af){var _0x1f3f61=_0x3a32d4[_0xa087('0x4c')][_0xa087('0x25')]({'plain':!![]});if(!_0x1f3f61)throw new Error(_0xa087('0x4d'));if(_0x1f3f61['role']===_0xa087('0x4c')){var _0x1ef4bb=_0x1509af[_0xa087('0x25')]({'plain':!![]});var _0x5eac82=_0xa087('0x26');return db[_0xa087('0x4e')]['find']({'where':{'name':_0x5eac82,'userProfileId':_0x1f3f61[_0xa087('0x4f')]},'raw':!![]})['then'](function(_0x3e06d5){if(_0x3e06d5&&_0x3e06d5[_0xa087('0x50')]===0x0){return db['UserProfileResource'][_0xa087('0x4a')]({'name':_0x1ef4bb[_0xa087('0x2a')],'resourceId':_0x1ef4bb['id'],'type':_0x3e06d5[_0xa087('0x2a')],'sectionId':_0x3e06d5['id']},{})[_0xa087('0x23')](function(){return _0x1509af;});}else{return _0x1509af;}})[_0xa087('0x49')](function(_0x8c2ff8){logger[_0xa087('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8c2ff8);throw _0x8c2ff8;});}return _0x1509af;})[_0xa087('0x23')](respondWithResult(_0x34748a,0xc9))[_0xa087('0x49')](handleError(_0x34748a,null));};exports[_0xa087('0x22')]=function(_0x18b892,_0x3bfb70){if(_0x18b892[_0xa087('0x4b')]['id']){delete _0x18b892['body']['id'];}return db[_0xa087('0x2e')]['find']({'where':{'id':_0x18b892[_0xa087('0x45')]['id']}})[_0xa087('0x23')](handleEntityNotFound(_0x3bfb70,null))[_0xa087('0x23')](saveUpdates(_0x18b892[_0xa087('0x4b')],null))['then'](respondWithResult(_0x3bfb70,null))[_0xa087('0x49')](handleError(_0x3bfb70,null));};exports['destroy']=function(_0x59650e,_0x264d1b){return db[_0xa087('0x2e')]['find']({'where':{'id':_0x59650e['params']['id']}})['then'](handleEntityNotFound(_0x264d1b,null))[_0xa087('0x23')](removeEntity(_0x264d1b,null))['catch'](handleError(_0x264d1b,null));};exports['describe']=function(_0x2300ff,_0x21e7e5){return db[_0xa087('0x2e')]['describe']()[_0xa087('0x23')](respondWithResult(_0x21e7e5,null))[_0xa087('0x49')](handleError(_0x21e7e5,null));};exports[_0xa087('0x51')]=function(_0x147647,_0x2e24d,_0x594a91){var _0x3020b9={'raw':!![],'where':{}},_0x183574={},_0x8a08ad;return db[_0xa087('0x2e')][_0xa087('0x52')]({'where':{'id':_0x147647[_0xa087('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e24d,null))[_0xa087('0x23')](function(_0x327fcf){if(_0x327fcf){_0x8a08ad=_0x327fcf['get']({'plain':!![]});_0x183574[_0xa087('0x33')]=_[_0xa087('0x31')](db[_0xa087('0x53')][_0xa087('0x46')]);_0x183574[_0xa087('0x30')]=_[_0xa087('0x31')](_0x147647[_0xa087('0x30')]);_0x183574[_0xa087('0x3a')]=_[_0xa087('0x32')](_0x183574[_0xa087('0x33')],_0x183574[_0xa087('0x30')]);_0x3020b9[_0xa087('0x34')]=_[_0xa087('0x32')](_0x183574['model'],qs[_0xa087('0x35')](_0x147647[_0xa087('0x30')]['fields']));_0x3020b9[_0xa087('0x34')]=_0x3020b9['attributes'][_0xa087('0x36')]?_0x3020b9[_0xa087('0x34')]:_0x183574[_0xa087('0x33')];if(!_0x147647[_0xa087('0x30')][_0xa087('0x37')](_0xa087('0x38'))){_0x3020b9[_0xa087('0x1c')]=qs[_0xa087('0x1c')](_0x147647[_0xa087('0x30')][_0xa087('0x1c')]);_0x3020b9[_0xa087('0x1e')]=qs[_0xa087('0x1e')](_0x147647['query']['offset']);}_0x3020b9[_0xa087('0x54')]=qs[_0xa087('0x39')](_0x147647[_0xa087('0x30')][_0xa087('0x39')]);_0x3020b9[_0xa087('0x3c')]=qs[_0xa087('0x3a')](_[_0xa087('0x3b')](_0x147647[_0xa087('0x30')],_0x183574['filters']));_0x3020b9[_0xa087('0x3c')][_0xa087('0x55')]=_0x327fcf['id'];if(_0x147647[_0xa087('0x30')][_0xa087('0x40')]){_0x3020b9[_0xa087('0x3c')]=_['merge'](_0x3020b9[_0xa087('0x3c')],{'$or':_[_0xa087('0x2d')](_0x3020b9['attributes'],function(_0x5a4d4f){var _0x2be85d={};_0x2be85d[_0x5a4d4f]={'$like':'%'+_0x147647[_0xa087('0x30')][_0xa087('0x40')]+'%'};return _0x2be85d;})});}_0x3020b9=_['merge']({},_0x3020b9,_0x147647[_0xa087('0x48')]);return db[_0xa087('0x53')][_0xa087('0x42')](_0x3020b9);}})[_0xa087('0x23')](function(_0x14e4ed){if(_0x14e4ed){return db[_0xa087('0x56')][_0xa087('0x57')]({'where':{'id':_[_0xa087('0x2d')](_0x14e4ed,'UserId'),'role':_0xa087('0x58')},'attributes':['id','name',_0xa087('0x59'),'updatedAt',_0xa087('0x5a')]});}})[_0xa087('0x23')](function(_0xeb3119){if(_0xeb3119){return{'count':_0xeb3119[_0xa087('0x1d')],'rows':_[_0xa087('0x2d')](_0xeb3119[_0xa087('0x43')],function(_0x43bd0a){return{'membername':_0x43bd0a['name'],'UserId':_0x43bd0a['id'],'queue_name':_0x8a08ad['name'],'SmsQueueId':_0x8a08ad['id'],'interface':util[_0xa087('0x5b')](_0xa087('0x5c'),_0xa087('0x5d'),_0x43bd0a[_0xa087('0x2a')]),'penalty':0x0,'paused':_0x43bd0a[_0xa087('0x59')],'createdAt':_0x43bd0a[_0xa087('0x5a')],'updatedAt':_0x43bd0a[_0xa087('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa087('0x23')](respondWithFilteredResult(_0x2e24d,_0x3020b9))[_0xa087('0x49')](handleError(_0x2e24d,null));};exports[_0xa087('0x5f')]=function(_0x5ee541,_0x48b214,_0x5782da){var _0x59a21b={};var _0x5751d0={};var _0x142f12;var _0x14ffad;return db['SmsQueue']['findOne']({'where':{'id':_0x5ee541[_0xa087('0x45')]['id']}})[_0xa087('0x23')](handleEntityNotFound(_0x48b214,null))[_0xa087('0x23')](function(_0x11d3e7){if(_0x11d3e7){_0x142f12=_0x11d3e7;_0x5751d0[_0xa087('0x33')]=_[_0xa087('0x31')](db['Team'][_0xa087('0x46')]);_0x5751d0[_0xa087('0x30')]=_[_0xa087('0x31')](_0x5ee541['query']);_0x5751d0['filters']=_[_0xa087('0x32')](_0x5751d0[_0xa087('0x33')],_0x5751d0['query']);_0x59a21b[_0xa087('0x34')]=_[_0xa087('0x32')](_0x5751d0[_0xa087('0x33')],qs[_0xa087('0x35')](_0x5ee541[_0xa087('0x30')][_0xa087('0x35')]));_0x59a21b[_0xa087('0x34')]=_0x59a21b[_0xa087('0x34')][_0xa087('0x36')]?_0x59a21b[_0xa087('0x34')]:_0x5751d0['model'];_0x59a21b['order']=qs[_0xa087('0x39')](_0x5ee541[_0xa087('0x30')][_0xa087('0x39')]);_0x59a21b[_0xa087('0x3c')]=qs[_0xa087('0x3a')](_[_0xa087('0x3b')](_0x5ee541[_0xa087('0x30')],_0x5751d0[_0xa087('0x3a')]));if(_0x5ee541['query'][_0xa087('0x40')]){_0x59a21b[_0xa087('0x3c')]=_[_0xa087('0x3d')](_0x59a21b[_0xa087('0x3c')],{'$or':_[_0xa087('0x2d')](_0x59a21b[_0xa087('0x34')],function(_0x1ab875){var _0x4f8671={};_0x4f8671[_0x1ab875]={'$like':'%'+_0x5ee541[_0xa087('0x30')][_0xa087('0x40')]+'%'};return _0x4f8671;})});}_0x59a21b=_[_0xa087('0x3d')]({},_0x59a21b,_0x5ee541[_0xa087('0x48')]);return _0x142f12[_0xa087('0x5f')](_0x59a21b);}})[_0xa087('0x23')](function(_0x5ca808){if(_0x5ca808){_0x14ffad=_0x5ca808['length'];if(!_0x5ee541[_0xa087('0x30')][_0xa087('0x37')]('nolimit')){_0x59a21b[_0xa087('0x1c')]=qs[_0xa087('0x1c')](_0x5ee541[_0xa087('0x30')][_0xa087('0x1c')]);_0x59a21b[_0xa087('0x1e')]=qs[_0xa087('0x1e')](_0x5ee541[_0xa087('0x30')][_0xa087('0x1e')]);}return _0x142f12[_0xa087('0x5f')](_0x59a21b);}})['then'](function(_0x3423d7){if(_0x3423d7){return _0x3423d7?{'count':_0x14ffad,'rows':_0x3423d7}:null;}})[_0xa087('0x23')](respondWithResult(_0x48b214,null))[_0xa087('0x49')](handleError(_0x48b214,null));};exports[_0xa087('0x60')]=function(_0x54954f,_0x4b43c8,_0x273dfa){var _0x786ff6=_0x54954f[_0xa087('0x4b')]['ids'];return db[_0xa087('0x61')][_0xa087('0x42')]({'where':{'id':_0x786ff6},'attributes':['id'],'include':[{'model':db[_0xa087('0x56')],'as':_0xa087('0x62'),'attributes':['id','name',_0xa087('0x63'),'voicePause',_0xa087('0x64')],'raw':!![]}]})['then'](function(_0x35765c){if(_0x35765c){var _0x1203eb=_[_0xa087('0x65')](_0x35765c,function(_0x14043c){var _0x5b2250=_0x14043c['get']({'plain':!![]});return _0x5b2250[_0xa087('0x62')];});return db[_0xa087('0x2e')][_0xa087('0x66')]({'where':{'id':_0x54954f[_0xa087('0x45')]['id']}})[_0xa087('0x23')](function(_0x1e7b5b){return db[_0xa087('0x67')][_0xa087('0x68')](function(_0x539ff3){return _0x1e7b5b[_0xa087('0x60')](_0x786ff6,{'transaction':_0x539ff3})['then'](function(){return BPromise[_0xa087('0x69')](_0x1203eb,function(_0x13f289){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x13f289['id'],'SmsQueueId':_0x54954f[_0xa087('0x45')]['id']},'transaction':_0x539ff3});});})[_0xa087('0x23')](function(){_0x1203eb['forEach'](function(_0x20689b){socket[_0xa087('0x6a')]('userSmsQueue:save',{'UserId':_0x20689b['id'],'SmsQueueId':_0x1e7b5b['id']});});});});});}})[_0xa087('0x23')](respondWithStatusCode(_0x4b43c8,null))['catch'](handleError(_0x4b43c8,null));};exports[_0xa087('0x6b')]=function(_0x14c980,_0x46b9cf,_0xecb17a){return db[_0xa087('0x61')][_0xa087('0x42')]({'where':{'id':_0x14c980['query'][_0xa087('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xa087('0x56')],'as':_0xa087('0x62'),'attributes':['id'],'raw':!![]}]})[_0xa087('0x23')](handleEntityNotFound(_0x46b9cf,null))[_0xa087('0x23')](function(_0x566e4b){var _0x40c4c3=_[_0xa087('0x2d')](_0x566e4b,'id');var _0x53fd28=[];var _0x4dcb21=[];var _0x4dacb6=squel[_0xa087('0x6d')]();_0x4dacb6[_0xa087('0x6e')]('tq.TeamId')[_0xa087('0x6f')](_0xa087('0x70'),'tq')[_0xa087('0x71')](_0xa087('0x72'),'ut',_0xa087('0x73'))[_0xa087('0x3c')]('SmsQueueId\x20=\x20?',_0x14c980[_0xa087('0x45')]['id']);for(var _0x3c0547=0x0;_0x3c0547<_0x566e4b[_0xa087('0x36')];_0x3c0547+=0x1){let _0x41067b=_0x566e4b[_0x3c0547];for(var _0x90b604=0x0;_0x90b604<_0x41067b[_0xa087('0x62')][_0xa087('0x36')];_0x90b604+=0x1){let _0x261397=_0x41067b[_0xa087('0x62')][_0x90b604];var _0x378520=_0x4dacb6['clone']();_0x378520[_0xa087('0x3c')](_0xa087('0x74'),_0x261397['id']);_0x4dcb21['push'](db[_0xa087('0x67')][_0xa087('0x30')](_0x378520[_0xa087('0x75')](),{'type':db[_0xa087('0x67')][_0xa087('0x76')][_0xa087('0x77')]})['then'](function(_0x3be670){if(_0x3be670[_0xa087('0x36')]===0x1){return _0x261397['id'];}else{var _0xedc38d=_[_0xa087('0x78')](_[_0xa087('0x2d')](_0x3be670,'TeamId'),function(_0x52e40a){return _[_0xa087('0x79')](_0x40c4c3,_0x52e40a);});if(_0xedc38d){return _0x261397['id'];}}}));}}return BPromise['all'](_0x4dcb21)[_0xa087('0x23')](function(_0x1b59d7){_0x53fd28=_(_0x53fd28)[_0xa087('0x7a')](_0x1b59d7)[_0xa087('0x7b')]()[_0xa087('0x7c')]();return db[_0xa087('0x2e')][_0xa087('0x66')]({'where':{'id':_0x14c980[_0xa087('0x45')]['id']}})[_0xa087('0x23')](function(_0x4a71eb){return db[_0xa087('0x67')][_0xa087('0x68')](function(_0x3f9ed6){return _0x4a71eb[_0xa087('0x6b')](_0x14c980[_0xa087('0x30')][_0xa087('0x6c')],{'transaction':_0x3f9ed6})[_0xa087('0x23')](function(){if(!_['isEmpty'](_0x53fd28)){return _0x4a71eb[_0xa087('0x7d')](_0x53fd28,{'transaction':_0x3f9ed6});}})['then'](function(){_0x53fd28[_0xa087('0x7e')](function(_0x548326){socket[_0xa087('0x6a')](_0xa087('0x7f'),{'UserId':_0x548326,'SmsQueueId':_0x4a71eb['id']});});});});});});})[_0xa087('0x23')](respondWithStatusCode(_0x46b9cf,null))[_0xa087('0x49')](handleError(_0x46b9cf,null));};exports[_0xa087('0x80')]=function(_0x3b931c,_0xb378df,_0x821922){return db[_0xa087('0x2e')][_0xa087('0x66')]({'where':{'id':_0x3b931c[_0xa087('0x45')]['id']}})['then'](handleEntityNotFound(_0xb378df,null))[_0xa087('0x23')](function(_0x4a8694){if(_0x4a8694){return _0x4a8694[_0xa087('0x80')](_0x3b931c[_0xa087('0x4b')][_0xa087('0x6c')],_['omit'](_0x3b931c[_0xa087('0x4b')],[_0xa087('0x6c'),'id'])||{})[_0xa087('0x81')](function(_0x2b603b){for(var _0x4ec3bf=0x0;_0x4ec3bf<_0x3b931c[_0xa087('0x4b')][_0xa087('0x6c')][_0xa087('0x36')];_0x4ec3bf+=0x1){socket[_0xa087('0x6a')](_0xa087('0x82'),{'UserId':Number(_0x3b931c[_0xa087('0x4b')][_0xa087('0x6c')][_0x4ec3bf]),'SmsQueueId':Number(_0x3b931c[_0xa087('0x45')]['id'])});}return _0x2b603b;});}})[_0xa087('0x23')](respondWithResult(_0xb378df,null))[_0xa087('0x49')](handleError(_0xb378df,null));};exports['removeAgents']=function(_0x5518ae,_0x1eafe3,_0x33f0a9){return db[_0xa087('0x2e')][_0xa087('0x66')]({'where':{'id':_0x5518ae[_0xa087('0x45')]['id']}})[_0xa087('0x23')](handleEntityNotFound(_0x1eafe3,null))[_0xa087('0x23')](function(_0x18521d){if(_0x18521d){return _0x18521d[_0xa087('0x7d')](_0x5518ae['query'][_0xa087('0x6c')])['then'](function(){if(_[_0xa087('0x83')](_0x5518ae[_0xa087('0x30')][_0xa087('0x6c')])){for(var _0xb62ff0=0x0;_0xb62ff0<_0x5518ae[_0xa087('0x30')][_0xa087('0x6c')]['length'];_0xb62ff0+=0x1){socket[_0xa087('0x6a')](_0xa087('0x7f'),{'UserId':Number(_0x5518ae[_0xa087('0x30')][_0xa087('0x6c')][_0xb62ff0]),'SmsQueueId':Number(_0x5518ae['params']['id'])});}}else{socket[_0xa087('0x6a')](_0xa087('0x7f'),{'UserId':Number(_0x5518ae[_0xa087('0x30')][_0xa087('0x6c')]),'SmsQueueId':Number(_0x5518ae['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1eafe3,null))[_0xa087('0x49')](handleError(_0x1eafe3,null));};exports['getAgents']=function(_0x5ede6d,_0x4978cc,_0x4d9b66){var _0x1ddd49={};var _0x34950d={};var _0x1c64f3;var _0x254e1f;return db[_0xa087('0x2e')][_0xa087('0x52')]({'where':{'id':_0x5ede6d['params']['id']}})[_0xa087('0x23')](handleEntityNotFound(_0x4978cc,null))[_0xa087('0x23')](function(_0x2122b9){if(_0x2122b9){_0x1c64f3=_0x2122b9;_0x34950d[_0xa087('0x33')]=_[_0xa087('0x31')](db[_0xa087('0x56')][_0xa087('0x46')]);_0x34950d[_0xa087('0x30')]=_[_0xa087('0x31')](_0x5ede6d[_0xa087('0x30')]);_0x34950d[_0xa087('0x3a')]=_['intersection'](_0x34950d[_0xa087('0x33')],_0x34950d[_0xa087('0x30')]);_0x1ddd49['attributes']=_[_0xa087('0x32')](_0x34950d[_0xa087('0x33')],qs[_0xa087('0x35')](_0x5ede6d[_0xa087('0x30')][_0xa087('0x35')]));_0x1ddd49[_0xa087('0x34')]=_0x1ddd49[_0xa087('0x34')]['length']?_0x1ddd49[_0xa087('0x34')]:_0x34950d[_0xa087('0x33')];_0x1ddd49['order']=qs[_0xa087('0x39')](_0x5ede6d[_0xa087('0x30')]['sort']);_0x1ddd49[_0xa087('0x3c')]=qs[_0xa087('0x3a')](_['pick'](_0x5ede6d['query'],_0x34950d['filters']));if(_0x5ede6d[_0xa087('0x30')][_0xa087('0x40')]){_0x1ddd49[_0xa087('0x3c')]=_[_0xa087('0x3d')](_0x1ddd49[_0xa087('0x3c')],{'$or':_[_0xa087('0x2d')](_0x1ddd49['attributes'],function(_0x2493c0){var _0x80b0bd={};_0x80b0bd[_0x2493c0]={'$like':'%'+_0x5ede6d[_0xa087('0x30')][_0xa087('0x40')]+'%'};return _0x80b0bd;})});}_0x1ddd49=_['merge']({},_0x1ddd49,_0x5ede6d[_0xa087('0x48')]);return _0x1c64f3[_0xa087('0x84')](_0x1ddd49);}})[_0xa087('0x23')](function(_0x3dc4d8){if(_0x3dc4d8){_0x254e1f=_0x3dc4d8[_0xa087('0x36')];if(!_0x5ede6d[_0xa087('0x30')][_0xa087('0x37')](_0xa087('0x38'))){_0x1ddd49['limit']=qs[_0xa087('0x1c')](_0x5ede6d['query'][_0xa087('0x1c')]);_0x1ddd49['offset']=qs[_0xa087('0x1e')](_0x5ede6d['query'][_0xa087('0x1e')]);}return _0x1c64f3[_0xa087('0x84')](_0x1ddd49);}})[_0xa087('0x23')](function(_0x57551a){if(_0x57551a){return _0x57551a?{'count':_0x254e1f,'rows':_0x57551a}:null;}})[_0xa087('0x23')](respondWithResult(_0x4978cc,null))[_0xa087('0x49')](handleError(_0x4978cc,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index c6a20be..8b4e86d 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 _0x46a0=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x395b64,_0x57fd24){var _0x492804=function(_0x16ccb1){while(--_0x16ccb1){_0x395b64['push'](_0x395b64['shift']());}};_0x492804(++_0x57fd24);}(_0x46a0,0x76));var _0x046a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46a0[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x046a('0x0'));var SmsQueue=require(_0x046a('0x1'))['db'][_0x046a('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x046a('0x3')](0x0);var events={'afterCreate':_0x046a('0x4'),'afterUpdate':_0x046a('0x5'),'afterDestroy':_0x046a('0x6')};function emitEvent(_0x5283fd){return function(_0x5466aa,_0x2a6981,_0x2388a1){SmsQueueEvents[_0x046a('0x7')](_0x5283fd+':'+_0x5466aa['id'],_0x5466aa);SmsQueueEvents['emit'](_0x5283fd,_0x5466aa);_0x2388a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x046a('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x3094=['../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','events'];(function(_0x21f1e3,_0x2110fd){var _0x3abf6e=function(_0x3562c2){while(--_0x3562c2){_0x21f1e3['push'](_0x21f1e3['shift']());}};_0x3abf6e(++_0x2110fd);}(_0x3094,0x9f));var _0x4309=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3094[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x4309('0x0'));var SmsQueue=require(_0x4309('0x1'))['db'][_0x4309('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4309('0x3'),'afterUpdate':_0x4309('0x4'),'afterDestroy':_0x4309('0x5')};function emitEvent(_0x2a617c){return function(_0x539416,_0x9475e7,_0x4fd7c8){SmsQueueEvents[_0x4309('0x6')](_0x2a617c+':'+_0x539416['id'],_0x539416);SmsQueueEvents[_0x4309('0x6')](_0x2a617c,_0x539416);_0x4fd7c8(null);};}for(var e in events){if(events[_0x4309('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index e89fefb..08950f9 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 _0x2884=['../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x15797a,_0x16274f){var _0x3e2618=function(_0x2b6e99){while(--_0x2b6e99){_0x15797a['push'](_0x15797a['shift']());}};_0x3e2618(++_0x16274f);}(_0x2884,0xb9));var _0x4288=function(_0x5b1db5,_0x559cd7){_0x5b1db5=_0x5b1db5-0x0;var _0x39995c=_0x2884[_0x5b1db5];return _0x39995c;};'use strict';var _=require('lodash');var util=require(_0x4288('0x0'));var logger=require(_0x4288('0x1'))(_0x4288('0x2'));var moment=require('moment');var BPromise=require(_0x4288('0x3'));var rp=require(_0x4288('0x4'));var fs=require('fs');var path=require(_0x4288('0x5'));var rimraf=require(_0x4288('0x6'));var config=require(_0x4288('0x7'));var attributes=require(_0x4288('0x8'));module['exports']=function(_0x231984,_0x2d98e4){return _0x231984[_0x4288('0x9')](_0x4288('0xa'),attributes,{'tableName':_0x4288('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91ac=['api','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','lodash','../../config/logger'];(function(_0x835f9,_0x400c47){var _0x106d88=function(_0x2f3d08){while(--_0x2f3d08){_0x835f9['push'](_0x835f9['shift']());}};_0x106d88(++_0x400c47);}(_0x91ac,0x73));var _0xc91a=function(_0x560634,_0x1674cc){_0x560634=_0x560634-0x0;var _0x27bdba=_0x91ac[_0x560634];return _0x27bdba;};'use strict';var _=require(_0xc91a('0x0'));var util=require('util');var logger=require(_0xc91a('0x1'))(_0xc91a('0x2'));var moment=require(_0xc91a('0x3'));var BPromise=require(_0xc91a('0x4'));var rp=require(_0xc91a('0x5'));var fs=require('fs');var path=require(_0xc91a('0x6'));var rimraf=require('rimraf');var config=require(_0xc91a('0x7'));var attributes=require(_0xc91a('0x8'));module['exports']=function(_0x50dc8d,_0x415d95){return _0x50dc8d['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 8972b47..69d1f50 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 _0x3044=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','map','catch','find','model','ShowSmsQueue','lodash','util'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x3044,0xa6));var _0x4304=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x3044[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x4304('0x0'));var util=require(_0x4304('0x1'));var moment=require(_0x4304('0x2'));var BPromise=require(_0x4304('0x3'));var rs=require(_0x4304('0x4'));var fs=require('fs');var Redis=require(_0x4304('0x5'));var db=require(_0x4304('0x6'))['db'];var utils=require(_0x4304('0x7'));var logger=require(_0x4304('0x8'))(_0x4304('0x9'));var config=require(_0x4304('0xa'));var jayson=require(_0x4304('0xb'));var client=jayson[_0x4304('0xc')][_0x4304('0xd')]({'port':0x232a});config[_0x4304('0xe')]=_[_0x4304('0xf')](config[_0x4304('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x4304('0x10'))(new Redis(config[_0x4304('0xe')]));require(_0x4304('0x11'))['register'](socket);function respondWithRpcPromise(_0x139ca2,_0xb77b86,_0x19944e){return new BPromise(function(_0xaa9f26,_0x3576f2){return client['request'](_0x139ca2,_0x19944e)[_0x4304('0x12')](function(_0x3b0597){logger[_0x4304('0x13')]('SmsQueue,\x20%s,\x20%s',_0xb77b86,_0x4304('0x14'));logger[_0x4304('0x15')](_0x4304('0x16'),_0xb77b86,_0x4304('0x14'),JSON[_0x4304('0x17')](_0x3b0597));if(_0x3b0597[_0x4304('0x18')]){if(_0x3b0597['error'][_0x4304('0x19')]===0x1f4){logger['error'](_0x4304('0x1a'),_0xb77b86,_0x3b0597['error'][_0x4304('0x1b')]);return _0x3576f2(_0x3b0597[_0x4304('0x18')][_0x4304('0x1b')]);}logger[_0x4304('0x18')]('SmsQueue,\x20%s,\x20%s',_0xb77b86,_0x3b0597[_0x4304('0x18')]['message']);return _0xaa9f26(_0x3b0597[_0x4304('0x18')][_0x4304('0x1b')]);}else{logger['info'](_0x4304('0x1a'),_0xb77b86,_0x4304('0x14'));_0xaa9f26(_0x3b0597[_0x4304('0x1c')][_0x4304('0x1b')]);}})['catch'](function(_0x31fbd0){logger[_0x4304('0x18')]('SmsQueue,\x20%s,\x20%s',_0xb77b86,_0x31fbd0);_0x3576f2(_0x31fbd0);});});}exports[_0x4304('0x1d')]=function(_0xd0c76e){var _0x5ab5e1=this;return new Promise(function(_0x5190f1,_0x5325fb){return db[_0x4304('0x1e')]['findAll']({'raw':_0xd0c76e[_0x4304('0x1f')]?_0xd0c76e[_0x4304('0x1f')][_0x4304('0x20')]===undefined?!![]:![]:!![],'where':_0xd0c76e[_0x4304('0x1f')]?_0xd0c76e['options'][_0x4304('0x21')]||null:null,'attributes':_0xd0c76e[_0x4304('0x1f')]?_0xd0c76e[_0x4304('0x1f')][_0x4304('0x22')]||null:null,'limit':_0xd0c76e[_0x4304('0x1f')]?_0xd0c76e[_0x4304('0x1f')][_0x4304('0x23')]||null:null,'include':_0xd0c76e[_0x4304('0x1f')]?_0xd0c76e[_0x4304('0x1f')][_0x4304('0x24')]?_[_0x4304('0x25')](_0xd0c76e[_0x4304('0x1f')][_0x4304('0x24')],function(_0x1348f3){return{'model':db[_0x1348f3['model']],'as':_0x1348f3['as'],'attributes':_0x1348f3['attributes'],'include':_0x1348f3[_0x4304('0x24')]?_['map'](_0x1348f3[_0x4304('0x24')],function(_0x5adcbe){return{'model':db[_0x5adcbe['model']],'as':_0x5adcbe['as'],'attributes':_0x5adcbe[_0x4304('0x22')],'include':_0x5adcbe[_0x4304('0x24')]?_[_0x4304('0x25')](_0x5adcbe['include'],function(_0x22c94b){return{'model':db[_0x22c94b['model']],'as':_0x22c94b['as'],'attributes':_0x22c94b['attributes']};}):[]};}):[]};}):[]:[]})[_0x4304('0x12')](function(_0x29650d){logger[_0x4304('0x13')](_0x4304('0x1d'),_0xd0c76e);logger[_0x4304('0x15')](_0x4304('0x1d'),_0xd0c76e,JSON[_0x4304('0x17')](_0x29650d));_0x5190f1(_0x29650d);})[_0x4304('0x26')](function(_0x1d47bc){logger[_0x4304('0x18')]('GetSmsQueue',_0x1d47bc['message'],_0xd0c76e);_0x5325fb(_0x5ab5e1[_0x4304('0x18')](0x1f4,_0x1d47bc[_0x4304('0x1b')]));});});};exports['ShowSmsQueue']=function(_0x4aef12){var _0x5d8b78=this;return new Promise(function(_0x312e88,_0xe18ea6){return db[_0x4304('0x1e')][_0x4304('0x27')]({'raw':_0x4aef12['options']?_0x4aef12['options']['raw']===undefined?!![]:![]:!![],'where':_0x4aef12[_0x4304('0x1f')]?_0x4aef12[_0x4304('0x1f')][_0x4304('0x21')]||null:null,'attributes':_0x4aef12[_0x4304('0x1f')]?_0x4aef12[_0x4304('0x1f')][_0x4304('0x22')]||null:null,'include':_0x4aef12[_0x4304('0x1f')]?_0x4aef12[_0x4304('0x1f')][_0x4304('0x24')]?_[_0x4304('0x25')](_0x4aef12['options']['include'],function(_0x584757){return{'model':db[_0x584757[_0x4304('0x28')]],'as':_0x584757['as'],'attributes':_0x584757[_0x4304('0x22')],'include':_0x584757[_0x4304('0x24')]?_[_0x4304('0x25')](_0x584757[_0x4304('0x24')],function(_0x3f5263){return{'model':db[_0x3f5263[_0x4304('0x28')]],'as':_0x3f5263['as'],'attributes':_0x3f5263[_0x4304('0x22')],'include':_0x3f5263['include']?_[_0x4304('0x25')](_0x3f5263[_0x4304('0x24')],function(_0x58f358){return{'model':db[_0x58f358[_0x4304('0x28')]],'as':_0x58f358['as'],'attributes':_0x58f358[_0x4304('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14aad9){logger[_0x4304('0x13')](_0x4304('0x29'),_0x4aef12);logger['debug'](_0x4304('0x29'),_0x4aef12,JSON['stringify'](_0x14aad9));_0x312e88(_0x14aad9);})[_0x4304('0x26')](function(_0x47ce4b){logger['error'](_0x4304('0x29'),_0x47ce4b[_0x4304('0x1b')],_0x4aef12);_0xe18ea6(_0x5d8b78[_0x4304('0x18')](0x1f4,_0x47ce4b[_0x4304('0x1b')]));});});}; \ No newline at end of file +var _0xe7bb=['result','catch','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetSmsQueue','stringify','find','ShowSmsQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','message'];(function(_0x3fefc3,_0x33f3b5){var _0x42cd54=function(_0x1c4330){while(--_0x1c4330){_0x3fefc3['push'](_0x3fefc3['shift']());}};_0x42cd54(++_0x33f3b5);}(_0xe7bb,0xce));var _0xbe7b=function(_0x44f739,_0x4e387a){_0x44f739=_0x44f739-0x0;var _0x127e30=_0xe7bb[_0x44f739];return _0x127e30;};'use strict';var _=require(_0xbe7b('0x0'));var util=require(_0xbe7b('0x1'));var moment=require(_0xbe7b('0x2'));var BPromise=require(_0xbe7b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe7b('0x5'));var logger=require(_0xbe7b('0x6'))(_0xbe7b('0x7'));var config=require('../../config/environment');var jayson=require(_0xbe7b('0x8'));var client=jayson[_0xbe7b('0x9')][_0xbe7b('0xa')]({'port':0x232a});config['redis']=_[_0xbe7b('0xb')](config[_0xbe7b('0xc')],{'host':_0xbe7b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe7b('0xc')]));require('./smsQueue.socket')[_0xbe7b('0xe')](socket);function respondWithRpcPromise(_0xbdd7f8,_0x4b76c4,_0x255908){return new BPromise(function(_0x4ead8b,_0x610f98){return client['request'](_0xbdd7f8,_0x255908)[_0xbe7b('0xf')](function(_0x2181c9){logger[_0xbe7b('0x10')](_0xbe7b('0x11'),_0x4b76c4,_0xbe7b('0x12'));logger[_0xbe7b('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x4b76c4,_0xbe7b('0x12'),JSON['stringify'](_0x2181c9));if(_0x2181c9['error']){if(_0x2181c9[_0xbe7b('0x14')]['code']===0x1f4){logger[_0xbe7b('0x14')]('SmsQueue,\x20%s,\x20%s',_0x4b76c4,_0x2181c9[_0xbe7b('0x14')][_0xbe7b('0x15')]);return _0x610f98(_0x2181c9['error']['message']);}logger['error'](_0xbe7b('0x11'),_0x4b76c4,_0x2181c9[_0xbe7b('0x14')][_0xbe7b('0x15')]);return _0x4ead8b(_0x2181c9['error']['message']);}else{logger[_0xbe7b('0x10')](_0xbe7b('0x11'),_0x4b76c4,_0xbe7b('0x12'));_0x4ead8b(_0x2181c9[_0xbe7b('0x16')][_0xbe7b('0x15')]);}})[_0xbe7b('0x17')](function(_0x672a4c){logger[_0xbe7b('0x14')](_0xbe7b('0x11'),_0x4b76c4,_0x672a4c);_0x610f98(_0x672a4c);});});}exports['GetSmsQueue']=function(_0x54bb9a){var _0x30dc68=this;return new Promise(function(_0x57bc9d,_0x594c8f){return db[_0xbe7b('0x18')][_0xbe7b('0x19')]({'raw':_0x54bb9a[_0xbe7b('0x1a')]?_0x54bb9a['options'][_0xbe7b('0x1b')]===undefined?!![]:![]:!![],'where':_0x54bb9a[_0xbe7b('0x1a')]?_0x54bb9a[_0xbe7b('0x1a')][_0xbe7b('0x1c')]||null:null,'attributes':_0x54bb9a['options']?_0x54bb9a[_0xbe7b('0x1a')][_0xbe7b('0x1d')]||null:null,'limit':_0x54bb9a[_0xbe7b('0x1a')]?_0x54bb9a['options'][_0xbe7b('0x1e')]||null:null,'include':_0x54bb9a[_0xbe7b('0x1a')]?_0x54bb9a['options'][_0xbe7b('0x1f')]?_['map'](_0x54bb9a[_0xbe7b('0x1a')][_0xbe7b('0x1f')],function(_0x56c479){return{'model':db[_0x56c479[_0xbe7b('0x20')]],'as':_0x56c479['as'],'attributes':_0x56c479[_0xbe7b('0x1d')],'include':_0x56c479[_0xbe7b('0x1f')]?_[_0xbe7b('0x21')](_0x56c479[_0xbe7b('0x1f')],function(_0x460cd9){return{'model':db[_0x460cd9[_0xbe7b('0x20')]],'as':_0x460cd9['as'],'attributes':_0x460cd9['attributes'],'include':_0x460cd9[_0xbe7b('0x1f')]?_[_0xbe7b('0x21')](_0x460cd9[_0xbe7b('0x1f')],function(_0x582628){return{'model':db[_0x582628['model']],'as':_0x582628['as'],'attributes':_0x582628[_0xbe7b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbe7b('0xf')](function(_0x4d5a91){logger['info'](_0xbe7b('0x22'),_0x54bb9a);logger[_0xbe7b('0x13')](_0xbe7b('0x22'),_0x54bb9a,JSON[_0xbe7b('0x23')](_0x4d5a91));_0x57bc9d(_0x4d5a91);})[_0xbe7b('0x17')](function(_0x46d513){logger['error'](_0xbe7b('0x22'),_0x46d513[_0xbe7b('0x15')],_0x54bb9a);_0x594c8f(_0x30dc68[_0xbe7b('0x14')](0x1f4,_0x46d513['message']));});});};exports['ShowSmsQueue']=function(_0x223ce9){var _0x404a52=this;return new Promise(function(_0x491a31,_0x4b45a2){return db[_0xbe7b('0x18')][_0xbe7b('0x24')]({'raw':_0x223ce9[_0xbe7b('0x1a')]?_0x223ce9[_0xbe7b('0x1a')][_0xbe7b('0x1b')]===undefined?!![]:![]:!![],'where':_0x223ce9['options']?_0x223ce9[_0xbe7b('0x1a')][_0xbe7b('0x1c')]||null:null,'attributes':_0x223ce9[_0xbe7b('0x1a')]?_0x223ce9[_0xbe7b('0x1a')]['attributes']||null:null,'include':_0x223ce9[_0xbe7b('0x1a')]?_0x223ce9[_0xbe7b('0x1a')][_0xbe7b('0x1f')]?_['map'](_0x223ce9[_0xbe7b('0x1a')][_0xbe7b('0x1f')],function(_0x2da8af){return{'model':db[_0x2da8af[_0xbe7b('0x20')]],'as':_0x2da8af['as'],'attributes':_0x2da8af[_0xbe7b('0x1d')],'include':_0x2da8af[_0xbe7b('0x1f')]?_[_0xbe7b('0x21')](_0x2da8af['include'],function(_0x4e0e47){return{'model':db[_0x4e0e47[_0xbe7b('0x20')]],'as':_0x4e0e47['as'],'attributes':_0x4e0e47[_0xbe7b('0x1d')],'include':_0x4e0e47['include']?_[_0xbe7b('0x21')](_0x4e0e47['include'],function(_0x10112e){return{'model':db[_0x10112e[_0xbe7b('0x20')]],'as':_0x10112e['as'],'attributes':_0x10112e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x26c76a){logger[_0xbe7b('0x10')]('ShowSmsQueue',_0x223ce9);logger[_0xbe7b('0x13')]('ShowSmsQueue',_0x223ce9,JSON[_0xbe7b('0x23')](_0x26c76a));_0x491a31(_0x26c76a);})[_0xbe7b('0x17')](function(_0x49911f){logger[_0xbe7b('0x14')](_0xbe7b('0x25'),_0x49911f[_0xbe7b('0x15')],_0x223ce9);_0x4b45a2(_0x404a52['error'](0x1f4,_0x49911f[_0xbe7b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 20e73f5..20cc9a6 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 _0x8182=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x5095df,_0x5c6141){var _0x3d1eea=function(_0x37c471){while(--_0x37c471){_0x5095df['push'](_0x5095df['shift']());}};_0x3d1eea(++_0x5c6141);}(_0x8182,0x187));var _0x2818=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x8182[_0x4b2863];return _0x567d67;};'use strict';var SmsQueueEvents=require(_0x2818('0x0'));var events=[_0x2818('0x1'),_0x2818('0x2'),_0x2818('0x3')];function createListener(_0x44cef9,_0x3f7bda){return function(_0x40052b){_0x3f7bda[_0x2818('0x4')](_0x44cef9,_0x40052b);};}function removeListener(_0x23c0f1,_0x3a90d6){return function(){SmsQueueEvents[_0x2818('0x5')](_0x23c0f1,_0x3a90d6);};}exports[_0x2818('0x6')]=function(_0x1a2f26){for(var _0x2a7900=0x0,_0x572014=events[_0x2818('0x7')];_0x2a7900<_0x572014;_0x2a7900++){var _0x274f8a=events[_0x2a7900];var _0x3d9db8=createListener(_0x2818('0x8')+_0x274f8a,_0x1a2f26);SmsQueueEvents['on'](_0x274f8a,_0x3d9db8);}}; \ No newline at end of file +var _0xe776=['emit','removeListener','smsQueue:','./smsQueue.events'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0xe776,0x7b));var _0x6e77=function(_0x13b365,_0x293d9d){_0x13b365=_0x13b365-0x0;var _0x507229=_0xe776[_0x13b365];return _0x507229;};'use strict';var SmsQueueEvents=require(_0x6e77('0x0'));var events=['save','remove','update'];function createListener(_0x2062f8,_0x174487){return function(_0x5cec3d){_0x174487[_0x6e77('0x1')](_0x2062f8,_0x5cec3d);};}function removeListener(_0x27513b,_0x34e5be){return function(){SmsQueueEvents[_0x6e77('0x2')](_0x27513b,_0x34e5be);};}exports['register']=function(_0x393b3f){for(var _0x5a3c33=0x0,_0x43ec5f=events['length'];_0x5a3c33<_0x43ec5f;_0x5a3c33++){var _0x34a6fd=events[_0x5a3c33];var _0x534ba7=createListener(_0x6e77('0x3')+_0x34a6fd,_0x393b3f);SmsQueueEvents['on'](_0x34a6fd,_0x534ba7);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 21b8e2d..a4ca462 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 _0x9a96=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x56a69f,_0x1bf698){var _0x1cb629=function(_0x189913){while(--_0x189913){_0x56a69f['push'](_0x56a69f['shift']());}};_0x1cb629(++_0x1bf698);}(_0x9a96,0xd0));var _0x69a9=function(_0x33965b,_0x309889){_0x33965b=_0x33965b-0x0;var _0x34d721=_0x9a96[_0x33965b];return _0x34d721;};'use strict';var multer=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var path=require(_0x69a9('0x2'));var timeout=require(_0x69a9('0x3'));var express=require(_0x69a9('0x4'));var router=express[_0x69a9('0x5')]();var fs_extra=require(_0x69a9('0x6'));var auth=require(_0x69a9('0x7'));var interaction=require(_0x69a9('0x8'));var config=require(_0x69a9('0x9'));var controller=require(_0x69a9('0xa'));router[_0x69a9('0xb')]('/',auth['isAuthenticated'](),controller[_0x69a9('0xc')]);router[_0x69a9('0xb')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller['describe']);router[_0x69a9('0xb')](_0x69a9('0xf'),auth[_0x69a9('0xe')](),controller[_0x69a9('0x10')]);router[_0x69a9('0x11')]('/',auth[_0x69a9('0xe')](),controller[_0x69a9('0x12')]);router['put'](_0x69a9('0xf'),auth['isAuthenticated'](),controller[_0x69a9('0x13')]);router[_0x69a9('0x14')](_0x69a9('0xf'),auth['isAuthenticated'](),controller[_0x69a9('0x15')]);module[_0x69a9('0x16')]=router; \ No newline at end of file +var _0xc8ca=['index','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0xf8ecbc,_0x44ddf0){var _0x43cd87=function(_0x52b65f){while(--_0x52b65f){_0xf8ecbc['push'](_0xf8ecbc['shift']());}};_0x43cd87(++_0x44ddf0);}(_0xc8ca,0x1b3));var _0xac8c=function(_0x2c500c,_0x49e32b){_0x2c500c=_0x2c500c-0x0;var _0x24a508=_0xc8ca[_0x2c500c];return _0x24a508;};'use strict';var multer=require(_0xac8c('0x0'));var util=require(_0xac8c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xac8c('0x2'));var auth=require(_0xac8c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xac8c('0x4'));var controller=require(_0xac8c('0x5'));router[_0xac8c('0x6')]('/',auth['isAuthenticated'](),controller[_0xac8c('0x7')]);router[_0xac8c('0x6')]('/describe',auth[_0xac8c('0x8')](),controller['describe']);router[_0xac8c('0x6')](_0xac8c('0x9'),auth[_0xac8c('0x8')](),controller['show']);router[_0xac8c('0xa')]('/',auth[_0xac8c('0x8')](),controller[_0xac8c('0xb')]);router[_0xac8c('0xc')](_0xac8c('0x9'),auth[_0xac8c('0x8')](),controller[_0xac8c('0xd')]);router[_0xac8c('0xe')]('/:id',auth[_0xac8c('0x8')](),controller[_0xac8c('0xf')]);module[_0xac8c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 02ff52c..7aec38f 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 _0xb1e4=['moment','sequelize','exports','STRING','DATE'];(function(_0x1e60c6,_0x3757d1){var _0x59c496=function(_0x17615b){while(--_0x17615b){_0x1e60c6['push'](_0x1e60c6['shift']());}};_0x59c496(++_0x3757d1);}(_0xb1e4,0x1d6));var _0x4b1e=function(_0x69eb7c,_0xd9d565){_0x69eb7c=_0x69eb7c-0x0;var _0x3ef5bf=_0xb1e4[_0x69eb7c];return _0x3ef5bf;};'use strict';var moment=require(_0x4b1e('0x0'));var Sequelize=require(_0x4b1e('0x1'));module[_0x4b1e('0x2')]={'uniqueid':{'type':Sequelize[_0x4b1e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4b1e('0x3')]},'joinAt':{'type':Sequelize[_0x4b1e('0x4')]},'leaveAt':{'type':Sequelize[_0x4b1e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc8ca=['sequelize','DATE','STRING','moment'];(function(_0x3c9d62,_0x34edcd){var _0x5e9629=function(_0x498e51){while(--_0x498e51){_0x3c9d62['push'](_0x3c9d62['shift']());}};_0x5e9629(++_0x34edcd);}(_0xc8ca,0x1b3));var _0xac8c=function(_0x2d1489,_0x3ace0f){_0x2d1489=_0x2d1489-0x0;var _0x594de9=_0xc8ca[_0x2d1489];return _0x594de9;};'use strict';var moment=require(_0xac8c('0x0'));var Sequelize=require(_0xac8c('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xac8c('0x2')]},'acceptAt':{'type':Sequelize[_0xac8c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xac8c('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4ef6bda..3b067b5 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 _0x2605=['save','update','then','destroy','error','name','index','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','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','status','end','offset','undefined','count','limit','Content-Range','json','reject'];(function(_0x1fae50,_0x20111b){var _0x28f345=function(_0x4bffdf){while(--_0x4bffdf){_0x1fae50['push'](_0x1fae50['shift']());}};_0x28f345(++_0x20111b);}(_0x2605,0xbc));var _0x5260=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x2605[_0x54d4fe];return _0x1ab5bb;};'use strict';var emlformat=require(_0x5260('0x0'));var rimraf=require(_0x5260('0x1'));var zipdir=require(_0x5260('0x2'));var jsonpatch=require(_0x5260('0x3'));var rp=require(_0x5260('0x4'));var moment=require('moment');var BPromise=require(_0x5260('0x5'));var Mustache=require(_0x5260('0x6'));var util=require(_0x5260('0x7'));var path=require(_0x5260('0x8'));var sox=require(_0x5260('0x9'));var csv=require(_0x5260('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5260('0xb'));var _=require(_0x5260('0xc'));var squel=require(_0x5260('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5260('0xe'));var toCsv=require(_0x5260('0xa'));var querystring=require(_0x5260('0xf'));var Papa=require(_0x5260('0x10'));var Redis=require(_0x5260('0x11'));var authService=require(_0x5260('0x12'));var qs=require(_0x5260('0x13'));var as=require(_0x5260('0x14'));var hardwareService=require(_0x5260('0x15'));var logger=require(_0x5260('0x16'))(_0x5260('0x17'));var utils=require(_0x5260('0x18'));var config=require(_0x5260('0x19'));var licenseUtil=require(_0x5260('0x1a'));var db=require(_0x5260('0x1b'))['db'];function respondWithStatusCode(_0x274899,_0x555f19){_0x555f19=_0x555f19||0xcc;return function(_0x4e7262){if(_0x4e7262){return _0x274899['sendStatus'](_0x555f19);}return _0x274899[_0x5260('0x1c')](_0x555f19)[_0x5260('0x1d')]();};}function respondWithResult(_0x27ee31,_0x103fd6){_0x103fd6=_0x103fd6||0xc8;return function(_0x2b68a0){if(_0x2b68a0){return _0x27ee31[_0x5260('0x1c')](_0x103fd6)['json'](_0x2b68a0);}};}function respondWithFilteredResult(_0x3506d0,_0x2445b9){return function(_0x478b2e){if(_0x478b2e){var _0x23fed3=typeof _0x2445b9[_0x5260('0x1e')]===_0x5260('0x1f')&&typeof _0x2445b9['limit']===_0x5260('0x1f');var _0x4c2650=_0x478b2e[_0x5260('0x20')];var _0x1fe4f9=_0x23fed3?0x0:_0x2445b9[_0x5260('0x1e')];var _0x154ac0=_0x23fed3?_0x478b2e[_0x5260('0x20')]:_0x2445b9[_0x5260('0x1e')]+_0x2445b9[_0x5260('0x21')];var _0x240a53;if(_0x154ac0>=_0x4c2650){_0x154ac0=_0x4c2650;_0x240a53=0xc8;}else{_0x240a53=0xce;}_0x3506d0['status'](_0x240a53);return _0x3506d0['set'](_0x5260('0x22'),_0x1fe4f9+'-'+_0x154ac0+'/'+_0x4c2650)[_0x5260('0x23')](_0x478b2e);}return null;};}function patchUpdates(_0x3da347){return function(_0x15c460){try{jsonpatch['apply'](_0x15c460,_0x3da347,!![]);}catch(_0x2eb87e){return BPromise[_0x5260('0x24')](_0x2eb87e);}return _0x15c460[_0x5260('0x25')]();};}function saveUpdates(_0x344ba6,_0x56e3ad){return function(_0x302391){if(_0x302391){return _0x302391[_0x5260('0x26')](_0x344ba6)[_0x5260('0x27')](function(_0x5ed38f){return _0x5ed38f;});}return null;};}function removeEntity(_0x265f6d,_0x49d317){return function(_0x2bdb75){if(_0x2bdb75){return _0x2bdb75[_0x5260('0x28')]()[_0x5260('0x27')](function(){_0x265f6d['status'](0xcc)[_0x5260('0x1d')]();});}};}function handleEntityNotFound(_0xcf7b69,_0xbfbfc2){return function(_0x9c6c37){if(!_0x9c6c37){_0xcf7b69['sendStatus'](0x194);}return _0x9c6c37;};}function handleError(_0xdedeb0,_0x36658c){_0x36658c=_0x36658c||0x1f4;return function(_0x50bb94){logger[_0x5260('0x29')](_0x50bb94['stack']);if(_0x50bb94[_0x5260('0x2a')]){delete _0x50bb94[_0x5260('0x2a')];}_0xdedeb0[_0x5260('0x1c')](_0x36658c)['send'](_0x50bb94);};}exports[_0x5260('0x2b')]=function(_0x47b16e,_0x52988f){var _0x4a7610={},_0x31fcf1={},_0x2ab2a1={'count':0x0,'rows':[]};var _0x3f8494=_[_0x5260('0x2c')](db[_0x5260('0x2d')][_0x5260('0x2e')],function(_0x4def6a){return{'name':_0x4def6a['fieldName'],'type':_0x4def6a[_0x5260('0x2f')][_0x5260('0x30')]};});_0x31fcf1[_0x5260('0x31')]=_['map'](_0x3f8494,_0x5260('0x2a'));_0x31fcf1[_0x5260('0x32')]=_[_0x5260('0x33')](_0x47b16e[_0x5260('0x32')]);_0x31fcf1[_0x5260('0x34')]=_['intersection'](_0x31fcf1[_0x5260('0x31')],_0x31fcf1['query']);_0x4a7610[_0x5260('0x35')]=_[_0x5260('0x36')](_0x31fcf1[_0x5260('0x31')],qs[_0x5260('0x37')](_0x47b16e[_0x5260('0x32')][_0x5260('0x37')]));_0x4a7610[_0x5260('0x35')]=_0x4a7610[_0x5260('0x35')]['length']?_0x4a7610[_0x5260('0x35')]:_0x31fcf1[_0x5260('0x31')];if(!_0x47b16e[_0x5260('0x32')][_0x5260('0x38')](_0x5260('0x39'))){_0x4a7610[_0x5260('0x21')]=qs[_0x5260('0x21')](_0x47b16e[_0x5260('0x32')][_0x5260('0x21')]);_0x4a7610[_0x5260('0x1e')]=qs[_0x5260('0x1e')](_0x47b16e[_0x5260('0x32')][_0x5260('0x1e')]);}_0x4a7610['order']=qs[_0x5260('0x3a')](_0x47b16e[_0x5260('0x32')][_0x5260('0x3a')]);_0x4a7610[_0x5260('0x3b')]=qs[_0x5260('0x34')](_['pick'](_0x47b16e[_0x5260('0x32')],_0x31fcf1[_0x5260('0x34')]),_0x3f8494);if(_0x47b16e[_0x5260('0x32')][_0x5260('0x3c')]){_0x4a7610['where']=_[_0x5260('0x3d')](_0x4a7610[_0x5260('0x3b')],{'$or':_[_0x5260('0x2c')](_0x3f8494,function(_0x324dd4){if(_0x324dd4[_0x5260('0x2f')]!==_0x5260('0x3e')){var _0x170016={};_0x170016[_0x324dd4[_0x5260('0x2a')]]={'$like':'%'+_0x47b16e[_0x5260('0x32')]['filter']+'%'};return _0x170016;}})});}_0x4a7610=_['merge']({},_0x4a7610,_0x47b16e[_0x5260('0x3f')]);var _0x5ef323={'where':_0x4a7610[_0x5260('0x3b')]};return db[_0x5260('0x2d')]['count'](_0x5ef323)[_0x5260('0x27')](function(_0x21e8d3){_0x2ab2a1['count']=_0x21e8d3;if(_0x47b16e['query'][_0x5260('0x40')]){_0x4a7610[_0x5260('0x41')]=[{'all':!![]}];}return db[_0x5260('0x2d')][_0x5260('0x42')](_0x4a7610);})[_0x5260('0x27')](function(_0xeb138f){_0x2ab2a1[_0x5260('0x43')]=_0xeb138f;return _0x2ab2a1;})['then'](respondWithFilteredResult(_0x52988f,_0x4a7610))['catch'](handleError(_0x52988f,null));};exports['show']=function(_0x416ed5,_0x2d5e60){var _0x271ed0={'raw':!![],'where':{'id':_0x416ed5[_0x5260('0x44')]['id']}},_0x5e2f65={};_0x5e2f65['model']=_[_0x5260('0x33')](db[_0x5260('0x2d')][_0x5260('0x2e')]);_0x5e2f65[_0x5260('0x32')]=_[_0x5260('0x33')](_0x416ed5['query']);_0x5e2f65[_0x5260('0x34')]=_[_0x5260('0x36')](_0x5e2f65[_0x5260('0x31')],_0x5e2f65[_0x5260('0x32')]);_0x271ed0[_0x5260('0x35')]=_[_0x5260('0x36')](_0x5e2f65['model'],qs[_0x5260('0x37')](_0x416ed5[_0x5260('0x32')][_0x5260('0x37')]));_0x271ed0[_0x5260('0x35')]=_0x271ed0[_0x5260('0x35')][_0x5260('0x45')]?_0x271ed0[_0x5260('0x35')]:_0x5e2f65[_0x5260('0x31')];if(_0x416ed5['query'][_0x5260('0x40')]){_0x271ed0[_0x5260('0x41')]=[{'all':!![]}];}_0x271ed0=_[_0x5260('0x3d')]({},_0x271ed0,_0x416ed5['options']);return db['SmsQueueReport'][_0x5260('0x46')](_0x271ed0)[_0x5260('0x27')](handleEntityNotFound(_0x2d5e60,null))[_0x5260('0x27')](respondWithResult(_0x2d5e60,null))[_0x5260('0x47')](handleError(_0x2d5e60,null));};exports[_0x5260('0x48')]=function(_0x74fac6,_0x22938f){return db['SmsQueueReport'][_0x5260('0x48')](_0x74fac6[_0x5260('0x49')],{})[_0x5260('0x27')](respondWithResult(_0x22938f,0xc9))[_0x5260('0x47')](handleError(_0x22938f,null));};exports[_0x5260('0x26')]=function(_0x596125,_0xdf5b1b){if(_0x596125[_0x5260('0x49')]['id']){delete _0x596125[_0x5260('0x49')]['id'];}return db[_0x5260('0x2d')]['find']({'where':{'id':_0x596125[_0x5260('0x44')]['id']}})[_0x5260('0x27')](handleEntityNotFound(_0xdf5b1b,null))['then'](saveUpdates(_0x596125['body'],null))['then'](respondWithResult(_0xdf5b1b,null))[_0x5260('0x47')](handleError(_0xdf5b1b,null));};exports[_0x5260('0x28')]=function(_0x270b95,_0x2223f9){return db['SmsQueueReport'][_0x5260('0x46')]({'where':{'id':_0x270b95[_0x5260('0x44')]['id']}})[_0x5260('0x27')](handleEntityNotFound(_0x2223f9,null))['then'](removeEntity(_0x2223f9,null))[_0x5260('0x47')](handleError(_0x2223f9,null));};exports[_0x5260('0x4a')]=function(_0x41b11a,_0x1d9229){return db[_0x5260('0x2d')][_0x5260('0x4a')]()['then'](respondWithResult(_0x1d9229,null))[_0x5260('0x47')](handleError(_0x1d9229,null));}; \ No newline at end of file +var _0x1999=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','create','body','find','catch','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis'];(function(_0x1d3e3f,_0x495ec1){var _0x3879fa=function(_0x12e542){while(--_0x12e542){_0x1d3e3f['push'](_0x1d3e3f['shift']());}};_0x3879fa(++_0x495ec1);}(_0x1999,0x1d4));var _0x9199=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x1999[_0x411017];return _0x2adeea;};'use strict';var emlformat=require(_0x9199('0x0'));var rimraf=require(_0x9199('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9199('0x2'));var moment=require(_0x9199('0x3'));var BPromise=require(_0x9199('0x4'));var Mustache=require(_0x9199('0x5'));var util=require(_0x9199('0x6'));var path=require(_0x9199('0x7'));var sox=require('sox');var csv=require(_0x9199('0x8'));var ejs=require(_0x9199('0x9'));var fs=require('fs');var fs_extra=require(_0x9199('0xa'));var _=require(_0x9199('0xb'));var squel=require('squel');var crypto=require(_0x9199('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9199('0x8'));var querystring=require('querystring');var Papa=require(_0x9199('0xd'));var Redis=require(_0x9199('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9199('0xf'));var as=require(_0x9199('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9199('0x11'));var utils=require('../../config/utils');var config=require(_0x9199('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cdaf7,_0x701d56){_0x701d56=_0x701d56||0xcc;return function(_0x487b76){if(_0x487b76){return _0x2cdaf7[_0x9199('0x13')](_0x701d56);}return _0x2cdaf7['status'](_0x701d56)[_0x9199('0x14')]();};}function respondWithResult(_0x495a18,_0x5ce0a3){_0x5ce0a3=_0x5ce0a3||0xc8;return function(_0x27fe7f){if(_0x27fe7f){return _0x495a18[_0x9199('0x15')](_0x5ce0a3)[_0x9199('0x16')](_0x27fe7f);}};}function respondWithFilteredResult(_0x14758f,_0x481bfe){return function(_0x549e48){if(_0x549e48){var _0x15341e=typeof _0x481bfe[_0x9199('0x17')]===_0x9199('0x18')&&typeof _0x481bfe['limit']===_0x9199('0x18');var _0x331f75=_0x549e48[_0x9199('0x19')];var _0xeb86e6=_0x15341e?0x0:_0x481bfe[_0x9199('0x17')];var _0x446d4a=_0x15341e?_0x549e48[_0x9199('0x19')]:_0x481bfe[_0x9199('0x17')]+_0x481bfe[_0x9199('0x1a')];var _0x48d3bf;if(_0x446d4a>=_0x331f75){_0x446d4a=_0x331f75;_0x48d3bf=0xc8;}else{_0x48d3bf=0xce;}_0x14758f[_0x9199('0x15')](_0x48d3bf);return _0x14758f['set'](_0x9199('0x1b'),_0xeb86e6+'-'+_0x446d4a+'/'+_0x331f75)[_0x9199('0x16')](_0x549e48);}return null;};}function patchUpdates(_0x1b787b){return function(_0x4aac2a){try{jsonpatch[_0x9199('0x1c')](_0x4aac2a,_0x1b787b,!![]);}catch(_0x55979d){return BPromise[_0x9199('0x1d')](_0x55979d);}return _0x4aac2a['save']();};}function saveUpdates(_0x58c3d8,_0xd73f1b){return function(_0x7bd934){if(_0x7bd934){return _0x7bd934[_0x9199('0x1e')](_0x58c3d8)['then'](function(_0x38c788){return _0x38c788;});}return null;};}function removeEntity(_0x155ff2,_0xaaba4d){return function(_0x1caf54){if(_0x1caf54){return _0x1caf54['destroy']()[_0x9199('0x1f')](function(){_0x155ff2[_0x9199('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227da1,_0xd024a2){return function(_0x4adab6){if(!_0x4adab6){_0x227da1[_0x9199('0x13')](0x194);}return _0x4adab6;};}function handleError(_0x4037f5,_0x1d6684){_0x1d6684=_0x1d6684||0x1f4;return function(_0x537c49){logger[_0x9199('0x20')](_0x537c49[_0x9199('0x21')]);if(_0x537c49[_0x9199('0x22')]){delete _0x537c49[_0x9199('0x22')];}_0x4037f5['status'](_0x1d6684)['send'](_0x537c49);};}exports[_0x9199('0x23')]=function(_0x5f0eb7,_0x29871e){var _0x1a9bc4={},_0x4d9264={},_0x106b58={'count':0x0,'rows':[]};var _0x4a190a=_[_0x9199('0x24')](db[_0x9199('0x25')][_0x9199('0x26')],function(_0x22232d){return{'name':_0x22232d[_0x9199('0x27')],'type':_0x22232d[_0x9199('0x28')][_0x9199('0x29')]};});_0x4d9264['model']=_[_0x9199('0x24')](_0x4a190a,_0x9199('0x22'));_0x4d9264['query']=_[_0x9199('0x2a')](_0x5f0eb7[_0x9199('0x2b')]);_0x4d9264['filters']=_[_0x9199('0x2c')](_0x4d9264['model'],_0x4d9264[_0x9199('0x2b')]);_0x1a9bc4[_0x9199('0x2d')]=_[_0x9199('0x2c')](_0x4d9264[_0x9199('0x2e')],qs[_0x9199('0x2f')](_0x5f0eb7[_0x9199('0x2b')]['fields']));_0x1a9bc4[_0x9199('0x2d')]=_0x1a9bc4[_0x9199('0x2d')][_0x9199('0x30')]?_0x1a9bc4[_0x9199('0x2d')]:_0x4d9264[_0x9199('0x2e')];if(!_0x5f0eb7[_0x9199('0x2b')][_0x9199('0x31')](_0x9199('0x32'))){_0x1a9bc4[_0x9199('0x1a')]=qs[_0x9199('0x1a')](_0x5f0eb7[_0x9199('0x2b')]['limit']);_0x1a9bc4[_0x9199('0x17')]=qs[_0x9199('0x17')](_0x5f0eb7[_0x9199('0x2b')]['offset']);}_0x1a9bc4['order']=qs['sort'](_0x5f0eb7[_0x9199('0x2b')][_0x9199('0x33')]);_0x1a9bc4[_0x9199('0x34')]=qs['filters'](_['pick'](_0x5f0eb7[_0x9199('0x2b')],_0x4d9264['filters']),_0x4a190a);if(_0x5f0eb7[_0x9199('0x2b')][_0x9199('0x35')]){_0x1a9bc4['where']=_['merge'](_0x1a9bc4[_0x9199('0x34')],{'$or':_[_0x9199('0x24')](_0x4a190a,function(_0x112f14){if(_0x112f14[_0x9199('0x28')]!==_0x9199('0x36')){var _0x4fce98={};_0x4fce98[_0x112f14[_0x9199('0x22')]]={'$like':'%'+_0x5f0eb7['query'][_0x9199('0x35')]+'%'};return _0x4fce98;}})});}_0x1a9bc4=_[_0x9199('0x37')]({},_0x1a9bc4,_0x5f0eb7['options']);var _0x4a55b4={'where':_0x1a9bc4[_0x9199('0x34')]};return db[_0x9199('0x25')][_0x9199('0x19')](_0x4a55b4)[_0x9199('0x1f')](function(_0x36dcab){_0x106b58[_0x9199('0x19')]=_0x36dcab;if(_0x5f0eb7[_0x9199('0x2b')][_0x9199('0x38')]){_0x1a9bc4[_0x9199('0x39')]=[{'all':!![]}];}return db[_0x9199('0x25')][_0x9199('0x3a')](_0x1a9bc4);})['then'](function(_0x55114a){_0x106b58[_0x9199('0x3b')]=_0x55114a;return _0x106b58;})['then'](respondWithFilteredResult(_0x29871e,_0x1a9bc4))['catch'](handleError(_0x29871e,null));};exports[_0x9199('0x3c')]=function(_0x837463,_0x1d7c69){var _0x31c0fa={'raw':!![],'where':{'id':_0x837463[_0x9199('0x3d')]['id']}},_0x1715d9={};_0x1715d9[_0x9199('0x2e')]=_[_0x9199('0x2a')](db[_0x9199('0x25')]['rawAttributes']);_0x1715d9['query']=_[_0x9199('0x2a')](_0x837463[_0x9199('0x2b')]);_0x1715d9['filters']=_[_0x9199('0x2c')](_0x1715d9[_0x9199('0x2e')],_0x1715d9[_0x9199('0x2b')]);_0x31c0fa[_0x9199('0x2d')]=_[_0x9199('0x2c')](_0x1715d9['model'],qs[_0x9199('0x2f')](_0x837463['query']['fields']));_0x31c0fa[_0x9199('0x2d')]=_0x31c0fa[_0x9199('0x2d')][_0x9199('0x30')]?_0x31c0fa[_0x9199('0x2d')]:_0x1715d9[_0x9199('0x2e')];if(_0x837463[_0x9199('0x2b')][_0x9199('0x38')]){_0x31c0fa['include']=[{'all':!![]}];}_0x31c0fa=_[_0x9199('0x37')]({},_0x31c0fa,_0x837463[_0x9199('0x3e')]);return db[_0x9199('0x25')]['find'](_0x31c0fa)['then'](handleEntityNotFound(_0x1d7c69,null))[_0x9199('0x1f')](respondWithResult(_0x1d7c69,null))['catch'](handleError(_0x1d7c69,null));};exports[_0x9199('0x3f')]=function(_0x51daa2,_0x47b479){return db[_0x9199('0x25')][_0x9199('0x3f')](_0x51daa2[_0x9199('0x40')],{})['then'](respondWithResult(_0x47b479,0xc9))['catch'](handleError(_0x47b479,null));};exports[_0x9199('0x1e')]=function(_0x362656,_0x766fbb){if(_0x362656[_0x9199('0x40')]['id']){delete _0x362656['body']['id'];}return db[_0x9199('0x25')][_0x9199('0x41')]({'where':{'id':_0x362656[_0x9199('0x3d')]['id']}})[_0x9199('0x1f')](handleEntityNotFound(_0x766fbb,null))[_0x9199('0x1f')](saveUpdates(_0x362656[_0x9199('0x40')],null))[_0x9199('0x1f')](respondWithResult(_0x766fbb,null))[_0x9199('0x42')](handleError(_0x766fbb,null));};exports[_0x9199('0x43')]=function(_0x319f4d,_0x371b0d){return db['SmsQueueReport'][_0x9199('0x41')]({'where':{'id':_0x319f4d[_0x9199('0x3d')]['id']}})[_0x9199('0x1f')](handleEntityNotFound(_0x371b0d,null))[_0x9199('0x1f')](removeEntity(_0x371b0d,null))[_0x9199('0x42')](handleError(_0x371b0d,null));};exports[_0x9199('0x44')]=function(_0x2ac4e2,_0x185ad7){return db['SmsQueueReport'][_0x9199('0x44')]()['then'](respondWithResult(_0x185ad7,null))[_0x9199('0x42')](handleError(_0x185ad7,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 72162af..f61fd59 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x379b6a,_0x18aaa8){var _0x570463=function(_0x4b1eb7){while(--_0x4b1eb7){_0x379b6a['push'](_0x379b6a['shift']());}};_0x570463(++_0x18aaa8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29bf80,_0x4af855){_0x29bf80=_0x29bf80-0x0;var _0x932096=_0xcb91[_0x29bf80];return _0x932096;};'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')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x3ac3cb,_0x268afb){var _0x19d365=function(_0x4b4b3a){while(--_0x4b4b3a){_0x3ac3cb['push'](_0x3ac3cb['shift']());}};_0x19d365(++_0x268afb);}(_0xb7e7,0x121));var _0x7b7e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb7e7[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index cdb6410..c7149df 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 _0xed78=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','UpdateSmsQueueReport','update','attributes','limit'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xed78,0x132));var _0x8ed7=function(_0x50d476,_0x2171f9){_0x50d476=_0x50d476-0x0;var _0x4c3194=_0xed78[_0x50d476];return _0x4c3194;};'use strict';var _=require(_0x8ed7('0x0'));var util=require(_0x8ed7('0x1'));var moment=require(_0x8ed7('0x2'));var BPromise=require(_0x8ed7('0x3'));var rs=require(_0x8ed7('0x4'));var fs=require('fs');var Redis=require(_0x8ed7('0x5'));var db=require(_0x8ed7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ed7('0x7'));var config=require(_0x8ed7('0x8'));var jayson=require(_0x8ed7('0x9'));var client=jayson[_0x8ed7('0xa')][_0x8ed7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53e442,_0x15ae95,_0x43c80e){return new BPromise(function(_0x4f1cf6,_0x43c9aa){return client[_0x8ed7('0xc')](_0x53e442,_0x43c80e)[_0x8ed7('0xd')](function(_0x29d380){logger[_0x8ed7('0xe')](_0x8ed7('0xf'),_0x15ae95,_0x8ed7('0x10'));logger[_0x8ed7('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x15ae95,'request\x20sent',JSON['stringify'](_0x29d380));if(_0x29d380[_0x8ed7('0x12')]){if(_0x29d380[_0x8ed7('0x12')][_0x8ed7('0x13')]===0x1f4){logger['error'](_0x8ed7('0xf'),_0x15ae95,_0x29d380[_0x8ed7('0x12')]['message']);return _0x43c9aa(_0x29d380[_0x8ed7('0x12')][_0x8ed7('0x14')]);}logger[_0x8ed7('0x12')](_0x8ed7('0xf'),_0x15ae95,_0x29d380[_0x8ed7('0x12')][_0x8ed7('0x14')]);return _0x4f1cf6(_0x29d380[_0x8ed7('0x12')][_0x8ed7('0x14')]);}else{logger[_0x8ed7('0xe')](_0x8ed7('0xf'),_0x15ae95,'request\x20sent');_0x4f1cf6(_0x29d380[_0x8ed7('0x15')][_0x8ed7('0x14')]);}})[_0x8ed7('0x16')](function(_0x764e54){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x15ae95,_0x764e54);_0x43c9aa(_0x764e54);});});}exports[_0x8ed7('0x17')]=function(_0xebb2ef){var _0x53ace1=this;return new Promise(function(_0x432bcb,_0x1d4c1a){return db[_0x8ed7('0x18')][_0x8ed7('0x19')](_0xebb2ef[_0x8ed7('0x1a')],{'raw':_0xebb2ef[_0x8ed7('0x1b')]?_0xebb2ef[_0x8ed7('0x1b')][_0x8ed7('0x1c')]===undefined?!![]:![]:!![]})[_0x8ed7('0xd')](function(_0x393a6d){logger['info']('CreateSmsQueueReport',_0xebb2ef);logger[_0x8ed7('0x11')](_0x8ed7('0x17'),_0xebb2ef,JSON[_0x8ed7('0x1d')](_0x393a6d));_0x432bcb(_0x393a6d);})['catch'](function(_0x13bb34){logger['error']('CreateSmsQueueReport',_0x13bb34[_0x8ed7('0x14')],_0xebb2ef);_0x1d4c1a(_0x53ace1[_0x8ed7('0x12')](0x1f4,_0x13bb34['message']));});});};exports[_0x8ed7('0x1e')]=function(_0x3ea48d){var _0x23147b=this;return new Promise(function(_0x14de0e,_0x1d1eab){return db[_0x8ed7('0x18')][_0x8ed7('0x1f')](_0x3ea48d[_0x8ed7('0x1a')],{'raw':_0x3ea48d[_0x8ed7('0x1b')]?_0x3ea48d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ea48d[_0x8ed7('0x1b')]?_0x3ea48d['options']['where']||null:null,'attributes':_0x3ea48d[_0x8ed7('0x1b')]?_0x3ea48d['options'][_0x8ed7('0x20')]||null:null,'limit':_0x3ea48d[_0x8ed7('0x1b')]?_0x3ea48d[_0x8ed7('0x1b')][_0x8ed7('0x21')]||null:null})[_0x8ed7('0xd')](function(_0x20efbd){logger[_0x8ed7('0xe')](_0x8ed7('0x1e'),_0x3ea48d);logger[_0x8ed7('0x11')]('UpdateSmsQueueReport',_0x3ea48d,JSON['stringify'](_0x20efbd));_0x14de0e(_0x20efbd);})[_0x8ed7('0x16')](function(_0x2e8d88){logger['error'](_0x8ed7('0x1e'),_0x2e8d88['message'],_0x3ea48d);_0x1d1eab(_0x23147b[_0x8ed7('0x12')](0x1f4,_0x2e8d88[_0x8ed7('0x14')]));});});}; \ No newline at end of file +var _0xdf17=['../../mysqldb','rpc','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','body','options','UpdateSmsQueueReport','SmsQueueReport','raw','where','attributes','limit','stringify','lodash','moment','bluebird','ioredis'];(function(_0xa0a9fb,_0x583272){var _0x460f56=function(_0x57164f){while(--_0x57164f){_0xa0a9fb['push'](_0xa0a9fb['shift']());}};_0x460f56(++_0x583272);}(_0xdf17,0xd5));var _0x7df1=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xdf17[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x7df1('0x0'));var util=require('util');var moment=require(_0x7df1('0x1'));var BPromise=require(_0x7df1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7df1('0x3'));var db=require(_0x7df1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7df1('0x5'));var config=require(_0x7df1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7df1('0x7')][_0x7df1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1461cc,_0x158188,_0x299aec){return new BPromise(function(_0x3155da,_0xf323ba){return client[_0x7df1('0x9')](_0x1461cc,_0x299aec)[_0x7df1('0xa')](function(_0x51f70d){logger[_0x7df1('0xb')](_0x7df1('0xc'),_0x158188,_0x7df1('0xd'));logger[_0x7df1('0xe')](_0x7df1('0xf'),_0x158188,_0x7df1('0xd'),JSON['stringify'](_0x51f70d));if(_0x51f70d[_0x7df1('0x10')]){if(_0x51f70d[_0x7df1('0x10')][_0x7df1('0x11')]===0x1f4){logger[_0x7df1('0x10')](_0x7df1('0xc'),_0x158188,_0x51f70d['error'][_0x7df1('0x12')]);return _0xf323ba(_0x51f70d[_0x7df1('0x10')][_0x7df1('0x12')]);}logger[_0x7df1('0x10')](_0x7df1('0xc'),_0x158188,_0x51f70d[_0x7df1('0x10')][_0x7df1('0x12')]);return _0x3155da(_0x51f70d[_0x7df1('0x10')][_0x7df1('0x12')]);}else{logger[_0x7df1('0xb')](_0x7df1('0xc'),_0x158188,_0x7df1('0xd'));_0x3155da(_0x51f70d[_0x7df1('0x13')][_0x7df1('0x12')]);}})[_0x7df1('0x14')](function(_0x75efe1){logger[_0x7df1('0x10')](_0x7df1('0xc'),_0x158188,_0x75efe1);_0xf323ba(_0x75efe1);});});}exports[_0x7df1('0x15')]=function(_0x400cab){var _0x542c44=this;return new Promise(function(_0x3e99e7,_0x5c44ea){return db['SmsQueueReport']['create'](_0x400cab[_0x7df1('0x16')],{'raw':_0x400cab[_0x7df1('0x17')]?_0x400cab[_0x7df1('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7df1('0xa')](function(_0x2432e5){logger[_0x7df1('0xb')](_0x7df1('0x15'),_0x400cab);logger[_0x7df1('0xe')](_0x7df1('0x15'),_0x400cab,JSON['stringify'](_0x2432e5));_0x3e99e7(_0x2432e5);})[_0x7df1('0x14')](function(_0x2bf072){logger[_0x7df1('0x10')](_0x7df1('0x15'),_0x2bf072[_0x7df1('0x12')],_0x400cab);_0x5c44ea(_0x542c44[_0x7df1('0x10')](0x1f4,_0x2bf072['message']));});});};exports[_0x7df1('0x18')]=function(_0x46cc4c){var _0x116600=this;return new Promise(function(_0x34dec1,_0xb979f0){return db[_0x7df1('0x19')]['update'](_0x46cc4c[_0x7df1('0x16')],{'raw':_0x46cc4c[_0x7df1('0x17')]?_0x46cc4c[_0x7df1('0x17')][_0x7df1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46cc4c[_0x7df1('0x17')]?_0x46cc4c[_0x7df1('0x17')][_0x7df1('0x1b')]||null:null,'attributes':_0x46cc4c['options']?_0x46cc4c[_0x7df1('0x17')][_0x7df1('0x1c')]||null:null,'limit':_0x46cc4c[_0x7df1('0x17')]?_0x46cc4c[_0x7df1('0x17')][_0x7df1('0x1d')]||null:null})[_0x7df1('0xa')](function(_0x1ea72c){logger[_0x7df1('0xb')](_0x7df1('0x18'),_0x46cc4c);logger[_0x7df1('0xe')]('UpdateSmsQueueReport',_0x46cc4c,JSON[_0x7df1('0x1e')](_0x1ea72c));_0x34dec1(_0x1ea72c);})['catch'](function(_0x106c63){logger[_0x7df1('0x10')](_0x7df1('0x18'),_0x106c63[_0x7df1('0x12')],_0x46cc4c);_0xb979f0(_0x116600[_0x7df1('0x10')](0x1f4,_0x106c63[_0x7df1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 72b6641..940b7cf 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 _0x6c7b=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c7b,0x10b));var _0xb6c7=function(_0xeb72d0,_0x2eeee8){_0xeb72d0=_0xeb72d0-0x0;var _0x48a718=_0x6c7b[_0xeb72d0];return _0x48a718;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb6c7('0x1'));var router=express['Router']();var fs_extra=require(_0xb6c7('0x2'));var auth=require(_0xb6c7('0x3'));var interaction=require(_0xb6c7('0x4'));var config=require('../../config/environment');var controller=require(_0xb6c7('0x5'));router[_0xb6c7('0x6')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x8')]);router[_0xb6c7('0x6')]('/describe',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x9')]);router[_0xb6c7('0x6')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xb')]);router[_0xb6c7('0xc')]('/',auth[_0xb6c7('0x7')](),controller['create']);router['put'](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xd')]);router[_0xb6c7('0xe')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf120=['Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','show','post','put','/:id','update','delete','exports','util','path','connect-timeout'];(function(_0x30188f,_0x2bc726){var _0x14afa4=function(_0x234600){while(--_0x234600){_0x30188f['push'](_0x30188f['shift']());}};_0x14afa4(++_0x2bc726);}(_0xf120,0x179));var _0x0f12=function(_0x335a07,_0x27e488){_0x335a07=_0x335a07-0x0;var _0x57dcf7=_0xf120[_0x335a07];return _0x57dcf7;};'use strict';var multer=require('multer');var util=require(_0x0f12('0x0'));var path=require(_0x0f12('0x1'));var timeout=require(_0x0f12('0x2'));var express=require('express');var router=express[_0x0f12('0x3')]();var fs_extra=require(_0x0f12('0x4'));var auth=require(_0x0f12('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f12('0x6'));var controller=require(_0x0f12('0x7'));router[_0x0f12('0x8')]('/',auth[_0x0f12('0x9')](),controller[_0x0f12('0xa')]);router[_0x0f12('0x8')](_0x0f12('0xb'),auth[_0x0f12('0x9')](),controller['describe']);router[_0x0f12('0x8')]('/:id',auth[_0x0f12('0x9')](),controller[_0x0f12('0xc')]);router[_0x0f12('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0f12('0xe')](_0x0f12('0xf'),auth[_0x0f12('0x9')](),controller[_0x0f12('0x10')]);router[_0x0f12('0x11')](_0x0f12('0xf'),auth[_0x0f12('0x9')](),controller['destroy']);module[_0x0f12('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 2343db0..05f08c9 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2fd5f1,_0x51a172){var _0x5af6f6=function(_0xaad6bf){while(--_0xaad6bf){_0x2fd5f1['push'](_0x2fd5f1['shift']());}};_0x5af6f6(++_0x51a172);}(_0xaa88,0x137));var _0x8aa8=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xaa88[_0x3e69ae];return _0x3d7f42;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x33ced6,_0x5d94e8){var _0x51a10f=function(_0x40a6af){while(--_0x40a6af){_0x33ced6['push'](_0x33ced6['shift']());}};_0x51a10f(++_0x5d94e8);}(_0x70e0,0x17b));var _0x070e=function(_0x56781e,_0x3fd180){_0x56781e=_0x56781e-0x0;var _0x2cbab3=_0x70e0[_0x56781e];return _0x2cbab3;};'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 diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 135aa57..8ad8fe0 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 _0x3a22=['options','then','includeAll','include','findAll','rows','catch','params','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','apply','update','error','name','send','index','map','SmsTransferReport','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x3a22,0x1b6));var _0x23a2=function(_0x59071f,_0xceb977){_0x59071f=_0x59071f-0x0;var _0x4d7669=_0x3a22[_0x59071f];return _0x4d7669;};'use strict';var emlformat=require(_0x23a2('0x0'));var rimraf=require(_0x23a2('0x1'));var zipdir=require(_0x23a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x23a2('0x3'));var BPromise=require(_0x23a2('0x4'));var Mustache=require(_0x23a2('0x5'));var util=require(_0x23a2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x23a2('0x7'));var ejs=require(_0x23a2('0x8'));var fs=require('fs');var fs_extra=require(_0x23a2('0x9'));var _=require(_0x23a2('0xa'));var squel=require(_0x23a2('0xb'));var crypto=require('crypto');var jsforce=require(_0x23a2('0xc'));var deskjs=require(_0x23a2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x23a2('0xe'));var Papa=require(_0x23a2('0xf'));var Redis=require(_0x23a2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x23a2('0x11'));var as=require(_0x23a2('0x12'));var hardwareService=require(_0x23a2('0x13'));var logger=require(_0x23a2('0x14'))('api');var utils=require(_0x23a2('0x15'));var config=require(_0x23a2('0x16'));var licenseUtil=require(_0x23a2('0x17'));var db=require(_0x23a2('0x18'))['db'];function respondWithStatusCode(_0x50f735,_0x18262c){_0x18262c=_0x18262c||0xcc;return function(_0x3d81c4){if(_0x3d81c4){return _0x50f735[_0x23a2('0x19')](_0x18262c);}return _0x50f735['status'](_0x18262c)[_0x23a2('0x1a')]();};}function respondWithResult(_0x1fdcfd,_0x3dd59e){_0x3dd59e=_0x3dd59e||0xc8;return function(_0x2018c6){if(_0x2018c6){return _0x1fdcfd[_0x23a2('0x1b')](_0x3dd59e)['json'](_0x2018c6);}};}function respondWithFilteredResult(_0x33f82a,_0xae7f9f){return function(_0x491736){if(_0x491736){var _0x4bf555=typeof _0xae7f9f[_0x23a2('0x1c')]===_0x23a2('0x1d')&&typeof _0xae7f9f[_0x23a2('0x1e')]==='undefined';var _0x1b58f2=_0x491736['count'];var _0x2705a0=_0x4bf555?0x0:_0xae7f9f[_0x23a2('0x1c')];var _0x4924ee=_0x4bf555?_0x491736[_0x23a2('0x1f')]:_0xae7f9f[_0x23a2('0x1c')]+_0xae7f9f['limit'];var _0x57d395;if(_0x4924ee>=_0x1b58f2){_0x4924ee=_0x1b58f2;_0x57d395=0xc8;}else{_0x57d395=0xce;}_0x33f82a[_0x23a2('0x1b')](_0x57d395);return _0x33f82a[_0x23a2('0x20')]('Content-Range',_0x2705a0+'-'+_0x4924ee+'/'+_0x1b58f2)['json'](_0x491736);}return null;};}function patchUpdates(_0x8978b6){return function(_0x180b7a){try{jsonpatch[_0x23a2('0x21')](_0x180b7a,_0x8978b6,!![]);}catch(_0x5bd6cc){return BPromise['reject'](_0x5bd6cc);}return _0x180b7a['save']();};}function saveUpdates(_0x34b324,_0x19a24c){return function(_0x442c5b){if(_0x442c5b){return _0x442c5b[_0x23a2('0x22')](_0x34b324)['then'](function(_0x302e51){return _0x302e51;});}return null;};}function removeEntity(_0xf81687,_0xc3ff36){return function(_0x53c4ab){if(_0x53c4ab){return _0x53c4ab['destroy']()['then'](function(){_0xf81687[_0x23a2('0x1b')](0xcc)[_0x23a2('0x1a')]();});}};}function handleEntityNotFound(_0x3eb010,_0x28db7a){return function(_0xd4db84){if(!_0xd4db84){_0x3eb010[_0x23a2('0x19')](0x194);}return _0xd4db84;};}function handleError(_0x2b0d62,_0x42bf42){_0x42bf42=_0x42bf42||0x1f4;return function(_0x30b9c5){logger[_0x23a2('0x23')](_0x30b9c5['stack']);if(_0x30b9c5['name']){delete _0x30b9c5[_0x23a2('0x24')];}_0x2b0d62[_0x23a2('0x1b')](_0x42bf42)[_0x23a2('0x25')](_0x30b9c5);};}exports[_0x23a2('0x26')]=function(_0x3c6ee2,_0xc8ba29){var _0x5964f4={},_0x25a3b4={},_0x2571b4={'count':0x0,'rows':[]};var _0x2efb6d=_[_0x23a2('0x27')](db[_0x23a2('0x28')][_0x23a2('0x29')],function(_0x374843){return{'name':_0x374843['fieldName'],'type':_0x374843[_0x23a2('0x2a')]['key']};});_0x25a3b4['model']=_[_0x23a2('0x27')](_0x2efb6d,_0x23a2('0x24'));_0x25a3b4[_0x23a2('0x2b')]=_[_0x23a2('0x2c')](_0x3c6ee2[_0x23a2('0x2b')]);_0x25a3b4[_0x23a2('0x2d')]=_[_0x23a2('0x2e')](_0x25a3b4[_0x23a2('0x2f')],_0x25a3b4[_0x23a2('0x2b')]);_0x5964f4['attributes']=_[_0x23a2('0x2e')](_0x25a3b4[_0x23a2('0x2f')],qs[_0x23a2('0x30')](_0x3c6ee2['query'][_0x23a2('0x30')]));_0x5964f4[_0x23a2('0x31')]=_0x5964f4[_0x23a2('0x31')][_0x23a2('0x32')]?_0x5964f4[_0x23a2('0x31')]:_0x25a3b4['model'];if(!_0x3c6ee2[_0x23a2('0x2b')][_0x23a2('0x33')](_0x23a2('0x34'))){_0x5964f4[_0x23a2('0x1e')]=qs['limit'](_0x3c6ee2['query'][_0x23a2('0x1e')]);_0x5964f4[_0x23a2('0x1c')]=qs['offset'](_0x3c6ee2[_0x23a2('0x2b')]['offset']);}_0x5964f4[_0x23a2('0x35')]=qs[_0x23a2('0x36')](_0x3c6ee2['query'][_0x23a2('0x36')]);_0x5964f4[_0x23a2('0x37')]=qs[_0x23a2('0x2d')](_[_0x23a2('0x38')](_0x3c6ee2[_0x23a2('0x2b')],_0x25a3b4[_0x23a2('0x2d')]),_0x2efb6d);if(_0x3c6ee2[_0x23a2('0x2b')][_0x23a2('0x39')]){_0x5964f4['where']=_[_0x23a2('0x3a')](_0x5964f4[_0x23a2('0x37')],{'$or':_[_0x23a2('0x27')](_0x2efb6d,function(_0x19264c){if(_0x19264c['type']!=='VIRTUAL'){var _0x57a286={};_0x57a286[_0x19264c[_0x23a2('0x24')]]={'$like':'%'+_0x3c6ee2[_0x23a2('0x2b')]['filter']+'%'};return _0x57a286;}})});}_0x5964f4=_['merge']({},_0x5964f4,_0x3c6ee2[_0x23a2('0x3b')]);var _0x342efd={'where':_0x5964f4[_0x23a2('0x37')]};return db[_0x23a2('0x28')][_0x23a2('0x1f')](_0x342efd)[_0x23a2('0x3c')](function(_0x378f3e){_0x2571b4[_0x23a2('0x1f')]=_0x378f3e;if(_0x3c6ee2[_0x23a2('0x2b')][_0x23a2('0x3d')]){_0x5964f4[_0x23a2('0x3e')]=[{'all':!![]}];}return db[_0x23a2('0x28')][_0x23a2('0x3f')](_0x5964f4);})['then'](function(_0x4d13e0){_0x2571b4[_0x23a2('0x40')]=_0x4d13e0;return _0x2571b4;})['then'](respondWithFilteredResult(_0xc8ba29,_0x5964f4))[_0x23a2('0x41')](handleError(_0xc8ba29,null));};exports['show']=function(_0x253a6f,_0x319fcd){var _0x44acc7={'raw':!![],'where':{'id':_0x253a6f[_0x23a2('0x42')]['id']}},_0x130858={};_0x130858[_0x23a2('0x2f')]=_[_0x23a2('0x2c')](db[_0x23a2('0x28')][_0x23a2('0x29')]);_0x130858[_0x23a2('0x2b')]=_['keys'](_0x253a6f[_0x23a2('0x2b')]);_0x130858[_0x23a2('0x2d')]=_['intersection'](_0x130858[_0x23a2('0x2f')],_0x130858['query']);_0x44acc7['attributes']=_[_0x23a2('0x2e')](_0x130858[_0x23a2('0x2f')],qs['fields'](_0x253a6f[_0x23a2('0x2b')]['fields']));_0x44acc7['attributes']=_0x44acc7[_0x23a2('0x31')]['length']?_0x44acc7['attributes']:_0x130858['model'];if(_0x253a6f[_0x23a2('0x2b')]['includeAll']){_0x44acc7[_0x23a2('0x3e')]=[{'all':!![]}];}_0x44acc7=_[_0x23a2('0x3a')]({},_0x44acc7,_0x253a6f['options']);return db[_0x23a2('0x28')]['find'](_0x44acc7)['then'](handleEntityNotFound(_0x319fcd,null))['then'](respondWithResult(_0x319fcd,null))[_0x23a2('0x41')](handleError(_0x319fcd,null));};exports[_0x23a2('0x43')]=function(_0x5e902c,_0x1efd94){return db[_0x23a2('0x28')][_0x23a2('0x43')](_0x5e902c['body'],{})[_0x23a2('0x3c')](respondWithResult(_0x1efd94,0xc9))[_0x23a2('0x41')](handleError(_0x1efd94,null));};exports[_0x23a2('0x22')]=function(_0x81d182,_0x1af5fe){if(_0x81d182[_0x23a2('0x44')]['id']){delete _0x81d182[_0x23a2('0x44')]['id'];}return db[_0x23a2('0x28')]['find']({'where':{'id':_0x81d182[_0x23a2('0x42')]['id']}})[_0x23a2('0x3c')](handleEntityNotFound(_0x1af5fe,null))[_0x23a2('0x3c')](saveUpdates(_0x81d182['body'],null))[_0x23a2('0x3c')](respondWithResult(_0x1af5fe,null))[_0x23a2('0x41')](handleError(_0x1af5fe,null));};exports[_0x23a2('0x45')]=function(_0x523c0b,_0x562b8a){return db['SmsTransferReport']['find']({'where':{'id':_0x523c0b['params']['id']}})[_0x23a2('0x3c')](handleEntityNotFound(_0x562b8a,null))['then'](removeEntity(_0x562b8a,null))[_0x23a2('0x41')](handleError(_0x562b8a,null));};exports['describe']=function(_0x47adf9,_0x1b1fc5){return db[_0x23a2('0x28')][_0x23a2('0x46')]()[_0x23a2('0x3c')](respondWithResult(_0x1b1fc5,null))[_0x23a2('0x41')](handleError(_0x1b1fc5,null));}; \ No newline at end of file +var _0x6a7c=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1f9923,_0x1f2419){var _0x4ddcba=function(_0x592dd0){while(--_0x592dd0){_0x1f9923['push'](_0x1f9923['shift']());}};_0x4ddcba(++_0x1f2419);}(_0x6a7c,0x11c));var _0xc6a7=function(_0x27f473,_0x21bab7){_0x27f473=_0x27f473-0x0;var _0x3f09d7=_0x6a7c[_0x27f473];return _0x3f09d7;};'use strict';var emlformat=require(_0xc6a7('0x0'));var rimraf=require(_0xc6a7('0x1'));var zipdir=require(_0xc6a7('0x2'));var jsonpatch=require(_0xc6a7('0x3'));var rp=require(_0xc6a7('0x4'));var moment=require(_0xc6a7('0x5'));var BPromise=require(_0xc6a7('0x6'));var Mustache=require(_0xc6a7('0x7'));var util=require('util');var path=require(_0xc6a7('0x8'));var sox=require('sox');var csv=require(_0xc6a7('0x9'));var ejs=require(_0xc6a7('0xa'));var fs=require('fs');var fs_extra=require(_0xc6a7('0xb'));var _=require(_0xc6a7('0xc'));var squel=require(_0xc6a7('0xd'));var crypto=require('crypto');var jsforce=require(_0xc6a7('0xe'));var deskjs=require(_0xc6a7('0xf'));var toCsv=require(_0xc6a7('0x9'));var querystring=require(_0xc6a7('0x10'));var Papa=require(_0xc6a7('0x11'));var Redis=require(_0xc6a7('0x12'));var authService=require(_0xc6a7('0x13'));var qs=require(_0xc6a7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6a7('0x15'));var logger=require(_0xc6a7('0x16'))(_0xc6a7('0x17'));var utils=require(_0xc6a7('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc6a7('0x19'))['db'];function respondWithStatusCode(_0x4a47e7,_0x2c1df2){_0x2c1df2=_0x2c1df2||0xcc;return function(_0x4f13f3){if(_0x4f13f3){return _0x4a47e7[_0xc6a7('0x1a')](_0x2c1df2);}return _0x4a47e7[_0xc6a7('0x1b')](_0x2c1df2)['end']();};}function respondWithResult(_0x1a0280,_0x7746c6){_0x7746c6=_0x7746c6||0xc8;return function(_0x44adb5){if(_0x44adb5){return _0x1a0280[_0xc6a7('0x1b')](_0x7746c6)['json'](_0x44adb5);}};}function respondWithFilteredResult(_0x247f1f,_0xd46d52){return function(_0x57fe7c){if(_0x57fe7c){var _0x1ae647=typeof _0xd46d52[_0xc6a7('0x1c')]===_0xc6a7('0x1d')&&typeof _0xd46d52[_0xc6a7('0x1e')]===_0xc6a7('0x1d');var _0x3b5b8c=_0x57fe7c[_0xc6a7('0x1f')];var _0x14b2c7=_0x1ae647?0x0:_0xd46d52[_0xc6a7('0x1c')];var _0x6837a3=_0x1ae647?_0x57fe7c['count']:_0xd46d52['offset']+_0xd46d52[_0xc6a7('0x1e')];var _0x4b678f;if(_0x6837a3>=_0x3b5b8c){_0x6837a3=_0x3b5b8c;_0x4b678f=0xc8;}else{_0x4b678f=0xce;}_0x247f1f[_0xc6a7('0x1b')](_0x4b678f);return _0x247f1f['set']('Content-Range',_0x14b2c7+'-'+_0x6837a3+'/'+_0x3b5b8c)[_0xc6a7('0x20')](_0x57fe7c);}return null;};}function patchUpdates(_0x3b59f1){return function(_0x3b51ec){try{jsonpatch[_0xc6a7('0x21')](_0x3b51ec,_0x3b59f1,!![]);}catch(_0x4fd745){return BPromise[_0xc6a7('0x22')](_0x4fd745);}return _0x3b51ec[_0xc6a7('0x23')]();};}function saveUpdates(_0x1a78d4,_0x4d300f){return function(_0x40b02b){if(_0x40b02b){return _0x40b02b[_0xc6a7('0x24')](_0x1a78d4)[_0xc6a7('0x25')](function(_0x58482d){return _0x58482d;});}return null;};}function removeEntity(_0x2de289,_0x21e6aa){return function(_0x2bd7b4){if(_0x2bd7b4){return _0x2bd7b4[_0xc6a7('0x26')]()[_0xc6a7('0x25')](function(){_0x2de289[_0xc6a7('0x1b')](0xcc)[_0xc6a7('0x27')]();});}};}function handleEntityNotFound(_0x130d23,_0x25aa18){return function(_0x31a392){if(!_0x31a392){_0x130d23[_0xc6a7('0x1a')](0x194);}return _0x31a392;};}function handleError(_0x4844b9,_0x2af7d8){_0x2af7d8=_0x2af7d8||0x1f4;return function(_0x1cd529){logger[_0xc6a7('0x28')](_0x1cd529[_0xc6a7('0x29')]);if(_0x1cd529[_0xc6a7('0x2a')]){delete _0x1cd529[_0xc6a7('0x2a')];}_0x4844b9['status'](_0x2af7d8)[_0xc6a7('0x2b')](_0x1cd529);};}exports[_0xc6a7('0x2c')]=function(_0x3020b0,_0x144b67){var _0x29d13e={},_0x1009e8={},_0x2ad631={'count':0x0,'rows':[]};var _0x3af9e0=_[_0xc6a7('0x2d')](db[_0xc6a7('0x2e')][_0xc6a7('0x2f')],function(_0x453997){return{'name':_0x453997[_0xc6a7('0x30')],'type':_0x453997[_0xc6a7('0x31')][_0xc6a7('0x32')]};});_0x1009e8[_0xc6a7('0x33')]=_[_0xc6a7('0x2d')](_0x3af9e0,_0xc6a7('0x2a'));_0x1009e8[_0xc6a7('0x34')]=_[_0xc6a7('0x35')](_0x3020b0[_0xc6a7('0x34')]);_0x1009e8[_0xc6a7('0x36')]=_['intersection'](_0x1009e8['model'],_0x1009e8['query']);_0x29d13e[_0xc6a7('0x37')]=_['intersection'](_0x1009e8[_0xc6a7('0x33')],qs['fields'](_0x3020b0[_0xc6a7('0x34')][_0xc6a7('0x38')]));_0x29d13e[_0xc6a7('0x37')]=_0x29d13e['attributes']['length']?_0x29d13e[_0xc6a7('0x37')]:_0x1009e8['model'];if(!_0x3020b0['query'][_0xc6a7('0x39')]('nolimit')){_0x29d13e[_0xc6a7('0x1e')]=qs[_0xc6a7('0x1e')](_0x3020b0[_0xc6a7('0x34')]['limit']);_0x29d13e[_0xc6a7('0x1c')]=qs[_0xc6a7('0x1c')](_0x3020b0[_0xc6a7('0x34')][_0xc6a7('0x1c')]);}_0x29d13e[_0xc6a7('0x3a')]=qs[_0xc6a7('0x3b')](_0x3020b0[_0xc6a7('0x34')][_0xc6a7('0x3b')]);_0x29d13e[_0xc6a7('0x3c')]=qs['filters'](_[_0xc6a7('0x3d')](_0x3020b0[_0xc6a7('0x34')],_0x1009e8[_0xc6a7('0x36')]),_0x3af9e0);if(_0x3020b0[_0xc6a7('0x34')][_0xc6a7('0x3e')]){_0x29d13e['where']=_[_0xc6a7('0x3f')](_0x29d13e[_0xc6a7('0x3c')],{'$or':_['map'](_0x3af9e0,function(_0x55aeb5){if(_0x55aeb5['type']!=='VIRTUAL'){var _0x42b8ce={};_0x42b8ce[_0x55aeb5[_0xc6a7('0x2a')]]={'$like':'%'+_0x3020b0[_0xc6a7('0x34')][_0xc6a7('0x3e')]+'%'};return _0x42b8ce;}})});}_0x29d13e=_[_0xc6a7('0x3f')]({},_0x29d13e,_0x3020b0[_0xc6a7('0x40')]);var _0x46d2c2={'where':_0x29d13e['where']};return db[_0xc6a7('0x2e')][_0xc6a7('0x1f')](_0x46d2c2)[_0xc6a7('0x25')](function(_0xae4d1a){_0x2ad631['count']=_0xae4d1a;if(_0x3020b0[_0xc6a7('0x34')][_0xc6a7('0x41')]){_0x29d13e[_0xc6a7('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xc6a7('0x43')](_0x29d13e);})[_0xc6a7('0x25')](function(_0x16699c){_0x2ad631['rows']=_0x16699c;return _0x2ad631;})['then'](respondWithFilteredResult(_0x144b67,_0x29d13e))[_0xc6a7('0x44')](handleError(_0x144b67,null));};exports[_0xc6a7('0x45')]=function(_0x4d7b83,_0x9c740){var _0x321af9={'raw':!![],'where':{'id':_0x4d7b83[_0xc6a7('0x46')]['id']}},_0x321c40={};_0x321c40[_0xc6a7('0x33')]=_[_0xc6a7('0x35')](db['SmsTransferReport'][_0xc6a7('0x2f')]);_0x321c40[_0xc6a7('0x34')]=_[_0xc6a7('0x35')](_0x4d7b83['query']);_0x321c40[_0xc6a7('0x36')]=_['intersection'](_0x321c40[_0xc6a7('0x33')],_0x321c40[_0xc6a7('0x34')]);_0x321af9[_0xc6a7('0x37')]=_['intersection'](_0x321c40[_0xc6a7('0x33')],qs['fields'](_0x4d7b83[_0xc6a7('0x34')][_0xc6a7('0x38')]));_0x321af9[_0xc6a7('0x37')]=_0x321af9[_0xc6a7('0x37')][_0xc6a7('0x47')]?_0x321af9['attributes']:_0x321c40[_0xc6a7('0x33')];if(_0x4d7b83['query']['includeAll']){_0x321af9[_0xc6a7('0x42')]=[{'all':!![]}];}_0x321af9=_[_0xc6a7('0x3f')]({},_0x321af9,_0x4d7b83['options']);return db[_0xc6a7('0x2e')]['find'](_0x321af9)[_0xc6a7('0x25')](handleEntityNotFound(_0x9c740,null))[_0xc6a7('0x25')](respondWithResult(_0x9c740,null))[_0xc6a7('0x44')](handleError(_0x9c740,null));};exports[_0xc6a7('0x48')]=function(_0xd3052e,_0x6a386c){return db['SmsTransferReport']['create'](_0xd3052e[_0xc6a7('0x49')],{})[_0xc6a7('0x25')](respondWithResult(_0x6a386c,0xc9))[_0xc6a7('0x44')](handleError(_0x6a386c,null));};exports[_0xc6a7('0x24')]=function(_0xb951ae,_0x31b208){if(_0xb951ae[_0xc6a7('0x49')]['id']){delete _0xb951ae[_0xc6a7('0x49')]['id'];}return db[_0xc6a7('0x2e')][_0xc6a7('0x4a')]({'where':{'id':_0xb951ae[_0xc6a7('0x46')]['id']}})[_0xc6a7('0x25')](handleEntityNotFound(_0x31b208,null))['then'](saveUpdates(_0xb951ae['body'],null))[_0xc6a7('0x25')](respondWithResult(_0x31b208,null))['catch'](handleError(_0x31b208,null));};exports[_0xc6a7('0x26')]=function(_0x583173,_0x510b74){return db['SmsTransferReport'][_0xc6a7('0x4a')]({'where':{'id':_0x583173[_0xc6a7('0x46')]['id']}})[_0xc6a7('0x25')](handleEntityNotFound(_0x510b74,null))[_0xc6a7('0x25')](removeEntity(_0x510b74,null))[_0xc6a7('0x44')](handleError(_0x510b74,null));};exports[_0xc6a7('0x4b')]=function(_0x2a2987,_0x3d0565){return db['SmsTransferReport'][_0xc6a7('0x4b')]()[_0xc6a7('0x25')](respondWithResult(_0x3d0565,null))[_0xc6a7('0x44')](handleError(_0x3d0565,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index fc9f372..875f8ec 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 _0x17da=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','uniqueid','lodash','util'];(function(_0x49860e,_0x53c289){var _0x38bbf4=function(_0x12207c){while(--_0x12207c){_0x49860e['push'](_0x49860e['shift']());}};_0x38bbf4(++_0x53c289);}(_0x17da,0x18a));var _0xa17d=function(_0x5cf904,_0x5be2d6){_0x5cf904=_0x5cf904-0x0;var _0x35b67f=_0x17da[_0x5cf904];return _0x35b67f;};'use strict';var _=require(_0xa17d('0x0'));var util=require(_0xa17d('0x1'));var logger=require(_0xa17d('0x2'))(_0xa17d('0x3'));var moment=require(_0xa17d('0x4'));var BPromise=require('bluebird');var rp=require(_0xa17d('0x5'));var fs=require('fs');var path=require(_0xa17d('0x6'));var rimraf=require(_0xa17d('0x7'));var config=require(_0xa17d('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0xa17d('0x9')]=function(_0x29d7c8,_0x5314f7){return _0x29d7c8[_0xa17d('0xa')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xa17d('0xb'),'fields':[_0xa17d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa03c=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x55448c,_0x174be9){var _0x3b6b3a=function(_0x1ac9e0){while(--_0x1ac9e0){_0x55448c['push'](_0x55448c['shift']());}};_0x3b6b3a(++_0x174be9);}(_0xa03c,0x143));var _0xca03=function(_0x461058,_0x4db6b8){_0x461058=_0x461058-0x0;var _0x571917=_0xa03c[_0x461058];return _0x571917;};'use strict';var _=require(_0xca03('0x0'));var util=require(_0xca03('0x1'));var logger=require(_0xca03('0x2'))(_0xca03('0x3'));var moment=require(_0xca03('0x4'));var BPromise=require(_0xca03('0x5'));var rp=require(_0xca03('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xca03('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x3235ac,_0x54a2c8){return _0x3235ac[_0xca03('0x8')](_0xca03('0x9'),attributes,{'tableName':_0xca03('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xca03('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3e469c9..363ba34 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 _0x8403=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x482b42,_0x4f388c){var _0xdfd487=function(_0x88f016){while(--_0x88f016){_0x482b42['push'](_0x482b42['shift']());}};_0xdfd487(++_0x4f388c);}(_0x8403,0x1a5));var _0x3840=function(_0x135e5e,_0x5a2868){_0x135e5e=_0x135e5e-0x0;var _0x3c5bf9=_0x8403[_0x135e5e];return _0x3c5bf9;};'use strict';var _=require(_0x3840('0x0'));var util=require(_0x3840('0x1'));var moment=require(_0x3840('0x2'));var BPromise=require(_0x3840('0x3'));var rs=require(_0x3840('0x4'));var fs=require('fs');var Redis=require(_0x3840('0x5'));var db=require(_0x3840('0x6'))['db'];var utils=require(_0x3840('0x7'));var logger=require(_0x3840('0x8'))('rpc');var config=require(_0x3840('0x9'));var jayson=require(_0x3840('0xa'));var client=jayson[_0x3840('0xb')][_0x3840('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fcfd8,_0x45d17c,_0x59923c){return new BPromise(function(_0x5aa2c4,_0x339366){return client[_0x3840('0xd')](_0x1fcfd8,_0x59923c)[_0x3840('0xe')](function(_0x5351e8){logger['info'](_0x3840('0xf'),_0x45d17c,_0x3840('0x10'));logger[_0x3840('0x11')](_0x3840('0x12'),_0x45d17c,_0x3840('0x10'),JSON[_0x3840('0x13')](_0x5351e8));if(_0x5351e8[_0x3840('0x14')]){if(_0x5351e8[_0x3840('0x14')][_0x3840('0x15')]===0x1f4){logger[_0x3840('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x45d17c,_0x5351e8[_0x3840('0x14')][_0x3840('0x16')]);return _0x339366(_0x5351e8[_0x3840('0x14')]['message']);}logger[_0x3840('0x14')](_0x3840('0xf'),_0x45d17c,_0x5351e8['error'][_0x3840('0x16')]);return _0x5aa2c4(_0x5351e8[_0x3840('0x14')][_0x3840('0x16')]);}else{logger[_0x3840('0x17')](_0x3840('0xf'),_0x45d17c,_0x3840('0x10'));_0x5aa2c4(_0x5351e8[_0x3840('0x18')][_0x3840('0x16')]);}})[_0x3840('0x19')](function(_0x741d23){logger[_0x3840('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x45d17c,_0x741d23);_0x339366(_0x741d23);});});} \ No newline at end of file +var _0x26d1=['SmsTransferReport,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x26d1,0x8e));var _0x126d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x26d1[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var moment=require(_0x126d('0x1'));var BPromise=require(_0x126d('0x2'));var rs=require(_0x126d('0x3'));var fs=require('fs');var Redis=require(_0x126d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x126d('0x5'))('rpc');var config=require(_0x126d('0x6'));var jayson=require(_0x126d('0x7'));var client=jayson[_0x126d('0x8')][_0x126d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4dfc,_0x4e5e87,_0x2e668c){return new BPromise(function(_0x25ccc2,_0x7d6e4c){return client[_0x126d('0xa')](_0x2b4dfc,_0x2e668c)[_0x126d('0xb')](function(_0x1cf6fb){logger[_0x126d('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4e5e87,_0x126d('0xd'));logger[_0x126d('0xe')](_0x126d('0xf'),_0x4e5e87,_0x126d('0xd'),JSON[_0x126d('0x10')](_0x1cf6fb));if(_0x1cf6fb['error']){if(_0x1cf6fb[_0x126d('0x11')]['code']===0x1f4){logger[_0x126d('0x11')](_0x126d('0x12'),_0x4e5e87,_0x1cf6fb[_0x126d('0x11')]['message']);return _0x7d6e4c(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}logger[_0x126d('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x4e5e87,_0x1cf6fb['error'][_0x126d('0x13')]);return _0x25ccc2(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}else{logger[_0x126d('0xc')](_0x126d('0x12'),_0x4e5e87,_0x126d('0xd'));_0x25ccc2(_0x1cf6fb['result'][_0x126d('0x13')]);}})['catch'](function(_0x352d72){logger['error'](_0x126d('0x12'),_0x4e5e87,_0x352d72);_0x7d6e4c(_0x352d72);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index c522093..17bf557 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 _0xfebc=['join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','put','update','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download'];(function(_0x89bde,_0x4c9f88){var _0xb11164=function(_0x3841b8){while(--_0x3841b8){_0x89bde['push'](_0x89bde['shift']());}};_0xb11164(++_0x4c9f88);}(_0xfebc,0x16d));var _0xcfeb=function(_0x207696,_0x1cf674){_0x207696=_0x207696-0x0;var _0x4060f3=_0xfebc[_0x207696];return _0x4060f3;};'use strict';var multer=require(_0xcfeb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcfeb('0x1'));var router=express[_0xcfeb('0x2')]();var fs_extra=require(_0xcfeb('0x3'));var auth=require(_0xcfeb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcfeb('0x5'));var controller=require(_0xcfeb('0x6'));router[_0xcfeb('0x7')]('/',auth[_0xcfeb('0x8')](),controller[_0xcfeb('0x9')]);router[_0xcfeb('0x7')](_0xcfeb('0xa'),auth[_0xcfeb('0x8')](),controller['show']);router['get'](_0xcfeb('0xb'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a4d6,_0x43342e,_0x3b1d5e){_0x3b1d5e(null,path[_0xcfeb('0xc')](config[_0xcfeb('0xd')],_0xcfeb('0xe')));},'filename':function(_0x57c24a,_0x51b223,_0x63b0c8){_0x51b223[_0xcfeb('0xf')]=_0x51b223['originalname'][_0xcfeb('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x63b0c8(null,util[_0xcfeb('0x11')](_0xcfeb('0x12'),path[_0xcfeb('0x13')](_0x51b223[_0xcfeb('0xf')],path[_0xcfeb('0x14')](_0x51b223[_0xcfeb('0xf')])),Date[_0xcfeb('0x15')](),path['extname'](_0x51b223[_0xcfeb('0xf')])));}})});router[_0xcfeb('0x16')]('/',upload[_0xcfeb('0x17')](_0xcfeb('0x18')),controller['create']);router[_0xcfeb('0x19')](_0xcfeb('0xa'),auth[_0xcfeb('0x8')](),controller[_0xcfeb('0x1a')]);router['delete'](_0xcfeb('0xa'),auth[_0xcfeb('0x8')](),controller[_0xcfeb('0x1b')]);module[_0xcfeb('0x1c')]=router; \ No newline at end of file +var _0x0395=['now','post','file','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','show','isAuthenticated','download','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname'];(function(_0x4e7bad,_0x3d5983){var _0x161c5f=function(_0x1f5611){while(--_0x1f5611){_0x4e7bad['push'](_0x4e7bad['shift']());}};_0x161c5f(++_0x3d5983);}(_0x0395,0x180));var _0x5039=function(_0x9f48e6,_0x8f87aa){_0x9f48e6=_0x9f48e6-0x0;var _0x45fc5c=_0x0395[_0x9f48e6];return _0x45fc5c;};'use strict';var multer=require(_0x5039('0x0'));var util=require(_0x5039('0x1'));var path=require('path');var timeout=require(_0x5039('0x2'));var express=require(_0x5039('0x3'));var router=express[_0x5039('0x4')]();var fs_extra=require(_0x5039('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5039('0x6'));var config=require(_0x5039('0x7'));var controller=require('./sound.controller');router[_0x5039('0x8')]('/',auth['isAuthenticated'](),controller[_0x5039('0x9')]);router['get'](_0x5039('0xa'),auth['isAuthenticated'](),controller[_0x5039('0xb')]);router[_0x5039('0x8')]('/:id/download',auth[_0x5039('0xc')](),controller[_0x5039('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a5081,_0x5095b3,_0x44e835){_0x44e835(null,path['join'](config[_0x5039('0xe')],_0x5039('0xf')));},'filename':function(_0x445656,_0x210c00,_0x59a8d1){_0x210c00[_0x5039('0x10')]=_0x210c00['originalname'][_0x5039('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59a8d1(null,util[_0x5039('0x12')](_0x5039('0x13'),path[_0x5039('0x14')](_0x210c00['originalname'],path[_0x5039('0x15')](_0x210c00['originalname'])),Date[_0x5039('0x16')](),path['extname'](_0x210c00[_0x5039('0x10')])));}})});router[_0x5039('0x17')]('/',upload['single'](_0x5039('0x18')),controller[_0x5039('0x19')]);router['put']('/:id',auth[_0x5039('0xc')](),controller[_0x5039('0x1a')]);router[_0x5039('0x1b')](_0x5039('0xa'),auth[_0x5039('0xc')](),controller['delete']);module[_0x5039('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 94f2a0a..0303cce 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 _0xc5af=['exports','STRING','name','INTEGER','BIGINT','sequelize'];(function(_0x43e1e4,_0x8c388a){var _0x41bcc2=function(_0x58fd5b){while(--_0x58fd5b){_0x43e1e4['push'](_0x43e1e4['shift']());}};_0x41bcc2(++_0x8c388a);}(_0xc5af,0x155));var _0xfc5a=function(_0x3692a1,_0x42752a){_0x3692a1=_0x3692a1-0x0;var _0x16d985=_0xc5af[_0x3692a1];return _0x16d985;};'use strict';var Sequelize=require(_0xfc5a('0x0'));module[_0xfc5a('0x1')]={'name':{'type':Sequelize[_0xfc5a('0x2')],'unique':_0xfc5a('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xfc5a('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xfc5a('0x2')]},'original_format':{'type':Sequelize[_0xfc5a('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xfc5a('0x4')]},'original_bitRate':{'type':Sequelize[_0xfc5a('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xfc5a('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xfc5a('0x5')]},'converted_channelCount':{'type':Sequelize[_0xfc5a('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc360=['BIGINT','STRING','name','FLOAT','INTEGER'];(function(_0x5291c8,_0x3b0c49){var _0x56b9e5=function(_0x3b2ea7){while(--_0x3b2ea7){_0x5291c8['push'](_0x5291c8['shift']());}};_0x56b9e5(++_0x3b0c49);}(_0xc360,0x15f));var _0x0c36=function(_0x65958c,_0x5e7354){_0x65958c=_0x65958c-0x0;var _0x9800c3=_0xc360[_0x65958c];return _0x9800c3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c36('0x0')],'unique':_0x0c36('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0c36('0x0')]},'display_name':{'type':Sequelize[_0x0c36('0x0')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x0c36('0x0')]},'original_duration':{'type':Sequelize[_0x0c36('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x0c36('0x3')]},'original_bitRate':{'type':Sequelize[_0x0c36('0x4')]},'original_sampleRate':{'type':Sequelize[_0x0c36('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x0c36('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x0c36('0x4')]},'converted_channelCount':{'type':Sequelize[_0x0c36('0x3')]},'converted_bitRate':{'type':Sequelize[_0x0c36('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x0c36('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 51f0fca..57b456e 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 _0x5454=['save_name','converted_format','join','root','server/files/sounds/converted','ValidationError','format','%s.%s','create','basename','file','originalname','extname','filename','wav','info','Sound\x20upload\x20filepath:\x20%s','0777','unlinkSync','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','sampleRate','chmodSync','body','role','user','userProfileId','autoAssociation','catch','start','description','delete','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','find','download'];(function(_0x4fd9b3,_0x4d5381){var _0x44cbb2=function(_0x39e247){while(--_0x39e247){_0x4fd9b3['push'](_0x4fd9b3['shift']());}};_0x44cbb2(++_0x4d5381);}(_0x5454,0x191));var _0x4545=function(_0x99ddcd,_0x36ed25){_0x99ddcd=_0x99ddcd-0x0;var _0x35a144=_0x5454[_0x99ddcd];return _0x35a144;};'use strict';var emlformat=require(_0x4545('0x0'));var rimraf=require(_0x4545('0x1'));var zipdir=require(_0x4545('0x2'));var jsonpatch=require(_0x4545('0x3'));var rp=require(_0x4545('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4545('0x5'));var util=require(_0x4545('0x6'));var path=require(_0x4545('0x7'));var sox=require(_0x4545('0x8'));var csv=require(_0x4545('0x9'));var ejs=require(_0x4545('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4545('0xb'));var crypto=require(_0x4545('0xc'));var jsforce=require(_0x4545('0xd'));var deskjs=require(_0x4545('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4545('0xf'));var Papa=require(_0x4545('0x10'));var Redis=require(_0x4545('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4545('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4545('0x13'))(_0x4545('0x14'));var utils=require('../../config/utils');var config=require(_0x4545('0x15'));var licenseUtil=require(_0x4545('0x16'));var db=require(_0x4545('0x17'))['db'];function respondWithStatusCode(_0x305bdc,_0x1d4be1){_0x1d4be1=_0x1d4be1||0xcc;return function(_0x3e97f1){if(_0x3e97f1){return _0x305bdc['sendStatus'](_0x1d4be1);}return _0x305bdc['status'](_0x1d4be1)[_0x4545('0x18')]();};}function respondWithResult(_0x5767c6,_0xcbd2bd){_0xcbd2bd=_0xcbd2bd||0xc8;return function(_0x4d0f00){if(_0x4d0f00){return _0x5767c6[_0x4545('0x19')](_0xcbd2bd)[_0x4545('0x1a')](_0x4d0f00);}};}function respondWithFilteredResult(_0x96b983,_0x28082e){return function(_0x259965){if(_0x259965){var _0x105f6b=typeof _0x28082e[_0x4545('0x1b')]==='undefined'&&typeof _0x28082e[_0x4545('0x1c')]==='undefined';var _0x50f455=_0x259965['count'];var _0x514e8d=_0x105f6b?0x0:_0x28082e[_0x4545('0x1b')];var _0x264fa5=_0x105f6b?_0x259965[_0x4545('0x1d')]:_0x28082e[_0x4545('0x1b')]+_0x28082e[_0x4545('0x1c')];var _0x42398d;if(_0x264fa5>=_0x50f455){_0x264fa5=_0x50f455;_0x42398d=0xc8;}else{_0x42398d=0xce;}_0x96b983['status'](_0x42398d);return _0x96b983['set'](_0x4545('0x1e'),_0x514e8d+'-'+_0x264fa5+'/'+_0x50f455)[_0x4545('0x1a')](_0x259965);}return null;};}function patchUpdates(_0x7e97d5){return function(_0x2227de){try{jsonpatch[_0x4545('0x1f')](_0x2227de,_0x7e97d5,!![]);}catch(_0x484727){return BPromise[_0x4545('0x20')](_0x484727);}return _0x2227de[_0x4545('0x21')]();};}function saveUpdates(_0x39ef20,_0x194c29){return function(_0x1ae104){if(_0x1ae104){return _0x1ae104[_0x4545('0x22')](_0x39ef20)[_0x4545('0x23')](function(_0x4574b1){return _0x4574b1;});}return null;};}function removeEntity(_0x36c8f6,_0x4ad6f9){return function(_0x2fec52){if(_0x2fec52){return _0x2fec52[_0x4545('0x24')]()[_0x4545('0x23')](function(){var _0x178be1=_0x2fec52[_0x4545('0x25')]({'plain':!![]});var _0x5aa696=_0x4545('0x26');return db[_0x4545('0x27')][_0x4545('0x24')]({'where':{'type':_0x5aa696,'resourceId':_0x178be1['id']}})[_0x4545('0x23')](function(){return _0x2fec52;});})[_0x4545('0x23')](function(){_0x36c8f6[_0x4545('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3fae,_0x3b82f7){return function(_0x2ad40b){if(!_0x2ad40b){_0x4b3fae[_0x4545('0x28')](0x194);}return _0x2ad40b;};}function handleError(_0x471764,_0x2f02ae){_0x2f02ae=_0x2f02ae||0x1f4;return function(_0x4e1105){logger[_0x4545('0x29')](_0x4e1105[_0x4545('0x2a')]);if(_0x4e1105[_0x4545('0x2b')]){delete _0x4e1105[_0x4545('0x2b')];}_0x471764[_0x4545('0x19')](_0x2f02ae)[_0x4545('0x2c')](_0x4e1105);};}exports[_0x4545('0x2d')]=function(_0x3a5e41,_0x4b210a){var _0x3c6450={},_0x46b220={},_0x18c4af={'count':0x0,'rows':[]};var _0x420a17=_[_0x4545('0x2e')](db[_0x4545('0x2f')][_0x4545('0x30')],function(_0x18385c){return{'name':_0x18385c[_0x4545('0x31')],'type':_0x18385c[_0x4545('0x32')][_0x4545('0x33')]};});_0x46b220[_0x4545('0x34')]=_[_0x4545('0x2e')](_0x420a17,_0x4545('0x2b'));_0x46b220['query']=_[_0x4545('0x35')](_0x3a5e41['query']);_0x46b220['filters']=_[_0x4545('0x36')](_0x46b220['model'],_0x46b220[_0x4545('0x37')]);_0x3c6450[_0x4545('0x38')]=_[_0x4545('0x36')](_0x46b220['model'],qs[_0x4545('0x39')](_0x3a5e41[_0x4545('0x37')][_0x4545('0x39')]));_0x3c6450[_0x4545('0x38')]=_0x3c6450[_0x4545('0x38')][_0x4545('0x3a')]?_0x3c6450['attributes']:_0x46b220[_0x4545('0x34')];if(!_0x3a5e41[_0x4545('0x37')][_0x4545('0x3b')]('nolimit')){_0x3c6450[_0x4545('0x1c')]=qs[_0x4545('0x1c')](_0x3a5e41[_0x4545('0x37')][_0x4545('0x1c')]);_0x3c6450[_0x4545('0x1b')]=qs[_0x4545('0x1b')](_0x3a5e41[_0x4545('0x37')][_0x4545('0x1b')]);}_0x3c6450[_0x4545('0x3c')]=qs[_0x4545('0x3d')](_0x3a5e41[_0x4545('0x37')][_0x4545('0x3d')]);_0x3c6450[_0x4545('0x3e')]=qs[_0x4545('0x3f')](_[_0x4545('0x40')](_0x3a5e41[_0x4545('0x37')],_0x46b220['filters']),_0x420a17);if(_0x3a5e41['query'][_0x4545('0x41')]){_0x3c6450[_0x4545('0x3e')]=_['merge'](_0x3c6450[_0x4545('0x3e')],{'$or':_[_0x4545('0x2e')](_0x420a17,function(_0x3d915c){if(_0x3d915c['type']!=='VIRTUAL'){var _0x172d32={};_0x172d32[_0x3d915c[_0x4545('0x2b')]]={'$like':'%'+_0x3a5e41[_0x4545('0x37')]['filter']+'%'};return _0x172d32;}})});}_0x3c6450=_[_0x4545('0x42')]({},_0x3c6450,_0x3a5e41[_0x4545('0x43')]);var _0x533837={'where':_0x3c6450[_0x4545('0x3e')]};return db[_0x4545('0x2f')][_0x4545('0x1d')](_0x533837)[_0x4545('0x23')](function(_0x400d8d){_0x18c4af['count']=_0x400d8d;if(_0x3a5e41[_0x4545('0x37')][_0x4545('0x44')]){_0x3c6450[_0x4545('0x45')]=[{'all':!![]}];}return db[_0x4545('0x2f')]['findAll'](_0x3c6450);})['then'](function(_0x11b05f){_0x18c4af[_0x4545('0x46')]=_0x11b05f;return _0x18c4af;})['then'](respondWithFilteredResult(_0x4b210a,_0x3c6450))['catch'](handleError(_0x4b210a,null));};exports[_0x4545('0x47')]=function(_0x5d41e1,_0x3d8e35){var _0x1617e3={'raw':!![],'where':{'id':_0x5d41e1[_0x4545('0x48')]['id']}},_0x418cae={};_0x418cae[_0x4545('0x34')]=_[_0x4545('0x35')](db[_0x4545('0x2f')]['rawAttributes']);_0x418cae[_0x4545('0x37')]=_[_0x4545('0x35')](_0x5d41e1[_0x4545('0x37')]);_0x418cae[_0x4545('0x3f')]=_[_0x4545('0x36')](_0x418cae[_0x4545('0x34')],_0x418cae['query']);_0x1617e3['attributes']=_[_0x4545('0x36')](_0x418cae[_0x4545('0x34')],qs['fields'](_0x5d41e1[_0x4545('0x37')][_0x4545('0x39')]));_0x1617e3[_0x4545('0x38')]=_0x1617e3[_0x4545('0x38')][_0x4545('0x3a')]?_0x1617e3[_0x4545('0x38')]:_0x418cae[_0x4545('0x34')];if(_0x5d41e1[_0x4545('0x37')][_0x4545('0x44')]){_0x1617e3[_0x4545('0x45')]=[{'all':!![]}];}_0x1617e3=_[_0x4545('0x42')]({},_0x1617e3,_0x5d41e1[_0x4545('0x43')]);return db[_0x4545('0x2f')][_0x4545('0x49')](_0x1617e3)[_0x4545('0x23')](handleEntityNotFound(_0x3d8e35,null))[_0x4545('0x23')](respondWithResult(_0x3d8e35,null))['catch'](handleError(_0x3d8e35,null));};exports[_0x4545('0x4a')]=function(_0x1dc436,_0x59b59e,_0x249fdb){return db[_0x4545('0x2f')][_0x4545('0x49')]({'where':{'id':_0x1dc436['params']['id']},'attributes':[_0x4545('0x2b'),_0x4545('0x4b'),_0x4545('0x4c')],'raw':!![]})[_0x4545('0x23')](handleEntityNotFound(_0x59b59e,null))[_0x4545('0x23')](function(_0x14d1eb){if(_0x14d1eb){if(!fs['existsSync'](path[_0x4545('0x4d')](config[_0x4545('0x4e')],_0x4545('0x4f'),_0x14d1eb[_0x4545('0x4b')]+'.'+_0x14d1eb[_0x4545('0x4c')]))){throw new db['Sequelize'][(_0x4545('0x50'))]('Sound\x20not\x20found');}return _0x59b59e['download'](path['join'](config[_0x4545('0x4e')],'server/files/sounds/converted',util[_0x4545('0x51')](_0x4545('0x52'),_0x14d1eb[_0x4545('0x4b')],_0x14d1eb[_0x4545('0x4c')])),util['format'](_0x4545('0x52'),_0x14d1eb[_0x4545('0x2b')],_0x14d1eb[_0x4545('0x4c')]));}return null;})['catch'](handleError(_0x59b59e,null));};exports[_0x4545('0x53')]=function(_0xede9d7,_0x11d469,_0x5bf680){var _0x58b552={'name':path[_0x4545('0x54')](_0xede9d7[_0x4545('0x55')][_0x4545('0x56')],path[_0x4545('0x57')](_0xede9d7[_0x4545('0x55')][_0x4545('0x56')])),'save_name':path['basename'](_0xede9d7[_0x4545('0x55')][_0x4545('0x58')],path[_0x4545('0x57')](_0xede9d7[_0x4545('0x55')][_0x4545('0x58')])),'original_format':path[_0x4545('0x57')](_0xede9d7[_0x4545('0x55')][_0x4545('0x56')])['substring'](0x1),'converted_format':_0x4545('0x59')};var _0x4621b3=path[_0x4545('0x4d')](config[_0x4545('0x4e')],'server/files/sounds/original',_0xede9d7[_0x4545('0x55')][_0x4545('0x58')]);var _0x547f96=path['join'](config[_0x4545('0x4e')],_0x4545('0x4f'),util[_0x4545('0x51')](_0x4545('0x52'),path[_0x4545('0x54')](_0xede9d7[_0x4545('0x55')][_0x4545('0x58')],path[_0x4545('0x57')](_0xede9d7['file'][_0x4545('0x58')])),_0x58b552[_0x4545('0x4c')]));logger[_0x4545('0x5a')](_0x4545('0x5b'),_0x4621b3);logger[_0x4545('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x547f96);try{fs['chmodSync'](_0x4621b3,parseInt(_0x4545('0x5c'),0x8));var _0xcbeb86=sox['transcode'](_0x4621b3,_0x547f96,{'sampleRate':0x1f40,'format':_0x4545('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xcbeb86['on'](_0x4545('0x29'),function(_0x293f52){fs[_0x4545('0x5d')](_0x4621b3);_0x11d469[_0x4545('0x19')](0x1f4)[_0x4545('0x2c')](_0x293f52);});_0xcbeb86['on']('src',function(_0x3b3a74){_0x58b552[_0x4545('0x5e')]=isNaN(_0x3b3a74[_0x4545('0x5f')])?null:_0x3b3a74['duration']*0x3e8;_0x58b552['original_sampleCount']=isNaN(_0x3b3a74[_0x4545('0x60')])?null:_0x3b3a74[_0x4545('0x60')];_0x58b552[_0x4545('0x61')]=isNaN(_0x3b3a74[_0x4545('0x62')])?null:_0x3b3a74[_0x4545('0x62')];_0x58b552[_0x4545('0x63')]=isNaN(_0x3b3a74['bitRate'])?null:_0x3b3a74[_0x4545('0x64')];_0x58b552['original_sampleRate']=isNaN(_0x3b3a74['sampleRate'])?null:_0x3b3a74['sampleRate'];});_0xcbeb86['on'](_0x4545('0x65'),function(_0x31f6df){_0x58b552[_0x4545('0x66')]=isNaN(_0x31f6df['duration'])?null:_0x31f6df[_0x4545('0x5f')]*0x3e8;_0x58b552[_0x4545('0x67')]=isNaN(_0x31f6df[_0x4545('0x60')])?null:_0x31f6df['sampleCount'];_0x58b552[_0x4545('0x68')]=isNaN(_0x31f6df[_0x4545('0x62')])?null:_0x31f6df['channelCount'];_0x58b552[_0x4545('0x69')]=isNaN(_0x31f6df['bitRate'])?null:_0x31f6df[_0x4545('0x64')];_0x58b552['converted_sampleRate']=isNaN(_0x31f6df['sampleRate'])?null:_0x31f6df[_0x4545('0x6a')];});_0xcbeb86['on']('end',function(){fs[_0x4545('0x6b')](_0x547f96,parseInt(_0x4545('0x5c'),0x8));return db[_0x4545('0x2f')][_0x4545('0x53')](_0x58b552)[_0x4545('0x23')](function(_0x2961b7){var _0x4fa47e={'role':_0xede9d7[_0x4545('0x6c')][_0x4545('0x6d')],'userProfileId':_0xede9d7['body']['userProfileId']};if(!_0x4fa47e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fa47e[_0x4545('0x6d')]===_0x4545('0x6e')){var _0x3ad313=_0x2961b7[_0x4545('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x4545('0x49')]({'where':{'name':'Sounds','userProfileId':_0x4fa47e[_0x4545('0x6f')]},'raw':!![]})[_0x4545('0x23')](function(_0x3c1ca3){if(_0x3c1ca3&&_0x3c1ca3[_0x4545('0x70')]===0x0){return db[_0x4545('0x27')][_0x4545('0x53')]({'name':_0x3ad313[_0x4545('0x2b')],'resourceId':_0x3ad313['id'],'type':_0x3c1ca3['name'],'sectionId':_0x3c1ca3['id']},{})['then'](function(){return _0x2961b7;});}else{return _0x2961b7;}})[_0x4545('0x71')](function(_0x5b326a){logger[_0x4545('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b326a);throw _0x5b326a;});}return _0x2961b7;})['then'](respondWithResult(_0x11d469,null))[_0x4545('0x71')](handleError(_0x11d469,null));});_0xcbeb86[_0x4545('0x72')]();}catch(_0x245c03){_0x11d469['status'](0x1f4)[_0x4545('0x2c')](_0x245c03);}};exports['update']=function(_0x3a9bd7,_0x4bf914,_0x1e446d){return db[_0x4545('0x2f')][_0x4545('0x49')]({'where':{'id':_0x3a9bd7[_0x4545('0x48')]['id']}})[_0x4545('0x23')](handleEntityNotFound(_0x4bf914,null))['then'](saveUpdates(_[_0x4545('0x40')](_0x3a9bd7[_0x4545('0x6c')],[_0x4545('0x2b'),_0x4545('0x73')]),null))[_0x4545('0x23')](respondWithResult(_0x4bf914,null))[_0x4545('0x71')](handleError(_0x4bf914,null));};exports[_0x4545('0x74')]=function(_0x59681c,_0x428d08,_0x20a36d){return db['Sound'][_0x4545('0x49')]({'where':{'id':_0x59681c[_0x4545('0x48')]['id']}})['then'](function(_0x13ba75){if(_0x13ba75){return _0x13ba75['destroy']();}})['then'](function(_0x5eb5a9){var _0x39aab9=path[_0x4545('0x4d')](config['root'],_0x4545('0x75'),util[_0x4545('0x51')](_0x4545('0x52'),_0x5eb5a9[_0x4545('0x4b')],_0x5eb5a9[_0x4545('0x76')]));var _0x530b3b=path[_0x4545('0x4d')](config['root'],_0x4545('0x4f'),util['format']('%s.%s',_0x5eb5a9[_0x4545('0x4b')],_0x5eb5a9[_0x4545('0x4c')]));fs[_0x4545('0x5d')](_0x39aab9);fs[_0x4545('0x5d')](_0x530b3b);return _0x5eb5a9;})[_0x4545('0x23')](function(_0x381da1){if(_0x381da1){return _0x428d08[_0x4545('0x19')](0xcc)[_0x4545('0x18')]();}})[_0x4545('0x23')](handleEntityNotFound(_0x428d08,null))[_0x4545('0x71')](handleError(_0x428d08,null));}; \ No newline at end of file +var _0xf299=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','save','update','destroy','get','Sounds','then','error','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','options','find','converted_format','root','server/files/sounds/converted','save_name','Sequelize','download','join','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','start','description','delete','original_format','unlinkSync','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3f1b8d,_0x13e895){var _0x163074=function(_0x56e525){while(--_0x56e525){_0x3f1b8d['push'](_0x3f1b8d['shift']());}};_0x163074(++_0x13e895);}(_0xf299,0x161));var _0x9f29=function(_0x128bfe,_0x1e61c5){_0x128bfe=_0x128bfe-0x0;var _0x41751b=_0xf299[_0x128bfe];return _0x41751b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9f29('0x0'));var jsonpatch=require(_0x9f29('0x1'));var rp=require('request-promise');var moment=require(_0x9f29('0x2'));var BPromise=require(_0x9f29('0x3'));var Mustache=require(_0x9f29('0x4'));var util=require(_0x9f29('0x5'));var path=require('path');var sox=require(_0x9f29('0x6'));var csv=require(_0x9f29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f29('0x8'));var squel=require(_0x9f29('0x9'));var crypto=require(_0x9f29('0xa'));var jsforce=require(_0x9f29('0xb'));var deskjs=require(_0x9f29('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9f29('0xd'));var Papa=require(_0x9f29('0xe'));var Redis=require(_0x9f29('0xf'));var authService=require(_0x9f29('0x10'));var qs=require(_0x9f29('0x11'));var as=require(_0x9f29('0x12'));var hardwareService=require(_0x9f29('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9f29('0x14'));var config=require(_0x9f29('0x15'));var licenseUtil=require(_0x9f29('0x16'));var db=require(_0x9f29('0x17'))['db'];function respondWithStatusCode(_0x221e4f,_0x1bcf1a){_0x1bcf1a=_0x1bcf1a||0xcc;return function(_0x18b6cc){if(_0x18b6cc){return _0x221e4f[_0x9f29('0x18')](_0x1bcf1a);}return _0x221e4f[_0x9f29('0x19')](_0x1bcf1a)[_0x9f29('0x1a')]();};}function respondWithResult(_0x776b78,_0x51593d){_0x51593d=_0x51593d||0xc8;return function(_0x268bc5){if(_0x268bc5){return _0x776b78[_0x9f29('0x19')](_0x51593d)['json'](_0x268bc5);}};}function respondWithFilteredResult(_0x518f23,_0xa85f9){return function(_0x4302d){if(_0x4302d){var _0x4fe86e=typeof _0xa85f9['offset']==='undefined'&&typeof _0xa85f9[_0x9f29('0x1b')]===_0x9f29('0x1c');var _0x25d744=_0x4302d[_0x9f29('0x1d')];var _0x162dc9=_0x4fe86e?0x0:_0xa85f9['offset'];var _0x421891=_0x4fe86e?_0x4302d[_0x9f29('0x1d')]:_0xa85f9[_0x9f29('0x1e')]+_0xa85f9['limit'];var _0x25138f;if(_0x421891>=_0x25d744){_0x421891=_0x25d744;_0x25138f=0xc8;}else{_0x25138f=0xce;}_0x518f23[_0x9f29('0x19')](_0x25138f);return _0x518f23['set'](_0x9f29('0x1f'),_0x162dc9+'-'+_0x421891+'/'+_0x25d744)[_0x9f29('0x20')](_0x4302d);}return null;};}function patchUpdates(_0x30d4bc){return function(_0x1a4c87){try{jsonpatch[_0x9f29('0x21')](_0x1a4c87,_0x30d4bc,!![]);}catch(_0x32f3b9){return BPromise[_0x9f29('0x22')](_0x32f3b9);}return _0x1a4c87[_0x9f29('0x23')]();};}function saveUpdates(_0x2f249a,_0x2479a9){return function(_0x219390){if(_0x219390){return _0x219390[_0x9f29('0x24')](_0x2f249a)['then'](function(_0x2d8c9e){return _0x2d8c9e;});}return null;};}function removeEntity(_0x44143e,_0xd0a420){return function(_0x221fa7){if(_0x221fa7){return _0x221fa7[_0x9f29('0x25')]()['then'](function(){var _0x33b429=_0x221fa7[_0x9f29('0x26')]({'plain':!![]});var _0x550543=_0x9f29('0x27');return db['UserProfileResource'][_0x9f29('0x25')]({'where':{'type':_0x550543,'resourceId':_0x33b429['id']}})['then'](function(){return _0x221fa7;});})[_0x9f29('0x28')](function(){_0x44143e[_0x9f29('0x19')](0xcc)[_0x9f29('0x1a')]();});}};}function handleEntityNotFound(_0x4a4e69,_0x1266af){return function(_0x3ab254){if(!_0x3ab254){_0x4a4e69[_0x9f29('0x18')](0x194);}return _0x3ab254;};}function handleError(_0x2ad946,_0x531172){_0x531172=_0x531172||0x1f4;return function(_0xe11b23){logger[_0x9f29('0x29')](_0xe11b23['stack']);if(_0xe11b23['name']){delete _0xe11b23[_0x9f29('0x2a')];}_0x2ad946['status'](_0x531172)[_0x9f29('0x2b')](_0xe11b23);};}exports[_0x9f29('0x2c')]=function(_0x458c93,_0x4ccf42){var _0x5b6522={},_0xab1d5c={},_0x4dcccb={'count':0x0,'rows':[]};var _0x660981=_['map'](db[_0x9f29('0x2d')][_0x9f29('0x2e')],function(_0x1ffc9c){return{'name':_0x1ffc9c[_0x9f29('0x2f')],'type':_0x1ffc9c[_0x9f29('0x30')][_0x9f29('0x31')]};});_0xab1d5c[_0x9f29('0x32')]=_[_0x9f29('0x33')](_0x660981,_0x9f29('0x2a'));_0xab1d5c['query']=_[_0x9f29('0x34')](_0x458c93['query']);_0xab1d5c[_0x9f29('0x35')]=_[_0x9f29('0x36')](_0xab1d5c[_0x9f29('0x32')],_0xab1d5c[_0x9f29('0x37')]);_0x5b6522['attributes']=_[_0x9f29('0x36')](_0xab1d5c[_0x9f29('0x32')],qs['fields'](_0x458c93[_0x9f29('0x37')][_0x9f29('0x38')]));_0x5b6522[_0x9f29('0x39')]=_0x5b6522[_0x9f29('0x39')][_0x9f29('0x3a')]?_0x5b6522[_0x9f29('0x39')]:_0xab1d5c[_0x9f29('0x32')];if(!_0x458c93[_0x9f29('0x37')]['hasOwnProperty'](_0x9f29('0x3b'))){_0x5b6522[_0x9f29('0x1b')]=qs['limit'](_0x458c93[_0x9f29('0x37')][_0x9f29('0x1b')]);_0x5b6522['offset']=qs[_0x9f29('0x1e')](_0x458c93['query'][_0x9f29('0x1e')]);}_0x5b6522[_0x9f29('0x3c')]=qs[_0x9f29('0x3d')](_0x458c93[_0x9f29('0x37')][_0x9f29('0x3d')]);_0x5b6522[_0x9f29('0x3e')]=qs[_0x9f29('0x35')](_[_0x9f29('0x3f')](_0x458c93['query'],_0xab1d5c['filters']),_0x660981);if(_0x458c93['query'][_0x9f29('0x40')]){_0x5b6522['where']=_['merge'](_0x5b6522[_0x9f29('0x3e')],{'$or':_[_0x9f29('0x33')](_0x660981,function(_0x1e9cd8){if(_0x1e9cd8[_0x9f29('0x30')]!==_0x9f29('0x41')){var _0x13b8ad={};_0x13b8ad[_0x1e9cd8[_0x9f29('0x2a')]]={'$like':'%'+_0x458c93['query'][_0x9f29('0x40')]+'%'};return _0x13b8ad;}})});}_0x5b6522=_[_0x9f29('0x42')]({},_0x5b6522,_0x458c93['options']);var _0x3bb87d={'where':_0x5b6522['where']};return db['Sound'][_0x9f29('0x1d')](_0x3bb87d)[_0x9f29('0x28')](function(_0x3a81d7){_0x4dcccb[_0x9f29('0x1d')]=_0x3a81d7;if(_0x458c93[_0x9f29('0x37')]['includeAll']){_0x5b6522[_0x9f29('0x43')]=[{'all':!![]}];}return db[_0x9f29('0x2d')][_0x9f29('0x44')](_0x5b6522);})[_0x9f29('0x28')](function(_0x293309){_0x4dcccb[_0x9f29('0x45')]=_0x293309;return _0x4dcccb;})[_0x9f29('0x28')](respondWithFilteredResult(_0x4ccf42,_0x5b6522))[_0x9f29('0x46')](handleError(_0x4ccf42,null));};exports['show']=function(_0x574df8,_0x3d6f25){var _0x23b65f={'raw':!![],'where':{'id':_0x574df8[_0x9f29('0x47')]['id']}},_0x536fbe={};_0x536fbe['model']=_[_0x9f29('0x34')](db[_0x9f29('0x2d')][_0x9f29('0x2e')]);_0x536fbe[_0x9f29('0x37')]=_['keys'](_0x574df8[_0x9f29('0x37')]);_0x536fbe[_0x9f29('0x35')]=_[_0x9f29('0x36')](_0x536fbe[_0x9f29('0x32')],_0x536fbe[_0x9f29('0x37')]);_0x23b65f['attributes']=_[_0x9f29('0x36')](_0x536fbe[_0x9f29('0x32')],qs[_0x9f29('0x38')](_0x574df8[_0x9f29('0x37')][_0x9f29('0x38')]));_0x23b65f[_0x9f29('0x39')]=_0x23b65f[_0x9f29('0x39')][_0x9f29('0x3a')]?_0x23b65f[_0x9f29('0x39')]:_0x536fbe[_0x9f29('0x32')];if(_0x574df8[_0x9f29('0x37')]['includeAll']){_0x23b65f[_0x9f29('0x43')]=[{'all':!![]}];}_0x23b65f=_[_0x9f29('0x42')]({},_0x23b65f,_0x574df8[_0x9f29('0x48')]);return db['Sound'][_0x9f29('0x49')](_0x23b65f)['then'](handleEntityNotFound(_0x3d6f25,null))[_0x9f29('0x28')](respondWithResult(_0x3d6f25,null))[_0x9f29('0x46')](handleError(_0x3d6f25,null));};exports['download']=function(_0x31e10d,_0x4598e9,_0x2978d0){return db[_0x9f29('0x2d')]['find']({'where':{'id':_0x31e10d[_0x9f29('0x47')]['id']},'attributes':[_0x9f29('0x2a'),'save_name',_0x9f29('0x4a')],'raw':!![]})[_0x9f29('0x28')](handleEntityNotFound(_0x4598e9,null))[_0x9f29('0x28')](function(_0x26f929){if(_0x26f929){if(!fs['existsSync'](path['join'](config[_0x9f29('0x4b')],_0x9f29('0x4c'),_0x26f929[_0x9f29('0x4d')]+'.'+_0x26f929['converted_format']))){throw new db[(_0x9f29('0x4e'))]['ValidationError']('Sound\x20not\x20found');}return _0x4598e9[_0x9f29('0x4f')](path[_0x9f29('0x50')](config['root'],_0x9f29('0x4c'),util[_0x9f29('0x51')](_0x9f29('0x52'),_0x26f929[_0x9f29('0x4d')],_0x26f929[_0x9f29('0x4a')])),util[_0x9f29('0x51')]('%s.%s',_0x26f929['name'],_0x26f929[_0x9f29('0x4a')]));}return null;})['catch'](handleError(_0x4598e9,null));};exports[_0x9f29('0x53')]=function(_0x5b6564,_0x4c2d92,_0x18e988){var _0x48f694={'name':path['basename'](_0x5b6564[_0x9f29('0x54')][_0x9f29('0x55')],path[_0x9f29('0x56')](_0x5b6564['file'][_0x9f29('0x55')])),'save_name':path[_0x9f29('0x57')](_0x5b6564[_0x9f29('0x54')][_0x9f29('0x58')],path['extname'](_0x5b6564['file'][_0x9f29('0x58')])),'original_format':path[_0x9f29('0x56')](_0x5b6564[_0x9f29('0x54')][_0x9f29('0x55')])[_0x9f29('0x59')](0x1),'converted_format':_0x9f29('0x5a')};var _0x537cc2=path[_0x9f29('0x50')](config[_0x9f29('0x4b')],_0x9f29('0x5b'),_0x5b6564[_0x9f29('0x54')][_0x9f29('0x58')]);var _0x1e61c1=path[_0x9f29('0x50')](config['root'],'server/files/sounds/converted',util[_0x9f29('0x51')](_0x9f29('0x52'),path[_0x9f29('0x57')](_0x5b6564['file'][_0x9f29('0x58')],path[_0x9f29('0x56')](_0x5b6564[_0x9f29('0x54')]['filename'])),_0x48f694['converted_format']));logger[_0x9f29('0x5c')](_0x9f29('0x5d'),_0x537cc2);logger[_0x9f29('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x1e61c1);try{fs[_0x9f29('0x5e')](_0x537cc2,parseInt(_0x9f29('0x5f'),0x8));var _0x2501f0=sox[_0x9f29('0x60')](_0x537cc2,_0x1e61c1,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2501f0['on']('error',function(_0x42aa65){fs['unlinkSync'](_0x537cc2);_0x4c2d92[_0x9f29('0x19')](0x1f4)[_0x9f29('0x2b')](_0x42aa65);});_0x2501f0['on'](_0x9f29('0x61'),function(_0x1cdc9b){_0x48f694[_0x9f29('0x62')]=isNaN(_0x1cdc9b[_0x9f29('0x63')])?null:_0x1cdc9b[_0x9f29('0x63')]*0x3e8;_0x48f694['original_sampleCount']=isNaN(_0x1cdc9b[_0x9f29('0x64')])?null:_0x1cdc9b['sampleCount'];_0x48f694[_0x9f29('0x65')]=isNaN(_0x1cdc9b[_0x9f29('0x66')])?null:_0x1cdc9b[_0x9f29('0x66')];_0x48f694['original_bitRate']=isNaN(_0x1cdc9b[_0x9f29('0x67')])?null:_0x1cdc9b[_0x9f29('0x67')];_0x48f694[_0x9f29('0x68')]=isNaN(_0x1cdc9b[_0x9f29('0x69')])?null:_0x1cdc9b[_0x9f29('0x69')];});_0x2501f0['on'](_0x9f29('0x6a'),function(_0x3fd2a4){_0x48f694[_0x9f29('0x6b')]=isNaN(_0x3fd2a4[_0x9f29('0x63')])?null:_0x3fd2a4[_0x9f29('0x63')]*0x3e8;_0x48f694[_0x9f29('0x6c')]=isNaN(_0x3fd2a4[_0x9f29('0x64')])?null:_0x3fd2a4[_0x9f29('0x64')];_0x48f694[_0x9f29('0x6d')]=isNaN(_0x3fd2a4[_0x9f29('0x66')])?null:_0x3fd2a4[_0x9f29('0x66')];_0x48f694[_0x9f29('0x6e')]=isNaN(_0x3fd2a4[_0x9f29('0x67')])?null:_0x3fd2a4[_0x9f29('0x67')];_0x48f694[_0x9f29('0x6f')]=isNaN(_0x3fd2a4['sampleRate'])?null:_0x3fd2a4[_0x9f29('0x69')];});_0x2501f0['on'](_0x9f29('0x1a'),function(){fs[_0x9f29('0x5e')](_0x1e61c1,parseInt(_0x9f29('0x5f'),0x8));return db['Sound'][_0x9f29('0x53')](_0x48f694)[_0x9f29('0x28')](function(_0x50d3cc){var _0x4bfa71={'role':_0x5b6564[_0x9f29('0x70')]['role'],'userProfileId':_0x5b6564[_0x9f29('0x70')][_0x9f29('0x71')]};if(!_0x4bfa71)throw new Error(_0x9f29('0x72'));if(_0x4bfa71[_0x9f29('0x73')]===_0x9f29('0x74')){var _0x4852d8=_0x50d3cc['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x9f29('0x27'),'userProfileId':_0x4bfa71[_0x9f29('0x71')]},'raw':!![]})[_0x9f29('0x28')](function(_0x361a5b){if(_0x361a5b&&_0x361a5b[_0x9f29('0x75')]===0x0){return db['UserProfileResource'][_0x9f29('0x53')]({'name':_0x4852d8[_0x9f29('0x2a')],'resourceId':_0x4852d8['id'],'type':_0x361a5b[_0x9f29('0x2a')],'sectionId':_0x361a5b['id']},{})[_0x9f29('0x28')](function(){return _0x50d3cc;});}else{return _0x50d3cc;}})[_0x9f29('0x46')](function(_0x3fbf02){logger[_0x9f29('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fbf02);throw _0x3fbf02;});}return _0x50d3cc;})[_0x9f29('0x28')](respondWithResult(_0x4c2d92,null))[_0x9f29('0x46')](handleError(_0x4c2d92,null));});_0x2501f0[_0x9f29('0x76')]();}catch(_0x5cd94a){_0x4c2d92[_0x9f29('0x19')](0x1f4)[_0x9f29('0x2b')](_0x5cd94a);}};exports[_0x9f29('0x24')]=function(_0x316699,_0x2caadf,_0x4d4551){return db[_0x9f29('0x2d')][_0x9f29('0x49')]({'where':{'id':_0x316699[_0x9f29('0x47')]['id']}})[_0x9f29('0x28')](handleEntityNotFound(_0x2caadf,null))['then'](saveUpdates(_[_0x9f29('0x3f')](_0x316699[_0x9f29('0x70')],['name',_0x9f29('0x77')]),null))[_0x9f29('0x28')](respondWithResult(_0x2caadf,null))[_0x9f29('0x46')](handleError(_0x2caadf,null));};exports[_0x9f29('0x78')]=function(_0x57c6a9,_0x3979dd,_0x55de72){return db[_0x9f29('0x2d')][_0x9f29('0x49')]({'where':{'id':_0x57c6a9['params']['id']}})[_0x9f29('0x28')](function(_0x2dfea5){if(_0x2dfea5){return _0x2dfea5[_0x9f29('0x25')]();}})[_0x9f29('0x28')](function(_0x3ea519){var _0x41d21d=path[_0x9f29('0x50')](config[_0x9f29('0x4b')],'server/files/sounds/original',util[_0x9f29('0x51')](_0x9f29('0x52'),_0x3ea519['save_name'],_0x3ea519[_0x9f29('0x79')]));var _0x1807ca=path[_0x9f29('0x50')](config[_0x9f29('0x4b')],_0x9f29('0x4c'),util[_0x9f29('0x51')](_0x9f29('0x52'),_0x3ea519[_0x9f29('0x4d')],_0x3ea519['converted_format']));fs[_0x9f29('0x7a')](_0x41d21d);fs[_0x9f29('0x7a')](_0x1807ca);return _0x3ea519;})[_0x9f29('0x28')](function(_0x186b9b){if(_0x186b9b){return _0x3979dd['status'](0xcc)[_0x9f29('0x1a')]();}})[_0x9f29('0x28')](handleEntityNotFound(_0x3979dd,null))[_0x9f29('0x46')](handleError(_0x3979dd,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 262b66b..4c01593 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 _0x047b=['exports','define','Sound','tools_sounds','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x047b,0x12f));var _0xb047=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x047b[_0x101e7b];return _0x4995c0;};'use strict';var _=require('lodash');var util=require(_0xb047('0x0'));var logger=require(_0xb047('0x1'))(_0xb047('0x2'));var moment=require(_0xb047('0x3'));var BPromise=require('bluebird');var rp=require(_0xb047('0x4'));var fs=require('fs');var path=require(_0xb047('0x5'));var rimraf=require(_0xb047('0x6'));var config=require(_0xb047('0x7'));var attributes=require(_0xb047('0x8'));module[_0xb047('0x9')]=function(_0x51bfd0,_0x58873e){return _0x51bfd0[_0xb047('0xa')](_0xb047('0xb'),attributes,{'tableName':_0xb047('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6fa=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa6fa,0x15c));var _0xaa6f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa6fa[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xaa6f('0x0'));var util=require(_0xaa6f('0x1'));var logger=require(_0xaa6f('0x2'))(_0xaa6f('0x3'));var moment=require(_0xaa6f('0x4'));var BPromise=require(_0xaa6f('0x5'));var rp=require(_0xaa6f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa6f('0x7'));var config=require(_0xaa6f('0x8'));var attributes=require(_0xaa6f('0x9'));module[_0xaa6f('0xa')]=function(_0x309b8d,_0x1aaa01){return _0x309b8d[_0xaa6f('0xb')](_0xaa6f('0xc'),attributes,{'tableName':_0xaa6f('0xd'),'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 2957217..ad7e1f2 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 _0x14c6=['where','attributes','include','model','map','stringify','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','Sound','find','options'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x14c6,0xa7));var _0x614c=function(_0x4381ae,_0x5cc0ca){_0x4381ae=_0x4381ae-0x0;var _0x8968d5=_0x14c6[_0x4381ae];return _0x8968d5;};'use strict';var _=require(_0x614c('0x0'));var util=require(_0x614c('0x1'));var moment=require(_0x614c('0x2'));var BPromise=require('bluebird');var rs=require(_0x614c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x614c('0x4'))['db'];var utils=require(_0x614c('0x5'));var logger=require(_0x614c('0x6'))('rpc');var config=require(_0x614c('0x7'));var jayson=require(_0x614c('0x8'));var client=jayson[_0x614c('0x9')][_0x614c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aada6,_0x2850f7,_0x58cb96){return new BPromise(function(_0x28b85b,_0x30c041){return client[_0x614c('0xb')](_0x3aada6,_0x58cb96)[_0x614c('0xc')](function(_0x4a34ad){logger[_0x614c('0xd')](_0x614c('0xe'),_0x2850f7,_0x614c('0xf'));logger[_0x614c('0x10')](_0x614c('0x11'),_0x2850f7,_0x614c('0xf'),JSON['stringify'](_0x4a34ad));if(_0x4a34ad[_0x614c('0x12')]){if(_0x4a34ad[_0x614c('0x12')][_0x614c('0x13')]===0x1f4){logger[_0x614c('0x12')]('Sound,\x20%s,\x20%s',_0x2850f7,_0x4a34ad[_0x614c('0x12')]['message']);return _0x30c041(_0x4a34ad[_0x614c('0x12')][_0x614c('0x14')]);}logger['error'](_0x614c('0xe'),_0x2850f7,_0x4a34ad[_0x614c('0x12')][_0x614c('0x14')]);return _0x28b85b(_0x4a34ad[_0x614c('0x12')][_0x614c('0x14')]);}else{logger[_0x614c('0xd')](_0x614c('0xe'),_0x2850f7,'request\x20sent');_0x28b85b(_0x4a34ad[_0x614c('0x15')]['message']);}})['catch'](function(_0x22941c){logger[_0x614c('0x12')](_0x614c('0xe'),_0x2850f7,_0x22941c);_0x30c041(_0x22941c);});});}exports['ShowSound']=function(_0x3e8d08){var _0x425527=this;return new Promise(function(_0x1cd153,_0x41cde8){return db[_0x614c('0x16')][_0x614c('0x17')]({'raw':_0x3e8d08[_0x614c('0x18')]?_0x3e8d08['options']['raw']===undefined?!![]:![]:!![],'where':_0x3e8d08[_0x614c('0x18')]?_0x3e8d08['options'][_0x614c('0x19')]||null:null,'attributes':_0x3e8d08[_0x614c('0x18')]?_0x3e8d08['options'][_0x614c('0x1a')]||null:null,'include':_0x3e8d08['options']?_0x3e8d08[_0x614c('0x18')][_0x614c('0x1b')]?_['map'](_0x3e8d08[_0x614c('0x18')]['include'],function(_0x2ec3f0){return{'model':db[_0x2ec3f0[_0x614c('0x1c')]],'as':_0x2ec3f0['as'],'attributes':_0x2ec3f0[_0x614c('0x1a')],'include':_0x2ec3f0[_0x614c('0x1b')]?_['map'](_0x2ec3f0[_0x614c('0x1b')],function(_0x5ad137){return{'model':db[_0x5ad137[_0x614c('0x1c')]],'as':_0x5ad137['as'],'attributes':_0x5ad137[_0x614c('0x1a')],'include':_0x5ad137[_0x614c('0x1b')]?_[_0x614c('0x1d')](_0x5ad137[_0x614c('0x1b')],function(_0x5594d1){return{'model':db[_0x5594d1[_0x614c('0x1c')]],'as':_0x5594d1['as'],'attributes':_0x5594d1[_0x614c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x614c('0xc')](function(_0x3daffe){logger[_0x614c('0xd')]('ShowSound',_0x3e8d08);logger[_0x614c('0x10')]('ShowSound',_0x3e8d08,JSON[_0x614c('0x1e')](_0x3daffe));_0x1cd153(_0x3daffe);})[_0x614c('0x1f')](function(_0x560ba2){logger[_0x614c('0x12')]('ShowSound',_0x560ba2[_0x614c('0x14')],_0x3e8d08);_0x41cde8(_0x425527[_0x614c('0x12')](0x1f4,_0x560ba2[_0x614c('0x14')]));});});}; \ No newline at end of file +var _0xf82b=['debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','Sound,\x20%s,\x20%s','request\x20sent'];(function(_0x44a5a3,_0x44e933){var _0x524520=function(_0xa7dc2a){while(--_0xa7dc2a){_0x44a5a3['push'](_0x44a5a3['shift']());}};_0x524520(++_0x44e933);}(_0xf82b,0x13b));var _0xbf82=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf82b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbf82('0x0'));var util=require(_0xbf82('0x1'));var moment=require(_0xbf82('0x2'));var BPromise=require(_0xbf82('0x3'));var rs=require(_0xbf82('0x4'));var fs=require('fs');var Redis=require(_0xbf82('0x5'));var db=require(_0xbf82('0x6'))['db'];var utils=require(_0xbf82('0x7'));var logger=require(_0xbf82('0x8'))('rpc');var config=require(_0xbf82('0x9'));var jayson=require(_0xbf82('0xa'));var client=jayson['client'][_0xbf82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15613f,_0x3ed839,_0x56c839){return new BPromise(function(_0x476d32,_0x303c44){return client[_0xbf82('0xc')](_0x15613f,_0x56c839)['then'](function(_0x31e9dc){logger['info'](_0xbf82('0xd'),_0x3ed839,_0xbf82('0xe'));logger[_0xbf82('0xf')](_0xbf82('0x10'),_0x3ed839,_0xbf82('0xe'),JSON[_0xbf82('0x11')](_0x31e9dc));if(_0x31e9dc['error']){if(_0x31e9dc[_0xbf82('0x12')]['code']===0x1f4){logger[_0xbf82('0x12')](_0xbf82('0xd'),_0x3ed839,_0x31e9dc['error'][_0xbf82('0x13')]);return _0x303c44(_0x31e9dc[_0xbf82('0x12')]['message']);}logger['error'](_0xbf82('0xd'),_0x3ed839,_0x31e9dc[_0xbf82('0x12')][_0xbf82('0x13')]);return _0x476d32(_0x31e9dc[_0xbf82('0x12')]['message']);}else{logger[_0xbf82('0x14')](_0xbf82('0xd'),_0x3ed839,_0xbf82('0xe'));_0x476d32(_0x31e9dc[_0xbf82('0x15')][_0xbf82('0x13')]);}})[_0xbf82('0x16')](function(_0x1e60e0){logger['error'](_0xbf82('0xd'),_0x3ed839,_0x1e60e0);_0x303c44(_0x1e60e0);});});}exports[_0xbf82('0x17')]=function(_0x1f2c97){var _0x8e122c=this;return new Promise(function(_0x5b406d,_0x447cf0){return db[_0xbf82('0x18')][_0xbf82('0x19')]({'raw':_0x1f2c97['options']?_0x1f2c97[_0xbf82('0x1a')][_0xbf82('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f2c97[_0xbf82('0x1a')]?_0x1f2c97[_0xbf82('0x1a')][_0xbf82('0x1c')]||null:null,'attributes':_0x1f2c97[_0xbf82('0x1a')]?_0x1f2c97[_0xbf82('0x1a')][_0xbf82('0x1d')]||null:null,'include':_0x1f2c97[_0xbf82('0x1a')]?_0x1f2c97['options']['include']?_[_0xbf82('0x1e')](_0x1f2c97[_0xbf82('0x1a')][_0xbf82('0x1f')],function(_0x2dd3fc){return{'model':db[_0x2dd3fc[_0xbf82('0x20')]],'as':_0x2dd3fc['as'],'attributes':_0x2dd3fc[_0xbf82('0x1d')],'include':_0x2dd3fc[_0xbf82('0x1f')]?_[_0xbf82('0x1e')](_0x2dd3fc[_0xbf82('0x1f')],function(_0x248daf){return{'model':db[_0x248daf[_0xbf82('0x20')]],'as':_0x248daf['as'],'attributes':_0x248daf[_0xbf82('0x1d')],'include':_0x248daf['include']?_[_0xbf82('0x1e')](_0x248daf['include'],function(_0x2c87df){return{'model':db[_0x2c87df[_0xbf82('0x20')]],'as':_0x2c87df['as'],'attributes':_0x2c87df[_0xbf82('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23689e){logger[_0xbf82('0x14')](_0xbf82('0x17'),_0x1f2c97);logger[_0xbf82('0xf')](_0xbf82('0x17'),_0x1f2c97,JSON[_0xbf82('0x11')](_0x23689e));_0x5b406d(_0x23689e);})[_0xbf82('0x16')](function(_0x190bab){logger[_0xbf82('0x12')](_0xbf82('0x17'),_0x190bab['message'],_0x1f2c97);_0x447cf0(_0x8e122c['error'](0x1f4,_0x190bab[_0xbf82('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e12f43c..ce9d1e0 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d3e97,_0x749913){var _0x3147d7=function(_0x250599){while(--_0x250599){_0x4d3e97['push'](_0x4d3e97['shift']());}};_0x3147d7(++_0x749913);}(_0x0b0e,0x187));var _0xe0b0=function(_0x22c50e,_0x4ea131){_0x22c50e=_0x22c50e-0x0;var _0x500f85=_0x0b0e[_0x22c50e];return _0x500f85;};'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('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x200b68,_0x3271ee){var _0x4a9661=function(_0x29e135){while(--_0x29e135){_0x200b68['push'](_0x200b68['shift']());}};_0x4a9661(++_0x3271ee);}(_0xb7e7,0x121));var _0x7b7e=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb7e7[_0x580576];return _0x3f55a0;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6b239a9..f4ff4bf 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 _0x0af8=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x30bdd9,_0x2a0159){var _0x4cc0a3=function(_0x1098bc){while(--_0x1098bc){_0x30bdd9['push'](_0x30bdd9['shift']());}};_0x4cc0a3(++_0x2a0159);}(_0x0af8,0xee));var _0x80af=function(_0x5e9cc0,_0x488dd3){_0x5e9cc0=_0x5e9cc0-0x0;var _0x48dff8=_0x0af8[_0x5e9cc0];return _0x48dff8;};'use strict';var Sequelize=require(_0x80af('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x80af('0x1')]},'body':{'type':Sequelize[_0x80af('0x2')](_0x80af('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x80af('0x4')]('in',_0x80af('0x5')),'defaultValue':_0x80af('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x80af('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xaf2a=['out','STRING','TEXT','sequelize','exports','ENUM'];(function(_0x5536b2,_0x22d286){var _0x477566=function(_0x35c0f4){while(--_0x35c0f4){_0x5536b2['push'](_0x5536b2['shift']());}};_0x477566(++_0x22d286);}(_0xaf2a,0x1d7));var _0xaaf2=function(_0x66e7f,_0xe45210){_0x66e7f=_0x66e7f-0x0;var _0x31471f=_0xaf2a[_0x66e7f];return _0x31471f;};'use strict';var Sequelize=require(_0xaaf2('0x0'));module[_0xaaf2('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xaaf2('0x2')]('in',_0xaaf2('0x3')),'defaultValue':_0xaaf2('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xaaf2('0x4')]},'providerResponse':{'type':Sequelize[_0xaaf2('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index e0a6414..b8f55bd 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 _0x4abd=['VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','model','include','create','body','update','find','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','reject','then','destroy','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x3f7007,_0x5d1bce){var _0x4331f6=function(_0x57139e){while(--_0x57139e){_0x3f7007['push'](_0x3f7007['shift']());}};_0x4331f6(++_0x5d1bce);}(_0x4abd,0x1b9));var _0xd4ab=function(_0x176308,_0x5b4d58){_0x176308=_0x176308-0x0;var _0x545160=_0x4abd[_0x176308];return _0x545160;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd4ab('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4ab('0x1'));var moment=require(_0xd4ab('0x2'));var BPromise=require(_0xd4ab('0x3'));var Mustache=require(_0xd4ab('0x4'));var util=require(_0xd4ab('0x5'));var path=require('path');var sox=require(_0xd4ab('0x6'));var csv=require(_0xd4ab('0x7'));var ejs=require(_0xd4ab('0x8'));var fs=require('fs');var fs_extra=require(_0xd4ab('0x9'));var _=require(_0xd4ab('0xa'));var squel=require(_0xd4ab('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4ab('0xc'));var toCsv=require(_0xd4ab('0x7'));var querystring=require(_0xd4ab('0xd'));var Papa=require(_0xd4ab('0xe'));var Redis=require(_0xd4ab('0xf'));var authService=require(_0xd4ab('0x10'));var qs=require(_0xd4ab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4ab('0x12'))(_0xd4ab('0x13'));var utils=require(_0xd4ab('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd4ab('0x15'));var db=require(_0xd4ab('0x16'))['db'];function respondWithStatusCode(_0x2908dc,_0x1463fd){_0x1463fd=_0x1463fd||0xcc;return function(_0x32bd53){if(_0x32bd53){return _0x2908dc[_0xd4ab('0x17')](_0x1463fd);}return _0x2908dc[_0xd4ab('0x18')](_0x1463fd)[_0xd4ab('0x19')]();};}function respondWithResult(_0xc2fdad,_0x4cc545){_0x4cc545=_0x4cc545||0xc8;return function(_0x39bc27){if(_0x39bc27){return _0xc2fdad[_0xd4ab('0x18')](_0x4cc545)[_0xd4ab('0x1a')](_0x39bc27);}};}function respondWithFilteredResult(_0x2dc45f,_0x568508){return function(_0x332e41){if(_0x332e41){var _0x528c53=typeof _0x568508[_0xd4ab('0x1b')]===_0xd4ab('0x1c')&&typeof _0x568508[_0xd4ab('0x1d')]===_0xd4ab('0x1c');var _0x2ad2f1=_0x332e41['count'];var _0xeb964=_0x528c53?0x0:_0x568508['offset'];var _0x3e9654=_0x528c53?_0x332e41['count']:_0x568508[_0xd4ab('0x1b')]+_0x568508[_0xd4ab('0x1d')];var _0x42884d;if(_0x3e9654>=_0x2ad2f1){_0x3e9654=_0x2ad2f1;_0x42884d=0xc8;}else{_0x42884d=0xce;}_0x2dc45f['status'](_0x42884d);return _0x2dc45f['set']('Content-Range',_0xeb964+'-'+_0x3e9654+'/'+_0x2ad2f1)['json'](_0x332e41);}return null;};}function patchUpdates(_0x14ff47){return function(_0x12d631){try{jsonpatch['apply'](_0x12d631,_0x14ff47,!![]);}catch(_0x563d58){return BPromise[_0xd4ab('0x1e')](_0x563d58);}return _0x12d631['save']();};}function saveUpdates(_0x5b2bd6,_0x3c2a52){return function(_0x592c2f){if(_0x592c2f){return _0x592c2f['update'](_0x5b2bd6)[_0xd4ab('0x1f')](function(_0x5db6e8){return _0x5db6e8;});}return null;};}function removeEntity(_0x5c5ba4,_0x23125d){return function(_0x475f50){if(_0x475f50){return _0x475f50[_0xd4ab('0x20')]()['then'](function(){_0x5c5ba4['status'](0xcc)[_0xd4ab('0x19')]();});}};}function handleEntityNotFound(_0x2aed3a,_0x4312c8){return function(_0x5524f6){if(!_0x5524f6){_0x2aed3a[_0xd4ab('0x17')](0x194);}return _0x5524f6;};}function handleError(_0x555b74,_0x4f86e6){_0x4f86e6=_0x4f86e6||0x1f4;return function(_0x348103){logger[_0xd4ab('0x21')](_0x348103['stack']);if(_0x348103[_0xd4ab('0x22')]){delete _0x348103['name'];}_0x555b74['status'](_0x4f86e6)[_0xd4ab('0x23')](_0x348103);};}exports[_0xd4ab('0x24')]=function(_0x5af3dc,_0x447183){var _0x5f1980={},_0x148fd0={},_0x17fdc1={'count':0x0,'rows':[]};var _0x500d7a=_[_0xd4ab('0x25')](db[_0xd4ab('0x26')][_0xd4ab('0x27')],function(_0x463cb0){return{'name':_0x463cb0[_0xd4ab('0x28')],'type':_0x463cb0['type'][_0xd4ab('0x29')]};});_0x148fd0['model']=_['map'](_0x500d7a,_0xd4ab('0x22'));_0x148fd0[_0xd4ab('0x2a')]=_[_0xd4ab('0x2b')](_0x5af3dc[_0xd4ab('0x2a')]);_0x148fd0[_0xd4ab('0x2c')]=_[_0xd4ab('0x2d')](_0x148fd0['model'],_0x148fd0[_0xd4ab('0x2a')]);_0x5f1980[_0xd4ab('0x2e')]=_['intersection'](_0x148fd0['model'],qs[_0xd4ab('0x2f')](_0x5af3dc[_0xd4ab('0x2a')][_0xd4ab('0x2f')]));_0x5f1980[_0xd4ab('0x2e')]=_0x5f1980[_0xd4ab('0x2e')][_0xd4ab('0x30')]?_0x5f1980[_0xd4ab('0x2e')]:_0x148fd0['model'];if(!_0x5af3dc[_0xd4ab('0x2a')][_0xd4ab('0x31')](_0xd4ab('0x32'))){_0x5f1980[_0xd4ab('0x1d')]=qs[_0xd4ab('0x1d')](_0x5af3dc[_0xd4ab('0x2a')][_0xd4ab('0x1d')]);_0x5f1980[_0xd4ab('0x1b')]=qs[_0xd4ab('0x1b')](_0x5af3dc[_0xd4ab('0x2a')][_0xd4ab('0x1b')]);}_0x5f1980[_0xd4ab('0x33')]=qs[_0xd4ab('0x34')](_0x5af3dc[_0xd4ab('0x2a')]['sort']);_0x5f1980[_0xd4ab('0x35')]=qs[_0xd4ab('0x2c')](_['pick'](_0x5af3dc[_0xd4ab('0x2a')],_0x148fd0[_0xd4ab('0x2c')]),_0x500d7a);if(_0x5af3dc[_0xd4ab('0x2a')][_0xd4ab('0x36')]){_0x5f1980['where']=_[_0xd4ab('0x37')](_0x5f1980[_0xd4ab('0x35')],{'$or':_[_0xd4ab('0x25')](_0x500d7a,function(_0x50bcb2){if(_0x50bcb2['type']!==_0xd4ab('0x38')){var _0x4685cd={};_0x4685cd[_0x50bcb2['name']]={'$like':'%'+_0x5af3dc['query']['filter']+'%'};return _0x4685cd;}})});}_0x5f1980=_[_0xd4ab('0x37')]({},_0x5f1980,_0x5af3dc[_0xd4ab('0x39')]);var _0x533f77={'where':_0x5f1980[_0xd4ab('0x35')]};return db[_0xd4ab('0x26')][_0xd4ab('0x3a')](_0x533f77)['then'](function(_0x381a0f){_0x17fdc1[_0xd4ab('0x3a')]=_0x381a0f;if(_0x5af3dc[_0xd4ab('0x2a')][_0xd4ab('0x3b')]){_0x5f1980['include']=[{'all':!![]}];}return db[_0xd4ab('0x26')][_0xd4ab('0x3c')](_0x5f1980);})[_0xd4ab('0x1f')](function(_0x3f2777){_0x17fdc1[_0xd4ab('0x3d')]=_0x3f2777;return _0x17fdc1;})[_0xd4ab('0x1f')](respondWithFilteredResult(_0x447183,_0x5f1980))[_0xd4ab('0x3e')](handleError(_0x447183,null));};exports[_0xd4ab('0x3f')]=function(_0x5d14b7,_0x17da56){var _0x43ef8c={'raw':!![],'where':{'id':_0x5d14b7[_0xd4ab('0x40')]['id']}},_0x59b840={};_0x59b840[_0xd4ab('0x41')]=_['keys'](db[_0xd4ab('0x26')][_0xd4ab('0x27')]);_0x59b840[_0xd4ab('0x2a')]=_[_0xd4ab('0x2b')](_0x5d14b7[_0xd4ab('0x2a')]);_0x59b840[_0xd4ab('0x2c')]=_[_0xd4ab('0x2d')](_0x59b840[_0xd4ab('0x41')],_0x59b840[_0xd4ab('0x2a')]);_0x43ef8c[_0xd4ab('0x2e')]=_['intersection'](_0x59b840['model'],qs['fields'](_0x5d14b7[_0xd4ab('0x2a')][_0xd4ab('0x2f')]));_0x43ef8c[_0xd4ab('0x2e')]=_0x43ef8c[_0xd4ab('0x2e')]['length']?_0x43ef8c[_0xd4ab('0x2e')]:_0x59b840[_0xd4ab('0x41')];if(_0x5d14b7['query'][_0xd4ab('0x3b')]){_0x43ef8c[_0xd4ab('0x42')]=[{'all':!![]}];}_0x43ef8c=_['merge']({},_0x43ef8c,_0x5d14b7[_0xd4ab('0x39')]);return db[_0xd4ab('0x26')]['find'](_0x43ef8c)['then'](handleEntityNotFound(_0x17da56,null))[_0xd4ab('0x1f')](respondWithResult(_0x17da56,null))[_0xd4ab('0x3e')](handleError(_0x17da56,null));};exports['create']=function(_0x554d35,_0x10e1eb){return db[_0xd4ab('0x26')][_0xd4ab('0x43')](_0x554d35[_0xd4ab('0x44')],{})['then'](respondWithResult(_0x10e1eb,0xc9))['catch'](handleError(_0x10e1eb,null));};exports[_0xd4ab('0x45')]=function(_0x18225f,_0x48cf0a){if(_0x18225f[_0xd4ab('0x44')]['id']){delete _0x18225f[_0xd4ab('0x44')]['id'];}return db[_0xd4ab('0x26')][_0xd4ab('0x46')]({'where':{'id':_0x18225f[_0xd4ab('0x40')]['id']}})[_0xd4ab('0x1f')](handleEntityNotFound(_0x48cf0a,null))['then'](saveUpdates(_0x18225f[_0xd4ab('0x44')],null))[_0xd4ab('0x1f')](respondWithResult(_0x48cf0a,null))['catch'](handleError(_0x48cf0a,null));};exports[_0xd4ab('0x20')]=function(_0x5807dc,_0x15febe){return db[_0xd4ab('0x26')][_0xd4ab('0x46')]({'where':{'id':_0x5807dc[_0xd4ab('0x40')]['id']}})[_0xd4ab('0x1f')](handleEntityNotFound(_0x15febe,null))[_0xd4ab('0x1f')](removeEntity(_0x15febe,null))[_0xd4ab('0x3e')](handleError(_0x15febe,null));}; \ No newline at end of file +var _0x8588=['limit','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','index','SquareMessage','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','catch','show','rawAttributes','merge','find','create','update','body','destroy','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x1c8590,_0x2791ee){var _0x8898d1=function(_0x405673){while(--_0x405673){_0x1c8590['push'](_0x1c8590['shift']());}};_0x8898d1(++_0x2791ee);}(_0x8588,0x185));var _0x8858=function(_0x5ac188,_0x54cb25){_0x5ac188=_0x5ac188-0x0;var _0x190caf=_0x8588[_0x5ac188];return _0x190caf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8858('0x0'));var zipdir=require(_0x8858('0x1'));var jsonpatch=require(_0x8858('0x2'));var rp=require(_0x8858('0x3'));var moment=require('moment');var BPromise=require(_0x8858('0x4'));var Mustache=require(_0x8858('0x5'));var util=require(_0x8858('0x6'));var path=require('path');var sox=require(_0x8858('0x7'));var csv=require(_0x8858('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8858('0x9'));var _=require(_0x8858('0xa'));var squel=require(_0x8858('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8858('0x8'));var querystring=require('querystring');var Papa=require(_0x8858('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8858('0xd'));var as=require(_0x8858('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8858('0xf'));var utils=require(_0x8858('0x10'));var config=require(_0x8858('0x11'));var licenseUtil=require(_0x8858('0x12'));var db=require(_0x8858('0x13'))['db'];function respondWithStatusCode(_0x1f063a,_0x1da801){_0x1da801=_0x1da801||0xcc;return function(_0x3ebff2){if(_0x3ebff2){return _0x1f063a[_0x8858('0x14')](_0x1da801);}return _0x1f063a[_0x8858('0x15')](_0x1da801)[_0x8858('0x16')]();};}function respondWithResult(_0x1f6c96,_0x32be90){_0x32be90=_0x32be90||0xc8;return function(_0x424f1d){if(_0x424f1d){return _0x1f6c96[_0x8858('0x15')](_0x32be90)['json'](_0x424f1d);}};}function respondWithFilteredResult(_0x41f883,_0x5c0a1d){return function(_0x26c0bd){if(_0x26c0bd){var _0x22b356=typeof _0x5c0a1d[_0x8858('0x17')]===_0x8858('0x18')&&typeof _0x5c0a1d[_0x8858('0x19')]===_0x8858('0x18');var _0x251b32=_0x26c0bd[_0x8858('0x1a')];var _0x159aab=_0x22b356?0x0:_0x5c0a1d[_0x8858('0x17')];var _0x5b0880=_0x22b356?_0x26c0bd[_0x8858('0x1a')]:_0x5c0a1d[_0x8858('0x17')]+_0x5c0a1d[_0x8858('0x19')];var _0xcf674a;if(_0x5b0880>=_0x251b32){_0x5b0880=_0x251b32;_0xcf674a=0xc8;}else{_0xcf674a=0xce;}_0x41f883[_0x8858('0x15')](_0xcf674a);return _0x41f883[_0x8858('0x1b')](_0x8858('0x1c'),_0x159aab+'-'+_0x5b0880+'/'+_0x251b32)[_0x8858('0x1d')](_0x26c0bd);}return null;};}function patchUpdates(_0x837d58){return function(_0x19c37d){try{jsonpatch[_0x8858('0x1e')](_0x19c37d,_0x837d58,!![]);}catch(_0x30f607){return BPromise[_0x8858('0x1f')](_0x30f607);}return _0x19c37d[_0x8858('0x20')]();};}function saveUpdates(_0x546d2c,_0x55ec5b){return function(_0x1e7ee){if(_0x1e7ee){return _0x1e7ee['update'](_0x546d2c)[_0x8858('0x21')](function(_0x3b3301){return _0x3b3301;});}return null;};}function removeEntity(_0x3e31a0,_0x580fcb){return function(_0x4d7267){if(_0x4d7267){return _0x4d7267['destroy']()[_0x8858('0x21')](function(){_0x3e31a0[_0x8858('0x15')](0xcc)[_0x8858('0x16')]();});}};}function handleEntityNotFound(_0x11e03d,_0x479254){return function(_0x113e0c){if(!_0x113e0c){_0x11e03d[_0x8858('0x14')](0x194);}return _0x113e0c;};}function handleError(_0xf748fb,_0x1303c5){_0x1303c5=_0x1303c5||0x1f4;return function(_0x1e8f99){logger[_0x8858('0x22')](_0x1e8f99[_0x8858('0x23')]);if(_0x1e8f99[_0x8858('0x24')]){delete _0x1e8f99[_0x8858('0x24')];}_0xf748fb[_0x8858('0x15')](_0x1303c5)['send'](_0x1e8f99);};}exports[_0x8858('0x25')]=function(_0x4e2459,_0x3f9191){var _0x2fa4f9={},_0xba3171={},_0x1aaae3={'count':0x0,'rows':[]};var _0x89bec7=_['map'](db[_0x8858('0x26')]['rawAttributes'],function(_0xccfb93){return{'name':_0xccfb93['fieldName'],'type':_0xccfb93[_0x8858('0x27')]['key']};});_0xba3171['model']=_[_0x8858('0x28')](_0x89bec7,'name');_0xba3171[_0x8858('0x29')]=_[_0x8858('0x2a')](_0x4e2459[_0x8858('0x29')]);_0xba3171[_0x8858('0x2b')]=_[_0x8858('0x2c')](_0xba3171['model'],_0xba3171[_0x8858('0x29')]);_0x2fa4f9['attributes']=_['intersection'](_0xba3171[_0x8858('0x2d')],qs[_0x8858('0x2e')](_0x4e2459[_0x8858('0x29')][_0x8858('0x2e')]));_0x2fa4f9['attributes']=_0x2fa4f9[_0x8858('0x2f')][_0x8858('0x30')]?_0x2fa4f9[_0x8858('0x2f')]:_0xba3171[_0x8858('0x2d')];if(!_0x4e2459[_0x8858('0x29')][_0x8858('0x31')](_0x8858('0x32'))){_0x2fa4f9[_0x8858('0x19')]=qs[_0x8858('0x19')](_0x4e2459[_0x8858('0x29')][_0x8858('0x19')]);_0x2fa4f9[_0x8858('0x17')]=qs[_0x8858('0x17')](_0x4e2459[_0x8858('0x29')][_0x8858('0x17')]);}_0x2fa4f9[_0x8858('0x33')]=qs[_0x8858('0x34')](_0x4e2459['query']['sort']);_0x2fa4f9[_0x8858('0x35')]=qs[_0x8858('0x2b')](_['pick'](_0x4e2459[_0x8858('0x29')],_0xba3171[_0x8858('0x2b')]),_0x89bec7);if(_0x4e2459[_0x8858('0x29')]['filter']){_0x2fa4f9['where']=_['merge'](_0x2fa4f9[_0x8858('0x35')],{'$or':_[_0x8858('0x28')](_0x89bec7,function(_0x341dae){if(_0x341dae[_0x8858('0x27')]!=='VIRTUAL'){var _0x1ed1e2={};_0x1ed1e2[_0x341dae[_0x8858('0x24')]]={'$like':'%'+_0x4e2459[_0x8858('0x29')][_0x8858('0x36')]+'%'};return _0x1ed1e2;}})});}_0x2fa4f9=_['merge']({},_0x2fa4f9,_0x4e2459[_0x8858('0x37')]);var _0x21903f={'where':_0x2fa4f9[_0x8858('0x35')]};return db[_0x8858('0x26')][_0x8858('0x1a')](_0x21903f)['then'](function(_0x33fd2f){_0x1aaae3[_0x8858('0x1a')]=_0x33fd2f;if(_0x4e2459[_0x8858('0x29')][_0x8858('0x38')]){_0x2fa4f9[_0x8858('0x39')]=[{'all':!![]}];}return db[_0x8858('0x26')][_0x8858('0x3a')](_0x2fa4f9);})[_0x8858('0x21')](function(_0x3cadbf){_0x1aaae3['rows']=_0x3cadbf;return _0x1aaae3;})[_0x8858('0x21')](respondWithFilteredResult(_0x3f9191,_0x2fa4f9))[_0x8858('0x3b')](handleError(_0x3f9191,null));};exports[_0x8858('0x3c')]=function(_0xc6b4db,_0x5d33d0){var _0x1bdead={'raw':!![],'where':{'id':_0xc6b4db['params']['id']}},_0x5e86bd={};_0x5e86bd[_0x8858('0x2d')]=_[_0x8858('0x2a')](db[_0x8858('0x26')][_0x8858('0x3d')]);_0x5e86bd[_0x8858('0x29')]=_['keys'](_0xc6b4db[_0x8858('0x29')]);_0x5e86bd[_0x8858('0x2b')]=_['intersection'](_0x5e86bd[_0x8858('0x2d')],_0x5e86bd[_0x8858('0x29')]);_0x1bdead[_0x8858('0x2f')]=_[_0x8858('0x2c')](_0x5e86bd[_0x8858('0x2d')],qs[_0x8858('0x2e')](_0xc6b4db[_0x8858('0x29')][_0x8858('0x2e')]));_0x1bdead[_0x8858('0x2f')]=_0x1bdead[_0x8858('0x2f')][_0x8858('0x30')]?_0x1bdead[_0x8858('0x2f')]:_0x5e86bd[_0x8858('0x2d')];if(_0xc6b4db[_0x8858('0x29')][_0x8858('0x38')]){_0x1bdead[_0x8858('0x39')]=[{'all':!![]}];}_0x1bdead=_[_0x8858('0x3e')]({},_0x1bdead,_0xc6b4db['options']);return db[_0x8858('0x26')][_0x8858('0x3f')](_0x1bdead)['then'](handleEntityNotFound(_0x5d33d0,null))[_0x8858('0x21')](respondWithResult(_0x5d33d0,null))['catch'](handleError(_0x5d33d0,null));};exports[_0x8858('0x40')]=function(_0x34217a,_0x166d4d){return db['SquareMessage'][_0x8858('0x40')](_0x34217a['body'],{})['then'](respondWithResult(_0x166d4d,0xc9))[_0x8858('0x3b')](handleError(_0x166d4d,null));};exports[_0x8858('0x41')]=function(_0xe41edd,_0x147d0e){if(_0xe41edd[_0x8858('0x42')]['id']){delete _0xe41edd[_0x8858('0x42')]['id'];}return db[_0x8858('0x26')][_0x8858('0x3f')]({'where':{'id':_0xe41edd['params']['id']}})['then'](handleEntityNotFound(_0x147d0e,null))[_0x8858('0x21')](saveUpdates(_0xe41edd[_0x8858('0x42')],null))[_0x8858('0x21')](respondWithResult(_0x147d0e,null))[_0x8858('0x3b')](handleError(_0x147d0e,null));};exports[_0x8858('0x43')]=function(_0x48a32c,_0x2df438){return db['SquareMessage'][_0x8858('0x3f')]({'where':{'id':_0x48a32c[_0x8858('0x44')]['id']}})[_0x8858('0x21')](handleEntityNotFound(_0x2df438,null))[_0x8858('0x21')](removeEntity(_0x2df438,null))[_0x8858('0x3b')](handleError(_0x2df438,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index cd831f3..ba7bd31 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 _0xce2b=['SquareMessage','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x1194a5,_0xd0a243){var _0x339830=function(_0x36ef18){while(--_0x36ef18){_0x1194a5['push'](_0x1194a5['shift']());}};_0x339830(++_0xd0a243);}(_0xce2b,0x157));var _0xbce2=function(_0x3d259b,_0x29f950){_0x3d259b=_0x3d259b-0x0;var _0x108d50=_0xce2b[_0x3d259b];return _0x108d50;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbce2('0x0'))('api');var moment=require('moment');var BPromise=require(_0xbce2('0x1'));var rp=require(_0xbce2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbce2('0x3'));var config=require(_0xbce2('0x4'));var attributes=require(_0xbce2('0x5'));module[_0xbce2('0x6')]=function(_0x571846,_0x7f1846){return _0x571846[_0xbce2('0x7')](_0xbce2('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f98=['exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x4f4d47,_0x5b2321){var _0x4ffe85=function(_0x5ca693){while(--_0x5ca693){_0x4f4d47['push'](_0x4f4d47['shift']());}};_0x4ffe85(++_0x5b2321);}(_0x8f98,0x6c));var _0x88f9=function(_0x212ba2,_0x210212){_0x212ba2=_0x212ba2-0x0;var _0x3c6e1f=_0x8f98[_0x212ba2];return _0x3c6e1f;};'use strict';var _=require(_0x88f9('0x0'));var util=require(_0x88f9('0x1'));var logger=require(_0x88f9('0x2'))(_0x88f9('0x3'));var moment=require(_0x88f9('0x4'));var BPromise=require(_0x88f9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x88f9('0x6'));var config=require(_0x88f9('0x7'));var attributes=require(_0x88f9('0x8'));module[_0x88f9('0x9')]=function(_0x340efd,_0x325fc7){return _0x340efd[_0x88f9('0xa')](_0x88f9('0xb'),attributes,{'tableName':_0x88f9('0xc'),'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 9341c6d..9939567 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 _0xbd0e=['http','request','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareMessage','create','options','then','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x1b5da7,_0x400504){var _0x22dec2=function(_0x12e240){while(--_0x12e240){_0x1b5da7['push'](_0x1b5da7['shift']());}};_0x22dec2(++_0x400504);}(_0xbd0e,0xf6));var _0xebd0=function(_0x59cda9,_0x47d4c4){_0x59cda9=_0x59cda9-0x0;var _0x26c18f=_0xbd0e[_0x59cda9];return _0x26c18f;};'use strict';var _=require(_0xebd0('0x0'));var util=require(_0xebd0('0x1'));var moment=require('moment');var BPromise=require(_0xebd0('0x2'));var rs=require(_0xebd0('0x3'));var fs=require('fs');var Redis=require(_0xebd0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xebd0('0x5'))('rpc');var config=require(_0xebd0('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xebd0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55c658,_0x551141,_0x5d6910){return new BPromise(function(_0x37b1dd,_0x34efd2){return client[_0xebd0('0x8')](_0x55c658,_0x5d6910)['then'](function(_0x166adf){logger[_0xebd0('0x9')](_0xebd0('0xa'),_0x551141,'request\x20sent');logger[_0xebd0('0xb')](_0xebd0('0xc'),_0x551141,_0xebd0('0xd'),JSON[_0xebd0('0xe')](_0x166adf));if(_0x166adf[_0xebd0('0xf')]){if(_0x166adf[_0xebd0('0xf')]['code']===0x1f4){logger['error'](_0xebd0('0xa'),_0x551141,_0x166adf[_0xebd0('0xf')][_0xebd0('0x10')]);return _0x34efd2(_0x166adf[_0xebd0('0xf')][_0xebd0('0x10')]);}logger[_0xebd0('0xf')](_0xebd0('0xa'),_0x551141,_0x166adf['error'][_0xebd0('0x10')]);return _0x37b1dd(_0x166adf['error'][_0xebd0('0x10')]);}else{logger[_0xebd0('0x9')](_0xebd0('0xa'),_0x551141,_0xebd0('0xd'));_0x37b1dd(_0x166adf[_0xebd0('0x11')][_0xebd0('0x10')]);}})[_0xebd0('0x12')](function(_0x32a5a7){logger[_0xebd0('0xf')](_0xebd0('0xa'),_0x551141,_0x32a5a7);_0x34efd2(_0x32a5a7);});});}exports[_0xebd0('0x13')]=function(_0x4489f5){var _0x59ff1a=this;return new Promise(function(_0x2dc637,_0x52f099){return db['SquareMessage'][_0xebd0('0x14')](_0x4489f5['body'],{'raw':_0x4489f5['options']?_0x4489f5[_0xebd0('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xebd0('0x16')](function(_0x5164e8){logger[_0xebd0('0x9')](_0xebd0('0x13'),_0x4489f5);logger[_0xebd0('0xb')](_0xebd0('0x13'),_0x4489f5,JSON['stringify'](_0x5164e8));_0x2dc637(_0x5164e8);})['catch'](function(_0x45c92c){logger[_0xebd0('0xf')](_0xebd0('0x13'),_0x45c92c[_0xebd0('0x10')],_0x4489f5);_0x52f099(_0x59ff1a[_0xebd0('0xf')](0x1f4,_0x45c92c[_0xebd0('0x10')]));});});}; \ No newline at end of file +var _0x5501=['request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','info','catch','CreateSquareMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5501,0x138));var _0x1550=function(_0x32ff40,_0x1c80ca){_0x32ff40=_0x32ff40-0x0;var _0x19c160=_0x5501[_0x32ff40];return _0x19c160;};'use strict';var _=require(_0x1550('0x0'));var util=require(_0x1550('0x1'));var moment=require(_0x1550('0x2'));var BPromise=require(_0x1550('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1550('0x4'));var db=require(_0x1550('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1550('0x6'))(_0x1550('0x7'));var config=require(_0x1550('0x8'));var jayson=require(_0x1550('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23510a,_0x4b2ed4,_0xf49069){return new BPromise(function(_0x19d240,_0x1e0f64){return client[_0x1550('0xa')](_0x23510a,_0xf49069)[_0x1550('0xb')](function(_0x22caf4){logger['info']('SquareMessage,\x20%s,\x20%s',_0x4b2ed4,_0x1550('0xc'));logger[_0x1550('0xd')](_0x1550('0xe'),_0x4b2ed4,_0x1550('0xc'),JSON[_0x1550('0xf')](_0x22caf4));if(_0x22caf4['error']){if(_0x22caf4[_0x1550('0x10')][_0x1550('0x11')]===0x1f4){logger[_0x1550('0x10')](_0x1550('0x12'),_0x4b2ed4,_0x22caf4[_0x1550('0x10')][_0x1550('0x13')]);return _0x1e0f64(_0x22caf4[_0x1550('0x10')]['message']);}logger['error'](_0x1550('0x12'),_0x4b2ed4,_0x22caf4[_0x1550('0x10')][_0x1550('0x13')]);return _0x19d240(_0x22caf4['error'][_0x1550('0x13')]);}else{logger[_0x1550('0x14')](_0x1550('0x12'),_0x4b2ed4,'request\x20sent');_0x19d240(_0x22caf4['result'][_0x1550('0x13')]);}})[_0x1550('0x15')](function(_0x78b558){logger[_0x1550('0x10')](_0x1550('0x12'),_0x4b2ed4,_0x78b558);_0x1e0f64(_0x78b558);});});}exports[_0x1550('0x16')]=function(_0x221a1a){var _0x5c52c6=this;return new Promise(function(_0x30d8ef,_0x4f8fbe){return db['SquareMessage'][_0x1550('0x17')](_0x221a1a[_0x1550('0x18')],{'raw':_0x221a1a[_0x1550('0x19')]?_0x221a1a[_0x1550('0x19')][_0x1550('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xc22721){logger[_0x1550('0x14')](_0x1550('0x16'),_0x221a1a);logger[_0x1550('0xd')](_0x1550('0x16'),_0x221a1a,JSON[_0x1550('0xf')](_0xc22721));_0x30d8ef(_0xc22721);})[_0x1550('0x15')](function(_0x2c1930){logger[_0x1550('0x10')](_0x1550('0x16'),_0x2c1930[_0x1550('0x13')],_0x221a1a);_0x4f8fbe(_0x5c52c6[_0x1550('0x10')](0x1f4,_0x2c1930[_0x1550('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 6171dd9..a56cfc8 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 _0x8078=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','index','isAuthenticated','show','get','/:id/test','test','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3dbc1a,_0x4d4683){var _0x5c0c7c=function(_0x54bca3){while(--_0x54bca3){_0x3dbc1a['push'](_0x3dbc1a['shift']());}};_0x5c0c7c(++_0x4d4683);}(_0x8078,0x14e));var _0x8807=function(_0x593c31,_0x383229){_0x593c31=_0x593c31-0x0;var _0x164509=_0x8078[_0x593c31];return _0x164509;};'use strict';var multer=require(_0x8807('0x0'));var util=require(_0x8807('0x1'));var path=require(_0x8807('0x2'));var timeout=require(_0x8807('0x3'));var express=require(_0x8807('0x4'));var router=express[_0x8807('0x5')]();var fs_extra=require(_0x8807('0x6'));var auth=require(_0x8807('0x7'));var interaction=require(_0x8807('0x8'));var config=require(_0x8807('0x9'));var controller=require(_0x8807('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x8807('0xb')]);router['get']('/:id',auth[_0x8807('0xc')](),controller[_0x8807('0xd')]);router[_0x8807('0xe')](_0x8807('0xf'),auth['isAuthenticated'](),timeout('15s'),controller[_0x8807('0x10')]);router[_0x8807('0x11')]('/',auth[_0x8807('0xc')](),controller['create']);router[_0x8807('0x12')](_0x8807('0x13'),auth['isAuthenticated'](),controller[_0x8807('0x14')]);router[_0x8807('0x15')](_0x8807('0x13'),auth[_0x8807('0xc')](),controller[_0x8807('0x16')]);module[_0x8807('0x17')]=router; \ No newline at end of file +var _0x0bab=['index','get','/:id','isAuthenticated','show','/:id/test','15s','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0bab,0x173));var _0xb0ba=function(_0x2e48fc,_0x26a77f){_0x2e48fc=_0x2e48fc-0x0;var _0x1978d8=_0x0bab[_0x2e48fc];return _0x1978d8;};'use strict';var multer=require('multer');var util=require(_0xb0ba('0x0'));var path=require(_0xb0ba('0x1'));var timeout=require('connect-timeout');var express=require(_0xb0ba('0x2'));var router=express[_0xb0ba('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb0ba('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb0ba('0x5'));var controller=require(_0xb0ba('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb0ba('0x7')]);router[_0xb0ba('0x8')](_0xb0ba('0x9'),auth[_0xb0ba('0xa')](),controller[_0xb0ba('0xb')]);router[_0xb0ba('0x8')](_0xb0ba('0xc'),auth['isAuthenticated'](),timeout(_0xb0ba('0xd')),controller['test']);router[_0xb0ba('0xe')]('/',auth['isAuthenticated'](),controller[_0xb0ba('0xf')]);router[_0xb0ba('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb0ba('0x11')]);router[_0xb0ba('0x12')](_0xb0ba('0x9'),auth[_0xb0ba('0xa')](),controller[_0xb0ba('0x13')]);module[_0xb0ba('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5cdf4f6..869ef88 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 _0x0738=['sequelize','STRING'];(function(_0x131a9c,_0x4380c5){var _0x1cc059=function(_0x511007){while(--_0x511007){_0x131a9c['push'](_0x131a9c['shift']());}};_0x1cc059(++_0x4380c5);}(_0x0738,0x110));var _0x8073=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x0738[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0x8073('0x0'));module['exports']={'name':{'type':Sequelize[_0x8073('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8073('0x1')]}}; \ No newline at end of file +var _0x0f20=['sequelize','STRING','name'];(function(_0x43cee5,_0x2a6034){var _0x444f48=function(_0x3f4c65){while(--_0x3f4c65){_0x43cee5['push'](_0x43cee5['shift']());}};_0x444f48(++_0x2a6034);}(_0x0f20,0xa8));var _0x00f2=function(_0x5decd3,_0x1d9804){_0x5decd3=_0x5decd3-0x0;var _0x429117=_0x0f20[_0x5decd3];return _0x429117;};'use strict';var Sequelize=require(_0x00f2('0x0'));module['exports']={'name':{'type':Sequelize[_0x00f2('0x1')],'unique':_0x00f2('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x00f2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a189221..a022d1a 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 _0x5982=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','dsn','odbc','closeSync','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../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','reject','save','update','destroy','then','get','error','stack','name','index','map','SquareOdbc','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource'];(function(_0x5cd56d,_0x2df9f1){var _0x36fe10=function(_0x2306b5){while(--_0x2306b5){_0x5cd56d['push'](_0x5cd56d['shift']());}};_0x36fe10(++_0x2df9f1);}(_0x5982,0x106));var _0x2598=function(_0x598672,_0x3cabb8){_0x598672=_0x598672-0x0;var _0x24e751=_0x5982[_0x598672];return _0x24e751;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2598('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2598('0x1'));var rp=require(_0x2598('0x2'));var moment=require(_0x2598('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2598('0x4'));var path=require(_0x2598('0x5'));var sox=require(_0x2598('0x6'));var csv=require(_0x2598('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2598('0x8'));var squel=require(_0x2598('0x9'));var crypto=require('crypto');var jsforce=require(_0x2598('0xa'));var deskjs=require(_0x2598('0xb'));var toCsv=require(_0x2598('0x7'));var querystring=require('querystring');var Papa=require(_0x2598('0xc'));var Redis=require(_0x2598('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2598('0xe'));var hardwareService=require(_0x2598('0xf'));var logger=require(_0x2598('0x10'))(_0x2598('0x11'));var utils=require(_0x2598('0x12'));var config=require(_0x2598('0x13'));var licenseUtil=require(_0x2598('0x14'));var db=require(_0x2598('0x15'))['db'];function respondWithStatusCode(_0x401246,_0xf92345){_0xf92345=_0xf92345||0xcc;return function(_0x22b483){if(_0x22b483){return _0x401246[_0x2598('0x16')](_0xf92345);}return _0x401246['status'](_0xf92345)[_0x2598('0x17')]();};}function respondWithResult(_0x343607,_0x1e6a3a){_0x1e6a3a=_0x1e6a3a||0xc8;return function(_0x55353d){if(_0x55353d){return _0x343607[_0x2598('0x18')](_0x1e6a3a)[_0x2598('0x19')](_0x55353d);}};}function respondWithFilteredResult(_0x5c2a27,_0x1ed1a3){return function(_0xb19ef7){if(_0xb19ef7){var _0x4db765=typeof _0x1ed1a3[_0x2598('0x1a')]===_0x2598('0x1b')&&typeof _0x1ed1a3[_0x2598('0x1c')]===_0x2598('0x1b');var _0x3e77ef=_0xb19ef7['count'];var _0x4c5a26=_0x4db765?0x0:_0x1ed1a3[_0x2598('0x1a')];var _0x43c32b=_0x4db765?_0xb19ef7[_0x2598('0x1d')]:_0x1ed1a3[_0x2598('0x1a')]+_0x1ed1a3[_0x2598('0x1c')];var _0x283ad5;if(_0x43c32b>=_0x3e77ef){_0x43c32b=_0x3e77ef;_0x283ad5=0xc8;}else{_0x283ad5=0xce;}_0x5c2a27[_0x2598('0x18')](_0x283ad5);return _0x5c2a27[_0x2598('0x1e')](_0x2598('0x1f'),_0x4c5a26+'-'+_0x43c32b+'/'+_0x3e77ef)[_0x2598('0x19')](_0xb19ef7);}return null;};}function patchUpdates(_0x56a1f5){return function(_0x1feb65){try{jsonpatch['apply'](_0x1feb65,_0x56a1f5,!![]);}catch(_0x44019f){return BPromise[_0x2598('0x20')](_0x44019f);}return _0x1feb65[_0x2598('0x21')]();};}function saveUpdates(_0x358b1a,_0x26aebe){return function(_0x4bf0cd){if(_0x4bf0cd){return _0x4bf0cd[_0x2598('0x22')](_0x358b1a)['then'](function(_0x1b467d){return _0x1b467d;});}return null;};}function removeEntity(_0x15311d,_0x367178){return function(_0xece768){if(_0xece768){return _0xece768[_0x2598('0x23')]()[_0x2598('0x24')](function(){var _0x2c518b=_0xece768[_0x2598('0x25')]({'plain':!![]});var _0x318dc8='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x318dc8,'resourceId':_0x2c518b['id']}})[_0x2598('0x24')](function(){return _0xece768;});})['then'](function(){_0x15311d[_0x2598('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3846e0,_0x16b745){return function(_0x287b80){if(!_0x287b80){_0x3846e0['sendStatus'](0x194);}return _0x287b80;};}function handleError(_0x3270ad,_0x313ee0){_0x313ee0=_0x313ee0||0x1f4;return function(_0x1d185a){logger[_0x2598('0x26')](_0x1d185a[_0x2598('0x27')]);if(_0x1d185a[_0x2598('0x28')]){delete _0x1d185a[_0x2598('0x28')];}_0x3270ad[_0x2598('0x18')](_0x313ee0)['send'](_0x1d185a);};}exports[_0x2598('0x29')]=function(_0x314d96,_0x5a6d0a){var _0x9c3f5e={},_0x2a0acb={},_0x4ce8d3={'count':0x0,'rows':[]};var _0x3b2cdb=_[_0x2598('0x2a')](db[_0x2598('0x2b')]['rawAttributes'],function(_0x324206){return{'name':_0x324206['fieldName'],'type':_0x324206[_0x2598('0x2c')][_0x2598('0x2d')]};});_0x2a0acb[_0x2598('0x2e')]=_[_0x2598('0x2a')](_0x3b2cdb,_0x2598('0x28'));_0x2a0acb[_0x2598('0x2f')]=_[_0x2598('0x30')](_0x314d96[_0x2598('0x2f')]);_0x2a0acb[_0x2598('0x31')]=_['intersection'](_0x2a0acb['model'],_0x2a0acb['query']);_0x9c3f5e[_0x2598('0x32')]=_[_0x2598('0x33')](_0x2a0acb['model'],qs[_0x2598('0x34')](_0x314d96[_0x2598('0x2f')]['fields']));_0x9c3f5e[_0x2598('0x32')]=_0x9c3f5e[_0x2598('0x32')][_0x2598('0x35')]?_0x9c3f5e['attributes']:_0x2a0acb[_0x2598('0x2e')];if(!_0x314d96[_0x2598('0x2f')][_0x2598('0x36')]('nolimit')){_0x9c3f5e[_0x2598('0x1c')]=qs[_0x2598('0x1c')](_0x314d96[_0x2598('0x2f')]['limit']);_0x9c3f5e[_0x2598('0x1a')]=qs['offset'](_0x314d96['query'][_0x2598('0x1a')]);}_0x9c3f5e[_0x2598('0x37')]=qs[_0x2598('0x38')](_0x314d96[_0x2598('0x2f')]['sort']);_0x9c3f5e[_0x2598('0x39')]=qs[_0x2598('0x31')](_[_0x2598('0x3a')](_0x314d96[_0x2598('0x2f')],_0x2a0acb[_0x2598('0x31')]),_0x3b2cdb);if(_0x314d96[_0x2598('0x2f')][_0x2598('0x3b')]){_0x9c3f5e[_0x2598('0x39')]=_[_0x2598('0x3c')](_0x9c3f5e[_0x2598('0x39')],{'$or':_['map'](_0x3b2cdb,function(_0x58b92a){if(_0x58b92a['type']!==_0x2598('0x3d')){var _0xbeba21={};_0xbeba21[_0x58b92a[_0x2598('0x28')]]={'$like':'%'+_0x314d96[_0x2598('0x2f')]['filter']+'%'};return _0xbeba21;}})});}_0x9c3f5e=_['merge']({},_0x9c3f5e,_0x314d96[_0x2598('0x3e')]);var _0x1198ea={'where':_0x9c3f5e[_0x2598('0x39')]};return db[_0x2598('0x2b')][_0x2598('0x1d')](_0x1198ea)[_0x2598('0x24')](function(_0x11d0f2){_0x4ce8d3[_0x2598('0x1d')]=_0x11d0f2;if(_0x314d96[_0x2598('0x2f')][_0x2598('0x3f')]){_0x9c3f5e[_0x2598('0x40')]=[{'all':!![]}];}return db[_0x2598('0x2b')][_0x2598('0x41')](_0x9c3f5e);})[_0x2598('0x24')](function(_0x4c2aa8){_0x4ce8d3['rows']=_0x4c2aa8;return _0x4ce8d3;})[_0x2598('0x24')](respondWithFilteredResult(_0x5a6d0a,_0x9c3f5e))['catch'](handleError(_0x5a6d0a,null));};exports[_0x2598('0x42')]=function(_0x3d00d0,_0x4ff3f9){var _0x815bf3={'raw':!![],'where':{'id':_0x3d00d0['params']['id']}},_0x15e6a6={};_0x15e6a6[_0x2598('0x2e')]=_[_0x2598('0x30')](db[_0x2598('0x2b')]['rawAttributes']);_0x15e6a6[_0x2598('0x2f')]=_['keys'](_0x3d00d0[_0x2598('0x2f')]);_0x15e6a6['filters']=_[_0x2598('0x33')](_0x15e6a6[_0x2598('0x2e')],_0x15e6a6[_0x2598('0x2f')]);_0x815bf3['attributes']=_[_0x2598('0x33')](_0x15e6a6[_0x2598('0x2e')],qs['fields'](_0x3d00d0[_0x2598('0x2f')]['fields']));_0x815bf3['attributes']=_0x815bf3[_0x2598('0x32')][_0x2598('0x35')]?_0x815bf3['attributes']:_0x15e6a6[_0x2598('0x2e')];if(_0x3d00d0[_0x2598('0x2f')]['includeAll']){_0x815bf3[_0x2598('0x40')]=[{'all':!![]}];}_0x815bf3=_[_0x2598('0x3c')]({},_0x815bf3,_0x3d00d0[_0x2598('0x3e')]);return db['SquareOdbc']['find'](_0x815bf3)[_0x2598('0x24')](handleEntityNotFound(_0x4ff3f9,null))[_0x2598('0x24')](respondWithResult(_0x4ff3f9,null))[_0x2598('0x43')](handleError(_0x4ff3f9,null));};exports['create']=function(_0x6ee680,_0x316d0f){return db[_0x2598('0x2b')][_0x2598('0x44')](_0x6ee680['body'],{})[_0x2598('0x24')](function(_0x205db8){var _0x34fc8c=_0x6ee680[_0x2598('0x45')]['get']({'plain':!![]});if(!_0x34fc8c)throw new Error(_0x2598('0x46'));if(_0x34fc8c[_0x2598('0x47')]===_0x2598('0x45')){var _0x48e34d=_0x205db8[_0x2598('0x25')]({'plain':!![]});var _0x1148cb=_0x2598('0x48');return db[_0x2598('0x49')][_0x2598('0x4a')]({'where':{'name':_0x1148cb,'userProfileId':_0x34fc8c[_0x2598('0x4b')]},'raw':!![]})[_0x2598('0x24')](function(_0x200300){if(_0x200300&&_0x200300[_0x2598('0x4c')]===0x0){return db[_0x2598('0x4d')][_0x2598('0x44')]({'name':_0x48e34d[_0x2598('0x28')],'resourceId':_0x48e34d['id'],'type':_0x200300[_0x2598('0x28')],'sectionId':_0x200300['id']},{})[_0x2598('0x24')](function(){return _0x205db8;});}else{return _0x205db8;}})[_0x2598('0x43')](function(_0x848999){logger[_0x2598('0x26')](_0x2598('0x4e'),_0x848999);throw _0x848999;});}return _0x205db8;})[_0x2598('0x24')](respondWithResult(_0x316d0f,0xc9))[_0x2598('0x43')](handleError(_0x316d0f,null));};exports[_0x2598('0x22')]=function(_0x47186a,_0xfe32c){if(_0x47186a[_0x2598('0x4f')]['id']){delete _0x47186a['body']['id'];}return db[_0x2598('0x2b')][_0x2598('0x4a')]({'where':{'id':_0x47186a[_0x2598('0x50')]['id']}})[_0x2598('0x24')](handleEntityNotFound(_0xfe32c,null))[_0x2598('0x24')](saveUpdates(_0x47186a['body'],null))[_0x2598('0x24')](respondWithResult(_0xfe32c,null))[_0x2598('0x43')](handleError(_0xfe32c,null));};exports['destroy']=function(_0x3c9ec1,_0x43992d){return db['SquareOdbc'][_0x2598('0x4a')]({'where':{'id':_0x3c9ec1[_0x2598('0x50')]['id']}})[_0x2598('0x24')](handleEntityNotFound(_0x43992d,null))[_0x2598('0x24')](removeEntity(_0x43992d,null))[_0x2598('0x43')](handleError(_0x43992d,null));};exports[_0x2598('0x51')]=function(_0x533298,_0x128eec,_0x420894){var _0x3f57f2;return db[_0x2598('0x2b')][_0x2598('0x4a')]({'where':{'id':_0x533298['params']['id']},'attributes':['id',_0x2598('0x52')]})[_0x2598('0x24')](handleEntityNotFound(_0x128eec,null))[_0x2598('0x24')](function(_0x179ab0){if(_0x179ab0){var _0x5cb7c6=require(_0x2598('0x53'))();_0x5cb7c6['openSync'](_0x179ab0['dsn']);_0x5cb7c6[_0x2598('0x54')]();return _0x179ab0;}})['then'](respondWithResult(_0x128eec,null))['catch'](handleError(_0x128eec,null));}; \ No newline at end of file +var _0x4e31=['fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','status','end','offset','undefined','count','set','reject','update','then','destroy','ODBC','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','show','params','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','dsn','odbc','openSync','closeSync','rimraf'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4e31,0x1cd));var _0x14e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4e31[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14e3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14e3('0x1'));var rp=require(_0x14e3('0x2'));var moment=require('moment');var BPromise=require(_0x14e3('0x3'));var Mustache=require('mustache');var util=require(_0x14e3('0x4'));var path=require(_0x14e3('0x5'));var sox=require(_0x14e3('0x6'));var csv=require(_0x14e3('0x7'));var ejs=require(_0x14e3('0x8'));var fs=require('fs');var fs_extra=require(_0x14e3('0x9'));var _=require('lodash');var squel=require(_0x14e3('0xa'));var crypto=require(_0x14e3('0xb'));var jsforce=require(_0x14e3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x14e3('0x7'));var querystring=require(_0x14e3('0xd'));var Papa=require(_0x14e3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14e3('0xf'));var hardwareService=require(_0x14e3('0x10'));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('../../mysqldb')['db'];function respondWithStatusCode(_0x4c0018,_0x4f569e){_0x4f569e=_0x4f569e||0xcc;return function(_0x50b846){if(_0x50b846){return _0x4c0018['sendStatus'](_0x4f569e);}return _0x4c0018[_0x14e3('0x11')](_0x4f569e)[_0x14e3('0x12')]();};}function respondWithResult(_0x38d2fd,_0xaaddcb){_0xaaddcb=_0xaaddcb||0xc8;return function(_0x1e75e6){if(_0x1e75e6){return _0x38d2fd[_0x14e3('0x11')](_0xaaddcb)['json'](_0x1e75e6);}};}function respondWithFilteredResult(_0x3f8f3d,_0x38ac49){return function(_0x104050){if(_0x104050){var _0x5d7b6c=typeof _0x38ac49[_0x14e3('0x13')]===_0x14e3('0x14')&&typeof _0x38ac49['limit']==='undefined';var _0x4a3155=_0x104050['count'];var _0xc3dfa=_0x5d7b6c?0x0:_0x38ac49[_0x14e3('0x13')];var _0x51a067=_0x5d7b6c?_0x104050[_0x14e3('0x15')]:_0x38ac49[_0x14e3('0x13')]+_0x38ac49['limit'];var _0x1de242;if(_0x51a067>=_0x4a3155){_0x51a067=_0x4a3155;_0x1de242=0xc8;}else{_0x1de242=0xce;}_0x3f8f3d['status'](_0x1de242);return _0x3f8f3d[_0x14e3('0x16')]('Content-Range',_0xc3dfa+'-'+_0x51a067+'/'+_0x4a3155)['json'](_0x104050);}return null;};}function patchUpdates(_0x424445){return function(_0x3805a0){try{jsonpatch['apply'](_0x3805a0,_0x424445,!![]);}catch(_0x46707e){return BPromise[_0x14e3('0x17')](_0x46707e);}return _0x3805a0['save']();};}function saveUpdates(_0x41956e,_0x3ee210){return function(_0x30edb6){if(_0x30edb6){return _0x30edb6[_0x14e3('0x18')](_0x41956e)[_0x14e3('0x19')](function(_0x28c493){return _0x28c493;});}return null;};}function removeEntity(_0x343a7d,_0x11b2ef){return function(_0x1c1e17){if(_0x1c1e17){return _0x1c1e17[_0x14e3('0x1a')]()[_0x14e3('0x19')](function(){var _0xa0ab21=_0x1c1e17['get']({'plain':!![]});var _0x44532d=_0x14e3('0x1b');return db[_0x14e3('0x1c')][_0x14e3('0x1a')]({'where':{'type':_0x44532d,'resourceId':_0xa0ab21['id']}})[_0x14e3('0x19')](function(){return _0x1c1e17;});})['then'](function(){_0x343a7d['status'](0xcc)[_0x14e3('0x12')]();});}};}function handleEntityNotFound(_0x3e3fad,_0xae93e3){return function(_0x96cfa2){if(!_0x96cfa2){_0x3e3fad[_0x14e3('0x1d')](0x194);}return _0x96cfa2;};}function handleError(_0x12afba,_0x51cff3){_0x51cff3=_0x51cff3||0x1f4;return function(_0x124db6){logger[_0x14e3('0x1e')](_0x124db6[_0x14e3('0x1f')]);if(_0x124db6[_0x14e3('0x20')]){delete _0x124db6[_0x14e3('0x20')];}_0x12afba['status'](_0x51cff3)[_0x14e3('0x21')](_0x124db6);};}exports[_0x14e3('0x22')]=function(_0x393d36,_0x2d9b3f){var _0x1082e0={},_0x5786a2={},_0x38794b={'count':0x0,'rows':[]};var _0x219524=_[_0x14e3('0x23')](db[_0x14e3('0x24')][_0x14e3('0x25')],function(_0x3e1503){return{'name':_0x3e1503[_0x14e3('0x26')],'type':_0x3e1503['type'][_0x14e3('0x27')]};});_0x5786a2['model']=_[_0x14e3('0x23')](_0x219524,_0x14e3('0x20'));_0x5786a2['query']=_[_0x14e3('0x28')](_0x393d36[_0x14e3('0x29')]);_0x5786a2[_0x14e3('0x2a')]=_[_0x14e3('0x2b')](_0x5786a2[_0x14e3('0x2c')],_0x5786a2[_0x14e3('0x29')]);_0x1082e0[_0x14e3('0x2d')]=_['intersection'](_0x5786a2[_0x14e3('0x2c')],qs[_0x14e3('0x2e')](_0x393d36[_0x14e3('0x29')][_0x14e3('0x2e')]));_0x1082e0['attributes']=_0x1082e0[_0x14e3('0x2d')][_0x14e3('0x2f')]?_0x1082e0[_0x14e3('0x2d')]:_0x5786a2['model'];if(!_0x393d36['query'][_0x14e3('0x30')](_0x14e3('0x31'))){_0x1082e0['limit']=qs['limit'](_0x393d36['query']['limit']);_0x1082e0[_0x14e3('0x13')]=qs[_0x14e3('0x13')](_0x393d36[_0x14e3('0x29')][_0x14e3('0x13')]);}_0x1082e0[_0x14e3('0x32')]=qs[_0x14e3('0x33')](_0x393d36[_0x14e3('0x29')]['sort']);_0x1082e0[_0x14e3('0x34')]=qs[_0x14e3('0x2a')](_[_0x14e3('0x35')](_0x393d36[_0x14e3('0x29')],_0x5786a2[_0x14e3('0x2a')]),_0x219524);if(_0x393d36[_0x14e3('0x29')][_0x14e3('0x36')]){_0x1082e0[_0x14e3('0x34')]=_['merge'](_0x1082e0[_0x14e3('0x34')],{'$or':_[_0x14e3('0x23')](_0x219524,function(_0x1fed1d){if(_0x1fed1d[_0x14e3('0x37')]!=='VIRTUAL'){var _0x5bedab={};_0x5bedab[_0x1fed1d['name']]={'$like':'%'+_0x393d36['query'][_0x14e3('0x36')]+'%'};return _0x5bedab;}})});}_0x1082e0=_[_0x14e3('0x38')]({},_0x1082e0,_0x393d36[_0x14e3('0x39')]);var _0x12ec2d={'where':_0x1082e0[_0x14e3('0x34')]};return db[_0x14e3('0x24')][_0x14e3('0x15')](_0x12ec2d)[_0x14e3('0x19')](function(_0x2c3537){_0x38794b[_0x14e3('0x15')]=_0x2c3537;if(_0x393d36['query'][_0x14e3('0x3a')]){_0x1082e0[_0x14e3('0x3b')]=[{'all':!![]}];}return db[_0x14e3('0x24')][_0x14e3('0x3c')](_0x1082e0);})[_0x14e3('0x19')](function(_0x28a006){_0x38794b['rows']=_0x28a006;return _0x38794b;})[_0x14e3('0x19')](respondWithFilteredResult(_0x2d9b3f,_0x1082e0))['catch'](handleError(_0x2d9b3f,null));};exports[_0x14e3('0x3d')]=function(_0x4ded3f,_0x2ee5ac){var _0x1255ef={'raw':!![],'where':{'id':_0x4ded3f[_0x14e3('0x3e')]['id']}},_0x178efd={};_0x178efd[_0x14e3('0x2c')]=_[_0x14e3('0x28')](db[_0x14e3('0x24')][_0x14e3('0x25')]);_0x178efd[_0x14e3('0x29')]=_[_0x14e3('0x28')](_0x4ded3f[_0x14e3('0x29')]);_0x178efd[_0x14e3('0x2a')]=_[_0x14e3('0x2b')](_0x178efd['model'],_0x178efd['query']);_0x1255ef[_0x14e3('0x2d')]=_['intersection'](_0x178efd[_0x14e3('0x2c')],qs[_0x14e3('0x2e')](_0x4ded3f[_0x14e3('0x29')][_0x14e3('0x2e')]));_0x1255ef[_0x14e3('0x2d')]=_0x1255ef[_0x14e3('0x2d')][_0x14e3('0x2f')]?_0x1255ef[_0x14e3('0x2d')]:_0x178efd[_0x14e3('0x2c')];if(_0x4ded3f[_0x14e3('0x29')][_0x14e3('0x3a')]){_0x1255ef[_0x14e3('0x3b')]=[{'all':!![]}];}_0x1255ef=_[_0x14e3('0x38')]({},_0x1255ef,_0x4ded3f[_0x14e3('0x39')]);return db[_0x14e3('0x24')]['find'](_0x1255ef)[_0x14e3('0x19')](handleEntityNotFound(_0x2ee5ac,null))[_0x14e3('0x19')](respondWithResult(_0x2ee5ac,null))[_0x14e3('0x3f')](handleError(_0x2ee5ac,null));};exports[_0x14e3('0x40')]=function(_0x11170e,_0x388342){return db['SquareOdbc']['create'](_0x11170e[_0x14e3('0x41')],{})['then'](function(_0x3dc051){var _0xe54873=_0x11170e[_0x14e3('0x42')][_0x14e3('0x43')]({'plain':!![]});if(!_0xe54873)throw new Error(_0x14e3('0x44'));if(_0xe54873[_0x14e3('0x45')]===_0x14e3('0x42')){var _0x552429=_0x3dc051[_0x14e3('0x43')]({'plain':!![]});var _0x5d9844=_0x14e3('0x1b');return db['UserProfileSection']['find']({'where':{'name':_0x5d9844,'userProfileId':_0xe54873['userProfileId']},'raw':!![]})[_0x14e3('0x19')](function(_0x128730){if(_0x128730&&_0x128730[_0x14e3('0x46')]===0x0){return db[_0x14e3('0x1c')][_0x14e3('0x40')]({'name':_0x552429[_0x14e3('0x20')],'resourceId':_0x552429['id'],'type':_0x128730[_0x14e3('0x20')],'sectionId':_0x128730['id']},{})[_0x14e3('0x19')](function(){return _0x3dc051;});}else{return _0x3dc051;}})[_0x14e3('0x3f')](function(_0x44cfb2){logger[_0x14e3('0x1e')](_0x14e3('0x47'),_0x44cfb2);throw _0x44cfb2;});}return _0x3dc051;})[_0x14e3('0x19')](respondWithResult(_0x388342,0xc9))['catch'](handleError(_0x388342,null));};exports[_0x14e3('0x18')]=function(_0x124091,_0x3b7eb0){if(_0x124091['body']['id']){delete _0x124091[_0x14e3('0x41')]['id'];}return db[_0x14e3('0x24')]['find']({'where':{'id':_0x124091[_0x14e3('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3b7eb0,null))[_0x14e3('0x19')](saveUpdates(_0x124091['body'],null))['then'](respondWithResult(_0x3b7eb0,null))[_0x14e3('0x3f')](handleError(_0x3b7eb0,null));};exports[_0x14e3('0x1a')]=function(_0x459d96,_0x25bc17){return db[_0x14e3('0x24')]['find']({'where':{'id':_0x459d96[_0x14e3('0x3e')]['id']}})['then'](handleEntityNotFound(_0x25bc17,null))[_0x14e3('0x19')](removeEntity(_0x25bc17,null))[_0x14e3('0x3f')](handleError(_0x25bc17,null));};exports['test']=function(_0x3af54a,_0x2703f1,_0x5c3306){var _0x2e91c8;return db[_0x14e3('0x24')][_0x14e3('0x48')]({'where':{'id':_0x3af54a[_0x14e3('0x3e')]['id']},'attributes':['id',_0x14e3('0x49')]})[_0x14e3('0x19')](handleEntityNotFound(_0x2703f1,null))[_0x14e3('0x19')](function(_0x2c2660){if(_0x2c2660){var _0x848ae2=require(_0x14e3('0x4a'))();_0x848ae2[_0x14e3('0x4b')](_0x2c2660['dsn']);_0x848ae2[_0x14e3('0x4c')]();return _0x2c2660;}})['then'](respondWithResult(_0x2703f1,null))[_0x14e3('0x3f')](handleError(_0x2703f1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0d08b6e..6c0e912 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 _0xb516=['path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4914de,_0x28f254){var _0x2ee264=function(_0x19b9e1){while(--_0x19b9e1){_0x4914de['push'](_0x4914de['shift']());}};_0x2ee264(++_0x28f254);}(_0xb516,0x1ab));var _0x6b51=function(_0x37d40c,_0x27429e){_0x37d40c=_0x37d40c-0x0;var _0xa0441b=_0xb516[_0x37d40c];return _0xa0441b;};'use strict';var _=require(_0x6b51('0x0'));var util=require('util');var logger=require(_0x6b51('0x1'))(_0x6b51('0x2'));var moment=require(_0x6b51('0x3'));var BPromise=require(_0x6b51('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b51('0x5'));var rimraf=require(_0x6b51('0x6'));var config=require(_0x6b51('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x6b51('0x8')]=function(_0x234f6a,_0x2c24b5){return _0x234f6a[_0x6b51('0x9')](_0x6b51('0xa'),attributes,{'tableName':_0x6b51('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65b5=['bluebird','path','../../config/environment','./squareOdbc.attributes','exports','define','lodash','util','../../config/logger','moment'];(function(_0x5d16c2,_0x36abeb){var _0x992c8e=function(_0x3251a9){while(--_0x3251a9){_0x5d16c2['push'](_0x5d16c2['shift']());}};_0x992c8e(++_0x36abeb);}(_0x65b5,0x15a));var _0x565b=function(_0x5a43c3,_0x55cc14){_0x5a43c3=_0x5a43c3-0x0;var _0x28b9b3=_0x65b5[_0x5a43c3];return _0x28b9b3;};'use strict';var _=require(_0x565b('0x0'));var util=require(_0x565b('0x1'));var logger=require(_0x565b('0x2'))('api');var moment=require(_0x565b('0x3'));var BPromise=require(_0x565b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x565b('0x5'));var rimraf=require('rimraf');var config=require(_0x565b('0x6'));var attributes=require(_0x565b('0x7'));module[_0x565b('0x8')]=function(_0x4b257b,_0x571fb9){return _0x4b257b[_0x565b('0x9')]('SquareOdbc',attributes,{'tableName':'square_odbc','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 87fcd38..3f4b6b7 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 _0x1133=['raw','options','attributes','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','info','result','catch','ShowSquareOdbc','SquareOdbc'];(function(_0x7a319d,_0x235959){var _0x5c6b4e=function(_0x2e5b17){while(--_0x2e5b17){_0x7a319d['push'](_0x7a319d['shift']());}};_0x5c6b4e(++_0x235959);}(_0x1133,0xfe));var _0x3113=function(_0x26199d,_0x2ffd70){_0x26199d=_0x26199d-0x0;var _0x38e4da=_0x1133[_0x26199d];return _0x38e4da;};'use strict';var _=require('lodash');var util=require(_0x3113('0x0'));var moment=require(_0x3113('0x1'));var BPromise=require(_0x3113('0x2'));var rs=require(_0x3113('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3113('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3113('0x5'))(_0x3113('0x6'));var config=require(_0x3113('0x7'));var jayson=require(_0x3113('0x8'));var client=jayson[_0x3113('0x9')][_0x3113('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bc090,_0x41f079,_0x1b33c7){return new BPromise(function(_0x45ba91,_0x52838b){return client[_0x3113('0xb')](_0x1bc090,_0x1b33c7)['then'](function(_0x909e0b){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x41f079,_0x3113('0xc'));logger[_0x3113('0xd')](_0x3113('0xe'),_0x41f079,_0x3113('0xc'),JSON[_0x3113('0xf')](_0x909e0b));if(_0x909e0b[_0x3113('0x10')]){if(_0x909e0b[_0x3113('0x10')][_0x3113('0x11')]===0x1f4){logger['error'](_0x3113('0x12'),_0x41f079,_0x909e0b[_0x3113('0x10')][_0x3113('0x13')]);return _0x52838b(_0x909e0b[_0x3113('0x10')][_0x3113('0x13')]);}logger['error'](_0x3113('0x12'),_0x41f079,_0x909e0b[_0x3113('0x10')][_0x3113('0x13')]);return _0x45ba91(_0x909e0b['error'][_0x3113('0x13')]);}else{logger[_0x3113('0x14')](_0x3113('0x12'),_0x41f079,'request\x20sent');_0x45ba91(_0x909e0b[_0x3113('0x15')][_0x3113('0x13')]);}})[_0x3113('0x16')](function(_0x2a4e15){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x41f079,_0x2a4e15);_0x52838b(_0x2a4e15);});});}exports[_0x3113('0x17')]=function(_0x179758){var _0x214f14=this;return new Promise(function(_0x2fac66,_0x395215){return db[_0x3113('0x18')]['find']({'raw':_0x179758['options']?_0x179758['options'][_0x3113('0x19')]===undefined?!![]:![]:!![],'where':_0x179758[_0x3113('0x1a')]?_0x179758[_0x3113('0x1a')]['where']||null:null,'attributes':_0x179758[_0x3113('0x1a')]?_0x179758[_0x3113('0x1a')][_0x3113('0x1b')]||null:null,'include':_0x179758[_0x3113('0x1a')]?_0x179758[_0x3113('0x1a')][_0x3113('0x1c')]?_[_0x3113('0x1d')](_0x179758[_0x3113('0x1a')][_0x3113('0x1c')],function(_0x16c698){return{'model':db[_0x16c698[_0x3113('0x1e')]],'as':_0x16c698['as'],'attributes':_0x16c698[_0x3113('0x1b')],'include':_0x16c698[_0x3113('0x1c')]?_[_0x3113('0x1d')](_0x16c698[_0x3113('0x1c')],function(_0x5ab250){return{'model':db[_0x5ab250[_0x3113('0x1e')]],'as':_0x5ab250['as'],'attributes':_0x5ab250['attributes'],'include':_0x5ab250[_0x3113('0x1c')]?_[_0x3113('0x1d')](_0x5ab250[_0x3113('0x1c')],function(_0x2fd36e){return{'model':db[_0x2fd36e['model']],'as':_0x2fd36e['as'],'attributes':_0x2fd36e[_0x3113('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfe756f){logger['info'](_0x3113('0x17'),_0x179758);logger['debug'](_0x3113('0x17'),_0x179758,JSON[_0x3113('0xf')](_0xfe756f));_0x2fac66(_0xfe756f);})[_0x3113('0x16')](function(_0x2a3404){logger[_0x3113('0x10')](_0x3113('0x17'),_0x2a3404[_0x3113('0x13')],_0x179758);_0x395215(_0x214f14['error'](0x1f4,_0x2a3404['message']));});});}; \ No newline at end of file +var _0xfbd2=['find','options','where','map','include','model','attributes','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareOdbc'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xfbd2,0x17c));var _0x2fbd=function(_0x235c76,_0x5ad124){_0x235c76=_0x235c76-0x0;var _0x2e0e0c=_0xfbd2[_0x235c76];return _0x2e0e0c;};'use strict';var _=require(_0x2fbd('0x0'));var util=require(_0x2fbd('0x1'));var moment=require(_0x2fbd('0x2'));var BPromise=require(_0x2fbd('0x3'));var rs=require(_0x2fbd('0x4'));var fs=require('fs');var Redis=require(_0x2fbd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2fbd('0x6'));var config=require(_0x2fbd('0x7'));var jayson=require(_0x2fbd('0x8'));var client=jayson[_0x2fbd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301b0c,_0x376736,_0x2e5b07){return new BPromise(function(_0x629f9b,_0x4206cf){return client[_0x2fbd('0xa')](_0x301b0c,_0x2e5b07)['then'](function(_0xa67ecc){logger[_0x2fbd('0xb')](_0x2fbd('0xc'),_0x376736,_0x2fbd('0xd'));logger[_0x2fbd('0xe')](_0x2fbd('0xf'),_0x376736,'request\x20sent',JSON[_0x2fbd('0x10')](_0xa67ecc));if(_0xa67ecc[_0x2fbd('0x11')]){if(_0xa67ecc[_0x2fbd('0x11')][_0x2fbd('0x12')]===0x1f4){logger['error'](_0x2fbd('0xc'),_0x376736,_0xa67ecc['error'][_0x2fbd('0x13')]);return _0x4206cf(_0xa67ecc[_0x2fbd('0x11')]['message']);}logger[_0x2fbd('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x376736,_0xa67ecc['error'][_0x2fbd('0x13')]);return _0x629f9b(_0xa67ecc[_0x2fbd('0x11')][_0x2fbd('0x13')]);}else{logger['info'](_0x2fbd('0xc'),_0x376736,'request\x20sent');_0x629f9b(_0xa67ecc[_0x2fbd('0x14')][_0x2fbd('0x13')]);}})[_0x2fbd('0x15')](function(_0x5b0ff6){logger[_0x2fbd('0x11')](_0x2fbd('0xc'),_0x376736,_0x5b0ff6);_0x4206cf(_0x5b0ff6);});});}exports['ShowSquareOdbc']=function(_0x58e4c3){var _0x4fe5f3=this;return new Promise(function(_0x22e8a1,_0x3f1c60){return db[_0x2fbd('0x16')][_0x2fbd('0x17')]({'raw':_0x58e4c3[_0x2fbd('0x18')]?_0x58e4c3[_0x2fbd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x58e4c3[_0x2fbd('0x18')]?_0x58e4c3['options'][_0x2fbd('0x19')]||null:null,'attributes':_0x58e4c3[_0x2fbd('0x18')]?_0x58e4c3[_0x2fbd('0x18')]['attributes']||null:null,'include':_0x58e4c3['options']?_0x58e4c3[_0x2fbd('0x18')]['include']?_[_0x2fbd('0x1a')](_0x58e4c3[_0x2fbd('0x18')][_0x2fbd('0x1b')],function(_0x2c5092){return{'model':db[_0x2c5092[_0x2fbd('0x1c')]],'as':_0x2c5092['as'],'attributes':_0x2c5092[_0x2fbd('0x1d')],'include':_0x2c5092['include']?_[_0x2fbd('0x1a')](_0x2c5092[_0x2fbd('0x1b')],function(_0x4e03c0){return{'model':db[_0x4e03c0['model']],'as':_0x4e03c0['as'],'attributes':_0x4e03c0['attributes'],'include':_0x4e03c0[_0x2fbd('0x1b')]?_[_0x2fbd('0x1a')](_0x4e03c0[_0x2fbd('0x1b')],function(_0x15b41d){return{'model':db[_0x15b41d[_0x2fbd('0x1c')]],'as':_0x15b41d['as'],'attributes':_0x15b41d[_0x2fbd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7e0b99){logger[_0x2fbd('0xb')](_0x2fbd('0x1e'),_0x58e4c3);logger[_0x2fbd('0xe')](_0x2fbd('0x1e'),_0x58e4c3,JSON[_0x2fbd('0x10')](_0x7e0b99));_0x22e8a1(_0x7e0b99);})[_0x2fbd('0x15')](function(_0x8a9b3c){logger[_0x2fbd('0x11')](_0x2fbd('0x1e'),_0x8a9b3c[_0x2fbd('0x13')],_0x58e4c3);_0x3f1c60(_0x4fe5f3[_0x2fbd('0x11')](0x1f4,_0x8a9b3c[_0x2fbd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 38c167e..93d2ff2 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 _0x9e38=['update','destroy','delete','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','getUsers','post','addUsers'];(function(_0x3a825d,_0x10734e){var _0x6214b=function(_0x21f65c){while(--_0x21f65c){_0x3a825d['push'](_0x3a825d['shift']());}};_0x6214b(++_0x10734e);}(_0x9e38,0x155));var _0x89e3=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x9e38[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x89e3('0x0'));var util=require(_0x89e3('0x1'));var path=require(_0x89e3('0x2'));var timeout=require(_0x89e3('0x3'));var express=require(_0x89e3('0x4'));var router=express[_0x89e3('0x5')]();var fs_extra=require(_0x89e3('0x6'));var auth=require(_0x89e3('0x7'));var interaction=require(_0x89e3('0x8'));var config=require(_0x89e3('0x9'));var controller=require(_0x89e3('0xa'));router[_0x89e3('0xb')]('/',auth[_0x89e3('0xc')](),controller['index']);router[_0x89e3('0xb')](_0x89e3('0xd'),auth[_0x89e3('0xc')](),controller[_0x89e3('0xe')]);router[_0x89e3('0xb')](_0x89e3('0xf'),auth[_0x89e3('0xc')](),controller[_0x89e3('0x10')]);router[_0x89e3('0x11')]('/',auth[_0x89e3('0xc')](),controller['create']);router[_0x89e3('0x11')](_0x89e3('0xf'),auth[_0x89e3('0xc')](),controller[_0x89e3('0x12')]);router['put'](_0x89e3('0xd'),auth[_0x89e3('0xc')](),controller[_0x89e3('0x13')]);router['delete'](_0x89e3('0xd'),auth['isAuthenticated'](),controller[_0x89e3('0x14')]);router[_0x89e3('0x15')](_0x89e3('0xf'),auth[_0x89e3('0xc')](),controller[_0x89e3('0x16')]);module[_0x89e3('0x17')]=router; \ No newline at end of file +var _0x61d0=['isAuthenticated','index','/:id','post','/:id/users','addUsers','put','delete','destroy','removeUsers','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61d0,0x187));var _0x061d=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0x61d0[_0x348652];return _0x18a9ea;};'use strict';var multer=require(_0x061d('0x0'));var util=require('util');var path=require(_0x061d('0x1'));var timeout=require(_0x061d('0x2'));var express=require('express');var router=express[_0x061d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x061d('0x4'));var interaction=require(_0x061d('0x5'));var config=require('../../config/environment');var controller=require(_0x061d('0x6'));router[_0x061d('0x7')]('/',auth[_0x061d('0x8')](),controller[_0x061d('0x9')]);router[_0x061d('0x7')](_0x061d('0xa'),auth[_0x061d('0x8')](),controller['show']);router['get']('/:id/users',auth[_0x061d('0x8')](),controller['getUsers']);router[_0x061d('0xb')]('/',auth[_0x061d('0x8')](),controller['create']);router[_0x061d('0xb')](_0x061d('0xc'),auth[_0x061d('0x8')](),controller[_0x061d('0xd')]);router[_0x061d('0xe')](_0x061d('0xa'),auth[_0x061d('0x8')](),controller['update']);router[_0x061d('0xf')](_0x061d('0xa'),auth[_0x061d('0x8')](),controller[_0x061d('0x10')]);router[_0x061d('0xf')](_0x061d('0xc'),auth[_0x061d('0x8')](),controller[_0x061d('0x11')]);module[_0x061d('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index e1081e0..b6c5c7d 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 _0xff29=['BLOB','long','getDataValue','preproduction','production','utf8','DATE','sequelize','STRING','name','TEXT'];(function(_0x245381,_0x6ca13b){var _0x59e661=function(_0x4bd758){while(--_0x4bd758){_0x245381['push'](_0x245381['shift']());}};_0x59e661(++_0x6ca13b);}(_0xff29,0x1d5));var _0x9ff2=function(_0x2e7616,_0x56164f){_0x2e7616=_0x2e7616-0x0;var _0x3b9472=_0xff29[_0x2e7616];return _0x3b9472;};'use strict';var Sequelize=require(_0x9ff2('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ff2('0x1')],'unique':_0x9ff2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9ff2('0x1')]},'notes':{'type':Sequelize[_0x9ff2('0x3')]},'preproduction':{'type':Sequelize[_0x9ff2('0x4')](_0x9ff2('0x5')),'get':function(){if(this[_0x9ff2('0x6')](_0x9ff2('0x7'))){return this[_0x9ff2('0x6')](_0x9ff2('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x9ff2('0x4')](_0x9ff2('0x5')),'get':function(){if(this['getDataValue'](_0x9ff2('0x8'))){return this['getDataValue']('production')['toString'](_0x9ff2('0x9'));}}},'savedAt':{'type':Sequelize[_0x9ff2('0xa')]},'publishedAt':{'type':Sequelize[_0x9ff2('0xa')]}}; \ No newline at end of file +var _0x9916=['getDataValue','toString','utf8','long','production','DATE','exports','name','STRING','TEXT','preproduction'];(function(_0xc43e79,_0xd89bb8){var _0x196cde=function(_0x5ca588){while(--_0x5ca588){_0xc43e79['push'](_0xc43e79['shift']());}};_0x196cde(++_0xd89bb8);}(_0x9916,0x145));var _0x6991=function(_0x41ecb0,_0x232c59){_0x41ecb0=_0x41ecb0-0x0;var _0x17b9e0=_0x9916[_0x41ecb0];return _0x17b9e0;};'use strict';var Sequelize=require('sequelize');module[_0x6991('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6991('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x6991('0x2')]},'notes':{'type':Sequelize[_0x6991('0x3')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0x6991('0x4'))){return this[_0x6991('0x5')](_0x6991('0x4'))[_0x6991('0x6')](_0x6991('0x7'));}}},'production':{'type':Sequelize['BLOB'](_0x6991('0x8')),'get':function(){if(this[_0x6991('0x5')](_0x6991('0x9'))){return this['getDataValue'](_0x6991('0x9'))[_0x6991('0x6')](_0x6991('0x7'));}}},'savedAt':{'type':Sequelize[_0x6991('0xa')]},'publishedAt':{'type':Sequelize[_0x6991('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 7f9dfa1..b4d5042 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 _0xce1c=['merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','order','sort','filter','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','SquareProjects','UserProfileResource','end','error','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick'];(function(_0x40b2ed,_0x2b1765){var _0x18397d=function(_0xc6a86f){while(--_0xc6a86f){_0x40b2ed['push'](_0x40b2ed['shift']());}};_0x18397d(++_0x2b1765);}(_0xce1c,0x84));var _0xcce1=function(_0xc7a844,_0x36403a){_0xc7a844=_0xc7a844-0x0;var _0x3da35b=_0xce1c[_0xc7a844];return _0x3da35b;};'use strict';var emlformat=require(_0xcce1('0x0'));var rimraf=require(_0xcce1('0x1'));var zipdir=require(_0xcce1('0x2'));var jsonpatch=require(_0xcce1('0x3'));var rp=require('request-promise');var moment=require(_0xcce1('0x4'));var BPromise=require(_0xcce1('0x5'));var Mustache=require(_0xcce1('0x6'));var util=require(_0xcce1('0x7'));var path=require(_0xcce1('0x8'));var sox=require(_0xcce1('0x9'));var csv=require(_0xcce1('0xa'));var ejs=require(_0xcce1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcce1('0xc'));var squel=require('squel');var crypto=require(_0xcce1('0xd'));var jsforce=require(_0xcce1('0xe'));var deskjs=require(_0xcce1('0xf'));var toCsv=require(_0xcce1('0xa'));var querystring=require(_0xcce1('0x10'));var Papa=require('papaparse');var Redis=require(_0xcce1('0x11'));var authService=require(_0xcce1('0x12'));var qs=require(_0xcce1('0x13'));var as=require(_0xcce1('0x14'));var hardwareService=require(_0xcce1('0x15'));var logger=require('../../config/logger')(_0xcce1('0x16'));var utils=require(_0xcce1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcce1('0x18'));var db=require(_0xcce1('0x19'))['db'];config[_0xcce1('0x1a')]=_[_0xcce1('0x1b')](config[_0xcce1('0x1a')],{'host':_0xcce1('0x1c'),'port':0x18eb});var socket=require(_0xcce1('0x1d'))(new Redis(config['redis']));require(_0xcce1('0x1e'))[_0xcce1('0x1f')](socket);function respondWithStatusCode(_0x2b2371,_0x5d85ba){_0x5d85ba=_0x5d85ba||0xcc;return function(_0xb4b58f){if(_0xb4b58f){return _0x2b2371[_0xcce1('0x20')](_0x5d85ba);}return _0x2b2371[_0xcce1('0x21')](_0x5d85ba)['end']();};}function respondWithResult(_0x578334,_0x47b0a8){_0x47b0a8=_0x47b0a8||0xc8;return function(_0x1596ec){if(_0x1596ec){return _0x578334[_0xcce1('0x21')](_0x47b0a8)[_0xcce1('0x22')](_0x1596ec);}};}function respondWithFilteredResult(_0x55d2e7,_0x32a220){return function(_0x412715){if(_0x412715){var _0x49a8ec=typeof _0x32a220[_0xcce1('0x23')]===_0xcce1('0x24')&&typeof _0x32a220[_0xcce1('0x25')]==='undefined';var _0x48c636=_0x412715[_0xcce1('0x26')];var _0x4f6b2b=_0x49a8ec?0x0:_0x32a220[_0xcce1('0x23')];var _0x496087=_0x49a8ec?_0x412715[_0xcce1('0x26')]:_0x32a220[_0xcce1('0x23')]+_0x32a220['limit'];var _0x148e4c;if(_0x496087>=_0x48c636){_0x496087=_0x48c636;_0x148e4c=0xc8;}else{_0x148e4c=0xce;}_0x55d2e7[_0xcce1('0x21')](_0x148e4c);return _0x55d2e7[_0xcce1('0x27')]('Content-Range',_0x4f6b2b+'-'+_0x496087+'/'+_0x48c636)[_0xcce1('0x22')](_0x412715);}return null;};}function patchUpdates(_0xb0ba92){return function(_0x14fe01){try{jsonpatch[_0xcce1('0x28')](_0x14fe01,_0xb0ba92,!![]);}catch(_0x6b8a3f){return BPromise[_0xcce1('0x29')](_0x6b8a3f);}return _0x14fe01[_0xcce1('0x2a')]();};}function saveUpdates(_0x5d8553,_0x31d460){return function(_0x53abc7){if(_0x53abc7){return _0x53abc7['update'](_0x5d8553)[_0xcce1('0x2b')](function(_0xcd3508){return _0xcd3508;});}return null;};}function removeEntity(_0x499e2d,_0x35ddc7){return function(_0x31f0f4){if(_0x31f0f4){return _0x31f0f4[_0xcce1('0x2c')]()[_0xcce1('0x2b')](function(){var _0xdf62f8=_0x31f0f4[_0xcce1('0x2d')]({'plain':!![]});var _0xf7ac45=_0xcce1('0x2e');return db[_0xcce1('0x2f')][_0xcce1('0x2c')]({'where':{'type':_0xf7ac45,'resourceId':_0xdf62f8['id']}})[_0xcce1('0x2b')](function(){return _0x31f0f4;});})[_0xcce1('0x2b')](function(){_0x499e2d[_0xcce1('0x21')](0xcc)[_0xcce1('0x30')]();});}};}function handleEntityNotFound(_0xa7e5b3,_0x239b6a){return function(_0x2f583f){if(!_0x2f583f){_0xa7e5b3[_0xcce1('0x20')](0x194);}return _0x2f583f;};}function handleError(_0x1e03b0,_0x5a56c3){_0x5a56c3=_0x5a56c3||0x1f4;return function(_0x48e79a){logger[_0xcce1('0x31')](_0x48e79a['stack']);if(_0x48e79a[_0xcce1('0x32')]){delete _0x48e79a[_0xcce1('0x32')];}_0x1e03b0[_0xcce1('0x21')](_0x5a56c3)[_0xcce1('0x33')](_0x48e79a);};}exports[_0xcce1('0x34')]=function(_0x420186,_0x8dc2d1){var _0x3a67c2={},_0x3f7623={},_0x11af7e={'count':0x0,'rows':[]};var _0x289e8c=_['map'](db[_0xcce1('0x35')][_0xcce1('0x36')],function(_0x4d2bd4){return{'name':_0x4d2bd4[_0xcce1('0x37')],'type':_0x4d2bd4[_0xcce1('0x38')][_0xcce1('0x39')]};});_0x3f7623[_0xcce1('0x3a')]=_[_0xcce1('0x3b')](_0x289e8c,_0xcce1('0x32'));_0x3f7623[_0xcce1('0x3c')]=_[_0xcce1('0x3d')](_0x420186[_0xcce1('0x3c')]);_0x3f7623[_0xcce1('0x3e')]=_[_0xcce1('0x3f')](_0x3f7623['model'],_0x3f7623[_0xcce1('0x3c')]);_0x3a67c2[_0xcce1('0x40')]=_[_0xcce1('0x3f')](_0x3f7623[_0xcce1('0x3a')],qs[_0xcce1('0x41')](_0x420186['query'][_0xcce1('0x41')]));_0x3a67c2[_0xcce1('0x40')]=_0x3a67c2[_0xcce1('0x40')][_0xcce1('0x42')]?_0x3a67c2['attributes']:_0x3f7623[_0xcce1('0x3a')];if(!_0x420186[_0xcce1('0x3c')][_0xcce1('0x43')]('nolimit')){_0x3a67c2['limit']=qs[_0xcce1('0x25')](_0x420186[_0xcce1('0x3c')][_0xcce1('0x25')]);_0x3a67c2[_0xcce1('0x23')]=qs[_0xcce1('0x23')](_0x420186[_0xcce1('0x3c')][_0xcce1('0x23')]);}_0x3a67c2['order']=qs['sort'](_0x420186[_0xcce1('0x3c')]['sort']);_0x3a67c2[_0xcce1('0x44')]=qs[_0xcce1('0x3e')](_[_0xcce1('0x45')](_0x420186['query'],_0x3f7623[_0xcce1('0x3e')]),_0x289e8c);if(_0x420186[_0xcce1('0x3c')]['filter']){_0x3a67c2[_0xcce1('0x44')]=_[_0xcce1('0x46')](_0x3a67c2['where'],{'$or':_[_0xcce1('0x3b')](_0x289e8c,function(_0x39a816){if(_0x39a816['type']!=='VIRTUAL'){var _0x73c093={};_0x73c093[_0x39a816[_0xcce1('0x32')]]={'$like':'%'+_0x420186[_0xcce1('0x3c')]['filter']+'%'};return _0x73c093;}})});}_0x3a67c2=_[_0xcce1('0x46')]({},_0x3a67c2,_0x420186[_0xcce1('0x47')]);var _0x1bd139={'where':_0x3a67c2[_0xcce1('0x44')]};return db[_0xcce1('0x35')][_0xcce1('0x26')](_0x1bd139)['then'](function(_0x3f9460){_0x11af7e['count']=_0x3f9460;if(_0x420186[_0xcce1('0x3c')][_0xcce1('0x48')]){_0x3a67c2[_0xcce1('0x49')]=[{'all':!![]}];}return db[_0xcce1('0x35')][_0xcce1('0x4a')](_0x3a67c2);})[_0xcce1('0x2b')](function(_0x46cb26){_0x11af7e[_0xcce1('0x4b')]=_0x46cb26;return _0x11af7e;})[_0xcce1('0x2b')](respondWithFilteredResult(_0x8dc2d1,_0x3a67c2))[_0xcce1('0x4c')](handleError(_0x8dc2d1,null));};exports[_0xcce1('0x4d')]=function(_0x1882ba,_0x2e3d0f){var _0x57cdcb={'raw':![],'where':{'id':_0x1882ba[_0xcce1('0x4e')]['id']}},_0xc5fae5={};_0xc5fae5[_0xcce1('0x3a')]=_[_0xcce1('0x3d')](db[_0xcce1('0x35')][_0xcce1('0x36')]);_0xc5fae5[_0xcce1('0x3c')]=_[_0xcce1('0x3d')](_0x1882ba[_0xcce1('0x3c')]);_0xc5fae5[_0xcce1('0x3e')]=_[_0xcce1('0x3f')](_0xc5fae5[_0xcce1('0x3a')],_0xc5fae5[_0xcce1('0x3c')]);_0x57cdcb[_0xcce1('0x40')]=_[_0xcce1('0x3f')](_0xc5fae5[_0xcce1('0x3a')],qs[_0xcce1('0x41')](_0x1882ba['query']['fields']));_0x57cdcb[_0xcce1('0x40')]=_0x57cdcb[_0xcce1('0x40')]['length']?_0x57cdcb[_0xcce1('0x40')]:_0xc5fae5[_0xcce1('0x3a')];if(_0x1882ba['query'][_0xcce1('0x48')]){_0x57cdcb[_0xcce1('0x49')]=[{'all':!![]}];}_0x57cdcb=_[_0xcce1('0x46')]({},_0x57cdcb,_0x1882ba[_0xcce1('0x47')]);return db['SquareProject'][_0xcce1('0x4f')](_0x57cdcb)['then'](handleEntityNotFound(_0x2e3d0f,null))[_0xcce1('0x2b')](respondWithResult(_0x2e3d0f,null))[_0xcce1('0x4c')](handleError(_0x2e3d0f,null));};exports[_0xcce1('0x50')]=function(_0x2bac3a,_0x29ab0a){return db[_0xcce1('0x35')][_0xcce1('0x50')](_0x2bac3a[_0xcce1('0x51')],{})['then'](function(_0x253c36){var _0x113587=_0x2bac3a[_0xcce1('0x52')][_0xcce1('0x2d')]({'plain':!![]});if(!_0x113587)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x113587[_0xcce1('0x53')]===_0xcce1('0x52')){var _0x3c72a6=_0x253c36[_0xcce1('0x2d')]({'plain':!![]});var _0x317767=_0xcce1('0x2e');return db['UserProfileSection'][_0xcce1('0x4f')]({'where':{'name':_0x317767,'userProfileId':_0x113587[_0xcce1('0x54')]},'raw':!![]})['then'](function(_0x59cded){if(_0x59cded&&_0x59cded[_0xcce1('0x55')]===0x0){return db['UserProfileResource'][_0xcce1('0x50')]({'name':_0x3c72a6[_0xcce1('0x32')],'resourceId':_0x3c72a6['id'],'type':_0x59cded['name'],'sectionId':_0x59cded['id']},{})[_0xcce1('0x2b')](function(){return _0x253c36;});}else{return _0x253c36;}})['catch'](function(_0xe7eb6b){logger['error'](_0xcce1('0x56'),_0xe7eb6b);throw _0xe7eb6b;});}return _0x253c36;})[_0xcce1('0x2b')](respondWithResult(_0x29ab0a,0xc9))['catch'](handleError(_0x29ab0a,null));};exports[_0xcce1('0x57')]=function(_0x47e78b,_0x892399){if(_0x47e78b[_0xcce1('0x51')]['id']){delete _0x47e78b['body']['id'];}return db[_0xcce1('0x35')][_0xcce1('0x4f')]({'where':{'id':_0x47e78b['params']['id']}})[_0xcce1('0x2b')](handleEntityNotFound(_0x892399,null))[_0xcce1('0x2b')](saveUpdates(_0x47e78b['body'],null))[_0xcce1('0x2b')](respondWithResult(_0x892399,null))[_0xcce1('0x4c')](handleError(_0x892399,null));};exports[_0xcce1('0x2c')]=function(_0x187a66,_0x315e6b){return db[_0xcce1('0x35')][_0xcce1('0x4f')]({'where':{'id':_0x187a66['params']['id']}})[_0xcce1('0x2b')](handleEntityNotFound(_0x315e6b,null))[_0xcce1('0x2b')](removeEntity(_0x315e6b,null))[_0xcce1('0x4c')](handleError(_0x315e6b,null));};exports[_0xcce1('0x58')]=function(_0x208150,_0xf5892,_0x34a43a){return db['SquareProject'][_0xcce1('0x4f')]({'where':{'id':_0x208150[_0xcce1('0x4e')]['id']}})[_0xcce1('0x2b')](handleEntityNotFound(_0xf5892,null))[_0xcce1('0x2b')](function(_0x417de2){if(_0x417de2){return _0x417de2[_0xcce1('0x58')](_0x208150[_0xcce1('0x51')][_0xcce1('0x59')],_[_0xcce1('0x5a')](_0x208150[_0xcce1('0x51')],[_0xcce1('0x59'),'id'])||{});}})[_0xcce1('0x2b')](respondWithResult(_0xf5892,null))[_0xcce1('0x4c')](handleError(_0xf5892,null));};exports[_0xcce1('0x5b')]=function(_0x25edd5,_0x58e081,_0x59ec2c){return db['SquareProject'][_0xcce1('0x4f')]({'where':{'id':_0x25edd5[_0xcce1('0x4e')]['id']}})[_0xcce1('0x2b')](handleEntityNotFound(_0x58e081,null))[_0xcce1('0x2b')](function(_0x5b72a0){if(_0x5b72a0){return _0x5b72a0[_0xcce1('0x5b')](_0x25edd5[_0xcce1('0x3c')]['ids'])[_0xcce1('0x2b')](function(){if(_[_0xcce1('0x5c')](_0x25edd5[_0xcce1('0x3c')]['ids'])){for(var _0x28e814=0x0;_0x28e814<_0x25edd5[_0xcce1('0x3c')][_0xcce1('0x59')]['length'];_0x28e814+=0x1){socket[_0xcce1('0x5d')](_0xcce1('0x5e'),{'UserId':Number(_0x25edd5[_0xcce1('0x3c')]['ids'][_0x28e814]),'SquareProjectId':Number(_0x25edd5[_0xcce1('0x4e')]['id'])});}}else{socket[_0xcce1('0x5d')](_0xcce1('0x5e'),{'UserId':Number(_0x25edd5[_0xcce1('0x3c')]['ids']),'SquareProjectId':Number(_0x25edd5['params']['id'])});}});}})[_0xcce1('0x2b')](respondWithStatusCode(_0x58e081,null))[_0xcce1('0x4c')](handleError(_0x58e081,null));};exports['getUsers']=function(_0x26fd2f,_0x27ac7c,_0x113e27){var _0x36c116={};var _0x450227={};var _0xde84b5;var _0x52c612;return db[_0xcce1('0x35')][_0xcce1('0x5f')]({'where':{'id':_0x26fd2f[_0xcce1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x27ac7c,null))['then'](function(_0x55b6e3){if(_0x55b6e3){_0xde84b5=_0x55b6e3;_0x450227[_0xcce1('0x3a')]=_['keys'](db[_0xcce1('0x60')][_0xcce1('0x36')]);_0x450227['query']=_['keys'](_0x26fd2f['query']);_0x450227['filters']=_['intersection'](_0x450227[_0xcce1('0x3a')],_0x450227['query']);_0x36c116[_0xcce1('0x40')]=_['intersection'](_0x450227[_0xcce1('0x3a')],qs[_0xcce1('0x41')](_0x26fd2f[_0xcce1('0x3c')]['fields']));_0x36c116[_0xcce1('0x40')]=_0x36c116[_0xcce1('0x40')]['length']?_0x36c116['attributes']:_0x450227[_0xcce1('0x3a')];_0x36c116[_0xcce1('0x61')]=qs[_0xcce1('0x62')](_0x26fd2f['query'][_0xcce1('0x62')]);_0x36c116[_0xcce1('0x44')]=qs[_0xcce1('0x3e')](_[_0xcce1('0x45')](_0x26fd2f[_0xcce1('0x3c')],_0x450227[_0xcce1('0x3e')]));if(_0x26fd2f[_0xcce1('0x3c')][_0xcce1('0x63')]){_0x36c116[_0xcce1('0x44')]=_[_0xcce1('0x46')](_0x36c116['where'],{'$or':_[_0xcce1('0x3b')](_0x36c116[_0xcce1('0x40')],function(_0x209ced){var _0x5cb64f={};_0x5cb64f[_0x209ced]={'$like':'%'+_0x26fd2f[_0xcce1('0x3c')][_0xcce1('0x63')]+'%'};return _0x5cb64f;})});}_0x36c116=_[_0xcce1('0x46')]({},_0x36c116,_0x26fd2f[_0xcce1('0x47')]);return _0xde84b5[_0xcce1('0x64')](_0x36c116);}})[_0xcce1('0x2b')](function(_0x3b5879){if(_0x3b5879){_0x52c612=_0x3b5879[_0xcce1('0x42')];if(!_0x26fd2f['query'][_0xcce1('0x43')]('nolimit')){_0x36c116[_0xcce1('0x25')]=qs[_0xcce1('0x25')](_0x26fd2f[_0xcce1('0x3c')][_0xcce1('0x25')]);_0x36c116[_0xcce1('0x23')]=qs[_0xcce1('0x23')](_0x26fd2f[_0xcce1('0x3c')][_0xcce1('0x23')]);}return _0xde84b5[_0xcce1('0x64')](_0x36c116);}})[_0xcce1('0x2b')](function(_0xabf16){if(_0xabf16){return _0xabf16?{'count':_0x52c612,'rows':_0xabf16}:null;}})[_0xcce1('0x2b')](respondWithResult(_0x27ac7c,null))['catch'](handleError(_0x27ac7c,null));}; \ No newline at end of file +var _0x3c7c=['query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','pick','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type'];(function(_0x9ccc82,_0x27a5d1){var _0x56f356=function(_0x5cf3ac){while(--_0x5cf3ac){_0x9ccc82['push'](_0x9ccc82['shift']());}};_0x56f356(++_0x27a5d1);}(_0x3c7c,0x1b7));var _0xc3c7=function(_0x335d2d,_0x26e065){_0x335d2d=_0x335d2d-0x0;var _0x379073=_0x3c7c[_0x335d2d];return _0x379073;};'use strict';var emlformat=require(_0xc3c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc3c7('0x1'));var jsonpatch=require(_0xc3c7('0x2'));var rp=require(_0xc3c7('0x3'));var moment=require('moment');var BPromise=require(_0xc3c7('0x4'));var Mustache=require(_0xc3c7('0x5'));var util=require(_0xc3c7('0x6'));var path=require(_0xc3c7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc3c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3c7('0x9'));var squel=require(_0xc3c7('0xa'));var crypto=require(_0xc3c7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc3c7('0xc'));var toCsv=require(_0xc3c7('0xd'));var querystring=require(_0xc3c7('0xe'));var Papa=require(_0xc3c7('0xf'));var Redis=require('ioredis');var authService=require(_0xc3c7('0x10'));var qs=require(_0xc3c7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3c7('0x12'));var logger=require(_0xc3c7('0x13'))(_0xc3c7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc3c7('0x15'));var db=require(_0xc3c7('0x16'))['db'];config[_0xc3c7('0x17')]=_[_0xc3c7('0x18')](config[_0xc3c7('0x17')],{'host':_0xc3c7('0x19'),'port':0x18eb});var socket=require(_0xc3c7('0x1a'))(new Redis(config[_0xc3c7('0x17')]));require(_0xc3c7('0x1b'))[_0xc3c7('0x1c')](socket);function respondWithStatusCode(_0x2e2a8f,_0xb064ac){_0xb064ac=_0xb064ac||0xcc;return function(_0x490e7a){if(_0x490e7a){return _0x2e2a8f['sendStatus'](_0xb064ac);}return _0x2e2a8f[_0xc3c7('0x1d')](_0xb064ac)[_0xc3c7('0x1e')]();};}function respondWithResult(_0x3d1a42,_0x3667e5){_0x3667e5=_0x3667e5||0xc8;return function(_0x45951e){if(_0x45951e){return _0x3d1a42[_0xc3c7('0x1d')](_0x3667e5)[_0xc3c7('0x1f')](_0x45951e);}};}function respondWithFilteredResult(_0x2bab79,_0x506d80){return function(_0x2b80b8){if(_0x2b80b8){var _0x52d52b=typeof _0x506d80[_0xc3c7('0x20')]==='undefined'&&typeof _0x506d80[_0xc3c7('0x21')]===_0xc3c7('0x22');var _0x2eb53f=_0x2b80b8[_0xc3c7('0x23')];var _0x2c4fa2=_0x52d52b?0x0:_0x506d80[_0xc3c7('0x20')];var _0x63c04f=_0x52d52b?_0x2b80b8[_0xc3c7('0x23')]:_0x506d80[_0xc3c7('0x20')]+_0x506d80[_0xc3c7('0x21')];var _0x39cfad;if(_0x63c04f>=_0x2eb53f){_0x63c04f=_0x2eb53f;_0x39cfad=0xc8;}else{_0x39cfad=0xce;}_0x2bab79[_0xc3c7('0x1d')](_0x39cfad);return _0x2bab79[_0xc3c7('0x24')](_0xc3c7('0x25'),_0x2c4fa2+'-'+_0x63c04f+'/'+_0x2eb53f)[_0xc3c7('0x1f')](_0x2b80b8);}return null;};}function patchUpdates(_0x23f66a){return function(_0x1a8e14){try{jsonpatch['apply'](_0x1a8e14,_0x23f66a,!![]);}catch(_0x4c4f06){return BPromise[_0xc3c7('0x26')](_0x4c4f06);}return _0x1a8e14[_0xc3c7('0x27')]();};}function saveUpdates(_0x33ad2b,_0x490222){return function(_0x3e0d05){if(_0x3e0d05){return _0x3e0d05[_0xc3c7('0x28')](_0x33ad2b)['then'](function(_0x6c8acc){return _0x6c8acc;});}return null;};}function removeEntity(_0x3a737c,_0x2dae90){return function(_0x9f3160){if(_0x9f3160){return _0x9f3160[_0xc3c7('0x29')]()['then'](function(){var _0xe5830d=_0x9f3160[_0xc3c7('0x2a')]({'plain':!![]});var _0x51541f='SquareProjects';return db[_0xc3c7('0x2b')]['destroy']({'where':{'type':_0x51541f,'resourceId':_0xe5830d['id']}})[_0xc3c7('0x2c')](function(){return _0x9f3160;});})[_0xc3c7('0x2c')](function(){_0x3a737c[_0xc3c7('0x1d')](0xcc)[_0xc3c7('0x1e')]();});}};}function handleEntityNotFound(_0x419001,_0x224130){return function(_0x5e2c57){if(!_0x5e2c57){_0x419001[_0xc3c7('0x2d')](0x194);}return _0x5e2c57;};}function handleError(_0x516fa7,_0x5ad03b){_0x5ad03b=_0x5ad03b||0x1f4;return function(_0x1666ca){logger[_0xc3c7('0x2e')](_0x1666ca[_0xc3c7('0x2f')]);if(_0x1666ca[_0xc3c7('0x30')]){delete _0x1666ca['name'];}_0x516fa7[_0xc3c7('0x1d')](_0x5ad03b)[_0xc3c7('0x31')](_0x1666ca);};}exports[_0xc3c7('0x32')]=function(_0xebaa14,_0x111e67){var _0x17e90e={},_0x25f724={},_0x362b01={'count':0x0,'rows':[]};var _0x25718b=_[_0xc3c7('0x33')](db[_0xc3c7('0x34')][_0xc3c7('0x35')],function(_0x3d32ca){return{'name':_0x3d32ca[_0xc3c7('0x36')],'type':_0x3d32ca[_0xc3c7('0x37')]['key']};});_0x25f724['model']=_[_0xc3c7('0x33')](_0x25718b,_0xc3c7('0x30'));_0x25f724[_0xc3c7('0x38')]=_['keys'](_0xebaa14[_0xc3c7('0x38')]);_0x25f724[_0xc3c7('0x39')]=_[_0xc3c7('0x3a')](_0x25f724[_0xc3c7('0x3b')],_0x25f724[_0xc3c7('0x38')]);_0x17e90e['attributes']=_[_0xc3c7('0x3a')](_0x25f724[_0xc3c7('0x3b')],qs[_0xc3c7('0x3c')](_0xebaa14['query'][_0xc3c7('0x3c')]));_0x17e90e['attributes']=_0x17e90e[_0xc3c7('0x3d')][_0xc3c7('0x3e')]?_0x17e90e[_0xc3c7('0x3d')]:_0x25f724['model'];if(!_0xebaa14[_0xc3c7('0x38')]['hasOwnProperty'](_0xc3c7('0x3f'))){_0x17e90e['limit']=qs[_0xc3c7('0x21')](_0xebaa14[_0xc3c7('0x38')]['limit']);_0x17e90e[_0xc3c7('0x20')]=qs[_0xc3c7('0x20')](_0xebaa14[_0xc3c7('0x38')][_0xc3c7('0x20')]);}_0x17e90e[_0xc3c7('0x40')]=qs['sort'](_0xebaa14[_0xc3c7('0x38')][_0xc3c7('0x41')]);_0x17e90e[_0xc3c7('0x42')]=qs[_0xc3c7('0x39')](_['pick'](_0xebaa14[_0xc3c7('0x38')],_0x25f724[_0xc3c7('0x39')]),_0x25718b);if(_0xebaa14[_0xc3c7('0x38')][_0xc3c7('0x43')]){_0x17e90e[_0xc3c7('0x42')]=_[_0xc3c7('0x44')](_0x17e90e[_0xc3c7('0x42')],{'$or':_[_0xc3c7('0x33')](_0x25718b,function(_0x215d5e){if(_0x215d5e[_0xc3c7('0x37')]!==_0xc3c7('0x45')){var _0x50168d={};_0x50168d[_0x215d5e[_0xc3c7('0x30')]]={'$like':'%'+_0xebaa14[_0xc3c7('0x38')][_0xc3c7('0x43')]+'%'};return _0x50168d;}})});}_0x17e90e=_['merge']({},_0x17e90e,_0xebaa14[_0xc3c7('0x46')]);var _0x298e91={'where':_0x17e90e['where']};return db[_0xc3c7('0x34')][_0xc3c7('0x23')](_0x298e91)[_0xc3c7('0x2c')](function(_0x183589){_0x362b01[_0xc3c7('0x23')]=_0x183589;if(_0xebaa14[_0xc3c7('0x38')][_0xc3c7('0x47')]){_0x17e90e[_0xc3c7('0x48')]=[{'all':!![]}];}return db[_0xc3c7('0x34')][_0xc3c7('0x49')](_0x17e90e);})[_0xc3c7('0x2c')](function(_0x3e4add){_0x362b01[_0xc3c7('0x4a')]=_0x3e4add;return _0x362b01;})[_0xc3c7('0x2c')](respondWithFilteredResult(_0x111e67,_0x17e90e))[_0xc3c7('0x4b')](handleError(_0x111e67,null));};exports[_0xc3c7('0x4c')]=function(_0x22cf78,_0x3d8a7c){var _0x38730e={'raw':![],'where':{'id':_0x22cf78[_0xc3c7('0x4d')]['id']}},_0x56b4be={};_0x56b4be[_0xc3c7('0x3b')]=_[_0xc3c7('0x4e')](db[_0xc3c7('0x34')]['rawAttributes']);_0x56b4be[_0xc3c7('0x38')]=_[_0xc3c7('0x4e')](_0x22cf78[_0xc3c7('0x38')]);_0x56b4be[_0xc3c7('0x39')]=_[_0xc3c7('0x3a')](_0x56b4be[_0xc3c7('0x3b')],_0x56b4be[_0xc3c7('0x38')]);_0x38730e['attributes']=_['intersection'](_0x56b4be[_0xc3c7('0x3b')],qs[_0xc3c7('0x3c')](_0x22cf78[_0xc3c7('0x38')][_0xc3c7('0x3c')]));_0x38730e[_0xc3c7('0x3d')]=_0x38730e[_0xc3c7('0x3d')][_0xc3c7('0x3e')]?_0x38730e[_0xc3c7('0x3d')]:_0x56b4be[_0xc3c7('0x3b')];if(_0x22cf78['query'][_0xc3c7('0x47')]){_0x38730e[_0xc3c7('0x48')]=[{'all':!![]}];}_0x38730e=_[_0xc3c7('0x44')]({},_0x38730e,_0x22cf78[_0xc3c7('0x46')]);return db[_0xc3c7('0x34')][_0xc3c7('0x4f')](_0x38730e)[_0xc3c7('0x2c')](handleEntityNotFound(_0x3d8a7c,null))[_0xc3c7('0x2c')](respondWithResult(_0x3d8a7c,null))[_0xc3c7('0x4b')](handleError(_0x3d8a7c,null));};exports[_0xc3c7('0x50')]=function(_0x49faee,_0x3dc89d){return db[_0xc3c7('0x34')][_0xc3c7('0x50')](_0x49faee[_0xc3c7('0x51')],{})['then'](function(_0x1982ef){var _0x44422b=_0x49faee['user']['get']({'plain':!![]});if(!_0x44422b)throw new Error(_0xc3c7('0x52'));if(_0x44422b[_0xc3c7('0x53')]===_0xc3c7('0x54')){var _0x10f5d7=_0x1982ef[_0xc3c7('0x2a')]({'plain':!![]});var _0x269a04=_0xc3c7('0x55');return db[_0xc3c7('0x56')]['find']({'where':{'name':_0x269a04,'userProfileId':_0x44422b[_0xc3c7('0x57')]},'raw':!![]})[_0xc3c7('0x2c')](function(_0x134da6){if(_0x134da6&&_0x134da6[_0xc3c7('0x58')]===0x0){return db[_0xc3c7('0x2b')][_0xc3c7('0x50')]({'name':_0x10f5d7[_0xc3c7('0x30')],'resourceId':_0x10f5d7['id'],'type':_0x134da6[_0xc3c7('0x30')],'sectionId':_0x134da6['id']},{})[_0xc3c7('0x2c')](function(){return _0x1982ef;});}else{return _0x1982ef;}})['catch'](function(_0x20681a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20681a);throw _0x20681a;});}return _0x1982ef;})['then'](respondWithResult(_0x3dc89d,0xc9))[_0xc3c7('0x4b')](handleError(_0x3dc89d,null));};exports[_0xc3c7('0x28')]=function(_0x2afc84,_0x20781e){if(_0x2afc84[_0xc3c7('0x51')]['id']){delete _0x2afc84[_0xc3c7('0x51')]['id'];}return db[_0xc3c7('0x34')]['find']({'where':{'id':_0x2afc84[_0xc3c7('0x4d')]['id']}})[_0xc3c7('0x2c')](handleEntityNotFound(_0x20781e,null))[_0xc3c7('0x2c')](saveUpdates(_0x2afc84[_0xc3c7('0x51')],null))[_0xc3c7('0x2c')](respondWithResult(_0x20781e,null))['catch'](handleError(_0x20781e,null));};exports[_0xc3c7('0x29')]=function(_0x5dc511,_0x1e5e4a){return db[_0xc3c7('0x34')]['find']({'where':{'id':_0x5dc511[_0xc3c7('0x4d')]['id']}})[_0xc3c7('0x2c')](handleEntityNotFound(_0x1e5e4a,null))[_0xc3c7('0x2c')](removeEntity(_0x1e5e4a,null))[_0xc3c7('0x4b')](handleError(_0x1e5e4a,null));};exports[_0xc3c7('0x59')]=function(_0x4452cb,_0x4f69eb,_0x19db03){return db[_0xc3c7('0x34')][_0xc3c7('0x4f')]({'where':{'id':_0x4452cb[_0xc3c7('0x4d')]['id']}})[_0xc3c7('0x2c')](handleEntityNotFound(_0x4f69eb,null))[_0xc3c7('0x2c')](function(_0x95d587){if(_0x95d587){return _0x95d587[_0xc3c7('0x59')](_0x4452cb['body']['ids'],_['omit'](_0x4452cb['body'],[_0xc3c7('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x4f69eb,null))[_0xc3c7('0x4b')](handleError(_0x4f69eb,null));};exports[_0xc3c7('0x5b')]=function(_0x850aa6,_0x2ad02f,_0xbef7cd){return db[_0xc3c7('0x34')][_0xc3c7('0x4f')]({'where':{'id':_0x850aa6[_0xc3c7('0x4d')]['id']}})[_0xc3c7('0x2c')](handleEntityNotFound(_0x2ad02f,null))[_0xc3c7('0x2c')](function(_0x1b54eb){if(_0x1b54eb){return _0x1b54eb['removeUsers'](_0x850aa6[_0xc3c7('0x38')][_0xc3c7('0x5a')])[_0xc3c7('0x2c')](function(){if(_['isArray'](_0x850aa6['query'][_0xc3c7('0x5a')])){for(var _0x32271b=0x0;_0x32271b<_0x850aa6[_0xc3c7('0x38')][_0xc3c7('0x5a')][_0xc3c7('0x3e')];_0x32271b+=0x1){socket[_0xc3c7('0x5c')](_0xc3c7('0x5d'),{'UserId':Number(_0x850aa6['query'][_0xc3c7('0x5a')][_0x32271b]),'SquareProjectId':Number(_0x850aa6[_0xc3c7('0x4d')]['id'])});}}else{socket['emit'](_0xc3c7('0x5d'),{'UserId':Number(_0x850aa6[_0xc3c7('0x38')][_0xc3c7('0x5a')]),'SquareProjectId':Number(_0x850aa6[_0xc3c7('0x4d')]['id'])});}});}})[_0xc3c7('0x2c')](respondWithStatusCode(_0x2ad02f,null))['catch'](handleError(_0x2ad02f,null));};exports[_0xc3c7('0x5e')]=function(_0x56908f,_0x219870,_0x52214f){var _0x4e5d2c={};var _0x427d59={};var _0x372e3;var _0x27f530;return db[_0xc3c7('0x34')][_0xc3c7('0x5f')]({'where':{'id':_0x56908f[_0xc3c7('0x4d')]['id']}})[_0xc3c7('0x2c')](handleEntityNotFound(_0x219870,null))[_0xc3c7('0x2c')](function(_0x14ec8b){if(_0x14ec8b){_0x372e3=_0x14ec8b;_0x427d59['model']=_[_0xc3c7('0x4e')](db[_0xc3c7('0x60')][_0xc3c7('0x35')]);_0x427d59[_0xc3c7('0x38')]=_[_0xc3c7('0x4e')](_0x56908f[_0xc3c7('0x38')]);_0x427d59[_0xc3c7('0x39')]=_[_0xc3c7('0x3a')](_0x427d59['model'],_0x427d59[_0xc3c7('0x38')]);_0x4e5d2c['attributes']=_['intersection'](_0x427d59[_0xc3c7('0x3b')],qs[_0xc3c7('0x3c')](_0x56908f[_0xc3c7('0x38')][_0xc3c7('0x3c')]));_0x4e5d2c['attributes']=_0x4e5d2c[_0xc3c7('0x3d')][_0xc3c7('0x3e')]?_0x4e5d2c[_0xc3c7('0x3d')]:_0x427d59['model'];_0x4e5d2c[_0xc3c7('0x40')]=qs[_0xc3c7('0x41')](_0x56908f[_0xc3c7('0x38')][_0xc3c7('0x41')]);_0x4e5d2c[_0xc3c7('0x42')]=qs[_0xc3c7('0x39')](_[_0xc3c7('0x61')](_0x56908f[_0xc3c7('0x38')],_0x427d59[_0xc3c7('0x39')]));if(_0x56908f[_0xc3c7('0x38')]['filter']){_0x4e5d2c[_0xc3c7('0x42')]=_[_0xc3c7('0x44')](_0x4e5d2c[_0xc3c7('0x42')],{'$or':_[_0xc3c7('0x33')](_0x4e5d2c[_0xc3c7('0x3d')],function(_0x15a78c){var _0x4f09a9={};_0x4f09a9[_0x15a78c]={'$like':'%'+_0x56908f[_0xc3c7('0x38')][_0xc3c7('0x43')]+'%'};return _0x4f09a9;})});}_0x4e5d2c=_[_0xc3c7('0x44')]({},_0x4e5d2c,_0x56908f[_0xc3c7('0x46')]);return _0x372e3[_0xc3c7('0x5e')](_0x4e5d2c);}})[_0xc3c7('0x2c')](function(_0x235d90){if(_0x235d90){_0x27f530=_0x235d90[_0xc3c7('0x3e')];if(!_0x56908f[_0xc3c7('0x38')][_0xc3c7('0x62')](_0xc3c7('0x3f'))){_0x4e5d2c['limit']=qs[_0xc3c7('0x21')](_0x56908f[_0xc3c7('0x38')][_0xc3c7('0x21')]);_0x4e5d2c['offset']=qs[_0xc3c7('0x20')](_0x56908f[_0xc3c7('0x38')][_0xc3c7('0x20')]);}return _0x372e3[_0xc3c7('0x5e')](_0x4e5d2c);}})[_0xc3c7('0x2c')](function(_0x1caf5f){if(_0x1caf5f){return _0x1caf5f?{'count':_0x27f530,'rows':_0x1caf5f}:null;}})['then'](respondWithResult(_0x219870,null))[_0xc3c7('0x4b')](handleError(_0x219870,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a772cc1..e4a5fc9 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 _0x18de=['exports','events','SquareProject','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2e17e1,_0x78a0e0){var _0xd9d978=function(_0x389bdc){while(--_0x389bdc){_0x2e17e1['push'](_0x2e17e1['shift']());}};_0xd9d978(++_0x78a0e0);}(_0x18de,0x133));var _0xe18d=function(_0x10dcd5,_0x17dc6a){_0x10dcd5=_0x10dcd5-0x0;var _0x41a780=_0x18de[_0x10dcd5];return _0x41a780;};'use strict';var EventEmitter=require(_0xe18d('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xe18d('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe18d('0x2'),'afterUpdate':_0xe18d('0x3'),'afterDestroy':_0xe18d('0x4')};function emitEvent(_0x577eaf){return function(_0x412cea,_0x5b0dc3,_0x46cb66){SquareProjectEvents[_0xe18d('0x5')](_0x577eaf+':'+_0x412cea['id'],_0x412cea);SquareProjectEvents[_0xe18d('0x5')](_0x577eaf,_0x412cea);_0x46cb66(null);};}for(var e in events){if(events[_0xe18d('0x6')](e)){var event=events[e];SquareProject[_0xe18d('0x7')](e,emitEvent(event));}}module[_0xe18d('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x330b=['exports','events','../../mysqldb','SquareProject','save','update','emit','hasOwnProperty','hook'];(function(_0x1c57bf,_0x76315d){var _0x431581=function(_0x2162e3){while(--_0x2162e3){_0x1c57bf['push'](_0x1c57bf['shift']());}};_0x431581(++_0x76315d);}(_0x330b,0x1a8));var _0xb330=function(_0x7ed1f,_0xe724d3){_0x7ed1f=_0x7ed1f-0x0;var _0x58d101=_0x330b[_0x7ed1f];return _0x58d101;};'use strict';var EventEmitter=require(_0xb330('0x0'));var SquareProject=require(_0xb330('0x1'))['db'][_0xb330('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb330('0x3'),'afterUpdate':_0xb330('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e4b84){return function(_0x187017,_0x3685ca,_0x192932){SquareProjectEvents['emit'](_0x3e4b84+':'+_0x187017['id'],_0x187017);SquareProjectEvents[_0xb330('0x5')](_0x3e4b84,_0x187017);_0x192932(null);};}for(var e in events){if(events[_0xb330('0x6')](e)){var event=events[e];SquareProject[_0xb330('0x7')](e,emitEvent(event));}}module[_0xb330('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 9827f29..529f13a 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 _0x5f5a=['SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','define'];(function(_0x5625d6,_0x47d26d){var _0x468966=function(_0x1c3cb2){while(--_0x1c3cb2){_0x5625d6['push'](_0x5625d6['shift']());}};_0x468966(++_0x47d26d);}(_0x5f5a,0x97));var _0xa5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa5f5('0x0'));var util=require(_0xa5f5('0x1'));var logger=require(_0xa5f5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa5f5('0x3'));var rp=require(_0xa5f5('0x4'));var fs=require('fs');var path=require(_0xa5f5('0x5'));var rimraf=require('rimraf');var config=require(_0xa5f5('0x6'));var attributes=require(_0xa5f5('0x7'));module['exports']=function(_0x51fbac,_0x5a62db){return _0x51fbac[_0xa5f5('0x8')](_0xa5f5('0x9'),attributes,{'tableName':_0xa5f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa92f15,_0x4df167,_0x544e78){if(_0xa92f15[_0xa5f5('0xb')](_0xa5f5('0xc'))){_0xa92f15[_0xa5f5('0xd')]=moment()[_0xa5f5('0xe')](_0xa5f5('0xf'));}if(_0xa92f15[_0xa5f5('0xb')]('production')){_0xa92f15['publishedAt']=moment()[_0xa5f5('0xe')](_0xa5f5('0xf'));}_0x544e78(null,_0xa92f15);}}});}; \ No newline at end of file +var _0xee51=['bluebird','path','rimraf','../../config/environment','exports','define','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','publishedAt','util','../../config/logger','api','moment'];(function(_0x50c154,_0x4e08a2){var _0x23aad4=function(_0xb549c1){while(--_0xb549c1){_0x50c154['push'](_0x50c154['shift']());}};_0x23aad4(++_0x4e08a2);}(_0xee51,0x13f));var _0x1ee5=function(_0x3a096c,_0x1f9d72){_0x3a096c=_0x3a096c-0x0;var _0x44a6a4=_0xee51[_0x3a096c];return _0x44a6a4;};'use strict';var _=require('lodash');var util=require(_0x1ee5('0x0'));var logger=require(_0x1ee5('0x1'))(_0x1ee5('0x2'));var moment=require(_0x1ee5('0x3'));var BPromise=require(_0x1ee5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ee5('0x5'));var rimraf=require(_0x1ee5('0x6'));var config=require(_0x1ee5('0x7'));var attributes=require('./squareProject.attributes');module[_0x1ee5('0x8')]=function(_0x2178b7,_0x2338e0){return _0x2178b7[_0x1ee5('0x9')]('SquareProject',attributes,{'tableName':_0x1ee5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34800c,_0x3c715d,_0x144ab5){if(_0x34800c['changed'](_0x1ee5('0xb'))){_0x34800c[_0x1ee5('0xc')]=moment()[_0x1ee5('0xd')](_0x1ee5('0xe'));}if(_0x34800c[_0x1ee5('0xf')]('production')){_0x34800c[_0x1ee5('0x10')]=moment()[_0x1ee5('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x144ab5(null,_0x34800c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7591378..ce4d471 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 _0x3b54=['stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s'];(function(_0x917b9b,_0x5a1b48){var _0x203fd5=function(_0x455477){while(--_0x455477){_0x917b9b['push'](_0x917b9b['shift']());}};_0x203fd5(++_0x5a1b48);}(_0x3b54,0x1c8));var _0x43b5=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x3b54[_0x15ec4e];return _0xb5e5dd;};'use strict';var _=require(_0x43b5('0x0'));var util=require(_0x43b5('0x1'));var moment=require(_0x43b5('0x2'));var BPromise=require(_0x43b5('0x3'));var rs=require(_0x43b5('0x4'));var fs=require('fs');var Redis=require(_0x43b5('0x5'));var db=require(_0x43b5('0x6'))['db'];var utils=require(_0x43b5('0x7'));var logger=require('../../config/logger')(_0x43b5('0x8'));var config=require(_0x43b5('0x9'));var jayson=require(_0x43b5('0xa'));var client=jayson[_0x43b5('0xb')][_0x43b5('0xc')]({'port':0x232a});config[_0x43b5('0xd')]=_[_0x43b5('0xe')](config[_0x43b5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x43b5('0xf'))(new Redis(config[_0x43b5('0xd')]));require(_0x43b5('0x10'))['register'](socket);function respondWithRpcPromise(_0x26113e,_0x19bcd7,_0x45aa5a){return new BPromise(function(_0x435be5,_0x49c3ea){return client[_0x43b5('0x11')](_0x26113e,_0x45aa5a)[_0x43b5('0x12')](function(_0x3438d5){logger[_0x43b5('0x13')](_0x43b5('0x14'),_0x19bcd7,_0x43b5('0x15'));logger[_0x43b5('0x16')](_0x43b5('0x17'),_0x19bcd7,'request\x20sent',JSON[_0x43b5('0x18')](_0x3438d5));if(_0x3438d5['error']){if(_0x3438d5[_0x43b5('0x19')][_0x43b5('0x1a')]===0x1f4){logger[_0x43b5('0x19')](_0x43b5('0x14'),_0x19bcd7,_0x3438d5[_0x43b5('0x19')][_0x43b5('0x1b')]);return _0x49c3ea(_0x3438d5[_0x43b5('0x19')][_0x43b5('0x1b')]);}logger[_0x43b5('0x19')](_0x43b5('0x14'),_0x19bcd7,_0x3438d5[_0x43b5('0x19')]['message']);return _0x435be5(_0x3438d5[_0x43b5('0x19')]['message']);}else{logger[_0x43b5('0x13')](_0x43b5('0x14'),_0x19bcd7,_0x43b5('0x15'));_0x435be5(_0x3438d5[_0x43b5('0x1c')][_0x43b5('0x1b')]);}})[_0x43b5('0x1d')](function(_0x2c4090){logger['error']('SquareProject,\x20%s,\x20%s',_0x19bcd7,_0x2c4090);_0x49c3ea(_0x2c4090);});});}exports[_0x43b5('0x1e')]=function(_0x873485){var _0x116a91=this;return new Promise(function(_0x34623a,_0x4bd5f5){return db[_0x43b5('0x1f')][_0x43b5('0x20')]({'raw':_0x873485[_0x43b5('0x21')]?_0x873485[_0x43b5('0x21')][_0x43b5('0x22')]===undefined?!![]:![]:!![],'where':_0x873485[_0x43b5('0x21')]?_0x873485[_0x43b5('0x21')][_0x43b5('0x23')]||null:null,'attributes':_0x873485['options']?_0x873485['options'][_0x43b5('0x24')]||null:null,'include':_0x873485[_0x43b5('0x21')]?_0x873485['options'][_0x43b5('0x25')]?_[_0x43b5('0x26')](_0x873485[_0x43b5('0x21')][_0x43b5('0x25')],function(_0xcdf910){return{'model':db[_0xcdf910[_0x43b5('0x27')]],'as':_0xcdf910['as'],'attributes':_0xcdf910[_0x43b5('0x24')],'include':_0xcdf910[_0x43b5('0x25')]?_['map'](_0xcdf910[_0x43b5('0x25')],function(_0x40f129){return{'model':db[_0x40f129[_0x43b5('0x27')]],'as':_0x40f129['as'],'attributes':_0x40f129['attributes'],'include':_0x40f129[_0x43b5('0x25')]?_[_0x43b5('0x26')](_0x40f129[_0x43b5('0x25')],function(_0x54e53c){return{'model':db[_0x54e53c[_0x43b5('0x27')]],'as':_0x54e53c['as'],'attributes':_0x54e53c[_0x43b5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x43b5('0x12')](function(_0x1ebc17){logger['info']('ShowSquareProject',_0x873485);logger['debug'](_0x43b5('0x1e'),_0x873485,JSON[_0x43b5('0x18')](_0x1ebc17));_0x34623a(_0x1ebc17);})[_0x43b5('0x1d')](function(_0x4caa3e){logger[_0x43b5('0x19')](_0x43b5('0x1e'),_0x4caa3e[_0x43b5('0x1b')],_0x873485);_0x4bd5f5(_0x116a91[_0x43b5('0x19')](0x1f4,_0x4caa3e[_0x43b5('0x1b')]));});});}; \ No newline at end of file +var _0x5cc0=['catch','SquareProject','options','raw','where','attributes','map','include','model','info','ShowSquareProject','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','then','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2db379,_0x2dac86){var _0x521f80=function(_0xfa261f){while(--_0xfa261f){_0x2db379['push'](_0x2db379['shift']());}};_0x521f80(++_0x2dac86);}(_0x5cc0,0x78));var _0x05cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cc0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05cc('0x0'));var util=require(_0x05cc('0x1'));var moment=require(_0x05cc('0x2'));var BPromise=require(_0x05cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05cc('0x4'));var db=require(_0x05cc('0x5'))['db'];var utils=require(_0x05cc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x05cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x05cc('0x8')]['http']({'port':0x232a});config[_0x05cc('0x9')]=_[_0x05cc('0xa')](config[_0x05cc('0x9')],{'host':_0x05cc('0xb'),'port':0x18eb});var socket=require(_0x05cc('0xc'))(new Redis(config[_0x05cc('0x9')]));require(_0x05cc('0xd'))[_0x05cc('0xe')](socket);function respondWithRpcPromise(_0x456fe9,_0x5e82af,_0x228c1e){return new BPromise(function(_0x41ecc0,_0xf96dc7){return client['request'](_0x456fe9,_0x228c1e)[_0x05cc('0xf')](function(_0x1f1866){logger['info'](_0x05cc('0x10'),_0x5e82af,_0x05cc('0x11'));logger['debug'](_0x05cc('0x12'),_0x5e82af,_0x05cc('0x11'),JSON[_0x05cc('0x13')](_0x1f1866));if(_0x1f1866[_0x05cc('0x14')]){if(_0x1f1866[_0x05cc('0x14')][_0x05cc('0x15')]===0x1f4){logger['error'](_0x05cc('0x10'),_0x5e82af,_0x1f1866['error'][_0x05cc('0x16')]);return _0xf96dc7(_0x1f1866[_0x05cc('0x14')][_0x05cc('0x16')]);}logger['error'](_0x05cc('0x10'),_0x5e82af,_0x1f1866[_0x05cc('0x14')]['message']);return _0x41ecc0(_0x1f1866['error'][_0x05cc('0x16')]);}else{logger['info'](_0x05cc('0x10'),_0x5e82af,_0x05cc('0x11'));_0x41ecc0(_0x1f1866[_0x05cc('0x17')][_0x05cc('0x16')]);}})[_0x05cc('0x18')](function(_0xdf6f75){logger[_0x05cc('0x14')](_0x05cc('0x10'),_0x5e82af,_0xdf6f75);_0xf96dc7(_0xdf6f75);});});}exports['ShowSquareProject']=function(_0x1fb214){var _0x3cf7cf=this;return new Promise(function(_0x35c7f3,_0x4a3001){return db[_0x05cc('0x19')]['find']({'raw':_0x1fb214[_0x05cc('0x1a')]?_0x1fb214[_0x05cc('0x1a')][_0x05cc('0x1b')]===undefined?!![]:![]:!![],'where':_0x1fb214[_0x05cc('0x1a')]?_0x1fb214[_0x05cc('0x1a')][_0x05cc('0x1c')]||null:null,'attributes':_0x1fb214[_0x05cc('0x1a')]?_0x1fb214[_0x05cc('0x1a')][_0x05cc('0x1d')]||null:null,'include':_0x1fb214[_0x05cc('0x1a')]?_0x1fb214[_0x05cc('0x1a')]['include']?_[_0x05cc('0x1e')](_0x1fb214[_0x05cc('0x1a')][_0x05cc('0x1f')],function(_0x6bae4a){return{'model':db[_0x6bae4a[_0x05cc('0x20')]],'as':_0x6bae4a['as'],'attributes':_0x6bae4a['attributes'],'include':_0x6bae4a[_0x05cc('0x1f')]?_[_0x05cc('0x1e')](_0x6bae4a['include'],function(_0x56151a){return{'model':db[_0x56151a[_0x05cc('0x20')]],'as':_0x56151a['as'],'attributes':_0x56151a[_0x05cc('0x1d')],'include':_0x56151a['include']?_[_0x05cc('0x1e')](_0x56151a[_0x05cc('0x1f')],function(_0x29c3c5){return{'model':db[_0x29c3c5['model']],'as':_0x29c3c5['as'],'attributes':_0x29c3c5[_0x05cc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f41fd){logger[_0x05cc('0x21')](_0x05cc('0x22'),_0x1fb214);logger[_0x05cc('0x23')](_0x05cc('0x22'),_0x1fb214,JSON['stringify'](_0x2f41fd));_0x35c7f3(_0x2f41fd);})[_0x05cc('0x18')](function(_0x3a89e5){logger[_0x05cc('0x14')](_0x05cc('0x22'),_0x3a89e5[_0x05cc('0x16')],_0x1fb214);_0x4a3001(_0x3cf7cf[_0x05cc('0x14')](0x1f4,_0x3a89e5[_0x05cc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 67e9add..530c125 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 _0xf0b9=['emit','removeListener','length','squareProject:','save','remove','update'];(function(_0x188888,_0x2a0a1c){var _0x1491a8=function(_0x57414a){while(--_0x57414a){_0x188888['push'](_0x188888['shift']());}};_0x1491a8(++_0x2a0a1c);}(_0xf0b9,0x97));var _0x9f0b=function(_0x52a2c7,_0x2b5ee9){_0x52a2c7=_0x52a2c7-0x0;var _0xa6034b=_0xf0b9[_0x52a2c7];return _0xa6034b;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x9f0b('0x0'),_0x9f0b('0x1'),_0x9f0b('0x2')];function createListener(_0x17ab1b,_0x3cf1d2){return function(_0x2f4c9e){_0x3cf1d2[_0x9f0b('0x3')](_0x17ab1b,_0x2f4c9e);};}function removeListener(_0x1bf34b,_0x2fefee){return function(){SquareProjectEvents[_0x9f0b('0x4')](_0x1bf34b,_0x2fefee);};}exports['register']=function(_0xca9605){for(var _0x3cc572=0x0,_0x5bb3e7=events[_0x9f0b('0x5')];_0x3cc572<_0x5bb3e7;_0x3cc572++){var _0x4789e4=events[_0x3cc572];var _0x20cc35=createListener(_0x9f0b('0x6')+_0x4789e4,_0xca9605);SquareProjectEvents['on'](_0x4789e4,_0x20cc35);}}; \ No newline at end of file +var _0x80c9=['remove','update','emit','removeListener','register','./squareProject.events','save'];(function(_0x2febc3,_0x24ff35){var _0x9eeb7c=function(_0x216e24){while(--_0x216e24){_0x2febc3['push'](_0x2febc3['shift']());}};_0x9eeb7c(++_0x24ff35);}(_0x80c9,0x1e1));var _0x980c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80c9[_0x14add3];return _0x4a174f;};'use strict';var SquareProjectEvents=require(_0x980c('0x0'));var events=[_0x980c('0x1'),_0x980c('0x2'),_0x980c('0x3')];function createListener(_0x3db4de,_0x20d901){return function(_0x794db){_0x20d901[_0x980c('0x4')](_0x3db4de,_0x794db);};}function removeListener(_0x3cbe86,_0x30f0ec){return function(){SquareProjectEvents[_0x980c('0x5')](_0x3cbe86,_0x30f0ec);};}exports[_0x980c('0x6')]=function(_0x2fd56b){for(var _0x5da920=0x0,_0x4e5a73=events['length'];_0x5da920<_0x4e5a73;_0x5da920++){var _0x60ef2d=events[_0x5da920];var _0x1d2d63=createListener('squareProject:'+_0x60ef2d,_0x2fd56b);SquareProjectEvents['on'](_0x60ef2d,_0x1d2d63);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ecf2f24..2a3d99f 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x56c2c4,_0x2fdd2d){var _0x5ed200=function(_0x43eeae){while(--_0x43eeae){_0x56c2c4['push'](_0x56c2c4['shift']());}};_0x5ed200(++_0x2fdd2d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x2a9c07,_0xacf55){var _0x2001f0=function(_0x5a2d4d){while(--_0x5a2d4d){_0x2a9c07['push'](_0x2a9c07['shift']());}};_0x2001f0(++_0xacf55);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x7b842c,_0x393863){_0x7b842c=_0x7b842c-0x0;var _0x5c3f59=_0x7fbe[_0x7b842c];return _0x5c3f59;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index cb3d38c..80a56f4 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 _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x2675,0x75));var _0x5267=function(_0x46c52c,_0x4238bf){_0x46c52c=_0x46c52c-0x0;var _0x53d1d8=_0x2675[_0x46c52c];return _0x53d1d8;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file +var _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x23d189,_0x3aa2a5){var _0x2c75cf=function(_0x40f286){while(--_0x40f286){_0x23d189['push'](_0x23d189['shift']());}};_0x2c75cf(++_0x3aa2a5);}(_0x032e,0x124));var _0xe032=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x032e[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ddfe1eb..b13c36a 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 _0x7fba=['File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','params','find','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','existsSync','info'];(function(_0xaaa1f0,_0x54e13a){var _0x4bae69=function(_0x27f25f){while(--_0x27f25f){_0xaaa1f0['push'](_0xaaa1f0['shift']());}};_0x4bae69(++_0x54e13a);}(_0x7fba,0x1f4));var _0xa7fb=function(_0x191480,_0x517116){_0x191480=_0x191480-0x0;var _0xb4f387=_0x7fba[_0x191480];return _0xb4f387;};'use strict';var emlformat=require(_0xa7fb('0x0'));var rimraf=require(_0xa7fb('0x1'));var zipdir=require(_0xa7fb('0x2'));var jsonpatch=require(_0xa7fb('0x3'));var rp=require(_0xa7fb('0x4'));var moment=require(_0xa7fb('0x5'));var BPromise=require(_0xa7fb('0x6'));var Mustache=require(_0xa7fb('0x7'));var util=require(_0xa7fb('0x8'));var path=require(_0xa7fb('0x9'));var sox=require('sox');var csv=require(_0xa7fb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa7fb('0xb'));var squel=require(_0xa7fb('0xc'));var crypto=require('crypto');var jsforce=require(_0xa7fb('0xd'));var deskjs=require(_0xa7fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa7fb('0xf'));var Papa=require(_0xa7fb('0x10'));var Redis=require(_0xa7fb('0x11'));var authService=require(_0xa7fb('0x12'));var qs=require(_0xa7fb('0x13'));var as=require(_0xa7fb('0x14'));var hardwareService=require(_0xa7fb('0x15'));var logger=require(_0xa7fb('0x16'))(_0xa7fb('0x17'));var utils=require(_0xa7fb('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2952a6,_0x195e38){_0x195e38=_0x195e38||0xcc;return function(_0x1cefe5){if(_0x1cefe5){return _0x2952a6['sendStatus'](_0x195e38);}return _0x2952a6['status'](_0x195e38)['end']();};}function respondWithResult(_0x3ed07a,_0x30bbdc){_0x30bbdc=_0x30bbdc||0xc8;return function(_0x39a273){if(_0x39a273){return _0x3ed07a['status'](_0x30bbdc)[_0xa7fb('0x19')](_0x39a273);}};}function respondWithFilteredResult(_0x2af8d3,_0x33c844){return function(_0x3d1220){if(_0x3d1220){var _0x52ac11=typeof _0x33c844[_0xa7fb('0x1a')]===_0xa7fb('0x1b')&&typeof _0x33c844[_0xa7fb('0x1c')]===_0xa7fb('0x1b');var _0x42d129=_0x3d1220[_0xa7fb('0x1d')];var _0x44c4ff=_0x52ac11?0x0:_0x33c844['offset'];var _0x2d6a42=_0x52ac11?_0x3d1220[_0xa7fb('0x1d')]:_0x33c844[_0xa7fb('0x1a')]+_0x33c844[_0xa7fb('0x1c')];var _0x299b7e;if(_0x2d6a42>=_0x42d129){_0x2d6a42=_0x42d129;_0x299b7e=0xc8;}else{_0x299b7e=0xce;}_0x2af8d3[_0xa7fb('0x1e')](_0x299b7e);return _0x2af8d3[_0xa7fb('0x1f')]('Content-Range',_0x44c4ff+'-'+_0x2d6a42+'/'+_0x42d129)[_0xa7fb('0x19')](_0x3d1220);}return null;};}function patchUpdates(_0x5d7421){return function(_0x5f296f){try{jsonpatch[_0xa7fb('0x20')](_0x5f296f,_0x5d7421,!![]);}catch(_0x185880){return BPromise[_0xa7fb('0x21')](_0x185880);}return _0x5f296f[_0xa7fb('0x22')]();};}function saveUpdates(_0x366cef,_0x17b45b){return function(_0x402e46){if(_0x402e46){return _0x402e46[_0xa7fb('0x23')](_0x366cef)[_0xa7fb('0x24')](function(_0x1b66e9){return _0x1b66e9;});}return null;};}function removeEntity(_0x41a532,_0x1ebfd9){return function(_0x108388){if(_0x108388){return _0x108388['destroy']()[_0xa7fb('0x24')](function(){_0x41a532[_0xa7fb('0x1e')](0xcc)[_0xa7fb('0x25')]();});}};}function handleEntityNotFound(_0x3554ef,_0x8e4295){return function(_0x4734a6){if(!_0x4734a6){_0x3554ef[_0xa7fb('0x26')](0x194);}return _0x4734a6;};}function handleError(_0x19a5e0,_0x39c99f){_0x39c99f=_0x39c99f||0x1f4;return function(_0x1d9567){logger[_0xa7fb('0x27')](_0x1d9567[_0xa7fb('0x28')]);if(_0x1d9567['name']){delete _0x1d9567[_0xa7fb('0x29')];}_0x19a5e0[_0xa7fb('0x1e')](_0x39c99f)[_0xa7fb('0x2a')](_0x1d9567);};}exports[_0xa7fb('0x2b')]=function(_0x275594,_0x295b5e){var _0x48f71c={},_0xe707be={},_0x34ccc1={'count':0x0,'rows':[]};var _0x45f1fb=_[_0xa7fb('0x2c')](db['SquareRecording'][_0xa7fb('0x2d')],function(_0xa8f9fa){return{'name':_0xa8f9fa['fieldName'],'type':_0xa8f9fa['type'][_0xa7fb('0x2e')]};});_0xe707be['model']=_['map'](_0x45f1fb,_0xa7fb('0x29'));_0xe707be[_0xa7fb('0x2f')]=_[_0xa7fb('0x30')](_0x275594[_0xa7fb('0x2f')]);_0xe707be[_0xa7fb('0x31')]=_[_0xa7fb('0x32')](_0xe707be[_0xa7fb('0x33')],_0xe707be['query']);_0x48f71c[_0xa7fb('0x34')]=_[_0xa7fb('0x32')](_0xe707be[_0xa7fb('0x33')],qs[_0xa7fb('0x35')](_0x275594[_0xa7fb('0x2f')]['fields']));_0x48f71c[_0xa7fb('0x34')]=_0x48f71c[_0xa7fb('0x34')][_0xa7fb('0x36')]?_0x48f71c['attributes']:_0xe707be['model'];if(!_0x275594[_0xa7fb('0x2f')][_0xa7fb('0x37')](_0xa7fb('0x38'))){_0x48f71c['limit']=qs[_0xa7fb('0x1c')](_0x275594['query'][_0xa7fb('0x1c')]);_0x48f71c['offset']=qs[_0xa7fb('0x1a')](_0x275594[_0xa7fb('0x2f')][_0xa7fb('0x1a')]);}_0x48f71c[_0xa7fb('0x39')]=qs[_0xa7fb('0x3a')](_0x275594[_0xa7fb('0x2f')][_0xa7fb('0x3a')]);_0x48f71c[_0xa7fb('0x3b')]=qs[_0xa7fb('0x31')](_[_0xa7fb('0x3c')](_0x275594[_0xa7fb('0x2f')],_0xe707be[_0xa7fb('0x31')]),_0x45f1fb);if(_0x275594[_0xa7fb('0x2f')][_0xa7fb('0x3d')]){_0x48f71c[_0xa7fb('0x3b')]=_[_0xa7fb('0x3e')](_0x48f71c['where'],{'$or':_[_0xa7fb('0x2c')](_0x45f1fb,function(_0x2e2a53){if(_0x2e2a53[_0xa7fb('0x3f')]!==_0xa7fb('0x40')){var _0x49589b={};_0x49589b[_0x2e2a53[_0xa7fb('0x29')]]={'$like':'%'+_0x275594[_0xa7fb('0x2f')]['filter']+'%'};return _0x49589b;}})});}_0x48f71c=_[_0xa7fb('0x3e')]({},_0x48f71c,_0x275594[_0xa7fb('0x41')]);var _0x1b37a4={'where':_0x48f71c['where']};return db[_0xa7fb('0x42')][_0xa7fb('0x1d')](_0x1b37a4)['then'](function(_0x1c5f50){_0x34ccc1[_0xa7fb('0x1d')]=_0x1c5f50;if(_0x275594[_0xa7fb('0x2f')][_0xa7fb('0x43')]){_0x48f71c[_0xa7fb('0x44')]=[{'all':!![]}];}return db[_0xa7fb('0x42')][_0xa7fb('0x45')](_0x48f71c);})['then'](function(_0xab40b4){_0x34ccc1[_0xa7fb('0x46')]=_0xab40b4;return _0x34ccc1;})[_0xa7fb('0x24')](respondWithFilteredResult(_0x295b5e,_0x48f71c))[_0xa7fb('0x47')](handleError(_0x295b5e,null));};exports['show']=function(_0xca6d00,_0x559d8c){var _0x3896a8={'raw':!![],'where':{'id':_0xca6d00[_0xa7fb('0x48')]['id']}},_0x9cfc38={};_0x9cfc38[_0xa7fb('0x33')]=_[_0xa7fb('0x30')](db[_0xa7fb('0x42')][_0xa7fb('0x2d')]);_0x9cfc38['query']=_['keys'](_0xca6d00[_0xa7fb('0x2f')]);_0x9cfc38['filters']=_[_0xa7fb('0x32')](_0x9cfc38[_0xa7fb('0x33')],_0x9cfc38[_0xa7fb('0x2f')]);_0x3896a8[_0xa7fb('0x34')]=_[_0xa7fb('0x32')](_0x9cfc38[_0xa7fb('0x33')],qs['fields'](_0xca6d00[_0xa7fb('0x2f')][_0xa7fb('0x35')]));_0x3896a8['attributes']=_0x3896a8[_0xa7fb('0x34')][_0xa7fb('0x36')]?_0x3896a8[_0xa7fb('0x34')]:_0x9cfc38[_0xa7fb('0x33')];if(_0xca6d00[_0xa7fb('0x2f')][_0xa7fb('0x43')]){_0x3896a8[_0xa7fb('0x44')]=[{'all':!![]}];}_0x3896a8=_[_0xa7fb('0x3e')]({},_0x3896a8,_0xca6d00[_0xa7fb('0x41')]);return db[_0xa7fb('0x42')][_0xa7fb('0x49')](_0x3896a8)[_0xa7fb('0x24')](handleEntityNotFound(_0x559d8c,null))['then'](respondWithResult(_0x559d8c,null))[_0xa7fb('0x47')](handleError(_0x559d8c,null));};exports['create']=function(_0x3bd165,_0x5e6588){return db[_0xa7fb('0x42')]['create'](_0x3bd165[_0xa7fb('0x4a')],{})[_0xa7fb('0x24')](respondWithResult(_0x5e6588,0xc9))[_0xa7fb('0x47')](handleError(_0x5e6588,null));};exports[_0xa7fb('0x23')]=function(_0x44c7f1,_0x311195){if(_0x44c7f1[_0xa7fb('0x4a')]['id']){delete _0x44c7f1[_0xa7fb('0x4a')]['id'];}return db[_0xa7fb('0x42')][_0xa7fb('0x49')]({'where':{'id':_0x44c7f1['params']['id']}})['then'](handleEntityNotFound(_0x311195,null))[_0xa7fb('0x24')](saveUpdates(_0x44c7f1[_0xa7fb('0x4a')],null))[_0xa7fb('0x24')](respondWithResult(_0x311195,null))['catch'](handleError(_0x311195,null));};exports[_0xa7fb('0x4b')]=function(_0x1708a8,_0x3c979d,_0x3b0336){var _0x5489b2=require(_0xa7fb('0x4c'));var _0x4b4dff=![];var _0x309a04={};if(_0x1708a8[_0xa7fb('0x2f')][_0xa7fb('0x3f')]&&_0x1708a8[_0xa7fb('0x2f')][_0xa7fb('0x3f')]===_0xa7fb('0x4d')){_0x309a04[_0xa7fb('0x4d')]=_0x1708a8[_0xa7fb('0x48')]['id'];}else{_0x309a04['id']=_0x1708a8[_0xa7fb('0x48')]['id'];}return db[_0xa7fb('0x42')][_0xa7fb('0x49')]({'where':_0x309a04,'attributes':['id',_0xa7fb('0x4e'),_0xa7fb('0x4f')],'raw':!![]})[_0xa7fb('0x24')](handleEntityNotFound(_0x3c979d,null))['then'](function(_0x1f0a60){if(_0x1f0a60){var _0x273ef3=_0x1f0a60[_0xa7fb('0x4e')];var _0x3d836b=util[_0xa7fb('0x50')](_0xa7fb('0x51'),_0x273ef3);if(fs['existsSync'](_0x3d836b)){_0x4b4dff=!![];return _0x5489b2['decryptFile'](_0x3d836b,_0x273ef3,config['secrets']['recording'])[_0xa7fb('0x24')](function(){return _0x1f0a60;});}return _0x1f0a60;}})[_0xa7fb('0x24')](function(_0xb9f949){if(_0xb9f949){var _0x1fae5f=_0xb9f949['savePath'];if(!fs['existsSync'](_0x1fae5f)){throw new db[(_0xa7fb('0x52'))][(_0xa7fb('0x53'))](_0xa7fb('0x54'));}if(_0xb9f949[_0xa7fb('0x4f')]){return _0x3c979d[_0xa7fb('0x4b')](_0x1fae5f,_0xb9f949['filename']+path[_0xa7fb('0x55')](_0x1fae5f),function(){if(_0x4b4dff){fs[_0xa7fb('0x56')](_0x1fae5f);}});}else{return _0x3c979d[_0xa7fb('0x4b')](_0x1fae5f,function(_0xdc28ce){if(_0x4b4dff){fs[_0xa7fb('0x56')](_0x1fae5f);}});}}})[_0xa7fb('0x47')](function(_0x40ef93){if(_0x40ef93[_0xa7fb('0x57')]===_0xa7fb('0x54')){_0x3c979d[_0xa7fb('0x1e')](0x194)[_0xa7fb('0x2a')](_0xa7fb('0x58'));}else{return handleError(_0x3c979d,null);}});};exports[_0xa7fb('0x59')]=function(_0x278ce7,_0x27f4f3){return db[_0xa7fb('0x42')][_0xa7fb('0x49')]({'where':{'id':_0x278ce7['params']['id']}})['then'](function(_0x2c4790){if(_['isNil'](_0x2c4790)){throw new ReferenceError(_0xa7fb('0x5a'));}return _0x2c4790;})[_0xa7fb('0x24')](function(_0x1bb03c){var _0x1e2171=_0x1bb03c[_0xa7fb('0x4e')];logger['info'](_0xa7fb('0x5b'),_0x1e2171);if(!_['isNil'](_0x1bb03c[_0xa7fb('0x4e')])&&fs[_0xa7fb('0x5c')](_0x1e2171)){logger[_0xa7fb('0x5d')](_0xa7fb('0x5e')+_0x1e2171+_0xa7fb('0x5f'));fs[_0xa7fb('0x60')](_0x1e2171);}_0x1e2171=_0x1e2171+_0xa7fb('0x61');if(!_[_0xa7fb('0x62')](_0x1bb03c[_0xa7fb('0x4e')])&&fs['existsSync'](_0x1e2171)){logger[_0xa7fb('0x5d')](_0xa7fb('0x5e')+_0x1e2171+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa7fb('0x60')](_0x1e2171);}return _0x1bb03c;})[_0xa7fb('0x24')](function(_0xbfa28c){if(!_0xbfa28c)throw new InternalError();return _0xbfa28c[_0xa7fb('0x59')]();})[_0xa7fb('0x24')](function(){_0x27f4f3[_0xa7fb('0x1e')](0xcc)['end']();})[_0xa7fb('0x47')](handleError(_0x27f4f3,null));}; \ No newline at end of file +var _0x81de=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x73865a,_0x451e72){var _0x47767f=function(_0x56aa35){while(--_0x56aa35){_0x73865a['push'](_0x73865a['shift']());}};_0x47767f(++_0x451e72);}(_0x81de,0x110));var _0xe81d=function(_0xab014e,_0x4f00d1){_0xab014e=_0xab014e-0x0;var _0x376735=_0x81de[_0xab014e];return _0x376735;};'use strict';var emlformat=require(_0xe81d('0x0'));var rimraf=require(_0xe81d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe81d('0x2'));var rp=require('request-promise');var moment=require(_0xe81d('0x3'));var BPromise=require(_0xe81d('0x4'));var Mustache=require(_0xe81d('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe81d('0x6'));var csv=require('to-csv');var ejs=require(_0xe81d('0x7'));var fs=require('fs');var fs_extra=require(_0xe81d('0x8'));var _=require(_0xe81d('0x9'));var squel=require(_0xe81d('0xa'));var crypto=require(_0xe81d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe81d('0xc'));var toCsv=require(_0xe81d('0xd'));var querystring=require(_0xe81d('0xe'));var Papa=require('papaparse');var Redis=require(_0xe81d('0xf'));var authService=require(_0xe81d('0x10'));var qs=require(_0xe81d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe81d('0x12'));var logger=require(_0xe81d('0x13'))(_0xe81d('0x14'));var utils=require(_0xe81d('0x15'));var config=require(_0xe81d('0x16'));var licenseUtil=require(_0xe81d('0x17'));var db=require(_0xe81d('0x18'))['db'];function respondWithStatusCode(_0x109c95,_0x53959e){_0x53959e=_0x53959e||0xcc;return function(_0x35116e){if(_0x35116e){return _0x109c95['sendStatus'](_0x53959e);}return _0x109c95[_0xe81d('0x19')](_0x53959e)[_0xe81d('0x1a')]();};}function respondWithResult(_0x2fe2d2,_0x3e363e){_0x3e363e=_0x3e363e||0xc8;return function(_0x237594){if(_0x237594){return _0x2fe2d2[_0xe81d('0x19')](_0x3e363e)[_0xe81d('0x1b')](_0x237594);}};}function respondWithFilteredResult(_0x1e79f6,_0xf92970){return function(_0x3da069){if(_0x3da069){var _0x473bc7=typeof _0xf92970[_0xe81d('0x1c')]==='undefined'&&typeof _0xf92970[_0xe81d('0x1d')]===_0xe81d('0x1e');var _0xec4175=_0x3da069[_0xe81d('0x1f')];var _0x4b6643=_0x473bc7?0x0:_0xf92970[_0xe81d('0x1c')];var _0x1ca804=_0x473bc7?_0x3da069[_0xe81d('0x1f')]:_0xf92970['offset']+_0xf92970[_0xe81d('0x1d')];var _0x24b993;if(_0x1ca804>=_0xec4175){_0x1ca804=_0xec4175;_0x24b993=0xc8;}else{_0x24b993=0xce;}_0x1e79f6[_0xe81d('0x19')](_0x24b993);return _0x1e79f6[_0xe81d('0x20')](_0xe81d('0x21'),_0x4b6643+'-'+_0x1ca804+'/'+_0xec4175)[_0xe81d('0x1b')](_0x3da069);}return null;};}function patchUpdates(_0x25c244){return function(_0x200cbc){try{jsonpatch[_0xe81d('0x22')](_0x200cbc,_0x25c244,!![]);}catch(_0x2124eb){return BPromise['reject'](_0x2124eb);}return _0x200cbc[_0xe81d('0x23')]();};}function saveUpdates(_0x22d22e,_0x4bb7b4){return function(_0x1cb2a5){if(_0x1cb2a5){return _0x1cb2a5[_0xe81d('0x24')](_0x22d22e)[_0xe81d('0x25')](function(_0x3a53bb){return _0x3a53bb;});}return null;};}function removeEntity(_0x150f29,_0x3cf823){return function(_0x40ae66){if(_0x40ae66){return _0x40ae66[_0xe81d('0x26')]()[_0xe81d('0x25')](function(){_0x150f29[_0xe81d('0x19')](0xcc)[_0xe81d('0x1a')]();});}};}function handleEntityNotFound(_0x46d1c9,_0x189b3){return function(_0x439987){if(!_0x439987){_0x46d1c9[_0xe81d('0x27')](0x194);}return _0x439987;};}function handleError(_0x17a808,_0x1d8537){_0x1d8537=_0x1d8537||0x1f4;return function(_0x41d820){logger[_0xe81d('0x28')](_0x41d820[_0xe81d('0x29')]);if(_0x41d820[_0xe81d('0x2a')]){delete _0x41d820[_0xe81d('0x2a')];}_0x17a808['status'](_0x1d8537)[_0xe81d('0x2b')](_0x41d820);};}exports[_0xe81d('0x2c')]=function(_0x195896,_0x53a0e6){var _0x450361={},_0x3b4287={},_0x1514a1={'count':0x0,'rows':[]};var _0x308d20=_[_0xe81d('0x2d')](db[_0xe81d('0x2e')][_0xe81d('0x2f')],function(_0x4227f3){return{'name':_0x4227f3[_0xe81d('0x30')],'type':_0x4227f3[_0xe81d('0x31')]['key']};});_0x3b4287[_0xe81d('0x32')]=_['map'](_0x308d20,_0xe81d('0x2a'));_0x3b4287['query']=_['keys'](_0x195896[_0xe81d('0x33')]);_0x3b4287[_0xe81d('0x34')]=_[_0xe81d('0x35')](_0x3b4287['model'],_0x3b4287['query']);_0x450361[_0xe81d('0x36')]=_['intersection'](_0x3b4287[_0xe81d('0x32')],qs['fields'](_0x195896[_0xe81d('0x33')][_0xe81d('0x37')]));_0x450361[_0xe81d('0x36')]=_0x450361['attributes'][_0xe81d('0x38')]?_0x450361[_0xe81d('0x36')]:_0x3b4287[_0xe81d('0x32')];if(!_0x195896[_0xe81d('0x33')][_0xe81d('0x39')](_0xe81d('0x3a'))){_0x450361[_0xe81d('0x1d')]=qs[_0xe81d('0x1d')](_0x195896[_0xe81d('0x33')]['limit']);_0x450361[_0xe81d('0x1c')]=qs[_0xe81d('0x1c')](_0x195896[_0xe81d('0x33')][_0xe81d('0x1c')]);}_0x450361[_0xe81d('0x3b')]=qs[_0xe81d('0x3c')](_0x195896[_0xe81d('0x33')][_0xe81d('0x3c')]);_0x450361[_0xe81d('0x3d')]=qs[_0xe81d('0x34')](_[_0xe81d('0x3e')](_0x195896['query'],_0x3b4287['filters']),_0x308d20);if(_0x195896[_0xe81d('0x33')][_0xe81d('0x3f')]){_0x450361[_0xe81d('0x3d')]=_[_0xe81d('0x40')](_0x450361[_0xe81d('0x3d')],{'$or':_[_0xe81d('0x2d')](_0x308d20,function(_0x56398f){if(_0x56398f['type']!=='VIRTUAL'){var _0x516a76={};_0x516a76[_0x56398f[_0xe81d('0x2a')]]={'$like':'%'+_0x195896[_0xe81d('0x33')][_0xe81d('0x3f')]+'%'};return _0x516a76;}})});}_0x450361=_['merge']({},_0x450361,_0x195896[_0xe81d('0x41')]);var _0x5416fa={'where':_0x450361['where']};return db[_0xe81d('0x2e')][_0xe81d('0x1f')](_0x5416fa)['then'](function(_0x1674f5){_0x1514a1[_0xe81d('0x1f')]=_0x1674f5;if(_0x195896[_0xe81d('0x33')][_0xe81d('0x42')]){_0x450361[_0xe81d('0x43')]=[{'all':!![]}];}return db[_0xe81d('0x2e')][_0xe81d('0x44')](_0x450361);})[_0xe81d('0x25')](function(_0x4da454){_0x1514a1['rows']=_0x4da454;return _0x1514a1;})[_0xe81d('0x25')](respondWithFilteredResult(_0x53a0e6,_0x450361))[_0xe81d('0x45')](handleError(_0x53a0e6,null));};exports[_0xe81d('0x46')]=function(_0x45c9a1,_0x3754c4){var _0x430503={'raw':!![],'where':{'id':_0x45c9a1[_0xe81d('0x47')]['id']}},_0x527d14={};_0x527d14['model']=_[_0xe81d('0x48')](db[_0xe81d('0x2e')][_0xe81d('0x2f')]);_0x527d14[_0xe81d('0x33')]=_[_0xe81d('0x48')](_0x45c9a1[_0xe81d('0x33')]);_0x527d14['filters']=_[_0xe81d('0x35')](_0x527d14['model'],_0x527d14[_0xe81d('0x33')]);_0x430503[_0xe81d('0x36')]=_[_0xe81d('0x35')](_0x527d14[_0xe81d('0x32')],qs['fields'](_0x45c9a1[_0xe81d('0x33')][_0xe81d('0x37')]));_0x430503[_0xe81d('0x36')]=_0x430503[_0xe81d('0x36')][_0xe81d('0x38')]?_0x430503[_0xe81d('0x36')]:_0x527d14[_0xe81d('0x32')];if(_0x45c9a1[_0xe81d('0x33')][_0xe81d('0x42')]){_0x430503[_0xe81d('0x43')]=[{'all':!![]}];}_0x430503=_['merge']({},_0x430503,_0x45c9a1['options']);return db[_0xe81d('0x2e')][_0xe81d('0x49')](_0x430503)['then'](handleEntityNotFound(_0x3754c4,null))[_0xe81d('0x25')](respondWithResult(_0x3754c4,null))[_0xe81d('0x45')](handleError(_0x3754c4,null));};exports['create']=function(_0x3d6031,_0x357fcd){return db[_0xe81d('0x2e')][_0xe81d('0x4a')](_0x3d6031[_0xe81d('0x4b')],{})[_0xe81d('0x25')](respondWithResult(_0x357fcd,0xc9))[_0xe81d('0x45')](handleError(_0x357fcd,null));};exports[_0xe81d('0x24')]=function(_0x19177f,_0x405bfe){if(_0x19177f[_0xe81d('0x4b')]['id']){delete _0x19177f[_0xe81d('0x4b')]['id'];}return db[_0xe81d('0x2e')]['find']({'where':{'id':_0x19177f['params']['id']}})[_0xe81d('0x25')](handleEntityNotFound(_0x405bfe,null))[_0xe81d('0x25')](saveUpdates(_0x19177f[_0xe81d('0x4b')],null))[_0xe81d('0x25')](respondWithResult(_0x405bfe,null))[_0xe81d('0x45')](handleError(_0x405bfe,null));};exports[_0xe81d('0x4c')]=function(_0x5cb418,_0x4282bf,_0x4a2f1e){var _0x2ddaf7=require(_0xe81d('0x4d'));var _0x5bf7fb=![];var _0xedb23f={};if(_0x5cb418[_0xe81d('0x33')][_0xe81d('0x31')]&&_0x5cb418['query'][_0xe81d('0x31')]===_0xe81d('0x4e')){_0xedb23f[_0xe81d('0x4e')]=_0x5cb418[_0xe81d('0x47')]['id'];}else{_0xedb23f['id']=_0x5cb418['params']['id'];}return db[_0xe81d('0x2e')][_0xe81d('0x49')]({'where':_0xedb23f,'attributes':['id',_0xe81d('0x4f'),_0xe81d('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x4282bf,null))[_0xe81d('0x25')](function(_0x29d631){if(_0x29d631){var _0xc2bff2=_0x29d631['savePath'];var _0xf5ae34=util[_0xe81d('0x51')]('%s.cypher',_0xc2bff2);if(fs[_0xe81d('0x52')](_0xf5ae34)){_0x5bf7fb=!![];return _0x2ddaf7['decryptFile'](_0xf5ae34,_0xc2bff2,config['secrets'][_0xe81d('0x53')])[_0xe81d('0x25')](function(){return _0x29d631;});}return _0x29d631;}})['then'](function(_0x9dd30b){if(_0x9dd30b){var _0x59a262=_0x9dd30b[_0xe81d('0x4f')];if(!fs['existsSync'](_0x59a262)){throw new db[(_0xe81d('0x54'))][(_0xe81d('0x55'))](_0xe81d('0x56'));}if(_0x9dd30b[_0xe81d('0x50')]){return _0x4282bf[_0xe81d('0x4c')](_0x59a262,_0x9dd30b['filename']+path[_0xe81d('0x57')](_0x59a262),function(){if(_0x5bf7fb){fs['unlink'](_0x59a262);}});}else{return _0x4282bf[_0xe81d('0x4c')](_0x59a262,function(_0x2f0188){if(_0x5bf7fb){fs[_0xe81d('0x58')](_0x59a262);}});}}})[_0xe81d('0x45')](function(_0x1b5dd6){if(_0x1b5dd6[_0xe81d('0x59')]===_0xe81d('0x56')){_0x4282bf[_0xe81d('0x19')](0x194)[_0xe81d('0x2b')](_0xe81d('0x5a'));}else{return handleError(_0x4282bf,null);}});};exports[_0xe81d('0x26')]=function(_0x223ec0,_0x49e7a3){return db[_0xe81d('0x2e')][_0xe81d('0x49')]({'where':{'id':_0x223ec0[_0xe81d('0x47')]['id']}})[_0xe81d('0x25')](function(_0x86532f){if(_[_0xe81d('0x5b')](_0x86532f)){throw new ReferenceError('Entity\x20not\x20found');}return _0x86532f;})['then'](function(_0x2b679c){var _0x4dd19f=_0x2b679c['savePath'];logger[_0xe81d('0x5c')](_0xe81d('0x5d'),_0x4dd19f);if(!_[_0xe81d('0x5b')](_0x2b679c[_0xe81d('0x4f')])&&fs[_0xe81d('0x52')](_0x4dd19f)){logger['info'](_0xe81d('0x5e')+_0x4dd19f+_0xe81d('0x5f'));fs[_0xe81d('0x60')](_0x4dd19f);}_0x4dd19f=_0x4dd19f+_0xe81d('0x61');if(!_['isNil'](_0x2b679c['savePath'])&&fs[_0xe81d('0x52')](_0x4dd19f)){logger['info']('File:\x20\x22'+_0x4dd19f+_0xe81d('0x5f'));fs[_0xe81d('0x60')](_0x4dd19f);}return _0x2b679c;})[_0xe81d('0x25')](function(_0x57283f){if(!_0x57283f)throw new InternalError();return _0x57283f[_0xe81d('0x26')]();})[_0xe81d('0x25')](function(){_0x49e7a3[_0xe81d('0x19')](0xcc)[_0xe81d('0x1a')]();})[_0xe81d('0x45')](handleError(_0x49e7a3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 884d642..2e74f93 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 _0x6db4=['moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','util','../../config/logger','api'];(function(_0x3e502d,_0x32e5fb){var _0x4961d6=function(_0x545c7e){while(--_0x545c7e){_0x3e502d['push'](_0x3e502d['shift']());}};_0x4961d6(++_0x32e5fb);}(_0x6db4,0x111));var _0x46db=function(_0x887c92,_0x30cd13){_0x887c92=_0x887c92-0x0;var _0x604323=_0x6db4[_0x887c92];return _0x604323;};'use strict';var _=require('lodash');var util=require(_0x46db('0x0'));var logger=require(_0x46db('0x1'))(_0x46db('0x2'));var moment=require(_0x46db('0x3'));var BPromise=require(_0x46db('0x4'));var rp=require(_0x46db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46db('0x6'));var config=require(_0x46db('0x7'));var attributes=require(_0x46db('0x8'));module[_0x46db('0x9')]=function(_0x331e67,_0x2abfd4){return _0x331e67[_0x46db('0xa')]('SquareRecording',attributes,{'tableName':_0x46db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b2c=['request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger','moment'];(function(_0x5960d1,_0x334d55){var _0x392307=function(_0x51d415){while(--_0x51d415){_0x5960d1['push'](_0x5960d1['shift']());}};_0x392307(++_0x334d55);}(_0x9b2c,0x189));var _0xc9b2=function(_0x143ce6,_0x46e089){_0x143ce6=_0x143ce6-0x0;var _0x33ed64=_0x9b2c[_0x143ce6];return _0x33ed64;};'use strict';var _=require('lodash');var util=require(_0xc9b2('0x0'));var logger=require(_0xc9b2('0x1'))('api');var moment=require(_0xc9b2('0x2'));var BPromise=require('bluebird');var rp=require(_0xc9b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9b2('0x4'));var config=require(_0xc9b2('0x5'));var attributes=require(_0xc9b2('0x6'));module[_0xc9b2('0x7')]=function(_0x15be55,_0x3e6343){return _0x15be55[_0xc9b2('0x8')](_0xc9b2('0x9'),attributes,{'tableName':_0xc9b2('0xa'),'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 700047f..458c965 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 _0x82c0=['stringify','error','code','message','result','CreateSquareRecording','SquareRecording','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x82c0,0x119));var _0x082c=function(_0x16a7d7,_0x17d6c0){_0x16a7d7=_0x16a7d7-0x0;var _0x5e0ff8=_0x82c0[_0x16a7d7];return _0x5e0ff8;};'use strict';var _=require(_0x082c('0x0'));var util=require(_0x082c('0x1'));var moment=require(_0x082c('0x2'));var BPromise=require(_0x082c('0x3'));var rs=require(_0x082c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x082c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x082c('0x6'))(_0x082c('0x7'));var config=require(_0x082c('0x8'));var jayson=require(_0x082c('0x9'));var client=jayson[_0x082c('0xa')][_0x082c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cf2b3,_0x356aa6,_0x1ac73b){return new BPromise(function(_0x55f7a5,_0x18059b){return client[_0x082c('0xc')](_0x1cf2b3,_0x1ac73b)[_0x082c('0xd')](function(_0x357e1d){logger[_0x082c('0xe')](_0x082c('0xf'),_0x356aa6,_0x082c('0x10'));logger[_0x082c('0x11')](_0x082c('0x12'),_0x356aa6,'request\x20sent',JSON[_0x082c('0x13')](_0x357e1d));if(_0x357e1d[_0x082c('0x14')]){if(_0x357e1d[_0x082c('0x14')][_0x082c('0x15')]===0x1f4){logger[_0x082c('0x14')](_0x082c('0xf'),_0x356aa6,_0x357e1d[_0x082c('0x14')][_0x082c('0x16')]);return _0x18059b(_0x357e1d[_0x082c('0x14')][_0x082c('0x16')]);}logger[_0x082c('0x14')](_0x082c('0xf'),_0x356aa6,_0x357e1d[_0x082c('0x14')][_0x082c('0x16')]);return _0x55f7a5(_0x357e1d['error']['message']);}else{logger[_0x082c('0xe')](_0x082c('0xf'),_0x356aa6,_0x082c('0x10'));_0x55f7a5(_0x357e1d[_0x082c('0x17')]['message']);}})['catch'](function(_0x1642b4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x356aa6,_0x1642b4);_0x18059b(_0x1642b4);});});}exports[_0x082c('0x18')]=function(_0x33fc60){var _0x2d1bb7=this;return new Promise(function(_0x2526ae,_0x52ce5c){return db[_0x082c('0x19')]['create'](_0x33fc60[_0x082c('0x1a')],{'raw':_0x33fc60[_0x082c('0x1b')]?_0x33fc60['options'][_0x082c('0x1c')]===undefined?!![]:![]:!![]})[_0x082c('0xd')](function(_0x269867){logger[_0x082c('0xe')](_0x082c('0x18'),_0x33fc60);logger[_0x082c('0x11')](_0x082c('0x18'),_0x33fc60,JSON[_0x082c('0x13')](_0x269867));_0x2526ae(_0x269867);})[_0x082c('0x1d')](function(_0x9efd88){logger[_0x082c('0x14')]('CreateSquareRecording',_0x9efd88[_0x082c('0x16')],_0x33fc60);_0x52ce5c(_0x2d1bb7[_0x082c('0x14')](0x1f4,_0x9efd88[_0x082c('0x16')]));});});}; \ No newline at end of file +var _0xe072=['catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','moment','randomstring','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x21f1d3,_0x5d60c7){var _0xad5b16=function(_0x3bece1){while(--_0x3bece1){_0x21f1d3['push'](_0x21f1d3['shift']());}};_0xad5b16(++_0x5d60c7);}(_0xe072,0x173));var _0x2e07=function(_0x14554e,_0x1b97f9){_0x14554e=_0x14554e-0x0;var _0x2e516f=_0xe072[_0x14554e];return _0x2e516f;};'use strict';var _=require(_0x2e07('0x0'));var util=require(_0x2e07('0x1'));var moment=require(_0x2e07('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2e07('0x4'));var jayson=require(_0x2e07('0x5'));var client=jayson[_0x2e07('0x6')][_0x2e07('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3160d9,_0x20ff0b,_0x391068){return new BPromise(function(_0x40c4f2,_0xfd0b63){return client[_0x2e07('0x8')](_0x3160d9,_0x391068)[_0x2e07('0x9')](function(_0x20d769){logger[_0x2e07('0xa')](_0x2e07('0xb'),_0x20ff0b,'request\x20sent');logger['debug'](_0x2e07('0xc'),_0x20ff0b,'request\x20sent',JSON[_0x2e07('0xd')](_0x20d769));if(_0x20d769[_0x2e07('0xe')]){if(_0x20d769[_0x2e07('0xe')][_0x2e07('0xf')]===0x1f4){logger[_0x2e07('0xe')](_0x2e07('0xb'),_0x20ff0b,_0x20d769[_0x2e07('0xe')][_0x2e07('0x10')]);return _0xfd0b63(_0x20d769['error'][_0x2e07('0x10')]);}logger[_0x2e07('0xe')](_0x2e07('0xb'),_0x20ff0b,_0x20d769[_0x2e07('0xe')][_0x2e07('0x10')]);return _0x40c4f2(_0x20d769[_0x2e07('0xe')][_0x2e07('0x10')]);}else{logger['info'](_0x2e07('0xb'),_0x20ff0b,_0x2e07('0x11'));_0x40c4f2(_0x20d769[_0x2e07('0x12')][_0x2e07('0x10')]);}})[_0x2e07('0x13')](function(_0xfdc782){logger['error'](_0x2e07('0xb'),_0x20ff0b,_0xfdc782);_0xfd0b63(_0xfdc782);});});}exports[_0x2e07('0x14')]=function(_0x42bfad){var _0x54223f=this;return new Promise(function(_0x5927cb,_0x5dbf67){return db[_0x2e07('0x15')][_0x2e07('0x16')](_0x42bfad[_0x2e07('0x17')],{'raw':_0x42bfad['options']?_0x42bfad[_0x2e07('0x18')][_0x2e07('0x19')]===undefined?!![]:![]:!![]})[_0x2e07('0x9')](function(_0x5db89b){logger['info'](_0x2e07('0x14'),_0x42bfad);logger['debug'](_0x2e07('0x14'),_0x42bfad,JSON[_0x2e07('0xd')](_0x5db89b));_0x5927cb(_0x5db89b);})[_0x2e07('0x13')](function(_0x349c11){logger[_0x2e07('0xe')](_0x2e07('0x14'),_0x349c11[_0x2e07('0x10')],_0x42bfad);_0x5dbf67(_0x54223f[_0x2e07('0xe')](0x1f4,_0x349c11[_0x2e07('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 416a4c1..92a5e56 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x33c227,_0x1a5944){var _0x309456=function(_0x883209){while(--_0x883209){_0x33c227['push'](_0x33c227['shift']());}};_0x309456(++_0x1a5944);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x35e15d,_0x5e16e3){var _0x3a53e2=function(_0x238c7f){while(--_0x238c7f){_0x35e15d['push'](_0x35e15d['shift']());}};_0x3a53e2(++_0x5e16e3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 14f185e..51d8fe7 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 _0xf603=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0xb2fb80,_0x88033a){var _0x480aac=function(_0x38a846){while(--_0x38a846){_0xb2fb80['push'](_0xb2fb80['shift']());}};_0x480aac(++_0x88033a);}(_0xf603,0xeb));var _0x3f60=function(_0x52486d,_0x23e392){_0x52486d=_0x52486d-0x0;var _0x14ff30=_0xf603[_0x52486d];return _0x14ff30;};'use strict';var Sequelize=require(_0x3f60('0x0'));module[_0x3f60('0x1')]={'network':{'type':Sequelize[_0x3f60('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x3f60('0x2')]},'channel':{'type':Sequelize[_0x3f60('0x2')]},'language':{'type':Sequelize[_0x3f60('0x2')]},'type':{'type':Sequelize[_0x3f60('0x2')]},'uniqueid':{'type':Sequelize[_0x3f60('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3f60('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x3f60('0x2')]},'callington':{'type':Sequelize[_0x3f60('0x2')]},'callingtns':{'type':Sequelize[_0x3f60('0x2')]},'dnid':{'type':Sequelize[_0x3f60('0x2')]},'rdnis':{'type':Sequelize[_0x3f60('0x2')]},'context':{'type':Sequelize[_0x3f60('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3f60('0x2')]},'enhanced':{'type':Sequelize[_0x3f60('0x2')]},'accountcode':{'type':Sequelize[_0x3f60('0x2')]},'threadid':{'type':Sequelize[_0x3f60('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3f60('0x3')]},'bot':{'type':Sequelize[_0x3f60('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xdb60=['STRING','DATE','BOOLEAN','exports'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0xdb60,0xb3));var _0x0db6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb60[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x0db6('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x0db6('0x1')]},'channel':{'type':Sequelize[_0x0db6('0x1')]},'language':{'type':Sequelize[_0x0db6('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0db6('0x1')]},'version':{'type':Sequelize[_0x0db6('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x0db6('0x1')]},'callington':{'type':Sequelize[_0x0db6('0x1')]},'callingtns':{'type':Sequelize[_0x0db6('0x1')]},'dnid':{'type':Sequelize[_0x0db6('0x1')]},'rdnis':{'type':Sequelize[_0x0db6('0x1')]},'context':{'type':Sequelize[_0x0db6('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0db6('0x1')]},'enhanced':{'type':Sequelize[_0x0db6('0x1')]},'accountcode':{'type':Sequelize[_0x0db6('0x1')]},'threadid':{'type':Sequelize[_0x0db6('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0db6('0x2')]},'leaveAt':{'type':Sequelize[_0x0db6('0x2')]},'bot':{'type':Sequelize[_0x0db6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 95a3d8d..d3f94b3 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 _0x5e1a=['bluebird','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','map','options','SquareReport','includeAll','include','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x5c7dfb,_0x98c594){var _0x2bc8a4=function(_0x42ef5d){while(--_0x42ef5d){_0x5c7dfb['push'](_0x5c7dfb['shift']());}};_0x2bc8a4(++_0x98c594);}(_0x5e1a,0x87));var _0xa5e1=function(_0x86c6cb,_0x30bb53){_0x86c6cb=_0x86c6cb-0x0;var _0x1b1592=_0x5e1a[_0x86c6cb];return _0x1b1592;};'use strict';var emlformat=require(_0xa5e1('0x0'));var rimraf=require(_0xa5e1('0x1'));var zipdir=require(_0xa5e1('0x2'));var jsonpatch=require(_0xa5e1('0x3'));var rp=require('request-promise');var moment=require(_0xa5e1('0x4'));var BPromise=require(_0xa5e1('0x5'));var Mustache=require('mustache');var util=require(_0xa5e1('0x6'));var path=require(_0xa5e1('0x7'));var sox=require(_0xa5e1('0x8'));var csv=require('to-csv');var ejs=require(_0xa5e1('0x9'));var fs=require('fs');var fs_extra=require(_0xa5e1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa5e1('0xb'));var jsforce=require(_0xa5e1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa5e1('0xd'));var querystring=require(_0xa5e1('0xe'));var Papa=require(_0xa5e1('0xf'));var Redis=require(_0xa5e1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa5e1('0x11'));var hardwareService=require(_0xa5e1('0x12'));var logger=require(_0xa5e1('0x13'))('api');var utils=require(_0xa5e1('0x14'));var config=require(_0xa5e1('0x15'));var licenseUtil=require(_0xa5e1('0x16'));var db=require(_0xa5e1('0x17'))['db'];function respondWithStatusCode(_0x2c18e9,_0x51a6b3){_0x51a6b3=_0x51a6b3||0xcc;return function(_0x56da89){if(_0x56da89){return _0x2c18e9['sendStatus'](_0x51a6b3);}return _0x2c18e9[_0xa5e1('0x18')](_0x51a6b3)[_0xa5e1('0x19')]();};}function respondWithResult(_0x37366f,_0x22fb1f){_0x22fb1f=_0x22fb1f||0xc8;return function(_0x2e869f){if(_0x2e869f){return _0x37366f[_0xa5e1('0x18')](_0x22fb1f)[_0xa5e1('0x1a')](_0x2e869f);}};}function respondWithFilteredResult(_0x3cc4ff,_0x37bbde){return function(_0x342be2){if(_0x342be2){var _0x2ddc9b=typeof _0x37bbde[_0xa5e1('0x1b')]===_0xa5e1('0x1c')&&typeof _0x37bbde[_0xa5e1('0x1d')]==='undefined';var _0x47e7ae=_0x342be2[_0xa5e1('0x1e')];var _0x289a84=_0x2ddc9b?0x0:_0x37bbde['offset'];var _0x146bf6=_0x2ddc9b?_0x342be2[_0xa5e1('0x1e')]:_0x37bbde[_0xa5e1('0x1b')]+_0x37bbde[_0xa5e1('0x1d')];var _0x46afa1;if(_0x146bf6>=_0x47e7ae){_0x146bf6=_0x47e7ae;_0x46afa1=0xc8;}else{_0x46afa1=0xce;}_0x3cc4ff['status'](_0x46afa1);return _0x3cc4ff['set'](_0xa5e1('0x1f'),_0x289a84+'-'+_0x146bf6+'/'+_0x47e7ae)[_0xa5e1('0x1a')](_0x342be2);}return null;};}function patchUpdates(_0x1b416d){return function(_0x44e33a){try{jsonpatch['apply'](_0x44e33a,_0x1b416d,!![]);}catch(_0x3060b0){return BPromise[_0xa5e1('0x20')](_0x3060b0);}return _0x44e33a['save']();};}function saveUpdates(_0xd7180c,_0x9de55b){return function(_0x1b3624){if(_0x1b3624){return _0x1b3624[_0xa5e1('0x21')](_0xd7180c)[_0xa5e1('0x22')](function(_0x202d84){return _0x202d84;});}return null;};}function removeEntity(_0x1d64fb,_0x1932a2){return function(_0x2678bc){if(_0x2678bc){return _0x2678bc[_0xa5e1('0x23')]()[_0xa5e1('0x22')](function(){_0x1d64fb[_0xa5e1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dd857,_0x59dd22){return function(_0x34e061){if(!_0x34e061){_0x3dd857['sendStatus'](0x194);}return _0x34e061;};}function handleError(_0x16c9af,_0x1d8b07){_0x1d8b07=_0x1d8b07||0x1f4;return function(_0x25b437){logger[_0xa5e1('0x24')](_0x25b437[_0xa5e1('0x25')]);if(_0x25b437[_0xa5e1('0x26')]){delete _0x25b437[_0xa5e1('0x26')];}_0x16c9af['status'](_0x1d8b07)['send'](_0x25b437);};}exports[_0xa5e1('0x27')]=function(_0x51976a,_0xcad0e){var _0xb41316={},_0x353679={},_0x5813ac={'count':0x0,'rows':[]};var _0x55cb4b=_['map'](db['SquareReport'][_0xa5e1('0x28')],function(_0x1aad8d){return{'name':_0x1aad8d['fieldName'],'type':_0x1aad8d[_0xa5e1('0x29')][_0xa5e1('0x2a')]};});_0x353679[_0xa5e1('0x2b')]=_['map'](_0x55cb4b,_0xa5e1('0x26'));_0x353679[_0xa5e1('0x2c')]=_[_0xa5e1('0x2d')](_0x51976a[_0xa5e1('0x2c')]);_0x353679[_0xa5e1('0x2e')]=_[_0xa5e1('0x2f')](_0x353679[_0xa5e1('0x2b')],_0x353679[_0xa5e1('0x2c')]);_0xb41316[_0xa5e1('0x30')]=_[_0xa5e1('0x2f')](_0x353679[_0xa5e1('0x2b')],qs[_0xa5e1('0x31')](_0x51976a[_0xa5e1('0x2c')][_0xa5e1('0x31')]));_0xb41316[_0xa5e1('0x30')]=_0xb41316[_0xa5e1('0x30')]['length']?_0xb41316['attributes']:_0x353679[_0xa5e1('0x2b')];if(!_0x51976a[_0xa5e1('0x2c')]['hasOwnProperty'](_0xa5e1('0x32'))){_0xb41316[_0xa5e1('0x1d')]=qs['limit'](_0x51976a[_0xa5e1('0x2c')]['limit']);_0xb41316[_0xa5e1('0x1b')]=qs[_0xa5e1('0x1b')](_0x51976a[_0xa5e1('0x2c')][_0xa5e1('0x1b')]);}_0xb41316[_0xa5e1('0x33')]=qs[_0xa5e1('0x34')](_0x51976a[_0xa5e1('0x2c')]['sort']);_0xb41316[_0xa5e1('0x35')]=qs['filters'](_['pick'](_0x51976a[_0xa5e1('0x2c')],_0x353679[_0xa5e1('0x2e')]),_0x55cb4b);if(_0x51976a[_0xa5e1('0x2c')][_0xa5e1('0x36')]){_0xb41316['where']=_[_0xa5e1('0x37')](_0xb41316[_0xa5e1('0x35')],{'$or':_[_0xa5e1('0x38')](_0x55cb4b,function(_0x19e6f9){if(_0x19e6f9[_0xa5e1('0x29')]!=='VIRTUAL'){var _0x40de82={};_0x40de82[_0x19e6f9[_0xa5e1('0x26')]]={'$like':'%'+_0x51976a[_0xa5e1('0x2c')][_0xa5e1('0x36')]+'%'};return _0x40de82;}})});}_0xb41316=_[_0xa5e1('0x37')]({},_0xb41316,_0x51976a[_0xa5e1('0x39')]);var _0x315f8d={'where':_0xb41316[_0xa5e1('0x35')]};return db[_0xa5e1('0x3a')][_0xa5e1('0x1e')](_0x315f8d)['then'](function(_0xb28878){_0x5813ac[_0xa5e1('0x1e')]=_0xb28878;if(_0x51976a[_0xa5e1('0x2c')][_0xa5e1('0x3b')]){_0xb41316[_0xa5e1('0x3c')]=[{'all':!![]}];}return db[_0xa5e1('0x3a')]['findAll'](_0xb41316);})['then'](function(_0x34ffe5){_0x5813ac[_0xa5e1('0x3d')]=_0x34ffe5;return _0x5813ac;})['then'](respondWithFilteredResult(_0xcad0e,_0xb41316))[_0xa5e1('0x3e')](handleError(_0xcad0e,null));};exports[_0xa5e1('0x3f')]=function(_0xa3eab,_0x1b3ac9){var _0x3ec4a9={'raw':!![],'where':{'id':_0xa3eab[_0xa5e1('0x40')]['id']}},_0x203c51={};_0x203c51[_0xa5e1('0x2b')]=_[_0xa5e1('0x2d')](db['SquareReport'][_0xa5e1('0x28')]);_0x203c51['query']=_['keys'](_0xa3eab[_0xa5e1('0x2c')]);_0x203c51[_0xa5e1('0x2e')]=_[_0xa5e1('0x2f')](_0x203c51[_0xa5e1('0x2b')],_0x203c51[_0xa5e1('0x2c')]);_0x3ec4a9[_0xa5e1('0x30')]=_[_0xa5e1('0x2f')](_0x203c51[_0xa5e1('0x2b')],qs[_0xa5e1('0x31')](_0xa3eab[_0xa5e1('0x2c')]['fields']));_0x3ec4a9['attributes']=_0x3ec4a9[_0xa5e1('0x30')][_0xa5e1('0x41')]?_0x3ec4a9[_0xa5e1('0x30')]:_0x203c51[_0xa5e1('0x2b')];if(_0xa3eab[_0xa5e1('0x2c')][_0xa5e1('0x3b')]){_0x3ec4a9['include']=[{'all':!![]}];}_0x3ec4a9=_[_0xa5e1('0x37')]({},_0x3ec4a9,_0xa3eab[_0xa5e1('0x39')]);return db[_0xa5e1('0x3a')][_0xa5e1('0x42')](_0x3ec4a9)['then'](handleEntityNotFound(_0x1b3ac9,null))[_0xa5e1('0x22')](respondWithResult(_0x1b3ac9,null))[_0xa5e1('0x3e')](handleError(_0x1b3ac9,null));};exports[_0xa5e1('0x43')]=function(_0x527630,_0x58f5d2){return db['SquareReport']['create'](_0x527630[_0xa5e1('0x44')],{})[_0xa5e1('0x22')](respondWithResult(_0x58f5d2,0xc9))[_0xa5e1('0x3e')](handleError(_0x58f5d2,null));};exports['update']=function(_0x40b11e,_0x10d26d){if(_0x40b11e[_0xa5e1('0x44')]['id']){delete _0x40b11e[_0xa5e1('0x44')]['id'];}return db[_0xa5e1('0x3a')][_0xa5e1('0x42')]({'where':{'id':_0x40b11e[_0xa5e1('0x40')]['id']}})[_0xa5e1('0x22')](handleEntityNotFound(_0x10d26d,null))['then'](saveUpdates(_0x40b11e[_0xa5e1('0x44')],null))[_0xa5e1('0x22')](respondWithResult(_0x10d26d,null))[_0xa5e1('0x3e')](handleError(_0x10d26d,null));};exports['destroy']=function(_0x34f4e2,_0x2890ab){return db[_0xa5e1('0x3a')][_0xa5e1('0x42')]({'where':{'id':_0x34f4e2['params']['id']}})[_0xa5e1('0x22')](handleEntityNotFound(_0x2890ab,null))[_0xa5e1('0x22')](removeEntity(_0x2890ab,null))[_0xa5e1('0x3e')](handleError(_0x2890ab,null));};exports[_0xa5e1('0x45')]=function(_0x1d8800,_0x2e48d7){return db['SquareReport'][_0xa5e1('0x45')]()[_0xa5e1('0x22')](respondWithResult(_0x2e48d7,null))[_0xa5e1('0x3e')](handleError(_0x2e48d7,null));}; \ No newline at end of file +var _0x7676=['../../config/license/util','../../mysqldb','status','json','limit','undefined','count','set','Content-Range','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareReport','include','findAll','catch','show','params','includeAll','body','describe','eml-format','zip-dir','fast-json-patch','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5d9937,_0x28b174){var _0x55672c=function(_0x3588db){while(--_0x3588db){_0x5d9937['push'](_0x5d9937['shift']());}};_0x55672c(++_0x28b174);}(_0x7676,0xc0));var _0x6767=function(_0x5e3490,_0x1af794){_0x5e3490=_0x5e3490-0x0;var _0x529751=_0x7676[_0x5e3490];return _0x529751;};'use strict';var emlformat=require(_0x6767('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6767('0x1'));var jsonpatch=require(_0x6767('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6767('0x3'));var sox=require(_0x6767('0x4'));var csv=require('to-csv');var ejs=require(_0x6767('0x5'));var fs=require('fs');var fs_extra=require(_0x6767('0x6'));var _=require(_0x6767('0x7'));var squel=require(_0x6767('0x8'));var crypto=require('crypto');var jsforce=require(_0x6767('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x6767('0xa'));var querystring=require(_0x6767('0xb'));var Papa=require(_0x6767('0xc'));var Redis=require('ioredis');var authService=require(_0x6767('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6767('0xe'));var hardwareService=require(_0x6767('0xf'));var logger=require(_0x6767('0x10'))(_0x6767('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6767('0x12'));var db=require(_0x6767('0x13'))['db'];function respondWithStatusCode(_0x2c3cfe,_0x54605f){_0x54605f=_0x54605f||0xcc;return function(_0x370160){if(_0x370160){return _0x2c3cfe['sendStatus'](_0x54605f);}return _0x2c3cfe['status'](_0x54605f)['end']();};}function respondWithResult(_0x5e7560,_0x5dc86f){_0x5dc86f=_0x5dc86f||0xc8;return function(_0x316bd1){if(_0x316bd1){return _0x5e7560[_0x6767('0x14')](_0x5dc86f)[_0x6767('0x15')](_0x316bd1);}};}function respondWithFilteredResult(_0x1c977d,_0x4d5bc8){return function(_0x40f5c0){if(_0x40f5c0){var _0x414251=typeof _0x4d5bc8['offset']==='undefined'&&typeof _0x4d5bc8[_0x6767('0x16')]===_0x6767('0x17');var _0x35e60c=_0x40f5c0['count'];var _0x16d92f=_0x414251?0x0:_0x4d5bc8['offset'];var _0x1d353b=_0x414251?_0x40f5c0[_0x6767('0x18')]:_0x4d5bc8['offset']+_0x4d5bc8[_0x6767('0x16')];var _0x682513;if(_0x1d353b>=_0x35e60c){_0x1d353b=_0x35e60c;_0x682513=0xc8;}else{_0x682513=0xce;}_0x1c977d[_0x6767('0x14')](_0x682513);return _0x1c977d[_0x6767('0x19')](_0x6767('0x1a'),_0x16d92f+'-'+_0x1d353b+'/'+_0x35e60c)[_0x6767('0x15')](_0x40f5c0);}return null;};}function patchUpdates(_0x5995f7){return function(_0x134216){try{jsonpatch['apply'](_0x134216,_0x5995f7,!![]);}catch(_0x4fb4a4){return BPromise['reject'](_0x4fb4a4);}return _0x134216[_0x6767('0x1b')]();};}function saveUpdates(_0x326f48,_0x124d96){return function(_0x1a678e){if(_0x1a678e){return _0x1a678e[_0x6767('0x1c')](_0x326f48)[_0x6767('0x1d')](function(_0x1b0216){return _0x1b0216;});}return null;};}function removeEntity(_0x38a3b8,_0x36f582){return function(_0x218a78){if(_0x218a78){return _0x218a78[_0x6767('0x1e')]()[_0x6767('0x1d')](function(){_0x38a3b8[_0x6767('0x14')](0xcc)[_0x6767('0x1f')]();});}};}function handleEntityNotFound(_0x11fa50,_0x56bd66){return function(_0x72b806){if(!_0x72b806){_0x11fa50[_0x6767('0x20')](0x194);}return _0x72b806;};}function handleError(_0x270d48,_0x487b80){_0x487b80=_0x487b80||0x1f4;return function(_0x24e567){logger[_0x6767('0x21')](_0x24e567[_0x6767('0x22')]);if(_0x24e567[_0x6767('0x23')]){delete _0x24e567['name'];}_0x270d48['status'](_0x487b80)[_0x6767('0x24')](_0x24e567);};}exports[_0x6767('0x25')]=function(_0x508ca3,_0x5d662d){var _0x583e68={},_0x4e3a3e={},_0x5091fb={'count':0x0,'rows':[]};var _0x82be15=_[_0x6767('0x26')](db['SquareReport'][_0x6767('0x27')],function(_0x19c700){return{'name':_0x19c700[_0x6767('0x28')],'type':_0x19c700[_0x6767('0x29')]['key']};});_0x4e3a3e[_0x6767('0x2a')]=_[_0x6767('0x26')](_0x82be15,'name');_0x4e3a3e[_0x6767('0x2b')]=_[_0x6767('0x2c')](_0x508ca3['query']);_0x4e3a3e[_0x6767('0x2d')]=_[_0x6767('0x2e')](_0x4e3a3e[_0x6767('0x2a')],_0x4e3a3e['query']);_0x583e68[_0x6767('0x2f')]=_[_0x6767('0x2e')](_0x4e3a3e[_0x6767('0x2a')],qs[_0x6767('0x30')](_0x508ca3[_0x6767('0x2b')][_0x6767('0x30')]));_0x583e68[_0x6767('0x2f')]=_0x583e68[_0x6767('0x2f')][_0x6767('0x31')]?_0x583e68[_0x6767('0x2f')]:_0x4e3a3e[_0x6767('0x2a')];if(!_0x508ca3[_0x6767('0x2b')][_0x6767('0x32')](_0x6767('0x33'))){_0x583e68[_0x6767('0x16')]=qs[_0x6767('0x16')](_0x508ca3[_0x6767('0x2b')]['limit']);_0x583e68[_0x6767('0x34')]=qs['offset'](_0x508ca3['query'][_0x6767('0x34')]);}_0x583e68[_0x6767('0x35')]=qs[_0x6767('0x36')](_0x508ca3[_0x6767('0x2b')]['sort']);_0x583e68[_0x6767('0x37')]=qs[_0x6767('0x2d')](_[_0x6767('0x38')](_0x508ca3[_0x6767('0x2b')],_0x4e3a3e['filters']),_0x82be15);if(_0x508ca3['query'][_0x6767('0x39')]){_0x583e68[_0x6767('0x37')]=_['merge'](_0x583e68[_0x6767('0x37')],{'$or':_[_0x6767('0x26')](_0x82be15,function(_0x1fd2d9){if(_0x1fd2d9['type']!==_0x6767('0x3a')){var _0x2f2084={};_0x2f2084[_0x1fd2d9['name']]={'$like':'%'+_0x508ca3['query'][_0x6767('0x39')]+'%'};return _0x2f2084;}})});}_0x583e68=_[_0x6767('0x3b')]({},_0x583e68,_0x508ca3[_0x6767('0x3c')]);var _0x3489a8={'where':_0x583e68[_0x6767('0x37')]};return db[_0x6767('0x3d')][_0x6767('0x18')](_0x3489a8)[_0x6767('0x1d')](function(_0x291d38){_0x5091fb[_0x6767('0x18')]=_0x291d38;if(_0x508ca3[_0x6767('0x2b')]['includeAll']){_0x583e68[_0x6767('0x3e')]=[{'all':!![]}];}return db[_0x6767('0x3d')][_0x6767('0x3f')](_0x583e68);})[_0x6767('0x1d')](function(_0x4b963b){_0x5091fb['rows']=_0x4b963b;return _0x5091fb;})[_0x6767('0x1d')](respondWithFilteredResult(_0x5d662d,_0x583e68))[_0x6767('0x40')](handleError(_0x5d662d,null));};exports[_0x6767('0x41')]=function(_0x368f64,_0x2d6f49){var _0x5153d6={'raw':!![],'where':{'id':_0x368f64[_0x6767('0x42')]['id']}},_0x27119a={};_0x27119a[_0x6767('0x2a')]=_[_0x6767('0x2c')](db[_0x6767('0x3d')]['rawAttributes']);_0x27119a['query']=_[_0x6767('0x2c')](_0x368f64[_0x6767('0x2b')]);_0x27119a[_0x6767('0x2d')]=_[_0x6767('0x2e')](_0x27119a[_0x6767('0x2a')],_0x27119a['query']);_0x5153d6['attributes']=_[_0x6767('0x2e')](_0x27119a[_0x6767('0x2a')],qs[_0x6767('0x30')](_0x368f64[_0x6767('0x2b')]['fields']));_0x5153d6[_0x6767('0x2f')]=_0x5153d6[_0x6767('0x2f')][_0x6767('0x31')]?_0x5153d6[_0x6767('0x2f')]:_0x27119a[_0x6767('0x2a')];if(_0x368f64[_0x6767('0x2b')][_0x6767('0x43')]){_0x5153d6[_0x6767('0x3e')]=[{'all':!![]}];}_0x5153d6=_[_0x6767('0x3b')]({},_0x5153d6,_0x368f64[_0x6767('0x3c')]);return db[_0x6767('0x3d')]['find'](_0x5153d6)[_0x6767('0x1d')](handleEntityNotFound(_0x2d6f49,null))['then'](respondWithResult(_0x2d6f49,null))[_0x6767('0x40')](handleError(_0x2d6f49,null));};exports['create']=function(_0x5f4e59,_0x5568f3){return db[_0x6767('0x3d')]['create'](_0x5f4e59[_0x6767('0x44')],{})[_0x6767('0x1d')](respondWithResult(_0x5568f3,0xc9))[_0x6767('0x40')](handleError(_0x5568f3,null));};exports['update']=function(_0x2b2a1c,_0x110510){if(_0x2b2a1c[_0x6767('0x44')]['id']){delete _0x2b2a1c['body']['id'];}return db['SquareReport']['find']({'where':{'id':_0x2b2a1c[_0x6767('0x42')]['id']}})['then'](handleEntityNotFound(_0x110510,null))[_0x6767('0x1d')](saveUpdates(_0x2b2a1c[_0x6767('0x44')],null))['then'](respondWithResult(_0x110510,null))[_0x6767('0x40')](handleError(_0x110510,null));};exports['destroy']=function(_0x1dd117,_0x16df55){return db[_0x6767('0x3d')]['find']({'where':{'id':_0x1dd117[_0x6767('0x42')]['id']}})[_0x6767('0x1d')](handleEntityNotFound(_0x16df55,null))[_0x6767('0x1d')](removeEntity(_0x16df55,null))[_0x6767('0x40')](handleError(_0x16df55,null));};exports['describe']=function(_0x3260db,_0x5cb480){return db[_0x6767('0x3d')][_0x6767('0x45')]()[_0x6767('0x1d')](respondWithResult(_0x5cb480,null))[_0x6767('0x40')](handleError(_0x5cb480,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f53677d..1bbcbde 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 _0x4e58=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util'];(function(_0xc26345,_0x13917e){var _0x482a7c=function(_0x23bdb4){while(--_0x23bdb4){_0xc26345['push'](_0xc26345['shift']());}};_0x482a7c(++_0x13917e);}(_0x4e58,0x97));var _0x84e5=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x4e58[_0x6e1239];return _0x418150;};'use strict';var _=require(_0x84e5('0x0'));var util=require(_0x84e5('0x1'));var logger=require(_0x84e5('0x2'))(_0x84e5('0x3'));var moment=require(_0x84e5('0x4'));var BPromise=require(_0x84e5('0x5'));var rp=require(_0x84e5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84e5('0x7'));var config=require(_0x84e5('0x8'));var attributes=require('./squareReport.attributes');module[_0x84e5('0x9')]=function(_0x439297,_0x355735){return _0x439297[_0x84e5('0xa')](_0x84e5('0xb'),attributes,{'tableName':_0x84e5('0xc'),'paranoid':![],'indexes':[{'name':_0x84e5('0xd'),'fields':[_0x84e5('0xe'),_0x84e5('0xf')]},{'name':_0x84e5('0x10'),'fields':[_0x84e5('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1aa=['report_square','uid_pname','uniqueid','project_name','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x4f9e31,_0x3c713d){var _0x22880e=function(_0x971930){while(--_0x971930){_0x4f9e31['push'](_0x4f9e31['shift']());}};_0x22880e(++_0x3c713d);}(_0xb1aa,0x1c4));var _0xab1a=function(_0x353c9b,_0x963d4b){_0x353c9b=_0x353c9b-0x0;var _0x37b8f4=_0xb1aa[_0x353c9b];return _0x37b8f4;};'use strict';var _=require(_0xab1a('0x0'));var util=require(_0xab1a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xab1a('0x2'));var BPromise=require(_0xab1a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab1a('0x4'));var rimraf=require(_0xab1a('0x5'));var config=require(_0xab1a('0x6'));var attributes=require(_0xab1a('0x7'));module[_0xab1a('0x8')]=function(_0x536c72,_0x4c0c9d){return _0x536c72[_0xab1a('0x9')]('SquareReport',attributes,{'tableName':_0xab1a('0xa'),'paranoid':![],'indexes':[{'name':_0xab1a('0xb'),'fields':[_0xab1a('0xc'),_0xab1a('0xd')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d7cbac7..4f1b085 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 _0x0bf9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','update','attributes','limit','UpdateSquareReport','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36d552,_0x5805de){var _0x4fb7d9=function(_0x298dab){while(--_0x298dab){_0x36d552['push'](_0x36d552['shift']());}};_0x4fb7d9(++_0x5805de);}(_0x0bf9,0xe3));var _0x90bf=function(_0x4a8b6b,_0xd6dc10){_0x4a8b6b=_0x4a8b6b-0x0;var _0x2e14b3=_0x0bf9[_0x4a8b6b];return _0x2e14b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x90bf('0x0'));var rs=require(_0x90bf('0x1'));var fs=require('fs');var Redis=require(_0x90bf('0x2'));var db=require(_0x90bf('0x3'))['db'];var utils=require(_0x90bf('0x4'));var logger=require(_0x90bf('0x5'))(_0x90bf('0x6'));var config=require(_0x90bf('0x7'));var jayson=require(_0x90bf('0x8'));var client=jayson[_0x90bf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2821,_0x314566,_0x3f438e){return new BPromise(function(_0x56baa4,_0x366d79){return client[_0x90bf('0xa')](_0x1a2821,_0x3f438e)[_0x90bf('0xb')](function(_0x59ddef){logger[_0x90bf('0xc')](_0x90bf('0xd'),_0x314566,_0x90bf('0xe'));logger[_0x90bf('0xf')](_0x90bf('0x10'),_0x314566,_0x90bf('0xe'),JSON[_0x90bf('0x11')](_0x59ddef));if(_0x59ddef[_0x90bf('0x12')]){if(_0x59ddef['error'][_0x90bf('0x13')]===0x1f4){logger[_0x90bf('0x12')]('SquareReport,\x20%s,\x20%s',_0x314566,_0x59ddef[_0x90bf('0x12')][_0x90bf('0x14')]);return _0x366d79(_0x59ddef[_0x90bf('0x12')][_0x90bf('0x14')]);}logger[_0x90bf('0x12')]('SquareReport,\x20%s,\x20%s',_0x314566,_0x59ddef[_0x90bf('0x12')][_0x90bf('0x14')]);return _0x56baa4(_0x59ddef[_0x90bf('0x12')][_0x90bf('0x14')]);}else{logger[_0x90bf('0xc')]('SquareReport,\x20%s,\x20%s',_0x314566,_0x90bf('0xe'));_0x56baa4(_0x59ddef[_0x90bf('0x15')][_0x90bf('0x14')]);}})[_0x90bf('0x16')](function(_0x2e3082){logger[_0x90bf('0x12')](_0x90bf('0xd'),_0x314566,_0x2e3082);_0x366d79(_0x2e3082);});});}exports[_0x90bf('0x17')]=function(_0x588565){var _0xcc17c=this;return new Promise(function(_0x141f45,_0xb715b3){return db[_0x90bf('0x18')][_0x90bf('0x19')](_0x588565[_0x90bf('0x1a')],{'raw':_0x588565['options']?_0x588565[_0x90bf('0x1b')][_0x90bf('0x1c')]===undefined?!![]:![]:!![]})[_0x90bf('0xb')](function(_0x4043aa){logger[_0x90bf('0xc')](_0x90bf('0x17'),_0x588565);logger[_0x90bf('0xf')](_0x90bf('0x17'),_0x588565,JSON['stringify'](_0x4043aa));_0x141f45(_0x4043aa);})[_0x90bf('0x16')](function(_0x1d0e1f){logger[_0x90bf('0x12')](_0x90bf('0x17'),_0x1d0e1f[_0x90bf('0x14')],_0x588565);_0xb715b3(_0xcc17c[_0x90bf('0x12')](0x1f4,_0x1d0e1f[_0x90bf('0x14')]));});});};exports['UpdateSquareReport']=function(_0x52b51f){var _0xd9f98=this;return new Promise(function(_0xc486f4,_0x4c74f4){return db['SquareReport'][_0x90bf('0x1d')](_0x52b51f[_0x90bf('0x1a')],{'raw':_0x52b51f[_0x90bf('0x1b')]?_0x52b51f[_0x90bf('0x1b')][_0x90bf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52b51f[_0x90bf('0x1b')]?_0x52b51f[_0x90bf('0x1b')]['where']||null:null,'attributes':_0x52b51f[_0x90bf('0x1b')]?_0x52b51f[_0x90bf('0x1b')][_0x90bf('0x1e')]||null:null,'limit':_0x52b51f[_0x90bf('0x1b')]?_0x52b51f['options'][_0x90bf('0x1f')]||null:null})[_0x90bf('0xb')](function(_0x2842cf){logger[_0x90bf('0xc')](_0x90bf('0x20'),_0x52b51f);logger['debug'](_0x90bf('0x20'),_0x52b51f,JSON[_0x90bf('0x11')](_0x2842cf));_0xc486f4(_0x2842cf);})[_0x90bf('0x16')](function(_0x11a539){logger[_0x90bf('0x12')](_0x90bf('0x20'),_0x11a539[_0x90bf('0x14')],_0x52b51f);_0x4c74f4(_0xd9f98[_0x90bf('0x12')](0x1f4,_0x11a539['message']));});});}; \ No newline at end of file +var _0xda16=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','options','raw','then','UpdateSquareReport','where'];(function(_0x2a3152,_0x1eb070){var _0x51f2c6=function(_0x12c4a0){while(--_0x12c4a0){_0x2a3152['push'](_0x2a3152['shift']());}};_0x51f2c6(++_0x1eb070);}(_0xda16,0xd4));var _0x6da1=function(_0x1cc1e3,_0x4598a4){_0x1cc1e3=_0x1cc1e3-0x0;var _0x2843cc=_0xda16[_0x1cc1e3];return _0x2843cc;};'use strict';var _=require(_0x6da1('0x0'));var util=require(_0x6da1('0x1'));var moment=require(_0x6da1('0x2'));var BPromise=require(_0x6da1('0x3'));var rs=require(_0x6da1('0x4'));var fs=require('fs');var Redis=require(_0x6da1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6da1('0x6'))('rpc');var config=require(_0x6da1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6da1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27b748,_0x564aaa,_0x29dc03){return new BPromise(function(_0x465d97,_0x499f3a){return client[_0x6da1('0x9')](_0x27b748,_0x29dc03)['then'](function(_0x5b4d62){logger[_0x6da1('0xa')]('SquareReport,\x20%s,\x20%s',_0x564aaa,_0x6da1('0xb'));logger[_0x6da1('0xc')](_0x6da1('0xd'),_0x564aaa,_0x6da1('0xb'),JSON[_0x6da1('0xe')](_0x5b4d62));if(_0x5b4d62[_0x6da1('0xf')]){if(_0x5b4d62[_0x6da1('0xf')][_0x6da1('0x10')]===0x1f4){logger['error'](_0x6da1('0x11'),_0x564aaa,_0x5b4d62[_0x6da1('0xf')][_0x6da1('0x12')]);return _0x499f3a(_0x5b4d62[_0x6da1('0xf')][_0x6da1('0x12')]);}logger[_0x6da1('0xf')](_0x6da1('0x11'),_0x564aaa,_0x5b4d62['error'][_0x6da1('0x12')]);return _0x465d97(_0x5b4d62[_0x6da1('0xf')][_0x6da1('0x12')]);}else{logger[_0x6da1('0xa')](_0x6da1('0x11'),_0x564aaa,_0x6da1('0xb'));_0x465d97(_0x5b4d62[_0x6da1('0x13')][_0x6da1('0x12')]);}})[_0x6da1('0x14')](function(_0x397630){logger[_0x6da1('0xf')](_0x6da1('0x11'),_0x564aaa,_0x397630);_0x499f3a(_0x397630);});});}exports[_0x6da1('0x15')]=function(_0x34abf1){var _0x1a7ba8=this;return new Promise(function(_0x1b8c12,_0x273dda){return db[_0x6da1('0x16')]['create'](_0x34abf1['body'],{'raw':_0x34abf1['options']?_0x34abf1[_0x6da1('0x17')][_0x6da1('0x18')]===undefined?!![]:![]:!![]})[_0x6da1('0x19')](function(_0x1035aa){logger[_0x6da1('0xa')](_0x6da1('0x15'),_0x34abf1);logger['debug'](_0x6da1('0x15'),_0x34abf1,JSON[_0x6da1('0xe')](_0x1035aa));_0x1b8c12(_0x1035aa);})[_0x6da1('0x14')](function(_0x1d54a2){logger['error'](_0x6da1('0x15'),_0x1d54a2[_0x6da1('0x12')],_0x34abf1);_0x273dda(_0x1a7ba8[_0x6da1('0xf')](0x1f4,_0x1d54a2[_0x6da1('0x12')]));});});};exports[_0x6da1('0x1a')]=function(_0x18996f){var _0x1fa2eb=this;return new Promise(function(_0x104b10,_0x3c19ed){return db['SquareReport']['update'](_0x18996f['body'],{'raw':_0x18996f[_0x6da1('0x17')]?_0x18996f['options'][_0x6da1('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18996f[_0x6da1('0x17')]?_0x18996f[_0x6da1('0x17')][_0x6da1('0x1b')]||null:null,'attributes':_0x18996f[_0x6da1('0x17')]?_0x18996f[_0x6da1('0x17')][_0x6da1('0x1c')]||null:null,'limit':_0x18996f['options']?_0x18996f['options'][_0x6da1('0x1d')]||null:null})[_0x6da1('0x19')](function(_0x56d253){logger[_0x6da1('0xa')](_0x6da1('0x1a'),_0x18996f);logger['debug'](_0x6da1('0x1a'),_0x18996f,JSON[_0x6da1('0xe')](_0x56d253));_0x104b10(_0x56d253);})[_0x6da1('0x14')](function(_0x524c03){logger[_0x6da1('0xf')](_0x6da1('0x1a'),_0x524c03['message'],_0x18996f);_0x3c19ed(_0x1fa2eb[_0x6da1('0xf')](0x1f4,_0x524c03['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 44d5176..91d1eb3 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 _0xd3bb=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','path'];(function(_0xae6a27,_0x12108f){var _0x34c913=function(_0x3cd129){while(--_0x3cd129){_0xae6a27['push'](_0xae6a27['shift']());}};_0x34c913(++_0x12108f);}(_0xd3bb,0xbd));var _0xbd3b=function(_0x53dac6,_0x531fc3){_0x53dac6=_0x53dac6-0x0;var _0x32dd43=_0xd3bb[_0x53dac6];return _0x32dd43;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbd3b('0x0'));var timeout=require(_0xbd3b('0x1'));var express=require(_0xbd3b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd3b('0x3'));var interaction=require(_0xbd3b('0x4'));var config=require('../../config/environment');var controller=require(_0xbd3b('0x5'));router[_0xbd3b('0x6')]('/',auth[_0xbd3b('0x7')](),controller[_0xbd3b('0x8')]);router[_0xbd3b('0x6')](_0xbd3b('0x9'),auth[_0xbd3b('0x7')](),controller[_0xbd3b('0xa')]);router[_0xbd3b('0x6')](_0xbd3b('0xb'),auth[_0xbd3b('0x7')](),controller[_0xbd3b('0xc')]);router[_0xbd3b('0xd')]('/',auth[_0xbd3b('0x7')](),controller[_0xbd3b('0xe')]);router['put'](_0xbd3b('0xb'),auth['isAuthenticated'](),controller[_0xbd3b('0xf')]);router[_0xbd3b('0x10')](_0xbd3b('0xb'),auth[_0xbd3b('0x7')](),controller[_0xbd3b('0x11')]);module[_0xbd3b('0x12')]=router; \ No newline at end of file +var _0x1676=['isAuthenticated','index','/describe','/:id','create','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x1676,0x16d));var _0x6167=function(_0x53721a,_0x474e0f){_0x53721a=_0x53721a-0x0;var _0x46dc81=_0x1676[_0x53721a];return _0x46dc81;};'use strict';var multer=require(_0x6167('0x0'));var util=require(_0x6167('0x1'));var path=require('path');var timeout=require(_0x6167('0x2'));var express=require(_0x6167('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6167('0x4'));var interaction=require(_0x6167('0x5'));var config=require(_0x6167('0x6'));var controller=require(_0x6167('0x7'));router[_0x6167('0x8')]('/',auth[_0x6167('0x9')](),controller[_0x6167('0xa')]);router[_0x6167('0x8')](_0x6167('0xb'),auth[_0x6167('0x9')](),controller['describe']);router[_0x6167('0x8')](_0x6167('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6167('0x9')](),controller[_0x6167('0xd')]);router[_0x6167('0xe')](_0x6167('0xc'),auth[_0x6167('0x9')](),controller['update']);router[_0x6167('0xf')](_0x6167('0xc'),auth[_0x6167('0x9')](),controller['destroy']);module[_0x6167('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4a934b6..91af5d9 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 _0x1120=['exports','STRING','sequelize'];(function(_0x609e41,_0x299cdc){var _0x4f30a0=function(_0xe1bf48){while(--_0xe1bf48){_0x609e41['push'](_0x609e41['shift']());}};_0x4f30a0(++_0x299cdc);}(_0x1120,0x140));var _0x0112=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x1120[_0xd7b0a4];return _0x184e9e;};'use strict';var Sequelize=require(_0x0112('0x0'));module[_0x0112('0x1')]={'uniqueid':{'type':Sequelize[_0x0112('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0112('0x2')]}}; \ No newline at end of file +var _0x5b2d=['exports','STRING','TEXT','sequelize'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0x5b2d,0x17f));var _0xd5b2=function(_0x980af9,_0x463080){_0x980af9=_0x980af9-0x0;var _0x2d5487=_0x5b2d[_0x980af9];return _0x2d5487;};'use strict';var Sequelize=require(_0xd5b2('0x0'));module[_0xd5b2('0x1')]={'uniqueid':{'type':Sequelize[_0xd5b2('0x2')]},'node':{'type':Sequelize[_0xd5b2('0x2')]},'application':{'type':Sequelize[_0xd5b2('0x2')]},'data':{'type':Sequelize[_0xd5b2('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 7d43edd..08125f6 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 _0x8c0f=['params','keys','length','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','type','VIRTUAL','SquareDetailsReport','count','includeAll','catch','show'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x8c0f,0x129));var _0xf8c0=function(_0x377847,_0x2e2de7){_0x377847=_0x377847-0x0;var _0x279026=_0x8c0f[_0x377847];return _0x279026;};'use strict';var emlformat=require(_0xf8c0('0x0'));var rimraf=require(_0xf8c0('0x1'));var zipdir=require(_0xf8c0('0x2'));var jsonpatch=require(_0xf8c0('0x3'));var rp=require(_0xf8c0('0x4'));var moment=require(_0xf8c0('0x5'));var BPromise=require(_0xf8c0('0x6'));var Mustache=require('mustache');var util=require(_0xf8c0('0x7'));var path=require(_0xf8c0('0x8'));var sox=require(_0xf8c0('0x9'));var csv=require(_0xf8c0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8c0('0xb'));var _=require(_0xf8c0('0xc'));var squel=require(_0xf8c0('0xd'));var crypto=require(_0xf8c0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf8c0('0xf'));var toCsv=require(_0xf8c0('0xa'));var querystring=require(_0xf8c0('0x10'));var Papa=require('papaparse');var Redis=require(_0xf8c0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf8c0('0x12'));var as=require(_0xf8c0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8c0('0x14'))(_0xf8c0('0x15'));var utils=require(_0xf8c0('0x16'));var config=require(_0xf8c0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x267cf9,_0x50e6bb){_0x50e6bb=_0x50e6bb||0xcc;return function(_0x42b93b){if(_0x42b93b){return _0x267cf9[_0xf8c0('0x18')](_0x50e6bb);}return _0x267cf9[_0xf8c0('0x19')](_0x50e6bb)[_0xf8c0('0x1a')]();};}function respondWithResult(_0x267fa4,_0x342210){_0x342210=_0x342210||0xc8;return function(_0x41d9b7){if(_0x41d9b7){return _0x267fa4[_0xf8c0('0x19')](_0x342210)['json'](_0x41d9b7);}};}function respondWithFilteredResult(_0x2d1c52,_0x123405){return function(_0x4b3601){if(_0x4b3601){var _0x43e37c=typeof _0x123405['offset']===_0xf8c0('0x1b')&&typeof _0x123405[_0xf8c0('0x1c')]===_0xf8c0('0x1b');var _0x269c7a=_0x4b3601['count'];var _0x383a63=_0x43e37c?0x0:_0x123405['offset'];var _0x590265=_0x43e37c?_0x4b3601['count']:_0x123405['offset']+_0x123405['limit'];var _0x27e0ee;if(_0x590265>=_0x269c7a){_0x590265=_0x269c7a;_0x27e0ee=0xc8;}else{_0x27e0ee=0xce;}_0x2d1c52[_0xf8c0('0x19')](_0x27e0ee);return _0x2d1c52['set']('Content-Range',_0x383a63+'-'+_0x590265+'/'+_0x269c7a)['json'](_0x4b3601);}return null;};}function patchUpdates(_0xa9ce98){return function(_0xd3b651){try{jsonpatch[_0xf8c0('0x1d')](_0xd3b651,_0xa9ce98,!![]);}catch(_0x6bb525){return BPromise[_0xf8c0('0x1e')](_0x6bb525);}return _0xd3b651[_0xf8c0('0x1f')]();};}function saveUpdates(_0x4ba157,_0x4e6e86){return function(_0x53bfae){if(_0x53bfae){return _0x53bfae[_0xf8c0('0x20')](_0x4ba157)[_0xf8c0('0x21')](function(_0x31afdf){return _0x31afdf;});}return null;};}function removeEntity(_0xce4311,_0x2b4589){return function(_0x1302b7){if(_0x1302b7){return _0x1302b7[_0xf8c0('0x22')]()[_0xf8c0('0x21')](function(){_0xce4311[_0xf8c0('0x19')](0xcc)[_0xf8c0('0x1a')]();});}};}function handleEntityNotFound(_0x4136bf,_0x56cea4){return function(_0x386702){if(!_0x386702){_0x4136bf[_0xf8c0('0x18')](0x194);}return _0x386702;};}function handleError(_0x19e76f,_0x3ec5c4){_0x3ec5c4=_0x3ec5c4||0x1f4;return function(_0x39e029){logger[_0xf8c0('0x23')](_0x39e029[_0xf8c0('0x24')]);if(_0x39e029[_0xf8c0('0x25')]){delete _0x39e029[_0xf8c0('0x25')];}_0x19e76f[_0xf8c0('0x19')](_0x3ec5c4)[_0xf8c0('0x26')](_0x39e029);};}exports['index']=function(_0x45f0bb,_0x190eae){var _0x3fa7e6={},_0x239083={},_0x3c8f6f={'count':0x0,'rows':[]};var _0x49d67f=_[_0xf8c0('0x27')](db['SquareDetailsReport'][_0xf8c0('0x28')],function(_0x5c4c59){return{'name':_0x5c4c59['fieldName'],'type':_0x5c4c59['type'][_0xf8c0('0x29')]};});_0x239083['model']=_[_0xf8c0('0x27')](_0x49d67f,'name');_0x239083[_0xf8c0('0x2a')]=_['keys'](_0x45f0bb[_0xf8c0('0x2a')]);_0x239083[_0xf8c0('0x2b')]=_[_0xf8c0('0x2c')](_0x239083[_0xf8c0('0x2d')],_0x239083[_0xf8c0('0x2a')]);_0x3fa7e6[_0xf8c0('0x2e')]=_[_0xf8c0('0x2c')](_0x239083[_0xf8c0('0x2d')],qs['fields'](_0x45f0bb[_0xf8c0('0x2a')][_0xf8c0('0x2f')]));_0x3fa7e6[_0xf8c0('0x2e')]=_0x3fa7e6['attributes']['length']?_0x3fa7e6[_0xf8c0('0x2e')]:_0x239083[_0xf8c0('0x2d')];if(!_0x45f0bb[_0xf8c0('0x2a')][_0xf8c0('0x30')](_0xf8c0('0x31'))){_0x3fa7e6[_0xf8c0('0x1c')]=qs['limit'](_0x45f0bb[_0xf8c0('0x2a')]['limit']);_0x3fa7e6[_0xf8c0('0x32')]=qs[_0xf8c0('0x32')](_0x45f0bb[_0xf8c0('0x2a')][_0xf8c0('0x32')]);}_0x3fa7e6[_0xf8c0('0x33')]=qs['sort'](_0x45f0bb[_0xf8c0('0x2a')]['sort']);_0x3fa7e6[_0xf8c0('0x34')]=qs[_0xf8c0('0x2b')](_[_0xf8c0('0x35')](_0x45f0bb[_0xf8c0('0x2a')],_0x239083[_0xf8c0('0x2b')]),_0x49d67f);if(_0x45f0bb['query'][_0xf8c0('0x36')]){_0x3fa7e6[_0xf8c0('0x34')]=_[_0xf8c0('0x37')](_0x3fa7e6[_0xf8c0('0x34')],{'$or':_[_0xf8c0('0x27')](_0x49d67f,function(_0x56e61e){if(_0x56e61e[_0xf8c0('0x38')]!==_0xf8c0('0x39')){var _0x2b7945={};_0x2b7945[_0x56e61e['name']]={'$like':'%'+_0x45f0bb['query'][_0xf8c0('0x36')]+'%'};return _0x2b7945;}})});}_0x3fa7e6=_[_0xf8c0('0x37')]({},_0x3fa7e6,_0x45f0bb['options']);var _0x19f346={'where':_0x3fa7e6[_0xf8c0('0x34')]};return db[_0xf8c0('0x3a')]['count'](_0x19f346)[_0xf8c0('0x21')](function(_0x2f9a96){_0x3c8f6f[_0xf8c0('0x3b')]=_0x2f9a96;if(_0x45f0bb['query'][_0xf8c0('0x3c')]){_0x3fa7e6['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x3fa7e6);})[_0xf8c0('0x21')](function(_0x3e0948){_0x3c8f6f['rows']=_0x3e0948;return _0x3c8f6f;})[_0xf8c0('0x21')](respondWithFilteredResult(_0x190eae,_0x3fa7e6))[_0xf8c0('0x3d')](handleError(_0x190eae,null));};exports[_0xf8c0('0x3e')]=function(_0x3e8634,_0x1285ad){var _0x2e9e23={'raw':!![],'where':{'id':_0x3e8634[_0xf8c0('0x3f')]['id']}},_0x3866a2={};_0x3866a2[_0xf8c0('0x2d')]=_['keys'](db[_0xf8c0('0x3a')]['rawAttributes']);_0x3866a2[_0xf8c0('0x2a')]=_[_0xf8c0('0x40')](_0x3e8634['query']);_0x3866a2[_0xf8c0('0x2b')]=_[_0xf8c0('0x2c')](_0x3866a2[_0xf8c0('0x2d')],_0x3866a2['query']);_0x2e9e23['attributes']=_[_0xf8c0('0x2c')](_0x3866a2[_0xf8c0('0x2d')],qs[_0xf8c0('0x2f')](_0x3e8634[_0xf8c0('0x2a')]['fields']));_0x2e9e23[_0xf8c0('0x2e')]=_0x2e9e23[_0xf8c0('0x2e')][_0xf8c0('0x41')]?_0x2e9e23[_0xf8c0('0x2e')]:_0x3866a2['model'];if(_0x3e8634[_0xf8c0('0x2a')][_0xf8c0('0x3c')]){_0x2e9e23[_0xf8c0('0x42')]=[{'all':!![]}];}_0x2e9e23=_[_0xf8c0('0x37')]({},_0x2e9e23,_0x3e8634[_0xf8c0('0x43')]);return db[_0xf8c0('0x3a')][_0xf8c0('0x44')](_0x2e9e23)[_0xf8c0('0x21')](handleEntityNotFound(_0x1285ad,null))['then'](respondWithResult(_0x1285ad,null))[_0xf8c0('0x3d')](handleError(_0x1285ad,null));};exports[_0xf8c0('0x45')]=function(_0x4bf08c,_0x2f925e){return db[_0xf8c0('0x3a')][_0xf8c0('0x45')](_0x4bf08c[_0xf8c0('0x46')],{})['then'](respondWithResult(_0x2f925e,0xc9))[_0xf8c0('0x3d')](handleError(_0x2f925e,null));};exports[_0xf8c0('0x20')]=function(_0x16de60,_0x27e77d){if(_0x16de60['body']['id']){delete _0x16de60[_0xf8c0('0x46')]['id'];}return db[_0xf8c0('0x3a')][_0xf8c0('0x44')]({'where':{'id':_0x16de60[_0xf8c0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x27e77d,null))['then'](saveUpdates(_0x16de60['body'],null))[_0xf8c0('0x21')](respondWithResult(_0x27e77d,null))['catch'](handleError(_0x27e77d,null));};exports[_0xf8c0('0x22')]=function(_0x555305,_0xcaa5b3){return db[_0xf8c0('0x3a')][_0xf8c0('0x44')]({'where':{'id':_0x555305[_0xf8c0('0x3f')]['id']}})['then'](handleEntityNotFound(_0xcaa5b3,null))[_0xf8c0('0x21')](removeEntity(_0xcaa5b3,null))['catch'](handleError(_0xcaa5b3,null));};exports['describe']=function(_0x2c892e,_0x437f44){return db[_0xf8c0('0x3a')][_0xf8c0('0x47')]()[_0xf8c0('0x21')](respondWithResult(_0x437f44,null))['catch'](handleError(_0x437f44,null));}; \ No newline at end of file +var _0x5181=['save','then','sendStatus','error','stack','name','send','map','SquareDetailsReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','catch','create','body','update','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','limit','undefined','offset','status','Content-Range','apply'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x5181,0x19a));var _0x1518=function(_0x44f470,_0x74d1a8){_0x44f470=_0x44f470-0x0;var _0x54f0f5=_0x5181[_0x44f470];return _0x54f0f5;};'use strict';var emlformat=require(_0x1518('0x0'));var rimraf=require(_0x1518('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1518('0x2'));var rp=require(_0x1518('0x3'));var moment=require(_0x1518('0x4'));var BPromise=require(_0x1518('0x5'));var Mustache=require(_0x1518('0x6'));var util=require(_0x1518('0x7'));var path=require(_0x1518('0x8'));var sox=require(_0x1518('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1518('0xa'));var _=require(_0x1518('0xb'));var squel=require('squel');var crypto=require(_0x1518('0xc'));var jsforce=require(_0x1518('0xd'));var deskjs=require(_0x1518('0xe'));var toCsv=require(_0x1518('0xf'));var querystring=require(_0x1518('0x10'));var Papa=require(_0x1518('0x11'));var Redis=require(_0x1518('0x12'));var authService=require(_0x1518('0x13'));var qs=require(_0x1518('0x14'));var as=require(_0x1518('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1518('0x16'))('api');var utils=require(_0x1518('0x17'));var config=require(_0x1518('0x18'));var licenseUtil=require(_0x1518('0x19'));var db=require(_0x1518('0x1a'))['db'];function respondWithStatusCode(_0x19a13a,_0x5850f4){_0x5850f4=_0x5850f4||0xcc;return function(_0x57e056){if(_0x57e056){return _0x19a13a['sendStatus'](_0x5850f4);}return _0x19a13a['status'](_0x5850f4)[_0x1518('0x1b')]();};}function respondWithResult(_0xd601cf,_0x3d99b1){_0x3d99b1=_0x3d99b1||0xc8;return function(_0x124de9){if(_0x124de9){return _0xd601cf['status'](_0x3d99b1)['json'](_0x124de9);}};}function respondWithFilteredResult(_0x5f427a,_0x1e1a51){return function(_0x18a2f2){if(_0x18a2f2){var _0x4f0466=typeof _0x1e1a51['offset']==='undefined'&&typeof _0x1e1a51[_0x1518('0x1c')]===_0x1518('0x1d');var _0xd86fd0=_0x18a2f2['count'];var _0x2a9fed=_0x4f0466?0x0:_0x1e1a51[_0x1518('0x1e')];var _0x54c8a5=_0x4f0466?_0x18a2f2['count']:_0x1e1a51[_0x1518('0x1e')]+_0x1e1a51[_0x1518('0x1c')];var _0x54fd38;if(_0x54c8a5>=_0xd86fd0){_0x54c8a5=_0xd86fd0;_0x54fd38=0xc8;}else{_0x54fd38=0xce;}_0x5f427a[_0x1518('0x1f')](_0x54fd38);return _0x5f427a['set'](_0x1518('0x20'),_0x2a9fed+'-'+_0x54c8a5+'/'+_0xd86fd0)['json'](_0x18a2f2);}return null;};}function patchUpdates(_0x1b7399){return function(_0x4452da){try{jsonpatch[_0x1518('0x21')](_0x4452da,_0x1b7399,!![]);}catch(_0x288707){return BPromise['reject'](_0x288707);}return _0x4452da[_0x1518('0x22')]();};}function saveUpdates(_0x3a866b,_0x4584b0){return function(_0xe8736a){if(_0xe8736a){return _0xe8736a['update'](_0x3a866b)[_0x1518('0x23')](function(_0x5a816b){return _0x5a816b;});}return null;};}function removeEntity(_0xfcf2f0,_0x556b93){return function(_0x3148a6){if(_0x3148a6){return _0x3148a6['destroy']()[_0x1518('0x23')](function(){_0xfcf2f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x867841,_0x19df7f){return function(_0x57d5bf){if(!_0x57d5bf){_0x867841[_0x1518('0x24')](0x194);}return _0x57d5bf;};}function handleError(_0x3a3513,_0x946e5b){_0x946e5b=_0x946e5b||0x1f4;return function(_0x533ac3){logger[_0x1518('0x25')](_0x533ac3[_0x1518('0x26')]);if(_0x533ac3[_0x1518('0x27')]){delete _0x533ac3[_0x1518('0x27')];}_0x3a3513['status'](_0x946e5b)[_0x1518('0x28')](_0x533ac3);};}exports['index']=function(_0x2d0d10,_0xcd6d1b){var _0x45444={},_0x5f3ed9={},_0x47d2da={'count':0x0,'rows':[]};var _0x26a643=_[_0x1518('0x29')](db[_0x1518('0x2a')][_0x1518('0x2b')],function(_0x701f69){return{'name':_0x701f69['fieldName'],'type':_0x701f69[_0x1518('0x2c')]['key']};});_0x5f3ed9[_0x1518('0x2d')]=_[_0x1518('0x29')](_0x26a643,_0x1518('0x27'));_0x5f3ed9[_0x1518('0x2e')]=_[_0x1518('0x2f')](_0x2d0d10['query']);_0x5f3ed9[_0x1518('0x30')]=_[_0x1518('0x31')](_0x5f3ed9[_0x1518('0x2d')],_0x5f3ed9[_0x1518('0x2e')]);_0x45444['attributes']=_['intersection'](_0x5f3ed9['model'],qs[_0x1518('0x32')](_0x2d0d10[_0x1518('0x2e')]['fields']));_0x45444['attributes']=_0x45444[_0x1518('0x33')][_0x1518('0x34')]?_0x45444[_0x1518('0x33')]:_0x5f3ed9[_0x1518('0x2d')];if(!_0x2d0d10[_0x1518('0x2e')][_0x1518('0x35')](_0x1518('0x36'))){_0x45444[_0x1518('0x1c')]=qs[_0x1518('0x1c')](_0x2d0d10[_0x1518('0x2e')][_0x1518('0x1c')]);_0x45444[_0x1518('0x1e')]=qs['offset'](_0x2d0d10['query']['offset']);}_0x45444['order']=qs['sort'](_0x2d0d10[_0x1518('0x2e')][_0x1518('0x37')]);_0x45444[_0x1518('0x38')]=qs[_0x1518('0x30')](_['pick'](_0x2d0d10[_0x1518('0x2e')],_0x5f3ed9[_0x1518('0x30')]),_0x26a643);if(_0x2d0d10['query'][_0x1518('0x39')]){_0x45444['where']=_['merge'](_0x45444['where'],{'$or':_[_0x1518('0x29')](_0x26a643,function(_0x40d3a0){if(_0x40d3a0[_0x1518('0x2c')]!==_0x1518('0x3a')){var _0x45a16a={};_0x45a16a[_0x40d3a0[_0x1518('0x27')]]={'$like':'%'+_0x2d0d10['query'][_0x1518('0x39')]+'%'};return _0x45a16a;}})});}_0x45444=_[_0x1518('0x3b')]({},_0x45444,_0x2d0d10[_0x1518('0x3c')]);var _0x1194b9={'where':_0x45444['where']};return db[_0x1518('0x2a')]['count'](_0x1194b9)[_0x1518('0x23')](function(_0x3ba725){_0x47d2da[_0x1518('0x3d')]=_0x3ba725;if(_0x2d0d10['query'][_0x1518('0x3e')]){_0x45444[_0x1518('0x3f')]=[{'all':!![]}];}return db[_0x1518('0x2a')]['findAll'](_0x45444);})['then'](function(_0x122b50){_0x47d2da[_0x1518('0x40')]=_0x122b50;return _0x47d2da;})[_0x1518('0x23')](respondWithFilteredResult(_0xcd6d1b,_0x45444))['catch'](handleError(_0xcd6d1b,null));};exports[_0x1518('0x41')]=function(_0x21070d,_0x416b7a){var _0x2ac678={'raw':!![],'where':{'id':_0x21070d[_0x1518('0x42')]['id']}},_0x2d8cb7={};_0x2d8cb7[_0x1518('0x2d')]=_[_0x1518('0x2f')](db[_0x1518('0x2a')]['rawAttributes']);_0x2d8cb7['query']=_[_0x1518('0x2f')](_0x21070d['query']);_0x2d8cb7['filters']=_[_0x1518('0x31')](_0x2d8cb7[_0x1518('0x2d')],_0x2d8cb7[_0x1518('0x2e')]);_0x2ac678[_0x1518('0x33')]=_['intersection'](_0x2d8cb7[_0x1518('0x2d')],qs['fields'](_0x21070d[_0x1518('0x2e')]['fields']));_0x2ac678['attributes']=_0x2ac678[_0x1518('0x33')][_0x1518('0x34')]?_0x2ac678[_0x1518('0x33')]:_0x2d8cb7['model'];if(_0x21070d[_0x1518('0x2e')][_0x1518('0x3e')]){_0x2ac678[_0x1518('0x3f')]=[{'all':!![]}];}_0x2ac678=_[_0x1518('0x3b')]({},_0x2ac678,_0x21070d['options']);return db[_0x1518('0x2a')]['find'](_0x2ac678)[_0x1518('0x23')](handleEntityNotFound(_0x416b7a,null))['then'](respondWithResult(_0x416b7a,null))[_0x1518('0x43')](handleError(_0x416b7a,null));};exports[_0x1518('0x44')]=function(_0x2111fd,_0x5b6eb4){return db[_0x1518('0x2a')][_0x1518('0x44')](_0x2111fd[_0x1518('0x45')],{})[_0x1518('0x23')](respondWithResult(_0x5b6eb4,0xc9))[_0x1518('0x43')](handleError(_0x5b6eb4,null));};exports[_0x1518('0x46')]=function(_0x657b50,_0x320fed){if(_0x657b50[_0x1518('0x45')]['id']){delete _0x657b50['body']['id'];}return db[_0x1518('0x2a')][_0x1518('0x47')]({'where':{'id':_0x657b50[_0x1518('0x42')]['id']}})[_0x1518('0x23')](handleEntityNotFound(_0x320fed,null))['then'](saveUpdates(_0x657b50['body'],null))[_0x1518('0x23')](respondWithResult(_0x320fed,null))[_0x1518('0x43')](handleError(_0x320fed,null));};exports[_0x1518('0x48')]=function(_0x339b9c,_0x30717a){return db[_0x1518('0x2a')][_0x1518('0x47')]({'where':{'id':_0x339b9c[_0x1518('0x42')]['id']}})[_0x1518('0x23')](handleEntityNotFound(_0x30717a,null))[_0x1518('0x23')](removeEntity(_0x30717a,null))['catch'](handleError(_0x30717a,null));};exports[_0x1518('0x49')]=function(_0x2e780f,_0x5a2cdf){return db[_0x1518('0x2a')]['describe']()[_0x1518('0x23')](respondWithResult(_0x5a2cdf,null))[_0x1518('0x43')](handleError(_0x5a2cdf,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 36c6c83..03f54fd 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 _0x55c2=['api','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0x2afeff,_0x1b524){var _0x411a33=function(_0x384a58){while(--_0x384a58){_0x2afeff['push'](_0x2afeff['shift']());}};_0x411a33(++_0x1b524);}(_0x55c2,0x128));var _0x255c=function(_0x367bad,_0x1eea19){_0x367bad=_0x367bad-0x0;var _0x3a99d3=_0x55c2[_0x367bad];return _0x3a99d3;};'use strict';var _=require(_0x255c('0x0'));var util=require(_0x255c('0x1'));var logger=require(_0x255c('0x2'))(_0x255c('0x3'));var moment=require('moment');var BPromise=require(_0x255c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x255c('0x5'));var rimraf=require(_0x255c('0x6'));var config=require(_0x255c('0x7'));var attributes=require(_0x255c('0x8'));module[_0x255c('0x9')]=function(_0x1a3e7a,_0x528dea){return _0x1a3e7a[_0x255c('0xa')](_0x255c('0xb'),attributes,{'tableName':_0x255c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe206=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x49b71c,_0x54176f){var _0x2afb0e=function(_0x25b3bf){while(--_0x25b3bf){_0x49b71c['push'](_0x49b71c['shift']());}};_0x2afb0e(++_0x54176f);}(_0xe206,0xa4));var _0x6e20=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xe206[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0x6e20('0x0'));var util=require(_0x6e20('0x1'));var logger=require(_0x6e20('0x2'))('api');var moment=require(_0x6e20('0x3'));var BPromise=require('bluebird');var rp=require(_0x6e20('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e20('0x5'));var config=require('../../config/environment');var attributes=require(_0x6e20('0x6'));module[_0x6e20('0x7')]=function(_0x1fd06e,_0x4b6d8d){return _0x1fd06e[_0x6e20('0x8')](_0x6e20('0x9'),attributes,{'tableName':'report_square_details','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 c82ef63..f4f25ae 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 _0xcf66=['body','options','raw','info','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x19628c,_0x1b7192){var _0x1d8d7e=function(_0x385dfa){while(--_0x385dfa){_0x19628c['push'](_0x19628c['shift']());}};_0x1d8d7e(++_0x1b7192);}(_0xcf66,0x71));var _0x6cf6=function(_0x5c6c30,_0x45a758){_0x5c6c30=_0x5c6c30-0x0;var _0x1cdb8d=_0xcf66[_0x5c6c30];return _0x1cdb8d;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb082,_0x94c6a9,_0x308d0d){return new BPromise(function(_0x36b892,_0x748c93){return client[_0x6cf6('0xa')](_0x5eb082,_0x308d0d)[_0x6cf6('0xb')](function(_0x5b3827){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x94c6a9,_0x6cf6('0xc'));logger['debug'](_0x6cf6('0xd'),_0x94c6a9,_0x6cf6('0xc'),JSON[_0x6cf6('0xe')](_0x5b3827));if(_0x5b3827[_0x6cf6('0xf')]){if(_0x5b3827['error']['code']===0x1f4){logger['error'](_0x6cf6('0x10'),_0x94c6a9,_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);return _0x748c93(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}logger[_0x6cf6('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x94c6a9,_0x5b3827[_0x6cf6('0xf')]['message']);return _0x36b892(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}else{logger['info'](_0x6cf6('0x10'),_0x94c6a9,_0x6cf6('0xc'));_0x36b892(_0x5b3827[_0x6cf6('0x12')][_0x6cf6('0x11')]);}})[_0x6cf6('0x13')](function(_0x2bdb12){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x94c6a9,_0x2bdb12);_0x748c93(_0x2bdb12);});});}exports[_0x6cf6('0x14')]=function(_0x2ca2b1){var _0x5e8b11=this;return new Promise(function(_0x11d994,_0x22915c){return db[_0x6cf6('0x15')]['create'](_0x2ca2b1[_0x6cf6('0x16')],{'raw':_0x2ca2b1[_0x6cf6('0x17')]?_0x2ca2b1[_0x6cf6('0x17')][_0x6cf6('0x18')]===undefined?!![]:![]:!![]})[_0x6cf6('0xb')](function(_0x21e903){logger[_0x6cf6('0x19')]('CreateSquareDetailsReport',_0x2ca2b1);logger[_0x6cf6('0x1a')](_0x6cf6('0x14'),_0x2ca2b1,JSON[_0x6cf6('0xe')](_0x21e903));_0x11d994(_0x21e903);})[_0x6cf6('0x13')](function(_0x5cba3a){logger[_0x6cf6('0xf')](_0x6cf6('0x14'),_0x5cba3a[_0x6cf6('0x11')],_0x2ca2b1);_0x22915c(_0x5e8b11['error'](0x1f4,_0x5cba3a['message']));});});}; \ No newline at end of file +var _0x4bde=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','stringify','lodash','util'];(function(_0x4da382,_0x4cfc5d){var _0x10073f=function(_0x32dc45){while(--_0x32dc45){_0x4da382['push'](_0x4da382['shift']());}};_0x10073f(++_0x4cfc5d);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x4db0e3,_0x45b7a8){_0x4db0e3=_0x4db0e3-0x0;var _0x4b607b=_0x4bde[_0x4db0e3];return _0x4b607b;};'use strict';var _=require(_0xe4bd('0x0'));var util=require(_0xe4bd('0x1'));var moment=require(_0xe4bd('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4bd('0x3'));var fs=require('fs');var Redis=require(_0xe4bd('0x4'));var db=require(_0xe4bd('0x5'))['db'];var utils=require(_0xe4bd('0x6'));var logger=require('../../config/logger')(_0xe4bd('0x7'));var config=require(_0xe4bd('0x8'));var jayson=require(_0xe4bd('0x9'));var client=jayson[_0xe4bd('0xa')][_0xe4bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4008eb,_0x4c933b,_0x2cf33d){return new BPromise(function(_0xbd04ce,_0x262295){return client[_0xe4bd('0xc')](_0x4008eb,_0x2cf33d)[_0xe4bd('0xd')](function(_0x3ef7e7){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x4c933b,'request\x20sent');logger[_0xe4bd('0xe')](_0xe4bd('0xf'),_0x4c933b,_0xe4bd('0x10'),JSON['stringify'](_0x3ef7e7));if(_0x3ef7e7[_0xe4bd('0x11')]){if(_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x12')]===0x1f4){logger[_0xe4bd('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x4c933b,_0x3ef7e7[_0xe4bd('0x11')]['message']);return _0x262295(_0x3ef7e7[_0xe4bd('0x11')]['message']);}logger[_0xe4bd('0x11')](_0xe4bd('0x13'),_0x4c933b,_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x14')]);return _0xbd04ce(_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x14')]);}else{logger[_0xe4bd('0x15')](_0xe4bd('0x13'),_0x4c933b,_0xe4bd('0x10'));_0xbd04ce(_0x3ef7e7[_0xe4bd('0x16')][_0xe4bd('0x14')]);}})[_0xe4bd('0x17')](function(_0x470cd1){logger['error'](_0xe4bd('0x13'),_0x4c933b,_0x470cd1);_0x262295(_0x470cd1);});});}exports[_0xe4bd('0x18')]=function(_0x5982f4){var _0x1731a1=this;return new Promise(function(_0x3dccd4,_0x544b3c){return db[_0xe4bd('0x19')]['create'](_0x5982f4['body'],{'raw':_0x5982f4[_0xe4bd('0x1a')]?_0x5982f4[_0xe4bd('0x1a')][_0xe4bd('0x1b')]===undefined?!![]:![]:!![]})[_0xe4bd('0xd')](function(_0x10a234){logger[_0xe4bd('0x15')](_0xe4bd('0x18'),_0x5982f4);logger['debug'](_0xe4bd('0x18'),_0x5982f4,JSON[_0xe4bd('0x1c')](_0x10a234));_0x3dccd4(_0x10a234);})['catch'](function(_0x2a5f40){logger[_0xe4bd('0x11')](_0xe4bd('0x18'),_0x2a5f40[_0xe4bd('0x14')],_0x5982f4);_0x544b3c(_0x1731a1[_0xe4bd('0x11')](0x1f4,_0x2a5f40[_0xe4bd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 834d285..865eac4 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 _0x5ece=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x483d2a,_0x4bffba){var _0x5ba5d5=function(_0x33e56a){while(--_0x33e56a){_0x483d2a['push'](_0x483d2a['shift']());}};_0x5ba5d5(++_0x4bffba);}(_0x5ece,0xf5));var _0xe5ec=function(_0x5db861,_0xe8f005){_0x5db861=_0x5db861-0x0;var _0x100b07=_0x5ece[_0x5db861];return _0x100b07;};'use strict';var express=require(_0xe5ec('0x0'));var router=express[_0xe5ec('0x1')]();var auth=require(_0xe5ec('0x2'));var controller=require(_0xe5ec('0x3'));router[_0xe5ec('0x4')]('/',auth[_0xe5ec('0x5')](),controller[_0xe5ec('0x6')]);router['get'](_0xe5ec('0x7'),auth[_0xe5ec('0x5')](),controller[_0xe5ec('0x8')]);module[_0xe5ec('0x9')]=router; \ No newline at end of file +var _0xa001=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x123922,_0x4c13b7){var _0x583796=function(_0x52bc5a){while(--_0x52bc5a){_0x123922['push'](_0x123922['shift']());}};_0x583796(++_0x4c13b7);}(_0xa001,0x70));var _0x1a00=function(_0x6a785a,_0x3b6592){_0x6a785a=_0x6a785a-0x0;var _0x63a79c=_0xa001[_0x6a785a];return _0x63a79c;};'use strict';var express=require(_0x1a00('0x0'));var router=express[_0x1a00('0x1')]();var auth=require(_0x1a00('0x2'));var controller=require(_0x1a00('0x3'));router[_0x1a00('0x4')]('/',auth[_0x1a00('0x5')](),controller[_0x1a00('0x6')]);router[_0x1a00('0x4')](_0x1a00('0x7'),auth['isAuthenticated'](),controller[_0x1a00('0x8')]);module[_0x1a00('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 060977a..0ac94b9 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 _0x4d5b=['params','kill','SIGINT','exec','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length'];(function(_0x47272f,_0x4e4f9e){var _0x17ebc8=function(_0xe23b83){while(--_0xe23b83){_0x47272f['push'](_0x47272f['shift']());}};_0x17ebc8(++_0x4e4f9e);}(_0x4d5b,0xa4));var _0xb4d5=function(_0x431c08,_0x4a3daf){_0x431c08=_0x431c08-0x0;var _0x19e9da=_0x4d5b[_0x431c08];return _0x19e9da;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xb4d5('0x0')];var logger=require(_0xb4d5('0x1'))('api');var util=require(_0xb4d5('0x2'));var BPromise=require('bluebird');var _=require(_0xb4d5('0x3'));function handleError(_0x3d6b08,_0x1a0551,_0x1e8f73){_0x1a0551=_0x1a0551||0x1f4;return function(_0x23446a){logger[_0xb4d5('0x4')](_0xb4d5('0x5'),_0x1e8f73,_0x1a0551,util[_0xb4d5('0x6')](_0x23446a,{'showHidden':![],'depth':null}));delete _0x23446a[_0xb4d5('0x7')];_0x3d6b08[_0xb4d5('0x8')](_0x1a0551)[_0xb4d5('0x9')](_0x23446a);};}exports['index']=function(_0x1616ee,_0x46accc){return info[_0xb4d5('0xa')]()[_0xb4d5('0xb')](function(_0x152c98){return _0x46accc[_0xb4d5('0x8')](0xc8)['json'](_0x152c98);})[_0xb4d5('0xc')](function(_0x39859e){return _0x46accc[_0xb4d5('0x8')](0x1f4)[_0xb4d5('0xd')](_0x39859e);});};exports[_0xb4d5('0xe')]=function(_0x4516c2,_0x11f79a){var _0x47e6d4=[_0xb4d5('0xf')];return new BPromise(function(_0x720fc1,_0x459550){return exec(util[_0xb4d5('0x10')](_0xb4d5('0x11'),_0x4516c2['params'][_0xb4d5('0x12')]),function(_0x2dc8a2,_0x4b0acc,_0x3c3e76){if(_0x2dc8a2){return _0x459550(_0x2dc8a2);}return _0x720fc1(_0x4b0acc);});})[_0xb4d5('0xb')](function(_0x3c6cdf){var _0x3d8ec3=![];var _0x5e5a47=_0x3c6cdf['split'](/\n/);for(var _0x20d7b0=0x0,_0x3168af=_0x47e6d4[_0xb4d5('0x13')];_0x20d7b0<_0x3168af,_0x3d8ec3===![];_0x20d7b0+=0x1){if(_0x3c6cdf['indexOf'](_0x47e6d4[_0x20d7b0])>=0x0){_0x3d8ec3=!![];}}if(!_0x3d8ec3){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4516c2[_0xb4d5('0x14')][_0xb4d5('0x12')]));}process[_0xb4d5('0x15')](_0x4516c2['params'][_0xb4d5('0x12')],_0xb4d5('0x16'));return _0x11f79a[_0xb4d5('0x8')](0xc8)[_0xb4d5('0xd')]({'message':util[_0xb4d5('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4516c2['params'][_0xb4d5('0x12')])});})[_0xb4d5('0xc')](handleError(_0x11f79a,null,_0xb4d5('0xe')));}; \ No newline at end of file +var _0xac80=['pid','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','../../config/logger','api','util','bluebird','lodash','error','name','status','send','index','then','catch','json','killProcess','components/import/cm','params'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0xac80,0x74));var _0x0ac8=function(_0x1c6a65,_0x9a977e){_0x1c6a65=_0x1c6a65-0x0;var _0x2410fb=_0xac80[_0x1c6a65];return _0x2410fb;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0x0ac8('0x0'))(_0x0ac8('0x1'));var util=require(_0x0ac8('0x2'));var BPromise=require(_0x0ac8('0x3'));var _=require(_0x0ac8('0x4'));function handleError(_0x5f3e51,_0x65c758,_0x312289){_0x65c758=_0x65c758||0x1f4;return function(_0x14a763){logger[_0x0ac8('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x312289,_0x65c758,util['inspect'](_0x14a763,{'showHidden':![],'depth':null}));delete _0x14a763[_0x0ac8('0x6')];_0x5f3e51[_0x0ac8('0x7')](_0x65c758)[_0x0ac8('0x8')](_0x14a763);};}exports[_0x0ac8('0x9')]=function(_0x569944,_0x116471){return info['getAllData']()[_0x0ac8('0xa')](function(_0x44cdbd){return _0x116471[_0x0ac8('0x7')](0xc8)['json'](_0x44cdbd);})[_0x0ac8('0xb')](function(_0x3ec5c2){return _0x116471[_0x0ac8('0x7')](0x1f4)[_0x0ac8('0xc')](_0x3ec5c2);});};exports[_0x0ac8('0xd')]=function(_0x527a36,_0x562e22){var _0x3dcf65=[_0x0ac8('0xe')];return new BPromise(function(_0x571817,_0x424a5e){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x527a36[_0x0ac8('0xf')][_0x0ac8('0x10')]),function(_0x305e88,_0x734b86,_0xe4cab4){if(_0x305e88){return _0x424a5e(_0x305e88);}return _0x571817(_0x734b86);});})[_0x0ac8('0xa')](function(_0x4c8afc){var _0x332afd=![];var _0x300597=_0x4c8afc[_0x0ac8('0x11')](/\n/);for(var _0x35f5ce=0x0,_0x4bbbe0=_0x3dcf65['length'];_0x35f5ce<_0x4bbbe0,_0x332afd===![];_0x35f5ce+=0x1){if(_0x4c8afc[_0x0ac8('0x12')](_0x3dcf65[_0x35f5ce])>=0x0){_0x332afd=!![];}}if(!_0x332afd){throw new Error(util[_0x0ac8('0x13')](_0x0ac8('0x14'),_0x527a36[_0x0ac8('0xf')][_0x0ac8('0x10')]));}process[_0x0ac8('0x15')](_0x527a36[_0x0ac8('0xf')][_0x0ac8('0x10')],'SIGINT');return _0x562e22[_0x0ac8('0x7')](0xc8)['json']({'message':util[_0x0ac8('0x13')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x527a36[_0x0ac8('0xf')][_0x0ac8('0x10')])});})['catch'](handleError(_0x562e22,null,_0x0ac8('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c52cea3..f0f7180 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 _0xb3c3=['./tag.controller','get','index','/:id','isAuthenticated','show','create','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xd02d4,_0x13deb5){var _0x1c8700=function(_0x27afce){while(--_0x27afce){_0xd02d4['push'](_0xd02d4['shift']());}};_0x1c8700(++_0x13deb5);}(_0xb3c3,0x1ce));var _0x3b3c=function(_0x33fbc6,_0x5685a3){_0x33fbc6=_0x33fbc6-0x0;var _0xe71609=_0xb3c3[_0x33fbc6];return _0xe71609;};'use strict';var multer=require(_0x3b3c('0x0'));var util=require('util');var path=require(_0x3b3c('0x1'));var timeout=require('connect-timeout');var express=require(_0x3b3c('0x2'));var router=express['Router']();var fs_extra=require(_0x3b3c('0x3'));var auth=require(_0x3b3c('0x4'));var interaction=require(_0x3b3c('0x5'));var config=require('../../config/environment');var controller=require(_0x3b3c('0x6'));router[_0x3b3c('0x7')]('/',auth['isAuthenticated'](),controller[_0x3b3c('0x8')]);router['get'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller[_0x3b3c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b3c('0xc')]);router['put'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller['update']);router['delete'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x983f=['show','post','/:id','delete','destroy','exports','path','express','../../config/environment','./tag.controller','index','get','isAuthenticated'];(function(_0x415fa6,_0x1bb5a1){var _0x2b0f67=function(_0x3a81fc){while(--_0x3a81fc){_0x415fa6['push'](_0x415fa6['shift']());}};_0x2b0f67(++_0x1bb5a1);}(_0x983f,0xe3));var _0xf983=function(_0x49a666,_0x22791b){_0x49a666=_0x49a666-0x0;var _0x137ba3=_0x983f[_0x49a666];return _0x137ba3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf983('0x0'));var timeout=require('connect-timeout');var express=require(_0xf983('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf983('0x2'));var controller=require(_0xf983('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0xf983('0x4')]);router[_0xf983('0x5')]('/:id',auth[_0xf983('0x6')](),controller[_0xf983('0x7')]);router[_0xf983('0x8')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf983('0x9'),auth[_0xf983('0x6')](),controller['update']);router[_0xf983('0xa')](_0xf983('0x9'),auth['isAuthenticated'](),controller[_0xf983('0xb')]);module[_0xf983('0xc')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 7001d49..85c09dd 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 _0xdacc=['STRING','name','#0091EA','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdacc,0x14f));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xcdac('0x0')]={'name':{'type':Sequelize[_0xcdac('0x1')],'unique':_0xcdac('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xcdac('0x1')],'defaultValue':_0xcdac('0x3')},'description':{'type':Sequelize[_0xcdac('0x1')]}}; \ No newline at end of file +var _0x7382=['exports','STRING'];(function(_0x153b36,_0x265eda){var _0x38b194=function(_0x2a4797){while(--_0x2a4797){_0x153b36['push'](_0x153b36['shift']());}};_0x38b194(++_0x265eda);}(_0x7382,0x1f2));var _0x2738=function(_0x80c685,_0x4ce1c2){_0x80c685=_0x80c685-0x0;var _0x22b6f0=_0x7382[_0x80c685];return _0x22b6f0;};'use strict';var Sequelize=require('sequelize');module[_0x2738('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x2738('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x2738('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a7a0bf7..8e265cb 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 _0x9099=['includeAll','findAll','rows','catch','show','keys','length','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','get','Tags','destroy','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x58bbeb,_0x19caf1){var _0x5d9f3e=function(_0x27e100){while(--_0x27e100){_0x58bbeb['push'](_0x58bbeb['shift']());}};_0x5d9f3e(++_0x19caf1);}(_0x9099,0x1ac));var _0x9909=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x9099[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x9909('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9909('0x1'));var jsonpatch=require(_0x9909('0x2'));var rp=require(_0x9909('0x3'));var moment=require(_0x9909('0x4'));var BPromise=require(_0x9909('0x5'));var Mustache=require(_0x9909('0x6'));var util=require(_0x9909('0x7'));var path=require(_0x9909('0x8'));var sox=require(_0x9909('0x9'));var csv=require(_0x9909('0xa'));var ejs=require(_0x9909('0xb'));var fs=require('fs');var fs_extra=require(_0x9909('0xc'));var _=require(_0x9909('0xd'));var squel=require(_0x9909('0xe'));var crypto=require('crypto');var jsforce=require(_0x9909('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9909('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9909('0x11'));var as=require(_0x9909('0x12'));var hardwareService=require(_0x9909('0x13'));var logger=require('../../config/logger')(_0x9909('0x14'));var utils=require('../../config/utils');var config=require(_0x9909('0x15'));var licenseUtil=require(_0x9909('0x16'));var db=require(_0x9909('0x17'))['db'];function respondWithStatusCode(_0x3ba080,_0x1c69bb){_0x1c69bb=_0x1c69bb||0xcc;return function(_0x5cc11e){if(_0x5cc11e){return _0x3ba080[_0x9909('0x18')](_0x1c69bb);}return _0x3ba080[_0x9909('0x19')](_0x1c69bb)[_0x9909('0x1a')]();};}function respondWithResult(_0xef3295,_0x1c2668){_0x1c2668=_0x1c2668||0xc8;return function(_0x38c2e3){if(_0x38c2e3){return _0xef3295[_0x9909('0x19')](_0x1c2668)['json'](_0x38c2e3);}};}function respondWithFilteredResult(_0x33a8e3,_0x55e800){return function(_0x1f32cc){if(_0x1f32cc){var _0x5bd7e7=typeof _0x55e800[_0x9909('0x1b')]===_0x9909('0x1c')&&typeof _0x55e800[_0x9909('0x1d')]==='undefined';var _0x9a16a6=_0x1f32cc[_0x9909('0x1e')];var _0x180929=_0x5bd7e7?0x0:_0x55e800[_0x9909('0x1b')];var _0x1106e5=_0x5bd7e7?_0x1f32cc[_0x9909('0x1e')]:_0x55e800[_0x9909('0x1b')]+_0x55e800['limit'];var _0x1b038f;if(_0x1106e5>=_0x9a16a6){_0x1106e5=_0x9a16a6;_0x1b038f=0xc8;}else{_0x1b038f=0xce;}_0x33a8e3[_0x9909('0x19')](_0x1b038f);return _0x33a8e3['set'](_0x9909('0x1f'),_0x180929+'-'+_0x1106e5+'/'+_0x9a16a6)[_0x9909('0x20')](_0x1f32cc);}return null;};}function patchUpdates(_0x20c236){return function(_0x1553ae){try{jsonpatch[_0x9909('0x21')](_0x1553ae,_0x20c236,!![]);}catch(_0x222cd9){return BPromise[_0x9909('0x22')](_0x222cd9);}return _0x1553ae['save']();};}function saveUpdates(_0x112727,_0x319c31){return function(_0x4a626b){if(_0x4a626b){return _0x4a626b['update'](_0x112727)[_0x9909('0x23')](function(_0x176593){return _0x176593;});}return null;};}function removeEntity(_0xdd5088,_0x19e66b){return function(_0x2f15fa){if(_0x2f15fa){return _0x2f15fa['destroy']()['then'](function(){var _0x2d83a5=_0x2f15fa[_0x9909('0x24')]({'plain':!![]});var _0x614308=_0x9909('0x25');return db['UserProfileResource'][_0x9909('0x26')]({'where':{'type':_0x614308,'resourceId':_0x2d83a5['id']}})[_0x9909('0x23')](function(){return _0x2f15fa;});})[_0x9909('0x23')](function(){_0xdd5088[_0x9909('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x405c5e,_0x22ff12){return function(_0x19c7e8){if(!_0x19c7e8){_0x405c5e[_0x9909('0x18')](0x194);}return _0x19c7e8;};}function handleError(_0x5250d8,_0xb0b66f){_0xb0b66f=_0xb0b66f||0x1f4;return function(_0x175d52){logger[_0x9909('0x27')](_0x175d52[_0x9909('0x28')]);if(_0x175d52[_0x9909('0x29')]){delete _0x175d52[_0x9909('0x29')];}_0x5250d8[_0x9909('0x19')](_0xb0b66f)['send'](_0x175d52);};}exports[_0x9909('0x2a')]=function(_0x3a3f4f,_0x87ac8a){var _0x42f1e5={},_0x3e4e07={},_0x519066={'count':0x0,'rows':[]};var _0x4245eb=_[_0x9909('0x2b')](db[_0x9909('0x2c')][_0x9909('0x2d')],function(_0xc1bd06){return{'name':_0xc1bd06[_0x9909('0x2e')],'type':_0xc1bd06[_0x9909('0x2f')][_0x9909('0x30')]};});_0x3e4e07['model']=_['map'](_0x4245eb,_0x9909('0x29'));_0x3e4e07[_0x9909('0x31')]=_['keys'](_0x3a3f4f[_0x9909('0x31')]);_0x3e4e07[_0x9909('0x32')]=_[_0x9909('0x33')](_0x3e4e07[_0x9909('0x34')],_0x3e4e07[_0x9909('0x31')]);_0x42f1e5[_0x9909('0x35')]=_[_0x9909('0x33')](_0x3e4e07['model'],qs[_0x9909('0x36')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x36')]));_0x42f1e5[_0x9909('0x35')]=_0x42f1e5[_0x9909('0x35')]['length']?_0x42f1e5[_0x9909('0x35')]:_0x3e4e07[_0x9909('0x34')];if(!_0x3a3f4f['query'][_0x9909('0x37')](_0x9909('0x38'))){_0x42f1e5[_0x9909('0x1d')]=qs[_0x9909('0x1d')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x1d')]);_0x42f1e5['offset']=qs[_0x9909('0x1b')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x1b')]);}_0x42f1e5[_0x9909('0x39')]=qs[_0x9909('0x3a')](_0x3a3f4f[_0x9909('0x31')][_0x9909('0x3a')]);_0x42f1e5[_0x9909('0x3b')]=qs[_0x9909('0x32')](_[_0x9909('0x3c')](_0x3a3f4f[_0x9909('0x31')],_0x3e4e07[_0x9909('0x32')]),_0x4245eb);if(_0x3a3f4f[_0x9909('0x31')][_0x9909('0x3d')]){_0x42f1e5[_0x9909('0x3b')]=_[_0x9909('0x3e')](_0x42f1e5[_0x9909('0x3b')],{'$or':_[_0x9909('0x2b')](_0x4245eb,function(_0x1b5e2b){if(_0x1b5e2b[_0x9909('0x2f')]!==_0x9909('0x3f')){var _0x1b224d={};_0x1b224d[_0x1b5e2b[_0x9909('0x29')]]={'$like':'%'+_0x3a3f4f['query']['filter']+'%'};return _0x1b224d;}})});}_0x42f1e5=_[_0x9909('0x3e')]({},_0x42f1e5,_0x3a3f4f['options']);var _0x52724f={'where':_0x42f1e5[_0x9909('0x3b')]};return db[_0x9909('0x2c')][_0x9909('0x1e')](_0x52724f)[_0x9909('0x23')](function(_0x556fad){_0x519066[_0x9909('0x1e')]=_0x556fad;if(_0x3a3f4f[_0x9909('0x31')][_0x9909('0x40')]){_0x42f1e5['include']=[{'all':!![]}];}return db[_0x9909('0x2c')][_0x9909('0x41')](_0x42f1e5);})[_0x9909('0x23')](function(_0x4b0a4c){_0x519066[_0x9909('0x42')]=_0x4b0a4c;return _0x519066;})[_0x9909('0x23')](respondWithFilteredResult(_0x87ac8a,_0x42f1e5))[_0x9909('0x43')](handleError(_0x87ac8a,null));};exports[_0x9909('0x44')]=function(_0x1f57bd,_0x856057){var _0xef5aa6={'raw':!![],'where':{'id':_0x1f57bd['params']['id']}},_0x3b1844={};_0x3b1844[_0x9909('0x34')]=_[_0x9909('0x45')](db['Tag'][_0x9909('0x2d')]);_0x3b1844[_0x9909('0x31')]=_['keys'](_0x1f57bd['query']);_0x3b1844[_0x9909('0x32')]=_[_0x9909('0x33')](_0x3b1844[_0x9909('0x34')],_0x3b1844[_0x9909('0x31')]);_0xef5aa6[_0x9909('0x35')]=_[_0x9909('0x33')](_0x3b1844[_0x9909('0x34')],qs[_0x9909('0x36')](_0x1f57bd[_0x9909('0x31')][_0x9909('0x36')]));_0xef5aa6['attributes']=_0xef5aa6[_0x9909('0x35')][_0x9909('0x46')]?_0xef5aa6[_0x9909('0x35')]:_0x3b1844[_0x9909('0x34')];if(_0x1f57bd['query']['includeAll']){_0xef5aa6[_0x9909('0x47')]=[{'all':!![]}];}_0xef5aa6=_['merge']({},_0xef5aa6,_0x1f57bd[_0x9909('0x48')]);return db[_0x9909('0x2c')][_0x9909('0x49')](_0xef5aa6)['then'](handleEntityNotFound(_0x856057,null))[_0x9909('0x23')](respondWithResult(_0x856057,null))[_0x9909('0x43')](handleError(_0x856057,null));};exports[_0x9909('0x4a')]=function(_0x54152c,_0x271984){return db[_0x9909('0x2c')][_0x9909('0x4a')](_0x54152c[_0x9909('0x4b')],{})[_0x9909('0x23')](function(_0x137fb6){var _0x8fbd0c=_0x54152c['user'][_0x9909('0x24')]({'plain':!![]});if(!_0x8fbd0c)throw new Error(_0x9909('0x4c'));if(_0x8fbd0c['role']===_0x9909('0x4d')){var _0x240947=_0x137fb6[_0x9909('0x24')]({'plain':!![]});var _0x37697d=_0x9909('0x25');return db['UserProfileSection'][_0x9909('0x49')]({'where':{'name':_0x37697d,'userProfileId':_0x8fbd0c['userProfileId']},'raw':!![]})[_0x9909('0x23')](function(_0x159e08){if(_0x159e08&&_0x159e08[_0x9909('0x4e')]===0x0){return db[_0x9909('0x4f')][_0x9909('0x4a')]({'name':_0x240947[_0x9909('0x29')],'resourceId':_0x240947['id'],'type':_0x159e08[_0x9909('0x29')],'sectionId':_0x159e08['id']},{})[_0x9909('0x23')](function(){return _0x137fb6;});}else{return _0x137fb6;}})['catch'](function(_0x51b214){logger[_0x9909('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51b214);throw _0x51b214;});}return _0x137fb6;})['then'](respondWithResult(_0x271984,0xc9))[_0x9909('0x43')](handleError(_0x271984,null));};exports[_0x9909('0x50')]=function(_0x49659a,_0x1144e0){if(_0x49659a[_0x9909('0x4b')]['id']){delete _0x49659a[_0x9909('0x4b')]['id'];}return db[_0x9909('0x2c')][_0x9909('0x49')]({'where':{'id':_0x49659a[_0x9909('0x51')]['id']}})['then'](handleEntityNotFound(_0x1144e0,null))[_0x9909('0x23')](saveUpdates(_0x49659a[_0x9909('0x4b')],null))['then'](respondWithResult(_0x1144e0,null))['catch'](handleError(_0x1144e0,null));};exports[_0x9909('0x26')]=function(_0x508b6a,_0x180cf5){return db[_0x9909('0x2c')][_0x9909('0x49')]({'where':{'id':_0x508b6a[_0x9909('0x51')]['id']}})['then'](handleEntityNotFound(_0x180cf5,null))['then'](removeEntity(_0x180cf5,null))['catch'](handleError(_0x180cf5,null));}; \ No newline at end of file +var _0x2504=['update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','Tag','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','merge','VIRTUAL','filter','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x2504,0xee));var _0x4250=function(_0x405a37,_0x5aea5e){_0x405a37=_0x405a37-0x0;var _0x5c781b=_0x2504[_0x405a37];return _0x5c781b;};'use strict';var emlformat=require(_0x4250('0x0'));var rimraf=require(_0x4250('0x1'));var zipdir=require(_0x4250('0x2'));var jsonpatch=require(_0x4250('0x3'));var rp=require(_0x4250('0x4'));var moment=require(_0x4250('0x5'));var BPromise=require(_0x4250('0x6'));var Mustache=require(_0x4250('0x7'));var util=require(_0x4250('0x8'));var path=require(_0x4250('0x9'));var sox=require(_0x4250('0xa'));var csv=require(_0x4250('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4250('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4250('0xd'));var jsforce=require(_0x4250('0xe'));var deskjs=require(_0x4250('0xf'));var toCsv=require(_0x4250('0xb'));var querystring=require(_0x4250('0x10'));var Papa=require('papaparse');var Redis=require(_0x4250('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4250('0x12'));var as=require(_0x4250('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4250('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4250('0x15'));var licenseUtil=require(_0x4250('0x16'));var db=require(_0x4250('0x17'))['db'];function respondWithStatusCode(_0x3c1e7e,_0x2a496b){_0x2a496b=_0x2a496b||0xcc;return function(_0x5d62a0){if(_0x5d62a0){return _0x3c1e7e[_0x4250('0x18')](_0x2a496b);}return _0x3c1e7e[_0x4250('0x19')](_0x2a496b)[_0x4250('0x1a')]();};}function respondWithResult(_0x2c8a75,_0xfa4d8a){_0xfa4d8a=_0xfa4d8a||0xc8;return function(_0x33f317){if(_0x33f317){return _0x2c8a75['status'](_0xfa4d8a)[_0x4250('0x1b')](_0x33f317);}};}function respondWithFilteredResult(_0x46ba15,_0x1b0c66){return function(_0x3cff02){if(_0x3cff02){var _0x2979cd=typeof _0x1b0c66[_0x4250('0x1c')]===_0x4250('0x1d')&&typeof _0x1b0c66['limit']===_0x4250('0x1d');var _0x35d232=_0x3cff02[_0x4250('0x1e')];var _0x17a8a9=_0x2979cd?0x0:_0x1b0c66[_0x4250('0x1c')];var _0x30e48c=_0x2979cd?_0x3cff02[_0x4250('0x1e')]:_0x1b0c66['offset']+_0x1b0c66[_0x4250('0x1f')];var _0x4f0154;if(_0x30e48c>=_0x35d232){_0x30e48c=_0x35d232;_0x4f0154=0xc8;}else{_0x4f0154=0xce;}_0x46ba15['status'](_0x4f0154);return _0x46ba15[_0x4250('0x20')](_0x4250('0x21'),_0x17a8a9+'-'+_0x30e48c+'/'+_0x35d232)[_0x4250('0x1b')](_0x3cff02);}return null;};}function patchUpdates(_0x42c331){return function(_0x242cf1){try{jsonpatch[_0x4250('0x22')](_0x242cf1,_0x42c331,!![]);}catch(_0x1ba772){return BPromise[_0x4250('0x23')](_0x1ba772);}return _0x242cf1[_0x4250('0x24')]();};}function saveUpdates(_0x3818c0,_0x728862){return function(_0x30e2ae){if(_0x30e2ae){return _0x30e2ae['update'](_0x3818c0)[_0x4250('0x25')](function(_0x171df4){return _0x171df4;});}return null;};}function removeEntity(_0x1feb98,_0x523053){return function(_0x5d1a74){if(_0x5d1a74){return _0x5d1a74[_0x4250('0x26')]()[_0x4250('0x25')](function(){var _0x1c1294=_0x5d1a74[_0x4250('0x27')]({'plain':!![]});var _0x328ffb='Tags';return db[_0x4250('0x28')][_0x4250('0x26')]({'where':{'type':_0x328ffb,'resourceId':_0x1c1294['id']}})[_0x4250('0x25')](function(){return _0x5d1a74;});})['then'](function(){_0x1feb98['status'](0xcc)[_0x4250('0x1a')]();});}};}function handleEntityNotFound(_0x5d0fa2,_0x3e8b4d){return function(_0x1c4fa5){if(!_0x1c4fa5){_0x5d0fa2[_0x4250('0x18')](0x194);}return _0x1c4fa5;};}function handleError(_0x2cdfdf,_0xb82299){_0xb82299=_0xb82299||0x1f4;return function(_0x501c5f){logger[_0x4250('0x29')](_0x501c5f[_0x4250('0x2a')]);if(_0x501c5f['name']){delete _0x501c5f[_0x4250('0x2b')];}_0x2cdfdf['status'](_0xb82299)[_0x4250('0x2c')](_0x501c5f);};}exports['index']=function(_0x5e0fe6,_0xea7ccc){var _0x5f20d5={},_0x16b8a4={},_0x281be9={'count':0x0,'rows':[]};var _0x4bed2b=_[_0x4250('0x2d')](db[_0x4250('0x2e')]['rawAttributes'],function(_0x217188){return{'name':_0x217188[_0x4250('0x2f')],'type':_0x217188['type'][_0x4250('0x30')]};});_0x16b8a4[_0x4250('0x31')]=_[_0x4250('0x2d')](_0x4bed2b,_0x4250('0x2b'));_0x16b8a4[_0x4250('0x32')]=_[_0x4250('0x33')](_0x5e0fe6[_0x4250('0x32')]);_0x16b8a4[_0x4250('0x34')]=_[_0x4250('0x35')](_0x16b8a4[_0x4250('0x31')],_0x16b8a4[_0x4250('0x32')]);_0x5f20d5[_0x4250('0x36')]=_[_0x4250('0x35')](_0x16b8a4['model'],qs[_0x4250('0x37')](_0x5e0fe6['query'][_0x4250('0x37')]));_0x5f20d5[_0x4250('0x36')]=_0x5f20d5['attributes'][_0x4250('0x38')]?_0x5f20d5[_0x4250('0x36')]:_0x16b8a4[_0x4250('0x31')];if(!_0x5e0fe6[_0x4250('0x32')]['hasOwnProperty']('nolimit')){_0x5f20d5['limit']=qs[_0x4250('0x1f')](_0x5e0fe6[_0x4250('0x32')]['limit']);_0x5f20d5[_0x4250('0x1c')]=qs[_0x4250('0x1c')](_0x5e0fe6[_0x4250('0x32')][_0x4250('0x1c')]);}_0x5f20d5[_0x4250('0x39')]=qs['sort'](_0x5e0fe6[_0x4250('0x32')]['sort']);_0x5f20d5['where']=qs[_0x4250('0x34')](_['pick'](_0x5e0fe6[_0x4250('0x32')],_0x16b8a4[_0x4250('0x34')]),_0x4bed2b);if(_0x5e0fe6[_0x4250('0x32')]['filter']){_0x5f20d5[_0x4250('0x3a')]=_[_0x4250('0x3b')](_0x5f20d5[_0x4250('0x3a')],{'$or':_[_0x4250('0x2d')](_0x4bed2b,function(_0x3bcdbf){if(_0x3bcdbf['type']!==_0x4250('0x3c')){var _0x1d8459={};_0x1d8459[_0x3bcdbf[_0x4250('0x2b')]]={'$like':'%'+_0x5e0fe6[_0x4250('0x32')][_0x4250('0x3d')]+'%'};return _0x1d8459;}})});}_0x5f20d5=_[_0x4250('0x3b')]({},_0x5f20d5,_0x5e0fe6['options']);var _0x3a340a={'where':_0x5f20d5['where']};return db[_0x4250('0x2e')][_0x4250('0x1e')](_0x3a340a)[_0x4250('0x25')](function(_0x2a10b9){_0x281be9[_0x4250('0x1e')]=_0x2a10b9;if(_0x5e0fe6[_0x4250('0x32')]['includeAll']){_0x5f20d5['include']=[{'all':!![]}];}return db['Tag'][_0x4250('0x3e')](_0x5f20d5);})[_0x4250('0x25')](function(_0x2e4a22){_0x281be9['rows']=_0x2e4a22;return _0x281be9;})[_0x4250('0x25')](respondWithFilteredResult(_0xea7ccc,_0x5f20d5))[_0x4250('0x3f')](handleError(_0xea7ccc,null));};exports[_0x4250('0x40')]=function(_0x53fb93,_0x100727){var _0x307d2c={'raw':!![],'where':{'id':_0x53fb93[_0x4250('0x41')]['id']}},_0x366cb7={};_0x366cb7['model']=_['keys'](db[_0x4250('0x2e')][_0x4250('0x42')]);_0x366cb7[_0x4250('0x32')]=_[_0x4250('0x33')](_0x53fb93[_0x4250('0x32')]);_0x366cb7['filters']=_[_0x4250('0x35')](_0x366cb7['model'],_0x366cb7[_0x4250('0x32')]);_0x307d2c[_0x4250('0x36')]=_[_0x4250('0x35')](_0x366cb7['model'],qs[_0x4250('0x37')](_0x53fb93[_0x4250('0x32')][_0x4250('0x37')]));_0x307d2c['attributes']=_0x307d2c['attributes']['length']?_0x307d2c[_0x4250('0x36')]:_0x366cb7[_0x4250('0x31')];if(_0x53fb93[_0x4250('0x32')][_0x4250('0x43')]){_0x307d2c[_0x4250('0x44')]=[{'all':!![]}];}_0x307d2c=_[_0x4250('0x3b')]({},_0x307d2c,_0x53fb93['options']);return db[_0x4250('0x2e')][_0x4250('0x45')](_0x307d2c)[_0x4250('0x25')](handleEntityNotFound(_0x100727,null))['then'](respondWithResult(_0x100727,null))[_0x4250('0x3f')](handleError(_0x100727,null));};exports['create']=function(_0x5895ea,_0x2e0d9d){return db[_0x4250('0x2e')][_0x4250('0x46')](_0x5895ea[_0x4250('0x47')],{})[_0x4250('0x25')](function(_0x34d672){var _0x59d51a=_0x5895ea[_0x4250('0x48')]['get']({'plain':!![]});if(!_0x59d51a)throw new Error(_0x4250('0x49'));if(_0x59d51a[_0x4250('0x4a')]===_0x4250('0x48')){var _0x544048=_0x34d672[_0x4250('0x27')]({'plain':!![]});var _0x440aa4='Tags';return db['UserProfileSection']['find']({'where':{'name':_0x440aa4,'userProfileId':_0x59d51a[_0x4250('0x4b')]},'raw':!![]})['then'](function(_0x4e3158){if(_0x4e3158&&_0x4e3158[_0x4250('0x4c')]===0x0){return db[_0x4250('0x28')][_0x4250('0x46')]({'name':_0x544048[_0x4250('0x2b')],'resourceId':_0x544048['id'],'type':_0x4e3158[_0x4250('0x2b')],'sectionId':_0x4e3158['id']},{})['then'](function(){return _0x34d672;});}else{return _0x34d672;}})[_0x4250('0x3f')](function(_0xb82981){logger[_0x4250('0x29')](_0x4250('0x4d'),_0xb82981);throw _0xb82981;});}return _0x34d672;})['then'](respondWithResult(_0x2e0d9d,0xc9))[_0x4250('0x3f')](handleError(_0x2e0d9d,null));};exports[_0x4250('0x4e')]=function(_0x59efc0,_0xc7ba0){if(_0x59efc0[_0x4250('0x47')]['id']){delete _0x59efc0['body']['id'];}return db[_0x4250('0x2e')][_0x4250('0x45')]({'where':{'id':_0x59efc0[_0x4250('0x41')]['id']}})[_0x4250('0x25')](handleEntityNotFound(_0xc7ba0,null))[_0x4250('0x25')](saveUpdates(_0x59efc0[_0x4250('0x47')],null))[_0x4250('0x25')](respondWithResult(_0xc7ba0,null))['catch'](handleError(_0xc7ba0,null));};exports[_0x4250('0x26')]=function(_0x39e9f5,_0x6094fb){return db['Tag']['find']({'where':{'id':_0x39e9f5[_0x4250('0x41')]['id']}})[_0x4250('0x25')](handleEntityNotFound(_0x6094fb,null))['then'](removeEntity(_0x6094fb,null))[_0x4250('0x3f')](handleError(_0x6094fb,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index eb220a6..ba0f531 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 _0xc622=['api','moment','request-promise','rimraf','../../config/environment','exports','tools_tags','lodash','../../config/logger'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0xc622,0xb2));var _0x2c62=function(_0x18ccd6,_0x1098e8){_0x18ccd6=_0x18ccd6-0x0;var _0x587d2c=_0xc622[_0x18ccd6];return _0x587d2c;};'use strict';var _=require(_0x2c62('0x0'));var util=require('util');var logger=require(_0x2c62('0x1'))(_0x2c62('0x2'));var moment=require(_0x2c62('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c62('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c62('0x5'));var config=require(_0x2c62('0x6'));var attributes=require('./tag.attributes');module[_0x2c62('0x7')]=function(_0x3ba052,_0x19ee18){return _0x3ba052['define']('Tag',attributes,{'tableName':_0x2c62('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9906=['define','Tag','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./tag.attributes','exports'];(function(_0x3bf001,_0xfc5c13){var _0x1be18a=function(_0x3133e6){while(--_0x3133e6){_0x3bf001['push'](_0x3bf001['shift']());}};_0x1be18a(++_0xfc5c13);}(_0x9906,0xda));var _0x6990=function(_0x587291,_0xd5fce0){_0x587291=_0x587291-0x0;var _0x2cc693=_0x9906[_0x587291];return _0x2cc693;};'use strict';var _=require(_0x6990('0x0'));var util=require(_0x6990('0x1'));var logger=require('../../config/logger')(_0x6990('0x2'));var moment=require(_0x6990('0x3'));var BPromise=require(_0x6990('0x4'));var rp=require(_0x6990('0x5'));var fs=require('fs');var path=require(_0x6990('0x6'));var rimraf=require('rimraf');var config=require(_0x6990('0x7'));var attributes=require(_0x6990('0x8'));module[_0x6990('0x9')]=function(_0x3aad47,_0x781919){return _0x3aad47[_0x6990('0xa')](_0x6990('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 b65d980..765fb86 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 _0x99c9=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x453b63,_0x1b847d){var _0x3bf6e6=function(_0x4246f7){while(--_0x4246f7){_0x453b63['push'](_0x453b63['shift']());}};_0x3bf6e6(++_0x1b847d);}(_0x99c9,0x13c));var _0x999c=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x99c9[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var moment=require(_0x999c('0x2'));var BPromise=require(_0x999c('0x3'));var rs=require(_0x999c('0x4'));var fs=require('fs');var Redis=require(_0x999c('0x5'));var db=require(_0x999c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x999c('0x7'))(_0x999c('0x8'));var config=require(_0x999c('0x9'));var jayson=require(_0x999c('0xa'));var client=jayson[_0x999c('0xb')][_0x999c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34f100,_0x651b7e,_0xc8a6b5){return new BPromise(function(_0xb88ec1,_0x329252){return client[_0x999c('0xd')](_0x34f100,_0xc8a6b5)[_0x999c('0xe')](function(_0x395321){logger['info'](_0x999c('0xf'),_0x651b7e,_0x999c('0x10'));logger['debug'](_0x999c('0x11'),_0x651b7e,_0x999c('0x10'),JSON[_0x999c('0x12')](_0x395321));if(_0x395321[_0x999c('0x13')]){if(_0x395321[_0x999c('0x13')][_0x999c('0x14')]===0x1f4){logger[_0x999c('0x13')](_0x999c('0xf'),_0x651b7e,_0x395321[_0x999c('0x13')][_0x999c('0x15')]);return _0x329252(_0x395321[_0x999c('0x13')][_0x999c('0x15')]);}logger['error'](_0x999c('0xf'),_0x651b7e,_0x395321[_0x999c('0x13')]['message']);return _0xb88ec1(_0x395321['error']['message']);}else{logger[_0x999c('0x16')](_0x999c('0xf'),_0x651b7e,_0x999c('0x10'));_0xb88ec1(_0x395321[_0x999c('0x17')][_0x999c('0x15')]);}})['catch'](function(_0x226437){logger[_0x999c('0x13')](_0x999c('0xf'),_0x651b7e,_0x226437);_0x329252(_0x226437);});});} \ No newline at end of file +var _0xac31=['code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x464f25,_0x1dcae3){var _0x4be4f9=function(_0x26907d){while(--_0x26907d){_0x464f25['push'](_0x464f25['shift']());}};_0x4be4f9(++_0x1dcae3);}(_0xac31,0xca));var _0x1ac3=function(_0x2d6646,_0x399a0f){_0x2d6646=_0x2d6646-0x0;var _0x108563=_0xac31[_0x2d6646];return _0x108563;};'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});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){return client['request'](_0x2bf9b1,_0x157604)[_0x1ac3('0xb')](function(_0x40b64c){logger[_0x1ac3('0xc')]('Tag,\x20%s,\x20%s',_0x1be223,_0x1ac3('0xd'));logger[_0x1ac3('0xe')](_0x1ac3('0xf'),_0x1be223,_0x1ac3('0xd'),JSON[_0x1ac3('0x10')](_0x40b64c));if(_0x40b64c[_0x1ac3('0x11')]){if(_0x40b64c['error'][_0x1ac3('0x12')]===0x1f4){logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c[_0x1ac3('0x11')]['message']);return _0x2d17de(_0x40b64c[_0x1ac3('0x11')][_0x1ac3('0x14')]);}logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c['error'][_0x1ac3('0x14')]);return _0x57893c(_0x40b64c[_0x1ac3('0x11')]['message']);}else{logger[_0x1ac3('0xc')](_0x1ac3('0x13'),_0x1be223,_0x1ac3('0xd'));_0x57893c(_0x40b64c['result'][_0x1ac3('0x14')]);}})[_0x1ac3('0x15')](function(_0x23e6e9){logger['error'](_0x1ac3('0x13'),_0x1be223,_0x23e6e9);_0x2d17de(_0x23e6e9);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6dcffa1..413be70 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(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 33b774a..dfb53e5 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 _0x0713=['STRING','name'];(function(_0x1af711,_0x29e9a4){var _0x11b425=function(_0x355249){while(--_0x355249){_0x1af711['push'](_0x1af711['shift']());}};_0x11b425(++_0x29e9a4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb7e7[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2badffd..a676496 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 _0x2e5d=['user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','Sequelize','Unknown\x20channel','toLowerCase','Queue','capitalize','addQueues','isValidChannel','add','Queues','ids','removeQueues','ValidationError','Voice','Chat','Mail','Sms','Fax','Openchannel','sequelize','transaction','through','penalty','defaults','TeamVoiceQueue','User','emit','online','interface','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','all','spread','removeAgents','Whatsapp','parse','Queue:remove','QueueId','destroy','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','update','then','get','Teams','UserProfileResource','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Team','includeAll','include','findAll','rows','params','length','find','catch','create','body'];(function(_0x7566db,_0x3b707f){var _0x2174b6=function(_0x1d459b){while(--_0x1d459b){_0x7566db['push'](_0x7566db['shift']());}};_0x2174b6(++_0x3b707f);}(_0x2e5d,0x1c1));var _0xd2e5=function(_0x56a061,_0x53fb1b){_0x56a061=_0x56a061-0x0;var _0x105fa0=_0x2e5d[_0x56a061];return _0x105fa0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2e5('0x0'));var zipdir=require(_0xd2e5('0x1'));var jsonpatch=require(_0xd2e5('0x2'));var rp=require(_0xd2e5('0x3'));var moment=require(_0xd2e5('0x4'));var BPromise=require(_0xd2e5('0x5'));var Mustache=require(_0xd2e5('0x6'));var util=require(_0xd2e5('0x7'));var path=require(_0xd2e5('0x8'));var sox=require(_0xd2e5('0x9'));var csv=require(_0xd2e5('0xa'));var ejs=require(_0xd2e5('0xb'));var fs=require('fs');var fs_extra=require(_0xd2e5('0xc'));var _=require(_0xd2e5('0xd'));var squel=require(_0xd2e5('0xe'));var crypto=require(_0xd2e5('0xf'));var jsforce=require(_0xd2e5('0x10'));var deskjs=require(_0xd2e5('0x11'));var toCsv=require(_0xd2e5('0xa'));var querystring=require(_0xd2e5('0x12'));var Papa=require('papaparse');var Redis=require(_0xd2e5('0x13'));var authService=require(_0xd2e5('0x14'));var qs=require(_0xd2e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2e5('0x16'));var logger=require(_0xd2e5('0x17'))(_0xd2e5('0x18'));var utils=require('../../config/utils');var config=require(_0xd2e5('0x19'));var licenseUtil=require(_0xd2e5('0x1a'));var db=require(_0xd2e5('0x1b'))['db'];config['redis']=_['defaults'](config[_0xd2e5('0x1c')],{'host':_0xd2e5('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd2e5('0x1e'))[_0xd2e5('0x1f')](socket);function respondWithStatusCode(_0x48d15c,_0x504567){_0x504567=_0x504567||0xcc;return function(_0x5a71a7){if(_0x5a71a7){return _0x48d15c[_0xd2e5('0x20')](_0x504567);}return _0x48d15c[_0xd2e5('0x21')](_0x504567)[_0xd2e5('0x22')]();};}function respondWithResult(_0x50e09b,_0x59445c){_0x59445c=_0x59445c||0xc8;return function(_0x3021b4){if(_0x3021b4){return _0x50e09b[_0xd2e5('0x21')](_0x59445c)[_0xd2e5('0x23')](_0x3021b4);}};}function respondWithFilteredResult(_0x4893e0,_0xa289de){return function(_0x1885a7){if(_0x1885a7){var _0x39e4b7=typeof _0xa289de[_0xd2e5('0x24')]===_0xd2e5('0x25')&&typeof _0xa289de['limit']===_0xd2e5('0x25');var _0x5ce05e=_0x1885a7[_0xd2e5('0x26')];var _0x4b6b85=_0x39e4b7?0x0:_0xa289de['offset'];var _0x3eb02b=_0x39e4b7?_0x1885a7[_0xd2e5('0x26')]:_0xa289de[_0xd2e5('0x24')]+_0xa289de[_0xd2e5('0x27')];var _0x190569;if(_0x3eb02b>=_0x5ce05e){_0x3eb02b=_0x5ce05e;_0x190569=0xc8;}else{_0x190569=0xce;}_0x4893e0['status'](_0x190569);return _0x4893e0['set']('Content-Range',_0x4b6b85+'-'+_0x3eb02b+'/'+_0x5ce05e)[_0xd2e5('0x23')](_0x1885a7);}return null;};}function patchUpdates(_0xd450ed){return function(_0x5a66a5){try{jsonpatch[_0xd2e5('0x28')](_0x5a66a5,_0xd450ed,!![]);}catch(_0x3e614a){return BPromise[_0xd2e5('0x29')](_0x3e614a);}return _0x5a66a5['save']();};}function saveUpdates(_0x34e8e0,_0x18d5e9){return function(_0x54a8e3){if(_0x54a8e3){return _0x54a8e3[_0xd2e5('0x2a')](_0x34e8e0)['then'](function(_0x2fabce){return _0x2fabce;});}return null;};}function removeEntity(_0x1dee42,_0x3cb9b8){return function(_0x1ad756){if(_0x1ad756){return _0x1ad756['destroy']()[_0xd2e5('0x2b')](function(){var _0x339179=_0x1ad756[_0xd2e5('0x2c')]({'plain':!![]});var _0x47c067=_0xd2e5('0x2d');return db[_0xd2e5('0x2e')]['destroy']({'where':{'type':_0x47c067,'resourceId':_0x339179['id']}})[_0xd2e5('0x2b')](function(){return _0x1ad756;});})[_0xd2e5('0x2b')](function(){_0x1dee42[_0xd2e5('0x21')](0xcc)[_0xd2e5('0x22')]();});}};}function handleEntityNotFound(_0x103a2e,_0x6136d8){return function(_0x4cf166){if(!_0x4cf166){_0x103a2e[_0xd2e5('0x20')](0x194);}return _0x4cf166;};}function handleError(_0x551664,_0xb2c6ad){_0xb2c6ad=_0xb2c6ad||0x1f4;return function(_0x444895){logger[_0xd2e5('0x2f')](_0x444895[_0xd2e5('0x30')]);if(_0x444895[_0xd2e5('0x31')]){delete _0x444895[_0xd2e5('0x31')];}_0x551664['status'](_0xb2c6ad)[_0xd2e5('0x32')](_0x444895);};}exports[_0xd2e5('0x33')]=function(_0x4f55fd,_0x230f36){var _0x8fe213={},_0x121214={},_0x50877d={'count':0x0,'rows':[]};var _0x4ebeaf=_['map'](db['Team'][_0xd2e5('0x34')],function(_0x195a24){return{'name':_0x195a24['fieldName'],'type':_0x195a24[_0xd2e5('0x35')][_0xd2e5('0x36')]};});_0x121214[_0xd2e5('0x37')]=_[_0xd2e5('0x38')](_0x4ebeaf,'name');_0x121214[_0xd2e5('0x39')]=_[_0xd2e5('0x3a')](_0x4f55fd[_0xd2e5('0x39')]);_0x121214['filters']=_[_0xd2e5('0x3b')](_0x121214[_0xd2e5('0x37')],_0x121214[_0xd2e5('0x39')]);_0x8fe213[_0xd2e5('0x3c')]=_[_0xd2e5('0x3b')](_0x121214[_0xd2e5('0x37')],qs['fields'](_0x4f55fd[_0xd2e5('0x39')][_0xd2e5('0x3d')]));_0x8fe213[_0xd2e5('0x3c')]=_0x8fe213['attributes']['length']?_0x8fe213[_0xd2e5('0x3c')]:_0x121214[_0xd2e5('0x37')];if(!_0x4f55fd[_0xd2e5('0x39')]['hasOwnProperty'](_0xd2e5('0x3e'))){_0x8fe213[_0xd2e5('0x27')]=qs[_0xd2e5('0x27')](_0x4f55fd['query'][_0xd2e5('0x27')]);_0x8fe213[_0xd2e5('0x24')]=qs[_0xd2e5('0x24')](_0x4f55fd[_0xd2e5('0x39')][_0xd2e5('0x24')]);}_0x8fe213[_0xd2e5('0x3f')]=qs[_0xd2e5('0x40')](_0x4f55fd['query'][_0xd2e5('0x40')]);_0x8fe213[_0xd2e5('0x41')]=qs[_0xd2e5('0x42')](_[_0xd2e5('0x43')](_0x4f55fd['query'],_0x121214[_0xd2e5('0x42')]),_0x4ebeaf);if(_0x4f55fd[_0xd2e5('0x39')][_0xd2e5('0x44')]){_0x8fe213[_0xd2e5('0x41')]=_['merge'](_0x8fe213[_0xd2e5('0x41')],{'$or':_[_0xd2e5('0x38')](_0x4ebeaf,function(_0x166338){if(_0x166338[_0xd2e5('0x35')]!==_0xd2e5('0x45')){var _0x53b14d={};_0x53b14d[_0x166338[_0xd2e5('0x31')]]={'$like':'%'+_0x4f55fd[_0xd2e5('0x39')][_0xd2e5('0x44')]+'%'};return _0x53b14d;}})});}_0x8fe213=_[_0xd2e5('0x46')]({},_0x8fe213,_0x4f55fd[_0xd2e5('0x47')]);var _0x501505={'where':_0x8fe213[_0xd2e5('0x41')]};return db[_0xd2e5('0x48')][_0xd2e5('0x26')](_0x501505)[_0xd2e5('0x2b')](function(_0x1b18d7){_0x50877d[_0xd2e5('0x26')]=_0x1b18d7;if(_0x4f55fd[_0xd2e5('0x39')][_0xd2e5('0x49')]){_0x8fe213[_0xd2e5('0x4a')]=[{'all':!![]}];}return db[_0xd2e5('0x48')][_0xd2e5('0x4b')](_0x8fe213);})[_0xd2e5('0x2b')](function(_0x3a6ef6){_0x50877d[_0xd2e5('0x4c')]=_0x3a6ef6;return _0x50877d;})[_0xd2e5('0x2b')](respondWithFilteredResult(_0x230f36,_0x8fe213))['catch'](handleError(_0x230f36,null));};exports['show']=function(_0x1acb4b,_0x25b8a2){var _0x195e22={'raw':![],'where':{'id':_0x1acb4b[_0xd2e5('0x4d')]['id']}},_0x5c4028={};_0x5c4028[_0xd2e5('0x37')]=_['keys'](db['Team']['rawAttributes']);_0x5c4028['query']=_[_0xd2e5('0x3a')](_0x1acb4b[_0xd2e5('0x39')]);_0x5c4028[_0xd2e5('0x42')]=_['intersection'](_0x5c4028[_0xd2e5('0x37')],_0x5c4028['query']);_0x195e22[_0xd2e5('0x3c')]=_[_0xd2e5('0x3b')](_0x5c4028[_0xd2e5('0x37')],qs[_0xd2e5('0x3d')](_0x1acb4b['query'][_0xd2e5('0x3d')]));_0x195e22[_0xd2e5('0x3c')]=_0x195e22[_0xd2e5('0x3c')][_0xd2e5('0x4e')]?_0x195e22[_0xd2e5('0x3c')]:_0x5c4028['model'];if(_0x1acb4b['query'][_0xd2e5('0x49')]){_0x195e22[_0xd2e5('0x4a')]=[{'all':!![]}];}_0x195e22=_['merge']({},_0x195e22,_0x1acb4b[_0xd2e5('0x47')]);return db[_0xd2e5('0x48')][_0xd2e5('0x4f')](_0x195e22)[_0xd2e5('0x2b')](handleEntityNotFound(_0x25b8a2,null))[_0xd2e5('0x2b')](respondWithResult(_0x25b8a2,null))[_0xd2e5('0x50')](handleError(_0x25b8a2,null));};exports[_0xd2e5('0x51')]=function(_0x1b5316,_0x32c518){return db[_0xd2e5('0x48')][_0xd2e5('0x51')](_0x1b5316[_0xd2e5('0x52')],{})['then'](function(_0x38dc04){var _0x3dc261=_0x1b5316[_0xd2e5('0x53')][_0xd2e5('0x2c')]({'plain':!![]});if(!_0x3dc261)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dc261[_0xd2e5('0x54')]==='user'){var _0x108fb7=_0x38dc04[_0xd2e5('0x2c')]({'plain':!![]});var _0x31e586='Teams';return db['UserProfileSection'][_0xd2e5('0x4f')]({'where':{'name':_0x31e586,'userProfileId':_0x3dc261[_0xd2e5('0x55')]},'raw':!![]})[_0xd2e5('0x2b')](function(_0x454256){if(_0x454256&&_0x454256[_0xd2e5('0x56')]===0x0){return db[_0xd2e5('0x2e')][_0xd2e5('0x51')]({'name':_0x108fb7['name'],'resourceId':_0x108fb7['id'],'type':_0x454256[_0xd2e5('0x31')],'sectionId':_0x454256['id']},{})[_0xd2e5('0x2b')](function(){return _0x38dc04;});}else{return _0x38dc04;}})[_0xd2e5('0x50')](function(_0x423519){logger[_0xd2e5('0x2f')](_0xd2e5('0x57'),_0x423519);throw _0x423519;});}return _0x38dc04;})[_0xd2e5('0x2b')](respondWithResult(_0x32c518,0xc9))[_0xd2e5('0x50')](handleError(_0x32c518,null));};exports[_0xd2e5('0x2a')]=function(_0x41a25b,_0x18b0d7){if(_0x41a25b['body']['id']){delete _0x41a25b[_0xd2e5('0x52')]['id'];}return db[_0xd2e5('0x48')][_0xd2e5('0x4f')]({'where':{'id':_0x41a25b[_0xd2e5('0x4d')]['id']}})[_0xd2e5('0x2b')](handleEntityNotFound(_0x18b0d7,null))[_0xd2e5('0x2b')](saveUpdates(_0x41a25b[_0xd2e5('0x52')],null))[_0xd2e5('0x2b')](respondWithResult(_0x18b0d7,null))[_0xd2e5('0x50')](handleError(_0x18b0d7,null));};exports['destroy']=function(_0x589597,_0x2f57fd){return db[_0xd2e5('0x48')]['find']({'where':{'id':_0x589597[_0xd2e5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f57fd,null))[_0xd2e5('0x2b')](removeEntity(_0x2f57fd,null))[_0xd2e5('0x50')](handleError(_0x2f57fd,null));};exports[_0xd2e5('0x58')]=function(_0x5c21e2,_0x50b498,_0xe5c071){return db[_0xd2e5('0x48')][_0xd2e5('0x59')]({'where':{'id':_0x5c21e2[_0xd2e5('0x4d')]['id']}})[_0xd2e5('0x2b')](handleEntityNotFound(_0x50b498,null))[_0xd2e5('0x2b')](function(_0x376688){if(!_0x5c21e2['query'][_0xd2e5('0x5a')]||!utils['isValidChannel'](_0x5c21e2[_0xd2e5('0x39')][_0xd2e5('0x5a')])){throw new db[(_0xd2e5('0x5b'))]['ValidationError'](_0xd2e5('0x5c'));}var _0x5592a9={};var _0x367a3f={};_0x367a3f[_0xd2e5('0x37')]=_[_0xd2e5('0x3a')](db[_['capitalize'](_0x5c21e2['query'][_0xd2e5('0x5a')][_0xd2e5('0x5d')]())+_0xd2e5('0x5e')][_0xd2e5('0x34')]);_0x367a3f['query']=_[_0xd2e5('0x3a')](_0x5c21e2[_0xd2e5('0x39')]);_0x367a3f['filters']=_[_0xd2e5('0x3b')](_0x367a3f[_0xd2e5('0x37')],_0x367a3f['query']);_0x5592a9['attributes']=_['intersection'](_0x367a3f['model'],qs[_0xd2e5('0x3d')](_0x5c21e2[_0xd2e5('0x39')][_0xd2e5('0x3d')]));_0x5592a9[_0xd2e5('0x3c')]=_0x5592a9[_0xd2e5('0x3c')][_0xd2e5('0x4e')]?_0x5592a9['attributes']:_0x367a3f[_0xd2e5('0x37')];_0x5592a9[_0xd2e5('0x27')]=qs['limit'](_0x5c21e2[_0xd2e5('0x39')][_0xd2e5('0x27')]);_0x5592a9[_0xd2e5('0x24')]=qs[_0xd2e5('0x24')](_0x5c21e2[_0xd2e5('0x39')][_0xd2e5('0x24')]);_0x5592a9['order']=qs['sort'](_0x5c21e2['query'][_0xd2e5('0x40')]);_0x5592a9[_0xd2e5('0x41')]=qs[_0xd2e5('0x42')](_['pick'](_0x5c21e2[_0xd2e5('0x39')],_0x367a3f[_0xd2e5('0x42')]));_0x5592a9=_[_0xd2e5('0x46')]({},_0x5592a9,_0x5c21e2[_0xd2e5('0x47')]);return _0x376688['get'+_[_0xd2e5('0x5f')](_0x5c21e2[_0xd2e5('0x39')]['channel']['toLowerCase']())+'Queues'](_0x5592a9);})['then'](respondWithResult(_0x50b498,null))[_0xd2e5('0x50')](handleError(_0x50b498,null));};exports[_0xd2e5('0x60')]=function(_0xa1bd73,_0x1d1953,_0x3e015c){return db[_0xd2e5('0x48')]['findOne']({'where':{'id':_0xa1bd73[_0xd2e5('0x4d')]['id']}})[_0xd2e5('0x2b')](function(_0x181ea9){if(_0x181ea9){if(!_0xa1bd73['body'][_0xd2e5('0x5a')]||!utils[_0xd2e5('0x61')](_0xa1bd73[_0xd2e5('0x52')][_0xd2e5('0x5a')])){throw new db[(_0xd2e5('0x5b'))]['ValidationError'](_0xd2e5('0x5c'));}return _0x181ea9[_0xd2e5('0x62')+_[_0xd2e5('0x5f')](_0xa1bd73['body'][_0xd2e5('0x5a')]['toLowerCase']())+_0xd2e5('0x63')](_0xa1bd73[_0xd2e5('0x52')][_0xd2e5('0x64')]);}return null;})['then'](handleEntityNotFound(_0x1d1953,null))[_0xd2e5('0x2b')](respondWithStatusCode(_0x1d1953,null))[_0xd2e5('0x50')](handleError(_0x1d1953,null));};exports[_0xd2e5('0x65')]=function(_0x303400,_0x252714,_0x2d5347){return db[_0xd2e5('0x48')]['findOne']({'where':{'id':_0x303400['params']['id']}})[_0xd2e5('0x2b')](function(_0x4973d2){if(_0x4973d2){if(!_0x303400[_0xd2e5('0x39')][_0xd2e5('0x5a')]||!utils[_0xd2e5('0x61')](_0x303400[_0xd2e5('0x39')][_0xd2e5('0x5a')])){throw new db['Sequelize'][(_0xd2e5('0x66'))](_0xd2e5('0x5c'));}return _0x4973d2['remove'+_['capitalize'](_0x303400[_0xd2e5('0x39')][_0xd2e5('0x5a')][_0xd2e5('0x5d')]())+_0xd2e5('0x63')](_0x303400[_0xd2e5('0x39')][_0xd2e5('0x64')]);}return null;})[_0xd2e5('0x2b')](handleEntityNotFound(_0x252714,null))[_0xd2e5('0x2b')](respondWithStatusCode(_0x252714,null))['catch'](handleError(_0x252714,null));};exports['addAgents']=function(_0x1c15e5,_0x5389d5){return db['Team']['find']({'where':{'id':_0x1c15e5[_0xd2e5('0x4d')]['id']}})[_0xd2e5('0x2b')](handleEntityNotFound(_0x5389d5,null))[_0xd2e5('0x2b')](function(_0xfb14b9){if(_0xfb14b9){var _0xb2e69c=[_0xd2e5('0x67'),_0xd2e5('0x68'),_0xd2e5('0x69'),_0xd2e5('0x6a'),_0xd2e5('0x6b'),_0xd2e5('0x6c'),'Whatsapp'];return db[_0xd2e5('0x6d')][_0xd2e5('0x6e')](function(_0x110956){var _0x57084b=_[_0xd2e5('0x38')](_0xb2e69c,function(_0x271d3f){var _0x5eb6a9={'attributes':['id',_0xd2e5('0x31')]};if(_0x271d3f===_0xd2e5('0x67')){_0x5eb6a9[_0xd2e5('0x6f')]={'attributes':[_0xd2e5('0x70')]};}return _0xfb14b9['get'+_0x271d3f+_0xd2e5('0x63')](_0x5eb6a9)[_0xd2e5('0x2b')](function(_0x2190df){var _0x2dbca5=_[_0xd2e5('0x38')](_0x2190df,function(_0x55e147){var _0x53c8ec=_[_0xd2e5('0x38')](_0x1c15e5['body']['ids'],function(_0x50cbdb){var _0x2b6d5c={'where':{'UserId':_0x50cbdb,[_0x271d3f+'QueueId']:_0x55e147['id']},'transaction':_0x110956};if(_0x271d3f==='Voice'){_0x2b6d5c[_0xd2e5('0x71')]={'penalty':_0x55e147[_0xd2e5('0x72')][_0xd2e5('0x70')]};}return db[_0xd2e5('0x73')+_0x271d3f+_0xd2e5('0x5e')]['findOrCreate'](_0x2b6d5c)[_0xd2e5('0x2b')](function(){socket[_0xd2e5('0x74')](_0xd2e5('0x53')+_0x271d3f+'Queue:save',{'UserId':_0x50cbdb,[_0x271d3f+'QueueId']:_0x55e147['id']});if(_0x271d3f!==_0xd2e5('0x67'))return;return db['User']['findAll']({'where':{'id':_0x1c15e5['body'][_0xd2e5('0x64')],'online':0x1},'attributes':['id','name',_0xd2e5('0x75'),'voicePause',_0xd2e5('0x76')],'raw':!![]})[_0xd2e5('0x2b')](function(_0x176356){var _0x144d00=_[_0xd2e5('0x38')](_0x176356,function(_0x136523){return db[_0xd2e5('0x77')]['upsert']({'membername':_0x136523[_0xd2e5('0x31')],'UserId':_0x136523['id'],'queue_name':_0x55e147[_0xd2e5('0x31')],'VoiceQueueId':_0x55e147['id'],'interface':_[_0xd2e5('0x78')](_0x136523['interface'])?util[_0xd2e5('0x79')](_0xd2e5('0x7a'),_0x136523[_0xd2e5('0x31')]):_0x136523[_0xd2e5('0x76')],'paused':_0x136523[_0xd2e5('0x7b')]||![],'penalty':_0x55e147['TeamVoiceQueue'][_0xd2e5('0x70')]},{'transaction':_0x110956});});return Promise[_0xd2e5('0x7c')](_0x144d00);});});});return Promise['all'](_0x53c8ec);});return Promise[_0xd2e5('0x7c')](_0x2dbca5);});});return Promise[_0xd2e5('0x7c')](_0x57084b)[_0xd2e5('0x2b')](function(){return _0xfb14b9['addAgents'](_0x1c15e5['body'][_0xd2e5('0x64')],{'transaction':_0x110956})[_0xd2e5('0x7d')](function(_0x533171){return _0x533171;});});});}})[_0xd2e5('0x2b')](respondWithResult(_0x5389d5,null))[_0xd2e5('0x50')](handleError(_0x5389d5,null));};exports[_0xd2e5('0x7e')]=function(_0x19a039,_0x151f62){return db[_0xd2e5('0x48')]['find']({'where':{'id':_0x19a039[_0xd2e5('0x4d')]['id']}})[_0xd2e5('0x2b')](handleEntityNotFound(_0x151f62,null))[_0xd2e5('0x2b')](function(_0x4fe328){if(_0x4fe328){var _0x2fe1d6=[_0xd2e5('0x67'),_0xd2e5('0x68'),_0xd2e5('0x69'),_0xd2e5('0x6a'),_0xd2e5('0x6b'),_0xd2e5('0x6c'),_0xd2e5('0x7f')];return db[_0xd2e5('0x6d')]['transaction'](function(_0x462e0e){var _0x5b7edf=_[_0xd2e5('0x38')](_0x2fe1d6,function(_0x3e3352){var _0x2a8738={'attributes':['id',_0xd2e5('0x31')]};return _0x4fe328[_0xd2e5('0x2c')+_0x3e3352+_0xd2e5('0x63')](_0x2a8738)[_0xd2e5('0x2b')](function(_0x5472b0){var _0x4c67b3=_[_0xd2e5('0x38')](_0x5472b0,function(_0x87f368){return _0x87f368[_0xd2e5('0x7e')](_0x19a039[_0xd2e5('0x39')]['ids'],{'transaction':_0x462e0e})['then'](function(){var _0x3f56d9=JSON[_0xd2e5('0x80')]('['+_0x19a039[_0xd2e5('0x39')][_0xd2e5('0x64')]+']');var _0x7009f5=_[_0xd2e5('0x38')](_0x3f56d9,function(_0x2042d4){socket[_0xd2e5('0x74')]('user'+_0x3e3352+_0xd2e5('0x81'),{'UserId':Number(_0x2042d4),[_0x3e3352+_0xd2e5('0x82')]:_0x87f368['id']});if(_0x3e3352!==_0xd2e5('0x67'))return;return db[_0xd2e5('0x77')][_0xd2e5('0x83')]({'where':{'VoiceQueueId':_0x87f368['id'],'UserId':_0x2042d4},'transaction':_0x462e0e});});return Promise[_0xd2e5('0x7c')](_0x7009f5);});});return Promise[_0xd2e5('0x7c')](_0x4c67b3);});});return Promise['all'](_0x5b7edf)[_0xd2e5('0x2b')](function(){return _0x4fe328['removeAgents'](_0x19a039[_0xd2e5('0x39')]['ids'],{'transaction':_0x462e0e});});});}})['then'](respondWithStatusCode(_0x151f62,null))['catch'](handleError(_0x151f62,null));};exports['getAgents']=function(_0x36099e,_0x43b918,_0x50be3f){var _0x2411d9={};var _0x56574c={};var _0x4528d1;var _0xcbdd17;return db[_0xd2e5('0x48')][_0xd2e5('0x59')]({'where':{'id':_0x36099e['params']['id']}})[_0xd2e5('0x2b')](handleEntityNotFound(_0x43b918,null))['then'](function(_0x2a1a47){if(_0x2a1a47){_0x4528d1=_0x2a1a47;_0x56574c[_0xd2e5('0x37')]=_['keys'](db[_0xd2e5('0x73')][_0xd2e5('0x34')]);_0x56574c['query']=_['keys'](_0x36099e[_0xd2e5('0x39')]);_0x56574c['filters']=_[_0xd2e5('0x3b')](_0x56574c[_0xd2e5('0x37')],_0x56574c[_0xd2e5('0x39')]);_0x2411d9[_0xd2e5('0x3c')]=_['intersection'](_0x56574c[_0xd2e5('0x37')],qs[_0xd2e5('0x3d')](_0x36099e[_0xd2e5('0x39')][_0xd2e5('0x3d')]));_0x2411d9[_0xd2e5('0x3c')]=_0x2411d9[_0xd2e5('0x3c')][_0xd2e5('0x4e')]?_0x2411d9[_0xd2e5('0x3c')]:_0x56574c[_0xd2e5('0x37')];_0x2411d9[_0xd2e5('0x3f')]=qs[_0xd2e5('0x40')](_0x36099e[_0xd2e5('0x39')]['sort']);_0x2411d9['where']=qs[_0xd2e5('0x42')](_['pick'](_0x36099e[_0xd2e5('0x39')],_0x56574c[_0xd2e5('0x42')]));if(_0x36099e['query'][_0xd2e5('0x44')]){_0x2411d9[_0xd2e5('0x41')]=_[_0xd2e5('0x46')](_0x2411d9[_0xd2e5('0x41')],{'$or':_[_0xd2e5('0x38')](_0x2411d9[_0xd2e5('0x3c')],function(_0x1c9377){var _0x3bc15c={};_0x3bc15c[_0x1c9377]={'$like':'%'+_0x36099e[_0xd2e5('0x39')]['filter']+'%'};return _0x3bc15c;})});}_0x2411d9=_[_0xd2e5('0x46')]({},_0x2411d9,_0x36099e['options']);return _0x4528d1[_0xd2e5('0x84')](_0x2411d9);}})[_0xd2e5('0x2b')](function(_0x5c42d8){if(_0x5c42d8){_0xcbdd17=_0x5c42d8[_0xd2e5('0x4e')];if(!_0x36099e['query']['hasOwnProperty'](_0xd2e5('0x3e'))){_0x2411d9[_0xd2e5('0x27')]=qs[_0xd2e5('0x27')](_0x36099e[_0xd2e5('0x39')][_0xd2e5('0x27')]);_0x2411d9[_0xd2e5('0x24')]=qs[_0xd2e5('0x24')](_0x36099e[_0xd2e5('0x39')][_0xd2e5('0x24')]);}return _0x4528d1[_0xd2e5('0x84')](_0x2411d9);}})[_0xd2e5('0x2b')](function(_0x151f79){if(_0x151f79){return _0x151f79?{'count':_0xcbdd17,'rows':_0x151f79}:null;}})['then'](respondWithResult(_0x43b918,null))[_0xd2e5('0x50')](handleError(_0x43b918,null));}; \ No newline at end of file +var _0xc5e5=['Team','findAll','catch','show','params','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','isValidChannel','channel','Sequelize','Unknown\x20channel','toLowerCase','Queue','capitalize','Queues','addQueues','ValidationError','add','ids','removeQueues','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','spread','removeAgents','parse','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','defaults','redis','localhost','./team.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Teams','UserProfileResource','end','error','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0xc5e5,0x1e1));var _0x5c5e=function(_0x18e38e,_0x20b7cd){_0x18e38e=_0x18e38e-0x0;var _0x6c41=_0xc5e5[_0x18e38e];return _0x6c41;};'use strict';var emlformat=require(_0x5c5e('0x0'));var rimraf=require(_0x5c5e('0x1'));var zipdir=require(_0x5c5e('0x2'));var jsonpatch=require(_0x5c5e('0x3'));var rp=require('request-promise');var moment=require(_0x5c5e('0x4'));var BPromise=require(_0x5c5e('0x5'));var Mustache=require(_0x5c5e('0x6'));var util=require(_0x5c5e('0x7'));var path=require(_0x5c5e('0x8'));var sox=require(_0x5c5e('0x9'));var csv=require(_0x5c5e('0xa'));var ejs=require(_0x5c5e('0xb'));var fs=require('fs');var fs_extra=require(_0x5c5e('0xc'));var _=require(_0x5c5e('0xd'));var squel=require(_0x5c5e('0xe'));var crypto=require('crypto');var jsforce=require(_0x5c5e('0xf'));var deskjs=require(_0x5c5e('0x10'));var toCsv=require(_0x5c5e('0xa'));var querystring=require(_0x5c5e('0x11'));var Papa=require(_0x5c5e('0x12'));var Redis=require(_0x5c5e('0x13'));var authService=require(_0x5c5e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5c5e('0x15'));var hardwareService=require(_0x5c5e('0x16'));var logger=require(_0x5c5e('0x17'))(_0x5c5e('0x18'));var utils=require(_0x5c5e('0x19'));var config=require(_0x5c5e('0x1a'));var licenseUtil=require(_0x5c5e('0x1b'));var db=require(_0x5c5e('0x1c'))['db'];config['redis']=_[_0x5c5e('0x1d')](config[_0x5c5e('0x1e')],{'host':_0x5c5e('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5c5e('0x20'))[_0x5c5e('0x21')](socket);function respondWithStatusCode(_0x3cba01,_0x4e2349){_0x4e2349=_0x4e2349||0xcc;return function(_0x288c4b){if(_0x288c4b){return _0x3cba01[_0x5c5e('0x22')](_0x4e2349);}return _0x3cba01[_0x5c5e('0x23')](_0x4e2349)['end']();};}function respondWithResult(_0x3afa4a,_0x60c2d8){_0x60c2d8=_0x60c2d8||0xc8;return function(_0x3ac24){if(_0x3ac24){return _0x3afa4a[_0x5c5e('0x23')](_0x60c2d8)[_0x5c5e('0x24')](_0x3ac24);}};}function respondWithFilteredResult(_0x2235a3,_0x3a6f59){return function(_0x557b62){if(_0x557b62){var _0x358710=typeof _0x3a6f59[_0x5c5e('0x25')]===_0x5c5e('0x26')&&typeof _0x3a6f59['limit']===_0x5c5e('0x26');var _0x4d7734=_0x557b62[_0x5c5e('0x27')];var _0x2a39a1=_0x358710?0x0:_0x3a6f59[_0x5c5e('0x25')];var _0x31dbaa=_0x358710?_0x557b62['count']:_0x3a6f59[_0x5c5e('0x25')]+_0x3a6f59[_0x5c5e('0x28')];var _0x5420e1;if(_0x31dbaa>=_0x4d7734){_0x31dbaa=_0x4d7734;_0x5420e1=0xc8;}else{_0x5420e1=0xce;}_0x2235a3['status'](_0x5420e1);return _0x2235a3[_0x5c5e('0x29')](_0x5c5e('0x2a'),_0x2a39a1+'-'+_0x31dbaa+'/'+_0x4d7734)[_0x5c5e('0x24')](_0x557b62);}return null;};}function patchUpdates(_0x5ad422){return function(_0x123f0a){try{jsonpatch[_0x5c5e('0x2b')](_0x123f0a,_0x5ad422,!![]);}catch(_0x25068e){return BPromise[_0x5c5e('0x2c')](_0x25068e);}return _0x123f0a[_0x5c5e('0x2d')]();};}function saveUpdates(_0x4b5494,_0x51dd1d){return function(_0x287773){if(_0x287773){return _0x287773[_0x5c5e('0x2e')](_0x4b5494)['then'](function(_0x5c6ceb){return _0x5c6ceb;});}return null;};}function removeEntity(_0x22aaf1,_0xc48618){return function(_0x274543){if(_0x274543){return _0x274543[_0x5c5e('0x2f')]()[_0x5c5e('0x30')](function(){var _0x198a2c=_0x274543[_0x5c5e('0x31')]({'plain':!![]});var _0xf172d5=_0x5c5e('0x32');return db[_0x5c5e('0x33')][_0x5c5e('0x2f')]({'where':{'type':_0xf172d5,'resourceId':_0x198a2c['id']}})[_0x5c5e('0x30')](function(){return _0x274543;});})[_0x5c5e('0x30')](function(){_0x22aaf1[_0x5c5e('0x23')](0xcc)[_0x5c5e('0x34')]();});}};}function handleEntityNotFound(_0x3a864a,_0x56c72b){return function(_0x35ca1d){if(!_0x35ca1d){_0x3a864a[_0x5c5e('0x22')](0x194);}return _0x35ca1d;};}function handleError(_0x20ec8d,_0x17dacb){_0x17dacb=_0x17dacb||0x1f4;return function(_0x275838){logger[_0x5c5e('0x35')](_0x275838[_0x5c5e('0x36')]);if(_0x275838[_0x5c5e('0x37')]){delete _0x275838[_0x5c5e('0x37')];}_0x20ec8d[_0x5c5e('0x23')](_0x17dacb)[_0x5c5e('0x38')](_0x275838);};}exports[_0x5c5e('0x39')]=function(_0x13e534,_0x656e2){var _0x3e1116={},_0x155bd7={},_0x298de4={'count':0x0,'rows':[]};var _0x5c94a1=_['map'](db['Team'][_0x5c5e('0x3a')],function(_0x5519f5){return{'name':_0x5519f5['fieldName'],'type':_0x5519f5[_0x5c5e('0x3b')][_0x5c5e('0x3c')]};});_0x155bd7[_0x5c5e('0x3d')]=_[_0x5c5e('0x3e')](_0x5c94a1,_0x5c5e('0x37'));_0x155bd7['query']=_[_0x5c5e('0x3f')](_0x13e534[_0x5c5e('0x40')]);_0x155bd7[_0x5c5e('0x41')]=_[_0x5c5e('0x42')](_0x155bd7[_0x5c5e('0x3d')],_0x155bd7[_0x5c5e('0x40')]);_0x3e1116[_0x5c5e('0x43')]=_[_0x5c5e('0x42')](_0x155bd7[_0x5c5e('0x3d')],qs[_0x5c5e('0x44')](_0x13e534[_0x5c5e('0x40')]['fields']));_0x3e1116[_0x5c5e('0x43')]=_0x3e1116[_0x5c5e('0x43')][_0x5c5e('0x45')]?_0x3e1116[_0x5c5e('0x43')]:_0x155bd7[_0x5c5e('0x3d')];if(!_0x13e534[_0x5c5e('0x40')][_0x5c5e('0x46')]('nolimit')){_0x3e1116[_0x5c5e('0x28')]=qs[_0x5c5e('0x28')](_0x13e534[_0x5c5e('0x40')][_0x5c5e('0x28')]);_0x3e1116[_0x5c5e('0x25')]=qs[_0x5c5e('0x25')](_0x13e534[_0x5c5e('0x40')]['offset']);}_0x3e1116[_0x5c5e('0x47')]=qs[_0x5c5e('0x48')](_0x13e534[_0x5c5e('0x40')][_0x5c5e('0x48')]);_0x3e1116[_0x5c5e('0x49')]=qs['filters'](_[_0x5c5e('0x4a')](_0x13e534['query'],_0x155bd7[_0x5c5e('0x41')]),_0x5c94a1);if(_0x13e534[_0x5c5e('0x40')][_0x5c5e('0x4b')]){_0x3e1116[_0x5c5e('0x49')]=_['merge'](_0x3e1116[_0x5c5e('0x49')],{'$or':_[_0x5c5e('0x3e')](_0x5c94a1,function(_0x403ab8){if(_0x403ab8[_0x5c5e('0x3b')]!==_0x5c5e('0x4c')){var _0x5c902a={};_0x5c902a[_0x403ab8['name']]={'$like':'%'+_0x13e534[_0x5c5e('0x40')]['filter']+'%'};return _0x5c902a;}})});}_0x3e1116=_[_0x5c5e('0x4d')]({},_0x3e1116,_0x13e534[_0x5c5e('0x4e')]);var _0x5a429a={'where':_0x3e1116[_0x5c5e('0x49')]};return db[_0x5c5e('0x4f')][_0x5c5e('0x27')](_0x5a429a)[_0x5c5e('0x30')](function(_0x5192e1){_0x298de4[_0x5c5e('0x27')]=_0x5192e1;if(_0x13e534[_0x5c5e('0x40')]['includeAll']){_0x3e1116['include']=[{'all':!![]}];}return db[_0x5c5e('0x4f')][_0x5c5e('0x50')](_0x3e1116);})[_0x5c5e('0x30')](function(_0x5cf55d){_0x298de4['rows']=_0x5cf55d;return _0x298de4;})['then'](respondWithFilteredResult(_0x656e2,_0x3e1116))[_0x5c5e('0x51')](handleError(_0x656e2,null));};exports[_0x5c5e('0x52')]=function(_0x1b4159,_0xb355c4){var _0x144758={'raw':![],'where':{'id':_0x1b4159[_0x5c5e('0x53')]['id']}},_0x4d1c00={};_0x4d1c00['model']=_[_0x5c5e('0x3f')](db[_0x5c5e('0x4f')]['rawAttributes']);_0x4d1c00[_0x5c5e('0x40')]=_['keys'](_0x1b4159[_0x5c5e('0x40')]);_0x4d1c00[_0x5c5e('0x41')]=_[_0x5c5e('0x42')](_0x4d1c00[_0x5c5e('0x3d')],_0x4d1c00['query']);_0x144758[_0x5c5e('0x43')]=_[_0x5c5e('0x42')](_0x4d1c00['model'],qs[_0x5c5e('0x44')](_0x1b4159[_0x5c5e('0x40')][_0x5c5e('0x44')]));_0x144758[_0x5c5e('0x43')]=_0x144758[_0x5c5e('0x43')]['length']?_0x144758[_0x5c5e('0x43')]:_0x4d1c00['model'];if(_0x1b4159[_0x5c5e('0x40')][_0x5c5e('0x54')]){_0x144758[_0x5c5e('0x55')]=[{'all':!![]}];}_0x144758=_['merge']({},_0x144758,_0x1b4159[_0x5c5e('0x4e')]);return db[_0x5c5e('0x4f')][_0x5c5e('0x56')](_0x144758)['then'](handleEntityNotFound(_0xb355c4,null))[_0x5c5e('0x30')](respondWithResult(_0xb355c4,null))[_0x5c5e('0x51')](handleError(_0xb355c4,null));};exports[_0x5c5e('0x57')]=function(_0x413058,_0x35e3ef){return db[_0x5c5e('0x4f')][_0x5c5e('0x57')](_0x413058['body'],{})[_0x5c5e('0x30')](function(_0x12b9de){var _0x33c64e=_0x413058[_0x5c5e('0x58')][_0x5c5e('0x31')]({'plain':!![]});if(!_0x33c64e)throw new Error(_0x5c5e('0x59'));if(_0x33c64e[_0x5c5e('0x5a')]===_0x5c5e('0x58')){var _0x239c07=_0x12b9de[_0x5c5e('0x31')]({'plain':!![]});var _0xd096d=_0x5c5e('0x32');return db[_0x5c5e('0x5b')][_0x5c5e('0x56')]({'where':{'name':_0xd096d,'userProfileId':_0x33c64e[_0x5c5e('0x5c')]},'raw':!![]})[_0x5c5e('0x30')](function(_0x177969){if(_0x177969&&_0x177969[_0x5c5e('0x5d')]===0x0){return db[_0x5c5e('0x33')][_0x5c5e('0x57')]({'name':_0x239c07[_0x5c5e('0x37')],'resourceId':_0x239c07['id'],'type':_0x177969[_0x5c5e('0x37')],'sectionId':_0x177969['id']},{})[_0x5c5e('0x30')](function(){return _0x12b9de;});}else{return _0x12b9de;}})[_0x5c5e('0x51')](function(_0x8b0c3c){logger[_0x5c5e('0x35')](_0x5c5e('0x5e'),_0x8b0c3c);throw _0x8b0c3c;});}return _0x12b9de;})[_0x5c5e('0x30')](respondWithResult(_0x35e3ef,0xc9))[_0x5c5e('0x51')](handleError(_0x35e3ef,null));};exports[_0x5c5e('0x2e')]=function(_0x5487d6,_0xa7428){if(_0x5487d6['body']['id']){delete _0x5487d6[_0x5c5e('0x5f')]['id'];}return db['Team'][_0x5c5e('0x56')]({'where':{'id':_0x5487d6[_0x5c5e('0x53')]['id']}})[_0x5c5e('0x30')](handleEntityNotFound(_0xa7428,null))[_0x5c5e('0x30')](saveUpdates(_0x5487d6[_0x5c5e('0x5f')],null))['then'](respondWithResult(_0xa7428,null))[_0x5c5e('0x51')](handleError(_0xa7428,null));};exports[_0x5c5e('0x2f')]=function(_0x29b2bf,_0x5751ff){return db[_0x5c5e('0x4f')]['find']({'where':{'id':_0x29b2bf[_0x5c5e('0x53')]['id']}})['then'](handleEntityNotFound(_0x5751ff,null))[_0x5c5e('0x30')](removeEntity(_0x5751ff,null))[_0x5c5e('0x51')](handleError(_0x5751ff,null));};exports[_0x5c5e('0x60')]=function(_0x3959a3,_0x38ad7d,_0x5d5c5a){return db[_0x5c5e('0x4f')][_0x5c5e('0x61')]({'where':{'id':_0x3959a3[_0x5c5e('0x53')]['id']}})[_0x5c5e('0x30')](handleEntityNotFound(_0x38ad7d,null))['then'](function(_0x8835d9){if(!_0x3959a3[_0x5c5e('0x40')]['channel']||!utils[_0x5c5e('0x62')](_0x3959a3[_0x5c5e('0x40')][_0x5c5e('0x63')])){throw new db[(_0x5c5e('0x64'))]['ValidationError'](_0x5c5e('0x65'));}var _0x253d46={};var _0x3403b4={};_0x3403b4['model']=_['keys'](db[_['capitalize'](_0x3959a3['query'][_0x5c5e('0x63')][_0x5c5e('0x66')]())+_0x5c5e('0x67')][_0x5c5e('0x3a')]);_0x3403b4['query']=_[_0x5c5e('0x3f')](_0x3959a3[_0x5c5e('0x40')]);_0x3403b4[_0x5c5e('0x41')]=_[_0x5c5e('0x42')](_0x3403b4[_0x5c5e('0x3d')],_0x3403b4[_0x5c5e('0x40')]);_0x253d46[_0x5c5e('0x43')]=_['intersection'](_0x3403b4[_0x5c5e('0x3d')],qs['fields'](_0x3959a3[_0x5c5e('0x40')][_0x5c5e('0x44')]));_0x253d46[_0x5c5e('0x43')]=_0x253d46[_0x5c5e('0x43')]['length']?_0x253d46['attributes']:_0x3403b4[_0x5c5e('0x3d')];_0x253d46[_0x5c5e('0x28')]=qs[_0x5c5e('0x28')](_0x3959a3['query'][_0x5c5e('0x28')]);_0x253d46[_0x5c5e('0x25')]=qs[_0x5c5e('0x25')](_0x3959a3[_0x5c5e('0x40')][_0x5c5e('0x25')]);_0x253d46[_0x5c5e('0x47')]=qs[_0x5c5e('0x48')](_0x3959a3[_0x5c5e('0x40')]['sort']);_0x253d46[_0x5c5e('0x49')]=qs['filters'](_[_0x5c5e('0x4a')](_0x3959a3[_0x5c5e('0x40')],_0x3403b4[_0x5c5e('0x41')]));_0x253d46=_[_0x5c5e('0x4d')]({},_0x253d46,_0x3959a3[_0x5c5e('0x4e')]);return _0x8835d9['get'+_[_0x5c5e('0x68')](_0x3959a3[_0x5c5e('0x40')][_0x5c5e('0x63')][_0x5c5e('0x66')]())+_0x5c5e('0x69')](_0x253d46);})[_0x5c5e('0x30')](respondWithResult(_0x38ad7d,null))[_0x5c5e('0x51')](handleError(_0x38ad7d,null));};exports[_0x5c5e('0x6a')]=function(_0x17f66b,_0x37db71,_0x1bffa2){return db[_0x5c5e('0x4f')][_0x5c5e('0x61')]({'where':{'id':_0x17f66b[_0x5c5e('0x53')]['id']}})[_0x5c5e('0x30')](function(_0xbae4dd){if(_0xbae4dd){if(!_0x17f66b[_0x5c5e('0x5f')][_0x5c5e('0x63')]||!utils[_0x5c5e('0x62')](_0x17f66b['body'][_0x5c5e('0x63')])){throw new db['Sequelize'][(_0x5c5e('0x6b'))](_0x5c5e('0x65'));}return _0xbae4dd[_0x5c5e('0x6c')+_[_0x5c5e('0x68')](_0x17f66b['body'][_0x5c5e('0x63')][_0x5c5e('0x66')]())+_0x5c5e('0x69')](_0x17f66b[_0x5c5e('0x5f')][_0x5c5e('0x6d')]);}return null;})['then'](handleEntityNotFound(_0x37db71,null))[_0x5c5e('0x30')](respondWithStatusCode(_0x37db71,null))[_0x5c5e('0x51')](handleError(_0x37db71,null));};exports[_0x5c5e('0x6e')]=function(_0x47d2c8,_0x160e0b,_0x20a38e){return db['Team']['findOne']({'where':{'id':_0x47d2c8['params']['id']}})[_0x5c5e('0x30')](function(_0x407983){if(_0x407983){if(!_0x47d2c8[_0x5c5e('0x40')]['channel']||!utils[_0x5c5e('0x62')](_0x47d2c8[_0x5c5e('0x40')]['channel'])){throw new db['Sequelize'][(_0x5c5e('0x6b'))]('Unknown\x20channel');}return _0x407983['remove'+_['capitalize'](_0x47d2c8[_0x5c5e('0x40')]['channel'][_0x5c5e('0x66')]())+_0x5c5e('0x69')](_0x47d2c8[_0x5c5e('0x40')]['ids']);}return null;})[_0x5c5e('0x30')](handleEntityNotFound(_0x160e0b,null))[_0x5c5e('0x30')](respondWithStatusCode(_0x160e0b,null))[_0x5c5e('0x51')](handleError(_0x160e0b,null));};exports[_0x5c5e('0x6f')]=function(_0x382188,_0x973cf1){return db[_0x5c5e('0x4f')][_0x5c5e('0x56')]({'where':{'id':_0x382188[_0x5c5e('0x53')]['id']}})['then'](handleEntityNotFound(_0x973cf1,null))[_0x5c5e('0x30')](function(_0x4f68fa){if(_0x4f68fa){var _0x27df04=[_0x5c5e('0x70'),_0x5c5e('0x71'),_0x5c5e('0x72'),_0x5c5e('0x73'),_0x5c5e('0x74'),_0x5c5e('0x75'),_0x5c5e('0x76')];return db[_0x5c5e('0x77')]['transaction'](function(_0x4f1b76){var _0x5ef5f5=_[_0x5c5e('0x3e')](_0x27df04,function(_0x19f031){var _0x57cd11={'attributes':['id','name']};if(_0x19f031===_0x5c5e('0x70')){_0x57cd11[_0x5c5e('0x78')]={'attributes':['penalty']};}return _0x4f68fa[_0x5c5e('0x31')+_0x19f031+_0x5c5e('0x69')](_0x57cd11)['then'](function(_0x377a0d){var _0x28212c=_[_0x5c5e('0x3e')](_0x377a0d,function(_0xb9bb69){var _0x322ca8=_['map'](_0x382188['body'][_0x5c5e('0x6d')],function(_0x4b139d){var _0x4857ab={'where':{'UserId':_0x4b139d,[_0x19f031+_0x5c5e('0x79')]:_0xb9bb69['id']},'transaction':_0x4f1b76};if(_0x19f031===_0x5c5e('0x70')){_0x4857ab[_0x5c5e('0x1d')]={'penalty':_0xb9bb69[_0x5c5e('0x7a')][_0x5c5e('0x7b')]};}return db[_0x5c5e('0x7c')+_0x19f031+_0x5c5e('0x67')][_0x5c5e('0x7d')](_0x4857ab)[_0x5c5e('0x30')](function(){socket[_0x5c5e('0x7e')](_0x5c5e('0x58')+_0x19f031+'Queue:save',{'UserId':_0x4b139d,[_0x19f031+_0x5c5e('0x79')]:_0xb9bb69['id']});if(_0x19f031!=='Voice')return;return db[_0x5c5e('0x7c')][_0x5c5e('0x50')]({'where':{'id':_0x382188['body'][_0x5c5e('0x6d')],'online':0x1},'attributes':['id',_0x5c5e('0x37'),_0x5c5e('0x7f'),_0x5c5e('0x80'),_0x5c5e('0x81')],'raw':!![]})[_0x5c5e('0x30')](function(_0x4b9169){var _0x2dc668=_[_0x5c5e('0x3e')](_0x4b9169,function(_0x413dc7){return db[_0x5c5e('0x82')]['upsert']({'membername':_0x413dc7[_0x5c5e('0x37')],'UserId':_0x413dc7['id'],'queue_name':_0xb9bb69[_0x5c5e('0x37')],'VoiceQueueId':_0xb9bb69['id'],'interface':_[_0x5c5e('0x83')](_0x413dc7[_0x5c5e('0x81')])?util[_0x5c5e('0x84')](_0x5c5e('0x85'),_0x413dc7[_0x5c5e('0x37')]):_0x413dc7['interface'],'paused':_0x413dc7[_0x5c5e('0x80')]||![],'penalty':_0xb9bb69['TeamVoiceQueue'][_0x5c5e('0x7b')]},{'transaction':_0x4f1b76});});return Promise[_0x5c5e('0x86')](_0x2dc668);});});});return Promise[_0x5c5e('0x86')](_0x322ca8);});return Promise[_0x5c5e('0x86')](_0x28212c);});});return Promise['all'](_0x5ef5f5)['then'](function(){return _0x4f68fa[_0x5c5e('0x6f')](_0x382188['body'][_0x5c5e('0x6d')],{'transaction':_0x4f1b76})[_0x5c5e('0x87')](function(_0x58d94f){return _0x58d94f;});});});}})[_0x5c5e('0x30')](respondWithResult(_0x973cf1,null))[_0x5c5e('0x51')](handleError(_0x973cf1,null));};exports[_0x5c5e('0x88')]=function(_0xef0ba3,_0x446894){return db[_0x5c5e('0x4f')][_0x5c5e('0x56')]({'where':{'id':_0xef0ba3[_0x5c5e('0x53')]['id']}})[_0x5c5e('0x30')](handleEntityNotFound(_0x446894,null))[_0x5c5e('0x30')](function(_0x403740){if(_0x403740){var _0xf5075a=['Voice',_0x5c5e('0x71'),_0x5c5e('0x72'),_0x5c5e('0x73'),'Fax',_0x5c5e('0x75'),_0x5c5e('0x76')];return db[_0x5c5e('0x77')]['transaction'](function(_0x13b5a7){var _0x3ca67a=_[_0x5c5e('0x3e')](_0xf5075a,function(_0xf692a4){var _0x23553f={'attributes':['id',_0x5c5e('0x37')]};return _0x403740['get'+_0xf692a4+_0x5c5e('0x69')](_0x23553f)[_0x5c5e('0x30')](function(_0x461f07){var _0x4da3c2=_[_0x5c5e('0x3e')](_0x461f07,function(_0x469343){return _0x469343[_0x5c5e('0x88')](_0xef0ba3[_0x5c5e('0x40')][_0x5c5e('0x6d')],{'transaction':_0x13b5a7})[_0x5c5e('0x30')](function(){var _0x243880=JSON[_0x5c5e('0x89')]('['+_0xef0ba3['query']['ids']+']');var _0x12d1f4=_[_0x5c5e('0x3e')](_0x243880,function(_0x3b56d1){socket['emit'](_0x5c5e('0x58')+_0xf692a4+_0x5c5e('0x8a'),{'UserId':Number(_0x3b56d1),[_0xf692a4+_0x5c5e('0x79')]:_0x469343['id']});if(_0xf692a4!=='Voice')return;return db[_0x5c5e('0x82')]['destroy']({'where':{'VoiceQueueId':_0x469343['id'],'UserId':_0x3b56d1},'transaction':_0x13b5a7});});return Promise['all'](_0x12d1f4);});});return Promise[_0x5c5e('0x86')](_0x4da3c2);});});return Promise['all'](_0x3ca67a)[_0x5c5e('0x30')](function(){return _0x403740[_0x5c5e('0x88')](_0xef0ba3[_0x5c5e('0x40')][_0x5c5e('0x6d')],{'transaction':_0x13b5a7});});});}})['then'](respondWithStatusCode(_0x446894,null))[_0x5c5e('0x51')](handleError(_0x446894,null));};exports[_0x5c5e('0x8b')]=function(_0x5c4b84,_0x197832,_0x375a25){var _0x34365f={};var _0x53d0e2={};var _0x3eb552;var _0x595310;return db['Team'][_0x5c5e('0x61')]({'where':{'id':_0x5c4b84[_0x5c5e('0x53')]['id']}})[_0x5c5e('0x30')](handleEntityNotFound(_0x197832,null))[_0x5c5e('0x30')](function(_0x4ddcfc){if(_0x4ddcfc){_0x3eb552=_0x4ddcfc;_0x53d0e2['model']=_[_0x5c5e('0x3f')](db[_0x5c5e('0x7c')]['rawAttributes']);_0x53d0e2[_0x5c5e('0x40')]=_['keys'](_0x5c4b84['query']);_0x53d0e2['filters']=_['intersection'](_0x53d0e2[_0x5c5e('0x3d')],_0x53d0e2[_0x5c5e('0x40')]);_0x34365f[_0x5c5e('0x43')]=_[_0x5c5e('0x42')](_0x53d0e2[_0x5c5e('0x3d')],qs[_0x5c5e('0x44')](_0x5c4b84['query']['fields']));_0x34365f['attributes']=_0x34365f['attributes']['length']?_0x34365f[_0x5c5e('0x43')]:_0x53d0e2[_0x5c5e('0x3d')];_0x34365f[_0x5c5e('0x47')]=qs[_0x5c5e('0x48')](_0x5c4b84[_0x5c5e('0x40')][_0x5c5e('0x48')]);_0x34365f[_0x5c5e('0x49')]=qs['filters'](_[_0x5c5e('0x4a')](_0x5c4b84[_0x5c5e('0x40')],_0x53d0e2['filters']));if(_0x5c4b84[_0x5c5e('0x40')][_0x5c5e('0x4b')]){_0x34365f[_0x5c5e('0x49')]=_[_0x5c5e('0x4d')](_0x34365f[_0x5c5e('0x49')],{'$or':_['map'](_0x34365f[_0x5c5e('0x43')],function(_0x2d785d){var _0x93df3b={};_0x93df3b[_0x2d785d]={'$like':'%'+_0x5c4b84['query'][_0x5c5e('0x4b')]+'%'};return _0x93df3b;})});}_0x34365f=_[_0x5c5e('0x4d')]({},_0x34365f,_0x5c4b84['options']);return _0x3eb552[_0x5c5e('0x8b')](_0x34365f);}})[_0x5c5e('0x30')](function(_0x14798a){if(_0x14798a){_0x595310=_0x14798a[_0x5c5e('0x45')];if(!_0x5c4b84[_0x5c5e('0x40')][_0x5c5e('0x46')]('nolimit')){_0x34365f['limit']=qs[_0x5c5e('0x28')](_0x5c4b84[_0x5c5e('0x40')][_0x5c5e('0x28')]);_0x34365f[_0x5c5e('0x25')]=qs[_0x5c5e('0x25')](_0x5c4b84[_0x5c5e('0x40')][_0x5c5e('0x25')]);}return _0x3eb552[_0x5c5e('0x8b')](_0x34365f);}})['then'](function(_0x63ce51){if(_0x63ce51){return _0x63ce51?{'count':_0x595310,'rows':_0x63ce51}:null;}})['then'](respondWithResult(_0x197832,null))['catch'](handleError(_0x197832,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 1f174a9..c3c8133 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 _0x7dbf=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x2c3a88,_0x48637e){var _0x4a7925=function(_0x15780f){while(--_0x15780f){_0x2c3a88['push'](_0x2c3a88['shift']());}};_0x4a7925(++_0x48637e);}(_0x7dbf,0x1c0));var _0xf7db=function(_0x55b44f,_0x20048c){_0x55b44f=_0x55b44f-0x0;var _0x647b=_0x7dbf[_0x55b44f];return _0x647b;};'use strict';var EventEmitter=require(_0xf7db('0x0'));var Team=require(_0xf7db('0x1'))['db'][_0xf7db('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xf7db('0x3')](0x0);var events={'afterCreate':_0xf7db('0x4'),'afterUpdate':_0xf7db('0x5'),'afterDestroy':_0xf7db('0x6')};function emitEvent(_0x34c33d){return function(_0x57e812,_0x225886,_0x43fe5c){TeamEvents[_0xf7db('0x7')](_0x34c33d+':'+_0x57e812['id'],_0x57e812);TeamEvents[_0xf7db('0x7')](_0x34c33d,_0x57e812);_0x43fe5c(null);};}for(var e in events){if(events[_0xf7db('0x8')](e)){var event=events[e];Team[_0xf7db('0x9')](e,emitEvent(event));}}module[_0xf7db('0xa')]=TeamEvents; \ No newline at end of file +var _0xced0=['exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3f383c,_0x3ffca8){var _0x2759d7=function(_0x3452df){while(--_0x3452df){_0x3f383c['push'](_0x3f383c['shift']());}};_0x2759d7(++_0x3ffca8);}(_0xced0,0x177));var _0x0ced=function(_0x3d83ac,_0x1d0135){_0x3d83ac=_0x3d83ac-0x0;var _0x299760=_0xced0[_0x3d83ac];return _0x299760;};'use strict';var EventEmitter=require(_0x0ced('0x0'));var Team=require(_0x0ced('0x1'))['db'][_0x0ced('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x0ced('0x3')](0x0);var events={'afterCreate':_0x0ced('0x4'),'afterUpdate':_0x0ced('0x5'),'afterDestroy':_0x0ced('0x6')};function emitEvent(_0x1cec08){return function(_0x588fa3,_0x50c82a,_0x4e988d){TeamEvents[_0x0ced('0x7')](_0x1cec08+':'+_0x588fa3['id'],_0x588fa3);TeamEvents[_0x0ced('0x7')](_0x1cec08,_0x588fa3);_0x4e988d(null);};}for(var e in events){if(events[_0x0ced('0x8')](e)){var event=events[e];Team[_0x0ced('0x9')](e,emitEvent(event));}}module[_0x0ced('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index e972010..2ac696c 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 _0xb94e=['moment','bluebird','../../config/environment','./team.attributes','exports','Team','lodash','../../config/logger','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb94e,0xb1));var _0xeb94=function(_0xb12c26,_0x26a2f5){_0xb12c26=_0xb12c26-0x0;var _0x2e8295=_0xb94e[_0xb12c26];return _0x2e8295;};'use strict';var _=require(_0xeb94('0x0'));var util=require('util');var logger=require(_0xeb94('0x1'))(_0xeb94('0x2'));var moment=require(_0xeb94('0x3'));var BPromise=require(_0xeb94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeb94('0x5'));var attributes=require(_0xeb94('0x6'));module[_0xeb94('0x7')]=function(_0x19ac84,_0x488a04){return _0x19ac84['define'](_0xeb94('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f4b=['./team.attributes','exports','define','Team','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x288817,_0x33ce34){var _0x4198a6=function(_0x12f48c){while(--_0x12f48c){_0x288817['push'](_0x288817['shift']());}};_0x4198a6(++_0x33ce34);}(_0x9f4b,0xe0));var _0xb9f4=function(_0x224c30,_0x356d4c){_0x224c30=_0x224c30-0x0;var _0x3e3fa1=_0x9f4b[_0x224c30];return _0x3e3fa1;};'use strict';var _=require(_0xb9f4('0x0'));var util=require(_0xb9f4('0x1'));var logger=require(_0xb9f4('0x2'))(_0xb9f4('0x3'));var moment=require(_0xb9f4('0x4'));var BPromise=require(_0xb9f4('0x5'));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(_0xb9f4('0x6'));module[_0xb9f4('0x7')]=function(_0x5f5039,_0x49dd6e){return _0x5f5039[_0xb9f4('0x8')](_0xb9f4('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 54e35e4..d788d95 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 _0x9417=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','info','result'];(function(_0x53199f,_0x1dac3a){var _0x1f9609=function(_0x452065){while(--_0x452065){_0x53199f['push'](_0x53199f['shift']());}};_0x1f9609(++_0x1dac3a);}(_0x9417,0x139));var _0x7941=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x9417[_0x4f08dd];return _0x3017ee;};'use strict';var _=require(_0x7941('0x0'));var util=require(_0x7941('0x1'));var moment=require(_0x7941('0x2'));var BPromise=require(_0x7941('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7941('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7941('0x5'));var logger=require(_0x7941('0x6'))('rpc');var config=require(_0x7941('0x7'));var jayson=require(_0x7941('0x8'));var client=jayson[_0x7941('0x9')][_0x7941('0xa')]({'port':0x232a});config[_0x7941('0xb')]=_[_0x7941('0xc')](config[_0x7941('0xb')],{'host':_0x7941('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7941('0xb')]));require('./team.socket')[_0x7941('0xe')](socket);function respondWithRpcPromise(_0x126805,_0x1a9ce0,_0x1d03ee){return new BPromise(function(_0x2cc1cf,_0x48cc96){return client['request'](_0x126805,_0x1d03ee)['then'](function(_0x5df23e){logger['info']('Team,\x20%s,\x20%s',_0x1a9ce0,_0x7941('0xf'));logger[_0x7941('0x10')](_0x7941('0x11'),_0x1a9ce0,_0x7941('0xf'),JSON[_0x7941('0x12')](_0x5df23e));if(_0x5df23e[_0x7941('0x13')]){if(_0x5df23e[_0x7941('0x13')][_0x7941('0x14')]===0x1f4){logger[_0x7941('0x13')](_0x7941('0x15'),_0x1a9ce0,_0x5df23e[_0x7941('0x13')][_0x7941('0x16')]);return _0x48cc96(_0x5df23e[_0x7941('0x13')][_0x7941('0x16')]);}logger[_0x7941('0x13')](_0x7941('0x15'),_0x1a9ce0,_0x5df23e['error'][_0x7941('0x16')]);return _0x2cc1cf(_0x5df23e[_0x7941('0x13')][_0x7941('0x16')]);}else{logger[_0x7941('0x17')](_0x7941('0x15'),_0x1a9ce0,_0x7941('0xf'));_0x2cc1cf(_0x5df23e[_0x7941('0x18')][_0x7941('0x16')]);}})[_0x7941('0x19')](function(_0xfcd30d){logger[_0x7941('0x13')]('Team,\x20%s,\x20%s',_0x1a9ce0,_0xfcd30d);_0x48cc96(_0xfcd30d);});});} \ No newline at end of file +var _0x3934=['redis','localhost','socket.io-emitter','./team.socket','register','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x13e60d,_0x26b08e){var _0x536f64=function(_0x1f6df1){while(--_0x1f6df1){_0x13e60d['push'](_0x13e60d['shift']());}};_0x536f64(++_0x26b08e);}(_0x3934,0x116));var _0x4393=function(_0x54a512,_0x4af21f){_0x54a512=_0x54a512-0x0;var _0x4f6d62=_0x3934[_0x54a512];return _0x4f6d62;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4393('0x0'));var BPromise=require(_0x4393('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4393('0x2'));var db=require(_0x4393('0x3'))['db'];var utils=require(_0x4393('0x4'));var logger=require('../../config/logger')(_0x4393('0x5'));var config=require(_0x4393('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4393('0x7')]({'port':0x232a});config[_0x4393('0x8')]=_['defaults'](config[_0x4393('0x8')],{'host':_0x4393('0x9'),'port':0x18eb});var socket=require(_0x4393('0xa'))(new Redis(config[_0x4393('0x8')]));require(_0x4393('0xb'))[_0x4393('0xc')](socket);function respondWithRpcPromise(_0x3e143f,_0x1c2fd6,_0xbda3a5){return new BPromise(function(_0x198f9e,_0x5aca21){return client['request'](_0x3e143f,_0xbda3a5)['then'](function(_0x4c6f7a){logger['info'](_0x4393('0xd'),_0x1c2fd6,_0x4393('0xe'));logger[_0x4393('0xf')](_0x4393('0x10'),_0x1c2fd6,_0x4393('0xe'),JSON['stringify'](_0x4c6f7a));if(_0x4c6f7a[_0x4393('0x11')]){if(_0x4c6f7a['error'][_0x4393('0x12')]===0x1f4){logger[_0x4393('0x11')](_0x4393('0xd'),_0x1c2fd6,_0x4c6f7a[_0x4393('0x11')][_0x4393('0x13')]);return _0x5aca21(_0x4c6f7a[_0x4393('0x11')][_0x4393('0x13')]);}logger[_0x4393('0x11')](_0x4393('0xd'),_0x1c2fd6,_0x4c6f7a[_0x4393('0x11')][_0x4393('0x13')]);return _0x198f9e(_0x4c6f7a[_0x4393('0x11')]['message']);}else{logger[_0x4393('0x14')](_0x4393('0xd'),_0x1c2fd6,'request\x20sent');_0x198f9e(_0x4c6f7a['result']['message']);}})[_0x4393('0x15')](function(_0x1f1cd4){logger[_0x4393('0x11')](_0x4393('0xd'),_0x1c2fd6,_0x1f1cd4);_0x5aca21(_0x1f1cd4);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d65ff4c..0a11f57 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 _0xa786=['./team.events','save','remove','update','removeListener','register','length'];(function(_0xed2200,_0x3bc0a1){var _0x50ec12=function(_0x40647e){while(--_0x40647e){_0xed2200['push'](_0xed2200['shift']());}};_0x50ec12(++_0x3bc0a1);}(_0xa786,0x1f1));var _0x6a78=function(_0xc65d0,_0x49ee57){_0xc65d0=_0xc65d0-0x0;var _0x5204e4=_0xa786[_0xc65d0];return _0x5204e4;};'use strict';var TeamEvents=require(_0x6a78('0x0'));var events=[_0x6a78('0x1'),_0x6a78('0x2'),_0x6a78('0x3')];function createListener(_0x6002b8,_0x29c1b5){return function(_0x185973){_0x29c1b5['emit'](_0x6002b8,_0x185973);};}function removeListener(_0x2f9133,_0x28cc9f){return function(){TeamEvents[_0x6a78('0x4')](_0x2f9133,_0x28cc9f);};}exports[_0x6a78('0x5')]=function(_0x5624df){for(var _0x152b20=0x0,_0x34deae=events[_0x6a78('0x6')];_0x152b20<_0x34deae;_0x152b20++){var _0x55482c=events[_0x152b20];var _0x58d2bc=createListener('team:'+_0x55482c,_0x5624df);TeamEvents['on'](_0x55482c,_0x58d2bc);}}; \ No newline at end of file +var _0x9c54=['./team.events','removeListener','length','team:'];(function(_0x520945,_0x28b144){var _0x17067a=function(_0x191ae1){while(--_0x191ae1){_0x520945['push'](_0x520945['shift']());}};_0x17067a(++_0x28b144);}(_0x9c54,0x120));var _0x49c5=function(_0x244ab5,_0xb34ac8){_0x244ab5=_0x244ab5-0x0;var _0x572f88=_0x9c54[_0x244ab5];return _0x572f88;};'use strict';var TeamEvents=require(_0x49c5('0x0'));var events=['save','remove','update'];function createListener(_0x5518b1,_0x23917e){return function(_0x414077){_0x23917e['emit'](_0x5518b1,_0x414077);};}function removeListener(_0xb14138,_0x1bc477){return function(){TeamEvents[_0x49c5('0x1')](_0xb14138,_0x1bc477);};}exports['register']=function(_0x5c54de){for(var _0x30798b=0x0,_0x12795e=events[_0x49c5('0x2')];_0x30798b<_0x12795e;_0x30798b++){var _0x1072c5=events[_0x30798b];var _0x2491e6=createListener(_0x49c5('0x3')+_0x1072c5,_0x5c54de);TeamEvents['on'](_0x1072c5,_0x2491e6);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index b4122d8..7e304db 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1a5770,_0x505b0b){var _0x10f1f4=function(_0x13091b){while(--_0x13091b){_0x1a5770['push'](_0x1a5770['shift']());}};_0x10f1f4(++_0x505b0b);}(_0xedd9,0xfc));var _0x9edd=function(_0xfb8f31,_0x2d3880){_0xfb8f31=_0xfb8f31-0x0;var _0x28b6e0=_0xedd9[_0xfb8f31];return _0x28b6e0;};'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');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x24e721,_0x4aec0c){var _0x16434e=function(_0x273166){while(--_0x273166){_0x24e721['push'](_0x24e721['shift']());}};_0x16434e(++_0x4aec0c);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 92a442e..301e4fe 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 _0xceb1=['exports','INTEGER','sequelize'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xceb1,0x10a));var _0x1ceb=function(_0x2e8369,_0x30759b){_0x2e8369=_0x2e8369-0x0;var _0x5f0fe5=_0xceb1[_0x2e8369];return _0x5f0fe5;};'use strict';var Sequelize=require(_0x1ceb('0x0'));module[_0x1ceb('0x1')]={'penalty':{'type':Sequelize[_0x1ceb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x846c=['INTEGER','sequelize','exports'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x846c,0xf1));var _0xc846=function(_0x3a1f89,_0x472660){_0x3a1f89=_0x3a1f89-0x0;var _0x3ee895=_0x846c[_0x3a1f89];return _0x3ee895;};'use strict';var Sequelize=require(_0xc846('0x0'));module[_0xc846('0x1')]={'penalty':{'type':Sequelize[_0xc846('0x2')],'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 56e91a3..be55603 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 _0x0dba=['TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x267811,_0x5115e8){var _0x14217e=function(_0x20929b){while(--_0x20929b){_0x267811['push'](_0x267811['shift']());}};_0x14217e(++_0x5115e8);}(_0x0dba,0x136));var _0xa0db=function(_0x4603a0,_0x34f97a){_0x4603a0=_0x4603a0-0x0;var _0x34d839=_0x0dba[_0x4603a0];return _0x34d839;};'use strict';var _=require(_0xa0db('0x0'));var util=require(_0xa0db('0x1'));var logger=require(_0xa0db('0x2'))(_0xa0db('0x3'));var moment=require(_0xa0db('0x4'));var BPromise=require(_0xa0db('0x5'));var rp=require(_0xa0db('0x6'));var fs=require('fs');var path=require(_0xa0db('0x7'));var rimraf=require(_0xa0db('0x8'));var config=require(_0xa0db('0x9'));var attributes=require(_0xa0db('0xa'));module[_0xa0db('0xb')]=function(_0x4d6ece,_0x53472e){return _0x4d6ece['define'](_0xa0db('0xc'),attributes,{'tableName':_0xa0db('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6fb=['define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api','bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','exports'];(function(_0x5b142f,_0x10815a){var _0x327bbd=function(_0x56806f){while(--_0x56806f){_0x5b142f['push'](_0x5b142f['shift']());}};_0x327bbd(++_0x10815a);}(_0xf6fb,0x111));var _0xbf6f=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0xf6fb[_0x590851];return _0x3b0115;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf6f('0x0'))(_0xbf6f('0x1'));var moment=require('moment');var BPromise=require(_0xbf6f('0x2'));var rp=require(_0xbf6f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf6f('0x4'));var config=require('../../config/environment');var attributes=require(_0xbf6f('0x5'));module[_0xbf6f('0x6')]=function(_0x2d8ffb,_0x370983){return _0x2d8ffb[_0xbf6f('0x7')](_0xbf6f('0x8'),attributes,{'tableName':_0xbf6f('0x9'),'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 85f24dc..050ee0f 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 _0x8fe4=['request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0xe0eb8,_0xf2768d){var _0x4c747d=function(_0x5aa853){while(--_0x5aa853){_0xe0eb8['push'](_0xe0eb8['shift']());}};_0x4c747d(++_0xf2768d);}(_0x8fe4,0x170));var _0x48fe=function(_0x227221,_0x31d0d0){_0x227221=_0x227221-0x0;var _0x3f49e9=_0x8fe4[_0x227221];return _0x3f49e9;};'use strict';var _=require(_0x48fe('0x0'));var util=require(_0x48fe('0x1'));var moment=require('moment');var BPromise=require(_0x48fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48fe('0x3'))['db'];var utils=require(_0x48fe('0x4'));var logger=require(_0x48fe('0x5'))(_0x48fe('0x6'));var config=require(_0x48fe('0x7'));var jayson=require(_0x48fe('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b1138,_0x47b1ec,_0x43134e){return new BPromise(function(_0x35918b,_0xc19b5c){return client[_0x48fe('0x9')](_0x5b1138,_0x43134e)['then'](function(_0x39cbb1){logger[_0x48fe('0xa')](_0x48fe('0xb'),_0x47b1ec,_0x48fe('0xc'));logger['debug'](_0x48fe('0xd'),_0x47b1ec,_0x48fe('0xc'),JSON[_0x48fe('0xe')](_0x39cbb1));if(_0x39cbb1[_0x48fe('0xf')]){if(_0x39cbb1[_0x48fe('0xf')][_0x48fe('0x10')]===0x1f4){logger['error'](_0x48fe('0xb'),_0x47b1ec,_0x39cbb1[_0x48fe('0xf')]['message']);return _0xc19b5c(_0x39cbb1[_0x48fe('0xf')][_0x48fe('0x11')]);}logger[_0x48fe('0xf')](_0x48fe('0xb'),_0x47b1ec,_0x39cbb1[_0x48fe('0xf')]['message']);return _0x35918b(_0x39cbb1[_0x48fe('0xf')][_0x48fe('0x11')]);}else{logger[_0x48fe('0xa')](_0x48fe('0xb'),_0x47b1ec,_0x48fe('0xc'));_0x35918b(_0x39cbb1[_0x48fe('0x12')]['message']);}})[_0x48fe('0x13')](function(_0xb06a32){logger['error'](_0x48fe('0xb'),_0x47b1ec,_0xb06a32);_0xc19b5c(_0xb06a32);});});} \ No newline at end of file +var _0xb38a=['code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20d0e6,_0x579837){var _0x4cc540=function(_0x27af00){while(--_0x27af00){_0x20d0e6['push'](_0x20d0e6['shift']());}};_0x4cc540(++_0x579837);}(_0xb38a,0x77));var _0xab38=function(_0x3230cc,_0xd34a78){_0x3230cc=_0x3230cc-0x0;var _0xd4f510=_0xb38a[_0x3230cc];return _0xd4f510;};'use strict';var _=require(_0xab38('0x0'));var util=require(_0xab38('0x1'));var moment=require(_0xab38('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab38('0x3'));var db=require(_0xab38('0x4'))['db'];var utils=require(_0xab38('0x5'));var logger=require(_0xab38('0x6'))(_0xab38('0x7'));var config=require('../../config/environment');var jayson=require(_0xab38('0x8'));var client=jayson[_0xab38('0x9')][_0xab38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bf893,_0x195526,_0x12940b){return new BPromise(function(_0x34b995,_0x19a782){return client['request'](_0x5bf893,_0x12940b)[_0xab38('0xb')](function(_0x2fe098){logger[_0xab38('0xc')](_0xab38('0xd'),_0x195526,_0xab38('0xe'));logger[_0xab38('0xf')](_0xab38('0x10'),_0x195526,_0xab38('0xe'),JSON[_0xab38('0x11')](_0x2fe098));if(_0x2fe098[_0xab38('0x12')]){if(_0x2fe098[_0xab38('0x12')][_0xab38('0x13')]===0x1f4){logger[_0xab38('0x12')](_0xab38('0xd'),_0x195526,_0x2fe098[_0xab38('0x12')]['message']);return _0x19a782(_0x2fe098[_0xab38('0x12')][_0xab38('0x14')]);}logger[_0xab38('0x12')](_0xab38('0xd'),_0x195526,_0x2fe098['error'][_0xab38('0x14')]);return _0x34b995(_0x2fe098[_0xab38('0x12')][_0xab38('0x14')]);}else{logger[_0xab38('0xc')](_0xab38('0xd'),_0x195526,'request\x20sent');_0x34b995(_0x2fe098[_0xab38('0x15')][_0xab38('0x14')]);}})[_0xab38('0x16')](function(_0x4b646a){logger[_0xab38('0x12')](_0xab38('0xd'),_0x195526,_0x4b646a);_0x19a782(_0x4b646a);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7893f49..77f61ef 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 _0x9541=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./template.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9541,0xb3));var _0x1954=function(_0x449885,_0x1c89c0){_0x449885=_0x449885-0x0;var _0xfd5de7=_0x9541[_0x449885];return _0xfd5de7;};'use strict';var multer=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var path=require(_0x1954('0x2'));var timeout=require(_0x1954('0x3'));var express=require(_0x1954('0x4'));var router=express[_0x1954('0x5')]();var fs_extra=require(_0x1954('0x6'));var auth=require(_0x1954('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1954('0x8'));router[_0x1954('0x9')]('/',auth['isAuthenticated'](),controller[_0x1954('0xa')]);router[_0x1954('0x9')](_0x1954('0xb'),auth[_0x1954('0xc')](),controller[_0x1954('0xd')]);router[_0x1954('0xe')]('/',auth['isAuthenticated'](),controller[_0x1954('0xf')]);router[_0x1954('0x10')](_0x1954('0xb'),auth[_0x1954('0xc')](),controller[_0x1954('0x11')]);router[_0x1954('0x12')](_0x1954('0xb'),auth[_0x1954('0xc')](),controller['destroy']);module[_0x1954('0x13')]=router; \ No newline at end of file +var _0xa880=['isAuthenticated','index','get','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0xc6615e,_0x129a49){var _0xff6625=function(_0xe82703){while(--_0xe82703){_0xc6615e['push'](_0xc6615e['shift']());}};_0xff6625(++_0x129a49);}(_0xa880,0x106));var _0x0a88=function(_0x3d5e72,_0x3ab167){_0x3d5e72=_0x3d5e72-0x0;var _0x2230e4=_0xa880[_0x3d5e72];return _0x2230e4;};'use strict';var multer=require(_0x0a88('0x0'));var util=require(_0x0a88('0x1'));var path=require(_0x0a88('0x2'));var timeout=require(_0x0a88('0x3'));var express=require(_0x0a88('0x4'));var router=express[_0x0a88('0x5')]();var fs_extra=require(_0x0a88('0x6'));var auth=require(_0x0a88('0x7'));var interaction=require(_0x0a88('0x8'));var config=require(_0x0a88('0x9'));var controller=require(_0x0a88('0xa'));router['get']('/',auth[_0x0a88('0xb')](),controller[_0x0a88('0xc')]);router[_0x0a88('0xd')](_0x0a88('0xe'),auth['isAuthenticated'](),controller[_0x0a88('0xf')]);router[_0x0a88('0x10')]('/',auth[_0x0a88('0xb')](),controller['create']);router['put']('/:id',auth[_0x0a88('0xb')](),controller[_0x0a88('0x11')]);router[_0x0a88('0x12')](_0x0a88('0xe'),auth[_0x0a88('0xb')](),controller[_0x0a88('0x13')]);module[_0x0a88('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index bfb9042..6e53418 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 _0x373d=['STRING','TEXT','sequelize','exports'];(function(_0x1c2ad8,_0x4c461b){var _0x1ff948=function(_0x2ee6e3){while(--_0x2ee6e3){_0x1c2ad8['push'](_0x1c2ad8['shift']());}};_0x1ff948(++_0x4c461b);}(_0x373d,0x172));var _0xd373=function(_0x40bfc2,_0x538e26){_0x40bfc2=_0x40bfc2-0x0;var _0x14d1db=_0x373d[_0x40bfc2];return _0x14d1db;};'use strict';var Sequelize=require(_0xd373('0x0'));module[_0xd373('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd373('0x2')]},'html':{'type':Sequelize[_0xd373('0x3')]}}; \ No newline at end of file +var _0xf3b2=['STRING','sequelize','exports'];(function(_0x50242b,_0xa100e3){var _0x5b7825=function(_0x384ccc){while(--_0x384ccc){_0x50242b['push'](_0x50242b['shift']());}};_0x5b7825(++_0xa100e3);}(_0xf3b2,0x1a2));var _0x2f3b=function(_0x45f4e9,_0x5246fd){_0x45f4e9=_0x45f4e9-0x0;var _0x559d8f=_0xf3b2[_0x45f4e9];return _0x559d8f;};'use strict';var Sequelize=require(_0x2f3b('0x0'));module[_0x2f3b('0x1')]={'name':{'type':Sequelize[_0x2f3b('0x2')]},'description':{'type':Sequelize[_0x2f3b('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1b92867..667c8b7 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 _0x4ab8=['merge','options','Template','include','findAll','catch','show','params','includeAll','create','body','user','role','Templates','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x4ab8,0x105));var _0x84ab=function(_0x505882,_0x7da40c){_0x505882=_0x505882-0x0;var _0x2c9e6c=_0x4ab8[_0x505882];return _0x2c9e6c;};'use strict';var emlformat=require(_0x84ab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x84ab('0x1'));var rp=require(_0x84ab('0x2'));var moment=require(_0x84ab('0x3'));var BPromise=require(_0x84ab('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x84ab('0x5'));var sox=require(_0x84ab('0x6'));var csv=require('to-csv');var ejs=require(_0x84ab('0x7'));var fs=require('fs');var fs_extra=require(_0x84ab('0x8'));var _=require(_0x84ab('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x84ab('0xa'));var deskjs=require(_0x84ab('0xb'));var toCsv=require(_0x84ab('0xc'));var querystring=require(_0x84ab('0xd'));var Papa=require('papaparse');var Redis=require(_0x84ab('0xe'));var authService=require(_0x84ab('0xf'));var qs=require(_0x84ab('0x10'));var as=require(_0x84ab('0x11'));var hardwareService=require(_0x84ab('0x12'));var logger=require(_0x84ab('0x13'))(_0x84ab('0x14'));var utils=require(_0x84ab('0x15'));var config=require(_0x84ab('0x16'));var licenseUtil=require(_0x84ab('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31a4a9,_0x22c7a7){_0x22c7a7=_0x22c7a7||0xcc;return function(_0x3dd018){if(_0x3dd018){return _0x31a4a9[_0x84ab('0x18')](_0x22c7a7);}return _0x31a4a9[_0x84ab('0x19')](_0x22c7a7)[_0x84ab('0x1a')]();};}function respondWithResult(_0x1e6af8,_0x2ab955){_0x2ab955=_0x2ab955||0xc8;return function(_0x1d4803){if(_0x1d4803){return _0x1e6af8['status'](_0x2ab955)[_0x84ab('0x1b')](_0x1d4803);}};}function respondWithFilteredResult(_0x3c9b35,_0x1394d7){return function(_0x26adbf){if(_0x26adbf){var _0x3f8070=typeof _0x1394d7[_0x84ab('0x1c')]===_0x84ab('0x1d')&&typeof _0x1394d7[_0x84ab('0x1e')]===_0x84ab('0x1d');var _0x52c0fa=_0x26adbf[_0x84ab('0x1f')];var _0x5ca5bc=_0x3f8070?0x0:_0x1394d7['offset'];var _0x57f4bc=_0x3f8070?_0x26adbf[_0x84ab('0x1f')]:_0x1394d7['offset']+_0x1394d7[_0x84ab('0x1e')];var _0x467a59;if(_0x57f4bc>=_0x52c0fa){_0x57f4bc=_0x52c0fa;_0x467a59=0xc8;}else{_0x467a59=0xce;}_0x3c9b35[_0x84ab('0x19')](_0x467a59);return _0x3c9b35[_0x84ab('0x20')](_0x84ab('0x21'),_0x5ca5bc+'-'+_0x57f4bc+'/'+_0x52c0fa)[_0x84ab('0x1b')](_0x26adbf);}return null;};}function patchUpdates(_0x121587){return function(_0x2159c6){try{jsonpatch[_0x84ab('0x22')](_0x2159c6,_0x121587,!![]);}catch(_0x11e033){return BPromise[_0x84ab('0x23')](_0x11e033);}return _0x2159c6[_0x84ab('0x24')]();};}function saveUpdates(_0x3bfdab,_0x5befef){return function(_0x5747f0){if(_0x5747f0){return _0x5747f0[_0x84ab('0x25')](_0x3bfdab)[_0x84ab('0x26')](function(_0x4701c1){return _0x4701c1;});}return null;};}function removeEntity(_0x3da7eb,_0x986fc6){return function(_0x96bcbf){if(_0x96bcbf){return _0x96bcbf['destroy']()[_0x84ab('0x26')](function(){var _0x37c566=_0x96bcbf[_0x84ab('0x27')]({'plain':!![]});var _0x4c6805='Templates';return db[_0x84ab('0x28')]['destroy']({'where':{'type':_0x4c6805,'resourceId':_0x37c566['id']}})[_0x84ab('0x26')](function(){return _0x96bcbf;});})[_0x84ab('0x26')](function(){_0x3da7eb[_0x84ab('0x19')](0xcc)[_0x84ab('0x1a')]();});}};}function handleEntityNotFound(_0x4ab973,_0x453370){return function(_0xc40373){if(!_0xc40373){_0x4ab973[_0x84ab('0x18')](0x194);}return _0xc40373;};}function handleError(_0x4a28fd,_0x5cad47){_0x5cad47=_0x5cad47||0x1f4;return function(_0x3e7f17){logger[_0x84ab('0x29')](_0x3e7f17[_0x84ab('0x2a')]);if(_0x3e7f17[_0x84ab('0x2b')]){delete _0x3e7f17[_0x84ab('0x2b')];}_0x4a28fd['status'](_0x5cad47)[_0x84ab('0x2c')](_0x3e7f17);};}exports['index']=function(_0x2f3f84,_0x215cb3){var _0xc5475f={},_0x30cac3={},_0x21becd={'count':0x0,'rows':[]};var _0x420fc6=_[_0x84ab('0x2d')](db['Template'][_0x84ab('0x2e')],function(_0x1f0f8b){return{'name':_0x1f0f8b[_0x84ab('0x2f')],'type':_0x1f0f8b[_0x84ab('0x30')]['key']};});_0x30cac3[_0x84ab('0x31')]=_[_0x84ab('0x2d')](_0x420fc6,'name');_0x30cac3[_0x84ab('0x32')]=_[_0x84ab('0x33')](_0x2f3f84[_0x84ab('0x32')]);_0x30cac3['filters']=_[_0x84ab('0x34')](_0x30cac3[_0x84ab('0x31')],_0x30cac3['query']);_0xc5475f['attributes']=_['intersection'](_0x30cac3['model'],qs[_0x84ab('0x35')](_0x2f3f84[_0x84ab('0x32')][_0x84ab('0x35')]));_0xc5475f['attributes']=_0xc5475f[_0x84ab('0x36')][_0x84ab('0x37')]?_0xc5475f[_0x84ab('0x36')]:_0x30cac3[_0x84ab('0x31')];if(!_0x2f3f84['query']['hasOwnProperty'](_0x84ab('0x38'))){_0xc5475f[_0x84ab('0x1e')]=qs['limit'](_0x2f3f84[_0x84ab('0x32')][_0x84ab('0x1e')]);_0xc5475f[_0x84ab('0x1c')]=qs[_0x84ab('0x1c')](_0x2f3f84[_0x84ab('0x32')]['offset']);}_0xc5475f[_0x84ab('0x39')]=qs['sort'](_0x2f3f84['query'][_0x84ab('0x3a')]);_0xc5475f['where']=qs[_0x84ab('0x3b')](_[_0x84ab('0x3c')](_0x2f3f84[_0x84ab('0x32')],_0x30cac3['filters']),_0x420fc6);if(_0x2f3f84[_0x84ab('0x32')][_0x84ab('0x3d')]){_0xc5475f[_0x84ab('0x3e')]=_[_0x84ab('0x3f')](_0xc5475f[_0x84ab('0x3e')],{'$or':_[_0x84ab('0x2d')](_0x420fc6,function(_0x5c932b){if(_0x5c932b[_0x84ab('0x30')]!=='VIRTUAL'){var _0x16695f={};_0x16695f[_0x5c932b[_0x84ab('0x2b')]]={'$like':'%'+_0x2f3f84[_0x84ab('0x32')][_0x84ab('0x3d')]+'%'};return _0x16695f;}})});}_0xc5475f=_[_0x84ab('0x3f')]({},_0xc5475f,_0x2f3f84[_0x84ab('0x40')]);var _0x1f43e8={'where':_0xc5475f[_0x84ab('0x3e')]};return db[_0x84ab('0x41')][_0x84ab('0x1f')](_0x1f43e8)[_0x84ab('0x26')](function(_0x5cf78b){_0x21becd[_0x84ab('0x1f')]=_0x5cf78b;if(_0x2f3f84['query']['includeAll']){_0xc5475f[_0x84ab('0x42')]=[{'all':!![]}];}return db[_0x84ab('0x41')][_0x84ab('0x43')](_0xc5475f);})[_0x84ab('0x26')](function(_0x3b19f1){_0x21becd['rows']=_0x3b19f1;return _0x21becd;})[_0x84ab('0x26')](respondWithFilteredResult(_0x215cb3,_0xc5475f))[_0x84ab('0x44')](handleError(_0x215cb3,null));};exports[_0x84ab('0x45')]=function(_0xfe0fa9,_0x15b7b3){var _0x5ab26e={'raw':!![],'where':{'id':_0xfe0fa9[_0x84ab('0x46')]['id']}},_0x56e894={};_0x56e894['model']=_[_0x84ab('0x33')](db['Template'][_0x84ab('0x2e')]);_0x56e894[_0x84ab('0x32')]=_[_0x84ab('0x33')](_0xfe0fa9[_0x84ab('0x32')]);_0x56e894[_0x84ab('0x3b')]=_[_0x84ab('0x34')](_0x56e894[_0x84ab('0x31')],_0x56e894['query']);_0x5ab26e[_0x84ab('0x36')]=_[_0x84ab('0x34')](_0x56e894[_0x84ab('0x31')],qs['fields'](_0xfe0fa9['query'][_0x84ab('0x35')]));_0x5ab26e[_0x84ab('0x36')]=_0x5ab26e['attributes'][_0x84ab('0x37')]?_0x5ab26e['attributes']:_0x56e894['model'];if(_0xfe0fa9[_0x84ab('0x32')][_0x84ab('0x47')]){_0x5ab26e['include']=[{'all':!![]}];}_0x5ab26e=_[_0x84ab('0x3f')]({},_0x5ab26e,_0xfe0fa9[_0x84ab('0x40')]);return db[_0x84ab('0x41')]['find'](_0x5ab26e)[_0x84ab('0x26')](handleEntityNotFound(_0x15b7b3,null))[_0x84ab('0x26')](respondWithResult(_0x15b7b3,null))[_0x84ab('0x44')](handleError(_0x15b7b3,null));};exports[_0x84ab('0x48')]=function(_0x34ff28,_0x1a1aa1){return db['Template']['create'](_0x34ff28[_0x84ab('0x49')],{})[_0x84ab('0x26')](function(_0x614a8a){var _0x463f73=_0x34ff28[_0x84ab('0x4a')]['get']({'plain':!![]});if(!_0x463f73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x463f73[_0x84ab('0x4b')]==='user'){var _0x134fe2=_0x614a8a[_0x84ab('0x27')]({'plain':!![]});var _0xed236e=_0x84ab('0x4c');return db[_0x84ab('0x4d')]['find']({'where':{'name':_0xed236e,'userProfileId':_0x463f73['userProfileId']},'raw':!![]})['then'](function(_0x4a82a7){if(_0x4a82a7&&_0x4a82a7[_0x84ab('0x4e')]===0x0){return db[_0x84ab('0x28')][_0x84ab('0x48')]({'name':_0x134fe2['name'],'resourceId':_0x134fe2['id'],'type':_0x4a82a7[_0x84ab('0x2b')],'sectionId':_0x4a82a7['id']},{})[_0x84ab('0x26')](function(){return _0x614a8a;});}else{return _0x614a8a;}})[_0x84ab('0x44')](function(_0x243818){logger[_0x84ab('0x29')](_0x84ab('0x4f'),_0x243818);throw _0x243818;});}return _0x614a8a;})[_0x84ab('0x26')](respondWithResult(_0x1a1aa1,0xc9))[_0x84ab('0x44')](handleError(_0x1a1aa1,null));};exports[_0x84ab('0x25')]=function(_0x994bbf,_0x5b65b0){if(_0x994bbf[_0x84ab('0x49')]['id']){delete _0x994bbf[_0x84ab('0x49')]['id'];}return db['Template']['find']({'where':{'id':_0x994bbf['params']['id']}})[_0x84ab('0x26')](handleEntityNotFound(_0x5b65b0,null))[_0x84ab('0x26')](saveUpdates(_0x994bbf[_0x84ab('0x49')],null))[_0x84ab('0x26')](respondWithResult(_0x5b65b0,null))[_0x84ab('0x44')](handleError(_0x5b65b0,null));};exports[_0x84ab('0x50')]=function(_0x1aaaef,_0x10081a){return db[_0x84ab('0x41')]['find']({'where':{'id':_0x1aaaef['params']['id']}})[_0x84ab('0x26')](handleEntityNotFound(_0x10081a,null))[_0x84ab('0x26')](removeEntity(_0x10081a,null))['catch'](handleError(_0x10081a,null));}; \ No newline at end of file +var _0x599a=['update','destroy','then','get','Templates','UserProfileResource','end','error','name','send','index','map','Template','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','length','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x18d949,_0x364c87){var _0x5d4e81=function(_0x328e62){while(--_0x328e62){_0x18d949['push'](_0x18d949['shift']());}};_0x5d4e81(++_0x364c87);}(_0x599a,0xcc));var _0xa599=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x599a[_0x420b24];return _0x4da552;};'use strict';var emlformat=require(_0xa599('0x0'));var rimraf=require(_0xa599('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa599('0x2'));var rp=require(_0xa599('0x3'));var moment=require('moment');var BPromise=require(_0xa599('0x4'));var Mustache=require('mustache');var util=require(_0xa599('0x5'));var path=require('path');var sox=require(_0xa599('0x6'));var csv=require(_0xa599('0x7'));var ejs=require(_0xa599('0x8'));var fs=require('fs');var fs_extra=require(_0xa599('0x9'));var _=require(_0xa599('0xa'));var squel=require(_0xa599('0xb'));var crypto=require(_0xa599('0xc'));var jsforce=require(_0xa599('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa599('0x7'));var querystring=require(_0xa599('0xe'));var Papa=require(_0xa599('0xf'));var Redis=require(_0xa599('0x10'));var authService=require(_0xa599('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa599('0x12'))(_0xa599('0x13'));var utils=require(_0xa599('0x14'));var config=require(_0xa599('0x15'));var licenseUtil=require(_0xa599('0x16'));var db=require(_0xa599('0x17'))['db'];function respondWithStatusCode(_0x3944b5,_0x42942b){_0x42942b=_0x42942b||0xcc;return function(_0x3cf551){if(_0x3cf551){return _0x3944b5[_0xa599('0x18')](_0x42942b);}return _0x3944b5[_0xa599('0x19')](_0x42942b)['end']();};}function respondWithResult(_0x2e887f,_0x818dcc){_0x818dcc=_0x818dcc||0xc8;return function(_0xc90636){if(_0xc90636){return _0x2e887f[_0xa599('0x19')](_0x818dcc)[_0xa599('0x1a')](_0xc90636);}};}function respondWithFilteredResult(_0xf2e557,_0x409628){return function(_0x4bfb15){if(_0x4bfb15){var _0x31aa55=typeof _0x409628[_0xa599('0x1b')]===_0xa599('0x1c')&&typeof _0x409628[_0xa599('0x1d')]===_0xa599('0x1c');var _0x259c9e=_0x4bfb15[_0xa599('0x1e')];var _0x2e97f4=_0x31aa55?0x0:_0x409628[_0xa599('0x1b')];var _0x4a5b11=_0x31aa55?_0x4bfb15[_0xa599('0x1e')]:_0x409628[_0xa599('0x1b')]+_0x409628[_0xa599('0x1d')];var _0x57883f;if(_0x4a5b11>=_0x259c9e){_0x4a5b11=_0x259c9e;_0x57883f=0xc8;}else{_0x57883f=0xce;}_0xf2e557[_0xa599('0x19')](_0x57883f);return _0xf2e557[_0xa599('0x1f')](_0xa599('0x20'),_0x2e97f4+'-'+_0x4a5b11+'/'+_0x259c9e)[_0xa599('0x1a')](_0x4bfb15);}return null;};}function patchUpdates(_0x4ae661){return function(_0x46b64b){try{jsonpatch[_0xa599('0x21')](_0x46b64b,_0x4ae661,!![]);}catch(_0x3a9523){return BPromise[_0xa599('0x22')](_0x3a9523);}return _0x46b64b[_0xa599('0x23')]();};}function saveUpdates(_0x273262,_0x31e941){return function(_0x2743fb){if(_0x2743fb){return _0x2743fb[_0xa599('0x24')](_0x273262)['then'](function(_0x31881c){return _0x31881c;});}return null;};}function removeEntity(_0x48d204,_0x40b015){return function(_0x426830){if(_0x426830){return _0x426830[_0xa599('0x25')]()[_0xa599('0x26')](function(){var _0x6cd953=_0x426830[_0xa599('0x27')]({'plain':!![]});var _0x514d3a=_0xa599('0x28');return db[_0xa599('0x29')][_0xa599('0x25')]({'where':{'type':_0x514d3a,'resourceId':_0x6cd953['id']}})[_0xa599('0x26')](function(){return _0x426830;});})[_0xa599('0x26')](function(){_0x48d204[_0xa599('0x19')](0xcc)[_0xa599('0x2a')]();});}};}function handleEntityNotFound(_0x45d2df,_0x59582d){return function(_0x2596e8){if(!_0x2596e8){_0x45d2df[_0xa599('0x18')](0x194);}return _0x2596e8;};}function handleError(_0x52069d,_0x18d465){_0x18d465=_0x18d465||0x1f4;return function(_0x447ea6){logger[_0xa599('0x2b')](_0x447ea6['stack']);if(_0x447ea6[_0xa599('0x2c')]){delete _0x447ea6['name'];}_0x52069d[_0xa599('0x19')](_0x18d465)[_0xa599('0x2d')](_0x447ea6);};}exports[_0xa599('0x2e')]=function(_0x5a443e,_0x18de1d){var _0x1b614a={},_0x4ec60f={},_0x20108d={'count':0x0,'rows':[]};var _0x1829a6=_[_0xa599('0x2f')](db[_0xa599('0x30')][_0xa599('0x31')],function(_0x541c2a){return{'name':_0x541c2a[_0xa599('0x32')],'type':_0x541c2a[_0xa599('0x33')]['key']};});_0x4ec60f[_0xa599('0x34')]=_[_0xa599('0x2f')](_0x1829a6,'name');_0x4ec60f['query']=_[_0xa599('0x35')](_0x5a443e[_0xa599('0x36')]);_0x4ec60f[_0xa599('0x37')]=_[_0xa599('0x38')](_0x4ec60f[_0xa599('0x34')],_0x4ec60f[_0xa599('0x36')]);_0x1b614a[_0xa599('0x39')]=_[_0xa599('0x38')](_0x4ec60f[_0xa599('0x34')],qs['fields'](_0x5a443e[_0xa599('0x36')][_0xa599('0x3a')]));_0x1b614a[_0xa599('0x39')]=_0x1b614a[_0xa599('0x39')]['length']?_0x1b614a[_0xa599('0x39')]:_0x4ec60f[_0xa599('0x34')];if(!_0x5a443e[_0xa599('0x36')][_0xa599('0x3b')]('nolimit')){_0x1b614a[_0xa599('0x1d')]=qs[_0xa599('0x1d')](_0x5a443e['query'][_0xa599('0x1d')]);_0x1b614a[_0xa599('0x1b')]=qs[_0xa599('0x1b')](_0x5a443e['query']['offset']);}_0x1b614a[_0xa599('0x3c')]=qs[_0xa599('0x3d')](_0x5a443e[_0xa599('0x36')][_0xa599('0x3d')]);_0x1b614a[_0xa599('0x3e')]=qs[_0xa599('0x37')](_['pick'](_0x5a443e[_0xa599('0x36')],_0x4ec60f['filters']),_0x1829a6);if(_0x5a443e[_0xa599('0x36')][_0xa599('0x3f')]){_0x1b614a[_0xa599('0x3e')]=_[_0xa599('0x40')](_0x1b614a[_0xa599('0x3e')],{'$or':_[_0xa599('0x2f')](_0x1829a6,function(_0x4afe16){if(_0x4afe16[_0xa599('0x33')]!==_0xa599('0x41')){var _0x9b7072={};_0x9b7072[_0x4afe16[_0xa599('0x2c')]]={'$like':'%'+_0x5a443e[_0xa599('0x36')]['filter']+'%'};return _0x9b7072;}})});}_0x1b614a=_[_0xa599('0x40')]({},_0x1b614a,_0x5a443e['options']);var _0x3a208c={'where':_0x1b614a['where']};return db['Template'][_0xa599('0x1e')](_0x3a208c)[_0xa599('0x26')](function(_0xb4704b){_0x20108d[_0xa599('0x1e')]=_0xb4704b;if(_0x5a443e[_0xa599('0x36')][_0xa599('0x42')]){_0x1b614a[_0xa599('0x43')]=[{'all':!![]}];}return db[_0xa599('0x30')][_0xa599('0x44')](_0x1b614a);})[_0xa599('0x26')](function(_0x4831ff){_0x20108d[_0xa599('0x45')]=_0x4831ff;return _0x20108d;})[_0xa599('0x26')](respondWithFilteredResult(_0x18de1d,_0x1b614a))['catch'](handleError(_0x18de1d,null));};exports['show']=function(_0x3ab95d,_0x4e18d9){var _0x447a3b={'raw':!![],'where':{'id':_0x3ab95d[_0xa599('0x46')]['id']}},_0x34b02a={};_0x34b02a[_0xa599('0x34')]=_['keys'](db[_0xa599('0x30')]['rawAttributes']);_0x34b02a[_0xa599('0x36')]=_[_0xa599('0x35')](_0x3ab95d[_0xa599('0x36')]);_0x34b02a[_0xa599('0x37')]=_['intersection'](_0x34b02a[_0xa599('0x34')],_0x34b02a['query']);_0x447a3b[_0xa599('0x39')]=_[_0xa599('0x38')](_0x34b02a[_0xa599('0x34')],qs[_0xa599('0x3a')](_0x3ab95d[_0xa599('0x36')]['fields']));_0x447a3b['attributes']=_0x447a3b[_0xa599('0x39')][_0xa599('0x47')]?_0x447a3b[_0xa599('0x39')]:_0x34b02a[_0xa599('0x34')];if(_0x3ab95d[_0xa599('0x36')]['includeAll']){_0x447a3b[_0xa599('0x43')]=[{'all':!![]}];}_0x447a3b=_[_0xa599('0x40')]({},_0x447a3b,_0x3ab95d['options']);return db[_0xa599('0x30')][_0xa599('0x48')](_0x447a3b)[_0xa599('0x26')](handleEntityNotFound(_0x4e18d9,null))['then'](respondWithResult(_0x4e18d9,null))[_0xa599('0x49')](handleError(_0x4e18d9,null));};exports[_0xa599('0x4a')]=function(_0xd88d03,_0x3f3475){return db['Template'][_0xa599('0x4a')](_0xd88d03[_0xa599('0x4b')],{})['then'](function(_0x4a340a){var _0x2d61ac=_0xd88d03[_0xa599('0x4c')][_0xa599('0x27')]({'plain':!![]});if(!_0x2d61ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d61ac['role']===_0xa599('0x4c')){var _0x2b40cd=_0x4a340a[_0xa599('0x27')]({'plain':!![]});var _0x13d209=_0xa599('0x28');return db[_0xa599('0x4d')][_0xa599('0x48')]({'where':{'name':_0x13d209,'userProfileId':_0x2d61ac[_0xa599('0x4e')]},'raw':!![]})['then'](function(_0x1a5b08){if(_0x1a5b08&&_0x1a5b08[_0xa599('0x4f')]===0x0){return db[_0xa599('0x29')][_0xa599('0x4a')]({'name':_0x2b40cd[_0xa599('0x2c')],'resourceId':_0x2b40cd['id'],'type':_0x1a5b08[_0xa599('0x2c')],'sectionId':_0x1a5b08['id']},{})[_0xa599('0x26')](function(){return _0x4a340a;});}else{return _0x4a340a;}})[_0xa599('0x49')](function(_0x43e459){logger[_0xa599('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43e459);throw _0x43e459;});}return _0x4a340a;})['then'](respondWithResult(_0x3f3475,0xc9))[_0xa599('0x49')](handleError(_0x3f3475,null));};exports[_0xa599('0x24')]=function(_0x40d323,_0x5d2ca6){if(_0x40d323[_0xa599('0x4b')]['id']){delete _0x40d323[_0xa599('0x4b')]['id'];}return db['Template']['find']({'where':{'id':_0x40d323['params']['id']}})[_0xa599('0x26')](handleEntityNotFound(_0x5d2ca6,null))[_0xa599('0x26')](saveUpdates(_0x40d323[_0xa599('0x4b')],null))[_0xa599('0x26')](respondWithResult(_0x5d2ca6,null))[_0xa599('0x49')](handleError(_0x5d2ca6,null));};exports[_0xa599('0x25')]=function(_0x282630,_0x154fca){return db[_0xa599('0x30')][_0xa599('0x48')]({'where':{'id':_0x282630['params']['id']}})[_0xa599('0x26')](handleEntityNotFound(_0x154fca,null))[_0xa599('0x26')](removeEntity(_0x154fca,null))[_0xa599('0x49')](handleError(_0x154fca,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ed7fa24..b57092d 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 _0x2c11=['./template.attributes','exports','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5066e3,_0xd9c4dd){var _0x279fc5=function(_0x48965f){while(--_0x48965f){_0x5066e3['push'](_0x5066e3['shift']());}};_0x279fc5(++_0xd9c4dd);}(_0x2c11,0xea));var _0x12c1=function(_0xb0975b,_0x93b0d6){_0xb0975b=_0xb0975b-0x0;var _0x320d30=_0x2c11[_0xb0975b];return _0x320d30;};'use strict';var _=require(_0x12c1('0x0'));var util=require(_0x12c1('0x1'));var logger=require(_0x12c1('0x2'))('api');var moment=require(_0x12c1('0x3'));var BPromise=require(_0x12c1('0x4'));var rp=require(_0x12c1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x12c1('0x6'));module[_0x12c1('0x7')]=function(_0x2b1956,_0x1ce81b){return _0x2b1956['define']('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c9=['rimraf','../../config/environment','exports','Template','tools_templates','lodash','util','api','moment','request-promise','path'];(function(_0x3046d5,_0x3ad1da){var _0x12ab8c=function(_0x563759){while(--_0x563759){_0x3046d5['push'](_0x3046d5['shift']());}};_0x12ab8c(++_0x3ad1da);}(_0xa5c9,0x1c8));var _0x9a5c=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0xa5c9[_0x4d7116];return _0x4593dc;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var logger=require('../../config/logger')(_0x9a5c('0x2'));var moment=require(_0x9a5c('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a5c('0x4'));var fs=require('fs');var path=require(_0x9a5c('0x5'));var rimraf=require(_0x9a5c('0x6'));var config=require(_0x9a5c('0x7'));var attributes=require('./template.attributes');module[_0x9a5c('0x8')]=function(_0xc7bdb9,_0x28fcd3){return _0xc7bdb9['define'](_0x9a5c('0x9'),attributes,{'tableName':_0x9a5c('0xa'),'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 3175ac1..3321772 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 _0x8dfb=['info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','then','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x5ab97e,_0x4d27eb){var _0x2a3dfa=function(_0x5b43af){while(--_0x5b43af){_0x5ab97e['push'](_0x5ab97e['shift']());}};_0x2a3dfa(++_0x4d27eb);}(_0x8dfb,0x189));var _0xb8df=function(_0x48d99d,_0x1e297b){_0x48d99d=_0x48d99d-0x0;var _0x18b0a6=_0x8dfb[_0x48d99d];return _0x18b0a6;};'use strict';var _=require(_0xb8df('0x0'));var util=require('util');var moment=require(_0xb8df('0x1'));var BPromise=require('bluebird');var rs=require(_0xb8df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8df('0x3'))['db'];var utils=require(_0xb8df('0x4'));var logger=require(_0xb8df('0x5'))('rpc');var config=require(_0xb8df('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb8df('0x7')][_0xb8df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x236a75,_0x2d79e0,_0x3a2487){return new BPromise(function(_0x2294e9,_0x11d4b6){return client[_0xb8df('0x9')](_0x236a75,_0x3a2487)['then'](function(_0x37c9b8){logger[_0xb8df('0xa')](_0xb8df('0xb'),_0x2d79e0,'request\x20sent');logger[_0xb8df('0xc')](_0xb8df('0xd'),_0x2d79e0,'request\x20sent',JSON[_0xb8df('0xe')](_0x37c9b8));if(_0x37c9b8[_0xb8df('0xf')]){if(_0x37c9b8['error'][_0xb8df('0x10')]===0x1f4){logger[_0xb8df('0xf')](_0xb8df('0xb'),_0x2d79e0,_0x37c9b8[_0xb8df('0xf')][_0xb8df('0x11')]);return _0x11d4b6(_0x37c9b8['error'][_0xb8df('0x11')]);}logger[_0xb8df('0xf')](_0xb8df('0xb'),_0x2d79e0,_0x37c9b8['error'][_0xb8df('0x11')]);return _0x2294e9(_0x37c9b8['error'][_0xb8df('0x11')]);}else{logger[_0xb8df('0xa')](_0xb8df('0xb'),_0x2d79e0,_0xb8df('0x12'));_0x2294e9(_0x37c9b8['result'][_0xb8df('0x11')]);}})['catch'](function(_0x3ef3fe){logger['error'](_0xb8df('0xb'),_0x2d79e0,_0x3ef3fe);_0x11d4b6(_0x3ef3fe);});});}exports[_0xb8df('0x13')]=function(_0x4e7b06){var _0xd920b8=this;return new Promise(function(_0x262a83,_0x40b88b){return db[_0xb8df('0x14')]['findAll']({'raw':_0x4e7b06[_0xb8df('0x15')]?_0x4e7b06[_0xb8df('0x15')][_0xb8df('0x16')]===undefined?!![]:![]:!![],'where':_0x4e7b06[_0xb8df('0x15')]?_0x4e7b06[_0xb8df('0x15')][_0xb8df('0x17')]||null:null,'attributes':_0x4e7b06['options']?_0x4e7b06[_0xb8df('0x15')][_0xb8df('0x18')]||null:null,'limit':_0x4e7b06[_0xb8df('0x15')]?_0x4e7b06['options'][_0xb8df('0x19')]||null:null,'include':_0x4e7b06[_0xb8df('0x15')]?_0x4e7b06['options'][_0xb8df('0x1a')]?_[_0xb8df('0x1b')](_0x4e7b06[_0xb8df('0x15')][_0xb8df('0x1a')],function(_0xb9910f){return{'model':db[_0xb9910f[_0xb8df('0x1c')]],'as':_0xb9910f['as'],'attributes':_0xb9910f['attributes'],'include':_0xb9910f[_0xb8df('0x1a')]?_[_0xb8df('0x1b')](_0xb9910f[_0xb8df('0x1a')],function(_0x422c19){return{'model':db[_0x422c19[_0xb8df('0x1c')]],'as':_0x422c19['as'],'attributes':_0x422c19[_0xb8df('0x18')],'include':_0x422c19['include']?_['map'](_0x422c19[_0xb8df('0x1a')],function(_0x375d93){return{'model':db[_0x375d93[_0xb8df('0x1c')]],'as':_0x375d93['as'],'attributes':_0x375d93['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8df('0x1d')](function(_0x4627ff){logger[_0xb8df('0xa')]('GetTemplate',_0x4e7b06);logger[_0xb8df('0xc')](_0xb8df('0x13'),_0x4e7b06,JSON[_0xb8df('0xe')](_0x4627ff));_0x262a83(_0x4627ff);})[_0xb8df('0x1e')](function(_0x324ff1){logger[_0xb8df('0xf')](_0xb8df('0x13'),_0x324ff1[_0xb8df('0x11')],_0x4e7b06);_0x40b88b(_0xd920b8[_0xb8df('0xf')](0x1f4,_0x324ff1[_0xb8df('0x11')]));});});}; \ No newline at end of file +var _0xac4a=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','where','limit','include','model','attributes','map','lodash'];(function(_0x28b343,_0x2561f8){var _0x14614a=function(_0x3b4b34){while(--_0x3b4b34){_0x28b343['push'](_0x28b343['shift']());}};_0x14614a(++_0x2561f8);}(_0xac4a,0x13f));var _0xaac4=function(_0x414fa7,_0x393530){_0x414fa7=_0x414fa7-0x0;var _0x1abcfb=_0xac4a[_0x414fa7];return _0x1abcfb;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('Template,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('Template,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});}exports[_0xaac4('0x15')]=function(_0x52085a){var _0x220630=this;return new Promise(function(_0x5b6fd6,_0x3ce35a){return db[_0xaac4('0x16')][_0xaac4('0x17')]({'raw':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x19')]===undefined?!![]:![]:!![],'where':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1a')]||null:null,'attributes':_0x52085a['options']?_0x52085a[_0xaac4('0x18')]['attributes']||null:null,'limit':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1b')]||null:null,'include':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')]?_['map'](_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')],function(_0x174860){return{'model':db[_0x174860[_0xaac4('0x1d')]],'as':_0x174860['as'],'attributes':_0x174860[_0xaac4('0x1e')],'include':_0x174860[_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0x174860['include'],function(_0x24186b){return{'model':db[_0x24186b['model']],'as':_0x24186b['as'],'attributes':_0x24186b['attributes'],'include':_0x24186b['include']?_['map'](_0x24186b[_0xaac4('0x1c')],function(_0x17d25f){return{'model':db[_0x17d25f[_0xaac4('0x1d')]],'as':_0x17d25f['as'],'attributes':_0x17d25f[_0xaac4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaac4('0xa')](function(_0x249a5d){logger[_0xaac4('0xb')](_0xaac4('0x15'),_0x52085a);logger[_0xaac4('0xc')](_0xaac4('0x15'),_0x52085a,JSON['stringify'](_0x249a5d));_0x5b6fd6(_0x249a5d);})[_0xaac4('0x14')](function(_0x16b33c){logger[_0xaac4('0x10')](_0xaac4('0x15'),_0x16b33c[_0xaac4('0x12')],_0x52085a);_0x3ce35a(_0x220630[_0xaac4('0x10')](0x1f4,_0x16b33c['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 979133a..bc583d9 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 _0x4ffa=['post','addAllCondition','addAction','update','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ffa,0x124));var _0xa4ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4ffa[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa4ff('0x0'));var timeout=require('connect-timeout');var express=require(_0xa4ff('0x1'));var router=express[_0xa4ff('0x2')]();var fs_extra=require(_0xa4ff('0x3'));var auth=require(_0xa4ff('0x4'));var interaction=require(_0xa4ff('0x5'));var config=require(_0xa4ff('0x6'));var controller=require('./trigger.controller');router[_0xa4ff('0x7')]('/',auth[_0xa4ff('0x8')](),controller[_0xa4ff('0x9')]);router['get'](_0xa4ff('0xa'),auth['isAuthenticated'](),controller[_0xa4ff('0xb')]);router[_0xa4ff('0x7')](_0xa4ff('0xc'),auth['isAuthenticated'](),controller[_0xa4ff('0xd')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xa4ff('0xe')]);router[_0xa4ff('0x7')](_0xa4ff('0xf'),auth[_0xa4ff('0x8')](),controller['getActions']);router[_0xa4ff('0x10')]('/',auth[_0xa4ff('0x8')](),controller['create']);router[_0xa4ff('0x10')](_0xa4ff('0xc'),auth['isAuthenticated'](),controller[_0xa4ff('0x11')]);router[_0xa4ff('0x10')]('/:id/any_conditions',auth[_0xa4ff('0x8')](),controller['addAnyCondition']);router[_0xa4ff('0x10')]('/:id/actions',auth[_0xa4ff('0x8')](),controller[_0xa4ff('0x12')]);router['put'](_0xa4ff('0xa'),auth[_0xa4ff('0x8')](),controller[_0xa4ff('0x13')]);router[_0xa4ff('0x14')](_0xa4ff('0xa'),auth[_0xa4ff('0x8')](),controller['destroy']);module[_0xa4ff('0x15')]=router; \ No newline at end of file +var _0x4111=['path','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','addAllCondition','post','addAnyCondition','addAction','exports','util'];(function(_0x511cc0,_0x32a00a){var _0x3c136e=function(_0x19e836){while(--_0x19e836){_0x511cc0['push'](_0x511cc0['shift']());}};_0x3c136e(++_0x32a00a);}(_0x4111,0x1cb));var _0x1411=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4111[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1411('0x0'));var path=require(_0x1411('0x1'));var timeout=require('connect-timeout');var express=require(_0x1411('0x2'));var router=express[_0x1411('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1411('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1411('0x5'));var controller=require(_0x1411('0x6'));router[_0x1411('0x7')]('/',auth[_0x1411('0x8')](),controller[_0x1411('0x9')]);router[_0x1411('0x7')](_0x1411('0xa'),auth[_0x1411('0x8')](),controller['show']);router[_0x1411('0x7')](_0x1411('0xb'),auth[_0x1411('0x8')](),controller[_0x1411('0xc')]);router[_0x1411('0x7')](_0x1411('0xd'),auth[_0x1411('0x8')](),controller[_0x1411('0xe')]);router[_0x1411('0x7')](_0x1411('0xf'),auth[_0x1411('0x8')](),controller[_0x1411('0x10')]);router['post']('/',auth[_0x1411('0x8')](),controller[_0x1411('0x11')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x1411('0x12')]);router[_0x1411('0x13')](_0x1411('0xd'),auth[_0x1411('0x8')](),controller[_0x1411('0x14')]);router[_0x1411('0x13')](_0x1411('0xf'),auth['isAuthenticated'](),controller[_0x1411('0x15')]);router['put'](_0x1411('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1411('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index b584187..6fc7e53 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 _0x919a=['BOOLEAN','STRING'];(function(_0x4dfd10,_0x3169d5){var _0x267950=function(_0x15b4ae){while(--_0x15b4ae){_0x4dfd10['push'](_0x4dfd10['shift']());}};_0x267950(++_0x3169d5);}(_0x919a,0x1b9));var _0xa919=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x919a[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa919('0x0')]},'channel':{'type':Sequelize[_0xa919('0x0')]},'description':{'type':Sequelize[_0xa919('0x0')]},'status':{'type':Sequelize[_0xa919('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x37f0=['BOOLEAN','sequelize','exports','STRING'];(function(_0x567011,_0x273172){var _0x50ac02=function(_0x79f2ba){while(--_0x79f2ba){_0x567011['push'](_0x567011['shift']());}};_0x50ac02(++_0x273172);}(_0x37f0,0x18d));var _0x037f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x37f0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x037f('0x0'));module[_0x037f('0x1')]={'name':{'type':Sequelize[_0x037f('0x2')]},'channel':{'type':Sequelize[_0x037f('0x2')]},'description':{'type':Sequelize[_0x037f('0x2')]},'status':{'type':Sequelize[_0x037f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 3f782e6..e404798 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 _0x0ec1=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','index','Trigger','rawAttributes','type','key','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','Condition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x224f44,_0xc57d1f){var _0xa60435=function(_0x22a69b){while(--_0x22a69b){_0x224f44['push'](_0x224f44['shift']());}};_0xa60435(++_0xc57d1f);}(_0x0ec1,0x16b));var _0x10ec=function(_0x536b06,_0x47e3c6){_0x536b06=_0x536b06-0x0;var _0x375d82=_0x0ec1[_0x536b06];return _0x375d82;};'use strict';var emlformat=require(_0x10ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x10ec('0x2'));var moment=require(_0x10ec('0x3'));var BPromise=require(_0x10ec('0x4'));var Mustache=require(_0x10ec('0x5'));var util=require(_0x10ec('0x6'));var path=require(_0x10ec('0x7'));var sox=require(_0x10ec('0x8'));var csv=require(_0x10ec('0x9'));var ejs=require(_0x10ec('0xa'));var fs=require('fs');var fs_extra=require(_0x10ec('0xb'));var _=require('lodash');var squel=require(_0x10ec('0xc'));var crypto=require(_0x10ec('0xd'));var jsforce=require(_0x10ec('0xe'));var deskjs=require(_0x10ec('0xf'));var toCsv=require(_0x10ec('0x9'));var querystring=require(_0x10ec('0x10'));var Papa=require(_0x10ec('0x11'));var Redis=require(_0x10ec('0x12'));var authService=require(_0x10ec('0x13'));var qs=require(_0x10ec('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x10ec('0x15'))(_0x10ec('0x16'));var utils=require(_0x10ec('0x17'));var config=require(_0x10ec('0x18'));var licenseUtil=require(_0x10ec('0x19'));var db=require(_0x10ec('0x1a'))['db'];function respondWithStatusCode(_0x197024,_0x44b403){_0x44b403=_0x44b403||0xcc;return function(_0x18b135){if(_0x18b135){return _0x197024[_0x10ec('0x1b')](_0x44b403);}return _0x197024[_0x10ec('0x1c')](_0x44b403)[_0x10ec('0x1d')]();};}function respondWithResult(_0x2a15c3,_0xfeeeda){_0xfeeeda=_0xfeeeda||0xc8;return function(_0x3a29f5){if(_0x3a29f5){return _0x2a15c3['status'](_0xfeeeda)[_0x10ec('0x1e')](_0x3a29f5);}};}function respondWithFilteredResult(_0x563a12,_0x2d45d0){return function(_0x3bbf48){if(_0x3bbf48){var _0x2c2fe9=typeof _0x2d45d0[_0x10ec('0x1f')]===_0x10ec('0x20')&&typeof _0x2d45d0['limit']==='undefined';var _0x4c99a8=_0x3bbf48['count'];var _0x4b91af=_0x2c2fe9?0x0:_0x2d45d0['offset'];var _0x32f4e5=_0x2c2fe9?_0x3bbf48[_0x10ec('0x21')]:_0x2d45d0[_0x10ec('0x1f')]+_0x2d45d0[_0x10ec('0x22')];var _0x5e430e;if(_0x32f4e5>=_0x4c99a8){_0x32f4e5=_0x4c99a8;_0x5e430e=0xc8;}else{_0x5e430e=0xce;}_0x563a12[_0x10ec('0x1c')](_0x5e430e);return _0x563a12[_0x10ec('0x23')]('Content-Range',_0x4b91af+'-'+_0x32f4e5+'/'+_0x4c99a8)[_0x10ec('0x1e')](_0x3bbf48);}return null;};}function patchUpdates(_0x12bfaf){return function(_0x12590b){try{jsonpatch[_0x10ec('0x24')](_0x12590b,_0x12bfaf,!![]);}catch(_0x528564){return BPromise[_0x10ec('0x25')](_0x528564);}return _0x12590b[_0x10ec('0x26')]();};}function saveUpdates(_0x5cb07a,_0x2dc09e){return function(_0x293678){if(_0x293678){return _0x293678[_0x10ec('0x27')](_0x5cb07a)[_0x10ec('0x28')](function(_0x5b56d6){return _0x5b56d6;});}return null;};}function removeEntity(_0x3065dc,_0x2b6645){return function(_0xb70239){if(_0xb70239){return _0xb70239[_0x10ec('0x29')]()['then'](function(){var _0x5d6427=_0xb70239[_0x10ec('0x2a')]({'plain':!![]});var _0x16b99f=_0x10ec('0x2b');return db[_0x10ec('0x2c')][_0x10ec('0x29')]({'where':{'type':_0x16b99f,'resourceId':_0x5d6427['id']}})[_0x10ec('0x28')](function(){return _0xb70239;});})['then'](function(){_0x3065dc[_0x10ec('0x1c')](0xcc)[_0x10ec('0x1d')]();});}};}function handleEntityNotFound(_0x1c15d5,_0x26801d){return function(_0x2418ae){if(!_0x2418ae){_0x1c15d5['sendStatus'](0x194);}return _0x2418ae;};}function handleError(_0xee90d,_0x5125a8){_0x5125a8=_0x5125a8||0x1f4;return function(_0x57127e){logger[_0x10ec('0x2d')](_0x57127e['stack']);if(_0x57127e[_0x10ec('0x2e')]){delete _0x57127e[_0x10ec('0x2e')];}_0xee90d[_0x10ec('0x1c')](_0x5125a8)['send'](_0x57127e);};}exports[_0x10ec('0x2f')]=function(_0x464f5e,_0x541faf){var _0x4deccd={},_0x58efba={},_0x19ce7d={'count':0x0,'rows':[]};var _0x39faf1=_['map'](db[_0x10ec('0x30')][_0x10ec('0x31')],function(_0x433d0a){return{'name':_0x433d0a['fieldName'],'type':_0x433d0a[_0x10ec('0x32')][_0x10ec('0x33')]};});_0x58efba[_0x10ec('0x34')]=_[_0x10ec('0x35')](_0x39faf1,_0x10ec('0x2e'));_0x58efba['query']=_['keys'](_0x464f5e['query']);_0x58efba[_0x10ec('0x36')]=_[_0x10ec('0x37')](_0x58efba[_0x10ec('0x34')],_0x58efba[_0x10ec('0x38')]);_0x4deccd['attributes']=_[_0x10ec('0x37')](_0x58efba[_0x10ec('0x34')],qs[_0x10ec('0x39')](_0x464f5e[_0x10ec('0x38')][_0x10ec('0x39')]));_0x4deccd[_0x10ec('0x3a')]=_0x4deccd['attributes'][_0x10ec('0x3b')]?_0x4deccd['attributes']:_0x58efba['model'];if(!_0x464f5e[_0x10ec('0x38')][_0x10ec('0x3c')](_0x10ec('0x3d'))){_0x4deccd[_0x10ec('0x22')]=qs[_0x10ec('0x22')](_0x464f5e[_0x10ec('0x38')][_0x10ec('0x22')]);_0x4deccd[_0x10ec('0x1f')]=qs[_0x10ec('0x1f')](_0x464f5e[_0x10ec('0x38')]['offset']);}_0x4deccd[_0x10ec('0x3e')]=qs[_0x10ec('0x3f')](_0x464f5e[_0x10ec('0x38')]['sort']);_0x4deccd[_0x10ec('0x40')]=qs[_0x10ec('0x36')](_[_0x10ec('0x41')](_0x464f5e[_0x10ec('0x38')],_0x58efba[_0x10ec('0x36')]),_0x39faf1);if(_0x464f5e[_0x10ec('0x38')][_0x10ec('0x42')]){_0x4deccd['where']=_[_0x10ec('0x43')](_0x4deccd['where'],{'$or':_[_0x10ec('0x35')](_0x39faf1,function(_0x3f0a79){if(_0x3f0a79['type']!==_0x10ec('0x44')){var _0x2bb951={};_0x2bb951[_0x3f0a79[_0x10ec('0x2e')]]={'$like':'%'+_0x464f5e['query']['filter']+'%'};return _0x2bb951;}})});}_0x4deccd=_[_0x10ec('0x43')]({},_0x4deccd,_0x464f5e[_0x10ec('0x45')]);var _0x567d7a={'where':_0x4deccd['where']};return db[_0x10ec('0x30')][_0x10ec('0x21')](_0x567d7a)[_0x10ec('0x28')](function(_0x344ace){_0x19ce7d['count']=_0x344ace;if(_0x464f5e[_0x10ec('0x38')][_0x10ec('0x46')]){_0x4deccd[_0x10ec('0x47')]=[{'all':!![]}];}return db['Trigger'][_0x10ec('0x48')](_0x4deccd);})['then'](function(_0x239f71){_0x19ce7d['rows']=_0x239f71;return _0x19ce7d;})[_0x10ec('0x28')](respondWithFilteredResult(_0x541faf,_0x4deccd))[_0x10ec('0x49')](handleError(_0x541faf,null));};exports[_0x10ec('0x4a')]=function(_0x25254f,_0x25e4e7){var _0x8fdd01={'raw':![],'where':{'id':_0x25254f[_0x10ec('0x4b')]['id']}},_0x183795={};_0x183795['model']=_['keys'](db['Trigger'][_0x10ec('0x31')]);_0x183795[_0x10ec('0x38')]=_[_0x10ec('0x4c')](_0x25254f[_0x10ec('0x38')]);_0x183795[_0x10ec('0x36')]=_['intersection'](_0x183795[_0x10ec('0x34')],_0x183795[_0x10ec('0x38')]);_0x8fdd01[_0x10ec('0x3a')]=_[_0x10ec('0x37')](_0x183795['model'],qs[_0x10ec('0x39')](_0x25254f[_0x10ec('0x38')]['fields']));_0x8fdd01[_0x10ec('0x3a')]=_0x8fdd01[_0x10ec('0x3a')]['length']?_0x8fdd01[_0x10ec('0x3a')]:_0x183795[_0x10ec('0x34')];if(_0x25254f[_0x10ec('0x38')]['includeAll']){_0x8fdd01[_0x10ec('0x47')]=[{'all':!![]}];}_0x8fdd01=_[_0x10ec('0x43')]({},_0x8fdd01,_0x25254f['options']);return db[_0x10ec('0x30')]['find'](_0x8fdd01)['then'](handleEntityNotFound(_0x25e4e7,null))[_0x10ec('0x28')](respondWithResult(_0x25e4e7,null))[_0x10ec('0x49')](handleError(_0x25e4e7,null));};exports['create']=function(_0x4d5160,_0x223dfb){return db[_0x10ec('0x30')]['create'](_0x4d5160[_0x10ec('0x4d')],{})[_0x10ec('0x28')](function(_0x22e162){var _0x32f8e4=_0x4d5160[_0x10ec('0x4e')]['get']({'plain':!![]});if(!_0x32f8e4)throw new Error(_0x10ec('0x4f'));if(_0x32f8e4['role']===_0x10ec('0x4e')){var _0x20348c=_0x22e162[_0x10ec('0x2a')]({'plain':!![]});var _0x29460d=_0x10ec('0x2b');return db['UserProfileSection'][_0x10ec('0x50')]({'where':{'name':_0x29460d,'userProfileId':_0x32f8e4['userProfileId']},'raw':!![]})[_0x10ec('0x28')](function(_0x3a0695){if(_0x3a0695&&_0x3a0695['autoAssociation']===0x0){return db[_0x10ec('0x2c')][_0x10ec('0x51')]({'name':_0x20348c['name'],'resourceId':_0x20348c['id'],'type':_0x3a0695[_0x10ec('0x2e')],'sectionId':_0x3a0695['id']},{})[_0x10ec('0x28')](function(){return _0x22e162;});}else{return _0x22e162;}})[_0x10ec('0x49')](function(_0x296b64){logger[_0x10ec('0x2d')](_0x10ec('0x52'),_0x296b64);throw _0x296b64;});}return _0x22e162;})[_0x10ec('0x28')](respondWithResult(_0x223dfb,0xc9))['catch'](handleError(_0x223dfb,null));};exports[_0x10ec('0x27')]=function(_0x26bcc4,_0x556379){if(_0x26bcc4[_0x10ec('0x4d')]['id']){delete _0x26bcc4['body']['id'];}return db[_0x10ec('0x30')][_0x10ec('0x50')]({'where':{'id':_0x26bcc4[_0x10ec('0x4b')]['id']}})[_0x10ec('0x28')](handleEntityNotFound(_0x556379,null))[_0x10ec('0x28')](saveUpdates(_0x26bcc4[_0x10ec('0x4d')],null))['then'](respondWithResult(_0x556379,null))[_0x10ec('0x49')](handleError(_0x556379,null));};exports['destroy']=function(_0x42a657,_0x4da5e4){return db[_0x10ec('0x30')][_0x10ec('0x50')]({'where':{'id':_0x42a657['params']['id']}})[_0x10ec('0x28')](handleEntityNotFound(_0x4da5e4,null))[_0x10ec('0x28')](removeEntity(_0x4da5e4,null))[_0x10ec('0x49')](handleError(_0x4da5e4,null));};exports[_0x10ec('0x53')]=function(_0xf7af1c,_0x4e9525,_0x54fee6){if(_0xf7af1c['body']['id']){delete _0xf7af1c[_0x10ec('0x4d')]['id'];}return db[_0x10ec('0x30')][_0x10ec('0x50')]({'where':{'id':_0xf7af1c[_0x10ec('0x4b')]['id']}})[_0x10ec('0x28')](handleEntityNotFound(_0x4e9525,null))[_0x10ec('0x28')](function(_0x58107a){if(_0x58107a){_0xf7af1c[_0x10ec('0x4d')][_0x10ec('0x54')]=_0x58107a['id'];return db['Condition'][_0x10ec('0x51')](_0xf7af1c[_0x10ec('0x4d')]);}})['then'](respondWithResult(_0x4e9525,null))[_0x10ec('0x49')](handleError(_0x4e9525,null));};exports[_0x10ec('0x55')]=function(_0xee657a,_0x3571bd,_0xd54337){if(_0xee657a[_0x10ec('0x4d')]['id']){delete _0xee657a[_0x10ec('0x4d')]['id'];}return db[_0x10ec('0x30')][_0x10ec('0x50')]({'where':{'id':_0xee657a['params']['id']}})[_0x10ec('0x28')](handleEntityNotFound(_0x3571bd,null))[_0x10ec('0x28')](function(_0xbc86ae){if(_0xbc86ae){_0xee657a[_0x10ec('0x4d')]['TriggerAnyId']=_0xbc86ae['id'];return db[_0x10ec('0x56')][_0x10ec('0x51')](_0xee657a[_0x10ec('0x4d')]);}})[_0x10ec('0x28')](respondWithResult(_0x3571bd,null))['catch'](handleError(_0x3571bd,null));};exports[_0x10ec('0x57')]=function(_0x1859f3,_0x51f60e,_0x2d9925){var _0x42c101={};var _0x475532={};var _0x1dd457;var _0x24bfb4;return db['Trigger']['findOne']({'where':{'id':_0x1859f3[_0x10ec('0x4b')]['id']}})[_0x10ec('0x28')](handleEntityNotFound(_0x51f60e,null))['then'](function(_0x477cd5){if(_0x477cd5){_0x1dd457=_0x477cd5;_0x475532['model']=_[_0x10ec('0x4c')](db[_0x10ec('0x56')][_0x10ec('0x31')]);_0x475532['query']=_[_0x10ec('0x4c')](_0x1859f3['query']);_0x475532[_0x10ec('0x36')]=_['intersection'](_0x475532[_0x10ec('0x34')],_0x475532[_0x10ec('0x38')]);_0x42c101['attributes']=_[_0x10ec('0x37')](_0x475532[_0x10ec('0x34')],qs[_0x10ec('0x39')](_0x1859f3[_0x10ec('0x38')][_0x10ec('0x39')]));_0x42c101[_0x10ec('0x3a')]=_0x42c101['attributes'][_0x10ec('0x3b')]?_0x42c101[_0x10ec('0x3a')]:_0x475532['model'];_0x42c101[_0x10ec('0x3e')]=qs[_0x10ec('0x3f')](_0x1859f3[_0x10ec('0x38')][_0x10ec('0x3f')]);_0x42c101['where']=qs['filters'](_[_0x10ec('0x41')](_0x1859f3[_0x10ec('0x38')],_0x475532[_0x10ec('0x36')]));if(_0x1859f3[_0x10ec('0x38')][_0x10ec('0x42')]){_0x42c101[_0x10ec('0x40')]=_['merge'](_0x42c101[_0x10ec('0x40')],{'$or':_['map'](_0x42c101[_0x10ec('0x3a')],function(_0x16ea2f){var _0x3e3d89={};_0x3e3d89[_0x16ea2f]={'$like':'%'+_0x1859f3['query'][_0x10ec('0x42')]+'%'};return _0x3e3d89;})});}_0x42c101=_[_0x10ec('0x43')]({},_0x42c101,_0x1859f3[_0x10ec('0x45')]);return _0x1dd457[_0x10ec('0x57')](_0x42c101);}})['then'](function(_0x2964d2){if(_0x2964d2){_0x24bfb4=_0x2964d2[_0x10ec('0x3b')];if(!_0x1859f3[_0x10ec('0x38')][_0x10ec('0x3c')](_0x10ec('0x3d'))){_0x42c101[_0x10ec('0x22')]=qs[_0x10ec('0x22')](_0x1859f3[_0x10ec('0x38')][_0x10ec('0x22')]);_0x42c101['offset']=qs[_0x10ec('0x1f')](_0x1859f3['query'][_0x10ec('0x1f')]);}return _0x1dd457[_0x10ec('0x57')](_0x42c101);}})[_0x10ec('0x28')](function(_0x36815d){if(_0x36815d){return _0x36815d?{'count':_0x24bfb4,'rows':_0x36815d}:null;}})[_0x10ec('0x28')](respondWithResult(_0x51f60e,null))['catch'](handleError(_0x51f60e,null));};exports['getAnyConditions']=function(_0x5911a0,_0x3eeb4d,_0x31021a){var _0x4c2164={};var _0x296acf={};var _0xf07273;var _0x5d5228;return db[_0x10ec('0x30')][_0x10ec('0x58')]({'where':{'id':_0x5911a0[_0x10ec('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3eeb4d,null))[_0x10ec('0x28')](function(_0x15c667){if(_0x15c667){_0xf07273=_0x15c667;_0x296acf[_0x10ec('0x34')]=_[_0x10ec('0x4c')](db[_0x10ec('0x56')][_0x10ec('0x31')]);_0x296acf[_0x10ec('0x38')]=_[_0x10ec('0x4c')](_0x5911a0['query']);_0x296acf[_0x10ec('0x36')]=_[_0x10ec('0x37')](_0x296acf[_0x10ec('0x34')],_0x296acf[_0x10ec('0x38')]);_0x4c2164[_0x10ec('0x3a')]=_['intersection'](_0x296acf['model'],qs[_0x10ec('0x39')](_0x5911a0[_0x10ec('0x38')][_0x10ec('0x39')]));_0x4c2164[_0x10ec('0x3a')]=_0x4c2164[_0x10ec('0x3a')][_0x10ec('0x3b')]?_0x4c2164[_0x10ec('0x3a')]:_0x296acf[_0x10ec('0x34')];_0x4c2164[_0x10ec('0x3e')]=qs[_0x10ec('0x3f')](_0x5911a0[_0x10ec('0x38')]['sort']);_0x4c2164[_0x10ec('0x40')]=qs[_0x10ec('0x36')](_['pick'](_0x5911a0[_0x10ec('0x38')],_0x296acf[_0x10ec('0x36')]));if(_0x5911a0[_0x10ec('0x38')][_0x10ec('0x42')]){_0x4c2164[_0x10ec('0x40')]=_[_0x10ec('0x43')](_0x4c2164[_0x10ec('0x40')],{'$or':_[_0x10ec('0x35')](_0x4c2164[_0x10ec('0x3a')],function(_0x2bdc47){var _0x4fd489={};_0x4fd489[_0x2bdc47]={'$like':'%'+_0x5911a0[_0x10ec('0x38')]['filter']+'%'};return _0x4fd489;})});}_0x4c2164=_['merge']({},_0x4c2164,_0x5911a0[_0x10ec('0x45')]);return _0xf07273[_0x10ec('0x59')](_0x4c2164);}})[_0x10ec('0x28')](function(_0x2e815a){if(_0x2e815a){_0x5d5228=_0x2e815a[_0x10ec('0x3b')];if(!_0x5911a0[_0x10ec('0x38')]['hasOwnProperty'](_0x10ec('0x3d'))){_0x4c2164['limit']=qs[_0x10ec('0x22')](_0x5911a0[_0x10ec('0x38')]['limit']);_0x4c2164[_0x10ec('0x1f')]=qs['offset'](_0x5911a0[_0x10ec('0x38')]['offset']);}return _0xf07273[_0x10ec('0x59')](_0x4c2164);}})[_0x10ec('0x28')](function(_0xee5de3){if(_0xee5de3){return _0xee5de3?{'count':_0x5d5228,'rows':_0xee5de3}:null;}})[_0x10ec('0x28')](respondWithResult(_0x3eeb4d,null))[_0x10ec('0x49')](handleError(_0x3eeb4d,null));};exports[_0x10ec('0x5a')]=function(_0x18e074,_0x2ea964,_0x59da72){if(_0x18e074['body']['id']){delete _0x18e074[_0x10ec('0x4d')]['id'];}return db[_0x10ec('0x30')]['find']({'where':{'id':_0x18e074['params']['id']}})[_0x10ec('0x28')](handleEntityNotFound(_0x2ea964,null))[_0x10ec('0x28')](function(_0x198aa6){if(_0x198aa6){_0x18e074[_0x10ec('0x4d')][_0x10ec('0x5b')]=_0x198aa6['id'];return db[_0x10ec('0x5c')][_0x10ec('0x51')](_0x18e074[_0x10ec('0x4d')]);}})['then'](respondWithResult(_0x2ea964,null))[_0x10ec('0x49')](handleError(_0x2ea964,null));};exports['getActions']=function(_0x46cfc6,_0x87b248,_0x42d962){var _0x3d2e9d={};var _0x1e45a1={};var _0xe7d35e;var _0x16da19;return db[_0x10ec('0x30')]['findOne']({'where':{'id':_0x46cfc6[_0x10ec('0x4b')]['id']}})[_0x10ec('0x28')](handleEntityNotFound(_0x87b248,null))['then'](function(_0x57ddec){if(_0x57ddec){_0xe7d35e=_0x57ddec;_0x1e45a1[_0x10ec('0x34')]=_[_0x10ec('0x4c')](db[_0x10ec('0x5c')][_0x10ec('0x31')]);_0x1e45a1[_0x10ec('0x38')]=_[_0x10ec('0x4c')](_0x46cfc6['query']);_0x1e45a1[_0x10ec('0x36')]=_[_0x10ec('0x37')](_0x1e45a1[_0x10ec('0x34')],_0x1e45a1[_0x10ec('0x38')]);_0x3d2e9d['attributes']=_[_0x10ec('0x37')](_0x1e45a1[_0x10ec('0x34')],qs[_0x10ec('0x39')](_0x46cfc6[_0x10ec('0x38')][_0x10ec('0x39')]));_0x3d2e9d['attributes']=_0x3d2e9d[_0x10ec('0x3a')]['length']?_0x3d2e9d['attributes']:_0x1e45a1[_0x10ec('0x34')];_0x3d2e9d[_0x10ec('0x3e')]=qs[_0x10ec('0x3f')](_0x46cfc6[_0x10ec('0x38')][_0x10ec('0x3f')]);_0x3d2e9d[_0x10ec('0x40')]=qs[_0x10ec('0x36')](_[_0x10ec('0x41')](_0x46cfc6[_0x10ec('0x38')],_0x1e45a1[_0x10ec('0x36')]));if(_0x46cfc6[_0x10ec('0x38')][_0x10ec('0x42')]){_0x3d2e9d[_0x10ec('0x40')]=_[_0x10ec('0x43')](_0x3d2e9d[_0x10ec('0x40')],{'$or':_[_0x10ec('0x35')](_0x3d2e9d[_0x10ec('0x3a')],function(_0x5c7226){var _0x2e3417={};_0x2e3417[_0x5c7226]={'$like':'%'+_0x46cfc6['query'][_0x10ec('0x42')]+'%'};return _0x2e3417;})});}_0x3d2e9d=_['merge']({},_0x3d2e9d,_0x46cfc6[_0x10ec('0x45')]);return _0xe7d35e[_0x10ec('0x5d')](_0x3d2e9d);}})[_0x10ec('0x28')](function(_0x14bbc1){if(_0x14bbc1){_0x16da19=_0x14bbc1[_0x10ec('0x3b')];if(!_0x46cfc6[_0x10ec('0x38')][_0x10ec('0x3c')](_0x10ec('0x3d'))){_0x3d2e9d[_0x10ec('0x22')]=qs[_0x10ec('0x22')](_0x46cfc6[_0x10ec('0x38')]['limit']);_0x3d2e9d[_0x10ec('0x1f')]=qs[_0x10ec('0x1f')](_0x46cfc6['query'][_0x10ec('0x1f')]);}return _0xe7d35e['getActions'](_0x3d2e9d);}})[_0x10ec('0x28')](function(_0x542d7d){if(_0x542d7d){return _0x542d7d?{'count':_0x16da19,'rows':_0x542d7d}:null;}})[_0x10ec('0x28')](respondWithResult(_0x87b248,null))[_0x10ec('0x49')](handleError(_0x87b248,null));}; \ No newline at end of file +var _0x5162=['order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','show','intersection','include','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','findOne','addAction','getActions','Action','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','Triggers','end','sendStatus','error','name','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2decbe,_0x3e7eee){var _0x4c6def=function(_0x303509){while(--_0x303509){_0x2decbe['push'](_0x2decbe['shift']());}};_0x4c6def(++_0x3e7eee);}(_0x5162,0x1eb));var _0x2516=function(_0x528404,_0x27a5ba){_0x528404=_0x528404-0x0;var _0xe59e6b=_0x5162[_0x528404];return _0xe59e6b;};'use strict';var emlformat=require(_0x2516('0x0'));var rimraf=require(_0x2516('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2516('0x2'));var rp=require('request-promise');var moment=require(_0x2516('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2516('0x4'));var util=require(_0x2516('0x5'));var path=require('path');var sox=require(_0x2516('0x6'));var csv=require(_0x2516('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2516('0x8'));var _=require('lodash');var squel=require(_0x2516('0x9'));var crypto=require(_0x2516('0xa'));var jsforce=require(_0x2516('0xb'));var deskjs=require(_0x2516('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2516('0xd'));var Papa=require(_0x2516('0xe'));var Redis=require(_0x2516('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2516('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2516('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2516('0x12'));var config=require(_0x2516('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2516('0x14'))['db'];function respondWithStatusCode(_0x3e0060,_0xda8853){_0xda8853=_0xda8853||0xcc;return function(_0x43c41e){if(_0x43c41e){return _0x3e0060['sendStatus'](_0xda8853);}return _0x3e0060['status'](_0xda8853)['end']();};}function respondWithResult(_0x3463f2,_0x8daa10){_0x8daa10=_0x8daa10||0xc8;return function(_0x36a89c){if(_0x36a89c){return _0x3463f2[_0x2516('0x15')](_0x8daa10)['json'](_0x36a89c);}};}function respondWithFilteredResult(_0x41bb03,_0x1f512a){return function(_0x2ab3ca){if(_0x2ab3ca){var _0x2305a3=typeof _0x1f512a['offset']===_0x2516('0x16')&&typeof _0x1f512a[_0x2516('0x17')]===_0x2516('0x16');var _0x17afb0=_0x2ab3ca[_0x2516('0x18')];var _0x59b3cc=_0x2305a3?0x0:_0x1f512a[_0x2516('0x19')];var _0x1c1359=_0x2305a3?_0x2ab3ca[_0x2516('0x18')]:_0x1f512a['offset']+_0x1f512a[_0x2516('0x17')];var _0x3b5b4b;if(_0x1c1359>=_0x17afb0){_0x1c1359=_0x17afb0;_0x3b5b4b=0xc8;}else{_0x3b5b4b=0xce;}_0x41bb03['status'](_0x3b5b4b);return _0x41bb03[_0x2516('0x1a')](_0x2516('0x1b'),_0x59b3cc+'-'+_0x1c1359+'/'+_0x17afb0)[_0x2516('0x1c')](_0x2ab3ca);}return null;};}function patchUpdates(_0x10af4d){return function(_0x2d3627){try{jsonpatch[_0x2516('0x1d')](_0x2d3627,_0x10af4d,!![]);}catch(_0x4e1a75){return BPromise['reject'](_0x4e1a75);}return _0x2d3627[_0x2516('0x1e')]();};}function saveUpdates(_0x1b2985,_0x51d84a){return function(_0x46d4cd){if(_0x46d4cd){return _0x46d4cd[_0x2516('0x1f')](_0x1b2985)[_0x2516('0x20')](function(_0x199a66){return _0x199a66;});}return null;};}function removeEntity(_0x454851,_0x1c1e82){return function(_0x360cf7){if(_0x360cf7){return _0x360cf7[_0x2516('0x21')]()[_0x2516('0x20')](function(){var _0x3d4861=_0x360cf7['get']({'plain':!![]});var _0x4b52b9=_0x2516('0x22');return db['UserProfileResource'][_0x2516('0x21')]({'where':{'type':_0x4b52b9,'resourceId':_0x3d4861['id']}})['then'](function(){return _0x360cf7;});})[_0x2516('0x20')](function(){_0x454851[_0x2516('0x15')](0xcc)[_0x2516('0x23')]();});}};}function handleEntityNotFound(_0x21aec6,_0x394d67){return function(_0x2fd3d6){if(!_0x2fd3d6){_0x21aec6[_0x2516('0x24')](0x194);}return _0x2fd3d6;};}function handleError(_0x5ba1f3,_0xa4f5d2){_0xa4f5d2=_0xa4f5d2||0x1f4;return function(_0x23823e){logger[_0x2516('0x25')](_0x23823e['stack']);if(_0x23823e[_0x2516('0x26')]){delete _0x23823e[_0x2516('0x26')];}_0x5ba1f3[_0x2516('0x15')](_0xa4f5d2)['send'](_0x23823e);};}exports[_0x2516('0x27')]=function(_0xcdf1f3,_0x2a11d7){var _0x3c35d8={},_0xba7f49={},_0x48f4fb={'count':0x0,'rows':[]};var _0x46b39a=_[_0x2516('0x28')](db[_0x2516('0x29')][_0x2516('0x2a')],function(_0x518f50){return{'name':_0x518f50[_0x2516('0x2b')],'type':_0x518f50[_0x2516('0x2c')][_0x2516('0x2d')]};});_0xba7f49['model']=_[_0x2516('0x28')](_0x46b39a,_0x2516('0x26'));_0xba7f49[_0x2516('0x2e')]=_[_0x2516('0x2f')](_0xcdf1f3[_0x2516('0x2e')]);_0xba7f49[_0x2516('0x30')]=_['intersection'](_0xba7f49[_0x2516('0x31')],_0xba7f49['query']);_0x3c35d8[_0x2516('0x32')]=_['intersection'](_0xba7f49[_0x2516('0x31')],qs[_0x2516('0x33')](_0xcdf1f3[_0x2516('0x2e')][_0x2516('0x33')]));_0x3c35d8[_0x2516('0x32')]=_0x3c35d8['attributes'][_0x2516('0x34')]?_0x3c35d8[_0x2516('0x32')]:_0xba7f49[_0x2516('0x31')];if(!_0xcdf1f3[_0x2516('0x2e')][_0x2516('0x35')](_0x2516('0x36'))){_0x3c35d8[_0x2516('0x17')]=qs[_0x2516('0x17')](_0xcdf1f3['query'][_0x2516('0x17')]);_0x3c35d8[_0x2516('0x19')]=qs[_0x2516('0x19')](_0xcdf1f3[_0x2516('0x2e')][_0x2516('0x19')]);}_0x3c35d8[_0x2516('0x37')]=qs[_0x2516('0x38')](_0xcdf1f3['query'][_0x2516('0x38')]);_0x3c35d8[_0x2516('0x39')]=qs[_0x2516('0x30')](_[_0x2516('0x3a')](_0xcdf1f3['query'],_0xba7f49[_0x2516('0x30')]),_0x46b39a);if(_0xcdf1f3[_0x2516('0x2e')]['filter']){_0x3c35d8['where']=_[_0x2516('0x3b')](_0x3c35d8[_0x2516('0x39')],{'$or':_[_0x2516('0x28')](_0x46b39a,function(_0x22c8c0){if(_0x22c8c0[_0x2516('0x2c')]!==_0x2516('0x3c')){var _0x4f4bc5={};_0x4f4bc5[_0x22c8c0['name']]={'$like':'%'+_0xcdf1f3[_0x2516('0x2e')][_0x2516('0x3d')]+'%'};return _0x4f4bc5;}})});}_0x3c35d8=_['merge']({},_0x3c35d8,_0xcdf1f3[_0x2516('0x3e')]);var _0x2a7b6b={'where':_0x3c35d8[_0x2516('0x39')]};return db[_0x2516('0x29')][_0x2516('0x18')](_0x2a7b6b)[_0x2516('0x20')](function(_0x50dec6){_0x48f4fb[_0x2516('0x18')]=_0x50dec6;if(_0xcdf1f3[_0x2516('0x2e')]['includeAll']){_0x3c35d8['include']=[{'all':!![]}];}return db[_0x2516('0x29')]['findAll'](_0x3c35d8);})[_0x2516('0x20')](function(_0x881f99){_0x48f4fb[_0x2516('0x3f')]=_0x881f99;return _0x48f4fb;})['then'](respondWithFilteredResult(_0x2a11d7,_0x3c35d8))[_0x2516('0x40')](handleError(_0x2a11d7,null));};exports[_0x2516('0x41')]=function(_0x39a949,_0x2644c2){var _0x5e215b={'raw':![],'where':{'id':_0x39a949['params']['id']}},_0xa81531={};_0xa81531['model']=_['keys'](db['Trigger'][_0x2516('0x2a')]);_0xa81531[_0x2516('0x2e')]=_[_0x2516('0x2f')](_0x39a949[_0x2516('0x2e')]);_0xa81531['filters']=_[_0x2516('0x42')](_0xa81531[_0x2516('0x31')],_0xa81531[_0x2516('0x2e')]);_0x5e215b[_0x2516('0x32')]=_[_0x2516('0x42')](_0xa81531[_0x2516('0x31')],qs[_0x2516('0x33')](_0x39a949['query'][_0x2516('0x33')]));_0x5e215b[_0x2516('0x32')]=_0x5e215b['attributes'][_0x2516('0x34')]?_0x5e215b['attributes']:_0xa81531[_0x2516('0x31')];if(_0x39a949[_0x2516('0x2e')]['includeAll']){_0x5e215b[_0x2516('0x43')]=[{'all':!![]}];}_0x5e215b=_[_0x2516('0x3b')]({},_0x5e215b,_0x39a949[_0x2516('0x3e')]);return db['Trigger'][_0x2516('0x44')](_0x5e215b)[_0x2516('0x20')](handleEntityNotFound(_0x2644c2,null))[_0x2516('0x20')](respondWithResult(_0x2644c2,null))[_0x2516('0x40')](handleError(_0x2644c2,null));};exports[_0x2516('0x45')]=function(_0x145e36,_0x534077){return db[_0x2516('0x29')][_0x2516('0x45')](_0x145e36[_0x2516('0x46')],{})[_0x2516('0x20')](function(_0x53eadc){var _0x4df02f=_0x145e36[_0x2516('0x47')][_0x2516('0x48')]({'plain':!![]});if(!_0x4df02f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4df02f[_0x2516('0x49')]==='user'){var _0x1469c5=_0x53eadc[_0x2516('0x48')]({'plain':!![]});var _0x480e51=_0x2516('0x22');return db[_0x2516('0x4a')][_0x2516('0x44')]({'where':{'name':_0x480e51,'userProfileId':_0x4df02f[_0x2516('0x4b')]},'raw':!![]})[_0x2516('0x20')](function(_0x187b99){if(_0x187b99&&_0x187b99[_0x2516('0x4c')]===0x0){return db[_0x2516('0x4d')][_0x2516('0x45')]({'name':_0x1469c5[_0x2516('0x26')],'resourceId':_0x1469c5['id'],'type':_0x187b99[_0x2516('0x26')],'sectionId':_0x187b99['id']},{})['then'](function(){return _0x53eadc;});}else{return _0x53eadc;}})[_0x2516('0x40')](function(_0x2f0716){logger[_0x2516('0x25')](_0x2516('0x4e'),_0x2f0716);throw _0x2f0716;});}return _0x53eadc;})[_0x2516('0x20')](respondWithResult(_0x534077,0xc9))['catch'](handleError(_0x534077,null));};exports['update']=function(_0x227ccb,_0x493451){if(_0x227ccb[_0x2516('0x46')]['id']){delete _0x227ccb['body']['id'];}return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x227ccb[_0x2516('0x4f')]['id']}})['then'](handleEntityNotFound(_0x493451,null))[_0x2516('0x20')](saveUpdates(_0x227ccb[_0x2516('0x46')],null))[_0x2516('0x20')](respondWithResult(_0x493451,null))[_0x2516('0x40')](handleError(_0x493451,null));};exports[_0x2516('0x21')]=function(_0x49fdd3,_0x4bf6d7){return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x49fdd3['params']['id']}})[_0x2516('0x20')](handleEntityNotFound(_0x4bf6d7,null))[_0x2516('0x20')](removeEntity(_0x4bf6d7,null))['catch'](handleError(_0x4bf6d7,null));};exports[_0x2516('0x50')]=function(_0x5a7c6c,_0x3fe8ad,_0x4f09de){if(_0x5a7c6c[_0x2516('0x46')]['id']){delete _0x5a7c6c[_0x2516('0x46')]['id'];}return db[_0x2516('0x29')]['find']({'where':{'id':_0x5a7c6c[_0x2516('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3fe8ad,null))['then'](function(_0x2fe6b8){if(_0x2fe6b8){_0x5a7c6c[_0x2516('0x46')][_0x2516('0x51')]=_0x2fe6b8['id'];return db['Condition'][_0x2516('0x45')](_0x5a7c6c['body']);}})[_0x2516('0x20')](respondWithResult(_0x3fe8ad,null))[_0x2516('0x40')](handleError(_0x3fe8ad,null));};exports[_0x2516('0x52')]=function(_0x27058b,_0x5987cc,_0x15005a){if(_0x27058b[_0x2516('0x46')]['id']){delete _0x27058b['body']['id'];}return db[_0x2516('0x29')]['find']({'where':{'id':_0x27058b[_0x2516('0x4f')]['id']}})[_0x2516('0x20')](handleEntityNotFound(_0x5987cc,null))[_0x2516('0x20')](function(_0x5b5449){if(_0x5b5449){_0x27058b[_0x2516('0x46')][_0x2516('0x53')]=_0x5b5449['id'];return db[_0x2516('0x54')][_0x2516('0x45')](_0x27058b[_0x2516('0x46')]);}})['then'](respondWithResult(_0x5987cc,null))[_0x2516('0x40')](handleError(_0x5987cc,null));};exports[_0x2516('0x55')]=function(_0x64715b,_0xc32369,_0x390ba2){var _0x53eef9={};var _0x88b573={};var _0x510f54;var _0x52bad8;return db[_0x2516('0x29')]['findOne']({'where':{'id':_0x64715b['params']['id']}})[_0x2516('0x20')](handleEntityNotFound(_0xc32369,null))[_0x2516('0x20')](function(_0x356c78){if(_0x356c78){_0x510f54=_0x356c78;_0x88b573[_0x2516('0x31')]=_[_0x2516('0x2f')](db[_0x2516('0x54')][_0x2516('0x2a')]);_0x88b573['query']=_[_0x2516('0x2f')](_0x64715b[_0x2516('0x2e')]);_0x88b573[_0x2516('0x30')]=_['intersection'](_0x88b573[_0x2516('0x31')],_0x88b573['query']);_0x53eef9[_0x2516('0x32')]=_[_0x2516('0x42')](_0x88b573[_0x2516('0x31')],qs[_0x2516('0x33')](_0x64715b[_0x2516('0x2e')]['fields']));_0x53eef9[_0x2516('0x32')]=_0x53eef9[_0x2516('0x32')][_0x2516('0x34')]?_0x53eef9[_0x2516('0x32')]:_0x88b573[_0x2516('0x31')];_0x53eef9['order']=qs['sort'](_0x64715b[_0x2516('0x2e')]['sort']);_0x53eef9['where']=qs['filters'](_['pick'](_0x64715b[_0x2516('0x2e')],_0x88b573[_0x2516('0x30')]));if(_0x64715b[_0x2516('0x2e')][_0x2516('0x3d')]){_0x53eef9['where']=_[_0x2516('0x3b')](_0x53eef9[_0x2516('0x39')],{'$or':_[_0x2516('0x28')](_0x53eef9[_0x2516('0x32')],function(_0xd611f){var _0x23ae4f={};_0x23ae4f[_0xd611f]={'$like':'%'+_0x64715b['query'][_0x2516('0x3d')]+'%'};return _0x23ae4f;})});}_0x53eef9=_[_0x2516('0x3b')]({},_0x53eef9,_0x64715b[_0x2516('0x3e')]);return _0x510f54[_0x2516('0x55')](_0x53eef9);}})[_0x2516('0x20')](function(_0x4abaad){if(_0x4abaad){_0x52bad8=_0x4abaad[_0x2516('0x34')];if(!_0x64715b['query']['hasOwnProperty'](_0x2516('0x36'))){_0x53eef9[_0x2516('0x17')]=qs[_0x2516('0x17')](_0x64715b[_0x2516('0x2e')][_0x2516('0x17')]);_0x53eef9['offset']=qs[_0x2516('0x19')](_0x64715b[_0x2516('0x2e')][_0x2516('0x19')]);}return _0x510f54['getAllConditions'](_0x53eef9);}})[_0x2516('0x20')](function(_0x3a2f94){if(_0x3a2f94){return _0x3a2f94?{'count':_0x52bad8,'rows':_0x3a2f94}:null;}})[_0x2516('0x20')](respondWithResult(_0xc32369,null))['catch'](handleError(_0xc32369,null));};exports[_0x2516('0x56')]=function(_0x205fc8,_0x5946c3,_0x18a602){var _0x287630={};var _0x4cd92c={};var _0x118386;var _0x1e7847;return db[_0x2516('0x29')][_0x2516('0x57')]({'where':{'id':_0x205fc8[_0x2516('0x4f')]['id']}})[_0x2516('0x20')](handleEntityNotFound(_0x5946c3,null))[_0x2516('0x20')](function(_0x353b35){if(_0x353b35){_0x118386=_0x353b35;_0x4cd92c[_0x2516('0x31')]=_[_0x2516('0x2f')](db['Condition'][_0x2516('0x2a')]);_0x4cd92c[_0x2516('0x2e')]=_[_0x2516('0x2f')](_0x205fc8['query']);_0x4cd92c['filters']=_['intersection'](_0x4cd92c['model'],_0x4cd92c[_0x2516('0x2e')]);_0x287630[_0x2516('0x32')]=_[_0x2516('0x42')](_0x4cd92c[_0x2516('0x31')],qs[_0x2516('0x33')](_0x205fc8[_0x2516('0x2e')][_0x2516('0x33')]));_0x287630[_0x2516('0x32')]=_0x287630[_0x2516('0x32')]['length']?_0x287630['attributes']:_0x4cd92c[_0x2516('0x31')];_0x287630['order']=qs[_0x2516('0x38')](_0x205fc8[_0x2516('0x2e')][_0x2516('0x38')]);_0x287630[_0x2516('0x39')]=qs[_0x2516('0x30')](_[_0x2516('0x3a')](_0x205fc8['query'],_0x4cd92c[_0x2516('0x30')]));if(_0x205fc8['query'][_0x2516('0x3d')]){_0x287630[_0x2516('0x39')]=_['merge'](_0x287630[_0x2516('0x39')],{'$or':_[_0x2516('0x28')](_0x287630[_0x2516('0x32')],function(_0x53eddf){var _0x2d62b0={};_0x2d62b0[_0x53eddf]={'$like':'%'+_0x205fc8[_0x2516('0x2e')]['filter']+'%'};return _0x2d62b0;})});}_0x287630=_['merge']({},_0x287630,_0x205fc8[_0x2516('0x3e')]);return _0x118386[_0x2516('0x56')](_0x287630);}})[_0x2516('0x20')](function(_0xa06244){if(_0xa06244){_0x1e7847=_0xa06244[_0x2516('0x34')];if(!_0x205fc8[_0x2516('0x2e')]['hasOwnProperty'](_0x2516('0x36'))){_0x287630['limit']=qs[_0x2516('0x17')](_0x205fc8[_0x2516('0x2e')]['limit']);_0x287630[_0x2516('0x19')]=qs[_0x2516('0x19')](_0x205fc8['query'][_0x2516('0x19')]);}return _0x118386[_0x2516('0x56')](_0x287630);}})[_0x2516('0x20')](function(_0x57467f){if(_0x57467f){return _0x57467f?{'count':_0x1e7847,'rows':_0x57467f}:null;}})[_0x2516('0x20')](respondWithResult(_0x5946c3,null))[_0x2516('0x40')](handleError(_0x5946c3,null));};exports[_0x2516('0x58')]=function(_0x58a2b0,_0x2990cf,_0x382f34){if(_0x58a2b0[_0x2516('0x46')]['id']){delete _0x58a2b0[_0x2516('0x46')]['id'];}return db['Trigger'][_0x2516('0x44')]({'where':{'id':_0x58a2b0[_0x2516('0x4f')]['id']}})[_0x2516('0x20')](handleEntityNotFound(_0x2990cf,null))['then'](function(_0x15233b){if(_0x15233b){_0x58a2b0[_0x2516('0x46')]['TriggerId']=_0x15233b['id'];return db['Action'][_0x2516('0x45')](_0x58a2b0[_0x2516('0x46')]);}})['then'](respondWithResult(_0x2990cf,null))['catch'](handleError(_0x2990cf,null));};exports[_0x2516('0x59')]=function(_0x46788c,_0x50dcf5,_0x38c6d9){var _0xe9eaf7={};var _0x5b870e={};var _0x6dfee;var _0x4d6210;return db[_0x2516('0x29')][_0x2516('0x57')]({'where':{'id':_0x46788c[_0x2516('0x4f')]['id']}})[_0x2516('0x20')](handleEntityNotFound(_0x50dcf5,null))[_0x2516('0x20')](function(_0x2268f2){if(_0x2268f2){_0x6dfee=_0x2268f2;_0x5b870e[_0x2516('0x31')]=_[_0x2516('0x2f')](db[_0x2516('0x5a')][_0x2516('0x2a')]);_0x5b870e[_0x2516('0x2e')]=_['keys'](_0x46788c[_0x2516('0x2e')]);_0x5b870e[_0x2516('0x30')]=_[_0x2516('0x42')](_0x5b870e[_0x2516('0x31')],_0x5b870e[_0x2516('0x2e')]);_0xe9eaf7[_0x2516('0x32')]=_[_0x2516('0x42')](_0x5b870e[_0x2516('0x31')],qs[_0x2516('0x33')](_0x46788c[_0x2516('0x2e')][_0x2516('0x33')]));_0xe9eaf7[_0x2516('0x32')]=_0xe9eaf7['attributes']['length']?_0xe9eaf7[_0x2516('0x32')]:_0x5b870e[_0x2516('0x31')];_0xe9eaf7[_0x2516('0x37')]=qs[_0x2516('0x38')](_0x46788c[_0x2516('0x2e')][_0x2516('0x38')]);_0xe9eaf7['where']=qs['filters'](_[_0x2516('0x3a')](_0x46788c[_0x2516('0x2e')],_0x5b870e[_0x2516('0x30')]));if(_0x46788c[_0x2516('0x2e')]['filter']){_0xe9eaf7[_0x2516('0x39')]=_[_0x2516('0x3b')](_0xe9eaf7[_0x2516('0x39')],{'$or':_[_0x2516('0x28')](_0xe9eaf7[_0x2516('0x32')],function(_0x2afd45){var _0x2100c8={};_0x2100c8[_0x2afd45]={'$like':'%'+_0x46788c[_0x2516('0x2e')][_0x2516('0x3d')]+'%'};return _0x2100c8;})});}_0xe9eaf7=_[_0x2516('0x3b')]({},_0xe9eaf7,_0x46788c['options']);return _0x6dfee['getActions'](_0xe9eaf7);}})[_0x2516('0x20')](function(_0x3645a0){if(_0x3645a0){_0x4d6210=_0x3645a0[_0x2516('0x34')];if(!_0x46788c[_0x2516('0x2e')][_0x2516('0x35')](_0x2516('0x36'))){_0xe9eaf7[_0x2516('0x17')]=qs[_0x2516('0x17')](_0x46788c[_0x2516('0x2e')]['limit']);_0xe9eaf7[_0x2516('0x19')]=qs[_0x2516('0x19')](_0x46788c[_0x2516('0x2e')][_0x2516('0x19')]);}return _0x6dfee['getActions'](_0xe9eaf7);}})[_0x2516('0x20')](function(_0x419785){if(_0x419785){return _0x419785?{'count':_0x4d6210,'rows':_0x419785}:null;}})[_0x2516('0x20')](respondWithResult(_0x50dcf5,null))[_0x2516('0x40')](handleError(_0x50dcf5,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 14942db..3176633 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 _0x0f9f=['./trigger.attributes','exports','define','tools_triggers','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x223646,_0xe096ad){_0x223646=_0x223646-0x0;var _0x3ba43c=_0x0f9f[_0x223646];return _0x3ba43c;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var logger=require(_0xf0f9('0x1'))(_0xf0f9('0x2'));var moment=require('moment');var BPromise=require(_0xf0f9('0x3'));var rp=require(_0xf0f9('0x4'));var fs=require('fs');var path=require(_0xf0f9('0x5'));var rimraf=require(_0xf0f9('0x6'));var config=require(_0xf0f9('0x7'));var attributes=require(_0xf0f9('0x8'));module[_0xf0f9('0x9')]=function(_0x3eaff3,_0x425fbe){return _0x3eaff3[_0xf0f9('0xa')]('Trigger',attributes,{'tableName':_0xf0f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14ee=['tools_triggers','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','Trigger'];(function(_0x3c97e3,_0x49eed8){var _0x2acdab=function(_0x431541){while(--_0x431541){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x2acdab(++_0x49eed8);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe14e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe14e('0x1'));var moment=require(_0xe14e('0x2'));var BPromise=require(_0xe14e('0x3'));var rp=require(_0xe14e('0x4'));var fs=require('fs');var path=require(_0xe14e('0x5'));var rimraf=require(_0xe14e('0x6'));var config=require(_0xe14e('0x7'));var attributes=require(_0xe14e('0x8'));module['exports']=function(_0x55d396,_0x4c78d1){return _0x55d396[_0xe14e('0x9')](_0xe14e('0xa'),attributes,{'tableName':_0xe14e('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 9558be8..bbfb162 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 _0x4940=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','include','map','model','stringify','find','ShowTrigger','lodash','util','moment','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4940,0x192));var _0x0494=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x4940[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x0494('0x0'));var util=require(_0x0494('0x1'));var moment=require(_0x0494('0x2'));var BPromise=require('bluebird');var rs=require(_0x0494('0x3'));var fs=require('fs');var Redis=require(_0x0494('0x4'));var db=require(_0x0494('0x5'))['db'];var utils=require(_0x0494('0x6'));var logger=require(_0x0494('0x7'))(_0x0494('0x8'));var config=require(_0x0494('0x9'));var jayson=require(_0x0494('0xa'));var client=jayson[_0x0494('0xb')][_0x0494('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8cb7c5,_0x2a8ceb,_0x1f69f1){return new BPromise(function(_0x24cb8a,_0x5945c3){return client[_0x0494('0xd')](_0x8cb7c5,_0x1f69f1)[_0x0494('0xe')](function(_0x39c0fe){logger[_0x0494('0xf')](_0x0494('0x10'),_0x2a8ceb,_0x0494('0x11'));logger[_0x0494('0x12')](_0x0494('0x13'),_0x2a8ceb,_0x0494('0x11'),JSON['stringify'](_0x39c0fe));if(_0x39c0fe[_0x0494('0x14')]){if(_0x39c0fe[_0x0494('0x14')][_0x0494('0x15')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x2a8ceb,_0x39c0fe['error']['message']);return _0x5945c3(_0x39c0fe[_0x0494('0x14')][_0x0494('0x16')]);}logger['error'](_0x0494('0x10'),_0x2a8ceb,_0x39c0fe['error'][_0x0494('0x16')]);return _0x24cb8a(_0x39c0fe['error'][_0x0494('0x16')]);}else{logger[_0x0494('0xf')]('Trigger,\x20%s,\x20%s',_0x2a8ceb,_0x0494('0x11'));_0x24cb8a(_0x39c0fe[_0x0494('0x17')][_0x0494('0x16')]);}})[_0x0494('0x18')](function(_0x279705){logger[_0x0494('0x14')](_0x0494('0x10'),_0x2a8ceb,_0x279705);_0x5945c3(_0x279705);});});}exports[_0x0494('0x19')]=function(_0x46388f){var _0x13c74e=this;return new Promise(function(_0x12fabd,_0x38c162){return db[_0x0494('0x1a')][_0x0494('0x1b')]({'raw':_0x46388f['options']?_0x46388f[_0x0494('0x1c')][_0x0494('0x1d')]===undefined?!![]:![]:!![],'where':_0x46388f[_0x0494('0x1c')]?_0x46388f[_0x0494('0x1c')]['where']||null:null,'attributes':_0x46388f[_0x0494('0x1c')]?_0x46388f[_0x0494('0x1c')][_0x0494('0x1e')]||null:null,'limit':_0x46388f[_0x0494('0x1c')]?_0x46388f[_0x0494('0x1c')]['limit']||null:null,'include':_0x46388f[_0x0494('0x1c')]?_0x46388f[_0x0494('0x1c')][_0x0494('0x1f')]?_[_0x0494('0x20')](_0x46388f['options']['include'],function(_0x2d11a2){return{'model':db[_0x2d11a2['model']],'as':_0x2d11a2['as'],'attributes':_0x2d11a2[_0x0494('0x1e')],'include':_0x2d11a2[_0x0494('0x1f')]?_[_0x0494('0x20')](_0x2d11a2['include'],function(_0x1859c4){return{'model':db[_0x1859c4['model']],'as':_0x1859c4['as'],'attributes':_0x1859c4[_0x0494('0x1e')],'include':_0x1859c4[_0x0494('0x1f')]?_[_0x0494('0x20')](_0x1859c4['include'],function(_0x346860){return{'model':db[_0x346860[_0x0494('0x21')]],'as':_0x346860['as'],'attributes':_0x346860['attributes']};}):[]};}):[]};}):[]:[]})[_0x0494('0xe')](function(_0x4f5270){logger['info']('GetTrigger',_0x46388f);logger['debug'](_0x0494('0x19'),_0x46388f,JSON[_0x0494('0x22')](_0x4f5270));_0x12fabd(_0x4f5270);})[_0x0494('0x18')](function(_0x56a6d5){logger[_0x0494('0x14')](_0x0494('0x19'),_0x56a6d5[_0x0494('0x16')],_0x46388f);_0x38c162(_0x13c74e[_0x0494('0x14')](0x1f4,_0x56a6d5[_0x0494('0x16')]));});});};exports['ShowTrigger']=function(_0x11059f){var _0x5b2e7f=this;return new Promise(function(_0x3ada74,_0x6d0a09){return db[_0x0494('0x1a')][_0x0494('0x23')]({'raw':_0x11059f[_0x0494('0x1c')]?_0x11059f[_0x0494('0x1c')][_0x0494('0x1d')]===undefined?!![]:![]:!![],'where':_0x11059f[_0x0494('0x1c')]?_0x11059f[_0x0494('0x1c')]['where']||null:null,'attributes':_0x11059f[_0x0494('0x1c')]?_0x11059f['options']['attributes']||null:null,'include':_0x11059f[_0x0494('0x1c')]?_0x11059f['options'][_0x0494('0x1f')]?_[_0x0494('0x20')](_0x11059f['options'][_0x0494('0x1f')],function(_0x43c917){return{'model':db[_0x43c917[_0x0494('0x21')]],'as':_0x43c917['as'],'attributes':_0x43c917['attributes'],'include':_0x43c917[_0x0494('0x1f')]?_['map'](_0x43c917[_0x0494('0x1f')],function(_0x306cb3){return{'model':db[_0x306cb3[_0x0494('0x21')]],'as':_0x306cb3['as'],'attributes':_0x306cb3[_0x0494('0x1e')],'include':_0x306cb3[_0x0494('0x1f')]?_['map'](_0x306cb3[_0x0494('0x1f')],function(_0xd2472e){return{'model':db[_0xd2472e[_0x0494('0x21')]],'as':_0xd2472e['as'],'attributes':_0xd2472e[_0x0494('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0494('0xe')](function(_0x210ed6){logger[_0x0494('0xf')]('ShowTrigger',_0x11059f);logger[_0x0494('0x12')](_0x0494('0x24'),_0x11059f,JSON[_0x0494('0x22')](_0x210ed6));_0x3ada74(_0x210ed6);})[_0x0494('0x18')](function(_0x4caebc){logger[_0x0494('0x14')]('ShowTrigger',_0x4caebc[_0x0494('0x16')],_0x11059f);_0x6d0a09(_0x5b2e7f['error'](0x1f4,_0x4caebc[_0x0494('0x16')]));});});}; \ No newline at end of file +var _0x90fe=['limit','include','model','attributes','map','ShowTrigger','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x90fe,0xdf));var _0xe90f=function(_0x3b5c00,_0x36017d){_0x3b5c00=_0x3b5c00-0x0;var _0x2b248c=_0x90fe[_0x3b5c00];return _0x2b248c;};'use strict';var _=require(_0xe90f('0x0'));var util=require('util');var moment=require(_0xe90f('0x1'));var BPromise=require(_0xe90f('0x2'));var rs=require(_0xe90f('0x3'));var fs=require('fs');var Redis=require(_0xe90f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe90f('0x5'));var logger=require(_0xe90f('0x6'))('rpc');var config=require(_0xe90f('0x7'));var jayson=require(_0xe90f('0x8'));var client=jayson[_0xe90f('0x9')][_0xe90f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e7fdd,_0x1653eb,_0x4f6cf0){return new BPromise(function(_0x501eb2,_0xba907b){return client[_0xe90f('0xb')](_0x1e7fdd,_0x4f6cf0)[_0xe90f('0xc')](function(_0x184b53){logger[_0xe90f('0xd')](_0xe90f('0xe'),_0x1653eb,_0xe90f('0xf'));logger[_0xe90f('0x10')](_0xe90f('0x11'),_0x1653eb,'request\x20sent',JSON[_0xe90f('0x12')](_0x184b53));if(_0x184b53[_0xe90f('0x13')]){if(_0x184b53[_0xe90f('0x13')]['code']===0x1f4){logger[_0xe90f('0x13')](_0xe90f('0xe'),_0x1653eb,_0x184b53[_0xe90f('0x13')][_0xe90f('0x14')]);return _0xba907b(_0x184b53[_0xe90f('0x13')]['message']);}logger[_0xe90f('0x13')](_0xe90f('0xe'),_0x1653eb,_0x184b53[_0xe90f('0x13')][_0xe90f('0x14')]);return _0x501eb2(_0x184b53[_0xe90f('0x13')][_0xe90f('0x14')]);}else{logger['info'](_0xe90f('0xe'),_0x1653eb,_0xe90f('0xf'));_0x501eb2(_0x184b53[_0xe90f('0x15')]['message']);}})[_0xe90f('0x16')](function(_0x36f53c){logger[_0xe90f('0x13')](_0xe90f('0xe'),_0x1653eb,_0x36f53c);_0xba907b(_0x36f53c);});});}exports[_0xe90f('0x17')]=function(_0x17c872){var _0x31b851=this;return new Promise(function(_0x4e04f0,_0x11d487){return db[_0xe90f('0x18')][_0xe90f('0x19')]({'raw':_0x17c872[_0xe90f('0x1a')]?_0x17c872[_0xe90f('0x1a')][_0xe90f('0x1b')]===undefined?!![]:![]:!![],'where':_0x17c872[_0xe90f('0x1a')]?_0x17c872[_0xe90f('0x1a')][_0xe90f('0x1c')]||null:null,'attributes':_0x17c872[_0xe90f('0x1a')]?_0x17c872['options']['attributes']||null:null,'limit':_0x17c872[_0xe90f('0x1a')]?_0x17c872[_0xe90f('0x1a')][_0xe90f('0x1d')]||null:null,'include':_0x17c872[_0xe90f('0x1a')]?_0x17c872[_0xe90f('0x1a')][_0xe90f('0x1e')]?_['map'](_0x17c872[_0xe90f('0x1a')][_0xe90f('0x1e')],function(_0x1345e7){return{'model':db[_0x1345e7[_0xe90f('0x1f')]],'as':_0x1345e7['as'],'attributes':_0x1345e7[_0xe90f('0x20')],'include':_0x1345e7[_0xe90f('0x1e')]?_[_0xe90f('0x21')](_0x1345e7['include'],function(_0x136123){return{'model':db[_0x136123['model']],'as':_0x136123['as'],'attributes':_0x136123['attributes'],'include':_0x136123['include']?_[_0xe90f('0x21')](_0x136123[_0xe90f('0x1e')],function(_0x299e40){return{'model':db[_0x299e40[_0xe90f('0x1f')]],'as':_0x299e40['as'],'attributes':_0x299e40[_0xe90f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe90f('0xc')](function(_0xae8550){logger['info'](_0xe90f('0x17'),_0x17c872);logger[_0xe90f('0x10')](_0xe90f('0x17'),_0x17c872,JSON[_0xe90f('0x12')](_0xae8550));_0x4e04f0(_0xae8550);})[_0xe90f('0x16')](function(_0x2d0616){logger[_0xe90f('0x13')](_0xe90f('0x17'),_0x2d0616['message'],_0x17c872);_0x11d487(_0x31b851[_0xe90f('0x13')](0x1f4,_0x2d0616[_0xe90f('0x14')]));});});};exports[_0xe90f('0x22')]=function(_0x5cb057){var _0x1f72f4=this;return new Promise(function(_0x1b926b,_0x315c4f){return db[_0xe90f('0x18')][_0xe90f('0x23')]({'raw':_0x5cb057['options']?_0x5cb057['options'][_0xe90f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5cb057['options']?_0x5cb057[_0xe90f('0x1a')]['where']||null:null,'attributes':_0x5cb057[_0xe90f('0x1a')]?_0x5cb057[_0xe90f('0x1a')]['attributes']||null:null,'include':_0x5cb057[_0xe90f('0x1a')]?_0x5cb057[_0xe90f('0x1a')][_0xe90f('0x1e')]?_[_0xe90f('0x21')](_0x5cb057['options'][_0xe90f('0x1e')],function(_0x142845){return{'model':db[_0x142845['model']],'as':_0x142845['as'],'attributes':_0x142845[_0xe90f('0x20')],'include':_0x142845[_0xe90f('0x1e')]?_[_0xe90f('0x21')](_0x142845['include'],function(_0x27a79c){return{'model':db[_0x27a79c['model']],'as':_0x27a79c['as'],'attributes':_0x27a79c[_0xe90f('0x20')],'include':_0x27a79c[_0xe90f('0x1e')]?_[_0xe90f('0x21')](_0x27a79c[_0xe90f('0x1e')],function(_0x68712a){return{'model':db[_0x68712a[_0xe90f('0x1f')]],'as':_0x68712a['as'],'attributes':_0x68712a[_0xe90f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe90f('0xc')](function(_0x5c1451){logger[_0xe90f('0xd')]('ShowTrigger',_0x5cb057);logger[_0xe90f('0x10')](_0xe90f('0x22'),_0x5cb057,JSON['stringify'](_0x5c1451));_0x1b926b(_0x5c1451);})[_0xe90f('0x16')](function(_0x43cfe1){logger[_0xe90f('0x13')](_0xe90f('0x22'),_0x43cfe1[_0xe90f('0x14')],_0x5cb057);_0x315c4f(_0x1f72f4['error'](0x1f4,_0x43cfe1[_0xe90f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d2da117..b3e060f 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 _0x0614=['show','post','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id'];(function(_0x15fa48,_0x5ce51b){var _0x53bcfd=function(_0x45558d){while(--_0x45558d){_0x15fa48['push'](_0x15fa48['shift']());}};_0x53bcfd(++_0x5ce51b);}(_0x0614,0x114));var _0x4061=function(_0x861057,_0x2cf646){_0x861057=_0x861057-0x0;var _0x34440c=_0x0614[_0x861057];return _0x34440c;};'use strict';var multer=require('multer');var util=require(_0x4061('0x0'));var path=require(_0x4061('0x1'));var timeout=require(_0x4061('0x2'));var express=require(_0x4061('0x3'));var router=express[_0x4061('0x4')]();var fs_extra=require(_0x4061('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4061('0x6'));var config=require(_0x4061('0x7'));var controller=require(_0x4061('0x8'));router[_0x4061('0x9')]('/',auth[_0x4061('0xa')](),controller['index']);router[_0x4061('0x9')](_0x4061('0xb'),auth[_0x4061('0xa')](),controller[_0x4061('0xc')]);router['post']('/:id/clone',auth[_0x4061('0xa')](),controller['clone']);router[_0x4061('0xd')]('/',auth[_0x4061('0xa')](),controller['create']);router['put'](_0x4061('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4061('0xe')]('/:id',auth[_0x4061('0xa')](),controller['destroy']);module[_0x4061('0xf')]=router; \ No newline at end of file +var _0x2426=['get','isAuthenticated','/:id','show','post','clone','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0xc805f9,_0x1d9c1a){var _0x18392b=function(_0xcb74a8){while(--_0xcb74a8){_0xc805f9['push'](_0xc805f9['shift']());}};_0x18392b(++_0x1d9c1a);}(_0x2426,0x199));var _0x6242=function(_0x2e58c3,_0x25bf31){_0x2e58c3=_0x2e58c3-0x0;var _0x3a4ede=_0x2426[_0x2e58c3];return _0x3a4ede;};'use strict';var multer=require('multer');var util=require(_0x6242('0x0'));var path=require(_0x6242('0x1'));var timeout=require(_0x6242('0x2'));var express=require(_0x6242('0x3'));var router=express[_0x6242('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6242('0x5'));var interaction=require(_0x6242('0x6'));var config=require(_0x6242('0x7'));var controller=require(_0x6242('0x8'));router[_0x6242('0x9')]('/',auth[_0x6242('0xa')](),controller['index']);router[_0x6242('0x9')](_0x6242('0xb'),auth[_0x6242('0xa')](),controller[_0x6242('0xc')]);router[_0x6242('0xd')]('/:id/clone',auth['isAuthenticated'](),controller[_0x6242('0xe')]);router[_0x6242('0xd')]('/',auth[_0x6242('0xa')](),controller['create']);router['put'](_0x6242('0xb'),auth['isAuthenticated'](),controller[_0x6242('0xf')]);router[_0x6242('0x10')]('/:id',auth[_0x6242('0xa')](),controller[_0x6242('0x11')]);module[_0x6242('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 5f7e57a..4b214fb 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 _0xd5de=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','setDataValue','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','accept','originate','uas','pai','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','from-voip-provider'];(function(_0x22342c,_0x218835){var _0xd3b434=function(_0x45b259){while(--_0x45b259){_0x22342c['push'](_0x22342c['shift']());}};_0xd3b434(++_0x218835);}(_0xd5de,0x125));var _0xed5d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd5de[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xed5d('0x0'));module[_0xed5d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xed5d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x4'),_0xed5d('0x5'),'peer'),'allowNull':![],'defaultValue':_0xed5d('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xed5d('0x6')},'callingpres':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x7'),_0xed5d('0x8'),_0xed5d('0x9'),_0xed5d('0xa'),_0xed5d('0xb'),_0xed5d('0xc'),_0xed5d('0xd'),_0xed5d('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xed5d('0xf')]},'md5secret':{'type':Sequelize[_0xed5d('0xf')]},'remotesecret':{'type':Sequelize[_0xed5d('0xf')]},'transport':{'type':Sequelize[_0xed5d('0xf')],'defaultValue':'udp','set':function(_0x6b8035){this[_0xed5d('0x10')]('transport',_0x6b8035?_0x6b8035['join'](','):null);},'get':function(){return this[_0xed5d('0x11')](_0xed5d('0x12'))?this[_0xed5d('0x11')](_0xed5d('0x12'))['split'](','):null;},'comment':_0xed5d('0x13')},'dtmfmode':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x14'),_0xed5d('0x15'),_0xed5d('0x16'),_0xed5d('0x17'),_0xed5d('0x18')),'defaultValue':_0xed5d('0x14')},'directmedia':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no','nonat',_0xed5d('0x1a'),_0xed5d('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xed5d('0xf')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x30d260){this['setDataValue'](_0xed5d('0x1c'),_0x30d260?_0x30d260[_0xed5d('0x1d')](','):null);},'get':function(){return this[_0xed5d('0x11')]('nat')?this[_0xed5d('0x11')](_0xed5d('0x1c'))[_0xed5d('0x1e')](','):null;},'comment':_0xed5d('0x1f')},'callgroup':{'type':Sequelize[_0xed5d('0xf')]},'namedcallgroup':{'type':Sequelize[_0xed5d('0xf')]},'pickupgroup':{'type':Sequelize[_0xed5d('0xf')]},'namedpickupgroup':{'type':Sequelize[_0xed5d('0xf')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xed5d('0xf')],'defaultValue':_0xed5d('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xed5d('0x21'),'set':function(_0x2399e8){this['setDataValue'](_0xed5d('0x22'),_0x2399e8?_0x2399e8[_0xed5d('0x1d')](';'):_0xed5d('0x21'));},'get':function(){return this['getDataValue'](_0xed5d('0x22'))?this['getDataValue'](_0xed5d('0x22'))[_0xed5d('0x1e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'insecure':{'type':Sequelize[_0xed5d('0xf')],'defaultValue':'port,invite','set':function(_0x2ecb7d){this[_0xed5d('0x10')]('insecure',_0x2ecb7d?_0x2ecb7d[_0xed5d('0x1d')](','):null);},'get':function(){return this[_0xed5d('0x11')](_0xed5d('0x23'))?this[_0xed5d('0x11')](_0xed5d('0x23'))[_0xed5d('0x1e')](','):null;},'comment':_0xed5d('0x24')},'trustrpid':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xed5d('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xed5d('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xed5d('0x19'),'no')},'accountcode':{'type':Sequelize[_0xed5d('0x25')](0xb)},'setvar':{'type':Sequelize[_0xed5d('0xf')]},'callerid':{'type':Sequelize[_0xed5d('0xf')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xed5d('0xf')]},'callcounter':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xed5d('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xed5d('0xf')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0xed5d('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xed5d('0xf')]},'session_timers':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x26'),'refuse',_0xed5d('0x27'))},'session_expires':{'type':Sequelize[_0xed5d('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xed5d('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xed5d('0x3')]('uac',_0xed5d('0x28')),'defaultValue':_0xed5d('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xed5d('0xf')]},'fromdomain':{'type':Sequelize[_0xed5d('0xf')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xed5d('0x25')](0x5)},'qualify':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no'),'defaultValue':_0xed5d('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xed5d('0xf')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xed5d('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xed5d('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no',_0xed5d('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xed5d('0xf')]},'timert1':{'type':Sequelize[_0xed5d('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xed5d('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xed5d('0xf')]},'contactdeny':{'type':Sequelize[_0xed5d('0xf')]},'contactacl':{'type':Sequelize[_0xed5d('0xf')]},'unsolicited_mailbox':{'type':Sequelize[_0xed5d('0xf')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xed5d('0x25')](0xb)},'encryption':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'force_avp':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'icesupport':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no',_0xed5d('0x2a'),_0xed5d('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xed5d('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xed5d('0xf')]},'dtlsprivatekey':{'type':Sequelize[_0xed5d('0xf')]},'dtlscipher':{'type':Sequelize[_0xed5d('0xf')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xed5d('0xf')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xed5d('0x2c'),_0xed5d('0x2d'),_0xed5d('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xed5d('0xf')]},'usereqphone':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xed5d('0xf')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xed5d('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xed5d('0x3')](_0xed5d('0x19'),'no')},'vmexten':{'type':Sequelize[_0xed5d('0xf')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xed5d('0xf')]},'host':{'type':Sequelize[_0xed5d('0xf')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xed5d('0x3')]('yes','no',_0xed5d('0x2f'),_0xed5d('0x1a'),_0xed5d('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xed5d('0xf')]},'active':{'type':Sequelize[_0xed5d('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xed5d('0xf')],'defaultValue':'no'}}; \ No newline at end of file +var _0xdb91=['fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','STRING','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','join','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uas'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0xdb91,0x97));var _0x1db9=function(_0x537cc4,_0x4f7915){_0x537cc4=_0x537cc4-0x0;var _0x4b9d3f=_0xdb91[_0x537cc4];return _0x4b9d3f;};'use strict';var Sequelize=require(_0x1db9('0x0'));module[_0x1db9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x3'),_0x1db9('0x4'),_0x1db9('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1db9('0x6')},'callingpres':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x7'),_0x1db9('0x8'),_0x1db9('0x9'),_0x1db9('0xa'),'PROHIB_NOT_SCREENED',_0x1db9('0xb'),'PROHIB_FAILED_SCREEN',_0x1db9('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x1db9('0xd')]},'secret':{'type':Sequelize[_0x1db9('0xd')]},'md5secret':{'type':Sequelize[_0x1db9('0xd')]},'remotesecret':{'type':Sequelize[_0x1db9('0xd')]},'transport':{'type':Sequelize[_0x1db9('0xd')],'defaultValue':_0x1db9('0xe'),'set':function(_0x49acde){this[_0x1db9('0xf')](_0x1db9('0x10'),_0x49acde?_0x49acde['join'](','):null);},'get':function(){return this[_0x1db9('0x11')](_0x1db9('0x10'))?this[_0x1db9('0x11')](_0x1db9('0x10'))['split'](','):null;},'comment':_0x1db9('0x12')},'dtmfmode':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x13'),_0x1db9('0x14'),'shortinfo','inband',_0x1db9('0x15')),'defaultValue':_0x1db9('0x13')},'directmedia':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no','nonat','update',_0x1db9('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1db9('0xd')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x1db9('0xd')],'defaultValue':'force_rport,comedia','set':function(_0x4a0d8a){this[_0x1db9('0xf')](_0x1db9('0x18'),_0x4a0d8a?_0x4a0d8a['join'](','):null);},'get':function(){return this[_0x1db9('0x11')](_0x1db9('0x18'))?this[_0x1db9('0x11')](_0x1db9('0x18'))[_0x1db9('0x19')](','):null;},'comment':_0x1db9('0x1a')},'callgroup':{'type':Sequelize[_0x1db9('0xd')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x1db9('0xd')]},'namedpickupgroup':{'type':Sequelize[_0x1db9('0xd')]},'language':{'type':Sequelize[_0x1db9('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1db9('0xd')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1db9('0xd')],'defaultValue':_0x1db9('0x1b')},'allow':{'type':Sequelize[_0x1db9('0xd')],'allowNull':![],'defaultValue':_0x1db9('0x1c'),'set':function(_0x260552){this[_0x1db9('0xf')](_0x1db9('0x1d'),_0x260552?_0x260552['join'](';'):_0x1db9('0x1c'));},'get':function(){return this[_0x1db9('0x11')](_0x1db9('0x1d'))?this[_0x1db9('0x11')](_0x1db9('0x1d'))[_0x1db9('0x19')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x1db9('0x1e'),'set':function(_0xa8ee57){this[_0x1db9('0xf')]('insecure',_0xa8ee57?_0xa8ee57[_0x1db9('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0x1db9('0x20'))?this[_0x1db9('0x11')](_0x1db9('0x20'))[_0x1db9('0x19')](','):null;},'comment':_0x1db9('0x21')},'trustrpid':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x1db9('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no',_0x1db9('0x22'))},'promiscredir':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x1db9('0x23')](0xb)},'setvar':{'type':Sequelize[_0x1db9('0xd')]},'callerid':{'type':Sequelize[_0x1db9('0xd')],'defaultValue':_0x1db9('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x1db9('0x2')]('yes','no'),'defaultValue':_0x1db9('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x1db9('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1db9('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x1db9('0xd')]},'template':{'type':Sequelize[_0x1db9('0xd')]},'videosupport':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no',_0x1db9('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1db9('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM']('accept',_0x1db9('0x26'),_0x1db9('0x27'))},'session_expires':{'type':Sequelize[_0x1db9('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x1db9('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x1db9('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1db9('0xd')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x1db9('0xd')]},'fromuser':{'type':Sequelize[_0x1db9('0xd')]},'port':{'type':Sequelize[_0x1db9('0x23')](0x5)},'qualify':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no'),'defaultValue':_0x1db9('0x16')},'keepalive':{'type':Sequelize[_0x1db9('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x1db9('0xd')]},'defaultuser':{'type':Sequelize[_0x1db9('0xd')]},'rtptimeout':{'type':Sequelize[_0x1db9('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1db9('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1db9('0xd')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x1db9('0x23')](0xb)},'timerb':{'type':Sequelize[_0x1db9('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1db9('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x1db9('0xd')]},'unsolicited_mailbox':{'type':Sequelize[_0x1db9('0xd')]},'use_q850_reason':{'type':Sequelize[_0x1db9('0xd')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'force_avp':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'icesupport':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no',_0x1db9('0x29'),_0x1db9('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x1db9('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1db9('0xd')]},'dtlsprivatekey':{'type':Sequelize[_0x1db9('0xd')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x1db9('0xd')]},'dtlscapath':{'type':Sequelize[_0x1db9('0xd')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x1db9('0x2b'),_0x1db9('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1db9('0xd')]},'usereqphone':{'type':Sequelize[_0x1db9('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1db9('0xd')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x1db9('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x1db9('0xd')]},'mohsuggest':{'type':Sequelize[_0x1db9('0xd')]},'parkinglot':{'type':Sequelize[_0x1db9('0xd')]},'description':{'type':Sequelize[_0x1db9('0xd')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x1db9('0x2d')},'canreinvite':{'type':Sequelize[_0x1db9('0x2')](_0x1db9('0x16'),'no','nonat','update',_0x1db9('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1db9('0xd')]},'otherFields':{'type':Sequelize[_0x1db9('0xd')]},'active':{'type':Sequelize[_0x1db9('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1db9('0xd')],'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 12b2312..29d8566 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 _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x484c94,_0x4b312d){var _0x1224a7=function(_0xa31198){while(--_0xa31198){_0x484c94['push'](_0x484c94['shift']());}};_0x1224a7(++_0x4b312d);}(_0x6aa7,0x178));var _0x76aa=function(_0x4e2a92,_0x2f5aab){_0x4e2a92=_0x4e2a92-0x0;var _0x3cbc71=_0x6aa7[_0x4e2a92];return _0x3cbc71;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file +var _0x008c=['update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Trunk','findAll','show','params','includeAll','include','options','clone','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/trunk.ejs','join','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x30da2e,_0x146e54){var _0x794139=function(_0x25bd28){while(--_0x25bd28){_0x30da2e['push'](_0x30da2e['shift']());}};_0x794139(++_0x146e54);}(_0x008c,0x188));var _0xc008=function(_0x4727f1,_0x2ff773){_0x4727f1=_0x4727f1-0x0;var _0x2977ce=_0x008c[_0x4727f1];return _0x2977ce;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];var jayson=require(_0xc008('0x18'));var client=jayson[_0xc008('0x19')][_0xc008('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x593f7a,_0x560e28,_0x33f44c,_0x50c1ab){return new BPromise(function(_0x25e13f,_0x4584e1){var _0x2073ef=_0x50c1ab||client;return _0x2073ef[_0xc008('0x1b')](_0x593f7a,_0x33f44c)[_0xc008('0x1c')](function(_0x5ee00b){logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x560e28,_0xc008('0x1d'),JSON['stringify'](_0x5ee00b));if(_0x5ee00b['error']){if(_0x5ee00b['error']['code']===0x1f4){logger[_0xc008('0x20')](_0xc008('0x21'),_0x560e28,_0x5ee00b['error'][_0xc008('0x22')]);return _0x4584e1(_0x5ee00b['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x560e28,_0x5ee00b[_0xc008('0x20')]['message']);return _0x25e13f(_0x5ee00b['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));_0x25e13f(_0x5ee00b[_0xc008('0x23')][_0xc008('0x22')]);}})[_0xc008('0x24')](function(_0x11cc75){logger[_0xc008('0x20')]('Trunk,\x20%s,\x20%s',_0x560e28,_0x11cc75);_0x4584e1(_0x11cc75);});});}function respondWithStatusCode(_0x459fd9,_0x5c85f2){_0x5c85f2=_0x5c85f2||0xcc;return function(_0x58a6ea){if(_0x58a6ea){return _0x459fd9[_0xc008('0x25')](_0x5c85f2);}return _0x459fd9[_0xc008('0x26')](_0x5c85f2)[_0xc008('0x27')]();};}function respondWithResult(_0x3cb28c,_0x5410f5){_0x5410f5=_0x5410f5||0xc8;return function(_0x48582b){if(_0x48582b){return _0x3cb28c['status'](_0x5410f5)[_0xc008('0x28')](_0x48582b);}};}function respondWithFilteredResult(_0x15dade,_0x92c582){return function(_0x2e31c2){if(_0x2e31c2){var _0x5bebd9=typeof _0x92c582['offset']==='undefined'&&typeof _0x92c582['limit']==='undefined';var _0x3865c0=_0x2e31c2[_0xc008('0x29')];var _0x25eae4=_0x5bebd9?0x0:_0x92c582['offset'];var _0x24c14c=_0x5bebd9?_0x2e31c2[_0xc008('0x29')]:_0x92c582[_0xc008('0x2a')]+_0x92c582[_0xc008('0x2b')];var _0x4c5dec;if(_0x24c14c>=_0x3865c0){_0x24c14c=_0x3865c0;_0x4c5dec=0xc8;}else{_0x4c5dec=0xce;}_0x15dade[_0xc008('0x26')](_0x4c5dec);return _0x15dade[_0xc008('0x2c')]('Content-Range',_0x25eae4+'-'+_0x24c14c+'/'+_0x3865c0)['json'](_0x2e31c2);}return null;};}function patchUpdates(_0x539766){return function(_0x1032b2){try{jsonpatch[_0xc008('0x2d')](_0x1032b2,_0x539766,!![]);}catch(_0xf831f2){return BPromise[_0xc008('0x2e')](_0xf831f2);}return _0x1032b2[_0xc008('0x2f')]();};}function saveUpdates(_0xceebc3,_0x294f97){return function(_0x22d8e8){if(_0x22d8e8){return _0x22d8e8[_0xc008('0x30')](_0xceebc3)[_0xc008('0x1c')](function(_0x2f4b6b){return _0x2f4b6b;});}return null;};}function removeEntity(_0x1ac7c8,_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x31')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x32')]({'plain':!![]});var _0x383be7=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x31')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x1c')](function(){return _0x334a09;});})[_0xc008('0x1c')](function(){_0x1ac7c8[_0xc008('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87,_0x389a40){return function(_0x459df4){if(!_0x459df4){_0x415b87[_0xc008('0x25')](0x194);}return _0x459df4;};}function handleError(_0x40002f,_0x315562){_0x315562=_0x315562||0x1f4;return function(_0x1667a0){logger['error'](_0x1667a0[_0xc008('0x35')]);if(_0x1667a0[_0xc008('0x36')]){delete _0x1667a0['name'];}_0x40002f[_0xc008('0x26')](_0x315562)[_0xc008('0x37')](_0x1667a0);};}exports['index']=function(_0x263473,_0x2e4ae1){var _0x280e9b={},_0x55ff48={},_0x53b353={'count':0x0,'rows':[]};var _0x478810=_[_0xc008('0x38')](db['Trunk'][_0xc008('0x39')],function(_0x3884dd){return{'name':_0x3884dd[_0xc008('0x3a')],'type':_0x3884dd[_0xc008('0x3b')][_0xc008('0x3c')]};});_0x55ff48[_0xc008('0x3d')]=_[_0xc008('0x38')](_0x478810,_0xc008('0x36'));_0x55ff48[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x263473[_0xc008('0x3e')]);_0x55ff48[_0xc008('0x40')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],_0x55ff48['query']);_0x280e9b[_0xc008('0x42')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x263473['query'][_0xc008('0x43')]));_0x280e9b[_0xc008('0x42')]=_0x280e9b[_0xc008('0x42')][_0xc008('0x44')]?_0x280e9b[_0xc008('0x42')]:_0x55ff48['model'];if(!_0x263473[_0xc008('0x3e')][_0xc008('0x45')](_0xc008('0x46'))){_0x280e9b[_0xc008('0x2b')]=qs[_0xc008('0x2b')](_0x263473['query'][_0xc008('0x2b')]);_0x280e9b[_0xc008('0x2a')]=qs[_0xc008('0x2a')](_0x263473[_0xc008('0x3e')]['offset']);}_0x280e9b[_0xc008('0x47')]=qs[_0xc008('0x48')](_0x263473[_0xc008('0x3e')]['sort']);_0x280e9b[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x263473['query'],_0x55ff48[_0xc008('0x40')]),_0x478810);if(_0x263473[_0xc008('0x3e')]['filter']){_0x280e9b[_0xc008('0x49')]=_[_0xc008('0x4b')](_0x280e9b[_0xc008('0x49')],{'$or':_['map'](_0x478810,function(_0x1cec64){if(_0x1cec64[_0xc008('0x3b')]!==_0xc008('0x4c')){var _0x44fc5d={};_0x44fc5d[_0x1cec64[_0xc008('0x36')]]={'$like':'%'+_0x263473[_0xc008('0x3e')]['filter']+'%'};return _0x44fc5d;}})});}_0x280e9b=_['merge']({},_0x280e9b,_0x263473['options']);var _0x4552ed={'where':_0x280e9b[_0xc008('0x49')]};return db[_0xc008('0x4d')][_0xc008('0x29')](_0x4552ed)[_0xc008('0x1c')](function(_0x24f6a4){_0x53b353[_0xc008('0x29')]=_0x24f6a4;if(_0x263473[_0xc008('0x3e')]['includeAll']){_0x280e9b['include']=[{'all':!![]}];}return db['Trunk'][_0xc008('0x4e')](_0x280e9b);})[_0xc008('0x1c')](function(_0x158eae){_0x53b353['rows']=_0x158eae;return _0x53b353;})[_0xc008('0x1c')](respondWithFilteredResult(_0x2e4ae1,_0x280e9b))[_0xc008('0x24')](handleError(_0x2e4ae1,null));};exports[_0xc008('0x4f')]=function(_0x1c2c50,_0x4981b4){var _0x56e4ac={'raw':![],'where':{'id':_0x1c2c50[_0xc008('0x50')]['id']}},_0x17ec90={};_0x17ec90[_0xc008('0x3d')]=_[_0xc008('0x3f')](db['Trunk']['rawAttributes']);_0x17ec90[_0xc008('0x3e')]=_['keys'](_0x1c2c50[_0xc008('0x3e')]);_0x17ec90[_0xc008('0x40')]=_[_0xc008('0x41')](_0x17ec90['model'],_0x17ec90[_0xc008('0x3e')]);_0x56e4ac[_0xc008('0x42')]=_[_0xc008('0x41')](_0x17ec90[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x1c2c50['query'][_0xc008('0x43')]));_0x56e4ac[_0xc008('0x42')]=_0x56e4ac['attributes'][_0xc008('0x44')]?_0x56e4ac[_0xc008('0x42')]:_0x17ec90['model'];if(_0x1c2c50['query'][_0xc008('0x51')]){_0x56e4ac[_0xc008('0x52')]=[{'all':!![]}];}_0x56e4ac=_[_0xc008('0x4b')]({},_0x56e4ac,_0x1c2c50[_0xc008('0x53')]);return db[_0xc008('0x4d')]['find'](_0x56e4ac)['then'](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1c')](respondWithResult(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports[_0xc008('0x54')]=function(_0x25d351,_0xf94fcb){var _0x2f1105={'where':{'id':_0x25d351[_0xc008('0x50')]['id']}},_0x44f42d={};_0x44f42d['model']=_[_0xc008('0x3f')](db[_0xc008('0x4d')][_0xc008('0x39')]);_0x2f1105[_0xc008('0x42')]=_[_0xc008('0x41')](_0x44f42d['model'],qs[_0xc008('0x43')](_0x25d351['query']['fields']));_0x2f1105['attributes']=_0x2f1105[_0xc008('0x42')][_0xc008('0x44')]?_0x2f1105[_0xc008('0x42')]:_0x44f42d['model'];if(_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]){_0x2f1105[_0xc008('0x52')]=[{'all':!![]}];}_0x2f1105=_['merge']({},_0x2f1105,_0x25d351[_0xc008('0x53')]);return db[_0xc008('0x4d')][_0xc008('0x55')](_0x2f1105)[_0xc008('0x1c')](handleEntityNotFound(_0xf94fcb,null))['then'](function(_0x4022dd){if(_0x4022dd){var _0x4eaa6d=_0x4022dd[_0xc008('0x32')]({'plain':!![]});_0x4eaa6d=qs[_0xc008('0x56')](_0x4eaa6d,['id',_0xc008('0x57'),_0xc008('0x58')]);_0x25d351[_0xc008('0x59')]=_[_0xc008('0x56')](_0x25d351['body'],['id',_0xc008('0x57'),'updatedAt']);return db['Trunk'][_0xc008('0x5a')](_[_0xc008('0x4b')](_0x4eaa6d,_0x25d351['body']),{'include':_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]?[{'all':!![]}]:undefined})[_0xc008('0x1c')](function(_0x4517c0){var _0x21ee6d=_0x25d351[_0xc008('0x5b')][_0xc008('0x32')]({'plain':!![]});if(!_0x21ee6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ee6d[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x3bfb15=_0x4517c0[_0xc008('0x32')]({'plain':!![]});var _0xb3ca0f=_0xc008('0x33');return db[_0xc008('0x5d')][_0xc008('0x55')]({'where':{'name':_0xb3ca0f,'userProfileId':_0x21ee6d[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x1bef66){if(_0x1bef66&&_0x1bef66[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x3bfb15['name'],'resourceId':_0x3bfb15['id'],'type':_0x1bef66[_0xc008('0x36')],'sectionId':_0x1bef66['id']},{})[_0xc008('0x1c')](function(){return _0x4517c0;});}else{return _0x4517c0;}})[_0xc008('0x24')](function(_0x566dea){logger[_0xc008('0x20')](_0xc008('0x60'),_0x566dea);throw _0x566dea;});}return _0x4517c0;});}})['then'](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x5a')]=function(_0x2a4c2b,_0x7bad14,_0x39083c){var _0x1a2ce7;return db[_0xc008('0x4d')][_0xc008('0x5a')](_0x2a4c2b[_0xc008('0x59')],{'raw':!![]})[_0xc008('0x1c')](function(_0x1b059b){_0x1a2ce7=_0x1b059b;return db[_0xc008('0x4d')]['findAll']({'raw':!![]});})[_0xc008('0x1c')](function(_0x25a52b){var _0xfdb5e3=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],'server/files/templates/trunk.ejs'),_0xc008('0x63'));var _0x46fa7b=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x64')),_0xc008('0x63'));var _0x553f5c=ejs[_0xc008('0x65')](_0xfdb5e3,{'trunks':_0x25a52b||[]});fs['writeFileSync'](_0xc008('0x66'),_0x553f5c);if(_0x1a2ce7[_0xc008('0x67')]){var _0x23012c=ejs[_0xc008('0x65')](_0x46fa7b,{'trunks':_0x25a52b||[]});fs[_0xc008('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x23012c);}})[_0xc008('0x1c')](function(){return respondWithRpcPromise(_0xc008('0x69'),'create',{'module':_0xc008('0x6a')});})['then'](function(){var _0x278cbe=_0x2a4c2b['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x278cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x278cbe[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x33d8e4=_0x1a2ce7[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x55')]({'where':{'name':_0xc008('0x33'),'userProfileId':_0x278cbe[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x321500){if(_0x321500&&_0x321500[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x33d8e4['name'],'resourceId':_0x33d8e4['id'],'type':_0x321500[_0xc008('0x36')],'sectionId':_0x321500['id']},{})['then'](function(){return _0x1a2ce7;});}else{return _0x1a2ce7;}})['catch'](function(_0x4c84da){logger[_0xc008('0x20')](_0xc008('0x60'),_0x4c84da);throw _0x4c84da;});}return _0x1a2ce7;})[_0xc008('0x1c')](respondWithResult(_0x7bad14,0xc9))[_0xc008('0x24')](handleError(_0x7bad14,null));};exports[_0xc008('0x30')]=function(_0x2e9646,_0x23ef42,_0x519328){var _0x127bdf;return db['Trunk'][_0xc008('0x55')]({'where':{'id':_0x2e9646[_0xc008('0x50')]['id']}})[_0xc008('0x1c')](handleEntityNotFound(_0x23ef42,null))[_0xc008('0x1c')](saveUpdates(_0x2e9646[_0xc008('0x59')],null))[_0xc008('0x1c')](function(_0x23d4ff){if(_0x23d4ff){_0x127bdf=_0x23d4ff;return db[_0xc008('0x4d')][_0xc008('0x4e')]({'raw':!![]});}})[_0xc008('0x1c')](function(_0x334ed8){if(_0x334ed8){var _0x1dd9fe=fs['readFileSync'](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x572d93=fs[_0xc008('0x61')](path[_0xc008('0x6c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x3fc44f=ejs[_0xc008('0x65')](_0x1dd9fe,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x66'),_0x3fc44f);var _0x1101b8=ejs[_0xc008('0x65')](_0x572d93,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x6d'),_0x1101b8);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xc644fe){if(_0xc644fe){return _0x127bdf;}})[_0xc008('0x1c')](respondWithResult(_0x23ef42,null))[_0xc008('0x24')](handleError(_0x23ef42,null));};exports[_0xc008('0x31')]=function(_0x2b94b2,_0x37fc2c,_0x4b434f){var _0x5794fe;return db[_0xc008('0x4d')][_0xc008('0x55')]({'where':{'id':_0x2b94b2[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc2c,null))['then'](removeEntity(_0x37fc2c,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x276de2){var _0x52bf60=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x5bc8b0=fs['readFileSync'](path[_0xc008('0x6c')](config['root'],_0xc008('0x64')),_0xc008('0x63'));var _0x544519=ejs[_0xc008('0x65')](_0x52bf60,{'trunks':_0x276de2});var _0x4db90b=ejs['render'](_0x5bc8b0,{'trunks':_0x276de2});fs[_0xc008('0x68')](_0xc008('0x66'),_0x544519);fs['writeFileSync'](_0xc008('0x6d'),_0x4db90b);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x31'),{'module':'chan_sip.so'});})[_0xc008('0x24')](handleError(_0x37fc2c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 714f55e..28490c8 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 _0x3925=['moment','request-promise','path','rimraf','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x2ba566,_0x5113e1){var _0x115d46=function(_0x1361cd){while(--_0x1361cd){_0x2ba566['push'](_0x2ba566['shift']());}};_0x115d46(++_0x5113e1);}(_0x3925,0x68));var _0x5392=function(_0x24f68e,_0x139064){_0x24f68e=_0x24f68e-0x0;var _0x58b286=_0x3925[_0x24f68e];return _0x58b286;};'use strict';var _=require(_0x5392('0x0'));var util=require(_0x5392('0x1'));var logger=require(_0x5392('0x2'))(_0x5392('0x3'));var moment=require(_0x5392('0x4'));var BPromise=require('bluebird');var rp=require(_0x5392('0x5'));var fs=require('fs');var path=require(_0x5392('0x6'));var rimraf=require(_0x5392('0x7'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0x5392('0x8')]=function(_0x538996,_0x2cef56){return _0x538996[_0x5392('0x9')](_0x5392('0xa'),attributes,{'tableName':_0x5392('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5595=['rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1cf5d8,_0x2d66a4){var _0x1483fa=function(_0x358282){while(--_0x358282){_0x1cf5d8['push'](_0x1cf5d8['shift']());}};_0x1483fa(++_0x2d66a4);}(_0x5595,0xde));var _0x5559=function(_0x302482,_0x46d0c7){_0x302482=_0x302482-0x0;var _0x12ba81=_0x5595[_0x302482];return _0x12ba81;};'use strict';var _=require(_0x5559('0x0'));var util=require('util');var logger=require(_0x5559('0x1'))('api');var moment=require(_0x5559('0x2'));var BPromise=require(_0x5559('0x3'));var rp=require(_0x5559('0x4'));var fs=require('fs');var path=require(_0x5559('0x5'));var rimraf=require(_0x5559('0x6'));var config=require(_0x5559('0x7'));var attributes=require(_0x5559('0x8'));module[_0x5559('0x9')]=function(_0x36474d,_0x47bead){return _0x36474d['define'](_0x5559('0xa'),attributes,{'tableName':_0x5559('0xb'),'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 967fc69..7d0456d 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 _0xb06c=['model','ShowTrunk','where','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xb06c,0x123));var _0xcb06=function(_0x5eb2f0,_0x268cab){_0x5eb2f0=_0x5eb2f0-0x0;var _0x220d44=_0xb06c[_0x5eb2f0];return _0x220d44;};'use strict';var _=require('lodash');var util=require(_0xcb06('0x0'));var moment=require(_0xcb06('0x1'));var BPromise=require('bluebird');var rs=require(_0xcb06('0x2'));var fs=require('fs');var Redis=require(_0xcb06('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb06('0x4'));var logger=require('../../config/logger')(_0xcb06('0x5'));var config=require(_0xcb06('0x6'));var jayson=require(_0xcb06('0x7'));var client=jayson['client'][_0xcb06('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26d66a,_0x13124b,_0x333277){return new BPromise(function(_0x21640e,_0x58839c){return client[_0xcb06('0x9')](_0x26d66a,_0x333277)['then'](function(_0x29f71f){logger[_0xcb06('0xa')](_0xcb06('0xb'),_0x13124b,'request\x20sent');logger[_0xcb06('0xc')](_0xcb06('0xd'),_0x13124b,'request\x20sent',JSON[_0xcb06('0xe')](_0x29f71f));if(_0x29f71f[_0xcb06('0xf')]){if(_0x29f71f[_0xcb06('0xf')][_0xcb06('0x10')]===0x1f4){logger['error'](_0xcb06('0xb'),_0x13124b,_0x29f71f[_0xcb06('0xf')][_0xcb06('0x11')]);return _0x58839c(_0x29f71f['error'][_0xcb06('0x11')]);}logger[_0xcb06('0xf')](_0xcb06('0xb'),_0x13124b,_0x29f71f['error'][_0xcb06('0x11')]);return _0x21640e(_0x29f71f[_0xcb06('0xf')][_0xcb06('0x11')]);}else{logger['info'](_0xcb06('0xb'),_0x13124b,_0xcb06('0x12'));_0x21640e(_0x29f71f['result'][_0xcb06('0x11')]);}})[_0xcb06('0x13')](function(_0xa8177a){logger[_0xcb06('0xf')](_0xcb06('0xb'),_0x13124b,_0xa8177a);_0x58839c(_0xa8177a);});});}exports[_0xcb06('0x14')]=function(_0x443ceb){var _0x4c518f=this;return new Promise(function(_0xd9a8fa,_0x17e698){return db[_0xcb06('0x15')][_0xcb06('0x16')]({'raw':_0x443ceb['options']?_0x443ceb[_0xcb06('0x17')][_0xcb06('0x18')]===undefined?!![]:![]:!![],'where':_0x443ceb[_0xcb06('0x17')]?_0x443ceb['options']['where']||null:null,'attributes':_0x443ceb[_0xcb06('0x17')]?_0x443ceb['options'][_0xcb06('0x19')]||null:null,'limit':_0x443ceb[_0xcb06('0x17')]?_0x443ceb[_0xcb06('0x17')][_0xcb06('0x1a')]||null:null,'include':_0x443ceb[_0xcb06('0x17')]?_0x443ceb['options'][_0xcb06('0x1b')]?_[_0xcb06('0x1c')](_0x443ceb[_0xcb06('0x17')][_0xcb06('0x1b')],function(_0x1410e0){return{'model':db[_0x1410e0[_0xcb06('0x1d')]],'as':_0x1410e0['as'],'attributes':_0x1410e0[_0xcb06('0x19')],'include':_0x1410e0[_0xcb06('0x1b')]?_[_0xcb06('0x1c')](_0x1410e0[_0xcb06('0x1b')],function(_0x5b1398){return{'model':db[_0x5b1398[_0xcb06('0x1d')]],'as':_0x5b1398['as'],'attributes':_0x5b1398[_0xcb06('0x19')],'include':_0x5b1398[_0xcb06('0x1b')]?_[_0xcb06('0x1c')](_0x5b1398[_0xcb06('0x1b')],function(_0x56e229){return{'model':db[_0x56e229[_0xcb06('0x1d')]],'as':_0x56e229['as'],'attributes':_0x56e229[_0xcb06('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc06b86){logger[_0xcb06('0xa')](_0xcb06('0x14'),_0x443ceb);logger['debug'](_0xcb06('0x14'),_0x443ceb,JSON['stringify'](_0xc06b86));_0xd9a8fa(_0xc06b86);})[_0xcb06('0x13')](function(_0x824098){logger['error'](_0xcb06('0x14'),_0x824098[_0xcb06('0x11')],_0x443ceb);_0x17e698(_0x4c518f[_0xcb06('0xf')](0x1f4,_0x824098[_0xcb06('0x11')]));});});};exports[_0xcb06('0x1e')]=function(_0x3af1ba){var _0x987d1e=this;return new Promise(function(_0x1f1a13,_0x2840c0){return db[_0xcb06('0x15')]['find']({'raw':_0x3af1ba['options']?_0x3af1ba['options'][_0xcb06('0x18')]===undefined?!![]:![]:!![],'where':_0x3af1ba['options']?_0x3af1ba[_0xcb06('0x17')][_0xcb06('0x1f')]||null:null,'attributes':_0x3af1ba['options']?_0x3af1ba[_0xcb06('0x17')][_0xcb06('0x19')]||null:null,'include':_0x3af1ba[_0xcb06('0x17')]?_0x3af1ba['options']['include']?_[_0xcb06('0x1c')](_0x3af1ba[_0xcb06('0x17')]['include'],function(_0xe0d600){return{'model':db[_0xe0d600['model']],'as':_0xe0d600['as'],'attributes':_0xe0d600['attributes'],'include':_0xe0d600[_0xcb06('0x1b')]?_[_0xcb06('0x1c')](_0xe0d600[_0xcb06('0x1b')],function(_0x54ac68){return{'model':db[_0x54ac68[_0xcb06('0x1d')]],'as':_0x54ac68['as'],'attributes':_0x54ac68[_0xcb06('0x19')],'include':_0x54ac68[_0xcb06('0x1b')]?_[_0xcb06('0x1c')](_0x54ac68[_0xcb06('0x1b')],function(_0x4b3201){return{'model':db[_0x4b3201['model']],'as':_0x4b3201['as'],'attributes':_0x4b3201[_0xcb06('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a9aa8){logger[_0xcb06('0xa')](_0xcb06('0x1e'),_0x3af1ba);logger[_0xcb06('0xc')](_0xcb06('0x1e'),_0x3af1ba,JSON[_0xcb06('0xe')](_0x3a9aa8));_0x1f1a13(_0x3a9aa8);})[_0xcb06('0x13')](function(_0x43ad03){logger['error']('ShowTrunk',_0x43ad03[_0xcb06('0x11')],_0x3af1ba);_0x2840c0(_0x987d1e['error'](0x1f4,_0x43ad03[_0xcb06('0x11')]));});});}; \ No newline at end of file +var _0xf681=['ShowTrunk','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include','map','attributes','model'];(function(_0x49178b,_0x3a882b){var _0x2d73cc=function(_0x2e29aa){while(--_0x2e29aa){_0x49178b['push'](_0x49178b['shift']());}};_0x2d73cc(++_0x3a882b);}(_0xf681,0x6e));var _0x1f68=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf681[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x1f68('0x0'));var moment=require(_0x1f68('0x1'));var BPromise=require(_0x1f68('0x2'));var rs=require(_0x1f68('0x3'));var fs=require('fs');var Redis=require(_0x1f68('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f68('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1f68('0x6'));var jayson=require(_0x1f68('0x7'));var client=jayson[_0x1f68('0x8')][_0x1f68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x345375,_0x14522c,_0x2983a5){return new BPromise(function(_0x34761a,_0x5f1c0c){return client[_0x1f68('0xa')](_0x345375,_0x2983a5)[_0x1f68('0xb')](function(_0x18ea1c){logger[_0x1f68('0xc')](_0x1f68('0xd'),_0x14522c,_0x1f68('0xe'));logger[_0x1f68('0xf')](_0x1f68('0x10'),_0x14522c,_0x1f68('0xe'),JSON[_0x1f68('0x11')](_0x18ea1c));if(_0x18ea1c[_0x1f68('0x12')]){if(_0x18ea1c[_0x1f68('0x12')][_0x1f68('0x13')]===0x1f4){logger[_0x1f68('0x12')](_0x1f68('0xd'),_0x14522c,_0x18ea1c[_0x1f68('0x12')][_0x1f68('0x14')]);return _0x5f1c0c(_0x18ea1c[_0x1f68('0x12')][_0x1f68('0x14')]);}logger[_0x1f68('0x12')](_0x1f68('0xd'),_0x14522c,_0x18ea1c[_0x1f68('0x12')]['message']);return _0x34761a(_0x18ea1c[_0x1f68('0x12')]['message']);}else{logger[_0x1f68('0xc')](_0x1f68('0xd'),_0x14522c,_0x1f68('0xe'));_0x34761a(_0x18ea1c[_0x1f68('0x15')][_0x1f68('0x14')]);}})[_0x1f68('0x16')](function(_0x1761d6){logger[_0x1f68('0x12')](_0x1f68('0xd'),_0x14522c,_0x1761d6);_0x5f1c0c(_0x1761d6);});});}exports[_0x1f68('0x17')]=function(_0x521350){var _0x3a26f4=this;return new Promise(function(_0x55b5f4,_0x2f996e){return db[_0x1f68('0x18')][_0x1f68('0x19')]({'raw':_0x521350[_0x1f68('0x1a')]?_0x521350[_0x1f68('0x1a')][_0x1f68('0x1b')]===undefined?!![]:![]:!![],'where':_0x521350[_0x1f68('0x1a')]?_0x521350['options'][_0x1f68('0x1c')]||null:null,'attributes':_0x521350['options']?_0x521350[_0x1f68('0x1a')]['attributes']||null:null,'limit':_0x521350[_0x1f68('0x1a')]?_0x521350[_0x1f68('0x1a')][_0x1f68('0x1d')]||null:null,'include':_0x521350[_0x1f68('0x1a')]?_0x521350[_0x1f68('0x1a')][_0x1f68('0x1e')]?_[_0x1f68('0x1f')](_0x521350[_0x1f68('0x1a')][_0x1f68('0x1e')],function(_0x40ad4c){return{'model':db[_0x40ad4c['model']],'as':_0x40ad4c['as'],'attributes':_0x40ad4c[_0x1f68('0x20')],'include':_0x40ad4c[_0x1f68('0x1e')]?_[_0x1f68('0x1f')](_0x40ad4c[_0x1f68('0x1e')],function(_0x3be59b){return{'model':db[_0x3be59b[_0x1f68('0x21')]],'as':_0x3be59b['as'],'attributes':_0x3be59b['attributes'],'include':_0x3be59b[_0x1f68('0x1e')]?_[_0x1f68('0x1f')](_0x3be59b['include'],function(_0x2dad95){return{'model':db[_0x2dad95['model']],'as':_0x2dad95['as'],'attributes':_0x2dad95[_0x1f68('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x935681){logger[_0x1f68('0xc')](_0x1f68('0x17'),_0x521350);logger[_0x1f68('0xf')](_0x1f68('0x17'),_0x521350,JSON[_0x1f68('0x11')](_0x935681));_0x55b5f4(_0x935681);})['catch'](function(_0x58b2ff){logger['error'](_0x1f68('0x17'),_0x58b2ff[_0x1f68('0x14')],_0x521350);_0x2f996e(_0x3a26f4[_0x1f68('0x12')](0x1f4,_0x58b2ff[_0x1f68('0x14')]));});});};exports[_0x1f68('0x22')]=function(_0x3040da){var _0x4729fa=this;return new Promise(function(_0xfbe188,_0xf6ca83){return db[_0x1f68('0x18')][_0x1f68('0x23')]({'raw':_0x3040da[_0x1f68('0x1a')]?_0x3040da[_0x1f68('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3040da[_0x1f68('0x1a')]?_0x3040da[_0x1f68('0x1a')]['where']||null:null,'attributes':_0x3040da[_0x1f68('0x1a')]?_0x3040da[_0x1f68('0x1a')][_0x1f68('0x20')]||null:null,'include':_0x3040da[_0x1f68('0x1a')]?_0x3040da[_0x1f68('0x1a')][_0x1f68('0x1e')]?_[_0x1f68('0x1f')](_0x3040da[_0x1f68('0x1a')][_0x1f68('0x1e')],function(_0x4c024d){return{'model':db[_0x4c024d[_0x1f68('0x21')]],'as':_0x4c024d['as'],'attributes':_0x4c024d[_0x1f68('0x20')],'include':_0x4c024d[_0x1f68('0x1e')]?_[_0x1f68('0x1f')](_0x4c024d[_0x1f68('0x1e')],function(_0x44a549){return{'model':db[_0x44a549[_0x1f68('0x21')]],'as':_0x44a549['as'],'attributes':_0x44a549[_0x1f68('0x20')],'include':_0x44a549[_0x1f68('0x1e')]?_['map'](_0x44a549[_0x1f68('0x1e')],function(_0x5bdbe6){return{'model':db[_0x5bdbe6[_0x1f68('0x21')]],'as':_0x5bdbe6['as'],'attributes':_0x5bdbe6[_0x1f68('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1f68('0xb')](function(_0x3c4ec9){logger[_0x1f68('0xc')](_0x1f68('0x22'),_0x3040da);logger[_0x1f68('0xf')](_0x1f68('0x22'),_0x3040da,JSON['stringify'](_0x3c4ec9));_0xfbe188(_0x3c4ec9);})[_0x1f68('0x16')](function(_0x443915){logger[_0x1f68('0x12')](_0x1f68('0x22'),_0x443915[_0x1f68('0x14')],_0x3040da);_0xf6ca83(_0x4729fa[_0x1f68('0x12')](0x1f4,_0x443915[_0x1f68('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8f40be3..71cdc60 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 _0xa912=['removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getTeams','getLists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','createApiKey','put','/:id/password','changePassword','removeTeams','delete','/:id','destroy','removeMailInteractions'];(function(_0xb60a95,_0xdb478f){var _0x2c876c=function(_0x234c62){while(--_0x234c62){_0xb60a95['push'](_0xb60a95['shift']());}};_0x2c876c(++_0xdb478f);}(_0xa912,0xf2));var _0x2a91=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xa912[_0x5a776b];return _0xbbef59;};'use strict';var multer=require(_0x2a91('0x0'));var util=require(_0x2a91('0x1'));var path=require(_0x2a91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2a91('0x3')]();var fs_extra=require(_0x2a91('0x4'));var auth=require(_0x2a91('0x5'));var interaction=require(_0x2a91('0x6'));var config=require('../../config/environment');var controller=require(_0x2a91('0x7'));router[_0x2a91('0x8')]('/',auth[_0x2a91('0x9')](),controller[_0x2a91('0xa')]);router[_0x2a91('0x8')](_0x2a91('0xb'),auth[_0x2a91('0x9')](),controller['describe']);router[_0x2a91('0x8')](_0x2a91('0xc'),auth[_0x2a91('0x9')](),controller[_0x2a91('0xd')]);router['get']('/presence',auth[_0x2a91('0x9')](),controller[_0x2a91('0xe')]);router['get']('/:id',auth[_0x2a91('0x9')](),controller[_0x2a91('0xf')]);router['get'](_0x2a91('0x10'),controller[_0x2a91('0x11')]);router[_0x2a91('0x8')](_0x2a91('0x12'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x13')]);router['get'](_0x2a91('0x14'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x15')]);router[_0x2a91('0x8')]('/:id/queues',auth[_0x2a91('0x9')](),controller[_0x2a91('0x16')]);router[_0x2a91('0x8')](_0x2a91('0x17'),auth['isAuthenticated'](),controller[_0x2a91('0x18')]);router['get']('/:id/groups',auth[_0x2a91('0x9')](),controller[_0x2a91('0x19')]);router[_0x2a91('0x8')](_0x2a91('0x1a'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x1b')]);router[_0x2a91('0x8')](_0x2a91('0x1c'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x1d')]);router[_0x2a91('0x8')](_0x2a91('0x1e'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x1f')]);router[_0x2a91('0x8')](_0x2a91('0x20'),auth['isAuthenticated'](),controller[_0x2a91('0x21')]);router['get']('/:id/mail/interactions',auth[_0x2a91('0x9')](),controller[_0x2a91('0x22')]);router[_0x2a91('0x8')](_0x2a91('0x23'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x24')]);router[_0x2a91('0x8')](_0x2a91('0x25'),auth['isAuthenticated'](),controller[_0x2a91('0x26')]);router[_0x2a91('0x8')]('/:id/whatsapp/interactions',auth[_0x2a91('0x9')](),controller['getWhatsappInteractions']);router[_0x2a91('0x8')]('/:id/teams',auth[_0x2a91('0x9')](),controller[_0x2a91('0x27')]);router['get']('/:id/lists',auth[_0x2a91('0x9')](),controller[_0x2a91('0x28')]);router[_0x2a91('0x8')](_0x2a91('0x29'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x2a')]);router[_0x2a91('0x8')]('/:id/prefixes',auth[_0x2a91('0x9')](),controller['getVoicePrefixes']);router['get'](_0x2a91('0x2b'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x2c')]);router[_0x2a91('0x8')]('/:id/mail_accounts',auth[_0x2a91('0x9')](),controller[_0x2a91('0x2d')]);router[_0x2a91('0x8')](_0x2a91('0x2e'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x2f')]);router['get'](_0x2a91('0x30'),auth[_0x2a91('0x9')](),controller['getSmsAccounts']);router['get'](_0x2a91('0x31'),auth['isAuthenticated'](),controller[_0x2a91('0x32')]);router[_0x2a91('0x8')](_0x2a91('0x33'),auth['isAuthenticated'](),controller[_0x2a91('0x34')]);router[_0x2a91('0x8')](_0x2a91('0x35'),auth[_0x2a91('0x9')](),controller['getSquareProjects']);router[_0x2a91('0x8')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x2a91('0x8')](_0x2a91('0x36'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x37')]);router[_0x2a91('0x38')](_0x2a91('0x14'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x39')]);router[_0x2a91('0x38')]('/',auth[_0x2a91('0x9')](),controller[_0x2a91('0x3a')]);router['post'](_0x2a91('0x3b'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x3c')]);router['post'](_0x2a91('0x3d'),auth['isAuthenticated'](),controller[_0x2a91('0x3e')]);var upload=multer({'storage':multer[_0x2a91('0x3f')]({'destination':function(_0x3969f6,_0x4f39de,_0x33bc06){_0x33bc06(null,path[_0x2a91('0x40')](config[_0x2a91('0x41')],_0x2a91('0x42')));},'filename':function(_0x27a3f6,_0x4617aa,_0x458f6d){_0x458f6d(null,util[_0x2a91('0x43')](_0x2a91('0x44'),Date[_0x2a91('0x45')](),_0x4617aa['originalname']));}})});router[_0x2a91('0x38')](_0x2a91('0x10'),upload['single'](_0x2a91('0x46')),controller[_0x2a91('0x47')]);router[_0x2a91('0x38')](_0x2a91('0x48'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x49')]);router['post'](_0x2a91('0x4a'),auth['isAuthenticated'](),controller[_0x2a91('0x4b')]);router[_0x2a91('0x38')](_0x2a91('0x4c'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x4d')]);router[_0x2a91('0x38')](_0x2a91('0x4e'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x4f')]);router[_0x2a91('0x38')](_0x2a91('0x50'),auth['isAuthenticated'](),controller[_0x2a91('0x51')]);router[_0x2a91('0x38')](_0x2a91('0x52'),auth['isAuthenticated'](),controller[_0x2a91('0x53')]);router[_0x2a91('0x38')](_0x2a91('0x54'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x55')]);router['post'](_0x2a91('0x56'),auth[_0x2a91('0x9')](),controller['addFaxInteractions']);router[_0x2a91('0x38')](_0x2a91('0x57'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x58')]);router[_0x2a91('0x38')](_0x2a91('0x59'),auth['isAuthenticated'](),controller[_0x2a91('0x5a')]);router[_0x2a91('0x38')](_0x2a91('0x5b'),auth['isAuthenticated'](),controller[_0x2a91('0x5c')]);router[_0x2a91('0x38')]('/:id/fax_accounts',auth[_0x2a91('0x9')](),controller[_0x2a91('0x5d')]);router[_0x2a91('0x38')]('/:id/mail_accounts',auth[_0x2a91('0x9')](),controller[_0x2a91('0x5e')]);router[_0x2a91('0x38')](_0x2a91('0x2e'),auth[_0x2a91('0x9')](),controller['addOpenchannelAccounts']);router[_0x2a91('0x38')](_0x2a91('0x30'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x5f')]);router[_0x2a91('0x38')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x2a91('0x60')]);router[_0x2a91('0x38')]('/:id/whatsapp_accounts',auth[_0x2a91('0x9')](),controller['addWhatsappAccounts']);router[_0x2a91('0x38')](_0x2a91('0x35'),auth[_0x2a91('0x9')](),controller['addSquareProjects']);router[_0x2a91('0x38')](_0x2a91('0x36'),auth['isAuthenticated'](),controller[_0x2a91('0x61')]);router[_0x2a91('0x62')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2a91('0x62')](_0x2a91('0x63'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x64')]);router['delete']('/:id/queues',auth[_0x2a91('0x9')](),controller['removeQueues']);router['delete'](_0x2a91('0x50'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x65')]);router[_0x2a91('0x66')](_0x2a91('0x67'),auth['isAuthenticated'](),controller[_0x2a91('0x68')]);router[_0x2a91('0x66')]('/:id/chat_interactions',auth[_0x2a91('0x9')](),controller['removeChatInteractions']);router[_0x2a91('0x66')](_0x2a91('0x54'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x69')]);router['delete'](_0x2a91('0x56'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router['delete'](_0x2a91('0x57'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x6a')]);router['delete'](_0x2a91('0x59'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x6b')]);router[_0x2a91('0x66')]('/:id/whatsapp_interactions',auth[_0x2a91('0x9')](),controller[_0x2a91('0x6c')]);router[_0x2a91('0x66')](_0x2a91('0x2b'),auth['isAuthenticated'](),controller[_0x2a91('0x6d')]);router[_0x2a91('0x66')](_0x2a91('0x6e'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x2a91('0x66')](_0x2a91('0x2e'),auth['isAuthenticated'](),controller[_0x2a91('0x6f')]);router[_0x2a91('0x66')]('/:id/sms_accounts',auth[_0x2a91('0x9')](),controller['removeSmsAccounts']);router[_0x2a91('0x66')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x2a91('0x70')]);router[_0x2a91('0x66')](_0x2a91('0x33'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x71')]);router['delete'](_0x2a91('0x35'),auth[_0x2a91('0x9')](),controller[_0x2a91('0x72')]);router['delete'](_0x2a91('0x36'),auth[_0x2a91('0x9')](),controller['removeApiKey']);module[_0x2a91('0x73')]=router; \ No newline at end of file +var _0x14b6=['removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/whoami','/presence','/:id','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getTeams','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','diskStorage','join','root','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','/:id/teams','removeTeams','removeMailInteractions','removeFaxInteractions'];(function(_0x3bd363,_0x128f0b){var _0x5ebc76=function(_0x1f3a18){while(--_0x1f3a18){_0x3bd363['push'](_0x3bd363['shift']());}};_0x5ebc76(++_0x128f0b);}(_0x14b6,0xeb));var _0x614b=function(_0x1d3244,_0x130236){_0x1d3244=_0x1d3244-0x0;var _0x5b62b3=_0x14b6[_0x1d3244];return _0x5b62b3;};'use strict';var multer=require(_0x614b('0x0'));var util=require(_0x614b('0x1'));var path=require(_0x614b('0x2'));var timeout=require(_0x614b('0x3'));var express=require('express');var router=express[_0x614b('0x4')]();var fs_extra=require(_0x614b('0x5'));var auth=require(_0x614b('0x6'));var interaction=require(_0x614b('0x7'));var config=require(_0x614b('0x8'));var controller=require(_0x614b('0x9'));router['get']('/',auth[_0x614b('0xa')](),controller[_0x614b('0xb')]);router['get']('/describe',auth[_0x614b('0xa')](),controller['describe']);router[_0x614b('0xc')](_0x614b('0xd'),auth['isAuthenticated'](),controller['whoami']);router[_0x614b('0xc')](_0x614b('0xe'),auth[_0x614b('0xa')](),controller['getPresence']);router['get'](_0x614b('0xf'),auth[_0x614b('0xa')](),controller['show']);router[_0x614b('0xc')](_0x614b('0x10'),controller['getAvatar']);router[_0x614b('0xc')](_0x614b('0x11'),auth['isAuthenticated'](),controller[_0x614b('0x12')]);router['get'](_0x614b('0x13'),auth['isAuthenticated'](),controller[_0x614b('0x14')]);router[_0x614b('0xc')](_0x614b('0x15'),auth[_0x614b('0xa')](),controller[_0x614b('0x16')]);router[_0x614b('0xc')](_0x614b('0x17'),auth['isAuthenticated'](),controller[_0x614b('0x18')]);router[_0x614b('0xc')](_0x614b('0x19'),auth[_0x614b('0xa')](),controller['getGroups']);router['get'](_0x614b('0x1a'),auth['isAuthenticated'](),controller[_0x614b('0x1b')]);router[_0x614b('0xc')](_0x614b('0x1c'),auth[_0x614b('0xa')](),controller[_0x614b('0x1d')]);router[_0x614b('0xc')](_0x614b('0x1e'),auth[_0x614b('0xa')](),controller[_0x614b('0x1f')]);router[_0x614b('0xc')](_0x614b('0x20'),auth[_0x614b('0xa')](),controller[_0x614b('0x21')]);router[_0x614b('0xc')](_0x614b('0x22'),auth[_0x614b('0xa')](),controller['getMailInteractions']);router[_0x614b('0xc')](_0x614b('0x23'),auth['isAuthenticated'](),controller[_0x614b('0x24')]);router[_0x614b('0xc')](_0x614b('0x25'),auth[_0x614b('0xa')](),controller['getFaxInteractions']);router['get'](_0x614b('0x26'),auth[_0x614b('0xa')](),controller['getWhatsappInteractions']);router['get']('/:id/teams',auth[_0x614b('0xa')](),controller[_0x614b('0x27')]);router[_0x614b('0xc')]('/:id/lists',auth[_0x614b('0xa')](),controller['getLists']);router[_0x614b('0xc')]('/:id/agents',auth[_0x614b('0xa')](),controller[_0x614b('0x28')]);router[_0x614b('0xc')](_0x614b('0x29'),auth[_0x614b('0xa')](),controller['getVoicePrefixes']);router[_0x614b('0xc')](_0x614b('0x2a'),auth[_0x614b('0xa')](),controller[_0x614b('0x2b')]);router[_0x614b('0xc')](_0x614b('0x2c'),auth[_0x614b('0xa')](),controller[_0x614b('0x2d')]);router[_0x614b('0xc')](_0x614b('0x2e'),auth['isAuthenticated'](),controller[_0x614b('0x2f')]);router[_0x614b('0xc')](_0x614b('0x30'),auth[_0x614b('0xa')](),controller['getSmsAccounts']);router[_0x614b('0xc')](_0x614b('0x31'),auth['isAuthenticated'](),controller[_0x614b('0x32')]);router[_0x614b('0xc')](_0x614b('0x33'),auth[_0x614b('0xa')](),controller[_0x614b('0x34')]);router[_0x614b('0xc')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x614b('0x35')]);router[_0x614b('0xc')](_0x614b('0x36'),auth[_0x614b('0xa')](),controller[_0x614b('0x37')]);router[_0x614b('0xc')](_0x614b('0x38'),auth[_0x614b('0xa')](),controller[_0x614b('0x39')]);router[_0x614b('0x3a')](_0x614b('0x13'),auth['isAuthenticated'](),controller[_0x614b('0x3b')]);router[_0x614b('0x3a')]('/',auth[_0x614b('0xa')](),controller['create']);router['post'](_0x614b('0x3c'),auth[_0x614b('0xa')](),controller[_0x614b('0x3d')]);router[_0x614b('0x3a')](_0x614b('0x15'),auth[_0x614b('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x614b('0x3e')]({'destination':function(_0x2a7d78,_0x1c5e2b,_0x297381){_0x297381(null,path[_0x614b('0x3f')](config[_0x614b('0x40')],'server/files/images/'));},'filename':function(_0x407ebc,_0x917e33,_0x5dfe98){_0x5dfe98(null,util[_0x614b('0x41')](_0x614b('0x42'),Date[_0x614b('0x43')](),_0x917e33[_0x614b('0x44')]));}})});router[_0x614b('0x3a')](_0x614b('0x10'),upload[_0x614b('0x45')](_0x614b('0x46')),controller['addAvatar']);router[_0x614b('0x3a')](_0x614b('0x47'),auth[_0x614b('0xa')](),controller[_0x614b('0x48')]);router['post'](_0x614b('0x49'),auth[_0x614b('0xa')](),controller[_0x614b('0x4a')]);router[_0x614b('0x3a')](_0x614b('0x4b'),auth[_0x614b('0xa')](),controller['pause']);router['post'](_0x614b('0x4c'),auth[_0x614b('0xa')](),controller['unpause']);router[_0x614b('0x3a')]('/:id/teams',auth[_0x614b('0xa')](),controller[_0x614b('0x4d')]);router[_0x614b('0x3a')](_0x614b('0x4e'),auth[_0x614b('0xa')](),controller[_0x614b('0x4f')]);router[_0x614b('0x3a')](_0x614b('0x50'),auth[_0x614b('0xa')](),controller[_0x614b('0x51')]);router[_0x614b('0x3a')](_0x614b('0x52'),auth[_0x614b('0xa')](),controller[_0x614b('0x53')]);router['post']('/:id/sms_interactions',auth[_0x614b('0xa')](),controller['addSmsInteractions']);router[_0x614b('0x3a')](_0x614b('0x54'),auth[_0x614b('0xa')](),controller[_0x614b('0x55')]);router['post'](_0x614b('0x56'),auth['isAuthenticated'](),controller[_0x614b('0x57')]);router[_0x614b('0x3a')]('/:id/fax_accounts',auth[_0x614b('0xa')](),controller[_0x614b('0x58')]);router[_0x614b('0x3a')](_0x614b('0x2c'),auth[_0x614b('0xa')](),controller['addMailAccounts']);router[_0x614b('0x3a')](_0x614b('0x2e'),auth['isAuthenticated'](),controller[_0x614b('0x59')]);router[_0x614b('0x3a')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x614b('0x5a')]);router[_0x614b('0x3a')](_0x614b('0x31'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x614b('0x3a')](_0x614b('0x33'),auth[_0x614b('0xa')](),controller[_0x614b('0x5b')]);router[_0x614b('0x3a')](_0x614b('0x5c'),auth[_0x614b('0xa')](),controller[_0x614b('0x5d')]);router[_0x614b('0x3a')](_0x614b('0x38'),auth['isAuthenticated'](),controller[_0x614b('0x5e')]);router[_0x614b('0x5f')](_0x614b('0xf'),auth[_0x614b('0xa')](),controller[_0x614b('0x60')]);router[_0x614b('0x5f')](_0x614b('0x61'),auth['isAuthenticated'](),controller[_0x614b('0x62')]);router[_0x614b('0x63')]('/:id/queues',auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0x614b('0x64'),auth[_0x614b('0xa')](),controller[_0x614b('0x65')]);router[_0x614b('0x63')](_0x614b('0xf'),auth[_0x614b('0xa')](),controller['destroy']);router[_0x614b('0x63')](_0x614b('0x4e'),auth[_0x614b('0xa')](),controller['removeChatInteractions']);router[_0x614b('0x63')](_0x614b('0x50'),auth[_0x614b('0xa')](),controller[_0x614b('0x66')]);router[_0x614b('0x63')]('/:id/fax_interactions',auth[_0x614b('0xa')](),controller[_0x614b('0x67')]);router[_0x614b('0x63')]('/:id/sms_interactions',auth[_0x614b('0xa')](),controller[_0x614b('0x68')]);router['delete'](_0x614b('0x54'),auth[_0x614b('0xa')](),controller['removeOpenchannelInteractions']);router[_0x614b('0x63')](_0x614b('0x56'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x614b('0x63')](_0x614b('0x2a'),auth[_0x614b('0xa')](),controller[_0x614b('0x69')]);router[_0x614b('0x63')](_0x614b('0x2c'),auth[_0x614b('0xa')](),controller[_0x614b('0x6a')]);router[_0x614b('0x63')](_0x614b('0x2e'),auth[_0x614b('0xa')](),controller[_0x614b('0x6b')]);router['delete'](_0x614b('0x30'),auth[_0x614b('0xa')](),controller[_0x614b('0x6c')]);router[_0x614b('0x63')](_0x614b('0x31'),auth[_0x614b('0xa')](),controller[_0x614b('0x6d')]);router[_0x614b('0x63')](_0x614b('0x33'),auth[_0x614b('0xa')](),controller[_0x614b('0x6e')]);router[_0x614b('0x63')](_0x614b('0x5c'),auth[_0x614b('0xa')](),controller['removeSquareProjects']);router[_0x614b('0x63')](_0x614b('0x38'),auth[_0x614b('0xa')](),controller[_0x614b('0x6f')]);module[_0x614b('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6da8a4b..6833140 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 _0x49df=['The\x20name\x20of\x20the\x20user','callerid','format','internal','email','toLowerCase','ENUM','user','local','INTEGER','\x22%s\x22\x20<%s>','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','nonat','update','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','get','isArray','udp','encryption','avpf','icesupport','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','dtlsverify','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','defaultuser'];(function(_0x1f2405,_0x534b4f){var _0x4a0d2f=function(_0x221b81){while(--_0x221b81){_0x1f2405['push'](_0x1f2405['shift']());}};_0x4a0d2f(++_0x534b4f);}(_0x49df,0xad));var _0xf49d=function(_0x357979,_0x56feef){_0x357979=_0x357979-0x0;var _0xabb42f=_0x49df[_0x357979];return _0xabb42f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0xf49d('0x0'));var _=require(_0xf49d('0x1'));module[_0xf49d('0x2')]={'name':{'type':Sequelize[_0xf49d('0x3')],'allowNull':![],'unique':_0xf49d('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1ff84c){this[_0xf49d('0x5')]('name',_0x1ff84c);this[_0xf49d('0x5')](_0xf49d('0x6'),_0x1ff84c);},'comment':_0xf49d('0x7')},'fullname':{'type':Sequelize[_0xf49d('0x3')],'allowNull':![],'set':function(_0x1aaf37){this[_0xf49d('0x5')]('fullname',_0x1aaf37);this[_0xf49d('0x5')](_0xf49d('0x8'),util[_0xf49d('0x9')]('\x22%s\x22\x20<%s>',_0x1aaf37,this['getDataValue'](_0xf49d('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf49d('0xb'),'validate':{'isEmail':!![]},'set':function(_0xb82700){if(_0xb82700){this[_0xf49d('0x5')]('email',_0xb82700[_0xf49d('0xc')]());}}},'role':{'type':Sequelize[_0xf49d('0xd')]('admin',_0xf49d('0xe'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xf49d('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xf49d('0xf')},'internal':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':![],'unique':_0xf49d('0xa'),'set':function(_0x5ab175){this[_0xf49d('0x5')](_0xf49d('0xa'),_0x5ab175);this[_0xf49d('0x5')]('accountcode',_0x5ab175);this[_0xf49d('0x5')](_0xf49d('0x8'),util[_0xf49d('0x9')](_0xf49d('0x11'),this['getDataValue'](_0xf49d('0x12')),_0x5ab175));}},'salt':{'type':Sequelize[_0xf49d('0x3')]},'phone':{'type':Sequelize[_0xf49d('0x3')]},'mobile':{'type':Sequelize[_0xf49d('0x3')]},'address':{'type':Sequelize[_0xf49d('0x3')]},'zipcode':{'type':Sequelize[_0xf49d('0x3')]},'userpic':{'type':Sequelize[_0xf49d('0x3')]},'city':{'type':Sequelize[_0xf49d('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xf49d('0x14')]},'voicePause':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf49d('0x3')],'defaultValue':_0xf49d('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf49d('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xf49d('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xf49d('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf49d('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf49d('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![],'defaultValue':_0xf49d('0x16')},'ipaddr':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xf49d('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xf49d('0xd')]('friend','user',_0xf49d('0x17')),'allowNull':!![],'defaultValue':_0xf49d('0x18')},'context':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![],'defaultValue':_0xf49d('0x19')},'callingpres':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x1a'),_0xf49d('0x1b'),'ALLOWED_FAILED_SCREEN',_0xf49d('0x1c'),_0xf49d('0x1d'),_0xf49d('0x1e'),_0xf49d('0x1f'),_0xf49d('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x41e760){this[_0xf49d('0x5')]('transport',_0x41e760?_0x41e760[_0xf49d('0x21')](','):null);},'get':function(){return this[_0xf49d('0x22')](_0xf49d('0x23'))?this['getDataValue'](_0xf49d('0x23'))[_0xf49d('0x24')](','):null;},'comment':_0xf49d('0x25')},'dtmfmode':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x26'),_0xf49d('0x27'),_0xf49d('0x28'),_0xf49d('0x29'),'auto'),'allowNull':!![],'defaultValue':_0xf49d('0x26')},'directmedia':{'type':Sequelize[_0xf49d('0xd')]('yes','no',_0xf49d('0x2a'),_0xf49d('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![],'defaultValue':_0xf49d('0x2d'),'set':function(_0x18e604){this[_0xf49d('0x5')](_0xf49d('0x2e'),_0x18e604?_0x18e604['join'](','):null);},'get':function(){return this[_0xf49d('0x22')](_0xf49d('0x2e'))?this[_0xf49d('0x22')](_0xf49d('0x2e'))['split'](','):null;},'comment':_0xf49d('0x2f')},'callgroup':{'type':Sequelize[_0xf49d('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xf49d('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xf49d('0x3')]},'language':{'type':Sequelize[_0xf49d('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xf49d('0x3')],'allowNull':![],'defaultValue':_0xf49d('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf49d('0x31'),'set':function(_0x4e5f14){this['setDataValue'](_0xf49d('0x32'),_0x4e5f14?_0x4e5f14['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf49d('0x22')](_0xf49d('0x32'))?this[_0xf49d('0x22')](_0xf49d('0x32'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![],'set':function(_0x287d15){this[_0xf49d('0x5')](_0xf49d('0x33'),_0x287d15?_0x287d15['join'](','):null);},'get':function(){return this[_0xf49d('0x22')](_0xf49d('0x33'))?this[_0xf49d('0x22')](_0xf49d('0x33'))[_0xf49d('0x24')](','):null;},'comment':_0xf49d('0x34')},'trustrpid':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf49d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf49d('0xd')]('yes','no',_0xf49d('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xf49d('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf49d('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![],'defaultValue':_0xf49d('0x36')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xf49d('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xf49d('0x2c')},'busylevel':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xf49d('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xf49d('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf49d('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xf49d('0xd')]('yes','no',_0xf49d('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x38'),_0xf49d('0x39'),_0xf49d('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x3b'),_0xf49d('0x3c')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf49d('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf49d('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xf49d('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no',_0xf49d('0x3d'),_0xf49d('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x3f'),_0xf49d('0x40'),_0xf49d('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xf49d('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf49d('0xd')]('yes','no','nonat',_0xf49d('0x2b'),_0xf49d('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xf49d('0x43')]},'showWebBar':{'type':Sequelize[_0xf49d('0x10')],'defaultValue':0x0,'set':function(_0x392656){this[_0xf49d('0x5')]('showWebBar',_0x392656);var _0x10f297=this[_0xf49d('0x44')]({'plain':!![]});switch(_0x392656){case 0x0:case 0x1:var _0x155090=_0x10f297[_0xf49d('0x23')]?_[_0xf49d('0x45')](_0x10f297[_0xf49d('0x23')])?_0x10f297['transport'][_0xf49d('0x21')]():_0x10f297['transport']:_0xf49d('0x46');if(_0x155090==='wss'){_0x155090=_0xf49d('0x46');}this[_0xf49d('0x5')](_0xf49d('0x23'),_0x155090);this[_0xf49d('0x5')](_0xf49d('0x47'),'no');this[_0xf49d('0x5')](_0xf49d('0x48'),null);this[_0xf49d('0x5')]('force_avp',null);this[_0xf49d('0x5')](_0xf49d('0x49'),null);this[_0xf49d('0x5')]('dtlsenable',null);this[_0xf49d('0x5')]('dtlsverify',null);this[_0xf49d('0x5')]('dtlssetup',null);this[_0xf49d('0x5')](_0xf49d('0x4a'),null);this[_0xf49d('0x5')](_0xf49d('0x4b'),null);this[_0xf49d('0x5')](_0xf49d('0x4c'),'no');break;case 0x2:this[_0xf49d('0x5')](_0xf49d('0x23'),_0xf49d('0x4d'));this[_0xf49d('0x5')]('encryption',_0xf49d('0x2c'));this[_0xf49d('0x5')](_0xf49d('0x48'),_0xf49d('0x2c'));this[_0xf49d('0x5')]('force_avp',_0xf49d('0x2c'));this[_0xf49d('0x5')](_0xf49d('0x49'),_0xf49d('0x2c'));this[_0xf49d('0x5')]('dtlsenable',_0xf49d('0x2c'));this[_0xf49d('0x5')](_0xf49d('0x4e'),'no');this[_0xf49d('0x5')](_0xf49d('0x4f'),_0xf49d('0x41'));this['setDataValue'](_0xf49d('0x4a'),_0x10f297[_0xf49d('0x4a')]||_0xf49d('0x50'));this['setDataValue']('dtlsprivatekey',_0x10f297[_0xf49d('0x4b')]||_0xf49d('0x51'));this[_0xf49d('0x5')](_0xf49d('0x4c'),_0xf49d('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xf49d('0x43')],'set':function(_0x2c31c6){this[_0xf49d('0x5')]('permissions',_0x2c31c6?_0x2c31c6[_0xf49d('0x21')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0xf49d('0x22')](_0xf49d('0x52'))[_0xf49d('0x24')](','),function(_0xcddac4){return parseInt(_0xcddac4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf49d('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xf49d('0x3')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xf49d('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xf49d('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xf49d('0xd')](_0xf49d('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xf49d('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xf49d('0x22')]('phoneBarEnableScreenRecordingByAgent')?this[_0xf49d('0x22')](_0xf49d('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0xf49d('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf49d('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![],'set':function(_0xc3743b){if(typeof _0xc3743b===_0xf49d('0x54')){var _0x495855=_0xc3743b==='1'?!![]:_0xc3743b==='0'?![]:_0xc3743b===_0xf49d('0x55')?!![]:_0xc3743b==='false'?![]:![];this[_0xf49d('0x5')](_0xf49d('0x56'),_0x495855);}else{this[_0xf49d('0x5')](_0xf49d('0x56'),_0xc3743b);}}},'blocked':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![],'set':function(_0x40772c){this[_0xf49d('0x5')](_0xf49d('0x57'),_0x40772c);if(_0x40772c===!![]){this['setDataValue'](_0xf49d('0x58'),moment());this[_0xf49d('0x5')]('loginAttempts',0x0);}else{this[_0xf49d('0x5')](_0xf49d('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0xf49d('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf49d('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xf49d('0x10')](0x5)[_0xf49d('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf49d('0x13')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5bc1=['UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','local','INTEGER','accountcode','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','rfc2833','shortinfo','inband','auto','yes','nonat','update','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','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]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','update,nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts'];(function(_0x2b6b34,_0xfee69c){var _0x1189d0=function(_0x12c61c){while(--_0x12c61c){_0x2b6b34['push'](_0x2b6b34['shift']());}};_0x1189d0(++_0xfee69c);}(_0x5bc1,0xb5));var _0x15bc=function(_0x525445,_0x4f8f42){_0x525445=_0x525445-0x0;var _0x48b600=_0x5bc1[_0x525445];return _0x48b600;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x15bc('0x0'));var util=require(_0x15bc('0x1'));var _=require(_0x15bc('0x2'));module[_0x15bc('0x3')]={'name':{'type':Sequelize[_0x15bc('0x4')],'allowNull':![],'unique':_0x15bc('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5cd32c){this['setDataValue'](_0x15bc('0x5'),_0x5cd32c);this[_0x15bc('0x6')](_0x15bc('0x7'),_0x5cd32c);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x15bc('0x4')],'allowNull':![],'set':function(_0x483c6d){this[_0x15bc('0x6')](_0x15bc('0x8'),_0x483c6d);this[_0x15bc('0x6')](_0x15bc('0x9'),util[_0x15bc('0xa')](_0x15bc('0xb'),_0x483c6d,this[_0x15bc('0xc')](_0x15bc('0xd'))));}},'alias':{'type':Sequelize[_0x15bc('0x4')]},'email':{'type':Sequelize[_0x15bc('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x18b502){if(_0x18b502){this[_0x15bc('0x6')](_0x15bc('0xe'),_0x18b502['toLowerCase']());}}},'role':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x10'),_0x15bc('0x11'),_0x15bc('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x15bc('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x15bc('0x4')],'defaultValue':_0x15bc('0x13')},'internal':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':![],'unique':_0x15bc('0xd'),'set':function(_0x3f546b){this[_0x15bc('0x6')](_0x15bc('0xd'),_0x3f546b);this[_0x15bc('0x6')](_0x15bc('0x15'),_0x3f546b);this[_0x15bc('0x6')](_0x15bc('0x9'),util[_0x15bc('0xa')](_0x15bc('0xb'),this['getDataValue'](_0x15bc('0x8')),_0x3f546b));}},'salt':{'type':Sequelize[_0x15bc('0x4')]},'phone':{'type':Sequelize[_0x15bc('0x4')]},'mobile':{'type':Sequelize[_0x15bc('0x4')]},'address':{'type':Sequelize[_0x15bc('0x4')]},'zipcode':{'type':Sequelize[_0x15bc('0x4')]},'userpic':{'type':Sequelize[_0x15bc('0x4')]},'city':{'type':Sequelize[_0x15bc('0x4')]},'country':{'type':Sequelize[_0x15bc('0x4')]},'online':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x15bc('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x15bc('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x15bc('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x15bc('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x15bc('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x15bc('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x15bc('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x15bc('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x15bc('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x15bc('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![],'defaultValue':_0x15bc('0x18')},'ipaddr':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x15bc('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x19'),_0x15bc('0x11'),_0x15bc('0x1a')),'allowNull':!![],'defaultValue':_0x15bc('0x19')},'context':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x1b'),_0x15bc('0x1c'),_0x15bc('0x1d'),_0x15bc('0x1e'),_0x15bc('0x1f'),_0x15bc('0x20'),_0x15bc('0x21'),_0x15bc('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x4e78f3){this[_0x15bc('0x6')](_0x15bc('0x23'),_0x4e78f3?_0x4e78f3['join'](','):null);},'get':function(){return this['getDataValue'](_0x15bc('0x23'))?this[_0x15bc('0xc')](_0x15bc('0x23'))[_0x15bc('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x25'),'info',_0x15bc('0x26'),_0x15bc('0x27'),_0x15bc('0x28')),'allowNull':!![],'defaultValue':_0x15bc('0x25')},'directmedia':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no',_0x15bc('0x2a'),_0x15bc('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x434b5b){this['setDataValue'](_0x15bc('0x2c'),_0x434b5b?_0x434b5b[_0x15bc('0x2d')](','):null);},'get':function(){return this[_0x15bc('0xc')](_0x15bc('0x2c'))?this['getDataValue'](_0x15bc('0x2c'))[_0x15bc('0x24')](','):null;},'comment':_0x15bc('0x2e')},'callgroup':{'type':Sequelize[_0x15bc('0x4')]},'namedcallgroup':{'type':Sequelize[_0x15bc('0x4')]},'pickupgroup':{'type':Sequelize[_0x15bc('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x15bc('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x15bc('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x15bc('0x30'),'set':function(_0x51a458){this[_0x15bc('0x6')]('allow',_0x51a458?_0x51a458[_0x15bc('0x2d')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x15bc('0xc')](_0x15bc('0x31'))?this[_0x15bc('0xc')](_0x15bc('0x31'))['split'](';'):null;},'comment':_0x15bc('0x32')},'autoframing':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x2106fe){this[_0x15bc('0x6')](_0x15bc('0x33'),_0x2106fe?_0x2106fe['join'](','):null);},'get':function(){return this[_0x15bc('0xc')](_0x15bc('0x33'))?this[_0x15bc('0xc')]('insecure')['split'](','):null;},'comment':_0x15bc('0x34')},'trustrpid':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x15bc('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no',_0x15bc('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![],'defaultValue':_0x15bc('0x36')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![],'defaultValue':_0x15bc('0x29')},'busylevel':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x15bc('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x15bc('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no',_0x15bc('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x38'),_0x15bc('0x39'),_0x15bc('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x3b'),_0x15bc('0x3c')),'allowNull':!![],'defaultValue':_0x15bc('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![],'defaultValue':_0x15bc('0x29')},'keepalive':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x15bc('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x15bc('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x15bc('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x15bc('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x15bc('0xf')]('yes','no','fingerprint',_0x15bc('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x15bc('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x15bc('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x15bc('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x15bc('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x15bc('0xf')](_0x15bc('0x29'),'no',_0x15bc('0x2a'),_0x15bc('0x2b'),_0x15bc('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x15bc('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x15bc('0x17')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x15bc('0x3f')]},'showWebBar':{'type':Sequelize[_0x15bc('0x14')],'defaultValue':0x0,'set':function(_0x46c6dd){this['setDataValue'](_0x15bc('0x40'),_0x46c6dd);var _0x1271b4=this[_0x15bc('0x41')]({'plain':!![]});switch(_0x46c6dd){case 0x0:case 0x1:var _0x409e12=_0x1271b4['transport']?_[_0x15bc('0x42')](_0x1271b4[_0x15bc('0x23')])?_0x1271b4['transport'][_0x15bc('0x2d')]():_0x1271b4[_0x15bc('0x23')]:_0x15bc('0x43');if(_0x409e12===_0x15bc('0x44')){_0x409e12=_0x15bc('0x43');}this['setDataValue'](_0x15bc('0x23'),_0x409e12);this[_0x15bc('0x6')](_0x15bc('0x45'),'no');this[_0x15bc('0x6')]('avpf',null);this[_0x15bc('0x6')]('force_avp',null);this['setDataValue'](_0x15bc('0x46'),null);this[_0x15bc('0x6')](_0x15bc('0x47'),null);this[_0x15bc('0x6')](_0x15bc('0x48'),null);this[_0x15bc('0x6')](_0x15bc('0x49'),null);this[_0x15bc('0x6')](_0x15bc('0x4a'),null);this['setDataValue'](_0x15bc('0x4b'),null);this[_0x15bc('0x6')]('rtcp_mux','no');break;case 0x2:this['setDataValue']('transport',_0x15bc('0x44'));this[_0x15bc('0x6')](_0x15bc('0x45'),_0x15bc('0x29'));this[_0x15bc('0x6')]('avpf',_0x15bc('0x29'));this[_0x15bc('0x6')]('force_avp',_0x15bc('0x29'));this[_0x15bc('0x6')](_0x15bc('0x46'),_0x15bc('0x29'));this['setDataValue']('dtlsenable',_0x15bc('0x29'));this[_0x15bc('0x6')](_0x15bc('0x48'),'no');this[_0x15bc('0x6')](_0x15bc('0x49'),_0x15bc('0x4c'));this[_0x15bc('0x6')]('dtlscertfile',_0x1271b4[_0x15bc('0x4a')]||_0x15bc('0x4d'));this[_0x15bc('0x6')]('dtlsprivatekey',_0x1271b4[_0x15bc('0x4b')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x15bc('0x4e'),_0x15bc('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x15bc('0x3f')],'set':function(_0x54e1bd){this[_0x15bc('0x6')](_0x15bc('0x4f'),_0x54e1bd?_0x54e1bd[_0x15bc('0x2d')](','):[]);},'get':function(){return this[_0x15bc('0xc')](_0x15bc('0x4f'))?_[_0x15bc('0x50')](this[_0x15bc('0xc')](_0x15bc('0x4f'))[_0x15bc('0x24')](','),function(_0x504211){return parseInt(_0x504211,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x15bc('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x15bc('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x15bc('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x15bc('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x15bc('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x15bc('0xc')](_0x15bc('0x51'))?this[_0x15bc('0xc')](_0x15bc('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x15bc('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![],'set':function(_0x1ce9e8){if(typeof _0x1ce9e8===_0x15bc('0x52')){var _0x2ef50b=_0x1ce9e8==='1'?!![]:_0x1ce9e8==='0'?![]:_0x1ce9e8===_0x15bc('0x53')?!![]:_0x1ce9e8===_0x15bc('0x54')?![]:![];this[_0x15bc('0x6')]('screenrecording',_0x2ef50b);}else{this[_0x15bc('0x6')](_0x15bc('0x55'),_0x1ce9e8);}}},'blocked':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':![],'set':function(_0x61acb0){this[_0x15bc('0x6')](_0x15bc('0x56'),_0x61acb0);if(_0x61acb0===!![]){this[_0x15bc('0x6')](_0x15bc('0x57'),moment());this[_0x15bc('0x6')](_0x15bc('0x58'),0x0);}else{this[_0x15bc('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x15bc('0x14')](0x5)[_0x15bc('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x15bc('0x16')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 08d37b5..768ca86 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 _0xfa28=['$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','lastName','phone','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','iat','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','send','teams','queues','inbound','lower','col','toString','asc','desc','substring','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','ui.createdAt','_interactions','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','client','then','info','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','count','offset','limit','update','destroy','get','role','admin','user','Telephones','telephone','filter','ignore','map','includes','find','name','end','stack','index','rawAttributes','type','password','salt','value','getOptions','where','User','query','attributes','push','findAll','openTabs','rows','chat','dataValues','mail','openchannel','whatsapp','all','model','differenceBy','keys','filters','intersection','fields','length','includeAll','include','merge','options','true','sms','fax','body','params','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','QueryTypes','from','voicemail','VoiceMail','fullname','email','agent','permissions','101','102','113','110','104','106','108','109','111','114','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','settingsEnabled','userProfileId','create','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','each','Agents','isEmpty','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','penalty','toLowerCase','QueueId','emit','Queue:save','voice','VoiceQueue','online','format','SIP/%s','voicePause','UserVoiceQueueRt','removeQueues','remove','Queues','isArray','Queue:remove','addAvatar','userpic','getAvatar','root','download','server/files/images/','join','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','sort','pick','hasOwnProperty','CmList','List','Tag','Tags','tag','nolimit','getQueues','order','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','concat','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','whatsapppause','pauseType','manual','set','%s%s','getTeams','Team','addTeams','setDataValue','Voice','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','removeTeams','getChatQueues','Whatsapp','flatten','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper'];(function(_0x56a1d0,_0x16a437){var _0x5952c4=function(_0x3a4e4e){while(--_0x3a4e4e){_0x56a1d0['push'](_0x56a1d0['shift']());}};_0x5952c4(++_0x16a437);}(_0xfa28,0x1c6));var _0x8fa2=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xfa28[_0xdea41a];return _0x15d0d8;};'use strict';var moment=require(_0x8fa2('0x0'));var BPromise=require(_0x8fa2('0x1'));var util=require(_0x8fa2('0x2'));var path=require(_0x8fa2('0x3'));var fs=require('fs');var _=require(_0x8fa2('0x4'));var squel=require(_0x8fa2('0x5'));var jayson=require(_0x8fa2('0x6'));var Redis=require(_0x8fa2('0x7'));var authService=require('../../components/auth/service');var qs=require(_0x8fa2('0x8'));var logger=require(_0x8fa2('0x9'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8fa2('0xa'))['db'];var socket=require(_0x8fa2('0xb'))(new Redis(config[_0x8fa2('0xc')]));require(_0x8fa2('0xd'))['register'](socket);config[_0x8fa2('0xc')]=_[_0x8fa2('0xe')](config[_0x8fa2('0xc')],{'host':_0x8fa2('0xf'),'port':0x18eb});var client=jayson[_0x8fa2('0x10')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x5a736b,_0x24e076,_0x2200f7,_0x23ab93){return new BPromise(function(_0xd42906,_0x24170a){var _0x60a19a=_0x23ab93||client;return _0x60a19a['request'](_0x5a736b,_0x2200f7)[_0x8fa2('0x11')](function(_0xbb30a5){logger[_0x8fa2('0x12')](_0x8fa2('0x13'),_0x24e076,'request\x20sent');logger[_0x8fa2('0x14')]('User,\x20%s,\x20%s,\x20%s',_0x24e076,_0x8fa2('0x15'),JSON[_0x8fa2('0x16')](_0xbb30a5));if(_0xbb30a5[_0x8fa2('0x17')]){if(_0xbb30a5['error'][_0x8fa2('0x18')]===0x1f4){logger[_0x8fa2('0x17')](_0x8fa2('0x13'),_0x24e076,_0xbb30a5[_0x8fa2('0x17')][_0x8fa2('0x19')]);return _0x24170a(_0xbb30a5[_0x8fa2('0x17')]['message']);}logger[_0x8fa2('0x17')]('User,\x20%s,\x20%s',_0x24e076,_0xbb30a5[_0x8fa2('0x17')][_0x8fa2('0x19')]);return _0xd42906(_0xbb30a5[_0x8fa2('0x17')][_0x8fa2('0x19')]);}else{logger['info']('User,\x20%s,\x20%s',_0x24e076,_0x8fa2('0x15'));_0xd42906(_0xbb30a5[_0x8fa2('0x1a')][_0x8fa2('0x19')]);}})[_0x8fa2('0x1b')](function(_0x56624a){logger[_0x8fa2('0x17')](_0x8fa2('0x13'),_0x24e076,_0x56624a);_0x24170a(_0x56624a);});});}function respondWithStatusCode(_0x535987,_0xb038cd){_0xb038cd=_0xb038cd||0xcc;return function(_0xd3c700){if(_0xd3c700){return _0x535987['sendStatus'](_0xb038cd);}return _0x535987['status'](_0xb038cd)['end']();};}function respondWithResult(_0xa590cb,_0x265a56){_0x265a56=_0x265a56||0xc8;return function(_0x2ac1fa){if(_0x2ac1fa){return _0xa590cb[_0x8fa2('0x1c')](_0x265a56)[_0x8fa2('0x1d')](_0x2ac1fa);}};}function respondWithFilteredResult(_0x4cf7d4,_0x3f5769){return function(_0x30fe69){if(_0x30fe69){var _0x54bac0=typeof _0x3f5769['offset']==='undefined'&&typeof _0x3f5769['limit']===_0x8fa2('0x1e');var _0x2a9b83=_0x30fe69[_0x8fa2('0x1f')];var _0x5c2c08=_0x54bac0?0x0:_0x3f5769[_0x8fa2('0x20')];var _0x3aafaf=_0x54bac0?_0x30fe69[_0x8fa2('0x1f')]:_0x3f5769[_0x8fa2('0x20')]+_0x3f5769[_0x8fa2('0x21')];var _0x52909b;if(_0x3aafaf>=_0x2a9b83){_0x3aafaf=_0x2a9b83;_0x52909b=0xc8;}else{_0x52909b=0xce;}_0x4cf7d4[_0x8fa2('0x1c')](_0x52909b);return _0x4cf7d4['set']('Content-Range',_0x5c2c08+'-'+_0x3aafaf+'/'+_0x2a9b83)[_0x8fa2('0x1d')](_0x30fe69);}return null;};}function saveUpdates(_0x3808e3){return function(_0x42baf8){if(_0x42baf8){return _0x42baf8[_0x8fa2('0x22')](_0x3808e3)[_0x8fa2('0x11')](function(_0x5ddd54){return _0x5ddd54;});}return null;};}function removeEntity(_0x408aa0){return function(_0x1ea3f1){if(_0x1ea3f1){return _0x1ea3f1[_0x8fa2('0x23')]()[_0x8fa2('0x11')](function(){var _0x4e862a=_0x1ea3f1[_0x8fa2('0x24')]({'plain':!![]});if(_0x4e862a[_0x8fa2('0x25')]===_0x8fa2('0x26'))return;var _0xbe2473=[{'name':'Users','value':_0x8fa2('0x27'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x8fa2('0x28'),'value':_0x8fa2('0x29'),'ignore':![]}];var _0x6d1e08=_(_0xbe2473)[_0x8fa2('0x2a')](_0x8fa2('0x2b'))[_0x8fa2('0x2c')]('value')['value']();if(_[_0x8fa2('0x2d')](_0x6d1e08,_0x4e862a[_0x8fa2('0x25')])){return;}var _0x563d94=_[_0x8fa2('0x2e')](_0xbe2473,['value',_0x4e862a[_0x8fa2('0x25')]])[_0x8fa2('0x2f')];return db['UserProfileResource']['destroy']({'where':{'type':_0x563d94,'resourceId':_0x4e862a['id']}})['then'](function(){return _0x1ea3f1;});})[_0x8fa2('0x11')](function(){_0x408aa0[_0x8fa2('0x1c')](0xcc)[_0x8fa2('0x30')]();});}};}function handleEntityNotFound(_0x2130a5){return function(_0x37e73d){if(!_0x37e73d){_0x2130a5['sendStatus'](0x194);}return _0x37e73d;};}function handleError(_0x43adf1,_0x496051){_0x496051=_0x496051||0x1f4;return function(_0x4b5a30){logger[_0x8fa2('0x17')](_0x4b5a30[_0x8fa2('0x31')]);if(_0x4b5a30[_0x8fa2('0x2f')]){delete _0x4b5a30[_0x8fa2('0x2f')];}_0x43adf1['status'](_0x496051)['send'](_0x4b5a30);};}exports[_0x8fa2('0x32')]=function(_0x4c282e,_0x296a15){var _0x4e26ca={},_0x50f3f8={'count':0x0,'rows':[]};var _0x398d7a=_(db['User'][_0x8fa2('0x33')])[_0x8fa2('0x2c')](function(_0x5733c0){return{'name':_0x5733c0['fieldName'],'type':_0x5733c0[_0x8fa2('0x34')]['key']};})['filter'](function(_0x595203){return!_[_0x8fa2('0x2d')]([_0x8fa2('0x35'),_0x8fa2('0x36')],_0x595203[_0x8fa2('0x2f')]);})[_0x8fa2('0x37')]();_0x4e26ca=qs[_0x8fa2('0x38')](_0x398d7a,_0x4c282e);var _0x479152={'where':_0x4e26ca[_0x8fa2('0x39')]};return db[_0x8fa2('0x3a')][_0x8fa2('0x1f')](_0x479152)[_0x8fa2('0x11')](function(_0x53208c){_0x50f3f8[_0x8fa2('0x1f')]=_0x53208c;if(_0x4c282e[_0x8fa2('0x3b')]['includeAll']){_0x4e26ca['include']=[{'all':!![]}];}if(!_[_0x8fa2('0x2d')](_0x4e26ca[_0x8fa2('0x3c')],'id')){_0x4e26ca['attributes'][_0x8fa2('0x3d')]('id');}return db['User'][_0x8fa2('0x3e')](_0x4e26ca);})[_0x8fa2('0x11')](function(_0x4beeba){_0x50f3f8['rows']=_0x4beeba;if(_0x4c282e['query'][_0x8fa2('0x3f')]==='true'){var _0x58827d=[];for(var _0x3cf69b=0x0;_0x3cf69b<_0x50f3f8[_0x8fa2('0x40')]['length'];_0x3cf69b++){_0x58827d[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x41'),_0x50f3f8[_0x8fa2('0x40')][_0x3cf69b][_0x8fa2('0x42')]));_0x58827d['push'](get_open_tabs('sms',_0x50f3f8[_0x8fa2('0x40')][_0x3cf69b][_0x8fa2('0x42')]));_0x58827d[_0x8fa2('0x3d')](get_open_tabs('fax',_0x50f3f8[_0x8fa2('0x40')][_0x3cf69b][_0x8fa2('0x42')]));_0x58827d[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x43'),_0x50f3f8[_0x8fa2('0x40')][_0x3cf69b][_0x8fa2('0x42')]));_0x58827d[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x44'),_0x50f3f8[_0x8fa2('0x40')][_0x3cf69b][_0x8fa2('0x42')]));_0x58827d[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x45'),_0x50f3f8[_0x8fa2('0x40')][_0x3cf69b][_0x8fa2('0x42')]));}return BPromise[_0x8fa2('0x46')](_0x58827d)[_0x8fa2('0x11')](function(_0xdc0e83){return _0x50f3f8;});}else{return _0x50f3f8;}})['then'](respondWithFilteredResult(_0x296a15,_0x4e26ca))[_0x8fa2('0x1b')](handleError(_0x296a15,null));};exports['show']=function(_0x2e96aa,_0x2ce83c){var _0x225f9a={'raw':![],'where':{'id':_0x2e96aa['params']['id']}},_0x4ea128={};_0x4ea128[_0x8fa2('0x47')]=_[_0x8fa2('0x48')](_[_0x8fa2('0x49')](db[_0x8fa2('0x3a')][_0x8fa2('0x33')]),[_0x8fa2('0x35'),_0x8fa2('0x36')]);_0x4ea128[_0x8fa2('0x3b')]=_['keys'](_0x2e96aa[_0x8fa2('0x3b')]);_0x4ea128[_0x8fa2('0x4a')]=_[_0x8fa2('0x4b')](_0x4ea128[_0x8fa2('0x47')],_0x4ea128['query']);_0x225f9a[_0x8fa2('0x3c')]=_[_0x8fa2('0x4b')](_0x4ea128[_0x8fa2('0x47')],qs[_0x8fa2('0x4c')](_0x2e96aa[_0x8fa2('0x3b')]['fields']));_0x225f9a[_0x8fa2('0x3c')]=_0x225f9a['attributes'][_0x8fa2('0x4d')]?_0x225f9a[_0x8fa2('0x3c')]:_0x4ea128['model'];if(_0x2e96aa[_0x8fa2('0x3b')][_0x8fa2('0x4e')]){_0x225f9a[_0x8fa2('0x4f')]=[{'all':!![]}];}_0x225f9a=_[_0x8fa2('0x50')]({},_0x225f9a,_0x2e96aa[_0x8fa2('0x51')]);if(!_[_0x8fa2('0x2d')](_0x225f9a[_0x8fa2('0x3c')],'id')){_0x225f9a[_0x8fa2('0x3c')][_0x8fa2('0x3d')]('id');}return db[_0x8fa2('0x3a')][_0x8fa2('0x2e')](_0x225f9a)['then'](handleEntityNotFound(_0x2ce83c,null))[_0x8fa2('0x11')](function(_0x224af2){var _0xee4a6c=[];values=_0x224af2;if(_0x2e96aa['query']['openTabs']===_0x8fa2('0x52')){_0xee4a6c['push'](get_open_tabs(_0x8fa2('0x41'),_0x224af2['dataValues']));_0xee4a6c['push'](get_open_tabs(_0x8fa2('0x53'),_0x224af2[_0x8fa2('0x42')]));_0xee4a6c[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x44'),_0x224af2['dataValues']));_0xee4a6c[_0x8fa2('0x3d')](get_open_tabs('whatsapp',_0x224af2['dataValues']));_0xee4a6c[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x54'),_0x224af2[_0x8fa2('0x42')]));_0xee4a6c[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x43'),_0x224af2[_0x8fa2('0x42')]));return BPromise[_0x8fa2('0x46')](_0xee4a6c);}else{return values;}})[_0x8fa2('0x11')](function(_0x3cc4c5){return values;})[_0x8fa2('0x11')](respondWithResult(_0x2ce83c,null))[_0x8fa2('0x1b')](handleError(_0x2ce83c,null));};exports[_0x8fa2('0x22')]=function(_0x2c5fb0,_0x192983){if(_0x2c5fb0[_0x8fa2('0x55')]['id']){delete _0x2c5fb0[_0x8fa2('0x55')]['id'];}delete _0x2c5fb0[_0x8fa2('0x55')][_0x8fa2('0x25')];return db[_0x8fa2('0x3a')][_0x8fa2('0x2e')]({'where':{'id':_0x2c5fb0[_0x8fa2('0x56')]['id']}})[_0x8fa2('0x11')](handleEntityNotFound(_0x192983,null))[_0x8fa2('0x11')](saveUpdates(_0x2c5fb0[_0x8fa2('0x55')],null))[_0x8fa2('0x11')](respondWithResult(_0x192983,null))[_0x8fa2('0x1b')](handleError(_0x192983,null));};exports[_0x8fa2('0x57')]=function(_0x4b5184,_0x506dd0){return db['User']['describe']()['then'](respondWithResult(_0x506dd0,null))[_0x8fa2('0x1b')](handleError(_0x506dd0,null));};exports[_0x8fa2('0x58')]=function(_0x3f3553,_0x39f32d){return db['User']['find']({'where':{'id':_0x3f3553[_0x8fa2('0x56')]['id']}})[_0x8fa2('0x11')](handleEntityNotFound(_0x39f32d,null))[_0x8fa2('0x11')](function(_0x3eddbf){if(_0x3eddbf){return _0x3eddbf[_0x8fa2('0x58')](_0x3f3553['body'][_0x8fa2('0x59')],_[_0x8fa2('0x5a')](_0x3f3553[_0x8fa2('0x55')],['ids','id'])||{});}})[_0x8fa2('0x11')](respondWithResult(_0x39f32d,null))['catch'](handleError(_0x39f32d,null));};function validateUser(_0xde2735){return new BPromise(function(_0xa7d2c0,_0xe38cc3){if(_0xde2735[_0x8fa2('0x5b')])return _0xa7d2c0(_0xde2735);return db[_0x8fa2('0x5c')]['findById'](0x1)[_0x8fa2('0x11')](function(_0x5340a0){if(_0x5340a0[_0x8fa2('0x5d')])authService[_0x8fa2('0x5e')](_0xde2735['password']);db[_0x8fa2('0x3a')][_0x8fa2('0x5f')](_0x8fa2('0x5b'))['then'](function(_0x41eeab){if(_[_0x8fa2('0x60')](_0x41eeab)){_0xde2735[_0x8fa2('0x5b')]=_0x5340a0['min_internal']||0x1;return;}if(_[_0x8fa2('0x60')](_0x5340a0['min_internal'])||_0x5340a0[_0x8fa2('0x61')]===_0x41eeab){_0xde2735['internal']=_0x41eeab+0x1;return;}if(_0x5340a0[_0x8fa2('0x61')]>_0x41eeab){_0xde2735[_0x8fa2('0x5b')]=_0x5340a0[_0x8fa2('0x61')];return;}return db[_0x8fa2('0x62')][_0x8fa2('0x3b')]('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[_0x8fa2('0x62')][_0x8fa2('0x63')]['SELECT']})['then'](function(_0x162eeb){if(_0x162eeb&&_0x162eeb[_0x8fa2('0x4d')]){for(var _0x5ec894=0x0,_0x237f68=_0x162eeb['length'];_0x5ec894<_0x237f68&&_[_0x8fa2('0x60')](_0xde2735[_0x8fa2('0x5b')]);_0x5ec894++){if(_0x5340a0[_0x8fa2('0x61')]<=_0x162eeb[_0x5ec894][_0x8fa2('0x64')]){_0xde2735[_0x8fa2('0x5b')]=_0x162eeb[_0x5ec894][_0x8fa2('0x64')];}else if(_0x5340a0[_0x8fa2('0x61')]>_0x162eeb[_0x5ec894][_0x8fa2('0x64')]&&_0x5340a0['min_internal']<=_0x162eeb[_0x5ec894]['to']){_0xde2735[_0x8fa2('0x5b')]=_0x5340a0['min_internal'];}}}if(_[_0x8fa2('0x60')](_0xde2735[_0x8fa2('0x5b')])){_0xde2735[_0x8fa2('0x5b')]=_0x41eeab+0x1;}return _0xa7d2c0(_0xde2735);});});})[_0x8fa2('0x1b')](function(_0x5a3a98){_0xe38cc3(_0x5a3a98);});});}function updateUser(_0x2636a1){return new BPromise(function(_0x437173,_0x3f0959){try{if(_0x2636a1[_0x8fa2('0x65')]){_0x2636a1['mailbox']=_0x2636a1[_0x8fa2('0x5b')];_0x2636a1[_0x8fa2('0x66')]={'mailbox':_0x2636a1[_0x8fa2('0x5b')],'password':_0x2636a1['password'],'fullname':_0x2636a1[_0x8fa2('0x67')],'email':_0x2636a1[_0x8fa2('0x68')]};}if(_0x2636a1[_0x8fa2('0x25')]===_0x8fa2('0x69')){if(!_0x2636a1[_0x8fa2('0x6a')])_0x2636a1[_0x8fa2('0x6a')]=[_0x8fa2('0x6b'),_0x8fa2('0x6c'),'103',_0x8fa2('0x6d'),_0x8fa2('0x6e'),_0x8fa2('0x6f'),'105',_0x8fa2('0x70'),'107',_0x8fa2('0x71'),_0x8fa2('0x72'),'100',_0x8fa2('0x73'),_0x8fa2('0x74'),'115'];}_0x437173(_0x2636a1);}catch(_0x341526){_0x3f0959(_0x341526);}});}exports['create']=function(_0x425dac,_0x43348f){if(_0x425dac['user'][_0x8fa2('0x25')]===_0x8fa2('0x69'))throw new Error('Unauthorized');if(_0x425dac[_0x8fa2('0x55')][_0x8fa2('0x25')]===_0x8fa2('0x27')&&_0x425dac[_0x8fa2('0x27')]['role']!==_0x8fa2('0x26')){throw new Error(_0x8fa2('0x75'));}if(_0x425dac[_0x8fa2('0x55')]['role']===_0x8fa2('0x26')&&_0x425dac[_0x8fa2('0x27')]['role']!==_0x8fa2('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x425dac[_0x8fa2('0x55')]])['then'](function(){return validateUser(_0x425dac[_0x8fa2('0x55')]);})[_0x8fa2('0x11')](function(_0x2eb563){return updateUser(_0x2eb563)['then'](function(_0x30c0c2){if(_0x30c0c2[_0x8fa2('0x25')]===_0x8fa2('0x26')){_0x30c0c2[_0x8fa2('0x76')]=_0x425dac[_0x8fa2('0x27')][_0x8fa2('0x76')];delete _0x30c0c2[_0x8fa2('0x77')];}return _0x30c0c2;});})[_0x8fa2('0x11')](function(_0x1e825c){return db['User'][_0x8fa2('0x78')](_0x1e825c,{'include':[{'model':db[_0x8fa2('0x66')],'as':_0x8fa2('0x66')}]});})[_0x8fa2('0x11')](function(_0x55e207){if(_0x425dac[_0x8fa2('0x55')][_0x8fa2('0x25')]===_0x8fa2('0x27'))return _0x55e207;if(_0x425dac[_0x8fa2('0x27')][_0x8fa2('0x25')]!==_0x8fa2('0x27'))return _0x55e207;return db[_0x8fa2('0x79')]['find']({'where':{'name':_0x55e207['role']===_0x8fa2('0x69')?'Agents':'Telephones','userProfileId':_0x425dac[_0x8fa2('0x27')][_0x8fa2('0x77')]},'raw':!![]})[_0x8fa2('0x11')](function(_0x4c7a61){if(!_0x4c7a61||_0x4c7a61[_0x8fa2('0x7a')]!=0x0)return _0x55e207;return db[_0x8fa2('0x7b')][_0x8fa2('0x78')]({'name':_0x55e207[_0x8fa2('0x2f')],'resourceId':_0x55e207['id'],'type':_0x4c7a61[_0x8fa2('0x2f')],'sectionId':_0x4c7a61['id']},{})[_0x8fa2('0x11')](function(){return _0x55e207;});})[_0x8fa2('0x1b')](function(_0x2531d7){logger[_0x8fa2('0x17')](_0x8fa2('0x7c'),_0x2531d7);throw _0x2531d7;});})[_0x8fa2('0x11')](respondWithResult(_0x43348f,0xc9))[_0x8fa2('0x1b')](handleError(_0x43348f,null));};exports['bulkCreate']=function(_0x3a4ec6,_0x163409){var _0x2a0926=_0x3a4ec6['body'];var _0x102dfe=[];if(_0x3a4ec6['user']['role']===_0x8fa2('0x69'))throw new Error(_0x8fa2('0x7d'));if(_[_0x8fa2('0x7e')](_0x2a0926,[_0x8fa2('0x25'),'user'])&&_0x3a4ec6[_0x8fa2('0x27')][_0x8fa2('0x25')]!==_0x8fa2('0x26')){throw new Error(_0x8fa2('0x75'));}if(_['some'](_0x2a0926,[_0x8fa2('0x25'),_0x8fa2('0x26')])&&_0x3a4ec6['user']['role']!==_0x8fa2('0x26')){throw new Error(_0x8fa2('0x7f'));}return licenseUtil[_0x8fa2('0x80')](_0x2a0926)[_0x8fa2('0x11')](function(){return validateUser(_0x2a0926[0x0]);})[_0x8fa2('0x11')](function(){for(var _0x39c612=0x1;_0x39c612<_0x2a0926['length'];_0x39c612++){var _0x3da1a8=_0x2a0926[_0x39c612-0x1]['internal'];if(!_0x2a0926[_0x39c612]['internal'])_0x2a0926[_0x39c612][_0x8fa2('0x5b')]=_0x3da1a8+0x1;_0x102dfe[_0x8fa2('0x3d')](validateUser(_0x2a0926[_0x39c612]));}return BPromise['all'](_0x102dfe);})['then'](function(){_0x102dfe=[];for(var _0x3690c8=0x0;_0x3690c8<_0x2a0926['length'];_0x3690c8++){_0x102dfe[_0x8fa2('0x3d')](updateUser(_0x2a0926[_0x3690c8]));}return BPromise[_0x8fa2('0x46')](_0x102dfe);})['then'](function(){return BPromise[_0x8fa2('0x81')](_0x2a0926,function(_0x3ff299){return db[_0x8fa2('0x3a')][_0x8fa2('0x78')](_0x3ff299,{'include':[{'model':db[_0x8fa2('0x66')],'as':'VoiceMail'}]})[_0x8fa2('0x11')](function(_0x3cb467){_0x3ff299['id']=_0x3cb467['id'];return _0x3ff299;});});})[_0x8fa2('0x11')](function(_0xc896ee){if(_0x3a4ec6[_0x8fa2('0x55')][_0x8fa2('0x25')]===_0x8fa2('0x27'))return _0xc896ee;if(_0x3a4ec6[_0x8fa2('0x27')][_0x8fa2('0x25')]!==_0x8fa2('0x27'))return _0xc896ee;var _0x3dd716=_[_0x8fa2('0x7e')](_0xc896ee,function(_0x3494a4){return _0x3494a4[_0x8fa2('0x25')]===_0x8fa2('0x69')||_0x3494a4[_0x8fa2('0x25')]===_0x8fa2('0x29');});if(!_0x3dd716)return _0xc896ee;return db[_0x8fa2('0x79')][_0x8fa2('0x3e')]({'where':{'name':{'$or':[_0x8fa2('0x82'),_0x8fa2('0x28')]},'userProfileId':_0x3a4ec6[_0x8fa2('0x27')]['userProfileId']},'raw':!![]})['then'](function(_0x1713f2){if(_[_0x8fa2('0x83')](_0x1713f2)||!_[_0x8fa2('0x7e')](_0x1713f2,['autoAssociation',0x0]))return _0xc896ee;_0x102dfe=[];var _0x44405d=_(_0x1713f2)[_0x8fa2('0x2c')](function(_0x42831c){if(_0x42831c[_0x8fa2('0x7a')]===0x1)return;return _0x42831c[_0x8fa2('0x2f')]===_0x8fa2('0x82')?_0x8fa2('0x69'):_0x8fa2('0x29');})['compact']()['value']();for(var _0x4efb34=0x0;_0x4efb34<_0xc896ee[_0x8fa2('0x4d')];_0x4efb34++){if(!_[_0x8fa2('0x2d')](_0x44405d,_0xc896ee[_0x4efb34]['role']))return;var _0x1f14cc=_0xc896ee[_0x4efb34][_0x8fa2('0x25')]===_0x8fa2('0x69')?_0x8fa2('0x82'):_0x8fa2('0x28');_0x102dfe[_0x8fa2('0x3d')](db['UserProfileResource']['create']({'name':_0xc896ee[_0x4efb34]['name'],'resourceId':_0xc896ee[_0x4efb34]['id'],'type':_0x1f14cc,'sectionId':_[_0x8fa2('0x2e')](_0x1713f2,[_0x8fa2('0x2f'),_0x1f14cc])['id']},{}));}return BPromise[_0x8fa2('0x46')](_0x102dfe);});})['then'](respondWithResult(_0x163409,0xc9))[_0x8fa2('0x1b')](handleError(_0x163409,null));};exports[_0x8fa2('0x84')]=function(_0x44a9cb,_0xa70b3d){if(_0x44a9cb[_0x8fa2('0x55')]['id']){delete _0x44a9cb['body']['id'];}return db[_0x8fa2('0x3a')][_0x8fa2('0x2e')]({'where':{'id':_0x44a9cb[_0x8fa2('0x56')]['id']}})['then'](function(_0x1f8870){if(!_0x1f8870)return null;if(_0x1f8870['id']===_0x44a9cb['user']['id']){if(!_0x44a9cb['body'][_0x8fa2('0x85')]||!_0x44a9cb['body'][_0x8fa2('0x86')]){throw new db[(_0x8fa2('0x87'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x1f8870['authenticate'](_0x44a9cb[_0x8fa2('0x55')]['oldPassword'])){throw new db[(_0x8fa2('0x87'))][(_0x8fa2('0x88'))](_0x8fa2('0x89'));}if(_0x44a9cb['body'][_0x8fa2('0x85')]===_0x44a9cb[_0x8fa2('0x55')][_0x8fa2('0x86')]){throw new db['Sequelize'][(_0x8fa2('0x88'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x44a9cb[_0x8fa2('0x27')][_0x8fa2('0x25')]===_0x8fa2('0x26')){if(!_0x44a9cb[_0x8fa2('0x55')][_0x8fa2('0x86')]){throw new db[(_0x8fa2('0x87'))][(_0x8fa2('0x88'))](_0x8fa2('0x8a'));}}else if(_0x44a9cb[_0x8fa2('0x27')][_0x8fa2('0x25')]===_0x8fa2('0x27')){if(!_0x44a9cb[_0x8fa2('0x55')]['newPassword']){throw new db[(_0x8fa2('0x87'))][(_0x8fa2('0x88'))](_0x8fa2('0x8a'));}if(_0x1f8870[_0x8fa2('0x25')]!==_0x8fa2('0x69')){throw new db[(_0x8fa2('0x87'))][(_0x8fa2('0x88'))]('Unauthorized');}}else{throw new db[(_0x8fa2('0x87'))][(_0x8fa2('0x88'))](_0x8fa2('0x7d'));}return _0x1f8870;})['then'](handleEntityNotFound(_0xa70b3d,null))[_0x8fa2('0x11')](function(_0x423bf2){return db['Setting'][_0x8fa2('0x8b')]({'attributes':['id',_0x8fa2('0x5d'),_0x8fa2('0x8c'),'passwordHistoryLimit']})[_0x8fa2('0x11')](function(_0x12cb33){if(_0x12cb33[_0x8fa2('0x5d')])authService[_0x8fa2('0x5e')](_0x44a9cb['body'][_0x8fa2('0x86')]);if(!_0x12cb33[_0x8fa2('0x8c')]||!_0x423bf2['previousPasswords'])return _0x423bf2;authService[_0x8fa2('0x8d')](_0x44a9cb[_0x8fa2('0x55')][_0x8fa2('0x86')],_0x423bf2[_0x8fa2('0x8e')],_0x12cb33[_0x8fa2('0x8f')]);return _0x423bf2;})[_0x8fa2('0x11')](saveUpdates({'password':_0x44a9cb[_0x8fa2('0x55')][_0x8fa2('0x86')],'passwordResetAt':_0x44a9cb[_0x8fa2('0x27')]['id']==_0x44a9cb[_0x8fa2('0x56')]['id']?moment():null,'previousPasswords':authService[_0x8fa2('0x90')](_0x44a9cb[_0x8fa2('0x55')][_0x8fa2('0x86')],_0x423bf2[_0x8fa2('0x8e')])},null));})[_0x8fa2('0x11')](respondWithResult(_0xa70b3d,null))[_0x8fa2('0x1b')](handleError(_0xa70b3d,null));};exports[_0x8fa2('0x91')]=function(_0x4845f9,_0x3e39f3){var _0x4a4ddd=_0x4845f9[_0x8fa2('0x55')][_0x8fa2('0x92')];return db[_0x8fa2('0x3a')][_0x8fa2('0x2e')]({'where':{'id':_0x4845f9[_0x8fa2('0x56')]['id']},'attributes':['id',_0x8fa2('0x2f'),_0x8fa2('0x25'),'online',_0x8fa2('0x93'),'voicePause',_0x8fa2('0x94')]})['then'](handleEntityNotFound(_0x3e39f3,null))['then'](function(_0x35b867){if(_0x35b867){if(!utils[_0x8fa2('0x95')](_0x4a4ddd)){throw new db[(_0x8fa2('0x87'))][(_0x8fa2('0x88'))](_0x8fa2('0x96'));}return _0x35b867[_0x8fa2('0x97')+_[_0x8fa2('0x98')](_0x4a4ddd['toLowerCase']())+'Queues'](_0x4845f9[_0x8fa2('0x55')][_0x8fa2('0x59')],{'penalty':_0x4845f9['body'][_0x8fa2('0x99')]||0x0})['spread'](function(_0x16b7af){for(var _0xd061c5=0x0;_0xd061c5<_0x4845f9[_0x8fa2('0x55')][_0x8fa2('0x59')][_0x8fa2('0x4d')];_0xd061c5+=0x1){var _0x3de787={'UserId':Number(_0x4845f9[_0x8fa2('0x56')]['id'])};_0x3de787[_[_0x8fa2('0x98')](_0x4a4ddd[_0x8fa2('0x9a')]())+_0x8fa2('0x9b')]=Number(_0x4845f9[_0x8fa2('0x55')][_0x8fa2('0x59')][_0xd061c5]);socket[_0x8fa2('0x9c')](_0x8fa2('0x27')+_[_0x8fa2('0x98')](_0x4a4ddd[_0x8fa2('0x9a')]())+_0x8fa2('0x9d'),_0x3de787);}return _0x16b7af;})['then'](function(){if(_0x4a4ddd===_0x8fa2('0x9e')){return db[_0x8fa2('0x9f')][_0x8fa2('0x3e')]({'where':{'id':_0x4845f9['body'][_0x8fa2('0x59')]||[]},'raw':!![],'attributes':['id',_0x8fa2('0x2f')]});}})[_0x8fa2('0x11')](function(_0x32b9b6){var _0x1919f7=_0x35b867[_0x8fa2('0x24')]({'plain':!![]});var _0x11eb73=[];if(_0x4a4ddd===_0x8fa2('0x9e')&&_0x1919f7[_0x8fa2('0x25')]===_0x8fa2('0x69')&&_0x1919f7[_0x8fa2('0xa0')]){for(var _0x26f702=0x0;_0x26f702<_0x32b9b6['length'];_0x26f702+=0x1){_0x11eb73[_0x8fa2('0x3d')]({'membername':_0x1919f7[_0x8fa2('0x2f')],'UserId':_0x1919f7['id'],'queue_name':_0x32b9b6[_0x26f702][_0x8fa2('0x2f')],'VoiceQueueId':_0x32b9b6[_0x26f702]['id'],'interface':_[_0x8fa2('0x60')](_0x1919f7['interface'])?util[_0x8fa2('0xa1')](_0x8fa2('0xa2'),_0x1919f7[_0x8fa2('0x2f')]):_0x1919f7['interface'],'paused':_0x1919f7[_0x8fa2('0xa3')]||![],'penalty':_0x4845f9['body'][_0x8fa2('0x99')]||0x0});}return BPromise[_0x8fa2('0x81')](_0x11eb73,function(_0x54bf44){return db[_0x8fa2('0xa4')]['upsert'](_0x54bf44);});}return _0x35b867;});}})['then'](respondWithStatusCode(_0x3e39f3,null))[_0x8fa2('0x1b')](handleError(_0x3e39f3,null));};exports[_0x8fa2('0xa5')]=function(_0x242b23,_0x3aeb81){var _0x5924a2;return db[_0x8fa2('0x3a')][_0x8fa2('0x2e')]({'where':{'id':_0x242b23[_0x8fa2('0x56')]['id']},'attributes':['id',_0x8fa2('0x2f'),_0x8fa2('0x25')]})[_0x8fa2('0x11')](handleEntityNotFound(_0x3aeb81,null))['then'](function(_0x506727){if(_0x506727){_0x5924a2=_0x506727;if(!_0x242b23[_0x8fa2('0x3b')][_0x8fa2('0x92')]||!utils[_0x8fa2('0x95')](_0x242b23[_0x8fa2('0x3b')][_0x8fa2('0x92')])){throw new db['Sequelize']['ValidationError'](_0x8fa2('0x96'));}return _0x506727[_0x8fa2('0xa6')+_['capitalize'](_0x242b23[_0x8fa2('0x3b')][_0x8fa2('0x92')]['toLowerCase']())+_0x8fa2('0xa7')](_0x242b23[_0x8fa2('0x3b')]['ids']);}})[_0x8fa2('0x11')](function(_0x4cda1a){if(_[_0x8fa2('0xa8')](_0x242b23['query'][_0x8fa2('0x59')])){for(var _0x3982d5=0x0;_0x3982d5<_0x242b23['query'][_0x8fa2('0x59')][_0x8fa2('0x4d')];_0x3982d5+=0x1){var _0x59b818={'UserId':Number(_0x242b23['params']['id'])};_0x59b818[_['capitalize'](_0x242b23[_0x8fa2('0x3b')]['channel'][_0x8fa2('0x9a')]())+_0x8fa2('0x9b')]=Number(_0x242b23[_0x8fa2('0x3b')][_0x8fa2('0x59')][_0x3982d5]);socket[_0x8fa2('0x9c')]('user'+_[_0x8fa2('0x98')](_0x242b23[_0x8fa2('0x3b')][_0x8fa2('0x92')][_0x8fa2('0x9a')]())+_0x8fa2('0xa9'),_0x59b818);}}else{var _0x59b818={'UserId':Number(_0x242b23[_0x8fa2('0x56')]['id'])};_0x59b818[_[_0x8fa2('0x98')](_0x242b23['query'][_0x8fa2('0x92')][_0x8fa2('0x9a')]())+_0x8fa2('0x9b')]=Number(_0x242b23['query']['ids']);socket[_0x8fa2('0x9c')](_0x8fa2('0x27')+_['capitalize'](_0x242b23['query'][_0x8fa2('0x92')][_0x8fa2('0x9a')]())+_0x8fa2('0xa9'),_0x59b818);}return _0x4cda1a;})['then'](function(){if(_0x242b23['query'][_0x8fa2('0x92')]===_0x8fa2('0x9e')){return db[_0x8fa2('0xa4')][_0x8fa2('0x23')]({'where':{'UserId':_0x242b23[_0x8fa2('0x56')]['id'],'VoiceQueueId':_0x242b23[_0x8fa2('0x3b')][_0x8fa2('0x59')]},'individualHooks':!![]})['then'](function(){return _0x5924a2;});}return _0x5924a2;})[_0x8fa2('0x11')](respondWithStatusCode(_0x3aeb81,null))[_0x8fa2('0x1b')](handleError(_0x3aeb81,null));};exports[_0x8fa2('0xaa')]=function(_0x23625f,_0x1ca11e){_0x23625f[_0x8fa2('0x55')][_0x8fa2('0xab')]=_0x23625f['file']['filename'];return db[_0x8fa2('0x3a')]['find']({'where':{'id':_0x23625f[_0x8fa2('0x56')]['id']}})[_0x8fa2('0x11')](handleEntityNotFound(_0x1ca11e,null))[_0x8fa2('0x11')](saveUpdates(_0x23625f[_0x8fa2('0x55')],null))['then'](respondWithResult(_0x1ca11e,null))[_0x8fa2('0x1b')](handleError(_0x1ca11e,null));};exports[_0x8fa2('0xac')]=function(_0x4aceef,_0x4ff431){var _0x1d688d=path['join'](config[_0x8fa2('0xad')],'server/files/images/logos/default_profile.png');return db[_0x8fa2('0x3a')][_0x8fa2('0x2e')]({'where':{'id':_0x4aceef[_0x8fa2('0x56')]['id']},'attributes':['id',_0x8fa2('0xab')],'raw':!![]})['then'](handleEntityNotFound(_0x4ff431,null))[_0x8fa2('0x11')](function(_0x119611){if(_0x119611){if(_[_0x8fa2('0x60')](_0x119611['userpic'])){return _0x4ff431[_0x8fa2('0xae')](_0x1d688d);}else{if(!fs['existsSync'](path['join'](config[_0x8fa2('0xad')],_0x8fa2('0xaf'),_0x119611[_0x8fa2('0xab')]))){return _0x4ff431[_0x8fa2('0xae')](_0x1d688d);}return _0x4ff431[_0x8fa2('0xae')](path[_0x8fa2('0xb0')](config[_0x8fa2('0xad')],_0x8fa2('0xaf'),_0x119611[_0x8fa2('0xab')]));}}})[_0x8fa2('0x1b')](handleError(_0x4ff431,null));};exports[_0x8fa2('0xb1')]=function(_0x8fa492,_0x210bfd){return db['User'][_0x8fa2('0x2e')]({'where':{'id':_0x8fa492[_0x8fa2('0x56')]['id']},'attributes':['id']})[_0x8fa2('0x11')](handleEntityNotFound(_0x210bfd,null))[_0x8fa2('0x11')](function(_0x3c3fdd){var _0xdc118=[];values=_0x3c3fdd['dataValues'];_0xdc118[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x41'),_0x3c3fdd['dataValues']));_0xdc118[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x53'),_0x3c3fdd[_0x8fa2('0x42')]));_0xdc118[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x44'),_0x3c3fdd[_0x8fa2('0x42')]));_0xdc118[_0x8fa2('0x3d')](get_open_tabs('whatsapp',_0x3c3fdd['dataValues']));_0xdc118[_0x8fa2('0x3d')](get_open_tabs(_0x8fa2('0x54'),_0x3c3fdd['dataValues']));_0xdc118['push'](get_open_tabs(_0x8fa2('0x43'),_0x3c3fdd['dataValues']));return BPromise[_0x8fa2('0x46')](_0xdc118);})[_0x8fa2('0x11')](function(_0x4b8d50){var _0x533ba4=[];if(_0x4b8d50){for(var _0x201df0=0x0;_0x201df0=_0x3304ec){_0x2081f6=_0x3304ec;_0x341495=0xc8;}else{_0x341495=0xce;}_0x151905[_0xf6f2('0x1e')](_0x341495);return _0x151905[_0xf6f2('0x24')](_0xf6f2('0x25'),_0x5dac6a+'-'+_0x2081f6+'/'+_0x3304ec)[_0xf6f2('0x1f')](_0x196d4f);}return null;};}function saveUpdates(_0x2c643d){return function(_0x4accfe){if(_0x4accfe){return _0x4accfe[_0xf6f2('0x26')](_0x2c643d)[_0xf6f2('0x11')](function(_0x17c63f){return _0x17c63f;});}return null;};}function removeEntity(_0x458171){return function(_0x1a08f3){if(_0x1a08f3){return _0x1a08f3[_0xf6f2('0x27')]()[_0xf6f2('0x11')](function(){var _0x13d05d=_0x1a08f3[_0xf6f2('0x28')]({'plain':!![]});if(_0x13d05d[_0xf6f2('0x29')]===_0xf6f2('0x2a'))return;var _0x7cf6b0=[{'name':'Users','value':_0xf6f2('0x2b'),'ignore':!![]},{'name':_0xf6f2('0x2c'),'value':_0xf6f2('0x2d'),'ignore':![]},{'name':_0xf6f2('0x2e'),'value':_0xf6f2('0x2f'),'ignore':![]}];var _0x3a421f=_(_0x7cf6b0)[_0xf6f2('0x30')](_0xf6f2('0x31'))[_0xf6f2('0x32')](_0xf6f2('0x33'))[_0xf6f2('0x33')]();if(_[_0xf6f2('0x34')](_0x3a421f,_0x13d05d[_0xf6f2('0x29')])){return;}var _0x5c23b2=_['find'](_0x7cf6b0,['value',_0x13d05d[_0xf6f2('0x29')]])[_0xf6f2('0x35')];return db['UserProfileResource']['destroy']({'where':{'type':_0x5c23b2,'resourceId':_0x13d05d['id']}})[_0xf6f2('0x11')](function(){return _0x1a08f3;});})[_0xf6f2('0x11')](function(){_0x458171[_0xf6f2('0x1e')](0xcc)[_0xf6f2('0x36')]();});}};}function handleEntityNotFound(_0xce0c28){return function(_0xcda69b){if(!_0xcda69b){_0xce0c28['sendStatus'](0x194);}return _0xcda69b;};}function handleError(_0x2e633d,_0x53e7eb){_0x53e7eb=_0x53e7eb||0x1f4;return function(_0x33139f){logger[_0xf6f2('0x17')](_0x33139f[_0xf6f2('0x37')]);if(_0x33139f[_0xf6f2('0x35')]){delete _0x33139f['name'];}_0x2e633d[_0xf6f2('0x1e')](_0x53e7eb)[_0xf6f2('0x38')](_0x33139f);};}exports[_0xf6f2('0x39')]=function(_0x4bf2df,_0xabae89){var _0x213923={},_0x1e3726={'count':0x0,'rows':[]};var _0x598489=_(db[_0xf6f2('0x3a')]['rawAttributes'])[_0xf6f2('0x32')](function(_0xb312d9){return{'name':_0xb312d9[_0xf6f2('0x3b')],'type':_0xb312d9['type'][_0xf6f2('0x3c')]};})[_0xf6f2('0x30')](function(_0x10bebb){return!_[_0xf6f2('0x34')]([_0xf6f2('0x3d'),'salt'],_0x10bebb[_0xf6f2('0x35')]);})[_0xf6f2('0x33')]();_0x213923=qs[_0xf6f2('0x3e')](_0x598489,_0x4bf2df);var _0xe94cb4={'where':_0x213923[_0xf6f2('0x3f')]};return db[_0xf6f2('0x3a')][_0xf6f2('0x23')](_0xe94cb4)['then'](function(_0xa48cc4){_0x1e3726[_0xf6f2('0x23')]=_0xa48cc4;if(_0x4bf2df[_0xf6f2('0x40')]['includeAll']){_0x213923[_0xf6f2('0x41')]=[{'all':!![]}];}if(!_[_0xf6f2('0x34')](_0x213923[_0xf6f2('0x42')],'id')){_0x213923[_0xf6f2('0x42')][_0xf6f2('0x43')]('id');}return db['User'][_0xf6f2('0x44')](_0x213923);})[_0xf6f2('0x11')](function(_0x34ba3a){_0x1e3726[_0xf6f2('0x45')]=_0x34ba3a;if(_0x4bf2df[_0xf6f2('0x40')]['openTabs']===_0xf6f2('0x46')){var _0x5f2a9f=[];for(var _0x1a7e1e=0x0;_0x1a7e1e<_0x1e3726[_0xf6f2('0x45')][_0xf6f2('0x47')];_0x1a7e1e++){_0x5f2a9f[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x48'),_0x1e3726[_0xf6f2('0x45')][_0x1a7e1e][_0xf6f2('0x49')]));_0x5f2a9f[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x4a'),_0x1e3726[_0xf6f2('0x45')][_0x1a7e1e][_0xf6f2('0x49')]));_0x5f2a9f['push'](get_open_tabs(_0xf6f2('0x4b'),_0x1e3726[_0xf6f2('0x45')][_0x1a7e1e][_0xf6f2('0x49')]));_0x5f2a9f['push'](get_open_tabs('mail',_0x1e3726['rows'][_0x1a7e1e][_0xf6f2('0x49')]));_0x5f2a9f[_0xf6f2('0x43')](get_open_tabs('openchannel',_0x1e3726['rows'][_0x1a7e1e][_0xf6f2('0x49')]));_0x5f2a9f[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x4c'),_0x1e3726[_0xf6f2('0x45')][_0x1a7e1e][_0xf6f2('0x49')]));}return BPromise[_0xf6f2('0x4d')](_0x5f2a9f)['then'](function(_0x5b4737){return _0x1e3726;});}else{return _0x1e3726;}})['then'](respondWithFilteredResult(_0xabae89,_0x213923))['catch'](handleError(_0xabae89,null));};exports[_0xf6f2('0x4e')]=function(_0x56f00f,_0x37927d){var _0x353d76={'raw':![],'where':{'id':_0x56f00f[_0xf6f2('0x4f')]['id']}},_0x2b9274={};_0x2b9274[_0xf6f2('0x50')]=_['differenceBy'](_['keys'](db[_0xf6f2('0x3a')]['rawAttributes']),['password',_0xf6f2('0x51')]);_0x2b9274[_0xf6f2('0x40')]=_[_0xf6f2('0x52')](_0x56f00f[_0xf6f2('0x40')]);_0x2b9274[_0xf6f2('0x53')]=_[_0xf6f2('0x54')](_0x2b9274['model'],_0x2b9274[_0xf6f2('0x40')]);_0x353d76[_0xf6f2('0x42')]=_['intersection'](_0x2b9274[_0xf6f2('0x50')],qs[_0xf6f2('0x55')](_0x56f00f[_0xf6f2('0x40')]['fields']));_0x353d76[_0xf6f2('0x42')]=_0x353d76[_0xf6f2('0x42')][_0xf6f2('0x47')]?_0x353d76[_0xf6f2('0x42')]:_0x2b9274[_0xf6f2('0x50')];if(_0x56f00f[_0xf6f2('0x40')][_0xf6f2('0x56')]){_0x353d76[_0xf6f2('0x41')]=[{'all':!![]}];}_0x353d76=_[_0xf6f2('0x57')]({},_0x353d76,_0x56f00f[_0xf6f2('0x58')]);if(!_[_0xf6f2('0x34')](_0x353d76['attributes'],'id')){_0x353d76[_0xf6f2('0x42')][_0xf6f2('0x43')]('id');}return db[_0xf6f2('0x3a')][_0xf6f2('0x59')](_0x353d76)[_0xf6f2('0x11')](handleEntityNotFound(_0x37927d,null))[_0xf6f2('0x11')](function(_0x43221e){var _0x22e7d1=[];values=_0x43221e;if(_0x56f00f[_0xf6f2('0x40')][_0xf6f2('0x5a')]==='true'){_0x22e7d1[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x48'),_0x43221e['dataValues']));_0x22e7d1[_0xf6f2('0x43')](get_open_tabs('sms',_0x43221e['dataValues']));_0x22e7d1[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x5b'),_0x43221e[_0xf6f2('0x49')]));_0x22e7d1[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x4c'),_0x43221e[_0xf6f2('0x49')]));_0x22e7d1[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x4b'),_0x43221e['dataValues']));_0x22e7d1[_0xf6f2('0x43')](get_open_tabs('mail',_0x43221e[_0xf6f2('0x49')]));return BPromise['all'](_0x22e7d1);}else{return values;}})[_0xf6f2('0x11')](function(_0x3e43db){return values;})[_0xf6f2('0x11')](respondWithResult(_0x37927d,null))[_0xf6f2('0x1c')](handleError(_0x37927d,null));};exports['update']=function(_0x44a099,_0x322cb1){if(_0x44a099['body']['id']){delete _0x44a099[_0xf6f2('0x5c')]['id'];}delete _0x44a099[_0xf6f2('0x5c')]['role'];return db[_0xf6f2('0x3a')][_0xf6f2('0x59')]({'where':{'id':_0x44a099[_0xf6f2('0x4f')]['id']}})[_0xf6f2('0x11')](handleEntityNotFound(_0x322cb1,null))[_0xf6f2('0x11')](saveUpdates(_0x44a099[_0xf6f2('0x5c')],null))[_0xf6f2('0x11')](respondWithResult(_0x322cb1,null))[_0xf6f2('0x1c')](handleError(_0x322cb1,null));};exports['describe']=function(_0x2c5aaa,_0x213c3f){return db['User'][_0xf6f2('0x5d')]()['then'](respondWithResult(_0x213c3f,null))['catch'](handleError(_0x213c3f,null));};exports[_0xf6f2('0x5e')]=function(_0x141d68,_0x1def57){return db['User'][_0xf6f2('0x59')]({'where':{'id':_0x141d68[_0xf6f2('0x4f')]['id']}})[_0xf6f2('0x11')](handleEntityNotFound(_0x1def57,null))[_0xf6f2('0x11')](function(_0x4c7e76){if(_0x4c7e76){return _0x4c7e76['addContacts'](_0x141d68[_0xf6f2('0x5c')][_0xf6f2('0x5f')],_[_0xf6f2('0x60')](_0x141d68[_0xf6f2('0x5c')],[_0xf6f2('0x5f'),'id'])||{});}})[_0xf6f2('0x11')](respondWithResult(_0x1def57,null))[_0xf6f2('0x1c')](handleError(_0x1def57,null));};function validateUser(_0x2ec204){return new BPromise(function(_0x508460,_0x3651dd){if(_0x2ec204['internal'])return _0x508460(_0x2ec204);return db[_0xf6f2('0x61')][_0xf6f2('0x62')](0x1)['then'](function(_0x2af307){if(_0x2af307['securePassword'])authService[_0xf6f2('0x63')](_0x2ec204[_0xf6f2('0x3d')]);db['User'][_0xf6f2('0x64')](_0xf6f2('0x65'))[_0xf6f2('0x11')](function(_0x16a26e){if(_[_0xf6f2('0x66')](_0x16a26e)){_0x2ec204['internal']=_0x2af307[_0xf6f2('0x67')]||0x1;return;}if(_[_0xf6f2('0x66')](_0x2af307[_0xf6f2('0x67')])||_0x2af307[_0xf6f2('0x67')]===_0x16a26e){_0x2ec204['internal']=_0x16a26e+0x1;return;}if(_0x2af307[_0xf6f2('0x67')]>_0x16a26e){_0x2ec204[_0xf6f2('0x65')]=_0x2af307[_0xf6f2('0x67')];return;}return db['sequelize']['query'](_0xf6f2('0x68'),{'type':db[_0xf6f2('0x69')][_0xf6f2('0x6a')]['SELECT']})[_0xf6f2('0x11')](function(_0x69ab02){if(_0x69ab02&&_0x69ab02[_0xf6f2('0x47')]){for(var _0x5a2ad6=0x0,_0x3bc3bb=_0x69ab02[_0xf6f2('0x47')];_0x5a2ad6<_0x3bc3bb&&_[_0xf6f2('0x66')](_0x2ec204[_0xf6f2('0x65')]);_0x5a2ad6++){if(_0x2af307['min_internal']<=_0x69ab02[_0x5a2ad6][_0xf6f2('0x6b')]){_0x2ec204[_0xf6f2('0x65')]=_0x69ab02[_0x5a2ad6]['from'];}else if(_0x2af307[_0xf6f2('0x67')]>_0x69ab02[_0x5a2ad6][_0xf6f2('0x6b')]&&_0x2af307[_0xf6f2('0x67')]<=_0x69ab02[_0x5a2ad6]['to']){_0x2ec204['internal']=_0x2af307[_0xf6f2('0x67')];}}}if(_[_0xf6f2('0x66')](_0x2ec204[_0xf6f2('0x65')])){_0x2ec204[_0xf6f2('0x65')]=_0x16a26e+0x1;}return _0x508460(_0x2ec204);});});})[_0xf6f2('0x1c')](function(_0x7d461f){_0x3651dd(_0x7d461f);});});}function updateUser(_0x25dbc5){return new BPromise(function(_0x1866a5,_0xe4279b){try{if(_0x25dbc5[_0xf6f2('0x6c')]){_0x25dbc5[_0xf6f2('0x6d')]=_0x25dbc5[_0xf6f2('0x65')];_0x25dbc5[_0xf6f2('0x6e')]={'mailbox':_0x25dbc5[_0xf6f2('0x65')],'password':_0x25dbc5[_0xf6f2('0x3d')],'fullname':_0x25dbc5[_0xf6f2('0x6f')],'email':_0x25dbc5[_0xf6f2('0x70')]};}if(_0x25dbc5[_0xf6f2('0x29')]===_0xf6f2('0x2d')){if(!_0x25dbc5[_0xf6f2('0x71')])_0x25dbc5[_0xf6f2('0x71')]=[_0xf6f2('0x72'),'102',_0xf6f2('0x73'),_0xf6f2('0x74'),_0xf6f2('0x75'),'104','105','106',_0xf6f2('0x76'),_0xf6f2('0x77'),_0xf6f2('0x78'),_0xf6f2('0x79'),_0xf6f2('0x7a'),_0xf6f2('0x7b'),_0xf6f2('0x7c')];}_0x1866a5(_0x25dbc5);}catch(_0x2170d2){_0xe4279b(_0x2170d2);}});}exports[_0xf6f2('0x7d')]=function(_0xcf3079,_0x184cd0){if(_0xcf3079['user'][_0xf6f2('0x29')]===_0xf6f2('0x2d'))throw new Error(_0xf6f2('0x7e'));if(_0xcf3079[_0xf6f2('0x5c')][_0xf6f2('0x29')]==='user'&&_0xcf3079['user'][_0xf6f2('0x29')]!==_0xf6f2('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0xcf3079[_0xf6f2('0x5c')][_0xf6f2('0x29')]===_0xf6f2('0x2a')&&_0xcf3079['user']['role']!==_0xf6f2('0x2a')){throw new Error(_0xf6f2('0x7f'));}return licenseUtil[_0xf6f2('0x80')]([_0xcf3079['body']])[_0xf6f2('0x11')](function(){return validateUser(_0xcf3079[_0xf6f2('0x5c')]);})[_0xf6f2('0x11')](function(_0x403a21){return updateUser(_0x403a21)['then'](function(_0x25ec3e){if(_0x25ec3e[_0xf6f2('0x29')]==='admin'){_0x25ec3e[_0xf6f2('0x81')]=_0xcf3079[_0xf6f2('0x2b')][_0xf6f2('0x81')];delete _0x25ec3e[_0xf6f2('0x82')];}return _0x25ec3e;});})[_0xf6f2('0x11')](function(_0x28b0ff){return db['User'][_0xf6f2('0x7d')](_0x28b0ff,{'include':[{'model':db[_0xf6f2('0x6e')],'as':_0xf6f2('0x6e')}]});})[_0xf6f2('0x11')](function(_0x3f41d1){if(_0xcf3079[_0xf6f2('0x5c')][_0xf6f2('0x29')]===_0xf6f2('0x2b'))return _0x3f41d1;if(_0xcf3079[_0xf6f2('0x2b')][_0xf6f2('0x29')]!==_0xf6f2('0x2b'))return _0x3f41d1;return db[_0xf6f2('0x83')][_0xf6f2('0x59')]({'where':{'name':_0x3f41d1[_0xf6f2('0x29')]==='agent'?_0xf6f2('0x2c'):'Telephones','userProfileId':_0xcf3079[_0xf6f2('0x2b')][_0xf6f2('0x82')]},'raw':!![]})['then'](function(_0xd54d4c){if(!_0xd54d4c||_0xd54d4c[_0xf6f2('0x84')]!=0x0)return _0x3f41d1;return db[_0xf6f2('0x85')][_0xf6f2('0x7d')]({'name':_0x3f41d1[_0xf6f2('0x35')],'resourceId':_0x3f41d1['id'],'type':_0xd54d4c[_0xf6f2('0x35')],'sectionId':_0xd54d4c['id']},{})[_0xf6f2('0x11')](function(){return _0x3f41d1;});})[_0xf6f2('0x1c')](function(_0x4b5450){logger['error'](_0xf6f2('0x86'),_0x4b5450);throw _0x4b5450;});})[_0xf6f2('0x11')](respondWithResult(_0x184cd0,0xc9))[_0xf6f2('0x1c')](handleError(_0x184cd0,null));};exports['bulkCreate']=function(_0x6e038c,_0x24705d){var _0x21221c=_0x6e038c['body'];var _0x35d474=[];if(_0x6e038c[_0xf6f2('0x2b')][_0xf6f2('0x29')]==='agent')throw new Error(_0xf6f2('0x7e'));if(_['some'](_0x21221c,[_0xf6f2('0x29'),_0xf6f2('0x2b')])&&_0x6e038c[_0xf6f2('0x2b')]['role']!==_0xf6f2('0x2a')){throw new Error(_0xf6f2('0x87'));}if(_[_0xf6f2('0x88')](_0x21221c,[_0xf6f2('0x29'),_0xf6f2('0x2a')])&&_0x6e038c[_0xf6f2('0x2b')][_0xf6f2('0x29')]!==_0xf6f2('0x2a')){throw new Error(_0xf6f2('0x89'));}return licenseUtil['checkUserLimits'](_0x21221c)[_0xf6f2('0x11')](function(){return validateUser(_0x21221c[0x0]);})[_0xf6f2('0x11')](function(){for(var _0x578d5e=0x1;_0x578d5e<_0x21221c[_0xf6f2('0x47')];_0x578d5e++){var _0x6e6558=_0x21221c[_0x578d5e-0x1][_0xf6f2('0x65')];if(!_0x21221c[_0x578d5e][_0xf6f2('0x65')])_0x21221c[_0x578d5e][_0xf6f2('0x65')]=_0x6e6558+0x1;_0x35d474['push'](validateUser(_0x21221c[_0x578d5e]));}return BPromise['all'](_0x35d474);})['then'](function(){_0x35d474=[];for(var _0x300e6d=0x0;_0x300e6d<_0x21221c['length'];_0x300e6d++){_0x35d474['push'](updateUser(_0x21221c[_0x300e6d]));}return BPromise['all'](_0x35d474);})[_0xf6f2('0x11')](function(){return BPromise['each'](_0x21221c,function(_0x294ff6){return db['User'][_0xf6f2('0x7d')](_0x294ff6,{'include':[{'model':db[_0xf6f2('0x6e')],'as':_0xf6f2('0x6e')}]})['then'](function(_0x12fdbb){_0x294ff6['id']=_0x12fdbb['id'];return _0x294ff6;});});})[_0xf6f2('0x11')](function(_0x2beb57){if(_0x6e038c[_0xf6f2('0x5c')]['role']===_0xf6f2('0x2b'))return _0x2beb57;if(_0x6e038c['user']['role']!=='user')return _0x2beb57;var _0x56cdfd=_['some'](_0x2beb57,function(_0x15b1ae){return _0x15b1ae[_0xf6f2('0x29')]===_0xf6f2('0x2d')||_0x15b1ae['role']===_0xf6f2('0x2f');});if(!_0x56cdfd)return _0x2beb57;return db['UserProfileSection'][_0xf6f2('0x44')]({'where':{'name':{'$or':[_0xf6f2('0x2c'),'Telephones']},'userProfileId':_0x6e038c[_0xf6f2('0x2b')][_0xf6f2('0x82')]},'raw':!![]})['then'](function(_0x454e89){if(_[_0xf6f2('0x8a')](_0x454e89)||!_[_0xf6f2('0x88')](_0x454e89,[_0xf6f2('0x84'),0x0]))return _0x2beb57;_0x35d474=[];var _0x23685b=_(_0x454e89)['map'](function(_0x1f989e){if(_0x1f989e[_0xf6f2('0x84')]===0x1)return;return _0x1f989e['name']==='Agents'?_0xf6f2('0x2d'):_0xf6f2('0x2f');})['compact']()[_0xf6f2('0x33')]();for(var _0x53cd73=0x0;_0x53cd73<_0x2beb57[_0xf6f2('0x47')];_0x53cd73++){if(!_[_0xf6f2('0x34')](_0x23685b,_0x2beb57[_0x53cd73]['role']))return;var _0x3cd76d=_0x2beb57[_0x53cd73][_0xf6f2('0x29')]===_0xf6f2('0x2d')?'Agents':'Telephones';_0x35d474[_0xf6f2('0x43')](db['UserProfileResource'][_0xf6f2('0x7d')]({'name':_0x2beb57[_0x53cd73][_0xf6f2('0x35')],'resourceId':_0x2beb57[_0x53cd73]['id'],'type':_0x3cd76d,'sectionId':_[_0xf6f2('0x59')](_0x454e89,[_0xf6f2('0x35'),_0x3cd76d])['id']},{}));}return BPromise['all'](_0x35d474);});})[_0xf6f2('0x11')](respondWithResult(_0x24705d,0xc9))[_0xf6f2('0x1c')](handleError(_0x24705d,null));};exports[_0xf6f2('0x8b')]=function(_0x15f3d0,_0xfb5ae9){if(_0x15f3d0[_0xf6f2('0x5c')]['id']){delete _0x15f3d0[_0xf6f2('0x5c')]['id'];}return db[_0xf6f2('0x3a')]['find']({'where':{'id':_0x15f3d0[_0xf6f2('0x4f')]['id']}})[_0xf6f2('0x11')](function(_0x7f6e69){if(!_0x7f6e69)return null;if(_0x7f6e69['id']===_0x15f3d0[_0xf6f2('0x2b')]['id']){if(!_0x15f3d0['body']['oldPassword']||!_0x15f3d0['body'][_0xf6f2('0x8c')]){throw new db[(_0xf6f2('0x8d'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x7f6e69[_0xf6f2('0x8e')](_0x15f3d0['body'][_0xf6f2('0x8f')])){throw new db['Sequelize']['ValidationError'](_0xf6f2('0x90'));}if(_0x15f3d0[_0xf6f2('0x5c')]['oldPassword']===_0x15f3d0[_0xf6f2('0x5c')][_0xf6f2('0x8c')]){throw new db[(_0xf6f2('0x8d'))][(_0xf6f2('0x91'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x15f3d0[_0xf6f2('0x2b')]['role']===_0xf6f2('0x2a')){if(!_0x15f3d0[_0xf6f2('0x5c')][_0xf6f2('0x8c')]){throw new db[(_0xf6f2('0x8d'))][(_0xf6f2('0x91'))](_0xf6f2('0x92'));}}else if(_0x15f3d0[_0xf6f2('0x2b')][_0xf6f2('0x29')]===_0xf6f2('0x2b')){if(!_0x15f3d0['body'][_0xf6f2('0x8c')]){throw new db[(_0xf6f2('0x8d'))][(_0xf6f2('0x91'))](_0xf6f2('0x92'));}if(_0x7f6e69[_0xf6f2('0x29')]!==_0xf6f2('0x2d')){throw new db[(_0xf6f2('0x8d'))][(_0xf6f2('0x91'))]('Unauthorized');}}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}return _0x7f6e69;})['then'](handleEntityNotFound(_0xfb5ae9,null))[_0xf6f2('0x11')](function(_0xdd4d0f){return db['Setting']['findOne']({'attributes':['id',_0xf6f2('0x93'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xf6f2('0x11')](function(_0x4d7580){if(_0x4d7580[_0xf6f2('0x93')])authService[_0xf6f2('0x63')](_0x15f3d0[_0xf6f2('0x5c')][_0xf6f2('0x8c')]);if(!_0x4d7580[_0xf6f2('0x94')]||!_0xdd4d0f[_0xf6f2('0x95')])return _0xdd4d0f;authService[_0xf6f2('0x96')](_0x15f3d0[_0xf6f2('0x5c')]['newPassword'],_0xdd4d0f[_0xf6f2('0x95')],_0x4d7580['passwordHistoryLimit']);return _0xdd4d0f;})[_0xf6f2('0x11')](saveUpdates({'password':_0x15f3d0[_0xf6f2('0x5c')][_0xf6f2('0x8c')],'passwordResetAt':_0x15f3d0['user']['id']==_0x15f3d0['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x15f3d0[_0xf6f2('0x5c')]['newPassword'],_0xdd4d0f[_0xf6f2('0x95')])},null));})[_0xf6f2('0x11')](respondWithResult(_0xfb5ae9,null))['catch'](handleError(_0xfb5ae9,null));};exports[_0xf6f2('0x97')]=function(_0xbd9697,_0x185be2){var _0x48a9e9=_0xbd9697[_0xf6f2('0x5c')][_0xf6f2('0x98')];return db[_0xf6f2('0x3a')][_0xf6f2('0x59')]({'where':{'id':_0xbd9697['params']['id']},'attributes':['id',_0xf6f2('0x35'),_0xf6f2('0x29'),_0xf6f2('0x99'),_0xf6f2('0x9a'),'voicePause',_0xf6f2('0x9b')]})[_0xf6f2('0x11')](handleEntityNotFound(_0x185be2,null))[_0xf6f2('0x11')](function(_0xa7b942){if(_0xa7b942){if(!utils[_0xf6f2('0x9c')](_0x48a9e9)){throw new db['Sequelize']['ValidationError'](_0xf6f2('0x9d'));}return _0xa7b942[_0xf6f2('0x9e')+_['capitalize'](_0x48a9e9[_0xf6f2('0x9f')]())+_0xf6f2('0xa0')](_0xbd9697['body'][_0xf6f2('0x5f')],{'penalty':_0xbd9697['body'][_0xf6f2('0xa1')]||0x0})[_0xf6f2('0xa2')](function(_0x4f1dfd){for(var _0x2dd37d=0x0;_0x2dd37d<_0xbd9697['body']['ids'][_0xf6f2('0x47')];_0x2dd37d+=0x1){var _0xac4fce={'UserId':Number(_0xbd9697[_0xf6f2('0x4f')]['id'])};_0xac4fce[_['capitalize'](_0x48a9e9['toLowerCase']())+'QueueId']=Number(_0xbd9697[_0xf6f2('0x5c')][_0xf6f2('0x5f')][_0x2dd37d]);socket[_0xf6f2('0xa3')](_0xf6f2('0x2b')+_[_0xf6f2('0xa4')](_0x48a9e9[_0xf6f2('0x9f')]())+_0xf6f2('0xa5'),_0xac4fce);}return _0x4f1dfd;})['then'](function(){if(_0x48a9e9===_0xf6f2('0xa6')){return db[_0xf6f2('0xa7')][_0xf6f2('0x44')]({'where':{'id':_0xbd9697[_0xf6f2('0x5c')]['ids']||[]},'raw':!![],'attributes':['id',_0xf6f2('0x35')]});}})['then'](function(_0xb29988){var _0x25803d=_0xa7b942[_0xf6f2('0x28')]({'plain':!![]});var _0x24e8d5=[];if(_0x48a9e9===_0xf6f2('0xa6')&&_0x25803d[_0xf6f2('0x29')]===_0xf6f2('0x2d')&&_0x25803d[_0xf6f2('0x99')]){for(var _0x3d38bf=0x0;_0x3d38bf<_0xb29988[_0xf6f2('0x47')];_0x3d38bf+=0x1){_0x24e8d5[_0xf6f2('0x43')]({'membername':_0x25803d['name'],'UserId':_0x25803d['id'],'queue_name':_0xb29988[_0x3d38bf][_0xf6f2('0x35')],'VoiceQueueId':_0xb29988[_0x3d38bf]['id'],'interface':_[_0xf6f2('0x66')](_0x25803d[_0xf6f2('0x9b')])?util[_0xf6f2('0xa8')]('SIP/%s',_0x25803d['name']):_0x25803d[_0xf6f2('0x9b')],'paused':_0x25803d['voicePause']||![],'penalty':_0xbd9697[_0xf6f2('0x5c')][_0xf6f2('0xa1')]||0x0});}return BPromise[_0xf6f2('0xa9')](_0x24e8d5,function(_0x455c68){return db['UserVoiceQueueRt'][_0xf6f2('0xaa')](_0x455c68);});}return _0xa7b942;});}})[_0xf6f2('0x11')](respondWithStatusCode(_0x185be2,null))[_0xf6f2('0x1c')](handleError(_0x185be2,null));};exports[_0xf6f2('0xab')]=function(_0x129f5c,_0x466a42){var _0x14c575;return db[_0xf6f2('0x3a')][_0xf6f2('0x59')]({'where':{'id':_0x129f5c[_0xf6f2('0x4f')]['id']},'attributes':['id','name',_0xf6f2('0x29')]})[_0xf6f2('0x11')](handleEntityNotFound(_0x466a42,null))['then'](function(_0x3cef61){if(_0x3cef61){_0x14c575=_0x3cef61;if(!_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x98')]||!utils[_0xf6f2('0x9c')](_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x98')])){throw new db['Sequelize'][(_0xf6f2('0x91'))]('Unknown\x20channel');}return _0x3cef61[_0xf6f2('0xac')+_[_0xf6f2('0xa4')](_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x98')][_0xf6f2('0x9f')]())+_0xf6f2('0xa0')](_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x5f')]);}})['then'](function(_0x419653){if(_['isArray'](_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x5f')])){for(var _0x290ef6=0x0;_0x290ef6<_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x5f')][_0xf6f2('0x47')];_0x290ef6+=0x1){var _0x3609ec={'UserId':Number(_0x129f5c[_0xf6f2('0x4f')]['id'])};_0x3609ec[_[_0xf6f2('0xa4')](_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x98')][_0xf6f2('0x9f')]())+'QueueId']=Number(_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x5f')][_0x290ef6]);socket[_0xf6f2('0xa3')](_0xf6f2('0x2b')+_[_0xf6f2('0xa4')](_0x129f5c[_0xf6f2('0x40')]['channel']['toLowerCase']())+_0xf6f2('0xad'),_0x3609ec);}}else{var _0x3609ec={'UserId':Number(_0x129f5c[_0xf6f2('0x4f')]['id'])};_0x3609ec[_[_0xf6f2('0xa4')](_0x129f5c[_0xf6f2('0x40')]['channel']['toLowerCase']())+'QueueId']=Number(_0x129f5c[_0xf6f2('0x40')]['ids']);socket[_0xf6f2('0xa3')](_0xf6f2('0x2b')+_[_0xf6f2('0xa4')](_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x98')][_0xf6f2('0x9f')]())+'Queue:remove',_0x3609ec);}return _0x419653;})['then'](function(){if(_0x129f5c['query'][_0xf6f2('0x98')]===_0xf6f2('0xa6')){return db[_0xf6f2('0xae')][_0xf6f2('0x27')]({'where':{'UserId':_0x129f5c['params']['id'],'VoiceQueueId':_0x129f5c[_0xf6f2('0x40')][_0xf6f2('0x5f')]},'individualHooks':!![]})[_0xf6f2('0x11')](function(){return _0x14c575;});}return _0x14c575;})['then'](respondWithStatusCode(_0x466a42,null))[_0xf6f2('0x1c')](handleError(_0x466a42,null));};exports[_0xf6f2('0xaf')]=function(_0x13fb5f,_0x1ee544){_0x13fb5f[_0xf6f2('0x5c')]['userpic']=_0x13fb5f[_0xf6f2('0xb0')]['filename'];return db[_0xf6f2('0x3a')][_0xf6f2('0x59')]({'where':{'id':_0x13fb5f[_0xf6f2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1ee544,null))[_0xf6f2('0x11')](saveUpdates(_0x13fb5f[_0xf6f2('0x5c')],null))['then'](respondWithResult(_0x1ee544,null))[_0xf6f2('0x1c')](handleError(_0x1ee544,null));};exports['getAvatar']=function(_0x45ecd5,_0x3a0285){var _0x1cf799=path[_0xf6f2('0xb1')](config[_0xf6f2('0xb2')],'server/files/images/logos/default_profile.png');return db[_0xf6f2('0x3a')][_0xf6f2('0x59')]({'where':{'id':_0x45ecd5['params']['id']},'attributes':['id',_0xf6f2('0xb3')],'raw':!![]})['then'](handleEntityNotFound(_0x3a0285,null))[_0xf6f2('0x11')](function(_0x432c12){if(_0x432c12){if(_[_0xf6f2('0x66')](_0x432c12[_0xf6f2('0xb3')])){return _0x3a0285[_0xf6f2('0xb4')](_0x1cf799);}else{if(!fs[_0xf6f2('0xb5')](path['join'](config[_0xf6f2('0xb2')],_0xf6f2('0xb6'),_0x432c12[_0xf6f2('0xb3')]))){return _0x3a0285[_0xf6f2('0xb4')](_0x1cf799);}return _0x3a0285[_0xf6f2('0xb4')](path[_0xf6f2('0xb1')](config[_0xf6f2('0xb2')],'server/files/images/',_0x432c12[_0xf6f2('0xb3')]));}}})['catch'](handleError(_0x3a0285,null));};exports[_0xf6f2('0xb7')]=function(_0x29ec65,_0x5371fa){return db['User'][_0xf6f2('0x59')]({'where':{'id':_0x29ec65['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x5371fa,null))['then'](function(_0x2fd4b2){var _0x358f51=[];values=_0x2fd4b2[_0xf6f2('0x49')];_0x358f51[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x48'),_0x2fd4b2['dataValues']));_0x358f51[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x4a'),_0x2fd4b2[_0xf6f2('0x49')]));_0x358f51[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x5b'),_0x2fd4b2[_0xf6f2('0x49')]));_0x358f51[_0xf6f2('0x43')](get_open_tabs('whatsapp',_0x2fd4b2[_0xf6f2('0x49')]));_0x358f51[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0x4b'),_0x2fd4b2[_0xf6f2('0x49')]));_0x358f51[_0xf6f2('0x43')](get_open_tabs(_0xf6f2('0xb8'),_0x2fd4b2[_0xf6f2('0x49')]));return BPromise['all'](_0x358f51);})[_0xf6f2('0x11')](function(_0x552fe9){var _0x280936=[];if(_0x552fe9){for(var _0x3be39b=0x0;_0x3be39b=_0xf084af[_0x068d('0x53')]){throw new Error(_0x068d('0x54'));}})['then'](function(){if(_0xd66913){return db['UserVoiceQueueRt'][_0x068d('0x4d')]({'where':{'membername':_0xd66913['name']},'individualHooks':!![]});}})[_0x068d('0x27')](function(){if(_0xd66913){return _0xd66913[_0x068d('0x55')]({'raw':!![]});}})['then'](function(_0xec72e0){if(_0xd66913){if(_0xec72e0){var _0x21397b=[];_0x381b1f=_0xec72e0;if(_0x381b1f['length']){for(var _0x37a685=0x0;_0x37a685<_0x381b1f[_0x068d('0x32')];_0x37a685++){_0x21397b['push'](db[_0x068d('0x2d')]['upsert']({'membername':_0xd66913['name'],'UserId':_0xd66913['id'],'queue_name':_0x381b1f[_0x37a685][_0x068d('0x30')],'VoiceQueueId':_0x381b1f[_0x37a685]['id'],'interface':_0xf92d51,'paused':_0xd66913[_0x068d('0x50')]||![],'penalty':_0x381b1f[_0x37a685][_0x068d('0x56')]||0x0}));}return BPromise['all'](_0x21397b);}}}})[_0x068d('0x27')](function(){if(_0xd66913){return db[_0x068d('0x2f')][_0x068d('0x1e')]({'where':{'membername':_0xd66913[_0x068d('0x30')],'exitAt':null}});}})[_0x068d('0x27')](function(_0x391e3f){if(_0xd66913){if(_0x391e3f&&_0x391e3f[_0x068d('0x32')]){var _0x4ed564=[];_0x391e3f['forEach'](function(_0x4a7957){_0x4ed564[_0x068d('0x4a')](_0x4a7957[_0x068d('0x2e')]({'exitAt':moment()['format'](_0x068d('0x33'))}));});return BPromise[_0x068d('0x4b')](_0x4ed564);}}})['then'](function(_0xaa0e2c){if(_0xd66913){var _0xfbab63=[];var _0x1c29bc=[];var _0x598260=utils[_0x068d('0x57')]();var _0x2e3195={'membername':_0xd66913[_0x068d('0x30')],'interface':_0xf92d51,'enterAt':moment()[_0x068d('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd66913[_0x068d('0x3c')],'internal':_0xd66913[_0x068d('0x2b')]};_0x598260[_0x068d('0x35')](function(_0x6a1ba8){_0xfbab63[_0x068d('0x4a')](_[_0x068d('0x58')]({'channel':_0x6a1ba8,'type':_0x068d('0x59'),'data1':_0x068d('0x5a'),'data2':_0xf92d51},_0x2e3195));if(_0xd66913[_0x068d('0x50')]){_0x1c29bc[_0x068d('0x4a')](_[_0x068d('0x58')]({'channel':_0x6a1ba8,'type':'PAUSE','data1':_0x068d('0x5b')},_0x2e3195));}});return db['MemberReport']['bulkCreate'](_0xfbab63['concat'](_0x1c29bc),{'individualHooks':!![]});}})[_0x068d('0x27')](function(){if(_0xd66913){return _0xd66913[_0x068d('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x068d('0x37')](_0x068d('0x33')),'voicePause':_0xd66913[_0x068d('0x50')]||![],'mailPause':_0xd66913[_0x068d('0x50')]||![],'chatPause':_0xd66913[_0x068d('0x50')]||![],'faxPause':_0xd66913[_0x068d('0x50')]||![],'smsPause':_0xd66913[_0x068d('0x50')]||![],'openchannelPause':_0xd66913[_0x068d('0x50')]||![],'pauseType':_0xd66913[_0x068d('0x50')]?_0x068d('0x5b'):null,'lastPauseAt':moment()[_0x068d('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xf92d51});}})[_0x068d('0x27')](function(_0x3b493b){_0x2efcb0(_0x3b493b);})['catch'](function(_0x139113){_0x1a10a3(_0x26b6a4[_0x068d('0x17')](0x1f4,_0x139113[_0x068d('0x19')]));});});}; \ No newline at end of file +var _0xd5ce=['loginInPause','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','bulkCreate','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./user.socket','request','then','info','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','limit','map','include','model','GetUser','ShowUser','find','PauseUser','User','where','name','internal','interface','UserVoiceQueueRt','update','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','isNil','SIP/%s','format','body','type','role','uniqueid','MemberReport','DEFAULT\x20PAUSE','isValidChannel','channel','system','mail','fax','openchannel','whatsapp','set','%s%s','push','all','LogoutUser','findOne','destroy','forEach','LoginUser','count','agent','agents','Maximum\x20login\x20has\x20been\x20reached','upsert'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd5ce,0x16f));var _0xed5c=function(_0x45977b,_0x2d3f70){_0x45977b=_0x45977b-0x0;var _0x31f399=_0xd5ce[_0x45977b];return _0x31f399;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed5c('0x0'));var BPromise=require(_0xed5c('0x1'));var rs=require(_0xed5c('0x2'));var fs=require('fs');var Redis=require(_0xed5c('0x3'));var db=require(_0xed5c('0x4'))['db'];var utils=require(_0xed5c('0x5'));var logger=require(_0xed5c('0x6'))(_0xed5c('0x7'));var config=require(_0xed5c('0x8'));var jayson=require(_0xed5c('0x9'));var client=jayson[_0xed5c('0xa')][_0xed5c('0xb')]({'port':0x232a});config[_0xed5c('0xc')]=_[_0xed5c('0xd')](config['redis'],{'host':_0xed5c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed5c('0xc')]));require(_0xed5c('0xf'))['register'](socket);function respondWithRpcPromise(_0x39a9de,_0x5d1919,_0x9f30d1){return new BPromise(function(_0x2b44aa,_0x2526a9){return client[_0xed5c('0x10')](_0x39a9de,_0x9f30d1)[_0xed5c('0x11')](function(_0x4e2b66){logger[_0xed5c('0x12')]('User,\x20%s,\x20%s',_0x5d1919,'request\x20sent');logger[_0xed5c('0x13')](_0xed5c('0x14'),_0x5d1919,_0xed5c('0x15'),JSON[_0xed5c('0x16')](_0x4e2b66));if(_0x4e2b66[_0xed5c('0x17')]){if(_0x4e2b66[_0xed5c('0x17')][_0xed5c('0x18')]===0x1f4){logger[_0xed5c('0x17')](_0xed5c('0x19'),_0x5d1919,_0x4e2b66['error'][_0xed5c('0x1a')]);return _0x2526a9(_0x4e2b66[_0xed5c('0x17')][_0xed5c('0x1a')]);}logger[_0xed5c('0x17')](_0xed5c('0x19'),_0x5d1919,_0x4e2b66[_0xed5c('0x17')][_0xed5c('0x1a')]);return _0x2b44aa(_0x4e2b66['error'][_0xed5c('0x1a')]);}else{logger[_0xed5c('0x12')](_0xed5c('0x19'),_0x5d1919,_0xed5c('0x15'));_0x2b44aa(_0x4e2b66[_0xed5c('0x1b')][_0xed5c('0x1a')]);}})[_0xed5c('0x1c')](function(_0x237387){logger[_0xed5c('0x17')](_0xed5c('0x19'),_0x5d1919,_0x237387);_0x2526a9(_0x237387);});});}exports['GetUser']=function(_0x1154d2){var _0x5be3f5=this;return new Promise(function(_0x4773cd,_0x33028c){return db['User'][_0xed5c('0x1d')]({'raw':_0x1154d2[_0xed5c('0x1e')]?_0x1154d2[_0xed5c('0x1e')][_0xed5c('0x1f')]===undefined?!![]:![]:!![],'where':_0x1154d2['options']?_0x1154d2[_0xed5c('0x1e')]['where']||null:null,'attributes':_0x1154d2[_0xed5c('0x1e')]?_0x1154d2[_0xed5c('0x1e')][_0xed5c('0x20')]||null:null,'limit':_0x1154d2[_0xed5c('0x1e')]?_0x1154d2[_0xed5c('0x1e')][_0xed5c('0x21')]||null:null,'include':_0x1154d2[_0xed5c('0x1e')]?_0x1154d2[_0xed5c('0x1e')]['include']?_[_0xed5c('0x22')](_0x1154d2[_0xed5c('0x1e')][_0xed5c('0x23')],function(_0x20a09f){return{'model':db[_0x20a09f['model']],'as':_0x20a09f['as'],'attributes':_0x20a09f[_0xed5c('0x20')],'include':_0x20a09f['include']?_[_0xed5c('0x22')](_0x20a09f['include'],function(_0x5562be){return{'model':db[_0x5562be[_0xed5c('0x24')]],'as':_0x5562be['as'],'attributes':_0x5562be['attributes'],'include':_0x5562be[_0xed5c('0x23')]?_[_0xed5c('0x22')](_0x5562be[_0xed5c('0x23')],function(_0x4930d0){return{'model':db[_0x4930d0['model']],'as':_0x4930d0['as'],'attributes':_0x4930d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xed5c('0x11')](function(_0xd7a29a){logger['info'](_0xed5c('0x25'),_0x1154d2);logger[_0xed5c('0x13')](_0xed5c('0x25'),_0x1154d2,JSON[_0xed5c('0x16')](_0xd7a29a));_0x4773cd(_0xd7a29a);})[_0xed5c('0x1c')](function(_0x19a0ec){logger['error'](_0xed5c('0x25'),_0x19a0ec[_0xed5c('0x1a')],_0x1154d2);_0x33028c(_0x5be3f5[_0xed5c('0x17')](0x1f4,_0x19a0ec[_0xed5c('0x1a')]));});});};exports[_0xed5c('0x26')]=function(_0x42f11b){var _0x54909c=this;return new Promise(function(_0x2ef6fe,_0x629b29){return db['User'][_0xed5c('0x27')]({'raw':_0x42f11b[_0xed5c('0x1e')]?_0x42f11b[_0xed5c('0x1e')][_0xed5c('0x1f')]===undefined?!![]:![]:!![],'where':_0x42f11b[_0xed5c('0x1e')]?_0x42f11b[_0xed5c('0x1e')]['where']||null:null,'attributes':_0x42f11b[_0xed5c('0x1e')]?_0x42f11b[_0xed5c('0x1e')]['attributes']||null:null,'include':_0x42f11b[_0xed5c('0x1e')]?_0x42f11b['options'][_0xed5c('0x23')]?_[_0xed5c('0x22')](_0x42f11b[_0xed5c('0x1e')][_0xed5c('0x23')],function(_0x3bb256){return{'model':db[_0x3bb256['model']],'as':_0x3bb256['as'],'attributes':_0x3bb256[_0xed5c('0x20')],'include':_0x3bb256['include']?_['map'](_0x3bb256['include'],function(_0x25d42e){return{'model':db[_0x25d42e['model']],'as':_0x25d42e['as'],'attributes':_0x25d42e[_0xed5c('0x20')],'include':_0x25d42e['include']?_[_0xed5c('0x22')](_0x25d42e[_0xed5c('0x23')],function(_0x5c8832){return{'model':db[_0x5c8832[_0xed5c('0x24')]],'as':_0x5c8832['as'],'attributes':_0x5c8832[_0xed5c('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x109e36){logger['info'](_0xed5c('0x26'),_0x42f11b);logger[_0xed5c('0x13')](_0xed5c('0x26'),_0x42f11b,JSON[_0xed5c('0x16')](_0x109e36));_0x2ef6fe(_0x109e36);})['catch'](function(_0x1f4add){logger['error'](_0xed5c('0x26'),_0x1f4add[_0xed5c('0x1a')],_0x42f11b);_0x629b29(_0x54909c[_0xed5c('0x17')](0x1f4,_0x1f4add[_0xed5c('0x1a')]));});});};exports[_0xed5c('0x28')]=function(_0x3a5089){var _0xbaf16e=this;return new Promise(function(_0x473095,_0x5954e0){var _0x42e5ed;return db[_0xed5c('0x29')][_0xed5c('0x27')]({'where':_0x3a5089[_0xed5c('0x1e')][_0xed5c('0x2a')]||{},'attributes':['id',_0xed5c('0x2b'),'role',_0xed5c('0x2c'),_0xed5c('0x2d')]})['then'](function(_0x2b04d4){if(_0x2b04d4){_0x42e5ed=_0x2b04d4;return db[_0xed5c('0x2e')][_0xed5c('0x2f')]({'paused':0x1},{'where':{'UserId':_0x42e5ed['id']},'individualHooks':!![]});}})[_0xed5c('0x11')](function(){if(_0x42e5ed){return db['MemberReport'][_0xed5c('0x1d')]({'where':{'membername':_0x42e5ed['name'],'type':_0xed5c('0x30'),'exitAt':null}});}})['then'](function(_0xceee1e){if(_0x42e5ed){if(_0xceee1e&&_0xceee1e[_0xed5c('0x31')]){var _0x41d1bc=moment()['format'](_0xed5c('0x32'));for(var _0x30788f=0x0,_0x565bdd=_0xceee1e[_0xed5c('0x31')];_0x30788f<_0x565bdd;_0x30788f++){_0xceee1e[_0x30788f][_0xed5c('0x33')]({'exitAt':_0x41d1bc});}}}})[_0xed5c('0x11')](function(){if(_0x42e5ed){var _0x36a5b1=[];var _0x52def1=utils[_0xed5c('0x34')]();_0x52def1['forEach'](function(_0x103428){_0x36a5b1['push']({'channel':_0x103428,'membername':_0x42e5ed[_0xed5c('0x2b')],'interface':_[_0xed5c('0x35')](_0x42e5ed[_0xed5c('0x2d')])?util['format'](_0xed5c('0x36'),_0x42e5ed['name']):_0x42e5ed[_0xed5c('0x2d')],'type':'PAUSE','enterAt':moment()[_0xed5c('0x37')](_0xed5c('0x32')),'data1':_0x3a5089[_0xed5c('0x38')][_0xed5c('0x39')]||'DEFAULT\x20PAUSE','role':_0x42e5ed[_0xed5c('0x3a')],'internal':_0x42e5ed[_0xed5c('0x2c')],'uniqueid':_0x3a5089[_0xed5c('0x38')][_0xed5c('0x3b')]||null});});return db[_0xed5c('0x3c')]['bulkCreate'](_0x36a5b1,{'individualHooks':!![]});}})[_0xed5c('0x11')](function(){if(_0x42e5ed){return _0x42e5ed[_0xed5c('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3a5089[_0xed5c('0x38')][_0xed5c('0x39')]||_0xed5c('0x3d'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xed5c('0x11')](function(_0x2a80a1){_0x473095(_0x2a80a1);})[_0xed5c('0x1c')](function(_0x38c2c5){_0x5954e0(_0xbaf16e[_0xed5c('0x17')](0x1f4,_0x38c2c5['message']));});});};exports['UnpauseUser']=function(_0xbd074){var _0x15b871=this;return new Promise(function(_0x34d597,_0x9d0e7f){var _0x176d57;return db['User']['findOne']({'where':_0xbd074[_0xed5c('0x1e')][_0xed5c('0x2a')]||{},'attributes':['id',_0xed5c('0x2b')]})[_0xed5c('0x11')](function(_0x44df2e){if(_0x44df2e){_0x176d57=_0x44df2e;if(_0xbd074[_0xed5c('0x38')]['channel']&&!utils[_0xed5c('0x3e')](_0xbd074['body'][_0xed5c('0x3f')])){throw new Error('Unknown\x20channel');}switch(_0xbd074[_0xed5c('0x38')]['channel']){case'voice':return db['UserVoiceQueueRt'][_0xed5c('0x2f')]({'paused':0x0},{'where':{'UserId':_0x176d57['id']}})['then'](function(){return db[_0xed5c('0x3c')][_0xed5c('0x27')]({'where':{'channel':_0xbd074['body'][_0xed5c('0x3f')],'membername':_0x176d57[_0xed5c('0x2b')],'type':_0xed5c('0x30'),'exitAt':null}});})[_0xed5c('0x11')](function(_0x2a6d64){if(_0x2a6d64){return _0x2a6d64[_0xed5c('0x2f')]({'exitAt':moment()[_0xed5c('0x37')](_0xed5c('0x32')),'data2':_0xed5c('0x40')},{'individualHooks':!![]});}return null;})[_0xed5c('0x11')](function(){return _0x176d57[_0xed5c('0x2f')]({'voicePause':![]});});case _0xed5c('0x41'):case'chat':case _0xed5c('0x42'):case'sms':case _0xed5c('0x43'):case _0xed5c('0x44'):return db[_0xed5c('0x3c')][_0xed5c('0x27')]({'where':{'channel':_0xbd074[_0xed5c('0x38')][_0xed5c('0x3f')],'membername':_0x176d57[_0xed5c('0x2b')],'type':'PAUSE','exitAt':null}})[_0xed5c('0x11')](function(_0x518e28){return _0x518e28[_0xed5c('0x2f')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xed5c('0x40')},{'individualHooks':!![]});})['then'](function(){var _0x24e28a={};_[_0xed5c('0x45')](_0x24e28a,util['format'](_0xed5c('0x46'),_0xbd074['body'][_0xed5c('0x3f')],'Pause'),![]);return _0x176d57[_0xed5c('0x2f')](_0x24e28a);});default:return db[_0xed5c('0x2e')][_0xed5c('0x2f')]({'paused':0x0},{'where':{'UserId':_0x176d57['id']}})['then'](function(){return db['MemberReport'][_0xed5c('0x1d')]({'where':{'membername':_0x176d57[_0xed5c('0x2b')],'type':_0xed5c('0x30'),'exitAt':null}});})[_0xed5c('0x11')](function(_0x5c2b1a){var _0x17db6a=[];_0x5c2b1a['forEach'](function(_0x481e19){_0x17db6a[_0xed5c('0x47')](_0x481e19[_0xed5c('0x2f')]({'exitAt':moment()[_0xed5c('0x37')](_0xed5c('0x32')),'data2':_0xed5c('0x40')}));});return BPromise[_0xed5c('0x48')](_0x17db6a);})[_0xed5c('0x11')](function(){return _0x176d57['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xed5c('0x11')](function(_0x1c8318){_0x34d597(_0x1c8318);})[_0xed5c('0x1c')](function(_0xf4d39c){_0x9d0e7f(_0x15b871[_0xed5c('0x17')](0x1f4,_0xf4d39c[_0xed5c('0x1a')]));});});};exports[_0xed5c('0x49')]=function(_0x2f0a1e){var _0x393b71=this;return new Promise(function(_0x13fc74,_0x16392b){var _0x2270ea;return db['User'][_0xed5c('0x4a')]({'where':_0x2f0a1e[_0xed5c('0x1e')][_0xed5c('0x2a')]||{},'attributes':['id',_0xed5c('0x2b')]})[_0xed5c('0x11')](function(_0x3a2713){if(_0x3a2713){_0x2270ea=_0x3a2713;return db[_0xed5c('0x2e')][_0xed5c('0x4b')]({'where':{'membername':_0x2270ea[_0xed5c('0x2b')]},'individualHooks':!![]});}})['then'](function(){if(_0x2270ea){return db['MemberReport'][_0xed5c('0x1d')]({'where':{'membername':_0x2270ea[_0xed5c('0x2b')],'exitAt':null}});}})[_0xed5c('0x11')](function(_0x10f79f){if(_0x2270ea){if(_0x10f79f&&_0x10f79f[_0xed5c('0x31')]){var _0x1b5595=[];_0x10f79f[_0xed5c('0x4c')](function(_0x5caa5c){_0x1b5595[_0xed5c('0x47')](_0x5caa5c[_0xed5c('0x2f')]({'exitAt':moment()[_0xed5c('0x37')](_0xed5c('0x32'))}));});return BPromise[_0xed5c('0x48')](_0x1b5595);}}})[_0xed5c('0x11')](function(){if(_0x2270ea){return _0x2270ea[_0xed5c('0x2f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xed5c('0x11')](function(_0xf18afc){_0x13fc74(_0xf18afc);})[_0xed5c('0x1c')](function(_0x39e40d){_0x16392b(_0x393b71[_0xed5c('0x17')](0x1f4,_0x39e40d[_0xed5c('0x1a')]));});});};exports[_0xed5c('0x4d')]=function(_0x21cbff){var _0x30a23d=this;return new Promise(function(_0x22a730,_0x948188){var _0x3c739d;var _0x53639f;var _0x2c9d95;var _0xb3dcea;return db['User'][_0xed5c('0x4a')]({'where':_0x21cbff[_0xed5c('0x1e')]['where']||{},'attributes':['id',_0xed5c('0x2b'),_0xed5c('0x3a'),'mobile','phone','internal','loginInPause',_0xed5c('0x2d')]})[_0xed5c('0x11')](function(_0x18dd62){if(_0x18dd62){_0x3c739d=_0x18dd62;_0xb3dcea=_0x21cbff[_0xed5c('0x38')][_0xed5c('0x2d')]?_0x21cbff[_0xed5c('0x38')][_0xed5c('0x2d')]:util[_0xed5c('0x37')]('SIP/%s',_0x3c739d[_0xed5c('0x2b')]);return db[_0xed5c('0x29')][_0xed5c('0x4e')]({'where':{'role':_0xed5c('0x4f'),'online':!![],'id':{'$ne':_0x3c739d['id']}}});}})[_0xed5c('0x11')](function(_0x20ab6f){if(_0x20ab6f){_0x2c9d95=_0x20ab6f;return require('../../config/license/util')['getLicense']();}})[_0xed5c('0x11')](function(_0x36044b){if(_0x36044b&&_0x36044b[_0xed5c('0x50')]&&_0x2c9d95>=_0x36044b['agents']){throw new Error(_0xed5c('0x51'));}})['then'](function(){if(_0x3c739d){return db[_0xed5c('0x2e')][_0xed5c('0x4b')]({'where':{'membername':_0x3c739d[_0xed5c('0x2b')]},'individualHooks':!![]});}})[_0xed5c('0x11')](function(){if(_0x3c739d){return _0x3c739d['getVoiceQueues']({'raw':!![]});}})[_0xed5c('0x11')](function(_0x1a6a89){if(_0x3c739d){if(_0x1a6a89){var _0xe86db=[];_0x53639f=_0x1a6a89;if(_0x53639f[_0xed5c('0x31')]){for(var _0x20b942=0x0;_0x20b942<_0x53639f['length'];_0x20b942++){_0xe86db[_0xed5c('0x47')](db[_0xed5c('0x2e')][_0xed5c('0x52')]({'membername':_0x3c739d[_0xed5c('0x2b')],'UserId':_0x3c739d['id'],'queue_name':_0x53639f[_0x20b942][_0xed5c('0x2b')],'VoiceQueueId':_0x53639f[_0x20b942]['id'],'interface':_0xb3dcea,'paused':_0x3c739d[_0xed5c('0x53')]||![],'penalty':_0x53639f[_0x20b942][_0xed5c('0x54')]||0x0}));}return BPromise[_0xed5c('0x48')](_0xe86db);}}}})[_0xed5c('0x11')](function(){if(_0x3c739d){return db['MemberReport'][_0xed5c('0x1d')]({'where':{'membername':_0x3c739d[_0xed5c('0x2b')],'exitAt':null}});}})[_0xed5c('0x11')](function(_0x3bc52c){if(_0x3c739d){if(_0x3bc52c&&_0x3bc52c['length']){var _0x46eaea=[];_0x3bc52c[_0xed5c('0x4c')](function(_0x5e308d){_0x46eaea[_0xed5c('0x47')](_0x5e308d[_0xed5c('0x2f')]({'exitAt':moment()['format'](_0xed5c('0x32'))}));});return BPromise[_0xed5c('0x48')](_0x46eaea);}}})[_0xed5c('0x11')](function(_0x43f4fe){if(_0x3c739d){var _0x36237c=[];var _0x3c4ec5=[];var _0x24127b=utils[_0xed5c('0x34')]();var _0x35fd3d={'membername':_0x3c739d['name'],'interface':_0xb3dcea,'enterAt':moment()['format'](_0xed5c('0x32')),'role':_0x3c739d[_0xed5c('0x3a')],'internal':_0x3c739d[_0xed5c('0x2c')]};_0x24127b['forEach'](function(_0x8c7d89){_0x36237c[_0xed5c('0x47')](_['merge']({'channel':_0x8c7d89,'type':_0xed5c('0x55'),'data1':_0xed5c('0x56'),'data2':_0xb3dcea},_0x35fd3d));if(_0x3c739d['loginInPause']){_0x3c4ec5['push'](_[_0xed5c('0x57')]({'channel':_0x8c7d89,'type':_0xed5c('0x30'),'data1':_0xed5c('0x58')},_0x35fd3d));}});return db[_0xed5c('0x3c')][_0xed5c('0x59')](_0x36237c['concat'](_0x3c4ec5),{'individualHooks':!![]});}})['then'](function(){if(_0x3c739d){return _0x3c739d[_0xed5c('0x2f')]({'online':!![],'lastLoginAt':moment()[_0xed5c('0x37')](_0xed5c('0x32')),'voicePause':_0x3c739d['loginInPause']||![],'mailPause':_0x3c739d[_0xed5c('0x53')]||![],'chatPause':_0x3c739d[_0xed5c('0x53')]||![],'faxPause':_0x3c739d[_0xed5c('0x53')]||![],'smsPause':_0x3c739d[_0xed5c('0x53')]||![],'openchannelPause':_0x3c739d['loginInPause']||![],'pauseType':_0x3c739d[_0xed5c('0x53')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xed5c('0x37')](_0xed5c('0x32')),'interface':_0xb3dcea});}})[_0xed5c('0x11')](function(_0x342435){_0x22a730(_0x342435);})[_0xed5c('0x1c')](function(_0x2f5a1a){_0x948188(_0x30a23d['error'](0x1f4,_0x2f5a1a[_0xed5c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0a7f7b5..5be4dc6 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 _0xb599=['./user.events','remove','update','emit','removeListener','register','length','user:'];(function(_0x20d68e,_0x36b353){var _0x452fa9=function(_0x56a712){while(--_0x56a712){_0x20d68e['push'](_0x20d68e['shift']());}};_0x452fa9(++_0x36b353);}(_0xb599,0xe0));var _0x9b59=function(_0x201602,_0x2cf2f7){_0x201602=_0x201602-0x0;var _0x1438b2=_0xb599[_0x201602];return _0x1438b2;};'use strict';var UserEvents=require(_0x9b59('0x0'));var events=['save',_0x9b59('0x1'),_0x9b59('0x2')];function createListener(_0x402d8a,_0x644dfd){return function(_0x5c9cdb){_0x644dfd[_0x9b59('0x3')](_0x402d8a,_0x5c9cdb);};}function removeListener(_0x8b6f5,_0x4fa92d){return function(){UserEvents[_0x9b59('0x4')](_0x8b6f5,_0x4fa92d);};}exports[_0x9b59('0x5')]=function(_0xc2990a){for(var _0x44134e=0x0,_0x359342=events[_0x9b59('0x6')];_0x44134e<_0x359342;_0x44134e++){var _0x1d7fb2=events[_0x44134e];var _0x357928=createListener(_0x9b59('0x7')+_0x1d7fb2,_0xc2990a);UserEvents['on'](_0x1d7fb2,_0x357928);}}; \ No newline at end of file +var _0x91b6=['save','remove','emit','register','length','./user.events'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x91b6,0xe3));var _0x691b=function(_0x504575,_0x1ad9e0){_0x504575=_0x504575-0x0;var _0x4484cc=_0x91b6[_0x504575];return _0x4484cc;};'use strict';var UserEvents=require(_0x691b('0x0'));var events=[_0x691b('0x1'),_0x691b('0x2'),'update'];function createListener(_0x1a6b0f,_0x1e6eca){return function(_0x424183){_0x1e6eca[_0x691b('0x3')](_0x1a6b0f,_0x424183);};}function removeListener(_0x548b67,_0x210df1){return function(){UserEvents['removeListener'](_0x548b67,_0x210df1);};}exports[_0x691b('0x4')]=function(_0x250f01){for(var _0x4c4813=0x0,_0x39ff7f=events[_0x691b('0x5')];_0x4c4813<_0x39ff7f;_0x4c4813++){var _0x5d0128=events[_0x4c4813];var _0x13d9e1=createListener('user:'+_0x5d0128,_0x250f01);UserEvents['on'](_0x5d0128,_0x13d9e1);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 28de85b..320ee27 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x356005,_0x411466){var _0x2bb35b=function(_0x449cfb){while(--_0x449cfb){_0x356005['push'](_0x356005['shift']());}};_0x2bb35b(++_0x411466);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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(_0x21bb2f,_0x4199b9){var _0x279b0e=function(_0x4014b5){while(--_0x4014b5){_0x21bb2f['push'](_0x21bb2f['shift']());}};_0x279b0e(++_0x4199b9);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index eb5613b..a7ffb34 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 _0x850f=['sequelize','exports','INTEGER'];(function(_0x2dfd7d,_0x2ecd18){var _0x23eacc=function(_0xbe5c8f){while(--_0xbe5c8f){_0x2dfd7d['push'](_0x2dfd7d['shift']());}};_0x23eacc(++_0x2ecd18);}(_0x850f,0xff));var _0xf850=function(_0x2171f5,_0x3c5bd6){_0x2171f5=_0x2171f5-0x0;var _0x2bee9c=_0x850f[_0x2171f5];return _0x2bee9c;};'use strict';var Sequelize=require(_0xf850('0x0'));module[_0xf850('0x1')]={'penalty':{'type':Sequelize[_0xf850('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4444=['exports','sequelize'];(function(_0x26f2e3,_0x327271){var _0x116418=function(_0x5cd5b9){while(--_0x5cd5b9){_0x26f2e3['push'](_0x26f2e3['shift']());}};_0x116418(++_0x327271);}(_0x4444,0xa3));var _0x4444=function(_0x4f51f9,_0x5d5613){_0x4f51f9=_0x4f51f9-0x0;var _0x533984=_0x4444[_0x4f51f9];return _0x533984;};'use strict';var Sequelize=require(_0x4444('0x0'));module[_0x4444('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 a01e7bd..19651e9 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 _0x9039=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x490c45,_0x97b829){var _0x82738e=function(_0x215c17){while(--_0x215c17){_0x490c45['push'](_0x490c45['shift']());}};_0x82738e(++_0x97b829);}(_0x9039,0x19e));var _0x9903=function(_0x464e74,_0x583c17){_0x464e74=_0x464e74-0x0;var _0x439c03=_0x9039[_0x464e74];return _0x439c03;};'use strict';var _=require(_0x9903('0x0'));var util=require(_0x9903('0x1'));var logger=require(_0x9903('0x2'))(_0x9903('0x3'));var moment=require(_0x9903('0x4'));var BPromise=require(_0x9903('0x5'));var rp=require(_0x9903('0x6'));var fs=require('fs');var path=require(_0x9903('0x7'));var rimraf=require(_0x9903('0x8'));var config=require(_0x9903('0x9'));var attributes=require(_0x9903('0xa'));module[_0x9903('0xb')]=function(_0x46032a,_0x1bc689){return _0x46032a['define'](_0x9903('0xc'),attributes,{'tableName':_0x9903('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa947=['exports','UserChatQueue','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x4dd521,_0x17c78b){var _0x1e9302=function(_0x5ab9bb){while(--_0x5ab9bb){_0x4dd521['push'](_0x4dd521['shift']());}};_0x1e9302(++_0x17c78b);}(_0xa947,0x91));var _0x7a94=function(_0x1a0c98,_0x102853){_0x1a0c98=_0x1a0c98-0x0;var _0x47e29f=_0xa947[_0x1a0c98];return _0x47e29f;};'use strict';var _=require(_0x7a94('0x0'));var util=require(_0x7a94('0x1'));var logger=require(_0x7a94('0x2'))(_0x7a94('0x3'));var moment=require('moment');var BPromise=require(_0x7a94('0x4'));var rp=require(_0x7a94('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a94('0x6'));var config=require(_0x7a94('0x7'));var attributes=require(_0x7a94('0x8'));module[_0x7a94('0x9')]=function(_0x5201bd,_0x10f518){return _0x5201bd['define'](_0x7a94('0xa'),attributes,{'tableName':'user_has_chat_queues','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 f2c7947..ab1644e 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 _0x643a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x4dedb3,_0xea9838){var _0x2f196f=function(_0x390b06){while(--_0x390b06){_0x4dedb3['push'](_0x4dedb3['shift']());}};_0x2f196f(++_0xea9838);}(_0x643a,0x84));var _0xa643=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0x643a[_0x1b6311];return _0x25aab6;};'use strict';var _=require(_0xa643('0x0'));var util=require(_0xa643('0x1'));var moment=require(_0xa643('0x2'));var BPromise=require(_0xa643('0x3'));var rs=require(_0xa643('0x4'));var fs=require('fs');var Redis=require(_0xa643('0x5'));var db=require(_0xa643('0x6'))['db'];var utils=require(_0xa643('0x7'));var logger=require(_0xa643('0x8'))(_0xa643('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa643('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2431e8,_0x2c6037,_0xaf3d60){return new BPromise(function(_0x140055,_0x43ed18){return client[_0xa643('0xb')](_0x2431e8,_0xaf3d60)[_0xa643('0xc')](function(_0x45bdb5){logger[_0xa643('0xd')](_0xa643('0xe'),_0x2c6037,_0xa643('0xf'));logger[_0xa643('0x10')](_0xa643('0x11'),_0x2c6037,_0xa643('0xf'),JSON[_0xa643('0x12')](_0x45bdb5));if(_0x45bdb5[_0xa643('0x13')]){if(_0x45bdb5[_0xa643('0x13')]['code']===0x1f4){logger[_0xa643('0x13')](_0xa643('0xe'),_0x2c6037,_0x45bdb5[_0xa643('0x13')][_0xa643('0x14')]);return _0x43ed18(_0x45bdb5[_0xa643('0x13')][_0xa643('0x14')]);}logger['error'](_0xa643('0xe'),_0x2c6037,_0x45bdb5['error'][_0xa643('0x14')]);return _0x140055(_0x45bdb5['error']['message']);}else{logger[_0xa643('0xd')](_0xa643('0xe'),_0x2c6037,'request\x20sent');_0x140055(_0x45bdb5[_0xa643('0x15')][_0xa643('0x14')]);}})['catch'](function(_0x2e8c0c){logger[_0xa643('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x2c6037,_0x2e8c0c);_0x43ed18(_0x2e8c0c);});});} \ No newline at end of file +var _0x9984=['../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9984,0xbe));var _0x4998=function(_0x578216,_0x40305c){_0x578216=_0x578216-0x0;var _0x516eb6=_0x9984[_0x578216];return _0x516eb6;};'use strict';var _=require(_0x4998('0x0'));var util=require(_0x4998('0x1'));var moment=require(_0x4998('0x2'));var BPromise=require(_0x4998('0x3'));var rs=require(_0x4998('0x4'));var fs=require('fs');var Redis=require(_0x4998('0x5'));var db=require(_0x4998('0x6'))['db'];var utils=require(_0x4998('0x7'));var logger=require(_0x4998('0x8'))(_0x4998('0x9'));var config=require(_0x4998('0xa'));var jayson=require(_0x4998('0xb'));var client=jayson[_0x4998('0xc')][_0x4998('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x54e7a0,_0x468545,_0x59ded9){return new BPromise(function(_0x3aa8bc,_0x24fb5b){return client[_0x4998('0xe')](_0x54e7a0,_0x59ded9)[_0x4998('0xf')](function(_0x351988){logger[_0x4998('0x10')](_0x4998('0x11'),_0x468545,_0x4998('0x12'));logger[_0x4998('0x13')](_0x4998('0x14'),_0x468545,_0x4998('0x12'),JSON['stringify'](_0x351988));if(_0x351988['error']){if(_0x351988['error'][_0x4998('0x15')]===0x1f4){logger[_0x4998('0x16')](_0x4998('0x11'),_0x468545,_0x351988[_0x4998('0x16')][_0x4998('0x17')]);return _0x24fb5b(_0x351988[_0x4998('0x16')][_0x4998('0x17')]);}logger[_0x4998('0x16')](_0x4998('0x11'),_0x468545,_0x351988['error']['message']);return _0x3aa8bc(_0x351988['error'][_0x4998('0x17')]);}else{logger['info'](_0x4998('0x11'),_0x468545,_0x4998('0x12'));_0x3aa8bc(_0x351988['result'][_0x4998('0x17')]);}})[_0x4998('0x18')](function(_0x54ade8){logger[_0x4998('0x16')](_0x4998('0x11'),_0x468545,_0x54ade8);_0x24fb5b(_0x54ade8);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c1b6897..9fd025b 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1d89f7,_0x5330a8){var _0x349f29=function(_0x3a4c39){while(--_0x3a4c39){_0x1d89f7['push'](_0x1d89f7['shift']());}};_0x349f29(++_0x5330a8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xcb91[_0x35fabd];return _0x61a8ee;};'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 +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x55b86a,_0x9f9772){var _0x46f950=function(_0x3113b0){while(--_0x3113b0){_0x55b86a['push'](_0x55b86a['shift']());}};_0x46f950(++_0x9f9772);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c1c7249..7582776 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 _0x6376=['STRING','sequelize','exports','INTEGER'];(function(_0x2c63be,_0x420eea){var _0x3e803a=function(_0x220ee0){while(--_0x220ee0){_0x2c63be['push'](_0x2c63be['shift']());}};_0x3e803a(++_0x420eea);}(_0x6376,0x99));var _0x6637=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6376[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x6637('0x0'));module[_0x6637('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6637('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6637('0x3')]}}; \ No newline at end of file +var _0xda02=['INTEGER'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0xda02,0x77));var _0x2da0=function(_0x8854f2,_0x79542c){_0x8854f2=_0x8854f2-0x0;var _0x38505d=_0xda02[_0x8854f2];return _0x38505d;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x2da0('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2da0('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 66e7bbd..88fd866 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 _0xff89=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b0da2,_0x306d66){var _0x45a240=function(_0x557598){while(--_0x557598){_0x3b0da2['push'](_0x3b0da2['shift']());}};_0x45a240(++_0x306d66);}(_0xff89,0x19e));var _0x9ff8=function(_0x6e01b4,_0x430cd8){_0x6e01b4=_0x6e01b4-0x0;var _0x2c9980=_0xff89[_0x6e01b4];return _0x2c9980;};'use strict';var _=require(_0x9ff8('0x0'));var util=require(_0x9ff8('0x1'));var logger=require(_0x9ff8('0x2'))(_0x9ff8('0x3'));var moment=require(_0x9ff8('0x4'));var BPromise=require(_0x9ff8('0x5'));var rp=require(_0x9ff8('0x6'));var fs=require('fs');var path=require(_0x9ff8('0x7'));var rimraf=require(_0x9ff8('0x8'));var config=require(_0x9ff8('0x9'));var attributes=require(_0x9ff8('0xa'));module[_0x9ff8('0xb')]=function(_0x2e844a,_0x53a3e4){return _0x2e844a[_0x9ff8('0xc')](_0x9ff8('0xd'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9612=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','moment','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9612,0xa5));var _0x2961=function(_0x10b6ad,_0x2316a4){_0x10b6ad=_0x10b6ad-0x0;var _0x586a07=_0x9612[_0x10b6ad];return _0x586a07;};'use strict';var _=require(_0x2961('0x0'));var util=require(_0x2961('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2961('0x2'));var BPromise=require('bluebird');var rp=require(_0x2961('0x3'));var fs=require('fs');var path=require(_0x2961('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2961('0x5'));module[_0x2961('0x6')]=function(_0x438082,_0x2798b1){return _0x438082[_0x2961('0x7')](_0x2961('0x8'),attributes,{'tableName':_0x2961('0x9'),'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 45751a0..f7fc883 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 _0xf012=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xf012,0x1db));var _0x2f01=function(_0x41af7c,_0x1ffcfa){_0x41af7c=_0x41af7c-0x0;var _0x3ee1a2=_0xf012[_0x41af7c];return _0x3ee1a2;};'use strict';var _=require('lodash');var util=require(_0x2f01('0x0'));var moment=require(_0x2f01('0x1'));var BPromise=require(_0x2f01('0x2'));var rs=require(_0x2f01('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f01('0x4'))['db'];var utils=require(_0x2f01('0x5'));var logger=require(_0x2f01('0x6'))(_0x2f01('0x7'));var config=require(_0x2f01('0x8'));var jayson=require(_0x2f01('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x577b2f,_0x29dd81,_0x1fc31e){return new BPromise(function(_0x5104b4,_0x1ca04a){return client[_0x2f01('0xa')](_0x577b2f,_0x1fc31e)['then'](function(_0x519941){logger[_0x2f01('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x29dd81,_0x2f01('0xc'));logger[_0x2f01('0xd')](_0x2f01('0xe'),_0x29dd81,_0x2f01('0xc'),JSON[_0x2f01('0xf')](_0x519941));if(_0x519941[_0x2f01('0x10')]){if(_0x519941[_0x2f01('0x10')]['code']===0x1f4){logger[_0x2f01('0x10')](_0x2f01('0x11'),_0x29dd81,_0x519941['error'][_0x2f01('0x12')]);return _0x1ca04a(_0x519941[_0x2f01('0x10')][_0x2f01('0x12')]);}logger['error'](_0x2f01('0x11'),_0x29dd81,_0x519941[_0x2f01('0x10')]['message']);return _0x5104b4(_0x519941[_0x2f01('0x10')][_0x2f01('0x12')]);}else{logger[_0x2f01('0xb')](_0x2f01('0x11'),_0x29dd81,_0x2f01('0xc'));_0x5104b4(_0x519941['result']['message']);}})[_0x2f01('0x13')](function(_0x5acabc){logger[_0x2f01('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x29dd81,_0x5acabc);_0x1ca04a(_0x5acabc);});});} \ No newline at end of file +var _0x935a=['client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x49199d,_0x241c86){var _0x1b6419=function(_0x2aa0b6){while(--_0x2aa0b6){_0x49199d['push'](_0x49199d['shift']());}};_0x1b6419(++_0x241c86);}(_0x935a,0x90));var _0xa935=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x935a[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xa935('0x0'));var util=require(_0xa935('0x1'));var moment=require(_0xa935('0x2'));var BPromise=require(_0xa935('0x3'));var rs=require(_0xa935('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa935('0x5'))['db'];var utils=require(_0xa935('0x6'));var logger=require(_0xa935('0x7'))('rpc');var config=require(_0xa935('0x8'));var jayson=require(_0xa935('0x9'));var client=jayson[_0xa935('0xa')][_0xa935('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c6516,_0x18444b,_0x592392){return new BPromise(function(_0x45415c,_0x551e2f){return client[_0xa935('0xc')](_0x5c6516,_0x592392)[_0xa935('0xd')](function(_0x1eef97){logger[_0xa935('0xe')](_0xa935('0xf'),_0x18444b,_0xa935('0x10'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x18444b,_0xa935('0x10'),JSON['stringify'](_0x1eef97));if(_0x1eef97['error']){if(_0x1eef97['error'][_0xa935('0x11')]===0x1f4){logger[_0xa935('0x12')](_0xa935('0xf'),_0x18444b,_0x1eef97[_0xa935('0x12')][_0xa935('0x13')]);return _0x551e2f(_0x1eef97['error'][_0xa935('0x13')]);}logger[_0xa935('0x12')](_0xa935('0xf'),_0x18444b,_0x1eef97['error']['message']);return _0x45415c(_0x1eef97[_0xa935('0x12')][_0xa935('0x13')]);}else{logger[_0xa935('0xe')](_0xa935('0xf'),_0x18444b,_0xa935('0x10'));_0x45415c(_0x1eef97[_0xa935('0x14')]['message']);}})[_0xa935('0x15')](function(_0x19bc09){logger['error'](_0xa935('0xf'),_0x18444b,_0x19bc09);_0x551e2f(_0x19bc09);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b369547..f7f8786 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1b1424,_0x3ea9b5){var _0x1b6445=function(_0x34bbc0){while(--_0x34bbc0){_0x1b1424['push'](_0x1b1424['shift']());}};_0x1b6445(++_0x3ea9b5);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a27b3,_0x2adbc7){var _0x29699e=function(_0x46e8e0){while(--_0x46e8e0){_0x1a27b3['push'](_0x1a27b3['shift']());}};_0x29699e(++_0x2adbc7);}(_0xe706,0xa3));var _0x6e70=function(_0x5eb1a8,_0x30e664){_0x5eb1a8=_0x5eb1a8-0x0;var _0x14c11c=_0xe706[_0x5eb1a8];return _0x14c11c;};'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 diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ce2d4a2..cfb5bcd 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 _0xccee=['sequelize','INTEGER'];(function(_0x57d932,_0x2e854a){var _0xc7be7f=function(_0x57c9a1){while(--_0x57c9a1){_0x57d932['push'](_0x57d932['shift']());}};_0xc7be7f(++_0x2e854a);}(_0xccee,0x124));var _0xecce=function(_0x3e30d9,_0x48abcd){_0x3e30d9=_0x3e30d9-0x0;var _0x2194b6=_0xccee[_0x3e30d9];return _0x2194b6;};'use strict';var Sequelize=require(_0xecce('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xecce('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8daf=['exports','sequelize'];(function(_0x36fcbf,_0x5cf98a){var _0x4c41ea=function(_0x219dae){while(--_0x219dae){_0x36fcbf['push'](_0x36fcbf['shift']());}};_0x4c41ea(++_0x5cf98a);}(_0x8daf,0xf9));var _0xf8da=function(_0x2fcadf,_0x401da6){_0x2fcadf=_0x2fcadf-0x0;var _0x2a2c05=_0x8daf[_0x2fcadf];return _0x2a2c05;};'use strict';var Sequelize=require(_0xf8da('0x0'));module[_0xf8da('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 c6c90b4..21e28f7 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 _0x8947=['lodash','util','api','bluebird','request-promise','path','../../config/environment','exports','define','user_has_mail_queues'];(function(_0x182823,_0x4f3a37){var _0x57b848=function(_0x2a9cb2){while(--_0x2a9cb2){_0x182823['push'](_0x182823['shift']());}};_0x57b848(++_0x4f3a37);}(_0x8947,0xaa));var _0x7894=function(_0x2e0def,_0x359c85){_0x2e0def=_0x2e0def-0x0;var _0x119e85=_0x8947[_0x2e0def];return _0x119e85;};'use strict';var _=require(_0x7894('0x0'));var util=require(_0x7894('0x1'));var logger=require('../../config/logger')(_0x7894('0x2'));var moment=require('moment');var BPromise=require(_0x7894('0x3'));var rp=require(_0x7894('0x4'));var fs=require('fs');var path=require(_0x7894('0x5'));var rimraf=require('rimraf');var config=require(_0x7894('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x7894('0x7')]=function(_0x283a42,_0x45a998){return _0x283a42[_0x7894('0x8')]('UserMailQueue',attributes,{'tableName':_0x7894('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe356=['./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe356,0x18a));var _0x6e35=function(_0x395888,_0x3ed7be){_0x395888=_0x395888-0x0;var _0xbf8435=_0xe356[_0x395888];return _0xbf8435;};'use strict';var _=require(_0x6e35('0x0'));var util=require(_0x6e35('0x1'));var logger=require(_0x6e35('0x2'))('api');var moment=require(_0x6e35('0x3'));var BPromise=require(_0x6e35('0x4'));var rp=require(_0x6e35('0x5'));var fs=require('fs');var path=require(_0x6e35('0x6'));var rimraf=require(_0x6e35('0x7'));var config=require(_0x6e35('0x8'));var attributes=require(_0x6e35('0x9'));module['exports']=function(_0x24f21c,_0x629e29){return _0x24f21c[_0x6e35('0xa')](_0x6e35('0xb'),attributes,{'tableName':_0x6e35('0xc'),'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 b82d5ff..81c146a 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x197a46,_0xd6f910){var _0x4bee51=function(_0x24a910){while(--_0x24a910){_0x197a46['push'](_0x197a46['shift']());}};_0x4bee51(++_0xd6f910);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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']('UserMailQueue,\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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7217,0x19e));var _0x7721=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x7217[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 70763e2..8e220a3 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 _0xb497=['../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x28a49d,_0x418c3c){var _0x30adf9=function(_0x58c12e){while(--_0x58c12e){_0x28a49d['push'](_0x28a49d['shift']());}};_0x30adf9(++_0x418c3c);}(_0xb497,0x13d));var _0x7b49=function(_0x4595c9,_0x40d935){_0x4595c9=_0x4595c9-0x0;var _0x576e3c=_0xb497[_0x4595c9];return _0x576e3c;};'use strict';var multer=require(_0x7b49('0x0'));var util=require(_0x7b49('0x1'));var path=require(_0x7b49('0x2'));var timeout=require(_0x7b49('0x3'));var express=require('express');var router=express[_0x7b49('0x4')]();var fs_extra=require(_0x7b49('0x5'));var auth=require(_0x7b49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7b49('0x7'));var controller=require(_0x7b49('0x8'));router[_0x7b49('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b49('0xa')]);module[_0x7b49('0xb')]=router; \ No newline at end of file +var _0x3d19=['fs-extra','../../components/auth/service','../../components/interaction/service','post','isAuthenticated','exports','multer','path','connect-timeout','express','Router'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x3d19,0x171));var _0x93d1=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x3d19[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0x93d1('0x0'));var util=require('util');var path=require(_0x93d1('0x1'));var timeout=require(_0x93d1('0x2'));var express=require(_0x93d1('0x3'));var router=express[_0x93d1('0x4')]();var fs_extra=require(_0x93d1('0x5'));var auth=require(_0x93d1('0x6'));var interaction=require(_0x93d1('0x7'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x93d1('0x8')]('/',auth[_0x93d1('0x9')](),controller['sendUserNotification']);module[_0x93d1('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 5807e48..deadc22 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 _0x7bfc=['sequelize','TEXT','STRING'];(function(_0x286306,_0x534c34){var _0x509b8b=function(_0xd7ad21){while(--_0xd7ad21){_0x286306['push'](_0x286306['shift']());}};_0x509b8b(++_0x534c34);}(_0x7bfc,0xa2));var _0xc7bf=function(_0x1df216,_0x5bfc61){_0x1df216=_0x1df216-0x0;var _0xab53b1=_0x7bfc[_0x1df216];return _0xab53b1;};'use strict';var Sequelize=require(_0xc7bf('0x0'));module['exports']={'body':{'type':Sequelize[_0xc7bf('0x1')]},'senderName':{'type':Sequelize[_0xc7bf('0x2')]},'recipientsId':{'type':Sequelize[_0xc7bf('0x1')]},'recipientsDescription':{'type':Sequelize[_0xc7bf('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xa930=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0xa930,0xb0));var _0x0a93=function(_0x3846e4,_0x51dd2c){_0x3846e4=_0x3846e4-0x0;var _0x24657c=_0xa930[_0x3846e4];return _0x24657c;};'use strict';var Sequelize=require(_0x0a93('0x0'));module[_0x0a93('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x0a93('0x2')]},'recipientsDescription':{'type':Sequelize[_0x0a93('0x3')]},'beep':{'type':Sequelize[_0x0a93('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d6bb774..f1d599a 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 _0xfcb3=['queue','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','then','destroy','error','stack','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','union','ids','replace'];(function(_0x231cac,_0x5a7ce6){var _0xe5328b=function(_0x392abd){while(--_0x392abd){_0x231cac['push'](_0x231cac['shift']());}};_0xe5328b(++_0x5a7ce6);}(_0xfcb3,0xd2));var _0x3fcb=function(_0xaafc8c,_0x5e36b6){_0xaafc8c=_0xaafc8c-0x0;var _0x36fbbc=_0xfcb3[_0xaafc8c];return _0x36fbbc;};'use strict';var emlformat=require(_0x3fcb('0x0'));var rimraf=require(_0x3fcb('0x1'));var zipdir=require(_0x3fcb('0x2'));var jsonpatch=require(_0x3fcb('0x3'));var rp=require(_0x3fcb('0x4'));var moment=require(_0x3fcb('0x5'));var BPromise=require(_0x3fcb('0x6'));var Mustache=require(_0x3fcb('0x7'));var util=require(_0x3fcb('0x8'));var path=require(_0x3fcb('0x9'));var sox=require('sox');var csv=require(_0x3fcb('0xa'));var ejs=require(_0x3fcb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fcb('0xc'));var squel=require(_0x3fcb('0xd'));var crypto=require(_0x3fcb('0xe'));var jsforce=require(_0x3fcb('0xf'));var deskjs=require(_0x3fcb('0x10'));var toCsv=require(_0x3fcb('0xa'));var querystring=require('querystring');var Papa=require(_0x3fcb('0x11'));var Redis=require(_0x3fcb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3fcb('0x13'));var as=require(_0x3fcb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fcb('0x15'))(_0x3fcb('0x16'));var utils=require('../../config/utils');var config=require(_0x3fcb('0x17'));var licenseUtil=require(_0x3fcb('0x18'));var db=require(_0x3fcb('0x19'))['db'];config['redis']=_[_0x3fcb('0x1a')](config[_0x3fcb('0x1b')],{'host':_0x3fcb('0x1c'),'port':0x18eb});var socket=require(_0x3fcb('0x1d'))(new Redis(config['redis']));require(_0x3fcb('0x1e'))[_0x3fcb('0x1f')](socket);function respondWithStatusCode(_0x179941,_0x43c7c1){_0x43c7c1=_0x43c7c1||0xcc;return function(_0x52d9a0){if(_0x52d9a0){return _0x179941[_0x3fcb('0x20')](_0x43c7c1);}return _0x179941[_0x3fcb('0x21')](_0x43c7c1)[_0x3fcb('0x22')]();};}function respondWithResult(_0x3673bf,_0x1ebd1b){_0x1ebd1b=_0x1ebd1b||0xc8;return function(_0xf00698){if(_0xf00698){return _0x3673bf[_0x3fcb('0x21')](_0x1ebd1b)[_0x3fcb('0x23')](_0xf00698);}};}function respondWithFilteredResult(_0x144795,_0x282657){return function(_0x258b3d){if(_0x258b3d){var _0x27f95b=typeof _0x282657[_0x3fcb('0x24')]==='undefined'&&typeof _0x282657['limit']===_0x3fcb('0x25');var _0x386075=_0x258b3d[_0x3fcb('0x26')];var _0x143d70=_0x27f95b?0x0:_0x282657['offset'];var _0x1f2b1a=_0x27f95b?_0x258b3d[_0x3fcb('0x26')]:_0x282657['offset']+_0x282657[_0x3fcb('0x27')];var _0x29e0d0;if(_0x1f2b1a>=_0x386075){_0x1f2b1a=_0x386075;_0x29e0d0=0xc8;}else{_0x29e0d0=0xce;}_0x144795[_0x3fcb('0x21')](_0x29e0d0);return _0x144795[_0x3fcb('0x28')](_0x3fcb('0x29'),_0x143d70+'-'+_0x1f2b1a+'/'+_0x386075)['json'](_0x258b3d);}return null;};}function patchUpdates(_0x4384d5){return function(_0x2e6ade){try{jsonpatch['apply'](_0x2e6ade,_0x4384d5,!![]);}catch(_0x14c993){return BPromise[_0x3fcb('0x2a')](_0x14c993);}return _0x2e6ade['save']();};}function saveUpdates(_0x1d5fb3,_0x6632bb){return function(_0x2c5e26){if(_0x2c5e26){return _0x2c5e26['update'](_0x1d5fb3)[_0x3fcb('0x2b')](function(_0x21c8e9){return _0x21c8e9;});}return null;};}function removeEntity(_0x20d28d,_0x5a239e){return function(_0x3a6ecf){if(_0x3a6ecf){return _0x3a6ecf[_0x3fcb('0x2c')]()[_0x3fcb('0x2b')](function(){_0x20d28d[_0x3fcb('0x21')](0xcc)[_0x3fcb('0x22')]();});}};}function handleEntityNotFound(_0x16e3b9,_0x43b3e0){return function(_0x338b4d){if(!_0x338b4d){_0x16e3b9[_0x3fcb('0x20')](0x194);}return _0x338b4d;};}function handleError(_0x3f106e,_0x316c01){_0x316c01=_0x316c01||0x1f4;return function(_0x2bce6d){logger[_0x3fcb('0x2d')](_0x2bce6d[_0x3fcb('0x2e')]);if(_0x2bce6d['name']){delete _0x2bce6d['name'];}_0x3f106e[_0x3fcb('0x21')](_0x316c01)[_0x3fcb('0x2f')](_0x2bce6d);};}exports[_0x3fcb('0x30')]=function(_0x552dc2,_0x3828fa,_0x2d6629){if(!_0x552dc2[_0x3fcb('0x31')][_0x3fcb('0x32')](_0x3fcb('0x33'))&&!_0x552dc2[_0x3fcb('0x31')][_0x3fcb('0x32')](_0x3fcb('0x34'))){throw new db[(_0x3fcb('0x35'))][(_0x3fcb('0x36'))](_0x3fcb('0x37'));}else{if(_0x552dc2[_0x3fcb('0x31')][_0x3fcb('0x32')](_0x3fcb('0x34'))&&!_0x552dc2['body'][_0x3fcb('0x32')](_0x3fcb('0x38'))){throw new db[(_0x3fcb('0x35'))][(_0x3fcb('0x36'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x552dc2[_0x3fcb('0x31')]['hasOwnProperty'](_0x3fcb('0x39'))){throw new db[(_0x3fcb('0x35'))][(_0x3fcb('0x36'))](_0x3fcb('0x3a'));}else{try{var _0x5a9307=JSON[_0x3fcb('0x3b')](_0x552dc2[_0x3fcb('0x31')]['recipients']);}catch(_0x44b411){logger[_0x3fcb('0x2d')](_0x44b411);throw new db['Sequelize'][(_0x3fcb('0x36'))](_0x3fcb('0x3c'));}var _0x32b564=[_0x3fcb('0x3d'),_0x3fcb('0x3e'),'mailqueue',_0x3fcb('0x3f'),_0x3fcb('0x40'),_0x3fcb('0x41'),_0x3fcb('0x42'),_0x3fcb('0x43'),_0x3fcb('0x44')];if(_[_0x3fcb('0x45')](_0x5a9307,function(_0x3dd12e){return!_[_0x3fcb('0x46')](_0x32b564,_0x3dd12e[_0x3fcb('0x47')][_0x3fcb('0x48')]());})){throw new db[(_0x3fcb('0x35'))]['ValidationError'](_0x3fcb('0x49'));}}}var _0x45e9a5={};_0x45e9a5[_0x3fcb('0x4a')]=_0x552dc2[_0x3fcb('0x31')][_0x3fcb('0x32')](_0x3fcb('0x4a'))?_0x552dc2['body'][_0x3fcb('0x4a')]:_0x552dc2[_0x3fcb('0x44')][_0x3fcb('0x4b')];_0x45e9a5[_0x3fcb('0x4c')]=_[_0x3fcb('0x4d')](_0x552dc2['body'][_0x3fcb('0x4c')])?null:_0x552dc2[_0x3fcb('0x31')][_0x3fcb('0x4c')];_0x45e9a5[_0x3fcb('0x4e')]=_0x552dc2[_0x3fcb('0x31')][_0x3fcb('0x4e')]||![];_0x45e9a5[_0x3fcb('0x4f')]=_0x552dc2[_0x3fcb('0x44')]['id'];return getContent(_0x552dc2[_0x3fcb('0x31')])[_0x3fcb('0x2b')](function(_0x24c228){_0x45e9a5[_0x3fcb('0x31')]=_0x24c228;return getRecipients(_0x5a9307);})[_0x3fcb('0x2b')](function(_0x47d65f){_0x45e9a5['recipientsId']=_['sortBy'](_0x47d65f)[_0x3fcb('0x50')](',');return db[_0x3fcb('0x51')][_0x3fcb('0x52')](function(_0x49b665){return db[_0x3fcb('0x53')][_0x3fcb('0x54')](_0x45e9a5,{'raw':!![],'transaction':_0x49b665})[_0x3fcb('0x2b')](function(_0x172ebf){var _0x71d123={'sender':_0x45e9a5[_0x3fcb('0x4a')],'description':_0x45e9a5[_0x3fcb('0x4c')],'content':_0x45e9a5[_0x3fcb('0x31')],'beep':_0x45e9a5[_0x3fcb('0x4e')]};_0x47d65f[_0x3fcb('0x55')](function(_0x2b75df){_0x71d123[_0x3fcb('0x56')]=_0x2b75df;socket[_0x3fcb('0x57')](_0x3fcb('0x58'),_0x71d123);});return _0x172ebf;});});})['then'](respondWithResult(_0x3828fa,0xc9))['catch'](handleError(_0x3828fa,null));};function getContent(_0x5b49ae){return new BPromise(function(_0x276c2f,_0x1e2749){if(_0x5b49ae['text']){_0x276c2f(_0x5b49ae[_0x3fcb('0x33')]);return;}return db[_0x3fcb('0x59')][_0x3fcb('0x5a')]({'attributes':[_0x3fcb('0x5b')],'where':{'id':_0x5b49ae[_0x3fcb('0x34')]},'raw':!![]})['then'](function(_0x36b878){if(!_0x36b878)throw new db[(_0x3fcb('0x35'))][(_0x3fcb('0x36'))](_0x3fcb('0x5c'));var _0x25b95a=Mustache[_0x3fcb('0x5d')](_0x36b878['html'],_0x5b49ae[_0x3fcb('0x38')]);_0x276c2f(_0x25b95a);})[_0x3fcb('0x5e')](function(_0x1c4802){_0x1e2749(_0x1c4802);});});}function getRecipients(_0x359f79){return new BPromise(function(_0x37260d,_0x54d96a){var _0x5ef117=[];var _0x93518=[];_0x359f79[_0x3fcb('0x55')](function(_0x1f0049){var _0x2c6856=_[_0x3fcb('0x5f')](_0x1f0049[_0x3fcb('0x47')][_0x3fcb('0x48')]());if(_0x2c6856==='User'){_0x5ef117=_[_0x3fcb('0x60')](_0x5ef117,_0x1f0049[_0x3fcb('0x61')]);}else{if(_['includes'](_0x2c6856,'queue'))_0x2c6856=_0x2c6856[_0x3fcb('0x62')](_0x3fcb('0x63'),'Queue');_0x1f0049[_0x3fcb('0x61')]['forEach'](function(_0x3df025){_0x93518['push'](getAgents(_0x2c6856,_0x3df025));});}});return BPromise[_0x3fcb('0x64')](_0x93518)[_0x3fcb('0x2b')](function(_0x26d7f9){_0x5ef117=_[_0x3fcb('0x60')](_0x5ef117,_[_0x3fcb('0x65')](_0x26d7f9));_0x37260d(_0x5ef117);})[_0x3fcb('0x5e')](function(_0x1b5f86){_0x54d96a(_0x1b5f86);});});}function getAgents(_0x549c9a,_0x1220d9){return new BPromise(function(_0xf9e0cb,_0x80baa7){return db[_0x549c9a][_0x3fcb('0x5a')]({'where':{'id':_0x1220d9}})[_0x3fcb('0x2b')](function(_0x53231b){return _0x53231b['getAgents']({'attributes':['id'],'raw':!![]})[_0x3fcb('0x2b')](function(_0x132f15){var _0x753fa8=_[_0x3fcb('0x66')](_0x132f15,'id');_0xf9e0cb(_0x753fa8);});})[_0x3fcb('0x5e')](function(_0x5bad88){_0x80baa7(_0x5bad88);});});} \ No newline at end of file +var _0xf663=['team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','union','ids','queue','Queue','push','all','flatten','getAgents','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','openchannelqueue','smsqueue','whatsappqueue'];(function(_0x4a9ace,_0x7d6f0c){var _0x48ceab=function(_0x37bfcf){while(--_0x37bfcf){_0x4a9ace['push'](_0x4a9ace['shift']());}};_0x48ceab(++_0x7d6f0c);}(_0xf663,0xe9));var _0x3f66=function(_0x335b77,_0x273122){_0x335b77=_0x335b77-0x0;var _0x27114a=_0xf663[_0x335b77];return _0x27114a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f66('0x0'));var jsonpatch=require(_0x3f66('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f66('0x2'));var Mustache=require(_0x3f66('0x3'));var util=require(_0x3f66('0x4'));var path=require(_0x3f66('0x5'));var sox=require(_0x3f66('0x6'));var csv=require(_0x3f66('0x7'));var ejs=require(_0x3f66('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f66('0x9'));var crypto=require('crypto');var jsforce=require(_0x3f66('0xa'));var deskjs=require(_0x3f66('0xb'));var toCsv=require(_0x3f66('0x7'));var querystring=require(_0x3f66('0xc'));var Papa=require(_0x3f66('0xd'));var Redis=require(_0x3f66('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3f66('0xf'));var as=require(_0x3f66('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f66('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3f66('0x12'));var licenseUtil=require(_0x3f66('0x13'));var db=require(_0x3f66('0x14'))['db'];config[_0x3f66('0x15')]=_['defaults'](config[_0x3f66('0x15')],{'host':_0x3f66('0x16'),'port':0x18eb});var socket=require(_0x3f66('0x17'))(new Redis(config['redis']));require(_0x3f66('0x18'))[_0x3f66('0x19')](socket);function respondWithStatusCode(_0x3ccbd1,_0x3d8278){_0x3d8278=_0x3d8278||0xcc;return function(_0x559234){if(_0x559234){return _0x3ccbd1[_0x3f66('0x1a')](_0x3d8278);}return _0x3ccbd1[_0x3f66('0x1b')](_0x3d8278)[_0x3f66('0x1c')]();};}function respondWithResult(_0x4f82b2,_0x288a0a){_0x288a0a=_0x288a0a||0xc8;return function(_0x892566){if(_0x892566){return _0x4f82b2[_0x3f66('0x1b')](_0x288a0a)['json'](_0x892566);}};}function respondWithFilteredResult(_0xc8836e,_0x57584e){return function(_0x1b9935){if(_0x1b9935){var _0x439f2e=typeof _0x57584e[_0x3f66('0x1d')]===_0x3f66('0x1e')&&typeof _0x57584e[_0x3f66('0x1f')]===_0x3f66('0x1e');var _0xc85f6f=_0x1b9935[_0x3f66('0x20')];var _0x303952=_0x439f2e?0x0:_0x57584e['offset'];var _0x35c337=_0x439f2e?_0x1b9935[_0x3f66('0x20')]:_0x57584e[_0x3f66('0x1d')]+_0x57584e[_0x3f66('0x1f')];var _0x432dfa;if(_0x35c337>=_0xc85f6f){_0x35c337=_0xc85f6f;_0x432dfa=0xc8;}else{_0x432dfa=0xce;}_0xc8836e[_0x3f66('0x1b')](_0x432dfa);return _0xc8836e[_0x3f66('0x21')](_0x3f66('0x22'),_0x303952+'-'+_0x35c337+'/'+_0xc85f6f)['json'](_0x1b9935);}return null;};}function patchUpdates(_0x3a5d7c){return function(_0x9d51a3){try{jsonpatch[_0x3f66('0x23')](_0x9d51a3,_0x3a5d7c,!![]);}catch(_0x967e20){return BPromise[_0x3f66('0x24')](_0x967e20);}return _0x9d51a3[_0x3f66('0x25')]();};}function saveUpdates(_0x181bf4,_0x37c116){return function(_0x3032c4){if(_0x3032c4){return _0x3032c4[_0x3f66('0x26')](_0x181bf4)[_0x3f66('0x27')](function(_0x2e14a4){return _0x2e14a4;});}return null;};}function removeEntity(_0x32ec6d,_0x18ec92){return function(_0x10f8a7){if(_0x10f8a7){return _0x10f8a7[_0x3f66('0x28')]()[_0x3f66('0x27')](function(){_0x32ec6d[_0x3f66('0x1b')](0xcc)[_0x3f66('0x1c')]();});}};}function handleEntityNotFound(_0x451e93,_0x121f5b){return function(_0x4661bc){if(!_0x4661bc){_0x451e93['sendStatus'](0x194);}return _0x4661bc;};}function handleError(_0x51015a,_0x20d044){_0x20d044=_0x20d044||0x1f4;return function(_0xc3749d){logger[_0x3f66('0x29')](_0xc3749d[_0x3f66('0x2a')]);if(_0xc3749d[_0x3f66('0x2b')]){delete _0xc3749d[_0x3f66('0x2b')];}_0x51015a[_0x3f66('0x1b')](_0x20d044)[_0x3f66('0x2c')](_0xc3749d);};}exports['sendUserNotification']=function(_0x243f54,_0x7a4941,_0x345fe4){if(!_0x243f54[_0x3f66('0x2d')][_0x3f66('0x2e')]('text')&&!_0x243f54['body'][_0x3f66('0x2e')](_0x3f66('0x2f'))){throw new db[(_0x3f66('0x30'))][(_0x3f66('0x31'))](_0x3f66('0x32'));}else{if(_0x243f54[_0x3f66('0x2d')][_0x3f66('0x2e')](_0x3f66('0x2f'))&&!_0x243f54[_0x3f66('0x2d')][_0x3f66('0x2e')](_0x3f66('0x33'))){throw new db[(_0x3f66('0x30'))]['ValidationError'](_0x3f66('0x34'));}if(!_0x243f54[_0x3f66('0x2d')]['hasOwnProperty'](_0x3f66('0x35'))){throw new db[(_0x3f66('0x30'))][(_0x3f66('0x31'))](_0x3f66('0x36'));}else{try{var _0x31c43f=JSON[_0x3f66('0x37')](_0x243f54[_0x3f66('0x2d')][_0x3f66('0x35')]);}catch(_0x5d7e5a){logger[_0x3f66('0x29')](_0x5d7e5a);throw new db['Sequelize'][(_0x3f66('0x31'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x3cdc5f=[_0x3f66('0x38'),_0x3f66('0x39'),'mailqueue',_0x3f66('0x3a'),_0x3f66('0x3b'),'voicequeue',_0x3f66('0x3c'),_0x3f66('0x3d'),_0x3f66('0x3e')];if(_[_0x3f66('0x3f')](_0x31c43f,function(_0x343868){return!_[_0x3f66('0x40')](_0x3cdc5f,_0x343868['model'][_0x3f66('0x41')]());})){throw new db['Sequelize']['ValidationError'](_0x3f66('0x42'));}}}var _0xfb74b1={};_0xfb74b1[_0x3f66('0x43')]=_0x243f54[_0x3f66('0x2d')][_0x3f66('0x2e')](_0x3f66('0x43'))?_0x243f54[_0x3f66('0x2d')][_0x3f66('0x43')]:_0x243f54[_0x3f66('0x3e')]['fullname'];_0xfb74b1[_0x3f66('0x44')]=_[_0x3f66('0x45')](_0x243f54['body'][_0x3f66('0x44')])?null:_0x243f54[_0x3f66('0x2d')][_0x3f66('0x44')];_0xfb74b1[_0x3f66('0x46')]=_0x243f54['body']['beep']||![];_0xfb74b1['SenderId']=_0x243f54[_0x3f66('0x3e')]['id'];return getContent(_0x243f54[_0x3f66('0x2d')])[_0x3f66('0x27')](function(_0x1cd138){_0xfb74b1[_0x3f66('0x2d')]=_0x1cd138;return getRecipients(_0x31c43f);})['then'](function(_0x3597a6){_0xfb74b1[_0x3f66('0x47')]=_[_0x3f66('0x48')](_0x3597a6)[_0x3f66('0x49')](',');return db[_0x3f66('0x4a')][_0x3f66('0x4b')](function(_0x70158c){return db[_0x3f66('0x4c')]['create'](_0xfb74b1,{'raw':!![],'transaction':_0x70158c})[_0x3f66('0x27')](function(_0x30e170){var _0x30bcff={'sender':_0xfb74b1[_0x3f66('0x43')],'description':_0xfb74b1[_0x3f66('0x44')],'content':_0xfb74b1['body'],'beep':_0xfb74b1[_0x3f66('0x46')]};_0x3597a6[_0x3f66('0x4d')](function(_0x27629c){_0x30bcff['recipient']=_0x27629c;socket[_0x3f66('0x4e')](_0x3f66('0x4f'),_0x30bcff);});return _0x30e170;});});})['then'](respondWithResult(_0x7a4941,0xc9))[_0x3f66('0x50')](handleError(_0x7a4941,null));};function getContent(_0x1a3ced){return new BPromise(function(_0xd58eac,_0x2719b3){if(_0x1a3ced[_0x3f66('0x51')]){_0xd58eac(_0x1a3ced[_0x3f66('0x51')]);return;}return db[_0x3f66('0x52')][_0x3f66('0x53')]({'attributes':[_0x3f66('0x54')],'where':{'id':_0x1a3ced[_0x3f66('0x2f')]},'raw':!![]})[_0x3f66('0x27')](function(_0x2cba8a){if(!_0x2cba8a)throw new db[(_0x3f66('0x30'))][(_0x3f66('0x31'))](_0x3f66('0x55'));var _0xd8c616=Mustache[_0x3f66('0x56')](_0x2cba8a[_0x3f66('0x54')],_0x1a3ced[_0x3f66('0x33')]);_0xd58eac(_0xd8c616);})[_0x3f66('0x50')](function(_0x442e29){_0x2719b3(_0x442e29);});});}function getRecipients(_0x4bc9d0){return new BPromise(function(_0x37ac71,_0xbd6f2e){var _0x4f9a58=[];var _0x1c10c5=[];_0x4bc9d0[_0x3f66('0x4d')](function(_0x58ecbe){var _0x5f34f=_[_0x3f66('0x57')](_0x58ecbe[_0x3f66('0x58')][_0x3f66('0x41')]());if(_0x5f34f===_0x3f66('0x59')){_0x4f9a58=_[_0x3f66('0x5a')](_0x4f9a58,_0x58ecbe[_0x3f66('0x5b')]);}else{if(_[_0x3f66('0x40')](_0x5f34f,_0x3f66('0x5c')))_0x5f34f=_0x5f34f['replace']('queue',_0x3f66('0x5d'));_0x58ecbe[_0x3f66('0x5b')][_0x3f66('0x4d')](function(_0x35299c){_0x1c10c5[_0x3f66('0x5e')](getAgents(_0x5f34f,_0x35299c));});}});return BPromise[_0x3f66('0x5f')](_0x1c10c5)[_0x3f66('0x27')](function(_0x549841){_0x4f9a58=_[_0x3f66('0x5a')](_0x4f9a58,_[_0x3f66('0x60')](_0x549841));_0x37ac71(_0x4f9a58);})['catch'](function(_0x2c5587){_0xbd6f2e(_0x2c5587);});});}function getAgents(_0x1315a7,_0x59b295){return new BPromise(function(_0x45a22b,_0x570c5d){return db[_0x1315a7][_0x3f66('0x53')]({'where':{'id':_0x59b295}})[_0x3f66('0x27')](function(_0x374607){return _0x374607[_0x3f66('0x61')]({'attributes':['id'],'raw':!![]})[_0x3f66('0x27')](function(_0x3e175f){var _0x405950=_['map'](_0x3e175f,'id');_0x45a22b(_0x405950);});})[_0x3f66('0x50')](function(_0x1692c2){_0x570c5d(_0x1692c2);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 679018e..d4d03a8 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 _0x7a38=['exports','events','update','remove','emit','hasOwnProperty','hook'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x7a38,0xda));var _0x87a3=function(_0x27d6e9,_0x179407){_0x27d6e9=_0x27d6e9-0x0;var _0x15941a=_0x7a38[_0x27d6e9];return _0x15941a;};'use strict';var EventEmitter=require(_0x87a3('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x87a3('0x1'),'afterDestroy':_0x87a3('0x2')};function emitEvent(_0x479e96){return function(_0x5766ea,_0x22afaa,_0x51179d){UserNotificationEvents['emit'](_0x479e96+':'+_0x5766ea['id'],_0x5766ea);UserNotificationEvents[_0x87a3('0x3')](_0x479e96,_0x5766ea);_0x51179d(null);};}for(var e in events){if(events[_0x87a3('0x4')](e)){var event=events[e];UserNotification[_0x87a3('0x5')](e,emitEvent(event));}}module[_0x87a3('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x17e5=['../../mysqldb','UserNotification','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x1ccb2c,_0x3f9aa6){var _0x21155c=function(_0x4cac7c){while(--_0x4cac7c){_0x1ccb2c['push'](_0x1ccb2c['shift']());}};_0x21155c(++_0x3f9aa6);}(_0x17e5,0x1a8));var _0x517e=function(_0x299b94,_0x524564){_0x299b94=_0x299b94-0x0;var _0x507968=_0x17e5[_0x299b94];return _0x507968;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x517e('0x0'))['db'][_0x517e('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x517e('0x2')](0x0);var events={'afterCreate':_0x517e('0x3'),'afterUpdate':'update','afterDestroy':_0x517e('0x4')};function emitEvent(_0x45ddce){return function(_0x4923be,_0x1d09d5,_0x1ae4a2){UserNotificationEvents[_0x517e('0x5')](_0x45ddce+':'+_0x4923be['id'],_0x4923be);UserNotificationEvents['emit'](_0x45ddce,_0x4923be);_0x1ae4a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x517e('0x6')](e,emitEvent(event));}}module[_0x517e('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 383efd5..4fbeb20 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 _0x033b=['define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','./userNotification.attributes','exports'];(function(_0x50e0c8,_0x4b590b){var _0x2cc915=function(_0x4c8a05){while(--_0x4c8a05){_0x50e0c8['push'](_0x50e0c8['shift']());}};_0x2cc915(++_0x4b590b);}(_0x033b,0x88));var _0xb033=function(_0x5e5c20,_0x3966cb){_0x5e5c20=_0x5e5c20-0x0;var _0x412a1e=_0x033b[_0x5e5c20];return _0x412a1e;};'use strict';var _=require(_0xb033('0x0'));var util=require('util');var logger=require(_0xb033('0x1'))(_0xb033('0x2'));var moment=require(_0xb033('0x3'));var BPromise=require(_0xb033('0x4'));var rp=require(_0xb033('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb033('0x6'));module[_0xb033('0x7')]=function(_0x59857c,_0x4b38e9){return _0x59857c[_0xb033('0x8')](_0xb033('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb033('0xa'),'collate':_0xb033('0xb')});}; \ No newline at end of file +var _0xec1b=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x1f9e17,_0x127015){var _0x4fda50=function(_0x5c8ad4){while(--_0x5c8ad4){_0x1f9e17['push'](_0x1f9e17['shift']());}};_0x4fda50(++_0x127015);}(_0xec1b,0xe4));var _0xbec1=function(_0x5abb00,_0x342d70){_0x5abb00=_0x5abb00-0x0;var _0xf9b854=_0xec1b[_0x5abb00];return _0xf9b854;};'use strict';var _=require(_0xbec1('0x0'));var util=require(_0xbec1('0x1'));var logger=require(_0xbec1('0x2'))(_0xbec1('0x3'));var moment=require(_0xbec1('0x4'));var BPromise=require('bluebird');var rp=require(_0xbec1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbec1('0x6'));var config=require(_0xbec1('0x7'));var attributes=require(_0xbec1('0x8'));module[_0xbec1('0x9')]=function(_0x492708,_0x2d96b8){return _0x492708[_0xbec1('0xa')](_0xbec1('0xb'),attributes,{'tableName':_0xbec1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbec1('0xd'),'collate':_0xbec1('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 46c658d..d15665d 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 _0x9cf5=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2fbf91,_0x250526){var _0x5be9eb=function(_0x3b969d){while(--_0x3b969d){_0x2fbf91['push'](_0x2fbf91['shift']());}};_0x5be9eb(++_0x250526);}(_0x9cf5,0x95));var _0x59cf=function(_0x6d0e45,_0x2658b3){_0x6d0e45=_0x6d0e45-0x0;var _0xab8e58=_0x9cf5[_0x6d0e45];return _0xab8e58;};'use strict';var _=require(_0x59cf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x59cf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59cf('0x2'))['db'];var utils=require(_0x59cf('0x3'));var logger=require('../../config/logger')(_0x59cf('0x4'));var config=require(_0x59cf('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x59cf('0x6')]['http']({'port':0x232a});config[_0x59cf('0x7')]=_[_0x59cf('0x8')](config[_0x59cf('0x7')],{'host':_0x59cf('0x9'),'port':0x18eb});var socket=require(_0x59cf('0xa'))(new Redis(config[_0x59cf('0x7')]));require(_0x59cf('0xb'))['register'](socket);function respondWithRpcPromise(_0x3ec784,_0x411328,_0x30bb47){return new BPromise(function(_0x39731e,_0x65ccf3){return client[_0x59cf('0xc')](_0x3ec784,_0x30bb47)[_0x59cf('0xd')](function(_0x4d773f){logger[_0x59cf('0xe')](_0x59cf('0xf'),_0x411328,_0x59cf('0x10'));logger[_0x59cf('0x11')](_0x59cf('0x12'),_0x411328,_0x59cf('0x10'),JSON[_0x59cf('0x13')](_0x4d773f));if(_0x4d773f[_0x59cf('0x14')]){if(_0x4d773f[_0x59cf('0x14')][_0x59cf('0x15')]===0x1f4){logger[_0x59cf('0x14')](_0x59cf('0xf'),_0x411328,_0x4d773f[_0x59cf('0x14')]['message']);return _0x65ccf3(_0x4d773f['error'][_0x59cf('0x16')]);}logger[_0x59cf('0x14')]('UserNotification,\x20%s,\x20%s',_0x411328,_0x4d773f['error']['message']);return _0x39731e(_0x4d773f[_0x59cf('0x14')][_0x59cf('0x16')]);}else{logger[_0x59cf('0xe')](_0x59cf('0xf'),_0x411328,_0x59cf('0x10'));_0x39731e(_0x4d773f[_0x59cf('0x17')][_0x59cf('0x16')]);}})[_0x59cf('0x18')](function(_0x1ea740){logger[_0x59cf('0x14')](_0x59cf('0xf'),_0x411328,_0x1ea740);_0x65ccf3(_0x1ea740);});});} \ No newline at end of file +var _0x84e8=['socket.io-emitter','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x84e8,0x12e));var _0x884e=function(_0x2d3910,_0x1893be){_0x2d3910=_0x2d3910-0x0;var _0x50af63=_0x84e8[_0x2d3910];return _0x50af63;};'use strict';var _=require('lodash');var util=require(_0x884e('0x0'));var moment=require('moment');var BPromise=require(_0x884e('0x1'));var rs=require(_0x884e('0x2'));var fs=require('fs');var Redis=require(_0x884e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x884e('0x4'))(_0x884e('0x5'));var config=require('../../config/environment');var jayson=require(_0x884e('0x6'));var client=jayson[_0x884e('0x7')]['http']({'port':0x232a});config[_0x884e('0x8')]=_[_0x884e('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x884e('0xa'))(new Redis(config['redis']));require('./userNotification.socket')[_0x884e('0xb')](socket);function respondWithRpcPromise(_0x36e6e3,_0x2d668e,_0x334514){return new BPromise(function(_0x17a9d2,_0x4e626e){return client[_0x884e('0xc')](_0x36e6e3,_0x334514)['then'](function(_0x57b2f2){logger[_0x884e('0xd')](_0x884e('0xe'),_0x2d668e,_0x884e('0xf'));logger[_0x884e('0x10')](_0x884e('0x11'),_0x2d668e,_0x884e('0xf'),JSON[_0x884e('0x12')](_0x57b2f2));if(_0x57b2f2[_0x884e('0x13')]){if(_0x57b2f2[_0x884e('0x13')][_0x884e('0x14')]===0x1f4){logger[_0x884e('0x13')](_0x884e('0xe'),_0x2d668e,_0x57b2f2[_0x884e('0x13')][_0x884e('0x15')]);return _0x4e626e(_0x57b2f2['error'][_0x884e('0x15')]);}logger[_0x884e('0x13')](_0x884e('0xe'),_0x2d668e,_0x57b2f2[_0x884e('0x13')][_0x884e('0x15')]);return _0x17a9d2(_0x57b2f2[_0x884e('0x13')][_0x884e('0x15')]);}else{logger[_0x884e('0xd')](_0x884e('0xe'),_0x2d668e,'request\x20sent');_0x17a9d2(_0x57b2f2[_0x884e('0x16')][_0x884e('0x15')]);}})[_0x884e('0x17')](function(_0x49d04f){logger[_0x884e('0x13')](_0x884e('0xe'),_0x2d668e,_0x49d04f);_0x4e626e(_0x49d04f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 92068db..4ac3ff2 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 _0x6311=['emit','removeListener','register','length','./userNotification.events'];(function(_0x569da8,_0x3d75d8){var _0x4262df=function(_0x52b737){while(--_0x52b737){_0x569da8['push'](_0x569da8['shift']());}};_0x4262df(++_0x3d75d8);}(_0x6311,0x8b));var _0x1631=function(_0xf62e6c,_0x160938){_0xf62e6c=_0xf62e6c-0x0;var _0x14234f=_0x6311[_0xf62e6c];return _0x14234f;};'use strict';var UserNotificationEvents=require(_0x1631('0x0'));var events=['save','remove','update'];function createListener(_0x580d3b,_0x368f9e){return function(_0xdc43b9){_0x368f9e[_0x1631('0x1')](_0x580d3b,_0xdc43b9);};}function removeListener(_0x4f467a,_0x478721){return function(){UserNotificationEvents[_0x1631('0x2')](_0x4f467a,_0x478721);};}exports[_0x1631('0x3')]=function(_0x5dabd4){for(var _0x20c263=0x0,_0x743d96=events[_0x1631('0x4')];_0x20c263<_0x743d96;_0x20c263++){var _0x1242e7=events[_0x20c263];var _0x12c83d=createListener('userNotification:'+_0x1242e7,_0x5dabd4);UserNotificationEvents['on'](_0x1242e7,_0x12c83d);}}; \ No newline at end of file +var _0x6e19=['remove','emit','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0xbe7cd0,_0xe54007){var _0x46ef3e=function(_0x4ff0cf){while(--_0x4ff0cf){_0xbe7cd0['push'](_0xbe7cd0['shift']());}};_0x46ef3e(++_0xe54007);}(_0x6e19,0x13a));var _0x96e1=function(_0x24bb72,_0x121fe9){_0x24bb72=_0x24bb72-0x0;var _0x462e48=_0x6e19[_0x24bb72];return _0x462e48;};'use strict';var UserNotificationEvents=require(_0x96e1('0x0'));var events=['save',_0x96e1('0x1'),'update'];function createListener(_0x1b0585,_0x4aa740){return function(_0x2c4b68){_0x4aa740[_0x96e1('0x2')](_0x1b0585,_0x2c4b68);};}function removeListener(_0x3af5ca,_0x5659cd){return function(){UserNotificationEvents[_0x96e1('0x3')](_0x3af5ca,_0x5659cd);};}exports[_0x96e1('0x4')]=function(_0x299b5a){for(var _0x31d8f7=0x0,_0x54e9c6=events[_0x96e1('0x5')];_0x31d8f7<_0x54e9c6;_0x31d8f7++){var _0x1f94e1=events[_0x31d8f7];var _0x5152de=createListener(_0x96e1('0x6')+_0x1f94e1,_0x299b5a);UserNotificationEvents['on'](_0x1f94e1,_0x5152de);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c0d9baa..bb22766 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x18f14f,_0x3bf59b){var _0x514889=function(_0x5b7acf){while(--_0x5b7acf){_0x18f14f['push'](_0x18f14f['shift']());}};_0x514889(++_0x3bf59b);}(_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(_0x5f28e6,_0x166c61){var _0x48b540=function(_0x1a6105){while(--_0x1a6105){_0x5f28e6['push'](_0x5f28e6['shift']());}};_0x48b540(++_0x166c61);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0xcb91[_0x54d52];return _0x968345;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 935df23..686720e 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 _0xf105=['INTEGER'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xf105,0x136));var _0x5f10=function(_0x3cda11,_0x11528f){_0x3cda11=_0x3cda11-0x0;var _0x29bbd2=_0xf105[_0x3cda11];return _0x29bbd2;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5f10('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc22d=['INTEGER','exports'];(function(_0x687372,_0x38814a){var _0x5ef088=function(_0xd27711){while(--_0xd27711){_0x687372['push'](_0x687372['shift']());}};_0x5ef088(++_0x38814a);}(_0xc22d,0x151));var _0xdc22=function(_0x141932,_0x537fec){_0x141932=_0x141932-0x0;var _0x43d494=_0xc22d[_0x141932];return _0x43d494;};'use strict';var Sequelize=require('sequelize');module[_0xdc22('0x0')]={'penalty':{'type':Sequelize[_0xdc22('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 55785ab..f0d1021 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 _0x6eac=['request-promise','../../config/environment','./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','util','../../config/logger','api'];(function(_0x5474ae,_0xe1e2fa){var _0x427fba=function(_0x292d1e){while(--_0x292d1e){_0x5474ae['push'](_0x5474ae['shift']());}};_0x427fba(++_0xe1e2fa);}(_0x6eac,0x1ad));var _0xc6ea=function(_0x246269,_0x498bd2){_0x246269=_0x246269-0x0;var _0x26a23f=_0x6eac[_0x246269];return _0x26a23f;};'use strict';var _=require('lodash');var util=require(_0xc6ea('0x0'));var logger=require(_0xc6ea('0x1'))(_0xc6ea('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc6ea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6ea('0x4'));var attributes=require(_0xc6ea('0x5'));module[_0xc6ea('0x6')]=function(_0x2eee0a,_0x3c46f3){return _0x2eee0a['define']('UserOpenchannelQueue',attributes,{'tableName':_0xc6ea('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ad5=['./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','util','moment','request-promise','path','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3ad5,0x9b));var _0x53ad=function(_0x5d8c19,_0x55089c){_0x5d8c19=_0x5d8c19-0x0;var _0x486ffd=_0x3ad5[_0x5d8c19];return _0x486ffd;};'use strict';var _=require('lodash');var util=require(_0x53ad('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x53ad('0x1'));var BPromise=require('bluebird');var rp=require(_0x53ad('0x2'));var fs=require('fs');var path=require(_0x53ad('0x3'));var rimraf=require('rimraf');var config=require(_0x53ad('0x4'));var attributes=require(_0x53ad('0x5'));module[_0x53ad('0x6')]=function(_0x17f244,_0x2ffac4){return _0x17f244['define'](_0x53ad('0x7'),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 537064a..f53bc2b 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 _0x3064=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x40052f,_0x1dc55b){var _0x133d70=function(_0x53eba9){while(--_0x53eba9){_0x40052f['push'](_0x40052f['shift']());}};_0x133d70(++_0x1dc55b);}(_0x3064,0x19e));var _0x4306=function(_0x49f28e,_0xad6f05){_0x49f28e=_0x49f28e-0x0;var _0x20d72e=_0x3064[_0x49f28e];return _0x20d72e;};'use strict';var _=require(_0x4306('0x0'));var util=require(_0x4306('0x1'));var moment=require(_0x4306('0x2'));var BPromise=require(_0x4306('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4306('0x4'))['db'];var utils=require(_0x4306('0x5'));var logger=require(_0x4306('0x6'))(_0x4306('0x7'));var config=require(_0x4306('0x8'));var jayson=require(_0x4306('0x9'));var client=jayson[_0x4306('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2172a2,_0x2639fd,_0x406ff8){return new BPromise(function(_0x2670af,_0x473b4b){return client['request'](_0x2172a2,_0x406ff8)[_0x4306('0xb')](function(_0x24a6a9){logger[_0x4306('0xc')](_0x4306('0xd'),_0x2639fd,'request\x20sent');logger[_0x4306('0xe')](_0x4306('0xf'),_0x2639fd,_0x4306('0x10'),JSON[_0x4306('0x11')](_0x24a6a9));if(_0x24a6a9[_0x4306('0x12')]){if(_0x24a6a9[_0x4306('0x12')][_0x4306('0x13')]===0x1f4){logger[_0x4306('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2639fd,_0x24a6a9[_0x4306('0x12')]['message']);return _0x473b4b(_0x24a6a9[_0x4306('0x12')]['message']);}logger[_0x4306('0x12')](_0x4306('0xd'),_0x2639fd,_0x24a6a9[_0x4306('0x12')][_0x4306('0x14')]);return _0x2670af(_0x24a6a9[_0x4306('0x12')][_0x4306('0x14')]);}else{logger[_0x4306('0xc')](_0x4306('0xd'),_0x2639fd,_0x4306('0x10'));_0x2670af(_0x24a6a9[_0x4306('0x15')][_0x4306('0x14')]);}})[_0x4306('0x16')](function(_0x1b038b){logger[_0x4306('0x12')](_0x4306('0xd'),_0x2639fd,_0x1b038b);_0x473b4b(_0x1b038b);});});} \ No newline at end of file +var _0x850f=['rpc','../../config/environment','jayson/promise','then','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','UserOpenchannelQueue,\x20%s,\x20%s','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x49020b,_0x22b7f9){var _0x3a2d41=function(_0x158979){while(--_0x158979){_0x49020b['push'](_0x49020b['shift']());}};_0x3a2d41(++_0x22b7f9);}(_0x850f,0x1af));var _0xf850=function(_0x4b363a,_0x1a2eb5){_0x4b363a=_0x4b363a-0x0;var _0x2afa1e=_0x850f[_0x4b363a];return _0x2afa1e;};'use strict';var _=require('lodash');var util=require(_0xf850('0x0'));var moment=require(_0xf850('0x1'));var BPromise=require(_0xf850('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf850('0x3'));var db=require(_0xf850('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf850('0x5'))(_0xf850('0x6'));var config=require(_0xf850('0x7'));var jayson=require(_0xf850('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x505827,_0x12e5fa,_0x4c2b04){return new BPromise(function(_0x5cf436,_0xb36f47){return client['request'](_0x505827,_0x4c2b04)[_0xf850('0x9')](function(_0x5a4553){logger[_0xf850('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x12e5fa,'request\x20sent');logger[_0xf850('0xb')](_0xf850('0xc'),_0x12e5fa,'request\x20sent',JSON[_0xf850('0xd')](_0x5a4553));if(_0x5a4553[_0xf850('0xe')]){if(_0x5a4553[_0xf850('0xe')]['code']===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x12e5fa,_0x5a4553[_0xf850('0xe')][_0xf850('0xf')]);return _0xb36f47(_0x5a4553[_0xf850('0xe')]['message']);}logger[_0xf850('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x12e5fa,_0x5a4553[_0xf850('0xe')]['message']);return _0x5cf436(_0x5a4553[_0xf850('0xe')][_0xf850('0xf')]);}else{logger[_0xf850('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x12e5fa,_0xf850('0x10'));_0x5cf436(_0x5a4553[_0xf850('0x11')][_0xf850('0xf')]);}})['catch'](function(_0xf52c79){logger['error'](_0xf850('0x12'),_0x12e5fa,_0xf52c79);_0xb36f47(_0xf52c79);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 782d427..26e4094 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 _0xd3d5=['/:id','show','getSections','getResources','post','/:id/clone','/:id/sections','addSections','/:id/resources','put','update','delete','destroy','removeSections','removeResources','multer','util','express','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2ff3b0,_0x34d292){var _0x5911ec=function(_0x40940a){while(--_0x40940a){_0x2ff3b0['push'](_0x2ff3b0['shift']());}};_0x5911ec(++_0x34d292);}(_0xd3d5,0x1af));var _0x5d3d=function(_0x58a4ac,_0x26f3e7){_0x58a4ac=_0x58a4ac-0x0;var _0x435e2d=_0xd3d5[_0x58a4ac];return _0x435e2d;};'use strict';var multer=require(_0x5d3d('0x0'));var util=require(_0x5d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5d3d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5d3d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5d3d('0x4'));var controller=require(_0x5d3d('0x5'));router[_0x5d3d('0x6')]('/',auth[_0x5d3d('0x7')](),controller[_0x5d3d('0x8')]);router[_0x5d3d('0x6')](_0x5d3d('0x9'),auth[_0x5d3d('0x7')](),controller[_0x5d3d('0xa')]);router[_0x5d3d('0x6')](_0x5d3d('0xb'),auth['isAuthenticated'](),controller[_0x5d3d('0xc')]);router[_0x5d3d('0x6')]('/:id/sections',auth[_0x5d3d('0x7')](),controller[_0x5d3d('0xd')]);router[_0x5d3d('0x6')]('/:id/resources',auth[_0x5d3d('0x7')](),controller[_0x5d3d('0xe')]);router[_0x5d3d('0xf')]('/',auth[_0x5d3d('0x7')](),controller['create']);router[_0x5d3d('0xf')](_0x5d3d('0x10'),auth[_0x5d3d('0x7')](),controller['clone']);router[_0x5d3d('0xf')](_0x5d3d('0x11'),auth[_0x5d3d('0x7')](),controller[_0x5d3d('0x12')]);router[_0x5d3d('0xf')](_0x5d3d('0x13'),auth['isAuthenticated'](),controller['addResources']);router[_0x5d3d('0x14')](_0x5d3d('0xb'),auth[_0x5d3d('0x7')](),controller[_0x5d3d('0x15')]);router[_0x5d3d('0x16')]('/:id',auth[_0x5d3d('0x7')](),controller[_0x5d3d('0x17')]);router[_0x5d3d('0x16')](_0x5d3d('0x11'),auth['isAuthenticated'](),controller[_0x5d3d('0x18')]);router['delete'](_0x5d3d('0x13'),auth[_0x5d3d('0x7')](),controller[_0x5d3d('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa5ef=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','/:id/resources','getResources','post','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','exports'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xa5ef,0x1dc));var _0xfa5e=function(_0x12d5e9,_0x1decd6){_0x12d5e9=_0x12d5e9-0x0;var _0x343939=_0xa5ef[_0x12d5e9];return _0x343939;};'use strict';var multer=require(_0xfa5e('0x0'));var util=require('util');var path=require(_0xfa5e('0x1'));var timeout=require(_0xfa5e('0x2'));var express=require(_0xfa5e('0x3'));var router=express[_0xfa5e('0x4')]();var fs_extra=require(_0xfa5e('0x5'));var auth=require(_0xfa5e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfa5e('0x7'));var controller=require(_0xfa5e('0x8'));router[_0xfa5e('0x9')]('/',auth[_0xfa5e('0xa')](),controller[_0xfa5e('0xb')]);router[_0xfa5e('0x9')](_0xfa5e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xfa5e('0x9')](_0xfa5e('0xd'),auth['isAuthenticated'](),controller[_0xfa5e('0xe')]);router[_0xfa5e('0x9')](_0xfa5e('0xf'),auth[_0xfa5e('0xa')](),controller['getSections']);router['get'](_0xfa5e('0x10'),auth[_0xfa5e('0xa')](),controller[_0xfa5e('0x11')]);router[_0xfa5e('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfa5e('0x12')](_0xfa5e('0x13'),auth[_0xfa5e('0xa')](),controller[_0xfa5e('0x14')]);router[_0xfa5e('0x12')]('/:id/sections',auth[_0xfa5e('0xa')](),controller[_0xfa5e('0x15')]);router[_0xfa5e('0x12')](_0xfa5e('0x10'),auth[_0xfa5e('0xa')](),controller['addResources']);router[_0xfa5e('0x16')](_0xfa5e('0xd'),auth[_0xfa5e('0xa')](),controller[_0xfa5e('0x17')]);router[_0xfa5e('0x18')]('/:id',auth[_0xfa5e('0xa')](),controller[_0xfa5e('0x19')]);router[_0xfa5e('0x18')]('/:id/sections',auth[_0xfa5e('0xa')](),controller[_0xfa5e('0x1a')]);router[_0xfa5e('0x18')](_0xfa5e('0x10'),auth[_0xfa5e('0xa')](),controller['removeResources']);module[_0xfa5e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7b32d8f..a8a04b8 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 _0xe12c=['name','STRING','setDataValue','crudPermissions','split','BOOLEAN','exports'];(function(_0x5d1964,_0x50f3d8){var _0x5b6e31=function(_0x4eca8a){while(--_0x4eca8a){_0x5d1964['push'](_0x5d1964['shift']());}};_0x5b6e31(++_0x50f3d8);}(_0xe12c,0x12c));var _0xce12=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0xe12c[_0x4b4d43];return _0x5706ba;};'use strict';var Sequelize=require('sequelize');module[_0xce12('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xce12('0x1')},'crudPermissions':{'type':Sequelize[_0xce12('0x2')],'set':function(_0x191281){this[_0xce12('0x3')](_0xce12('0x4'),_0x191281?_0x191281['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0xce12('0x4'))[_0xce12('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xce12('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xce12('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xce12('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xce12('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xce12('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xce12('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x718d=['split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x4847fd,_0x3694a7){var _0x495358=function(_0x180f9a){while(--_0x180f9a){_0x4847fd['push'](_0x4847fd['shift']());}};_0x495358(++_0x3694a7);}(_0x718d,0x107));var _0xd718=function(_0x212d6d,_0x30a647){_0x212d6d=_0x212d6d-0x0;var _0x46b2d1=_0x718d[_0x212d6d];return _0x46b2d1;};'use strict';var Sequelize=require(_0xd718('0x0'));module['exports']={'name':{'type':Sequelize[_0xd718('0x1')],'allowNull':![],'unique':_0xd718('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x128a07){this[_0xd718('0x3')](_0xd718('0x4'),_0x128a07?_0x128a07[_0xd718('0x5')](''):[]);},'get':function(){return this[_0xd718('0x6')](_0xd718('0x4'))?this[_0xd718('0x6')](_0xd718('0x4'))[_0xd718('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd718('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xd718('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd718('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd718('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd718('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd718('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd718('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xd718('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd718('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d079f6f..3529af8 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 _0xe0dc=['filters','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','intersection','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','params','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','UserProfile','rawAttributes','key','model','keys','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2e4cfb,_0x2bee56){var _0x5c7206=function(_0x45dfea){while(--_0x45dfea){_0x2e4cfb['push'](_0x2e4cfb['shift']());}};_0x5c7206(++_0x2bee56);}(_0xe0dc,0x190));var _0xce0d=function(_0x4ba8c3,_0x33c457){_0x4ba8c3=_0x4ba8c3-0x0;var _0xf65364=_0xe0dc[_0x4ba8c3];return _0xf65364;};'use strict';var emlformat=require(_0xce0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce0d('0x1'));var jsonpatch=require(_0xce0d('0x2'));var rp=require('request-promise');var moment=require(_0xce0d('0x3'));var BPromise=require(_0xce0d('0x4'));var Mustache=require(_0xce0d('0x5'));var util=require(_0xce0d('0x6'));var path=require('path');var sox=require(_0xce0d('0x7'));var csv=require('to-csv');var ejs=require(_0xce0d('0x8'));var fs=require('fs');var fs_extra=require(_0xce0d('0x9'));var _=require(_0xce0d('0xa'));var squel=require(_0xce0d('0xb'));var crypto=require(_0xce0d('0xc'));var jsforce=require(_0xce0d('0xd'));var deskjs=require(_0xce0d('0xe'));var toCsv=require(_0xce0d('0xf'));var querystring=require(_0xce0d('0x10'));var Papa=require(_0xce0d('0x11'));var Redis=require(_0xce0d('0x12'));var authService=require(_0xce0d('0x13'));var qs=require(_0xce0d('0x14'));var as=require(_0xce0d('0x15'));var hardwareService=require(_0xce0d('0x16'));var logger=require(_0xce0d('0x17'))(_0xce0d('0x18'));var utils=require(_0xce0d('0x19'));var config=require(_0xce0d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xce0d('0x1b'))['db'];config[_0xce0d('0x1c')]=_[_0xce0d('0x1d')](config[_0xce0d('0x1c')],{'host':_0xce0d('0x1e'),'port':0x18eb});var socket=require(_0xce0d('0x1f'))(new Redis(config[_0xce0d('0x1c')]));require(_0xce0d('0x20'))[_0xce0d('0x21')](socket);function respondWithStatusCode(_0xfba354,_0x15b11f){_0x15b11f=_0x15b11f||0xcc;return function(_0x2db05a){if(_0x2db05a){return _0xfba354[_0xce0d('0x22')](_0x15b11f);}return _0xfba354[_0xce0d('0x23')](_0x15b11f)[_0xce0d('0x24')]();};}function respondWithResult(_0x176c81,_0x936728){_0x936728=_0x936728||0xc8;return function(_0x39ed8){if(_0x39ed8){return _0x176c81[_0xce0d('0x23')](_0x936728)[_0xce0d('0x25')](_0x39ed8);}};}function respondWithFilteredResult(_0x2044df,_0x35dfa1){return function(_0x1dc8aa){if(_0x1dc8aa){var _0x1e03c1=typeof _0x35dfa1[_0xce0d('0x26')]===_0xce0d('0x27')&&typeof _0x35dfa1[_0xce0d('0x28')]===_0xce0d('0x27');var _0x37aae8=_0x1dc8aa[_0xce0d('0x29')];var _0x155567=_0x1e03c1?0x0:_0x35dfa1[_0xce0d('0x26')];var _0x1fda5a=_0x1e03c1?_0x1dc8aa[_0xce0d('0x29')]:_0x35dfa1[_0xce0d('0x26')]+_0x35dfa1[_0xce0d('0x28')];var _0x16788f;if(_0x1fda5a>=_0x37aae8){_0x1fda5a=_0x37aae8;_0x16788f=0xc8;}else{_0x16788f=0xce;}_0x2044df['status'](_0x16788f);return _0x2044df['set'](_0xce0d('0x2a'),_0x155567+'-'+_0x1fda5a+'/'+_0x37aae8)['json'](_0x1dc8aa);}return null;};}function patchUpdates(_0x2727c2){return function(_0x302476){try{jsonpatch[_0xce0d('0x2b')](_0x302476,_0x2727c2,!![]);}catch(_0x58d7c5){return BPromise[_0xce0d('0x2c')](_0x58d7c5);}return _0x302476['save']();};}function saveUpdates(_0x298f3e,_0x51aac8){return function(_0x5b759){if(_0x5b759){return _0x5b759[_0xce0d('0x2d')](_0x298f3e)['then'](function(_0x516609){return _0x516609;});}return null;};}function removeEntity(_0x31300f,_0x201167){return function(_0x2a3815){if(_0x2a3815){return _0x2a3815[_0xce0d('0x2e')]()[_0xce0d('0x2f')](function(){_0x31300f['status'](0xcc)[_0xce0d('0x24')]();});}};}function handleEntityNotFound(_0x25c356,_0x31ace8){return function(_0x5b197c){if(!_0x5b197c){_0x25c356[_0xce0d('0x22')](0x194);}return _0x5b197c;};}function handleError(_0x4c9d05,_0x228a1c){_0x228a1c=_0x228a1c||0x1f4;return function(_0x1eb234){logger[_0xce0d('0x30')](_0x1eb234[_0xce0d('0x31')]);if(_0x1eb234[_0xce0d('0x32')]){delete _0x1eb234[_0xce0d('0x32')];}_0x4c9d05[_0xce0d('0x23')](_0x228a1c)[_0xce0d('0x33')](_0x1eb234);};}exports[_0xce0d('0x34')]=function(_0x1dc21a,_0x4171cb){var _0x336114={},_0x5c4ec9={},_0x4a3308={'count':0x0,'rows':[]};var _0x2c3de1=_[_0xce0d('0x35')](db[_0xce0d('0x36')][_0xce0d('0x37')],function(_0x3b1bc8){return{'name':_0x3b1bc8['fieldName'],'type':_0x3b1bc8['type'][_0xce0d('0x38')]};});_0x5c4ec9[_0xce0d('0x39')]=_['map'](_0x2c3de1,'name');_0x5c4ec9['query']=_[_0xce0d('0x3a')](_0x1dc21a['query']);_0x5c4ec9['filters']=_['intersection'](_0x5c4ec9[_0xce0d('0x39')],_0x5c4ec9['query']);_0x336114['attributes']=_['intersection'](_0x5c4ec9['model'],qs['fields'](_0x1dc21a['query'][_0xce0d('0x3b')]));_0x336114[_0xce0d('0x3c')]=_0x336114[_0xce0d('0x3c')][_0xce0d('0x3d')]?_0x336114[_0xce0d('0x3c')]:_0x5c4ec9[_0xce0d('0x39')];if(!_0x1dc21a[_0xce0d('0x3e')][_0xce0d('0x3f')](_0xce0d('0x40'))){_0x336114['limit']=qs[_0xce0d('0x28')](_0x1dc21a[_0xce0d('0x3e')]['limit']);_0x336114[_0xce0d('0x26')]=qs[_0xce0d('0x26')](_0x1dc21a['query']['offset']);}_0x336114[_0xce0d('0x41')]=qs[_0xce0d('0x42')](_0x1dc21a[_0xce0d('0x3e')][_0xce0d('0x42')]);_0x336114[_0xce0d('0x43')]=qs['filters'](_['pick'](_0x1dc21a[_0xce0d('0x3e')],_0x5c4ec9[_0xce0d('0x44')]),_0x2c3de1);if(_0x1dc21a['query']['filter']){_0x336114[_0xce0d('0x43')]=_[_0xce0d('0x45')](_0x336114[_0xce0d('0x43')],{'$or':_[_0xce0d('0x35')](_0x2c3de1,function(_0x3f54b){if(_0x3f54b[_0xce0d('0x46')]!=='VIRTUAL'){var _0x37da5b={};_0x37da5b[_0x3f54b[_0xce0d('0x32')]]={'$like':'%'+_0x1dc21a[_0xce0d('0x3e')][_0xce0d('0x47')]+'%'};return _0x37da5b;}})});}_0x336114=_[_0xce0d('0x45')]({},_0x336114,_0x1dc21a[_0xce0d('0x48')]);var _0x18faeb={'where':_0x336114[_0xce0d('0x43')]};return db['UserProfile'][_0xce0d('0x29')](_0x18faeb)['then'](function(_0x6352f9){_0x4a3308[_0xce0d('0x29')]=_0x6352f9;if(_0x1dc21a[_0xce0d('0x3e')][_0xce0d('0x49')]){_0x336114[_0xce0d('0x4a')]=[{'all':!![]}];}return db['UserProfile'][_0xce0d('0x4b')](_0x336114);})[_0xce0d('0x2f')](function(_0x5457d8){_0x4a3308[_0xce0d('0x4c')]=_0x5457d8;return _0x4a3308;})['then'](respondWithFilteredResult(_0x4171cb,_0x336114))[_0xce0d('0x4d')](handleError(_0x4171cb,null));};exports[_0xce0d('0x4e')]=function(_0x191e8f,_0x4b31e3){var _0x3fd83e={'raw':![],'where':{'id':_0x191e8f['params']['id']}},_0x46003d={};_0x46003d['model']=_[_0xce0d('0x3a')](db[_0xce0d('0x36')][_0xce0d('0x37')]);_0x46003d[_0xce0d('0x3e')]=_[_0xce0d('0x3a')](_0x191e8f['query']);_0x46003d['filters']=_['intersection'](_0x46003d[_0xce0d('0x39')],_0x46003d[_0xce0d('0x3e')]);_0x3fd83e[_0xce0d('0x3c')]=_[_0xce0d('0x4f')](_0x46003d[_0xce0d('0x39')],qs[_0xce0d('0x3b')](_0x191e8f[_0xce0d('0x3e')]['fields']));_0x3fd83e['attributes']=_0x3fd83e[_0xce0d('0x3c')][_0xce0d('0x3d')]?_0x3fd83e[_0xce0d('0x3c')]:_0x46003d[_0xce0d('0x39')];if(_0x191e8f[_0xce0d('0x3e')][_0xce0d('0x49')]){_0x3fd83e[_0xce0d('0x4a')]=[{'all':!![]}];}_0x3fd83e=_['merge']({},_0x3fd83e,_0x191e8f[_0xce0d('0x48')]);return db['UserProfile']['find'](_0x3fd83e)[_0xce0d('0x2f')](handleEntityNotFound(_0x4b31e3,null))[_0xce0d('0x2f')](respondWithResult(_0x4b31e3,null))[_0xce0d('0x4d')](handleError(_0x4b31e3,null));};exports['create']=function(_0x641547,_0x36f502){return db['UserProfile'][_0xce0d('0x50')](_0x641547[_0xce0d('0x51')],{})[_0xce0d('0x2f')](respondWithResult(_0x36f502,0xc9))[_0xce0d('0x4d')](handleError(_0x36f502,null));};exports[_0xce0d('0x52')]=function(_0x306657,_0x17919a){var _0x45b887={'where':{'id':_0x306657['params']['id']}},_0x12b423={};_0x12b423[_0xce0d('0x39')]=_[_0xce0d('0x3a')](db[_0xce0d('0x36')][_0xce0d('0x37')]);_0x45b887['attributes']=_[_0xce0d('0x4f')](_0x12b423[_0xce0d('0x39')],qs['fields'](_0x306657[_0xce0d('0x3e')]['fields']));_0x45b887[_0xce0d('0x3c')]=_0x45b887['attributes']['length']?_0x45b887[_0xce0d('0x3c')]:_0x12b423[_0xce0d('0x39')];if(_0x306657[_0xce0d('0x3e')][_0xce0d('0x49')]){_0x45b887[_0xce0d('0x4a')]=[{'all':!![]}];}_0x45b887=_[_0xce0d('0x45')]({},_0x45b887,_0x306657[_0xce0d('0x48')]);return db[_0xce0d('0x36')][_0xce0d('0x53')](_0x45b887)[_0xce0d('0x2f')](handleEntityNotFound(_0x17919a,null))['then'](function(_0x56d7f7){if(_0x56d7f7){var _0x47323a=_0x56d7f7[_0xce0d('0x54')]({'plain':!![]});_0x47323a=qs[_0xce0d('0x55')](_0x47323a,['id',_0xce0d('0x56'),_0xce0d('0x57'),_0xce0d('0x58')]);_0x306657[_0xce0d('0x51')]=_[_0xce0d('0x55')](_0x306657['body'],['id',_0xce0d('0x56'),_0xce0d('0x57')]);return db[_0xce0d('0x59')][_0xce0d('0x5a')](function(_0x1f9716){return db[_0xce0d('0x36')]['create'](_['merge'](_0x47323a,_0x306657['body']),{'include':_0x306657['query'][_0xce0d('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x1f9716})['then'](function(_0x1c35d9){var _0x3b3929=_0x1c35d9[_0xce0d('0x54')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x306657[_0xce0d('0x5b')]['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x41ac2a){if(_0x41ac2a){return BPromise['each'](_0x41ac2a,function(_0x1c9702){return new BPromise(function(_0x4de7e3,_0x43df19){if(_0x1c9702['autoAssociation']===null||_0x1c9702[_0xce0d('0x5c')]===0x1)_0x4de7e3(null);return db[_0xce0d('0x5d')][_0xce0d('0x4b')]({'where':{'sectionId':_0x1c9702['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x5a52ef){var _0xd47a82=_[_0xce0d('0x35')](_0x5a52ef,function(_0xeb6cbc){return qs['omit'](_0xeb6cbc,['id',_0xce0d('0x56'),_0xce0d('0x57'),_0xce0d('0x5e')]);});_0x4de7e3(_0xd47a82);})[_0xce0d('0x4d')](function(_0x57acd8){_0x43df19(_0x57acd8);});})['then'](function(_0x5d09e0){var _0x76d67a=qs[_0xce0d('0x55')](_0x1c9702,['id',_0xce0d('0x56'),'updatedAt']);_0x76d67a[_0xce0d('0x5f')]=_0x3b3929['id'];if(_0x5d09e0)_0x76d67a[_0xce0d('0x60')]=_0x5d09e0;return _0x76d67a;})['then'](function(_0x1a24db){return db[_0xce0d('0x61')][_0xce0d('0x50')](_0x1a24db,{'include':[{'model':db[_0xce0d('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x1f9716});});})[_0xce0d('0x2f')](function(){return _0x3b3929;});}});});});}})['then'](respondWithResult(_0x17919a,0xc9))['catch'](handleError(_0x17919a,null));};exports[_0xce0d('0x2d')]=function(_0x313d3a,_0x119204){if(_0x313d3a[_0xce0d('0x51')]['id']){delete _0x313d3a['body']['id'];}return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x313d3a[_0xce0d('0x5b')]['id']}})[_0xce0d('0x2f')](handleEntityNotFound(_0x119204,null))[_0xce0d('0x2f')](saveUpdates(_0x313d3a['body'],null))[_0xce0d('0x2f')](respondWithResult(_0x119204,null))['catch'](handleError(_0x119204,null));};exports[_0xce0d('0x2e')]=function(_0x4e3d99,_0x682a6d){return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x4e3d99[_0xce0d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x682a6d,null))[_0xce0d('0x2f')](removeEntity(_0x682a6d,null))[_0xce0d('0x4d')](handleError(_0x682a6d,null));};exports[_0xce0d('0x62')]=function(_0x1646cc,_0x1b4ffe){return db[_0xce0d('0x36')][_0xce0d('0x62')]()['then'](respondWithResult(_0x1b4ffe,null))['catch'](handleError(_0x1b4ffe,null));};exports['addSections']=function(_0x55b75a,_0x3355e3){var _0x3609a5=_0x55b75a[_0xce0d('0x51')];return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x55b75a[_0xce0d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3355e3,null))[_0xce0d('0x2f')](function(_0x47307d){if(_0x47307d){return db[_0xce0d('0x59')][_0xce0d('0x5a')](function(_0x231403){return db['UserProfileSection'][_0xce0d('0x2e')]({'where':{'userProfileId':_0x55b75a[_0xce0d('0x5b')]['id'],'sectionId':_[_0xce0d('0x35')](_0x3609a5,function(_0x7552be){return _0x7552be[_0xce0d('0x5e')];})},'transaction':_0x231403})[_0xce0d('0x2f')](function(){var _0x5531a5=_[_0xce0d('0x35')](_0x3609a5,function(_0x121ee4){_0x121ee4['userProfileId']=_0x55b75a['params']['id'];return _0x121ee4;});var _0x9fb17=[];return BPromise['each'](_0x5531a5,function(_0x1df5c8){return db['UserProfileSection'][_0xce0d('0x50')](_0x1df5c8,{'include':[{'model':db[_0xce0d('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x231403})[_0xce0d('0x2f')](function(_0x5abe1d){_0x9fb17[_0xce0d('0x63')](_0x5abe1d['get']({'plain':!![]}));});})[_0xce0d('0x2f')](function(){return _0x9fb17;});});});}})[_0xce0d('0x2f')](function(_0x491ae7){return _0x491ae7;})[_0xce0d('0x2f')](respondWithResult(_0x3355e3,null))[_0xce0d('0x4d')](handleError(_0x3355e3,null));};exports[_0xce0d('0x64')]=function(_0x49db9f,_0x636f1a){var _0x2d53e9;return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x49db9f[_0xce0d('0x5b')]['id']},'attributes':['id',_0xce0d('0x32')]})[_0xce0d('0x2f')](handleEntityNotFound(_0x636f1a,null))[_0xce0d('0x2f')](function(_0x5266e1){if(_0x5266e1){_0x2d53e9=_0x5266e1;return db[_0xce0d('0x61')][_0xce0d('0x2e')]({'where':{'userProfileId':_0x49db9f[_0xce0d('0x5b')]['id'],'sectionId':_0x49db9f[_0xce0d('0x3e')][_0xce0d('0x65')]}});}})[_0xce0d('0x2f')](function(){return _0x2d53e9;})[_0xce0d('0x2f')](respondWithStatusCode(_0x636f1a,null))[_0xce0d('0x4d')](handleError(_0x636f1a,null));};exports[_0xce0d('0x66')]=function(_0x5aaa23,_0x380375){var _0xda5005=[];var _0x213e29=[];return db[_0xce0d('0x61')][_0xce0d('0x4b')]({'where':{'userProfileId':_0x5aaa23[_0xce0d('0x5b')]['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x524955){_0xda5005=_[_0xce0d('0x47')](_0x524955,function(_0x443827){return _0x443827[_0xce0d('0x67')]===0x1||_['includes']([0x3eb,0x709],_0x443827[_0xce0d('0x5e')]);});if(!_[_0xce0d('0x68')](_0xda5005)){return _[_0xce0d('0x35')](_0xda5005,function(_0x8ad438){return _0x8ad438[_0xce0d('0x5e')];});}else{return;}})[_0xce0d('0x2f')](function(_0x226f80){if(_0x226f80)_0x213e29=_0x226f80;if(_[_0xce0d('0x69')](_0x213e29,0x64)){var _0x2222a2=_[_0xce0d('0x53')](_0xda5005,{'sectionId':0x64});return hasDefaultDashboard(_0x2222a2)[_0xce0d('0x2f')](function(_0x41a72a){return _[_0xce0d('0x35')](_0xda5005,function(_0x3a7e5c){if(_0x3a7e5c[_0xce0d('0x5e')]===0x64){_0x3a7e5c[_0xce0d('0x6a')]=_0x41a72a;}return _0x3a7e5c;});});}else{return;}})[_0xce0d('0x2f')](function(_0x2fc92a){if(_0x2fc92a)_0xda5005=_0x2fc92a;if(_[_0xce0d('0x69')](_0x213e29,0x3eb)){var _0x22b745=_[_0xce0d('0x53')](_0xda5005,{'sectionId':0x3eb});return getCustomDashboards(_0x22b745)[_0xce0d('0x2f')](function(_0x8059af){return _[_0xce0d('0x35')](_0xda5005,function(_0x3bb7ca){if(_0x22b745['enabled']){if(_0x3bb7ca[_0xce0d('0x5e')]===0x3eb){_0x3bb7ca[_0xce0d('0x6a')]=_0x8059af;}}else{if(_0x3bb7ca['sectionId']===0x64){_0x3bb7ca[_0xce0d('0x6a')]=_0x8059af;}}return _0x3bb7ca;});});}else{return;}})['then'](function(_0x44b7da){if(_0x44b7da)_0xda5005=_0x44b7da;if(_['includes'](_0x213e29,0x709)){var _0x1e1807=_[_0xce0d('0x53')](_0xda5005,{'sectionId':0x709});return getPlugins(_0x1e1807)['then'](function(_0x505068){if(_0x1e1807[_0xce0d('0x67')]){return _['map'](_0xda5005,function(_0x326185){if(_0x326185['sectionId']===0x709){_0x326185[_0xce0d('0x6a')]=_0x505068;}return _0x326185;});}else{var _0x4d0d14={'sectionId':0x76c,'enabled':0x1,'subsections':_0x505068};var _0x3cde4f=_['map'](_0xda5005);_0x3cde4f[_0xce0d('0x63')](_0x4d0d14);return _0x3cde4f;}});}else{return;}})[_0xce0d('0x2f')](function(_0x1662ce){if(_0x1662ce)_0xda5005=_0x1662ce;return _[_0xce0d('0x47')](_0xda5005,[_0xce0d('0x67'),0x1]);})[_0xce0d('0x2f')](respondWithResult(_0x380375,null))['catch'](handleError(_0x380375,null));};function hasDefaultDashboard(_0x2573de){var _0x55ea8d=[0x65];return new BPromise(function(_0xbd36af,_0x5ad7b5){try{if(_0x2573de['autoAssociation']){_0xbd36af(_0x55ea8d);}else{return db[_0xce0d('0x5d')][_0xce0d('0x6b')]({'where':{'sectionId':_0x2573de['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0xbe8813){_0xbe8813?_0xbd36af(_0x55ea8d):_0xbd36af();});}}catch(_0x41ba80){_0x5ad7b5(_0x41ba80);}});}function getCustomDashboards(_0x2f93e9){var _0x502457=[];return new BPromise(function(_0x83703f,_0x6a0858){try{if(_0x2f93e9[_0xce0d('0x5c')]){return db[_0xce0d('0x6c')][_0xce0d('0x4b')]({'raw':!![]})[_0xce0d('0x2f')](function(_0x29dd68){_0x29dd68[_0xce0d('0x6d')](function(_0x1d05af){_0x502457[_0xce0d('0x63')](_0x1d05af['id']+0x1869f);});_0x83703f(_0x502457);});}else{return db['UserProfileResource'][_0xce0d('0x4b')]({'where':{'sectionId':_0x2f93e9['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x4bb7e4){_0x4bb7e4[_0xce0d('0x6d')](function(_0x30015a){_0x502457[_0xce0d('0x63')](_0x30015a[_0xce0d('0x6e')]+0x1869f);});_0x83703f(_0x502457);});}}catch(_0x31a331){_0x6a0858(_0x31a331);}});}function getPlugins(_0xe5aef2){var _0x13640c=[];return new BPromise(function(_0x8eeb0e,_0x211b55){try{if(_0xe5aef2[_0xce0d('0x5c')]){return db[_0xce0d('0x6f')]['findAll']({'raw':!![]})[_0xce0d('0x2f')](function(_0x491498){_0x491498[_0xce0d('0x6d')](function(_0x1d858e){_0x13640c[_0xce0d('0x63')](_0x1d858e['id']+0x15b38);});_0x8eeb0e(_0x13640c);});}else{return db[_0xce0d('0x5d')]['findAll']({'where':{'sectionId':_0xe5aef2['id']},'raw':!![]})[_0xce0d('0x2f')](function(_0x5bdd29){_0x5bdd29['forEach'](function(_0x426c0f){_0x13640c[_0xce0d('0x63')](_0x426c0f[_0xce0d('0x6e')]+0x15b38);});_0x8eeb0e(_0x13640c);});}}catch(_0x5aa658){_0x211b55(_0x5aa658);}});}exports[_0xce0d('0x70')]=function(_0x599a2a,_0x33dd67){return db[_0xce0d('0x36')]['find']({'where':{'id':_0x599a2a[_0xce0d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x33dd67,null))['then'](function(_0x164a3d){if(_0x164a3d){return db[_0xce0d('0x59')][_0xce0d('0x5a')](function(_0x180ac0){return db[_0xce0d('0x61')][_0xce0d('0x4b')]({'where':{'userProfileId':_0x599a2a[_0xce0d('0x5b')]['id']},'attributes':['id'],'raw':!![]})[_0xce0d('0x2f')](function(_0x1d53a0){if(_0x1d53a0){return db[_0xce0d('0x61')][_0xce0d('0x2e')]({'where':{'userProfileId':_0x599a2a[_0xce0d('0x5b')]['id'],'id':_[_0xce0d('0x35')](_0x1d53a0,function(_0x5ee4f4){return _0x5ee4f4['id'];})},'transaction':_0x180ac0});}})['then'](function(_0x24802a){var _0x3e06a2=_[_0xce0d('0x35')](_0x599a2a[_0xce0d('0x51')],function(_0x9d75fd){_0x9d75fd[_0xce0d('0x5f')]=_0x599a2a['params']['id'];return _0x9d75fd;});return db[_0xce0d('0x61')][_0xce0d('0x71')](_0x3e06a2,{'raw':!![],'transaction':_0x180ac0});})[_0xce0d('0x2f')](function(_0x1fa275){var _0x5e7a6a=_[_0xce0d('0x47')](_[_0xce0d('0x35')](_0x1fa275,function(_0x3ed9f8){return _0x3ed9f8[_0xce0d('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x5e7a6a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x599a2a[_0xce0d('0x5b')]['id'],'sectionId':_['map'](_0x5e7a6a,function(_0x640655){return _0x640655[_0xce0d('0x5e')];})},'attributes':['id',_0xce0d('0x5e')],'raw':!![]})['then'](function(_0x55272e){var _0x19c4b5=_[_0xce0d('0x35')](_0x599a2a[_0xce0d('0x51')],function(_0x2ab3f0){_0x2ab3f0[_0xce0d('0x5f')]=_0x599a2a[_0xce0d('0x5b')]['id'];return _0x2ab3f0;});return db[_0xce0d('0x5d')][_0xce0d('0x71')](_0x19c4b5,{'raw':!![],'transaction':_0x180ac0});});}})[_0xce0d('0x4d')](handleError(_0x33dd67,null));});}})[_0xce0d('0x2f')](function(_0x4840f6){var _0x21cbbd=_[_0xce0d('0x35')](_0x4840f6,function(_0x237d84){return _0x237d84[_0xce0d('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0x33dd67,null))['catch'](handleError(_0x33dd67,null));};exports[_0xce0d('0x72')]=function(_0x5a0094,_0x4bde6e,_0x4c0421){return db['UserProfile'][_0xce0d('0x53')]({'where':{'id':_0x5a0094['params']['id']}})[_0xce0d('0x2f')](handleEntityNotFound(_0x4bde6e,null))['then'](function(_0x23d0e2){if(_0x23d0e2){return _0x23d0e2[_0xce0d('0x72')](_0x5a0094[_0xce0d('0x3e')][_0xce0d('0x65')]);}})[_0xce0d('0x2f')](respondWithStatusCode(_0x4bde6e,null))['catch'](handleError(_0x4bde6e,null));};exports[_0xce0d('0x73')]=function(_0x375ae7,_0x55db7f){var _0x52d394={};if(!_0x375ae7['query'][_0xce0d('0x74')])throw new Error('Missing\x20section\x20parameter');if(!_0x375ae7[_0xce0d('0x3e')]['hasOwnProperty'](_0xce0d('0x40'))){_0x52d394['limit']=qs[_0xce0d('0x28')](_0x375ae7['query'][_0xce0d('0x28')]);_0x52d394[_0xce0d('0x26')]=qs[_0xce0d('0x26')](_0x375ae7[_0xce0d('0x3e')]['offset']);}return db[_0xce0d('0x36')][_0xce0d('0x53')]({'where':{'id':_0x375ae7[_0xce0d('0x5b')]['id']}})['then'](function(_0x2baec8){if(!_0x2baec8)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x375ae7['params']['id']);return db[_0xce0d('0x36')][_0xce0d('0x73')](_0x375ae7);})[_0xce0d('0x2f')](respondWithFilteredResult(_0x55db7f,_0x52d394))[_0xce0d('0x4d')](handleError(_0x55db7f,null));}; \ No newline at end of file +var _0x86dc=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','key','name','query','keys','filters','intersection','model','attributes','length','nolimit','order','where','pick','filter','merge','type','options','count','findAll','catch','show','params','fields','create','body','clone','includeAll','include','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','sectionId','userProfileId','Resources','UserProfileResource','find','destroy','describe','UserProfileSection','push','removeSections','ids','enabled','includes','isEmpty','subsections','autoAssociation','findOne','forEach','resourceId','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x86dc,0x13e));var _0xc86d=function(_0x538d29,_0x23d646){_0x538d29=_0x538d29-0x0;var _0x227dd4=_0x86dc[_0x538d29];return _0x227dd4;};'use strict';var emlformat=require(_0xc86d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc86d('0x1'));var rp=require(_0xc86d('0x2'));var moment=require(_0xc86d('0x3'));var BPromise=require(_0xc86d('0x4'));var Mustache=require('mustache');var util=require(_0xc86d('0x5'));var path=require('path');var sox=require(_0xc86d('0x6'));var csv=require('to-csv');var ejs=require(_0xc86d('0x7'));var fs=require('fs');var fs_extra=require(_0xc86d('0x8'));var _=require(_0xc86d('0x9'));var squel=require('squel');var crypto=require(_0xc86d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc86d('0xb'));var toCsv=require(_0xc86d('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc86d('0xd'));var authService=require(_0xc86d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc86d('0xf'));var hardwareService=require(_0xc86d('0x10'));var logger=require(_0xc86d('0x11'))(_0xc86d('0x12'));var utils=require(_0xc86d('0x13'));var config=require(_0xc86d('0x14'));var licenseUtil=require(_0xc86d('0x15'));var db=require(_0xc86d('0x16'))['db'];config[_0xc86d('0x17')]=_[_0xc86d('0x18')](config[_0xc86d('0x17')],{'host':_0xc86d('0x19'),'port':0x18eb});var socket=require(_0xc86d('0x1a'))(new Redis(config[_0xc86d('0x17')]));require(_0xc86d('0x1b'))[_0xc86d('0x1c')](socket);function respondWithStatusCode(_0x176ce1,_0x313c16){_0x313c16=_0x313c16||0xcc;return function(_0x2bc469){if(_0x2bc469){return _0x176ce1[_0xc86d('0x1d')](_0x313c16);}return _0x176ce1[_0xc86d('0x1e')](_0x313c16)['end']();};}function respondWithResult(_0x4fb8e7,_0x49af1f){_0x49af1f=_0x49af1f||0xc8;return function(_0x3a253c){if(_0x3a253c){return _0x4fb8e7[_0xc86d('0x1e')](_0x49af1f)[_0xc86d('0x1f')](_0x3a253c);}};}function respondWithFilteredResult(_0x2a9459,_0x3a95c2){return function(_0x3d7e72){if(_0x3d7e72){var _0x279406=typeof _0x3a95c2['offset']==='undefined'&&typeof _0x3a95c2[_0xc86d('0x20')]===_0xc86d('0x21');var _0x445863=_0x3d7e72['count'];var _0x36c81d=_0x279406?0x0:_0x3a95c2[_0xc86d('0x22')];var _0x4f1efc=_0x279406?_0x3d7e72['count']:_0x3a95c2[_0xc86d('0x22')]+_0x3a95c2[_0xc86d('0x20')];var _0x548f59;if(_0x4f1efc>=_0x445863){_0x4f1efc=_0x445863;_0x548f59=0xc8;}else{_0x548f59=0xce;}_0x2a9459[_0xc86d('0x1e')](_0x548f59);return _0x2a9459[_0xc86d('0x23')](_0xc86d('0x24'),_0x36c81d+'-'+_0x4f1efc+'/'+_0x445863)[_0xc86d('0x1f')](_0x3d7e72);}return null;};}function patchUpdates(_0x57d804){return function(_0x2a0308){try{jsonpatch[_0xc86d('0x25')](_0x2a0308,_0x57d804,!![]);}catch(_0xad7be1){return BPromise[_0xc86d('0x26')](_0xad7be1);}return _0x2a0308[_0xc86d('0x27')]();};}function saveUpdates(_0x56278d,_0x38fb11){return function(_0x419afa){if(_0x419afa){return _0x419afa[_0xc86d('0x28')](_0x56278d)[_0xc86d('0x29')](function(_0x27d636){return _0x27d636;});}return null;};}function removeEntity(_0x5347f7,_0x1458fe){return function(_0x54303e){if(_0x54303e){return _0x54303e['destroy']()['then'](function(){_0x5347f7[_0xc86d('0x1e')](0xcc)[_0xc86d('0x2a')]();});}};}function handleEntityNotFound(_0x273c5a,_0x1e29be){return function(_0xd8b255){if(!_0xd8b255){_0x273c5a[_0xc86d('0x1d')](0x194);}return _0xd8b255;};}function handleError(_0x2fabc0,_0x2a35b3){_0x2a35b3=_0x2a35b3||0x1f4;return function(_0x4db581){logger[_0xc86d('0x2b')](_0x4db581[_0xc86d('0x2c')]);if(_0x4db581['name']){delete _0x4db581['name'];}_0x2fabc0[_0xc86d('0x1e')](_0x2a35b3)[_0xc86d('0x2d')](_0x4db581);};}exports[_0xc86d('0x2e')]=function(_0x271b23,_0x384bc9){var _0x217415={},_0x27e478={},_0x5a4ef1={'count':0x0,'rows':[]};var _0x5bda1c=_[_0xc86d('0x2f')](db[_0xc86d('0x30')][_0xc86d('0x31')],function(_0x219673){return{'name':_0x219673[_0xc86d('0x32')],'type':_0x219673['type'][_0xc86d('0x33')]};});_0x27e478['model']=_[_0xc86d('0x2f')](_0x5bda1c,_0xc86d('0x34'));_0x27e478[_0xc86d('0x35')]=_[_0xc86d('0x36')](_0x271b23[_0xc86d('0x35')]);_0x27e478[_0xc86d('0x37')]=_[_0xc86d('0x38')](_0x27e478[_0xc86d('0x39')],_0x27e478[_0xc86d('0x35')]);_0x217415['attributes']=_['intersection'](_0x27e478['model'],qs['fields'](_0x271b23['query']['fields']));_0x217415[_0xc86d('0x3a')]=_0x217415[_0xc86d('0x3a')][_0xc86d('0x3b')]?_0x217415[_0xc86d('0x3a')]:_0x27e478[_0xc86d('0x39')];if(!_0x271b23[_0xc86d('0x35')]['hasOwnProperty'](_0xc86d('0x3c'))){_0x217415[_0xc86d('0x20')]=qs[_0xc86d('0x20')](_0x271b23[_0xc86d('0x35')][_0xc86d('0x20')]);_0x217415[_0xc86d('0x22')]=qs[_0xc86d('0x22')](_0x271b23[_0xc86d('0x35')][_0xc86d('0x22')]);}_0x217415[_0xc86d('0x3d')]=qs['sort'](_0x271b23[_0xc86d('0x35')]['sort']);_0x217415[_0xc86d('0x3e')]=qs[_0xc86d('0x37')](_[_0xc86d('0x3f')](_0x271b23['query'],_0x27e478[_0xc86d('0x37')]),_0x5bda1c);if(_0x271b23[_0xc86d('0x35')][_0xc86d('0x40')]){_0x217415['where']=_[_0xc86d('0x41')](_0x217415[_0xc86d('0x3e')],{'$or':_[_0xc86d('0x2f')](_0x5bda1c,function(_0x3de4f3){if(_0x3de4f3[_0xc86d('0x42')]!=='VIRTUAL'){var _0x25e94e={};_0x25e94e[_0x3de4f3[_0xc86d('0x34')]]={'$like':'%'+_0x271b23[_0xc86d('0x35')][_0xc86d('0x40')]+'%'};return _0x25e94e;}})});}_0x217415=_[_0xc86d('0x41')]({},_0x217415,_0x271b23[_0xc86d('0x43')]);var _0x562fec={'where':_0x217415[_0xc86d('0x3e')]};return db['UserProfile'][_0xc86d('0x44')](_0x562fec)[_0xc86d('0x29')](function(_0x39bdc7){_0x5a4ef1[_0xc86d('0x44')]=_0x39bdc7;if(_0x271b23['query']['includeAll']){_0x217415['include']=[{'all':!![]}];}return db[_0xc86d('0x30')][_0xc86d('0x45')](_0x217415);})[_0xc86d('0x29')](function(_0x2c3f3d){_0x5a4ef1['rows']=_0x2c3f3d;return _0x5a4ef1;})[_0xc86d('0x29')](respondWithFilteredResult(_0x384bc9,_0x217415))[_0xc86d('0x46')](handleError(_0x384bc9,null));};exports[_0xc86d('0x47')]=function(_0x2562a2,_0x1a6494){var _0x5395bd={'raw':![],'where':{'id':_0x2562a2[_0xc86d('0x48')]['id']}},_0x36c0af={};_0x36c0af[_0xc86d('0x39')]=_[_0xc86d('0x36')](db['UserProfile'][_0xc86d('0x31')]);_0x36c0af['query']=_['keys'](_0x2562a2[_0xc86d('0x35')]);_0x36c0af['filters']=_[_0xc86d('0x38')](_0x36c0af[_0xc86d('0x39')],_0x36c0af[_0xc86d('0x35')]);_0x5395bd[_0xc86d('0x3a')]=_['intersection'](_0x36c0af[_0xc86d('0x39')],qs[_0xc86d('0x49')](_0x2562a2[_0xc86d('0x35')]['fields']));_0x5395bd['attributes']=_0x5395bd[_0xc86d('0x3a')]['length']?_0x5395bd[_0xc86d('0x3a')]:_0x36c0af[_0xc86d('0x39')];if(_0x2562a2[_0xc86d('0x35')]['includeAll']){_0x5395bd['include']=[{'all':!![]}];}_0x5395bd=_[_0xc86d('0x41')]({},_0x5395bd,_0x2562a2[_0xc86d('0x43')]);return db[_0xc86d('0x30')]['find'](_0x5395bd)[_0xc86d('0x29')](handleEntityNotFound(_0x1a6494,null))['then'](respondWithResult(_0x1a6494,null))[_0xc86d('0x46')](handleError(_0x1a6494,null));};exports[_0xc86d('0x4a')]=function(_0x57231e,_0x485e8b){return db[_0xc86d('0x30')]['create'](_0x57231e[_0xc86d('0x4b')],{})['then'](respondWithResult(_0x485e8b,0xc9))[_0xc86d('0x46')](handleError(_0x485e8b,null));};exports[_0xc86d('0x4c')]=function(_0x47474a,_0x52c6e0){var _0x505aaf={'where':{'id':_0x47474a[_0xc86d('0x48')]['id']}},_0x29dbbe={};_0x29dbbe[_0xc86d('0x39')]=_[_0xc86d('0x36')](db['UserProfile'][_0xc86d('0x31')]);_0x505aaf[_0xc86d('0x3a')]=_[_0xc86d('0x38')](_0x29dbbe[_0xc86d('0x39')],qs[_0xc86d('0x49')](_0x47474a[_0xc86d('0x35')]['fields']));_0x505aaf[_0xc86d('0x3a')]=_0x505aaf[_0xc86d('0x3a')][_0xc86d('0x3b')]?_0x505aaf[_0xc86d('0x3a')]:_0x29dbbe[_0xc86d('0x39')];if(_0x47474a[_0xc86d('0x35')][_0xc86d('0x4d')]){_0x505aaf[_0xc86d('0x4e')]=[{'all':!![]}];}_0x505aaf=_['merge']({},_0x505aaf,_0x47474a['options']);return db[_0xc86d('0x30')]['find'](_0x505aaf)[_0xc86d('0x29')](handleEntityNotFound(_0x52c6e0,null))[_0xc86d('0x29')](function(_0x52da8c){if(_0x52da8c){var _0x3c24ae=_0x52da8c[_0xc86d('0x4f')]({'plain':!![]});_0x3c24ae=qs[_0xc86d('0x50')](_0x3c24ae,['id',_0xc86d('0x51'),_0xc86d('0x52'),_0xc86d('0x53')]);_0x47474a[_0xc86d('0x4b')]=_[_0xc86d('0x50')](_0x47474a['body'],['id',_0xc86d('0x51'),_0xc86d('0x52')]);return db[_0xc86d('0x54')][_0xc86d('0x55')](function(_0x4da22d){return db[_0xc86d('0x30')]['create'](_[_0xc86d('0x41')](_0x3c24ae,_0x47474a[_0xc86d('0x4b')]),{'include':_0x47474a[_0xc86d('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4da22d})[_0xc86d('0x29')](function(_0x12a877){var _0x909d61=_0x12a877[_0xc86d('0x4f')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x47474a[_0xc86d('0x48')]['id']},'raw':!![]})['then'](function(_0xbe263a){if(_0xbe263a){return BPromise['each'](_0xbe263a,function(_0x41b5ce){return new BPromise(function(_0x80e0ca,_0xfadb15){if(_0x41b5ce['autoAssociation']===null||_0x41b5ce['autoAssociation']===0x1)_0x80e0ca(null);return db['UserProfileResource'][_0xc86d('0x45')]({'where':{'sectionId':_0x41b5ce['id']},'raw':!![]})[_0xc86d('0x29')](function(_0x234af8){var _0xa28234=_[_0xc86d('0x2f')](_0x234af8,function(_0x3ed64b){return qs['omit'](_0x3ed64b,['id','createdAt',_0xc86d('0x52'),_0xc86d('0x56')]);});_0x80e0ca(_0xa28234);})[_0xc86d('0x46')](function(_0x3bb71c){_0xfadb15(_0x3bb71c);});})[_0xc86d('0x29')](function(_0x465aac){var _0x4237fa=qs[_0xc86d('0x50')](_0x41b5ce,['id',_0xc86d('0x51'),'updatedAt']);_0x4237fa[_0xc86d('0x57')]=_0x909d61['id'];if(_0x465aac)_0x4237fa[_0xc86d('0x58')]=_0x465aac;return _0x4237fa;})['then'](function(_0x547981){return db['UserProfileSection'][_0xc86d('0x4a')](_0x547981,{'include':[{'model':db[_0xc86d('0x59')],'as':_0xc86d('0x58')}],'raw':!![],'transaction':_0x4da22d});});})[_0xc86d('0x29')](function(){return _0x909d61;});}});});});}})[_0xc86d('0x29')](respondWithResult(_0x52c6e0,0xc9))[_0xc86d('0x46')](handleError(_0x52c6e0,null));};exports[_0xc86d('0x28')]=function(_0xf99be1,_0x4a12fe){if(_0xf99be1[_0xc86d('0x4b')]['id']){delete _0xf99be1['body']['id'];}return db[_0xc86d('0x30')][_0xc86d('0x5a')]({'where':{'id':_0xf99be1[_0xc86d('0x48')]['id']}})[_0xc86d('0x29')](handleEntityNotFound(_0x4a12fe,null))[_0xc86d('0x29')](saveUpdates(_0xf99be1[_0xc86d('0x4b')],null))[_0xc86d('0x29')](respondWithResult(_0x4a12fe,null))[_0xc86d('0x46')](handleError(_0x4a12fe,null));};exports[_0xc86d('0x5b')]=function(_0x2a11c0,_0x32df56){return db[_0xc86d('0x30')]['find']({'where':{'id':_0x2a11c0[_0xc86d('0x48')]['id']}})[_0xc86d('0x29')](handleEntityNotFound(_0x32df56,null))[_0xc86d('0x29')](removeEntity(_0x32df56,null))[_0xc86d('0x46')](handleError(_0x32df56,null));};exports[_0xc86d('0x5c')]=function(_0x34741d,_0x4cacd3){return db['UserProfile'][_0xc86d('0x5c')]()[_0xc86d('0x29')](respondWithResult(_0x4cacd3,null))[_0xc86d('0x46')](handleError(_0x4cacd3,null));};exports['addSections']=function(_0x4334e3,_0x2172c3){var _0x542d27=_0x4334e3['body'];return db[_0xc86d('0x30')][_0xc86d('0x5a')]({'where':{'id':_0x4334e3[_0xc86d('0x48')]['id']}})[_0xc86d('0x29')](handleEntityNotFound(_0x2172c3,null))[_0xc86d('0x29')](function(_0x151e26){if(_0x151e26){return db[_0xc86d('0x54')][_0xc86d('0x55')](function(_0x1b5ea7){return db[_0xc86d('0x5d')][_0xc86d('0x5b')]({'where':{'userProfileId':_0x4334e3[_0xc86d('0x48')]['id'],'sectionId':_[_0xc86d('0x2f')](_0x542d27,function(_0x160cb1){return _0x160cb1[_0xc86d('0x56')];})},'transaction':_0x1b5ea7})[_0xc86d('0x29')](function(){var _0x20ce5b=_[_0xc86d('0x2f')](_0x542d27,function(_0x5909e0){_0x5909e0[_0xc86d('0x57')]=_0x4334e3[_0xc86d('0x48')]['id'];return _0x5909e0;});var _0x52ad43=[];return BPromise['each'](_0x20ce5b,function(_0x3ad079){return db['UserProfileSection'][_0xc86d('0x4a')](_0x3ad079,{'include':[{'model':db[_0xc86d('0x59')],'as':_0xc86d('0x58')}],'raw':!![],'transaction':_0x1b5ea7})['then'](function(_0x2b3fd3){_0x52ad43[_0xc86d('0x5e')](_0x2b3fd3[_0xc86d('0x4f')]({'plain':!![]}));});})[_0xc86d('0x29')](function(){return _0x52ad43;});});});}})[_0xc86d('0x29')](function(_0x104472){return _0x104472;})[_0xc86d('0x29')](respondWithResult(_0x2172c3,null))['catch'](handleError(_0x2172c3,null));};exports[_0xc86d('0x5f')]=function(_0x224b33,_0x61ca65){var _0x48224e;return db[_0xc86d('0x30')][_0xc86d('0x5a')]({'where':{'id':_0x224b33[_0xc86d('0x48')]['id']},'attributes':['id',_0xc86d('0x34')]})[_0xc86d('0x29')](handleEntityNotFound(_0x61ca65,null))[_0xc86d('0x29')](function(_0x3ab2e9){if(_0x3ab2e9){_0x48224e=_0x3ab2e9;return db[_0xc86d('0x5d')][_0xc86d('0x5b')]({'where':{'userProfileId':_0x224b33[_0xc86d('0x48')]['id'],'sectionId':_0x224b33[_0xc86d('0x35')][_0xc86d('0x60')]}});}})[_0xc86d('0x29')](function(){return _0x48224e;})[_0xc86d('0x29')](respondWithStatusCode(_0x61ca65,null))[_0xc86d('0x46')](handleError(_0x61ca65,null));};exports['getSections']=function(_0x34e77e,_0xc2d3c8){var _0x29e307=[];var _0x5c7345=[];return db[_0xc86d('0x5d')][_0xc86d('0x45')]({'where':{'userProfileId':_0x34e77e[_0xc86d('0x48')]['id']},'raw':!![]})[_0xc86d('0x29')](function(_0x322e30){_0x29e307=_[_0xc86d('0x40')](_0x322e30,function(_0x504b67){return _0x504b67[_0xc86d('0x61')]===0x1||_[_0xc86d('0x62')]([0x3eb,0x709],_0x504b67['sectionId']);});if(!_[_0xc86d('0x63')](_0x29e307)){return _[_0xc86d('0x2f')](_0x29e307,function(_0x43a3bc){return _0x43a3bc['sectionId'];});}else{return;}})[_0xc86d('0x29')](function(_0x335992){if(_0x335992)_0x5c7345=_0x335992;if(_[_0xc86d('0x62')](_0x5c7345,0x64)){var _0xe39522=_[_0xc86d('0x5a')](_0x29e307,{'sectionId':0x64});return hasDefaultDashboard(_0xe39522)['then'](function(_0x541a5e){return _[_0xc86d('0x2f')](_0x29e307,function(_0x512f2e){if(_0x512f2e['sectionId']===0x64){_0x512f2e[_0xc86d('0x64')]=_0x541a5e;}return _0x512f2e;});});}else{return;}})['then'](function(_0x302f5d){if(_0x302f5d)_0x29e307=_0x302f5d;if(_[_0xc86d('0x62')](_0x5c7345,0x3eb)){var _0xa17588=_[_0xc86d('0x5a')](_0x29e307,{'sectionId':0x3eb});return getCustomDashboards(_0xa17588)[_0xc86d('0x29')](function(_0x2abe0b){return _[_0xc86d('0x2f')](_0x29e307,function(_0x2b70b7){if(_0xa17588[_0xc86d('0x61')]){if(_0x2b70b7[_0xc86d('0x56')]===0x3eb){_0x2b70b7[_0xc86d('0x64')]=_0x2abe0b;}}else{if(_0x2b70b7[_0xc86d('0x56')]===0x64){_0x2b70b7[_0xc86d('0x64')]=_0x2abe0b;}}return _0x2b70b7;});});}else{return;}})['then'](function(_0x2643f3){if(_0x2643f3)_0x29e307=_0x2643f3;if(_[_0xc86d('0x62')](_0x5c7345,0x709)){var _0x5ace7e=_['find'](_0x29e307,{'sectionId':0x709});return getPlugins(_0x5ace7e)['then'](function(_0x2789ad){if(_0x5ace7e[_0xc86d('0x61')]){return _[_0xc86d('0x2f')](_0x29e307,function(_0x93317e){if(_0x93317e[_0xc86d('0x56')]===0x709){_0x93317e[_0xc86d('0x64')]=_0x2789ad;}return _0x93317e;});}else{var _0x3ef3cb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2789ad};var _0x5b1af8=_[_0xc86d('0x2f')](_0x29e307);_0x5b1af8[_0xc86d('0x5e')](_0x3ef3cb);return _0x5b1af8;}});}else{return;}})[_0xc86d('0x29')](function(_0x4c5e64){if(_0x4c5e64)_0x29e307=_0x4c5e64;return _[_0xc86d('0x40')](_0x29e307,[_0xc86d('0x61'),0x1]);})['then'](respondWithResult(_0xc2d3c8,null))[_0xc86d('0x46')](handleError(_0xc2d3c8,null));};function hasDefaultDashboard(_0x45520f){var _0x568467=[0x65];return new BPromise(function(_0xe99aa6,_0x54998e){try{if(_0x45520f[_0xc86d('0x65')]){_0xe99aa6(_0x568467);}else{return db[_0xc86d('0x59')][_0xc86d('0x66')]({'where':{'sectionId':_0x45520f['id']},'raw':!![]})['then'](function(_0x3a53a4){_0x3a53a4?_0xe99aa6(_0x568467):_0xe99aa6();});}}catch(_0x19fa2f){_0x54998e(_0x19fa2f);}});}function getCustomDashboards(_0x2948d3){var _0xe20161=[];return new BPromise(function(_0x17eb20,_0xa1d94a){try{if(_0x2948d3[_0xc86d('0x65')]){return db['Dashboard'][_0xc86d('0x45')]({'raw':!![]})[_0xc86d('0x29')](function(_0x33d492){_0x33d492['forEach'](function(_0x2ffbc7){_0xe20161[_0xc86d('0x5e')](_0x2ffbc7['id']+0x1869f);});_0x17eb20(_0xe20161);});}else{return db[_0xc86d('0x59')][_0xc86d('0x45')]({'where':{'sectionId':_0x2948d3['id']},'raw':!![]})['then'](function(_0x2b3dcf){_0x2b3dcf[_0xc86d('0x67')](function(_0x4e69ae){_0xe20161['push'](_0x4e69ae[_0xc86d('0x68')]+0x1869f);});_0x17eb20(_0xe20161);});}}catch(_0x27f63d){_0xa1d94a(_0x27f63d);}});}function getPlugins(_0x570a11){var _0x3bf107=[];return new BPromise(function(_0x3e46a3,_0x1a0616){try{if(_0x570a11[_0xc86d('0x65')]){return db['Plugin'][_0xc86d('0x45')]({'raw':!![]})['then'](function(_0x1bf8d4){_0x1bf8d4[_0xc86d('0x67')](function(_0x2f8652){_0x3bf107[_0xc86d('0x5e')](_0x2f8652['id']+0x15b38);});_0x3e46a3(_0x3bf107);});}else{return db[_0xc86d('0x59')][_0xc86d('0x45')]({'where':{'sectionId':_0x570a11['id']},'raw':!![]})[_0xc86d('0x29')](function(_0x2bf77a){_0x2bf77a['forEach'](function(_0x1a52e2){_0x3bf107[_0xc86d('0x5e')](_0x1a52e2[_0xc86d('0x68')]+0x15b38);});_0x3e46a3(_0x3bf107);});}}catch(_0x429c45){_0x1a0616(_0x429c45);}});}exports['addResources']=function(_0x963bc2,_0x54fa5d){return db[_0xc86d('0x30')][_0xc86d('0x5a')]({'where':{'id':_0x963bc2[_0xc86d('0x48')]['id']}})[_0xc86d('0x29')](handleEntityNotFound(_0x54fa5d,null))[_0xc86d('0x29')](function(_0x3fe5ce){if(_0x3fe5ce){return db[_0xc86d('0x54')]['transaction'](function(_0x37f708){return db[_0xc86d('0x5d')]['findAll']({'where':{'userProfileId':_0x963bc2['params']['id']},'attributes':['id'],'raw':!![]})[_0xc86d('0x29')](function(_0x40761f){if(_0x40761f){return db['UserProfileSection'][_0xc86d('0x5b')]({'where':{'userProfileId':_0x963bc2[_0xc86d('0x48')]['id'],'id':_[_0xc86d('0x2f')](_0x40761f,function(_0x360615){return _0x360615['id'];})},'transaction':_0x37f708});}})[_0xc86d('0x29')](function(_0x1c14d6){var _0x2c1431=_[_0xc86d('0x2f')](_0x963bc2[_0xc86d('0x4b')],function(_0x48b1b5){_0x48b1b5['userProfileId']=_0x963bc2[_0xc86d('0x48')]['id'];return _0x48b1b5;});return db[_0xc86d('0x5d')][_0xc86d('0x69')](_0x2c1431,{'raw':!![],'transaction':_0x37f708});})['then'](function(_0x389f19){var _0x1b3bcb=_[_0xc86d('0x40')](_['map'](_0x389f19,function(_0x24719d){return _0x24719d[_0xc86d('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x1b3bcb){return db['UserProfileSection'][_0xc86d('0x45')]({'where':{'userProfileId':_0x963bc2[_0xc86d('0x48')]['id'],'sectionId':_[_0xc86d('0x2f')](_0x1b3bcb,function(_0x731435){return _0x731435[_0xc86d('0x56')];})},'attributes':['id',_0xc86d('0x56')],'raw':!![]})[_0xc86d('0x29')](function(_0x553ab0){var _0x2a09d9=_[_0xc86d('0x2f')](_0x963bc2['body'],function(_0x513639){_0x513639[_0xc86d('0x57')]=_0x963bc2[_0xc86d('0x48')]['id'];return _0x513639;});return db['UserProfileResource'][_0xc86d('0x69')](_0x2a09d9,{'raw':!![],'transaction':_0x37f708});});}})[_0xc86d('0x46')](handleError(_0x54fa5d,null));});}})[_0xc86d('0x29')](function(_0x36435f){var _0x30c4d5=_['map'](_0x36435f,function(_0x50d2ae){return _0x50d2ae[_0xc86d('0x4f')]({'plain':!![]});});})['then'](respondWithResult(_0x54fa5d,null))[_0xc86d('0x46')](handleError(_0x54fa5d,null));};exports[_0xc86d('0x6a')]=function(_0x505ffa,_0xc628a1,_0x3105c5){return db[_0xc86d('0x30')][_0xc86d('0x5a')]({'where':{'id':_0x505ffa['params']['id']}})[_0xc86d('0x29')](handleEntityNotFound(_0xc628a1,null))['then'](function(_0x36035b){if(_0x36035b){return _0x36035b['removeResources'](_0x505ffa[_0xc86d('0x35')]['ids']);}})[_0xc86d('0x29')](respondWithStatusCode(_0xc628a1,null))[_0xc86d('0x46')](handleError(_0xc628a1,null));};exports['getResources']=function(_0x3ce441,_0x49c64e){var _0x5d322c={};if(!_0x3ce441[_0xc86d('0x35')][_0xc86d('0x6b')])throw new Error(_0xc86d('0x6c'));if(!_0x3ce441[_0xc86d('0x35')]['hasOwnProperty'](_0xc86d('0x3c'))){_0x5d322c['limit']=qs[_0xc86d('0x20')](_0x3ce441[_0xc86d('0x35')][_0xc86d('0x20')]);_0x5d322c[_0xc86d('0x22')]=qs[_0xc86d('0x22')](_0x3ce441[_0xc86d('0x35')][_0xc86d('0x22')]);}return db['UserProfile'][_0xc86d('0x5a')]({'where':{'id':_0x3ce441[_0xc86d('0x48')]['id']}})[_0xc86d('0x29')](function(_0x180f1c){if(!_0x180f1c)throw new Error(_0xc86d('0x6d')+_0x3ce441['params']['id']);return db[_0xc86d('0x30')][_0xc86d('0x6e')](_0x3ce441);})[_0xc86d('0x29')](respondWithFilteredResult(_0x49c64e,_0x5d322c))[_0xc86d('0x46')](handleError(_0x49c64e,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 40f7fe9..ffa9a9d 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 _0x8cad=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update'];(function(_0x5e940f,_0xe7ac8a){var _0x4cb995=function(_0x598864){while(--_0x598864){_0x5e940f['push'](_0x5e940f['shift']());}};_0x4cb995(++_0xe7ac8a);}(_0x8cad,0xfe));var _0xd8ca=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x8cad[_0x368fb9];return _0x4892fb;};'use strict';var EventEmitter=require(_0xd8ca('0x0'));var UserProfile=require(_0xd8ca('0x1'))['db'][_0xd8ca('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd8ca('0x3')](0x0);var events={'afterCreate':_0xd8ca('0x4'),'afterUpdate':_0xd8ca('0x5'),'afterDestroy':_0xd8ca('0x6')};function emitEvent(_0x10c3c8){return function(_0x1334ec,_0x1e29ce,_0x388aeb){UserProfileEvents[_0xd8ca('0x7')](_0x10c3c8+':'+_0x1334ec['id'],_0x1334ec);UserProfileEvents[_0xd8ca('0x7')](_0x10c3c8,_0x1334ec);_0x388aeb(null);};}for(var e in events){if(events[_0xd8ca('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd8ca('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xa498=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserProfile'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0xa498,0x1d6));var _0x8a49=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xa498[_0x503950];return _0x1657a9;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x8a49('0x0'))['db'][_0x8a49('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a49('0x2'),'afterDestroy':_0x8a49('0x3')};function emitEvent(_0x1d4dd2){return function(_0x65eb15,_0x2f362e,_0x5aaf52){UserProfileEvents[_0x8a49('0x4')](_0x1d4dd2+':'+_0x65eb15['id'],_0x65eb15);UserProfileEvents['emit'](_0x1d4dd2,_0x65eb15);_0x5aaf52(null);};}for(var e in events){if(events[_0x8a49('0x5')](e)){var event=events[e];UserProfile[_0x8a49('0x6')](e,emitEvent(event));}}module[_0x8a49('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a607e91..847ba9c 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 _0x6599=['associatedResources','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','Users','role','admin','user','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','from','user_has_','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','section','isEmpty','push','UserProfileSection','all','length','find','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','key','foreignKey','forEach','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','includeAll','Tags','color','tag','ThroughTags','openTabs','dataValues','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','models','filter','field','value','findAll','then','map','catch','model'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x6599,0x16e));var _0x9659=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x6599[_0x438fe1];return _0x3c8e1b;};'use strict';var _=require(_0x9659('0x0'));var attributes=require(_0x9659('0x1'));var qs=require(_0x9659('0x2'));module['exports']=function(_0x578b1e){var _0x14ca0b=_0x578b1e[_0x9659('0x3')];function _0x2c9329(_0x3a8a90,_0x951877){return new Promise(function(_0x462056,_0x4257f6){if(!_0x951877)return _0x462056(null);var _0x4f4840=_0x951877['filter']?{[_0x951877[_0x9659('0x4')][_0x9659('0x5')]]:_0x951877[_0x9659('0x4')][_0x9659('0x6')]}:undefined;return _0x14ca0b[_0x3a8a90][_0x9659('0x7')]({'where':_0x4f4840,'raw':!![]})[_0x9659('0x8')](function(_0x5c6eec){_0x951877['associatedResources']=_[_0x9659('0x9')](_0x5c6eec,'id');_0x462056(_0x951877);})[_0x9659('0xa')](function(_0x331b99){_0x4257f6(_0x331b99);});});}function _0xebbee4(_0xf4624c,_0x2afcbf){return new Promise(function(_0x32381a,_0xfffff4){var _0x46d98f=_0xf4624c[_0x9659('0x4')]?{[_0xf4624c[_0x9659('0x4')][_0x9659('0x5')]]:_0xf4624c[_0x9659('0x4')][_0x9659('0x6')]}:undefined;return _0x14ca0b[_0xf4624c[_0x9659('0xb')]][_0x9659('0x7')]({'where':_0x46d98f,'raw':!![]})[_0x9659('0x8')](function(_0x4c1a14){_0x2afcbf[_0x9659('0xc')]=_[_0x9659('0x9')](_0x4c1a14,function(_0x2c3b73){return _0x2c3b73['name'];});_0x32381a(_0x2afcbf);})[_0x9659('0xa')](function(_0x5c27d5){_0xfffff4(_0x5c27d5);});});}function _0x5a86ef(_0x1bdc7c,_0x68cbc7,_0x50d18e){if(!_0x68cbc7)return resolve(null);return new Promise(function(_0x856f8e,_0x4cf8be){return _0x14ca0b[_0x9659('0xd')][_0x9659('0x7')]({'where':{'sectionId':_0x68cbc7['id']},'raw':!![]})['then'](function(_0x22e6e9){if(_0x1bdc7c[_0x9659('0x5')]&&_0x1bdc7c['field']!=='id'){_0x68cbc7[_0x9659('0xc')]=_[_0x9659('0x9')](_0x22e6e9,function(_0xd2abd9){return _0xd2abd9[_0x1bdc7c['field']];});}else{if(_0x50d18e===_0x9659('0xe')){_0x68cbc7[_0x9659('0xc')]=_[_0x9659('0x9')](_0x22e6e9,function(_0x2bbcc4){return{'id':_0x2bbcc4[_0x9659('0xf')],'type':_0x2bbcc4['type']};});}else{_0x68cbc7[_0x9659('0xc')]=_[_0x9659('0x9')](_0x22e6e9,function(_0xb622c2){return _0xb622c2[_0x9659('0xf')];});}}_0x856f8e(_0x68cbc7);})[_0x9659('0xa')](function(_0x23c391){_0x4cf8be(_0x23c391);});});}function _0x1b0324(_0x30d9cc,_0x130ba1){var _0x3b56e5={'parentSections':[]};switch(_0x30d9cc[_0x9659('0x10')]()){case _0x9659('0x11'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x13');break;case _0x9659('0x14'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x15');break;case _0x9659('0x16'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x17');_0x3b56e5[_0x9659('0x18')]=[{'name':_0x9659('0x19'),'field':_0x9659('0x1a'),'foreignKey':_0x9659('0x1b')}];break;case'projects':_0x3b56e5['childModel']=_0x9659('0x1c');break;case _0x9659('0x1d'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x1e');_0x3b56e5['parentSections']=[{'name':_0x9659('0x1f'),'field':'id','foreignKey':_0x9659('0x20')}];break;case _0x9659('0x21'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x22');break;case _0x9659('0x23'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x24');break;case _0x9659('0x25'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x26');break;case _0x9659('0x27'):_0x3b56e5['childModel']='ChatQueue';break;case'chatwebsites':_0x3b56e5[_0x9659('0x12')]=_0x9659('0x28');break;case _0x9659('0x29'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x2a');break;case _0x9659('0x2b'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x2c');break;case _0x9659('0x2d'):case _0x9659('0x2e'):case'outboundroutes':_0x3b56e5[_0x9659('0x12')]=_0x9659('0x2f');break;case _0x9659('0x30'):_0x3b56e5[_0x9659('0x12')]='VoiceContext';break;case _0x9659('0x31'):_0x3b56e5['childModel']='VoiceMail';break;case _0x9659('0x32'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x33');_0x3b56e5[_0x9659('0x18')]=[{'name':_0x9659('0x34'),'field':_0x9659('0x1a'),'foreignKey':_0x9659('0x35'),'model':_0x9659('0x36'),'filter':{'field':'role','value':[_0x9659('0x37')]}},{'name':_0x9659('0x38'),'field':_0x9659('0x1a'),'foreignKey':_0x9659('0x35'),'model':'User','filter':{'field':'role','value':[_0x9659('0x39')]}},{'name':_0x9659('0x3a'),'field':_0x9659('0x1a'),'foreignKey':_0x9659('0x3b'),'model':_0x9659('0x3c'),'filter':{'field':_0x9659('0x3d'),'value':[_0x9659('0x3e')]}},{'name':_0x9659('0x3f'),'field':_0x9659('0x1a'),'foreignKey':'queue','model':_0x9659('0x3c'),'filter':{'field':_0x9659('0x3d'),'value':[_0x9659('0x40')]}}];break;case _0x9659('0x41'):_0x3b56e5['childModel']=_0x9659('0x42');break;case'chanspies':_0x3b56e5['childModel']=_0x9659('0x43');break;case'voiceprefixes':_0x3b56e5[_0x9659('0x12')]=_0x9659('0x44');break;case _0x9659('0x45'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x46');break;case _0x9659('0x47'):_0x3b56e5[_0x9659('0x12')]='MailQueue';break;case _0x9659('0x48'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x49');break;case _0x9659('0x4a'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x4b');break;case _0x9659('0x4c'):_0x3b56e5[_0x9659('0x12')]='OpenchannelQueue';break;case _0x9659('0x4d'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x4e');break;case _0x9659('0x4f'):_0x3b56e5['childModel']=_0x9659('0x50');break;case'smsaccounts':_0x3b56e5[_0x9659('0x12')]=_0x9659('0x51');break;case _0x9659('0x52'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x53');break;case _0x9659('0x54'):_0x3b56e5['childModel']=_0x9659('0x55');break;case _0x9659('0x56'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x57');break;case'voicequeues':case _0x9659('0x58'):_0x3b56e5[_0x9659('0x12')]='VoiceQueue';if(_0x130ba1){_0x3b56e5[_0x9659('0x18')]=[{'name':'VoiceQueues'},{'name':_0x9659('0x3f')}];}break;case _0x9659('0x59'):case _0x9659('0x5a'):case _0x9659('0x5b'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x36');if(_0x130ba1){_0x3b56e5[_0x9659('0x18')]=[{'name':_0x9659('0x5c'),'filter':{'field':_0x9659('0x5d'),'value':[_0x9659('0x5e'),_0x9659('0x5f')]},'ignore':!![]},{'name':_0x9659('0x34')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x3b56e5[_0x9659('0x12')]=_0x9659('0x60');break;case'salesforceaccounts':_0x3b56e5[_0x9659('0x12')]=_0x9659('0x61');break;case _0x9659('0x62'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x63');break;case _0x9659('0x64'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x65');break;case'deskaccounts':_0x3b56e5[_0x9659('0x12')]=_0x9659('0x66');break;case _0x9659('0x67'):_0x3b56e5[_0x9659('0x12')]='ZohoAccount';break;case _0x9659('0x68'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x36');break;case'cannedanswers':_0x3b56e5[_0x9659('0x12')]=_0x9659('0x69');break;case _0x9659('0x6a'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x6b');break;case _0x9659('0x6c'):_0x3b56e5[_0x9659('0x12')]='Dashboard';break;case _0x9659('0x6d'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x6e');break;case'pauses':_0x3b56e5['childModel']='Pause';break;case _0x9659('0x6f'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x70');break;case _0x9659('0x71'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x72');break;case _0x9659('0x73'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x74');break;case _0x9659('0x75'):_0x3b56e5['childModel']=_0x9659('0x76');break;case _0x9659('0x77'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x78');break;case'trunks':_0x3b56e5[_0x9659('0x12')]=_0x9659('0x79');break;case _0x9659('0x7a'):_0x3b56e5['childModel']=_0x9659('0x7b');break;case _0x9659('0x7c'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0x7d');break;case _0x9659('0x7e'):_0x3b56e5[_0x9659('0x12')]=_0x9659('0xe');_0x3b56e5[_0x9659('0x18')]=[{'name':_0x9659('0x7f'),'field':'id','foreignKey':_0x9659('0x80')}];break;case _0x9659('0x81'):_0x3b56e5['childModel']='AnalyticMetric';break;case _0x9659('0x54'):_0x3b56e5['childModel']=_0x9659('0x55');break;}return _0x3b56e5;}function _0x3484c2(_0x11d4e8,_0x4b1c61){var _0x32b7ce=_0x11d4e8['charAt'](0x0)[_0x9659('0x82')]()+_0x11d4e8[_0x9659('0x83')](0x1);var _0x54ff28={'type':_0x14ca0b[_0x9659('0x84')]['QueryTypes'][_0x9659('0x85')],'raw':!![]};return new BPromise(function(_0x47cd74,_0x2df747){var _0x18b3d2=squel[_0x9659('0x86')]()[_0x9659('0x5')](_0x9659('0x87')+_0x32b7ce+_0x9659('0x88'),'id')[_0x9659('0x5')]('ui.createdAt')[_0x9659('0x89')](_0x9659('0x8a')+_0x11d4e8+'_interactions','ui')['where'](_0x9659('0x8b'),_0x4b1c61['id']);return _0x14ca0b['sequelize'][_0x9659('0x8c')](_0x18b3d2[_0x9659('0x8d')](),_0x54ff28)[_0x9659('0x8')](function(_0x13fe9d){_0x4b1c61[_0x32b7ce+_0x9659('0x8e')]=_0x13fe9d;_0x47cd74(_0x13fe9d);})['catch'](function(_0x16166d){_0x2df747(_0x16166d);});});}return _0x578b1e[_0x9659('0x8f')](_0x9659('0x90'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x24ce1d){var _0x4cc89f={'raw':![],'where':{}};var _0x1b661a={};var _0x4f8c3e={'count':0x0,'rows':[]};var _0x1241e7=_0x24ce1d[_0x9659('0x8c')][_0x9659('0x91')];var _0x55af65=_0x24ce1d[_0x9659('0x8c')]['mergeResources']||![];var _0x363fa9=_0x1b0324(_0x1241e7,_0x55af65);if(!_0x363fa9[_0x9659('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0x1241e7+'\x27');var _0x3916d7=[{'name':_0x1241e7}];if(!_[_0x9659('0x92')](_0x363fa9[_0x9659('0x18')]))_0x3916d7=_0x363fa9[_0x9659('0x18')];var _0x58bf96=[];for(var _0x273750=0x0;_0x273750<_0x3916d7['length'];_0x273750++){_0x58bf96[_0x9659('0x93')](_0x14ca0b[_0x9659('0x94')]['find']({'where':{'userProfileId':_0x24ce1d['params']['id'],'name':_0x3916d7[_0x273750][_0x9659('0x1a')]},'raw':!![]}));}return Promise[_0x9659('0x95')](_0x58bf96)[_0x9659('0x8')](function(_0x155e38){var _0x2523b6=_['filter'](_0x155e38,function(_0x11f52b){return _0x11f52b?_0x11f52b:undefined;});var _0x2691d4=_[_0x9659('0x4')](_0x3916d7,['ignore',!![]]);var _0x29ccb2=_[_0x9659('0x92')](_0x2523b6)&&_[_0x9659('0x92')](_0x2691d4)?null:_['union'](_0x2691d4,_0x2523b6);if(!_0x29ccb2)return null;var _0x357539=[];for(var _0x63995d=0x0;_0x63995d<_0x29ccb2[_0x9659('0x96')];_0x63995d++){var _0x28725b=_[_0x9659('0x97')](_0x3916d7,function(_0xd9ade6){return _0x29ccb2[_0x63995d]?_0xd9ade6[_0x9659('0x1a')]===_0x29ccb2[_0x63995d][_0x9659('0x1a')]:null;});if(_0x28725b){if(_0x29ccb2[_0x63995d][_0x9659('0x98')]){_0x357539[_0x9659('0x93')](_0x2c9329(_0x363fa9[_0x9659('0x12')],_0x29ccb2[_0x63995d]));}else{if(!_0x29ccb2[_0x63995d][_0x9659('0x99')]){_0x357539[_0x9659('0x93')](_0x5a86ef(_0x28725b,_0x29ccb2[_0x63995d],_0x363fa9['childModel']));}else{if(_0x28725b[_0x9659('0xb')]){_0x357539[_0x9659('0x93')](_0xebbee4(_0x28725b,_0x29ccb2[_0x63995d]));}}}}}return Promise[_0x9659('0x95')](_0x357539);})[_0x9659('0x8')](function(_0x18805d){var _0x1f6a38=_0x18805d;var _0x45715d=null;if(_0x1f6a38){_0x45715d=_0x1f6a38['length']===0x1?_0x1f6a38[0x0]:null;}if(!_0x45715d&&!_0x1f6a38)return _0x4f8c3e;var _0x55744e=_0x14ca0b[_0x363fa9[_0x9659('0x12')]][_0x9659('0x9a')];_0x1b661a[_0x9659('0xb')]=_[_0x9659('0x9b')](_0x55744e);_0x1b661a[_0x9659('0x8c')]=_[_0x9659('0x9b')](_0x24ce1d[_0x9659('0x8c')]);_0x1b661a[_0x9659('0x9c')]=_[_0x9659('0x9d')](_0x1b661a[_0x9659('0xb')],_0x1b661a['query']);_0x4cc89f[_0x9659('0x9e')]=_['intersection'](_0x1b661a[_0x9659('0xb')],qs[_0x9659('0x9f')](_0x24ce1d[_0x9659('0x8c')]['fields']));_0x4cc89f['attributes']=_0x4cc89f['attributes'][_0x9659('0x96')]?_0x4cc89f[_0x9659('0x9e')]:_0x1b661a[_0x9659('0xb')];if(!_0x24ce1d[_0x9659('0x8c')][_0x9659('0xa0')](_0x9659('0xa1'))){_0x4cc89f[_0x9659('0xa2')]=qs['limit'](_0x24ce1d[_0x9659('0x8c')]['limit']);_0x4cc89f[_0x9659('0xa3')]=qs[_0x9659('0xa3')](_0x24ce1d[_0x9659('0x8c')][_0x9659('0xa3')]);}_0x4cc89f[_0x9659('0xa4')]=qs['sort'](_0x24ce1d['query'][_0x9659('0xa5')]);_0x4cc89f[_0x9659('0xa6')]=qs[_0x9659('0x9c')](_[_0x9659('0xa7')](_0x24ce1d[_0x9659('0x8c')],_0x1b661a[_0x9659('0x9c')]));if(_0x24ce1d['query']['filter']){_0x4cc89f[_0x9659('0xa6')]=_[_0x9659('0xa8')](_0x4cc89f[_0x9659('0xa6')],{'$or':_[_0x9659('0x9')](_0x55744e,function(_0x59a8ec){if(_0x59a8ec[_0x9659('0x3d')][_0x9659('0xa9')]!=='VIRTUAL'){var _0x53e713={};_0x53e713[_0x59a8ec[_0x9659('0x5')]]={'$like':'%'+_0x24ce1d[_0x9659('0x8c')][_0x9659('0x4')]+'%'};return _0x53e713;}})});}var _0x19e9c0=[];if(_0x45715d){var _0x48c977=_[_0x9659('0x97')](_0x3916d7,[_0x9659('0x1a'),_0x45715d[_0x9659('0x1a')]]);if(_0x48c977[_0x9659('0x5')]){var _0x409b40={};if(_0x363fa9[_0x9659('0x12')]==='AnalyticExtractedReport'){_0x409b40[_0x48c977[_0x9659('0xaa')]]=_['map'](_0x45715d[_0x9659('0xc')],'id');}else{_0x409b40[_0x48c977[_0x9659('0xaa')]]=_0x45715d[_0x9659('0xc')];}_0x19e9c0[_0x9659('0x93')](_0x409b40);}else{_0x4cc89f[_0x9659('0xa6')]['id']=_0x45715d[_0x9659('0xc')];}}else{for(var _0x3f787f=0x0;_0x3f787f<_0x1f6a38[_0x9659('0x96')];_0x3f787f++){var _0x48c977=_[_0x9659('0x97')](_0x3916d7,[_0x9659('0x1a'),_0x1f6a38[_0x3f787f][_0x9659('0x1a')]]);if(_0x48c977[_0x9659('0x5')]){var _0x409b40={};_0x409b40[_0x48c977['foreignKey']]=_0x1f6a38[_0x3f787f][_0x9659('0xc')];_0x19e9c0['push'](_0x409b40);}else{if(!_0x4cc89f['where']['id'])_0x4cc89f[_0x9659('0xa6')]['id']=[];_0x1f6a38[_0x3f787f][_0x9659('0xc')][_0x9659('0xab')](function(_0x25c938){_0x4cc89f['where']['id'][_0x9659('0x93')](_0x25c938);});}}}if(!_[_0x9659('0x92')](_0x19e9c0)){_0x4cc89f[_0x9659('0xa6')]=_[_0x9659('0xa8')](_0x4cc89f[_0x9659('0xa6')],{'$and':{'$or':_0x19e9c0}});}_0x4cc89f=_[_0x9659('0xa8')]({},_0x4cc89f,_0x24ce1d['options']);if(_0x45715d&&!_0x45715d[_0x9659('0x99')]&&_0x363fa9['childModel']===_0x9659('0xe')){if(_0x24ce1d[_0x9659('0x8c')]['includeAll']){_0x4cc89f[_0x9659('0xac')]=[{'all':!![]}];}return _0x14ca0b[_0x363fa9[_0x9659('0x12')]][_0x9659('0x7')](_0x4cc89f)[_0x9659('0x8')](function(_0x5c9ddc){var _0x376d47=[];_0x5c9ddc[_0x9659('0xab')](function(_0x31e394){var _0x4c4d64;switch(_0x31e394[_0x9659('0xad')]){case _0x9659('0xae'):_0x4c4d64=_['find'](_0x45715d[_0x9659('0xc')],function(_0xf43cf){return _0xf43cf['id']===_0x31e394[_0x9659('0x80')]&&_0xf43cf[_0x9659('0x3d')]===_0x9659('0xaf');});break;case _0x9659('0xb0'):_0x4c4d64=_[_0x9659('0x97')](_0x45715d[_0x9659('0xc')],function(_0x44c8a5){return _0x44c8a5['id']===_0x31e394[_0x9659('0x80')]&&_0x44c8a5[_0x9659('0x3d')]===_0x9659('0xb1');});break;}if(_0x4c4d64)_0x376d47[_0x9659('0x93')](_0x31e394);});_0x4f8c3e[_0x9659('0xb2')]=_0x376d47[_0x9659('0x96')];_0x4f8c3e[_0x9659('0xb3')]=_0x376d47;return _0x4f8c3e;});}else{return _0x14ca0b[_0x363fa9['childModel']][_0x9659('0xb2')]({'where':_0x4cc89f['where']})[_0x9659('0x8')](function(_0x147588){_0x4f8c3e[_0x9659('0xb2')]=_0x147588;if(_0x24ce1d[_0x9659('0x8c')][_0x9659('0xb4')]){if(_0x363fa9[_0x9659('0x12')]===_0x9659('0x1e')){_0x4cc89f[_0x9659('0xac')]=[{'model':_0x14ca0b[_0x9659('0x74')],'as':_0x9659('0xb5'),'attributes':['id',_0x9659('0x1a'),_0x9659('0xb6')],'required':_0x24ce1d[_0x9659('0x8c')][_0x9659('0xb7')]?!![]:![]},{'model':_0x14ca0b['Tag'],'as':_0x9659('0xb8'),'attributes':['id',_0x9659('0x1a'),_0x9659('0xb6')],'through':_0x24ce1d[_0x9659('0x8c')][_0x9659('0xb7')]?{'attributes':[],'where':{'TagId':_0x24ce1d['query'][_0x9659('0xb7')]||undefined}}:{},'required':_0x24ce1d['query'][_0x9659('0xb7')]?!![]:![]}];}else{_0x4cc89f['include']=[{'all':!![]}];}}return _0x14ca0b[_0x363fa9[_0x9659('0x12')]][_0x9659('0x7')](_0x4cc89f);})[_0x9659('0x8')](function(_0x54d1a5){_0x4f8c3e['rows']=_0x54d1a5;if(_0x1241e7==='Agents'&&_0x24ce1d[_0x9659('0x8c')][_0x9659('0xb9')]==='true'){var _0x3cd25f=[];for(var _0x5b24f0=0x0;_0x5b24f0<_0x4f8c3e['rows'][_0x9659('0x96')];_0x5b24f0++){_0x3cd25f['push'](_0x3484c2('chat',_0x4f8c3e[_0x9659('0xb3')][_0x5b24f0][_0x9659('0xba')]));_0x3cd25f[_0x9659('0x93')](_0x3484c2('sms',_0x4f8c3e[_0x9659('0xb3')][_0x5b24f0]['dataValues']));_0x3cd25f['push'](_0x3484c2('fax',_0x4f8c3e[_0x9659('0xb3')][_0x5b24f0][_0x9659('0xba')]));_0x3cd25f['push'](_0x3484c2(_0x9659('0xbb'),_0x4f8c3e[_0x9659('0xb3')][_0x5b24f0][_0x9659('0xba')]));_0x3cd25f['push'](_0x3484c2(_0x9659('0xbc'),_0x4f8c3e['rows'][_0x5b24f0][_0x9659('0xba')]));_0x3cd25f[_0x9659('0x93')](_0x3484c2('whatsapp',_0x4f8c3e[_0x9659('0xb3')][_0x5b24f0][_0x9659('0xba')]));}return Promise[_0x9659('0x95')](_0x3cd25f)['then'](function(){return _0x4f8c3e;});}return _0x4f8c3e;});}});}}});}; \ No newline at end of file +var _0xc794=['FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','VoiceQueues','name','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Tag','templates','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','query','OpenTabs','define','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','ignore','length','autoAssociation','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','merge','foreignKey','options','include','reportType','default','reportId','DefaultReports','custom','CustomReports','count','rows','includeAll','Tags','color','tag','ThroughTags','openTabs','true','dataValues','sms','fax','openchannel','whatsapp','./userProfile.attributes','models','filter','field','value','findAll','then','associatedResources','catch','model','map','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','childModel','SquareProject','squarerecordings','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc794,0x95));var _0x4c79=function(_0x4fdc05,_0x357462){_0x4fdc05=_0x4fdc05-0x0;var _0xbf9a1b=_0xc794[_0x4fdc05];return _0xbf9a1b;};'use strict';var _=require('lodash');var attributes=require(_0x4c79('0x0'));var qs=require('../../components/parsers/qs');module['exports']=function(_0x597ea0){var _0x3b1b88=_0x597ea0[_0x4c79('0x1')];function _0x1ce516(_0x304722,_0x96403){return new Promise(function(_0x24ceae,_0x18a92e){if(!_0x96403)return _0x24ceae(null);var _0x32a445=_0x96403[_0x4c79('0x2')]?{[_0x96403[_0x4c79('0x2')][_0x4c79('0x3')]]:_0x96403[_0x4c79('0x2')][_0x4c79('0x4')]}:undefined;return _0x3b1b88[_0x304722][_0x4c79('0x5')]({'where':_0x32a445,'raw':!![]})[_0x4c79('0x6')](function(_0x4dc8a4){_0x96403[_0x4c79('0x7')]=_['map'](_0x4dc8a4,'id');_0x24ceae(_0x96403);})[_0x4c79('0x8')](function(_0x121fcf){_0x18a92e(_0x121fcf);});});}function _0xfcbca6(_0x28ac4a,_0x5701a3){return new Promise(function(_0x3ad4df,_0x41e045){var _0x5635dd=_0x28ac4a[_0x4c79('0x2')]?{[_0x28ac4a['filter'][_0x4c79('0x3')]]:_0x28ac4a[_0x4c79('0x2')]['value']}:undefined;return _0x3b1b88[_0x28ac4a[_0x4c79('0x9')]][_0x4c79('0x5')]({'where':_0x5635dd,'raw':!![]})['then'](function(_0x25b64f){_0x5701a3[_0x4c79('0x7')]=_[_0x4c79('0xa')](_0x25b64f,function(_0x5d0ce8){return _0x5d0ce8['name'];});_0x3ad4df(_0x5701a3);})[_0x4c79('0x8')](function(_0x5d5caf){_0x41e045(_0x5d5caf);});});}function _0x1ff29c(_0x39e560,_0xde18f5,_0x2307b9){if(!_0xde18f5)return resolve(null);return new Promise(function(_0x754010,_0xf7b69b){return _0x3b1b88[_0x4c79('0xb')][_0x4c79('0x5')]({'where':{'sectionId':_0xde18f5['id']},'raw':!![]})[_0x4c79('0x6')](function(_0x5622e4){if(_0x39e560[_0x4c79('0x3')]&&_0x39e560['field']!=='id'){_0xde18f5[_0x4c79('0x7')]=_[_0x4c79('0xa')](_0x5622e4,function(_0x4bca93){return _0x4bca93[_0x39e560[_0x4c79('0x3')]];});}else{if(_0x2307b9===_0x4c79('0xc')){_0xde18f5[_0x4c79('0x7')]=_[_0x4c79('0xa')](_0x5622e4,function(_0x214af9){return{'id':_0x214af9[_0x4c79('0xd')],'type':_0x214af9['type']};});}else{_0xde18f5['associatedResources']=_[_0x4c79('0xa')](_0x5622e4,function(_0x8f2be1){return _0x8f2be1[_0x4c79('0xd')];});}}_0x754010(_0xde18f5);})[_0x4c79('0x8')](function(_0x57503a){_0xf7b69b(_0x57503a);});});}function _0x1f09b0(_0xd73569,_0x5e5f59){var _0x275e4d={'parentSections':[]};switch(_0xd73569[_0x4c79('0xe')]()){case'squareprojects':_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x10');break;case'odbc':_0x275e4d[_0x4c79('0xf')]='SquareOdbc';break;case _0x4c79('0x11'):_0x275e4d[_0x4c79('0xf')]='SquareRecording';_0x275e4d[_0x4c79('0x12')]=[{'name':_0x4c79('0x13'),'field':'name','foreignKey':_0x4c79('0x14')}];break;case _0x4c79('0x15'):_0x275e4d['childModel']=_0x4c79('0x16');break;case _0x4c79('0x17'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x18');_0x275e4d[_0x4c79('0x12')]=[{'name':_0x4c79('0x19'),'field':'id','foreignKey':_0x4c79('0x1a')}];break;case _0x4c79('0x1b'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x1c');break;case _0x4c79('0x1d'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x1e');break;case _0x4c79('0x1f'):_0x275e4d['childModel']=_0x4c79('0x20');break;case _0x4c79('0x21'):_0x275e4d[_0x4c79('0xf')]='ChatQueue';break;case _0x4c79('0x22'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x23');break;case _0x4c79('0x24'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x25');break;case _0x4c79('0x26'):_0x275e4d['childModel']='FaxAccount';break;case _0x4c79('0x27'):case _0x4c79('0x28'):case'outboundroutes':_0x275e4d['childModel']=_0x4c79('0x29');break;case'contexts':_0x275e4d['childModel']=_0x4c79('0x2a');break;case'voicemails':_0x275e4d['childModel']=_0x4c79('0x2b');break;case _0x4c79('0x2c'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x2d');_0x275e4d['parentSections']=[{'name':_0x4c79('0x2e'),'field':'name','foreignKey':_0x4c79('0x2f'),'model':_0x4c79('0x30'),'filter':{'field':'role','value':[_0x4c79('0x31')]}},{'name':_0x4c79('0x32'),'field':'name','foreignKey':_0x4c79('0x2f'),'model':_0x4c79('0x30'),'filter':{'field':_0x4c79('0x33'),'value':['telephone']}},{'name':_0x4c79('0x34'),'field':_0x4c79('0x35'),'foreignKey':_0x4c79('0x36'),'model':_0x4c79('0x37'),'filter':{'field':_0x4c79('0x38'),'value':[_0x4c79('0x39')]}},{'name':_0x4c79('0x3a'),'field':_0x4c79('0x35'),'foreignKey':_0x4c79('0x36'),'model':_0x4c79('0x37'),'filter':{'field':'type','value':[_0x4c79('0x3b')]}}];break;case _0x4c79('0x3c'):_0x275e4d['childModel']=_0x4c79('0x3d');break;case _0x4c79('0x3e'):_0x275e4d[_0x4c79('0xf')]='VoiceChanSpy';break;case'voiceprefixes':_0x275e4d['childModel']=_0x4c79('0x3f');break;case _0x4c79('0x40'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x41');break;case _0x4c79('0x42'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x43');break;case _0x4c79('0x44'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x45');break;case _0x4c79('0x46'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x47');break;case _0x4c79('0x48'):_0x275e4d[_0x4c79('0xf')]='OpenchannelQueue';break;case'openchannelaccounts':_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x49');break;case'smsqueues':_0x275e4d['childModel']=_0x4c79('0x4a');break;case _0x4c79('0x4b'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x4c');break;case _0x4c79('0x4d'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x4e');break;case _0x4c79('0x4f'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x50');break;case _0x4c79('0x51'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x52');break;case _0x4c79('0x53'):case _0x4c79('0x54'):_0x275e4d[_0x4c79('0xf')]='VoiceQueue';if(_0x5e5f59){_0x275e4d[_0x4c79('0x12')]=[{'name':_0x4c79('0x34')},{'name':_0x4c79('0x3a')}];}break;case'users':case _0x4c79('0x55'):case _0x4c79('0x56'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x30');if(_0x5e5f59){_0x275e4d[_0x4c79('0x12')]=[{'name':_0x4c79('0x57'),'filter':{'field':_0x4c79('0x33'),'value':[_0x4c79('0x58'),_0x4c79('0x59')]},'ignore':!![]},{'name':_0x4c79('0x2e')},{'name':_0x4c79('0x32')}];}break;case'zendeskaccounts':_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x5a');break;case _0x4c79('0x5b'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x5c');break;case _0x4c79('0x5d'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x5e');break;case _0x4c79('0x5f'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x60');break;case'deskaccounts':_0x275e4d[_0x4c79('0xf')]='DeskAccount';break;case _0x4c79('0x61'):_0x275e4d['childModel']=_0x4c79('0x62');break;case _0x4c79('0x63'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x30');break;case _0x4c79('0x64'):_0x275e4d[_0x4c79('0xf')]='CannedAnswer';break;case'dispositions':_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x65');break;case'customdashboards':_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x66');break;case _0x4c79('0x67'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x68');break;case _0x4c79('0x69'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x6a');break;case _0x4c79('0x6b'):_0x275e4d['childModel']=_0x4c79('0x6c');break;case _0x4c79('0x6d'):_0x275e4d['childModel']='Sound';break;case'tags':_0x275e4d['childModel']=_0x4c79('0x6e');break;case _0x4c79('0x6f'):_0x275e4d[_0x4c79('0xf')]='Template';break;case _0x4c79('0x70'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x71');break;case _0x4c79('0x72'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x73');break;case _0x4c79('0x74'):_0x275e4d['childModel']=_0x4c79('0x75');break;case'plugins':_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x76');break;case _0x4c79('0x77'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0xc');_0x275e4d[_0x4c79('0x12')]=[{'name':_0x4c79('0x78'),'field':'id','foreignKey':'reportId'}];break;case _0x4c79('0x79'):_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x7a');break;case'whatsappaccounts':_0x275e4d[_0x4c79('0xf')]=_0x4c79('0x50');break;}return _0x275e4d;}function _0x3473d8(_0x335464,_0x2072b1){var _0x40c3c0=_0x335464[_0x4c79('0x7b')](0x0)['toUpperCase']()+_0x335464[_0x4c79('0x7c')](0x1);var _0x3e8f7a={'type':_0x3b1b88['Sequelize'][_0x4c79('0x7d')][_0x4c79('0x7e')],'raw':!![]};return new BPromise(function(_0x4599bd,_0x2db767){var _0x27fb08=squel[_0x4c79('0x7f')]()[_0x4c79('0x3')](_0x4c79('0x80')+_0x40c3c0+_0x4c79('0x81'),'id')[_0x4c79('0x3')](_0x4c79('0x82'))[_0x4c79('0x83')](_0x4c79('0x84')+_0x335464+_0x4c79('0x85'),'ui')[_0x4c79('0x86')]('ui.UserId\x20=\x20?',_0x2072b1['id']);return _0x3b1b88['sequelize'][_0x4c79('0x87')](_0x27fb08['toString'](),_0x3e8f7a)[_0x4c79('0x6')](function(_0x59aba1){_0x2072b1[_0x40c3c0+_0x4c79('0x88')]=_0x59aba1;_0x4599bd(_0x59aba1);})[_0x4c79('0x8')](function(_0x95ea3f){_0x2db767(_0x95ea3f);});});}return _0x597ea0[_0x4c79('0x89')]('UserProfile',attributes,{'tableName':_0x4c79('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x371a02){var _0x557f40={'raw':![],'where':{}};var _0x6c161b={};var _0x3bcb39={'count':0x0,'rows':[]};var _0x424779=_0x371a02[_0x4c79('0x87')][_0x4c79('0x8b')];var _0x1e4c31=_0x371a02[_0x4c79('0x87')][_0x4c79('0x8c')]||![];var _0x342837=_0x1f09b0(_0x424779,_0x1e4c31);if(!_0x342837[_0x4c79('0xf')])throw new Error(_0x4c79('0x8d')+_0x424779+'\x27');var _0x31d6d6=[{'name':_0x424779}];if(!_[_0x4c79('0x8e')](_0x342837[_0x4c79('0x12')]))_0x31d6d6=_0x342837['parentSections'];var _0x71ed4c=[];for(var _0x2d4c32=0x0;_0x2d4c32<_0x31d6d6['length'];_0x2d4c32++){_0x71ed4c[_0x4c79('0x8f')](_0x3b1b88[_0x4c79('0x90')][_0x4c79('0x91')]({'where':{'userProfileId':_0x371a02[_0x4c79('0x92')]['id'],'name':_0x31d6d6[_0x2d4c32][_0x4c79('0x35')]},'raw':!![]}));}return Promise['all'](_0x71ed4c)[_0x4c79('0x6')](function(_0x1cab82){var _0x5b1323=_['filter'](_0x1cab82,function(_0x5b75e8){return _0x5b75e8?_0x5b75e8:undefined;});var _0xc7aaa=_[_0x4c79('0x2')](_0x31d6d6,[_0x4c79('0x93'),!![]]);var _0x1c130b=_[_0x4c79('0x8e')](_0x5b1323)&&_[_0x4c79('0x8e')](_0xc7aaa)?null:_['union'](_0xc7aaa,_0x5b1323);if(!_0x1c130b)return null;var _0x18387e=[];for(var _0x186855=0x0;_0x186855<_0x1c130b[_0x4c79('0x94')];_0x186855++){var _0x1b6e32=_[_0x4c79('0x91')](_0x31d6d6,function(_0x33aebf){return _0x1c130b[_0x186855]?_0x33aebf['name']===_0x1c130b[_0x186855][_0x4c79('0x35')]:null;});if(_0x1b6e32){if(_0x1c130b[_0x186855][_0x4c79('0x93')]){_0x18387e['push'](_0x1ce516(_0x342837[_0x4c79('0xf')],_0x1c130b[_0x186855]));}else{if(!_0x1c130b[_0x186855][_0x4c79('0x95')]){_0x18387e['push'](_0x1ff29c(_0x1b6e32,_0x1c130b[_0x186855],_0x342837[_0x4c79('0xf')]));}else{if(_0x1b6e32['model']){_0x18387e[_0x4c79('0x8f')](_0xfcbca6(_0x1b6e32,_0x1c130b[_0x186855]));}}}}}return Promise[_0x4c79('0x96')](_0x18387e);})[_0x4c79('0x6')](function(_0x42ad1f){var _0x50791d=_0x42ad1f;var _0x3c7726=null;if(_0x50791d){_0x3c7726=_0x50791d[_0x4c79('0x94')]===0x1?_0x50791d[0x0]:null;}if(!_0x3c7726&&!_0x50791d)return _0x3bcb39;var _0x309dfb=_0x3b1b88[_0x342837[_0x4c79('0xf')]][_0x4c79('0x97')];_0x6c161b[_0x4c79('0x9')]=_[_0x4c79('0x98')](_0x309dfb);_0x6c161b[_0x4c79('0x87')]=_['keys'](_0x371a02[_0x4c79('0x87')]);_0x6c161b[_0x4c79('0x99')]=_[_0x4c79('0x9a')](_0x6c161b['model'],_0x6c161b[_0x4c79('0x87')]);_0x557f40[_0x4c79('0x9b')]=_[_0x4c79('0x9a')](_0x6c161b[_0x4c79('0x9')],qs['fields'](_0x371a02['query'][_0x4c79('0x9c')]));_0x557f40[_0x4c79('0x9b')]=_0x557f40['attributes']['length']?_0x557f40[_0x4c79('0x9b')]:_0x6c161b[_0x4c79('0x9')];if(!_0x371a02[_0x4c79('0x87')][_0x4c79('0x9d')]('nolimit')){_0x557f40[_0x4c79('0x9e')]=qs[_0x4c79('0x9e')](_0x371a02[_0x4c79('0x87')][_0x4c79('0x9e')]);_0x557f40[_0x4c79('0x9f')]=qs[_0x4c79('0x9f')](_0x371a02[_0x4c79('0x87')]['offset']);}_0x557f40[_0x4c79('0xa0')]=qs[_0x4c79('0xa1')](_0x371a02[_0x4c79('0x87')][_0x4c79('0xa1')]);_0x557f40[_0x4c79('0x86')]=qs[_0x4c79('0x99')](_['pick'](_0x371a02[_0x4c79('0x87')],_0x6c161b[_0x4c79('0x99')]));if(_0x371a02[_0x4c79('0x87')]['filter']){_0x557f40[_0x4c79('0x86')]=_[_0x4c79('0xa2')](_0x557f40[_0x4c79('0x86')],{'$or':_['map'](_0x309dfb,function(_0x349009){if(_0x349009[_0x4c79('0x38')]['key']!=='VIRTUAL'){var _0x592de1={};_0x592de1[_0x349009[_0x4c79('0x3')]]={'$like':'%'+_0x371a02[_0x4c79('0x87')][_0x4c79('0x2')]+'%'};return _0x592de1;}})});}var _0x5b642b=[];if(_0x3c7726){var _0xf7391b=_[_0x4c79('0x91')](_0x31d6d6,[_0x4c79('0x35'),_0x3c7726[_0x4c79('0x35')]]);if(_0xf7391b['field']){var _0x1d9388={};if(_0x342837[_0x4c79('0xf')]===_0x4c79('0xc')){_0x1d9388[_0xf7391b[_0x4c79('0xa3')]]=_['map'](_0x3c7726[_0x4c79('0x7')],'id');}else{_0x1d9388[_0xf7391b[_0x4c79('0xa3')]]=_0x3c7726[_0x4c79('0x7')];}_0x5b642b[_0x4c79('0x8f')](_0x1d9388);}else{_0x557f40['where']['id']=_0x3c7726[_0x4c79('0x7')];}}else{for(var _0x537208=0x0;_0x537208<_0x50791d['length'];_0x537208++){var _0xf7391b=_[_0x4c79('0x91')](_0x31d6d6,['name',_0x50791d[_0x537208][_0x4c79('0x35')]]);if(_0xf7391b[_0x4c79('0x3')]){var _0x1d9388={};_0x1d9388[_0xf7391b['foreignKey']]=_0x50791d[_0x537208][_0x4c79('0x7')];_0x5b642b[_0x4c79('0x8f')](_0x1d9388);}else{if(!_0x557f40['where']['id'])_0x557f40['where']['id']=[];_0x50791d[_0x537208][_0x4c79('0x7')]['forEach'](function(_0x5e3ceb){_0x557f40[_0x4c79('0x86')]['id'][_0x4c79('0x8f')](_0x5e3ceb);});}}}if(!_[_0x4c79('0x8e')](_0x5b642b)){_0x557f40[_0x4c79('0x86')]=_['merge'](_0x557f40[_0x4c79('0x86')],{'$and':{'$or':_0x5b642b}});}_0x557f40=_[_0x4c79('0xa2')]({},_0x557f40,_0x371a02[_0x4c79('0xa4')]);if(_0x3c7726&&!_0x3c7726['autoAssociation']&&_0x342837[_0x4c79('0xf')]===_0x4c79('0xc')){if(_0x371a02[_0x4c79('0x87')]['includeAll']){_0x557f40[_0x4c79('0xa5')]=[{'all':!![]}];}return _0x3b1b88[_0x342837[_0x4c79('0xf')]]['findAll'](_0x557f40)['then'](function(_0x342682){var _0x3e2fa1=[];_0x342682['forEach'](function(_0x397d5a){var _0x21dc45;switch(_0x397d5a[_0x4c79('0xa6')]){case _0x4c79('0xa7'):_0x21dc45=_[_0x4c79('0x91')](_0x3c7726[_0x4c79('0x7')],function(_0x14470c){return _0x14470c['id']===_0x397d5a[_0x4c79('0xa8')]&&_0x14470c[_0x4c79('0x38')]===_0x4c79('0xa9');});break;case _0x4c79('0xaa'):_0x21dc45=_[_0x4c79('0x91')](_0x3c7726[_0x4c79('0x7')],function(_0x5b7dff){return _0x5b7dff['id']===_0x397d5a[_0x4c79('0xa8')]&&_0x5b7dff[_0x4c79('0x38')]===_0x4c79('0xab');});break;}if(_0x21dc45)_0x3e2fa1[_0x4c79('0x8f')](_0x397d5a);});_0x3bcb39[_0x4c79('0xac')]=_0x3e2fa1[_0x4c79('0x94')];_0x3bcb39[_0x4c79('0xad')]=_0x3e2fa1;return _0x3bcb39;});}else{return _0x3b1b88[_0x342837[_0x4c79('0xf')]][_0x4c79('0xac')]({'where':_0x557f40[_0x4c79('0x86')]})[_0x4c79('0x6')](function(_0x4f0082){_0x3bcb39[_0x4c79('0xac')]=_0x4f0082;if(_0x371a02['query'][_0x4c79('0xae')]){if(_0x342837[_0x4c79('0xf')]==='CmContact'){_0x557f40[_0x4c79('0xa5')]=[{'model':_0x3b1b88['Tag'],'as':_0x4c79('0xaf'),'attributes':['id',_0x4c79('0x35'),_0x4c79('0xb0')],'required':_0x371a02[_0x4c79('0x87')][_0x4c79('0xb1')]?!![]:![]},{'model':_0x3b1b88[_0x4c79('0x6e')],'as':_0x4c79('0xb2'),'attributes':['id',_0x4c79('0x35'),'color'],'through':_0x371a02['query']['tag']?{'attributes':[],'where':{'TagId':_0x371a02[_0x4c79('0x87')]['tag']||undefined}}:{},'required':_0x371a02[_0x4c79('0x87')][_0x4c79('0xb1')]?!![]:![]}];}else{_0x557f40[_0x4c79('0xa5')]=[{'all':!![]}];}}return _0x3b1b88[_0x342837[_0x4c79('0xf')]][_0x4c79('0x5')](_0x557f40);})['then'](function(_0x43c3d3){_0x3bcb39[_0x4c79('0xad')]=_0x43c3d3;if(_0x424779===_0x4c79('0x2e')&&_0x371a02['query'][_0x4c79('0xb3')]===_0x4c79('0xb4')){var _0x48f2ee=[];for(var _0x4ab124=0x0;_0x4ab124<_0x3bcb39['rows'][_0x4c79('0x94')];_0x4ab124++){_0x48f2ee[_0x4c79('0x8f')](_0x3473d8('chat',_0x3bcb39[_0x4c79('0xad')][_0x4ab124][_0x4c79('0xb5')]));_0x48f2ee[_0x4c79('0x8f')](_0x3473d8(_0x4c79('0xb6'),_0x3bcb39[_0x4c79('0xad')][_0x4ab124][_0x4c79('0xb5')]));_0x48f2ee[_0x4c79('0x8f')](_0x3473d8(_0x4c79('0xb7'),_0x3bcb39[_0x4c79('0xad')][_0x4ab124][_0x4c79('0xb5')]));_0x48f2ee[_0x4c79('0x8f')](_0x3473d8('mail',_0x3bcb39['rows'][_0x4ab124][_0x4c79('0xb5')]));_0x48f2ee[_0x4c79('0x8f')](_0x3473d8(_0x4c79('0xb8'),_0x3bcb39['rows'][_0x4ab124][_0x4c79('0xb5')]));_0x48f2ee[_0x4c79('0x8f')](_0x3473d8(_0x4c79('0xb9'),_0x3bcb39[_0x4c79('0xad')][_0x4ab124][_0x4c79('0xb5')]));}return Promise[_0x4c79('0x96')](_0x48f2ee)[_0x4c79('0x6')](function(){return _0x3bcb39;});}return _0x3bcb39;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index fbebb55..cafc728 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 _0x4c9d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x149155,_0x4668d9){var _0x154d7a=function(_0xa1a287){while(--_0xa1a287){_0x149155['push'](_0x149155['shift']());}};_0x154d7a(++_0x4668d9);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd4c9('0x0'));var util=require(_0xd4c9('0x1'));var moment=require(_0xd4c9('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4c9('0x3'));var fs=require('fs');var Redis=require(_0xd4c9('0x4'));var db=require(_0xd4c9('0x5'))['db'];var utils=require(_0xd4c9('0x6'));var logger=require(_0xd4c9('0x7'))(_0xd4c9('0x8'));var config=require(_0xd4c9('0x9'));var jayson=require(_0xd4c9('0xa'));var client=jayson[_0xd4c9('0xb')]['http']({'port':0x232a});config['redis']=_[_0xd4c9('0xc')](config[_0xd4c9('0xd')],{'host':_0xd4c9('0xe'),'port':0x18eb});var socket=require(_0xd4c9('0xf'))(new Redis(config[_0xd4c9('0xd')]));require('./userProfile.socket')[_0xd4c9('0x10')](socket);function respondWithRpcPromise(_0x3d909e,_0x429338,_0x53b75b){return new BPromise(function(_0x57d126,_0x5896e9){return client['request'](_0x3d909e,_0x53b75b)['then'](function(_0x37e77d){logger['info'](_0xd4c9('0x11'),_0x429338,_0xd4c9('0x12'));logger[_0xd4c9('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x429338,_0xd4c9('0x12'),JSON[_0xd4c9('0x14')](_0x37e77d));if(_0x37e77d[_0xd4c9('0x15')]){if(_0x37e77d[_0xd4c9('0x15')][_0xd4c9('0x16')]===0x1f4){logger[_0xd4c9('0x15')](_0xd4c9('0x11'),_0x429338,_0x37e77d[_0xd4c9('0x15')][_0xd4c9('0x17')]);return _0x5896e9(_0x37e77d[_0xd4c9('0x15')][_0xd4c9('0x17')]);}logger['error'](_0xd4c9('0x11'),_0x429338,_0x37e77d[_0xd4c9('0x15')]['message']);return _0x57d126(_0x37e77d[_0xd4c9('0x15')][_0xd4c9('0x17')]);}else{logger['info'](_0xd4c9('0x11'),_0x429338,_0xd4c9('0x12'));_0x57d126(_0x37e77d[_0xd4c9('0x18')][_0xd4c9('0x17')]);}})[_0xd4c9('0x19')](function(_0x22aa75){logger[_0xd4c9('0x15')](_0xd4c9('0x11'),_0x429338,_0x22aa75);_0x5896e9(_0x22aa75);});});} \ No newline at end of file +var _0x8a9a=['UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x8a9a[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var moment=require(_0xa8a9('0x1'));var BPromise=require(_0xa8a9('0x2'));var rs=require(_0xa8a9('0x3'));var fs=require('fs');var Redis=require(_0xa8a9('0x4'));var db=require(_0xa8a9('0x5'))['db'];var utils=require(_0xa8a9('0x6'));var logger=require(_0xa8a9('0x7'))(_0xa8a9('0x8'));var config=require(_0xa8a9('0x9'));var jayson=require(_0xa8a9('0xa'));var client=jayson[_0xa8a9('0xb')]['http']({'port':0x232a});config[_0xa8a9('0xc')]=_['defaults'](config[_0xa8a9('0xc')],{'host':_0xa8a9('0xd'),'port':0x18eb});var socket=require(_0xa8a9('0xe'))(new Redis(config[_0xa8a9('0xc')]));require(_0xa8a9('0xf'))['register'](socket);function respondWithRpcPromise(_0x2f9391,_0x50071a,_0x58e265){return new BPromise(function(_0x2743ed,_0x4f4af8){return client[_0xa8a9('0x10')](_0x2f9391,_0x58e265)[_0xa8a9('0x11')](function(_0x5815e4){logger[_0xa8a9('0x12')](_0xa8a9('0x13'),_0x50071a,_0xa8a9('0x14'));logger[_0xa8a9('0x15')](_0xa8a9('0x16'),_0x50071a,_0xa8a9('0x14'),JSON['stringify'](_0x5815e4));if(_0x5815e4[_0xa8a9('0x17')]){if(_0x5815e4[_0xa8a9('0x17')][_0xa8a9('0x18')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x50071a,_0x5815e4[_0xa8a9('0x17')][_0xa8a9('0x19')]);return _0x4f4af8(_0x5815e4[_0xa8a9('0x17')]['message']);}logger[_0xa8a9('0x17')](_0xa8a9('0x13'),_0x50071a,_0x5815e4['error']['message']);return _0x2743ed(_0x5815e4[_0xa8a9('0x17')][_0xa8a9('0x19')]);}else{logger[_0xa8a9('0x12')](_0xa8a9('0x13'),_0x50071a,_0xa8a9('0x14'));_0x2743ed(_0x5815e4[_0xa8a9('0x1a')]['message']);}})['catch'](function(_0x3a7ae7){logger['error']('UserProfile,\x20%s,\x20%s',_0x50071a,_0x3a7ae7);_0x4f4af8(_0x3a7ae7);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 25f86c3..62bb8d8 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 _0x770a=['save','remove','update','emit','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x770a,0xbc));var _0xa770=function(_0x59ff1a,_0x2b8962){_0x59ff1a=_0x59ff1a-0x0;var _0x454ddc=_0x770a[_0x59ff1a];return _0x454ddc;};'use strict';var UserProfileEvents=require(_0xa770('0x0'));var events=[_0xa770('0x1'),_0xa770('0x2'),_0xa770('0x3')];function createListener(_0x56b68e,_0x1ed17e){return function(_0x2f92d0){_0x1ed17e[_0xa770('0x4')](_0x56b68e,_0x2f92d0);};}function removeListener(_0x3650dd,_0x162b29){return function(){UserProfileEvents[_0xa770('0x5')](_0x3650dd,_0x162b29);};}exports[_0xa770('0x6')]=function(_0x4e3cad){for(var _0x5a2ab2=0x0,_0x45f8c2=events[_0xa770('0x7')];_0x5a2ab2<_0x45f8c2;_0x5a2ab2++){var _0x559fb4=events[_0x5a2ab2];var _0x1f079d=createListener(_0xa770('0x8')+_0x559fb4,_0x4e3cad);UserProfileEvents['on'](_0x559fb4,_0x1f079d);}}; \ No newline at end of file +var _0x5aa0=['save','remove','update','removeListener','register','userProfile:','./userProfile.events'];(function(_0x35ec65,_0x3eaced){var _0xe1551a=function(_0x47abdc){while(--_0x47abdc){_0x35ec65['push'](_0x35ec65['shift']());}};_0xe1551a(++_0x3eaced);}(_0x5aa0,0xc3));var _0x05aa=function(_0x253c31,_0x41dd37){_0x253c31=_0x253c31-0x0;var _0x3548f3=_0x5aa0[_0x253c31];return _0x3548f3;};'use strict';var UserProfileEvents=require(_0x05aa('0x0'));var events=[_0x05aa('0x1'),_0x05aa('0x2'),_0x05aa('0x3')];function createListener(_0x4fe548,_0x54cd22){return function(_0x1235be){_0x54cd22['emit'](_0x4fe548,_0x1235be);};}function removeListener(_0x4bef9c,_0x4aad5d){return function(){UserProfileEvents[_0x05aa('0x4')](_0x4bef9c,_0x4aad5d);};}exports[_0x05aa('0x5')]=function(_0x3d37dc){for(var _0x5b6f26=0x0,_0x3c1525=events['length'];_0x5b6f26<_0x3c1525;_0x5b6f26++){var _0x2f45ed=events[_0x5b6f26];var _0x52eb17=createListener(_0x05aa('0x6')+_0x2f45ed,_0x3d37dc);UserProfileEvents['on'](_0x2f45ed,_0x52eb17);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index e0a7a1e..5b7e068 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 _0x34b5=['/describe','describe','/:id','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0x34b5,0x1c9));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x534b('0x0'));var path=require(_0x534b('0x1'));var timeout=require(_0x534b('0x2'));var express=require(_0x534b('0x3'));var router=express[_0x534b('0x4')]();var fs_extra=require(_0x534b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x534b('0x6'));var config=require(_0x534b('0x7'));var controller=require('./userProfileResource.controller');router[_0x534b('0x8')]('/',auth[_0x534b('0x9')](),controller[_0x534b('0xa')]);router[_0x534b('0x8')](_0x534b('0xb'),auth[_0x534b('0x9')](),controller[_0x534b('0xc')]);router[_0x534b('0x8')](_0x534b('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x534b('0x9')](),controller[_0x534b('0xe')]);router['put']('/:id',auth[_0x534b('0x9')](),controller[_0x534b('0xf')]);router[_0x534b('0x10')](_0x534b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x534b('0x11')]=router; \ No newline at end of file +var _0xfb49=['../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfb49,0x13a));var _0x9fb4=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0xfb49[_0x555ebb];return _0x3c0a4a;};'use strict';var multer=require(_0x9fb4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9fb4('0x1'));var express=require(_0x9fb4('0x2'));var router=express[_0x9fb4('0x3')]();var fs_extra=require(_0x9fb4('0x4'));var auth=require(_0x9fb4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9fb4('0x6'));var controller=require(_0x9fb4('0x7'));router[_0x9fb4('0x8')]('/',auth['isAuthenticated'](),controller[_0x9fb4('0x9')]);router[_0x9fb4('0x8')](_0x9fb4('0xa'),auth[_0x9fb4('0xb')](),controller[_0x9fb4('0xc')]);router[_0x9fb4('0x8')]('/:id',auth[_0x9fb4('0xb')](),controller[_0x9fb4('0xd')]);router[_0x9fb4('0xe')]('/',auth[_0x9fb4('0xb')](),controller['create']);router[_0x9fb4('0xf')](_0x9fb4('0x10'),auth[_0x9fb4('0xb')](),controller[_0x9fb4('0x11')]);router[_0x9fb4('0x12')]('/:id',auth[_0x9fb4('0xb')](),controller[_0x9fb4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 92252e0..5f10280 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 _0x6038=['sequelize','exports','STRING','INTEGER'];(function(_0x1b79d6,_0x49e484){var _0x374ded=function(_0x1ac248){while(--_0x1ac248){_0x1b79d6['push'](_0x1b79d6['shift']());}};_0x374ded(++_0x49e484);}(_0x6038,0xe0));var _0x8603=function(_0x4720d4,_0x4510a7){_0x4720d4=_0x4720d4-0x0;var _0x5b473b=_0x6038[_0x4720d4];return _0x5b473b;};'use strict';var Sequelize=require(_0x8603('0x0'));module[_0x8603('0x1')]={'name':{'type':Sequelize[_0x8603('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8603('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8603('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa853=['INTEGER','exports'];(function(_0x1dfce3,_0x491d21){var _0x127504=function(_0x3028cb){while(--_0x3028cb){_0x1dfce3['push'](_0x1dfce3['shift']());}};_0x127504(++_0x491d21);}(_0xa853,0x1b9));var _0x3a85=function(_0x32d51f,_0x8fc467){_0x32d51f=_0x32d51f-0x0;var _0x56237d=_0xa853[_0x32d51f];return _0x56237d;};'use strict';var Sequelize=require('sequelize');module[_0x3a85('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3a85('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1da7a02..e854c48 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 _0x687b=['options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','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','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x687b,0x14a));var _0xb687=function(_0x364edc,_0x20b3c1){_0x364edc=_0x364edc-0x0;var _0x53e6a1=_0x687b[_0x364edc];return _0x53e6a1;};'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'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['UserProfileResource'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));};exports[_0xb687('0x4e')]=function(_0x2342f6,_0x4f5784){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x4f5784,null))[_0xb687('0x4a')](handleError(_0x4f5784,null));}; \ No newline at end of file +var _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0xba34,0x119));var _0x4ba3=function(_0x38e159,_0x34246b){_0x38e159=_0x38e159-0x0;var _0x511ae7=_0xba34[_0x38e159];return _0x511ae7;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 5383609..05283b3 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 _0x104d=['../../config/environment','exports','UserProfileResource','user_profile_has_resources','resourceId','sectionId','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x103c7c,_0x3e464d){var _0x18d62b=function(_0x428883){while(--_0x428883){_0x103c7c['push'](_0x103c7c['shift']());}};_0x18d62b(++_0x3e464d);}(_0x104d,0x145));var _0xd104=function(_0x551926,_0x201309){_0x551926=_0x551926-0x0;var _0x5350ad=_0x104d[_0x551926];return _0x5350ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd104('0x0'))('api');var moment=require('moment');var BPromise=require(_0xd104('0x1'));var rp=require(_0xd104('0x2'));var fs=require('fs');var path=require(_0xd104('0x3'));var rimraf=require(_0xd104('0x4'));var config=require(_0xd104('0x5'));var attributes=require('./userProfileResource.attributes');module[_0xd104('0x6')]=function(_0xe0f395,_0x5915bf){return _0xe0f395['define'](_0xd104('0x7'),attributes,{'tableName':_0xd104('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd104('0x9'),_0xd104('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed5f=['user_profile_has_resources','resourceId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xed5f,0x1a6));var _0xfed5=function(_0x37657b,_0x2ae142){_0x37657b=_0x37657b-0x0;var _0x572f86=_0xed5f[_0x37657b];return _0x572f86;};'use strict';var _=require(_0xfed5('0x0'));var util=require(_0xfed5('0x1'));var logger=require(_0xfed5('0x2'))(_0xfed5('0x3'));var moment=require(_0xfed5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfed5('0x5'));var rimraf=require(_0xfed5('0x6'));var config=require(_0xfed5('0x7'));var attributes=require(_0xfed5('0x8'));module['exports']=function(_0x483255,_0x1a71cb){return _0x483255['define'](_0xfed5('0x9'),attributes,{'tableName':_0xfed5('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xfed5('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 5b25660..6448254 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 _0xc021=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','error','code','UserProfileResource,\x20%s,\x20%s','message','result'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc021,0x131));var _0x1c02=function(_0x2c58f5,_0x3cc09f){_0x2c58f5=_0x2c58f5-0x0;var _0x31e6c5=_0xc021[_0x2c58f5];return _0x31e6c5;};'use strict';var _=require(_0x1c02('0x0'));var util=require(_0x1c02('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1c02('0x2'));var fs=require('fs');var Redis=require(_0x1c02('0x3'));var db=require(_0x1c02('0x4'))['db'];var utils=require(_0x1c02('0x5'));var logger=require(_0x1c02('0x6'))(_0x1c02('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1c02('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43dfd0,_0x283a69,_0x58028b){return new BPromise(function(_0x14eb4c,_0x378c7e){return client['request'](_0x43dfd0,_0x58028b)[_0x1c02('0x9')](function(_0x45298d){logger[_0x1c02('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x283a69,_0x1c02('0xb'));logger[_0x1c02('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x283a69,_0x1c02('0xb'),JSON['stringify'](_0x45298d));if(_0x45298d[_0x1c02('0xd')]){if(_0x45298d[_0x1c02('0xd')][_0x1c02('0xe')]===0x1f4){logger[_0x1c02('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x283a69,_0x45298d[_0x1c02('0xd')]['message']);return _0x378c7e(_0x45298d[_0x1c02('0xd')]['message']);}logger[_0x1c02('0xd')](_0x1c02('0xf'),_0x283a69,_0x45298d['error'][_0x1c02('0x10')]);return _0x14eb4c(_0x45298d[_0x1c02('0xd')][_0x1c02('0x10')]);}else{logger[_0x1c02('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x283a69,'request\x20sent');_0x14eb4c(_0x45298d[_0x1c02('0x11')][_0x1c02('0x10')]);}})[_0x1c02('0x12')](function(_0x7af050){logger[_0x1c02('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x283a69,_0x7af050);_0x378c7e(_0x7af050);});});} \ No newline at end of file +var _0xf59d=['jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','code','message','error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x310c83,_0x33eed5){var _0x41eb41=function(_0x7cbad){while(--_0x7cbad){_0x310c83['push'](_0x310c83['shift']());}};_0x41eb41(++_0x33eed5);}(_0xf59d,0x121));var _0xdf59=function(_0x146eed,_0x547c97){_0x146eed=_0x146eed-0x0;var _0x17cdc4=_0xf59d[_0x146eed];return _0x17cdc4;};'use strict';var _=require(_0xdf59('0x0'));var util=require(_0xdf59('0x1'));var moment=require(_0xdf59('0x2'));var BPromise=require(_0xdf59('0x3'));var rs=require(_0xdf59('0x4'));var fs=require('fs');var Redis=require(_0xdf59('0x5'));var db=require(_0xdf59('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf59('0x7'))(_0xdf59('0x8'));var config=require(_0xdf59('0x9'));var jayson=require(_0xdf59('0xa'));var client=jayson[_0xdf59('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3299f7,_0x112445,_0x28ce47){return new BPromise(function(_0x38ecc0,_0x5c4643){return client[_0xdf59('0xc')](_0x3299f7,_0x28ce47)[_0xdf59('0xd')](function(_0x2a859e){logger[_0xdf59('0xe')](_0xdf59('0xf'),_0x112445,'request\x20sent');logger[_0xdf59('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x112445,_0xdf59('0x11'),JSON['stringify'](_0x2a859e));if(_0x2a859e['error']){if(_0x2a859e['error'][_0xdf59('0x12')]===0x1f4){logger['error'](_0xdf59('0xf'),_0x112445,_0x2a859e['error'][_0xdf59('0x13')]);return _0x5c4643(_0x2a859e[_0xdf59('0x14')]['message']);}logger[_0xdf59('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x112445,_0x2a859e['error'][_0xdf59('0x13')]);return _0x38ecc0(_0x2a859e[_0xdf59('0x14')][_0xdf59('0x13')]);}else{logger[_0xdf59('0xe')](_0xdf59('0xf'),_0x112445,_0xdf59('0x11'));_0x38ecc0(_0x2a859e[_0xdf59('0x15')][_0xdf59('0x13')]);}})[_0xdf59('0x16')](function(_0x149811){logger[_0xdf59('0x14')](_0xdf59('0xf'),_0x112445,_0x149811);_0x5c4643(_0x149811);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index edf1bb6..ac53fa4 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 _0xf9ac=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x40f34b,_0x117e07){var _0x47755f=function(_0x52c250){while(--_0x52c250){_0x40f34b['push'](_0x40f34b['shift']());}};_0x47755f(++_0x117e07);}(_0xf9ac,0x12c));var _0xcf9a=function(_0x2472ba,_0x43fb6e){_0x2472ba=_0x2472ba-0x0;var _0x12e782=_0xf9ac[_0x2472ba];return _0x12e782;};'use strict';var multer=require('multer');var util=require(_0xcf9a('0x0'));var path=require(_0xcf9a('0x1'));var timeout=require(_0xcf9a('0x2'));var express=require(_0xcf9a('0x3'));var router=express[_0xcf9a('0x4')]();var fs_extra=require(_0xcf9a('0x5'));var auth=require(_0xcf9a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf9a('0x7'));var controller=require('./userProfileSection.controller');router[_0xcf9a('0x8')]('/',auth[_0xcf9a('0x9')](),controller[_0xcf9a('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xcf9a('0xb')]);router[_0xcf9a('0x8')](_0xcf9a('0xc'),auth[_0xcf9a('0x9')](),controller[_0xcf9a('0xd')]);router[_0xcf9a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcf9a('0xf')]);router['put'](_0xcf9a('0xc'),auth[_0xcf9a('0x9')](),controller[_0xcf9a('0x10')]);router['delete'](_0xcf9a('0xc'),auth[_0xcf9a('0x9')](),controller[_0xcf9a('0x11')]);module[_0xcf9a('0x12')]=router; \ No newline at end of file +var _0xb3e0=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete'];(function(_0x23125f,_0x54a910){var _0x3c8b6e=function(_0x5d4f44){while(--_0x5d4f44){_0x23125f['push'](_0x23125f['shift']());}};_0x3c8b6e(++_0x54a910);}(_0xb3e0,0xf4));var _0x0b3e=function(_0x4be43e,_0x22febf){_0x4be43e=_0x4be43e-0x0;var _0xb3b959=_0xb3e0[_0x4be43e];return _0xb3b959;};'use strict';var multer=require(_0x0b3e('0x0'));var util=require(_0x0b3e('0x1'));var path=require(_0x0b3e('0x2'));var timeout=require(_0x0b3e('0x3'));var express=require(_0x0b3e('0x4'));var router=express[_0x0b3e('0x5')]();var fs_extra=require(_0x0b3e('0x6'));var auth=require(_0x0b3e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0b3e('0x8'));var controller=require(_0x0b3e('0x9'));router[_0x0b3e('0xa')]('/',auth[_0x0b3e('0xb')](),controller[_0x0b3e('0xc')]);router['get'](_0x0b3e('0xd'),auth[_0x0b3e('0xb')](),controller['describe']);router['get'](_0x0b3e('0xe'),auth[_0x0b3e('0xb')](),controller[_0x0b3e('0xf')]);router[_0x0b3e('0x10')]('/',auth[_0x0b3e('0xb')](),controller[_0x0b3e('0x11')]);router['put'](_0x0b3e('0xe'),auth['isAuthenticated'](),controller[_0x0b3e('0x12')]);router[_0x0b3e('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0b3e('0x14')]);module[_0x0b3e('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ce79894..274af9d 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 _0xe605=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x13d972,_0x3642ee){var _0x4fbba9=function(_0x3b45e2){while(--_0x3b45e2){_0x13d972['push'](_0x13d972['shift']());}};_0x4fbba9(++_0x3642ee);}(_0xe605,0x92));var _0x5e60=function(_0x450289,_0xd9f877){_0x450289=_0x450289-0x0;var _0x3fe1bd=_0xe605[_0x450289];return _0x3fe1bd;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x5e60('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e60('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e60('0x2')],'set':function(_0xfe1f64){this[_0x5e60('0x5')](_0x5e60('0x6'),_0xfe1f64?_0xfe1f64[_0x5e60('0x7')](''):[]);},'get':function(){return this[_0x5e60('0x8')](_0x5e60('0x6'))?this[_0x5e60('0x8')]('crudPermissions')[_0x5e60('0x9')](''):[];}}}; \ No newline at end of file +var _0xf4f4=['INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x256f90,_0x2187a6){_0x256f90=_0x256f90-0x0;var _0x415016=_0xf4f4[_0x256f90];return _0x415016;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4f4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4f4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4f4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4f4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4f4f('0x2')],'set':function(_0x510b24){this[_0x4f4f('0x5')]('crudPermissions',_0x510b24?_0x510b24[_0x4f4f('0x6')](''):[]);},'get':function(){return this[_0x4f4f('0x7')](_0x4f4f('0x8'))?this[_0x4f4f('0x7')](_0x4f4f('0x8'))[_0x4f4f('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index dd6a4b2..e34a3c4 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 _0xe5ea=['bluebird','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','merge','UserProfileSection','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x15e286,_0x49035b){var _0x513d30=function(_0x425b04){while(--_0x425b04){_0x15e286['push'](_0x15e286['shift']());}};_0x513d30(++_0x49035b);}(_0xe5ea,0x1d5));var _0xae5e=function(_0x2c3136,_0x59ad18){_0x2c3136=_0x2c3136-0x0;var _0x296855=_0xe5ea[_0x2c3136];return _0x296855;};'use strict';var emlformat=require(_0xae5e('0x0'));var rimraf=require(_0xae5e('0x1'));var zipdir=require(_0xae5e('0x2'));var jsonpatch=require(_0xae5e('0x3'));var rp=require('request-promise');var moment=require(_0xae5e('0x4'));var BPromise=require(_0xae5e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xae5e('0x6'));var sox=require(_0xae5e('0x7'));var csv=require(_0xae5e('0x8'));var ejs=require(_0xae5e('0x9'));var fs=require('fs');var fs_extra=require(_0xae5e('0xa'));var _=require('lodash');var squel=require(_0xae5e('0xb'));var crypto=require(_0xae5e('0xc'));var jsforce=require(_0xae5e('0xd'));var deskjs=require(_0xae5e('0xe'));var toCsv=require(_0xae5e('0x8'));var querystring=require(_0xae5e('0xf'));var Papa=require(_0xae5e('0x10'));var Redis=require(_0xae5e('0x11'));var authService=require(_0xae5e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xae5e('0x13'));var hardwareService=require(_0xae5e('0x14'));var logger=require(_0xae5e('0x15'))(_0xae5e('0x16'));var utils=require(_0xae5e('0x17'));var config=require(_0xae5e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xae5e('0x19'))['db'];function respondWithStatusCode(_0x224143,_0x3495ec){_0x3495ec=_0x3495ec||0xcc;return function(_0x5a9b31){if(_0x5a9b31){return _0x224143[_0xae5e('0x1a')](_0x3495ec);}return _0x224143['status'](_0x3495ec)[_0xae5e('0x1b')]();};}function respondWithResult(_0x599bdf,_0x4bce19){_0x4bce19=_0x4bce19||0xc8;return function(_0x1da4a9){if(_0x1da4a9){return _0x599bdf[_0xae5e('0x1c')](_0x4bce19)[_0xae5e('0x1d')](_0x1da4a9);}};}function respondWithFilteredResult(_0xe93bcd,_0x1bd3d8){return function(_0x1be448){if(_0x1be448){var _0x1c1895=typeof _0x1bd3d8[_0xae5e('0x1e')]===_0xae5e('0x1f')&&typeof _0x1bd3d8['limit']===_0xae5e('0x1f');var _0x8484d9=_0x1be448[_0xae5e('0x20')];var _0x5634dc=_0x1c1895?0x0:_0x1bd3d8[_0xae5e('0x1e')];var _0x53ee6a=_0x1c1895?_0x1be448['count']:_0x1bd3d8[_0xae5e('0x1e')]+_0x1bd3d8[_0xae5e('0x21')];var _0x1010a9;if(_0x53ee6a>=_0x8484d9){_0x53ee6a=_0x8484d9;_0x1010a9=0xc8;}else{_0x1010a9=0xce;}_0xe93bcd[_0xae5e('0x1c')](_0x1010a9);return _0xe93bcd[_0xae5e('0x22')](_0xae5e('0x23'),_0x5634dc+'-'+_0x53ee6a+'/'+_0x8484d9)['json'](_0x1be448);}return null;};}function patchUpdates(_0x5245b4){return function(_0x1246bf){try{jsonpatch[_0xae5e('0x24')](_0x1246bf,_0x5245b4,!![]);}catch(_0x4cc183){return BPromise[_0xae5e('0x25')](_0x4cc183);}return _0x1246bf[_0xae5e('0x26')]();};}function saveUpdates(_0x3d418e,_0x40c06a){return function(_0x52bce4){if(_0x52bce4){return _0x52bce4[_0xae5e('0x27')](_0x3d418e)['then'](function(_0x596a72){return _0x596a72;});}return null;};}function removeEntity(_0x4bba58,_0x215699){return function(_0xfd0dce){if(_0xfd0dce){return _0xfd0dce[_0xae5e('0x28')]()['then'](function(){_0x4bba58[_0xae5e('0x1c')](0xcc)[_0xae5e('0x1b')]();});}};}function handleEntityNotFound(_0x577bcf,_0x43252d){return function(_0x3613d7){if(!_0x3613d7){_0x577bcf['sendStatus'](0x194);}return _0x3613d7;};}function handleError(_0x5af391,_0x7ec44a){_0x7ec44a=_0x7ec44a||0x1f4;return function(_0x13ded4){logger[_0xae5e('0x29')](_0x13ded4[_0xae5e('0x2a')]);if(_0x13ded4[_0xae5e('0x2b')]){delete _0x13ded4[_0xae5e('0x2b')];}_0x5af391[_0xae5e('0x1c')](_0x7ec44a)[_0xae5e('0x2c')](_0x13ded4);};}exports[_0xae5e('0x2d')]=function(_0x1badbf,_0x401f11){var _0x2ffea5={},_0x42b149={},_0x1b9c0f={'count':0x0,'rows':[]};var _0x1ecdc6=_[_0xae5e('0x2e')](db['UserProfileSection'][_0xae5e('0x2f')],function(_0x88f67){return{'name':_0x88f67['fieldName'],'type':_0x88f67[_0xae5e('0x30')][_0xae5e('0x31')]};});_0x42b149[_0xae5e('0x32')]=_[_0xae5e('0x2e')](_0x1ecdc6,'name');_0x42b149[_0xae5e('0x33')]=_[_0xae5e('0x34')](_0x1badbf['query']);_0x42b149['filters']=_[_0xae5e('0x35')](_0x42b149[_0xae5e('0x32')],_0x42b149[_0xae5e('0x33')]);_0x2ffea5[_0xae5e('0x36')]=_[_0xae5e('0x35')](_0x42b149['model'],qs[_0xae5e('0x37')](_0x1badbf[_0xae5e('0x33')][_0xae5e('0x37')]));_0x2ffea5['attributes']=_0x2ffea5[_0xae5e('0x36')][_0xae5e('0x38')]?_0x2ffea5['attributes']:_0x42b149[_0xae5e('0x32')];if(!_0x1badbf[_0xae5e('0x33')]['hasOwnProperty'](_0xae5e('0x39'))){_0x2ffea5[_0xae5e('0x21')]=qs['limit'](_0x1badbf[_0xae5e('0x33')][_0xae5e('0x21')]);_0x2ffea5['offset']=qs['offset'](_0x1badbf['query'][_0xae5e('0x1e')]);}_0x2ffea5[_0xae5e('0x3a')]=qs[_0xae5e('0x3b')](_0x1badbf[_0xae5e('0x33')][_0xae5e('0x3b')]);_0x2ffea5['where']=qs[_0xae5e('0x3c')](_[_0xae5e('0x3d')](_0x1badbf[_0xae5e('0x33')],_0x42b149['filters']),_0x1ecdc6);if(_0x1badbf[_0xae5e('0x33')][_0xae5e('0x3e')]){_0x2ffea5[_0xae5e('0x3f')]=_['merge'](_0x2ffea5[_0xae5e('0x3f')],{'$or':_[_0xae5e('0x2e')](_0x1ecdc6,function(_0x363381){if(_0x363381[_0xae5e('0x30')]!==_0xae5e('0x40')){var _0x56441f={};_0x56441f[_0x363381[_0xae5e('0x2b')]]={'$like':'%'+_0x1badbf[_0xae5e('0x33')][_0xae5e('0x3e')]+'%'};return _0x56441f;}})});}_0x2ffea5=_['merge']({},_0x2ffea5,_0x1badbf[_0xae5e('0x41')]);var _0x4160d1={'where':_0x2ffea5[_0xae5e('0x3f')]};return db['UserProfileSection'][_0xae5e('0x20')](_0x4160d1)[_0xae5e('0x42')](function(_0x4ac65f){_0x1b9c0f['count']=_0x4ac65f;if(_0x1badbf[_0xae5e('0x33')][_0xae5e('0x43')]){_0x2ffea5[_0xae5e('0x44')]=[{'all':!![]}];}return db['UserProfileSection'][_0xae5e('0x45')](_0x2ffea5);})[_0xae5e('0x42')](function(_0x1a941a){_0x1b9c0f[_0xae5e('0x46')]=_0x1a941a;return _0x1b9c0f;})[_0xae5e('0x42')](respondWithFilteredResult(_0x401f11,_0x2ffea5))[_0xae5e('0x47')](handleError(_0x401f11,null));};exports['show']=function(_0x565573,_0x3a89ae){var _0x13160d={'raw':![],'where':{'id':_0x565573['params']['id']}},_0x37cc24={};_0x37cc24[_0xae5e('0x32')]=_[_0xae5e('0x34')](db['UserProfileSection'][_0xae5e('0x2f')]);_0x37cc24[_0xae5e('0x33')]=_[_0xae5e('0x34')](_0x565573['query']);_0x37cc24[_0xae5e('0x3c')]=_[_0xae5e('0x35')](_0x37cc24[_0xae5e('0x32')],_0x37cc24[_0xae5e('0x33')]);_0x13160d[_0xae5e('0x36')]=_[_0xae5e('0x35')](_0x37cc24[_0xae5e('0x32')],qs[_0xae5e('0x37')](_0x565573['query'][_0xae5e('0x37')]));_0x13160d['attributes']=_0x13160d[_0xae5e('0x36')][_0xae5e('0x38')]?_0x13160d[_0xae5e('0x36')]:_0x37cc24[_0xae5e('0x32')];if(_0x565573[_0xae5e('0x33')][_0xae5e('0x43')]){_0x13160d['include']=[{'all':!![]}];}_0x13160d=_[_0xae5e('0x48')]({},_0x13160d,_0x565573[_0xae5e('0x41')]);return db[_0xae5e('0x49')]['find'](_0x13160d)[_0xae5e('0x42')](handleEntityNotFound(_0x3a89ae,null))[_0xae5e('0x42')](respondWithResult(_0x3a89ae,null))[_0xae5e('0x47')](handleError(_0x3a89ae,null));};exports['create']=function(_0xce44b,_0x357d92){return db[_0xae5e('0x49')][_0xae5e('0x4a')](_0xce44b[_0xae5e('0x4b')],{})[_0xae5e('0x42')](respondWithResult(_0x357d92,0xc9))[_0xae5e('0x47')](handleError(_0x357d92,null));};exports['update']=function(_0x258dff,_0x2a8a8c){if(_0x258dff[_0xae5e('0x4b')]['id']){delete _0x258dff['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x258dff['params']['id']}})[_0xae5e('0x42')](handleEntityNotFound(_0x2a8a8c,null))[_0xae5e('0x42')](saveUpdates(_0x258dff['body'],null))[_0xae5e('0x42')](respondWithResult(_0x2a8a8c,null))[_0xae5e('0x47')](handleError(_0x2a8a8c,null));};exports[_0xae5e('0x28')]=function(_0x286d5b,_0x1255d9){return db[_0xae5e('0x49')][_0xae5e('0x4c')]({'where':{'id':_0x286d5b[_0xae5e('0x4d')]['id']}})[_0xae5e('0x42')](handleEntityNotFound(_0x1255d9,null))[_0xae5e('0x42')](removeEntity(_0x1255d9,null))[_0xae5e('0x47')](handleError(_0x1255d9,null));};exports['describe']=function(_0x88d58d,_0x45ee94){return db[_0xae5e('0x49')][_0xae5e('0x4e')]()['then'](respondWithResult(_0x45ee94,null))[_0xae5e('0x47')](handleError(_0x45ee94,null));}; \ No newline at end of file +var _0x7dd5=['reject','save','then','destroy','end','stack','name','send','index','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','VIRTUAL','options','includeAll','include','UserProfileSection','findAll','catch','show','params','keys','rawAttributes','merge','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x98197,_0xea7356){var _0x5d9199=function(_0x135375){while(--_0x135375){_0x98197['push'](_0x98197['shift']());}};_0x5d9199(++_0xea7356);}(_0x7dd5,0x11b));var _0x57dd=function(_0x3fca37,_0x1dcf07){_0x3fca37=_0x3fca37-0x0;var _0xd06fd5=_0x7dd5[_0x3fca37];return _0xd06fd5;};'use strict';var emlformat=require(_0x57dd('0x0'));var rimraf=require(_0x57dd('0x1'));var zipdir=require(_0x57dd('0x2'));var jsonpatch=require(_0x57dd('0x3'));var rp=require(_0x57dd('0x4'));var moment=require(_0x57dd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x57dd('0x6'));var util=require(_0x57dd('0x7'));var path=require(_0x57dd('0x8'));var sox=require(_0x57dd('0x9'));var csv=require(_0x57dd('0xa'));var ejs=require(_0x57dd('0xb'));var fs=require('fs');var fs_extra=require(_0x57dd('0xc'));var _=require(_0x57dd('0xd'));var squel=require(_0x57dd('0xe'));var crypto=require(_0x57dd('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x57dd('0x10'));var toCsv=require(_0x57dd('0xa'));var querystring=require('querystring');var Papa=require(_0x57dd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x57dd('0x12'));var as=require(_0x57dd('0x13'));var hardwareService=require(_0x57dd('0x14'));var logger=require(_0x57dd('0x15'))(_0x57dd('0x16'));var utils=require(_0x57dd('0x17'));var config=require(_0x57dd('0x18'));var licenseUtil=require(_0x57dd('0x19'));var db=require(_0x57dd('0x1a'))['db'];function respondWithStatusCode(_0x177f52,_0x5b14b5){_0x5b14b5=_0x5b14b5||0xcc;return function(_0x4cf556){if(_0x4cf556){return _0x177f52[_0x57dd('0x1b')](_0x5b14b5);}return _0x177f52[_0x57dd('0x1c')](_0x5b14b5)['end']();};}function respondWithResult(_0x53a479,_0x422edf){_0x422edf=_0x422edf||0xc8;return function(_0x23c220){if(_0x23c220){return _0x53a479[_0x57dd('0x1c')](_0x422edf)['json'](_0x23c220);}};}function respondWithFilteredResult(_0x29ad23,_0x211435){return function(_0x5b3f4e){if(_0x5b3f4e){var _0x351922=typeof _0x211435[_0x57dd('0x1d')]===_0x57dd('0x1e')&&typeof _0x211435[_0x57dd('0x1f')]===_0x57dd('0x1e');var _0xd75746=_0x5b3f4e[_0x57dd('0x20')];var _0x128525=_0x351922?0x0:_0x211435[_0x57dd('0x1d')];var _0x1e3844=_0x351922?_0x5b3f4e[_0x57dd('0x20')]:_0x211435[_0x57dd('0x1d')]+_0x211435[_0x57dd('0x1f')];var _0x3cdd96;if(_0x1e3844>=_0xd75746){_0x1e3844=_0xd75746;_0x3cdd96=0xc8;}else{_0x3cdd96=0xce;}_0x29ad23[_0x57dd('0x1c')](_0x3cdd96);return _0x29ad23[_0x57dd('0x21')](_0x57dd('0x22'),_0x128525+'-'+_0x1e3844+'/'+_0xd75746)[_0x57dd('0x23')](_0x5b3f4e);}return null;};}function patchUpdates(_0x5ec0fe){return function(_0xc08fa7){try{jsonpatch[_0x57dd('0x24')](_0xc08fa7,_0x5ec0fe,!![]);}catch(_0x4f694c){return BPromise[_0x57dd('0x25')](_0x4f694c);}return _0xc08fa7[_0x57dd('0x26')]();};}function saveUpdates(_0x553473,_0x42ed35){return function(_0x9f4da4){if(_0x9f4da4){return _0x9f4da4['update'](_0x553473)[_0x57dd('0x27')](function(_0x362537){return _0x362537;});}return null;};}function removeEntity(_0x38ab95,_0x525fb6){return function(_0x5a8f09){if(_0x5a8f09){return _0x5a8f09[_0x57dd('0x28')]()['then'](function(){_0x38ab95[_0x57dd('0x1c')](0xcc)[_0x57dd('0x29')]();});}};}function handleEntityNotFound(_0x4aeaae,_0xb12a64){return function(_0x2e32f9){if(!_0x2e32f9){_0x4aeaae['sendStatus'](0x194);}return _0x2e32f9;};}function handleError(_0x5a3747,_0x5a6732){_0x5a6732=_0x5a6732||0x1f4;return function(_0x5f2c12){logger['error'](_0x5f2c12[_0x57dd('0x2a')]);if(_0x5f2c12[_0x57dd('0x2b')]){delete _0x5f2c12[_0x57dd('0x2b')];}_0x5a3747[_0x57dd('0x1c')](_0x5a6732)[_0x57dd('0x2c')](_0x5f2c12);};}exports[_0x57dd('0x2d')]=function(_0x4b34e6,_0x6ea50a){var _0x3e310f={},_0x58c391={},_0x3f32ba={'count':0x0,'rows':[]};var _0x3db8a6=_['map'](db['UserProfileSection']['rawAttributes'],function(_0x3e5d30){return{'name':_0x3e5d30[_0x57dd('0x2e')],'type':_0x3e5d30[_0x57dd('0x2f')][_0x57dd('0x30')]};});_0x58c391[_0x57dd('0x31')]=_[_0x57dd('0x32')](_0x3db8a6,_0x57dd('0x2b'));_0x58c391[_0x57dd('0x33')]=_['keys'](_0x4b34e6[_0x57dd('0x33')]);_0x58c391['filters']=_[_0x57dd('0x34')](_0x58c391['model'],_0x58c391[_0x57dd('0x33')]);_0x3e310f[_0x57dd('0x35')]=_[_0x57dd('0x34')](_0x58c391[_0x57dd('0x31')],qs[_0x57dd('0x36')](_0x4b34e6[_0x57dd('0x33')][_0x57dd('0x36')]));_0x3e310f[_0x57dd('0x35')]=_0x3e310f[_0x57dd('0x35')][_0x57dd('0x37')]?_0x3e310f[_0x57dd('0x35')]:_0x58c391[_0x57dd('0x31')];if(!_0x4b34e6[_0x57dd('0x33')][_0x57dd('0x38')](_0x57dd('0x39'))){_0x3e310f[_0x57dd('0x1f')]=qs[_0x57dd('0x1f')](_0x4b34e6['query'][_0x57dd('0x1f')]);_0x3e310f[_0x57dd('0x1d')]=qs[_0x57dd('0x1d')](_0x4b34e6[_0x57dd('0x33')][_0x57dd('0x1d')]);}_0x3e310f[_0x57dd('0x3a')]=qs['sort'](_0x4b34e6[_0x57dd('0x33')]['sort']);_0x3e310f[_0x57dd('0x3b')]=qs['filters'](_[_0x57dd('0x3c')](_0x4b34e6[_0x57dd('0x33')],_0x58c391[_0x57dd('0x3d')]),_0x3db8a6);if(_0x4b34e6[_0x57dd('0x33')][_0x57dd('0x3e')]){_0x3e310f[_0x57dd('0x3b')]=_['merge'](_0x3e310f[_0x57dd('0x3b')],{'$or':_[_0x57dd('0x32')](_0x3db8a6,function(_0x5809ab){if(_0x5809ab[_0x57dd('0x2f')]!==_0x57dd('0x3f')){var _0x216a78={};_0x216a78[_0x5809ab[_0x57dd('0x2b')]]={'$like':'%'+_0x4b34e6[_0x57dd('0x33')][_0x57dd('0x3e')]+'%'};return _0x216a78;}})});}_0x3e310f=_['merge']({},_0x3e310f,_0x4b34e6[_0x57dd('0x40')]);var _0x4976c7={'where':_0x3e310f[_0x57dd('0x3b')]};return db['UserProfileSection'][_0x57dd('0x20')](_0x4976c7)[_0x57dd('0x27')](function(_0x1deb99){_0x3f32ba[_0x57dd('0x20')]=_0x1deb99;if(_0x4b34e6[_0x57dd('0x33')][_0x57dd('0x41')]){_0x3e310f[_0x57dd('0x42')]=[{'all':!![]}];}return db[_0x57dd('0x43')][_0x57dd('0x44')](_0x3e310f);})[_0x57dd('0x27')](function(_0xa02c6e){_0x3f32ba['rows']=_0xa02c6e;return _0x3f32ba;})[_0x57dd('0x27')](respondWithFilteredResult(_0x6ea50a,_0x3e310f))[_0x57dd('0x45')](handleError(_0x6ea50a,null));};exports[_0x57dd('0x46')]=function(_0x2c495a,_0x5f5a08){var _0x1d7c38={'raw':![],'where':{'id':_0x2c495a[_0x57dd('0x47')]['id']}},_0x1af511={};_0x1af511[_0x57dd('0x31')]=_[_0x57dd('0x48')](db[_0x57dd('0x43')][_0x57dd('0x49')]);_0x1af511[_0x57dd('0x33')]=_['keys'](_0x2c495a[_0x57dd('0x33')]);_0x1af511[_0x57dd('0x3d')]=_[_0x57dd('0x34')](_0x1af511[_0x57dd('0x31')],_0x1af511[_0x57dd('0x33')]);_0x1d7c38['attributes']=_[_0x57dd('0x34')](_0x1af511[_0x57dd('0x31')],qs['fields'](_0x2c495a[_0x57dd('0x33')]['fields']));_0x1d7c38[_0x57dd('0x35')]=_0x1d7c38[_0x57dd('0x35')][_0x57dd('0x37')]?_0x1d7c38[_0x57dd('0x35')]:_0x1af511[_0x57dd('0x31')];if(_0x2c495a['query'][_0x57dd('0x41')]){_0x1d7c38[_0x57dd('0x42')]=[{'all':!![]}];}_0x1d7c38=_[_0x57dd('0x4a')]({},_0x1d7c38,_0x2c495a[_0x57dd('0x40')]);return db[_0x57dd('0x43')][_0x57dd('0x4b')](_0x1d7c38)[_0x57dd('0x27')](handleEntityNotFound(_0x5f5a08,null))[_0x57dd('0x27')](respondWithResult(_0x5f5a08,null))[_0x57dd('0x45')](handleError(_0x5f5a08,null));};exports[_0x57dd('0x4c')]=function(_0x4ff367,_0x2f06fd){return db[_0x57dd('0x43')][_0x57dd('0x4c')](_0x4ff367[_0x57dd('0x4d')],{})[_0x57dd('0x27')](respondWithResult(_0x2f06fd,0xc9))[_0x57dd('0x45')](handleError(_0x2f06fd,null));};exports[_0x57dd('0x4e')]=function(_0x2e68d6,_0x7f2440){if(_0x2e68d6['body']['id']){delete _0x2e68d6[_0x57dd('0x4d')]['id'];}return db[_0x57dd('0x43')][_0x57dd('0x4b')]({'where':{'id':_0x2e68d6['params']['id']}})[_0x57dd('0x27')](handleEntityNotFound(_0x7f2440,null))[_0x57dd('0x27')](saveUpdates(_0x2e68d6[_0x57dd('0x4d')],null))['then'](respondWithResult(_0x7f2440,null))['catch'](handleError(_0x7f2440,null));};exports['destroy']=function(_0x5df102,_0x4c420e){return db[_0x57dd('0x43')][_0x57dd('0x4b')]({'where':{'id':_0x5df102[_0x57dd('0x47')]['id']}})[_0x57dd('0x27')](handleEntityNotFound(_0x4c420e,null))[_0x57dd('0x27')](removeEntity(_0x4c420e,null))['catch'](handleError(_0x4c420e,null));};exports[_0x57dd('0x4f')]=function(_0x288740,_0x2b3bc0){return db[_0x57dd('0x43')][_0x57dd('0x4f')]()[_0x57dd('0x27')](respondWithResult(_0x2b3bc0,null))[_0x57dd('0x45')](handleError(_0x2b3bc0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a1226dd..67f5f8f 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 _0x38b2=['./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x11668c,_0x1913b1){var _0x354c9b=function(_0x525642){while(--_0x525642){_0x11668c['push'](_0x11668c['shift']());}};_0x354c9b(++_0x1913b1);}(_0x38b2,0xf6));var _0x238b=function(_0x4089a1,_0x4894a8){_0x4089a1=_0x4089a1-0x0;var _0x2b9812=_0x38b2[_0x4089a1];return _0x2b9812;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var logger=require(_0x238b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x238b('0x3'));var rp=require(_0x238b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x238b('0x5'));var config=require('../../config/environment');var attributes=require(_0x238b('0x6'));module[_0x238b('0x7')]=function(_0x2fb980,_0xb6f089){return _0x2fb980['define'](_0x238b('0x8'),attributes,{'tableName':_0x238b('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x238b('0xa'),_0x238b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0512=['exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x377016,_0x1c7d6d){var _0x3575da=function(_0xecaff9){while(--_0xecaff9){_0x377016['push'](_0x377016['shift']());}};_0x3575da(++_0x1c7d6d);}(_0x0512,0x1e6));var _0x2051=function(_0x55e099,_0x3bd8a9){_0x55e099=_0x55e099-0x0;var _0xcc67fb=_0x0512[_0x55e099];return _0xcc67fb;};'use strict';var _=require(_0x2051('0x0'));var util=require(_0x2051('0x1'));var logger=require(_0x2051('0x2'))(_0x2051('0x3'));var moment=require(_0x2051('0x4'));var BPromise=require(_0x2051('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2051('0x6'));var rimraf=require(_0x2051('0x7'));var config=require(_0x2051('0x8'));var attributes=require(_0x2051('0x9'));module[_0x2051('0xa')]=function(_0x5b7b33,_0x4ea450){return _0x5b7b33[_0x2051('0xb')](_0x2051('0xc'),attributes,{'tableName':_0x2051('0xd'),'paranoid':![],'indexes':[{'name':_0x2051('0xe'),'fields':[_0x2051('0xf'),'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 a9c6b30..253b6fe 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 _0xa566=['UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','info'];(function(_0x4ccb14,_0x5958c6){var _0x1ef6d8=function(_0xac1a61){while(--_0xac1a61){_0x4ccb14['push'](_0x4ccb14['shift']());}};_0x1ef6d8(++_0x5958c6);}(_0xa566,0x1c1));var _0x6a56=function(_0xdea740,_0x5c7894){_0xdea740=_0xdea740-0x0;var _0x4856be=_0xa566[_0xdea740];return _0x4856be;};'use strict';var _=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var moment=require(_0x6a56('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a56('0x3'));var fs=require('fs');var Redis=require(_0x6a56('0x4'));var db=require(_0x6a56('0x5'))['db'];var utils=require(_0x6a56('0x6'));var logger=require('../../config/logger')(_0x6a56('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3712ee,_0x50ae34,_0x472c60){return new BPromise(function(_0x4947a9,_0x33240c){return client[_0x6a56('0x8')](_0x3712ee,_0x472c60)['then'](function(_0x2f49ab){logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));logger['debug'](_0x6a56('0xc'),_0x50ae34,_0x6a56('0xb'),JSON['stringify'](_0x2f49ab));if(_0x2f49ab['error']){if(_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xe')]===0x1f4){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x33240c(_0x2f49ab[_0x6a56('0xd')]['message']);}logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x4947a9(_0x2f49ab[_0x6a56('0xd')]['message']);}else{logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));_0x4947a9(_0x2f49ab[_0x6a56('0x10')][_0x6a56('0xf')]);}})['catch'](function(_0x5e9895){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x5e9895);_0x33240c(_0x5e9895);});});} \ No newline at end of file +var _0x3178=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserProfileSection,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x3178,0x7f));var _0x8317=function(_0xc03fac,_0x5e8753){_0xc03fac=_0xc03fac-0x0;var _0xa1af02=_0x3178[_0xc03fac];return _0xa1af02;};'use strict';var _=require(_0x8317('0x0'));var util=require(_0x8317('0x1'));var moment=require('moment');var BPromise=require(_0x8317('0x2'));var rs=require(_0x8317('0x3'));var fs=require('fs');var Redis=require(_0x8317('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8317('0x5'));var logger=require(_0x8317('0x6'))(_0x8317('0x7'));var config=require(_0x8317('0x8'));var jayson=require(_0x8317('0x9'));var client=jayson[_0x8317('0xa')][_0x8317('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29976b,_0x49c705,_0x83d6d3){return new BPromise(function(_0x3cff10,_0xf37701){return client[_0x8317('0xc')](_0x29976b,_0x83d6d3)[_0x8317('0xd')](function(_0x3c7eb7){logger[_0x8317('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x49c705,'request\x20sent');logger[_0x8317('0xf')](_0x8317('0x10'),_0x49c705,_0x8317('0x11'),JSON[_0x8317('0x12')](_0x3c7eb7));if(_0x3c7eb7[_0x8317('0x13')]){if(_0x3c7eb7[_0x8317('0x13')]['code']===0x1f4){logger['error'](_0x8317('0x14'),_0x49c705,_0x3c7eb7[_0x8317('0x13')][_0x8317('0x15')]);return _0xf37701(_0x3c7eb7[_0x8317('0x13')][_0x8317('0x15')]);}logger[_0x8317('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x49c705,_0x3c7eb7['error'][_0x8317('0x15')]);return _0x3cff10(_0x3c7eb7[_0x8317('0x13')][_0x8317('0x15')]);}else{logger[_0x8317('0xe')](_0x8317('0x14'),_0x49c705,_0x8317('0x11'));_0x3cff10(_0x3c7eb7['result'][_0x8317('0x15')]);}})['catch'](function(_0x2db59f){logger['error'](_0x8317('0x14'),_0x49c705,_0x2db59f);_0xf37701(_0x2db59f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index adc3b94..4a655fa 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x47dbe7,_0x4bf90c){var _0x372312=function(_0x57c68b){while(--_0x57c68b){_0x47dbe7['push'](_0x47dbe7['shift']());}};_0x372312(++_0x4bf90c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1b2b2e,_0x36c4c4){var _0x105738=function(_0xa77172){while(--_0xa77172){_0x1b2b2e['push'](_0x1b2b2e['shift']());}};_0x105738(++_0x36c4c4);}(_0xe706,0xa3));var _0x6e70=function(_0x5442d1,_0x193d0e){_0x5442d1=_0x5442d1-0x0;var _0x2f0eaf=_0xe706[_0x5442d1];return _0x2f0eaf;};'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 diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9006424..c35196e 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x13f6=['exports'];(function(_0x4f2fdb,_0x3b3d53){var _0x21dc29=function(_0x1b15f6){while(--_0x1b15f6){_0x4f2fdb['push'](_0x4f2fdb['shift']());}};_0x21dc29(++_0x3b3d53);}(_0x13f6,0xaf));var _0x613f=function(_0x2dd085,_0x14a9de){_0x2dd085=_0x2dd085-0x0;var _0x18f010=_0x13f6[_0x2dd085];return _0x18f010;};'use strict';var Sequelize=require('sequelize');module[_0x613f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 939e409..c463a5c 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 _0x8085=['define','UserSmsQueue','user_has_sms_queues','lodash','api','moment','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes'];(function(_0x31cdff,_0x545438){var _0x14091f=function(_0x363721){while(--_0x363721){_0x31cdff['push'](_0x31cdff['shift']());}};_0x14091f(++_0x545438);}(_0x8085,0x71));var _0x5808=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x8085[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0x5808('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5808('0x1'));var moment=require(_0x5808('0x2'));var BPromise=require(_0x5808('0x3'));var rp=require(_0x5808('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5808('0x5'));var attributes=require(_0x5808('0x6'));module['exports']=function(_0x17f899,_0x749306){return _0x17f899[_0x5808('0x7')](_0x5808('0x8'),attributes,{'tableName':_0x5808('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2581=['request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x539b0c,_0x4a8fbd){var _0x33d740=function(_0x21071f){while(--_0x21071f){_0x539b0c['push'](_0x539b0c['shift']());}};_0x33d740(++_0x4a8fbd);}(_0x2581,0xcb));var _0x1258=function(_0x402c34,_0x4582fd){_0x402c34=_0x402c34-0x0;var _0x2bad90=_0x2581[_0x402c34];return _0x2bad90;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var logger=require(_0x1258('0x2'))(_0x1258('0x3'));var moment=require(_0x1258('0x4'));var BPromise=require('bluebird');var rp=require(_0x1258('0x5'));var fs=require('fs');var path=require(_0x1258('0x6'));var rimraf=require(_0x1258('0x7'));var config=require(_0x1258('0x8'));var attributes=require(_0x1258('0x9'));module[_0x1258('0xa')]=function(_0x16c926,_0x2aeafc){return _0x16c926['define'](_0x1258('0xb'),attributes,{'tableName':_0x1258('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 7ee8450..33e2e39 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 _0x6cda=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1d0a89,_0x11eda8){var _0x29a843=function(_0x1a0fbe){while(--_0x1a0fbe){_0x1d0a89['push'](_0x1d0a89['shift']());}};_0x29a843(++_0x11eda8);}(_0x6cda,0xfb));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6cd('0x0'));var util=require(_0xa6cd('0x1'));var moment=require(_0xa6cd('0x2'));var BPromise=require(_0xa6cd('0x3'));var rs=require(_0xa6cd('0x4'));var fs=require('fs');var Redis=require(_0xa6cd('0x5'));var db=require(_0xa6cd('0x6'))['db'];var utils=require(_0xa6cd('0x7'));var logger=require(_0xa6cd('0x8'))(_0xa6cd('0x9'));var config=require(_0xa6cd('0xa'));var jayson=require(_0xa6cd('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c1b00,_0x46fb9a,_0x4dbedd){return new BPromise(function(_0x117af2,_0x4b7f33){return client[_0xa6cd('0xc')](_0x1c1b00,_0x4dbedd)[_0xa6cd('0xd')](function(_0x8207f3){logger[_0xa6cd('0xe')](_0xa6cd('0xf'),_0x46fb9a,_0xa6cd('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x46fb9a,_0xa6cd('0x10'),JSON[_0xa6cd('0x11')](_0x8207f3));if(_0x8207f3['error']){if(_0x8207f3[_0xa6cd('0x12')][_0xa6cd('0x13')]===0x1f4){logger[_0xa6cd('0x12')](_0xa6cd('0xf'),_0x46fb9a,_0x8207f3[_0xa6cd('0x12')][_0xa6cd('0x14')]);return _0x4b7f33(_0x8207f3[_0xa6cd('0x12')]['message']);}logger[_0xa6cd('0x12')](_0xa6cd('0xf'),_0x46fb9a,_0x8207f3[_0xa6cd('0x12')][_0xa6cd('0x14')]);return _0x117af2(_0x8207f3[_0xa6cd('0x12')][_0xa6cd('0x14')]);}else{logger[_0xa6cd('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x46fb9a,_0xa6cd('0x10'));_0x117af2(_0x8207f3[_0xa6cd('0x15')][_0xa6cd('0x14')]);}})[_0xa6cd('0x16')](function(_0x5a47fe){logger[_0xa6cd('0x12')](_0xa6cd('0xf'),_0x46fb9a,_0x5a47fe);_0x4b7f33(_0x5a47fe);});});} \ No newline at end of file +var _0xcd75=['code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x24b052,_0x3da042){var _0x433bc1=function(_0x4c20cc){while(--_0x4c20cc){_0x24b052['push'](_0x24b052['shift']());}};_0x433bc1(++_0x3da042);}(_0xcd75,0x14f));var _0x5cd7=function(_0x15500e,_0x278771){_0x15500e=_0x15500e-0x0;var _0x19a57b=_0xcd75[_0x15500e];return _0x19a57b;};'use strict';var _=require(_0x5cd7('0x0'));var util=require(_0x5cd7('0x1'));var moment=require('moment');var BPromise=require(_0x5cd7('0x2'));var rs=require(_0x5cd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cd7('0x4'))['db'];var utils=require(_0x5cd7('0x5'));var logger=require(_0x5cd7('0x6'))(_0x5cd7('0x7'));var config=require(_0x5cd7('0x8'));var jayson=require(_0x5cd7('0x9'));var client=jayson[_0x5cd7('0xa')][_0x5cd7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13bf21,_0x2aaf5,_0x3b7cf8){return new BPromise(function(_0x55dcc1,_0x31c6fd){return client['request'](_0x13bf21,_0x3b7cf8)['then'](function(_0x4ca899){logger['info'](_0x5cd7('0xc'),_0x2aaf5,_0x5cd7('0xd'));logger[_0x5cd7('0xe')](_0x5cd7('0xf'),_0x2aaf5,_0x5cd7('0xd'),JSON['stringify'](_0x4ca899));if(_0x4ca899['error']){if(_0x4ca899[_0x5cd7('0x10')][_0x5cd7('0x11')]===0x1f4){logger[_0x5cd7('0x10')](_0x5cd7('0xc'),_0x2aaf5,_0x4ca899['error'][_0x5cd7('0x12')]);return _0x31c6fd(_0x4ca899[_0x5cd7('0x10')][_0x5cd7('0x12')]);}logger['error'](_0x5cd7('0xc'),_0x2aaf5,_0x4ca899['error']['message']);return _0x55dcc1(_0x4ca899[_0x5cd7('0x10')][_0x5cd7('0x12')]);}else{logger[_0x5cd7('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2aaf5,_0x5cd7('0xd'));_0x55dcc1(_0x4ca899[_0x5cd7('0x14')][_0x5cd7('0x12')]);}})[_0x5cd7('0x15')](function(_0x482252){logger[_0x5cd7('0x10')](_0x5cd7('0xc'),_0x2aaf5,_0x482252);_0x31c6fd(_0x482252);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 7be8936..09521db 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x165082,_0x207ae8){var _0x21989b=function(_0x3bec8b){while(--_0x3bec8b){_0x165082['push'](_0x165082['shift']());}};_0x21989b(++_0x207ae8);}(_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(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_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'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 8333691..2cd9644 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 _0x80e8=['sequelize','exports','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x80e8,0x141));var _0x880e=function(_0x5268b0,_0x9173bb){_0x5268b0=_0x5268b0-0x0;var _0x5f1337=_0x80e8[_0x5268b0];return _0x5f1337;};'use strict';var Sequelize=require(_0x880e('0x0'));module[_0x880e('0x1')]={'penalty':{'type':Sequelize[_0x880e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3ea4=['INTEGER','sequelize','exports'];(function(_0x335dc3,_0x349fe3){var _0x5ddcc6=function(_0x940123){while(--_0x940123){_0x335dc3['push'](_0x335dc3['shift']());}};_0x5ddcc6(++_0x349fe3);}(_0x3ea4,0xd6));var _0x43ea=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x3ea4[_0xf16b1];return _0x26f94d;};'use strict';var Sequelize=require(_0x43ea('0x0'));module[_0x43ea('0x1')]={'penalty':{'type':Sequelize[_0x43ea('0x2')],'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 9f765b5..a5e55b3 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 _0x6aa2=['UserVoiceQueue','user_has_voice_queues','util','../../config/logger','moment','path','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x7d4250,_0xee043c){var _0x2a69c5=function(_0x550cf6){while(--_0x550cf6){_0x7d4250['push'](_0x7d4250['shift']());}};_0x2a69c5(++_0xee043c);}(_0x6aa2,0xb6));var _0x26aa=function(_0x36f641,_0x1a3063){_0x36f641=_0x36f641-0x0;var _0x39b299=_0x6aa2[_0x36f641];return _0x39b299;};'use strict';var _=require('lodash');var util=require(_0x26aa('0x0'));var logger=require(_0x26aa('0x1'))('api');var moment=require(_0x26aa('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x26aa('0x3'));var rimraf=require('rimraf');var config=require(_0x26aa('0x4'));var attributes=require(_0x26aa('0x5'));module[_0x26aa('0x6')]=function(_0x4c459d,_0x2c4362){return _0x4c459d[_0x26aa('0x7')](_0x26aa('0x8'),attributes,{'tableName':_0x26aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7366=['path','rimraf','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1cbdd9,_0x420c37){var _0x99a966=function(_0x6fe48c){while(--_0x6fe48c){_0x1cbdd9['push'](_0x1cbdd9['shift']());}};_0x99a966(++_0x420c37);}(_0x7366,0x13e));var _0x6736=function(_0x293fec,_0x133f38){_0x293fec=_0x293fec-0x0;var _0x405724=_0x7366[_0x293fec];return _0x405724;};'use strict';var _=require(_0x6736('0x0'));var util=require('util');var logger=require(_0x6736('0x1'))(_0x6736('0x2'));var moment=require(_0x6736('0x3'));var BPromise=require(_0x6736('0x4'));var rp=require(_0x6736('0x5'));var fs=require('fs');var path=require(_0x6736('0x6'));var rimraf=require(_0x6736('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x6736('0x8')]=function(_0x546607,_0xbf1bac){return _0x546607[_0x6736('0x9')](_0x6736('0xa'),attributes,{'tableName':_0x6736('0xb'),'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 7f23dff..be9ee35 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 _0x261d=['client','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x41e99d,_0x2224e4){var _0x21e1cc=function(_0x21477a){while(--_0x21477a){_0x41e99d['push'](_0x41e99d['shift']());}};_0x21e1cc(++_0x2224e4);}(_0x261d,0xe8));var _0xd261=function(_0x218676,_0x2266a8){_0x218676=_0x218676-0x0;var _0x2053fc=_0x261d[_0x218676];return _0x2053fc;};'use strict';var _=require(_0xd261('0x0'));var util=require(_0xd261('0x1'));var moment=require(_0xd261('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd261('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd261('0x4'));var logger=require(_0xd261('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd261('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x453774,_0xf18332,_0x50fdd6){return new BPromise(function(_0x114bc0,_0x23309e){return client['request'](_0x453774,_0x50fdd6)[_0xd261('0x7')](function(_0xa2ff96){logger[_0xd261('0x8')](_0xd261('0x9'),_0xf18332,_0xd261('0xa'));logger[_0xd261('0xb')](_0xd261('0xc'),_0xf18332,_0xd261('0xa'),JSON[_0xd261('0xd')](_0xa2ff96));if(_0xa2ff96[_0xd261('0xe')]){if(_0xa2ff96[_0xd261('0xe')][_0xd261('0xf')]===0x1f4){logger['error'](_0xd261('0x9'),_0xf18332,_0xa2ff96[_0xd261('0xe')][_0xd261('0x10')]);return _0x23309e(_0xa2ff96[_0xd261('0xe')][_0xd261('0x10')]);}logger[_0xd261('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0xf18332,_0xa2ff96[_0xd261('0xe')][_0xd261('0x10')]);return _0x114bc0(_0xa2ff96[_0xd261('0xe')][_0xd261('0x10')]);}else{logger['info'](_0xd261('0x9'),_0xf18332,'request\x20sent');_0x114bc0(_0xa2ff96['result']['message']);}})['catch'](function(_0x55c205){logger[_0xd261('0xe')](_0xd261('0x9'),_0xf18332,_0x55c205);_0x23309e(_0x55c205);});});} \ No newline at end of file +var _0x2228=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x464212,_0x10211c){var _0x19fe7a=function(_0x3c4c8f){while(--_0x3c4c8f){_0x464212['push'](_0x464212['shift']());}};_0x19fe7a(++_0x10211c);}(_0x2228,0x121));var _0x8222=function(_0xe4d394,_0x172eb7){_0xe4d394=_0xe4d394-0x0;var _0x492843=_0x2228[_0xe4d394];return _0x492843;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8222('0x0'));var BPromise=require(_0x8222('0x1'));var rs=require(_0x8222('0x2'));var fs=require('fs');var Redis=require(_0x8222('0x3'));var db=require(_0x8222('0x4'))['db'];var utils=require(_0x8222('0x5'));var logger=require(_0x8222('0x6'))(_0x8222('0x7'));var config=require(_0x8222('0x8'));var jayson=require(_0x8222('0x9'));var client=jayson[_0x8222('0xa')][_0x8222('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f209c,_0x55480e,_0x59bcc3){return new BPromise(function(_0x51bebb,_0x5c12b4){return client['request'](_0x2f209c,_0x59bcc3)[_0x8222('0xc')](function(_0x47ebcd){logger['info'](_0x8222('0xd'),_0x55480e,_0x8222('0xe'));logger[_0x8222('0xf')](_0x8222('0x10'),_0x55480e,'request\x20sent',JSON['stringify'](_0x47ebcd));if(_0x47ebcd[_0x8222('0x11')]){if(_0x47ebcd[_0x8222('0x11')]['code']===0x1f4){logger[_0x8222('0x11')](_0x8222('0xd'),_0x55480e,_0x47ebcd[_0x8222('0x11')][_0x8222('0x12')]);return _0x5c12b4(_0x47ebcd[_0x8222('0x11')]['message']);}logger[_0x8222('0x11')](_0x8222('0xd'),_0x55480e,_0x47ebcd[_0x8222('0x11')]['message']);return _0x51bebb(_0x47ebcd[_0x8222('0x11')][_0x8222('0x12')]);}else{logger[_0x8222('0x13')](_0x8222('0xd'),_0x55480e,_0x8222('0xe'));_0x51bebb(_0x47ebcd['result'][_0x8222('0x12')]);}})[_0x8222('0x14')](function(_0x4ff7d0){logger[_0x8222('0x11')](_0x8222('0xd'),_0x55480e,_0x4ff7d0);_0x5c12b4(_0x4ff7d0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e41a484..040baee 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(_0xcc67fe,_0x27eed2){var _0x679c61=function(_0x288d2a){while(--_0x288d2a){_0xcc67fe['push'](_0xcc67fe['shift']());}};_0x679c61(++_0x27eed2);}(_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(_0x498bc3,_0x20297b){var _0x32467f=function(_0x15f4ee){while(--_0x15f4ee){_0x498bc3['push'](_0x498bc3['shift']());}};_0x32467f(++_0x20297b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0xcb91[_0x888385];return _0x22d5c2;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6456f7d..4c76836 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 _0xa408=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa408,0x1ea));var _0x8a40=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0xa408[_0x4d7a70];return _0x3aafbb;};'use strict';var Sequelize=require('sequelize');module[_0x8a40('0x0')]={'uniqueid':{'type':Sequelize[_0x8a40('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8a40('0x2')},'membername':{'type':Sequelize[_0x8a40('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x8a40('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8a40('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x8a40('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8a40('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x8a40('0x3')],'allowNull':![],'unique':_0x8a40('0x4'),'comment':_0x8a40('0x2')},'penalty':{'type':Sequelize[_0x8a40('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x8a40('0x1')](0xb),'defaultValue':0x0,'comment':_0x8a40('0x2')}}; \ No newline at end of file +var _0x41c4=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x496962,_0x50ce30){var _0x355bd5=function(_0x3946e5){while(--_0x3946e5){_0x496962['push'](_0x496962['shift']());}};_0x355bd5(++_0x50ce30);}(_0x41c4,0x1ee));var _0x441c=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x41c4[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0x441c('0x0')]={'uniqueid':{'type':Sequelize[_0x441c('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x441c('0x2')},'membername':{'type':Sequelize[_0x441c('0x3')],'allowNull':![],'comment':_0x441c('0x2')},'UserId':{'type':Sequelize[_0x441c('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x441c('0x3')],'allowNull':![],'unique':_0x441c('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x441c('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x441c('0x3')],'allowNull':![],'unique':_0x441c('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x441c('0x2')},'paused':{'type':Sequelize[_0x441c('0x1')](0xb),'defaultValue':0x0,'comment':_0x441c('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3e78c59..9d53773 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 _0x5ace=['remove','emit','hook','exports','events','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0xf106cd,_0x3f277f){var _0x59e0ed=function(_0x3399d5){while(--_0x3399d5){_0xf106cd['push'](_0xf106cd['shift']());}};_0x59e0ed(++_0x3f277f);}(_0x5ace,0x82));var _0xe5ac=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x5ace[_0x59d89e];return _0x554e93;};'use strict';var EventEmitter=require(_0xe5ac('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xe5ac('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe5ac('0x2')](0x0);var events={'afterCreate':_0xe5ac('0x3'),'afterUpdate':_0xe5ac('0x4'),'afterDestroy':_0xe5ac('0x5')};function emitEvent(_0x375cc0){return function(_0x4f0eea,_0x27c5be,_0x43187f){UserVoiceQueueRtEvents['emit'](_0x375cc0+':'+_0x4f0eea['id'],_0x4f0eea);UserVoiceQueueRtEvents[_0xe5ac('0x6')](_0x375cc0,_0x4f0eea);_0x43187f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xe5ac('0x7')](e,emitEvent(event));}}module[_0xe5ac('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x4d5d=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0xd48408,_0x293f03){var _0x5c8816=function(_0x434971){while(--_0x434971){_0xd48408['push'](_0xd48408['shift']());}};_0x5c8816(++_0x293f03);}(_0x4d5d,0x188));var _0xd4d5=function(_0x33d9c5,_0x2c159d){_0x33d9c5=_0x33d9c5-0x0;var _0x28f547=_0x4d5d[_0x33d9c5];return _0x28f547;};'use strict';var EventEmitter=require(_0xd4d5('0x0'));var UserVoiceQueueRt=require(_0xd4d5('0x1'))['db'][_0xd4d5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd4d5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd4d5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x118ae7){return function(_0x3f5bc6,_0x3416c9,_0x54774c){UserVoiceQueueRtEvents[_0xd4d5('0x5')](_0x118ae7+':'+_0x3f5bc6['id'],_0x3f5bc6);UserVoiceQueueRtEvents[_0xd4d5('0x5')](_0x118ae7,_0x3f5bc6);_0x54774c(null);};}for(var e in events){if(events[_0xd4d5('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xd4d5('0x7')](e,emitEvent(event));}}module[_0xd4d5('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8cc8df9..8ec0e88 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 _0xc244=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x480f03,_0x3c5672){var _0x2d656e=function(_0x17c535){while(--_0x17c535){_0x480f03['push'](_0x480f03['shift']());}};_0x2d656e(++_0x3c5672);}(_0xc244,0x1ef));var _0x4c24=function(_0x3a04fa,_0x3fe649){_0x3a04fa=_0x3a04fa-0x0;var _0x9504db=_0xc244[_0x3a04fa];return _0x9504db;};'use strict';var _=require(_0x4c24('0x0'));var util=require(_0x4c24('0x1'));var logger=require(_0x4c24('0x2'))(_0x4c24('0x3'));var moment=require(_0x4c24('0x4'));var BPromise=require(_0x4c24('0x5'));var rp=require(_0x4c24('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c24('0x7'));var config=require(_0x4c24('0x8'));var attributes=require(_0x4c24('0x9'));module[_0x4c24('0xa')]=function(_0x3621dc,_0xaf440){return _0x3621dc[_0x4c24('0xb')](_0x4c24('0xc'),attributes,{'tableName':_0x4c24('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd51f=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x9fd314,_0x4ea791){var _0x39d36a=function(_0x358f07){while(--_0x358f07){_0x9fd314['push'](_0x9fd314['shift']());}};_0x39d36a(++_0x4ea791);}(_0xd51f,0x1be));var _0xfd51=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd51f[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xfd51('0x0'));var util=require('util');var logger=require(_0xfd51('0x1'))(_0xfd51('0x2'));var moment=require(_0xfd51('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd51('0x4'));var fs=require('fs');var path=require(_0xfd51('0x5'));var rimraf=require(_0xfd51('0x6'));var config=require(_0xfd51('0x7'));var attributes=require(_0xfd51('0x8'));module[_0xfd51('0x9')]=function(_0x19f984,_0x2819bb){return _0x19f984[_0xfd51('0xa')](_0xfd51('0xb'),attributes,{'tableName':_0xfd51('0xc'),'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 2350211..57ef76f 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 _0x45f9=['findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt'];(function(_0x2efc9e,_0x58f425){var _0x3222f6=function(_0x56a90f){while(--_0x56a90f){_0x2efc9e['push'](_0x2efc9e['shift']());}};_0x3222f6(++_0x58f425);}(_0x45f9,0x1dd));var _0x945f=function(_0x29af1d,_0x18657e){_0x29af1d=_0x29af1d-0x0;var _0x2e7bf9=_0x45f9[_0x29af1d];return _0x2e7bf9;};'use strict';var _=require(_0x945f('0x0'));var util=require(_0x945f('0x1'));var moment=require(_0x945f('0x2'));var BPromise=require(_0x945f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x945f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x945f('0x5'));var logger=require(_0x945f('0x6'))(_0x945f('0x7'));var config=require(_0x945f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x945f('0x9')]['http']({'port':0x232a});config[_0x945f('0xa')]=_[_0x945f('0xb')](config[_0x945f('0xa')],{'host':_0x945f('0xc'),'port':0x18eb});var socket=require(_0x945f('0xd'))(new Redis(config[_0x945f('0xa')]));require(_0x945f('0xe'))[_0x945f('0xf')](socket);function respondWithRpcPromise(_0x4872e8,_0x358d33,_0x1fb80d){return new BPromise(function(_0x5c301e,_0x57b7dc){return client['request'](_0x4872e8,_0x1fb80d)['then'](function(_0x20ce4d){logger[_0x945f('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x358d33,_0x945f('0x11'));logger['debug'](_0x945f('0x12'),_0x358d33,_0x945f('0x11'),JSON[_0x945f('0x13')](_0x20ce4d));if(_0x20ce4d[_0x945f('0x14')]){if(_0x20ce4d[_0x945f('0x14')]['code']===0x1f4){logger[_0x945f('0x14')](_0x945f('0x15'),_0x358d33,_0x20ce4d[_0x945f('0x14')][_0x945f('0x16')]);return _0x57b7dc(_0x20ce4d[_0x945f('0x14')]['message']);}logger['error'](_0x945f('0x15'),_0x358d33,_0x20ce4d[_0x945f('0x14')][_0x945f('0x16')]);return _0x5c301e(_0x20ce4d['error'][_0x945f('0x16')]);}else{logger[_0x945f('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x358d33,'request\x20sent');_0x5c301e(_0x20ce4d[_0x945f('0x17')]['message']);}})[_0x945f('0x18')](function(_0x512c20){logger[_0x945f('0x14')](_0x945f('0x15'),_0x358d33,_0x512c20);_0x57b7dc(_0x512c20);});});}exports[_0x945f('0x19')]=function(_0x3c9ef6){var _0x51fada=this;return new Promise(function(_0x40d708,_0x22efe2){return db[_0x945f('0x1a')][_0x945f('0x1b')]({'raw':_0x3c9ef6[_0x945f('0x1c')]?_0x3c9ef6['options'][_0x945f('0x1d')]===undefined?!![]:![]:!![],'where':_0x3c9ef6[_0x945f('0x1c')]?_0x3c9ef6[_0x945f('0x1c')][_0x945f('0x1e')]||null:null,'attributes':[[db[_0x945f('0x1f')]['fn'](_0x945f('0x20'),db[_0x945f('0x1f')]['fn']('IF',db['sequelize'][_0x945f('0x21')](_0x945f('0x22')))),_0x945f('0x23')]]})['then'](function(_0x343ca7){logger[_0x945f('0x10')]('GetVoiceQueueRtPauses',_0x3c9ef6);logger['debug'](_0x945f('0x19'),_0x3c9ef6,JSON['stringify'](_0x343ca7));_0x40d708(_0x343ca7);})[_0x945f('0x18')](function(_0x19c16e){logger[_0x945f('0x14')]('GetVoiceQueueRtPauses',_0x19c16e[_0x945f('0x16')],_0x3c9ef6);_0x22efe2(_0x51fada['error'](0x1f4,_0x19c16e[_0x945f('0x16')]));});});}; \ No newline at end of file +var _0x1c30=['rpc','client','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','outboundQueuePauses','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4f2b8c,_0x4012c8){var _0x1226ae=function(_0x495689){while(--_0x495689){_0x4f2b8c['push'](_0x4f2b8c['shift']());}};_0x1226ae(++_0x4012c8);}(_0x1c30,0x156));var _0x01c3=function(_0x5c814d,_0x4d81c7){_0x5c814d=_0x5c814d-0x0;var _0x89b71=_0x1c30[_0x5c814d];return _0x89b71;};'use strict';var _=require(_0x01c3('0x0'));var util=require(_0x01c3('0x1'));var moment=require(_0x01c3('0x2'));var BPromise=require(_0x01c3('0x3'));var rs=require(_0x01c3('0x4'));var fs=require('fs');var Redis=require(_0x01c3('0x5'));var db=require(_0x01c3('0x6'))['db'];var utils=require(_0x01c3('0x7'));var logger=require('../../config/logger')(_0x01c3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x01c3('0x9')]['http']({'port':0x232a});config['redis']=_[_0x01c3('0xa')](config['redis'],{'host':_0x01c3('0xb'),'port':0x18eb});var socket=require(_0x01c3('0xc'))(new Redis(config['redis']));require(_0x01c3('0xd'))['register'](socket);function respondWithRpcPromise(_0x1ff0cc,_0x201468,_0x43d92a){return new BPromise(function(_0x2dd50f,_0x202079){return client[_0x01c3('0xe')](_0x1ff0cc,_0x43d92a)['then'](function(_0x66ae04){logger[_0x01c3('0xf')](_0x01c3('0x10'),_0x201468,'request\x20sent');logger[_0x01c3('0x11')](_0x01c3('0x12'),_0x201468,_0x01c3('0x13'),JSON['stringify'](_0x66ae04));if(_0x66ae04[_0x01c3('0x14')]){if(_0x66ae04[_0x01c3('0x14')]['code']===0x1f4){logger[_0x01c3('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x201468,_0x66ae04[_0x01c3('0x14')][_0x01c3('0x15')]);return _0x202079(_0x66ae04['error'][_0x01c3('0x15')]);}logger['error'](_0x01c3('0x10'),_0x201468,_0x66ae04[_0x01c3('0x14')][_0x01c3('0x15')]);return _0x2dd50f(_0x66ae04[_0x01c3('0x14')][_0x01c3('0x15')]);}else{logger[_0x01c3('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x201468,_0x01c3('0x13'));_0x2dd50f(_0x66ae04[_0x01c3('0x16')][_0x01c3('0x15')]);}})[_0x01c3('0x17')](function(_0xdf8e27){logger[_0x01c3('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x201468,_0xdf8e27);_0x202079(_0xdf8e27);});});}exports[_0x01c3('0x18')]=function(_0x3acc05){var _0x323851=this;return new Promise(function(_0x46d1cc,_0x9d8a2f){return db[_0x01c3('0x19')][_0x01c3('0x1a')]({'raw':_0x3acc05[_0x01c3('0x1b')]?_0x3acc05[_0x01c3('0x1b')][_0x01c3('0x1c')]===undefined?!![]:![]:!![],'where':_0x3acc05[_0x01c3('0x1b')]?_0x3acc05['options']['where']||null:null,'attributes':[[db[_0x01c3('0x1d')]['fn'](_0x01c3('0x1e'),db[_0x01c3('0x1d')]['fn']('IF',db[_0x01c3('0x1d')][_0x01c3('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),_0x01c3('0x20')]]})[_0x01c3('0x21')](function(_0x4b7609){logger[_0x01c3('0xf')](_0x01c3('0x18'),_0x3acc05);logger[_0x01c3('0x11')](_0x01c3('0x18'),_0x3acc05,JSON[_0x01c3('0x22')](_0x4b7609));_0x46d1cc(_0x4b7609);})[_0x01c3('0x17')](function(_0x3babd3){logger['error'](_0x01c3('0x18'),_0x3babd3[_0x01c3('0x15')],_0x3acc05);_0x9d8a2f(_0x323851[_0x01c3('0x14')](0x1f4,_0x3babd3[_0x01c3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 42914b7..bf569a3 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 _0x8b8e=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove'];(function(_0x2fe15c,_0x48713a){var _0x26ec58=function(_0x3e475a){while(--_0x3e475a){_0x2fe15c['push'](_0x2fe15c['shift']());}};_0x26ec58(++_0x48713a);}(_0x8b8e,0x108));var _0xe8b8=function(_0x29c9f6,_0x29b430){_0x29c9f6=_0x29c9f6-0x0;var _0xfbc70e=_0x8b8e[_0x29c9f6];return _0xfbc70e;};'use strict';var UserVoiceQueueRtEvents=require(_0xe8b8('0x0'));var events=['save',_0xe8b8('0x1'),'update'];function createListener(_0x3f1493,_0x4d012c){return function(_0x4b1992){_0x4d012c[_0xe8b8('0x2')](_0x3f1493,_0x4b1992);};}function removeListener(_0x472a91,_0x13a865){return function(){UserVoiceQueueRtEvents[_0xe8b8('0x3')](_0x472a91,_0x13a865);};}exports[_0xe8b8('0x4')]=function(_0x3f5dd7){for(var _0x1c0548=0x0,_0x2b3269=events[_0xe8b8('0x5')];_0x1c0548<_0x2b3269;_0x1c0548++){var _0x2540e3=events[_0x1c0548];var _0x4ce796=createListener(_0xe8b8('0x6')+_0x2540e3,_0x3f5dd7);UserVoiceQueueRtEvents['on'](_0x2540e3,_0x4ce796);}}; \ No newline at end of file +var _0x7e4b=['save','update','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x3b68ff,_0x4b03a5){var _0x589872=function(_0x576a06){while(--_0x576a06){_0x3b68ff['push'](_0x3b68ff['shift']());}};_0x589872(++_0x4b03a5);}(_0x7e4b,0x84));var _0xb7e4=function(_0x5441de,_0x3b30ab){_0x5441de=_0x5441de-0x0;var _0x324e43=_0x7e4b[_0x5441de];return _0x324e43;};'use strict';var UserVoiceQueueRtEvents=require(_0xb7e4('0x0'));var events=[_0xb7e4('0x1'),'remove',_0xb7e4('0x2')];function createListener(_0x802d62,_0x546114){return function(_0x3d3eed){_0x546114[_0xb7e4('0x3')](_0x802d62,_0x3d3eed);};}function removeListener(_0x2fca1d,_0x32f781){return function(){UserVoiceQueueRtEvents[_0xb7e4('0x4')](_0x2fca1d,_0x32f781);};}exports[_0xb7e4('0x5')]=function(_0x39c1fd){for(var _0x2f1b05=0x0,_0x1d49a7=events['length'];_0x2f1b05<_0x1d49a7;_0x2f1b05++){var _0x334af2=events[_0x2f1b05];var _0x5e4a34=createListener(_0xb7e4('0x6')+_0x334af2,_0x39c1fd);UserVoiceQueueRtEvents['on'](_0x334af2,_0x5e4a34);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 9a34e36..053590d 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x433219,_0x500f12){var _0x3f9a64=function(_0x4d6e01){while(--_0x4d6e01){_0x433219['push'](_0x433219['shift']());}};_0x3f9a64(++_0x500f12);}(_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(_0x56e80c,_0xd0f2eb){var _0x2ece80=function(_0x222104){while(--_0x222104){_0x56e80c['push'](_0x56e80c['shift']());}};_0x2ece80(++_0xd0f2eb);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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 9cc002f..d9d6f2e 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 _0xf5f0=['sequelize','exports','INTEGER'];(function(_0x416972,_0xcf23f7){var _0x25f2b8=function(_0x4794f5){while(--_0x4794f5){_0x416972['push'](_0x416972['shift']());}};_0x25f2b8(++_0xcf23f7);}(_0xf5f0,0xd8));var _0x0f5f=function(_0xbb067d,_0x3d8fb5){_0xbb067d=_0xbb067d-0x0;var _0x21e289=_0xf5f0[_0xbb067d];return _0x21e289;};'use strict';var Sequelize=require(_0x0f5f('0x0'));module[_0x0f5f('0x1')]={'penalty':{'type':Sequelize[_0x0f5f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc1a6=['sequelize','exports','INTEGER'];(function(_0x362046,_0x5cf93f){var _0x419ffe=function(_0x18cb42){while(--_0x18cb42){_0x362046['push'](_0x362046['shift']());}};_0x419ffe(++_0x5cf93f);}(_0xc1a6,0xc6));var _0x6c1a=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xc1a6[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x6c1a('0x0'));module[_0x6c1a('0x1')]={'penalty':{'type':Sequelize[_0x6c1a('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 e6ef050..9b81ace 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 _0xc321=['../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x5d6bb7,_0x101286){var _0x5052b5=function(_0x3648e8){while(--_0x3648e8){_0x5d6bb7['push'](_0x5d6bb7['shift']());}};_0x5052b5(++_0x101286);}(_0xc321,0x11a));var _0x1c32=function(_0x15e6b9,_0x121b3f){_0x15e6b9=_0x15e6b9-0x0;var _0x3fe1f1=_0xc321[_0x15e6b9];return _0x3fe1f1;};'use strict';var _=require('lodash');var util=require(_0x1c32('0x0'));var logger=require(_0x1c32('0x1'))(_0x1c32('0x2'));var moment=require('moment');var BPromise=require(_0x1c32('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c32('0x4'));var rimraf=require(_0x1c32('0x5'));var config=require(_0x1c32('0x6'));var attributes=require(_0x1c32('0x7'));module['exports']=function(_0x5cf16e,_0x37638f){return _0x5cf16e['define'](_0x1c32('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0818=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','user_has_whatsapp_queues','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0818,0x15a));var _0x8081=function(_0x4d6a4d,_0x3c9aaf){_0x4d6a4d=_0x4d6a4d-0x0;var _0x5d06cc=_0x0818[_0x4d6a4d];return _0x5d06cc;};'use strict';var _=require('lodash');var util=require(_0x8081('0x0'));var logger=require(_0x8081('0x1'))(_0x8081('0x2'));var moment=require(_0x8081('0x3'));var BPromise=require(_0x8081('0x4'));var rp=require(_0x8081('0x5'));var fs=require('fs');var path=require(_0x8081('0x6'));var rimraf=require(_0x8081('0x7'));var config=require(_0x8081('0x8'));var attributes=require(_0x8081('0x9'));module['exports']=function(_0x20acfa,_0x156bdc){return _0x20acfa[_0x8081('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x8081('0xb'),'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 da69770..4bc2bf3 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 _0x1bc4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4c25ff,_0x18b912){var _0x1331b1=function(_0x16ff1d){while(--_0x16ff1d){_0x4c25ff['push'](_0x4c25ff['shift']());}};_0x1331b1(++_0x18b912);}(_0x1bc4,0xd8));var _0x41bc=function(_0x4ac33f,_0x22e37d){_0x4ac33f=_0x4ac33f-0x0;var _0x29de2f=_0x1bc4[_0x4ac33f];return _0x29de2f;};'use strict';var _=require(_0x41bc('0x0'));var util=require(_0x41bc('0x1'));var moment=require(_0x41bc('0x2'));var BPromise=require(_0x41bc('0x3'));var rs=require(_0x41bc('0x4'));var fs=require('fs');var Redis=require(_0x41bc('0x5'));var db=require(_0x41bc('0x6'))['db'];var utils=require(_0x41bc('0x7'));var logger=require(_0x41bc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x41bc('0x9'));var client=jayson[_0x41bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd4af04,_0x59e2be,_0x38a10f){return new BPromise(function(_0x3cf795,_0x316ace){return client[_0x41bc('0xb')](_0xd4af04,_0x38a10f)[_0x41bc('0xc')](function(_0xbcc865){logger[_0x41bc('0xd')](_0x41bc('0xe'),_0x59e2be,_0x41bc('0xf'));logger[_0x41bc('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x59e2be,'request\x20sent',JSON[_0x41bc('0x11')](_0xbcc865));if(_0xbcc865[_0x41bc('0x12')]){if(_0xbcc865[_0x41bc('0x12')]['code']===0x1f4){logger[_0x41bc('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x59e2be,_0xbcc865['error'][_0x41bc('0x13')]);return _0x316ace(_0xbcc865['error']['message']);}logger['error'](_0x41bc('0xe'),_0x59e2be,_0xbcc865['error'][_0x41bc('0x13')]);return _0x3cf795(_0xbcc865['error'][_0x41bc('0x13')]);}else{logger[_0x41bc('0xd')](_0x41bc('0xe'),_0x59e2be,_0x41bc('0xf'));_0x3cf795(_0xbcc865[_0x41bc('0x14')][_0x41bc('0x13')]);}})[_0x41bc('0x15')](function(_0x4e5ac0){logger[_0x41bc('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x59e2be,_0x4e5ac0);_0x316ace(_0x4e5ac0);});});} \ No newline at end of file +var _0x5c84=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','ioredis','../../mysqldb'];(function(_0xd6d2b9,_0x48c95a){var _0x2a51c5=function(_0x5133ce){while(--_0x5133ce){_0xd6d2b9['push'](_0xd6d2b9['shift']());}};_0x2a51c5(++_0x48c95a);}(_0x5c84,0x1ca));var _0x45c8=function(_0x25abc5,_0x51df2c){_0x25abc5=_0x25abc5-0x0;var _0x241cbb=_0x5c84[_0x25abc5];return _0x241cbb;};'use strict';var _=require(_0x45c8('0x0'));var util=require(_0x45c8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45c8('0x2'));var db=require(_0x45c8('0x3'))['db'];var utils=require(_0x45c8('0x4'));var logger=require(_0x45c8('0x5'))('rpc');var config=require(_0x45c8('0x6'));var jayson=require(_0x45c8('0x7'));var client=jayson[_0x45c8('0x8')][_0x45c8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e95b8,_0x2ed71a,_0x14f633){return new BPromise(function(_0xeda095,_0x5e949d){return client[_0x45c8('0xa')](_0x5e95b8,_0x14f633)[_0x45c8('0xb')](function(_0xcce490){logger[_0x45c8('0xc')](_0x45c8('0xd'),_0x2ed71a,'request\x20sent');logger[_0x45c8('0xe')](_0x45c8('0xf'),_0x2ed71a,_0x45c8('0x10'),JSON[_0x45c8('0x11')](_0xcce490));if(_0xcce490[_0x45c8('0x12')]){if(_0xcce490[_0x45c8('0x12')][_0x45c8('0x13')]===0x1f4){logger[_0x45c8('0x12')](_0x45c8('0xd'),_0x2ed71a,_0xcce490[_0x45c8('0x12')][_0x45c8('0x14')]);return _0x5e949d(_0xcce490[_0x45c8('0x12')][_0x45c8('0x14')]);}logger[_0x45c8('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2ed71a,_0xcce490[_0x45c8('0x12')][_0x45c8('0x14')]);return _0xeda095(_0xcce490[_0x45c8('0x12')][_0x45c8('0x14')]);}else{logger[_0x45c8('0xc')](_0x45c8('0xd'),_0x2ed71a,_0x45c8('0x10'));_0xeda095(_0xcce490[_0x45c8('0x15')][_0x45c8('0x14')]);}})['catch'](function(_0x3a8c35){logger[_0x45c8('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2ed71a,_0x3a8c35);_0x5e949d(_0x3a8c35);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 0769386..4ba3fae 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 _0x0d4e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x13282f,_0x5cd763){var _0x2c96c4=function(_0x2b4b24){while(--_0x2b4b24){_0x13282f['push'](_0x13282f['shift']());}};_0x2c96c4(++_0x5cd763);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0d4e[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0xe0d4('0x0'));var util=require(_0xe0d4('0x1'));var path=require(_0xe0d4('0x2'));var timeout=require(_0xe0d4('0x3'));var express=require(_0xe0d4('0x4'));var router=express[_0xe0d4('0x5')]();var fs_extra=require(_0xe0d4('0x6'));var auth=require(_0xe0d4('0x7'));var interaction=require(_0xe0d4('0x8'));var config=require('../../config/environment');var controller=require(_0xe0d4('0x9'));router[_0xe0d4('0xa')]('/',auth[_0xe0d4('0xb')](),controller[_0xe0d4('0xc')]);router['get']('/:id',auth[_0xe0d4('0xb')](),controller[_0xe0d4('0xd')]);router[_0xe0d4('0xe')]('/',auth[_0xe0d4('0xb')](),controller[_0xe0d4('0xf')]);router[_0xe0d4('0x10')](_0xe0d4('0x11'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x12')]);router[_0xe0d4('0x13')](_0xe0d4('0x11'),auth[_0xe0d4('0xb')](),controller[_0xe0d4('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc02d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4b5b90,_0x25f0f5){var _0x1ad181=function(_0x45d59c){while(--_0x45d59c){_0x4b5b90['push'](_0x4b5b90['shift']());}};_0x1ad181(++_0x25f0f5);}(_0xc02d,0x1aa));var _0xdc02=function(_0x3b44a0,_0x240182){_0x3b44a0=_0x3b44a0-0x0;var _0x359a80=_0xc02d[_0x3b44a0];return _0x359a80;};'use strict';var multer=require('multer');var util=require(_0xdc02('0x0'));var path=require(_0xdc02('0x1'));var timeout=require(_0xdc02('0x2'));var express=require(_0xdc02('0x3'));var router=express[_0xdc02('0x4')]();var fs_extra=require(_0xdc02('0x5'));var auth=require(_0xdc02('0x6'));var interaction=require(_0xdc02('0x7'));var config=require(_0xdc02('0x8'));var controller=require(_0xdc02('0x9'));router[_0xdc02('0xa')]('/',auth['isAuthenticated'](),controller[_0xdc02('0xb')]);router[_0xdc02('0xa')](_0xdc02('0xc'),auth[_0xdc02('0xd')](),controller['show']);router['post']('/',auth[_0xdc02('0xd')](),controller[_0xdc02('0xe')]);router[_0xdc02('0xf')]('/:id',auth[_0xdc02('0xd')](),controller['update']);router[_0xdc02('0x10')](_0xdc02('0xc'),auth[_0xdc02('0xd')](),controller[_0xdc02('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 94596d9..712108c 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 _0x1cb9=['name','sequelize','STRING'];(function(_0xe565cb,_0x6fba9b){var _0xc32bf5=function(_0x5e3879){while(--_0x5e3879){_0xe565cb['push'](_0xe565cb['shift']());}};_0xc32bf5(++_0x6fba9b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x339846,_0x2ace54){_0x339846=_0x339846-0x0;var _0x226bfe=_0x1cb9[_0x339846];return _0x226bfe;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'unique':_0x91cb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91cb('0x1')]}}; \ No newline at end of file +var _0x09f1=['exports','name','STRING','sequelize'];(function(_0x21b99d,_0x46fbc9){var _0x31335a=function(_0x3985a8){while(--_0x3985a8){_0x21b99d['push'](_0x21b99d['shift']());}};_0x31335a(++_0x46fbc9);}(_0x09f1,0xbf));var _0x109f=function(_0x155fdf,_0x4e743c){_0x155fdf=_0x155fdf-0x0;var _0x31a9a1=_0x09f1[_0x155fdf];return _0x31a9a1;};'use strict';var Sequelize=require(_0x109f('0x0'));module[_0x109f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x109f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x109f('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f5fc8f9..1a04878 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 _0x0bee=['../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x3b8597,_0x39514f){var _0x26e9e5=function(_0x36b171){while(--_0x36b171){_0x3b8597['push'](_0x3b8597['shift']());}};_0x26e9e5(++_0x39514f);}(_0x0bee,0x129));var _0xe0be=function(_0x47cd62,_0x56180e){_0x47cd62=_0x47cd62-0x0;var _0x1749cc=_0x0bee[_0x47cd62];return _0x1749cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0be('0x1'));var rp=require('request-promise');var moment=require(_0xe0be('0x2'));var BPromise=require(_0xe0be('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe0be('0x4'));var sox=require('sox');var csv=require(_0xe0be('0x5'));var ejs=require(_0xe0be('0x6'));var fs=require('fs');var fs_extra=require(_0xe0be('0x7'));var _=require('lodash');var squel=require(_0xe0be('0x8'));var crypto=require(_0xe0be('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe0be('0xa'));var toCsv=require(_0xe0be('0x5'));var querystring=require(_0xe0be('0xb'));var Papa=require('papaparse');var Redis=require(_0xe0be('0xc'));var authService=require(_0xe0be('0xd'));var qs=require(_0xe0be('0xe'));var as=require(_0xe0be('0xf'));var hardwareService=require(_0xe0be('0x10'));var logger=require(_0xe0be('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe0be('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0be('0x13'))['db'];function respondWithStatusCode(_0x30eadf,_0x244fbf){_0x244fbf=_0x244fbf||0xcc;return function(_0x42b991){if(_0x42b991){return _0x30eadf[_0xe0be('0x14')](_0x244fbf);}return _0x30eadf['status'](_0x244fbf)[_0xe0be('0x15')]();};}function respondWithResult(_0x49c77d,_0x56ed67){_0x56ed67=_0x56ed67||0xc8;return function(_0x495526){if(_0x495526){return _0x49c77d['status'](_0x56ed67)[_0xe0be('0x16')](_0x495526);}};}function respondWithFilteredResult(_0x447ea8,_0x5c3caa){return function(_0xce2035){if(_0xce2035){var _0x4f216b=typeof _0x5c3caa[_0xe0be('0x17')]==='undefined'&&typeof _0x5c3caa[_0xe0be('0x18')]===_0xe0be('0x19');var _0x33f690=_0xce2035['count'];var _0x4c82e7=_0x4f216b?0x0:_0x5c3caa[_0xe0be('0x17')];var _0x82359f=_0x4f216b?_0xce2035[_0xe0be('0x1a')]:_0x5c3caa['offset']+_0x5c3caa[_0xe0be('0x18')];var _0x23041c;if(_0x82359f>=_0x33f690){_0x82359f=_0x33f690;_0x23041c=0xc8;}else{_0x23041c=0xce;}_0x447ea8[_0xe0be('0x1b')](_0x23041c);return _0x447ea8['set'](_0xe0be('0x1c'),_0x4c82e7+'-'+_0x82359f+'/'+_0x33f690)[_0xe0be('0x16')](_0xce2035);}return null;};}function patchUpdates(_0x4f231e){return function(_0x5c3619){try{jsonpatch[_0xe0be('0x1d')](_0x5c3619,_0x4f231e,!![]);}catch(_0x4b0613){return BPromise['reject'](_0x4b0613);}return _0x5c3619[_0xe0be('0x1e')]();};}function saveUpdates(_0x752e12,_0x46a954){return function(_0x26a207){if(_0x26a207){return _0x26a207[_0xe0be('0x1f')](_0x752e12)[_0xe0be('0x20')](function(_0xbefa07){return _0xbefa07;});}return null;};}function removeEntity(_0x59a686,_0x1d4197){return function(_0xc31f56){if(_0xc31f56){return _0xc31f56[_0xe0be('0x21')]()[_0xe0be('0x20')](function(){var _0x4df80f=_0xc31f56[_0xe0be('0x22')]({'plain':!![]});var _0x1cf3c2=_0xe0be('0x23');return db[_0xe0be('0x24')][_0xe0be('0x21')]({'where':{'type':_0x1cf3c2,'resourceId':_0x4df80f['id']}})[_0xe0be('0x20')](function(){return _0xc31f56;});})[_0xe0be('0x20')](function(){_0x59a686['status'](0xcc)[_0xe0be('0x15')]();});}};}function handleEntityNotFound(_0x2c914b,_0x4289a9){return function(_0x2e7f56){if(!_0x2e7f56){_0x2c914b[_0xe0be('0x14')](0x194);}return _0x2e7f56;};}function handleError(_0x58b9d9,_0x1b3933){_0x1b3933=_0x1b3933||0x1f4;return function(_0x46ab40){logger[_0xe0be('0x25')](_0x46ab40['stack']);if(_0x46ab40[_0xe0be('0x26')]){delete _0x46ab40[_0xe0be('0x26')];}_0x58b9d9['status'](_0x1b3933)[_0xe0be('0x27')](_0x46ab40);};}exports[_0xe0be('0x28')]=function(_0x5dbd70,_0x138b60){var _0x51e94b={},_0xd9a378={},_0x3dda38={'count':0x0,'rows':[]};var _0x4beb96=_[_0xe0be('0x29')](db[_0xe0be('0x2a')][_0xe0be('0x2b')],function(_0x3f3388){return{'name':_0x3f3388[_0xe0be('0x2c')],'type':_0x3f3388[_0xe0be('0x2d')][_0xe0be('0x2e')]};});_0xd9a378[_0xe0be('0x2f')]=_[_0xe0be('0x29')](_0x4beb96,'name');_0xd9a378['query']=_[_0xe0be('0x30')](_0x5dbd70[_0xe0be('0x31')]);_0xd9a378[_0xe0be('0x32')]=_['intersection'](_0xd9a378['model'],_0xd9a378[_0xe0be('0x31')]);_0x51e94b['attributes']=_[_0xe0be('0x33')](_0xd9a378['model'],qs[_0xe0be('0x34')](_0x5dbd70[_0xe0be('0x31')][_0xe0be('0x34')]));_0x51e94b[_0xe0be('0x35')]=_0x51e94b[_0xe0be('0x35')][_0xe0be('0x36')]?_0x51e94b[_0xe0be('0x35')]:_0xd9a378[_0xe0be('0x2f')];if(!_0x5dbd70[_0xe0be('0x31')][_0xe0be('0x37')]('nolimit')){_0x51e94b['limit']=qs[_0xe0be('0x18')](_0x5dbd70[_0xe0be('0x31')][_0xe0be('0x18')]);_0x51e94b[_0xe0be('0x17')]=qs[_0xe0be('0x17')](_0x5dbd70[_0xe0be('0x31')][_0xe0be('0x17')]);}_0x51e94b[_0xe0be('0x38')]=qs[_0xe0be('0x39')](_0x5dbd70['query'][_0xe0be('0x39')]);_0x51e94b[_0xe0be('0x3a')]=qs[_0xe0be('0x32')](_[_0xe0be('0x3b')](_0x5dbd70['query'],_0xd9a378[_0xe0be('0x32')]),_0x4beb96);if(_0x5dbd70[_0xe0be('0x31')][_0xe0be('0x3c')]){_0x51e94b[_0xe0be('0x3a')]=_[_0xe0be('0x3d')](_0x51e94b['where'],{'$or':_[_0xe0be('0x29')](_0x4beb96,function(_0x1d324d){if(_0x1d324d[_0xe0be('0x2d')]!==_0xe0be('0x3e')){var _0x282e9c={};_0x282e9c[_0x1d324d[_0xe0be('0x26')]]={'$like':'%'+_0x5dbd70[_0xe0be('0x31')]['filter']+'%'};return _0x282e9c;}})});}_0x51e94b=_['merge']({},_0x51e94b,_0x5dbd70[_0xe0be('0x3f')]);var _0x53b39d={'where':_0x51e94b['where']};return db[_0xe0be('0x2a')]['count'](_0x53b39d)['then'](function(_0x5efdcc){_0x3dda38['count']=_0x5efdcc;if(_0x5dbd70[_0xe0be('0x31')][_0xe0be('0x40')]){_0x51e94b[_0xe0be('0x41')]=[{'all':!![]}];}return db[_0xe0be('0x2a')]['findAll'](_0x51e94b);})['then'](function(_0x4291be){_0x3dda38[_0xe0be('0x42')]=_0x4291be;return _0x3dda38;})['then'](respondWithFilteredResult(_0x138b60,_0x51e94b))[_0xe0be('0x43')](handleError(_0x138b60,null));};exports[_0xe0be('0x44')]=function(_0x5f2fc1,_0x27757f){var _0x385ad4={'raw':!![],'where':{'id':_0x5f2fc1[_0xe0be('0x45')]['id']}},_0x2fad53={};_0x2fad53[_0xe0be('0x2f')]=_[_0xe0be('0x30')](db['Variable'][_0xe0be('0x2b')]);_0x2fad53[_0xe0be('0x31')]=_[_0xe0be('0x30')](_0x5f2fc1['query']);_0x2fad53['filters']=_[_0xe0be('0x33')](_0x2fad53[_0xe0be('0x2f')],_0x2fad53[_0xe0be('0x31')]);_0x385ad4['attributes']=_['intersection'](_0x2fad53['model'],qs[_0xe0be('0x34')](_0x5f2fc1['query']['fields']));_0x385ad4[_0xe0be('0x35')]=_0x385ad4[_0xe0be('0x35')][_0xe0be('0x36')]?_0x385ad4[_0xe0be('0x35')]:_0x2fad53[_0xe0be('0x2f')];if(_0x5f2fc1[_0xe0be('0x31')][_0xe0be('0x40')]){_0x385ad4[_0xe0be('0x41')]=[{'all':!![]}];}_0x385ad4=_[_0xe0be('0x3d')]({},_0x385ad4,_0x5f2fc1[_0xe0be('0x3f')]);return db[_0xe0be('0x2a')][_0xe0be('0x46')](_0x385ad4)[_0xe0be('0x20')](handleEntityNotFound(_0x27757f,null))[_0xe0be('0x20')](respondWithResult(_0x27757f,null))[_0xe0be('0x43')](handleError(_0x27757f,null));};exports[_0xe0be('0x47')]=function(_0x145ae0,_0x2af1eb){return db[_0xe0be('0x2a')][_0xe0be('0x47')](_0x145ae0[_0xe0be('0x48')],{})[_0xe0be('0x20')](function(_0x4de991){var _0x30ce3a=_0x145ae0[_0xe0be('0x49')]['get']({'plain':!![]});if(!_0x30ce3a)throw new Error(_0xe0be('0x4a'));if(_0x30ce3a[_0xe0be('0x4b')]===_0xe0be('0x49')){var _0x55ffdf=_0x4de991[_0xe0be('0x22')]({'plain':!![]});var _0x5a6c12='Variables';return db[_0xe0be('0x4c')][_0xe0be('0x46')]({'where':{'name':_0x5a6c12,'userProfileId':_0x30ce3a['userProfileId']},'raw':!![]})[_0xe0be('0x20')](function(_0x493a56){if(_0x493a56&&_0x493a56[_0xe0be('0x4d')]===0x0){return db[_0xe0be('0x24')]['create']({'name':_0x55ffdf[_0xe0be('0x26')],'resourceId':_0x55ffdf['id'],'type':_0x493a56[_0xe0be('0x26')],'sectionId':_0x493a56['id']},{})[_0xe0be('0x20')](function(){return _0x4de991;});}else{return _0x4de991;}})[_0xe0be('0x43')](function(_0x12a636){logger[_0xe0be('0x25')](_0xe0be('0x4e'),_0x12a636);throw _0x12a636;});}return _0x4de991;})['then'](respondWithResult(_0x2af1eb,0xc9))[_0xe0be('0x43')](handleError(_0x2af1eb,null));};exports['update']=function(_0x1011ed,_0x523656){if(_0x1011ed[_0xe0be('0x48')]['id']){delete _0x1011ed[_0xe0be('0x48')]['id'];}return db[_0xe0be('0x2a')][_0xe0be('0x46')]({'where':{'id':_0x1011ed['params']['id']}})[_0xe0be('0x20')](handleEntityNotFound(_0x523656,null))[_0xe0be('0x20')](saveUpdates(_0x1011ed['body'],null))[_0xe0be('0x20')](respondWithResult(_0x523656,null))['catch'](handleError(_0x523656,null));};exports[_0xe0be('0x21')]=function(_0x56c499,_0x2d1008){return db['Variable'][_0xe0be('0x46')]({'where':{'id':_0x56c499[_0xe0be('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d1008,null))['then'](removeEntity(_0x2d1008,null))[_0xe0be('0x43')](handleError(_0x2d1008,null));}; \ No newline at end of file +var _0xe38c=['includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','offset','undefined','limit','count','status','Content-Range','json','reject','save','update','destroy','then','get','UserProfileResource','end','error','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0xe38c,0x19f));var _0xce38=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xe38c[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xce38('0x0'));var rimraf=require(_0xce38('0x1'));var zipdir=require(_0xce38('0x2'));var jsonpatch=require(_0xce38('0x3'));var rp=require(_0xce38('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xce38('0x5'));var util=require(_0xce38('0x6'));var path=require(_0xce38('0x7'));var sox=require(_0xce38('0x8'));var csv=require(_0xce38('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce38('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xce38('0xb'));var deskjs=require(_0xce38('0xc'));var toCsv=require(_0xce38('0x9'));var querystring=require(_0xce38('0xd'));var Papa=require(_0xce38('0xe'));var Redis=require(_0xce38('0xf'));var authService=require(_0xce38('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xce38('0x11'));var hardwareService=require(_0xce38('0x12'));var logger=require(_0xce38('0x13'))(_0xce38('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xce38('0x15'));var db=require(_0xce38('0x16'))['db'];function respondWithStatusCode(_0x21d0d0,_0x523c73){_0x523c73=_0x523c73||0xcc;return function(_0x2bef61){if(_0x2bef61){return _0x21d0d0['sendStatus'](_0x523c73);}return _0x21d0d0['status'](_0x523c73)['end']();};}function respondWithResult(_0x4c8fbe,_0xd5a6ce){_0xd5a6ce=_0xd5a6ce||0xc8;return function(_0x5dd50d){if(_0x5dd50d){return _0x4c8fbe['status'](_0xd5a6ce)['json'](_0x5dd50d);}};}function respondWithFilteredResult(_0x1ac18b,_0x461957){return function(_0x360ebe){if(_0x360ebe){var _0xd3c0ab=typeof _0x461957[_0xce38('0x17')]===_0xce38('0x18')&&typeof _0x461957[_0xce38('0x19')]===_0xce38('0x18');var _0xefa76c=_0x360ebe[_0xce38('0x1a')];var _0xb3aae2=_0xd3c0ab?0x0:_0x461957['offset'];var _0x11bfc6=_0xd3c0ab?_0x360ebe[_0xce38('0x1a')]:_0x461957[_0xce38('0x17')]+_0x461957[_0xce38('0x19')];var _0x19cf73;if(_0x11bfc6>=_0xefa76c){_0x11bfc6=_0xefa76c;_0x19cf73=0xc8;}else{_0x19cf73=0xce;}_0x1ac18b[_0xce38('0x1b')](_0x19cf73);return _0x1ac18b['set'](_0xce38('0x1c'),_0xb3aae2+'-'+_0x11bfc6+'/'+_0xefa76c)[_0xce38('0x1d')](_0x360ebe);}return null;};}function patchUpdates(_0xe28ffd){return function(_0x50084f){try{jsonpatch['apply'](_0x50084f,_0xe28ffd,!![]);}catch(_0x2b0f69){return BPromise[_0xce38('0x1e')](_0x2b0f69);}return _0x50084f[_0xce38('0x1f')]();};}function saveUpdates(_0x417542,_0x8a0c40){return function(_0x16e851){if(_0x16e851){return _0x16e851[_0xce38('0x20')](_0x417542)['then'](function(_0x5b4205){return _0x5b4205;});}return null;};}function removeEntity(_0x2bccb9,_0x4860b1){return function(_0x43ddd3){if(_0x43ddd3){return _0x43ddd3[_0xce38('0x21')]()[_0xce38('0x22')](function(){var _0x248952=_0x43ddd3[_0xce38('0x23')]({'plain':!![]});var _0x26279b='Variables';return db[_0xce38('0x24')][_0xce38('0x21')]({'where':{'type':_0x26279b,'resourceId':_0x248952['id']}})[_0xce38('0x22')](function(){return _0x43ddd3;});})[_0xce38('0x22')](function(){_0x2bccb9[_0xce38('0x1b')](0xcc)[_0xce38('0x25')]();});}};}function handleEntityNotFound(_0xcd3856,_0x52fb83){return function(_0x2d45b9){if(!_0x2d45b9){_0xcd3856['sendStatus'](0x194);}return _0x2d45b9;};}function handleError(_0x30b5f5,_0x462889){_0x462889=_0x462889||0x1f4;return function(_0x10a3e3){logger[_0xce38('0x26')](_0x10a3e3['stack']);if(_0x10a3e3[_0xce38('0x27')]){delete _0x10a3e3[_0xce38('0x27')];}_0x30b5f5['status'](_0x462889)[_0xce38('0x28')](_0x10a3e3);};}exports[_0xce38('0x29')]=function(_0x153d4f,_0x55beda){var _0x40117e={},_0x21983a={},_0x3d714b={'count':0x0,'rows':[]};var _0x453dc2=_[_0xce38('0x2a')](db[_0xce38('0x2b')][_0xce38('0x2c')],function(_0x435f8d){return{'name':_0x435f8d[_0xce38('0x2d')],'type':_0x435f8d[_0xce38('0x2e')][_0xce38('0x2f')]};});_0x21983a[_0xce38('0x30')]=_[_0xce38('0x2a')](_0x453dc2,_0xce38('0x27'));_0x21983a[_0xce38('0x31')]=_[_0xce38('0x32')](_0x153d4f['query']);_0x21983a[_0xce38('0x33')]=_['intersection'](_0x21983a['model'],_0x21983a[_0xce38('0x31')]);_0x40117e[_0xce38('0x34')]=_[_0xce38('0x35')](_0x21983a['model'],qs['fields'](_0x153d4f['query'][_0xce38('0x36')]));_0x40117e[_0xce38('0x34')]=_0x40117e[_0xce38('0x34')][_0xce38('0x37')]?_0x40117e[_0xce38('0x34')]:_0x21983a['model'];if(!_0x153d4f[_0xce38('0x31')][_0xce38('0x38')]('nolimit')){_0x40117e[_0xce38('0x19')]=qs['limit'](_0x153d4f[_0xce38('0x31')][_0xce38('0x19')]);_0x40117e[_0xce38('0x17')]=qs[_0xce38('0x17')](_0x153d4f[_0xce38('0x31')][_0xce38('0x17')]);}_0x40117e[_0xce38('0x39')]=qs[_0xce38('0x3a')](_0x153d4f['query'][_0xce38('0x3a')]);_0x40117e['where']=qs[_0xce38('0x33')](_[_0xce38('0x3b')](_0x153d4f['query'],_0x21983a[_0xce38('0x33')]),_0x453dc2);if(_0x153d4f[_0xce38('0x31')][_0xce38('0x3c')]){_0x40117e[_0xce38('0x3d')]=_['merge'](_0x40117e[_0xce38('0x3d')],{'$or':_[_0xce38('0x2a')](_0x453dc2,function(_0x3b3ebe){if(_0x3b3ebe[_0xce38('0x2e')]!==_0xce38('0x3e')){var _0x424d7b={};_0x424d7b[_0x3b3ebe[_0xce38('0x27')]]={'$like':'%'+_0x153d4f['query'][_0xce38('0x3c')]+'%'};return _0x424d7b;}})});}_0x40117e=_[_0xce38('0x3f')]({},_0x40117e,_0x153d4f[_0xce38('0x40')]);var _0x2f5576={'where':_0x40117e[_0xce38('0x3d')]};return db[_0xce38('0x2b')][_0xce38('0x1a')](_0x2f5576)['then'](function(_0x27a894){_0x3d714b['count']=_0x27a894;if(_0x153d4f['query'][_0xce38('0x41')]){_0x40117e[_0xce38('0x42')]=[{'all':!![]}];}return db[_0xce38('0x2b')]['findAll'](_0x40117e);})[_0xce38('0x22')](function(_0x3e1300){_0x3d714b[_0xce38('0x43')]=_0x3e1300;return _0x3d714b;})[_0xce38('0x22')](respondWithFilteredResult(_0x55beda,_0x40117e))[_0xce38('0x44')](handleError(_0x55beda,null));};exports[_0xce38('0x45')]=function(_0x221028,_0x2dd0ed){var _0x576a07={'raw':!![],'where':{'id':_0x221028[_0xce38('0x46')]['id']}},_0x2f8378={};_0x2f8378[_0xce38('0x30')]=_['keys'](db[_0xce38('0x2b')][_0xce38('0x2c')]);_0x2f8378[_0xce38('0x31')]=_['keys'](_0x221028[_0xce38('0x31')]);_0x2f8378[_0xce38('0x33')]=_[_0xce38('0x35')](_0x2f8378[_0xce38('0x30')],_0x2f8378[_0xce38('0x31')]);_0x576a07[_0xce38('0x34')]=_['intersection'](_0x2f8378[_0xce38('0x30')],qs['fields'](_0x221028[_0xce38('0x31')][_0xce38('0x36')]));_0x576a07['attributes']=_0x576a07['attributes'][_0xce38('0x37')]?_0x576a07[_0xce38('0x34')]:_0x2f8378[_0xce38('0x30')];if(_0x221028[_0xce38('0x31')]['includeAll']){_0x576a07[_0xce38('0x42')]=[{'all':!![]}];}_0x576a07=_[_0xce38('0x3f')]({},_0x576a07,_0x221028['options']);return db['Variable'][_0xce38('0x47')](_0x576a07)['then'](handleEntityNotFound(_0x2dd0ed,null))[_0xce38('0x22')](respondWithResult(_0x2dd0ed,null))['catch'](handleError(_0x2dd0ed,null));};exports[_0xce38('0x48')]=function(_0x567a60,_0xcf5a6f){return db['Variable'][_0xce38('0x48')](_0x567a60[_0xce38('0x49')],{})[_0xce38('0x22')](function(_0x4c56e7){var _0x42aa58=_0x567a60['user']['get']({'plain':!![]});if(!_0x42aa58)throw new Error(_0xce38('0x4a'));if(_0x42aa58[_0xce38('0x4b')]===_0xce38('0x4c')){var _0x39f88a=_0x4c56e7[_0xce38('0x23')]({'plain':!![]});var _0x1f09d3='Variables';return db[_0xce38('0x4d')]['find']({'where':{'name':_0x1f09d3,'userProfileId':_0x42aa58['userProfileId']},'raw':!![]})[_0xce38('0x22')](function(_0x306e45){if(_0x306e45&&_0x306e45[_0xce38('0x4e')]===0x0){return db[_0xce38('0x24')][_0xce38('0x48')]({'name':_0x39f88a[_0xce38('0x27')],'resourceId':_0x39f88a['id'],'type':_0x306e45[_0xce38('0x27')],'sectionId':_0x306e45['id']},{})['then'](function(){return _0x4c56e7;});}else{return _0x4c56e7;}})[_0xce38('0x44')](function(_0x2f8ec8){logger[_0xce38('0x26')](_0xce38('0x4f'),_0x2f8ec8);throw _0x2f8ec8;});}return _0x4c56e7;})['then'](respondWithResult(_0xcf5a6f,0xc9))[_0xce38('0x44')](handleError(_0xcf5a6f,null));};exports['update']=function(_0x52410b,_0x3735d1){if(_0x52410b['body']['id']){delete _0x52410b[_0xce38('0x49')]['id'];}return db[_0xce38('0x2b')][_0xce38('0x47')]({'where':{'id':_0x52410b['params']['id']}})[_0xce38('0x22')](handleEntityNotFound(_0x3735d1,null))[_0xce38('0x22')](saveUpdates(_0x52410b[_0xce38('0x49')],null))[_0xce38('0x22')](respondWithResult(_0x3735d1,null))[_0xce38('0x44')](handleError(_0x3735d1,null));};exports[_0xce38('0x21')]=function(_0x10cc91,_0x8987af){return db[_0xce38('0x2b')][_0xce38('0x47')]({'where':{'id':_0x10cc91[_0xce38('0x46')]['id']}})['then'](handleEntityNotFound(_0x8987af,null))[_0xce38('0x22')](removeEntity(_0x8987af,null))[_0xce38('0x44')](handleError(_0x8987af,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 6a9eacc..be9baba 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 _0xe9ac=['path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4d63c1,_0x15c55c){var _0x49a14b=function(_0x52f49d){while(--_0x52f49d){_0x4d63c1['push'](_0x4d63c1['shift']());}};_0x49a14b(++_0x15c55c);}(_0xe9ac,0x1b4));var _0xce9a=function(_0x3d03f5,_0x34747b){_0x3d03f5=_0x3d03f5-0x0;var _0x4bcb72=_0xe9ac[_0x3d03f5];return _0x4bcb72;};'use strict';var _=require(_0xce9a('0x0'));var util=require(_0xce9a('0x1'));var logger=require(_0xce9a('0x2'))(_0xce9a('0x3'));var moment=require('moment');var BPromise=require(_0xce9a('0x4'));var rp=require(_0xce9a('0x5'));var fs=require('fs');var path=require(_0xce9a('0x6'));var rimraf=require(_0xce9a('0x7'));var config=require(_0xce9a('0x8'));var attributes=require(_0xce9a('0x9'));module[_0xce9a('0xa')]=function(_0x4c0ad1,_0x5a4ee6){return _0x4c0ad1[_0xce9a('0xb')]('Variable',attributes,{'tableName':_0xce9a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x390f=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','Variable','tools_variables'];(function(_0x2f9625,_0x4efdd8){var _0x56e181=function(_0x1e2151){while(--_0x1e2151){_0x2f9625['push'](_0x2f9625['shift']());}};_0x56e181(++_0x4efdd8);}(_0x390f,0x1c3));var _0xf390=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x390f[_0xed9fea];return _0x198f12;};'use strict';var _=require(_0xf390('0x0'));var util=require(_0xf390('0x1'));var logger=require(_0xf390('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf390('0x3'));var rp=require(_0xf390('0x4'));var fs=require('fs');var path=require(_0xf390('0x5'));var rimraf=require(_0xf390('0x6'));var config=require(_0xf390('0x7'));var attributes=require('./variable.attributes');module['exports']=function(_0x571245,_0x384afa){return _0x571245[_0xf390('0x8')](_0xf390('0x9'),attributes,{'tableName':_0xf390('0xa'),'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 c8b9fb7..3d2a0d6 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 _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(_0x1dc1ea,_0x44ab67){var _0x44e0e2=function(_0x415548){while(--_0x415548){_0x1dc1ea['push'](_0x1dc1ea['shift']());}};_0x44e0e2(++_0x44ab67);}(_0x55ca,0x126));var _0xa55c=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0x55ca[_0x11ec6c];return _0xb59506;};'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 +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x28c6a2,_0x295b05){var _0x593dc9=function(_0x2cb32d){while(--_0x2cb32d){_0x28c6a2['push'](_0x28c6a2['shift']());}};_0x593dc9(++_0x295b05);}(_0xabce,0x103));var _0xeabc=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xabce[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 82d0b51..9f2eee4 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 _0x9e8a=['index','/fetch','isAuthenticated','canUpdate','fetch','/pull','restart','/migrations','express','../../components/auth/service','./version.controller','get'];(function(_0x4d6efb,_0x30d83c){var _0x35d839=function(_0x5ade95){while(--_0x5ade95){_0x4d6efb['push'](_0x4d6efb['shift']());}};_0x35d839(++_0x30d83c);}(_0x9e8a,0x74));var _0xa9e8=function(_0x505772,_0x479e52){_0x505772=_0x505772-0x0;var _0x522a67=_0x9e8a[_0x505772];return _0x522a67;};'use strict';var express=require(_0xa9e8('0x0'));var router=express['Router']();var auth=require(_0xa9e8('0x1'));var controller=require(_0xa9e8('0x2'));router[_0xa9e8('0x3')]('/',controller[_0xa9e8('0x4')]);router[_0xa9e8('0x3')](_0xa9e8('0x5'),auth[_0xa9e8('0x6')](),auth[_0xa9e8('0x7')](),controller[_0xa9e8('0x8')]);router[_0xa9e8('0x3')]('/reset',auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router['get'](_0xa9e8('0x9'),auth['isAuthenticated'](),auth[_0xa9e8('0x7')](),controller['pull']);router[_0xa9e8('0x3')]('/restart',auth[_0xa9e8('0x6')](),controller[_0xa9e8('0xa')]);router[_0xa9e8('0x3')](_0xa9e8('0xb'),controller['migrations']);module['exports']=router; \ No newline at end of file +var _0x636f=['./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','/restart','restart','migrations','exports','../../components/auth/service'];(function(_0x49a02a,_0x6d46e9){var _0x172807=function(_0x4c1f1f){while(--_0x4c1f1f){_0x49a02a['push'](_0x49a02a['shift']());}};_0x172807(++_0x6d46e9);}(_0x636f,0xa8));var _0xf636=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x636f[_0x397e5f];return _0x5302b8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf636('0x0'));var controller=require(_0xf636('0x1'));router[_0xf636('0x2')]('/',controller['index']);router['get'](_0xf636('0x3'),auth[_0xf636('0x4')](),auth[_0xf636('0x5')](),controller[_0xf636('0x6')]);router['get']('/reset',auth['isAuthenticated'](),auth[_0xf636('0x5')](),controller[_0xf636('0x7')]);router[_0xf636('0x2')](_0xf636('0x8'),auth[_0xf636('0x4')](),auth[_0xf636('0x5')](),controller['pull']);router[_0xf636('0x2')](_0xf636('0x9'),auth[_0xf636('0x4')](),controller[_0xf636('0xa')]);router[_0xf636('0x2')]('/migrations',controller[_0xf636('0xb')]);module[_0xf636('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 309b4cd..4a6be13 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 _0x3ae3=['git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','migrations','readdirSync','replace','.js','length','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','join','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','query','fetch','exports','latest','status','json','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x35e26e,_0x1ba0f1){var _0x34b1eb=function(_0x521cd7){while(--_0x521cd7){_0x35e26e['push'](_0x35e26e['shift']());}};_0x34b1eb(++_0x1ba0f1);}(_0x3ae3,0xa9));var _0x33ae=function(_0x1670bf,_0x4c3293){_0x1670bf=_0x1670bf-0x0;var _0x1891f8=_0x3ae3[_0x1670bf];return _0x1891f8;};'use strict';var Umzug=require(_0x33ae('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x33ae('0x1'));var pkginfo=require('pkginfo')(module,_0x33ae('0x2'));var compareVersions=require(_0x33ae('0x3'));var exec=require(_0x33ae('0x4'))['exec'];var db=require(_0x33ae('0x5'))['db'];var config=require(_0x33ae('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x33ae('0x7'))(_0x33ae('0x8'));var git=require(_0x33ae('0x9'))(config[_0x33ae('0xa')]);exports[_0x33ae('0xb')]=function(_0x12ffbe,_0x487555){var _0x48e771={'current':module['exports']['version'],'phonebar':0x2};if(_0x12ffbe[_0x33ae('0xc')]&&_0x12ffbe[_0x33ae('0xc')]['latest']){return git[_0x33ae('0xd')]()['tags'](function(_0x2d464f,_0x40f395){_0x48e771['latest']=(_0x2d464f?module[_0x33ae('0xe')][_0x33ae('0x2')]:_0x40f395[_0x33ae('0xf')])||'2.0.0';return _0x487555[_0x33ae('0x10')](0xc8)[_0x33ae('0x11')](_0x48e771);});}else{return _0x487555[_0x33ae('0x10')](0xc8)[_0x33ae('0x11')](_0x48e771);}};exports[_0x33ae('0xd')]=function(_0x4bc12b,_0x462ec7){return git[_0x33ae('0xd')](['origin',_0x33ae('0x12')],function(_0x2e76f2){if(_0x2e76f2){logger['error'](_0x2e76f2);return _0x462ec7[_0x33ae('0x10')](0x1f4)[_0x33ae('0x11')](_0x2e76f2);}logger[_0x33ae('0x13')](_0x33ae('0x14'));return _0x462ec7['status'](0xc8)[_0x33ae('0x11')]({'output':_0x33ae('0x15')});});};exports[_0x33ae('0x16')]=function(_0x4d136a,_0x59b09b){return git['reset']([_0x33ae('0x17'),_0x33ae('0x18')],function(_0x5de486){if(_0x5de486){logger[_0x33ae('0x19')](_0x5de486);return _0x59b09b['status'](0x1f4)['json'](_0x5de486);}logger[_0x33ae('0x13')](_0x33ae('0x1a'));return _0x59b09b[_0x33ae('0x10')](0xc8)[_0x33ae('0x11')]({'output':_0x33ae('0x1b')});});};exports['pull']=function(_0xe80c40,_0x247b3c){exec(_0x33ae('0x1c'),function(_0x447ce5,_0x12fcd3,_0x5f0e6e){logger[_0x33ae('0x13')](_0x12fcd3);logger[_0x33ae('0x13')](_0x5f0e6e);if(_0x447ce5){logger[_0x33ae('0x19')](_0x447ce5);return _0x247b3c[_0x33ae('0x10')](0x1f4)['json'](_0x447ce5);}return _0x247b3c[_0x33ae('0x10')](0xc8)[_0x33ae('0x11')]({'output':_0x12fcd3});});};exports[_0x33ae('0x1d')]=function(_0x4ea167,_0x24fbd9){return pm2[_0x33ae('0x1d')](_0x33ae('0x1e'))[_0x33ae('0x1f')](function(_0xd2a7){logger['info'](_0x33ae('0x20'),_0xd2a7);return _0x24fbd9[_0x33ae('0x10')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x5e10e6){logger[_0x33ae('0x19')](_0x5e10e6);return _0x24fbd9['status'](0x1f4)['json'](_0x5e10e6);});};exports[_0x33ae('0x21')]=function(_0x45a80f,_0x112c80){var _0x50dbab=fs[_0x33ae('0x22')](path['join'](config[_0x33ae('0xa')],'server',_0x33ae('0x21')));var _0x2c0fbf=[];for(var _0x5b102a=0x0;_0x5b102a<_0x50dbab['length'];_0x5b102a++){var _0x30e23a=_0x50dbab[_0x5b102a][_0x33ae('0x23')](_0x33ae('0x24'),'');if(compareVersions(module[_0x33ae('0xe')][_0x33ae('0x2')],_0x30e23a)===-0x1){_0x2c0fbf['push'](_0x30e23a);}}if(_0x2c0fbf[_0x33ae('0x25')]){var _0xc9feff=_0x2c0fbf[_0x33ae('0x26')](compareVersions);var _0x328ef0=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x33ae('0x27')],'modelName':_0x33ae('0x27'),'columnName':_0x33ae('0x2')},'migrations':{'params':[db[_0x33ae('0x28')][_0x33ae('0x29')](),db['sequelize'][_0x33ae('0x2a')],function(){throw new Error(_0x33ae('0x2b'));}],'path':path['join'](config[_0x33ae('0xa')],'server',_0x33ae('0x21')),'pattern':/\.js$/}});_0x328ef0['up']({'migrations':_[_0x33ae('0x2c')](_0xc9feff,function(_0x372110){return _0x372110+_0x33ae('0x24');})})[_0x33ae('0x1f')](function(){return _0x112c80[_0x33ae('0x10')](0xc8)[_0x33ae('0x11')]({'output':_0x33ae('0x2d')+module[_0x33ae('0xe')]['version']+'\x20to\x20'+_[_0x33ae('0x2e')](_0xc9feff),'migrations':_[_0x33ae('0x2f')](_0xc9feff)});})['catch'](function(_0x160c2d){if(_0x160c2d instanceof db['sequelize']['UniqueConstraintError']){return _0x112c80['status'](0xc8)['json']({'output':_0x33ae('0x30')});}else{return _0x112c80[_0x33ae('0x10')](0x1f4)['json'](_0x160c2d);}});}else{return _0x112c80[_0x33ae('0x10')](0xc8)['json']({'output':_0x33ae('0x30')});}}; \ No newline at end of file +var _0xdbb6=['Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','simple-git','root','query','latest','fetch','tags','exports','2.0.0','json','status','origin','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','push','sort','sequelize'];(function(_0x41c793,_0x393a99){var _0x40cd60=function(_0xe0b0bb){while(--_0xe0b0bb){_0x41c793['push'](_0x41c793['shift']());}};_0x40cd60(++_0x393a99);}(_0xdbb6,0x116));var _0x6dbb=function(_0x422016,_0x2c2dcc){_0x422016=_0x422016-0x0;var _0x17a7d7=_0xdbb6[_0x422016];return _0x17a7d7;};'use strict';var Umzug=require(_0x6dbb('0x0'));var path=require(_0x6dbb('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6dbb('0x2'))(module,_0x6dbb('0x3'));var compareVersions=require(_0x6dbb('0x4'));var exec=require(_0x6dbb('0x5'))[_0x6dbb('0x6')];var db=require(_0x6dbb('0x7'))['db'];var config=require(_0x6dbb('0x8'));var pm2=require(_0x6dbb('0x9'));var logger=require('../../config/logger')('update');var git=require(_0x6dbb('0xa'))(config[_0x6dbb('0xb')]);exports['index']=function(_0x5b9164,_0x454f6e){var _0x2c9c9d={'current':module['exports'][_0x6dbb('0x3')],'phonebar':0x2};if(_0x5b9164[_0x6dbb('0xc')]&&_0x5b9164[_0x6dbb('0xc')][_0x6dbb('0xd')]){return git[_0x6dbb('0xe')]()[_0x6dbb('0xf')](function(_0xd0dabe,_0x7469d4){_0x2c9c9d[_0x6dbb('0xd')]=(_0xd0dabe?module[_0x6dbb('0x10')][_0x6dbb('0x3')]:_0x7469d4[_0x6dbb('0xd')])||_0x6dbb('0x11');return _0x454f6e['status'](0xc8)[_0x6dbb('0x12')](_0x2c9c9d);});}else{return _0x454f6e[_0x6dbb('0x13')](0xc8)[_0x6dbb('0x12')](_0x2c9c9d);}};exports[_0x6dbb('0xe')]=function(_0x340761,_0x5bd645){return git[_0x6dbb('0xe')]([_0x6dbb('0x14'),'master'],function(_0x43de9e){if(_0x43de9e){logger[_0x6dbb('0x15')](_0x43de9e);return _0x5bd645['status'](0x1f4)['json'](_0x43de9e);}logger[_0x6dbb('0x16')]('git\x20fetch');return _0x5bd645[_0x6dbb('0x13')](0xc8)[_0x6dbb('0x12')]({'output':_0x6dbb('0x17')});});};exports[_0x6dbb('0x18')]=function(_0xcbb9d9,_0x26d751){return git['reset']([_0x6dbb('0x19'),_0x6dbb('0x1a')],function(_0x173873){if(_0x173873){logger[_0x6dbb('0x15')](_0x173873);return _0x26d751[_0x6dbb('0x13')](0x1f4)[_0x6dbb('0x12')](_0x173873);}logger['info'](_0x6dbb('0x1b'));return _0x26d751['status'](0xc8)[_0x6dbb('0x12')]({'output':_0x6dbb('0x1c')});});};exports[_0x6dbb('0x1d')]=function(_0xfcd5d8,_0x18c9cd){exec(_0x6dbb('0x1e'),function(_0x2daae4,_0x1a6f27,_0x42d281){logger[_0x6dbb('0x16')](_0x1a6f27);logger[_0x6dbb('0x16')](_0x42d281);if(_0x2daae4){logger[_0x6dbb('0x15')](_0x2daae4);return _0x18c9cd['status'](0x1f4)[_0x6dbb('0x12')](_0x2daae4);}return _0x18c9cd[_0x6dbb('0x13')](0xc8)[_0x6dbb('0x12')]({'output':_0x1a6f27});});};exports['restart']=function(_0x130d6d,_0x130b9a){return pm2[_0x6dbb('0x1f')](_0x6dbb('0x20'))[_0x6dbb('0x21')](function(_0x2eb6e0){logger[_0x6dbb('0x16')]('pm2\x20restart\x20motion\x20%s',_0x2eb6e0);return _0x130b9a[_0x6dbb('0x13')](0xc8)['json']({'output':_0x6dbb('0x22')});})[_0x6dbb('0x23')](function(_0x173808){logger[_0x6dbb('0x15')](_0x173808);return _0x130b9a[_0x6dbb('0x13')](0x1f4)[_0x6dbb('0x12')](_0x173808);});};exports[_0x6dbb('0x24')]=function(_0x58b355,_0x5c0d3a){var _0x48b07c=fs[_0x6dbb('0x25')](path[_0x6dbb('0x26')](config['root'],_0x6dbb('0x27'),_0x6dbb('0x24')));var _0x4dda00=[];for(var _0x1412ee=0x0;_0x1412ee<_0x48b07c[_0x6dbb('0x28')];_0x1412ee++){var _0x5cffeb=_0x48b07c[_0x1412ee][_0x6dbb('0x29')](_0x6dbb('0x2a'),'');if(compareVersions(module[_0x6dbb('0x10')][_0x6dbb('0x3')],_0x5cffeb)===-0x1){_0x4dda00[_0x6dbb('0x2b')](_0x5cffeb);}}if(_0x4dda00[_0x6dbb('0x28')]){var _0x11bf80=_0x4dda00[_0x6dbb('0x2c')](compareVersions);var _0x1f9a72=new Umzug({'storage':_0x6dbb('0x2d'),'storageOptions':{'model':db[_0x6dbb('0x2e')],'modelName':_0x6dbb('0x2e'),'columnName':'version'},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x6dbb('0x2d')][_0x6dbb('0x2f')],function(){throw new Error(_0x6dbb('0x30'));}],'path':path['join'](config[_0x6dbb('0xb')],_0x6dbb('0x27'),_0x6dbb('0x24')),'pattern':/\.js$/}});_0x1f9a72['up']({'migrations':_[_0x6dbb('0x31')](_0x11bf80,function(_0x218461){return _0x218461+'.js';})})[_0x6dbb('0x21')](function(){return _0x5c0d3a[_0x6dbb('0x13')](0xc8)[_0x6dbb('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x6dbb('0x10')]['version']+_0x6dbb('0x32')+_[_0x6dbb('0x33')](_0x11bf80),'migrations':_[_0x6dbb('0x26')](_0x11bf80)});})['catch'](function(_0x58c187){if(_0x58c187 instanceof db['sequelize'][_0x6dbb('0x34')]){return _0x5c0d3a[_0x6dbb('0x13')](0xc8)[_0x6dbb('0x12')]({'output':_0x6dbb('0x35')});}else{return _0x5c0d3a[_0x6dbb('0x13')](0x1f4)[_0x6dbb('0x12')](_0x58c187);}});}else{return _0x5c0d3a[_0x6dbb('0x13')](0xc8)[_0x6dbb('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7776582..03e067b 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 _0xfe64=['/describe','isAuthenticated','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','./voiceAgentReport.controller','index','get'];(function(_0x39c1a7,_0x1f295e){var _0x118c1c=function(_0x355073){while(--_0x355073){_0x39c1a7['push'](_0x39c1a7['shift']());}};_0x118c1c(++_0x1f295e);}(_0xfe64,0x1ee));var _0x4fe6=function(_0x3e2ac1,_0x3f734e){_0x3e2ac1=_0x3e2ac1-0x0;var _0x36ef20=_0xfe64[_0x3e2ac1];return _0x36ef20;};'use strict';var multer=require(_0x4fe6('0x0'));var util=require(_0x4fe6('0x1'));var path=require(_0x4fe6('0x2'));var timeout=require(_0x4fe6('0x3'));var express=require(_0x4fe6('0x4'));var router=express['Router']();var fs_extra=require(_0x4fe6('0x5'));var auth=require(_0x4fe6('0x6'));var interaction=require(_0x4fe6('0x7'));var config=require(_0x4fe6('0x8'));var controller=require(_0x4fe6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4fe6('0xa')]);router[_0x4fe6('0xb')](_0x4fe6('0xc'),auth[_0x4fe6('0xd')](),controller[_0x4fe6('0xe')]);router['get'](_0x4fe6('0xf'),auth[_0x4fe6('0xd')](),controller[_0x4fe6('0x10')]);router[_0x4fe6('0x11')]('/',auth[_0x4fe6('0xd')](),controller[_0x4fe6('0x12')]);router[_0x4fe6('0x13')](_0x4fe6('0xf'),auth[_0x4fe6('0xd')](),controller[_0x4fe6('0x14')]);router[_0x4fe6('0x15')]('/:id',auth[_0x4fe6('0xd')](),controller[_0x4fe6('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb457=['post','create','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x144fab,_0x2b256e){var _0x44dbeb=function(_0x4b29e0){while(--_0x4b29e0){_0x144fab['push'](_0x144fab['shift']());}};_0x44dbeb(++_0x2b256e);}(_0xb457,0x93));var _0x7b45=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb457[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x7b45('0x0'));var util=require(_0x7b45('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b45('0x2')]();var fs_extra=require(_0x7b45('0x3'));var auth=require(_0x7b45('0x4'));var interaction=require(_0x7b45('0x5'));var config=require(_0x7b45('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x7b45('0x7')]('/',auth[_0x7b45('0x8')](),controller[_0x7b45('0x9')]);router[_0x7b45('0x7')](_0x7b45('0xa'),auth[_0x7b45('0x8')](),controller[_0x7b45('0xb')]);router[_0x7b45('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7b45('0xc')]);router[_0x7b45('0xd')]('/',auth[_0x7b45('0x8')](),controller[_0x7b45('0xe')]);router[_0x7b45('0xf')](_0x7b45('0x10'),auth['isAuthenticated'](),controller[_0x7b45('0x11')]);router['delete'](_0x7b45('0x10'),auth['isAuthenticated'](),controller[_0x7b45('0x12')]);module[_0x7b45('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index ed2b080..98b7402 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 _0xcf66=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x58c08e,_0x3f2b22){var _0x5b71ce=function(_0xa0ba41){while(--_0xa0ba41){_0x58c08e['push'](_0x58c08e['shift']());}};_0x5b71ce(++_0x3f2b22);}(_0xcf66,0x71));var _0x6cf6=function(_0x37b322,_0x561902){_0x37b322=_0x37b322-0x0;var _0x44b0ee=_0xcf66[_0x37b322];return _0x44b0ee;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'type':{'type':Sequelize[_0x6cf6('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6cf6('0x2')]},'calleridname':{'type':Sequelize[_0x6cf6('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6cf6('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6cf6('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x6cf6('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x6cf6('0x3')]},'agentdumpAt':{'type':Sequelize[_0x6cf6('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6cf6('0x5')]},'agentacw':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6cf6('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6cf6('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6cf6('0x2')]},'connectedlinename':{'type':Sequelize[_0x6cf6('0x2')]},'language':{'type':Sequelize[_0x6cf6('0x2')]},'accountcode':{'type':Sequelize[_0x6cf6('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x6cf6('0x2')]},'destchannelstate':{'type':Sequelize[_0x6cf6('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x6cf6('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6cf6('0x2')]},'destcalleridname':{'type':Sequelize[_0x6cf6('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6cf6('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x6cf6('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x6cf6('0x2')]},'destexten':{'type':Sequelize[_0x6cf6('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x6cf6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6cf6('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x6cf6('0x2')]},'transfer':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6cf6('0x2')],'comment':_0x6cf6('0x6')},'transferexten':{'type':Sequelize[_0x6cf6('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6cf6('0x2')]},'agententerreason':{'type':Sequelize[_0x6cf6('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4639=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x41188f,_0x43488c){var _0x356950=function(_0x5c9350){while(--_0x5c9350){_0x41188f['push'](_0x41188f['shift']());}};_0x356950(++_0x43488c);}(_0x4639,0x115));var _0x9463=function(_0x494986,_0x4debb8){_0x494986=_0x494986-0x0;var _0x1c805b=_0x4639[_0x494986];return _0x1c805b;};'use strict';var Sequelize=require(_0x9463('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9463('0x1')]},'calleridnum':{'type':Sequelize[_0x9463('0x1')]},'calleridname':{'type':Sequelize[_0x9463('0x1')]},'queue':{'type':Sequelize[_0x9463('0x1')]},'interface':{'type':Sequelize[_0x9463('0x1')]},'membername':{'type':Sequelize[_0x9463('0x1')]},'agentcalledAt':{'type':Sequelize[_0x9463('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x9463('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x9463('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x9463('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9463('0x4')]},'agentacw':{'type':Sequelize[_0x9463('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9463('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x9463('0x1')]},'channel':{'type':Sequelize[_0x9463('0x1')]},'channelstate':{'type':Sequelize[_0x9463('0x4')]},'channelstatedesc':{'type':Sequelize[_0x9463('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9463('0x1')]},'connectedlinename':{'type':Sequelize[_0x9463('0x1')]},'language':{'type':Sequelize[_0x9463('0x1')]},'accountcode':{'type':Sequelize[_0x9463('0x1')]},'context':{'type':Sequelize[_0x9463('0x1')]},'exten':{'type':Sequelize[_0x9463('0x1')]},'priority':{'type':Sequelize[_0x9463('0x1')]},'destchannel':{'type':Sequelize[_0x9463('0x1')]},'destchannelstate':{'type':Sequelize[_0x9463('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x9463('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9463('0x1')]},'destcalleridname':{'type':Sequelize[_0x9463('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9463('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x9463('0x1')]},'destlanguage':{'type':Sequelize[_0x9463('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9463('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9463('0x1')]},'destuniqueid':{'type':Sequelize[_0x9463('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9463('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x9463('0x1')]},'transfer':{'type':Sequelize[_0x9463('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9463('0x5')},'transferexten':{'type':Sequelize[_0x9463('0x1')]},'transferuniqueid':{'type':Sequelize[_0x9463('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 67ae6dd..a153f75 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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 c650cfb..d05ce7f 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 _0x2a3a=['./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x210391,_0x1600e1){var _0x3c897b=function(_0x3782aa){while(--_0x3782aa){_0x210391['push'](_0x210391['shift']());}};_0x3c897b(++_0x1600e1);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x21795a,_0x1023bd){_0x21795a=_0x21795a-0x0;var _0x86cf57=_0x2a3a[_0x21795a];return _0x86cf57;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa2a3('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc949=['path','rimraf','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0xf7058b,_0x22c9b7){var _0x24cbf0=function(_0x2997ac){while(--_0x2997ac){_0xf7058b['push'](_0xf7058b['shift']());}};_0x24cbf0(++_0x22c9b7);}(_0xc949,0x181));var _0x9c94=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xc949[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var logger=require(_0x9c94('0x1'))(_0x9c94('0x2'));var moment=require(_0x9c94('0x3'));var BPromise=require(_0x9c94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c94('0x5'));var rimraf=require(_0x9c94('0x6'));var config=require('../../config/environment');var attributes=require(_0x9c94('0x7'));module[_0x9c94('0x8')]=function(_0x46d560,_0x1357ac){return _0x46d560['define'](_0x9c94('0x9'),attributes,{'tableName':_0x9c94('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9c94('0xb'),_0x9c94('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e0636e1..af30c40 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 _0x4f78=['raw','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4f78,0x158));var _0x84f7=function(_0x59cd25,_0x55b586){_0x59cd25=_0x59cd25-0x0;var _0x1efadf=_0x4f78[_0x59cd25];return _0x1efadf;};'use strict';var _=require(_0x84f7('0x0'));var util=require(_0x84f7('0x1'));var moment=require(_0x84f7('0x2'));var BPromise=require(_0x84f7('0x3'));var rs=require(_0x84f7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84f7('0x5'))['db'];var utils=require(_0x84f7('0x6'));var logger=require('../../config/logger')(_0x84f7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x84f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5476d3,_0x57464b,_0x162edc){return new BPromise(function(_0x33a680,_0xdd74b7){return client['request'](_0x5476d3,_0x162edc)[_0x84f7('0x9')](function(_0x1874ff){logger[_0x84f7('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x57464b,'request\x20sent');logger[_0x84f7('0xb')](_0x84f7('0xc'),_0x57464b,_0x84f7('0xd'),JSON[_0x84f7('0xe')](_0x1874ff));if(_0x1874ff[_0x84f7('0xf')]){if(_0x1874ff['error'][_0x84f7('0x10')]===0x1f4){logger[_0x84f7('0xf')](_0x84f7('0x11'),_0x57464b,_0x1874ff[_0x84f7('0xf')][_0x84f7('0x12')]);return _0xdd74b7(_0x1874ff[_0x84f7('0xf')]['message']);}logger[_0x84f7('0xf')](_0x84f7('0x11'),_0x57464b,_0x1874ff['error'][_0x84f7('0x12')]);return _0x33a680(_0x1874ff[_0x84f7('0xf')][_0x84f7('0x12')]);}else{logger[_0x84f7('0xa')](_0x84f7('0x11'),_0x57464b,_0x84f7('0xd'));_0x33a680(_0x1874ff[_0x84f7('0x13')][_0x84f7('0x12')]);}})[_0x84f7('0x14')](function(_0x2249d5){logger[_0x84f7('0xf')](_0x84f7('0x11'),_0x57464b,_0x2249d5);_0xdd74b7(_0x2249d5);});});}exports[_0x84f7('0x15')]=function(_0x7c779d){var _0x2c8645=this;return new Promise(function(_0x2ccf3c,_0x29730a){return db[_0x84f7('0x16')][_0x84f7('0x17')](_0x7c779d[_0x84f7('0x18')],{'raw':_0x7c779d[_0x84f7('0x19')]?_0x7c779d['options']['raw']===undefined?!![]:![]:!![]})[_0x84f7('0x9')](function(_0xc23d63){logger[_0x84f7('0xa')](_0x84f7('0x15'),_0x7c779d);logger[_0x84f7('0xb')]('CreateVoiceAgentReport',_0x7c779d,JSON[_0x84f7('0xe')](_0xc23d63));_0x2ccf3c(_0xc23d63);})[_0x84f7('0x14')](function(_0x1f8493){logger[_0x84f7('0xf')](_0x84f7('0x15'),_0x1f8493[_0x84f7('0x12')],_0x7c779d);_0x29730a(_0x2c8645[_0x84f7('0xf')](0x1f4,_0x1f8493[_0x84f7('0x12')]));});});};exports[_0x84f7('0x1a')]=function(_0x1618a8){var _0x2ef3c3=this;return new Promise(function(_0x12dfb0,_0x540bce){return db['VoiceAgentReport'][_0x84f7('0x1b')](_0x1618a8['body'],{'raw':_0x1618a8[_0x84f7('0x19')]?_0x1618a8[_0x84f7('0x19')][_0x84f7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1618a8['options']?_0x1618a8[_0x84f7('0x19')][_0x84f7('0x1d')]||null:null,'attributes':_0x1618a8[_0x84f7('0x19')]?_0x1618a8[_0x84f7('0x19')]['attributes']||null:null,'limit':_0x1618a8['options']?_0x1618a8['options'][_0x84f7('0x1e')]||null:null})[_0x84f7('0x9')](function(_0x6e1999){logger[_0x84f7('0xa')](_0x84f7('0x1a'),_0x1618a8);logger[_0x84f7('0xb')](_0x84f7('0x1a'),_0x1618a8,JSON[_0x84f7('0xe')](_0x6e1999));_0x12dfb0(_0x6e1999);})[_0x84f7('0x14')](function(_0x474bea){logger['error'](_0x84f7('0x1a'),_0x474bea[_0x84f7('0x12')],_0x1618a8);_0x540bce(_0x2ef3c3[_0x84f7('0xf')](0x1f4,_0x474bea[_0x84f7('0x12')]));});});}; \ No newline at end of file +var _0xf596=['then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x291d2e,_0x5d43e3){var _0x53a151=function(_0x20fe0e){while(--_0x20fe0e){_0x291d2e['push'](_0x291d2e['shift']());}};_0x53a151(++_0x5d43e3);}(_0xf596,0xdb));var _0x6f59=function(_0x343de6,_0x5848c8){_0x343de6=_0x343de6-0x0;var _0x565a=_0xf596[_0x343de6];return _0x565a;};'use strict';var _=require(_0x6f59('0x0'));var util=require(_0x6f59('0x1'));var moment=require(_0x6f59('0x2'));var BPromise=require(_0x6f59('0x3'));var rs=require(_0x6f59('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f59('0x5'))['db'];var utils=require(_0x6f59('0x6'));var logger=require(_0x6f59('0x7'))('rpc');var config=require(_0x6f59('0x8'));var jayson=require(_0x6f59('0x9'));var client=jayson[_0x6f59('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3de956,_0x3368df,_0x3ea895){return new BPromise(function(_0x58c574,_0x1417e8){return client[_0x6f59('0xb')](_0x3de956,_0x3ea895)[_0x6f59('0xc')](function(_0x3e11a1){logger[_0x6f59('0xd')](_0x6f59('0xe'),_0x3368df,_0x6f59('0xf'));logger[_0x6f59('0x10')](_0x6f59('0x11'),_0x3368df,'request\x20sent',JSON[_0x6f59('0x12')](_0x3e11a1));if(_0x3e11a1[_0x6f59('0x13')]){if(_0x3e11a1[_0x6f59('0x13')][_0x6f59('0x14')]===0x1f4){logger['error'](_0x6f59('0xe'),_0x3368df,_0x3e11a1[_0x6f59('0x13')]['message']);return _0x1417e8(_0x3e11a1[_0x6f59('0x13')][_0x6f59('0x15')]);}logger[_0x6f59('0x13')](_0x6f59('0xe'),_0x3368df,_0x3e11a1[_0x6f59('0x13')][_0x6f59('0x15')]);return _0x58c574(_0x3e11a1[_0x6f59('0x13')][_0x6f59('0x15')]);}else{logger[_0x6f59('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x3368df,_0x6f59('0xf'));_0x58c574(_0x3e11a1['result'][_0x6f59('0x15')]);}})[_0x6f59('0x16')](function(_0x173578){logger[_0x6f59('0x13')](_0x6f59('0xe'),_0x3368df,_0x173578);_0x1417e8(_0x173578);});});}exports['CreateVoiceAgentReport']=function(_0x43302d){var _0x2a2be3=this;return new Promise(function(_0x110f35,_0x14be3e){return db['VoiceAgentReport'][_0x6f59('0x17')](_0x43302d[_0x6f59('0x18')],{'raw':_0x43302d[_0x6f59('0x19')]?_0x43302d[_0x6f59('0x19')][_0x6f59('0x1a')]===undefined?!![]:![]:!![]})[_0x6f59('0xc')](function(_0x312a0e){logger[_0x6f59('0xd')](_0x6f59('0x1b'),_0x43302d);logger[_0x6f59('0x10')](_0x6f59('0x1b'),_0x43302d,JSON[_0x6f59('0x12')](_0x312a0e));_0x110f35(_0x312a0e);})[_0x6f59('0x16')](function(_0x10e273){logger[_0x6f59('0x13')](_0x6f59('0x1b'),_0x10e273[_0x6f59('0x15')],_0x43302d);_0x14be3e(_0x2a2be3[_0x6f59('0x13')](0x1f4,_0x10e273['message']));});});};exports[_0x6f59('0x1c')]=function(_0x1b7dcf){var _0x4e1f56=this;return new Promise(function(_0x19e71d,_0xf6cb22){return db[_0x6f59('0x1d')][_0x6f59('0x1e')](_0x1b7dcf[_0x6f59('0x18')],{'raw':_0x1b7dcf[_0x6f59('0x19')]?_0x1b7dcf[_0x6f59('0x19')][_0x6f59('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7dcf[_0x6f59('0x19')]?_0x1b7dcf['options'][_0x6f59('0x1f')]||null:null,'attributes':_0x1b7dcf[_0x6f59('0x19')]?_0x1b7dcf[_0x6f59('0x19')]['attributes']||null:null,'limit':_0x1b7dcf[_0x6f59('0x19')]?_0x1b7dcf[_0x6f59('0x19')][_0x6f59('0x20')]||null:null})[_0x6f59('0xc')](function(_0x32280f){logger[_0x6f59('0xd')](_0x6f59('0x1c'),_0x1b7dcf);logger[_0x6f59('0x10')](_0x6f59('0x1c'),_0x1b7dcf,JSON['stringify'](_0x32280f));_0x19e71d(_0x32280f);})[_0x6f59('0x16')](function(_0x14d684){logger[_0x6f59('0x13')]('UpdateVoiceAgentReport',_0x14d684[_0x6f59('0x15')],_0x1b7dcf);_0xf6cb22(_0x4e1f56[_0x6f59('0x13')](0x1f4,_0x14d684[_0x6f59('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4f2f2b4..07e097f 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 _0x9a19=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x1d42d5,_0x341ee5){var _0xa97e5e=function(_0x1aaad7){while(--_0x1aaad7){_0x1d42d5['push'](_0x1d42d5['shift']());}};_0xa97e5e(++_0x341ee5);}(_0x9a19,0x114));var _0x99a1=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x9a19[_0x2b4448];return _0xb4b465;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var fs_extra=require(_0x99a1('0x5'));var auth=require(_0x99a1('0x6'));var interaction=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var controller=require(_0x99a1('0x9'));router[_0x99a1('0xa')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xc')]);router[_0x99a1('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x99a1('0xa')](_0x99a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x99a1('0xe')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x10')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x11')]);router[_0x99a1('0x12')](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x13')]);module[_0x99a1('0x14')]=router; \ No newline at end of file +var _0xaba6=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0x2a9cd0,_0x339b90){var _0x95eca8=function(_0x4ac46b){while(--_0x4ac46b){_0x2a9cd0['push'](_0x2a9cd0['shift']());}};_0x95eca8(++_0x339b90);}(_0xaba6,0xe2));var _0x6aba=function(_0x45911d,_0x25b782){_0x45911d=_0x45911d-0x0;var _0x387de2=_0xaba6[_0x45911d];return _0x387de2;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/describe',auth[_0x6aba('0x7')](),controller[_0x6aba('0x8')]);router['get'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller['show']);router[_0x6aba('0xa')]('/',auth[_0x6aba('0x7')](),controller[_0x6aba('0xb')]);router[_0x6aba('0xc')](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xd')]);router['delete'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xe')]);module[_0x6aba('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 1c1aa52..dbbcc3f 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 _0xb0d2=['outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound'];(function(_0x4a57f6,_0x15380f){var _0x362bbe=function(_0x13d2b5){while(--_0x13d2b5){_0x4a57f6['push'](_0x4a57f6['shift']());}};_0x362bbe(++_0x15380f);}(_0xb0d2,0x1b4));var _0x2b0d=function(_0x30093f,_0x170ac7){_0x30093f=_0x30093f-0x0;var _0x328fb6=_0xb0d2[_0x30093f];return _0x328fb6;};'use strict';var Sequelize=require(_0x2b0d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2b0d('0x1')]},'type':{'type':Sequelize[_0x2b0d('0x2')](_0x2b0d('0x3'),'internal',_0x2b0d('0x4'),_0x2b0d('0x5'),_0x2b0d('0x6'),_0x2b0d('0x7'))},'tag':{'type':Sequelize[_0x2b0d('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x2b0d('0x1')]},'destination':{'type':Sequelize[_0x2b0d('0x1')]},'destinationcontext':{'type':Sequelize[_0x2b0d('0x1')]},'callerid':{'type':Sequelize[_0x2b0d('0x1')]},'channel':{'type':Sequelize[_0x2b0d('0x1')]},'destinationchannel':{'type':Sequelize[_0x2b0d('0x1')]},'lastapplication':{'type':Sequelize[_0x2b0d('0x1')]},'lastdata':{'type':Sequelize[_0x2b0d('0x8')]},'starttime':{'type':Sequelize[_0x2b0d('0x9')]},'systemanswertime':{'type':Sequelize[_0x2b0d('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2b0d('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x2b0d('0xa')]},'mohtime':{'type':Sequelize[_0x2b0d('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2b0d('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x2b0d('0x1')]},'userDisposition':{'type':Sequelize[_0x2b0d('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x2b0d('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x2b0d('0x1')]},'note':{'type':Sequelize[_0x2b0d('0x1')]},'prefix':{'type':Sequelize[_0x2b0d('0x1')]},'routeid':{'type':Sequelize[_0x2b0d('0xa')]},'sipcallid':{'type':Sequelize[_0x2b0d('0x1')]}}; \ No newline at end of file +var _0x51f9=['ENUM','outbound','inbound-fax','STRING','DATE','sequelize'];(function(_0x4ff939,_0x5f54ea){var _0x3f8ba8=function(_0x25e6f7){while(--_0x25e6f7){_0x4ff939['push'](_0x4ff939['shift']());}};_0x3f8ba8(++_0x5f54ea);}(_0x51f9,0x1eb));var _0x951f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x51f9[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x951f('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x951f('0x1')]('inbound','internal',_0x951f('0x2'),_0x951f('0x3'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x951f('0x4')]},'accountcode':{'type':Sequelize[_0x951f('0x4')]},'source':{'type':Sequelize[_0x951f('0x4')]},'destination':{'type':Sequelize[_0x951f('0x4')]},'destinationcontext':{'type':Sequelize[_0x951f('0x4')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x951f('0x4')]},'destinationchannel':{'type':Sequelize[_0x951f('0x4')]},'lastapplication':{'type':Sequelize[_0x951f('0x4')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x951f('0x5')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x951f('0x5')]},'endtime':{'type':Sequelize[_0x951f('0x5')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x951f('0x4')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x951f('0x4')]},'userThirdDisposition':{'type':Sequelize[_0x951f('0x4')]},'note':{'type':Sequelize[_0x951f('0x4')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x951f('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 69b1dd0..8b5137d 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x59f613,_0x33973b){_0x59f613=_0x59f613-0x0;var _0x5bf2d8=_0x2032[_0x59f613];return _0x5bf2d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x184f99,_0x58777c){var _0x296740=function(_0x466819){while(--_0x466819){_0x184f99['push'](_0x184f99['shift']());}};_0x296740(++_0x58777c);}(_0xdb28,0x106));var _0x8db2=function(_0x189581,_0x19f1ae){_0x189581=_0x189581-0x0;var _0x43e660=_0xdb28[_0x189581];return _0x43e660;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 320854b..c2b2aae 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 _0x8760=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x8760,0x15a));var _0x0876=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x8760[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x0876('0x0'));var util=require('util');var logger=require(_0x0876('0x1'))(_0x0876('0x2'));var moment=require(_0x0876('0x3'));var BPromise=require(_0x0876('0x4'));var rp=require(_0x0876('0x5'));var fs=require('fs');var path=require(_0x0876('0x6'));var rimraf=require(_0x0876('0x7'));var config=require(_0x0876('0x8'));var attributes=require(_0x0876('0x9'));module[_0x0876('0xa')]=function(_0x30e12e,_0xaa21ca){return _0x30e12e[_0x0876('0xb')](_0x0876('0xc'),attributes,{'tableName':_0x0876('0xd'),'paranoid':![],'indexes':[{'fields':[_0x0876('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa20=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x51113f,_0x5f056c){var _0x205716=function(_0x3c07a8){while(--_0x3c07a8){_0x51113f['push'](_0x51113f['shift']());}};_0x205716(++_0x5f056c);}(_0xfa20,0x141));var _0x0fa2=function(_0x3287a6,_0x35e598){_0x3287a6=_0x3287a6-0x0;var _0x9c6449=_0xfa20[_0x3287a6];return _0x9c6449;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var logger=require(_0x0fa2('0x2'))(_0x0fa2('0x3'));var moment=require(_0x0fa2('0x4'));var BPromise=require(_0x0fa2('0x5'));var rp=require(_0x0fa2('0x6'));var fs=require('fs');var path=require(_0x0fa2('0x7'));var rimraf=require(_0x0fa2('0x8'));var config=require(_0x0fa2('0x9'));var attributes=require(_0x0fa2('0xa'));module['exports']=function(_0x19387c,_0x2247e9){return _0x19387c['define'](_0x0fa2('0xb'),attributes,{'tableName':_0x0fa2('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0fa2('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 e43b883..492398b 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 _0x7be9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceCallReport','create','UpdateVoiceCallReport','body','lodash'];(function(_0x4f4c53,_0x58ba7b){var _0x568ff1=function(_0x1b6013){while(--_0x1b6013){_0x4f4c53['push'](_0x4f4c53['shift']());}};_0x568ff1(++_0x58ba7b);}(_0x7be9,0x97));var _0x97be=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x7be9[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x97be('0x0'));var util=require(_0x97be('0x1'));var moment=require(_0x97be('0x2'));var BPromise=require(_0x97be('0x3'));var rs=require(_0x97be('0x4'));var fs=require('fs');var Redis=require(_0x97be('0x5'));var db=require(_0x97be('0x6'))['db'];var utils=require(_0x97be('0x7'));var logger=require(_0x97be('0x8'))(_0x97be('0x9'));var config=require('../../config/environment');var jayson=require(_0x97be('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8a47,_0x3ca6e1,_0x201194){return new BPromise(function(_0x491d11,_0x10b32d){return client[_0x97be('0xb')](_0x2a8a47,_0x201194)['then'](function(_0x530e8e){logger[_0x97be('0xc')](_0x97be('0xd'),_0x3ca6e1,_0x97be('0xe'));logger[_0x97be('0xf')](_0x97be('0x10'),_0x3ca6e1,_0x97be('0xe'),JSON[_0x97be('0x11')](_0x530e8e));if(_0x530e8e['error']){if(_0x530e8e['error'][_0x97be('0x12')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3ca6e1,_0x530e8e['error'][_0x97be('0x13')]);return _0x10b32d(_0x530e8e[_0x97be('0x14')][_0x97be('0x13')]);}logger[_0x97be('0x14')](_0x97be('0xd'),_0x3ca6e1,_0x530e8e[_0x97be('0x14')][_0x97be('0x13')]);return _0x491d11(_0x530e8e[_0x97be('0x14')][_0x97be('0x13')]);}else{logger[_0x97be('0xc')](_0x97be('0xd'),_0x3ca6e1,_0x97be('0xe'));_0x491d11(_0x530e8e[_0x97be('0x15')]['message']);}})[_0x97be('0x16')](function(_0x3217f4){logger['error'](_0x97be('0xd'),_0x3ca6e1,_0x3217f4);_0x10b32d(_0x3217f4);});});}exports[_0x97be('0x17')]=function(_0x4dd6b5){var _0x2fa7bd=this;return new Promise(function(_0x2cae9f,_0x4184f8){return db[_0x97be('0x18')]['findAll']({'raw':_0x4dd6b5[_0x97be('0x19')]?_0x4dd6b5['options'][_0x97be('0x1a')]===undefined?!![]:![]:!![],'where':_0x4dd6b5[_0x97be('0x19')]?_0x4dd6b5[_0x97be('0x19')][_0x97be('0x1b')]||null:null,'attributes':_0x4dd6b5[_0x97be('0x19')]?_0x4dd6b5['options'][_0x97be('0x1c')]||null:null,'limit':_0x4dd6b5[_0x97be('0x19')]?_0x4dd6b5[_0x97be('0x19')][_0x97be('0x1d')]||null:null,'include':_0x4dd6b5[_0x97be('0x19')]?_0x4dd6b5[_0x97be('0x19')][_0x97be('0x1e')]?_[_0x97be('0x1f')](_0x4dd6b5[_0x97be('0x19')][_0x97be('0x1e')],function(_0x10254d){return{'model':db[_0x10254d[_0x97be('0x20')]],'as':_0x10254d['as'],'attributes':_0x10254d['attributes'],'include':_0x10254d[_0x97be('0x1e')]?_[_0x97be('0x1f')](_0x10254d[_0x97be('0x1e')],function(_0x25a179){return{'model':db[_0x25a179['model']],'as':_0x25a179['as'],'attributes':_0x25a179[_0x97be('0x1c')],'include':_0x25a179['include']?_['map'](_0x25a179[_0x97be('0x1e')],function(_0x191214){return{'model':db[_0x191214[_0x97be('0x20')]],'as':_0x191214['as'],'attributes':_0x191214[_0x97be('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x97be('0x21')](function(_0x17a4b5){logger[_0x97be('0xc')](_0x97be('0x17'),_0x4dd6b5);logger['debug'](_0x97be('0x17'),_0x4dd6b5,JSON[_0x97be('0x11')](_0x17a4b5));_0x2cae9f(_0x17a4b5);})[_0x97be('0x16')](function(_0x14e88c){logger[_0x97be('0x14')](_0x97be('0x17'),_0x14e88c['message'],_0x4dd6b5);_0x4184f8(_0x2fa7bd['error'](0x1f4,_0x14e88c[_0x97be('0x13')]));});});};exports[_0x97be('0x22')]=function(_0x3b02c9){var _0x4bf052=this;return new Promise(function(_0x53d772,_0x1373a2){return db[_0x97be('0x18')][_0x97be('0x23')](_0x3b02c9['body'],{'raw':_0x3b02c9[_0x97be('0x19')]?_0x3b02c9['options'][_0x97be('0x1a')]===undefined?!![]:![]:!![]})[_0x97be('0x21')](function(_0x5855f3){logger[_0x97be('0xc')]('CreateVoiceCallReport',_0x3b02c9);logger['debug'](_0x97be('0x22'),_0x3b02c9,JSON['stringify'](_0x5855f3));_0x53d772(_0x5855f3);})[_0x97be('0x16')](function(_0x56cff6){logger['error'](_0x97be('0x22'),_0x56cff6[_0x97be('0x13')],_0x3b02c9);_0x1373a2(_0x4bf052[_0x97be('0x14')](0x1f4,_0x56cff6[_0x97be('0x13')]));});});};exports[_0x97be('0x24')]=function(_0x797dd7){var _0x1cad36=this;return new Promise(function(_0x2625fa,_0x3a8c57){return db['VoiceCallReport']['update'](_0x797dd7[_0x97be('0x25')],{'raw':_0x797dd7[_0x97be('0x19')]?_0x797dd7[_0x97be('0x19')][_0x97be('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x797dd7['options']?_0x797dd7[_0x97be('0x19')][_0x97be('0x1b')]||null:null,'attributes':_0x797dd7['options']?_0x797dd7[_0x97be('0x19')][_0x97be('0x1c')]||null:null,'limit':_0x797dd7[_0x97be('0x19')]?_0x797dd7[_0x97be('0x19')][_0x97be('0x1d')]||null:null})[_0x97be('0x21')](function(_0x40f0ff){logger[_0x97be('0xc')](_0x97be('0x24'),_0x797dd7);logger['debug'](_0x97be('0x24'),_0x797dd7,JSON[_0x97be('0x11')](_0x40f0ff));_0x2625fa(_0x40f0ff);})[_0x97be('0x16')](function(_0xf67041){logger[_0x97be('0x14')](_0x97be('0x24'),_0xf67041[_0x97be('0x13')],_0x797dd7);_0x3a8c57(_0x1cad36[_0x97be('0x14')](0x1f4,_0xf67041[_0x97be('0x13')]));});});}; \ No newline at end of file +var _0x5172=['client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','options','where','limit','include','model','attributes','map','then','catch','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x17afed,_0x5003ee){var _0x180e9e=function(_0x541c15){while(--_0x541c15){_0x17afed['push'](_0x17afed['shift']());}};_0x180e9e(++_0x5003ee);}(_0x5172,0x1ec));var _0x2517=function(_0x421f85,_0x318885){_0x421f85=_0x421f85-0x0;var _0x3b3638=_0x5172[_0x421f85];return _0x3b3638;};'use strict';var _=require(_0x2517('0x0'));var util=require(_0x2517('0x1'));var moment=require(_0x2517('0x2'));var BPromise=require(_0x2517('0x3'));var rs=require(_0x2517('0x4'));var fs=require('fs');var Redis=require(_0x2517('0x5'));var db=require(_0x2517('0x6'))['db'];var utils=require(_0x2517('0x7'));var logger=require(_0x2517('0x8'))(_0x2517('0x9'));var config=require(_0x2517('0xa'));var jayson=require(_0x2517('0xb'));var client=jayson[_0x2517('0xc')][_0x2517('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c62b8,_0x433a91,_0x45070c){return new BPromise(function(_0x3fef24,_0xa36b25){return client[_0x2517('0xe')](_0x3c62b8,_0x45070c)['then'](function(_0x32152d){logger[_0x2517('0xf')](_0x2517('0x10'),_0x433a91,_0x2517('0x11'));logger[_0x2517('0x12')](_0x2517('0x13'),_0x433a91,_0x2517('0x11'),JSON[_0x2517('0x14')](_0x32152d));if(_0x32152d[_0x2517('0x15')]){if(_0x32152d[_0x2517('0x15')][_0x2517('0x16')]===0x1f4){logger[_0x2517('0x15')](_0x2517('0x10'),_0x433a91,_0x32152d[_0x2517('0x15')][_0x2517('0x17')]);return _0xa36b25(_0x32152d[_0x2517('0x15')][_0x2517('0x17')]);}logger[_0x2517('0x15')](_0x2517('0x10'),_0x433a91,_0x32152d[_0x2517('0x15')][_0x2517('0x17')]);return _0x3fef24(_0x32152d[_0x2517('0x15')][_0x2517('0x17')]);}else{logger['info'](_0x2517('0x10'),_0x433a91,_0x2517('0x11'));_0x3fef24(_0x32152d[_0x2517('0x18')]['message']);}})['catch'](function(_0x9ce406){logger[_0x2517('0x15')](_0x2517('0x10'),_0x433a91,_0x9ce406);_0xa36b25(_0x9ce406);});});}exports[_0x2517('0x19')]=function(_0x4814a6){var _0x5187a9=this;return new Promise(function(_0x391a57,_0x2bd450){return db[_0x2517('0x1a')]['findAll']({'raw':_0x4814a6['options']?_0x4814a6[_0x2517('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4814a6['options']?_0x4814a6[_0x2517('0x1b')][_0x2517('0x1c')]||null:null,'attributes':_0x4814a6[_0x2517('0x1b')]?_0x4814a6[_0x2517('0x1b')]['attributes']||null:null,'limit':_0x4814a6[_0x2517('0x1b')]?_0x4814a6['options'][_0x2517('0x1d')]||null:null,'include':_0x4814a6['options']?_0x4814a6[_0x2517('0x1b')][_0x2517('0x1e')]?_['map'](_0x4814a6[_0x2517('0x1b')][_0x2517('0x1e')],function(_0xdb9f56){return{'model':db[_0xdb9f56[_0x2517('0x1f')]],'as':_0xdb9f56['as'],'attributes':_0xdb9f56[_0x2517('0x20')],'include':_0xdb9f56[_0x2517('0x1e')]?_[_0x2517('0x21')](_0xdb9f56['include'],function(_0x5f27e1){return{'model':db[_0x5f27e1['model']],'as':_0x5f27e1['as'],'attributes':_0x5f27e1[_0x2517('0x20')],'include':_0x5f27e1['include']?_[_0x2517('0x21')](_0x5f27e1['include'],function(_0x4bf106){return{'model':db[_0x4bf106[_0x2517('0x1f')]],'as':_0x4bf106['as'],'attributes':_0x4bf106['attributes']};}):[]};}):[]};}):[]:[]})[_0x2517('0x22')](function(_0x323acd){logger['info'](_0x2517('0x19'),_0x4814a6);logger[_0x2517('0x12')](_0x2517('0x19'),_0x4814a6,JSON['stringify'](_0x323acd));_0x391a57(_0x323acd);})[_0x2517('0x23')](function(_0x386b58){logger[_0x2517('0x15')](_0x2517('0x19'),_0x386b58[_0x2517('0x17')],_0x4814a6);_0x2bd450(_0x5187a9[_0x2517('0x15')](0x1f4,_0x386b58[_0x2517('0x17')]));});});};exports[_0x2517('0x24')]=function(_0x1c4362){var _0xb07c43=this;return new Promise(function(_0x1d64f9,_0x2f4383){return db[_0x2517('0x1a')][_0x2517('0x25')](_0x1c4362[_0x2517('0x26')],{'raw':_0x1c4362['options']?_0x1c4362[_0x2517('0x1b')][_0x2517('0x27')]===undefined?!![]:![]:!![]})['then'](function(_0x2080a4){logger[_0x2517('0xf')](_0x2517('0x24'),_0x1c4362);logger['debug'](_0x2517('0x24'),_0x1c4362,JSON['stringify'](_0x2080a4));_0x1d64f9(_0x2080a4);})[_0x2517('0x23')](function(_0x12c32f){logger['error']('CreateVoiceCallReport',_0x12c32f[_0x2517('0x17')],_0x1c4362);_0x2f4383(_0xb07c43['error'](0x1f4,_0x12c32f[_0x2517('0x17')]));});});};exports[_0x2517('0x28')]=function(_0x500ade){var _0x51773e=this;return new Promise(function(_0x5b7acb,_0x497180){return db[_0x2517('0x1a')][_0x2517('0x29')](_0x500ade[_0x2517('0x26')],{'raw':_0x500ade[_0x2517('0x1b')]?_0x500ade[_0x2517('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x500ade[_0x2517('0x1b')]?_0x500ade[_0x2517('0x1b')][_0x2517('0x1c')]||null:null,'attributes':_0x500ade[_0x2517('0x1b')]?_0x500ade[_0x2517('0x1b')][_0x2517('0x20')]||null:null,'limit':_0x500ade[_0x2517('0x1b')]?_0x500ade[_0x2517('0x1b')][_0x2517('0x1d')]||null:null})[_0x2517('0x22')](function(_0x4eb337){logger[_0x2517('0xf')]('UpdateVoiceCallReport',_0x500ade);logger[_0x2517('0x12')]('UpdateVoiceCallReport',_0x500ade,JSON[_0x2517('0x14')](_0x4eb337));_0x5b7acb(_0x4eb337);})[_0x2517('0x23')](function(_0x1bf58b){logger[_0x2517('0x15')](_0x2517('0x28'),_0x1bf58b[_0x2517('0x17')],_0x500ade);_0x497180(_0x51773e['error'](0x1f4,_0x1bf58b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 2f75fa7..6aed826 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 _0xc266=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated','show','post','update','delete'];(function(_0x4e1211,_0x1c0e26){var _0x4ae887=function(_0x6e55ff){while(--_0x6e55ff){_0x4e1211['push'](_0x4e1211['shift']());}};_0x4ae887(++_0x1c0e26);}(_0xc266,0xd2));var _0x6c26=function(_0x23096b,_0x35ebc1){_0x23096b=_0x23096b-0x0;var _0x24c0f4=_0xc266[_0x23096b];return _0x24c0f4;};'use strict';var multer=require(_0x6c26('0x0'));var util=require('util');var path=require(_0x6c26('0x1'));var timeout=require(_0x6c26('0x2'));var express=require(_0x6c26('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6c26('0x4'));var interaction=require(_0x6c26('0x5'));var config=require(_0x6c26('0x6'));var controller=require(_0x6c26('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6c26('0x8')](_0x6c26('0x9'),auth[_0x6c26('0xa')](),controller[_0x6c26('0xb')]);router[_0x6c26('0xc')]('/',auth[_0x6c26('0xa')](),controller['create']);router['put'](_0x6c26('0x9'),auth['isAuthenticated'](),controller[_0x6c26('0xd')]);router[_0x6c26('0xe')](_0x6c26('0x9'),auth[_0x6c26('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe299=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x518294,_0x3845b3){var _0x227a02=function(_0x259dee){while(--_0x259dee){_0x518294['push'](_0x518294['shift']());}};_0x227a02(++_0x3845b3);}(_0xe299,0x1c5));var _0x9e29=function(_0x5bdf81,_0x377084){_0x5bdf81=_0x5bdf81-0x0;var _0x3dac91=_0xe299[_0x5bdf81];return _0x3dac91;};'use strict';var multer=require(_0x9e29('0x0'));var util=require(_0x9e29('0x1'));var path=require('path');var timeout=require(_0x9e29('0x2'));var express=require(_0x9e29('0x3'));var router=express[_0x9e29('0x4')]();var fs_extra=require(_0x9e29('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9e29('0x6'));var config=require(_0x9e29('0x7'));var controller=require(_0x9e29('0x8'));router[_0x9e29('0x9')]('/',auth[_0x9e29('0xa')](),controller[_0x9e29('0xb')]);router['get'](_0x9e29('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9e29('0xd')]('/',auth[_0x9e29('0xa')](),controller[_0x9e29('0xe')]);router['put'](_0x9e29('0xc'),auth[_0x9e29('0xa')](),controller[_0x9e29('0xf')]);router[_0x9e29('0x10')](_0x9e29('0xc'),auth[_0x9e29('0xa')](),controller[_0x9e29('0x11')]);module[_0x9e29('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 2d8621d..629748c 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 _0xfc2f=['STRING','name','setDataValue','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x2ee3a6,_0x2c7bab){var _0x378198=function(_0x4dc245){while(--_0x4dc245){_0x2ee3a6['push'](_0x2ee3a6['shift']());}};_0x378198(++_0x2c7bab);}(_0xfc2f,0x1d2));var _0xffc2=function(_0x2ee63e,_0x2ddd70){_0x2ee63e=_0x2ee63e-0x0;var _0x20c26f=_0xfc2f[_0x2ee63e];return _0x20c26f;};'use strict';var Sequelize=require(_0xffc2('0x0'));module[_0xffc2('0x1')]={'name':{'type':Sequelize[_0xffc2('0x2')]},'prefix':{'type':Sequelize[_0xffc2('0x2')],'unique':_0xffc2('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xffc2('0x2')],'set':function(_0x2fc127){this[_0xffc2('0x4')]('options',_0x2fc127?_0x2fc127[_0xffc2('0x5')](''):[]);},'get':function(){return this[_0xffc2('0x6')]('options')?this[_0xffc2('0x6')]('options')[_0xffc2('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xffc2('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xffc2('0x2')]},'description':{'type':Sequelize[_0xffc2('0x2')]}}; \ No newline at end of file +var _0x3aa8=['split','BOOLEAN','sequelize','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x3f473d,_0x406151){var _0x56bba1=function(_0x5f488c){while(--_0x5f488c){_0x3f473d['push'](_0x3f473d['shift']());}};_0x56bba1(++_0x406151);}(_0x3aa8,0x80));var _0x83aa=function(_0x2d644d,_0x5ed363){_0x2d644d=_0x2d644d-0x0;var _0x4e645a=_0x3aa8[_0x2d644d];return _0x4e645a;};'use strict';var Sequelize=require(_0x83aa('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x83aa('0x1')],'unique':_0x83aa('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x83aa('0x1')],'set':function(_0xe409ba){this[_0x83aa('0x3')](_0x83aa('0x4'),_0xe409ba?_0xe409ba[_0x83aa('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x83aa('0x4'))?this[_0x83aa('0x6')]('options')[_0x83aa('0x7')](''):[];}},'auth':{'type':Sequelize[_0x83aa('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x83aa('0x1')]},'record':{'type':Sequelize[_0x83aa('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x83aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1776d67..3002a28 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 _0x7846=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','send','index','map','VoiceChanSpy','rawAttributes','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x7846,0xf4));var _0x6784=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0x7846[_0x3cc05d];return _0x28b736;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6784('0x0'));var zipdir=require(_0x6784('0x1'));var jsonpatch=require(_0x6784('0x2'));var rp=require(_0x6784('0x3'));var moment=require(_0x6784('0x4'));var BPromise=require(_0x6784('0x5'));var Mustache=require('mustache');var util=require(_0x6784('0x6'));var path=require(_0x6784('0x7'));var sox=require(_0x6784('0x8'));var csv=require(_0x6784('0x9'));var ejs=require(_0x6784('0xa'));var fs=require('fs');var fs_extra=require(_0x6784('0xb'));var _=require(_0x6784('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6784('0xd'));var deskjs=require(_0x6784('0xe'));var toCsv=require(_0x6784('0x9'));var querystring=require(_0x6784('0xf'));var Papa=require(_0x6784('0x10'));var Redis=require(_0x6784('0x11'));var authService=require(_0x6784('0x12'));var qs=require(_0x6784('0x13'));var as=require(_0x6784('0x14'));var hardwareService=require(_0x6784('0x15'));var logger=require(_0x6784('0x16'))(_0x6784('0x17'));var utils=require(_0x6784('0x18'));var config=require(_0x6784('0x19'));var licenseUtil=require(_0x6784('0x1a'));var db=require(_0x6784('0x1b'))['db'];function respondWithStatusCode(_0x5a43c1,_0x221cb8){_0x221cb8=_0x221cb8||0xcc;return function(_0x42cd0f){if(_0x42cd0f){return _0x5a43c1[_0x6784('0x1c')](_0x221cb8);}return _0x5a43c1[_0x6784('0x1d')](_0x221cb8)['end']();};}function respondWithResult(_0x18b8a9,_0x681759){_0x681759=_0x681759||0xc8;return function(_0x62426d){if(_0x62426d){return _0x18b8a9[_0x6784('0x1d')](_0x681759)[_0x6784('0x1e')](_0x62426d);}};}function respondWithFilteredResult(_0x18929b,_0x474511){return function(_0x32eaf2){if(_0x32eaf2){var _0x1db6be=typeof _0x474511[_0x6784('0x1f')]===_0x6784('0x20')&&typeof _0x474511['limit']===_0x6784('0x20');var _0x575d8=_0x32eaf2[_0x6784('0x21')];var _0x2fd8a2=_0x1db6be?0x0:_0x474511['offset'];var _0x23f32e=_0x1db6be?_0x32eaf2[_0x6784('0x21')]:_0x474511[_0x6784('0x1f')]+_0x474511[_0x6784('0x22')];var _0x338067;if(_0x23f32e>=_0x575d8){_0x23f32e=_0x575d8;_0x338067=0xc8;}else{_0x338067=0xce;}_0x18929b['status'](_0x338067);return _0x18929b[_0x6784('0x23')](_0x6784('0x24'),_0x2fd8a2+'-'+_0x23f32e+'/'+_0x575d8)['json'](_0x32eaf2);}return null;};}function patchUpdates(_0x3f4178){return function(_0x2eeed8){try{jsonpatch[_0x6784('0x25')](_0x2eeed8,_0x3f4178,!![]);}catch(_0x461ced){return BPromise['reject'](_0x461ced);}return _0x2eeed8[_0x6784('0x26')]();};}function saveUpdates(_0x225a9e,_0x581690){return function(_0x37aea3){if(_0x37aea3){return _0x37aea3[_0x6784('0x27')](_0x225a9e)[_0x6784('0x28')](function(_0x305d64){return _0x305d64;});}return null;};}function removeEntity(_0x3cdfe2,_0x140a38){return function(_0x5452a8){if(_0x5452a8){return _0x5452a8[_0x6784('0x29')]()[_0x6784('0x28')](function(){var _0x37aa8f=_0x5452a8[_0x6784('0x2a')]({'plain':!![]});var _0x4ac355=_0x6784('0x2b');return db[_0x6784('0x2c')][_0x6784('0x29')]({'where':{'type':_0x4ac355,'resourceId':_0x37aa8f['id']}})['then'](function(){return _0x5452a8;});})[_0x6784('0x28')](function(){_0x3cdfe2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51cbe4,_0x2dc02c){return function(_0x17346b){if(!_0x17346b){_0x51cbe4[_0x6784('0x1c')](0x194);}return _0x17346b;};}function handleError(_0x202a0e,_0x151340){_0x151340=_0x151340||0x1f4;return function(_0x280b56){logger['error'](_0x280b56[_0x6784('0x2d')]);if(_0x280b56['name']){delete _0x280b56['name'];}_0x202a0e['status'](_0x151340)[_0x6784('0x2e')](_0x280b56);};}exports[_0x6784('0x2f')]=function(_0x461057,_0x2036d6){var _0x204fba={},_0x5e465c={},_0x2e0b03={'count':0x0,'rows':[]};var _0x32e3cc=_[_0x6784('0x30')](db[_0x6784('0x31')][_0x6784('0x32')],function(_0xd9de69){return{'name':_0xd9de69['fieldName'],'type':_0xd9de69[_0x6784('0x33')]['key']};});_0x5e465c['model']=_[_0x6784('0x30')](_0x32e3cc,_0x6784('0x34'));_0x5e465c[_0x6784('0x35')]=_[_0x6784('0x36')](_0x461057['query']);_0x5e465c[_0x6784('0x37')]=_[_0x6784('0x38')](_0x5e465c[_0x6784('0x39')],_0x5e465c[_0x6784('0x35')]);_0x204fba[_0x6784('0x3a')]=_[_0x6784('0x38')](_0x5e465c[_0x6784('0x39')],qs[_0x6784('0x3b')](_0x461057['query']['fields']));_0x204fba[_0x6784('0x3a')]=_0x204fba['attributes'][_0x6784('0x3c')]?_0x204fba['attributes']:_0x5e465c[_0x6784('0x39')];if(!_0x461057['query'][_0x6784('0x3d')]('nolimit')){_0x204fba[_0x6784('0x22')]=qs[_0x6784('0x22')](_0x461057['query']['limit']);_0x204fba[_0x6784('0x1f')]=qs[_0x6784('0x1f')](_0x461057[_0x6784('0x35')]['offset']);}_0x204fba['order']=qs['sort'](_0x461057[_0x6784('0x35')][_0x6784('0x3e')]);_0x204fba[_0x6784('0x3f')]=qs[_0x6784('0x37')](_[_0x6784('0x40')](_0x461057['query'],_0x5e465c[_0x6784('0x37')]),_0x32e3cc);if(_0x461057[_0x6784('0x35')][_0x6784('0x41')]){_0x204fba[_0x6784('0x3f')]=_[_0x6784('0x42')](_0x204fba[_0x6784('0x3f')],{'$or':_['map'](_0x32e3cc,function(_0x2b1090){if(_0x2b1090[_0x6784('0x33')]!==_0x6784('0x43')){var _0x5f65a9={};_0x5f65a9[_0x2b1090[_0x6784('0x34')]]={'$like':'%'+_0x461057[_0x6784('0x35')][_0x6784('0x41')]+'%'};return _0x5f65a9;}})});}_0x204fba=_[_0x6784('0x42')]({},_0x204fba,_0x461057[_0x6784('0x44')]);var _0x373921={'where':_0x204fba[_0x6784('0x3f')]};return db[_0x6784('0x31')]['count'](_0x373921)['then'](function(_0x11e22d){_0x2e0b03[_0x6784('0x21')]=_0x11e22d;if(_0x461057['query'][_0x6784('0x45')]){_0x204fba[_0x6784('0x46')]=[{'all':!![]}];}return db[_0x6784('0x31')][_0x6784('0x47')](_0x204fba);})[_0x6784('0x28')](function(_0x2ccb02){_0x2e0b03['rows']=_0x2ccb02;return _0x2e0b03;})['then'](respondWithFilteredResult(_0x2036d6,_0x204fba))[_0x6784('0x48')](handleError(_0x2036d6,null));};exports['show']=function(_0x14cbd8,_0x2497ce){var _0x28e519={'raw':![],'where':{'id':_0x14cbd8[_0x6784('0x49')]['id']}},_0x549dfb={};_0x549dfb[_0x6784('0x39')]=_[_0x6784('0x36')](db[_0x6784('0x31')]['rawAttributes']);_0x549dfb[_0x6784('0x35')]=_['keys'](_0x14cbd8['query']);_0x549dfb[_0x6784('0x37')]=_[_0x6784('0x38')](_0x549dfb['model'],_0x549dfb['query']);_0x28e519[_0x6784('0x3a')]=_[_0x6784('0x38')](_0x549dfb[_0x6784('0x39')],qs['fields'](_0x14cbd8[_0x6784('0x35')][_0x6784('0x3b')]));_0x28e519['attributes']=_0x28e519[_0x6784('0x3a')][_0x6784('0x3c')]?_0x28e519[_0x6784('0x3a')]:_0x549dfb['model'];if(_0x14cbd8[_0x6784('0x35')][_0x6784('0x45')]){_0x28e519[_0x6784('0x46')]=[{'all':!![]}];}_0x28e519=_[_0x6784('0x42')]({},_0x28e519,_0x14cbd8[_0x6784('0x44')]);return db[_0x6784('0x31')][_0x6784('0x4a')](_0x28e519)[_0x6784('0x28')](handleEntityNotFound(_0x2497ce,null))[_0x6784('0x28')](respondWithResult(_0x2497ce,null))[_0x6784('0x48')](handleError(_0x2497ce,null));};exports['create']=function(_0x4c332e,_0x3955c7){return db[_0x6784('0x31')][_0x6784('0x4b')](_0x4c332e['body'],{})[_0x6784('0x28')](function(_0x5dcadf){var _0x2deb8d=_0x4c332e[_0x6784('0x4c')]['get']({'plain':!![]});if(!_0x2deb8d)throw new Error(_0x6784('0x4d'));if(_0x2deb8d['role']==='user'){var _0x3f3715=_0x5dcadf[_0x6784('0x2a')]({'plain':!![]});var _0x2603f1=_0x6784('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x2603f1,'userProfileId':_0x2deb8d[_0x6784('0x4e')]},'raw':!![]})[_0x6784('0x28')](function(_0x5b4801){if(_0x5b4801&&_0x5b4801[_0x6784('0x4f')]===0x0){return db[_0x6784('0x2c')][_0x6784('0x4b')]({'name':_0x3f3715[_0x6784('0x34')],'resourceId':_0x3f3715['id'],'type':_0x5b4801[_0x6784('0x34')],'sectionId':_0x5b4801['id']},{})[_0x6784('0x28')](function(){return _0x5dcadf;});}else{return _0x5dcadf;}})[_0x6784('0x48')](function(_0x408763){logger[_0x6784('0x50')](_0x6784('0x51'),_0x408763);throw _0x408763;});}return _0x5dcadf;})[_0x6784('0x28')](respondWithResult(_0x3955c7,0xc9))['catch'](handleError(_0x3955c7,null));};exports[_0x6784('0x27')]=function(_0x2aaf8b,_0x37d00b){if(_0x2aaf8b[_0x6784('0x52')]['id']){delete _0x2aaf8b[_0x6784('0x52')]['id'];}return db[_0x6784('0x31')][_0x6784('0x4a')]({'where':{'id':_0x2aaf8b[_0x6784('0x49')]['id']}})['then'](handleEntityNotFound(_0x37d00b,null))[_0x6784('0x28')](saveUpdates(_0x2aaf8b[_0x6784('0x52')],null))[_0x6784('0x28')](respondWithResult(_0x37d00b,null))[_0x6784('0x48')](handleError(_0x37d00b,null));};exports[_0x6784('0x29')]=function(_0x176f33,_0xbed6df){return db[_0x6784('0x31')][_0x6784('0x4a')]({'where':{'id':_0x176f33[_0x6784('0x49')]['id']}})[_0x6784('0x28')](handleEntityNotFound(_0xbed6df,null))[_0x6784('0x28')](removeEntity(_0xbed6df,null))[_0x6784('0x48')](handleError(_0xbed6df,null));}; \ No newline at end of file +var _0xdeb3=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','map','VoiceChanSpy','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','create','user','role','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','ejs','fs-extra','lodash','squel','crypto'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xdeb3,0xeb));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x3deb('0x0'));var rimraf=require(_0x3deb('0x1'));var zipdir=require(_0x3deb('0x2'));var jsonpatch=require(_0x3deb('0x3'));var rp=require(_0x3deb('0x4'));var moment=require(_0x3deb('0x5'));var BPromise=require(_0x3deb('0x6'));var Mustache=require(_0x3deb('0x7'));var util=require(_0x3deb('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3deb('0x9'));var fs=require('fs');var fs_extra=require(_0x3deb('0xa'));var _=require(_0x3deb('0xb'));var squel=require(_0x3deb('0xc'));var crypto=require(_0x3deb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3deb('0xe'));var querystring=require(_0x3deb('0xf'));var Papa=require(_0x3deb('0x10'));var Redis=require(_0x3deb('0x11'));var authService=require(_0x3deb('0x12'));var qs=require(_0x3deb('0x13'));var as=require(_0x3deb('0x14'));var hardwareService=require(_0x3deb('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3deb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3deb('0x17'))['db'];function respondWithStatusCode(_0x21f596,_0x78aa81){_0x78aa81=_0x78aa81||0xcc;return function(_0x1055dc){if(_0x1055dc){return _0x21f596['sendStatus'](_0x78aa81);}return _0x21f596[_0x3deb('0x18')](_0x78aa81)[_0x3deb('0x19')]();};}function respondWithResult(_0x1a651d,_0x228e23){_0x228e23=_0x228e23||0xc8;return function(_0x329f3a){if(_0x329f3a){return _0x1a651d[_0x3deb('0x18')](_0x228e23)[_0x3deb('0x1a')](_0x329f3a);}};}function respondWithFilteredResult(_0xa25716,_0x4a291e){return function(_0x428f90){if(_0x428f90){var _0xa45605=typeof _0x4a291e['offset']===_0x3deb('0x1b')&&typeof _0x4a291e[_0x3deb('0x1c')]==='undefined';var _0x5cd9db=_0x428f90['count'];var _0x2a8ec4=_0xa45605?0x0:_0x4a291e[_0x3deb('0x1d')];var _0x4adbaa=_0xa45605?_0x428f90['count']:_0x4a291e[_0x3deb('0x1d')]+_0x4a291e[_0x3deb('0x1c')];var _0xb6be32;if(_0x4adbaa>=_0x5cd9db){_0x4adbaa=_0x5cd9db;_0xb6be32=0xc8;}else{_0xb6be32=0xce;}_0xa25716[_0x3deb('0x18')](_0xb6be32);return _0xa25716['set'](_0x3deb('0x1e'),_0x2a8ec4+'-'+_0x4adbaa+'/'+_0x5cd9db)[_0x3deb('0x1a')](_0x428f90);}return null;};}function patchUpdates(_0xbd82de){return function(_0x4ceab2){try{jsonpatch[_0x3deb('0x1f')](_0x4ceab2,_0xbd82de,!![]);}catch(_0x144671){return BPromise[_0x3deb('0x20')](_0x144671);}return _0x4ceab2[_0x3deb('0x21')]();};}function saveUpdates(_0x22ea80,_0x543014){return function(_0x35843b){if(_0x35843b){return _0x35843b[_0x3deb('0x22')](_0x22ea80)[_0x3deb('0x23')](function(_0x428869){return _0x428869;});}return null;};}function removeEntity(_0x12f415,_0x385e2a){return function(_0x3f3d52){if(_0x3f3d52){return _0x3f3d52[_0x3deb('0x24')]()['then'](function(){var _0xd42d62=_0x3f3d52[_0x3deb('0x25')]({'plain':!![]});var _0x1aacbd=_0x3deb('0x26');return db[_0x3deb('0x27')]['destroy']({'where':{'type':_0x1aacbd,'resourceId':_0xd42d62['id']}})[_0x3deb('0x23')](function(){return _0x3f3d52;});})[_0x3deb('0x23')](function(){_0x12f415[_0x3deb('0x18')](0xcc)[_0x3deb('0x19')]();});}};}function handleEntityNotFound(_0xec30ee,_0x331065){return function(_0xff692b){if(!_0xff692b){_0xec30ee['sendStatus'](0x194);}return _0xff692b;};}function handleError(_0x56b62c,_0x24b32d){_0x24b32d=_0x24b32d||0x1f4;return function(_0x520f24){logger[_0x3deb('0x28')](_0x520f24[_0x3deb('0x29')]);if(_0x520f24[_0x3deb('0x2a')]){delete _0x520f24['name'];}_0x56b62c[_0x3deb('0x18')](_0x24b32d)['send'](_0x520f24);};}exports['index']=function(_0x14ffa1,_0x205c22){var _0x29a190={},_0x7ecaa2={},_0x5c42ad={'count':0x0,'rows':[]};var _0x494dba=_[_0x3deb('0x2b')](db[_0x3deb('0x2c')]['rawAttributes'],function(_0x5bcac3){return{'name':_0x5bcac3[_0x3deb('0x2d')],'type':_0x5bcac3[_0x3deb('0x2e')][_0x3deb('0x2f')]};});_0x7ecaa2['model']=_[_0x3deb('0x2b')](_0x494dba,'name');_0x7ecaa2[_0x3deb('0x30')]=_[_0x3deb('0x31')](_0x14ffa1[_0x3deb('0x30')]);_0x7ecaa2[_0x3deb('0x32')]=_[_0x3deb('0x33')](_0x7ecaa2[_0x3deb('0x34')],_0x7ecaa2[_0x3deb('0x30')]);_0x29a190[_0x3deb('0x35')]=_[_0x3deb('0x33')](_0x7ecaa2[_0x3deb('0x34')],qs['fields'](_0x14ffa1[_0x3deb('0x30')][_0x3deb('0x36')]));_0x29a190[_0x3deb('0x35')]=_0x29a190[_0x3deb('0x35')][_0x3deb('0x37')]?_0x29a190[_0x3deb('0x35')]:_0x7ecaa2[_0x3deb('0x34')];if(!_0x14ffa1[_0x3deb('0x30')][_0x3deb('0x38')](_0x3deb('0x39'))){_0x29a190[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x14ffa1[_0x3deb('0x30')][_0x3deb('0x1c')]);_0x29a190[_0x3deb('0x1d')]=qs[_0x3deb('0x1d')](_0x14ffa1['query']['offset']);}_0x29a190[_0x3deb('0x3a')]=qs[_0x3deb('0x3b')](_0x14ffa1[_0x3deb('0x30')]['sort']);_0x29a190[_0x3deb('0x3c')]=qs['filters'](_[_0x3deb('0x3d')](_0x14ffa1['query'],_0x7ecaa2[_0x3deb('0x32')]),_0x494dba);if(_0x14ffa1['query'][_0x3deb('0x3e')]){_0x29a190[_0x3deb('0x3c')]=_[_0x3deb('0x3f')](_0x29a190[_0x3deb('0x3c')],{'$or':_['map'](_0x494dba,function(_0x12ce28){if(_0x12ce28['type']!==_0x3deb('0x40')){var _0x30ed7c={};_0x30ed7c[_0x12ce28[_0x3deb('0x2a')]]={'$like':'%'+_0x14ffa1[_0x3deb('0x30')][_0x3deb('0x3e')]+'%'};return _0x30ed7c;}})});}_0x29a190=_[_0x3deb('0x3f')]({},_0x29a190,_0x14ffa1[_0x3deb('0x41')]);var _0x26973c={'where':_0x29a190['where']};return db[_0x3deb('0x2c')]['count'](_0x26973c)['then'](function(_0x5bbbfa){_0x5c42ad[_0x3deb('0x42')]=_0x5bbbfa;if(_0x14ffa1[_0x3deb('0x30')][_0x3deb('0x43')]){_0x29a190[_0x3deb('0x44')]=[{'all':!![]}];}return db[_0x3deb('0x2c')][_0x3deb('0x45')](_0x29a190);})[_0x3deb('0x23')](function(_0x4eed4a){_0x5c42ad['rows']=_0x4eed4a;return _0x5c42ad;})[_0x3deb('0x23')](respondWithFilteredResult(_0x205c22,_0x29a190))[_0x3deb('0x46')](handleError(_0x205c22,null));};exports[_0x3deb('0x47')]=function(_0x1e8979,_0x303e2e){var _0x4d4c13={'raw':![],'where':{'id':_0x1e8979[_0x3deb('0x48')]['id']}},_0x1fa3ca={};_0x1fa3ca[_0x3deb('0x34')]=_['keys'](db[_0x3deb('0x2c')][_0x3deb('0x49')]);_0x1fa3ca[_0x3deb('0x30')]=_[_0x3deb('0x31')](_0x1e8979[_0x3deb('0x30')]);_0x1fa3ca['filters']=_[_0x3deb('0x33')](_0x1fa3ca[_0x3deb('0x34')],_0x1fa3ca[_0x3deb('0x30')]);_0x4d4c13['attributes']=_['intersection'](_0x1fa3ca[_0x3deb('0x34')],qs[_0x3deb('0x36')](_0x1e8979[_0x3deb('0x30')][_0x3deb('0x36')]));_0x4d4c13[_0x3deb('0x35')]=_0x4d4c13['attributes'][_0x3deb('0x37')]?_0x4d4c13[_0x3deb('0x35')]:_0x1fa3ca[_0x3deb('0x34')];if(_0x1e8979[_0x3deb('0x30')][_0x3deb('0x43')]){_0x4d4c13[_0x3deb('0x44')]=[{'all':!![]}];}_0x4d4c13=_[_0x3deb('0x3f')]({},_0x4d4c13,_0x1e8979[_0x3deb('0x41')]);return db[_0x3deb('0x2c')]['find'](_0x4d4c13)[_0x3deb('0x23')](handleEntityNotFound(_0x303e2e,null))[_0x3deb('0x23')](respondWithResult(_0x303e2e,null))[_0x3deb('0x46')](handleError(_0x303e2e,null));};exports[_0x3deb('0x4a')]=function(_0x448505,_0x4b3cd6){return db[_0x3deb('0x2c')][_0x3deb('0x4a')](_0x448505['body'],{})['then'](function(_0x55cdaa){var _0x864bd2=_0x448505[_0x3deb('0x4b')]['get']({'plain':!![]});if(!_0x864bd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x864bd2[_0x3deb('0x4c')]===_0x3deb('0x4b')){var _0x8aabc0=_0x55cdaa[_0x3deb('0x25')]({'plain':!![]});var _0x47f001=_0x3deb('0x26');return db[_0x3deb('0x4d')][_0x3deb('0x4e')]({'where':{'name':_0x47f001,'userProfileId':_0x864bd2[_0x3deb('0x4f')]},'raw':!![]})[_0x3deb('0x23')](function(_0x1e53e4){if(_0x1e53e4&&_0x1e53e4[_0x3deb('0x50')]===0x0){return db[_0x3deb('0x27')]['create']({'name':_0x8aabc0['name'],'resourceId':_0x8aabc0['id'],'type':_0x1e53e4[_0x3deb('0x2a')],'sectionId':_0x1e53e4['id']},{})[_0x3deb('0x23')](function(){return _0x55cdaa;});}else{return _0x55cdaa;}})[_0x3deb('0x46')](function(_0x46a180){logger[_0x3deb('0x28')](_0x3deb('0x51'),_0x46a180);throw _0x46a180;});}return _0x55cdaa;})[_0x3deb('0x23')](respondWithResult(_0x4b3cd6,0xc9))[_0x3deb('0x46')](handleError(_0x4b3cd6,null));};exports[_0x3deb('0x22')]=function(_0x22b8e1,_0x2111e0){if(_0x22b8e1[_0x3deb('0x52')]['id']){delete _0x22b8e1[_0x3deb('0x52')]['id'];}return db[_0x3deb('0x2c')]['find']({'where':{'id':_0x22b8e1['params']['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x2111e0,null))['then'](saveUpdates(_0x22b8e1['body'],null))[_0x3deb('0x23')](respondWithResult(_0x2111e0,null))[_0x3deb('0x46')](handleError(_0x2111e0,null));};exports[_0x3deb('0x24')]=function(_0x4195b5,_0x59a3c0){return db[_0x3deb('0x2c')][_0x3deb('0x4e')]({'where':{'id':_0x4195b5[_0x3deb('0x48')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x59a3c0,null))[_0x3deb('0x23')](removeEntity(_0x59a3c0,null))[_0x3deb('0x46')](handleError(_0x59a3c0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 219a4e9..29fbd99 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 _0x5473=['StopMixMonitor','concat','internal','findAll','agent','then','models','define','VoiceChanSpy','voice_chanspy','length','bulkCreate','destroy','VoiceExtension','catch','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','prefix','system','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','recordingFormat','auth','merge','Authenticate','password','SIP/%s,%s','name','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5473,0xc8));var _0x3547=function(_0x20f7e9,_0xfb2bb8){_0x20f7e9=_0x20f7e9-0x0;var _0xc4697b=_0x5473[_0x20f7e9];return _0xc4697b;};'use strict';var _=require(_0x3547('0x0'));var util=require(_0x3547('0x1'));var BPromise=require(_0x3547('0x2'));var attributes=require(_0x3547('0x3'));var getUserApplications=function(_0x3de4dc,_0x2b8633,_0x1d9f87){var _0x4377e7=0x1;var _0x2d5013=[];var _0x428445={'context':_0x2b8633['context']||_0x3547('0x4'),'exten':util[_0x3547('0x5')]('%s%s',_0x3de4dc[_0x3547('0x6')],_0x1d9f87),'type':_0x3547('0x7'),'isApp':![],'ChanSpyId':_0x3de4dc['id'],'UserId':_0x2b8633['id']};_0x2d5013['push'](_['merge']({'app':_0x3547('0x8'),'appdata':util[_0x3547('0x5')](_0x3547('0x9'),_0x3547('0xa')),'priority':_0x4377e7++},_0x428445));if(_0x3de4dc[_0x3547('0xb')]){_0x2d5013[_0x3547('0xc')](_['merge']({'app':_0x3547('0xd'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x3de4dc[_0x3547('0xe')]),'priority':_0x4377e7++},_0x428445));}if(_0x3de4dc[_0x3547('0xf')]){_0x2d5013[_0x3547('0xc')](_[_0x3547('0x10')]({'app':_0x3547('0x11'),'appdata':_0x3de4dc[_0x3547('0x12')],'priority':_0x4377e7++},_0x428445));}_0x2d5013[_0x3547('0xc')](_[_0x3547('0x10')]({'app':'ChanSpy','appdata':util[_0x3547('0x5')](_0x3547('0x13'),_0x2b8633[_0x3547('0x14')],_0x3de4dc['options']?_0x3de4dc['options'][_0x3547('0x15')](''):''),'priority':_0x4377e7++},_0x428445));if(_0x3de4dc[_0x3547('0xb')]){_0x2d5013[_0x3547('0xc')](_[_0x3547('0x10')]({'app':_0x3547('0x16'),'priority':_0x4377e7++},_0x428445));}return _0x2d5013;};var getChanSpyApplications=function(_0x465a11,_0x3221c0){var _0x17f8b1=[];for(var _0x16b6c7=0x0,_0x487a34=0x1;_0x16b6c7<_0x3221c0['length'];_0x16b6c7++,_0x487a34=0x1){_0x17f8b1=_0x17f8b1[_0x3547('0x17')](getUserApplications(_0x465a11,_0x3221c0[_0x16b6c7],_0x3221c0[_0x16b6c7][_0x3547('0x18')]));if(_0x3221c0[_0x16b6c7][_0x3547('0x18')]!=_0x3221c0[_0x16b6c7][_0x3547('0x14')]){_0x17f8b1=_0x17f8b1['concat'](getUserApplications(_0x465a11,_0x3221c0[_0x16b6c7],_0x3221c0[_0x16b6c7][_0x3547('0x14')]));}}return _0x17f8b1;};var getChanSpyPromise=function(_0x372940,_0x54e998){return new BPromise(function(_0x968d18,_0x33f8a4){return _0x372940['User'][_0x3547('0x19')]({'attributes':['id',_0x3547('0x14'),_0x3547('0x18')],'where':{'role':_0x3547('0x1a'),'chanspy':!![]},'raw':!![]})[_0x3547('0x1b')](function(_0x2ddf92){if(_0x2ddf92){return _0x968d18(getChanSpyApplications(_0x54e998,_0x2ddf92));}return _0x968d18([]);})['catch'](function(_0x3ec20e){_0x33f8a4(_0x3ec20e);});});};module['exports']=function(_0x16529f,_0x1a9179){var _0x39df4f=_0x16529f[_0x3547('0x1c')];return _0x16529f[_0x3547('0x1d')](_0x3547('0x1e'),attributes,{'tableName':_0x3547('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x355a62,_0x1eaf03,_0x1159e6){return getChanSpyPromise(_0x39df4f,_0x355a62)[_0x3547('0x1b')](function(_0x21e2b4){if(_0x21e2b4&&_0x21e2b4[_0x3547('0x20')]){return _0x39df4f['VoiceExtension'][_0x3547('0x21')](_0x21e2b4);}})['then'](function(){_0x1159e6();})['catch'](function(_0x5d352b){_0x1159e6(_0x5d352b);});},'afterUpdate':function(_0x595e40,_0x57eba3,_0x50865e){return _0x39df4f['VoiceExtension'][_0x3547('0x22')]({'where':{'ChanSpyId':_0x595e40['id']}})[_0x3547('0x1b')](function(){return getChanSpyPromise(_0x39df4f,_0x595e40);})['then'](function(_0x3f3176){if(_0x3f3176&&_0x3f3176[_0x3547('0x20')]){return _0x39df4f[_0x3547('0x23')]['bulkCreate'](_0x3f3176);}})[_0x3547('0x1b')](function(){_0x50865e();})[_0x3547('0x24')](function(_0x54ca15){_0x50865e(_0x54ca15);});},'afterDestroy':function(_0x3168de,_0x344b1e,_0x5935b1){return _0x39df4f[_0x3547('0x23')]['destroy']({'where':{'ChanSpyId':_0x3168de['id']}})[_0x3547('0x1b')](function(){_0x5935b1();})[_0x3547('0x24')](function(_0x26e1af){_0x5935b1(_0x26e1af);});}}});}; \ No newline at end of file +var _0xe39a=['models','VoiceChanSpy','destroy','VoiceExtension','bulkCreate','lodash','util','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','Set','format','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','agent','then','catch','exports'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0xe39a,0x7a));var _0xae39=function(_0x57a234,_0xd3ea21){_0x57a234=_0x57a234-0x0;var _0x4d799f=_0xe39a[_0x57a234];return _0x4d799f;};'use strict';var _=require(_0xae39('0x0'));var util=require(_0xae39('0x1'));var BPromise=require('bluebird');var attributes=require(_0xae39('0x2'));var getUserApplications=function(_0x279f2a,_0x293901,_0xb378d2){var _0x345c30=0x1;var _0xead729=[];var _0x37f001={'context':_0x293901[_0xae39('0x3')]||_0xae39('0x4'),'exten':util['format'](_0xae39('0x5'),_0x279f2a[_0xae39('0x6')],_0xb378d2),'type':_0xae39('0x7'),'isApp':![],'ChanSpyId':_0x279f2a['id'],'UserId':_0x293901['id']};_0xead729[_0xae39('0x8')](_['merge']({'app':_0xae39('0x9'),'appdata':util[_0xae39('0xa')]('CDR(type)=%s',_0xae39('0xb')),'priority':_0x345c30++},_0x37f001));if(_0x279f2a[_0xae39('0xc')]){_0xead729[_0xae39('0x8')](_[_0xae39('0xd')]({'app':_0xae39('0xe'),'appdata':util[_0xae39('0xa')](_0xae39('0xf'),_0x279f2a[_0xae39('0x10')]),'priority':_0x345c30++},_0x37f001));}if(_0x279f2a[_0xae39('0x11')]){_0xead729[_0xae39('0x8')](_['merge']({'app':_0xae39('0x12'),'appdata':_0x279f2a[_0xae39('0x13')],'priority':_0x345c30++},_0x37f001));}_0xead729['push'](_['merge']({'app':_0xae39('0x14'),'appdata':util[_0xae39('0xa')](_0xae39('0x15'),_0x293901[_0xae39('0x16')],_0x279f2a[_0xae39('0x17')]?_0x279f2a['options'][_0xae39('0x18')](''):''),'priority':_0x345c30++},_0x37f001));if(_0x279f2a['record']){_0xead729[_0xae39('0x8')](_[_0xae39('0xd')]({'app':_0xae39('0x19'),'priority':_0x345c30++},_0x37f001));}return _0xead729;};var getChanSpyApplications=function(_0x34bea8,_0x101919){var _0x5a0954=[];for(var _0x266bae=0x0,_0x797fac=0x1;_0x266bae<_0x101919[_0xae39('0x1a')];_0x266bae++,_0x797fac=0x1){_0x5a0954=_0x5a0954[_0xae39('0x1b')](getUserApplications(_0x34bea8,_0x101919[_0x266bae],_0x101919[_0x266bae][_0xae39('0x1c')]));if(_0x101919[_0x266bae][_0xae39('0x1c')]!=_0x101919[_0x266bae]['name']){_0x5a0954=_0x5a0954[_0xae39('0x1b')](getUserApplications(_0x34bea8,_0x101919[_0x266bae],_0x101919[_0x266bae][_0xae39('0x16')]));}}return _0x5a0954;};var getChanSpyPromise=function(_0x3eb328,_0x17f4e7){return new BPromise(function(_0x7d372c,_0x283983){return _0x3eb328[_0xae39('0x1d')]['findAll']({'attributes':['id','name',_0xae39('0x1c')],'where':{'role':_0xae39('0x1e'),'chanspy':!![]},'raw':!![]})[_0xae39('0x1f')](function(_0x187ac9){if(_0x187ac9){return _0x7d372c(getChanSpyApplications(_0x17f4e7,_0x187ac9));}return _0x7d372c([]);})[_0xae39('0x20')](function(_0x528caf){_0x283983(_0x528caf);});});};module[_0xae39('0x21')]=function(_0x360f07,_0x3b3b9b){var _0x4ab066=_0x360f07[_0xae39('0x22')];return _0x360f07['define'](_0xae39('0x23'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x26a927,_0x556aef,_0x1536fd){return getChanSpyPromise(_0x4ab066,_0x26a927)[_0xae39('0x1f')](function(_0x285af0){if(_0x285af0&&_0x285af0['length']){return _0x4ab066['VoiceExtension']['bulkCreate'](_0x285af0);}})[_0xae39('0x1f')](function(){_0x1536fd();})[_0xae39('0x20')](function(_0x113071){_0x1536fd(_0x113071);});},'afterUpdate':function(_0x421f24,_0x49df15,_0x2f5826){return _0x4ab066['VoiceExtension'][_0xae39('0x24')]({'where':{'ChanSpyId':_0x421f24['id']}})['then'](function(){return getChanSpyPromise(_0x4ab066,_0x421f24);})[_0xae39('0x1f')](function(_0x26cbbd){if(_0x26cbbd&&_0x26cbbd['length']){return _0x4ab066[_0xae39('0x25')][_0xae39('0x26')](_0x26cbbd);}})[_0xae39('0x1f')](function(){_0x2f5826();})[_0xae39('0x20')](function(_0x136e2c){_0x2f5826(_0x136e2c);});},'afterDestroy':function(_0x4753b9,_0x2db998,_0x3c6269){return _0x4ab066[_0xae39('0x25')][_0xae39('0x24')]({'where':{'ChanSpyId':_0x4753b9['id']}})[_0xae39('0x1f')](function(){_0x3c6269();})[_0xae39('0x20')](function(_0x15182e){_0x3c6269(_0x15182e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8f8ac58..6cab555 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 _0x9434=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1362d5,_0x59f403){var _0x541b88=function(_0xe46882){while(--_0xe46882){_0x1362d5['push'](_0x1362d5['shift']());}};_0x541b88(++_0x59f403);}(_0x9434,0x168));var _0x4943=function(_0x48531d,_0x2fc156){_0x48531d=_0x48531d-0x0;var _0x1d67ac=_0x9434[_0x48531d];return _0x1d67ac;};'use strict';var _=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var moment=require(_0x4943('0x2'));var BPromise=require(_0x4943('0x3'));var rs=require(_0x4943('0x4'));var fs=require('fs');var Redis=require(_0x4943('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4943('0x6'));var logger=require(_0x4943('0x7'))('rpc');var config=require(_0x4943('0x8'));var jayson=require(_0x4943('0x9'));var client=jayson['client'][_0x4943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56a55a,_0x4da494,_0x3ae08d){return new BPromise(function(_0x2f4119,_0x1876eb){return client[_0x4943('0xb')](_0x56a55a,_0x3ae08d)[_0x4943('0xc')](function(_0x553991){logger['info'](_0x4943('0xd'),_0x4da494,_0x4943('0xe'));logger[_0x4943('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4da494,_0x4943('0xe'),JSON[_0x4943('0x10')](_0x553991));if(_0x553991['error']){if(_0x553991[_0x4943('0x11')]['code']===0x1f4){logger['error'](_0x4943('0xd'),_0x4da494,_0x553991[_0x4943('0x11')][_0x4943('0x12')]);return _0x1876eb(_0x553991[_0x4943('0x11')][_0x4943('0x12')]);}logger[_0x4943('0x11')](_0x4943('0xd'),_0x4da494,_0x553991['error'][_0x4943('0x12')]);return _0x2f4119(_0x553991[_0x4943('0x11')][_0x4943('0x12')]);}else{logger[_0x4943('0x13')](_0x4943('0xd'),_0x4da494,_0x4943('0xe'));_0x2f4119(_0x553991['result'][_0x4943('0x12')]);}})[_0x4943('0x14')](function(_0xb08628){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4da494,_0xb08628);_0x1876eb(_0xb08628);});});} \ No newline at end of file +var _0x263f=['client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0x263f,0x182));var _0xf263=function(_0x4f890c,_0x5f0d98){_0x4f890c=_0x4f890c-0x0;var _0x53cc03=_0x263f[_0x4f890c];return _0x53cc03;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fded6,_0xa2b1b0,_0x9644ab){return new BPromise(function(_0xa2e77e,_0x16ff53){return client['request'](_0x4fded6,_0x9644ab)[_0xf263('0xb')](function(_0x26504c){logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));logger[_0xf263('0xf')](_0xf263('0x10'),_0xa2b1b0,'request\x20sent',JSON[_0xf263('0x11')](_0x26504c));if(_0x26504c['error']){if(_0x26504c[_0xf263('0x12')]['code']===0x1f4){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);return _0x16ff53(_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);}logger[_0xf263('0x12')](_0xf263('0xd'),_0xa2b1b0,_0x26504c['error'][_0xf263('0x13')]);return _0xa2e77e(_0x26504c['error'][_0xf263('0x13')]);}else{logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));_0xa2e77e(_0x26504c[_0xf263('0x14')][_0xf263('0x13')]);}})[_0xf263('0x15')](function(_0x57c655){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x57c655);_0x16ff53(_0x57c655);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 816964a..d2b32bf 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 _0xa89f=['/:id','show','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index'];(function(_0x1d4aa6,_0x1b040c){var _0x26ce6a=function(_0x1268ec){while(--_0x1268ec){_0x1d4aa6['push'](_0x1d4aa6['shift']());}};_0x26ce6a(++_0x1b040c);}(_0xa89f,0xb1));var _0xfa89=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0xa89f[_0x2d364e];return _0x1b9312;};'use strict';var multer=require(_0xfa89('0x0'));var util=require(_0xfa89('0x1'));var path=require(_0xfa89('0x2'));var timeout=require(_0xfa89('0x3'));var express=require(_0xfa89('0x4'));var router=express[_0xfa89('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfa89('0x6'));var interaction=require(_0xfa89('0x7'));var config=require(_0xfa89('0x8'));var controller=require(_0xfa89('0x9'));router[_0xfa89('0xa')]('/',auth[_0xfa89('0xb')](),controller[_0xfa89('0xc')]);router[_0xfa89('0xa')](_0xfa89('0xd'),auth['isAuthenticated'](),controller[_0xfa89('0xe')]);router[_0xfa89('0xf')]('/',auth[_0xfa89('0xb')](),controller['create']);router[_0xfa89('0x10')](_0xfa89('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xfa89('0x11')](_0xfa89('0xd'),auth[_0xfa89('0xb')](),controller['destroy']);module[_0xfa89('0x12')]=router; \ No newline at end of file +var _0x275c=['../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x522dbf,_0x37abca){var _0x5d80d3=function(_0x1d5b4c){while(--_0x1d5b4c){_0x522dbf['push'](_0x522dbf['shift']());}};_0x5d80d3(++_0x37abca);}(_0x275c,0x162));var _0xc275=function(_0x4395e8,_0x51daeb){_0x4395e8=_0x4395e8-0x0;var _0x20886c=_0x275c[_0x4395e8];return _0x20886c;};'use strict';var multer=require(_0xc275('0x0'));var util=require(_0xc275('0x1'));var path=require(_0xc275('0x2'));var timeout=require(_0xc275('0x3'));var express=require(_0xc275('0x4'));var router=express[_0xc275('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc275('0x6'));var interaction=require(_0xc275('0x7'));var config=require(_0xc275('0x8'));var controller=require(_0xc275('0x9'));router['get']('/',auth[_0xc275('0xa')](),controller[_0xc275('0xb')]);router['get'](_0xc275('0xc'),auth[_0xc275('0xa')](),controller['show']);router[_0xc275('0xd')]('/',auth[_0xc275('0xa')](),controller[_0xc275('0xe')]);router[_0xc275('0xf')]('/:id',auth[_0xc275('0xa')](),controller[_0xc275('0x10')]);router[_0xc275('0x11')]('/:id',auth[_0xc275('0xa')](),controller[_0xc275('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 6ef14ed..060c1eb 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 _0x416f=['name','sequelize','exports','STRING'];(function(_0x2f36d2,_0x24285c){var _0x147f7f=function(_0x41db50){while(--_0x41db50){_0x2f36d2['push'](_0x2f36d2['shift']());}};_0x147f7f(++_0x24285c);}(_0x416f,0xf9));var _0xf416=function(_0xa6c033,_0x2d00bf){_0xa6c033=_0xa6c033-0x0;var _0x298714=_0x416f[_0xa6c033];return _0x298714;};'use strict';var Sequelize=require(_0xf416('0x0'));module[_0xf416('0x1')]={'name':{'type':Sequelize[_0xf416('0x2')],'unique':_0xf416('0x3')},'description':{'type':Sequelize[_0xf416('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d65=['STRING','name','BOOLEAN','exports'];(function(_0x5216b9,_0x115733){var _0x565112=function(_0x2bc025){while(--_0x2bc025){_0x5216b9['push'](_0x5216b9['shift']());}};_0x565112(++_0x115733);}(_0x6d65,0x9f));var _0x56d6=function(_0x47ba45,_0x5e325a){_0x47ba45=_0x47ba45-0x0;var _0x352b97=_0x6d65[_0x47ba45];return _0x352b97;};'use strict';var Sequelize=require('sequelize');module[_0x56d6('0x0')]={'name':{'type':Sequelize[_0x56d6('0x1')],'unique':_0x56d6('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x56d6('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 19f72c0..ac208be 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 _0x20cf=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','message','catch','VoiceContext,\x20%s,\x20%s','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','get','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','VoiceContext','includeAll','include','findAll','rows','keys','find','create','body','readFileSync','join','root','utf8','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Contexts','autoAssociation','update','params','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x269cb8,_0x445b2f){var _0x1eb06a=function(_0x328116){while(--_0x328116){_0x269cb8['push'](_0x269cb8['shift']());}};_0x1eb06a(++_0x445b2f);}(_0x20cf,0x181));var _0xf20c=function(_0x37eb8a,_0x53ec7d){_0x37eb8a=_0x37eb8a-0x0;var _0x287b3c=_0x20cf[_0x37eb8a];return _0x287b3c;};'use strict';var emlformat=require(_0xf20c('0x0'));var rimraf=require(_0xf20c('0x1'));var zipdir=require(_0xf20c('0x2'));var jsonpatch=require(_0xf20c('0x3'));var rp=require(_0xf20c('0x4'));var moment=require(_0xf20c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf20c('0x6'));var path=require(_0xf20c('0x7'));var sox=require('sox');var csv=require(_0xf20c('0x8'));var ejs=require(_0xf20c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf20c('0xa'));var squel=require(_0xf20c('0xb'));var crypto=require(_0xf20c('0xc'));var jsforce=require(_0xf20c('0xd'));var deskjs=require(_0xf20c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf20c('0xf'));var Papa=require(_0xf20c('0x10'));var Redis=require(_0xf20c('0x11'));var authService=require(_0xf20c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf20c('0x13'));var hardwareService=require(_0xf20c('0x14'));var logger=require(_0xf20c('0x15'))(_0xf20c('0x16'));var utils=require('../../config/utils');var config=require(_0xf20c('0x17'));var licenseUtil=require(_0xf20c('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf20c('0x19'));var client=jayson[_0xf20c('0x1a')][_0xf20c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x41b3e0,_0x168621,_0x17ef0f,_0x467485){return new BPromise(function(_0xf0266d,_0x8848ab){var _0x22e3a8=_0x467485||client;return _0x22e3a8['request'](_0x41b3e0,_0x17ef0f)[_0xf20c('0x1c')](function(_0x40a00e){logger[_0xf20c('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x168621,_0xf20c('0x1e'));logger[_0xf20c('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x168621,_0xf20c('0x1e'),JSON['stringify'](_0x40a00e));if(_0x40a00e[_0xf20c('0x20')]){if(_0x40a00e['error'][_0xf20c('0x21')]===0x1f4){logger[_0xf20c('0x20')]('VoiceContext,\x20%s,\x20%s',_0x168621,_0x40a00e[_0xf20c('0x20')]['message']);return _0x8848ab(_0x40a00e[_0xf20c('0x20')][_0xf20c('0x22')]);}logger[_0xf20c('0x20')]('VoiceContext,\x20%s,\x20%s',_0x168621,_0x40a00e['error'][_0xf20c('0x22')]);return _0xf0266d(_0x40a00e[_0xf20c('0x20')]['message']);}else{logger[_0xf20c('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x168621,_0xf20c('0x1e'));_0xf0266d(_0x40a00e['result'][_0xf20c('0x22')]);}})[_0xf20c('0x23')](function(_0x5577c9){logger['error'](_0xf20c('0x24'),_0x168621,_0x5577c9);_0x8848ab(_0x5577c9);});});}function respondWithStatusCode(_0x2e7aa1,_0x5b406d){_0x5b406d=_0x5b406d||0xcc;return function(_0x23641c){if(_0x23641c){return _0x2e7aa1[_0xf20c('0x25')](_0x5b406d);}return _0x2e7aa1['status'](_0x5b406d)[_0xf20c('0x26')]();};}function respondWithResult(_0x451834,_0x184421){_0x184421=_0x184421||0xc8;return function(_0x52e071){if(_0x52e071){return _0x451834[_0xf20c('0x27')](_0x184421)[_0xf20c('0x28')](_0x52e071);}};}function respondWithFilteredResult(_0x3af1ad,_0x33e21e){return function(_0x2cf13b){if(_0x2cf13b){var _0x9cfd11=typeof _0x33e21e[_0xf20c('0x29')]===_0xf20c('0x2a')&&typeof _0x33e21e['limit']==='undefined';var _0x22ab70=_0x2cf13b[_0xf20c('0x2b')];var _0x338de8=_0x9cfd11?0x0:_0x33e21e[_0xf20c('0x29')];var _0x581e0e=_0x9cfd11?_0x2cf13b['count']:_0x33e21e[_0xf20c('0x29')]+_0x33e21e[_0xf20c('0x2c')];var _0x12a69d;if(_0x581e0e>=_0x22ab70){_0x581e0e=_0x22ab70;_0x12a69d=0xc8;}else{_0x12a69d=0xce;}_0x3af1ad[_0xf20c('0x27')](_0x12a69d);return _0x3af1ad['set'](_0xf20c('0x2d'),_0x338de8+'-'+_0x581e0e+'/'+_0x22ab70)[_0xf20c('0x28')](_0x2cf13b);}return null;};}function patchUpdates(_0xfed6c5){return function(_0x38f001){try{jsonpatch[_0xf20c('0x2e')](_0x38f001,_0xfed6c5,!![]);}catch(_0x116a65){return BPromise['reject'](_0x116a65);}return _0x38f001[_0xf20c('0x2f')]();};}function saveUpdates(_0x434add,_0x20922e){return function(_0x3804a6){if(_0x3804a6){return _0x3804a6['update'](_0x434add)[_0xf20c('0x1c')](function(_0x5cb4b8){return _0x5cb4b8;});}return null;};}function removeEntity(_0x1a7c8e,_0x1cf15e){return function(_0x48ca9b){if(_0x48ca9b){return _0x48ca9b['destroy']()[_0xf20c('0x1c')](function(){var _0x53492f=_0x48ca9b[_0xf20c('0x30')]({'plain':!![]});var _0xf2bfec='Contexts';return db[_0xf20c('0x31')][_0xf20c('0x32')]({'where':{'type':_0xf2bfec,'resourceId':_0x53492f['id']}})['then'](function(){return _0x48ca9b;});})[_0xf20c('0x1c')](function(){_0x1a7c8e[_0xf20c('0x27')](0xcc)[_0xf20c('0x26')]();});}};}function handleEntityNotFound(_0x29cd03,_0x3cf3ab){return function(_0xd3b666){if(!_0xd3b666){_0x29cd03[_0xf20c('0x25')](0x194);}return _0xd3b666;};}function handleError(_0x1cecf0,_0x4a9ae7){_0x4a9ae7=_0x4a9ae7||0x1f4;return function(_0x50d8fd){logger[_0xf20c('0x20')](_0x50d8fd[_0xf20c('0x33')]);if(_0x50d8fd[_0xf20c('0x34')]){delete _0x50d8fd[_0xf20c('0x34')];}_0x1cecf0[_0xf20c('0x27')](_0x4a9ae7)[_0xf20c('0x35')](_0x50d8fd);};}exports[_0xf20c('0x36')]=function(_0x3c88a1,_0x4de2bd){var _0xc2edab={},_0x484d49={},_0x237caf={'count':0x0,'rows':[]};var _0x3d7d1c=_[_0xf20c('0x37')](db['VoiceContext'][_0xf20c('0x38')],function(_0x19b5c5){return{'name':_0x19b5c5[_0xf20c('0x39')],'type':_0x19b5c5[_0xf20c('0x3a')][_0xf20c('0x3b')]};});_0x484d49[_0xf20c('0x3c')]=_[_0xf20c('0x37')](_0x3d7d1c,_0xf20c('0x34'));_0x484d49['query']=_['keys'](_0x3c88a1['query']);_0x484d49[_0xf20c('0x3d')]=_[_0xf20c('0x3e')](_0x484d49['model'],_0x484d49[_0xf20c('0x3f')]);_0xc2edab[_0xf20c('0x40')]=_['intersection'](_0x484d49[_0xf20c('0x3c')],qs[_0xf20c('0x41')](_0x3c88a1['query']['fields']));_0xc2edab[_0xf20c('0x40')]=_0xc2edab[_0xf20c('0x40')][_0xf20c('0x42')]?_0xc2edab[_0xf20c('0x40')]:_0x484d49[_0xf20c('0x3c')];if(!_0x3c88a1['query'][_0xf20c('0x43')]('nolimit')){_0xc2edab[_0xf20c('0x2c')]=qs['limit'](_0x3c88a1[_0xf20c('0x3f')][_0xf20c('0x2c')]);_0xc2edab['offset']=qs[_0xf20c('0x29')](_0x3c88a1[_0xf20c('0x3f')][_0xf20c('0x29')]);}_0xc2edab['order']=qs[_0xf20c('0x44')](_0x3c88a1[_0xf20c('0x3f')][_0xf20c('0x44')]);_0xc2edab[_0xf20c('0x45')]=qs[_0xf20c('0x3d')](_['pick'](_0x3c88a1[_0xf20c('0x3f')],_0x484d49['filters']),_0x3d7d1c);if(_0x3c88a1[_0xf20c('0x3f')]['filter']){_0xc2edab[_0xf20c('0x45')]=_[_0xf20c('0x46')](_0xc2edab[_0xf20c('0x45')],{'$or':_['map'](_0x3d7d1c,function(_0x13257d){if(_0x13257d['type']!==_0xf20c('0x47')){var _0x2720b7={};_0x2720b7[_0x13257d[_0xf20c('0x34')]]={'$like':'%'+_0x3c88a1[_0xf20c('0x3f')][_0xf20c('0x48')]+'%'};return _0x2720b7;}})});}_0xc2edab=_[_0xf20c('0x46')]({},_0xc2edab,_0x3c88a1[_0xf20c('0x49')]);var _0xe0cadf={'where':_0xc2edab[_0xf20c('0x45')]};return db[_0xf20c('0x4a')][_0xf20c('0x2b')](_0xe0cadf)[_0xf20c('0x1c')](function(_0x5e05fc){_0x237caf[_0xf20c('0x2b')]=_0x5e05fc;if(_0x3c88a1[_0xf20c('0x3f')][_0xf20c('0x4b')]){_0xc2edab[_0xf20c('0x4c')]=[{'all':!![]}];}return db[_0xf20c('0x4a')][_0xf20c('0x4d')](_0xc2edab);})[_0xf20c('0x1c')](function(_0xfe6d00){_0x237caf[_0xf20c('0x4e')]=_0xfe6d00;return _0x237caf;})[_0xf20c('0x1c')](respondWithFilteredResult(_0x4de2bd,_0xc2edab))['catch'](handleError(_0x4de2bd,null));};exports['show']=function(_0x45b863,_0x1bbac7){var _0x2ba28a={'raw':![],'where':{'id':_0x45b863['params']['id']}},_0x193e1d={};_0x193e1d[_0xf20c('0x3c')]=_[_0xf20c('0x4f')](db['VoiceContext'][_0xf20c('0x38')]);_0x193e1d['query']=_[_0xf20c('0x4f')](_0x45b863[_0xf20c('0x3f')]);_0x193e1d[_0xf20c('0x3d')]=_['intersection'](_0x193e1d[_0xf20c('0x3c')],_0x193e1d['query']);_0x2ba28a[_0xf20c('0x40')]=_[_0xf20c('0x3e')](_0x193e1d[_0xf20c('0x3c')],qs['fields'](_0x45b863[_0xf20c('0x3f')][_0xf20c('0x41')]));_0x2ba28a[_0xf20c('0x40')]=_0x2ba28a[_0xf20c('0x40')]['length']?_0x2ba28a[_0xf20c('0x40')]:_0x193e1d[_0xf20c('0x3c')];if(_0x45b863[_0xf20c('0x3f')][_0xf20c('0x4b')]){_0x2ba28a[_0xf20c('0x4c')]=[{'all':!![]}];}_0x2ba28a=_[_0xf20c('0x46')]({},_0x2ba28a,_0x45b863[_0xf20c('0x49')]);return db['VoiceContext'][_0xf20c('0x50')](_0x2ba28a)['then'](handleEntityNotFound(_0x1bbac7,null))[_0xf20c('0x1c')](respondWithResult(_0x1bbac7,null))['catch'](handleError(_0x1bbac7,null));};exports[_0xf20c('0x51')]=function(_0x1f00d4,_0x513a2b,_0x59becd){var _0x26cd7e;return db['VoiceContext']['create'](_0x1f00d4[_0xf20c('0x52')],{'raw':!![]})[_0xf20c('0x1c')](function(_0x3a2263){_0x26cd7e=_0x3a2263;return db[_0xf20c('0x4a')]['findAll']({'raw':!![]});})[_0xf20c('0x1c')](function(_0x4106a8){var _0x12b958=fs[_0xf20c('0x53')](path[_0xf20c('0x54')](config[_0xf20c('0x55')],'server/files/templates/context.ejs'),_0xf20c('0x56'));var _0x4213d9=ejs['render'](_0x12b958,{'contexts':_0x4106a8||[]});fs[_0xf20c('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4213d9);})['then'](function(){return respondWithRpcPromise(_0xf20c('0x58'),_0xf20c('0x51'),{'module':_0xf20c('0x59')});})[_0xf20c('0x1c')](function(){var _0x5d3ede=_0x1f00d4['user'][_0xf20c('0x30')]({'plain':!![]});if(!_0x5d3ede)throw new Error(_0xf20c('0x5a'));if(_0x5d3ede['role']===_0xf20c('0x5b')){var _0x38a85d=_0x26cd7e['get']({'plain':!![]});return db[_0xf20c('0x5c')][_0xf20c('0x50')]({'where':{'name':_0xf20c('0x5d'),'userProfileId':_0x5d3ede['userProfileId']},'raw':!![]})[_0xf20c('0x1c')](function(_0x38d9a3){if(_0x38d9a3&&_0x38d9a3[_0xf20c('0x5e')]===0x0){return db[_0xf20c('0x31')]['create']({'name':_0x38a85d[_0xf20c('0x34')],'resourceId':_0x38a85d['id'],'type':_0x38d9a3[_0xf20c('0x34')],'sectionId':_0x38d9a3['id']},{})[_0xf20c('0x1c')](function(){return _0x26cd7e;});}else{return _0x26cd7e;}})[_0xf20c('0x23')](function(_0xa0c8fa){logger[_0xf20c('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0c8fa);throw _0xa0c8fa;});}return _0x26cd7e;})[_0xf20c('0x1c')](respondWithResult(_0x513a2b,0xc9))[_0xf20c('0x23')](handleError(_0x513a2b,null));};exports[_0xf20c('0x5f')]=function(_0x417396,_0x1158d3,_0x334093){var _0x1ed5c1;return db['VoiceContext']['find']({'where':{'id':_0x417396[_0xf20c('0x60')]['id']}})[_0xf20c('0x1c')](handleEntityNotFound(_0x1158d3,null))['then'](saveUpdates(_0x417396[_0xf20c('0x52')],null))[_0xf20c('0x1c')](function(_0x4d3159){if(_0x4d3159){_0x1ed5c1=_0x4d3159;return db[_0xf20c('0x4a')][_0xf20c('0x4d')]({'raw':!![]});}})['then'](function(_0x456289){var _0x515d4e=fs['readFileSync'](path[_0xf20c('0x54')](config['root'],_0xf20c('0x61')),_0xf20c('0x56'));var _0x59cd6c=ejs[_0xf20c('0x62')](_0x515d4e,{'contexts':_0x456289||[]});fs[_0xf20c('0x57')](_0xf20c('0x63'),_0x59cd6c);})['then'](function(){return respondWithRpcPromise(_0xf20c('0x58'),'update',{'module':_0xf20c('0x59')});})['then'](function(){return _0x1ed5c1;})['then'](respondWithResult(_0x1158d3,null))[_0xf20c('0x23')](handleError(_0x1158d3,null));};exports[_0xf20c('0x32')]=function(_0x17479b,_0x329a43,_0x1bb165){var _0x497f7f;return db['VoiceContext'][_0xf20c('0x50')]({'where':{'id':_0x17479b[_0xf20c('0x60')]['id']}})[_0xf20c('0x1c')](handleEntityNotFound(_0x329a43,null))[_0xf20c('0x1c')](removeEntity(_0x329a43,null))['then'](function(){return db[_0xf20c('0x4a')][_0xf20c('0x4d')]({'raw':!![]});})[_0xf20c('0x1c')](function(_0x3afe59){var _0x24e920=fs[_0xf20c('0x53')](path[_0xf20c('0x54')](config[_0xf20c('0x55')],_0xf20c('0x61')),_0xf20c('0x56'));var _0x576303=ejs[_0xf20c('0x62')](_0x24e920,{'contexts':_0x3afe59});fs[_0xf20c('0x57')](_0xf20c('0x63'),_0x576303);return respondWithRpcPromise(_0xf20c('0x58'),'destroy',{'module':_0xf20c('0x59')});})[_0xf20c('0x23')](handleError(_0x329a43,null));}; \ No newline at end of file +var _0x8c8b=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','writeFileSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','Contexts','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','show','params','find','create','body','findAll','root','server/files/templates/context.ejs','utf8','render','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x8c8b,0x134));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb8c8('0x0'));var rimraf=require(_0xb8c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8c8('0x2'));var rp=require(_0xb8c8('0x3'));var moment=require('moment');var BPromise=require(_0xb8c8('0x4'));var Mustache=require(_0xb8c8('0x5'));var util=require(_0xb8c8('0x6'));var path=require('path');var sox=require(_0xb8c8('0x7'));var csv=require(_0xb8c8('0x8'));var ejs=require(_0xb8c8('0x9'));var fs=require('fs');var fs_extra=require(_0xb8c8('0xa'));var _=require(_0xb8c8('0xb'));var squel=require(_0xb8c8('0xc'));var crypto=require('crypto');var jsforce=require(_0xb8c8('0xd'));var deskjs=require(_0xb8c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb8c8('0xf'));var Papa=require('papaparse');var Redis=require(_0xb8c8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb8c8('0x11'));var as=require(_0xb8c8('0x12'));var hardwareService=require(_0xb8c8('0x13'));var logger=require('../../config/logger')(_0xb8c8('0x14'));var utils=require('../../config/utils');var config=require(_0xb8c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8c8('0x16'))['db'];var jayson=require(_0xb8c8('0x17'));var client=jayson[_0xb8c8('0x18')][_0xb8c8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x311882,_0x167719,_0xba41d0,_0x899242){return new BPromise(function(_0x9534e0,_0x5071b8){var _0x3f8095=_0x899242||client;return _0x3f8095['request'](_0x311882,_0xba41d0)[_0xb8c8('0x1a')](function(_0x27af55){logger['info'](_0xb8c8('0x1b'),_0x167719,_0xb8c8('0x1c'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x167719,_0xb8c8('0x1c'),JSON['stringify'](_0x27af55));if(_0x27af55[_0xb8c8('0x1d')]){if(_0x27af55['error'][_0xb8c8('0x1e')]===0x1f4){logger['error'](_0xb8c8('0x1b'),_0x167719,_0x27af55[_0xb8c8('0x1d')][_0xb8c8('0x1f')]);return _0x5071b8(_0x27af55[_0xb8c8('0x1d')][_0xb8c8('0x1f')]);}logger['error'](_0xb8c8('0x1b'),_0x167719,_0x27af55[_0xb8c8('0x1d')][_0xb8c8('0x1f')]);return _0x9534e0(_0x27af55[_0xb8c8('0x1d')][_0xb8c8('0x1f')]);}else{logger[_0xb8c8('0x20')]('VoiceContext,\x20%s,\x20%s',_0x167719,_0xb8c8('0x1c'));_0x9534e0(_0x27af55['result']['message']);}})[_0xb8c8('0x21')](function(_0x48b3f2){logger[_0xb8c8('0x1d')](_0xb8c8('0x1b'),_0x167719,_0x48b3f2);_0x5071b8(_0x48b3f2);});});}function respondWithStatusCode(_0x266351,_0x26f1e3){_0x26f1e3=_0x26f1e3||0xcc;return function(_0x2c3e9a){if(_0x2c3e9a){return _0x266351[_0xb8c8('0x22')](_0x26f1e3);}return _0x266351[_0xb8c8('0x23')](_0x26f1e3)[_0xb8c8('0x24')]();};}function respondWithResult(_0x4a597c,_0x42f105){_0x42f105=_0x42f105||0xc8;return function(_0x39d428){if(_0x39d428){return _0x4a597c[_0xb8c8('0x23')](_0x42f105)[_0xb8c8('0x25')](_0x39d428);}};}function respondWithFilteredResult(_0x1fd20a,_0x526640){return function(_0x4b3c31){if(_0x4b3c31){var _0x2b559b=typeof _0x526640[_0xb8c8('0x26')]===_0xb8c8('0x27')&&typeof _0x526640['limit']===_0xb8c8('0x27');var _0x5b556a=_0x4b3c31['count'];var _0x249cef=_0x2b559b?0x0:_0x526640['offset'];var _0x482a97=_0x2b559b?_0x4b3c31[_0xb8c8('0x28')]:_0x526640['offset']+_0x526640[_0xb8c8('0x29')];var _0x2896b6;if(_0x482a97>=_0x5b556a){_0x482a97=_0x5b556a;_0x2896b6=0xc8;}else{_0x2896b6=0xce;}_0x1fd20a[_0xb8c8('0x23')](_0x2896b6);return _0x1fd20a[_0xb8c8('0x2a')](_0xb8c8('0x2b'),_0x249cef+'-'+_0x482a97+'/'+_0x5b556a)['json'](_0x4b3c31);}return null;};}function patchUpdates(_0x529f83){return function(_0x371cce){try{jsonpatch[_0xb8c8('0x2c')](_0x371cce,_0x529f83,!![]);}catch(_0x388143){return BPromise['reject'](_0x388143);}return _0x371cce[_0xb8c8('0x2d')]();};}function saveUpdates(_0x53a9fd,_0x4409b7){return function(_0x59b476){if(_0x59b476){return _0x59b476[_0xb8c8('0x2e')](_0x53a9fd)[_0xb8c8('0x1a')](function(_0x2dc245){return _0x2dc245;});}return null;};}function removeEntity(_0xb71890,_0x4b72f6){return function(_0x155530){if(_0x155530){return _0x155530['destroy']()['then'](function(){var _0x4d87ab=_0x155530['get']({'plain':!![]});var _0x1873ba=_0xb8c8('0x2f');return db['UserProfileResource'][_0xb8c8('0x30')]({'where':{'type':_0x1873ba,'resourceId':_0x4d87ab['id']}})['then'](function(){return _0x155530;});})[_0xb8c8('0x1a')](function(){_0xb71890[_0xb8c8('0x23')](0xcc)[_0xb8c8('0x24')]();});}};}function handleEntityNotFound(_0x2b87cb,_0x59231d){return function(_0x3e0891){if(!_0x3e0891){_0x2b87cb['sendStatus'](0x194);}return _0x3e0891;};}function handleError(_0x29aeb0,_0x2c7c4a){_0x2c7c4a=_0x2c7c4a||0x1f4;return function(_0x1d1668){logger['error'](_0x1d1668[_0xb8c8('0x31')]);if(_0x1d1668[_0xb8c8('0x32')]){delete _0x1d1668[_0xb8c8('0x32')];}_0x29aeb0[_0xb8c8('0x23')](_0x2c7c4a)[_0xb8c8('0x33')](_0x1d1668);};}exports[_0xb8c8('0x34')]=function(_0x329398,_0x5c7d31){var _0x5a89a9={},_0x2da0d4={},_0xbe079={'count':0x0,'rows':[]};var _0x1d99c3=_[_0xb8c8('0x35')](db[_0xb8c8('0x36')][_0xb8c8('0x37')],function(_0x257e98){return{'name':_0x257e98[_0xb8c8('0x38')],'type':_0x257e98[_0xb8c8('0x39')][_0xb8c8('0x3a')]};});_0x2da0d4['model']=_[_0xb8c8('0x35')](_0x1d99c3,_0xb8c8('0x32'));_0x2da0d4[_0xb8c8('0x3b')]=_[_0xb8c8('0x3c')](_0x329398[_0xb8c8('0x3b')]);_0x2da0d4[_0xb8c8('0x3d')]=_['intersection'](_0x2da0d4['model'],_0x2da0d4[_0xb8c8('0x3b')]);_0x5a89a9['attributes']=_[_0xb8c8('0x3e')](_0x2da0d4[_0xb8c8('0x3f')],qs[_0xb8c8('0x40')](_0x329398[_0xb8c8('0x3b')][_0xb8c8('0x40')]));_0x5a89a9[_0xb8c8('0x41')]=_0x5a89a9[_0xb8c8('0x41')][_0xb8c8('0x42')]?_0x5a89a9[_0xb8c8('0x41')]:_0x2da0d4[_0xb8c8('0x3f')];if(!_0x329398[_0xb8c8('0x3b')]['hasOwnProperty'](_0xb8c8('0x43'))){_0x5a89a9[_0xb8c8('0x29')]=qs[_0xb8c8('0x29')](_0x329398['query'][_0xb8c8('0x29')]);_0x5a89a9[_0xb8c8('0x26')]=qs[_0xb8c8('0x26')](_0x329398[_0xb8c8('0x3b')]['offset']);}_0x5a89a9[_0xb8c8('0x44')]=qs['sort'](_0x329398[_0xb8c8('0x3b')][_0xb8c8('0x45')]);_0x5a89a9[_0xb8c8('0x46')]=qs[_0xb8c8('0x3d')](_[_0xb8c8('0x47')](_0x329398[_0xb8c8('0x3b')],_0x2da0d4[_0xb8c8('0x3d')]),_0x1d99c3);if(_0x329398[_0xb8c8('0x3b')][_0xb8c8('0x48')]){_0x5a89a9['where']=_[_0xb8c8('0x49')](_0x5a89a9[_0xb8c8('0x46')],{'$or':_['map'](_0x1d99c3,function(_0x17124f){if(_0x17124f[_0xb8c8('0x39')]!=='VIRTUAL'){var _0x526ae8={};_0x526ae8[_0x17124f[_0xb8c8('0x32')]]={'$like':'%'+_0x329398[_0xb8c8('0x3b')][_0xb8c8('0x48')]+'%'};return _0x526ae8;}})});}_0x5a89a9=_['merge']({},_0x5a89a9,_0x329398[_0xb8c8('0x4a')]);var _0x286252={'where':_0x5a89a9[_0xb8c8('0x46')]};return db['VoiceContext']['count'](_0x286252)[_0xb8c8('0x1a')](function(_0x50e3a5){_0xbe079[_0xb8c8('0x28')]=_0x50e3a5;if(_0x329398[_0xb8c8('0x3b')][_0xb8c8('0x4b')]){_0x5a89a9['include']=[{'all':!![]}];}return db[_0xb8c8('0x36')]['findAll'](_0x5a89a9);})[_0xb8c8('0x1a')](function(_0x4afbc1){_0xbe079[_0xb8c8('0x4c')]=_0x4afbc1;return _0xbe079;})['then'](respondWithFilteredResult(_0x5c7d31,_0x5a89a9))['catch'](handleError(_0x5c7d31,null));};exports[_0xb8c8('0x4d')]=function(_0x2a9324,_0x4b88f0){var _0x460159={'raw':![],'where':{'id':_0x2a9324[_0xb8c8('0x4e')]['id']}},_0x19a732={};_0x19a732[_0xb8c8('0x3f')]=_[_0xb8c8('0x3c')](db['VoiceContext'][_0xb8c8('0x37')]);_0x19a732[_0xb8c8('0x3b')]=_[_0xb8c8('0x3c')](_0x2a9324['query']);_0x19a732[_0xb8c8('0x3d')]=_[_0xb8c8('0x3e')](_0x19a732[_0xb8c8('0x3f')],_0x19a732['query']);_0x460159['attributes']=_[_0xb8c8('0x3e')](_0x19a732[_0xb8c8('0x3f')],qs['fields'](_0x2a9324[_0xb8c8('0x3b')]['fields']));_0x460159[_0xb8c8('0x41')]=_0x460159['attributes']['length']?_0x460159['attributes']:_0x19a732[_0xb8c8('0x3f')];if(_0x2a9324[_0xb8c8('0x3b')][_0xb8c8('0x4b')]){_0x460159['include']=[{'all':!![]}];}_0x460159=_[_0xb8c8('0x49')]({},_0x460159,_0x2a9324[_0xb8c8('0x4a')]);return db[_0xb8c8('0x36')][_0xb8c8('0x4f')](_0x460159)['then'](handleEntityNotFound(_0x4b88f0,null))['then'](respondWithResult(_0x4b88f0,null))[_0xb8c8('0x21')](handleError(_0x4b88f0,null));};exports[_0xb8c8('0x50')]=function(_0x561724,_0x5be016,_0x74dece){var _0x31b657;return db[_0xb8c8('0x36')][_0xb8c8('0x50')](_0x561724[_0xb8c8('0x51')],{'raw':!![]})[_0xb8c8('0x1a')](function(_0x634a94){_0x31b657=_0x634a94;return db['VoiceContext'][_0xb8c8('0x52')]({'raw':!![]});})['then'](function(_0xb0a530){var _0x1aed9d=fs['readFileSync'](path['join'](config[_0xb8c8('0x53')],_0xb8c8('0x54')),_0xb8c8('0x55'));var _0x3ac32c=ejs[_0xb8c8('0x56')](_0x1aed9d,{'contexts':_0xb0a530||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3ac32c);})[_0xb8c8('0x1a')](function(){return respondWithRpcPromise(_0xb8c8('0x57'),_0xb8c8('0x50'),{'module':'chan_sip.so'});})[_0xb8c8('0x1a')](function(){var _0x1b3731=_0x561724[_0xb8c8('0x58')][_0xb8c8('0x59')]({'plain':!![]});if(!_0x1b3731)throw new Error(_0xb8c8('0x5a'));if(_0x1b3731[_0xb8c8('0x5b')]==='user'){var _0x3e6c40=_0x31b657['get']({'plain':!![]});return db[_0xb8c8('0x5c')]['find']({'where':{'name':_0xb8c8('0x2f'),'userProfileId':_0x1b3731['userProfileId']},'raw':!![]})[_0xb8c8('0x1a')](function(_0x116d48){if(_0x116d48&&_0x116d48[_0xb8c8('0x5d')]===0x0){return db['UserProfileResource'][_0xb8c8('0x50')]({'name':_0x3e6c40[_0xb8c8('0x32')],'resourceId':_0x3e6c40['id'],'type':_0x116d48[_0xb8c8('0x32')],'sectionId':_0x116d48['id']},{})[_0xb8c8('0x1a')](function(){return _0x31b657;});}else{return _0x31b657;}})[_0xb8c8('0x21')](function(_0x3c6b1c){logger['error'](_0xb8c8('0x5e'),_0x3c6b1c);throw _0x3c6b1c;});}return _0x31b657;})['then'](respondWithResult(_0x5be016,0xc9))[_0xb8c8('0x21')](handleError(_0x5be016,null));};exports[_0xb8c8('0x2e')]=function(_0x34895e,_0x489039,_0x5bcfa4){var _0x373bfd;return db['VoiceContext'][_0xb8c8('0x4f')]({'where':{'id':_0x34895e[_0xb8c8('0x4e')]['id']}})[_0xb8c8('0x1a')](handleEntityNotFound(_0x489039,null))['then'](saveUpdates(_0x34895e[_0xb8c8('0x51')],null))[_0xb8c8('0x1a')](function(_0x37e612){if(_0x37e612){_0x373bfd=_0x37e612;return db[_0xb8c8('0x36')]['findAll']({'raw':!![]});}})[_0xb8c8('0x1a')](function(_0x330b43){var _0x2aafaa=fs[_0xb8c8('0x5f')](path[_0xb8c8('0x60')](config['root'],_0xb8c8('0x54')),'utf8');var _0x290498=ejs[_0xb8c8('0x56')](_0x2aafaa,{'contexts':_0x330b43||[]});fs['writeFileSync'](_0xb8c8('0x61'),_0x290498);})[_0xb8c8('0x1a')](function(){return respondWithRpcPromise(_0xb8c8('0x57'),'update',{'module':_0xb8c8('0x62')});})[_0xb8c8('0x1a')](function(){return _0x373bfd;})[_0xb8c8('0x1a')](respondWithResult(_0x489039,null))[_0xb8c8('0x21')](handleError(_0x489039,null));};exports['destroy']=function(_0x44819d,_0x2836ac,_0x421df9){var _0x416ac1;return db[_0xb8c8('0x36')][_0xb8c8('0x4f')]({'where':{'id':_0x44819d[_0xb8c8('0x4e')]['id']}})[_0xb8c8('0x1a')](handleEntityNotFound(_0x2836ac,null))[_0xb8c8('0x1a')](removeEntity(_0x2836ac,null))[_0xb8c8('0x1a')](function(){return db[_0xb8c8('0x36')][_0xb8c8('0x52')]({'raw':!![]});})[_0xb8c8('0x1a')](function(_0x2a7d5e){var _0x3d352c=fs[_0xb8c8('0x5f')](path['join'](config[_0xb8c8('0x53')],_0xb8c8('0x54')),_0xb8c8('0x55'));var _0x18d639=ejs['render'](_0x3d352c,{'contexts':_0x2a7d5e});fs[_0xb8c8('0x63')](_0xb8c8('0x61'),_0x18d639);return respondWithRpcPromise(_0xb8c8('0x57'),_0xb8c8('0x30'),{'module':_0xb8c8('0x62')});})[_0xb8c8('0x21')](handleError(_0x2836ac,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6a49bc8..46be56d 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 _0x847f=['moment','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','api'];(function(_0x2967b4,_0x9b5a9b){var _0x483322=function(_0x4652d0){while(--_0x4652d0){_0x2967b4['push'](_0x2967b4['shift']());}};_0x483322(++_0x9b5a9b);}(_0x847f,0xb8));var _0xf847=function(_0x469a2d,_0x53bcbe){_0x469a2d=_0x469a2d-0x0;var _0x148147=_0x847f[_0x469a2d];return _0x148147;};'use strict';var _=require(_0xf847('0x0'));var util=require(_0xf847('0x1'));var logger=require('../../config/logger')(_0xf847('0x2'));var moment=require(_0xf847('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf847('0x4'));var rimraf=require(_0xf847('0x5'));var config=require(_0xf847('0x6'));var attributes=require(_0xf847('0x7'));module['exports']=function(_0x57aaf0,_0xf2bc9e){return _0x57aaf0[_0xf847('0x8')](_0xf847('0x9'),attributes,{'tableName':_0xf847('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdea1=['request-promise','path','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5e16ba,_0x362b40){var _0x392b96=function(_0x58c61f){while(--_0x58c61f){_0x5e16ba['push'](_0x5e16ba['shift']());}};_0x392b96(++_0x362b40);}(_0xdea1,0xdf));var _0x1dea=function(_0x2ae4a0,_0x310e91){_0x2ae4a0=_0x2ae4a0-0x0;var _0x5a9f6b=_0xdea1[_0x2ae4a0];return _0x5a9f6b;};'use strict';var _=require(_0x1dea('0x0'));var util=require('util');var logger=require(_0x1dea('0x1'))(_0x1dea('0x2'));var moment=require(_0x1dea('0x3'));var BPromise=require(_0x1dea('0x4'));var rp=require(_0x1dea('0x5'));var fs=require('fs');var path=require(_0x1dea('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1dea('0x7'));module[_0x1dea('0x8')]=function(_0x29ef7f,_0x2fae5f){return _0x29ef7f[_0x1dea('0x9')](_0x1dea('0xa'),attributes,{'tableName':_0x1dea('0xb'),'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 b9c3781..045e2fd 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 _0xfde3=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xbcb6,_0x8e00a9){var _0x58899b=function(_0x35e0c4){while(--_0x35e0c4){_0xbcb6['push'](_0xbcb6['shift']());}};_0x58899b(++_0x8e00a9);}(_0xfde3,0x19f));var _0x3fde=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfde3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3fde('0x0'));var util=require(_0x3fde('0x1'));var moment=require(_0x3fde('0x2'));var BPromise=require(_0x3fde('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fde('0x4'));var db=require(_0x3fde('0x5'))['db'];var utils=require(_0x3fde('0x6'));var logger=require('../../config/logger')(_0x3fde('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3fde('0x8')][_0x3fde('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55ae50,_0x2100d7,_0x72051d){return new BPromise(function(_0x4e44d8,_0x199a48){return client[_0x3fde('0xa')](_0x55ae50,_0x72051d)[_0x3fde('0xb')](function(_0x950123){logger[_0x3fde('0xc')](_0x3fde('0xd'),_0x2100d7,_0x3fde('0xe'));logger[_0x3fde('0xf')](_0x3fde('0x10'),_0x2100d7,_0x3fde('0xe'),JSON[_0x3fde('0x11')](_0x950123));if(_0x950123[_0x3fde('0x12')]){if(_0x950123['error'][_0x3fde('0x13')]===0x1f4){logger['error'](_0x3fde('0xd'),_0x2100d7,_0x950123[_0x3fde('0x12')]['message']);return _0x199a48(_0x950123[_0x3fde('0x12')][_0x3fde('0x14')]);}logger[_0x3fde('0x12')]('VoiceContext,\x20%s,\x20%s',_0x2100d7,_0x950123[_0x3fde('0x12')][_0x3fde('0x14')]);return _0x4e44d8(_0x950123[_0x3fde('0x12')][_0x3fde('0x14')]);}else{logger[_0x3fde('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2100d7,_0x3fde('0xe'));_0x4e44d8(_0x950123[_0x3fde('0x15')][_0x3fde('0x14')]);}})[_0x3fde('0x16')](function(_0x4754f8){logger[_0x3fde('0x12')]('VoiceContext,\x20%s,\x20%s',_0x2100d7,_0x4754f8);_0x199a48(_0x4754f8);});});} \ No newline at end of file +var _0x5761=['util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x31c5fd,_0x33131f){var _0x3799ab=function(_0x1538bf){while(--_0x1538bf){_0x31c5fd['push'](_0x31c5fd['shift']());}};_0x3799ab(++_0x33131f);}(_0x5761,0x107));var _0x1576=function(_0x3c840c,_0x5ac2d0){_0x3c840c=_0x3c840c-0x0;var _0x30b880=_0x5761[_0x3c840c];return _0x30b880;};'use strict';var _=require(_0x1576('0x0'));var util=require(_0x1576('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1576('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1576('0x3'))['db'];var utils=require(_0x1576('0x4'));var logger=require(_0x1576('0x5'))(_0x1576('0x6'));var config=require(_0x1576('0x7'));var jayson=require(_0x1576('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30f503,_0x21d3bd,_0x229cee){return new BPromise(function(_0x1f814b,_0x5ab69b){return client[_0x1576('0x9')](_0x30f503,_0x229cee)[_0x1576('0xa')](function(_0x561917){logger[_0x1576('0xb')]('VoiceContext,\x20%s,\x20%s',_0x21d3bd,'request\x20sent');logger[_0x1576('0xc')](_0x1576('0xd'),_0x21d3bd,_0x1576('0xe'),JSON[_0x1576('0xf')](_0x561917));if(_0x561917[_0x1576('0x10')]){if(_0x561917['error'][_0x1576('0x11')]===0x1f4){logger['error'](_0x1576('0x12'),_0x21d3bd,_0x561917[_0x1576('0x10')][_0x1576('0x13')]);return _0x5ab69b(_0x561917[_0x1576('0x10')][_0x1576('0x13')]);}logger[_0x1576('0x10')](_0x1576('0x12'),_0x21d3bd,_0x561917[_0x1576('0x10')][_0x1576('0x13')]);return _0x1f814b(_0x561917['error'][_0x1576('0x13')]);}else{logger['info'](_0x1576('0x12'),_0x21d3bd,_0x1576('0xe'));_0x1f814b(_0x561917[_0x1576('0x14')][_0x1576('0x13')]);}})[_0x1576('0x15')](function(_0x288749){logger['error'](_0x1576('0x12'),_0x21d3bd,_0x288749);_0x5ab69b(_0x288749);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c758cdc..ef508c6 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 _0xfc45=['destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete'];(function(_0xb95b84,_0x4a0e1f){var _0x35a9fe=function(_0x245da3){while(--_0x245da3){_0xb95b84['push'](_0xb95b84['shift']());}};_0x35a9fe(++_0x4a0e1f);}(_0xfc45,0x16b));var _0x5fc4=function(_0x86907a,_0x1346cf){_0x86907a=_0x86907a-0x0;var _0x226893=_0xfc45[_0x86907a];return _0x226893;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5fc4('0x0'));var timeout=require(_0x5fc4('0x1'));var express=require(_0x5fc4('0x2'));var router=express[_0x5fc4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5fc4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5fc4('0x5'));var controller=require('./voiceDialReport.controller');router[_0x5fc4('0x6')]('/',auth[_0x5fc4('0x7')](),controller[_0x5fc4('0x8')]);router[_0x5fc4('0x6')](_0x5fc4('0x9'),auth[_0x5fc4('0x7')](),controller[_0x5fc4('0xa')]);router[_0x5fc4('0x6')](_0x5fc4('0xb'),auth['isAuthenticated'](),controller[_0x5fc4('0xc')]);router[_0x5fc4('0xd')]('/',auth[_0x5fc4('0x7')](),controller[_0x5fc4('0xe')]);router['put'](_0x5fc4('0xb'),auth[_0x5fc4('0x7')](),controller[_0x5fc4('0xf')]);router[_0x5fc4('0x10')](_0x5fc4('0xb'),auth[_0x5fc4('0x7')](),controller[_0x5fc4('0x11')]);module[_0x5fc4('0x12')]=router; \ No newline at end of file +var _0xb6ec=['express','Router','fs-extra','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','exports','multer','util','path'];(function(_0x4c4683,_0x241657){var _0x78ee7e=function(_0x4c9489){while(--_0x4c9489){_0x4c4683['push'](_0x4c4683['shift']());}};_0x78ee7e(++_0x241657);}(_0xb6ec,0x74));var _0xcb6e=function(_0x57b0a9,_0x7fd7ed){_0x57b0a9=_0x57b0a9-0x0;var _0x28486b=_0xb6ec[_0x57b0a9];return _0x28486b;};'use strict';var multer=require(_0xcb6e('0x0'));var util=require(_0xcb6e('0x1'));var path=require(_0xcb6e('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb6e('0x3'));var router=express[_0xcb6e('0x4')]();var fs_extra=require(_0xcb6e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb6e('0x6'));var config=require('../../config/environment');var controller=require(_0xcb6e('0x7'));router[_0xcb6e('0x8')]('/',auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xa')]);router[_0xcb6e('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xcb6e('0x8')](_0xcb6e('0xb'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xc')]);router['post']('/',auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xd')]);router['put'](_0xcb6e('0xb'),auth['isAuthenticated'](),controller[_0xcb6e('0xe')]);router['delete'](_0xcb6e('0xb'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xf')]);module[_0xcb6e('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index cd4ac79..daf26e4 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 _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x23b1d5,_0x3043fa){var _0x3f5702=function(_0xc9b7eb){while(--_0xc9b7eb){_0x23b1d5['push'](_0x23b1d5['shift']());}};_0x3f5702(++_0x3043fa);}(_0x8ef6,0xf2));var _0x68ef=function(_0x52ba83,_0x21126b){_0x52ba83=_0x52ba83-0x0;var _0x56ec74=_0x8ef6[_0x52ba83];return _0x56ec74;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x54ef,0x112));var _0xf54e=function(_0x4aa902,_0x4b4012){_0x4aa902=_0x4aa902-0x0;var _0x3406f4=_0x54ef[_0x4aa902];return _0x3406f4;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 57b32c7..68c48f9 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 _0x5753=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','count','offset','set','apply','reject','save','destroy','then','end','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5f5b0c,_0x21e7e1){var _0x26f660=function(_0x25e75c){while(--_0x25e75c){_0x5f5b0c['push'](_0x5f5b0c['shift']());}};_0x26f660(++_0x21e7e1);}(_0x5753,0x82));var _0x3575=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5753[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x3575('0x0'));var rimraf=require(_0x3575('0x1'));var zipdir=require(_0x3575('0x2'));var jsonpatch=require(_0x3575('0x3'));var rp=require(_0x3575('0x4'));var moment=require(_0x3575('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3575('0x6'));var util=require(_0x3575('0x7'));var path=require(_0x3575('0x8'));var sox=require(_0x3575('0x9'));var csv=require(_0x3575('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3575('0xb'));var squel=require(_0x3575('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3575('0xd'));var toCsv=require(_0x3575('0xa'));var querystring=require(_0x3575('0xe'));var Papa=require('papaparse');var Redis=require(_0x3575('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3575('0x10'));var as=require(_0x3575('0x11'));var hardwareService=require(_0x3575('0x12'));var logger=require(_0x3575('0x13'))(_0x3575('0x14'));var utils=require('../../config/utils');var config=require(_0x3575('0x15'));var licenseUtil=require(_0x3575('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51a142,_0x104f6d){_0x104f6d=_0x104f6d||0xcc;return function(_0x548909){if(_0x548909){return _0x51a142[_0x3575('0x17')](_0x104f6d);}return _0x51a142['status'](_0x104f6d)['end']();};}function respondWithResult(_0x1f22b4,_0x49a75b){_0x49a75b=_0x49a75b||0xc8;return function(_0xa16773){if(_0xa16773){return _0x1f22b4[_0x3575('0x18')](_0x49a75b)['json'](_0xa16773);}};}function respondWithFilteredResult(_0x5b5cb4,_0x80eae0){return function(_0x396086){if(_0x396086){var _0x38c43f=typeof _0x80eae0['offset']===_0x3575('0x19')&&typeof _0x80eae0[_0x3575('0x1a')]===_0x3575('0x19');var _0x585f52=_0x396086[_0x3575('0x1b')];var _0x1e0eb8=_0x38c43f?0x0:_0x80eae0[_0x3575('0x1c')];var _0xb5e953=_0x38c43f?_0x396086[_0x3575('0x1b')]:_0x80eae0[_0x3575('0x1c')]+_0x80eae0[_0x3575('0x1a')];var _0x589bbb;if(_0xb5e953>=_0x585f52){_0xb5e953=_0x585f52;_0x589bbb=0xc8;}else{_0x589bbb=0xce;}_0x5b5cb4[_0x3575('0x18')](_0x589bbb);return _0x5b5cb4[_0x3575('0x1d')]('Content-Range',_0x1e0eb8+'-'+_0xb5e953+'/'+_0x585f52)['json'](_0x396086);}return null;};}function patchUpdates(_0x2f6ec1){return function(_0x39a18){try{jsonpatch[_0x3575('0x1e')](_0x39a18,_0x2f6ec1,!![]);}catch(_0xe89bd5){return BPromise[_0x3575('0x1f')](_0xe89bd5);}return _0x39a18[_0x3575('0x20')]();};}function saveUpdates(_0x16a37c,_0x5678b8){return function(_0x5a48b1){if(_0x5a48b1){return _0x5a48b1['update'](_0x16a37c)['then'](function(_0x5464c0){return _0x5464c0;});}return null;};}function removeEntity(_0x5b4aa0,_0x2b4dab){return function(_0x16500a){if(_0x16500a){return _0x16500a[_0x3575('0x21')]()[_0x3575('0x22')](function(){_0x5b4aa0[_0x3575('0x18')](0xcc)[_0x3575('0x23')]();});}};}function handleEntityNotFound(_0x2c7f3c,_0x148dc7){return function(_0x232387){if(!_0x232387){_0x2c7f3c['sendStatus'](0x194);}return _0x232387;};}function handleError(_0x34ddca,_0x3dedd9){_0x3dedd9=_0x3dedd9||0x1f4;return function(_0x3e1a52){logger[_0x3575('0x24')](_0x3e1a52[_0x3575('0x25')]);if(_0x3e1a52['name']){delete _0x3e1a52[_0x3575('0x26')];}_0x34ddca['status'](_0x3dedd9)[_0x3575('0x27')](_0x3e1a52);};}exports[_0x3575('0x28')]=function(_0x2d57c9,_0xbfadd5){var _0x5d20f3={},_0x4e6c5a={},_0x681f59={'count':0x0,'rows':[]};var _0x8f4fff=_['map'](db[_0x3575('0x29')][_0x3575('0x2a')],function(_0x3d1e87){return{'name':_0x3d1e87[_0x3575('0x2b')],'type':_0x3d1e87[_0x3575('0x2c')]['key']};});_0x4e6c5a['model']=_[_0x3575('0x2d')](_0x8f4fff,'name');_0x4e6c5a[_0x3575('0x2e')]=_[_0x3575('0x2f')](_0x2d57c9['query']);_0x4e6c5a['filters']=_[_0x3575('0x30')](_0x4e6c5a[_0x3575('0x31')],_0x4e6c5a[_0x3575('0x2e')]);_0x5d20f3[_0x3575('0x32')]=_['intersection'](_0x4e6c5a[_0x3575('0x31')],qs[_0x3575('0x33')](_0x2d57c9['query'][_0x3575('0x33')]));_0x5d20f3[_0x3575('0x32')]=_0x5d20f3['attributes'][_0x3575('0x34')]?_0x5d20f3[_0x3575('0x32')]:_0x4e6c5a[_0x3575('0x31')];if(!_0x2d57c9[_0x3575('0x2e')]['hasOwnProperty'](_0x3575('0x35'))){_0x5d20f3[_0x3575('0x1a')]=qs[_0x3575('0x1a')](_0x2d57c9[_0x3575('0x2e')][_0x3575('0x1a')]);_0x5d20f3[_0x3575('0x1c')]=qs[_0x3575('0x1c')](_0x2d57c9[_0x3575('0x2e')]['offset']);}_0x5d20f3[_0x3575('0x36')]=qs[_0x3575('0x37')](_0x2d57c9[_0x3575('0x2e')]['sort']);_0x5d20f3[_0x3575('0x38')]=qs['filters'](_[_0x3575('0x39')](_0x2d57c9[_0x3575('0x2e')],_0x4e6c5a[_0x3575('0x3a')]),_0x8f4fff);if(_0x2d57c9['query'][_0x3575('0x3b')]){_0x5d20f3[_0x3575('0x38')]=_['merge'](_0x5d20f3['where'],{'$or':_[_0x3575('0x2d')](_0x8f4fff,function(_0x586864){if(_0x586864['type']!==_0x3575('0x3c')){var _0x4b60cb={};_0x4b60cb[_0x586864['name']]={'$like':'%'+_0x2d57c9[_0x3575('0x2e')][_0x3575('0x3b')]+'%'};return _0x4b60cb;}})});}_0x5d20f3=_['merge']({},_0x5d20f3,_0x2d57c9[_0x3575('0x3d')]);var _0x455aba={'where':_0x5d20f3[_0x3575('0x38')]};return db[_0x3575('0x29')][_0x3575('0x1b')](_0x455aba)[_0x3575('0x22')](function(_0x1f1d0e){_0x681f59['count']=_0x1f1d0e;if(_0x2d57c9[_0x3575('0x2e')][_0x3575('0x3e')]){_0x5d20f3[_0x3575('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x3575('0x40')](_0x5d20f3);})[_0x3575('0x22')](function(_0x4c11d9){_0x681f59[_0x3575('0x41')]=_0x4c11d9;return _0x681f59;})[_0x3575('0x22')](respondWithFilteredResult(_0xbfadd5,_0x5d20f3))[_0x3575('0x42')](handleError(_0xbfadd5,null));};exports[_0x3575('0x43')]=function(_0xb9a1,_0xe37168){var _0x1d67e0={'raw':!![],'where':{'id':_0xb9a1[_0x3575('0x44')]['id']}},_0x43eca9={};_0x43eca9[_0x3575('0x31')]=_[_0x3575('0x2f')](db[_0x3575('0x29')]['rawAttributes']);_0x43eca9[_0x3575('0x2e')]=_[_0x3575('0x2f')](_0xb9a1[_0x3575('0x2e')]);_0x43eca9[_0x3575('0x3a')]=_[_0x3575('0x30')](_0x43eca9[_0x3575('0x31')],_0x43eca9['query']);_0x1d67e0[_0x3575('0x32')]=_[_0x3575('0x30')](_0x43eca9['model'],qs[_0x3575('0x33')](_0xb9a1[_0x3575('0x2e')]['fields']));_0x1d67e0[_0x3575('0x32')]=_0x1d67e0[_0x3575('0x32')][_0x3575('0x34')]?_0x1d67e0[_0x3575('0x32')]:_0x43eca9[_0x3575('0x31')];if(_0xb9a1[_0x3575('0x2e')][_0x3575('0x3e')]){_0x1d67e0[_0x3575('0x3f')]=[{'all':!![]}];}_0x1d67e0=_['merge']({},_0x1d67e0,_0xb9a1[_0x3575('0x3d')]);return db[_0x3575('0x29')]['find'](_0x1d67e0)[_0x3575('0x22')](handleEntityNotFound(_0xe37168,null))[_0x3575('0x22')](respondWithResult(_0xe37168,null))[_0x3575('0x42')](handleError(_0xe37168,null));};exports[_0x3575('0x45')]=function(_0x20c46f,_0x15969a){return db[_0x3575('0x29')][_0x3575('0x45')](_0x20c46f[_0x3575('0x46')],{})[_0x3575('0x22')](respondWithResult(_0x15969a,0xc9))[_0x3575('0x42')](handleError(_0x15969a,null));};exports[_0x3575('0x47')]=function(_0x5f4b43,_0x1f4916){if(_0x5f4b43[_0x3575('0x46')]['id']){delete _0x5f4b43[_0x3575('0x46')]['id'];}return db['VoiceDialReport'][_0x3575('0x48')]({'where':{'id':_0x5f4b43['params']['id']}})[_0x3575('0x22')](handleEntityNotFound(_0x1f4916,null))[_0x3575('0x22')](saveUpdates(_0x5f4b43[_0x3575('0x46')],null))[_0x3575('0x22')](respondWithResult(_0x1f4916,null))[_0x3575('0x42')](handleError(_0x1f4916,null));};exports[_0x3575('0x21')]=function(_0x45f2a3,_0x935e38){return db['VoiceDialReport']['find']({'where':{'id':_0x45f2a3[_0x3575('0x44')]['id']}})[_0x3575('0x22')](handleEntityNotFound(_0x935e38,null))[_0x3575('0x22')](removeEntity(_0x935e38,null))[_0x3575('0x42')](handleError(_0x935e38,null));};exports[_0x3575('0x49')]=function(_0x35fa63,_0x30defe){return db[_0x3575('0x29')][_0x3575('0x49')]()[_0x3575('0x22')](respondWithResult(_0x30defe,null))[_0x3575('0x42')](handleError(_0x30defe,null));}; \ No newline at end of file +var _0x0eb0=['destroy','end','error','stack','name','send','map','VoiceDialReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','then'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0eb0,0x1e5));var _0x00eb=function(_0x36671b,_0xd609f4){_0x36671b=_0x36671b-0x0;var _0x42061c=_0x0eb0[_0x36671b];return _0x42061c;};'use strict';var emlformat=require(_0x00eb('0x0'));var rimraf=require(_0x00eb('0x1'));var zipdir=require(_0x00eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x00eb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x00eb('0x4'));var util=require('util');var path=require(_0x00eb('0x5'));var sox=require(_0x00eb('0x6'));var csv=require(_0x00eb('0x7'));var ejs=require(_0x00eb('0x8'));var fs=require('fs');var fs_extra=require(_0x00eb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x00eb('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x00eb('0xb'));var toCsv=require(_0x00eb('0x7'));var querystring=require(_0x00eb('0xc'));var Papa=require('papaparse');var Redis=require(_0x00eb('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x00eb('0xe'));var hardwareService=require(_0x00eb('0xf'));var logger=require(_0x00eb('0x10'))(_0x00eb('0x11'));var utils=require(_0x00eb('0x12'));var config=require(_0x00eb('0x13'));var licenseUtil=require(_0x00eb('0x14'));var db=require(_0x00eb('0x15'))['db'];function respondWithStatusCode(_0xd51f2b,_0x5912d0){_0x5912d0=_0x5912d0||0xcc;return function(_0x1f9ab9){if(_0x1f9ab9){return _0xd51f2b[_0x00eb('0x16')](_0x5912d0);}return _0xd51f2b['status'](_0x5912d0)['end']();};}function respondWithResult(_0x15de2c,_0x143da7){_0x143da7=_0x143da7||0xc8;return function(_0x248dfd){if(_0x248dfd){return _0x15de2c[_0x00eb('0x17')](_0x143da7)[_0x00eb('0x18')](_0x248dfd);}};}function respondWithFilteredResult(_0x47baa3,_0x3691c1){return function(_0x51f894){if(_0x51f894){var _0xe2dac6=typeof _0x3691c1[_0x00eb('0x19')]===_0x00eb('0x1a')&&typeof _0x3691c1[_0x00eb('0x1b')]===_0x00eb('0x1a');var _0x1383dd=_0x51f894[_0x00eb('0x1c')];var _0x117bc3=_0xe2dac6?0x0:_0x3691c1['offset'];var _0x357b11=_0xe2dac6?_0x51f894[_0x00eb('0x1c')]:_0x3691c1[_0x00eb('0x19')]+_0x3691c1[_0x00eb('0x1b')];var _0x2ed692;if(_0x357b11>=_0x1383dd){_0x357b11=_0x1383dd;_0x2ed692=0xc8;}else{_0x2ed692=0xce;}_0x47baa3['status'](_0x2ed692);return _0x47baa3['set']('Content-Range',_0x117bc3+'-'+_0x357b11+'/'+_0x1383dd)[_0x00eb('0x18')](_0x51f894);}return null;};}function patchUpdates(_0x58b6e1){return function(_0x59bfcf){try{jsonpatch['apply'](_0x59bfcf,_0x58b6e1,!![]);}catch(_0x34d626){return BPromise[_0x00eb('0x1d')](_0x34d626);}return _0x59bfcf[_0x00eb('0x1e')]();};}function saveUpdates(_0x32de09,_0x4e3356){return function(_0x2c987b){if(_0x2c987b){return _0x2c987b[_0x00eb('0x1f')](_0x32de09)[_0x00eb('0x20')](function(_0x1a219e){return _0x1a219e;});}return null;};}function removeEntity(_0x14cac9,_0x183a69){return function(_0x1623b8){if(_0x1623b8){return _0x1623b8[_0x00eb('0x21')]()[_0x00eb('0x20')](function(){_0x14cac9[_0x00eb('0x17')](0xcc)[_0x00eb('0x22')]();});}};}function handleEntityNotFound(_0x1bca65,_0x53f989){return function(_0x38d586){if(!_0x38d586){_0x1bca65[_0x00eb('0x16')](0x194);}return _0x38d586;};}function handleError(_0x158f7e,_0x294b29){_0x294b29=_0x294b29||0x1f4;return function(_0x33ee0f){logger[_0x00eb('0x23')](_0x33ee0f[_0x00eb('0x24')]);if(_0x33ee0f['name']){delete _0x33ee0f[_0x00eb('0x25')];}_0x158f7e[_0x00eb('0x17')](_0x294b29)[_0x00eb('0x26')](_0x33ee0f);};}exports['index']=function(_0x587d54,_0x341f5b){var _0x3d850b={},_0x3e024b={},_0x1ca16d={'count':0x0,'rows':[]};var _0x57d17f=_[_0x00eb('0x27')](db[_0x00eb('0x28')]['rawAttributes'],function(_0x379d8b){return{'name':_0x379d8b[_0x00eb('0x29')],'type':_0x379d8b[_0x00eb('0x2a')][_0x00eb('0x2b')]};});_0x3e024b[_0x00eb('0x2c')]=_[_0x00eb('0x27')](_0x57d17f,_0x00eb('0x25'));_0x3e024b[_0x00eb('0x2d')]=_[_0x00eb('0x2e')](_0x587d54[_0x00eb('0x2d')]);_0x3e024b['filters']=_[_0x00eb('0x2f')](_0x3e024b[_0x00eb('0x2c')],_0x3e024b[_0x00eb('0x2d')]);_0x3d850b['attributes']=_['intersection'](_0x3e024b[_0x00eb('0x2c')],qs[_0x00eb('0x30')](_0x587d54['query'][_0x00eb('0x30')]));_0x3d850b['attributes']=_0x3d850b[_0x00eb('0x31')][_0x00eb('0x32')]?_0x3d850b[_0x00eb('0x31')]:_0x3e024b[_0x00eb('0x2c')];if(!_0x587d54[_0x00eb('0x2d')][_0x00eb('0x33')](_0x00eb('0x34'))){_0x3d850b[_0x00eb('0x1b')]=qs['limit'](_0x587d54['query'][_0x00eb('0x1b')]);_0x3d850b[_0x00eb('0x19')]=qs[_0x00eb('0x19')](_0x587d54[_0x00eb('0x2d')][_0x00eb('0x19')]);}_0x3d850b[_0x00eb('0x35')]=qs[_0x00eb('0x36')](_0x587d54[_0x00eb('0x2d')]['sort']);_0x3d850b[_0x00eb('0x37')]=qs[_0x00eb('0x38')](_[_0x00eb('0x39')](_0x587d54[_0x00eb('0x2d')],_0x3e024b['filters']),_0x57d17f);if(_0x587d54[_0x00eb('0x2d')][_0x00eb('0x3a')]){_0x3d850b[_0x00eb('0x37')]=_[_0x00eb('0x3b')](_0x3d850b[_0x00eb('0x37')],{'$or':_['map'](_0x57d17f,function(_0x397de0){if(_0x397de0['type']!==_0x00eb('0x3c')){var _0xccf95={};_0xccf95[_0x397de0[_0x00eb('0x25')]]={'$like':'%'+_0x587d54[_0x00eb('0x2d')]['filter']+'%'};return _0xccf95;}})});}_0x3d850b=_[_0x00eb('0x3b')]({},_0x3d850b,_0x587d54['options']);var _0x257fe5={'where':_0x3d850b[_0x00eb('0x37')]};return db['VoiceDialReport']['count'](_0x257fe5)[_0x00eb('0x20')](function(_0x365ab6){_0x1ca16d['count']=_0x365ab6;if(_0x587d54[_0x00eb('0x2d')][_0x00eb('0x3d')]){_0x3d850b[_0x00eb('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x00eb('0x3f')](_0x3d850b);})[_0x00eb('0x20')](function(_0x2b6b7d){_0x1ca16d[_0x00eb('0x40')]=_0x2b6b7d;return _0x1ca16d;})[_0x00eb('0x20')](respondWithFilteredResult(_0x341f5b,_0x3d850b))[_0x00eb('0x41')](handleError(_0x341f5b,null));};exports[_0x00eb('0x42')]=function(_0x255a5c,_0x155245){var _0x1fd826={'raw':!![],'where':{'id':_0x255a5c['params']['id']}},_0x247e06={};_0x247e06['model']=_[_0x00eb('0x2e')](db[_0x00eb('0x28')][_0x00eb('0x43')]);_0x247e06[_0x00eb('0x2d')]=_['keys'](_0x255a5c[_0x00eb('0x2d')]);_0x247e06[_0x00eb('0x38')]=_[_0x00eb('0x2f')](_0x247e06['model'],_0x247e06[_0x00eb('0x2d')]);_0x1fd826[_0x00eb('0x31')]=_[_0x00eb('0x2f')](_0x247e06[_0x00eb('0x2c')],qs[_0x00eb('0x30')](_0x255a5c[_0x00eb('0x2d')]['fields']));_0x1fd826[_0x00eb('0x31')]=_0x1fd826['attributes'][_0x00eb('0x32')]?_0x1fd826[_0x00eb('0x31')]:_0x247e06[_0x00eb('0x2c')];if(_0x255a5c[_0x00eb('0x2d')][_0x00eb('0x3d')]){_0x1fd826[_0x00eb('0x3e')]=[{'all':!![]}];}_0x1fd826=_[_0x00eb('0x3b')]({},_0x1fd826,_0x255a5c[_0x00eb('0x44')]);return db[_0x00eb('0x28')][_0x00eb('0x45')](_0x1fd826)[_0x00eb('0x20')](handleEntityNotFound(_0x155245,null))[_0x00eb('0x20')](respondWithResult(_0x155245,null))['catch'](handleError(_0x155245,null));};exports[_0x00eb('0x46')]=function(_0xf586d8,_0x3a8180){return db[_0x00eb('0x28')][_0x00eb('0x46')](_0xf586d8[_0x00eb('0x47')],{})[_0x00eb('0x20')](respondWithResult(_0x3a8180,0xc9))[_0x00eb('0x41')](handleError(_0x3a8180,null));};exports[_0x00eb('0x1f')]=function(_0x572e89,_0x44d289){if(_0x572e89['body']['id']){delete _0x572e89['body']['id'];}return db[_0x00eb('0x28')][_0x00eb('0x45')]({'where':{'id':_0x572e89[_0x00eb('0x48')]['id']}})[_0x00eb('0x20')](handleEntityNotFound(_0x44d289,null))[_0x00eb('0x20')](saveUpdates(_0x572e89[_0x00eb('0x47')],null))['then'](respondWithResult(_0x44d289,null))[_0x00eb('0x41')](handleError(_0x44d289,null));};exports[_0x00eb('0x21')]=function(_0x3d1751,_0x433078){return db['VoiceDialReport'][_0x00eb('0x45')]({'where':{'id':_0x3d1751[_0x00eb('0x48')]['id']}})[_0x00eb('0x20')](handleEntityNotFound(_0x433078,null))[_0x00eb('0x20')](removeEntity(_0x433078,null))['catch'](handleError(_0x433078,null));};exports[_0x00eb('0x49')]=function(_0x12ed72,_0x40198b){return db[_0x00eb('0x28')][_0x00eb('0x49')]()[_0x00eb('0x20')](respondWithResult(_0x40198b,null))[_0x00eb('0x41')](handleError(_0x40198b,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1ce071a..65c0aca 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 _0xbfb3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_dial','uniqueid','lodash','util','../../config/logger'];(function(_0x548aa6,_0x48a156){var _0x204e7c=function(_0x14285b){while(--_0x14285b){_0x548aa6['push'](_0x548aa6['shift']());}};_0x204e7c(++_0x48a156);}(_0xbfb3,0xa5));var _0x3bfb=function(_0x15bad4,_0x19bb36){_0x15bad4=_0x15bad4-0x0;var _0x3faf7d=_0xbfb3[_0x15bad4];return _0x3faf7d;};'use strict';var _=require(_0x3bfb('0x0'));var util=require(_0x3bfb('0x1'));var logger=require(_0x3bfb('0x2'))(_0x3bfb('0x3'));var moment=require(_0x3bfb('0x4'));var BPromise=require(_0x3bfb('0x5'));var rp=require(_0x3bfb('0x6'));var fs=require('fs');var path=require(_0x3bfb('0x7'));var rimraf=require(_0x3bfb('0x8'));var config=require(_0x3bfb('0x9'));var attributes=require('./voiceDialReport.attributes');module[_0x3bfb('0xa')]=function(_0x1c86a6,_0x2d23d2){return _0x1c86a6[_0x3bfb('0xb')]('VoiceDialReport',attributes,{'tableName':_0x3bfb('0xc'),'paranoid':![],'indexes':[{'fields':[_0x3bfb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c65=['moment','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api'];(function(_0x3c9e74,_0x4334c5){var _0x4fea21=function(_0x5a2cbb){while(--_0x5a2cbb){_0x3c9e74['push'](_0x3c9e74['shift']());}};_0x4fea21(++_0x4334c5);}(_0x0c65,0x19d));var _0x50c6=function(_0x5ce363,_0x44ee1b){_0x5ce363=_0x5ce363-0x0;var _0x160171=_0x0c65[_0x5ce363];return _0x160171;};'use strict';var _=require(_0x50c6('0x0'));var util=require('util');var logger=require(_0x50c6('0x1'))(_0x50c6('0x2'));var moment=require(_0x50c6('0x3'));var BPromise=require(_0x50c6('0x4'));var rp=require(_0x50c6('0x5'));var fs=require('fs');var path=require(_0x50c6('0x6'));var rimraf=require('rimraf');var config=require(_0x50c6('0x7'));var attributes=require(_0x50c6('0x8'));module['exports']=function(_0x4087c4,_0x55d805){return _0x4087c4[_0x50c6('0x9')](_0x50c6('0xa'),attributes,{'tableName':_0x50c6('0xb'),'paranoid':![],'indexes':[{'fields':[_0x50c6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index f16b256..037a693 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 _0x5dc6=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','attributes','limit'];(function(_0x42572b,_0x259433){var _0x4d50b3=function(_0x17a250){while(--_0x17a250){_0x42572b['push'](_0x42572b['shift']());}};_0x4d50b3(++_0x259433);}(_0x5dc6,0x132));var _0x65dc=function(_0x2852be,_0x3db5b4){_0x2852be=_0x2852be-0x0;var _0x42fa60=_0x5dc6[_0x2852be];return _0x42fa60;};'use strict';var _=require(_0x65dc('0x0'));var util=require(_0x65dc('0x1'));var moment=require(_0x65dc('0x2'));var BPromise=require(_0x65dc('0x3'));var rs=require(_0x65dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65dc('0x5'))['db'];var utils=require(_0x65dc('0x6'));var logger=require(_0x65dc('0x7'))('rpc');var config=require(_0x65dc('0x8'));var jayson=require(_0x65dc('0x9'));var client=jayson[_0x65dc('0xa')][_0x65dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5635cf,_0x411e74,_0x5cf8d2){return new BPromise(function(_0x24a931,_0x52a4c7){return client[_0x65dc('0xc')](_0x5635cf,_0x5cf8d2)[_0x65dc('0xd')](function(_0x4234fb){logger['info'](_0x65dc('0xe'),_0x411e74,_0x65dc('0xf'));logger[_0x65dc('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x411e74,_0x65dc('0xf'),JSON[_0x65dc('0x11')](_0x4234fb));if(_0x4234fb[_0x65dc('0x12')]){if(_0x4234fb['error'][_0x65dc('0x13')]===0x1f4){logger[_0x65dc('0x12')](_0x65dc('0xe'),_0x411e74,_0x4234fb['error'][_0x65dc('0x14')]);return _0x52a4c7(_0x4234fb[_0x65dc('0x12')][_0x65dc('0x14')]);}logger[_0x65dc('0x12')](_0x65dc('0xe'),_0x411e74,_0x4234fb[_0x65dc('0x12')]['message']);return _0x24a931(_0x4234fb[_0x65dc('0x12')]['message']);}else{logger[_0x65dc('0x15')](_0x65dc('0xe'),_0x411e74,_0x65dc('0xf'));_0x24a931(_0x4234fb[_0x65dc('0x16')]['message']);}})[_0x65dc('0x17')](function(_0xfb5b84){logger[_0x65dc('0x12')](_0x65dc('0xe'),_0x411e74,_0xfb5b84);_0x52a4c7(_0xfb5b84);});});}exports[_0x65dc('0x18')]=function(_0x583b5a){var _0x4f494c=this;return new Promise(function(_0x15f50c,_0x2b1dc6){return db[_0x65dc('0x19')][_0x65dc('0x1a')](_0x583b5a[_0x65dc('0x1b')],{'raw':_0x583b5a[_0x65dc('0x1c')]?_0x583b5a[_0x65dc('0x1c')][_0x65dc('0x1d')]===undefined?!![]:![]:!![]})[_0x65dc('0xd')](function(_0x345435){logger[_0x65dc('0x15')]('CreateVoiceDialReport',_0x583b5a);logger['debug'](_0x65dc('0x18'),_0x583b5a,JSON[_0x65dc('0x11')](_0x345435));_0x15f50c(_0x345435);})[_0x65dc('0x17')](function(_0x586202){logger[_0x65dc('0x12')](_0x65dc('0x18'),_0x586202[_0x65dc('0x14')],_0x583b5a);_0x2b1dc6(_0x4f494c[_0x65dc('0x12')](0x1f4,_0x586202[_0x65dc('0x14')]));});});};exports[_0x65dc('0x1e')]=function(_0x4f3628){var _0x1385ce=this;return new Promise(function(_0x5ef06c,_0x580362){return db['VoiceDialReport'][_0x65dc('0x1f')](_0x4f3628[_0x65dc('0x1b')],{'raw':_0x4f3628[_0x65dc('0x1c')]?_0x4f3628[_0x65dc('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f3628['options']?_0x4f3628['options']['where']||null:null,'attributes':_0x4f3628[_0x65dc('0x1c')]?_0x4f3628[_0x65dc('0x1c')][_0x65dc('0x20')]||null:null,'limit':_0x4f3628[_0x65dc('0x1c')]?_0x4f3628[_0x65dc('0x1c')][_0x65dc('0x21')]||null:null})[_0x65dc('0xd')](function(_0x2758ec){logger[_0x65dc('0x15')](_0x65dc('0x1e'),_0x4f3628);logger[_0x65dc('0x10')](_0x65dc('0x1e'),_0x4f3628,JSON[_0x65dc('0x11')](_0x2758ec));_0x5ef06c(_0x2758ec);})['catch'](function(_0x3351a7){logger[_0x65dc('0x12')](_0x65dc('0x1e'),_0x3351a7[_0x65dc('0x14')],_0x4f3628);_0x580362(_0x1385ce['error'](0x1f4,_0x3351a7[_0x65dc('0x14')]));});});}; \ No newline at end of file +var _0x4a9d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceDialReport','body','options','raw','stringify','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a9d,0x137));var _0xd4a9=function(_0x75be6b,_0x2e4f4d){_0x75be6b=_0x75be6b-0x0;var _0x294f32=_0x4a9d[_0x75be6b];return _0x294f32;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd4a9('0x0'));var BPromise=require(_0xd4a9('0x1'));var rs=require(_0xd4a9('0x2'));var fs=require('fs');var Redis=require(_0xd4a9('0x3'));var db=require(_0xd4a9('0x4'))['db'];var utils=require(_0xd4a9('0x5'));var logger=require(_0xd4a9('0x6'))(_0xd4a9('0x7'));var config=require(_0xd4a9('0x8'));var jayson=require(_0xd4a9('0x9'));var client=jayson[_0xd4a9('0xa')][_0xd4a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8f3d71,_0xba3b7b,_0x9090){return new BPromise(function(_0x27adbd,_0x5bb677){return client[_0xd4a9('0xc')](_0x8f3d71,_0x9090)[_0xd4a9('0xd')](function(_0x568381){logger[_0xd4a9('0xe')](_0xd4a9('0xf'),_0xba3b7b,_0xd4a9('0x10'));logger[_0xd4a9('0x11')](_0xd4a9('0x12'),_0xba3b7b,'request\x20sent',JSON['stringify'](_0x568381));if(_0x568381[_0xd4a9('0x13')]){if(_0x568381[_0xd4a9('0x13')][_0xd4a9('0x14')]===0x1f4){logger[_0xd4a9('0x13')](_0xd4a9('0xf'),_0xba3b7b,_0x568381[_0xd4a9('0x13')][_0xd4a9('0x15')]);return _0x5bb677(_0x568381[_0xd4a9('0x13')][_0xd4a9('0x15')]);}logger[_0xd4a9('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0xba3b7b,_0x568381[_0xd4a9('0x13')][_0xd4a9('0x15')]);return _0x27adbd(_0x568381[_0xd4a9('0x13')][_0xd4a9('0x15')]);}else{logger[_0xd4a9('0xe')](_0xd4a9('0xf'),_0xba3b7b,_0xd4a9('0x10'));_0x27adbd(_0x568381[_0xd4a9('0x16')]['message']);}})[_0xd4a9('0x17')](function(_0xc10416){logger[_0xd4a9('0x13')](_0xd4a9('0xf'),_0xba3b7b,_0xc10416);_0x5bb677(_0xc10416);});});}exports[_0xd4a9('0x18')]=function(_0x5457e4){var _0x7334c4=this;return new Promise(function(_0x59d710,_0x1d39ac){return db['VoiceDialReport']['create'](_0x5457e4[_0xd4a9('0x19')],{'raw':_0x5457e4[_0xd4a9('0x1a')]?_0x5457e4[_0xd4a9('0x1a')][_0xd4a9('0x1b')]===undefined?!![]:![]:!![]})[_0xd4a9('0xd')](function(_0x5b4bac){logger['info']('CreateVoiceDialReport',_0x5457e4);logger['debug'](_0xd4a9('0x18'),_0x5457e4,JSON[_0xd4a9('0x1c')](_0x5b4bac));_0x59d710(_0x5b4bac);})[_0xd4a9('0x17')](function(_0x5bbce1){logger['error']('CreateVoiceDialReport',_0x5bbce1['message'],_0x5457e4);_0x1d39ac(_0x7334c4[_0xd4a9('0x13')](0x1f4,_0x5bbce1['message']));});});};exports[_0xd4a9('0x1d')]=function(_0x1c445c){var _0x4dd95f=this;return new Promise(function(_0x179eaf,_0x11a1d6){return db[_0xd4a9('0x1e')][_0xd4a9('0x1f')](_0x1c445c['body'],{'raw':_0x1c445c['options']?_0x1c445c[_0xd4a9('0x1a')][_0xd4a9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c445c[_0xd4a9('0x1a')]?_0x1c445c[_0xd4a9('0x1a')][_0xd4a9('0x20')]||null:null,'attributes':_0x1c445c[_0xd4a9('0x1a')]?_0x1c445c['options'][_0xd4a9('0x21')]||null:null,'limit':_0x1c445c[_0xd4a9('0x1a')]?_0x1c445c[_0xd4a9('0x1a')][_0xd4a9('0x22')]||null:null})[_0xd4a9('0xd')](function(_0x14cd1b){logger[_0xd4a9('0xe')]('UpdateVoiceDialReport',_0x1c445c);logger['debug'](_0xd4a9('0x1d'),_0x1c445c,JSON[_0xd4a9('0x1c')](_0x14cd1b));_0x179eaf(_0x14cd1b);})['catch'](function(_0x25b5f5){logger[_0xd4a9('0x13')](_0xd4a9('0x1d'),_0x25b5f5['message'],_0x1c445c);_0x11a1d6(_0x4dd95f['error'](0x1f4,_0x25b5f5[_0xd4a9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 16fcb05..ea47ef2 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 _0x7b9c=['create','/:id/applications','addApplications','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x7b9c,0xa9));var _0xc7b9=function(_0x506403,_0x367a0a){_0x506403=_0x506403-0x0;var _0x4160f3=_0x7b9c[_0x506403];return _0x4160f3;};'use strict';var multer=require(_0xc7b9('0x0'));var util=require('util');var path=require(_0xc7b9('0x1'));var timeout=require(_0xc7b9('0x2'));var express=require(_0xc7b9('0x3'));var router=express[_0xc7b9('0x4')]();var fs_extra=require(_0xc7b9('0x5'));var auth=require(_0xc7b9('0x6'));var interaction=require(_0xc7b9('0x7'));var config=require(_0xc7b9('0x8'));var controller=require(_0xc7b9('0x9'));router[_0xc7b9('0xa')]('/',auth[_0xc7b9('0xb')](),controller[_0xc7b9('0xc')]);router[_0xc7b9('0xa')]('/:id',auth[_0xc7b9('0xb')](),controller[_0xc7b9('0xd')]);router[_0xc7b9('0xe')]('/',auth['isAuthenticated'](),controller[_0xc7b9('0xf')]);router[_0xc7b9('0xe')](_0xc7b9('0x10'),auth['isAuthenticated'](),controller[_0xc7b9('0x11')]);router['put'](_0xc7b9('0x12'),auth[_0xc7b9('0xb')](),controller[_0xc7b9('0x13')]);router[_0xc7b9('0x14')](_0xc7b9('0x12'),auth[_0xc7b9('0xb')](),controller[_0xc7b9('0x15')]);module[_0xc7b9('0x16')]=router; \ No newline at end of file +var _0x2d8a=['isAuthenticated','index','/:id','show','post','create','/:id/applications','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x5d69a5,_0x1549c7){var _0x153227=function(_0x1f3cba){while(--_0x1f3cba){_0x5d69a5['push'](_0x5d69a5['shift']());}};_0x153227(++_0x1549c7);}(_0x2d8a,0x73));var _0xa2d8=function(_0x19d415,_0x143df5){_0x19d415=_0x19d415-0x0;var _0x59ac43=_0x2d8a[_0x19d415];return _0x59ac43;};'use strict';var multer=require(_0xa2d8('0x0'));var util=require(_0xa2d8('0x1'));var path=require('path');var timeout=require(_0xa2d8('0x2'));var express=require(_0xa2d8('0x3'));var router=express[_0xa2d8('0x4')]();var fs_extra=require(_0xa2d8('0x5'));var auth=require(_0xa2d8('0x6'));var interaction=require(_0xa2d8('0x7'));var config=require(_0xa2d8('0x8'));var controller=require(_0xa2d8('0x9'));router[_0xa2d8('0xa')]('/',auth[_0xa2d8('0xb')](),controller[_0xa2d8('0xc')]);router[_0xa2d8('0xa')](_0xa2d8('0xd'),auth[_0xa2d8('0xb')](),controller[_0xa2d8('0xe')]);router[_0xa2d8('0xf')]('/',auth[_0xa2d8('0xb')](),controller[_0xa2d8('0x10')]);router[_0xa2d8('0xf')](_0xa2d8('0x11'),auth['isAuthenticated'](),controller['addApplications']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa2d8('0x12')]);router[_0xa2d8('0x13')](_0xa2d8('0xd'),auth[_0xa2d8('0xb')](),controller[_0xa2d8('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 2e4a725..b2e91ea 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 _0x2773=['inbound','outbound','internal','inbound-fax','any','*,*,*,*','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','ENUM'];(function(_0x1baa1d,_0x320433){var _0x354965=function(_0x20a0eb){while(--_0x20a0eb){_0x1baa1d['push'](_0x1baa1d['shift']());}};_0x354965(++_0x320433);}(_0x2773,0x163));var _0x3277=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2773[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3277('0x0'));module[_0x3277('0x1')]={'context':{'type':Sequelize[_0x3277('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3277('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x3277('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x3277('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3277('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3277('0x4')](_0x3277('0x5'),_0x3277('0x6'),_0x3277('0x7'),_0x3277('0x8'),'outbound-fax','system',_0x3277('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3277('0x2')],'allowNull':![],'defaultValue':_0x3277('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x3277('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3277('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3277('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x3277('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x3277('0x2')],'defaultValue':_0x3277('0xc')},'answer':{'type':Sequelize[_0x3277('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3277('0xd')],'get':function(_0x5ab84e){return this['getDataValue'](_0x3277('0xe'));}},'alias':{'type':Sequelize[_0x3277('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x83b2=['compositeIndex','STRING','NoOp','ENUM','inbound','outbound','internal','inbound-fax','system','any','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83b2,0x174));var _0x283b=function(_0x268b44,_0x20fe4e){_0x268b44=_0x268b44-0x0;var _0x3bc9de=_0x83b2[_0x268b44];return _0x3bc9de;};'use strict';var Sequelize=require(_0x283b('0x0'));module[_0x283b('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x283b('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x283b('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x283b('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x283b('0x3')],'allowNull':![],'defaultValue':_0x283b('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x283b('0x5')](_0x283b('0x6'),_0x283b('0x7'),_0x283b('0x8'),_0x283b('0x9'),'outbound-fax',_0x283b('0xa'),_0x283b('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x283b('0x3')]},'interval':{'type':Sequelize[_0x283b('0x3')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x283b('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x283b('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x283b('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x283b('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x283b('0xe')],'get':function(_0x367189){return this[_0x283b('0xf')](_0x283b('0x10'));}},'alias':{'type':Sequelize[_0x283b('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 3f7a3dc..d7a8d1e 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 _0x6990=['pick','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','body','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','internal','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','transaction','VoiceExtensionId','rewriteDial','toLowerCase','true','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','filter','map','value','includes','find','UserProfileResource','end','error','name','index','VoiceExtension','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters'];(function(_0x30310e,_0x110335){var _0x559a7f=function(_0x5bb77c){while(--_0x5bb77c){_0x30310e['push'](_0x30310e['shift']());}};_0x559a7f(++_0x110335);}(_0x6990,0x1da));var _0x0699=function(_0x3ef464,_0x4c41e3){_0x3ef464=_0x3ef464-0x0;var _0x50c97a=_0x6990[_0x3ef464];return _0x50c97a;};'use strict';var emlformat=require(_0x0699('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0699('0x1'));var jsonpatch=require(_0x0699('0x2'));var rp=require('request-promise');var moment=require(_0x0699('0x3'));var BPromise=require(_0x0699('0x4'));var Mustache=require(_0x0699('0x5'));var util=require(_0x0699('0x6'));var path=require(_0x0699('0x7'));var sox=require(_0x0699('0x8'));var csv=require(_0x0699('0x9'));var ejs=require(_0x0699('0xa'));var fs=require('fs');var fs_extra=require(_0x0699('0xb'));var _=require('lodash');var squel=require(_0x0699('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0699('0xd'));var toCsv=require(_0x0699('0x9'));var querystring=require(_0x0699('0xe'));var Papa=require(_0x0699('0xf'));var Redis=require('ioredis');var authService=require(_0x0699('0x10'));var qs=require(_0x0699('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0699('0x12'))(_0x0699('0x13'));var utils=require(_0x0699('0x14'));var config=require(_0x0699('0x15'));var licenseUtil=require(_0x0699('0x16'));var db=require(_0x0699('0x17'))['db'];config['redis']=_[_0x0699('0x18')](config[_0x0699('0x19')],{'host':_0x0699('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0699('0x19')]));require('./voiceExtension.socket')[_0x0699('0x1b')](socket);function respondWithStatusCode(_0x17af1c,_0x7c6f28){_0x7c6f28=_0x7c6f28||0xcc;return function(_0x327437){if(_0x327437){return _0x17af1c[_0x0699('0x1c')](_0x7c6f28);}return _0x17af1c[_0x0699('0x1d')](_0x7c6f28)['end']();};}function respondWithResult(_0x37f3d5,_0x568b52){_0x568b52=_0x568b52||0xc8;return function(_0x38e08a){if(_0x38e08a){return _0x37f3d5['status'](_0x568b52)[_0x0699('0x1e')](_0x38e08a);}};}function respondWithFilteredResult(_0x3b530c,_0x11a516){return function(_0x32fe8b){if(_0x32fe8b){var _0x2c97d7=typeof _0x11a516['offset']===_0x0699('0x1f')&&typeof _0x11a516[_0x0699('0x20')]===_0x0699('0x1f');var _0x4e63ce=_0x32fe8b['count'];var _0x470ce9=_0x2c97d7?0x0:_0x11a516[_0x0699('0x21')];var _0x218a59=_0x2c97d7?_0x32fe8b[_0x0699('0x22')]:_0x11a516[_0x0699('0x21')]+_0x11a516[_0x0699('0x20')];var _0x5cd489;if(_0x218a59>=_0x4e63ce){_0x218a59=_0x4e63ce;_0x5cd489=0xc8;}else{_0x5cd489=0xce;}_0x3b530c['status'](_0x5cd489);return _0x3b530c['set'](_0x0699('0x23'),_0x470ce9+'-'+_0x218a59+'/'+_0x4e63ce)[_0x0699('0x1e')](_0x32fe8b);}return null;};}function patchUpdates(_0x4a7c01){return function(_0xe722a8){try{jsonpatch[_0x0699('0x24')](_0xe722a8,_0x4a7c01,!![]);}catch(_0x393e2c){return BPromise[_0x0699('0x25')](_0x393e2c);}return _0xe722a8[_0x0699('0x26')]();};}function saveUpdates(_0x417dd2,_0x461ac6){return function(_0x57dc6b){if(_0x57dc6b){return _0x57dc6b[_0x0699('0x27')](_0x417dd2)[_0x0699('0x28')](function(_0x19bc60){return _0x19bc60;});}return null;};}function removeEntity(_0x15639a,_0x1d9fa1){return function(_0x1ce9dc){if(_0x1ce9dc){return _0x1ce9dc[_0x0699('0x29')]()['then'](function(){var _0x33a656=_0x1ce9dc[_0x0699('0x2a')]({'plain':!![]});var _0x31463c=[{'name':_0x0699('0x2b'),'value':_0x0699('0x2c'),'ignore':![]},{'name':'OutboundRoutes','value':_0x0699('0x2d'),'ignore':![]},{'name':_0x0699('0x2e'),'value':'internal','ignore':![]}];var _0x299271=_(_0x31463c)[_0x0699('0x2f')]('ignore')[_0x0699('0x30')](_0x0699('0x31'))[_0x0699('0x31')]();if(_[_0x0699('0x32')](_0x299271,_0x33a656['type'])){return;}var _0x40fbb0=_[_0x0699('0x33')](_0x31463c,[_0x0699('0x31'),_0x33a656['type']])['name'];return db[_0x0699('0x34')][_0x0699('0x29')]({'where':{'type':_0x40fbb0,'resourceId':_0x33a656['id']}})['then'](function(){return _0x1ce9dc;});})['then'](function(){_0x15639a[_0x0699('0x1d')](0xcc)[_0x0699('0x35')]();});}};}function handleEntityNotFound(_0x35a3c2,_0x106e0f){return function(_0x2f3745){if(!_0x2f3745){_0x35a3c2['sendStatus'](0x194);}return _0x2f3745;};}function handleError(_0x5c72e6,_0x540448){_0x540448=_0x540448||0x1f4;return function(_0x361a2e){logger[_0x0699('0x36')](_0x361a2e['stack']);if(_0x361a2e['name']){delete _0x361a2e[_0x0699('0x37')];}_0x5c72e6['status'](_0x540448)['send'](_0x361a2e);};}exports[_0x0699('0x38')]=function(_0x49febf,_0x520d65){var _0x4a650f={},_0x3425dc={},_0x5acb32={'count':0x0,'rows':[]};var _0x3aa0ca=_[_0x0699('0x30')](db[_0x0699('0x39')][_0x0699('0x3a')],function(_0x1602bb){return{'name':_0x1602bb['fieldName'],'type':_0x1602bb[_0x0699('0x3b')][_0x0699('0x3c')]};});_0x3425dc['model']=_['map'](_0x3aa0ca,_0x0699('0x37'));_0x3425dc[_0x0699('0x3d')]=_[_0x0699('0x3e')](_0x49febf[_0x0699('0x3d')]);_0x3425dc['filters']=_[_0x0699('0x3f')](_0x3425dc[_0x0699('0x40')],_0x3425dc[_0x0699('0x3d')]);_0x4a650f[_0x0699('0x41')]=_['intersection'](_0x3425dc[_0x0699('0x40')],qs[_0x0699('0x42')](_0x49febf[_0x0699('0x3d')][_0x0699('0x42')]));_0x4a650f[_0x0699('0x41')]=_0x4a650f['attributes']['length']?_0x4a650f[_0x0699('0x41')]:_0x3425dc[_0x0699('0x40')];if(!_0x49febf[_0x0699('0x3d')][_0x0699('0x43')](_0x0699('0x44'))){_0x4a650f[_0x0699('0x20')]=qs[_0x0699('0x20')](_0x49febf['query'][_0x0699('0x20')]);_0x4a650f[_0x0699('0x21')]=qs[_0x0699('0x21')](_0x49febf[_0x0699('0x3d')]['offset']);}_0x4a650f['order']=qs[_0x0699('0x45')](_0x49febf[_0x0699('0x3d')]['sort']);_0x4a650f['where']=qs[_0x0699('0x46')](_[_0x0699('0x47')](_0x49febf[_0x0699('0x3d')],_0x3425dc[_0x0699('0x46')]),_0x3aa0ca);if(_0x49febf[_0x0699('0x3d')][_0x0699('0x2f')]){_0x4a650f[_0x0699('0x48')]=_[_0x0699('0x49')](_0x4a650f['where'],{'$or':_['map'](_0x3aa0ca,function(_0x1cd63a){if(_0x1cd63a[_0x0699('0x3b')]!=='VIRTUAL'){var _0x31febd={};_0x31febd[_0x1cd63a['name']]={'$like':'%'+_0x49febf['query'][_0x0699('0x2f')]+'%'};return _0x31febd;}})});}_0x4a650f=_[_0x0699('0x49')]({},_0x4a650f,_0x49febf[_0x0699('0x4a')]);var _0x3e1e8a={'where':_0x4a650f['where']};return db[_0x0699('0x39')][_0x0699('0x22')](_0x3e1e8a)[_0x0699('0x28')](function(_0x371ee2){_0x5acb32[_0x0699('0x22')]=_0x371ee2;if(_0x49febf[_0x0699('0x3d')][_0x0699('0x4b')]){_0x4a650f[_0x0699('0x4c')]=[{'all':!![]}];}return db[_0x0699('0x39')][_0x0699('0x4d')](_0x4a650f);})[_0x0699('0x28')](function(_0x5b08df){_0x5acb32[_0x0699('0x4e')]=_0x5b08df;return _0x5acb32;})[_0x0699('0x28')](respondWithFilteredResult(_0x520d65,_0x4a650f))[_0x0699('0x4f')](handleError(_0x520d65,null));};exports[_0x0699('0x50')]=function(_0x54ab54,_0x2a1b8c){var _0x5f1323={'raw':![],'where':{'id':_0x54ab54[_0x0699('0x51')]['id']}},_0x465dc1={};_0x465dc1['model']=_[_0x0699('0x3e')](db[_0x0699('0x39')][_0x0699('0x3a')]);_0x465dc1[_0x0699('0x3d')]=_[_0x0699('0x3e')](_0x54ab54[_0x0699('0x3d')]);_0x465dc1['filters']=_['intersection'](_0x465dc1[_0x0699('0x40')],_0x465dc1[_0x0699('0x3d')]);_0x5f1323['attributes']=_[_0x0699('0x3f')](_0x465dc1[_0x0699('0x40')],qs[_0x0699('0x42')](_0x54ab54[_0x0699('0x3d')][_0x0699('0x42')]));_0x5f1323[_0x0699('0x41')]=_0x5f1323[_0x0699('0x41')][_0x0699('0x52')]?_0x5f1323[_0x0699('0x41')]:_0x465dc1[_0x0699('0x40')];if(_0x54ab54[_0x0699('0x3d')][_0x0699('0x4b')]){_0x5f1323[_0x0699('0x4c')]=[{'all':!![]}];}_0x5f1323=_[_0x0699('0x49')]({},_0x5f1323,_0x54ab54['options']);return db['VoiceExtension'][_0x0699('0x33')](_0x5f1323)[_0x0699('0x28')](handleEntityNotFound(_0x2a1b8c,null))[_0x0699('0x28')](respondWithResult(_0x2a1b8c,null))['catch'](handleError(_0x2a1b8c,null));};exports[_0x0699('0x29')]=function(_0x1863f3,_0x3ee375){return db[_0x0699('0x39')][_0x0699('0x33')]({'where':{'id':_0x1863f3['params']['id']}})['then'](handleEntityNotFound(_0x3ee375,null))['then'](removeEntity(_0x3ee375,null))['catch'](handleError(_0x3ee375,null));};exports['create']=function(_0x68550b,_0x382ed5){if(_0x68550b[_0x0699('0x53')][_0x0699('0x3b')]==='outbound'&&!_['startsWith'](_0x68550b[_0x0699('0x53')][_0x0699('0x54')],'_')){_0x68550b[_0x0699('0x53')]['exten']='_'['concat'](_0x68550b[_0x0699('0x53')][_0x0699('0x54')]);}return db[_0x0699('0x39')]['create'](_0x68550b[_0x0699('0x53')],{'raw':![]})[_0x0699('0x28')](function(_0x44e1bf){var _0x2c6900=_0x68550b['user']['get']({'plain':!![]});if(!_0x2c6900)throw new Error(_0x0699('0x55'));if(_0x2c6900[_0x0699('0x56')]==='user'){var _0x3c28fb=_0x44e1bf['get']({'plain':!![]});var _0x21a7de=[{'name':'InboundRoutes','value':_0x0699('0x2c')},{'name':_0x0699('0x57'),'value':_0x0699('0x2d')},{'name':_0x0699('0x2e'),'value':_0x0699('0x58')}];var _0xa7691d=_[_0x0699('0x33')](_0x21a7de,['value',_0x3c28fb['type']])[_0x0699('0x37')];return db[_0x0699('0x59')][_0x0699('0x33')]({'where':{'name':_0xa7691d,'userProfileId':_0x2c6900['userProfileId']},'raw':!![]})[_0x0699('0x28')](function(_0xc2211){if(_0xc2211&&_0xc2211[_0x0699('0x5a')]===0x0){return db[_0x0699('0x34')][_0x0699('0x5b')]({'name':_0x3c28fb[_0x0699('0x37')],'resourceId':_0x3c28fb['id'],'type':_0xc2211['name'],'sectionId':_0xc2211['id']},{})[_0x0699('0x28')](function(){return _0x44e1bf;});}else{return _0x44e1bf;}})[_0x0699('0x4f')](function(_0x2ff6e4){logger[_0x0699('0x36')](_0x0699('0x5c'),_0x2ff6e4);throw _0x2ff6e4;});}return _0x44e1bf;})[_0x0699('0x28')](respondWithResult(_0x382ed5,0xc9))[_0x0699('0x4f')](handleError(_0x382ed5,null));};exports[_0x0699('0x27')]=function(_0x41b177,_0x383097){if(_0x41b177[_0x0699('0x53')]['id']){delete _0x41b177[_0x0699('0x53')]['id'];}return db[_0x0699('0x39')]['find']({'where':{'id':_0x41b177[_0x0699('0x51')]['id']}})['then'](handleEntityNotFound(_0x383097,null))['then'](function(_0x20e4ed){if(_0x20e4ed){return db['VoiceExtension']['update'](_[_0x0699('0x47')](_0x41b177[_0x0699('0x53')],[_0x0699('0x54'),_0x0699('0x5d'),'description',_0x0699('0x5e'),_0x0699('0x5f'),_0x0699('0x60'),_0x0699('0x61')]),{'where':{'context':_0x20e4ed['context'],'exten':_0x20e4ed[_0x0699('0x54')]},'individualHooks':!![]})[_0x0699('0x28')](function(_0x417d07){return _0x417d07;});}return null;})['then'](respondWithStatusCode(_0x383097,null))[_0x0699('0x4f')](handleError(_0x383097,null));};exports[_0x0699('0x62')]=function(_0x42ffe3,_0x3ffa30){return db[_0x0699('0x39')][_0x0699('0x63')]({'where':{'id':_0x42ffe3[_0x0699('0x51')]['id']}})['then'](function(_0x240345){if(_0x240345){return db['sequelize'][_0x0699('0x64')](function(_0x1e13ef){return db[_0x0699('0x39')][_0x0699('0x29')]({'where':{'VoiceExtensionId':_0x42ffe3[_0x0699('0x51')]['id']},'transaction':_0x1e13ef})[_0x0699('0x28')](function(){var _0x5a8ecc=_['map'](_0x42ffe3['body'],function(_0x43e5c0){_0x43e5c0[_0x0699('0x65')]=_0x42ffe3[_0x0699('0x51')]['id'];_0x43e5c0['isApp']=!![];return _0x43e5c0;});var _0x3140ea=_0x42ffe3[_0x0699('0x3d')][_0x0699('0x66')]&&_0x42ffe3['query'][_0x0699('0x66')][_0x0699('0x67')]()===_0x0699('0x68')?!![]:![];return _0x240345[_0x0699('0x69')](_0x5a8ecc,_0x3140ea);})[_0x0699('0x28')](function(_0xc67ccd){return db[_0x0699('0x39')][_0x0699('0x6a')](_0xc67ccd,{'transaction':_0x1e13ef});});})[_0x0699('0x28')](function(){return db[_0x0699('0x39')][_0x0699('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x42ffe3['params']['id']},'order':_0x0699('0x6c')});});}})[_0x0699('0x28')](respondWithResult(_0x3ffa30,null))[_0x0699('0x4f')](handleError(_0x3ffa30,null));}; \ No newline at end of file +var _0x0b82=['params','keys','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','rewriteDial','true','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./voiceExtension.socket','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','find','name','UserProfileResource','error','stack','send','index','rawAttributes','type','key','model','intersection','query','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','VoiceExtension','findAll','rows','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b82,0x92));var _0x20b8=function(_0x327b5e,_0x519464){_0x327b5e=_0x327b5e-0x0;var _0x4118fb=_0x0b82[_0x327b5e];return _0x4118fb;};'use strict';var emlformat=require(_0x20b8('0x0'));var rimraf=require(_0x20b8('0x1'));var zipdir=require(_0x20b8('0x2'));var jsonpatch=require(_0x20b8('0x3'));var rp=require(_0x20b8('0x4'));var moment=require(_0x20b8('0x5'));var BPromise=require(_0x20b8('0x6'));var Mustache=require(_0x20b8('0x7'));var util=require(_0x20b8('0x8'));var path=require(_0x20b8('0x9'));var sox=require(_0x20b8('0xa'));var csv=require(_0x20b8('0xb'));var ejs=require(_0x20b8('0xc'));var fs=require('fs');var fs_extra=require(_0x20b8('0xd'));var _=require(_0x20b8('0xe'));var squel=require(_0x20b8('0xf'));var crypto=require(_0x20b8('0x10'));var jsforce=require(_0x20b8('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x20b8('0xb'));var querystring=require('querystring');var Papa=require(_0x20b8('0x12'));var Redis=require(_0x20b8('0x13'));var authService=require(_0x20b8('0x14'));var qs=require(_0x20b8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20b8('0x16'));var logger=require(_0x20b8('0x17'))(_0x20b8('0x18'));var utils=require(_0x20b8('0x19'));var config=require(_0x20b8('0x1a'));var licenseUtil=require(_0x20b8('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x20b8('0x1c')](config[_0x20b8('0x1d')],{'host':_0x20b8('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x20b8('0x1f'))['register'](socket);function respondWithStatusCode(_0x1b66a3,_0x5b864d){_0x5b864d=_0x5b864d||0xcc;return function(_0x39033c){if(_0x39033c){return _0x1b66a3[_0x20b8('0x20')](_0x5b864d);}return _0x1b66a3[_0x20b8('0x21')](_0x5b864d)['end']();};}function respondWithResult(_0x5b88e6,_0x33ee5e){_0x33ee5e=_0x33ee5e||0xc8;return function(_0x1b414f){if(_0x1b414f){return _0x5b88e6[_0x20b8('0x21')](_0x33ee5e)[_0x20b8('0x22')](_0x1b414f);}};}function respondWithFilteredResult(_0x531be1,_0x49ac70){return function(_0x16dadb){if(_0x16dadb){var _0x561e80=typeof _0x49ac70['offset']===_0x20b8('0x23')&&typeof _0x49ac70[_0x20b8('0x24')]===_0x20b8('0x23');var _0x500df2=_0x16dadb[_0x20b8('0x25')];var _0x395593=_0x561e80?0x0:_0x49ac70['offset'];var _0x1bdc81=_0x561e80?_0x16dadb[_0x20b8('0x25')]:_0x49ac70[_0x20b8('0x26')]+_0x49ac70[_0x20b8('0x24')];var _0x16bf3b;if(_0x1bdc81>=_0x500df2){_0x1bdc81=_0x500df2;_0x16bf3b=0xc8;}else{_0x16bf3b=0xce;}_0x531be1[_0x20b8('0x21')](_0x16bf3b);return _0x531be1[_0x20b8('0x27')](_0x20b8('0x28'),_0x395593+'-'+_0x1bdc81+'/'+_0x500df2)[_0x20b8('0x22')](_0x16dadb);}return null;};}function patchUpdates(_0x308a65){return function(_0x2d7ef7){try{jsonpatch[_0x20b8('0x29')](_0x2d7ef7,_0x308a65,!![]);}catch(_0x298ae2){return BPromise[_0x20b8('0x2a')](_0x298ae2);}return _0x2d7ef7[_0x20b8('0x2b')]();};}function saveUpdates(_0x4ede13,_0x312b07){return function(_0x472199){if(_0x472199){return _0x472199['update'](_0x4ede13)[_0x20b8('0x2c')](function(_0x162013){return _0x162013;});}return null;};}function removeEntity(_0x5e6fbf,_0x2322f4){return function(_0x3f3eae){if(_0x3f3eae){return _0x3f3eae[_0x20b8('0x2d')]()['then'](function(){var _0x852325=_0x3f3eae[_0x20b8('0x2e')]({'plain':!![]});var _0x56c1e1=[{'name':_0x20b8('0x2f'),'value':'inbound','ignore':![]},{'name':_0x20b8('0x30'),'value':_0x20b8('0x31'),'ignore':![]},{'name':_0x20b8('0x32'),'value':'internal','ignore':![]}];var _0x33c9b6=_(_0x56c1e1)[_0x20b8('0x33')](_0x20b8('0x34'))[_0x20b8('0x35')](_0x20b8('0x36'))[_0x20b8('0x36')]();if(_[_0x20b8('0x37')](_0x33c9b6,_0x852325['type'])){return;}var _0x269d84=_[_0x20b8('0x38')](_0x56c1e1,[_0x20b8('0x36'),_0x852325['type']])[_0x20b8('0x39')];return db[_0x20b8('0x3a')][_0x20b8('0x2d')]({'where':{'type':_0x269d84,'resourceId':_0x852325['id']}})[_0x20b8('0x2c')](function(){return _0x3f3eae;});})[_0x20b8('0x2c')](function(){_0x5e6fbf[_0x20b8('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b5508,_0xf3aa0b){return function(_0xf83a67){if(!_0xf83a67){_0x3b5508[_0x20b8('0x20')](0x194);}return _0xf83a67;};}function handleError(_0x582050,_0x3eb7e7){_0x3eb7e7=_0x3eb7e7||0x1f4;return function(_0x2bed20){logger[_0x20b8('0x3b')](_0x2bed20[_0x20b8('0x3c')]);if(_0x2bed20[_0x20b8('0x39')]){delete _0x2bed20[_0x20b8('0x39')];}_0x582050['status'](_0x3eb7e7)[_0x20b8('0x3d')](_0x2bed20);};}exports[_0x20b8('0x3e')]=function(_0x2b932a,_0x4b2f3b){var _0x5f02a5={},_0x17d39d={},_0x301338={'count':0x0,'rows':[]};var _0x3490b4=_['map'](db['VoiceExtension'][_0x20b8('0x3f')],function(_0x2eac74){return{'name':_0x2eac74['fieldName'],'type':_0x2eac74[_0x20b8('0x40')][_0x20b8('0x41')]};});_0x17d39d[_0x20b8('0x42')]=_[_0x20b8('0x35')](_0x3490b4,'name');_0x17d39d['query']=_['keys'](_0x2b932a['query']);_0x17d39d['filters']=_[_0x20b8('0x43')](_0x17d39d[_0x20b8('0x42')],_0x17d39d[_0x20b8('0x44')]);_0x5f02a5['attributes']=_[_0x20b8('0x43')](_0x17d39d['model'],qs[_0x20b8('0x45')](_0x2b932a[_0x20b8('0x44')][_0x20b8('0x45')]));_0x5f02a5[_0x20b8('0x46')]=_0x5f02a5[_0x20b8('0x46')]['length']?_0x5f02a5[_0x20b8('0x46')]:_0x17d39d['model'];if(!_0x2b932a[_0x20b8('0x44')]['hasOwnProperty'](_0x20b8('0x47'))){_0x5f02a5[_0x20b8('0x24')]=qs[_0x20b8('0x24')](_0x2b932a[_0x20b8('0x44')]['limit']);_0x5f02a5[_0x20b8('0x26')]=qs['offset'](_0x2b932a[_0x20b8('0x44')][_0x20b8('0x26')]);}_0x5f02a5[_0x20b8('0x48')]=qs[_0x20b8('0x49')](_0x2b932a[_0x20b8('0x44')][_0x20b8('0x49')]);_0x5f02a5[_0x20b8('0x4a')]=qs[_0x20b8('0x4b')](_[_0x20b8('0x4c')](_0x2b932a[_0x20b8('0x44')],_0x17d39d[_0x20b8('0x4b')]),_0x3490b4);if(_0x2b932a[_0x20b8('0x44')][_0x20b8('0x33')]){_0x5f02a5[_0x20b8('0x4a')]=_[_0x20b8('0x4d')](_0x5f02a5[_0x20b8('0x4a')],{'$or':_[_0x20b8('0x35')](_0x3490b4,function(_0x5d7c94){if(_0x5d7c94[_0x20b8('0x40')]!==_0x20b8('0x4e')){var _0x4d2e6a={};_0x4d2e6a[_0x5d7c94[_0x20b8('0x39')]]={'$like':'%'+_0x2b932a[_0x20b8('0x44')][_0x20b8('0x33')]+'%'};return _0x4d2e6a;}})});}_0x5f02a5=_[_0x20b8('0x4d')]({},_0x5f02a5,_0x2b932a[_0x20b8('0x4f')]);var _0x56c70a={'where':_0x5f02a5[_0x20b8('0x4a')]};return db['VoiceExtension']['count'](_0x56c70a)[_0x20b8('0x2c')](function(_0x52cf43){_0x301338['count']=_0x52cf43;if(_0x2b932a[_0x20b8('0x44')][_0x20b8('0x50')]){_0x5f02a5['include']=[{'all':!![]}];}return db[_0x20b8('0x51')][_0x20b8('0x52')](_0x5f02a5);})[_0x20b8('0x2c')](function(_0x4566db){_0x301338[_0x20b8('0x53')]=_0x4566db;return _0x301338;})['then'](respondWithFilteredResult(_0x4b2f3b,_0x5f02a5))[_0x20b8('0x54')](handleError(_0x4b2f3b,null));};exports[_0x20b8('0x55')]=function(_0x39f5af,_0x1411c0){var _0x2441fa={'raw':![],'where':{'id':_0x39f5af[_0x20b8('0x56')]['id']}},_0x5711e8={};_0x5711e8['model']=_[_0x20b8('0x57')](db[_0x20b8('0x51')]['rawAttributes']);_0x5711e8[_0x20b8('0x44')]=_[_0x20b8('0x57')](_0x39f5af[_0x20b8('0x44')]);_0x5711e8[_0x20b8('0x4b')]=_['intersection'](_0x5711e8[_0x20b8('0x42')],_0x5711e8['query']);_0x2441fa[_0x20b8('0x46')]=_[_0x20b8('0x43')](_0x5711e8[_0x20b8('0x42')],qs[_0x20b8('0x45')](_0x39f5af['query'][_0x20b8('0x45')]));_0x2441fa[_0x20b8('0x46')]=_0x2441fa[_0x20b8('0x46')]['length']?_0x2441fa[_0x20b8('0x46')]:_0x5711e8[_0x20b8('0x42')];if(_0x39f5af[_0x20b8('0x44')][_0x20b8('0x50')]){_0x2441fa[_0x20b8('0x58')]=[{'all':!![]}];}_0x2441fa=_[_0x20b8('0x4d')]({},_0x2441fa,_0x39f5af[_0x20b8('0x4f')]);return db[_0x20b8('0x51')][_0x20b8('0x38')](_0x2441fa)[_0x20b8('0x2c')](handleEntityNotFound(_0x1411c0,null))[_0x20b8('0x2c')](respondWithResult(_0x1411c0,null))['catch'](handleError(_0x1411c0,null));};exports[_0x20b8('0x2d')]=function(_0x16471d,_0x1dbed0){return db[_0x20b8('0x51')][_0x20b8('0x38')]({'where':{'id':_0x16471d[_0x20b8('0x56')]['id']}})['then'](handleEntityNotFound(_0x1dbed0,null))['then'](removeEntity(_0x1dbed0,null))[_0x20b8('0x54')](handleError(_0x1dbed0,null));};exports[_0x20b8('0x59')]=function(_0x2c6bf8,_0x507f09){if(_0x2c6bf8[_0x20b8('0x5a')][_0x20b8('0x40')]===_0x20b8('0x31')&&!_[_0x20b8('0x5b')](_0x2c6bf8[_0x20b8('0x5a')][_0x20b8('0x5c')],'_')){_0x2c6bf8['body'][_0x20b8('0x5c')]='_'[_0x20b8('0x5d')](_0x2c6bf8[_0x20b8('0x5a')][_0x20b8('0x5c')]);}return db['VoiceExtension'][_0x20b8('0x59')](_0x2c6bf8[_0x20b8('0x5a')],{'raw':![]})['then'](function(_0x44a66f){var _0x7ff5b1=_0x2c6bf8[_0x20b8('0x5e')][_0x20b8('0x2e')]({'plain':!![]});if(!_0x7ff5b1)throw new Error(_0x20b8('0x5f'));if(_0x7ff5b1[_0x20b8('0x60')]===_0x20b8('0x5e')){var _0x5c8a4c=_0x44a66f[_0x20b8('0x2e')]({'plain':!![]});var _0x67414d=[{'name':'InboundRoutes','value':_0x20b8('0x61')},{'name':_0x20b8('0x30'),'value':_0x20b8('0x31')},{'name':'InternalRoutes','value':'internal'}];var _0x45a380=_[_0x20b8('0x38')](_0x67414d,[_0x20b8('0x36'),_0x5c8a4c[_0x20b8('0x40')]])[_0x20b8('0x39')];return db[_0x20b8('0x62')][_0x20b8('0x38')]({'where':{'name':_0x45a380,'userProfileId':_0x7ff5b1['userProfileId']},'raw':!![]})[_0x20b8('0x2c')](function(_0x6bfe81){if(_0x6bfe81&&_0x6bfe81['autoAssociation']===0x0){return db[_0x20b8('0x3a')][_0x20b8('0x59')]({'name':_0x5c8a4c['name'],'resourceId':_0x5c8a4c['id'],'type':_0x6bfe81['name'],'sectionId':_0x6bfe81['id']},{})[_0x20b8('0x2c')](function(){return _0x44a66f;});}else{return _0x44a66f;}})['catch'](function(_0x4de830){logger[_0x20b8('0x3b')](_0x20b8('0x63'),_0x4de830);throw _0x4de830;});}return _0x44a66f;})['then'](respondWithResult(_0x507f09,0xc9))[_0x20b8('0x54')](handleError(_0x507f09,null));};exports[_0x20b8('0x64')]=function(_0x407fef,_0xa1786){if(_0x407fef[_0x20b8('0x5a')]['id']){delete _0x407fef[_0x20b8('0x5a')]['id'];}return db[_0x20b8('0x51')][_0x20b8('0x38')]({'where':{'id':_0x407fef[_0x20b8('0x56')]['id']}})[_0x20b8('0x2c')](handleEntityNotFound(_0xa1786,null))[_0x20b8('0x2c')](function(_0x4c3a62){if(_0x4c3a62){return db[_0x20b8('0x51')][_0x20b8('0x64')](_['pick'](_0x407fef['body'],[_0x20b8('0x5c'),_0x20b8('0x65'),'description',_0x20b8('0x66'),_0x20b8('0x67'),_0x20b8('0x68'),_0x20b8('0x69')]),{'where':{'context':_0x4c3a62[_0x20b8('0x65')],'exten':_0x4c3a62[_0x20b8('0x5c')]},'individualHooks':!![]})[_0x20b8('0x2c')](function(_0x35998d){return _0x35998d;});}return null;})[_0x20b8('0x2c')](respondWithStatusCode(_0xa1786,null))['catch'](handleError(_0xa1786,null));};exports[_0x20b8('0x6a')]=function(_0x921e14,_0x1bec56){return db[_0x20b8('0x51')][_0x20b8('0x6b')]({'where':{'id':_0x921e14['params']['id']}})['then'](function(_0x591983){if(_0x591983){return db[_0x20b8('0x6c')][_0x20b8('0x6d')](function(_0x2cd237){return db[_0x20b8('0x51')]['destroy']({'where':{'VoiceExtensionId':_0x921e14['params']['id']},'transaction':_0x2cd237})['then'](function(){var _0x16258d=_[_0x20b8('0x35')](_0x921e14[_0x20b8('0x5a')],function(_0x4bafdc){_0x4bafdc[_0x20b8('0x6e')]=_0x921e14[_0x20b8('0x56')]['id'];_0x4bafdc['isApp']=!![];return _0x4bafdc;});var _0x51b639=_0x921e14['query'][_0x20b8('0x6f')]&&_0x921e14[_0x20b8('0x44')]['rewriteDial']['toLowerCase']()===_0x20b8('0x70')?!![]:![];return _0x591983[_0x20b8('0x71')](_0x16258d,_0x51b639);})[_0x20b8('0x2c')](function(_0x24914b){return db[_0x20b8('0x51')][_0x20b8('0x72')](_0x24914b,{'transaction':_0x2cd237});});})[_0x20b8('0x2c')](function(){return db[_0x20b8('0x51')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x921e14['params']['id']},'order':_0x20b8('0x73')});});}})['then'](respondWithResult(_0x1bec56,null))['catch'](handleError(_0x1bec56,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a6a1e68..531c81c 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 _0x7403=['hasOwnProperty','hook','events','VoiceExtension','setMaxListeners','save','update','emit'];(function(_0x3872d7,_0x5a4e9b){var _0x52ff41=function(_0x9c0eaa){while(--_0x9c0eaa){_0x3872d7['push'](_0x3872d7['shift']());}};_0x52ff41(++_0x5a4e9b);}(_0x7403,0x1ba));var _0x3740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7403[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3740('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x3740('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3740('0x2')](0x0);var events={'afterCreate':_0x3740('0x3'),'afterUpdate':_0x3740('0x4'),'afterDestroy':'remove'};function emitEvent(_0x112596){return function(_0x5a9874,_0x16f892,_0x7e869c){VoiceExtensionEvents[_0x3740('0x5')](_0x112596+':'+_0x5a9874['id'],_0x5a9874);VoiceExtensionEvents['emit'](_0x112596,_0x5a9874);_0x7e869c(null);};}for(var e in events){if(events[_0x3740('0x6')](e)){var event=events[e];VoiceExtension[_0x3740('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x3512=['VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1a88f9,_0x3fd16c){var _0x400c80=function(_0x210cc5){while(--_0x210cc5){_0x1a88f9['push'](_0x1a88f9['shift']());}};_0x400c80(++_0x3fd16c);}(_0x3512,0x1b7));var _0x2351=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3512[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x2351('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x2351('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2351('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2351('0x3'),'afterDestroy':_0x2351('0x4')};function emitEvent(_0x48961d){return function(_0x37b138,_0x3bbf95,_0xb96388){VoiceExtensionEvents[_0x2351('0x5')](_0x48961d+':'+_0x37b138['id'],_0x37b138);VoiceExtensionEvents[_0x2351('0x5')](_0x48961d,_0x37b138);_0xb96388(null);};}for(var e in events){if(events[_0x2351('0x6')](e)){var event=events[e];VoiceExtension[_0x2351('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index eb701bf..2f949ce 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 _0xb1c5=['recordingFormat','wav','trunk','timeout','url','length','name','param','split','phone','prefix','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','custom','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','Hangup','util','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT='];(function(_0x4c15e7,_0x4ad7f5){var _0x1f119a=function(_0x5b3da8){while(--_0x5b3da8){_0x4c15e7['push'](_0x4c15e7['shift']());}};_0x1f119a(++_0x4ad7f5);}(_0xb1c5,0x121));var _0x5b1c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb1c5[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0x5b1c('0x0'));var _=require(_0x5b1c('0x1'));var attributes=require(_0x5b1c('0x2'));module[_0x5b1c('0x3')]=function(_0x4fb9b7){var _0x4b0026=_0x4fb9b7[_0x5b1c('0x4')];function _0x17467d(_0x41167a){var _0xc8ad52=0x2;var _0x12748d=[{'type':_0x41167a[_0x5b1c('0x5')],'app':_0x5b1c('0x6'),'appdata':_0x5b1c('0x7')+_0x41167a[_0x5b1c('0x5')],'context':_0x41167a[_0x5b1c('0x8')],'exten':_0x41167a[_0x5b1c('0x9')],'priority':_0xc8ad52++,'VoiceExtensionId':_0x41167a['id']},{'type':_0x41167a[_0x5b1c('0x5')],'app':_0x41167a[_0x5b1c('0xa')]?_0x5b1c('0x6'):_0x5b1c('0xb'),'appdata':_0x41167a[_0x5b1c('0xa')]?_0x5b1c('0xc')+_0x41167a[_0x5b1c('0xa')]:_0x5b1c('0xd'),'context':_0x41167a['context'],'exten':_0x41167a[_0x5b1c('0x9')],'priority':_0xc8ad52++,'VoiceExtensionId':_0x41167a['id']}];if(_0x41167a[_0x5b1c('0x5')]==='inbound'){_0x12748d['push']({'type':_0x5b1c('0xe'),'app':_0x5b1c('0x6'),'appdata':_0x5b1c('0xf')+_0x41167a['id'],'context':_0x41167a[_0x5b1c('0x8')],'exten':_0x41167a[_0x5b1c('0x9')],'priority':_0xc8ad52++,'VoiceExtensionId':_0x41167a['id']});}_0x12748d[_0x5b1c('0x10')]({'type':_0x41167a[_0x5b1c('0x5')],'app':_0x5b1c('0x6'),'appdata':_0x5b1c('0x11'),'context':_0x41167a[_0x5b1c('0x8')],'exten':_0x41167a['exten'],'priority':_0xc8ad52++,'VoiceExtensionId':_0x41167a['id']},{'type':_0x41167a['type'],'app':_0x5b1c('0x6'),'appdata':_0x5b1c('0x12'),'context':_0x41167a['context'],'exten':_0x41167a[_0x5b1c('0x9')],'priority':_0xc8ad52++,'VoiceExtensionId':_0x41167a['id']},{'type':_0x41167a[_0x5b1c('0x5')],'app':_0x5b1c('0x6'),'appdata':_0x5b1c('0x13'),'context':_0x41167a[_0x5b1c('0x8')],'exten':_0x41167a[_0x5b1c('0x9')],'priority':_0xc8ad52++,'VoiceExtensionId':_0x41167a['id']});return _0x12748d;}function _0x397e58(_0x25c4ed){var _0x5e5826=0x2;var _0x137cd8=[{'type':_0x5b1c('0x14'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x25c4ed['context'],'exten':_0x25c4ed[_0x5b1c('0x9')],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':_0x5b1c('0x14'),'app':_0x25c4ed['alias']?_0x5b1c('0x6'):_0x5b1c('0xb'),'appdata':_0x25c4ed[_0x5b1c('0xa')]?_0x5b1c('0xc')+_0x25c4ed[_0x5b1c('0xa')]:_0x5b1c('0xd'),'context':_0x25c4ed[_0x5b1c('0x8')],'exten':_0x25c4ed['exten'],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':'outbound','app':'Set','appdata':_0x5b1c('0x15')+(_0x25c4ed[_0x5b1c('0x16')]?_0x5b1c('0x17')+_0x25c4ed[_0x5b1c('0x16')]+'}':_0x5b1c('0x18')),'context':_0x25c4ed[_0x5b1c('0x8')],'exten':_0x25c4ed['exten'],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':'outbound','app':'Set','appdata':_0x5b1c('0xf')+_0x25c4ed['id'],'context':_0x25c4ed['context'],'exten':_0x25c4ed[_0x5b1c('0x9')],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':'outbound','app':_0x5b1c('0x19'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5e5826+0x2)+'):Goto('+(_0x5e5826+0x1)+')','context':_0x25c4ed['context'],'exten':_0x25c4ed['exten'],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':'outbound','app':_0x5b1c('0x6'),'appdata':_0x25c4ed[_0x5b1c('0x16')]?_0x5b1c('0x1a')+_0x25c4ed[_0x5b1c('0x16')]+'}':'CDR(prefix)=noprefix','context':_0x25c4ed[_0x5b1c('0x8')],'exten':_0x25c4ed[_0x5b1c('0x9')],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':_0x5b1c('0x14'),'app':'Set','appdata':_0x5b1c('0x11'),'context':_0x25c4ed[_0x5b1c('0x8')],'exten':_0x25c4ed[_0x5b1c('0x9')],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':_0x5b1c('0x14'),'app':_0x5b1c('0x6'),'appdata':_0x5b1c('0x12'),'context':_0x25c4ed[_0x5b1c('0x8')],'exten':_0x25c4ed[_0x5b1c('0x9')],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':'outbound','app':_0x5b1c('0x6'),'appdata':'MONITOR_OPTIONS=ab','context':_0x25c4ed[_0x5b1c('0x8')],'exten':_0x25c4ed['exten'],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':_0x5b1c('0x14'),'app':_0x5b1c('0x6'),'appdata':'outboundrouteid='+_0x25c4ed['id'],'context':_0x25c4ed[_0x5b1c('0x8')],'exten':_0x25c4ed[_0x5b1c('0x9')],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']}];if(_0x25c4ed[_0x5b1c('0x1b')]('recordingFormat')&&_0x25c4ed['recordingFormat']!==_0x5b1c('0x1c')){_0x137cd8[_0x5b1c('0x10')]({'type':_0x5b1c('0x14'),'app':_0x5b1c('0x6'),'appdata':_0x5b1c('0x1d'),'context':_0x25c4ed[_0x5b1c('0x8')],'exten':_0x25c4ed[_0x5b1c('0x9')],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']},{'type':_0x5b1c('0x14'),'app':_0x5b1c('0x6'),'appdata':_0x5b1c('0x1e')+_0x25c4ed[_0x5b1c('0x1f')]||_0x5b1c('0x20'),'context':_0x25c4ed[_0x5b1c('0x8')],'exten':_0x25c4ed[_0x5b1c('0x9')],'priority':_0x5e5826++,'VoiceExtensionId':_0x25c4ed['id']});}return _0x137cd8;}function _0x94009b(_0x135815){var _0x4698b4=[{'name':_0x5b1c('0x21'),'param':0x0},{'name':_0x5b1c('0x22'),'param':0x1},{'name':'options','param':0x2},{'name':_0x5b1c('0x23'),'param':0x3}];var _0x475bd5={};var _0x57546f=_0x135815['split'](',');var _0x2f3373=[];for(var _0x3059b2=0x0;_0x3059b2<_0x4698b4[_0x5b1c('0x24')];_0x3059b2++){switch(_0x4698b4[_0x3059b2][_0x5b1c('0x25')]){case _0x5b1c('0x21'):_0x475bd5[_0x5b1c('0x21')]=_0x57546f[_0x4698b4[_0x3059b2][_0x5b1c('0x26')]][_0x5b1c('0x27')]('/')[0x1];_0x475bd5['phone']=_0x57546f[_0x4698b4[_0x3059b2][_0x5b1c('0x26')]][_0x5b1c('0x27')]('/')[0x2];_0x475bd5['prefix']=_0x475bd5[_0x5b1c('0x28')]?_0x475bd5[_0x5b1c('0x28')][_0x5b1c('0x27')]('$')[0x0]:undefined;_0x475bd5[_0x5b1c('0x28')]=route[_0x5b1c('0x16')]?(_0x475bd5[_0x5b1c('0x29')]||'')+_0x5b1c('0x17')+route[_0x5b1c('0x16')]+'}':(_0x475bd5['prefix']||'')+'${EXTEN}';_0x2f3373[_0x4698b4[_0x3059b2][_0x5b1c('0x26')]]=['SIP',_0x475bd5['trunk'],_0x475bd5['phone']][_0x5b1c('0x2a')]('/');break;case _0x5b1c('0x2b'):_0x475bd5[_0x5b1c('0x2b')]=_0x57546f[_0x4698b4[_0x3059b2][_0x5b1c('0x26')]];if(route['recordingFormat']!=='none'){if(_0x475bd5[_0x5b1c('0x2b')][_0x5b1c('0x2c')](_0x5b1c('0x2d'))<0x0){_0x475bd5[_0x5b1c('0x2b')]+=_0x5b1c('0x2d');}}else{_0x475bd5[_0x5b1c('0x2b')]=_0x475bd5['options'][_0x5b1c('0x2e')]('U(xcally-mixmonitor-context)','');}_0x2f3373[_0x4698b4[_0x3059b2]['param']]=_0x475bd5[_0x5b1c('0x2b')];break;default:_0x2f3373[_0x4698b4[_0x3059b2][_0x5b1c('0x26')]]=_0x57546f[_0x4698b4[_0x3059b2]['param']];}}return _0x2f3373['join'](',');}function _0x179fb6(_0x289cc8,_0x3b1cc3,_0x53ae79,_0x3c7f86){return new Promise(function(_0x26bc49,_0x460c6d){var _0x151890=[];if(_[_0x5b1c('0x2f')](_0x3b1cc3))return _0x26bc49(_0x151890);_0x4b0026['Interval'][_0x5b1c('0x30')]({'attributes':['id',_0x5b1c('0x31'),_0x5b1c('0x32')],'raw':!![]})[_0x5b1c('0x33')](function(_0x296ac0){for(var _0x423136=0x0,_0x5bf35c=0x0;_0x423136<_0x3b1cc3[_0x5b1c('0x24')];_0x423136++,_0x5bf35c=0x0){var _0x15756b=_0x3b1cc3[_0x423136];var _0x2c124b=[];var _0x4a1b62=[];if(_0x15756b[_0x5b1c('0x31')]!==_0x5b1c('0x34')){_0x15756b[_0x5b1c('0x35')]=[_0x15756b['interval']];}else{_0x15756b['intervals']=_0x15756b[_0x5b1c('0x32')]?_[_0x5b1c('0x36')](_[_0x5b1c('0x37')](_0x296ac0,{'IntervalId':_0x15756b[_0x5b1c('0x32')]}),_0x5b1c('0x31')):[];}_0x15756b[_0x5b1c('0x8')]=_0x289cc8['context'];_0x15756b[_0x5b1c('0x9')]=_0x289cc8[_0x5b1c('0x9')];if(_0x15756b['type'])_0x15756b['type']=_0x15756b[_0x5b1c('0x5')][_0x5b1c('0x38')]();if(_0x289cc8[_0x5b1c('0x5')]===_0x5b1c('0x14')){if(_0x15756b[_0x5b1c('0x1b')](_0x5b1c('0x39'))&&_0x15756b[_0x5b1c('0x39')]&&_0x15756b['tag']!=='--'){_0x2c124b['push']({'type':_0x15756b[_0x5b1c('0x5')]['toLowerCase'](),'app':_0x5b1c('0x6'),'appdata':'CDR(tag)='+_0x15756b[_0x5b1c('0x39')],'context':_0x289cc8[_0x5b1c('0x8')],'exten':_0x289cc8[_0x5b1c('0x9')],'priority':_0x15756b[_0x5b1c('0x35')]['length']+_0x53ae79+_0x5bf35c++,'VoiceExtensionId':_0x289cc8['id']});}_0x2c124b[_0x5b1c('0x10')]({'type':_0x15756b[_0x5b1c('0x5')]['toLowerCase'](),'app':_0x5b1c('0x19'),'appdata':_0x5b1c('0x3a')+(_0x15756b[_0x5b1c('0x3b')]?_0x5b1c('0x3c')+_0x15756b[_0x5b1c('0x3b')]+')':_0x5b1c('0x3d')),'context':_0x289cc8['context'],'exten':_0x289cc8[_0x5b1c('0x9')],'priority':_0x15756b[_0x5b1c('0x35')][_0x5b1c('0x24')]+_0x53ae79+_0x5bf35c++,'VoiceExtensionId':_0x289cc8['id']});}else{if(_0x15756b[_0x5b1c('0x1b')](_0x5b1c('0x3e'))){if([_0x5b1c('0x3f'),'playback'][_0x5b1c('0x40')](_0x15756b[_0x5b1c('0x41')]['toLowerCase']())&&_0x15756b['appType']!==_0x5b1c('0x42')){if(_0x15756b['answer']){_0x2c124b[_0x5b1c('0x10')]({'type':_0x15756b[_0x5b1c('0x5')]['toLowerCase'](),'app':_0x5b1c('0x19'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x289cc8[_0x5b1c('0x8')],'exten':_0x289cc8[_0x5b1c('0x9')],'priority':_0x15756b[_0x5b1c('0x35')][_0x5b1c('0x24')]+_0x53ae79+_0x5bf35c++,'VoiceExtensionId':_0x289cc8['id']});_0x2c124b[_0x5b1c('0x10')]({'type':_0x15756b[_0x5b1c('0x5')][_0x5b1c('0x38')](),'app':_0x5b1c('0x6'),'appdata':_0x5b1c('0x43'),'context':_0x289cc8['context'],'exten':_0x289cc8[_0x5b1c('0x9')],'priority':_0x15756b[_0x5b1c('0x35')]['length']+_0x53ae79+_0x5bf35c++,'VoiceExtensionId':_0x289cc8['id']});}else{_0x2c124b['push']({'type':_0x15756b[_0x5b1c('0x5')][_0x5b1c('0x38')](),'app':_0x5b1c('0x19'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x289cc8[_0x5b1c('0x8')],'exten':_0x289cc8[_0x5b1c('0x9')],'priority':_0x15756b[_0x5b1c('0x35')][_0x5b1c('0x24')]+_0x53ae79+_0x5bf35c++,'VoiceExtensionId':_0x289cc8['id']});_0x2c124b[_0x5b1c('0x10')]({'type':_0x15756b[_0x5b1c('0x5')]['toLowerCase'](),'app':_0x5b1c('0x6'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x289cc8[_0x5b1c('0x8')],'exten':_0x289cc8['exten'],'priority':_0x15756b['intervals'][_0x5b1c('0x24')]+_0x53ae79+_0x5bf35c++,'VoiceExtensionId':_0x289cc8['id']});}}}}for(var _0x264248=0x0;_0x264248<_0x15756b[_0x5b1c('0x35')][_0x5b1c('0x24')];_0x264248++){var _0x32919b=_0x53ae79+_0x15756b[_0x5b1c('0x35')][_0x5b1c('0x24')];var _0x182469=_0x264248===_0x15756b['intervals'][_0x5b1c('0x24')]-0x1?_0x53ae79+_0x2c124b[_0x5b1c('0x24')]+_0x4a1b62[_0x5b1c('0x24')]+0x2:_0x53ae79+_0x264248+0x1;_0x2c124b[_0x5b1c('0x44')](_0x264248,0x0,{'type':_0x289cc8[_0x5b1c('0x5')],'app':'GotoIfTime','appdata':_0x15756b[_0x5b1c('0x35')][_0x264248]+'?'+_0x289cc8['context']+_0x5b1c('0x45')+_0x32919b+':'+_0x289cc8[_0x5b1c('0x8')]+',${EXTEN},'+_0x182469,'exten':_0x289cc8['exten'],'context':_0x289cc8[_0x5b1c('0x8')],'priority':_0x53ae79+_0x264248,'VoiceExtensionId':_0x289cc8['id']});}if(_0x3c7f86&&_0x15756b[_0x5b1c('0x46')]===_0x5b1c('0x47'))_0x15756b[_0x5b1c('0x48')]=_0x94009b(_0x15756b[_0x5b1c('0x48')]);_0x15756b[_0x5b1c('0x49')]=_0x2c124b[_0x5b1c('0x24')]?_[_0x5b1c('0x4a')](_0x2c124b)[_0x5b1c('0x49')]+0x1:_0x53ae79;_0x151890=_[_0x5b1c('0x4b')](_0x151890,_0x2c124b,[_0x15756b],_0x4a1b62);_0x53ae79=_[_0x5b1c('0x4a')](_0x151890)[_0x5b1c('0x49')]+0x1;}return _0x26bc49(_0x151890);})[_0x5b1c('0x4c')](function(_0x236782){_0x460c6d(_0x236782);});});}return _0x4fb9b7[_0x5b1c('0x4d')](_0x5b1c('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x45cba1,_0x2b724d){var _0x4906ec=this;var _0x287b1f=_0x4906ec[_0x5b1c('0x5')]===_0x5b1c('0x14')?_0x397e58(_0x4906ec):_0x17467d(_0x4906ec);return _0x179fb6(_0x4906ec,_0x45cba1,_[_0x5b1c('0x4a')](_0x287b1f)['priority']+0x1,_0x2b724d)['then'](function(_0xff3046){var _0x44b477=_[_0x5b1c('0x4b')](_0x287b1f,_0xff3046);_0x44b477[_0x5b1c('0x10')]({'type':_0x4906ec[_0x5b1c('0x5')],'app':_0x5b1c('0x4f'),'exten':_0x4906ec[_0x5b1c('0x9')],'context':_0x4906ec[_0x5b1c('0x8')],'priority':_[_0x5b1c('0x4a')](_0x44b477)['priority']+0x1,'VoiceExtensionId':_0x4906ec['id']});return _0x44b477;});}}});}; \ No newline at end of file +var _0xb7d4=['exten','alias','CDR(routeAlias)=','CDR(routeid)=','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','param','phone','prefix','${EXTEN:','join','none','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','priority','last','define','voice_extensions','util','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context'];(function(_0x5a6333,_0x270dea){var _0x1244c6=function(_0x4dae26){while(--_0x4dae26){_0x5a6333['push'](_0x5a6333['shift']());}};_0x1244c6(++_0x270dea);}(_0xb7d4,0x1b3));var _0x4b7d=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb7d4[_0x4b2436];return _0x4f5ab2;};'use strict';var util=require(_0x4b7d('0x0'));var _=require(_0x4b7d('0x1'));var attributes=require(_0x4b7d('0x2'));module[_0x4b7d('0x3')]=function(_0x49a837){var _0x16d4ab=_0x49a837[_0x4b7d('0x4')];function _0x27186b(_0x42e763){var _0x6d376f=0x2;var _0xe5d9f2=[{'type':_0x42e763[_0x4b7d('0x5')],'app':_0x4b7d('0x6'),'appdata':_0x4b7d('0x7')+_0x42e763[_0x4b7d('0x5')],'context':_0x42e763[_0x4b7d('0x8')],'exten':_0x42e763[_0x4b7d('0x9')],'priority':_0x6d376f++,'VoiceExtensionId':_0x42e763['id']},{'type':_0x42e763[_0x4b7d('0x5')],'app':_0x42e763[_0x4b7d('0xa')]?_0x4b7d('0x6'):'NoOp','appdata':_0x42e763[_0x4b7d('0xa')]?_0x4b7d('0xb')+_0x42e763[_0x4b7d('0xa')]:'No\x20alias\x20set','context':_0x42e763['context'],'exten':_0x42e763['exten'],'priority':_0x6d376f++,'VoiceExtensionId':_0x42e763['id']}];if(_0x42e763[_0x4b7d('0x5')]==='inbound'){_0xe5d9f2['push']({'type':'inbound','app':_0x4b7d('0x6'),'appdata':_0x4b7d('0xc')+_0x42e763['id'],'context':_0x42e763[_0x4b7d('0x8')],'exten':_0x42e763[_0x4b7d('0x9')],'priority':_0x6d376f++,'VoiceExtensionId':_0x42e763['id']});}_0xe5d9f2[_0x4b7d('0xd')]({'type':_0x42e763[_0x4b7d('0x5')],'app':_0x4b7d('0x6'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x42e763['context'],'exten':_0x42e763[_0x4b7d('0x9')],'priority':_0x6d376f++,'VoiceExtensionId':_0x42e763['id']},{'type':_0x42e763[_0x4b7d('0x5')],'app':_0x4b7d('0x6'),'appdata':_0x4b7d('0xe'),'context':_0x42e763[_0x4b7d('0x8')],'exten':_0x42e763['exten'],'priority':_0x6d376f++,'VoiceExtensionId':_0x42e763['id']},{'type':_0x42e763[_0x4b7d('0x5')],'app':_0x4b7d('0x6'),'appdata':_0x4b7d('0xf'),'context':_0x42e763[_0x4b7d('0x8')],'exten':_0x42e763[_0x4b7d('0x9')],'priority':_0x6d376f++,'VoiceExtensionId':_0x42e763['id']});return _0xe5d9f2;}function _0x5ab59f(_0x5a5ff3){var _0x28f10b=0x2;var _0x1287f1=[{'type':_0x4b7d('0x10'),'app':'Set','appdata':_0x4b7d('0x11'),'context':_0x5a5ff3[_0x4b7d('0x8')],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':_0x4b7d('0x10'),'app':_0x5a5ff3['alias']?'Set':_0x4b7d('0x12'),'appdata':_0x5a5ff3[_0x4b7d('0xa')]?_0x4b7d('0xb')+_0x5a5ff3[_0x4b7d('0xa')]:'No\x20alias\x20set','context':_0x5a5ff3['context'],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':'outbound','app':_0x4b7d('0x6'),'appdata':_0x4b7d('0x13')+(_0x5a5ff3['cutdigits']?'${EXTEN:'+_0x5a5ff3[_0x4b7d('0x14')]+'}':'${EXTEN}'),'context':_0x5a5ff3[_0x4b7d('0x8')],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':'outbound','app':'Set','appdata':_0x4b7d('0xc')+_0x5a5ff3['id'],'context':_0x5a5ff3[_0x4b7d('0x8')],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':_0x4b7d('0x10'),'app':_0x4b7d('0x15'),'appdata':_0x4b7d('0x16')+(_0x28f10b+0x2)+_0x4b7d('0x17')+(_0x28f10b+0x1)+')','context':_0x5a5ff3[_0x4b7d('0x8')],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':_0x4b7d('0x10'),'app':_0x4b7d('0x6'),'appdata':_0x5a5ff3[_0x4b7d('0x14')]?_0x4b7d('0x18')+_0x5a5ff3['cutdigits']+'}':_0x4b7d('0x19'),'context':_0x5a5ff3['context'],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':_0x4b7d('0x10'),'app':_0x4b7d('0x6'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5a5ff3[_0x4b7d('0x8')],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':'outbound','app':_0x4b7d('0x6'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5a5ff3[_0x4b7d('0x8')],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':_0x4b7d('0x10'),'app':_0x4b7d('0x6'),'appdata':_0x4b7d('0xf'),'context':_0x5a5ff3[_0x4b7d('0x8')],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':'outbound','app':_0x4b7d('0x6'),'appdata':_0x4b7d('0x1a')+_0x5a5ff3['id'],'context':_0x5a5ff3[_0x4b7d('0x8')],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']}];if(_0x5a5ff3[_0x4b7d('0x1b')](_0x4b7d('0x1c'))&&_0x5a5ff3[_0x4b7d('0x1c')]!=='none'){_0x1287f1[_0x4b7d('0xd')]({'type':_0x4b7d('0x10'),'app':_0x4b7d('0x6'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5a5ff3['context'],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']},{'type':_0x4b7d('0x10'),'app':'Set','appdata':_0x4b7d('0x1d')+_0x5a5ff3[_0x4b7d('0x1c')]||_0x4b7d('0x1e'),'context':_0x5a5ff3[_0x4b7d('0x8')],'exten':_0x5a5ff3[_0x4b7d('0x9')],'priority':_0x28f10b++,'VoiceExtensionId':_0x5a5ff3['id']});}return _0x1287f1;}function _0x5bdb23(_0xd3c5a7){var _0x570ac4=[{'name':_0x4b7d('0x1f'),'param':0x0},{'name':_0x4b7d('0x20'),'param':0x1},{'name':_0x4b7d('0x21'),'param':0x2},{'name':_0x4b7d('0x22'),'param':0x3}];var _0x5200a6={};var _0x43e077=_0xd3c5a7['split'](',');var _0x2118c0=[];for(var _0x4c86ba=0x0;_0x4c86ba<_0x570ac4[_0x4b7d('0x23')];_0x4c86ba++){switch(_0x570ac4[_0x4c86ba]['name']){case _0x4b7d('0x1f'):_0x5200a6[_0x4b7d('0x1f')]=_0x43e077[_0x570ac4[_0x4c86ba][_0x4b7d('0x24')]]['split']('/')[0x1];_0x5200a6[_0x4b7d('0x25')]=_0x43e077[_0x570ac4[_0x4c86ba][_0x4b7d('0x24')]]['split']('/')[0x2];_0x5200a6['prefix']=_0x5200a6[_0x4b7d('0x25')]?_0x5200a6[_0x4b7d('0x25')]['split']('$')[0x0]:undefined;_0x5200a6[_0x4b7d('0x25')]=route[_0x4b7d('0x14')]?(_0x5200a6[_0x4b7d('0x26')]||'')+_0x4b7d('0x27')+route[_0x4b7d('0x14')]+'}':(_0x5200a6[_0x4b7d('0x26')]||'')+'${EXTEN}';_0x2118c0[_0x570ac4[_0x4c86ba]['param']]=['SIP',_0x5200a6['trunk'],_0x5200a6[_0x4b7d('0x25')]][_0x4b7d('0x28')]('/');break;case _0x4b7d('0x21'):_0x5200a6[_0x4b7d('0x21')]=_0x43e077[_0x570ac4[_0x4c86ba]['param']];if(route['recordingFormat']!==_0x4b7d('0x29')){if(_0x5200a6['options'][_0x4b7d('0x2a')](_0x4b7d('0x2b'))<0x0){_0x5200a6[_0x4b7d('0x21')]+=_0x4b7d('0x2b');}}else{_0x5200a6['options']=_0x5200a6['options']['replace'](_0x4b7d('0x2b'),'');}_0x2118c0[_0x570ac4[_0x4c86ba][_0x4b7d('0x24')]]=_0x5200a6[_0x4b7d('0x21')];break;default:_0x2118c0[_0x570ac4[_0x4c86ba]['param']]=_0x43e077[_0x570ac4[_0x4c86ba][_0x4b7d('0x24')]];}}return _0x2118c0[_0x4b7d('0x28')](',');}function _0x3f4bd5(_0x4932ac,_0x222bcb,_0x5b6875,_0x488cac){return new Promise(function(_0x23e092,_0x3e62f7){var _0x3392b4=[];if(_[_0x4b7d('0x2c')](_0x222bcb))return _0x23e092(_0x3392b4);_0x16d4ab[_0x4b7d('0x2d')][_0x4b7d('0x2e')]({'attributes':['id',_0x4b7d('0x2f'),_0x4b7d('0x30')],'raw':!![]})[_0x4b7d('0x31')](function(_0x1b5b4d){for(var _0x1b336a=0x0,_0x168310=0x0;_0x1b336a<_0x222bcb[_0x4b7d('0x23')];_0x1b336a++,_0x168310=0x0){var _0x3d045c=_0x222bcb[_0x1b336a];var _0x7e1b56=[];var _0x430f5f=[];if(_0x3d045c[_0x4b7d('0x2f')]!=='*,*,*,*'){_0x3d045c[_0x4b7d('0x32')]=[_0x3d045c['interval']];}else{_0x3d045c[_0x4b7d('0x32')]=_0x3d045c[_0x4b7d('0x30')]?_[_0x4b7d('0x33')](_[_0x4b7d('0x34')](_0x1b5b4d,{'IntervalId':_0x3d045c[_0x4b7d('0x30')]}),'interval'):[];}_0x3d045c[_0x4b7d('0x8')]=_0x4932ac[_0x4b7d('0x8')];_0x3d045c[_0x4b7d('0x9')]=_0x4932ac[_0x4b7d('0x9')];if(_0x3d045c['type'])_0x3d045c[_0x4b7d('0x5')]=_0x3d045c['type'][_0x4b7d('0x35')]();if(_0x4932ac[_0x4b7d('0x5')]===_0x4b7d('0x10')){if(_0x3d045c['hasOwnProperty'](_0x4b7d('0x36'))&&_0x3d045c['tag']&&_0x3d045c[_0x4b7d('0x36')]!=='--'){_0x7e1b56[_0x4b7d('0xd')]({'type':_0x3d045c['type'][_0x4b7d('0x35')](),'app':_0x4b7d('0x6'),'appdata':_0x4b7d('0x37')+_0x3d045c[_0x4b7d('0x36')],'context':_0x4932ac[_0x4b7d('0x8')],'exten':_0x4932ac[_0x4b7d('0x9')],'priority':_0x3d045c[_0x4b7d('0x32')][_0x4b7d('0x23')]+_0x5b6875+_0x168310++,'VoiceExtensionId':_0x4932ac['id']});}_0x7e1b56['push']({'type':_0x3d045c[_0x4b7d('0x5')]['toLowerCase'](),'app':'ExecIf','appdata':_0x4b7d('0x38')+(_0x3d045c[_0x4b7d('0x39')]?_0x4b7d('0x3a')+_0x3d045c[_0x4b7d('0x39')]+')':_0x4b7d('0x3b')),'context':_0x4932ac[_0x4b7d('0x8')],'exten':_0x4932ac[_0x4b7d('0x9')],'priority':_0x3d045c[_0x4b7d('0x32')]['length']+_0x5b6875+_0x168310++,'VoiceExtensionId':_0x4932ac['id']});}else{if(_0x3d045c[_0x4b7d('0x1b')](_0x4b7d('0x3c'))){if([_0x4b7d('0x3d'),'playback']['includes'](_0x3d045c['app'][_0x4b7d('0x35')]())&&_0x3d045c[_0x4b7d('0x3e')]!==_0x4b7d('0x3f')){if(_0x3d045c['answer']){_0x7e1b56[_0x4b7d('0xd')]({'type':_0x3d045c[_0x4b7d('0x5')][_0x4b7d('0x35')](),'app':_0x4b7d('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4932ac[_0x4b7d('0x8')],'exten':_0x4932ac[_0x4b7d('0x9')],'priority':_0x3d045c['intervals']['length']+_0x5b6875+_0x168310++,'VoiceExtensionId':_0x4932ac['id']});_0x7e1b56['push']({'type':_0x3d045c[_0x4b7d('0x5')][_0x4b7d('0x35')](),'app':_0x4b7d('0x6'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4932ac[_0x4b7d('0x8')],'exten':_0x4932ac[_0x4b7d('0x9')],'priority':_0x3d045c[_0x4b7d('0x32')][_0x4b7d('0x23')]+_0x5b6875+_0x168310++,'VoiceExtensionId':_0x4932ac['id']});}else{_0x7e1b56[_0x4b7d('0xd')]({'type':_0x3d045c['type'][_0x4b7d('0x35')](),'app':_0x4b7d('0x15'),'appdata':_0x4b7d('0x40'),'context':_0x4932ac[_0x4b7d('0x8')],'exten':_0x4932ac[_0x4b7d('0x9')],'priority':_0x3d045c[_0x4b7d('0x32')][_0x4b7d('0x23')]+_0x5b6875+_0x168310++,'VoiceExtensionId':_0x4932ac['id']});_0x7e1b56[_0x4b7d('0xd')]({'type':_0x3d045c[_0x4b7d('0x5')]['toLowerCase'](),'app':_0x4b7d('0x6'),'appdata':_0x4b7d('0x41'),'context':_0x4932ac[_0x4b7d('0x8')],'exten':_0x4932ac[_0x4b7d('0x9')],'priority':_0x3d045c[_0x4b7d('0x32')][_0x4b7d('0x23')]+_0x5b6875+_0x168310++,'VoiceExtensionId':_0x4932ac['id']});}}}}for(var _0x59393e=0x0;_0x59393e<_0x3d045c[_0x4b7d('0x32')][_0x4b7d('0x23')];_0x59393e++){var _0x115a8e=_0x5b6875+_0x3d045c[_0x4b7d('0x32')][_0x4b7d('0x23')];var _0x4079a1=_0x59393e===_0x3d045c[_0x4b7d('0x32')][_0x4b7d('0x23')]-0x1?_0x5b6875+_0x7e1b56[_0x4b7d('0x23')]+_0x430f5f[_0x4b7d('0x23')]+0x2:_0x5b6875+_0x59393e+0x1;_0x7e1b56[_0x4b7d('0x42')](_0x59393e,0x0,{'type':_0x4932ac['type'],'app':_0x4b7d('0x43'),'appdata':_0x3d045c['intervals'][_0x59393e]+'?'+_0x4932ac[_0x4b7d('0x8')]+_0x4b7d('0x44')+_0x115a8e+':'+_0x4932ac[_0x4b7d('0x8')]+_0x4b7d('0x44')+_0x4079a1,'exten':_0x4932ac['exten'],'context':_0x4932ac[_0x4b7d('0x8')],'priority':_0x5b6875+_0x59393e,'VoiceExtensionId':_0x4932ac['id']});}if(_0x488cac&&_0x3d045c[_0x4b7d('0x3e')]===_0x4b7d('0x45'))_0x3d045c['appdata']=_0x5bdb23(_0x3d045c['appdata']);_0x3d045c[_0x4b7d('0x46')]=_0x7e1b56[_0x4b7d('0x23')]?_[_0x4b7d('0x47')](_0x7e1b56)[_0x4b7d('0x46')]+0x1:_0x5b6875;_0x3392b4=_['concat'](_0x3392b4,_0x7e1b56,[_0x3d045c],_0x430f5f);_0x5b6875=_[_0x4b7d('0x47')](_0x3392b4)[_0x4b7d('0x46')]+0x1;}return _0x23e092(_0x3392b4);})['catch'](function(_0x5c5b03){_0x3e62f7(_0x5c5b03);});});}return _0x49a837[_0x4b7d('0x48')]('VoiceExtension',attributes,{'tableName':_0x4b7d('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xbdbbe,_0x43f98d){var _0x442e78=this;var _0x5236c0=_0x442e78['type']===_0x4b7d('0x10')?_0x5ab59f(_0x442e78):_0x27186b(_0x442e78);return _0x3f4bd5(_0x442e78,_0xbdbbe,_['last'](_0x5236c0)[_0x4b7d('0x46')]+0x1,_0x43f98d)['then'](function(_0x31e4a4){var _0x403ca8=_['concat'](_0x5236c0,_0x31e4a4);_0x403ca8[_0x4b7d('0xd')]({'type':_0x442e78[_0x4b7d('0x5')],'app':'Hangup','exten':_0x442e78[_0x4b7d('0x9')],'context':_0x442e78[_0x4b7d('0x8')],'priority':_[_0x4b7d('0x47')](_0x403ca8)[_0x4b7d('0x46')]+0x1,'VoiceExtensionId':_0x442e78['id']});return _0x403ca8;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index a57c01e..969551d 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 _0x8819=['raw','limit','include','model','attributes','map','stringify','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','error','VoiceExtension,\x20%s,\x20%s','message','result','GetVoiceExtension','VoiceExtension','findAll','options'];(function(_0x4feaf5,_0x2e2801){var _0x307fdf=function(_0x13b732){while(--_0x13b732){_0x4feaf5['push'](_0x4feaf5['shift']());}};_0x307fdf(++_0x2e2801);}(_0x8819,0x94));var _0x9881=function(_0xe7a6ee,_0x17526c){_0xe7a6ee=_0xe7a6ee-0x0;var _0x4e0cdb=_0x8819[_0xe7a6ee];return _0x4e0cdb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9881('0x0'));var BPromise=require(_0x9881('0x1'));var rs=require(_0x9881('0x2'));var fs=require('fs');var Redis=require(_0x9881('0x3'));var db=require(_0x9881('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9881('0x5'))(_0x9881('0x6'));var config=require(_0x9881('0x7'));var jayson=require(_0x9881('0x8'));var client=jayson[_0x9881('0x9')][_0x9881('0xa')]({'port':0x232a});config['redis']=_[_0x9881('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9881('0xc'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x9881('0xd')](socket);function respondWithRpcPromise(_0x4adf62,_0x2570a3,_0x39122e){return new BPromise(function(_0x1e192a,_0x571947){return client[_0x9881('0xe')](_0x4adf62,_0x39122e)[_0x9881('0xf')](function(_0x2693a6){logger[_0x9881('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x2570a3,_0x9881('0x11'));logger[_0x9881('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2570a3,_0x9881('0x11'),JSON['stringify'](_0x2693a6));if(_0x2693a6['error']){if(_0x2693a6['error']['code']===0x1f4){logger[_0x9881('0x13')](_0x9881('0x14'),_0x2570a3,_0x2693a6[_0x9881('0x13')][_0x9881('0x15')]);return _0x571947(_0x2693a6[_0x9881('0x13')][_0x9881('0x15')]);}logger['error'](_0x9881('0x14'),_0x2570a3,_0x2693a6[_0x9881('0x13')][_0x9881('0x15')]);return _0x1e192a(_0x2693a6['error']['message']);}else{logger['info'](_0x9881('0x14'),_0x2570a3,'request\x20sent');_0x1e192a(_0x2693a6[_0x9881('0x16')]['message']);}})['catch'](function(_0x1f6e20){logger[_0x9881('0x13')](_0x9881('0x14'),_0x2570a3,_0x1f6e20);_0x571947(_0x1f6e20);});});}exports[_0x9881('0x17')]=function(_0x43f8a2){var _0xe97d44=this;return new Promise(function(_0x3ae21d,_0x1243cc){return db[_0x9881('0x18')][_0x9881('0x19')]({'raw':_0x43f8a2[_0x9881('0x1a')]?_0x43f8a2[_0x9881('0x1a')][_0x9881('0x1b')]===undefined?!![]:![]:!![],'where':_0x43f8a2[_0x9881('0x1a')]?_0x43f8a2[_0x9881('0x1a')]['where']||null:null,'attributes':_0x43f8a2['options']?_0x43f8a2[_0x9881('0x1a')]['attributes']||null:null,'limit':_0x43f8a2['options']?_0x43f8a2[_0x9881('0x1a')][_0x9881('0x1c')]||null:null,'include':_0x43f8a2['options']?_0x43f8a2['options'][_0x9881('0x1d')]?_['map'](_0x43f8a2[_0x9881('0x1a')][_0x9881('0x1d')],function(_0x16eeca){return{'model':db[_0x16eeca[_0x9881('0x1e')]],'as':_0x16eeca['as'],'attributes':_0x16eeca[_0x9881('0x1f')],'include':_0x16eeca[_0x9881('0x1d')]?_[_0x9881('0x20')](_0x16eeca[_0x9881('0x1d')],function(_0xc328b7){return{'model':db[_0xc328b7[_0x9881('0x1e')]],'as':_0xc328b7['as'],'attributes':_0xc328b7[_0x9881('0x1f')],'include':_0xc328b7[_0x9881('0x1d')]?_[_0x9881('0x20')](_0xc328b7['include'],function(_0x31956e){return{'model':db[_0x31956e[_0x9881('0x1e')]],'as':_0x31956e['as'],'attributes':_0x31956e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9881('0xf')](function(_0x3d7120){logger['info'](_0x9881('0x17'),_0x43f8a2);logger[_0x9881('0x12')](_0x9881('0x17'),_0x43f8a2,JSON[_0x9881('0x21')](_0x3d7120));_0x3ae21d(_0x3d7120);})[_0x9881('0x22')](function(_0x383ff0){logger[_0x9881('0x13')](_0x9881('0x17'),_0x383ff0['message'],_0x43f8a2);_0x1243cc(_0xe97d44[_0x9881('0x13')](0x1f4,_0x383ff0[_0x9881('0x15')]));});});}; \ No newline at end of file +var _0x1b9b=['client','http','defaults','redis','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','map','include','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2ee5aa,_0x616538){var _0x2e87cf=function(_0x164e26){while(--_0x164e26){_0x2ee5aa['push'](_0x2ee5aa['shift']());}};_0x2e87cf(++_0x616538);}(_0x1b9b,0x89));var _0xb1b9=function(_0x53a2eb,_0x233bfa){_0x53a2eb=_0x53a2eb-0x0;var _0x3430be=_0x1b9b[_0x53a2eb];return _0x3430be;};'use strict';var _=require(_0xb1b9('0x0'));var util=require('util');var moment=require(_0xb1b9('0x1'));var BPromise=require(_0xb1b9('0x2'));var rs=require(_0xb1b9('0x3'));var fs=require('fs');var Redis=require(_0xb1b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1b9('0x5'));var logger=require(_0xb1b9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1b9('0x7')][_0xb1b9('0x8')]({'port':0x232a});config['redis']=_[_0xb1b9('0x9')](config[_0xb1b9('0xa')],{'host':_0xb1b9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1b9('0xa')]));require(_0xb1b9('0xc'))[_0xb1b9('0xd')](socket);function respondWithRpcPromise(_0x509e87,_0x178bb4,_0x535387){return new BPromise(function(_0x31b546,_0x5a6c8c){return client[_0xb1b9('0xe')](_0x509e87,_0x535387)[_0xb1b9('0xf')](function(_0x1595a6){logger[_0xb1b9('0x10')](_0xb1b9('0x11'),_0x178bb4,_0xb1b9('0x12'));logger[_0xb1b9('0x13')](_0xb1b9('0x14'),_0x178bb4,'request\x20sent',JSON[_0xb1b9('0x15')](_0x1595a6));if(_0x1595a6[_0xb1b9('0x16')]){if(_0x1595a6[_0xb1b9('0x16')]['code']===0x1f4){logger[_0xb1b9('0x16')](_0xb1b9('0x11'),_0x178bb4,_0x1595a6[_0xb1b9('0x16')][_0xb1b9('0x17')]);return _0x5a6c8c(_0x1595a6[_0xb1b9('0x16')][_0xb1b9('0x17')]);}logger['error'](_0xb1b9('0x11'),_0x178bb4,_0x1595a6['error'][_0xb1b9('0x17')]);return _0x31b546(_0x1595a6[_0xb1b9('0x16')][_0xb1b9('0x17')]);}else{logger[_0xb1b9('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x178bb4,_0xb1b9('0x12'));_0x31b546(_0x1595a6[_0xb1b9('0x18')][_0xb1b9('0x17')]);}})['catch'](function(_0x26d012){logger[_0xb1b9('0x16')](_0xb1b9('0x11'),_0x178bb4,_0x26d012);_0x5a6c8c(_0x26d012);});});}exports[_0xb1b9('0x19')]=function(_0xc556e5){var _0x5dfcdf=this;return new Promise(function(_0x4aa7b9,_0x550998){return db[_0xb1b9('0x1a')][_0xb1b9('0x1b')]({'raw':_0xc556e5[_0xb1b9('0x1c')]?_0xc556e5[_0xb1b9('0x1c')][_0xb1b9('0x1d')]===undefined?!![]:![]:!![],'where':_0xc556e5[_0xb1b9('0x1c')]?_0xc556e5['options']['where']||null:null,'attributes':_0xc556e5[_0xb1b9('0x1c')]?_0xc556e5[_0xb1b9('0x1c')][_0xb1b9('0x1e')]||null:null,'limit':_0xc556e5['options']?_0xc556e5[_0xb1b9('0x1c')][_0xb1b9('0x1f')]||null:null,'include':_0xc556e5['options']?_0xc556e5[_0xb1b9('0x1c')]['include']?_[_0xb1b9('0x20')](_0xc556e5['options'][_0xb1b9('0x21')],function(_0x578116){return{'model':db[_0x578116[_0xb1b9('0x22')]],'as':_0x578116['as'],'attributes':_0x578116[_0xb1b9('0x1e')],'include':_0x578116[_0xb1b9('0x21')]?_[_0xb1b9('0x20')](_0x578116[_0xb1b9('0x21')],function(_0x5f45e8){return{'model':db[_0x5f45e8[_0xb1b9('0x22')]],'as':_0x5f45e8['as'],'attributes':_0x5f45e8[_0xb1b9('0x1e')],'include':_0x5f45e8[_0xb1b9('0x21')]?_[_0xb1b9('0x20')](_0x5f45e8[_0xb1b9('0x21')],function(_0x3531f0){return{'model':db[_0x3531f0[_0xb1b9('0x22')]],'as':_0x3531f0['as'],'attributes':_0x3531f0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59d433){logger[_0xb1b9('0x10')](_0xb1b9('0x19'),_0xc556e5);logger[_0xb1b9('0x13')](_0xb1b9('0x19'),_0xc556e5,JSON[_0xb1b9('0x15')](_0x59d433));_0x4aa7b9(_0x59d433);})[_0xb1b9('0x23')](function(_0x3a733c){logger[_0xb1b9('0x16')](_0xb1b9('0x19'),_0x3a733c[_0xb1b9('0x17')],_0xc556e5);_0x550998(_0x5dfcdf[_0xb1b9('0x16')](0x1f4,_0x3a733c[_0xb1b9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 3774ad6..35f9da0 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x410905,_0x139614){var _0x4cba49=function(_0x2f7710){while(--_0x2f7710){_0x410905['push'](_0x410905['shift']());}};_0x4cba49(++_0x139614);}(_0x7a54,0x106));var _0x47a5=function(_0x43adf8,_0x314ad9){_0x43adf8=_0x43adf8-0x0;var _0x2757c2=_0x7a54[_0x43adf8];return _0x2757c2;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x413f87,_0x12c5c0){var _0xb4ae8c=function(_0x3a4910){while(--_0x3a4910){_0x413f87['push'](_0x413f87['shift']());}};_0xb4ae8c(++_0x12c5c0);}(_0xe14b,0x93));var _0xbe14=function(_0x424378,_0x54908f){_0x424378=_0x424378-0x0;var _0x21e4b3=_0xe14b[_0x424378];return _0x21e4b3;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 46c5750..63cd1df 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 _0xd117=['./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8753c4,_0x2bcc63){var _0x7c4934=function(_0x4bdd2a){while(--_0x4bdd2a){_0x8753c4['push'](_0x8753c4['shift']());}};_0x7c4934(++_0x2bcc63);}(_0xd117,0x182));var _0x7d11=function(_0x219935,_0x5b7d02){_0x219935=_0x219935-0x0;var _0x130409=_0xd117[_0x219935];return _0x130409;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0x12')]('/',auth[_0x7d11('0xc')](),controller['create']);router[_0x7d11('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7d11('0x14')]);router['delete']('/:id',auth[_0x7d11('0xc')](),controller['destroy']);module[_0x7d11('0x15')]=router; \ No newline at end of file +var _0x47c5=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','index','/:id','isAuthenticated','show','/:id/messages','getMessages','post'];(function(_0x4f3463,_0x5a1ee7){var _0x5f0e49=function(_0x41419f){while(--_0x41419f){_0x4f3463['push'](_0x4f3463['shift']());}};_0x5f0e49(++_0x5a1ee7);}(_0x47c5,0x165));var _0x547c=function(_0x43f756,_0xae9f58){_0x43f756=_0x43f756-0x0;var _0x5ba710=_0x47c5[_0x43f756];return _0x5ba710;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x547c('0x6'));var interaction=require(_0x547c('0x7'));var config=require('../../config/environment');var controller=require(_0x547c('0x8'));router[_0x547c('0x9')]('/',auth['isAuthenticated'](),controller[_0x547c('0xa')]);router[_0x547c('0x9')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0xd')]);router[_0x547c('0x9')](_0x547c('0xe'),auth[_0x547c('0xc')](),controller[_0x547c('0xf')]);router[_0x547c('0x10')]('/',auth[_0x547c('0xc')](),controller[_0x547c('0x11')]);router[_0x547c('0x12')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0x13')]);router[_0x547c('0x14')]('/:id',auth[_0x547c('0xc')](),controller[_0x547c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 1af4a50..ec24f50 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 _0xb69b=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xb69b,0xd7));var _0xbb69=function(_0xc3e9e,_0x332b3f){_0xc3e9e=_0xc3e9e-0x0;var _0x42c816=_0xb69b[_0xc3e9e];return _0x42c816;};'use strict';var Sequelize=require(_0xbb69('0x0'));module[_0xbb69('0x1')]={'customer_id':{'type':Sequelize[_0xbb69('0x2')]},'context':{'type':Sequelize[_0xbb69('0x2')],'defaultValue':_0xbb69('0x3'),'unique':_0xbb69('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xbb69('0x4')},'password':{'type':Sequelize[_0xbb69('0x2')]},'fullname':{'type':Sequelize[_0xbb69('0x2')]},'email':{'type':Sequelize[_0xbb69('0x2')],'validate':{'isEmail':!![]},'set':function(_0x42bed7){this[_0xbb69('0x5')](_0xbb69('0x6'),typeof _0x42bed7===_0xbb69('0x7')&&_0x42bed7['trim']()?_0x42bed7['trim']():null);}},'pager':{'type':Sequelize[_0xbb69('0x2')]},'tz':{'type':Sequelize[_0xbb69('0x2')],'defaultValue':_0xbb69('0x8')},'attach':{'type':Sequelize[_0xbb69('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xbb69('0x2')]},'callback':{'type':Sequelize[_0xbb69('0x2')]},'review':{'type':Sequelize[_0xbb69('0x9')](_0xbb69('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbb69('0x9')](_0xbb69('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbb69('0x9')](_0xbb69('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbb69('0x9')](_0xbb69('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbb69('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbb69('0x9')](_0xbb69('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbb69('0x9')](_0xbb69('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbb69('0x9')]('yes','no'),'defaultValue':_0xbb69('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xbb69('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbb69('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbb69('0x9')](_0xbb69('0xa'),'no'),'defaultValue':_0xbb69('0xa'),'allowNull':![]},'stamp':{'type':_0xbb69('0xc')},'emailsubject':{'type':Sequelize[_0xbb69('0x2')]},'emailbody':{'type':Sequelize[_0xbb69('0x2')]},'maxsecs':{'type':Sequelize[_0xbb69('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xbb69('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbb69('0xe')](_0xbb69('0xf'))+_0xbb69('0x10')+this['getDataValue'](_0xbb69('0x11'));}}}; \ No newline at end of file +var _0xf4af=['sequelize','STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','getDataValue','mailbox'];(function(_0x13be0d,_0x1091c7){var _0x1711a6=function(_0x1c3a1d){while(--_0x1c3a1d){_0x13be0d['push'](_0x13be0d['shift']());}};_0x1711a6(++_0x1091c7);}(_0xf4af,0x1a0));var _0xff4a=function(_0x5afbd5,_0x48a693){_0x5afbd5=_0x5afbd5-0x0;var _0x298511=_0xf4af[_0x5afbd5];return _0x298511;};'use strict';var Sequelize=require(_0xff4a('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xff4a('0x1')]},'context':{'type':Sequelize[_0xff4a('0x1')],'defaultValue':_0xff4a('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xff4a('0x3')},'password':{'type':Sequelize[_0xff4a('0x1')]},'fullname':{'type':Sequelize[_0xff4a('0x1')]},'email':{'type':Sequelize[_0xff4a('0x1')],'validate':{'isEmail':!![]},'set':function(_0x329504){this['setDataValue']('email',typeof _0x329504===_0xff4a('0x4')&&_0x329504[_0xff4a('0x5')]()?_0x329504[_0xff4a('0x5')]():null);}},'pager':{'type':Sequelize[_0xff4a('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xff4a('0x6')},'attach':{'type':Sequelize[_0xff4a('0x7')]('yes','no'),'defaultValue':_0xff4a('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xff4a('0x7')]('yes','no'),'defaultValue':_0xff4a('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xff4a('0x1')]},'review':{'type':Sequelize[_0xff4a('0x7')](_0xff4a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xff4a('0x7')](_0xff4a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xff4a('0x7')](_0xff4a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xff4a('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xff4a('0x7')](_0xff4a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xff4a('0x7')](_0xff4a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xff4a('0x8'),'no'),'defaultValue':_0xff4a('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xff4a('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xff4a('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xff4a('0x8'),'no'),'defaultValue':_0xff4a('0x8'),'allowNull':![]},'stamp':{'type':_0xff4a('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xff4a('0x1')]},'maxsecs':{'type':Sequelize[_0xff4a('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xff4a('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xff4a('0xc')],'get':function(){return this['getDataValue']('fullname')+_0xff4a('0xd')+this[_0xff4a('0xe')](_0xff4a('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index caff855..121ecb0 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 _0xb7e7=['sort','where','pick','filter','options','show','params','keys','rawAttributes','intersection','includeAll','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','findAndCountAll','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','save','update','then','get','destroy','error','name','send','index','VoiceMail','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x1e890b,_0x287e4c){var _0x1aad8a=function(_0xf148f0){while(--_0xf148f0){_0x1e890b['push'](_0x1e890b['shift']());}};_0x1aad8a(++_0x287e4c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xb7e7[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=typeof _0x3d2fb2[_0x7b7e('0x1d')]===_0x7b7e('0x1e')&&typeof _0x3d2fb2[_0x7b7e('0x1f')]===_0x7b7e('0x1e');var _0x2cc400=_0x5703fd[_0x7b7e('0x20')];var _0x242368=_0x51baf6?0x0:_0x3d2fb2[_0x7b7e('0x1d')];var _0x2acb8c=_0x51baf6?_0x5703fd[_0x7b7e('0x20')]:_0x3d2fb2[_0x7b7e('0x1d')]+_0x3d2fb2[_0x7b7e('0x1f')];var _0x448980;if(_0x2acb8c>=_0x2cc400){_0x2acb8c=_0x2cc400;_0x448980=0xc8;}else{_0x448980=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x448980);return _0x457ec5[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x242368+'-'+_0x2acb8c+'/'+_0x2cc400)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x49eddb){return function(_0x69262b){try{jsonpatch[_0x7b7e('0x23')](_0x69262b,_0x49eddb,!![]);}catch(_0x24718c){return BPromise['reject'](_0x24718c);}return _0x69262b[_0x7b7e('0x24')]();};}function saveUpdates(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x25')](_0xbf0cb3)[_0x7b7e('0x26')](function(_0x28bf43){return _0x28bf43;});}return null;};}function removeEntity(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(_0x5d6215){return _0x5d6215['destroy']()[_0x7b7e('0x26')](function(){var _0x22598e=_0x5d6215[_0x7b7e('0x27')]({'plain':!![]});var _0x483c6f='Voicemails';return db['UserProfileResource'][_0x7b7e('0x28')]({'where':{'type':_0x483c6f,'resourceId':_0x22598e['id']}})[_0x7b7e('0x26')](function(){return _0x5d6215;});})[_0x7b7e('0x26')](function(){_0x10a66a[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x48fad1,_0x6a1e71){return function(_0x21a15){if(!_0x21a15){_0x48fad1['sendStatus'](0x194);}return _0x21a15;};}function handleError(_0x57b9da,_0x4e5de7){_0x4e5de7=_0x4e5de7||0x1f4;return function(_0x12ef0b){logger[_0x7b7e('0x29')](_0x12ef0b['stack']);if(_0x12ef0b[_0x7b7e('0x2a')]){delete _0x12ef0b['name'];}_0x57b9da[_0x7b7e('0x1b')](_0x4e5de7)[_0x7b7e('0x2b')](_0x12ef0b);};}exports[_0x7b7e('0x2c')]=function(_0x5515ca,_0x3960b8){var _0xe31336={},_0x35602a={},_0x326dd2={'count':0x0,'rows':[]};var _0x33f9a1=_['map'](db[_0x7b7e('0x2d')]['rawAttributes'],function(_0x23a453){return{'name':_0x23a453[_0x7b7e('0x2e')],'type':_0x23a453[_0x7b7e('0x2f')][_0x7b7e('0x30')]};});_0x35602a[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x33f9a1,_0x7b7e('0x2a'));_0x35602a['query']=_['keys'](_0x5515ca[_0x7b7e('0x33')]);_0x35602a[_0x7b7e('0x34')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],_0x35602a[_0x7b7e('0x33')]);_0xe31336[_0x7b7e('0x35')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0xe31336[_0x7b7e('0x35')]=_0xe31336[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0xe31336[_0x7b7e('0x35')]:_0x35602a[_0x7b7e('0x31')];if(!_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0xe31336[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1f')]);_0xe31336['offset']=qs[_0x7b7e('0x1d')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1d')]);}_0xe31336[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3b')]);_0xe31336[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x5515ca['query'],_0x35602a[_0x7b7e('0x34')]),_0x33f9a1);if(_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]){_0xe31336[_0x7b7e('0x3c')]=_['merge'](_0xe31336[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x32')](_0x33f9a1,function(_0x3d5280){if(_0x3d5280['type']!=='VIRTUAL'){var _0x22651e={};_0x22651e[_0x3d5280['name']]={'$like':'%'+_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x22651e;}})});}_0xe31336=_['merge']({},_0xe31336,_0x5515ca[_0x7b7e('0x3f')]);var _0x2074d1={'where':_0xe31336[_0x7b7e('0x3c')]};return db[_0x7b7e('0x2d')][_0x7b7e('0x20')](_0x2074d1)[_0x7b7e('0x26')](function(_0xc888e4){_0x326dd2[_0x7b7e('0x20')]=_0xc888e4;if(_0x5515ca[_0x7b7e('0x33')]['includeAll']){_0xe31336['include']=[{'all':!![]}];}return db[_0x7b7e('0x2d')]['findAll'](_0xe31336);})[_0x7b7e('0x26')](function(_0x5e8b5d){_0x326dd2['rows']=_0x5e8b5d;return _0x326dd2;})[_0x7b7e('0x26')](respondWithFilteredResult(_0x3960b8,_0xe31336))['catch'](handleError(_0x3960b8,null));};exports[_0x7b7e('0x40')]=function(_0x52051c,_0xa8521d){var _0x3e58be={'raw':!![],'where':{'id':_0x52051c[_0x7b7e('0x41')]['id']}},_0x7ea84c={};_0x7ea84c['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x2d')][_0x7b7e('0x43')]);_0x7ea84c[_0x7b7e('0x33')]=_[_0x7b7e('0x42')](_0x52051c[_0x7b7e('0x33')]);_0x7ea84c['filters']=_['intersection'](_0x7ea84c['model'],_0x7ea84c[_0x7b7e('0x33')]);_0x3e58be[_0x7b7e('0x35')]=_[_0x7b7e('0x44')](_0x7ea84c[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x52051c[_0x7b7e('0x33')]['fields']));_0x3e58be[_0x7b7e('0x35')]=_0x3e58be[_0x7b7e('0x35')]['length']?_0x3e58be['attributes']:_0x7ea84c[_0x7b7e('0x31')];if(_0x52051c[_0x7b7e('0x33')][_0x7b7e('0x45')]){_0x3e58be[_0x7b7e('0x46')]=[{'all':!![]}];}_0x3e58be=_[_0x7b7e('0x47')]({},_0x3e58be,_0x52051c[_0x7b7e('0x3f')]);return db['VoiceMail'][_0x7b7e('0x48')](_0x3e58be)['then'](handleEntityNotFound(_0xa8521d,null))[_0x7b7e('0x26')](respondWithResult(_0xa8521d,null))[_0x7b7e('0x49')](handleError(_0xa8521d,null));};exports[_0x7b7e('0x4a')]=function(_0x5874e2,_0x58e4e6){return db[_0x7b7e('0x2d')][_0x7b7e('0x4a')](_0x5874e2[_0x7b7e('0x4b')],{})[_0x7b7e('0x26')](function(_0x1f9d0f){var _0x5cce7c=_0x5874e2[_0x7b7e('0x4c')][_0x7b7e('0x27')]({'plain':!![]});if(!_0x5cce7c)throw new Error(_0x7b7e('0x4d'));if(_0x5cce7c[_0x7b7e('0x4e')]===_0x7b7e('0x4c')){var _0x5a9697=_0x1f9d0f[_0x7b7e('0x27')]({'plain':!![]});var _0x29024e=_0x7b7e('0x4f');return db[_0x7b7e('0x50')][_0x7b7e('0x48')]({'where':{'name':_0x29024e,'userProfileId':_0x5cce7c[_0x7b7e('0x51')]},'raw':!![]})[_0x7b7e('0x26')](function(_0x4a7be0){if(_0x4a7be0&&_0x4a7be0[_0x7b7e('0x52')]===0x0){return db['UserProfileResource'][_0x7b7e('0x4a')]({'name':_0x5a9697[_0x7b7e('0x2a')],'resourceId':_0x5a9697['id'],'type':_0x4a7be0['name'],'sectionId':_0x4a7be0['id']},{})[_0x7b7e('0x26')](function(){return _0x1f9d0f;});}else{return _0x1f9d0f;}})[_0x7b7e('0x49')](function(_0x16c81d){logger[_0x7b7e('0x29')](_0x7b7e('0x53'),_0x16c81d);throw _0x16c81d;});}return _0x1f9d0f;})[_0x7b7e('0x26')](respondWithResult(_0x58e4e6,0xc9))[_0x7b7e('0x49')](handleError(_0x58e4e6,null));};exports['update']=function(_0xbf044d,_0x3ff731){if(_0xbf044d[_0x7b7e('0x4b')]['id']){delete _0xbf044d[_0x7b7e('0x4b')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0xbf044d['params']['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x3ff731,null))[_0x7b7e('0x26')](saveUpdates(_0xbf044d[_0x7b7e('0x4b')],null))['then'](respondWithResult(_0x3ff731,null))['catch'](handleError(_0x3ff731,null));};exports[_0x7b7e('0x28')]=function(_0x39efb5,_0x4fecf7){return db[_0x7b7e('0x2d')][_0x7b7e('0x48')]({'where':{'id':_0x39efb5[_0x7b7e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fecf7,null))[_0x7b7e('0x26')](removeEntity(_0x4fecf7,null))[_0x7b7e('0x49')](handleError(_0x4fecf7,null));};exports['getMessages']=function(_0x25c933,_0x441c3c,_0x1d7db1){return db[_0x7b7e('0x2d')][_0x7b7e('0x54')]({'where':{'id':_0x25c933[_0x7b7e('0x41')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x441c3c,null))[_0x7b7e('0x26')](function(_0x45fff9){var _0x5509ad;var _0x29d0af={},_0x20108a={};_0x20108a['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x55')][_0x7b7e('0x43')]);_0x20108a['query']=_[_0x7b7e('0x42')](_0x25c933['query']);_0x20108a[_0x7b7e('0x34')]=_[_0x7b7e('0x44')](_0x20108a['model'],_0x20108a[_0x7b7e('0x33')]);_0x29d0af[_0x7b7e('0x35')]=_['intersection'](_0x20108a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0x29d0af['attributes']=_0x29d0af[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0x29d0af[_0x7b7e('0x35')]:_0x20108a[_0x7b7e('0x31')];if(!_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0x29d0af[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x25c933[_0x7b7e('0x33')]['limit']);_0x29d0af[_0x7b7e('0x1d')]=qs['offset'](_0x25c933['query'][_0x7b7e('0x1d')]);}_0x29d0af[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x25c933[_0x7b7e('0x33')]['sort']);_0x29d0af[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x25c933[_0x7b7e('0x33')],_0x20108a[_0x7b7e('0x34')]));if(_0x25c933[_0x7b7e('0x33')]['filter']){_0x29d0af[_0x7b7e('0x3c')]=_['merge'](_0x29d0af['where'],{'$or':_[_0x7b7e('0x32')](_0x29d0af['attributes'],function(_0x47aa4c){var _0x4a2378={};_0x4a2378[_0x47aa4c]={'$like':'%'+_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x4a2378;})});}_0x29d0af['where']=_[_0x7b7e('0x47')](_0x29d0af[_0x7b7e('0x3c')],{'mailboxuser':_0x45fff9['mailbox']});_0x29d0af=_[_0x7b7e('0x47')]({},_0x29d0af,_0x25c933[_0x7b7e('0x3f')]);return db[_0x7b7e('0x55')][_0x7b7e('0x56')](_0x29d0af)[_0x7b7e('0x26')](respondWithFilteredResult(_0x441c3c,_0x29d0af));})[_0x7b7e('0x49')](handleError(_0x441c3c,null));}; \ No newline at end of file +var _0x5eb8=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','VoiceMail','findAll','rows','catch','show','params','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','VoiceMailMessage','pick','filter','mailbox'];(function(_0x432666,_0x1987fd){var _0x411329=function(_0x53dc4d){while(--_0x53dc4d){_0x432666['push'](_0x432666['shift']());}};_0x411329(++_0x1987fd);}(_0x5eb8,0xb0));var _0x85eb=function(_0x366e51,_0x3a0178){_0x366e51=_0x366e51-0x0;var _0x4e23e3=_0x5eb8[_0x366e51];return _0x4e23e3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];function respondWithStatusCode(_0x784583,_0x2f42ba){_0x2f42ba=_0x2f42ba||0xcc;return function(_0x259f72){if(_0x259f72){return _0x784583['sendStatus'](_0x2f42ba);}return _0x784583['status'](_0x2f42ba)[_0x85eb('0x19')]();};}function respondWithResult(_0x5c760a,_0x18ca53){_0x18ca53=_0x18ca53||0xc8;return function(_0x23a82a){if(_0x23a82a){return _0x5c760a[_0x85eb('0x1a')](_0x18ca53)[_0x85eb('0x1b')](_0x23a82a);}};}function respondWithFilteredResult(_0x183b0c,_0x49efdf){return function(_0x2e5c0a){if(_0x2e5c0a){var _0x59237b=typeof _0x49efdf[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x49efdf[_0x85eb('0x1e')]===_0x85eb('0x1d');var _0x5dbeda=_0x2e5c0a['count'];var _0x50d2a8=_0x59237b?0x0:_0x49efdf[_0x85eb('0x1c')];var _0x39ca96=_0x59237b?_0x2e5c0a[_0x85eb('0x1f')]:_0x49efdf[_0x85eb('0x1c')]+_0x49efdf[_0x85eb('0x1e')];var _0x34f875;if(_0x39ca96>=_0x5dbeda){_0x39ca96=_0x5dbeda;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x183b0c['status'](_0x34f875);return _0x183b0c[_0x85eb('0x20')](_0x85eb('0x21'),_0x50d2a8+'-'+_0x39ca96+'/'+_0x5dbeda)[_0x85eb('0x1b')](_0x2e5c0a);}return null;};}function patchUpdates(_0x4e8041){return function(_0x4b4b38){try{jsonpatch['apply'](_0x4b4b38,_0x4e8041,!![]);}catch(_0x55b9e4){return BPromise[_0x85eb('0x22')](_0x55b9e4);}return _0x4b4b38[_0x85eb('0x23')]();};}function saveUpdates(_0x329fc5,_0x255ca7){return function(_0x465c74){if(_0x465c74){return _0x465c74[_0x85eb('0x24')](_0x329fc5)['then'](function(_0x5491d5){return _0x5491d5;});}return null;};}function removeEntity(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(_0x1426c8){return _0x1426c8[_0x85eb('0x25')]()[_0x85eb('0x26')](function(){var _0x312b3e=_0x1426c8[_0x85eb('0x27')]({'plain':!![]});var _0x5dfc96=_0x85eb('0x28');return db[_0x85eb('0x29')][_0x85eb('0x25')]({'where':{'type':_0x5dfc96,'resourceId':_0x312b3e['id']}})[_0x85eb('0x26')](function(){return _0x1426c8;});})[_0x85eb('0x26')](function(){_0x5b48d9['status'](0xcc)[_0x85eb('0x19')]();});}};}function handleEntityNotFound(_0x792d3a,_0x291557){return function(_0x3e7eb9){if(!_0x3e7eb9){_0x792d3a[_0x85eb('0x2a')](0x194);}return _0x3e7eb9;};}function handleError(_0x29d262,_0x50541a){_0x50541a=_0x50541a||0x1f4;return function(_0x562792){logger[_0x85eb('0x2b')](_0x562792['stack']);if(_0x562792[_0x85eb('0x2c')]){delete _0x562792['name'];}_0x29d262[_0x85eb('0x1a')](_0x50541a)[_0x85eb('0x2d')](_0x562792);};}exports[_0x85eb('0x2e')]=function(_0x1d9278,_0xa67e1c){var _0xf4ac13={},_0x41ed76={},_0x5decd5={'count':0x0,'rows':[]};var _0x237f19=_[_0x85eb('0x2f')](db['VoiceMail'][_0x85eb('0x30')],function(_0x5af2de){return{'name':_0x5af2de['fieldName'],'type':_0x5af2de[_0x85eb('0x31')][_0x85eb('0x32')]};});_0x41ed76[_0x85eb('0x33')]=_[_0x85eb('0x2f')](_0x237f19,_0x85eb('0x2c'));_0x41ed76[_0x85eb('0x34')]=_[_0x85eb('0x35')](_0x1d9278[_0x85eb('0x34')]);_0x41ed76[_0x85eb('0x36')]=_[_0x85eb('0x37')](_0x41ed76['model'],_0x41ed76[_0x85eb('0x34')]);_0xf4ac13[_0x85eb('0x38')]=_['intersection'](_0x41ed76['model'],qs[_0x85eb('0x39')](_0x1d9278[_0x85eb('0x34')][_0x85eb('0x39')]));_0xf4ac13[_0x85eb('0x38')]=_0xf4ac13[_0x85eb('0x38')][_0x85eb('0x3a')]?_0xf4ac13[_0x85eb('0x38')]:_0x41ed76[_0x85eb('0x33')];if(!_0x1d9278[_0x85eb('0x34')][_0x85eb('0x3b')](_0x85eb('0x3c'))){_0xf4ac13[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x1d9278[_0x85eb('0x34')]['limit']);_0xf4ac13[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x1d9278['query']['offset']);}_0xf4ac13[_0x85eb('0x3d')]=qs[_0x85eb('0x3e')](_0x1d9278['query'][_0x85eb('0x3e')]);_0xf4ac13['where']=qs[_0x85eb('0x36')](_['pick'](_0x1d9278[_0x85eb('0x34')],_0x41ed76['filters']),_0x237f19);if(_0x1d9278[_0x85eb('0x34')]['filter']){_0xf4ac13[_0x85eb('0x3f')]=_[_0x85eb('0x40')](_0xf4ac13['where'],{'$or':_[_0x85eb('0x2f')](_0x237f19,function(_0x5a1c15){if(_0x5a1c15[_0x85eb('0x31')]!==_0x85eb('0x41')){var _0x5c0156={};_0x5c0156[_0x5a1c15[_0x85eb('0x2c')]]={'$like':'%'+_0x1d9278['query']['filter']+'%'};return _0x5c0156;}})});}_0xf4ac13=_[_0x85eb('0x40')]({},_0xf4ac13,_0x1d9278['options']);var _0x17cc20={'where':_0xf4ac13[_0x85eb('0x3f')]};return db['VoiceMail']['count'](_0x17cc20)[_0x85eb('0x26')](function(_0x422ec3){_0x5decd5['count']=_0x422ec3;if(_0x1d9278['query'][_0x85eb('0x42')]){_0xf4ac13[_0x85eb('0x43')]=[{'all':!![]}];}return db[_0x85eb('0x44')][_0x85eb('0x45')](_0xf4ac13);})[_0x85eb('0x26')](function(_0x5b7411){_0x5decd5[_0x85eb('0x46')]=_0x5b7411;return _0x5decd5;})[_0x85eb('0x26')](respondWithFilteredResult(_0xa67e1c,_0xf4ac13))[_0x85eb('0x47')](handleError(_0xa67e1c,null));};exports[_0x85eb('0x48')]=function(_0x2ed39d,_0xbc43a7){var _0x40e2a2={'raw':!![],'where':{'id':_0x2ed39d[_0x85eb('0x49')]['id']}},_0x3e11a8={};_0x3e11a8['model']=_[_0x85eb('0x35')](db[_0x85eb('0x44')]['rawAttributes']);_0x3e11a8[_0x85eb('0x34')]=_[_0x85eb('0x35')](_0x2ed39d[_0x85eb('0x34')]);_0x3e11a8[_0x85eb('0x36')]=_[_0x85eb('0x37')](_0x3e11a8[_0x85eb('0x33')],_0x3e11a8['query']);_0x40e2a2[_0x85eb('0x38')]=_[_0x85eb('0x37')](_0x3e11a8[_0x85eb('0x33')],qs[_0x85eb('0x39')](_0x2ed39d[_0x85eb('0x34')][_0x85eb('0x39')]));_0x40e2a2[_0x85eb('0x38')]=_0x40e2a2[_0x85eb('0x38')]['length']?_0x40e2a2[_0x85eb('0x38')]:_0x3e11a8[_0x85eb('0x33')];if(_0x2ed39d[_0x85eb('0x34')][_0x85eb('0x42')]){_0x40e2a2[_0x85eb('0x43')]=[{'all':!![]}];}_0x40e2a2=_[_0x85eb('0x40')]({},_0x40e2a2,_0x2ed39d[_0x85eb('0x4a')]);return db[_0x85eb('0x44')][_0x85eb('0x4b')](_0x40e2a2)[_0x85eb('0x26')](handleEntityNotFound(_0xbc43a7,null))[_0x85eb('0x26')](respondWithResult(_0xbc43a7,null))[_0x85eb('0x47')](handleError(_0xbc43a7,null));};exports['create']=function(_0x11da79,_0x2c951b){return db[_0x85eb('0x44')]['create'](_0x11da79[_0x85eb('0x4c')],{})[_0x85eb('0x26')](function(_0x2cf928){var _0xd2f302=_0x11da79[_0x85eb('0x4d')]['get']({'plain':!![]});if(!_0xd2f302)throw new Error(_0x85eb('0x4e'));if(_0xd2f302[_0x85eb('0x4f')]===_0x85eb('0x4d')){var _0x50e264=_0x2cf928[_0x85eb('0x27')]({'plain':!![]});var _0x4550fd=_0x85eb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x4550fd,'userProfileId':_0xd2f302[_0x85eb('0x50')]},'raw':!![]})['then'](function(_0x5ed98a){if(_0x5ed98a&&_0x5ed98a[_0x85eb('0x51')]===0x0){return db['UserProfileResource'][_0x85eb('0x52')]({'name':_0x50e264[_0x85eb('0x2c')],'resourceId':_0x50e264['id'],'type':_0x5ed98a['name'],'sectionId':_0x5ed98a['id']},{})['then'](function(){return _0x2cf928;});}else{return _0x2cf928;}})[_0x85eb('0x47')](function(_0x249511){logger[_0x85eb('0x2b')](_0x85eb('0x53'),_0x249511);throw _0x249511;});}return _0x2cf928;})[_0x85eb('0x26')](respondWithResult(_0x2c951b,0xc9))['catch'](handleError(_0x2c951b,null));};exports[_0x85eb('0x24')]=function(_0x30062e,_0x270bb2){if(_0x30062e[_0x85eb('0x4c')]['id']){delete _0x30062e[_0x85eb('0x4c')]['id'];}return db['VoiceMail'][_0x85eb('0x4b')]({'where':{'id':_0x30062e['params']['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x270bb2,null))[_0x85eb('0x26')](saveUpdates(_0x30062e['body'],null))[_0x85eb('0x26')](respondWithResult(_0x270bb2,null))[_0x85eb('0x47')](handleError(_0x270bb2,null));};exports[_0x85eb('0x25')]=function(_0x26e04a,_0x214ef7){return db[_0x85eb('0x44')]['find']({'where':{'id':_0x26e04a[_0x85eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x214ef7,null))[_0x85eb('0x26')](removeEntity(_0x214ef7,null))[_0x85eb('0x47')](handleError(_0x214ef7,null));};exports['getMessages']=function(_0x152452,_0x2a0f8b,_0x4a3af9){return db[_0x85eb('0x44')]['findOne']({'where':{'id':_0x152452[_0x85eb('0x49')]['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x2a0f8b,null))[_0x85eb('0x26')](function(_0x13c0b3){var _0x45a201;var _0x15d4a7={},_0x5a729e={};_0x5a729e[_0x85eb('0x33')]=_[_0x85eb('0x35')](db[_0x85eb('0x54')][_0x85eb('0x30')]);_0x5a729e[_0x85eb('0x34')]=_[_0x85eb('0x35')](_0x152452[_0x85eb('0x34')]);_0x5a729e[_0x85eb('0x36')]=_[_0x85eb('0x37')](_0x5a729e[_0x85eb('0x33')],_0x5a729e[_0x85eb('0x34')]);_0x15d4a7['attributes']=_[_0x85eb('0x37')](_0x5a729e[_0x85eb('0x33')],qs[_0x85eb('0x39')](_0x152452[_0x85eb('0x34')][_0x85eb('0x39')]));_0x15d4a7[_0x85eb('0x38')]=_0x15d4a7['attributes'][_0x85eb('0x3a')]?_0x15d4a7['attributes']:_0x5a729e[_0x85eb('0x33')];if(!_0x152452[_0x85eb('0x34')][_0x85eb('0x3b')](_0x85eb('0x3c'))){_0x15d4a7[_0x85eb('0x1e')]=qs['limit'](_0x152452[_0x85eb('0x34')][_0x85eb('0x1e')]);_0x15d4a7[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x152452[_0x85eb('0x34')][_0x85eb('0x1c')]);}_0x15d4a7[_0x85eb('0x3d')]=qs[_0x85eb('0x3e')](_0x152452['query'][_0x85eb('0x3e')]);_0x15d4a7['where']=qs[_0x85eb('0x36')](_[_0x85eb('0x55')](_0x152452[_0x85eb('0x34')],_0x5a729e[_0x85eb('0x36')]));if(_0x152452[_0x85eb('0x34')]['filter']){_0x15d4a7[_0x85eb('0x3f')]=_[_0x85eb('0x40')](_0x15d4a7[_0x85eb('0x3f')],{'$or':_[_0x85eb('0x2f')](_0x15d4a7[_0x85eb('0x38')],function(_0x419b24){var _0x562ffa={};_0x562ffa[_0x419b24]={'$like':'%'+_0x152452['query'][_0x85eb('0x56')]+'%'};return _0x562ffa;})});}_0x15d4a7['where']=_[_0x85eb('0x40')](_0x15d4a7[_0x85eb('0x3f')],{'mailboxuser':_0x13c0b3[_0x85eb('0x57')]});_0x15d4a7=_[_0x85eb('0x40')]({},_0x15d4a7,_0x152452[_0x85eb('0x4a')]);return db[_0x85eb('0x54')]['findAndCountAll'](_0x15d4a7)[_0x85eb('0x26')](respondWithFilteredResult(_0x2a0f8b,_0x15d4a7));})[_0x85eb('0x47')](handleError(_0x2a0f8b,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 93c5bd3..861a467 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 _0x9b2e=['moment','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api'];(function(_0x47a878,_0xf0a411){var _0x5cb67e=function(_0xe69e22){while(--_0xe69e22){_0x47a878['push'](_0x47a878['shift']());}};_0x5cb67e(++_0xf0a411);}(_0x9b2e,0x130));var _0xe9b2=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9b2e[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xe9b2('0x0'));var util=require(_0xe9b2('0x1'));var logger=require(_0xe9b2('0x2'))(_0xe9b2('0x3'));var moment=require(_0xe9b2('0x4'));var BPromise=require('bluebird');var rp=require(_0xe9b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9b2('0x6'));var config=require(_0xe9b2('0x7'));var attributes=require(_0xe9b2('0x8'));module[_0xe9b2('0x9')]=function(_0x105439,_0x2d29bc){return _0x105439['define'](_0xe9b2('0xa'),attributes,{'tableName':_0xe9b2('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xe9b2('0xc'),_0xe9b2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3a1=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context'];(function(_0x544a8f,_0x264129){var _0x672182=function(_0x35be15){while(--_0x35be15){_0x544a8f['push'](_0x544a8f['shift']());}};_0x672182(++_0x264129);}(_0xe3a1,0x10a));var _0x1e3a=function(_0x2c82fd,_0x233dc7){_0x2c82fd=_0x2c82fd-0x0;var _0x5f10db=_0xe3a1[_0x2c82fd];return _0x5f10db;};'use strict';var _=require(_0x1e3a('0x0'));var util=require('util');var logger=require(_0x1e3a('0x1'))('api');var moment=require(_0x1e3a('0x2'));var BPromise=require(_0x1e3a('0x3'));var rp=require(_0x1e3a('0x4'));var fs=require('fs');var path=require(_0x1e3a('0x5'));var rimraf=require(_0x1e3a('0x6'));var config=require('../../config/environment');var attributes=require(_0x1e3a('0x7'));module[_0x1e3a('0x8')]=function(_0x499fdf,_0x47ef2d){return _0x499fdf[_0x1e3a('0x9')](_0x1e3a('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x1e3a('0xb'),'fields':[_0x1e3a('0xc'),_0x1e3a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 4202b66..cf0d10d 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 _0x7326=['../../config/environment','jayson/promise','client','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x7326,0x70));var _0x6732=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x7326[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x6732('0x0'));var util=require(_0x6732('0x1'));var moment=require('moment');var BPromise=require(_0x6732('0x2'));var rs=require(_0x6732('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6732('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6732('0x5'))(_0x6732('0x6'));var config=require(_0x6732('0x7'));var jayson=require(_0x6732('0x8'));var client=jayson[_0x6732('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1322a2,_0x5da573,_0x16036f){return new BPromise(function(_0x4a5fb6,_0x265882){return client['request'](_0x1322a2,_0x16036f)[_0x6732('0xa')](function(_0x1b0774){logger[_0x6732('0xb')](_0x6732('0xc'),_0x5da573,_0x6732('0xd'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5da573,'request\x20sent',JSON['stringify'](_0x1b0774));if(_0x1b0774[_0x6732('0xe')]){if(_0x1b0774[_0x6732('0xe')]['code']===0x1f4){logger[_0x6732('0xe')](_0x6732('0xc'),_0x5da573,_0x1b0774['error'][_0x6732('0xf')]);return _0x265882(_0x1b0774['error'][_0x6732('0xf')]);}logger[_0x6732('0xe')](_0x6732('0xc'),_0x5da573,_0x1b0774[_0x6732('0xe')][_0x6732('0xf')]);return _0x4a5fb6(_0x1b0774['error']['message']);}else{logger[_0x6732('0xb')]('VoiceMail,\x20%s,\x20%s',_0x5da573,_0x6732('0xd'));_0x4a5fb6(_0x1b0774[_0x6732('0x10')][_0x6732('0xf')]);}})['catch'](function(_0x5d92a8){logger[_0x6732('0xe')](_0x6732('0xc'),_0x5da573,_0x5d92a8);_0x265882(_0x5d92a8);});});} \ No newline at end of file +var _0x7a94=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x354eab,_0x4ba996){var _0x1a7fc1=function(_0x4fe192){while(--_0x4fe192){_0x354eab['push'](_0x354eab['shift']());}};_0x1a7fc1(++_0x4ba996);}(_0x7a94,0x1a8));var _0x47a9=function(_0xe695dc,_0x227af8){_0xe695dc=_0xe695dc-0x0;var _0x487e07=_0x7a94[_0xe695dc];return _0x487e07;};'use strict';var _=require(_0x47a9('0x0'));var util=require(_0x47a9('0x1'));var moment=require(_0x47a9('0x2'));var BPromise=require(_0x47a9('0x3'));var rs=require(_0x47a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47a9('0x5'))['db'];var utils=require(_0x47a9('0x6'));var logger=require(_0x47a9('0x7'))('rpc');var config=require(_0x47a9('0x8'));var jayson=require(_0x47a9('0x9'));var client=jayson[_0x47a9('0xa')][_0x47a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14b56d,_0x23e612,_0x1edda4){return new BPromise(function(_0xd9adb,_0x51c6fe){return client[_0x47a9('0xc')](_0x14b56d,_0x1edda4)[_0x47a9('0xd')](function(_0x2e048d){logger[_0x47a9('0xe')](_0x47a9('0xf'),_0x23e612,_0x47a9('0x10'));logger[_0x47a9('0x11')](_0x47a9('0x12'),_0x23e612,_0x47a9('0x10'),JSON[_0x47a9('0x13')](_0x2e048d));if(_0x2e048d[_0x47a9('0x14')]){if(_0x2e048d[_0x47a9('0x14')][_0x47a9('0x15')]===0x1f4){logger[_0x47a9('0x14')](_0x47a9('0xf'),_0x23e612,_0x2e048d[_0x47a9('0x14')][_0x47a9('0x16')]);return _0x51c6fe(_0x2e048d[_0x47a9('0x14')][_0x47a9('0x16')]);}logger[_0x47a9('0x14')](_0x47a9('0xf'),_0x23e612,_0x2e048d[_0x47a9('0x14')][_0x47a9('0x16')]);return _0xd9adb(_0x2e048d['error']['message']);}else{logger[_0x47a9('0xe')](_0x47a9('0xf'),_0x23e612,'request\x20sent');_0xd9adb(_0x2e048d[_0x47a9('0x17')][_0x47a9('0x16')]);}})[_0x47a9('0x18')](function(_0x4cab86){logger['error'](_0x47a9('0xf'),_0x23e612,_0x4cab86);_0x51c6fe(_0x4cab86);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8d65805..2015a0c 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 _0x9dbc=['exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy'];(function(_0x4567a3,_0x3446db){var _0x50ee97=function(_0x1168b9){while(--_0x1168b9){_0x4567a3['push'](_0x4567a3['shift']());}};_0x50ee97(++_0x3446db);}(_0x9dbc,0x1cf));var _0xc9db=function(_0x52c5b0,_0x4e543e){_0x52c5b0=_0x52c5b0-0x0;var _0x3d98dc=_0x9dbc[_0x52c5b0];return _0x3d98dc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc9db('0x0'));var timeout=require(_0xc9db('0x1'));var express=require(_0xc9db('0x2'));var router=express['Router']();var fs_extra=require(_0xc9db('0x3'));var auth=require(_0xc9db('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc9db('0x5'));var controller=require(_0xc9db('0x6'));router[_0xc9db('0x7')]('/',auth[_0xc9db('0x8')](),controller[_0xc9db('0x9')]);router[_0xc9db('0x7')](_0xc9db('0xa'),auth[_0xc9db('0x8')](),controller[_0xc9db('0xb')]);router[_0xc9db('0x7')](_0xc9db('0xc'),auth[_0xc9db('0x8')](),controller[_0xc9db('0xd')]);router[_0xc9db('0xe')]('/',auth[_0xc9db('0x8')](),controller[_0xc9db('0xf')]);router[_0xc9db('0x10')]('/:id',auth[_0xc9db('0x8')](),controller[_0xc9db('0x11')]);router[_0xc9db('0x12')](_0xc9db('0xa'),auth[_0xc9db('0x8')](),controller[_0xc9db('0x13')]);module[_0xc9db('0x14')]=router; \ No newline at end of file +var _0xa33d=['../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0xa33d,0x170));var _0xda33=function(_0x15d0a2,_0x4dd3f7){_0x15d0a2=_0x15d0a2-0x0;var _0x2a9c8d=_0xa33d[_0x15d0a2];return _0x2a9c8d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xda33('0x0'));var timeout=require('connect-timeout');var express=require(_0xda33('0x1'));var router=express[_0xda33('0x2')]();var fs_extra=require(_0xda33('0x3'));var auth=require(_0xda33('0x4'));var interaction=require(_0xda33('0x5'));var config=require(_0xda33('0x6'));var controller=require(_0xda33('0x7'));router['get']('/',auth[_0xda33('0x8')](),controller[_0xda33('0x9')]);router[_0xda33('0xa')](_0xda33('0xb'),auth['isAuthenticated'](),controller[_0xda33('0xc')]);router['get'](_0xda33('0xd'),auth[_0xda33('0x8')](),controller[_0xda33('0xe')]);router[_0xda33('0xf')]('/',auth[_0xda33('0x8')](),controller[_0xda33('0x10')]);router[_0xda33('0x11')](_0xda33('0xb'),auth[_0xda33('0x8')](),controller[_0xda33('0x12')]);router[_0xda33('0x13')](_0xda33('0xb'),auth[_0xda33('0x8')](),controller[_0xda33('0x14')]);module[_0xda33('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 0111c8a..a8b1a65 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 _0xdf2a=['STRING','BLOB','long','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xdf2a,0x194));var _0xadf2=function(_0x512c80,_0x53ceb8){_0x512c80=_0x512c80-0x0;var _0x5376f6=_0xdf2a[_0x512c80];return _0x5376f6;};'use strict';var Sequelize=require(_0xadf2('0x0'));module[_0xadf2('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xa80a){return this[_0xadf2('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xadf2('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xadf2('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xadf2('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xadf2('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xadf2('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xadf2('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xadf2('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xadf2('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xadf2('0x5')](_0xadf2('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xadf2('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xadf2('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0xadf2('0x7'))}}; \ No newline at end of file +var _0xdc4c=['long','TIMESTAMP','literal','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x40326d,_0x535665){var _0x3bb05b=function(_0xbe6959){while(--_0xbe6959){_0x40326d['push'](_0x40326d['shift']());}};_0x3bb05b(++_0x535665);}(_0xdc4c,0x193));var _0xcdc4=function(_0x58a650,_0x3e8776){_0x58a650=_0x58a650-0x0;var _0x358a4d=_0xdc4c[_0x58a650];return _0x358a4d;};'use strict';var Sequelize=require(_0xcdc4('0x0'));module[_0xcdc4('0x1')]={'name':{'type':Sequelize[_0xcdc4('0x2')],'get':function(_0x184fbe){return this[_0xcdc4('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xcdc4('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xcdc4('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xcdc4('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xcdc4('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xcdc4('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xcdc4('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xcdc4('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xcdc4('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xcdc4('0x6')](_0xcdc4('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xcdc4('0x5')],'defaultValue':''},'stamp':{'type':_0xcdc4('0x8'),'defaultValue':Sequelize[_0xcdc4('0x9')]('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 1e9b918..ef542ea 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 _0x3c4f=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','recording','msg_id','Sequelize','ValidationError','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','request-promise','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2542b4,_0x554dfd){var _0x23f839=function(_0x468ce1){while(--_0x468ce1){_0x2542b4['push'](_0x2542b4['shift']());}};_0x23f839(++_0x554dfd);}(_0x3c4f,0xbb));var _0xf3c4=function(_0x54a998,_0x3148e1){_0x54a998=_0x54a998-0x0;var _0x38ecb7=_0x3c4f[_0x54a998];return _0x38ecb7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf3c4('0x0'));var zipdir=require(_0xf3c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3c4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf3c4('0x3'));var path=require(_0xf3c4('0x4'));var sox=require('sox');var csv=require(_0xf3c4('0x5'));var ejs=require(_0xf3c4('0x6'));var fs=require('fs');var fs_extra=require(_0xf3c4('0x7'));var _=require('lodash');var squel=require(_0xf3c4('0x8'));var crypto=require('crypto');var jsforce=require(_0xf3c4('0x9'));var deskjs=require(_0xf3c4('0xa'));var toCsv=require(_0xf3c4('0x5'));var querystring=require('querystring');var Papa=require(_0xf3c4('0xb'));var Redis=require(_0xf3c4('0xc'));var authService=require(_0xf3c4('0xd'));var qs=require(_0xf3c4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3c4('0xf'))(_0xf3c4('0x10'));var utils=require(_0xf3c4('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf3c4('0x12'));var db=require(_0xf3c4('0x13'))['db'];function respondWithStatusCode(_0x236d3c,_0x5b641d){_0x5b641d=_0x5b641d||0xcc;return function(_0x52e003){if(_0x52e003){return _0x236d3c[_0xf3c4('0x14')](_0x5b641d);}return _0x236d3c[_0xf3c4('0x15')](_0x5b641d)[_0xf3c4('0x16')]();};}function respondWithResult(_0x135666,_0x48e90b){_0x48e90b=_0x48e90b||0xc8;return function(_0x48cf34){if(_0x48cf34){return _0x135666['status'](_0x48e90b)[_0xf3c4('0x17')](_0x48cf34);}};}function respondWithFilteredResult(_0x32f40e,_0x49a5e2){return function(_0x4f5689){if(_0x4f5689){var _0xa4f24f=typeof _0x49a5e2[_0xf3c4('0x18')]===_0xf3c4('0x19')&&typeof _0x49a5e2[_0xf3c4('0x1a')]===_0xf3c4('0x19');var _0x5e5cf2=_0x4f5689[_0xf3c4('0x1b')];var _0x5e0a20=_0xa4f24f?0x0:_0x49a5e2[_0xf3c4('0x18')];var _0x37c597=_0xa4f24f?_0x4f5689['count']:_0x49a5e2[_0xf3c4('0x18')]+_0x49a5e2[_0xf3c4('0x1a')];var _0x1aa0bf;if(_0x37c597>=_0x5e5cf2){_0x37c597=_0x5e5cf2;_0x1aa0bf=0xc8;}else{_0x1aa0bf=0xce;}_0x32f40e[_0xf3c4('0x15')](_0x1aa0bf);return _0x32f40e[_0xf3c4('0x1c')](_0xf3c4('0x1d'),_0x5e0a20+'-'+_0x37c597+'/'+_0x5e5cf2)[_0xf3c4('0x17')](_0x4f5689);}return null;};}function patchUpdates(_0x53b1a9){return function(_0x13a077){try{jsonpatch[_0xf3c4('0x1e')](_0x13a077,_0x53b1a9,!![]);}catch(_0x25f99a){return BPromise[_0xf3c4('0x1f')](_0x25f99a);}return _0x13a077[_0xf3c4('0x20')]();};}function saveUpdates(_0x3d7542,_0x36691c){return function(_0x2a869e){if(_0x2a869e){return _0x2a869e[_0xf3c4('0x21')](_0x3d7542)['then'](function(_0x54c4e4){return _0x54c4e4;});}return null;};}function removeEntity(_0x10feef,_0x1d6c3b){return function(_0x1b4f80){if(_0x1b4f80){return _0x1b4f80[_0xf3c4('0x22')]()[_0xf3c4('0x23')](function(){_0x10feef[_0xf3c4('0x15')](0xcc)[_0xf3c4('0x16')]();});}};}function handleEntityNotFound(_0xff7830,_0x536e2c){return function(_0x1f5693){if(!_0x1f5693){_0xff7830['sendStatus'](0x194);}return _0x1f5693;};}function handleError(_0x5bab88,_0x3ef701){_0x3ef701=_0x3ef701||0x1f4;return function(_0x38d5cc){logger['error'](_0x38d5cc['stack']);if(_0x38d5cc[_0xf3c4('0x24')]){delete _0x38d5cc[_0xf3c4('0x24')];}_0x5bab88[_0xf3c4('0x15')](_0x3ef701)[_0xf3c4('0x25')](_0x38d5cc);};}exports[_0xf3c4('0x26')]=function(_0x181dba,_0x926778){var _0x211e12={},_0x5e35ac={},_0x490dda={'count':0x0,'rows':[]};var _0x4e3b08=_[_0xf3c4('0x27')](db[_0xf3c4('0x28')][_0xf3c4('0x29')],function(_0x3db9fc){return{'name':_0x3db9fc[_0xf3c4('0x2a')],'type':_0x3db9fc['type'][_0xf3c4('0x2b')]};});_0x5e35ac[_0xf3c4('0x2c')]=_[_0xf3c4('0x2d')](_['map'](_0x4e3b08,_0xf3c4('0x24')),[_0xf3c4('0x24')]);_0x5e35ac[_0xf3c4('0x2e')]=_[_0xf3c4('0x2f')](_0x181dba[_0xf3c4('0x2e')]);_0x5e35ac[_0xf3c4('0x30')]=_[_0xf3c4('0x31')](_0x5e35ac['model'],_0x5e35ac['query']);_0x211e12[_0xf3c4('0x32')]=_[_0xf3c4('0x31')](_0x5e35ac['model'],qs[_0xf3c4('0x33')](_0x181dba[_0xf3c4('0x2e')][_0xf3c4('0x33')]));_0x211e12[_0xf3c4('0x32')]=_0x211e12[_0xf3c4('0x32')][_0xf3c4('0x34')]?_0x211e12['attributes']:_0x5e35ac['model'];if(!_0x181dba[_0xf3c4('0x2e')][_0xf3c4('0x35')](_0xf3c4('0x36'))){_0x211e12[_0xf3c4('0x1a')]=qs[_0xf3c4('0x1a')](_0x181dba['query']['limit']);_0x211e12['offset']=qs['offset'](_0x181dba[_0xf3c4('0x2e')][_0xf3c4('0x18')]);}_0x211e12[_0xf3c4('0x37')]=qs[_0xf3c4('0x38')](_0x181dba[_0xf3c4('0x2e')][_0xf3c4('0x38')]);_0x211e12[_0xf3c4('0x39')]=qs['filters'](_[_0xf3c4('0x3a')](_0x181dba['query'],_0x5e35ac[_0xf3c4('0x30')]),_0x4e3b08);if(_0x181dba['query'][_0xf3c4('0x3b')]){_0x211e12['where']=_[_0xf3c4('0x3c')](_0x211e12[_0xf3c4('0x39')],{'$or':_['map'](_0x4e3b08,function(_0x5bf930){if(_0x5bf930['type']!==_0xf3c4('0x3d')){var _0x42df6b={};_0x42df6b[_0x5bf930[_0xf3c4('0x24')]]={'$like':'%'+_0x181dba['query'][_0xf3c4('0x3b')]+'%'};return _0x42df6b;}})});}_0x211e12=_['merge']({},_0x211e12,_0x181dba[_0xf3c4('0x3e')]);var _0x5a3961={'where':_0x211e12[_0xf3c4('0x39')]};return db[_0xf3c4('0x28')][_0xf3c4('0x1b')](_0x5a3961)[_0xf3c4('0x23')](function(_0xf4f8a7){_0x490dda[_0xf3c4('0x1b')]=_0xf4f8a7;if(_0x181dba[_0xf3c4('0x2e')][_0xf3c4('0x3f')]){_0x211e12[_0xf3c4('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf3c4('0x41')](_0x211e12);})['then'](function(_0x300ebd){_0x490dda[_0xf3c4('0x42')]=_0x300ebd;return _0x490dda;})['then'](respondWithFilteredResult(_0x926778,_0x211e12))[_0xf3c4('0x43')](handleError(_0x926778,null));};exports[_0xf3c4('0x44')]=function(_0x18f805,_0x5c81e5){var _0xfbd16c={'raw':!![],'where':{'id':_0x18f805[_0xf3c4('0x45')]['id']}},_0x107c9d={};_0x107c9d[_0xf3c4('0x2c')]=_[_0xf3c4('0x2f')](db[_0xf3c4('0x28')][_0xf3c4('0x29')]);_0x107c9d[_0xf3c4('0x2e')]=_['keys'](_0x18f805[_0xf3c4('0x2e')]);_0x107c9d[_0xf3c4('0x30')]=_['intersection'](_0x107c9d['model'],_0x107c9d['query']);_0xfbd16c[_0xf3c4('0x32')]=_[_0xf3c4('0x31')](_0x107c9d['model'],qs['fields'](_0x18f805[_0xf3c4('0x2e')]['fields']));_0xfbd16c['attributes']=_0xfbd16c[_0xf3c4('0x32')][_0xf3c4('0x34')]?_0xfbd16c[_0xf3c4('0x32')]:_0x107c9d[_0xf3c4('0x2c')];if(_0x18f805['query'][_0xf3c4('0x3f')]){_0xfbd16c['include']=[{'all':!![]}];}_0xfbd16c=_[_0xf3c4('0x3c')]({},_0xfbd16c,_0x18f805[_0xf3c4('0x3e')]);return db[_0xf3c4('0x28')][_0xf3c4('0x46')](_0xfbd16c)[_0xf3c4('0x23')](handleEntityNotFound(_0x5c81e5,null))['then'](respondWithResult(_0x5c81e5,null))['catch'](handleError(_0x5c81e5,null));};exports[_0xf3c4('0x47')]=function(_0x1e9dc3,_0x4fb487){return db[_0xf3c4('0x28')][_0xf3c4('0x47')](_0x1e9dc3[_0xf3c4('0x48')],{})[_0xf3c4('0x23')](respondWithResult(_0x4fb487,0xc9))[_0xf3c4('0x43')](handleError(_0x4fb487,null));};exports[_0xf3c4('0x21')]=function(_0x1e549b,_0x1a3f9d){if(_0x1e549b[_0xf3c4('0x48')]['id']){delete _0x1e549b['body']['id'];}return db['VoiceMailMessage'][_0xf3c4('0x46')]({'where':{'id':_0x1e549b[_0xf3c4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a3f9d,null))[_0xf3c4('0x23')](saveUpdates(_0x1e549b[_0xf3c4('0x48')],null))[_0xf3c4('0x23')](respondWithResult(_0x1a3f9d,null))[_0xf3c4('0x43')](handleError(_0x1a3f9d,null));};exports[_0xf3c4('0x22')]=function(_0x320ff6,_0x415891){return db[_0xf3c4('0x28')][_0xf3c4('0x46')]({'where':{'id':_0x320ff6[_0xf3c4('0x45')]['id']}})[_0xf3c4('0x23')](handleEntityNotFound(_0x415891,null))[_0xf3c4('0x23')](removeEntity(_0x415891,null))[_0xf3c4('0x43')](handleError(_0x415891,null));};exports['download']=function(_0x345366,_0x91c3f3,_0x539307){return db['VoiceMailMessage'][_0xf3c4('0x46')]({'where':{'id':_0x345366[_0xf3c4('0x45')]['id']},'attributes':['id',_0xf3c4('0x49'),_0xf3c4('0x4a')]})[_0xf3c4('0x23')](handleEntityNotFound(_0x91c3f3,null))[_0xf3c4('0x23')](function(_0x544294){if(_0x544294){if(!_0x544294[_0xf3c4('0x49')]){throw new db[(_0xf3c4('0x4b'))][(_0xf3c4('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x44f1cb={'Content-Type':'audio/wav','Content-Disposition':_0xf3c4('0x4d')};if(_0x544294[_0xf3c4('0x4a')]){_0x44f1cb[_0xf3c4('0x4e')]=_0xf3c4('0x4f')+_0x544294['msg_id']+_0xf3c4('0x50');}_0x91c3f3[_0xf3c4('0x1c')](_0x44f1cb);return _0x91c3f3[_0xf3c4('0x25')](new Buffer(_0x544294[_0xf3c4('0x49')]));}})['catch'](handleError(_0x91c3f3,null));}; \ No newline at end of file +var _0x51bd=['msg_id','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','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','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','options','VoiceMailMessage','includeAll','rows','params','include','find','catch','create','body','destroy','recording'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x51bd,0x108));var _0xd51b=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x51bd[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0xd51b('0x0'));var rimraf=require(_0xd51b('0x1'));var zipdir=require(_0xd51b('0x2'));var jsonpatch=require(_0xd51b('0x3'));var rp=require(_0xd51b('0x4'));var moment=require(_0xd51b('0x5'));var BPromise=require(_0xd51b('0x6'));var Mustache=require('mustache');var util=require(_0xd51b('0x7'));var path=require(_0xd51b('0x8'));var sox=require(_0xd51b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd51b('0xa'));var _=require(_0xd51b('0xb'));var squel=require(_0xd51b('0xc'));var crypto=require(_0xd51b('0xd'));var jsforce=require(_0xd51b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd51b('0xf'));var querystring=require(_0xd51b('0x10'));var Papa=require(_0xd51b('0x11'));var Redis=require(_0xd51b('0x12'));var authService=require(_0xd51b('0x13'));var qs=require(_0xd51b('0x14'));var as=require(_0xd51b('0x15'));var hardwareService=require(_0xd51b('0x16'));var logger=require(_0xd51b('0x17'))('api');var utils=require(_0xd51b('0x18'));var config=require(_0xd51b('0x19'));var licenseUtil=require(_0xd51b('0x1a'));var db=require(_0xd51b('0x1b'))['db'];function respondWithStatusCode(_0xeaab34,_0x1056c9){_0x1056c9=_0x1056c9||0xcc;return function(_0x5e215d){if(_0x5e215d){return _0xeaab34[_0xd51b('0x1c')](_0x1056c9);}return _0xeaab34[_0xd51b('0x1d')](_0x1056c9)['end']();};}function respondWithResult(_0x27bbe8,_0x44136c){_0x44136c=_0x44136c||0xc8;return function(_0x47bc7b){if(_0x47bc7b){return _0x27bbe8['status'](_0x44136c)[_0xd51b('0x1e')](_0x47bc7b);}};}function respondWithFilteredResult(_0xb76df7,_0x2e40d1){return function(_0x10a07a){if(_0x10a07a){var _0x3f616a=typeof _0x2e40d1[_0xd51b('0x1f')]===_0xd51b('0x20')&&typeof _0x2e40d1[_0xd51b('0x21')]===_0xd51b('0x20');var _0x28d674=_0x10a07a[_0xd51b('0x22')];var _0x15708a=_0x3f616a?0x0:_0x2e40d1['offset'];var _0x11cfad=_0x3f616a?_0x10a07a['count']:_0x2e40d1['offset']+_0x2e40d1[_0xd51b('0x21')];var _0x156939;if(_0x11cfad>=_0x28d674){_0x11cfad=_0x28d674;_0x156939=0xc8;}else{_0x156939=0xce;}_0xb76df7[_0xd51b('0x1d')](_0x156939);return _0xb76df7[_0xd51b('0x23')](_0xd51b('0x24'),_0x15708a+'-'+_0x11cfad+'/'+_0x28d674)[_0xd51b('0x1e')](_0x10a07a);}return null;};}function patchUpdates(_0x58d27e){return function(_0x227edd){try{jsonpatch[_0xd51b('0x25')](_0x227edd,_0x58d27e,!![]);}catch(_0x1cc071){return BPromise['reject'](_0x1cc071);}return _0x227edd[_0xd51b('0x26')]();};}function saveUpdates(_0x2c3a0a,_0x3ae81a){return function(_0x1cc29f){if(_0x1cc29f){return _0x1cc29f[_0xd51b('0x27')](_0x2c3a0a)[_0xd51b('0x28')](function(_0x2eb228){return _0x2eb228;});}return null;};}function removeEntity(_0x516827,_0x34952f){return function(_0x64ec51){if(_0x64ec51){return _0x64ec51['destroy']()[_0xd51b('0x28')](function(){_0x516827['status'](0xcc)[_0xd51b('0x29')]();});}};}function handleEntityNotFound(_0xa20b4a,_0x160d51){return function(_0x27771b){if(!_0x27771b){_0xa20b4a[_0xd51b('0x1c')](0x194);}return _0x27771b;};}function handleError(_0x594bee,_0x51a519){_0x51a519=_0x51a519||0x1f4;return function(_0x42e66e){logger[_0xd51b('0x2a')](_0x42e66e[_0xd51b('0x2b')]);if(_0x42e66e[_0xd51b('0x2c')]){delete _0x42e66e[_0xd51b('0x2c')];}_0x594bee[_0xd51b('0x1d')](_0x51a519)[_0xd51b('0x2d')](_0x42e66e);};}exports[_0xd51b('0x2e')]=function(_0x3a7689,_0x19e864){var _0x3b3408={},_0x2489a9={},_0x3b3c59={'count':0x0,'rows':[]};var _0x818453=_[_0xd51b('0x2f')](db['VoiceMailMessage'][_0xd51b('0x30')],function(_0x2da729){return{'name':_0x2da729[_0xd51b('0x31')],'type':_0x2da729[_0xd51b('0x32')][_0xd51b('0x33')]};});_0x2489a9[_0xd51b('0x34')]=_[_0xd51b('0x35')](_[_0xd51b('0x2f')](_0x818453,_0xd51b('0x2c')),[_0xd51b('0x2c')]);_0x2489a9[_0xd51b('0x36')]=_[_0xd51b('0x37')](_0x3a7689[_0xd51b('0x36')]);_0x2489a9[_0xd51b('0x38')]=_[_0xd51b('0x39')](_0x2489a9[_0xd51b('0x34')],_0x2489a9[_0xd51b('0x36')]);_0x3b3408[_0xd51b('0x3a')]=_[_0xd51b('0x39')](_0x2489a9[_0xd51b('0x34')],qs[_0xd51b('0x3b')](_0x3a7689[_0xd51b('0x36')]['fields']));_0x3b3408[_0xd51b('0x3a')]=_0x3b3408[_0xd51b('0x3a')][_0xd51b('0x3c')]?_0x3b3408[_0xd51b('0x3a')]:_0x2489a9[_0xd51b('0x34')];if(!_0x3a7689['query']['hasOwnProperty'](_0xd51b('0x3d'))){_0x3b3408['limit']=qs[_0xd51b('0x21')](_0x3a7689[_0xd51b('0x36')][_0xd51b('0x21')]);_0x3b3408['offset']=qs[_0xd51b('0x1f')](_0x3a7689[_0xd51b('0x36')][_0xd51b('0x1f')]);}_0x3b3408[_0xd51b('0x3e')]=qs[_0xd51b('0x3f')](_0x3a7689[_0xd51b('0x36')][_0xd51b('0x3f')]);_0x3b3408['where']=qs[_0xd51b('0x38')](_[_0xd51b('0x40')](_0x3a7689['query'],_0x2489a9[_0xd51b('0x38')]),_0x818453);if(_0x3a7689[_0xd51b('0x36')]['filter']){_0x3b3408[_0xd51b('0x41')]=_[_0xd51b('0x42')](_0x3b3408[_0xd51b('0x41')],{'$or':_[_0xd51b('0x2f')](_0x818453,function(_0x50a47d){if(_0x50a47d[_0xd51b('0x32')]!==_0xd51b('0x43')){var _0x599d97={};_0x599d97[_0x50a47d['name']]={'$like':'%'+_0x3a7689['query']['filter']+'%'};return _0x599d97;}})});}_0x3b3408=_[_0xd51b('0x42')]({},_0x3b3408,_0x3a7689[_0xd51b('0x44')]);var _0x13af7f={'where':_0x3b3408[_0xd51b('0x41')]};return db[_0xd51b('0x45')][_0xd51b('0x22')](_0x13af7f)[_0xd51b('0x28')](function(_0x535cd6){_0x3b3c59[_0xd51b('0x22')]=_0x535cd6;if(_0x3a7689[_0xd51b('0x36')][_0xd51b('0x46')]){_0x3b3408['include']=[{'all':!![]}];}return db[_0xd51b('0x45')]['findAll'](_0x3b3408);})[_0xd51b('0x28')](function(_0x4b200f){_0x3b3c59[_0xd51b('0x47')]=_0x4b200f;return _0x3b3c59;})[_0xd51b('0x28')](respondWithFilteredResult(_0x19e864,_0x3b3408))['catch'](handleError(_0x19e864,null));};exports['show']=function(_0x53d529,_0x3ecbb1){var _0x5d0972={'raw':!![],'where':{'id':_0x53d529[_0xd51b('0x48')]['id']}},_0x2f8b37={};_0x2f8b37[_0xd51b('0x34')]=_[_0xd51b('0x37')](db['VoiceMailMessage'][_0xd51b('0x30')]);_0x2f8b37[_0xd51b('0x36')]=_[_0xd51b('0x37')](_0x53d529[_0xd51b('0x36')]);_0x2f8b37[_0xd51b('0x38')]=_['intersection'](_0x2f8b37[_0xd51b('0x34')],_0x2f8b37['query']);_0x5d0972['attributes']=_[_0xd51b('0x39')](_0x2f8b37[_0xd51b('0x34')],qs[_0xd51b('0x3b')](_0x53d529[_0xd51b('0x36')][_0xd51b('0x3b')]));_0x5d0972[_0xd51b('0x3a')]=_0x5d0972[_0xd51b('0x3a')]['length']?_0x5d0972[_0xd51b('0x3a')]:_0x2f8b37[_0xd51b('0x34')];if(_0x53d529[_0xd51b('0x36')][_0xd51b('0x46')]){_0x5d0972[_0xd51b('0x49')]=[{'all':!![]}];}_0x5d0972=_[_0xd51b('0x42')]({},_0x5d0972,_0x53d529[_0xd51b('0x44')]);return db[_0xd51b('0x45')][_0xd51b('0x4a')](_0x5d0972)[_0xd51b('0x28')](handleEntityNotFound(_0x3ecbb1,null))['then'](respondWithResult(_0x3ecbb1,null))[_0xd51b('0x4b')](handleError(_0x3ecbb1,null));};exports[_0xd51b('0x4c')]=function(_0x450944,_0x380dd6){return db[_0xd51b('0x45')][_0xd51b('0x4c')](_0x450944['body'],{})[_0xd51b('0x28')](respondWithResult(_0x380dd6,0xc9))[_0xd51b('0x4b')](handleError(_0x380dd6,null));};exports[_0xd51b('0x27')]=function(_0x10cedc,_0x4412c7){if(_0x10cedc['body']['id']){delete _0x10cedc[_0xd51b('0x4d')]['id'];}return db['VoiceMailMessage'][_0xd51b('0x4a')]({'where':{'id':_0x10cedc[_0xd51b('0x48')]['id']}})[_0xd51b('0x28')](handleEntityNotFound(_0x4412c7,null))[_0xd51b('0x28')](saveUpdates(_0x10cedc[_0xd51b('0x4d')],null))[_0xd51b('0x28')](respondWithResult(_0x4412c7,null))[_0xd51b('0x4b')](handleError(_0x4412c7,null));};exports[_0xd51b('0x4e')]=function(_0x356e4b,_0x4ac75a){return db[_0xd51b('0x45')][_0xd51b('0x4a')]({'where':{'id':_0x356e4b['params']['id']}})[_0xd51b('0x28')](handleEntityNotFound(_0x4ac75a,null))[_0xd51b('0x28')](removeEntity(_0x4ac75a,null))[_0xd51b('0x4b')](handleError(_0x4ac75a,null));};exports['download']=function(_0x570516,_0x408aac,_0x3a200d){return db[_0xd51b('0x45')]['find']({'where':{'id':_0x570516[_0xd51b('0x48')]['id']},'attributes':['id',_0xd51b('0x4f'),_0xd51b('0x50')]})[_0xd51b('0x28')](handleEntityNotFound(_0x408aac,null))[_0xd51b('0x28')](function(_0x18aca0){if(_0x18aca0){if(!_0x18aca0[_0xd51b('0x4f')]){throw new db['Sequelize']['ValidationError'](_0xd51b('0x51'));}var _0x455ab8={'Content-Type':_0xd51b('0x52'),'Content-Disposition':_0xd51b('0x53')};if(_0x18aca0[_0xd51b('0x50')]){_0x455ab8[_0xd51b('0x54')]=_0xd51b('0x55')+_0x18aca0[_0xd51b('0x50')]+'.wav\x22';}_0x408aac[_0xd51b('0x23')](_0x455ab8);return _0x408aac[_0xd51b('0x2d')](new Buffer(_0x18aca0[_0xd51b('0x4f')]));}})[_0xd51b('0x4b')](handleError(_0x408aac,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 034a9d2..97e4a8e 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 _0xe10e=['lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xe10e,0x12c));var _0xee10=function(_0x57b740,_0x3a8814){_0x57b740=_0x57b740-0x0;var _0x576e93=_0xe10e[_0x57b740];return _0x576e93;};'use strict';var _=require(_0xee10('0x0'));var util=require('util');var logger=require(_0xee10('0x1'))('api');var moment=require(_0xee10('0x2'));var BPromise=require('bluebird');var rp=require(_0xee10('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee10('0x4'));var config=require(_0xee10('0x5'));var attributes=require(_0xee10('0x6'));module[_0xee10('0x7')]=function(_0x1b705f,_0x22d953){return _0x1b705f[_0xee10('0x8')](_0xee10('0x9'),attributes,{'tableName':_0xee10('0xa'),'paranoid':![],'indexes':[{'name':_0xee10('0xb'),'fields':[_0xee10('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x587f=['moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api'];(function(_0x460f2,_0x24a187){var _0x11b925=function(_0x1c426a){while(--_0x1c426a){_0x460f2['push'](_0x460f2['shift']());}};_0x11b925(++_0x24a187);}(_0x587f,0x10a));var _0xf587=function(_0x58418a,_0x3d9f06){_0x58418a=_0x58418a-0x0;var _0x2716bf=_0x587f[_0x58418a];return _0x2716bf;};'use strict';var _=require(_0xf587('0x0'));var util=require(_0xf587('0x1'));var logger=require(_0xf587('0x2'))(_0xf587('0x3'));var moment=require(_0xf587('0x4'));var BPromise=require('bluebird');var rp=require(_0xf587('0x5'));var fs=require('fs');var path=require(_0xf587('0x6'));var rimraf=require(_0xf587('0x7'));var config=require(_0xf587('0x8'));var attributes=require(_0xf587('0x9'));module[_0xf587('0xa')]=function(_0x3484af,_0x2edcc8){return _0x3484af[_0xf587('0xb')](_0xf587('0xc'),attributes,{'tableName':_0xf587('0xd'),'paranoid':![],'indexes':[{'name':_0xf587('0xe'),'fields':[_0xf587('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 59867ca..5da8bd2 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 _0x54c0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','randomstring','ioredis'];(function(_0x54d1f7,_0x587355){var _0x4587ae=function(_0x49b076){while(--_0x49b076){_0x54d1f7['push'](_0x54d1f7['shift']());}};_0x4587ae(++_0x587355);}(_0x54c0,0x1cc));var _0x054c=function(_0x104dde,_0x4aa721){_0x104dde=_0x104dde-0x0;var _0x11d644=_0x54c0[_0x104dde];return _0x11d644;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x054c('0x0'));var fs=require('fs');var Redis=require(_0x054c('0x1'));var db=require(_0x054c('0x2'))['db'];var utils=require(_0x054c('0x3'));var logger=require(_0x054c('0x4'))(_0x054c('0x5'));var config=require(_0x054c('0x6'));var jayson=require(_0x054c('0x7'));var client=jayson[_0x054c('0x8')][_0x054c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x225f76,_0x1685c4,_0x2bb96b){return new BPromise(function(_0x49b142,_0x1e01f0){return client[_0x054c('0xa')](_0x225f76,_0x2bb96b)[_0x054c('0xb')](function(_0x4c6748){logger[_0x054c('0xc')](_0x054c('0xd'),_0x1685c4,'request\x20sent');logger[_0x054c('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1685c4,_0x054c('0xf'),JSON['stringify'](_0x4c6748));if(_0x4c6748[_0x054c('0x10')]){if(_0x4c6748[_0x054c('0x10')][_0x054c('0x11')]===0x1f4){logger[_0x054c('0x10')](_0x054c('0xd'),_0x1685c4,_0x4c6748[_0x054c('0x10')][_0x054c('0x12')]);return _0x1e01f0(_0x4c6748[_0x054c('0x10')][_0x054c('0x12')]);}logger['error'](_0x054c('0xd'),_0x1685c4,_0x4c6748['error'][_0x054c('0x12')]);return _0x49b142(_0x4c6748[_0x054c('0x10')]['message']);}else{logger['info'](_0x054c('0xd'),_0x1685c4,_0x054c('0xf'));_0x49b142(_0x4c6748[_0x054c('0x13')]['message']);}})[_0x054c('0x14')](function(_0x122c63){logger[_0x054c('0x10')](_0x054c('0xd'),_0x1685c4,_0x122c63);_0x1e01f0(_0x122c63);});});} \ No newline at end of file +var _0xa670=['code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2ffc88,_0x5e91cb){var _0x52b5aa=function(_0x16a15e){while(--_0x16a15e){_0x2ffc88['push'](_0x2ffc88['shift']());}};_0x52b5aa(++_0x5e91cb);}(_0xa670,0xff));var _0x0a67=function(_0xcd190a,_0x1a5398){_0xcd190a=_0xcd190a-0x0;var _0x3c9ef4=_0xa670[_0xcd190a];return _0x3c9ef4;};'use strict';var _=require(_0x0a67('0x0'));var util=require(_0x0a67('0x1'));var moment=require(_0x0a67('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a67('0x4'));var logger=require(_0x0a67('0x5'))(_0x0a67('0x6'));var config=require(_0x0a67('0x7'));var jayson=require(_0x0a67('0x8'));var client=jayson['client'][_0x0a67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49929e,_0x8e51fc,_0x122780){return new BPromise(function(_0x525d75,_0x24f39c){return client['request'](_0x49929e,_0x122780)[_0x0a67('0xa')](function(_0x91995a){logger[_0x0a67('0xb')](_0x0a67('0xc'),_0x8e51fc,_0x0a67('0xd'));logger[_0x0a67('0xe')](_0x0a67('0xf'),_0x8e51fc,'request\x20sent',JSON[_0x0a67('0x10')](_0x91995a));if(_0x91995a[_0x0a67('0x11')]){if(_0x91995a[_0x0a67('0x11')][_0x0a67('0x12')]===0x1f4){logger['error'](_0x0a67('0xc'),_0x8e51fc,_0x91995a[_0x0a67('0x11')][_0x0a67('0x13')]);return _0x24f39c(_0x91995a[_0x0a67('0x11')]['message']);}logger[_0x0a67('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x8e51fc,_0x91995a[_0x0a67('0x11')]['message']);return _0x525d75(_0x91995a[_0x0a67('0x11')][_0x0a67('0x13')]);}else{logger[_0x0a67('0xb')](_0x0a67('0xc'),_0x8e51fc,'request\x20sent');_0x525d75(_0x91995a[_0x0a67('0x14')]['message']);}})['catch'](function(_0x15e744){logger[_0x0a67('0x11')](_0x0a67('0xc'),_0x8e51fc,_0x15e744);_0x24f39c(_0x15e744);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index de6b110..65084b6 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 _0x587b=['/:id/sounds','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','getSounds','post','create'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x587b,0x17e));var _0xb587=function(_0x15f372,_0x28c77c){_0x15f372=_0x15f372-0x0;var _0x5d49a3=_0x587b[_0x15f372];return _0x5d49a3;};'use strict';var multer=require(_0xb587('0x0'));var util=require(_0xb587('0x1'));var path=require('path');var timeout=require(_0xb587('0x2'));var express=require(_0xb587('0x3'));var router=express[_0xb587('0x4')]();var fs_extra=require(_0xb587('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb587('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0xb587('0x7')]('/',auth[_0xb587('0x8')](),controller[_0xb587('0x9')]);router[_0xb587('0x7')](_0xb587('0xa'),auth[_0xb587('0x8')](),controller['show']);router['get']('/:id/sounds',auth['isAuthenticated'](),controller[_0xb587('0xb')]);router[_0xb587('0xc')]('/',auth[_0xb587('0x8')](),controller[_0xb587('0xd')]);router['post'](_0xb587('0xe'),auth[_0xb587('0x8')](),controller[_0xb587('0xf')]);router[_0xb587('0x10')](_0xb587('0xa'),auth[_0xb587('0x8')](),controller[_0xb587('0x11')]);router['delete']('/:id',auth[_0xb587('0x8')](),controller['destroy']);router[_0xb587('0x12')](_0xb587('0x13'),auth['isAuthenticated'](),controller[_0xb587('0x14')]);module[_0xb587('0x15')]=router; \ No newline at end of file +var _0x3d94=['show','/:id/sounds','getSounds','post','create','addSound','/:id','update','destroy','/:id/sounds/:id2','removeSound','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index'];(function(_0x6b5967,_0x848f6){var _0x1cec3d=function(_0x546a0d){while(--_0x546a0d){_0x6b5967['push'](_0x6b5967['shift']());}};_0x1cec3d(++_0x848f6);}(_0x3d94,0x1ad));var _0x43d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d94[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x43d9('0x0'));var path=require(_0x43d9('0x1'));var timeout=require(_0x43d9('0x2'));var express=require(_0x43d9('0x3'));var router=express['Router']();var fs_extra=require(_0x43d9('0x4'));var auth=require(_0x43d9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x43d9('0x6'));var controller=require(_0x43d9('0x7'));router[_0x43d9('0x8')]('/',auth[_0x43d9('0x9')](),controller[_0x43d9('0xa')]);router[_0x43d9('0x8')]('/:id',auth[_0x43d9('0x9')](),controller[_0x43d9('0xb')]);router['get'](_0x43d9('0xc'),auth['isAuthenticated'](),controller[_0x43d9('0xd')]);router[_0x43d9('0xe')]('/',auth['isAuthenticated'](),controller[_0x43d9('0xf')]);router['post']('/:id/sounds',auth[_0x43d9('0x9')](),controller[_0x43d9('0x10')]);router['put'](_0x43d9('0x11'),auth[_0x43d9('0x9')](),controller[_0x43d9('0x12')]);router['delete'](_0x43d9('0x11'),auth[_0x43d9('0x9')](),controller[_0x43d9('0x13')]);router['delete'](_0x43d9('0x14'),auth[_0x43d9('0x9')](),controller[_0x43d9('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 9d2d1b2..c1bb2bc 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 _0x3c53=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x43dbe8,_0x466183){var _0xd5cd3c=function(_0x4ebdc1){while(--_0x4ebdc1){_0x43dbe8['push'](_0x43dbe8['shift']());}};_0xd5cd3c(++_0x466183);}(_0x3c53,0x1a7));var _0x33c5=function(_0x1b4d1c,_0x5f511e){_0x1b4d1c=_0x1b4d1c-0x0;var _0x5d1908=_0x3c53[_0x1b4d1c];return _0x5d1908;};'use strict';var Sequelize=require(_0x33c5('0x0'));module[_0x33c5('0x1')]={'name':{'type':Sequelize[_0x33c5('0x2')],'allowNull':![],'unique':_0x33c5('0x3')},'mode':{'type':Sequelize[_0x33c5('0x4')](_0x33c5('0x5'),_0x33c5('0x6'),_0x33c5('0x7'),_0x33c5('0x8'),_0x33c5('0x9'),_0x33c5('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x33c5('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x33c5('0xb')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x33c5('0xc')},'defaultEntry':{'type':Sequelize[_0x33c5('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x340e=['ENUM','custom','files','quietmp3nb','quietmp3','exports','STRING','name'];(function(_0x18265c,_0xfae450){var _0xf60565=function(_0xb16970){while(--_0xb16970){_0x18265c['push'](_0x18265c['shift']());}};_0xf60565(++_0xfae450);}(_0x340e,0xed));var _0xe340=function(_0x533dd9,_0x49a469){_0x533dd9=_0x533dd9-0x0;var _0x5088c6=_0x340e[_0x533dd9];return _0x5088c6;};'use strict';var Sequelize=require('sequelize');module[_0xe340('0x0')]={'name':{'type':Sequelize[_0xe340('0x1')],'allowNull':![],'unique':_0xe340('0x2')},'mode':{'type':Sequelize[_0xe340('0x3')](_0xe340('0x4'),_0xe340('0x5'),'mp3nb',_0xe340('0x6'),_0xe340('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0xe340('0x5')},'directory':{'type':Sequelize[_0xe340('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xe340('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xe340('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xe340('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 7b67025..20aaeae 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 _0x7dfc=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoiceMusicOnHold','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','sequelize','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','MusicOnHolds','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','createdAt','rawAttributes','getSounds','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js'];(function(_0x19713a,_0x537f69){var _0x4c5bbf=function(_0x2172db){while(--_0x2172db){_0x19713a['push'](_0x19713a['shift']());}};_0x4c5bbf(++_0x537f69);}(_0x7dfc,0x13e));var _0xc7df=function(_0x1621f1,_0x5c6c09){_0x1621f1=_0x1621f1-0x0;var _0x3c7b06=_0x7dfc[_0x1621f1];return _0x3c7b06;};'use strict';var emlformat=require(_0xc7df('0x0'));var rimraf=require(_0xc7df('0x1'));var zipdir=require(_0xc7df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc7df('0x3'));var moment=require(_0xc7df('0x4'));var BPromise=require(_0xc7df('0x5'));var Mustache=require(_0xc7df('0x6'));var util=require(_0xc7df('0x7'));var path=require(_0xc7df('0x8'));var sox=require(_0xc7df('0x9'));var csv=require(_0xc7df('0xa'));var ejs=require(_0xc7df('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc7df('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc7df('0xd'));var deskjs=require(_0xc7df('0xe'));var toCsv=require(_0xc7df('0xa'));var querystring=require(_0xc7df('0xf'));var Papa=require(_0xc7df('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc7df('0x11'));var as=require(_0xc7df('0x12'));var hardwareService=require(_0xc7df('0x13'));var logger=require(_0xc7df('0x14'))(_0xc7df('0x15'));var utils=require('../../config/utils');var config=require(_0xc7df('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc7df('0x17'))['db'];function respondWithStatusCode(_0x826908,_0x18bcb8){_0x18bcb8=_0x18bcb8||0xcc;return function(_0x1c1782){if(_0x1c1782){return _0x826908['sendStatus'](_0x18bcb8);}return _0x826908[_0xc7df('0x18')](_0x18bcb8)['end']();};}function respondWithResult(_0x2aa2c3,_0x3e222f){_0x3e222f=_0x3e222f||0xc8;return function(_0xb0cd23){if(_0xb0cd23){return _0x2aa2c3[_0xc7df('0x18')](_0x3e222f)[_0xc7df('0x19')](_0xb0cd23);}};}function respondWithFilteredResult(_0x1b4c40,_0x41f7d8){return function(_0x503c4c){if(_0x503c4c){var _0x34b580=typeof _0x41f7d8[_0xc7df('0x1a')]==='undefined'&&typeof _0x41f7d8['limit']===_0xc7df('0x1b');var _0xfe2c6f=_0x503c4c[_0xc7df('0x1c')];var _0x10bdb1=_0x34b580?0x0:_0x41f7d8['offset'];var _0xcc02d5=_0x34b580?_0x503c4c[_0xc7df('0x1c')]:_0x41f7d8[_0xc7df('0x1a')]+_0x41f7d8['limit'];var _0x4d8bb6;if(_0xcc02d5>=_0xfe2c6f){_0xcc02d5=_0xfe2c6f;_0x4d8bb6=0xc8;}else{_0x4d8bb6=0xce;}_0x1b4c40['status'](_0x4d8bb6);return _0x1b4c40[_0xc7df('0x1d')](_0xc7df('0x1e'),_0x10bdb1+'-'+_0xcc02d5+'/'+_0xfe2c6f)[_0xc7df('0x19')](_0x503c4c);}return null;};}function patchUpdates(_0x1f5fd5){return function(_0x3a1033){try{jsonpatch['apply'](_0x3a1033,_0x1f5fd5,!![]);}catch(_0x20bdad){return BPromise[_0xc7df('0x1f')](_0x20bdad);}return _0x3a1033[_0xc7df('0x20')]();};}function saveUpdates(_0x730e2c,_0x34c555){return function(_0x5525ca){if(_0x5525ca){return _0x5525ca[_0xc7df('0x21')](_0x730e2c)[_0xc7df('0x22')](function(_0x171d2a){return _0x171d2a;});}return null;};}function removeEntity(_0x565825,_0x5390b5){return function(_0x4a05d9){if(_0x4a05d9){return _0x4a05d9[_0xc7df('0x23')]()[_0xc7df('0x22')](function(){var _0x3fa192=_0x4a05d9['get']({'plain':!![]});var _0x5efd79='MusicOnHolds';return db[_0xc7df('0x24')][_0xc7df('0x23')]({'where':{'type':_0x5efd79,'resourceId':_0x3fa192['id']}})['then'](function(){return _0x4a05d9;});})[_0xc7df('0x22')](function(){_0x565825[_0xc7df('0x18')](0xcc)[_0xc7df('0x25')]();});}};}function handleEntityNotFound(_0x1d47d8,_0x2cbf2a){return function(_0x1f2ed1){if(!_0x1f2ed1){_0x1d47d8[_0xc7df('0x26')](0x194);}return _0x1f2ed1;};}function handleError(_0x133e48,_0x518cb0){_0x518cb0=_0x518cb0||0x1f4;return function(_0x29455a){logger[_0xc7df('0x27')](_0x29455a[_0xc7df('0x28')]);if(_0x29455a[_0xc7df('0x29')]){delete _0x29455a[_0xc7df('0x29')];}_0x133e48['status'](_0x518cb0)['send'](_0x29455a);};}exports[_0xc7df('0x2a')]=function(_0xee1890,_0xd3321f){var _0x5d2ec3={},_0x22db54={},_0x5e9df8={'count':0x0,'rows':[]};var _0x521dac=_[_0xc7df('0x2b')](db[_0xc7df('0x2c')]['rawAttributes'],function(_0xa9e5e4){return{'name':_0xa9e5e4[_0xc7df('0x2d')],'type':_0xa9e5e4['type']['key']};});_0x22db54[_0xc7df('0x2e')]=_[_0xc7df('0x2b')](_0x521dac,_0xc7df('0x29'));_0x22db54[_0xc7df('0x2f')]=_[_0xc7df('0x30')](_0xee1890[_0xc7df('0x2f')]);_0x22db54[_0xc7df('0x31')]=_[_0xc7df('0x32')](_0x22db54[_0xc7df('0x2e')],_0x22db54[_0xc7df('0x2f')]);_0x5d2ec3[_0xc7df('0x33')]=_[_0xc7df('0x32')](_0x22db54[_0xc7df('0x2e')],qs['fields'](_0xee1890[_0xc7df('0x2f')][_0xc7df('0x34')]));_0x5d2ec3[_0xc7df('0x33')]=_0x5d2ec3[_0xc7df('0x33')][_0xc7df('0x35')]?_0x5d2ec3['attributes']:_0x22db54[_0xc7df('0x2e')];if(!_0xee1890[_0xc7df('0x2f')][_0xc7df('0x36')](_0xc7df('0x37'))){_0x5d2ec3[_0xc7df('0x38')]=qs[_0xc7df('0x38')](_0xee1890['query'][_0xc7df('0x38')]);_0x5d2ec3[_0xc7df('0x1a')]=qs[_0xc7df('0x1a')](_0xee1890[_0xc7df('0x2f')][_0xc7df('0x1a')]);}_0x5d2ec3[_0xc7df('0x39')]=qs[_0xc7df('0x3a')](_0xee1890[_0xc7df('0x2f')]['sort']);delete _0xee1890['query'][_0xc7df('0x3a')];_0x5d2ec3[_0xc7df('0x3b')]=qs[_0xc7df('0x31')](_[_0xc7df('0x3c')](_0xee1890[_0xc7df('0x2f')],_0x22db54[_0xc7df('0x31')]),_0x521dac);if(_0xee1890[_0xc7df('0x2f')][_0xc7df('0x3d')]){_0x5d2ec3[_0xc7df('0x3b')]=_[_0xc7df('0x3e')](_0x5d2ec3[_0xc7df('0x3b')],{'$or':_['map'](_0x521dac,function(_0x2ba81c){if(_0x2ba81c[_0xc7df('0x3f')]!==_0xc7df('0x40')){var _0x2985d7={};_0x2985d7[_0x2ba81c[_0xc7df('0x29')]]={'$like':'%'+_0xee1890[_0xc7df('0x2f')][_0xc7df('0x3d')]+'%'};return _0x2985d7;}})});}_0x5d2ec3=_[_0xc7df('0x3e')]({},_0x5d2ec3,_0xee1890[_0xc7df('0x41')]);var _0x4173e0={'where':_0x5d2ec3[_0xc7df('0x3b')]};return db['VoiceMusicOnHold'][_0xc7df('0x1c')](_0x4173e0)[_0xc7df('0x22')](function(_0x463ace){_0x5e9df8[_0xc7df('0x1c')]=_0x463ace;if(_0xee1890[_0xc7df('0x2f')][_0xc7df('0x42')]){_0x5d2ec3[_0xc7df('0x43')]=[{'all':!![]}];}return db[_0xc7df('0x2c')][_0xc7df('0x44')](_0x5d2ec3);})[_0xc7df('0x22')](function(_0x19ca32){_0x5e9df8[_0xc7df('0x45')]=_0x19ca32;return _0x5e9df8;})[_0xc7df('0x22')](respondWithFilteredResult(_0xd3321f,_0x5d2ec3))[_0xc7df('0x46')](handleError(_0xd3321f,null));};exports[_0xc7df('0x47')]=function(_0x1479c7,_0xb131ff){var _0x7ddce0={'raw':![],'where':{'id':_0x1479c7[_0xc7df('0x48')]['id']}},_0x40184d={};_0x40184d[_0xc7df('0x2e')]=_[_0xc7df('0x30')](db[_0xc7df('0x2c')]['rawAttributes']);_0x40184d[_0xc7df('0x2f')]=_[_0xc7df('0x30')](_0x1479c7[_0xc7df('0x2f')]);_0x40184d[_0xc7df('0x31')]=_['intersection'](_0x40184d[_0xc7df('0x2e')],_0x40184d[_0xc7df('0x2f')]);_0x7ddce0[_0xc7df('0x33')]=_[_0xc7df('0x32')](_0x40184d[_0xc7df('0x2e')],qs[_0xc7df('0x34')](_0x1479c7['query'][_0xc7df('0x34')]));_0x7ddce0[_0xc7df('0x33')]=_0x7ddce0[_0xc7df('0x33')][_0xc7df('0x35')]?_0x7ddce0['attributes']:_0x40184d['model'];if(_0x1479c7[_0xc7df('0x2f')][_0xc7df('0x42')]){_0x7ddce0['include']=[{'all':!![]}];}_0x7ddce0=_[_0xc7df('0x3e')]({},_0x7ddce0,_0x1479c7['options']);return db[_0xc7df('0x2c')][_0xc7df('0x49')](_0x7ddce0)['then'](handleEntityNotFound(_0xb131ff,null))[_0xc7df('0x22')](respondWithResult(_0xb131ff,null))[_0xc7df('0x46')](handleError(_0xb131ff,null));};exports[_0xc7df('0x21')]=function(_0x12dbb1,_0x16b704){if(_0x12dbb1[_0xc7df('0x4a')]['id']){delete _0x12dbb1[_0xc7df('0x4a')]['id'];}return db[_0xc7df('0x2c')][_0xc7df('0x49')]({'where':{'id':_0x12dbb1[_0xc7df('0x48')]['id']}})[_0xc7df('0x22')](handleEntityNotFound(_0x16b704,null))[_0xc7df('0x22')](saveUpdates(_0x12dbb1[_0xc7df('0x4a')],null))[_0xc7df('0x22')](respondWithResult(_0x16b704,null))['catch'](handleError(_0x16b704,null));};exports['create']=function(_0x5eb7d9,_0x41c905,_0x54fb15){return db[_0xc7df('0x4b')]['transaction'](function(_0x27ace4){if(_0x5eb7d9[_0xc7df('0x4a')][_0xc7df('0x4c')]===_0xc7df('0x4d')){_0x5eb7d9[_0xc7df('0x4a')]['directory']=path[_0xc7df('0x4e')](config[_0xc7df('0x4f')],_0xc7df('0x50'),_0x5eb7d9[_0xc7df('0x4a')][_0xc7df('0x29')]);}return db['VoiceMusicOnHold']['create'](_0x5eb7d9[_0xc7df('0x4a')],{'transaction':_0x27ace4})[_0xc7df('0x22')](function(_0xb95753){if(_0x5eb7d9[_0xc7df('0x4a')]['mode']==='files'){fs[_0xc7df('0x51')](_0xb95753[_0xc7df('0x52')],parseInt(_0xc7df('0x53'),0x8));}var _0x1dc24b=_0x5eb7d9['user'][_0xc7df('0x54')]({'plain':!![]});if(!_0x1dc24b)throw new Error(_0xc7df('0x55'));if(_0x1dc24b['role']==='user'){var _0xe3eb17=_0xb95753[_0xc7df('0x54')]({'plain':!![]});return db['UserProfileSection'][_0xc7df('0x49')]({'where':{'name':_0xc7df('0x56'),'userProfileId':_0x1dc24b[_0xc7df('0x57')]},'raw':!![]})[_0xc7df('0x22')](function(_0x3b8c8e){if(_0x3b8c8e&&_0x3b8c8e[_0xc7df('0x58')]===0x0){return db[_0xc7df('0x24')][_0xc7df('0x59')]({'name':_0xe3eb17[_0xc7df('0x29')],'resourceId':_0xe3eb17['id'],'type':_0x3b8c8e[_0xc7df('0x29')],'sectionId':_0x3b8c8e['id']},{})['then'](function(){return _0xb95753;});}else{return _0xb95753;}})[_0xc7df('0x46')](function(_0x538c4c){logger['error'](_0xc7df('0x5a'),_0x538c4c);});}return _0xb95753;});})[_0xc7df('0x22')](respondWithResult(_0x41c905,0xc9))['catch'](handleError(_0x41c905,null));};exports[_0xc7df('0x23')]=function(_0x451569,_0x206116,_0x68a4fb){var _0x48b470;return db['VoiceMusicOnHold'][_0xc7df('0x49')]({'where':{'id':_0x451569[_0xc7df('0x48')]['id']}})[_0xc7df('0x22')](function(_0x18dd4d){if(_0x18dd4d){return db[_0xc7df('0x4b')][_0xc7df('0x5b')](function(_0x69f1b){return _0x18dd4d[_0xc7df('0x23')]({'transaction':_0x69f1b,'raw':!![]})[_0xc7df('0x22')](function(_0x5d54a6){if(_0x5d54a6[_0xc7df('0x52')]){fs['readdirSync'](_0x5d54a6['directory'])['forEach'](function(_0x36f60a){fs['unlinkSync'](path['join'](_0x5d54a6[_0xc7df('0x52')],_0x36f60a));});fs[_0xc7df('0x5c')](_0x5d54a6[_0xc7df('0x52')]);}return _0x5d54a6;});})[_0xc7df('0x46')](function(_0x71f3a4){throw new db[(_0xc7df('0x5d'))][(_0xc7df('0x5e'))](_0x71f3a4[_0xc7df('0x5f')]);});}})[_0xc7df('0x22')](handleEntityNotFound(_0x206116,null))[_0xc7df('0x22')](removeEntity(_0x206116,null))['catch'](handleError(_0x206116,null));};exports[_0xc7df('0x60')]=function(_0x1de89a,_0x1f73a9,_0x28eb14){return db[_0xc7df('0x4b')][_0xc7df('0x5b')](function(_0x500e7a){var _0x3dc864;return db[_0xc7df('0x2c')]['find']({'where':{'id':_0x1de89a[_0xc7df('0x48')]['id']}})[_0xc7df('0x22')](function(_0x100393){if(_0x100393){_0x3dc864=_0x100393;return _0x100393[_0xc7df('0x60')](_0x1de89a[_0xc7df('0x4a')]['id'],{'transaction':_0x500e7a});}})['then'](function(_0x2f369e){if(_0x2f369e){return db[_0xc7df('0x61')][_0xc7df('0x62')]({'where':{'id':_0x1de89a[_0xc7df('0x4a')]['id']},'attributes':['id','name',_0xc7df('0x63'),_0xc7df('0x64'),'createdAt'],'raw':!![]});}})[_0xc7df('0x22')](function(_0x616dc5){if(_0x616dc5){var _0x2486f3=path[_0xc7df('0x4e')](config[_0xc7df('0x4f')],'server/files/sounds/converted',util[_0xc7df('0x65')](_0xc7df('0x66'),path[_0xc7df('0x67')](_0x616dc5['save_name'],path[_0xc7df('0x68')](_0x616dc5[_0xc7df('0x63')])),_0x616dc5[_0xc7df('0x64')]));var _0x5039e3=path[_0xc7df('0x4e')](config[_0xc7df('0x4f')],_0xc7df('0x50'),_0x3dc864[_0xc7df('0x29')],util[_0xc7df('0x65')](_0xc7df('0x66'),_0x616dc5[_0xc7df('0x29')],_0x616dc5['converted_format']));fs[_0xc7df('0x69')](_0x2486f3,_0x5039e3);return _0x616dc5;}})[_0xc7df('0x46')](function(_0x2355bf){throw new db[(_0xc7df('0x5d'))]['ValidationError'](_0x2355bf['message']);});})[_0xc7df('0x22')](handleEntityNotFound(_0x1f73a9,null))[_0xc7df('0x22')](respondWithResult(_0x1f73a9,0xc9))['catch'](handleError(_0x1f73a9,null));};exports['removeSound']=function(_0x32c8c1,_0x20d02c,_0x3ead1e){return db['sequelize']['transaction'](function(_0x1bc5e2){var _0x13acad;return db[_0xc7df('0x2c')]['findOne']({'where':{'id':_0x32c8c1[_0xc7df('0x48')]['id']}})[_0xc7df('0x22')](handleEntityNotFound(_0x20d02c,null))[_0xc7df('0x22')](function(_0x3fc8f0){if(_0x3fc8f0){_0x13acad=_0x3fc8f0;return _0x3fc8f0[_0xc7df('0x6a')](_0x32c8c1[_0xc7df('0x48')]['id2']);}})['then'](function(_0x4be5c0){if(_0x4be5c0){return db[_0xc7df('0x61')][_0xc7df('0x62')]({'where':{'id':_0x32c8c1['params'][_0xc7df('0x6b')]},'attributes':['id','name',_0xc7df('0x63'),_0xc7df('0x64'),_0xc7df('0x6c')],'raw':!![]});}})[_0xc7df('0x22')](function(_0x37f3e1){if(_0x37f3e1){fs['unlinkSync'](path[_0xc7df('0x4e')](_0x13acad[_0xc7df('0x52')],util[_0xc7df('0x65')](_0xc7df('0x66'),_0x37f3e1['name'],_0x37f3e1[_0xc7df('0x64')])));return _0x37f3e1;}})['catch'](function(_0x316bb6){throw new db['Sequelize'][(_0xc7df('0x5e'))](_0x316bb6['message']);});})[_0xc7df('0x22')](handleEntityNotFound(_0x20d02c,null))['then'](respondWithStatusCode(_0x20d02c,0xcc))[_0xc7df('0x46')](handleError(_0x20d02c,null));};exports['getSounds']=function(_0x156ddb,_0xefb374,_0x25d9fb){var _0x55d219={};var _0x32adae={};var _0x46c778;var _0x2b0846;return db['VoiceMusicOnHold'][_0xc7df('0x62')]({'where':{'id':_0x156ddb['params']['id']}})[_0xc7df('0x22')](handleEntityNotFound(_0xefb374,null))[_0xc7df('0x22')](function(_0x1111c8){if(_0x1111c8){_0x46c778=_0x1111c8;_0x32adae[_0xc7df('0x2e')]=_[_0xc7df('0x30')](db[_0xc7df('0x61')][_0xc7df('0x6d')]);_0x32adae[_0xc7df('0x2f')]=_[_0xc7df('0x30')](_0x156ddb[_0xc7df('0x2f')]);_0x32adae[_0xc7df('0x31')]=_['intersection'](_0x32adae[_0xc7df('0x2e')],_0x32adae['query']);_0x55d219[_0xc7df('0x33')]=_[_0xc7df('0x32')](_0x32adae[_0xc7df('0x2e')],qs['fields'](_0x156ddb[_0xc7df('0x2f')][_0xc7df('0x34')]));_0x55d219['attributes']=_0x55d219['attributes'][_0xc7df('0x35')]?_0x55d219[_0xc7df('0x33')]:_0x32adae[_0xc7df('0x2e')];_0x55d219[_0xc7df('0x39')]=qs[_0xc7df('0x3a')](_0x156ddb['query']['sort']);_0x55d219['where']=qs[_0xc7df('0x31')](_[_0xc7df('0x3c')](_0x156ddb[_0xc7df('0x2f')],_0x32adae[_0xc7df('0x31')]));if(_0x156ddb[_0xc7df('0x2f')][_0xc7df('0x3d')]){_0x55d219[_0xc7df('0x3b')]=_[_0xc7df('0x3e')](_0x55d219[_0xc7df('0x3b')],{'$or':_[_0xc7df('0x2b')](_0x55d219[_0xc7df('0x33')],function(_0xdd1362){var _0x48e87f={};_0x48e87f[_0xdd1362]={'$like':'%'+_0x156ddb[_0xc7df('0x2f')][_0xc7df('0x3d')]+'%'};return _0x48e87f;})});}_0x55d219=_['merge']({},_0x55d219,_0x156ddb[_0xc7df('0x41')]);return _0x46c778[_0xc7df('0x6e')](_0x55d219);}})['then'](function(_0x94e7fc){if(_0x94e7fc){_0x2b0846=_0x94e7fc[_0xc7df('0x35')];if(!_0x156ddb[_0xc7df('0x2f')]['hasOwnProperty'](_0xc7df('0x37'))){_0x55d219[_0xc7df('0x38')]=qs['limit'](_0x156ddb[_0xc7df('0x2f')][_0xc7df('0x38')]);_0x55d219[_0xc7df('0x1a')]=qs[_0xc7df('0x1a')](_0x156ddb[_0xc7df('0x2f')][_0xc7df('0x1a')]);}return _0x46c778[_0xc7df('0x6e')](_0x55d219);}})[_0xc7df('0x22')](function(_0x2446c4){if(_0x2446c4){return _0x2446c4?{'count':_0x2b0846,'rows':_0x2446c4}:null;}})[_0xc7df('0x22')](respondWithResult(_0xefb374,null))[_0xc7df('0x46')](handleError(_0xefb374,null));}; \ No newline at end of file +var _0xaeef=['findAll','rows','catch','show','params','includeAll','find','update','body','create','sequelize','transaction','mode','files','directory','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','root','removeSound','findOne','id2','getSounds','eml-format','fast-json-patch','request-promise','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x182b0a,_0x19bab4){var _0x5e2580=function(_0x383632){while(--_0x383632){_0x182b0a['push'](_0x182b0a['shift']());}};_0x5e2580(++_0x19bab4);}(_0xaeef,0x171));var _0xfaee=function(_0x509a73,_0x5dd81f){_0x509a73=_0x509a73-0x0;var _0x100c31=_0xaeef[_0x509a73];return _0x100c31;};'use strict';var emlformat=require(_0xfaee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfaee('0x1'));var rp=require(_0xfaee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfaee('0x3'));var path=require(_0xfaee('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfaee('0x5'));var fs=require('fs');var fs_extra=require(_0xfaee('0x6'));var _=require(_0xfaee('0x7'));var squel=require(_0xfaee('0x8'));var crypto=require(_0xfaee('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfaee('0xa'));var toCsv=require('to-csv');var querystring=require(_0xfaee('0xb'));var Papa=require(_0xfaee('0xc'));var Redis=require(_0xfaee('0xd'));var authService=require(_0xfaee('0xe'));var qs=require(_0xfaee('0xf'));var as=require(_0xfaee('0x10'));var hardwareService=require(_0xfaee('0x11'));var logger=require(_0xfaee('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfaee('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfaee('0x14'))['db'];function respondWithStatusCode(_0x53648b,_0x3f5e08){_0x3f5e08=_0x3f5e08||0xcc;return function(_0x5a630c){if(_0x5a630c){return _0x53648b[_0xfaee('0x15')](_0x3f5e08);}return _0x53648b[_0xfaee('0x16')](_0x3f5e08)['end']();};}function respondWithResult(_0x565a91,_0x1e0408){_0x1e0408=_0x1e0408||0xc8;return function(_0x1f585b){if(_0x1f585b){return _0x565a91[_0xfaee('0x16')](_0x1e0408)['json'](_0x1f585b);}};}function respondWithFilteredResult(_0x2aad43,_0x1e03a7){return function(_0x14e749){if(_0x14e749){var _0x54e887=typeof _0x1e03a7[_0xfaee('0x17')]===_0xfaee('0x18')&&typeof _0x1e03a7['limit']===_0xfaee('0x18');var _0x36e4d6=_0x14e749[_0xfaee('0x19')];var _0x110942=_0x54e887?0x0:_0x1e03a7[_0xfaee('0x17')];var _0x5125d0=_0x54e887?_0x14e749[_0xfaee('0x19')]:_0x1e03a7[_0xfaee('0x17')]+_0x1e03a7[_0xfaee('0x1a')];var _0xfcea72;if(_0x5125d0>=_0x36e4d6){_0x5125d0=_0x36e4d6;_0xfcea72=0xc8;}else{_0xfcea72=0xce;}_0x2aad43[_0xfaee('0x16')](_0xfcea72);return _0x2aad43[_0xfaee('0x1b')](_0xfaee('0x1c'),_0x110942+'-'+_0x5125d0+'/'+_0x36e4d6)['json'](_0x14e749);}return null;};}function patchUpdates(_0x3e4534){return function(_0x1dad62){try{jsonpatch[_0xfaee('0x1d')](_0x1dad62,_0x3e4534,!![]);}catch(_0x3f2ce6){return BPromise['reject'](_0x3f2ce6);}return _0x1dad62[_0xfaee('0x1e')]();};}function saveUpdates(_0x4dab7f,_0x146276){return function(_0x462508){if(_0x462508){return _0x462508['update'](_0x4dab7f)[_0xfaee('0x1f')](function(_0x1c349b){return _0x1c349b;});}return null;};}function removeEntity(_0x10fee9,_0x3fd787){return function(_0x3ee782){if(_0x3ee782){return _0x3ee782['destroy']()[_0xfaee('0x1f')](function(){var _0x1f1246=_0x3ee782[_0xfaee('0x20')]({'plain':!![]});var _0x3c5a56=_0xfaee('0x21');return db[_0xfaee('0x22')][_0xfaee('0x23')]({'where':{'type':_0x3c5a56,'resourceId':_0x1f1246['id']}})[_0xfaee('0x1f')](function(){return _0x3ee782;});})[_0xfaee('0x1f')](function(){_0x10fee9[_0xfaee('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb25c4,_0xdad668){return function(_0x1030b1){if(!_0x1030b1){_0xdb25c4[_0xfaee('0x15')](0x194);}return _0x1030b1;};}function handleError(_0x49d8cb,_0x2fe207){_0x2fe207=_0x2fe207||0x1f4;return function(_0x3fb175){logger[_0xfaee('0x24')](_0x3fb175[_0xfaee('0x25')]);if(_0x3fb175[_0xfaee('0x26')]){delete _0x3fb175['name'];}_0x49d8cb[_0xfaee('0x16')](_0x2fe207)[_0xfaee('0x27')](_0x3fb175);};}exports['index']=function(_0x13bb63,_0xb06d85){var _0x2b6aa3={},_0x162f5f={},_0x2e40d4={'count':0x0,'rows':[]};var _0x5b20c2=_[_0xfaee('0x28')](db[_0xfaee('0x29')][_0xfaee('0x2a')],function(_0x88a45a){return{'name':_0x88a45a['fieldName'],'type':_0x88a45a[_0xfaee('0x2b')][_0xfaee('0x2c')]};});_0x162f5f[_0xfaee('0x2d')]=_['map'](_0x5b20c2,_0xfaee('0x26'));_0x162f5f['query']=_[_0xfaee('0x2e')](_0x13bb63[_0xfaee('0x2f')]);_0x162f5f['filters']=_['intersection'](_0x162f5f[_0xfaee('0x2d')],_0x162f5f[_0xfaee('0x2f')]);_0x2b6aa3[_0xfaee('0x30')]=_[_0xfaee('0x31')](_0x162f5f[_0xfaee('0x2d')],qs[_0xfaee('0x32')](_0x13bb63[_0xfaee('0x2f')]['fields']));_0x2b6aa3[_0xfaee('0x30')]=_0x2b6aa3[_0xfaee('0x30')][_0xfaee('0x33')]?_0x2b6aa3[_0xfaee('0x30')]:_0x162f5f[_0xfaee('0x2d')];if(!_0x13bb63[_0xfaee('0x2f')][_0xfaee('0x34')](_0xfaee('0x35'))){_0x2b6aa3[_0xfaee('0x1a')]=qs['limit'](_0x13bb63[_0xfaee('0x2f')][_0xfaee('0x1a')]);_0x2b6aa3[_0xfaee('0x17')]=qs[_0xfaee('0x17')](_0x13bb63[_0xfaee('0x2f')][_0xfaee('0x17')]);}_0x2b6aa3[_0xfaee('0x36')]=qs[_0xfaee('0x37')](_0x13bb63[_0xfaee('0x2f')][_0xfaee('0x37')]);delete _0x13bb63[_0xfaee('0x2f')][_0xfaee('0x37')];_0x2b6aa3[_0xfaee('0x38')]=qs[_0xfaee('0x39')](_[_0xfaee('0x3a')](_0x13bb63[_0xfaee('0x2f')],_0x162f5f[_0xfaee('0x39')]),_0x5b20c2);if(_0x13bb63['query']['filter']){_0x2b6aa3['where']=_[_0xfaee('0x3b')](_0x2b6aa3[_0xfaee('0x38')],{'$or':_['map'](_0x5b20c2,function(_0x53463b){if(_0x53463b['type']!==_0xfaee('0x3c')){var _0x197cd4={};_0x197cd4[_0x53463b[_0xfaee('0x26')]]={'$like':'%'+_0x13bb63[_0xfaee('0x2f')][_0xfaee('0x3d')]+'%'};return _0x197cd4;}})});}_0x2b6aa3=_['merge']({},_0x2b6aa3,_0x13bb63[_0xfaee('0x3e')]);var _0x1cf97b={'where':_0x2b6aa3['where']};return db['VoiceMusicOnHold'][_0xfaee('0x19')](_0x1cf97b)[_0xfaee('0x1f')](function(_0x439e8f){_0x2e40d4[_0xfaee('0x19')]=_0x439e8f;if(_0x13bb63[_0xfaee('0x2f')]['includeAll']){_0x2b6aa3['include']=[{'all':!![]}];}return db[_0xfaee('0x29')][_0xfaee('0x3f')](_0x2b6aa3);})[_0xfaee('0x1f')](function(_0x442569){_0x2e40d4[_0xfaee('0x40')]=_0x442569;return _0x2e40d4;})[_0xfaee('0x1f')](respondWithFilteredResult(_0xb06d85,_0x2b6aa3))[_0xfaee('0x41')](handleError(_0xb06d85,null));};exports[_0xfaee('0x42')]=function(_0x35ef6f,_0x1e61af){var _0xc430ce={'raw':![],'where':{'id':_0x35ef6f[_0xfaee('0x43')]['id']}},_0x59d4d5={};_0x59d4d5[_0xfaee('0x2d')]=_[_0xfaee('0x2e')](db['VoiceMusicOnHold'][_0xfaee('0x2a')]);_0x59d4d5[_0xfaee('0x2f')]=_[_0xfaee('0x2e')](_0x35ef6f[_0xfaee('0x2f')]);_0x59d4d5['filters']=_[_0xfaee('0x31')](_0x59d4d5[_0xfaee('0x2d')],_0x59d4d5[_0xfaee('0x2f')]);_0xc430ce['attributes']=_[_0xfaee('0x31')](_0x59d4d5[_0xfaee('0x2d')],qs[_0xfaee('0x32')](_0x35ef6f[_0xfaee('0x2f')][_0xfaee('0x32')]));_0xc430ce[_0xfaee('0x30')]=_0xc430ce[_0xfaee('0x30')][_0xfaee('0x33')]?_0xc430ce[_0xfaee('0x30')]:_0x59d4d5[_0xfaee('0x2d')];if(_0x35ef6f[_0xfaee('0x2f')][_0xfaee('0x44')]){_0xc430ce['include']=[{'all':!![]}];}_0xc430ce=_[_0xfaee('0x3b')]({},_0xc430ce,_0x35ef6f[_0xfaee('0x3e')]);return db[_0xfaee('0x29')][_0xfaee('0x45')](_0xc430ce)[_0xfaee('0x1f')](handleEntityNotFound(_0x1e61af,null))[_0xfaee('0x1f')](respondWithResult(_0x1e61af,null))[_0xfaee('0x41')](handleError(_0x1e61af,null));};exports[_0xfaee('0x46')]=function(_0x101d1a,_0x3a4520){if(_0x101d1a[_0xfaee('0x47')]['id']){delete _0x101d1a[_0xfaee('0x47')]['id'];}return db[_0xfaee('0x29')][_0xfaee('0x45')]({'where':{'id':_0x101d1a[_0xfaee('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a4520,null))[_0xfaee('0x1f')](saveUpdates(_0x101d1a[_0xfaee('0x47')],null))[_0xfaee('0x1f')](respondWithResult(_0x3a4520,null))[_0xfaee('0x41')](handleError(_0x3a4520,null));};exports[_0xfaee('0x48')]=function(_0x38a8ad,_0x56c85b,_0x3c29f1){return db[_0xfaee('0x49')][_0xfaee('0x4a')](function(_0x29c713){if(_0x38a8ad[_0xfaee('0x47')][_0xfaee('0x4b')]===_0xfaee('0x4c')){_0x38a8ad[_0xfaee('0x47')][_0xfaee('0x4d')]=path['join'](config['root'],_0xfaee('0x4e'),_0x38a8ad[_0xfaee('0x47')][_0xfaee('0x26')]);}return db['VoiceMusicOnHold']['create'](_0x38a8ad[_0xfaee('0x47')],{'transaction':_0x29c713})['then'](function(_0x5c2ab9){if(_0x38a8ad['body'][_0xfaee('0x4b')]===_0xfaee('0x4c')){fs['mkdirSync'](_0x5c2ab9[_0xfaee('0x4d')],parseInt(_0xfaee('0x4f'),0x8));}var _0x573a19=_0x38a8ad[_0xfaee('0x50')][_0xfaee('0x20')]({'plain':!![]});if(!_0x573a19)throw new Error(_0xfaee('0x51'));if(_0x573a19[_0xfaee('0x52')]===_0xfaee('0x50')){var _0x206b1a=_0x5c2ab9['get']({'plain':!![]});return db['UserProfileSection'][_0xfaee('0x45')]({'where':{'name':_0xfaee('0x21'),'userProfileId':_0x573a19[_0xfaee('0x53')]},'raw':!![]})[_0xfaee('0x1f')](function(_0x195bf5){if(_0x195bf5&&_0x195bf5[_0xfaee('0x54')]===0x0){return db[_0xfaee('0x22')][_0xfaee('0x48')]({'name':_0x206b1a['name'],'resourceId':_0x206b1a['id'],'type':_0x195bf5[_0xfaee('0x26')],'sectionId':_0x195bf5['id']},{})['then'](function(){return _0x5c2ab9;});}else{return _0x5c2ab9;}})[_0xfaee('0x41')](function(_0x485f56){logger['error'](_0xfaee('0x55'),_0x485f56);});}return _0x5c2ab9;});})[_0xfaee('0x1f')](respondWithResult(_0x56c85b,0xc9))[_0xfaee('0x41')](handleError(_0x56c85b,null));};exports[_0xfaee('0x23')]=function(_0x5e694b,_0x26619e,_0x3de8e6){var _0x390749;return db[_0xfaee('0x29')][_0xfaee('0x45')]({'where':{'id':_0x5e694b['params']['id']}})[_0xfaee('0x1f')](function(_0x159d5c){if(_0x159d5c){return db['sequelize'][_0xfaee('0x4a')](function(_0x3a7687){return _0x159d5c[_0xfaee('0x23')]({'transaction':_0x3a7687,'raw':!![]})[_0xfaee('0x1f')](function(_0x361951){if(_0x361951[_0xfaee('0x4d')]){fs[_0xfaee('0x56')](_0x361951[_0xfaee('0x4d')])[_0xfaee('0x57')](function(_0x23f2ff){fs[_0xfaee('0x58')](path[_0xfaee('0x59')](_0x361951['directory'],_0x23f2ff));});fs[_0xfaee('0x5a')](_0x361951[_0xfaee('0x4d')]);}return _0x361951;});})['catch'](function(_0x20e106){throw new db[(_0xfaee('0x5b'))][(_0xfaee('0x5c'))](_0x20e106[_0xfaee('0x5d')]);});}})['then'](handleEntityNotFound(_0x26619e,null))[_0xfaee('0x1f')](removeEntity(_0x26619e,null))[_0xfaee('0x41')](handleError(_0x26619e,null));};exports[_0xfaee('0x5e')]=function(_0x27647e,_0xa8d371,_0x233cdc){return db[_0xfaee('0x49')][_0xfaee('0x4a')](function(_0x486045){var _0x351fe1;return db[_0xfaee('0x29')][_0xfaee('0x45')]({'where':{'id':_0x27647e[_0xfaee('0x43')]['id']}})['then'](function(_0x4f715b){if(_0x4f715b){_0x351fe1=_0x4f715b;return _0x4f715b[_0xfaee('0x5e')](_0x27647e['body']['id'],{'transaction':_0x486045});}})[_0xfaee('0x1f')](function(_0x5e4a76){if(_0x5e4a76){return db[_0xfaee('0x5f')]['findOne']({'where':{'id':_0x27647e['body']['id']},'attributes':['id','name',_0xfaee('0x60'),_0xfaee('0x61'),_0xfaee('0x62')],'raw':!![]});}})['then'](function(_0x47ee38){if(_0x47ee38){var _0x56fde7=path['join'](config['root'],_0xfaee('0x63'),util[_0xfaee('0x64')](_0xfaee('0x65'),path[_0xfaee('0x66')](_0x47ee38[_0xfaee('0x60')],path['extname'](_0x47ee38[_0xfaee('0x60')])),_0x47ee38[_0xfaee('0x61')]));var _0x20aefa=path[_0xfaee('0x59')](config[_0xfaee('0x67')],'server/files/moh',_0x351fe1['name'],util[_0xfaee('0x64')]('%s.%s',_0x47ee38[_0xfaee('0x26')],_0x47ee38['converted_format']));fs['symlinkSync'](_0x56fde7,_0x20aefa);return _0x47ee38;}})[_0xfaee('0x41')](function(_0xe86c02){throw new db['Sequelize'][(_0xfaee('0x5c'))](_0xe86c02['message']);});})['then'](handleEntityNotFound(_0xa8d371,null))[_0xfaee('0x1f')](respondWithResult(_0xa8d371,0xc9))[_0xfaee('0x41')](handleError(_0xa8d371,null));};exports[_0xfaee('0x68')]=function(_0x43d803,_0x19412c,_0x268f98){return db['sequelize'][_0xfaee('0x4a')](function(_0x414e25){var _0x2b0e84;return db[_0xfaee('0x29')][_0xfaee('0x69')]({'where':{'id':_0x43d803['params']['id']}})[_0xfaee('0x1f')](handleEntityNotFound(_0x19412c,null))[_0xfaee('0x1f')](function(_0x3aa52f){if(_0x3aa52f){_0x2b0e84=_0x3aa52f;return _0x3aa52f['removeSound'](_0x43d803[_0xfaee('0x43')][_0xfaee('0x6a')]);}})[_0xfaee('0x1f')](function(_0x53814d){if(_0x53814d){return db['Sound'][_0xfaee('0x69')]({'where':{'id':_0x43d803['params']['id2']},'attributes':['id',_0xfaee('0x26'),_0xfaee('0x60'),_0xfaee('0x61'),_0xfaee('0x62')],'raw':!![]});}})[_0xfaee('0x1f')](function(_0xbe35d3){if(_0xbe35d3){fs['unlinkSync'](path[_0xfaee('0x59')](_0x2b0e84[_0xfaee('0x4d')],util['format']('%s.%s',_0xbe35d3[_0xfaee('0x26')],_0xbe35d3['converted_format'])));return _0xbe35d3;}})[_0xfaee('0x41')](function(_0x93c585){throw new db['Sequelize'][(_0xfaee('0x5c'))](_0x93c585[_0xfaee('0x5d')]);});})[_0xfaee('0x1f')](handleEntityNotFound(_0x19412c,null))[_0xfaee('0x1f')](respondWithStatusCode(_0x19412c,0xcc))['catch'](handleError(_0x19412c,null));};exports[_0xfaee('0x6b')]=function(_0x32b358,_0x2144ab,_0x48d4aa){var _0xabbc67={};var _0x1a8d29={};var _0x38ca86;var _0x3d0a86;return db[_0xfaee('0x29')][_0xfaee('0x69')]({'where':{'id':_0x32b358[_0xfaee('0x43')]['id']}})[_0xfaee('0x1f')](handleEntityNotFound(_0x2144ab,null))['then'](function(_0x340796){if(_0x340796){_0x38ca86=_0x340796;_0x1a8d29['model']=_['keys'](db[_0xfaee('0x5f')][_0xfaee('0x2a')]);_0x1a8d29[_0xfaee('0x2f')]=_['keys'](_0x32b358[_0xfaee('0x2f')]);_0x1a8d29['filters']=_[_0xfaee('0x31')](_0x1a8d29[_0xfaee('0x2d')],_0x1a8d29['query']);_0xabbc67[_0xfaee('0x30')]=_[_0xfaee('0x31')](_0x1a8d29[_0xfaee('0x2d')],qs[_0xfaee('0x32')](_0x32b358[_0xfaee('0x2f')][_0xfaee('0x32')]));_0xabbc67[_0xfaee('0x30')]=_0xabbc67[_0xfaee('0x30')]['length']?_0xabbc67[_0xfaee('0x30')]:_0x1a8d29['model'];_0xabbc67[_0xfaee('0x36')]=qs['sort'](_0x32b358['query']['sort']);_0xabbc67[_0xfaee('0x38')]=qs[_0xfaee('0x39')](_[_0xfaee('0x3a')](_0x32b358[_0xfaee('0x2f')],_0x1a8d29[_0xfaee('0x39')]));if(_0x32b358['query']['filter']){_0xabbc67[_0xfaee('0x38')]=_[_0xfaee('0x3b')](_0xabbc67[_0xfaee('0x38')],{'$or':_['map'](_0xabbc67['attributes'],function(_0x1ed604){var _0x570e38={};_0x570e38[_0x1ed604]={'$like':'%'+_0x32b358['query'][_0xfaee('0x3d')]+'%'};return _0x570e38;})});}_0xabbc67=_[_0xfaee('0x3b')]({},_0xabbc67,_0x32b358[_0xfaee('0x3e')]);return _0x38ca86[_0xfaee('0x6b')](_0xabbc67);}})[_0xfaee('0x1f')](function(_0x1696aa){if(_0x1696aa){_0x3d0a86=_0x1696aa['length'];if(!_0x32b358[_0xfaee('0x2f')]['hasOwnProperty'](_0xfaee('0x35'))){_0xabbc67[_0xfaee('0x1a')]=qs[_0xfaee('0x1a')](_0x32b358['query'][_0xfaee('0x1a')]);_0xabbc67[_0xfaee('0x17')]=qs[_0xfaee('0x17')](_0x32b358[_0xfaee('0x2f')]['offset']);}return _0x38ca86['getSounds'](_0xabbc67);}})[_0xfaee('0x1f')](function(_0x2569e0){if(_0x2569e0){return _0x2569e0?{'count':_0x3d0a86,'rows':_0x2569e0}:null;}})[_0xfaee('0x1f')](respondWithResult(_0x2144ab,null))['catch'](handleError(_0x2144ab,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0e8618d..ca1eaae 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 _0x5f7c=['define','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x5f7c,0x1a8));var _0xc5f7=function(_0x2669cc,_0x2972da){_0x2669cc=_0x2669cc-0x0;var _0xd0a05d=_0x5f7c[_0x2669cc];return _0xd0a05d;};'use strict';var _=require(_0xc5f7('0x0'));var util=require('util');var logger=require(_0xc5f7('0x1'))(_0xc5f7('0x2'));var moment=require('moment');var BPromise=require(_0xc5f7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc5f7('0x4'));var config=require(_0xc5f7('0x5'));var attributes=require(_0xc5f7('0x6'));module[_0xc5f7('0x7')]=function(_0xae244e,_0x520364){return _0xae244e[_0xc5f7('0x8')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bc3=['../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x50a026,_0x1dcf3a){var _0x3dd42b=function(_0x4e60e9){while(--_0x4e60e9){_0x50a026['push'](_0x50a026['shift']());}};_0x3dd42b(++_0x1dcf3a);}(_0x9bc3,0xe2));var _0x39bc=function(_0x2af53e,_0x2222e5){_0x2af53e=_0x2af53e-0x0;var _0x4ed385=_0x9bc3[_0x2af53e];return _0x4ed385;};'use strict';var _=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var logger=require(_0x39bc('0x2'))(_0x39bc('0x3'));var moment=require(_0x39bc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x39bc('0x5'));var rimraf=require(_0x39bc('0x6'));var config=require(_0x39bc('0x7'));var attributes=require(_0x39bc('0x8'));module['exports']=function(_0x2d0170,_0x4db879){return _0x2d0170[_0x39bc('0x9')](_0x39bc('0xa'),attributes,{'tableName':_0x39bc('0xb'),'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 5a1cb98..0499ed7 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x52ebff,_0x39c31f){var _0x11a06f=function(_0x2022f6){while(--_0x2022f6){_0x52ebff['push'](_0x52ebff['shift']());}};_0x11a06f(++_0x39c31f);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x347452,_0x4a2ee4){var _0x204ebf=function(_0x2dde96){while(--_0x2dde96){_0x347452['push'](_0x347452['shift']());}};_0x204ebf(++_0x4a2ee4);}(_0x70e0,0x17b));var _0x070e=function(_0x2f4d3b,_0x4d8152){_0x2f4d3b=_0x2f4d3b-0x0;var _0x4d2f79=_0x70e0[_0x2f4d3b];return _0x4d2f79;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index fadaaf7..370cfb1 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 _0x31cf=['post','addAgents','put','update','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','describe','/:id','show','/:id/users','getAgents','create'];(function(_0x3b8487,_0x1e57d1){var _0x3ed9d5=function(_0x1ce391){while(--_0x1ce391){_0x3b8487['push'](_0x3b8487['shift']());}};_0x3ed9d5(++_0x1e57d1);}(_0x31cf,0x1a6));var _0xf31c=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x31cf[_0xf48cce];return _0x2a5c38;};'use strict';var multer=require(_0xf31c('0x0'));var util=require(_0xf31c('0x1'));var path=require(_0xf31c('0x2'));var timeout=require(_0xf31c('0x3'));var express=require(_0xf31c('0x4'));var router=express[_0xf31c('0x5')]();var fs_extra=require(_0xf31c('0x6'));var auth=require(_0xf31c('0x7'));var interaction=require(_0xf31c('0x8'));var config=require(_0xf31c('0x9'));var controller=require(_0xf31c('0xa'));router['get']('/',auth[_0xf31c('0xb')](),controller[_0xf31c('0xc')]);router[_0xf31c('0xd')]('/describe',auth['isAuthenticated'](),controller[_0xf31c('0xe')]);router[_0xf31c('0xd')](_0xf31c('0xf'),auth['isAuthenticated'](),controller[_0xf31c('0x10')]);router[_0xf31c('0xd')](_0xf31c('0x11'),auth[_0xf31c('0xb')](),controller[_0xf31c('0x12')]);router['post']('/',auth[_0xf31c('0xb')](),controller[_0xf31c('0x13')]);router[_0xf31c('0x14')](_0xf31c('0x11'),auth[_0xf31c('0xb')](),controller[_0xf31c('0x15')]);router[_0xf31c('0x16')](_0xf31c('0xf'),auth['isAuthenticated'](),controller[_0xf31c('0x17')]);router['delete'](_0xf31c('0xf'),auth[_0xf31c('0xb')](),controller['destroy']);router['delete'](_0xf31c('0x11'),auth[_0xf31c('0xb')](),controller[_0xf31c('0x18')]);module[_0xf31c('0x19')]=router; \ No newline at end of file +var _0x5907=['get','/:id/users','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','/describe','describe'];(function(_0xfa52b,_0x33f677){var _0x26828f=function(_0x2d21ae){while(--_0x2d21ae){_0xfa52b['push'](_0xfa52b['shift']());}};_0x26828f(++_0x33f677);}(_0x5907,0x1db));var _0x7590=function(_0x57b3a7,_0x11538c){_0x57b3a7=_0x57b3a7-0x0;var _0x41b803=_0x5907[_0x57b3a7];return _0x41b803;};'use strict';var multer=require(_0x7590('0x0'));var util=require(_0x7590('0x1'));var path=require(_0x7590('0x2'));var timeout=require(_0x7590('0x3'));var express=require(_0x7590('0x4'));var router=express[_0x7590('0x5')]();var fs_extra=require(_0x7590('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7590('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x7590('0x8')](),controller['index']);router['get'](_0x7590('0x9'),auth[_0x7590('0x8')](),controller[_0x7590('0xa')]);router[_0x7590('0xb')]('/:id',auth[_0x7590('0x8')](),controller['show']);router[_0x7590('0xb')](_0x7590('0xc'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x7590('0x8')](),controller['create']);router['post'](_0x7590('0xc'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7590('0xd')](_0x7590('0xe'),auth['isAuthenticated'](),controller[_0x7590('0xf')]);router[_0x7590('0x10')](_0x7590('0xe'),auth[_0x7590('0x8')](),controller[_0x7590('0x11')]);router['delete']('/:id/users',auth[_0x7590('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f853cee..4361f29 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 _0x13d1=['INTEGER','sequelize','exports','system-','name','STRING'];(function(_0x5c1c97,_0x51f714){var _0x379dda=function(_0x3d1b9f){while(--_0x3d1b9f){_0x5c1c97['push'](_0x5c1c97['shift']());}};_0x379dda(++_0x51f714);}(_0x13d1,0xfd));var _0x113d=function(_0x51ea9f,_0x5b4577){_0x51ea9f=_0x51ea9f-0x0;var _0x5915a1=_0x13d1[_0x51ea9f];return _0x5915a1;};'use strict';var Sequelize=require(_0x113d('0x0'));module[_0x113d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x180616){return _0x113d('0x2')+this['getDataValue'](_0x113d('0x3'))+'-';}},'description':{'type':Sequelize[_0x113d('0x4')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x113d('0x5')]}}; \ No newline at end of file +var _0xf9ac=['name','INTEGER','exports','STRING','getDataValue'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0xf9ac,0x15b));var _0xcf9a=function(_0x484339,_0x37f834){_0x484339=_0x484339-0x0;var _0x30d3bc=_0xf9ac[_0x484339];return _0x30d3bc;};'use strict';var Sequelize=require('sequelize');module[_0xcf9a('0x0')]={'name':{'type':Sequelize[_0xcf9a('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x7b054b){return'system-'+this[_0xcf9a('0x2')](_0xcf9a('0x3'))+'-';}},'description':{'type':Sequelize[_0xcf9a('0x1')]},'callerIdAll':{'type':Sequelize[_0xcf9a('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xcf9a('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 0747667..189f23e 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 _0x9649=['from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','transaction','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','send','index','map','VoicePrefix','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','rows','params','rawAttributes','options','find','catch','describe','create','sequelize','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xc99c77,_0x244e7a){var _0x338339=function(_0x50e80b){while(--_0x50e80b){_0xc99c77['push'](_0xc99c77['shift']());}};_0x338339(++_0x244e7a);}(_0x9649,0x118));var _0x9964=function(_0x5e20fe,_0x5e932a){_0x5e20fe=_0x5e20fe-0x0;var _0x1abfec=_0x9649[_0x5e20fe];return _0x1abfec;};'use strict';var emlformat=require(_0x9964('0x0'));var rimraf=require(_0x9964('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9964('0x2'));var rp=require(_0x9964('0x3'));var moment=require(_0x9964('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9964('0x5'));var util=require(_0x9964('0x6'));var path=require(_0x9964('0x7'));var sox=require(_0x9964('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9964('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9964('0xa'));var jsforce=require(_0x9964('0xb'));var deskjs=require(_0x9964('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9964('0xd'));var Papa=require(_0x9964('0xe'));var Redis=require(_0x9964('0xf'));var authService=require(_0x9964('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9964('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9964('0x12'))(_0x9964('0x13'));var utils=require('../../config/utils');var config=require(_0x9964('0x14'));var licenseUtil=require(_0x9964('0x15'));var db=require('../../mysqldb')['db'];config[_0x9964('0x16')]=_['defaults'](config[_0x9964('0x16')],{'host':_0x9964('0x17'),'port':0x18eb});var socket=require(_0x9964('0x18'))(new Redis(config[_0x9964('0x16')]));require(_0x9964('0x19'))[_0x9964('0x1a')](socket);function respondWithStatusCode(_0x44ce20,_0x59efc7){_0x59efc7=_0x59efc7||0xcc;return function(_0x5b722f){if(_0x5b722f){return _0x44ce20[_0x9964('0x1b')](_0x59efc7);}return _0x44ce20[_0x9964('0x1c')](_0x59efc7)['end']();};}function respondWithResult(_0x416340,_0x2b0aba){_0x2b0aba=_0x2b0aba||0xc8;return function(_0x41ed6b){if(_0x41ed6b){return _0x416340[_0x9964('0x1c')](_0x2b0aba)[_0x9964('0x1d')](_0x41ed6b);}};}function respondWithFilteredResult(_0x2c12f8,_0x51ecc5){return function(_0x2a7a61){if(_0x2a7a61){var _0x21766f=typeof _0x51ecc5['offset']==='undefined'&&typeof _0x51ecc5['limit']===_0x9964('0x1e');var _0xc4c0fe=_0x2a7a61[_0x9964('0x1f')];var _0x3661d4=_0x21766f?0x0:_0x51ecc5['offset'];var _0x3813d1=_0x21766f?_0x2a7a61['count']:_0x51ecc5[_0x9964('0x20')]+_0x51ecc5[_0x9964('0x21')];var _0x209929;if(_0x3813d1>=_0xc4c0fe){_0x3813d1=_0xc4c0fe;_0x209929=0xc8;}else{_0x209929=0xce;}_0x2c12f8[_0x9964('0x1c')](_0x209929);return _0x2c12f8[_0x9964('0x22')](_0x9964('0x23'),_0x3661d4+'-'+_0x3813d1+'/'+_0xc4c0fe)[_0x9964('0x1d')](_0x2a7a61);}return null;};}function patchUpdates(_0x341c56){return function(_0x5c52af){try{jsonpatch[_0x9964('0x24')](_0x5c52af,_0x341c56,!![]);}catch(_0x3069d7){return BPromise[_0x9964('0x25')](_0x3069d7);}return _0x5c52af[_0x9964('0x26')]();};}function saveUpdates(_0x5b2689,_0x20c522){return function(_0x988bf7){if(_0x988bf7){return _0x988bf7[_0x9964('0x27')](_0x5b2689)[_0x9964('0x28')](function(_0x4be822){return _0x4be822;});}return null;};}function removeEntity(_0x5d4a5e,_0x3911e0){return function(_0x35211b){if(_0x35211b){return _0x35211b[_0x9964('0x29')]()[_0x9964('0x28')](function(){var _0xd48c01=_0x35211b[_0x9964('0x2a')]({'plain':!![]});var _0x33be7b='VoicePrefixes';return db['UserProfileResource'][_0x9964('0x29')]({'where':{'type':_0x33be7b,'resourceId':_0xd48c01['id']}})[_0x9964('0x28')](function(){return _0x35211b;});})[_0x9964('0x28')](function(){_0x5d4a5e[_0x9964('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x201656,_0x3a59df){return function(_0x396054){if(!_0x396054){_0x201656[_0x9964('0x1b')](0x194);}return _0x396054;};}function handleError(_0x178089,_0x5f4f1b){_0x5f4f1b=_0x5f4f1b||0x1f4;return function(_0x4c04ce){logger[_0x9964('0x2b')](_0x4c04ce[_0x9964('0x2c')]);if(_0x4c04ce['name']){delete _0x4c04ce['name'];}_0x178089['status'](_0x5f4f1b)[_0x9964('0x2d')](_0x4c04ce);};}exports[_0x9964('0x2e')]=function(_0x54e25a,_0x4cc9a1){var _0x322323={},_0x15ff7d={},_0x1876d8={'count':0x0,'rows':[]};var _0x2ed9e0=_[_0x9964('0x2f')](db[_0x9964('0x30')]['rawAttributes'],function(_0x3eb46b){return{'name':_0x3eb46b[_0x9964('0x31')],'type':_0x3eb46b[_0x9964('0x32')]['key']};});_0x15ff7d[_0x9964('0x33')]=_[_0x9964('0x2f')](_0x2ed9e0,_0x9964('0x34'));_0x15ff7d['query']=_[_0x9964('0x35')](_0x54e25a[_0x9964('0x36')]);_0x15ff7d[_0x9964('0x37')]=_[_0x9964('0x38')](_0x15ff7d[_0x9964('0x33')],_0x15ff7d[_0x9964('0x36')]);_0x322323[_0x9964('0x39')]=_[_0x9964('0x38')](_0x15ff7d[_0x9964('0x33')],qs[_0x9964('0x3a')](_0x54e25a[_0x9964('0x36')][_0x9964('0x3a')]));_0x322323[_0x9964('0x39')]=_0x322323[_0x9964('0x39')][_0x9964('0x3b')]?_0x322323[_0x9964('0x39')]:_0x15ff7d[_0x9964('0x33')];if(!_0x54e25a[_0x9964('0x36')]['hasOwnProperty'](_0x9964('0x3c'))){_0x322323['limit']=qs[_0x9964('0x21')](_0x54e25a[_0x9964('0x36')]['limit']);_0x322323[_0x9964('0x20')]=qs['offset'](_0x54e25a[_0x9964('0x36')][_0x9964('0x20')]);}_0x322323[_0x9964('0x3d')]=qs[_0x9964('0x3e')](_0x54e25a[_0x9964('0x36')][_0x9964('0x3e')]);_0x322323['where']=qs[_0x9964('0x37')](_[_0x9964('0x3f')](_0x54e25a[_0x9964('0x36')],_0x15ff7d[_0x9964('0x37')]),_0x2ed9e0);if(_0x54e25a['query'][_0x9964('0x40')]){_0x322323['where']=_[_0x9964('0x41')](_0x322323[_0x9964('0x42')],{'$or':_[_0x9964('0x2f')](_0x2ed9e0,function(_0x2acc2e){if(_0x2acc2e[_0x9964('0x32')]!==_0x9964('0x43')){var _0x42eb44={};_0x42eb44[_0x2acc2e[_0x9964('0x34')]]={'$like':'%'+_0x54e25a[_0x9964('0x36')][_0x9964('0x40')]+'%'};return _0x42eb44;}})});}_0x322323=_[_0x9964('0x41')]({},_0x322323,_0x54e25a['options']);var _0x2a77ce={'where':_0x322323[_0x9964('0x42')]};return db[_0x9964('0x30')][_0x9964('0x1f')](_0x2a77ce)['then'](function(_0x138a3a){_0x1876d8['count']=_0x138a3a;if(_0x54e25a['query'][_0x9964('0x44')]){_0x322323['include']=[{'all':!![]}];}return db[_0x9964('0x30')]['findAll'](_0x322323);})[_0x9964('0x28')](function(_0x246fab){_0x1876d8[_0x9964('0x45')]=_0x246fab;return _0x1876d8;})['then'](respondWithFilteredResult(_0x4cc9a1,_0x322323))['catch'](handleError(_0x4cc9a1,null));};exports['show']=function(_0x157b2c,_0x100c5f){var _0x5f0f94={'raw':![],'where':{'id':_0x157b2c[_0x9964('0x46')]['id']}},_0x3b4275={};_0x3b4275[_0x9964('0x33')]=_['keys'](db[_0x9964('0x30')][_0x9964('0x47')]);_0x3b4275[_0x9964('0x36')]=_[_0x9964('0x35')](_0x157b2c['query']);_0x3b4275[_0x9964('0x37')]=_[_0x9964('0x38')](_0x3b4275[_0x9964('0x33')],_0x3b4275[_0x9964('0x36')]);_0x5f0f94[_0x9964('0x39')]=_['intersection'](_0x3b4275[_0x9964('0x33')],qs[_0x9964('0x3a')](_0x157b2c['query'][_0x9964('0x3a')]));_0x5f0f94[_0x9964('0x39')]=_0x5f0f94[_0x9964('0x39')]['length']?_0x5f0f94[_0x9964('0x39')]:_0x3b4275[_0x9964('0x33')];if(_0x157b2c[_0x9964('0x36')][_0x9964('0x44')]){_0x5f0f94['include']=[{'all':!![]}];}_0x5f0f94=_[_0x9964('0x41')]({},_0x5f0f94,_0x157b2c[_0x9964('0x48')]);return db[_0x9964('0x30')][_0x9964('0x49')](_0x5f0f94)['then'](handleEntityNotFound(_0x100c5f,null))[_0x9964('0x28')](respondWithResult(_0x100c5f,null))[_0x9964('0x4a')](handleError(_0x100c5f,null));};exports[_0x9964('0x29')]=function(_0x3d80db,_0x1c1ba7){return db['VoicePrefix'][_0x9964('0x49')]({'where':{'id':_0x3d80db[_0x9964('0x46')]['id']}})[_0x9964('0x28')](handleEntityNotFound(_0x1c1ba7,null))[_0x9964('0x28')](removeEntity(_0x1c1ba7,null))[_0x9964('0x4a')](handleError(_0x1c1ba7,null));};exports[_0x9964('0x4b')]=function(_0x451a3,_0x4128ca){return db['VoicePrefix'][_0x9964('0x4b')]()[_0x9964('0x28')](respondWithResult(_0x4128ca,null))[_0x9964('0x4a')](handleError(_0x4128ca,null));};exports[_0x9964('0x4c')]=function(_0x557851,_0x3532b0){var _0x1ed5b5;return db[_0x9964('0x4d')]['transaction'](function(_0x25faa5){return db[_0x9964('0x30')]['create'](_0x557851[_0x9964('0x4e')],{'transaction':_0x25faa5})[_0x9964('0x28')](function(_0x495a00){_0x1ed5b5=_0x495a00[_0x9964('0x2a')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x1ed5b5[_0x9964('0x4f')]},'raw':!![]})[_0x9964('0x28')](function(_0x12642b){return createVoicePrefixExtensions(_0x1ed5b5,_0x12642b,_0x25faa5);});});})[_0x9964('0x28')](function(){var _0x20f678=_0x557851[_0x9964('0x50')][_0x9964('0x2a')]({'plain':!![]});if(!_0x20f678)throw new Error(_0x9964('0x51'));if(_0x20f678[_0x9964('0x52')]==='user'){var _0x2ca871=_0x1ed5b5;return db[_0x9964('0x53')][_0x9964('0x49')]({'where':{'name':_0x9964('0x54'),'userProfileId':_0x20f678[_0x9964('0x55')]},'raw':!![]})[_0x9964('0x28')](function(_0x5433fb){if(_0x5433fb&&_0x5433fb[_0x9964('0x56')]===0x0){return db[_0x9964('0x57')][_0x9964('0x4c')]({'name':_0x2ca871['name'],'resourceId':_0x2ca871['id'],'type':_0x5433fb['name'],'sectionId':_0x5433fb['id']},{})[_0x9964('0x28')](function(){return _0x1ed5b5;});}else{return _0x1ed5b5;}})['catch'](function(_0x3d8653){logger['error'](_0x9964('0x58'),_0x3d8653);throw _0x3d8653;});}return _0x1ed5b5;})['then'](respondWithResult(_0x3532b0,null))[_0x9964('0x4a')](handleError(_0x3532b0,null));};function Extension(_0x2c5f71,_0x3264c0,_0x1826fb,_0x55cce6){this['context']=_0x9964('0x59');this[_0x9964('0x5a')]=_0x2c5f71;this['app']=_0x1826fb;this[_0x9964('0x32')]='system';this[_0x9964('0x5b')]=_0x9964('0x5c');this[_0x9964('0x5d')]=_0x3264c0;this[_0x9964('0x5e')]=_0x55cce6;}function createVoicePrefixExtensions(_0x26aa89,_0x57dcc9,_0x357a98){return new BPromise(function(_0x84ae9,_0x34287e){var _0x5bd8fe=new Extension(formatPrefixName(_0x26aa89[_0x9964('0x5f')]),0x1,_0x9964('0x60'),'Voice\x20Prefix');_0x5bd8fe[_0x9964('0x61')]=_0x26aa89['id'];return db[_0x9964('0x62')][_0x9964('0x4c')](_0x5bd8fe,{'transaction':_0x357a98})[_0x9964('0x28')](function(_0x18ad70){var _0x4b6385=_0x18ad70[_0x9964('0x2a')]({'plain':!![]});var _0x2ea3dd=_[_0x9964('0x2f')](addVoicePrefixExtensions(_0x26aa89,_0x57dcc9),function(_0x46ef18){_0x46ef18['VoiceExtensionId']=_0x4b6385['id'];_0x46ef18[_0x9964('0x61')]=_0x26aa89['id'];return _0x46ef18;});return db[_0x9964('0x62')][_0x9964('0x63')](_0x2ea3dd,{'transaction':_0x357a98})['then'](function(_0xcc606){if(!_0xcc606){return _0x34287e(_0x9964('0x64'));}else{return _0x84ae9(_0xcc606);}})[_0x9964('0x4a')](function(_0x209fb5){return _0x34287e(_0x209fb5);});});;});};function addVoicePrefixExtensions(_0x3e2577,_0x330c82){var _0x5829c2=[];var _0xc5c6e3=formatPrefixName(_0x3e2577[_0x9964('0x5f')]);_0x5829c2['push'](new Extension(_0xc5c6e3,0x2,'Set',_0x9964('0x65')+_0x3e2577[_0x9964('0x34')]));if(_0x3e2577[_0x9964('0x66')]){_0x5829c2['push'](new Extension(_0xc5c6e3,0x3,'Set',_0x9964('0x67')+_0x3e2577[_0x9964('0x66')]));}else{_0x5829c2[_0x9964('0x68')](new Extension(_0xc5c6e3,0x3,'NoOp',_0x9964('0x69')));}_0x5829c2[_0x9964('0x68')](new Extension(_0xc5c6e3,0x4,_0x9964('0x6a'),_0x330c82[_0x9964('0x6b')]+','+_0x9964('0x6c')+(0x8+_0x3e2577[_0x9964('0x34')][_0x9964('0x3b')])+'}'+','+0x1));return _0x5829c2;}function formatPrefixName(_0x5996e9){var _0x55fbcd='_';for(var _0x25bee7=0x0;_0x25bee7<_0x5996e9[_0x9964('0x3b')];_0x25bee7++){if(_0x5996e9[_0x9964('0x6d')](_0x25bee7)=='-'){_0x55fbcd+=_0x5996e9[_0x9964('0x6d')](_0x25bee7);}else{_0x55fbcd+='['+_0x5996e9['charAt'](_0x25bee7)+']';}}_0x55fbcd+='.';return _0x55fbcd;}exports['update']=function(_0x4a31a5,_0x36c907,_0x5936f5){var _0x1d7cdc=_0x4a31a5[_0x9964('0x4e')];_0x1d7cdc['prefix']=_0x9964('0x6e')+_0x1d7cdc[_0x9964('0x34')]+'-';return db[_0x9964('0x4d')][_0x9964('0x6f')](function(_0x3ecac0){return db[_0x9964('0x30')]['update'](_0x1d7cdc,{'where':{'id':_0x1d7cdc['id']},'transaction':_0x3ecac0})[_0x9964('0x28')](function(){return db['VoiceExtension'][_0x9964('0x29')]({'where':{'VoicePrefixId':_0x1d7cdc['id']},'transaction':_0x3ecac0})['then'](function(){return db[_0x9964('0x62')][_0x9964('0x49')]({'where':{'id':_0x1d7cdc[_0x9964('0x4f')]},'raw':!![]})['then'](function(_0x16f511){return createVoicePrefixExtensions(_0x1d7cdc,_0x16f511,_0x3ecac0);});});});})['then'](function(){return db[_0x9964('0x30')]['findById'](_0x1d7cdc['id']);})[_0x9964('0x28')](respondWithResult(_0x36c907,null))[_0x9964('0x4a')](handleError(_0x36c907,null));};exports[_0x9964('0x70')]=function(_0x426823,_0x15284a,_0xdbd87b){return db[_0x9964('0x30')][_0x9964('0x49')]({'where':{'id':_0x426823[_0x9964('0x46')]['id']}})[_0x9964('0x28')](handleEntityNotFound(_0x15284a,null))[_0x9964('0x28')](function(_0x933422){if(_0x933422){return _0x933422[_0x9964('0x70')](_0x426823[_0x9964('0x4e')][_0x9964('0x71')],_[_0x9964('0x72')](_0x426823['body'],[_0x9964('0x71'),'id'])||{})[_0x9964('0x73')](function(_0x4a43b6){for(var _0x1f787e=0x0;_0x1f787e<_0x426823[_0x9964('0x4e')][_0x9964('0x71')][_0x9964('0x3b')];_0x1f787e+=0x1){socket[_0x9964('0x74')](_0x9964('0x75'),{'UserId':Number(_0x426823[_0x9964('0x4e')][_0x9964('0x71')][_0x1f787e]),'VoicePrefixId':Number(_0x426823[_0x9964('0x46')]['id'])});}return _0x4a43b6;});}})['then'](respondWithResult(_0x15284a,null))['catch'](handleError(_0x15284a,null));};exports[_0x9964('0x76')]=function(_0xd5741e,_0x222f0f,_0x1446c5){return db['VoicePrefix']['find']({'where':{'id':_0xd5741e[_0x9964('0x46')]['id']}})[_0x9964('0x28')](handleEntityNotFound(_0x222f0f,null))[_0x9964('0x28')](function(_0x1d1e29){if(_0x1d1e29){return _0x1d1e29[_0x9964('0x76')](_0xd5741e['query'][_0x9964('0x71')])[_0x9964('0x28')](function(){if(_[_0x9964('0x77')](_0xd5741e[_0x9964('0x36')][_0x9964('0x71')])){for(var _0xaed0c4=0x0;_0xaed0c4<_0xd5741e[_0x9964('0x36')][_0x9964('0x71')][_0x9964('0x3b')];_0xaed0c4+=0x1){socket['emit'](_0x9964('0x78'),{'UserId':Number(_0xd5741e[_0x9964('0x36')]['ids'][_0xaed0c4]),'VoicePrefixId':Number(_0xd5741e[_0x9964('0x46')]['id'])});}}else{socket[_0x9964('0x74')](_0x9964('0x78'),{'UserId':Number(_0xd5741e['query'][_0x9964('0x71')]),'VoicePrefixId':Number(_0xd5741e[_0x9964('0x46')]['id'])});}});}})[_0x9964('0x28')](respondWithStatusCode(_0x222f0f,null))[_0x9964('0x4a')](handleError(_0x222f0f,null));};exports[_0x9964('0x79')]=function(_0x35a7b9,_0x57e3fb,_0x3f2828){var _0x459ebb={};var _0x11f2d1={};var _0x3dbc6a;var _0x1989c8;return db[_0x9964('0x30')]['findOne']({'where':{'id':_0x35a7b9[_0x9964('0x46')]['id']}})[_0x9964('0x28')](handleEntityNotFound(_0x57e3fb,null))[_0x9964('0x28')](function(_0x3f88cb){if(_0x3f88cb){_0x3dbc6a=_0x3f88cb;_0x11f2d1[_0x9964('0x33')]=_[_0x9964('0x35')](db[_0x9964('0x7a')][_0x9964('0x47')]);_0x11f2d1[_0x9964('0x36')]=_['keys'](_0x35a7b9['query']);_0x11f2d1['filters']=_[_0x9964('0x38')](_0x11f2d1[_0x9964('0x33')],_0x11f2d1[_0x9964('0x36')]);_0x459ebb['attributes']=_[_0x9964('0x38')](_0x11f2d1['model'],qs[_0x9964('0x3a')](_0x35a7b9[_0x9964('0x36')]['fields']));_0x459ebb[_0x9964('0x39')]=_0x459ebb[_0x9964('0x39')]['length']?_0x459ebb['attributes']:_0x11f2d1[_0x9964('0x33')];_0x459ebb[_0x9964('0x3d')]=qs['sort'](_0x35a7b9['query'][_0x9964('0x3e')]);_0x459ebb['where']=qs[_0x9964('0x37')](_[_0x9964('0x3f')](_0x35a7b9[_0x9964('0x36')],_0x11f2d1[_0x9964('0x37')]));if(_0x35a7b9[_0x9964('0x36')][_0x9964('0x40')]){_0x459ebb[_0x9964('0x42')]=_[_0x9964('0x41')](_0x459ebb[_0x9964('0x42')],{'$or':_[_0x9964('0x2f')](_0x459ebb[_0x9964('0x39')],function(_0x1f0162){var _0x439a5a={};_0x439a5a[_0x1f0162]={'$like':'%'+_0x35a7b9['query']['filter']+'%'};return _0x439a5a;})});}_0x459ebb=_['merge']({},_0x459ebb,_0x35a7b9['options']);return _0x3dbc6a['getAgents'](_0x459ebb);}})['then'](function(_0x2c2d23){if(_0x2c2d23){_0x1989c8=_0x2c2d23[_0x9964('0x3b')];if(!_0x35a7b9['query']['hasOwnProperty'](_0x9964('0x3c'))){_0x459ebb['limit']=qs['limit'](_0x35a7b9[_0x9964('0x36')][_0x9964('0x21')]);_0x459ebb[_0x9964('0x20')]=qs[_0x9964('0x20')](_0x35a7b9[_0x9964('0x36')][_0x9964('0x20')]);}return _0x3dbc6a[_0x9964('0x79')](_0x459ebb);}})[_0x9964('0x28')](function(_0x476b54){if(_0x476b54){return _0x476b54?{'count':_0x1989c8,'rows':_0x476b54}:null;}})['then'](respondWithResult(_0x57e3fb,null))[_0x9964('0x4a')](handleError(_0x57e3fb,null));}; \ No newline at end of file +var _0x29b1=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','error','stack','name','send','index','map','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','VoicePrefix','findAll','rows','rawAttributes','include','find','catch','create','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','prefix','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','params','userVoicePrefix:remove','getAgents','findOne','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x29b1,0x16d));var _0x129b=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x29b1[_0x4b7b62];return _0x2280df;};'use strict';var emlformat=require(_0x129b('0x0'));var rimraf=require(_0x129b('0x1'));var zipdir=require(_0x129b('0x2'));var jsonpatch=require(_0x129b('0x3'));var rp=require(_0x129b('0x4'));var moment=require('moment');var BPromise=require(_0x129b('0x5'));var Mustache=require(_0x129b('0x6'));var util=require(_0x129b('0x7'));var path=require(_0x129b('0x8'));var sox=require(_0x129b('0x9'));var csv=require(_0x129b('0xa'));var ejs=require(_0x129b('0xb'));var fs=require('fs');var fs_extra=require(_0x129b('0xc'));var _=require('lodash');var squel=require(_0x129b('0xd'));var crypto=require('crypto');var jsforce=require(_0x129b('0xe'));var deskjs=require(_0x129b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x129b('0x10'));var Papa=require(_0x129b('0x11'));var Redis=require('ioredis');var authService=require(_0x129b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x129b('0x13'));var hardwareService=require(_0x129b('0x14'));var logger=require(_0x129b('0x15'))('api');var utils=require(_0x129b('0x16'));var config=require(_0x129b('0x17'));var licenseUtil=require(_0x129b('0x18'));var db=require(_0x129b('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x129b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x129b('0x1b')]));require(_0x129b('0x1c'))[_0x129b('0x1d')](socket);function respondWithStatusCode(_0x52137c,_0x41b681){_0x41b681=_0x41b681||0xcc;return function(_0x47e53c){if(_0x47e53c){return _0x52137c[_0x129b('0x1e')](_0x41b681);}return _0x52137c[_0x129b('0x1f')](_0x41b681)[_0x129b('0x20')]();};}function respondWithResult(_0x50d62b,_0x46a6a4){_0x46a6a4=_0x46a6a4||0xc8;return function(_0x453ba2){if(_0x453ba2){return _0x50d62b[_0x129b('0x1f')](_0x46a6a4)[_0x129b('0x21')](_0x453ba2);}};}function respondWithFilteredResult(_0x30785a,_0x123acc){return function(_0x135b42){if(_0x135b42){var _0x169d4c=typeof _0x123acc[_0x129b('0x22')]===_0x129b('0x23')&&typeof _0x123acc[_0x129b('0x24')]===_0x129b('0x23');var _0x4ec534=_0x135b42[_0x129b('0x25')];var _0x46bcfa=_0x169d4c?0x0:_0x123acc[_0x129b('0x22')];var _0x338428=_0x169d4c?_0x135b42[_0x129b('0x25')]:_0x123acc[_0x129b('0x22')]+_0x123acc[_0x129b('0x24')];var _0x229473;if(_0x338428>=_0x4ec534){_0x338428=_0x4ec534;_0x229473=0xc8;}else{_0x229473=0xce;}_0x30785a[_0x129b('0x1f')](_0x229473);return _0x30785a[_0x129b('0x26')](_0x129b('0x27'),_0x46bcfa+'-'+_0x338428+'/'+_0x4ec534)[_0x129b('0x21')](_0x135b42);}return null;};}function patchUpdates(_0x491624){return function(_0x29c2e1){try{jsonpatch[_0x129b('0x28')](_0x29c2e1,_0x491624,!![]);}catch(_0x8f270d){return BPromise[_0x129b('0x29')](_0x8f270d);}return _0x29c2e1['save']();};}function saveUpdates(_0x4fedcd,_0x31bccc){return function(_0x5b345e){if(_0x5b345e){return _0x5b345e[_0x129b('0x2a')](_0x4fedcd)[_0x129b('0x2b')](function(_0x4c733d){return _0x4c733d;});}return null;};}function removeEntity(_0x5922fe,_0x38788f){return function(_0x1c6d9f){if(_0x1c6d9f){return _0x1c6d9f[_0x129b('0x2c')]()[_0x129b('0x2b')](function(){var _0x45e6be=_0x1c6d9f[_0x129b('0x2d')]({'plain':!![]});var _0x42d623=_0x129b('0x2e');return db['UserProfileResource'][_0x129b('0x2c')]({'where':{'type':_0x42d623,'resourceId':_0x45e6be['id']}})[_0x129b('0x2b')](function(){return _0x1c6d9f;});})['then'](function(){_0x5922fe[_0x129b('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4179e1,_0x4d1017){return function(_0x204e67){if(!_0x204e67){_0x4179e1[_0x129b('0x1e')](0x194);}return _0x204e67;};}function handleError(_0x24eb29,_0x2dcd11){_0x2dcd11=_0x2dcd11||0x1f4;return function(_0x917382){logger[_0x129b('0x2f')](_0x917382[_0x129b('0x30')]);if(_0x917382[_0x129b('0x31')]){delete _0x917382[_0x129b('0x31')];}_0x24eb29['status'](_0x2dcd11)[_0x129b('0x32')](_0x917382);};}exports[_0x129b('0x33')]=function(_0x480338,_0x1bf137){var _0x1b0ab7={},_0x1f5677={},_0x50835a={'count':0x0,'rows':[]};var _0x17e5ed=_[_0x129b('0x34')](db['VoicePrefix']['rawAttributes'],function(_0x2e3b88){return{'name':_0x2e3b88['fieldName'],'type':_0x2e3b88[_0x129b('0x35')]['key']};});_0x1f5677[_0x129b('0x36')]=_[_0x129b('0x34')](_0x17e5ed,'name');_0x1f5677[_0x129b('0x37')]=_[_0x129b('0x38')](_0x480338[_0x129b('0x37')]);_0x1f5677['filters']=_[_0x129b('0x39')](_0x1f5677[_0x129b('0x36')],_0x1f5677[_0x129b('0x37')]);_0x1b0ab7[_0x129b('0x3a')]=_['intersection'](_0x1f5677['model'],qs[_0x129b('0x3b')](_0x480338[_0x129b('0x37')]['fields']));_0x1b0ab7[_0x129b('0x3a')]=_0x1b0ab7[_0x129b('0x3a')][_0x129b('0x3c')]?_0x1b0ab7['attributes']:_0x1f5677['model'];if(!_0x480338[_0x129b('0x37')][_0x129b('0x3d')](_0x129b('0x3e'))){_0x1b0ab7['limit']=qs[_0x129b('0x24')](_0x480338[_0x129b('0x37')]['limit']);_0x1b0ab7[_0x129b('0x22')]=qs[_0x129b('0x22')](_0x480338['query']['offset']);}_0x1b0ab7[_0x129b('0x3f')]=qs[_0x129b('0x40')](_0x480338[_0x129b('0x37')][_0x129b('0x40')]);_0x1b0ab7[_0x129b('0x41')]=qs[_0x129b('0x42')](_[_0x129b('0x43')](_0x480338['query'],_0x1f5677['filters']),_0x17e5ed);if(_0x480338[_0x129b('0x37')]['filter']){_0x1b0ab7[_0x129b('0x41')]=_[_0x129b('0x44')](_0x1b0ab7[_0x129b('0x41')],{'$or':_[_0x129b('0x34')](_0x17e5ed,function(_0x4171cb){if(_0x4171cb[_0x129b('0x35')]!=='VIRTUAL'){var _0x501f58={};_0x501f58[_0x4171cb[_0x129b('0x31')]]={'$like':'%'+_0x480338['query'][_0x129b('0x45')]+'%'};return _0x501f58;}})});}_0x1b0ab7=_[_0x129b('0x44')]({},_0x1b0ab7,_0x480338[_0x129b('0x46')]);var _0x3f0432={'where':_0x1b0ab7['where']};return db['VoicePrefix']['count'](_0x3f0432)[_0x129b('0x2b')](function(_0x4bbd59){_0x50835a[_0x129b('0x25')]=_0x4bbd59;if(_0x480338['query'][_0x129b('0x47')]){_0x1b0ab7['include']=[{'all':!![]}];}return db[_0x129b('0x48')][_0x129b('0x49')](_0x1b0ab7);})[_0x129b('0x2b')](function(_0x3e24b3){_0x50835a[_0x129b('0x4a')]=_0x3e24b3;return _0x50835a;})[_0x129b('0x2b')](respondWithFilteredResult(_0x1bf137,_0x1b0ab7))['catch'](handleError(_0x1bf137,null));};exports['show']=function(_0x51a79a,_0x277396){var _0x115918={'raw':![],'where':{'id':_0x51a79a['params']['id']}},_0x148cae={};_0x148cae['model']=_[_0x129b('0x38')](db[_0x129b('0x48')][_0x129b('0x4b')]);_0x148cae[_0x129b('0x37')]=_[_0x129b('0x38')](_0x51a79a[_0x129b('0x37')]);_0x148cae['filters']=_[_0x129b('0x39')](_0x148cae[_0x129b('0x36')],_0x148cae['query']);_0x115918[_0x129b('0x3a')]=_[_0x129b('0x39')](_0x148cae[_0x129b('0x36')],qs[_0x129b('0x3b')](_0x51a79a[_0x129b('0x37')][_0x129b('0x3b')]));_0x115918[_0x129b('0x3a')]=_0x115918[_0x129b('0x3a')][_0x129b('0x3c')]?_0x115918[_0x129b('0x3a')]:_0x148cae[_0x129b('0x36')];if(_0x51a79a[_0x129b('0x37')][_0x129b('0x47')]){_0x115918[_0x129b('0x4c')]=[{'all':!![]}];}_0x115918=_[_0x129b('0x44')]({},_0x115918,_0x51a79a[_0x129b('0x46')]);return db[_0x129b('0x48')][_0x129b('0x4d')](_0x115918)[_0x129b('0x2b')](handleEntityNotFound(_0x277396,null))[_0x129b('0x2b')](respondWithResult(_0x277396,null))['catch'](handleError(_0x277396,null));};exports[_0x129b('0x2c')]=function(_0x128d59,_0x37dcfd){return db[_0x129b('0x48')]['find']({'where':{'id':_0x128d59['params']['id']}})[_0x129b('0x2b')](handleEntityNotFound(_0x37dcfd,null))[_0x129b('0x2b')](removeEntity(_0x37dcfd,null))[_0x129b('0x4e')](handleError(_0x37dcfd,null));};exports['describe']=function(_0x484c50,_0x1426f9){return db[_0x129b('0x48')]['describe']()[_0x129b('0x2b')](respondWithResult(_0x1426f9,null))[_0x129b('0x4e')](handleError(_0x1426f9,null));};exports[_0x129b('0x4f')]=function(_0x527cb5,_0x2ef589){var _0x4590a9;return db[_0x129b('0x50')][_0x129b('0x51')](function(_0x49bda0){return db['VoicePrefix'][_0x129b('0x4f')](_0x527cb5[_0x129b('0x52')],{'transaction':_0x49bda0})[_0x129b('0x2b')](function(_0x1d37a8){_0x4590a9=_0x1d37a8[_0x129b('0x2d')]({'plain':!![]});return db['VoiceExtension'][_0x129b('0x4d')]({'where':{'id':_0x4590a9[_0x129b('0x53')]},'raw':!![]})[_0x129b('0x2b')](function(_0x21e5fe){return createVoicePrefixExtensions(_0x4590a9,_0x21e5fe,_0x49bda0);});});})[_0x129b('0x2b')](function(){var _0x1fb041=_0x527cb5[_0x129b('0x54')][_0x129b('0x2d')]({'plain':!![]});if(!_0x1fb041)throw new Error(_0x129b('0x55'));if(_0x1fb041[_0x129b('0x56')]===_0x129b('0x54')){var _0x15152d=_0x4590a9;return db[_0x129b('0x57')][_0x129b('0x4d')]({'where':{'name':_0x129b('0x2e'),'userProfileId':_0x1fb041[_0x129b('0x58')]},'raw':!![]})[_0x129b('0x2b')](function(_0x59f400){if(_0x59f400&&_0x59f400[_0x129b('0x59')]===0x0){return db[_0x129b('0x5a')][_0x129b('0x4f')]({'name':_0x15152d[_0x129b('0x31')],'resourceId':_0x15152d['id'],'type':_0x59f400[_0x129b('0x31')],'sectionId':_0x59f400['id']},{})[_0x129b('0x2b')](function(){return _0x4590a9;});}else{return _0x4590a9;}})[_0x129b('0x4e')](function(_0x10f4a5){logger['error'](_0x129b('0x5b'),_0x10f4a5);throw _0x10f4a5;});}return _0x4590a9;})['then'](respondWithResult(_0x2ef589,null))[_0x129b('0x4e')](handleError(_0x2ef589,null));};function Extension(_0x56fa31,_0x484442,_0x4a76cf,_0x2d3260){this['context']=_0x129b('0x5c');this[_0x129b('0x5d')]=_0x56fa31;this[_0x129b('0x5e')]=_0x4a76cf;this[_0x129b('0x35')]=_0x129b('0x5f');this[_0x129b('0x60')]=_0x129b('0x61');this[_0x129b('0x62')]=_0x484442;this[_0x129b('0x63')]=_0x2d3260;}function createVoicePrefixExtensions(_0x1f6fab,_0x4809ec,_0x2fc87e){return new BPromise(function(_0x126810,_0x4638be){var _0x508745=new Extension(formatPrefixName(_0x1f6fab['prefix']),0x1,_0x129b('0x64'),_0x129b('0x65'));_0x508745[_0x129b('0x66')]=_0x1f6fab['id'];return db[_0x129b('0x67')][_0x129b('0x4f')](_0x508745,{'transaction':_0x2fc87e})[_0x129b('0x2b')](function(_0x57304d){var _0x290b5d=_0x57304d[_0x129b('0x2d')]({'plain':!![]});var _0x36ed65=_[_0x129b('0x34')](addVoicePrefixExtensions(_0x1f6fab,_0x4809ec),function(_0x58f7b3){_0x58f7b3[_0x129b('0x53')]=_0x290b5d['id'];_0x58f7b3[_0x129b('0x66')]=_0x1f6fab['id'];return _0x58f7b3;});return db[_0x129b('0x67')][_0x129b('0x68')](_0x36ed65,{'transaction':_0x2fc87e})[_0x129b('0x2b')](function(_0x20545d){if(!_0x20545d){return _0x4638be('Extensions\x20creation\x20failed');}else{return _0x126810(_0x20545d);}})[_0x129b('0x4e')](function(_0x58288a){return _0x4638be(_0x58288a);});});;});};function addVoicePrefixExtensions(_0x9a966b,_0x579722){var _0x10f7f1=[];var _0x37a6eb=formatPrefixName(_0x9a966b[_0x129b('0x69')]);_0x10f7f1['push'](new Extension(_0x37a6eb,0x2,_0x129b('0x6a'),_0x129b('0x6b')+_0x9a966b[_0x129b('0x31')]));if(_0x9a966b['callerIdAll']){_0x10f7f1['push'](new Extension(_0x37a6eb,0x3,_0x129b('0x6a'),_0x129b('0x6c')+_0x9a966b['callerIdAll']));}else{_0x10f7f1[_0x129b('0x6d')](new Extension(_0x37a6eb,0x3,_0x129b('0x64'),_0x129b('0x6e')));}_0x10f7f1['push'](new Extension(_0x37a6eb,0x4,_0x129b('0x6f'),_0x579722[_0x129b('0x70')]+','+_0x129b('0x71')+(0x8+_0x9a966b['name'][_0x129b('0x3c')])+'}'+','+0x1));return _0x10f7f1;}function formatPrefixName(_0x316874){var _0x42ab53='_';for(var _0xbc6310=0x0;_0xbc6310<_0x316874[_0x129b('0x3c')];_0xbc6310++){if(_0x316874['charAt'](_0xbc6310)=='-'){_0x42ab53+=_0x316874[_0x129b('0x72')](_0xbc6310);}else{_0x42ab53+='['+_0x316874['charAt'](_0xbc6310)+']';}}_0x42ab53+='.';return _0x42ab53;}exports[_0x129b('0x2a')]=function(_0x5a34a6,_0x29198a,_0x37517b){var _0x1ab712=_0x5a34a6[_0x129b('0x52')];_0x1ab712['prefix']='system-'+_0x1ab712['name']+'-';return db[_0x129b('0x50')][_0x129b('0x51')](function(_0x2539ff){return db['VoicePrefix'][_0x129b('0x2a')](_0x1ab712,{'where':{'id':_0x1ab712['id']},'transaction':_0x2539ff})[_0x129b('0x2b')](function(){return db[_0x129b('0x67')][_0x129b('0x2c')]({'where':{'VoicePrefixId':_0x1ab712['id']},'transaction':_0x2539ff})[_0x129b('0x2b')](function(){return db[_0x129b('0x67')][_0x129b('0x4d')]({'where':{'id':_0x1ab712['VoiceExtensionId']},'raw':!![]})['then'](function(_0x7d58f3){return createVoicePrefixExtensions(_0x1ab712,_0x7d58f3,_0x2539ff);});});});})[_0x129b('0x2b')](function(){return db['VoicePrefix'][_0x129b('0x73')](_0x1ab712['id']);})[_0x129b('0x2b')](respondWithResult(_0x29198a,null))[_0x129b('0x4e')](handleError(_0x29198a,null));};exports[_0x129b('0x74')]=function(_0x2c6692,_0x39af9f,_0x18ffe1){return db[_0x129b('0x48')]['find']({'where':{'id':_0x2c6692['params']['id']}})[_0x129b('0x2b')](handleEntityNotFound(_0x39af9f,null))['then'](function(_0x36379c){if(_0x36379c){return _0x36379c['addAgents'](_0x2c6692[_0x129b('0x52')][_0x129b('0x75')],_[_0x129b('0x76')](_0x2c6692[_0x129b('0x52')],[_0x129b('0x75'),'id'])||{})[_0x129b('0x77')](function(_0x3cf6a5){for(var _0x442787=0x0;_0x442787<_0x2c6692['body'][_0x129b('0x75')][_0x129b('0x3c')];_0x442787+=0x1){socket[_0x129b('0x78')](_0x129b('0x79'),{'UserId':Number(_0x2c6692[_0x129b('0x52')]['ids'][_0x442787]),'VoicePrefixId':Number(_0x2c6692['params']['id'])});}return _0x3cf6a5;});}})['then'](respondWithResult(_0x39af9f,null))[_0x129b('0x4e')](handleError(_0x39af9f,null));};exports[_0x129b('0x7a')]=function(_0x1e753d,_0x2bdcf3,_0x2cc35a){return db[_0x129b('0x48')][_0x129b('0x4d')]({'where':{'id':_0x1e753d[_0x129b('0x7b')]['id']}})[_0x129b('0x2b')](handleEntityNotFound(_0x2bdcf3,null))[_0x129b('0x2b')](function(_0x3282f8){if(_0x3282f8){return _0x3282f8[_0x129b('0x7a')](_0x1e753d['query']['ids'])[_0x129b('0x2b')](function(){if(_['isArray'](_0x1e753d['query']['ids'])){for(var _0x306947=0x0;_0x306947<_0x1e753d[_0x129b('0x37')]['ids'][_0x129b('0x3c')];_0x306947+=0x1){socket[_0x129b('0x78')](_0x129b('0x7c'),{'UserId':Number(_0x1e753d[_0x129b('0x37')][_0x129b('0x75')][_0x306947]),'VoicePrefixId':Number(_0x1e753d[_0x129b('0x7b')]['id'])});}}else{socket[_0x129b('0x78')](_0x129b('0x7c'),{'UserId':Number(_0x1e753d[_0x129b('0x37')]['ids']),'VoicePrefixId':Number(_0x1e753d[_0x129b('0x7b')]['id'])});}});}})[_0x129b('0x2b')](respondWithStatusCode(_0x2bdcf3,null))['catch'](handleError(_0x2bdcf3,null));};exports[_0x129b('0x7d')]=function(_0x43f508,_0x21558b,_0x1cb559){var _0x2de89f={};var _0x412f7d={};var _0x47a1ed;var _0x2c2908;return db[_0x129b('0x48')][_0x129b('0x7e')]({'where':{'id':_0x43f508['params']['id']}})[_0x129b('0x2b')](handleEntityNotFound(_0x21558b,null))['then'](function(_0x261acd){if(_0x261acd){_0x47a1ed=_0x261acd;_0x412f7d[_0x129b('0x36')]=_[_0x129b('0x38')](db[_0x129b('0x7f')]['rawAttributes']);_0x412f7d[_0x129b('0x37')]=_[_0x129b('0x38')](_0x43f508[_0x129b('0x37')]);_0x412f7d[_0x129b('0x42')]=_[_0x129b('0x39')](_0x412f7d[_0x129b('0x36')],_0x412f7d[_0x129b('0x37')]);_0x2de89f[_0x129b('0x3a')]=_['intersection'](_0x412f7d[_0x129b('0x36')],qs['fields'](_0x43f508[_0x129b('0x37')][_0x129b('0x3b')]));_0x2de89f['attributes']=_0x2de89f[_0x129b('0x3a')][_0x129b('0x3c')]?_0x2de89f[_0x129b('0x3a')]:_0x412f7d[_0x129b('0x36')];_0x2de89f[_0x129b('0x3f')]=qs[_0x129b('0x40')](_0x43f508[_0x129b('0x37')][_0x129b('0x40')]);_0x2de89f[_0x129b('0x41')]=qs[_0x129b('0x42')](_[_0x129b('0x43')](_0x43f508[_0x129b('0x37')],_0x412f7d[_0x129b('0x42')]));if(_0x43f508[_0x129b('0x37')][_0x129b('0x45')]){_0x2de89f[_0x129b('0x41')]=_[_0x129b('0x44')](_0x2de89f[_0x129b('0x41')],{'$or':_['map'](_0x2de89f[_0x129b('0x3a')],function(_0x479fda){var _0x49c53c={};_0x49c53c[_0x479fda]={'$like':'%'+_0x43f508[_0x129b('0x37')][_0x129b('0x45')]+'%'};return _0x49c53c;})});}_0x2de89f=_[_0x129b('0x44')]({},_0x2de89f,_0x43f508[_0x129b('0x46')]);return _0x47a1ed[_0x129b('0x7d')](_0x2de89f);}})[_0x129b('0x2b')](function(_0x103244){if(_0x103244){_0x2c2908=_0x103244[_0x129b('0x3c')];if(!_0x43f508[_0x129b('0x37')]['hasOwnProperty'](_0x129b('0x3e'))){_0x2de89f[_0x129b('0x24')]=qs['limit'](_0x43f508[_0x129b('0x37')][_0x129b('0x24')]);_0x2de89f[_0x129b('0x22')]=qs[_0x129b('0x22')](_0x43f508[_0x129b('0x37')][_0x129b('0x22')]);}return _0x47a1ed['getAgents'](_0x2de89f);}})['then'](function(_0x31fdc1){if(_0x31fdc1){return _0x31fdc1?{'count':_0x2c2908,'rows':_0x31fdc1}:null;}})[_0x129b('0x2b')](respondWithResult(_0x21558b,null))[_0x129b('0x4e')](handleError(_0x21558b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index d5365cd..15fae3c 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 _0xd75f=['events','../../mysqldb','VoicePrefix','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x35d1f9,_0xee484c){var _0x2d7877=function(_0x52117d){while(--_0x52117d){_0x35d1f9['push'](_0x35d1f9['shift']());}};_0x2d7877(++_0xee484c);}(_0xd75f,0x82));var _0xfd75=function(_0x32a7e8,_0x16dfe6){_0x32a7e8=_0x32a7e8-0x0;var _0x5dc3b1=_0xd75f[_0x32a7e8];return _0x5dc3b1;};'use strict';var EventEmitter=require(_0xfd75('0x0'));var VoicePrefix=require(_0xfd75('0x1'))['db'][_0xfd75('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd75('0x3'),'afterUpdate':_0xfd75('0x4'),'afterDestroy':_0xfd75('0x5')};function emitEvent(_0xa8746c){return function(_0x58d45f,_0x321d95,_0x42f1cc){VoicePrefixEvents[_0xfd75('0x6')](_0xa8746c+':'+_0x58d45f['id'],_0x58d45f);VoicePrefixEvents[_0xfd75('0x6')](_0xa8746c,_0x58d45f);_0x42f1cc(null);};}for(var e in events){if(events[_0xfd75('0x7')](e)){var event=events[e];VoicePrefix[_0xfd75('0x8')](e,emitEvent(event));}}module[_0xfd75('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x0506=['exports','events','../../mysqldb','VoicePrefix','update','emit','hasOwnProperty','hook'];(function(_0x14a913,_0x1329b5){var _0x4ce6e9=function(_0x10d39f){while(--_0x10d39f){_0x14a913['push'](_0x14a913['shift']());}};_0x4ce6e9(++_0x1329b5);}(_0x0506,0x89));var _0x6050=function(_0x28496c,_0x4049ce){_0x28496c=_0x28496c-0x0;var _0x1d3d40=_0x0506[_0x28496c];return _0x1d3d40;};'use strict';var EventEmitter=require(_0x6050('0x0'));var VoicePrefix=require(_0x6050('0x1'))['db'][_0x6050('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6050('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d9cac){return function(_0x568ca5,_0x520946,_0x589ef9){VoicePrefixEvents[_0x6050('0x4')](_0x2d9cac+':'+_0x568ca5['id'],_0x568ca5);VoicePrefixEvents[_0x6050('0x4')](_0x2d9cac,_0x568ca5);_0x589ef9(null);};}for(var e in events){if(events[_0x6050('0x5')](e)){var event=events[e];VoicePrefix[_0x6050('0x6')](e,emitEvent(event));}}module[_0x6050('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 81253f7..e7abf4a 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 _0x5b9c=['define','VoicePrefix','voice_prefixes','lodash','../../config/logger','moment','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x27acbf,_0xe7afec){var _0xf93fc8=function(_0x1a91f7){while(--_0x1a91f7){_0x27acbf['push'](_0x27acbf['shift']());}};_0xf93fc8(++_0xe7afec);}(_0x5b9c,0x13e));var _0xc5b9=function(_0x5c3f58,_0x4a9645){_0x5c3f58=_0x5c3f58-0x0;var _0x4c4900=_0x5b9c[_0x5c3f58];return _0x4c4900;};'use strict';var _=require(_0xc5b9('0x0'));var util=require('util');var logger=require(_0xc5b9('0x1'))('api');var moment=require(_0xc5b9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc5b9('0x3'));var attributes=require(_0xc5b9('0x4'));module[_0xc5b9('0x5')]=function(_0x1086ca,_0x336a47){return _0x1086ca[_0xc5b9('0x6')](_0xc5b9('0x7'),attributes,{'tableName':_0xc5b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x857d=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util'];(function(_0x549cbe,_0x207b54){var _0x1e3dc7=function(_0x3ef7cd){while(--_0x3ef7cd){_0x549cbe['push'](_0x549cbe['shift']());}};_0x1e3dc7(++_0x207b54);}(_0x857d,0xb4));var _0xd857=function(_0x1df9cf,_0x224ea0){_0x1df9cf=_0x1df9cf-0x0;var _0x1d9cba=_0x857d[_0x1df9cf];return _0x1d9cba;};'use strict';var _=require(_0xd857('0x0'));var util=require(_0xd857('0x1'));var logger=require(_0xd857('0x2'))(_0xd857('0x3'));var moment=require(_0xd857('0x4'));var BPromise=require(_0xd857('0x5'));var rp=require(_0xd857('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd857('0x7'));var config=require(_0xd857('0x8'));var attributes=require(_0xd857('0x9'));module[_0xd857('0xa')]=function(_0x4e4a8b,_0x58c515){return _0x4e4a8b[_0xd857('0xb')](_0xd857('0xc'),attributes,{'tableName':_0xd857('0xd'),'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 87945ae..9921d82 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 _0xe714=['./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x27bca8,_0x191f63){var _0x370163=function(_0x1329f8){while(--_0x1329f8){_0x27bca8['push'](_0x27bca8['shift']());}};_0x370163(++_0x191f63);}(_0xe714,0xe2));var _0x4e71=function(_0x36b72a,_0x2f2d10){_0x36b72a=_0x36b72a-0x0;var _0x9955ba=_0xe714[_0x36b72a];return _0x9955ba;};'use strict';var _=require(_0x4e71('0x0'));var util=require('util');var moment=require(_0x4e71('0x1'));var BPromise=require(_0x4e71('0x2'));var rs=require(_0x4e71('0x3'));var fs=require('fs');var Redis=require(_0x4e71('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e71('0x5'));var logger=require('../../config/logger')(_0x4e71('0x6'));var config=require(_0x4e71('0x7'));var jayson=require(_0x4e71('0x8'));var client=jayson[_0x4e71('0x9')][_0x4e71('0xa')]({'port':0x232a});config[_0x4e71('0xb')]=_['defaults'](config[_0x4e71('0xb')],{'host':_0x4e71('0xc'),'port':0x18eb});var socket=require(_0x4e71('0xd'))(new Redis(config['redis']));require(_0x4e71('0xe'))['register'](socket);function respondWithRpcPromise(_0x300ff6,_0x372059,_0x73a271){return new BPromise(function(_0x15fe57,_0x3bff86){return client[_0x4e71('0xf')](_0x300ff6,_0x73a271)[_0x4e71('0x10')](function(_0x3c7a9b){logger['info'](_0x4e71('0x11'),_0x372059,_0x4e71('0x12'));logger['debug'](_0x4e71('0x13'),_0x372059,_0x4e71('0x12'),JSON['stringify'](_0x3c7a9b));if(_0x3c7a9b[_0x4e71('0x14')]){if(_0x3c7a9b[_0x4e71('0x14')]['code']===0x1f4){logger['error'](_0x4e71('0x11'),_0x372059,_0x3c7a9b['error']['message']);return _0x3bff86(_0x3c7a9b['error'][_0x4e71('0x15')]);}logger[_0x4e71('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x372059,_0x3c7a9b['error'][_0x4e71('0x15')]);return _0x15fe57(_0x3c7a9b[_0x4e71('0x14')][_0x4e71('0x15')]);}else{logger[_0x4e71('0x16')](_0x4e71('0x11'),_0x372059,_0x4e71('0x12'));_0x15fe57(_0x3c7a9b['result'][_0x4e71('0x15')]);}})[_0x4e71('0x17')](function(_0x51d6da){logger[_0x4e71('0x14')](_0x4e71('0x11'),_0x372059,_0x51d6da);_0x3bff86(_0x51d6da);});});} \ No newline at end of file +var _0xb511=['rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1d156c,_0x3ec309){var _0x4b96a4=function(_0x1d58d5){while(--_0x1d58d5){_0x1d156c['push'](_0x1d156c['shift']());}};_0x4b96a4(++_0x3ec309);}(_0xb511,0x165));var _0x1b51=function(_0x4a03dd,_0x23d065){_0x4a03dd=_0x4a03dd-0x0;var _0x25b7b6=_0xb511[_0x4a03dd];return _0x25b7b6;};'use strict';var _=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var moment=require(_0x1b51('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b51('0x3'));var fs=require('fs');var Redis=require(_0x1b51('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b51('0x5'));var logger=require(_0x1b51('0x6'))(_0x1b51('0x7'));var config=require('../../config/environment');var jayson=require(_0x1b51('0x8'));var client=jayson[_0x1b51('0x9')]['http']({'port':0x232a});config[_0x1b51('0xa')]=_[_0x1b51('0xb')](config['redis'],{'host':_0x1b51('0xc'),'port':0x18eb});var socket=require(_0x1b51('0xd'))(new Redis(config[_0x1b51('0xa')]));require(_0x1b51('0xe'))[_0x1b51('0xf')](socket);function respondWithRpcPromise(_0x388fa7,_0x16a25b,_0x220ca2){return new BPromise(function(_0x4d01be,_0x337839){return client[_0x1b51('0x10')](_0x388fa7,_0x220ca2)[_0x1b51('0x11')](function(_0x3cc22d){logger[_0x1b51('0x12')](_0x1b51('0x13'),_0x16a25b,'request\x20sent');logger[_0x1b51('0x14')](_0x1b51('0x15'),_0x16a25b,_0x1b51('0x16'),JSON[_0x1b51('0x17')](_0x3cc22d));if(_0x3cc22d[_0x1b51('0x18')]){if(_0x3cc22d[_0x1b51('0x18')][_0x1b51('0x19')]===0x1f4){logger['error'](_0x1b51('0x13'),_0x16a25b,_0x3cc22d['error']['message']);return _0x337839(_0x3cc22d[_0x1b51('0x18')][_0x1b51('0x1a')]);}logger['error'](_0x1b51('0x13'),_0x16a25b,_0x3cc22d[_0x1b51('0x18')][_0x1b51('0x1a')]);return _0x4d01be(_0x3cc22d['error'][_0x1b51('0x1a')]);}else{logger[_0x1b51('0x12')](_0x1b51('0x13'),_0x16a25b,_0x1b51('0x16'));_0x4d01be(_0x3cc22d['result'][_0x1b51('0x1a')]);}})[_0x1b51('0x1b')](function(_0x153c33){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x16a25b,_0x153c33);_0x337839(_0x153c33);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 074f586..8fde682 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 _0x3f59=['./voicePrefix.events','save','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x2bb8ac,_0x498459){var _0x2d3e5e=function(_0x16eb6b){while(--_0x16eb6b){_0x2bb8ac['push'](_0x2bb8ac['shift']());}};_0x2d3e5e(++_0x498459);}(_0x3f59,0x1b0));var _0x93f5=function(_0x422452,_0x29b8f7){_0x422452=_0x422452-0x0;var _0x29fe0e=_0x3f59[_0x422452];return _0x29fe0e;};'use strict';var VoicePrefixEvents=require(_0x93f5('0x0'));var events=[_0x93f5('0x1'),'remove',_0x93f5('0x2')];function createListener(_0x3d04a8,_0x17f9c2){return function(_0xcea971){_0x17f9c2[_0x93f5('0x3')](_0x3d04a8,_0xcea971);};}function removeListener(_0x21ac17,_0x374022){return function(){VoicePrefixEvents[_0x93f5('0x4')](_0x21ac17,_0x374022);};}exports[_0x93f5('0x5')]=function(_0x4dd06b){for(var _0x565ad3=0x0,_0xb86c2d=events[_0x93f5('0x6')];_0x565ad3<_0xb86c2d;_0x565ad3++){var _0x1e7b4d=events[_0x565ad3];var _0x24b75b=createListener(_0x93f5('0x7')+_0x1e7b4d,_0x4dd06b);VoicePrefixEvents['on'](_0x1e7b4d,_0x24b75b);}}; \ No newline at end of file +var _0x85cf=['remove','update','emit','register','length','voicePrefix:','save'];(function(_0x35d3b9,_0x28d658){var _0x9fc7c2=function(_0x43f15d){while(--_0x43f15d){_0x35d3b9['push'](_0x35d3b9['shift']());}};_0x9fc7c2(++_0x28d658);}(_0x85cf,0x76));var _0xf85c=function(_0x4bc7ea,_0x5e3b49){_0x4bc7ea=_0x4bc7ea-0x0;var _0x5a2f25=_0x85cf[_0x4bc7ea];return _0x5a2f25;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xf85c('0x0'),_0xf85c('0x1'),_0xf85c('0x2')];function createListener(_0xc9366f,_0x39bbfd){return function(_0x240fa2){_0x39bbfd[_0xf85c('0x3')](_0xc9366f,_0x240fa2);};}function removeListener(_0x156922,_0x495110){return function(){VoicePrefixEvents['removeListener'](_0x156922,_0x495110);};}exports[_0xf85c('0x4')]=function(_0x3a5a32){for(var _0x51ac85=0x0,_0x386a60=events[_0xf85c('0x5')];_0x51ac85<_0x386a60;_0x51ac85++){var _0xe1be83=events[_0x51ac85];var _0x1bebcf=createListener(_0xf85c('0x6')+_0xe1be83,_0x3a5a32);VoicePrefixEvents['on'](_0xe1be83,_0x1bebcf);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index c554821..c58296d 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 _0xda2e=['/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','/:id/users','addAgents','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeBlackLists','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','getAgents','/:id/members','/:id/lists'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0xda2e,0x102));var _0xeda2=function(_0x49ee70,_0x115b1e){_0x49ee70=_0x49ee70-0x0;var _0x3a7254=_0xda2e[_0x49ee70];return _0x3a7254;};'use strict';var multer=require(_0xeda2('0x0'));var util=require('util');var path=require(_0xeda2('0x1'));var timeout=require('connect-timeout');var express=require(_0xeda2('0x2'));var router=express[_0xeda2('0x3')]();var fs_extra=require(_0xeda2('0x4'));var auth=require(_0xeda2('0x5'));var interaction=require(_0xeda2('0x6'));var config=require('../../config/environment');var controller=require(_0xeda2('0x7'));router['get']('/',auth[_0xeda2('0x8')](),controller[_0xeda2('0x9')]);router[_0xeda2('0xa')](_0xeda2('0xb'),auth['isAuthenticated'](),controller[_0xeda2('0xc')]);router[_0xeda2('0xa')](_0xeda2('0xd'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xeda2('0xa')]('/:id/hopper_histories',auth[_0xeda2('0x8')](),controller[_0xeda2('0xe')]);router[_0xeda2('0xa')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xeda2('0xf')]);router['get'](_0xeda2('0x10'),auth[_0xeda2('0x8')](),controller[_0xeda2('0x11')]);router[_0xeda2('0xa')]('/:id/teams',auth[_0xeda2('0x8')](),controller[_0xeda2('0x12')]);router[_0xeda2('0xa')]('/:id/users',auth[_0xeda2('0x8')](),controller[_0xeda2('0x13')]);router[_0xeda2('0xa')](_0xeda2('0x14'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xeda2('0x15'),auth[_0xeda2('0x8')](),controller['getLists']);router[_0xeda2('0xa')](_0xeda2('0x16'),auth[_0xeda2('0x8')](),controller[_0xeda2('0x17')]);router[_0xeda2('0x18')]('/',auth[_0xeda2('0x8')](),controller[_0xeda2('0x19')]);router[_0xeda2('0x18')](_0xeda2('0x1a'),auth[_0xeda2('0x8')](),controller[_0xeda2('0x1b')]);router[_0xeda2('0x18')](_0xeda2('0x1c'),auth[_0xeda2('0x8')](),controller[_0xeda2('0x1d')]);router['post'](_0xeda2('0x1e'),auth[_0xeda2('0x8')](),controller[_0xeda2('0x1f')]);router['post'](_0xeda2('0x15'),auth['isAuthenticated'](),controller['addLists']);router[_0xeda2('0x18')](_0xeda2('0x16'),auth[_0xeda2('0x8')](),controller[_0xeda2('0x20')]);router['put'](_0xeda2('0xb'),auth[_0xeda2('0x8')](),controller[_0xeda2('0x21')]);router[_0xeda2('0x22')](_0xeda2('0xb'),auth[_0xeda2('0x8')](),controller[_0xeda2('0x23')]);router[_0xeda2('0x22')](_0xeda2('0x1c'),auth['isAuthenticated'](),controller[_0xeda2('0x24')]);router[_0xeda2('0x22')]('/:id/users',auth[_0xeda2('0x8')](),controller[_0xeda2('0x25')]);router[_0xeda2('0x22')]('/:id/lists',auth[_0xeda2('0x8')](),controller['removeLists']);router[_0xeda2('0x22')](_0xeda2('0x16'),auth['isAuthenticated'](),controller[_0xeda2('0x26')]);module[_0xeda2('0x27')]=router; \ No newline at end of file +var _0x8d00=['getTeams','/:id/users','/:id/members','getMembers','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addTeams','addAgents','/:id/lists','addLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8d00,0x6d));var _0x08d0=function(_0x34a580,_0x6dffeb){_0x34a580=_0x34a580-0x0;var _0x3e268d=_0x8d00[_0x34a580];return _0x3e268d;};'use strict';var multer=require(_0x08d0('0x0'));var util=require(_0x08d0('0x1'));var path=require('path');var timeout=require(_0x08d0('0x2'));var express=require('express');var router=express[_0x08d0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x08d0('0x4'));var interaction=require(_0x08d0('0x5'));var config=require(_0x08d0('0x6'));var controller=require('./voiceQueue.controller');router['get']('/',auth[_0x08d0('0x7')](),controller[_0x08d0('0x8')]);router[_0x08d0('0x9')](_0x08d0('0xa'),auth[_0x08d0('0x7')](),controller[_0x08d0('0xb')]);router['get'](_0x08d0('0xc'),auth[_0x08d0('0x7')](),controller[_0x08d0('0xd')]);router[_0x08d0('0x9')]('/:id/hopper_histories',auth[_0x08d0('0x7')](),controller[_0x08d0('0xe')]);router['get'](_0x08d0('0xf'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x10')]);router[_0x08d0('0x9')](_0x08d0('0x11'),auth['isAuthenticated'](),controller[_0x08d0('0x12')]);router[_0x08d0('0x9')](_0x08d0('0x13'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x14')]);router[_0x08d0('0x9')](_0x08d0('0x15'),auth[_0x08d0('0x7')](),controller['getAgents']);router[_0x08d0('0x9')](_0x08d0('0x16'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x17')]);router[_0x08d0('0x9')]('/:id/lists',auth[_0x08d0('0x7')](),controller[_0x08d0('0x18')]);router[_0x08d0('0x9')](_0x08d0('0x19'),auth['isAuthenticated'](),controller[_0x08d0('0x1a')]);router['post']('/',auth['isAuthenticated'](),controller[_0x08d0('0x1b')]);router[_0x08d0('0x1c')](_0x08d0('0x1d'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x1e')]);router['post'](_0x08d0('0x13'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x1f')]);router['post'](_0x08d0('0x15'),auth['isAuthenticated'](),controller[_0x08d0('0x20')]);router['post'](_0x08d0('0x21'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x22')]);router[_0x08d0('0x1c')]('/:id/blacklists',auth[_0x08d0('0x7')](),controller['addBlackLists']);router['put'](_0x08d0('0xa'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x23')]);router[_0x08d0('0x24')](_0x08d0('0xa'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x25')]);router[_0x08d0('0x24')](_0x08d0('0x13'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x26')]);router[_0x08d0('0x24')]('/:id/users',auth[_0x08d0('0x7')](),controller[_0x08d0('0x27')]);router[_0x08d0('0x24')](_0x08d0('0x21'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x28')]);router[_0x08d0('0x24')](_0x08d0('0x19'),auth[_0x08d0('0x7')](),controller[_0x08d0('0x29')]);module[_0x08d0('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 918f66d..a000076 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 _0xcddd=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','ringall','setDataValue','type','getDataValue','dialMethod','strategy','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\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)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#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,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0xcddd,0x1a1));var _0xdcdd=function(_0x82c5d9,_0x12b33f){_0x82c5d9=_0x82c5d9-0x0;var _0x5970e1=_0xcddd[_0x82c5d9];return _0x5970e1;};'use strict';var Sequelize=require(_0xdcdd('0x0'));module[_0xdcdd('0x1')]={'name':{'type':Sequelize[_0xdcdd('0x2')],'allowNull':![],'unique':_0xdcdd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x5'),_0xdcdd('0x6')),'allowNull':![],'defaultValue':_0xdcdd('0x5')},'musiconhold':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':_0xdcdd('0x7')},'announce':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xdcdd('0x4')]('rr','ringall',_0xdcdd('0x8'),_0xdcdd('0x9'),'random',_0xdcdd('0xa'),'linear',_0xdcdd('0xb'),_0xdcdd('0xc')),'allowNull':![],'defaultValue':_0xdcdd('0xd'),'set':function(_0x58f6e8){this[_0xdcdd('0xe')]('strategy',_0x58f6e8?_0x58f6e8:_0xdcdd('0xa'));},'get':function(){var _0x429bb5=this['getDataValue'](_0xdcdd('0xf'));var _0x3c711b=this[_0xdcdd('0x10')](_0xdcdd('0x11'));var _0x56c0f5=this['getDataValue'](_0xdcdd('0x12'));if(_0x429bb5===_0xdcdd('0x5')){return _0x56c0f5;}if(_0x3c711b==='booked'&&_0x56c0f5===_0xdcdd('0xa')||_0x3c711b===_0xdcdd('0x13')&&_0x56c0f5===_0xdcdd('0x14')){return _0x56c0f5;}if(_0x3c711b===_0xdcdd('0x15')||_0x3c711b===_0xdcdd('0x16')||_0x3c711b==='power'){return _0x56c0f5;}return null;}},'servicelevel':{'type':Sequelize[_0xdcdd('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xdcdd('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xdcdd('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xdcdd('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xdcdd('0x18'),'no'),'defaultValue':_0xdcdd('0x18')},'autopause':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no',_0xdcdd('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xdcdd('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xdcdd('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xdcdd('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xdcdd('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdcdd('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xdcdd('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xdcdd('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xdcdd('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no',_0xdcdd('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xdcdd('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xdcdd('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xdcdd('0x2')]},'queue_youarenext':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xdcdd('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xdcdd('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xdcdd('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x56d33c){this[_0xdcdd('0xe')](_0xdcdd('0x1b'),_0x56d33c?_0x56d33c['join'](','):[]);},'get':function(){return this['getDataValue'](_0xdcdd('0x1b'))?this[_0xdcdd('0x10')](_0xdcdd('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':_0xdcdd('0x18'),'set':function(_0x33dcc5){this[_0xdcdd('0xe')]('joinempty',_0x33dcc5?_0x33dcc5[_0xdcdd('0x1c')](','):undefined);},'get':function(){return this[_0xdcdd('0x10')]('joinempty')?this[_0xdcdd('0x10')](_0xdcdd('0x1d'))[_0xdcdd('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':'no','set':function(_0x46d650){this[_0xdcdd('0xe')](_0xdcdd('0x1f'),_0x46d650?_0x46d650[_0xdcdd('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xdcdd('0x1f'))?this[_0xdcdd('0x10')](_0xdcdd('0x1f'))[_0xdcdd('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xdcdd('0x4')](_0xdcdd('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xdcdd('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xdcdd('0x2')]},'description':{'type':Sequelize[_0xdcdd('0x2')]},'acw':{'type':Sequelize[_0xdcdd('0x20')],'defaultValue':0x0,'set':function(_0x52a970){this[_0xdcdd('0xe')](_0xdcdd('0x21'),_0x52a970);if(_0x52a970){if(this[_0xdcdd('0x10')](_0xdcdd('0x22'))<0x2){this[_0xdcdd('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xdcdd('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdcdd('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xdcdd('0x4')]('preview',_0xdcdd('0x15'),_0xdcdd('0x23'),_0xdcdd('0x16'),_0xdcdd('0x13')),'defaultValue':_0xdcdd('0x15'),'comment':_0xdcdd('0x24')},'dialLimitChannel':{'type':Sequelize[_0xdcdd('0x17')](0x4)[_0xdcdd('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdcdd('0x26')},'dialLimitQueue':{'type':Sequelize[_0xdcdd('0x17')](0x4)[_0xdcdd('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xdcdd('0x27')](0x2)[_0xdcdd('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xdcdd('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xdcdd('0x29'),_0xdcdd('0x2a')),'defaultValue':'dropRate','comment':_0xdcdd('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xdcdd('0x27')](0x2)[_0xdcdd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xdcdd('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xdcdd('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdcdd('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':_0xdcdd('0x2d'),'comment':_0xdcdd('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdcdd('0x2f')},'dialQueueProject':{'type':Sequelize[_0xdcdd('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdcdd('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdcdd('0x17')](0x5)[_0xdcdd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdcdd('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xdcdd('0x17')](0x5)[_0xdcdd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdcdd('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdcdd('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xdcdd('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdcdd('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdcdd('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdcdd('0x35')},'dialTimezone':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdcdd('0x2')],'defaultValue':_0xdcdd('0x36')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xdcdd('0x37'),_0xdcdd('0x38'),'onlyIfOpen'),'defaultValue':_0xdcdd('0x37')},'dialAMDActive':{'type':Sequelize[_0xdcdd('0x20')],'defaultValue':0x0,'comment':_0xdcdd('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xdcdd('0x17')](0x9)[_0xdcdd('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xdcdd('0x17')](0x9)[_0xdcdd('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdcdd('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdcdd('0x17')](0x9)[_0xdcdd('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdcdd('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdcdd('0x17')](0x9)[_0xdcdd('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdcdd('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0xdcdd('0x17')](0x9)[_0xdcdd('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdcdd('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdcdd('0x17')](0x9)[_0xdcdd('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdcdd('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdcdd('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdcdd('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdcdd('0x17')](0x9)[_0xdcdd('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xdcdd('0x17')](0x5)[_0xdcdd('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xdcdd('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xdcdd('0x20')],'defaultValue':0x0,'comment':_0xdcdd('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdcdd('0x4')]('DESC',_0xdcdd('0x41')),'defaultValue':_0xdcdd('0x42')},'dialQueueProject2':{'type':Sequelize[_0xdcdd('0x2')],'comment':_0xdcdd('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xdcdd('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xdcdd('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdcdd('0x44')},'dialCutDigit':{'type':Sequelize[_0xdcdd('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdcdd('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdcdd('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdcdd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdcdd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xdcdd('0x17')](0x5)[_0xdcdd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdcdd('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdcdd('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdcdd('0x17')](0x5)[_0xdcdd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdcdd('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdcdd('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdcdd('0x17')](0x5)[_0xdcdd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdcdd('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdcdd('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdcdd('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdcdd('0x20')],'defaultValue':![],'comment':_0xdcdd('0x4d'),'set':function(_0x353904){if(!_0x353904)this[_0xdcdd('0xe')](_0xdcdd('0x4e'),null);this['setDataValue'](_0xdcdd('0x4f'),_0x353904);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xdcdd('0x17')](0x3)[_0xdcdd('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xdcdd('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x8075=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','inbound','outbound','STRING','default','ringall','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','ENUM','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\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','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\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','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\x20(min:1,\x20max:999)','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\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x205dd4,_0x56dad9){var _0x2cc869=function(_0x1ae57c){while(--_0x1ae57c){_0x205dd4['push'](_0x205dd4['shift']());}};_0x2cc869(++_0x56dad9);}(_0x8075,0xab));var _0x5807=function(_0x3355d2,_0xccef9a){_0x3355d2=_0x3355d2-0x0;var _0x5b6bda=_0x8075[_0x3355d2];return _0x5b6bda;};'use strict';var Sequelize=require(_0x5807('0x0'));module[_0x5807('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5807('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x5807('0x3'),_0x5807('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x5807('0x5')],'defaultValue':_0x5807('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x5807('0x7'),'leastrecent',_0x5807('0x8'),_0x5807('0x9'),_0x5807('0xa'),_0x5807('0xb'),_0x5807('0xc'),_0x5807('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x47f3dc){this[_0x5807('0xe')](_0x5807('0xf'),_0x47f3dc?_0x47f3dc:_0x5807('0xa'));},'get':function(){var _0x121888=this[_0x5807('0x10')](_0x5807('0x11'));var _0xa1ec39=this[_0x5807('0x10')](_0x5807('0x12'));var _0x33a81a=this[_0x5807('0x10')]('strategy');if(_0x121888===_0x5807('0x3')){return _0x33a81a;}if(_0xa1ec39===_0x5807('0x13')&&_0x33a81a===_0x5807('0xa')||_0xa1ec39===_0x5807('0x13')&&_0x33a81a===_0x5807('0x14')){return _0x33a81a;}if(_0xa1ec39===_0x5807('0x15')||_0xa1ec39===_0x5807('0x16')||_0xa1ec39===_0x5807('0x17')){return _0x33a81a;}return null;}},'servicelevel':{'type':Sequelize[_0x5807('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5807('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5807('0x18')](0xb)},'timeout':{'type':Sequelize[_0x5807('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5807('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5807('0x5')]},'weight':{'type':Sequelize[_0x5807('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5807('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x1a'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x1a'),'no',_0x5807('0x1b')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5807('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0x5807('0x19')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x1a'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5807('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5807('0x19')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x1a'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x1a'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x1a'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5807('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5807('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5807('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x1a'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x5807('0x1a'),'no'),'defaultValue':_0x5807('0x1a')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x5807('0x1a'),'no',_0x5807('0x1c')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5807('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x5807('0x1a'),'no')},'announce_position_limit':{'type':Sequelize[_0x5807('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x5807('0x19')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5807('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5807('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5807('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5807('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x5807('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5807('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x5807('0x5')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x5807('0x5')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x220540){this[_0x5807('0xe')](_0x5807('0x1d'),_0x220540?_0x220540[_0x5807('0x1e')](','):[]);},'get':function(){return this[_0x5807('0x10')](_0x5807('0x1d'))?this[_0x5807('0x10')]('periodic_announce')[_0x5807('0x1f')](','):[];}},'joinempty':{'type':Sequelize[_0x5807('0x5')],'defaultValue':'yes','set':function(_0x50585b){this[_0x5807('0xe')](_0x5807('0x20'),_0x50585b?_0x50585b[_0x5807('0x1e')](','):undefined);},'get':function(){return this[_0x5807('0x10')](_0x5807('0x20'))?this[_0x5807('0x10')]('joinempty')[_0x5807('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5807('0x5')],'defaultValue':'no','set':function(_0x2682ac){this[_0x5807('0xe')]('leavewhenempty',_0x2682ac?_0x2682ac[_0x5807('0x1e')](','):undefined);},'get':function(){return this[_0x5807('0x10')](_0x5807('0x21'))?this[_0x5807('0x10')](_0x5807('0x21'))[_0x5807('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x5807('0x1a'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x1a'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5807('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x1a'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5807('0x5')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x5807('0x22')],'defaultValue':0x0,'set':function(_0x59f8b3){this['setDataValue'](_0x5807('0x23'),_0x59f8b3);if(_0x59f8b3){if(this[_0x5807('0x10')]('wrapuptime')<0x2){this[_0x5807('0xe')](_0x5807('0x24'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5807('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x5807('0x15'),_0x5807('0x17'),_0x5807('0x16'),_0x5807('0x13')),'defaultValue':_0x5807('0x15'),'comment':_0x5807('0x25')},'dialLimitChannel':{'type':Sequelize[_0x5807('0x18')](0x4)[_0x5807('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5807('0x27')},'dialLimitQueue':{'type':Sequelize[_0x5807('0x18')](0x4)[_0x5807('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x5807('0x28')](0x2)[_0x5807('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5807('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x5807('0x19')](_0x5807('0x2a'),_0x5807('0x2b')),'defaultValue':_0x5807('0x2b'),'comment':_0x5807('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5807('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5807('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x5807('0x18')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5807('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5807('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5807('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5807('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x5807('0x5')],'defaultValue':_0x5807('0x30'),'comment':_0x5807('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x5807('0x18')](0x3)[_0x5807('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5807('0x32')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x5807('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5807('0x18')](0x3)[_0x5807('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5807('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5807('0x18')](0x5)[_0x5807('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5807('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5807('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5807('0x18')](0x5)[_0x5807('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5807('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x5807('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5807('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5807('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5807('0x18')](0x3)[_0x5807('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5807('0x38')},'dialTimezone':{'type':Sequelize[_0x5807('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5807('0x5')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x5807('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5807('0x19')]('always',_0x5807('0x39'),_0x5807('0x3a')),'defaultValue':_0x5807('0x3b')},'dialAMDActive':{'type':Sequelize[_0x5807('0x22')],'defaultValue':0x0,'comment':_0x5807('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0x5807('0x18')](0x9)[_0x5807('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5807('0x3d')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x5807('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5807('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5807('0x18')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x5807('0x18')](0x9)[_0x5807('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5807('0x18')](0x9)[_0x5807('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5807('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5807('0x18')](0x9)[_0x5807('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5807('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5807('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5807('0x18')](0x9)[_0x5807('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x5807('0x18')](0x5)[_0x5807('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5807('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x5807('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x5807('0x42')),'defaultValue':_0x5807('0x43')},'dialQueueProject2':{'type':Sequelize[_0x5807('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5807('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5807('0x18')](0x3)[_0x5807('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5807('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5807('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5807('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5807('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5807('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5807('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5807('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x5807('0x18')](0x3)[_0x5807('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5807('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x5807('0x18')](0x5)[_0x5807('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5807('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5807('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5807('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5807('0x18')](0x5)[_0x5807('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5807('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x5807('0x18')](0x3)[_0x5807('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5807('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5807('0x18')](0x5)[_0x5807('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5807('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5807('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5807('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5807('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5807('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5807('0x18')],'allowNull':!![],'comment':_0x5807('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x5807('0x22')],'defaultValue':![],'comment':_0x5807('0x51'),'set':function(_0x1092e8){if(!_0x1092e8)this[_0x5807('0xe')](_0x5807('0x52'),null);this[_0x5807('0xe')](_0x5807('0x53'),_0x1092e8);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x5807('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x5807('0x18')](0x3)[_0x5807('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index a75ba34..9d9c9aa 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 _0x469c=['options','VoiceQueue','includeAll','include','rows','catch','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','QueueCampaigns','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','hasOwnProperty','findAll','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','isNil','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','spread','push','getAgents','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','field','NOW()','scheduledAt','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','insert','ListId\x20=\x20?','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','inbound','ignore','map','value','includes','type','name','UserProfileResource','sendStatus','error','stack','send','index','fieldName','model','keys','intersection','query','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x469c,0x71));var _0xc469=function(_0xc23380,_0x18e158){_0xc23380=_0xc23380-0x0;var _0x4b1b26=_0x469c[_0xc23380];return _0x4b1b26;};'use strict';var emlformat=require(_0xc469('0x0'));var rimraf=require(_0xc469('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc469('0x2'));var rp=require(_0xc469('0x3'));var moment=require(_0xc469('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc469('0x5'));var util=require(_0xc469('0x6'));var path=require(_0xc469('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc469('0x8'));var _=require(_0xc469('0x9'));var squel=require(_0xc469('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc469('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc469('0xc'));var Papa=require('papaparse');var Redis=require(_0xc469('0xd'));var authService=require(_0xc469('0xe'));var qs=require(_0xc469('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc469('0x10'));var logger=require(_0xc469('0x11'))('api');var utils=require(_0xc469('0x12'));var config=require(_0xc469('0x13'));var licenseUtil=require(_0xc469('0x14'));var db=require('../../mysqldb')['db'];config[_0xc469('0x15')]=_[_0xc469('0x16')](config[_0xc469('0x15')],{'host':_0xc469('0x17'),'port':0x18eb});var socket=require(_0xc469('0x18'))(new Redis(config[_0xc469('0x15')]));require('./voiceQueue.socket')[_0xc469('0x19')](socket);function respondWithStatusCode(_0x4bf967,_0x32477f){_0x32477f=_0x32477f||0xcc;return function(_0x545a1){if(_0x545a1){return _0x4bf967['sendStatus'](_0x32477f);}return _0x4bf967[_0xc469('0x1a')](_0x32477f)[_0xc469('0x1b')]();};}function respondWithResult(_0x1605a7,_0x33463d){_0x33463d=_0x33463d||0xc8;return function(_0xa96886){if(_0xa96886){return _0x1605a7[_0xc469('0x1a')](_0x33463d)[_0xc469('0x1c')](_0xa96886);}};}function respondWithFilteredResult(_0xbbeca9,_0x231e4b){return function(_0x426b0b){if(_0x426b0b){var _0x50e73a=typeof _0x231e4b[_0xc469('0x1d')]==='undefined'&&typeof _0x231e4b['limit']==='undefined';var _0x5e6ca4=_0x426b0b[_0xc469('0x1e')];var _0x5b15c8=_0x50e73a?0x0:_0x231e4b['offset'];var _0x44334c=_0x50e73a?_0x426b0b[_0xc469('0x1e')]:_0x231e4b[_0xc469('0x1d')]+_0x231e4b[_0xc469('0x1f')];var _0x4212ce;if(_0x44334c>=_0x5e6ca4){_0x44334c=_0x5e6ca4;_0x4212ce=0xc8;}else{_0x4212ce=0xce;}_0xbbeca9[_0xc469('0x1a')](_0x4212ce);return _0xbbeca9[_0xc469('0x20')](_0xc469('0x21'),_0x5b15c8+'-'+_0x44334c+'/'+_0x5e6ca4)[_0xc469('0x1c')](_0x426b0b);}return null;};}function patchUpdates(_0x9df0ba){return function(_0x5f0174){try{jsonpatch[_0xc469('0x22')](_0x5f0174,_0x9df0ba,!![]);}catch(_0x1829ec){return BPromise[_0xc469('0x23')](_0x1829ec);}return _0x5f0174[_0xc469('0x24')]();};}function saveUpdates(_0x324f33,_0x16de30){return function(_0x139273){if(_0x139273){return _0x139273[_0xc469('0x25')](_0x324f33)[_0xc469('0x26')](function(_0x5b0753){return _0x5b0753;});}return null;};}function removeEntity(_0x13f2e6,_0x5eff76){return function(_0x5037ae){if(_0x5037ae){return _0x5037ae[_0xc469('0x27')]()[_0xc469('0x26')](function(){var _0xbfc662=_0x5037ae['get']({'plain':!![]});var _0x45c373=[{'name':_0xc469('0x28'),'value':_0xc469('0x29'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x687c39=_(_0x45c373)['filter'](_0xc469('0x2a'))[_0xc469('0x2b')](_0xc469('0x2c'))[_0xc469('0x2c')]();if(_[_0xc469('0x2d')](_0x687c39,_0xbfc662[_0xc469('0x2e')])){return;}var _0x4fbae5=_['find'](_0x45c373,['value',_0xbfc662[_0xc469('0x2e')]])[_0xc469('0x2f')];return db[_0xc469('0x30')][_0xc469('0x27')]({'where':{'type':_0x4fbae5,'resourceId':_0xbfc662['id']}})['then'](function(){return _0x5037ae;});})['then'](function(){_0x13f2e6[_0xc469('0x1a')](0xcc)[_0xc469('0x1b')]();});}};}function handleEntityNotFound(_0x3a2b65,_0x4ae010){return function(_0x3f4f96){if(!_0x3f4f96){_0x3a2b65[_0xc469('0x31')](0x194);}return _0x3f4f96;};}function handleError(_0x3c3783,_0x52be03){_0x52be03=_0x52be03||0x1f4;return function(_0x4b4711){logger[_0xc469('0x32')](_0x4b4711[_0xc469('0x33')]);if(_0x4b4711[_0xc469('0x2f')]){delete _0x4b4711[_0xc469('0x2f')];}_0x3c3783[_0xc469('0x1a')](_0x52be03)[_0xc469('0x34')](_0x4b4711);};}exports[_0xc469('0x35')]=function(_0x280d54,_0x49698d){var _0x148198={},_0x159dbb={},_0x5b4041={'count':0x0,'rows':[]};var _0x5dd094=_[_0xc469('0x2b')](db['VoiceQueue']['rawAttributes'],function(_0x27827e){return{'name':_0x27827e[_0xc469('0x36')],'type':_0x27827e[_0xc469('0x2e')]['key']};});_0x159dbb[_0xc469('0x37')]=_[_0xc469('0x2b')](_0x5dd094,_0xc469('0x2f'));_0x159dbb['query']=_[_0xc469('0x38')](_0x280d54['query']);_0x159dbb['filters']=_[_0xc469('0x39')](_0x159dbb[_0xc469('0x37')],_0x159dbb[_0xc469('0x3a')]);_0x148198['attributes']=_['intersection'](_0x159dbb[_0xc469('0x37')],qs[_0xc469('0x3b')](_0x280d54[_0xc469('0x3a')]['fields']));_0x148198[_0xc469('0x3c')]=_0x148198[_0xc469('0x3c')][_0xc469('0x3d')]?_0x148198[_0xc469('0x3c')]:_0x159dbb['model'];if(!_0x280d54[_0xc469('0x3a')]['hasOwnProperty']('nolimit')){_0x148198[_0xc469('0x1f')]=qs[_0xc469('0x1f')](_0x280d54[_0xc469('0x3a')][_0xc469('0x1f')]);_0x148198[_0xc469('0x1d')]=qs[_0xc469('0x1d')](_0x280d54[_0xc469('0x3a')][_0xc469('0x1d')]);}_0x148198[_0xc469('0x3e')]=qs[_0xc469('0x3f')](_0x280d54[_0xc469('0x3a')]['sort']);_0x148198[_0xc469('0x40')]=qs[_0xc469('0x41')](_[_0xc469('0x42')](_0x280d54['query'],_0x159dbb['filters']),_0x5dd094);if(_0x280d54[_0xc469('0x3a')][_0xc469('0x43')]){_0x148198['where']=_[_0xc469('0x44')](_0x148198[_0xc469('0x40')],{'$or':_[_0xc469('0x2b')](_0x5dd094,function(_0x387153){if(_0x387153[_0xc469('0x2e')]!==_0xc469('0x45')){var _0x39c9ff={};_0x39c9ff[_0x387153['name']]={'$like':'%'+_0x280d54[_0xc469('0x3a')]['filter']+'%'};return _0x39c9ff;}})});}_0x148198=_[_0xc469('0x44')]({},_0x148198,_0x280d54[_0xc469('0x46')]);var _0x5af68e={'where':_0x148198[_0xc469('0x40')]};return db[_0xc469('0x47')][_0xc469('0x1e')](_0x5af68e)[_0xc469('0x26')](function(_0x3d987c){_0x5b4041['count']=_0x3d987c;if(_0x280d54[_0xc469('0x3a')][_0xc469('0x48')]){_0x148198[_0xc469('0x49')]=[{'all':!![]}];}return db[_0xc469('0x47')]['findAll'](_0x148198);})[_0xc469('0x26')](function(_0x5ce4d5){_0x5b4041[_0xc469('0x4a')]=_0x5ce4d5;return _0x5b4041;})['then'](respondWithFilteredResult(_0x49698d,_0x148198))[_0xc469('0x4b')](handleError(_0x49698d,null));};exports['show']=function(_0x5adb62,_0x552bee){var _0x173de6={'raw':![],'where':{'id':_0x5adb62[_0xc469('0x4c')]['id']}},_0x54fd06={};_0x54fd06[_0xc469('0x37')]=_[_0xc469('0x38')](db[_0xc469('0x47')][_0xc469('0x4d')]);_0x54fd06[_0xc469('0x3a')]=_[_0xc469('0x38')](_0x5adb62[_0xc469('0x3a')]);_0x54fd06[_0xc469('0x41')]=_[_0xc469('0x39')](_0x54fd06[_0xc469('0x37')],_0x54fd06['query']);_0x173de6[_0xc469('0x3c')]=_[_0xc469('0x39')](_0x54fd06[_0xc469('0x37')],qs[_0xc469('0x3b')](_0x5adb62['query'][_0xc469('0x3b')]));_0x173de6[_0xc469('0x3c')]=_0x173de6['attributes'][_0xc469('0x3d')]?_0x173de6[_0xc469('0x3c')]:_0x54fd06[_0xc469('0x37')];if(_0x5adb62[_0xc469('0x3a')][_0xc469('0x48')]){_0x173de6[_0xc469('0x49')]=[{'all':!![]}];}_0x173de6=_[_0xc469('0x44')]({},_0x173de6,_0x5adb62[_0xc469('0x46')]);return db[_0xc469('0x47')][_0xc469('0x4e')](_0x173de6)[_0xc469('0x26')](handleEntityNotFound(_0x552bee,null))[_0xc469('0x26')](respondWithResult(_0x552bee,null))['catch'](handleError(_0x552bee,null));};exports[_0xc469('0x4f')]=function(_0x242e2b,_0x2c720b){return db[_0xc469('0x47')][_0xc469('0x4f')](_0x242e2b[_0xc469('0x50')],{})['then'](function(_0x5e9b23){var _0x47ac70=_0x242e2b['user']['get']({'plain':!![]});if(!_0x47ac70)throw new Error(_0xc469('0x51'));if(_0x47ac70[_0xc469('0x52')]===_0xc469('0x53')){var _0xdce24e=_0x5e9b23[_0xc469('0x54')]({'plain':!![]});var _0x28a708=[{'name':_0xc469('0x28'),'value':_0xc469('0x29')},{'name':_0xc469('0x55'),'value':'outbound'}];var _0x1b38d7=_['find'](_0x28a708,[_0xc469('0x2c'),_0xdce24e[_0xc469('0x2e')]])[_0xc469('0x2f')];return db[_0xc469('0x56')]['find']({'where':{'name':_0x1b38d7,'userProfileId':_0x47ac70[_0xc469('0x57')]},'raw':!![]})[_0xc469('0x26')](function(_0x2c4bfb){if(_0x2c4bfb&&_0x2c4bfb['autoAssociation']===0x0){return db[_0xc469('0x30')]['create']({'name':_0xdce24e[_0xc469('0x2f')],'resourceId':_0xdce24e['id'],'type':_0x2c4bfb[_0xc469('0x2f')],'sectionId':_0x2c4bfb['id']},{})[_0xc469('0x26')](function(){return _0x5e9b23;});}else{return _0x5e9b23;}})['catch'](function(_0x48bff3){logger[_0xc469('0x32')](_0xc469('0x58'),_0x48bff3);throw _0x48bff3;});}return _0x5e9b23;})[_0xc469('0x26')](respondWithResult(_0x2c720b,0xc9))[_0xc469('0x4b')](handleError(_0x2c720b,null));};exports[_0xc469('0x59')]=function(_0x325a21,_0x25fc43){var _0x34229c={'where':{'id':_0x325a21[_0xc469('0x4c')]['id']}},_0x2ac04b={};_0x2ac04b[_0xc469('0x37')]=_[_0xc469('0x38')](db[_0xc469('0x47')][_0xc469('0x4d')]);_0x34229c[_0xc469('0x3c')]=_['intersection'](_0x2ac04b[_0xc469('0x37')],qs[_0xc469('0x3b')](_0x325a21[_0xc469('0x3a')][_0xc469('0x3b')]));_0x34229c[_0xc469('0x3c')]=_0x34229c[_0xc469('0x3c')][_0xc469('0x3d')]?_0x34229c[_0xc469('0x3c')]:_0x2ac04b['model'];if(_0x325a21['query'][_0xc469('0x48')]){_0x34229c['include']=[{'all':!![]}];}_0x34229c=_[_0xc469('0x44')]({},_0x34229c,_0x325a21[_0xc469('0x46')]);return db['VoiceQueue'][_0xc469('0x4e')](_0x34229c)[_0xc469('0x26')](handleEntityNotFound(_0x25fc43,null))[_0xc469('0x26')](function(_0x39d54f){if(_0x39d54f){var _0x1cc184=_0x39d54f['get']({'plain':!![]});_0x1cc184=qs[_0xc469('0x5a')](_0x1cc184,['id',_0xc469('0x5b'),_0xc469('0x5c')]);_0x325a21['body']=_[_0xc469('0x5a')](_0x325a21[_0xc469('0x50')],['id',_0xc469('0x5b'),_0xc469('0x5c')]);return db[_0xc469('0x47')][_0xc469('0x4f')](_[_0xc469('0x44')](_0x1cc184,_0x325a21['body']),{'include':_0x325a21[_0xc469('0x3a')][_0xc469('0x48')]?[{'all':!![]}]:undefined})[_0xc469('0x26')](function(_0x4c2e0e){var _0x363c94=_0x325a21[_0xc469('0x53')][_0xc469('0x54')]({'plain':!![]});if(!_0x363c94)throw new Error(_0xc469('0x51'));if(_0x363c94[_0xc469('0x52')]===_0xc469('0x53')){var _0x31730c=_0x4c2e0e[_0xc469('0x54')]({'plain':!![]});var _0x3bb800=[{'name':_0xc469('0x28'),'value':_0xc469('0x29')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5f13cc=_[_0xc469('0x4e')](_0x3bb800,['value',_0x31730c[_0xc469('0x2e')]])['name'];return db['UserProfileSection'][_0xc469('0x4e')]({'where':{'name':_0x5f13cc,'userProfileId':_0x363c94[_0xc469('0x57')]},'raw':!![]})['then'](function(_0x3cff05){if(_0x3cff05&&_0x3cff05['autoAssociation']===0x0){return db[_0xc469('0x30')][_0xc469('0x4f')]({'name':_0x31730c[_0xc469('0x2f')],'resourceId':_0x31730c['id'],'type':_0x3cff05['name'],'sectionId':_0x3cff05['id']},{})[_0xc469('0x26')](function(){return _0x4c2e0e;});}else{return _0x4c2e0e;}})[_0xc469('0x4b')](function(_0x29d099){logger['error'](_0xc469('0x58'),_0x29d099);throw _0x29d099;});}return _0x4c2e0e;});}})[_0xc469('0x26')](respondWithResult(_0x25fc43,0xc9))[_0xc469('0x4b')](handleError(_0x25fc43,null));};exports[_0xc469('0x25')]=function(_0x1157c3,_0x84caf3){if(_0x1157c3[_0xc469('0x50')]['id']){delete _0x1157c3[_0xc469('0x50')]['id'];}return db[_0xc469('0x47')]['find']({'where':{'id':_0x1157c3[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x84caf3,null))[_0xc469('0x26')](saveUpdates(_0x1157c3[_0xc469('0x50')],null))['then'](respondWithResult(_0x84caf3,null))[_0xc469('0x4b')](handleError(_0x84caf3,null));};exports[_0xc469('0x27')]=function(_0x25060c,_0x2bd2d3){return db[_0xc469('0x47')][_0xc469('0x4e')]({'where':{'id':_0x25060c[_0xc469('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2bd2d3,null))[_0xc469('0x26')](removeEntity(_0x2bd2d3,null))[_0xc469('0x4b')](handleError(_0x2bd2d3,null));};exports[_0xc469('0x5d')]=function(_0x427ea0,_0x1e7e5d,_0x360b59){var _0x256eec={'raw':![],'where':{}};var _0x53209f={};var _0x57084c={'count':0x0,'rows':[]};return db[_0xc469('0x47')][_0xc469('0x5e')]({'where':{'id':_0x427ea0[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x1e7e5d,null))['then'](function(_0x2ef2e4){if(_0x2ef2e4){_0x53209f[_0xc469('0x37')]=_[_0xc469('0x38')](db[_0xc469('0x5f')][_0xc469('0x4d')]);_0x53209f[_0xc469('0x3a')]=_[_0xc469('0x38')](_0x427ea0[_0xc469('0x3a')]);_0x53209f[_0xc469('0x41')]=_[_0xc469('0x39')](_0x53209f[_0xc469('0x37')],_0x53209f['query']);_0x256eec[_0xc469('0x3c')]=_[_0xc469('0x39')](_0x53209f[_0xc469('0x37')],qs['fields'](_0x427ea0[_0xc469('0x3a')][_0xc469('0x3b')]));_0x256eec[_0xc469('0x3c')]=_0x256eec['attributes'][_0xc469('0x3d')]?_0x256eec[_0xc469('0x3c')]:_0x53209f[_0xc469('0x37')];if(!_0x427ea0[_0xc469('0x3a')][_0xc469('0x60')]('nolimit')){_0x256eec[_0xc469('0x1f')]=qs['limit'](_0x427ea0['query'][_0xc469('0x1f')]);_0x256eec[_0xc469('0x1d')]=qs[_0xc469('0x1d')](_0x427ea0[_0xc469('0x3a')][_0xc469('0x1d')]);}_0x256eec['order']=qs[_0xc469('0x3f')](_0x427ea0['query'][_0xc469('0x3f')]);_0x256eec[_0xc469('0x40')]=qs[_0xc469('0x41')](_[_0xc469('0x42')](_0x427ea0['query'],_0x53209f[_0xc469('0x41')]));_0x256eec[_0xc469('0x40')]['VoiceQueueId']=_0x2ef2e4['id'];if(_0x427ea0[_0xc469('0x3a')]['filter']){_0x256eec[_0xc469('0x40')]=_[_0xc469('0x44')](_0x256eec[_0xc469('0x40')],{'$or':_[_0xc469('0x2b')](_0x256eec[_0xc469('0x3c')],function(_0x3fd621){var _0x1c9e4d={};_0x1c9e4d[_0x3fd621]={'$like':'%'+_0x427ea0[_0xc469('0x3a')][_0xc469('0x43')]+'%'};return _0x1c9e4d;})});}_0x256eec=_[_0xc469('0x44')]({},_0x256eec,_0x427ea0[_0xc469('0x46')]);return db[_0xc469('0x5f')][_0xc469('0x1e')]({'where':_0x256eec[_0xc469('0x40')]})['then'](function(_0x3c190f){_0x57084c[_0xc469('0x1e')]=_0x3c190f;if(_0x427ea0[_0xc469('0x3a')][_0xc469('0x48')]){_0x256eec['include']=[{'all':!![]}];}return db['CmHopper'][_0xc469('0x61')](_0x256eec);})[_0xc469('0x26')](function(_0x55589d){_0x57084c[_0xc469('0x4a')]=_0x55589d;return _0x57084c;});}})[_0xc469('0x26')](respondWithFilteredResult(_0x1e7e5d,_0x256eec))[_0xc469('0x4b')](handleError(_0x1e7e5d,null));};exports[_0xc469('0x62')]=function(_0x545b2a,_0x34fd6e,_0x4f04b8){var _0xd207f5={'raw':!![],'where':{}};var _0x40e004={};var _0x1a24bb={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc469('0x5e')]({'where':{'id':_0x545b2a[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x34fd6e,null))[_0xc469('0x26')](function(_0x5da60d){if(_0x5da60d){_0x40e004[_0xc469('0x37')]=_[_0xc469('0x38')](db[_0xc469('0x63')][_0xc469('0x4d')]);_0x40e004[_0xc469('0x3a')]=_['keys'](_0x545b2a[_0xc469('0x3a')]);_0x40e004['filters']=_['intersection'](_0x40e004[_0xc469('0x37')],_0x40e004['query']);_0xd207f5[_0xc469('0x3c')]=_[_0xc469('0x39')](_0x40e004[_0xc469('0x37')],qs['fields'](_0x545b2a['query'][_0xc469('0x3b')]));_0xd207f5[_0xc469('0x3c')]=_0xd207f5['attributes'][_0xc469('0x3d')]?_0xd207f5['attributes']:_0x40e004[_0xc469('0x37')];if(!_0x545b2a[_0xc469('0x3a')][_0xc469('0x60')](_0xc469('0x64'))){_0xd207f5[_0xc469('0x1f')]=qs[_0xc469('0x1f')](_0x545b2a[_0xc469('0x3a')][_0xc469('0x1f')]);_0xd207f5[_0xc469('0x1d')]=qs[_0xc469('0x1d')](_0x545b2a[_0xc469('0x3a')][_0xc469('0x1d')]);}_0xd207f5[_0xc469('0x3e')]=qs[_0xc469('0x3f')](_0x545b2a[_0xc469('0x3a')][_0xc469('0x3f')]);_0xd207f5[_0xc469('0x40')]=qs[_0xc469('0x41')](_[_0xc469('0x42')](_0x545b2a[_0xc469('0x3a')],_0x40e004[_0xc469('0x41')]));_0xd207f5[_0xc469('0x40')][_0xc469('0x65')]=_0x5da60d['id'];if(_0x545b2a[_0xc469('0x3a')][_0xc469('0x43')]){_0xd207f5[_0xc469('0x40')]=_[_0xc469('0x44')](_0xd207f5[_0xc469('0x40')],{'$or':_['map'](_0xd207f5[_0xc469('0x3c')],function(_0x2c6956){var _0x590ecd={};_0x590ecd[_0x2c6956]={'$like':'%'+_0x545b2a[_0xc469('0x3a')][_0xc469('0x43')]+'%'};return _0x590ecd;})});}_0xd207f5=_[_0xc469('0x44')]({},_0xd207f5,_0x545b2a[_0xc469('0x46')]);return db[_0xc469('0x63')][_0xc469('0x1e')]({'where':_0xd207f5[_0xc469('0x40')]})[_0xc469('0x26')](function(_0x1e0406){_0x1a24bb['count']=_0x1e0406;if(_0x545b2a[_0xc469('0x3a')][_0xc469('0x48')]){_0xd207f5[_0xc469('0x49')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xd207f5);})[_0xc469('0x26')](function(_0x5e912e){_0x1a24bb[_0xc469('0x4a')]=_0x5e912e;return _0x1a24bb;});}})[_0xc469('0x26')](respondWithFilteredResult(_0x34fd6e,_0xd207f5))[_0xc469('0x4b')](handleError(_0x34fd6e,null));};exports[_0xc469('0x66')]=function(_0x527102,_0x41ba5a,_0x27b69b){var _0x429971={'raw':!![],'where':{}};var _0x35432c={};var _0x1654d5={'count':0x0,'rows':[]};return db[_0xc469('0x47')][_0xc469('0x5e')]({'where':{'id':_0x527102[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x41ba5a,null))[_0xc469('0x26')](function(_0x5bf1eb){if(_0x5bf1eb){_0x35432c[_0xc469('0x37')]=_[_0xc469('0x38')](db[_0xc469('0x67')][_0xc469('0x4d')]);_0x35432c['query']=_[_0xc469('0x38')](_0x527102['query']);_0x35432c[_0xc469('0x41')]=_[_0xc469('0x39')](_0x35432c[_0xc469('0x37')],_0x35432c[_0xc469('0x3a')]);_0x429971[_0xc469('0x3c')]=_[_0xc469('0x39')](_0x35432c[_0xc469('0x37')],qs[_0xc469('0x3b')](_0x527102[_0xc469('0x3a')][_0xc469('0x3b')]));_0x429971[_0xc469('0x3c')]=_0x429971[_0xc469('0x3c')]['length']?_0x429971[_0xc469('0x3c')]:_0x35432c[_0xc469('0x37')];if(!_0x527102[_0xc469('0x3a')][_0xc469('0x60')](_0xc469('0x64'))){_0x429971[_0xc469('0x1f')]=qs[_0xc469('0x1f')](_0x527102['query'][_0xc469('0x1f')]);_0x429971['offset']=qs[_0xc469('0x1d')](_0x527102[_0xc469('0x3a')][_0xc469('0x1d')]);}_0x429971[_0xc469('0x3e')]=qs[_0xc469('0x3f')](_0x527102[_0xc469('0x3a')][_0xc469('0x3f')]);_0x429971[_0xc469('0x40')]=qs[_0xc469('0x41')](_[_0xc469('0x42')](_0x527102[_0xc469('0x3a')],_0x35432c[_0xc469('0x41')]));_0x429971[_0xc469('0x40')][_0xc469('0x65')]=_0x5bf1eb['id'];if(_0x527102['query'][_0xc469('0x43')]){_0x429971[_0xc469('0x40')]=_[_0xc469('0x44')](_0x429971[_0xc469('0x40')],{'$or':_[_0xc469('0x2b')](_0x429971['attributes'],function(_0x29c0e9){var _0x3321ac={};_0x3321ac[_0x29c0e9]={'$like':'%'+_0x527102['query'][_0xc469('0x43')]+'%'};return _0x3321ac;})});}_0x429971=_['merge']({},_0x429971,_0x527102['options']);return db[_0xc469('0x67')][_0xc469('0x1e')]({'where':_0x429971['where']})[_0xc469('0x26')](function(_0x1ba505){_0x1654d5[_0xc469('0x1e')]=_0x1ba505;if(_0x527102[_0xc469('0x3a')][_0xc469('0x48')]){_0x429971['include']=[{'all':!![]}];}return db[_0xc469('0x67')][_0xc469('0x61')](_0x429971);})['then'](function(_0x13cedb){_0x1654d5[_0xc469('0x4a')]=_0x13cedb;return _0x1654d5;});}})[_0xc469('0x26')](respondWithFilteredResult(_0x41ba5a,_0x429971))['catch'](handleError(_0x41ba5a,null));};exports['getHopperBlacks']=function(_0x39a931,_0x17dd13,_0x38e1e0){var _0x35ba45={'raw':!![],'where':{}};var _0x443b18={};var _0x1ba682={'count':0x0,'rows':[]};return db[_0xc469('0x47')][_0xc469('0x5e')]({'where':{'id':_0x39a931[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x17dd13,null))[_0xc469('0x26')](function(_0x52af27){if(_0x52af27){_0x443b18['model']=_[_0xc469('0x38')](db['CmHopperBlack'][_0xc469('0x4d')]);_0x443b18[_0xc469('0x3a')]=_[_0xc469('0x38')](_0x39a931['query']);_0x443b18[_0xc469('0x41')]=_[_0xc469('0x39')](_0x443b18[_0xc469('0x37')],_0x443b18[_0xc469('0x3a')]);_0x35ba45['attributes']=_[_0xc469('0x39')](_0x443b18[_0xc469('0x37')],qs['fields'](_0x39a931[_0xc469('0x3a')][_0xc469('0x3b')]));_0x35ba45[_0xc469('0x3c')]=_0x35ba45['attributes'][_0xc469('0x3d')]?_0x35ba45[_0xc469('0x3c')]:_0x443b18[_0xc469('0x37')];if(!_0x39a931[_0xc469('0x3a')][_0xc469('0x60')]('nolimit')){_0x35ba45[_0xc469('0x1f')]=qs[_0xc469('0x1f')](_0x39a931[_0xc469('0x3a')]['limit']);_0x35ba45[_0xc469('0x1d')]=qs['offset'](_0x39a931['query']['offset']);}_0x35ba45['order']=qs[_0xc469('0x3f')](_0x39a931['query'][_0xc469('0x3f')]);_0x35ba45[_0xc469('0x40')]=qs[_0xc469('0x41')](_['pick'](_0x39a931[_0xc469('0x3a')],_0x443b18['filters']));_0x35ba45['where'][_0xc469('0x65')]=_0x52af27['id'];if(_0x39a931[_0xc469('0x3a')][_0xc469('0x43')]){_0x35ba45[_0xc469('0x40')]=_[_0xc469('0x44')](_0x35ba45['where'],{'$or':_['map'](_0x35ba45['attributes'],function(_0x164cd7){var _0x290a35={};_0x290a35[_0x164cd7]={'$like':'%'+_0x39a931['query'][_0xc469('0x43')]+'%'};return _0x290a35;})});}_0x35ba45=_[_0xc469('0x44')]({},_0x35ba45,_0x39a931[_0xc469('0x46')]);return db[_0xc469('0x68')][_0xc469('0x1e')]({'where':_0x35ba45['where']})[_0xc469('0x26')](function(_0x22d4b0){_0x1ba682['count']=_0x22d4b0;if(_0x39a931[_0xc469('0x3a')][_0xc469('0x48')]){_0x35ba45[_0xc469('0x49')]=[{'all':!![]}];}return db[_0xc469('0x68')][_0xc469('0x61')](_0x35ba45);})[_0xc469('0x26')](function(_0x527370){_0x1ba682[_0xc469('0x4a')]=_0x527370;return _0x1ba682;});}})[_0xc469('0x26')](respondWithFilteredResult(_0x17dd13,_0x35ba45))[_0xc469('0x4b')](handleError(_0x17dd13,null));};exports[_0xc469('0x69')]=function(_0x2c2c54,_0x507446,_0xe70c1e){var _0x24c222={};var _0x438301={};var _0x280234;var _0x5b5e18;return db[_0xc469('0x47')]['findOne']({'where':{'id':_0x2c2c54[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x507446,null))[_0xc469('0x26')](function(_0x479a36){if(_0x479a36){_0x280234=_0x479a36;_0x438301[_0xc469('0x37')]=_[_0xc469('0x38')](db[_0xc469('0x6a')][_0xc469('0x4d')]);_0x438301['query']=_[_0xc469('0x38')](_0x2c2c54[_0xc469('0x3a')]);_0x438301['filters']=_[_0xc469('0x39')](_0x438301[_0xc469('0x37')],_0x438301['query']);_0x24c222[_0xc469('0x3c')]=_['intersection'](_0x438301[_0xc469('0x37')],qs['fields'](_0x2c2c54[_0xc469('0x3a')][_0xc469('0x3b')]));_0x24c222['attributes']=_0x24c222[_0xc469('0x3c')][_0xc469('0x3d')]?_0x24c222[_0xc469('0x3c')]:_0x438301[_0xc469('0x37')];_0x24c222[_0xc469('0x3e')]=qs['sort'](_0x2c2c54[_0xc469('0x3a')][_0xc469('0x3f')]);_0x24c222[_0xc469('0x40')]=qs[_0xc469('0x41')](_['pick'](_0x2c2c54[_0xc469('0x3a')],_0x438301[_0xc469('0x41')]));if(_0x2c2c54[_0xc469('0x3a')][_0xc469('0x43')]){_0x24c222['where']=_['merge'](_0x24c222[_0xc469('0x40')],{'$or':_[_0xc469('0x2b')](_0x24c222[_0xc469('0x3c')],function(_0x148ae6){var _0x1ffae5={};_0x1ffae5[_0x148ae6]={'$like':'%'+_0x2c2c54['query'][_0xc469('0x43')]+'%'};return _0x1ffae5;})});}_0x24c222=_[_0xc469('0x44')]({},_0x24c222,_0x2c2c54[_0xc469('0x46')]);return _0x280234[_0xc469('0x69')](_0x24c222);}})[_0xc469('0x26')](function(_0x29e3dc){if(_0x29e3dc){_0x5b5e18=_0x29e3dc['length'];if(!_0x2c2c54[_0xc469('0x3a')][_0xc469('0x60')](_0xc469('0x64'))){_0x24c222[_0xc469('0x1f')]=qs[_0xc469('0x1f')](_0x2c2c54[_0xc469('0x3a')][_0xc469('0x1f')]);_0x24c222[_0xc469('0x1d')]=qs[_0xc469('0x1d')](_0x2c2c54[_0xc469('0x3a')][_0xc469('0x1d')]);}return _0x280234['getTeams'](_0x24c222);}})['then'](function(_0x2dd53a){if(_0x2dd53a){return _0x2dd53a?{'count':_0x5b5e18,'rows':_0x2dd53a}:null;}})[_0xc469('0x26')](respondWithResult(_0x507446,null))['catch'](handleError(_0x507446,null));};exports[_0xc469('0x6b')]=function(_0x486112,_0x59ec98,_0x3e15e6){var _0x90d9d6=_0x486112[_0xc469('0x50')][_0xc469('0x6c')];var _0x501da1=_[_0xc469('0x2b')](_0x90d9d6,'id');return db[_0xc469('0x6a')][_0xc469('0x61')]({'where':{'id':_0x501da1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc469('0x6d'),'attributes':['id',_0xc469('0x2f'),_0xc469('0x6e'),_0xc469('0x6f'),'interface'],'raw':!![]}]})[_0xc469('0x26')](function(_0x3256ee){if(_0x3256ee){var _0x2b244e=_[_0xc469('0x70')](_0x3256ee,function(_0x5a7c8d){var _0x459c52=_0x5a7c8d[_0xc469('0x54')]({'plain':!![]});_0x459c52[_0xc469('0x6d')][_0xc469('0x71')](function(_0x28f43b){_0x28f43b[_0xc469('0x72')]=_[_0xc469('0x4e')](_0x90d9d6,{'id':_0x459c52['id']})['penalty'];});return _0x459c52[_0xc469('0x6d')];});return db[_0xc469('0x47')][_0xc469('0x4e')]({'where':{'id':_0x486112[_0xc469('0x4c')]['id']}})['then'](function(_0x4a845d){return db[_0xc469('0x73')][_0xc469('0x74')](function(_0x4ed96a){return _0x4a845d[_0xc469('0x6b')](_0x501da1,{'transaction':_0x4ed96a})[_0xc469('0x26')](function(){return BPromise[_0xc469('0x75')](_0x90d9d6,function(_0x3d185a){return db[_0xc469('0x76')][_0xc469('0x77')]({'TeamId':_0x3d185a['id'],'VoiceQueueId':_0x486112[_0xc469('0x4c')]['id'],'penalty':_0x3d185a[_0xc469('0x72')]},{'transaction':_0x4ed96a});});})[_0xc469('0x26')](function(){return BPromise[_0xc469('0x75')](_0x2b244e,function(_0x3203d0){return db[_0xc469('0x78')][_0xc469('0x79')]({'where':{'UserId':_0x3203d0['id'],'VoiceQueueId':_0x486112[_0xc469('0x4c')]['id']},'defaults':{'penalty':_0x3203d0[_0xc469('0x72')]},'transaction':_0x4ed96a});});})[_0xc469('0x26')](function(){return BPromise[_0xc469('0x75')](_[_0xc469('0x43')](_0x2b244e,{'online':!![]}),function(_0x298003){return db['UserVoiceQueueRt'][_0xc469('0x77')]({'membername':_0x298003['name'],'UserId':_0x298003['id'],'queue_name':_0x4a845d[_0xc469('0x2f')],'VoiceQueueId':_0x4a845d['id'],'interface':_[_0xc469('0x7a')](_0x298003[_0xc469('0x7b')])?util[_0xc469('0x7c')](_0xc469('0x7d'),_0x298003[_0xc469('0x2f')]):_0x298003['interface'],'paused':_0x298003[_0xc469('0x6f')]||![],'penalty':_0x298003[_0xc469('0x72')]},{'transaction':_0x4ed96a});});})[_0xc469('0x26')](function(){_0x2b244e[_0xc469('0x71')](function(_0x5648c6){socket['emit'](_0xc469('0x7e'),{'UserId':_0x5648c6['id'],'VoiceQueueId':_0x4a845d['id']});});});});});}})[_0xc469('0x26')](respondWithStatusCode(_0x59ec98,null))['catch'](handleError(_0x59ec98,null));};exports[_0xc469('0x7f')]=function(_0x182441,_0x3b4656,_0x2b35a2){return db[_0xc469('0x6a')][_0xc469('0x61')]({'where':{'id':_0x182441[_0xc469('0x3a')][_0xc469('0x80')]},'attributes':['id'],'include':[{'model':db[_0xc469('0x81')],'as':_0xc469('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3b4656,null))[_0xc469('0x26')](function(_0x7cf7ba){var _0x42354d=_['map'](_0x7cf7ba,'id');var _0x380ef6=[];var _0x4aa064=[];var _0x59aba1=squel[_0xc469('0x82')]();_0x59aba1['field'](_0xc469('0x83'))[_0xc469('0x84')](_0xc469('0x85'),'tq')['join'](_0xc469('0x86'),'ut',_0xc469('0x87'))[_0xc469('0x40')](_0xc469('0x88'),_0x182441[_0xc469('0x4c')]['id']);for(var _0xc77c37=0x0;_0xc77c37<_0x7cf7ba[_0xc469('0x3d')];_0xc77c37+=0x1){let _0x346035=_0x7cf7ba[_0xc77c37];for(var _0xe54c37=0x0;_0xe54c37<_0x346035[_0xc469('0x6d')][_0xc469('0x3d')];_0xe54c37+=0x1){let _0xe38d61=_0x346035[_0xc469('0x6d')][_0xe54c37];var _0x319778=_0x59aba1[_0xc469('0x59')]();_0x319778[_0xc469('0x40')](_0xc469('0x89'),_0xe38d61['id']);_0x4aa064['push'](db[_0xc469('0x73')][_0xc469('0x3a')](_0x319778[_0xc469('0x8a')](),{'type':db[_0xc469('0x73')]['QueryTypes'][_0xc469('0x8b')]})['then'](function(_0x34f741){if(_0x34f741['length']===0x1){return _0xe38d61['id'];}else{var _0x28627b=_[_0xc469('0x8c')](_['map'](_0x34f741,_0xc469('0x8d')),function(_0x1e8f2e){return _[_0xc469('0x2d')](_0x42354d,_0x1e8f2e);});if(_0x28627b){return _0xe38d61['id'];}}}));}}return BPromise[_0xc469('0x8e')](_0x4aa064)['then'](function(_0x757cc){_0x380ef6=_(_0x380ef6)[_0xc469('0x8f')](_0x757cc)[_0xc469('0x90')]()[_0xc469('0x2c')]();return db[_0xc469('0x47')][_0xc469('0x4e')]({'where':{'id':_0x182441['params']['id']}})[_0xc469('0x26')](function(_0x56b6fd){return db[_0xc469('0x73')][_0xc469('0x74')](function(_0x17e8ae){return _0x56b6fd[_0xc469('0x7f')](_0x182441['query']['ids'],{'transaction':_0x17e8ae})[_0xc469('0x26')](function(){if(!_[_0xc469('0x91')](_0x380ef6)){return _0x56b6fd[_0xc469('0x92')](_0x380ef6,{'transaction':_0x17e8ae})[_0xc469('0x26')](function(){return db[_0xc469('0x93')][_0xc469('0x27')]({'where':{'VoiceQueueId':_0x182441['params']['id'],'UserId':_0x380ef6},'transaction':_0x17e8ae});});}})['then'](function(){_0x380ef6['forEach'](function(_0x5499a2){socket[_0xc469('0x94')](_0xc469('0x95'),{'UserId':_0x5499a2,'VoiceQueueId':_0x56b6fd['id']});});});});});});})[_0xc469('0x26')](respondWithStatusCode(_0x3b4656,null))['catch'](handleError(_0x3b4656,null));};exports['addAgents']=function(_0x5b6b17,_0x5c18b3,_0x1b2ed1){var _0x3166c8,_0x51bae7;return db[_0xc469('0x47')][_0xc469('0x4e')]({'where':{'id':_0x5b6b17[_0xc469('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c18b3,null))[_0xc469('0x26')](function(_0x37351c){if(_0x37351c){_0x51bae7=_0x37351c;return _0x37351c['addAgents'](_0x5b6b17[_0xc469('0x50')]['ids'],_[_0xc469('0x5a')](_0x5b6b17[_0xc469('0x50')],[_0xc469('0x80'),'id'])||{})[_0xc469('0x96')](function(_0x2f3cd4){for(var _0x257d82=0x0;_0x257d82<_0x5b6b17[_0xc469('0x50')][_0xc469('0x80')][_0xc469('0x3d')];_0x257d82+=0x1){socket[_0xc469('0x94')]('userVoiceQueue:save',{'UserId':Number(_0x5b6b17[_0xc469('0x50')]['ids'][_0x257d82]),'VoiceQueueId':Number(_0x5b6b17[_0xc469('0x4c')]['id'])});}return _0x2f3cd4;});}})[_0xc469('0x26')](function(_0x32c114){_0x3166c8=_0x32c114||[];if(_0x51bae7){return db['User'][_0xc469('0x61')]({'where':{'id':_0x5b6b17[_0xc469('0x50')][_0xc469('0x80')]},'attributes':['id',_0xc469('0x2f'),_0xc469('0x6e'),_0xc469('0x6f'),_0xc469('0x7b')],'raw':!![]});}})[_0xc469('0x26')](function(_0x54b5bf){if(!_['isEmpty'](_0x54b5bf)){var _0x1d78b3=[];for(var _0x24f05b=0x0;_0x24f05b<_0x54b5bf[_0xc469('0x3d')];_0x24f05b++){if(_0x54b5bf[_0x24f05b][_0xc469('0x6e')]){_0x1d78b3[_0xc469('0x97')](db[_0xc469('0x93')]['upsert']({'membername':_0x54b5bf[_0x24f05b]['name'],'UserId':_0x54b5bf[_0x24f05b]['id'],'queue_name':_0x51bae7[_0xc469('0x2f')],'VoiceQueueId':_0x51bae7['id'],'interface':_[_0xc469('0x7a')](_0x54b5bf[_0x24f05b][_0xc469('0x7b')])?util[_0xc469('0x7c')](_0xc469('0x7d'),_0x54b5bf[_0x24f05b][_0xc469('0x2f')]):_0x54b5bf[_0x24f05b][_0xc469('0x7b')],'paused':_0x54b5bf[_0x24f05b]['voicePause']||![],'penalty':_0x5b6b17[_0xc469('0x50')]['penalty']||0x0}));}}return BPromise['all'](_0x1d78b3);}})[_0xc469('0x26')](function(){return _0x3166c8;})[_0xc469('0x26')](respondWithResult(_0x5c18b3,null))[_0xc469('0x4b')](handleError(_0x5c18b3,null));};exports['removeAgents']=function(_0x3a9163,_0x3b1ff1,_0x408e50){return db[_0xc469('0x47')][_0xc469('0x4e')]({'where':{'id':_0x3a9163['params']['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x3b1ff1,null))[_0xc469('0x26')](function(_0x23b056){if(_0x23b056){return _0x23b056['removeAgents'](_0x3a9163[_0xc469('0x3a')][_0xc469('0x80')])['then'](function(){if(_['isArray'](_0x3a9163[_0xc469('0x3a')][_0xc469('0x80')])){for(var _0x4ab95e=0x0;_0x4ab95e<_0x3a9163[_0xc469('0x3a')][_0xc469('0x80')]['length'];_0x4ab95e+=0x1){socket[_0xc469('0x94')](_0xc469('0x95'),{'UserId':Number(_0x3a9163['query'][_0xc469('0x80')][_0x4ab95e]),'VoiceQueueId':Number(_0x3a9163[_0xc469('0x4c')]['id'])});}}else{socket['emit'](_0xc469('0x95'),{'UserId':Number(_0x3a9163[_0xc469('0x3a')][_0xc469('0x80')]),'VoiceQueueId':Number(_0x3a9163['params']['id'])});}});}})[_0xc469('0x26')](function(_0x25881e){return db[_0xc469('0x93')][_0xc469('0x27')]({'where':{'VoiceQueueId':_0x3a9163[_0xc469('0x4c')]['id'],'UserId':_0x3a9163[_0xc469('0x3a')][_0xc469('0x80')]}})[_0xc469('0x26')](function(){return _0x25881e;});})[_0xc469('0x26')](respondWithStatusCode(_0x3b1ff1,null))[_0xc469('0x4b')](handleError(_0x3b1ff1,null));};exports[_0xc469('0x98')]=function(_0x1f5e54,_0xc859ec,_0x4fe4bb){var _0xe4cd73={};var _0x13d739={};var _0x17dcc3;var _0x24c977;return db[_0xc469('0x47')][_0xc469('0x5e')]({'where':{'id':_0x1f5e54[_0xc469('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc859ec,null))[_0xc469('0x26')](function(_0x3170ce){if(_0x3170ce){_0x17dcc3=_0x3170ce;_0x13d739[_0xc469('0x37')]=_[_0xc469('0x38')](db[_0xc469('0x81')][_0xc469('0x4d')]);_0x13d739[_0xc469('0x3a')]=_[_0xc469('0x38')](_0x1f5e54['query']);_0x13d739[_0xc469('0x41')]=_['intersection'](_0x13d739[_0xc469('0x37')],_0x13d739[_0xc469('0x3a')]);_0xe4cd73[_0xc469('0x3c')]=_['intersection'](_0x13d739['model'],qs[_0xc469('0x3b')](_0x1f5e54['query'][_0xc469('0x3b')]));_0xe4cd73[_0xc469('0x3c')]=_0xe4cd73['attributes'][_0xc469('0x3d')]?_0xe4cd73[_0xc469('0x3c')]:_0x13d739[_0xc469('0x37')];_0xe4cd73['order']=qs[_0xc469('0x3f')](_0x1f5e54['query'][_0xc469('0x3f')]);_0xe4cd73[_0xc469('0x40')]=qs[_0xc469('0x41')](_[_0xc469('0x42')](_0x1f5e54[_0xc469('0x3a')],_0x13d739[_0xc469('0x41')]));if(_0x1f5e54[_0xc469('0x3a')][_0xc469('0x43')]){_0xe4cd73['where']=_[_0xc469('0x44')](_0xe4cd73['where'],{'$or':_[_0xc469('0x2b')](_0xe4cd73[_0xc469('0x3c')],function(_0x55353d){var _0x1127df={};_0x1127df[_0x55353d]={'$like':'%'+_0x1f5e54[_0xc469('0x3a')][_0xc469('0x43')]+'%'};return _0x1127df;})});}_0xe4cd73=_['merge']({},_0xe4cd73,_0x1f5e54[_0xc469('0x46')]);return _0x17dcc3[_0xc469('0x98')](_0xe4cd73);}})[_0xc469('0x26')](function(_0x12fb91){if(_0x12fb91){_0x24c977=_0x12fb91[_0xc469('0x3d')];if(!_0x1f5e54[_0xc469('0x3a')][_0xc469('0x60')](_0xc469('0x64'))){_0xe4cd73['limit']=qs[_0xc469('0x1f')](_0x1f5e54[_0xc469('0x3a')][_0xc469('0x1f')]);_0xe4cd73[_0xc469('0x1d')]=qs[_0xc469('0x1d')](_0x1f5e54[_0xc469('0x3a')][_0xc469('0x1d')]);}return _0x17dcc3['getAgents'](_0xe4cd73);}})[_0xc469('0x26')](function(_0x18a1a6){if(_0x18a1a6){return _0x18a1a6?{'count':_0x24c977,'rows':_0x18a1a6}:null;}})['then'](respondWithResult(_0xc859ec,null))['catch'](handleError(_0xc859ec,null));};exports['getMembers']=function(_0x2620ae,_0x4bb16b,_0x3d8e54){var _0x153636={};var _0x4536a1={};var _0x8be47b;var _0x581fc4;return db[_0xc469('0x47')][_0xc469('0x5e')]({'where':{'id':_0x2620ae['params']['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x4bb16b,null))['then'](function(_0x3a733c){if(_0x3a733c){_0x8be47b=_0x3a733c;_0x4536a1[_0xc469('0x37')]=_['keys'](db[_0xc469('0x93')][_0xc469('0x4d')]);_0x4536a1[_0xc469('0x3a')]=_[_0xc469('0x38')](_0x2620ae['query']);_0x4536a1[_0xc469('0x41')]=_[_0xc469('0x39')](_0x4536a1[_0xc469('0x37')],_0x4536a1[_0xc469('0x3a')]);_0x153636[_0xc469('0x3c')]=_[_0xc469('0x39')](_0x4536a1[_0xc469('0x37')],qs['fields'](_0x2620ae[_0xc469('0x3a')][_0xc469('0x3b')]));_0x153636[_0xc469('0x3c')]=_0x153636[_0xc469('0x3c')][_0xc469('0x3d')]?_0x153636[_0xc469('0x3c')]:_0x4536a1[_0xc469('0x37')];_0x153636[_0xc469('0x3e')]=qs[_0xc469('0x3f')](_0x2620ae[_0xc469('0x3a')][_0xc469('0x3f')]);_0x153636[_0xc469('0x40')]=qs[_0xc469('0x41')](_[_0xc469('0x42')](_0x2620ae[_0xc469('0x3a')],_0x4536a1[_0xc469('0x41')]));if(_0x2620ae[_0xc469('0x3a')][_0xc469('0x43')]){_0x153636[_0xc469('0x40')]=_['merge'](_0x153636['where'],{'$or':_[_0xc469('0x2b')](_0x153636[_0xc469('0x3c')],function(_0x595331){var _0xa7041f={};_0xa7041f[_0x595331]={'$like':'%'+_0x2620ae[_0xc469('0x3a')][_0xc469('0x43')]+'%'};return _0xa7041f;})});}_0x153636=_['merge']({},_0x153636,_0x2620ae['options']);return _0x8be47b['getMembers'](_0x153636);}})[_0xc469('0x26')](function(_0x1cf3d7){if(_0x1cf3d7){_0x581fc4=_0x1cf3d7[_0xc469('0x3d')];if(!_0x2620ae[_0xc469('0x3a')]['hasOwnProperty'](_0xc469('0x64'))){_0x153636[_0xc469('0x1f')]=qs[_0xc469('0x1f')](_0x2620ae[_0xc469('0x3a')][_0xc469('0x1f')]);_0x153636[_0xc469('0x1d')]=qs[_0xc469('0x1d')](_0x2620ae[_0xc469('0x3a')][_0xc469('0x1d')]);}return _0x8be47b['getMembers'](_0x153636);}})[_0xc469('0x26')](function(_0x2afde0){return _0x2afde0?{'count':_0x581fc4,'rows':_0x2afde0}:null;})[_0xc469('0x26')](respondWithResult(_0x4bb16b,null))['catch'](handleError(_0x4bb16b,null));};exports[_0xc469('0x99')]=function(_0x4b9a62,_0x4ac3dd,_0x57d8bf){var _0x578faa={};var _0x122b22={};var _0x41454e;var _0x382b5b;return db['VoiceQueue'][_0xc469('0x5e')]({'where':{'id':_0x4b9a62['params']['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x4ac3dd,null))[_0xc469('0x26')](function(_0xae852e){if(_0xae852e){_0x41454e=_0xae852e;_0x122b22['model']=_['keys'](db['CmList']['rawAttributes']);_0x122b22[_0xc469('0x3a')]=_[_0xc469('0x38')](_0x4b9a62[_0xc469('0x3a')]);_0x122b22[_0xc469('0x41')]=_['intersection'](_0x122b22['model'],_0x122b22[_0xc469('0x3a')]);_0x578faa[_0xc469('0x3c')]=_['intersection'](_0x122b22[_0xc469('0x37')],qs[_0xc469('0x3b')](_0x4b9a62[_0xc469('0x3a')][_0xc469('0x3b')]));_0x578faa[_0xc469('0x3c')]=_0x578faa[_0xc469('0x3c')][_0xc469('0x3d')]?_0x578faa['attributes']:_0x122b22['model'];_0x578faa[_0xc469('0x3e')]=qs[_0xc469('0x3f')](_0x4b9a62['query']['sort']);_0x578faa['where']=qs[_0xc469('0x41')](_[_0xc469('0x42')](_0x4b9a62[_0xc469('0x3a')],_0x122b22[_0xc469('0x41')]));if(_0x4b9a62[_0xc469('0x3a')][_0xc469('0x43')]){_0x578faa[_0xc469('0x40')]=_[_0xc469('0x44')](_0x578faa['where'],{'$or':_['map'](_0x578faa['attributes'],function(_0x188fad){var _0x33d091={};_0x33d091[_0x188fad]={'$like':'%'+_0x4b9a62[_0xc469('0x3a')][_0xc469('0x43')]+'%'};return _0x33d091;})});}_0x578faa=_[_0xc469('0x44')]({},_0x578faa,_0x4b9a62[_0xc469('0x46')]);return _0x41454e[_0xc469('0x99')](_0x578faa);}})[_0xc469('0x26')](function(_0x3e476f){if(_0x3e476f){_0x382b5b=_0x3e476f[_0xc469('0x3d')];if(!_0x4b9a62[_0xc469('0x3a')][_0xc469('0x60')](_0xc469('0x64'))){_0x578faa[_0xc469('0x1f')]=qs[_0xc469('0x1f')](_0x4b9a62[_0xc469('0x3a')][_0xc469('0x1f')]);_0x578faa[_0xc469('0x1d')]=qs[_0xc469('0x1d')](_0x4b9a62[_0xc469('0x3a')][_0xc469('0x1d')]);}return _0x41454e[_0xc469('0x99')](_0x578faa);}})[_0xc469('0x26')](function(_0x39bca1){if(_0x39bca1){return _0x39bca1?{'count':_0x382b5b,'rows':_0x39bca1}:null;}})[_0xc469('0x26')](respondWithResult(_0x4ac3dd,null))[_0xc469('0x4b')](handleError(_0x4ac3dd,null));};exports[_0xc469('0x9a')]=function(_0x26ad97,_0x398608,_0x2c0f5e){var _0x478cb3,_0x236527;return db[_0xc469('0x47')][_0xc469('0x4e')]({'where':{'id':_0x26ad97['params']['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x398608,null))[_0xc469('0x26')](function(_0x540a5b){if(_0x540a5b){_0x236527=_0x540a5b;return _0x540a5b[_0xc469('0x9a')](_0x26ad97[_0xc469('0x50')][_0xc469('0x80')],_[_0xc469('0x5a')](_0x26ad97[_0xc469('0x50')],[_0xc469('0x80'),'id'])||{});}return null;})[_0xc469('0x96')](function(_0x367420){var _0x59871e;_0x478cb3=_0x367420||[];var _0xc92227=[];if(_0x367420){for(var _0x23e71b=0x0;_0x23e71b<_0x367420[_0xc469('0x3d')];_0x23e71b+=0x1){var _0x1d2f5e=_0x367420[_0x23e71b][_0xc469('0x54')]({'plain':!![]});_0x236527[_0xc469('0x9b')]=_0x26ad97['body'][_0xc469('0x9b')]?_0x26ad97[_0xc469('0x50')][_0xc469('0x9b')]:_0x236527['dialCheckDuplicateType'];switch(_0x236527[_0xc469('0x9b')]){case _0xc469('0x9c'):_0x59871e=squel['insert']()[_0xc469('0x9d')](_0xc469('0x9e'))[_0xc469('0x9f')]([_0xc469('0xa0'),'scheduledAt',_0xc469('0xa1'),'ListId',_0xc469('0x65'),_0xc469('0x5b'),_0xc469('0x5c')],squel[_0xc469('0x82')]()[_0xc469('0xa2')](_0xc469('0xa0'),_0xc469('0xa0'))[_0xc469('0xa2')](_0xc469('0xa3'),_0xc469('0xa4'))[_0xc469('0xa2')]('id',_0xc469('0xa1'))[_0xc469('0xa2')](_0x1d2f5e[_0xc469('0xa5')][_0xc469('0x8a')](),_0xc469('0xa6'))[_0xc469('0xa2')](_0x26ad97[_0xc469('0x4c')]['id']['toString'](),_0xc469('0x65'))['field']('NOW()',_0xc469('0x5b'))[_0xc469('0xa2')](_0xc469('0xa3'),'updatedAt')['from'](_0xc469('0xa7'))[_0xc469('0x40')](_0xc469('0xa8'))[_0xc469('0x40')]('ListId\x20=\x20?',_0x1d2f5e['CmListId'][_0xc469('0x8a')]())['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc469('0xa2')](_0xc469('0xa9'))[_0xc469('0x84')](_0xc469('0xaa'))[_0xc469('0x40')]('VoiceQueueId\x20=\x20?',_0x26ad97[_0xc469('0x4c')]['id'][_0xc469('0x8a')]()))['where'](_0xc469('0xab'),squel['select']()[_0xc469('0xa2')](_0xc469('0xac'))['from']('cm_hopper')['where'](_0xc469('0x88'),_0x26ad97[_0xc469('0x4c')]['id'][_0xc469('0x8a')]())))[_0xc469('0x8a')]();break;case _0xc469('0xad'):_0x59871e=squel['insert']()[_0xc469('0x9d')](_0xc469('0x9e'))[_0xc469('0x9f')]([_0xc469('0xa0'),_0xc469('0xa4'),_0xc469('0xa1'),'ListId',_0xc469('0x65'),_0xc469('0x5b'),_0xc469('0x5c')],squel[_0xc469('0x82')]()[_0xc469('0xa2')](_0xc469('0xa0'),_0xc469('0xa0'))[_0xc469('0xa2')](_0xc469('0xa3'),_0xc469('0xa4'))[_0xc469('0xa2')]('id',_0xc469('0xa1'))[_0xc469('0xa2')](_0x1d2f5e[_0xc469('0xa5')][_0xc469('0x8a')](),'ListId')[_0xc469('0xa2')](_0x26ad97['params']['id']['toString'](),_0xc469('0x65'))[_0xc469('0xa2')](_0xc469('0xa3'),_0xc469('0x5b'))[_0xc469('0xa2')](_0xc469('0xa3'),_0xc469('0x5c'))[_0xc469('0x84')](_0xc469('0xa7'))[_0xc469('0x40')](_0xc469('0xa8'))['where']('ListId\x20=\x20?',_0x1d2f5e[_0xc469('0xa5')][_0xc469('0x8a')]())[_0xc469('0x40')](_0xc469('0xae'))[_0xc469('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc469('0x82')]()[_0xc469('0xa2')](_0xc469('0xac'))['from']('cm_hopper')[_0xc469('0x40')](_0xc469('0x88'),_0x26ad97[_0xc469('0x4c')]['id'][_0xc469('0x8a')]())))[_0xc469('0x8a')]();break;default:_0x59871e=squel[_0xc469('0xaf')]()[_0xc469('0x9d')](_0xc469('0x9e'))[_0xc469('0x9f')]([_0xc469('0xa0'),_0xc469('0xa4'),'ContactId','ListId',_0xc469('0x65'),_0xc469('0x5b'),'updatedAt'],squel['select']()[_0xc469('0xa2')](_0xc469('0xa0'),'phone')['field'](_0xc469('0xa3'),_0xc469('0xa4'))[_0xc469('0xa2')]('id',_0xc469('0xa1'))[_0xc469('0xa2')](_0x1d2f5e['CmListId']['toString'](),'ListId')['field'](_0x26ad97[_0xc469('0x4c')]['id'][_0xc469('0x8a')](),'VoiceQueueId')[_0xc469('0xa2')]('NOW()',_0xc469('0x5b'))[_0xc469('0xa2')](_0xc469('0xa3'),_0xc469('0x5c'))[_0xc469('0x84')](_0xc469('0xa7'))[_0xc469('0x40')](_0xc469('0xa8'))[_0xc469('0x40')](_0xc469('0xb0'),_0x1d2f5e[_0xc469('0xa5')][_0xc469('0x8a')]())[_0xc469('0x40')](_0xc469('0xae')))[_0xc469('0x8a')]();}_0xc92227['push'](db['sequelize']['query'](_0x59871e));}return BPromise[_0xc469('0x8e')](_0xc92227);}})[_0xc469('0x26')](function(){return _0x478cb3;})[_0xc469('0x26')](respondWithResult(_0x398608,null))[_0xc469('0x4b')](handleError(_0x398608,null));};exports[_0xc469('0xb1')]=function(_0x4fd259,_0x59a03c,_0x581566){return db[_0xc469('0x47')][_0xc469('0x4e')]({'where':{'id':_0x4fd259[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x59a03c,null))['then'](function(_0x30b2ef){if(_0x30b2ef){return _0x30b2ef[_0xc469('0xb1')](_0x4fd259[_0xc469('0x3a')][_0xc469('0x80')]);}})[_0xc469('0x26')](function(_0x554a34){if(_0x554a34){return db['CmHopper']['destroy']({'where':{'ListId':_0x4fd259[_0xc469('0x3a')][_0xc469('0x80')],'VoiceQueueId':_0x4fd259[_0xc469('0x4c')]['id']}})['then'](function(){return _0x554a34;});}})[_0xc469('0x26')](respondWithStatusCode(_0x59a03c,null))[_0xc469('0x4b')](handleError(_0x59a03c,null));};exports[_0xc469('0xb2')]=function(_0x23b1ab,_0x186e03,_0x3dbb06){var _0x5b32da={};var _0x475908={};var _0x1ae0a5;var _0x53c3ed;return db[_0xc469('0x47')]['findOne']({'where':{'id':_0x23b1ab[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x186e03,null))['then'](function(_0x2566ac){if(_0x2566ac){_0x1ae0a5=_0x2566ac;_0x475908['model']=_[_0xc469('0x38')](db[_0xc469('0xb3')][_0xc469('0x4d')]);_0x475908[_0xc469('0x3a')]=_[_0xc469('0x38')](_0x23b1ab[_0xc469('0x3a')]);_0x475908[_0xc469('0x41')]=_['intersection'](_0x475908[_0xc469('0x37')],_0x475908[_0xc469('0x3a')]);_0x5b32da[_0xc469('0x3c')]=_['intersection'](_0x475908[_0xc469('0x37')],qs[_0xc469('0x3b')](_0x23b1ab[_0xc469('0x3a')][_0xc469('0x3b')]));_0x5b32da[_0xc469('0x3c')]=_0x5b32da['attributes'][_0xc469('0x3d')]?_0x5b32da['attributes']:_0x475908[_0xc469('0x37')];_0x5b32da[_0xc469('0x3e')]=qs['sort'](_0x23b1ab[_0xc469('0x3a')][_0xc469('0x3f')]);_0x5b32da[_0xc469('0x40')]=qs[_0xc469('0x41')](_[_0xc469('0x42')](_0x23b1ab[_0xc469('0x3a')],_0x475908['filters']));if(_0x23b1ab[_0xc469('0x3a')][_0xc469('0x43')]){_0x5b32da[_0xc469('0x40')]=_['merge'](_0x5b32da[_0xc469('0x40')],{'$or':_[_0xc469('0x2b')](_0x5b32da[_0xc469('0x3c')],function(_0x29b2bd){var _0x45e0c6={};_0x45e0c6[_0x29b2bd]={'$like':'%'+_0x23b1ab[_0xc469('0x3a')][_0xc469('0x43')]+'%'};return _0x45e0c6;})});}_0x5b32da=_['merge']({},_0x5b32da,_0x23b1ab['options']);return _0x1ae0a5[_0xc469('0xb2')](_0x5b32da);}})['then'](function(_0x4abac0){if(_0x4abac0){_0x53c3ed=_0x4abac0[_0xc469('0x3d')];if(!_0x23b1ab[_0xc469('0x3a')][_0xc469('0x60')](_0xc469('0x64'))){_0x5b32da[_0xc469('0x1f')]=qs[_0xc469('0x1f')](_0x23b1ab[_0xc469('0x3a')][_0xc469('0x1f')]);_0x5b32da[_0xc469('0x1d')]=qs[_0xc469('0x1d')](_0x23b1ab[_0xc469('0x3a')][_0xc469('0x1d')]);}return _0x1ae0a5[_0xc469('0xb2')](_0x5b32da);}})[_0xc469('0x26')](function(_0x2ae819){if(_0x2ae819){return _0x2ae819?{'count':_0x53c3ed,'rows':_0x2ae819}:null;}})[_0xc469('0x26')](respondWithResult(_0x186e03,null))[_0xc469('0x4b')](handleError(_0x186e03,null));};exports[_0xc469('0xb4')]=function(_0x54f528,_0x3754a8,_0x4c9b11){var _0x39cf89,_0x5f5cc5;return db[_0xc469('0x47')][_0xc469('0x4e')]({'where':{'id':_0x54f528[_0xc469('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3754a8,null))['then'](function(_0x2b77e1){if(_0x2b77e1){_0x5f5cc5=_0x2b77e1;return _0x2b77e1['addBlackLists'](_0x54f528['body'][_0xc469('0x80')],_[_0xc469('0x5a')](_0x54f528[_0xc469('0x50')],[_0xc469('0x80'),'id'])||{});}return null;})[_0xc469('0x96')](function(_0x5a6803){var _0x2fefc5;_0x39cf89=_0x5a6803||[];var _0x5d5a2f=[];if(_0x5a6803){for(var _0xd36d7f=0x0;_0xd36d7f<_0x5a6803[_0xc469('0x3d')];_0xd36d7f+=0x1){var _0x4c8d43=_0x5a6803[_0xd36d7f][_0xc469('0x54')]({'plain':!![]});_0x2fefc5=squel['insert']()[_0xc469('0x9d')](_0xc469('0xb5'))[_0xc469('0x9f')]([_0xc469('0xa0'),'ContactId',_0xc469('0xa6'),_0xc469('0x65'),_0xc469('0x5b'),'updatedAt'],squel[_0xc469('0x82')]()['field'](_0xc469('0xa0'),_0xc469('0xa0'))[_0xc469('0xa2')]('id','ContactId')[_0xc469('0xa2')](_0x4c8d43[_0xc469('0xa5')][_0xc469('0x8a')](),_0xc469('0xa6'))[_0xc469('0xa2')](_0x54f528[_0xc469('0x4c')]['id'][_0xc469('0x8a')](),_0xc469('0x65'))[_0xc469('0xa2')]('NOW()','createdAt')[_0xc469('0xa2')](_0xc469('0xa3'),_0xc469('0x5c'))[_0xc469('0x84')]('cm_contacts')[_0xc469('0x40')](_0xc469('0xa8'))[_0xc469('0x40')](_0xc469('0xb0'),_0x4c8d43[_0xc469('0xa5')]['toString']())[_0xc469('0x40')](_0xc469('0xae')))['toString']();_0x5d5a2f['push'](db['sequelize'][_0xc469('0x3a')](_0x2fefc5));}return BPromise[_0xc469('0x8e')](_0x5d5a2f);}})[_0xc469('0x26')](function(){return _0x39cf89;})[_0xc469('0x26')](respondWithResult(_0x3754a8,null))[_0xc469('0x4b')](handleError(_0x3754a8,null));};exports[_0xc469('0xb6')]=function(_0x57d597,_0x40663f,_0x469f49){return db[_0xc469('0x47')][_0xc469('0x4e')]({'where':{'id':_0x57d597[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](handleEntityNotFound(_0x40663f,null))['then'](function(_0x20ebfe){if(_0x20ebfe){return _0x20ebfe[_0xc469('0xb6')](_0x57d597['query'][_0xc469('0x80')]);}})['then'](function(_0x43d284){if(_0x43d284){return db[_0xc469('0x68')]['destroy']({'where':{'ListId':_0x57d597[_0xc469('0x3a')][_0xc469('0x80')],'VoiceQueueId':_0x57d597[_0xc469('0x4c')]['id']}})[_0xc469('0x26')](function(){return _0x43d284;});}})['then'](respondWithStatusCode(_0x40663f,null))[_0xc469('0x4b')](handleError(_0x40663f,null));}; \ No newline at end of file +var _0xa3dc=['pick','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopper','order','getHopperHistories','findOne','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','User','online','interface','Agents','forEach','penalty','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','ids','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','TeamId','all','compact','transaction','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','spread','push','removeAgents','getAgents','getMembers','CmList','getLists','addLists','omit','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','ignore','value','includes','type','find','name','UserProfileResource','error','VoiceQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x4cc97a,_0x3665fc){var _0x941ddd=function(_0x454b9b){while(--_0x454b9b){_0x4cc97a['push'](_0x4cc97a['shift']());}};_0x941ddd(++_0x3665fc);}(_0xa3dc,0x128));var _0xca3d=function(_0x31888b,_0x13aa56){_0x31888b=_0x31888b-0x0;var _0x3051fd=_0xa3dc[_0x31888b];return _0x3051fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca3d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca3d('0x1'));var rp=require(_0xca3d('0x2'));var moment=require(_0xca3d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca3d('0x4'));var path=require(_0xca3d('0x5'));var sox=require(_0xca3d('0x6'));var csv=require('to-csv');var ejs=require(_0xca3d('0x7'));var fs=require('fs');var fs_extra=require(_0xca3d('0x8'));var _=require(_0xca3d('0x9'));var squel=require(_0xca3d('0xa'));var crypto=require(_0xca3d('0xb'));var jsforce=require(_0xca3d('0xc'));var deskjs=require(_0xca3d('0xd'));var toCsv=require(_0xca3d('0xe'));var querystring=require(_0xca3d('0xf'));var Papa=require(_0xca3d('0x10'));var Redis=require(_0xca3d('0x11'));var authService=require(_0xca3d('0x12'));var qs=require(_0xca3d('0x13'));var as=require(_0xca3d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xca3d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xca3d('0x16'));var db=require('../../mysqldb')['db'];config[_0xca3d('0x17')]=_[_0xca3d('0x18')](config[_0xca3d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xca3d('0x19'))(new Redis(config['redis']));require(_0xca3d('0x1a'))[_0xca3d('0x1b')](socket);function respondWithStatusCode(_0x6be114,_0x5b5ee3){_0x5b5ee3=_0x5b5ee3||0xcc;return function(_0x19178c){if(_0x19178c){return _0x6be114[_0xca3d('0x1c')](_0x5b5ee3);}return _0x6be114['status'](_0x5b5ee3)[_0xca3d('0x1d')]();};}function respondWithResult(_0x36ffdf,_0x3b3ca5){_0x3b3ca5=_0x3b3ca5||0xc8;return function(_0x53c74c){if(_0x53c74c){return _0x36ffdf[_0xca3d('0x1e')](_0x3b3ca5)[_0xca3d('0x1f')](_0x53c74c);}};}function respondWithFilteredResult(_0x292f36,_0x46d91c){return function(_0x2bd39c){if(_0x2bd39c){var _0x5a4cbd=typeof _0x46d91c[_0xca3d('0x20')]==='undefined'&&typeof _0x46d91c[_0xca3d('0x21')]===_0xca3d('0x22');var _0x596e39=_0x2bd39c[_0xca3d('0x23')];var _0x1af110=_0x5a4cbd?0x0:_0x46d91c['offset'];var _0x3d69d4=_0x5a4cbd?_0x2bd39c[_0xca3d('0x23')]:_0x46d91c['offset']+_0x46d91c['limit'];var _0x11ba88;if(_0x3d69d4>=_0x596e39){_0x3d69d4=_0x596e39;_0x11ba88=0xc8;}else{_0x11ba88=0xce;}_0x292f36['status'](_0x11ba88);return _0x292f36[_0xca3d('0x24')](_0xca3d('0x25'),_0x1af110+'-'+_0x3d69d4+'/'+_0x596e39)[_0xca3d('0x1f')](_0x2bd39c);}return null;};}function patchUpdates(_0x20b85a){return function(_0x5d3ba6){try{jsonpatch[_0xca3d('0x26')](_0x5d3ba6,_0x20b85a,!![]);}catch(_0x2e6ab4){return BPromise[_0xca3d('0x27')](_0x2e6ab4);}return _0x5d3ba6[_0xca3d('0x28')]();};}function saveUpdates(_0x2bf9e7,_0x337e78){return function(_0x1670a9){if(_0x1670a9){return _0x1670a9[_0xca3d('0x29')](_0x2bf9e7)[_0xca3d('0x2a')](function(_0x57f76d){return _0x57f76d;});}return null;};}function removeEntity(_0x5a2567,_0x10110c){return function(_0x4c57e9){if(_0x4c57e9){return _0x4c57e9[_0xca3d('0x2b')]()[_0xca3d('0x2a')](function(){var _0x4d265b=_0x4c57e9[_0xca3d('0x2c')]({'plain':!![]});var _0x18e1bc=[{'name':_0xca3d('0x2d'),'value':'inbound','ignore':![]},{'name':_0xca3d('0x2e'),'value':_0xca3d('0x2f'),'ignore':![]}];var _0x3c77c5=_(_0x18e1bc)['filter'](_0xca3d('0x30'))['map'](_0xca3d('0x31'))[_0xca3d('0x31')]();if(_[_0xca3d('0x32')](_0x3c77c5,_0x4d265b[_0xca3d('0x33')])){return;}var _0x556002=_[_0xca3d('0x34')](_0x18e1bc,[_0xca3d('0x31'),_0x4d265b['type']])[_0xca3d('0x35')];return db[_0xca3d('0x36')][_0xca3d('0x2b')]({'where':{'type':_0x556002,'resourceId':_0x4d265b['id']}})[_0xca3d('0x2a')](function(){return _0x4c57e9;});})[_0xca3d('0x2a')](function(){_0x5a2567[_0xca3d('0x1e')](0xcc)[_0xca3d('0x1d')]();});}};}function handleEntityNotFound(_0x2ff1f0,_0x18523f){return function(_0x815d60){if(!_0x815d60){_0x2ff1f0[_0xca3d('0x1c')](0x194);}return _0x815d60;};}function handleError(_0x34140b,_0x145f82){_0x145f82=_0x145f82||0x1f4;return function(_0x98df16){logger[_0xca3d('0x37')](_0x98df16['stack']);if(_0x98df16[_0xca3d('0x35')]){delete _0x98df16[_0xca3d('0x35')];}_0x34140b['status'](_0x145f82)['send'](_0x98df16);};}exports['index']=function(_0x3774ad,_0x55ce6c){var _0x3e40b1={},_0xcf5ef8={},_0x29db71={'count':0x0,'rows':[]};var _0xe1aea2=_['map'](db[_0xca3d('0x38')]['rawAttributes'],function(_0x575c2e){return{'name':_0x575c2e[_0xca3d('0x39')],'type':_0x575c2e[_0xca3d('0x33')][_0xca3d('0x3a')]};});_0xcf5ef8[_0xca3d('0x3b')]=_['map'](_0xe1aea2,'name');_0xcf5ef8[_0xca3d('0x3c')]=_['keys'](_0x3774ad['query']);_0xcf5ef8[_0xca3d('0x3d')]=_[_0xca3d('0x3e')](_0xcf5ef8[_0xca3d('0x3b')],_0xcf5ef8['query']);_0x3e40b1[_0xca3d('0x3f')]=_[_0xca3d('0x3e')](_0xcf5ef8['model'],qs[_0xca3d('0x40')](_0x3774ad[_0xca3d('0x3c')][_0xca3d('0x40')]));_0x3e40b1[_0xca3d('0x3f')]=_0x3e40b1['attributes'][_0xca3d('0x41')]?_0x3e40b1[_0xca3d('0x3f')]:_0xcf5ef8[_0xca3d('0x3b')];if(!_0x3774ad[_0xca3d('0x3c')][_0xca3d('0x42')](_0xca3d('0x43'))){_0x3e40b1[_0xca3d('0x21')]=qs[_0xca3d('0x21')](_0x3774ad['query']['limit']);_0x3e40b1[_0xca3d('0x20')]=qs['offset'](_0x3774ad[_0xca3d('0x3c')][_0xca3d('0x20')]);}_0x3e40b1['order']=qs[_0xca3d('0x44')](_0x3774ad['query'][_0xca3d('0x44')]);_0x3e40b1[_0xca3d('0x45')]=qs[_0xca3d('0x3d')](_[_0xca3d('0x46')](_0x3774ad[_0xca3d('0x3c')],_0xcf5ef8[_0xca3d('0x3d')]),_0xe1aea2);if(_0x3774ad['query'][_0xca3d('0x47')]){_0x3e40b1[_0xca3d('0x45')]=_['merge'](_0x3e40b1[_0xca3d('0x45')],{'$or':_[_0xca3d('0x48')](_0xe1aea2,function(_0x3c53d9){if(_0x3c53d9[_0xca3d('0x33')]!=='VIRTUAL'){var _0x4362b4={};_0x4362b4[_0x3c53d9[_0xca3d('0x35')]]={'$like':'%'+_0x3774ad[_0xca3d('0x3c')][_0xca3d('0x47')]+'%'};return _0x4362b4;}})});}_0x3e40b1=_[_0xca3d('0x49')]({},_0x3e40b1,_0x3774ad[_0xca3d('0x4a')]);var _0x43f2c3={'where':_0x3e40b1[_0xca3d('0x45')]};return db[_0xca3d('0x38')][_0xca3d('0x23')](_0x43f2c3)['then'](function(_0x4b633f){_0x29db71[_0xca3d('0x23')]=_0x4b633f;if(_0x3774ad[_0xca3d('0x3c')][_0xca3d('0x4b')]){_0x3e40b1[_0xca3d('0x4c')]=[{'all':!![]}];}return db[_0xca3d('0x38')][_0xca3d('0x4d')](_0x3e40b1);})[_0xca3d('0x2a')](function(_0x409f11){_0x29db71[_0xca3d('0x4e')]=_0x409f11;return _0x29db71;})[_0xca3d('0x2a')](respondWithFilteredResult(_0x55ce6c,_0x3e40b1))[_0xca3d('0x4f')](handleError(_0x55ce6c,null));};exports[_0xca3d('0x50')]=function(_0x118cfa,_0x5d087d){var _0x363095={'raw':![],'where':{'id':_0x118cfa[_0xca3d('0x51')]['id']}},_0x33993a={};_0x33993a['model']=_[_0xca3d('0x52')](db[_0xca3d('0x38')][_0xca3d('0x53')]);_0x33993a[_0xca3d('0x3c')]=_['keys'](_0x118cfa[_0xca3d('0x3c')]);_0x33993a[_0xca3d('0x3d')]=_[_0xca3d('0x3e')](_0x33993a['model'],_0x33993a['query']);_0x363095[_0xca3d('0x3f')]=_[_0xca3d('0x3e')](_0x33993a[_0xca3d('0x3b')],qs[_0xca3d('0x40')](_0x118cfa['query'][_0xca3d('0x40')]));_0x363095[_0xca3d('0x3f')]=_0x363095[_0xca3d('0x3f')][_0xca3d('0x41')]?_0x363095[_0xca3d('0x3f')]:_0x33993a[_0xca3d('0x3b')];if(_0x118cfa['query'][_0xca3d('0x4b')]){_0x363095[_0xca3d('0x4c')]=[{'all':!![]}];}_0x363095=_['merge']({},_0x363095,_0x118cfa['options']);return db[_0xca3d('0x38')]['find'](_0x363095)[_0xca3d('0x2a')](handleEntityNotFound(_0x5d087d,null))['then'](respondWithResult(_0x5d087d,null))[_0xca3d('0x4f')](handleError(_0x5d087d,null));};exports['create']=function(_0x4f86fb,_0x5229c7){return db[_0xca3d('0x38')][_0xca3d('0x54')](_0x4f86fb['body'],{})[_0xca3d('0x2a')](function(_0x37f117){var _0x4bfa63=_0x4f86fb[_0xca3d('0x55')][_0xca3d('0x2c')]({'plain':!![]});if(!_0x4bfa63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bfa63['role']===_0xca3d('0x55')){var _0x1ce689=_0x37f117['get']({'plain':!![]});var _0xe2b448=[{'name':_0xca3d('0x2d'),'value':_0xca3d('0x56')},{'name':'QueueCampaigns','value':_0xca3d('0x2f')}];var _0x3f4848=_[_0xca3d('0x34')](_0xe2b448,[_0xca3d('0x31'),_0x1ce689[_0xca3d('0x33')]])[_0xca3d('0x35')];return db[_0xca3d('0x57')][_0xca3d('0x34')]({'where':{'name':_0x3f4848,'userProfileId':_0x4bfa63[_0xca3d('0x58')]},'raw':!![]})['then'](function(_0x10bb5c){if(_0x10bb5c&&_0x10bb5c[_0xca3d('0x59')]===0x0){return db[_0xca3d('0x36')][_0xca3d('0x54')]({'name':_0x1ce689[_0xca3d('0x35')],'resourceId':_0x1ce689['id'],'type':_0x10bb5c[_0xca3d('0x35')],'sectionId':_0x10bb5c['id']},{})[_0xca3d('0x2a')](function(){return _0x37f117;});}else{return _0x37f117;}})[_0xca3d('0x4f')](function(_0x21e900){logger['error'](_0xca3d('0x5a'),_0x21e900);throw _0x21e900;});}return _0x37f117;})['then'](respondWithResult(_0x5229c7,0xc9))[_0xca3d('0x4f')](handleError(_0x5229c7,null));};exports['clone']=function(_0x2aaecd,_0x31519b){var _0x2ee0a8={'where':{'id':_0x2aaecd['params']['id']}},_0x3b25f2={};_0x3b25f2[_0xca3d('0x3b')]=_[_0xca3d('0x52')](db[_0xca3d('0x38')][_0xca3d('0x53')]);_0x2ee0a8[_0xca3d('0x3f')]=_[_0xca3d('0x3e')](_0x3b25f2[_0xca3d('0x3b')],qs[_0xca3d('0x40')](_0x2aaecd['query'][_0xca3d('0x40')]));_0x2ee0a8[_0xca3d('0x3f')]=_0x2ee0a8['attributes'][_0xca3d('0x41')]?_0x2ee0a8[_0xca3d('0x3f')]:_0x3b25f2[_0xca3d('0x3b')];if(_0x2aaecd['query'][_0xca3d('0x4b')]){_0x2ee0a8[_0xca3d('0x4c')]=[{'all':!![]}];}_0x2ee0a8=_['merge']({},_0x2ee0a8,_0x2aaecd[_0xca3d('0x4a')]);return db['VoiceQueue'][_0xca3d('0x34')](_0x2ee0a8)[_0xca3d('0x2a')](handleEntityNotFound(_0x31519b,null))[_0xca3d('0x2a')](function(_0xd8004b){if(_0xd8004b){var _0x1b19d4=_0xd8004b[_0xca3d('0x2c')]({'plain':!![]});_0x1b19d4=qs['omit'](_0x1b19d4,['id',_0xca3d('0x5b'),'updatedAt']);_0x2aaecd[_0xca3d('0x5c')]=_['omit'](_0x2aaecd['body'],['id',_0xca3d('0x5b'),_0xca3d('0x5d')]);return db[_0xca3d('0x38')][_0xca3d('0x54')](_[_0xca3d('0x49')](_0x1b19d4,_0x2aaecd[_0xca3d('0x5c')]),{'include':_0x2aaecd[_0xca3d('0x3c')][_0xca3d('0x4b')]?[{'all':!![]}]:undefined})[_0xca3d('0x2a')](function(_0x49a83c){var _0x466e94=_0x2aaecd[_0xca3d('0x55')][_0xca3d('0x2c')]({'plain':!![]});if(!_0x466e94)throw new Error(_0xca3d('0x5e'));if(_0x466e94[_0xca3d('0x5f')]==='user'){var _0x2d8d95=_0x49a83c['get']({'plain':!![]});var _0x182c29=[{'name':_0xca3d('0x2d'),'value':'inbound'},{'name':_0xca3d('0x2e'),'value':_0xca3d('0x2f')}];var _0x56d262=_[_0xca3d('0x34')](_0x182c29,['value',_0x2d8d95['type']])[_0xca3d('0x35')];return db[_0xca3d('0x57')][_0xca3d('0x34')]({'where':{'name':_0x56d262,'userProfileId':_0x466e94[_0xca3d('0x58')]},'raw':!![]})['then'](function(_0x183eec){if(_0x183eec&&_0x183eec['autoAssociation']===0x0){return db[_0xca3d('0x36')][_0xca3d('0x54')]({'name':_0x2d8d95['name'],'resourceId':_0x2d8d95['id'],'type':_0x183eec[_0xca3d('0x35')],'sectionId':_0x183eec['id']},{})[_0xca3d('0x2a')](function(){return _0x49a83c;});}else{return _0x49a83c;}})[_0xca3d('0x4f')](function(_0x80ccdf){logger[_0xca3d('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x80ccdf);throw _0x80ccdf;});}return _0x49a83c;});}})[_0xca3d('0x2a')](respondWithResult(_0x31519b,0xc9))['catch'](handleError(_0x31519b,null));};exports['update']=function(_0x373ad9,_0x3c2803){if(_0x373ad9[_0xca3d('0x5c')]['id']){delete _0x373ad9[_0xca3d('0x5c')]['id'];}return db[_0xca3d('0x38')]['find']({'where':{'id':_0x373ad9['params']['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x3c2803,null))['then'](saveUpdates(_0x373ad9['body'],null))[_0xca3d('0x2a')](respondWithResult(_0x3c2803,null))[_0xca3d('0x4f')](handleError(_0x3c2803,null));};exports[_0xca3d('0x2b')]=function(_0xe23a3d,_0x3dc5d3){return db[_0xca3d('0x38')][_0xca3d('0x34')]({'where':{'id':_0xe23a3d[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x3dc5d3,null))[_0xca3d('0x2a')](removeEntity(_0x3dc5d3,null))['catch'](handleError(_0x3dc5d3,null));};exports['getHoppers']=function(_0x2a454e,_0x2f34bb,_0x3d1560){var _0x188a36={'raw':![],'where':{}};var _0x1e92b7={};var _0x35370c={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2a454e[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x2f34bb,null))[_0xca3d('0x2a')](function(_0x786c17){if(_0x786c17){_0x1e92b7[_0xca3d('0x3b')]=_['keys'](db[_0xca3d('0x60')][_0xca3d('0x53')]);_0x1e92b7[_0xca3d('0x3c')]=_[_0xca3d('0x52')](_0x2a454e[_0xca3d('0x3c')]);_0x1e92b7[_0xca3d('0x3d')]=_[_0xca3d('0x3e')](_0x1e92b7['model'],_0x1e92b7[_0xca3d('0x3c')]);_0x188a36['attributes']=_[_0xca3d('0x3e')](_0x1e92b7[_0xca3d('0x3b')],qs['fields'](_0x2a454e['query'][_0xca3d('0x40')]));_0x188a36[_0xca3d('0x3f')]=_0x188a36[_0xca3d('0x3f')][_0xca3d('0x41')]?_0x188a36[_0xca3d('0x3f')]:_0x1e92b7[_0xca3d('0x3b')];if(!_0x2a454e[_0xca3d('0x3c')]['hasOwnProperty']('nolimit')){_0x188a36[_0xca3d('0x21')]=qs[_0xca3d('0x21')](_0x2a454e[_0xca3d('0x3c')][_0xca3d('0x21')]);_0x188a36[_0xca3d('0x20')]=qs['offset'](_0x2a454e[_0xca3d('0x3c')][_0xca3d('0x20')]);}_0x188a36[_0xca3d('0x61')]=qs['sort'](_0x2a454e['query']['sort']);_0x188a36[_0xca3d('0x45')]=qs[_0xca3d('0x3d')](_[_0xca3d('0x46')](_0x2a454e['query'],_0x1e92b7[_0xca3d('0x3d')]));_0x188a36[_0xca3d('0x45')]['VoiceQueueId']=_0x786c17['id'];if(_0x2a454e['query'][_0xca3d('0x47')]){_0x188a36[_0xca3d('0x45')]=_[_0xca3d('0x49')](_0x188a36[_0xca3d('0x45')],{'$or':_[_0xca3d('0x48')](_0x188a36[_0xca3d('0x3f')],function(_0x48dcb5){var _0x2c9747={};_0x2c9747[_0x48dcb5]={'$like':'%'+_0x2a454e['query'][_0xca3d('0x47')]+'%'};return _0x2c9747;})});}_0x188a36=_['merge']({},_0x188a36,_0x2a454e['options']);return db[_0xca3d('0x60')][_0xca3d('0x23')]({'where':_0x188a36['where']})[_0xca3d('0x2a')](function(_0x30f24d){_0x35370c[_0xca3d('0x23')]=_0x30f24d;if(_0x2a454e[_0xca3d('0x3c')]['includeAll']){_0x188a36['include']=[{'all':!![]}];}return db[_0xca3d('0x60')][_0xca3d('0x4d')](_0x188a36);})[_0xca3d('0x2a')](function(_0x45f3cc){_0x35370c[_0xca3d('0x4e')]=_0x45f3cc;return _0x35370c;});}})[_0xca3d('0x2a')](respondWithFilteredResult(_0x2f34bb,_0x188a36))[_0xca3d('0x4f')](handleError(_0x2f34bb,null));};exports[_0xca3d('0x62')]=function(_0x848f7d,_0x140467,_0x2e1996){var _0x1554fd={'raw':!![],'where':{}};var _0x26c7e0={};var _0x4a8efb={'count':0x0,'rows':[]};return db[_0xca3d('0x38')][_0xca3d('0x63')]({'where':{'id':_0x848f7d['params']['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x140467,null))['then'](function(_0x27be70){if(_0x27be70){_0x26c7e0[_0xca3d('0x3b')]=_[_0xca3d('0x52')](db['CmHopperHistory'][_0xca3d('0x53')]);_0x26c7e0[_0xca3d('0x3c')]=_['keys'](_0x848f7d[_0xca3d('0x3c')]);_0x26c7e0[_0xca3d('0x3d')]=_['intersection'](_0x26c7e0['model'],_0x26c7e0[_0xca3d('0x3c')]);_0x1554fd['attributes']=_['intersection'](_0x26c7e0[_0xca3d('0x3b')],qs[_0xca3d('0x40')](_0x848f7d[_0xca3d('0x3c')][_0xca3d('0x40')]));_0x1554fd['attributes']=_0x1554fd[_0xca3d('0x3f')][_0xca3d('0x41')]?_0x1554fd[_0xca3d('0x3f')]:_0x26c7e0['model'];if(!_0x848f7d[_0xca3d('0x3c')][_0xca3d('0x42')](_0xca3d('0x43'))){_0x1554fd[_0xca3d('0x21')]=qs['limit'](_0x848f7d[_0xca3d('0x3c')][_0xca3d('0x21')]);_0x1554fd[_0xca3d('0x20')]=qs[_0xca3d('0x20')](_0x848f7d['query'][_0xca3d('0x20')]);}_0x1554fd[_0xca3d('0x61')]=qs[_0xca3d('0x44')](_0x848f7d[_0xca3d('0x3c')][_0xca3d('0x44')]);_0x1554fd[_0xca3d('0x45')]=qs[_0xca3d('0x3d')](_[_0xca3d('0x46')](_0x848f7d['query'],_0x26c7e0[_0xca3d('0x3d')]));_0x1554fd[_0xca3d('0x45')][_0xca3d('0x64')]=_0x27be70['id'];if(_0x848f7d['query'][_0xca3d('0x47')]){_0x1554fd[_0xca3d('0x45')]=_[_0xca3d('0x49')](_0x1554fd[_0xca3d('0x45')],{'$or':_[_0xca3d('0x48')](_0x1554fd['attributes'],function(_0x1ee69e){var _0x589f50={};_0x589f50[_0x1ee69e]={'$like':'%'+_0x848f7d[_0xca3d('0x3c')][_0xca3d('0x47')]+'%'};return _0x589f50;})});}_0x1554fd=_[_0xca3d('0x49')]({},_0x1554fd,_0x848f7d['options']);return db[_0xca3d('0x65')][_0xca3d('0x23')]({'where':_0x1554fd[_0xca3d('0x45')]})[_0xca3d('0x2a')](function(_0x20242b){_0x4a8efb[_0xca3d('0x23')]=_0x20242b;if(_0x848f7d['query'][_0xca3d('0x4b')]){_0x1554fd[_0xca3d('0x4c')]=[{'all':!![]}];}return db[_0xca3d('0x65')][_0xca3d('0x4d')](_0x1554fd);})[_0xca3d('0x2a')](function(_0x1a814e){_0x4a8efb['rows']=_0x1a814e;return _0x4a8efb;});}})[_0xca3d('0x2a')](respondWithFilteredResult(_0x140467,_0x1554fd))[_0xca3d('0x4f')](handleError(_0x140467,null));};exports[_0xca3d('0x66')]=function(_0x448374,_0x463bdc,_0x338e0f){var _0x392ee3={'raw':!![],'where':{}};var _0x2fe33e={};var _0x2d772b={'count':0x0,'rows':[]};return db[_0xca3d('0x38')][_0xca3d('0x63')]({'where':{'id':_0x448374[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x463bdc,null))[_0xca3d('0x2a')](function(_0x2a82e2){if(_0x2a82e2){_0x2fe33e[_0xca3d('0x3b')]=_[_0xca3d('0x52')](db[_0xca3d('0x67')]['rawAttributes']);_0x2fe33e[_0xca3d('0x3c')]=_['keys'](_0x448374[_0xca3d('0x3c')]);_0x2fe33e[_0xca3d('0x3d')]=_[_0xca3d('0x3e')](_0x2fe33e[_0xca3d('0x3b')],_0x2fe33e[_0xca3d('0x3c')]);_0x392ee3['attributes']=_[_0xca3d('0x3e')](_0x2fe33e['model'],qs[_0xca3d('0x40')](_0x448374[_0xca3d('0x3c')]['fields']));_0x392ee3[_0xca3d('0x3f')]=_0x392ee3[_0xca3d('0x3f')][_0xca3d('0x41')]?_0x392ee3[_0xca3d('0x3f')]:_0x2fe33e[_0xca3d('0x3b')];if(!_0x448374[_0xca3d('0x3c')]['hasOwnProperty'](_0xca3d('0x43'))){_0x392ee3[_0xca3d('0x21')]=qs['limit'](_0x448374[_0xca3d('0x3c')][_0xca3d('0x21')]);_0x392ee3[_0xca3d('0x20')]=qs[_0xca3d('0x20')](_0x448374[_0xca3d('0x3c')][_0xca3d('0x20')]);}_0x392ee3[_0xca3d('0x61')]=qs[_0xca3d('0x44')](_0x448374[_0xca3d('0x3c')]['sort']);_0x392ee3['where']=qs[_0xca3d('0x3d')](_[_0xca3d('0x46')](_0x448374[_0xca3d('0x3c')],_0x2fe33e['filters']));_0x392ee3[_0xca3d('0x45')][_0xca3d('0x64')]=_0x2a82e2['id'];if(_0x448374['query'][_0xca3d('0x47')]){_0x392ee3['where']=_[_0xca3d('0x49')](_0x392ee3['where'],{'$or':_[_0xca3d('0x48')](_0x392ee3['attributes'],function(_0x4e8a08){var _0xaf271f={};_0xaf271f[_0x4e8a08]={'$like':'%'+_0x448374['query'][_0xca3d('0x47')]+'%'};return _0xaf271f;})});}_0x392ee3=_['merge']({},_0x392ee3,_0x448374['options']);return db[_0xca3d('0x67')][_0xca3d('0x23')]({'where':_0x392ee3[_0xca3d('0x45')]})[_0xca3d('0x2a')](function(_0x5be383){_0x2d772b[_0xca3d('0x23')]=_0x5be383;if(_0x448374[_0xca3d('0x3c')][_0xca3d('0x4b')]){_0x392ee3['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xca3d('0x4d')](_0x392ee3);})['then'](function(_0x42357b){_0x2d772b[_0xca3d('0x4e')]=_0x42357b;return _0x2d772b;});}})['then'](respondWithFilteredResult(_0x463bdc,_0x392ee3))[_0xca3d('0x4f')](handleError(_0x463bdc,null));};exports[_0xca3d('0x68')]=function(_0x438343,_0x9b07c3,_0x50bf72){var _0x3a85ac={'raw':!![],'where':{}};var _0x5ca2b3={};var _0x273359={'count':0x0,'rows':[]};return db[_0xca3d('0x38')]['findOne']({'where':{'id':_0x438343[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x9b07c3,null))['then'](function(_0x7babae){if(_0x7babae){_0x5ca2b3['model']=_['keys'](db['CmHopperBlack'][_0xca3d('0x53')]);_0x5ca2b3[_0xca3d('0x3c')]=_[_0xca3d('0x52')](_0x438343['query']);_0x5ca2b3[_0xca3d('0x3d')]=_[_0xca3d('0x3e')](_0x5ca2b3[_0xca3d('0x3b')],_0x5ca2b3[_0xca3d('0x3c')]);_0x3a85ac[_0xca3d('0x3f')]=_[_0xca3d('0x3e')](_0x5ca2b3[_0xca3d('0x3b')],qs[_0xca3d('0x40')](_0x438343[_0xca3d('0x3c')][_0xca3d('0x40')]));_0x3a85ac[_0xca3d('0x3f')]=_0x3a85ac['attributes'][_0xca3d('0x41')]?_0x3a85ac['attributes']:_0x5ca2b3[_0xca3d('0x3b')];if(!_0x438343['query']['hasOwnProperty'](_0xca3d('0x43'))){_0x3a85ac['limit']=qs[_0xca3d('0x21')](_0x438343['query'][_0xca3d('0x21')]);_0x3a85ac[_0xca3d('0x20')]=qs[_0xca3d('0x20')](_0x438343[_0xca3d('0x3c')][_0xca3d('0x20')]);}_0x3a85ac[_0xca3d('0x61')]=qs[_0xca3d('0x44')](_0x438343[_0xca3d('0x3c')]['sort']);_0x3a85ac[_0xca3d('0x45')]=qs[_0xca3d('0x3d')](_[_0xca3d('0x46')](_0x438343['query'],_0x5ca2b3[_0xca3d('0x3d')]));_0x3a85ac[_0xca3d('0x45')][_0xca3d('0x64')]=_0x7babae['id'];if(_0x438343[_0xca3d('0x3c')]['filter']){_0x3a85ac['where']=_[_0xca3d('0x49')](_0x3a85ac[_0xca3d('0x45')],{'$or':_[_0xca3d('0x48')](_0x3a85ac[_0xca3d('0x3f')],function(_0x126f0e){var _0x11a8f2={};_0x11a8f2[_0x126f0e]={'$like':'%'+_0x438343[_0xca3d('0x3c')][_0xca3d('0x47')]+'%'};return _0x11a8f2;})});}_0x3a85ac=_[_0xca3d('0x49')]({},_0x3a85ac,_0x438343['options']);return db[_0xca3d('0x69')][_0xca3d('0x23')]({'where':_0x3a85ac[_0xca3d('0x45')]})[_0xca3d('0x2a')](function(_0x5718fa){_0x273359[_0xca3d('0x23')]=_0x5718fa;if(_0x438343[_0xca3d('0x3c')][_0xca3d('0x4b')]){_0x3a85ac[_0xca3d('0x4c')]=[{'all':!![]}];}return db[_0xca3d('0x69')][_0xca3d('0x4d')](_0x3a85ac);})[_0xca3d('0x2a')](function(_0x3c9f65){_0x273359['rows']=_0x3c9f65;return _0x273359;});}})[_0xca3d('0x2a')](respondWithFilteredResult(_0x9b07c3,_0x3a85ac))[_0xca3d('0x4f')](handleError(_0x9b07c3,null));};exports[_0xca3d('0x6a')]=function(_0x44e610,_0xda5306,_0x580553){var _0xc4a0f3={};var _0x2d4db0={};var _0x59c952;var _0x4a26bd;return db[_0xca3d('0x38')]['findOne']({'where':{'id':_0x44e610[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0xda5306,null))[_0xca3d('0x2a')](function(_0x3edb1d){if(_0x3edb1d){_0x59c952=_0x3edb1d;_0x2d4db0['model']=_['keys'](db['Team'][_0xca3d('0x53')]);_0x2d4db0['query']=_[_0xca3d('0x52')](_0x44e610[_0xca3d('0x3c')]);_0x2d4db0[_0xca3d('0x3d')]=_[_0xca3d('0x3e')](_0x2d4db0[_0xca3d('0x3b')],_0x2d4db0[_0xca3d('0x3c')]);_0xc4a0f3[_0xca3d('0x3f')]=_[_0xca3d('0x3e')](_0x2d4db0[_0xca3d('0x3b')],qs[_0xca3d('0x40')](_0x44e610[_0xca3d('0x3c')][_0xca3d('0x40')]));_0xc4a0f3['attributes']=_0xc4a0f3[_0xca3d('0x3f')]['length']?_0xc4a0f3['attributes']:_0x2d4db0[_0xca3d('0x3b')];_0xc4a0f3[_0xca3d('0x61')]=qs['sort'](_0x44e610['query'][_0xca3d('0x44')]);_0xc4a0f3[_0xca3d('0x45')]=qs[_0xca3d('0x3d')](_[_0xca3d('0x46')](_0x44e610[_0xca3d('0x3c')],_0x2d4db0[_0xca3d('0x3d')]));if(_0x44e610['query']['filter']){_0xc4a0f3[_0xca3d('0x45')]=_['merge'](_0xc4a0f3['where'],{'$or':_['map'](_0xc4a0f3['attributes'],function(_0x4521ce){var _0x4743d4={};_0x4743d4[_0x4521ce]={'$like':'%'+_0x44e610[_0xca3d('0x3c')]['filter']+'%'};return _0x4743d4;})});}_0xc4a0f3=_[_0xca3d('0x49')]({},_0xc4a0f3,_0x44e610[_0xca3d('0x4a')]);return _0x59c952[_0xca3d('0x6a')](_0xc4a0f3);}})['then'](function(_0xd0a79d){if(_0xd0a79d){_0x4a26bd=_0xd0a79d['length'];if(!_0x44e610[_0xca3d('0x3c')][_0xca3d('0x42')](_0xca3d('0x43'))){_0xc4a0f3['limit']=qs[_0xca3d('0x21')](_0x44e610['query'][_0xca3d('0x21')]);_0xc4a0f3['offset']=qs[_0xca3d('0x20')](_0x44e610[_0xca3d('0x3c')]['offset']);}return _0x59c952[_0xca3d('0x6a')](_0xc4a0f3);}})['then'](function(_0x3973f7){if(_0x3973f7){return _0x3973f7?{'count':_0x4a26bd,'rows':_0x3973f7}:null;}})[_0xca3d('0x2a')](respondWithResult(_0xda5306,null))[_0xca3d('0x4f')](handleError(_0xda5306,null));};exports[_0xca3d('0x6b')]=function(_0x55d682,_0x3c8526,_0x12335f){var _0x1c8c9f=_0x55d682[_0xca3d('0x5c')]['teams'];var _0x3de0f5=_[_0xca3d('0x48')](_0x1c8c9f,'id');return db[_0xca3d('0x6c')][_0xca3d('0x4d')]({'where':{'id':_0x3de0f5},'attributes':['id'],'include':[{'model':db[_0xca3d('0x6d')],'as':'Agents','attributes':['id','name',_0xca3d('0x6e'),'voicePause',_0xca3d('0x6f')],'raw':!![]}]})[_0xca3d('0x2a')](function(_0x5f59e1){if(_0x5f59e1){var _0x4b867d=_['flatMap'](_0x5f59e1,function(_0x1fbfad){var _0x21bac6=_0x1fbfad[_0xca3d('0x2c')]({'plain':!![]});_0x21bac6[_0xca3d('0x70')][_0xca3d('0x71')](function(_0x1eaf36){_0x1eaf36[_0xca3d('0x72')]=_['find'](_0x1c8c9f,{'id':_0x21bac6['id']})[_0xca3d('0x72')];});return _0x21bac6[_0xca3d('0x70')];});return db[_0xca3d('0x38')]['find']({'where':{'id':_0x55d682[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](function(_0xa6724e){return db['sequelize']['transaction'](function(_0x744744){return _0xa6724e[_0xca3d('0x6b')](_0x3de0f5,{'transaction':_0x744744})[_0xca3d('0x2a')](function(){return BPromise[_0xca3d('0x73')](_0x1c8c9f,function(_0x3e7ea5){return db[_0xca3d('0x74')][_0xca3d('0x75')]({'TeamId':_0x3e7ea5['id'],'VoiceQueueId':_0x55d682[_0xca3d('0x51')]['id'],'penalty':_0x3e7ea5[_0xca3d('0x72')]},{'transaction':_0x744744});});})['then'](function(){return BPromise[_0xca3d('0x73')](_0x4b867d,function(_0x4a1f92){return db[_0xca3d('0x76')][_0xca3d('0x77')]({'where':{'UserId':_0x4a1f92['id'],'VoiceQueueId':_0x55d682['params']['id']},'defaults':{'penalty':_0x4a1f92[_0xca3d('0x72')]},'transaction':_0x744744});});})[_0xca3d('0x2a')](function(){return BPromise['each'](_['filter'](_0x4b867d,{'online':!![]}),function(_0x38e3e4){return db[_0xca3d('0x78')][_0xca3d('0x75')]({'membername':_0x38e3e4[_0xca3d('0x35')],'UserId':_0x38e3e4['id'],'queue_name':_0xa6724e['name'],'VoiceQueueId':_0xa6724e['id'],'interface':_[_0xca3d('0x79')](_0x38e3e4[_0xca3d('0x6f')])?util[_0xca3d('0x7a')](_0xca3d('0x7b'),_0x38e3e4[_0xca3d('0x35')]):_0x38e3e4['interface'],'paused':_0x38e3e4[_0xca3d('0x7c')]||![],'penalty':_0x38e3e4['penalty']},{'transaction':_0x744744});});})[_0xca3d('0x2a')](function(){_0x4b867d['forEach'](function(_0x52cfdb){socket[_0xca3d('0x7d')](_0xca3d('0x7e'),{'UserId':_0x52cfdb['id'],'VoiceQueueId':_0xa6724e['id']});});});});});}})[_0xca3d('0x2a')](respondWithStatusCode(_0x3c8526,null))[_0xca3d('0x4f')](handleError(_0x3c8526,null));};exports['removeTeams']=function(_0x2fc458,_0x34be3a,_0x10b9cc){return db[_0xca3d('0x6c')][_0xca3d('0x4d')]({'where':{'id':_0x2fc458[_0xca3d('0x3c')][_0xca3d('0x7f')]},'attributes':['id'],'include':[{'model':db[_0xca3d('0x6d')],'as':_0xca3d('0x70'),'attributes':['id'],'raw':!![]}]})[_0xca3d('0x2a')](handleEntityNotFound(_0x34be3a,null))[_0xca3d('0x2a')](function(_0x28d827){var _0x47ae77=_[_0xca3d('0x48')](_0x28d827,'id');var _0x108ea0=[];var _0x20d629=[];var _0xa245b4=squel['select']();_0xa245b4['field'](_0xca3d('0x80'))['from'](_0xca3d('0x81'),'tq')[_0xca3d('0x82')](_0xca3d('0x83'),'ut',_0xca3d('0x84'))[_0xca3d('0x45')](_0xca3d('0x85'),_0x2fc458[_0xca3d('0x51')]['id']);for(var _0x194bd0=0x0;_0x194bd0<_0x28d827[_0xca3d('0x41')];_0x194bd0+=0x1){let _0x472b6a=_0x28d827[_0x194bd0];for(var _0x185328=0x0;_0x185328<_0x472b6a[_0xca3d('0x70')][_0xca3d('0x41')];_0x185328+=0x1){let _0x3c4d9c=_0x472b6a['Agents'][_0x185328];var _0x16d145=_0xa245b4['clone']();_0x16d145['where'](_0xca3d('0x86'),_0x3c4d9c['id']);_0x20d629['push'](db[_0xca3d('0x87')][_0xca3d('0x3c')](_0x16d145[_0xca3d('0x88')](),{'type':db[_0xca3d('0x87')]['QueryTypes']['SELECT']})['then'](function(_0x2cbc07){if(_0x2cbc07[_0xca3d('0x41')]===0x1){return _0x3c4d9c['id'];}else{var _0xce6a6e=_['every'](_['map'](_0x2cbc07,_0xca3d('0x89')),function(_0xb497da){return _[_0xca3d('0x32')](_0x47ae77,_0xb497da);});if(_0xce6a6e){return _0x3c4d9c['id'];}}}));}}return BPromise[_0xca3d('0x8a')](_0x20d629)[_0xca3d('0x2a')](function(_0x578f06){_0x108ea0=_(_0x108ea0)['union'](_0x578f06)[_0xca3d('0x8b')]()[_0xca3d('0x31')]();return db[_0xca3d('0x38')]['find']({'where':{'id':_0x2fc458['params']['id']}})['then'](function(_0x5b5ed5){return db[_0xca3d('0x87')][_0xca3d('0x8c')](function(_0x5268f1){return _0x5b5ed5[_0xca3d('0x8d')](_0x2fc458['query'][_0xca3d('0x7f')],{'transaction':_0x5268f1})[_0xca3d('0x2a')](function(){if(!_[_0xca3d('0x8e')](_0x108ea0)){return _0x5b5ed5['removeAgents'](_0x108ea0,{'transaction':_0x5268f1})[_0xca3d('0x2a')](function(){return db['UserVoiceQueueRt'][_0xca3d('0x2b')]({'where':{'VoiceQueueId':_0x2fc458['params']['id'],'UserId':_0x108ea0},'transaction':_0x5268f1});});}})[_0xca3d('0x2a')](function(){_0x108ea0[_0xca3d('0x71')](function(_0x55b6a3){socket['emit'](_0xca3d('0x8f'),{'UserId':_0x55b6a3,'VoiceQueueId':_0x5b5ed5['id']});});});});});});})[_0xca3d('0x2a')](respondWithStatusCode(_0x34be3a,null))[_0xca3d('0x4f')](handleError(_0x34be3a,null));};exports[_0xca3d('0x90')]=function(_0x5c781b,_0x30a83d,_0x3570e7){var _0x5c6e5e,_0x557693;return db['VoiceQueue'][_0xca3d('0x34')]({'where':{'id':_0x5c781b[_0xca3d('0x51')]['id']}})['then'](handleEntityNotFound(_0x30a83d,null))[_0xca3d('0x2a')](function(_0x5186f8){if(_0x5186f8){_0x557693=_0x5186f8;return _0x5186f8[_0xca3d('0x90')](_0x5c781b[_0xca3d('0x5c')][_0xca3d('0x7f')],_['omit'](_0x5c781b[_0xca3d('0x5c')],[_0xca3d('0x7f'),'id'])||{})[_0xca3d('0x91')](function(_0x1136ad){for(var _0x144a8b=0x0;_0x144a8b<_0x5c781b[_0xca3d('0x5c')]['ids'][_0xca3d('0x41')];_0x144a8b+=0x1){socket[_0xca3d('0x7d')](_0xca3d('0x7e'),{'UserId':Number(_0x5c781b['body'][_0xca3d('0x7f')][_0x144a8b]),'VoiceQueueId':Number(_0x5c781b[_0xca3d('0x51')]['id'])});}return _0x1136ad;});}})[_0xca3d('0x2a')](function(_0x3d55ae){_0x5c6e5e=_0x3d55ae||[];if(_0x557693){return db[_0xca3d('0x6d')]['findAll']({'where':{'id':_0x5c781b[_0xca3d('0x5c')][_0xca3d('0x7f')]},'attributes':['id',_0xca3d('0x35'),_0xca3d('0x6e'),_0xca3d('0x7c'),_0xca3d('0x6f')],'raw':!![]});}})[_0xca3d('0x2a')](function(_0xf4d0a0){if(!_[_0xca3d('0x8e')](_0xf4d0a0)){var _0x2fd873=[];for(var _0x205ed2=0x0;_0x205ed2<_0xf4d0a0['length'];_0x205ed2++){if(_0xf4d0a0[_0x205ed2][_0xca3d('0x6e')]){_0x2fd873[_0xca3d('0x92')](db[_0xca3d('0x78')][_0xca3d('0x75')]({'membername':_0xf4d0a0[_0x205ed2][_0xca3d('0x35')],'UserId':_0xf4d0a0[_0x205ed2]['id'],'queue_name':_0x557693[_0xca3d('0x35')],'VoiceQueueId':_0x557693['id'],'interface':_[_0xca3d('0x79')](_0xf4d0a0[_0x205ed2][_0xca3d('0x6f')])?util[_0xca3d('0x7a')](_0xca3d('0x7b'),_0xf4d0a0[_0x205ed2][_0xca3d('0x35')]):_0xf4d0a0[_0x205ed2]['interface'],'paused':_0xf4d0a0[_0x205ed2][_0xca3d('0x7c')]||![],'penalty':_0x5c781b[_0xca3d('0x5c')][_0xca3d('0x72')]||0x0}));}}return BPromise[_0xca3d('0x8a')](_0x2fd873);}})[_0xca3d('0x2a')](function(){return _0x5c6e5e;})[_0xca3d('0x2a')](respondWithResult(_0x30a83d,null))['catch'](handleError(_0x30a83d,null));};exports[_0xca3d('0x93')]=function(_0x42e899,_0x58305d,_0x56f6ba){return db[_0xca3d('0x38')][_0xca3d('0x34')]({'where':{'id':_0x42e899[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x58305d,null))[_0xca3d('0x2a')](function(_0x261d0b){if(_0x261d0b){return _0x261d0b[_0xca3d('0x93')](_0x42e899['query'][_0xca3d('0x7f')])[_0xca3d('0x2a')](function(){if(_['isArray'](_0x42e899[_0xca3d('0x3c')][_0xca3d('0x7f')])){for(var _0x279ab6=0x0;_0x279ab6<_0x42e899[_0xca3d('0x3c')][_0xca3d('0x7f')][_0xca3d('0x41')];_0x279ab6+=0x1){socket[_0xca3d('0x7d')](_0xca3d('0x8f'),{'UserId':Number(_0x42e899[_0xca3d('0x3c')][_0xca3d('0x7f')][_0x279ab6]),'VoiceQueueId':Number(_0x42e899[_0xca3d('0x51')]['id'])});}}else{socket['emit'](_0xca3d('0x8f'),{'UserId':Number(_0x42e899[_0xca3d('0x3c')][_0xca3d('0x7f')]),'VoiceQueueId':Number(_0x42e899[_0xca3d('0x51')]['id'])});}});}})['then'](function(_0x525994){return db[_0xca3d('0x78')][_0xca3d('0x2b')]({'where':{'VoiceQueueId':_0x42e899['params']['id'],'UserId':_0x42e899[_0xca3d('0x3c')][_0xca3d('0x7f')]}})[_0xca3d('0x2a')](function(){return _0x525994;});})[_0xca3d('0x2a')](respondWithStatusCode(_0x58305d,null))[_0xca3d('0x4f')](handleError(_0x58305d,null));};exports[_0xca3d('0x94')]=function(_0x4fd264,_0x5e6af2,_0xe4fcfc){var _0x3e4373={};var _0x3fc117={};var _0x7bdef4;var _0x4fa345;return db[_0xca3d('0x38')][_0xca3d('0x63')]({'where':{'id':_0x4fd264[_0xca3d('0x51')]['id']}})['then'](handleEntityNotFound(_0x5e6af2,null))[_0xca3d('0x2a')](function(_0x5529d3){if(_0x5529d3){_0x7bdef4=_0x5529d3;_0x3fc117[_0xca3d('0x3b')]=_['keys'](db[_0xca3d('0x6d')][_0xca3d('0x53')]);_0x3fc117[_0xca3d('0x3c')]=_[_0xca3d('0x52')](_0x4fd264[_0xca3d('0x3c')]);_0x3fc117[_0xca3d('0x3d')]=_[_0xca3d('0x3e')](_0x3fc117[_0xca3d('0x3b')],_0x3fc117[_0xca3d('0x3c')]);_0x3e4373['attributes']=_[_0xca3d('0x3e')](_0x3fc117[_0xca3d('0x3b')],qs[_0xca3d('0x40')](_0x4fd264[_0xca3d('0x3c')][_0xca3d('0x40')]));_0x3e4373[_0xca3d('0x3f')]=_0x3e4373[_0xca3d('0x3f')][_0xca3d('0x41')]?_0x3e4373['attributes']:_0x3fc117['model'];_0x3e4373[_0xca3d('0x61')]=qs[_0xca3d('0x44')](_0x4fd264[_0xca3d('0x3c')][_0xca3d('0x44')]);_0x3e4373[_0xca3d('0x45')]=qs[_0xca3d('0x3d')](_[_0xca3d('0x46')](_0x4fd264[_0xca3d('0x3c')],_0x3fc117[_0xca3d('0x3d')]));if(_0x4fd264['query'][_0xca3d('0x47')]){_0x3e4373[_0xca3d('0x45')]=_[_0xca3d('0x49')](_0x3e4373[_0xca3d('0x45')],{'$or':_['map'](_0x3e4373[_0xca3d('0x3f')],function(_0x1e20d){var _0x2ddc37={};_0x2ddc37[_0x1e20d]={'$like':'%'+_0x4fd264[_0xca3d('0x3c')]['filter']+'%'};return _0x2ddc37;})});}_0x3e4373=_['merge']({},_0x3e4373,_0x4fd264[_0xca3d('0x4a')]);return _0x7bdef4['getAgents'](_0x3e4373);}})['then'](function(_0x878510){if(_0x878510){_0x4fa345=_0x878510[_0xca3d('0x41')];if(!_0x4fd264[_0xca3d('0x3c')]['hasOwnProperty'](_0xca3d('0x43'))){_0x3e4373[_0xca3d('0x21')]=qs[_0xca3d('0x21')](_0x4fd264[_0xca3d('0x3c')][_0xca3d('0x21')]);_0x3e4373[_0xca3d('0x20')]=qs[_0xca3d('0x20')](_0x4fd264['query']['offset']);}return _0x7bdef4[_0xca3d('0x94')](_0x3e4373);}})['then'](function(_0x2fb52f){if(_0x2fb52f){return _0x2fb52f?{'count':_0x4fa345,'rows':_0x2fb52f}:null;}})[_0xca3d('0x2a')](respondWithResult(_0x5e6af2,null))[_0xca3d('0x4f')](handleError(_0x5e6af2,null));};exports[_0xca3d('0x95')]=function(_0x37d010,_0xef509a,_0x3ef8b0){var _0xf7aa1c={};var _0x4bd00e={};var _0x2dba54;var _0xd88efa;return db[_0xca3d('0x38')]['findOne']({'where':{'id':_0x37d010['params']['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0xef509a,null))[_0xca3d('0x2a')](function(_0xb54b4){if(_0xb54b4){_0x2dba54=_0xb54b4;_0x4bd00e[_0xca3d('0x3b')]=_[_0xca3d('0x52')](db[_0xca3d('0x78')]['rawAttributes']);_0x4bd00e[_0xca3d('0x3c')]=_[_0xca3d('0x52')](_0x37d010[_0xca3d('0x3c')]);_0x4bd00e[_0xca3d('0x3d')]=_[_0xca3d('0x3e')](_0x4bd00e[_0xca3d('0x3b')],_0x4bd00e[_0xca3d('0x3c')]);_0xf7aa1c[_0xca3d('0x3f')]=_[_0xca3d('0x3e')](_0x4bd00e['model'],qs[_0xca3d('0x40')](_0x37d010[_0xca3d('0x3c')][_0xca3d('0x40')]));_0xf7aa1c[_0xca3d('0x3f')]=_0xf7aa1c[_0xca3d('0x3f')]['length']?_0xf7aa1c['attributes']:_0x4bd00e[_0xca3d('0x3b')];_0xf7aa1c['order']=qs['sort'](_0x37d010[_0xca3d('0x3c')][_0xca3d('0x44')]);_0xf7aa1c['where']=qs['filters'](_['pick'](_0x37d010['query'],_0x4bd00e[_0xca3d('0x3d')]));if(_0x37d010['query'][_0xca3d('0x47')]){_0xf7aa1c[_0xca3d('0x45')]=_[_0xca3d('0x49')](_0xf7aa1c[_0xca3d('0x45')],{'$or':_[_0xca3d('0x48')](_0xf7aa1c[_0xca3d('0x3f')],function(_0x1a4186){var _0x2033b7={};_0x2033b7[_0x1a4186]={'$like':'%'+_0x37d010['query'][_0xca3d('0x47')]+'%'};return _0x2033b7;})});}_0xf7aa1c=_[_0xca3d('0x49')]({},_0xf7aa1c,_0x37d010['options']);return _0x2dba54[_0xca3d('0x95')](_0xf7aa1c);}})[_0xca3d('0x2a')](function(_0xc2013b){if(_0xc2013b){_0xd88efa=_0xc2013b[_0xca3d('0x41')];if(!_0x37d010[_0xca3d('0x3c')][_0xca3d('0x42')]('nolimit')){_0xf7aa1c[_0xca3d('0x21')]=qs['limit'](_0x37d010['query'][_0xca3d('0x21')]);_0xf7aa1c[_0xca3d('0x20')]=qs['offset'](_0x37d010[_0xca3d('0x3c')][_0xca3d('0x20')]);}return _0x2dba54[_0xca3d('0x95')](_0xf7aa1c);}})[_0xca3d('0x2a')](function(_0x1e0479){return _0x1e0479?{'count':_0xd88efa,'rows':_0x1e0479}:null;})[_0xca3d('0x2a')](respondWithResult(_0xef509a,null))[_0xca3d('0x4f')](handleError(_0xef509a,null));};exports['getLists']=function(_0x1e65d5,_0x42e6a2,_0x171c03){var _0x529d92={};var _0x1950aa={};var _0x419fa1;var _0x2ff2d7;return db['VoiceQueue'][_0xca3d('0x63')]({'where':{'id':_0x1e65d5[_0xca3d('0x51')]['id']}})['then'](handleEntityNotFound(_0x42e6a2,null))['then'](function(_0x4cbb67){if(_0x4cbb67){_0x419fa1=_0x4cbb67;_0x1950aa[_0xca3d('0x3b')]=_[_0xca3d('0x52')](db[_0xca3d('0x96')]['rawAttributes']);_0x1950aa['query']=_[_0xca3d('0x52')](_0x1e65d5[_0xca3d('0x3c')]);_0x1950aa['filters']=_['intersection'](_0x1950aa[_0xca3d('0x3b')],_0x1950aa['query']);_0x529d92['attributes']=_['intersection'](_0x1950aa['model'],qs['fields'](_0x1e65d5[_0xca3d('0x3c')][_0xca3d('0x40')]));_0x529d92['attributes']=_0x529d92[_0xca3d('0x3f')][_0xca3d('0x41')]?_0x529d92['attributes']:_0x1950aa[_0xca3d('0x3b')];_0x529d92['order']=qs['sort'](_0x1e65d5['query'][_0xca3d('0x44')]);_0x529d92['where']=qs[_0xca3d('0x3d')](_['pick'](_0x1e65d5['query'],_0x1950aa[_0xca3d('0x3d')]));if(_0x1e65d5[_0xca3d('0x3c')][_0xca3d('0x47')]){_0x529d92[_0xca3d('0x45')]=_[_0xca3d('0x49')](_0x529d92['where'],{'$or':_[_0xca3d('0x48')](_0x529d92[_0xca3d('0x3f')],function(_0x462dd3){var _0x58532e={};_0x58532e[_0x462dd3]={'$like':'%'+_0x1e65d5[_0xca3d('0x3c')]['filter']+'%'};return _0x58532e;})});}_0x529d92=_[_0xca3d('0x49')]({},_0x529d92,_0x1e65d5[_0xca3d('0x4a')]);return _0x419fa1[_0xca3d('0x97')](_0x529d92);}})['then'](function(_0x5e32b6){if(_0x5e32b6){_0x2ff2d7=_0x5e32b6[_0xca3d('0x41')];if(!_0x1e65d5[_0xca3d('0x3c')][_0xca3d('0x42')](_0xca3d('0x43'))){_0x529d92[_0xca3d('0x21')]=qs[_0xca3d('0x21')](_0x1e65d5[_0xca3d('0x3c')][_0xca3d('0x21')]);_0x529d92[_0xca3d('0x20')]=qs[_0xca3d('0x20')](_0x1e65d5[_0xca3d('0x3c')]['offset']);}return _0x419fa1[_0xca3d('0x97')](_0x529d92);}})[_0xca3d('0x2a')](function(_0xff5b40){if(_0xff5b40){return _0xff5b40?{'count':_0x2ff2d7,'rows':_0xff5b40}:null;}})[_0xca3d('0x2a')](respondWithResult(_0x42e6a2,null))[_0xca3d('0x4f')](handleError(_0x42e6a2,null));};exports[_0xca3d('0x98')]=function(_0x34598b,_0x18b956,_0x10a157){var _0x10b96f,_0x10558d;return db['VoiceQueue'][_0xca3d('0x34')]({'where':{'id':_0x34598b[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x18b956,null))[_0xca3d('0x2a')](function(_0x531602){if(_0x531602){_0x10558d=_0x531602;return _0x531602[_0xca3d('0x98')](_0x34598b[_0xca3d('0x5c')][_0xca3d('0x7f')],_[_0xca3d('0x99')](_0x34598b[_0xca3d('0x5c')],[_0xca3d('0x7f'),'id'])||{});}return null;})[_0xca3d('0x91')](function(_0x520f83){var _0x176a49;_0x10b96f=_0x520f83||[];var _0x304e96=[];if(_0x520f83){for(var _0x4a6f44=0x0;_0x4a6f44<_0x520f83[_0xca3d('0x41')];_0x4a6f44+=0x1){var _0xb62bfa=_0x520f83[_0x4a6f44][_0xca3d('0x2c')]({'plain':!![]});_0x10558d['dialCheckDuplicateType']=_0x34598b['body']['dialCheckDuplicateType']?_0x34598b[_0xca3d('0x5c')][_0xca3d('0x9a')]:_0x10558d[_0xca3d('0x9a')];switch(_0x10558d['dialCheckDuplicateType']){case _0xca3d('0x9b'):_0x176a49=squel[_0xca3d('0x9c')]()['into'](_0xca3d('0x9d'))['fromQuery']([_0xca3d('0x9e'),_0xca3d('0x9f'),'ContactId',_0xca3d('0xa0'),_0xca3d('0x64'),_0xca3d('0x5b'),'updatedAt'],squel[_0xca3d('0xa1')]()['field'](_0xca3d('0x9e'),_0xca3d('0x9e'))[_0xca3d('0xa2')](_0xca3d('0xa3'),_0xca3d('0x9f'))[_0xca3d('0xa2')]('id',_0xca3d('0xa4'))['field'](_0xb62bfa[_0xca3d('0xa5')]['toString'](),_0xca3d('0xa0'))[_0xca3d('0xa2')](_0x34598b[_0xca3d('0x51')]['id'][_0xca3d('0x88')](),'VoiceQueueId')[_0xca3d('0xa2')](_0xca3d('0xa3'),_0xca3d('0x5b'))[_0xca3d('0xa2')](_0xca3d('0xa3'),_0xca3d('0x5d'))[_0xca3d('0xa6')]('cm_contacts')['where'](_0xca3d('0xa7'))['where'](_0xca3d('0xa8'),_0xb62bfa[_0xca3d('0xa5')][_0xca3d('0x88')]())[_0xca3d('0x45')](_0xca3d('0xa9'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xca3d('0xa1')]()[_0xca3d('0xa2')](_0xca3d('0xaa'))['from'](_0xca3d('0xab'))[_0xca3d('0x45')](_0xca3d('0x85'),_0x34598b[_0xca3d('0x51')]['id'][_0xca3d('0x88')]()))['where'](_0xca3d('0xac'),squel[_0xca3d('0xa1')]()[_0xca3d('0xa2')](_0xca3d('0xad'))['from'](_0xca3d('0x9d'))['where'](_0xca3d('0x85'),_0x34598b['params']['id'][_0xca3d('0x88')]())))['toString']();break;case _0xca3d('0xae'):_0x176a49=squel[_0xca3d('0x9c')]()[_0xca3d('0xaf')](_0xca3d('0x9d'))[_0xca3d('0xb0')]([_0xca3d('0x9e'),_0xca3d('0x9f'),_0xca3d('0xa4'),_0xca3d('0xa0'),_0xca3d('0x64'),_0xca3d('0x5b'),_0xca3d('0x5d')],squel['select']()[_0xca3d('0xa2')](_0xca3d('0x9e'),'phone')['field'](_0xca3d('0xa3'),_0xca3d('0x9f'))[_0xca3d('0xa2')]('id',_0xca3d('0xa4'))['field'](_0xb62bfa[_0xca3d('0xa5')][_0xca3d('0x88')](),_0xca3d('0xa0'))['field'](_0x34598b['params']['id'][_0xca3d('0x88')](),_0xca3d('0x64'))[_0xca3d('0xa2')](_0xca3d('0xa3'),_0xca3d('0x5b'))[_0xca3d('0xa2')]('NOW()',_0xca3d('0x5d'))[_0xca3d('0xa6')](_0xca3d('0xb1'))[_0xca3d('0x45')](_0xca3d('0xa7'))['where'](_0xca3d('0xa8'),_0xb62bfa[_0xca3d('0xa5')]['toString']())[_0xca3d('0x45')](_0xca3d('0xa9'))[_0xca3d('0x45')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xca3d('0xa2')]('COALESCE(phone,\x27\x27)')[_0xca3d('0xa6')]('cm_hopper')[_0xca3d('0x45')](_0xca3d('0x85'),_0x34598b[_0xca3d('0x51')]['id'][_0xca3d('0x88')]())))[_0xca3d('0x88')]();break;default:_0x176a49=squel['insert']()['into'](_0xca3d('0x9d'))[_0xca3d('0xb0')](['phone',_0xca3d('0x9f'),_0xca3d('0xa4'),_0xca3d('0xa0'),'VoiceQueueId',_0xca3d('0x5b'),'updatedAt'],squel[_0xca3d('0xa1')]()[_0xca3d('0xa2')](_0xca3d('0x9e'),_0xca3d('0x9e'))['field'](_0xca3d('0xa3'),_0xca3d('0x9f'))[_0xca3d('0xa2')]('id','ContactId')['field'](_0xb62bfa['CmListId']['toString'](),_0xca3d('0xa0'))[_0xca3d('0xa2')](_0x34598b[_0xca3d('0x51')]['id'][_0xca3d('0x88')](),_0xca3d('0x64'))[_0xca3d('0xa2')](_0xca3d('0xa3'),_0xca3d('0x5b'))[_0xca3d('0xa2')]('NOW()',_0xca3d('0x5d'))[_0xca3d('0xa6')]('cm_contacts')['where'](_0xca3d('0xa7'))[_0xca3d('0x45')](_0xca3d('0xa8'),_0xb62bfa['CmListId'][_0xca3d('0x88')]())[_0xca3d('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xca3d('0x88')]();}_0x304e96['push'](db[_0xca3d('0x87')][_0xca3d('0x3c')](_0x176a49));}return BPromise[_0xca3d('0x8a')](_0x304e96);}})[_0xca3d('0x2a')](function(){return _0x10b96f;})[_0xca3d('0x2a')](respondWithResult(_0x18b956,null))[_0xca3d('0x4f')](handleError(_0x18b956,null));};exports[_0xca3d('0xb2')]=function(_0x22402f,_0x2bbc13,_0xa5663e){return db[_0xca3d('0x38')][_0xca3d('0x34')]({'where':{'id':_0x22402f[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x2bbc13,null))['then'](function(_0x56f89f){if(_0x56f89f){return _0x56f89f['removeLists'](_0x22402f[_0xca3d('0x3c')]['ids']);}})[_0xca3d('0x2a')](function(_0x4567f){if(_0x4567f){return db[_0xca3d('0x60')][_0xca3d('0x2b')]({'where':{'ListId':_0x22402f[_0xca3d('0x3c')][_0xca3d('0x7f')],'VoiceQueueId':_0x22402f[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](function(){return _0x4567f;});}})[_0xca3d('0x2a')](respondWithStatusCode(_0x2bbc13,null))[_0xca3d('0x4f')](handleError(_0x2bbc13,null));};exports[_0xca3d('0xb3')]=function(_0x1bb5a6,_0x4516f2,_0x462910){var _0x4c131a={};var _0x28960f={};var _0x3347b0;var _0x50cce0;return db[_0xca3d('0x38')][_0xca3d('0x63')]({'where':{'id':_0x1bb5a6[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x4516f2,null))[_0xca3d('0x2a')](function(_0x44a82d){if(_0x44a82d){_0x3347b0=_0x44a82d;_0x28960f[_0xca3d('0x3b')]=_[_0xca3d('0x52')](db[_0xca3d('0x96')][_0xca3d('0x53')]);_0x28960f['query']=_[_0xca3d('0x52')](_0x1bb5a6['query']);_0x28960f['filters']=_[_0xca3d('0x3e')](_0x28960f[_0xca3d('0x3b')],_0x28960f['query']);_0x4c131a['attributes']=_['intersection'](_0x28960f['model'],qs[_0xca3d('0x40')](_0x1bb5a6[_0xca3d('0x3c')][_0xca3d('0x40')]));_0x4c131a[_0xca3d('0x3f')]=_0x4c131a[_0xca3d('0x3f')][_0xca3d('0x41')]?_0x4c131a['attributes']:_0x28960f[_0xca3d('0x3b')];_0x4c131a[_0xca3d('0x61')]=qs[_0xca3d('0x44')](_0x1bb5a6[_0xca3d('0x3c')][_0xca3d('0x44')]);_0x4c131a['where']=qs[_0xca3d('0x3d')](_[_0xca3d('0x46')](_0x1bb5a6['query'],_0x28960f[_0xca3d('0x3d')]));if(_0x1bb5a6[_0xca3d('0x3c')][_0xca3d('0x47')]){_0x4c131a['where']=_['merge'](_0x4c131a[_0xca3d('0x45')],{'$or':_[_0xca3d('0x48')](_0x4c131a['attributes'],function(_0x3b3980){var _0x5a2487={};_0x5a2487[_0x3b3980]={'$like':'%'+_0x1bb5a6[_0xca3d('0x3c')][_0xca3d('0x47')]+'%'};return _0x5a2487;})});}_0x4c131a=_[_0xca3d('0x49')]({},_0x4c131a,_0x1bb5a6[_0xca3d('0x4a')]);return _0x3347b0[_0xca3d('0xb3')](_0x4c131a);}})[_0xca3d('0x2a')](function(_0x3c0d82){if(_0x3c0d82){_0x50cce0=_0x3c0d82[_0xca3d('0x41')];if(!_0x1bb5a6['query'][_0xca3d('0x42')](_0xca3d('0x43'))){_0x4c131a[_0xca3d('0x21')]=qs[_0xca3d('0x21')](_0x1bb5a6[_0xca3d('0x3c')][_0xca3d('0x21')]);_0x4c131a['offset']=qs[_0xca3d('0x20')](_0x1bb5a6[_0xca3d('0x3c')][_0xca3d('0x20')]);}return _0x3347b0[_0xca3d('0xb3')](_0x4c131a);}})[_0xca3d('0x2a')](function(_0x405a58){if(_0x405a58){return _0x405a58?{'count':_0x50cce0,'rows':_0x405a58}:null;}})[_0xca3d('0x2a')](respondWithResult(_0x4516f2,null))['catch'](handleError(_0x4516f2,null));};exports[_0xca3d('0xb4')]=function(_0xefbd0a,_0x3dc259,_0x3ceea9){var _0x2637e2,_0x4bcb11;return db[_0xca3d('0x38')][_0xca3d('0x34')]({'where':{'id':_0xefbd0a['params']['id']}})['then'](handleEntityNotFound(_0x3dc259,null))[_0xca3d('0x2a')](function(_0x17dc8f){if(_0x17dc8f){_0x4bcb11=_0x17dc8f;return _0x17dc8f[_0xca3d('0xb4')](_0xefbd0a[_0xca3d('0x5c')][_0xca3d('0x7f')],_[_0xca3d('0x99')](_0xefbd0a[_0xca3d('0x5c')],[_0xca3d('0x7f'),'id'])||{});}return null;})[_0xca3d('0x91')](function(_0x14c4a4){var _0x325090;_0x2637e2=_0x14c4a4||[];var _0x5691a5=[];if(_0x14c4a4){for(var _0x1dffde=0x0;_0x1dffde<_0x14c4a4[_0xca3d('0x41')];_0x1dffde+=0x1){var _0x41d205=_0x14c4a4[_0x1dffde][_0xca3d('0x2c')]({'plain':!![]});_0x325090=squel['insert']()['into'](_0xca3d('0xb5'))['fromQuery']([_0xca3d('0x9e'),_0xca3d('0xa4'),'ListId',_0xca3d('0x64'),_0xca3d('0x5b'),_0xca3d('0x5d')],squel[_0xca3d('0xa1')]()['field'](_0xca3d('0x9e'),_0xca3d('0x9e'))[_0xca3d('0xa2')]('id',_0xca3d('0xa4'))[_0xca3d('0xa2')](_0x41d205[_0xca3d('0xa5')][_0xca3d('0x88')](),_0xca3d('0xa0'))[_0xca3d('0xa2')](_0xefbd0a[_0xca3d('0x51')]['id'][_0xca3d('0x88')](),_0xca3d('0x64'))[_0xca3d('0xa2')]('NOW()',_0xca3d('0x5b'))[_0xca3d('0xa2')](_0xca3d('0xa3'),_0xca3d('0x5d'))[_0xca3d('0xa6')](_0xca3d('0xb1'))[_0xca3d('0x45')](_0xca3d('0xa7'))['where']('ListId\x20=\x20?',_0x41d205['CmListId'][_0xca3d('0x88')]())[_0xca3d('0x45')](_0xca3d('0xa9')))[_0xca3d('0x88')]();_0x5691a5[_0xca3d('0x92')](db[_0xca3d('0x87')]['query'](_0x325090));}return BPromise[_0xca3d('0x8a')](_0x5691a5);}})[_0xca3d('0x2a')](function(){return _0x2637e2;})[_0xca3d('0x2a')](respondWithResult(_0x3dc259,null))['catch'](handleError(_0x3dc259,null));};exports[_0xca3d('0xb6')]=function(_0x1e2747,_0x11ffe4,_0x7b55b7){return db[_0xca3d('0x38')]['find']({'where':{'id':_0x1e2747[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](handleEntityNotFound(_0x11ffe4,null))['then'](function(_0x8290ff){if(_0x8290ff){return _0x8290ff[_0xca3d('0xb6')](_0x1e2747[_0xca3d('0x3c')]['ids']);}})[_0xca3d('0x2a')](function(_0x391825){if(_0x391825){return db[_0xca3d('0x69')]['destroy']({'where':{'ListId':_0x1e2747[_0xca3d('0x3c')][_0xca3d('0x7f')],'VoiceQueueId':_0x1e2747[_0xca3d('0x51')]['id']}})[_0xca3d('0x2a')](function(){return _0x391825;});}})['then'](respondWithStatusCode(_0x11ffe4,null))[_0xca3d('0x4f')](handleError(_0x11ffe4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 70eb97f..52ab57c 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 _0x5e95=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x469829,_0x1a922e){var _0x489583=function(_0x4c7812){while(--_0x4c7812){_0x469829['push'](_0x469829['shift']());}};_0x489583(++_0x1a922e);}(_0x5e95,0xb4));var _0x55e9=function(_0x4d7cfc,_0x3c748f){_0x4d7cfc=_0x4d7cfc-0x0;var _0x3eb4e5=_0x5e95[_0x4d7cfc];return _0x3eb4e5;};'use strict';var EventEmitter=require(_0x55e9('0x0'));var VoiceQueue=require(_0x55e9('0x1'))['db'][_0x55e9('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x55e9('0x3')](0x0);var events={'afterCreate':_0x55e9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b25d8){return function(_0x5d391c,_0x81ac81,_0xf86cd6){VoiceQueueEvents[_0x55e9('0x5')](_0x3b25d8+':'+_0x5d391c['id'],_0x5d391c);VoiceQueueEvents[_0x55e9('0x5')](_0x3b25d8,_0x5d391c);_0xf86cd6(null);};}for(var e in events){if(events[_0x55e9('0x6')](e)){var event=events[e];VoiceQueue[_0x55e9('0x7')](e,emitEvent(event));}}module[_0x55e9('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xc207=['remove','emit','hook','exports','../../mysqldb','VoiceQueue','save','update'];(function(_0x4afdb1,_0x3881f8){var _0x90bdf2=function(_0x1ed64c){while(--_0x1ed64c){_0x4afdb1['push'](_0x4afdb1['shift']());}};_0x90bdf2(++_0x3881f8);}(_0xc207,0x18c));var _0x7c20=function(_0x4421a0,_0x1525bc){_0x4421a0=_0x4421a0-0x0;var _0x5626d0=_0xc207[_0x4421a0];return _0x5626d0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x7c20('0x0'))['db'][_0x7c20('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7c20('0x2'),'afterUpdate':_0x7c20('0x3'),'afterDestroy':_0x7c20('0x4')};function emitEvent(_0x30e7fb){return function(_0x2357c0,_0xc454bd,_0x3e5282){VoiceQueueEvents['emit'](_0x30e7fb+':'+_0x2357c0['id'],_0x2357c0);VoiceQueueEvents[_0x7c20('0x5')](_0x30e7fb,_0x2357c0);_0x3e5282(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x7c20('0x6')](e,emitEvent(event));}}module[_0x7c20('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 12de271..9d6b0f9 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0xe89ba,_0x19472b){var _0xd1266e=function(_0x1b692c){while(--_0x1b692c){_0xe89ba['push'](_0xe89ba['shift']());}};_0xd1266e(++_0x19472b);}(_0x34e8,0x12c));var _0x834e=function(_0x1cb891,_0x4715e0){_0x1cb891=_0x1cb891-0x0;var _0x545f56=_0x34e8[_0x1cb891];return _0x545f56;};'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 +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x30fde3,_0x69fd6){var _0x45703f=function(_0x470c4e){while(--_0x470c4e){_0x30fde3['push'](_0x30fde3['shift']());}};_0x45703f(++_0x69fd6);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'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 a2387d9..2b6bdeb 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 _0x9b19=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueue','findAll','options','include','model','attributes','map','then','ShowVoiceQueue','VoiceQueue','raw','catch','lodash','moment'];(function(_0x45515e,_0x526ba7){var _0x40cb36=function(_0x32366){while(--_0x32366){_0x45515e['push'](_0x45515e['shift']());}};_0x40cb36(++_0x526ba7);}(_0x9b19,0x1a2));var _0x99b1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9b19[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x99b1('0x0'));var util=require('util');var moment=require(_0x99b1('0x1'));var BPromise=require(_0x99b1('0x2'));var rs=require(_0x99b1('0x3'));var fs=require('fs');var Redis=require(_0x99b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99b1('0x5'));var logger=require(_0x99b1('0x6'))('rpc');var config=require(_0x99b1('0x7'));var jayson=require(_0x99b1('0x8'));var client=jayson['client'][_0x99b1('0x9')]({'port':0x232a});config['redis']=_[_0x99b1('0xa')](config[_0x99b1('0xb')],{'host':_0x99b1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99b1('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x232bb9,_0x7c5631,_0x5d446d){return new BPromise(function(_0x393789,_0x124a76){return client['request'](_0x232bb9,_0x5d446d)['then'](function(_0x2c7e62){logger['info'](_0x99b1('0xd'),_0x7c5631,_0x99b1('0xe'));logger[_0x99b1('0xf')](_0x99b1('0x10'),_0x7c5631,_0x99b1('0xe'),JSON[_0x99b1('0x11')](_0x2c7e62));if(_0x2c7e62[_0x99b1('0x12')]){if(_0x2c7e62[_0x99b1('0x12')][_0x99b1('0x13')]===0x1f4){logger[_0x99b1('0x12')](_0x99b1('0xd'),_0x7c5631,_0x2c7e62[_0x99b1('0x12')]['message']);return _0x124a76(_0x2c7e62[_0x99b1('0x12')][_0x99b1('0x14')]);}logger[_0x99b1('0x12')](_0x99b1('0xd'),_0x7c5631,_0x2c7e62[_0x99b1('0x12')][_0x99b1('0x14')]);return _0x393789(_0x2c7e62[_0x99b1('0x12')][_0x99b1('0x14')]);}else{logger[_0x99b1('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x7c5631,'request\x20sent');_0x393789(_0x2c7e62[_0x99b1('0x16')][_0x99b1('0x14')]);}})['catch'](function(_0x3599b1){logger[_0x99b1('0x12')](_0x99b1('0xd'),_0x7c5631,_0x3599b1);_0x124a76(_0x3599b1);});});}exports[_0x99b1('0x17')]=function(_0x5c56c7){var _0x1cd4e2=this;return new Promise(function(_0x14aced,_0x277041){return db['VoiceQueue'][_0x99b1('0x18')]({'raw':_0x5c56c7[_0x99b1('0x19')]?_0x5c56c7[_0x99b1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5c56c7[_0x99b1('0x19')]?_0x5c56c7['options']['where']||null:null,'attributes':_0x5c56c7[_0x99b1('0x19')]?_0x5c56c7['options']['attributes']||null:null,'limit':_0x5c56c7[_0x99b1('0x19')]?_0x5c56c7[_0x99b1('0x19')]['limit']||null:null,'include':_0x5c56c7['options']?_0x5c56c7[_0x99b1('0x19')][_0x99b1('0x1a')]?_['map'](_0x5c56c7[_0x99b1('0x19')][_0x99b1('0x1a')],function(_0x3b75a5){return{'model':db[_0x3b75a5[_0x99b1('0x1b')]],'as':_0x3b75a5['as'],'attributes':_0x3b75a5[_0x99b1('0x1c')],'include':_0x3b75a5[_0x99b1('0x1a')]?_[_0x99b1('0x1d')](_0x3b75a5[_0x99b1('0x1a')],function(_0x38b483){return{'model':db[_0x38b483[_0x99b1('0x1b')]],'as':_0x38b483['as'],'attributes':_0x38b483[_0x99b1('0x1c')],'include':_0x38b483[_0x99b1('0x1a')]?_[_0x99b1('0x1d')](_0x38b483[_0x99b1('0x1a')],function(_0x472b96){return{'model':db[_0x472b96[_0x99b1('0x1b')]],'as':_0x472b96['as'],'attributes':_0x472b96[_0x99b1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x99b1('0x1e')](function(_0x2356e5){logger[_0x99b1('0x15')](_0x99b1('0x17'),_0x5c56c7);logger['debug'](_0x99b1('0x17'),_0x5c56c7,JSON[_0x99b1('0x11')](_0x2356e5));_0x14aced(_0x2356e5);})['catch'](function(_0x2df9c6){logger[_0x99b1('0x12')]('GetVoiceQueue',_0x2df9c6['message'],_0x5c56c7);_0x277041(_0x1cd4e2[_0x99b1('0x12')](0x1f4,_0x2df9c6[_0x99b1('0x14')]));});});};exports[_0x99b1('0x1f')]=function(_0x6021c8){var _0x4e34f1=this;return new Promise(function(_0x5aebbe,_0x40fb2f){return db[_0x99b1('0x20')]['find']({'raw':_0x6021c8['options']?_0x6021c8[_0x99b1('0x19')][_0x99b1('0x21')]===undefined?!![]:![]:!![],'where':_0x6021c8[_0x99b1('0x19')]?_0x6021c8['options']['where']||null:null,'attributes':_0x6021c8[_0x99b1('0x19')]?_0x6021c8['options']['attributes']||null:null,'include':_0x6021c8[_0x99b1('0x19')]?_0x6021c8[_0x99b1('0x19')][_0x99b1('0x1a')]?_[_0x99b1('0x1d')](_0x6021c8['options']['include'],function(_0x55344e){return{'model':db[_0x55344e[_0x99b1('0x1b')]],'as':_0x55344e['as'],'attributes':_0x55344e[_0x99b1('0x1c')],'include':_0x55344e[_0x99b1('0x1a')]?_[_0x99b1('0x1d')](_0x55344e[_0x99b1('0x1a')],function(_0x3e6a3e){return{'model':db[_0x3e6a3e[_0x99b1('0x1b')]],'as':_0x3e6a3e['as'],'attributes':_0x3e6a3e[_0x99b1('0x1c')],'include':_0x3e6a3e['include']?_['map'](_0x3e6a3e[_0x99b1('0x1a')],function(_0x102739){return{'model':db[_0x102739['model']],'as':_0x102739['as'],'attributes':_0x102739[_0x99b1('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b327d){logger[_0x99b1('0x15')](_0x99b1('0x1f'),_0x6021c8);logger[_0x99b1('0xf')](_0x99b1('0x1f'),_0x6021c8,JSON[_0x99b1('0x11')](_0x3b327d));_0x5aebbe(_0x3b327d);})[_0x99b1('0x22')](function(_0x2d3b89){logger['error'](_0x99b1('0x1f'),_0x2d3b89[_0x99b1('0x14')],_0x6021c8);_0x40fb2f(_0x4e34f1[_0x99b1('0x12')](0x1f4,_0x2d3b89[_0x99b1('0x14')]));});});}; \ No newline at end of file +var _0x7ce4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','include','map','model','ShowVoiceQueue','find','lodash','util','bluebird'];(function(_0x5bcf32,_0x40523f){var _0x914a10=function(_0x217a8c){while(--_0x217a8c){_0x5bcf32['push'](_0x5bcf32['shift']());}};_0x914a10(++_0x40523f);}(_0x7ce4,0x1dd));var _0x47ce=function(_0x1416e5,_0x14cbcb){_0x1416e5=_0x1416e5-0x0;var _0x2d765f=_0x7ce4[_0x1416e5];return _0x2d765f;};'use strict';var _=require(_0x47ce('0x0'));var util=require(_0x47ce('0x1'));var moment=require('moment');var BPromise=require(_0x47ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47ce('0x3'));var db=require(_0x47ce('0x4'))['db'];var utils=require(_0x47ce('0x5'));var logger=require(_0x47ce('0x6'))('rpc');var config=require(_0x47ce('0x7'));var jayson=require(_0x47ce('0x8'));var client=jayson[_0x47ce('0x9')][_0x47ce('0xa')]({'port':0x232a});config[_0x47ce('0xb')]=_[_0x47ce('0xc')](config[_0x47ce('0xb')],{'host':_0x47ce('0xd'),'port':0x18eb});var socket=require(_0x47ce('0xe'))(new Redis(config[_0x47ce('0xb')]));require(_0x47ce('0xf'))[_0x47ce('0x10')](socket);function respondWithRpcPromise(_0x4161f5,_0x44419a,_0x65a936){return new BPromise(function(_0x24566c,_0x502501){return client[_0x47ce('0x11')](_0x4161f5,_0x65a936)[_0x47ce('0x12')](function(_0x1dc582){logger[_0x47ce('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x44419a,'request\x20sent');logger[_0x47ce('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x44419a,'request\x20sent',JSON[_0x47ce('0x15')](_0x1dc582));if(_0x1dc582[_0x47ce('0x16')]){if(_0x1dc582[_0x47ce('0x16')][_0x47ce('0x17')]===0x1f4){logger[_0x47ce('0x16')](_0x47ce('0x18'),_0x44419a,_0x1dc582[_0x47ce('0x16')][_0x47ce('0x19')]);return _0x502501(_0x1dc582[_0x47ce('0x16')][_0x47ce('0x19')]);}logger[_0x47ce('0x16')](_0x47ce('0x18'),_0x44419a,_0x1dc582[_0x47ce('0x16')]['message']);return _0x24566c(_0x1dc582[_0x47ce('0x16')][_0x47ce('0x19')]);}else{logger[_0x47ce('0x13')](_0x47ce('0x18'),_0x44419a,_0x47ce('0x1a'));_0x24566c(_0x1dc582[_0x47ce('0x1b')]['message']);}})[_0x47ce('0x1c')](function(_0x4da201){logger[_0x47ce('0x16')](_0x47ce('0x18'),_0x44419a,_0x4da201);_0x502501(_0x4da201);});});}exports[_0x47ce('0x1d')]=function(_0x5069ac){var _0x4968dc=this;return new Promise(function(_0x5c3e57,_0x26740f){return db[_0x47ce('0x1e')][_0x47ce('0x1f')]({'raw':_0x5069ac[_0x47ce('0x20')]?_0x5069ac[_0x47ce('0x20')][_0x47ce('0x21')]===undefined?!![]:![]:!![],'where':_0x5069ac[_0x47ce('0x20')]?_0x5069ac['options']['where']||null:null,'attributes':_0x5069ac[_0x47ce('0x20')]?_0x5069ac[_0x47ce('0x20')][_0x47ce('0x22')]||null:null,'limit':_0x5069ac['options']?_0x5069ac[_0x47ce('0x20')]['limit']||null:null,'include':_0x5069ac[_0x47ce('0x20')]?_0x5069ac['options'][_0x47ce('0x23')]?_[_0x47ce('0x24')](_0x5069ac[_0x47ce('0x20')][_0x47ce('0x23')],function(_0x62ea2e){return{'model':db[_0x62ea2e[_0x47ce('0x25')]],'as':_0x62ea2e['as'],'attributes':_0x62ea2e[_0x47ce('0x22')],'include':_0x62ea2e[_0x47ce('0x23')]?_[_0x47ce('0x24')](_0x62ea2e[_0x47ce('0x23')],function(_0x37ff53){return{'model':db[_0x37ff53[_0x47ce('0x25')]],'as':_0x37ff53['as'],'attributes':_0x37ff53['attributes'],'include':_0x37ff53['include']?_[_0x47ce('0x24')](_0x37ff53['include'],function(_0x3fa574){return{'model':db[_0x3fa574[_0x47ce('0x25')]],'as':_0x3fa574['as'],'attributes':_0x3fa574[_0x47ce('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d15fa){logger[_0x47ce('0x13')](_0x47ce('0x1d'),_0x5069ac);logger[_0x47ce('0x14')]('GetVoiceQueue',_0x5069ac,JSON['stringify'](_0x2d15fa));_0x5c3e57(_0x2d15fa);})[_0x47ce('0x1c')](function(_0x396a72){logger[_0x47ce('0x16')]('GetVoiceQueue',_0x396a72[_0x47ce('0x19')],_0x5069ac);_0x26740f(_0x4968dc[_0x47ce('0x16')](0x1f4,_0x396a72[_0x47ce('0x19')]));});});};exports[_0x47ce('0x26')]=function(_0x5c6d4a){var _0x46ee4d=this;return new Promise(function(_0x7d5df9,_0x571e39){return db[_0x47ce('0x1e')][_0x47ce('0x27')]({'raw':_0x5c6d4a[_0x47ce('0x20')]?_0x5c6d4a[_0x47ce('0x20')][_0x47ce('0x21')]===undefined?!![]:![]:!![],'where':_0x5c6d4a[_0x47ce('0x20')]?_0x5c6d4a[_0x47ce('0x20')]['where']||null:null,'attributes':_0x5c6d4a[_0x47ce('0x20')]?_0x5c6d4a['options']['attributes']||null:null,'include':_0x5c6d4a[_0x47ce('0x20')]?_0x5c6d4a[_0x47ce('0x20')][_0x47ce('0x23')]?_[_0x47ce('0x24')](_0x5c6d4a[_0x47ce('0x20')][_0x47ce('0x23')],function(_0x48e372){return{'model':db[_0x48e372[_0x47ce('0x25')]],'as':_0x48e372['as'],'attributes':_0x48e372['attributes'],'include':_0x48e372['include']?_[_0x47ce('0x24')](_0x48e372[_0x47ce('0x23')],function(_0x3af280){return{'model':db[_0x3af280[_0x47ce('0x25')]],'as':_0x3af280['as'],'attributes':_0x3af280[_0x47ce('0x22')],'include':_0x3af280[_0x47ce('0x23')]?_['map'](_0x3af280[_0x47ce('0x23')],function(_0x472f40){return{'model':db[_0x472f40['model']],'as':_0x472f40['as'],'attributes':_0x472f40[_0x47ce('0x22')]};}):[]};}):[]};}):[]:[]})[_0x47ce('0x12')](function(_0x388384){logger[_0x47ce('0x13')](_0x47ce('0x26'),_0x5c6d4a);logger[_0x47ce('0x14')](_0x47ce('0x26'),_0x5c6d4a,JSON[_0x47ce('0x15')](_0x388384));_0x7d5df9(_0x388384);})[_0x47ce('0x1c')](function(_0x2fd36a){logger[_0x47ce('0x16')](_0x47ce('0x26'),_0x2fd36a['message'],_0x5c6d4a);_0x571e39(_0x46ee4d['error'](0x1f4,_0x2fd36a[_0x47ce('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6f69512..57d3767 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 _0x7e96=['register','length','voiceQueue:','save','remove','removeListener'];(function(_0x1e73f7,_0x304862){var _0xb7277d=function(_0x4fa918){while(--_0x4fa918){_0x1e73f7['push'](_0x1e73f7['shift']());}};_0xb7277d(++_0x304862);}(_0x7e96,0x129));var _0x67e9=function(_0x5f24c8,_0x3430fb){_0x5f24c8=_0x5f24c8-0x0;var _0x4ef539=_0x7e96[_0x5f24c8];return _0x4ef539;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x67e9('0x0'),_0x67e9('0x1'),'update'];function createListener(_0x59b6c7,_0x135a5e){return function(_0xc291ee){_0x135a5e['emit'](_0x59b6c7,_0xc291ee);};}function removeListener(_0x10b105,_0x1ba4cf){return function(){VoiceQueueEvents[_0x67e9('0x2')](_0x10b105,_0x1ba4cf);};}exports[_0x67e9('0x3')]=function(_0x1f51f1){for(var _0x23c221=0x0,_0x52180=events[_0x67e9('0x4')];_0x23c221<_0x52180;_0x23c221++){var _0x3159b6=events[_0x23c221];var _0x1fc50d=createListener(_0x67e9('0x5')+_0x3159b6,_0x1f51f1);VoiceQueueEvents['on'](_0x3159b6,_0x1fc50d);}}; \ No newline at end of file +var _0xd543=['save','update','emit','removeListener','register','length','./voiceQueue.events'];(function(_0x4ff091,_0x94e491){var _0x1bb7f1=function(_0x104e2a){while(--_0x104e2a){_0x4ff091['push'](_0x4ff091['shift']());}};_0x1bb7f1(++_0x94e491);}(_0xd543,0x125));var _0x3d54=function(_0x4e294e,_0x11912f){_0x4e294e=_0x4e294e-0x0;var _0x4bfeb6=_0xd543[_0x4e294e];return _0x4bfeb6;};'use strict';var VoiceQueueEvents=require(_0x3d54('0x0'));var events=[_0x3d54('0x1'),'remove',_0x3d54('0x2')];function createListener(_0x6c95f6,_0x54864b){return function(_0x5d895d){_0x54864b[_0x3d54('0x3')](_0x6c95f6,_0x5d895d);};}function removeListener(_0x489e4a,_0x286beb){return function(){VoiceQueueEvents[_0x3d54('0x4')](_0x489e4a,_0x286beb);};}exports[_0x3d54('0x5')]=function(_0x175224){for(var _0x3d5085=0x0,_0x5a1199=events[_0x3d54('0x6')];_0x3d5085<_0x5a1199;_0x3d5085++){var _0x2c0e35=events[_0x3d5085];var _0x24ddc7=createListener('voiceQueue:'+_0x2c0e35,_0x175224);VoiceQueueEvents['on'](_0x2c0e35,_0x24ddc7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e556f66..0f80dca 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 _0x4bad=['../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','post','update','destroy','multer','util','express','Router','fs-extra'];(function(_0x25a54d,_0x2d84e8){var _0x36b530=function(_0x1dea9d){while(--_0x1dea9d){_0x25a54d['push'](_0x25a54d['shift']());}};_0x36b530(++_0x2d84e8);}(_0x4bad,0x163));var _0xd4ba=function(_0x18af44,_0xa8026d){_0x18af44=_0x18af44-0x0;var _0x1bfd4f=_0x4bad[_0x18af44];return _0x1bfd4f;};'use strict';var multer=require(_0xd4ba('0x0'));var util=require(_0xd4ba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd4ba('0x2'));var router=express[_0xd4ba('0x3')]();var fs_extra=require(_0xd4ba('0x4'));var auth=require(_0xd4ba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd4ba('0x6'));var controller=require(_0xd4ba('0x7'));router[_0xd4ba('0x8')]('/',auth[_0xd4ba('0x9')](),controller[_0xd4ba('0xa')]);router['get']('/describe',auth[_0xd4ba('0x9')](),controller[_0xd4ba('0xb')]);router[_0xd4ba('0x8')](_0xd4ba('0xc'),auth[_0xd4ba('0x9')](),controller[_0xd4ba('0xd')]);router[_0xd4ba('0x8')](_0xd4ba('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xd4ba('0xf')]('/',auth[_0xd4ba('0x9')](),controller['create']);router['put'](_0xd4ba('0xe'),auth['isAuthenticated'](),controller[_0xd4ba('0x10')]);router['delete']('/:id',auth[_0xd4ba('0x9')](),controller[_0xd4ba('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc652=['getVoiceQueuesReport','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3c7ec9,_0x7e16ff){var _0x4e925e=function(_0x377ffa){while(--_0x377ffa){_0x3c7ec9['push'](_0x3c7ec9['shift']());}};_0x4e925e(++_0x7e16ff);}(_0xc652,0x86));var _0x2c65=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0xc652[_0x5b34c0];return _0x242bd3;};'use strict';var multer=require(_0x2c65('0x0'));var util=require(_0x2c65('0x1'));var path=require(_0x2c65('0x2'));var timeout=require(_0x2c65('0x3'));var express=require(_0x2c65('0x4'));var router=express[_0x2c65('0x5')]();var fs_extra=require(_0x2c65('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2c65('0x7'));var config=require('../../config/environment');var controller=require(_0x2c65('0x8'));router[_0x2c65('0x9')]('/',auth[_0x2c65('0xa')](),controller[_0x2c65('0xb')]);router['get'](_0x2c65('0xc'),auth[_0x2c65('0xa')](),controller['describe']);router[_0x2c65('0x9')]('/index',auth[_0x2c65('0xa')](),controller[_0x2c65('0xd')]);router[_0x2c65('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2c65('0xe')]('/',auth[_0x2c65('0xa')](),controller[_0x2c65('0xf')]);router[_0x2c65('0x10')](_0x2c65('0x11'),auth['isAuthenticated'](),controller[_0x2c65('0x12')]);router[_0x2c65('0x13')](_0x2c65('0x11'),auth['isAuthenticated'](),controller[_0x2c65('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index bcc2a2f..091bded 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 _0x940a=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING','DATE','queuecallerjoinAt'];(function(_0x2b8717,_0x4fecb7){var _0x4aec38=function(_0x4ad3ea){while(--_0x4ad3ea){_0x2b8717['push'](_0x2b8717['shift']());}};_0x4aec38(++_0x4fecb7);}(_0x940a,0xce));var _0xa940=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x940a[_0x4a5494];return _0x57cbb5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa940('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa940('0x1')]},'calleridname':{'type':Sequelize[_0xa940('0x1')]},'queue':{'type':Sequelize[_0xa940('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xa940('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xa940('0x2')],'set':function(_0x3a1d03){var _0x598780=moment(_0x3a1d03);var _0x415bbc=moment(this['getDataValue'](_0xa940('0x3')))[_0xa940('0x4')](_0xa940('0x5'));var _0x551dd9=_0x598780[_0xa940('0x6')](_0x415bbc,_0xa940('0x7'));this[_0xa940('0x8')](_0xa940('0x9'),_0x3a1d03);this[_0xa940('0x8')]('holdtime',_0x551dd9||null);}},'position':{'type':Sequelize[_0xa940('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xa940('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa940('0x2')]},'queuecallercomplete':{'type':Sequelize[_0xa940('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa940('0x2')]},'queuecallerexit':{'type':Sequelize[_0xa940('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa940('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xa940('0x1')],'comment':_0xa940('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa940('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa940('0x1')]},'priority':{'type':Sequelize[_0xa940('0x1')]},'holdtime':{'type':Sequelize[_0xa940('0xa')]},'mohtime':{'type':Sequelize[_0xa940('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa940('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa940('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa940('0x1')],'comment':_0xa940('0xd')},'transferexten':{'type':Sequelize[_0xa940('0x1')]},'transferuniqueid':{'type':Sequelize[_0xa940('0x1')]},'disposition':{'type':Sequelize[_0xa940('0x1')]},'secondDisposition':{'type':Sequelize[_0xa940('0x1')]},'thirdDisposition':{'type':Sequelize[_0xa940('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd03c=['seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x3b3e01,_0x2e7761){var _0x4ad9f6=function(_0x8c7f4f){while(--_0x8c7f4f){_0x3b3e01['push'](_0x3b3e01['shift']());}};_0x4ad9f6(++_0x2e7761);}(_0xd03c,0x6f));var _0xcd03=function(_0x409562,_0x4fc288){_0x409562=_0x409562-0x0;var _0x425ffa=_0xd03c[_0x409562];return _0x425ffa;};'use strict';var Sequelize=require(_0xcd03('0x0'));var moment=require('moment');module[_0xcd03('0x1')]={'type':{'type':Sequelize[_0xcd03('0x2')]},'uniqueid':{'type':Sequelize[_0xcd03('0x2')]},'calleridnum':{'type':Sequelize[_0xcd03('0x2')]},'calleridname':{'type':Sequelize[_0xcd03('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xcd03('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xcd03('0x3')],'set':function(_0x3fb7f7){var _0x546271=moment(_0x3fb7f7);var _0x230847=moment(this[_0xcd03('0x4')](_0xcd03('0x5')))[_0xcd03('0x6')](_0xcd03('0x7'));var _0x1df0cc=_0x546271[_0xcd03('0x8')](_0x230847,_0xcd03('0x9'));this['setDataValue']('queuecallerleaveAt',_0x3fb7f7);this[_0xcd03('0xa')](_0xcd03('0xb'),_0x1df0cc||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xcd03('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xcd03('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xcd03('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xcd03('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xcd03('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xcd03('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xcd03('0xc')]},'channel':{'type':Sequelize[_0xcd03('0x2')]},'connectedlinenum':{'type':Sequelize[_0xcd03('0x2')]},'connectedlinename':{'type':Sequelize[_0xcd03('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcd03('0x2')]},'holdtime':{'type':Sequelize[_0xcd03('0xc')]},'mohtime':{'type':Sequelize[_0xcd03('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcd03('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcd03('0x2')]},'transfer':{'type':Sequelize[_0xcd03('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcd03('0x2')],'comment':_0xcd03('0xe')},'transferexten':{'type':Sequelize[_0xcd03('0x2')]},'transferuniqueid':{'type':Sequelize[_0xcd03('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcd03('0x2')]},'thirdDisposition':{'type':Sequelize[_0xcd03('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index edd7c14..ae48e99 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 _0x2f48=['show','find','create','update','body','params','describe','getVoiceQueuesReport','hasOwnProperty','includeAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','destroy','then','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x2d0895,_0x3fd641){var _0x333305=function(_0x110a96){while(--_0x110a96){_0x2d0895['push'](_0x2d0895['shift']());}};_0x333305(++_0x3fd641);}(_0x2f48,0xb0));var _0x82f4=function(_0x37fed0,_0x1f0f09){_0x37fed0=_0x37fed0-0x0;var _0x45ca0a=_0x2f48[_0x37fed0];return _0x45ca0a;};'use strict';var emlformat=require(_0x82f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x82f4('0x1'));var jsonpatch=require(_0x82f4('0x2'));var rp=require(_0x82f4('0x3'));var moment=require('moment');var BPromise=require(_0x82f4('0x4'));var Mustache=require(_0x82f4('0x5'));var util=require(_0x82f4('0x6'));var path=require(_0x82f4('0x7'));var sox=require(_0x82f4('0x8'));var csv=require('to-csv');var ejs=require(_0x82f4('0x9'));var fs=require('fs');var fs_extra=require(_0x82f4('0xa'));var _=require(_0x82f4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f4('0xc'));var toCsv=require(_0x82f4('0xd'));var querystring=require(_0x82f4('0xe'));var Papa=require(_0x82f4('0xf'));var Redis=require(_0x82f4('0x10'));var authService=require(_0x82f4('0x11'));var qs=require(_0x82f4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x82f4('0x13'))(_0x82f4('0x14'));var utils=require(_0x82f4('0x15'));var config=require(_0x82f4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x82f4('0x17'))['db'];config[_0x82f4('0x18')]=_[_0x82f4('0x19')](config['redis'],{'host':_0x82f4('0x1a'),'port':0x18eb});var socket=require(_0x82f4('0x1b'))(new Redis(config[_0x82f4('0x18')]));require('./voiceQueueReport.socket')[_0x82f4('0x1c')](socket);function respondWithStatusCode(_0x2752bc,_0x225786){_0x225786=_0x225786||0xcc;return function(_0x3f0e30){if(_0x3f0e30){return _0x2752bc[_0x82f4('0x1d')](_0x225786);}return _0x2752bc[_0x82f4('0x1e')](_0x225786)[_0x82f4('0x1f')]();};}function respondWithResult(_0x16fd8f,_0x1f4150){_0x1f4150=_0x1f4150||0xc8;return function(_0x288a2f){if(_0x288a2f){return _0x16fd8f[_0x82f4('0x1e')](_0x1f4150)[_0x82f4('0x20')](_0x288a2f);}};}function respondWithFilteredResult(_0x53195d,_0x244f98){return function(_0x1208d4){if(_0x1208d4){var _0xcbf5a4=typeof _0x244f98['offset']===_0x82f4('0x21')&&typeof _0x244f98[_0x82f4('0x22')]===_0x82f4('0x21');var _0x2f1ad3=_0x1208d4['count'];var _0x39bebe=_0xcbf5a4?0x0:_0x244f98[_0x82f4('0x23')];var _0x38b6bf=_0xcbf5a4?_0x1208d4[_0x82f4('0x24')]:_0x244f98[_0x82f4('0x23')]+_0x244f98[_0x82f4('0x22')];var _0x56908c;if(_0x38b6bf>=_0x2f1ad3){_0x38b6bf=_0x2f1ad3;_0x56908c=0xc8;}else{_0x56908c=0xce;}_0x53195d[_0x82f4('0x1e')](_0x56908c);return _0x53195d[_0x82f4('0x25')]('Content-Range',_0x39bebe+'-'+_0x38b6bf+'/'+_0x2f1ad3)[_0x82f4('0x20')](_0x1208d4);}return null;};}function patchUpdates(_0x4c3bf8){return function(_0x152b97){try{jsonpatch[_0x82f4('0x26')](_0x152b97,_0x4c3bf8,!![]);}catch(_0x384763){return BPromise[_0x82f4('0x27')](_0x384763);}return _0x152b97[_0x82f4('0x28')]();};}function saveUpdates(_0x4a0cca,_0x61fdc3){return function(_0x58f284){if(_0x58f284){return _0x58f284['update'](_0x4a0cca)['then'](function(_0xdca6c3){return _0xdca6c3;});}return null;};}function removeEntity(_0x3370a7,_0x3ba72d){return function(_0x59f3bc){if(_0x59f3bc){return _0x59f3bc[_0x82f4('0x29')]()[_0x82f4('0x2a')](function(){_0x3370a7['status'](0xcc)[_0x82f4('0x1f')]();});}};}function handleEntityNotFound(_0x311662,_0x524cd7){return function(_0x3045c7){if(!_0x3045c7){_0x311662['sendStatus'](0x194);}return _0x3045c7;};}function handleError(_0x1b9903,_0x1b7233){_0x1b7233=_0x1b7233||0x1f4;return function(_0x5d5cac){logger['error'](_0x5d5cac[_0x82f4('0x2b')]);if(_0x5d5cac[_0x82f4('0x2c')]){delete _0x5d5cac[_0x82f4('0x2c')];}_0x1b9903['status'](_0x1b7233)[_0x82f4('0x2d')](_0x5d5cac);};}exports[_0x82f4('0x2e')]=function(_0x101312,_0x5242ae){var _0x3963f1={},_0x3bda9e={},_0x16c68b={'count':0x0,'rows':[]};var _0x5cef7a=_['map'](db[_0x82f4('0x2f')][_0x82f4('0x30')],function(_0xb375a1){return{'name':_0xb375a1[_0x82f4('0x31')],'type':_0xb375a1[_0x82f4('0x32')]['key']};});_0x3bda9e[_0x82f4('0x33')]=_[_0x82f4('0x34')](_0x5cef7a,'name');_0x3bda9e[_0x82f4('0x35')]=_[_0x82f4('0x36')](_0x101312['query']);_0x3bda9e['filters']=_['intersection'](_0x3bda9e[_0x82f4('0x33')],_0x3bda9e[_0x82f4('0x35')]);_0x3963f1[_0x82f4('0x37')]=_[_0x82f4('0x38')](_0x3bda9e['model'],qs[_0x82f4('0x39')](_0x101312[_0x82f4('0x35')][_0x82f4('0x39')]));_0x3963f1[_0x82f4('0x37')]=_0x3963f1[_0x82f4('0x37')][_0x82f4('0x3a')]?_0x3963f1['attributes']:_0x3bda9e[_0x82f4('0x33')];if(!_0x101312['query']['hasOwnProperty'](_0x82f4('0x3b'))){_0x3963f1[_0x82f4('0x22')]=qs[_0x82f4('0x22')](_0x101312[_0x82f4('0x35')][_0x82f4('0x22')]);_0x3963f1[_0x82f4('0x23')]=qs[_0x82f4('0x23')](_0x101312[_0x82f4('0x35')][_0x82f4('0x23')]);}_0x3963f1[_0x82f4('0x3c')]=qs[_0x82f4('0x3d')](_0x101312[_0x82f4('0x35')]['sort']);_0x3963f1['where']=qs['filters'](_[_0x82f4('0x3e')](_0x101312[_0x82f4('0x35')],_0x3bda9e[_0x82f4('0x3f')]),_0x5cef7a);if(_0x101312[_0x82f4('0x35')][_0x82f4('0x40')]){_0x3963f1[_0x82f4('0x41')]=_[_0x82f4('0x42')](_0x3963f1['where'],{'$or':_['map'](_0x5cef7a,function(_0x26ff36){if(_0x26ff36[_0x82f4('0x32')]!==_0x82f4('0x43')){var _0x58d0dd={};_0x58d0dd[_0x26ff36[_0x82f4('0x2c')]]={'$like':'%'+_0x101312[_0x82f4('0x35')][_0x82f4('0x40')]+'%'};return _0x58d0dd;}})});}_0x3963f1=_[_0x82f4('0x42')]({},_0x3963f1,_0x101312[_0x82f4('0x44')]);var _0x477cd9={'where':_0x3963f1['where']};return db['VoiceQueueReport'][_0x82f4('0x24')](_0x477cd9)[_0x82f4('0x2a')](function(_0x23ad94){_0x16c68b[_0x82f4('0x24')]=_0x23ad94;if(_0x101312[_0x82f4('0x35')]['includeAll']){_0x3963f1[_0x82f4('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x82f4('0x46')](_0x3963f1);})[_0x82f4('0x2a')](function(_0xedfdf6){_0x16c68b[_0x82f4('0x47')]=_0xedfdf6;return _0x16c68b;})[_0x82f4('0x2a')](respondWithFilteredResult(_0x5242ae,_0x3963f1))[_0x82f4('0x48')](handleError(_0x5242ae,null));};exports[_0x82f4('0x49')]=function(_0x177884,_0x3b1a10){var _0x25e361={'raw':![],'where':{'id':_0x177884['params']['id']}},_0x46ccfd={};_0x46ccfd[_0x82f4('0x33')]=_['keys'](db[_0x82f4('0x2f')][_0x82f4('0x30')]);_0x46ccfd['query']=_['keys'](_0x177884[_0x82f4('0x35')]);_0x46ccfd['filters']=_[_0x82f4('0x38')](_0x46ccfd['model'],_0x46ccfd['query']);_0x25e361[_0x82f4('0x37')]=_[_0x82f4('0x38')](_0x46ccfd[_0x82f4('0x33')],qs[_0x82f4('0x39')](_0x177884[_0x82f4('0x35')]['fields']));_0x25e361[_0x82f4('0x37')]=_0x25e361[_0x82f4('0x37')][_0x82f4('0x3a')]?_0x25e361[_0x82f4('0x37')]:_0x46ccfd['model'];if(_0x177884['query']['includeAll']){_0x25e361['include']=[{'all':!![]}];}_0x25e361=_[_0x82f4('0x42')]({},_0x25e361,_0x177884['options']);return db[_0x82f4('0x2f')][_0x82f4('0x4a')](_0x25e361)[_0x82f4('0x2a')](handleEntityNotFound(_0x3b1a10,null))[_0x82f4('0x2a')](respondWithResult(_0x3b1a10,null))['catch'](handleError(_0x3b1a10,null));};exports[_0x82f4('0x4b')]=function(_0x3551fc,_0x5ad0d2){return db[_0x82f4('0x2f')]['create'](_0x3551fc['body'],{})[_0x82f4('0x2a')](respondWithResult(_0x5ad0d2,0xc9))['catch'](handleError(_0x5ad0d2,null));};exports[_0x82f4('0x4c')]=function(_0x208c30,_0x28932b){if(_0x208c30[_0x82f4('0x4d')]['id']){delete _0x208c30[_0x82f4('0x4d')]['id'];}return db[_0x82f4('0x2f')][_0x82f4('0x4a')]({'where':{'id':_0x208c30[_0x82f4('0x4e')]['id']}})[_0x82f4('0x2a')](handleEntityNotFound(_0x28932b,null))[_0x82f4('0x2a')](saveUpdates(_0x208c30[_0x82f4('0x4d')],null))[_0x82f4('0x2a')](respondWithResult(_0x28932b,null))['catch'](handleError(_0x28932b,null));};exports[_0x82f4('0x29')]=function(_0x26cf60,_0xe113ae){return db[_0x82f4('0x2f')][_0x82f4('0x4a')]({'where':{'id':_0x26cf60[_0x82f4('0x4e')]['id']}})[_0x82f4('0x2a')](handleEntityNotFound(_0xe113ae,null))[_0x82f4('0x2a')](removeEntity(_0xe113ae,null))['catch'](handleError(_0xe113ae,null));};exports[_0x82f4('0x4f')]=function(_0x32cb15,_0x444993){return db['VoiceQueueReport'][_0x82f4('0x4f')]()[_0x82f4('0x2a')](respondWithResult(_0x444993,null))['catch'](handleError(_0x444993,null));};exports[_0x82f4('0x50')]=function(_0x1f51fb,_0x353d10){var _0x172ed4={},_0x47aaf6={},_0x2d1b91={'count':0x0,'rows':[]};_0x47aaf6[_0x82f4('0x33')]=_[_0x82f4('0x36')](db['VoiceQueueReport'][_0x82f4('0x30')]);_0x47aaf6[_0x82f4('0x35')]=_[_0x82f4('0x36')](_0x1f51fb['query']);_0x47aaf6['filters']=_[_0x82f4('0x38')](_0x47aaf6[_0x82f4('0x33')],_0x47aaf6[_0x82f4('0x35')]);_0x172ed4[_0x82f4('0x37')]=_[_0x82f4('0x38')](_0x47aaf6[_0x82f4('0x33')],qs['fields'](_0x1f51fb[_0x82f4('0x35')]['fields']));_0x172ed4['attributes']=_0x172ed4[_0x82f4('0x37')][_0x82f4('0x3a')]?_0x172ed4['attributes']:_0x47aaf6[_0x82f4('0x33')];if(!_0x1f51fb[_0x82f4('0x35')][_0x82f4('0x51')]('nolimit')){_0x172ed4[_0x82f4('0x22')]=qs['limit'](_0x1f51fb[_0x82f4('0x35')][_0x82f4('0x22')]);_0x172ed4[_0x82f4('0x23')]=qs[_0x82f4('0x23')](_0x1f51fb['query'][_0x82f4('0x23')]);}_0x172ed4['order']=qs[_0x82f4('0x3d')](_0x1f51fb[_0x82f4('0x35')][_0x82f4('0x3d')]);_0x172ed4[_0x82f4('0x41')]=qs[_0x82f4('0x3f')](_[_0x82f4('0x3e')](_0x1f51fb['query'],_0x47aaf6[_0x82f4('0x3f')]));if(_0x1f51fb[_0x82f4('0x35')][_0x82f4('0x40')]){_0x172ed4[_0x82f4('0x41')]=_['merge'](_0x172ed4[_0x82f4('0x41')],{'$or':_['map'](_0x172ed4[_0x82f4('0x37')],function(_0x10164f){var _0xe579d9={};_0xe579d9[_0x10164f]={'$like':'%'+_0x1f51fb[_0x82f4('0x35')][_0x82f4('0x40')]+'%'};return _0xe579d9;})});}_0x172ed4=_[_0x82f4('0x42')]({},_0x172ed4,_0x1f51fb[_0x82f4('0x44')]);var _0x5e3031={'where':_0x172ed4[_0x82f4('0x41')]};return db[_0x82f4('0x2f')][_0x82f4('0x24')](_0x5e3031)[_0x82f4('0x2a')](function(_0x346542){_0x2d1b91['count']=_0x346542;if(_0x1f51fb[_0x82f4('0x35')][_0x82f4('0x52')]){_0x172ed4['include']=[{'all':!![]}];}return db[_0x82f4('0x2f')][_0x82f4('0x46')](_0x172ed4);})[_0x82f4('0x2a')](function(_0x4f696a){_0x2d1b91['rows']=_0x4f696a;return _0x2d1b91;})[_0x82f4('0x2a')](respondWithFilteredResult(_0x353d10,_0x172ed4,'getVoiceQueuesReport'))[_0x82f4('0x48')](handleError(_0x353d10,null,_0x82f4('0x50')));}; \ No newline at end of file +var _0x172b=['reject','save','update','then','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','getVoiceQueuesReport','order','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','./voiceQueueReport.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x6e1e2a,_0xf9cd0f){var _0x558e58=function(_0x849644){while(--_0x849644){_0x6e1e2a['push'](_0x6e1e2a['shift']());}};_0x558e58(++_0xf9cd0f);}(_0x172b,0x1e0));var _0xb172=function(_0x32bea3,_0x3ed963){_0x32bea3=_0x32bea3-0x0;var _0x2eecca=_0x172b[_0x32bea3];return _0x2eecca;};'use strict';var emlformat=require(_0xb172('0x0'));var rimraf=require(_0xb172('0x1'));var zipdir=require(_0xb172('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb172('0x3'));var moment=require(_0xb172('0x4'));var BPromise=require(_0xb172('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb172('0x6'));var sox=require('sox');var csv=require(_0xb172('0x7'));var ejs=require(_0xb172('0x8'));var fs=require('fs');var fs_extra=require(_0xb172('0x9'));var _=require('lodash');var squel=require(_0xb172('0xa'));var crypto=require(_0xb172('0xb'));var jsforce=require(_0xb172('0xc'));var deskjs=require(_0xb172('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb172('0xe'));var Papa=require(_0xb172('0xf'));var Redis=require(_0xb172('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb172('0x11'));var as=require(_0xb172('0x12'));var hardwareService=require(_0xb172('0x13'));var logger=require(_0xb172('0x14'))('api');var utils=require(_0xb172('0x15'));var config=require(_0xb172('0x16'));var licenseUtil=require(_0xb172('0x17'));var db=require(_0xb172('0x18'))['db'];config[_0xb172('0x19')]=_[_0xb172('0x1a')](config['redis'],{'host':_0xb172('0x1b'),'port':0x18eb});var socket=require(_0xb172('0x1c'))(new Redis(config[_0xb172('0x19')]));require(_0xb172('0x1d'))[_0xb172('0x1e')](socket);function respondWithStatusCode(_0x57cc1f,_0xf2c392){_0xf2c392=_0xf2c392||0xcc;return function(_0x3998ba){if(_0x3998ba){return _0x57cc1f[_0xb172('0x1f')](_0xf2c392);}return _0x57cc1f['status'](_0xf2c392)[_0xb172('0x20')]();};}function respondWithResult(_0x153163,_0xf373b){_0xf373b=_0xf373b||0xc8;return function(_0x18d171){if(_0x18d171){return _0x153163[_0xb172('0x21')](_0xf373b)[_0xb172('0x22')](_0x18d171);}};}function respondWithFilteredResult(_0x381b90,_0x2913f7){return function(_0x1f2824){if(_0x1f2824){var _0x19602a=typeof _0x2913f7['offset']===_0xb172('0x23')&&typeof _0x2913f7[_0xb172('0x24')]===_0xb172('0x23');var _0x67d6ea=_0x1f2824[_0xb172('0x25')];var _0xf0019d=_0x19602a?0x0:_0x2913f7['offset'];var _0x167fcd=_0x19602a?_0x1f2824['count']:_0x2913f7[_0xb172('0x26')]+_0x2913f7[_0xb172('0x24')];var _0x1485f5;if(_0x167fcd>=_0x67d6ea){_0x167fcd=_0x67d6ea;_0x1485f5=0xc8;}else{_0x1485f5=0xce;}_0x381b90[_0xb172('0x21')](_0x1485f5);return _0x381b90[_0xb172('0x27')](_0xb172('0x28'),_0xf0019d+'-'+_0x167fcd+'/'+_0x67d6ea)['json'](_0x1f2824);}return null;};}function patchUpdates(_0x51d893){return function(_0x2b3744){try{jsonpatch[_0xb172('0x29')](_0x2b3744,_0x51d893,!![]);}catch(_0x3adce0){return BPromise[_0xb172('0x2a')](_0x3adce0);}return _0x2b3744[_0xb172('0x2b')]();};}function saveUpdates(_0x457b07,_0x225141){return function(_0x480198){if(_0x480198){return _0x480198[_0xb172('0x2c')](_0x457b07)[_0xb172('0x2d')](function(_0xf4bf3){return _0xf4bf3;});}return null;};}function removeEntity(_0x1d18af,_0x4f8cd1){return function(_0x3b3e20){if(_0x3b3e20){return _0x3b3e20['destroy']()[_0xb172('0x2d')](function(){_0x1d18af[_0xb172('0x21')](0xcc)[_0xb172('0x20')]();});}};}function handleEntityNotFound(_0x5c2dcc,_0x3f3998){return function(_0x1063b2){if(!_0x1063b2){_0x5c2dcc[_0xb172('0x1f')](0x194);}return _0x1063b2;};}function handleError(_0x2fb332,_0x36a233){_0x36a233=_0x36a233||0x1f4;return function(_0x2809cb){logger[_0xb172('0x2e')](_0x2809cb['stack']);if(_0x2809cb[_0xb172('0x2f')]){delete _0x2809cb[_0xb172('0x2f')];}_0x2fb332[_0xb172('0x21')](_0x36a233)[_0xb172('0x30')](_0x2809cb);};}exports[_0xb172('0x31')]=function(_0x43a7f,_0x4d7fa8){var _0x4d59cf={},_0x53a54c={},_0x36cb5c={'count':0x0,'rows':[]};var _0x15ba5f=_[_0xb172('0x32')](db[_0xb172('0x33')][_0xb172('0x34')],function(_0x1fb90b){return{'name':_0x1fb90b[_0xb172('0x35')],'type':_0x1fb90b[_0xb172('0x36')][_0xb172('0x37')]};});_0x53a54c[_0xb172('0x38')]=_[_0xb172('0x32')](_0x15ba5f,_0xb172('0x2f'));_0x53a54c[_0xb172('0x39')]=_[_0xb172('0x3a')](_0x43a7f[_0xb172('0x39')]);_0x53a54c[_0xb172('0x3b')]=_['intersection'](_0x53a54c['model'],_0x53a54c['query']);_0x4d59cf[_0xb172('0x3c')]=_[_0xb172('0x3d')](_0x53a54c[_0xb172('0x38')],qs[_0xb172('0x3e')](_0x43a7f[_0xb172('0x39')]['fields']));_0x4d59cf[_0xb172('0x3c')]=_0x4d59cf['attributes'][_0xb172('0x3f')]?_0x4d59cf[_0xb172('0x3c')]:_0x53a54c[_0xb172('0x38')];if(!_0x43a7f['query'][_0xb172('0x40')](_0xb172('0x41'))){_0x4d59cf[_0xb172('0x24')]=qs[_0xb172('0x24')](_0x43a7f[_0xb172('0x39')][_0xb172('0x24')]);_0x4d59cf[_0xb172('0x26')]=qs['offset'](_0x43a7f[_0xb172('0x39')][_0xb172('0x26')]);}_0x4d59cf['order']=qs['sort'](_0x43a7f[_0xb172('0x39')][_0xb172('0x42')]);_0x4d59cf['where']=qs[_0xb172('0x3b')](_[_0xb172('0x43')](_0x43a7f['query'],_0x53a54c[_0xb172('0x3b')]),_0x15ba5f);if(_0x43a7f['query']['filter']){_0x4d59cf['where']=_['merge'](_0x4d59cf[_0xb172('0x44')],{'$or':_[_0xb172('0x32')](_0x15ba5f,function(_0x1acd9c){if(_0x1acd9c['type']!==_0xb172('0x45')){var _0x4e2aba={};_0x4e2aba[_0x1acd9c[_0xb172('0x2f')]]={'$like':'%'+_0x43a7f['query'][_0xb172('0x46')]+'%'};return _0x4e2aba;}})});}_0x4d59cf=_[_0xb172('0x47')]({},_0x4d59cf,_0x43a7f['options']);var _0x30681c={'where':_0x4d59cf[_0xb172('0x44')]};return db[_0xb172('0x33')][_0xb172('0x25')](_0x30681c)[_0xb172('0x2d')](function(_0x2c4db3){_0x36cb5c[_0xb172('0x25')]=_0x2c4db3;if(_0x43a7f[_0xb172('0x39')][_0xb172('0x48')]){_0x4d59cf[_0xb172('0x49')]=[{'all':!![]}];}return db[_0xb172('0x33')][_0xb172('0x4a')](_0x4d59cf);})['then'](function(_0x441ee0){_0x36cb5c[_0xb172('0x4b')]=_0x441ee0;return _0x36cb5c;})[_0xb172('0x2d')](respondWithFilteredResult(_0x4d7fa8,_0x4d59cf))[_0xb172('0x4c')](handleError(_0x4d7fa8,null));};exports[_0xb172('0x4d')]=function(_0x31328c,_0x4ddd98){var _0x378e57={'raw':![],'where':{'id':_0x31328c[_0xb172('0x4e')]['id']}},_0x46f4c5={};_0x46f4c5[_0xb172('0x38')]=_[_0xb172('0x3a')](db[_0xb172('0x33')][_0xb172('0x34')]);_0x46f4c5[_0xb172('0x39')]=_[_0xb172('0x3a')](_0x31328c[_0xb172('0x39')]);_0x46f4c5[_0xb172('0x3b')]=_[_0xb172('0x3d')](_0x46f4c5[_0xb172('0x38')],_0x46f4c5[_0xb172('0x39')]);_0x378e57['attributes']=_[_0xb172('0x3d')](_0x46f4c5['model'],qs[_0xb172('0x3e')](_0x31328c[_0xb172('0x39')][_0xb172('0x3e')]));_0x378e57['attributes']=_0x378e57[_0xb172('0x3c')]['length']?_0x378e57['attributes']:_0x46f4c5[_0xb172('0x38')];if(_0x31328c[_0xb172('0x39')][_0xb172('0x48')]){_0x378e57['include']=[{'all':!![]}];}_0x378e57=_[_0xb172('0x47')]({},_0x378e57,_0x31328c[_0xb172('0x4f')]);return db[_0xb172('0x33')][_0xb172('0x50')](_0x378e57)[_0xb172('0x2d')](handleEntityNotFound(_0x4ddd98,null))[_0xb172('0x2d')](respondWithResult(_0x4ddd98,null))[_0xb172('0x4c')](handleError(_0x4ddd98,null));};exports[_0xb172('0x51')]=function(_0x246cee,_0x211c80){return db[_0xb172('0x33')][_0xb172('0x51')](_0x246cee[_0xb172('0x52')],{})[_0xb172('0x2d')](respondWithResult(_0x211c80,0xc9))[_0xb172('0x4c')](handleError(_0x211c80,null));};exports['update']=function(_0x5329a8,_0x5012c8){if(_0x5329a8['body']['id']){delete _0x5329a8[_0xb172('0x52')]['id'];}return db[_0xb172('0x33')][_0xb172('0x50')]({'where':{'id':_0x5329a8[_0xb172('0x4e')]['id']}})[_0xb172('0x2d')](handleEntityNotFound(_0x5012c8,null))[_0xb172('0x2d')](saveUpdates(_0x5329a8[_0xb172('0x52')],null))[_0xb172('0x2d')](respondWithResult(_0x5012c8,null))[_0xb172('0x4c')](handleError(_0x5012c8,null));};exports[_0xb172('0x53')]=function(_0x1e2b11,_0x3a1dc3){return db['VoiceQueueReport']['find']({'where':{'id':_0x1e2b11[_0xb172('0x4e')]['id']}})[_0xb172('0x2d')](handleEntityNotFound(_0x3a1dc3,null))[_0xb172('0x2d')](removeEntity(_0x3a1dc3,null))[_0xb172('0x4c')](handleError(_0x3a1dc3,null));};exports[_0xb172('0x54')]=function(_0x4e7486,_0x6b2689){return db[_0xb172('0x33')][_0xb172('0x54')]()['then'](respondWithResult(_0x6b2689,null))[_0xb172('0x4c')](handleError(_0x6b2689,null));};exports[_0xb172('0x55')]=function(_0x1f114c,_0x152818){var _0x36a391={},_0x5e01b9={},_0x3fcdb1={'count':0x0,'rows':[]};_0x5e01b9[_0xb172('0x38')]=_[_0xb172('0x3a')](db[_0xb172('0x33')][_0xb172('0x34')]);_0x5e01b9[_0xb172('0x39')]=_[_0xb172('0x3a')](_0x1f114c[_0xb172('0x39')]);_0x5e01b9[_0xb172('0x3b')]=_[_0xb172('0x3d')](_0x5e01b9[_0xb172('0x38')],_0x5e01b9[_0xb172('0x39')]);_0x36a391[_0xb172('0x3c')]=_[_0xb172('0x3d')](_0x5e01b9[_0xb172('0x38')],qs[_0xb172('0x3e')](_0x1f114c[_0xb172('0x39')][_0xb172('0x3e')]));_0x36a391[_0xb172('0x3c')]=_0x36a391['attributes'][_0xb172('0x3f')]?_0x36a391[_0xb172('0x3c')]:_0x5e01b9[_0xb172('0x38')];if(!_0x1f114c['query'][_0xb172('0x40')](_0xb172('0x41'))){_0x36a391[_0xb172('0x24')]=qs[_0xb172('0x24')](_0x1f114c['query']['limit']);_0x36a391['offset']=qs[_0xb172('0x26')](_0x1f114c[_0xb172('0x39')][_0xb172('0x26')]);}_0x36a391[_0xb172('0x56')]=qs[_0xb172('0x42')](_0x1f114c['query']['sort']);_0x36a391[_0xb172('0x44')]=qs[_0xb172('0x3b')](_['pick'](_0x1f114c['query'],_0x5e01b9[_0xb172('0x3b')]));if(_0x1f114c[_0xb172('0x39')]['filter']){_0x36a391[_0xb172('0x44')]=_[_0xb172('0x47')](_0x36a391[_0xb172('0x44')],{'$or':_[_0xb172('0x32')](_0x36a391[_0xb172('0x3c')],function(_0x956e21){var _0x18d305={};_0x18d305[_0x956e21]={'$like':'%'+_0x1f114c['query'][_0xb172('0x46')]+'%'};return _0x18d305;})});}_0x36a391=_['merge']({},_0x36a391,_0x1f114c[_0xb172('0x4f')]);var _0x3ea067={'where':_0x36a391[_0xb172('0x44')]};return db[_0xb172('0x33')][_0xb172('0x25')](_0x3ea067)[_0xb172('0x2d')](function(_0x4dbf00){_0x3fcdb1[_0xb172('0x25')]=_0x4dbf00;if(_0x1f114c[_0xb172('0x39')]['includeAll']){_0x36a391[_0xb172('0x49')]=[{'all':!![]}];}return db[_0xb172('0x33')][_0xb172('0x4a')](_0x36a391);})[_0xb172('0x2d')](function(_0x3ccb34){_0x3fcdb1['rows']=_0x3ccb34;return _0x3fcdb1;})[_0xb172('0x2d')](respondWithFilteredResult(_0x152818,_0x36a391,_0xb172('0x55')))[_0xb172('0x4c')](handleError(_0x152818,null,_0xb172('0x55')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 9c94e08..32d61c9 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 _0x72c7=['hasOwnProperty','hook','setMaxListeners','save','update','emit'];(function(_0x1b6915,_0x50ee57){var _0x5910b4=function(_0x238c0e){while(--_0x238c0e){_0x1b6915['push'](_0x1b6915['shift']());}};_0x5910b4(++_0x50ee57);}(_0x72c7,0xda));var _0x772c=function(_0x45bc6a,_0x301e14){_0x45bc6a=_0x45bc6a-0x0;var _0x171a81=_0x72c7[_0x45bc6a];return _0x171a81;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x772c('0x0')](0x0);var events={'afterCreate':_0x772c('0x1'),'afterUpdate':_0x772c('0x2'),'afterDestroy':'remove'};function emitEvent(_0x24c4e1){return function(_0x3fce4c,_0x523c61,_0x2f163){VoiceQueueReportEvents[_0x772c('0x3')](_0x24c4e1+':'+_0x3fce4c['id'],_0x3fce4c);VoiceQueueReportEvents[_0x772c('0x3')](_0x24c4e1,_0x3fce4c);_0x2f163(null);};}for(var e in events){if(events[_0x772c('0x4')](e)){var event=events[e];VoiceQueueReport[_0x772c('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x3a92=['hook','exports','events','../../mysqldb','VoiceQueueReport','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a92,0x14a));var _0x23a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a92[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x23a9('0x0'));var VoiceQueueReport=require(_0x23a9('0x1'))['db'][_0x23a9('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x23a9('0x3'),'afterUpdate':_0x23a9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x513da4){return function(_0x4171cb,_0x4ba701,_0x3520c3){VoiceQueueReportEvents[_0x23a9('0x5')](_0x513da4+':'+_0x4171cb['id'],_0x4171cb);VoiceQueueReportEvents[_0x23a9('0x5')](_0x513da4,_0x4171cb);_0x3520c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x23a9('0x6')](e,emitEvent(event));}}module[_0x23a9('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index eb9d0ae..8055f01 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 _0x4d7f=['exports','define','VoiceQueueReport','report_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x38e20d,_0x591ee0){var _0x2e831e=function(_0x56575a){while(--_0x56575a){_0x38e20d['push'](_0x38e20d['shift']());}};_0x2e831e(++_0x591ee0);}(_0x4d7f,0x17c));var _0xf4d7=function(_0x1b7e66,_0x1e25de){_0x1b7e66=_0x1b7e66-0x0;var _0x55f1c2=_0x4d7f[_0x1b7e66];return _0x55f1c2;};'use strict';var _=require('lodash');var util=require(_0xf4d7('0x0'));var logger=require(_0xf4d7('0x1'))(_0xf4d7('0x2'));var moment=require(_0xf4d7('0x3'));var BPromise=require(_0xf4d7('0x4'));var rp=require(_0xf4d7('0x5'));var fs=require('fs');var path=require(_0xf4d7('0x6'));var rimraf=require(_0xf4d7('0x7'));var config=require(_0xf4d7('0x8'));var attributes=require(_0xf4d7('0x9'));module[_0xf4d7('0xa')]=function(_0x2d4c6f,_0x37db90){return _0x2d4c6f[_0xf4d7('0xb')](_0xf4d7('0xc'),attributes,{'tableName':_0xf4d7('0xd'),'paranoid':![],'indexes':[{'fields':[_0xf4d7('0xe')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x10ce=['exports','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x51553f,_0x5b4b7b){var _0x318110=function(_0x2f7018){while(--_0x2f7018){_0x51553f['push'](_0x51553f['shift']());}};_0x318110(++_0x5b4b7b);}(_0x10ce,0x1d7));var _0xe10c=function(_0x537a0d,_0x12efae){_0x537a0d=_0x537a0d-0x0;var _0x2cff5a=_0x10ce[_0x537a0d];return _0x2cff5a;};'use strict';var _=require(_0xe10c('0x0'));var util=require(_0xe10c('0x1'));var logger=require(_0xe10c('0x2'))(_0xe10c('0x3'));var moment=require(_0xe10c('0x4'));var BPromise=require('bluebird');var rp=require(_0xe10c('0x5'));var fs=require('fs');var path=require(_0xe10c('0x6'));var rimraf=require(_0xe10c('0x7'));var config=require(_0xe10c('0x8'));var attributes=require(_0xe10c('0x9'));module[_0xe10c('0xa')]=function(_0x5a6bb7,_0x2dde0e){return _0x5a6bb7['define']('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe10c('0xb')]},{'fields':[_0xe10c('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 148aec1..6e60e61 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 _0x008c=['debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','map','model','attributes','include','CreateVoiceQueueReport','create','catch','UpdateVoiceQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x008c,0x1af));var _0xc008=function(_0x4ee89a,_0x56d642){_0x4ee89a=_0x4ee89a-0x0;var _0x42aca9=_0x008c[_0x4ee89a];return _0x42aca9;};'use strict';var _=require('lodash');var util=require(_0xc008('0x0'));var moment=require('moment');var BPromise=require(_0xc008('0x1'));var rs=require(_0xc008('0x2'));var fs=require('fs');var Redis=require(_0xc008('0x3'));var db=require(_0xc008('0x4'))['db'];var utils=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var config=require(_0xc008('0x8'));var jayson=require(_0xc008('0x9'));var client=jayson[_0xc008('0xa')][_0xc008('0xb')]({'port':0x232a});config[_0xc008('0xc')]=_['defaults'](config['redis'],{'host':_0xc008('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc008('0xe'))[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x278c91,_0x19df9c,_0x5e65d0){return new BPromise(function(_0x23f1d4,_0x5bf00c){return client['request'](_0x278c91,_0x5e65d0)[_0xc008('0x10')](function(_0x122fa2){logger[_0xc008('0x11')](_0xc008('0x12'),_0x19df9c,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x19df9c,_0xc008('0x13'),JSON[_0xc008('0x16')](_0x122fa2));if(_0x122fa2[_0xc008('0x17')]){if(_0x122fa2[_0xc008('0x17')]['code']===0x1f4){logger[_0xc008('0x17')](_0xc008('0x12'),_0x19df9c,_0x122fa2[_0xc008('0x17')][_0xc008('0x18')]);return _0x5bf00c(_0x122fa2[_0xc008('0x17')]['message']);}logger[_0xc008('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x19df9c,_0x122fa2[_0xc008('0x17')][_0xc008('0x18')]);return _0x23f1d4(_0x122fa2['error'][_0xc008('0x18')]);}else{logger[_0xc008('0x11')](_0xc008('0x12'),_0x19df9c,_0xc008('0x13'));_0x23f1d4(_0x122fa2[_0xc008('0x19')]['message']);}})['catch'](function(_0x114838){logger[_0xc008('0x17')](_0xc008('0x12'),_0x19df9c,_0x114838);_0x5bf00c(_0x114838);});});}exports[_0xc008('0x1a')]=function(_0x14a498){var _0x43790b=this;return new Promise(function(_0x3562cb,_0xf9f10a){return db[_0xc008('0x1b')][_0xc008('0x1c')]({'raw':_0x14a498[_0xc008('0x1d')]?_0x14a498[_0xc008('0x1d')][_0xc008('0x1e')]===undefined?!![]:![]:!![],'where':_0x14a498[_0xc008('0x1d')]?_0x14a498['options'][_0xc008('0x1f')]||null:null,'attributes':_0x14a498[_0xc008('0x1d')]?_0x14a498[_0xc008('0x1d')]['attributes']||null:null,'limit':_0x14a498[_0xc008('0x1d')]?_0x14a498['options'][_0xc008('0x20')]||null:null,'include':_0x14a498['options']?_0x14a498[_0xc008('0x1d')]['include']?_[_0xc008('0x21')](_0x14a498[_0xc008('0x1d')]['include'],function(_0x13535f){return{'model':db[_0x13535f[_0xc008('0x22')]],'as':_0x13535f['as'],'attributes':_0x13535f[_0xc008('0x23')],'include':_0x13535f[_0xc008('0x24')]?_[_0xc008('0x21')](_0x13535f[_0xc008('0x24')],function(_0x383acc){return{'model':db[_0x383acc['model']],'as':_0x383acc['as'],'attributes':_0x383acc[_0xc008('0x23')],'include':_0x383acc['include']?_[_0xc008('0x21')](_0x383acc[_0xc008('0x24')],function(_0x39f3cc){return{'model':db[_0x39f3cc[_0xc008('0x22')]],'as':_0x39f3cc['as'],'attributes':_0x39f3cc['attributes']};}):[]};}):[]};}):[]:[]})[_0xc008('0x10')](function(_0x3783a0){logger['info'](_0xc008('0x1a'),_0x14a498);logger[_0xc008('0x14')](_0xc008('0x1a'),_0x14a498,JSON[_0xc008('0x16')](_0x3783a0));_0x3562cb(_0x3783a0);})['catch'](function(_0x1d27c3){logger[_0xc008('0x17')](_0xc008('0x1a'),_0x1d27c3[_0xc008('0x18')],_0x14a498);_0xf9f10a(_0x43790b[_0xc008('0x17')](0x1f4,_0x1d27c3[_0xc008('0x18')]));});});};exports[_0xc008('0x25')]=function(_0x229f99){var _0x577f88=this;return new Promise(function(_0x294a52,_0x201603){return db[_0xc008('0x1b')][_0xc008('0x26')](_0x229f99['body'],{'raw':_0x229f99[_0xc008('0x1d')]?_0x229f99['options'][_0xc008('0x1e')]===undefined?!![]:![]:!![]})[_0xc008('0x10')](function(_0x9441ad){logger[_0xc008('0x11')](_0xc008('0x25'),_0x229f99);logger[_0xc008('0x14')](_0xc008('0x25'),_0x229f99,JSON['stringify'](_0x9441ad));_0x294a52(_0x9441ad);})[_0xc008('0x27')](function(_0x1c3db8){logger[_0xc008('0x17')](_0xc008('0x25'),_0x1c3db8[_0xc008('0x18')],_0x229f99);_0x201603(_0x577f88[_0xc008('0x17')](0x1f4,_0x1c3db8['message']));});});};exports[_0xc008('0x28')]=function(_0x580bca){var _0x209b6c=this;return new Promise(function(_0x283dae,_0x45d055){return db[_0xc008('0x1b')]['update'](_0x580bca['body'],{'raw':_0x580bca['options']?_0x580bca['options'][_0xc008('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x580bca[_0xc008('0x1d')]?_0x580bca[_0xc008('0x1d')]['where']||null:null,'attributes':_0x580bca['options']?_0x580bca[_0xc008('0x1d')][_0xc008('0x23')]||null:null,'limit':_0x580bca[_0xc008('0x1d')]?_0x580bca[_0xc008('0x1d')]['limit']||null:null})[_0xc008('0x10')](function(_0x3cd76b){logger[_0xc008('0x11')](_0xc008('0x28'),_0x580bca);logger[_0xc008('0x14')](_0xc008('0x28'),_0x580bca,JSON[_0xc008('0x16')](_0x3cd76b));_0x283dae(_0x3cd76b);})['catch'](function(_0x9d1fad){logger[_0xc008('0x17')]('UpdateVoiceQueueReport',_0x9d1fad[_0xc008('0x18')],_0x580bca);_0x45d055(_0x209b6c[_0xc008('0x17')](0x1f4,_0x9d1fad[_0xc008('0x18')]));});});}; \ No newline at end of file +var _0xa212=['then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','VoiceQueueReport','update','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register'];(function(_0x515ef1,_0x476d57){var _0x2081a6=function(_0x310edf){while(--_0x310edf){_0x515ef1['push'](_0x515ef1['shift']());}};_0x2081a6(++_0x476d57);}(_0xa212,0x1f4));var _0x2a21=function(_0x4167d0,_0x56d592){_0x4167d0=_0x4167d0-0x0;var _0x33cc61=_0xa212[_0x4167d0];return _0x33cc61;};'use strict';var _=require(_0x2a21('0x0'));var util=require(_0x2a21('0x1'));var moment=require('moment');var BPromise=require(_0x2a21('0x2'));var rs=require(_0x2a21('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a21('0x4'))['db'];var utils=require(_0x2a21('0x5'));var logger=require(_0x2a21('0x6'))(_0x2a21('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a21('0x8')][_0x2a21('0x9')]({'port':0x232a});config[_0x2a21('0xa')]=_[_0x2a21('0xb')](config[_0x2a21('0xa')],{'host':_0x2a21('0xc'),'port':0x18eb});var socket=require(_0x2a21('0xd'))(new Redis(config[_0x2a21('0xa')]));require(_0x2a21('0xe'))[_0x2a21('0xf')](socket);function respondWithRpcPromise(_0x5dd813,_0x48bb21,_0x4b2c53){return new BPromise(function(_0x3a7a9,_0x4fdaa8){return client['request'](_0x5dd813,_0x4b2c53)[_0x2a21('0x10')](function(_0x3bbd7b){logger[_0x2a21('0x11')](_0x2a21('0x12'),_0x48bb21,_0x2a21('0x13'));logger['debug'](_0x2a21('0x14'),_0x48bb21,_0x2a21('0x13'),JSON[_0x2a21('0x15')](_0x3bbd7b));if(_0x3bbd7b[_0x2a21('0x16')]){if(_0x3bbd7b['error'][_0x2a21('0x17')]===0x1f4){logger[_0x2a21('0x16')](_0x2a21('0x12'),_0x48bb21,_0x3bbd7b[_0x2a21('0x16')]['message']);return _0x4fdaa8(_0x3bbd7b['error'][_0x2a21('0x18')]);}logger[_0x2a21('0x16')](_0x2a21('0x12'),_0x48bb21,_0x3bbd7b['error'][_0x2a21('0x18')]);return _0x3a7a9(_0x3bbd7b[_0x2a21('0x16')][_0x2a21('0x18')]);}else{logger[_0x2a21('0x11')](_0x2a21('0x12'),_0x48bb21,_0x2a21('0x13'));_0x3a7a9(_0x3bbd7b[_0x2a21('0x19')][_0x2a21('0x18')]);}})[_0x2a21('0x1a')](function(_0x1a1fc3){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x48bb21,_0x1a1fc3);_0x4fdaa8(_0x1a1fc3);});});}exports[_0x2a21('0x1b')]=function(_0x37e300){var _0x361946=this;return new Promise(function(_0x36d72f,_0x575f22){return db['VoiceQueueReport'][_0x2a21('0x1c')]({'raw':_0x37e300[_0x2a21('0x1d')]?_0x37e300[_0x2a21('0x1d')][_0x2a21('0x1e')]===undefined?!![]:![]:!![],'where':_0x37e300[_0x2a21('0x1d')]?_0x37e300[_0x2a21('0x1d')][_0x2a21('0x1f')]||null:null,'attributes':_0x37e300[_0x2a21('0x1d')]?_0x37e300['options'][_0x2a21('0x20')]||null:null,'limit':_0x37e300['options']?_0x37e300['options'][_0x2a21('0x21')]||null:null,'include':_0x37e300[_0x2a21('0x1d')]?_0x37e300[_0x2a21('0x1d')][_0x2a21('0x22')]?_[_0x2a21('0x23')](_0x37e300['options'][_0x2a21('0x22')],function(_0x3bbc53){return{'model':db[_0x3bbc53[_0x2a21('0x24')]],'as':_0x3bbc53['as'],'attributes':_0x3bbc53[_0x2a21('0x20')],'include':_0x3bbc53[_0x2a21('0x22')]?_[_0x2a21('0x23')](_0x3bbc53[_0x2a21('0x22')],function(_0x3bcde5){return{'model':db[_0x3bcde5[_0x2a21('0x24')]],'as':_0x3bcde5['as'],'attributes':_0x3bcde5[_0x2a21('0x20')],'include':_0x3bcde5[_0x2a21('0x22')]?_[_0x2a21('0x23')](_0x3bcde5[_0x2a21('0x22')],function(_0x3d869b){return{'model':db[_0x3d869b[_0x2a21('0x24')]],'as':_0x3d869b['as'],'attributes':_0x3d869b[_0x2a21('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2a21('0x10')](function(_0x5cba71){logger[_0x2a21('0x11')](_0x2a21('0x1b'),_0x37e300);logger[_0x2a21('0x25')]('GetVoiceQueueReport',_0x37e300,JSON[_0x2a21('0x15')](_0x5cba71));_0x36d72f(_0x5cba71);})[_0x2a21('0x1a')](function(_0x3043bd){logger[_0x2a21('0x16')](_0x2a21('0x1b'),_0x3043bd[_0x2a21('0x18')],_0x37e300);_0x575f22(_0x361946['error'](0x1f4,_0x3043bd[_0x2a21('0x18')]));});});};exports[_0x2a21('0x26')]=function(_0x5d1c4a){var _0x42109f=this;return new Promise(function(_0x3ede04,_0x121af9){return db['VoiceQueueReport']['create'](_0x5d1c4a[_0x2a21('0x27')],{'raw':_0x5d1c4a[_0x2a21('0x1d')]?_0x5d1c4a[_0x2a21('0x1d')][_0x2a21('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x1bbf4f){logger['info'](_0x2a21('0x26'),_0x5d1c4a);logger['debug']('CreateVoiceQueueReport',_0x5d1c4a,JSON[_0x2a21('0x15')](_0x1bbf4f));_0x3ede04(_0x1bbf4f);})[_0x2a21('0x1a')](function(_0x52cc85){logger[_0x2a21('0x16')](_0x2a21('0x26'),_0x52cc85['message'],_0x5d1c4a);_0x121af9(_0x42109f[_0x2a21('0x16')](0x1f4,_0x52cc85[_0x2a21('0x18')]));});});};exports[_0x2a21('0x28')]=function(_0x5c58c8){var _0x133789=this;return new Promise(function(_0x54826c,_0x11c683){return db[_0x2a21('0x29')][_0x2a21('0x2a')](_0x5c58c8[_0x2a21('0x27')],{'raw':_0x5c58c8[_0x2a21('0x1d')]?_0x5c58c8['options'][_0x2a21('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c58c8[_0x2a21('0x1d')]?_0x5c58c8['options'][_0x2a21('0x1f')]||null:null,'attributes':_0x5c58c8[_0x2a21('0x1d')]?_0x5c58c8['options'][_0x2a21('0x20')]||null:null,'limit':_0x5c58c8['options']?_0x5c58c8[_0x2a21('0x1d')][_0x2a21('0x21')]||null:null})['then'](function(_0x4f1efb){logger[_0x2a21('0x11')](_0x2a21('0x28'),_0x5c58c8);logger[_0x2a21('0x25')]('UpdateVoiceQueueReport',_0x5c58c8,JSON[_0x2a21('0x15')](_0x4f1efb));_0x54826c(_0x4f1efb);})[_0x2a21('0x1a')](function(_0x177801){logger['error']('UpdateVoiceQueueReport',_0x177801[_0x2a21('0x18')],_0x5c58c8);_0x11c683(_0x133789['error'](0x1f4,_0x177801[_0x2a21('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 24bcdc4..7320e14 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 _0x2c46=['remove','update','emit','removeListener','register','length','save'];(function(_0x3e756c,_0x16de3f){var _0x1c6abb=function(_0x247121){while(--_0x247121){_0x3e756c['push'](_0x3e756c['shift']());}};_0x1c6abb(++_0x16de3f);}(_0x2c46,0x6f));var _0x62c4=function(_0x5e6c1a,_0x204b2e){_0x5e6c1a=_0x5e6c1a-0x0;var _0x8b8f48=_0x2c46[_0x5e6c1a];return _0x8b8f48;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x62c4('0x0'),_0x62c4('0x1'),_0x62c4('0x2')];function createListener(_0x35cc9a,_0x40e803){return function(_0x2ae983){_0x40e803[_0x62c4('0x3')](_0x35cc9a,_0x2ae983);};}function removeListener(_0x65976c,_0x357b91){return function(){VoiceQueueReportEvents[_0x62c4('0x4')](_0x65976c,_0x357b91);};}exports[_0x62c4('0x5')]=function(_0x400057){for(var _0x2a719e=0x0,_0x2bfa72=events[_0x62c4('0x6')];_0x2a719e<_0x2bfa72;_0x2a719e++){var _0x46eacc=events[_0x2a719e];var _0xa171ec=createListener('voiceQueueReport:'+_0x46eacc,_0x400057);VoiceQueueReportEvents['on'](_0x46eacc,_0xa171ec);}}; \ No newline at end of file +var _0x7b83=['save','remove','emit','removeListener','register','./voiceQueueReport.events'];(function(_0x233b29,_0x167b3e){var _0x9346e0=function(_0x1bc2db){while(--_0x1bc2db){_0x233b29['push'](_0x233b29['shift']());}};_0x9346e0(++_0x167b3e);}(_0x7b83,0xa1));var _0x37b8=function(_0x40c547,_0x4638bc){_0x40c547=_0x40c547-0x0;var _0x4c67bf=_0x7b83[_0x40c547];return _0x4c67bf;};'use strict';var VoiceQueueReportEvents=require(_0x37b8('0x0'));var events=[_0x37b8('0x1'),_0x37b8('0x2'),'update'];function createListener(_0x562827,_0x788dfd){return function(_0x37c7d0){_0x788dfd[_0x37b8('0x3')](_0x562827,_0x37c7d0);};}function removeListener(_0x48aaa1,_0x420271){return function(){VoiceQueueReportEvents[_0x37b8('0x4')](_0x48aaa1,_0x420271);};}exports[_0x37b8('0x5')]=function(_0x2a5439){for(var _0x4102eb=0x0,_0x220cd2=events['length'];_0x4102eb<_0x220cd2;_0x4102eb++){var _0x45e094=events[_0x4102eb];var _0xc3ab5b=createListener('voiceQueueReport:'+_0x45e094,_0x2a5439);VoiceQueueReportEvents['on'](_0x45e094,_0xc3ab5b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2f30e03..702e6ab 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 _0xe444=['connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path'];(function(_0x505b15,_0x576feb){var _0x3f4c13=function(_0x443d74){while(--_0x443d74){_0x505b15['push'](_0x505b15['shift']());}};_0x3f4c13(++_0x576feb);}(_0xe444,0x196));var _0x4e44=function(_0x47f1c6,_0x54c4a7){_0x47f1c6=_0x47f1c6-0x0;var _0x268a40=_0xe444[_0x47f1c6];return _0x268a40;};'use strict';var multer=require(_0x4e44('0x0'));var util=require('util');var path=require(_0x4e44('0x1'));var timeout=require(_0x4e44('0x2'));var express=require(_0x4e44('0x3'));var router=express['Router']();var fs_extra=require(_0x4e44('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e44('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x4e44('0x6')]('/',auth[_0x4e44('0x7')](),controller[_0x4e44('0x8')]);router[_0x4e44('0x6')](_0x4e44('0x9'),auth['isAuthenticated'](),controller[_0x4e44('0xa')]);router[_0x4e44('0xb')]('/',auth[_0x4e44('0x7')](),controller[_0x4e44('0xc')]);router[_0x4e44('0xd')](_0x4e44('0x9'),auth[_0x4e44('0x7')](),controller[_0x4e44('0xe')]);router['delete'](_0x4e44('0x9'),auth[_0x4e44('0x7')](),controller[_0x4e44('0xf')]);module[_0x4e44('0x10')]=router; \ No newline at end of file +var _0x8782=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4f9415,_0x11717e){var _0x487c86=function(_0x41cbd6){while(--_0x41cbd6){_0x4f9415['push'](_0x4f9415['shift']());}};_0x487c86(++_0x11717e);}(_0x8782,0x17a));var _0x2878=function(_0x407565,_0x4c4d59){_0x407565=_0x407565-0x0;var _0x543a7c=_0x8782[_0x407565];return _0x543a7c;};'use strict';var multer=require(_0x2878('0x0'));var util=require(_0x2878('0x1'));var path=require(_0x2878('0x2'));var timeout=require(_0x2878('0x3'));var express=require(_0x2878('0x4'));var router=express[_0x2878('0x5')]();var fs_extra=require(_0x2878('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2878('0x7'));var config=require(_0x2878('0x8'));var controller=require(_0x2878('0x9'));router['get']('/',auth[_0x2878('0xa')](),controller['index']);router[_0x2878('0xb')](_0x2878('0xc'),auth[_0x2878('0xa')](),controller['show']);router[_0x2878('0xd')]('/',auth['isAuthenticated'](),controller[_0x2878('0xe')]);router[_0x2878('0xf')](_0x2878('0xc'),auth[_0x2878('0xa')](),controller[_0x2878('0x10')]);router[_0x2878('0x11')](_0x2878('0xc'),auth[_0x2878('0xa')](),controller[_0x2878('0x12')]);module[_0x2878('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a24ac69..40d281e 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 _0x473a=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0x473a,0x173));var _0xa473=function(_0x5aef1c,_0x1d7eb1){_0x5aef1c=_0x5aef1c-0x0;var _0x43b354=_0x473a[_0x5aef1c];return _0x43b354;};'use strict';var Sequelize=require(_0xa473('0x0'));var moment=require(_0xa473('0x1'));module[_0xa473('0x2')]={'time':{'type':Sequelize[_0xa473('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa473('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa473('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa473('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa473('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa473('0x4')],'allowNull':![],'defaultValue':moment()[_0xa473('0x5')](_0xa473('0x6'))}}; \ No newline at end of file +var _0x5c1f=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING'];(function(_0x4690a8,_0x250671){var _0x52e447=function(_0x5d74f6){while(--_0x5d74f6){_0x4690a8['push'](_0x4690a8['shift']());}};_0x52e447(++_0x250671);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x5c1f[_0x48c4ef];return _0x435715;};'use strict';var Sequelize=require(_0xf5c1('0x0'));var moment=require('moment');module[_0xf5c1('0x1')]={'time':{'type':Sequelize[_0xf5c1('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf5c1('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf5c1('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf5c1('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf5c1('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf5c1('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xf5c1('0x3')],'allowNull':![],'defaultValue':moment()[_0xf5c1('0x4')](_0xf5c1('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e95b527..9a56355 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 _0xa97d=['sort','where','filter','merge','includeAll','include','rows','catch','show','params','keys','create','body','find','destroy','rimraf','zip-dir','request-promise','mustache','util','path','sox','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x50af9c,_0xf03b1e){var _0x5b5e5a=function(_0x309a92){while(--_0x309a92){_0x50af9c['push'](_0x50af9c['shift']());}};_0x5b5e5a(++_0xf03b1e);}(_0xa97d,0x95));var _0xda97=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0xa97d[_0x39479f];return _0x4a6d96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda97('0x0'));var zipdir=require(_0xda97('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda97('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xda97('0x3'));var util=require(_0xda97('0x4'));var path=require(_0xda97('0x5'));var sox=require(_0xda97('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda97('0x7'));var _=require('lodash');var squel=require(_0xda97('0x8'));var crypto=require(_0xda97('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xda97('0xa'));var querystring=require(_0xda97('0xb'));var Papa=require(_0xda97('0xc'));var Redis=require(_0xda97('0xd'));var authService=require(_0xda97('0xe'));var qs=require(_0xda97('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda97('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xda97('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xda97('0x12'))['db'];function respondWithStatusCode(_0x3aea5e,_0x1f8b26){_0x1f8b26=_0x1f8b26||0xcc;return function(_0x2891f3){if(_0x2891f3){return _0x3aea5e[_0xda97('0x13')](_0x1f8b26);}return _0x3aea5e['status'](_0x1f8b26)['end']();};}function respondWithResult(_0x4885e8,_0x45e7f5){_0x45e7f5=_0x45e7f5||0xc8;return function(_0x5c31a9){if(_0x5c31a9){return _0x4885e8[_0xda97('0x14')](_0x45e7f5)[_0xda97('0x15')](_0x5c31a9);}};}function respondWithFilteredResult(_0x218218,_0x33f011){return function(_0x3c7d72){if(_0x3c7d72){var _0x47569e=typeof _0x33f011['offset']==='undefined'&&typeof _0x33f011[_0xda97('0x16')]==='undefined';var _0x12c144=_0x3c7d72['count'];var _0x2ef844=_0x47569e?0x0:_0x33f011[_0xda97('0x17')];var _0x1ab593=_0x47569e?_0x3c7d72[_0xda97('0x18')]:_0x33f011[_0xda97('0x17')]+_0x33f011[_0xda97('0x16')];var _0x348baf;if(_0x1ab593>=_0x12c144){_0x1ab593=_0x12c144;_0x348baf=0xc8;}else{_0x348baf=0xce;}_0x218218[_0xda97('0x14')](_0x348baf);return _0x218218[_0xda97('0x19')](_0xda97('0x1a'),_0x2ef844+'-'+_0x1ab593+'/'+_0x12c144)[_0xda97('0x15')](_0x3c7d72);}return null;};}function patchUpdates(_0x5c9ee7){return function(_0x4ef800){try{jsonpatch[_0xda97('0x1b')](_0x4ef800,_0x5c9ee7,!![]);}catch(_0x1831da){return BPromise[_0xda97('0x1c')](_0x1831da);}return _0x4ef800[_0xda97('0x1d')]();};}function saveUpdates(_0x104163,_0x21eed4){return function(_0x20988a){if(_0x20988a){return _0x20988a[_0xda97('0x1e')](_0x104163)[_0xda97('0x1f')](function(_0x4b8aea){return _0x4b8aea;});}return null;};}function removeEntity(_0x4709c2,_0x22acc1){return function(_0x362d31){if(_0x362d31){return _0x362d31['destroy']()['then'](function(){_0x4709c2[_0xda97('0x14')](0xcc)[_0xda97('0x20')]();});}};}function handleEntityNotFound(_0x4c2b87,_0x5d4c02){return function(_0x1e1b90){if(!_0x1e1b90){_0x4c2b87[_0xda97('0x13')](0x194);}return _0x1e1b90;};}function handleError(_0x59195f,_0x37329a){_0x37329a=_0x37329a||0x1f4;return function(_0x457876){logger['error'](_0x457876[_0xda97('0x21')]);if(_0x457876[_0xda97('0x22')]){delete _0x457876['name'];}_0x59195f['status'](_0x37329a)[_0xda97('0x23')](_0x457876);};}exports[_0xda97('0x24')]=function(_0x5a8dc2,_0x27b4e7){var _0x2bc8a0={},_0x299768={},_0x3dcbd9={'count':0x0,'rows':[]};var _0xee1573=_[_0xda97('0x25')](db[_0xda97('0x26')][_0xda97('0x27')],function(_0x3fce71){return{'name':_0x3fce71[_0xda97('0x28')],'type':_0x3fce71[_0xda97('0x29')][_0xda97('0x2a')]};});_0x299768[_0xda97('0x2b')]=_[_0xda97('0x25')](_0xee1573,_0xda97('0x22'));_0x299768[_0xda97('0x2c')]=_['keys'](_0x5a8dc2[_0xda97('0x2c')]);_0x299768[_0xda97('0x2d')]=_[_0xda97('0x2e')](_0x299768[_0xda97('0x2b')],_0x299768['query']);_0x2bc8a0[_0xda97('0x2f')]=_['intersection'](_0x299768['model'],qs['fields'](_0x5a8dc2['query'][_0xda97('0x30')]));_0x2bc8a0[_0xda97('0x2f')]=_0x2bc8a0[_0xda97('0x2f')][_0xda97('0x31')]?_0x2bc8a0[_0xda97('0x2f')]:_0x299768['model'];if(!_0x5a8dc2['query'][_0xda97('0x32')](_0xda97('0x33'))){_0x2bc8a0[_0xda97('0x16')]=qs[_0xda97('0x16')](_0x5a8dc2[_0xda97('0x2c')][_0xda97('0x16')]);_0x2bc8a0[_0xda97('0x17')]=qs[_0xda97('0x17')](_0x5a8dc2['query'][_0xda97('0x17')]);}_0x2bc8a0['order']=qs[_0xda97('0x34')](_0x5a8dc2['query'][_0xda97('0x34')]);_0x2bc8a0[_0xda97('0x35')]=qs[_0xda97('0x2d')](_['pick'](_0x5a8dc2['query'],_0x299768[_0xda97('0x2d')]),_0xee1573);if(_0x5a8dc2[_0xda97('0x2c')][_0xda97('0x36')]){_0x2bc8a0[_0xda97('0x35')]=_[_0xda97('0x37')](_0x2bc8a0[_0xda97('0x35')],{'$or':_[_0xda97('0x25')](_0xee1573,function(_0x2c3dd4){if(_0x2c3dd4[_0xda97('0x29')]!=='VIRTUAL'){var _0xa4a74c={};_0xa4a74c[_0x2c3dd4[_0xda97('0x22')]]={'$like':'%'+_0x5a8dc2['query'][_0xda97('0x36')]+'%'};return _0xa4a74c;}})});}_0x2bc8a0=_['merge']({},_0x2bc8a0,_0x5a8dc2['options']);var _0xd0a472={'where':_0x2bc8a0['where']};return db[_0xda97('0x26')]['count'](_0xd0a472)[_0xda97('0x1f')](function(_0x467fc9){_0x3dcbd9[_0xda97('0x18')]=_0x467fc9;if(_0x5a8dc2[_0xda97('0x2c')][_0xda97('0x38')]){_0x2bc8a0[_0xda97('0x39')]=[{'all':!![]}];}return db[_0xda97('0x26')]['findAll'](_0x2bc8a0);})['then'](function(_0x37b507){_0x3dcbd9[_0xda97('0x3a')]=_0x37b507;return _0x3dcbd9;})[_0xda97('0x1f')](respondWithFilteredResult(_0x27b4e7,_0x2bc8a0))[_0xda97('0x3b')](handleError(_0x27b4e7,null));};exports[_0xda97('0x3c')]=function(_0x5d0bae,_0xf0998c){var _0x322c72={'raw':!![],'where':{'id':_0x5d0bae[_0xda97('0x3d')]['id']}},_0x126768={};_0x126768['model']=_[_0xda97('0x3e')](db[_0xda97('0x26')][_0xda97('0x27')]);_0x126768[_0xda97('0x2c')]=_[_0xda97('0x3e')](_0x5d0bae[_0xda97('0x2c')]);_0x126768[_0xda97('0x2d')]=_[_0xda97('0x2e')](_0x126768[_0xda97('0x2b')],_0x126768[_0xda97('0x2c')]);_0x322c72[_0xda97('0x2f')]=_['intersection'](_0x126768[_0xda97('0x2b')],qs[_0xda97('0x30')](_0x5d0bae[_0xda97('0x2c')][_0xda97('0x30')]));_0x322c72[_0xda97('0x2f')]=_0x322c72[_0xda97('0x2f')][_0xda97('0x31')]?_0x322c72[_0xda97('0x2f')]:_0x126768[_0xda97('0x2b')];if(_0x5d0bae['query'][_0xda97('0x38')]){_0x322c72[_0xda97('0x39')]=[{'all':!![]}];}_0x322c72=_['merge']({},_0x322c72,_0x5d0bae['options']);return db[_0xda97('0x26')]['find'](_0x322c72)[_0xda97('0x1f')](handleEntityNotFound(_0xf0998c,null))['then'](respondWithResult(_0xf0998c,null))['catch'](handleError(_0xf0998c,null));};exports[_0xda97('0x3f')]=function(_0x33001f,_0x36ee5d){return db[_0xda97('0x26')][_0xda97('0x3f')](_0x33001f[_0xda97('0x40')],{})[_0xda97('0x1f')](respondWithResult(_0x36ee5d,0xc9))['catch'](handleError(_0x36ee5d,null));};exports[_0xda97('0x1e')]=function(_0x4cf5aa,_0xc2253b){if(_0x4cf5aa[_0xda97('0x40')]['id']){delete _0x4cf5aa[_0xda97('0x40')]['id'];}return db[_0xda97('0x26')][_0xda97('0x41')]({'where':{'id':_0x4cf5aa[_0xda97('0x3d')]['id']}})['then'](handleEntityNotFound(_0xc2253b,null))['then'](saveUpdates(_0x4cf5aa[_0xda97('0x40')],null))['then'](respondWithResult(_0xc2253b,null))['catch'](handleError(_0xc2253b,null));};exports[_0xda97('0x42')]=function(_0x5b9c67,_0x57370a){return db[_0xda97('0x26')][_0xda97('0x41')]({'where':{'id':_0x5b9c67[_0xda97('0x3d')]['id']}})[_0xda97('0x1f')](handleEntityNotFound(_0x57370a,null))['then'](removeEntity(_0x57370a,null))['catch'](handleError(_0x57370a,null));}; \ No newline at end of file +var _0xdf0a=['map','rawAttributes','fieldName','type','keys','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','VoiceQueuesLog','include','rows','catch','show','params','length','includeAll','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','reject','save','update','then','error','stack','name','index'];(function(_0x4480f8,_0x364a3d){var _0x4550f6=function(_0x49e8ca){while(--_0x49e8ca){_0x4480f8['push'](_0x4480f8['shift']());}};_0x4550f6(++_0x364a3d);}(_0xdf0a,0x148));var _0xadf0=function(_0xf44739,_0x4568b1){_0xf44739=_0xf44739-0x0;var _0x12edaf=_0xdf0a[_0xf44739];return _0x12edaf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xadf0('0x0'));var zipdir=require(_0xadf0('0x1'));var jsonpatch=require(_0xadf0('0x2'));var rp=require(_0xadf0('0x3'));var moment=require(_0xadf0('0x4'));var BPromise=require(_0xadf0('0x5'));var Mustache=require(_0xadf0('0x6'));var util=require('util');var path=require(_0xadf0('0x7'));var sox=require(_0xadf0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xadf0('0x9'));var _=require(_0xadf0('0xa'));var squel=require(_0xadf0('0xb'));var crypto=require(_0xadf0('0xc'));var jsforce=require(_0xadf0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xadf0('0xe'));var querystring=require('querystring');var Papa=require(_0xadf0('0xf'));var Redis=require(_0xadf0('0x10'));var authService=require(_0xadf0('0x11'));var qs=require(_0xadf0('0x12'));var as=require(_0xadf0('0x13'));var hardwareService=require(_0xadf0('0x14'));var logger=require(_0xadf0('0x15'))(_0xadf0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xadf0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x347333,_0x35863c){_0x35863c=_0x35863c||0xcc;return function(_0x5a5515){if(_0x5a5515){return _0x347333[_0xadf0('0x18')](_0x35863c);}return _0x347333[_0xadf0('0x19')](_0x35863c)[_0xadf0('0x1a')]();};}function respondWithResult(_0x4bdbc1,_0x318121){_0x318121=_0x318121||0xc8;return function(_0x277382){if(_0x277382){return _0x4bdbc1[_0xadf0('0x19')](_0x318121)['json'](_0x277382);}};}function respondWithFilteredResult(_0x6ac337,_0xe5d1d7){return function(_0x39b044){if(_0x39b044){var _0x51cd2f=typeof _0xe5d1d7['offset']==='undefined'&&typeof _0xe5d1d7[_0xadf0('0x1b')]===_0xadf0('0x1c');var _0x447022=_0x39b044['count'];var _0x13d71a=_0x51cd2f?0x0:_0xe5d1d7[_0xadf0('0x1d')];var _0x29fea6=_0x51cd2f?_0x39b044[_0xadf0('0x1e')]:_0xe5d1d7[_0xadf0('0x1d')]+_0xe5d1d7[_0xadf0('0x1b')];var _0x20bc77;if(_0x29fea6>=_0x447022){_0x29fea6=_0x447022;_0x20bc77=0xc8;}else{_0x20bc77=0xce;}_0x6ac337['status'](_0x20bc77);return _0x6ac337[_0xadf0('0x1f')](_0xadf0('0x20'),_0x13d71a+'-'+_0x29fea6+'/'+_0x447022)[_0xadf0('0x21')](_0x39b044);}return null;};}function patchUpdates(_0x37d206){return function(_0x1a4f10){try{jsonpatch['apply'](_0x1a4f10,_0x37d206,!![]);}catch(_0x1bdb37){return BPromise[_0xadf0('0x22')](_0x1bdb37);}return _0x1a4f10[_0xadf0('0x23')]();};}function saveUpdates(_0x345928,_0x771d9){return function(_0x417fcc){if(_0x417fcc){return _0x417fcc[_0xadf0('0x24')](_0x345928)[_0xadf0('0x25')](function(_0x2c859f){return _0x2c859f;});}return null;};}function removeEntity(_0x2f58d5,_0x3dae8b){return function(_0x4a2d71){if(_0x4a2d71){return _0x4a2d71['destroy']()[_0xadf0('0x25')](function(){_0x2f58d5[_0xadf0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1736ff,_0x22bd12){return function(_0x30d5b5){if(!_0x30d5b5){_0x1736ff[_0xadf0('0x18')](0x194);}return _0x30d5b5;};}function handleError(_0x382141,_0x383dd7){_0x383dd7=_0x383dd7||0x1f4;return function(_0x4bc936){logger[_0xadf0('0x26')](_0x4bc936[_0xadf0('0x27')]);if(_0x4bc936[_0xadf0('0x28')]){delete _0x4bc936[_0xadf0('0x28')];}_0x382141[_0xadf0('0x19')](_0x383dd7)['send'](_0x4bc936);};}exports[_0xadf0('0x29')]=function(_0x374148,_0xdbd88e){var _0x36ae37={},_0x57ca0a={},_0x399f8b={'count':0x0,'rows':[]};var _0x44d735=_[_0xadf0('0x2a')](db['VoiceQueuesLog'][_0xadf0('0x2b')],function(_0x200a26){return{'name':_0x200a26[_0xadf0('0x2c')],'type':_0x200a26[_0xadf0('0x2d')]['key']};});_0x57ca0a['model']=_[_0xadf0('0x2a')](_0x44d735,_0xadf0('0x28'));_0x57ca0a['query']=_[_0xadf0('0x2e')](_0x374148[_0xadf0('0x2f')]);_0x57ca0a['filters']=_['intersection'](_0x57ca0a[_0xadf0('0x30')],_0x57ca0a['query']);_0x36ae37[_0xadf0('0x31')]=_[_0xadf0('0x32')](_0x57ca0a[_0xadf0('0x30')],qs[_0xadf0('0x33')](_0x374148['query'][_0xadf0('0x33')]));_0x36ae37[_0xadf0('0x31')]=_0x36ae37[_0xadf0('0x31')]['length']?_0x36ae37[_0xadf0('0x31')]:_0x57ca0a[_0xadf0('0x30')];if(!_0x374148[_0xadf0('0x2f')][_0xadf0('0x34')](_0xadf0('0x35'))){_0x36ae37[_0xadf0('0x1b')]=qs[_0xadf0('0x1b')](_0x374148[_0xadf0('0x2f')]['limit']);_0x36ae37[_0xadf0('0x1d')]=qs[_0xadf0('0x1d')](_0x374148['query']['offset']);}_0x36ae37[_0xadf0('0x36')]=qs['sort'](_0x374148[_0xadf0('0x2f')]['sort']);_0x36ae37[_0xadf0('0x37')]=qs['filters'](_[_0xadf0('0x38')](_0x374148[_0xadf0('0x2f')],_0x57ca0a[_0xadf0('0x39')]),_0x44d735);if(_0x374148['query'][_0xadf0('0x3a')]){_0x36ae37['where']=_[_0xadf0('0x3b')](_0x36ae37[_0xadf0('0x37')],{'$or':_[_0xadf0('0x2a')](_0x44d735,function(_0x57eb83){if(_0x57eb83[_0xadf0('0x2d')]!==_0xadf0('0x3c')){var _0x50f65f={};_0x50f65f[_0x57eb83[_0xadf0('0x28')]]={'$like':'%'+_0x374148[_0xadf0('0x2f')]['filter']+'%'};return _0x50f65f;}})});}_0x36ae37=_[_0xadf0('0x3b')]({},_0x36ae37,_0x374148[_0xadf0('0x3d')]);var _0x3b0f6b={'where':_0x36ae37['where']};return db[_0xadf0('0x3e')][_0xadf0('0x1e')](_0x3b0f6b)[_0xadf0('0x25')](function(_0x565780){_0x399f8b[_0xadf0('0x1e')]=_0x565780;if(_0x374148[_0xadf0('0x2f')]['includeAll']){_0x36ae37[_0xadf0('0x3f')]=[{'all':!![]}];}return db[_0xadf0('0x3e')]['findAll'](_0x36ae37);})[_0xadf0('0x25')](function(_0x45263a){_0x399f8b[_0xadf0('0x40')]=_0x45263a;return _0x399f8b;})[_0xadf0('0x25')](respondWithFilteredResult(_0xdbd88e,_0x36ae37))[_0xadf0('0x41')](handleError(_0xdbd88e,null));};exports[_0xadf0('0x42')]=function(_0x3e3e45,_0x5671f3){var _0x188a65={'raw':!![],'where':{'id':_0x3e3e45[_0xadf0('0x43')]['id']}},_0x166761={};_0x166761[_0xadf0('0x30')]=_[_0xadf0('0x2e')](db['VoiceQueuesLog'][_0xadf0('0x2b')]);_0x166761[_0xadf0('0x2f')]=_[_0xadf0('0x2e')](_0x3e3e45['query']);_0x166761[_0xadf0('0x39')]=_[_0xadf0('0x32')](_0x166761[_0xadf0('0x30')],_0x166761[_0xadf0('0x2f')]);_0x188a65['attributes']=_[_0xadf0('0x32')](_0x166761['model'],qs['fields'](_0x3e3e45[_0xadf0('0x2f')][_0xadf0('0x33')]));_0x188a65[_0xadf0('0x31')]=_0x188a65['attributes'][_0xadf0('0x44')]?_0x188a65['attributes']:_0x166761[_0xadf0('0x30')];if(_0x3e3e45[_0xadf0('0x2f')][_0xadf0('0x45')]){_0x188a65[_0xadf0('0x3f')]=[{'all':!![]}];}_0x188a65=_[_0xadf0('0x3b')]({},_0x188a65,_0x3e3e45['options']);return db['VoiceQueuesLog']['find'](_0x188a65)['then'](handleEntityNotFound(_0x5671f3,null))[_0xadf0('0x25')](respondWithResult(_0x5671f3,null))['catch'](handleError(_0x5671f3,null));};exports[_0xadf0('0x46')]=function(_0x526e94,_0x45efc6){return db[_0xadf0('0x3e')]['create'](_0x526e94[_0xadf0('0x47')],{})['then'](respondWithResult(_0x45efc6,0xc9))[_0xadf0('0x41')](handleError(_0x45efc6,null));};exports[_0xadf0('0x24')]=function(_0x5a5b34,_0x423089){if(_0x5a5b34[_0xadf0('0x47')]['id']){delete _0x5a5b34[_0xadf0('0x47')]['id'];}return db[_0xadf0('0x3e')][_0xadf0('0x48')]({'where':{'id':_0x5a5b34['params']['id']}})[_0xadf0('0x25')](handleEntityNotFound(_0x423089,null))[_0xadf0('0x25')](saveUpdates(_0x5a5b34[_0xadf0('0x47')],null))['then'](respondWithResult(_0x423089,null))['catch'](handleError(_0x423089,null));};exports[_0xadf0('0x49')]=function(_0x1a83ab,_0x2c6eb8){return db['VoiceQueuesLog'][_0xadf0('0x48')]({'where':{'id':_0x1a83ab['params']['id']}})[_0xadf0('0x25')](handleEntityNotFound(_0x2c6eb8,null))[_0xadf0('0x25')](removeEntity(_0x2c6eb8,null))['catch'](handleError(_0x2c6eb8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index ccc01dc..3121bc6 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 _0x1cea=['event','dtm','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm'];(function(_0x3b7d34,_0x30c6a6){var _0x3d42b1=function(_0x387997){while(--_0x387997){_0x3b7d34['push'](_0x3b7d34['shift']());}};_0x3d42b1(++_0x30c6a6);}(_0x1cea,0xfe));var _0xa1ce=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x1cea[_0x27e811];return _0x1627fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa1ce('0x0'))(_0xa1ce('0x1'));var moment=require(_0xa1ce('0x2'));var BPromise=require(_0xa1ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1ce('0x4'));var rimraf=require(_0xa1ce('0x5'));var config=require(_0xa1ce('0x6'));var attributes=require(_0xa1ce('0x7'));module[_0xa1ce('0x8')]=function(_0x17654c,_0x5aab1c){return _0x17654c[_0xa1ce('0x9')](_0xa1ce('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xa1ce('0xb'),'fields':[_0xa1ce('0xc'),_0xa1ce('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1714=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1714,0x160));var _0x4171=function(_0x5e5fa2,_0xca8c02){_0x5e5fa2=_0x5e5fa2-0x0;var _0x12c987=_0x1714[_0x5e5fa2];return _0x12c987;};'use strict';var _=require(_0x4171('0x0'));var util=require(_0x4171('0x1'));var logger=require(_0x4171('0x2'))(_0x4171('0x3'));var moment=require(_0x4171('0x4'));var BPromise=require(_0x4171('0x5'));var rp=require(_0x4171('0x6'));var fs=require('fs');var path=require(_0x4171('0x7'));var rimraf=require(_0x4171('0x8'));var config=require(_0x4171('0x9'));var attributes=require(_0x4171('0xa'));module[_0x4171('0xb')]=function(_0x3e12f6,_0x409436){return _0x3e12f6[_0x4171('0xc')](_0x4171('0xd'),attributes,{'tableName':_0x4171('0xe'),'paranoid':![],'indexes':[{'name':_0x4171('0xf'),'fields':[_0x4171('0x10'),_0x4171('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 82396a7..fc6c530 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 _0x92d7=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x479e21,_0x385fd9){var _0x422e9c=function(_0x1dc4ca){while(--_0x1dc4ca){_0x479e21['push'](_0x479e21['shift']());}};_0x422e9c(++_0x385fd9);}(_0x92d7,0x17b));var _0x792d=function(_0x36170a,_0x72f767){_0x36170a=_0x36170a-0x0;var _0x55076c=_0x92d7[_0x36170a];return _0x55076c;};'use strict';var _=require(_0x792d('0x0'));var util=require('util');var moment=require(_0x792d('0x1'));var BPromise=require(_0x792d('0x2'));var rs=require(_0x792d('0x3'));var fs=require('fs');var Redis=require(_0x792d('0x4'));var db=require(_0x792d('0x5'))['db'];var utils=require(_0x792d('0x6'));var logger=require(_0x792d('0x7'))(_0x792d('0x8'));var config=require(_0x792d('0x9'));var jayson=require(_0x792d('0xa'));var client=jayson['client'][_0x792d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238cab,_0x7cfc16,_0x11240a){return new BPromise(function(_0x56f730,_0x309f0e){return client[_0x792d('0xc')](_0x238cab,_0x11240a)[_0x792d('0xd')](function(_0xe14801){logger[_0x792d('0xe')](_0x792d('0xf'),_0x7cfc16,_0x792d('0x10'));logger['debug'](_0x792d('0x11'),_0x7cfc16,'request\x20sent',JSON[_0x792d('0x12')](_0xe14801));if(_0xe14801[_0x792d('0x13')]){if(_0xe14801['error']['code']===0x1f4){logger[_0x792d('0x13')](_0x792d('0xf'),_0x7cfc16,_0xe14801[_0x792d('0x13')]['message']);return _0x309f0e(_0xe14801[_0x792d('0x13')][_0x792d('0x14')]);}logger[_0x792d('0x13')](_0x792d('0xf'),_0x7cfc16,_0xe14801[_0x792d('0x13')][_0x792d('0x14')]);return _0x56f730(_0xe14801[_0x792d('0x13')][_0x792d('0x14')]);}else{logger[_0x792d('0xe')](_0x792d('0xf'),_0x7cfc16,_0x792d('0x10'));_0x56f730(_0xe14801[_0x792d('0x15')][_0x792d('0x14')]);}})[_0x792d('0x16')](function(_0x45b458){logger['error'](_0x792d('0xf'),_0x7cfc16,_0x45b458);_0x309f0e(_0x45b458);});});} \ No newline at end of file +var _0x1e91=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x11c225,_0x117302){var _0x488623=function(_0x227765){while(--_0x227765){_0x11c225['push'](_0x11c225['shift']());}};_0x488623(++_0x117302);}(_0x1e91,0xe3));var _0x11e9=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0x1e91[_0x3ad7ad];return _0x225a60;};'use strict';var _=require('lodash');var util=require(_0x11e9('0x0'));var moment=require('moment');var BPromise=require(_0x11e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11e9('0x2'));var db=require(_0x11e9('0x3'))['db'];var utils=require(_0x11e9('0x4'));var logger=require(_0x11e9('0x5'))('rpc');var config=require(_0x11e9('0x6'));var jayson=require(_0x11e9('0x7'));var client=jayson[_0x11e9('0x8')][_0x11e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20954e,_0x32ced5,_0x56ef81){return new BPromise(function(_0x579026,_0xc95e3c){return client[_0x11e9('0xa')](_0x20954e,_0x56ef81)[_0x11e9('0xb')](function(_0x1a4fd8){logger[_0x11e9('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x32ced5,_0x11e9('0xd'));logger[_0x11e9('0xe')](_0x11e9('0xf'),_0x32ced5,_0x11e9('0xd'),JSON[_0x11e9('0x10')](_0x1a4fd8));if(_0x1a4fd8[_0x11e9('0x11')]){if(_0x1a4fd8[_0x11e9('0x11')][_0x11e9('0x12')]===0x1f4){logger[_0x11e9('0x11')](_0x11e9('0x13'),_0x32ced5,_0x1a4fd8['error'][_0x11e9('0x14')]);return _0xc95e3c(_0x1a4fd8[_0x11e9('0x11')][_0x11e9('0x14')]);}logger[_0x11e9('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x32ced5,_0x1a4fd8[_0x11e9('0x11')]['message']);return _0x579026(_0x1a4fd8['error'][_0x11e9('0x14')]);}else{logger[_0x11e9('0xc')](_0x11e9('0x13'),_0x32ced5,_0x11e9('0xd'));_0x579026(_0x1a4fd8[_0x11e9('0x15')][_0x11e9('0x14')]);}})['catch'](function(_0x952f3f){logger[_0x11e9('0x11')](_0x11e9('0x13'),_0x32ced5,_0x952f3f);_0xc95e3c(_0x952f3f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7b1a510..2427827 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 _0x8eae=['/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','index','/describe','isAuthenticated','describe','get'];(function(_0x8181f3,_0x27ddbf){var _0x16cf82=function(_0x11e05f){while(--_0x11e05f){_0x8181f3['push'](_0x8181f3['shift']());}};_0x16cf82(++_0x27ddbf);}(_0x8eae,0xd5));var _0xe8ea=function(_0x3fa631,_0x24392c){_0x3fa631=_0x3fa631-0x0;var _0x5c9dec=_0x8eae[_0x3fa631];return _0x5c9dec;};'use strict';var multer=require('multer');var util=require(_0xe8ea('0x0'));var path=require(_0xe8ea('0x1'));var timeout=require(_0xe8ea('0x2'));var express=require(_0xe8ea('0x3'));var router=express[_0xe8ea('0x4')]();var fs_extra=require(_0xe8ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe8ea('0x6'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe8ea('0x7')]);router['get'](_0xe8ea('0x8'),auth[_0xe8ea('0x9')](),controller[_0xe8ea('0xa')]);router[_0xe8ea('0xb')](_0xe8ea('0xc'),auth[_0xe8ea('0x9')](),controller[_0xe8ea('0xd')]);router[_0xe8ea('0xb')](_0xe8ea('0xe'),auth['isAuthenticated'](),controller[_0xe8ea('0xf')]);router[_0xe8ea('0xb')](_0xe8ea('0x10'),controller[_0xe8ea('0x11')]);router[_0xe8ea('0xb')](_0xe8ea('0x12'),auth[_0xe8ea('0x9')](),controller[_0xe8ea('0x13')]);router[_0xe8ea('0x14')]('/',auth[_0xe8ea('0x9')](),controller['create']);router[_0xe8ea('0x14')]('/:id/transcribe',auth[_0xe8ea('0x9')](),controller[_0xe8ea('0x15')]);router[_0xe8ea('0x16')](_0xe8ea('0xc'),auth[_0xe8ea('0x9')](),controller[_0xe8ea('0x17')]);router['delete']('/:id',auth[_0xe8ea('0x9')](),controller['destroy']);module[_0xe8ea('0x18')]=router; \ No newline at end of file +var _0xa971=['/:id','show','/:id/downloads','/:id/transcribe','post','runTranscribe','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x5b290f,_0x3f6490){var _0x3b54f4=function(_0x4f6353){while(--_0x4f6353){_0x5b290f['push'](_0x5b290f['shift']());}};_0x3b54f4(++_0x3f6490);}(_0xa971,0xdc));var _0x1a97=function(_0x43ddd1,_0x3f4da1){_0x43ddd1=_0x43ddd1-0x0;var _0x13da10=_0xa971[_0x43ddd1];return _0x13da10;};'use strict';var multer=require(_0x1a97('0x0'));var util=require(_0x1a97('0x1'));var path=require('path');var timeout=require(_0x1a97('0x2'));var express=require(_0x1a97('0x3'));var router=express[_0x1a97('0x4')]();var fs_extra=require(_0x1a97('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a97('0x6'));var controller=require('./voiceRecording.controller');router[_0x1a97('0x7')]('/',auth[_0x1a97('0x8')](),controller[_0x1a97('0x9')]);router[_0x1a97('0x7')]('/describe',auth[_0x1a97('0x8')](),controller[_0x1a97('0xa')]);router[_0x1a97('0x7')](_0x1a97('0xb'),auth['isAuthenticated'](),controller[_0x1a97('0xc')]);router[_0x1a97('0x7')]('/:id/download',auth[_0x1a97('0x8')](),controller['download']);router[_0x1a97('0x7')](_0x1a97('0xd'),controller['downloads']);router[_0x1a97('0x7')](_0x1a97('0xe'),auth[_0x1a97('0x8')](),controller['downloadTranscribe']);router['post']('/',auth[_0x1a97('0x8')](),controller['create']);router[_0x1a97('0xf')](_0x1a97('0xe'),auth['isAuthenticated'](),controller[_0x1a97('0x10')]);router[_0x1a97('0x11')]('/:id',auth[_0x1a97('0x8')](),controller[_0x1a97('0x12')]);router[_0x1a97('0x13')](_0x1a97('0xb'),auth[_0x1a97('0x8')](),controller[_0x1a97('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 9087f04..8e0534a 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(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 edde76f..11a8b5e 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 _0x26c7=['status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','map','VIRTUAL','includeAll','include','findAll','catch','show','params','merge','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','decryptFile','ValidationError','extname','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','transcribeName','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','language','IN_PROGRESS','writeFile','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x26c7,0x7a));var _0x726c=function(_0x1bb11e,_0x58fd78){_0x1bb11e=_0x1bb11e-0x0;var _0x422492=_0x26c7[_0x1bb11e];return _0x422492;};'use strict';var emlformat=require(_0x726c('0x0'));var rimraf=require(_0x726c('0x1'));var zipdir=require(_0x726c('0x2'));var jsonpatch=require(_0x726c('0x3'));var rp=require(_0x726c('0x4'));var moment=require(_0x726c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x726c('0x6'));var util=require(_0x726c('0x7'));var path=require(_0x726c('0x8'));var sox=require(_0x726c('0x9'));var csv=require(_0x726c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x726c('0xb'));var _=require(_0x726c('0xc'));var squel=require(_0x726c('0xd'));var crypto=require(_0x726c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x726c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x726c('0x10'));var Papa=require(_0x726c('0x11'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x726c('0x12'));var authService=require(_0x726c('0x13'));var qs=require(_0x726c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x726c('0x15'));var logger=require('../../config/logger')(_0x726c('0x16'));var utils=require('../../config/utils');var config=require(_0x726c('0x17'));var licenseUtil=require(_0x726c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x281596,_0x42142a){_0x42142a=_0x42142a||0xcc;return function(_0x53ca16){if(_0x53ca16){return _0x281596[_0x726c('0x19')](_0x42142a);}return _0x281596[_0x726c('0x1a')](_0x42142a)[_0x726c('0x1b')]();};}function respondWithResult(_0x1a1b00,_0x57f983){_0x57f983=_0x57f983||0xc8;return function(_0x2e0704){if(_0x2e0704){return _0x1a1b00[_0x726c('0x1a')](_0x57f983)[_0x726c('0x1c')](_0x2e0704);}};}function respondWithFilteredResult(_0x5ae72f,_0x4d032b){return function(_0x47db81){if(_0x47db81){var _0x24cd9b=typeof _0x4d032b[_0x726c('0x1d')]===_0x726c('0x1e')&&typeof _0x4d032b[_0x726c('0x1f')]===_0x726c('0x1e');var _0x1ddca1=_0x47db81[_0x726c('0x20')];var _0x16c4be=_0x24cd9b?0x0:_0x4d032b[_0x726c('0x1d')];var _0x5a6e2f=_0x24cd9b?_0x47db81[_0x726c('0x20')]:_0x4d032b[_0x726c('0x1d')]+_0x4d032b['limit'];var _0x1dc697;if(_0x5a6e2f>=_0x1ddca1){_0x5a6e2f=_0x1ddca1;_0x1dc697=0xc8;}else{_0x1dc697=0xce;}_0x5ae72f[_0x726c('0x1a')](_0x1dc697);return _0x5ae72f[_0x726c('0x21')]('Content-Range',_0x16c4be+'-'+_0x5a6e2f+'/'+_0x1ddca1)[_0x726c('0x1c')](_0x47db81);}return null;};}function patchUpdates(_0xccfaa4){return function(_0x1d575d){try{jsonpatch[_0x726c('0x22')](_0x1d575d,_0xccfaa4,!![]);}catch(_0xe3d851){return BPromise[_0x726c('0x23')](_0xe3d851);}return _0x1d575d[_0x726c('0x24')]();};}function saveUpdates(_0x1a7585,_0x39c0eb){return function(_0x1f6984){if(_0x1f6984){return _0x1f6984[_0x726c('0x25')](_0x1a7585)[_0x726c('0x26')](function(_0x3fa84f){return _0x3fa84f;});}return null;};}function removeEntity(_0x22cf52,_0x2d8937){return function(_0x31d42e){if(_0x31d42e){return _0x31d42e[_0x726c('0x27')]()[_0x726c('0x26')](function(){_0x22cf52[_0x726c('0x1a')](0xcc)[_0x726c('0x1b')]();});}};}function handleEntityNotFound(_0x4415a8,_0x250c9e){return function(_0x26833c){if(!_0x26833c){_0x4415a8[_0x726c('0x19')](0x194);}return _0x26833c;};}function handleError(_0x48a29c,_0x3b8971){_0x3b8971=_0x3b8971||0x1f4;return function(_0x29440f){logger['error'](_0x29440f[_0x726c('0x28')]);if(_0x29440f[_0x726c('0x29')]){delete _0x29440f[_0x726c('0x29')];}_0x48a29c['status'](_0x3b8971)[_0x726c('0x2a')](_0x29440f);};}exports[_0x726c('0x2b')]=function(_0x5ed36b,_0x173cc6){var _0x4bc068={},_0x1d97cc={},_0x2ca43b={'count':0x0,'rows':[]};var _0x4de195=_['map'](db[_0x726c('0x2c')][_0x726c('0x2d')],function(_0x15b3f2){return{'name':_0x15b3f2[_0x726c('0x2e')],'type':_0x15b3f2[_0x726c('0x2f')][_0x726c('0x30')]};});_0x1d97cc[_0x726c('0x31')]=_['differenceBy'](_['map'](_0x4de195,'name'),[_0x726c('0x32')]);_0x1d97cc[_0x726c('0x33')]=_[_0x726c('0x34')](_0x5ed36b[_0x726c('0x33')]);_0x1d97cc['filters']=_[_0x726c('0x35')](_0x1d97cc[_0x726c('0x31')],_0x1d97cc[_0x726c('0x33')]);_0x4bc068[_0x726c('0x36')]=_['intersection'](_0x1d97cc[_0x726c('0x31')],qs[_0x726c('0x37')](_0x5ed36b[_0x726c('0x33')][_0x726c('0x37')]));_0x4bc068[_0x726c('0x36')]=_0x4bc068[_0x726c('0x36')][_0x726c('0x38')]?_0x4bc068[_0x726c('0x36')]:_0x1d97cc[_0x726c('0x31')];if(!_0x5ed36b[_0x726c('0x33')][_0x726c('0x39')](_0x726c('0x3a'))){_0x4bc068[_0x726c('0x1f')]=qs[_0x726c('0x1f')](_0x5ed36b[_0x726c('0x33')][_0x726c('0x1f')]);_0x4bc068[_0x726c('0x1d')]=qs[_0x726c('0x1d')](_0x5ed36b[_0x726c('0x33')][_0x726c('0x1d')]);}_0x4bc068['order']=qs[_0x726c('0x3b')](_0x5ed36b[_0x726c('0x33')][_0x726c('0x3b')]);_0x4bc068['where']=qs[_0x726c('0x3c')](_['pick'](_0x5ed36b[_0x726c('0x33')],_0x1d97cc[_0x726c('0x3c')]),_0x4de195);if(_0x5ed36b['query'][_0x726c('0x3d')]){_0x4bc068[_0x726c('0x3e')]=_['merge'](_0x4bc068['where'],{'$or':_[_0x726c('0x3f')](_0x4de195,function(_0x273e29){if(_0x273e29[_0x726c('0x2f')]!==_0x726c('0x40')){var _0x5f23a5={};_0x5f23a5[_0x273e29[_0x726c('0x29')]]={'$like':'%'+_0x5ed36b['query'][_0x726c('0x3d')]+'%'};return _0x5f23a5;}})});}_0x4bc068=_['merge']({},_0x4bc068,_0x5ed36b['options']);var _0x37f1cf={'where':_0x4bc068[_0x726c('0x3e')]};return db[_0x726c('0x2c')][_0x726c('0x20')](_0x37f1cf)[_0x726c('0x26')](function(_0x526424){_0x2ca43b['count']=_0x526424;if(_0x5ed36b[_0x726c('0x33')][_0x726c('0x41')]){_0x4bc068[_0x726c('0x42')]=[{'all':!![]}];}return db[_0x726c('0x2c')][_0x726c('0x43')](_0x4bc068);})[_0x726c('0x26')](function(_0x57af20){_0x2ca43b['rows']=_0x57af20;return _0x2ca43b;})[_0x726c('0x26')](respondWithFilteredResult(_0x173cc6,_0x4bc068))[_0x726c('0x44')](handleError(_0x173cc6,null));};exports[_0x726c('0x45')]=function(_0x149a24,_0xcee796){var _0x5ab5fa={'raw':![],'where':{'id':_0x149a24[_0x726c('0x46')]['id']}},_0x36e7fd={};_0x36e7fd[_0x726c('0x31')]=_['keys'](db[_0x726c('0x2c')][_0x726c('0x2d')]);_0x36e7fd['query']=_[_0x726c('0x34')](_0x149a24[_0x726c('0x33')]);_0x36e7fd[_0x726c('0x3c')]=_[_0x726c('0x35')](_0x36e7fd[_0x726c('0x31')],_0x36e7fd[_0x726c('0x33')]);_0x5ab5fa[_0x726c('0x36')]=_[_0x726c('0x35')](_0x36e7fd[_0x726c('0x31')],qs[_0x726c('0x37')](_0x149a24[_0x726c('0x33')]['fields']));_0x5ab5fa['attributes']=_0x5ab5fa['attributes'][_0x726c('0x38')]?_0x5ab5fa[_0x726c('0x36')]:_0x36e7fd['model'];if(_0x149a24[_0x726c('0x33')][_0x726c('0x41')]){_0x5ab5fa[_0x726c('0x42')]=[{'all':!![]}];}_0x5ab5fa=_[_0x726c('0x47')]({},_0x5ab5fa,_0x149a24[_0x726c('0x48')]);return db[_0x726c('0x2c')][_0x726c('0x49')](_0x5ab5fa)['then'](handleEntityNotFound(_0xcee796,null))['then'](respondWithResult(_0xcee796,null))['catch'](handleError(_0xcee796,null));};exports[_0x726c('0x4a')]=function(_0x3abf31,_0x8c8c1c){return db[_0x726c('0x2c')][_0x726c('0x4a')](_0x3abf31[_0x726c('0x4b')],{})[_0x726c('0x26')](respondWithResult(_0x8c8c1c,0xc9))[_0x726c('0x44')](handleError(_0x8c8c1c,null));};exports[_0x726c('0x25')]=function(_0x503edd,_0x5ee821){if(_0x503edd[_0x726c('0x4b')]['id']){delete _0x503edd[_0x726c('0x4b')]['id'];}return db[_0x726c('0x2c')][_0x726c('0x49')]({'where':{'id':_0x503edd[_0x726c('0x46')]['id']}})[_0x726c('0x26')](handleEntityNotFound(_0x5ee821,null))[_0x726c('0x26')](saveUpdates(_0x503edd[_0x726c('0x4b')],null))[_0x726c('0x26')](respondWithResult(_0x5ee821,null))['catch'](handleError(_0x5ee821,null));};exports[_0x726c('0x4c')]=function(_0x172b21,_0x3e9c21){return db[_0x726c('0x2c')][_0x726c('0x4c')]()[_0x726c('0x26')](respondWithResult(_0x3e9c21,null))[_0x726c('0x44')](handleError(_0x3e9c21,null));};exports[_0x726c('0x4d')]=function(_0x2eca01,_0x4d976f,_0x3950e7){var _0x320ea8=require(_0x726c('0x4e'));var _0x297b2b=![];var _0x18321d={};if(_0x2eca01[_0x726c('0x33')][_0x726c('0x2f')]&&_0x2eca01[_0x726c('0x33')]['type']===_0x726c('0x4f')){_0x18321d[_0x726c('0x4f')]=_0x2eca01['params']['id'];}else{_0x18321d['id']=_0x2eca01[_0x726c('0x46')]['id'];}return db[_0x726c('0x2c')]['find']({'where':_0x18321d,'attributes':['id','value'],'raw':!![]})[_0x726c('0x26')](handleEntityNotFound(_0x4d976f,null))[_0x726c('0x26')](function(_0x149a98){if(_0x149a98){var _0x1d8e3f=_0x149a98[_0x726c('0x50')];var _0x20ea0c=util[_0x726c('0x32')](_0x726c('0x51'),_0x1d8e3f);if(fs[_0x726c('0x52')](_0x20ea0c)){_0x297b2b=!![];return _0x320ea8['decryptFile'](_0x20ea0c,_0x1d8e3f,config[_0x726c('0x53')][_0x726c('0x54')])[_0x726c('0x26')](function(){return _0x149a98;});}return _0x149a98;}})[_0x726c('0x26')](function(_0x312f1c){if(_0x312f1c){var _0x2fe4ae=_0x312f1c[_0x726c('0x50')];if(!fs[_0x726c('0x52')](_0x2fe4ae)){throw new db[(_0x726c('0x55'))]['ValidationError'](_0x726c('0x56'));}if(_0x312f1c[_0x726c('0x57')]){return _0x4d976f[_0x726c('0x4d')](_0x2fe4ae,_0x312f1c[_0x726c('0x57')]+path['extname'](_0x2fe4ae),function(){if(_0x297b2b){fs['unlink'](_0x2fe4ae);}});}else{return _0x4d976f[_0x726c('0x4d')](_0x2fe4ae,function(_0x3926d8){if(_0x297b2b){fs[_0x726c('0x58')](_0x2fe4ae);}});}}})[_0x726c('0x44')](function(_0xf7114f){if(_0xf7114f[_0x726c('0x59')]===_0x726c('0x56')){_0x4d976f[_0x726c('0x1a')](0x194)[_0x726c('0x2a')](_0x726c('0x5a'));}else{return handleError(_0x4d976f,null);}});};exports[_0x726c('0x5b')]=function(_0x257f88,_0x37a478,_0x20a271){var _0x5ce93f=require('../../components/encryptor');var _0x53ba19=![];var _0x1c0e10={'$and':[db[_0x726c('0x5c')][_0x726c('0x3e')](db[_0x726c('0x5c')]['fn'](_0x726c('0x5d'),db[_0x726c('0x5c')][_0x726c('0x5e')](_0x726c('0x4f'))),_0x257f88['query']['token'])]};if(_0x257f88[_0x726c('0x33')][_0x726c('0x2f')]&&_0x257f88[_0x726c('0x33')][_0x726c('0x2f')]===_0x726c('0x4f')){_0x1c0e10[_0x726c('0x5f')][_0x726c('0x60')]({'uniqueid':_0x257f88[_0x726c('0x46')]['id']});}else{_0x1c0e10['$and'][_0x726c('0x60')]({'id':_0x257f88[_0x726c('0x46')]['id']});}return db['VoiceRecording'][_0x726c('0x49')]({'where':_0x1c0e10,'attributes':['id',_0x726c('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x37a478,null))[_0x726c('0x26')](function(_0x4b2dea){if(_0x4b2dea){var _0xf6476a=util[_0x726c('0x32')](_0x726c('0x51'),_0x4b2dea['value']);if(fs[_0x726c('0x52')](_0xf6476a)){_0x53ba19=!![];return _0x5ce93f[_0x726c('0x61')](_0xf6476a,_0x4b2dea[_0x726c('0x50')],config['secrets'][_0x726c('0x54')])[_0x726c('0x26')](function(){return _0x4b2dea;});}return _0x4b2dea;}})['then'](function(_0x2686eb){if(_0x2686eb){if(!fs[_0x726c('0x52')](_0x2686eb[_0x726c('0x50')])){throw new db[(_0x726c('0x55'))][(_0x726c('0x62'))](_0x726c('0x56'));}if(_0x2686eb[_0x726c('0x57')]){return _0x37a478[_0x726c('0x4d')](_0x2686eb['value'],_0x2686eb['filename']+path[_0x726c('0x63')](_0x2686eb[_0x726c('0x50')]),function(){if(_0x53ba19){fs['unlink'](_0x2686eb[_0x726c('0x50')]);}});}else{return _0x37a478[_0x726c('0x4d')](_0x2686eb[_0x726c('0x50')],function(_0x19822b){if(_0x53ba19){fs[_0x726c('0x58')](_0x2686eb['value']);}});}}})[_0x726c('0x44')](handleError(_0x37a478,null));};exports[_0x726c('0x27')]=function(_0x26f444,_0x590dc1){return db[_0x726c('0x2c')]['find']({'where':{'id':_0x26f444[_0x726c('0x46')]['id']}})['then'](function(_0x2ccb0f){if(_[_0x726c('0x64')](_0x2ccb0f)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ccb0f;})[_0x726c('0x26')](function(_0x4ab3e2){var _0x141ae1=_0x4ab3e2['value'];logger[_0x726c('0x65')](_0x726c('0x66'),_0x141ae1);if(!_['isNil'](_0x4ab3e2[_0x726c('0x50')])&&fs[_0x726c('0x52')](_0x141ae1)){logger[_0x726c('0x65')](_0x726c('0x67')+_0x141ae1+_0x726c('0x68'));fs[_0x726c('0x69')](_0x141ae1);}_0x141ae1=_0x141ae1+_0x726c('0x6a');if(!_[_0x726c('0x64')](_0x4ab3e2['value'])&&fs[_0x726c('0x52')](_0x141ae1)){logger[_0x726c('0x65')](_0x726c('0x67')+_0x141ae1+_0x726c('0x68'));fs[_0x726c('0x69')](_0x141ae1);}return _0x4ab3e2;})[_0x726c('0x26')](function(_0x65dfe5){if(!_0x65dfe5)throw new InternalError();return _0x65dfe5['destroy']();})[_0x726c('0x26')](function(){_0x590dc1[_0x726c('0x1a')](0xcc)['end']();})[_0x726c('0x44')](handleError(_0x590dc1,null));};function getBucketslist(_0x594c7a,_0xa3464e,_0x147c96){return new Promise(function(_0x1d4d46,_0x335b21){var _0x2ca05b=new AWS['S3']({'accessKeyId':_0xa3464e,'secretAccessKey':_0x594c7a,'region':_0x147c96});_0x2ca05b[_0x726c('0x6b')]({},function(_0x5499d3,_0x4883f6){if(_0x5499d3){return _0x335b21(_0x5499d3);}else{return _0x1d4d46(_0x4883f6);}});});}function createBucket(_0x6b625c,_0x4af0a1,_0x33728a,_0x5a42f3){return new Promise(function(_0xc8b1e5,_0x532c00){var _0x5f05b6=new AWS['S3']({'accessKeyId':_0x4af0a1,'secretAccessKey':_0x6b625c,'region':_0x33728a});_0x5f05b6[_0x726c('0x6c')]({'Bucket':_0x5a42f3},function(_0xb43edc,_0x449d6c){if(_0xb43edc){return _0x532c00(_0xb43edc);}else{return _0xc8b1e5(_0x449d6c);}});});}function uploadFile(_0x171fab,_0x590c87,_0xa1c385,_0x5b4f3c,_0x3496eb,_0x2ef7e9){return new Promise(function(_0x13cf8f,_0x3ca98c){var _0x4188df=new AWS['S3']({'accessKeyId':_0x590c87,'secretAccessKey':_0x171fab,'region':_0xa1c385});_0x4188df[_0x726c('0x6d')]({'Bucket':_0x5b4f3c,'Key':_0x3496eb,'Body':_0x2ef7e9},function(_0x51b81c,_0x58fc75){if(_0x51b81c){return _0x3ca98c(_0x51b81c);}else{return _0x13cf8f(_0x58fc75);}});});}function startTranscribe(_0xe7fc6a,_0x307d84,_0x40b7ee,_0x1efe84,_0x45c8ae,_0x293951){return new Promise(function(_0x5c1d07,_0x17f0aa){var _0x35c67f=new AWS[(_0x726c('0x6e'))]({'accessKeyId':_0x307d84,'secretAccessKey':_0xe7fc6a,'region':_0x40b7ee});_0x35c67f[_0x726c('0x6f')]({'TranscriptionJobName':_0x1efe84,'LanguageCode':_0x45c8ae,'Media':{'MediaFileUri':_0x293951}},function(_0x304e39,_0x5c77cf){if(_0x304e39){return _0x17f0aa(_0x304e39);}else{return _0x5c1d07(_0x5c77cf);}});});}function transcribe(_0xa63a56,_0x340ebf,_0x29b42d,_0x2ebffc,_0x4c09f9,_0x1a839b,_0x5d12ec){return new Promise(function(_0x12376a,_0x1d28dc){var _0x20ecd2={};logger[_0x726c('0x65')](util[_0x726c('0x32')](_0x726c('0x70'),_0xa63a56,_0x4c09f9));return uploadFile(_0x340ebf,_0x29b42d,_0x2ebffc,_0x4c09f9,path[_0x726c('0x71')](_0x1a839b),fs[_0x726c('0x72')](_0x1a839b))[_0x726c('0x26')](function(_0x41b97b){logger[_0x726c('0x65')](util['format'](_0x726c('0x73'),_0xa63a56,_0x4c09f9,_0x41b97b['Location']));_0x20ecd2[_0x726c('0x74')]=_0x41b97b['Bucket'];_0x20ecd2[_0x726c('0x75')]=_0x41b97b[_0x726c('0x76')];logger[_0x726c('0x65')](util[_0x726c('0x32')](_0x726c('0x77'),_0xa63a56));return startTranscribe(_0x340ebf,_0x29b42d,_0x2ebffc,uuidv4(),_0x5d12ec,_0x41b97b[_0x726c('0x76')]);})['then'](function(_0x12e5dc){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xa63a56,_0x12e5dc[_0x726c('0x78')]['TranscriptionJobName']));_0x20ecd2[_0x726c('0x79')]=_0x12e5dc[_0x726c('0x78')]['TranscriptionJobName'];_0x20ecd2['transcribeStatus']=_0x12e5dc[_0x726c('0x78')][_0x726c('0x7a')];return _0x12376a(_0x20ecd2);})[_0x726c('0x44')](function(_0x173faf){return _0x1d28dc(_0x173faf);});});}exports['runTranscribe']=function(_0x40ce85,_0x1eb827,_0xe27281){var _0x369246;var _0x19e36d;var _0x4b6a3c;var _0x18a28e=require(_0x726c('0x4e'));return db[_0x726c('0x2c')][_0x726c('0x7b')]({'where':{'id':_0x40ce85['params']['id']}})[_0x726c('0x26')](function(_0x4105f6){if(_0x4105f6){var _0x38332f=util[_0x726c('0x32')](_0x726c('0x51'),_0x4105f6[_0x726c('0x50')]);if(fs[_0x726c('0x52')](_0x38332f)){cypher=!![];return _0x18a28e[_0x726c('0x61')](_0x38332f,_0x4105f6['value'],config[_0x726c('0x53')][_0x726c('0x54')])[_0x726c('0x26')](function(){return _0x4105f6;});}return _0x4105f6;}})[_0x726c('0x26')](function(_0x4acfd6){if(!_0x4acfd6){throw new db['Sequelize'][(_0x726c('0x62'))](_0x726c('0x7c'));}_0x19e36d=_0x4acfd6;return db[_0x726c('0x7d')][_0x726c('0x7b')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1eb827,null))[_0x726c('0x26')](function(_0x3145bf){if(_0x3145bf){_0x369246=_0x3145bf;if(!_0x369246[_0x726c('0x7e')]||!_0x369246[_0x726c('0x7f')]||!_0x369246['transcribeRegion']||!_0x369246['language']||!_0x369246[_0x726c('0x74')]){throw new db[(_0x726c('0x55'))][(_0x726c('0x62'))](_0x726c('0x80'));}if(_0x40ce85[_0x726c('0x4b')][_0x726c('0x81')]&&(!_0x369246['sentiment']||!_0x369246[_0x726c('0x82')]||!_0x369246[_0x726c('0x83')]||!_0x369246['language']||!_0x369246[_0x726c('0x74')])){throw new db[(_0x726c('0x55'))][(_0x726c('0x62'))](_0x726c('0x84'));}return db['CloudProvider'][_0x726c('0x7b')]({'where':{'id':_0x369246[_0x726c('0x7f')]}});}})[_0x726c('0x26')](function(_0x315d80){if(!_0x315d80){throw new db['Sequelize']['ValidationError'](_0x726c('0x85'));}if(!_0x315d80['data1']||!_0x315d80[_0x726c('0x86')]){throw new db['Sequelize'][(_0x726c('0x62'))](_0x726c('0x87'));}_0x4b6a3c=_0x315d80;return getBucketslist(_0x4b6a3c[_0x726c('0x88')],_0x4b6a3c[_0x726c('0x86')],_0x369246[_0x726c('0x89')]);})['then'](function(_0x48cc54){if(_0x48cc54&&_0x48cc54[_0x726c('0x8a')]){var _0x3f3e87=_['find'](_0x48cc54[_0x726c('0x8a')],function(_0xab728d){return _0xab728d['Name']===_0x369246[_0x726c('0x74')];});if(!_0x3f3e87){logger[_0x726c('0x65')](util[_0x726c('0x32')](_0x726c('0x8b'),_0x40ce85[_0x726c('0x46')]['id'],_0x369246[_0x726c('0x74')]));return createBucket(_0x4b6a3c[_0x726c('0x88')],_0x4b6a3c[_0x726c('0x86')],_0x369246[_0x726c('0x89')],_0x369246[_0x726c('0x74')]);}logger[_0x726c('0x65')](util[_0x726c('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x40ce85[_0x726c('0x46')]['id'],_0x369246[_0x726c('0x74')]));return;}})['then'](function(_0x2b1a4e){if(_0x19e36d[_0x726c('0x8c')]===_0x726c('0x8d')){return transcribe(_0x40ce85[_0x726c('0x46')]['id'],_0x4b6a3c[_0x726c('0x88')],_0x4b6a3c[_0x726c('0x86')],_0x369246[_0x726c('0x89')],_0x369246[_0x726c('0x74')],_0x19e36d[_0x726c('0x50')],_0x369246[_0x726c('0x8e')]);}else{logger[_0x726c('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x40ce85[_0x726c('0x46')]['id']));return{'transcribeStatus':_0x726c('0x8f')};}})['then'](function(_0x16318b){if(_0x16318b){_0x16318b['tempSentiment']=_0x40ce85[_0x726c('0x4b')][_0x726c('0x81')];return _0x19e36d['updateAttributes'](_0x16318b);}})['then'](respondWithResult(_0x1eb827,null))[_0x726c('0x44')](handleError(_0x1eb827,null));};function writeFile(_0x4a2763,_0x54a917){return new Promise(function(_0xe67fb2,_0x22e737){fs[_0x726c('0x90')](_0x54a917,_0x4a2763,function(_0x27e686,_0x3b55b0){if(_0x27e686){return _0x22e737(_0x27e686);}else{return _0xe67fb2(_0x3b55b0);}});});}exports['downloadTranscribe']=function(_0x57099f,_0x144c78,_0x464ada){return db[_0x726c('0x2c')]['findOne']({'where':{'id':_0x57099f[_0x726c('0x46')]['id']}})[_0x726c('0x26')](handleEntityNotFound(_0x144c78))[_0x726c('0x26')](function(_0x1656f1){if(_0x1656f1&&_0x1656f1[_0x726c('0x91')]){var _0x5a9a76=_0x1656f1[_0x726c('0x91')];var _0x3f08b0=config[_0x726c('0x92')]+'/server/files/transcribes/transcribe_'+_0x1656f1['id']+'.txt';if(fs[_0x726c('0x52')](_0x3f08b0)){return _0x3f08b0;}return writeFile(_0x5a9a76,_0x3f08b0)[_0x726c('0x26')](function(){return _0x3f08b0;});}else{throw new db[(_0x726c('0x55'))][(_0x726c('0x62'))](_0x726c('0x93'));}})[_0x726c('0x26')](function(_0x471334){return _0x144c78['download'](_0x471334);})['catch'](handleError(_0x144c78));}; \ No newline at end of file +var _0x134f=['NEW','data2','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','error','name','send','index','map','VoiceRecording','rawAttributes','type','differenceBy','format','keys','query','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','MD5','col','token','push','$and','decryptFile','secrets','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','recording','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available'];(function(_0x5c1996,_0x2fceb7){var _0x1d64e0=function(_0x218939){while(--_0x218939){_0x5c1996['push'](_0x5c1996['shift']());}};_0x1d64e0(++_0x2fceb7);}(_0x134f,0x135));var _0xf134=function(_0x389c9f,_0x5d3e49){_0x389c9f=_0x389c9f-0x0;var _0x22a908=_0x134f[_0x389c9f];return _0x22a908;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf134('0x0'));var zipdir=require(_0xf134('0x1'));var jsonpatch=require(_0xf134('0x2'));var rp=require(_0xf134('0x3'));var moment=require(_0xf134('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf134('0x5'));var util=require(_0xf134('0x6'));var path=require(_0xf134('0x7'));var sox=require(_0xf134('0x8'));var csv=require(_0xf134('0x9'));var ejs=require(_0xf134('0xa'));var fs=require('fs');var fs_extra=require(_0xf134('0xb'));var _=require(_0xf134('0xc'));var squel=require('squel');var crypto=require(_0xf134('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf134('0xe'));var toCsv=require(_0xf134('0x9'));var querystring=require(_0xf134('0xf'));var Papa=require(_0xf134('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0xf134('0x11'));var Redis=require('ioredis');var authService=require(_0xf134('0x12'));var qs=require(_0xf134('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf134('0x14'));var logger=require(_0xf134('0x15'))('api');var utils=require(_0xf134('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf134('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cca20,_0x2b4388){_0x2b4388=_0x2b4388||0xcc;return function(_0x1fe01b){if(_0x1fe01b){return _0x4cca20[_0xf134('0x18')](_0x2b4388);}return _0x4cca20['status'](_0x2b4388)[_0xf134('0x19')]();};}function respondWithResult(_0x93037,_0x3e6369){_0x3e6369=_0x3e6369||0xc8;return function(_0x25df9f){if(_0x25df9f){return _0x93037['status'](_0x3e6369)['json'](_0x25df9f);}};}function respondWithFilteredResult(_0x37dd9e,_0x358d1d){return function(_0x1146fd){if(_0x1146fd){var _0x5a39c6=typeof _0x358d1d[_0xf134('0x1a')]===_0xf134('0x1b')&&typeof _0x358d1d[_0xf134('0x1c')]===_0xf134('0x1b');var _0x2db3a4=_0x1146fd['count'];var _0x4e099f=_0x5a39c6?0x0:_0x358d1d[_0xf134('0x1a')];var _0x5644f0=_0x5a39c6?_0x1146fd[_0xf134('0x1d')]:_0x358d1d[_0xf134('0x1a')]+_0x358d1d[_0xf134('0x1c')];var _0xc23e80;if(_0x5644f0>=_0x2db3a4){_0x5644f0=_0x2db3a4;_0xc23e80=0xc8;}else{_0xc23e80=0xce;}_0x37dd9e[_0xf134('0x1e')](_0xc23e80);return _0x37dd9e[_0xf134('0x1f')](_0xf134('0x20'),_0x4e099f+'-'+_0x5644f0+'/'+_0x2db3a4)[_0xf134('0x21')](_0x1146fd);}return null;};}function patchUpdates(_0x18f8f1){return function(_0x227daf){try{jsonpatch[_0xf134('0x22')](_0x227daf,_0x18f8f1,!![]);}catch(_0x167352){return BPromise['reject'](_0x167352);}return _0x227daf[_0xf134('0x23')]();};}function saveUpdates(_0x151186,_0x55747c){return function(_0x2a4331){if(_0x2a4331){return _0x2a4331[_0xf134('0x24')](_0x151186)[_0xf134('0x25')](function(_0x23e4d6){return _0x23e4d6;});}return null;};}function removeEntity(_0x5e85ec,_0x4b894d){return function(_0x35beec){if(_0x35beec){return _0x35beec['destroy']()[_0xf134('0x25')](function(){_0x5e85ec['status'](0xcc)[_0xf134('0x19')]();});}};}function handleEntityNotFound(_0x555016,_0x2fada6){return function(_0x2b118e){if(!_0x2b118e){_0x555016[_0xf134('0x18')](0x194);}return _0x2b118e;};}function handleError(_0x411c3b,_0x3665bc){_0x3665bc=_0x3665bc||0x1f4;return function(_0x543916){logger[_0xf134('0x26')](_0x543916['stack']);if(_0x543916[_0xf134('0x27')]){delete _0x543916[_0xf134('0x27')];}_0x411c3b[_0xf134('0x1e')](_0x3665bc)[_0xf134('0x28')](_0x543916);};}exports[_0xf134('0x29')]=function(_0x42dc2e,_0x17c456){var _0x322be1={},_0x2aa9d0={},_0x589b50={'count':0x0,'rows':[]};var _0x251a9f=_[_0xf134('0x2a')](db[_0xf134('0x2b')][_0xf134('0x2c')],function(_0x48fbce){return{'name':_0x48fbce['fieldName'],'type':_0x48fbce[_0xf134('0x2d')]['key']};});_0x2aa9d0['model']=_[_0xf134('0x2e')](_[_0xf134('0x2a')](_0x251a9f,'name'),[_0xf134('0x2f')]);_0x2aa9d0['query']=_[_0xf134('0x30')](_0x42dc2e[_0xf134('0x31')]);_0x2aa9d0['filters']=_[_0xf134('0x32')](_0x2aa9d0['model'],_0x2aa9d0[_0xf134('0x31')]);_0x322be1[_0xf134('0x33')]=_[_0xf134('0x32')](_0x2aa9d0[_0xf134('0x34')],qs[_0xf134('0x35')](_0x42dc2e[_0xf134('0x31')]['fields']));_0x322be1['attributes']=_0x322be1[_0xf134('0x33')][_0xf134('0x36')]?_0x322be1[_0xf134('0x33')]:_0x2aa9d0['model'];if(!_0x42dc2e[_0xf134('0x31')]['hasOwnProperty'](_0xf134('0x37'))){_0x322be1[_0xf134('0x1c')]=qs[_0xf134('0x1c')](_0x42dc2e[_0xf134('0x31')][_0xf134('0x1c')]);_0x322be1['offset']=qs[_0xf134('0x1a')](_0x42dc2e[_0xf134('0x31')]['offset']);}_0x322be1['order']=qs['sort'](_0x42dc2e[_0xf134('0x31')][_0xf134('0x38')]);_0x322be1[_0xf134('0x39')]=qs['filters'](_[_0xf134('0x3a')](_0x42dc2e[_0xf134('0x31')],_0x2aa9d0[_0xf134('0x3b')]),_0x251a9f);if(_0x42dc2e[_0xf134('0x31')][_0xf134('0x3c')]){_0x322be1[_0xf134('0x39')]=_[_0xf134('0x3d')](_0x322be1[_0xf134('0x39')],{'$or':_[_0xf134('0x2a')](_0x251a9f,function(_0x5a6fdf){if(_0x5a6fdf['type']!=='VIRTUAL'){var _0x492e4f={};_0x492e4f[_0x5a6fdf[_0xf134('0x27')]]={'$like':'%'+_0x42dc2e['query'][_0xf134('0x3c')]+'%'};return _0x492e4f;}})});}_0x322be1=_[_0xf134('0x3d')]({},_0x322be1,_0x42dc2e[_0xf134('0x3e')]);var _0x5af956={'where':_0x322be1['where']};return db[_0xf134('0x2b')][_0xf134('0x1d')](_0x5af956)[_0xf134('0x25')](function(_0x4bcdad){_0x589b50['count']=_0x4bcdad;if(_0x42dc2e[_0xf134('0x31')][_0xf134('0x3f')]){_0x322be1[_0xf134('0x40')]=[{'all':!![]}];}return db[_0xf134('0x2b')]['findAll'](_0x322be1);})['then'](function(_0x308000){_0x589b50[_0xf134('0x41')]=_0x308000;return _0x589b50;})[_0xf134('0x25')](respondWithFilteredResult(_0x17c456,_0x322be1))[_0xf134('0x42')](handleError(_0x17c456,null));};exports[_0xf134('0x43')]=function(_0x16e678,_0x470645){var _0x3169e0={'raw':![],'where':{'id':_0x16e678[_0xf134('0x44')]['id']}},_0x2d7620={};_0x2d7620[_0xf134('0x34')]=_[_0xf134('0x30')](db[_0xf134('0x2b')][_0xf134('0x2c')]);_0x2d7620['query']=_['keys'](_0x16e678[_0xf134('0x31')]);_0x2d7620[_0xf134('0x3b')]=_['intersection'](_0x2d7620[_0xf134('0x34')],_0x2d7620[_0xf134('0x31')]);_0x3169e0[_0xf134('0x33')]=_['intersection'](_0x2d7620['model'],qs[_0xf134('0x35')](_0x16e678[_0xf134('0x31')][_0xf134('0x35')]));_0x3169e0['attributes']=_0x3169e0[_0xf134('0x33')]['length']?_0x3169e0[_0xf134('0x33')]:_0x2d7620['model'];if(_0x16e678[_0xf134('0x31')][_0xf134('0x3f')]){_0x3169e0[_0xf134('0x40')]=[{'all':!![]}];}_0x3169e0=_['merge']({},_0x3169e0,_0x16e678[_0xf134('0x3e')]);return db[_0xf134('0x2b')][_0xf134('0x45')](_0x3169e0)['then'](handleEntityNotFound(_0x470645,null))[_0xf134('0x25')](respondWithResult(_0x470645,null))[_0xf134('0x42')](handleError(_0x470645,null));};exports[_0xf134('0x46')]=function(_0x3fed08,_0x425907){return db['VoiceRecording']['create'](_0x3fed08[_0xf134('0x47')],{})[_0xf134('0x25')](respondWithResult(_0x425907,0xc9))[_0xf134('0x42')](handleError(_0x425907,null));};exports[_0xf134('0x24')]=function(_0x1e9b09,_0xfbd98d){if(_0x1e9b09[_0xf134('0x47')]['id']){delete _0x1e9b09[_0xf134('0x47')]['id'];}return db[_0xf134('0x2b')][_0xf134('0x45')]({'where':{'id':_0x1e9b09[_0xf134('0x44')]['id']}})[_0xf134('0x25')](handleEntityNotFound(_0xfbd98d,null))[_0xf134('0x25')](saveUpdates(_0x1e9b09['body'],null))[_0xf134('0x25')](respondWithResult(_0xfbd98d,null))[_0xf134('0x42')](handleError(_0xfbd98d,null));};exports[_0xf134('0x48')]=function(_0xa7bb32,_0xd83764){return db[_0xf134('0x2b')][_0xf134('0x48')]()['then'](respondWithResult(_0xd83764,null))[_0xf134('0x42')](handleError(_0xd83764,null));};exports[_0xf134('0x49')]=function(_0x1fb842,_0x17234a,_0xc40033){var _0x4fe9f6=require(_0xf134('0x4a'));var _0x55786f=![];var _0x346ade={};if(_0x1fb842[_0xf134('0x31')]['type']&&_0x1fb842[_0xf134('0x31')][_0xf134('0x2d')]===_0xf134('0x4b')){_0x346ade['uniqueid']=_0x1fb842[_0xf134('0x44')]['id'];}else{_0x346ade['id']=_0x1fb842[_0xf134('0x44')]['id'];}return db['VoiceRecording']['find']({'where':_0x346ade,'attributes':['id',_0xf134('0x4c')],'raw':!![]})[_0xf134('0x25')](handleEntityNotFound(_0x17234a,null))[_0xf134('0x25')](function(_0x17800b){if(_0x17800b){var _0x2e93b7=_0x17800b['value'];var _0xc7766=util[_0xf134('0x2f')]('%s.cypher',_0x2e93b7);if(fs['existsSync'](_0xc7766)){_0x55786f=!![];return _0x4fe9f6['decryptFile'](_0xc7766,_0x2e93b7,config['secrets']['recording'])[_0xf134('0x25')](function(){return _0x17800b;});}return _0x17800b;}})['then'](function(_0x1e39ba){if(_0x1e39ba){var _0x214dbb=_0x1e39ba[_0xf134('0x4c')];if(!fs['existsSync'](_0x214dbb)){throw new db[(_0xf134('0x4d'))][(_0xf134('0x4e'))](_0xf134('0x4f'));}if(_0x1e39ba[_0xf134('0x50')]){return _0x17234a['download'](_0x214dbb,_0x1e39ba['filename']+path[_0xf134('0x51')](_0x214dbb),function(){if(_0x55786f){fs[_0xf134('0x52')](_0x214dbb);}});}else{return _0x17234a[_0xf134('0x49')](_0x214dbb,function(_0x429bbd){if(_0x55786f){fs[_0xf134('0x52')](_0x214dbb);}});}}})[_0xf134('0x42')](function(_0x4f140d){if(_0x4f140d[_0xf134('0x53')]===_0xf134('0x4f')){_0x17234a[_0xf134('0x1e')](0x194)[_0xf134('0x28')](_0xf134('0x54'));}else{return handleError(_0x17234a,null);}});};exports[_0xf134('0x55')]=function(_0xb40df4,_0x4d3f96,_0x40b182){var _0x22ca65=require('../../components/encryptor');var _0x28945a=![];var _0x13cd10={'$and':[db['sequelize'][_0xf134('0x39')](db['sequelize']['fn'](_0xf134('0x56'),db['sequelize'][_0xf134('0x57')](_0xf134('0x4b'))),_0xb40df4[_0xf134('0x31')][_0xf134('0x58')])]};if(_0xb40df4[_0xf134('0x31')][_0xf134('0x2d')]&&_0xb40df4['query']['type']===_0xf134('0x4b')){_0x13cd10['$and'][_0xf134('0x59')]({'uniqueid':_0xb40df4[_0xf134('0x44')]['id']});}else{_0x13cd10[_0xf134('0x5a')]['push']({'id':_0xb40df4[_0xf134('0x44')]['id']});}return db[_0xf134('0x2b')][_0xf134('0x45')]({'where':_0x13cd10,'attributes':['id',_0xf134('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x4d3f96,null))['then'](function(_0x204df7){if(_0x204df7){var _0x203f81=util[_0xf134('0x2f')]('%s.cypher',_0x204df7[_0xf134('0x4c')]);if(fs['existsSync'](_0x203f81)){_0x28945a=!![];return _0x22ca65[_0xf134('0x5b')](_0x203f81,_0x204df7[_0xf134('0x4c')],config[_0xf134('0x5c')]['recording'])[_0xf134('0x25')](function(){return _0x204df7;});}return _0x204df7;}})[_0xf134('0x25')](function(_0x406a6a){if(_0x406a6a){if(!fs['existsSync'](_0x406a6a[_0xf134('0x4c')])){throw new db[(_0xf134('0x4d'))][(_0xf134('0x4e'))](_0xf134('0x4f'));}if(_0x406a6a['filename']){return _0x4d3f96[_0xf134('0x49')](_0x406a6a[_0xf134('0x4c')],_0x406a6a[_0xf134('0x50')]+path['extname'](_0x406a6a[_0xf134('0x4c')]),function(){if(_0x28945a){fs[_0xf134('0x52')](_0x406a6a[_0xf134('0x4c')]);}});}else{return _0x4d3f96[_0xf134('0x49')](_0x406a6a[_0xf134('0x4c')],function(_0x21b2b1){if(_0x28945a){fs['unlink'](_0x406a6a[_0xf134('0x4c')]);}});}}})[_0xf134('0x42')](handleError(_0x4d3f96,null));};exports[_0xf134('0x5d')]=function(_0x401753,_0x4fb5e0){return db['VoiceRecording'][_0xf134('0x45')]({'where':{'id':_0x401753[_0xf134('0x44')]['id']}})[_0xf134('0x25')](function(_0x18c0cc){if(_[_0xf134('0x5e')](_0x18c0cc)){throw new ReferenceError(_0xf134('0x5f'));}return _0x18c0cc;})[_0xf134('0x25')](function(_0x548b5a){var _0xa77606=_0x548b5a['value'];logger[_0xf134('0x60')](_0xf134('0x61'),_0xa77606);if(!_[_0xf134('0x5e')](_0x548b5a[_0xf134('0x4c')])&&fs[_0xf134('0x62')](_0xa77606)){logger['info']('File:\x20\x22'+_0xa77606+_0xf134('0x63'));fs[_0xf134('0x64')](_0xa77606);}_0xa77606=_0xa77606+'.cypher';if(!_[_0xf134('0x5e')](_0x548b5a['value'])&&fs['existsSync'](_0xa77606)){logger['info'](_0xf134('0x65')+_0xa77606+_0xf134('0x63'));fs[_0xf134('0x64')](_0xa77606);}return _0x548b5a;})['then'](function(_0x5e5659){if(!_0x5e5659)throw new InternalError();return _0x5e5659['destroy']();})[_0xf134('0x25')](function(){_0x4fb5e0['status'](0xcc)[_0xf134('0x19')]();})['catch'](handleError(_0x4fb5e0,null));};function getBucketslist(_0x153f41,_0x3de74e,_0x4fc2ed){return new Promise(function(_0x3a95b3,_0xcde439){var _0x4962cc=new AWS['S3']({'accessKeyId':_0x3de74e,'secretAccessKey':_0x153f41,'region':_0x4fc2ed});_0x4962cc['listBuckets']({},function(_0x1a882c,_0x4afd75){if(_0x1a882c){return _0xcde439(_0x1a882c);}else{return _0x3a95b3(_0x4afd75);}});});}function createBucket(_0x53a670,_0xc7facb,_0x532ec9,_0x3c7244){return new Promise(function(_0x44da5b,_0x1eb4e5){var _0x261ac4=new AWS['S3']({'accessKeyId':_0xc7facb,'secretAccessKey':_0x53a670,'region':_0x532ec9});_0x261ac4[_0xf134('0x66')]({'Bucket':_0x3c7244},function(_0xa22f01,_0x3b2e40){if(_0xa22f01){return _0x1eb4e5(_0xa22f01);}else{return _0x44da5b(_0x3b2e40);}});});}function uploadFile(_0x4d7d93,_0x48e44d,_0x5d30fb,_0x30e378,_0x12c4aa,_0xd5e548){return new Promise(function(_0x3e0352,_0x126d15){var _0x426abc=new AWS['S3']({'accessKeyId':_0x48e44d,'secretAccessKey':_0x4d7d93,'region':_0x5d30fb});_0x426abc[_0xf134('0x67')]({'Bucket':_0x30e378,'Key':_0x12c4aa,'Body':_0xd5e548},function(_0x4c9b34,_0x5c758f){if(_0x4c9b34){return _0x126d15(_0x4c9b34);}else{return _0x3e0352(_0x5c758f);}});});}function startTranscribe(_0x27ebd3,_0x3d09c9,_0x459fd2,_0xf8d75b,_0x183146,_0x304050){return new Promise(function(_0x538db3,_0x5928f5){var _0x176a95=new AWS[(_0xf134('0x68'))]({'accessKeyId':_0x3d09c9,'secretAccessKey':_0x27ebd3,'region':_0x459fd2});_0x176a95[_0xf134('0x69')]({'TranscriptionJobName':_0xf8d75b,'LanguageCode':_0x183146,'Media':{'MediaFileUri':_0x304050}},function(_0x5f583a,_0x270c72){if(_0x5f583a){return _0x5928f5(_0x5f583a);}else{return _0x538db3(_0x270c72);}});});}function transcribe(_0x59a9ff,_0x377af4,_0x2e6ccd,_0x5537a6,_0x5ee4a8,_0x2d8689,_0x49ae89){return new Promise(function(_0x24c533,_0x592b5a){var _0x14e450={};logger['info'](util[_0xf134('0x2f')](_0xf134('0x6a'),_0x59a9ff,_0x5ee4a8));return uploadFile(_0x377af4,_0x2e6ccd,_0x5537a6,_0x5ee4a8,path[_0xf134('0x6b')](_0x2d8689),fs[_0xf134('0x6c')](_0x2d8689))[_0xf134('0x25')](function(_0xe88305){logger['info'](util['format'](_0xf134('0x6d'),_0x59a9ff,_0x5ee4a8,_0xe88305[_0xf134('0x6e')]));_0x14e450[_0xf134('0x6f')]=_0xe88305[_0xf134('0x70')];_0x14e450[_0xf134('0x71')]=_0xe88305[_0xf134('0x6e')];logger[_0xf134('0x60')](util[_0xf134('0x2f')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x59a9ff));return startTranscribe(_0x377af4,_0x2e6ccd,_0x5537a6,uuidv4(),_0x49ae89,_0xe88305[_0xf134('0x6e')]);})[_0xf134('0x25')](function(_0x3f90e3){logger[_0xf134('0x60')](util[_0xf134('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x59a9ff,_0x3f90e3['TranscriptionJob'][_0xf134('0x72')]));_0x14e450[_0xf134('0x73')]=_0x3f90e3[_0xf134('0x74')][_0xf134('0x72')];_0x14e450[_0xf134('0x75')]=_0x3f90e3[_0xf134('0x74')][_0xf134('0x76')];return _0x24c533(_0x14e450);})['catch'](function(_0x331edd){return _0x592b5a(_0x331edd);});});}exports[_0xf134('0x77')]=function(_0x3a0578,_0x3d943f,_0x40c199){var _0x1ff8a7;var _0x5a4890;var _0x25e577;var _0x24c62d=require(_0xf134('0x4a'));return db[_0xf134('0x2b')][_0xf134('0x78')]({'where':{'id':_0x3a0578['params']['id']}})['then'](function(_0x370c4f){if(_0x370c4f){var _0x5b2067=util['format'](_0xf134('0x79'),_0x370c4f['value']);if(fs[_0xf134('0x62')](_0x5b2067)){cypher=!![];return _0x24c62d[_0xf134('0x5b')](_0x5b2067,_0x370c4f[_0xf134('0x4c')],config[_0xf134('0x5c')][_0xf134('0x7a')])[_0xf134('0x25')](function(){return _0x370c4f;});}return _0x370c4f;}})[_0xf134('0x25')](function(_0x10f785){if(!_0x10f785){throw new db['Sequelize'][(_0xf134('0x4e'))](_0xf134('0x7b'));}_0x5a4890=_0x10f785;return db[_0xf134('0x7c')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x3d943f,null))[_0xf134('0x25')](function(_0x4446c1){if(_0x4446c1){_0x1ff8a7=_0x4446c1;if(!_0x1ff8a7[_0xf134('0x7d')]||!_0x1ff8a7['transcribeAccountId']||!_0x1ff8a7[_0xf134('0x7e')]||!_0x1ff8a7[_0xf134('0x7f')]||!_0x1ff8a7[_0xf134('0x6f')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x3a0578[_0xf134('0x47')][_0xf134('0x80')]&&(!_0x1ff8a7[_0xf134('0x81')]||!_0x1ff8a7[_0xf134('0x82')]||!_0x1ff8a7[_0xf134('0x83')]||!_0x1ff8a7[_0xf134('0x7f')]||!_0x1ff8a7[_0xf134('0x6f')])){throw new db[(_0xf134('0x4d'))]['ValidationError'](_0xf134('0x84'));}return db[_0xf134('0x85')][_0xf134('0x78')]({'where':{'id':_0x1ff8a7[_0xf134('0x86')]}});}})['then'](function(_0x49b927){if(!_0x49b927){throw new db[(_0xf134('0x4d'))][(_0xf134('0x4e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x49b927['data1']||!_0x49b927['data2']){throw new db[(_0xf134('0x4d'))]['ValidationError'](_0xf134('0x87'));}_0x25e577=_0x49b927;return getBucketslist(_0x25e577[_0xf134('0x88')],_0x25e577['data2'],_0x1ff8a7[_0xf134('0x7e')]);})['then'](function(_0xe673d2){if(_0xe673d2&&_0xe673d2[_0xf134('0x89')]){var _0x12ef34=_['find'](_0xe673d2['Buckets'],function(_0x153fbf){return _0x153fbf[_0xf134('0x8a')]===_0x1ff8a7['bucket'];});if(!_0x12ef34){logger[_0xf134('0x60')](util[_0xf134('0x2f')](_0xf134('0x8b'),_0x3a0578[_0xf134('0x44')]['id'],_0x1ff8a7[_0xf134('0x6f')]));return createBucket(_0x25e577[_0xf134('0x88')],_0x25e577['data2'],_0x1ff8a7[_0xf134('0x7e')],_0x1ff8a7[_0xf134('0x6f')]);}logger[_0xf134('0x60')](util[_0xf134('0x2f')](_0xf134('0x8c'),_0x3a0578[_0xf134('0x44')]['id'],_0x1ff8a7[_0xf134('0x6f')]));return;}})[_0xf134('0x25')](function(_0x5004f1){if(_0x5a4890[_0xf134('0x75')]===_0xf134('0x8d')){return transcribe(_0x3a0578['params']['id'],_0x25e577[_0xf134('0x88')],_0x25e577[_0xf134('0x8e')],_0x1ff8a7[_0xf134('0x7e')],_0x1ff8a7['bucket'],_0x5a4890[_0xf134('0x4c')],_0x1ff8a7[_0xf134('0x7f')]);}else{logger[_0xf134('0x60')](util[_0xf134('0x2f')](_0xf134('0x8f'),_0x3a0578[_0xf134('0x44')]['id']));return{'transcribeStatus':_0xf134('0x90')};}})['then'](function(_0x490047){if(_0x490047){_0x490047[_0xf134('0x91')]=_0x3a0578[_0xf134('0x47')]['runSentiment'];return _0x5a4890[_0xf134('0x92')](_0x490047);}})[_0xf134('0x25')](respondWithResult(_0x3d943f,null))[_0xf134('0x42')](handleError(_0x3d943f,null));};function writeFile(_0x5efcca,_0x9c3b55){return new Promise(function(_0x5a62dd,_0x2a90a5){fs[_0xf134('0x93')](_0x9c3b55,_0x5efcca,function(_0x35875e,_0x41fd8b){if(_0x35875e){return _0x2a90a5(_0x35875e);}else{return _0x5a62dd(_0x41fd8b);}});});}exports['downloadTranscribe']=function(_0x1a77e6,_0x28fc12,_0x17b9ec){return db[_0xf134('0x2b')][_0xf134('0x78')]({'where':{'id':_0x1a77e6[_0xf134('0x44')]['id']}})['then'](handleEntityNotFound(_0x28fc12))[_0xf134('0x25')](function(_0x1314c5){if(_0x1314c5&&_0x1314c5['fileText']){var _0x7c11b0=_0x1314c5['fileText'];var _0xd94ae1=config['root']+'/server/files/transcribes/transcribe_'+_0x1314c5['id']+_0xf134('0x94');if(fs[_0xf134('0x62')](_0xd94ae1)){return _0xd94ae1;}return writeFile(_0x7c11b0,_0xd94ae1)[_0xf134('0x25')](function(){return _0xd94ae1;});}else{throw new db['Sequelize'][(_0xf134('0x4e'))](_0xf134('0x95'));}})['then'](function(_0x4ef46c){return _0x28fc12[_0xf134('0x49')](_0x4ef46c);})[_0xf134('0x42')](handleError(_0x28fc12));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d7552e1..06044fa 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 _0x6c4b=['define','VoiceRecording','voice_recordings','uniqueid','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6c4b,0x9e));var _0xb6c4=function(_0x339c23,_0x541ff6){_0x339c23=_0x339c23-0x0;var _0x5bf134=_0x6c4b[_0x339c23];return _0x5bf134;};'use strict';var _=require(_0xb6c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb6c4('0x1'));var moment=require(_0xb6c4('0x2'));var BPromise=require(_0xb6c4('0x3'));var rp=require(_0xb6c4('0x4'));var fs=require('fs');var path=require(_0xb6c4('0x5'));var rimraf=require('rimraf');var config=require(_0xb6c4('0x6'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x152e43,_0x3eb1cd){return _0x152e43[_0xb6c4('0x7')](_0xb6c4('0x8'),attributes,{'tableName':_0xb6c4('0x9'),'paranoid':![],'indexes':[{'name':_0xb6c4('0xa'),'fields':[_0xb6c4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf759=['./voiceRecording.attributes','define','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0xf759,0x154));var _0x9f75=function(_0x23e32a,_0x29e4d3){_0x23e32a=_0x23e32a-0x0;var _0x179aa6=_0xf759[_0x23e32a];return _0x179aa6;};'use strict';var _=require(_0x9f75('0x0'));var util=require(_0x9f75('0x1'));var logger=require(_0x9f75('0x2'))(_0x9f75('0x3'));var moment=require(_0x9f75('0x4'));var BPromise=require(_0x9f75('0x5'));var rp=require(_0x9f75('0x6'));var fs=require('fs');var path=require(_0x9f75('0x7'));var rimraf=require(_0x9f75('0x8'));var config=require(_0x9f75('0x9'));var attributes=require(_0x9f75('0xa'));module['exports']=function(_0x2f40ae,_0x58d750){return _0x2f40ae[_0x9f75('0xb')]('VoiceRecording',attributes,{'tableName':_0x9f75('0xc'),'paranoid':![],'indexes':[{'name':_0x9f75('0xd'),'fields':[_0x9f75('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 92754fd..fd3e6e5 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 _0x77d4=['%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format'];(function(_0x55bc42,_0x21367d){var _0x41de17=function(_0x559bc0){while(--_0x559bc0){_0x55bc42['push'](_0x55bc42['shift']());}};_0x41de17(++_0x21367d);}(_0x77d4,0x108));var _0x477d=function(_0x47cc35,_0x3c310e){_0x47cc35=_0x47cc35-0x0;var _0x95ec4c=_0x77d4[_0x47cc35];return _0x95ec4c;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')](_0x5d5553[_0x477d('0x16')],{'raw':_0x5d5553['options']?_0x5d5553[_0x477d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d5553[_0x477d('0x17')]?_0x5d5553[_0x477d('0x17')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x17')]?_0x5d5553[_0x477d('0x17')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x17')]?_0x5d5553[_0x477d('0x17')][_0x477d('0x1a')]||null:null})[_0x477d('0x9')](function(_0x3d2943){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1b')]('UpdateVoiceRecording',_0x5d5553,JSON[_0x477d('0xe')](_0x3d2943));_0x1399d7(_0x3d2943);})['catch'](function(_0x239b56){logger[_0x477d('0xf')](_0x477d('0x13'),_0x239b56[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965['error'](0x1f4,_0x239b56[_0x477d('0x11')]));});});};exports[_0x477d('0x1c')]=function(_0x1ca4fe){var _0x48ee5e=this;return new Promise(function(_0x585648,_0x198697){var _0x3c6270=require(_0x477d('0x1d'));var _0x5c8ef1;return db[_0x477d('0x1e')][_0x477d('0x1f')]({'attributes':['id',_0x477d('0x20')],'where':{'id':0x1},'raw':!![]})[_0x477d('0x9')](function(_0x37b332){_0x5c8ef1=_0x37b332;return db['VoiceRecording'][_0x477d('0x21')](_0x1ca4fe[_0x477d('0x16')]);})[_0x477d('0x9')](function(_0x25a329){if(_0x5c8ef1[_0x477d('0x20')]&&fs[_0x477d('0x22')](_0x25a329[_0x477d('0x23')])){var _0x98b5d9=util[_0x477d('0x24')](_0x477d('0x25'),_0x25a329[_0x477d('0x23')]);return _0x3c6270[_0x477d('0x26')](_0x25a329[_0x477d('0x23')],_0x98b5d9,config[_0x477d('0x27')][_0x477d('0x28')])[_0x477d('0x9')](function(){fs[_0x477d('0x29')](_0x25a329[_0x477d('0x23')]);logger[_0x477d('0xa')](_0x477d('0x2a'));return _0x25a329;});}return _0x25a329;})['then'](function(_0x304d25){logger['info'](_0x477d('0x1c'),_0x1ca4fe);logger[_0x477d('0x1b')](_0x477d('0x1c'),_0x1ca4fe,JSON['stringify'](_0x304d25));_0x585648(_0x304d25);})[_0x477d('0x12')](function(_0x1201a9){logger[_0x477d('0xf')](_0x477d('0x1c'),_0x1201a9[_0x477d('0x11')],_0x1ca4fe);_0x198697(_0x48ee5e[_0x477d('0xf')](0x1f4,_0x1201a9[_0x477d('0x11')]));});});}; \ No newline at end of file +var _0x32b6=['jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','info','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x32b6,0x1d1));var _0x632b=function(_0x2d70f0,_0xda7fb1){_0x2d70f0=_0x2d70f0-0x0;var _0x231b2d=_0x32b6[_0x2d70f0];return _0x231b2d;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['where']||null:null,'attributes':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['attributes']||null:null,'limit':_0x3bb27f[_0x632b('0x19')]?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1b')]||null:null})['then'](function(_0x10fc32){logger[_0x632b('0x14')]('UpdateVoiceRecording',_0x3bb27f);logger[_0x632b('0xd')](_0x632b('0x15'),_0x3bb27f,JSON[_0x632b('0xf')](_0x10fc32));_0x51c894(_0x10fc32);})[_0x632b('0x1c')](function(_0x45d017){logger[_0x632b('0x10')]('UpdateVoiceRecording',_0x45d017['message'],_0x3bb27f);_0x2f3e88(_0x28c472[_0x632b('0x10')](0x1f4,_0x45d017['message']));});});};exports[_0x632b('0x1d')]=function(_0x954fa0){var _0x5d6855=this;return new Promise(function(_0x273e89,_0x3f4eab){var _0x29d9aa=require(_0x632b('0x1e'));var _0x4728a8;return db[_0x632b('0x1f')][_0x632b('0x20')]({'attributes':['id',_0x632b('0x21')],'where':{'id':0x1},'raw':!![]})[_0x632b('0xc')](function(_0x4f8410){_0x4728a8=_0x4f8410;return db[_0x632b('0x16')][_0x632b('0x22')](_0x954fa0[_0x632b('0x18')]);})[_0x632b('0xc')](function(_0x17a5ba){if(_0x4728a8[_0x632b('0x21')]&&fs[_0x632b('0x23')](_0x17a5ba[_0x632b('0x24')])){var _0x1ace1b=util[_0x632b('0x25')](_0x632b('0x26'),_0x17a5ba[_0x632b('0x24')]);return _0x29d9aa[_0x632b('0x27')](_0x17a5ba[_0x632b('0x24')],_0x1ace1b,config[_0x632b('0x28')][_0x632b('0x29')])[_0x632b('0xc')](function(){fs[_0x632b('0x2a')](_0x17a5ba[_0x632b('0x24')]);logger[_0x632b('0x14')]('CreateVoiceRecording\x20file\x20encrypted');return _0x17a5ba;});}return _0x17a5ba;})[_0x632b('0xc')](function(_0x4401dc){logger[_0x632b('0x14')](_0x632b('0x1d'),_0x954fa0);logger['debug'](_0x632b('0x1d'),_0x954fa0,JSON['stringify'](_0x4401dc));_0x273e89(_0x4401dc);})[_0x632b('0x1c')](function(_0x15b22d){logger['error'](_0x632b('0x1d'),_0x15b22d[_0x632b('0x13')],_0x954fa0);_0x3f4eab(_0x5d6855[_0x632b('0x10')](0x1f4,_0x15b22d[_0x632b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 40d937c..74d8630 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 _0x095d=['/:id','show','create','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','get','/describe','describe'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x095d,0x115));var _0xd095=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x095d[_0x15ca1a];return _0x507626;};'use strict';var multer=require('multer');var util=require(_0xd095('0x0'));var path=require(_0xd095('0x1'));var timeout=require('connect-timeout');var express=require(_0xd095('0x2'));var router=express[_0xd095('0x3')]();var fs_extra=require(_0xd095('0x4'));var auth=require(_0xd095('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd095('0x6'));var controller=require(_0xd095('0x7'));router['get']('/',auth[_0xd095('0x8')](),controller['index']);router[_0xd095('0x9')](_0xd095('0xa'),auth['isAuthenticated'](),controller[_0xd095('0xb')]);router[_0xd095('0x9')](_0xd095('0xc'),auth['isAuthenticated'](),controller[_0xd095('0xd')]);router['post']('/',auth[_0xd095('0x8')](),controller[_0xd095('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd095('0xf')](_0xd095('0xc'),auth[_0xd095('0x8')](),controller[_0xd095('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1e74=['/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0x2452d6,_0x58fb87){var _0x4de32e=function(_0x3f6192){while(--_0x3f6192){_0x2452d6['push'](_0x2452d6['shift']());}};_0x4de32e(++_0x58fb87);}(_0x1e74,0x11c));var _0x41e7=function(_0x1bcbe6,_0x5a3bc1){_0x1bcbe6=_0x1bcbe6-0x0;var _0x36cc73=_0x1e74[_0x1bcbe6];return _0x36cc73;};'use strict';var multer=require(_0x41e7('0x0'));var util=require(_0x41e7('0x1'));var path=require(_0x41e7('0x2'));var timeout=require(_0x41e7('0x3'));var express=require(_0x41e7('0x4'));var router=express[_0x41e7('0x5')]();var fs_extra=require(_0x41e7('0x6'));var auth=require(_0x41e7('0x7'));var interaction=require(_0x41e7('0x8'));var config=require(_0x41e7('0x9'));var controller=require(_0x41e7('0xa'));router[_0x41e7('0xb')]('/',auth[_0x41e7('0xc')](),controller[_0x41e7('0xd')]);router[_0x41e7('0xb')]('/describe',auth[_0x41e7('0xc')](),controller[_0x41e7('0xe')]);router['get'](_0x41e7('0xf'),auth[_0x41e7('0xc')](),controller[_0x41e7('0x10')]);router[_0x41e7('0x11')]('/',auth[_0x41e7('0xc')](),controller[_0x41e7('0x12')]);router[_0x41e7('0x13')](_0x41e7('0xf'),auth[_0x41e7('0xc')](),controller[_0x41e7('0x14')]);router['delete'](_0x41e7('0xf'),auth[_0x41e7('0xc')](),controller[_0x41e7('0x15')]);module[_0x41e7('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f8f958c..d57f047 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 _0xd3ac=['exports','blind','STRING','Yes','sequelize','moment'];(function(_0x2f0618,_0x3aa7de){var _0x4a02db=function(_0x533953){while(--_0x533953){_0x2f0618['push'](_0x2f0618['shift']());}};_0x4a02db(++_0x3aa7de);}(_0xd3ac,0x64));var _0xcd3a=function(_0x24678d,_0x59e17e){_0x24678d=_0x24678d-0x0;var _0x717828=_0xd3ac[_0x24678d];return _0x717828;};'use strict';var Sequelize=require(_0xcd3a('0x0'));var moment=require(_0xcd3a('0x1'));module[_0xcd3a('0x2')]={'type':{'type':Sequelize['ENUM'](_0xcd3a('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xcd3a('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xcd3a('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xcd3a('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xcd3a('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xcd3a('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xcd3a('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xcd3a('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xcd3a('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xcd3a('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xcd3a('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xcd3a('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0xcd3a('0x5'),'No')},'context':{'type':Sequelize[_0xcd3a('0x4')]},'extension':{'type':Sequelize[_0xcd3a('0x4')]}}; \ No newline at end of file +var _0x816d=['ENUM','Yes','moment','blind','attended','STRING'];(function(_0x3653c7,_0x58e9eb){var _0x22d36a=function(_0xf0b9e0){while(--_0xf0b9e0){_0x3653c7['push'](_0x3653c7['shift']());}};_0x22d36a(++_0x58e9eb);}(_0x816d,0xf8));var _0xd816=function(_0x5dac28,_0x31bef7){_0x5dac28=_0x5dac28-0x0;var _0x2d5552=_0x816d[_0x5dac28];return _0x2d5552;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd816('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xd816('0x1'),_0xd816('0x2'))},'result':{'type':Sequelize[_0xd816('0x3')]},'transfererchannel':{'type':Sequelize[_0xd816('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xd816('0x3')]},'transferercalleridname':{'type':Sequelize[_0xd816('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xd816('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xd816('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xd816('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xd816('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xd816('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xd816('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xd816('0x3')]},'isexternal':{'type':Sequelize[_0xd816('0x4')](_0xd816('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xd816('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 78287c2..02c53ee 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 _0xf982=['rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','type','VIRTUAL','filter','merge','VoiceTransferReport','include','rows','show','params','includeAll','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x184f5f,_0x2034dd){var _0x467cd7=function(_0x5826b7){while(--_0x5826b7){_0x184f5f['push'](_0x184f5f['shift']());}};_0x467cd7(++_0x2034dd);}(_0xf982,0xf5));var _0x2f98=function(_0x17ca9c,_0x24d2d8){_0x17ca9c=_0x17ca9c-0x0;var _0x55d2eb=_0xf982[_0x17ca9c];return _0x55d2eb;};'use strict';var emlformat=require(_0x2f98('0x0'));var rimraf=require(_0x2f98('0x1'));var zipdir=require(_0x2f98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f98('0x3'));var moment=require(_0x2f98('0x4'));var BPromise=require(_0x2f98('0x5'));var Mustache=require(_0x2f98('0x6'));var util=require('util');var path=require(_0x2f98('0x7'));var sox=require(_0x2f98('0x8'));var csv=require(_0x2f98('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f98('0xa'));var _=require(_0x2f98('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2f98('0xc'));var deskjs=require(_0x2f98('0xd'));var toCsv=require(_0x2f98('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2f98('0xe'));var as=require(_0x2f98('0xf'));var hardwareService=require(_0x2f98('0x10'));var logger=require(_0x2f98('0x11'))(_0x2f98('0x12'));var utils=require(_0x2f98('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f98('0x14'))['db'];function respondWithStatusCode(_0x4b0565,_0x3604a8){_0x3604a8=_0x3604a8||0xcc;return function(_0x2b0e24){if(_0x2b0e24){return _0x4b0565[_0x2f98('0x15')](_0x3604a8);}return _0x4b0565[_0x2f98('0x16')](_0x3604a8)['end']();};}function respondWithResult(_0x30ebe7,_0x7f4fbd){_0x7f4fbd=_0x7f4fbd||0xc8;return function(_0x286232){if(_0x286232){return _0x30ebe7[_0x2f98('0x16')](_0x7f4fbd)['json'](_0x286232);}};}function respondWithFilteredResult(_0xcc895d,_0x249476){return function(_0x87926d){if(_0x87926d){var _0x284bf1=typeof _0x249476[_0x2f98('0x17')]===_0x2f98('0x18')&&typeof _0x249476[_0x2f98('0x19')]===_0x2f98('0x18');var _0x39c704=_0x87926d[_0x2f98('0x1a')];var _0x4ee59c=_0x284bf1?0x0:_0x249476[_0x2f98('0x17')];var _0x297b80=_0x284bf1?_0x87926d[_0x2f98('0x1a')]:_0x249476[_0x2f98('0x17')]+_0x249476[_0x2f98('0x19')];var _0x57d012;if(_0x297b80>=_0x39c704){_0x297b80=_0x39c704;_0x57d012=0xc8;}else{_0x57d012=0xce;}_0xcc895d[_0x2f98('0x16')](_0x57d012);return _0xcc895d[_0x2f98('0x1b')]('Content-Range',_0x4ee59c+'-'+_0x297b80+'/'+_0x39c704)['json'](_0x87926d);}return null;};}function patchUpdates(_0x51bfff){return function(_0x4c6037){try{jsonpatch[_0x2f98('0x1c')](_0x4c6037,_0x51bfff,!![]);}catch(_0x54df46){return BPromise[_0x2f98('0x1d')](_0x54df46);}return _0x4c6037[_0x2f98('0x1e')]();};}function saveUpdates(_0x47322d,_0x37f1f3){return function(_0x34b8bd){if(_0x34b8bd){return _0x34b8bd[_0x2f98('0x1f')](_0x47322d)[_0x2f98('0x20')](function(_0x2c0f86){return _0x2c0f86;});}return null;};}function removeEntity(_0x1b53f6,_0x651222){return function(_0x5e7c4c){if(_0x5e7c4c){return _0x5e7c4c[_0x2f98('0x21')]()['then'](function(){_0x1b53f6[_0x2f98('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30d672,_0x1189ac){return function(_0x1d4222){if(!_0x1d4222){_0x30d672[_0x2f98('0x15')](0x194);}return _0x1d4222;};}function handleError(_0x2b5f04,_0x2e00f4){_0x2e00f4=_0x2e00f4||0x1f4;return function(_0x15fa57){logger[_0x2f98('0x22')](_0x15fa57[_0x2f98('0x23')]);if(_0x15fa57[_0x2f98('0x24')]){delete _0x15fa57[_0x2f98('0x24')];}_0x2b5f04[_0x2f98('0x16')](_0x2e00f4)[_0x2f98('0x25')](_0x15fa57);};}exports[_0x2f98('0x26')]=function(_0x1f0e52,_0x20f477){var _0x16945d={},_0x1d0630={},_0x4cb0dd={'count':0x0,'rows':[]};var _0x165035=_['map'](db['VoiceTransferReport'][_0x2f98('0x27')],function(_0x1fd65c){return{'name':_0x1fd65c[_0x2f98('0x28')],'type':_0x1fd65c['type'][_0x2f98('0x29')]};});_0x1d0630[_0x2f98('0x2a')]=_[_0x2f98('0x2b')](_0x165035,_0x2f98('0x24'));_0x1d0630[_0x2f98('0x2c')]=_[_0x2f98('0x2d')](_0x1f0e52[_0x2f98('0x2c')]);_0x1d0630[_0x2f98('0x2e')]=_[_0x2f98('0x2f')](_0x1d0630['model'],_0x1d0630[_0x2f98('0x2c')]);_0x16945d[_0x2f98('0x30')]=_[_0x2f98('0x2f')](_0x1d0630['model'],qs[_0x2f98('0x31')](_0x1f0e52[_0x2f98('0x2c')][_0x2f98('0x31')]));_0x16945d[_0x2f98('0x30')]=_0x16945d['attributes'][_0x2f98('0x32')]?_0x16945d[_0x2f98('0x30')]:_0x1d0630[_0x2f98('0x2a')];if(!_0x1f0e52[_0x2f98('0x2c')][_0x2f98('0x33')]('nolimit')){_0x16945d[_0x2f98('0x19')]=qs['limit'](_0x1f0e52['query'][_0x2f98('0x19')]);_0x16945d[_0x2f98('0x17')]=qs[_0x2f98('0x17')](_0x1f0e52[_0x2f98('0x2c')]['offset']);}_0x16945d['order']=qs[_0x2f98('0x34')](_0x1f0e52[_0x2f98('0x2c')]['sort']);_0x16945d[_0x2f98('0x35')]=qs[_0x2f98('0x2e')](_[_0x2f98('0x36')](_0x1f0e52[_0x2f98('0x2c')],_0x1d0630[_0x2f98('0x2e')]),_0x165035);if(_0x1f0e52[_0x2f98('0x2c')]['filter']){_0x16945d['where']=_['merge'](_0x16945d[_0x2f98('0x35')],{'$or':_[_0x2f98('0x2b')](_0x165035,function(_0x3851ea){if(_0x3851ea[_0x2f98('0x37')]!==_0x2f98('0x38')){var _0x1fa2c4={};_0x1fa2c4[_0x3851ea[_0x2f98('0x24')]]={'$like':'%'+_0x1f0e52[_0x2f98('0x2c')][_0x2f98('0x39')]+'%'};return _0x1fa2c4;}})});}_0x16945d=_[_0x2f98('0x3a')]({},_0x16945d,_0x1f0e52['options']);var _0x1a639d={'where':_0x16945d['where']};return db[_0x2f98('0x3b')][_0x2f98('0x1a')](_0x1a639d)['then'](function(_0x40a2eb){_0x4cb0dd[_0x2f98('0x1a')]=_0x40a2eb;if(_0x1f0e52[_0x2f98('0x2c')]['includeAll']){_0x16945d[_0x2f98('0x3c')]=[{'all':!![]}];}return db[_0x2f98('0x3b')]['findAll'](_0x16945d);})['then'](function(_0x345056){_0x4cb0dd[_0x2f98('0x3d')]=_0x345056;return _0x4cb0dd;})[_0x2f98('0x20')](respondWithFilteredResult(_0x20f477,_0x16945d))['catch'](handleError(_0x20f477,null));};exports[_0x2f98('0x3e')]=function(_0x4caec7,_0x292f5b){var _0x4fe860={'raw':!![],'where':{'id':_0x4caec7[_0x2f98('0x3f')]['id']}},_0x4ea3c5={};_0x4ea3c5['model']=_[_0x2f98('0x2d')](db[_0x2f98('0x3b')][_0x2f98('0x27')]);_0x4ea3c5[_0x2f98('0x2c')]=_[_0x2f98('0x2d')](_0x4caec7['query']);_0x4ea3c5[_0x2f98('0x2e')]=_[_0x2f98('0x2f')](_0x4ea3c5[_0x2f98('0x2a')],_0x4ea3c5[_0x2f98('0x2c')]);_0x4fe860['attributes']=_[_0x2f98('0x2f')](_0x4ea3c5[_0x2f98('0x2a')],qs[_0x2f98('0x31')](_0x4caec7['query']['fields']));_0x4fe860[_0x2f98('0x30')]=_0x4fe860[_0x2f98('0x30')][_0x2f98('0x32')]?_0x4fe860[_0x2f98('0x30')]:_0x4ea3c5['model'];if(_0x4caec7[_0x2f98('0x2c')][_0x2f98('0x40')]){_0x4fe860[_0x2f98('0x3c')]=[{'all':!![]}];}_0x4fe860=_[_0x2f98('0x3a')]({},_0x4fe860,_0x4caec7[_0x2f98('0x41')]);return db[_0x2f98('0x3b')][_0x2f98('0x42')](_0x4fe860)[_0x2f98('0x20')](handleEntityNotFound(_0x292f5b,null))[_0x2f98('0x20')](respondWithResult(_0x292f5b,null))['catch'](handleError(_0x292f5b,null));};exports['create']=function(_0x3d9f85,_0x65954f){return db['VoiceTransferReport'][_0x2f98('0x43')](_0x3d9f85[_0x2f98('0x44')],{})[_0x2f98('0x20')](respondWithResult(_0x65954f,0xc9))[_0x2f98('0x45')](handleError(_0x65954f,null));};exports[_0x2f98('0x1f')]=function(_0x5cdfa7,_0x1c02e4){if(_0x5cdfa7['body']['id']){delete _0x5cdfa7[_0x2f98('0x44')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x5cdfa7[_0x2f98('0x3f')]['id']}})[_0x2f98('0x20')](handleEntityNotFound(_0x1c02e4,null))[_0x2f98('0x20')](saveUpdates(_0x5cdfa7['body'],null))[_0x2f98('0x20')](respondWithResult(_0x1c02e4,null))[_0x2f98('0x45')](handleError(_0x1c02e4,null));};exports[_0x2f98('0x21')]=function(_0x171898,_0x35a59b){return db['VoiceTransferReport'][_0x2f98('0x42')]({'where':{'id':_0x171898[_0x2f98('0x3f')]['id']}})[_0x2f98('0x20')](handleEntityNotFound(_0x35a59b,null))[_0x2f98('0x20')](removeEntity(_0x35a59b,null))[_0x2f98('0x45')](handleError(_0x35a59b,null));};exports['describe']=function(_0xbcb42f,_0x509b2f){return db['VoiceTransferReport'][_0x2f98('0x46')]()['then'](respondWithResult(_0x509b2f,null))[_0x2f98('0x45')](handleError(_0x509b2f,null));}; \ No newline at end of file +var _0xdb32=['key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','keys','include','create','body','update','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','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','end','json','undefined','limit','count','offset','status','set','apply','reject','save','destroy','then','sendStatus','error','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type'];(function(_0x2c9527,_0x3d3e1d){var _0x2fd230=function(_0x301888){while(--_0x301888){_0x2c9527['push'](_0x2c9527['shift']());}};_0x2fd230(++_0x3d3e1d);}(_0xdb32,0xbe));var _0x2db3=function(_0x5c92b4,_0x3ac3b2){_0x5c92b4=_0x5c92b4-0x0;var _0x4bc8b7=_0xdb32[_0x5c92b4];return _0x4bc8b7;};'use strict';var emlformat=require(_0x2db3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2db3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2db3('0x2'));var moment=require(_0x2db3('0x3'));var BPromise=require(_0x2db3('0x4'));var Mustache=require(_0x2db3('0x5'));var util=require(_0x2db3('0x6'));var path=require(_0x2db3('0x7'));var sox=require(_0x2db3('0x8'));var csv=require('to-csv');var ejs=require(_0x2db3('0x9'));var fs=require('fs');var fs_extra=require(_0x2db3('0xa'));var _=require(_0x2db3('0xb'));var squel=require('squel');var crypto=require(_0x2db3('0xc'));var jsforce=require(_0x2db3('0xd'));var deskjs=require(_0x2db3('0xe'));var toCsv=require(_0x2db3('0xf'));var querystring=require(_0x2db3('0x10'));var Papa=require(_0x2db3('0x11'));var Redis=require(_0x2db3('0x12'));var authService=require(_0x2db3('0x13'));var qs=require(_0x2db3('0x14'));var as=require(_0x2db3('0x15'));var hardwareService=require(_0x2db3('0x16'));var logger=require(_0x2db3('0x17'))('api');var utils=require(_0x2db3('0x18'));var config=require(_0x2db3('0x19'));var licenseUtil=require(_0x2db3('0x1a'));var db=require(_0x2db3('0x1b'))['db'];function respondWithStatusCode(_0x17f1a2,_0x23a968){_0x23a968=_0x23a968||0xcc;return function(_0x394537){if(_0x394537){return _0x17f1a2['sendStatus'](_0x23a968);}return _0x17f1a2['status'](_0x23a968)[_0x2db3('0x1c')]();};}function respondWithResult(_0x29118b,_0x1fc83f){_0x1fc83f=_0x1fc83f||0xc8;return function(_0x249b03){if(_0x249b03){return _0x29118b['status'](_0x1fc83f)[_0x2db3('0x1d')](_0x249b03);}};}function respondWithFilteredResult(_0x184015,_0x2ddcbc){return function(_0x594da7){if(_0x594da7){var _0x5840ca=typeof _0x2ddcbc['offset']===_0x2db3('0x1e')&&typeof _0x2ddcbc[_0x2db3('0x1f')]===_0x2db3('0x1e');var _0x81e373=_0x594da7[_0x2db3('0x20')];var _0xf4775a=_0x5840ca?0x0:_0x2ddcbc['offset'];var _0xeda10=_0x5840ca?_0x594da7[_0x2db3('0x20')]:_0x2ddcbc[_0x2db3('0x21')]+_0x2ddcbc[_0x2db3('0x1f')];var _0x5036d8;if(_0xeda10>=_0x81e373){_0xeda10=_0x81e373;_0x5036d8=0xc8;}else{_0x5036d8=0xce;}_0x184015[_0x2db3('0x22')](_0x5036d8);return _0x184015[_0x2db3('0x23')]('Content-Range',_0xf4775a+'-'+_0xeda10+'/'+_0x81e373)[_0x2db3('0x1d')](_0x594da7);}return null;};}function patchUpdates(_0x3a2966){return function(_0x31776d){try{jsonpatch[_0x2db3('0x24')](_0x31776d,_0x3a2966,!![]);}catch(_0x54c4f5){return BPromise[_0x2db3('0x25')](_0x54c4f5);}return _0x31776d[_0x2db3('0x26')]();};}function saveUpdates(_0x48eaf6,_0x4a752c){return function(_0x528c05){if(_0x528c05){return _0x528c05['update'](_0x48eaf6)['then'](function(_0x57a289){return _0x57a289;});}return null;};}function removeEntity(_0x171d4a,_0x1a10a8){return function(_0xd03662){if(_0xd03662){return _0xd03662[_0x2db3('0x27')]()[_0x2db3('0x28')](function(){_0x171d4a[_0x2db3('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55093b,_0x424bbb){return function(_0x5fb65d){if(!_0x5fb65d){_0x55093b[_0x2db3('0x29')](0x194);}return _0x5fb65d;};}function handleError(_0x54f29f,_0x4e5b5a){_0x4e5b5a=_0x4e5b5a||0x1f4;return function(_0x3d6061){logger[_0x2db3('0x2a')](_0x3d6061['stack']);if(_0x3d6061[_0x2db3('0x2b')]){delete _0x3d6061[_0x2db3('0x2b')];}_0x54f29f[_0x2db3('0x22')](_0x4e5b5a)[_0x2db3('0x2c')](_0x3d6061);};}exports[_0x2db3('0x2d')]=function(_0x572657,_0x51d280){var _0x33d15c={},_0x989e8f={},_0x55469c={'count':0x0,'rows':[]};var _0x2d8708=_['map'](db[_0x2db3('0x2e')][_0x2db3('0x2f')],function(_0x20e000){return{'name':_0x20e000[_0x2db3('0x30')],'type':_0x20e000[_0x2db3('0x31')][_0x2db3('0x32')]};});_0x989e8f['model']=_[_0x2db3('0x33')](_0x2d8708,_0x2db3('0x2b'));_0x989e8f[_0x2db3('0x34')]=_['keys'](_0x572657[_0x2db3('0x34')]);_0x989e8f[_0x2db3('0x35')]=_[_0x2db3('0x36')](_0x989e8f[_0x2db3('0x37')],_0x989e8f[_0x2db3('0x34')]);_0x33d15c['attributes']=_['intersection'](_0x989e8f[_0x2db3('0x37')],qs['fields'](_0x572657[_0x2db3('0x34')][_0x2db3('0x38')]));_0x33d15c[_0x2db3('0x39')]=_0x33d15c[_0x2db3('0x39')][_0x2db3('0x3a')]?_0x33d15c['attributes']:_0x989e8f[_0x2db3('0x37')];if(!_0x572657[_0x2db3('0x34')]['hasOwnProperty'](_0x2db3('0x3b'))){_0x33d15c['limit']=qs[_0x2db3('0x1f')](_0x572657['query'][_0x2db3('0x1f')]);_0x33d15c[_0x2db3('0x21')]=qs[_0x2db3('0x21')](_0x572657[_0x2db3('0x34')][_0x2db3('0x21')]);}_0x33d15c[_0x2db3('0x3c')]=qs['sort'](_0x572657[_0x2db3('0x34')][_0x2db3('0x3d')]);_0x33d15c[_0x2db3('0x3e')]=qs['filters'](_[_0x2db3('0x3f')](_0x572657[_0x2db3('0x34')],_0x989e8f['filters']),_0x2d8708);if(_0x572657[_0x2db3('0x34')]['filter']){_0x33d15c[_0x2db3('0x3e')]=_[_0x2db3('0x40')](_0x33d15c[_0x2db3('0x3e')],{'$or':_[_0x2db3('0x33')](_0x2d8708,function(_0x5d6586){if(_0x5d6586[_0x2db3('0x31')]!==_0x2db3('0x41')){var _0x5a655c={};_0x5a655c[_0x5d6586[_0x2db3('0x2b')]]={'$like':'%'+_0x572657[_0x2db3('0x34')][_0x2db3('0x42')]+'%'};return _0x5a655c;}})});}_0x33d15c=_[_0x2db3('0x40')]({},_0x33d15c,_0x572657[_0x2db3('0x43')]);var _0x268b99={'where':_0x33d15c[_0x2db3('0x3e')]};return db[_0x2db3('0x2e')][_0x2db3('0x20')](_0x268b99)[_0x2db3('0x28')](function(_0x36e166){_0x55469c[_0x2db3('0x20')]=_0x36e166;if(_0x572657[_0x2db3('0x34')][_0x2db3('0x44')]){_0x33d15c['include']=[{'all':!![]}];}return db[_0x2db3('0x2e')][_0x2db3('0x45')](_0x33d15c);})['then'](function(_0x293acd){_0x55469c[_0x2db3('0x46')]=_0x293acd;return _0x55469c;})[_0x2db3('0x28')](respondWithFilteredResult(_0x51d280,_0x33d15c))[_0x2db3('0x47')](handleError(_0x51d280,null));};exports['show']=function(_0x404dea,_0x34fe6c){var _0x31afc0={'raw':!![],'where':{'id':_0x404dea[_0x2db3('0x48')]['id']}},_0x23a703={};_0x23a703['model']=_[_0x2db3('0x49')](db['VoiceTransferReport'][_0x2db3('0x2f')]);_0x23a703[_0x2db3('0x34')]=_[_0x2db3('0x49')](_0x404dea[_0x2db3('0x34')]);_0x23a703[_0x2db3('0x35')]=_[_0x2db3('0x36')](_0x23a703[_0x2db3('0x37')],_0x23a703[_0x2db3('0x34')]);_0x31afc0[_0x2db3('0x39')]=_[_0x2db3('0x36')](_0x23a703[_0x2db3('0x37')],qs['fields'](_0x404dea[_0x2db3('0x34')]['fields']));_0x31afc0[_0x2db3('0x39')]=_0x31afc0['attributes'][_0x2db3('0x3a')]?_0x31afc0[_0x2db3('0x39')]:_0x23a703[_0x2db3('0x37')];if(_0x404dea[_0x2db3('0x34')]['includeAll']){_0x31afc0[_0x2db3('0x4a')]=[{'all':!![]}];}_0x31afc0=_[_0x2db3('0x40')]({},_0x31afc0,_0x404dea[_0x2db3('0x43')]);return db[_0x2db3('0x2e')]['find'](_0x31afc0)[_0x2db3('0x28')](handleEntityNotFound(_0x34fe6c,null))[_0x2db3('0x28')](respondWithResult(_0x34fe6c,null))[_0x2db3('0x47')](handleError(_0x34fe6c,null));};exports[_0x2db3('0x4b')]=function(_0x4b1f39,_0x35ba47){return db[_0x2db3('0x2e')]['create'](_0x4b1f39[_0x2db3('0x4c')],{})['then'](respondWithResult(_0x35ba47,0xc9))['catch'](handleError(_0x35ba47,null));};exports[_0x2db3('0x4d')]=function(_0x2778fd,_0x43faa8){if(_0x2778fd[_0x2db3('0x4c')]['id']){delete _0x2778fd[_0x2db3('0x4c')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x2778fd['params']['id']}})[_0x2db3('0x28')](handleEntityNotFound(_0x43faa8,null))[_0x2db3('0x28')](saveUpdates(_0x2778fd[_0x2db3('0x4c')],null))['then'](respondWithResult(_0x43faa8,null))[_0x2db3('0x47')](handleError(_0x43faa8,null));};exports[_0x2db3('0x27')]=function(_0x14c804,_0x4b008c){return db[_0x2db3('0x2e')][_0x2db3('0x4e')]({'where':{'id':_0x14c804[_0x2db3('0x48')]['id']}})[_0x2db3('0x28')](handleEntityNotFound(_0x4b008c,null))[_0x2db3('0x28')](removeEntity(_0x4b008c,null))[_0x2db3('0x47')](handleError(_0x4b008c,null));};exports[_0x2db3('0x4f')]=function(_0x53eabb,_0x4c6446){return db[_0x2db3('0x2e')]['describe']()['then'](respondWithResult(_0x4c6446,null))[_0x2db3('0x47')](handleError(_0x4c6446,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index fdc4aab..b271ec3 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 _0xda8e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xda8e,0x17e));var _0xeda8=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0xda8e[_0x49a57c];return _0x4e0316;};'use strict';var _=require(_0xeda8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeda8('0x1'));var moment=require(_0xeda8('0x2'));var BPromise=require(_0xeda8('0x3'));var rp=require(_0xeda8('0x4'));var fs=require('fs');var path=require(_0xeda8('0x5'));var rimraf=require(_0xeda8('0x6'));var config=require(_0xeda8('0x7'));var attributes=require(_0xeda8('0x8'));module[_0xeda8('0x9')]=function(_0x17a191,_0x46bb80){return _0x17a191[_0xeda8('0xa')]('VoiceTransferReport',attributes,{'tableName':_0xeda8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x909c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_call_transfer','lodash','../../config/logger','api'];(function(_0x3a9172,_0x4c96e7){var _0x4ab5f9=function(_0x25d07c){while(--_0x25d07c){_0x3a9172['push'](_0x3a9172['shift']());}};_0x4ab5f9(++_0x4c96e7);}(_0x909c,0x131));var _0xc909=function(_0x8055e4,_0x59c828){_0x8055e4=_0x8055e4-0x0;var _0x18888e=_0x909c[_0x8055e4];return _0x18888e;};'use strict';var _=require(_0xc909('0x0'));var util=require('util');var logger=require(_0xc909('0x1'))(_0xc909('0x2'));var moment=require(_0xc909('0x3'));var BPromise=require(_0xc909('0x4'));var rp=require(_0xc909('0x5'));var fs=require('fs');var path=require(_0xc909('0x6'));var rimraf=require(_0xc909('0x7'));var config=require(_0xc909('0x8'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x5e93a2,_0x56d750){return _0x5e93a2[_0xc909('0x9')]('VoiceTransferReport',attributes,{'tableName':_0xc909('0xa'),'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 1f6bd0b..e6483ac 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 _0x4fef=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceTransferReport','body','options','raw','debug','stringify'];(function(_0x4940d,_0x5ab488){var _0x5bcb40=function(_0x2cd63a){while(--_0x2cd63a){_0x4940d['push'](_0x4940d['shift']());}};_0x5bcb40(++_0x5ab488);}(_0x4fef,0x145));var _0xf4fe=function(_0x98a9c8,_0x1714e5){_0x98a9c8=_0x98a9c8-0x0;var _0x1295c8=_0x4fef[_0x98a9c8];return _0x1295c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf4fe('0x0'));var rs=require(_0xf4fe('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf4fe('0x2'));var logger=require(_0xf4fe('0x3'))(_0xf4fe('0x4'));var config=require(_0xf4fe('0x5'));var jayson=require(_0xf4fe('0x6'));var client=jayson[_0xf4fe('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213257,_0x178d6f,_0x5aa275){return new BPromise(function(_0x12c0da,_0x2db5f5){return client[_0xf4fe('0x8')](_0x213257,_0x5aa275)[_0xf4fe('0x9')](function(_0x41a2a9){logger[_0xf4fe('0xa')](_0xf4fe('0xb'),_0x178d6f,_0xf4fe('0xc'));logger['debug'](_0xf4fe('0xd'),_0x178d6f,_0xf4fe('0xc'),JSON['stringify'](_0x41a2a9));if(_0x41a2a9['error']){if(_0x41a2a9[_0xf4fe('0xe')][_0xf4fe('0xf')]===0x1f4){logger[_0xf4fe('0xe')](_0xf4fe('0xb'),_0x178d6f,_0x41a2a9[_0xf4fe('0xe')]['message']);return _0x2db5f5(_0x41a2a9[_0xf4fe('0xe')][_0xf4fe('0x10')]);}logger['error'](_0xf4fe('0xb'),_0x178d6f,_0x41a2a9[_0xf4fe('0xe')][_0xf4fe('0x10')]);return _0x12c0da(_0x41a2a9['error']['message']);}else{logger[_0xf4fe('0xa')](_0xf4fe('0xb'),_0x178d6f,_0xf4fe('0xc'));_0x12c0da(_0x41a2a9[_0xf4fe('0x11')][_0xf4fe('0x10')]);}})[_0xf4fe('0x12')](function(_0xf545ab){logger['error'](_0xf4fe('0xb'),_0x178d6f,_0xf545ab);_0x2db5f5(_0xf545ab);});});}exports[_0xf4fe('0x13')]=function(_0x2ce22e){var _0x27abdb=this;return new Promise(function(_0x11670c,_0x4a0b79){return db['VoiceTransferReport']['create'](_0x2ce22e[_0xf4fe('0x14')],{'raw':_0x2ce22e['options']?_0x2ce22e[_0xf4fe('0x15')][_0xf4fe('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x16167f){logger['info'](_0xf4fe('0x13'),_0x2ce22e);logger[_0xf4fe('0x17')](_0xf4fe('0x13'),_0x2ce22e,JSON[_0xf4fe('0x18')](_0x16167f));_0x11670c(_0x16167f);})['catch'](function(_0x2b4597){logger[_0xf4fe('0xe')](_0xf4fe('0x13'),_0x2b4597[_0xf4fe('0x10')],_0x2ce22e);_0x4a0b79(_0x27abdb['error'](0x1f4,_0x2b4597[_0xf4fe('0x10')]));});});}; \ No newline at end of file +var _0x5eb8=['code','VoiceTransferReport,\x20%s,\x20%s','message','result','VoiceTransferReport','body','options','info','CreateVoiceTransferReport','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x540511,_0x201e3b){var _0x5c1ac6=function(_0xdacf37){while(--_0xdacf37){_0x540511['push'](_0x540511['shift']());}};_0x5c1ac6(++_0x201e3b);}(_0x5eb8,0x106));var _0x85eb=function(_0xe09d0,_0x1e55d0){_0xe09d0=_0xe09d0-0x0;var _0x44ad05=_0x5eb8[_0xe09d0];return _0x44ad05;};'use strict';var _=require(_0x85eb('0x0'));var util=require(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x85eb('0x3'));var fs=require('fs');var Redis=require(_0x85eb('0x4'));var db=require(_0x85eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require('../../config/environment');var jayson=require(_0x85eb('0x8'));var client=jayson[_0x85eb('0x9')][_0x85eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdbecd,_0x44c705,_0xd19546){return new BPromise(function(_0x1e3ff5,_0x1c6a3b){return client[_0x85eb('0xb')](_0xdbecd,_0xd19546)[_0x85eb('0xc')](function(_0x28c77d){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x44c705,'request\x20sent');logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x44c705,_0x85eb('0xf'),JSON[_0x85eb('0x10')](_0x28c77d));if(_0x28c77d[_0x85eb('0x11')]){if(_0x28c77d[_0x85eb('0x11')][_0x85eb('0x12')]===0x1f4){logger[_0x85eb('0x11')](_0x85eb('0x13'),_0x44c705,_0x28c77d[_0x85eb('0x11')][_0x85eb('0x14')]);return _0x1c6a3b(_0x28c77d['error'][_0x85eb('0x14')]);}logger[_0x85eb('0x11')](_0x85eb('0x13'),_0x44c705,_0x28c77d[_0x85eb('0x11')][_0x85eb('0x14')]);return _0x1e3ff5(_0x28c77d[_0x85eb('0x11')][_0x85eb('0x14')]);}else{logger['info'](_0x85eb('0x13'),_0x44c705,_0x85eb('0xf'));_0x1e3ff5(_0x28c77d[_0x85eb('0x15')][_0x85eb('0x14')]);}})['catch'](function(_0x3e6960){logger[_0x85eb('0x11')](_0x85eb('0x13'),_0x44c705,_0x3e6960);_0x1c6a3b(_0x3e6960);});});}exports['CreateVoiceTransferReport']=function(_0xe5155f){var _0x4800d0=this;return new Promise(function(_0x94a7fc,_0x193b3b){return db[_0x85eb('0x16')]['create'](_0xe5155f[_0x85eb('0x17')],{'raw':_0xe5155f[_0x85eb('0x18')]?_0xe5155f[_0x85eb('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x85eb('0xc')](function(_0x5ce603){logger[_0x85eb('0x19')]('CreateVoiceTransferReport',_0xe5155f);logger[_0x85eb('0xd')](_0x85eb('0x1a'),_0xe5155f,JSON[_0x85eb('0x10')](_0x5ce603));_0x94a7fc(_0x5ce603);})[_0x85eb('0x1b')](function(_0x567919){logger[_0x85eb('0x11')](_0x85eb('0x1a'),_0x567919[_0x85eb('0x14')],_0xe5155f);_0x193b3b(_0x4800d0[_0x85eb('0x11')](0x1f4,_0x567919[_0x85eb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 5de8502..9cadcd0 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 _0xc8eb=['answer','post','/unhold','unhold','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','canUpdate','originate','/hangup','isAuthenticated','hangup','/answer'];(function(_0x498c71,_0x36155d){var _0x5cf10e=function(_0x23b726){while(--_0x23b726){_0x498c71['push'](_0x498c71['shift']());}};_0x5cf10e(++_0x36155d);}(_0xc8eb,0x76));var _0xbc8e=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xc8eb[_0x310a1b];return _0xdea206;};'use strict';var express=require(_0xbc8e('0x0'));var router=express[_0xbc8e('0x1')]();var auth=require(_0xbc8e('0x2'));var controller=require(_0xbc8e('0x3'));router['post']('/originate',auth['isAuthenticated'](),auth[_0xbc8e('0x4')](),controller[_0xbc8e('0x5')]);router['post'](_0xbc8e('0x6'),auth[_0xbc8e('0x7')](),auth[_0xbc8e('0x4')](),controller[_0xbc8e('0x8')]);router['post'](_0xbc8e('0x9'),auth[_0xbc8e('0x7')](),auth[_0xbc8e('0x4')](),controller[_0xbc8e('0xa')]);router['post']('/hold',auth['isAuthenticated'](),auth['canUpdate'](),controller['hold']);router[_0xbc8e('0xb')](_0xbc8e('0xc'),auth[_0xbc8e('0x7')](),auth['canUpdate'](),controller[_0xbc8e('0xd')]);router[_0xbc8e('0xb')]('/calls',auth[_0xbc8e('0x7')](),auth['canUpdate'](),controller['calls']);router[_0xbc8e('0xb')](_0xbc8e('0xe'),auth[_0xbc8e('0x7')](),auth[_0xbc8e('0x4')](),controller[_0xbc8e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x543e=['/originate','isAuthenticated','originate','canUpdate','answer','/hold','hold','/unhold','unhold','calls','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x1a799d,_0x37b9d0){var _0x30aef3=function(_0x1296b4){while(--_0x1296b4){_0x1a799d['push'](_0x1a799d['shift']());}};_0x30aef3(++_0x37b9d0);}(_0x543e,0x1b5));var _0xe543=function(_0x2e7982,_0x2d9e36){_0x2e7982=_0x2e7982-0x0;var _0x5b3b05=_0x543e[_0x2e7982];return _0x5b3b05;};'use strict';var express=require(_0xe543('0x0'));var router=express[_0xe543('0x1')]();var auth=require(_0xe543('0x2'));var controller=require(_0xe543('0x3'));router[_0xe543('0x4')](_0xe543('0x5'),auth[_0xe543('0x6')](),auth['canUpdate'](),controller[_0xe543('0x7')]);router[_0xe543('0x4')]('/hangup',auth['isAuthenticated'](),auth[_0xe543('0x8')](),controller['hangup']);router[_0xe543('0x4')]('/answer',auth[_0xe543('0x6')](),auth[_0xe543('0x8')](),controller[_0xe543('0x9')]);router[_0xe543('0x4')](_0xe543('0xa'),auth['isAuthenticated'](),auth[_0xe543('0x8')](),controller[_0xe543('0xb')]);router[_0xe543('0x4')](_0xe543('0xc'),auth['isAuthenticated'](),auth[_0xe543('0x8')](),controller[_0xe543('0xd')]);router[_0xe543('0x4')]('/calls',auth[_0xe543('0x6')](),auth['canUpdate'](),controller[_0xe543('0xe')]);router[_0xe543('0x4')](_0xe543('0xf'),auth['isAuthenticated'](),auth[_0xe543('0x8')](),controller[_0xe543('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d34993e..94ab535 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 _0x5178=['message','result','User','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','catch','hangup','hangup\x20fired:','validate','user:%s','webbar:hangup','hangup\x20executed!','answer','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','http','../../config/logger','ioredis','defaults','redis','localhost','socket.io-emitter','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','then','code'];(function(_0x2dce9f,_0x1d1880){var _0x1cd454=function(_0x2a909c){while(--_0x2a909c){_0x2dce9f['push'](_0x2dce9f['shift']());}};_0x1cd454(++_0x1d1880);}(_0x5178,0x171));var _0x8517=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5178[_0x6c993a];return _0x27f547;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8517('0x0'));var db=require(_0x8517('0x1'))['db'];var config=require(_0x8517('0x2'));var util=require(_0x8517('0x3'));var BPromise=require(_0x8517('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x8517('0x5')]({'port':0x232a});var logger=require(_0x8517('0x6'))('webbarapi');var Redis=require(_0x8517('0x7'));config['redis']=_[_0x8517('0x8')](config[_0x8517('0x9')],{'host':_0x8517('0xa'),'port':0x18eb});var io=require(_0x8517('0xb'))(new Redis(config[_0x8517('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x8517('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x8517('0xd')]},'callerId':{'type':_0x8517('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x8517('0xc'),'required':[!![],_0x8517('0xf')]},'sessionId':{'type':_0x8517('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8517('0xc'),'required':[!![],_0x8517('0xf')]},'sessionId':{'type':_0x8517('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8517('0xc'),'required':[!![],_0x8517('0xf')]},'sessionId':{'type':'string','required':[!![],_0x8517('0x10')]},'transferNumber':{'type':_0x8517('0xe'),'required':[!![],_0x8517('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x8517('0xc'),'required':[!![],_0x8517('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8517('0xc'),'required':[!![],_0x8517('0xf')]},'sessionId':{'type':_0x8517('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8517('0xc'),'required':[!![],_0x8517('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8517('0xc'),'required':[!![],_0x8517('0xf')]}});function emit(_0x30cea1,_0x504a92,_0x2953dd){logger[_0x8517('0x12')](_0x30cea1,_0x504a92,JSON[_0x8517('0x13')](_0x2953dd));io['to'](_0x30cea1)['emit'](_0x504a92,_0x2953dd);}function handleError(_0xdfe7fe){return function(_0x100b76){console[_0x8517('0x14')](_0x8517('0x15'),_0x100b76,_0x100b76 instanceof RangeError);logger[_0x8517('0x16')](_0x100b76[_0x8517('0x17')]);if(_0x100b76 instanceof RangeError){if(_0x100b76[_0x8517('0x18')]){delete _0x100b76['name'];}_0xdfe7fe[_0x8517('0x19')](0x194)['send'](_0x100b76);}else{if(_0x100b76['name']){delete _0x100b76[_0x8517('0x18')];}_0xdfe7fe[_0x8517('0x19')](0x1f4)[_0x8517('0x1a')](_0x100b76);}};}function checkError(){return function(_0x180d8d){if(!_0x180d8d){throw new RangeError(_0x8517('0x1b'));}return _0x180d8d;};}function respondWithRpcPromise(_0xdfde16,_0x512458){return new BPromise(function(_0x4b145f,_0x2dd1df){var _0x37861d=amiClient;return _0x37861d[_0x8517('0x1c')](_0xdfde16,_0x512458)[_0x8517('0x1d')](function(_0x3a5f0b){if(_0x3a5f0b[_0x8517('0x16')]){if(_0x3a5f0b['error'][_0x8517('0x1e')]===0x1f4){return _0x2dd1df(_0x3a5f0b[_0x8517('0x16')]['message']);}return _0x4b145f(_0x3a5f0b[_0x8517('0x16')][_0x8517('0x1f')]);}else{_0x4b145f(_0x3a5f0b[_0x8517('0x20')]);}})['catch'](function(_0x634092){_0x2dd1df(_0x634092);});});}function getAgent(_0x572ce4){return db[_0x8517('0x21')][_0x8517('0x22')]({'where':{'id':_0x572ce4,'role':_0x8517('0x23')}})[_0x8517('0x1d')](checkError());}function getAgentCheckSession(_0x238f2c,_0x300e3f){return new BPromise(function(_0x481ceb,_0x39764e){var _0x51d516=respondWithRpcPromise(_0x8517('0x24'));var _0x70ee9d=getAgent(_0x238f2c);Promise[_0x8517('0x25')]([_0x51d516,_0x70ee9d])[_0x8517('0x1d')](function(_0x3e6f89){var _0x1b2423=_0x3e6f89[0x0];var _0x4c691f=_0x3e6f89[0x1];var _0x20ec0a=_['filter'](_0x1b2423[_0x8517('0x26')],function(_0x4b9983){return _0x4b9983[_0x8517('0x27')]==_0x4c691f['id']&&_0x4b9983[_0x8517('0x28')]==_0x300e3f;});if(_0x20ec0a[_0x8517('0x29')]==0x1){_0x481ceb(_0x4c691f);}else{_0x39764e(new RangeError(_0x8517('0x2a')+_0x300e3f+_0x8517('0x2b')));}});});}exports[_0x8517('0x2c')]=function(_0x647d81,_0x559707){logger[_0x8517('0x12')](_0x8517('0x2d'),_0x647d81[_0x8517('0x2e')]);var _0x53c009=originateValidation['validate'](_0x647d81['body']);if(_0x53c009[_0x8517('0x29')]>0x0){return _0x559707[_0x8517('0x19')](0x190)[_0x8517('0x2f')](_0x53c009);}var _0x2abad4=_0x647d81[_0x8517('0x2e')][_0x8517('0x30')];var _0x5d9d04=_0x647d81[_0x8517('0x2e')][_0x8517('0x31')];var _0x3fc3aa=_0x647d81['body'][_0x8517('0x32')];var _0x5756d7=_0x647d81[_0x8517('0x2e')][_0x8517('0x33')];return getAgent(_0x2abad4)['then'](function(_0x572feb){logger[_0x8517('0x12')](_0x8517('0x34'),_0x572feb[_0x8517('0x18')]);emit(util[_0x8517('0x35')]('user:%s',_0x572feb['name']),_0x8517('0x36'),{'callNumber':_0x5d9d04,'callerId':_0x3fc3aa,'callbackUrl':_0x5756d7});return _0x559707[_0x8517('0x19')](0xc8)[_0x8517('0x2f')]({'error':![],'message':'originate\x20executed!'});})[_0x8517('0x37')](handleError(_0x559707));};exports[_0x8517('0x38')]=function(_0x4afa5b,_0x209235){logger[_0x8517('0x12')](_0x8517('0x39'),_0x4afa5b[_0x8517('0x2e')]);var _0x57ca29=hangupValidation[_0x8517('0x3a')](_0x4afa5b[_0x8517('0x2e')]);if(_0x57ca29[_0x8517('0x29')]>0x0){return _0x209235[_0x8517('0x19')](0x190)[_0x8517('0x2f')](_0x57ca29);}var _0x22592a=_0x4afa5b[_0x8517('0x2e')][_0x8517('0x30')];var _0x3f338a=_0x4afa5b[_0x8517('0x2e')][_0x8517('0x28')];return getAgent(_0x22592a)[_0x8517('0x1d')](function(_0x232e49){logger['info']('entityFound:',_0x232e49[_0x8517('0x18')]);emit(util[_0x8517('0x35')](_0x8517('0x3b'),_0x232e49[_0x8517('0x18')]),_0x8517('0x3c'),{'sessionId':_0x3f338a});return _0x209235['status'](0xc8)[_0x8517('0x2f')]({'error':![],'message':_0x8517('0x3d')});})['catch'](handleError(_0x209235));};exports[_0x8517('0x3e')]=function(_0x34fd09,_0x32fba6){logger[_0x8517('0x12')]('answer\x20fired:',_0x34fd09[_0x8517('0x2e')]);var _0x24034f=answerValidation['validate'](_0x34fd09[_0x8517('0x2e')]);if(_0x24034f[_0x8517('0x29')]>0x0){return _0x32fba6[_0x8517('0x19')](0x190)['json'](_0x24034f);}var _0x368bb8=_0x34fd09[_0x8517('0x2e')][_0x8517('0x30')];var _0x404a40=_0x34fd09[_0x8517('0x2e')][_0x8517('0x28')];return getAgent(_0x368bb8)[_0x8517('0x1d')](function(_0x501850){logger[_0x8517('0x12')](_0x8517('0x34'),_0x501850['name']);emit(util[_0x8517('0x35')](_0x8517('0x3b'),_0x501850[_0x8517('0x18')]),_0x8517('0x3f'),{'sessionId':_0x404a40});return _0x32fba6[_0x8517('0x19')](0xc8)[_0x8517('0x2f')]({'error':![],'message':'answer\x20executed!'});})[_0x8517('0x37')](handleError(_0x32fba6));};exports[_0x8517('0x40')]=function(_0x3a9778,_0x561860){logger[_0x8517('0x12')](_0x8517('0x41'),_0x3a9778['body']);var _0x10ed6a=holdValidation[_0x8517('0x3a')](_0x3a9778['body']);if(_0x10ed6a['length']>0x0){return _0x561860['status'](0x190)[_0x8517('0x2f')](_0x10ed6a);}var _0x250a14=_0x3a9778['body'][_0x8517('0x30')];var _0x5b0ea3=_0x3a9778['body'][_0x8517('0x28')];return getAgent(_0x250a14)[_0x8517('0x1d')](function(_0x3c8ecb){logger[_0x8517('0x12')]('entityFound:',_0x3c8ecb[_0x8517('0x18')]);emit(util[_0x8517('0x35')](_0x8517('0x3b'),_0x3c8ecb['name']),_0x8517('0x42'),{'sessionId':_0x5b0ea3});return _0x561860[_0x8517('0x19')](0xc8)[_0x8517('0x2f')]({'error':![],'message':_0x8517('0x43')});})[_0x8517('0x37')](handleError(_0x561860));};exports[_0x8517('0x44')]=function(_0x3cccd9,_0x4987eb){logger[_0x8517('0x12')]('unhold\x20fired:',_0x3cccd9['body']);var _0x2752b6=unholdValidation[_0x8517('0x3a')](_0x3cccd9[_0x8517('0x2e')]);if(_0x2752b6[_0x8517('0x29')]>0x0){return _0x4987eb['status'](0x190)[_0x8517('0x2f')](_0x2752b6);}var _0x2da857=_0x3cccd9['body']['userId'];var _0x3bdbb4=_0x3cccd9[_0x8517('0x2e')][_0x8517('0x28')];return getAgent(_0x2da857)['then'](function(_0x26444e){logger['info'](_0x8517('0x34'),_0x26444e[_0x8517('0x18')]);emit(util[_0x8517('0x35')](_0x8517('0x3b'),_0x26444e[_0x8517('0x18')]),_0x8517('0x45'),{'sessionId':_0x3bdbb4});return _0x4987eb[_0x8517('0x19')](0xc8)[_0x8517('0x2f')]({'error':![],'message':_0x8517('0x46')});})['catch'](handleError(_0x4987eb));};exports['calls']=function(_0x1eaadc,_0x6f36b1){logger[_0x8517('0x12')]('calls\x20fired:',_0x6f36b1[_0x8517('0x2e')]);var _0x1ce476=callsValidation[_0x8517('0x3a')](_0x1eaadc['body']);if(_0x1ce476['length']>0x0){return _0x6f36b1[_0x8517('0x19')](0x190)[_0x8517('0x2f')](_0x1ce476);}var _0x919ff8=_0x1eaadc[_0x8517('0x2e')][_0x8517('0x30')];var _0x3be6db=respondWithRpcPromise(_0x8517('0x24'));var _0x123504=getAgent(_0x919ff8);return Promise[_0x8517('0x25')]([_0x3be6db,_0x123504])[_0x8517('0x1d')](function(_0x3f6f67){var _0x3c5462=_0x3f6f67[0x0];var _0xf303bb=_0x3f6f67[0x1];var _0x20dc60=_[_0x8517('0x47')](_0x3c5462[_0x8517('0x26')],function(_0x5c3932){return _0x5c3932[_0x8517('0x27')]==_0xf303bb['id'];});return _0x6f36b1[_0x8517('0x19')](0xc8)[_0x8517('0x2f')]({'count':_0x20dc60[_0x8517('0x29')],'rows':_0x20dc60});})[_0x8517('0x37')](handleError(_0x6f36b1));};exports[_0x8517('0x48')]=function(_0x322682,_0x50b037){logger[_0x8517('0x12')](_0x8517('0x49'),_0x322682[_0x8517('0x2e')]);var _0x461640=conferenceValidation[_0x8517('0x3a')](_0x322682['body']);if(_0x461640[_0x8517('0x29')]>0x0){return _0x50b037['status'](0x190)[_0x8517('0x2f')](_0x461640);}var _0x2305dd=_0x322682[_0x8517('0x2e')][_0x8517('0x30')];return getAgent(_0x2305dd)[_0x8517('0x1d')](function(_0x56b659){logger[_0x8517('0x12')](_0x8517('0x34'),_0x56b659[_0x8517('0x18')]);emit(util[_0x8517('0x35')]('user:%s',_0x56b659['name']),_0x8517('0x4a'));return _0x50b037['status'](0xc8)[_0x8517('0x2f')]({'error':![],'message':_0x8517('0x4b')});})['catch'](handleError(_0x50b037));};exports[_0x8517('0x4c')]=function(_0x3e9374,_0x4a483d){logger[_0x8517('0x12')](_0x8517('0x4d'),_0x3e9374[_0x8517('0x2e')]);var _0x3321c5=transferValidation[_0x8517('0x3a')](_0x3e9374[_0x8517('0x2e')]);if(_0x3321c5[_0x8517('0x29')]>0x0){return _0x4a483d[_0x8517('0x19')](0x190)['json'](_0x3321c5);}var _0x2f0156=_0x3e9374[_0x8517('0x2e')][_0x8517('0x30')];var _0x1b9c97=_0x3e9374['body'][_0x8517('0x28')];var _0x4793fe=_0x3e9374[_0x8517('0x2e')][_0x8517('0x4e')];return getAgent(_0x2f0156)[_0x8517('0x1d')](function(_0x67bd47){logger['info']('entityFound:',_0x67bd47[_0x8517('0x18')]);emit(util[_0x8517('0x35')](_0x8517('0x3b'),_0x67bd47[_0x8517('0x18')]),'webbar:transfer',{'sessionId':_0x1b9c97,'transferNumber':_0x4793fe});return _0x4a483d[_0x8517('0x19')](0xc8)[_0x8517('0x2f')]({'error':![],'message':_0x8517('0x4f')});})[_0x8517('0x37')](handleError(_0x4a483d));}; \ No newline at end of file +var _0x702d=['message','result','catch','User','agent','then','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','body','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','userId','hangup\x20executed!','answer','answer\x20fired:','validate','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','all','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','ioredis','defaults','redis','localhost','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound'];(function(_0x1fafcd,_0x4a6ae7){var _0x240aa0=function(_0x27a075){while(--_0x27a075){_0x1fafcd['push'](_0x1fafcd['shift']());}};_0x240aa0(++_0x4a6ae7);}(_0x702d,0x147));var _0xd702=function(_0x4cfbb9,_0xeee76f){_0x4cfbb9=_0x4cfbb9-0x0;var _0x8e0ce1=_0x702d[_0x4cfbb9];return _0x8e0ce1;};'use strict';var path=require(_0xd702('0x0'));var fs=require('fs');var _=require(_0xd702('0x1'));var db=require(_0xd702('0x2'))['db'];var config=require(_0xd702('0x3'));var util=require(_0xd702('0x4'));var BPromise=require('bluebird');var jayson=require(_0xd702('0x5'));var amiClient=jayson[_0xd702('0x6')][_0xd702('0x7')]({'port':0x232a});var logger=require(_0xd702('0x8'))('webbarapi');var Redis=require(_0xd702('0x9'));config['redis']=_[_0xd702('0xa')](config[_0xd702('0xb')],{'host':_0xd702('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd702('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],_0xd702('0xe')]},'callNumber':{'type':_0xd702('0xf'),'required':[!![],_0xd702('0x10')]},'callerId':{'type':_0xd702('0xf')},'callbackUrl':{'type':_0xd702('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],_0xd702('0xe')]},'sessionId':{'type':_0xd702('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],_0xd702('0xe')]},'sessionId':{'type':_0xd702('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xd702('0xf'),'required':[!![],_0xd702('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],_0xd702('0xe')]},'sessionId':{'type':_0xd702('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd702('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x268c66,_0x210c32,_0x55b93e){logger[_0xd702('0x12')](_0x268c66,_0x210c32,JSON[_0xd702('0x13')](_0x55b93e));io['to'](_0x268c66)[_0xd702('0x14')](_0x210c32,_0x55b93e);}function handleError(_0x4fdbbd){return function(_0x5b3b1d){console[_0xd702('0x15')]('handleError:',_0x5b3b1d,_0x5b3b1d instanceof RangeError);logger[_0xd702('0x16')](_0x5b3b1d[_0xd702('0x17')]);if(_0x5b3b1d instanceof RangeError){if(_0x5b3b1d[_0xd702('0x18')]){delete _0x5b3b1d[_0xd702('0x18')];}_0x4fdbbd[_0xd702('0x19')](0x194)[_0xd702('0x1a')](_0x5b3b1d);}else{if(_0x5b3b1d[_0xd702('0x18')]){delete _0x5b3b1d['name'];}_0x4fdbbd['status'](0x1f4)['send'](_0x5b3b1d);}};}function checkError(){return function(_0x55516e){if(!_0x55516e){throw new RangeError(_0xd702('0x1b'));}return _0x55516e;};}function respondWithRpcPromise(_0x5cbff4,_0x211200){return new BPromise(function(_0x5d91fd,_0xc4c246){var _0x5824ec=amiClient;return _0x5824ec['request'](_0x5cbff4,_0x211200)['then'](function(_0x21c00e){if(_0x21c00e[_0xd702('0x16')]){if(_0x21c00e[_0xd702('0x16')]['code']===0x1f4){return _0xc4c246(_0x21c00e[_0xd702('0x16')][_0xd702('0x1c')]);}return _0x5d91fd(_0x21c00e[_0xd702('0x16')][_0xd702('0x1c')]);}else{_0x5d91fd(_0x21c00e[_0xd702('0x1d')]);}})[_0xd702('0x1e')](function(_0x94c58d){_0xc4c246(_0x94c58d);});});}function getAgent(_0x45ca87){return db[_0xd702('0x1f')]['findOne']({'where':{'id':_0x45ca87,'role':_0xd702('0x20')}})[_0xd702('0x21')](checkError());}function getAgentCheckSession(_0x25e96a,_0x335202){return new BPromise(function(_0xbe4518,_0x38505d){var _0x797156=respondWithRpcPromise(_0xd702('0x22'));var _0x5f1084=getAgent(_0x25e96a);Promise['all']([_0x797156,_0x5f1084])[_0xd702('0x21')](function(_0x43cd38){var _0x56bc8d=_0x43cd38[0x0];var _0x45cd22=_0x43cd38[0x1];var _0xee8bf1=_[_0xd702('0x23')](_0x56bc8d[_0xd702('0x24')],function(_0x56e9cd){return _0x56e9cd[_0xd702('0x25')]==_0x45cd22['id']&&_0x56e9cd[_0xd702('0x26')]==_0x335202;});if(_0xee8bf1[_0xd702('0x27')]==0x1){_0xbe4518(_0x45cd22);}else{_0x38505d(new RangeError(_0xd702('0x28')+_0x335202+_0xd702('0x29')));}});});}exports['originate']=function(_0x1b1056,_0x219f41){logger[_0xd702('0x12')]('originate\x20fired:',_0x1b1056[_0xd702('0x2a')]);var _0x563103=originateValidation['validate'](_0x1b1056[_0xd702('0x2a')]);if(_0x563103[_0xd702('0x27')]>0x0){return _0x219f41[_0xd702('0x19')](0x190)['json'](_0x563103);}var _0x7b8af3=_0x1b1056[_0xd702('0x2a')]['userId'];var _0x208f50=_0x1b1056[_0xd702('0x2a')][_0xd702('0x2b')];var _0xd244cc=_0x1b1056[_0xd702('0x2a')][_0xd702('0x2c')];var _0x401f92=_0x1b1056[_0xd702('0x2a')][_0xd702('0x2d')];return getAgent(_0x7b8af3)[_0xd702('0x21')](function(_0x9f458b){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x9f458b['name']);emit(util[_0xd702('0x2f')](_0xd702('0x30'),_0x9f458b[_0xd702('0x18')]),_0xd702('0x31'),{'callNumber':_0x208f50,'callerId':_0xd244cc,'callbackUrl':_0x401f92});return _0x219f41[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x33')});})['catch'](handleError(_0x219f41));};exports['hangup']=function(_0x138d54,_0x1810ee){logger['info']('hangup\x20fired:',_0x138d54[_0xd702('0x2a')]);var _0x234795=hangupValidation['validate'](_0x138d54[_0xd702('0x2a')]);if(_0x234795[_0xd702('0x27')]>0x0){return _0x1810ee[_0xd702('0x19')](0x190)['json'](_0x234795);}var _0x3444c8=_0x138d54[_0xd702('0x2a')][_0xd702('0x34')];var _0x506c4a=_0x138d54[_0xd702('0x2a')]['sessionId'];return getAgent(_0x3444c8)[_0xd702('0x21')](function(_0x239bec){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x239bec[_0xd702('0x18')]);emit(util[_0xd702('0x2f')](_0xd702('0x30'),_0x239bec[_0xd702('0x18')]),'webbar:hangup',{'sessionId':_0x506c4a});return _0x1810ee[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x35')});})[_0xd702('0x1e')](handleError(_0x1810ee));};exports[_0xd702('0x36')]=function(_0x5ecb10,_0x203f5d){logger[_0xd702('0x12')](_0xd702('0x37'),_0x5ecb10['body']);var _0xd48ad0=answerValidation[_0xd702('0x38')](_0x5ecb10[_0xd702('0x2a')]);if(_0xd48ad0[_0xd702('0x27')]>0x0){return _0x203f5d['status'](0x190)[_0xd702('0x32')](_0xd48ad0);}var _0xfa5e9=_0x5ecb10[_0xd702('0x2a')][_0xd702('0x34')];var _0x185e4a=_0x5ecb10['body'][_0xd702('0x26')];return getAgent(_0xfa5e9)[_0xd702('0x21')](function(_0x5b1ab7){logger['info'](_0xd702('0x2e'),_0x5b1ab7[_0xd702('0x18')]);emit(util[_0xd702('0x2f')](_0xd702('0x30'),_0x5b1ab7[_0xd702('0x18')]),_0xd702('0x39'),{'sessionId':_0x185e4a});return _0x203f5d[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x3a')});})['catch'](handleError(_0x203f5d));};exports['hold']=function(_0xbf6235,_0x58047c){logger[_0xd702('0x12')]('hold\x20fired:',_0xbf6235[_0xd702('0x2a')]);var _0x58a56f=holdValidation[_0xd702('0x38')](_0xbf6235['body']);if(_0x58a56f[_0xd702('0x27')]>0x0){return _0x58047c[_0xd702('0x19')](0x190)['json'](_0x58a56f);}var _0x160f5e=_0xbf6235[_0xd702('0x2a')][_0xd702('0x34')];var _0x18012d=_0xbf6235[_0xd702('0x2a')]['sessionId'];return getAgent(_0x160f5e)[_0xd702('0x21')](function(_0x14c1db){logger[_0xd702('0x12')]('entityFound:',_0x14c1db[_0xd702('0x18')]);emit(util['format'](_0xd702('0x30'),_0x14c1db[_0xd702('0x18')]),_0xd702('0x3b'),{'sessionId':_0x18012d});return _0x58047c['status'](0xc8)['json']({'error':![],'message':_0xd702('0x3c')});})[_0xd702('0x1e')](handleError(_0x58047c));};exports[_0xd702('0x3d')]=function(_0x397e91,_0x16e59b){logger[_0xd702('0x12')](_0xd702('0x3e'),_0x397e91[_0xd702('0x2a')]);var _0x7da555=unholdValidation[_0xd702('0x38')](_0x397e91['body']);if(_0x7da555['length']>0x0){return _0x16e59b[_0xd702('0x19')](0x190)[_0xd702('0x32')](_0x7da555);}var _0x229d47=_0x397e91['body']['userId'];var _0x831383=_0x397e91['body'][_0xd702('0x26')];return getAgent(_0x229d47)[_0xd702('0x21')](function(_0x18ef24){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x18ef24[_0xd702('0x18')]);emit(util[_0xd702('0x2f')](_0xd702('0x30'),_0x18ef24[_0xd702('0x18')]),'webbar:unhold',{'sessionId':_0x831383});return _0x16e59b[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x3f')});})[_0xd702('0x1e')](handleError(_0x16e59b));};exports['calls']=function(_0x3f3045,_0x4e542a){logger[_0xd702('0x12')]('calls\x20fired:',_0x4e542a['body']);var _0x2a31c0=callsValidation[_0xd702('0x38')](_0x3f3045[_0xd702('0x2a')]);if(_0x2a31c0[_0xd702('0x27')]>0x0){return _0x4e542a[_0xd702('0x19')](0x190)[_0xd702('0x32')](_0x2a31c0);}var _0x5db532=_0x3f3045[_0xd702('0x2a')][_0xd702('0x34')];var _0x55719b=respondWithRpcPromise(_0xd702('0x22'));var _0x316520=getAgent(_0x5db532);return Promise[_0xd702('0x40')]([_0x55719b,_0x316520])[_0xd702('0x21')](function(_0x34a194){var _0x27e588=_0x34a194[0x0];var _0x554ab8=_0x34a194[0x1];var _0x2186e7=_[_0xd702('0x23')](_0x27e588[_0xd702('0x24')],function(_0x2e536a){return _0x2e536a[_0xd702('0x25')]==_0x554ab8['id'];});return _0x4e542a['status'](0xc8)['json']({'count':_0x2186e7[_0xd702('0x27')],'rows':_0x2186e7});})['catch'](handleError(_0x4e542a));};exports['conference']=function(_0x2fa2c7,_0x48e348){logger[_0xd702('0x12')](_0xd702('0x41'),_0x2fa2c7[_0xd702('0x2a')]);var _0x1ea97e=conferenceValidation['validate'](_0x2fa2c7[_0xd702('0x2a')]);if(_0x1ea97e['length']>0x0){return _0x48e348[_0xd702('0x19')](0x190)['json'](_0x1ea97e);}var _0x4453c5=_0x2fa2c7[_0xd702('0x2a')][_0xd702('0x34')];return getAgent(_0x4453c5)[_0xd702('0x21')](function(_0x329642){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x329642['name']);emit(util['format'](_0xd702('0x30'),_0x329642['name']),_0xd702('0x42'));return _0x48e348[_0xd702('0x19')](0xc8)['json']({'error':![],'message':_0xd702('0x43')});})[_0xd702('0x1e')](handleError(_0x48e348));};exports['transfer']=function(_0x1dbf12,_0x5e88cb){logger[_0xd702('0x12')](_0xd702('0x44'),_0x1dbf12[_0xd702('0x2a')]);var _0xc9611d=transferValidation['validate'](_0x1dbf12[_0xd702('0x2a')]);if(_0xc9611d[_0xd702('0x27')]>0x0){return _0x5e88cb[_0xd702('0x19')](0x190)[_0xd702('0x32')](_0xc9611d);}var _0x36a782=_0x1dbf12['body'][_0xd702('0x34')];var _0x1c514e=_0x1dbf12[_0xd702('0x2a')][_0xd702('0x26')];var _0x29fc86=_0x1dbf12[_0xd702('0x2a')]['transferNumber'];return getAgent(_0x36a782)[_0xd702('0x21')](function(_0x4f3e4f){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x4f3e4f[_0xd702('0x18')]);emit(util[_0xd702('0x2f')]('user:%s',_0x4f3e4f[_0xd702('0x18')]),_0xd702('0x45'),{'sessionId':_0x1c514e,'transferNumber':_0x29fc86});return _0x5e88cb[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x46')});})['catch'](handleError(_0x5e88cb));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 7922ffa..4bf8b27 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 _0x9582=['destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addApplications','/:id/notify','/:id/send','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9582,0x95));var _0x2958=function(_0x932abd,_0x376dd9){_0x932abd=_0x932abd-0x0;var _0x3769dc=_0x9582[_0x932abd];return _0x3769dc;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2958('0x6'));var interaction=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var controller=require(_0x2958('0x9'));router[_0x2958('0xa')]('/',auth[_0x2958('0xb')](),controller[_0x2958('0xc')]);router[_0x2958('0xa')](_0x2958('0xd'),auth[_0x2958('0xb')](),controller['describe']);router['get'](_0x2958('0xe'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['get'](_0x2958('0x10'),auth['isAuthenticated'](),controller[_0x2958('0x11')]);router[_0x2958('0xa')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x13')]);router['get'](_0x2958('0x14'),auth[_0x2958('0xb')](),controller[_0x2958('0x15')]);router[_0x2958('0xa')](_0x2958('0x16'),auth[_0x2958('0xb')](),controller[_0x2958('0x17')]);router[_0x2958('0x18')]('/',auth['isAuthenticated'](),controller[_0x2958('0x19')]);router[_0x2958('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2958('0x1a')]);router[_0x2958('0x18')]('/:id/canned_answers',auth[_0x2958('0xb')](),controller['addAnswer']);router['post'](_0x2958('0x14'),auth[_0x2958('0xb')](),controller['addAgents']);router['post'](_0x2958('0x16'),auth[_0x2958('0xb')](),controller[_0x2958('0x1b')]);router[_0x2958('0x18')](_0x2958('0x1c'),controller['notify']);router[_0x2958('0x18')](_0x2958('0x1d'),auth[_0x2958('0xb')](),controller['send']);router[_0x2958('0x1e')]('/:id',auth[_0x2958('0xb')](),controller['update']);router['delete'](_0x2958('0xe'),auth[_0x2958('0xb')](),controller[_0x2958('0x1f')]);router[_0x2958('0x20')](_0x2958('0x10'),auth[_0x2958('0xb')](),controller[_0x2958('0x21')]);router[_0x2958('0x20')](_0x2958('0x12'),auth[_0x2958('0xb')](),controller[_0x2958('0x22')]);router[_0x2958('0x20')](_0x2958('0x14'),auth[_0x2958('0xb')](),controller[_0x2958('0x23')]);module['exports']=router; \ No newline at end of file +var _0x8952=['getAgents','/:id/applications','create','/:id/dispositions','addDisposition','post','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','update','delete','destroy','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','getAnswers'];(function(_0x49ca08,_0x2a4505){var _0x5663aa=function(_0x585f2a){while(--_0x585f2a){_0x49ca08['push'](_0x49ca08['shift']());}};_0x5663aa(++_0x2a4505);}(_0x8952,0x17e));var _0x2895=function(_0x59b8d7,_0x47a6a1){_0x59b8d7=_0x59b8d7-0x0;var _0x16c2ca=_0x8952[_0x59b8d7];return _0x16c2ca;};'use strict';var multer=require('multer');var util=require(_0x2895('0x0'));var path=require(_0x2895('0x1'));var timeout=require(_0x2895('0x2'));var express=require(_0x2895('0x3'));var router=express[_0x2895('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2895('0x5'));var interaction=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var controller=require('./whatsappAccount.controller');router[_0x2895('0x8')]('/',auth[_0x2895('0x9')](),controller[_0x2895('0xa')]);router['get']('/describe',auth[_0x2895('0x9')](),controller[_0x2895('0xb')]);router[_0x2895('0x8')](_0x2895('0xc'),auth[_0x2895('0x9')](),controller['show']);router[_0x2895('0x8')]('/:id/dispositions',auth[_0x2895('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x2895('0x9')](),controller[_0x2895('0xd')]);router[_0x2895('0x8')]('/:id/users',auth[_0x2895('0x9')](),controller[_0x2895('0xe')]);router['get'](_0x2895('0xf'),auth[_0x2895('0x9')](),controller['getApplications']);router['post']('/',auth[_0x2895('0x9')](),controller[_0x2895('0x10')]);router['post'](_0x2895('0x11'),auth[_0x2895('0x9')](),controller[_0x2895('0x12')]);router[_0x2895('0x13')](_0x2895('0x14'),auth[_0x2895('0x9')](),controller[_0x2895('0x15')]);router[_0x2895('0x13')](_0x2895('0x16'),auth[_0x2895('0x9')](),controller[_0x2895('0x17')]);router[_0x2895('0x13')](_0x2895('0xf'),auth[_0x2895('0x9')](),controller[_0x2895('0x18')]);router[_0x2895('0x13')](_0x2895('0x19'),controller[_0x2895('0x1a')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x2895('0x1b')]);router[_0x2895('0x1c')](_0x2895('0xc'),auth['isAuthenticated'](),controller[_0x2895('0x1d')]);router[_0x2895('0x1e')](_0x2895('0xc'),auth[_0x2895('0x9')](),controller[_0x2895('0x1f')]);router['delete'](_0x2895('0x11'),auth[_0x2895('0x9')](),controller['removeDispositions']);router[_0x2895('0x1e')](_0x2895('0x14'),auth[_0x2895('0x9')](),controller['removeAnswers']);router['delete'](_0x2895('0x16'),auth[_0x2895('0x9')](),controller[_0x2895('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 40b998e..f3f8445 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 _0x2d38=['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','mandatoryDisposition','sequelize','exports','STRING','name','generate','twilio','TEXT'];(function(_0x32f5a0,_0x241a2b){var _0x1edf8e=function(_0x572c8e){while(--_0x572c8e){_0x32f5a0['push'](_0x32f5a0['shift']());}};_0x1edf8e(++_0x241a2b);}(_0x2d38,0x13b));var _0x82d3=function(_0x1eee6e,_0x12f7a3){_0x1eee6e=_0x1eee6e-0x0;var _0x3caf1d=_0x2d38[_0x1eee6e];return _0x3caf1d;};'use strict';var Sequelize=require(_0x82d3('0x0'));var rs=require('randomstring');module[_0x82d3('0x1')]={'name':{'type':Sequelize[_0x82d3('0x2')],'unique':_0x82d3('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x82d3('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x82d3('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x82d3('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x82d3('0x5'))},'accountSid':{'type':Sequelize[_0x82d3('0x2')]},'authToken':{'type':Sequelize[_0x82d3('0x2')]},'notificationTemplate':{'type':Sequelize[_0x82d3('0x6')],'defaultValue':function(){return _0x82d3('0x7');}},'notificationSound':{'type':Sequelize[_0x82d3('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x82d3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x82d3('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x82d3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x82d3('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x82d3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x82d3('0x9')],'comment':_0x82d3('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x82d3('0x8')],'defaultValue':![],'comment':_0x82d3('0xb'),'set':function(_0x5a91eb){if(!_0x5a91eb){this[_0x82d3('0xc')]('mandatoryDispositionPauseId',null);}this[_0x82d3('0xc')](_0x82d3('0xd'),_0x5a91eb);}},'description':{'type':Sequelize[_0x82d3('0x2')]}}; \ No newline at end of file +var _0xfe23=['mandatoryDispositionPauseId','sequelize','exports','STRING','name','generate','ENUM','twilio','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'];(function(_0x39b148,_0x37726e){var _0x17a5ef=function(_0x35a1c0){while(--_0x35a1c0){_0x39b148['push'](_0x39b148['shift']());}};_0x17a5ef(++_0x37726e);}(_0xfe23,0x14b));var _0x3fe2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfe23[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x3fe2('0x0'));var rs=require('randomstring');module[_0x3fe2('0x1')]={'name':{'type':Sequelize[_0x3fe2('0x2')],'unique':_0x3fe2('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x3fe2('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x3fe2('0x2')],'defaultValue':function(){return rs[_0x3fe2('0x4')]();}},'phone':{'type':Sequelize[_0x3fe2('0x2')]},'type':{'type':Sequelize[_0x3fe2('0x5')](_0x3fe2('0x6'))},'accountSid':{'type':Sequelize[_0x3fe2('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3fe2('0x7')],'defaultValue':function(){return _0x3fe2('0x8');}},'notificationSound':{'type':Sequelize[_0x3fe2('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3fe2('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3fe2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3fe2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3fe2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3fe2('0xa')],'comment':_0x3fe2('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3fe2('0xc'),'set':function(_0x299783){if(!_0x299783){this[_0x3fe2('0xd')](_0x3fe2('0xe'),null);}this[_0x3fe2('0xd')]('mandatoryDisposition',_0x299783);}},'description':{'type':Sequelize[_0x3fe2('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 28c3f3b..4454134 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 _0xaefb=['show','keys','rawAttributes','find','create','body','user','autoAssociation','update','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','getApplications','notify','whatsapp','account','applications','orderBy','priority','asc','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','from','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','save','then','destroy','get','WhatsappAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','count','includeAll','include','findAll','rows'];(function(_0x4a706f,_0x3018f0){var _0x5458f4=function(_0x1b4f84){while(--_0x1b4f84){_0x4a706f['push'](_0x4a706f['shift']());}};_0x5458f4(++_0x3018f0);}(_0xaefb,0x67));var _0xbaef=function(_0x2cb3eb,_0x4d83aa){_0x2cb3eb=_0x2cb3eb-0x0;var _0x2759ee=_0xaefb[_0x2cb3eb];return _0x2759ee;};'use strict';var emlformat=require(_0xbaef('0x0'));var rimraf=require(_0xbaef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbaef('0x2'));var rp=require(_0xbaef('0x3'));var moment=require(_0xbaef('0x4'));var BPromise=require(_0xbaef('0x5'));var Mustache=require(_0xbaef('0x6'));var util=require(_0xbaef('0x7'));var path=require(_0xbaef('0x8'));var sox=require(_0xbaef('0x9'));var csv=require(_0xbaef('0xa'));var ejs=require(_0xbaef('0xb'));var fs=require('fs');var fs_extra=require(_0xbaef('0xc'));var _=require(_0xbaef('0xd'));var squel=require(_0xbaef('0xe'));var crypto=require('crypto');var jsforce=require(_0xbaef('0xf'));var deskjs=require(_0xbaef('0x10'));var toCsv=require(_0xbaef('0xa'));var querystring=require(_0xbaef('0x11'));var Papa=require(_0xbaef('0x12'));var Redis=require('ioredis');var authService=require(_0xbaef('0x13'));var qs=require(_0xbaef('0x14'));var as=require(_0xbaef('0x15'));var hardwareService=require(_0xbaef('0x16'));var logger=require(_0xbaef('0x17'))(_0xbaef('0x18'));var utils=require('../../config/utils');var config=require(_0xbaef('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbaef('0x1a'))['db'];config[_0xbaef('0x1b')]=_[_0xbaef('0x1c')](config['redis'],{'host':_0xbaef('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbaef('0x1b')]));require(_0xbaef('0x1e'))['register'](socket);var jayson=require(_0xbaef('0x1f'));var client=jayson[_0xbaef('0x20')][_0xbaef('0x21')]({'port':0x232c});function respondWithRpcPromise(_0xcb982d,_0x25828b,_0x217936,_0x2d66ee){return new BPromise(function(_0x1a72a5,_0x5e1878){var _0x27f941=_0x2d66ee||client;return _0x27f941[_0xbaef('0x22')](_0xcb982d,_0x217936)['then'](function(_0x32ae7d){logger[_0xbaef('0x23')](_0xbaef('0x24'),_0x25828b,_0xbaef('0x25'));logger['debug'](_0xbaef('0x26'),_0x25828b,_0xbaef('0x25'),JSON[_0xbaef('0x27')](_0x32ae7d));if(_0x32ae7d[_0xbaef('0x28')]){if(_0x32ae7d['error']['code']===0x1f4){logger[_0xbaef('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x25828b,_0x32ae7d['error'][_0xbaef('0x29')]);return _0x5e1878(_0x32ae7d[_0xbaef('0x28')][_0xbaef('0x29')]);}logger[_0xbaef('0x28')](_0xbaef('0x24'),_0x25828b,_0x32ae7d[_0xbaef('0x28')][_0xbaef('0x29')]);return _0x1a72a5(_0x32ae7d[_0xbaef('0x28')][_0xbaef('0x29')]);}else{logger[_0xbaef('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x25828b,_0xbaef('0x25'));_0x1a72a5(_0x32ae7d[_0xbaef('0x2a')]['message']);}})[_0xbaef('0x2b')](function(_0x5ea624){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x25828b,_0x5ea624);_0x5e1878(_0x5ea624);});});}function respondWithStatusCode(_0x3d10d7,_0x462af0){_0x462af0=_0x462af0||0xcc;return function(_0xfc3fe8){if(_0xfc3fe8){return _0x3d10d7[_0xbaef('0x2c')](_0x462af0);}return _0x3d10d7[_0xbaef('0x2d')](_0x462af0)[_0xbaef('0x2e')]();};}function respondWithResult(_0x53fee9,_0x4e2870){_0x4e2870=_0x4e2870||0xc8;return function(_0x32321e){if(_0x32321e){return _0x53fee9['status'](_0x4e2870)['json'](_0x32321e);}};}function respondWithFilteredResult(_0x461160,_0x5daf8b){return function(_0x51c6fb){if(_0x51c6fb){var _0xba1c91=typeof _0x5daf8b['offset']===_0xbaef('0x2f')&&typeof _0x5daf8b[_0xbaef('0x30')]===_0xbaef('0x2f');var _0x4b3815=_0x51c6fb['count'];var _0x183c53=_0xba1c91?0x0:_0x5daf8b['offset'];var _0x44b09c=_0xba1c91?_0x51c6fb['count']:_0x5daf8b[_0xbaef('0x31')]+_0x5daf8b[_0xbaef('0x30')];var _0x5d5b47;if(_0x44b09c>=_0x4b3815){_0x44b09c=_0x4b3815;_0x5d5b47=0xc8;}else{_0x5d5b47=0xce;}_0x461160[_0xbaef('0x2d')](_0x5d5b47);return _0x461160[_0xbaef('0x32')](_0xbaef('0x33'),_0x183c53+'-'+_0x44b09c+'/'+_0x4b3815)[_0xbaef('0x34')](_0x51c6fb);}return null;};}function patchUpdates(_0x58da95){return function(_0x4936b4){try{jsonpatch[_0xbaef('0x35')](_0x4936b4,_0x58da95,!![]);}catch(_0x3f3101){return BPromise['reject'](_0x3f3101);}return _0x4936b4[_0xbaef('0x36')]();};}function saveUpdates(_0x1b5d68,_0x22590e){return function(_0x310a20){if(_0x310a20){return _0x310a20['update'](_0x1b5d68)[_0xbaef('0x37')](function(_0x4cd844){return _0x4cd844;});}return null;};}function removeEntity(_0x101c16,_0xc457da){return function(_0x1369dc){if(_0x1369dc){return _0x1369dc[_0xbaef('0x38')]()[_0xbaef('0x37')](function(){var _0x3cede9=_0x1369dc[_0xbaef('0x39')]({'plain':!![]});var _0x4153f0=_0xbaef('0x3a');return db[_0xbaef('0x3b')][_0xbaef('0x38')]({'where':{'type':_0x4153f0,'resourceId':_0x3cede9['id']}})[_0xbaef('0x37')](function(){return _0x1369dc;});})[_0xbaef('0x37')](function(){_0x101c16[_0xbaef('0x2d')](0xcc)[_0xbaef('0x2e')]();});}};}function handleEntityNotFound(_0x462a3c,_0xa23a17){return function(_0x79eb82){if(!_0x79eb82){_0x462a3c[_0xbaef('0x2c')](0x194);}return _0x79eb82;};}function handleError(_0x509587,_0x29d795){_0x29d795=_0x29d795||0x1f4;return function(_0x110b0b){logger[_0xbaef('0x28')](_0x110b0b['stack']);if(_0x110b0b[_0xbaef('0x3c')]){delete _0x110b0b[_0xbaef('0x3c')];}_0x509587[_0xbaef('0x2d')](_0x29d795)['send'](_0x110b0b);};}exports[_0xbaef('0x3d')]=function(_0x328d50,_0x392c64){var _0x41c5b2={'include':[{'model':db[_0xbaef('0x3e')],'as':_0xbaef('0x3f')}]},_0x495694={},_0x3e1c0e={'count':0x0,'rows':[]};var _0x11df41=_[_0xbaef('0x40')](db[_0xbaef('0x41')]['rawAttributes'],function(_0x186704){return{'name':_0x186704['fieldName'],'type':_0x186704[_0xbaef('0x42')][_0xbaef('0x43')]};});_0x495694['model']=_[_0xbaef('0x40')](_0x11df41,_0xbaef('0x3c'));_0x495694['query']=_['keys'](_0x328d50[_0xbaef('0x44')]);_0x495694[_0xbaef('0x45')]=_[_0xbaef('0x46')](_0x495694[_0xbaef('0x47')],_0x495694[_0xbaef('0x44')]);_0x41c5b2[_0xbaef('0x48')]=_['intersection'](_0x495694['model'],qs[_0xbaef('0x49')](_0x328d50[_0xbaef('0x44')][_0xbaef('0x49')]));_0x41c5b2[_0xbaef('0x48')]=_0x41c5b2['attributes'][_0xbaef('0x4a')]?_0x41c5b2[_0xbaef('0x48')]:_0x495694['model'];if(!_0x328d50['query'][_0xbaef('0x4b')](_0xbaef('0x4c'))){_0x41c5b2[_0xbaef('0x30')]=qs[_0xbaef('0x30')](_0x328d50[_0xbaef('0x44')][_0xbaef('0x30')]);_0x41c5b2[_0xbaef('0x31')]=qs[_0xbaef('0x31')](_0x328d50[_0xbaef('0x44')]['offset']);}_0x41c5b2['order']=qs['sort'](_0x328d50['query']['sort']);_0x41c5b2[_0xbaef('0x4d')]=qs[_0xbaef('0x45')](_[_0xbaef('0x4e')](_0x328d50['query'],_0x495694[_0xbaef('0x45')]),_0x11df41);if(_0x328d50['query'][_0xbaef('0x4f')]){_0x41c5b2[_0xbaef('0x4d')]=_[_0xbaef('0x50')](_0x41c5b2['where'],{'$or':_[_0xbaef('0x40')](_0x11df41,function(_0x3b9f7e){if(_0x3b9f7e[_0xbaef('0x42')]!=='VIRTUAL'){var _0x18b660={};_0x18b660[_0x3b9f7e[_0xbaef('0x3c')]]={'$like':'%'+_0x328d50[_0xbaef('0x44')][_0xbaef('0x4f')]+'%'};return _0x18b660;}})});}_0x41c5b2=_['merge']({},_0x41c5b2,_0x328d50[_0xbaef('0x51')]);var _0x3eacd9={'where':_0x41c5b2[_0xbaef('0x4d')]};return db[_0xbaef('0x41')][_0xbaef('0x52')](_0x3eacd9)['then'](function(_0x21185f){_0x3e1c0e[_0xbaef('0x52')]=_0x21185f;if(_0x328d50[_0xbaef('0x44')][_0xbaef('0x53')]){_0x41c5b2[_0xbaef('0x54')]=[{'all':!![]}];}return db[_0xbaef('0x41')][_0xbaef('0x55')](_0x41c5b2);})[_0xbaef('0x37')](function(_0x4bb1e9){_0x3e1c0e[_0xbaef('0x56')]=_0x4bb1e9;return _0x3e1c0e;})[_0xbaef('0x37')](respondWithFilteredResult(_0x392c64,_0x41c5b2))[_0xbaef('0x2b')](handleError(_0x392c64,null));};exports[_0xbaef('0x57')]=function(_0x3d1a93,_0x30a670){var _0x48bb1c={'raw':![],'where':{'id':_0x3d1a93['params']['id']},'include':[{'model':db['Pause'],'as':_0xbaef('0x3f')}]},_0x22c8b7={};_0x22c8b7[_0xbaef('0x47')]=_[_0xbaef('0x58')](db['WhatsappAccount'][_0xbaef('0x59')]);_0x22c8b7[_0xbaef('0x44')]=_[_0xbaef('0x58')](_0x3d1a93['query']);_0x22c8b7[_0xbaef('0x45')]=_[_0xbaef('0x46')](_0x22c8b7[_0xbaef('0x47')],_0x22c8b7['query']);_0x48bb1c['attributes']=_[_0xbaef('0x46')](_0x22c8b7[_0xbaef('0x47')],qs[_0xbaef('0x49')](_0x3d1a93['query']['fields']));_0x48bb1c[_0xbaef('0x48')]=_0x48bb1c[_0xbaef('0x48')][_0xbaef('0x4a')]?_0x48bb1c['attributes']:_0x22c8b7[_0xbaef('0x47')];if(_0x3d1a93[_0xbaef('0x44')][_0xbaef('0x53')]){_0x48bb1c[_0xbaef('0x54')]=[{'all':!![]}];}_0x48bb1c=_['merge']({},_0x48bb1c,_0x3d1a93['options']);return db['WhatsappAccount'][_0xbaef('0x5a')](_0x48bb1c)[_0xbaef('0x37')](handleEntityNotFound(_0x30a670,null))[_0xbaef('0x37')](respondWithResult(_0x30a670,null))[_0xbaef('0x2b')](handleError(_0x30a670,null));};exports['create']=function(_0x5b67d4,_0xfb9fee){return db['WhatsappAccount'][_0xbaef('0x5b')](_0x5b67d4[_0xbaef('0x5c')],{})[_0xbaef('0x37')](function(_0x536f83){var _0x4ec083=_0x5b67d4[_0xbaef('0x5d')][_0xbaef('0x39')]({'plain':!![]});if(!_0x4ec083)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec083['role']===_0xbaef('0x5d')){var _0x5ae455=_0x536f83[_0xbaef('0x39')]({'plain':!![]});var _0x507ff9='WhatsappAccounts';return db['UserProfileSection'][_0xbaef('0x5a')]({'where':{'name':_0x507ff9,'userProfileId':_0x4ec083['userProfileId']},'raw':!![]})['then'](function(_0x4cc2ce){if(_0x4cc2ce&&_0x4cc2ce[_0xbaef('0x5e')]===0x0){return db['UserProfileResource'][_0xbaef('0x5b')]({'name':_0x5ae455[_0xbaef('0x3c')],'resourceId':_0x5ae455['id'],'type':_0x4cc2ce[_0xbaef('0x3c')],'sectionId':_0x4cc2ce['id']},{})[_0xbaef('0x37')](function(){return _0x536f83;});}else{return _0x536f83;}})[_0xbaef('0x2b')](function(_0x403bfa){logger[_0xbaef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x403bfa);throw _0x403bfa;});}return _0x536f83;})[_0xbaef('0x37')](respondWithResult(_0xfb9fee,0xc9))['catch'](handleError(_0xfb9fee,null));};exports[_0xbaef('0x5f')]=function(_0x3ebcc9,_0x330b97){if(_0x3ebcc9[_0xbaef('0x5c')]['id']){delete _0x3ebcc9[_0xbaef('0x5c')]['id'];}return db['WhatsappAccount'][_0xbaef('0x5a')]({'where':{'id':_0x3ebcc9[_0xbaef('0x60')]['id']},'include':[{'model':db[_0xbaef('0x3e')],'as':_0xbaef('0x3f')}]})[_0xbaef('0x37')](handleEntityNotFound(_0x330b97,null))[_0xbaef('0x37')](saveUpdates(_0x3ebcc9[_0xbaef('0x5c')],null))[_0xbaef('0x37')](respondWithResult(_0x330b97,null))[_0xbaef('0x2b')](handleError(_0x330b97,null));};exports[_0xbaef('0x38')]=function(_0x17ccc1,_0xd74444){return db['WhatsappAccount'][_0xbaef('0x5a')]({'where':{'id':_0x17ccc1[_0xbaef('0x60')]['id']}})[_0xbaef('0x37')](handleEntityNotFound(_0xd74444,null))['then'](removeEntity(_0xd74444,null))[_0xbaef('0x2b')](handleError(_0xd74444,null));};exports[_0xbaef('0x61')]=function(_0x5cf366,_0x3a0987){return db[_0xbaef('0x41')][_0xbaef('0x61')]()[_0xbaef('0x37')](respondWithResult(_0x3a0987,null))['catch'](handleError(_0x3a0987,null));};exports[_0xbaef('0x62')]=function(_0x3016a1,_0x16e3e2,_0x56af72){if(_0x3016a1[_0xbaef('0x5c')]['id']){delete _0x3016a1[_0xbaef('0x5c')]['id'];}return db[_0xbaef('0x41')][_0xbaef('0x5a')]({'where':{'id':_0x3016a1['params']['id']}})['then'](handleEntityNotFound(_0x16e3e2,null))[_0xbaef('0x37')](function(_0x5dd39c){if(_0x5dd39c){_0x3016a1[_0xbaef('0x5c')][_0xbaef('0x63')]=_0x5dd39c['id'];return db[_0xbaef('0x64')]['create'](_0x3016a1[_0xbaef('0x5c')]);}})[_0xbaef('0x37')](respondWithResult(_0x16e3e2,null))['catch'](handleError(_0x16e3e2,null));};exports[_0xbaef('0x65')]=function(_0x46a253,_0x49acbb,_0x2461f7){var _0x490378={'raw':![],'where':{}};var _0x1ff18f={};var _0x7b5c98={'count':0x0,'rows':[]};return db[_0xbaef('0x41')][_0xbaef('0x66')]({'where':{'id':_0x46a253[_0xbaef('0x60')]['id']}})[_0xbaef('0x37')](handleEntityNotFound(_0x49acbb,null))[_0xbaef('0x37')](function(_0x2a7cc0){if(_0x2a7cc0){_0x1ff18f[_0xbaef('0x47')]=_[_0xbaef('0x58')](db[_0xbaef('0x64')]['rawAttributes']);_0x1ff18f[_0xbaef('0x44')]=_[_0xbaef('0x58')](_0x46a253[_0xbaef('0x44')]);_0x1ff18f['filters']=_[_0xbaef('0x46')](_0x1ff18f['model'],_0x1ff18f['query']);_0x490378[_0xbaef('0x48')]=_[_0xbaef('0x46')](_0x1ff18f[_0xbaef('0x47')],qs['fields'](_0x46a253[_0xbaef('0x44')]['fields']));_0x490378[_0xbaef('0x48')]=_0x490378[_0xbaef('0x48')][_0xbaef('0x4a')]?_0x490378['attributes']:_0x1ff18f[_0xbaef('0x47')];if(!_0x46a253[_0xbaef('0x44')][_0xbaef('0x4b')](_0xbaef('0x4c'))){_0x490378[_0xbaef('0x30')]=qs[_0xbaef('0x30')](_0x46a253[_0xbaef('0x44')][_0xbaef('0x30')]);_0x490378[_0xbaef('0x31')]=qs[_0xbaef('0x31')](_0x46a253[_0xbaef('0x44')][_0xbaef('0x31')]);}_0x490378['order']=qs[_0xbaef('0x67')](_0x46a253[_0xbaef('0x44')][_0xbaef('0x67')]);_0x490378[_0xbaef('0x4d')]=qs[_0xbaef('0x45')](_[_0xbaef('0x4e')](_0x46a253[_0xbaef('0x44')],_0x1ff18f[_0xbaef('0x45')]));_0x490378[_0xbaef('0x4d')]['WhatsappAccountId']=_0x2a7cc0['id'];if(_0x46a253['query'][_0xbaef('0x4f')]){_0x490378['where']=_[_0xbaef('0x50')](_0x490378[_0xbaef('0x4d')],{'$or':_[_0xbaef('0x40')](_0x490378[_0xbaef('0x48')],function(_0x491778){var _0x5df22e={};_0x5df22e[_0x491778]={'$like':'%'+_0x46a253[_0xbaef('0x44')][_0xbaef('0x4f')]+'%'};return _0x5df22e;})});}_0x490378=_[_0xbaef('0x50')]({},_0x490378,_0x46a253[_0xbaef('0x51')]);return db[_0xbaef('0x64')][_0xbaef('0x52')]({'where':_0x490378[_0xbaef('0x4d')]})[_0xbaef('0x37')](function(_0x56d073){_0x7b5c98['count']=_0x56d073;if(_0x46a253[_0xbaef('0x44')][_0xbaef('0x53')]){_0x490378[_0xbaef('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xbaef('0x55')](_0x490378);})[_0xbaef('0x37')](function(_0x2b4de7){_0x7b5c98[_0xbaef('0x56')]=_0x2b4de7;return _0x7b5c98;});}})[_0xbaef('0x37')](respondWithFilteredResult(_0x49acbb,_0x490378))[_0xbaef('0x2b')](handleError(_0x49acbb,null));};exports[_0xbaef('0x68')]=function(_0x28fa49,_0x4741ea,_0x29a90d){return db['WhatsappAccount']['find']({'where':{'id':_0x28fa49['params']['id']}})[_0xbaef('0x37')](handleEntityNotFound(_0x4741ea,null))['then'](function(_0x37dba5){if(_0x37dba5){return _0x37dba5[_0xbaef('0x68')](_0x28fa49['query']['ids']);}})[_0xbaef('0x37')](respondWithStatusCode(_0x4741ea,null))[_0xbaef('0x2b')](handleError(_0x4741ea,null));};exports[_0xbaef('0x69')]=function(_0x9bbf3f,_0x2723c0,_0x5ca454){if(_0x9bbf3f[_0xbaef('0x5c')]['id']){delete _0x9bbf3f[_0xbaef('0x5c')]['id'];}return db[_0xbaef('0x41')]['find']({'where':{'id':_0x9bbf3f['params']['id']}})[_0xbaef('0x37')](handleEntityNotFound(_0x2723c0,null))[_0xbaef('0x37')](function(_0x5de6ba){if(_0x5de6ba){_0x9bbf3f['body'][_0xbaef('0x63')]=_0x5de6ba['id'];return db[_0xbaef('0x6a')][_0xbaef('0x5b')](_0x9bbf3f[_0xbaef('0x5c')]);}})[_0xbaef('0x37')](respondWithResult(_0x2723c0,null))[_0xbaef('0x2b')](handleError(_0x2723c0,null));};exports[_0xbaef('0x6b')]=function(_0x466612,_0x5d5b3f,_0x5ec953){var _0x170e46={'raw':![],'where':{}};var _0x5b22c9={};var _0x24a677={'count':0x0,'rows':[]};return db[_0xbaef('0x41')][_0xbaef('0x66')]({'where':{'id':_0x466612[_0xbaef('0x60')]['id']}})[_0xbaef('0x37')](handleEntityNotFound(_0x5d5b3f,null))[_0xbaef('0x37')](function(_0x53344a){if(_0x53344a){_0x5b22c9[_0xbaef('0x47')]=_['keys'](db[_0xbaef('0x6a')][_0xbaef('0x59')]);_0x5b22c9[_0xbaef('0x44')]=_['keys'](_0x466612[_0xbaef('0x44')]);_0x5b22c9[_0xbaef('0x45')]=_[_0xbaef('0x46')](_0x5b22c9['model'],_0x5b22c9[_0xbaef('0x44')]);_0x170e46['attributes']=_[_0xbaef('0x46')](_0x5b22c9[_0xbaef('0x47')],qs[_0xbaef('0x49')](_0x466612['query'][_0xbaef('0x49')]));_0x170e46[_0xbaef('0x48')]=_0x170e46[_0xbaef('0x48')][_0xbaef('0x4a')]?_0x170e46[_0xbaef('0x48')]:_0x5b22c9[_0xbaef('0x47')];if(!_0x466612[_0xbaef('0x44')]['hasOwnProperty']('nolimit')){_0x170e46[_0xbaef('0x30')]=qs['limit'](_0x466612[_0xbaef('0x44')][_0xbaef('0x30')]);_0x170e46[_0xbaef('0x31')]=qs[_0xbaef('0x31')](_0x466612[_0xbaef('0x44')][_0xbaef('0x31')]);}_0x170e46[_0xbaef('0x6c')]=qs[_0xbaef('0x67')](_0x466612['query']['sort']);_0x170e46[_0xbaef('0x4d')]=qs[_0xbaef('0x45')](_[_0xbaef('0x4e')](_0x466612[_0xbaef('0x44')],_0x5b22c9[_0xbaef('0x45')]));_0x170e46[_0xbaef('0x4d')][_0xbaef('0x63')]=_0x53344a['id'];if(_0x466612['query'][_0xbaef('0x4f')]){_0x170e46[_0xbaef('0x4d')]=_['merge'](_0x170e46['where'],{'$or':_[_0xbaef('0x40')](_0x170e46['attributes'],function(_0x550d55){var _0x1dea7d={};_0x1dea7d[_0x550d55]={'$like':'%'+_0x466612[_0xbaef('0x44')][_0xbaef('0x4f')]+'%'};return _0x1dea7d;})});}_0x170e46=_[_0xbaef('0x50')]({},_0x170e46,_0x466612[_0xbaef('0x51')]);return db[_0xbaef('0x6a')][_0xbaef('0x52')]({'where':_0x170e46['where']})[_0xbaef('0x37')](function(_0x4a7685){_0x24a677['count']=_0x4a7685;if(_0x466612[_0xbaef('0x44')]['includeAll']){_0x170e46[_0xbaef('0x54')]=[{'all':!![]}];}return db[_0xbaef('0x6a')][_0xbaef('0x55')](_0x170e46);})['then'](function(_0x1036ba){_0x24a677[_0xbaef('0x56')]=_0x1036ba;return _0x24a677;});}})[_0xbaef('0x37')](respondWithFilteredResult(_0x5d5b3f,_0x170e46))[_0xbaef('0x2b')](handleError(_0x5d5b3f,null));};exports[_0xbaef('0x6d')]=function(_0x5bce37,_0x3f67f3,_0x170b1e){return db[_0xbaef('0x41')][_0xbaef('0x5a')]({'where':{'id':_0x5bce37[_0xbaef('0x60')]['id']}})['then'](handleEntityNotFound(_0x3f67f3,null))[_0xbaef('0x37')](function(_0x9a519){if(_0x9a519){return _0x9a519[_0xbaef('0x6d')](_0x5bce37['query'][_0xbaef('0x6e')]);}})[_0xbaef('0x37')](respondWithStatusCode(_0x3f67f3,null))[_0xbaef('0x2b')](handleError(_0x3f67f3,null));};exports['addAgents']=function(_0x1584f3,_0x4bc1c4,_0x59a792){return db['WhatsappAccount'][_0xbaef('0x5a')]({'where':{'id':_0x1584f3[_0xbaef('0x60')]['id']}})['then'](handleEntityNotFound(_0x4bc1c4,null))[_0xbaef('0x37')](function(_0x3658ba){if(_0x3658ba){return _0x3658ba[_0xbaef('0x6f')](_0x1584f3[_0xbaef('0x5c')][_0xbaef('0x6e')],_[_0xbaef('0x70')](_0x1584f3[_0xbaef('0x5c')],[_0xbaef('0x6e'),'id'])||{})[_0xbaef('0x71')](function(_0xe273c2){for(var _0x3bf109=0x0;_0x3bf109<_0x1584f3['body'][_0xbaef('0x6e')][_0xbaef('0x4a')];_0x3bf109+=0x1){socket[_0xbaef('0x72')](_0xbaef('0x73'),{'UserId':Number(_0x1584f3[_0xbaef('0x5c')][_0xbaef('0x6e')][_0x3bf109]),'WhatsappAccountId':Number(_0x1584f3[_0xbaef('0x60')]['id'])});}return _0xe273c2;});}})['then'](respondWithResult(_0x4bc1c4,null))[_0xbaef('0x2b')](handleError(_0x4bc1c4,null));};exports[_0xbaef('0x74')]=function(_0x1c9653,_0x30b308,_0x1a0302){return db[_0xbaef('0x41')][_0xbaef('0x5a')]({'where':{'id':_0x1c9653['params']['id']}})[_0xbaef('0x37')](handleEntityNotFound(_0x30b308,null))['then'](function(_0x2d7e26){if(_0x2d7e26){return _0x2d7e26['removeAgents'](_0x1c9653[_0xbaef('0x44')][_0xbaef('0x6e')])['then'](function(){if(_[_0xbaef('0x75')](_0x1c9653[_0xbaef('0x44')][_0xbaef('0x6e')])){for(var _0x355269=0x0;_0x355269<_0x1c9653[_0xbaef('0x44')]['ids'][_0xbaef('0x4a')];_0x355269+=0x1){socket[_0xbaef('0x72')](_0xbaef('0x76'),{'UserId':Number(_0x1c9653[_0xbaef('0x44')][_0xbaef('0x6e')][_0x355269]),'WhatsappAccountId':Number(_0x1c9653[_0xbaef('0x60')]['id'])});}}else{socket[_0xbaef('0x72')](_0xbaef('0x76'),{'UserId':Number(_0x1c9653['query'][_0xbaef('0x6e')]),'WhatsappAccountId':Number(_0x1c9653[_0xbaef('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x30b308,null))[_0xbaef('0x2b')](handleError(_0x30b308,null));};exports['getAgents']=function(_0x1d6d18,_0x559831,_0xd275ff){var _0x3fd5f9={};var _0x2f5794={};var _0x554f2d;var _0x3ea4af;return db[_0xbaef('0x41')][_0xbaef('0x66')]({'where':{'id':_0x1d6d18[_0xbaef('0x60')]['id']}})[_0xbaef('0x37')](handleEntityNotFound(_0x559831,null))[_0xbaef('0x37')](function(_0x3c5c0a){if(_0x3c5c0a){_0x554f2d=_0x3c5c0a;_0x2f5794[_0xbaef('0x47')]=_[_0xbaef('0x58')](db['User']['rawAttributes']);_0x2f5794[_0xbaef('0x44')]=_[_0xbaef('0x58')](_0x1d6d18['query']);_0x2f5794[_0xbaef('0x45')]=_[_0xbaef('0x46')](_0x2f5794['model'],_0x2f5794[_0xbaef('0x44')]);_0x3fd5f9[_0xbaef('0x48')]=_[_0xbaef('0x46')](_0x2f5794[_0xbaef('0x47')],qs[_0xbaef('0x49')](_0x1d6d18[_0xbaef('0x44')][_0xbaef('0x49')]));_0x3fd5f9[_0xbaef('0x48')]=_0x3fd5f9[_0xbaef('0x48')][_0xbaef('0x4a')]?_0x3fd5f9[_0xbaef('0x48')]:_0x2f5794[_0xbaef('0x47')];_0x3fd5f9[_0xbaef('0x6c')]=qs[_0xbaef('0x67')](_0x1d6d18[_0xbaef('0x44')][_0xbaef('0x67')]);_0x3fd5f9[_0xbaef('0x4d')]=qs[_0xbaef('0x45')](_[_0xbaef('0x4e')](_0x1d6d18[_0xbaef('0x44')],_0x2f5794[_0xbaef('0x45')]));if(_0x1d6d18['query'][_0xbaef('0x4f')]){_0x3fd5f9[_0xbaef('0x4d')]=_['merge'](_0x3fd5f9[_0xbaef('0x4d')],{'$or':_[_0xbaef('0x40')](_0x3fd5f9[_0xbaef('0x48')],function(_0x5665bb){var _0x2d331e={};_0x2d331e[_0x5665bb]={'$like':'%'+_0x1d6d18[_0xbaef('0x44')]['filter']+'%'};return _0x2d331e;})});}_0x3fd5f9=_[_0xbaef('0x50')]({},_0x3fd5f9,_0x1d6d18[_0xbaef('0x51')]);return _0x554f2d[_0xbaef('0x77')](_0x3fd5f9);}})[_0xbaef('0x37')](function(_0x168ca2){if(_0x168ca2){_0x3ea4af=_0x168ca2[_0xbaef('0x4a')];if(!_0x1d6d18[_0xbaef('0x44')][_0xbaef('0x4b')](_0xbaef('0x4c'))){_0x3fd5f9['limit']=qs['limit'](_0x1d6d18[_0xbaef('0x44')][_0xbaef('0x30')]);_0x3fd5f9['offset']=qs[_0xbaef('0x31')](_0x1d6d18[_0xbaef('0x44')][_0xbaef('0x31')]);}return _0x554f2d[_0xbaef('0x77')](_0x3fd5f9);}})[_0xbaef('0x37')](function(_0x30f012){if(_0x30f012){return _0x30f012?{'count':_0x3ea4af,'rows':_0x30f012}:null;}})[_0xbaef('0x37')](respondWithResult(_0x559831,null))[_0xbaef('0x2b')](handleError(_0x559831,null));};exports[_0xbaef('0x78')]=function(_0x2c69d6,_0x6cb82,_0x3eb118){return db['WhatsappAccount'][_0xbaef('0x66')]({'where':{'id':_0x2c69d6[_0xbaef('0x60')]['id']}})['then'](handleEntityNotFound(_0x6cb82,null))[_0xbaef('0x37')](function(_0x5bd978){if(_0x5bd978){return db[_0xbaef('0x79')][_0xbaef('0x7a')](function(_0x977240){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x2c69d6[_0xbaef('0x60')]['id']},'transaction':_0x977240})[_0xbaef('0x37')](function(_0x1ceaf1){var _0x924826=_[_0xbaef('0x40')](_0x2c69d6[_0xbaef('0x5c')],function(_0x172d69){_0x172d69[_0xbaef('0x63')]=_0x2c69d6[_0xbaef('0x60')]['id'];return _0x172d69;});return db[_0xbaef('0x7b')]['bulkCreate'](_0x924826,{'transaction':_0x977240});});})[_0xbaef('0x37')](function(){return db['WhatsappApplication'][_0xbaef('0x7c')]({'where':{'WhatsappAccountId':_0x2c69d6['params']['id']},'order':'priority'});});}})[_0xbaef('0x37')](respondWithResult(_0x6cb82,null))[_0xbaef('0x2b')](handleError(_0x6cb82,null));};exports[_0xbaef('0x7d')]=function(_0x4efef7,_0x27f656,_0x418258){var _0x4a47db={};var _0x17dd09={};var _0x20e27a;var _0x5a6022;return db['WhatsappAccount'][_0xbaef('0x66')]({'where':{'id':_0x4efef7['params']['id']}})[_0xbaef('0x37')](handleEntityNotFound(_0x27f656,null))[_0xbaef('0x37')](function(_0x24dcd3){if(_0x24dcd3){_0x20e27a=_0x24dcd3;_0x17dd09[_0xbaef('0x47')]=_['keys'](db[_0xbaef('0x7b')]['rawAttributes']);_0x17dd09[_0xbaef('0x44')]=_['keys'](_0x4efef7[_0xbaef('0x44')]);_0x17dd09[_0xbaef('0x45')]=_['intersection'](_0x17dd09[_0xbaef('0x47')],_0x17dd09[_0xbaef('0x44')]);_0x4a47db[_0xbaef('0x48')]=_['intersection'](_0x17dd09['model'],qs['fields'](_0x4efef7[_0xbaef('0x44')][_0xbaef('0x49')]));_0x4a47db[_0xbaef('0x48')]=_0x4a47db[_0xbaef('0x48')][_0xbaef('0x4a')]?_0x4a47db[_0xbaef('0x48')]:_0x17dd09['model'];_0x4a47db[_0xbaef('0x6c')]=qs['sort'](_0x4efef7[_0xbaef('0x44')][_0xbaef('0x67')]);_0x4a47db[_0xbaef('0x4d')]=qs['filters'](_[_0xbaef('0x4e')](_0x4efef7[_0xbaef('0x44')],_0x17dd09[_0xbaef('0x45')]));if(_0x4efef7[_0xbaef('0x44')]['filter']){_0x4a47db[_0xbaef('0x4d')]=_[_0xbaef('0x50')](_0x4a47db[_0xbaef('0x4d')],{'$or':_[_0xbaef('0x40')](_0x4a47db['attributes'],function(_0x3165d6){var _0x484a5d={};_0x484a5d[_0x3165d6]={'$like':'%'+_0x4efef7['query'][_0xbaef('0x4f')]+'%'};return _0x484a5d;})});}_0x4a47db=_[_0xbaef('0x50')]({},_0x4a47db,_0x4efef7['options']);return _0x20e27a[_0xbaef('0x7d')](_0x4a47db);}})[_0xbaef('0x37')](function(_0x5847c0){if(_0x5847c0){_0x5a6022=_0x5847c0[_0xbaef('0x4a')];if(!_0x4efef7[_0xbaef('0x44')]['hasOwnProperty'](_0xbaef('0x4c'))){_0x4a47db['limit']=qs['limit'](_0x4efef7[_0xbaef('0x44')]['limit']);_0x4a47db[_0xbaef('0x31')]=qs['offset'](_0x4efef7[_0xbaef('0x44')][_0xbaef('0x31')]);}return _0x20e27a[_0xbaef('0x7d')](_0x4a47db);}})[_0xbaef('0x37')](function(_0x4f1536){if(_0x4f1536){return _0x4f1536?{'count':_0x5a6022,'rows':_0x4f1536}:null;}})[_0xbaef('0x37')](respondWithResult(_0x27f656,null))['catch'](handleError(_0x27f656,null));};exports[_0xbaef('0x7e')]=function(_0x80f8db,_0x24637f,_0x4215a4){var _0x2ab013={'channel':_0xbaef('0x7f')};var _0x170f53=[];var _0x507445=[];var _0x298fc7={};return db[_0xbaef('0x41')][_0xbaef('0x5a')]({'where':{'id':_0x80f8db[_0xbaef('0x60')]['id']},'include':[{'model':db[_0xbaef('0x7b')],'as':'Applications'}]})[_0xbaef('0x37')](handleEntityNotFound(_0x24637f,null))['then'](function(_0x165d29){_0x2ab013[_0xbaef('0x80')]=_0x165d29;_0x2ab013[_0xbaef('0x81')]=_[_0xbaef('0x82')](_0x165d29['Applications'],[_0xbaef('0x83')],[_0xbaef('0x84')]);if(_0x2ab013['account'][_0xbaef('0x85')]){delete _0x2ab013[_0xbaef('0x80')][_0xbaef('0x85')];}return db[_0xbaef('0x86')]['describe']();})[_0xbaef('0x37')](function(_0x3026be){if(!_0x3026be){throw new db[(_0xbaef('0x87'))][(_0xbaef('0x88'))](_0xbaef('0x89'));}_0x170f53=_[_0xbaef('0x8a')](_[_0xbaef('0x58')](_0x3026be),['createdAt',_0xbaef('0x8b')]);_0x507445=_[_0xbaef('0x8a')](_[_0xbaef('0x58')](_0x3026be),[_0xbaef('0x8c'),_0xbaef('0x8b'),_0xbaef('0x8d'),_0xbaef('0x8e')]);_0x2ab013['body']={'mapKey':_0xbaef('0x8f')};if(_0x2ab013[_0xbaef('0x80')]['type']&&_0x2ab013[_0xbaef('0x80')][_0xbaef('0x42')]==='twilio'){_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x90')]=_0x80f8db[_0xbaef('0x5c')]['From'][_0xbaef('0x91')](_0xbaef('0x92'),'');_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x5c')]=_0x80f8db[_0xbaef('0x5c')][_0xbaef('0x93')];_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x94')]=_0x80f8db[_0xbaef('0x5c')][_0xbaef('0x95')];}if(_0x2ab013['body']['id']){delete _0x2ab013[_0xbaef('0x5c')]['id'];}if(_[_0xbaef('0x96')](_0x2ab013['body'][_0xbaef('0x90')])){throw new db[(_0xbaef('0x87'))][(_0xbaef('0x88'))](_0xbaef('0x97'));}if(_['isNil'](_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x5c')])||_0x2ab013[_0xbaef('0x5c')]['body']===''){throw new db[(_0xbaef('0x87'))]['ValidationError'](_0xbaef('0x98'));}if(_[_0xbaef('0x96')](_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x99')])){throw new db['Sequelize'][(_0xbaef('0x88'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x507445);}if(!_['includes'](_0x507445,_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x99')])){throw new db[(_0xbaef('0x87'))]['ValidationError'](_0xbaef('0x9a')+_0x507445);}_0x298fc7[_0x2ab013[_0xbaef('0x5c')]['mapKey']]=_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x90')];return db[_0xbaef('0x9b')]['find']({'where':{'id':_0x2ab013[_0xbaef('0x80')][_0xbaef('0x8e')]},'include':[{'model':db[_0xbaef('0x86')],'as':_0xbaef('0x9c'),'where':_0x298fc7,'limit':0x1,'order':[[_0xbaef('0x8b'),_0xbaef('0x9d')]]}]});})[_0xbaef('0x37')](handleEntityNotFound(_0x24637f,null))[_0xbaef('0x37')](function(_0xb1f257){if(_0xb1f257){_0x2ab013['list']=_[_0xbaef('0x70')](_0xb1f257,[_0xbaef('0x9c')]);if(_0xb1f257[_0xbaef('0x9c')][_0xbaef('0x4a')]){return _0xb1f257['Contacts'][0x0];}var _0x5836d2=_['defaults'](_0x2ab013[_0xbaef('0x5c')],{'firstName':_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x90')],'ListId':_0xb1f257['id']});_0x5836d2[_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x99')]]=_0x2ab013['body'][_0xbaef('0x90')];return db[_0xbaef('0x86')][_0xbaef('0x5b')](_0x5836d2,{'fields':_0x170f53,'raw':!![]});}})[_0xbaef('0x37')](handleEntityNotFound(_0x24637f,null))[_0xbaef('0x37')](function(_0x58018a){if(_0x58018a){_0x2ab013[_0xbaef('0x9e')]=_0x58018a;var _0x29c5df={'ContactId':_0x58018a['id'],'phone':_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x90')],'WhatsappAccountId':_0x80f8db[_0xbaef('0x60')]['id']};var _0x196cee={'ContactId':_0x58018a['id'],'WhatsappAccountId':_0x80f8db[_0xbaef('0x60')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xbaef('0x5a')]({'where':_0x196cee})[_0xbaef('0x37')](function(_0x826ed8){if(_0x826ed8){return[_0x826ed8,![]];}return db[_0xbaef('0x9f')]['create'](_0x29c5df)[_0xbaef('0x37')](function(_0x24f903){return[_0x24f903,!![]];});});}})[_0xbaef('0x71')](function(_0x49caa6,_0x1c931c){_0x2ab013[_0xbaef('0xa0')]=_0x49caa6[_0xbaef('0x39')]({'plain':!![]});_0x2ab013[_0xbaef('0xa0')][_0xbaef('0xa1')]=![];if(_0x1c931c){if(_0x2ab013[_0xbaef('0x80')][_0xbaef('0xa2')]){_0x2ab013[_0xbaef('0x81')][_0xbaef('0xa3')]({'id':0x0,'priority':_0x2ab013[_0xbaef('0x81')][_0xbaef('0x4a')]+0x1,'app':_0xbaef('0xa4'),'appdata':_0xbaef('0xa5'),'interval':_0xbaef('0xa6')});}_0x2ab013['interaction'][_0xbaef('0xa1')]=!![];}return db[_0xbaef('0xa7')][_0xbaef('0x5b')]({'phone':_0x2ab013[_0xbaef('0x5c')]['from'],'messageId':_0x2ab013[_0xbaef('0x5c')][_0xbaef('0x94')],'body':_0x2ab013['body'][_0xbaef('0x5c')],'WhatsappAccountId':_0x80f8db['params']['id'],'WhatsappInteractionId':_0x49caa6['id'],'direction':'in','ContactId':_0x49caa6[_0xbaef('0xa8')],'AttachmentId':_0x2ab013[_0xbaef('0x5c')][_0xbaef('0xa9')]});})['then'](function(_0x98b53){_0x2ab013[_0xbaef('0x29')]=_0x98b53;if(_0x2ab013['interaction']['UserId']){return db[_0xbaef('0xaa')][_0xbaef('0x5a')]({'attributes':['id',_0xbaef('0x3c')],'where':{'id':_0x2ab013[_0xbaef('0xa0')][_0xbaef('0xab')]}})[_0xbaef('0x37')](function(_0x46175a){if(_0x46175a){_0x2ab013[_0xbaef('0x81')][_0xbaef('0xac')]({'id':0x0,'priority':0x0,'app':_0xbaef('0xad'),'appdata':_0x46175a[_0xbaef('0x3c')]+','+(_0x2ab013[_0xbaef('0x80')][_0xbaef('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xbaef('0xaf'),_0xbaef('0xb0'),_0x2ab013);});}return respondWithRpcPromise(_0xbaef('0xaf'),'startRouting',_0x2ab013);})['then'](function(_0xceb11c){if(_0xceb11c){var _0x10bb91=0xc8;var _0x1bc72e=_0xbaef('0xb1');logger[_0xbaef('0x23')](_0xbaef('0x26'),_0x1bc72e,_0x10bb91,_0xbaef('0xb2'));logger[_0xbaef('0xb3')](_0xbaef('0xb4'),_0x1bc72e,_0x10bb91,_0xbaef('0xb2'),JSON[_0xbaef('0x27')](_0xceb11c));if(_0x2ab013[_0xbaef('0x80')][_0xbaef('0x42')]===_0xbaef('0xb5')){return _0x24637f[_0xbaef('0x2d')](_0x10bb91)[_0xbaef('0x32')](_0xbaef('0xb6'),_0xbaef('0xb7'))[_0xbaef('0xb8')]('\x0a');}else{return _0x24637f[_0xbaef('0x2d')](_0x10bb91)[_0xbaef('0x34')](_0xceb11c);}}})[_0xbaef('0x2b')](handleError(_0x24637f,null));};exports['send']=function(_0x4c1e59,_0x27fa29,_0x1e1996){var _0x38efb2,_0x52c7ef,_0x3605ec;if(_[_0xbaef('0x96')](_0x4c1e59[_0xbaef('0x5c')][_0xbaef('0x5c')])||_0x4c1e59['body']['body']===''){throw new db[(_0xbaef('0x87'))][(_0xbaef('0x88'))](_0xbaef('0x98'));}if(_[_0xbaef('0x96')](_0x4c1e59[_0xbaef('0x5c')]['to'])){throw new db[(_0xbaef('0x87'))][(_0xbaef('0x88'))](_0xbaef('0xb9'));}_0x38efb2=_0x4c1e59[_0xbaef('0x5c')]['to'];return db[_0xbaef('0x41')][_0xbaef('0x5a')]({'where':{'id':_0x4c1e59[_0xbaef('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0xbaef('0xba'),'include':[{'model':db[_0xbaef('0x86')],'as':_0xbaef('0x9c'),'where':{'mobile':_0x38efb2},'limit':0x1,'order':[[_0xbaef('0x8b'),_0xbaef('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x27fa29,null))[_0xbaef('0x37')](function(_0x1bea9d){if(_0x1bea9d&&_0x1bea9d['List']){_0x52c7ef=_0x1bea9d[_0xbaef('0x39')]({'plain':!![]});if(_0x52c7ef[_0xbaef('0xba')]&&_0x52c7ef[_0xbaef('0xba')][_0xbaef('0x9c')][_0xbaef('0x4a')]){return _0x52c7ef[_0xbaef('0xba')][_0xbaef('0x9c')][0x0];}return db['CmContact'][_0xbaef('0x5b')](_[_0xbaef('0x1c')](_0x4c1e59['body'],{'firstName':_0x38efb2,'mobile':_0x38efb2,'phone':_0x38efb2,'ListId':_0x52c7ef[_0xbaef('0x8e')]}));}})[_0xbaef('0x37')](handleEntityNotFound(_0x27fa29,null))['then'](function(_0x140902){if(_0x140902){_0x3605ec=_0x140902;return db[_0xbaef('0x9f')][_0xbaef('0x5a')]({'where':{'ContactId':_0x3605ec['id'],'closed':![],'WhatsappAccountId':_0x52c7ef['id']}})['then'](function(_0xfdd43c){if(_0xfdd43c){return[_0xfdd43c,![]];}return db[_0xbaef('0x9f')][_0xbaef('0x5b')]({'UserId':_0x4c1e59[_0xbaef('0x5d')]['id'],'ContactId':_0x3605ec['id'],'WhatsappAccountId':_0x52c7ef['id'],'phone':_0x38efb2,'firstMsgDirection':_0xbaef('0xbb'),'Messages':[_[_0xbaef('0x50')](_0x4c1e59[_0xbaef('0x5c')],{'read':![],'body':_0x4c1e59[_0xbaef('0x5c')][_0xbaef('0x5c')],'phone':_0x38efb2,'WhatsappAccountId':_0x52c7ef['id'],'UserId':_0x4c1e59['user']['id'],'ContactId':_0x3605ec['id']})]},{'include':[{'model':db[_0xbaef('0xa7')],'as':_0xbaef('0xbc')}]})[_0xbaef('0x37')](function(_0x1ea154){return[_0x1ea154,!![]];});});}})[_0xbaef('0x71')](function(_0x19ac98,_0x16e2e5){if(_0x16e2e5){return _0x19ac98;}return db['WhatsappMessage'][_0xbaef('0x5b')](_[_0xbaef('0x50')](_0x4c1e59[_0xbaef('0x5c')],{'read':![],'body':_0x4c1e59[_0xbaef('0x5c')][_0xbaef('0x5c')],'phone':_0x38efb2,'WhatsappAccountId':_0x52c7ef['id'],'WhatsappInteractionId':_0x19ac98['id'],'UserId':_0x4c1e59[_0xbaef('0x5d')]['id'],'ContactId':_0x3605ec['id']}))[_0xbaef('0x37')](function(_0x5c8612){_0x19ac98[_0xbaef('0xbd')]['Messages']=[];_0x19ac98['dataValues'][_0xbaef('0xbc')]['push'](_0x5c8612['dataValues']);return _0x19ac98;});})['then'](respondWithResult(_0x27fa29,null))['catch'](handleError(_0x27fa29,null));}; \ No newline at end of file +var _0x654d=['WhatsappAccounts','stack','name','send','index','Pause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','getAgents','User','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','whatsapp:','Body','messageId','MessageSid','isNil','Sequelize','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','Contacts','DESC','list','CmContact','WhatsappInteraction','interaction','created','push','close','unmanaged','WhatsappMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','user','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','get'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0x654d,0x80));var _0xd654=function(_0x4cab31,_0xf719a2){_0x4cab31=_0x4cab31-0x0;var _0x236639=_0x654d[_0x4cab31];return _0x236639;};'use strict';var emlformat=require(_0xd654('0x0'));var rimraf=require(_0xd654('0x1'));var zipdir=require(_0xd654('0x2'));var jsonpatch=require(_0xd654('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd654('0x4'));var Mustache=require(_0xd654('0x5'));var util=require(_0xd654('0x6'));var path=require(_0xd654('0x7'));var sox=require(_0xd654('0x8'));var csv=require('to-csv');var ejs=require(_0xd654('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd654('0xa'));var squel=require(_0xd654('0xb'));var crypto=require(_0xd654('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd654('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd654('0xe'));var Redis=require('ioredis');var authService=require(_0xd654('0xf'));var qs=require(_0xd654('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd654('0x11'));var logger=require('../../config/logger')(_0xd654('0x12'));var utils=require('../../config/utils');var config=require(_0xd654('0x13'));var licenseUtil=require(_0xd654('0x14'));var db=require(_0xd654('0x15'))['db'];config['redis']=_[_0xd654('0x16')](config[_0xd654('0x17')],{'host':_0xd654('0x18'),'port':0x18eb});var socket=require(_0xd654('0x19'))(new Redis(config[_0xd654('0x17')]));require(_0xd654('0x1a'))['register'](socket);var jayson=require(_0xd654('0x1b'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x512a89,_0x1e4aaa,_0x34d033,_0x151b72){return new BPromise(function(_0x21f88f,_0x2387d6){var _0x3b4ff5=_0x151b72||client;return _0x3b4ff5[_0xd654('0x1c')](_0x512a89,_0x34d033)[_0xd654('0x1d')](function(_0x288c27){logger[_0xd654('0x1e')](_0xd654('0x1f'),_0x1e4aaa,_0xd654('0x20'));logger['debug'](_0xd654('0x21'),_0x1e4aaa,'request\x20sent',JSON[_0xd654('0x22')](_0x288c27));if(_0x288c27[_0xd654('0x23')]){if(_0x288c27['error'][_0xd654('0x24')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1e4aaa,_0x288c27[_0xd654('0x23')][_0xd654('0x25')]);return _0x2387d6(_0x288c27[_0xd654('0x23')][_0xd654('0x25')]);}logger[_0xd654('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x1e4aaa,_0x288c27[_0xd654('0x23')][_0xd654('0x25')]);return _0x21f88f(_0x288c27[_0xd654('0x23')][_0xd654('0x25')]);}else{logger['info'](_0xd654('0x1f'),_0x1e4aaa,_0xd654('0x20'));_0x21f88f(_0x288c27[_0xd654('0x26')]['message']);}})['catch'](function(_0x4bb2a2){logger[_0xd654('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x1e4aaa,_0x4bb2a2);_0x2387d6(_0x4bb2a2);});});}function respondWithStatusCode(_0x1a6234,_0x658b9c){_0x658b9c=_0x658b9c||0xcc;return function(_0x4a7435){if(_0x4a7435){return _0x1a6234[_0xd654('0x27')](_0x658b9c);}return _0x1a6234[_0xd654('0x28')](_0x658b9c)['end']();};}function respondWithResult(_0x275b3b,_0x45d802){_0x45d802=_0x45d802||0xc8;return function(_0x5e8974){if(_0x5e8974){return _0x275b3b['status'](_0x45d802)['json'](_0x5e8974);}};}function respondWithFilteredResult(_0x9e84e0,_0x32e7f9){return function(_0x5d9ab5){if(_0x5d9ab5){var _0x43547c=typeof _0x32e7f9[_0xd654('0x29')]===_0xd654('0x2a')&&typeof _0x32e7f9[_0xd654('0x2b')]===_0xd654('0x2a');var _0x44f085=_0x5d9ab5[_0xd654('0x2c')];var _0x3b3944=_0x43547c?0x0:_0x32e7f9[_0xd654('0x29')];var _0x466f22=_0x43547c?_0x5d9ab5[_0xd654('0x2c')]:_0x32e7f9[_0xd654('0x29')]+_0x32e7f9[_0xd654('0x2b')];var _0x38ad87;if(_0x466f22>=_0x44f085){_0x466f22=_0x44f085;_0x38ad87=0xc8;}else{_0x38ad87=0xce;}_0x9e84e0['status'](_0x38ad87);return _0x9e84e0[_0xd654('0x2d')](_0xd654('0x2e'),_0x3b3944+'-'+_0x466f22+'/'+_0x44f085)[_0xd654('0x2f')](_0x5d9ab5);}return null;};}function patchUpdates(_0x16c82a){return function(_0x355e7c){try{jsonpatch[_0xd654('0x30')](_0x355e7c,_0x16c82a,!![]);}catch(_0x219364){return BPromise['reject'](_0x219364);}return _0x355e7c[_0xd654('0x31')]();};}function saveUpdates(_0x5b9d61,_0x34a80d){return function(_0x10d77d){if(_0x10d77d){return _0x10d77d['update'](_0x5b9d61)[_0xd654('0x1d')](function(_0x1dfb4b){return _0x1dfb4b;});}return null;};}function removeEntity(_0x2018b7,_0x13045c){return function(_0x21bc5a){if(_0x21bc5a){return _0x21bc5a[_0xd654('0x32')]()['then'](function(){var _0x2d7c3e=_0x21bc5a[_0xd654('0x33')]({'plain':!![]});var _0x16f4c2=_0xd654('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x16f4c2,'resourceId':_0x2d7c3e['id']}})[_0xd654('0x1d')](function(){return _0x21bc5a;});})['then'](function(){_0x2018b7[_0xd654('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a72a,_0x439526){return function(_0x26de77){if(!_0x26de77){_0x54a72a[_0xd654('0x27')](0x194);}return _0x26de77;};}function handleError(_0x311e86,_0x5ce1f1){_0x5ce1f1=_0x5ce1f1||0x1f4;return function(_0xc304d8){logger[_0xd654('0x23')](_0xc304d8[_0xd654('0x35')]);if(_0xc304d8['name']){delete _0xc304d8[_0xd654('0x36')];}_0x311e86[_0xd654('0x28')](_0x5ce1f1)[_0xd654('0x37')](_0xc304d8);};}exports[_0xd654('0x38')]=function(_0xc9dfdd,_0x5015fa){var _0x4b2a3d={'include':[{'model':db[_0xd654('0x39')],'as':'mandatoryDispositionPause'}]},_0x231a5c={},_0x598731={'count':0x0,'rows':[]};var _0x1b7415=_['map'](db[_0xd654('0x3a')][_0xd654('0x3b')],function(_0x1f0303){return{'name':_0x1f0303[_0xd654('0x3c')],'type':_0x1f0303[_0xd654('0x3d')][_0xd654('0x3e')]};});_0x231a5c[_0xd654('0x3f')]=_[_0xd654('0x40')](_0x1b7415,_0xd654('0x36'));_0x231a5c[_0xd654('0x41')]=_[_0xd654('0x42')](_0xc9dfdd['query']);_0x231a5c[_0xd654('0x43')]=_[_0xd654('0x44')](_0x231a5c[_0xd654('0x3f')],_0x231a5c[_0xd654('0x41')]);_0x4b2a3d['attributes']=_[_0xd654('0x44')](_0x231a5c['model'],qs[_0xd654('0x45')](_0xc9dfdd[_0xd654('0x41')][_0xd654('0x45')]));_0x4b2a3d[_0xd654('0x46')]=_0x4b2a3d['attributes'][_0xd654('0x47')]?_0x4b2a3d['attributes']:_0x231a5c[_0xd654('0x3f')];if(!_0xc9dfdd['query']['hasOwnProperty']('nolimit')){_0x4b2a3d[_0xd654('0x2b')]=qs['limit'](_0xc9dfdd['query'][_0xd654('0x2b')]);_0x4b2a3d[_0xd654('0x29')]=qs[_0xd654('0x29')](_0xc9dfdd[_0xd654('0x41')][_0xd654('0x29')]);}_0x4b2a3d[_0xd654('0x48')]=qs[_0xd654('0x49')](_0xc9dfdd[_0xd654('0x41')]['sort']);_0x4b2a3d[_0xd654('0x4a')]=qs['filters'](_[_0xd654('0x4b')](_0xc9dfdd[_0xd654('0x41')],_0x231a5c[_0xd654('0x43')]),_0x1b7415);if(_0xc9dfdd[_0xd654('0x41')]['filter']){_0x4b2a3d[_0xd654('0x4a')]=_[_0xd654('0x4c')](_0x4b2a3d['where'],{'$or':_[_0xd654('0x40')](_0x1b7415,function(_0x1d0cfe){if(_0x1d0cfe[_0xd654('0x3d')]!==_0xd654('0x4d')){var _0x23d64f={};_0x23d64f[_0x1d0cfe['name']]={'$like':'%'+_0xc9dfdd['query'][_0xd654('0x4e')]+'%'};return _0x23d64f;}})});}_0x4b2a3d=_[_0xd654('0x4c')]({},_0x4b2a3d,_0xc9dfdd['options']);var _0x3e7f66={'where':_0x4b2a3d[_0xd654('0x4a')]};return db[_0xd654('0x3a')][_0xd654('0x2c')](_0x3e7f66)['then'](function(_0x26766a){_0x598731['count']=_0x26766a;if(_0xc9dfdd[_0xd654('0x41')]['includeAll']){_0x4b2a3d[_0xd654('0x4f')]=[{'all':!![]}];}return db[_0xd654('0x3a')][_0xd654('0x50')](_0x4b2a3d);})[_0xd654('0x1d')](function(_0x59d082){_0x598731[_0xd654('0x51')]=_0x59d082;return _0x598731;})['then'](respondWithFilteredResult(_0x5015fa,_0x4b2a3d))[_0xd654('0x52')](handleError(_0x5015fa,null));};exports[_0xd654('0x53')]=function(_0x13f515,_0x21231b){var _0x3e3924={'raw':![],'where':{'id':_0x13f515[_0xd654('0x54')]['id']},'include':[{'model':db[_0xd654('0x39')],'as':'mandatoryDispositionPause'}]},_0x59adba={};_0x59adba[_0xd654('0x3f')]=_[_0xd654('0x42')](db['WhatsappAccount'][_0xd654('0x3b')]);_0x59adba[_0xd654('0x41')]=_['keys'](_0x13f515[_0xd654('0x41')]);_0x59adba['filters']=_['intersection'](_0x59adba['model'],_0x59adba['query']);_0x3e3924['attributes']=_[_0xd654('0x44')](_0x59adba[_0xd654('0x3f')],qs['fields'](_0x13f515['query'][_0xd654('0x45')]));_0x3e3924['attributes']=_0x3e3924[_0xd654('0x46')][_0xd654('0x47')]?_0x3e3924[_0xd654('0x46')]:_0x59adba[_0xd654('0x3f')];if(_0x13f515[_0xd654('0x41')][_0xd654('0x55')]){_0x3e3924['include']=[{'all':!![]}];}_0x3e3924=_['merge']({},_0x3e3924,_0x13f515[_0xd654('0x56')]);return db[_0xd654('0x3a')][_0xd654('0x57')](_0x3e3924)[_0xd654('0x1d')](handleEntityNotFound(_0x21231b,null))['then'](respondWithResult(_0x21231b,null))['catch'](handleError(_0x21231b,null));};exports[_0xd654('0x58')]=function(_0x4344a6,_0x20062b){return db[_0xd654('0x3a')]['create'](_0x4344a6[_0xd654('0x59')],{})[_0xd654('0x1d')](function(_0xb5708b){var _0xf70263=_0x4344a6['user'][_0xd654('0x33')]({'plain':!![]});if(!_0xf70263)throw new Error(_0xd654('0x5a'));if(_0xf70263['role']==='user'){var _0x556e1d=_0xb5708b[_0xd654('0x33')]({'plain':!![]});var _0x1148ce='WhatsappAccounts';return db[_0xd654('0x5b')][_0xd654('0x57')]({'where':{'name':_0x1148ce,'userProfileId':_0xf70263['userProfileId']},'raw':!![]})[_0xd654('0x1d')](function(_0x47faa4){if(_0x47faa4&&_0x47faa4[_0xd654('0x5c')]===0x0){return db[_0xd654('0x5d')]['create']({'name':_0x556e1d[_0xd654('0x36')],'resourceId':_0x556e1d['id'],'type':_0x47faa4[_0xd654('0x36')],'sectionId':_0x47faa4['id']},{})[_0xd654('0x1d')](function(){return _0xb5708b;});}else{return _0xb5708b;}})[_0xd654('0x52')](function(_0x2a564c){logger['error'](_0xd654('0x5e'),_0x2a564c);throw _0x2a564c;});}return _0xb5708b;})[_0xd654('0x1d')](respondWithResult(_0x20062b,0xc9))[_0xd654('0x52')](handleError(_0x20062b,null));};exports[_0xd654('0x5f')]=function(_0x1983d9,_0x134a7d){if(_0x1983d9[_0xd654('0x59')]['id']){delete _0x1983d9[_0xd654('0x59')]['id'];}return db['WhatsappAccount'][_0xd654('0x57')]({'where':{'id':_0x1983d9[_0xd654('0x54')]['id']},'include':[{'model':db[_0xd654('0x39')],'as':_0xd654('0x60')}]})['then'](handleEntityNotFound(_0x134a7d,null))[_0xd654('0x1d')](saveUpdates(_0x1983d9[_0xd654('0x59')],null))[_0xd654('0x1d')](respondWithResult(_0x134a7d,null))[_0xd654('0x52')](handleError(_0x134a7d,null));};exports['destroy']=function(_0x5d5e93,_0x48a34b){return db[_0xd654('0x3a')][_0xd654('0x57')]({'where':{'id':_0x5d5e93[_0xd654('0x54')]['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x48a34b,null))[_0xd654('0x1d')](removeEntity(_0x48a34b,null))[_0xd654('0x52')](handleError(_0x48a34b,null));};exports[_0xd654('0x61')]=function(_0x4ddc18,_0x53d2c1){return db[_0xd654('0x3a')]['describe']()[_0xd654('0x1d')](respondWithResult(_0x53d2c1,null))[_0xd654('0x52')](handleError(_0x53d2c1,null));};exports[_0xd654('0x62')]=function(_0x504aff,_0x46fafa,_0x1bc9c4){if(_0x504aff[_0xd654('0x59')]['id']){delete _0x504aff[_0xd654('0x59')]['id'];}return db[_0xd654('0x3a')][_0xd654('0x57')]({'where':{'id':_0x504aff['params']['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x46fafa,null))['then'](function(_0x4c67a1){if(_0x4c67a1){_0x504aff[_0xd654('0x59')][_0xd654('0x63')]=_0x4c67a1['id'];return db[_0xd654('0x64')][_0xd654('0x58')](_0x504aff[_0xd654('0x59')]);}})['then'](respondWithResult(_0x46fafa,null))[_0xd654('0x52')](handleError(_0x46fafa,null));};exports[_0xd654('0x65')]=function(_0x24ff85,_0x4ce197,_0x35d4a5){var _0x4350b6={'raw':![],'where':{}};var _0x5e078b={};var _0x494770={'count':0x0,'rows':[]};return db[_0xd654('0x3a')][_0xd654('0x66')]({'where':{'id':_0x24ff85[_0xd654('0x54')]['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x4ce197,null))[_0xd654('0x1d')](function(_0x48aa55){if(_0x48aa55){_0x5e078b[_0xd654('0x3f')]=_['keys'](db['Disposition']['rawAttributes']);_0x5e078b['query']=_[_0xd654('0x42')](_0x24ff85[_0xd654('0x41')]);_0x5e078b[_0xd654('0x43')]=_[_0xd654('0x44')](_0x5e078b[_0xd654('0x3f')],_0x5e078b['query']);_0x4350b6[_0xd654('0x46')]=_['intersection'](_0x5e078b[_0xd654('0x3f')],qs[_0xd654('0x45')](_0x24ff85[_0xd654('0x41')][_0xd654('0x45')]));_0x4350b6[_0xd654('0x46')]=_0x4350b6[_0xd654('0x46')][_0xd654('0x47')]?_0x4350b6[_0xd654('0x46')]:_0x5e078b[_0xd654('0x3f')];if(!_0x24ff85['query'][_0xd654('0x67')](_0xd654('0x68'))){_0x4350b6[_0xd654('0x2b')]=qs[_0xd654('0x2b')](_0x24ff85[_0xd654('0x41')][_0xd654('0x2b')]);_0x4350b6[_0xd654('0x29')]=qs[_0xd654('0x29')](_0x24ff85[_0xd654('0x41')]['offset']);}_0x4350b6[_0xd654('0x48')]=qs[_0xd654('0x49')](_0x24ff85[_0xd654('0x41')][_0xd654('0x49')]);_0x4350b6[_0xd654('0x4a')]=qs[_0xd654('0x43')](_[_0xd654('0x4b')](_0x24ff85[_0xd654('0x41')],_0x5e078b[_0xd654('0x43')]));_0x4350b6[_0xd654('0x4a')][_0xd654('0x63')]=_0x48aa55['id'];if(_0x24ff85['query'][_0xd654('0x4e')]){_0x4350b6['where']=_['merge'](_0x4350b6['where'],{'$or':_[_0xd654('0x40')](_0x4350b6[_0xd654('0x46')],function(_0x598ec0){var _0xb388f6={};_0xb388f6[_0x598ec0]={'$like':'%'+_0x24ff85[_0xd654('0x41')][_0xd654('0x4e')]+'%'};return _0xb388f6;})});}_0x4350b6=_[_0xd654('0x4c')]({},_0x4350b6,_0x24ff85[_0xd654('0x56')]);return db['Disposition'][_0xd654('0x2c')]({'where':_0x4350b6[_0xd654('0x4a')]})[_0xd654('0x1d')](function(_0x17fb7f){_0x494770['count']=_0x17fb7f;if(_0x24ff85['query']['includeAll']){_0x4350b6['include']=[{'all':!![]}];}return db[_0xd654('0x64')][_0xd654('0x50')](_0x4350b6);})[_0xd654('0x1d')](function(_0x287a36){_0x494770[_0xd654('0x51')]=_0x287a36;return _0x494770;});}})['then'](respondWithFilteredResult(_0x4ce197,_0x4350b6))[_0xd654('0x52')](handleError(_0x4ce197,null));};exports[_0xd654('0x69')]=function(_0xee960,_0x397797,_0x43881f){return db['WhatsappAccount'][_0xd654('0x57')]({'where':{'id':_0xee960['params']['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x397797,null))['then'](function(_0x1277b8){if(_0x1277b8){return _0x1277b8[_0xd654('0x69')](_0xee960[_0xd654('0x41')][_0xd654('0x6a')]);}})['then'](respondWithStatusCode(_0x397797,null))['catch'](handleError(_0x397797,null));};exports[_0xd654('0x6b')]=function(_0x3aaa63,_0x4a50d0,_0x5cc5ec){if(_0x3aaa63[_0xd654('0x59')]['id']){delete _0x3aaa63['body']['id'];}return db[_0xd654('0x3a')][_0xd654('0x57')]({'where':{'id':_0x3aaa63['params']['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x4a50d0,null))[_0xd654('0x1d')](function(_0x53f041){if(_0x53f041){_0x3aaa63['body'][_0xd654('0x63')]=_0x53f041['id'];return db[_0xd654('0x6c')][_0xd654('0x58')](_0x3aaa63[_0xd654('0x59')]);}})[_0xd654('0x1d')](respondWithResult(_0x4a50d0,null))[_0xd654('0x52')](handleError(_0x4a50d0,null));};exports['getAnswers']=function(_0x5ddd87,_0x205c7a,_0x5baca8){var _0x57f53a={'raw':![],'where':{}};var _0x44d99c={};var _0x589cd4={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xd654('0x66')]({'where':{'id':_0x5ddd87[_0xd654('0x54')]['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x205c7a,null))[_0xd654('0x1d')](function(_0x51ab3b){if(_0x51ab3b){_0x44d99c[_0xd654('0x3f')]=_[_0xd654('0x42')](db[_0xd654('0x6c')][_0xd654('0x3b')]);_0x44d99c[_0xd654('0x41')]=_['keys'](_0x5ddd87[_0xd654('0x41')]);_0x44d99c[_0xd654('0x43')]=_[_0xd654('0x44')](_0x44d99c[_0xd654('0x3f')],_0x44d99c[_0xd654('0x41')]);_0x57f53a[_0xd654('0x46')]=_[_0xd654('0x44')](_0x44d99c['model'],qs[_0xd654('0x45')](_0x5ddd87[_0xd654('0x41')]['fields']));_0x57f53a[_0xd654('0x46')]=_0x57f53a[_0xd654('0x46')][_0xd654('0x47')]?_0x57f53a[_0xd654('0x46')]:_0x44d99c[_0xd654('0x3f')];if(!_0x5ddd87[_0xd654('0x41')]['hasOwnProperty'](_0xd654('0x68'))){_0x57f53a[_0xd654('0x2b')]=qs['limit'](_0x5ddd87[_0xd654('0x41')][_0xd654('0x2b')]);_0x57f53a['offset']=qs[_0xd654('0x29')](_0x5ddd87[_0xd654('0x41')][_0xd654('0x29')]);}_0x57f53a[_0xd654('0x48')]=qs[_0xd654('0x49')](_0x5ddd87[_0xd654('0x41')][_0xd654('0x49')]);_0x57f53a[_0xd654('0x4a')]=qs['filters'](_[_0xd654('0x4b')](_0x5ddd87['query'],_0x44d99c['filters']));_0x57f53a[_0xd654('0x4a')]['WhatsappAccountId']=_0x51ab3b['id'];if(_0x5ddd87[_0xd654('0x41')][_0xd654('0x4e')]){_0x57f53a['where']=_[_0xd654('0x4c')](_0x57f53a[_0xd654('0x4a')],{'$or':_[_0xd654('0x40')](_0x57f53a[_0xd654('0x46')],function(_0x3ab74d){var _0x52e1ec={};_0x52e1ec[_0x3ab74d]={'$like':'%'+_0x5ddd87[_0xd654('0x41')][_0xd654('0x4e')]+'%'};return _0x52e1ec;})});}_0x57f53a=_[_0xd654('0x4c')]({},_0x57f53a,_0x5ddd87[_0xd654('0x56')]);return db[_0xd654('0x6c')][_0xd654('0x2c')]({'where':_0x57f53a[_0xd654('0x4a')]})[_0xd654('0x1d')](function(_0x17b149){_0x589cd4[_0xd654('0x2c')]=_0x17b149;if(_0x5ddd87[_0xd654('0x41')][_0xd654('0x55')]){_0x57f53a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xd654('0x50')](_0x57f53a);})[_0xd654('0x1d')](function(_0x10ab80){_0x589cd4['rows']=_0x10ab80;return _0x589cd4;});}})[_0xd654('0x1d')](respondWithFilteredResult(_0x205c7a,_0x57f53a))[_0xd654('0x52')](handleError(_0x205c7a,null));};exports[_0xd654('0x6d')]=function(_0x408741,_0x5a3c40,_0x8fdd28){return db['WhatsappAccount'][_0xd654('0x57')]({'where':{'id':_0x408741[_0xd654('0x54')]['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x5a3c40,null))[_0xd654('0x1d')](function(_0x364d64){if(_0x364d64){return _0x364d64[_0xd654('0x6d')](_0x408741['query'][_0xd654('0x6a')]);}})[_0xd654('0x1d')](respondWithStatusCode(_0x5a3c40,null))[_0xd654('0x52')](handleError(_0x5a3c40,null));};exports[_0xd654('0x6e')]=function(_0x1a249b,_0x4b2e48,_0x393f20){return db[_0xd654('0x3a')][_0xd654('0x57')]({'where':{'id':_0x1a249b['params']['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x4b2e48,null))[_0xd654('0x1d')](function(_0x3b78ca){if(_0x3b78ca){return _0x3b78ca[_0xd654('0x6e')](_0x1a249b[_0xd654('0x59')][_0xd654('0x6a')],_[_0xd654('0x6f')](_0x1a249b[_0xd654('0x59')],[_0xd654('0x6a'),'id'])||{})[_0xd654('0x70')](function(_0x353ebe){for(var _0x14f6e3=0x0;_0x14f6e3<_0x1a249b[_0xd654('0x59')][_0xd654('0x6a')][_0xd654('0x47')];_0x14f6e3+=0x1){socket[_0xd654('0x71')](_0xd654('0x72'),{'UserId':Number(_0x1a249b[_0xd654('0x59')][_0xd654('0x6a')][_0x14f6e3]),'WhatsappAccountId':Number(_0x1a249b[_0xd654('0x54')]['id'])});}return _0x353ebe;});}})[_0xd654('0x1d')](respondWithResult(_0x4b2e48,null))['catch'](handleError(_0x4b2e48,null));};exports['removeAgents']=function(_0x5c4874,_0x3c8131,_0x5a855b){return db['WhatsappAccount']['find']({'where':{'id':_0x5c4874[_0xd654('0x54')]['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x3c8131,null))['then'](function(_0x2607b3){if(_0x2607b3){return _0x2607b3[_0xd654('0x73')](_0x5c4874[_0xd654('0x41')][_0xd654('0x6a')])['then'](function(){if(_[_0xd654('0x74')](_0x5c4874['query']['ids'])){for(var _0x226666=0x0;_0x226666<_0x5c4874['query']['ids'][_0xd654('0x47')];_0x226666+=0x1){socket[_0xd654('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x5c4874[_0xd654('0x41')]['ids'][_0x226666]),'WhatsappAccountId':Number(_0x5c4874[_0xd654('0x54')]['id'])});}}else{socket[_0xd654('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x5c4874['query'][_0xd654('0x6a')]),'WhatsappAccountId':Number(_0x5c4874[_0xd654('0x54')]['id'])});}});}})[_0xd654('0x1d')](respondWithStatusCode(_0x3c8131,null))[_0xd654('0x52')](handleError(_0x3c8131,null));};exports[_0xd654('0x75')]=function(_0x2da4b6,_0x142646,_0x189cbf){var _0x58c9d2={};var _0x112b2d={};var _0x5140c8;var _0x127186;return db[_0xd654('0x3a')][_0xd654('0x66')]({'where':{'id':_0x2da4b6[_0xd654('0x54')]['id']}})['then'](handleEntityNotFound(_0x142646,null))['then'](function(_0x7eb59f){if(_0x7eb59f){_0x5140c8=_0x7eb59f;_0x112b2d[_0xd654('0x3f')]=_[_0xd654('0x42')](db[_0xd654('0x76')]['rawAttributes']);_0x112b2d[_0xd654('0x41')]=_[_0xd654('0x42')](_0x2da4b6[_0xd654('0x41')]);_0x112b2d['filters']=_[_0xd654('0x44')](_0x112b2d[_0xd654('0x3f')],_0x112b2d[_0xd654('0x41')]);_0x58c9d2[_0xd654('0x46')]=_[_0xd654('0x44')](_0x112b2d[_0xd654('0x3f')],qs['fields'](_0x2da4b6[_0xd654('0x41')][_0xd654('0x45')]));_0x58c9d2[_0xd654('0x46')]=_0x58c9d2[_0xd654('0x46')][_0xd654('0x47')]?_0x58c9d2[_0xd654('0x46')]:_0x112b2d[_0xd654('0x3f')];_0x58c9d2[_0xd654('0x48')]=qs[_0xd654('0x49')](_0x2da4b6[_0xd654('0x41')]['sort']);_0x58c9d2[_0xd654('0x4a')]=qs[_0xd654('0x43')](_[_0xd654('0x4b')](_0x2da4b6[_0xd654('0x41')],_0x112b2d[_0xd654('0x43')]));if(_0x2da4b6[_0xd654('0x41')][_0xd654('0x4e')]){_0x58c9d2[_0xd654('0x4a')]=_[_0xd654('0x4c')](_0x58c9d2[_0xd654('0x4a')],{'$or':_['map'](_0x58c9d2[_0xd654('0x46')],function(_0x337e2b){var _0x1a74f5={};_0x1a74f5[_0x337e2b]={'$like':'%'+_0x2da4b6[_0xd654('0x41')][_0xd654('0x4e')]+'%'};return _0x1a74f5;})});}_0x58c9d2=_[_0xd654('0x4c')]({},_0x58c9d2,_0x2da4b6[_0xd654('0x56')]);return _0x5140c8['getAgents'](_0x58c9d2);}})['then'](function(_0xf40594){if(_0xf40594){_0x127186=_0xf40594['length'];if(!_0x2da4b6[_0xd654('0x41')]['hasOwnProperty'](_0xd654('0x68'))){_0x58c9d2[_0xd654('0x2b')]=qs['limit'](_0x2da4b6[_0xd654('0x41')][_0xd654('0x2b')]);_0x58c9d2[_0xd654('0x29')]=qs[_0xd654('0x29')](_0x2da4b6[_0xd654('0x41')][_0xd654('0x29')]);}return _0x5140c8[_0xd654('0x75')](_0x58c9d2);}})[_0xd654('0x1d')](function(_0x13d8bb){if(_0x13d8bb){return _0x13d8bb?{'count':_0x127186,'rows':_0x13d8bb}:null;}})['then'](respondWithResult(_0x142646,null))[_0xd654('0x52')](handleError(_0x142646,null));};exports['addApplications']=function(_0x5e7d16,_0x47b8e6,_0x2d8bad){return db[_0xd654('0x3a')]['findOne']({'where':{'id':_0x5e7d16['params']['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x47b8e6,null))[_0xd654('0x1d')](function(_0x3fdac7){if(_0x3fdac7){return db['sequelize']['transaction'](function(_0x5c7b9b){return db[_0xd654('0x77')][_0xd654('0x32')]({'where':{'WhatsappAccountId':_0x5e7d16[_0xd654('0x54')]['id']},'transaction':_0x5c7b9b})['then'](function(_0x1dacfb){var _0x3dd4ba=_['map'](_0x5e7d16['body'],function(_0x4e51c3){_0x4e51c3[_0xd654('0x63')]=_0x5e7d16['params']['id'];return _0x4e51c3;});return db[_0xd654('0x77')]['bulkCreate'](_0x3dd4ba,{'transaction':_0x5c7b9b});});})['then'](function(){return db[_0xd654('0x77')][_0xd654('0x78')]({'where':{'WhatsappAccountId':_0x5e7d16['params']['id']},'order':_0xd654('0x79')});});}})[_0xd654('0x1d')](respondWithResult(_0x47b8e6,null))[_0xd654('0x52')](handleError(_0x47b8e6,null));};exports['getApplications']=function(_0x394f55,_0x47f1b8,_0x42b78a){var _0x173d5a={};var _0x35dd50={};var _0x57cc22;var _0x1e2246;return db[_0xd654('0x3a')][_0xd654('0x66')]({'where':{'id':_0x394f55['params']['id']}})[_0xd654('0x1d')](handleEntityNotFound(_0x47f1b8,null))['then'](function(_0x344aaa){if(_0x344aaa){_0x57cc22=_0x344aaa;_0x35dd50['model']=_['keys'](db[_0xd654('0x77')][_0xd654('0x3b')]);_0x35dd50[_0xd654('0x41')]=_[_0xd654('0x42')](_0x394f55['query']);_0x35dd50[_0xd654('0x43')]=_[_0xd654('0x44')](_0x35dd50[_0xd654('0x3f')],_0x35dd50['query']);_0x173d5a[_0xd654('0x46')]=_['intersection'](_0x35dd50[_0xd654('0x3f')],qs[_0xd654('0x45')](_0x394f55[_0xd654('0x41')]['fields']));_0x173d5a[_0xd654('0x46')]=_0x173d5a[_0xd654('0x46')][_0xd654('0x47')]?_0x173d5a[_0xd654('0x46')]:_0x35dd50[_0xd654('0x3f')];_0x173d5a[_0xd654('0x48')]=qs[_0xd654('0x49')](_0x394f55[_0xd654('0x41')]['sort']);_0x173d5a['where']=qs[_0xd654('0x43')](_[_0xd654('0x4b')](_0x394f55[_0xd654('0x41')],_0x35dd50[_0xd654('0x43')]));if(_0x394f55[_0xd654('0x41')][_0xd654('0x4e')]){_0x173d5a[_0xd654('0x4a')]=_[_0xd654('0x4c')](_0x173d5a[_0xd654('0x4a')],{'$or':_[_0xd654('0x40')](_0x173d5a[_0xd654('0x46')],function(_0xa71dff){var _0x5624e6={};_0x5624e6[_0xa71dff]={'$like':'%'+_0x394f55[_0xd654('0x41')]['filter']+'%'};return _0x5624e6;})});}_0x173d5a=_['merge']({},_0x173d5a,_0x394f55['options']);return _0x57cc22['getApplications'](_0x173d5a);}})[_0xd654('0x1d')](function(_0x473194){if(_0x473194){_0x1e2246=_0x473194[_0xd654('0x47')];if(!_0x394f55[_0xd654('0x41')][_0xd654('0x67')](_0xd654('0x68'))){_0x173d5a[_0xd654('0x2b')]=qs[_0xd654('0x2b')](_0x394f55[_0xd654('0x41')][_0xd654('0x2b')]);_0x173d5a[_0xd654('0x29')]=qs[_0xd654('0x29')](_0x394f55['query']['offset']);}return _0x57cc22[_0xd654('0x7a')](_0x173d5a);}})[_0xd654('0x1d')](function(_0x3f3906){if(_0x3f3906){return _0x3f3906?{'count':_0x1e2246,'rows':_0x3f3906}:null;}})['then'](respondWithResult(_0x47f1b8,null))[_0xd654('0x52')](handleError(_0x47f1b8,null));};exports[_0xd654('0x7b')]=function(_0x26dfad,_0x5ec064,_0x5f3aa4){var _0x3ccff8={'channel':_0xd654('0x7c')};var _0x4d8ed2=[];var _0x57bcf0=[];var _0x113921={};return db[_0xd654('0x3a')][_0xd654('0x57')]({'where':{'id':_0x26dfad[_0xd654('0x54')]['id']},'include':[{'model':db[_0xd654('0x77')],'as':_0xd654('0x7d')}]})[_0xd654('0x1d')](handleEntityNotFound(_0x5ec064,null))[_0xd654('0x1d')](function(_0x9b8025){_0x3ccff8[_0xd654('0x7e')]=_0x9b8025;_0x3ccff8[_0xd654('0x7f')]=_[_0xd654('0x80')](_0x9b8025[_0xd654('0x7d')],[_0xd654('0x79')],[_0xd654('0x81')]);if(_0x3ccff8[_0xd654('0x7e')][_0xd654('0x7d')]){delete _0x3ccff8[_0xd654('0x7e')][_0xd654('0x7d')];}return db['CmContact'][_0xd654('0x61')]();})[_0xd654('0x1d')](function(_0x5b21a1){if(!_0x5b21a1){throw new db['Sequelize'][(_0xd654('0x82'))]('no\x20available\x20attributes');}_0x4d8ed2=_[_0xd654('0x83')](_[_0xd654('0x42')](_0x5b21a1),[_0xd654('0x84'),_0xd654('0x85')]);_0x57bcf0=_['difference'](_[_0xd654('0x42')](_0x5b21a1),['createdAt','updatedAt',_0xd654('0x86'),_0xd654('0x87')]);_0x3ccff8[_0xd654('0x59')]={'mapKey':_0xd654('0x88')};if(_0x3ccff8['account'][_0xd654('0x3d')]&&_0x3ccff8[_0xd654('0x7e')][_0xd654('0x3d')]===_0xd654('0x89')){_0x3ccff8['body'][_0xd654('0x8a')]=_0x26dfad[_0xd654('0x59')]['From']['replace'](_0xd654('0x8b'),'');_0x3ccff8[_0xd654('0x59')]['body']=_0x26dfad[_0xd654('0x59')][_0xd654('0x8c')];_0x3ccff8[_0xd654('0x59')][_0xd654('0x8d')]=_0x26dfad['body'][_0xd654('0x8e')];}if(_0x3ccff8[_0xd654('0x59')]['id']){delete _0x3ccff8[_0xd654('0x59')]['id'];}if(_[_0xd654('0x8f')](_0x3ccff8[_0xd654('0x59')]['from'])){throw new db[(_0xd654('0x90'))][(_0xd654('0x82'))](_0xd654('0x91'));}if(_['isNil'](_0x3ccff8[_0xd654('0x59')][_0xd654('0x59')])||_0x3ccff8['body'][_0xd654('0x59')]===''){throw new db['Sequelize'][(_0xd654('0x82'))](_0xd654('0x92'));}if(_[_0xd654('0x8f')](_0x3ccff8['body'][_0xd654('0x93')])){throw new db[(_0xd654('0x90'))]['ValidationError'](_0xd654('0x94')+_0x57bcf0);}if(!_[_0xd654('0x95')](_0x57bcf0,_0x3ccff8['body'][_0xd654('0x93')])){throw new db[(_0xd654('0x90'))][(_0xd654('0x82'))](_0xd654('0x96')+_0x57bcf0);}_0x113921[_0x3ccff8[_0xd654('0x59')][_0xd654('0x93')]]=_0x3ccff8['body'][_0xd654('0x8a')];return db['CmList']['find']({'where':{'id':_0x3ccff8[_0xd654('0x7e')][_0xd654('0x87')]},'include':[{'model':db['CmContact'],'as':_0xd654('0x97'),'where':_0x113921,'limit':0x1,'order':[['updatedAt',_0xd654('0x98')]]}]});})[_0xd654('0x1d')](handleEntityNotFound(_0x5ec064,null))[_0xd654('0x1d')](function(_0x18926c){if(_0x18926c){_0x3ccff8[_0xd654('0x99')]=_[_0xd654('0x6f')](_0x18926c,[_0xd654('0x97')]);if(_0x18926c[_0xd654('0x97')][_0xd654('0x47')]){return _0x18926c['Contacts'][0x0];}var _0x2da48c=_[_0xd654('0x16')](_0x3ccff8[_0xd654('0x59')],{'firstName':_0x3ccff8[_0xd654('0x59')]['from'],'ListId':_0x18926c['id']});_0x2da48c[_0x3ccff8[_0xd654('0x59')][_0xd654('0x93')]]=_0x3ccff8[_0xd654('0x59')][_0xd654('0x8a')];return db[_0xd654('0x9a')][_0xd654('0x58')](_0x2da48c,{'fields':_0x4d8ed2,'raw':!![]});}})[_0xd654('0x1d')](handleEntityNotFound(_0x5ec064,null))[_0xd654('0x1d')](function(_0x3af2c1){if(_0x3af2c1){_0x3ccff8['contact']=_0x3af2c1;var _0xede983={'ContactId':_0x3af2c1['id'],'phone':_0x3ccff8['body'][_0xd654('0x8a')],'WhatsappAccountId':_0x26dfad['params']['id']};var _0x293985={'ContactId':_0x3af2c1['id'],'WhatsappAccountId':_0x26dfad['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0xd654('0x57')]({'where':_0x293985})[_0xd654('0x1d')](function(_0x3e3843){if(_0x3e3843){return[_0x3e3843,![]];}return db[_0xd654('0x9b')][_0xd654('0x58')](_0xede983)[_0xd654('0x1d')](function(_0x3588ba){return[_0x3588ba,!![]];});});}})[_0xd654('0x70')](function(_0x48ef59,_0x105827){_0x3ccff8[_0xd654('0x9c')]=_0x48ef59['get']({'plain':!![]});_0x3ccff8[_0xd654('0x9c')][_0xd654('0x9d')]=![];if(_0x105827){if(_0x3ccff8['account']['autoclose']){_0x3ccff8['applications'][_0xd654('0x9e')]({'id':0x0,'priority':_0x3ccff8[_0xd654('0x7f')]['length']+0x1,'app':_0xd654('0x9f'),'appdata':_0xd654('0xa0'),'interval':'*,*,*,*'});}_0x3ccff8[_0xd654('0x9c')][_0xd654('0x9d')]=!![];}return db[_0xd654('0xa1')][_0xd654('0x58')]({'phone':_0x3ccff8['body'][_0xd654('0x8a')],'messageId':_0x3ccff8[_0xd654('0x59')][_0xd654('0x8d')],'body':_0x3ccff8['body'][_0xd654('0x59')],'WhatsappAccountId':_0x26dfad['params']['id'],'WhatsappInteractionId':_0x48ef59['id'],'direction':'in','ContactId':_0x48ef59['ContactId'],'AttachmentId':_0x3ccff8[_0xd654('0x59')][_0xd654('0xa2')]});})[_0xd654('0x1d')](function(_0x4d8947){_0x3ccff8[_0xd654('0x25')]=_0x4d8947;if(_0x3ccff8[_0xd654('0x9c')]['UserId']){return db[_0xd654('0x76')][_0xd654('0x57')]({'attributes':['id',_0xd654('0x36')],'where':{'id':_0x3ccff8[_0xd654('0x9c')][_0xd654('0xa3')]}})[_0xd654('0x1d')](function(_0x5aeb02){if(_0x5aeb02){_0x3ccff8['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd654('0xa4'),'appdata':_0x5aeb02[_0xd654('0x36')]+','+(_0x3ccff8[_0xd654('0x7e')][_0xd654('0xa5')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd654('0xa6'),_0x3ccff8);});}return respondWithRpcPromise(_0xd654('0xa7'),_0xd654('0xa6'),_0x3ccff8);})['then'](function(_0x5f4b7c){if(_0x5f4b7c){var _0x46ed94=0xc8;var _0x2e8b67=_0xd654('0xa8');logger['info'](_0xd654('0x21'),_0x2e8b67,_0x46ed94,_0xd654('0xa9'));logger[_0xd654('0xaa')](_0xd654('0xab'),_0x2e8b67,_0x46ed94,_0xd654('0xa9'),JSON[_0xd654('0x22')](_0x5f4b7c));if(_0x3ccff8[_0xd654('0x7e')][_0xd654('0x3d')]===_0xd654('0x89')){return _0x5ec064[_0xd654('0x28')](_0x46ed94)[_0xd654('0x2d')](_0xd654('0xac'),_0xd654('0xad'))[_0xd654('0x37')](_0xd654('0xae'));}else{return _0x5ec064[_0xd654('0x28')](_0x46ed94)[_0xd654('0x2f')](_0x5f4b7c);}}})[_0xd654('0x52')](handleError(_0x5ec064,null));};exports['send']=function(_0x2d29b1,_0xfbd2eb,_0x316502){var _0x2f2c9e,_0x3e1cf8,_0x505321;if(_[_0xd654('0x8f')](_0x2d29b1[_0xd654('0x59')]['body'])||_0x2d29b1[_0xd654('0x59')]['body']===''){throw new db['Sequelize']['ValidationError'](_0xd654('0x92'));}if(_[_0xd654('0x8f')](_0x2d29b1[_0xd654('0x59')]['to'])){throw new db[(_0xd654('0x90'))][(_0xd654('0x82'))](_0xd654('0xaf'));}_0x2f2c9e=_0x2d29b1[_0xd654('0x59')]['to'];return db[_0xd654('0x3a')][_0xd654('0x57')]({'where':{'id':_0x2d29b1[_0xd654('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xd654('0xb0'),'include':[{'model':db[_0xd654('0x9a')],'as':_0xd654('0x97'),'where':{'mobile':_0x2f2c9e},'limit':0x1,'order':[[_0xd654('0x85'),_0xd654('0x98')]]}]}]})[_0xd654('0x1d')](handleEntityNotFound(_0xfbd2eb,null))[_0xd654('0x1d')](function(_0x3ec6db){if(_0x3ec6db&&_0x3ec6db[_0xd654('0xb0')]){_0x3e1cf8=_0x3ec6db[_0xd654('0x33')]({'plain':!![]});if(_0x3e1cf8['List']&&_0x3e1cf8[_0xd654('0xb0')][_0xd654('0x97')]['length']){return _0x3e1cf8[_0xd654('0xb0')][_0xd654('0x97')][0x0];}return db['CmContact'][_0xd654('0x58')](_[_0xd654('0x16')](_0x2d29b1['body'],{'firstName':_0x2f2c9e,'mobile':_0x2f2c9e,'phone':_0x2f2c9e,'ListId':_0x3e1cf8['ListId']}));}})[_0xd654('0x1d')](handleEntityNotFound(_0xfbd2eb,null))[_0xd654('0x1d')](function(_0x9f6481){if(_0x9f6481){_0x505321=_0x9f6481;return db[_0xd654('0x9b')][_0xd654('0x57')]({'where':{'ContactId':_0x505321['id'],'closed':![],'WhatsappAccountId':_0x3e1cf8['id']}})[_0xd654('0x1d')](function(_0x189a5c){if(_0x189a5c){return[_0x189a5c,![]];}return db[_0xd654('0x9b')][_0xd654('0x58')]({'UserId':_0x2d29b1[_0xd654('0xb1')]['id'],'ContactId':_0x505321['id'],'WhatsappAccountId':_0x3e1cf8['id'],'phone':_0x2f2c9e,'firstMsgDirection':'out','Messages':[_[_0xd654('0x4c')](_0x2d29b1[_0xd654('0x59')],{'read':![],'body':_0x2d29b1[_0xd654('0x59')]['body'],'phone':_0x2f2c9e,'WhatsappAccountId':_0x3e1cf8['id'],'UserId':_0x2d29b1[_0xd654('0xb1')]['id'],'ContactId':_0x505321['id']})]},{'include':[{'model':db[_0xd654('0xa1')],'as':'Messages'}]})[_0xd654('0x1d')](function(_0x1adbaa){return[_0x1adbaa,!![]];});});}})[_0xd654('0x70')](function(_0x575fcd,_0x2bdb26){if(_0x2bdb26){return _0x575fcd;}return db[_0xd654('0xa1')][_0xd654('0x58')](_[_0xd654('0x4c')](_0x2d29b1[_0xd654('0x59')],{'read':![],'body':_0x2d29b1[_0xd654('0x59')][_0xd654('0x59')],'phone':_0x2f2c9e,'WhatsappAccountId':_0x3e1cf8['id'],'WhatsappInteractionId':_0x575fcd['id'],'UserId':_0x2d29b1[_0xd654('0xb1')]['id'],'ContactId':_0x505321['id']}))['then'](function(_0xf696f){_0x575fcd[_0xd654('0xb2')][_0xd654('0xb3')]=[];_0x575fcd[_0xd654('0xb2')]['Messages'][_0xd654('0x9e')](_0xf696f[_0xd654('0xb2')]);return _0x575fcd;});})[_0xd654('0x1d')](respondWithResult(_0xfbd2eb,null))[_0xd654('0x52')](handleError(_0xfbd2eb,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index eec81ff..24e3c8f 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 _0x02f0=['events','../../mysqldb','setMaxListeners','save','remove','emit','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x02f0,0x19d));var _0x002f=function(_0x1a2d3c,_0x2a588d){_0x1a2d3c=_0x1a2d3c-0x0;var _0x328513=_0x02f0[_0x1a2d3c];return _0x328513;};'use strict';var EventEmitter=require(_0x002f('0x0'));var WhatsappAccount=require(_0x002f('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x002f('0x2')](0x0);var events={'afterCreate':_0x002f('0x3'),'afterUpdate':'update','afterDestroy':_0x002f('0x4')};function emitEvent(_0x238097){return function(_0x2a775f,_0x4dd624,_0x58718b){WhatsappAccountEvents[_0x002f('0x5')](_0x238097+':'+_0x2a775f['id'],_0x2a775f);WhatsappAccountEvents[_0x002f('0x5')](_0x238097,_0x2a775f);_0x58718b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x002f('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x16d1=['hook','exports','WhatsappAccount','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x16d1,0xba));var _0x116d=function(_0x2d6b81,_0x57cbd8){_0x2d6b81=_0x2d6b81-0x0;var _0x2c59f6=_0x16d1[_0x2d6b81];return _0x2c59f6;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x116d('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x116d('0x1')](0x0);var events={'afterCreate':_0x116d('0x2'),'afterUpdate':'update','afterDestroy':_0x116d('0x3')};function emitEvent(_0x9f2214){return function(_0x34aba1,_0x5cf839,_0x10b62c){WhatsappAccountEvents['emit'](_0x9f2214+':'+_0x34aba1['id'],_0x34aba1);WhatsappAccountEvents[_0x116d('0x4')](_0x9f2214,_0x34aba1);_0x10b62c(null);};}for(var e in events){if(events[_0x116d('0x5')](e)){var event=events[e];WhatsappAccount[_0x116d('0x6')](e,emitEvent(event));}}module[_0x116d('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 79f10ee..a5a1a0d 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 _0x334e=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x2d4be8,_0x1d7784){var _0x2df932=function(_0x2f593b){while(--_0x2f593b){_0x2d4be8['push'](_0x2d4be8['shift']());}};_0x2df932(++_0x1d7784);}(_0x334e,0x1d2));var _0xe334=function(_0x390f76,_0x25afe8){_0x390f76=_0x390f76-0x0;var _0x39866e=_0x334e[_0x390f76];return _0x39866e;};'use strict';var _=require(_0xe334('0x0'));var util=require(_0xe334('0x1'));var logger=require(_0xe334('0x2'))(_0xe334('0x3'));var moment=require(_0xe334('0x4'));var BPromise=require(_0xe334('0x5'));var rp=require(_0xe334('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe334('0x7'));var config=require('../../config/environment');var attributes=require(_0xe334('0x8'));module['exports']=function(_0x4d346a,_0x15acd1){return _0x4d346a[_0xe334('0x9')](_0xe334('0xa'),attributes,{'tableName':_0xe334('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c94=['define','whatsapp_accounts','util','api','moment','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0xc5775d,_0x3701ab){var _0x3b4edd=function(_0x37c3cb){while(--_0x37c3cb){_0xc5775d['push'](_0xc5775d['shift']());}};_0x3b4edd(++_0x3701ab);}(_0x9c94,0x107));var _0x49c9=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x9c94[_0x119280];return _0x481797;};'use strict';var _=require('lodash');var util=require(_0x49c9('0x0'));var logger=require('../../config/logger')(_0x49c9('0x1'));var moment=require(_0x49c9('0x2'));var BPromise=require('bluebird');var rp=require(_0x49c9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49c9('0x4'));var config=require(_0x49c9('0x5'));var attributes=require(_0x49c9('0x6'));module['exports']=function(_0x515732,_0x9b0e7){return _0x515732[_0x49c9('0x7')]('WhatsappAccount',attributes,{'tableName':_0x49c9('0x8'),'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 232f729..12f61f0 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 _0x8c23=['result','ShowWhatsappAccount','find','options','raw','where','attributes','map','include','model','debug','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x19ae83,_0x4dc7d9){var _0x355a07=function(_0x2b33e0){while(--_0x2b33e0){_0x19ae83['push'](_0x19ae83['shift']());}};_0x355a07(++_0x4dc7d9);}(_0x8c23,0x115));var _0x38c2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8c23[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x38c2('0x0'));var util=require(_0x38c2('0x1'));var moment=require(_0x38c2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38c2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x38c2('0x4'));var logger=require(_0x38c2('0x5'))(_0x38c2('0x6'));var config=require(_0x38c2('0x7'));var jayson=require(_0x38c2('0x8'));var client=jayson[_0x38c2('0x9')][_0x38c2('0xa')]({'port':0x232a});config['redis']=_[_0x38c2('0xb')](config[_0x38c2('0xc')],{'host':_0x38c2('0xd'),'port':0x18eb});var socket=require(_0x38c2('0xe'))(new Redis(config[_0x38c2('0xc')]));require(_0x38c2('0xf'))[_0x38c2('0x10')](socket);function respondWithRpcPromise(_0x1ee1ae,_0x1bf661,_0xe990fe){return new BPromise(function(_0x55bd3f,_0x7c48e1){return client[_0x38c2('0x11')](_0x1ee1ae,_0xe990fe)[_0x38c2('0x12')](function(_0x1c1964){logger[_0x38c2('0x13')](_0x38c2('0x14'),_0x1bf661,_0x38c2('0x15'));logger['debug'](_0x38c2('0x16'),_0x1bf661,_0x38c2('0x15'),JSON[_0x38c2('0x17')](_0x1c1964));if(_0x1c1964[_0x38c2('0x18')]){if(_0x1c1964[_0x38c2('0x18')][_0x38c2('0x19')]===0x1f4){logger['error'](_0x38c2('0x14'),_0x1bf661,_0x1c1964[_0x38c2('0x18')][_0x38c2('0x1a')]);return _0x7c48e1(_0x1c1964[_0x38c2('0x18')][_0x38c2('0x1a')]);}logger[_0x38c2('0x18')](_0x38c2('0x14'),_0x1bf661,_0x1c1964[_0x38c2('0x18')][_0x38c2('0x1a')]);return _0x55bd3f(_0x1c1964['error']['message']);}else{logger[_0x38c2('0x13')](_0x38c2('0x14'),_0x1bf661,_0x38c2('0x15'));_0x55bd3f(_0x1c1964[_0x38c2('0x1b')][_0x38c2('0x1a')]);}})['catch'](function(_0x4bcadf){logger[_0x38c2('0x18')](_0x38c2('0x14'),_0x1bf661,_0x4bcadf);_0x7c48e1(_0x4bcadf);});});}exports[_0x38c2('0x1c')]=function(_0x5e3093){var _0xb6447c=this;return new Promise(function(_0x38dc9d,_0xee0119){return db['WhatsappAccount'][_0x38c2('0x1d')]({'raw':_0x5e3093[_0x38c2('0x1e')]?_0x5e3093['options'][_0x38c2('0x1f')]===undefined?!![]:![]:!![],'where':_0x5e3093[_0x38c2('0x1e')]?_0x5e3093[_0x38c2('0x1e')][_0x38c2('0x20')]||null:null,'attributes':_0x5e3093[_0x38c2('0x1e')]?_0x5e3093[_0x38c2('0x1e')][_0x38c2('0x21')]||null:null,'include':_0x5e3093['options']?_0x5e3093['options']['include']?_[_0x38c2('0x22')](_0x5e3093[_0x38c2('0x1e')][_0x38c2('0x23')],function(_0x213085){return{'model':db[_0x213085['model']],'as':_0x213085['as'],'attributes':_0x213085[_0x38c2('0x21')],'include':_0x213085[_0x38c2('0x23')]?_['map'](_0x213085['include'],function(_0xfc01cd){return{'model':db[_0xfc01cd[_0x38c2('0x24')]],'as':_0xfc01cd['as'],'attributes':_0xfc01cd[_0x38c2('0x21')],'include':_0xfc01cd['include']?_[_0x38c2('0x22')](_0xfc01cd[_0x38c2('0x23')],function(_0x3be5a7){return{'model':db[_0x3be5a7[_0x38c2('0x24')]],'as':_0x3be5a7['as'],'attributes':_0x3be5a7[_0x38c2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x38c2('0x12')](function(_0x3151b8){logger[_0x38c2('0x13')]('ShowWhatsappAccount',_0x5e3093);logger[_0x38c2('0x25')](_0x38c2('0x1c'),_0x5e3093,JSON[_0x38c2('0x17')](_0x3151b8));_0x38dc9d(_0x3151b8);})['catch'](function(_0x47b2f2){logger[_0x38c2('0x18')]('ShowWhatsappAccount',_0x47b2f2['message'],_0x5e3093);_0xee0119(_0xb6447c['error'](0x1f4,_0x47b2f2[_0x38c2('0x1a')]));});});}; \ No newline at end of file +var _0x3ef7=['code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappAccount.socket','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12a4d9,_0x4696c2){var _0x305516=function(_0x59196f){while(--_0x59196f){_0x12a4d9['push'](_0x12a4d9['shift']());}};_0x305516(++_0x4696c2);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var moment=require(_0x73ef('0x1'));var BPromise=require(_0x73ef('0x2'));var rs=require(_0x73ef('0x3'));var fs=require('fs');var Redis=require(_0x73ef('0x4'));var db=require(_0x73ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73ef('0x6'))(_0x73ef('0x7'));var config=require(_0x73ef('0x8'));var jayson=require(_0x73ef('0x9'));var client=jayson['client'][_0x73ef('0xa')]({'port':0x232a});config[_0x73ef('0xb')]=_[_0x73ef('0xc')](config[_0x73ef('0xb')],{'host':_0x73ef('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73ef('0xb')]));require(_0x73ef('0xe'))['register'](socket);function respondWithRpcPromise(_0x1055e1,_0x21bfed,_0x364470){return new BPromise(function(_0x3bd4c9,_0x33aa09){return client['request'](_0x1055e1,_0x364470)[_0x73ef('0xf')](function(_0x111ce3){logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x21bfed,_0x73ef('0x12'));logger[_0x73ef('0x13')](_0x73ef('0x14'),_0x21bfed,_0x73ef('0x12'),JSON[_0x73ef('0x15')](_0x111ce3));if(_0x111ce3[_0x73ef('0x16')]){if(_0x111ce3[_0x73ef('0x16')][_0x73ef('0x17')]===0x1f4){logger[_0x73ef('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x21bfed,_0x111ce3[_0x73ef('0x16')]['message']);return _0x33aa09(_0x111ce3[_0x73ef('0x16')][_0x73ef('0x18')]);}logger[_0x73ef('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x21bfed,_0x111ce3[_0x73ef('0x16')][_0x73ef('0x18')]);return _0x3bd4c9(_0x111ce3['error'][_0x73ef('0x18')]);}else{logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x21bfed,_0x73ef('0x12'));_0x3bd4c9(_0x111ce3[_0x73ef('0x19')]['message']);}})[_0x73ef('0x1a')](function(_0x4dc000){logger[_0x73ef('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x21bfed,_0x4dc000);_0x33aa09(_0x4dc000);});});}exports[_0x73ef('0x1b')]=function(_0x2168ec){var _0x36d02f=this;return new Promise(function(_0x2c4d28,_0x35d733){return db[_0x73ef('0x1c')][_0x73ef('0x1d')]({'raw':_0x2168ec[_0x73ef('0x1e')]?_0x2168ec['options'][_0x73ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x2168ec[_0x73ef('0x1e')]?_0x2168ec[_0x73ef('0x1e')][_0x73ef('0x20')]||null:null,'attributes':_0x2168ec['options']?_0x2168ec[_0x73ef('0x1e')][_0x73ef('0x21')]||null:null,'include':_0x2168ec[_0x73ef('0x1e')]?_0x2168ec[_0x73ef('0x1e')][_0x73ef('0x22')]?_[_0x73ef('0x23')](_0x2168ec[_0x73ef('0x1e')][_0x73ef('0x22')],function(_0x173e2d){return{'model':db[_0x173e2d[_0x73ef('0x24')]],'as':_0x173e2d['as'],'attributes':_0x173e2d['attributes'],'include':_0x173e2d[_0x73ef('0x22')]?_[_0x73ef('0x23')](_0x173e2d['include'],function(_0x5ad215){return{'model':db[_0x5ad215[_0x73ef('0x24')]],'as':_0x5ad215['as'],'attributes':_0x5ad215['attributes'],'include':_0x5ad215['include']?_[_0x73ef('0x23')](_0x5ad215[_0x73ef('0x22')],function(_0x2153e3){return{'model':db[_0x2153e3[_0x73ef('0x24')]],'as':_0x2153e3['as'],'attributes':_0x2153e3['attributes']};}):[]};}):[]};}):[]:[]})[_0x73ef('0xf')](function(_0x4fa6e2){logger[_0x73ef('0x10')]('ShowWhatsappAccount',_0x2168ec);logger[_0x73ef('0x13')](_0x73ef('0x1b'),_0x2168ec,JSON[_0x73ef('0x15')](_0x4fa6e2));_0x2c4d28(_0x4fa6e2);})[_0x73ef('0x1a')](function(_0x19c821){logger[_0x73ef('0x16')](_0x73ef('0x1b'),_0x19c821['message'],_0x2168ec);_0x35d733(_0x36d02f[_0x73ef('0x16')](0x1f4,_0x19c821[_0x73ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e321084..522bb28 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 _0xbc36=['remove','update','register','length','./whatsappAccount.events','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbc36,0x1ba));var _0x6bc3=function(_0x52f500,_0x9696f0){_0x52f500=_0x52f500-0x0;var _0x1962d9=_0xbc36[_0x52f500];return _0x1962d9;};'use strict';var WhatsappAccountEvents=require(_0x6bc3('0x0'));var events=[_0x6bc3('0x1'),_0x6bc3('0x2'),_0x6bc3('0x3')];function createListener(_0x5596a5,_0x370380){return function(_0x527186){_0x370380['emit'](_0x5596a5,_0x527186);};}function removeListener(_0x3ad439,_0x3da587){return function(){WhatsappAccountEvents['removeListener'](_0x3ad439,_0x3da587);};}exports[_0x6bc3('0x4')]=function(_0x235204){for(var _0x42be5e=0x0,_0x16f45e=events[_0x6bc3('0x5')];_0x42be5e<_0x16f45e;_0x42be5e++){var _0x3f0dd3=events[_0x42be5e];var _0x50cc95=createListener('whatsappAccount:'+_0x3f0dd3,_0x235204);WhatsappAccountEvents['on'](_0x3f0dd3,_0x50cc95);}}; \ No newline at end of file +var _0xb447=['remove','emit','removeListener','register','length','whatsappAccount:','save'];(function(_0x2746b0,_0x3dacf0){var _0x35a4af=function(_0x309580){while(--_0x309580){_0x2746b0['push'](_0x2746b0['shift']());}};_0x35a4af(++_0x3dacf0);}(_0xb447,0x156));var _0x7b44=function(_0xece9e3,_0x1e3745){_0xece9e3=_0xece9e3-0x0;var _0x23444d=_0xb447[_0xece9e3];return _0x23444d;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x7b44('0x0'),_0x7b44('0x1'),'update'];function createListener(_0x25e286,_0x3245e4){return function(_0xe571c2){_0x3245e4[_0x7b44('0x2')](_0x25e286,_0xe571c2);};}function removeListener(_0x738518,_0x16668f){return function(){WhatsappAccountEvents[_0x7b44('0x3')](_0x738518,_0x16668f);};}exports[_0x7b44('0x4')]=function(_0x51c7bb){for(var _0x36a385=0x0,_0x177928=events[_0x7b44('0x5')];_0x36a385<_0x177928;_0x36a385++){var _0x2ef54a=events[_0x36a385];var _0x15e08a=createListener(_0x7b44('0x6')+_0x2ef54a,_0x51c7bb);WhatsappAccountEvents['on'](_0x2ef54a,_0x15e08a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e84d7b9..3f14fc4 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 _0xdabf=['update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','index','isAuthenticated','post','create','put','/:id'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xdabf,0x1ce));var _0xfdab=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xdabf[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0xfdab('0x0'));var util=require(_0xfdab('0x1'));var path=require(_0xfdab('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfdab('0x3')]();var fs_extra=require(_0xfdab('0x4'));var auth=require(_0xfdab('0x5'));var interaction=require(_0xfdab('0x6'));var config=require('../../config/environment');var controller=require(_0xfdab('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfdab('0x8')]);router['get']('/:id',auth[_0xfdab('0x9')](),controller['show']);router[_0xfdab('0xa')]('/',auth[_0xfdab('0x9')](),controller[_0xfdab('0xb')]);router[_0xfdab('0xc')](_0xfdab('0xd'),auth[_0xfdab('0x9')](),controller[_0xfdab('0xe')]);router[_0xfdab('0xf')](_0xfdab('0xd'),auth[_0xfdab('0x9')](),controller[_0xfdab('0x10')]);module['exports']=router; \ No newline at end of file +var _0x78bb=['isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x78bb,0x172));var _0xb78b=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x78bb[_0x1e4f2d];return _0xd05ce5;};'use strict';var multer=require(_0xb78b('0x0'));var util=require(_0xb78b('0x1'));var path=require(_0xb78b('0x2'));var timeout=require(_0xb78b('0x3'));var express=require('express');var router=express[_0xb78b('0x4')]();var fs_extra=require(_0xb78b('0x5'));var auth=require(_0xb78b('0x6'));var interaction=require(_0xb78b('0x7'));var config=require(_0xb78b('0x8'));var controller=require('./whatsappApplication.controller');router[_0xb78b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb78b('0x9')]('/:id',auth[_0xb78b('0xa')](),controller[_0xb78b('0xb')]);router[_0xb78b('0xc')]('/',auth[_0xb78b('0xa')](),controller[_0xb78b('0xd')]);router[_0xb78b('0xe')](_0xb78b('0xf'),auth[_0xb78b('0xa')](),controller[_0xb78b('0x10')]);router['delete']('/:id',auth[_0xb78b('0xa')](),controller[_0xb78b('0x11')]);module[_0xb78b('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 0bd33b4..6453b87 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 _0xa3a3=['*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x26a434,_0x5500c5){var _0x524037=function(_0x5a71ac){while(--_0x5a71ac){_0x26a434['push'](_0x26a434['shift']());}};_0x524037(++_0x5500c5);}(_0xa3a3,0xd1));var _0x3a3a=function(_0x59bf6d,_0x45605c){_0x59bf6d=_0x59bf6d-0x0;var _0xc46b18=_0xa3a3[_0x59bf6d];return _0xc46b18;};'use strict';var Sequelize=require(_0x3a3a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3a3a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3a3a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3a3a('0x2')],'defaultValue':_0x3a3a('0x3')}}; \ No newline at end of file +var _0x84e5=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x5d0001,_0x14edeb){var _0x56d984=function(_0x165a79){while(--_0x165a79){_0x5d0001['push'](_0x5d0001['shift']());}};_0x56d984(++_0x14edeb);}(_0x84e5,0x111));var _0x584e=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x84e5[_0x265aa2];return _0x447a3a;};'use strict';var Sequelize=require('sequelize');module[_0x584e('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x584e('0x1')],'allowNull':![],'defaultValue':_0x584e('0x2')},'appdata':{'type':Sequelize[_0x584e('0x3')]()},'description':{'type':Sequelize[_0x584e('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x584e('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a2bdb9e..dd6952d 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 _0x762e=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','catch','show','params','create','body','find','eml-format','fast-json-patch','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','destroy','sendStatus','error','stack','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','name','query'];(function(_0x412712,_0x10079b){var _0x3c7416=function(_0xe4d95c){while(--_0xe4d95c){_0x412712['push'](_0x412712['shift']());}};_0x3c7416(++_0x10079b);}(_0x762e,0xea));var _0xe762=function(_0x4061dd,_0x49333c){_0x4061dd=_0x4061dd-0x0;var _0x2bfd4b=_0x762e[_0x4061dd];return _0x2bfd4b;};'use strict';var emlformat=require(_0xe762('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe762('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe762('0x2'));var Mustache=require(_0xe762('0x3'));var util=require(_0xe762('0x4'));var path=require('path');var sox=require(_0xe762('0x5'));var csv=require(_0xe762('0x6'));var ejs=require(_0xe762('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe762('0x8'));var squel=require(_0xe762('0x9'));var crypto=require(_0xe762('0xa'));var jsforce=require(_0xe762('0xb'));var deskjs=require(_0xe762('0xc'));var toCsv=require(_0xe762('0x6'));var querystring=require('querystring');var Papa=require(_0xe762('0xd'));var Redis=require(_0xe762('0xe'));var authService=require(_0xe762('0xf'));var qs=require(_0xe762('0x10'));var as=require(_0xe762('0x11'));var hardwareService=require(_0xe762('0x12'));var logger=require(_0xe762('0x13'))('api');var utils=require(_0xe762('0x14'));var config=require(_0xe762('0x15'));var licenseUtil=require(_0xe762('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x340573,_0x4793b0){_0x4793b0=_0x4793b0||0xcc;return function(_0x3d3bd0){if(_0x3d3bd0){return _0x340573['sendStatus'](_0x4793b0);}return _0x340573[_0xe762('0x17')](_0x4793b0)[_0xe762('0x18')]();};}function respondWithResult(_0x1ebf3d,_0x533dcb){_0x533dcb=_0x533dcb||0xc8;return function(_0x50aa09){if(_0x50aa09){return _0x1ebf3d[_0xe762('0x17')](_0x533dcb)[_0xe762('0x19')](_0x50aa09);}};}function respondWithFilteredResult(_0x229d3d,_0x13c27d){return function(_0x3e6c1d){if(_0x3e6c1d){var _0x7a379=typeof _0x13c27d[_0xe762('0x1a')]===_0xe762('0x1b')&&typeof _0x13c27d['limit']===_0xe762('0x1b');var _0xe43c3e=_0x3e6c1d[_0xe762('0x1c')];var _0x27c2cf=_0x7a379?0x0:_0x13c27d['offset'];var _0xd2cb26=_0x7a379?_0x3e6c1d[_0xe762('0x1c')]:_0x13c27d['offset']+_0x13c27d['limit'];var _0x52e1de;if(_0xd2cb26>=_0xe43c3e){_0xd2cb26=_0xe43c3e;_0x52e1de=0xc8;}else{_0x52e1de=0xce;}_0x229d3d[_0xe762('0x17')](_0x52e1de);return _0x229d3d['set'](_0xe762('0x1d'),_0x27c2cf+'-'+_0xd2cb26+'/'+_0xe43c3e)['json'](_0x3e6c1d);}return null;};}function patchUpdates(_0x8775aa){return function(_0x57ad0d){try{jsonpatch[_0xe762('0x1e')](_0x57ad0d,_0x8775aa,!![]);}catch(_0x190aa3){return BPromise[_0xe762('0x1f')](_0x190aa3);}return _0x57ad0d[_0xe762('0x20')]();};}function saveUpdates(_0x3e2d00,_0x5c096c){return function(_0x58a906){if(_0x58a906){return _0x58a906['update'](_0x3e2d00)['then'](function(_0x413584){return _0x413584;});}return null;};}function removeEntity(_0x14641f,_0x31ac1a){return function(_0x604304){if(_0x604304){return _0x604304[_0xe762('0x21')]()['then'](function(){_0x14641f[_0xe762('0x17')](0xcc)[_0xe762('0x18')]();});}};}function handleEntityNotFound(_0x407d1e,_0x1f8cb1){return function(_0x411d94){if(!_0x411d94){_0x407d1e[_0xe762('0x22')](0x194);}return _0x411d94;};}function handleError(_0x46817e,_0x3dcd32){_0x3dcd32=_0x3dcd32||0x1f4;return function(_0xc05eb8){logger[_0xe762('0x23')](_0xc05eb8[_0xe762('0x24')]);if(_0xc05eb8['name']){delete _0xc05eb8['name'];}_0x46817e[_0xe762('0x17')](_0x3dcd32)['send'](_0xc05eb8);};}exports[_0xe762('0x25')]=function(_0x40a4bd,_0x5b09d0){var _0x2b0a36={},_0xa39b64={},_0x1e0b47={'count':0x0,'rows':[]};var _0x4112ba=_[_0xe762('0x26')](db[_0xe762('0x27')][_0xe762('0x28')],function(_0x3c8dcd){return{'name':_0x3c8dcd[_0xe762('0x29')],'type':_0x3c8dcd[_0xe762('0x2a')]['key']};});_0xa39b64[_0xe762('0x2b')]=_[_0xe762('0x26')](_0x4112ba,_0xe762('0x2c'));_0xa39b64[_0xe762('0x2d')]=_[_0xe762('0x2e')](_0x40a4bd[_0xe762('0x2d')]);_0xa39b64[_0xe762('0x2f')]=_[_0xe762('0x30')](_0xa39b64['model'],_0xa39b64['query']);_0x2b0a36[_0xe762('0x31')]=_[_0xe762('0x30')](_0xa39b64[_0xe762('0x2b')],qs[_0xe762('0x32')](_0x40a4bd[_0xe762('0x2d')][_0xe762('0x32')]));_0x2b0a36[_0xe762('0x31')]=_0x2b0a36['attributes'][_0xe762('0x33')]?_0x2b0a36[_0xe762('0x31')]:_0xa39b64[_0xe762('0x2b')];if(!_0x40a4bd['query'][_0xe762('0x34')](_0xe762('0x35'))){_0x2b0a36[_0xe762('0x36')]=qs[_0xe762('0x36')](_0x40a4bd[_0xe762('0x2d')][_0xe762('0x36')]);_0x2b0a36[_0xe762('0x1a')]=qs[_0xe762('0x1a')](_0x40a4bd[_0xe762('0x2d')][_0xe762('0x1a')]);}_0x2b0a36['order']=qs[_0xe762('0x37')](_0x40a4bd[_0xe762('0x2d')][_0xe762('0x37')]);_0x2b0a36[_0xe762('0x38')]=qs[_0xe762('0x2f')](_[_0xe762('0x39')](_0x40a4bd[_0xe762('0x2d')],_0xa39b64[_0xe762('0x2f')]),_0x4112ba);if(_0x40a4bd[_0xe762('0x2d')][_0xe762('0x3a')]){_0x2b0a36[_0xe762('0x38')]=_[_0xe762('0x3b')](_0x2b0a36[_0xe762('0x38')],{'$or':_[_0xe762('0x26')](_0x4112ba,function(_0xef4687){if(_0xef4687[_0xe762('0x2a')]!==_0xe762('0x3c')){var _0x4320b8={};_0x4320b8[_0xef4687[_0xe762('0x2c')]]={'$like':'%'+_0x40a4bd[_0xe762('0x2d')][_0xe762('0x3a')]+'%'};return _0x4320b8;}})});}_0x2b0a36=_['merge']({},_0x2b0a36,_0x40a4bd['options']);var _0x19cfb0={'where':_0x2b0a36[_0xe762('0x38')]};return db[_0xe762('0x27')][_0xe762('0x1c')](_0x19cfb0)[_0xe762('0x3d')](function(_0x2a5b71){_0x1e0b47[_0xe762('0x1c')]=_0x2a5b71;if(_0x40a4bd[_0xe762('0x2d')][_0xe762('0x3e')]){_0x2b0a36[_0xe762('0x3f')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x2b0a36);})[_0xe762('0x3d')](function(_0x3cfe4e){_0x1e0b47['rows']=_0x3cfe4e;return _0x1e0b47;})[_0xe762('0x3d')](respondWithFilteredResult(_0x5b09d0,_0x2b0a36))[_0xe762('0x40')](handleError(_0x5b09d0,null));};exports[_0xe762('0x41')]=function(_0x3bc307,_0x4ff8c1){var _0x48caae={'raw':!![],'where':{'id':_0x3bc307[_0xe762('0x42')]['id']}},_0x2e8301={};_0x2e8301['model']=_[_0xe762('0x2e')](db[_0xe762('0x27')][_0xe762('0x28')]);_0x2e8301[_0xe762('0x2d')]=_[_0xe762('0x2e')](_0x3bc307[_0xe762('0x2d')]);_0x2e8301[_0xe762('0x2f')]=_[_0xe762('0x30')](_0x2e8301[_0xe762('0x2b')],_0x2e8301[_0xe762('0x2d')]);_0x48caae[_0xe762('0x31')]=_[_0xe762('0x30')](_0x2e8301[_0xe762('0x2b')],qs['fields'](_0x3bc307['query']['fields']));_0x48caae[_0xe762('0x31')]=_0x48caae[_0xe762('0x31')][_0xe762('0x33')]?_0x48caae[_0xe762('0x31')]:_0x2e8301[_0xe762('0x2b')];if(_0x3bc307['query']['includeAll']){_0x48caae[_0xe762('0x3f')]=[{'all':!![]}];}_0x48caae=_[_0xe762('0x3b')]({},_0x48caae,_0x3bc307['options']);return db[_0xe762('0x27')]['find'](_0x48caae)['then'](handleEntityNotFound(_0x4ff8c1,null))[_0xe762('0x3d')](respondWithResult(_0x4ff8c1,null))[_0xe762('0x40')](handleError(_0x4ff8c1,null));};exports['create']=function(_0x12e82c,_0x2b3b1d){return db[_0xe762('0x27')][_0xe762('0x43')](_0x12e82c['body'],{})[_0xe762('0x3d')](respondWithResult(_0x2b3b1d,0xc9))[_0xe762('0x40')](handleError(_0x2b3b1d,null));};exports['update']=function(_0x2eb2fb,_0x8be01b){if(_0x2eb2fb[_0xe762('0x44')]['id']){delete _0x2eb2fb[_0xe762('0x44')]['id'];}return db[_0xe762('0x27')][_0xe762('0x45')]({'where':{'id':_0x2eb2fb['params']['id']}})[_0xe762('0x3d')](handleEntityNotFound(_0x8be01b,null))[_0xe762('0x3d')](saveUpdates(_0x2eb2fb[_0xe762('0x44')],null))[_0xe762('0x3d')](respondWithResult(_0x8be01b,null))['catch'](handleError(_0x8be01b,null));};exports[_0xe762('0x21')]=function(_0x591845,_0x4c1b77){return db[_0xe762('0x27')][_0xe762('0x45')]({'where':{'id':_0x591845[_0xe762('0x42')]['id']}})[_0xe762('0x3d')](handleEntityNotFound(_0x4c1b77,null))[_0xe762('0x3d')](removeEntity(_0x4c1b77,null))[_0xe762('0x40')](handleError(_0x4c1b77,null));}; \ No newline at end of file +var _0x9b0d=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','findAll','rows','show','params','include','catch','create','body','update','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','key','query','keys'];(function(_0x42ca10,_0x737816){var _0x3544aa=function(_0x107197){while(--_0x107197){_0x42ca10['push'](_0x42ca10['shift']());}};_0x3544aa(++_0x737816);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x2e0785,_0x5c6f4d){_0x2e0785=_0x2e0785-0x0;var _0x55459b=_0x9b0d[_0x2e0785];return _0x55459b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd9b0('0x0'));var zipdir=require(_0xd9b0('0x1'));var jsonpatch=require(_0xd9b0('0x2'));var rp=require(_0xd9b0('0x3'));var moment=require('moment');var BPromise=require(_0xd9b0('0x4'));var Mustache=require(_0xd9b0('0x5'));var util=require(_0xd9b0('0x6'));var path=require(_0xd9b0('0x7'));var sox=require('sox');var csv=require(_0xd9b0('0x8'));var ejs=require(_0xd9b0('0x9'));var fs=require('fs');var fs_extra=require(_0xd9b0('0xa'));var _=require(_0xd9b0('0xb'));var squel=require(_0xd9b0('0xc'));var crypto=require(_0xd9b0('0xd'));var jsforce=require(_0xd9b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd9b0('0x8'));var querystring=require(_0xd9b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xd9b0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd9b0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9b0('0x12'));var logger=require(_0xd9b0('0x13'))(_0xd9b0('0x14'));var utils=require(_0xd9b0('0x15'));var config=require(_0xd9b0('0x16'));var licenseUtil=require(_0xd9b0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29e9e0,_0x76bb6e){_0x76bb6e=_0x76bb6e||0xcc;return function(_0x4e0210){if(_0x4e0210){return _0x29e9e0[_0xd9b0('0x18')](_0x76bb6e);}return _0x29e9e0[_0xd9b0('0x19')](_0x76bb6e)[_0xd9b0('0x1a')]();};}function respondWithResult(_0x46321d,_0x2a15b1){_0x2a15b1=_0x2a15b1||0xc8;return function(_0x13a800){if(_0x13a800){return _0x46321d['status'](_0x2a15b1)[_0xd9b0('0x1b')](_0x13a800);}};}function respondWithFilteredResult(_0x579aa7,_0x2908a1){return function(_0x288dd4){if(_0x288dd4){var _0x141fea=typeof _0x2908a1[_0xd9b0('0x1c')]===_0xd9b0('0x1d')&&typeof _0x2908a1[_0xd9b0('0x1e')]===_0xd9b0('0x1d');var _0x584d2d=_0x288dd4[_0xd9b0('0x1f')];var _0x3ffdc8=_0x141fea?0x0:_0x2908a1[_0xd9b0('0x1c')];var _0x1b9b8f=_0x141fea?_0x288dd4[_0xd9b0('0x1f')]:_0x2908a1[_0xd9b0('0x1c')]+_0x2908a1[_0xd9b0('0x1e')];var _0x485cdf;if(_0x1b9b8f>=_0x584d2d){_0x1b9b8f=_0x584d2d;_0x485cdf=0xc8;}else{_0x485cdf=0xce;}_0x579aa7[_0xd9b0('0x19')](_0x485cdf);return _0x579aa7['set'](_0xd9b0('0x20'),_0x3ffdc8+'-'+_0x1b9b8f+'/'+_0x584d2d)['json'](_0x288dd4);}return null;};}function patchUpdates(_0x225823){return function(_0x77c318){try{jsonpatch[_0xd9b0('0x21')](_0x77c318,_0x225823,!![]);}catch(_0x3df41b){return BPromise[_0xd9b0('0x22')](_0x3df41b);}return _0x77c318[_0xd9b0('0x23')]();};}function saveUpdates(_0x549cfe,_0x5ecfe7){return function(_0x132710){if(_0x132710){return _0x132710['update'](_0x549cfe)[_0xd9b0('0x24')](function(_0x283da7){return _0x283da7;});}return null;};}function removeEntity(_0x11c443,_0x5a1f95){return function(_0x222229){if(_0x222229){return _0x222229['destroy']()['then'](function(){_0x11c443[_0xd9b0('0x19')](0xcc)[_0xd9b0('0x1a')]();});}};}function handleEntityNotFound(_0x5569c3,_0x3d90f0){return function(_0x4b9935){if(!_0x4b9935){_0x5569c3[_0xd9b0('0x18')](0x194);}return _0x4b9935;};}function handleError(_0xf06e12,_0x1c7ece){_0x1c7ece=_0x1c7ece||0x1f4;return function(_0xe07b77){logger[_0xd9b0('0x25')](_0xe07b77[_0xd9b0('0x26')]);if(_0xe07b77[_0xd9b0('0x27')]){delete _0xe07b77[_0xd9b0('0x27')];}_0xf06e12[_0xd9b0('0x19')](_0x1c7ece)[_0xd9b0('0x28')](_0xe07b77);};}exports[_0xd9b0('0x29')]=function(_0x233aae,_0x160c43){var _0x8be573={},_0x16cd85={},_0x23b2d8={'count':0x0,'rows':[]};var _0x4f5cdc=_[_0xd9b0('0x2a')](db['WhatsappApplication'][_0xd9b0('0x2b')],function(_0x1f8bc8){return{'name':_0x1f8bc8['fieldName'],'type':_0x1f8bc8[_0xd9b0('0x2c')][_0xd9b0('0x2d')]};});_0x16cd85['model']=_[_0xd9b0('0x2a')](_0x4f5cdc,_0xd9b0('0x27'));_0x16cd85[_0xd9b0('0x2e')]=_[_0xd9b0('0x2f')](_0x233aae[_0xd9b0('0x2e')]);_0x16cd85[_0xd9b0('0x30')]=_[_0xd9b0('0x31')](_0x16cd85[_0xd9b0('0x32')],_0x16cd85['query']);_0x8be573[_0xd9b0('0x33')]=_[_0xd9b0('0x31')](_0x16cd85[_0xd9b0('0x32')],qs[_0xd9b0('0x34')](_0x233aae['query']['fields']));_0x8be573[_0xd9b0('0x33')]=_0x8be573['attributes'][_0xd9b0('0x35')]?_0x8be573[_0xd9b0('0x33')]:_0x16cd85['model'];if(!_0x233aae['query'][_0xd9b0('0x36')](_0xd9b0('0x37'))){_0x8be573[_0xd9b0('0x1e')]=qs[_0xd9b0('0x1e')](_0x233aae[_0xd9b0('0x2e')][_0xd9b0('0x1e')]);_0x8be573[_0xd9b0('0x1c')]=qs[_0xd9b0('0x1c')](_0x233aae['query'][_0xd9b0('0x1c')]);}_0x8be573[_0xd9b0('0x38')]=qs[_0xd9b0('0x39')](_0x233aae[_0xd9b0('0x2e')][_0xd9b0('0x39')]);_0x8be573[_0xd9b0('0x3a')]=qs[_0xd9b0('0x30')](_[_0xd9b0('0x3b')](_0x233aae[_0xd9b0('0x2e')],_0x16cd85[_0xd9b0('0x30')]),_0x4f5cdc);if(_0x233aae[_0xd9b0('0x2e')][_0xd9b0('0x3c')]){_0x8be573[_0xd9b0('0x3a')]=_[_0xd9b0('0x3d')](_0x8be573[_0xd9b0('0x3a')],{'$or':_[_0xd9b0('0x2a')](_0x4f5cdc,function(_0x1d04de){if(_0x1d04de[_0xd9b0('0x2c')]!==_0xd9b0('0x3e')){var _0x18dc45={};_0x18dc45[_0x1d04de['name']]={'$like':'%'+_0x233aae['query'][_0xd9b0('0x3c')]+'%'};return _0x18dc45;}})});}_0x8be573=_['merge']({},_0x8be573,_0x233aae[_0xd9b0('0x3f')]);var _0x353fd7={'where':_0x8be573[_0xd9b0('0x3a')]};return db[_0xd9b0('0x40')][_0xd9b0('0x1f')](_0x353fd7)[_0xd9b0('0x24')](function(_0x359b3e){_0x23b2d8[_0xd9b0('0x1f')]=_0x359b3e;if(_0x233aae[_0xd9b0('0x2e')][_0xd9b0('0x41')]){_0x8be573['include']=[{'all':!![]}];}return db[_0xd9b0('0x40')][_0xd9b0('0x42')](_0x8be573);})['then'](function(_0x1f5333){_0x23b2d8[_0xd9b0('0x43')]=_0x1f5333;return _0x23b2d8;})[_0xd9b0('0x24')](respondWithFilteredResult(_0x160c43,_0x8be573))['catch'](handleError(_0x160c43,null));};exports[_0xd9b0('0x44')]=function(_0x225800,_0x418113){var _0x3a09aa={'raw':!![],'where':{'id':_0x225800[_0xd9b0('0x45')]['id']}},_0x285ca9={};_0x285ca9[_0xd9b0('0x32')]=_[_0xd9b0('0x2f')](db[_0xd9b0('0x40')][_0xd9b0('0x2b')]);_0x285ca9[_0xd9b0('0x2e')]=_[_0xd9b0('0x2f')](_0x225800[_0xd9b0('0x2e')]);_0x285ca9[_0xd9b0('0x30')]=_[_0xd9b0('0x31')](_0x285ca9[_0xd9b0('0x32')],_0x285ca9[_0xd9b0('0x2e')]);_0x3a09aa[_0xd9b0('0x33')]=_['intersection'](_0x285ca9[_0xd9b0('0x32')],qs[_0xd9b0('0x34')](_0x225800['query'][_0xd9b0('0x34')]));_0x3a09aa[_0xd9b0('0x33')]=_0x3a09aa[_0xd9b0('0x33')]['length']?_0x3a09aa['attributes']:_0x285ca9[_0xd9b0('0x32')];if(_0x225800[_0xd9b0('0x2e')][_0xd9b0('0x41')]){_0x3a09aa[_0xd9b0('0x46')]=[{'all':!![]}];}_0x3a09aa=_[_0xd9b0('0x3d')]({},_0x3a09aa,_0x225800[_0xd9b0('0x3f')]);return db[_0xd9b0('0x40')]['find'](_0x3a09aa)[_0xd9b0('0x24')](handleEntityNotFound(_0x418113,null))['then'](respondWithResult(_0x418113,null))[_0xd9b0('0x47')](handleError(_0x418113,null));};exports[_0xd9b0('0x48')]=function(_0xd11f53,_0x32857f){return db[_0xd9b0('0x40')][_0xd9b0('0x48')](_0xd11f53[_0xd9b0('0x49')],{})[_0xd9b0('0x24')](respondWithResult(_0x32857f,0xc9))['catch'](handleError(_0x32857f,null));};exports[_0xd9b0('0x4a')]=function(_0x982ccd,_0x2618a0){if(_0x982ccd[_0xd9b0('0x49')]['id']){delete _0x982ccd[_0xd9b0('0x49')]['id'];}return db[_0xd9b0('0x40')][_0xd9b0('0x4b')]({'where':{'id':_0x982ccd[_0xd9b0('0x45')]['id']}})[_0xd9b0('0x24')](handleEntityNotFound(_0x2618a0,null))[_0xd9b0('0x24')](saveUpdates(_0x982ccd[_0xd9b0('0x49')],null))[_0xd9b0('0x24')](respondWithResult(_0x2618a0,null))[_0xd9b0('0x47')](handleError(_0x2618a0,null));};exports[_0xd9b0('0x4c')]=function(_0x39ca70,_0x795b17){return db['WhatsappApplication'][_0xd9b0('0x4b')]({'where':{'id':_0x39ca70[_0xd9b0('0x45')]['id']}})[_0xd9b0('0x24')](handleEntityNotFound(_0x795b17,null))[_0xd9b0('0x24')](removeEntity(_0x795b17,null))[_0xd9b0('0x47')](handleError(_0x795b17,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 14c00e7..c8eaae6 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 _0xc73e=['util','api','moment','rimraf','../../config/environment','exports','define','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x58fa75,_0x212e02){var _0x324ce3=function(_0x16d870){while(--_0x16d870){_0x58fa75['push'](_0x58fa75['shift']());}};_0x324ce3(++_0x212e02);}(_0xc73e,0x1e9));var _0xec73=function(_0x856b21,_0xca5f58){_0x856b21=_0x856b21-0x0;var _0x5a99b2=_0xc73e[_0x856b21];return _0x5a99b2;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var logger=require('../../config/logger')(_0xec73('0x2'));var moment=require(_0xec73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xec73('0x4'));var config=require(_0xec73('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0xec73('0x6')]=function(_0x26598a,_0x3bd154){return _0x26598a[_0xec73('0x7')]('WhatsappApplication',attributes,{'tableName':_0xec73('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xec73('0x9')});}; \ No newline at end of file +var _0x4944=['moment','bluebird','request-promise','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0xe2680e,_0x2f5445){var _0x25f5f7=function(_0x44effb){while(--_0x44effb){_0xe2680e['push'](_0xe2680e['shift']());}};_0x25f5f7(++_0x2f5445);}(_0x4944,0x6d));var _0x4494=function(_0x43089e,_0x475dd4){_0x43089e=_0x43089e-0x0;var _0x104150=_0x4944[_0x43089e];return _0x104150;};'use strict';var _=require(_0x4494('0x0'));var util=require('util');var logger=require(_0x4494('0x1'))(_0x4494('0x2'));var moment=require(_0x4494('0x3'));var BPromise=require(_0x4494('0x4'));var rp=require(_0x4494('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4494('0x6'));var config=require('../../config/environment');var attributes=require(_0x4494('0x7'));module[_0x4494('0x8')]=function(_0x38480d,_0xb94d02){return _0x38480d[_0x4494('0x9')](_0x4494('0xa'),attributes,{'tableName':_0x4494('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4494('0xc'),'collate':_0x4494('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index cb95620..933c7fc 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','WhatsappApplication,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x2f0704,_0xedf4eb){var _0x683b28=function(_0xe561b6){while(--_0xe561b6){_0x2f0704['push'](_0x2f0704['shift']());}};_0x683b28(++_0xedf4eb);}(_0x3e74,0x175));var _0x43e7=function(_0x545bb6,_0xe4c6d1){_0x545bb6=_0x545bb6-0x0;var _0x32155e=_0x3e74[_0x545bb6];return _0x32155e;};'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']('WhatsappApplication,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('WhatsappApplication,\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')]('WhatsappApplication,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0xeec6=['then','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0xeec6,0x1c2));var _0x6eec=function(_0x4b6804,_0x301b24){_0x4b6804=_0x4b6804-0x0;var _0x11b4f1=_0xeec6[_0x4b6804];return _0x11b4f1;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 73a578e..ed6a983 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 _0x9c5a=['isAuthenticated','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','describe'];(function(_0x572359,_0x100986){var _0x3ec4cf=function(_0x1478dd){while(--_0x1478dd){_0x572359['push'](_0x572359['shift']());}};_0x3ec4cf(++_0x100986);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x35c610,_0x58d439){_0x35c610=_0x35c610-0x0;var _0x1eb1ee=_0x9c5a[_0x35c610];return _0x1eb1ee;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./whatsappInteraction.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['get'](_0xa9c5('0xd'),auth[_0xa9c5('0xb')](),controller['getMessages']);router['get'](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xf')]);router[_0xa9c5('0x10')]('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);router[_0xa9c5('0x10')](_0xa9c5('0xd'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x12')]);router['post'](_0xa9c5('0x13'),auth[_0xa9c5('0xb')](),interaction[_0xa9c5('0x14')](_0xa9c5('0x15'),_0xa9c5('0x16')),controller[_0xa9c5('0x17')]);router[_0xa9c5('0x18')](_0xa9c5('0x19'),auth[_0xa9c5('0xb')](),interaction[_0xa9c5('0x14')]('whatsapp',_0xa9c5('0x1a')),controller[_0xa9c5('0x1b')]);router[_0xa9c5('0x1c')]('/:id',auth[_0xa9c5('0xb')](),interaction[_0xa9c5('0x14')](_0xa9c5('0x15'),_0xa9c5('0x1d')),controller[_0xa9c5('0x1e')]);router[_0xa9c5('0x1c')](_0xa9c5('0x13'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x1f')]);module[_0xa9c5('0x20')]=router; \ No newline at end of file +var _0xafb9=['update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsappinteraction:update'];(function(_0x3bd868,_0x49db8c){var _0x577e18=function(_0x9c59d6){while(--_0x9c59d6){_0x3bd868['push'](_0x3bd868['shift']());}};_0x577e18(++_0x49db8c);}(_0xafb9,0x68));var _0x9afb=function(_0x2404e1,_0x463c16){_0x2404e1=_0x2404e1-0x0;var _0x27486b=_0xafb9[_0x2404e1];return _0x27486b;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var fs_extra=require(_0x9afb('0x6'));var auth=require(_0x9afb('0x7'));var interaction=require(_0x9afb('0x8'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x9afb('0x9')]('/',auth['isAuthenticated'](),controller[_0x9afb('0xa')]);router['get']('/describe',auth[_0x9afb('0xb')](),controller[_0x9afb('0xc')]);router[_0x9afb('0x9')]('/:id',auth[_0x9afb('0xb')](),controller[_0x9afb('0xd')]);router[_0x9afb('0x9')](_0x9afb('0xe'),auth[_0x9afb('0xb')](),controller['getMessages']);router['get'](_0x9afb('0xf'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x10')]);router[_0x9afb('0x11')]('/',auth[_0x9afb('0xb')](),controller[_0x9afb('0x12')]);router[_0x9afb('0x11')](_0x9afb('0xe'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x13')]);router['post'](_0x9afb('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x9afb('0x15'),_0x9afb('0x16')),controller[_0x9afb('0x17')]);router[_0x9afb('0x18')](_0x9afb('0x19'),auth[_0x9afb('0xb')](),interaction[_0x9afb('0x1a')]('whatsapp',_0x9afb('0x1b')),controller[_0x9afb('0x1c')]);router[_0x9afb('0x1d')](_0x9afb('0x19'),auth[_0x9afb('0xb')](),interaction['tracked'](_0x9afb('0x15'),'whatsappinteraction:destroy'),controller[_0x9afb('0x1e')]);router[_0x9afb('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller[_0x9afb('0x1f')]);module[_0x9afb('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 701ef57..52ad11e 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 _0x4b47=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x5af756,_0x2743fe){var _0x407568=function(_0x4e19c1){while(--_0x4e19c1){_0x5af756['push'](_0x5af756['shift']());}};_0x407568(++_0x2743fe);}(_0x4b47,0x1b4));var _0x74b4=function(_0x168cec,_0x340a7c){_0x168cec=_0x168cec-0x0;var _0x2e13ca=_0x4b47[_0x168cec];return _0x2e13ca;};'use strict';var Sequelize=require(_0x74b4('0x0'));var moment=require('moment');module[_0x74b4('0x1')]={'closed':{'type':Sequelize[_0x74b4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x74b4('0x3')]},'disposition':{'type':Sequelize[_0x74b4('0x4')]},'secondDisposition':{'type':Sequelize[_0x74b4('0x4')]},'thirdDisposition':{'type':Sequelize[_0x74b4('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x74b4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x74b4('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x74b4('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x74b4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xea89=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x463efb,_0x5a4680){var _0x58a131=function(_0x15472a){while(--_0x15472a){_0x463efb['push'](_0x463efb['shift']());}};_0x58a131(++_0x5a4680);}(_0xea89,0x1e2));var _0x9ea8=function(_0x5312a2,_0x22da34){_0x5312a2=_0x5312a2-0x0;var _0x1f3b06=_0xea89[_0x5312a2];return _0x1f3b06;};'use strict';var Sequelize=require(_0x9ea8('0x0'));var moment=require(_0x9ea8('0x1'));module[_0x9ea8('0x2')]={'closed':{'type':Sequelize[_0x9ea8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9ea8('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9ea8('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9ea8('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9ea8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9ea8('0x6')]('in',_0x9ea8('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9ea8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9ea8('0x6')]('in',_0x9ea8('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9ea8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index e12be37..b1a1ceb 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 _0x34e8=['destroy','describe','WhatsappMessage','addMessage','ids','omit','findOne','WhatsappInteractionId','format','rows','addTags','setTags','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','Messages','direction','secret','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','reject','then','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','catch','index','rawAttributes','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','filters','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','start','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','getWhatsappAccounts','user','sequelize','toString','keyBy','merge','WhatsappInteraction','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','push','all','show','params','includeAll','include','options','create'];(function(_0x43dced,_0x4a2035){var _0x5ec2fc=function(_0x426dea){while(--_0x426dea){_0x43dced['push'](_0x43dced['shift']());}};_0x5ec2fc(++_0x4a2035);}(_0x34e8,0x12c));var _0x834e=function(_0x1081e3,_0x40b374){_0x1081e3=_0x1081e3-0x0;var _0x3b4c11=_0x34e8[_0x1081e3];return _0x3b4c11;};'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 pdf=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x834e('0x1c'))['db'];config[_0x834e('0x1d')]=_['defaults'](config[_0x834e('0x1d')],{'host':_0x834e('0x1e'),'port':0x18eb});var socket=require(_0x834e('0x1f'))(new Redis(config[_0x834e('0x1d')]));require('./whatsappInteraction.socket')[_0x834e('0x20')](socket);function respondWithStatusCode(_0x302cbd,_0x57274a){_0x57274a=_0x57274a||0xcc;return function(_0x316205){if(_0x316205){return _0x302cbd['sendStatus'](_0x57274a);}return _0x302cbd[_0x834e('0x21')](_0x57274a)[_0x834e('0x22')]();};}function respondWithResult(_0x478afe,_0x43ac41){_0x43ac41=_0x43ac41||0xc8;return function(_0x22106e){if(_0x22106e){return _0x478afe[_0x834e('0x21')](_0x43ac41)['json'](_0x22106e);}};}function respondWithFilteredResult(_0x283e56,_0x211e9a){return function(_0x34e41a){if(_0x34e41a){var _0xb993a1=typeof _0x211e9a[_0x834e('0x23')]===_0x834e('0x24')&&typeof _0x211e9a[_0x834e('0x25')]==='undefined';var _0x2545b4=_0x34e41a[_0x834e('0x26')];var _0x113ff4=_0xb993a1?0x0:_0x211e9a[_0x834e('0x23')];var _0x4ab05d=_0xb993a1?_0x34e41a[_0x834e('0x26')]:_0x211e9a[_0x834e('0x23')]+_0x211e9a['limit'];var _0x1b4bdf;if(_0x4ab05d>=_0x2545b4){_0x4ab05d=_0x2545b4;_0x1b4bdf=0xc8;}else{_0x1b4bdf=0xce;}_0x283e56[_0x834e('0x21')](_0x1b4bdf);return _0x283e56[_0x834e('0x27')]('Content-Range',_0x113ff4+'-'+_0x4ab05d+'/'+_0x2545b4)['json'](_0x34e41a);}return null;};}function patchUpdates(_0x231619){return function(_0x34563b){try{jsonpatch['apply'](_0x34563b,_0x231619,!![]);}catch(_0x25ee1d){return BPromise[_0x834e('0x28')](_0x25ee1d);}return _0x34563b['save']();};}function saveUpdates(_0x3bc4f7,_0x2e1983){return function(_0x338636){if(_0x338636){return _0x338636['update'](_0x3bc4f7)[_0x834e('0x29')](function(_0x3e310f){return _0x3e310f;});}return null;};}function removeEntity(_0x5e1cc5,_0x5bef62){return function(_0x1e713a){if(_0x1e713a){return _0x1e713a['destroy']()[_0x834e('0x29')](function(){_0x5e1cc5[_0x834e('0x21')](0xcc)[_0x834e('0x22')]();});}};}function handleEntityNotFound(_0x2cc2eb,_0x3cd928){return function(_0x130cc5){if(!_0x130cc5){_0x2cc2eb['sendStatus'](0x194);}return _0x130cc5;};}function handleError(_0x510780,_0x4dc64a){_0x4dc64a=_0x4dc64a||0x1f4;return function(_0x58c1d7){logger[_0x834e('0x2a')](_0x58c1d7[_0x834e('0x2b')]);if(_0x58c1d7[_0x834e('0x2c')]){delete _0x58c1d7['name'];}_0x510780[_0x834e('0x21')](_0x4dc64a)[_0x834e('0x2d')](_0x58c1d7);};}function getInteractionUsers(_0x1f3671,_0x1e026a){return new BPromise(function(_0x4551f5,_0x390119){try{if(_0x1e026a[_0x1f3671['id']]){_0x1f3671[_0x834e('0x2e')]=_[_0x834e('0x2f')](_0x1e026a[_0x1f3671['id']],function(_0x278db3){return{'id':_0x278db3['id'],'fullname':_0x278db3['fullname']};});}}catch(_0xef9ec2){_0x390119(_0xef9ec2);}_0x4551f5(_0x1f3671);});}function getInteractionTags(_0x5cad11,_0x2c75c2){return new BPromise(function(_0x3787b0,_0x9ab921){try{if(_0x5cad11[_0x834e('0x30')]){_0x5cad11[_0x834e('0x31')]=[];_0x5cad11[_0x834e('0x30')][_0x834e('0x32')](',')[_0x834e('0x33')](function(_0x358c31){_0x5cad11[_0x834e('0x31')]['push'](_0x2c75c2[_0x358c31]);});}delete _0x5cad11[_0x834e('0x30')];}catch(_0x2f408a){_0x9ab921(_0x2f408a);}_0x3787b0(_0x5cad11);});}function updateWhatsappInteraction(_0x24a9df,_0xaf01f4,_0x595cc0){return new BPromise(function(_0x3f88ad,_0x379d60){return getInteractionUsers(_0x24a9df,_0x595cc0)['then'](function(_0x496533){return getInteractionTags(_0x496533,_0xaf01f4);})['then'](function(_0x3e58fa){_0x3f88ad(_0x3e58fa);})[_0x834e('0x34')](function(_0x20c6ae){_0x379d60(_0x20c6ae);});});}exports[_0x834e('0x35')]=function(_0x339e28,_0x1b76dd){var _0x4c2ef6={},_0x2c2d94={},_0x513f36={'count':0x0,'rows':[]};var _0xe103fe=_[_0x834e('0x2f')](db['WhatsappInteraction'][_0x834e('0x36')],function(_0x2f56c7){return{'name':_0x2f56c7['fieldName'],'type':_0x2f56c7['type'][_0x834e('0x37')]};});_0x2c2d94[_0x834e('0x38')]=_[_0x834e('0x2f')](_0xe103fe,_0x834e('0x2c'));_0x2c2d94[_0x834e('0x39')]=_['keys'](_0x339e28[_0x834e('0x39')]);_0x2c2d94['filters']=_['intersection'](_0x2c2d94[_0x834e('0x38')],_0x2c2d94['query']);_0x4c2ef6[_0x834e('0x3a')]=_[_0x834e('0x3b')](_0x2c2d94[_0x834e('0x38')],qs[_0x834e('0x3c')](_0x339e28[_0x834e('0x39')]['fields']));_0x4c2ef6[_0x834e('0x3a')]=_0x4c2ef6[_0x834e('0x3a')][_0x834e('0x3d')]?_0x4c2ef6['attributes']:_0x2c2d94[_0x834e('0x38')];if(!_0x339e28[_0x834e('0x39')]['hasOwnProperty'](_0x834e('0x3e'))){_0x4c2ef6['limit']=qs[_0x834e('0x25')](_0x339e28[_0x834e('0x39')]['limit']);_0x4c2ef6['offset']=qs[_0x834e('0x23')](_0x339e28[_0x834e('0x39')][_0x834e('0x23')]);}_0x4c2ef6[_0x834e('0x3f')]=qs[_0x834e('0x40')](_0x339e28[_0x834e('0x39')][_0x834e('0x40')]);_0x4c2ef6['where']=qs[_0x834e('0x41')](_['pick'](_0x339e28[_0x834e('0x39')],_0x2c2d94['filters']),_0xe103fe);var _0x1df5b0=[];var _0x5a5807=squel[_0x834e('0x42')]()[_0x834e('0x43')]('id')['field'](_0x834e('0x2c'))[_0x834e('0x43')](_0x834e('0x44'))[_0x834e('0x45')](_0x834e('0x46'));var _0x1a7149=squel[_0x834e('0x42')]()[_0x834e('0x43')](_0x834e('0x47'))[_0x834e('0x43')]('u.fullname')[_0x834e('0x43')](_0x834e('0x48'))['from'](_0x834e('0x49'),'ui')[_0x834e('0x4a')](_0x834e('0x4b'),'u',_0x834e('0x4c'));var _0x19b5ef=squel[_0x834e('0x42')]()['from']('whatsapp_interactions','i')[_0x834e('0x4a')](_0x834e('0x4d'),'c',_0x834e('0x4e'))[_0x834e('0x4a')](_0x834e('0x4b'),'o',_0x834e('0x4f'))[_0x834e('0x4a')](_0x834e('0x50'),'a',_0x834e('0x51'))[_0x834e('0x4a')](_0x834e('0x52'),'me',_0x834e('0x53'))[_0x834e('0x4a')](_0x834e('0x54'),'it',_0x834e('0x55'))[_0x834e('0x4a')](_0x834e('0x46'),'t',_0x834e('0x56'));var _0x420841=squel[_0x834e('0x57')]();var _0x4cfacd=[];var _0x1cc0b8=squel[_0x834e('0x57')]();var _0x4e73e0;if(_0x339e28[_0x834e('0x39')][_0x834e('0x58')]){_0x4e73e0=as['parseSearch'](_0x339e28[_0x834e('0x39')][_0x834e('0x58')]);var _0x2cbc6f=_0x4e73e0[_0x834e('0x59')];for(var _0x4288e4=0x0;_0x4288e4<_0x4e73e0[_0x834e('0x5a')][_0x834e('0x3d')];_0x4288e4++){var _0x4a8b32=_0x4e73e0[_0x834e('0x5a')][_0x4288e4];var _0x8bc6c6='i';var _0x3e0550=_[_0x834e('0x5b')](_0xe103fe,[_0x834e('0x2c'),_0x4a8b32[_0x834e('0x43')]]);if(!_0x3e0550){switch(_0x4a8b32[_0x834e('0x43')]){case _0x834e('0x5c'):if(_0x4a8b32['value']==0x1){_0x19b5ef[_0x834e('0x5d')]('`'+_0x4a8b32['field']+_0x834e('0x5e'));}else{_0x19b5ef['having']('`'+_0x4a8b32[_0x834e('0x43')]+'`\x20>\x200');}break;case'Contact':if(_0x4a8b32[_0x834e('0x5f')]===_0x834e('0x60')){if(_0x4a8b32['value']['split']('\x20')[_0x834e('0x3d')]>0x1){_0x420841[_0x2cbc6f](_0x834e('0x61'),qs[_0x834e('0x62')](_0x4a8b32[_0x834e('0x63')]),null);}else{var _0x21c417='%'+_0x4a8b32[_0x834e('0x63')]+'%';_0x420841[_0x2cbc6f](_0x834e('0x64'),_0x21c417,_0x21c417,_0x21c417);}}else{_0x3e0550=_[_0x834e('0x5b')](_0xe103fe,['name',_0x834e('0x65')]);_0x4a8b32[_0x834e('0x43')]='ContactId';_0x4ca099=as[_0x834e('0x66')](_0x8bc6c6,_0x3e0550['type'],_0x4a8b32);_0x420841[_0x2cbc6f](_0x4ca099[_0x834e('0x67')],_0x4ca099[_0x834e('0x63')]['start'],_0x4ca099[_0x834e('0x63')][_0x834e('0x22')]);}break;case _0x834e('0x68'):var _0x25f720=_0x4a8b32['value'][_0x834e('0x32')](',')[_0x834e('0x2f')](function(_0x1dfd5f){return Number(_0x1dfd5f);});_0x25f720['forEach'](function(_0x246b8e){_0x1cc0b8['or'](_0x834e('0x69'),'%,'+_0x246b8e+',%');});_0x4cfacd=_[_0x834e('0x6a')](_0x4cfacd,_0x25f720);break;case _0x834e('0x6b'):if(_0x4a8b32[_0x834e('0x5f')]===_0x834e('0x60')){_0x420841[_0x2cbc6f](_0x834e('0x6c'),'%'+_0x4a8b32[_0x834e('0x63')]+'%',null);}else{_0x3e0550=_[_0x834e('0x5b')](_0xe103fe,[_0x834e('0x2c'),_0x834e('0x6d')]);_0x4a8b32[_0x834e('0x43')]=_0x834e('0x6d');_0x4ca099=as[_0x834e('0x66')](_0x8bc6c6,_0x3e0550[_0x834e('0x6e')],_0x4a8b32);_0x420841[_0x2cbc6f](_0x4ca099[_0x834e('0x67')],_0x4ca099[_0x834e('0x63')][_0x834e('0x6f')],_0x4ca099[_0x834e('0x63')][_0x834e('0x22')]);}break;case _0x834e('0x70'):_0x4ca099=as[_0x834e('0x66')]('me',null,_0x4a8b32);_0x420841[_0x2cbc6f](_0x4ca099['text'],_0x4ca099[_0x834e('0x63')][_0x834e('0x6f')],_0x4ca099[_0x834e('0x63')][_0x834e('0x22')]);break;}}else{var _0x4ca099=as[_0x834e('0x66')](_0x8bc6c6,_0x3e0550['type'],_0x4a8b32);_0x420841[_0x2cbc6f](_0x4ca099['text'],_0x4ca099[_0x834e('0x63')][_0x834e('0x6f')],_0x4ca099[_0x834e('0x63')][_0x834e('0x22')]);}}}else{var _0x216105=_(_0x339e28[_0x834e('0x39')])[_0x834e('0x71')]()[_0x834e('0x2f')](function(_0x525ed3){return _[_0x834e('0x72')](_0xe103fe,['name',_0x525ed3])?_0x525ed3:undefined;})[_0x834e('0x73')]()[_0x834e('0x63')]();if(!_['isEmpty'](_0x216105)){_0x216105['forEach'](function(_0x4a4def){if(_0x4a4def===_0x834e('0x74')){_0x19b5ef[_0x834e('0x75')](_0x834e('0x76'),[][_0x834e('0x77')](_0x339e28['query'][_0x4a4def]));}else if(_0x4a4def===_0x834e('0x78')){var _0x15018f=JSON[_0x834e('0x79')](_0x339e28[_0x834e('0x39')][_0x4a4def])[_0x834e('0x7a')];var _0x28b5c9=JSON[_0x834e('0x79')](_0x339e28[_0x834e('0x39')][_0x4a4def])[_0x834e('0x7b')];_0x19b5ef[_0x834e('0x75')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x15018f,_0x28b5c9);}else{if(_0x339e28[_0x834e('0x39')][_0x4a4def]===_0x834e('0x7c')){_0x19b5ef[_0x834e('0x75')]('i.'+_0x4a4def+_0x834e('0x7d'));}else{_0x19b5ef['where']('i.'+_0x4a4def+_0x834e('0x7e'),_0x339e28['query'][_0x4a4def]);}}});}if(_0x339e28['query']['read']){if(_0x339e28[_0x834e('0x39')][_0x834e('0x7f')]==0x1){_0x19b5ef['having'](_0x834e('0x80'));}else{_0x19b5ef[_0x834e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x339e28[_0x834e('0x39')][_0x834e('0x81')]){_0x4cfacd=_['isArray'](_0x339e28['query'][_0x834e('0x81')])?_0x339e28[_0x834e('0x39')][_0x834e('0x81')]:new Array(_0x339e28[_0x834e('0x39')][_0x834e('0x81')]);_0x4cfacd['forEach'](function(_0x264a6f){_0x1cc0b8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x264a6f+',%');});}if(_0x339e28[_0x834e('0x39')][_0x834e('0x82')]){var _0x2c758c=_0x339e28['query'][_0x834e('0x82')][_0x834e('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x834e('0x84')](_0x2c758c)){_0x420841['or'](_0x834e('0x85'),_0x2c758c+'%')['or'](_0x834e('0x86'),_0x2c758c+'%');}else{_0x420841['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x834e('0x62')](_0x2c758c))['or'](_0x834e('0x87'),_0x2c758c+'%');}}}_0x19b5ef[_0x834e('0x75')](_0x420841);_0x19b5ef[_0x834e('0x88')](_0x834e('0x89'));var _0x29bfd7={'type':db[_0x834e('0x8a')][_0x834e('0x8b')][_0x834e('0x8c')],'raw':!![]};var _0x1691d5=_0x19b5ef['clone']();_0x1691d5['field']('i.id');_0x1691d5[_0x834e('0x43')](_0x834e('0x8d'),_0x834e('0x5c'));if(_0x4c2ef6[_0x834e('0x3f')]){_0x4c2ef6[_0x834e('0x3f')]['forEach'](function(_0x483bae){var _0x4520fc=_0x483bae[0x0]===_0x834e('0x8e')?_0x483bae[0x0]:'i.'+_0x483bae[0x0];_0x19b5ef[_0x834e('0x3f')](_0x4520fc,_0x483bae[0x1]===_0x834e('0x8f')?![]:!![]);});}if(!_[_0x834e('0x90')](_0x4cfacd)){_0x19b5ef['having'](_0x1cc0b8);_0x1691d5[_0x834e('0x75')](_0x834e('0x91'),_0x4cfacd);}BPromise[_0x834e('0x92')]()['then'](function(){if(!_0x4e73e0){if(_0x339e28[_0x834e('0x39')][_0x834e('0x74')])return;_0x1691d5[_0x834e('0x75')](_0x834e('0x93'));_0x19b5ef[_0x834e('0x75')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x339e28['user'][_0x834e('0x94')]!==_0x834e('0x95'))return;return _0x339e28['user'][_0x834e('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40c401){if(_[_0x834e('0x90')](_0x40c401)){_0x1691d5[_0x834e('0x75')]('i.WhatsappAccountId\x20IS\x20NULL');_0x19b5ef[_0x834e('0x75')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x1691d5['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x834e('0x2f')](_0x40c401,'id'));_0x19b5ef[_0x834e('0x75')](_0x834e('0x76'),_[_0x834e('0x2f')](_0x40c401,'id'));}});})[_0x834e('0x29')](function(){if(_0x339e28[_0x834e('0x97')][_0x834e('0x94')]===_0x834e('0x95')&&!_0x4e73e0&&!_0x339e28[_0x834e('0x39')]['WhatsappAccountId'])return[];return db[_0x834e('0x98')]['query'](_0x1691d5[_0x834e('0x99')](),_0x29bfd7);})[_0x834e('0x29')](function(_0x38bfa4){_0x513f36[_0x834e('0x26')]=_0x38bfa4[_0x834e('0x3d')];if(_0x513f36[_0x834e('0x26')]===0x0)return[];return db['sequelize']['query'](_0x5a5807[_0x834e('0x99')](),_0x29bfd7)[_0x834e('0x29')](function(_0x4eff8d){_0x1df5b0=_[_0x834e('0x9a')](_0x4eff8d,'id');_0x29bfd7=_[_0x834e('0x9b')](_0x29bfd7,{'model':db[_0x834e('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x339e28[_0x834e('0x39')][_0x834e('0x3c')]){_0x4c2ef6['attributes'][_0x834e('0x33')](function(_0x78917b){_0x19b5ef['field']('i.'+_0x78917b);});}else{_0x19b5ef['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x834e('0x5c'));_0x19b5ef[_0x834e('0x43')]('a.key',_0x834e('0x9d'));_0x19b5ef[_0x834e('0x43')]('a.mandatoryDisposition',_0x834e('0x9e'));_0x19b5ef['field']('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',_0x834e('0x8e'));_0x19b5ef[_0x834e('0x43')](_0x834e('0x9f'));_0x19b5ef[_0x834e('0x43')]('c.firstName',_0x834e('0xa0'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa1'),_0x834e('0xa2'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa3'),_0x834e('0xa4'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa5'),_0x834e('0xa6'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa7'),_0x834e('0xa8'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xa9'),_0x834e('0xaa'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xab'),_0x834e('0xac'));_0x19b5ef[_0x834e('0x43')](_0x834e('0xad'),_0x834e('0xae'));_0x19b5ef['field'](_0x834e('0xaf'),_0x834e('0x30'));}if(_0x4c2ef6[_0x834e('0x25')])_0x19b5ef[_0x834e('0x25')](_0x4c2ef6[_0x834e('0x25')]);if(_0x4c2ef6[_0x834e('0x23')])_0x19b5ef[_0x834e('0x23')](_0x4c2ef6[_0x834e('0x23')]);return db[_0x834e('0x98')]['query'](_0x19b5ef['toString'](),_0x29bfd7);})['then'](function(_0x150ed8){if(_0x150ed8['length']>0x0)_0x1a7149[_0x834e('0x75')](_0x834e('0xb0'),_[_0x834e('0x2f')](_0x150ed8,'id'));return db['sequelize'][_0x834e('0x39')](_0x1a7149[_0x834e('0x99')](),_0x29bfd7)[_0x834e('0x29')](function(_0x1594ef){var _0x3ef0ad=_[_0x834e('0xb1')](_0x1594ef,'WhatsappInteractionId');var _0x10dd7b=[];_0x150ed8[_0x834e('0x33')](function(_0x24ff45){_0x10dd7b[_0x834e('0xb2')](updateWhatsappInteraction(_0x24ff45,_0x1df5b0,_0x3ef0ad));});return BPromise[_0x834e('0xb3')](_0x10dd7b);});});})['then'](function(_0x4ebeba){_0x513f36['rows']=_0x4ebeba;return _0x513f36;})['then'](respondWithFilteredResult(_0x1b76dd,_0x4c2ef6))[_0x834e('0x34')](handleError(_0x1b76dd,null));};exports[_0x834e('0xb4')]=function(_0x56fc05,_0x3bd1e7){var _0xf9fec9={'raw':![],'where':{'id':_0x56fc05[_0x834e('0xb5')]['id']}},_0x4fb709={};_0x4fb709[_0x834e('0x38')]=_[_0x834e('0x71')](db[_0x834e('0x9c')][_0x834e('0x36')]);_0x4fb709[_0x834e('0x39')]=_['keys'](_0x56fc05['query']);_0x4fb709[_0x834e('0x41')]=_[_0x834e('0x3b')](_0x4fb709[_0x834e('0x38')],_0x4fb709['query']);_0xf9fec9[_0x834e('0x3a')]=_[_0x834e('0x3b')](_0x4fb709['model'],qs[_0x834e('0x3c')](_0x56fc05[_0x834e('0x39')][_0x834e('0x3c')]));_0xf9fec9[_0x834e('0x3a')]=_0xf9fec9['attributes'][_0x834e('0x3d')]?_0xf9fec9['attributes']:_0x4fb709['model'];if(_0x56fc05[_0x834e('0x39')][_0x834e('0xb6')]){_0xf9fec9[_0x834e('0xb7')]=[{'all':!![]}];}_0xf9fec9=_[_0x834e('0x9b')]({},_0xf9fec9,_0x56fc05[_0x834e('0xb8')]);return db[_0x834e('0x9c')]['find'](_0xf9fec9)['then'](handleEntityNotFound(_0x3bd1e7,null))[_0x834e('0x29')](respondWithResult(_0x3bd1e7,null))[_0x834e('0x34')](handleError(_0x3bd1e7,null));};exports[_0x834e('0xb9')]=function(_0x1421b3,_0x476cb1){return db[_0x834e('0x9c')][_0x834e('0xb9')](_0x1421b3['body'],{})[_0x834e('0x29')](respondWithResult(_0x476cb1,0xc9))[_0x834e('0x34')](handleError(_0x476cb1,null));};exports['update']=function(_0x4278ab,_0x6a507a){if(_0x4278ab[_0x834e('0x70')]['id']){delete _0x4278ab[_0x834e('0x70')]['id'];}return db[_0x834e('0x9c')][_0x834e('0x5b')]({'where':{'id':_0x4278ab[_0x834e('0xb5')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x6a507a,null))[_0x834e('0x29')](saveUpdates(_0x4278ab[_0x834e('0x70')],null))[_0x834e('0x29')](respondWithResult(_0x6a507a,null))[_0x834e('0x34')](handleError(_0x6a507a,null));};exports[_0x834e('0xba')]=function(_0x1306d9,_0x5673e6){return db[_0x834e('0x9c')][_0x834e('0x5b')]({'where':{'id':_0x1306d9['params']['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x5673e6,null))['then'](removeEntity(_0x5673e6,null))[_0x834e('0x34')](handleError(_0x5673e6,null));};exports['describe']=function(_0x16a42b,_0x560d10){return db[_0x834e('0x9c')][_0x834e('0xbb')]()[_0x834e('0x29')](respondWithResult(_0x560d10,null))[_0x834e('0x34')](handleError(_0x560d10,null));};exports['addMessage']=function(_0x3d4608,_0x38085e,_0x375fec){return db[_0x834e('0xbc')][_0x834e('0x5b')]({'where':{'id':_0x3d4608[_0x834e('0xb5')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x38085e,null))[_0x834e('0x29')](function(_0x2aa430){if(_0x2aa430){return _0x2aa430[_0x834e('0xbd')](_0x3d4608[_0x834e('0x70')][_0x834e('0xbe')],_[_0x834e('0xbf')](_0x3d4608[_0x834e('0x70')],[_0x834e('0xbe'),'id'])||{});}})[_0x834e('0x29')](respondWithResult(_0x38085e,null))[_0x834e('0x34')](handleError(_0x38085e,null));};exports['getMessages']=function(_0x4b7277,_0x2df814,_0x349685){var _0x3f52b9={'raw':![],'where':{}};var _0x213303={};var _0x3bf1b6={'count':0x0,'rows':[]};return db[_0x834e('0x9c')][_0x834e('0xc0')]({'where':{'id':_0x4b7277[_0x834e('0xb5')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x2df814,null))[_0x834e('0x29')](function(_0x25f1f9){if(_0x25f1f9){_0x213303[_0x834e('0x38')]=_['keys'](db[_0x834e('0xbc')]['rawAttributes']);_0x213303[_0x834e('0x39')]=_[_0x834e('0x71')](_0x4b7277[_0x834e('0x39')]);_0x213303['filters']=_[_0x834e('0x3b')](_0x213303[_0x834e('0x38')],_0x213303['query']);_0x3f52b9['attributes']=_[_0x834e('0x3b')](_0x213303[_0x834e('0x38')],qs['fields'](_0x4b7277[_0x834e('0x39')][_0x834e('0x3c')]));_0x3f52b9[_0x834e('0x3a')]=_0x3f52b9[_0x834e('0x3a')][_0x834e('0x3d')]?_0x3f52b9['attributes']:_0x213303['model'];if(!_0x4b7277[_0x834e('0x39')]['hasOwnProperty']('nolimit')){_0x3f52b9['limit']=qs[_0x834e('0x25')](_0x4b7277[_0x834e('0x39')]['limit']);_0x3f52b9[_0x834e('0x23')]=qs[_0x834e('0x23')](_0x4b7277[_0x834e('0x39')][_0x834e('0x23')]);}_0x3f52b9['order']=qs[_0x834e('0x40')](_0x4b7277[_0x834e('0x39')][_0x834e('0x40')]);_0x3f52b9['where']=qs[_0x834e('0x41')](_['pick'](_0x4b7277[_0x834e('0x39')],_0x213303['filters']));_0x3f52b9[_0x834e('0x75')][_0x834e('0xc1')]=_0x25f1f9['id'];if(_0x4b7277['query'][_0x834e('0x82')]){_0x3f52b9[_0x834e('0x75')]=_[_0x834e('0x9b')](_0x3f52b9[_0x834e('0x75')],{'$or':_[_0x834e('0x2f')](_0x3f52b9[_0x834e('0x3a')],function(_0x5bb5ff){var _0x2d4b29={};_0x2d4b29[_0x5bb5ff]={'$like':'%'+_0x4b7277[_0x834e('0x39')][_0x834e('0x82')]+'%'};return _0x2d4b29;})});}if(_0x4b7277[_0x834e('0x39')][_0x834e('0x7a')]){var _0x1b8e67=_0x4b7277['query'][_0x834e('0x7a')]['split'](',');var _0x4d5afa={};_0x4d5afa[_0x1b8e67[0x0]]={'$gte':moment(_0x1b8e67[0x1])[_0x834e('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f52b9['where']=_[_0x834e('0x9b')](_0x3f52b9[_0x834e('0x75')],_0x4d5afa);}_0x3f52b9=_[_0x834e('0x9b')]({},_0x3f52b9,_0x4b7277[_0x834e('0xb8')]);return db[_0x834e('0xbc')][_0x834e('0x26')]({'where':_0x3f52b9[_0x834e('0x75')]})[_0x834e('0x29')](function(_0x1d3ca9){_0x3bf1b6[_0x834e('0x26')]=_0x1d3ca9;if(_0x4b7277[_0x834e('0x39')][_0x834e('0xb6')]){_0x3f52b9[_0x834e('0xb7')]=[{'all':!![]}];}return db[_0x834e('0xbc')]['findAll'](_0x3f52b9);})[_0x834e('0x29')](function(_0x4874e1){_0x3bf1b6[_0x834e('0xc3')]=_0x4874e1;return _0x3bf1b6;});}})[_0x834e('0x29')](respondWithFilteredResult(_0x2df814,_0x3f52b9))[_0x834e('0x34')](handleError(_0x2df814,null));};exports[_0x834e('0xc4')]=function(_0x5ab11f,_0x5f558a,_0x37d8dd){return db[_0x834e('0x9c')]['find']({'where':{'id':_0x5ab11f[_0x834e('0xb5')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x5f558a,null))['then'](function(_0x231970){if(_0x231970){return _0x231970[_0x834e('0xc5')](_0x5ab11f[_0x834e('0x70')][_0x834e('0xbe')],_['omit'](_0x5ab11f['body'],['ids','id'])||{})['spread'](function(){return db[_0x834e('0x68')][_0x834e('0xc6')]({'attributes':['id','name',_0x834e('0x44')],'where':{'id':_0x5ab11f['body'][_0x834e('0xbe')]}});})[_0x834e('0x29')](function(_0x343a59){socket[_0x834e('0xc7')](_0x834e('0xc8'),{'id':Number(_0x5ab11f[_0x834e('0xb5')]['id']),'tags':_0x343a59||[]});return{'id':Number(_0x5ab11f[_0x834e('0xb5')]['id']),'tags':_0x343a59||[]};});}})['then'](respondWithResult(_0x5f558a,null))[_0x834e('0x34')](handleError(_0x5f558a,null));};exports[_0x834e('0xc9')]=function(_0x59ac23,_0x22f4c7,_0x4551cb){return db['WhatsappInteraction']['find']({'where':{'id':_0x59ac23['params']['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x22f4c7,null))[_0x834e('0x29')](function(_0x29105a){if(_0x29105a){return _0x29105a['removeTags'](_0x59ac23[_0x834e('0x39')][_0x834e('0xbe')]);}})[_0x834e('0x29')](respondWithStatusCode(_0x22f4c7,null))[_0x834e('0x34')](handleError(_0x22f4c7,null));};exports[_0x834e('0xca')]=function(_0xad7b72,_0x19cb0b){var _0x13af70=moment()[_0x834e('0xcb')]()[_0x834e('0x99')]();var _0x48b6c4=path['join'](config[_0x834e('0xcc')],_0x834e('0xcd'),_0x834e('0xce'),_0x834e('0xcf'));var _0x4303a6=path[_0x834e('0xd0')](config[_0x834e('0xcc')],_0x834e('0xcd'),_0x834e('0xce'),_0x834e('0xd1'));var _0x264adc=path[_0x834e('0xd0')](_0x48b6c4,_0x13af70);var _0x13b354=util['format'](_0x834e('0xd2'),_0xad7b72[_0x834e('0xb5')]['id'],_0x13af70);var _0x3f5b2e=path[_0x834e('0xd0')](_0x48b6c4,_0x13b354);var _0x495697=[];_0x495697['push']({'model':db['User'],'as':_0x834e('0x6b'),'attributes':['id',_0x834e('0xd3')],'raw':!![]});_0x495697[_0x834e('0xb2')]({'model':db[_0x834e('0xd4')],'as':_0x834e('0xd5'),'attributes':['id',_0x834e('0xd6'),_0x834e('0xd7')],'raw':!![]});if(_0xad7b72[_0x834e('0x39')]['attachments']){_0x495697['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x2024dd=[{'model':db[_0x834e('0xbc')],'as':_0x834e('0xd8'),'attributes':['id',_0x834e('0x70'),_0x834e('0x78'),_0x834e('0xd9'),_0x834e('0xda'),_0x834e('0x7f')],'include':_0x495697}];_0x2024dd[_0x834e('0xb2')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id','name']});_0x2024dd['push']({'model':db[_0x834e('0x6b')],'as':_0x834e('0xdb'),'attributes':['id',_0x834e('0xd3')]});return db[_0x834e('0x9c')][_0x834e('0x5b')]({'where':{'id':_0xad7b72[_0x834e('0xb5')]['id']},'include':_0x2024dd})[_0x834e('0x29')](handleEntityNotFound(_0x19cb0b,null))[_0x834e('0x29')](function(_0x86d08c){if(_0x86d08c){var _0xcd64c2=_0x86d08c[_0x834e('0xdc')]({'plain':!![]});fs[_0x834e('0xdd')](_0x264adc);var _0x1fd72b={'channel':_0x834e('0xde'),'account':_0xcd64c2[_0x834e('0xdf')][_0x834e('0x2c')],'agent':_0xcd64c2['Owner']?_0xcd64c2[_0x834e('0xdb')]['fullname']:_0x834e('0xe0'),'createdAt':moment(_0xcd64c2[_0x834e('0x78')])[_0x834e('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x834e('0x99')](),'closedAt':_0xcd64c2[_0x834e('0xe1')]?moment(_0xcd64c2['closedAt'])['format'](_0x834e('0xe2'))[_0x834e('0x99')]():'','disposition':_0xcd64c2[_0x834e('0xe3')],'messages':_(_0xcd64c2[_0x834e('0xd8')])[_0x834e('0x82')]({'secret':![]})[_0x834e('0x2f')](function(_0x3eb2e8){if(_0x3eb2e8[_0x834e('0xe4')]){var _0x569a80=path[_0x834e('0xd0')](_0x4303a6,_0x3eb2e8[_0x834e('0xe4')][_0x834e('0xe5')]);if(fs[_0x834e('0xe6')](_0x569a80)){fs[_0x834e('0xe7')](_0x569a80)[_0x834e('0xe8')](fs[_0x834e('0xe9')](path['join'](_0x264adc,_0x3eb2e8[_0x834e('0xe4')]['basename'])));}}return{'date':moment(_0x3eb2e8['createdAt'])[_0x834e('0xc2')](_0x834e('0xe2'))['toString'](),'sender':_0x3eb2e8[_0x834e('0xd9')]===_0x834e('0xea')?_0x3eb2e8['User']?_0x3eb2e8[_0x834e('0x6b')][_0x834e('0xd3')]:'System':_0x3eb2e8['Contact'][_0x834e('0xd6')]+(_0x3eb2e8[_0x834e('0xd5')]['lastName']?'\x20'+_0x3eb2e8['Contact'][_0x834e('0xd7')]:''),'body':_0x3eb2e8[_0x834e('0xe4')]?_0x3eb2e8['Attachment']['basename']:_0x3eb2e8['body'],'direction':_0x3eb2e8['direction']===_0x834e('0xea')?'A':'C','secret':_0x3eb2e8['secret'],'read':_0x3eb2e8[_0x834e('0x7f')],'attachment':_0x3eb2e8['Attachment']};})[_0x834e('0x63')]()};return ejs[_0x834e('0xeb')](path[_0x834e('0xd0')](config[_0x834e('0xcc')],'server',_0x834e('0xec'),_0x834e('0xed')),{'interaction':_0x1fd72b})[_0x834e('0x29')](function(_0x37bb7b){var _0x3a3a6c=path[_0x834e('0xd0')](_0x264adc,_0x834e('0xee')+_0xcd64c2['id']+'-'+_0x13af70+_0x834e('0xef'));var _0x464ae6={'path':_0x3a3a6c,'channel':_0x834e('0xde'),'interactionId':_0xcd64c2['id']};return pdf['createPdfFromHTML'](_0x37bb7b,_0x464ae6);})[_0x834e('0x29')](function(){return new BPromise(function(_0x48f8da,_0x3980c0){zipdir(_0x264adc,{'saveTo':_0x3f5b2e},function(_0x376850,_0x2eedc5){if(_0x376850)return _0x3980c0(_0x376850);return _0x48f8da(_0x2eedc5);});})[_0x834e('0x29')](function(){return new BPromise(function(_0x185167,_0x507578){rimraf(_0x264adc,function(_0x41698e){if(_0x41698e)_0x507578(_0x41698e);return _0x185167();});});})['then'](function(){return _0x19cb0b['download'](_0x3f5b2e,_0x13b354,function(_0x21bf6a){if(_0x21bf6a){console[_0x834e('0xf0')](_0x834e('0xf1'),_0x21bf6a);}else{fs['unlinkSync'](_0x3f5b2e);}});});});}else{return _0x19cb0b[_0x834e('0xf2')](0xc8);}})[_0x834e('0x34')](handleError(_0x19cb0b,null));}; \ No newline at end of file +var _0x27bf=['Tag','removeTags','download','unix','join','tmp','root','server','format','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','basename','existsSync','createReadStream','pipe','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','catch','index','WhatsappInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','length','conditions','find','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','o.fullname','groupBy','WhatsappInteractionId','push','all','rows','show','rawAttributes','include','options','create','params','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','$gte','includeAll','findAll','setTags','spread'];(function(_0x8319e4,_0x1d1ec8){var _0x37ca5d=function(_0x2536a0){while(--_0x2536a0){_0x8319e4['push'](_0x8319e4['shift']());}};_0x37ca5d(++_0x1d1ec8);}(_0x27bf,0x117));var _0xf27b=function(_0x4f0ca5,_0x389278){_0x4f0ca5=_0x4f0ca5-0x0;var _0x2131f5=_0x27bf[_0x4f0ca5];return _0x2131f5;};'use strict';var emlformat=require(_0xf27b('0x0'));var rimraf=require(_0xf27b('0x1'));var zipdir=require(_0xf27b('0x2'));var jsonpatch=require(_0xf27b('0x3'));var rp=require(_0xf27b('0x4'));var moment=require(_0xf27b('0x5'));var BPromise=require(_0xf27b('0x6'));var Mustache=require(_0xf27b('0x7'));var util=require(_0xf27b('0x8'));var path=require(_0xf27b('0x9'));var sox=require(_0xf27b('0xa'));var csv=require('to-csv');var ejs=require(_0xf27b('0xb'));var fs=require('fs');var fs_extra=require(_0xf27b('0xc'));var _=require(_0xf27b('0xd'));var squel=require(_0xf27b('0xe'));var crypto=require(_0xf27b('0xf'));var jsforce=require(_0xf27b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf27b('0x11'));var querystring=require(_0xf27b('0x12'));var Papa=require(_0xf27b('0x13'));var Redis=require(_0xf27b('0x14'));var authService=require(_0xf27b('0x15'));var qs=require(_0xf27b('0x16'));var as=require(_0xf27b('0x17'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf27b('0x18'));var utils=require('../../config/utils');var config=require(_0xf27b('0x19'));var licenseUtil=require(_0xf27b('0x1a'));var db=require(_0xf27b('0x1b'))['db'];config[_0xf27b('0x1c')]=_['defaults'](config[_0xf27b('0x1c')],{'host':_0xf27b('0x1d'),'port':0x18eb});var socket=require(_0xf27b('0x1e'))(new Redis(config[_0xf27b('0x1c')]));require('./whatsappInteraction.socket')[_0xf27b('0x1f')](socket);function respondWithStatusCode(_0x3b7f5f,_0x5e7853){_0x5e7853=_0x5e7853||0xcc;return function(_0x552f2d){if(_0x552f2d){return _0x3b7f5f[_0xf27b('0x20')](_0x5e7853);}return _0x3b7f5f['status'](_0x5e7853)[_0xf27b('0x21')]();};}function respondWithResult(_0x12db19,_0x1fc319){_0x1fc319=_0x1fc319||0xc8;return function(_0x5305d9){if(_0x5305d9){return _0x12db19[_0xf27b('0x22')](_0x1fc319)[_0xf27b('0x23')](_0x5305d9);}};}function respondWithFilteredResult(_0x1350d8,_0x4ae833){return function(_0x472f1a){if(_0x472f1a){var _0x2f6382=typeof _0x4ae833[_0xf27b('0x24')]===_0xf27b('0x25')&&typeof _0x4ae833[_0xf27b('0x26')]===_0xf27b('0x25');var _0x28b7e6=_0x472f1a[_0xf27b('0x27')];var _0x27042a=_0x2f6382?0x0:_0x4ae833['offset'];var _0x12502e=_0x2f6382?_0x472f1a['count']:_0x4ae833[_0xf27b('0x24')]+_0x4ae833[_0xf27b('0x26')];var _0x4124b5;if(_0x12502e>=_0x28b7e6){_0x12502e=_0x28b7e6;_0x4124b5=0xc8;}else{_0x4124b5=0xce;}_0x1350d8[_0xf27b('0x22')](_0x4124b5);return _0x1350d8['set'](_0xf27b('0x28'),_0x27042a+'-'+_0x12502e+'/'+_0x28b7e6)[_0xf27b('0x23')](_0x472f1a);}return null;};}function patchUpdates(_0x1c586e){return function(_0x38902c){try{jsonpatch['apply'](_0x38902c,_0x1c586e,!![]);}catch(_0x3f4814){return BPromise[_0xf27b('0x29')](_0x3f4814);}return _0x38902c[_0xf27b('0x2a')]();};}function saveUpdates(_0xd9a319,_0x2a975d){return function(_0x262c11){if(_0x262c11){return _0x262c11['update'](_0xd9a319)['then'](function(_0x5017ec){return _0x5017ec;});}return null;};}function removeEntity(_0x1422c3,_0x3e26c9){return function(_0x1166db){if(_0x1166db){return _0x1166db['destroy']()[_0xf27b('0x2b')](function(){_0x1422c3['status'](0xcc)[_0xf27b('0x21')]();});}};}function handleEntityNotFound(_0x190729,_0x2817cd){return function(_0x1502ad){if(!_0x1502ad){_0x190729['sendStatus'](0x194);}return _0x1502ad;};}function handleError(_0x3ff5bc,_0x280246){_0x280246=_0x280246||0x1f4;return function(_0x564943){logger[_0xf27b('0x2c')](_0x564943[_0xf27b('0x2d')]);if(_0x564943[_0xf27b('0x2e')]){delete _0x564943[_0xf27b('0x2e')];}_0x3ff5bc[_0xf27b('0x22')](_0x280246)[_0xf27b('0x2f')](_0x564943);};}function getInteractionUsers(_0x5eddd6,_0x5202c1){return new BPromise(function(_0x780e4,_0x2b0cb9){try{if(_0x5202c1[_0x5eddd6['id']]){_0x5eddd6[_0xf27b('0x30')]=_[_0xf27b('0x31')](_0x5202c1[_0x5eddd6['id']],function(_0x6033f1){return{'id':_0x6033f1['id'],'fullname':_0x6033f1[_0xf27b('0x32')]};});}}catch(_0x9b7f){_0x2b0cb9(_0x9b7f);}_0x780e4(_0x5eddd6);});}function getInteractionTags(_0x174080,_0x159c89){return new BPromise(function(_0x4ddacc,_0x83c81c){try{if(_0x174080[_0xf27b('0x33')]){_0x174080[_0xf27b('0x34')]=[];_0x174080[_0xf27b('0x33')][_0xf27b('0x35')](',')['forEach'](function(_0x30fb76){_0x174080[_0xf27b('0x34')]['push'](_0x159c89[_0x30fb76]);});}delete _0x174080['TagIds'];}catch(_0x291096){_0x83c81c(_0x291096);}_0x4ddacc(_0x174080);});}function updateWhatsappInteraction(_0x3c61d3,_0x3afeca,_0x457291){return new BPromise(function(_0x4ce989,_0x5dacdb){return getInteractionUsers(_0x3c61d3,_0x457291)[_0xf27b('0x2b')](function(_0x35ded7){return getInteractionTags(_0x35ded7,_0x3afeca);})['then'](function(_0x4d4ac6){_0x4ce989(_0x4d4ac6);})[_0xf27b('0x36')](function(_0x21698e){_0x5dacdb(_0x21698e);});});}exports[_0xf27b('0x37')]=function(_0x2ebafd,_0x3f435a){var _0x537ca9={},_0x5cec25={},_0x3441bd={'count':0x0,'rows':[]};var _0x210ae4=_[_0xf27b('0x31')](db[_0xf27b('0x38')]['rawAttributes'],function(_0x2272a4){return{'name':_0x2272a4[_0xf27b('0x39')],'type':_0x2272a4[_0xf27b('0x3a')][_0xf27b('0x3b')]};});_0x5cec25[_0xf27b('0x3c')]=_['map'](_0x210ae4,_0xf27b('0x2e'));_0x5cec25[_0xf27b('0x3d')]=_[_0xf27b('0x3e')](_0x2ebafd[_0xf27b('0x3d')]);_0x5cec25[_0xf27b('0x3f')]=_[_0xf27b('0x40')](_0x5cec25['model'],_0x5cec25[_0xf27b('0x3d')]);_0x537ca9['attributes']=_[_0xf27b('0x40')](_0x5cec25[_0xf27b('0x3c')],qs[_0xf27b('0x41')](_0x2ebafd['query'][_0xf27b('0x41')]));_0x537ca9[_0xf27b('0x42')]=_0x537ca9[_0xf27b('0x42')]['length']?_0x537ca9[_0xf27b('0x42')]:_0x5cec25[_0xf27b('0x3c')];if(!_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x43')]('nolimit')){_0x537ca9['limit']=qs['limit'](_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x26')]);_0x537ca9[_0xf27b('0x24')]=qs[_0xf27b('0x24')](_0x2ebafd['query'][_0xf27b('0x24')]);}_0x537ca9['order']=qs[_0xf27b('0x44')](_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x44')]);_0x537ca9[_0xf27b('0x45')]=qs[_0xf27b('0x3f')](_[_0xf27b('0x46')](_0x2ebafd[_0xf27b('0x3d')],_0x5cec25[_0xf27b('0x3f')]),_0x210ae4);var _0x1a1e13=[];var _0x8913e5=squel[_0xf27b('0x47')]()[_0xf27b('0x48')]('id')[_0xf27b('0x48')](_0xf27b('0x2e'))[_0xf27b('0x48')](_0xf27b('0x49'))['from'](_0xf27b('0x4a'));var _0x75cfea=squel[_0xf27b('0x47')]()['field'](_0xf27b('0x4b'))[_0xf27b('0x48')](_0xf27b('0x4c'))[_0xf27b('0x48')](_0xf27b('0x4d'))[_0xf27b('0x4e')](_0xf27b('0x4f'),'ui')[_0xf27b('0x50')](_0xf27b('0x51'),'u',_0xf27b('0x52'));var _0x5cde81=squel[_0xf27b('0x47')]()[_0xf27b('0x4e')](_0xf27b('0x53'),'i')[_0xf27b('0x50')](_0xf27b('0x54'),'c',_0xf27b('0x55'))['left_join']('users','o',_0xf27b('0x56'))[_0xf27b('0x50')](_0xf27b('0x57'),'a',_0xf27b('0x58'))[_0xf27b('0x50')](_0xf27b('0x59'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xf27b('0x50')]('whatsapp_interaction_has_tags','it',_0xf27b('0x5a'))[_0xf27b('0x50')](_0xf27b('0x4a'),'t',_0xf27b('0x5b'));var _0x479f98=squel['expr']();var _0x33148b=[];var _0x320915=squel[_0xf27b('0x5c')]();var _0x22186c;if(_0x2ebafd['query']['search']){_0x22186c=as[_0xf27b('0x5d')](_0x2ebafd[_0xf27b('0x3d')]['search']);var _0xe4ea01=_0x22186c[_0xf27b('0x5e')];for(var _0x253f6b=0x0;_0x253f6b<_0x22186c['conditions'][_0xf27b('0x5f')];_0x253f6b++){var _0x5b929e=_0x22186c[_0xf27b('0x60')][_0x253f6b];var _0x512319='i';var _0x4d4413=_[_0xf27b('0x61')](_0x210ae4,['name',_0x5b929e[_0xf27b('0x48')]]);if(!_0x4d4413){switch(_0x5b929e['field']){case'unreadMessages':if(_0x5b929e[_0xf27b('0x62')]==0x1){_0x5cde81[_0xf27b('0x63')]('`'+_0x5b929e['field']+'`\x20=\x200');}else{_0x5cde81['having']('`'+_0x5b929e[_0xf27b('0x48')]+_0xf27b('0x64'));}break;case _0xf27b('0x65'):if(_0x5b929e[_0xf27b('0x66')]===_0xf27b('0x67')){if(_0x5b929e[_0xf27b('0x62')][_0xf27b('0x35')]('\x20')[_0xf27b('0x5f')]>0x1){_0x479f98[_0xe4ea01](_0xf27b('0x68'),qs['getFullTextValue'](_0x5b929e[_0xf27b('0x62')]),null);}else{var _0x144bb6='%'+_0x5b929e['value']+'%';_0x479f98[_0xe4ea01]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x144bb6,_0x144bb6,_0x144bb6);}}else{_0x4d4413=_['find'](_0x210ae4,[_0xf27b('0x2e'),'ContactId']);_0x5b929e[_0xf27b('0x48')]=_0xf27b('0x69');_0x13aea3=as[_0xf27b('0x6a')](_0x512319,_0x4d4413[_0xf27b('0x3a')],_0x5b929e);_0x479f98[_0xe4ea01](_0x13aea3[_0xf27b('0x6b')],_0x13aea3[_0xf27b('0x62')][_0xf27b('0x6c')],_0x13aea3[_0xf27b('0x62')]['end']);}break;case'Tag':var _0x3ab5eb=_0x5b929e[_0xf27b('0x62')][_0xf27b('0x35')](',')[_0xf27b('0x31')](function(_0x2d2665){return Number(_0x2d2665);});_0x3ab5eb[_0xf27b('0x6d')](function(_0x16d3ad){_0x320915['or'](_0xf27b('0x6e'),'%,'+_0x16d3ad+',%');});_0x33148b=_[_0xf27b('0x6f')](_0x33148b,_0x3ab5eb);break;case'User':if(_0x5b929e[_0xf27b('0x66')]===_0xf27b('0x67')){_0x479f98[_0xe4ea01](_0xf27b('0x70'),'%'+_0x5b929e['value']+'%',null);}else{_0x4d4413=_[_0xf27b('0x61')](_0x210ae4,['name',_0xf27b('0x71')]);_0x5b929e[_0xf27b('0x48')]=_0xf27b('0x71');_0x13aea3=as['buildExpression'](_0x512319,_0x4d4413[_0xf27b('0x3a')],_0x5b929e);_0x479f98[_0xe4ea01](_0x13aea3[_0xf27b('0x6b')],_0x13aea3[_0xf27b('0x62')][_0xf27b('0x6c')],_0x13aea3[_0xf27b('0x62')][_0xf27b('0x21')]);}break;case _0xf27b('0x72'):_0x13aea3=as[_0xf27b('0x6a')]('me',null,_0x5b929e);_0x479f98[_0xe4ea01](_0x13aea3[_0xf27b('0x6b')],_0x13aea3[_0xf27b('0x62')][_0xf27b('0x6c')],_0x13aea3[_0xf27b('0x62')][_0xf27b('0x21')]);break;}}else{var _0x13aea3=as[_0xf27b('0x6a')](_0x512319,_0x4d4413[_0xf27b('0x3a')],_0x5b929e);_0x479f98[_0xe4ea01](_0x13aea3[_0xf27b('0x6b')],_0x13aea3['value'][_0xf27b('0x6c')],_0x13aea3[_0xf27b('0x62')][_0xf27b('0x21')]);}}}else{var _0x3cb377=_(_0x2ebafd['query'])['keys']()['map'](function(_0x1e7be3){return _[_0xf27b('0x73')](_0x210ae4,[_0xf27b('0x2e'),_0x1e7be3])?_0x1e7be3:undefined;})[_0xf27b('0x74')]()['value']();if(!_[_0xf27b('0x75')](_0x3cb377)){_0x3cb377[_0xf27b('0x6d')](function(_0x4482ef){if(_0x4482ef===_0xf27b('0x76')){_0x5cde81[_0xf27b('0x45')](_0xf27b('0x77'),[][_0xf27b('0x78')](_0x2ebafd[_0xf27b('0x3d')][_0x4482ef]));}else if(_0x4482ef===_0xf27b('0x79')){var _0x581926=JSON[_0xf27b('0x7a')](_0x2ebafd[_0xf27b('0x3d')][_0x4482ef])['$gte'];var _0x45bd9c=JSON['parse'](_0x2ebafd[_0xf27b('0x3d')][_0x4482ef])['$lte'];_0x5cde81[_0xf27b('0x45')](_0xf27b('0x7b'),_0x581926,_0x45bd9c);}else{if(_0x2ebafd[_0xf27b('0x3d')][_0x4482ef]==='null'){_0x5cde81[_0xf27b('0x45')]('i.'+_0x4482ef+_0xf27b('0x7c'));}else{_0x5cde81[_0xf27b('0x45')]('i.'+_0x4482ef+_0xf27b('0x7d'),_0x2ebafd[_0xf27b('0x3d')][_0x4482ef]);}}});}if(_0x2ebafd['query'][_0xf27b('0x7e')]){if(_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x7e')]==0x1){_0x5cde81[_0xf27b('0x63')](_0xf27b('0x7f'));}else{_0x5cde81[_0xf27b('0x63')](_0xf27b('0x80'));}}if(_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x81')]){_0x33148b=_[_0xf27b('0x82')](_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x81')])?_0x2ebafd['query']['tag']:new Array(_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x81')]);_0x33148b[_0xf27b('0x6d')](function(_0x2f551c){_0x320915['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2f551c+',%');});}if(_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x83')]){var _0x36cfad=_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x83')][_0xf27b('0x84')]('\x5c','\x5c\x5c')[_0xf27b('0x84')](/'/g,'\x27\x27');if(qs[_0xf27b('0x85')](_0x36cfad)){_0x479f98['or'](_0xf27b('0x86'),_0x36cfad+'%')['or']('i.phone\x20LIKE\x20?',_0x36cfad+'%');}else{_0x479f98['or'](_0xf27b('0x87'),qs[_0xf27b('0x88')](_0x36cfad))['or'](_0xf27b('0x89'),_0x36cfad+'%');}}}_0x5cde81[_0xf27b('0x45')](_0x479f98);_0x5cde81[_0xf27b('0x8a')](_0xf27b('0x8b'));var _0x5093c3={'type':db[_0xf27b('0x8c')][_0xf27b('0x8d')][_0xf27b('0x8e')],'raw':!![]};var _0x4c8f6a=_0x5cde81[_0xf27b('0x8f')]();_0x4c8f6a[_0xf27b('0x48')](_0xf27b('0x8b'));_0x4c8f6a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf27b('0x90'));if(_0x537ca9['order']){_0x537ca9[_0xf27b('0x91')]['forEach'](function(_0x1e3a88){var _0x29b0ba=_0x1e3a88[0x0]===_0xf27b('0x92')?_0x1e3a88[0x0]:'i.'+_0x1e3a88[0x0];_0x5cde81[_0xf27b('0x91')](_0x29b0ba,_0x1e3a88[0x1]===_0xf27b('0x93')?![]:!![]);});}if(!_[_0xf27b('0x75')](_0x33148b)){_0x5cde81[_0xf27b('0x63')](_0x320915);_0x4c8f6a[_0xf27b('0x45')](_0xf27b('0x94'),_0x33148b);}BPromise[_0xf27b('0x95')]()['then'](function(){if(!_0x22186c){if(_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x76')])return;_0x4c8f6a[_0xf27b('0x45')](_0xf27b('0x96'));_0x5cde81[_0xf27b('0x45')](_0xf27b('0x96'));return;}if(_0x2ebafd[_0xf27b('0x97')][_0xf27b('0x98')]!==_0xf27b('0x99'))return;return _0x2ebafd[_0xf27b('0x97')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xf27b('0x2b')](function(_0x22a74b){if(_['isEmpty'](_0x22a74b)){_0x4c8f6a[_0xf27b('0x45')](_0xf27b('0x9a'));_0x5cde81[_0xf27b('0x45')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x4c8f6a[_0xf27b('0x45')](_0xf27b('0x77'),_[_0xf27b('0x31')](_0x22a74b,'id'));_0x5cde81['where'](_0xf27b('0x77'),_[_0xf27b('0x31')](_0x22a74b,'id'));}});})[_0xf27b('0x2b')](function(){if(_0x2ebafd[_0xf27b('0x97')]['role']===_0xf27b('0x99')&&!_0x22186c&&!_0x2ebafd[_0xf27b('0x3d')][_0xf27b('0x76')])return[];return db[_0xf27b('0x9b')][_0xf27b('0x3d')](_0x4c8f6a[_0xf27b('0x9c')](),_0x5093c3);})['then'](function(_0x20c747){_0x3441bd[_0xf27b('0x27')]=_0x20c747['length'];if(_0x3441bd[_0xf27b('0x27')]===0x0)return[];return db[_0xf27b('0x9b')]['query'](_0x8913e5['toString'](),_0x5093c3)['then'](function(_0x17f3a4){_0x1a1e13=_['keyBy'](_0x17f3a4,'id');_0x5093c3=_[_0xf27b('0x9d')](_0x5093c3,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ebafd[_0xf27b('0x3d')]['fields']){_0x537ca9[_0xf27b('0x42')][_0xf27b('0x6d')](function(_0x4bf8dc){_0x5cde81['field']('i.'+_0x4bf8dc);});}else{_0x5cde81['field'](_0xf27b('0x9e'),'unreadMessages');_0x5cde81[_0xf27b('0x48')](_0xf27b('0x9f'),_0xf27b('0xa0'));_0x5cde81['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x5cde81[_0xf27b('0x48')]('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',_0xf27b('0x92'));_0x5cde81[_0xf27b('0x48')](_0xf27b('0xa1'));_0x5cde81['field'](_0xf27b('0xa2'),_0xf27b('0xa3'));_0x5cde81['field']('c.lastName','Contact.lastName');_0x5cde81[_0xf27b('0x48')](_0xf27b('0xa4'),_0xf27b('0xa5'));_0x5cde81['field'](_0xf27b('0xa6'),_0xf27b('0xa7'));_0x5cde81[_0xf27b('0x48')]('c.mobile',_0xf27b('0xa8'));_0x5cde81[_0xf27b('0x48')]('c.fax','Contact.fax');_0x5cde81['field'](_0xf27b('0xa9'),'Owner.fullname');_0x5cde81[_0xf27b('0x48')]('o.internal','Owner.internal');_0x5cde81[_0xf27b('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf27b('0x33'));}if(_0x537ca9[_0xf27b('0x26')])_0x5cde81[_0xf27b('0x26')](_0x537ca9[_0xf27b('0x26')]);if(_0x537ca9[_0xf27b('0x24')])_0x5cde81[_0xf27b('0x24')](_0x537ca9[_0xf27b('0x24')]);return db[_0xf27b('0x9b')][_0xf27b('0x3d')](_0x5cde81[_0xf27b('0x9c')](),_0x5093c3);})[_0xf27b('0x2b')](function(_0x278217){if(_0x278217[_0xf27b('0x5f')]>0x0)_0x75cfea[_0xf27b('0x45')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xf27b('0x31')](_0x278217,'id'));return db['sequelize'][_0xf27b('0x3d')](_0x75cfea[_0xf27b('0x9c')](),_0x5093c3)[_0xf27b('0x2b')](function(_0x380d48){var _0x52e00d=_[_0xf27b('0xaa')](_0x380d48,_0xf27b('0xab'));var _0x4c8dfc=[];_0x278217[_0xf27b('0x6d')](function(_0x55b213){_0x4c8dfc[_0xf27b('0xac')](updateWhatsappInteraction(_0x55b213,_0x1a1e13,_0x52e00d));});return BPromise[_0xf27b('0xad')](_0x4c8dfc);});});})['then'](function(_0x429005){_0x3441bd[_0xf27b('0xae')]=_0x429005;return _0x3441bd;})[_0xf27b('0x2b')](respondWithFilteredResult(_0x3f435a,_0x537ca9))[_0xf27b('0x36')](handleError(_0x3f435a,null));};exports[_0xf27b('0xaf')]=function(_0x500f8b,_0x2553ca){var _0xc79f29={'raw':![],'where':{'id':_0x500f8b['params']['id']}},_0x32f0e9={};_0x32f0e9[_0xf27b('0x3c')]=_[_0xf27b('0x3e')](db['WhatsappInteraction'][_0xf27b('0xb0')]);_0x32f0e9[_0xf27b('0x3d')]=_['keys'](_0x500f8b['query']);_0x32f0e9[_0xf27b('0x3f')]=_['intersection'](_0x32f0e9['model'],_0x32f0e9['query']);_0xc79f29['attributes']=_[_0xf27b('0x40')](_0x32f0e9[_0xf27b('0x3c')],qs['fields'](_0x500f8b['query'][_0xf27b('0x41')]));_0xc79f29['attributes']=_0xc79f29[_0xf27b('0x42')][_0xf27b('0x5f')]?_0xc79f29[_0xf27b('0x42')]:_0x32f0e9[_0xf27b('0x3c')];if(_0x500f8b['query']['includeAll']){_0xc79f29[_0xf27b('0xb1')]=[{'all':!![]}];}_0xc79f29=_[_0xf27b('0x9d')]({},_0xc79f29,_0x500f8b[_0xf27b('0xb2')]);return db['WhatsappInteraction'][_0xf27b('0x61')](_0xc79f29)['then'](handleEntityNotFound(_0x2553ca,null))['then'](respondWithResult(_0x2553ca,null))[_0xf27b('0x36')](handleError(_0x2553ca,null));};exports[_0xf27b('0xb3')]=function(_0x576211,_0x254b1e){return db[_0xf27b('0x38')]['create'](_0x576211['body'],{})[_0xf27b('0x2b')](respondWithResult(_0x254b1e,0xc9))['catch'](handleError(_0x254b1e,null));};exports['update']=function(_0x2baabd,_0x25d710){if(_0x2baabd['body']['id']){delete _0x2baabd[_0xf27b('0x72')]['id'];}return db[_0xf27b('0x38')]['find']({'where':{'id':_0x2baabd[_0xf27b('0xb4')]['id']}})['then'](handleEntityNotFound(_0x25d710,null))['then'](saveUpdates(_0x2baabd[_0xf27b('0x72')],null))[_0xf27b('0x2b')](respondWithResult(_0x25d710,null))['catch'](handleError(_0x25d710,null));};exports[_0xf27b('0xb5')]=function(_0x1a845d,_0x2304a0){return db[_0xf27b('0x38')]['find']({'where':{'id':_0x1a845d[_0xf27b('0xb4')]['id']}})['then'](handleEntityNotFound(_0x2304a0,null))[_0xf27b('0x2b')](removeEntity(_0x2304a0,null))[_0xf27b('0x36')](handleError(_0x2304a0,null));};exports[_0xf27b('0xb6')]=function(_0x54bc5f,_0x53d7f8){return db[_0xf27b('0x38')][_0xf27b('0xb6')]()[_0xf27b('0x2b')](respondWithResult(_0x53d7f8,null))['catch'](handleError(_0x53d7f8,null));};exports[_0xf27b('0xb7')]=function(_0x2ef6a0,_0x579bc9,_0x5305ba){return db[_0xf27b('0xb8')][_0xf27b('0x61')]({'where':{'id':_0x2ef6a0[_0xf27b('0xb4')]['id']}})[_0xf27b('0x2b')](handleEntityNotFound(_0x579bc9,null))['then'](function(_0x598549){if(_0x598549){return _0x598549['addMessage'](_0x2ef6a0['body'][_0xf27b('0xb9')],_[_0xf27b('0xba')](_0x2ef6a0[_0xf27b('0x72')],[_0xf27b('0xb9'),'id'])||{});}})[_0xf27b('0x2b')](respondWithResult(_0x579bc9,null))[_0xf27b('0x36')](handleError(_0x579bc9,null));};exports[_0xf27b('0xbb')]=function(_0x15db43,_0x21e44c,_0x2890df){var _0x172369={'raw':![],'where':{}};var _0x330dca={};var _0x1fd52a={'count':0x0,'rows':[]};return db[_0xf27b('0x38')][_0xf27b('0xbc')]({'where':{'id':_0x15db43[_0xf27b('0xb4')]['id']}})[_0xf27b('0x2b')](handleEntityNotFound(_0x21e44c,null))[_0xf27b('0x2b')](function(_0x657d41){if(_0x657d41){_0x330dca['model']=_['keys'](db[_0xf27b('0xb8')][_0xf27b('0xb0')]);_0x330dca[_0xf27b('0x3d')]=_[_0xf27b('0x3e')](_0x15db43[_0xf27b('0x3d')]);_0x330dca[_0xf27b('0x3f')]=_[_0xf27b('0x40')](_0x330dca[_0xf27b('0x3c')],_0x330dca['query']);_0x172369['attributes']=_[_0xf27b('0x40')](_0x330dca[_0xf27b('0x3c')],qs[_0xf27b('0x41')](_0x15db43[_0xf27b('0x3d')][_0xf27b('0x41')]));_0x172369[_0xf27b('0x42')]=_0x172369[_0xf27b('0x42')][_0xf27b('0x5f')]?_0x172369['attributes']:_0x330dca[_0xf27b('0x3c')];if(!_0x15db43[_0xf27b('0x3d')]['hasOwnProperty'](_0xf27b('0xbd'))){_0x172369['limit']=qs[_0xf27b('0x26')](_0x15db43['query'][_0xf27b('0x26')]);_0x172369[_0xf27b('0x24')]=qs[_0xf27b('0x24')](_0x15db43[_0xf27b('0x3d')][_0xf27b('0x24')]);}_0x172369[_0xf27b('0x91')]=qs['sort'](_0x15db43[_0xf27b('0x3d')][_0xf27b('0x44')]);_0x172369[_0xf27b('0x45')]=qs[_0xf27b('0x3f')](_[_0xf27b('0x46')](_0x15db43['query'],_0x330dca['filters']));_0x172369[_0xf27b('0x45')][_0xf27b('0xab')]=_0x657d41['id'];if(_0x15db43[_0xf27b('0x3d')][_0xf27b('0x83')]){_0x172369[_0xf27b('0x45')]=_[_0xf27b('0x9d')](_0x172369[_0xf27b('0x45')],{'$or':_[_0xf27b('0x31')](_0x172369[_0xf27b('0x42')],function(_0x13fde7){var _0x3f2613={};_0x3f2613[_0x13fde7]={'$like':'%'+_0x15db43['query'][_0xf27b('0x83')]+'%'};return _0x3f2613;})});}if(_0x15db43[_0xf27b('0x3d')][_0xf27b('0xbe')]){var _0x3fa476=_0x15db43[_0xf27b('0x3d')]['$gte']['split'](',');var _0x2881df={};_0x2881df[_0x3fa476[0x0]]={'$gte':moment(_0x3fa476[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x172369[_0xf27b('0x45')]=_[_0xf27b('0x9d')](_0x172369[_0xf27b('0x45')],_0x2881df);}_0x172369=_['merge']({},_0x172369,_0x15db43[_0xf27b('0xb2')]);return db[_0xf27b('0xb8')][_0xf27b('0x27')]({'where':_0x172369[_0xf27b('0x45')]})[_0xf27b('0x2b')](function(_0x6c21e6){_0x1fd52a[_0xf27b('0x27')]=_0x6c21e6;if(_0x15db43[_0xf27b('0x3d')][_0xf27b('0xbf')]){_0x172369[_0xf27b('0xb1')]=[{'all':!![]}];}return db[_0xf27b('0xb8')][_0xf27b('0xc0')](_0x172369);})[_0xf27b('0x2b')](function(_0x40f489){_0x1fd52a['rows']=_0x40f489;return _0x1fd52a;});}})[_0xf27b('0x2b')](respondWithFilteredResult(_0x21e44c,_0x172369))[_0xf27b('0x36')](handleError(_0x21e44c,null));};exports['addTags']=function(_0x41a75a,_0x2c2732,_0x1e4b8e){return db['WhatsappInteraction']['find']({'where':{'id':_0x41a75a[_0xf27b('0xb4')]['id']}})['then'](handleEntityNotFound(_0x2c2732,null))[_0xf27b('0x2b')](function(_0x5ac058){if(_0x5ac058){return _0x5ac058[_0xf27b('0xc1')](_0x41a75a[_0xf27b('0x72')][_0xf27b('0xb9')],_[_0xf27b('0xba')](_0x41a75a[_0xf27b('0x72')],[_0xf27b('0xb9'),'id'])||{})[_0xf27b('0xc2')](function(){return db[_0xf27b('0xc3')][_0xf27b('0xc0')]({'attributes':['id',_0xf27b('0x2e'),_0xf27b('0x49')],'where':{'id':_0x41a75a[_0xf27b('0x72')]['ids']}});})[_0xf27b('0x2b')](function(_0x15dff8){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x41a75a['params']['id']),'tags':_0x15dff8||[]});return{'id':Number(_0x41a75a[_0xf27b('0xb4')]['id']),'tags':_0x15dff8||[]};});}})[_0xf27b('0x2b')](respondWithResult(_0x2c2732,null))['catch'](handleError(_0x2c2732,null));};exports[_0xf27b('0xc4')]=function(_0x5ca9b5,_0x3e0d76,_0x457cc6){return db[_0xf27b('0x38')][_0xf27b('0x61')]({'where':{'id':_0x5ca9b5[_0xf27b('0xb4')]['id']}})[_0xf27b('0x2b')](handleEntityNotFound(_0x3e0d76,null))['then'](function(_0x3f1906){if(_0x3f1906){return _0x3f1906[_0xf27b('0xc4')](_0x5ca9b5[_0xf27b('0x3d')]['ids']);}})['then'](respondWithStatusCode(_0x3e0d76,null))[_0xf27b('0x36')](handleError(_0x3e0d76,null));};exports[_0xf27b('0xc5')]=function(_0x3e0195,_0x1b935c){var _0x1e16ac=moment()[_0xf27b('0xc6')]()[_0xf27b('0x9c')]();var _0x288609=path[_0xf27b('0xc7')](config['root'],'server','files',_0xf27b('0xc8'));var _0x2c7ad5=path[_0xf27b('0xc7')](config[_0xf27b('0xc9')],_0xf27b('0xca'),'files','attachments');var _0x459ad3=path[_0xf27b('0xc7')](_0x288609,_0x1e16ac);var _0x2a8d0d=util[_0xf27b('0xcb')](_0xf27b('0xcc'),_0x3e0195[_0xf27b('0xb4')]['id'],_0x1e16ac);var _0x12cdee=path[_0xf27b('0xc7')](_0x288609,_0x2a8d0d);var _0x83dd3a=[];_0x83dd3a['push']({'model':db['User'],'as':_0xf27b('0xcd'),'attributes':['id',_0xf27b('0x32')],'raw':!![]});_0x83dd3a['push']({'model':db[_0xf27b('0xce')],'as':_0xf27b('0x65'),'attributes':['id','firstName',_0xf27b('0xcf')],'raw':!![]});if(_0x3e0195[_0xf27b('0x3d')]['attachments']){_0x83dd3a['push']({'model':db[_0xf27b('0xd0')],'as':'Attachment','raw':!![]});}var _0x5d6ba1=[{'model':db[_0xf27b('0xb8')],'as':_0xf27b('0xd1'),'attributes':['id',_0xf27b('0x72'),_0xf27b('0x79'),_0xf27b('0xd2'),_0xf27b('0xd3'),_0xf27b('0x7e')],'include':_0x83dd3a}];_0x5d6ba1['push']({'model':db[_0xf27b('0xd4')],'as':_0xf27b('0xd5'),'attributes':['id',_0xf27b('0x2e')]});_0x5d6ba1[_0xf27b('0xac')]({'model':db[_0xf27b('0xcd')],'as':_0xf27b('0xd6'),'attributes':['id',_0xf27b('0x32')]});return db[_0xf27b('0x38')][_0xf27b('0x61')]({'where':{'id':_0x3e0195[_0xf27b('0xb4')]['id']},'include':_0x5d6ba1})[_0xf27b('0x2b')](handleEntityNotFound(_0x1b935c,null))[_0xf27b('0x2b')](function(_0x3e340d){if(_0x3e340d){var _0x6f629f=_0x3e340d[_0xf27b('0xd7')]({'plain':!![]});fs[_0xf27b('0xd8')](_0x459ad3);var _0x5a71ce={'channel':_0xf27b('0xd9'),'account':_0x6f629f['Account'][_0xf27b('0x2e')],'agent':_0x6f629f[_0xf27b('0xd6')]?_0x6f629f['Owner'][_0xf27b('0x32')]:_0xf27b('0xda'),'createdAt':moment(_0x6f629f[_0xf27b('0x79')])[_0xf27b('0xcb')](_0xf27b('0xdb'))[_0xf27b('0x9c')](),'closedAt':_0x6f629f[_0xf27b('0xdc')]?moment(_0x6f629f[_0xf27b('0xdd')])[_0xf27b('0xcb')](_0xf27b('0xdb'))[_0xf27b('0x9c')]():'','disposition':_0x6f629f['disposition'],'messages':_(_0x6f629f['Messages'])['filter']({'secret':![]})[_0xf27b('0x31')](function(_0x471e5c){if(_0x471e5c[_0xf27b('0xd0')]){var _0x3665e3=path[_0xf27b('0xc7')](_0x2c7ad5,_0x471e5c[_0xf27b('0xd0')][_0xf27b('0xde')]);if(fs[_0xf27b('0xdf')](_0x3665e3)){fs[_0xf27b('0xe0')](_0x3665e3)[_0xf27b('0xe1')](fs['createWriteStream'](path[_0xf27b('0xc7')](_0x459ad3,_0x471e5c[_0xf27b('0xd0')][_0xf27b('0xde')])));}}return{'date':moment(_0x471e5c['createdAt'])[_0xf27b('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf27b('0x9c')](),'sender':_0x471e5c[_0xf27b('0xd2')]===_0xf27b('0xe2')?_0x471e5c[_0xf27b('0xcd')]?_0x471e5c['User']['fullname']:_0xf27b('0xe3'):_0x471e5c[_0xf27b('0x65')]['firstName']+(_0x471e5c['Contact'][_0xf27b('0xcf')]?'\x20'+_0x471e5c['Contact'][_0xf27b('0xcf')]:''),'body':_0x471e5c[_0xf27b('0xd0')]?_0x471e5c[_0xf27b('0xd0')][_0xf27b('0xde')]:_0x471e5c[_0xf27b('0x72')],'direction':_0x471e5c[_0xf27b('0xd2')]==='out'?'A':'C','secret':_0x471e5c['secret'],'read':_0x471e5c['read'],'attachment':_0x471e5c['Attachment']};})['value']()};return ejs[_0xf27b('0xe4')](path['join'](config['root'],_0xf27b('0xca'),_0xf27b('0xe5'),_0xf27b('0xe6')),{'interaction':_0x5a71ce})[_0xf27b('0x2b')](function(_0x1c4d3a){var _0x130a07=path['join'](_0x459ad3,_0xf27b('0xe7')+_0x6f629f['id']+'-'+_0x1e16ac+_0xf27b('0xe8'));var _0x46a8f6={'path':_0x130a07,'channel':_0xf27b('0xd9'),'interactionId':_0x6f629f['id']};return pdf[_0xf27b('0xe9')](_0x1c4d3a,_0x46a8f6);})[_0xf27b('0x2b')](function(){return new BPromise(function(_0x25c1c3,_0xfc97b2){zipdir(_0x459ad3,{'saveTo':_0x12cdee},function(_0x340173,_0x23584d){if(_0x340173)return _0xfc97b2(_0x340173);return _0x25c1c3(_0x23584d);});})[_0xf27b('0x2b')](function(){return new BPromise(function(_0x96cea0,_0x5bd9a1){rimraf(_0x459ad3,function(_0x376ea6){if(_0x376ea6)_0x5bd9a1(_0x376ea6);return _0x96cea0();});});})[_0xf27b('0x2b')](function(){return _0x1b935c[_0xf27b('0xc5')](_0x12cdee,_0x2a8d0d,function(_0x50228f){if(_0x50228f){console[_0xf27b('0xea')](_0xf27b('0xeb'),_0x50228f);}else{fs[_0xf27b('0xec')](_0x12cdee);}});});});}else{return _0x1b935c[_0xf27b('0x20')](0xc8);}})[_0xf27b('0x36')](handleError(_0x1b935c,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 14f7ea8..b1dca43 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 _0x559a=['Users','map','findAll','setDataValue','unreadMessages','length','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','then'];(function(_0x2be004,_0x26fc49){var _0x55cfba=function(_0x34ccee){while(--_0x34ccee){_0x2be004['push'](_0x2be004['shift']());}};_0x55cfba(++_0x26fc49);}(_0x559a,0xb3));var _0xa559=function(_0x55cf14,_0xa0269){_0x55cf14=_0x55cf14-0x0;var _0x28c399=_0x559a[_0x55cf14];return _0x28c399;};'use strict';var EventEmitter=require(_0xa559('0x0'));var WhatsappInteraction=require(_0xa559('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xa559('0x1'))['db'][_0xa559('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa559('0x3')](0x0);var events={'afterCreate':_0xa559('0x4'),'afterUpdate':_0xa559('0x5'),'afterDestroy':_0xa559('0x6')};function emitEvent(_0x4fac42){return function(_0x5d85c7,_0x2c9386,_0x231070){_0x5d85c7['getUsers']({'attributes':['id'],'raw':!![]})[_0xa559('0x7')](function(_0x1a5cec){_0x5d85c7['setDataValue'](_0xa559('0x8'),_0x1a5cec[_0xa559('0x9')](function(_0x15813d){return{'id':_0x15813d['id']};}));return WhatsappMessage[_0xa559('0xa')]({'where':{'WhatsappInteractionId':_0x5d85c7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2737e0){_0x5d85c7[_0xa559('0xb')](_0xa559('0xc'),_0x2737e0[_0xa559('0xd')]);WhatsappInteractionEvents['emit'](_0x4fac42+':'+_0x5d85c7['id'],_0x5d85c7);WhatsappInteractionEvents['emit'](_0x4fac42,_0x5d85c7);_0x231070(null);})[_0xa559('0xe')](_0x231070(null));};}for(var e in events){if(events[_0xa559('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xa559('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x26bc=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x26bc,0x162));var _0xc26b=function(_0x2a1d7b,_0x2baf66){_0x2a1d7b=_0x2a1d7b-0x0;var _0x24187b=_0x26bc[_0x2a1d7b];return _0x24187b;};'use strict';var EventEmitter=require(_0xc26b('0x0'));var WhatsappInteraction=require(_0xc26b('0x1'))['db'][_0xc26b('0x2')];var WhatsappMessage=require(_0xc26b('0x1'))['db'][_0xc26b('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc26b('0x4'),'afterUpdate':_0xc26b('0x5'),'afterDestroy':_0xc26b('0x6')};function emitEvent(_0x4d8d28){return function(_0xdd0a64,_0x5c87f7,_0x299ad8){_0xdd0a64[_0xc26b('0x7')]({'attributes':['id'],'raw':!![]})[_0xc26b('0x8')](function(_0x5c2f6f){_0xdd0a64[_0xc26b('0x9')](_0xc26b('0xa'),_0x5c2f6f[_0xc26b('0xb')](function(_0x15cfa5){return{'id':_0x15cfa5['id']};}));return WhatsappMessage[_0xc26b('0xc')]({'where':{'WhatsappInteractionId':_0xdd0a64['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc26b('0x8')](function(_0x22af41){_0xdd0a64[_0xc26b('0x9')](_0xc26b('0xd'),_0x22af41[_0xc26b('0xe')]);WhatsappInteractionEvents['emit'](_0x4d8d28+':'+_0xdd0a64['id'],_0xdd0a64);WhatsappInteractionEvents[_0xc26b('0xf')](_0x4d8d28,_0xdd0a64);_0x299ad8(null);})[_0xc26b('0x10')](_0x299ad8(null));};}for(var e in events){if(events[_0xc26b('0x11')](e)){var event=events[e];WhatsappInteraction[_0xc26b('0x12')](e,emitEvent(event));}}module[_0xc26b('0x13')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 8868513..aa16c90 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 _0xc801=['path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0xc801,0x174));var _0x1c80=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xc801[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0x1c80('0x0'));var util=require(_0x1c80('0x1'));var logger=require('../../config/logger')(_0x1c80('0x2'));var moment=require(_0x1c80('0x3'));var BPromise=require(_0x1c80('0x4'));var rp=require(_0x1c80('0x5'));var fs=require('fs');var path=require(_0x1c80('0x6'));var rimraf=require(_0x1c80('0x7'));var config=require('../../config/environment');var attributes=require(_0x1c80('0x8'));module[_0x1c80('0x9')]=function(_0x1c760e,_0x5ac78d){return _0x1c760e[_0x1c80('0xa')](_0x1c80('0xb'),attributes,{'tableName':_0x1c80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24c7c5,_0x472bf9,_0x1a2ea4){if(_0x24c7c5[_0x1c80('0xd')](_0x1c80('0xe'))){_0x24c7c5[_0x1c80('0xf')]=moment()[_0x1c80('0x10')](_0x1c80('0x11'));}_0x1a2ea4(null,_0x24c7c5);}}});}; \ No newline at end of file +var _0xb8c1=['request-promise','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0xb8c1,0x91));var _0x1b8c=function(_0x18e69f,_0x2d3896){_0x18e69f=_0x18e69f-0x0;var _0x43d6d1=_0xb8c1[_0x18e69f];return _0x43d6d1;};'use strict';var _=require('lodash');var util=require(_0x1b8c('0x0'));var logger=require(_0x1b8c('0x1'))(_0x1b8c('0x2'));var moment=require(_0x1b8c('0x3'));var BPromise=require(_0x1b8c('0x4'));var rp=require(_0x1b8c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b8c('0x6'));module[_0x1b8c('0x7')]=function(_0x44804c,_0x460b86){return _0x44804c[_0x1b8c('0x8')](_0x1b8c('0x9'),attributes,{'tableName':_0x1b8c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd96ed1,_0x4e0510,_0x24de68){if(_0xd96ed1[_0x1b8c('0xb')]('closed')){_0xd96ed1[_0x1b8c('0xc')]=moment()[_0x1b8c('0xd')](_0x1b8c('0xe'));}_0x24de68(null,_0xd96ed1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 2735ab7..0db304b 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 _0xb469=['http','redis','defaults','localhost','socket.io-emitter','request','then','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','catch','AddTagsToWhatsappInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x7c54d4,_0x113465){var _0x29f545=function(_0x4d07b8){while(--_0x4d07b8){_0x7c54d4['push'](_0x7c54d4['shift']());}};_0x29f545(++_0x113465);}(_0xb469,0x129));var _0x9b46=function(_0x573643,_0x2fd6c2){_0x573643=_0x573643-0x0;var _0x88450f=_0xb469[_0x573643];return _0x88450f;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require('moment');var BPromise=require(_0x9b46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9b46('0x3'));var logger=require(_0x9b46('0x4'))('rpc');var config=require(_0x9b46('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9b46('0x6')][_0x9b46('0x7')]({'port':0x232a});config[_0x9b46('0x8')]=_[_0x9b46('0x9')](config[_0x9b46('0x8')],{'host':_0x9b46('0xa'),'port':0x18eb});var socket=require(_0x9b46('0xb'))(new Redis(config[_0x9b46('0x8')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x43a31f,_0x49cba1,_0x5e3bf3){return new BPromise(function(_0x5c6bac,_0x414eb2){return client[_0x9b46('0xc')](_0x43a31f,_0x5e3bf3)[_0x9b46('0xd')](function(_0x2740e7){logger['info'](_0x9b46('0xe'),_0x49cba1,'request\x20sent');logger[_0x9b46('0xf')](_0x9b46('0x10'),_0x49cba1,_0x9b46('0x11'),JSON[_0x9b46('0x12')](_0x2740e7));if(_0x2740e7[_0x9b46('0x13')]){if(_0x2740e7['error'][_0x9b46('0x14')]===0x1f4){logger[_0x9b46('0x13')](_0x9b46('0xe'),_0x49cba1,_0x2740e7[_0x9b46('0x13')][_0x9b46('0x15')]);return _0x414eb2(_0x2740e7[_0x9b46('0x13')]['message']);}logger['error'](_0x9b46('0xe'),_0x49cba1,_0x2740e7[_0x9b46('0x13')]['message']);return _0x5c6bac(_0x2740e7[_0x9b46('0x13')][_0x9b46('0x15')]);}else{logger[_0x9b46('0x16')](_0x9b46('0xe'),_0x49cba1,_0x9b46('0x11'));_0x5c6bac(_0x2740e7[_0x9b46('0x17')][_0x9b46('0x15')]);}})['catch'](function(_0x58cb7c){logger[_0x9b46('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x49cba1,_0x58cb7c);_0x414eb2(_0x58cb7c);});});}exports[_0x9b46('0x18')]=function(_0x526c64){var _0xd92562=this;return new Promise(function(_0x23590e,_0x1f3d48){return db[_0x9b46('0x19')][_0x9b46('0x1a')](_0x526c64[_0x9b46('0x1b')],{'raw':_0x526c64['options']?_0x526c64['options'][_0x9b46('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x526c64[_0x9b46('0x1d')]?_0x526c64[_0x9b46('0x1d')]['where']||null:null,'attributes':_0x526c64[_0x9b46('0x1d')]?_0x526c64[_0x9b46('0x1d')]['attributes']||null:null,'limit':_0x526c64[_0x9b46('0x1d')]?_0x526c64['options']['limit']||null:null})['then'](function(_0x51962f){logger[_0x9b46('0x16')](_0x9b46('0x18'),_0x526c64);logger[_0x9b46('0xf')](_0x9b46('0x18'),_0x526c64,JSON[_0x9b46('0x12')](_0x51962f));_0x23590e(_0x51962f);})[_0x9b46('0x1e')](function(_0x27f17a){logger[_0x9b46('0x13')](_0x9b46('0x18'),_0x27f17a['message'],_0x526c64);_0x1f3d48(_0xd92562[_0x9b46('0x13')](0x1f4,_0x27f17a['message']));});});};exports[_0x9b46('0x1f')]=function(_0x898c84){return new Promise(function(_0x598efb,_0xb9e41c){return db[_0x9b46('0x19')]['find']({'where':_0x898c84['options']?_0x898c84['options'][_0x9b46('0x20')]||null:null})[_0x9b46('0xd')](function(_0x16aa11){if(_0x16aa11){return _0x16aa11[_0x9b46('0x21')](_0x898c84[_0x9b46('0x1b')][_0x9b46('0x22')],_[_0x9b46('0x23')](_0x898c84[_0x9b46('0x1b')],[_0x9b46('0x22'),'id'])||{});}})[_0x9b46('0x24')](function(_0x3140b2){logger[_0x9b46('0x16')](_0x9b46('0x25'),_0x898c84);logger[_0x9b46('0xf')](_0x9b46('0x25'),_0x898c84,JSON[_0x9b46('0x12')](_0x3140b2));_0x598efb(_0x3140b2);})['catch'](function(_0x34f1bf){logger[_0x9b46('0x13')](_0x9b46('0x25'),_0x34f1bf['message'],_0x898c84);_0xb9e41c(_this['error'](0x1f4,_0x34f1bf[_0x9b46('0x15')]));});});}; \ No newline at end of file +var _0x9beb=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','AddTagsToWhatsappInteraction','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x9beb,0x133));var _0xb9be=function(_0x393043,_0x143c24){_0x393043=_0x393043-0x0;var _0x50c9e1=_0x9beb[_0x393043];return _0x50c9e1;};'use strict';var _=require(_0xb9be('0x0'));var util=require(_0xb9be('0x1'));var moment=require(_0xb9be('0x2'));var BPromise=require(_0xb9be('0x3'));var rs=require(_0xb9be('0x4'));var fs=require('fs');var Redis=require(_0xb9be('0x5'));var db=require(_0xb9be('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9be('0x7'))(_0xb9be('0x8'));var config=require(_0xb9be('0x9'));var jayson=require(_0xb9be('0xa'));var client=jayson['client'][_0xb9be('0xb')]({'port':0x232a});config[_0xb9be('0xc')]=_[_0xb9be('0xd')](config[_0xb9be('0xc')],{'host':_0xb9be('0xe'),'port':0x18eb});var socket=require(_0xb9be('0xf'))(new Redis(config[_0xb9be('0xc')]));require(_0xb9be('0x10'))[_0xb9be('0x11')](socket);function respondWithRpcPromise(_0x4f42a4,_0xda122c,_0x1e00f2){return new BPromise(function(_0x3ab4df,_0x16b672){return client['request'](_0x4f42a4,_0x1e00f2)[_0xb9be('0x12')](function(_0x44e991){logger[_0xb9be('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0xda122c,'request\x20sent');logger[_0xb9be('0x14')](_0xb9be('0x15'),_0xda122c,_0xb9be('0x16'),JSON[_0xb9be('0x17')](_0x44e991));if(_0x44e991[_0xb9be('0x18')]){if(_0x44e991[_0xb9be('0x18')]['code']===0x1f4){logger[_0xb9be('0x18')](_0xb9be('0x19'),_0xda122c,_0x44e991[_0xb9be('0x18')][_0xb9be('0x1a')]);return _0x16b672(_0x44e991[_0xb9be('0x18')][_0xb9be('0x1a')]);}logger[_0xb9be('0x18')](_0xb9be('0x19'),_0xda122c,_0x44e991[_0xb9be('0x18')][_0xb9be('0x1a')]);return _0x3ab4df(_0x44e991['error'][_0xb9be('0x1a')]);}else{logger['info'](_0xb9be('0x19'),_0xda122c,_0xb9be('0x16'));_0x3ab4df(_0x44e991['result'][_0xb9be('0x1a')]);}})[_0xb9be('0x1b')](function(_0x51e002){logger[_0xb9be('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0xda122c,_0x51e002);_0x16b672(_0x51e002);});});}exports[_0xb9be('0x1c')]=function(_0x3cef3d){var _0x50f7e3=this;return new Promise(function(_0x1c172b,_0x4f3d90){return db[_0xb9be('0x1d')][_0xb9be('0x1e')](_0x3cef3d['body'],{'raw':_0x3cef3d[_0xb9be('0x1f')]?_0x3cef3d['options'][_0xb9be('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cef3d[_0xb9be('0x1f')]?_0x3cef3d['options'][_0xb9be('0x21')]||null:null,'attributes':_0x3cef3d[_0xb9be('0x1f')]?_0x3cef3d[_0xb9be('0x1f')]['attributes']||null:null,'limit':_0x3cef3d['options']?_0x3cef3d[_0xb9be('0x1f')]['limit']||null:null})['then'](function(_0x31a54c){logger[_0xb9be('0x13')](_0xb9be('0x1c'),_0x3cef3d);logger['debug'](_0xb9be('0x1c'),_0x3cef3d,JSON['stringify'](_0x31a54c));_0x1c172b(_0x31a54c);})[_0xb9be('0x1b')](function(_0x5d6d56){logger['error'](_0xb9be('0x1c'),_0x5d6d56[_0xb9be('0x1a')],_0x3cef3d);_0x4f3d90(_0x50f7e3[_0xb9be('0x18')](0x1f4,_0x5d6d56[_0xb9be('0x1a')]));});});};exports[_0xb9be('0x22')]=function(_0x49c977){return new Promise(function(_0x5e1d8f,_0x155c9f){return db[_0xb9be('0x1d')]['find']({'where':_0x49c977['options']?_0x49c977[_0xb9be('0x1f')][_0xb9be('0x21')]||null:null})[_0xb9be('0x12')](function(_0xc3e677){if(_0xc3e677){return _0xc3e677[_0xb9be('0x23')](_0x49c977['body']['ids'],_[_0xb9be('0x24')](_0x49c977['body'],['ids','id'])||{});}})[_0xb9be('0x25')](function(_0x3bf0fb){logger[_0xb9be('0x13')](_0xb9be('0x26'),_0x49c977);logger[_0xb9be('0x14')](_0xb9be('0x26'),_0x49c977,JSON[_0xb9be('0x17')](_0x3bf0fb));_0x5e1d8f(_0x3bf0fb);})[_0xb9be('0x1b')](function(_0x4071b7){logger[_0xb9be('0x18')](_0xb9be('0x26'),_0x4071b7[_0xb9be('0x1a')],_0x49c977);_0x155c9f(_this[_0xb9be('0x18')](0x1f4,_0x4071b7[_0xb9be('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index c46ce88..88a2567 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 _0x57b3=['register','length','./whatsappInteraction.events','save','remove'];(function(_0x25513e,_0x5bd983){var _0x17915e=function(_0x2ba28c){while(--_0x2ba28c){_0x25513e['push'](_0x25513e['shift']());}};_0x17915e(++_0x5bd983);}(_0x57b3,0x11f));var _0x357b=function(_0x5c140a,_0x4f0fb0){_0x5c140a=_0x5c140a-0x0;var _0x557247=_0x57b3[_0x5c140a];return _0x557247;};'use strict';var WhatsappInteractionEvents=require(_0x357b('0x0'));var events=[_0x357b('0x1'),_0x357b('0x2'),'update'];function createListener(_0x381168,_0x1e78d5){return function(_0x3d3fff){_0x1e78d5['emit'](_0x381168,_0x3d3fff);};}function removeListener(_0x375ff8,_0x53600f){return function(){WhatsappInteractionEvents['removeListener'](_0x375ff8,_0x53600f);};}exports[_0x357b('0x3')]=function(_0xa3a6f6){for(var _0xe771df=0x0,_0x32abe5=events[_0x357b('0x4')];_0xe771df<_0x32abe5;_0xe771df++){var _0x4fb29c=events[_0xe771df];var _0x295ba1=createListener('whatsappInteraction:'+_0x4fb29c,_0xa3a6f6);WhatsappInteractionEvents['on'](_0x4fb29c,_0x295ba1);}}; \ No newline at end of file +var _0xd971=['update','emit','removeListener','length','./whatsappInteraction.events','save'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0xd971,0x18a));var _0x1d97=function(_0x448ae2,_0x1676f5){_0x448ae2=_0x448ae2-0x0;var _0x4fdd34=_0xd971[_0x448ae2];return _0x4fdd34;};'use strict';var WhatsappInteractionEvents=require(_0x1d97('0x0'));var events=[_0x1d97('0x1'),'remove',_0x1d97('0x2')];function createListener(_0x27bc62,_0x355886){return function(_0x263e32){_0x355886[_0x1d97('0x3')](_0x27bc62,_0x263e32);};}function removeListener(_0x3ca7e2,_0x594d23){return function(){WhatsappInteractionEvents[_0x1d97('0x4')](_0x3ca7e2,_0x594d23);};}exports['register']=function(_0x67625d){for(var _0x28e685=0x0,_0x4f37af=events[_0x1d97('0x5')];_0x28e685<_0x4f37af;_0x28e685++){var _0x361171=events[_0x28e685];var _0x1aa759=createListener('whatsappInteraction:'+_0x361171,_0x67625d);WhatsappInteractionEvents['on'](_0x361171,_0x1aa759);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 4481788..8645608 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 _0x807f=['isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','reject','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x807f,0x155));var _0xf807=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x807f[_0x35d4e9];return _0x5c2770;};'use strict';var multer=require('multer');var util=require(_0xf807('0x0'));var path=require(_0xf807('0x1'));var timeout=require(_0xf807('0x2'));var express=require(_0xf807('0x3'));var router=express[_0xf807('0x4')]();var fs_extra=require(_0xf807('0x5'));var auth=require(_0xf807('0x6'));var interaction=require(_0xf807('0x7'));var config=require('../../config/environment');var controller=require(_0xf807('0x8'));router[_0xf807('0x9')]('/',auth[_0xf807('0xa')](),controller[_0xf807('0xb')]);router['get'](_0xf807('0xc'),auth[_0xf807('0xa')](),controller[_0xf807('0xd')]);router[_0xf807('0x9')](_0xf807('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xf807('0xf')]('/',auth['isAuthenticated'](),interaction[_0xf807('0x10')](_0xf807('0x11'),_0xf807('0x12')),controller[_0xf807('0x13')]);router[_0xf807('0xf')](_0xf807('0x14'),controller[_0xf807('0x15')]);router[_0xf807('0x16')](_0xf807('0xe'),auth[_0xf807('0xa')](),controller[_0xf807('0x17')]);router[_0xf807('0x16')](_0xf807('0x18'),auth[_0xf807('0xa')](),controller['accept']);router[_0xf807('0x16')]('/:id/reject',auth[_0xf807('0xa')](),controller[_0xf807('0x19')]);router['delete'](_0xf807('0xe'),auth['isAuthenticated'](),controller[_0xf807('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x8822=['delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','isAuthenticated','index','/describe','get','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x8822,0x15e));var _0x2882=function(_0x18e184,_0x497c5e){_0x18e184=_0x18e184-0x0;var _0x5f4c49=_0x8822[_0x18e184];return _0x5f4c49;};'use strict';var multer=require(_0x2882('0x0'));var util=require(_0x2882('0x1'));var path=require('path');var timeout=require(_0x2882('0x2'));var express=require(_0x2882('0x3'));var router=express[_0x2882('0x4')]();var fs_extra=require(_0x2882('0x5'));var auth=require(_0x2882('0x6'));var interaction=require(_0x2882('0x7'));var config=require('../../config/environment');var controller=require(_0x2882('0x8'));router['get']('/',auth[_0x2882('0x9')](),controller[_0x2882('0xa')]);router['get'](_0x2882('0xb'),auth[_0x2882('0x9')](),controller['describe']);router[_0x2882('0xc')](_0x2882('0xd'),auth[_0x2882('0x9')](),controller[_0x2882('0xe')]);router[_0x2882('0xf')]('/',auth['isAuthenticated'](),interaction[_0x2882('0x10')](_0x2882('0x11'),_0x2882('0x12')),controller[_0x2882('0x13')]);router['post']('/:id/status',controller[_0x2882('0x14')]);router[_0x2882('0x15')](_0x2882('0xd'),auth[_0x2882('0x9')](),controller[_0x2882('0x16')]);router[_0x2882('0x15')](_0x2882('0x17'),auth[_0x2882('0x9')](),controller[_0x2882('0x18')]);router[_0x2882('0x15')](_0x2882('0x19'),auth['isAuthenticated'](),controller[_0x2882('0x1a')]);router[_0x2882('0x1b')](_0x2882('0xd'),auth[_0x2882('0x9')](),controller[_0x2882('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6504498..f0d59d8 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 _0x91f8=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x436eed,_0x50d115){var _0x496d99=function(_0x4807b8){while(--_0x4807b8){_0x436eed['push'](_0x436eed['shift']());}};_0x496d99(++_0x50d115);}(_0x91f8,0x13f));var _0x891f=function(_0x4b4950,_0x103d19){_0x4b4950=_0x4b4950-0x0;var _0x401a6e=_0x91f8[_0x4b4950];return _0x401a6e;};'use strict';var Sequelize=require(_0x891f('0x0'));module[_0x891f('0x1')]={'body':{'type':Sequelize[_0x891f('0x2')](_0x891f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x891f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x891f('0x5')]('in',_0x891f('0x6')),'defaultValue':_0x891f('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x891f('0x7')]},'readAt':{'type':Sequelize[_0x891f('0x8')]},'secret':{'type':Sequelize[_0x891f('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x891f('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x21f2=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x1d50c9,_0x276cb9){var _0x2b8211=function(_0x5040c3){while(--_0x5040c3){_0x1d50c9['push'](_0x1d50c9['shift']());}};_0x2b8211(++_0x276cb9);}(_0x21f2,0x158));var _0x221f=function(_0x5cca21,_0x16b49f){_0x5cca21=_0x5cca21-0x0;var _0xaa5774=_0x21f2[_0x5cca21];return _0xaa5774;};'use strict';var Sequelize=require('sequelize');module[_0x221f('0x0')]={'body':{'type':Sequelize[_0x221f('0x1')](_0x221f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x221f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x221f('0x4')]('in',_0x221f('0x5')),'defaultValue':_0x221f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x221f('0x6')](0xbe)},'phone':{'type':Sequelize[_0x221f('0x6')]},'readAt':{'type':Sequelize[_0x221f('0x7')]},'secret':{'type':Sequelize[_0x221f('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x221f('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 60dd2e3..840fce3 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 _0xeff8=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','reject','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','update','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','ContactId','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xeff8,0x186));var _0x8eff=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xeff8[_0x386c3e];return _0x4b8e13;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8eff('0x18')](config[_0x8eff('0x19')],{'host':_0x8eff('0x1a'),'port':0x18eb});var socket=require(_0x8eff('0x1b'))(new Redis(config[_0x8eff('0x19')]));require('./whatsappMessage.socket')[_0x8eff('0x1c')](socket);var jayson=require(_0x8eff('0x1d'));var client=jayson[_0x8eff('0x1e')][_0x8eff('0x1f')]({'port':0x232c});var client9002=jayson[_0x8eff('0x1e')][_0x8eff('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x16202e,_0xdbb753,_0x16a4eb,_0x427902){return new BPromise(function(_0x137344,_0x4ad743){var _0x32b791=_0x427902||client;return _0x32b791[_0x8eff('0x20')](_0x16202e,_0x16a4eb)[_0x8eff('0x21')](function(_0x20ec2a){logger[_0x8eff('0x22')](_0x8eff('0x23'),_0xdbb753,_0x8eff('0x24'));logger[_0x8eff('0x25')](_0x8eff('0x26'),_0xdbb753,_0x8eff('0x24'),JSON[_0x8eff('0x27')](_0x20ec2a));if(_0x20ec2a[_0x8eff('0x28')]){if(_0x20ec2a[_0x8eff('0x28')][_0x8eff('0x29')]===0x1f4){logger[_0x8eff('0x28')](_0x8eff('0x23'),_0xdbb753,_0x20ec2a['error'][_0x8eff('0x2a')]);return _0x4ad743(_0x20ec2a[_0x8eff('0x28')]['message']);}logger[_0x8eff('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0xdbb753,_0x20ec2a[_0x8eff('0x28')][_0x8eff('0x2a')]);return _0x137344(_0x20ec2a[_0x8eff('0x28')][_0x8eff('0x2a')]);}else{logger[_0x8eff('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0xdbb753,_0x8eff('0x24'));_0x137344(_0x20ec2a[_0x8eff('0x2b')]['message']);}})[_0x8eff('0x2c')](function(_0x5ec3d7){logger[_0x8eff('0x28')](_0x8eff('0x23'),_0xdbb753,_0x5ec3d7);_0x4ad743(_0x5ec3d7);});});}function respondWithStatusCode(_0xd60d94,_0x41324b){_0x41324b=_0x41324b||0xcc;return function(_0x6359df){if(_0x6359df){return _0xd60d94[_0x8eff('0x2d')](_0x41324b);}return _0xd60d94['status'](_0x41324b)[_0x8eff('0x2e')]();};}function respondWithResult(_0x323ffa,_0x15083c){_0x15083c=_0x15083c||0xc8;return function(_0xb88ce9){if(_0xb88ce9){return _0x323ffa[_0x8eff('0x2f')](_0x15083c)[_0x8eff('0x30')](_0xb88ce9);}};}function respondWithFilteredResult(_0x4cc146,_0x4ed3b8){return function(_0x44dcdb){if(_0x44dcdb){var _0x472b19=typeof _0x4ed3b8[_0x8eff('0x31')]==='undefined'&&typeof _0x4ed3b8[_0x8eff('0x32')]===_0x8eff('0x33');var _0x229e0d=_0x44dcdb[_0x8eff('0x34')];var _0x25b98e=_0x472b19?0x0:_0x4ed3b8[_0x8eff('0x31')];var _0x141bd7=_0x472b19?_0x44dcdb[_0x8eff('0x34')]:_0x4ed3b8[_0x8eff('0x31')]+_0x4ed3b8[_0x8eff('0x32')];var _0xf3ee6;if(_0x141bd7>=_0x229e0d){_0x141bd7=_0x229e0d;_0xf3ee6=0xc8;}else{_0xf3ee6=0xce;}_0x4cc146[_0x8eff('0x2f')](_0xf3ee6);return _0x4cc146['set'](_0x8eff('0x35'),_0x25b98e+'-'+_0x141bd7+'/'+_0x229e0d)[_0x8eff('0x30')](_0x44dcdb);}return null;};}function patchUpdates(_0x115fa4){return function(_0x7da1fb){try{jsonpatch['apply'](_0x7da1fb,_0x115fa4,!![]);}catch(_0x1f2240){return BPromise[_0x8eff('0x36')](_0x1f2240);}return _0x7da1fb['save']();};}function saveUpdates(_0x4e1256,_0x40ed09){return function(_0x271d64){if(_0x271d64){return _0x271d64['update'](_0x4e1256)['then'](function(_0x51ec38){return _0x51ec38;});}return null;};}function removeEntity(_0x315691,_0x5f5b79){return function(_0x45d9d4){if(_0x45d9d4){return _0x45d9d4['destroy']()[_0x8eff('0x21')](function(){_0x315691[_0x8eff('0x2f')](0xcc)[_0x8eff('0x2e')]();});}};}function handleEntityNotFound(_0x1dcab3,_0x3e53a2){return function(_0x37e474){if(!_0x37e474){_0x1dcab3['sendStatus'](0x194);}return _0x37e474;};}function handleError(_0xd95908,_0x5907e0){_0x5907e0=_0x5907e0||0x1f4;return function(_0xba48d8){logger['error'](_0xba48d8[_0x8eff('0x37')]);if(_0xba48d8[_0x8eff('0x38')]){delete _0xba48d8[_0x8eff('0x38')];}_0xd95908[_0x8eff('0x2f')](_0x5907e0)['send'](_0xba48d8);};}exports[_0x8eff('0x39')]=function(_0x170a33,_0x18c42c){var _0x5360b7={},_0x475213={},_0x1cf3d3={'count':0x0,'rows':[]};var _0x102023=_[_0x8eff('0x3a')](db[_0x8eff('0x3b')][_0x8eff('0x3c')],function(_0x29f68e){return{'name':_0x29f68e[_0x8eff('0x3d')],'type':_0x29f68e[_0x8eff('0x3e')]['key']};});_0x475213['model']=_[_0x8eff('0x3a')](_0x102023,_0x8eff('0x38'));_0x475213[_0x8eff('0x3f')]=_[_0x8eff('0x40')](_0x170a33[_0x8eff('0x3f')]);_0x475213[_0x8eff('0x41')]=_[_0x8eff('0x42')](_0x475213['model'],_0x475213[_0x8eff('0x3f')]);_0x5360b7[_0x8eff('0x43')]=_['intersection'](_0x475213[_0x8eff('0x44')],qs[_0x8eff('0x45')](_0x170a33[_0x8eff('0x3f')][_0x8eff('0x45')]));_0x5360b7[_0x8eff('0x43')]=_0x5360b7[_0x8eff('0x43')][_0x8eff('0x46')]?_0x5360b7[_0x8eff('0x43')]:_0x475213[_0x8eff('0x44')];if(!_0x170a33['query'][_0x8eff('0x47')](_0x8eff('0x48'))){_0x5360b7[_0x8eff('0x32')]=qs[_0x8eff('0x32')](_0x170a33[_0x8eff('0x3f')]['limit']);_0x5360b7[_0x8eff('0x31')]=qs['offset'](_0x170a33[_0x8eff('0x3f')][_0x8eff('0x31')]);}_0x5360b7[_0x8eff('0x49')]=qs[_0x8eff('0x4a')](_0x170a33['query'][_0x8eff('0x4a')]);_0x5360b7[_0x8eff('0x4b')]=qs[_0x8eff('0x41')](_['pick'](_0x170a33['query'],_0x475213[_0x8eff('0x41')]),_0x102023);if(_0x170a33[_0x8eff('0x3f')][_0x8eff('0x4c')]){_0x5360b7[_0x8eff('0x4b')]=_[_0x8eff('0x4d')](_0x5360b7['where'],{'$or':_[_0x8eff('0x3a')](_0x102023,function(_0x51aa5d){if(_0x51aa5d[_0x8eff('0x3e')]!==_0x8eff('0x4e')){var _0x577a2b={};_0x577a2b[_0x51aa5d['name']]={'$like':'%'+_0x170a33['query']['filter']+'%'};return _0x577a2b;}})});}_0x5360b7=_['merge']({},_0x5360b7,_0x170a33['options']);var _0xcd41c0={'where':_0x5360b7[_0x8eff('0x4b')]};return db[_0x8eff('0x3b')][_0x8eff('0x34')](_0xcd41c0)[_0x8eff('0x21')](function(_0x190aec){_0x1cf3d3[_0x8eff('0x34')]=_0x190aec;if(_0x170a33[_0x8eff('0x3f')][_0x8eff('0x4f')]){_0x5360b7[_0x8eff('0x50')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x8eff('0x51')](_0x5360b7);})['then'](function(_0x295464){_0x1cf3d3[_0x8eff('0x52')]=_0x295464;return _0x1cf3d3;})[_0x8eff('0x21')](respondWithFilteredResult(_0x18c42c,_0x5360b7))[_0x8eff('0x2c')](handleError(_0x18c42c,null));};exports[_0x8eff('0x53')]=function(_0xecde36,_0x342bbd){var _0x3a4c31={'raw':!![],'where':{'id':_0xecde36[_0x8eff('0x54')]['id']}},_0x16078f={};_0x16078f[_0x8eff('0x44')]=_[_0x8eff('0x40')](db['WhatsappMessage'][_0x8eff('0x3c')]);_0x16078f[_0x8eff('0x3f')]=_[_0x8eff('0x40')](_0xecde36[_0x8eff('0x3f')]);_0x16078f[_0x8eff('0x41')]=_[_0x8eff('0x42')](_0x16078f[_0x8eff('0x44')],_0x16078f[_0x8eff('0x3f')]);_0x3a4c31[_0x8eff('0x43')]=_['intersection'](_0x16078f['model'],qs[_0x8eff('0x45')](_0xecde36[_0x8eff('0x3f')][_0x8eff('0x45')]));_0x3a4c31[_0x8eff('0x43')]=_0x3a4c31[_0x8eff('0x43')][_0x8eff('0x46')]?_0x3a4c31['attributes']:_0x16078f[_0x8eff('0x44')];if(_0xecde36[_0x8eff('0x3f')][_0x8eff('0x4f')]){_0x3a4c31['include']=[{'all':!![]}];}_0x3a4c31=_[_0x8eff('0x4d')]({},_0x3a4c31,_0xecde36[_0x8eff('0x55')]);return db[_0x8eff('0x3b')][_0x8eff('0x56')](_0x3a4c31)['then'](handleEntityNotFound(_0x342bbd,null))[_0x8eff('0x21')](respondWithResult(_0x342bbd,null))[_0x8eff('0x2c')](handleError(_0x342bbd,null));};exports[_0x8eff('0x57')]=function(_0x244a96,_0x1d56ce){return db[_0x8eff('0x3b')][_0x8eff('0x57')](_0x244a96['body'],{})[_0x8eff('0x21')](respondWithResult(_0x1d56ce,0xc9))[_0x8eff('0x2c')](handleError(_0x1d56ce,null));};exports[_0x8eff('0x58')]=function(_0x430696,_0x2079f6){if(_0x430696['body']['id']){delete _0x430696[_0x8eff('0x59')]['id'];}return db[_0x8eff('0x3b')][_0x8eff('0x56')]({'where':{'id':_0x430696['params']['id']}})[_0x8eff('0x21')](handleEntityNotFound(_0x2079f6,null))['then'](saveUpdates(_0x430696[_0x8eff('0x59')],null))[_0x8eff('0x21')](respondWithResult(_0x2079f6,null))[_0x8eff('0x2c')](handleError(_0x2079f6,null));};exports[_0x8eff('0x5a')]=function(_0x3d82b6,_0xa6355e){return db[_0x8eff('0x3b')]['find']({'where':{'id':_0x3d82b6['params']['id']}})[_0x8eff('0x21')](handleEntityNotFound(_0xa6355e,null))['then'](removeEntity(_0xa6355e,null))[_0x8eff('0x2c')](handleError(_0xa6355e,null));};exports[_0x8eff('0x5b')]=function(_0x3064ae,_0x29af10){return db[_0x8eff('0x3b')]['describe']()[_0x8eff('0x21')](respondWithResult(_0x29af10,null))[_0x8eff('0x2c')](handleError(_0x29af10,null));};var interaction_log=require(_0x8eff('0x14'))(_0x8eff('0x5c'));exports[_0x8eff('0x5d')]=function(_0x5f21ad,_0x5bfc72,_0x1147a8){var _0x5c0ea3={'agent':{},'channel':_0x8eff('0x5e')};if(_0x5f21ad[_0x8eff('0x59')]['id']){delete _0x5f21ad['body']['id'];}_0x5f21ad[_0x8eff('0x59')][_0x8eff('0x5f')]=!![];_0x5f21ad[_0x8eff('0x59')][_0x8eff('0x60')]=moment()[_0x8eff('0x61')](_0x8eff('0x62'));_0x5f21ad[_0x8eff('0x59')][_0x8eff('0x63')]=_0x5f21ad['body'][_0x8eff('0x63')]||_0x5f21ad['user']['id'];_0x5c0ea3['agent']['id']=_0x5f21ad[_0x8eff('0x59')][_0x8eff('0x63')];return db['WhatsappMessage'][_0x8eff('0x56')]({'where':{'id':_0x5f21ad[_0x8eff('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5bfc72,null))[_0x8eff('0x21')](saveUpdates(_0x5f21ad[_0x8eff('0x59')],null))['then'](function(_0xc70ecc){if(_0xc70ecc){_0x5c0ea3[_0x8eff('0x2a')]=_0xc70ecc[_0x8eff('0x64')]({'plain':!![]});return db[_0x8eff('0x65')][_0x8eff('0x56')]({'where':{'id':_0xc70ecc[_0x8eff('0x66')]}});}return null;})[_0x8eff('0x21')](handleEntityNotFound(_0x5bfc72,null))['then'](function(_0x479a4b){if(_0x479a4b){return _0x479a4b[_0x8eff('0x58')]({'UserId':_0x5f21ad[_0x8eff('0x59')][_0x8eff('0x63')],'read1stAt':_[_0x8eff('0x67')](_0x479a4b[_0x8eff('0x68')])?moment()[_0x8eff('0x61')](_0x8eff('0x62')):undefined});}return null;})['then'](function(_0x593a18){if(_0x593a18){_0x5c0ea3[_0x8eff('0x69')]=_0x593a18['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5f21ad[_0x8eff('0x6a')]['id'],_0x5f21ad[_0x8eff('0x6a')][_0x8eff('0x38')],_0x5f21ad[_0x8eff('0x6a')][_0x8eff('0x6b')],_0x5c0ea3[_0x8eff('0x69')]['id'],_0x5f21ad[_0x8eff('0x59')]?JSON[_0x8eff('0x27')](_0x5f21ad['body']):_0x8eff('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x8eff('0x6d'),_0x5c0ea3);}return null;})[_0x8eff('0x21')](function(_0x12ebd1){var _0x225703=_0x8eff('0x6e')+_0x12ebd1[_0x8eff('0x2a')]['ContactId'];return db[_0x8eff('0x6f')]['query'](_0x225703,{'type':db[_0x8eff('0x70')][_0x8eff('0x71')][_0x8eff('0x72')],'raw':!![]})[_0x8eff('0x21')](function(_0x41d7e2){return _0x41d7e2;});})[_0x8eff('0x21')](function(_0x2313d7){if(_0x2313d7){_0x5c0ea3[_0x8eff('0x2a')][_0x8eff('0x73')]=_0x2313d7[0x0];if(!_0x5f21ad['body'][_0x8eff('0x63')])return;return db[_0x8eff('0x74')][_0x8eff('0x56')]({'where':{'id':_0x5f21ad[_0x8eff('0x59')][_0x8eff('0x63')],'role':_0x8eff('0x75')},'attributes':['id',_0x8eff('0x38'),_0x8eff('0x76'),_0x8eff('0x77'),_0x8eff('0x78')],'raw':!![]});}return null;})['then'](function(_0x503527){if(!_0x503527)return null;_0x5c0ea3['message']['agent']=_0x503527;return _0x5c0ea3;})[_0x8eff('0x21')](function(_0x16221f){if(_0x16221f){if(_0x5f21ad[_0x8eff('0x59')][_0x8eff('0x79')]){_0x5c0ea3[_0x8eff('0x2a')][_0x8eff('0x7a')]=util[_0x8eff('0x61')]('SIP/%s',_0x5f21ad[_0x8eff('0x6a')][_0x8eff('0x38')]);_0x5c0ea3[_0x8eff('0x2a')][_0x8eff('0x7b')]=_0x5c0ea3['channel'];_0x5c0ea3[_0x8eff('0x2a')][_0x8eff('0x7c')]='accept';return respondWithRpcPromise(_0x8eff('0x7d'),_0x8eff('0x7d'),{'event':_0x8eff('0x7e'),'message':_0x5c0ea3['message']},client9002)['then'](function(){return _0x5c0ea3;});}return _0x5c0ea3;}return null;})['then'](respondWithResult(_0x5bfc72,null))[_0x8eff('0x2c')](handleError(_0x5bfc72,null));};var interaction_log=require(_0x8eff('0x14'))(_0x8eff('0x5c'));exports[_0x8eff('0x36')]=function(_0xaca1b5,_0x10d22d,_0x283f26){var _0x5a329b={'agent':{},'channel':_0x8eff('0x5e')};if(_0xaca1b5[_0x8eff('0x59')]['id']){delete _0xaca1b5[_0x8eff('0x59')]['id'];}_0xaca1b5['body'][_0x8eff('0x63')]=_0xaca1b5['body'][_0x8eff('0x63')]||_0xaca1b5[_0x8eff('0x6a')]['id'];_0x5a329b['agent']['id']=_0xaca1b5[_0x8eff('0x59')]['UserId'];return db[_0x8eff('0x3b')][_0x8eff('0x56')]({'where':{'id':_0xaca1b5[_0x8eff('0x54')]['id'],'UserId':null}})[_0x8eff('0x21')](handleEntityNotFound(_0x10d22d,null))[_0x8eff('0x21')](function(_0x4a4603){if(_0x4a4603){_0x5a329b[_0x8eff('0x2a')]=_0x4a4603[_0x8eff('0x64')]({'plain':!![]});return db[_0x8eff('0x65')][_0x8eff('0x56')]({'where':{'id':_0x4a4603[_0x8eff('0x66')]}});}return null;})[_0x8eff('0x21')](handleEntityNotFound(_0x10d22d,null))[_0x8eff('0x21')](function(_0x32108b){if(_0x32108b){_0x5a329b[_0x8eff('0x69')]=_0x32108b[_0x8eff('0x64')]({'plain':!![]});interaction_log[_0x8eff('0x22')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xaca1b5[_0x8eff('0x6a')]['id'],_0xaca1b5[_0x8eff('0x6a')][_0x8eff('0x38')],_0xaca1b5[_0x8eff('0x6a')][_0x8eff('0x6b')],_0x5a329b['interaction']['id'],_0xaca1b5[_0x8eff('0x59')]?JSON[_0x8eff('0x27')](_0xaca1b5['body']):'null');return respondWithRpcPromise(_0x8eff('0x7f'),_0x8eff('0x80'),_0x5a329b);}return null;})[_0x8eff('0x21')](function(_0xe31924){var _0x2c5622=_0x8eff('0x6e')+_0xe31924['message'][_0x8eff('0x81')];return db['sequelize'][_0x8eff('0x3f')](_0x2c5622,{'type':db[_0x8eff('0x70')]['QueryTypes'][_0x8eff('0x72')],'raw':!![]})['then'](function(_0x506c3f){return _0x506c3f;});})[_0x8eff('0x21')](function(_0x525779){if(_0x525779){_0x5a329b[_0x8eff('0x2a')][_0x8eff('0x73')]=_0x525779[0x0];if(!_0xaca1b5['body'][_0x8eff('0x63')])return;return db[_0x8eff('0x74')]['find']({'where':{'id':_0xaca1b5[_0x8eff('0x59')][_0x8eff('0x63')],'role':_0x8eff('0x75')},'attributes':['id',_0x8eff('0x38'),_0x8eff('0x76'),_0x8eff('0x77'),_0x8eff('0x78')],'raw':!![]});}return null;})[_0x8eff('0x21')](function(_0x552d1a){if(!_0x552d1a)return null;_0x5a329b['message']['agent']=_0x552d1a;return _0x5a329b;})['then'](function(_0x338269){if(_0x338269){_0x338269[_0x8eff('0x2a')][_0x8eff('0x7a')]=util['format'](_0x8eff('0x82'),_0xaca1b5[_0x8eff('0x6a')][_0x8eff('0x38')]);_0x338269[_0x8eff('0x2a')][_0x8eff('0x7b')]=_0x5a329b[_0x8eff('0x7b')];_0x338269['message'][_0x8eff('0x7c')]='reject';respondWithRpcPromise(_0x8eff('0x7d'),_0x8eff('0x7d'),{'event':_0x8eff('0x83'),'message':_0x338269[_0x8eff('0x2a')]},client9002);return _0x5a329b;}return null;})[_0x8eff('0x21')](respondWithResult(_0x10d22d,null))[_0x8eff('0x2c')](handleError(_0x10d22d,null));};exports[_0x8eff('0x2f')]=function(_0x54ad86,_0x290fa2,_0x159d86){if(_0x54ad86[_0x8eff('0x59')]['id']){delete _0x54ad86[_0x8eff('0x59')]['id'];}var _0x20db23;return db['WhatsappMessage'][_0x8eff('0x56')]({'where':{'id':_0x54ad86[_0x8eff('0x54')]['id']}})[_0x8eff('0x21')](handleEntityNotFound(_0x290fa2,null))['then'](function(_0x4a035e){if(_0x4a035e){_0x20db23=_0x4a035e;return db[_0x8eff('0x84')][_0x8eff('0x56')]({'where':{'id':_0x4a035e[_0x8eff('0x85')]}});}})['then'](handleEntityNotFound(_0x290fa2,null))[_0x8eff('0x21')](function(_0x5b9120){if(_0x5b9120){logger['debug'](_0x8eff('0x86'),_0x8eff('0x2f'),_0x8eff('0x87'),_0x5b9120[_0x8eff('0x3e')],util[_0x8eff('0x88')](_0x54ad86[_0x8eff('0x59')],{'showHidden':![],'depth':null}));switch(_0x5b9120[_0x8eff('0x3e')]){case _0x8eff('0x89'):if(_0x54ad86[_0x8eff('0x59')][_0x8eff('0x8a')]&&_0x54ad86[_0x8eff('0x59')][_0x8eff('0x8a')]===_0x20db23['messageId']&&_0x54ad86[_0x8eff('0x59')][_0x8eff('0x8b')]&&_0x54ad86[_0x8eff('0x59')][_0x8eff('0x8b')]===_0x8eff('0x5f')){return _0x20db23['update']({'read':!![]});}else{logger[_0x8eff('0x28')](_0x8eff('0x8c'),_0x8eff('0x2f'),_0x8eff('0x89'),util['inspect'](_0x54ad86['body'],{'showHidden':![],'depth':null}));}break;}return _0x20db23;}})[_0x8eff('0x21')](respondWithResult(_0x290fa2,null))[_0x8eff('0x2c')](handleError(_0x290fa2,null));}; \ No newline at end of file +var _0xf230=['Content-Range','reject','update','then','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','include','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','agent','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','../../config/logger','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','Sequelize','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','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','offset','undefined','limit','count','set'];(function(_0x81f0fc,_0x2c5785){var _0xd4667d=function(_0x5c4849){while(--_0x5c4849){_0x81f0fc['push'](_0x81f0fc['shift']());}};_0xd4667d(++_0x2c5785);}(_0xf230,0xea));var _0x0f23=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf230[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x0f23('0x0'));var rimraf=require(_0x0f23('0x1'));var zipdir=require(_0x0f23('0x2'));var jsonpatch=require(_0x0f23('0x3'));var rp=require(_0x0f23('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0f23('0x5'));var util=require(_0x0f23('0x6'));var path=require(_0x0f23('0x7'));var sox=require('sox');var csv=require(_0x0f23('0x8'));var ejs=require(_0x0f23('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f23('0xa'));var squel=require('squel');var crypto=require(_0x0f23('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0f23('0xc'));var toCsv=require(_0x0f23('0x8'));var querystring=require(_0x0f23('0xd'));var Papa=require(_0x0f23('0xe'));var Redis=require('ioredis');var authService=require(_0x0f23('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0f23('0x10'));var hardwareService=require(_0x0f23('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0f23('0x12'));var config=require(_0x0f23('0x13'));var licenseUtil=require(_0x0f23('0x14'));var db=require(_0x0f23('0x15'))['db'];config['redis']=_[_0x0f23('0x16')](config[_0x0f23('0x17')],{'host':_0x0f23('0x18'),'port':0x18eb});var socket=require(_0x0f23('0x19'))(new Redis(config[_0x0f23('0x17')]));require(_0x0f23('0x1a'))[_0x0f23('0x1b')](socket);var jayson=require(_0x0f23('0x1c'));var client=jayson[_0x0f23('0x1d')][_0x0f23('0x1e')]({'port':0x232c});var client9002=jayson[_0x0f23('0x1d')][_0x0f23('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4ed26d,_0x10f544,_0x2ef2a6,_0x52e976){return new BPromise(function(_0x186863,_0x423880){var _0x296b90=_0x52e976||client;return _0x296b90[_0x0f23('0x1f')](_0x4ed26d,_0x2ef2a6)['then'](function(_0x3c68d0){logger[_0x0f23('0x20')](_0x0f23('0x21'),_0x10f544,_0x0f23('0x22'));logger[_0x0f23('0x23')](_0x0f23('0x24'),_0x10f544,'request\x20sent',JSON[_0x0f23('0x25')](_0x3c68d0));if(_0x3c68d0[_0x0f23('0x26')]){if(_0x3c68d0[_0x0f23('0x26')][_0x0f23('0x27')]===0x1f4){logger['error'](_0x0f23('0x21'),_0x10f544,_0x3c68d0[_0x0f23('0x26')][_0x0f23('0x28')]);return _0x423880(_0x3c68d0[_0x0f23('0x26')][_0x0f23('0x28')]);}logger[_0x0f23('0x26')](_0x0f23('0x21'),_0x10f544,_0x3c68d0[_0x0f23('0x26')]['message']);return _0x186863(_0x3c68d0['error'][_0x0f23('0x28')]);}else{logger[_0x0f23('0x20')](_0x0f23('0x21'),_0x10f544,_0x0f23('0x22'));_0x186863(_0x3c68d0[_0x0f23('0x29')][_0x0f23('0x28')]);}})[_0x0f23('0x2a')](function(_0x2ebac5){logger[_0x0f23('0x26')](_0x0f23('0x21'),_0x10f544,_0x2ebac5);_0x423880(_0x2ebac5);});});}function respondWithStatusCode(_0xb168d2,_0x2cfad4){_0x2cfad4=_0x2cfad4||0xcc;return function(_0x23961e){if(_0x23961e){return _0xb168d2[_0x0f23('0x2b')](_0x2cfad4);}return _0xb168d2[_0x0f23('0x2c')](_0x2cfad4)[_0x0f23('0x2d')]();};}function respondWithResult(_0x11ac00,_0x579e89){_0x579e89=_0x579e89||0xc8;return function(_0x2789d4){if(_0x2789d4){return _0x11ac00['status'](_0x579e89)[_0x0f23('0x2e')](_0x2789d4);}};}function respondWithFilteredResult(_0x470d36,_0x461275){return function(_0x123009){if(_0x123009){var _0x1b67d7=typeof _0x461275[_0x0f23('0x2f')]===_0x0f23('0x30')&&typeof _0x461275[_0x0f23('0x31')]===_0x0f23('0x30');var _0x265170=_0x123009['count'];var _0x2a3541=_0x1b67d7?0x0:_0x461275[_0x0f23('0x2f')];var _0x1785a2=_0x1b67d7?_0x123009[_0x0f23('0x32')]:_0x461275['offset']+_0x461275['limit'];var _0x416669;if(_0x1785a2>=_0x265170){_0x1785a2=_0x265170;_0x416669=0xc8;}else{_0x416669=0xce;}_0x470d36[_0x0f23('0x2c')](_0x416669);return _0x470d36[_0x0f23('0x33')](_0x0f23('0x34'),_0x2a3541+'-'+_0x1785a2+'/'+_0x265170)['json'](_0x123009);}return null;};}function patchUpdates(_0x5afac9){return function(_0x57ead3){try{jsonpatch['apply'](_0x57ead3,_0x5afac9,!![]);}catch(_0x398515){return BPromise[_0x0f23('0x35')](_0x398515);}return _0x57ead3['save']();};}function saveUpdates(_0x351fda,_0x3a001c){return function(_0x2fb345){if(_0x2fb345){return _0x2fb345[_0x0f23('0x36')](_0x351fda)[_0x0f23('0x37')](function(_0x4c4f5c){return _0x4c4f5c;});}return null;};}function removeEntity(_0x522e7b,_0x58ba85){return function(_0xb166e3){if(_0xb166e3){return _0xb166e3['destroy']()[_0x0f23('0x37')](function(){_0x522e7b['status'](0xcc)[_0x0f23('0x2d')]();});}};}function handleEntityNotFound(_0x127cbd,_0x161dad){return function(_0xa6cba0){if(!_0xa6cba0){_0x127cbd[_0x0f23('0x2b')](0x194);}return _0xa6cba0;};}function handleError(_0x1ca8be,_0x5761ff){_0x5761ff=_0x5761ff||0x1f4;return function(_0x324673){logger[_0x0f23('0x26')](_0x324673[_0x0f23('0x38')]);if(_0x324673['name']){delete _0x324673[_0x0f23('0x39')];}_0x1ca8be[_0x0f23('0x2c')](_0x5761ff)['send'](_0x324673);};}exports[_0x0f23('0x3a')]=function(_0x4b2d6c,_0x3ebe98){var _0x2a45a2={},_0x2aaa6c={},_0x4f5875={'count':0x0,'rows':[]};var _0xe3e207=_[_0x0f23('0x3b')](db[_0x0f23('0x3c')][_0x0f23('0x3d')],function(_0x158ed0){return{'name':_0x158ed0[_0x0f23('0x3e')],'type':_0x158ed0[_0x0f23('0x3f')][_0x0f23('0x40')]};});_0x2aaa6c['model']=_[_0x0f23('0x3b')](_0xe3e207,'name');_0x2aaa6c[_0x0f23('0x41')]=_['keys'](_0x4b2d6c[_0x0f23('0x41')]);_0x2aaa6c[_0x0f23('0x42')]=_['intersection'](_0x2aaa6c['model'],_0x2aaa6c[_0x0f23('0x41')]);_0x2a45a2['attributes']=_[_0x0f23('0x43')](_0x2aaa6c[_0x0f23('0x44')],qs[_0x0f23('0x45')](_0x4b2d6c[_0x0f23('0x41')]['fields']));_0x2a45a2[_0x0f23('0x46')]=_0x2a45a2['attributes'][_0x0f23('0x47')]?_0x2a45a2[_0x0f23('0x46')]:_0x2aaa6c[_0x0f23('0x44')];if(!_0x4b2d6c[_0x0f23('0x41')][_0x0f23('0x48')]('nolimit')){_0x2a45a2[_0x0f23('0x31')]=qs[_0x0f23('0x31')](_0x4b2d6c[_0x0f23('0x41')]['limit']);_0x2a45a2['offset']=qs['offset'](_0x4b2d6c['query'][_0x0f23('0x2f')]);}_0x2a45a2[_0x0f23('0x49')]=qs[_0x0f23('0x4a')](_0x4b2d6c[_0x0f23('0x41')][_0x0f23('0x4a')]);_0x2a45a2[_0x0f23('0x4b')]=qs[_0x0f23('0x42')](_[_0x0f23('0x4c')](_0x4b2d6c[_0x0f23('0x41')],_0x2aaa6c[_0x0f23('0x42')]),_0xe3e207);if(_0x4b2d6c[_0x0f23('0x41')][_0x0f23('0x4d')]){_0x2a45a2['where']=_[_0x0f23('0x4e')](_0x2a45a2['where'],{'$or':_[_0x0f23('0x3b')](_0xe3e207,function(_0x23f80c){if(_0x23f80c['type']!==_0x0f23('0x4f')){var _0x364f13={};_0x364f13[_0x23f80c['name']]={'$like':'%'+_0x4b2d6c[_0x0f23('0x41')][_0x0f23('0x4d')]+'%'};return _0x364f13;}})});}_0x2a45a2=_['merge']({},_0x2a45a2,_0x4b2d6c[_0x0f23('0x50')]);var _0xf7b2a6={'where':_0x2a45a2[_0x0f23('0x4b')]};return db['WhatsappMessage'][_0x0f23('0x32')](_0xf7b2a6)['then'](function(_0x39f7a1){_0x4f5875[_0x0f23('0x32')]=_0x39f7a1;if(_0x4b2d6c[_0x0f23('0x41')]['includeAll']){_0x2a45a2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x0f23('0x51')](_0x2a45a2);})['then'](function(_0x3392cb){_0x4f5875[_0x0f23('0x52')]=_0x3392cb;return _0x4f5875;})[_0x0f23('0x37')](respondWithFilteredResult(_0x3ebe98,_0x2a45a2))['catch'](handleError(_0x3ebe98,null));};exports[_0x0f23('0x53')]=function(_0x4898d8,_0xe2298){var _0x583216={'raw':!![],'where':{'id':_0x4898d8[_0x0f23('0x54')]['id']}},_0x5c806f={};_0x5c806f[_0x0f23('0x44')]=_[_0x0f23('0x55')](db[_0x0f23('0x3c')][_0x0f23('0x3d')]);_0x5c806f['query']=_[_0x0f23('0x55')](_0x4898d8[_0x0f23('0x41')]);_0x5c806f['filters']=_['intersection'](_0x5c806f[_0x0f23('0x44')],_0x5c806f['query']);_0x583216[_0x0f23('0x46')]=_[_0x0f23('0x43')](_0x5c806f[_0x0f23('0x44')],qs['fields'](_0x4898d8[_0x0f23('0x41')][_0x0f23('0x45')]));_0x583216[_0x0f23('0x46')]=_0x583216['attributes']['length']?_0x583216[_0x0f23('0x46')]:_0x5c806f[_0x0f23('0x44')];if(_0x4898d8[_0x0f23('0x41')][_0x0f23('0x56')]){_0x583216[_0x0f23('0x57')]=[{'all':!![]}];}_0x583216=_['merge']({},_0x583216,_0x4898d8[_0x0f23('0x50')]);return db['WhatsappMessage'][_0x0f23('0x58')](_0x583216)[_0x0f23('0x37')](handleEntityNotFound(_0xe2298,null))['then'](respondWithResult(_0xe2298,null))['catch'](handleError(_0xe2298,null));};exports[_0x0f23('0x59')]=function(_0x4ba023,_0x4e2b1e){return db[_0x0f23('0x3c')]['create'](_0x4ba023['body'],{})[_0x0f23('0x37')](respondWithResult(_0x4e2b1e,0xc9))[_0x0f23('0x2a')](handleError(_0x4e2b1e,null));};exports['update']=function(_0x384521,_0x595eae){if(_0x384521[_0x0f23('0x5a')]['id']){delete _0x384521[_0x0f23('0x5a')]['id'];}return db[_0x0f23('0x3c')][_0x0f23('0x58')]({'where':{'id':_0x384521[_0x0f23('0x54')]['id']}})[_0x0f23('0x37')](handleEntityNotFound(_0x595eae,null))[_0x0f23('0x37')](saveUpdates(_0x384521[_0x0f23('0x5a')],null))[_0x0f23('0x37')](respondWithResult(_0x595eae,null))[_0x0f23('0x2a')](handleError(_0x595eae,null));};exports[_0x0f23('0x5b')]=function(_0x1095eb,_0x2aec0f){return db['WhatsappMessage'][_0x0f23('0x58')]({'where':{'id':_0x1095eb[_0x0f23('0x54')]['id']}})['then'](handleEntityNotFound(_0x2aec0f,null))['then'](removeEntity(_0x2aec0f,null))[_0x0f23('0x2a')](handleError(_0x2aec0f,null));};exports['describe']=function(_0x4582f2,_0x45a19a){return db[_0x0f23('0x3c')][_0x0f23('0x5c')]()['then'](respondWithResult(_0x45a19a,null))['catch'](handleError(_0x45a19a,null));};var interaction_log=require('../../config/logger')(_0x0f23('0x5d'));exports[_0x0f23('0x5e')]=function(_0x37e2be,_0x4e91d9,_0x578637){var _0x32bd29={'agent':{},'channel':_0x0f23('0x5f')};if(_0x37e2be[_0x0f23('0x5a')]['id']){delete _0x37e2be[_0x0f23('0x5a')]['id'];}_0x37e2be[_0x0f23('0x5a')][_0x0f23('0x60')]=!![];_0x37e2be[_0x0f23('0x5a')][_0x0f23('0x61')]=moment()[_0x0f23('0x62')](_0x0f23('0x63'));_0x37e2be[_0x0f23('0x5a')][_0x0f23('0x64')]=_0x37e2be[_0x0f23('0x5a')]['UserId']||_0x37e2be[_0x0f23('0x65')]['id'];_0x32bd29['agent']['id']=_0x37e2be[_0x0f23('0x5a')][_0x0f23('0x64')];return db[_0x0f23('0x3c')][_0x0f23('0x58')]({'where':{'id':_0x37e2be[_0x0f23('0x54')]['id'],'UserId':null}})[_0x0f23('0x37')](handleEntityNotFound(_0x4e91d9,null))[_0x0f23('0x37')](saveUpdates(_0x37e2be['body'],null))[_0x0f23('0x37')](function(_0x4ae489){if(_0x4ae489){_0x32bd29['message']=_0x4ae489[_0x0f23('0x66')]({'plain':!![]});return db[_0x0f23('0x67')]['find']({'where':{'id':_0x4ae489['WhatsappInteractionId']}});}return null;})[_0x0f23('0x37')](handleEntityNotFound(_0x4e91d9,null))[_0x0f23('0x37')](function(_0x1dc2b5){if(_0x1dc2b5){return _0x1dc2b5['update']({'UserId':_0x37e2be[_0x0f23('0x5a')]['UserId'],'read1stAt':_[_0x0f23('0x68')](_0x1dc2b5[_0x0f23('0x69')])?moment()['format'](_0x0f23('0x63')):undefined});}return null;})[_0x0f23('0x37')](function(_0x260543){if(_0x260543){_0x32bd29['interaction']=_0x260543['get']({'plain':!![]});interaction_log[_0x0f23('0x20')](_0x0f23('0x6a'),_0x37e2be[_0x0f23('0x65')]['id'],_0x37e2be['user']['name'],_0x37e2be[_0x0f23('0x65')]['role'],_0x32bd29[_0x0f23('0x6b')]['id'],_0x37e2be['body']?JSON['stringify'](_0x37e2be['body']):'null');return respondWithRpcPromise(_0x0f23('0x6c'),'acceptMessage',_0x32bd29);}return null;})[_0x0f23('0x37')](function(_0x274780){var _0x52bf05=_0x0f23('0x6d')+_0x274780[_0x0f23('0x28')][_0x0f23('0x6e')];return db[_0x0f23('0x6f')][_0x0f23('0x41')](_0x52bf05,{'type':db['Sequelize'][_0x0f23('0x70')][_0x0f23('0x71')],'raw':!![]})['then'](function(_0x1922e8){return _0x1922e8;});})[_0x0f23('0x37')](function(_0x57a517){if(_0x57a517){_0x32bd29[_0x0f23('0x28')]['contact']=_0x57a517[0x0];if(!_0x37e2be[_0x0f23('0x5a')][_0x0f23('0x64')])return;return db['User'][_0x0f23('0x58')]({'where':{'id':_0x37e2be[_0x0f23('0x5a')]['UserId'],'role':_0x0f23('0x72')},'attributes':['id',_0x0f23('0x39'),_0x0f23('0x73'),_0x0f23('0x74'),_0x0f23('0x75')],'raw':!![]});}return null;})[_0x0f23('0x37')](function(_0x251e46){if(!_0x251e46)return null;_0x32bd29[_0x0f23('0x28')]['agent']=_0x251e46;return _0x32bd29;})[_0x0f23('0x37')](function(_0x5f2c57){if(_0x5f2c57){if(_0x37e2be['body'][_0x0f23('0x76')]){_0x32bd29[_0x0f23('0x28')][_0x0f23('0x77')]=util[_0x0f23('0x62')](_0x0f23('0x78'),_0x37e2be[_0x0f23('0x65')][_0x0f23('0x39')]);_0x32bd29[_0x0f23('0x28')][_0x0f23('0x79')]=_0x32bd29[_0x0f23('0x79')];_0x32bd29[_0x0f23('0x28')][_0x0f23('0x7a')]=_0x0f23('0x5e');return respondWithRpcPromise(_0x0f23('0x7b'),_0x0f23('0x7b'),{'event':'acceptmessage','message':_0x32bd29['message']},client9002)['then'](function(){return _0x32bd29;});}return _0x32bd29;}return null;})[_0x0f23('0x37')](respondWithResult(_0x4e91d9,null))['catch'](handleError(_0x4e91d9,null));};var interaction_log=require(_0x0f23('0x7c'))('whatsapp-interactions');exports[_0x0f23('0x35')]=function(_0x16fbc9,_0x30bcb6,_0xb9c07b){var _0x2bfaf4={'agent':{},'channel':_0x0f23('0x5f')};if(_0x16fbc9[_0x0f23('0x5a')]['id']){delete _0x16fbc9[_0x0f23('0x5a')]['id'];}_0x16fbc9[_0x0f23('0x5a')][_0x0f23('0x64')]=_0x16fbc9[_0x0f23('0x5a')][_0x0f23('0x64')]||_0x16fbc9[_0x0f23('0x65')]['id'];_0x2bfaf4[_0x0f23('0x72')]['id']=_0x16fbc9[_0x0f23('0x5a')][_0x0f23('0x64')];return db['WhatsappMessage'][_0x0f23('0x58')]({'where':{'id':_0x16fbc9['params']['id'],'UserId':null}})[_0x0f23('0x37')](handleEntityNotFound(_0x30bcb6,null))['then'](function(_0x5c7571){if(_0x5c7571){_0x2bfaf4['message']=_0x5c7571[_0x0f23('0x66')]({'plain':!![]});return db['WhatsappInteraction'][_0x0f23('0x58')]({'where':{'id':_0x5c7571[_0x0f23('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x30bcb6,null))[_0x0f23('0x37')](function(_0x43b6a8){if(_0x43b6a8){_0x2bfaf4[_0x0f23('0x6b')]=_0x43b6a8[_0x0f23('0x66')]({'plain':!![]});interaction_log[_0x0f23('0x20')](_0x0f23('0x7e'),_0x16fbc9[_0x0f23('0x65')]['id'],_0x16fbc9[_0x0f23('0x65')]['name'],_0x16fbc9[_0x0f23('0x65')][_0x0f23('0x7f')],_0x2bfaf4[_0x0f23('0x6b')]['id'],_0x16fbc9[_0x0f23('0x5a')]?JSON['stringify'](_0x16fbc9[_0x0f23('0x5a')]):_0x0f23('0x80'));return respondWithRpcPromise(_0x0f23('0x81'),_0x0f23('0x82'),_0x2bfaf4);}return null;})['then'](function(_0x33ecd9){var _0x78a838=_0x0f23('0x6d')+_0x33ecd9[_0x0f23('0x28')][_0x0f23('0x6e')];return db[_0x0f23('0x6f')][_0x0f23('0x41')](_0x78a838,{'type':db[_0x0f23('0x83')][_0x0f23('0x70')][_0x0f23('0x71')],'raw':!![]})[_0x0f23('0x37')](function(_0x5a1e65){return _0x5a1e65;});})['then'](function(_0x42ae13){if(_0x42ae13){_0x2bfaf4[_0x0f23('0x28')][_0x0f23('0x84')]=_0x42ae13[0x0];if(!_0x16fbc9[_0x0f23('0x5a')][_0x0f23('0x64')])return;return db['User'][_0x0f23('0x58')]({'where':{'id':_0x16fbc9[_0x0f23('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0x0f23('0x39'),_0x0f23('0x73'),_0x0f23('0x74'),_0x0f23('0x75')],'raw':!![]});}return null;})[_0x0f23('0x37')](function(_0x5a152e){if(!_0x5a152e)return null;_0x2bfaf4[_0x0f23('0x28')][_0x0f23('0x72')]=_0x5a152e;return _0x2bfaf4;})[_0x0f23('0x37')](function(_0x338cf8){if(_0x338cf8){_0x338cf8[_0x0f23('0x28')][_0x0f23('0x77')]=util[_0x0f23('0x62')](_0x0f23('0x78'),_0x16fbc9[_0x0f23('0x65')]['name']);_0x338cf8[_0x0f23('0x28')][_0x0f23('0x79')]=_0x2bfaf4[_0x0f23('0x79')];_0x338cf8['message']['event']='reject';respondWithRpcPromise(_0x0f23('0x7b'),_0x0f23('0x7b'),{'event':_0x0f23('0x85'),'message':_0x338cf8[_0x0f23('0x28')]},client9002);return _0x2bfaf4;}return null;})[_0x0f23('0x37')](respondWithResult(_0x30bcb6,null))[_0x0f23('0x2a')](handleError(_0x30bcb6,null));};exports[_0x0f23('0x2c')]=function(_0x1908dd,_0x8d8669,_0x528042){if(_0x1908dd[_0x0f23('0x5a')]['id']){delete _0x1908dd[_0x0f23('0x5a')]['id'];}var _0x2e1974;return db[_0x0f23('0x3c')][_0x0f23('0x58')]({'where':{'id':_0x1908dd[_0x0f23('0x54')]['id']}})[_0x0f23('0x37')](handleEntityNotFound(_0x8d8669,null))[_0x0f23('0x37')](function(_0x433d15){if(_0x433d15){_0x2e1974=_0x433d15;return db[_0x0f23('0x86')][_0x0f23('0x58')]({'where':{'id':_0x433d15[_0x0f23('0x87')]}});}})[_0x0f23('0x37')](handleEntityNotFound(_0x8d8669,null))['then'](function(_0x56f181){if(_0x56f181){logger['debug'](_0x0f23('0x88'),_0x0f23('0x2c'),_0x0f23('0x89'),_0x56f181['type'],util[_0x0f23('0x8a')](_0x1908dd['body'],{'showHidden':![],'depth':null}));switch(_0x56f181[_0x0f23('0x3f')]){case _0x0f23('0x8b'):if(_0x1908dd['body'][_0x0f23('0x8c')]&&_0x1908dd[_0x0f23('0x5a')][_0x0f23('0x8c')]===_0x2e1974[_0x0f23('0x8d')]&&_0x1908dd[_0x0f23('0x5a')][_0x0f23('0x8e')]&&_0x1908dd[_0x0f23('0x5a')][_0x0f23('0x8e')]===_0x0f23('0x60')){return _0x2e1974[_0x0f23('0x36')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x0f23('0x2c'),_0x0f23('0x8b'),util['inspect'](_0x1908dd[_0x0f23('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2e1974;}})['then'](respondWithResult(_0x8d8669,null))[_0x0f23('0x2a')](handleError(_0x8d8669,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 26c8889..5a5ba63 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 _0x1752=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x372380,_0x3ba885){var _0x2280c6=function(_0x2b0c0b){while(--_0x2b0c0b){_0x372380['push'](_0x372380['shift']());}};_0x2280c6(++_0x3ba885);}(_0x1752,0xa5));var _0x2175=function(_0x5314f9,_0x10fd61){_0x5314f9=_0x5314f9-0x0;var _0x40f920=_0x1752[_0x5314f9];return _0x40f920;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x2175('0x0'))['db'][_0x2175('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2175('0x2')](0x0);var events={'afterCreate':_0x2175('0x3'),'afterUpdate':_0x2175('0x4'),'afterDestroy':_0x2175('0x5')};function emitEvent(_0x56c315){return function(_0x1ee277,_0x22c167,_0x12b8d9){WhatsappMessageEvents[_0x2175('0x6')](_0x56c315+':'+_0x1ee277['id'],_0x1ee277);WhatsappMessageEvents[_0x2175('0x6')](_0x56c315,_0x1ee277);_0x12b8d9(null);};}for(var e in events){if(events[_0x2175('0x7')](e)){var event=events[e];WhatsappMessage[_0x2175('0x8')](e,emitEvent(event));}}module[_0x2175('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0xd52d=['WhatsappMessage','save','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xd52d,0x1c7));var _0xdd52=function(_0x1eaf2e,_0x56e834){_0x1eaf2e=_0x1eaf2e-0x0;var _0x36e8aa=_0xd52d[_0x1eaf2e];return _0x36e8aa;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xdd52('0x0'))['db'][_0xdd52('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdd52('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1dfed5){return function(_0x211062,_0x30fb04,_0x29a95e){WhatsappMessageEvents[_0xdd52('0x3')](_0x1dfed5+':'+_0x211062['id'],_0x211062);WhatsappMessageEvents[_0xdd52('0x3')](_0x1dfed5,_0x211062);_0x29a95e(null);};}for(var e in events){if(events[_0xdd52('0x4')](e)){var event=events[e];WhatsappMessage[_0xdd52('0x5')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index a1801e5..d5596ba 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 _0x90a8=['error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','models','toLowerCase','direction','out','secret','UserId','WhatsappInteractionId','then','update','createdAt','catch','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','body','whatsapp:','/api/whatsapp/messages/','sid'];(function(_0x406ba5,_0x39fa4b){var _0x557db7=function(_0x40f28b){while(--_0x40f28b){_0x406ba5['push'](_0x406ba5['shift']());}};_0x557db7(++_0x39fa4b);}(_0x90a8,0x14a));var _0x890a=function(_0x5618b1,_0x48be68){_0x5618b1=_0x5618b1-0x0;var _0x5cf07d=_0x90a8[_0x5618b1];return _0x5cf07d;};'use strict';var _=require(_0x890a('0x0'));var util=require(_0x890a('0x1'));var logger=require('../../config/logger')(_0x890a('0x2'));var moment=require(_0x890a('0x3'));var BPromise=require(_0x890a('0x4'));var rp=require(_0x890a('0x5'));var fs=require('fs');var path=require(_0x890a('0x6'));var rimraf=require(_0x890a('0x7'));var config=require(_0x890a('0x8'));var attributes=require(_0x890a('0x9'));module[_0x890a('0xa')]=function(_0x15a68a,_0xc82179){return _0x15a68a['define'](_0x890a('0xb'),attributes,{'tableName':_0x890a('0xc'),'paranoid':![],'indexes':[{'name':_0x890a('0xd'),'fields':[_0x890a('0xd')]},{'name':_0x890a('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59413d,_0x11b1ae,_0x3b1b0d){var _0x1659e2=_0x15a68a[_0x890a('0xf')];var _0x4bfbe4=_0x59413d['get']({'plain':!![]});if(_0x4bfbe4['direction'][_0x890a('0x10')]()==='in'||_0x4bfbe4[_0x890a('0x11')][_0x890a('0x10')]()===_0x890a('0x12')&&!_0x4bfbe4[_0x890a('0x13')]&&!_['isNil'](_0x4bfbe4[_0x890a('0x14')])){_0x1659e2['WhatsappInteraction']['findOne']({'where':{'id':_0x4bfbe4[_0x890a('0x15')]}})[_0x890a('0x16')](function(_0x13e630){if(_0x13e630){_0x13e630[_0x890a('0x17')]({'lastMsgAt':_0x4bfbe4[_0x890a('0x18')],'lastMsgDirection':_0x4bfbe4[_0x890a('0x11')][_0x890a('0x10')]()});}})[_0x890a('0x19')](function(_0x36bed9){console['error'](_0x36bed9);});}if(_0x4bfbe4[_0x890a('0x11')]===_0x890a('0x12')&&!_0x4bfbe4[_0x890a('0x13')]){var _0x990413;_0x1659e2['WhatsappAccount'][_0x890a('0x1a')]({'where':{'id':_0x4bfbe4[_0x890a('0x1b')]},'raw':!![]})[_0x890a('0x16')](function(_0x5bffde){_0x990413=_0x5bffde;if(_0x990413&&_0x990413[_0x890a('0x1c')]){switch(_0x990413[_0x890a('0x1c')]){case'twilio':var _0x3b45c2=require(_0x890a('0x1d'));if(_0x990413[_0x890a('0x1e')]&&_0x990413[_0x890a('0x1f')]&&_0x990413[_0x890a('0x20')]){var _0x3bf2ec=new _0x3b45c2(_0x990413['accountSid'],_0x990413[_0x890a('0x1f')]);_0x3bf2ec[_0x890a('0x21')]['create']({'body':_0x4bfbe4[_0x890a('0x22')],'to':_0x890a('0x23')+_0x4bfbe4['phone'],'from':_0x890a('0x23')+_0x990413[_0x890a('0x20')],'statusCallback':_0x990413['remote']+_0x890a('0x24')+_0x4bfbe4['id']+'/status?token='+_0x990413['token']})[_0x890a('0x16')](function(_0x5356ab){if(_0x5356ab[_0x890a('0x25')]){return _0x59413d[_0x890a('0x17')]({'messageId':_0x5356ab[_0x890a('0x25')]});}})[_0x890a('0x19')](function(_0x54d03c){logger[_0x890a('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x890a('0x27'),_0x890a('0x1d'),util[_0x890a('0x28')](_0x54d03c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x890a('0x29'),_0x890a('0x27'),_0x890a('0x1d'),_0x890a('0x2a'));}break;}}})[_0x890a('0x2b')](function(){_0x3b1b0d();});}else{_0x3b1b0d();}}},'charset':_0x890a('0x2c'),'collate':_0x890a('0x2d')});}; \ No newline at end of file +var _0x37b4=['findOne','then','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','whatsapp_messages','messageId','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction'];(function(_0xcfd9c6,_0x21836f){var _0x5b02e7=function(_0x4c9115){while(--_0x4c9115){_0xcfd9c6['push'](_0xcfd9c6['shift']());}};_0x5b02e7(++_0x21836f);}(_0x37b4,0xef));var _0x437b=function(_0x43371b,_0x1cb4cf){_0x43371b=_0x43371b-0x0;var _0x19cd26=_0x37b4[_0x43371b];return _0x19cd26;};'use strict';var _=require(_0x437b('0x0'));var util=require('util');var logger=require(_0x437b('0x1'))(_0x437b('0x2'));var moment=require(_0x437b('0x3'));var BPromise=require('bluebird');var rp=require(_0x437b('0x4'));var fs=require('fs');var path=require(_0x437b('0x5'));var rimraf=require(_0x437b('0x6'));var config=require(_0x437b('0x7'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x1bab79,_0x560099){return _0x1bab79[_0x437b('0x8')]('WhatsappMessage',attributes,{'tableName':_0x437b('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x437b('0xa')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x437b('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfcf11a,_0x5ee65b,_0x474464){var _0x4ca515=_0x1bab79['models'];var _0x33f17d=_0xfcf11a[_0x437b('0xc')]({'plain':!![]});if(_0x33f17d[_0x437b('0xd')][_0x437b('0xe')]()==='in'||_0x33f17d['direction'][_0x437b('0xe')]()===_0x437b('0xf')&&!_0x33f17d[_0x437b('0x10')]&&!_['isNil'](_0x33f17d[_0x437b('0x11')])){_0x4ca515[_0x437b('0x12')][_0x437b('0x13')]({'where':{'id':_0x33f17d['WhatsappInteractionId']}})[_0x437b('0x14')](function(_0x56524c){if(_0x56524c){_0x56524c[_0x437b('0x15')]({'lastMsgAt':_0x33f17d[_0x437b('0x16')],'lastMsgDirection':_0x33f17d[_0x437b('0xd')]['toLowerCase']()});}})[_0x437b('0x17')](function(_0x159076){console[_0x437b('0x18')](_0x159076);});}if(_0x33f17d[_0x437b('0xd')]===_0x437b('0xf')&&!_0x33f17d[_0x437b('0x10')]){var _0x53bb67;_0x4ca515[_0x437b('0x19')]['find']({'where':{'id':_0x33f17d[_0x437b('0x1a')]},'raw':!![]})[_0x437b('0x14')](function(_0x1c91bc){_0x53bb67=_0x1c91bc;if(_0x53bb67&&_0x53bb67[_0x437b('0x1b')]){switch(_0x53bb67['type']){case'twilio':var _0x589939=require('twilio');if(_0x53bb67[_0x437b('0x1c')]&&_0x53bb67[_0x437b('0x1d')]&&_0x53bb67['phone']){var _0x2db7fc=new _0x589939(_0x53bb67['accountSid'],_0x53bb67[_0x437b('0x1d')]);_0x2db7fc[_0x437b('0x1e')][_0x437b('0x1f')]({'body':_0x33f17d['body'],'to':'whatsapp:'+_0x33f17d['phone'],'from':_0x437b('0x20')+_0x53bb67[_0x437b('0x21')],'statusCallback':_0x53bb67[_0x437b('0x22')]+_0x437b('0x23')+_0x33f17d['id']+_0x437b('0x24')+_0x53bb67[_0x437b('0x25')]})[_0x437b('0x14')](function(_0x18869f){if(_0x18869f[_0x437b('0x26')]){return _0xfcf11a[_0x437b('0x15')]({'messageId':_0x18869f[_0x437b('0x26')]});}})['catch'](function(_0x3ec9e6){logger[_0x437b('0x18')](_0x437b('0x27'),_0x437b('0x28'),_0x437b('0x29'),util['inspect'](_0x3ec9e6,{'showHidden':![],'depth':null}));});}else{logger[_0x437b('0x18')](_0x437b('0x27'),'afterCreate',_0x437b('0x29'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x474464();});}else{_0x474464();}}},'charset':'utf8mb4','collate':_0x437b('0x2a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f2c2e9e..a884275 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 _0x5a29=['body','options','raw','then','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x5a29,0x1cd));var _0x95a2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5a29[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x95a2('0x0'));var util=require(_0x95a2('0x1'));var moment=require(_0x95a2('0x2'));var BPromise=require(_0x95a2('0x3'));var rs=require(_0x95a2('0x4'));var fs=require('fs');var Redis=require(_0x95a2('0x5'));var db=require(_0x95a2('0x6'))['db'];var utils=require(_0x95a2('0x7'));var logger=require(_0x95a2('0x8'))(_0x95a2('0x9'));var config=require(_0x95a2('0xa'));var jayson=require(_0x95a2('0xb'));var client=jayson[_0x95a2('0xc')][_0x95a2('0xd')]({'port':0x232a});config[_0x95a2('0xe')]=_[_0x95a2('0xf')](config[_0x95a2('0xe')],{'host':_0x95a2('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x95a2('0xe')]));require('./whatsappMessage.socket')[_0x95a2('0x11')](socket);function respondWithRpcPromise(_0x1f6741,_0x56ff01,_0x189e51){return new BPromise(function(_0x96d825,_0x1a4365){return client[_0x95a2('0x12')](_0x1f6741,_0x189e51)['then'](function(_0x3255c0){logger['info'](_0x95a2('0x13'),_0x56ff01,_0x95a2('0x14'));logger[_0x95a2('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x56ff01,'request\x20sent',JSON['stringify'](_0x3255c0));if(_0x3255c0[_0x95a2('0x16')]){if(_0x3255c0['error'][_0x95a2('0x17')]===0x1f4){logger['error'](_0x95a2('0x13'),_0x56ff01,_0x3255c0[_0x95a2('0x16')][_0x95a2('0x18')]);return _0x1a4365(_0x3255c0[_0x95a2('0x16')][_0x95a2('0x18')]);}logger[_0x95a2('0x16')](_0x95a2('0x13'),_0x56ff01,_0x3255c0['error'][_0x95a2('0x18')]);return _0x96d825(_0x3255c0[_0x95a2('0x16')][_0x95a2('0x18')]);}else{logger['info'](_0x95a2('0x13'),_0x56ff01,_0x95a2('0x14'));_0x96d825(_0x3255c0['result'][_0x95a2('0x18')]);}})[_0x95a2('0x19')](function(_0x4e04e0){logger[_0x95a2('0x16')](_0x95a2('0x13'),_0x56ff01,_0x4e04e0);_0x1a4365(_0x4e04e0);});});}exports[_0x95a2('0x1a')]=function(_0x576013){var _0x114202=this;return new Promise(function(_0x5b7185,_0x552154){return db[_0x95a2('0x1b')][_0x95a2('0x1c')](_0x576013[_0x95a2('0x1d')],{'raw':_0x576013[_0x95a2('0x1e')]?_0x576013[_0x95a2('0x1e')][_0x95a2('0x1f')]===undefined?!![]:![]:!![]})[_0x95a2('0x20')](function(_0x26788f){logger[_0x95a2('0x21')](_0x95a2('0x1a'),_0x576013);logger['debug'](_0x95a2('0x1a'),_0x576013,JSON[_0x95a2('0x22')](_0x26788f));_0x5b7185(_0x26788f);})['catch'](function(_0x44a5d8){logger['error'](_0x95a2('0x1a'),_0x44a5d8[_0x95a2('0x18')],_0x576013);_0x552154(_0x114202[_0x95a2('0x16')](0x1f4,_0x44a5d8['message']));});});}; \ No newline at end of file +var _0xe7f4=['stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw'];(function(_0x3edc8c,_0x44cc99){var _0x537440=function(_0x23db2d){while(--_0x23db2d){_0x3edc8c['push'](_0x3edc8c['shift']());}};_0x537440(++_0x44cc99);}(_0xe7f4,0xf6));var _0x4e7f=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xe7f4[_0x3ba924];return _0x4cc1df;};'use strict';var _=require(_0x4e7f('0x0'));var util=require(_0x4e7f('0x1'));var moment=require(_0x4e7f('0x2'));var BPromise=require(_0x4e7f('0x3'));var rs=require(_0x4e7f('0x4'));var fs=require('fs');var Redis=require(_0x4e7f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4e7f('0x6'))('rpc');var config=require(_0x4e7f('0x7'));var jayson=require(_0x4e7f('0x8'));var client=jayson[_0x4e7f('0x9')][_0x4e7f('0xa')]({'port':0x232a});config['redis']=_[_0x4e7f('0xb')](config[_0x4e7f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e7f('0xd'))(new Redis(config['redis']));require(_0x4e7f('0xe'))[_0x4e7f('0xf')](socket);function respondWithRpcPromise(_0x5ceb3c,_0x170dce,_0x17dade){return new BPromise(function(_0x542e46,_0x3af019){return client[_0x4e7f('0x10')](_0x5ceb3c,_0x17dade)[_0x4e7f('0x11')](function(_0x1d869d){logger[_0x4e7f('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x170dce,_0x4e7f('0x13'));logger[_0x4e7f('0x14')](_0x4e7f('0x15'),_0x170dce,_0x4e7f('0x13'),JSON['stringify'](_0x1d869d));if(_0x1d869d[_0x4e7f('0x16')]){if(_0x1d869d[_0x4e7f('0x16')][_0x4e7f('0x17')]===0x1f4){logger[_0x4e7f('0x16')](_0x4e7f('0x18'),_0x170dce,_0x1d869d[_0x4e7f('0x16')][_0x4e7f('0x19')]);return _0x3af019(_0x1d869d[_0x4e7f('0x16')]['message']);}logger[_0x4e7f('0x16')](_0x4e7f('0x18'),_0x170dce,_0x1d869d[_0x4e7f('0x16')][_0x4e7f('0x19')]);return _0x542e46(_0x1d869d[_0x4e7f('0x16')][_0x4e7f('0x19')]);}else{logger[_0x4e7f('0x12')](_0x4e7f('0x18'),_0x170dce,_0x4e7f('0x13'));_0x542e46(_0x1d869d[_0x4e7f('0x1a')][_0x4e7f('0x19')]);}})[_0x4e7f('0x1b')](function(_0x3daf78){logger[_0x4e7f('0x16')](_0x4e7f('0x18'),_0x170dce,_0x3daf78);_0x3af019(_0x3daf78);});});}exports[_0x4e7f('0x1c')]=function(_0x9caab){var _0x249229=this;return new Promise(function(_0x49c59a,_0x6f2d84){return db[_0x4e7f('0x1d')][_0x4e7f('0x1e')](_0x9caab[_0x4e7f('0x1f')],{'raw':_0x9caab['options']?_0x9caab[_0x4e7f('0x20')][_0x4e7f('0x21')]===undefined?!![]:![]:!![]})[_0x4e7f('0x11')](function(_0x6c7d01){logger[_0x4e7f('0x12')](_0x4e7f('0x1c'),_0x9caab);logger[_0x4e7f('0x14')]('CreateWhatsappMessage',_0x9caab,JSON[_0x4e7f('0x22')](_0x6c7d01));_0x49c59a(_0x6c7d01);})[_0x4e7f('0x1b')](function(_0x2988fb){logger[_0x4e7f('0x16')]('CreateWhatsappMessage',_0x2988fb[_0x4e7f('0x19')],_0x9caab);_0x6f2d84(_0x249229[_0x4e7f('0x16')](0x1f4,_0x2988fb[_0x4e7f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 38e0b19..c8f8944 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 _0x32cf=['./whatsappMessage.events','save','update','emit','removeListener','register','length','whatsappMessage:'];(function(_0x5cf101,_0x2baac6){var _0x17491a=function(_0x168ccd){while(--_0x168ccd){_0x5cf101['push'](_0x5cf101['shift']());}};_0x17491a(++_0x2baac6);}(_0x32cf,0xa0));var _0xf32c=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x32cf[_0x3718b7];return _0xf8c91e;};'use strict';var WhatsappMessageEvents=require(_0xf32c('0x0'));var events=[_0xf32c('0x1'),'remove',_0xf32c('0x2')];function createListener(_0x1fa1ee,_0x1b6794){return function(_0x38abc1){_0x1b6794[_0xf32c('0x3')](_0x1fa1ee,_0x38abc1);};}function removeListener(_0x153954,_0x1b64ba){return function(){WhatsappMessageEvents[_0xf32c('0x4')](_0x153954,_0x1b64ba);};}exports[_0xf32c('0x5')]=function(_0x1c3959){for(var _0xc97ab0=0x0,_0x39d341=events[_0xf32c('0x6')];_0xc97ab0<_0x39d341;_0xc97ab0++){var _0x336035=events[_0xc97ab0];var _0x570815=createListener(_0xf32c('0x7')+_0x336035,_0x1c3959);WhatsappMessageEvents['on'](_0x336035,_0x570815);}}; \ No newline at end of file +var _0x3852=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','removeListener','register'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x3852,0x122));var _0x2385=function(_0x183049,_0x4b279){_0x183049=_0x183049-0x0;var _0xbea4b8=_0x3852[_0x183049];return _0xbea4b8;};'use strict';var WhatsappMessageEvents=require(_0x2385('0x0'));var events=[_0x2385('0x1'),_0x2385('0x2'),_0x2385('0x3')];function createListener(_0x39192b,_0x421eeb){return function(_0x1d1178){_0x421eeb['emit'](_0x39192b,_0x1d1178);};}function removeListener(_0x193f50,_0x536343){return function(){WhatsappMessageEvents[_0x2385('0x4')](_0x193f50,_0x536343);};}exports[_0x2385('0x5')]=function(_0xf53af9){for(var _0x228e7c=0x0,_0x2998c1=events[_0x2385('0x6')];_0x228e7c<_0x2998c1;_0x228e7c++){var _0x225760=events[_0x228e7c];var _0x176560=createListener(_0x2385('0x7')+_0x225760,_0xf53af9);WhatsappMessageEvents['on'](_0x225760,_0x176560);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 53bb578..d51cd96 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 _0x5554=['addTeams','put','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getTeams','/:id/users','post'];(function(_0xe00f4c,_0x59ba20){var _0x5dfa97=function(_0xe557dc){while(--_0xe557dc){_0xe00f4c['push'](_0xe00f4c['shift']());}};_0x5dfa97(++_0x59ba20);}(_0x5554,0x13c));var _0x4555=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5554[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x4555('0x0'));var util=require(_0x4555('0x1'));var path=require(_0x4555('0x2'));var timeout=require(_0x4555('0x3'));var express=require(_0x4555('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4555('0x5'));var interaction=require(_0x4555('0x6'));var config=require(_0x4555('0x7'));var controller=require(_0x4555('0x8'));router['get']('/',auth[_0x4555('0x9')](),controller[_0x4555('0xa')]);router[_0x4555('0xb')](_0x4555('0xc'),auth['isAuthenticated'](),controller[_0x4555('0xd')]);router['get'](_0x4555('0xe'),auth[_0x4555('0x9')](),controller[_0x4555('0xf')]);router[_0x4555('0xb')](_0x4555('0x10'),auth[_0x4555('0x9')](),controller['getMembers']);router[_0x4555('0xb')]('/:id/teams',auth[_0x4555('0x9')](),controller[_0x4555('0x11')]);router[_0x4555('0xb')](_0x4555('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4555('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4555('0x13')]('/:id/teams',auth[_0x4555('0x9')](),controller[_0x4555('0x14')]);router['post'](_0x4555('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x4555('0x15')](_0x4555('0xe'),auth[_0x4555('0x9')](),controller['update']);router[_0x4555('0x16')](_0x4555('0xe'),auth[_0x4555('0x9')](),controller[_0x4555('0x17')]);router[_0x4555('0x16')](_0x4555('0x18'),auth[_0x4555('0x9')](),controller[_0x4555('0x19')]);router[_0x4555('0x16')](_0x4555('0x12'),auth[_0x4555('0x9')](),controller[_0x4555('0x1a')]);module[_0x4555('0x1b')]=router; \ No newline at end of file +var _0x0d4d=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','addTeams','post','addAgents','put','update','destroy','delete','/:id/users','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','/describe'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x0d4d,0x10d));var _0xd0d4=function(_0x22b02c,_0x457c85){_0x22b02c=_0x22b02c-0x0;var _0x35542e=_0x0d4d[_0x22b02c];return _0x35542e;};'use strict';var multer=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var path=require(_0xd0d4('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0d4('0x3'));var router=express[_0xd0d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd0d4('0x5'));var interaction=require(_0xd0d4('0x6'));var config=require('../../config/environment');var controller=require(_0xd0d4('0x7'));router[_0xd0d4('0x8')]('/',auth[_0xd0d4('0x9')](),controller['index']);router[_0xd0d4('0x8')](_0xd0d4('0xa'),auth[_0xd0d4('0x9')](),controller['describe']);router[_0xd0d4('0x8')](_0xd0d4('0xb'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0xc')]);router[_0xd0d4('0x8')](_0xd0d4('0xd'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0xe')]);router[_0xd0d4('0x8')](_0xd0d4('0xf'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x10')]);router[_0xd0d4('0x8')]('/:id/users',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x11')]);router['post']('/',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x12')]);router['post']('/:id/teams',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x13')]);router[_0xd0d4('0x14')]('/:id/users',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x15')]);router[_0xd0d4('0x16')]('/:id',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x17')]);router['delete'](_0xd0d4('0xb'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x18')]);router[_0xd0d4('0x19')]('/:id/teams',auth[_0xd0d4('0x9')](),controller['removeTeams']);router[_0xd0d4('0x19')](_0xd0d4('0x1a'),auth[_0xd0d4('0x9')](),controller['removeAgents']);module[_0xd0d4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 4f26918..23ae7ec 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 _0x18e0=['ENUM','beepall','exports','name','INTEGER'];(function(_0x211e53,_0x34fff2){var _0x551a0e=function(_0x2929a7){while(--_0x2929a7){_0x211e53['push'](_0x211e53['shift']());}};_0x551a0e(++_0x34fff2);}(_0x18e0,0xa2));var _0x018e=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x18e0[_0x39e84d];return _0x1991bc;};'use strict';var Sequelize=require('sequelize');module[_0x018e('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x018e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x018e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x018e('0x3')]('rrmemory',_0x018e('0x4'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba33=['roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xba33,0xf1));var _0x3ba3=function(_0x192c12,_0x2f58d5){_0x192c12=_0x192c12-0x0;var _0x2b7e21=_0xba33[_0x192c12];return _0x2b7e21;};'use strict';var Sequelize=require(_0x3ba3('0x0'));module[_0x3ba3('0x1')]={'name':{'type':Sequelize[_0x3ba3('0x2')],'unique':_0x3ba3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3ba3('0x4')](_0x3ba3('0x5'),_0x3ba3('0x6'),_0x3ba3('0x7'))},'description':{'type':Sequelize[_0x3ba3('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 05af610..df1b1a7 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 _0x8009=['undefined','limit','Content-Range','json','save','update','destroy','then','WhatsappQueues','UserProfileResource','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','catch','show','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getMembers','params','nolimit','UserWhatsappQueue','UserId','agent','whatsappPause','updatedAt','createdAt','format','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','User','select','field','from','team_has_whatsapp_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','union','compact','value','find','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','offset'];(function(_0x3651b8,_0x355550){var _0x261775=function(_0x219fc9){while(--_0x219fc9){_0x3651b8['push'](_0x3651b8['shift']());}};_0x261775(++_0x355550);}(_0x8009,0x1ea));var _0x9800=function(_0xefb766,_0x34b668){_0xefb766=_0xefb766-0x0;var _0x1b04ef=_0x8009[_0xefb766];return _0x1b04ef;};'use strict';var emlformat=require(_0x9800('0x0'));var rimraf=require(_0x9800('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9800('0x2'));var moment=require(_0x9800('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9800('0x4'));var util=require(_0x9800('0x5'));var path=require(_0x9800('0x6'));var sox=require(_0x9800('0x7'));var csv=require(_0x9800('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9800('0x9'));var jsforce=require(_0x9800('0xa'));var deskjs=require(_0x9800('0xb'));var toCsv=require(_0x9800('0x8'));var querystring=require(_0x9800('0xc'));var Papa=require('papaparse');var Redis=require(_0x9800('0xd'));var authService=require(_0x9800('0xe'));var qs=require(_0x9800('0xf'));var as=require(_0x9800('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9800('0x11'));var config=require(_0x9800('0x12'));var licenseUtil=require(_0x9800('0x13'));var db=require(_0x9800('0x14'))['db'];config[_0x9800('0x15')]=_[_0x9800('0x16')](config[_0x9800('0x15')],{'host':_0x9800('0x17'),'port':0x18eb});var socket=require(_0x9800('0x18'))(new Redis(config[_0x9800('0x15')]));require(_0x9800('0x19'))['register'](socket);function respondWithStatusCode(_0x3ca798,_0x58e387){_0x58e387=_0x58e387||0xcc;return function(_0x4e998e){if(_0x4e998e){return _0x3ca798[_0x9800('0x1a')](_0x58e387);}return _0x3ca798[_0x9800('0x1b')](_0x58e387)[_0x9800('0x1c')]();};}function respondWithResult(_0x2ffb16,_0x419607){_0x419607=_0x419607||0xc8;return function(_0x20ebe1){if(_0x20ebe1){return _0x2ffb16[_0x9800('0x1b')](_0x419607)['json'](_0x20ebe1);}};}function respondWithFilteredResult(_0x441030,_0x532467){return function(_0x2b605a){if(_0x2b605a){var _0x26bcd6=typeof _0x532467[_0x9800('0x1d')]===_0x9800('0x1e')&&typeof _0x532467[_0x9800('0x1f')]==='undefined';var _0xa82a94=_0x2b605a['count'];var _0x595968=_0x26bcd6?0x0:_0x532467[_0x9800('0x1d')];var _0x30b269=_0x26bcd6?_0x2b605a['count']:_0x532467[_0x9800('0x1d')]+_0x532467['limit'];var _0x3580f1;if(_0x30b269>=_0xa82a94){_0x30b269=_0xa82a94;_0x3580f1=0xc8;}else{_0x3580f1=0xce;}_0x441030[_0x9800('0x1b')](_0x3580f1);return _0x441030['set'](_0x9800('0x20'),_0x595968+'-'+_0x30b269+'/'+_0xa82a94)[_0x9800('0x21')](_0x2b605a);}return null;};}function patchUpdates(_0x19bbc6){return function(_0x399502){try{jsonpatch['apply'](_0x399502,_0x19bbc6,!![]);}catch(_0x2e6d99){return BPromise['reject'](_0x2e6d99);}return _0x399502[_0x9800('0x22')]();};}function saveUpdates(_0x382134,_0x315196){return function(_0xa8f4b2){if(_0xa8f4b2){return _0xa8f4b2[_0x9800('0x23')](_0x382134)['then'](function(_0x3850b8){return _0x3850b8;});}return null;};}function removeEntity(_0x293665,_0x1bbfff){return function(_0x5cbb2c){if(_0x5cbb2c){return _0x5cbb2c[_0x9800('0x24')]()[_0x9800('0x25')](function(){var _0x5f0fda=_0x5cbb2c['get']({'plain':!![]});var _0x3222f6=_0x9800('0x26');return db[_0x9800('0x27')][_0x9800('0x24')]({'where':{'type':_0x3222f6,'resourceId':_0x5f0fda['id']}})[_0x9800('0x25')](function(){return _0x5cbb2c;});})[_0x9800('0x25')](function(){_0x293665[_0x9800('0x1b')](0xcc)[_0x9800('0x1c')]();});}};}function handleEntityNotFound(_0x48877d,_0x40a961){return function(_0x4903ec){if(!_0x4903ec){_0x48877d[_0x9800('0x1a')](0x194);}return _0x4903ec;};}function handleError(_0x39274e,_0x35aba8){_0x35aba8=_0x35aba8||0x1f4;return function(_0x46168f){logger[_0x9800('0x28')](_0x46168f[_0x9800('0x29')]);if(_0x46168f[_0x9800('0x2a')]){delete _0x46168f['name'];}_0x39274e[_0x9800('0x1b')](_0x35aba8)[_0x9800('0x2b')](_0x46168f);};}exports['index']=function(_0x90f975,_0x497601){var _0x473f68={},_0xbaba9d={},_0x372880={'count':0x0,'rows':[]};var _0x137a99=_[_0x9800('0x2c')](db[_0x9800('0x2d')][_0x9800('0x2e')],function(_0x290cd9){return{'name':_0x290cd9[_0x9800('0x2f')],'type':_0x290cd9[_0x9800('0x30')][_0x9800('0x31')]};});_0xbaba9d[_0x9800('0x32')]=_[_0x9800('0x2c')](_0x137a99,_0x9800('0x2a'));_0xbaba9d[_0x9800('0x33')]=_[_0x9800('0x34')](_0x90f975['query']);_0xbaba9d[_0x9800('0x35')]=_[_0x9800('0x36')](_0xbaba9d[_0x9800('0x32')],_0xbaba9d[_0x9800('0x33')]);_0x473f68[_0x9800('0x37')]=_['intersection'](_0xbaba9d[_0x9800('0x32')],qs[_0x9800('0x38')](_0x90f975[_0x9800('0x33')][_0x9800('0x38')]));_0x473f68['attributes']=_0x473f68['attributes'][_0x9800('0x39')]?_0x473f68[_0x9800('0x37')]:_0xbaba9d[_0x9800('0x32')];if(!_0x90f975[_0x9800('0x33')][_0x9800('0x3a')]('nolimit')){_0x473f68[_0x9800('0x1f')]=qs[_0x9800('0x1f')](_0x90f975[_0x9800('0x33')][_0x9800('0x1f')]);_0x473f68['offset']=qs[_0x9800('0x1d')](_0x90f975[_0x9800('0x33')][_0x9800('0x1d')]);}_0x473f68[_0x9800('0x3b')]=qs[_0x9800('0x3c')](_0x90f975['query']['sort']);_0x473f68[_0x9800('0x3d')]=qs[_0x9800('0x35')](_[_0x9800('0x3e')](_0x90f975[_0x9800('0x33')],_0xbaba9d[_0x9800('0x35')]),_0x137a99);if(_0x90f975[_0x9800('0x33')][_0x9800('0x3f')]){_0x473f68[_0x9800('0x3d')]=_[_0x9800('0x40')](_0x473f68[_0x9800('0x3d')],{'$or':_[_0x9800('0x2c')](_0x137a99,function(_0x5b76d5){if(_0x5b76d5[_0x9800('0x30')]!=='VIRTUAL'){var _0x278268={};_0x278268[_0x5b76d5[_0x9800('0x2a')]]={'$like':'%'+_0x90f975['query'][_0x9800('0x3f')]+'%'};return _0x278268;}})});}_0x473f68=_[_0x9800('0x40')]({},_0x473f68,_0x90f975[_0x9800('0x41')]);var _0x1fb110={'where':_0x473f68[_0x9800('0x3d')]};return db[_0x9800('0x2d')]['count'](_0x1fb110)[_0x9800('0x25')](function(_0x4f3ae8){_0x372880[_0x9800('0x42')]=_0x4f3ae8;if(_0x90f975[_0x9800('0x33')][_0x9800('0x43')]){_0x473f68['include']=[{'all':!![]}];}return db[_0x9800('0x2d')][_0x9800('0x44')](_0x473f68);})[_0x9800('0x25')](function(_0x506534){_0x372880[_0x9800('0x45')]=_0x506534;return _0x372880;})[_0x9800('0x25')](respondWithFilteredResult(_0x497601,_0x473f68))[_0x9800('0x46')](handleError(_0x497601,null));};exports[_0x9800('0x47')]=function(_0x1a8f61,_0x3eb4af){var _0x2663e9={'raw':!![],'where':{'id':_0x1a8f61['params']['id']}},_0x4357de={};_0x4357de[_0x9800('0x32')]=_['keys'](db[_0x9800('0x2d')][_0x9800('0x2e')]);_0x4357de[_0x9800('0x33')]=_[_0x9800('0x34')](_0x1a8f61['query']);_0x4357de[_0x9800('0x35')]=_[_0x9800('0x36')](_0x4357de[_0x9800('0x32')],_0x4357de[_0x9800('0x33')]);_0x2663e9[_0x9800('0x37')]=_[_0x9800('0x36')](_0x4357de[_0x9800('0x32')],qs[_0x9800('0x38')](_0x1a8f61[_0x9800('0x33')]['fields']));_0x2663e9[_0x9800('0x37')]=_0x2663e9[_0x9800('0x37')][_0x9800('0x39')]?_0x2663e9['attributes']:_0x4357de['model'];if(_0x1a8f61[_0x9800('0x33')][_0x9800('0x43')]){_0x2663e9[_0x9800('0x48')]=[{'all':!![]}];}_0x2663e9=_[_0x9800('0x40')]({},_0x2663e9,_0x1a8f61[_0x9800('0x41')]);return db[_0x9800('0x2d')]['find'](_0x2663e9)[_0x9800('0x25')](handleEntityNotFound(_0x3eb4af,null))['then'](respondWithResult(_0x3eb4af,null))['catch'](handleError(_0x3eb4af,null));};exports[_0x9800('0x49')]=function(_0x59b406,_0x45920c){return db[_0x9800('0x2d')][_0x9800('0x49')](_0x59b406[_0x9800('0x4a')],{})[_0x9800('0x25')](function(_0x2c2332){var _0x43e74f=_0x59b406['user'][_0x9800('0x4b')]({'plain':!![]});if(!_0x43e74f)throw new Error(_0x9800('0x4c'));if(_0x43e74f['role']==='user'){var _0x3895a1=_0x2c2332[_0x9800('0x4b')]({'plain':!![]});var _0x2385d3=_0x9800('0x26');return db[_0x9800('0x4d')]['find']({'where':{'name':_0x2385d3,'userProfileId':_0x43e74f[_0x9800('0x4e')]},'raw':!![]})[_0x9800('0x25')](function(_0x485c8b){if(_0x485c8b&&_0x485c8b[_0x9800('0x4f')]===0x0){return db[_0x9800('0x27')]['create']({'name':_0x3895a1[_0x9800('0x2a')],'resourceId':_0x3895a1['id'],'type':_0x485c8b[_0x9800('0x2a')],'sectionId':_0x485c8b['id']},{})[_0x9800('0x25')](function(){return _0x2c2332;});}else{return _0x2c2332;}})[_0x9800('0x46')](function(_0x56a9cc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56a9cc);throw _0x56a9cc;});}return _0x2c2332;})[_0x9800('0x25')](respondWithResult(_0x45920c,0xc9))[_0x9800('0x46')](handleError(_0x45920c,null));};exports[_0x9800('0x23')]=function(_0xe2ee03,_0x246af9){if(_0xe2ee03['body']['id']){delete _0xe2ee03[_0x9800('0x4a')]['id'];}return db[_0x9800('0x2d')]['find']({'where':{'id':_0xe2ee03['params']['id']}})[_0x9800('0x25')](handleEntityNotFound(_0x246af9,null))['then'](saveUpdates(_0xe2ee03[_0x9800('0x4a')],null))['then'](respondWithResult(_0x246af9,null))[_0x9800('0x46')](handleError(_0x246af9,null));};exports[_0x9800('0x24')]=function(_0x433b07,_0x195243){return db[_0x9800('0x2d')]['find']({'where':{'id':_0x433b07['params']['id']}})['then'](handleEntityNotFound(_0x195243,null))[_0x9800('0x25')](removeEntity(_0x195243,null))[_0x9800('0x46')](handleError(_0x195243,null));};exports['describe']=function(_0x42eeac,_0xde1a41){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0xde1a41,null))[_0x9800('0x46')](handleError(_0xde1a41,null));};exports[_0x9800('0x50')]=function(_0x2c8cf7,_0x3f2ecb,_0x2c32bf){var _0x85ee28={'raw':!![],'where':{}},_0x357b3b={},_0x5254ea;return db[_0x9800('0x2d')]['findOne']({'where':{'id':_0x2c8cf7[_0x9800('0x51')]['id']}})['then'](handleEntityNotFound(_0x3f2ecb,null))[_0x9800('0x25')](function(_0x458487){if(_0x458487){_0x5254ea=_0x458487[_0x9800('0x4b')]({'plain':!![]});_0x357b3b[_0x9800('0x32')]=_[_0x9800('0x34')](db['UserWhatsappQueue'][_0x9800('0x2e')]);_0x357b3b[_0x9800('0x33')]=_[_0x9800('0x34')](_0x2c8cf7[_0x9800('0x33')]);_0x357b3b['filters']=_[_0x9800('0x36')](_0x357b3b[_0x9800('0x32')],_0x357b3b[_0x9800('0x33')]);_0x85ee28[_0x9800('0x37')]=_[_0x9800('0x36')](_0x357b3b[_0x9800('0x32')],qs[_0x9800('0x38')](_0x2c8cf7[_0x9800('0x33')][_0x9800('0x38')]));_0x85ee28[_0x9800('0x37')]=_0x85ee28[_0x9800('0x37')][_0x9800('0x39')]?_0x85ee28[_0x9800('0x37')]:_0x357b3b[_0x9800('0x32')];if(!_0x2c8cf7[_0x9800('0x33')][_0x9800('0x3a')](_0x9800('0x52'))){_0x85ee28[_0x9800('0x1f')]=qs[_0x9800('0x1f')](_0x2c8cf7['query'][_0x9800('0x1f')]);_0x85ee28[_0x9800('0x1d')]=qs[_0x9800('0x1d')](_0x2c8cf7[_0x9800('0x33')][_0x9800('0x1d')]);}_0x85ee28[_0x9800('0x3b')]=qs['sort'](_0x2c8cf7[_0x9800('0x33')][_0x9800('0x3c')]);_0x85ee28[_0x9800('0x3d')]=qs[_0x9800('0x35')](_[_0x9800('0x3e')](_0x2c8cf7[_0x9800('0x33')],_0x357b3b[_0x9800('0x35')]));_0x85ee28[_0x9800('0x3d')]['WhatsappQueueId']=_0x458487['id'];if(_0x2c8cf7[_0x9800('0x33')][_0x9800('0x3f')]){_0x85ee28[_0x9800('0x3d')]=_[_0x9800('0x40')](_0x85ee28[_0x9800('0x3d')],{'$or':_['map'](_0x85ee28['attributes'],function(_0x10c3bc){var _0xd6219={};_0xd6219[_0x10c3bc]={'$like':'%'+_0x2c8cf7['query'][_0x9800('0x3f')]+'%'};return _0xd6219;})});}_0x85ee28=_[_0x9800('0x40')]({},_0x85ee28,_0x2c8cf7['options']);return db[_0x9800('0x53')][_0x9800('0x44')](_0x85ee28);}})[_0x9800('0x25')](function(_0x334e85){if(_0x334e85){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x334e85,_0x9800('0x54')),'role':_0x9800('0x55')},'attributes':['id','name',_0x9800('0x56'),_0x9800('0x57'),_0x9800('0x58')]});}})[_0x9800('0x25')](function(_0x1650ee){if(_0x1650ee){return{'count':_0x1650ee['count'],'rows':_[_0x9800('0x2c')](_0x1650ee[_0x9800('0x45')],function(_0x2d43f8){return{'membername':_0x2d43f8['name'],'UserId':_0x2d43f8['id'],'queue_name':_0x5254ea[_0x9800('0x2a')],'WhatsappQueueId':_0x5254ea['id'],'interface':util[_0x9800('0x59')]('%s/%s','SIP',_0x2d43f8[_0x9800('0x2a')]),'penalty':0x0,'paused':_0x2d43f8[_0x9800('0x56')],'createdAt':_0x2d43f8[_0x9800('0x58')],'updatedAt':_0x2d43f8[_0x9800('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9800('0x25')](respondWithFilteredResult(_0x3f2ecb,_0x85ee28))['catch'](handleError(_0x3f2ecb,null));};exports[_0x9800('0x5a')]=function(_0xc57865,_0x1b4041,_0x324fe3){var _0x2830e6={};var _0x5b5286={};var _0x5c8933;var _0x42460a;return db['WhatsappQueue'][_0x9800('0x5b')]({'where':{'id':_0xc57865[_0x9800('0x51')]['id']}})['then'](handleEntityNotFound(_0x1b4041,null))[_0x9800('0x25')](function(_0xd2edab){if(_0xd2edab){_0x5c8933=_0xd2edab;_0x5b5286[_0x9800('0x32')]=_['keys'](db[_0x9800('0x5c')][_0x9800('0x2e')]);_0x5b5286[_0x9800('0x33')]=_[_0x9800('0x34')](_0xc57865[_0x9800('0x33')]);_0x5b5286['filters']=_[_0x9800('0x36')](_0x5b5286[_0x9800('0x32')],_0x5b5286[_0x9800('0x33')]);_0x2830e6['attributes']=_[_0x9800('0x36')](_0x5b5286['model'],qs[_0x9800('0x38')](_0xc57865[_0x9800('0x33')]['fields']));_0x2830e6[_0x9800('0x37')]=_0x2830e6['attributes'][_0x9800('0x39')]?_0x2830e6['attributes']:_0x5b5286[_0x9800('0x32')];_0x2830e6[_0x9800('0x3b')]=qs[_0x9800('0x3c')](_0xc57865[_0x9800('0x33')][_0x9800('0x3c')]);_0x2830e6[_0x9800('0x3d')]=qs[_0x9800('0x35')](_[_0x9800('0x3e')](_0xc57865[_0x9800('0x33')],_0x5b5286['filters']));if(_0xc57865['query'][_0x9800('0x3f')]){_0x2830e6[_0x9800('0x3d')]=_[_0x9800('0x40')](_0x2830e6[_0x9800('0x3d')],{'$or':_[_0x9800('0x2c')](_0x2830e6[_0x9800('0x37')],function(_0x4f4197){var _0x4ba3a5={};_0x4ba3a5[_0x4f4197]={'$like':'%'+_0xc57865[_0x9800('0x33')][_0x9800('0x3f')]+'%'};return _0x4ba3a5;})});}_0x2830e6=_[_0x9800('0x40')]({},_0x2830e6,_0xc57865[_0x9800('0x41')]);return _0x5c8933[_0x9800('0x5a')](_0x2830e6);}})['then'](function(_0x4719f2){if(_0x4719f2){_0x42460a=_0x4719f2[_0x9800('0x39')];if(!_0xc57865[_0x9800('0x33')][_0x9800('0x3a')](_0x9800('0x52'))){_0x2830e6[_0x9800('0x1f')]=qs[_0x9800('0x1f')](_0xc57865[_0x9800('0x33')][_0x9800('0x1f')]);_0x2830e6[_0x9800('0x1d')]=qs[_0x9800('0x1d')](_0xc57865[_0x9800('0x33')]['offset']);}return _0x5c8933['getTeams'](_0x2830e6);}})[_0x9800('0x25')](function(_0x3ba499){if(_0x3ba499){return _0x3ba499?{'count':_0x42460a,'rows':_0x3ba499}:null;}})['then'](respondWithResult(_0x1b4041,null))[_0x9800('0x46')](handleError(_0x1b4041,null));};exports[_0x9800('0x5d')]=function(_0x4b7190,_0x1d17a4,_0x1642a4){var _0x35f5bd=_0x4b7190[_0x9800('0x4a')][_0x9800('0x5e')];return db[_0x9800('0x5c')][_0x9800('0x44')]({'where':{'id':_0x35f5bd},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9800('0x5f'),'attributes':['id',_0x9800('0x2a'),_0x9800('0x60'),_0x9800('0x61'),_0x9800('0x62')],'raw':!![]}]})['then'](function(_0x498843){if(_0x498843){var _0x56dbbc=_['flatMap'](_0x498843,function(_0x151587){var _0x50f178=_0x151587[_0x9800('0x4b')]({'plain':!![]});return _0x50f178[_0x9800('0x5f')];});return db[_0x9800('0x2d')]['find']({'where':{'id':_0x4b7190['params']['id']}})[_0x9800('0x25')](function(_0x1e02ae){return db[_0x9800('0x63')][_0x9800('0x64')](function(_0x4bbfa3){return _0x1e02ae[_0x9800('0x5d')](_0x35f5bd,{'transaction':_0x4bbfa3})[_0x9800('0x25')](function(){return BPromise[_0x9800('0x65')](_0x56dbbc,function(_0x5ca918){return db[_0x9800('0x53')]['findOrCreate']({'where':{'UserId':_0x5ca918['id'],'WhatsappQueueId':_0x4b7190[_0x9800('0x51')]['id']},'transaction':_0x4bbfa3});});})[_0x9800('0x25')](function(){_0x56dbbc[_0x9800('0x66')](function(_0x186cf0){socket[_0x9800('0x67')](_0x9800('0x68'),{'UserId':_0x186cf0['id'],'WhatsappQueueId':_0x1e02ae['id']});});});});});}})['then'](respondWithStatusCode(_0x1d17a4,null))[_0x9800('0x46')](handleError(_0x1d17a4,null));};exports[_0x9800('0x69')]=function(_0x503fd1,_0x10b141,_0x456564){return db[_0x9800('0x5c')][_0x9800('0x44')]({'where':{'id':_0x503fd1[_0x9800('0x33')][_0x9800('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x9800('0x6a')],'as':_0x9800('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x9800('0x25')](handleEntityNotFound(_0x10b141,null))['then'](function(_0x44acda){var _0x3f1c73=_['map'](_0x44acda,'id');var _0x4509bb=[];var _0x1d3400=[];var _0x3cc20a=squel[_0x9800('0x6b')]();_0x3cc20a[_0x9800('0x6c')]('tq.TeamId')[_0x9800('0x6d')](_0x9800('0x6e'),'tq')['join'](_0x9800('0x6f'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('WhatsappQueueId\x20=\x20?',_0x503fd1[_0x9800('0x51')]['id']);for(var _0x4fac01=0x0;_0x4fac01<_0x44acda['length'];_0x4fac01+=0x1){let _0x58272e=_0x44acda[_0x4fac01];for(var _0x57ed26=0x0;_0x57ed26<_0x58272e[_0x9800('0x5f')][_0x9800('0x39')];_0x57ed26+=0x1){let _0x3dbca7=_0x58272e[_0x9800('0x5f')][_0x57ed26];var _0x1a3637=_0x3cc20a[_0x9800('0x70')]();_0x1a3637[_0x9800('0x3d')](_0x9800('0x71'),_0x3dbca7['id']);_0x1d3400[_0x9800('0x72')](db['sequelize'][_0x9800('0x33')](_0x1a3637[_0x9800('0x73')](),{'type':db[_0x9800('0x63')]['QueryTypes'][_0x9800('0x74')]})['then'](function(_0x16f1b1){if(_0x16f1b1[_0x9800('0x39')]===0x1){return _0x3dbca7['id'];}else{var _0x5997d8=_['every'](_[_0x9800('0x2c')](_0x16f1b1,_0x9800('0x75')),function(_0x17b2ae){return _[_0x9800('0x76')](_0x3f1c73,_0x17b2ae);});if(_0x5997d8){return _0x3dbca7['id'];}}}));}}return BPromise['all'](_0x1d3400)['then'](function(_0xc30ac9){_0x4509bb=_(_0x4509bb)[_0x9800('0x77')](_0xc30ac9)[_0x9800('0x78')]()[_0x9800('0x79')]();return db[_0x9800('0x2d')][_0x9800('0x7a')]({'where':{'id':_0x503fd1[_0x9800('0x51')]['id']}})[_0x9800('0x25')](function(_0x7e6402){return db[_0x9800('0x63')][_0x9800('0x64')](function(_0x20ea61){return _0x7e6402[_0x9800('0x69')](_0x503fd1[_0x9800('0x33')][_0x9800('0x5e')],{'transaction':_0x20ea61})['then'](function(){if(!_[_0x9800('0x7b')](_0x4509bb)){return _0x7e6402[_0x9800('0x7c')](_0x4509bb,{'transaction':_0x20ea61});}})[_0x9800('0x25')](function(){_0x4509bb[_0x9800('0x66')](function(_0x1696c8){socket['emit'](_0x9800('0x7d'),{'UserId':_0x1696c8,'WhatsappQueueId':_0x7e6402['id']});});});});});});})[_0x9800('0x25')](respondWithStatusCode(_0x10b141,null))[_0x9800('0x46')](handleError(_0x10b141,null));};exports[_0x9800('0x7e')]=function(_0x4b5d9d,_0x1fc6ae,_0x384daa){return db[_0x9800('0x2d')][_0x9800('0x7a')]({'where':{'id':_0x4b5d9d['params']['id']}})['then'](handleEntityNotFound(_0x1fc6ae,null))[_0x9800('0x25')](function(_0x453922){if(_0x453922){return _0x453922[_0x9800('0x7e')](_0x4b5d9d[_0x9800('0x4a')][_0x9800('0x5e')],_[_0x9800('0x7f')](_0x4b5d9d[_0x9800('0x4a')],[_0x9800('0x5e'),'id'])||{})[_0x9800('0x80')](function(_0x46fb43){for(var _0x4be14e=0x0;_0x4be14e<_0x4b5d9d[_0x9800('0x4a')][_0x9800('0x5e')]['length'];_0x4be14e+=0x1){socket[_0x9800('0x67')]('userWhatsappQueue:save',{'UserId':Number(_0x4b5d9d[_0x9800('0x4a')]['ids'][_0x4be14e]),'WhatsappQueueId':Number(_0x4b5d9d[_0x9800('0x51')]['id'])});}return _0x46fb43;});}})[_0x9800('0x25')](respondWithResult(_0x1fc6ae,null))[_0x9800('0x46')](handleError(_0x1fc6ae,null));};exports[_0x9800('0x7c')]=function(_0x2c3e5e,_0x56a19e,_0x529655){return db[_0x9800('0x2d')][_0x9800('0x7a')]({'where':{'id':_0x2c3e5e['params']['id']}})[_0x9800('0x25')](handleEntityNotFound(_0x56a19e,null))[_0x9800('0x25')](function(_0x14da9c){if(_0x14da9c){return _0x14da9c[_0x9800('0x7c')](_0x2c3e5e['query'][_0x9800('0x5e')])[_0x9800('0x25')](function(){if(_['isArray'](_0x2c3e5e[_0x9800('0x33')]['ids'])){for(var _0x31b2df=0x0;_0x31b2df<_0x2c3e5e['query'][_0x9800('0x5e')][_0x9800('0x39')];_0x31b2df+=0x1){socket[_0x9800('0x67')](_0x9800('0x7d'),{'UserId':Number(_0x2c3e5e['query']['ids'][_0x31b2df]),'WhatsappQueueId':Number(_0x2c3e5e[_0x9800('0x51')]['id'])});}}else{socket[_0x9800('0x67')]('userWhatsappQueue:remove',{'UserId':Number(_0x2c3e5e[_0x9800('0x33')][_0x9800('0x5e')]),'WhatsappQueueId':Number(_0x2c3e5e[_0x9800('0x51')]['id'])});}});}})[_0x9800('0x25')](respondWithStatusCode(_0x56a19e,null))['catch'](handleError(_0x56a19e,null));};exports[_0x9800('0x81')]=function(_0x308720,_0x2fa61e,_0x2d6508){var _0x30d31e={};var _0x18708a={};var _0xec852e;var _0x3e577e;return db[_0x9800('0x2d')][_0x9800('0x5b')]({'where':{'id':_0x308720[_0x9800('0x51')]['id']}})['then'](handleEntityNotFound(_0x2fa61e,null))[_0x9800('0x25')](function(_0x18c629){if(_0x18c629){_0xec852e=_0x18c629;_0x18708a[_0x9800('0x32')]=_[_0x9800('0x34')](db[_0x9800('0x6a')][_0x9800('0x2e')]);_0x18708a[_0x9800('0x33')]=_['keys'](_0x308720[_0x9800('0x33')]);_0x18708a[_0x9800('0x35')]=_['intersection'](_0x18708a[_0x9800('0x32')],_0x18708a[_0x9800('0x33')]);_0x30d31e[_0x9800('0x37')]=_['intersection'](_0x18708a[_0x9800('0x32')],qs['fields'](_0x308720[_0x9800('0x33')][_0x9800('0x38')]));_0x30d31e[_0x9800('0x37')]=_0x30d31e['attributes'][_0x9800('0x39')]?_0x30d31e['attributes']:_0x18708a[_0x9800('0x32')];_0x30d31e[_0x9800('0x3b')]=qs[_0x9800('0x3c')](_0x308720[_0x9800('0x33')][_0x9800('0x3c')]);_0x30d31e[_0x9800('0x3d')]=qs[_0x9800('0x35')](_[_0x9800('0x3e')](_0x308720[_0x9800('0x33')],_0x18708a[_0x9800('0x35')]));if(_0x308720[_0x9800('0x33')][_0x9800('0x3f')]){_0x30d31e[_0x9800('0x3d')]=_[_0x9800('0x40')](_0x30d31e[_0x9800('0x3d')],{'$or':_[_0x9800('0x2c')](_0x30d31e[_0x9800('0x37')],function(_0x32b846){var _0x14d433={};_0x14d433[_0x32b846]={'$like':'%'+_0x308720[_0x9800('0x33')][_0x9800('0x3f')]+'%'};return _0x14d433;})});}_0x30d31e=_[_0x9800('0x40')]({},_0x30d31e,_0x308720[_0x9800('0x41')]);return _0xec852e[_0x9800('0x81')](_0x30d31e);}})[_0x9800('0x25')](function(_0x630a8e){if(_0x630a8e){_0x3e577e=_0x630a8e[_0x9800('0x39')];if(!_0x308720['query'][_0x9800('0x3a')](_0x9800('0x52'))){_0x30d31e[_0x9800('0x1f')]=qs[_0x9800('0x1f')](_0x308720['query'][_0x9800('0x1f')]);_0x30d31e[_0x9800('0x1d')]=qs[_0x9800('0x1d')](_0x308720[_0x9800('0x33')][_0x9800('0x1d')]);}return _0xec852e[_0x9800('0x81')](_0x30d31e);}})[_0x9800('0x25')](function(_0x2b0be7){if(_0x2b0be7){return _0x2b0be7?{'count':_0x3e577e,'rows':_0x2b0be7}:null;}})[_0x9800('0x25')](respondWithResult(_0x2fa61e,null))[_0x9800('0x46')](handleError(_0x2fa61e,null));}; \ No newline at end of file +var _0xcee1=['UserProfileResource','end','sendStatus','error','name','send','index','map','WhatsappQueue','rawAttributes','type','key','query','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','options','User','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','findOne','Team','getTeams','hasOwnProperty','addTeams','ids','Agents','voicePause','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','omit','isArray','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./whatsappQueue.socket','status','offset','undefined','limit','count','set','apply','reject','then','destroy','WhatsappQueues'];(function(_0x23d643,_0x3a341e){var _0x18d292=function(_0x54fdeb){while(--_0x54fdeb){_0x23d643['push'](_0x23d643['shift']());}};_0x18d292(++_0x3a341e);}(_0xcee1,0xe3));var _0x1cee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcee1[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1cee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1cee('0x1'));var rp=require('request-promise');var moment=require(_0x1cee('0x2'));var BPromise=require(_0x1cee('0x3'));var Mustache=require(_0x1cee('0x4'));var util=require(_0x1cee('0x5'));var path=require(_0x1cee('0x6'));var sox=require(_0x1cee('0x7'));var csv=require('to-csv');var ejs=require(_0x1cee('0x8'));var fs=require('fs');var fs_extra=require(_0x1cee('0x9'));var _=require(_0x1cee('0xa'));var squel=require('squel');var crypto=require(_0x1cee('0xb'));var jsforce=require(_0x1cee('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1cee('0xd'));var Papa=require(_0x1cee('0xe'));var Redis=require('ioredis');var authService=require(_0x1cee('0xf'));var qs=require(_0x1cee('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1cee('0x11'));var logger=require(_0x1cee('0x12'))(_0x1cee('0x13'));var utils=require(_0x1cee('0x14'));var config=require(_0x1cee('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cee('0x16'))['db'];config[_0x1cee('0x17')]=_['defaults'](config[_0x1cee('0x17')],{'host':_0x1cee('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cee('0x17')]));require(_0x1cee('0x19'))['register'](socket);function respondWithStatusCode(_0x591eeb,_0x180457){_0x180457=_0x180457||0xcc;return function(_0x54042d){if(_0x54042d){return _0x591eeb['sendStatus'](_0x180457);}return _0x591eeb[_0x1cee('0x1a')](_0x180457)['end']();};}function respondWithResult(_0x1c47ff,_0x515632){_0x515632=_0x515632||0xc8;return function(_0x433ac7){if(_0x433ac7){return _0x1c47ff['status'](_0x515632)['json'](_0x433ac7);}};}function respondWithFilteredResult(_0xa7769f,_0x1f2f85){return function(_0x144016){if(_0x144016){var _0x42fa8a=typeof _0x1f2f85[_0x1cee('0x1b')]===_0x1cee('0x1c')&&typeof _0x1f2f85[_0x1cee('0x1d')]===_0x1cee('0x1c');var _0x2e8d2d=_0x144016[_0x1cee('0x1e')];var _0x5db29a=_0x42fa8a?0x0:_0x1f2f85[_0x1cee('0x1b')];var _0x6c617b=_0x42fa8a?_0x144016[_0x1cee('0x1e')]:_0x1f2f85[_0x1cee('0x1b')]+_0x1f2f85['limit'];var _0x3b7c06;if(_0x6c617b>=_0x2e8d2d){_0x6c617b=_0x2e8d2d;_0x3b7c06=0xc8;}else{_0x3b7c06=0xce;}_0xa7769f[_0x1cee('0x1a')](_0x3b7c06);return _0xa7769f[_0x1cee('0x1f')]('Content-Range',_0x5db29a+'-'+_0x6c617b+'/'+_0x2e8d2d)['json'](_0x144016);}return null;};}function patchUpdates(_0x23077e){return function(_0x54db2a){try{jsonpatch[_0x1cee('0x20')](_0x54db2a,_0x23077e,!![]);}catch(_0x276ec2){return BPromise[_0x1cee('0x21')](_0x276ec2);}return _0x54db2a['save']();};}function saveUpdates(_0x4d2094,_0x451c06){return function(_0x566d95){if(_0x566d95){return _0x566d95['update'](_0x4d2094)[_0x1cee('0x22')](function(_0x6554e){return _0x6554e;});}return null;};}function removeEntity(_0x1bdf88,_0x20058d){return function(_0x1beacf){if(_0x1beacf){return _0x1beacf[_0x1cee('0x23')]()['then'](function(){var _0x3df3ee=_0x1beacf['get']({'plain':!![]});var _0x790b38=_0x1cee('0x24');return db[_0x1cee('0x25')]['destroy']({'where':{'type':_0x790b38,'resourceId':_0x3df3ee['id']}})['then'](function(){return _0x1beacf;});})['then'](function(){_0x1bdf88[_0x1cee('0x1a')](0xcc)[_0x1cee('0x26')]();});}};}function handleEntityNotFound(_0x53d435,_0x54b6fe){return function(_0x35d8a2){if(!_0x35d8a2){_0x53d435[_0x1cee('0x27')](0x194);}return _0x35d8a2;};}function handleError(_0x18cd43,_0x9f99c6){_0x9f99c6=_0x9f99c6||0x1f4;return function(_0x429c6e){logger[_0x1cee('0x28')](_0x429c6e['stack']);if(_0x429c6e['name']){delete _0x429c6e[_0x1cee('0x29')];}_0x18cd43[_0x1cee('0x1a')](_0x9f99c6)[_0x1cee('0x2a')](_0x429c6e);};}exports[_0x1cee('0x2b')]=function(_0x13d5c6,_0x42e5e9){var _0x3f94c5={},_0x1021eb={},_0x404af5={'count':0x0,'rows':[]};var _0x4f83e0=_[_0x1cee('0x2c')](db[_0x1cee('0x2d')][_0x1cee('0x2e')],function(_0x14f487){return{'name':_0x14f487['fieldName'],'type':_0x14f487[_0x1cee('0x2f')][_0x1cee('0x30')]};});_0x1021eb['model']=_['map'](_0x4f83e0,_0x1cee('0x29'));_0x1021eb[_0x1cee('0x31')]=_['keys'](_0x13d5c6[_0x1cee('0x31')]);_0x1021eb['filters']=_['intersection'](_0x1021eb['model'],_0x1021eb[_0x1cee('0x31')]);_0x3f94c5['attributes']=_[_0x1cee('0x32')](_0x1021eb[_0x1cee('0x33')],qs[_0x1cee('0x34')](_0x13d5c6[_0x1cee('0x31')][_0x1cee('0x34')]));_0x3f94c5[_0x1cee('0x35')]=_0x3f94c5[_0x1cee('0x35')][_0x1cee('0x36')]?_0x3f94c5[_0x1cee('0x35')]:_0x1021eb[_0x1cee('0x33')];if(!_0x13d5c6['query']['hasOwnProperty'](_0x1cee('0x37'))){_0x3f94c5['limit']=qs[_0x1cee('0x1d')](_0x13d5c6[_0x1cee('0x31')][_0x1cee('0x1d')]);_0x3f94c5['offset']=qs[_0x1cee('0x1b')](_0x13d5c6[_0x1cee('0x31')]['offset']);}_0x3f94c5[_0x1cee('0x38')]=qs[_0x1cee('0x39')](_0x13d5c6['query'][_0x1cee('0x39')]);_0x3f94c5['where']=qs['filters'](_[_0x1cee('0x3a')](_0x13d5c6[_0x1cee('0x31')],_0x1021eb[_0x1cee('0x3b')]),_0x4f83e0);if(_0x13d5c6[_0x1cee('0x31')][_0x1cee('0x3c')]){_0x3f94c5[_0x1cee('0x3d')]=_[_0x1cee('0x3e')](_0x3f94c5[_0x1cee('0x3d')],{'$or':_['map'](_0x4f83e0,function(_0x3252e5){if(_0x3252e5[_0x1cee('0x2f')]!==_0x1cee('0x3f')){var _0x2267d6={};_0x2267d6[_0x3252e5['name']]={'$like':'%'+_0x13d5c6[_0x1cee('0x31')]['filter']+'%'};return _0x2267d6;}})});}_0x3f94c5=_[_0x1cee('0x3e')]({},_0x3f94c5,_0x13d5c6['options']);var _0x2d8f2d={'where':_0x3f94c5[_0x1cee('0x3d')]};return db['WhatsappQueue']['count'](_0x2d8f2d)[_0x1cee('0x22')](function(_0x591f6c){_0x404af5[_0x1cee('0x1e')]=_0x591f6c;if(_0x13d5c6['query'][_0x1cee('0x40')]){_0x3f94c5[_0x1cee('0x41')]=[{'all':!![]}];}return db[_0x1cee('0x2d')][_0x1cee('0x42')](_0x3f94c5);})[_0x1cee('0x22')](function(_0x2d464b){_0x404af5[_0x1cee('0x43')]=_0x2d464b;return _0x404af5;})[_0x1cee('0x22')](respondWithFilteredResult(_0x42e5e9,_0x3f94c5))[_0x1cee('0x44')](handleError(_0x42e5e9,null));};exports[_0x1cee('0x45')]=function(_0x16e682,_0x4333b0){var _0x46109f={'raw':!![],'where':{'id':_0x16e682[_0x1cee('0x46')]['id']}},_0xf5ae0f={};_0xf5ae0f[_0x1cee('0x33')]=_[_0x1cee('0x47')](db['WhatsappQueue']['rawAttributes']);_0xf5ae0f[_0x1cee('0x31')]=_[_0x1cee('0x47')](_0x16e682['query']);_0xf5ae0f[_0x1cee('0x3b')]=_[_0x1cee('0x32')](_0xf5ae0f[_0x1cee('0x33')],_0xf5ae0f['query']);_0x46109f[_0x1cee('0x35')]=_[_0x1cee('0x32')](_0xf5ae0f[_0x1cee('0x33')],qs['fields'](_0x16e682[_0x1cee('0x31')]['fields']));_0x46109f[_0x1cee('0x35')]=_0x46109f['attributes'][_0x1cee('0x36')]?_0x46109f[_0x1cee('0x35')]:_0xf5ae0f[_0x1cee('0x33')];if(_0x16e682[_0x1cee('0x31')][_0x1cee('0x40')]){_0x46109f[_0x1cee('0x41')]=[{'all':!![]}];}_0x46109f=_[_0x1cee('0x3e')]({},_0x46109f,_0x16e682['options']);return db[_0x1cee('0x2d')][_0x1cee('0x48')](_0x46109f)['then'](handleEntityNotFound(_0x4333b0,null))['then'](respondWithResult(_0x4333b0,null))[_0x1cee('0x44')](handleError(_0x4333b0,null));};exports[_0x1cee('0x49')]=function(_0x4e0e1d,_0x92f75f){return db['WhatsappQueue'][_0x1cee('0x49')](_0x4e0e1d[_0x1cee('0x4a')],{})[_0x1cee('0x22')](function(_0x550484){var _0x5f107d=_0x4e0e1d[_0x1cee('0x4b')][_0x1cee('0x4c')]({'plain':!![]});if(!_0x5f107d)throw new Error(_0x1cee('0x4d'));if(_0x5f107d[_0x1cee('0x4e')]===_0x1cee('0x4b')){var _0x83fd5c=_0x550484['get']({'plain':!![]});var _0x58b672=_0x1cee('0x24');return db[_0x1cee('0x4f')][_0x1cee('0x48')]({'where':{'name':_0x58b672,'userProfileId':_0x5f107d['userProfileId']},'raw':!![]})[_0x1cee('0x22')](function(_0x397fa3){if(_0x397fa3&&_0x397fa3[_0x1cee('0x50')]===0x0){return db[_0x1cee('0x25')]['create']({'name':_0x83fd5c[_0x1cee('0x29')],'resourceId':_0x83fd5c['id'],'type':_0x397fa3[_0x1cee('0x29')],'sectionId':_0x397fa3['id']},{})[_0x1cee('0x22')](function(){return _0x550484;});}else{return _0x550484;}})[_0x1cee('0x44')](function(_0x44672c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44672c);throw _0x44672c;});}return _0x550484;})[_0x1cee('0x22')](respondWithResult(_0x92f75f,0xc9))[_0x1cee('0x44')](handleError(_0x92f75f,null));};exports['update']=function(_0x1dcc2f,_0x27aa9c){if(_0x1dcc2f[_0x1cee('0x4a')]['id']){delete _0x1dcc2f[_0x1cee('0x4a')]['id'];}return db[_0x1cee('0x2d')][_0x1cee('0x48')]({'where':{'id':_0x1dcc2f[_0x1cee('0x46')]['id']}})[_0x1cee('0x22')](handleEntityNotFound(_0x27aa9c,null))[_0x1cee('0x22')](saveUpdates(_0x1dcc2f['body'],null))[_0x1cee('0x22')](respondWithResult(_0x27aa9c,null))[_0x1cee('0x44')](handleError(_0x27aa9c,null));};exports[_0x1cee('0x23')]=function(_0xdabd52,_0x5983de){return db[_0x1cee('0x2d')][_0x1cee('0x48')]({'where':{'id':_0xdabd52[_0x1cee('0x46')]['id']}})[_0x1cee('0x22')](handleEntityNotFound(_0x5983de,null))[_0x1cee('0x22')](removeEntity(_0x5983de,null))[_0x1cee('0x44')](handleError(_0x5983de,null));};exports[_0x1cee('0x51')]=function(_0x341fbf,_0x94372f){return db[_0x1cee('0x2d')]['describe']()[_0x1cee('0x22')](respondWithResult(_0x94372f,null))['catch'](handleError(_0x94372f,null));};exports[_0x1cee('0x52')]=function(_0x19d2f4,_0x2b6b0b,_0x4f443c){var _0x25df90={'raw':!![],'where':{}},_0x2d33f7={},_0x1bda5c;return db[_0x1cee('0x2d')]['findOne']({'where':{'id':_0x19d2f4[_0x1cee('0x46')]['id']}})[_0x1cee('0x22')](handleEntityNotFound(_0x2b6b0b,null))['then'](function(_0x20cff3){if(_0x20cff3){_0x1bda5c=_0x20cff3[_0x1cee('0x4c')]({'plain':!![]});_0x2d33f7[_0x1cee('0x33')]=_[_0x1cee('0x47')](db[_0x1cee('0x53')][_0x1cee('0x2e')]);_0x2d33f7[_0x1cee('0x31')]=_[_0x1cee('0x47')](_0x19d2f4[_0x1cee('0x31')]);_0x2d33f7['filters']=_['intersection'](_0x2d33f7[_0x1cee('0x33')],_0x2d33f7['query']);_0x25df90[_0x1cee('0x35')]=_[_0x1cee('0x32')](_0x2d33f7[_0x1cee('0x33')],qs[_0x1cee('0x34')](_0x19d2f4['query'][_0x1cee('0x34')]));_0x25df90[_0x1cee('0x35')]=_0x25df90[_0x1cee('0x35')][_0x1cee('0x36')]?_0x25df90[_0x1cee('0x35')]:_0x2d33f7[_0x1cee('0x33')];if(!_0x19d2f4['query']['hasOwnProperty'](_0x1cee('0x37'))){_0x25df90['limit']=qs[_0x1cee('0x1d')](_0x19d2f4[_0x1cee('0x31')]['limit']);_0x25df90[_0x1cee('0x1b')]=qs[_0x1cee('0x1b')](_0x19d2f4[_0x1cee('0x31')][_0x1cee('0x1b')]);}_0x25df90[_0x1cee('0x38')]=qs['sort'](_0x19d2f4[_0x1cee('0x31')][_0x1cee('0x39')]);_0x25df90[_0x1cee('0x3d')]=qs[_0x1cee('0x3b')](_['pick'](_0x19d2f4['query'],_0x2d33f7['filters']));_0x25df90[_0x1cee('0x3d')][_0x1cee('0x54')]=_0x20cff3['id'];if(_0x19d2f4[_0x1cee('0x31')]['filter']){_0x25df90['where']=_[_0x1cee('0x3e')](_0x25df90[_0x1cee('0x3d')],{'$or':_[_0x1cee('0x2c')](_0x25df90[_0x1cee('0x35')],function(_0xee45e2){var _0x17f4a0={};_0x17f4a0[_0xee45e2]={'$like':'%'+_0x19d2f4[_0x1cee('0x31')][_0x1cee('0x3c')]+'%'};return _0x17f4a0;})});}_0x25df90=_[_0x1cee('0x3e')]({},_0x25df90,_0x19d2f4[_0x1cee('0x55')]);return db[_0x1cee('0x53')][_0x1cee('0x42')](_0x25df90);}})[_0x1cee('0x22')](function(_0x1d264d){if(_0x1d264d){return db[_0x1cee('0x56')][_0x1cee('0x57')]({'where':{'id':_[_0x1cee('0x2c')](_0x1d264d,_0x1cee('0x58')),'role':'agent'},'attributes':['id',_0x1cee('0x29'),_0x1cee('0x59'),_0x1cee('0x5a'),'createdAt']});}})[_0x1cee('0x22')](function(_0x47ac90){if(_0x47ac90){return{'count':_0x47ac90[_0x1cee('0x1e')],'rows':_['map'](_0x47ac90['rows'],function(_0x22e302){return{'membername':_0x22e302[_0x1cee('0x29')],'UserId':_0x22e302['id'],'queue_name':_0x1bda5c[_0x1cee('0x29')],'WhatsappQueueId':_0x1bda5c['id'],'interface':util[_0x1cee('0x5b')](_0x1cee('0x5c'),_0x1cee('0x5d'),_0x22e302[_0x1cee('0x29')]),'penalty':0x0,'paused':_0x22e302[_0x1cee('0x59')],'createdAt':_0x22e302[_0x1cee('0x5e')],'updatedAt':_0x22e302[_0x1cee('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1cee('0x22')](respondWithFilteredResult(_0x2b6b0b,_0x25df90))[_0x1cee('0x44')](handleError(_0x2b6b0b,null));};exports['getTeams']=function(_0x27e987,_0x10549b,_0x2fbf68){var _0x232a3b={};var _0x5c39eb={};var _0x15a94b;var _0x507e83;return db['WhatsappQueue'][_0x1cee('0x5f')]({'where':{'id':_0x27e987[_0x1cee('0x46')]['id']}})['then'](handleEntityNotFound(_0x10549b,null))[_0x1cee('0x22')](function(_0x59b632){if(_0x59b632){_0x15a94b=_0x59b632;_0x5c39eb['model']=_['keys'](db[_0x1cee('0x60')][_0x1cee('0x2e')]);_0x5c39eb[_0x1cee('0x31')]=_['keys'](_0x27e987[_0x1cee('0x31')]);_0x5c39eb[_0x1cee('0x3b')]=_[_0x1cee('0x32')](_0x5c39eb[_0x1cee('0x33')],_0x5c39eb[_0x1cee('0x31')]);_0x232a3b[_0x1cee('0x35')]=_['intersection'](_0x5c39eb[_0x1cee('0x33')],qs[_0x1cee('0x34')](_0x27e987[_0x1cee('0x31')][_0x1cee('0x34')]));_0x232a3b[_0x1cee('0x35')]=_0x232a3b[_0x1cee('0x35')]['length']?_0x232a3b[_0x1cee('0x35')]:_0x5c39eb[_0x1cee('0x33')];_0x232a3b[_0x1cee('0x38')]=qs['sort'](_0x27e987[_0x1cee('0x31')]['sort']);_0x232a3b[_0x1cee('0x3d')]=qs[_0x1cee('0x3b')](_['pick'](_0x27e987[_0x1cee('0x31')],_0x5c39eb[_0x1cee('0x3b')]));if(_0x27e987[_0x1cee('0x31')][_0x1cee('0x3c')]){_0x232a3b['where']=_[_0x1cee('0x3e')](_0x232a3b[_0x1cee('0x3d')],{'$or':_['map'](_0x232a3b[_0x1cee('0x35')],function(_0x40837d){var _0x5898d5={};_0x5898d5[_0x40837d]={'$like':'%'+_0x27e987[_0x1cee('0x31')][_0x1cee('0x3c')]+'%'};return _0x5898d5;})});}_0x232a3b=_[_0x1cee('0x3e')]({},_0x232a3b,_0x27e987[_0x1cee('0x55')]);return _0x15a94b[_0x1cee('0x61')](_0x232a3b);}})[_0x1cee('0x22')](function(_0x2bd54a){if(_0x2bd54a){_0x507e83=_0x2bd54a[_0x1cee('0x36')];if(!_0x27e987['query'][_0x1cee('0x62')](_0x1cee('0x37'))){_0x232a3b['limit']=qs['limit'](_0x27e987[_0x1cee('0x31')][_0x1cee('0x1d')]);_0x232a3b[_0x1cee('0x1b')]=qs[_0x1cee('0x1b')](_0x27e987['query'][_0x1cee('0x1b')]);}return _0x15a94b['getTeams'](_0x232a3b);}})[_0x1cee('0x22')](function(_0x387a33){if(_0x387a33){return _0x387a33?{'count':_0x507e83,'rows':_0x387a33}:null;}})['then'](respondWithResult(_0x10549b,null))[_0x1cee('0x44')](handleError(_0x10549b,null));};exports[_0x1cee('0x63')]=function(_0x4e2f29,_0x4f20e3,_0x2a1a99){var _0x8bdd2d=_0x4e2f29['body'][_0x1cee('0x64')];return db[_0x1cee('0x60')]['findAll']({'where':{'id':_0x8bdd2d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1cee('0x65'),'attributes':['id',_0x1cee('0x29'),'online',_0x1cee('0x66'),'interface'],'raw':!![]}]})['then'](function(_0x1a49f8){if(_0x1a49f8){var _0x5effed=_['flatMap'](_0x1a49f8,function(_0x3e36b8){var _0x104290=_0x3e36b8[_0x1cee('0x4c')]({'plain':!![]});return _0x104290['Agents'];});return db[_0x1cee('0x2d')]['find']({'where':{'id':_0x4e2f29[_0x1cee('0x46')]['id']}})[_0x1cee('0x22')](function(_0x1f49b8){return db[_0x1cee('0x67')][_0x1cee('0x68')](function(_0x2ddac9){return _0x1f49b8[_0x1cee('0x63')](_0x8bdd2d,{'transaction':_0x2ddac9})['then'](function(){return BPromise['each'](_0x5effed,function(_0x18c37c){return db[_0x1cee('0x53')][_0x1cee('0x69')]({'where':{'UserId':_0x18c37c['id'],'WhatsappQueueId':_0x4e2f29[_0x1cee('0x46')]['id']},'transaction':_0x2ddac9});});})[_0x1cee('0x22')](function(){_0x5effed[_0x1cee('0x6a')](function(_0x18ba97){socket[_0x1cee('0x6b')](_0x1cee('0x6c'),{'UserId':_0x18ba97['id'],'WhatsappQueueId':_0x1f49b8['id']});});});});});}})[_0x1cee('0x22')](respondWithStatusCode(_0x4f20e3,null))['catch'](handleError(_0x4f20e3,null));};exports[_0x1cee('0x6d')]=function(_0x44c31c,_0x1f0455,_0x48808a){return db[_0x1cee('0x60')]['findAll']({'where':{'id':_0x44c31c[_0x1cee('0x31')][_0x1cee('0x64')]},'attributes':['id'],'include':[{'model':db[_0x1cee('0x56')],'as':_0x1cee('0x65'),'attributes':['id'],'raw':!![]}]})[_0x1cee('0x22')](handleEntityNotFound(_0x1f0455,null))[_0x1cee('0x22')](function(_0xe954ad){var _0x5c347a=_['map'](_0xe954ad,'id');var _0xb93a25=[];var _0x220375=[];var _0x494f31=squel[_0x1cee('0x6e')]();_0x494f31[_0x1cee('0x6f')](_0x1cee('0x70'))[_0x1cee('0x71')]('team_has_whatsapp_queues','tq')[_0x1cee('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1cee('0x3d')](_0x1cee('0x73'),_0x44c31c['params']['id']);for(var _0x260202=0x0;_0x260202<_0xe954ad[_0x1cee('0x36')];_0x260202+=0x1){let _0x3cd4d2=_0xe954ad[_0x260202];for(var _0x5f54fd=0x0;_0x5f54fd<_0x3cd4d2[_0x1cee('0x65')]['length'];_0x5f54fd+=0x1){let _0x2618a5=_0x3cd4d2[_0x1cee('0x65')][_0x5f54fd];var _0x315075=_0x494f31[_0x1cee('0x74')]();_0x315075[_0x1cee('0x3d')](_0x1cee('0x75'),_0x2618a5['id']);_0x220375[_0x1cee('0x76')](db[_0x1cee('0x67')][_0x1cee('0x31')](_0x315075[_0x1cee('0x77')](),{'type':db['sequelize'][_0x1cee('0x78')][_0x1cee('0x79')]})[_0x1cee('0x22')](function(_0x49df2e){if(_0x49df2e[_0x1cee('0x36')]===0x1){return _0x2618a5['id'];}else{var _0x32659f=_['every'](_[_0x1cee('0x2c')](_0x49df2e,_0x1cee('0x7a')),function(_0x1655c3){return _['includes'](_0x5c347a,_0x1655c3);});if(_0x32659f){return _0x2618a5['id'];}}}));}}return BPromise[_0x1cee('0x7b')](_0x220375)[_0x1cee('0x22')](function(_0x4a5c48){_0xb93a25=_(_0xb93a25)['union'](_0x4a5c48)[_0x1cee('0x7c')]()[_0x1cee('0x7d')]();return db[_0x1cee('0x2d')][_0x1cee('0x48')]({'where':{'id':_0x44c31c['params']['id']}})[_0x1cee('0x22')](function(_0x5156d5){return db['sequelize'][_0x1cee('0x68')](function(_0x4cc110){return _0x5156d5['removeTeams'](_0x44c31c['query'][_0x1cee('0x64')],{'transaction':_0x4cc110})['then'](function(){if(!_[_0x1cee('0x7e')](_0xb93a25)){return _0x5156d5[_0x1cee('0x7f')](_0xb93a25,{'transaction':_0x4cc110});}})[_0x1cee('0x22')](function(){_0xb93a25[_0x1cee('0x6a')](function(_0x12facd){socket[_0x1cee('0x6b')](_0x1cee('0x80'),{'UserId':_0x12facd,'WhatsappQueueId':_0x5156d5['id']});});});});});});})[_0x1cee('0x22')](respondWithStatusCode(_0x1f0455,null))[_0x1cee('0x44')](handleError(_0x1f0455,null));};exports['addAgents']=function(_0x402ab9,_0x1faf2b,_0x238fbc){return db['WhatsappQueue']['find']({'where':{'id':_0x402ab9[_0x1cee('0x46')]['id']}})[_0x1cee('0x22')](handleEntityNotFound(_0x1faf2b,null))[_0x1cee('0x22')](function(_0x2c9918){if(_0x2c9918){return _0x2c9918['addAgents'](_0x402ab9[_0x1cee('0x4a')][_0x1cee('0x64')],_[_0x1cee('0x81')](_0x402ab9[_0x1cee('0x4a')],['ids','id'])||{})['spread'](function(_0xe663da){for(var _0x437f18=0x0;_0x437f18<_0x402ab9['body'][_0x1cee('0x64')][_0x1cee('0x36')];_0x437f18+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x402ab9[_0x1cee('0x4a')]['ids'][_0x437f18]),'WhatsappQueueId':Number(_0x402ab9[_0x1cee('0x46')]['id'])});}return _0xe663da;});}})['then'](respondWithResult(_0x1faf2b,null))['catch'](handleError(_0x1faf2b,null));};exports[_0x1cee('0x7f')]=function(_0x5405e2,_0x1809ba,_0x2c815a){return db[_0x1cee('0x2d')]['find']({'where':{'id':_0x5405e2['params']['id']}})[_0x1cee('0x22')](handleEntityNotFound(_0x1809ba,null))[_0x1cee('0x22')](function(_0x18464e){if(_0x18464e){return _0x18464e['removeAgents'](_0x5405e2[_0x1cee('0x31')]['ids'])['then'](function(){if(_[_0x1cee('0x82')](_0x5405e2[_0x1cee('0x31')][_0x1cee('0x64')])){for(var _0x4b82b3=0x0;_0x4b82b3<_0x5405e2[_0x1cee('0x31')][_0x1cee('0x64')][_0x1cee('0x36')];_0x4b82b3+=0x1){socket[_0x1cee('0x6b')](_0x1cee('0x80'),{'UserId':Number(_0x5405e2['query'][_0x1cee('0x64')][_0x4b82b3]),'WhatsappQueueId':Number(_0x5405e2['params']['id'])});}}else{socket['emit'](_0x1cee('0x80'),{'UserId':Number(_0x5405e2[_0x1cee('0x31')][_0x1cee('0x64')]),'WhatsappQueueId':Number(_0x5405e2[_0x1cee('0x46')]['id'])});}});}})[_0x1cee('0x22')](respondWithStatusCode(_0x1809ba,null))['catch'](handleError(_0x1809ba,null));};exports[_0x1cee('0x83')]=function(_0x4e13e6,_0x26343a,_0xa20f6d){var _0x5e7897={};var _0x67a5cf={};var _0x4d40c4;var _0x563ad6;return db[_0x1cee('0x2d')][_0x1cee('0x5f')]({'where':{'id':_0x4e13e6['params']['id']}})[_0x1cee('0x22')](handleEntityNotFound(_0x26343a,null))['then'](function(_0x442d6e){if(_0x442d6e){_0x4d40c4=_0x442d6e;_0x67a5cf['model']=_[_0x1cee('0x47')](db[_0x1cee('0x56')][_0x1cee('0x2e')]);_0x67a5cf[_0x1cee('0x31')]=_[_0x1cee('0x47')](_0x4e13e6[_0x1cee('0x31')]);_0x67a5cf[_0x1cee('0x3b')]=_[_0x1cee('0x32')](_0x67a5cf['model'],_0x67a5cf[_0x1cee('0x31')]);_0x5e7897[_0x1cee('0x35')]=_[_0x1cee('0x32')](_0x67a5cf['model'],qs[_0x1cee('0x34')](_0x4e13e6['query']['fields']));_0x5e7897[_0x1cee('0x35')]=_0x5e7897[_0x1cee('0x35')][_0x1cee('0x36')]?_0x5e7897[_0x1cee('0x35')]:_0x67a5cf[_0x1cee('0x33')];_0x5e7897[_0x1cee('0x38')]=qs[_0x1cee('0x39')](_0x4e13e6[_0x1cee('0x31')][_0x1cee('0x39')]);_0x5e7897['where']=qs['filters'](_[_0x1cee('0x3a')](_0x4e13e6[_0x1cee('0x31')],_0x67a5cf['filters']));if(_0x4e13e6['query']['filter']){_0x5e7897[_0x1cee('0x3d')]=_[_0x1cee('0x3e')](_0x5e7897[_0x1cee('0x3d')],{'$or':_['map'](_0x5e7897[_0x1cee('0x35')],function(_0x588ccc){var _0x34658d={};_0x34658d[_0x588ccc]={'$like':'%'+_0x4e13e6['query'][_0x1cee('0x3c')]+'%'};return _0x34658d;})});}_0x5e7897=_[_0x1cee('0x3e')]({},_0x5e7897,_0x4e13e6['options']);return _0x4d40c4['getAgents'](_0x5e7897);}})[_0x1cee('0x22')](function(_0x26aecc){if(_0x26aecc){_0x563ad6=_0x26aecc[_0x1cee('0x36')];if(!_0x4e13e6['query']['hasOwnProperty'](_0x1cee('0x37'))){_0x5e7897[_0x1cee('0x1d')]=qs['limit'](_0x4e13e6['query']['limit']);_0x5e7897['offset']=qs['offset'](_0x4e13e6[_0x1cee('0x31')][_0x1cee('0x1b')]);}return _0x4d40c4[_0x1cee('0x83')](_0x5e7897);}})[_0x1cee('0x22')](function(_0x3d63c7){if(_0x3d63c7){return _0x3d63c7?{'count':_0x563ad6,'rows':_0x3d63c7}:null;}})['then'](respondWithResult(_0x26343a,null))[_0x1cee('0x44')](handleError(_0x26343a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 58abd84..47e1eb5 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 _0x75b9=['remove','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x75b9,0x1b3));var _0x975b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x75b9[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x975b('0x0'));var WhatsappQueue=require(_0x975b('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x975b('0x2')](0x0);var events={'afterCreate':_0x975b('0x3'),'afterUpdate':_0x975b('0x4'),'afterDestroy':_0x975b('0x5')};function emitEvent(_0x2e7fe3){return function(_0x46d61d,_0x34c457,_0x2ac33f){WhatsappQueueEvents['emit'](_0x2e7fe3+':'+_0x46d61d['id'],_0x46d61d);WhatsappQueueEvents['emit'](_0x2e7fe3,_0x46d61d);_0x2ac33f(null);};}for(var e in events){if(events[_0x975b('0x6')](e)){var event=events[e];WhatsappQueue[_0x975b('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x3afd=['remove','emit','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x237bf7,_0xb851fc){var _0x5928ba=function(_0x14c0d0){while(--_0x14c0d0){_0x237bf7['push'](_0x237bf7['shift']());}};_0x5928ba(++_0xb851fc);}(_0x3afd,0x124));var _0xd3af=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x3afd[_0x8e9386];return _0x4abf26;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xd3af('0x0'))['db'][_0xd3af('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd3af('0x2')](0x0);var events={'afterCreate':_0xd3af('0x3'),'afterUpdate':_0xd3af('0x4'),'afterDestroy':_0xd3af('0x5')};function emitEvent(_0x5941bb){return function(_0x3c9f21,_0x366d30,_0xbea1d5){WhatsappQueueEvents['emit'](_0x5941bb+':'+_0x3c9f21['id'],_0x3c9f21);WhatsappQueueEvents[_0xd3af('0x6')](_0x5941bb,_0x3c9f21);_0xbea1d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd3af('0x7')](e,emitEvent(event));}}module[_0xd3af('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6790372..74e8540 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 _0x6133=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x201498,_0x2ee6b4){var _0x23f348=function(_0x3280f9){while(--_0x3280f9){_0x201498['push'](_0x201498['shift']());}};_0x23f348(++_0x2ee6b4);}(_0x6133,0x1e3));var _0x3613=function(_0x488d3e,_0x2b40d0){_0x488d3e=_0x488d3e-0x0;var _0x13d39d=_0x6133[_0x488d3e];return _0x13d39d;};'use strict';var _=require(_0x3613('0x0'));var util=require('util');var logger=require(_0x3613('0x1'))(_0x3613('0x2'));var moment=require(_0x3613('0x3'));var BPromise=require(_0x3613('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3613('0x5'));var rimraf=require('rimraf');var config=require(_0x3613('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x3613('0x7')]=function(_0x40e7b7,_0x2475b1){return _0x40e7b7[_0x3613('0x8')](_0x3613('0x9'),attributes,{'tableName':_0x3613('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc027=['request-promise','path','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','api','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc027,0xf7));var _0x7c02=function(_0x48093b,_0x6f8029){_0x48093b=_0x48093b-0x0;var _0x562fbf=_0xc027[_0x48093b];return _0x562fbf;};'use strict';var _=require('lodash');var util=require(_0x7c02('0x0'));var logger=require('../../config/logger')(_0x7c02('0x1'));var moment=require('moment');var BPromise=require(_0x7c02('0x2'));var rp=require(_0x7c02('0x3'));var fs=require('fs');var path=require(_0x7c02('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7c02('0x5'));module[_0x7c02('0x6')]=function(_0x49bdb4,_0x25e3b9){return _0x49bdb4[_0x7c02('0x7')](_0x7c02('0x8'),attributes,{'tableName':_0x7c02('0x9'),'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 5c30a68..44137e3 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 _0x2378=['attributes','limit','include','map','model','info','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','WhatsappQueue','options','raw','where'];(function(_0x146023,_0x507b23){var _0x346c4c=function(_0x1f1d7f){while(--_0x1f1d7f){_0x146023['push'](_0x146023['shift']());}};_0x346c4c(++_0x507b23);}(_0x2378,0xd1));var _0x8237=function(_0x4f9a7f,_0x30d20){_0x4f9a7f=_0x4f9a7f-0x0;var _0x169f92=_0x2378[_0x4f9a7f];return _0x169f92;};'use strict';var _=require(_0x8237('0x0'));var util=require(_0x8237('0x1'));var moment=require(_0x8237('0x2'));var BPromise=require(_0x8237('0x3'));var rs=require(_0x8237('0x4'));var fs=require('fs');var Redis=require(_0x8237('0x5'));var db=require(_0x8237('0x6'))['db'];var utils=require(_0x8237('0x7'));var logger=require('../../config/logger')(_0x8237('0x8'));var config=require(_0x8237('0x9'));var jayson=require(_0x8237('0xa'));var client=jayson[_0x8237('0xb')]['http']({'port':0x232a});config[_0x8237('0xc')]=_['defaults'](config[_0x8237('0xc')],{'host':_0x8237('0xd'),'port':0x18eb});var socket=require(_0x8237('0xe'))(new Redis(config[_0x8237('0xc')]));require(_0x8237('0xf'))[_0x8237('0x10')](socket);function respondWithRpcPromise(_0x5c9fc8,_0x1b65b3,_0xbb8bd9){return new BPromise(function(_0x3783bc,_0x2a8204){return client[_0x8237('0x11')](_0x5c9fc8,_0xbb8bd9)[_0x8237('0x12')](function(_0x2810b8){logger['info'](_0x8237('0x13'),_0x1b65b3,_0x8237('0x14'));logger[_0x8237('0x15')](_0x8237('0x16'),_0x1b65b3,_0x8237('0x14'),JSON[_0x8237('0x17')](_0x2810b8));if(_0x2810b8[_0x8237('0x18')]){if(_0x2810b8['error']['code']===0x1f4){logger[_0x8237('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x1b65b3,_0x2810b8[_0x8237('0x18')][_0x8237('0x19')]);return _0x2a8204(_0x2810b8[_0x8237('0x18')][_0x8237('0x19')]);}logger[_0x8237('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x1b65b3,_0x2810b8[_0x8237('0x18')][_0x8237('0x19')]);return _0x3783bc(_0x2810b8[_0x8237('0x18')][_0x8237('0x19')]);}else{logger['info'](_0x8237('0x13'),_0x1b65b3,_0x8237('0x14'));_0x3783bc(_0x2810b8['result'][_0x8237('0x19')]);}})[_0x8237('0x1a')](function(_0x40a032){logger[_0x8237('0x18')](_0x8237('0x13'),_0x1b65b3,_0x40a032);_0x2a8204(_0x40a032);});});}exports['GetWhatsappQueue']=function(_0x214fc4){var _0xf5546b=this;return new Promise(function(_0x1e76bf,_0x3363fb){return db[_0x8237('0x1b')]['findAll']({'raw':_0x214fc4[_0x8237('0x1c')]?_0x214fc4[_0x8237('0x1c')][_0x8237('0x1d')]===undefined?!![]:![]:!![],'where':_0x214fc4[_0x8237('0x1c')]?_0x214fc4[_0x8237('0x1c')][_0x8237('0x1e')]||null:null,'attributes':_0x214fc4[_0x8237('0x1c')]?_0x214fc4[_0x8237('0x1c')][_0x8237('0x1f')]||null:null,'limit':_0x214fc4[_0x8237('0x1c')]?_0x214fc4[_0x8237('0x1c')][_0x8237('0x20')]||null:null,'include':_0x214fc4[_0x8237('0x1c')]?_0x214fc4[_0x8237('0x1c')][_0x8237('0x21')]?_[_0x8237('0x22')](_0x214fc4[_0x8237('0x1c')][_0x8237('0x21')],function(_0x3106ed){return{'model':db[_0x3106ed[_0x8237('0x23')]],'as':_0x3106ed['as'],'attributes':_0x3106ed[_0x8237('0x1f')],'include':_0x3106ed[_0x8237('0x21')]?_[_0x8237('0x22')](_0x3106ed['include'],function(_0x24626b){return{'model':db[_0x24626b['model']],'as':_0x24626b['as'],'attributes':_0x24626b['attributes'],'include':_0x24626b[_0x8237('0x21')]?_['map'](_0x24626b[_0x8237('0x21')],function(_0xdee357){return{'model':db[_0xdee357[_0x8237('0x23')]],'as':_0xdee357['as'],'attributes':_0xdee357[_0x8237('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8237('0x12')](function(_0x49bcb3){logger[_0x8237('0x24')](_0x8237('0x25'),_0x214fc4);logger[_0x8237('0x15')](_0x8237('0x25'),_0x214fc4,JSON[_0x8237('0x17')](_0x49bcb3));_0x1e76bf(_0x49bcb3);})[_0x8237('0x1a')](function(_0x3d4f9c){logger[_0x8237('0x18')]('GetWhatsappQueue',_0x3d4f9c[_0x8237('0x19')],_0x214fc4);_0x3363fb(_0xf5546b[_0x8237('0x18')](0x1f4,_0x3d4f9c[_0x8237('0x19')]));});});};exports[_0x8237('0x26')]=function(_0x4a8630){var _0x9ce2e1=this;return new Promise(function(_0x34a74a,_0x452ab7){return db[_0x8237('0x1b')][_0x8237('0x27')]({'raw':_0x4a8630[_0x8237('0x1c')]?_0x4a8630[_0x8237('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4a8630[_0x8237('0x1c')]?_0x4a8630[_0x8237('0x1c')][_0x8237('0x1e')]||null:null,'attributes':_0x4a8630[_0x8237('0x1c')]?_0x4a8630[_0x8237('0x1c')][_0x8237('0x1f')]||null:null,'include':_0x4a8630[_0x8237('0x1c')]?_0x4a8630[_0x8237('0x1c')][_0x8237('0x21')]?_[_0x8237('0x22')](_0x4a8630[_0x8237('0x1c')][_0x8237('0x21')],function(_0x3a23f2){return{'model':db[_0x3a23f2[_0x8237('0x23')]],'as':_0x3a23f2['as'],'attributes':_0x3a23f2[_0x8237('0x1f')],'include':_0x3a23f2[_0x8237('0x21')]?_['map'](_0x3a23f2[_0x8237('0x21')],function(_0x4634c7){return{'model':db[_0x4634c7[_0x8237('0x23')]],'as':_0x4634c7['as'],'attributes':_0x4634c7[_0x8237('0x1f')],'include':_0x4634c7[_0x8237('0x21')]?_[_0x8237('0x22')](_0x4634c7[_0x8237('0x21')],function(_0x4263a0){return{'model':db[_0x4263a0[_0x8237('0x23')]],'as':_0x4263a0['as'],'attributes':_0x4263a0[_0x8237('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8237('0x12')](function(_0x4d5bc9){logger[_0x8237('0x24')](_0x8237('0x26'),_0x4a8630);logger[_0x8237('0x15')](_0x8237('0x26'),_0x4a8630,JSON['stringify'](_0x4d5bc9));_0x34a74a(_0x4d5bc9);})[_0x8237('0x1a')](function(_0x1fb8d8){logger[_0x8237('0x18')]('ShowWhatsappQueue',_0x1fb8d8[_0x8237('0x19')],_0x4a8630);_0x452ab7(_0x9ce2e1[_0x8237('0x18')](0x1f4,_0x1fb8d8[_0x8237('0x19')]));});});}; \ No newline at end of file +var _0xd515=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetWhatsappQueue','options','raw','where','attributes','map','include','then','ShowWhatsappQueue','WhatsappQueue','find','model','lodash','moment','randomstring'];(function(_0x4dbc5d,_0x3fab33){var _0x48893d=function(_0x2fe406){while(--_0x2fe406){_0x4dbc5d['push'](_0x4dbc5d['shift']());}};_0x48893d(++_0x3fab33);}(_0xd515,0x19f));var _0x5d51=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd515[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5d51('0x0'));var util=require('util');var moment=require(_0x5d51('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d51('0x2'));var fs=require('fs');var Redis=require(_0x5d51('0x3'));var db=require(_0x5d51('0x4'))['db'];var utils=require(_0x5d51('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d51('0x6'));var jayson=require(_0x5d51('0x7'));var client=jayson[_0x5d51('0x8')][_0x5d51('0x9')]({'port':0x232a});config[_0x5d51('0xa')]=_[_0x5d51('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5d51('0xc'))(new Redis(config[_0x5d51('0xa')]));require(_0x5d51('0xd'))[_0x5d51('0xe')](socket);function respondWithRpcPromise(_0x33b5c7,_0x155bd5,_0x34f26c){return new BPromise(function(_0xa3dc5d,_0x5d589f){return client[_0x5d51('0xf')](_0x33b5c7,_0x34f26c)['then'](function(_0x303b14){logger['info'](_0x5d51('0x10'),_0x155bd5,_0x5d51('0x11'));logger[_0x5d51('0x12')](_0x5d51('0x13'),_0x155bd5,'request\x20sent',JSON[_0x5d51('0x14')](_0x303b14));if(_0x303b14[_0x5d51('0x15')]){if(_0x303b14[_0x5d51('0x15')]['code']===0x1f4){logger[_0x5d51('0x15')](_0x5d51('0x10'),_0x155bd5,_0x303b14[_0x5d51('0x15')][_0x5d51('0x16')]);return _0x5d589f(_0x303b14[_0x5d51('0x15')][_0x5d51('0x16')]);}logger[_0x5d51('0x15')](_0x5d51('0x10'),_0x155bd5,_0x303b14[_0x5d51('0x15')][_0x5d51('0x16')]);return _0xa3dc5d(_0x303b14[_0x5d51('0x15')][_0x5d51('0x16')]);}else{logger[_0x5d51('0x17')](_0x5d51('0x10'),_0x155bd5,'request\x20sent');_0xa3dc5d(_0x303b14[_0x5d51('0x18')]['message']);}})[_0x5d51('0x19')](function(_0x3d2301){logger['error'](_0x5d51('0x10'),_0x155bd5,_0x3d2301);_0x5d589f(_0x3d2301);});});}exports[_0x5d51('0x1a')]=function(_0x932ea6){var _0x5e94f8=this;return new Promise(function(_0x33186c,_0x241693){return db['WhatsappQueue']['findAll']({'raw':_0x932ea6[_0x5d51('0x1b')]?_0x932ea6[_0x5d51('0x1b')][_0x5d51('0x1c')]===undefined?!![]:![]:!![],'where':_0x932ea6[_0x5d51('0x1b')]?_0x932ea6[_0x5d51('0x1b')][_0x5d51('0x1d')]||null:null,'attributes':_0x932ea6[_0x5d51('0x1b')]?_0x932ea6['options'][_0x5d51('0x1e')]||null:null,'limit':_0x932ea6[_0x5d51('0x1b')]?_0x932ea6[_0x5d51('0x1b')]['limit']||null:null,'include':_0x932ea6['options']?_0x932ea6[_0x5d51('0x1b')]['include']?_[_0x5d51('0x1f')](_0x932ea6[_0x5d51('0x1b')][_0x5d51('0x20')],function(_0x3c9cb1){return{'model':db[_0x3c9cb1['model']],'as':_0x3c9cb1['as'],'attributes':_0x3c9cb1[_0x5d51('0x1e')],'include':_0x3c9cb1['include']?_['map'](_0x3c9cb1[_0x5d51('0x20')],function(_0x142d05){return{'model':db[_0x142d05['model']],'as':_0x142d05['as'],'attributes':_0x142d05[_0x5d51('0x1e')],'include':_0x142d05[_0x5d51('0x20')]?_[_0x5d51('0x1f')](_0x142d05['include'],function(_0x3139c9){return{'model':db[_0x3139c9['model']],'as':_0x3139c9['as'],'attributes':_0x3139c9[_0x5d51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5d51('0x21')](function(_0x18e901){logger[_0x5d51('0x17')](_0x5d51('0x1a'),_0x932ea6);logger[_0x5d51('0x12')](_0x5d51('0x1a'),_0x932ea6,JSON['stringify'](_0x18e901));_0x33186c(_0x18e901);})['catch'](function(_0x22261f){logger[_0x5d51('0x15')](_0x5d51('0x1a'),_0x22261f['message'],_0x932ea6);_0x241693(_0x5e94f8[_0x5d51('0x15')](0x1f4,_0x22261f[_0x5d51('0x16')]));});});};exports[_0x5d51('0x22')]=function(_0x474aa2){var _0x2425da=this;return new Promise(function(_0x52e7f6,_0x29497c){return db[_0x5d51('0x23')][_0x5d51('0x24')]({'raw':_0x474aa2[_0x5d51('0x1b')]?_0x474aa2[_0x5d51('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x474aa2[_0x5d51('0x1b')]?_0x474aa2[_0x5d51('0x1b')][_0x5d51('0x1d')]||null:null,'attributes':_0x474aa2[_0x5d51('0x1b')]?_0x474aa2[_0x5d51('0x1b')][_0x5d51('0x1e')]||null:null,'include':_0x474aa2[_0x5d51('0x1b')]?_0x474aa2[_0x5d51('0x1b')][_0x5d51('0x20')]?_[_0x5d51('0x1f')](_0x474aa2[_0x5d51('0x1b')][_0x5d51('0x20')],function(_0x144eaf){return{'model':db[_0x144eaf[_0x5d51('0x25')]],'as':_0x144eaf['as'],'attributes':_0x144eaf[_0x5d51('0x1e')],'include':_0x144eaf['include']?_['map'](_0x144eaf['include'],function(_0x1fc021){return{'model':db[_0x1fc021[_0x5d51('0x25')]],'as':_0x1fc021['as'],'attributes':_0x1fc021[_0x5d51('0x1e')],'include':_0x1fc021[_0x5d51('0x20')]?_[_0x5d51('0x1f')](_0x1fc021[_0x5d51('0x20')],function(_0x47a350){return{'model':db[_0x47a350[_0x5d51('0x25')]],'as':_0x47a350['as'],'attributes':_0x47a350['attributes']};}):[]};}):[]};}):[]:[]})[_0x5d51('0x21')](function(_0x1738cc){logger[_0x5d51('0x17')]('ShowWhatsappQueue',_0x474aa2);logger[_0x5d51('0x12')](_0x5d51('0x22'),_0x474aa2,JSON['stringify'](_0x1738cc));_0x52e7f6(_0x1738cc);})[_0x5d51('0x19')](function(_0xb3a563){logger[_0x5d51('0x15')](_0x5d51('0x22'),_0xb3a563[_0x5d51('0x16')],_0x474aa2);_0x29497c(_0x2425da[_0x5d51('0x15')](0x1f4,_0xb3a563[_0x5d51('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 7dec6bc..e9dfd65 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 _0x3d21=['update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x4039a3,_0x197e17){var _0x109295=function(_0x316a52){while(--_0x316a52){_0x4039a3['push'](_0x4039a3['shift']());}};_0x109295(++_0x197e17);}(_0x3d21,0x11d));var _0x13d2=function(_0x468d4c,_0x52679b){_0x468d4c=_0x468d4c-0x0;var _0x14a789=_0x3d21[_0x468d4c];return _0x14a789;};'use strict';var WhatsappQueueEvents=require(_0x13d2('0x0'));var events=[_0x13d2('0x1'),_0x13d2('0x2'),_0x13d2('0x3')];function createListener(_0x4f118d,_0x5c2d82){return function(_0x3e7a87){_0x5c2d82[_0x13d2('0x4')](_0x4f118d,_0x3e7a87);};}function removeListener(_0x23ecab,_0x4acd09){return function(){WhatsappQueueEvents[_0x13d2('0x5')](_0x23ecab,_0x4acd09);};}exports[_0x13d2('0x6')]=function(_0x2ac09c){for(var _0x22c6ad=0x0,_0x22bc6a=events[_0x13d2('0x7')];_0x22c6ad<_0x22bc6a;_0x22c6ad++){var _0x409fa2=events[_0x22c6ad];var _0x206e42=createListener(_0x13d2('0x8')+_0x409fa2,_0x2ac09c);WhatsappQueueEvents['on'](_0x409fa2,_0x206e42);}}; \ No newline at end of file +var _0xa6e5=['./whatsappQueue.events','remove','update','removeListener','register','length'];(function(_0x599ec1,_0x52c00d){var _0x55cbfa=function(_0x2b51d9){while(--_0x2b51d9){_0x599ec1['push'](_0x599ec1['shift']());}};_0x55cbfa(++_0x52c00d);}(_0xa6e5,0x120));var _0x5a6e=function(_0x12b2aa,_0x4f8322){_0x12b2aa=_0x12b2aa-0x0;var _0x43b70f=_0xa6e5[_0x12b2aa];return _0x43b70f;};'use strict';var WhatsappQueueEvents=require(_0x5a6e('0x0'));var events=['save',_0x5a6e('0x1'),_0x5a6e('0x2')];function createListener(_0x33230c,_0x4506bb){return function(_0x449f71){_0x4506bb['emit'](_0x33230c,_0x449f71);};}function removeListener(_0x4d79d8,_0x32d444){return function(){WhatsappQueueEvents[_0x5a6e('0x3')](_0x4d79d8,_0x32d444);};}exports[_0x5a6e('0x4')]=function(_0x10e8a0){for(var _0x52bb42=0x0,_0x2a788d=events[_0x5a6e('0x5')];_0x52bb42<_0x2a788d;_0x52bb42++){var _0xc3da51=events[_0x52bb42];var _0xa1e2d8=createListener('whatsappQueue:'+_0xc3da51,_0x10e8a0);WhatsappQueueEvents['on'](_0xc3da51,_0xa1e2d8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 53e3f5b..ff43b8a 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 _0x9f04=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x262cc5,_0x3b26a7){var _0x1f0eae=function(_0x5c9cef){while(--_0x5c9cef){_0x262cc5['push'](_0x262cc5['shift']());}};_0x1f0eae(++_0x3b26a7);}(_0x9f04,0x178));var _0x49f0=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x9f04[_0x174ef5];return _0x1cc379;};'use strict';var multer=require('multer');var util=require(_0x49f0('0x0'));var path=require(_0x49f0('0x1'));var timeout=require(_0x49f0('0x2'));var express=require(_0x49f0('0x3'));var router=express[_0x49f0('0x4')]();var fs_extra=require(_0x49f0('0x5'));var auth=require(_0x49f0('0x6'));var interaction=require(_0x49f0('0x7'));var config=require(_0x49f0('0x8'));var controller=require(_0x49f0('0x9'));router[_0x49f0('0xa')]('/',auth['isAuthenticated'](),controller[_0x49f0('0xb')]);router[_0x49f0('0xa')](_0x49f0('0xc'),auth[_0x49f0('0xd')](),controller['describe']);router[_0x49f0('0xa')]('/:id',auth[_0x49f0('0xd')](),controller[_0x49f0('0xe')]);router[_0x49f0('0xf')]('/',auth[_0x49f0('0xd')](),controller[_0x49f0('0x10')]);router[_0x49f0('0x11')](_0x49f0('0x12'),auth[_0x49f0('0xd')](),controller[_0x49f0('0x13')]);router['delete']('/:id',auth[_0x49f0('0xd')](),controller[_0x49f0('0x14')]);module[_0x49f0('0x15')]=router; \ No newline at end of file +var _0x7abb=['./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x7abb,0x1f0));var _0xb7ab=function(_0x4ec527,_0x4cc420){_0x4ec527=_0x4ec527-0x0;var _0x38101a=_0x7abb[_0x4ec527];return _0x38101a;};'use strict';var multer=require('multer');var util=require(_0xb7ab('0x0'));var path=require(_0xb7ab('0x1'));var timeout=require(_0xb7ab('0x2'));var express=require(_0xb7ab('0x3'));var router=express['Router']();var fs_extra=require(_0xb7ab('0x4'));var auth=require(_0xb7ab('0x5'));var interaction=require(_0xb7ab('0x6'));var config=require(_0xb7ab('0x7'));var controller=require(_0xb7ab('0x8'));router[_0xb7ab('0x9')]('/',auth[_0xb7ab('0xa')](),controller[_0xb7ab('0xb')]);router[_0xb7ab('0x9')](_0xb7ab('0xc'),auth['isAuthenticated'](),controller[_0xb7ab('0xd')]);router['get']('/:id',auth[_0xb7ab('0xa')](),controller[_0xb7ab('0xe')]);router[_0xb7ab('0xf')]('/',auth['isAuthenticated'](),controller[_0xb7ab('0x10')]);router['put'](_0xb7ab('0x11'),auth[_0xb7ab('0xa')](),controller[_0xb7ab('0x12')]);router['delete'](_0xb7ab('0x11'),auth[_0xb7ab('0xa')](),controller[_0xb7ab('0x13')]);module[_0xb7ab('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5efca12..ee10e89 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(_0x21a6bb,_0x1f1969){var _0x1a400c=function(_0xb2af77){while(--_0xb2af77){_0x21a6bb['push'](_0x21a6bb['shift']());}};_0x1a400c(++_0x1f1969);}(_0x7a54,0x106));var _0x47a5=function(_0x3c3bd1,_0x452ed8){_0x3c3bd1=_0x3c3bd1-0x0;var _0x5867df=_0x7a54[_0x3c3bd1];return _0x5867df;};'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(_0x225ed0,_0x4588f0){var _0x251288=function(_0x43d869){while(--_0x43d869){_0x225ed0['push'](_0x225ed0['shift']());}};_0x251288(++_0x4588f0);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 16244a9..043e4ae 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 _0xb574=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x26068a,_0x11058c){var _0x4c2517=function(_0xde27af){while(--_0xde27af){_0x26068a['push'](_0x26068a['shift']());}};_0x4c2517(++_0x11058c);}(_0xb574,0x106));var _0x4b57=function(_0x13ed8d,_0x1330eb){_0x13ed8d=_0x13ed8d-0x0;var _0x39288f=_0xb574[_0x13ed8d];return _0x39288f;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x540eff,_0x156962){return function(_0x51d0c3){if(!_0x51d0c3){_0x540eff[_0x4b57('0x16')](0x194);}return _0x51d0c3;};}function handleError(_0x517119,_0x36ceb1){_0x36ceb1=_0x36ceb1||0x1f4;return function(_0x2dc9d8){logger[_0x4b57('0x25')](_0x2dc9d8[_0x4b57('0x26')]);if(_0x2dc9d8[_0x4b57('0x27')]){delete _0x2dc9d8[_0x4b57('0x27')];}_0x517119['status'](_0x36ceb1)['send'](_0x2dc9d8);};}exports[_0x4b57('0x28')]=function(_0x4c58e4,_0x1ea0cb){var _0x458f70={},_0x874cf7={},_0x3af22f={'count':0x0,'rows':[]};var _0x249461=_[_0x4b57('0x29')](db['WhatsappQueueReport'][_0x4b57('0x2a')],function(_0x2e9922){return{'name':_0x2e9922[_0x4b57('0x2b')],'type':_0x2e9922[_0x4b57('0x2c')]['key']};});_0x874cf7[_0x4b57('0x2d')]=_[_0x4b57('0x29')](_0x249461,'name');_0x874cf7[_0x4b57('0x2e')]=_[_0x4b57('0x2f')](_0x4c58e4[_0x4b57('0x2e')]);_0x874cf7[_0x4b57('0x30')]=_['intersection'](_0x874cf7['model'],_0x874cf7['query']);_0x458f70[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x874cf7[_0x4b57('0x2d')],qs[_0x4b57('0x33')](_0x4c58e4[_0x4b57('0x2e')]['fields']));_0x458f70[_0x4b57('0x31')]=_0x458f70[_0x4b57('0x31')][_0x4b57('0x34')]?_0x458f70['attributes']:_0x874cf7[_0x4b57('0x2d')];if(!_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x35')]('nolimit')){_0x458f70[_0x4b57('0x1b')]=qs[_0x4b57('0x1b')](_0x4c58e4['query'][_0x4b57('0x1b')]);_0x458f70[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x1d')]);}_0x458f70[_0x4b57('0x36')]=qs['sort'](_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x37')]);_0x458f70[_0x4b57('0x38')]=qs[_0x4b57('0x30')](_[_0x4b57('0x39')](_0x4c58e4[_0x4b57('0x2e')],_0x874cf7[_0x4b57('0x30')]),_0x249461);if(_0x4c58e4['query']['filter']){_0x458f70[_0x4b57('0x38')]=_[_0x4b57('0x3a')](_0x458f70[_0x4b57('0x38')],{'$or':_['map'](_0x249461,function(_0x40414f){if(_0x40414f[_0x4b57('0x2c')]!==_0x4b57('0x3b')){var _0x3c086e={};_0x3c086e[_0x40414f['name']]={'$like':'%'+_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x3c')]+'%'};return _0x3c086e;}})});}_0x458f70=_[_0x4b57('0x3a')]({},_0x458f70,_0x4c58e4[_0x4b57('0x3d')]);var _0x56528f={'where':_0x458f70['where']};return db['WhatsappQueueReport'][_0x4b57('0x1c')](_0x56528f)[_0x4b57('0x23')](function(_0x188f24){_0x3af22f[_0x4b57('0x1c')]=_0x188f24;if(_0x4c58e4['query'][_0x4b57('0x3e')]){_0x458f70[_0x4b57('0x3f')]=[{'all':!![]}];}return db[_0x4b57('0x40')][_0x4b57('0x41')](_0x458f70);})[_0x4b57('0x23')](function(_0x453129){_0x3af22f[_0x4b57('0x42')]=_0x453129;return _0x3af22f;})[_0x4b57('0x23')](respondWithFilteredResult(_0x1ea0cb,_0x458f70))[_0x4b57('0x43')](handleError(_0x1ea0cb,null));};exports['show']=function(_0x318187,_0x3685fd){var _0x3c5095={'raw':!![],'where':{'id':_0x318187[_0x4b57('0x44')]['id']}},_0x5b2f50={};_0x5b2f50['model']=_[_0x4b57('0x2f')](db[_0x4b57('0x40')][_0x4b57('0x2a')]);_0x5b2f50[_0x4b57('0x2e')]=_[_0x4b57('0x2f')](_0x318187[_0x4b57('0x2e')]);_0x5b2f50[_0x4b57('0x30')]=_[_0x4b57('0x32')](_0x5b2f50[_0x4b57('0x2d')],_0x5b2f50[_0x4b57('0x2e')]);_0x3c5095[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x5b2f50[_0x4b57('0x2d')],qs['fields'](_0x318187['query'][_0x4b57('0x33')]));_0x3c5095[_0x4b57('0x31')]=_0x3c5095[_0x4b57('0x31')][_0x4b57('0x34')]?_0x3c5095['attributes']:_0x5b2f50[_0x4b57('0x2d')];if(_0x318187[_0x4b57('0x2e')]['includeAll']){_0x3c5095[_0x4b57('0x3f')]=[{'all':!![]}];}_0x3c5095=_['merge']({},_0x3c5095,_0x318187[_0x4b57('0x3d')]);return db['WhatsappQueueReport']['find'](_0x3c5095)[_0x4b57('0x23')](handleEntityNotFound(_0x3685fd,null))[_0x4b57('0x23')](respondWithResult(_0x3685fd,null))['catch'](handleError(_0x3685fd,null));};exports[_0x4b57('0x45')]=function(_0xc19684,_0x2732ff){return db[_0x4b57('0x40')][_0x4b57('0x45')](_0xc19684[_0x4b57('0x46')],{})['then'](respondWithResult(_0x2732ff,0xc9))[_0x4b57('0x43')](handleError(_0x2732ff,null));};exports[_0x4b57('0x22')]=function(_0x4a632c,_0xd529fb){if(_0x4a632c[_0x4b57('0x46')]['id']){delete _0x4a632c[_0x4b57('0x46')]['id'];}return db['WhatsappQueueReport'][_0x4b57('0x47')]({'where':{'id':_0x4a632c['params']['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0xd529fb,null))[_0x4b57('0x23')](saveUpdates(_0x4a632c[_0x4b57('0x46')],null))[_0x4b57('0x23')](respondWithResult(_0xd529fb,null))[_0x4b57('0x43')](handleError(_0xd529fb,null));};exports[_0x4b57('0x24')]=function(_0x3d1ecd,_0x3ec6ba){return db['WhatsappQueueReport'][_0x4b57('0x47')]({'where':{'id':_0x3d1ecd[_0x4b57('0x44')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x3ec6ba,null))['then'](removeEntity(_0x3ec6ba,null))[_0x4b57('0x43')](handleError(_0x3ec6ba,null));};exports[_0x4b57('0x48')]=function(_0x32985f,_0x488bea){return db[_0x4b57('0x40')][_0x4b57('0x48')]()[_0x4b57('0x23')](respondWithResult(_0x488bea,null))[_0x4b57('0x43')](handleError(_0x488bea,null));}; \ No newline at end of file +var _0x2547=['order','where','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2547,0x1cd));var _0x7254=function(_0x2a0a2c,_0x1f8ee5){_0x2a0a2c=_0x2a0a2c-0x0;var _0x4ba7c5=_0x2547[_0x2a0a2c];return _0x4ba7c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x50c34b[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x36b5d5,_0x133aee){return function(_0x5d6df5){if(!_0x5d6df5){_0x36b5d5[_0x7254('0x17')](0x194);}return _0x5d6df5;};}function handleError(_0x21a579,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x494cdb){logger[_0x7254('0x27')](_0x494cdb['stack']);if(_0x494cdb[_0x7254('0x28')]){delete _0x494cdb[_0x7254('0x28')];}_0x21a579['status'](_0x2b4f46)[_0x7254('0x29')](_0x494cdb);};}exports[_0x7254('0x2a')]=function(_0x4f684c,_0x14cbea){var _0x6c4927={},_0x37cb5c={},_0xb9198b={'count':0x0,'rows':[]};var _0x43bf02=_[_0x7254('0x2b')](db['WhatsappQueueReport'][_0x7254('0x2c')],function(_0x2dba3f){return{'name':_0x2dba3f['fieldName'],'type':_0x2dba3f[_0x7254('0x2d')][_0x7254('0x2e')]};});_0x37cb5c[_0x7254('0x2f')]=_['map'](_0x43bf02,_0x7254('0x28'));_0x37cb5c[_0x7254('0x30')]=_[_0x7254('0x31')](_0x4f684c[_0x7254('0x30')]);_0x37cb5c[_0x7254('0x32')]=_[_0x7254('0x33')](_0x37cb5c[_0x7254('0x2f')],_0x37cb5c['query']);_0x6c4927[_0x7254('0x34')]=_['intersection'](_0x37cb5c['model'],qs[_0x7254('0x35')](_0x4f684c[_0x7254('0x30')][_0x7254('0x35')]));_0x6c4927[_0x7254('0x34')]=_0x6c4927[_0x7254('0x34')][_0x7254('0x36')]?_0x6c4927[_0x7254('0x34')]:_0x37cb5c[_0x7254('0x2f')];if(!_0x4f684c[_0x7254('0x30')][_0x7254('0x37')](_0x7254('0x38'))){_0x6c4927[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x4f684c[_0x7254('0x30')]['limit']);_0x6c4927[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x4f684c[_0x7254('0x30')][_0x7254('0x1b')]);}_0x6c4927[_0x7254('0x39')]=qs['sort'](_0x4f684c[_0x7254('0x30')]['sort']);_0x6c4927[_0x7254('0x3a')]=qs[_0x7254('0x32')](_[_0x7254('0x3b')](_0x4f684c[_0x7254('0x30')],_0x37cb5c[_0x7254('0x32')]),_0x43bf02);if(_0x4f684c['query'][_0x7254('0x3c')]){_0x6c4927['where']=_[_0x7254('0x3d')](_0x6c4927[_0x7254('0x3a')],{'$or':_['map'](_0x43bf02,function(_0x1485a0){if(_0x1485a0[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x9273ee={};_0x9273ee[_0x1485a0[_0x7254('0x28')]]={'$like':'%'+_0x4f684c[_0x7254('0x30')]['filter']+'%'};return _0x9273ee;}})});}_0x6c4927=_[_0x7254('0x3d')]({},_0x6c4927,_0x4f684c[_0x7254('0x3f')]);var _0x105b8c={'where':_0x6c4927['where']};return db[_0x7254('0x40')][_0x7254('0x1e')](_0x105b8c)[_0x7254('0x25')](function(_0x4824d5){_0xb9198b[_0x7254('0x1e')]=_0x4824d5;if(_0x4f684c[_0x7254('0x30')][_0x7254('0x41')]){_0x6c4927[_0x7254('0x42')]=[{'all':!![]}];}return db[_0x7254('0x40')]['findAll'](_0x6c4927);})['then'](function(_0x25004f){_0xb9198b[_0x7254('0x43')]=_0x25004f;return _0xb9198b;})[_0x7254('0x25')](respondWithFilteredResult(_0x14cbea,_0x6c4927))[_0x7254('0x44')](handleError(_0x14cbea,null));};exports['show']=function(_0x53a7a7,_0x29821a){var _0x565cd8={'raw':!![],'where':{'id':_0x53a7a7[_0x7254('0x45')]['id']}},_0x2ae22e={};_0x2ae22e[_0x7254('0x2f')]=_[_0x7254('0x31')](db['WhatsappQueueReport']['rawAttributes']);_0x2ae22e[_0x7254('0x30')]=_[_0x7254('0x31')](_0x53a7a7[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x32')]=_[_0x7254('0x33')](_0x2ae22e['model'],_0x2ae22e['query']);_0x565cd8[_0x7254('0x34')]=_[_0x7254('0x33')](_0x2ae22e[_0x7254('0x2f')],qs['fields'](_0x53a7a7[_0x7254('0x30')][_0x7254('0x35')]));_0x565cd8['attributes']=_0x565cd8[_0x7254('0x34')][_0x7254('0x36')]?_0x565cd8[_0x7254('0x34')]:_0x2ae22e[_0x7254('0x2f')];if(_0x53a7a7['query'][_0x7254('0x41')]){_0x565cd8[_0x7254('0x42')]=[{'all':!![]}];}_0x565cd8=_['merge']({},_0x565cd8,_0x53a7a7[_0x7254('0x3f')]);return db[_0x7254('0x40')][_0x7254('0x46')](_0x565cd8)['then'](handleEntityNotFound(_0x29821a,null))[_0x7254('0x25')](respondWithResult(_0x29821a,null))[_0x7254('0x44')](handleError(_0x29821a,null));};exports['create']=function(_0x5f101e,_0x10b32f){return db['WhatsappQueueReport'][_0x7254('0x47')](_0x5f101e[_0x7254('0x48')],{})['then'](respondWithResult(_0x10b32f,0xc9))['catch'](handleError(_0x10b32f,null));};exports[_0x7254('0x24')]=function(_0xc40bc5,_0x38bcd5){if(_0xc40bc5[_0x7254('0x48')]['id']){delete _0xc40bc5[_0x7254('0x48')]['id'];}return db[_0x7254('0x40')]['find']({'where':{'id':_0xc40bc5[_0x7254('0x45')]['id']}})['then'](handleEntityNotFound(_0x38bcd5,null))[_0x7254('0x25')](saveUpdates(_0xc40bc5[_0x7254('0x48')],null))[_0x7254('0x25')](respondWithResult(_0x38bcd5,null))['catch'](handleError(_0x38bcd5,null));};exports[_0x7254('0x26')]=function(_0x1c1a0e,_0x252758){return db['WhatsappQueueReport'][_0x7254('0x46')]({'where':{'id':_0x1c1a0e[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x252758,null))[_0x7254('0x25')](removeEntity(_0x252758,null))[_0x7254('0x44')](handleError(_0x252758,null));};exports['describe']=function(_0x5e66c6,_0x24c532){return db[_0x7254('0x40')][_0x7254('0x49')]()[_0x7254('0x25')](respondWithResult(_0x24c532,null))[_0x7254('0x44')](handleError(_0x24c532,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index fdcf01b..4ff3cf1 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 _0x2b2f=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0x2b2f,0xb7));var _0xf2b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2b2f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf2b2('0x0'));var util=require(_0xf2b2('0x1'));var logger=require(_0xf2b2('0x2'))(_0xf2b2('0x3'));var moment=require('moment');var BPromise=require(_0xf2b2('0x4'));var rp=require(_0xf2b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2b2('0x6'));var config=require(_0xf2b2('0x7'));var attributes=require(_0xf2b2('0x8'));module[_0xf2b2('0x9')]=function(_0x5a5122,_0x19715e){return _0x5a5122[_0xf2b2('0xa')](_0xf2b2('0xb'),attributes,{'tableName':_0xf2b2('0xc'),'paranoid':![],'indexes':[{'name':_0xf2b2('0xd'),'fields':[_0xf2b2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a2b=['moment','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3a2b,0x1d8));var _0xb3a2=function(_0x3975af,_0x2feca3){_0x3975af=_0x3975af-0x0;var _0x37b36f=_0x3a2b[_0x3975af];return _0x37b36f;};'use strict';var _=require(_0xb3a2('0x0'));var util=require(_0xb3a2('0x1'));var logger=require(_0xb3a2('0x2'))(_0xb3a2('0x3'));var moment=require(_0xb3a2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3a2('0x5'));var rimraf=require(_0xb3a2('0x6'));var config=require(_0xb3a2('0x7'));var attributes=require(_0xb3a2('0x8'));module[_0xb3a2('0x9')]=function(_0x1324db,_0x4dbe65){return _0x1324db[_0xb3a2('0xa')](_0xb3a2('0xb'),attributes,{'tableName':_0xb3a2('0xc'),'paranoid':![],'indexes':[{'name':_0xb3a2('0xd'),'fields':[_0xb3a2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 71daaf0..32b2234 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 _0x4152=['request','then','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5463c3,_0x3692b5){var _0x5998a0=function(_0x15dacd){while(--_0x15dacd){_0x5463c3['push'](_0x5463c3['shift']());}};_0x5998a0(++_0x3692b5);}(_0x4152,0xe9));var _0x2415=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4152[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2415('0x0'));var rs=require(_0x2415('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2415('0x2'));var logger=require(_0x2415('0x3'))('rpc');var config=require(_0x2415('0x4'));var jayson=require(_0x2415('0x5'));var client=jayson[_0x2415('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16ed28,_0x267f3b,_0x1756d9){return new BPromise(function(_0x3356ff,_0x2c2e5c){return client[_0x2415('0x7')](_0x16ed28,_0x1756d9)[_0x2415('0x8')](function(_0x238015){logger['info'](_0x2415('0x9'),_0x267f3b,'request\x20sent');logger[_0x2415('0xa')](_0x2415('0xb'),_0x267f3b,_0x2415('0xc'),JSON[_0x2415('0xd')](_0x238015));if(_0x238015['error']){if(_0x238015['error'][_0x2415('0xe')]===0x1f4){logger[_0x2415('0xf')](_0x2415('0x9'),_0x267f3b,_0x238015[_0x2415('0xf')][_0x2415('0x10')]);return _0x2c2e5c(_0x238015[_0x2415('0xf')][_0x2415('0x10')]);}logger['error'](_0x2415('0x9'),_0x267f3b,_0x238015[_0x2415('0xf')]['message']);return _0x3356ff(_0x238015[_0x2415('0xf')]['message']);}else{logger[_0x2415('0x11')](_0x2415('0x9'),_0x267f3b,'request\x20sent');_0x3356ff(_0x238015[_0x2415('0x12')]['message']);}})[_0x2415('0x13')](function(_0x39be39){logger[_0x2415('0xf')](_0x2415('0x9'),_0x267f3b,_0x39be39);_0x2c2e5c(_0x39be39);});});}exports['CreateWhatsappQueueReport']=function(_0x54ab30){var _0x14a7a7=this;return new Promise(function(_0xe35c9e,_0x36b48d){return db['WhatsappQueueReport'][_0x2415('0x14')](_0x54ab30[_0x2415('0x15')],{'raw':_0x54ab30[_0x2415('0x16')]?_0x54ab30[_0x2415('0x16')][_0x2415('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x10a441){logger[_0x2415('0x11')](_0x2415('0x18'),_0x54ab30);logger[_0x2415('0xa')]('CreateWhatsappQueueReport',_0x54ab30,JSON['stringify'](_0x10a441));_0xe35c9e(_0x10a441);})[_0x2415('0x13')](function(_0x13886b){logger[_0x2415('0xf')](_0x2415('0x18'),_0x13886b[_0x2415('0x10')],_0x54ab30);_0x36b48d(_0x14a7a7[_0x2415('0xf')](0x1f4,_0x13886b[_0x2415('0x10')]));});});};exports[_0x2415('0x19')]=function(_0x14fc99){var _0x548b72=this;return new Promise(function(_0x392709,_0x2ccc2d){return db[_0x2415('0x1a')][_0x2415('0x1b')](_0x14fc99[_0x2415('0x15')],{'raw':_0x14fc99[_0x2415('0x16')]?_0x14fc99[_0x2415('0x16')][_0x2415('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14fc99[_0x2415('0x16')]?_0x14fc99[_0x2415('0x16')][_0x2415('0x1c')]||null:null,'attributes':_0x14fc99[_0x2415('0x16')]?_0x14fc99[_0x2415('0x16')][_0x2415('0x1d')]||null:null,'limit':_0x14fc99[_0x2415('0x16')]?_0x14fc99[_0x2415('0x16')]['limit']||null:null})[_0x2415('0x8')](function(_0x596e4b){logger[_0x2415('0x11')](_0x2415('0x19'),_0x14fc99);logger[_0x2415('0xa')]('UpdateWhatsappQueueReport',_0x14fc99,JSON[_0x2415('0xd')](_0x596e4b));_0x392709(_0x596e4b);})['catch'](function(_0xbe6ec8){logger[_0x2415('0xf')]('UpdateWhatsappQueueReport',_0xbe6ec8[_0x2415('0x10')],_0x14fc99);_0x2ccc2d(_0x548b72[_0x2415('0xf')](0x1f4,_0xbe6ec8[_0x2415('0x10')]));});});}; \ No newline at end of file +var _0x1451=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','create','body','options','info','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','update','raw','attributes','lodash','util','bluebird'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x1451,0x193));var _0x1145=function(_0x155719,_0x123b9d){_0x155719=_0x155719-0x0;var _0x41e840=_0x1451[_0x155719];return _0x41e840;};'use strict';var _=require(_0x1145('0x0'));var util=require(_0x1145('0x1'));var moment=require('moment');var BPromise=require(_0x1145('0x2'));var rs=require(_0x1145('0x3'));var fs=require('fs');var Redis=require(_0x1145('0x4'));var db=require(_0x1145('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1145('0x6'))(_0x1145('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1145('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x506a5e,_0x130155,_0x4a14b7){return new BPromise(function(_0x140006,_0x1793d3){return client['request'](_0x506a5e,_0x4a14b7)[_0x1145('0x9')](function(_0x341fa9){logger['info'](_0x1145('0xa'),_0x130155,_0x1145('0xb'));logger[_0x1145('0xc')](_0x1145('0xd'),_0x130155,_0x1145('0xb'),JSON[_0x1145('0xe')](_0x341fa9));if(_0x341fa9[_0x1145('0xf')]){if(_0x341fa9[_0x1145('0xf')][_0x1145('0x10')]===0x1f4){logger[_0x1145('0xf')](_0x1145('0xa'),_0x130155,_0x341fa9['error'][_0x1145('0x11')]);return _0x1793d3(_0x341fa9[_0x1145('0xf')][_0x1145('0x11')]);}logger[_0x1145('0xf')](_0x1145('0xa'),_0x130155,_0x341fa9[_0x1145('0xf')][_0x1145('0x11')]);return _0x140006(_0x341fa9[_0x1145('0xf')]['message']);}else{logger['info'](_0x1145('0xa'),_0x130155,'request\x20sent');_0x140006(_0x341fa9['result']['message']);}})['catch'](function(_0x209c1f){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x130155,_0x209c1f);_0x1793d3(_0x209c1f);});});}exports['CreateWhatsappQueueReport']=function(_0xcd4e72){var _0x4b30ad=this;return new Promise(function(_0x31c9ed,_0x18a056){return db['WhatsappQueueReport'][_0x1145('0x12')](_0xcd4e72[_0x1145('0x13')],{'raw':_0xcd4e72[_0x1145('0x14')]?_0xcd4e72[_0x1145('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x1145('0x9')](function(_0x1ce483){logger[_0x1145('0x15')]('CreateWhatsappQueueReport',_0xcd4e72);logger[_0x1145('0xc')](_0x1145('0x16'),_0xcd4e72,JSON['stringify'](_0x1ce483));_0x31c9ed(_0x1ce483);})[_0x1145('0x17')](function(_0x3cb29e){logger[_0x1145('0xf')](_0x1145('0x16'),_0x3cb29e[_0x1145('0x11')],_0xcd4e72);_0x18a056(_0x4b30ad[_0x1145('0xf')](0x1f4,_0x3cb29e['message']));});});};exports[_0x1145('0x18')]=function(_0x39ebb2){var _0x3c23f8=this;return new Promise(function(_0x5e3081,_0x1e3b81){return db[_0x1145('0x19')][_0x1145('0x1a')](_0x39ebb2[_0x1145('0x13')],{'raw':_0x39ebb2[_0x1145('0x14')]?_0x39ebb2[_0x1145('0x14')][_0x1145('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39ebb2['options']?_0x39ebb2[_0x1145('0x14')]['where']||null:null,'attributes':_0x39ebb2['options']?_0x39ebb2['options'][_0x1145('0x1c')]||null:null,'limit':_0x39ebb2[_0x1145('0x14')]?_0x39ebb2['options']['limit']||null:null})[_0x1145('0x9')](function(_0x372b88){logger[_0x1145('0x15')](_0x1145('0x18'),_0x39ebb2);logger[_0x1145('0xc')](_0x1145('0x18'),_0x39ebb2,JSON[_0x1145('0xe')](_0x372b88));_0x5e3081(_0x372b88);})[_0x1145('0x17')](function(_0x1179e8){logger['error']('UpdateWhatsappQueueReport',_0x1179e8[_0x1145('0x11')],_0x39ebb2);_0x1e3b81(_0x3c23f8[_0x1145('0xf')](0x1f4,_0x1179e8[_0x1145('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 21b8115..15515fe 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 _0x15a9=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','multer'];(function(_0x4bbd5f,_0x3d9914){var _0x5b281e=function(_0x29e886){while(--_0x29e886){_0x4bbd5f['push'](_0x4bbd5f['shift']());}};_0x5b281e(++_0x3d9914);}(_0x15a9,0xb3));var _0x915a=function(_0xd76a02,_0x2a2409){_0xd76a02=_0xd76a02-0x0;var _0x246033=_0x15a9[_0xd76a02];return _0x246033;};'use strict';var multer=require(_0x915a('0x0'));var util=require(_0x915a('0x1'));var path=require(_0x915a('0x2'));var timeout=require(_0x915a('0x3'));var express=require(_0x915a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x915a('0x5'));var interaction=require(_0x915a('0x6'));var config=require(_0x915a('0x7'));var controller=require(_0x915a('0x8'));router[_0x915a('0x9')]('/',auth[_0x915a('0xa')](),controller[_0x915a('0xb')]);router[_0x915a('0x9')](_0x915a('0xc'),auth[_0x915a('0xa')](),controller[_0x915a('0xd')]);router[_0x915a('0x9')](_0x915a('0xe'),auth['isAuthenticated'](),controller[_0x915a('0xf')]);router[_0x915a('0x10')]('/',auth[_0x915a('0xa')](),controller['create']);router['put'](_0x915a('0xe'),auth[_0x915a('0xa')](),controller[_0x915a('0x11')]);router[_0x915a('0x12')]('/:id',auth[_0x915a('0xa')](),controller[_0x915a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x51de=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','connect-timeout'];(function(_0x2ac07d,_0x45eee2){var _0x367b0c=function(_0x2995b6){while(--_0x2995b6){_0x2ac07d['push'](_0x2ac07d['shift']());}};_0x367b0c(++_0x45eee2);}(_0x51de,0x143));var _0xe51d=function(_0x2ebbca,_0x3e0847){_0x2ebbca=_0x2ebbca-0x0;var _0x36edf2=_0x51de[_0x2ebbca];return _0x36edf2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe51d('0x0'));var express=require('express');var router=express[_0xe51d('0x1')]();var fs_extra=require(_0xe51d('0x2'));var auth=require(_0xe51d('0x3'));var interaction=require(_0xe51d('0x4'));var config=require(_0xe51d('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0xe51d('0x6')]('/',auth[_0xe51d('0x7')](),controller[_0xe51d('0x8')]);router['get'](_0xe51d('0x9'),auth[_0xe51d('0x7')](),controller[_0xe51d('0xa')]);router['get'](_0xe51d('0xb'),auth['isAuthenticated'](),controller[_0xe51d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe51d('0xd')]);router[_0xe51d('0xe')](_0xe51d('0xb'),auth['isAuthenticated'](),controller[_0xe51d('0xf')]);router[_0xe51d('0x10')](_0xe51d('0xb'),auth['isAuthenticated'](),controller[_0xe51d('0x11')]);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 aefe3c7..55e3935 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 _0x6e1c=['queue','DATE','sequelize','ENUM','account','agent'];(function(_0x42fc4f,_0x267216){var _0x30ab18=function(_0x3eaed8){while(--_0x3eaed8){_0x42fc4f['push'](_0x42fc4f['shift']());}};_0x30ab18(++_0x267216);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc6e1('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc6e1('0x1')](_0xc6e1('0x2'),_0xc6e1('0x3'),_0xc6e1('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc6e1('0x5')]}}; \ No newline at end of file +var _0x0abf=['sequelize','STRING','ENUM','queue'];(function(_0x4e3923,_0x460856){var _0x274c25=function(_0x24466c){while(--_0x24466c){_0x4e3923['push'](_0x4e3923['shift']());}};_0x274c25(++_0x460856);}(_0x0abf,0xe8));var _0xf0ab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0abf[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf0ab('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf0ab('0x2')]('account','agent',_0xf0ab('0x3')),'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 5708c5e..599c52a 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 _0xc19a=['sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','end','error','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x545ac5,_0x35d4a3){var _0x4fefa7=function(_0x24c35d){while(--_0x24c35d){_0x545ac5['push'](_0x545ac5['shift']());}};_0x4fefa7(++_0x35d4a3);}(_0xc19a,0x7f));var _0xac19=function(_0x4d37fd,_0x3d4e2c){_0x4d37fd=_0x4d37fd-0x0;var _0x5ea307=_0xc19a[_0x4d37fd];return _0x5ea307;};'use strict';var emlformat=require(_0xac19('0x0'));var rimraf=require(_0xac19('0x1'));var zipdir=require(_0xac19('0x2'));var jsonpatch=require(_0xac19('0x3'));var rp=require('request-promise');var moment=require(_0xac19('0x4'));var BPromise=require(_0xac19('0x5'));var Mustache=require(_0xac19('0x6'));var util=require('util');var path=require(_0xac19('0x7'));var sox=require(_0xac19('0x8'));var csv=require('to-csv');var ejs=require(_0xac19('0x9'));var fs=require('fs');var fs_extra=require(_0xac19('0xa'));var _=require('lodash');var squel=require(_0xac19('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac19('0xc'));var querystring=require(_0xac19('0xd'));var Papa=require(_0xac19('0xe'));var Redis=require(_0xac19('0xf'));var authService=require(_0xac19('0x10'));var qs=require(_0xac19('0x11'));var as=require(_0xac19('0x12'));var hardwareService=require(_0xac19('0x13'));var logger=require('../../config/logger')(_0xac19('0x14'));var utils=require(_0xac19('0x15'));var config=require(_0xac19('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x493836,_0x52f65e){_0x52f65e=_0x52f65e||0xcc;return function(_0xba0c2a){if(_0xba0c2a){return _0x493836[_0xac19('0x17')](_0x52f65e);}return _0x493836['status'](_0x52f65e)['end']();};}function respondWithResult(_0x1bfe4a,_0x5a0214){_0x5a0214=_0x5a0214||0xc8;return function(_0x127a6e){if(_0x127a6e){return _0x1bfe4a[_0xac19('0x18')](_0x5a0214)['json'](_0x127a6e);}};}function respondWithFilteredResult(_0x189eab,_0x5817e1){return function(_0x204220){if(_0x204220){var _0x1961fc=typeof _0x5817e1[_0xac19('0x19')]===_0xac19('0x1a')&&typeof _0x5817e1[_0xac19('0x1b')]==='undefined';var _0x5235ac=_0x204220[_0xac19('0x1c')];var _0x26c053=_0x1961fc?0x0:_0x5817e1[_0xac19('0x19')];var _0x42d094=_0x1961fc?_0x204220['count']:_0x5817e1['offset']+_0x5817e1[_0xac19('0x1b')];var _0x2b0e52;if(_0x42d094>=_0x5235ac){_0x42d094=_0x5235ac;_0x2b0e52=0xc8;}else{_0x2b0e52=0xce;}_0x189eab[_0xac19('0x18')](_0x2b0e52);return _0x189eab[_0xac19('0x1d')](_0xac19('0x1e'),_0x26c053+'-'+_0x42d094+'/'+_0x5235ac)[_0xac19('0x1f')](_0x204220);}return null;};}function patchUpdates(_0x3d63c0){return function(_0x1d150b){try{jsonpatch[_0xac19('0x20')](_0x1d150b,_0x3d63c0,!![]);}catch(_0x7239ca){return BPromise['reject'](_0x7239ca);}return _0x1d150b[_0xac19('0x21')]();};}function saveUpdates(_0x347f6e,_0x2c457f){return function(_0x31dbb7){if(_0x31dbb7){return _0x31dbb7['update'](_0x347f6e)[_0xac19('0x22')](function(_0x52b6d2){return _0x52b6d2;});}return null;};}function removeEntity(_0x605bb3,_0x5d65fb){return function(_0x404842){if(_0x404842){return _0x404842[_0xac19('0x23')]()['then'](function(){_0x605bb3[_0xac19('0x18')](0xcc)[_0xac19('0x24')]();});}};}function handleEntityNotFound(_0x4158c4,_0x5351e4){return function(_0x1d1308){if(!_0x1d1308){_0x4158c4[_0xac19('0x17')](0x194);}return _0x1d1308;};}function handleError(_0x1bb883,_0x378566){_0x378566=_0x378566||0x1f4;return function(_0x46ce99){logger[_0xac19('0x25')](_0x46ce99['stack']);if(_0x46ce99[_0xac19('0x26')]){delete _0x46ce99[_0xac19('0x26')];}_0x1bb883[_0xac19('0x18')](_0x378566)[_0xac19('0x27')](_0x46ce99);};}exports['index']=function(_0x1301cd,_0x212b9f){var _0x2c372b={},_0x1779fa={},_0x4db0be={'count':0x0,'rows':[]};var _0x701c97=_[_0xac19('0x28')](db[_0xac19('0x29')][_0xac19('0x2a')],function(_0x5cb694){return{'name':_0x5cb694[_0xac19('0x2b')],'type':_0x5cb694[_0xac19('0x2c')][_0xac19('0x2d')]};});_0x1779fa[_0xac19('0x2e')]=_[_0xac19('0x28')](_0x701c97,_0xac19('0x26'));_0x1779fa[_0xac19('0x2f')]=_[_0xac19('0x30')](_0x1301cd[_0xac19('0x2f')]);_0x1779fa[_0xac19('0x31')]=_['intersection'](_0x1779fa[_0xac19('0x2e')],_0x1779fa[_0xac19('0x2f')]);_0x2c372b['attributes']=_['intersection'](_0x1779fa[_0xac19('0x2e')],qs[_0xac19('0x32')](_0x1301cd[_0xac19('0x2f')][_0xac19('0x32')]));_0x2c372b[_0xac19('0x33')]=_0x2c372b[_0xac19('0x33')][_0xac19('0x34')]?_0x2c372b[_0xac19('0x33')]:_0x1779fa['model'];if(!_0x1301cd['query'][_0xac19('0x35')](_0xac19('0x36'))){_0x2c372b[_0xac19('0x1b')]=qs[_0xac19('0x1b')](_0x1301cd[_0xac19('0x2f')]['limit']);_0x2c372b[_0xac19('0x19')]=qs['offset'](_0x1301cd[_0xac19('0x2f')]['offset']);}_0x2c372b[_0xac19('0x37')]=qs[_0xac19('0x38')](_0x1301cd[_0xac19('0x2f')][_0xac19('0x38')]);_0x2c372b[_0xac19('0x39')]=qs[_0xac19('0x31')](_[_0xac19('0x3a')](_0x1301cd[_0xac19('0x2f')],_0x1779fa[_0xac19('0x31')]),_0x701c97);if(_0x1301cd[_0xac19('0x2f')][_0xac19('0x3b')]){_0x2c372b['where']=_[_0xac19('0x3c')](_0x2c372b['where'],{'$or':_[_0xac19('0x28')](_0x701c97,function(_0x48073f){if(_0x48073f[_0xac19('0x2c')]!==_0xac19('0x3d')){var _0x2511b8={};_0x2511b8[_0x48073f[_0xac19('0x26')]]={'$like':'%'+_0x1301cd['query']['filter']+'%'};return _0x2511b8;}})});}_0x2c372b=_['merge']({},_0x2c372b,_0x1301cd[_0xac19('0x3e')]);var _0x200290={'where':_0x2c372b[_0xac19('0x39')]};return db[_0xac19('0x29')][_0xac19('0x1c')](_0x200290)[_0xac19('0x22')](function(_0x1ec53f){_0x4db0be['count']=_0x1ec53f;if(_0x1301cd[_0xac19('0x2f')][_0xac19('0x3f')]){_0x2c372b[_0xac19('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xac19('0x41')](_0x2c372b);})['then'](function(_0x305092){_0x4db0be[_0xac19('0x42')]=_0x305092;return _0x4db0be;})[_0xac19('0x22')](respondWithFilteredResult(_0x212b9f,_0x2c372b))[_0xac19('0x43')](handleError(_0x212b9f,null));};exports[_0xac19('0x44')]=function(_0x111584,_0x8fd928){var _0x1d09f7={'raw':!![],'where':{'id':_0x111584['params']['id']}},_0x2b70ea={};_0x2b70ea[_0xac19('0x2e')]=_[_0xac19('0x30')](db['WhatsappTransferReport'][_0xac19('0x2a')]);_0x2b70ea[_0xac19('0x2f')]=_['keys'](_0x111584['query']);_0x2b70ea[_0xac19('0x31')]=_[_0xac19('0x45')](_0x2b70ea[_0xac19('0x2e')],_0x2b70ea[_0xac19('0x2f')]);_0x1d09f7[_0xac19('0x33')]=_[_0xac19('0x45')](_0x2b70ea[_0xac19('0x2e')],qs[_0xac19('0x32')](_0x111584[_0xac19('0x2f')][_0xac19('0x32')]));_0x1d09f7[_0xac19('0x33')]=_0x1d09f7[_0xac19('0x33')]['length']?_0x1d09f7[_0xac19('0x33')]:_0x2b70ea[_0xac19('0x2e')];if(_0x111584[_0xac19('0x2f')][_0xac19('0x3f')]){_0x1d09f7['include']=[{'all':!![]}];}_0x1d09f7=_[_0xac19('0x3c')]({},_0x1d09f7,_0x111584[_0xac19('0x3e')]);return db[_0xac19('0x29')][_0xac19('0x46')](_0x1d09f7)[_0xac19('0x22')](handleEntityNotFound(_0x8fd928,null))[_0xac19('0x22')](respondWithResult(_0x8fd928,null))['catch'](handleError(_0x8fd928,null));};exports[_0xac19('0x47')]=function(_0x200c0d,_0x222d95){return db[_0xac19('0x29')][_0xac19('0x47')](_0x200c0d[_0xac19('0x48')],{})[_0xac19('0x22')](respondWithResult(_0x222d95,0xc9))[_0xac19('0x43')](handleError(_0x222d95,null));};exports[_0xac19('0x49')]=function(_0x3df206,_0x1d107b){if(_0x3df206['body']['id']){delete _0x3df206[_0xac19('0x48')]['id'];}return db['WhatsappTransferReport'][_0xac19('0x46')]({'where':{'id':_0x3df206['params']['id']}})[_0xac19('0x22')](handleEntityNotFound(_0x1d107b,null))[_0xac19('0x22')](saveUpdates(_0x3df206[_0xac19('0x48')],null))[_0xac19('0x22')](respondWithResult(_0x1d107b,null))[_0xac19('0x43')](handleError(_0x1d107b,null));};exports[_0xac19('0x23')]=function(_0x22ddf3,_0xa14c28){return db[_0xac19('0x29')][_0xac19('0x46')]({'where':{'id':_0x22ddf3['params']['id']}})['then'](handleEntityNotFound(_0xa14c28,null))['then'](removeEntity(_0xa14c28,null))['catch'](handleError(_0xa14c28,null));};exports[_0xac19('0x4a')]=function(_0x3f24c3,_0x31bc26){return db[_0xac19('0x29')][_0xac19('0x4a')]()[_0xac19('0x22')](respondWithResult(_0x31bc26,null))[_0xac19('0x43')](handleError(_0x31bc26,null));}; \ No newline at end of file +var _0x95b5=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','include','catch','show','params','keys','intersection','update','body','find','describe','eml-format','zip-dir','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x55dd7b,_0x4865f8){var _0x12664f=function(_0x12fdb4){while(--_0x12fdb4){_0x55dd7b['push'](_0x55dd7b['shift']());}};_0x12664f(++_0x4865f8);}(_0x95b5,0x143));var _0x595b=function(_0xafdf47,_0x38b5b3){_0xafdf47=_0xafdf47-0x0;var _0x1e6c17=_0x95b5[_0xafdf47];return _0x1e6c17;};'use strict';var emlformat=require(_0x595b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x595b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x595b('0x2'));var sox=require(_0x595b('0x3'));var csv=require(_0x595b('0x4'));var ejs=require(_0x595b('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x595b('0x6'));var jsforce=require(_0x595b('0x7'));var deskjs=require(_0x595b('0x8'));var toCsv=require(_0x595b('0x4'));var querystring=require(_0x595b('0x9'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x595b('0xa'));var qs=require(_0x595b('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x595b('0xc'));var logger=require(_0x595b('0xd'))(_0x595b('0xe'));var utils=require('../../config/utils');var config=require(_0x595b('0xf'));var licenseUtil=require(_0x595b('0x10'));var db=require(_0x595b('0x11'))['db'];function respondWithStatusCode(_0x7df826,_0x3c845c){_0x3c845c=_0x3c845c||0xcc;return function(_0x28f05a){if(_0x28f05a){return _0x7df826['sendStatus'](_0x3c845c);}return _0x7df826[_0x595b('0x12')](_0x3c845c)['end']();};}function respondWithResult(_0x576e58,_0x1c2f8b){_0x1c2f8b=_0x1c2f8b||0xc8;return function(_0x26a88a){if(_0x26a88a){return _0x576e58[_0x595b('0x12')](_0x1c2f8b)[_0x595b('0x13')](_0x26a88a);}};}function respondWithFilteredResult(_0x48429d,_0x1ab11e){return function(_0x385f64){if(_0x385f64){var _0x549fbf=typeof _0x1ab11e[_0x595b('0x14')]===_0x595b('0x15')&&typeof _0x1ab11e[_0x595b('0x16')]==='undefined';var _0x3bacd7=_0x385f64[_0x595b('0x17')];var _0x6a4d52=_0x549fbf?0x0:_0x1ab11e[_0x595b('0x14')];var _0x32aaf0=_0x549fbf?_0x385f64[_0x595b('0x17')]:_0x1ab11e[_0x595b('0x14')]+_0x1ab11e[_0x595b('0x16')];var _0x2fb087;if(_0x32aaf0>=_0x3bacd7){_0x32aaf0=_0x3bacd7;_0x2fb087=0xc8;}else{_0x2fb087=0xce;}_0x48429d[_0x595b('0x12')](_0x2fb087);return _0x48429d[_0x595b('0x18')](_0x595b('0x19'),_0x6a4d52+'-'+_0x32aaf0+'/'+_0x3bacd7)[_0x595b('0x13')](_0x385f64);}return null;};}function patchUpdates(_0x50ec9e){return function(_0xbf59e3){try{jsonpatch[_0x595b('0x1a')](_0xbf59e3,_0x50ec9e,!![]);}catch(_0x31245b){return BPromise[_0x595b('0x1b')](_0x31245b);}return _0xbf59e3[_0x595b('0x1c')]();};}function saveUpdates(_0x4cd310,_0x2eaed6){return function(_0x378444){if(_0x378444){return _0x378444['update'](_0x4cd310)['then'](function(_0x1413c0){return _0x1413c0;});}return null;};}function removeEntity(_0x385df3,_0x3218b1){return function(_0x3cfaa5){if(_0x3cfaa5){return _0x3cfaa5[_0x595b('0x1d')]()[_0x595b('0x1e')](function(){_0x385df3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30856e,_0x2ac807){return function(_0x4c3444){if(!_0x4c3444){_0x30856e[_0x595b('0x1f')](0x194);}return _0x4c3444;};}function handleError(_0x4cb3f5,_0x30ed66){_0x30ed66=_0x30ed66||0x1f4;return function(_0x34babd){logger['error'](_0x34babd[_0x595b('0x20')]);if(_0x34babd[_0x595b('0x21')]){delete _0x34babd[_0x595b('0x21')];}_0x4cb3f5[_0x595b('0x12')](_0x30ed66)['send'](_0x34babd);};}exports[_0x595b('0x22')]=function(_0x1cd13c,_0x4820ca){var _0x2739ad={},_0x1f2e34={},_0x120696={'count':0x0,'rows':[]};var _0x5df2ae=_[_0x595b('0x23')](db['WhatsappTransferReport'][_0x595b('0x24')],function(_0x92622f){return{'name':_0x92622f[_0x595b('0x25')],'type':_0x92622f[_0x595b('0x26')][_0x595b('0x27')]};});_0x1f2e34['model']=_[_0x595b('0x23')](_0x5df2ae,'name');_0x1f2e34['query']=_['keys'](_0x1cd13c['query']);_0x1f2e34['filters']=_['intersection'](_0x1f2e34[_0x595b('0x28')],_0x1f2e34[_0x595b('0x29')]);_0x2739ad['attributes']=_['intersection'](_0x1f2e34[_0x595b('0x28')],qs[_0x595b('0x2a')](_0x1cd13c[_0x595b('0x29')][_0x595b('0x2a')]));_0x2739ad[_0x595b('0x2b')]=_0x2739ad[_0x595b('0x2b')][_0x595b('0x2c')]?_0x2739ad[_0x595b('0x2b')]:_0x1f2e34[_0x595b('0x28')];if(!_0x1cd13c[_0x595b('0x29')][_0x595b('0x2d')]('nolimit')){_0x2739ad['limit']=qs[_0x595b('0x16')](_0x1cd13c['query'][_0x595b('0x16')]);_0x2739ad[_0x595b('0x14')]=qs[_0x595b('0x14')](_0x1cd13c[_0x595b('0x29')][_0x595b('0x14')]);}_0x2739ad[_0x595b('0x2e')]=qs[_0x595b('0x2f')](_0x1cd13c[_0x595b('0x29')][_0x595b('0x2f')]);_0x2739ad[_0x595b('0x30')]=qs[_0x595b('0x31')](_[_0x595b('0x32')](_0x1cd13c['query'],_0x1f2e34['filters']),_0x5df2ae);if(_0x1cd13c['query'][_0x595b('0x33')]){_0x2739ad['where']=_[_0x595b('0x34')](_0x2739ad[_0x595b('0x30')],{'$or':_[_0x595b('0x23')](_0x5df2ae,function(_0x2bfbe8){if(_0x2bfbe8[_0x595b('0x26')]!==_0x595b('0x35')){var _0x51be1b={};_0x51be1b[_0x2bfbe8[_0x595b('0x21')]]={'$like':'%'+_0x1cd13c[_0x595b('0x29')][_0x595b('0x33')]+'%'};return _0x51be1b;}})});}_0x2739ad=_['merge']({},_0x2739ad,_0x1cd13c[_0x595b('0x36')]);var _0x3cbcd2={'where':_0x2739ad['where']};return db[_0x595b('0x37')][_0x595b('0x17')](_0x3cbcd2)[_0x595b('0x1e')](function(_0x3fe172){_0x120696[_0x595b('0x17')]=_0x3fe172;if(_0x1cd13c[_0x595b('0x29')][_0x595b('0x38')]){_0x2739ad[_0x595b('0x39')]=[{'all':!![]}];}return db[_0x595b('0x37')]['findAll'](_0x2739ad);})['then'](function(_0x21e453){_0x120696['rows']=_0x21e453;return _0x120696;})[_0x595b('0x1e')](respondWithFilteredResult(_0x4820ca,_0x2739ad))[_0x595b('0x3a')](handleError(_0x4820ca,null));};exports[_0x595b('0x3b')]=function(_0x125912,_0x21cc38){var _0x4c890c={'raw':!![],'where':{'id':_0x125912[_0x595b('0x3c')]['id']}},_0x526133={};_0x526133[_0x595b('0x28')]=_[_0x595b('0x3d')](db[_0x595b('0x37')]['rawAttributes']);_0x526133[_0x595b('0x29')]=_[_0x595b('0x3d')](_0x125912['query']);_0x526133[_0x595b('0x31')]=_['intersection'](_0x526133[_0x595b('0x28')],_0x526133[_0x595b('0x29')]);_0x4c890c['attributes']=_[_0x595b('0x3e')](_0x526133['model'],qs[_0x595b('0x2a')](_0x125912['query'][_0x595b('0x2a')]));_0x4c890c[_0x595b('0x2b')]=_0x4c890c[_0x595b('0x2b')][_0x595b('0x2c')]?_0x4c890c[_0x595b('0x2b')]:_0x526133[_0x595b('0x28')];if(_0x125912[_0x595b('0x29')][_0x595b('0x38')]){_0x4c890c['include']=[{'all':!![]}];}_0x4c890c=_[_0x595b('0x34')]({},_0x4c890c,_0x125912[_0x595b('0x36')]);return db[_0x595b('0x37')]['find'](_0x4c890c)[_0x595b('0x1e')](handleEntityNotFound(_0x21cc38,null))[_0x595b('0x1e')](respondWithResult(_0x21cc38,null))[_0x595b('0x3a')](handleError(_0x21cc38,null));};exports['create']=function(_0x1c39df,_0x585590){return db[_0x595b('0x37')]['create'](_0x1c39df['body'],{})[_0x595b('0x1e')](respondWithResult(_0x585590,0xc9))[_0x595b('0x3a')](handleError(_0x585590,null));};exports[_0x595b('0x3f')]=function(_0x29da32,_0x5c3d43){if(_0x29da32[_0x595b('0x40')]['id']){delete _0x29da32[_0x595b('0x40')]['id'];}return db[_0x595b('0x37')][_0x595b('0x41')]({'where':{'id':_0x29da32[_0x595b('0x3c')]['id']}})[_0x595b('0x1e')](handleEntityNotFound(_0x5c3d43,null))['then'](saveUpdates(_0x29da32[_0x595b('0x40')],null))[_0x595b('0x1e')](respondWithResult(_0x5c3d43,null))[_0x595b('0x3a')](handleError(_0x5c3d43,null));};exports[_0x595b('0x1d')]=function(_0x209920,_0x15c7b5){return db[_0x595b('0x37')][_0x595b('0x41')]({'where':{'id':_0x209920[_0x595b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x15c7b5,null))[_0x595b('0x1e')](removeEntity(_0x15c7b5,null))['catch'](handleError(_0x15c7b5,null));};exports['describe']=function(_0x18f5eb,_0x2cca73){return db['WhatsappTransferReport'][_0x595b('0x42')]()[_0x595b('0x1e')](respondWithResult(_0x2cca73,null))[_0x595b('0x3a')](handleError(_0x2cca73,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index db2ba33..67d95e7 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 _0x69f2=['api','moment','request-promise','rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2153dd,_0x465fb7){var _0x3da57d=function(_0x3e9d44){while(--_0x3e9d44){_0x2153dd['push'](_0x2153dd['shift']());}};_0x3da57d(++_0x465fb7);}(_0x69f2,0x72));var _0x269f=function(_0x2ce841,_0x2f74ac){_0x2ce841=_0x2ce841-0x0;var _0x15e0dd=_0x69f2[_0x2ce841];return _0x15e0dd;};'use strict';var _=require(_0x269f('0x0'));var util=require(_0x269f('0x1'));var logger=require(_0x269f('0x2'))(_0x269f('0x3'));var moment=require(_0x269f('0x4'));var BPromise=require('bluebird');var rp=require(_0x269f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x269f('0x6'));var config=require(_0x269f('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0x269f('0x8')]=function(_0x40cce1,_0x386967){return _0x40cce1[_0x269f('0x9')](_0x269f('0xa'),attributes,{'tableName':_0x269f('0xb'),'paranoid':![],'indexes':[{'name':_0x269f('0xc'),'fields':[_0x269f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xccbe=['../../config/environment','./whatsappTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4042d7,_0x46c717){var _0x344f6e=function(_0x1d79e3){while(--_0x1d79e3){_0x4042d7['push'](_0x4042d7['shift']());}};_0x344f6e(++_0x46c717);}(_0xccbe,0x1b7));var _0xeccb=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0xccbe[_0x4687df];return _0x32eaef;};'use strict';var _=require(_0xeccb('0x0'));var util=require(_0xeccb('0x1'));var logger=require(_0xeccb('0x2'))(_0xeccb('0x3'));var moment=require(_0xeccb('0x4'));var BPromise=require(_0xeccb('0x5'));var rp=require(_0xeccb('0x6'));var fs=require('fs');var path=require(_0xeccb('0x7'));var rimraf=require(_0xeccb('0x8'));var config=require(_0xeccb('0x9'));var attributes=require(_0xeccb('0xa'));module[_0xeccb('0xb')]=function(_0xf38129,_0x32f39a){return _0xf38129[_0xeccb('0xc')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xeccb('0xd'),'fields':[_0xeccb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b350aaf..8e5b964 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 _0x764b=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappTransferReport,\x20%s,\x20%s','message'];(function(_0x487d0a,_0x1b7cb4){var _0x3d740c=function(_0xa714f2){while(--_0xa714f2){_0x487d0a['push'](_0x487d0a['shift']());}};_0x3d740c(++_0x1b7cb4);}(_0x764b,0xb5));var _0xb764=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x764b[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xb764('0x0'));var util=require(_0xb764('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb764('0x2'));var fs=require('fs');var Redis=require(_0xb764('0x3'));var db=require(_0xb764('0x4'))['db'];var utils=require(_0xb764('0x5'));var logger=require(_0xb764('0x6'))(_0xb764('0x7'));var config=require(_0xb764('0x8'));var jayson=require(_0xb764('0x9'));var client=jayson[_0xb764('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22d388,_0x3fd053,_0x4d299c){return new BPromise(function(_0x574338,_0x1b3415){return client[_0xb764('0xb')](_0x22d388,_0x4d299c)[_0xb764('0xc')](function(_0x33a64b){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x3fd053,_0xb764('0xd'));logger['debug'](_0xb764('0xe'),_0x3fd053,_0xb764('0xd'),JSON['stringify'](_0x33a64b));if(_0x33a64b[_0xb764('0xf')]){if(_0x33a64b[_0xb764('0xf')][_0xb764('0x10')]===0x1f4){logger[_0xb764('0xf')](_0xb764('0x11'),_0x3fd053,_0x33a64b[_0xb764('0xf')][_0xb764('0x12')]);return _0x1b3415(_0x33a64b['error'][_0xb764('0x12')]);}logger[_0xb764('0xf')](_0xb764('0x11'),_0x3fd053,_0x33a64b[_0xb764('0xf')][_0xb764('0x12')]);return _0x574338(_0x33a64b[_0xb764('0xf')]['message']);}else{logger['info'](_0xb764('0x11'),_0x3fd053,_0xb764('0xd'));_0x574338(_0x33a64b['result'][_0xb764('0x12')]);}})[_0xb764('0x13')](function(_0x55939d){logger['error'](_0xb764('0x11'),_0x3fd053,_0x55939d);_0x1b3415(_0x55939d);});});} \ No newline at end of file +var _0x3c0c=['../../config/logger','rpc','jayson/promise','http','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c0c,0x94));var _0xc3c0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3c0c[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xc3c0('0x0'));var util=require('util');var moment=require(_0xc3c0('0x1'));var BPromise=require('bluebird');var rs=require(_0xc3c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3c0('0x3'))['db'];var utils=require(_0xc3c0('0x4'));var logger=require(_0xc3c0('0x5'))(_0xc3c0('0x6'));var config=require('../../config/environment');var jayson=require(_0xc3c0('0x7'));var client=jayson['client'][_0xc3c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e0320,_0x2833bb,_0x2aad9c){return new BPromise(function(_0x30b32e,_0x41d878){return client['request'](_0x2e0320,_0x2aad9c)['then'](function(_0x111d23){logger['info'](_0xc3c0('0x9'),_0x2833bb,_0xc3c0('0xa'));logger[_0xc3c0('0xb')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x2833bb,_0xc3c0('0xa'),JSON[_0xc3c0('0xc')](_0x111d23));if(_0x111d23['error']){if(_0x111d23[_0xc3c0('0xd')][_0xc3c0('0xe')]===0x1f4){logger[_0xc3c0('0xd')](_0xc3c0('0x9'),_0x2833bb,_0x111d23['error']['message']);return _0x41d878(_0x111d23[_0xc3c0('0xd')]['message']);}logger[_0xc3c0('0xd')](_0xc3c0('0x9'),_0x2833bb,_0x111d23[_0xc3c0('0xd')]['message']);return _0x30b32e(_0x111d23['error'][_0xc3c0('0xf')]);}else{logger['info'](_0xc3c0('0x9'),_0x2833bb,_0xc3c0('0xa'));_0x30b32e(_0x111d23[_0xc3c0('0x10')][_0xc3c0('0xf')]);}})['catch'](function(_0x7c817f){logger[_0xc3c0('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2833bb,_0x7c817f);_0x41d878(_0x7c817f);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 555488f..b44f93c 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a9c=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','join','status','seedDB','./config/license','default','error'];(function(_0x589e30,_0x148169){var _0x336f60=function(_0x38eb36){while(--_0x38eb36){_0x589e30['push'](_0x589e30['shift']());}};_0x336f60(++_0x148169);}(_0x8a9c,0xfe));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var mysqldb=require(_0xc8a9('0x1'));var rpc=require('./rpc');var config=require(_0xc8a9('0x2'));var logger=require('./config/logger')(_0xc8a9('0x3'));var pm2=require(_0xc8a9('0x4'));var pm2Config=require(_0xc8a9('0x5'));var schedule=require(_0xc8a9('0x6'));var chat=require(_0xc8a9('0x7'));var whatsapp=require(_0xc8a9('0x8'));var transcribe=require(_0xc8a9('0x9'));function main(){return mysqldb['db'][_0xc8a9('0xa')][_0xc8a9('0xb')]()[_0xc8a9('0xc')](function(){return rpc[_0xc8a9('0xd')]();})[_0xc8a9('0xc')](function(_0x2d45ad){logger[_0xc8a9('0xe')](_0x2d45ad);return chat[_0xc8a9('0xf')]();})[_0xc8a9('0xc')](function(){return whatsapp[_0xc8a9('0xf')]();})[_0xc8a9('0xc')](function(){return schedule[_0xc8a9('0xf')]();})[_0xc8a9('0xc')](function(){return transcribe[_0xc8a9('0xf')]();})['then'](function(_0x16e6f1){logger[_0xc8a9('0xe')](_0x16e6f1);return pm2[_0xc8a9('0xf')](pm2Config);})[_0xc8a9('0xc')](function(_0xe0c64c){logger[_0xc8a9('0xe')](_0xc8a9('0x10'),_[_0xc8a9('0x11')](_[_0xc8a9('0x12')](_0xe0c64c,{'status':_0xc8a9('0x13')}),'name')[_0xc8a9('0x14')]());logger[_0xc8a9('0xe')]('Offline\x20apps:',_[_0xc8a9('0x11')](_['filter'](_0xe0c64c,function(_0x2a178a){return _0x2a178a[_0xc8a9('0x15')]!==_0xc8a9('0x13');}),'name')[_0xc8a9('0x14')]()||'None');config[_0xc8a9('0x16')]&&require('./config/seedDB')['default']();require(_0xc8a9('0x17'))[_0xc8a9('0x18')]();})['catch'](function(_0x58aa34){logger[_0xc8a9('0x19')](_0xc8a9('0x1a'),_0x58aa34);process[_0xc8a9('0x1b')](0x1);});}main(); \ No newline at end of file +var _0x9e2a=['app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','listen','then','start','info','Online\x20apps:','join','Offline\x20apps:','filter','status','online','name','None','seedDB','./config/seedDB','default','./config/license','catch','error','exit','lodash','./rpc','./config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9e2a,0x10b));var _0xa9e2=function(_0xb475a2,_0x4ce5c9){_0xb475a2=_0xb475a2-0x0;var _0x38be70=_0x9e2a[_0xb475a2];return _0x38be70;};'use strict';var _=require(_0xa9e2('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xa9e2('0x1'));var config=require(_0xa9e2('0x2'));var logger=require('./config/logger')(_0xa9e2('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0xa9e2('0x4'));var schedule=require(_0xa9e2('0x5'));var chat=require(_0xa9e2('0x6'));var whatsapp=require(_0xa9e2('0x7'));var transcribe=require(_0xa9e2('0x8'));function main(){return mysqldb['db'][_0xa9e2('0x9')][_0xa9e2('0xa')]()['then'](function(){return rpc[_0xa9e2('0xb')]();})[_0xa9e2('0xc')](function(_0x461857){logger['info'](_0x461857);return chat[_0xa9e2('0xd')]();})[_0xa9e2('0xc')](function(){return whatsapp[_0xa9e2('0xd')]();})[_0xa9e2('0xc')](function(){return schedule[_0xa9e2('0xd')]();})[_0xa9e2('0xc')](function(){return transcribe[_0xa9e2('0xd')]();})[_0xa9e2('0xc')](function(_0x4f5085){logger[_0xa9e2('0xe')](_0x4f5085);return pm2[_0xa9e2('0xd')](pm2Config);})[_0xa9e2('0xc')](function(_0x3d9a3f){logger[_0xa9e2('0xe')](_0xa9e2('0xf'),_['map'](_['filter'](_0x3d9a3f,{'status':'online'}),'name')[_0xa9e2('0x10')]());logger['info'](_0xa9e2('0x11'),_['map'](_[_0xa9e2('0x12')](_0x3d9a3f,function(_0x3b1b88){return _0x3b1b88[_0xa9e2('0x13')]!==_0xa9e2('0x14');}),_0xa9e2('0x15'))['join']()||_0xa9e2('0x16'));config[_0xa9e2('0x17')]&&require(_0xa9e2('0x18'))[_0xa9e2('0x19')]();require(_0xa9e2('0x1a'))[_0xa9e2('0x19')]();})[_0xa9e2('0x1b')](function(_0x5409f9){logger[_0xa9e2('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5409f9);process[_0xa9e2('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 50e13d1..ccb69be 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 _0xa3f3=['disposition','status','json','unmanaged','Unmanaged.','Forbidden.','authorization','headers','Basic','find','then','user','startsWith','Bearer','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','add','blockDuration','minutes','catch','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','redirect','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','payload','options','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','wssPort','downloadOmnichannelInteractions','use','ChatInteraction','findOne','params','closed'];(function(_0x553d33,_0x56c9e0){var _0x1743f2=function(_0x5dc7bb){while(--_0x5dc7bb){_0x553d33['push'](_0x553d33['shift']());}};_0x1743f2(++_0x56c9e0);}(_0xa3f3,0x1ab));var _0x3a3f=function(_0x22835e,_0x14ffec){_0x22835e=_0x22835e-0x0;var _0xb85ef9=_0xa3f3[_0x22835e];return _0xb85ef9;};'use strict';var db=require(_0x3a3f('0x0'))['db'];var config=require(_0x3a3f('0x1'));var hardwareConf=require(_0x3a3f('0x2'));var licenseUtil=require(_0x3a3f('0x3'));var encryptor=require('../encryptor');var _=require(_0x3a3f('0x4'));var jwt=require(_0x3a3f('0x5'));var expressJwt=require(_0x3a3f('0x6'));var compose=require(_0x3a3f('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x3a3f('0x8'));var BPromise=require(_0x3a3f('0x9'));var util=require('util');var moment=require(_0x3a3f('0xa'));var validateJwt=expressJwt({'secret':config[_0x3a3f('0xb')][_0x3a3f('0xc')]});var userAttributes=['id',_0x3a3f('0xd'),_0x3a3f('0xe'),_0x3a3f('0xf'),_0x3a3f('0x10'),_0x3a3f('0x11'),_0x3a3f('0x12'),_0x3a3f('0x13'),_0x3a3f('0x14'),_0x3a3f('0x15'),_0x3a3f('0x16'),'mailPause',_0x3a3f('0x17'),_0x3a3f('0x18'),'openchannelPause',_0x3a3f('0x19'),_0x3a3f('0x1a'),'lastLoginAt',_0x3a3f('0x1b'),'crudPermissions','allowmessenger',_0x3a3f('0x1c'),_0x3a3f('0x1d'),_0x3a3f('0x1e'),_0x3a3f('0x1f'),_0x3a3f('0x20'),_0x3a3f('0x21'),_0x3a3f('0x22'),'phoneBarEnableSettings',_0x3a3f('0x23'),_0x3a3f('0x24'),_0x3a3f('0x25'),_0x3a3f('0x26'),_0x3a3f('0x27'),_0x3a3f('0x28'),'userProfileId',_0x3a3f('0x29'),'settingsEnabled',_0x3a3f('0x2a'),'downloadVoiceRecordings',_0x3a3f('0x2b'),'downloadAttachments'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x3a3f('0x2c')](function(_0x4b7b61,_0x140fd8,_0x5ef2ac){if(_0x4b7b61['user']){_0x5ef2ac();}else{return db[_0x3a3f('0x2d')][_0x3a3f('0x2e')]({'where':{'id':_0x4b7b61[_0x3a3f('0x2f')]['id']},'attributes':['id',_0x3a3f('0x30'),_0x3a3f('0x31')],'raw':!![]})['then'](function(_0x41725c){if(_0x41725c&&_0x41725c[_0x3a3f('0x30')]){return _0x140fd8[_0x3a3f('0x32')](_0x41725c[_0x3a3f('0x31')]==='unmanaged'?0x195:0x193)[_0x3a3f('0x33')]({'message':_0x41725c[_0x3a3f('0x31')]===_0x3a3f('0x34')?_0x3a3f('0x35'):_0x3a3f('0x36')});}else{_0x5ef2ac();}})['catch'](function(_0x3085fc){_0x5ef2ac(_0x3085fc);});}});};exports['isAuthenticated']=function isAuthenticated(_0x435f3b){return compose()[_0x3a3f('0x2c')](function(_0x10d7ee,_0x5d2cb2,_0x101374){var _0x5a4da9;if(_0x10d7ee['headers'][_0x3a3f('0x37')]){if(_['startsWith'](_0x10d7ee[_0x3a3f('0x38')][_0x3a3f('0x37')],_0x3a3f('0x39'))){var _0xbd7279=basicAuth(_0x10d7ee);db['User'][_0x3a3f('0x3a')]({'where':{'name':_0xbd7279[_0x3a3f('0xf')]}})[_0x3a3f('0x3b')](function(_0xc5b27e){if(!_0xc5b27e||!_0xc5b27e['authenticate'](_0xbd7279['pass'])){return _0x5d2cb2[_0x3a3f('0x32')](0x191)[_0x3a3f('0x33')]({'message':'Wrong\x20credentials.'});}_0x10d7ee[_0x3a3f('0x3c')]={'id':_0xc5b27e['id']};_0x101374();})['catch'](function(_0x1062a1){_0x101374(_0x1062a1);});}else if(_[_0x3a3f('0x3d')](_0x10d7ee[_0x3a3f('0x38')]['authorization'],_0x3a3f('0x3e'))){validateJwt(_0x10d7ee,_0x5d2cb2,_0x101374);}else{if(_0x435f3b){_0x101374();}else{return _0x5d2cb2[_0x3a3f('0x32')](0x193)[_0x3a3f('0x33')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x10d7ee[_0x3a3f('0x3f')][_0x3a3f('0x40')]){try{var _0x38f925={'audience':hardwareConf[_0x3a3f('0x41')](),'issuer':hardwareConf[_0x3a3f('0x41')]()};verifyJwt(_0x10d7ee[_0x3a3f('0x3f')][_0x3a3f('0x40')],_0x38f925)['then'](function(_0x177dd6){return db[_0x3a3f('0x42')][_0x3a3f('0x3a')]({'where':{'id':_0x177dd6[_0x3a3f('0x43')]}})[_0x3a3f('0x3b')](function(_0x5a8ddb){_0x5a4da9=_0x5a8ddb;return db[_0x3a3f('0x44')][_0x3a3f('0x2e')]({'where':{'id':0x1},'attributes':[_0x3a3f('0x45'),'blockDuration'],'raw':!![]});})['then'](function(_0x11ff7e){if(!_0x5a4da9||!_['isEqual'](_0x5a4da9['apiKeyNonce'],_0x177dd6[_0x3a3f('0x46')])){return _0x5d2cb2[_0x3a3f('0x32')](0x191)[_0x3a3f('0x33')]({'message':_0x3a3f('0x47')});}if(_0x5a4da9[_0x3a3f('0x48')]){return _0x5d2cb2[_0x3a3f('0x32')](0x191)['json']({'message':_0x3a3f('0x49')});}if(_0x5a4da9['blocked']){if(_0x11ff7e['blockDuration']>0x0){if(moment(_0x5a4da9['blockedAt'])[_0x3a3f('0x4a')](_0x11ff7e[_0x3a3f('0x4b')],_0x3a3f('0x4c'))>moment()){return _0x5d2cb2[_0x3a3f('0x32')](0x191)[_0x3a3f('0x33')]({'message':_0x3a3f('0x49')});}}else{return _0x5d2cb2[_0x3a3f('0x32')](0x191)['json']({'message':_0x3a3f('0x49')});}}_0x10d7ee['user']={'id':_0x5a4da9['id']};_0x101374();});})[_0x3a3f('0x4d')](function(){return _0x5d2cb2[_0x3a3f('0x32')](0x191)[_0x3a3f('0x33')]({'message':_0x3a3f('0x49')});});}catch(_0x36f202){_0x101374(_0x36f202);}}else if(_0x435f3b){_0x101374();}else{return _0x5d2cb2[_0x3a3f('0x32')](0x193)[_0x3a3f('0x33')]({'message':_0x3a3f('0x4e')});}})[_0x3a3f('0x2c')](function(_0x441b03,_0x177687,_0x59af3b){if(_0x441b03[_0x3a3f('0x3c')]){db[_0x3a3f('0x42')][_0x3a3f('0x3a')]({'where':{'id':_0x441b03[_0x3a3f('0x3c')]['id']},'attributes':userAttributes})[_0x3a3f('0x3b')](function(_0x1d9c3a){if(!_0x1d9c3a){return _0x177687[_0x3a3f('0x32')](0x194)['json']({'message':_0x3a3f('0x4f')});}_0x441b03[_0x3a3f('0x3c')]=_0x1d9c3a;_0x59af3b();})['catch'](function(_0x140d10){_0x59af3b(_0x140d10);});}else if(_0x435f3b){_0x59af3b();}else{return _0x177687['status'](0x194)[_0x3a3f('0x33')]({'message':_0x3a3f('0x50')});}});};exports[_0x3a3f('0x51')]=function canUpdate(){return compose()[_0x3a3f('0x2c')](function(_0x3c5649,_0x125b57,_0x5829dd){return licenseUtil[_0x3a3f('0x52')]()[_0x3a3f('0x3b')](function(_0x140866){if(_0x140866['update']){_0x5829dd();}else{return _0x125b57['status'](0x193)['json']({'message':_0x3a3f('0x53')});}})[_0x3a3f('0x4d')](function(_0x29b3dc){_0x5829dd(_0x29b3dc);});});};exports[_0x3a3f('0x54')]=function(_0x52b63c,_0x345355,_0x1318fd){_0x52b63c[_0x3a3f('0x54')]=!![];return _0x1318fd();};exports[_0x3a3f('0x55')]=function signToken(_0x180ea4){return signJwt(_0x180ea4);};exports['setTokenCookie']=function(_0x2bcb4f,_0x3e6036){if(!_0x2bcb4f[_0x3a3f('0x3c')]){return _0x3e6036['status'](0x194)[_0x3a3f('0x33')]({'message':_0x3a3f('0x56')});}var _0x205698={'payload':{'id':_0x2bcb4f[_0x3a3f('0x3c')]['id'],'role':_0x2bcb4f['user'][_0x3a3f('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x205698)[_0x3a3f('0x3b')](function(_0x576da3){_0x3e6036['cookie']('motion.token',_0x576da3);_0x3e6036[_0x3a3f('0x57')]('/dashboards/general');})[_0x3a3f('0x4d')](function(_0x191d08){return _0x3e6036[_0x3a3f('0x32')](0x1f4)['send'](_0x191d08);});};exports['retrieveApiKey']=function(_0x17bcf5){if(_[_0x3a3f('0x58')](_0x17bcf5[_0x3a3f('0x59')])||_[_0x3a3f('0x58')](_0x17bcf5[_0x3a3f('0x5a')])){return null;}else{return createJwt(_0x17bcf5);}};exports[_0x3a3f('0x5b')]=function(_0x494135){_0x494135[_0x3a3f('0x59')]=generateNonce();_0x494135[_0x3a3f('0x5a')]=generateIssuedAt();return createJwt(_0x494135);};exports[_0x3a3f('0x5c')]=function(_0x4ad2e8,_0x79b463){var _0x497891=_0x4ad2e8['query'][_0x3a3f('0x40')];if(_0x497891){var _0x696e0={'nonce':_0x79b463['apiKeyNonce'],'iat':_0x79b463['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x3a3f('0x41')]()};return verifyJwt(_0x497891,_0x696e0)[_0x3a3f('0x3b')](function(){return generateApiKey(_0x79b463);});}else{throw{'message':_0x3a3f('0x5d')};}};exports[_0x3a3f('0x5e')]=function(_0x22b986){var _0x490d4e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x490d4e['test'](_0x22b986))throw new db['Sequelize'][(_0x3a3f('0x5f'))](_0x3a3f('0x60'));return;};exports[_0x3a3f('0x61')]=function(_0x501d2e,_0x15617d,_0x389873){var _0x4b36f4=encryptor[_0x3a3f('0x62')](_0x15617d)[_0x3a3f('0x63')](',');for(var _0x298fbc=0x0;_0x298fbc<_0x389873;_0x298fbc++){if(!_0x4b36f4[_0x298fbc])break;if(_0x501d2e['toLowerCase']()===_0x4b36f4[_0x298fbc][_0x3a3f('0x64')]()){var _0x2c4f1f=util[_0x3a3f('0x65')](_0x3a3f('0x66'),_0x389873);if(_0x389873===0x1){_0x2c4f1f=_0x3a3f('0x67');}throw new db[(_0x3a3f('0x68'))][(_0x3a3f('0x5f'))](_0x2c4f1f);}}return;};exports[_0x3a3f('0x69')]=function(_0x5209bb,_0x1b0804){var _0xaa6ad8=_0x1b0804?encryptor['decryptString'](_0x1b0804)[_0x3a3f('0x63')](','):[];if(_0xaa6ad8[_0x3a3f('0x6a')]===0x5){_0xaa6ad8['splice'](-0x1,0x1);}_0xaa6ad8[_0x3a3f('0x6b')](_0x5209bb);return encryptor[_0x3a3f('0x6c')](_0xaa6ad8[_0x3a3f('0x6d')](','));};function signJwt(_0x29e9c9){var _0xe78b25=BPromise[_0x3a3f('0x6e')](jwt[_0x3a3f('0x6f')],{'context':jwt});var _0x162987=_0x29e9c9['secret']||config[_0x3a3f('0xb')][_0x3a3f('0xc')];return new BPromise(function(_0x40dd02,_0x3384f6){_0xe78b25(_0x29e9c9[_0x3a3f('0x70')],_0x162987,_0x29e9c9[_0x3a3f('0x71')])['then'](function(_0x4c3e0c){_0x40dd02(_0x4c3e0c);})['catch'](function(_0xd3048b){_0x3384f6(_0xd3048b);});});}function verifyJwt(_0x3bc4a5,_0x4a4a43,_0x3b488f){var _0x189e4e=BPromise[_0x3a3f('0x6e')](jwt['verify'],{'context':jwt});var _0x3a1e04=_0x3b488f||config[_0x3a3f('0xb')]['session'];return new BPromise(function(_0x3c493a,_0x5a5708){_0x189e4e(_0x3bc4a5,_0x3a1e04,_0x4a4a43)[_0x3a3f('0x3b')](function(_0x302f2f){_0x3c493a(_0x302f2f);})[_0x3a3f('0x4d')](function(_0x2ec395){_0x5a5708(_0x2ec395);});});}function generateNonce(){return crypto[_0x3a3f('0x72')](0x10)[_0x3a3f('0x73')]('hex');}function generateIssuedAt(){return Math[_0x3a3f('0x74')](Date[_0x3a3f('0x75')]()/0x3e8)[_0x3a3f('0x73')]();}function createJwt(_0xd1db62){var _0xd4d5d3={'payload':{'iat':_0xd1db62[_0x3a3f('0x5a')],'nonce':_0xd1db62[_0x3a3f('0x59')]},'options':{'algorithm':_0x3a3f('0x76'),'subject':_0xd1db62['id']['toString'](),'issuer':hardwareConf[_0x3a3f('0x41')](),'audience':hardwareConf[_0x3a3f('0x41')]()}};return signJwt(_0xd4d5d3)[_0x3a3f('0x3b')](function(_0x5d2279){return{'iat':_0xd1db62[_0x3a3f('0x5a')],'nonce':_0xd1db62[_0x3a3f('0x59')],'token':_0x5d2279};});} \ No newline at end of file +var _0x74d6=['add','minutes','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','isNil','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','unshift','join','promisify','sign','secret','payload','verify','session','randomBytes','hex','floor','toString','apiKeyIat','HS512','../../mysqldb','../../config/environment','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','Bearer','query','apikey','getUuid','then','sub','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt'];(function(_0xd59d96,_0x310864){var _0x5c18d3=function(_0x49f976){while(--_0x49f976){_0xd59d96['push'](_0xd59d96['shift']());}};_0x5c18d3(++_0x310864);}(_0x74d6,0xaf));var _0x674d=function(_0x283b55,_0x279bee){_0x283b55=_0x283b55-0x0;var _0x192e58=_0x74d6[_0x283b55];return _0x192e58;};'use strict';var db=require(_0x674d('0x0'))['db'];var config=require(_0x674d('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x674d('0x2'));var _=require(_0x674d('0x3'));var jwt=require(_0x674d('0x4'));var expressJwt=require(_0x674d('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x674d('0x6'));var crypto=require(_0x674d('0x7'));var BPromise=require(_0x674d('0x8'));var util=require(_0x674d('0x9'));var moment=require(_0x674d('0xa'));var validateJwt=expressJwt({'secret':config[_0x674d('0xb')]['session']});var userAttributes=['id','role',_0x674d('0xc'),_0x674d('0xd'),_0x674d('0xe'),_0x674d('0xf'),_0x674d('0x10'),_0x674d('0x11'),'md5secret','voicePause',_0x674d('0x12'),_0x674d('0x13'),_0x674d('0x14'),'smsPause','openchannelPause',_0x674d('0x15'),_0x674d('0x16'),_0x674d('0x17'),_0x674d('0x18'),_0x674d('0x19'),_0x674d('0x1a'),'passwordResetAt',_0x674d('0x1b'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd',_0x674d('0x1c'),_0x674d('0x1d'),_0x674d('0x1e'),_0x674d('0x1f'),_0x674d('0x20'),_0x674d('0x21'),_0x674d('0x22'),'hotdesk',_0x674d('0x23'),_0x674d('0x24'),_0x674d('0x25'),_0x674d('0x26'),_0x674d('0x27'),_0x674d('0x28'),'downloadOmnichannelInteractions',_0x674d('0x29')];exports[_0x674d('0x2a')]=function(){return this[_0x674d('0x2b')](!![])[_0x674d('0x2c')](function(_0x4f2407,_0x191bae,_0x3409ac){if(_0x4f2407[_0x674d('0x2d')]){_0x3409ac();}else{return db[_0x674d('0x2e')]['findOne']({'where':{'id':_0x4f2407[_0x674d('0x2f')]['id']},'attributes':['id',_0x674d('0x30'),'disposition'],'raw':!![]})['then'](function(_0x401362){if(_0x401362&&_0x401362[_0x674d('0x30')]){return _0x191bae[_0x674d('0x31')](_0x401362[_0x674d('0x32')]===_0x674d('0x33')?0x195:0x193)[_0x674d('0x34')]({'message':_0x401362[_0x674d('0x32')]==='unmanaged'?_0x674d('0x35'):_0x674d('0x36')});}else{_0x3409ac();}})[_0x674d('0x37')](function(_0x4906a9){_0x3409ac(_0x4906a9);});}});};exports['isAuthenticated']=function isAuthenticated(_0x89a8d1){return compose()['use'](function(_0x12335c,_0x356bf2,_0x2b8c66){var _0x1674c6;if(_0x12335c[_0x674d('0x38')][_0x674d('0x39')]){if(_[_0x674d('0x3a')](_0x12335c['headers']['authorization'],_0x674d('0x3b'))){var _0x33bca7=basicAuth(_0x12335c);db[_0x674d('0x3c')][_0x674d('0x3d')]({'where':{'name':_0x33bca7[_0x674d('0xd')]}})['then'](function(_0x17c158){if(!_0x17c158||!_0x17c158[_0x674d('0x3e')](_0x33bca7[_0x674d('0x3f')])){return _0x356bf2[_0x674d('0x31')](0x191)['json']({'message':_0x674d('0x40')});}_0x12335c[_0x674d('0x2d')]={'id':_0x17c158['id']};_0x2b8c66();})[_0x674d('0x37')](function(_0x2eaabc){_0x2b8c66(_0x2eaabc);});}else if(_[_0x674d('0x3a')](_0x12335c[_0x674d('0x38')]['authorization'],_0x674d('0x41'))){validateJwt(_0x12335c,_0x356bf2,_0x2b8c66);}else{if(_0x89a8d1){_0x2b8c66();}else{return _0x356bf2[_0x674d('0x31')](0x193)[_0x674d('0x34')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x12335c[_0x674d('0x42')][_0x674d('0x43')]){try{var _0x1047f1={'audience':hardwareConf[_0x674d('0x44')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x12335c[_0x674d('0x42')][_0x674d('0x43')],_0x1047f1)[_0x674d('0x45')](function(_0x229979){return db[_0x674d('0x3c')]['find']({'where':{'id':_0x229979[_0x674d('0x46')]}})['then'](function(_0x2c7fc3){_0x1674c6=_0x2c7fc3;return db['Setting'][_0x674d('0x47')]({'where':{'id':0x1},'attributes':[_0x674d('0x48'),_0x674d('0x49')],'raw':!![]});})[_0x674d('0x45')](function(_0x2c1243){if(!_0x1674c6||!_[_0x674d('0x4a')](_0x1674c6[_0x674d('0x4b')],_0x229979[_0x674d('0x4c')])){return _0x356bf2[_0x674d('0x31')](0x191)['json']({'message':_0x674d('0x4d')});}if(_0x1674c6[_0x674d('0x4e')]){return _0x356bf2['status'](0x191)[_0x674d('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1674c6[_0x674d('0x4f')]){if(_0x2c1243['blockDuration']>0x0){if(moment(_0x1674c6[_0x674d('0x50')])[_0x674d('0x51')](_0x2c1243[_0x674d('0x49')],_0x674d('0x52'))>moment()){return _0x356bf2[_0x674d('0x31')](0x191)[_0x674d('0x34')]({'message':_0x674d('0x53')});}}else{return _0x356bf2['status'](0x191)[_0x674d('0x34')]({'message':_0x674d('0x53')});}}_0x12335c[_0x674d('0x2d')]={'id':_0x1674c6['id']};_0x2b8c66();});})['catch'](function(){return _0x356bf2[_0x674d('0x31')](0x191)[_0x674d('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x119c0c){_0x2b8c66(_0x119c0c);}}else if(_0x89a8d1){_0x2b8c66();}else{return _0x356bf2['status'](0x193)[_0x674d('0x34')]({'message':_0x674d('0x54')});}})[_0x674d('0x2c')](function(_0x228d96,_0x31cedb,_0x1639e7){if(_0x228d96[_0x674d('0x2d')]){db[_0x674d('0x3c')][_0x674d('0x3d')]({'where':{'id':_0x228d96[_0x674d('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0x31009f){if(!_0x31009f){return _0x31cedb[_0x674d('0x31')](0x194)[_0x674d('0x34')]({'message':'User\x20not\x20found.'});}_0x228d96[_0x674d('0x2d')]=_0x31009f;_0x1639e7();})[_0x674d('0x37')](function(_0x1fb312){_0x1639e7(_0x1fb312);});}else if(_0x89a8d1){_0x1639e7();}else{return _0x31cedb['status'](0x194)[_0x674d('0x34')]({'message':_0x674d('0x55')});}});};exports[_0x674d('0x56')]=function canUpdate(){return compose()['use'](function(_0x12b88b,_0x30edb8,_0x27b345){return licenseUtil['getLicense']()['then'](function(_0x45b627){if(_0x45b627[_0x674d('0x57')]){_0x27b345();}else{return _0x30edb8['status'](0x193)[_0x674d('0x34')]({'message':_0x674d('0x58')});}})[_0x674d('0x37')](function(_0x57751a){_0x27b345(_0x57751a);});});};exports[_0x674d('0x59')]=function(_0x73f952,_0xa0b5e0,_0x329052){_0x73f952['isMiddleware']=!![];return _0x329052();};exports[_0x674d('0x5a')]=function signToken(_0x2155b2){return signJwt(_0x2155b2);};exports['setTokenCookie']=function(_0x27785c,_0x181af8){if(!_0x27785c['user']){return _0x181af8[_0x674d('0x31')](0x194)[_0x674d('0x34')]({'message':_0x674d('0x5b')});}var _0x599e36={'payload':{'id':_0x27785c[_0x674d('0x2d')]['id'],'role':_0x27785c[_0x674d('0x2d')][_0x674d('0x5c')]},'options':{'expiresIn':0x15180}};return signJwt(_0x599e36)[_0x674d('0x45')](function(_0x4c219b){_0x181af8[_0x674d('0x5d')](_0x674d('0x5e'),_0x4c219b);_0x181af8[_0x674d('0x5f')](_0x674d('0x60'));})[_0x674d('0x37')](function(_0x40061c){return _0x181af8[_0x674d('0x31')](0x1f4)['send'](_0x40061c);});};exports['retrieveApiKey']=function(_0x120f89){if(_[_0x674d('0x61')](_0x120f89['apiKeyNonce'])||_['isNil'](_0x120f89['apiKeyIat'])){return null;}else{return createJwt(_0x120f89);}};exports[_0x674d('0x62')]=function(_0xcf0609){_0xcf0609['apiKeyNonce']=generateNonce();_0xcf0609['apiKeyIat']=generateIssuedAt();return createJwt(_0xcf0609);};exports[_0x674d('0x63')]=function(_0xc6ad1b,_0x6547df){var _0x5c3c8a=_0xc6ad1b[_0x674d('0x42')][_0x674d('0x43')];if(_0x5c3c8a){var _0x38de34={'nonce':_0x6547df[_0x674d('0x4b')],'iat':_0x6547df['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x5c3c8a,_0x38de34)['then'](function(){return generateApiKey(_0x6547df);});}else{throw{'message':_0x674d('0x64')};}};exports[_0x674d('0x65')]=function(_0x22ed91){var _0xf543c6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf543c6['test'](_0x22ed91))throw new db[(_0x674d('0x66'))][(_0x674d('0x67'))](_0x674d('0x68'));return;};exports[_0x674d('0x69')]=function(_0x470309,_0x5f03de,_0x2efccd){var _0x465d9b=encryptor[_0x674d('0x6a')](_0x5f03de)['split'](',');for(var _0x354907=0x0;_0x354907<_0x2efccd;_0x354907++){if(!_0x465d9b[_0x354907])break;if(_0x470309[_0x674d('0x6b')]()===_0x465d9b[_0x354907][_0x674d('0x6b')]()){var _0x468393=util[_0x674d('0x6c')](_0x674d('0x6d'),_0x2efccd);if(_0x2efccd===0x1){_0x468393=_0x674d('0x6e');}throw new db['Sequelize'][(_0x674d('0x67'))](_0x468393);}}return;};exports[_0x674d('0x6f')]=function(_0x424b22,_0x2d0889){var _0x5e07a2=_0x2d0889?encryptor[_0x674d('0x6a')](_0x2d0889)[_0x674d('0x70')](','):[];if(_0x5e07a2[_0x674d('0x71')]===0x5){_0x5e07a2['splice'](-0x1,0x1);}_0x5e07a2[_0x674d('0x72')](_0x424b22);return encryptor['encryptString'](_0x5e07a2[_0x674d('0x73')](','));};function signJwt(_0x5e8563){var _0x4e484a=BPromise[_0x674d('0x74')](jwt[_0x674d('0x75')],{'context':jwt});var _0x2b448c=_0x5e8563[_0x674d('0x76')]||config[_0x674d('0xb')]['session'];return new BPromise(function(_0x27547a,_0x5da447){_0x4e484a(_0x5e8563[_0x674d('0x77')],_0x2b448c,_0x5e8563['options'])['then'](function(_0x5d6695){_0x27547a(_0x5d6695);})[_0x674d('0x37')](function(_0x284878){_0x5da447(_0x284878);});});}function verifyJwt(_0x2be81d,_0x47cb61,_0x1df510){var _0x46b5c4=BPromise[_0x674d('0x74')](jwt[_0x674d('0x78')],{'context':jwt});var _0x377467=_0x1df510||config[_0x674d('0xb')][_0x674d('0x79')];return new BPromise(function(_0x162867,_0x5bd87a){_0x46b5c4(_0x2be81d,_0x377467,_0x47cb61)[_0x674d('0x45')](function(_0x3387d4){_0x162867(_0x3387d4);})[_0x674d('0x37')](function(_0x5672e2){_0x5bd87a(_0x5672e2);});});}function generateNonce(){return crypto[_0x674d('0x7a')](0x10)['toString'](_0x674d('0x7b'));}function generateIssuedAt(){return Math[_0x674d('0x7c')](Date['now']()/0x3e8)[_0x674d('0x7d')]();}function createJwt(_0x27a9dd){var _0xe995b1={'payload':{'iat':_0x27a9dd[_0x674d('0x7e')],'nonce':_0x27a9dd[_0x674d('0x4b')]},'options':{'algorithm':_0x674d('0x7f'),'subject':_0x27a9dd['id'][_0x674d('0x7d')](),'issuer':hardwareConf[_0x674d('0x44')](),'audience':hardwareConf[_0x674d('0x44')]()}};return signJwt(_0xe995b1)[_0x674d('0x45')](function(_0x4986ab){return{'iat':_0x27a9dd[_0x674d('0x7e')],'nonce':_0x27a9dd['apiKeyNonce'],'token':_0x4986ab};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 5509a38..4098a00 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 _0x19d2=['write','end','binary','close','unlink','decryptFile','createDecipher','data','final','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','../../config/environment','../../config/logger','app','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x19d2,0x1d6));var _0x219d=function(_0xfdd7df,_0x419e66){_0xfdd7df=_0xfdd7df-0x0;var _0xca5a7c=_0x19d2[_0xfdd7df];return _0xca5a7c;};'use strict';var crypto=require(_0x219d('0x0'));var fs=require('fs');var BPromise=require(_0x219d('0x1'));var _=require('lodash');var config=require(_0x219d('0x2'));var logger=require(_0x219d('0x3'))(_0x219d('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x219d('0x5')};const fileOptions={'algorithm':_0x219d('0x6')};if(config['encrypt']&&config[_0x219d('0x7')][_0x219d('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x219d('0x8')]);if(isSupported){fileOptions[_0x219d('0x8')]=config[_0x219d('0x7')][_0x219d('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x219d('0x9')](',\x20');logger[_0x219d('0xa')](config['encrypt']['algorithm'],_0x219d('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x32e860){return AES_SUPPORTED_RX[_0x219d('0xc')](_0x32e860);}function getSupportedCiphers(){return crypto[_0x219d('0xd')]()[_0x219d('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x33e40f){return getSupportedCiphers()['indexOf'](_0x33e40f)>-0x1;}function combineOptions(_0x588cfc){var _0x393d7={};for(var _0x3b65bd in fileOptions){if(fileOptions[_0x219d('0xf')](_0x3b65bd)){_0x393d7[_0x3b65bd]=fileOptions[_0x3b65bd];}}if(_0x588cfc){for(var _0x170da3 in _0x588cfc){if(_0x588cfc['hasOwnProperty'](_0x170da3)){_0x393d7[_0x170da3]=_0x588cfc[_0x170da3];}}}return _0x393d7;}exports[_0x219d('0x10')]=function(_0x306071,_0x134508,_0x3297ca,_0x4d89c1){return new BPromise(function(_0x49a3fa,_0x3e752b){_0x4d89c1=combineOptions(_0x4d89c1);var _0x635b31=new Buffer(_0x3297ca);var _0x2b1eec=fs[_0x219d('0x11')](_0x306071);var _0x14e522=fs[_0x219d('0x12')](_0x134508);var _0x540e90=crypto['createCipher'](_0x4d89c1['algorithm'],_0x635b31);_0x2b1eec['on']('data',function(_0x1c1bfd){var _0x1401d4=new Buffer(_0x540e90[_0x219d('0x13')](_0x1c1bfd),'binary');_0x14e522[_0x219d('0x14')](_0x1401d4);});_0x2b1eec['on'](_0x219d('0x15'),function(){try{var _0x2abb37=new Buffer(_0x540e90['final'](_0x219d('0x16')),'binary');_0x14e522['write'](_0x2abb37);_0x14e522['end']();_0x14e522['on'](_0x219d('0x17'),function(){return _0x49a3fa(_0x134508);});}catch(_0x18c045){fs[_0x219d('0x18')](_0x134508);return _0x3e752b(_0x18c045);}});});};exports[_0x219d('0x19')]=function(_0x3b5cd7,_0x53b750,_0x1a1012,_0x1aab35){return new BPromise(function(_0x4da18b,_0x4f6aa7){_0x1aab35=combineOptions(_0x1aab35);var _0x1aba68=new Buffer(_0x1a1012);var _0x505faf=fs[_0x219d('0x11')](_0x3b5cd7);var _0xec430f=fs[_0x219d('0x12')](_0x53b750);var _0x30579d=crypto[_0x219d('0x1a')](_0x1aab35[_0x219d('0x8')],_0x1aba68);_0x505faf['on'](_0x219d('0x1b'),function(_0x3d09dd){var _0x8ac2b=new Buffer(_0x30579d[_0x219d('0x13')](_0x3d09dd),_0x219d('0x16'));_0xec430f[_0x219d('0x14')](_0x8ac2b);});_0x505faf['on']('end',function(){try{var _0x207993=new Buffer(_0x30579d[_0x219d('0x1c')](_0x219d('0x16')),_0x219d('0x16'));_0xec430f[_0x219d('0x14')](_0x207993);_0xec430f['end']();_0xec430f['on'](_0x219d('0x17'),function(){return _0x4da18b(_0x53b750);});}catch(_0x102c7b){fs[_0x219d('0x18')](_0x53b750);return _0x4f6aa7(_0x102c7b);}});});};exports[_0x219d('0x1d')]=function(_0x2596cd,_0x52efad,_0x7a276f){var _0x32b5d4=_0x7a276f||stringOptions[_0x219d('0x8')];var _0x2bb56b=_0x52efad||stringOptions[_0x219d('0x1e')];var _0x1ad137=crypto[_0x219d('0x1f')](_0x32b5d4,_0x2bb56b);var _0xfcc205=_0x1ad137[_0x219d('0x13')](_0x2596cd,_0x219d('0x20'),'base64');_0xfcc205+=_0x1ad137[_0x219d('0x1c')](_0x219d('0x21'));return _0xfcc205;};exports[_0x219d('0x22')]=function(_0x489d67,_0x4c5987,_0x5e4ee9){var _0x2645a6=_0x5e4ee9||stringOptions[_0x219d('0x8')];var _0x44024e=_0x4c5987||stringOptions[_0x219d('0x1e')];var _0x4f4e52=crypto[_0x219d('0x1a')](_0x2645a6,_0x44024e);var _0x2ac74e=_0x4f4e52['update'](_0x489d67,_0x219d('0x21'),_0x219d('0x20'));_0x2ac74e+=_0x4f4e52['final']('utf8');return _0x2ac74e;}; \ No newline at end of file +var _0xb64a=['secrets','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','final','bluebird','lodash','../../config/environment','../../config/logger','app'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb64a,0xf0));var _0xab64=function(_0x5d3de4,_0x1da281){_0x5d3de4=_0x5d3de4-0x0;var _0x10d032=_0xb64a[_0x5d3de4];return _0x10d032;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xab64('0x0'));var _=require(_0xab64('0x1'));var config=require(_0xab64('0x2'));var logger=require(_0xab64('0x3'))(_0xab64('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xab64('0x5')]['session'],'algorithm':_0xab64('0x6')};const fileOptions={'algorithm':_0xab64('0x7')};if(config[_0xab64('0x8')]&&config[_0xab64('0x8')][_0xab64('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xab64('0x9')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0xab64('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xab64('0xa')](',\x20');logger['error'](config[_0xab64('0x8')][_0xab64('0x9')],_0xab64('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x399233){return AES_SUPPORTED_RX[_0xab64('0xc')](_0x399233);}function getSupportedCiphers(){return crypto[_0xab64('0xd')]()[_0xab64('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x236b91){return getSupportedCiphers()[_0xab64('0xf')](_0x236b91)>-0x1;}function combineOptions(_0x418bb1){var _0x1e8e69={};for(var _0x524cf6 in fileOptions){if(fileOptions[_0xab64('0x10')](_0x524cf6)){_0x1e8e69[_0x524cf6]=fileOptions[_0x524cf6];}}if(_0x418bb1){for(var _0x3ce280 in _0x418bb1){if(_0x418bb1[_0xab64('0x10')](_0x3ce280)){_0x1e8e69[_0x3ce280]=_0x418bb1[_0x3ce280];}}}return _0x1e8e69;}exports[_0xab64('0x11')]=function(_0x12313e,_0x3af153,_0x856b53,_0x188304){return new BPromise(function(_0x39ad63,_0x44fdb3){_0x188304=combineOptions(_0x188304);var _0x2f0414=new Buffer(_0x856b53);var _0x536464=fs[_0xab64('0x12')](_0x12313e);var _0x289114=fs[_0xab64('0x13')](_0x3af153);var _0x218909=crypto[_0xab64('0x14')](_0x188304[_0xab64('0x9')],_0x2f0414);_0x536464['on'](_0xab64('0x15'),function(_0x13b324){var _0x586244=new Buffer(_0x218909[_0xab64('0x16')](_0x13b324),_0xab64('0x17'));_0x289114[_0xab64('0x18')](_0x586244);});_0x536464['on'](_0xab64('0x19'),function(){try{var _0x1f8187=new Buffer(_0x218909['final'](_0xab64('0x17')),_0xab64('0x17'));_0x289114['write'](_0x1f8187);_0x289114[_0xab64('0x19')]();_0x289114['on'](_0xab64('0x1a'),function(){return _0x39ad63(_0x3af153);});}catch(_0x40f2cc){fs[_0xab64('0x1b')](_0x3af153);return _0x44fdb3(_0x40f2cc);}});});};exports[_0xab64('0x1c')]=function(_0xe19ea6,_0xaf9138,_0x330680,_0x461095){return new BPromise(function(_0xb4b5e4,_0x1c64f6){_0x461095=combineOptions(_0x461095);var _0x1f2c30=new Buffer(_0x330680);var _0x45fbbc=fs[_0xab64('0x12')](_0xe19ea6);var _0x39212d=fs[_0xab64('0x13')](_0xaf9138);var _0x463269=crypto[_0xab64('0x1d')](_0x461095[_0xab64('0x9')],_0x1f2c30);_0x45fbbc['on'](_0xab64('0x15'),function(_0x1e7e5b){var _0x2c6ef5=new Buffer(_0x463269[_0xab64('0x16')](_0x1e7e5b),'binary');_0x39212d[_0xab64('0x18')](_0x2c6ef5);});_0x45fbbc['on'](_0xab64('0x19'),function(){try{var _0x594570=new Buffer(_0x463269['final'](_0xab64('0x17')),'binary');_0x39212d['write'](_0x594570);_0x39212d[_0xab64('0x19')]();_0x39212d['on']('close',function(){return _0xb4b5e4(_0xaf9138);});}catch(_0x17a871){fs[_0xab64('0x1b')](_0xaf9138);return _0x1c64f6(_0x17a871);}});});};exports[_0xab64('0x1e')]=function(_0x2bc9ea,_0x1d981f,_0x4c849d){var _0x6af4d9=_0x4c849d||stringOptions[_0xab64('0x9')];var _0x40fd68=_0x1d981f||stringOptions[_0xab64('0x1f')];var _0x2897f2=crypto[_0xab64('0x14')](_0x6af4d9,_0x40fd68);var _0xa7a679=_0x2897f2[_0xab64('0x16')](_0x2bc9ea,_0xab64('0x20'),_0xab64('0x21'));_0xa7a679+=_0x2897f2[_0xab64('0x22')](_0xab64('0x21'));return _0xa7a679;};exports['decryptString']=function(_0x48e274,_0x9135c7,_0x4a2b90){var _0x5a31d7=_0x4a2b90||stringOptions[_0xab64('0x9')];var _0x57a4e1=_0x9135c7||stringOptions[_0xab64('0x1f')];var _0x208236=crypto[_0xab64('0x1d')](_0x5a31d7,_0x57a4e1);var _0x396a6c=_0x208236[_0xab64('0x16')](_0x48e274,'base64',_0xab64('0x20'));_0x396a6c+=_0x208236[_0xab64('0x22')](_0xab64('0x20'));return _0x396a6c;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1da87b2..4cf43e7 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 _0xd8b0=['%s.%s','writeFileSync','zip','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','length','existsSync','join','mkdirSync','csv'];(function(_0x4391a1,_0x5046ce){var _0x171e36=function(_0x2785ca){while(--_0x2785ca){_0x4391a1['push'](_0x4391a1['shift']());}};_0x171e36(++_0x5046ce);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var path=require(_0x0d8b('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x0d8b('0x2'));var rimraf=require(_0x0d8b('0x3'));var db=require(_0x0d8b('0x4'))['db'];var dbH=require(_0x0d8b('0x4'))[_0x0d8b('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x6')][0x2]);var QUERY=process[_0x0d8b('0x6')][0x3];var PATH=process[_0x0d8b('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4a4470,_0x413284){var _0x284169={'status':_0x4a4470};var _0x58e4e2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x413284){_0x284169[_0x0d8b('0x7')]=_0x413284;}return db[_0x0d8b('0x8')][_0x0d8b('0x9')](_0x284169,_0x58e4e2);}function main(){var _0x1f4800=0x1388;var _0x28ff7f;logger[_0x0d8b('0xa')](util[_0x0d8b('0xb')](_0x0d8b('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x0d8b('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0xe'),_0x0d8b('0xf')]})[_0x0d8b('0x10')](function(_0x92cdd8){if(_0x92cdd8){_0x28ff7f=_0x92cdd8;_0x1f4800=_0x28ff7f[_0x0d8b('0xf')]||0x1388;}})[_0x0d8b('0x10')](function(){return dbH[_0x0d8b('0x11')][_0x0d8b('0x12')](util[_0x0d8b('0xb')](_0x0d8b('0x13'),QUERY),{'type':dbH[_0x0d8b('0x11')][_0x0d8b('0x14')][_0x0d8b('0x15')]});})[_0x0d8b('0x10')](function(_0x4f6f21){if(!_0x4f6f21[0x0][_0x0d8b('0x16')]){return analyticExtractedReport(_0x0d8b('0x17'));}var _0x17f7df=[];var _0xe2e167=0x0;var _0x2cb03c=!![];if(_0x4f6f21&&_0x4f6f21['length']){var _0x106a01=_0x4f6f21[0x0][_0x0d8b('0x16')]%(_0xe2e167+_0x1f4800);if(_0x28ff7f[_0x0d8b('0xe')]){for(;_0x2cb03c;_0xe2e167+=_0x1f4800,_0x106a01=_0x4f6f21[0x0][_0x0d8b('0x16')]%(_0xe2e167+_0x1f4800)){if(_0x106a01==0x0||_0x106a01==_0x4f6f21[0x0][_0x0d8b('0x16')]){_0x2cb03c=![];}_0x17f7df[_0x0d8b('0x18')](dbH[_0x0d8b('0x11')][_0x0d8b('0x12')](util['format'](_0x0d8b('0x19'),QUERY,_0x1f4800,_0xe2e167),{'type':dbH[_0x0d8b('0x11')][_0x0d8b('0x14')][_0x0d8b('0x15')]}));}}else{_0x17f7df[_0x0d8b('0x18')](dbH[_0x0d8b('0x11')][_0x0d8b('0x12')](QUERY,{'type':dbH[_0x0d8b('0x11')]['QueryTypes']['SELECT']}));}}var _0x33fb87=path['dirname'](PATH);var _0x56c729=path['basename'](PATH,_0x0d8b('0x1a'));var _0x2b924f=_0x28ff7f[_0x0d8b('0xe')]&&_0x17f7df[_0x0d8b('0x1b')]>0x1;var _0x221071=[];if(!fs[_0x0d8b('0x1c')](path[_0x0d8b('0x1d')](_0x33fb87,_0x56c729))&&_0x2b924f){fs[_0x0d8b('0x1e')](path[_0x0d8b('0x1d')](_0x33fb87,_0x56c729));}return BPromise['each'](_0x17f7df,function(_0xe8bbee){_0x221071[_0x0d8b('0x18')](_0xe8bbee);})['then'](function(){for(var _0xe1ef20=0x0;_0xe1ef20<_0x221071['length'];_0xe1ef20+=0x1){var _0x3dd149;var _0x234bdd=_0x221071[_0xe1ef20];if(_0x2b924f){_0x3dd149=path[_0x0d8b('0x1d')](_0x33fb87,_0x56c729,util['format']('%s%d.%s',_0x56c729,_0xe1ef20,_0x0d8b('0x1f')));}else{_0x3dd149=path[_0x0d8b('0x1d')](_0x33fb87,util['format'](_0x0d8b('0x20'),_0x56c729,'csv'));}fs[_0x0d8b('0x21')](_0x3dd149,csv(_0x234bdd));}})['then'](function(){if(_0x2b924f){zipdir(path[_0x0d8b('0x1d')](_0x33fb87,_0x56c729),{'saveTo':path['join'](_0x33fb87,util[_0x0d8b('0xb')]('%s.%s',_0x56c729,_0x0d8b('0x22')))},function(_0x544735,_0x3c8887){});rimraf(path[_0x0d8b('0x1d')](_0x33fb87,_0x56c729),function(){});}})[_0x0d8b('0x10')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x0d8b('0x23')));return analyticExtractedReport('Completed',_0x2b924f?util[_0x0d8b('0xb')]('%s.%s',_0x56c729,_0x2b924f?'zip':_0x0d8b('0x1f')):null);});})[_0x0d8b('0x24')](function(_0x109c14){logger[_0x0d8b('0xa')](util[_0x0d8b('0xb')](_0x0d8b('0x25'),EXTRACTED_REPORT_ID,_0x0d8b('0x23')),util[_0x0d8b('0x26')](_0x109c14,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0d8b('0x27')](function(){process[_0x0d8b('0x28')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x693f=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','%s%d.%s','%s.%s','csv','writeFileSync','zip','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','CSV','Setting','find','split','splitSizeCsv','then','query','QueryTypes','SELECT','num','length','push','sequelize'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xf693('0x0'));var path=require(_0xf693('0x1'));var _=require(_0xf693('0x2'));var csv=require(_0xf693('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xf693('0x4'));var rimraf=require(_0xf693('0x5'));var db=require(_0xf693('0x6'))['db'];var dbH=require(_0xf693('0x6'))[_0xf693('0x7')];var logger=require(_0xf693('0x8'))(_0xf693('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf693('0xa')][0x3];var PATH=process[_0xf693('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b91c5,_0x22f362){var _0x594505={'status':_0x5b91c5};var _0x38e78a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x22f362){_0x594505['savename']=_0x22f362;}return db[_0xf693('0xb')][_0xf693('0xc')](_0x594505,_0x38e78a);}function main(){var _0x48984a=0x1388;var _0x4b09d6;logger['info'](util[_0xf693('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf693('0xe')));return db[_0xf693('0xf')][_0xf693('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf693('0x11'),_0xf693('0x12')]})['then'](function(_0x5d0d4c){if(_0x5d0d4c){_0x4b09d6=_0x5d0d4c;_0x48984a=_0x4b09d6[_0xf693('0x12')]||0x1388;}})[_0xf693('0x13')](function(){return dbH['sequelize'][_0xf693('0x14')](util[_0xf693('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xf693('0x15')][_0xf693('0x16')]});})[_0xf693('0x13')](function(_0x208f32){if(!_0x208f32[0x0][_0xf693('0x17')]){return analyticExtractedReport('Empty');}var _0x1d9278=[];var _0x1c0dfc=0x0;var _0x3c8084=!![];if(_0x208f32&&_0x208f32[_0xf693('0x18')]){var _0x345539=_0x208f32[0x0][_0xf693('0x17')]%(_0x1c0dfc+_0x48984a);if(_0x4b09d6['split']){for(;_0x3c8084;_0x1c0dfc+=_0x48984a,_0x345539=_0x208f32[0x0]['num']%(_0x1c0dfc+_0x48984a)){if(_0x345539==0x0||_0x345539==_0x208f32[0x0]['num']){_0x3c8084=![];}_0x1d9278[_0xf693('0x19')](dbH[_0xf693('0x1a')][_0xf693('0x14')](util[_0xf693('0xd')](_0xf693('0x1b'),QUERY,_0x48984a,_0x1c0dfc),{'type':dbH['sequelize'][_0xf693('0x15')][_0xf693('0x16')]}));}}else{_0x1d9278[_0xf693('0x19')](dbH[_0xf693('0x1a')][_0xf693('0x14')](QUERY,{'type':dbH[_0xf693('0x1a')][_0xf693('0x15')][_0xf693('0x16')]}));}}var _0x50b20e=path[_0xf693('0x1c')](PATH);var _0x1188c6=path[_0xf693('0x1d')](PATH,_0xf693('0x1e'));var _0x400398=_0x4b09d6[_0xf693('0x11')]&&_0x1d9278[_0xf693('0x18')]>0x1;var _0x5407f5=[];if(!fs[_0xf693('0x1f')](path[_0xf693('0x20')](_0x50b20e,_0x1188c6))&&_0x400398){fs[_0xf693('0x21')](path[_0xf693('0x20')](_0x50b20e,_0x1188c6));}return BPromise['each'](_0x1d9278,function(_0x950632){_0x5407f5[_0xf693('0x19')](_0x950632);})[_0xf693('0x13')](function(){for(var _0x2245af=0x0;_0x2245af<_0x5407f5[_0xf693('0x18')];_0x2245af+=0x1){var _0xbbbf29;var _0x1c6ff2=_0x5407f5[_0x2245af];if(_0x400398){_0xbbbf29=path[_0xf693('0x20')](_0x50b20e,_0x1188c6,util[_0xf693('0xd')](_0xf693('0x22'),_0x1188c6,_0x2245af,'csv'));}else{_0xbbbf29=path[_0xf693('0x20')](_0x50b20e,util[_0xf693('0xd')](_0xf693('0x23'),_0x1188c6,_0xf693('0x24')));}fs[_0xf693('0x25')](_0xbbbf29,csv(_0x1c6ff2));}})[_0xf693('0x13')](function(){if(_0x400398){zipdir(path[_0xf693('0x20')](_0x50b20e,_0x1188c6),{'saveTo':path[_0xf693('0x20')](_0x50b20e,util['format'](_0xf693('0x23'),_0x1188c6,_0xf693('0x26')))},function(_0x3580c5,_0x19b4dc){});rimraf(path['join'](_0x50b20e,_0x1188c6),function(){});}})['then'](function(){logger[_0xf693('0x27')](util[_0xf693('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf693('0xe')));return analyticExtractedReport(_0xf693('0x28'),_0x400398?util[_0xf693('0xd')](_0xf693('0x23'),_0x1188c6,_0x400398?'zip':_0xf693('0x24')):null);});})[_0xf693('0x29')](function(_0xa9b406){logger[_0xf693('0x27')](util[_0xf693('0xd')](_0xf693('0x2a'),EXTRACTED_REPORT_ID,_0xf693('0xe')),util[_0xf693('0x2b')](_0xa9b406,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf693('0x2c')](function(){process[_0xf693('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6d0ccdc..3a513ea 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 _0x52af=['chunk','forEach','format','name','header','before','landscape','\x20/\x20','footer','Arial','black','right','Empty','dirname','basename','.pdf','join','%s.%s','pdf','find','split','splitSizePdf','then','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','existsSync','mkdirSync','all','flatten','createPdfKitDocument','%s%d.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','length','auto','push','body'];(function(_0x39c6c7,_0x585670){var _0x4f1833=function(_0x459a9e){while(--_0x459a9e){_0x39c6c7['push'](_0x39c6c7['shift']());}};_0x4f1833(++_0x585670);}(_0x52af,0x93));var _0xf52a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x52af[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xf52a('0x0'));var fs=require('fs');var util=require(_0xf52a('0x1'));var path=require(_0xf52a('0x2'));var moment=require(_0xf52a('0x3'));var htmlToPdfmake=require(_0xf52a('0x4'));var PdfPrinter=require(_0xf52a('0x5'));var zipdir=require(_0xf52a('0x6'));var rimraf=require(_0xf52a('0x7'));var JSDOM=require(_0xf52a('0x8'))[_0xf52a('0x9')];var window=new JSDOM('')['window'];var db=require(_0xf52a('0xa'))['db'];var dbH=require(_0xf52a('0xa'))[_0xf52a('0xb')];var logger=require('../../config/logger')(_0xf52a('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xf52a('0xd')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x75045d,_0x3b400e){var _0x494478={'status':_0x75045d};var _0x385031={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b400e){_0x494478[_0xf52a('0xe')]=_0x3b400e;}return db[_0xf52a('0xf')][_0xf52a('0x10')](_0x494478,_0x385031);}function getHeaders(_0x4f72ce){return _[_0xf52a('0x11')](_0x4f72ce,function(_0x470acc){return{'text':_0x470acc,'style':_0xf52a('0x12')};});}function getRows(_0x304d56,_0x236de9){return _[_0xf52a('0x11')](_0x236de9,function(_0x19f419){return _(_0x19f419)[_0xf52a('0x13')](_0x304d56)[_0xf52a('0x11')](function(_0x52419b){return _0x52419b?_[_0xf52a('0x14')](_0x52419b):'';})['value']();});}function createTable(_0x117b78,_0x129738){var _0x4236bc={'widths':_['fill'](Array(_0x117b78[_0xf52a('0x15')]),0x91),'heights':function(_0x11923b){return _0x11923b===0x0?_0xf52a('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x44a115=getHeaders(_0x117b78);_0x4236bc['body'][_0xf52a('0x17')](_0x44a115);var _0x22411c=getRows(_0x117b78,_0x129738);_0x4236bc['body']=_0x4236bc[_0xf52a('0x18')]['concat'](_0x22411c);return _0x4236bc;}function createTables(_0x4758f6){var _0x35e096=[];var _0x3df53c=_[_0xf52a('0x19')](Object['keys'](_0x4758f6[0x0]),0x5);_0x3df53c[_0xf52a('0x1a')](function(_0x18d81c){_0x35e096['push'](createTable(_0x18d81c,_0x4758f6));});return _0x35e096;}function getPDFDocDefinition(_0x1e6a98){var _0x37939b=util[_0xf52a('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xf52a('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0xf52a('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xf52a('0x1b')](FORMAT));var _0x4dda34=[];for(var _0x5a5245=0x0;_0x5a5245<_0x1e6a98['length'];_0x5a5245++){var _0x17c47a=[];if(_0x5a5245===0x0){_0x17c47a['push']({'text':_0x37939b,'style':_0xf52a('0x1d')});}var _0x2fe905={'table':_0x1e6a98[_0x5a5245]};if(_0x5a5245>0x0){_0x2fe905['pageBreak']=_0xf52a('0x1e');_0x2fe905['margin']=[0x0,0x46,0x0,0x0];}_0x17c47a[_0xf52a('0x17')](_0x2fe905);_0x4dda34[_0xf52a('0x17')](_0x17c47a);}return{'pageSize':'A4','pageOrientation':_0xf52a('0x1f'),'content':_0x4dda34,'footer':function(_0x5139d7,_0x3e9117){return{'text':_0x5139d7[_0xf52a('0x14')]()+_0xf52a('0x20')+_0x3e9117,'style':_0xf52a('0x21')};},'defaultStyle':{'font':_0xf52a('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf52a('0x23')},'footer':{'alignment':_0xf52a('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xde28c7){var _0x2e9572=0x1388;var _0x215d2d;if(!_0xde28c7[0x0]['num']){return analyticExtractedReport(_0xf52a('0x25'));}var _0x1e2efd=[];var _0x33c81e=0x0;var _0x1e9466=!![];var _0x246342=path[_0xf52a('0x26')](PATH);var _0x439296=path[_0xf52a('0x27')](PATH,_0xf52a('0x28'));var _0x29b637=path[_0xf52a('0x29')](_0x246342,util[_0xf52a('0x1b')](_0xf52a('0x2a'),_0x439296,_0xf52a('0x2b')));var _0x8890fb=![];return db['Setting'][_0xf52a('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf52a('0x2d'),_0xf52a('0x2e')]})[_0xf52a('0x2f')](function(_0x5aae84){if(_0x5aae84){_0x215d2d=_0x5aae84;_0x2e9572=_0x215d2d[_0xf52a('0x2e')]||0x3e8;}})['then'](function(){if(_0xde28c7&&_0xde28c7[_0xf52a('0x15')]){var _0x38daec=_0xde28c7[0x0]['num']%(_0x33c81e+_0x2e9572);if(_0x215d2d[_0xf52a('0x2d')]){for(;_0x1e9466;_0x33c81e+=_0x2e9572,_0x38daec=_0xde28c7[0x0][_0xf52a('0x30')]%(_0x33c81e+_0x2e9572)){if(_0x38daec==0x0||_0x38daec==_0xde28c7[0x0]['num']){_0x1e9466=![];}_0x1e2efd[_0xf52a('0x17')](dbH[_0xf52a('0x31')][_0xf52a('0x32')](util['format'](_0xf52a('0x33'),QUERY,_0x2e9572,_0x33c81e),{'type':dbH[_0xf52a('0x31')][_0xf52a('0x34')]['SELECT']}));}}else{_0x1e2efd[_0xf52a('0x17')](dbH['sequelize'][_0xf52a('0x32')](QUERY,{'type':dbH[_0xf52a('0x31')][_0xf52a('0x34')]['SELECT']}));}}_0x8890fb=_0x215d2d[_0xf52a('0x2d')]&&_0x1e2efd[_0xf52a('0x15')]>0x1;if(!fs[_0xf52a('0x35')](path[_0xf52a('0x29')](_0x246342,_0x439296))&&_0x8890fb){fs[_0xf52a('0x36')](path[_0xf52a('0x29')](_0x246342,_0x439296));}return Promise[_0xf52a('0x37')](_0x1e2efd);})[_0xf52a('0x2f')](function(_0x4bc024){return createTables(_[_0xf52a('0x38')](_0x4bc024));})[_0xf52a('0x2f')](function(_0x17b1b6){var _0x4f557b=getPDFDocDefinition(_0x17b1b6);var _0x59c803=getPDFPrinter();var _0x541e1a=_0x59c803[_0xf52a('0x39')](_0x4f557b);if(_0x8890fb)_0x29b637=path['join'](_0x246342,_0x439296,util[_0xf52a('0x1b')](_0xf52a('0x3a'),_0x439296,index,_0xf52a('0x2b')));return writePDFDocument(_0x541e1a,_0x29b637);})['then'](function(){if(!_0x8890fb)return;zipdir(path['join'](_0x246342,_0x439296),{'saveTo':path[_0xf52a('0x29')](_0x246342,util[_0xf52a('0x1b')](_0xf52a('0x2a'),_0x439296,_0xf52a('0x3b')))},function(_0x17a059){if(_0x17a059)throw _0x17a059;return;});})[_0xf52a('0x2f')](function(){if(!_0x8890fb)return;rimraf(path[_0xf52a('0x29')](_0x246342,_0x439296),function(){});})['then'](function(){logger['info'](util['format'](_0xf52a('0x3c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xf52a('0x3d'),_0x8890fb?util['format'](_0xf52a('0x2a'),_0x439296,_0x8890fb?_0xf52a('0x3b'):_0xf52a('0x2b')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf52a('0x3e')](util[_0xf52a('0x1b')](_0xf52a('0x3f'),EXTRACTED_REPORT_ID,_0xf52a('0x40')));return db['AnalyticExtractedReport'][_0xf52a('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x3f7d58){EXTRACTED_REPORT=_0x3f7d58;return dbH[_0xf52a('0x31')]['query'](util['format'](_0xf52a('0x42'),QUERY),{'type':dbH[_0xf52a('0x31')][_0xf52a('0x34')][_0xf52a('0x43')]});})[_0xf52a('0x2f')](extractReport)['catch'](function(_0x56e689){logger[_0xf52a('0x3e')](util[_0xf52a('0x1b')](_0xf52a('0x44'),EXTRACTED_REPORT_ID,'PDF'),util[_0xf52a('0x45')](_0x56e689,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf52a('0x46')](function(){process[_0xf52a('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x103063=new PdfPrinter({'Arial':{'normal':__dirname+_0xf52a('0x48'),'bold':__dirname+_0xf52a('0x49'),'italics':__dirname+_0xf52a('0x4a'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x103063;}function getPDFDocDefinitionFromHTML(_0x4932de,_0x3e69f7){var _0x399ce0=util[_0xf52a('0x1b')](_0xf52a('0x4b'),_0x3e69f7[_0xf52a('0x4c')],_0x3e69f7['interactionId']);var _0x1d113c=moment()[_0xf52a('0x1b')](_0xf52a('0x4d'))[_0xf52a('0x14')]();var _0x473c3f=htmlToPdfmake(_0x4932de,{'window':window,'tableAutoSize':!![]});return{'content':[_0x473c3f],'defaultStyle':{'font':_0xf52a('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf52a('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf52a('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xf52a('0x4f'),'style':_0xf52a('0x1d')}];},'footer':function(_0x1ca4c9,_0xaa3d34){return[{'text':util[_0xf52a('0x1b')](_0xf52a('0x50'),_0x399ce0,_0x1ca4c9,_0xaa3d34,_0x1d113c),'style':_0xf52a('0x21')}];}};}function writePDFDocument(_0x39cd24,_0x300e19){return new Promise(function(_0x21e45d,_0x424280){var _0x2869a7=_0x39cd24[_0xf52a('0x51')](fs['createWriteStream'](_0x300e19));_0x2869a7['on'](_0xf52a('0x52'),function(){_0x21e45d(_0xf52a('0x52'));});_0x2869a7['on'](_0xf52a('0x53'),function(_0x1c4641){_0x424280(_0x1c4641);});_0x39cd24[_0xf52a('0x54')]();});}exports[_0xf52a('0x55')]=function(_0x171382,_0x55d763){var _0x39f743=getPDFPrinter();var _0x4608fa=getPDFDocDefinitionFromHTML(_0x171382,_0x55d763);var _0x1d5940=_0x39f743[_0xf52a('0x39')](_0x4608fa);return writePDFDocument(_0x1d5940,_0x55d763[_0xf52a('0x2')])['catch'](function(_0x120cd0){throw _0x120cd0;});}; \ No newline at end of file +var _0xf747=['%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','dirname','basename','.pdf','join','%s.%s','pdf','Setting','find','split','then','splitSizePdf','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','existsSync','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','zip','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf'];(function(_0xda4a3f,_0x3c73ef){var _0x1b84c9=function(_0x50087c){while(--_0x50087c){_0xda4a3f['push'](_0xda4a3f['shift']());}};_0x1b84c9(++_0x3c73ef);}(_0xf747,0x181));var _0x7f74=function(_0x473a62,_0x394331){_0x473a62=_0x473a62-0x0;var _0x5812bf=_0xf747[_0x473a62];return _0x5812bf;};'use strict';var _=require(_0x7f74('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x7f74('0x1'));var htmlToPdfmake=require(_0x7f74('0x2'));var PdfPrinter=require(_0x7f74('0x3'));var zipdir=require(_0x7f74('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x7f74('0x5'))[_0x7f74('0x6')];var window=new JSDOM('')[_0x7f74('0x7')];var db=require('../../mysqldb')['db'];var dbH=require(_0x7f74('0x8'))[_0x7f74('0x9')];var logger=require(_0x7f74('0xa'))(_0x7f74('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x7f74('0xc')][0x2]);var QUERY=process[_0x7f74('0xc')][0x3];var PATH=process[_0x7f74('0xc')][0x4];var NAME=process[_0x7f74('0xc')][0x5];var FORMAT=_0x7f74('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x24d213,_0x2efb7b){var _0x44fb80={'status':_0x24d213};var _0x5d1502={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2efb7b){_0x44fb80[_0x7f74('0xe')]=_0x2efb7b;}return db[_0x7f74('0xf')]['update'](_0x44fb80,_0x5d1502);}function getHeaders(_0x63582f){return _[_0x7f74('0x10')](_0x63582f,function(_0x19c6b0){return{'text':_0x19c6b0,'style':_0x7f74('0x11')};});}function getRows(_0x404e2f,_0x2a0b1b){return _[_0x7f74('0x10')](_0x2a0b1b,function(_0x3d5fbb){return _(_0x3d5fbb)[_0x7f74('0x12')](_0x404e2f)['map'](function(_0x5b6af3){return _0x5b6af3?_[_0x7f74('0x13')](_0x5b6af3):'';})[_0x7f74('0x14')]();});}function createTable(_0x2cc9f2,_0x459a9d){var _0xd40f3b={'widths':_[_0x7f74('0x15')](Array(_0x2cc9f2[_0x7f74('0x16')]),0x91),'heights':function(_0x5dee4c){return _0x5dee4c===0x0?_0x7f74('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1ad7a6=getHeaders(_0x2cc9f2);_0xd40f3b[_0x7f74('0x18')][_0x7f74('0x19')](_0x1ad7a6);var _0x294a41=getRows(_0x2cc9f2,_0x459a9d);_0xd40f3b[_0x7f74('0x18')]=_0xd40f3b[_0x7f74('0x18')][_0x7f74('0x1a')](_0x294a41);return _0xd40f3b;}function createTables(_0x31230f){var _0xa9ca25=[];var _0x4d729f=_[_0x7f74('0x1b')](Object[_0x7f74('0x1c')](_0x31230f[0x0]),0x5);_0x4d729f['forEach'](function(_0x15403f){_0xa9ca25[_0x7f74('0x19')](createTable(_0x15403f,_0x31230f));});return _0xa9ca25;}function getPDFDocDefinition(_0xe50bbe){var _0x4c6112=util[_0x7f74('0x1d')](_0x7f74('0x1e'),NAME,EXTRACTED_REPORT[_0x7f74('0x1f')],moment(EXTRACTED_REPORT[_0x7f74('0x20')])[_0x7f74('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x7f74('0x21')])[_0x7f74('0x1d')](FORMAT));var _0xfa3173=[];for(var _0x2cd644=0x0;_0x2cd644<_0xe50bbe[_0x7f74('0x16')];_0x2cd644++){var _0x3759e1=[];if(_0x2cd644===0x0){_0x3759e1[_0x7f74('0x19')]({'text':_0x4c6112,'style':_0x7f74('0x22')});}var _0x219f7c={'table':_0xe50bbe[_0x2cd644]};if(_0x2cd644>0x0){_0x219f7c['pageBreak']='before';_0x219f7c['margin']=[0x0,0x46,0x0,0x0];}_0x3759e1[_0x7f74('0x19')](_0x219f7c);_0xfa3173[_0x7f74('0x19')](_0x3759e1);}return{'pageSize':'A4','pageOrientation':_0x7f74('0x23'),'content':_0xfa3173,'footer':function(_0x557081,_0x4571a6){return{'text':_0x557081[_0x7f74('0x13')]()+_0x7f74('0x24')+_0x4571a6,'style':_0x7f74('0x25')};},'defaultStyle':{'font':_0x7f74('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7f74('0x27')},'footer':{'alignment':_0x7f74('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x59b8e8){var _0x774fb3=0x1388;var _0x12b761;if(!_0x59b8e8[0x0][_0x7f74('0x29')]){return analyticExtractedReport(_0x7f74('0x2a'));}var _0x248617=[];var _0xc4b139=0x0;var _0x33b138=!![];var _0x27cbe0=path[_0x7f74('0x2b')](PATH);var _0x2caf66=path[_0x7f74('0x2c')](PATH,_0x7f74('0x2d'));var _0x17181f=path[_0x7f74('0x2e')](_0x27cbe0,util['format'](_0x7f74('0x2f'),_0x2caf66,_0x7f74('0x30')));var _0xfe5192=![];return db[_0x7f74('0x31')][_0x7f74('0x32')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7f74('0x33'),'splitSizePdf']})[_0x7f74('0x34')](function(_0x2e3462){if(_0x2e3462){_0x12b761=_0x2e3462;_0x774fb3=_0x12b761[_0x7f74('0x35')]||0x3e8;}})[_0x7f74('0x34')](function(){if(_0x59b8e8&&_0x59b8e8['length']){var _0x2a3b60=_0x59b8e8[0x0][_0x7f74('0x29')]%(_0xc4b139+_0x774fb3);if(_0x12b761[_0x7f74('0x33')]){for(;_0x33b138;_0xc4b139+=_0x774fb3,_0x2a3b60=_0x59b8e8[0x0][_0x7f74('0x29')]%(_0xc4b139+_0x774fb3)){if(_0x2a3b60==0x0||_0x2a3b60==_0x59b8e8[0x0][_0x7f74('0x29')]){_0x33b138=![];}_0x248617['push'](dbH['sequelize']['query'](util[_0x7f74('0x1d')](_0x7f74('0x36'),QUERY,_0x774fb3,_0xc4b139),{'type':dbH[_0x7f74('0x37')][_0x7f74('0x38')][_0x7f74('0x39')]}));}}else{_0x248617['push'](dbH['sequelize'][_0x7f74('0x3a')](QUERY,{'type':dbH['sequelize'][_0x7f74('0x38')][_0x7f74('0x39')]}));}}_0xfe5192=_0x12b761['split']&&_0x248617[_0x7f74('0x16')]>0x1;if(!fs[_0x7f74('0x3b')](path[_0x7f74('0x2e')](_0x27cbe0,_0x2caf66))&&_0xfe5192){fs[_0x7f74('0x3c')](path[_0x7f74('0x2e')](_0x27cbe0,_0x2caf66));}return Promise['all'](_0x248617);})[_0x7f74('0x34')](function(_0xf08ef9){return createTables(_[_0x7f74('0x3d')](_0xf08ef9));})['then'](function(_0x3ea2b9){var _0x2b7c8c=getPDFDocDefinition(_0x3ea2b9);var _0x29879f=getPDFPrinter();var _0x50272c=_0x29879f[_0x7f74('0x3e')](_0x2b7c8c);if(_0xfe5192)_0x17181f=path[_0x7f74('0x2e')](_0x27cbe0,_0x2caf66,util[_0x7f74('0x1d')](_0x7f74('0x3f'),_0x2caf66,index,_0x7f74('0x30')));return writePDFDocument(_0x50272c,_0x17181f);})[_0x7f74('0x34')](function(){if(!_0xfe5192)return;zipdir(path[_0x7f74('0x2e')](_0x27cbe0,_0x2caf66),{'saveTo':path[_0x7f74('0x2e')](_0x27cbe0,util['format']('%s.%s',_0x2caf66,_0x7f74('0x40')))},function(_0x24e429){if(_0x24e429)throw _0x24e429;return;});})[_0x7f74('0x34')](function(){if(!_0xfe5192)return;rimraf(path[_0x7f74('0x2e')](_0x27cbe0,_0x2caf66),function(){});})[_0x7f74('0x34')](function(){logger['info'](util[_0x7f74('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x7f74('0x41')));return analyticExtractedReport(_0x7f74('0x42'),_0xfe5192?util[_0x7f74('0x1d')](_0x7f74('0x2f'),_0x2caf66,_0xfe5192?_0x7f74('0x40'):'pdf'):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x7f74('0x43'),EXTRACTED_REPORT_ID,_0x7f74('0x44')));return db[_0x7f74('0xf')][_0x7f74('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x3c1ab3){EXTRACTED_REPORT=_0x3c1ab3;return dbH[_0x7f74('0x37')]['query'](util[_0x7f74('0x1d')](_0x7f74('0x46'),QUERY),{'type':dbH[_0x7f74('0x37')][_0x7f74('0x38')][_0x7f74('0x39')]});})[_0x7f74('0x34')](extractReport)[_0x7f74('0x47')](function(_0x3135f2){logger[_0x7f74('0x48')](util[_0x7f74('0x1d')](_0x7f74('0x49'),EXTRACTED_REPORT_ID,_0x7f74('0x44')),util[_0x7f74('0x4a')](_0x3135f2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7f74('0x4b'));})[_0x7f74('0x4c')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2cf266=new PdfPrinter({'Arial':{'normal':__dirname+_0x7f74('0x4d'),'bold':__dirname+_0x7f74('0x4e'),'italics':__dirname+_0x7f74('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x2cf266;}function getPDFDocDefinitionFromHTML(_0x440cee,_0x8af0d1){var _0x5c5051=util[_0x7f74('0x1d')](_0x7f74('0x50'),_0x8af0d1[_0x7f74('0x51')],_0x8af0d1[_0x7f74('0x52')]);var _0x5a35a3=moment()[_0x7f74('0x1d')](_0x7f74('0x53'))[_0x7f74('0x13')]();var _0x339eae=htmlToPdfmake(_0x440cee,{'window':window,'tableAutoSize':!![]});return{'content':[_0x339eae],'defaultStyle':{'font':_0x7f74('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x7f74('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7f74('0x54')}},'header':function(){return[{'text':_0x7f74('0x55'),'style':_0x7f74('0x22')}];},'footer':function(_0x298cdc,_0x36f9d1){return[{'text':util[_0x7f74('0x1d')](_0x7f74('0x56'),_0x5c5051,_0x298cdc,_0x36f9d1,_0x5a35a3),'style':_0x7f74('0x25')}];}};}function writePDFDocument(_0x4bfeee,_0x3df947){return new Promise(function(_0x16389e,_0x40082b){var _0x3f26fa=_0x4bfeee['pipe'](fs[_0x7f74('0x57')](_0x3df947));_0x3f26fa['on'](_0x7f74('0x58'),function(){_0x16389e('finish');});_0x3f26fa['on'](_0x7f74('0x59'),function(_0x458420){_0x40082b(_0x458420);});_0x4bfeee[_0x7f74('0x5a')]();});}exports[_0x7f74('0x5b')]=function(_0xd1664d,_0x44b234){var _0x378b30=getPDFPrinter();var _0x459c41=getPDFDocDefinitionFromHTML(_0xd1664d,_0x44b234);var _0x579de7=_0x378b30[_0x7f74('0x3e')](_0x459c41);return writePDFDocument(_0x579de7,_0x44b234[_0x7f74('0x5c')])[_0x7f74('0x47')](function(_0x2479eb){throw _0x2479eb;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 7cf60f4..7674561 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 _0xf69c=['existsSync','join','mkdirSync','xlsx','%s.%s','writeFileSync','binary','zip','Completed','catch','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','XLSX','split','then','splitSizeXlsx','sequelize','query','SELECT','num','Empty','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','length'];(function(_0x51d37a,_0x408570){var _0xbb86a6=function(_0x4446f9){while(--_0x4446f9){_0x51d37a['push'](_0x51d37a['shift']());}};_0xbb86a6(++_0x408570);}(_0xf69c,0x1c5));var _0xcf69=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xf69c[_0x2a56ad];return _0x425175;};'use strict';var util=require(_0xcf69('0x0'));var path=require(_0xcf69('0x1'));var _=require(_0xcf69('0x2'));var fs=require('fs');var json2xls=require(_0xcf69('0x3'));var BPromise=require(_0xcf69('0x4'));var zipdir=require(_0xcf69('0x5'));var rimraf=require('rimraf');var db=require(_0xcf69('0x6'))['db'];var dbH=require(_0xcf69('0x6'))[_0xcf69('0x7')];var logger=require(_0xcf69('0x8'))(_0xcf69('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xcf69('0xa')][0x2]);var QUERY=process[_0xcf69('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x39aaf5,_0x8c0cf8){var _0x3f37ad={'status':_0x39aaf5};var _0x3373b5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8c0cf8){_0x3f37ad['savename']=_0x8c0cf8;}return db[_0xcf69('0xb')][_0xcf69('0xc')](_0x3f37ad,_0x3373b5);}function main(){var _0x407be0=0x1388;var _0x497547;logger[_0xcf69('0xd')](util[_0xcf69('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcf69('0xf')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcf69('0x10'),'splitSizeXlsx']})[_0xcf69('0x11')](function(_0x294368){if(_0x294368){_0x497547=_0x294368;_0x407be0=_0x497547[_0xcf69('0x12')]||0x1388;}})[_0xcf69('0x11')](function(){return dbH[_0xcf69('0x13')][_0xcf69('0x14')](util[_0xcf69('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xcf69('0x15')]});})[_0xcf69('0x11')](function(_0x4901dc){if(!_0x4901dc[0x0][_0xcf69('0x16')]){return analyticExtractedReport(_0xcf69('0x17'));}var _0x4b7363=[];var _0x36db9d=0x0;var _0x37066d=!![];if(_0x497547[_0xcf69('0x10')]){if(_0x4901dc&&_0x4901dc['length']){var _0x19d764=_0x4901dc[0x0][_0xcf69('0x16')]%(_0x36db9d+_0x407be0);for(;_0x37066d;_0x36db9d+=_0x407be0,_0x19d764=_0x4901dc[0x0]['num']%(_0x36db9d+_0x407be0)){if(_0x19d764==0x0||_0x19d764==_0x4901dc[0x0][_0xcf69('0x16')]){_0x37066d=![];}_0x4b7363[_0xcf69('0x18')](dbH[_0xcf69('0x13')][_0xcf69('0x14')](util['format'](_0xcf69('0x19'),QUERY,_0x407be0,_0x36db9d),{'type':dbH[_0xcf69('0x13')][_0xcf69('0x1a')]['SELECT']}));}}}else{_0x4b7363['push'](dbH[_0xcf69('0x13')][_0xcf69('0x14')](QUERY,{'type':dbH['sequelize'][_0xcf69('0x1a')][_0xcf69('0x15')]}));}var _0x466982=path[_0xcf69('0x1b')](PATH);var _0x42cd9b=path[_0xcf69('0x1c')](PATH,_0xcf69('0x1d'));var _0x1bf1a0=_0x497547[_0xcf69('0x10')]&&_0x4b7363[_0xcf69('0x1e')]>0x1;var _0xe4f5d0=[];if(!fs[_0xcf69('0x1f')](path[_0xcf69('0x20')](_0x466982,_0x42cd9b))&&_0x1bf1a0){fs[_0xcf69('0x21')](path[_0xcf69('0x20')](_0x466982,_0x42cd9b));}return BPromise['each'](_0x4b7363,function(_0x1482a8){_0xe4f5d0[_0xcf69('0x18')](_0x1482a8);})[_0xcf69('0x11')](function(){for(var _0x27c6d8=0x0;_0x27c6d8<_0xe4f5d0[_0xcf69('0x1e')];_0x27c6d8+=0x1){var _0x52f38c;var _0x7535a3=_0xe4f5d0[_0x27c6d8];if(_0x1bf1a0){_0x52f38c=path[_0xcf69('0x20')](_0x466982,_0x42cd9b,util[_0xcf69('0xe')]('%s%d.%s',_0x42cd9b,_0x27c6d8,_0xcf69('0x22')));}else{_0x52f38c=path['join'](_0x466982,util[_0xcf69('0xe')](_0xcf69('0x23'),_0x42cd9b,_0xcf69('0x22')));}fs[_0xcf69('0x24')](_0x52f38c,json2xls(_0x7535a3),_0xcf69('0x25'));}})[_0xcf69('0x11')](function(){if(_0x1bf1a0){zipdir(path[_0xcf69('0x20')](_0x466982,_0x42cd9b),{'saveTo':path[_0xcf69('0x20')](_0x466982,util['format'](_0xcf69('0x23'),_0x42cd9b,_0xcf69('0x26')))},function(_0x2884ee,_0x123e64){});rimraf(path[_0xcf69('0x20')](_0x466982,_0x42cd9b),function(){});}})['then'](function(){logger[_0xcf69('0xd')](util[_0xcf69('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xcf69('0x27'),_0x1bf1a0?util[_0xcf69('0xe')](_0xcf69('0x23'),_0x42cd9b,_0x1bf1a0?_0xcf69('0x26'):'xlsx'):null);});})[_0xcf69('0x28')](function(_0x35f9a2){logger['info'](util[_0xcf69('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcf69('0xf')),util[_0xcf69('0x29')](_0x35f9a2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcf69('0x2a'));})[_0xcf69('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa474=['push','%s\x20limit\x20%d\x20OFFSET\x20%d','.xlsx','length','existsSync','join','mkdirSync','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeXlsx','sequelize','query','QueryTypes','SELECT','num'];(function(_0xff7ade,_0x424e72){var _0x5e4abd=function(_0x2d2ac3){while(--_0x2d2ac3){_0xff7ade['push'](_0xff7ade['shift']());}};_0x5e4abd(++_0x424e72);}(_0xa474,0xc4));var _0x4a47=function(_0x2a23b8,_0x257b92){_0x2a23b8=_0x2a23b8-0x0;var _0x54e9d6=_0xa474[_0x2a23b8];return _0x54e9d6;};'use strict';var util=require(_0x4a47('0x0'));var path=require(_0x4a47('0x1'));var _=require(_0x4a47('0x2'));var fs=require('fs');var json2xls=require(_0x4a47('0x3'));var BPromise=require(_0x4a47('0x4'));var zipdir=require(_0x4a47('0x5'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x4a47('0x6'))(_0x4a47('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x4a47('0x8')][0x2]);var QUERY=process[_0x4a47('0x8')][0x3];var PATH=process[_0x4a47('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x582414,_0x16f640){var _0x14e15e={'status':_0x582414};var _0x56caab={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16f640){_0x14e15e[_0x4a47('0x9')]=_0x16f640;}return db[_0x4a47('0xa')][_0x4a47('0xb')](_0x14e15e,_0x56caab);}function main(){var _0x56afa4=0x1388;var _0xed84cd;logger['info'](util[_0x4a47('0xc')](_0x4a47('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x4a47('0xe')][_0x4a47('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4a47('0x10'),'splitSizeXlsx']})[_0x4a47('0x11')](function(_0x55e084){if(_0x55e084){_0xed84cd=_0x55e084;_0x56afa4=_0xed84cd[_0x4a47('0x12')]||0x1388;}})[_0x4a47('0x11')](function(){return dbH[_0x4a47('0x13')][_0x4a47('0x14')](util[_0x4a47('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4a47('0x13')][_0x4a47('0x15')][_0x4a47('0x16')]});})[_0x4a47('0x11')](function(_0x55d9d4){if(!_0x55d9d4[0x0][_0x4a47('0x17')]){return analyticExtractedReport('Empty');}var _0x3a2e6f=[];var _0x173185=0x0;var _0x2beded=!![];if(_0xed84cd[_0x4a47('0x10')]){if(_0x55d9d4&&_0x55d9d4['length']){var _0x182b97=_0x55d9d4[0x0][_0x4a47('0x17')]%(_0x173185+_0x56afa4);for(;_0x2beded;_0x173185+=_0x56afa4,_0x182b97=_0x55d9d4[0x0][_0x4a47('0x17')]%(_0x173185+_0x56afa4)){if(_0x182b97==0x0||_0x182b97==_0x55d9d4[0x0][_0x4a47('0x17')]){_0x2beded=![];}_0x3a2e6f[_0x4a47('0x18')](dbH['sequelize'][_0x4a47('0x14')](util['format'](_0x4a47('0x19'),QUERY,_0x56afa4,_0x173185),{'type':dbH[_0x4a47('0x13')][_0x4a47('0x15')][_0x4a47('0x16')]}));}}}else{_0x3a2e6f[_0x4a47('0x18')](dbH[_0x4a47('0x13')][_0x4a47('0x14')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x4a47('0x16')]}));}var _0x3db6dd=path['dirname'](PATH);var _0x529401=path['basename'](PATH,_0x4a47('0x1a'));var _0x12eb2d=_0xed84cd[_0x4a47('0x10')]&&_0x3a2e6f[_0x4a47('0x1b')]>0x1;var _0x469b65=[];if(!fs[_0x4a47('0x1c')](path[_0x4a47('0x1d')](_0x3db6dd,_0x529401))&&_0x12eb2d){fs[_0x4a47('0x1e')](path[_0x4a47('0x1d')](_0x3db6dd,_0x529401));}return BPromise['each'](_0x3a2e6f,function(_0x175fd2){_0x469b65[_0x4a47('0x18')](_0x175fd2);})['then'](function(){for(var _0xec3fb1=0x0;_0xec3fb1<_0x469b65[_0x4a47('0x1b')];_0xec3fb1+=0x1){var _0x57855e;var _0x1a59de=_0x469b65[_0xec3fb1];if(_0x12eb2d){_0x57855e=path[_0x4a47('0x1d')](_0x3db6dd,_0x529401,util[_0x4a47('0xc')]('%s%d.%s',_0x529401,_0xec3fb1,_0x4a47('0x1f')));}else{_0x57855e=path[_0x4a47('0x1d')](_0x3db6dd,util[_0x4a47('0xc')]('%s.%s',_0x529401,'xlsx'));}fs[_0x4a47('0x20')](_0x57855e,json2xls(_0x1a59de),_0x4a47('0x21'));}})[_0x4a47('0x11')](function(){if(_0x12eb2d){zipdir(path[_0x4a47('0x1d')](_0x3db6dd,_0x529401),{'saveTo':path[_0x4a47('0x1d')](_0x3db6dd,util[_0x4a47('0xc')](_0x4a47('0x22'),_0x529401,_0x4a47('0x23')))},function(_0x11a904,_0x4dad10){});rimraf(path[_0x4a47('0x1d')](_0x3db6dd,_0x529401),function(){});}})[_0x4a47('0x11')](function(){logger['info'](util[_0x4a47('0xc')](_0x4a47('0x24'),EXTRACTED_REPORT_ID,_0x4a47('0x25')));return analyticExtractedReport('Completed',_0x12eb2d?util[_0x4a47('0xc')](_0x4a47('0x22'),_0x529401,_0x12eb2d?_0x4a47('0x23'):_0x4a47('0x1f')):null);});})['catch'](function(_0x586dd1){logger[_0x4a47('0x26')](util['format'](_0x4a47('0x27'),EXTRACTED_REPORT_ID,_0x4a47('0x25')),util[_0x4a47('0x28')](_0x586dd1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4a47('0x29'));})[_0x4a47('0x2a')](function(){process[_0x4a47('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index b4746ef..3379e2d 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 _0x0293=['CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','updatedAt','interval','IntervalId','tag','CDR(tag)=','length','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','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','util','models','Interval','then','intervals','VoiceExtension','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','find','extensions','push','type','CDR(type)=%s','context','priority','CDR(routeid)=','VoiceExtensionId','outbound','extension','Set'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x0293,0xba));var _0x3029=function(_0x529898,_0x4512ae){_0x529898=_0x529898-0x0;var _0x228902=_0x0293[_0x529898];return _0x228902;};'use strict';var _=require('lodash');var util=require(_0x3029('0x0'));function rewrite(_0x5b8759,_0x3e8f19){var _0x30f076=this;return _0x5b8759[_0x3029('0x1')][_0x3029('0x2')]['findAll']({'raw':!![]})[_0x3029('0x3')](function(_0x343bc7){_0x30f076[_0x3029('0x4')]=_0x343bc7;return _0x5b8759[_0x3029('0x1')][_0x3029('0x5')][_0x3029('0x6')]({'where':{'IntervalId':_0x3e8f19['IntervalId']},'raw':!![]});})[_0x3029('0x3')](function(_0x204237){return _0x5b8759['models']['VoiceExtension'][_0x3029('0x6')]({'where':{'exten':{'$in':_[_0x3029('0x7')](_[_0x3029('0x8')](_0x204237,_0x3029('0x9')))}},'order':[{'raw':_0x3029('0xa')}],'raw':!![]});})[_0x3029('0x3')](function(_0x3bf0af){var _0x257fda=_[_0x3029('0xb')](_0x3bf0af,{'priority':'1'});var _0x15f5d6=_['filter'](_0x3bf0af,{'isApp':0x1});var _0x10e7fc=_[_0x3029('0xc')](_0x15f5d6,_0x3029('0x9'));var _0x2fd93d=['queue',_0x3029('0xd')];var _0x1b8e86=[];var _0x3862f6=[];for(var _0x549e87 in _0x10e7fc){if(_0x10e7fc[_0x3029('0xe')](_0x549e87)){_0x30f076['priority']=0x2;_0x30f076['extensions']=[];_0x30f076['extension']=_[_0x3029('0xf')](_0x257fda,{'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')]});_0x30f076[_0x3029('0x10')][_0x3029('0x11')]({'type':_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')],'app':'Set','appdata':util['format'](_0x3029('0x13'),_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')]),'context':_0x10e7fc[_0x549e87][0x0][_0x3029('0x14')],'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')],'priority':_0x30f076[_0x3029('0x15')]++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0]['VoiceExtensionId']});if(_0x10e7fc[_0x549e87][0x0]['type']==='inbound'){_0x30f076['extensions'][_0x3029('0x11')]({'type':_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')],'app':'Set','appdata':_0x3029('0x16')+_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')],'context':_0x10e7fc[_0x549e87][0x0][_0x3029('0x14')],'exten':_0x10e7fc[_0x549e87][0x0]['exten'],'priority':_0x30f076[_0x3029('0x15')]++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]});}else if(_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')]===_0x3029('0x18')){if(_0x30f076[_0x3029('0x19')]){_0x30f076[_0x3029('0x10')][_0x3029('0x11')]({'type':_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')],'app':_0x3029('0x1a'),'appdata':_0x3029('0x1b')+(_0x30f076[_0x3029('0x19')][_0x3029('0x1c')]?_0x3029('0x1d')+_0x30f076['extension']['cutdigits']+'}':_0x3029('0x1e')),'context':_0x10e7fc[_0x549e87][0x0][_0x3029('0x14')],'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')],'priority':_0x30f076[_0x3029('0x15')]++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]});}_0x30f076[_0x3029('0x10')]['push']({'type':_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')],'app':_0x3029('0x1a'),'appdata':_0x3029('0x16')+_0x10e7fc[_0x549e87][0x0]['VoiceExtensionId'],'context':_0x10e7fc[_0x549e87][0x0][_0x3029('0x14')],'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')],'priority':_0x30f076[_0x3029('0x15')]++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]});var _0x582189=_0x30f076[_0x3029('0x15')]++;_0x30f076[_0x3029('0x10')][_0x3029('0x11')]({'type':_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')],'app':_0x3029('0x1f'),'appdata':_0x3029('0x20')+(_0x582189+0x2)+_0x3029('0x21')+(_0x582189+0x1)+')','context':_0x10e7fc[_0x549e87][0x0][_0x3029('0x14')],'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')],'priority':_0x582189,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]});if(_0x30f076[_0x3029('0x19')]){_0x30f076[_0x3029('0x10')][_0x3029('0x11')]({'type':_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')],'app':'Set','appdata':_0x30f076['extension']['cutdigits']?_0x3029('0x22')+_0x30f076['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x10e7fc[_0x549e87][0x0][_0x3029('0x14')],'exten':_0x10e7fc[_0x549e87][0x0]['exten'],'priority':_0x30f076[_0x3029('0x15')]++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]});}_0x30f076[_0x3029('0x10')]['push']({'type':_0x10e7fc[_0x549e87][0x0]['type'],'app':_0x3029('0x1a'),'appdata':_0x3029('0x23')+_0x10e7fc[_0x549e87][0x0]['VoiceExtensionId'],'context':_0x10e7fc[_0x549e87][0x0]['context'],'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')],'priority':_0x30f076['priority']++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0]['VoiceExtensionId']});if(_0x30f076[_0x3029('0x19')]&&_0x30f076[_0x3029('0x19')][_0x3029('0xe')](_0x3029('0x24'))&&_0x30f076[_0x3029('0x19')][_0x3029('0x24')]!==_0x3029('0x25')){_0x30f076['extensions'][_0x3029('0x11')]({'type':_0x10e7fc[_0x549e87][0x0]['type'],'app':_0x3029('0x1a'),'appdata':_0x3029('0x26'),'context':_0x10e7fc[_0x549e87][0x0]['context'],'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')],'priority':_0x30f076[_0x3029('0x15')]++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0]['VoiceExtensionId']});_0x30f076[_0x3029('0x10')]['push']({'type':_0x10e7fc[_0x549e87][0x0]['type'],'app':_0x3029('0x1a'),'appdata':_0x3029('0x27')+_0x30f076[_0x3029('0x19')][_0x3029('0x24')]||_0x3029('0x28'),'context':_0x10e7fc[_0x549e87][0x0]['context'],'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')],'priority':_0x30f076['priority']++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0]['VoiceExtensionId']});}}_0x30f076[_0x3029('0x10')]['push']({'type':_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')],'app':_0x3029('0x1a'),'appdata':_0x3029('0x29'),'context':_0x10e7fc[_0x549e87][0x0][_0x3029('0x14')],'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')],'priority':_0x30f076[_0x3029('0x15')]++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]});_0x30f076[_0x3029('0x10')][_0x3029('0x11')]({'type':_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')],'app':_0x3029('0x1a'),'appdata':_0x3029('0x2a'),'context':_0x10e7fc[_0x549e87][0x0]['context'],'exten':_0x10e7fc[_0x549e87][0x0]['exten'],'priority':_0x30f076[_0x3029('0x15')]++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]});_0x30f076[_0x3029('0x10')][_0x3029('0x11')]({'type':_0x10e7fc[_0x549e87][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x10e7fc[_0x549e87][0x0][_0x3029('0x14')],'exten':_0x10e7fc[_0x549e87][0x0]['exten'],'priority':_0x30f076[_0x3029('0x15')]++,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]});for(var _0x207778=0x0,_0xa91943=0x0;_0x207778<_0x10e7fc[_0x549e87]['length'];_0x207778+=0x1,_0xa91943=0x0){var _0x5ccb7e=_0x10e7fc[_0x549e87][_0x207778];if(_0x5ccb7e[_0x3029('0x12')]){_0x5ccb7e[_0x3029('0x12')]=_0x5ccb7e[_0x3029('0x12')]['toLowerCase']();}var _0x405c05=[];var _0x29befa=[];delete _0x5ccb7e['id'];delete _0x5ccb7e['createdAt'];delete _0x5ccb7e[_0x3029('0x2b')];var _0x24150d=_0x5ccb7e['interval']!=='*,*,*,*'?[_0x5ccb7e[_0x3029('0x2c')]]:_0x5ccb7e[_0x3029('0x2d')]?_[_0x3029('0x8')](_[_0x3029('0xb')](_0x30f076['intervals'],{'IntervalId':_0x5ccb7e[_0x3029('0x2d')]}),'interval'):[];if(_0x5ccb7e[_0x3029('0xe')]('tag')){if(_0x5ccb7e[_0x3029('0x2e')]&&_0x5ccb7e[_0x3029('0x2e')]!=='--'){_0x405c05[_0x3029('0x11')]({'type':_0x5ccb7e[_0x3029('0x12')],'app':'Set','appdata':_0x3029('0x2f')+_0x5ccb7e[_0x3029('0x2e')],'context':_0x5ccb7e[_0x3029('0x14')],'exten':_0x5ccb7e[_0x3029('0x9')],'priority':_0x24150d[_0x3029('0x30')]+_0x30f076['priority']+_0xa91943++,'VoiceExtensionId':_0x5ccb7e[_0x3029('0x17')]});}}if(_0x5ccb7e[_0x3029('0x12')]===_0x3029('0x18')&&_0x5ccb7e['hasOwnProperty'](_0x3029('0x31'))){if(_0x5ccb7e['callerID']){_0x405c05[_0x3029('0x11')]({'type':_0x5ccb7e[_0x3029('0x12')],'app':_0x3029('0x1f'),'appdata':_0x3029('0x32')+_0x5ccb7e['callerID']+')','context':_0x5ccb7e[_0x3029('0x14')],'exten':_0x5ccb7e[_0x3029('0x9')],'priority':_0x24150d[_0x3029('0x30')]+_0x30f076[_0x3029('0x15')]+_0xa91943++,'VoiceExtensionId':_0x5ccb7e[_0x3029('0x17')]});}else{_0x405c05[_0x3029('0x11')]({'type':_0x5ccb7e[_0x3029('0x12')],'app':_0x3029('0x1f'),'appdata':_0x3029('0x33'),'context':_0x5ccb7e[_0x3029('0x14')],'exten':_0x5ccb7e[_0x3029('0x9')],'priority':_0x24150d[_0x3029('0x30')]+_0x30f076['priority']+_0xa91943++,'VoiceExtensionId':_0x5ccb7e[_0x3029('0x17')]});}}if(_0x5ccb7e[_0x3029('0xe')](_0x3029('0x34'))){if(_0x2fd93d[_0x3029('0x35')](_0x5ccb7e[_0x3029('0x36')][_0x3029('0x37')]())>=0x0&&_0x5ccb7e['appType']!==_0x3029('0x38')){if(_0x5ccb7e[_0x3029('0x34')]){_0x405c05[_0x3029('0x11')]({'type':_0x5ccb7e[_0x3029('0x12')],'app':'ExecIf','appdata':_0x3029('0x39'),'context':_0x5ccb7e[_0x3029('0x14')],'exten':_0x5ccb7e[_0x3029('0x9')],'priority':_0x24150d[_0x3029('0x30')]+_0x30f076[_0x3029('0x15')]+_0xa91943++,'VoiceExtensionId':_0x5ccb7e[_0x3029('0x17')]});_0x405c05[_0x3029('0x11')]({'type':_0x5ccb7e[_0x3029('0x12')],'app':_0x3029('0x1a'),'appdata':_0x3029('0x3a'),'context':_0x5ccb7e[_0x3029('0x14')],'exten':_0x5ccb7e[_0x3029('0x9')],'priority':_0x24150d[_0x3029('0x30')]+_0x30f076[_0x3029('0x15')]+_0xa91943++,'VoiceExtensionId':_0x5ccb7e[_0x3029('0x17')]});}else{_0x405c05[_0x3029('0x11')]({'type':_0x5ccb7e[_0x3029('0x12')],'app':_0x3029('0x1f'),'appdata':_0x3029('0x3b'),'context':_0x5ccb7e[_0x3029('0x14')],'exten':_0x5ccb7e['exten'],'priority':_0x24150d[_0x3029('0x30')]+_0x30f076[_0x3029('0x15')]+_0xa91943++,'VoiceExtensionId':_0x5ccb7e[_0x3029('0x17')]});_0x405c05['push']({'type':_0x5ccb7e[_0x3029('0x12')],'app':_0x3029('0x1a'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5ccb7e[_0x3029('0x14')],'exten':_0x5ccb7e['exten'],'priority':_0x24150d[_0x3029('0x30')]+_0x30f076[_0x3029('0x15')]+_0xa91943++,'VoiceExtensionId':_0x5ccb7e[_0x3029('0x17')]});}}}for(var _0x8265cc=0x0;_0x8265cc<_0x24150d[_0x3029('0x30')];_0x8265cc+=0x1){var _0x2adc8e=_0x30f076[_0x3029('0x15')]+_0x24150d['length'];var _0x1ca7fe=_0x8265cc===_0x24150d['length']-0x1?_0x30f076['priority']+_0x405c05['length']+_0x29befa[_0x3029('0x30')]+0x2:_0x30f076['priority']+_0x8265cc+0x1;_0x405c05[_0x3029('0x3c')](_0x8265cc,0x0,{'type':_0x5ccb7e[_0x3029('0x12')],'app':_0x3029('0x3d'),'appdata':_0x24150d[_0x8265cc]+'?'+_0x5ccb7e[_0x3029('0x14')]+_0x3029('0x3e')+_0x2adc8e+':'+_0x5ccb7e['context']+',${EXTEN},'+_0x1ca7fe,'exten':_0x5ccb7e[_0x3029('0x9')],'context':_0x5ccb7e[_0x3029('0x14')],'priority':_0x30f076['priority']+_0x8265cc,'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]});}_0x5ccb7e[_0x3029('0x15')]=_0x405c05[_0x3029('0x30')]?_[_0x3029('0x3f')](_0x405c05)[_0x3029('0x15')]+0x1:_0x30f076[_0x3029('0x15')];_0x30f076[_0x3029('0x15')]=(_0x29befa['length']?_[_0x3029('0x3f')](_0x29befa)[_0x3029('0x15')]:_0x5ccb7e[_0x3029('0x15')])+0x1;_0x30f076[_0x3029('0x10')]=_[_0x3029('0x40')](_0x30f076['extensions'],_0x405c05,[_0x5ccb7e],_0x29befa);}_0x30f076[_0x3029('0x10')][_0x3029('0x11')]({'type':_0x10e7fc[_0x549e87][0x0][_0x3029('0x12')],'app':_0x3029('0x41'),'exten':_0x10e7fc[_0x549e87][0x0][_0x3029('0x9')],'context':_0x10e7fc[_0x549e87][0x0][_0x3029('0x14')],'priority':_0x30f076['priority'],'VoiceExtensionId':_0x10e7fc[_0x549e87][0x0]['VoiceExtensionId']});_0x1b8e86[_0x3029('0x11')](_0x10e7fc[_0x549e87][0x0][_0x3029('0x17')]);_0x3862f6=_[_0x3029('0x40')](_0x3862f6,_0x30f076[_0x3029('0x10')]);}}return _0x5b8759[_0x3029('0x42')](function(_0x3c70c6){return _0x5b8759[_0x3029('0x1')][_0x3029('0x5')][_0x3029('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x1b8e86}},'transaction':_0x3c70c6})['then'](function(_0xcedff2){return _0x5b8759[_0x3029('0x1')][_0x3029('0x5')]['bulkCreate'](_[_0x3029('0x44')](_0x3862f6,_0x3029('0x15')),{'transaction':_0x3c70c6});});});})[_0x3029('0x45')](function(_0x3b58bc){console[_0x3029('0x46')](_0x3b58bc);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x676e=['VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','extension','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','Interval','then','intervals','models','VoiceExtension','findAll','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','type','Set','format','CDR(type)=%s','context'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x676e,0xcd));var _0xe676=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0x676e[_0x1c5950];return _0x2b720a;};'use strict';var _=require(_0xe676('0x0'));var util=require(_0xe676('0x1'));function rewrite(_0x520330,_0x4cd129){var _0x14716c=this;return _0x520330['models'][_0xe676('0x2')]['findAll']({'raw':!![]})[_0xe676('0x3')](function(_0x33dd7c){_0x14716c[_0xe676('0x4')]=_0x33dd7c;return _0x520330[_0xe676('0x5')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x4cd129['IntervalId']},'raw':!![]});})[_0xe676('0x3')](function(_0x2045f4){return _0x520330[_0xe676('0x5')][_0xe676('0x6')][_0xe676('0x7')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x2045f4,_0xe676('0x8')))}},'order':[{'raw':_0xe676('0x9')}],'raw':!![]});})[_0xe676('0x3')](function(_0x48c9e5){var _0x471113=_[_0xe676('0xa')](_0x48c9e5,{'priority':'1'});var _0x55098b=_[_0xe676('0xa')](_0x48c9e5,{'isApp':0x1});var _0x35acd3=_[_0xe676('0xb')](_0x55098b,'exten');var _0x46c16e=[_0xe676('0xc'),_0xe676('0xd')];var _0x2270e4=[];var _0x4d0c58=[];for(var _0x4bb3ef in _0x35acd3){if(_0x35acd3[_0xe676('0xe')](_0x4bb3ef)){_0x14716c[_0xe676('0xf')]=0x2;_0x14716c[_0xe676('0x10')]=[];_0x14716c['extension']=_[_0xe676('0x11')](_0x471113,{'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')]});_0x14716c[_0xe676('0x10')]['push']({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':_0xe676('0x13'),'appdata':util[_0xe676('0x14')](_0xe676('0x15'),_0x35acd3[_0x4bb3ef][0x0]['type']),'context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0]['exten'],'priority':_0x14716c[_0xe676('0xf')]++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});if(_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')]===_0xe676('0x18')){_0x14716c[_0xe676('0x10')][_0xe676('0x19')]({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':_0xe676('0x13'),'appdata':_0xe676('0x1a')+_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')],'context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')],'priority':_0x14716c[_0xe676('0xf')]++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0]['VoiceExtensionId']});}else if(_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')]===_0xe676('0x1b')){if(_0x14716c[_0xe676('0x1c')]){_0x14716c[_0xe676('0x10')][_0xe676('0x19')]({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':'Set','appdata':'CDR(destination)='+(_0x14716c[_0xe676('0x1c')][_0xe676('0x1d')]?_0xe676('0x1e')+_0x14716c['extension']['cutdigits']+'}':_0xe676('0x1f')),'context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0]['exten'],'priority':_0x14716c['priority']++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});}_0x14716c[_0xe676('0x10')][_0xe676('0x19')]({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':_0xe676('0x13'),'appdata':'CDR(routeid)='+_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')],'context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')],'priority':_0x14716c[_0xe676('0xf')]++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0]['VoiceExtensionId']});var _0x1c0e2c=_0x14716c[_0xe676('0xf')]++;_0x14716c[_0xe676('0x10')][_0xe676('0x19')]({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':'ExecIf','appdata':_0xe676('0x20')+(_0x1c0e2c+0x2)+_0xe676('0x21')+(_0x1c0e2c+0x1)+')','context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0]['exten'],'priority':_0x1c0e2c,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});if(_0x14716c[_0xe676('0x1c')]){_0x14716c['extensions'][_0xe676('0x19')]({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':'Set','appdata':_0x14716c[_0xe676('0x1c')][_0xe676('0x1d')]?_0xe676('0x22')+_0x14716c[_0xe676('0x1c')][_0xe676('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')],'priority':_0x14716c['priority']++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});}_0x14716c[_0xe676('0x10')]['push']({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':_0xe676('0x13'),'appdata':_0xe676('0x23')+_0x35acd3[_0x4bb3ef][0x0]['VoiceExtensionId'],'context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')],'priority':_0x14716c['priority']++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});if(_0x14716c[_0xe676('0x1c')]&&_0x14716c['extension'][_0xe676('0xe')]('recordingFormat')&&_0x14716c['extension'][_0xe676('0x24')]!=='none'){_0x14716c[_0xe676('0x10')]['push']({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':'Set','appdata':_0xe676('0x25'),'context':_0x35acd3[_0x4bb3ef][0x0]['context'],'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')],'priority':_0x14716c[_0xe676('0xf')]++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});_0x14716c[_0xe676('0x10')][_0xe676('0x19')]({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':_0xe676('0x13'),'appdata':_0xe676('0x26')+_0x14716c[_0xe676('0x1c')][_0xe676('0x24')]||_0xe676('0x27'),'context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0]['exten'],'priority':_0x14716c[_0xe676('0xf')]++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0]['VoiceExtensionId']});}}_0x14716c[_0xe676('0x10')][_0xe676('0x19')]({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':'Set','appdata':_0xe676('0x28'),'context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')],'priority':_0x14716c['priority']++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});_0x14716c['extensions'][_0xe676('0x19')]({'type':_0x35acd3[_0x4bb3ef][0x0]['type'],'app':_0xe676('0x13'),'appdata':_0xe676('0x29'),'context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')],'priority':_0x14716c[_0xe676('0xf')]++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0]['VoiceExtensionId']});_0x14716c[_0xe676('0x10')]['push']({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':_0xe676('0x13'),'appdata':_0xe676('0x2a'),'context':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x16')],'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')],'priority':_0x14716c['priority']++,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});for(var _0x32c02f=0x0,_0xe2c62a=0x0;_0x32c02f<_0x35acd3[_0x4bb3ef][_0xe676('0x2b')];_0x32c02f+=0x1,_0xe2c62a=0x0){var _0x4dd0e0=_0x35acd3[_0x4bb3ef][_0x32c02f];if(_0x4dd0e0[_0xe676('0x12')]){_0x4dd0e0[_0xe676('0x12')]=_0x4dd0e0['type'][_0xe676('0x2c')]();}var _0x2329da=[];var _0x10241c=[];delete _0x4dd0e0['id'];delete _0x4dd0e0[_0xe676('0x2d')];delete _0x4dd0e0[_0xe676('0x2e')];var _0x3c8a4c=_0x4dd0e0[_0xe676('0x2f')]!==_0xe676('0x30')?[_0x4dd0e0[_0xe676('0x2f')]]:_0x4dd0e0[_0xe676('0x31')]?_[_0xe676('0x32')](_['filter'](_0x14716c[_0xe676('0x4')],{'IntervalId':_0x4dd0e0[_0xe676('0x31')]}),_0xe676('0x2f')):[];if(_0x4dd0e0[_0xe676('0xe')](_0xe676('0x33'))){if(_0x4dd0e0[_0xe676('0x33')]&&_0x4dd0e0[_0xe676('0x33')]!=='--'){_0x2329da[_0xe676('0x19')]({'type':_0x4dd0e0[_0xe676('0x12')],'app':_0xe676('0x13'),'appdata':_0xe676('0x34')+_0x4dd0e0[_0xe676('0x33')],'context':_0x4dd0e0[_0xe676('0x16')],'exten':_0x4dd0e0['exten'],'priority':_0x3c8a4c['length']+_0x14716c[_0xe676('0xf')]+_0xe2c62a++,'VoiceExtensionId':_0x4dd0e0[_0xe676('0x17')]});}}if(_0x4dd0e0[_0xe676('0x12')]===_0xe676('0x1b')&&_0x4dd0e0[_0xe676('0xe')]('callerID')){if(_0x4dd0e0[_0xe676('0x35')]){_0x2329da[_0xe676('0x19')]({'type':_0x4dd0e0[_0xe676('0x12')],'app':_0xe676('0x36'),'appdata':_0xe676('0x37')+_0x4dd0e0[_0xe676('0x35')]+')','context':_0x4dd0e0[_0xe676('0x16')],'exten':_0x4dd0e0[_0xe676('0x8')],'priority':_0x3c8a4c[_0xe676('0x2b')]+_0x14716c['priority']+_0xe2c62a++,'VoiceExtensionId':_0x4dd0e0['VoiceExtensionId']});}else{_0x2329da[_0xe676('0x19')]({'type':_0x4dd0e0[_0xe676('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4dd0e0[_0xe676('0x16')],'exten':_0x4dd0e0[_0xe676('0x8')],'priority':_0x3c8a4c[_0xe676('0x2b')]+_0x14716c[_0xe676('0xf')]+_0xe2c62a++,'VoiceExtensionId':_0x4dd0e0['VoiceExtensionId']});}}if(_0x4dd0e0[_0xe676('0xe')](_0xe676('0x38'))){if(_0x46c16e[_0xe676('0x39')](_0x4dd0e0[_0xe676('0x3a')][_0xe676('0x2c')]())>=0x0&&_0x4dd0e0[_0xe676('0x3b')]!==_0xe676('0x3c')){if(_0x4dd0e0[_0xe676('0x38')]){_0x2329da[_0xe676('0x19')]({'type':_0x4dd0e0[_0xe676('0x12')],'app':_0xe676('0x36'),'appdata':_0xe676('0x3d'),'context':_0x4dd0e0[_0xe676('0x16')],'exten':_0x4dd0e0[_0xe676('0x8')],'priority':_0x3c8a4c['length']+_0x14716c[_0xe676('0xf')]+_0xe2c62a++,'VoiceExtensionId':_0x4dd0e0[_0xe676('0x17')]});_0x2329da[_0xe676('0x19')]({'type':_0x4dd0e0[_0xe676('0x12')],'app':_0xe676('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4dd0e0[_0xe676('0x16')],'exten':_0x4dd0e0['exten'],'priority':_0x3c8a4c[_0xe676('0x2b')]+_0x14716c['priority']+_0xe2c62a++,'VoiceExtensionId':_0x4dd0e0[_0xe676('0x17')]});}else{_0x2329da[_0xe676('0x19')]({'type':_0x4dd0e0[_0xe676('0x12')],'app':'ExecIf','appdata':_0xe676('0x3e'),'context':_0x4dd0e0[_0xe676('0x16')],'exten':_0x4dd0e0['exten'],'priority':_0x3c8a4c[_0xe676('0x2b')]+_0x14716c['priority']+_0xe2c62a++,'VoiceExtensionId':_0x4dd0e0[_0xe676('0x17')]});_0x2329da[_0xe676('0x19')]({'type':_0x4dd0e0[_0xe676('0x12')],'app':_0xe676('0x13'),'appdata':_0xe676('0x3f'),'context':_0x4dd0e0[_0xe676('0x16')],'exten':_0x4dd0e0[_0xe676('0x8')],'priority':_0x3c8a4c[_0xe676('0x2b')]+_0x14716c[_0xe676('0xf')]+_0xe2c62a++,'VoiceExtensionId':_0x4dd0e0[_0xe676('0x17')]});}}}for(var _0x1d91c2=0x0;_0x1d91c2<_0x3c8a4c['length'];_0x1d91c2+=0x1){var _0x403aa=_0x14716c[_0xe676('0xf')]+_0x3c8a4c[_0xe676('0x2b')];var _0x5da622=_0x1d91c2===_0x3c8a4c[_0xe676('0x2b')]-0x1?_0x14716c['priority']+_0x2329da[_0xe676('0x2b')]+_0x10241c['length']+0x2:_0x14716c['priority']+_0x1d91c2+0x1;_0x2329da['splice'](_0x1d91c2,0x0,{'type':_0x4dd0e0['type'],'app':_0xe676('0x40'),'appdata':_0x3c8a4c[_0x1d91c2]+'?'+_0x4dd0e0[_0xe676('0x16')]+_0xe676('0x41')+_0x403aa+':'+_0x4dd0e0[_0xe676('0x16')]+_0xe676('0x41')+_0x5da622,'exten':_0x4dd0e0['exten'],'context':_0x4dd0e0['context'],'priority':_0x14716c[_0xe676('0xf')]+_0x1d91c2,'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});}_0x4dd0e0[_0xe676('0xf')]=_0x2329da[_0xe676('0x2b')]?_[_0xe676('0x42')](_0x2329da)[_0xe676('0xf')]+0x1:_0x14716c[_0xe676('0xf')];_0x14716c[_0xe676('0xf')]=(_0x10241c[_0xe676('0x2b')]?_[_0xe676('0x42')](_0x10241c)[_0xe676('0xf')]:_0x4dd0e0[_0xe676('0xf')])+0x1;_0x14716c[_0xe676('0x10')]=_[_0xe676('0x43')](_0x14716c['extensions'],_0x2329da,[_0x4dd0e0],_0x10241c);}_0x14716c['extensions']['push']({'type':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x12')],'app':_0xe676('0x44'),'exten':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x8')],'context':_0x35acd3[_0x4bb3ef][0x0]['context'],'priority':_0x14716c['priority'],'VoiceExtensionId':_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]});_0x2270e4[_0xe676('0x19')](_0x35acd3[_0x4bb3ef][0x0][_0xe676('0x17')]);_0x4d0c58=_[_0xe676('0x43')](_0x4d0c58,_0x14716c[_0xe676('0x10')]);}}return _0x520330[_0xe676('0x45')](function(_0x2dc348){return _0x520330[_0xe676('0x5')][_0xe676('0x6')][_0xe676('0x46')]({'where':{'VoiceExtensionId':{'$in':_0x2270e4}},'transaction':_0x2dc348})['then'](function(_0x5c0c0d){return _0x520330['models'][_0xe676('0x6')][_0xe676('0x47')](_[_0xe676('0x48')](_0x4d0c58,_0xe676('0xf')),{'transaction':_0x2dc348});});});})[_0xe676('0x49')](function(_0x437030){console[_0xe676('0x4a')](_0x437030);});}exports[_0xe676('0x4b')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2d42fa3..995cf85 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 _0x5d93=['keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','str','cm_hopper_final','into','id\x20IN\x20?','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','outbound','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','stringify','exit','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create'];(function(_0x559f44,_0xbaca17){var _0x43ff05=function(_0x360272){while(--_0x360272){_0x559f44['push'](_0x559f44['shift']());}};_0x43ff05(++_0xbaca17);}(_0x5d93,0x189));var _0x35d9=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x5d93[_0x4fbfd9];return _0x31dc94;};'use strict';var BPromise=require(_0x35d9('0x0'));var util=require(_0x35d9('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x35d9('0x2'));var Papa=require(_0x35d9('0x3'));var Redis=require(_0x35d9('0x4'));var db=require(_0x35d9('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x35d9('0x6'));config[_0x35d9('0x7')]=_[_0x35d9('0x8')](config[_0x35d9('0x7')],{'host':_0x35d9('0x9'),'port':0x18eb});var socket=require(_0x35d9('0xa'))(new Redis(config[_0x35d9('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0x35d9('0xb')](socket);try{if(!process[_0x35d9('0xc')][0x2]||process[_0x35d9('0xc')][0x2]===_0x35d9('0xd')||process[_0x35d9('0xc')][0x2]===_0x35d9('0xe')){throw new Error(_0x35d9('0xf'));}var FILEPATH=process[_0x35d9('0xc')][0x2];if(!process[_0x35d9('0xc')][0x3]||process[_0x35d9('0xc')][0x3]==='undefined'||process['argv'][0x3]===_0x35d9('0xe')||!process[_0x35d9('0xc')][0x4]||process[_0x35d9('0xc')][0x4]==='undefined'||process[_0x35d9('0xc')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x35d9('0x10')](process[_0x35d9('0xc')][0x3][_0x35d9('0x11')](','),process['argv'][0x4][_0x35d9('0x11')](','));if(!process[_0x35d9('0xc')][0x5]||process['argv'][0x5]===_0x35d9('0xd')||process[_0x35d9('0xc')][0x5]===_0x35d9('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x35d9('0xc')][0x5];var COMPANYID=process[_0x35d9('0xc')][0x6]&&process[_0x35d9('0xc')][0x6]!=='undefined'&&process[_0x35d9('0xc')][0x6]!==_0x35d9('0xe')?process['argv'][0x6]:null;var DUPLICATES=process[_0x35d9('0xc')][0x7]&&process[_0x35d9('0xc')][0x7]!==_0x35d9('0xd')&&process[_0x35d9('0xc')][0x7]!==_0x35d9('0xe')?process[_0x35d9('0xc')][0x7]:null;if(!process[_0x35d9('0xc')][0x8]||process[_0x35d9('0xc')][0x8]==='undefined'||process[_0x35d9('0xc')][0x8]===_0x35d9('0xe')){throw new Error(_0x35d9('0x12'));}var SOCKET_TIMESTAMP=process[_0x35d9('0xc')][0x8];}catch(_0x524c96){logger[_0x35d9('0x13')](_0x524c96);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(_0x563fcc,_0x2f8c8c,_0x218ab5,_0x3909da){var _0x387177={'message':_0x2f8c8c};_0x387177[_0x563fcc]=!![];if(_0x218ab5){_0x387177[_0x35d9('0x14')]=_0x218ab5;}if(_0x3909da){_0x387177[_0x35d9('0x15')]=_0x3909da;}return _0x387177;}function isEmail(_0x4bb16d){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))*$/[_0x35d9('0x16')](_0x4bb16d);}function checkRow(_0x3ffcad,_0x3afae7,_0xd14fa){return new BPromise(function(_0x22dbf6,_0x160483){if(_[_0x35d9('0x17')](_0x3ffcad)){return _0x160483(handleCheckRowError(_0x35d9('0x13'),_0x35d9('0x18'),null,_0xd14fa));}if(_0x3ffcad[_0x35d9('0x19')]&&_0x3ffcad[_0x35d9('0x19')][_0x35d9('0x1a')]){var _0x336be6=_[_0x35d9('0x1b')](_0x3ffcad['errors'],_0x35d9('0x1c'))['join'](';');return _0x160483(handleCheckRowError(_0x35d9('0x13'),_0x336be6,null,_0xd14fa));}var _0x83d1cb={};for(var _0x2408ef in FIELDS){if(FIELDS[_0x35d9('0x1d')](_0x2408ef)&&FIELDS[_0x2408ef]){_0x83d1cb[_0x2408ef]=_0x3ffcad[_0x35d9('0x1e')][0x0][FIELDS[_0x2408ef]]||_0x3ffcad['data'][0x0]['\ufeff'+FIELDS[_0x2408ef]];}}if(!_0x83d1cb[_0x35d9('0x1f')]){return _0x160483(handleCheckRowError(_0x35d9('0x13'),_0x35d9('0x20'),null,_0xd14fa));}if(!_0x83d1cb[_0x35d9('0x21')]){return _0x160483(handleCheckRowError('error',_0x35d9('0x22'),null,_0xd14fa));}if(_0x83d1cb[_0x35d9('0x23')]){var _0xe63f66=moment(_0x83d1cb[_0x35d9('0x23')],_0x35d9('0x24'));if(!_0xe63f66[_0x35d9('0x25')]()){return _0x160483(handleCheckRowError(_0x35d9('0x13'),_0x35d9('0x26'),null,_0xd14fa));}}if(_0x83d1cb[_0x35d9('0x27')]){if(!isEmail(_0x83d1cb[_0x35d9('0x27')])){return _0x160483(handleCheckRowError('error',_0x35d9('0x28'),null,_0xd14fa));}}_0x83d1cb[_0x35d9('0x29')]=LISTID;_0x83d1cb[_0x35d9('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x35d9('0x1a')]&&_0x3afae7){var _0x59fa62={};for(var _0x14ebed=0x0,_0x5a9df1=DUPLICATES[_0x35d9('0x1a')];_0x14ebed<_0x5a9df1;_0x14ebed+=0x1){_0x59fa62[DUPLICATES[_0x14ebed]]=_0x83d1cb[DUPLICATES[_0x14ebed]];}var _0x4d18e9=_['find'](_0x3afae7,_0x59fa62);if(_0x4d18e9){return _0x160483(handleCheckRowError(_0x35d9('0x2b'),_0x35d9('0x2c'),_0x4d18e9,_0xd14fa));}}return db[_0x35d9('0x2d')][_0x35d9('0x2e')](_0x83d1cb,{'raw':!![],'hooks':![],'fields':_[_0x35d9('0x2f')](_0x83d1cb)})[_0x35d9('0x30')](function(_0x31aeb2){if(DUPLICATES&&DUPLICATES[_0x35d9('0x1a')]&&_0x3afae7){_0x3afae7[_0x35d9('0x31')](_[_0x35d9('0x32')](_0x83d1cb,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x31aeb2['id'];return _0x22dbf6();})[_0x35d9('0x33')](function(_0xe06651){return _0x160483(handleCheckRowError(_0x35d9('0x13'),_0x35d9('0x34')+(_0xe06651[_0x35d9('0x1c')]||JSON['stringify'](_0xe06651)),null,_0xd14fa));});});}function checkHopper(){function _0xe0266e(){return function(_0x5a7fb3){logger[_0x35d9('0x13')](_0x35d9('0x35'),_0x35d9('0x36'),util[_0x35d9('0x37')](_0x5a7fb3,{'showHidden':![],'depth':null}));};}var _0x508790=function(_0x593c90,_0x3a11bc){var _0x8424cf=squel[_0x35d9('0x38')]()['into']('cm_hopper')[_0x35d9('0x39')](['phone','scheduledAt',_0x35d9('0x3a'),_0x35d9('0x29'),_0x3a11bc,_0x35d9('0x3b'),_0x35d9('0x3c')],squel[_0x35d9('0x3d')]()[_0x35d9('0x3e')]('phone',_0x35d9('0x21'))[_0x35d9('0x3e')](_0x35d9('0x3f'),_0x35d9('0x40'))[_0x35d9('0x3e')]('id',_0x35d9('0x3a'))['field'](LISTID[_0x35d9('0x41')](),'ListId')[_0x35d9('0x3e')](_0x593c90['id']['toString'](),_0x3a11bc)[_0x35d9('0x3e')](_0x35d9('0x3f'),_0x35d9('0x3b'))[_0x35d9('0x3e')](_0x35d9('0x3f'),'updatedAt')[_0x35d9('0x42')](_0x35d9('0x43'))[_0x35d9('0x44')](_0x35d9('0x45'))[_0x35d9('0x44')](_0x35d9('0x46'),LISTID[_0x35d9('0x41')]())[_0x35d9('0x44')](_0x35d9('0x47'))['where'](_0x35d9('0x48'),squel[_0x35d9('0x3d')]()[_0x35d9('0x3e')](_0x35d9('0x21'))['from'](_0x35d9('0x49'))[_0x35d9('0x44')](_0x3a11bc+_0x35d9('0x4a'),_0x593c90['id'][_0x35d9('0x41')]())))['toString']();return _0x8424cf;};var _0x171393=function(_0x3bb503,_0x26bc8f){var _0x411df1=squel['insert']()['into'](_0x35d9('0x49'))['fromQuery']([_0x35d9('0x21'),'scheduledAt',_0x35d9('0x3a'),_0x35d9('0x29'),_0x26bc8f,_0x35d9('0x3b'),_0x35d9('0x3c')],squel[_0x35d9('0x3d')]()[_0x35d9('0x3e')](_0x35d9('0x21'),'phone')[_0x35d9('0x3e')](_0x35d9('0x3f'),_0x35d9('0x40'))[_0x35d9('0x3e')]('id',_0x35d9('0x3a'))[_0x35d9('0x3e')](LISTID[_0x35d9('0x41')](),'ListId')['field'](_0x3bb503['id'][_0x35d9('0x41')](),_0x26bc8f)['field'](_0x35d9('0x3f'),_0x35d9('0x3b'))[_0x35d9('0x3e')](_0x35d9('0x3f'),_0x35d9('0x3c'))[_0x35d9('0x42')](_0x35d9('0x43'))[_0x35d9('0x44')](_0x35d9('0x45'))['where'](_0x35d9('0x46'),LISTID[_0x35d9('0x41')]())[_0x35d9('0x44')]('id\x20IN\x20?',squel[_0x35d9('0x4b')](hopperContacts))[_0x35d9('0x44')](_0x35d9('0x47'))['where'](_0x35d9('0x48'),squel['select']()[_0x35d9('0x3e')]('calleridnum')[_0x35d9('0x42')](_0x35d9('0x4c'))[_0x35d9('0x44')](_0x26bc8f+_0x35d9('0x4a'),_0x3bb503['id'][_0x35d9('0x41')]()))[_0x35d9('0x44')](_0x35d9('0x48'),squel[_0x35d9('0x3d')]()[_0x35d9('0x3e')]('phone')[_0x35d9('0x42')](_0x35d9('0x49'))['where'](_0x26bc8f+_0x35d9('0x4a'),_0x3bb503['id']['toString']())))[_0x35d9('0x41')]();return _0x411df1;};function _0x5b66f6(_0x169214,_0x35a95b){var _0x374310=squel['insert']()[_0x35d9('0x4d')](_0x35d9('0x49'))['fromQuery']([_0x35d9('0x21'),_0x35d9('0x40'),_0x35d9('0x3a'),_0x35d9('0x29'),_0x35a95b,_0x35d9('0x3b'),'updatedAt'],squel[_0x35d9('0x3d')]()[_0x35d9('0x3e')](_0x35d9('0x21'),_0x35d9('0x21'))[_0x35d9('0x3e')](_0x35d9('0x3f'),_0x35d9('0x40'))[_0x35d9('0x3e')]('id',_0x35d9('0x3a'))['field'](LISTID[_0x35d9('0x41')](),_0x35d9('0x29'))[_0x35d9('0x3e')](_0x169214['id']['toString'](),_0x35a95b)[_0x35d9('0x3e')](_0x35d9('0x3f'),_0x35d9('0x3b'))[_0x35d9('0x3e')](_0x35d9('0x3f'),'updatedAt')['from'](_0x35d9('0x43'))[_0x35d9('0x44')](_0x35d9('0x45'))[_0x35d9('0x44')](_0x35d9('0x46'),LISTID['toString']())[_0x35d9('0x44')]('id\x20IN\x20?',squel[_0x35d9('0x4b')](hopperContacts))['where'](_0x35d9('0x47')))['toString']();return _0x374310;}function _0x3aac8c(_0x41a089,_0x3b463b){var _0x540a98=squel[_0x35d9('0x38')]()[_0x35d9('0x4d')]('cm_hopper_black')['fromQuery']([_0x35d9('0x21'),_0x35d9('0x3a'),_0x35d9('0x29'),_0x3b463b,_0x35d9('0x3b'),_0x35d9('0x3c')],squel[_0x35d9('0x3d')]()[_0x35d9('0x3e')]('phone',_0x35d9('0x21'))[_0x35d9('0x3e')]('id',_0x35d9('0x3a'))['field'](LISTID[_0x35d9('0x41')](),_0x35d9('0x29'))['field'](_0x41a089['id'][_0x35d9('0x41')](),_0x3b463b)[_0x35d9('0x3e')](_0x35d9('0x3f'),'createdAt')[_0x35d9('0x3e')](_0x35d9('0x3f'),_0x35d9('0x3c'))[_0x35d9('0x42')](_0x35d9('0x43'))['where'](_0x35d9('0x45'))[_0x35d9('0x44')](_0x35d9('0x46'),LISTID[_0x35d9('0x41')]())['where'](_0x35d9('0x4e'),squel[_0x35d9('0x4b')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x540a98;}return db[_0x35d9('0x4f')][_0x35d9('0x50')]({'where':{'type':'outbound'},'attributes':['id',_0x35d9('0x51')],'include':[{'model':db[_0x35d9('0x52')],'as':_0x35d9('0x53'),'where':{'id':LISTID}}]})[_0x35d9('0x30')](function(_0x2af5de){var _0x2a5e03=[];if(_0x2af5de){var _0x1d0d6b;for(var _0x51a569=0x0,_0x5a547e;_0x51a569<_0x2af5de[_0x35d9('0x1a')];_0x51a569+=0x1){_0x5a547e=_0x2af5de[_0x51a569]['get']({'plain':!![]});switch(_0x5a547e[_0x35d9('0x51')]){case _0x35d9('0x54'):_0x2a5e03[_0x35d9('0x31')](db[_0x35d9('0x55')][_0x35d9('0x56')](_0x171393(_0x5a547e,_0x35d9('0x57')))[_0x35d9('0x30')](function(){})[_0x35d9('0x33')](_0xe0266e()));break;case _0x35d9('0x58'):_0x2a5e03[_0x35d9('0x31')](db[_0x35d9('0x55')][_0x35d9('0x56')](_0x508790(_0x5a547e,'VoiceQueueId'))[_0x35d9('0x30')](function(){})[_0x35d9('0x33')](_0xe0266e()));break;default:_0x2a5e03[_0x35d9('0x31')](db[_0x35d9('0x55')][_0x35d9('0x56')](_0x5b66f6(_0x5a547e,'VoiceQueueId'))['then'](function(){})[_0x35d9('0x33')](_0xe0266e()));}}}return _0x2a5e03;})[_0x35d9('0x59')]()[_0x35d9('0x30')](function(){return db['VoiceQueue'][_0x35d9('0x50')]({'where':{'type':_0x35d9('0x5a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x35d9('0x30')](function(_0x27d0f0){var _0x1b7114=[];if(_0x27d0f0){var _0x3fa03a;for(var _0x221e2c=0x0,_0x34a787;_0x221e2c<_0x27d0f0['length'];_0x221e2c+=0x1){_0x34a787=_0x27d0f0[_0x221e2c][_0x35d9('0x5b')]({'plain':!![]});_0x1b7114[_0x35d9('0x31')](db[_0x35d9('0x55')][_0x35d9('0x56')](_0x3aac8c(_0x34a787,_0x35d9('0x57')))[_0x35d9('0x30')](function(){})['catch'](_0xe0266e()));}}return _0x1b7114;})[_0x35d9('0x59')]();})[_0x35d9('0x30')](function(){return db[_0x35d9('0x5c')][_0x35d9('0x50')]({'attributes':['id',_0x35d9('0x51')],'include':[{'model':db[_0x35d9('0x52')],'as':_0x35d9('0x53'),'where':{'id':LISTID}}]})['then'](function(_0x416ac9){var _0x5da2e1=[];if(_0x416ac9){for(var _0x10a793=0x0,_0x52526e;_0x10a793<_0x416ac9[_0x35d9('0x1a')];_0x10a793+=0x1){_0x52526e=_0x416ac9[_0x10a793]['get']({'plain':!![]});switch(_0x52526e[_0x35d9('0x51')]){case _0x35d9('0x54'):_0x5da2e1[_0x35d9('0x31')](db[_0x35d9('0x55')][_0x35d9('0x56')](_0x171393(_0x52526e,'CampaignId'))[_0x35d9('0x30')](function(){})[_0x35d9('0x33')](_0xe0266e()));break;case'onlyIfOpen':_0x5da2e1[_0x35d9('0x31')](db['sequelize'][_0x35d9('0x56')](_0x508790(_0x52526e,_0x35d9('0x5d')))[_0x35d9('0x30')](function(){})[_0x35d9('0x33')](_0xe0266e()));break;default:_0x5da2e1[_0x35d9('0x31')](db[_0x35d9('0x55')][_0x35d9('0x56')](_0x5b66f6(_0x52526e,_0x35d9('0x5d')))[_0x35d9('0x30')](function(){})[_0x35d9('0x33')](_0xe0266e()));}}}return _0x5da2e1;})['all']();})['then'](function(){return db['Campaign'][_0x35d9('0x50')]({'attributes':['id'],'include':[{'model':db[_0x35d9('0x52')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x35d9('0x30')](function(_0x52240f){var _0x15cec1=[];if(_0x52240f){for(var _0x327fc1=0x0,_0x16acd9;_0x327fc1<_0x52240f[_0x35d9('0x1a')];_0x327fc1+=0x1){_0x16acd9=_0x52240f[_0x327fc1][_0x35d9('0x5b')]({'plain':!![]});_0x15cec1[_0x35d9('0x31')](db[_0x35d9('0x55')][_0x35d9('0x56')](_0x3aac8c(_0x16acd9,_0x35d9('0x5d')))[_0x35d9('0x30')](function(){})['catch'](_0xe0266e()));}}return _0x15cec1;})['all']();})['catch'](function(_0x288551){logger[_0x35d9('0x13')](_0x35d9('0x5e'),'generalCheckHopper',_0x288551[_0x35d9('0x1c')]);});}var processPromises=function(_0x55e382){return BPromise[_0x35d9('0x59')](promises)[_0x35d9('0x30')](function(_0x2276ae){})[_0x35d9('0x33')](function(_0x2a1309){logger[_0x35d9('0x13')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x2a1309));})[_0x35d9('0x5f')](function(){socket[_0x35d9('0x60')](_0x35d9('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x55e382){return _0x55e382[_0x35d9('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x35d9('0x30')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x35d9('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x35d9('0x63')](FILEPATH);}catch(_0x5585bf){logger[_0x35d9('0x13')](_0x35d9('0x64'),JSON[_0x35d9('0x65')](_0x5585bf));}finally{process[_0x35d9('0x66')](0x0);}});};process['on']('SIGINT',function(){logger[_0x35d9('0x67')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x35d9('0x11')](',');return db[_0x35d9('0x2d')][_0x35d9('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x35d9('0x30')](function(_0x3f5626){var _0x495a66=fs[_0x35d9('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x35d9('0x69')](_0x495a66,{'header':!![],'skipEmptyLines':!![],'step':function(_0x52d1e3,_0x22e3d5){total+=0x1;var _0x398d4e=total;promises[_0x35d9('0x31')](checkRow(_0x52d1e3,_0x3f5626,_0x398d4e)[_0x35d9('0x30')](function(){success+=0x1;})[_0x35d9('0x33')](function(_0x31ca4e){if(_0x31ca4e[_0x35d9('0x13')]){errors+=0x1;delete _0x31ca4e['error'];}else if(_0x31ca4e[_0x35d9('0x2b')]){duplicates+=0x1;delete _0x31ca4e[_0x35d9('0x2b')];}rows[_0x35d9('0x31')](_0x31ca4e);}));if(total%0xc8===0x0){_0x22e3d5[_0x35d9('0x6a')]();return processPromises(_0x22e3d5);}},'complete':function(){return processPromises()[_0x35d9('0x30')](function(){logger[_0x35d9('0x67')](_0x35d9('0x6b'));endCsv();});},'error':function(_0x536630,_0xbb0343){logger[_0x35d9('0x67')](_0x35d9('0x6c'),JSON[_0x35d9('0x65')](_0x536630));endCsv();}});})[_0x35d9('0x33')](function(_0x5ce8c2){logger[_0x35d9('0x13')](_0x35d9('0x6d'),JSON[_0x35d9('0x65')](_0x5ce8c2));});}main(); \ No newline at end of file +var _0x9cc8=['contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','cm_hopper_final','ListId\x20=\x20?','str','cm_hopper_black','VoiceQueue','outbound','Lists','then','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','CmList','BlackLists','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit'];(function(_0x4f7cf,_0x43bf1a){var _0x83883=function(_0xf60b8b){while(--_0xf60b8b){_0x4f7cf['push'](_0x4f7cf['shift']());}};_0x83883(++_0x43bf1a);}(_0x9cc8,0x83));var _0x89cc=function(_0x2a6f57,_0x530329){_0x2a6f57=_0x2a6f57-0x0;var _0x2969f1=_0x9cc8[_0x2a6f57];return _0x2969f1;};'use strict';var BPromise=require(_0x89cc('0x0'));var util=require(_0x89cc('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x89cc('0x2'));var Redis=require(_0x89cc('0x3'));var db=require(_0x89cc('0x4'))['db'];var config=require(_0x89cc('0x5'));var logger=require(_0x89cc('0x6'))(_0x89cc('0x7'));config['redis']=_[_0x89cc('0x8')](config[_0x89cc('0x9')],{'host':_0x89cc('0xa'),'port':0x18eb});var socket=require(_0x89cc('0xb'))(new Redis(config[_0x89cc('0x9')]));require(_0x89cc('0xc'))[_0x89cc('0xd')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x89cc('0xe')||process[_0x89cc('0xf')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x89cc('0xf')][0x2];if(!process[_0x89cc('0xf')][0x3]||process[_0x89cc('0xf')][0x3]===_0x89cc('0xe')||process[_0x89cc('0xf')][0x3]===_0x89cc('0x10')||!process[_0x89cc('0xf')][0x4]||process[_0x89cc('0xf')][0x4]==='undefined'||process[_0x89cc('0xf')][0x4]==='null'){throw new Error(_0x89cc('0x11'));}var FIELDS=_[_0x89cc('0x12')](process[_0x89cc('0xf')][0x3][_0x89cc('0x13')](','),process['argv'][0x4][_0x89cc('0x13')](','));if(!process['argv'][0x5]||process[_0x89cc('0xf')][0x5]===_0x89cc('0xe')||process[_0x89cc('0xf')][0x5]==='null'){throw new Error(_0x89cc('0x14'));}var LISTID=process[_0x89cc('0xf')][0x5];var COMPANYID=process[_0x89cc('0xf')][0x6]&&process[_0x89cc('0xf')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x89cc('0x10')?process[_0x89cc('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x89cc('0xe')&&process[_0x89cc('0xf')][0x7]!==_0x89cc('0x10')?process[_0x89cc('0xf')][0x7]:null;if(!process['argv'][0x8]||process[_0x89cc('0xf')][0x8]===_0x89cc('0xe')||process['argv'][0x8]===_0x89cc('0x10')){throw new Error(_0x89cc('0x15'));}var SOCKET_TIMESTAMP=process[_0x89cc('0xf')][0x8];}catch(_0x272201){logger[_0x89cc('0x16')](_0x272201);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(_0x6f6293,_0x14315a,_0x4d53f5,_0x566620){var _0x467b83={'message':_0x14315a};_0x467b83[_0x6f6293]=!![];if(_0x4d53f5){_0x467b83[_0x89cc('0x17')]=_0x4d53f5;}if(_0x566620){_0x467b83[_0x89cc('0x18')]=_0x566620;}return _0x467b83;}function isEmail(_0x334a89){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))*$/[_0x89cc('0x19')](_0x334a89);}function checkRow(_0x3cb140,_0x325bec,_0x1d8400){return new BPromise(function(_0x1b1df1,_0x89ae57){if(_['isNil'](_0x3cb140)){return _0x89ae57(handleCheckRowError(_0x89cc('0x16'),_0x89cc('0x1a'),null,_0x1d8400));}if(_0x3cb140['errors']&&_0x3cb140[_0x89cc('0x1b')][_0x89cc('0x1c')]){var _0x3758f8=_[_0x89cc('0x1d')](_0x3cb140['errors'],_0x89cc('0x1e'))[_0x89cc('0x1f')](';');return _0x89ae57(handleCheckRowError('error',_0x3758f8,null,_0x1d8400));}var _0x11ce18={};for(var _0x1c6b4e in FIELDS){if(FIELDS[_0x89cc('0x20')](_0x1c6b4e)&&FIELDS[_0x1c6b4e]){_0x11ce18[_0x1c6b4e]=_0x3cb140[_0x89cc('0x21')][0x0][FIELDS[_0x1c6b4e]]||_0x3cb140[_0x89cc('0x21')][0x0]['\ufeff'+FIELDS[_0x1c6b4e]];}}if(!_0x11ce18[_0x89cc('0x22')]){return _0x89ae57(handleCheckRowError(_0x89cc('0x16'),_0x89cc('0x23'),null,_0x1d8400));}if(!_0x11ce18[_0x89cc('0x24')]){return _0x89ae57(handleCheckRowError(_0x89cc('0x16'),_0x89cc('0x25'),null,_0x1d8400));}if(_0x11ce18[_0x89cc('0x26')]){var _0x554ebf=moment(_0x11ce18['birthDate'],_0x89cc('0x27'));if(!_0x554ebf[_0x89cc('0x28')]()){return _0x89ae57(handleCheckRowError(_0x89cc('0x16'),_0x89cc('0x29'),null,_0x1d8400));}}if(_0x11ce18[_0x89cc('0x2a')]){if(!isEmail(_0x11ce18['email'])){return _0x89ae57(handleCheckRowError(_0x89cc('0x16'),_0x89cc('0x2b'),null,_0x1d8400));}}_0x11ce18[_0x89cc('0x2c')]=LISTID;_0x11ce18[_0x89cc('0x2d')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x325bec){var _0x4641f7={};for(var _0x5ec46a=0x0,_0x56b6b5=DUPLICATES[_0x89cc('0x1c')];_0x5ec46a<_0x56b6b5;_0x5ec46a+=0x1){_0x4641f7[DUPLICATES[_0x5ec46a]]=_0x11ce18[DUPLICATES[_0x5ec46a]];}var _0x1a0a1c=_[_0x89cc('0x2e')](_0x325bec,_0x4641f7);if(_0x1a0a1c){return _0x89ae57(handleCheckRowError(_0x89cc('0x2f'),_0x89cc('0x30'),_0x1a0a1c,_0x1d8400));}}return db[_0x89cc('0x31')][_0x89cc('0x32')](_0x11ce18,{'raw':!![],'hooks':![],'fields':_[_0x89cc('0x33')](_0x11ce18)})['then'](function(_0x693c90){if(DUPLICATES&&DUPLICATES['length']&&_0x325bec){_0x325bec[_0x89cc('0x34')](_[_0x89cc('0x35')](_0x11ce18,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x693c90['id'];return _0x1b1df1();})['catch'](function(_0x5ceb05){return _0x89ae57(handleCheckRowError('error',_0x89cc('0x36')+(_0x5ceb05[_0x89cc('0x1e')]||JSON[_0x89cc('0x37')](_0x5ceb05)),null,_0x1d8400));});});}function checkHopper(){function _0x3dad99(){return function(_0x414f31){logger[_0x89cc('0x16')]('cmContact',_0x89cc('0x38'),util[_0x89cc('0x39')](_0x414f31,{'showHidden':![],'depth':null}));};}var _0x35a43d=function(_0x182023,_0x1ca0b7){var _0x49fcbf=squel[_0x89cc('0x3a')]()[_0x89cc('0x3b')](_0x89cc('0x3c'))[_0x89cc('0x3d')]([_0x89cc('0x24'),_0x89cc('0x3e'),_0x89cc('0x3f'),_0x89cc('0x2c'),_0x1ca0b7,_0x89cc('0x40'),_0x89cc('0x41')],squel[_0x89cc('0x42')]()[_0x89cc('0x43')](_0x89cc('0x24'),_0x89cc('0x24'))[_0x89cc('0x43')](_0x89cc('0x44'),_0x89cc('0x3e'))[_0x89cc('0x43')]('id','ContactId')[_0x89cc('0x43')](LISTID[_0x89cc('0x45')](),'ListId')[_0x89cc('0x43')](_0x182023['id'][_0x89cc('0x45')](),_0x1ca0b7)[_0x89cc('0x43')](_0x89cc('0x44'),_0x89cc('0x40'))[_0x89cc('0x43')](_0x89cc('0x44'),_0x89cc('0x41'))[_0x89cc('0x46')](_0x89cc('0x47'))[_0x89cc('0x48')](_0x89cc('0x49'))[_0x89cc('0x48')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x89cc('0x4a'))[_0x89cc('0x48')](_0x89cc('0x4b'),squel['select']()['field']('phone')[_0x89cc('0x46')](_0x89cc('0x3c'))[_0x89cc('0x48')](_0x1ca0b7+_0x89cc('0x4c'),_0x182023['id'][_0x89cc('0x45')]())))[_0x89cc('0x45')]();return _0x49fcbf;};var _0x58a30b=function(_0x22fe13,_0x365716){var _0x5444a0=squel[_0x89cc('0x3a')]()[_0x89cc('0x3b')](_0x89cc('0x3c'))[_0x89cc('0x3d')](['phone',_0x89cc('0x3e'),_0x89cc('0x3f'),_0x89cc('0x2c'),_0x365716,_0x89cc('0x40'),'updatedAt'],squel[_0x89cc('0x42')]()['field']('phone','phone')['field'](_0x89cc('0x44'),_0x89cc('0x3e'))[_0x89cc('0x43')]('id',_0x89cc('0x3f'))[_0x89cc('0x43')](LISTID['toString'](),'ListId')['field'](_0x22fe13['id'][_0x89cc('0x45')](),_0x365716)['field'](_0x89cc('0x44'),_0x89cc('0x40'))[_0x89cc('0x43')](_0x89cc('0x44'),_0x89cc('0x41'))[_0x89cc('0x46')](_0x89cc('0x47'))[_0x89cc('0x48')](_0x89cc('0x49'))[_0x89cc('0x48')]('ListId\x20=\x20?',LISTID[_0x89cc('0x45')]())[_0x89cc('0x48')](_0x89cc('0x4d'),squel['str'](hopperContacts))[_0x89cc('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0x89cc('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x89cc('0x42')]()['field']('calleridnum')[_0x89cc('0x46')](_0x89cc('0x4e'))['where'](_0x365716+_0x89cc('0x4c'),_0x22fe13['id'][_0x89cc('0x45')]()))[_0x89cc('0x48')](_0x89cc('0x4b'),squel[_0x89cc('0x42')]()[_0x89cc('0x43')](_0x89cc('0x24'))[_0x89cc('0x46')](_0x89cc('0x3c'))[_0x89cc('0x48')](_0x365716+_0x89cc('0x4c'),_0x22fe13['id'][_0x89cc('0x45')]())))[_0x89cc('0x45')]();return _0x5444a0;};function _0x2cf49e(_0x3fe732,_0x1e081b){var _0x5c7372=squel[_0x89cc('0x3a')]()[_0x89cc('0x3b')](_0x89cc('0x3c'))[_0x89cc('0x3d')]([_0x89cc('0x24'),_0x89cc('0x3e'),_0x89cc('0x3f'),_0x89cc('0x2c'),_0x1e081b,_0x89cc('0x40'),_0x89cc('0x41')],squel[_0x89cc('0x42')]()[_0x89cc('0x43')](_0x89cc('0x24'),_0x89cc('0x24'))[_0x89cc('0x43')](_0x89cc('0x44'),_0x89cc('0x3e'))[_0x89cc('0x43')]('id',_0x89cc('0x3f'))['field'](LISTID[_0x89cc('0x45')](),_0x89cc('0x2c'))[_0x89cc('0x43')](_0x3fe732['id'][_0x89cc('0x45')](),_0x1e081b)['field'](_0x89cc('0x44'),_0x89cc('0x40'))['field'](_0x89cc('0x44'),_0x89cc('0x41'))[_0x89cc('0x46')](_0x89cc('0x47'))[_0x89cc('0x48')](_0x89cc('0x49'))[_0x89cc('0x48')](_0x89cc('0x4f'),LISTID[_0x89cc('0x45')]())[_0x89cc('0x48')](_0x89cc('0x4d'),squel[_0x89cc('0x50')](hopperContacts))[_0x89cc('0x48')](_0x89cc('0x4a')))[_0x89cc('0x45')]();return _0x5c7372;}function _0x4a377d(_0x5474ce,_0x5c2c28){var _0x55268d=squel['insert']()[_0x89cc('0x3b')](_0x89cc('0x51'))[_0x89cc('0x3d')]([_0x89cc('0x24'),_0x89cc('0x3f'),_0x89cc('0x2c'),_0x5c2c28,_0x89cc('0x40'),_0x89cc('0x41')],squel[_0x89cc('0x42')]()['field'](_0x89cc('0x24'),_0x89cc('0x24'))[_0x89cc('0x43')]('id','ContactId')[_0x89cc('0x43')](LISTID[_0x89cc('0x45')](),_0x89cc('0x2c'))[_0x89cc('0x43')](_0x5474ce['id'][_0x89cc('0x45')](),_0x5c2c28)[_0x89cc('0x43')](_0x89cc('0x44'),_0x89cc('0x40'))['field'](_0x89cc('0x44'),'updatedAt')['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x89cc('0x48')]('ListId\x20=\x20?',LISTID['toString']())[_0x89cc('0x48')](_0x89cc('0x4d'),squel['str'](hopperContacts))[_0x89cc('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x89cc('0x45')]();return _0x55268d;}return db[_0x89cc('0x52')]['findAll']({'where':{'type':_0x89cc('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x89cc('0x54'),'where':{'id':LISTID}}]})[_0x89cc('0x55')](function(_0x23b04c){var _0x1b3bbc=[];if(_0x23b04c){var _0x54ccbf;for(var _0x10232f=0x0,_0x1281ac;_0x10232f<_0x23b04c[_0x89cc('0x1c')];_0x10232f+=0x1){_0x1281ac=_0x23b04c[_0x10232f][_0x89cc('0x56')]({'plain':!![]});switch(_0x1281ac[_0x89cc('0x57')]){case _0x89cc('0x58'):_0x1b3bbc[_0x89cc('0x34')](db[_0x89cc('0x59')][_0x89cc('0x5a')](_0x58a30b(_0x1281ac,_0x89cc('0x5b')))[_0x89cc('0x55')](function(){})[_0x89cc('0x5c')](_0x3dad99()));break;case _0x89cc('0x5d'):_0x1b3bbc[_0x89cc('0x34')](db[_0x89cc('0x59')][_0x89cc('0x5a')](_0x35a43d(_0x1281ac,_0x89cc('0x5b')))[_0x89cc('0x55')](function(){})[_0x89cc('0x5c')](_0x3dad99()));break;default:_0x1b3bbc[_0x89cc('0x34')](db['sequelize'][_0x89cc('0x5a')](_0x2cf49e(_0x1281ac,'VoiceQueueId'))['then'](function(){})[_0x89cc('0x5c')](_0x3dad99()));}}}return _0x1b3bbc;})[_0x89cc('0x5e')]()[_0x89cc('0x55')](function(){return db[_0x89cc('0x52')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x89cc('0x5f')],'as':_0x89cc('0x60'),'where':{'id':LISTID}}]})[_0x89cc('0x55')](function(_0x844dcb){var _0x2a6d82=[];if(_0x844dcb){var _0x1bee23;for(var _0x5cf894=0x0,_0x663e1a;_0x5cf894<_0x844dcb[_0x89cc('0x1c')];_0x5cf894+=0x1){_0x663e1a=_0x844dcb[_0x5cf894]['get']({'plain':!![]});_0x2a6d82[_0x89cc('0x34')](db[_0x89cc('0x59')][_0x89cc('0x5a')](_0x4a377d(_0x663e1a,_0x89cc('0x5b')))['then'](function(){})[_0x89cc('0x5c')](_0x3dad99()));}}return _0x2a6d82;})[_0x89cc('0x5e')]();})[_0x89cc('0x55')](function(){return db[_0x89cc('0x61')][_0x89cc('0x62')]({'attributes':['id',_0x89cc('0x57')],'include':[{'model':db[_0x89cc('0x5f')],'as':_0x89cc('0x54'),'where':{'id':LISTID}}]})[_0x89cc('0x55')](function(_0x5e11c9){var _0x41f3fc=[];if(_0x5e11c9){for(var _0x1fc472=0x0,_0x308dd8;_0x1fc472<_0x5e11c9[_0x89cc('0x1c')];_0x1fc472+=0x1){_0x308dd8=_0x5e11c9[_0x1fc472][_0x89cc('0x56')]({'plain':!![]});switch(_0x308dd8[_0x89cc('0x57')]){case _0x89cc('0x58'):_0x41f3fc[_0x89cc('0x34')](db['sequelize'][_0x89cc('0x5a')](_0x58a30b(_0x308dd8,'CampaignId'))[_0x89cc('0x55')](function(){})['catch'](_0x3dad99()));break;case'onlyIfOpen':_0x41f3fc[_0x89cc('0x34')](db['sequelize'][_0x89cc('0x5a')](_0x35a43d(_0x308dd8,'CampaignId'))[_0x89cc('0x55')](function(){})[_0x89cc('0x5c')](_0x3dad99()));break;default:_0x41f3fc[_0x89cc('0x34')](db['sequelize'][_0x89cc('0x5a')](_0x2cf49e(_0x308dd8,_0x89cc('0x63')))[_0x89cc('0x55')](function(){})[_0x89cc('0x5c')](_0x3dad99()));}}}return _0x41f3fc;})[_0x89cc('0x5e')]();})['then'](function(){return db[_0x89cc('0x61')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x89cc('0x60'),'where':{'id':LISTID}}]})['then'](function(_0x1c594d){var _0x391caa=[];if(_0x1c594d){for(var _0x37efc5=0x0,_0x2019d5;_0x37efc5<_0x1c594d['length'];_0x37efc5+=0x1){_0x2019d5=_0x1c594d[_0x37efc5][_0x89cc('0x56')]({'plain':!![]});_0x391caa[_0x89cc('0x34')](db['sequelize'][_0x89cc('0x5a')](_0x4a377d(_0x2019d5,'CampaignId'))[_0x89cc('0x55')](function(){})[_0x89cc('0x5c')](_0x3dad99()));}}return _0x391caa;})[_0x89cc('0x5e')]();})[_0x89cc('0x5c')](function(_0x35e9e3){logger[_0x89cc('0x16')](_0x89cc('0x64'),_0x89cc('0x65'),_0x35e9e3[_0x89cc('0x1e')]);});}var processPromises=function(_0x5d0d6c){return BPromise[_0x89cc('0x5e')](promises)['then'](function(_0x1c35f6){})[_0x89cc('0x5c')](function(_0x130214){logger['error'](_0x89cc('0x66'),JSON[_0x89cc('0x37')](_0x130214));})[_0x89cc('0x67')](function(){socket[_0x89cc('0x68')](_0x89cc('0x69')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5d0d6c){return _0x5d0d6c[_0x89cc('0x6a')]();}});};var endCsv=function(){return BPromise[_0x89cc('0x6b')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x89cc('0x55')](function(){socket[_0x89cc('0x68')](_0x89cc('0x69')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x89cc('0x6c')](FILEPATH);}catch(_0x2f6bee){logger[_0x89cc('0x16')](_0x89cc('0x6d'),JSON[_0x89cc('0x37')](_0x2f6bee));}finally{process[_0x89cc('0x6e')](0x0);}});};process['on'](_0x89cc('0x6f'),function(){logger[_0x89cc('0x70')](_0x89cc('0x71'));endCsv();});function main(){return BPromise['resolve']()[_0x89cc('0x55')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x89cc('0x13')](',');return db[_0x89cc('0x31')][_0x89cc('0x62')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x515171){var _0x552510=fs[_0x89cc('0x72')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x552510,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4cc41c,_0x25ce42){total+=0x1;var _0x31ed2c=total;promises['push'](checkRow(_0x4cc41c,_0x515171,_0x31ed2c)['then'](function(){success+=0x1;})[_0x89cc('0x5c')](function(_0x3871bf){if(_0x3871bf[_0x89cc('0x16')]){errors+=0x1;delete _0x3871bf[_0x89cc('0x16')];}else if(_0x3871bf[_0x89cc('0x2f')]){duplicates+=0x1;delete _0x3871bf[_0x89cc('0x2f')];}rows[_0x89cc('0x34')](_0x3871bf);}));if(total%0xc8===0x0){_0x25ce42[_0x89cc('0x73')]();return processPromises(_0x25ce42);}},'complete':function(){return processPromises()[_0x89cc('0x55')](function(){logger['info'](_0x89cc('0x74'));endCsv();});},'error':function(_0x1ecc5f,_0x49257c){logger[_0x89cc('0x70')]('CSV\x20parse\x20error',JSON[_0x89cc('0x37')](_0x1ecc5f));endCsv();}});})[_0x89cc('0x5c')](function(_0x3a8c7c){logger[_0x89cc('0x16')](_0x89cc('0x75'),JSON[_0x89cc('0x37')](_0x3a8c7c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7712bb5..c65d5e7 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 _0xadd5=['uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','split','all','filter','CmContactHasItem','update','updated','PHONE','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','into','cm_hopper','fromQuery','phone','createdAt','recallme','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_hopper_black','ContactId','ListId','updatedAt','fields','cm_contacts','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','message','sequelize','query','catch','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','_description','keys','header','writeFileSync','parse','data','rows','find','isNil','hasOwnProperty','trim','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','UserId','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','firstName','\x20not\x20specified','replace','itemTypeId','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','format','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT'];(function(_0x56364a,_0x5da928){var _0x5a44a6=function(_0x146793){while(--_0x146793){_0x56364a['push'](_0x56364a['shift']());}};_0x5a44a6(++_0x5da928);}(_0xadd5,0xa7));var _0x5add=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadd5[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x5add('0x0'));var Papa=require(_0x5add('0x1'));var util=require(_0x5add('0x2'));var BPromise=require(_0x5add('0x3'));var moment=require(_0x5add('0x4'));var squel=require(_0x5add('0x5'));var Redis=require(_0x5add('0x6'));var db=require(_0x5add('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0x5add('0x8'))(_0x5add('0x9'));config[_0x5add('0xa')]=_[_0x5add('0xb')](config[_0x5add('0xa')],{'host':_0x5add('0xc'),'port':0x18eb});var socket=require(_0x5add('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2b24b9){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'](_0x2b24b9);}function selectNotIn(_0x317e2a,_0x274762,_0x158c9f,_0x408ab8,_0x22d6c9){return squel[_0x5add('0xe')]()[_0x5add('0xf')]('phone')[_0x5add('0x10')](_0x408ab8)[_0x5add('0x11')](_0x274762,null,_0x274762+_0x5add('0x12')+_0x408ab8+'.'+_0x158c9f)[_0x5add('0x13')](_0x408ab8+'.'+_0x158c9f+_0x5add('0x14')+_0x317e2a+'.'+_0x158c9f)[_0x5add('0x13')](_0x274762+_0x5add('0x15')+_0x22d6c9[_0x5add('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5c16c1,_0x436c34){promisesAdditionalPhones=[];return db[_0x5add('0x16')][_0x5add('0x17')]({'raw':!![],'attributes':['id',_0x5add('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5add('0x19')](function(_0x55f87d){if(_0x55f87d!==null){var _0x205387=[];for(var _0x17bb4d=0x0;_0x17bb4d<_0x55f87d[_0x5add('0x1a')];_0x17bb4d++){var _0x44b7fd=_0x55f87d[_0x17bb4d];_0x205387[_0x5add('0x1b')](insertAdditionalPhones(_0x44b7fd));}}Promise['all'](_0x205387)[_0x5add('0x19')](function(){_0x5c16c1({'val':0x1});});});});}function insertAdditionalPhones(_0x41ec94){return new Promise(function(_0x431362,_0x22651d){var _0x52d04c=_0x41ec94['AdditionalPhones'];var _0x2e5e93=_0x52d04c[_0x5add('0x1c')](';');var _0x50f716=[];orderBy=0x0;for(var _0x547c81=0x0;_0x547c81<_0x2e5e93[_0x5add('0x1a')];_0x547c81++){_0x50f716['push'](splitAdditionalPhone(_0x41ec94['id'],_0x2e5e93[_0x547c81]));}Promise[_0x5add('0x1d')](_0x50f716)['then'](function(){_0x431362({'val':_0x2e5e93['length']});});});}function splitAdditionalPhone(_0x34272d,_0x47af50){return new Promise(function(_0x13313a,_0x462308){var _0x3b485d=_0x47af50[_0x5add('0x1c')](':');var _0x30c8bb=_0x3b485d[0x0];var _0x5bf230=_0x3b485d[0x1];if(_0x5bf230!==''){var _0x362166=_0x5bf230[_0x5add('0x1c')]('|');var _0x2ec7c7=[];for(var _0x16edea=0x0;_0x16edea<_0x362166['length'];_0x16edea++){if(_0x362166[_0x16edea]!==''){var _0xe98a98=_[_0x5add('0x1e')](promisesAdditionalPhones,{'contactId':_0x34272d,'phone':_0x362166[_0x16edea]});if(_0xe98a98[_0x5add('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x5add('0x1b')]({'contactId':_0x34272d,'contactTypeId':_0x30c8bb,'phone':_0x362166[_0x16edea],'orderBy':orderBy});}}}_0x13313a({'ok':0x1});}else _0x13313a({'res':0x0});});}function createAdditionalPhone(_0x5cc1ab,_0x50a0f7,_0x2029a6,_0x28bf88){var _0x5c264e='';var _0x77059f='';var _0x3e4efb=_0x2029a6[_0x5add('0x1c')]('§');_0x5c264e=_0x3e4efb[0x0];if(_0x3e4efb[_0x5add('0x1a')]==0x2)_0x77059f=_0x3e4efb[0x1];return new Promise(function(_0x4a00da,_0x4e798f){return db[_0x5add('0x1f')]['findOne']({'where':{'CmContactId':_0x5cc1ab,'item':_0x5c264e}})[_0x5add('0x19')](function(_0x2d5c61){if(_0x2d5c61){return db['CmContactHasItem'][_0x5add('0x20')]({'ItemTypeId':_0x50a0f7,'description':_0x77059f,'OrderBy':_0x28bf88},{'where':{'CmContactId':_0x5cc1ab,'item':_0x5c264e}})[_0x5add('0x19')](function(_0x401cdd){_0x4a00da({'res':_0x5add('0x21')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x5cc1ab,'item':_0x5c264e,'description':_0x77059f,'ItemTypeId':_0x50a0f7,'OrderBy':_0x28bf88,'ItemClass':_0x5add('0x22')})[_0x5add('0x19')](function(_0x28f68c){_0x4a00da({'res':_0x5add('0x23')});});}});});}function insertCmHopper(_0x256cdd,_0x2a7f0c,_0x393866,_0xface8b,_0x3b1827){var _0x53a753=[_0x5add('0x24'),_0x5add('0x25'),_0x5add('0x26'),_0x5add('0x27'),_0x2a7f0c+'.'+_0xface8b,_0x5add('0x28'),_0x5add('0x29'),_0x5add('0x2a'),_0x5add('0x2b'),'\x22'+_0x3b1827+'\x22'];return squel[_0x5add('0x2c')]()[_0x5add('0x2d')](_0x5add('0x2e'))[_0x5add('0x2f')]([_0x5add('0x30'),'scheduledat','ContactId','ListId',_0xface8b,_0x5add('0x31'),'updatedAt','priority','UserId',_0x5add('0x32')],squel[_0x5add('0xe')]()['fields'](_0x53a753)[_0x5add('0x10')](_0x2a7f0c)['join']('cm_contacts',null,_0x5add('0x33')+_0x2a7f0c+_0x5add('0x34'))[_0x5add('0x11')](_0x393866,null,_0x393866+_0x5add('0x12')+_0x2a7f0c+'.'+_0xface8b)[_0x5add('0x13')](_0x2a7f0c+_0x5add('0x35'),_0x256cdd)[_0x5add('0x13')](_0x5add('0x36'),NOW)[_0x5add('0x13')](_0x5add('0x37'),selectNotIn(_0x2a7f0c,_0x393866,_0xface8b,'cm_hopper',[_0x5add('0x38'),_0x5add('0x39')]))[_0x5add('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a7f0c,_0x393866,_0xface8b,_0x5add('0x2e'),[_0x5add('0x38')])))[_0x5add('0x3a')]();}function insertCmHopperBlack(_0x5f3bac,_0x472929,_0x1d535e,_0x27e22e){var _0x13f84d=[_0x5add('0x24'),_0x5add('0x26'),'cm_contacts.ListId',_0x472929+'.'+_0x27e22e,_0x5add('0x28'),_0x5add('0x29')];return squel[_0x5add('0x2c')]()['into'](_0x5add('0x3b'))['fromQuery']([_0x5add('0x30'),_0x5add('0x3c'),_0x5add('0x3d'),_0x27e22e,_0x5add('0x31'),_0x5add('0x3e')],squel[_0x5add('0xe')]()[_0x5add('0x3f')](_0x13f84d)[_0x5add('0x10')](_0x472929)['join'](_0x5add('0x40'),null,_0x5add('0x33')+_0x472929+'.CmListId')[_0x5add('0x11')](_0x1d535e,null,_0x1d535e+_0x5add('0x12')+_0x472929+'.'+_0x27e22e)[_0x5add('0x13')](_0x472929+'.CmListId\x20=\x20?',_0x5f3bac)[_0x5add('0x13')](_0x5add('0x36'),NOW)['where'](_0x5add('0x37'),squel[_0x5add('0xe')]()[_0x5add('0xf')]('phone')[_0x5add('0x10')](_0x5add('0x3b'))[_0x5add('0x13')](_0x5add('0x41'),_0x5f3bac)[_0x5add('0x13')](_0x27e22e+'\x20=\x20?',_0x472929+'.'+_0x27e22e)))[_0x5add('0x3a')]();}function insertCmHopperAdditionalPhones(_0x5e7308){var _0x3b8a6c=[_0x5add('0x42'),_0x5add('0x43'),_0x5add('0x44'),_0x5add('0x45'),_0x5add('0x46')];return squel[_0x5add('0x2c')]()[_0x5add('0x2d')]('cm_hopper_additional_phones')[_0x5add('0x2f')]([_0x5add('0x47'),_0x5add('0x30'),_0x5add('0x48'),_0x5add('0x31'),_0x5add('0x3e')],squel[_0x5add('0xe')]()[_0x5add('0x3f')](_0x3b8a6c)[_0x5add('0x10')](_0x5add('0x2e'))[_0x5add('0x11')]('cm_contacts',null,_0x5add('0x49'))[_0x5add('0x11')](_0x5add('0x4a'),null,_0x5add('0x4b'))[_0x5add('0x13')]('cm_hopper.ListId\x20=\x20?',_0x5e7308)[_0x5add('0x13')](_0x5add('0x36'),NOW))['toString']();}function insertCmContact(_0x4913e2,_0x7ee78c,_0x14b504,_0x49f274){var _0x2b1d66=_[_0x5add('0x4c')](_['keys'](_0x49f274),[_0x5add('0x3d'),'CompanyId',_0x5add('0x31'),_0x5add('0x3e')]);return squel[_0x5add('0x2c')]()['into'](_0x5add('0x40'))[_0x5add('0x2f')](_0x2b1d66,squel[_0x5add('0xe')]()[_0x5add('0x3f')](_0x2b1d66)[_0x5add('0x10')](_0x7ee78c)[_0x5add('0x13')]('('+_0x14b504[_0x5add('0x11')](',')+_0x5add('0x4d'),squel[_0x5add('0xe')]()[_0x5add('0x3f')](_0x14b504)['from']('cm_contacts')[_0x5add('0x13')](_0x5add('0x41'),_0x4913e2)[_0x5add('0x13')](_0x5add('0x4e')))['where'](_0x5add('0x4f'),squel[_0x5add('0xe')]()[_0x5add('0xf')](_0x5add('0x50'),_0x5add('0x51'))['from'](_0x7ee78c)[_0x5add('0x52')](_0x14b504['join'](','))))[_0x5add('0x3a')]();}function handleStop(){logger[_0x5add('0x53')](_0x5add('0x54'));stopped=!![];}function handleUncaughtException(_0x10968d){logger[_0x5add('0x55')](_0x10968d['message']);process[_0x5add('0x56')](0x1);}function handleError(_0x3406cc,_0x1831d1){stats[_0x5add('0x57')][_0x5add('0x1b')]({'name':_0x1831d1['code'],'message':_0x1831d1[_0x5add('0x58')],'row':_0x3406cc});}function handleQuery(_0x1aead2){logger[_0x5add('0x53')](_0x1aead2);return db[_0x5add('0x59')][_0x5add('0x5a')](_0x1aead2)['spread'](function(_0x369e92){results['push'](_0x369e92);})[_0x5add('0x5b')](function(_0x3d39eb){logger[_0x5add('0x55')](_0x3d39eb[_0x5add('0x58')]);});}function main(_0x12cd71,_0x2bd36b,_0x422235,_0x2682c4){logger['info'](_0x5add('0x5c'),_0x12cd71,JSON[_0x5add('0x5d')](_0x2bd36b));process[_0x5add('0x5e')](_0x5add('0x5f'));var _0x6a63b8=_0x2bd36b[_0x5add('0x60')];var _0x2b34d3=_[_0x5add('0x61')](_0x6a63b8);var _0x37ec10=_0x2bd36b[_0x5add('0x62')];var _0x6856f9=path[_0x5add('0x11')](config[_0x5add('0x63')],_0x5add('0x64'),_0x37ec10+_0x5add('0x65'));logger[_0x5add('0x53')](_0x5add('0x66'),_0x2bd36b);db[_0x5add('0x67')]['findAll']({'raw':!![],'attributes':['id',_0x5add('0x68')]})[_0x5add('0x19')](function(_0x587302){for(var _0x3a82b9=0x0;_0x3a82b9<_0x587302[_0x5add('0x1a')];_0x3a82b9++){if(_0x587302[_0x3a82b9][_0x5add('0x68')]in _0x6a63b8){contactItemTypes[_0x5add('0x1b')](_0x587302[_0x3a82b9]);delete _0x2b34d3[_0x587302[_0x3a82b9][_0x5add('0x68')]];hasAdditionalPhones=!![];}for(var _0x184df2 in _0x6a63b8){if(_0x587302[_0x3a82b9][_0x5add('0x68')]+_0x5add('0x69')===_0x184df2){phoneDescriptions[_0x5add('0x1b')]({'itemTypeId':_0x587302[_0x3a82b9]['id'],'description':_0x184df2});delete _0x2b34d3[_0x184df2];}}}if(hasAdditionalPhones)_0x2b34d3[_0x5add('0x18')]='';var _0x37d009=_[_0x5add('0x6a')](_0x2b34d3)[_0x5add('0x11')]();logger[_0x5add('0x53')](_0x5add('0x6b'),_0x37d009);fs[_0x5add('0x6c')](_0x6856f9,_0x37d009+'\x0a');Papa[_0x5add('0x6d')](fs['createReadStream'](_0x12cd71),{'header':!![],'skipEmptyLines':!![],'step':function(_0x58f667,_0x4f3ffe){try{for(var _0x28127f=0x0,_0x1ae4cd=[];_0x28127f<_0x58f667[_0x5add('0x6e')]['length'];_0x28127f++){stats[_0x5add('0x6f')]+=0x1;if(_0x58f667[_0x5add('0x57')][_0x28127f]){handleError(_0x58f667[_0x5add('0x6e')][_0x28127f],_0x58f667[_0x5add('0x57')][_0x28127f]);}else{var _0x7d38a7=[];var _0x1b7f59=[];var _0x4eeab5={};for(var _0x4e2341 in _0x6a63b8){let _0xfe4a49=contactItemTypes[_0x5add('0x70')](_0x27ffe4=>_0x27ffe4['name']===_0x4e2341);let _0x41f878=contactItemTypes[_0x5add('0x70')](_0x5510b6=>_0x5510b6[_0x5add('0x68')]+'_description'===_0x4e2341);if(_['isNil'](_0xfe4a49)&&_[_0x5add('0x71')](_0x41f878)){if(_0x6a63b8[_0x5add('0x72')](_0x4e2341)){if(_0x58f667[_0x5add('0x6e')][_0x28127f][_0x6a63b8[_0x4e2341]]){var _0x1cf410=_[_0x5add('0x73')](_0x58f667[_0x5add('0x6e')][_0x28127f][_0x6a63b8[_0x4e2341]]['replace'](/"/g,'\x27'));switch(_0x4e2341){case _0x5add('0x74'):var _0x46adf5=moment(_0x1cf410,_0x5add('0x75'),!![]);if(_0x46adf5[_0x5add('0x76')]()){_0x1ae4cd[_0x5add('0x1b')]('\x22'+_0x1cf410+'\x22');}else{_0x7d38a7[_0x5add('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x4f4630=parseInt(_0x1cf410);_0x1cf410=_['isNaN'](_0x4f4630)||_0x4f4630<0x0||_0x4f4630>0x4?_0x2682c4?0x3:0x2:_0x4f4630;_0x1ae4cd[_0x5add('0x1b')]('\x22'+_0x1cf410+'\x22');break;case _0x5add('0x77'):var _0x1c624e=parseInt(_0x1cf410);if(_[_0x5add('0x78')](_0x1c624e)&&_[_0x5add('0x79')](_0x422235,_0x1c624e)){_0x1ae4cd['push']('\x22'+_0x1c624e+'\x22');}else{_0x7d38a7[_0x5add('0x1b')](_0x5add('0x7a'));}break;case'email':if(isEmail(_0x1cf410)){_0x1ae4cd[_0x5add('0x1b')]('\x22'+_0x1cf410+'\x22');}else{_0x7d38a7[_0x5add('0x1b')](_0x5add('0x7b'));}break;case'dateOfBirth':var _0x1eb1a2=moment(_0x1cf410,_0x5add('0x7c'),!![]);if(_0x1eb1a2[_0x5add('0x76')]()){_0x1ae4cd[_0x5add('0x1b')]('\x22'+_0x1cf410+'\x22');}else{_0x7d38a7[_0x5add('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1ae4cd[_0x5add('0x1b')]('\x22'+_0x1cf410+'\x22');}}else{switch(_0x4e2341){case _0x5add('0x7d'):case _0x5add('0x30'):_0x7d38a7[_0x5add('0x1b')](_0x4e2341+_0x5add('0x7e'));break;default:_0x1ae4cd[_0x5add('0x1b')]('\x22\x22');}}}}else{var _0x88f478='';if(!_[_0x5add('0x71')](_0xfe4a49)){if(!_0x4eeab5[_0x5add('0x72')](_0xfe4a49['id'])){for(var _0x4cffa4=0x0;_0x4cffa4<_0x6a63b8[_0x4e2341][_0x5add('0x1a')];_0x4cffa4++){var _0x1cf410=_[_0x5add('0x73')](_0x58f667[_0x5add('0x6e')][_0x28127f][_0x6a63b8[_0x4e2341][_0x4cffa4]][_0x5add('0x7f')](/"/g,'\x27'));var _0x4359ad=phoneDescriptions[_0x5add('0x70')](_0x5c0be4=>_0x5c0be4[_0x5add('0x80')]===_0xfe4a49['id']);if(!_[_0x5add('0x71')](_0x4359ad)){var _0x3d6884=_[_0x5add('0x73')](_0x58f667['data'][_0x28127f][_0x6a63b8[_0x4359ad['description']][0x0]][_0x5add('0x7f')](/"/g,'\x27'));if(!_[_0x5add('0x71')](_0x3d6884))_0x1cf410=_0x1cf410+'§'+_0x3d6884;}if(_0x88f478=='')_0x88f478=_0x1cf410;else _0x88f478+='|'+_0x1cf410;}_0x1b7f59['push'](_0xfe4a49['id']+':'+_0x88f478);_0x4eeab5[_0xfe4a49['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1ae4cd[_0x5add('0x1b')]('\x22'+_0x1b7f59[_0x5add('0x11')](';')+'\x22');}if(_0x7d38a7['length']){handleError(_0x58f667[_0x5add('0x6e')][_0x28127f],{'code':'SystemRow','message':_0x7d38a7[_0x5add('0x11')]()});}else{fs['appendFileSync'](_0x6856f9,_0x1ae4cd[_0x5add('0x11')]()+'\x0a');}_0x1ae4cd=[];}if(!(stats[_0x5add('0x6f')]%0xc8)){socket['emit']('contact:import:'+_0x37ec10,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x5add('0x81'));_0x4f3ffe['abort']();}}catch(_0x365862){handleError(_0x58f667[_0x5add('0x6e')][_0x28127f],{'code':_0x5add('0x82'),'message':_0x365862[_0x5add('0x58')]});logger[_0x5add('0x55')](_0x5add('0x83'),_0x365862[_0x5add('0x58')]);}},'complete':function(){try{var _0x2aa3ec=[];var _0x51f9df='cm_contacts';if(_0x2bd36b[_0x5add('0x84')]&&_0x2bd36b[_0x5add('0x84')][_0x5add('0x1a')]){_0x51f9df=_0x5add('0x85')+_0x37ec10;_0x2aa3ec[_0x5add('0x1b')](_0x5add('0x86')+_0x51f9df+_0x5add('0x87'));}logger[_0x5add('0x53')](_0x5add('0x88'),contactItemTypes[_0x5add('0x1a')]);var _0xf2b194=util[_0x5add('0x89')](_0x5add('0x8a'),_0x6856f9,_0x51f9df,_0x37d009,_0x2bd36b[_0x5add('0x3d')],_0x2bd36b[_0x5add('0x8b')]||null,NOW,NOW);if(_[_0x5add('0x71')](_0x6a63b8[_0x5add('0x74')])){_0xf2b194+=_0x5add('0x8c');}_0x2aa3ec[_0x5add('0x1b')](_0xf2b194);if(_0x2bd36b['duplicates']&&_0x2bd36b[_0x5add('0x84')]['length']){_0x2aa3ec[_0x5add('0x1b')](insertCmContact(_0x2bd36b['ListId'],_0x51f9df,_0x2bd36b[_0x5add('0x84')],_0x6a63b8));_0x2aa3ec[_0x5add('0x1b')](_0x5add('0x8d')+_0x51f9df+';');}BPromise['each'](_0x2aa3ec,handleQuery)['then'](function(_0x38341d){BPromise[_0x5add('0x1d')]([handleAdditionalPhones()])[_0x5add('0x19')](function(){_0x2aa3ec=[];for(var _0x33cd13=0x0;_0x33cd13_0x2847aa[_0xf7dc('0x64')]===_0x3fa3fd);let _0x2d3882=contactItemTypes['find'](_0x5be50b=>_0x5be50b[_0xf7dc('0x64')]+_0xf7dc('0x6b')===_0x3fa3fd);if(_[_0xf7dc('0x6c')](_0x4abaa1)&&_[_0xf7dc('0x6c')](_0x2d3882)){if(_0xe12031[_0xf7dc('0x6d')](_0x3fa3fd)){if(_0x569c4e[_0xf7dc('0x69')][_0xa58fd1][_0xe12031[_0x3fa3fd]]){var _0x1b6187=_[_0xf7dc('0x6e')](_0x569c4e['data'][_0xa58fd1][_0xe12031[_0x3fa3fd]][_0xf7dc('0x6f')](/"/g,'\x27'));switch(_0x3fa3fd){case _0xf7dc('0x70'):var _0x5eebb7=moment(_0x1b6187,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5eebb7[_0xf7dc('0x71')]()){_0xe3310e['push']('\x22'+_0x1b6187+'\x22');}else{_0x3afcf7['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xf7dc('0x32'):var _0x14ce31=parseInt(_0x1b6187);_0x1b6187=_[_0xf7dc('0x72')](_0x14ce31)||_0x14ce31<0x0||_0x14ce31>0x4?_0x14d1ee?0x3:0x2:_0x14ce31;_0xe3310e[_0xf7dc('0x19')]('\x22'+_0x1b6187+'\x22');break;case _0xf7dc('0x73'):var _0x29b98b=parseInt(_0x1b6187);if(_['isNumber'](_0x29b98b)&&_[_0xf7dc('0x74')](_0x5bc25e,_0x29b98b)){_0xe3310e[_0xf7dc('0x19')]('\x22'+_0x29b98b+'\x22');}else{_0x3afcf7['push'](_0xf7dc('0x75'));}break;case'email':if(isEmail(_0x1b6187)){_0xe3310e[_0xf7dc('0x19')]('\x22'+_0x1b6187+'\x22');}else{_0x3afcf7[_0xf7dc('0x19')](_0xf7dc('0x76'));}break;case _0xf7dc('0x77'):var _0x32a0d0=moment(_0x1b6187,'YYYY-MM-DD',!![]);if(_0x32a0d0[_0xf7dc('0x71')]()){_0xe3310e[_0xf7dc('0x19')]('\x22'+_0x1b6187+'\x22');}else{_0x3afcf7[_0xf7dc('0x19')](_0xf7dc('0x78'));}break;default:_0xe3310e[_0xf7dc('0x19')]('\x22'+_0x1b6187+'\x22');}}else{switch(_0x3fa3fd){case _0xf7dc('0x79'):case'phone':_0x3afcf7[_0xf7dc('0x19')](_0x3fa3fd+_0xf7dc('0x7a'));break;default:_0xe3310e['push']('\x22\x22');}}}}else{var _0x4d345f='';if(!_[_0xf7dc('0x6c')](_0x4abaa1)){if(!_0x28424c['hasOwnProperty'](_0x4abaa1['id'])){for(var _0x50fb42=0x0;_0x50fb42<_0xe12031[_0x3fa3fd][_0xf7dc('0x1d')];_0x50fb42++){var _0x1b6187=_[_0xf7dc('0x6e')](_0x569c4e[_0xf7dc('0x69')][_0xa58fd1][_0xe12031[_0x3fa3fd][_0x50fb42]][_0xf7dc('0x6f')](/"/g,'\x27'));var _0x14c969=phoneDescriptions[_0xf7dc('0x7b')](_0x190faf=>_0x190faf[_0xf7dc('0x7c')]===_0x4abaa1['id']);if(!_['isNil'](_0x14c969)){var _0x563db9=_['trim'](_0x569c4e[_0xf7dc('0x69')][_0xa58fd1][_0xe12031[_0x14c969['description']][0x0]][_0xf7dc('0x6f')](/"/g,'\x27'));if(!_[_0xf7dc('0x6c')](_0x563db9))_0x1b6187=_0x1b6187+'§'+_0x563db9;}if(_0x4d345f=='')_0x4d345f=_0x1b6187;else _0x4d345f+='|'+_0x1b6187;}_0xa9c344[_0xf7dc('0x19')](_0x4abaa1['id']+':'+_0x4d345f);_0x28424c[_0x4abaa1['id']]=0x1;}}}}if(hasAdditionalPhones){_0xe3310e[_0xf7dc('0x19')]('\x22'+_0xa9c344[_0xf7dc('0x3e')](';')+'\x22');}if(_0x3afcf7[_0xf7dc('0x1d')]){handleError(_0x569c4e[_0xf7dc('0x69')][_0xa58fd1],{'code':_0xf7dc('0x7d'),'message':_0x3afcf7['join']()});}else{fs[_0xf7dc('0x7e')](_0x4ff372,_0xe3310e[_0xf7dc('0x3e')]()+'\x0a');}_0xe3310e=[];}if(!(stats[_0xf7dc('0x6a')]%0xc8)){socket[_0xf7dc('0x7f')](_0xf7dc('0x80')+_0x27f1ce,stats);stats['errors']=[];}}if(stopped){logger[_0xf7dc('0x56')](_0xf7dc('0x81'));_0x28757f[_0xf7dc('0x82')]();}}catch(_0x27de55){handleError(_0x569c4e[_0xf7dc('0x69')][_0xa58fd1],{'code':_0xf7dc('0x83'),'message':_0x27de55[_0xf7dc('0x53')]});logger[_0xf7dc('0x59')](_0xf7dc('0x84'),_0x27de55[_0xf7dc('0x53')]);}},'complete':function(){try{var _0x3ddee7=[];var _0x2e4ce5='cm_contacts';if(_0x15f646[_0xf7dc('0x85')]&&_0x15f646[_0xf7dc('0x85')]['length']){_0x2e4ce5=_0xf7dc('0x86')+_0x27f1ce;_0x3ddee7['push'](_0xf7dc('0x87')+_0x2e4ce5+_0xf7dc('0x88'));}logger[_0xf7dc('0x56')](_0xf7dc('0x89'),contactItemTypes[_0xf7dc('0x1d')]);var _0x270374=util[_0xf7dc('0xe')](_0xf7dc('0x8a'),_0x4ff372,_0x2e4ce5,_0x21ac80,_0x15f646['ListId'],_0x15f646[_0xf7dc('0x4d')]||null,NOW,NOW);if(_['isNil'](_0xe12031['scheduledat'])){_0x270374+=_0xf7dc('0x8b');}_0x3ddee7[_0xf7dc('0x19')](_0x270374);if(_0x15f646[_0xf7dc('0x85')]&&_0x15f646[_0xf7dc('0x85')][_0xf7dc('0x1d')]){_0x3ddee7[_0xf7dc('0x19')](insertCmContact(_0x15f646[_0xf7dc('0x30')],_0x2e4ce5,_0x15f646[_0xf7dc('0x85')],_0xe12031));_0x3ddee7[_0xf7dc('0x19')]('DROP\x20TABLE\x20'+_0x2e4ce5+';');}BPromise[_0xf7dc('0x8c')](_0x3ddee7,handleQuery)[_0xf7dc('0x1c')](function(_0x5c0a36){BPromise[_0xf7dc('0x1b')]([handleAdditionalPhones()])[_0xf7dc('0x1c')](function(){_0x3ddee7=[];for(var _0x16125a=0x0;_0x16125a\x20\x20');}var _0x239b17=path[_0xf7dc('0x3e')](config[_0xf7dc('0x60')],_0xf7dc('0x61'),process[_0xf7dc('0x9a')][0x2]);if(!fs['existsSync'](_0x239b17)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2e7872={};try{_0x2e7872=JSON[_0xf7dc('0x67')](process[_0xf7dc('0x9a')][0x3]);if(!_0x2e7872['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2e7872['binding'][_0xf7dc('0x2e')]){throw new Error(_0xf7dc('0x9b'));}if(!_0x2e7872[_0xf7dc('0x5d')][_0xf7dc('0x79')]){throw new Error(_0xf7dc('0x9c'));}var _0x274023=0x0;if(_0x2e7872[_0xf7dc('0x5d')][_0xf7dc('0x73')]){_0x274023=0x1;}if(!_0x2e7872[_0xf7dc('0x30')]){throw new Error(_0xf7dc('0x9d'));}}catch(_0x586a06){throw new Error(_0xf7dc('0x9e'));}var _0x10f631=[];try{_0x10f631=_[_0xf7dc('0x9f')](JSON[_0xf7dc('0x67')](process[_0xf7dc('0x9a')][0x4]),'id');}catch(_0x34d913){logger['info']('No\x20agent\x20available');}main(_0x239b17,_0x2e7872,_0x10f631,_0x274023);}validate();process['on'](_0xf7dc('0xa0'),handleStop);process['on'](_0xf7dc('0xa1'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 7761faf..2e80564 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x463f=['hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','description','emit','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','contact:import:','unlink','exit','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','then','catch','message','split','all','filter','CmContactHasItem','findOne','updated','create','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fromQuery','ListId','cm_contacts','.CmListId','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','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?','keys','CompanyId','id\x20IN\x20?','min_id','group','error','errors','code','info','query','spread','stringify','start','clone','socket_timestamp','root','.csv','ContactItemType','findAll','name','_description','header','parse','createReadStream','data','rows','find'];(function(_0x33dda7,_0x59117d){var _0x56de5=function(_0x2e8164){while(--_0x2e8164){_0x33dda7['push'](_0x33dda7['shift']());}};_0x56de5(++_0x59117d);}(_0x463f,0x164));var _0xf463=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x463f[_0x178e48];return _0x440d7e;};'use strict';var fs=require('fs');var path=require(_0xf463('0x0'));var _=require(_0xf463('0x1'));var Papa=require(_0xf463('0x2'));var util=require(_0xf463('0x3'));var BPromise=require(_0xf463('0x4'));var moment=require(_0xf463('0x5'));var squel=require(_0xf463('0x6'));var Redis=require('ioredis');var db=require(_0xf463('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0xf463('0x8'))(_0xf463('0x9'));config['redis']=_['defaults'](config[_0xf463('0xa')],{'host':_0xf463('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf463('0xa')]));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()[_0xf463('0xc')](_0xf463('0xd'));var tempTableName=_0xf463('0xe')+moment()[_0xf463('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x365c4f){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'](_0x365c4f);}function selectNotIn(_0x11673c,_0x5b6b69,_0x18abc9,_0x184d8a,_0x124ffc){return squel[_0xf463('0xf')]()[_0xf463('0x10')](_0xf463('0x11'))[_0xf463('0x12')](_0x184d8a)[_0xf463('0x13')](_0x5b6b69,null,_0x5b6b69+_0xf463('0x14')+_0x184d8a+'.'+_0x18abc9)['where'](_0x184d8a+'.'+_0x18abc9+_0xf463('0x15')+_0x11673c+'.'+_0x18abc9)[_0xf463('0x16')](_0x5b6b69+_0xf463('0x17')+_0x124ffc[_0xf463('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x411de6,_0x354525){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf463('0x18')]['query'](_0xf463('0x19')+tempTableName)['spread'](function(_0x9e4bc4){if(_0x9e4bc4!==null){var _0x1508ad=[];for(var _0x200c86=0x0;_0x200c86<_0x9e4bc4[_0xf463('0x1a')];_0x200c86++){var _0x5e2822=_0x9e4bc4[_0x200c86];if(!_[_0xf463('0x1b')](_0x5e2822[_0xf463('0x11')])){if(!_[_0xf463('0x1b')](_0x5e2822[_0xf463('0x1c')]))_0x1508ad['push'](insertAdditionalPhones(_0x5e2822));promisesContact[_0xf463('0x1d')]({'contact':_0x5e2822});}}}Promise['all'](_0x1508ad)[_0xf463('0x1e')](function(){_0x411de6({'val':0x1});});})[_0xf463('0x1f')](function(_0x4e0fc6){logger['error'](_0x4e0fc6[_0xf463('0x20')]);});});}function insertAdditionalPhones(_0x43d7e4){return new Promise(function(_0x106e47,_0xd55ed9){var _0x806832=_0x43d7e4['AdditionalPhones'];if(_[_0xf463('0x1b')](_0x806832))_0xd55ed9({'val':0x0});else{var _0x38e201=_0x806832[_0xf463('0x21')](';');var _0x442e25=[];orderBy=0x0;for(var _0xf1c2f9=0x0;_0xf1c2f9<_0x38e201[_0xf463('0x1a')];_0xf1c2f9++){_0x442e25[_0xf463('0x1d')](splitAdditionalPhone(_0x43d7e4['id'],_0x38e201[_0xf1c2f9]));}Promise[_0xf463('0x22')](_0x442e25)[_0xf463('0x1e')](function(){_0x106e47({'val':_0x38e201['length']});});}});}function splitAdditionalPhone(_0x259161,_0x558068){return new Promise(function(_0x5259cd,_0x25fb78){var _0x470cb4=_0x558068[_0xf463('0x21')](':');var _0x6aab83=_0x470cb4[0x0];var _0x3216fa=_0x470cb4[0x1];if(_0x3216fa!==''){var _0x17c494=_0x3216fa[_0xf463('0x21')]('|');var _0x39079d=[];for(var _0x7c0e76=0x0;_0x7c0e76<_0x17c494[_0xf463('0x1a')];_0x7c0e76++){if(_0x17c494[_0x7c0e76]!==''){var _0x1ccbcf=_[_0xf463('0x23')](promisesAdditionalPhones,{'contactId':_0x259161,'phone':_0x17c494[_0x7c0e76]});if(_0x1ccbcf[_0xf463('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xf463('0x1d')]({'contactId':_0x259161,'contactTypeId':_0x6aab83,'phone':_0x17c494[_0x7c0e76],'orderBy':orderBy});}}}_0x5259cd({'ok':0x1});}else _0x5259cd({'res':0x0});});}function createAdditionalPhone(_0x576d9d,_0x114fec,_0x2af6c2,_0xe13dce){var _0x9ddf2='';var _0x419aea='';var _0x410a70=_0x2af6c2[_0xf463('0x21')]('§');_0x9ddf2=_0x410a70[0x0];if(_0x410a70[_0xf463('0x1a')]==0x2)_0x419aea=_0x410a70[0x1];return new Promise(function(_0x3b0df9,_0x3c947a){return db[_0xf463('0x24')][_0xf463('0x25')]({'where':{'CmContactId':_0x576d9d,'item':_0x9ddf2}})[_0xf463('0x1e')](function(_0x1cdc9b){if(_0x1cdc9b){return db[_0xf463('0x24')]['update']({'ItemTypeId':_0x114fec,'description':_0x419aea,'OrderBy':_0xe13dce},{'where':{'CmContactId':_0x576d9d,'item':_0x9ddf2}})[_0xf463('0x1e')](function(_0x1b6fc2){_0x3b0df9({'res':_0xf463('0x26')});});}else{return db[_0xf463('0x24')][_0xf463('0x27')]({'CmContactId':_0x576d9d,'item':_0x9ddf2,'ItemTypeId':_0x114fec,'description':_0x419aea,'OrderBy':_0xe13dce,'ItemClass':'PHONE'})[_0xf463('0x1e')](function(_0x9ec0d4){_0x3b0df9({'res':_0xf463('0x28')});});}});});}function updateContact(_0x39e53e){return new Promise(function(_0x2821cb,_0x3eebfd){var _0x5b3f14=_0x39e53e['id'];delete _0x39e53e['id'];return db['CmContact']['update'](_0x39e53e,{'where':{'id':_0x5b3f14}})[_0xf463('0x1e')](function(_0x438ce2){updatedRows+=0x1;return db[_0xf463('0x29')]['update']({'phone':_0x39e53e[_0xf463('0x11')]},{'where':{'ContactId':_0x5b3f14}})[_0xf463('0x1e')](function(_0x5b0552){_0x2821cb({'ret':'OK'});});});});}function insertCmHopper(_0x509888,_0x22abc8,_0x7bcd31,_0xde5532,_0x4c1fbe){var _0x8c3c70=[_0xf463('0x2a'),_0xf463('0x2b'),_0xf463('0x2c'),_0xf463('0x2d'),_0x22abc8+'.'+_0xde5532,_0xf463('0x2e'),_0xf463('0x2f'),'cm_contacts.priority',_0xf463('0x30'),'\x22'+_0x4c1fbe+'\x22'];return squel[_0xf463('0x31')]()[_0xf463('0x32')](_0xf463('0x33'))['fromQuery'](['phone',_0xf463('0x34'),_0xf463('0x35'),'ListId',_0xde5532,_0xf463('0x36'),_0xf463('0x37'),_0xf463('0x38'),_0xf463('0x39'),'recallme'],squel[_0xf463('0xf')]()[_0xf463('0x3a')](_0x8c3c70)[_0xf463('0x12')](_0x22abc8)['join']('cm_contacts',null,_0xf463('0x3b')+_0x22abc8+'.CmListId')[_0xf463('0x13')](_0x7bcd31,null,_0x7bcd31+'.id\x20=\x20'+_0x22abc8+'.'+_0xde5532)['where'](_0x22abc8+_0xf463('0x3c'),_0x509888)[_0xf463('0x16')](_0xf463('0x3d'),NOW)[_0xf463('0x16')](_0xf463('0x3e'),selectNotIn(_0x22abc8,_0x7bcd31,_0xde5532,_0xf463('0x33'),[_0xf463('0x3f'),_0xf463('0x40')]))[_0xf463('0x16')](_0xf463('0x3e'),selectNotIn(_0x22abc8,_0x7bcd31,_0xde5532,_0xf463('0x33'),['\x22always\x22'])))[_0xf463('0x41')]();}function insertCmHopperBlack(_0x2a2ca6,_0x538fd6,_0x4f8428,_0x2f7d48){var _0x525717=[_0xf463('0x2a'),_0xf463('0x2c'),'cm_contacts.ListId',_0x538fd6+'.'+_0x2f7d48,_0xf463('0x2e'),_0xf463('0x2f')];return squel[_0xf463('0x31')]()[_0xf463('0x32')](_0xf463('0x42'))[_0xf463('0x43')](['phone',_0xf463('0x35'),_0xf463('0x44'),_0x2f7d48,'createdAt',_0xf463('0x37')],squel[_0xf463('0xf')]()[_0xf463('0x3a')](_0x525717)[_0xf463('0x12')](_0x538fd6)[_0xf463('0x13')](_0xf463('0x45'),null,_0xf463('0x3b')+_0x538fd6+_0xf463('0x46'))[_0xf463('0x13')](_0x4f8428,null,_0x4f8428+'.id\x20=\x20'+_0x538fd6+'.'+_0x2f7d48)['where'](_0x538fd6+'.CmListId\x20=\x20?',_0x2a2ca6)[_0xf463('0x16')](_0xf463('0x3d'),NOW)[_0xf463('0x16')](_0xf463('0x3e'),squel[_0xf463('0xf')]()['field'](_0xf463('0x11'))['from'](_0xf463('0x42'))[_0xf463('0x16')](_0xf463('0x47'),_0x2a2ca6)[_0xf463('0x16')](_0x2f7d48+_0xf463('0x48'),_0x538fd6+'.'+_0x2f7d48)))['toString']();}function insertCmHopperAdditionalPhones(_0x2a09ee){var _0x29d21c=[_0xf463('0x49'),_0xf463('0x4a'),_0xf463('0x4b'),_0xf463('0x4c'),_0xf463('0x4d')];return squel[_0xf463('0x31')]()[_0xf463('0x32')](_0xf463('0x4e'))[_0xf463('0x43')]([_0xf463('0x4f'),_0xf463('0x11'),_0xf463('0x50'),_0xf463('0x36'),_0xf463('0x37')],squel['select']()['fields'](_0x29d21c)[_0xf463('0x12')](_0xf463('0x33'))[_0xf463('0x13')](_0xf463('0x45'),null,_0xf463('0x51'))[_0xf463('0x13')](_0xf463('0x52'),null,_0xf463('0x53'))[_0xf463('0x16')](_0xf463('0x54'),_0x2a09ee)['where'](_0xf463('0x3d'),NOW))[_0xf463('0x41')]();}function insertCmContact(_0x24ac9a,_0x1a5c8c,_0x3d6451,_0x139c76){var _0x5288e9=_['concat'](_[_0xf463('0x55')](_0x139c76),[_0xf463('0x44'),_0xf463('0x56'),_0xf463('0x36'),'updatedAt']);return squel['insert']()[_0xf463('0x32')]('cm_contacts')[_0xf463('0x43')](_0x5288e9,squel[_0xf463('0xf')]()[_0xf463('0x3a')](_0x5288e9)[_0xf463('0x12')](_0x1a5c8c)[_0xf463('0x16')]('('+_0x3d6451['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xf463('0xf')]()[_0xf463('0x3a')](_0x3d6451)[_0xf463('0x12')](_0xf463('0x45'))[_0xf463('0x16')](_0xf463('0x47'),_0x24ac9a))[_0xf463('0x16')](_0xf463('0x57'),squel[_0xf463('0xf')]()[_0xf463('0x10')]('MIN(id)',_0xf463('0x58'))['from'](_0x1a5c8c)[_0xf463('0x59')](_0x3d6451[_0xf463('0x13')](','))))['toString']();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2e6a4e){logger[_0xf463('0x5a')](_0x2e6a4e[_0xf463('0x20')]);process['exit'](0x1);}function handleError(_0x4e84f4,_0x121123){stats[_0xf463('0x5b')]['push']({'name':_0x121123[_0xf463('0x5c')],'message':_0x121123[_0xf463('0x20')],'row':_0x4e84f4});}function handleQuery(_0x2db304){logger[_0xf463('0x5d')](_0x2db304);return db[_0xf463('0x18')][_0xf463('0x5e')](_0x2db304)[_0xf463('0x5f')](function(_0x39c6e0){results[_0xf463('0x1d')](_0x39c6e0);})[_0xf463('0x1f')](function(_0x30b36a){logger['error'](_0x30b36a[_0xf463('0x20')]);});}function main(_0x2f33e0,_0x4d488f,_0x5569f,_0x5218b5){logger['info']('main',_0x2f33e0,JSON[_0xf463('0x60')](_0x4d488f));process['send'](_0xf463('0x61'));var _0x404610=_0x4d488f['binding'];var _0xd14cab=_[_0xf463('0x62')](_0x404610);var _0x4c88a0=_0x4d488f[_0xf463('0x63')];var _0x85cc20=path[_0xf463('0x13')](config[_0xf463('0x64')],'server/files/tmp',_0x4c88a0+_0xf463('0x65'));logger[_0xf463('0x5d')]('body',_0x4d488f);db[_0xf463('0x66')][_0xf463('0x67')]({'raw':!![],'attributes':['id','name']})[_0xf463('0x1e')](function(_0x205a73){for(var _0x10ad86=0x0;_0x10ad86<_0x205a73[_0xf463('0x1a')];_0x10ad86++){if(_0x205a73[_0x10ad86][_0xf463('0x68')]in _0x404610){contactItemTypes[_0xf463('0x1d')](_0x205a73[_0x10ad86]);delete _0xd14cab[_0x205a73[_0x10ad86][_0xf463('0x68')]];hasAdditionalPhones=!![];}for(var _0x542197 in _0x404610){if(_0x205a73[_0x10ad86]['name']+_0xf463('0x69')===_0x542197){phoneDescriptions['push']({'itemTypeId':_0x205a73[_0x10ad86]['id'],'description':_0x542197});delete _0xd14cab[_0x542197];}}}if(hasAdditionalPhones)_0xd14cab['AdditionalPhones']='';var _0x3acbf5=_['keys'](_0xd14cab)['join']();logger[_0xf463('0x5d')](_0xf463('0x6a'),_0x3acbf5);fs['writeFileSync'](_0x85cc20,_0x3acbf5+'\x0a');Papa[_0xf463('0x6b')](fs[_0xf463('0x6c')](_0x2f33e0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2d32cd,_0x7ac31){try{for(var _0x470dcc=0x0,_0x30a4b4=[];_0x470dcc<_0x2d32cd[_0xf463('0x6d')][_0xf463('0x1a')];_0x470dcc++){stats[_0xf463('0x6e')]+=0x1;if(_0x2d32cd[_0xf463('0x5b')][_0x470dcc]){handleError(_0x2d32cd[_0xf463('0x6d')][_0x470dcc],_0x2d32cd[_0xf463('0x5b')][_0x470dcc]);}else{var _0x3a5b53=[];var _0x5838c9=[];var _0x300133={};for(var _0x52a33b in _0x404610){let _0xfde0de=contactItemTypes[_0xf463('0x6f')](_0x3983bf=>_0x3983bf['name']===_0x52a33b);let _0x2c4790=contactItemTypes[_0xf463('0x6f')](_0xf1fd65=>_0xf1fd65['name']+_0xf463('0x69')===_0x52a33b);if(_[_0xf463('0x1b')](_0xfde0de)&&_[_0xf463('0x1b')](_0x2c4790)){if(_0x404610[_0xf463('0x70')](_0x52a33b)){if(_0x2d32cd['data'][_0x470dcc][_0x404610[_0x52a33b]]){var _0x555c88=_['trim'](_0x2d32cd[_0xf463('0x6d')][_0x470dcc][_0x404610[_0x52a33b]][_0xf463('0x71')](/"/g,'\x27'));switch(_0x52a33b){case _0xf463('0x34'):var _0x5e24c2=moment(_0x555c88,_0xf463('0xd'),!![]);if(_0x5e24c2[_0xf463('0x72')]()){_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x555c88+'\x22');}else{_0x3a5b53[_0xf463('0x1d')](_0xf463('0x73'));}break;case _0xf463('0x38'):var _0x291404=parseInt(_0x555c88);_0x555c88=_[_0xf463('0x74')](_0x291404)||_0x291404<0x0||_0x291404>0x4?_0x5218b5?0x3:0x2:_0x291404;_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x555c88+'\x22');break;case _0xf463('0x39'):var _0x4560cb=parseInt(_0x555c88);if(_['isNumber'](_0x4560cb)&&_[_0xf463('0x75')](_0x5569f,_0x4560cb)){_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x4560cb+'\x22');}else{_0x3a5b53[_0xf463('0x1d')]('agent\x20not\x20exists');}break;case _0xf463('0x76'):if(isEmail(_0x555c88)){_0x30a4b4['push']('\x22'+_0x555c88+'\x22');}else{_0x3a5b53[_0xf463('0x1d')](_0xf463('0x77'));}break;case _0xf463('0x78'):var _0x921ca3=moment(_0x555c88,_0xf463('0x79'),!![]);if(_0x921ca3[_0xf463('0x72')]()){_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x555c88+'\x22');}else{_0x3a5b53[_0xf463('0x1d')](_0xf463('0x7a'));}break;default:_0x30a4b4[_0xf463('0x1d')]('\x22'+_0x555c88+'\x22');}}else{switch(_0x52a33b){case _0xf463('0x7b'):case _0xf463('0x11'):_0x3a5b53['push'](_0x52a33b+_0xf463('0x7c'));break;default:_0x30a4b4[_0xf463('0x1d')]('\x22\x22');}}}}else{var _0x7b1b33='';if(!_[_0xf463('0x1b')](_0xfde0de)){if(!_0x300133['hasOwnProperty'](_0xfde0de['id'])){for(var _0x88740d=0x0;_0x88740d<_0x404610[_0x52a33b]['length'];_0x88740d++){var _0x555c88=_[_0xf463('0x7d')](_0x2d32cd[_0xf463('0x6d')][_0x470dcc][_0x404610[_0x52a33b][_0x88740d]][_0xf463('0x71')](/"/g,'\x27'));var _0x860b5d=phoneDescriptions[_0xf463('0x6f')](_0x2815b7=>_0x2815b7['itemTypeId']===_0xfde0de['id']);if(!_['isNil'](_0x860b5d)){var _0x16b722=_[_0xf463('0x7d')](_0x2d32cd[_0xf463('0x6d')][_0x470dcc][_0x404610[_0x860b5d[_0xf463('0x7e')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x16b722))_0x555c88=_0x555c88+'§'+_0x16b722;}if(_0x7b1b33=='')_0x7b1b33=_0x555c88;else _0x7b1b33+='|'+_0x555c88;}_0x5838c9[_0xf463('0x1d')](_0xfde0de['id']+':'+_0x7b1b33);_0x300133[_0xfde0de['id']]=0x1;}}}}if(hasAdditionalPhones){_0x30a4b4['push']('\x22'+_0x5838c9[_0xf463('0x13')](';')+'\x22');}if(_0x3a5b53[_0xf463('0x1a')]){handleError(_0x2d32cd[_0xf463('0x6d')][_0x470dcc],{'code':'SystemRow','message':_0x3a5b53[_0xf463('0x13')]()});}else{fs['appendFileSync'](_0x85cc20,_0x30a4b4[_0xf463('0x13')]()+'\x0a');}_0x30a4b4=[];}if(!(stats[_0xf463('0x6e')]%0xc8)){socket[_0xf463('0x7f')]('contact:import:'+_0x4c88a0,stats);stats[_0xf463('0x5b')]=[];}}if(stopped){logger['info'](_0xf463('0x80'));_0x7ac31['abort']();}}catch(_0x248ba7){handleError(_0x2d32cd[_0xf463('0x6d')][_0x470dcc],{'code':_0xf463('0x81'),'message':_0x248ba7[_0xf463('0x20')]});logger[_0xf463('0x5a')](_0xf463('0x82'),_0x248ba7[_0xf463('0x20')]);}},'complete':function(){try{var _0x2d0b2c=[];var _0x48821d=tempTableName;_0x2d0b2c[_0xf463('0x1d')](_0xf463('0x83')+_0x48821d+_0xf463('0x84'));logger[_0xf463('0x5d')](_0xf463('0x85'),contactItemTypes[_0xf463('0x1a')]);var _0x45baf4=util[_0xf463('0xc')](_0xf463('0x86'),_0x85cc20,_0x48821d,_0x3acbf5,_0x4d488f['ListId'],_0x4d488f['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x404610[_0xf463('0x34')])){_0x45baf4+=_0xf463('0x87');}_0x2d0b2c[_0xf463('0x1d')](_0x45baf4);BPromise[_0xf463('0x88')](_0x2d0b2c,handleQuery)[_0xf463('0x1e')](function(_0x580d01){BPromise['all']([handleAdditionalPhones()])[_0xf463('0x1e')](function(){_0x2d0b2c=[];for(var _0x278080=0x0;_0x278080_0x2defa5[_0x918c('0x66')]===_0x503faf);let _0x5a4b8b=contactItemTypes['find'](_0x3fcf9b=>_0x3fcf9b[_0x918c('0x66')]+'_description'===_0x503faf);if(_['isNil'](_0x3870b1)&&_['isNil'](_0x5a4b8b)){if(_0x4c8d8c[_0x918c('0x6e')](_0x503faf)){if(_0x432960[_0x918c('0x6a')][_0x57717f][_0x4c8d8c[_0x503faf]]){var _0x53e477=_[_0x918c('0x6f')](_0x432960[_0x918c('0x6a')][_0x57717f][_0x4c8d8c[_0x503faf]][_0x918c('0x70')](/"/g,'\x27'));switch(_0x503faf){case _0x918c('0x71'):var _0x11d527=moment(_0x53e477,_0x918c('0x72'),!![]);if(_0x11d527['isValid']()){_0x2b6581[_0x918c('0x21')]('\x22'+_0x53e477+'\x22');}else{_0x276146['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x918c('0x73'):var _0xe53eb2=parseInt(_0x53e477);_0x53e477=_['isNaN'](_0xe53eb2)||_0xe53eb2<0x0||_0xe53eb2>0x4?_0x188344?0x3:0x2:_0xe53eb2;_0x2b6581[_0x918c('0x21')]('\x22'+_0x53e477+'\x22');break;case'UserId':var _0x404909=parseInt(_0x53e477);if(_[_0x918c('0x74')](_0x404909)&&_[_0x918c('0x75')](_0x402050,_0x404909)){_0x2b6581[_0x918c('0x21')]('\x22'+_0x404909+'\x22');}else{_0x276146[_0x918c('0x21')](_0x918c('0x76'));}break;case _0x918c('0x77'):if(isEmail(_0x53e477)){_0x2b6581['push']('\x22'+_0x53e477+'\x22');}else{_0x276146[_0x918c('0x21')](_0x918c('0x78'));}break;case _0x918c('0x79'):var _0x4292a9=moment(_0x53e477,_0x918c('0x7a'),!![]);if(_0x4292a9[_0x918c('0x7b')]()){_0x2b6581[_0x918c('0x21')]('\x22'+_0x53e477+'\x22');}else{_0x276146[_0x918c('0x21')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2b6581[_0x918c('0x21')]('\x22'+_0x53e477+'\x22');}}else{switch(_0x503faf){case _0x918c('0x7c'):case _0x918c('0x11'):_0x276146[_0x918c('0x21')](_0x503faf+_0x918c('0x7d'));break;default:_0x2b6581[_0x918c('0x21')]('\x22\x22');}}}}else{var _0x54acce='';if(!_[_0x918c('0x1b')](_0x3870b1)){if(!_0x3d865a[_0x918c('0x6e')](_0x3870b1['id'])){for(var _0x3496df=0x0;_0x3496df<_0x4c8d8c[_0x503faf][_0x918c('0x22')];_0x3496df++){var _0x53e477=_[_0x918c('0x6f')](_0x432960[_0x918c('0x6a')][_0x57717f][_0x4c8d8c[_0x503faf][_0x3496df]][_0x918c('0x70')](/"/g,'\x27'));var _0x3ad580=phoneDescriptions[_0x918c('0x6d')](_0x43bbd1=>_0x43bbd1['itemTypeId']===_0x3870b1['id']);if(!_['isNil'](_0x3ad580)){var _0x3fb26b=_['trim'](_0x432960[_0x918c('0x6a')][_0x57717f][_0x4c8d8c[_0x3ad580[_0x918c('0x7e')]][0x0]][_0x918c('0x70')](/"/g,'\x27'));if(!_['isNil'](_0x3fb26b))_0x53e477=_0x53e477+'§'+_0x3fb26b;}if(_0x54acce=='')_0x54acce=_0x53e477;else _0x54acce+='|'+_0x53e477;}_0x286487[_0x918c('0x21')](_0x3870b1['id']+':'+_0x54acce);_0x3d865a[_0x3870b1['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b6581[_0x918c('0x21')]('\x22'+_0x286487[_0x918c('0x13')](';')+'\x22');}if(_0x276146['length']){handleError(_0x432960[_0x918c('0x6a')][_0x57717f],{'code':_0x918c('0x7f'),'message':_0x276146[_0x918c('0x13')]()});}else{fs[_0x918c('0x80')](_0x496692,_0x2b6581[_0x918c('0x13')]()+'\x0a');}_0x2b6581=[];}if(!(stats[_0x918c('0x6b')]%0xc8)){socket['emit'](_0x918c('0x81')+_0x1111f1,stats);stats['errors']=[];}}if(stopped){logger[_0x918c('0x58')]('Abort\x20parser');_0x47b33b[_0x918c('0x82')]();}}catch(_0x39f8b9){handleError(_0x432960[_0x918c('0x6a')][_0x57717f],{'code':'SystemError','message':_0x39f8b9['message']});logger[_0x918c('0x1f')](_0x918c('0x83'),_0x39f8b9['message']);}},'complete':function(){try{var _0x565718=[];var _0x3d71ed=tempTableName;_0x565718[_0x918c('0x21')](_0x918c('0x84')+_0x3d71ed+_0x918c('0x85'));logger['info'](_0x918c('0x86'),contactItemTypes[_0x918c('0x22')]);var _0x3d09a2=util[_0x918c('0xd')](_0x918c('0x87'),_0x496692,_0x3d71ed,_0x361ca1,_0x3fdf27['ListId'],_0x3fdf27[_0x918c('0x54')]||null,NOW,NOW);if(_['isNil'](_0x4c8d8c[_0x918c('0x71')])){_0x3d09a2+=_0x918c('0x88');}_0x565718[_0x918c('0x21')](_0x3d09a2);BPromise['each'](_0x565718,handleQuery)['then'](function(_0x539a43){BPromise[_0x918c('0x1d')]([handleAdditionalPhones()])[_0x918c('0x1e')](function(){_0x565718=[];for(var _0x47ed1d=0x0;_0x47ed1d\x20\x20');}var _0x510583=path[_0x918c('0x13')](config[_0x918c('0x95')],_0x918c('0x62'),process[_0x918c('0x94')][0x2]);if(!fs[_0x918c('0x96')](_0x510583)){throw new Error(_0x918c('0x97'));}var _0x2d7705={};try{_0x2d7705=JSON[_0x918c('0x68')](process[_0x918c('0x94')][0x3]);if(!_0x2d7705[_0x918c('0x5f')]){throw new Error(_0x918c('0x98'));}var _0xb2178b=0x0;if(_0x2d7705[_0x918c('0x5f')][_0x918c('0x37')]){_0xb2178b=0x1;}if(!_0x2d7705['ListId']){throw new Error(_0x918c('0x99'));}}catch(_0x49e9ae){throw new Error(_0x918c('0x9a'));}var _0x3ffc5d=[];try{_0x3ffc5d=_[_0x918c('0x9b')](JSON[_0x918c('0x68')](process[_0x918c('0x94')][0x4]),'id');}catch(_0x338327){logger[_0x918c('0x58')](_0x918c('0x9c'));}main(_0x510583,_0x2d7705,_0x3ffc5d,_0xb2178b);}validate();process['on']('SIGINT',handleStop);process['on'](_0x918c('0x9d'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index c1a27ff..f2248f8 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c6d=['toLowerCase','voice','inbound','push','queue','variable','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','calleridname','destexten','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','agentcompleteAt','Hold\x20Time','Member\x20Name','membername','UniqueId','starttime','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]'];(function(_0x15119a,_0xa30fd7){var _0x5201a6=function(_0x46c720){while(--_0x46c720){_0x15119a['push'](_0x15119a['shift']());}};_0x5201a6(++_0xa30fd7);}(_0x8c6d,0xdb));var _0xd8c6=function(_0x418438,_0x583fd1){_0x418438=_0x418438-0x0;var _0x2660c3=_0x8c6d[_0x418438];return _0x2660c3;};'use strict';exports[_0xd8c6('0x0')]=function(_0x1500e2,_0x5f1e51){var _0x54ff61=[{'type':_0xd8c6('0x1'),'content':_0xd8c6('0x2'),'variableName':null}];switch(_0x1500e2[_0xd8c6('0x3')]()){case _0xd8c6('0x4'):switch(_0x5f1e51[_0xd8c6('0x3')]()){case _0xd8c6('0x5'):_0x54ff61[_0xd8c6('0x6')]({'type':'variable','content':'','variableName':_0xd8c6('0x7')});_0x54ff61[_0xd8c6('0x6')]({'type':_0xd8c6('0x8'),'content':'','variableName':'calleridnum'});break;case _0xd8c6('0x9'):_0x54ff61[_0xd8c6('0x6')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x54ff61[_0xd8c6('0x6')]({'type':_0xd8c6('0x8'),'content':'','variableName':_0xd8c6('0xa')});break;}}return _0x54ff61;};exports[_0xd8c6('0xb')]=function(_0x264c13,_0x3cc024){var _0x3498fd=[];switch(_0x264c13[_0xd8c6('0x3')]()){case _0xd8c6('0x4'):switch(_0x3cc024['toLowerCase']()){case'inbound':_0x3498fd=[{'type':_0xd8c6('0x1'),'content':_0xd8c6('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xd8c6('0xd'),'content':'','key':_0xd8c6('0xe'),'keyType':_0xd8c6('0x8'),'variableName':_0xd8c6('0xf')},{'type':_0xd8c6('0xd'),'content':'','key':'Caller\x20Name','keyType':_0xd8c6('0x8'),'variableName':_0xd8c6('0x10')},{'type':_0xd8c6('0xd'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0xd8c6('0x11')},{'type':_0xd8c6('0xd'),'content':'','key':'Queue','keyType':_0xd8c6('0x8'),'variableName':_0xd8c6('0x7')},{'type':_0xd8c6('0xd'),'content':'','key':'UniqueId','keyType':_0xd8c6('0x8'),'variableName':_0xd8c6('0x12')},{'type':'keyValue','content':'','key':_0xd8c6('0x13'),'keyType':_0xd8c6('0x8'),'variableName':_0xd8c6('0x14')},{'type':_0xd8c6('0x1'),'content':_0xd8c6('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xd8c6('0xd'),'content':'','key':_0xd8c6('0x16'),'keyType':'variable','variableName':_0xd8c6('0x17')},{'type':'keyValue','content':'','key':_0xd8c6('0x18'),'keyType':_0xd8c6('0x8'),'variableName':_0xd8c6('0xa')},{'type':_0xd8c6('0x1'),'content':_0xd8c6('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0xd8c6('0x8'),'variableName':_0xd8c6('0x14')},{'type':_0xd8c6('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0xd8c6('0x8'),'variableName':'agentconnectAt'},{'type':_0xd8c6('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0xd8c6('0x8'),'variableName':_0xd8c6('0x1a')},{'type':_0xd8c6('0xd'),'content':'','key':_0xd8c6('0x1b'),'keyType':_0xd8c6('0x8'),'variableName':'holdtime'},{'type':_0xd8c6('0xd'),'content':'','key':'Talk\x20Time','keyType':_0xd8c6('0x8'),'variableName':'talktime'}];break;case'outbound':_0x3498fd=[{'type':_0xd8c6('0x1'),'content':_0xd8c6('0xc'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0xd8c6('0xa')},{'type':_0xd8c6('0xd'),'content':'','key':_0xd8c6('0x1c'),'keyType':_0xd8c6('0x8'),'keyContent':'','variableName':_0xd8c6('0x1d')},{'type':_0xd8c6('0xd'),'content':'','key':_0xd8c6('0x1e'),'keyType':'variable','keyContent':'','variableName':_0xd8c6('0x12')},{'type':_0xd8c6('0xd'),'content':'','key':'Date','keyType':_0xd8c6('0x8'),'keyContent':'','variableName':_0xd8c6('0x1f')},{'type':'string','content':_0xd8c6('0x19')},{'type':_0xd8c6('0xd'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0xd8c6('0x20')},{'type':'keyValue','content':'','key':_0xd8c6('0x21'),'keyType':_0xd8c6('0x8'),'keyContent':'','variableName':'endtime'},{'type':_0xd8c6('0xd'),'content':'','key':_0xd8c6('0x22'),'keyType':_0xd8c6('0x8'),'keyContent':'','variableName':_0xd8c6('0x23')},{'type':'keyValue','content':'','key':_0xd8c6('0x24'),'keyType':_0xd8c6('0x8'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x3498fd;}; \ No newline at end of file +var _0x3b06=['Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','Answer\x20Time','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten'];(function(_0x5a055f,_0x380821){var _0xafe578=function(_0xd9ef82){while(--_0xd9ef82){_0x5a055f['push'](_0x5a055f['shift']());}};_0xafe578(++_0x380821);}(_0x3b06,0x1dd));var _0x63b0=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x3b06[_0x4b6830];return _0x239e4a;};'use strict';exports[_0x63b0('0x0')]=function(_0x1e2685,_0x1162e2){var _0x8bc972=[{'type':_0x63b0('0x1'),'content':_0x63b0('0x2'),'variableName':null}];switch(_0x1e2685[_0x63b0('0x3')]()){case _0x63b0('0x4'):switch(_0x1162e2[_0x63b0('0x3')]()){case _0x63b0('0x5'):_0x8bc972[_0x63b0('0x6')]({'type':'variable','content':'','variableName':'queue'});_0x8bc972[_0x63b0('0x6')]({'type':_0x63b0('0x7'),'content':'','variableName':_0x63b0('0x8')});break;case _0x63b0('0x9'):_0x8bc972[_0x63b0('0x6')]({'type':_0x63b0('0x1'),'content':_0x63b0('0xa'),'variableName':null});_0x8bc972['push']({'type':_0x63b0('0x7'),'content':'','variableName':_0x63b0('0xb')});break;}}return _0x8bc972;};exports['getDescriptions']=function(_0x433dae,_0x430e58){var _0x64731e=[];switch(_0x433dae[_0x63b0('0x3')]()){case _0x63b0('0x4'):switch(_0x430e58['toLowerCase']()){case _0x63b0('0x5'):_0x64731e=[{'type':_0x63b0('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0xd'),'keyType':_0x63b0('0x7'),'variableName':_0x63b0('0x8')},{'type':'keyValue','content':'','key':_0x63b0('0xe'),'keyType':_0x63b0('0x7'),'variableName':_0x63b0('0xf')},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x10'),'keyType':_0x63b0('0x7'),'variableName':_0x63b0('0x11')},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x12'),'keyType':_0x63b0('0x7'),'variableName':'queue'},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x13'),'keyType':_0x63b0('0x7'),'variableName':_0x63b0('0x14')},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x15'),'keyType':'variable','variableName':_0x63b0('0x16')},{'type':_0x63b0('0x1'),'content':_0x63b0('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x63b0('0x18'),'keyType':_0x63b0('0x7'),'variableName':_0x63b0('0x19')},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x1a'),'keyType':_0x63b0('0x7'),'variableName':_0x63b0('0xb')},{'type':_0x63b0('0x1'),'content':_0x63b0('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x1c'),'keyType':'variable','variableName':_0x63b0('0x16')},{'type':_0x63b0('0xc'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x63b0('0x1d')},{'type':'keyValue','content':'','key':_0x63b0('0x1e'),'keyType':_0x63b0('0x7'),'variableName':_0x63b0('0x1f')},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x20'),'keyType':_0x63b0('0x7'),'variableName':_0x63b0('0x21')},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x22'),'keyType':_0x63b0('0x7'),'variableName':_0x63b0('0x23')}];break;case _0x63b0('0x9'):_0x64731e=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x24'),'keyType':_0x63b0('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x25'),'keyType':_0x63b0('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x13'),'keyType':_0x63b0('0x7'),'keyContent':'','variableName':_0x63b0('0x14')},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x15'),'keyType':_0x63b0('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0x63b0('0x1'),'content':_0x63b0('0x1b')},{'type':'keyValue','content':'','key':_0x63b0('0x26'),'keyType':_0x63b0('0x7'),'keyContent':'','variableName':_0x63b0('0x27')},{'type':_0x63b0('0xc'),'content':'','key':'Complete\x20Time','keyType':_0x63b0('0x7'),'keyContent':'','variableName':_0x63b0('0x28')},{'type':_0x63b0('0xc'),'content':'','key':_0x63b0('0x29'),'keyType':_0x63b0('0x7'),'keyContent':'','variableName':_0x63b0('0x2a')},{'type':'keyValue','content':'','key':_0x63b0('0x2b'),'keyType':_0x63b0('0x7'),'keyContent':'','variableName':_0x63b0('0x2c')}];break;}}return _0x64731e;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 3426df7..0378c5b 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3c0=['chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','findOne','catch','error','tracked','query','clone','body','omit','html','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions'];(function(_0xb68438,_0x21c2c0){var _0xbb3e85=function(_0x564de7){while(--_0x564de7){_0xb68438['push'](_0xb68438['shift']());}};_0xbb3e85(++_0x21c2c0);}(_0xd3c0,0x12f));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d3c('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x0d3c('0x1'))(_0x0d3c('0x2')),'mail':require(_0x0d3c('0x1'))(_0x0d3c('0x3')),'fax':require(_0x0d3c('0x1'))('fax-interactions'),'sms':require(_0x0d3c('0x1'))(_0x0d3c('0x4')),'chat':require(_0x0d3c('0x1'))(_0x0d3c('0x5')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getInteractionId(_0x12b479,_0x91e540,_0x23b69a){if(_0x12b479&&_0x12b479[_[_0x0d3c('0x6')](_0x23b69a)+_0x0d3c('0x7')]){return _0x12b479[_['upperFirst'](_0x23b69a)+_0x0d3c('0x7')];}else if(_0x12b479&&_0x12b479['id']){return _0x12b479['id'];}else if(_0x91e540&&_0x91e540['id']){return _0x91e540['id'];}else{return _0x0d3c('0x8');}}function log(_0x253158,_0x927652,_0x549080,_0x55017f,_0x409873,_0x125990){loggers[_0x409873[_0x0d3c('0x9')]()][_0x253158]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x125990[_0x0d3c('0xa')](),_0x927652?_0x927652['id']:null,_0x927652?_0x927652[_0x0d3c('0xb')]:null,_0x927652?_0x927652[_0x0d3c('0xc')]:null,getInteractionId(_0x549080,_0x55017f,_0x409873),_0x549080?JSON[_0x0d3c('0xd')](_0x549080):_0x0d3c('0xe'));}function updateUser(_0x1ea1f9,_0x54c131,_0x2bd4dc,_0x1fc554,_0x52ed17){db[_[_0x0d3c('0x6')](_0x1fc554)+_0x0d3c('0xf')][_0x0d3c('0x10')]({'where':{'id':getInteractionId(_0x54c131,_0x2bd4dc,_0x1fc554)}})['then'](function(_0x3e89e2){if(_0x3e89e2){return _0x3e89e2['update']({'UserId':_0x1ea1f9?_0x1ea1f9['id']:null});}})['then'](function(_0x1fc5a3){if(_0x1fc5a3){log('info',_0x1ea1f9,_0x54c131,_0x2bd4dc,_0x1fc554,_0x52ed17);}})[_0x0d3c('0x11')](function(){log(_0x0d3c('0x12'),_0x1ea1f9,_0x54c131,_0x2bd4dc,_0x1fc554,_0x52ed17);});}exports[_0x0d3c('0x13')]=function(_0x110bc4,_0x53948b){return function(_0x5892a2,_0x5e9f0c,_0x363305){var _0xac4568=_0x5892a2['user'];var _0x4bbb49={};var _0x3efe73=_0x5892a2[_0x0d3c('0x14')];if(_0x4bbb49){_0x4bbb49=_[_0x0d3c('0x15')](_0x5892a2[_0x0d3c('0x16')]);_0x4bbb49=_[_0x0d3c('0x17')](_0x4bbb49,[_0x0d3c('0x16'),_0x0d3c('0x18'),_0x0d3c('0x19'),_0x0d3c('0x1a'),_0x0d3c('0x1b')]);}updateUser(_0xac4568,_0x4bbb49,_0x3efe73,_0x110bc4,_0x53948b);_0x363305(null);};}; \ No newline at end of file +var _0x6b3f=['upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','stringify','Interaction','findOne','update','then','info','catch','error','clone','body','omit','html','phone','mobile','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b3f,0x1b4));var _0xf6b3=function(_0x73129a,_0x2de4bf){_0x73129a=_0x73129a-0x0;var _0x452f90=_0x6b3f[_0x73129a];return _0x452f90;};'use strict';var _=require('lodash');var db=require(_0xf6b3('0x0'))['db'];var loggers={'openchannel':require(_0xf6b3('0x1'))('openchannel-interactions'),'mail':require(_0xf6b3('0x1'))(_0xf6b3('0x2')),'fax':require(_0xf6b3('0x1'))(_0xf6b3('0x3')),'sms':require(_0xf6b3('0x1'))('sms-interactions'),'chat':require(_0xf6b3('0x1'))(_0xf6b3('0x4')),'whatsapp':require(_0xf6b3('0x1'))(_0xf6b3('0x5'))};function getInteractionId(_0x206b8b,_0x28fa4e,_0xc3694f){if(_0x206b8b&&_0x206b8b[_[_0xf6b3('0x6')](_0xc3694f)+'InteractionId']){return _0x206b8b[_[_0xf6b3('0x6')](_0xc3694f)+_0xf6b3('0x7')];}else if(_0x206b8b&&_0x206b8b['id']){return _0x206b8b['id'];}else if(_0x28fa4e&&_0x28fa4e['id']){return _0x28fa4e['id'];}else{return _0xf6b3('0x8');}}function log(_0x5d410d,_0x454607,_0x1f0876,_0xcc8497,_0x183b0a,_0x2c5c83){loggers[_0x183b0a[_0xf6b3('0x9')]()][_0x5d410d]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c5c83[_0xf6b3('0xa')](),_0x454607?_0x454607['id']:null,_0x454607?_0x454607[_0xf6b3('0xb')]:null,_0x454607?_0x454607['role']:null,getInteractionId(_0x1f0876,_0xcc8497,_0x183b0a),_0x1f0876?JSON[_0xf6b3('0xc')](_0x1f0876):'null');}function updateUser(_0xab745,_0x4ea019,_0x50bc2f,_0x15223a,_0x2663ca){db[_[_0xf6b3('0x6')](_0x15223a)+_0xf6b3('0xd')][_0xf6b3('0xe')]({'where':{'id':getInteractionId(_0x4ea019,_0x50bc2f,_0x15223a)}})['then'](function(_0x412185){if(_0x412185){return _0x412185[_0xf6b3('0xf')]({'UserId':_0xab745?_0xab745['id']:null});}})[_0xf6b3('0x10')](function(_0x8f18b){if(_0x8f18b){log(_0xf6b3('0x11'),_0xab745,_0x4ea019,_0x50bc2f,_0x15223a,_0x2663ca);}})[_0xf6b3('0x12')](function(){log(_0xf6b3('0x13'),_0xab745,_0x4ea019,_0x50bc2f,_0x15223a,_0x2663ca);});}exports['tracked']=function(_0x47e7d3,_0xe17993){return function(_0x5710f0,_0x2be823,_0x25d7d3){var _0x58d622=_0x5710f0['user'];var _0xa871={};var _0xc799bf=_0x5710f0['query'];if(_0xa871){_0xa871=_[_0xf6b3('0x14')](_0x5710f0[_0xf6b3('0x15')]);_0xa871=_[_0xf6b3('0x16')](_0xa871,[_0xf6b3('0x15'),_0xf6b3('0x17'),_0xf6b3('0x18'),'fax',_0xf6b3('0x19')]);}updateUser(_0x58d622,_0xa871,_0xc799bf,_0x47e7d3,_0xe17993);_0x25d7d3(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 1d0ccba..22c0341 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 _0x591f=['util','composable-middleware','data1','license','split','createDecipher','aes-256-ctr','format','update','base64','final','utf8','parse','use','License','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','isUserLimit','crypto'];(function(_0x45243c,_0x55239e){var _0x68b79b=function(_0x56b6fc){while(--_0x56b6fc){_0x45243c['push'](_0x45243c['shift']());}};_0x68b79b(++_0x55239e);}(_0x591f,0x1a1));var _0xf591=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x591f[_0x1694f5];return _0x5b4321;};'use strict';var crypto=require(_0xf591('0x0'));var util=require(_0xf591('0x1'));var compose=require(_0xf591('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0xd87767,_0x42471b){if(_0xd87767&&_0x42471b){if(_0x42471b[_0xf591('0x3')]&&_0x42471b[_0xf591('0x4')]){var _0x2010b6=_0x42471b[_0xf591('0x3')];var _0x3a3742=_0x42471b['license'];var _0x5d9491=_0x2010b6[_0xf591('0x5')]('-')[0x4];var _0x82c222=_0x2010b6[_0xf591('0x5')]('-')[0x0];var _0x3b4e45=crypto[_0xf591('0x6')](_0xf591('0x7'),util[_0xf591('0x8')]('%s:%s:%s',_0x5d9491,_0x2010b6,_0x82c222));var _0x31efd4=_0x3b4e45[_0xf591('0x9')](_0x3a3742,_0xf591('0xa'),'utf8');_0x31efd4+=_0x3b4e45[_0xf591('0xb')](_0xf591('0xc'));var _0x19c5e2=JSON[_0xf591('0xd')](_0x31efd4);return _0x19c5e2['hasOwnProperty'](_0xd87767)?_0x19c5e2[_0xd87767]:null;}}return null;}function isLimit(_0x33171b,_0x59a48c,_0x440cc4,_0x4ee6cc){var _0xa793db=_0x59a48c;return compose()[_0xf591('0xe')](function(_0x258efc,_0x49d44c,_0xd7ac72){return db[_0xf591('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xf591('0x10')](function(_0xb63a0f){var _0x31d405=getValueFromLicense(_0x33171b,_0xb63a0f);return _0x31d405?_0x31d405:_0xa793db;})[_0xf591('0x10')](function(_0x1ce54b){_0xa793db=_0x1ce54b;return _0x440cc4[_0xf591('0x11')](_0x4ee6cc);})['then'](function(_0x4b4326){if(_0x4b4326>=_0xa793db){return _0x49d44c['status'](0x193)['json']({'message':util[_0xf591('0x8')](_0xf591('0x12'),_0x33171b)});}_0xd7ac72();})[_0xf591('0x13')](function(_0x42eace){_0xd7ac72(_0x42eace);});});}function isUserLimit(){return isLimit(_0xf591('0x14'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0xf591('0x15')]=isUserLimit; \ No newline at end of file +var _0x6776=['composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','utf8','final','parse','hasOwnProperty','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','isUserLimit','crypto','util'];(function(_0x46003f,_0x18a160){var _0x373521=function(_0x357002){while(--_0x357002){_0x46003f['push'](_0x46003f['shift']());}};_0x373521(++_0x18a160);}(_0x6776,0x1b3));var _0x6677=function(_0x2f0209,_0xe6efca){_0x2f0209=_0x2f0209-0x0;var _0x35d6d4=_0x6776[_0x2f0209];return _0x35d6d4;};'use strict';var crypto=require(_0x6677('0x0'));var util=require(_0x6677('0x1'));var compose=require(_0x6677('0x2'));var db=require(_0x6677('0x3'))['db'];var config=require(_0x6677('0x4'));function getValueFromLicense(_0x1f8b62,_0x412309){if(_0x1f8b62&&_0x412309){if(_0x412309[_0x6677('0x5')]&&_0x412309[_0x6677('0x6')]){var _0xdbf345=_0x412309[_0x6677('0x5')];var _0x24f3ea=_0x412309['license'];var _0x409333=_0xdbf345['split']('-')[0x4];var _0x17f2ce=_0xdbf345[_0x6677('0x7')]('-')[0x0];var _0x1d0b47=crypto['createDecipher'](_0x6677('0x8'),util[_0x6677('0x9')](_0x6677('0xa'),_0x409333,_0xdbf345,_0x17f2ce));var _0xe0b8fd=_0x1d0b47['update'](_0x24f3ea,'base64',_0x6677('0xb'));_0xe0b8fd+=_0x1d0b47[_0x6677('0xc')](_0x6677('0xb'));var _0x362957=JSON[_0x6677('0xd')](_0xe0b8fd);return _0x362957[_0x6677('0xe')](_0x1f8b62)?_0x362957[_0x1f8b62]:null;}}return null;}function isLimit(_0x3c6b27,_0x1c06f4,_0x2231bf,_0x5943e3){var _0x471a80=_0x1c06f4;return compose()['use'](function(_0x267e00,_0x5bcd60,_0x2241d9){return db['License'][_0x6677('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x6677('0x10')](function(_0x2c4425){var _0x1a16ae=getValueFromLicense(_0x3c6b27,_0x2c4425);return _0x1a16ae?_0x1a16ae:_0x471a80;})[_0x6677('0x10')](function(_0x57c906){_0x471a80=_0x57c906;return _0x2231bf[_0x6677('0x11')](_0x5943e3);})[_0x6677('0x10')](function(_0x37d1a5){if(_0x37d1a5>=_0x471a80){return _0x5bcd60['status'](0x193)[_0x6677('0x12')]({'message':util[_0x6677('0x9')](_0x6677('0x13'),_0x3c6b27)});}_0x2241d9();})[_0x6677('0x14')](function(_0x3bdce1){_0x2241d9(_0x3bdce1);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x6677('0x15')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x6677('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2beeee0..fdcff79 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 _0xfbb1=['value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','field','\x20AS\x20','operator','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','[$or]','and','[$and]','split','length','slice','match','indexOf','map','conditions','push','$eq','$between'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xfbb1,0x197));var _0x1fbb=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0xfbb1[_0x2077c2];return _0x312f9f;};'use strict';var _=require(_0x1fbb('0x0'));var moment=require(_0x1fbb('0x1'));exports[_0x1fbb('0x2')]=function(_0x281cb5){var _0x2ca050={'conditions':[]};_0x2ca050[_0x1fbb('0x3')]=_['startsWith'](_0x281cb5,_0x1fbb('0x4'))?'or':_0x1fbb('0x5');var _0x1ab7ee=_0x281cb5['replace'](_0x1fbb('0x6'),'')['replace'](_0x1fbb('0x4'),'')[_0x1fbb('0x7')]('||');for(var _0x3ceae3=0x0;_0x3ceae3<_0x1ab7ee[_0x1fbb('0x8')];_0x3ceae3++){var _0x3fd91e=_0x1ab7ee[_0x3ceae3][_0x1fbb('0x7')](':=');var _0x3ab176=_0x3fd91e[0x0];var _0x1814b2=_0x3fd91e[_0x1fbb('0x9')](0x1);_0x1814b2['forEach'](function(_0x5f4972){var _0x57c6e0=_0x5f4972[_0x1fbb('0x7')]('[')['shift']();var _0x37eff4=_0x5f4972[_0x1fbb('0xa')](/\[(.*?)\]/g);_0x37eff4['forEach'](function(_0x53c5c4){var _0x5208c1=_0x53c5c4[_0x1fbb('0x7')]('[')['filter'](function(_0x19211e){return _0x19211e[_0x1fbb('0xb')](']')>-0x1;})[_0x1fbb('0xc')](function(_0x5a54fb){return _0x5a54fb[_0x1fbb('0x7')](']')[0x0];})[0x0];_0x2ca050[_0x1fbb('0xd')][_0x1fbb('0xe')]({'field':_0x3ab176,'operator':_0x57c6e0,'value':_0x5208c1});});});}return _0x2ca050;};exports['buildExpression']=function(_0x1a5bc6,_0x44fe84,_0x24f5df){var _0x44c922={};if(_0x44fe84==='DATE'){if(_0x24f5df['operator']===_0x1fbb('0xf')){_0x24f5df['operator']=_0x1fbb('0x10');_0x24f5df[_0x1fbb('0x11')]+=','+_0x24f5df[_0x1fbb('0x11')];}else if(_[_0x1fbb('0x12')]([_0x1fbb('0x13'),_0x1fbb('0x14')],_0x24f5df['operator'])){_0x24f5df['value']=moment(_0x24f5df[_0x1fbb('0x11')])[_0x1fbb('0x15')](0x1,'days')[_0x1fbb('0x16')](_0x1fbb('0x17'));}}if(_0x24f5df[_0x1fbb('0x18')]){_0x44fe84=_0x24f5df[_0x1fbb('0x18')];_0x44c922['text']='CAST('+_0x1a5bc6+'.'+_0x24f5df[_0x1fbb('0x19')]+_0x1fbb('0x1a')+_0x24f5df[_0x1fbb('0x18')]+')\x20'+parseOperator(_0x24f5df[_0x1fbb('0x1b')]);}else{_0x44c922[_0x1fbb('0x1c')]=_0x1a5bc6+'.'+_0x24f5df['field']+'\x20'+parseOperator(_0x24f5df[_0x1fbb('0x1b')]);}if(_[_0x1fbb('0x12')]([_0x1fbb('0x1d'),_0x1fbb('0x1e')],_0x24f5df['operator']))_0x44c922[_0x1fbb('0x1c')]='('+_0x44c922[_0x1fbb('0x1c')]+'\x20OR\x20'+_0x1a5bc6+'.'+_0x24f5df[_0x1fbb('0x19')]+_0x1fbb('0x1f');_0x44c922[_0x1fbb('0x11')]=parseValue(_0x44fe84,_0x24f5df[_0x1fbb('0x1b')],_0x24f5df[_0x1fbb('0x11')]);return _0x44c922;};function parseOperator(_0x386844){var _0xb37a51;switch(_0x386844){case _0x1fbb('0x20'):_0xb37a51=_0x1fbb('0x21');break;case'$notIn':_0xb37a51=_0x1fbb('0x22');break;case _0x1fbb('0xf'):_0xb37a51=_0x1fbb('0x23');break;case'$ne':_0xb37a51=_0x1fbb('0x24');break;case _0x1fbb('0x25'):case _0x1fbb('0x26'):case _0x1fbb('0x27'):_0xb37a51=_0x1fbb('0x28');break;case _0x1fbb('0x29'):_0xb37a51='<\x20?';break;case _0x1fbb('0x13'):_0xb37a51=_0x1fbb('0x2a');break;case _0x1fbb('0x14'):_0xb37a51=_0x1fbb('0x2b');break;case _0x1fbb('0x2c'):_0xb37a51=_0x1fbb('0x2d');break;case'$between':_0xb37a51=_0x1fbb('0x2e');break;}return _0xb37a51;}function parseValue(_0x2f7fc9,_0x5adca4,_0x2ff877){var _0x5e1568={'start':undefined,'end':undefined};switch(_0x5adca4){case _0x1fbb('0x20'):case _0x1fbb('0x1e'):_0x5e1568[_0x1fbb('0x2f')]=_0x2ff877[_0x1fbb('0x7')](',');break;case _0x1fbb('0x25'):_0x5e1568[_0x1fbb('0x2f')]='%'+_0x2ff877+'%';break;case _0x1fbb('0x26'):_0x5e1568[_0x1fbb('0x2f')]=_0x2ff877+'%';break;case _0x1fbb('0x27'):_0x5e1568['start']='%'+_0x2ff877;break;case _0x1fbb('0x10'):var _0x2d6f45=_0x2ff877['split'](',');var _0x2ff877=_0x2d6f45[_0x1fbb('0x30')]();var _0x5a4486=_0x2d6f45[_0x1fbb('0x31')]();if(_0x2f7fc9==='DATE'){_0x2ff877=moment(_0x2ff877)[_0x1fbb('0x32')](0x0,!![])[_0x1fbb('0x16')]();_0x5a4486=moment(_0x5a4486)[_0x1fbb('0x32')](0x0,!![])['add'](0x17,_0x1fbb('0x33'))['add'](0x3b,_0x1fbb('0x34'))[_0x1fbb('0x15')](0x3b,'seconds')[_0x1fbb('0x16')]();}_0x5e1568={'start':_0x2ff877,'end':_0x5a4486};break;default:_0x5e1568[_0x1fbb('0x2f')]=_0x2ff877;break;}return _0x5e1568;} \ No newline at end of file +var _0x346d=['filter','indexOf','map','conditions','buildExpression','DATE','$eq','value','includes','$gt','operator','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$between','shift','pop','hours','minutes','seconds','parseSearch','sqlOperator','startsWith','and','replace','split','length','slice','match','forEach'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x346d,0x1ae));var _0xd346=function(_0x2d17ec,_0x54eb4d){_0x2d17ec=_0x2d17ec-0x0;var _0x162002=_0x346d[_0x2d17ec];return _0x162002;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0xd346('0x0')]=function(_0x335334){var _0xeab033={'conditions':[]};_0xeab033[_0xd346('0x1')]=_[_0xd346('0x2')](_0x335334,'[$or]')?'or':_0xd346('0x3');var _0x248213=_0x335334[_0xd346('0x4')]('[$and]','')['replace']('[$or]','')[_0xd346('0x5')]('||');for(var _0x10062a=0x0;_0x10062a<_0x248213[_0xd346('0x6')];_0x10062a++){var _0x160914=_0x248213[_0x10062a]['split'](':=');var _0x579228=_0x160914[0x0];var _0x430799=_0x160914[_0xd346('0x7')](0x1);_0x430799['forEach'](function(_0x260898){var _0x50d369=_0x260898[_0xd346('0x5')]('[')['shift']();var _0x2dbb2b=_0x260898[_0xd346('0x8')](/\[(.*?)\]/g);_0x2dbb2b[_0xd346('0x9')](function(_0x277258){var _0x1e5e98=_0x277258[_0xd346('0x5')]('[')[_0xd346('0xa')](function(_0x1fbd3f){return _0x1fbd3f[_0xd346('0xb')](']')>-0x1;})[_0xd346('0xc')](function(_0x9daf72){return _0x9daf72[_0xd346('0x5')](']')[0x0];})[0x0];_0xeab033[_0xd346('0xd')]['push']({'field':_0x579228,'operator':_0x50d369,'value':_0x1e5e98});});});}return _0xeab033;};exports[_0xd346('0xe')]=function(_0x2ef0cd,_0x490e04,_0x401dae){var _0x2e1336={};if(_0x490e04===_0xd346('0xf')){if(_0x401dae['operator']===_0xd346('0x10')){_0x401dae['operator']='$between';_0x401dae[_0xd346('0x11')]+=','+_0x401dae[_0xd346('0x11')];}else if(_[_0xd346('0x12')]([_0xd346('0x13'),'$lte'],_0x401dae[_0xd346('0x14')])){_0x401dae[_0xd346('0x11')]=moment(_0x401dae[_0xd346('0x11')])[_0xd346('0x15')](0x1,_0xd346('0x16'))[_0xd346('0x17')](_0xd346('0x18'));}}if(_0x401dae['castTo']){_0x490e04=_0x401dae[_0xd346('0x19')];_0x2e1336[_0xd346('0x1a')]=_0xd346('0x1b')+_0x2ef0cd+'.'+_0x401dae[_0xd346('0x1c')]+'\x20AS\x20'+_0x401dae[_0xd346('0x19')]+')\x20'+parseOperator(_0x401dae['operator']);}else{_0x2e1336['text']=_0x2ef0cd+'.'+_0x401dae[_0xd346('0x1c')]+'\x20'+parseOperator(_0x401dae[_0xd346('0x14')]);}if(_[_0xd346('0x12')](['$ne',_0xd346('0x1d')],_0x401dae[_0xd346('0x14')]))_0x2e1336[_0xd346('0x1a')]='('+_0x2e1336[_0xd346('0x1a')]+_0xd346('0x1e')+_0x2ef0cd+'.'+_0x401dae[_0xd346('0x1c')]+_0xd346('0x1f');_0x2e1336['value']=parseValue(_0x490e04,_0x401dae[_0xd346('0x14')],_0x401dae[_0xd346('0x11')]);return _0x2e1336;};function parseOperator(_0x3d85f9){var _0x1d29fb;switch(_0x3d85f9){case _0xd346('0x20'):_0x1d29fb=_0xd346('0x21');break;case _0xd346('0x1d'):_0x1d29fb=_0xd346('0x22');break;case'$eq':_0x1d29fb=_0xd346('0x23');break;case _0xd346('0x24'):_0x1d29fb=_0xd346('0x25');break;case _0xd346('0x26'):case _0xd346('0x27'):case _0xd346('0x28'):_0x1d29fb='LIKE\x20?';break;case _0xd346('0x29'):_0x1d29fb=_0xd346('0x2a');break;case'$gt':_0x1d29fb=_0xd346('0x2b');break;case _0xd346('0x2c'):_0x1d29fb=_0xd346('0x2d');break;case _0xd346('0x2e'):_0x1d29fb='>=\x20?';break;case'$between':_0x1d29fb=_0xd346('0x2f');break;}return _0x1d29fb;}function parseValue(_0x429fa9,_0x1d3cfb,_0x1cbcca){var _0x5ca7f8={'start':undefined,'end':undefined};switch(_0x1d3cfb){case _0xd346('0x20'):case _0xd346('0x1d'):_0x5ca7f8[_0xd346('0x30')]=_0x1cbcca['split'](',');break;case _0xd346('0x26'):_0x5ca7f8[_0xd346('0x30')]='%'+_0x1cbcca+'%';break;case _0xd346('0x27'):_0x5ca7f8['start']=_0x1cbcca+'%';break;case'$endsWith':_0x5ca7f8[_0xd346('0x30')]='%'+_0x1cbcca;break;case _0xd346('0x31'):var _0x2d4f2a=_0x1cbcca[_0xd346('0x5')](',');var _0x1cbcca=_0x2d4f2a[_0xd346('0x32')]();var _0x435fb0=_0x2d4f2a[_0xd346('0x33')]();if(_0x429fa9==='DATE'){_0x1cbcca=moment(_0x1cbcca)['utcOffset'](0x0,!![])[_0xd346('0x17')]();_0x435fb0=moment(_0x435fb0)['utcOffset'](0x0,!![])[_0xd346('0x15')](0x17,_0xd346('0x34'))[_0xd346('0x15')](0x3b,_0xd346('0x35'))['add'](0x3b,_0xd346('0x36'))['format']();}_0x5ca7f8={'start':_0x1cbcca,'end':_0x435fb0};break;default:_0x5ca7f8[_0xd346('0x30')]=_0x1cbcca;break;}return _0x5ca7f8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 9496ff5..9590dca 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 _0x63c8=['lower','merge','options','lodash','moment','parse','includes','keys','filters','isEmpty','type','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','sort','indexOf','priority','cast','col','unsigned','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','map','intersection','attributes','fields','nolimit','order','where','pick','filter'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x63c8,0xe7));var _0x863c=function(_0x3ffbeb,_0x27f1cb){_0x3ffbeb=_0x3ffbeb-0x0;var _0x3db2d2=_0x63c8[_0x3ffbeb];return _0x3db2d2;};'use strict';var _=require(_0x863c('0x0'));var sequelize=require('sequelize');var moment=require(_0x863c('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5e8c5d){var _0x3ee867=['ne'];try{var _0x9cea34=JSON[_0x863c('0x2')](_0x5e8c5d);var _0x801513=Object['keys'](_0x9cea34)[0x0];return _0x3ee867[_0x863c('0x3')](_0x801513);}catch(_0x783c3d){return![];}}function getOperatorValue(_0x52a30a){var _0x1ef90a=JSON[_0x863c('0x2')](_0x52a30a);var _0x197a02=Object[_0x863c('0x4')](_0x1ef90a)[0x0];var _0x1dd68d=_0x1ef90a[_0x197a02];return{['$'+_0x197a02]:_0x1dd68d};}exports['fields']=function(_0x5b0c91){var _0x1cea0a=null;if(_0x5b0c91){_0x1cea0a=_0x5b0c91['split'](',');}return _0x1cea0a;};exports[_0x863c('0x5')]=function(_0xe57919,_0x24e5a6){var _0x4c283b={};if(!_[_0x863c('0x6')](_0xe57919)){_['forOwn'](_0xe57919,function(_0x34839a,_0x6064ea){try{if(_0x24e5a6){var _0x2677a6=_['find'](_0x24e5a6,{'name':_0x6064ea})||{};if(hasSequelizeOperator(_0x34839a)){_0x4c283b[_0x6064ea]=getOperatorValue(_0x34839a);}else if(_0x2677a6[_0x863c('0x7')]==='DATE'&&_['isPlainObject'](_0x34839a)){var _0x50b0c0=JSON[_0x863c('0x2')](_0x34839a);var _0xccbe9d={'$gte':moment(moment(_0x50b0c0[_0x863c('0x8')])[_0x863c('0x9')](_0x863c('0xa')))[_0x863c('0xb')]()['format'](),'$lte':moment(moment(_0x50b0c0[_0x863c('0xc')])[_0x863c('0x9')]('YYYY-MM-DD'))[_0x863c('0xb')]()[_0x863c('0xd')](0x1,'s')[_0x863c('0x9')]()};_0x4c283b[_0x6064ea]=_0xccbe9d;}else if(_0x2677a6[_0x863c('0xe')]===_0x863c('0xf')){_0x4c283b[_0x6064ea]=_0x34839a;}else{_0x4c283b[_0x6064ea]=_[_0x863c('0x10')](_0x34839a)?_0x34839a:JSON[_0x863c('0x2')](_0x34839a);}}else{_0x4c283b[_0x6064ea]=_[_0x863c('0x10')](_0x34839a)?_0x34839a:JSON[_0x863c('0x2')](_0x34839a);}}catch(_0x48e22b){_0x4c283b[_0x6064ea]=_0x34839a[_0x863c('0x11')](',');}});}return _0x4c283b;};exports[_0x863c('0x12')]=function(_0x124035){_0x124035=parseInt(_0x124035,0xa);if(!_0x124035||_0x124035<0x0){_0x124035=LIMIT_VALUE;}return _0x124035;};exports[_0x863c('0x13')]=function(_0x54955a){_0x54955a=parseInt(_0x54955a,0xa);if(!_0x54955a||_0x54955a<0x0){_0x54955a=0x0;}return _0x54955a;};exports[_0x863c('0x14')]=function(_0x4168ee){var _0x1b74ef,_0x5212a4=null;if(_0x4168ee){_0x1b74ef=_0x4168ee[_0x863c('0x11')](',');_0x5212a4=_['map'](_0x1b74ef,function(_0x25ebbc){if(_0x25ebbc[_0x863c('0x15')]('-')===0x0){return[_0x25ebbc===_0x863c('0x16')?sequelize[_0x863c('0x17')](sequelize[_0x863c('0x18')](_0x863c('0x16')),_0x863c('0x19')):_0x25ebbc['substr'](0x1),'DESC'];}else{return[_0x25ebbc===_0x863c('0x16')?sequelize['cast'](sequelize[_0x863c('0x18')](_0x863c('0x16')),'unsigned'):_0x25ebbc,_0x863c('0x1a')];}});}return _0x5212a4;};exports[_0x863c('0x1b')]=function(_0x297de3,_0x2d4bb5){if(_[_0x863c('0x6')](_0x297de3)){return _0x297de3;}if(_[_0x863c('0x10')](_0x297de3)){for(var _0x2ca5b4=0x0;_0x2ca5b4<_0x297de3[_0x863c('0x1c')];_0x2ca5b4+=0x1){_0x297de3[_0x2ca5b4]=this[_0x863c('0x1b')](_0x297de3[_0x2ca5b4],_0x2d4bb5);}return _0x297de3;}if(!_[_0x863c('0x1d')](_0x297de3)){return _0x297de3;}if(_[_0x863c('0x1e')](_0x2d4bb5)){_0x2d4bb5=[_0x2d4bb5];}if(!_[_0x863c('0x10')](_0x2d4bb5)){return _0x297de3;}for(var _0x1d1528=0x0;_0x1d1528<_0x2d4bb5[_0x863c('0x1c')];_0x1d1528+=0x1){_[_0x863c('0x1f')](_0x297de3,_0x2d4bb5[_0x1d1528]);}for(var _0x57bc34 in _0x297de3){if(_0x297de3[_0x863c('0x20')](_0x57bc34)){_0x297de3[_0x57bc34]=this[_0x863c('0x1b')](_0x297de3[_0x57bc34],_0x2d4bb5);}}return _0x297de3;};exports[_0x863c('0x21')]=function(_0x77edc4){return _0x77edc4[_0x863c('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x863c('0x23')]=function(_0x56fafc){return _0x56fafc[_0x863c('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x863c('0x24')]=function(_0x1d0f3d){var _0x5f3c44=[];_0x1d0f3d[_0x863c('0x11')](/[ ,]+/)[_0x863c('0x25')](function(_0x281391){_0x281391=_0x281391[_0x863c('0x26')](/([^:]")"+/g,'$1');_0x281391='+'+_0x281391+'*';if(_0x281391[_0x863c('0x3')]('@'))_0x281391='\x22'+_0x281391+'\x22';_0x5f3c44[_0x863c('0x27')](_0x281391);});return _0x5f3c44[_0x863c('0x28')]('\x20');};exports[_0x863c('0x29')]=function(_0x189b2f,_0xa9e9f8,_0x437954){var _0x11f53b={},_0x3731cc={};if(_0xa9e9f8[_0x863c('0x2a')][_0x863c('0x2b')]){_0xa9e9f8['query']['id']=_0xa9e9f8[_0x863c('0x2a')][_0x863c('0x2b')];delete _0xa9e9f8['query'][_0x863c('0x2b')];}_0x11f53b[_0x863c('0x2c')]=_[_0x863c('0x2d')](_0x189b2f,_0x863c('0xe'));_0x11f53b[_0x863c('0x2a')]=_[_0x863c('0x4')](_0xa9e9f8[_0x863c('0x2a')]);_0x11f53b[_0x863c('0x5')]=_[_0x863c('0x2e')](_0x11f53b[_0x863c('0x2c')],_0x11f53b[_0x863c('0x2a')]);_0x3731cc[_0x863c('0x2f')]=_[_0x863c('0x2e')](_0x11f53b['model'],this[_0x863c('0x30')](_0xa9e9f8[_0x863c('0x2a')][_0x863c('0x30')]));_0x3731cc[_0x863c('0x2f')]=_0x3731cc[_0x863c('0x2f')]['length']?_0x3731cc[_0x863c('0x2f')]:_0x11f53b[_0x863c('0x2c')];if(!_0xa9e9f8[_0x863c('0x2a')][_0x863c('0x20')](_0x863c('0x31'))){_0x3731cc[_0x863c('0x12')]=this[_0x863c('0x12')](_0xa9e9f8[_0x863c('0x2a')]['limit']);_0x3731cc[_0x863c('0x13')]=this[_0x863c('0x13')](_0xa9e9f8[_0x863c('0x2a')][_0x863c('0x13')]);}_0x3731cc[_0x863c('0x32')]=this['sort'](_0xa9e9f8['query']['sort']);_0x3731cc[_0x863c('0x33')]=this[_0x863c('0x5')](_[_0x863c('0x34')](_0xa9e9f8['query'],_0x11f53b[_0x863c('0x5')]),_0x189b2f);if(_0xa9e9f8[_0x863c('0x2a')][_0x863c('0x35')]){_0x3731cc['where']=_['merge'](_0x3731cc[_0x863c('0x33')],{'$or':_[_0x863c('0x2d')](_0x189b2f,function(_0x33f274){if(_0x33f274[_0x863c('0x7')]!=='VIRTUAL'){if(_0x437954){return sequelize['where'](sequelize['fn'](_0x863c('0x36'),sequelize['col'](_0x33f274[_0x863c('0xe')])),{'$like':sequelize['fn']('lower','%'+_0xa9e9f8['query'][_0x863c('0x35')]+'%')});}else{var _0x2da102={};_0x2da102[_0x33f274[_0x863c('0xe')]]={'$like':'%'+_0xa9e9f8[_0x863c('0x2a')][_0x863c('0x35')]+'%'};return _0x2da102;}}})});}_0x3731cc=_[_0x863c('0x37')]({},_0x3731cc,_0xa9e9f8[_0x863c('0x38')]);return _0x3731cc;}; \ No newline at end of file +var _0xdf5e=['$id','model','intersection','fields','attributes','hasOwnProperty','order','where','filter','merge','map','VIRTUAL','lower','options','sequelize','parse','keys','includes','split','filters','isEmpty','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','col','unsigned','substr','omit','isString','length','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','replace','join','getOptions','query'];(function(_0x40142d,_0x14d02d){var _0x8bc5c5=function(_0x24c4cb){while(--_0x24c4cb){_0x40142d['push'](_0x40142d['shift']());}};_0x8bc5c5(++_0x14d02d);}(_0xdf5e,0xde));var _0xedf5=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0xdf5e[_0x3b1e3f];return _0x3b1cd3;};'use strict';var _=require('lodash');var sequelize=require(_0xedf5('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1098d0){var _0x1d5f76=['ne'];try{var _0x46e071=JSON[_0xedf5('0x1')](_0x1098d0);var _0x5db4dd=Object[_0xedf5('0x2')](_0x46e071)[0x0];return _0x1d5f76[_0xedf5('0x3')](_0x5db4dd);}catch(_0x281afe){return![];}}function getOperatorValue(_0x4f2918){var _0x4cd55b=JSON[_0xedf5('0x1')](_0x4f2918);var _0x5e16a1=Object['keys'](_0x4cd55b)[0x0];var _0x5938e4=_0x4cd55b[_0x5e16a1];return{['$'+_0x5e16a1]:_0x5938e4};}exports['fields']=function(_0x5fc01a){var _0x2ae438=null;if(_0x5fc01a){_0x2ae438=_0x5fc01a[_0xedf5('0x4')](',');}return _0x2ae438;};exports[_0xedf5('0x5')]=function(_0x5475fc,_0x2786f2){var _0x35cdbd={};if(!_[_0xedf5('0x6')](_0x5475fc)){_['forOwn'](_0x5475fc,function(_0x3f1457,_0x3110aa){try{if(_0x2786f2){var _0xb8b80a=_['find'](_0x2786f2,{'name':_0x3110aa})||{};if(hasSequelizeOperator(_0x3f1457)){_0x35cdbd[_0x3110aa]=getOperatorValue(_0x3f1457);}else if(_0xb8b80a[_0xedf5('0x7')]===_0xedf5('0x8')&&_['isPlainObject'](_0x3f1457)){var _0x15a085=JSON[_0xedf5('0x1')](_0x3f1457);var _0x4a00fb={'$gte':moment(moment(_0x15a085[_0xedf5('0x9')])[_0xedf5('0xa')](_0xedf5('0xb')))[_0xedf5('0xc')]()[_0xedf5('0xa')](),'$lte':moment(moment(_0x15a085[_0xedf5('0xd')])['format'](_0xedf5('0xb')))[_0xedf5('0xc')]()['subtract'](0x1,'s')[_0xedf5('0xa')]()};_0x35cdbd[_0x3110aa]=_0x4a00fb;}else if(_0xb8b80a[_0xedf5('0xe')]===_0xedf5('0xf')){_0x35cdbd[_0x3110aa]=_0x3f1457;}else{_0x35cdbd[_0x3110aa]=_[_0xedf5('0x10')](_0x3f1457)?_0x3f1457:JSON[_0xedf5('0x1')](_0x3f1457);}}else{_0x35cdbd[_0x3110aa]=_[_0xedf5('0x10')](_0x3f1457)?_0x3f1457:JSON[_0xedf5('0x1')](_0x3f1457);}}catch(_0x5d79d8){_0x35cdbd[_0x3110aa]=_0x3f1457[_0xedf5('0x4')](',');}});}return _0x35cdbd;};exports[_0xedf5('0x11')]=function(_0x53b91e){_0x53b91e=parseInt(_0x53b91e,0xa);if(!_0x53b91e||_0x53b91e<0x0){_0x53b91e=LIMIT_VALUE;}return _0x53b91e;};exports[_0xedf5('0x12')]=function(_0x2e5187){_0x2e5187=parseInt(_0x2e5187,0xa);if(!_0x2e5187||_0x2e5187<0x0){_0x2e5187=0x0;}return _0x2e5187;};exports[_0xedf5('0x13')]=function(_0x37112d){var _0x4c8947,_0x5f0f92=null;if(_0x37112d){_0x4c8947=_0x37112d[_0xedf5('0x4')](',');_0x5f0f92=_['map'](_0x4c8947,function(_0x5ece74){if(_0x5ece74[_0xedf5('0x14')]('-')===0x0){return[_0x5ece74===_0xedf5('0x15')?sequelize[_0xedf5('0x16')](sequelize[_0xedf5('0x17')](_0xedf5('0x15')),_0xedf5('0x18')):_0x5ece74[_0xedf5('0x19')](0x1),'DESC'];}else{return[_0x5ece74===_0xedf5('0x15')?sequelize[_0xedf5('0x16')](sequelize[_0xedf5('0x17')](_0xedf5('0x15')),_0xedf5('0x18')):_0x5ece74,'ASC'];}});}return _0x5f0f92;};exports[_0xedf5('0x1a')]=function(_0x3fb914,_0x155f3a){if(_[_0xedf5('0x6')](_0x3fb914)){return _0x3fb914;}if(_['isArray'](_0x3fb914)){for(var _0x4d273c=0x0;_0x4d273c<_0x3fb914['length'];_0x4d273c+=0x1){_0x3fb914[_0x4d273c]=this[_0xedf5('0x1a')](_0x3fb914[_0x4d273c],_0x155f3a);}return _0x3fb914;}if(!_['isObject'](_0x3fb914)){return _0x3fb914;}if(_[_0xedf5('0x1b')](_0x155f3a)){_0x155f3a=[_0x155f3a];}if(!_[_0xedf5('0x10')](_0x155f3a)){return _0x3fb914;}for(var _0x20d8a9=0x0;_0x20d8a9<_0x155f3a[_0xedf5('0x1c')];_0x20d8a9+=0x1){_[_0xedf5('0x1d')](_0x3fb914,_0x155f3a[_0x20d8a9]);}for(var _0x16bf2f in _0x3fb914){if(_0x3fb914['hasOwnProperty'](_0x16bf2f)){_0x3fb914[_0x16bf2f]=this[_0xedf5('0x1a')](_0x3fb914[_0x16bf2f],_0x155f3a);}}return _0x3fb914;};exports[_0xedf5('0x1e')]=function(_0x5e5f6c){return _0x5e5f6c[_0xedf5('0x1f')](RegExp(_0xedf5('0x20')))?!![]:![];};exports[_0xedf5('0x21')]=function(_0x5bc60f){return _0x5bc60f['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x430aed){var _0x1469ee=[];_0x430aed['split'](/[ ,]+/)['forEach'](function(_0x55e302){_0x55e302=_0x55e302[_0xedf5('0x22')](/([^:]")"+/g,'$1');_0x55e302='+'+_0x55e302+'*';if(_0x55e302[_0xedf5('0x3')]('@'))_0x55e302='\x22'+_0x55e302+'\x22';_0x1469ee['push'](_0x55e302);});return _0x1469ee[_0xedf5('0x23')]('\x20');};exports[_0xedf5('0x24')]=function(_0xe99610,_0x2535d4,_0x3e9130){var _0x34ab46={},_0x1b97c2={};if(_0x2535d4[_0xedf5('0x25')][_0xedf5('0x26')]){_0x2535d4[_0xedf5('0x25')]['id']=_0x2535d4[_0xedf5('0x25')]['$id'];delete _0x2535d4['query'][_0xedf5('0x26')];}_0x34ab46[_0xedf5('0x27')]=_['map'](_0xe99610,_0xedf5('0xe'));_0x34ab46[_0xedf5('0x25')]=_[_0xedf5('0x2')](_0x2535d4[_0xedf5('0x25')]);_0x34ab46[_0xedf5('0x5')]=_[_0xedf5('0x28')](_0x34ab46[_0xedf5('0x27')],_0x34ab46['query']);_0x1b97c2['attributes']=_[_0xedf5('0x28')](_0x34ab46[_0xedf5('0x27')],this[_0xedf5('0x29')](_0x2535d4['query'][_0xedf5('0x29')]));_0x1b97c2['attributes']=_0x1b97c2[_0xedf5('0x2a')][_0xedf5('0x1c')]?_0x1b97c2[_0xedf5('0x2a')]:_0x34ab46[_0xedf5('0x27')];if(!_0x2535d4[_0xedf5('0x25')][_0xedf5('0x2b')]('nolimit')){_0x1b97c2[_0xedf5('0x11')]=this[_0xedf5('0x11')](_0x2535d4[_0xedf5('0x25')][_0xedf5('0x11')]);_0x1b97c2[_0xedf5('0x12')]=this[_0xedf5('0x12')](_0x2535d4[_0xedf5('0x25')][_0xedf5('0x12')]);}_0x1b97c2[_0xedf5('0x2c')]=this[_0xedf5('0x13')](_0x2535d4[_0xedf5('0x25')]['sort']);_0x1b97c2[_0xedf5('0x2d')]=this[_0xedf5('0x5')](_['pick'](_0x2535d4['query'],_0x34ab46[_0xedf5('0x5')]),_0xe99610);if(_0x2535d4[_0xedf5('0x25')][_0xedf5('0x2e')]){_0x1b97c2[_0xedf5('0x2d')]=_[_0xedf5('0x2f')](_0x1b97c2[_0xedf5('0x2d')],{'$or':_[_0xedf5('0x30')](_0xe99610,function(_0x214398){if(_0x214398['type']!==_0xedf5('0x31')){if(_0x3e9130){return sequelize[_0xedf5('0x2d')](sequelize['fn']('lower',sequelize[_0xedf5('0x17')](_0x214398[_0xedf5('0xe')])),{'$like':sequelize['fn'](_0xedf5('0x32'),'%'+_0x2535d4['query']['filter']+'%')});}else{var _0x3ed899={};_0x3ed899[_0x214398[_0xedf5('0xe')]]={'$like':'%'+_0x2535d4[_0xedf5('0x25')]['filter']+'%'};return _0x3ed899;}}})});}_0x1b97c2=_[_0xedf5('0x2f')]({},_0x1b97c2,_0x2535d4[_0xedf5('0x33')]);return _0x1b97c2;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 78edb71..248487b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4138=['development','test','appPath','client','use','json\x20replacer','toISOString','split','static','views','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','serve-favicon','cookie-parser','errorhandler','passport','cors','moment','./environment','../mysqldb','default','get','production','set','join','root','public'];(function(_0x3698ed,_0x5eaaf1){var _0x2ec7d7=function(_0x55a1f7){while(--_0x55a1f7){_0x3698ed['push'](_0x3698ed['shift']());}};_0x2ec7d7(++_0x5eaaf1);}(_0x4138,0xb1));var _0x8413=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4138[_0x2d7f0e];return _0x110b07;};'use strict';var express=require('express');var favicon=require(_0x8413('0x0'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x8413('0x1'));var errorHandler=require(_0x8413('0x2'));var path=require('path');var passport=require(_0x8413('0x3'));var cors=require(_0x8413('0x4'));var moment=require(_0x8413('0x5'));var config=require(_0x8413('0x6'));var db=require(_0x8413('0x7'))['db'];exports[_0x8413('0x8')]=function(_0x1a1150){var _0x205823=_0x1a1150[_0x8413('0x9')]('env');if(_0x205823===_0x8413('0xa')){_0x1a1150[_0x8413('0xb')]('appPath',path[_0x8413('0xc')](config[_0x8413('0xd')],_0x8413('0xe')));}if(_0x205823===_0x8413('0xf')||_0x205823===_0x8413('0x10')){_0x1a1150['set'](_0x8413('0x11'),path[_0x8413('0xc')](config[_0x8413('0xd')],_0x8413('0x12')));_0x1a1150[_0x8413('0x13')](errorHandler());}_0x1a1150['set'](_0x8413('0x14'),function(_0x21079,_0x44b893){if(this[_0x21079]instanceof Date){_0x44b893=this[_0x21079][_0x8413('0x15')]()[_0x8413('0x16')]('.')[0x0]+'Z';}return _0x44b893;});_0x1a1150['use'](express[_0x8413('0x17')](_0x1a1150[_0x8413('0x9')](_0x8413('0x11'))));_0x1a1150[_0x8413('0xb')](_0x8413('0x18'),config[_0x8413('0xd')]+_0x8413('0x19'));_0x1a1150[_0x8413('0x1a')](_0x8413('0x1b'),require(_0x8413('0x1c'))[_0x8413('0x1d')]);_0x1a1150[_0x8413('0xb')]('view\x20engine',_0x8413('0x1b'));_0x1a1150[_0x8413('0x13')](bodyParser[_0x8413('0x1e')]({'limit':_0x8413('0x1f'),'extended':!![]}));_0x1a1150['use'](bodyParser['json']({'limit':_0x8413('0x1f')}));_0x1a1150[_0x8413('0x13')](cors());_0x1a1150['use'](methodOverride());_0x1a1150['use'](cookieParser());_0x1a1150['use'](passport['initialize']());}; \ No newline at end of file +var _0x039b=['appPath','join','public','development','test','root','use','json\x20replacer','toISOString','split','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','body-parser','method-override','errorhandler','path','cors','moment','./environment','../mysqldb','get','set'];(function(_0x3d1a9f,_0x394606){var _0x3f0c79=function(_0x22f7ad){while(--_0x22f7ad){_0x3d1a9f['push'](_0x3d1a9f['shift']());}};_0x3f0c79(++_0x394606);}(_0x039b,0x1a8));var _0xb039=function(_0x469c3c,_0x498e4e){_0x469c3c=_0x469c3c-0x0;var _0x507037=_0x039b[_0x469c3c];return _0x507037;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0xb039('0x0'));var methodOverride=require(_0xb039('0x1'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xb039('0x2'));var path=require(_0xb039('0x3'));var passport=require('passport');var cors=require(_0xb039('0x4'));var moment=require(_0xb039('0x5'));var config=require(_0xb039('0x6'));var db=require(_0xb039('0x7'))['db'];exports['default']=function(_0x200383){var _0x38ccd6=_0x200383[_0xb039('0x8')]('env');if(_0x38ccd6==='production'){_0x200383[_0xb039('0x9')](_0xb039('0xa'),path[_0xb039('0xb')](config['root'],_0xb039('0xc')));}if(_0x38ccd6===_0xb039('0xd')||_0x38ccd6===_0xb039('0xe')){_0x200383[_0xb039('0x9')](_0xb039('0xa'),path['join'](config[_0xb039('0xf')],'client'));_0x200383[_0xb039('0x10')](errorHandler());}_0x200383['set'](_0xb039('0x11'),function(_0x13ee30,_0x4d1b3f){if(this[_0x13ee30]instanceof Date){_0x4d1b3f=this[_0x13ee30][_0xb039('0x12')]()[_0xb039('0x13')]('.')[0x0]+'Z';}return _0x4d1b3f;});_0x200383[_0xb039('0x10')](express['static'](_0x200383['get'](_0xb039('0xa'))));_0x200383[_0xb039('0x9')](_0xb039('0x14'),config[_0xb039('0xf')]+_0xb039('0x15'));_0x200383[_0xb039('0x16')](_0xb039('0x17'),require(_0xb039('0x18'))[_0xb039('0x19')]);_0x200383[_0xb039('0x9')](_0xb039('0x1a'),_0xb039('0x17'));_0x200383[_0xb039('0x10')](bodyParser[_0xb039('0x1b')]({'limit':_0xb039('0x1c'),'extended':!![]}));_0x200383[_0xb039('0x10')](bodyParser[_0xb039('0x1d')]({'limit':_0xb039('0x1c')}));_0x200383[_0xb039('0x10')](cors());_0x200383[_0xb039('0x10')](methodOverride());_0x200383[_0xb039('0x10')](cookieParser());_0x200383[_0xb039('0x10')](passport[_0xb039('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index e1e4406..06afcf6 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 _0x14c5=['macAddress','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','filter','family','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname'];(function(_0x2bd0db,_0x1509b8){var _0x5dafba=function(_0x512f6e){while(--_0x512f6e){_0x2bd0db['push'](_0x2bd0db['shift']());}};_0x5dafba(++_0x1509b8);}(_0x14c5,0x69));var _0x514c=function(_0x42e327,_0x25fe63){_0x42e327=_0x42e327-0x0;var _0x149c08=_0x14c5[_0x42e327];return _0x149c08;};'use strict';var _=require(_0x514c('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x514c('0x1'));var exec=require(_0x514c('0x2'))[_0x514c('0x3')];var config=require('../environment');function getInterfaces(){var _0x27fe47=[];var _0xdd4237=os[_0x514c('0x4')]();var _0x59d0ff=_[_0x514c('0x5')](_['keys'](_0xdd4237));for(var _0x21e6d9=0x0;_0x21e6d9<_0x59d0ff['length'];_0x21e6d9++){var _0x5255a1=_0xdd4237[_0x59d0ff[_0x21e6d9]][_0x514c('0x6')](function(_0x9e3f90){return _0x9e3f90[_0x514c('0x7')]===_0x514c('0x8')&&_0x9e3f90['internal']===![];});_0x27fe47=_0x27fe47[_0x514c('0x9')](_0x5255a1);}return _0x27fe47;}function getFirstInterface(){var _0x45ee20=_['head'](getInterfaces());return{'macAddress':_0x45ee20&&_0x45ee20['mac']?_0x45ee20[_0x514c('0xa')]:_0x514c('0xb'),'ipAddress':_0x45ee20&&_0x45ee20[_0x514c('0xc')]?_0x45ee20[_0x514c('0xc')]:_0x514c('0xd')};}exports[_0x514c('0xe')]=getFirstInterface;function getCPUhash(){var _0x5bf388=_[_0x514c('0x5')](os[_0x514c('0xf')]()[_0x514c('0x10')](function(_0x9487a2){return _0x9487a2[_0x514c('0x11')];}))[_0x514c('0x12')](':');return crypto[_0x514c('0x13')](_0x514c('0x14'))[_0x514c('0x15')](_0x5bf388)[_0x514c('0x16')](_0x514c('0x17'));}exports[_0x514c('0x18')]=function(){var _0x43260e=os[_0x514c('0x19')]();var _0x4f920b=/[0-9a-f-]{36}/;if(config[_0x514c('0x1a')]&&_0x4f920b['test'](config[_0x514c('0x1a')])){return config[_0x514c('0x1a')];}else if(_0x43260e===_0x514c('0x1b')){return exec(_0x514c('0x1c'),{'encoding':_0x514c('0x1d')})['replace']('\x0d\x0a','');}else{var _0xd50140=getFirstInterface();var _0xb74fd3=getCPUhash();var _0x5d94d5=_0xb74fd3+'|'+os[_0x514c('0x1e')]()+'|'+_0xd50140[_0x514c('0x1f')]+'|'+_0xd50140[_0x514c('0x20')];var _0x28c49a=crypto[_0x514c('0x13')]('md5')['update'](_0x5d94d5)[_0x514c('0x16')](_0x514c('0x17'));return _0x28c49a[_0x514c('0x21')](0x0,0x8)+'-'+_0x28c49a['substring'](0x8,0xc)+'-'+_0x28c49a['substring'](0xc,0x10)+'-'+_0x28c49a[_0x514c('0x21')](0x10,0x14)+'-'+_0x28c49a[_0x514c('0x21')](0x14);}}; \ No newline at end of file +var _0x0dff=['mac','00:00:00:00:00:00','address','getFirstInterface','map','model','join','createHash','md5','update','hex','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','head'];(function(_0x549cdd,_0x5eb1d0){var _0x357641=function(_0x413286){while(--_0x413286){_0x549cdd['push'](_0x549cdd['shift']());}};_0x357641(++_0x5eb1d0);}(_0x0dff,0x1d3));var _0xf0df=function(_0x2772f3,_0x18c26b){_0x2772f3=_0x2772f3-0x0;var _0x26d7ac=_0x0dff[_0x2772f3];return _0x26d7ac;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xf0df('0x0'));var machine=require(_0xf0df('0x1'));var exec=require(_0xf0df('0x2'))[_0xf0df('0x3')];var config=require('../environment');function getInterfaces(){var _0x31c9b1=[];var _0x4e6bcf=os[_0xf0df('0x4')]();var _0x5b0c48=_[_0xf0df('0x5')](_[_0xf0df('0x6')](_0x4e6bcf));for(var _0x34c573=0x0;_0x34c573<_0x5b0c48[_0xf0df('0x7')];_0x34c573++){var _0x493d90=_0x4e6bcf[_0x5b0c48[_0x34c573]][_0xf0df('0x8')](function(_0x43c296){return _0x43c296[_0xf0df('0x9')]===_0xf0df('0xa')&&_0x43c296['internal']===![];});_0x31c9b1=_0x31c9b1[_0xf0df('0xb')](_0x493d90);}return _0x31c9b1;}function getFirstInterface(){var _0x230a57=_[_0xf0df('0xc')](getInterfaces());return{'macAddress':_0x230a57&&_0x230a57[_0xf0df('0xd')]?_0x230a57[_0xf0df('0xd')]:_0xf0df('0xe'),'ipAddress':_0x230a57&&_0x230a57['address']?_0x230a57[_0xf0df('0xf')]:'127.0.0.1'};}exports[_0xf0df('0x10')]=getFirstInterface;function getCPUhash(){var _0x332f4f=_[_0xf0df('0x5')](os['cpus']()[_0xf0df('0x11')](function(_0x53c956){return _0x53c956[_0xf0df('0x12')];}))[_0xf0df('0x13')](':');return crypto[_0xf0df('0x14')](_0xf0df('0x15'))[_0xf0df('0x16')](_0x332f4f)['digest'](_0xf0df('0x17'));}exports['getUuid']=function(){var _0x270f7d=os['platform']();var _0x86f63c=/[0-9a-f-]{36}/;if(config[_0xf0df('0x18')]&&_0x86f63c[_0xf0df('0x19')](config[_0xf0df('0x18')])){return config[_0xf0df('0x18')];}else if(_0x270f7d===_0xf0df('0x1a')){return exec(_0xf0df('0x1b'),{'encoding':'utf8'})[_0xf0df('0x1c')]('\x0d\x0a','');}else{var _0x2831ca=getFirstInterface();var _0x1ef3c8=getCPUhash();var _0x58bab4=_0x1ef3c8+'|'+os['hostname']()+'|'+_0x2831ca[_0xf0df('0x1d')]+'|'+_0x2831ca[_0xf0df('0x1e')];var _0x54f661=crypto[_0xf0df('0x14')](_0xf0df('0x15'))[_0xf0df('0x16')](_0x58bab4)['digest']('hex');return _0x54f661[_0xf0df('0x1f')](0x0,0x8)+'-'+_0x54f661['substring'](0x8,0xc)+'-'+_0x54f661['substring'](0xc,0x10)+'-'+_0x54f661[_0xf0df('0x1f')](0x10,0x14)+'-'+_0x54f661[_0xf0df('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 6c2d6ed..0386e99 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 _0x4bf7=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','update','diff','days','error','finally','getUuid','License','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data2','data1','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x250790,_0x4807b1){var _0xd64a7e=function(_0x28b10e){while(--_0x28b10e){_0x250790['push'](_0x250790['shift']());}};_0xd64a7e(++_0x4807b1);}(_0x4bf7,0x159));var _0x74bf=function(_0x208f7d,_0x346df0){_0x208f7d=_0x208f7d-0x0;var _0x5b9694=_0x4bf7[_0x208f7d];return _0x5b9694;};'use strict';var util=require(_0x74bf('0x0'));var moment=require(_0x74bf('0x1'));var rp=require(_0x74bf('0x2'));var BPromise=require(_0x74bf('0x3'));var pkginfo=require(_0x74bf('0x4'))(module,_0x74bf('0x5'));var db=require(_0x74bf('0x6'))['db'];var encryptor=require(_0x74bf('0x7'));var hardware=require(_0x74bf('0x8'));var logger=require(_0x74bf('0x9'))(_0x74bf('0xa'));var HOST=_0x74bf('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xc59d30){return new BPromise(function(_0x2ab14c,_0x458317){var _0x19fd81=util[_0x74bf('0xc')](_0x74bf('0xd'),HOST,_0xc59d30,module['exports'][_0x74bf('0x5')]);if(oldToken){_0x19fd81=util[_0x74bf('0xc')](_0x74bf('0xe'),HOST,_0xc59d30,module['exports'][_0x74bf('0x5')],oldToken);}var _0x8ebe27={'uri':_0x19fd81,'method':_0x74bf('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x8ebe27)[_0x74bf('0x10')](function(_0x13efb7){_0x2ab14c(_0x13efb7);})[_0x74bf('0x11')](function(_0x50784e){_0x458317(_0x50784e);});});}function manageLicense(_0x222066,_0x22449){var _0x49950f=_0x22449['get']({'plain':!![]});if(!isOldTokenSent&&_0x49950f['data1']!==_0x222066&&!_0x49950f[_0x74bf('0x12')]){oldToken=_0x49950f[_0x74bf('0x13')];}httpRequest(_0x222066)[_0x74bf('0x10')](function(_0x443461){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x443461['active']){isOldTokenSent=![];if(!_0x49950f[_0x74bf('0xa')]&&_0x49950f[_0x74bf('0xa')]!=_0x443461['license']||_0x49950f[_0x74bf('0xa')]&&_0x49950f[_0x74bf('0x12')]){logger[_0x74bf('0x14')](_0x74bf('0x15'));}if(_0x49950f['license']&&!_0x49950f[_0x74bf('0x12')]&&_0x49950f['license']!=_0x443461['license']){logger[_0x74bf('0x14')](_0x74bf('0x16'));}if(_0x49950f['license']&&!_0x49950f[_0x74bf('0x12')]&&_0x49950f['license']==_0x443461['license']){return _0x22449;}return _0x22449['update']({'data1':_0x222066,'data2':null,'license':_0x443461['license']});}else{if(_0x443461['license']||_0x49950f[_0x74bf('0xa')]){if(!_0x49950f[_0x74bf('0x12')]){if(_0x49950f[_0x74bf('0x13')]==_0x222066){GRAY_PERIOD_REASON=_0x74bf('0x17');logger['info'](_0x74bf('0x18'));}else{GRAY_PERIOD_REASON=_0x74bf('0x19');logger['info'](_0x74bf('0x1a'),_0x49950f[_0x74bf('0x13')],_0x222066);}logger[_0x74bf('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x74bf('0xc')](_0x74bf('0x1b')));return _0x22449[_0x74bf('0x1c')]({'data2':encryptor['encryptString'](moment()[_0x74bf('0xc')](_0x74bf('0x1b')))});}else{if(moment()[_0x74bf('0x1d')](encryptor['decryptString'](_0x49950f['data2']),_0x74bf('0x1e'))>DAYS){logger[_0x74bf('0x14')]('DEMO\x20START\x20AT\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x22449['update']({'data1':_0x222066,'data2':null,'license':null});}}}else{if(_0x49950f[_0x74bf('0x13')]!=_0x222066){logger['info'](_0x74bf('0x1a'),_0x49950f[_0x74bf('0x13')],_0x222066);return _0x22449[_0x74bf('0x1c')]({'data1':_0x222066,'data2':null,'license':null});}}}return _0x22449;})[_0x74bf('0x10')](function(_0xf257cb){_0x22449=_0xf257cb;})[_0x74bf('0x11')](function(_0x352638){logger[_0x74bf('0x1f')](_0x352638['message']);})[_0x74bf('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x74bf('0x21')](),_0x22449);},TIME);});}function defaultLicense(){var _0x3acd8f=hardware['getUuid']();if(_0x3acd8f){return db[_0x74bf('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x3acd8f}})['spread'](function(_0x2ea4da,_0x21cd65){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3acd8f);manageLicense(_0x3acd8f,_0x2ea4da);})['catch'](function(_0x5dc710){logger[_0x74bf('0x1f')](_0x5dc710[_0x74bf('0x23')]);});}}exports[_0x74bf('0x24')]=defaultLicense; \ No newline at end of file +var _0x1ccd=['active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','util','moment','request-promise','bluebird','version','../../components/encryptor','../logger','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2'];(function(_0x5a5699,_0x5f0572){var _0x706221=function(_0x35a449){while(--_0x35a449){_0x5a5699['push'](_0x5a5699['shift']());}};_0x706221(++_0x5f0572);}(_0x1ccd,0x1a1));var _0xd1cc=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x1ccd[_0x1e9424];return _0x1bd96c;};'use strict';var util=require(_0xd1cc('0x0'));var moment=require(_0xd1cc('0x1'));var rp=require(_0xd1cc('0x2'));var BPromise=require(_0xd1cc('0x3'));var pkginfo=require('pkginfo')(module,_0xd1cc('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xd1cc('0x5'));var hardware=require('./hardware');var logger=require(_0xd1cc('0x6'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x279d77){return new BPromise(function(_0x4f1d68,_0x45640e){var _0x4ed2bc=util[_0xd1cc('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0x279d77,module['exports'][_0xd1cc('0x4')]);if(oldToken){_0x4ed2bc=util[_0xd1cc('0x7')](_0xd1cc('0x8'),HOST,_0x279d77,module['exports'][_0xd1cc('0x4')],oldToken);}var _0x2303e5={'uri':_0x4ed2bc,'method':_0xd1cc('0x9'),'timeout':0xea60,'json':!![]};return rp(_0x2303e5)[_0xd1cc('0xa')](function(_0x23b4ee){_0x4f1d68(_0x23b4ee);})[_0xd1cc('0xb')](function(_0x1a1c01){_0x45640e(_0x1a1c01);});});}function manageLicense(_0x4f4205,_0x366790){var _0x4750d7=_0x366790[_0xd1cc('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x4750d7[_0xd1cc('0xd')]!==_0x4f4205&&!_0x4750d7[_0xd1cc('0xe')]){oldToken=_0x4750d7[_0xd1cc('0xd')];}httpRequest(_0x4f4205)[_0xd1cc('0xa')](function(_0x4beacc){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4beacc[_0xd1cc('0xf')]){isOldTokenSent=![];if(!_0x4750d7[_0xd1cc('0x10')]&&_0x4750d7[_0xd1cc('0x10')]!=_0x4beacc[_0xd1cc('0x10')]||_0x4750d7[_0xd1cc('0x10')]&&_0x4750d7['data2']){logger[_0xd1cc('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4750d7[_0xd1cc('0x10')]&&!_0x4750d7[_0xd1cc('0xe')]&&_0x4750d7['license']!=_0x4beacc[_0xd1cc('0x10')]){logger[_0xd1cc('0x11')](_0xd1cc('0x12'));}if(_0x4750d7['license']&&!_0x4750d7[_0xd1cc('0xe')]&&_0x4750d7[_0xd1cc('0x10')]==_0x4beacc[_0xd1cc('0x10')]){return _0x366790;}return _0x366790[_0xd1cc('0x13')]({'data1':_0x4f4205,'data2':null,'license':_0x4beacc[_0xd1cc('0x10')]});}else{if(_0x4beacc[_0xd1cc('0x10')]||_0x4750d7[_0xd1cc('0x10')]){if(!_0x4750d7[_0xd1cc('0xe')]){if(_0x4750d7[_0xd1cc('0xd')]==_0x4f4205){GRAY_PERIOD_REASON='Disabled';logger[_0xd1cc('0x11')](_0xd1cc('0x14'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xd1cc('0x11')](_0xd1cc('0x15'),_0x4750d7['data1'],_0x4f4205);}logger[_0xd1cc('0x11')](_0xd1cc('0x16'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0xd1cc('0x17')));return _0x366790[_0xd1cc('0x13')]({'data2':encryptor[_0xd1cc('0x18')](moment()['format'](_0xd1cc('0x17')))});}else{if(moment()[_0xd1cc('0x19')](encryptor[_0xd1cc('0x1a')](_0x4750d7[_0xd1cc('0xe')]),_0xd1cc('0x1b'))>DAYS){logger[_0xd1cc('0x11')](_0xd1cc('0x1c'),moment()['format'](_0xd1cc('0x17')));isOldTokenSent=![];return _0x366790[_0xd1cc('0x13')]({'data1':_0x4f4205,'data2':null,'license':null});}}}else{if(_0x4750d7[_0xd1cc('0xd')]!=_0x4f4205){logger[_0xd1cc('0x11')](_0xd1cc('0x15'),_0x4750d7['data1'],_0x4f4205);return _0x366790['update']({'data1':_0x4f4205,'data2':null,'license':null});}}}return _0x366790;})[_0xd1cc('0xa')](function(_0x5e00f7){_0x366790=_0x5e00f7;})['catch'](function(_0x24d02b){logger['error'](_0x24d02b['message']);})[_0xd1cc('0x1d')](function(){setTimeout(function(){manageLicense(hardware[_0xd1cc('0x1e')](),_0x366790);},TIME);});}function defaultLicense(){var _0x176024=hardware[_0xd1cc('0x1e')]();if(_0x176024){return db[_0xd1cc('0x1f')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x176024}})[_0xd1cc('0x20')](function(_0x5bce25,_0x5bee17){logger[_0xd1cc('0x11')](_0xd1cc('0x21'),_0x176024);manageLicense(_0x176024,_0x5bce25);})[_0xd1cc('0xb')](function(_0x3e579b){logger[_0xd1cc('0x22')](_0x3e579b[_0xd1cc('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index be44266..e170b37 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 _0x5944=['grayReason','changed','disabled','message','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','telephones','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','demo','uuid','machineUuid','gray','deadline','add','days'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5944,0x11f));var _0x4594=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x5944[_0x1d24eb];return _0x1dc576;};'use strict';var util=require(_0x4594('0x0'));var _=require('lodash');var moment=require(_0x4594('0x1'));var BPromise=require('bluebird');var hardware=require(_0x4594('0x2'));var encryptor=require(_0x4594('0x3'));var db=require(_0x4594('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4594('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4594('0x6'),'machineUuid':hardware[_0x4594('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4594('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4594('0x8'),'machineUuid':hardware[_0x4594('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x58f965){return new BPromise(function(_0x3080a4,_0xd366f4){return db[_0x4594('0x9')][_0x4594('0xa')](_[_0x4594('0xb')](_0x58f965,{'raw':!![],'where':{'id':0x1}}))[_0x4594('0xc')](function(_0x50e975){return checkLicense(_0x50e975,null);})[_0x4594('0xc')](function(_0x3d9c46){_0x3080a4(_0x3d9c46);return;})[_0x4594('0xd')](function(_0x2e3ae3){_0xd366f4(_0x2e3ae3);});});}function checkLicense(_0x2e91ab,_0x1c3e5c){if(!_0x2e91ab){demoLicense['uuid']=_0x2e91ab[_0x4594('0xe')];return demoLicense;}try{var _0x5a1b6f=_0x1c3e5c||_0x2e91ab[_0x4594('0xf')];if(_[_0x4594('0x10')](_0x5a1b6f)){throw new Error(_0x4594('0x11'));}var _0xc6ce28=_0x2e91ab[_0x4594('0xe')];var _0x454151=_0x2e91ab['data2'];var _0x4b7b5b=_0xc6ce28[_0x4594('0x12')]('-')[0x4];var _0x3ac866=_0xc6ce28[_0x4594('0x12')]('-')[0x0];var _0x26b71b=encryptor[_0x4594('0x13')](_0x5a1b6f,util[_0x4594('0x14')]('%s:%s:%s',_0x4b7b5b,_0xc6ce28,_0x3ac866));var _0x59d156=JSON['parse'](_0x26b71b);_0x59d156[_0x4594('0x15')]=![];_0x59d156[_0x4594('0x16')]=_0xc6ce28;_0x59d156[_0x4594('0x17')]=hardware[_0x4594('0x7')]();if(_0x454151){var _0x4ff8f3=encryptor[_0x4594('0x13')](_0x454151);_0x59d156[_0x4594('0x18')]=_0x4ff8f3;_0x59d156[_0x4594('0x19')]=moment(_0x4ff8f3)[_0x4594('0x1a')](0x7,_0x4594('0x1b'))['format']();_0x59d156[_0x4594('0x1c')]=_0x59d156[_0x4594('0x16')]!=_0x59d156[_0x4594('0x17')]?_0x4594('0x1d'):_0x4594('0x1e');}return _0x59d156;}catch(_0x5b265c){breakingLicense[_0x4594('0x16')]=_0x2e91ab[_0x4594('0xe')];breakingLicense[_0x4594('0x1f')]=_0x5b265c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x580a3b,_0x3bf485){getLicense()[_0x4594('0xc')](function(_0x9571cd){return db['User'][_0x4594('0x20')]({'attributes':[_0x4594('0x21'),[db[_0x4594('0x22')]['fn'](_0x4594('0x23'),db[_0x4594('0x22')]['col'](_0x4594('0x21'))),_0x4594('0x24')]],'group':_0x4594('0x21'),'where':{'role':{'$or':[_0x4594('0x25'),_0x4594('0x26'),_0x4594('0x27')]}},'raw':!![]})[_0x4594('0xc')](function(_0x4da26c){var _0x2e5ae0={'user':_0x9571cd[_0x4594('0x28')]||0x0,'telephone':_0x9571cd[_0x4594('0x29')]||0x0};_0x4da26c['forEach'](function(_0x2dc59f){var _0x47d8f2=_0x2dc59f['role']===_0x4594('0x25')?_0x4594('0x26'):_0x2dc59f['role'];_0x2e5ae0[_0x47d8f2]-=_0x2dc59f[_0x4594('0x24')];if(_0x2e5ae0[_0x47d8f2]<0x0)_0x2e5ae0[_0x47d8f2]=0x0;});_0x580a3b(_0x2e5ae0);return;});})[_0x4594('0xd')](function(_0x196499){_0x3bf485(_0x196499);});});}function checkUserLimits(_0x4f319e){return new BPromise(function(_0x433a4c,_0x5dafca){getLimits()[_0x4594('0xc')](function(_0x4d85e3){var _0xdb19c5=_['pick'](_[_0x4594('0x2a')](_0x4f319e,_0x4594('0x21')),[_0x4594('0x25'),_0x4594('0x26'),_0x4594('0x27')]);var _0x4d7fce=(_0xdb19c5['admin']||0x0)+(_0xdb19c5[_0x4594('0x26')]||0x0);var _0x39aa3e=_0xdb19c5['telephone']||0x0;if(_0x4d7fce>_0x4d85e3[_0x4594('0x26')])return _0x5dafca(_0x4594('0x2b'));if(_0x39aa3e>_0x4d85e3[_0x4594('0x27')])return _0x5dafca('License\x20limit\x20reached\x20for\x20telephones');return _0x433a4c();})[_0x4594('0xd')](function(_0x21f201){_0x5dafca(_0x21f201);});});}module[_0x4594('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0205=['sequelize','role','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','disabled','User','findAll','COUNT'];(function(_0x31ce59,_0xd66fa6){var _0x13e0f9=function(_0x3ab7e4){while(--_0x3ab7e4){_0x31ce59['push'](_0x31ce59['shift']());}};_0x13e0f9(++_0xd66fa6);}(_0x0205,0x1a3));var _0x5020=function(_0x5df7bb,_0x175b3f){_0x5df7bb=_0x5df7bb-0x0;var _0x6c9994=_0x0205[_0x5df7bb];return _0x6c9994;};'use strict';var util=require('util');var _=require(_0x5020('0x0'));var moment=require(_0x5020('0x1'));var BPromise=require(_0x5020('0x2'));var hardware=require('./hardware');var encryptor=require(_0x5020('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5020('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5020('0x5'),'machineUuid':hardware[_0x5020('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5020('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x22a40c){return new BPromise(function(_0x20ac88,_0xc14baf){return db['License'][_0x5020('0x7')](_[_0x5020('0x8')](_0x22a40c,{'raw':!![],'where':{'id':0x1}}))[_0x5020('0x9')](function(_0x546443){return checkLicense(_0x546443,null);})['then'](function(_0x61835c){_0x20ac88(_0x61835c);return;})[_0x5020('0xa')](function(_0x5cb441){_0xc14baf(_0x5cb441);});});}function checkLicense(_0x549ed9,_0x2de143){if(!_0x549ed9){demoLicense[_0x5020('0xb')]=_0x549ed9[_0x5020('0xc')];return demoLicense;}try{var _0x198f78=_0x2de143||_0x549ed9['license'];if(_[_0x5020('0xd')](_0x198f78)){throw new Error(_0x5020('0xe'));}var _0x57909d=_0x549ed9[_0x5020('0xc')];var _0x1ea526=_0x549ed9[_0x5020('0xf')];var _0x33551f=_0x57909d[_0x5020('0x10')]('-')[0x4];var _0x2324a1=_0x57909d['split']('-')[0x0];var _0x59f44b=encryptor[_0x5020('0x11')](_0x198f78,util[_0x5020('0x12')](_0x5020('0x13'),_0x33551f,_0x57909d,_0x2324a1));var _0x310905=JSON[_0x5020('0x14')](_0x59f44b);_0x310905[_0x5020('0x15')]=![];_0x310905[_0x5020('0xb')]=_0x57909d;_0x310905[_0x5020('0x16')]=hardware['getUuid']();if(_0x1ea526){var _0x22408b=encryptor[_0x5020('0x11')](_0x1ea526);_0x310905[_0x5020('0x17')]=_0x22408b;_0x310905[_0x5020('0x18')]=moment(_0x22408b)[_0x5020('0x19')](0x7,_0x5020('0x1a'))[_0x5020('0x12')]();_0x310905['grayReason']=_0x310905['uuid']!=_0x310905[_0x5020('0x16')]?'changed':_0x5020('0x1b');}return _0x310905;}catch(_0xa2bd88){breakingLicense['uuid']=_0x549ed9[_0x5020('0xc')];breakingLicense['message']=_0xa2bd88['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3b7433,_0x50ecd7){getLicense()['then'](function(_0x263a76){return db[_0x5020('0x1c')][_0x5020('0x1d')]({'attributes':['role',[db['sequelize']['fn'](_0x5020('0x1e'),db[_0x5020('0x1f')]['col'](_0x5020('0x20'))),_0x5020('0x21')]],'group':_0x5020('0x20'),'where':{'role':{'$or':[_0x5020('0x22'),_0x5020('0x23'),_0x5020('0x24')]}},'raw':!![]})[_0x5020('0x9')](function(_0x3e3949){var _0x59aa96={'user':_0x263a76[_0x5020('0x25')]||0x0,'telephone':_0x263a76[_0x5020('0x26')]||0x0};_0x3e3949[_0x5020('0x27')](function(_0x298979){var _0x592b2d=_0x298979['role']===_0x5020('0x22')?_0x5020('0x23'):_0x298979[_0x5020('0x20')];_0x59aa96[_0x592b2d]-=_0x298979['count'];if(_0x59aa96[_0x592b2d]<0x0)_0x59aa96[_0x592b2d]=0x0;});_0x3b7433(_0x59aa96);return;});})[_0x5020('0xa')](function(_0x395d43){_0x50ecd7(_0x395d43);});});}function checkUserLimits(_0x3a616c){return new BPromise(function(_0x58c9d2,_0x1b0768){getLimits()[_0x5020('0x9')](function(_0x2caab7){var _0x44e99b=_[_0x5020('0x28')](_[_0x5020('0x29')](_0x3a616c,_0x5020('0x20')),[_0x5020('0x22'),_0x5020('0x23'),_0x5020('0x24')]);var _0x2f4cce=(_0x44e99b['admin']||0x0)+(_0x44e99b[_0x5020('0x23')]||0x0);var _0x19a689=_0x44e99b[_0x5020('0x24')]||0x0;if(_0x2f4cce>_0x2caab7['user'])return _0x1b0768(_0x5020('0x2a'));if(_0x19a689>_0x2caab7['telephone'])return _0x1b0768(_0x5020('0x2b'));return _0x58c9d2();})[_0x5020('0xa')](function(_0x33f0b4){_0x1b0768(_0x33f0b4);});});}module[_0x5020('0x2c')]={'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 68eeca3..6bf9f06 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 _0x0598=['http://localhost:9000','app-id','exports'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0x0598,0x92));var _0x8059=function(_0x446612,_0x5812c2){_0x446612=_0x446612-0x0;var _0x5c9eb8=_0x0598[_0x446612];return _0x5c9eb8;};'use strict';module[_0x8059('0x0')]={'DOMAIN':_0x8059('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x8059('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x5204=['http://localhost:9000','app-id','secret','exports'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0x5204,0xdf));var _0x4520=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x5204[_0x2ab76b];return _0x201126;};'use strict';module[_0x4520('0x0')]={'DOMAIN':_0x4520('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4520('0x2'),'GOOGLE_SECRET':_0x4520('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 9771102..71d759e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e1c=['Logger','transports','error','info','Console','env','winston','util','path','INFO','join','/var','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports'];(function(_0x3be45c,_0x3ccbb0){var _0x17a9dc=function(_0x302d7d){while(--_0x302d7d){_0x3be45c['push'](_0x3be45c['shift']());}};_0x17a9dc(++_0x3ccbb0);}(_0x9e1c,0x12c));var _0xc9e1=function(_0x4a42d0,_0x3d1ea5){_0x4a42d0=_0x4a42d0-0x0;var _0x16fa16=_0x9e1c[_0x4a42d0];return _0x16fa16;};'use strict';var moment=require('moment');var winston=require(_0xc9e1('0x0'));var util=require(_0xc9e1('0x1'));var path=require(_0xc9e1('0x2'));var debugLevel=_0xc9e1('0x3');function filename(_0x13bc25,_0x2134f9){return path[_0xc9e1('0x4')](_0xc9e1('0x5'),'log','xcally',util[_0xc9e1('0x6')]('%s-%s.log',_0x13bc25,_0x2134f9));}function formatter(_0xc3e12a,_0x366e59){_0x366e59['message']=_0x366e59[_0xc9e1('0x7')][_0xc9e1('0x8')](/@@{/g,'{{{')[_0xc9e1('0x8')](/}@@/g,_0xc9e1('0x9'))[_0xc9e1('0x8')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xc9e1('0x6')](_0xc9e1('0xa'),moment()['format'](_0xc9e1('0xb')),_0x366e59[_0xc9e1('0xc')][_0xc9e1('0xd')](),_0xc3e12a,_0x366e59[_0xc9e1('0x7')]);}module[_0xc9e1('0xe')]=function(_0x397207){return new winston[(_0xc9e1('0xf'))]({'transports':[new winston[(_0xc9e1('0x10'))]['File']({'name':util[_0xc9e1('0x6')]('%s-%s',_0x397207,_0xc9e1('0x11')),'filename':filename(_0x397207,_0xc9e1('0x11')),'level':_0xc9e1('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x173676){return formatter(_0x397207,_0x173676);}}),new winston[(_0xc9e1('0x10'))]['File']({'name':util['format']('%s-%s',_0x397207,_0xc9e1('0x12')),'filename':filename(_0x397207,_0xc9e1('0x12')),'level':_0xc9e1('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x24aefc){return formatter(_0x397207,_0x24aefc);}}),new winston[(_0xc9e1('0x10'))][(_0xc9e1('0x13'))]({'level':process[_0xc9e1('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x2b9b67){return formatter(_0x397207,_0x2b9b67);}})]});}; \ No newline at end of file +var _0xdbe5=['log','xcally','%s-%s.log','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','%s-%s','error','File','info','Console','env','debugLevel','moment','winston','util','path','INFO','join','/var'];(function(_0x231933,_0x4a2ec6){var _0x268c09=function(_0x3c34b4){while(--_0x3c34b4){_0x231933['push'](_0x231933['shift']());}};_0x268c09(++_0x4a2ec6);}(_0xdbe5,0x138));var _0x5dbe=function(_0xe82570,_0x496912){_0xe82570=_0xe82570-0x0;var _0x24d82d=_0xdbe5[_0xe82570];return _0x24d82d;};'use strict';var moment=require(_0x5dbe('0x0'));var winston=require(_0x5dbe('0x1'));var util=require(_0x5dbe('0x2'));var path=require(_0x5dbe('0x3'));var debugLevel=_0x5dbe('0x4');function filename(_0x2e9325,_0x4b8a46){return path[_0x5dbe('0x5')](_0x5dbe('0x6'),_0x5dbe('0x7'),_0x5dbe('0x8'),util['format'](_0x5dbe('0x9'),_0x2e9325,_0x4b8a46));}function formatter(_0x2878cc,_0x2332c9){_0x2332c9[_0x5dbe('0xa')]=_0x2332c9['message']['replace'](/@@{/g,_0x5dbe('0xb'))[_0x5dbe('0xc')](/}@@/g,_0x5dbe('0xd'))[_0x5dbe('0xc')](/@{/g,'{{')[_0x5dbe('0xc')](/}@/g,'}}');return util[_0x5dbe('0xe')](_0x5dbe('0xf'),moment()['format'](_0x5dbe('0x10')),_0x2332c9[_0x5dbe('0x11')][_0x5dbe('0x12')](),_0x2878cc,_0x2332c9[_0x5dbe('0xa')]);}module[_0x5dbe('0x13')]=function(_0x209d80){return new winston[(_0x5dbe('0x14'))]({'transports':[new winston[(_0x5dbe('0x15'))]['File']({'name':util[_0x5dbe('0xe')](_0x5dbe('0x16'),_0x209d80,_0x5dbe('0x17')),'filename':filename(_0x209d80,_0x5dbe('0x17')),'level':_0x5dbe('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x361d68){return formatter(_0x209d80,_0x361d68);}}),new winston[(_0x5dbe('0x15'))][(_0x5dbe('0x18'))]({'name':util[_0x5dbe('0xe')](_0x5dbe('0x16'),_0x209d80,_0x5dbe('0x19')),'filename':filename(_0x209d80,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x40c1b2){return formatter(_0x209d80,_0x40c1b2);}}),new winston[(_0x5dbe('0x15'))][(_0x5dbe('0x1a'))]({'level':process[_0x5dbe('0x1b')][_0x5dbe('0x1c')]||debugLevel,'json':![],'formatter':function(_0x2dcb7f){return formatter(_0x209d80,_0x2dcb7f);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 53a3d32..6a5a791 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 _0xca86=['agi','../../services/email/index.js','../../services/routing/index.js','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca86,0x1b5));var _0x6ca8=function(_0x466b4a,_0x4aa1aa){_0x466b4a=_0x466b4a-0x0;var _0xda6a8a=_0xca86[_0x466b4a];return _0xda6a8a;};'use strict';var path=require(_0x6ca8('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x6ca8('0x1')](__dirname,_0x6ca8('0x2'))},{'name':_0x6ca8('0x3'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0x6ca8('0x4'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x6ca8('0x1')](__dirname,_0x6ca8('0x5'))},{'name':'routing','script':path[_0x6ca8('0x1')](__dirname,_0x6ca8('0x6'))},{'name':'xdr','script':path[_0x6ca8('0x1')](__dirname,_0x6ca8('0x7'))}]};module[_0x6ca8('0x8')]=config; \ No newline at end of file +var _0x5524=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/email/index.js','routing','../../services/xdr/index.js','exports','path','express','join'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5524,0x76));var _0x4552=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5524[_0x1035c1];return _0x308d67;};'use strict';var path=require(_0x4552('0x0'));var os=require('os');var config={'apps':[{'name':_0x4552('0x1'),'script':path[_0x4552('0x2')](__dirname,_0x4552('0x3'))},{'name':_0x4552('0x4'),'script':path[_0x4552('0x2')](__dirname,_0x4552('0x5'))},{'name':_0x4552('0x6'),'script':path[_0x4552('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x4552('0x2')](__dirname,_0x4552('0x7'))},{'name':_0x4552('0x8'),'script':path[_0x4552('0x2')](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x4552('0x2')](__dirname,_0x4552('0x9'))}]};module[_0x4552('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b99defb..806540a 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 _0x5c33=['delete','dump','saved','pm2','bluebird','./config','connect','connected','then','start','disconnect','stop','list','describe'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x5c33,0x1b5));var _0x35c3=function(_0x434b7e,_0x4147ab){_0x434b7e=_0x434b7e-0x0;var _0x3979ee=_0x5c33[_0x434b7e];return _0x3979ee;};'use strict';var pm2=require(_0x35c3('0x0'));var BPromise=require(_0x35c3('0x1'));var config=require(_0x35c3('0x2'));function connect(){return new BPromise(function(_0x343f21,_0x29269a){return pm2[_0x35c3('0x3')](function(_0x25d6d7){if(_0x25d6d7){return _0x29269a(_0x25d6d7);}return _0x343f21(_0x35c3('0x4'));});});};exports['start']=function(_0x5518f1){return connect()[_0x35c3('0x5')](function(){return new BPromise(function(_0x86dddf,_0x230b65){return pm2[_0x35c3('0x6')](_0x5518f1,function(_0x11af97,_0x22f417){if(_0x11af97){return _0x230b65(_0x11af97);}pm2[_0x35c3('0x7')]();return _0x86dddf(_0x22f417);});});});};exports['stop']=function(_0x59c1e3){return connect()[_0x35c3('0x5')](function(){return new BPromise(function(_0x403bb7,_0x4fcfca){return pm2[_0x35c3('0x8')](_0x59c1e3,function(_0x4faaf3,_0x48b75b){if(_0x4faaf3){return _0x4fcfca(_0x4faaf3);}pm2[_0x35c3('0x7')]();return _0x403bb7(_0x48b75b);});});});};exports['restart']=function(_0x2dddba){return connect()[_0x35c3('0x5')](function(){return new BPromise(function(_0x16ced4,_0x334c18){return pm2['restart'](_0x2dddba,function(_0x5b7554,_0x479267){if(_0x5b7554){return _0x334c18(_0x5b7554);}pm2[_0x35c3('0x7')]();return _0x16ced4(_0x479267);});});});};exports['list']=function(){return connect()[_0x35c3('0x5')](function(){return new BPromise(function(_0x531a67,_0x26becd){return pm2[_0x35c3('0x9')](function(_0x4766aa,_0x170bb0){if(_0x4766aa){return _0x26becd(_0x4766aa);}pm2[_0x35c3('0x7')]();return _0x531a67(_0x170bb0);});});});};exports[_0x35c3('0xa')]=function(_0x7a1c10){return connect()[_0x35c3('0x5')](function(){return new BPromise(function(_0x4e800c,_0x1da122){return pm2['describe'](_0x7a1c10,function(_0x3a1ec2,_0x1d5cbc){if(_0x3a1ec2){return _0x1da122(_0x3a1ec2);}pm2['disconnect']();return _0x4e800c(_0x1d5cbc);});});});};exports['delete']=function(_0x2cd46c){return connect()['then'](function(){return new BPromise(function(_0x4ff4e6,_0x225cfe){return pm2[_0x35c3('0xb')](_0x2cd46c,function(_0x56209f,_0x1c92bd){if(_0x56209f){return _0x225cfe(_0x56209f);}pm2[_0x35c3('0x7')]();return _0x4ff4e6(_0x1c92bd);});});});};exports[_0x35c3('0xc')]=function(){return connect()[_0x35c3('0x5')](function(){return new BPromise(function(_0x45f316,_0x39d56a){return pm2['dump'](function(_0x26955e){if(_0x26955e){return _0x39d56a(_0x26955e);}return _0x45f316(_0x35c3('0xd'));});});});}; \ No newline at end of file +var _0xfa35=['dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete'];(function(_0x2cb984,_0x365f50){var _0x2f73e6=function(_0x315369){while(--_0x315369){_0x2cb984['push'](_0x2cb984['shift']());}};_0x2f73e6(++_0x365f50);}(_0xfa35,0x1a6));var _0x5fa3=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0xfa35[_0x2dc96f];return _0xd012da;};'use strict';var pm2=require(_0x5fa3('0x0'));var BPromise=require(_0x5fa3('0x1'));var config=require(_0x5fa3('0x2'));function connect(){return new BPromise(function(_0x41f363,_0x4821fc){return pm2[_0x5fa3('0x3')](function(_0x3e258d){if(_0x3e258d){return _0x4821fc(_0x3e258d);}return _0x41f363(_0x5fa3('0x4'));});});};exports[_0x5fa3('0x5')]=function(_0xfc859a){return connect()[_0x5fa3('0x6')](function(){return new BPromise(function(_0x335039,_0x4bd48e){return pm2[_0x5fa3('0x5')](_0xfc859a,function(_0x195931,_0x111e3c){if(_0x195931){return _0x4bd48e(_0x195931);}pm2[_0x5fa3('0x7')]();return _0x335039(_0x111e3c);});});});};exports[_0x5fa3('0x8')]=function(_0x5b8826){return connect()['then'](function(){return new BPromise(function(_0x52752d,_0x5e0513){return pm2[_0x5fa3('0x8')](_0x5b8826,function(_0x4b6fff,_0x182d19){if(_0x4b6fff){return _0x5e0513(_0x4b6fff);}pm2['disconnect']();return _0x52752d(_0x182d19);});});});};exports[_0x5fa3('0x9')]=function(_0x5e1efe){return connect()[_0x5fa3('0x6')](function(){return new BPromise(function(_0x380cd4,_0x5c4ba4){return pm2[_0x5fa3('0x9')](_0x5e1efe,function(_0x4ec6a5,_0x4e2d87){if(_0x4ec6a5){return _0x5c4ba4(_0x4ec6a5);}pm2[_0x5fa3('0x7')]();return _0x380cd4(_0x4e2d87);});});});};exports[_0x5fa3('0xa')]=function(){return connect()[_0x5fa3('0x6')](function(){return new BPromise(function(_0x422872,_0x3737c4){return pm2[_0x5fa3('0xa')](function(_0x46ccc8,_0x584a79){if(_0x46ccc8){return _0x3737c4(_0x46ccc8);}pm2[_0x5fa3('0x7')]();return _0x422872(_0x584a79);});});});};exports[_0x5fa3('0xb')]=function(_0x2e75eb){return connect()[_0x5fa3('0x6')](function(){return new BPromise(function(_0x119637,_0x4e07b5){return pm2[_0x5fa3('0xb')](_0x2e75eb,function(_0x3d04c8,_0x51d24b){if(_0x3d04c8){return _0x4e07b5(_0x3d04c8);}pm2[_0x5fa3('0x7')]();return _0x119637(_0x51d24b);});});});};exports[_0x5fa3('0xc')]=function(_0xe12beb){return connect()[_0x5fa3('0x6')](function(){return new BPromise(function(_0x5b6243,_0x4dc032){return pm2[_0x5fa3('0xc')](_0xe12beb,function(_0x4a4fcb,_0x165fe6){if(_0x4a4fcb){return _0x4dc032(_0x4a4fcb);}pm2[_0x5fa3('0x7')]();return _0x5b6243(_0x165fe6);});});});};exports[_0x5fa3('0xd')]=function(){return connect()[_0x5fa3('0x6')](function(){return new BPromise(function(_0x30abc4,_0x162111){return pm2[_0x5fa3('0xd')](function(_0x4ed19b){if(_0x4ed19b){return _0x162111(_0x4ed19b);}return _0x30abc4(_0x5fa3('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4b7a7e3..be2cae5 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 _0x4994=['inspect','lodash','moment','ioredis','util','../../mysqldb','schedule','defaults','socket.io-emitter','redis','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error'];(function(_0x4b1cb1,_0x1aeaf4){var _0x30cd3f=function(_0x4d2ca9){while(--_0x4d2ca9){_0x4b1cb1['push'](_0x4b1cb1['shift']());}};_0x30cd3f(++_0x1aeaf4);}(_0x4994,0x1c1));var _0x4499=function(_0x2fcc5c,_0x8cbf34){_0x2fcc5c=_0x2fcc5c-0x0;var _0x3ca488=_0x4994[_0x2fcc5c];return _0x3ca488;};'use strict';var _=require(_0x4499('0x0'));var moment=require(_0x4499('0x1'));var Redis=require(_0x4499('0x2'));var util=require(_0x4499('0x3'));var config=require('../../config/environment');var db=require(_0x4499('0x4'))['db'];var logger=require('../logger')(_0x4499('0x5'));config['redis']=_[_0x4499('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4499('0x7'))(new Redis(config[_0x4499('0x8')]));function closeInteractions(){var _0x3c7d32=0x0;var _0x49f157=[];return db[_0x4499('0x9')][_0x4499('0xa')]({'raw':!![],'attributes':['id',_0x4499('0xb')],'where':{'id':0x1}})[_0x4499('0xc')](function(_0x587542){_0x3c7d32=_0x587542['chatTimeout'];if(_0x3c7d32){return db[_0x4499('0xd')][_0x4499('0xe')]({'raw':!![],'attributes':['id',_0x4499('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4499('0x10')](_0x587542['chatTimeout'],_0x4499('0x11'))}}});}else{return[];}})[_0x4499('0xc')](function(_0x11af69){if(_0x11af69&&_0x11af69[_0x4499('0x12')]){_0x49f157=_[_0x4499('0x13')](_0x11af69||[],'id');logger[_0x4499('0x14')](_0x4499('0x15'),_0x49f157[_0x4499('0x16')]());return db[_0x4499('0xd')][_0x4499('0x17')]({'closeReason':_0x4499('0x18'),'disposition':_0x4499('0x19'),'closed':!![],'closedAt':moment()['format'](_0x4499('0x1a'))},{'where':{'id':_0x49f157}});}})[_0x4499('0xc')](function(){if(_0x49f157&&_0x49f157['length']){logger[_0x4499('0x14')](_0x4499('0x1b'),_0x49f157[_0x4499('0x16')]());for(var _0x3128fa=0x0;_0x3128fa<_0x49f157[_0x4499('0x12')];_0x3128fa++){io[_0x4499('0x1c')]('chatInteraction:update',{'id':_0x49f157[_0x3128fa],'closed':!![]});}}})[_0x4499('0x1d')](function(_0x12e369){logger[_0x4499('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x12e369?util[_0x4499('0x1f')](_0x12e369,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2ca9=['socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','inspect','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0x2ca9,0x1a8));var _0x92ca=function(_0x3421f7,_0x272690){_0x3421f7=_0x3421f7-0x0;var _0xc206ab=_0x2ca9[_0x3421f7];return _0xc206ab;};'use strict';var _=require(_0x92ca('0x0'));var moment=require(_0x92ca('0x1'));var Redis=require('ioredis');var util=require(_0x92ca('0x2'));var config=require(_0x92ca('0x3'));var db=require(_0x92ca('0x4'))['db'];var logger=require(_0x92ca('0x5'))(_0x92ca('0x6'));config[_0x92ca('0x7')]=_[_0x92ca('0x8')](config[_0x92ca('0x7')],{'host':_0x92ca('0x9'),'port':0x18eb});var io=require(_0x92ca('0xa'))(new Redis(config[_0x92ca('0x7')]));function closeInteractions(){var _0x44924f=0x0;var _0xa44984=[];return db[_0x92ca('0xb')]['find']({'raw':!![],'attributes':['id',_0x92ca('0xc')],'where':{'id':0x1}})[_0x92ca('0xd')](function(_0x462851){_0x44924f=_0x462851['chatTimeout'];if(_0x44924f){return db[_0x92ca('0xe')]['findAll']({'raw':!![],'attributes':['id',_0x92ca('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x92ca('0x10')](_0x462851['chatTimeout'],_0x92ca('0x11'))}}});}else{return[];}})[_0x92ca('0xd')](function(_0x45bad4){if(_0x45bad4&&_0x45bad4[_0x92ca('0x12')]){_0xa44984=_[_0x92ca('0x13')](_0x45bad4||[],'id');logger[_0x92ca('0x14')](_0x92ca('0x15'),_0xa44984[_0x92ca('0x16')]());return db[_0x92ca('0xe')]['update']({'closeReason':_0x92ca('0x17'),'disposition':_0x92ca('0x18'),'closed':!![],'closedAt':moment()[_0x92ca('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xa44984}});}})[_0x92ca('0xd')](function(){if(_0xa44984&&_0xa44984[_0x92ca('0x12')]){logger[_0x92ca('0x14')](_0x92ca('0x1a'),_0xa44984[_0x92ca('0x16')]());for(var _0x12c25a=0x0;_0x12c25a<_0xa44984[_0x92ca('0x12')];_0x12c25a++){io[_0x92ca('0x1b')]('chatInteraction:update',{'id':_0xa44984[_0x12c25a],'closed':!![]});}}})[_0x92ca('0x1c')](function(_0x1ee6ad){logger[_0x92ca('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x1ee6ad?util[_0x92ca('0x1e')](_0x1ee6ad,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index f16814f..49a0936 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 _0x7814=['stop','stop\x20cron','active','isBetween','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','existsSync','status','Sent','text','stringify','message','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','startAt','endAt','add','start','add\x20cron'];(function(_0x4b7962,_0x5e5fda){var _0x192b18=function(_0x1843da){while(--_0x1843da){_0x4b7962['push'](_0x4b7962['shift']());}};_0x192b18(++_0x5e5fda);}(_0x7814,0x187));var _0x4781=function(_0x1275e4,_0x376e39){_0x1275e4=_0x1275e4-0x0;var _0x3bcf8a=_0x7814[_0x1275e4];return _0x3bcf8a;};'use strict';var fs=require('fs');var util=require(_0x4781('0x0'));var path=require(_0x4781('0x1'));var _=require(_0x4781('0x2'));var moment=require(_0x4781('0x3'));var CronJobManager=require(_0x4781('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x4781('0x5'));var logger=require(_0x4781('0x6'))(_0x4781('0x7'));var db=require(_0x4781('0x8'))['db'];var analyticCustomReportController=require(_0x4781('0x9'));var analyticDefaultReportController=require(_0x4781('0xa'));var client=jayson[_0x4781('0xb')][_0x4781('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1819f0,_0xf6d178){return function(){logger[_0x4781('0xd')](_0x4781('0xe'),_0x1819f0[_0x4781('0xf')]);var _0x6c2ba1=!![];var _0x3e3823={'tls':{'rejectUnauthorized':![]}};if(_0x1819f0[_0x4781('0x10')][_0x4781('0x11')][_0x4781('0x12')]){_0x3e3823[_0x4781('0x12')]=_0x1819f0['MailAccount'][_0x4781('0x11')]['service'];}else{_0x3e3823[_0x4781('0x13')]=_0x1819f0[_0x4781('0x10')][_0x4781('0x11')][_0x4781('0x13')];_0x3e3823[_0x4781('0x14')]=_0x1819f0[_0x4781('0x10')]['Smtp'][_0x4781('0x14')];_0x3e3823[_0x4781('0x15')]=_0x1819f0['MailAccount'][_0x4781('0x11')][_0x4781('0x15')];}if(_0x1819f0[_0x4781('0x10')][_0x4781('0x11')][_0x4781('0x16')]){_0x3e3823[_0x4781('0x17')]={'user':_0x1819f0[_0x4781('0x10')][_0x4781('0x11')][_0x4781('0x18')],'pass':_0x1819f0[_0x4781('0x10')]['Smtp']['pass']};}var _0x4598d2={'account':_0x3e3823,'message':{'from':util[_0x4781('0x19')](_0x4781('0x1a'),_0x1819f0[_0x4781('0x10')][_0x4781('0x1b')],_0x1819f0[_0x4781('0x10')][_0x4781('0xf')]||_0x1819f0['MailAccount']['Smtp'][_0x4781('0x18')]),'to':_0x1819f0['email'],'cc':_0x1819f0['cc'],'bcc':_0x1819f0[_0x4781('0x1c')],'subject':util['format'](_0x4781('0x1d'),_0xf6d178[_0x4781('0x1b')],_0x1819f0[_0x4781('0x1e')],_0x1819f0[_0x4781('0x1f')])}};var _0xbcba6=path[_0x4781('0x20')](__dirname,'../../files/reports');var _0x6ed96d=_0xf6d178[_0x4781('0x21')];var _0x2b3f33=util[_0x4781('0x19')](_0x4781('0x22'),path[_0x4781('0x23')](_0xf6d178[_0x4781('0x21')],path[_0x4781('0x24')](_0xf6d178['savename'])),'zip');var _0x549af6=path[_0x4781('0x20')](_0xbcba6,_0x6ed96d);var _0x528054=path[_0x4781('0x20')](_0xbcba6,_0x2b3f33);if(fs[_0x4781('0x25')](_0x549af6)){_0xf6d178[_0x4781('0x26')]=_0x4781('0x27');_0x4598d2['message']['attachments']=[{'filename':_0x6ed96d,'path':_0x549af6}];_0x4598d2['message'][_0x4781('0x28')]=util[_0x4781('0x19')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x4781('0x29')](_0xf6d178,null,0x2));}else if(fs[_0x4781('0x25')](_0x528054)){_0xf6d178[_0x4781('0x26')]=_0x4781('0x27');_0x4598d2[_0x4781('0x2a')][_0x4781('0x2b')]=[{'filename':_0x2b3f33,'path':_0x528054}];}else{_0x4598d2[_0x4781('0x2a')][_0x4781('0x28')]=_0x4781('0x2c');if(!_0x1819f0[_0x4781('0x2d')]){_0x6c2ba1=![];logger[_0x4781('0xd')](_0x4781('0x2e'));}}if(_0x6c2ba1){return client[_0x4781('0x2f')](_0x4781('0x30'),_0x4598d2)[_0x4781('0x31')](function(_0x59cf01){if(_0x59cf01[_0x4781('0x32')]){return logger[_0x4781('0x32')](_0x4781('0x33'),JSON[_0x4781('0x29')](_0x59cf01));}return logger[_0x4781('0xd')](_0x4781('0x34'));})[_0x4781('0x35')](function(_0x3d5092){return logger[_0x4781('0x32')](_0x4781('0x33'),JSON[_0x4781('0x29')](_0x3d5092));});}};}function handleError(){return function(_0x372f10){return logger[_0x4781('0x32')](JSON[_0x4781('0x29')](_0x372f10));};}function handleResult(_0x22116e){return function(_0x3705c8){logger[_0x4781('0xd')](_0x4781('0x36'),JSON['stringify'](_0x3705c8));if(_0x22116e[_0x4781('0x10')]&&_0x22116e[_0x4781('0x10')][_0x4781('0x11')]&&!_['isNil'](_0x22116e['email'])){setTimeout(handleSendEmail(_0x22116e,_0x3705c8),0x3c*0x3e8);}};}function handleJob(_0xdc99b5){return function(){try{if(_['isNil'](_0xdc99b5[_0x4781('0x1e')])){return logger[_0x4781('0xd')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x4781('0x37')](_0xdc99b5[_0x4781('0x1f')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x37da95={'startDate':moment()['subtract'](_0xdc99b5[_0x4781('0x1e')],_0xdc99b5[_0x4781('0x1f')])['format'](_0x4781('0x38')),'endDate':moment()[_0x4781('0x19')](_0x4781('0x38')),'type':_0x4781('0x39'),'output':_0xdc99b5[_0x4781('0x3a')],'name':_0xdc99b5[_0x4781('0x1b')]};if(!_[_0x4781('0x37')](_0xdc99b5[_0x4781('0x3b')])){logger[_0x4781('0xd')](_0x4781('0x3c'),_0xdc99b5[_0x4781('0x3b')]);return analyticDefaultReportController['runReport']({'id':_0xdc99b5[_0x4781('0x3b')]},_0x37da95)[_0x4781('0x31')](handleResult(_0xdc99b5))[_0x4781('0x35')](handleError());}if(!_[_0x4781('0x37')](_0xdc99b5[_0x4781('0x3d')])){logger[_0x4781('0xd')]('exec\x20custom\x20report\x20id:%s',_0xdc99b5[_0x4781('0x3d')]);return analyticCustomReportController[_0x4781('0x3e')]({'id':_0xdc99b5['CustomReportId']},_0x37da95)[_0x4781('0x31')](handleResult(_0xdc99b5))[_0x4781('0x35')](handleError());}}catch(_0x5bf153){logger[_0x4781('0x32')](JSON['stringify'](_0x5bf153));}return logger['info'](_0x4781('0x3f'));};}function getJobs(_0xb21640){var _0x438a54={};if(_0xb21640){_0x438a54['id']=_0xb21640;}return db[_0x4781('0x40')][_0x4781('0x41')]({'where':_0x438a54,'include':[{'model':db[_0x4781('0x10')],'attributes':['id',_0x4781('0x1b'),_0x4781('0xf')],'include':[{'model':db[_0x4781('0x42')],'as':_0x4781('0x11')}]}]})['then'](function(_0x1708ec){var _0x56ac93=_[_0x4781('0x43')](manager[_0x4781('0x44')]);var _0x386571=_[_0x4781('0x45')](_0x1708ec,function(_0x6d1dc1){return _0x6d1dc1['id'][_0x4781('0x46')]();});var _0xe9630b=_[_0x4781('0x47')](_0x1708ec,function(_0x46aba3){return _0x46aba3['id']['toString']();});var _0x5683a8=_0xb21640?_0x386571:_[_0x4781('0x48')](_0x386571,_0x56ac93);var _0x463a30=_[_0x4781('0x49')](_0x386571,_0x56ac93);var _0x15117f=_['difference'](_0x56ac93,_0x386571);var _0x649b27;var _0x1f42a4;for(_0x649b27=0x0;_0x649b27<_0x15117f['length']&&!_0xb21640;_0x649b27+=0x1){_0x1f42a4=_0x15117f[_0x649b27]['toString']();if(manager[_0x4781('0x4a')](_0x1f42a4)){manager['stop'](_0x1f42a4);manager[_0x4781('0x4b')](_0x1f42a4);logger[_0x4781('0xd')](_0x4781('0x4c'),_0x1f42a4);}}logger['info'](_0x4781('0x4d'),JSON[_0x4781('0x29')](_0x5683a8));for(_0x649b27=0x0;_0x649b27<_0x5683a8[_0x4781('0x4e')];_0x649b27+=0x1){_0x1f42a4=_0x5683a8[_0x649b27][_0x4781('0x46')]();logger[_0x4781('0xd')](_0x4781('0x4f'),_0x1f42a4);if(_0xb21640){logger[_0x4781('0xd')](_0x4781('0x50'),_0xb21640);logger['info'](JSON['stringify'](_0xe9630b[_0x1f42a4]));BPromise[_0x4781('0x51')]()[_0x4781('0x31')](handleJob(_0xe9630b[_0x1f42a4]));logger[_0x4781('0xd')](_0x4781('0x52'),_0xe9630b[_0x1f42a4][_0x4781('0x1b')],_0xe9630b[_0x1f42a4][_0x4781('0x53')]);}else if(_0xe9630b[_0x1f42a4][_0x4781('0x53')]&&_0xe9630b[_0x1f42a4]['active']&&moment()['isBetween'](_0xe9630b[_0x1f42a4][_0x4781('0x54')],_0xe9630b[_0x1f42a4][_0x4781('0x55')])){manager[_0x4781('0x56')](_0x1f42a4,_0xe9630b[_0x1f42a4][_0x4781('0x53')],handleJob(_0xe9630b[_0x1f42a4]));manager[_0x4781('0x57')](_0x1f42a4);logger[_0x4781('0xd')](_0x4781('0x58'),_0xe9630b[_0x1f42a4][_0x4781('0x1b')],_0xe9630b[_0x1f42a4][_0x4781('0x53')]);}else if(manager[_0x4781('0x4a')](_0x1f42a4)){manager[_0x4781('0x59')](_0x1f42a4);manager[_0x4781('0x4b')](_0x1f42a4);logger['info'](_0x4781('0x5a'),_0xe9630b[_0x1f42a4][_0x4781('0x1b')],_0xe9630b[_0x1f42a4][_0x4781('0x53')]);}}for(_0x649b27=0x0,_0x1f42a4;_0x649b27<_0x463a30[_0x4781('0x4e')]&&!_0xb21640;_0x649b27+=0x1){_0x1f42a4=_0x463a30[_0x649b27][_0x4781('0x46')]();if(manager[_0x4781('0x4a')](_0x1f42a4)){if(_0xe9630b[_0x1f42a4]['cron']&&_0xe9630b[_0x1f42a4][_0x4781('0x5b')]&&moment()[_0x4781('0x5c')](_0xe9630b[_0x1f42a4][_0x4781('0x54')],_0xe9630b[_0x1f42a4][_0x4781('0x55')])){manager[_0x4781('0x5d')](_0x1f42a4,_0xe9630b[_0x1f42a4][_0x4781('0x53')],handleJob(_0xe9630b[_0x1f42a4]));logger[_0x4781('0xd')](_0x4781('0x5e'),_0xe9630b[_0x1f42a4][_0x4781('0x1b')],_0xe9630b[_0x1f42a4]['cron']);}else{manager[_0x4781('0x59')](_0x1f42a4);manager[_0x4781('0x4b')](_0x1f42a4);logger[_0x4781('0xd')](_0x4781('0x5a'),_0xe9630b[_0x1f42a4]['name'],_0xe9630b[_0x1f42a4]['cron']);}}}})[_0x4781('0x35')](function(_0x367043){logger['error'](JSON[_0x4781('0x29')](_0x367043));});}exports[_0x4781('0x5f')]=function(_0xe7d898){return getJobs(_0xe7d898);};exports[_0x4781('0x57')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0f8a=['DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','MailServerOut','keys','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','my\x20id','resolve','run\x20job','active','startAt','add','start','add\x20cron','stop\x20cron','cron','exists','endAt','update','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','port','secure','auth','\x22%s\x22\x20<%s>','email','user','bcc','format','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','then','error','error\x20mail','email\x20sent','catch','data','subtractNumber\x20null\x20or\x20undefined','isNil','YYYY-MM-DD\x20HH:mm:ss','scheduled','output'];(function(_0xf1ceb4,_0x3443e6){var _0x42ed45=function(_0x9ec7fa){while(--_0x9ec7fa){_0xf1ceb4['push'](_0xf1ceb4['shift']());}};_0x42ed45(++_0x3443e6);}(_0x0f8a,0x72));var _0xa0f8=function(_0x2f4be3,_0x517b55){_0x2f4be3=_0x2f4be3-0x0;var _0x3acfb8=_0x0f8a[_0x2f4be3];return _0x3acfb8;};'use strict';var fs=require('fs');var util=require(_0xa0f8('0x0'));var path=require(_0xa0f8('0x1'));var _=require('lodash');var moment=require(_0xa0f8('0x2'));var CronJobManager=require(_0xa0f8('0x3'));var jayson=require(_0xa0f8('0x4'));var BPromise=require(_0xa0f8('0x5'));var logger=require(_0xa0f8('0x6'))(_0xa0f8('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xa0f8('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xa0f8('0x9')][_0xa0f8('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2ff131,_0x18055b){return function(){logger[_0xa0f8('0xb')](_0xa0f8('0xc'),_0x2ff131['email']);var _0x4c9d86=!![];var _0x34afcf={'tls':{'rejectUnauthorized':![]}};if(_0x2ff131[_0xa0f8('0xd')][_0xa0f8('0xe')][_0xa0f8('0xf')]){_0x34afcf[_0xa0f8('0xf')]=_0x2ff131['MailAccount'][_0xa0f8('0xe')][_0xa0f8('0xf')];}else{_0x34afcf['host']=_0x2ff131['MailAccount'][_0xa0f8('0xe')]['host'];_0x34afcf[_0xa0f8('0x10')]=_0x2ff131[_0xa0f8('0xd')][_0xa0f8('0xe')][_0xa0f8('0x10')];_0x34afcf[_0xa0f8('0x11')]=_0x2ff131[_0xa0f8('0xd')][_0xa0f8('0xe')][_0xa0f8('0x11')];}if(_0x2ff131[_0xa0f8('0xd')]['Smtp']['authentication']){_0x34afcf[_0xa0f8('0x12')]={'user':_0x2ff131['MailAccount']['Smtp']['user'],'pass':_0x2ff131[_0xa0f8('0xd')][_0xa0f8('0xe')]['pass']};}var _0x1539c6={'account':_0x34afcf,'message':{'from':util['format'](_0xa0f8('0x13'),_0x2ff131['MailAccount']['name'],_0x2ff131['MailAccount'][_0xa0f8('0x14')]||_0x2ff131[_0xa0f8('0xd')][_0xa0f8('0xe')][_0xa0f8('0x15')]),'to':_0x2ff131['email'],'cc':_0x2ff131['cc'],'bcc':_0x2ff131[_0xa0f8('0x16')],'subject':util[_0xa0f8('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x18055b[_0xa0f8('0x18')],_0x2ff131[_0xa0f8('0x19')],_0x2ff131[_0xa0f8('0x1a')])}};var _0x5b1f39=path[_0xa0f8('0x1b')](__dirname,_0xa0f8('0x1c'));var _0x207ea0=_0x18055b[_0xa0f8('0x1d')];var _0x1f6c40=util[_0xa0f8('0x17')](_0xa0f8('0x1e'),path[_0xa0f8('0x1f')](_0x18055b[_0xa0f8('0x1d')],path[_0xa0f8('0x20')](_0x18055b[_0xa0f8('0x1d')])),_0xa0f8('0x21'));var _0x47255f=path[_0xa0f8('0x1b')](_0x5b1f39,_0x207ea0);var _0x3fabc7=path['join'](_0x5b1f39,_0x1f6c40);if(fs['existsSync'](_0x47255f)){_0x18055b[_0xa0f8('0x22')]='Sent';_0x1539c6[_0xa0f8('0x23')][_0xa0f8('0x24')]=[{'filename':_0x207ea0,'path':_0x47255f}];_0x1539c6[_0xa0f8('0x23')]['text']=util[_0xa0f8('0x17')](_0xa0f8('0x25'),JSON[_0xa0f8('0x26')](_0x18055b,null,0x2));}else if(fs['existsSync'](_0x3fabc7)){_0x18055b[_0xa0f8('0x22')]=_0xa0f8('0x27');_0x1539c6['message'][_0xa0f8('0x24')]=[{'filename':_0x1f6c40,'path':_0x3fabc7}];}else{_0x1539c6['message']['text']=_0xa0f8('0x28');if(!_0x2ff131[_0xa0f8('0x29')]){_0x4c9d86=![];logger[_0xa0f8('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x4c9d86){return client['request'](_0xa0f8('0x2a'),_0x1539c6)[_0xa0f8('0x2b')](function(_0x455f3e){if(_0x455f3e[_0xa0f8('0x2c')]){return logger[_0xa0f8('0x2c')](_0xa0f8('0x2d'),JSON['stringify'](_0x455f3e));}return logger['info'](_0xa0f8('0x2e'));})[_0xa0f8('0x2f')](function(_0x179bfc){return logger[_0xa0f8('0x2c')](_0xa0f8('0x2d'),JSON[_0xa0f8('0x26')](_0x179bfc));});}};}function handleError(){return function(_0x59b913){return logger['error'](JSON[_0xa0f8('0x26')](_0x59b913));};}function handleResult(_0x4a99a9){return function(_0x367625){logger['info'](_0xa0f8('0x30'),JSON['stringify'](_0x367625));if(_0x4a99a9[_0xa0f8('0xd')]&&_0x4a99a9[_0xa0f8('0xd')][_0xa0f8('0xe')]&&!_['isNil'](_0x4a99a9['email'])){setTimeout(handleSendEmail(_0x4a99a9,_0x367625),0x3c*0x3e8);}};}function handleJob(_0x288490){return function(){try{if(_['isNil'](_0x288490[_0xa0f8('0x19')])){return logger[_0xa0f8('0xb')](_0xa0f8('0x31'));}if(_[_0xa0f8('0x32')](_0x288490[_0xa0f8('0x1a')])){return logger[_0xa0f8('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x412a1c={'startDate':moment()['subtract'](_0x288490[_0xa0f8('0x19')],_0x288490[_0xa0f8('0x1a')])[_0xa0f8('0x17')](_0xa0f8('0x33')),'endDate':moment()[_0xa0f8('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xa0f8('0x34'),'output':_0x288490[_0xa0f8('0x35')],'name':_0x288490['name']};if(!_[_0xa0f8('0x32')](_0x288490[_0xa0f8('0x36')])){logger[_0xa0f8('0xb')](_0xa0f8('0x37'),_0x288490[_0xa0f8('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x288490[_0xa0f8('0x36')]},_0x412a1c)[_0xa0f8('0x2b')](handleResult(_0x288490))[_0xa0f8('0x2f')](handleError());}if(!_[_0xa0f8('0x32')](_0x288490[_0xa0f8('0x38')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x288490[_0xa0f8('0x38')]);return analyticCustomReportController[_0xa0f8('0x39')]({'id':_0x288490[_0xa0f8('0x38')]},_0x412a1c)[_0xa0f8('0x2b')](handleResult(_0x288490))[_0xa0f8('0x2f')](handleError());}}catch(_0x3a730f){logger[_0xa0f8('0x2c')](JSON[_0xa0f8('0x26')](_0x3a730f));}return logger['info'](_0xa0f8('0x3a'));};}function getJobs(_0x2db808){var _0x10db5f={};if(_0x2db808){_0x10db5f['id']=_0x2db808;}return db[_0xa0f8('0x3b')]['findAll']({'where':_0x10db5f,'include':[{'model':db[_0xa0f8('0xd')],'attributes':['id',_0xa0f8('0x18'),_0xa0f8('0x14')],'include':[{'model':db[_0xa0f8('0x3c')],'as':_0xa0f8('0xe')}]}]})['then'](function(_0x16a964){var _0x9c4982=_[_0xa0f8('0x3d')](manager['jobs']);var _0x142135=_[_0xa0f8('0x3e')](_0x16a964,function(_0x19ae75){return _0x19ae75['id'][_0xa0f8('0x3f')]();});var _0x6235f3=_[_0xa0f8('0x40')](_0x16a964,function(_0x3cb422){return _0x3cb422['id'][_0xa0f8('0x3f')]();});var _0x41a15e=_0x2db808?_0x142135:_[_0xa0f8('0x41')](_0x142135,_0x9c4982);var _0x187d0e=_[_0xa0f8('0x42')](_0x142135,_0x9c4982);var _0x2b104c=_['difference'](_0x9c4982,_0x142135);var _0x197cad;var _0x2879c0;for(_0x197cad=0x0;_0x197cad<_0x2b104c[_0xa0f8('0x43')]&&!_0x2db808;_0x197cad+=0x1){_0x2879c0=_0x2b104c[_0x197cad][_0xa0f8('0x3f')]();if(manager['exists'](_0x2879c0)){manager[_0xa0f8('0x44')](_0x2879c0);manager[_0xa0f8('0x45')](_0x2879c0);logger[_0xa0f8('0xb')](_0xa0f8('0x46'),_0x2879c0);}}logger[_0xa0f8('0xb')]('toRun',JSON[_0xa0f8('0x26')](_0x41a15e));for(_0x197cad=0x0;_0x197cad<_0x41a15e['length'];_0x197cad+=0x1){_0x2879c0=_0x41a15e[_0x197cad]['toString']();logger[_0xa0f8('0xb')]('index',_0x2879c0);if(_0x2db808){logger['info'](_0xa0f8('0x47'),_0x2db808);logger[_0xa0f8('0xb')](JSON['stringify'](_0x6235f3[_0x2879c0]));BPromise[_0xa0f8('0x48')]()[_0xa0f8('0x2b')](handleJob(_0x6235f3[_0x2879c0]));logger[_0xa0f8('0xb')](_0xa0f8('0x49'),_0x6235f3[_0x2879c0][_0xa0f8('0x18')],_0x6235f3[_0x2879c0]['cron']);}else if(_0x6235f3[_0x2879c0]['cron']&&_0x6235f3[_0x2879c0][_0xa0f8('0x4a')]&&moment()['isBetween'](_0x6235f3[_0x2879c0][_0xa0f8('0x4b')],_0x6235f3[_0x2879c0]['endAt'])){manager[_0xa0f8('0x4c')](_0x2879c0,_0x6235f3[_0x2879c0]['cron'],handleJob(_0x6235f3[_0x2879c0]));manager[_0xa0f8('0x4d')](_0x2879c0);logger[_0xa0f8('0xb')](_0xa0f8('0x4e'),_0x6235f3[_0x2879c0][_0xa0f8('0x18')],_0x6235f3[_0x2879c0]['cron']);}else if(manager['exists'](_0x2879c0)){manager[_0xa0f8('0x44')](_0x2879c0);manager[_0xa0f8('0x45')](_0x2879c0);logger[_0xa0f8('0xb')](_0xa0f8('0x4f'),_0x6235f3[_0x2879c0][_0xa0f8('0x18')],_0x6235f3[_0x2879c0][_0xa0f8('0x50')]);}}for(_0x197cad=0x0,_0x2879c0;_0x197cad<_0x187d0e[_0xa0f8('0x43')]&&!_0x2db808;_0x197cad+=0x1){_0x2879c0=_0x187d0e[_0x197cad][_0xa0f8('0x3f')]();if(manager[_0xa0f8('0x51')](_0x2879c0)){if(_0x6235f3[_0x2879c0][_0xa0f8('0x50')]&&_0x6235f3[_0x2879c0]['active']&&moment()['isBetween'](_0x6235f3[_0x2879c0]['startAt'],_0x6235f3[_0x2879c0][_0xa0f8('0x52')])){manager[_0xa0f8('0x53')](_0x2879c0,_0x6235f3[_0x2879c0]['cron'],handleJob(_0x6235f3[_0x2879c0]));logger['info']('update\x20cron',_0x6235f3[_0x2879c0]['name'],_0x6235f3[_0x2879c0]['cron']);}else{manager[_0xa0f8('0x44')](_0x2879c0);manager[_0xa0f8('0x45')](_0x2879c0);logger['info'](_0xa0f8('0x4f'),_0x6235f3[_0x2879c0][_0xa0f8('0x18')],_0x6235f3[_0x2879c0][_0xa0f8('0x50')]);}}}})[_0xa0f8('0x2f')](function(_0x5612bf){logger[_0xa0f8('0x2c')](JSON[_0xa0f8('0x26')](_0x5612bf));});}exports['run']=function(_0x269c28){return getJobs(_0x269c28);};exports[_0xa0f8('0x4d')]=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 0386a8f..24ae27f 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 _0x49f8=['sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','data1','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Negative','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribe','transcribeRegion','Cloud\x20Provider\x20not\x20available','forEach','push','all','catch','start','lodash','util','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment'];(function(_0x47c902,_0x220fd2){var _0x1ad6a0=function(_0xf9fdb0){while(--_0xf9fdb0){_0x47c902['push'](_0x47c902['shift']());}};_0x1ad6a0(++_0x220fd2);}(_0x49f8,0xff));var _0x849f=function(_0x185334,_0x4630ac){_0x185334=_0x185334-0x0;var _0xf2e59a=_0x49f8[_0x185334];return _0xf2e59a;};var _=require(_0x849f('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x849f('0x1'));var BPromise=require(_0x849f('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x849f('0x3'))('transcribe');function getTranscriptionJob(_0xdf19d3,_0x59d2a8,_0x4786cc,_0x590f53){return new Promise(function(_0x1e8405,_0x30ebab){var _0x21f577=new AWS[(_0x849f('0x4'))]({'accessKeyId':_0x59d2a8,'secretAccessKey':_0xdf19d3,'region':_0x4786cc});_0x21f577[_0x849f('0x5')]({'TranscriptionJobName':_0x590f53},function(_0xc6443e,_0x565438){if(_0xc6443e){return _0x30ebab(_0xc6443e);}else{return _0x1e8405(_0x565438);}});});}function sentiment(_0x47f0a5,_0x5c013d,_0x306c11,_0x1a902c,_0x3b094c){return new Promise(function(_0x51cf64,_0x1de72f){var _0x28de6e=new AWS[(_0x849f('0x6'))]({'accessKeyId':_0x5c013d,'secretAccessKey':_0x47f0a5,'region':_0x306c11});_0x28de6e['detectSentiment']({'Text':_0x1a902c,'LanguageCode':_0x3b094c[_0x849f('0x7')](0x0,0x2)},function(_0x5b4593,_0xd5525f){if(_0x5b4593){return _0x1de72f(_0x5b4593);}else{return _0x51cf64(_0xd5525f);}});});}function checkTranscribeJob(_0x25b276,_0x401480,_0x23c0ef){var _0x58dede;return new BPromise(function(_0x4f13f9,_0x41f999){logger[_0x849f('0x8')](util[_0x849f('0x9')](_0x849f('0xa'),_0x25b276['id'],_0x25b276['transcribeName']));return getTranscriptionJob(_0x23c0ef['data1'],_0x23c0ef[_0x849f('0xb')],_0x401480['transcribeRegion'],_0x25b276[_0x849f('0xc')])[_0x849f('0xd')](function(_0x45b940){logger[_0x849f('0x8')](util[_0x849f('0x9')](_0x849f('0xe'),_0x25b276['id'],_0x25b276[_0x849f('0xc')],_0x45b940['TranscriptionJob'][_0x849f('0xf')]));if(!_0x25b276[_0x849f('0x10')]){switch(_0x45b940[_0x849f('0x11')]['TranscriptionJobStatus']){case _0x849f('0x12'):var _0x364c9b={'transcribeStatus':_0x45b940['TranscriptionJob'][_0x849f('0xf')],'fileUri':_0x45b940[_0x849f('0x11')]['Transcript']['TranscriptFileUri']};logger[_0x849f('0x8')](util[_0x849f('0x9')](_0x849f('0x13'),_0x25b276['id']));return rp({'uri':_0x45b940[_0x849f('0x11')][_0x849f('0x14')][_0x849f('0x15')],'json':!![]})[_0x849f('0xd')](function(_0x2af70d){logger['info'](util[_0x849f('0x9')](_0x849f('0x16'),_0x25b276['id']));if(_0x2af70d&&_0x2af70d[_0x849f('0x17')]&&_0x2af70d[_0x849f('0x17')][_0x849f('0x18')]&&_0x2af70d['results'][_0x849f('0x18')][_0x849f('0x19')]){_0x364c9b[_0x849f('0x10')]='';for(var _0xe404c6=0x0;_0xe404c6<_0x2af70d[_0x849f('0x17')][_0x849f('0x18')][_0x849f('0x19')];_0xe404c6++){_0x364c9b[_0x849f('0x10')]+=_0x2af70d[_0x849f('0x17')][_0x849f('0x18')][_0xe404c6][_0x849f('0x1a')]+'';}}return _0x25b276[_0x849f('0x1b')](_0x364c9b);})[_0x849f('0xd')](function(){logger['info'](util[_0x849f('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x25b276['id']));if(!_0x25b276[_0x849f('0x1c')]){throw new db[(_0x849f('0x1d'))][(_0x849f('0x1e'))](_0x849f('0x1f'));}if(!_0x401480[_0x849f('0x20')]||!_0x401480[_0x849f('0x21')]||!_0x401480['sentimentRegion']||!_0x401480[_0x849f('0x22')]||!_0x401480[_0x849f('0x23')]){throw new db[(_0x849f('0x1d'))]['ValidationError'](_0x849f('0x24'));}if(!_0x364c9b['fileText']){throw new Error(_0x849f('0x25'));}if(_0x401480[_0x849f('0x21')]===_0x23c0ef['id']){return _0x23c0ef;}else{return db[_0x849f('0x26')][_0x849f('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x849f('0xd')](function(_0x47eb70){if(!_0x47eb70){throw new db[(_0x849f('0x1d'))][(_0x849f('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x47eb70['data1']||!_0x47eb70['data2']){throw new db[(_0x849f('0x1d'))][(_0x849f('0x1e'))](_0x849f('0x28'));}_0x58dede=_0x47eb70;logger[_0x849f('0x8')](util[_0x849f('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x25b276['id']));return sentiment(_0x58dede[_0x849f('0x29')],_0x58dede[_0x849f('0xb')],_0x401480[_0x849f('0x2a')],_0x364c9b[_0x849f('0x10')],_0x401480[_0x849f('0x22')]);})[_0x849f('0xd')](function(_0x357f90){logger[_0x849f('0x8')](util[_0x849f('0x9')](_0x849f('0x2b'),_0x25b276['id']));return _0x25b276['update']({'sentiment':_0x357f90['Sentiment'],'sPositive':_0x357f90[_0x849f('0x2c')][_0x849f('0x2d')],'sNegative':_0x357f90[_0x849f('0x2c')]['Negative'],'sMixed':_0x357f90[_0x849f('0x2c')][_0x849f('0x2e')],'sNeutral':_0x357f90[_0x849f('0x2c')][_0x849f('0x2f')]});})['then'](function(){logger[_0x849f('0x8')](util[_0x849f('0x9')](_0x849f('0x30'),_0x25b276['id']));_0x4f13f9();});case _0x849f('0x31'):return _0x25b276[_0x849f('0x1b')]({'transcribeStatus':_0x849f('0x31'),'failureReason':_0x45b940[_0x849f('0x11')]['FailureReason']})[_0x849f('0xd')](function(){logger[_0x849f('0x8')](util[_0x849f('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x25b276['id']));_0x4f13f9();});default:logger['info'](util[_0x849f('0x9')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x25b276['id']));break;}}else{return BPromise[_0x849f('0x32')]()['then'](function(){if(!_0x25b276[_0x849f('0x1c')]){throw new db[(_0x849f('0x1d'))]['ValidationError'](_0x849f('0x1f'));}if(!_0x401480[_0x849f('0x20')]||!_0x401480[_0x849f('0x21')]||!_0x401480[_0x849f('0x2a')]||!_0x401480['language']||!_0x401480['bucket']){throw new db[(_0x849f('0x1d'))][(_0x849f('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x25b276[_0x849f('0x10')]){throw new Error(_0x849f('0x25'));}if(_0x401480[_0x849f('0x21')]===_0x23c0ef['id']){return _0x23c0ef;}else{return db['CloudProvider'][_0x849f('0x27')]({'where':{'id':_settings[_0x849f('0x21')]}});}})[_0x849f('0xd')](function(_0x258696){if(!_0x258696){throw new db[(_0x849f('0x1d'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x258696[_0x849f('0x29')]||!_0x258696[_0x849f('0xb')]){throw new db['Sequelize'][(_0x849f('0x1e'))](_0x849f('0x28'));}_0x58dede=_0x258696;logger['info'](util[_0x849f('0x9')](_0x849f('0x33'),_0x25b276['id']));return sentiment(_0x58dede[_0x849f('0x29')],_0x58dede[_0x849f('0xb')],_0x401480[_0x849f('0x2a')],_0x25b276[_0x849f('0x10')],_0x401480[_0x849f('0x22')]);})[_0x849f('0xd')](function(_0x2431ac){logger[_0x849f('0x8')](util[_0x849f('0x9')](_0x849f('0x2b'),_0x25b276['id']));return _0x25b276[_0x849f('0x1b')]({'sentiment':_0x2431ac[_0x849f('0x34')],'sPositive':_0x2431ac['SentimentScore'][_0x849f('0x2d')],'sNegative':_0x2431ac[_0x849f('0x2c')][_0x849f('0x35')],'sMixed':_0x2431ac[_0x849f('0x2c')][_0x849f('0x2e')],'sNeutral':_0x2431ac[_0x849f('0x2c')]['Neutral'],'transcribeStatus':_0x849f('0x12')});})[_0x849f('0xd')](function(){logger[_0x849f('0x8')](util[_0x849f('0x9')](_0x849f('0x30'),_0x25b276['id']));_0x4f13f9();});}})['catch'](function(_0x3913b7){if(_0x3913b7){if(!_0x3913b7['name']||_0x3913b7[_0x849f('0x36')]!==_0x849f('0x37')){logger[_0x849f('0x38')](util[_0x849f('0x9')](_0x849f('0x39'),_0x25b276['id']),util[_0x849f('0x3a')](_0x3913b7,{'showHidden':![],'depth':null}));}}_0x4f13f9();});});}function checkTranscribe(){var _0x4f9f17;var _0x103185;var _0x1d7be3;return db[_0x849f('0x3b')][_0x849f('0x3c')]({'where':{'transcribeStatus':_0x849f('0x3d')}})[_0x849f('0xd')](function(_0x11adfd){if(!_0x11adfd||!_0x11adfd[_0x849f('0x19')]){throw new db[(_0x849f('0x1d'))][(_0x849f('0x1e'))](_0x849f('0x3e'));}_0x4f9f17=_0x11adfd;return db[_0x849f('0x3f')][_0x849f('0x27')]({'where':{'id':0x1}});})[_0x849f('0xd')](function(_0x36e27c){if(!_0x36e27c){throw new db[(_0x849f('0x1d'))][(_0x849f('0x1e'))]('Settings\x20not\x20available');}_0x103185=_0x36e27c;if(!_0x103185[_0x849f('0x40')]||!_0x103185['transcribeAccountId']||!_0x103185[_0x849f('0x41')]||!_0x103185[_0x849f('0x22')]||!_0x103185[_0x849f('0x23')]){throw new db[(_0x849f('0x1d'))]['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0x103185['transcribeAccountId']}});})['then'](function(_0x1f6117){if(!_0x1f6117){throw new db[(_0x849f('0x1d'))][(_0x849f('0x1e'))](_0x849f('0x42'));}if(!_0x1f6117[_0x849f('0x29')]||!_0x1f6117[_0x849f('0xb')]){throw new db[(_0x849f('0x1d'))][(_0x849f('0x1e'))](_0x849f('0x28'));}_0x1d7be3=_0x1f6117;var _0xa7d9e2=[];_0x4f9f17[_0x849f('0x43')](function(_0x27719a){_0xa7d9e2[_0x849f('0x44')](checkTranscribeJob(_0x27719a,_0x103185,_0x1d7be3));});return BPromise[_0x849f('0x45')](_0xa7d9e2);})[_0x849f('0x46')](function(_0x45f26b){if(_0x45f26b){if(!_0x45f26b['name']||_0x45f26b['name']!==_0x849f('0x37')){logger[_0x849f('0x38')](util[_0x849f('0x3a')](_0x45f26b,{'showHidden':![],'depth':null}));}}});}exports[_0x849f('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0664=['transcribeRegion','forEach','all','error','start','aws-sdk','util','bluebird','../../config/logger','transcribe','TranscribeService','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','findOne','Cloud\x20Provider\x20not\x20available','Positive','Neutral','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId'];(function(_0x42cfc4,_0x3ea038){var _0x586a7a=function(_0x1f7583){while(--_0x1f7583){_0x42cfc4['push'](_0x42cfc4['shift']());}};_0x586a7a(++_0x3ea038);}(_0x0664,0x93));var _0x4066=function(_0x3646a6,_0x10205d){_0x3646a6=_0x3646a6-0x0;var _0x1bcebb=_0x0664[_0x3646a6];return _0x1bcebb;};var _=require('lodash');var AWS=require(_0x4066('0x0'));var rp=require('request-promise');var util=require(_0x4066('0x1'));var BPromise=require(_0x4066('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x4066('0x3'))(_0x4066('0x4'));function getTranscriptionJob(_0x1479a6,_0x43d301,_0x362a79,_0x325e0e){return new Promise(function(_0x2febd3,_0x1e2bf0){var _0x143de5=new AWS[(_0x4066('0x5'))]({'accessKeyId':_0x43d301,'secretAccessKey':_0x1479a6,'region':_0x362a79});_0x143de5['getTranscriptionJob']({'TranscriptionJobName':_0x325e0e},function(_0x383df4,_0x5d360d){if(_0x383df4){return _0x1e2bf0(_0x383df4);}else{return _0x2febd3(_0x5d360d);}});});}function sentiment(_0x29a147,_0x2db4e6,_0x48333f,_0x5f3d44,_0x1da4d8){return new Promise(function(_0x3ea971,_0x16a1f7){var _0x41ad8b=new AWS['Comprehend']({'accessKeyId':_0x2db4e6,'secretAccessKey':_0x29a147,'region':_0x48333f});_0x41ad8b['detectSentiment']({'Text':_0x5f3d44,'LanguageCode':_0x1da4d8['substring'](0x0,0x2)},function(_0x4cbeb6,_0x2bac58){if(_0x4cbeb6){return _0x16a1f7(_0x4cbeb6);}else{return _0x3ea971(_0x2bac58);}});});}function checkTranscribeJob(_0x1b1712,_0x10c353,_0x12d36c){var _0x425456;return new BPromise(function(_0x3a0cf2,_0x38c65d){logger[_0x4066('0x6')](util['format'](_0x4066('0x7'),_0x1b1712['id'],_0x1b1712[_0x4066('0x8')]));return getTranscriptionJob(_0x12d36c['data1'],_0x12d36c[_0x4066('0x9')],_0x10c353['transcribeRegion'],_0x1b1712[_0x4066('0x8')])['then'](function(_0x50f71d){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0xb'),_0x1b1712['id'],_0x1b1712[_0x4066('0x8')],_0x50f71d[_0x4066('0xc')][_0x4066('0xd')]));if(!_0x1b1712[_0x4066('0xe')]){switch(_0x50f71d[_0x4066('0xc')][_0x4066('0xd')]){case _0x4066('0xf'):var _0x511cfa={'transcribeStatus':_0x50f71d['TranscriptionJob'][_0x4066('0xd')],'fileUri':_0x50f71d[_0x4066('0xc')]['Transcript'][_0x4066('0x10')]};logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x11'),_0x1b1712['id']));return rp({'uri':_0x50f71d[_0x4066('0xc')][_0x4066('0x12')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x541306){logger['info'](util[_0x4066('0xa')](_0x4066('0x13'),_0x1b1712['id']));if(_0x541306&&_0x541306[_0x4066('0x14')]&&_0x541306[_0x4066('0x14')][_0x4066('0x15')]&&_0x541306['results'][_0x4066('0x15')][_0x4066('0x16')]){_0x511cfa[_0x4066('0xe')]='';for(var _0x2598c6=0x0;_0x2598c6<_0x541306[_0x4066('0x14')]['transcripts']['length'];_0x2598c6++){_0x511cfa[_0x4066('0xe')]+=_0x541306[_0x4066('0x14')][_0x4066('0x15')][_0x2598c6][_0x4066('0x17')]+'';}}return _0x1b1712[_0x4066('0x18')](_0x511cfa);})[_0x4066('0x19')](function(){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x1a'),_0x1b1712['id']));if(!_0x1b1712[_0x4066('0x1b')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x1e'));}if(!_0x10c353[_0x4066('0x1f')]||!_0x10c353[_0x4066('0x20')]||!_0x10c353['sentimentRegion']||!_0x10c353[_0x4066('0x21')]||!_0x10c353['bucket']){throw new db['Sequelize']['ValidationError'](_0x4066('0x22'));}if(!_0x511cfa['fileText']){throw new Error(_0x4066('0x23'));}if(_0x10c353[_0x4066('0x20')]===_0x12d36c['id']){return _0x12d36c;}else{return db[_0x4066('0x24')]['findOne']({'where':{'id':_settings[_0x4066('0x20')]}});}})['then'](function(_0x2468f0){if(!_0x2468f0){throw new db[(_0x4066('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2468f0[_0x4066('0x25')]||!_0x2468f0[_0x4066('0x9')]){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x26'));}_0x425456=_0x2468f0;logger[_0x4066('0x6')](util['format'](_0x4066('0x27'),_0x1b1712['id']));return sentiment(_0x425456['data1'],_0x425456[_0x4066('0x9')],_0x10c353[_0x4066('0x28')],_0x511cfa[_0x4066('0xe')],_0x10c353[_0x4066('0x21')]);})[_0x4066('0x19')](function(_0x255fd0){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x29'),_0x1b1712['id']));return _0x1b1712[_0x4066('0x18')]({'sentiment':_0x255fd0[_0x4066('0x2a')],'sPositive':_0x255fd0[_0x4066('0x2b')]['Positive'],'sNegative':_0x255fd0[_0x4066('0x2b')][_0x4066('0x2c')],'sMixed':_0x255fd0['SentimentScore'][_0x4066('0x2d')],'sNeutral':_0x255fd0[_0x4066('0x2b')]['Neutral']});})[_0x4066('0x19')](function(){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x1a'),_0x1b1712['id']));_0x3a0cf2();});case _0x4066('0x2e'):return _0x1b1712[_0x4066('0x18')]({'transcribeStatus':_0x4066('0x2e'),'failureReason':_0x50f71d[_0x4066('0xc')][_0x4066('0x2f')]})['then'](function(){logger[_0x4066('0x6')](util[_0x4066('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1b1712['id']));_0x3a0cf2();});default:logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x30'),_0x1b1712['id']));break;}}else{return BPromise['resolve']()[_0x4066('0x19')](function(){if(!_0x1b1712[_0x4066('0x1b')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x1e'));}if(!_0x10c353[_0x4066('0x1f')]||!_0x10c353[_0x4066('0x20')]||!_0x10c353['sentimentRegion']||!_0x10c353[_0x4066('0x21')]||!_0x10c353[_0x4066('0x31')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x22'));}if(!_0x1b1712['fileText']){throw new Error(_0x4066('0x23'));}if(_0x10c353[_0x4066('0x20')]===_0x12d36c['id']){return _0x12d36c;}else{return db['CloudProvider'][_0x4066('0x32')]({'where':{'id':_settings[_0x4066('0x20')]}});}})[_0x4066('0x19')](function(_0x1c3abb){if(!_0x1c3abb){throw new db[(_0x4066('0x1c'))]['ValidationError'](_0x4066('0x33'));}if(!_0x1c3abb[_0x4066('0x25')]||!_0x1c3abb['data2']){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x26'));}_0x425456=_0x1c3abb;logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x27'),_0x1b1712['id']));return sentiment(_0x425456[_0x4066('0x25')],_0x425456['data2'],_0x10c353[_0x4066('0x28')],_0x1b1712[_0x4066('0xe')],_0x10c353[_0x4066('0x21')]);})[_0x4066('0x19')](function(_0x1c99a8){logger[_0x4066('0x6')](util['format'](_0x4066('0x29'),_0x1b1712['id']));return _0x1b1712['update']({'sentiment':_0x1c99a8[_0x4066('0x2a')],'sPositive':_0x1c99a8['SentimentScore'][_0x4066('0x34')],'sNegative':_0x1c99a8[_0x4066('0x2b')][_0x4066('0x2c')],'sMixed':_0x1c99a8[_0x4066('0x2b')]['Mixed'],'sNeutral':_0x1c99a8[_0x4066('0x2b')][_0x4066('0x35')],'transcribeStatus':'COMPLETED'});})[_0x4066('0x19')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1b1712['id']));_0x3a0cf2();});}})[_0x4066('0x36')](function(_0x3e7c11){if(_0x3e7c11){if(!_0x3e7c11[_0x4066('0x37')]||_0x3e7c11[_0x4066('0x37')]!==_0x4066('0x38')){logger['error'](util[_0x4066('0xa')](_0x4066('0x39'),_0x1b1712['id']),util[_0x4066('0x3a')](_0x3e7c11,{'showHidden':![],'depth':null}));}}_0x3a0cf2();});});}function checkTranscribe(){var _0x2dcad0;var _0x218d51;var _0x523396;return db[_0x4066('0x3b')][_0x4066('0x3c')]({'where':{'transcribeStatus':_0x4066('0x3d')}})[_0x4066('0x19')](function(_0x269ff0){if(!_0x269ff0||!_0x269ff0[_0x4066('0x16')]){throw new db[(_0x4066('0x1c'))]['ValidationError'](_0x4066('0x3e'));}_0x2dcad0=_0x269ff0;return db[_0x4066('0x3f')][_0x4066('0x32')]({'where':{'id':0x1}});})[_0x4066('0x19')](function(_0x3bfea2){if(!_0x3bfea2){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x40'));}_0x218d51=_0x3bfea2;if(!_0x218d51['transcribe']||!_0x218d51[_0x4066('0x41')]||!_0x218d51[_0x4066('0x42')]||!_0x218d51[_0x4066('0x21')]||!_0x218d51[_0x4066('0x31')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x4066('0x24')][_0x4066('0x32')]({'where':{'id':_0x218d51[_0x4066('0x41')]}});})['then'](function(_0xe0f43c){if(!_0xe0f43c){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x33'));}if(!_0xe0f43c['data1']||!_0xe0f43c['data2']){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x26'));}_0x523396=_0xe0f43c;var _0x1db0be=[];_0x2dcad0[_0x4066('0x43')](function(_0x4e677c){_0x1db0be['push'](checkTranscribeJob(_0x4e677c,_0x218d51,_0x523396));});return BPromise[_0x4066('0x44')](_0x1db0be);})[_0x4066('0x36')](function(_0x5886a1){if(_0x5886a1){if(!_0x5886a1['name']||_0x5886a1[_0x4066('0x37')]!=='SequelizeValidationError'){logger[_0x4066('0x45')](util['inspect'](_0x5886a1,{'showHidden':![],'depth':null}));}}});}exports[_0x4066('0x46')]=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 f08a5d7..31f6935 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 _0x472c=['info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','hours','length','map'];(function(_0x14102c,_0x1cb214){var _0x13297b=function(_0x1f4372){while(--_0x1f4372){_0x14102c['push'](_0x14102c['shift']());}};_0x13297b(++_0x1cb214);}(_0x472c,0xd9));var _0xc472=function(_0x3bbefc,_0x383dd4){_0x3bbefc=_0x3bbefc-0x0;var _0xdbf545=_0x472c[_0x3bbefc];return _0xdbf545;};'use strict';var _=require(_0xc472('0x0'));var moment=require(_0xc472('0x1'));var Redis=require('ioredis');var util=require(_0xc472('0x2'));var config=require(_0xc472('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xc472('0x4'))(_0xc472('0x5'));config[_0xc472('0x6')]=_[_0xc472('0x7')](config[_0xc472('0x6')],{'host':_0xc472('0x8'),'port':0x18eb});var io=require(_0xc472('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x582e2a=[];return db[_0xc472('0xa')][_0xc472('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xc472('0xc'))}}})['then'](function(_0x573652){if(_0x573652&&_0x573652[_0xc472('0xd')]){_0x582e2a=_[_0xc472('0xe')](_0x573652||[],'id');logger[_0xc472('0xf')](_0xc472('0x10'),_0x582e2a[_0xc472('0x11')]());return db[_0xc472('0xa')][_0xc472('0x12')]({'closeReason':_0xc472('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xc472('0x14')](_0xc472('0x15'))},{'where':{'id':_0x582e2a}});}})[_0xc472('0x16')](function(){if(_0x582e2a&&_0x582e2a[_0xc472('0xd')]){logger['info'](_0xc472('0x17'),_0x582e2a[_0xc472('0x11')]());for(var _0x452804=0x0;_0x452804<_0x582e2a['length'];_0x452804++){io['emit'](_0xc472('0x18'),{'id':_0x582e2a[_0x452804],'closed':!![]});}}})[_0xc472('0x19')](function(_0x199a65){logger[_0xc472('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x199a65?util[_0xc472('0x1b')](_0x199a65,{'showHidden':![],'depth':null}):'');});}exports[_0xc472('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x86a1=['../logger','schedule','defaults','redis','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info','join','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0x86a1,0x18d));var _0x186a=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x86a1[_0xbc4560];return _0x298cfb;};'use strict';var _=require(_0x186a('0x0'));var moment=require(_0x186a('0x1'));var Redis=require(_0x186a('0x2'));var util=require(_0x186a('0x3'));var config=require(_0x186a('0x4'));var db=require(_0x186a('0x5'))['db'];var logger=require(_0x186a('0x6'))(_0x186a('0x7'));config['redis']=_[_0x186a('0x8')](config[_0x186a('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x186a('0x9')]));function closeInteractions(){var _0x4299ac=[];return db[_0x186a('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x186a('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x186a('0xc')](0x18,_0x186a('0xd'))}}})[_0x186a('0xe')](function(_0x8862b3){if(_0x8862b3&&_0x8862b3[_0x186a('0xf')]){_0x4299ac=_[_0x186a('0x10')](_0x8862b3||[],'id');logger[_0x186a('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4299ac[_0x186a('0x12')]());return db[_0x186a('0xa')][_0x186a('0x13')]({'closeReason':_0x186a('0x14'),'disposition':_0x186a('0x15'),'closed':!![],'closedAt':moment()[_0x186a('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4299ac}});}})[_0x186a('0xe')](function(){if(_0x4299ac&&_0x4299ac['length']){logger['info'](_0x186a('0x17'),_0x4299ac[_0x186a('0x12')]());for(var _0x4c6807=0x0;_0x4c6807<_0x4299ac[_0x186a('0xf')];_0x4c6807++){io[_0x186a('0x18')](_0x186a('0x19'),{'id':_0x4299ac[_0x4c6807],'closed':!![]});}}})[_0x186a('0x1a')](function(_0x159c70){logger[_0x186a('0x1b')](_0x186a('0x1c'),_0x159c70?util[_0x186a('0x1d')](_0x159c70,{'showHidden':![],'depth':null}):'');});}exports[_0x186a('0x1e')]=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 7cb8547..82c4a72 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefc8=['then','bulkCreate','log','finished\x20populating','CmHopper','contacts2','hopper2','util','push','Biondo','@xcally.com','now','Innocenzo','CmContact','destroy'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xefc8,0x1ab));var _0x8efc=function(_0x12457e,_0x3e4bcd){_0x12457e=_0x12457e-0x0;var _0x30d134=_0xefc8[_0x12457e];return _0x30d134;};'use strict';var util=require(_0x8efc('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8efc('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x8efc('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8efc('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8efc('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x8efc('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x8efc('0x5')+i,'lastName':_0x8efc('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8efc('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x8efc('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x8efc('0x4')]()});}db[_0x8efc('0x6')][_0x8efc('0x7')]({'where':{}})[_0x8efc('0x8')](function(){return db[_0x8efc('0x6')][_0x8efc('0x9')](contacts);})['then'](function(){console[_0x8efc('0xa')](_0x8efc('0xb'),'contacts1');return db[_0x8efc('0xc')][_0x8efc('0x7')]({'where':{}});})[_0x8efc('0x8')](function(){return db[_0x8efc('0xc')][_0x8efc('0x9')](hopper);})[_0x8efc('0x8')](function(){console['log'](_0x8efc('0xb'),'hopper1');return db[_0x8efc('0x6')][_0x8efc('0x9')](contacts2);})[_0x8efc('0x8')](function(){console[_0x8efc('0xa')](_0x8efc('0xb'),_0x8efc('0xd'));return db[_0x8efc('0xc')][_0x8efc('0x9')](hopper2);})[_0x8efc('0x8')](function(){console[_0x8efc('0xa')](_0x8efc('0xb'),_0x8efc('0xe'));})['catch'](function(_0x302475){console[_0x8efc('0xa')](_0x302475);}); \ No newline at end of file +var _0x3ee5=['finished\x20populating','contacts1','destroy','log','hopper1','bulkCreate','CmHopper','hopper2','catch','../mysqldb','Biondo','@xcally.com','push','now','Innocenzo','CmContact','then'];(function(_0x3ae223,_0x4b787d){var _0x3935d9=function(_0x2eecf3){while(--_0x2eecf3){_0x3ae223['push'](_0x3ae223['shift']());}};_0x3935d9(++_0x4b787d);}(_0x3ee5,0xc4));var _0x53ee=function(_0x50da99,_0x25c8a1){_0x50da99=_0x50da99-0x0;var _0x8931ff=_0x3ee5[_0x50da99];return _0x8931ff;};'use strict';var util=require('util');var db=require(_0x53ee('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x53ee('0x1')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x53ee('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x53ee('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x53ee('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x53ee('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x53ee('0x5')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x53ee('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x53ee('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x53ee('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x53ee('0x4')]()});}db[_0x53ee('0x6')]['destroy']({'where':{}})['then'](function(){return db[_0x53ee('0x6')]['bulkCreate'](contacts);})[_0x53ee('0x7')](function(){console['log'](_0x53ee('0x8'),_0x53ee('0x9'));return db['CmHopper'][_0x53ee('0xa')]({'where':{}});})[_0x53ee('0x7')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x53ee('0x7')](function(){console[_0x53ee('0xb')](_0x53ee('0x8'),_0x53ee('0xc'));return db[_0x53ee('0x6')][_0x53ee('0xd')](contacts2);})[_0x53ee('0x7')](function(){console['log'](_0x53ee('0x8'),'contacts2');return db[_0x53ee('0xe')][_0x53ee('0xd')](hopper2);})[_0x53ee('0x7')](function(){console[_0x53ee('0xb')](_0x53ee('0x8'),_0x53ee('0xf'));})[_0x53ee('0x10')](function(_0x58cfb5){console[_0x53ee('0xb')](_0x58cfb5);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ce6ee9a..891ed58 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x894f=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','then','add\x20user','log','util','../mysqldb','push','format','%s%s','agent','friend','all'];(function(_0x401c21,_0x2e16d5){var _0x1a320e=function(_0x48065e){while(--_0x48065e){_0x401c21['push'](_0x401c21['shift']());}};_0x1a320e(++_0x2e16d5);}(_0x894f,0x8e));var _0xf894=function(_0x358a1c,_0x503791){_0x358a1c=_0x358a1c-0x0;var _0x2cbd3f=_0x894f[_0x358a1c];return _0x2cbd3f;};'use strict';var util=require(_0xf894('0x0'));var db=require(_0xf894('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf894('0x2')]({'name':util['format']('%s%s','agent',i),'fullname':util[_0xf894('0x3')](_0xf894('0x4'),'agent',i),'email':util[_0xf894('0x3')]('%s%s@xcally.com',_0xf894('0x5'),i),'role':_0xf894('0x5'),'password':'password','internal':0xfa0+i,'type':_0xf894('0x6'),'transport':['udp','ws','wss'],'disallow':[_0xf894('0x7')],'allow':['ulaw'],'defaultuser':util['format']('%s%s','agent',i),'encryption':_0xf894('0x8'),'avpf':_0xf894('0x8'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xf894('0x8'),'dtlsverify':'no','dtlscertfile':_0xf894('0x9'),'dtlsprivatekey':_0xf894('0xa'),'dtlssetup':_0xf894('0xb'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0xf894('0x3')](_0xf894('0x4'),_0xf894('0x5'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0xf894('0xc')](function(){console['log'](_0xf894('0xd'));})['catch'](function(_0x205f94){console[_0xf894('0xe')](_0x205f94);}); \ No newline at end of file +var _0x6e34=['udp','all','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend'];(function(_0x57ca81,_0x554cb3){var _0x5e5ddb=function(_0x15ac19){while(--_0x15ac19){_0x57ca81['push'](_0x57ca81['shift']());}};_0x5e5ddb(++_0x554cb3);}(_0x6e34,0x1e6));var _0x46e3=function(_0x2b097b,_0xce66b7){_0x2b097b=_0x2b097b-0x0;var _0x392138=_0x6e34[_0x2b097b];return _0x392138;};'use strict';var util=require(_0x46e3('0x0'));var db=require(_0x46e3('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x46e3('0x2')](_0x46e3('0x3'),_0x46e3('0x4'),i),'fullname':util[_0x46e3('0x2')](_0x46e3('0x3'),_0x46e3('0x4'),i),'email':util['format'](_0x46e3('0x5'),_0x46e3('0x4'),i),'role':_0x46e3('0x4'),'password':_0x46e3('0x6'),'internal':0xfa0+i,'type':_0x46e3('0x7'),'transport':[_0x46e3('0x8'),'ws','wss'],'disallow':[_0x46e3('0x9')],'allow':['ulaw'],'defaultuser':util['format'](_0x46e3('0x3'),'agent',i),'encryption':_0x46e3('0xa'),'avpf':'yes','force_avp':_0x46e3('0xa'),'icesupport':_0x46e3('0xa'),'dtlsenable':_0x46e3('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x46e3('0xb'),'dtlssetup':_0x46e3('0xc'),'callerid':util[_0x46e3('0x2')](_0x46e3('0xd'),util[_0x46e3('0x2')]('%s%s',_0x46e3('0x4'),i),0xfa0+i)});}db['User'][_0x46e3('0xe')](users)[_0x46e3('0xf')](function(){console[_0x46e3('0x10')](_0x46e3('0x11'));})[_0x46e3('0x12')](function(_0x273546){console[_0x46e3('0x10')](_0x273546);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7d84525..feea314 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1410=['MailQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','ivr','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','FaxQueue','WhatsappQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','User','role','agent','telephone','type','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues'];(function(_0x4032d4,_0x4f09aa){var _0x40f143=function(_0x37ca7d){while(--_0x37ca7d){_0x4032d4['push'](_0x4032d4['shift']());}};_0x40f143(++_0x4f09aa);}(_0x1410,0x130));var _0x0141=function(_0x2b7b24,_0x310723){_0x2b7b24=_0x2b7b24-0x0;var _0x16c3e8=_0x1410[_0x2b7b24];return _0x16c3e8;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var BPromise=require(_0x0141('0x2'));var db=require(_0x0141('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x0141('0x4')],'include':[{'as':'Agents','model':db[_0x0141('0x5')],'attributes':['id','name',_0x0141('0x6')],'raw':!![],'where':{'role':_0x0141('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0141('0x4')],'where':{'role':_0x0141('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0141('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x0141('0x4')],'where':{'role':_0x0141('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0141('0x4'),_0x0141('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x19ff64,_0x470b71,_0x2b4f13){return db[_0x0141('0xa')][_0x0141('0xb')]({'where':{'name':_0x19ff64,'userProfileId':_0x470b71},'raw':!![]})[_0x0141('0xc')](function(_0x3f5e8f){if(_0x3f5e8f){if(_0x3f5e8f[_0x0141('0xd')]){switch(_0x19ff64){case'VoiceQueues':case _0x0141('0xe'):case _0x0141('0xf'):case _0x0141('0x10'):case _0x0141('0x11'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x2b4f13][_0x0141('0x12')](queryQueues);case _0x0141('0x13'):return db[_0x2b4f13]['findAll'](queryTelephones);case _0x0141('0x14'):return db[_0x2b4f13][_0x0141('0x12')](queryTrunks);case _0x0141('0x15'):return db[_0x2b4f13][_0x0141('0x12')](queryCampaigns);}}else{return db[_0x0141('0x16')]['findAll']({'attributes':[_0x0141('0x17')],'where':{'sectionId':_0x3f5e8f['id']},'raw':!![]})['then'](function(_0x2ee001){if(_0x2ee001){var _0x3db66a={'where':{'id':_[_0x0141('0x18')](_0x2ee001,_0x0141('0x17'))},'raw':!![]};switch(_0x2b4f13){case _0x0141('0x5'):_0x3db66a[_0x0141('0x19')]['role']='telephone';break;case _0x0141('0x1a'):_0x3db66a[_0x0141('0x19')]['type']=_0x0141('0x1b');break;}return db[_0x2b4f13][_0x0141('0x12')](_0x3db66a);}else{return[];}});}}else{return[];}})[_0x0141('0xc')](function(_0x3a58b6){return _0x3a58b6;});}function joinOrLeaveQueues(_0x5427b5,_0x36ca7a,_0x5bf2e8,_0x5e9d0a){_0x5427b5[_0x36ca7a](util[_0x0141('0x1c')](_0x0141('0x1d'),_0x5bf2e8,_0x5e9d0a[_0x0141('0x4')]));if(_0x5e9d0a[_0x0141('0x1e')]){for(var _0x316f70=0x0;_0x316f70<_0x5e9d0a[_0x0141('0x1e')]['length'];_0x316f70+=0x1){_0x5427b5[_0x36ca7a](util[_0x0141('0x1c')](_0x0141('0x1f'),_0x5e9d0a[_0x0141('0x1e')][_0x316f70][_0x0141('0x4')]));}}}function joinOrLeave(_0x2b7a02,_0x1a4b0b,_0xccf0c){var _0x20656b;if(_0x2b7a02[_0x0141('0x20')][_0x0141('0x21')]['id']){db[_0x0141('0x5')][_0x0141('0x22')]({'attributes':['id','name',_0x0141('0x6'),_0x0141('0x23')],'where':{'id':_0x2b7a02[_0x0141('0x20')][_0x0141('0x21')]['id']},'include':[{'model':db[_0x0141('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0141('0x25')],'as':_0x0141('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x0141('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0141('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0141('0x29')],'as':_0x0141('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x0141('0x2b')],'as':_0x0141('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x0141('0xc')](function(_0x29f463){if(_0x29f463){_0x20656b=_0x29f463;_0x2b7a02[_0x1a4b0b](util[_0x0141('0x1c')](_0x0141('0x1f'),_0x29f463[_0x0141('0x4')]));var _0x308235=[];switch(_0x29f463[_0x0141('0x6')]){case _0x0141('0x2d'):_0x2b7a02[_0x1a4b0b](_0x0141('0x2e'));_0x2b7a02[_0x1a4b0b]('voice:outbound');if(queryQueues[_0x0141('0x2f')]('include')){delete queryQueues[_0x0141('0x30')];}_0x308235[_0x0141('0x31')](db[_0x0141('0x32')][_0x0141('0x12')](queryQueues));_0x308235[_0x0141('0x31')](db[_0x0141('0x33')]['findAll'](queryQueues));_0x308235[_0x0141('0x31')](db['FaxQueue'][_0x0141('0x12')](queryQueues));_0x308235[_0x0141('0x31')](db[_0x0141('0x34')]['findAll'](queryQueues));_0x308235[_0x0141('0x31')](db[_0x0141('0x35')]['findAll'](queryQueues));_0x308235[_0x0141('0x31')](db[_0x0141('0x36')][_0x0141('0x12')](queryQueues));_0x308235[_0x0141('0x31')](db[_0x0141('0x37')]['findAll'](queryQueues));_0x308235[_0x0141('0x31')](db[_0x0141('0x5')][_0x0141('0x12')](queryTelephones));_0x308235[_0x0141('0x31')](db[_0x0141('0x38')][_0x0141('0x12')](queryTrunks));_0x308235['push'](db['Campaign'][_0x0141('0x12')](queryCampaigns));_0x308235[_0x0141('0x31')](db['User'][_0x0141('0x12')](queryAgents));break;case _0x0141('0x39'):_0x2b7a02[_0x1a4b0b](_0x0141('0x2e'));_0x2b7a02[_0x1a4b0b]('voice:outbound');_0x308235['push'](getAssociatedResources('VoiceQueues',_0x29f463[_0x0141('0x23')],_0x0141('0x32')));_0x308235[_0x0141('0x31')](getAssociatedResources(_0x0141('0xe'),_0x29f463[_0x0141('0x23')],_0x0141('0x33')));_0x308235[_0x0141('0x31')](getAssociatedResources('FaxQueues',_0x29f463[_0x0141('0x23')],_0x0141('0x3a')));_0x308235['push'](getAssociatedResources(_0x0141('0x10'),_0x29f463[_0x0141('0x23')],_0x0141('0x34')));_0x308235[_0x0141('0x31')](getAssociatedResources(_0x0141('0x11'),_0x29f463[_0x0141('0x23')],_0x0141('0x35')));_0x308235[_0x0141('0x31')](getAssociatedResources('OpenchannelQueues',_0x29f463[_0x0141('0x23')],_0x0141('0x36')));_0x308235['push'](getAssociatedResources(_0x0141('0x3b'),_0x29f463[_0x0141('0x23')],_0x0141('0x37')));_0x308235[_0x0141('0x31')](getAssociatedResources(_0x0141('0x13'),_0x29f463['userProfileId'],_0x0141('0x5')));_0x308235['push'](getAssociatedResources(_0x0141('0x14'),_0x29f463['userProfileId'],'Trunk'));_0x308235['push'](getAssociatedResources(_0x0141('0x15'),_0x29f463[_0x0141('0x23')],_0x0141('0x1a')));_0x308235['push'](db[_0x0141('0x5')][_0x0141('0x12')](queryAgents));break;case _0x0141('0x7'):_0x2b7a02[_0x1a4b0b](_0x0141('0x2e'));_0x2b7a02[_0x1a4b0b]('voice:outbound');_0x308235[_0x0141('0x31')](_0x29f463[_0x0141('0x3c')]({'attributes':['id',_0x0141('0x4')]}));_0x308235[_0x0141('0x31')](_0x29f463[_0x0141('0x3d')]({'attributes':['id',_0x0141('0x4')]}));_0x308235[_0x0141('0x31')](_0x29f463[_0x0141('0x3e')]({'attributes':['id','name']}));_0x308235[_0x0141('0x31')](_0x29f463[_0x0141('0x3f')]({'attributes':['id',_0x0141('0x4')]}));_0x308235['push'](_0x29f463[_0x0141('0x40')]({'attributes':['id',_0x0141('0x4')]}));_0x308235[_0x0141('0x31')](_0x29f463['getOpenchannelQueues']({'attributes':['id',_0x0141('0x4')]}));_0x308235['push'](_0x29f463[_0x0141('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0x0141('0x42')](_0x308235);}})['then'](function(_0xaa2b6d){if(_0xaa2b6d&&_0xaa2b6d[_0x0141('0x43')]){for(var _0x12943f=0x0;_0x12943f<_0xaa2b6d[_0x0141('0x43')];_0x12943f+=0x1){for(var _0x20a901=0x0;_0x20a901<_0xaa2b6d[_0x12943f]['length'];_0x20a901+=0x1){switch(_0x12943f){case 0x0:joinOrLeaveQueues(_0x2b7a02,_0x1a4b0b,_0x0141('0x44'),_0xaa2b6d[_0x12943f][_0x20a901]);break;case 0x1:joinOrLeaveQueues(_0x2b7a02,_0x1a4b0b,_0x0141('0x45'),_0xaa2b6d[_0x12943f][_0x20a901]);break;case 0x2:joinOrLeaveQueues(_0x2b7a02,_0x1a4b0b,_0x0141('0x46'),_0xaa2b6d[_0x12943f][_0x20a901]);break;case 0x3:joinOrLeaveQueues(_0x2b7a02,_0x1a4b0b,'sms',_0xaa2b6d[_0x12943f][_0x20a901]);break;case 0x4:joinOrLeaveQueues(_0x2b7a02,_0x1a4b0b,_0x0141('0x47'),_0xaa2b6d[_0x12943f][_0x20a901]);break;case 0x5:joinOrLeaveQueues(_0x2b7a02,_0x1a4b0b,_0x0141('0x48'),_0xaa2b6d[_0x12943f][_0x20a901]);break;case 0x6:joinOrLeaveQueues(_0x2b7a02,_0x1a4b0b,_0x0141('0x49'),_0xaa2b6d[_0x12943f][_0x20a901]);break;case 0x7:if(_0x20656b['role']!==_0x0141('0x7'))_0x2b7a02[_0x1a4b0b](util['format'](_0x0141('0x4a'),_0xaa2b6d[_0x12943f][_0x20a901][_0x0141('0x4')]));break;case 0x8:if(_0x20656b[_0x0141('0x6')]!==_0x0141('0x7'))_0x2b7a02[_0x1a4b0b](util['format'](_0x0141('0x4b'),_0xaa2b6d[_0x12943f][_0x20a901][_0x0141('0x4')]));break;case 0x9:if(_0x20656b[_0x0141('0x6')]!==_0x0141('0x7'))_0x2b7a02[_0x1a4b0b](util[_0x0141('0x1c')](_0x0141('0x4c'),_0xaa2b6d[_0x12943f][_0x20a901][_0x0141('0x9')],_0xaa2b6d[_0x12943f][_0x20a901]['name']));break;case 0xa:_0x2b7a02[_0x1a4b0b](util[_0x0141('0x1c')](_0x0141('0x1f'),_0xaa2b6d[_0x12943f][_0x20a901][_0x0141('0x4')]));break;}}}}})['then'](function(){if(_0x1a4b0b===_0x0141('0x4d')){var _0x256fcc=_[_0x0141('0x18')](_0x20656b['ChatInteractions'],'id');return _0x20656b[_0x0141('0x4e')](_0x256fcc)['then'](function(){for(var _0x32428d=0x0;_0x32428d<_0x256fcc[_0x0141('0x43')];_0x32428d+=0x1){_0xccf0c[_0x0141('0x4f')](_0x0141('0x50'),{'ChatInteractionId':Number(_0x256fcc[_0x32428d]),'UserId':Number(_0x20656b['id'])});}});}})[_0x0141('0xc')](function(){if(_0x1a4b0b===_0x0141('0x4d')){var _0x42faf1=_[_0x0141('0x18')](_0x20656b[_0x0141('0x26')],'id');return _0x20656b[_0x0141('0x51')](_0x42faf1)[_0x0141('0xc')](function(){for(var _0x53b31f=0x0;_0x53b31f<_0x42faf1[_0x0141('0x43')];_0x53b31f+=0x1){_0xccf0c[_0x0141('0x4f')](_0x0141('0x52'),{'MailInteractionId':Number(_0x42faf1[_0x53b31f]),'UserId':Number(_0x20656b['id'])});}});}})[_0x0141('0xc')](function(){if(_0x1a4b0b==='leave'){var _0x475134=_[_0x0141('0x18')](_0x20656b[_0x0141('0x53')],'id');return _0x20656b[_0x0141('0x54')](_0x475134)[_0x0141('0xc')](function(){for(var _0x3e28eb=0x0;_0x3e28eb<_0x475134['length'];_0x3e28eb+=0x1){_0xccf0c[_0x0141('0x4f')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x475134[_0x3e28eb]),'UserId':Number(_0x20656b['id'])});}});}})[_0x0141('0xc')](function(){if(_0x1a4b0b===_0x0141('0x4d')){var _0x45020b=_[_0x0141('0x18')](_0x20656b[_0x0141('0x55')],'id');return _0x20656b[_0x0141('0x56')](_0x45020b)[_0x0141('0xc')](function(){for(var _0x4d515e=0x0;_0x4d515e<_0x45020b['length'];_0x4d515e+=0x1){_0xccf0c[_0x0141('0x4f')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x45020b[_0x4d515e]),'UserId':Number(_0x20656b['id'])});}});}})['then'](function(){if(_0x1a4b0b===_0x0141('0x4d')){var _0x2124a6=_[_0x0141('0x18')](_0x20656b[_0x0141('0x2a')],'id');return _0x20656b[_0x0141('0x57')](_0x2124a6)[_0x0141('0xc')](function(){for(var _0x20d836=0x0;_0x20d836<_0x2124a6[_0x0141('0x43')];_0x20d836+=0x1){_0xccf0c[_0x0141('0x4f')](_0x0141('0x58'),{'OpenchannelInteractionId':Number(_0x2124a6[_0x20d836]),'UserId':Number(_0x20656b['id'])});}});}})['then'](function(){if(_0x1a4b0b===_0x0141('0x4d')){var _0x25017c=_[_0x0141('0x18')](_0x20656b[_0x0141('0x2c')],'id');return _0x20656b[_0x0141('0x59')](_0x25017c)[_0x0141('0xc')](function(){for(var _0x2d8125=0x0;_0x2d8125<_0x25017c[_0x0141('0x43')];_0x2d8125+=0x1){_0xccf0c['emit'](_0x0141('0x5a'),{'WhatsappInteractionId':Number(_0x25017c[_0x2d8125]),'UserId':Number(_0x20656b['id'])});}});}})[_0x0141('0x5b')](function(_0x26b4a6){_0x2b7a02[_0x0141('0x5c')](_0x26b4a6);});}}function onDisconnect(_0x3c7ddc,_0x5c2f7f){joinOrLeave(_0x3c7ddc,'leave',_0x5c2f7f);}function onConnect(_0x3cd93c){joinOrLeave(_0x3cd93c,_0x0141('0x5d'));}exports[_0x0141('0x5e')]=function(_0x2d78d8){_0x2d78d8['on'](_0x0141('0x5f'),function(_0x4e0d6e){_0x4e0d6e[_0x0141('0x60')](0x0);_0x4e0d6e[_0x0141('0x61')]=_0x4e0d6e[_0x0141('0x62')][_0x0141('0x5f')][_0x0141('0x63')]+':'+_0x4e0d6e['request']['connection'][_0x0141('0x64')];_0x4e0d6e[_0x0141('0x65')]=new Date();_0x4e0d6e[_0x0141('0x5c')]=function(_0x1f41e9){console['log'](_0x0141('0x66')+_0x4e0d6e[_0x0141('0x67')][_0x0141('0x4')]+'['+_0x4e0d6e[_0x0141('0x61')]+']',_0x1f41e9);};_0x4e0d6e['on'](_0x0141('0x68'),function(){onDisconnect(_0x4e0d6e,_0x2d78d8);_0x4e0d6e['log'](_0x0141('0x69'));});onConnect(_0x4e0d6e);_0x4e0d6e[_0x0141('0x5c')](_0x0141('0x6a'));});}; \ No newline at end of file +var _0xc137=['userProfileId','ChatQueue','Trunks','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','setMaxListeners','address','request','connection','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','role','agent','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','User','where','type','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user'];(function(_0x14ea32,_0x262909){var _0x137bbb=function(_0x4a36ab){while(--_0x4a36ab){_0x14ea32['push'](_0x14ea32['shift']());}};_0x137bbb(++_0x262909);}(_0xc137,0xff));var _0x7c13=function(_0x1a64ff,_0x4277ba){_0x1a64ff=_0x1a64ff-0x0;var _0x4dc23b=_0xc137[_0x1a64ff];return _0x4dc23b;};'use strict';var _=require(_0x7c13('0x0'));var util=require(_0x7c13('0x1'));var BPromise=require(_0x7c13('0x2'));var db=require(_0x7c13('0x3'))['db'];var config=require(_0x7c13('0x4'));var queryQueues={'attributes':['id',_0x7c13('0x5')],'include':[{'as':'Agents','model':db['User'],'attributes':['id','name',_0x7c13('0x6')],'raw':!![],'where':{'role':_0x7c13('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7c13('0x5')],'where':{'role':_0x7c13('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7c13('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x7c13('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0x7c13('0x9')}};function getAssociatedResources(_0x2c93d6,_0x489201,_0x9cb550){return db[_0x7c13('0xa')]['findOne']({'where':{'name':_0x2c93d6,'userProfileId':_0x489201},'raw':!![]})[_0x7c13('0xb')](function(_0x20501d){if(_0x20501d){if(_0x20501d[_0x7c13('0xc')]){switch(_0x2c93d6){case _0x7c13('0xd'):case _0x7c13('0xe'):case _0x7c13('0xf'):case _0x7c13('0x10'):case _0x7c13('0x11'):case _0x7c13('0x12'):case _0x7c13('0x13'):return db[_0x9cb550][_0x7c13('0x14')](queryQueues);case _0x7c13('0x15'):return db[_0x9cb550][_0x7c13('0x14')](queryTelephones);case'Trunks':return db[_0x9cb550][_0x7c13('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x9cb550][_0x7c13('0x14')](queryCampaigns);}}else{return db[_0x7c13('0x16')][_0x7c13('0x14')]({'attributes':[_0x7c13('0x17')],'where':{'sectionId':_0x20501d['id']},'raw':!![]})[_0x7c13('0xb')](function(_0x3f9cf4){if(_0x3f9cf4){var _0x2b9855={'where':{'id':_['map'](_0x3f9cf4,_0x7c13('0x17'))},'raw':!![]};switch(_0x9cb550){case _0x7c13('0x18'):_0x2b9855['where'][_0x7c13('0x6')]=_0x7c13('0x8');break;case'Campaign':_0x2b9855[_0x7c13('0x19')][_0x7c13('0x1a')]=_0x7c13('0x9');break;}return db[_0x9cb550][_0x7c13('0x14')](_0x2b9855);}else{return[];}});}}else{return[];}})[_0x7c13('0xb')](function(_0x8a5383){return _0x8a5383;});}function joinOrLeaveQueues(_0x3a5c31,_0x46d80d,_0x39d21c,_0x5bd671){_0x3a5c31[_0x46d80d](util[_0x7c13('0x1b')](_0x7c13('0x1c'),_0x39d21c,_0x5bd671['name']));if(_0x5bd671['Agents']){for(var _0x2492e4=0x0;_0x2492e4<_0x5bd671[_0x7c13('0x1d')][_0x7c13('0x1e')];_0x2492e4+=0x1){_0x3a5c31[_0x46d80d](util['format'](_0x7c13('0x1f'),_0x5bd671[_0x7c13('0x1d')][_0x2492e4][_0x7c13('0x5')]));}}}function joinOrLeave(_0x12405c,_0x3a4753,_0xc5bc98){var _0x2cd2c1;if(_0x12405c[_0x7c13('0x20')][_0x7c13('0x21')]['id']){db[_0x7c13('0x18')][_0x7c13('0x22')]({'attributes':['id',_0x7c13('0x5'),_0x7c13('0x6'),'userProfileId'],'where':{'id':_0x12405c[_0x7c13('0x20')][_0x7c13('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7c13('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7c13('0x24')],'as':_0x7c13('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x7c13('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7c13('0x27')],'as':_0x7c13('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x7c13('0x29'),'attributes':['id'],'raw':!![]}]})[_0x7c13('0xb')](function(_0x2fe70e){if(_0x2fe70e){_0x2cd2c1=_0x2fe70e;_0x12405c[_0x3a4753](util[_0x7c13('0x1b')](_0x7c13('0x1f'),_0x2fe70e[_0x7c13('0x5')]));var _0x3e4da0=[];switch(_0x2fe70e[_0x7c13('0x6')]){case _0x7c13('0x2a'):_0x12405c[_0x3a4753](_0x7c13('0x2b'));_0x12405c[_0x3a4753](_0x7c13('0x2c'));if(queryQueues[_0x7c13('0x2d')]('include')){delete queryQueues[_0x7c13('0x2e')];}_0x3e4da0[_0x7c13('0x2f')](db[_0x7c13('0x30')][_0x7c13('0x14')](queryQueues));_0x3e4da0[_0x7c13('0x2f')](db['ChatQueue'][_0x7c13('0x14')](queryQueues));_0x3e4da0[_0x7c13('0x2f')](db[_0x7c13('0x31')][_0x7c13('0x14')](queryQueues));_0x3e4da0[_0x7c13('0x2f')](db[_0x7c13('0x32')][_0x7c13('0x14')](queryQueues));_0x3e4da0[_0x7c13('0x2f')](db[_0x7c13('0x33')][_0x7c13('0x14')](queryQueues));_0x3e4da0[_0x7c13('0x2f')](db[_0x7c13('0x34')][_0x7c13('0x14')](queryQueues));_0x3e4da0[_0x7c13('0x2f')](db[_0x7c13('0x35')][_0x7c13('0x14')](queryQueues));_0x3e4da0[_0x7c13('0x2f')](db[_0x7c13('0x18')][_0x7c13('0x14')](queryTelephones));_0x3e4da0['push'](db[_0x7c13('0x36')][_0x7c13('0x14')](queryTrunks));_0x3e4da0['push'](db[_0x7c13('0x37')][_0x7c13('0x14')](queryCampaigns));_0x3e4da0[_0x7c13('0x2f')](db['User']['findAll'](queryAgents));break;case _0x7c13('0x38'):_0x12405c[_0x3a4753](_0x7c13('0x2b'));_0x12405c[_0x3a4753]('voice:outbound');_0x3e4da0['push'](getAssociatedResources(_0x7c13('0xd'),_0x2fe70e[_0x7c13('0x39')],'VoiceQueue'));_0x3e4da0[_0x7c13('0x2f')](getAssociatedResources(_0x7c13('0xe'),_0x2fe70e[_0x7c13('0x39')],_0x7c13('0x3a')));_0x3e4da0[_0x7c13('0x2f')](getAssociatedResources(_0x7c13('0xf'),_0x2fe70e[_0x7c13('0x39')],_0x7c13('0x31')));_0x3e4da0[_0x7c13('0x2f')](getAssociatedResources(_0x7c13('0x10'),_0x2fe70e['userProfileId'],_0x7c13('0x32')));_0x3e4da0[_0x7c13('0x2f')](getAssociatedResources('MailQueues',_0x2fe70e[_0x7c13('0x39')],_0x7c13('0x33')));_0x3e4da0[_0x7c13('0x2f')](getAssociatedResources(_0x7c13('0x12'),_0x2fe70e[_0x7c13('0x39')],'OpenchannelQueue'));_0x3e4da0[_0x7c13('0x2f')](getAssociatedResources(_0x7c13('0x13'),_0x2fe70e[_0x7c13('0x39')],_0x7c13('0x35')));_0x3e4da0[_0x7c13('0x2f')](getAssociatedResources(_0x7c13('0x15'),_0x2fe70e['userProfileId'],_0x7c13('0x18')));_0x3e4da0[_0x7c13('0x2f')](getAssociatedResources(_0x7c13('0x3b'),_0x2fe70e[_0x7c13('0x39')],_0x7c13('0x36')));_0x3e4da0[_0x7c13('0x2f')](getAssociatedResources(_0x7c13('0x3c'),_0x2fe70e['userProfileId'],_0x7c13('0x37')));_0x3e4da0[_0x7c13('0x2f')](db[_0x7c13('0x18')][_0x7c13('0x14')](queryAgents));break;case'agent':_0x12405c[_0x3a4753](_0x7c13('0x2b'));_0x12405c[_0x3a4753](_0x7c13('0x2c'));_0x3e4da0[_0x7c13('0x2f')](_0x2fe70e[_0x7c13('0x3d')]({'attributes':['id',_0x7c13('0x5')]}));_0x3e4da0[_0x7c13('0x2f')](_0x2fe70e[_0x7c13('0x3e')]({'attributes':['id',_0x7c13('0x5')]}));_0x3e4da0[_0x7c13('0x2f')](_0x2fe70e[_0x7c13('0x3f')]({'attributes':['id',_0x7c13('0x5')]}));_0x3e4da0[_0x7c13('0x2f')](_0x2fe70e[_0x7c13('0x40')]({'attributes':['id','name']}));_0x3e4da0[_0x7c13('0x2f')](_0x2fe70e[_0x7c13('0x41')]({'attributes':['id',_0x7c13('0x5')]}));_0x3e4da0[_0x7c13('0x2f')](_0x2fe70e['getOpenchannelQueues']({'attributes':['id',_0x7c13('0x5')]}));_0x3e4da0[_0x7c13('0x2f')](_0x2fe70e[_0x7c13('0x42')]({'attributes':['id',_0x7c13('0x5')]}));break;}return BPromise['all'](_0x3e4da0);}})[_0x7c13('0xb')](function(_0x324077){if(_0x324077&&_0x324077['length']){for(var _0x22f37e=0x0;_0x22f37e<_0x324077[_0x7c13('0x1e')];_0x22f37e+=0x1){for(var _0x56b6a1=0x0;_0x56b6a1<_0x324077[_0x22f37e]['length'];_0x56b6a1+=0x1){switch(_0x22f37e){case 0x0:joinOrLeaveQueues(_0x12405c,_0x3a4753,_0x7c13('0x43'),_0x324077[_0x22f37e][_0x56b6a1]);break;case 0x1:joinOrLeaveQueues(_0x12405c,_0x3a4753,_0x7c13('0x44'),_0x324077[_0x22f37e][_0x56b6a1]);break;case 0x2:joinOrLeaveQueues(_0x12405c,_0x3a4753,_0x7c13('0x45'),_0x324077[_0x22f37e][_0x56b6a1]);break;case 0x3:joinOrLeaveQueues(_0x12405c,_0x3a4753,'sms',_0x324077[_0x22f37e][_0x56b6a1]);break;case 0x4:joinOrLeaveQueues(_0x12405c,_0x3a4753,_0x7c13('0x46'),_0x324077[_0x22f37e][_0x56b6a1]);break;case 0x5:joinOrLeaveQueues(_0x12405c,_0x3a4753,_0x7c13('0x47'),_0x324077[_0x22f37e][_0x56b6a1]);break;case 0x6:joinOrLeaveQueues(_0x12405c,_0x3a4753,_0x7c13('0x48'),_0x324077[_0x22f37e][_0x56b6a1]);break;case 0x7:if(_0x2cd2c1[_0x7c13('0x6')]!==_0x7c13('0x7'))_0x12405c[_0x3a4753](util[_0x7c13('0x1b')](_0x7c13('0x49'),_0x324077[_0x22f37e][_0x56b6a1][_0x7c13('0x5')]));break;case 0x8:if(_0x2cd2c1[_0x7c13('0x6')]!=='agent')_0x12405c[_0x3a4753](util[_0x7c13('0x1b')](_0x7c13('0x4a'),_0x324077[_0x22f37e][_0x56b6a1]['name']));break;case 0x9:if(_0x2cd2c1[_0x7c13('0x6')]!==_0x7c13('0x7'))_0x12405c[_0x3a4753](util[_0x7c13('0x1b')](_0x7c13('0x4b'),_0x324077[_0x22f37e][_0x56b6a1][_0x7c13('0x1a')],_0x324077[_0x22f37e][_0x56b6a1]['name']));break;case 0xa:_0x12405c[_0x3a4753](util[_0x7c13('0x1b')]('user:%s',_0x324077[_0x22f37e][_0x56b6a1][_0x7c13('0x5')]));break;}}}}})[_0x7c13('0xb')](function(){if(_0x3a4753===_0x7c13('0x4c')){var _0x2a5c1d=_[_0x7c13('0x4d')](_0x2cd2c1[_0x7c13('0x4e')],'id');return _0x2cd2c1[_0x7c13('0x4f')](_0x2a5c1d)[_0x7c13('0xb')](function(){for(var _0x1d565c=0x0;_0x1d565c<_0x2a5c1d[_0x7c13('0x1e')];_0x1d565c+=0x1){_0xc5bc98[_0x7c13('0x50')](_0x7c13('0x51'),{'ChatInteractionId':Number(_0x2a5c1d[_0x1d565c]),'UserId':Number(_0x2cd2c1['id'])});}});}})[_0x7c13('0xb')](function(){if(_0x3a4753===_0x7c13('0x4c')){var _0x139e45=_['map'](_0x2cd2c1[_0x7c13('0x52')],'id');return _0x2cd2c1[_0x7c13('0x53')](_0x139e45)['then'](function(){for(var _0x398d6a=0x0;_0x398d6a<_0x139e45[_0x7c13('0x1e')];_0x398d6a+=0x1){_0xc5bc98[_0x7c13('0x50')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x139e45[_0x398d6a]),'UserId':Number(_0x2cd2c1['id'])});}});}})[_0x7c13('0xb')](function(){if(_0x3a4753===_0x7c13('0x4c')){var _0x50d8da=_[_0x7c13('0x4d')](_0x2cd2c1[_0x7c13('0x25')],'id');return _0x2cd2c1['removeFaxInteractions'](_0x50d8da)[_0x7c13('0xb')](function(){for(var _0x4562ba=0x0;_0x4562ba<_0x50d8da[_0x7c13('0x1e')];_0x4562ba+=0x1){_0xc5bc98[_0x7c13('0x50')](_0x7c13('0x54'),{'FaxInteractionId':Number(_0x50d8da[_0x4562ba]),'UserId':Number(_0x2cd2c1['id'])});}});}})[_0x7c13('0xb')](function(){if(_0x3a4753===_0x7c13('0x4c')){var _0x4320e0=_['map'](_0x2cd2c1[_0x7c13('0x55')],'id');return _0x2cd2c1[_0x7c13('0x56')](_0x4320e0)['then'](function(){for(var _0x10c939=0x0;_0x10c939<_0x4320e0[_0x7c13('0x1e')];_0x10c939+=0x1){_0xc5bc98[_0x7c13('0x50')](_0x7c13('0x57'),{'SmsInteractionId':Number(_0x4320e0[_0x10c939]),'UserId':Number(_0x2cd2c1['id'])});}});}})[_0x7c13('0xb')](function(){if(_0x3a4753===_0x7c13('0x4c')){var _0x45044f=_[_0x7c13('0x4d')](_0x2cd2c1[_0x7c13('0x28')],'id');return _0x2cd2c1['removeOpenchannelInteractions'](_0x45044f)['then'](function(){for(var _0x4a2ff7=0x0;_0x4a2ff7<_0x45044f['length'];_0x4a2ff7+=0x1){_0xc5bc98['emit'](_0x7c13('0x58'),{'OpenchannelInteractionId':Number(_0x45044f[_0x4a2ff7]),'UserId':Number(_0x2cd2c1['id'])});}});}})[_0x7c13('0xb')](function(){if(_0x3a4753===_0x7c13('0x4c')){var _0x98dcbf=_[_0x7c13('0x4d')](_0x2cd2c1[_0x7c13('0x29')],'id');return _0x2cd2c1[_0x7c13('0x59')](_0x98dcbf)[_0x7c13('0xb')](function(){for(var _0x5e63f9=0x0;_0x5e63f9<_0x98dcbf[_0x7c13('0x1e')];_0x5e63f9+=0x1){_0xc5bc98[_0x7c13('0x50')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x98dcbf[_0x5e63f9]),'UserId':Number(_0x2cd2c1['id'])});}});}})[_0x7c13('0x5a')](function(_0x1149a1){_0x12405c[_0x7c13('0x5b')](_0x1149a1);});}}function onDisconnect(_0x6948ea,_0x47837a){joinOrLeave(_0x6948ea,_0x7c13('0x4c'),_0x47837a);}function onConnect(_0x4c419d){joinOrLeave(_0x4c419d,_0x7c13('0x5c'));}exports[_0x7c13('0x5d')]=function(_0x54feff){_0x54feff['on']('connection',function(_0x2b2b5c){_0x2b2b5c[_0x7c13('0x5e')](0x0);_0x2b2b5c[_0x7c13('0x5f')]=_0x2b2b5c[_0x7c13('0x60')][_0x7c13('0x61')]['remoteAddress']+':'+_0x2b2b5c[_0x7c13('0x60')]['connection'][_0x7c13('0x62')];_0x2b2b5c[_0x7c13('0x63')]=new Date();_0x2b2b5c[_0x7c13('0x5b')]=function(_0x49b9c8){console[_0x7c13('0x5b')]('SocketIO\x20'+_0x2b2b5c[_0x7c13('0x64')]['name']+'['+_0x2b2b5c[_0x7c13('0x5f')]+']',_0x49b9c8);};_0x2b2b5c['on'](_0x7c13('0x65'),function(){onDisconnect(_0x2b2b5c,_0x54feff);_0x2b2b5c[_0x7c13('0x5b')](_0x7c13('0x66'));});onConnect(_0x2b2b5c);_0x2b2b5c['log'](_0x7c13('0x67'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3113610..b1b5666 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 _0x29e6=['hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','lodash','ChatInteraction','afterCreate','Chat','afterUpdate','closedinteraction','ChatMessage','newmessage','SmsInteraction','newinteraction','SmsMessage','WhatsappInteraction','Whatsapp','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','error','code','Trigger,\x20%s','catch','get','event','direction','ContactId','sequelize','query','QueryTypes','then','User','find','UserId','name','fullname','interface','format','SIP/%s','channel','agent','incomingmessage','outgoingmessage','opened','SELECT','contact','changed','closed','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','internal','default','length','hasOwnProperty','model'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x29e6,0xd0));var _0x629e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x29e6[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x629e('0x0'));var db=require(_0x629e('0x1'))['db'];var jayson=require(_0x629e('0x2'));var logger=require(_0x629e('0x3'))(_0x629e('0x4'));var _=require(_0x629e('0x5'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x629e('0x6'),'event':_0x629e('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x629e('0x8'),'model':_0x629e('0x6'),'event':_0x629e('0x9'),'condition':_0x629e('0xa'),'callback':afterUpdate},{'channel':_0x629e('0x8'),'model':_0x629e('0xb'),'event':_0x629e('0x7'),'condition':_0x629e('0xc'),'callback':afterCreateMessage},{'channel':'Sms','model':_0x629e('0xd'),'event':_0x629e('0x7'),'condition':_0x629e('0xe'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x629e('0x9'),'condition':_0x629e('0xa'),'callback':afterUpdate},{'channel':'Sms','model':_0x629e('0xf'),'event':'afterCreate','condition':_0x629e('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x629e('0x10'),'event':_0x629e('0x7'),'condition':_0x629e('0xe'),'callback':afterCreate},{'channel':_0x629e('0x11'),'model':_0x629e('0x10'),'event':_0x629e('0x9'),'condition':_0x629e('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x629e('0x7'),'condition':_0x629e('0xc'),'callback':afterCreateMessage},{'channel':_0x629e('0x12'),'model':_0x629e('0x13'),'event':_0x629e('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x629e('0x12'),'model':'FaxInteraction','event':_0x629e('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x629e('0x12'),'model':_0x629e('0x14'),'event':_0x629e('0x7'),'condition':_0x629e('0xc'),'callback':afterCreateMessage},{'channel':_0x629e('0x15'),'model':_0x629e('0x16'),'event':_0x629e('0x7'),'condition':_0x629e('0xe'),'callback':afterCreate},{'channel':_0x629e('0x15'),'model':'MailInteraction','event':_0x629e('0x9'),'condition':_0x629e('0xa'),'callback':afterUpdate},{'channel':_0x629e('0x15'),'model':_0x629e('0x17'),'event':'afterCreate','condition':_0x629e('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x629e('0x18'),'model':_0x629e('0x19'),'event':_0x629e('0x9'),'condition':_0x629e('0xa'),'callback':afterUpdate},{'channel':_0x629e('0x18'),'model':'OpenchannelMessage','event':_0x629e('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x5c95a6){return client[_0x629e('0x1a')](_0x629e('0x1b'),_0x5c95a6)['then'](function(_0x58999d){logger['info']('Trigger,\x20%s',_0x629e('0x1b'),_0x58999d);if(_0x58999d[_0x629e('0x1c')]){if(_0x58999d[_0x629e('0x1c')][_0x629e('0x1d')]===0x1f4){logger[_0x629e('0x1c')](_0x629e('0x1e'),'EventManager',_0x58999d[_0x629e('0x1c')]);}}})[_0x629e('0x1f')](function(_0x2d1de3){logger[_0x629e('0x1c')]('Trigger,\x20%s',_0x629e('0x1b'),_0x2d1de3);});}function afterCreateMessage(_0x70b776,_0x1b96bc){return function(_0x2adb20,_0x209b9f){_0x2adb20=_0x2adb20[_0x629e('0x20')]({'plain':!![]});_0x2adb20['channel']=_0x70b776;_0x2adb20[_0x629e('0x21')]=_0x2adb20[_0x629e('0x22')];var _0x595ac9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2adb20[_0x629e('0x23')];return db[_0x629e('0x24')][_0x629e('0x25')](_0x595ac9,{'type':db['Sequelize'][_0x629e('0x26')]['SELECT'],'raw':!![]})['then'](function(_0x374d29){return _0x374d29;})[_0x629e('0x27')](function(_0x36445e){if(_0x36445e){_0x2adb20['contact']=_0x36445e[0x0];}if(_0x2adb20['UserId']){return db[_0x629e('0x28')][_0x629e('0x29')]({'where':{'id':_0x2adb20[_0x629e('0x2a')]},'attributes':['id',_0x629e('0x2b'),_0x629e('0x2c'),'email','internal'],'raw':!![]})[_0x629e('0x27')](function(_0xcfe4df){_0x2adb20[_0x629e('0x2d')]=util[_0x629e('0x2e')](_0x629e('0x2f'),_0xcfe4df[_0x629e('0x2b')]);_0x2adb20[_0x629e('0x30')]=_0x70b776;_0x2adb20[_0x629e('0x31')]=_0xcfe4df;return request({'event':_0x629e('0x32'),'message':_0x2adb20});})[_0x629e('0x1f')](function(_0x3845e9){console[_0x629e('0x1c')](_0x3845e9);});}else{return request({'event':_0x629e('0x33'),'message':_0x2adb20});}});};}function afterCreate(_0x133cac,_0x561f0f){return function(_0x2925b9,_0x25fe9b){_0x2925b9=_0x2925b9[_0x629e('0x20')]({'plain':!![]});_0x2925b9[_0x629e('0x30')]=_0x133cac;_0x2925b9[_0x629e('0x21')]=_0x629e('0x34');var _0x178aa8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2925b9[_0x629e('0x23')];return db[_0x629e('0x24')][_0x629e('0x25')](_0x178aa8,{'type':db['Sequelize']['QueryTypes'][_0x629e('0x35')],'raw':!![]})['then'](function(_0xb8cb76){return _0xb8cb76;})[_0x629e('0x27')](function(_0x3384b9){if(_0x3384b9){_0x2925b9[_0x629e('0x36')]=_0x3384b9[0x0];}return request({'event':_0x561f0f,'message':_0x2925b9});});};}function afterUpdate(_0x545d47,_0x2a5791){return function(_0x521a90,_0x5e2ea0){if(_0x521a90[_0x629e('0x37')](_0x629e('0x38'))&&_0x521a90[_0x629e('0x38')]){_0x521a90=_0x521a90[_0x629e('0x20')]({'plain':!![]});_0x521a90[_0x629e('0x30')]=_0x545d47;_0x521a90[_0x629e('0x21')]=_0x629e('0x38');var _0x10aa5f=_0x629e('0x39')+_0x521a90[_0x629e('0x23')];return db[_0x629e('0x24')]['query'](_0x10aa5f,{'type':db['Sequelize'][_0x629e('0x26')][_0x629e('0x35')],'raw':!![]})['then'](function(_0x590486){return _0x590486;})[_0x629e('0x27')](function(_0x40e0fb){if(_0x40e0fb){_0x521a90['contact']=_0x40e0fb[0x0];}if(_0x521a90['UserId']){return db[_0x629e('0x28')][_0x629e('0x29')]({'where':{'id':_0x521a90[_0x629e('0x2a')]},'attributes':['id',_0x629e('0x2b'),_0x629e('0x2c'),_0x629e('0x3a'),_0x629e('0x3b')],'raw':!![]})[_0x629e('0x27')](function(_0x23c8e8){_0x521a90[_0x629e('0x2d')]=util[_0x629e('0x2e')](_0x629e('0x2f'),_0x23c8e8[_0x629e('0x2b')]);_0x521a90[_0x629e('0x31')]=_0x23c8e8;return request({'event':_0x2a5791,'message':_0x521a90});})['catch'](function(_0x42b5e0){console[_0x629e('0x1c')](_0x42b5e0);});}else{return request({'event':_0x2a5791,'message':_0x521a90});}});}};}exports[_0x629e('0x3c')]=function(){for(var _0x11ac32=0x0;_0x11ac32=_0x1d4fd3[_0x7d5f('0x13')]){throw Error(_0x7d5f('0x14'));}_0x1a0aeb(_0x5297e8);})[_0x7d5f('0x15')](function(_0x504816){_0x58d183(_0x504816);});});}; \ No newline at end of file +var _0xc58f=['getChannels','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','User','then','getLicense','agents','bluebird','../mysqldb','mail','chat','fax','sms','openchannel'];(function(_0x3382ef,_0x1f9c2b){var _0x1fd20c=function(_0x63c860){while(--_0x63c860){_0x3382ef['push'](_0x3382ef['shift']());}};_0x1fd20c(++_0x1f9c2b);}(_0xc58f,0x175));var _0xfc58=function(_0x2c7377,_0x32ade5){_0x2c7377=_0x2c7377-0x0;var _0x35e181=_0xc58f[_0x2c7377];return _0x35e181;};'use strict';var _=require('lodash');var BPromise=require(_0xfc58('0x0'));var db=require(_0xfc58('0x1'))['db'];var util=require('./license/util');var channels=['voice',_0xfc58('0x2'),_0xfc58('0x3'),_0xfc58('0x4'),_0xfc58('0x5'),'whatsapp',_0xfc58('0x6')];exports[_0xfc58('0x7')]=function(){return channels;};exports['isValidChannel']=function(_0x397dee){_0x397dee=_0x397dee[_0xfc58('0x8')]();return _[_0xfc58('0x9')](channels,_0x397dee);};exports[_0xfc58('0xa')]=function(_0x16b065,_0x584203,_0x26caac,_0xda91a6){var _0x347aa4={'loginAttempts':_0x584203,'blocked':_0x26caac};if(!_[_0xfc58('0xb')](_0xda91a6)){_0x347aa4[_0xfc58('0xc')]=_0xda91a6;}return _0x16b065[_0xfc58('0xd')](_0x347aa4);};exports['getLicense']=function(_0x1341ee){return new BPromise(function(_0x546b57,_0x30ee7b){var _0x1717e7=0x0;if(_0x1341ee[_0xfc58('0xe')]!==_0xfc58('0xf')){_0x546b57(_0x1341ee);}db[_0xfc58('0x10')]['count']({'where':{'role':_0xfc58('0xf'),'online':!![],'id':{'$ne':_0x1341ee['id']}}})[_0xfc58('0x11')](function(_0x1b7ff2){_0x1717e7=_0x1b7ff2;return util[_0xfc58('0x12')]();})[_0xfc58('0x11')](function(_0x41aa34){if(_0x41aa34&&_0x41aa34[_0xfc58('0x13')]&&_0x1717e7>=_0x41aa34[_0xfc58('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x546b57(_0x1341ee);})['catch'](function(_0x1a4bc2){_0x30ee7b(_0x1a4bc2);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 016e61b..113c0a5 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f5d=['render','json','send','exports','404','status'];(function(_0xd8d1bb,_0x4a3b7d){var _0x4b61d8=function(_0xe5da07){while(--_0xe5da07){_0xd8d1bb['push'](_0xd8d1bb['shift']());}};_0x4b61d8(++_0x4a3b7d);}(_0x8f5d,0x10b));var _0xd8f5=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x8f5d[_0x1762b4];return _0x29beda;};'use strict';module[_0xd8f5('0x0')][0x194]=function pageNotFound(_0x4c076b,_0x4169bc){var _0x5863b6=_0xd8f5('0x1');var _0x5dd77f=0x194;var _0x481ffc={'status':_0x5dd77f};_0x4169bc[_0xd8f5('0x2')](_0x481ffc[_0xd8f5('0x2')]);_0x4169bc[_0xd8f5('0x3')](_0x5863b6,{},function(_0x108c3f,_0x391525){if(_0x108c3f){return _0x4169bc[_0xd8f5('0x2')](_0x481ffc[_0xd8f5('0x2')])[_0xd8f5('0x4')](_0x481ffc);}_0x4169bc[_0xd8f5('0x5')](_0x391525);});}; \ No newline at end of file +var _0x04a3=['render','json','send','exports','404','status'];(function(_0x2574c7,_0x3a90e7){var _0xa8354e=function(_0x29fe6c){while(--_0x29fe6c){_0x2574c7['push'](_0x2574c7['shift']());}};_0xa8354e(++_0x3a90e7);}(_0x04a3,0x12f));var _0x304a=function(_0x5d33a9,_0x1d72e9){_0x5d33a9=_0x5d33a9-0x0;var _0x59ec9d=_0x04a3[_0x5d33a9];return _0x59ec9d;};'use strict';module[_0x304a('0x0')][0x194]=function pageNotFound(_0x18b164,_0x434e73){var _0x1b3187=_0x304a('0x1');var _0x211c24=0x194;var _0x3d3bd5={'status':_0x211c24};_0x434e73[_0x304a('0x2')](_0x3d3bd5['status']);_0x434e73[_0x304a('0x3')](_0x1b3187,{},function(_0x1fb4dc,_0x4c4497){if(_0x1fb4dc){return _0x434e73[_0x304a('0x2')](_0x3d3bd5[_0x304a('0x2')])[_0x304a('0x4')](_0x3d3bd5);}_0x434e73[_0x304a('0x5')](_0x4c4497);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0266b54..b46e6d4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91c5=['../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','Plugin','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','Realtime','../api/teamVoiceQueue/teamVoiceQueue.model','User','UserId','hasMany','UserVoiceQueueRt','VoiceQueuesRt','Extensions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','chat_group_has_users','CmContact','cm_user_has_contacts','CmList','Lists','belongsToMany','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','VoiceQueues','MailQueues','ChatQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccount','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','user_has_square_projects','cascade','ChanSpyId','Sounds','moh_has_sounds','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','hasOne','Smtp','Dispositions','Answers','Interactions','MailApplication','Applications','List','TemplateId','mandatoryDispositionPauseId','UserMailQueue','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','ListId','Items','Disposition','FaxAccountId','Exntensions','user_has_fax_accounts','FaxQueue','TagId','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','Tags','ChatInteractionId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','Contacts','CompanyId','CmHopper','Hoppers','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','Schedule','AnalyticDefaultReport','DefaultReportId','CustomReportId','Sound','Mohs','ItemType','ItemTypeId','Hopper','AllConditions','TriggerAnyId','Actions','TriggerId','Fields','MetricId','AccountId','Subjects','Descriptions','DescriptionId','FieldId','SubjectId','Description','Field','Configurations','VariableId','DeskConfiguration','int_desk_configuration_has_tags','Subject','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','FreshsalesField','FromId','ToId','JscriptyProject','ProjectId','TeamVoiceQueue','FaxQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','UserProfileSections','Resources','WhatsappAccountId','WhatsappApplication','WhatsappMessage','WhatsappInteractionId','whatsapp_interaction_has_tags','ToWhatsappAccountId','ToQueueId','exports','../config/environment','jstz','motion2','xcall','127.0.0.1','mysql','name','utf8_general_ci','sequelizeHistory','defaultsDeep','xC@LL1234','utf8mb4','utf8','sequelize','database','password','options','username','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../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','Action','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','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','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network'];(function(_0x46365f,_0x227ccd){var _0x5ccc21=function(_0x1a4d44){while(--_0x1a4d44){_0x46365f['push'](_0x46365f['shift']());}};_0x5ccc21(++_0x227ccd);}(_0x91c5,0x124));var _0x591c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x91c5[_0xa464c9];return _0x3d73c4;};'use strict';var path=require('path');var config=require(_0x591c('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x591c('0x1'));var timezone=jstz['determine']();config['sequelize']=_['defaultsDeep'](config['sequelize'],{'database':_0x591c('0x2'),'username':_0x591c('0x3'),'password':'xC@LL1234','options':{'host':_0x591c('0x4'),'port':0xcea,'dialect':_0x591c('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x591c('0x6')](),'define':{'charset':'utf8','collate':_0x591c('0x7')}}});config[_0x591c('0x8')]=_[_0x591c('0x9')](config[_0x591c('0x8')],{'database':_0x591c('0x2'),'username':_0x591c('0x3'),'password':_0x591c('0xa'),'options':{'host':_0x591c('0x4'),'port':0xcea,'dialect':_0x591c('0x5'),'dialectOptions':{'charset':_0x591c('0xb')},'logging':![],'timezone':timezone[_0x591c('0x6')](),'define':{'charset':_0x591c('0xc'),'collate':_0x591c('0x7')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x591c('0xd')][_0x591c('0xe')],config[_0x591c('0xd')]['username'],config[_0x591c('0xd')][_0x591c('0xf')],config['sequelize'][_0x591c('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x591c('0x8')][_0x591c('0xe')],config[_0x591c('0x8')][_0x591c('0x11')],config[_0x591c('0x8')][_0x591c('0xf')],config[_0x591c('0x8')][_0x591c('0x10')])};db['User']=db[_0x591c('0xd')]['import'](_0x591c('0x12'));db[_0x591c('0x13')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x591c('0x15')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x16'));db[_0x591c('0x17')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x18'));db[_0x591c('0x19')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x1a'));db[_0x591c('0x1b')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x1c'));db['VoiceRecording']=db['sequelize'][_0x591c('0x14')](_0x591c('0x1d'));db['ScreenRecording']=db[_0x591c('0xd')]['import']('../api/screenRecording/screenRecording.model');db[_0x591c('0x1e')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x1f'));db[_0x591c('0x20')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x21'));db['VoiceCallReport']=db['sequelize']['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x591c('0x22')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0x591c('0x23')]=db[_0x591c('0xd')]['import'](_0x591c('0x24'));db['VoiceQueueReport']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x25'));db[_0x591c('0x26')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x27'));db[_0x591c('0x28')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x591c('0xd')][_0x591c('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x29'));db[_0x591c('0x2a')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x591c('0x2b')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x2c'));db['UserMailQueue']=db[_0x591c('0xd')]['import'](_0x591c('0x2d'));db[_0x591c('0x2e')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x2f'));db['UserOpenchannelQueue']=db[_0x591c('0xd')][_0x591c('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x591c('0x30')]=db[_0x591c('0xd')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x591c('0x31')]=db[_0x591c('0xd')]['import'](_0x591c('0x32'));db[_0x591c('0x33')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x34'));db['MailAccount']=db[_0x591c('0xd')][_0x591c('0x14')]('../api/mailAccount/mailAccount.model');db[_0x591c('0x35')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x36'));db['MailSubstatus']=db[_0x591c('0xd')]['import'](_0x591c('0x37'));db[_0x591c('0x38')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x39'));db[_0x591c('0x3a')]=db['sequelize']['import'](_0x591c('0x3b'));db['MailApplication']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x3c'));db[_0x591c('0x3d')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x3e'));db['Dashboard']=db[_0x591c('0xd')]['import'](_0x591c('0x3f'));db[_0x591c('0x40')]=db[_0x591c('0xd')]['import'](_0x591c('0x41'));db[_0x591c('0x42')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x43'));db[_0x591c('0x44')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x45'));db['FaxInteraction']=db['sequelize']['import'](_0x591c('0x46'));db[_0x591c('0x47')]=db[_0x591c('0xd')]['import'](_0x591c('0x48'));db['FaxQueue']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x49'));db[_0x591c('0x4a')]=db[_0x591c('0xd')]['import']('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x4b'));db['SmsApplication']=db[_0x591c('0xd')][_0x591c('0x14')]('../api/smsApplication/smsApplication.model');db[_0x591c('0x4c')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x4d'));db[_0x591c('0x4e')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x4f'));db[_0x591c('0x50')]=db['sequelize'][_0x591c('0x14')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x591c('0xd')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x591c('0x51')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x52'));db[_0x591c('0x53')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x591c('0x54')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x55'));db[_0x591c('0x56')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x57'));db[_0x591c('0x58')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x59'));db[_0x591c('0x5a')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x5b'));db[_0x591c('0x5c')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x5d'));db['ChatMessage']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x5e'));db['ChatOfflineMessage']=db[_0x591c('0xd')]['import'](_0x591c('0x5f'));db[_0x591c('0x60')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x61'));db[_0x591c('0x62')]=db['sequelize']['import'](_0x591c('0x63'));db[_0x591c('0x64')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x65'));db[_0x591c('0x66')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x67'));db['CmContact']=db[_0x591c('0xd')][_0x591c('0x14')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x68'));db[_0x591c('0x69')]=db[_0x591c('0xd')]['import'](_0x591c('0x6a'));db[_0x591c('0x6b')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x6c'));db[_0x591c('0x6d')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x6e'));db[_0x591c('0x6f')]=db[_0x591c('0xd')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x591c('0x70')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x71'));db[_0x591c('0x72')]=db['sequelize'][_0x591c('0x14')]('../api/action/action.model');db[_0x591c('0x73')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/automation/automation.model');db[_0x591c('0x74')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x75'));db['Disposition']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x76'));db['Condition']=db['sequelize']['import']('../api/condition/condition.model');db[_0x591c('0x77')]=db['sequelize']['import'](_0x591c('0x78'));db[_0x591c('0x79')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x7a'));db[_0x591c('0x7b')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x7c'));db[_0x591c('0x7d')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x7e'));db['Schedule']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x7f'));db['Sound']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x80'));db[_0x591c('0x81')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/tag/tag.model');db[_0x591c('0x82')]=db['sequelize'][_0x591c('0x14')]('../api/contactItemType/contactItemType.model');db[_0x591c('0x83')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x84'));db[_0x591c('0x85')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x591c('0x86')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/template/template.model');db[_0x591c('0x87')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x88'));db[_0x591c('0x89')]=db['sequelize'][_0x591c('0x14')]('../api/variable/variable.model');db[_0x591c('0x8a')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/integration/integration.model');db[_0x591c('0x8b')]=db['sequelize'][_0x591c('0x14')]('../api/integrationReport/integrationReport.model');db[_0x591c('0x8c')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x8d'));db['AnalyticDefaultReport']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x8e'));db[_0x591c('0x8f')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x90'));db[_0x591c('0x91')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x92'));db[_0x591c('0x93')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x94'));db[_0x591c('0x95')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x591c('0x96')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x591c('0x97')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x98'));db[_0x591c('0x99')]=db['sequelize']['import'](_0x591c('0x9a'));db[_0x591c('0x9b')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0x9c'));db[_0x591c('0x9d')]=db['sequelize'][_0x591c('0x14')](_0x591c('0x9e'));db[_0x591c('0x9f')]=db['sequelize']['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x591c('0xa0')]=db[_0x591c('0xd')]['import'](_0x591c('0xa1'));db['DeskConfiguration']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xa2'));db[_0x591c('0xa3')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/intDeskField/intDeskField.model');db[_0x591c('0xa4')]=db['sequelize'][_0x591c('0x14')](_0x591c('0xa5'));db[_0x591c('0xa6')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xa7'));db[_0x591c('0xa8')]=db[_0x591c('0xd')]['import']('../api/intZohoField/intZohoField.model');db[_0x591c('0xa9')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db['sequelize']['import'](_0x591c('0xaa'));db[_0x591c('0xab')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xac'));db[_0x591c('0xad')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xae'));db['FreshdeskConfiguration']=db[_0x591c('0xd')]['import'](_0x591c('0xaf'));db['FreshdeskField']=db[_0x591c('0xd')]['import'](_0x591c('0xb0'));db[_0x591c('0xb1')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xb2'));db[_0x591c('0xb3')]=db[_0x591c('0xd')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x591c('0xb4')]=db['sequelize'][_0x591c('0x14')](_0x591c('0xb5'));db[_0x591c('0xb6')]=db['sequelize'][_0x591c('0x14')](_0x591c('0xb7'));db[_0x591c('0xb8')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xb9'));db[_0x591c('0xba')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xbb'));db[_0x591c('0xbc')]=db['sequelize']['import'](_0x591c('0xbd'));db[_0x591c('0xbe')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xbf'));db[_0x591c('0xc0')]=db[_0x591c('0xd')]['import'](_0x591c('0xc1'));db[_0x591c('0xc2')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xc3'));db['FreshsalesField']=db['sequelize']['import'](_0x591c('0xc4'));db[_0x591c('0x8a')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xc5'));db[_0x591c('0xc6')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xc7'));db[_0x591c('0xc8')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xc9'));db['ChatInternalMessage']=db[_0x591c('0xd')]['import'](_0x591c('0xca'));db[_0x591c('0xcb')]=db['sequelize'][_0x591c('0x14')](_0x591c('0xcc'));db[_0x591c('0xcd')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xce'));db[_0x591c('0xcf')]=db['sequelize'][_0x591c('0x14')](_0x591c('0xd0'));db[_0x591c('0xd1')]=db[_0x591c('0xd')]['import'](_0x591c('0xd2'));db['SquareReport']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xd3'));db[_0x591c('0xd4')]=db['sequelize'][_0x591c('0x14')](_0x591c('0xd5'));db['JscriptyProject']=db[_0x591c('0xd')][_0x591c('0x14')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xd6'));db['SquareOdbc']=db['sequelize']['import'](_0x591c('0xd7'));db['SquareProject']=db[_0x591c('0xd')]['import']('../api/squareProject/squareProject.model');db[_0x591c('0xd8')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xd9'));db[_0x591c('0xda')]=db['sequelize']['import'](_0x591c('0xdb'));db[_0x591c('0xdc')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xdd'));db['License']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xde'));db['Campaign']=db[_0x591c('0xd')]['import']('../api/campaign/campaign.model');db[_0x591c('0xdf')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xe0'));db[_0x591c('0xe1')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/attachment/attachment.model');db[_0x591c('0xe2')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize'][_0x591c('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0x591c('0xe3')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x591c('0xe4')]=db[_0x591c('0xd')]['import'](_0x591c('0xe5'));db[_0x591c('0xe6')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xe7'));db['SmsTransferReport']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xe8'));db['CmList']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xe9'));db[_0x591c('0xea')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0x591c('0xeb')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/userProfile/userProfile.model');db[_0x591c('0xec')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xed'));db[_0x591c('0xee')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xef'));db[_0x591c('0xf0')]=db[_0x591c('0xd')]['import'](_0x591c('0xf1'));db['WhatsappApplication']=db[_0x591c('0xd')][_0x591c('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0x591c('0xf2')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xf3'));db['WhatsappMessage']=db[_0x591c('0xd')][_0x591c('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x591c('0xf4')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xf5'));db[_0x591c('0xf6')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xf7'));db[_0x591c('0xf8')]=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xf9'));db[_0x591c('0xfa')]=db['sequelize']['import'](_0x591c('0xfb'));db[_0x591c('0xfc')]=db[_0x591c('0xd')][_0x591c('0x14')]('../api/realtime/realtime.model');db['TeamVoiceQueue']=db[_0x591c('0xd')][_0x591c('0x14')](_0x591c('0xfd'));db[_0x591c('0xfe')]['hasOne'](db['VoiceMail'],{'as':_0x591c('0x1e'),'onDelete':'cascade','foreignKey':_0x591c('0xff')});db['User'][_0x591c('0x100')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x591c('0xff')});db[_0x591c('0xfe')][_0x591c('0x100')](db[_0x591c('0x101')],{'as':_0x591c('0x102'),'foreignKey':_0x591c('0xff')});db[_0x591c('0xfe')][_0x591c('0x100')](db['VoiceExtension'],{'as':_0x591c('0x103'),'onDelete':'cascade','hooks':!![]});db[_0x591c('0xfe')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'UserId'});db[_0x591c('0xfe')]['hasMany'](db[_0x591c('0x6d')],{'as':'HopperHistory','foreignKey':_0x591c('0xff')});db[_0x591c('0xfe')][_0x591c('0x100')](db[_0x591c('0x6f')],{'as':_0x591c('0x6f'),'foreignKey':_0x591c('0xff')});db['User']['hasMany'](db[_0x591c('0x53')],{'as':'OpenchannelInteractions','foreignKey':_0x591c('0xff')});db[_0x591c('0xfe')]['hasMany'](db[_0x591c('0x104')],{'as':_0x591c('0x105'),'foreignKey':_0x591c('0xff')});db['User'][_0x591c('0x100')](db['SmsInteraction'],{'as':_0x591c('0x106'),'foreignKey':_0x591c('0xff')});db[_0x591c('0xfe')][_0x591c('0x100')](db[_0x591c('0x107')],{'as':_0x591c('0x108'),'foreignKey':_0x591c('0xff')});db['User'][_0x591c('0x100')](db[_0x591c('0x38')],{'as':_0x591c('0x109'),'foreignKey':_0x591c('0xff')});db[_0x591c('0xfe')]['hasMany'](db['WhatsappInteraction'],{'as':_0x591c('0x10a'),'foreignKey':_0x591c('0xff')});db[_0x591c('0xfe')][_0x591c('0x100')](db['UserNotification'],{'as':_0x591c('0x10b'),'foreignKey':_0x591c('0x10c')});db[_0x591c('0xfe')][_0x591c('0x10d')](db[_0x591c('0xeb')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User']['belongsToMany'](db['ChatGroup'],{'as':'Groups','through':_0x591c('0x10e')});db[_0x591c('0xfe')]['belongsToMany'](db[_0x591c('0x10f')],{'as':'Contacts','through':_0x591c('0x110')});db[_0x591c('0xfe')]['belongsToMany'](db[_0x591c('0x111')],{'as':_0x591c('0x112'),'through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0x591c('0xdc')],{'through':'user_has_teams'});db[_0x591c('0xfe')][_0x591c('0x113')](db['MailInteraction'],{'as':'MailInteractions','through':_0x591c('0x114')});db[_0x591c('0xfe')]['belongsToMany'](db['ChatInteraction'],{'as':_0x591c('0x105'),'through':_0x591c('0x115')});db[_0x591c('0xfe')]['belongsToMany'](db[_0x591c('0x107')],{'as':_0x591c('0x108'),'through':_0x591c('0x116')});db[_0x591c('0xfe')]['belongsToMany'](db['SmsInteraction'],{'as':_0x591c('0x106'),'through':_0x591c('0x117')});db[_0x591c('0xfe')]['belongsToMany'](db[_0x591c('0x53')],{'as':_0x591c('0x118'),'through':'user_has_openchannel_interactions'});db[_0x591c('0xfe')][_0x591c('0x113')](db[_0x591c('0xf2')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x591c('0xfe')]['belongsToMany'](db[_0x591c('0x1b')],{'as':_0x591c('0x119'),'through':'UserVoiceQueue','required':![]});db[_0x591c('0xfe')][_0x591c('0x113')](db[_0x591c('0x35')],{'as':_0x591c('0x11a'),'through':'UserMailQueue','required':![]});db[_0x591c('0xfe')]['belongsToMany'](db['ChatQueue'],{'as':_0x591c('0x11b'),'through':_0x591c('0x2b'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':_0x591c('0x2e'),'required':![]});db[_0x591c('0xfe')][_0x591c('0x113')](db[_0x591c('0x50')],{'as':_0x591c('0x11c'),'through':_0x591c('0x11d'),'required':![]});db[_0x591c('0xfe')][_0x591c('0x113')](db[_0x591c('0x56')],{'as':_0x591c('0x11e'),'through':_0x591c('0x11f'),'required':![]});db['User'][_0x591c('0x113')](db[_0x591c('0xf8')],{'as':_0x591c('0x120'),'through':_0x591c('0x30'),'required':![]});db['User'][_0x591c('0x113')](db[_0x591c('0x111')],{'through':'cm_user_has_lists'});db[_0x591c('0xfe')][_0x591c('0x113')](db[_0x591c('0xea')],{'as':_0x591c('0x121'),'through':_0x591c('0x122'),'required':![]});db[_0x591c('0xfe')][_0x591c('0x113')](db[_0x591c('0x58')],{'as':_0x591c('0x123'),'through':_0x591c('0x124')});db[_0x591c('0xfe')][_0x591c('0x113')](db['FaxAccount'],{'as':_0x591c('0x125'),'through':'user_has_fax_accounts'});db[_0x591c('0xfe')][_0x591c('0x113')](db[_0x591c('0x126')],{'as':_0x591c('0x127'),'through':_0x591c('0x128')});db[_0x591c('0xfe')][_0x591c('0x113')](db[_0x591c('0x129')],{'as':_0x591c('0x12a'),'through':'user_has_openchannel_accounts'});db[_0x591c('0xfe')][_0x591c('0x113')](db[_0x591c('0x12b')],{'as':'SmsAccounts','through':_0x591c('0x12c')});db[_0x591c('0xfe')]['belongsToMany'](db[_0x591c('0xf0')],{'as':_0x591c('0x12d'),'through':_0x591c('0x12e')});db[_0x591c('0xfe')]['belongsToMany'](db[_0x591c('0x12f')],{'as':'SquareProjects','through':_0x591c('0x130')});db['VoiceChanSpy'][_0x591c('0x100')](db[_0x591c('0x17')],{'as':'SpiedAgents','onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x132')});db['VoiceContext'][_0x591c('0x100')](db['VoiceExtension'],{'onDelete':'cascade'});db['VoiceExtension'][_0x591c('0x100')](db['VoiceExtension'],{'as':'Applications','onDelete':_0x591c('0x131')});db['VoiceMusicOnHold'][_0x591c('0x113')](db['Sound'],{'as':_0x591c('0x133'),'through':_0x591c('0x134')});db[_0x591c('0x1b')][_0x591c('0x100')](db[_0x591c('0x101')],{'as':'Members','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x591c('0x100')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x591c('0x135')});db['VoiceQueue'][_0x591c('0x100')](db[_0x591c('0x6b')],{'as':_0x591c('0x136'),'foreignKey':'VoiceQueueId'});db[_0x591c('0x1b')][_0x591c('0x100')](db[_0x591c('0x6d')],{'as':_0x591c('0x137'),'foreignKey':_0x591c('0x135')});db[_0x591c('0x1b')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x591c('0x135')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':_0x591c('0x138'),'foreignKey':_0x591c('0x135')});db[_0x591c('0x1b')][_0x591c('0x100')](db['JscriptySessionReport'],{'as':_0x591c('0x139'),'foreignKey':_0x591c('0x135')});db['VoiceQueue']['belongsTo'](db[_0x591c('0x28')],{'as':_0x591c('0x28'),'foreignKey':_0x591c('0x13a')});db['VoiceQueue'][_0x591c('0x10d')](db[_0x591c('0x28')],{'as':_0x591c('0x13b'),'foreignKey':'TrunkBackupId'});db[_0x591c('0x1b')]['belongsTo'](db[_0x591c('0x77')],{'as':_0x591c('0x77'),'foreignKey':_0x591c('0x13c')});db[_0x591c('0x1b')][_0x591c('0x10d')](db[_0x591c('0x79')],{'as':_0x591c('0x13d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x591c('0x1b')][_0x591c('0x113')](db['CmList'],{'as':'Lists','through':_0x591c('0x13e')});db[_0x591c('0x1b')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x13f'),'through':_0x591c('0x2a')});db[_0x591c('0x1b')][_0x591c('0x113')](db[_0x591c('0xdc')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x591c('0x1b')]['belongsToMany'](db[_0x591c('0x111')],{'as':_0x591c('0x140'),'through':_0x591c('0x141')});db['VoiceRecording'][_0x591c('0x10d')](db[_0x591c('0xfe')],{'as':_0x591c('0xfe'),'foreignKey':'UserId'});db['ScreenRecording']['belongsTo'](db[_0x591c('0xfe')],{'as':_0x591c('0xfe'),'foreignKey':_0x591c('0xff')});db[_0x591c('0x1e')][_0x591c('0x100')](db[_0x591c('0x20')],{'as':_0x591c('0x142'),'onDelete':'cascade','foreignKey':_0x591c('0x143'),'sourceKey':'mailbox'});db[_0x591c('0x20')][_0x591c('0x10d')](db[_0x591c('0x1e')],{'foreignKey':_0x591c('0x143'),'targetKey':_0x591c('0x144')});db[_0x591c('0x145')][_0x591c('0x100')](db[_0x591c('0x146')],{'as':_0x591c('0x147'),'foreignKey':_0x591c('0x148'),'constraints':![]});db['VoiceCallReport']['hasMany'](db['VoiceAgentReport'],{'as':_0x591c('0x149'),'foreignKey':'uniqueid','constraints':![]});db[_0x591c('0x145')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'as':_0x591c('0xfe'),'foreignKey':_0x591c('0xff')});db['VoiceCallReport'][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db[_0x591c('0x31')]['belongsTo'](db[_0x591c('0x126')],{'as':_0x591c('0x126'),'foreignKey':_0x591c('0x14c')});db[_0x591c('0x33')][_0x591c('0x10d')](db[_0x591c('0x126')],{'as':'MailAccount','foreignKey':_0x591c('0x14c')});db[_0x591c('0x126')]['hasOne'](db[_0x591c('0x31')],{'as':'Imap','onDelete':_0x591c('0x131')});db['MailAccount'][_0x591c('0x14d')](db[_0x591c('0x33')],{'as':_0x591c('0x14e'),'onDelete':'cascade'});db[_0x591c('0x126')][_0x591c('0x100')](db['Disposition'],{'as':_0x591c('0x14f'),'foreignKey':'MailAccountId','onDelete':_0x591c('0x131')});db[_0x591c('0x126')]['hasMany'](db[_0x591c('0x74')],{'as':_0x591c('0x150'),'foreignKey':_0x591c('0x14c')});db[_0x591c('0x126')]['hasMany'](db['MailMessage'],{'as':_0x591c('0x142'),'foreignKey':_0x591c('0x14c')});db[_0x591c('0x126')][_0x591c('0x100')](db['MailInteraction'],{'as':_0x591c('0x151')});db[_0x591c('0x126')][_0x591c('0x100')](db[_0x591c('0x152')],{'as':_0x591c('0x153')});db[_0x591c('0x126')][_0x591c('0x10d')](db['CmList'],{'as':_0x591c('0x154'),'foreignKey':'ListId'});db[_0x591c('0x126')][_0x591c('0x10d')](db[_0x591c('0x86')],{'as':'Template','foreignKey':_0x591c('0x155')});db[_0x591c('0x126')][_0x591c('0x10d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x591c('0x156')});db[_0x591c('0x126')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x591c('0x35')]['belongsToMany'](db[_0x591c('0xfe')],{'as':_0x591c('0x13f'),'through':_0x591c('0x157')});db['MailQueue'][_0x591c('0x113')](db[_0x591c('0xdc')],{'through':_0x591c('0x158'),'as':_0x591c('0x159')});db[_0x591c('0x38')][_0x591c('0x100')](db[_0x591c('0x3a')],{'as':_0x591c('0x142'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x15a')});db[_0x591c('0x38')][_0x591c('0x10d')](db[_0x591c('0x126')],{'as':_0x591c('0x15b'),'foreignKey':_0x591c('0x14c')});db[_0x591c('0x38')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':'Contact','foreignKey':_0x591c('0x14b')});db[_0x591c('0x38')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'as':_0x591c('0x15c'),'foreignKey':_0x591c('0xff')});db[_0x591c('0x38')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x15d'),'as':'Tags'});db[_0x591c('0x38')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x15d'),'as':_0x591c('0x15e')});db[_0x591c('0x38')][_0x591c('0x113')](db['User'],{'as':_0x591c('0x15f'),'through':_0x591c('0x114'),'foreignKey':_0x591c('0x15a')});db['MailMessage']['hasMany'](db[_0x591c('0xe1')],{'as':_0x591c('0x160'),'onDelete':_0x591c('0x131')});db[_0x591c('0x3a')][_0x591c('0x10d')](db['User'],{'as':'User'});db[_0x591c('0x3a')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'onDelete':_0x591c('0x131'),'as':_0x591c('0x14a')});db[_0x591c('0x3a')][_0x591c('0x10d')](db[_0x591c('0x38')],{'as':_0x591c('0x161'),'foreignKey':'MailInteractionId'});db[_0x591c('0x3a')]['belongsTo'](db[_0x591c('0x126')],{'as':_0x591c('0x15b'),'foreignKey':_0x591c('0x14c')});db['MailMessage']['belongsTo'](db[_0x591c('0x58')],{'as':'ChatWebsite','foreignKey':_0x591c('0x162')});db[_0x591c('0x3a')][_0x591c('0x10d')](db[_0x591c('0x163')],{'as':'ChatOfflineMessage','foreignKey':_0x591c('0x164')});db[_0x591c('0x152')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'onDelete':'restrict'});db[_0x591c('0x152')][_0x591c('0x10d')](db[_0x591c('0x35')],{'onDelete':'restrict'});db[_0x591c('0x152')][_0x591c('0x10d')](db[_0x591c('0x126')],{'onDelete':_0x591c('0x165')});db[_0x591c('0x152')][_0x591c('0x10d')](db[_0x591c('0x77')],{'onDelete':'restrict','foreignKey':_0x591c('0x13c')});db[_0x591c('0x152')][_0x591c('0x10d')](db[_0x591c('0x81')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x591c('0x3d')][_0x591c('0x10d')](db[_0x591c('0x126')],{});db[_0x591c('0x3d')][_0x591c('0x10d')](db[_0x591c('0x111')],{'as':_0x591c('0x154'),'foreignKey':_0x591c('0x166')});db[_0x591c('0x3d')][_0x591c('0x10d')](db['CmContact'],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db[_0x591c('0x3d')]['belongsTo'](db[_0x591c('0x38')],{});db[_0x591c('0x3d')]['belongsTo'](db[_0x591c('0x3a')],{});db[_0x591c('0x3d')][_0x591c('0x10d')](db[_0x591c('0xfe')],{});db[_0x591c('0x3d')][_0x591c('0x10d')](db[_0x591c('0x35')],{});db['Dashboard'][_0x591c('0x100')](db[_0x591c('0x40')],{'as':_0x591c('0x167'),'onDelete':_0x591c('0x131')});db[_0x591c('0x42')][_0x591c('0x100')](db[_0x591c('0x168')],{'as':_0x591c('0x14f'),'foreignKey':_0x591c('0x169'),'onDelete':_0x591c('0x131')});db[_0x591c('0x42')][_0x591c('0x100')](db[_0x591c('0x74')],{'as':_0x591c('0x150'),'foreignKey':'FaxAccountId'});db[_0x591c('0x42')]['hasMany'](db[_0x591c('0x107')],{'as':'Interactions'});db[_0x591c('0x42')][_0x591c('0x100')](db[_0x591c('0x44')],{'as':_0x591c('0x153')});db['FaxAccount'][_0x591c('0x100')](db[_0x591c('0x17')],{'as':_0x591c('0x16a'),'onDelete':_0x591c('0x131')});db[_0x591c('0x42')][_0x591c('0x100')](db[_0x591c('0x47')],{'as':'Messages'});db[_0x591c('0x42')][_0x591c('0x10d')](db['Trunk'],{'as':_0x591c('0x28')});db[_0x591c('0x42')][_0x591c('0x10d')](db[_0x591c('0x111')],{'as':_0x591c('0x154'),'foreignKey':_0x591c('0x166')});db['FaxAccount'][_0x591c('0x10d')](db[_0x591c('0x79')],{'as':_0x591c('0x13d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x591c('0x42')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x13f'),'through':_0x591c('0x16b')});db[_0x591c('0x44')]['belongsTo'](db[_0x591c('0xfe')],{'onDelete':_0x591c('0x165')});db[_0x591c('0x44')]['belongsTo'](db[_0x591c('0x16c')],{'onDelete':_0x591c('0x165')});db[_0x591c('0x44')][_0x591c('0x10d')](db[_0x591c('0x42')],{'onDelete':_0x591c('0x165')});db[_0x591c('0x44')][_0x591c('0x10d')](db[_0x591c('0x81')],{'onDelete':_0x591c('0x165'),'foreignKey':_0x591c('0x16d')});db[_0x591c('0x107')][_0x591c('0x100')](db[_0x591c('0x47')],{'as':_0x591c('0x142'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0x591c('0x107')][_0x591c('0x10d')](db[_0x591c('0x42')],{'as':_0x591c('0x15b'),'foreignKey':_0x591c('0x169')});db['FaxInteraction']['belongsTo'](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db[_0x591c('0x107')][_0x591c('0x10d')](db['User'],{'as':_0x591c('0x15c'),'foreignKey':_0x591c('0xff')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x591c('0x107')]['belongsToMany'](db[_0x591c('0x81')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x591c('0x107')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x15f'),'through':_0x591c('0x116'),'foreignKey':_0x591c('0x16e')});db['FaxMessage'][_0x591c('0x10d')](db[_0x591c('0xfe')],{'onDelete':_0x591c('0x131'),'as':_0x591c('0xfe')});db[_0x591c('0x47')]['belongsTo'](db[_0x591c('0x107')],{'as':_0x591c('0x161'),'foreignKey':'FaxInteractionId'});db[_0x591c('0x47')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'onDelete':_0x591c('0x131'),'as':_0x591c('0x14a')});db[_0x591c('0x47')][_0x591c('0x10d')](db[_0x591c('0xe1')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x591c('0x47')]['belongsTo'](db[_0x591c('0x42')],{'as':_0x591c('0x15b'),'foreignKey':_0x591c('0x169')});db[_0x591c('0x16c')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x13f'),'through':_0x591c('0x2e')});db['FaxQueue'][_0x591c('0x113')](db[_0x591c('0xdc')],{'through':_0x591c('0x16f'),'as':_0x591c('0x159')});db['FaxQueueReport'][_0x591c('0x10d')](db[_0x591c('0x42')],{});db[_0x591c('0x4a')][_0x591c('0x10d')](db[_0x591c('0x111')],{'as':'List','foreignKey':_0x591c('0x166')});db[_0x591c('0x4a')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':'ContactId'});db[_0x591c('0x4a')][_0x591c('0x10d')](db[_0x591c('0x107')],{});db[_0x591c('0x4a')][_0x591c('0x10d')](db[_0x591c('0x47')],{});db[_0x591c('0x4a')][_0x591c('0x10d')](db[_0x591c('0xfe')],{});db[_0x591c('0x4a')][_0x591c('0x10d')](db[_0x591c('0x16c')],{});db[_0x591c('0x12b')][_0x591c('0x100')](db[_0x591c('0x168')],{'as':_0x591c('0x14f'),'foreignKey':_0x591c('0x170'),'onDelete':'cascade'});db[_0x591c('0x12b')][_0x591c('0x100')](db[_0x591c('0x74')],{'as':_0x591c('0x150'),'foreignKey':_0x591c('0x170')});db[_0x591c('0x12b')]['hasMany'](db['SmsMessage'],{'as':'Messages','foreignKey':_0x591c('0x170')});db[_0x591c('0x12b')][_0x591c('0x100')](db[_0x591c('0x4c')],{'as':'Interactions'});db[_0x591c('0x12b')][_0x591c('0x100')](db['SmsApplication'],{'as':_0x591c('0x153')});db[_0x591c('0x12b')][_0x591c('0x10d')](db[_0x591c('0x111')],{'as':_0x591c('0x154'),'foreignKey':_0x591c('0x166')});db[_0x591c('0x12b')][_0x591c('0x10d')](db[_0x591c('0x79')],{'as':_0x591c('0x13d'),'foreignKey':_0x591c('0x156')});db[_0x591c('0x12b')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x13f'),'through':'user_has_sms_accounts'});db[_0x591c('0x171')][_0x591c('0x10d')](db['User'],{'onDelete':_0x591c('0x165')});db[_0x591c('0x171')][_0x591c('0x10d')](db['SmsQueue'],{'onDelete':_0x591c('0x165')});db[_0x591c('0x171')]['belongsTo'](db[_0x591c('0x12b')],{'onDelete':'restrict'});db[_0x591c('0x171')][_0x591c('0x10d')](db[_0x591c('0x77')],{'onDelete':_0x591c('0x165'),'foreignKey':_0x591c('0x13c')});db[_0x591c('0x171')][_0x591c('0x10d')](db[_0x591c('0x81')],{'onDelete':_0x591c('0x165'),'foreignKey':_0x591c('0x16d')});db['SmsInteraction'][_0x591c('0x100')](db[_0x591c('0x4e')],{'as':_0x591c('0x142'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x172')});db['SmsInteraction'][_0x591c('0x10d')](db[_0x591c('0x12b')],{'as':_0x591c('0x15b'),'foreignKey':_0x591c('0x170')});db['SmsInteraction'][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db[_0x591c('0x4c')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'as':_0x591c('0x15c'),'foreignKey':_0x591c('0xff')});db[_0x591c('0x4c')]['belongsToMany'](db[_0x591c('0x81')],{'through':_0x591c('0x173'),'as':'Tags'});db[_0x591c('0x4c')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x173'),'as':_0x591c('0x15e')});db[_0x591c('0x4c')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':'Users','through':_0x591c('0x117'),'foreignKey':_0x591c('0x172')});db[_0x591c('0x4e')]['belongsTo'](db[_0x591c('0xfe')],{'as':_0x591c('0xfe')});db[_0x591c('0x4e')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'onDelete':'cascade','as':_0x591c('0x14a')});db[_0x591c('0x4e')][_0x591c('0x10d')](db[_0x591c('0x4c')],{'onDelete':_0x591c('0x131'),'as':_0x591c('0x161'),'foreignKey':'SmsInteractionId'});db[_0x591c('0x4e')][_0x591c('0x10d')](db[_0x591c('0x12b')],{'as':_0x591c('0x15b'),'foreignKey':'SmsAccountId'});db[_0x591c('0x50')]['belongsToMany'](db[_0x591c('0xfe')],{'as':'Agents','through':_0x591c('0x11d'),'foreignKey':_0x591c('0x174')});db[_0x591c('0x50')][_0x591c('0x113')](db[_0x591c('0xdc')],{'through':_0x591c('0x175'),'as':_0x591c('0x159')});db['OpenchannelAccount'][_0x591c('0x100')](db['Disposition'],{'as':_0x591c('0x14f'),'foreignKey':'OpenchannelAccountId','onDelete':_0x591c('0x131')});db['OpenchannelAccount'][_0x591c('0x100')](db[_0x591c('0x74')],{'as':'Answers','foreignKey':_0x591c('0x176')});db[_0x591c('0x129')][_0x591c('0x100')](db['OpenchannelInteraction'],{'as':_0x591c('0x151'),'foreignKey':_0x591c('0x176')});db[_0x591c('0x129')]['hasMany'](db[_0x591c('0x54')],{'as':_0x591c('0x142'),'foreignKey':_0x591c('0x176')});db['OpenchannelAccount']['hasMany'](db[_0x591c('0x51')],{'as':_0x591c('0x153'),'foreignKey':_0x591c('0x176')});db[_0x591c('0x129')][_0x591c('0x10d')](db[_0x591c('0x111')],{'as':'List','foreignKey':_0x591c('0x166')});db[_0x591c('0x129')][_0x591c('0x10d')](db[_0x591c('0x79')],{'as':'mandatoryDispositionPause','foreignKey':_0x591c('0x156')});db[_0x591c('0x129')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x13f'),'through':_0x591c('0x177')});db[_0x591c('0x51')][_0x591c('0x10d')](db['User'],{'onDelete':_0x591c('0x165')});db[_0x591c('0x51')][_0x591c('0x10d')](db[_0x591c('0x56')],{'onDelete':'restrict','foreignKey':_0x591c('0x178')});db[_0x591c('0x51')][_0x591c('0x10d')](db[_0x591c('0x129')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x591c('0x51')][_0x591c('0x10d')](db[_0x591c('0x77')],{'onDelete':'restrict','foreignKey':_0x591c('0x13c')});db[_0x591c('0x51')][_0x591c('0x10d')](db[_0x591c('0x81')],{'onDelete':_0x591c('0x165'),'foreignKey':_0x591c('0x16d')});db[_0x591c('0x53')]['hasMany'](db['OpenchannelMessage'],{'as':_0x591c('0x142'),'onDelete':_0x591c('0x131'),'foreignKey':'OpenchannelInteractionId'});db[_0x591c('0x53')]['belongsTo'](db[_0x591c('0x129')],{'as':'Account','foreignKey':_0x591c('0x176')});db[_0x591c('0x53')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db[_0x591c('0x53')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'as':_0x591c('0x15c'),'foreignKey':'UserId'});db[_0x591c('0x53')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x179'),'as':'Tags'});db[_0x591c('0x53')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x179'),'as':_0x591c('0x15e')});db[_0x591c('0x53')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x15f'),'through':'user_has_openchannel_interactions','foreignKey':_0x591c('0x17a')});db[_0x591c('0x54')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'onDelete':_0x591c('0x131'),'as':'User'});db['OpenchannelMessage'][_0x591c('0x10d')](db[_0x591c('0x10f')],{'onDelete':'cascade','as':_0x591c('0x14a')});db[_0x591c('0x54')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x591c('0x131'),'as':_0x591c('0x161'),'foreignKey':_0x591c('0x17a')});db['OpenchannelMessage'][_0x591c('0x10d')](db[_0x591c('0xe1')],{'as':'Attachment','foreignKey':_0x591c('0x17b')});db['OpenchannelMessage'][_0x591c('0x10d')](db['OpenchannelAccount'],{'as':_0x591c('0x15b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x13f'),'through':_0x591c('0x11f'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':_0x591c('0x17c'),'as':'Teams'});db['ChatWebsite']['hasMany'](db[_0x591c('0x168')],{'as':'Dispositions','foreignKey':_0x591c('0x162'),'onDelete':_0x591c('0x131')});db[_0x591c('0x58')][_0x591c('0x100')](db[_0x591c('0x74')],{'as':_0x591c('0x150'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x591c('0x100')](db[_0x591c('0x64')],{'as':_0x591c('0x17d')});db['ChatWebsite'][_0x591c('0x100')](db[_0x591c('0x104')],{'as':_0x591c('0x151')});db['ChatWebsite'][_0x591c('0x100')](db['ChatApplication'],{'as':_0x591c('0x153')});db[_0x591c('0x58')][_0x591c('0x100')](db[_0x591c('0x17e')],{'as':'Messages'});db['ChatWebsite'][_0x591c('0x10d')](db[_0x591c('0x111')],{'as':_0x591c('0x154'),'foreignKey':_0x591c('0x166')});db['ChatWebsite'][_0x591c('0x10d')](db[_0x591c('0x77')],{'as':_0x591c('0x77'),'foreignKey':'IntervalId'});db[_0x591c('0x58')][_0x591c('0x10d')](db[_0x591c('0x126')],{'as':_0x591c('0x126'),'foreignKey':_0x591c('0x14c')});db[_0x591c('0x58')][_0x591c('0x10d')](db[_0x591c('0x79')],{'as':_0x591c('0x13d'),'foreignKey':_0x591c('0x156')});db[_0x591c('0x58')][_0x591c('0x113')](db['User'],{'as':_0x591c('0x13f'),'through':_0x591c('0x124')});db[_0x591c('0x5a')][_0x591c('0x10d')](db['OpenchannelAccount'],{});db[_0x591c('0x5a')][_0x591c('0x10d')](db[_0x591c('0x111')],{'as':_0x591c('0x154'),'foreignKey':_0x591c('0x166')});db[_0x591c('0x5a')][_0x591c('0x10d')](db['CmContact'],{'as':_0x591c('0x14a'),'foreignKey':'ContactId'});db[_0x591c('0x5a')]['belongsTo'](db[_0x591c('0x53')],{});db[_0x591c('0x5a')][_0x591c('0x10d')](db[_0x591c('0x54')],{});db['OpenchannelQueueReport'][_0x591c('0x10d')](db[_0x591c('0xfe')],{});db['OpenchannelQueueReport'][_0x591c('0x10d')](db[_0x591c('0x56')],{});db[_0x591c('0x5c')]['belongsTo'](db[_0x591c('0xfe')],{'as':_0x591c('0x17f'),'foreignKey':_0x591c('0xff'),'onDelete':_0x591c('0x165')});db[_0x591c('0x5c')][_0x591c('0x10d')](db['ChatQueue'],{'as':_0x591c('0x180'),'foreignKey':_0x591c('0x181'),'onDelete':_0x591c('0x165')});db[_0x591c('0x5c')][_0x591c('0x10d')](db[_0x591c('0x58')],{'as':_0x591c('0x182'),'foreignKey':_0x591c('0x162'),'onDelete':_0x591c('0x165')});db[_0x591c('0x5c')][_0x591c('0x10d')](db[_0x591c('0x81')],{'onDelete':'restrict','foreignKey':_0x591c('0x16d')});db[_0x591c('0x104')][_0x591c('0x100')](db[_0x591c('0x17e')],{'as':_0x591c('0x142'),'onDelete':_0x591c('0x131'),'foreignKey':'ChatInteractionId'});db[_0x591c('0x104')]['belongsTo'](db[_0x591c('0x58')],{'as':_0x591c('0x15b'),'foreignKey':'ChatWebsiteId'});db[_0x591c('0x104')][_0x591c('0x10d')](db['CmContact'],{'as':_0x591c('0x14a'),'foreignKey':'ContactId'});db[_0x591c('0x104')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'as':'Owner','foreignKey':_0x591c('0xff')});db[_0x591c('0x104')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x183'),'as':_0x591c('0x184')});db['ChatInteraction'][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x183'),'as':_0x591c('0x15e')});db[_0x591c('0x104')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x15f'),'through':'user_has_chat_interactions','foreignKey':_0x591c('0x185')});db[_0x591c('0x17e')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x591c('0xfe')});db[_0x591c('0x17e')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'onDelete':_0x591c('0x131'),'as':'Contact','foreignKey':'ContactId'});db[_0x591c('0x17e')][_0x591c('0x10d')](db[_0x591c('0x104')],{'onDelete':_0x591c('0x131'),'as':_0x591c('0x161'),'foreignKey':_0x591c('0x185')});db[_0x591c('0x17e')][_0x591c('0x10d')](db[_0x591c('0xe1')],{'as':'Attachment','foreignKey':_0x591c('0x17b')});db[_0x591c('0x17e')][_0x591c('0x10d')](db[_0x591c('0x58')],{'as':_0x591c('0x15b'),'foreignKey':_0x591c('0x162')});db[_0x591c('0x163')]['hasMany'](db[_0x591c('0xe1')],{'as':'Attachments','foreignKey':_0x591c('0x164'),'onDelete':_0x591c('0x131'),'hooks':!![]});db[_0x591c('0x163')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'onDelete':_0x591c('0x131'),'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db['ChatOfflineMessage'][_0x591c('0x10d')](db[_0x591c('0x58')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x591c('0x60')][_0x591c('0x113')](db['User'],{'as':_0x591c('0x13f'),'through':_0x591c('0x2b'),'hooks':!![]});db[_0x591c('0x60')][_0x591c('0x113')](db[_0x591c('0xdc')],{'through':_0x591c('0x186'),'as':_0x591c('0x159')});db[_0x591c('0x62')][_0x591c('0x100')](db[_0x591c('0x187')],{'as':'Messages','foreignKey':_0x591c('0x188'),'onDelete':_0x591c('0x131')});db[_0x591c('0x62')][_0x591c('0x113')](db['User'],{'as':_0x591c('0x189'),'through':_0x591c('0x10e')});db[_0x591c('0x64')][_0x591c('0x10d')](db['ChatWebsite'],{'as':_0x591c('0x182'),'foreignKey':_0x591c('0x162')});db[_0x591c('0x66')][_0x591c('0x100')](db['CmContact'],{'as':_0x591c('0x18a'),'foreignKey':_0x591c('0x18b')});db[_0x591c('0x10f')][_0x591c('0x100')](db['CmContactHasItem'],{'as':'Phones','foreignKey':'CmContactId'});db['CmContact']['hasMany'](db[_0x591c('0x18c')],{'as':_0x591c('0x18d'),'foreignKey':'ContactId'});db[_0x591c('0x10f')]['hasMany'](db[_0x591c('0x6b')],{'as':'HopperFinals','foreignKey':_0x591c('0x14b')});db[_0x591c('0x10f')]['hasMany'](db[_0x591c('0x6d')],{'as':_0x591c('0x137'),'foreignKey':_0x591c('0x14b')});db[_0x591c('0x10f')]['hasMany'](db[_0x591c('0x6f')],{'as':_0x591c('0x6f'),'foreignKey':'ContactId'});db[_0x591c('0x10f')]['hasMany'](db[_0x591c('0xcf')],{'as':_0x591c('0x139'),'foreignKey':_0x591c('0x14b')});db[_0x591c('0x10f')][_0x591c('0x100')](db[_0x591c('0x53')],{'as':'OpenchannelInteractions','foreignKey':_0x591c('0x14b'),'onDelete':_0x591c('0x165')});db[_0x591c('0x10f')]['hasMany'](db[_0x591c('0x104')],{'as':_0x591c('0x105'),'foreignKey':_0x591c('0x14b'),'onDelete':'restrict'});db[_0x591c('0x10f')][_0x591c('0x100')](db[_0x591c('0x4c')],{'as':_0x591c('0x106'),'foreignKey':_0x591c('0x14b'),'onDelete':_0x591c('0x165')});db[_0x591c('0x10f')]['hasMany'](db[_0x591c('0x107')],{'as':'FaxInteractions','foreignKey':_0x591c('0x14b'),'onDelete':_0x591c('0x165')});db['CmContact'][_0x591c('0x100')](db[_0x591c('0x38')],{'as':_0x591c('0x109'),'foreignKey':_0x591c('0x14b'),'onDelete':_0x591c('0x165')});db[_0x591c('0x10f')][_0x591c('0x10d')](db[_0x591c('0x66')],{'as':'Company','foreignKey':_0x591c('0x18b')});db[_0x591c('0x10f')]['belongsTo'](db[_0x591c('0x111')],{'as':_0x591c('0x154'),'foreignKey':_0x591c('0x166'),'onDelete':_0x591c('0x131')});db[_0x591c('0x10f')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x15f'),'through':_0x591c('0x110')});db[_0x591c('0x10f')][_0x591c('0x113')](db[_0x591c('0x81')],{'as':_0x591c('0x184'),'through':'cm_contact_has_tags'});db[_0x591c('0x10f')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x18e'),'as':'ThroughTags'});db['CmHopper'][_0x591c('0x100')](db[_0x591c('0x85')],{'as':_0x591c('0x18f'),'foreignKey':_0x591c('0x190')});db['CmHopper'][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopper'][_0x591c('0x10d')](db['CmList'],{'as':'List','foreignKey':_0x591c('0x166'),'onDelete':_0x591c('0x131')});db['CmHopper'][_0x591c('0x10d')](db[_0x591c('0xfe')],{'as':_0x591c('0x17f'),'foreignKey':_0x591c('0xff')});db[_0x591c('0x18c')][_0x591c('0x10d')](db['VoiceQueue'],{'as':_0x591c('0x180'),'foreignKey':_0x591c('0x135'),'onDelete':_0x591c('0x131')});db[_0x591c('0x18c')][_0x591c('0x10d')](db['Campaign'],{'as':_0x591c('0x191'),'foreignKey':_0x591c('0x192'),'onDelete':_0x591c('0x131')});db[_0x591c('0x18c')]['belongsTo'](db[_0x591c('0xfe')],{'as':_0x591c('0x15c'),'foreignKey':_0x591c('0x193')});db[_0x591c('0x69')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b'),'onDelete':'cascade'});db[_0x591c('0x69')][_0x591c('0x10d')](db[_0x591c('0x111')],{'as':_0x591c('0x154'),'foreignKey':_0x591c('0x166'),'onDelete':_0x591c('0x131')});db[_0x591c('0x69')][_0x591c('0x10d')](db[_0x591c('0x1b')],{'as':_0x591c('0x180'),'foreignKey':_0x591c('0x135'),'onDelete':_0x591c('0x131')});db[_0x591c('0x69')][_0x591c('0x10d')](db[_0x591c('0x191')],{'as':'Campaign','foreignKey':_0x591c('0x192'),'onDelete':_0x591c('0x131')});db['Automation'][_0x591c('0x100')](db[_0x591c('0x194')],{'as':{'plural':_0x591c('0x195'),'singular':_0x591c('0x196')},'foreignKey':_0x591c('0x197'),'onDelete':_0x591c('0x131'),'hooks':!![]});db[_0x591c('0x73')][_0x591c('0x100')](db[_0x591c('0x194')],{'as':{'plural':_0x591c('0x198'),'singular':_0x591c('0x199')},'foreignKey':_0x591c('0x19a'),'onDelete':_0x591c('0x131'),'hooks':!![]});db[_0x591c('0x73')][_0x591c('0x100')](db['Action'],{'as':'Actions','foreignKey':_0x591c('0x19b'),'onDelete':_0x591c('0x131'),'hooks':!![]});db[_0x591c('0x168')][_0x591c('0x100')](db[_0x591c('0x168')],{'as':'Dispositions','foreignKey':_0x591c('0x19c'),'onDelete':'cascade'});db['Interval'][_0x591c('0x100')](db[_0x591c('0x77')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x591c('0x131'),'hooks':!![],'required':![]});db['Interval'][_0x591c('0x100')](db[_0x591c('0x17')],{'as':_0x591c('0x103'),'foreignKey':_0x591c('0x13c'),'onDelete':_0x591c('0x165')});db[_0x591c('0x77')]['hasMany'](db['MailApplication'],{'as':_0x591c('0x19d'),'foreignKey':_0x591c('0x13c')});db[_0x591c('0x77')]['hasMany'](db[_0x591c('0x5c')],{'as':_0x591c('0x19e'),'foreignKey':'IntervalId'});db[_0x591c('0x77')][_0x591c('0x100')](db[_0x591c('0x44')],{'as':_0x591c('0x19f'),'foreignKey':_0x591c('0x13c')});db['Interval'][_0x591c('0x100')](db[_0x591c('0x171')],{'as':'SmsApplications','foreignKey':_0x591c('0x13c')});db[_0x591c('0x1a0')][_0x591c('0x10d')](db[_0x591c('0x126')],{});db[_0x591c('0x1a0')][_0x591c('0x10d')](db[_0x591c('0x1a1')],{'foreignKey':_0x591c('0x1a2')});db[_0x591c('0x1a0')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x591c('0x1a3')});db[_0x591c('0x1a4')][_0x591c('0x113')](db[_0x591c('0x19')],{'as':_0x591c('0x1a5'),'through':_0x591c('0x134'),'onDelete':_0x591c('0x165')});db[_0x591c('0x81')]['belongsToMany'](db[_0x591c('0x10f')],{'through':'cm_contact_has_tags'});db[_0x591c('0x81')][_0x591c('0x113')](db[_0x591c('0x104')],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':_0x591c('0x15d')});db[_0x591c('0x81')][_0x591c('0x113')](db[_0x591c('0x4c')],{'through':_0x591c('0x173')});db[_0x591c('0x81')][_0x591c('0x113')](db[_0x591c('0x107')],{'through':'fax_interaction_has_tags'});db[_0x591c('0x81')][_0x591c('0x113')](db[_0x591c('0x53')],{'through':_0x591c('0x179')});db['Tag'][_0x591c('0x113')](db[_0x591c('0xf2')],{'through':'whatsapp_interaction_has_tags'});db[_0x591c('0x83')]['belongsTo'](db[_0x591c('0x82')],{'as':_0x591c('0x1a6'),'foreignKey':_0x591c('0x1a7')});db[_0x591c('0x85')][_0x591c('0x10d')](db[_0x591c('0x18c')],{'as':_0x591c('0x1a8'),'foreignKey':_0x591c('0x190')});db[_0x591c('0x87')][_0x591c('0x100')](db['Condition'],{'as':{'plural':_0x591c('0x1a9'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x591c('0x131'),'hooks':!![]});db[_0x591c('0x87')]['hasMany'](db[_0x591c('0x194')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x591c('0x1aa'),'onDelete':_0x591c('0x131'),'hooks':!![]});db[_0x591c('0x87')][_0x591c('0x100')](db[_0x591c('0x72')],{'as':_0x591c('0x1ab'),'foreignKey':_0x591c('0x1ac'),'onDelete':_0x591c('0x131'),'hooks':!![]});db[_0x591c('0x8c')][_0x591c('0x100')](db[_0x591c('0x93')],{'as':_0x591c('0x1ad'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x591c('0x93')],{'as':'Fields','onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1a2')});db[_0x591c('0x91')][_0x591c('0x100')](db[_0x591c('0x93')],{'as':'Fields','onDelete':_0x591c('0x131'),'foreignKey':'MetricId'});db[_0x591c('0x93')][_0x591c('0x10d')](db[_0x591c('0x91')],{'foreignKey':_0x591c('0x1ae')});db[_0x591c('0x96')][_0x591c('0x100')](db[_0x591c('0x97')],{'as':'Configurations','onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1af')});db[_0x591c('0x97')][_0x591c('0x100')](db[_0x591c('0x99')],{'as':_0x591c('0x1b0'),'onDelete':_0x591c('0x131'),'foreignKey':'SubjectId'});db['SalesforceConfiguration']['hasMany'](db[_0x591c('0x99')],{'as':_0x591c('0x1b1'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0x97')][_0x591c('0x100')](db['SalesforceField'],{'as':_0x591c('0x1ad'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0x97')][_0x591c('0x10d')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x591c('0x1af')});db[_0x591c('0x99')]['hasMany'](db[_0x591c('0x99')],{'as':'Subject','foreignKey':_0x591c('0x1b4')});db['SalesforceField'][_0x591c('0x100')](db[_0x591c('0x99')],{'as':_0x591c('0x1b5'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0x99')][_0x591c('0x100')](db[_0x591c('0x99')],{'as':_0x591c('0x1b6'),'foreignKey':'FieldId'});db[_0x591c('0x99')][_0x591c('0x10d')](db[_0x591c('0x89')],{'as':_0x591c('0x89'),'foreignKey':'VariableId'});db[_0x591c('0x9b')]['hasMany'](db[_0x591c('0x9d')],{'as':_0x591c('0x1b7'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1af')});db['SugarcrmConfiguration'][_0x591c('0x100')](db[_0x591c('0x9f')],{'as':'Subjects','onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0x9d')][_0x591c('0x100')](db[_0x591c('0x9f')],{'as':_0x591c('0x1b1'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0x9d')]['hasMany'](db[_0x591c('0x9f')],{'as':_0x591c('0x1ad'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x591c('0x9d')][_0x591c('0x10d')](db[_0x591c('0x9b')],{'as':_0x591c('0x15b'),'foreignKey':'AccountId'});db[_0x591c('0x9f')]['hasMany'](db[_0x591c('0x9f')],{'as':'Subject','foreignKey':_0x591c('0x1b4')});db['SugarcrmField'][_0x591c('0x100')](db['SugarcrmField'],{'as':_0x591c('0x1b5'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0x9f')][_0x591c('0x100')](db[_0x591c('0x9f')],{'as':_0x591c('0x1b6'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0x9f')][_0x591c('0x10d')](db[_0x591c('0x89')],{'as':_0x591c('0x89'),'foreignKey':_0x591c('0x1b8')});db['DeskAccount'][_0x591c('0x100')](db[_0x591c('0x1b9')],{'as':_0x591c('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration']['hasMany'](db[_0x591c('0xa3')],{'as':_0x591c('0x1b0'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0x1b9')]['hasMany'](db[_0x591c('0xa3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x591c('0x1b9')]['hasMany'](db[_0x591c('0xa3')],{'as':'Fields','onDelete':_0x591c('0x131'),'foreignKey':'FieldId'});db[_0x591c('0x1b9')]['belongsTo'](db[_0x591c('0xa0')],{'as':'Account','foreignKey':'AccountId'});db[_0x591c('0x1b9')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x1ba')});db[_0x591c('0xa3')][_0x591c('0x100')](db[_0x591c('0xa3')],{'as':_0x591c('0x1bb'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0xa3')][_0x591c('0x100')](db[_0x591c('0xa3')],{'as':_0x591c('0x1b5'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0xa3')][_0x591c('0x100')](db['DeskField'],{'as':_0x591c('0x1b6'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0xa3')][_0x591c('0x10d')](db['Variable'],{'as':_0x591c('0x89'),'foreignKey':_0x591c('0x1b8')});db[_0x591c('0xa4')][_0x591c('0x100')](db[_0x591c('0xa6')],{'as':_0x591c('0x1b7'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1af')});db[_0x591c('0xa6')][_0x591c('0x100')](db[_0x591c('0xa8')],{'as':_0x591c('0x1b0'),'onDelete':'cascade','foreignKey':_0x591c('0x1b4')});db['ZohoConfiguration'][_0x591c('0x100')](db[_0x591c('0xa8')],{'as':'Descriptions','onDelete':_0x591c('0x131'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x591c('0x100')](db[_0x591c('0xa8')],{'as':_0x591c('0x1ad'),'onDelete':_0x591c('0x131'),'foreignKey':'FieldId'});db[_0x591c('0xa6')]['belongsTo'](db[_0x591c('0xa4')],{'as':'Account','foreignKey':_0x591c('0x1af')});db[_0x591c('0xa8')][_0x591c('0x100')](db[_0x591c('0xa8')],{'as':_0x591c('0x1bb'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0xa8')][_0x591c('0x100')](db[_0x591c('0xa8')],{'as':_0x591c('0x1b5'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0xa8')][_0x591c('0x100')](db['ZohoField'],{'as':_0x591c('0x1b6'),'foreignKey':_0x591c('0x1b3')});db['ZohoField'][_0x591c('0x10d')](db[_0x591c('0x89')],{'as':_0x591c('0x89'),'foreignKey':_0x591c('0x1b8')});db[_0x591c('0xa9')][_0x591c('0x100')](db[_0x591c('0x1bc')],{'as':_0x591c('0x1b7'),'onDelete':'cascade','foreignKey':_0x591c('0x1af')});db[_0x591c('0x1bc')][_0x591c('0x100')](db['ZendeskField'],{'as':_0x591c('0x1b0'),'foreignKey':'SubjectId'});db['ZendeskConfiguration']['hasMany'](db[_0x591c('0xab')],{'as':_0x591c('0x1b1'),'foreignKey':_0x591c('0x1b2')});db['ZendeskConfiguration'][_0x591c('0x100')](db[_0x591c('0xab')],{'as':_0x591c('0x1ad'),'foreignKey':'FieldId'});db[_0x591c('0x1bc')][_0x591c('0x10d')](db['ZendeskAccount'],{'as':_0x591c('0x15b'),'foreignKey':_0x591c('0x1af')});db[_0x591c('0x1bc')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x1bd')});db[_0x591c('0xab')][_0x591c('0x100')](db[_0x591c('0xab')],{'as':_0x591c('0x1bb'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0xab')][_0x591c('0x100')](db[_0x591c('0xab')],{'as':_0x591c('0x1b5'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0xab')][_0x591c('0x100')](db['ZendeskField'],{'as':'Field','foreignKey':_0x591c('0x1b3')});db[_0x591c('0xab')][_0x591c('0x10d')](db['Variable'],{'as':_0x591c('0x89'),'foreignKey':_0x591c('0x1b8')});db[_0x591c('0xad')][_0x591c('0x100')](db[_0x591c('0x1be')],{'as':_0x591c('0x1b7'),'onDelete':'cascade','foreignKey':_0x591c('0x1af')});db['FreshdeskConfiguration'][_0x591c('0x100')](db[_0x591c('0x1bf')],{'as':_0x591c('0x1b0'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0x1be')][_0x591c('0x100')](db[_0x591c('0x1bf')],{'as':_0x591c('0x1b1'),'onDelete':'cascade','foreignKey':_0x591c('0x1b2')});db[_0x591c('0x1be')][_0x591c('0x100')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0x1be')][_0x591c('0x10d')](db[_0x591c('0xad')],{'as':'Account','foreignKey':_0x591c('0x1af')});db[_0x591c('0x1be')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x1c0')});db[_0x591c('0x1bf')]['hasMany'](db[_0x591c('0x1bf')],{'as':_0x591c('0x1bb'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0x1bf')][_0x591c('0x100')](db[_0x591c('0x1bf')],{'as':_0x591c('0x1b5'),'foreignKey':_0x591c('0x1b2')});db['FreshdeskField'][_0x591c('0x100')](db[_0x591c('0x1bf')],{'as':_0x591c('0x1b6'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0x1bf')]['belongsTo'](db[_0x591c('0x89')],{'as':_0x591c('0x89'),'foreignKey':'VariableId'});db[_0x591c('0xb1')]['hasMany'](db[_0x591c('0x1c1')],{'as':_0x591c('0x1b7'),'onDelete':'cascade','foreignKey':_0x591c('0x1af')});db['VtigerConfiguration'][_0x591c('0x100')](db['VtigerField'],{'as':_0x591c('0x1b0'),'foreignKey':'SubjectId'});db[_0x591c('0x1c1')]['hasMany'](db['VtigerField'],{'as':_0x591c('0x1b1'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0x1c1')][_0x591c('0x100')](db[_0x591c('0xb3')],{'as':_0x591c('0x1ad'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0x1c1')][_0x591c('0x10d')](db[_0x591c('0xb1')],{'as':_0x591c('0x15b'),'foreignKey':_0x591c('0x1af')});db[_0x591c('0xb3')]['hasMany'](db[_0x591c('0xb3')],{'as':_0x591c('0x1bb'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0xb3')][_0x591c('0x100')](db[_0x591c('0xb3')],{'as':_0x591c('0x1b5'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0xb3')]['hasMany'](db[_0x591c('0xb3')],{'as':_0x591c('0x1b6'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0xb3')][_0x591c('0x10d')](db['Variable'],{'as':_0x591c('0x89'),'foreignKey':_0x591c('0x1b8')});db[_0x591c('0xb4')][_0x591c('0x100')](db[_0x591c('0xb6')],{'as':_0x591c('0x1b7'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1af')});db['ServicenowConfiguration'][_0x591c('0x100')](db[_0x591c('0xb8')],{'as':_0x591c('0x1b0'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0xb6')][_0x591c('0x100')](db[_0x591c('0xb8')],{'as':_0x591c('0x1b1'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0xb6')][_0x591c('0x100')](db[_0x591c('0xb8')],{'as':'Fields','foreignKey':_0x591c('0x1b3')});db[_0x591c('0xb6')][_0x591c('0x10d')](db['ServicenowAccount'],{'as':_0x591c('0x15b'),'foreignKey':'AccountId'});db['ServicenowField']['hasMany'](db[_0x591c('0xb8')],{'as':_0x591c('0x1bb'),'foreignKey':'SubjectId'});db[_0x591c('0xb8')][_0x591c('0x100')](db['ServicenowField'],{'as':_0x591c('0x1b5'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0xb8')]['hasMany'](db[_0x591c('0xb8')],{'as':_0x591c('0x1b6'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0xb8')][_0x591c('0x10d')](db[_0x591c('0x89')],{'as':'Variable','foreignKey':_0x591c('0x1b8')});db['Dynamics365Account'][_0x591c('0x100')](db[_0x591c('0xbc')],{'as':_0x591c('0x1b7'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1af')});db[_0x591c('0xbc')]['hasMany'](db[_0x591c('0xbe')],{'as':'Subjects','onDelete':_0x591c('0x131'),'foreignKey':'SubjectId'});db[_0x591c('0xbc')][_0x591c('0x100')](db[_0x591c('0xbe')],{'as':_0x591c('0x1b1'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0xbc')][_0x591c('0x100')](db[_0x591c('0xbe')],{'as':_0x591c('0x1ad'),'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0xbc')]['belongsTo'](db['Dynamics365Account'],{'as':_0x591c('0x15b'),'foreignKey':'AccountId'});db[_0x591c('0xbe')][_0x591c('0x100')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x591c('0x1b4')});db[_0x591c('0xbe')][_0x591c('0x100')](db[_0x591c('0xbe')],{'as':_0x591c('0x1b5'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0xbe')][_0x591c('0x100')](db[_0x591c('0xbe')],{'as':_0x591c('0x1b6'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0xbe')][_0x591c('0x10d')](db[_0x591c('0x89')],{'as':_0x591c('0x89'),'foreignKey':_0x591c('0x1b8')});db[_0x591c('0xc0')][_0x591c('0x100')](db['FreshsalesConfiguration'],{'as':_0x591c('0x1b7'),'onDelete':_0x591c('0x131'),'foreignKey':'AccountId'});db[_0x591c('0xc2')][_0x591c('0x100')](db['FreshsalesField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x591c('0xc2')][_0x591c('0x100')](db['FreshsalesField'],{'as':_0x591c('0x1b1'),'foreignKey':_0x591c('0x1b2')});db[_0x591c('0xc2')][_0x591c('0x100')](db[_0x591c('0x1c2')],{'as':_0x591c('0x1ad'),'foreignKey':_0x591c('0x1b3')});db[_0x591c('0xc2')][_0x591c('0x10d')](db[_0x591c('0xc0')],{'as':_0x591c('0x15b'),'foreignKey':'AccountId'});db[_0x591c('0x1c2')][_0x591c('0x100')](db[_0x591c('0x1c2')],{'as':_0x591c('0x1bb'),'foreignKey':_0x591c('0x1b4')});db[_0x591c('0x1c2')][_0x591c('0x100')](db[_0x591c('0x1c2')],{'as':_0x591c('0x1b5'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0x591c('0x100')](db['FreshsalesField'],{'as':_0x591c('0x1b6'),'foreignKey':'FieldId'});db[_0x591c('0x1c2')][_0x591c('0x10d')](db[_0x591c('0x89')],{'as':'Variable','foreignKey':'VariableId'});db[_0x591c('0xc8')][_0x591c('0x10d')](db[_0x591c('0x58')],{});db[_0x591c('0xc8')]['belongsTo'](db[_0x591c('0x111')],{'as':_0x591c('0x154'),'foreignKey':_0x591c('0x166')});db[_0x591c('0xc8')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db[_0x591c('0xc8')][_0x591c('0x10d')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x591c('0x10d')](db[_0x591c('0x17e')],{});db[_0x591c('0xc8')][_0x591c('0x10d')](db[_0x591c('0xfe')],{});db[_0x591c('0xc8')]['belongsTo'](db[_0x591c('0x60')],{});db[_0x591c('0x187')]['belongsTo'](db[_0x591c('0xfe')],{'onDelete':'cascade','foreignKey':_0x591c('0x1c3')});db[_0x591c('0x187')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x1c4')});db['JscriptySessionReport'][_0x591c('0x100')](db[_0x591c('0xcd')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x591c('0xcf')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x591c('0x131')});db[_0x591c('0xd1')][_0x591c('0x10d')](db[_0x591c('0x12b')],{});db[_0x591c('0xd1')][_0x591c('0x10d')](db['CmList'],{'as':_0x591c('0x154'),'foreignKey':_0x591c('0x166')});db[_0x591c('0xd1')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db['SmsQueueReport']['belongsTo'](db[_0x591c('0x4c')],{});db[_0x591c('0xd1')][_0x591c('0x10d')](db[_0x591c('0x4e')],{});db[_0x591c('0xd1')]['belongsTo'](db[_0x591c('0xfe')],{});db['SmsQueueReport'][_0x591c('0x10d')](db[_0x591c('0x50')],{});db[_0x591c('0x1c5')]['hasMany'](db[_0x591c('0xcf')],{'foreignKey':_0x591c('0x1c6')});db[_0x591c('0x1c5')][_0x591c('0x100')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x591c('0x1c5')][_0x591c('0x100')](db[_0x591c('0xcb')],{'foreignKey':_0x591c('0x1c6')});db['SquareProject'][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':'Users','through':_0x591c('0x130')});db[_0x591c('0xdc')]['belongsToMany'](db[_0x591c('0xfe')],{'as':'Agents','through':'user_has_teams'});db[_0x591c('0xdc')][_0x591c('0x113')](db['VoiceQueue'],{'through':_0x591c('0x1c7'),'as':_0x591c('0x119')});db[_0x591c('0xdc')][_0x591c('0x113')](db[_0x591c('0x35')],{'through':_0x591c('0x158'),'as':_0x591c('0x11a')});db[_0x591c('0xdc')][_0x591c('0x113')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x591c('0x11b')});db[_0x591c('0xdc')][_0x591c('0x113')](db[_0x591c('0x16c')],{'through':_0x591c('0x16f'),'as':_0x591c('0x1c8')});db['Team'][_0x591c('0x113')](db['SmsQueue'],{'through':_0x591c('0x175'),'as':_0x591c('0x11c')});db['Team'][_0x591c('0x113')](db['OpenchannelQueue'],{'through':_0x591c('0x17c'),'as':'OpenchannelQueues'});db['Team'][_0x591c('0x113')](db[_0x591c('0xf8')],{'through':_0x591c('0x1c9'),'as':'WhatsappQueues'});db[_0x591c('0x191')]['hasMany'](db[_0x591c('0x18c')],{'as':'Hoppers','foreignKey':_0x591c('0x192')});db[_0x591c('0x191')][_0x591c('0x100')](db['CmHopperFinal'],{'as':_0x591c('0x136'),'foreignKey':_0x591c('0x192')});db[_0x591c('0x191')][_0x591c('0x100')](db[_0x591c('0x6d')],{'as':_0x591c('0x137'),'foreignKey':_0x591c('0x192')});db[_0x591c('0x191')][_0x591c('0x100')](db['CmHopperBlack'],{'as':_0x591c('0x138'),'foreignKey':_0x591c('0x192')});db[_0x591c('0x191')]['belongsTo'](db[_0x591c('0x28')],{'as':_0x591c('0x28'),'foreignKey':_0x591c('0x13a')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x591c('0x13b'),'foreignKey':_0x591c('0x1ca')});db[_0x591c('0x191')][_0x591c('0x10d')](db[_0x591c('0x77')],{'as':_0x591c('0x77'),'foreignKey':_0x591c('0x13c')});db['Campaign'][_0x591c('0x10d')](db[_0x591c('0x12f')],{'as':'SquareProject','foreignKey':_0x591c('0x1cb')});db[_0x591c('0x191')][_0x591c('0x113')](db[_0x591c('0x111')],{'as':_0x591c('0x112'),'through':_0x591c('0x1cc')});db[_0x591c('0x191')]['belongsToMany'](db[_0x591c('0x111')],{'as':_0x591c('0x140'),'through':_0x591c('0x1cd')});db[_0x591c('0xe1')][_0x591c('0x10d')](db[_0x591c('0x163')],{'as':_0x591c('0x163'),'foreignKey':'ChatOfflineMessageId'});db[_0x591c('0x1ce')][_0x591c('0x10d')](db[_0x591c('0x3a')],{});db[_0x591c('0x1ce')]['belongsTo'](db[_0x591c('0x38')],{});db[_0x591c('0x1ce')]['belongsTo'](db[_0x591c('0x126')],{'foreignKey':_0x591c('0x1cf'),'as':_0x591c('0x1d0')});db[_0x591c('0x1ce')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d1'),'as':_0x591c('0x1d2')});db[_0x591c('0x1ce')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d3'),'as':_0x591c('0x1d4')});db[_0x591c('0x1ce')][_0x591c('0x10d')](db[_0x591c('0x35')],{'foreignKey':_0x591c('0x1d5'),'as':_0x591c('0x1d6')});db[_0x591c('0x1ce')][_0x591c('0x10d')](db[_0x591c('0x126')],{'foreignKey':'ToMailAccountId','as':_0x591c('0x1d7')});db[_0x591c('0xe3')][_0x591c('0x10d')](db[_0x591c('0x17e')],{});db[_0x591c('0xe3')]['belongsTo'](db[_0x591c('0x104')],{});db[_0x591c('0xe3')][_0x591c('0x10d')](db[_0x591c('0x58')],{'foreignKey':_0x591c('0x1d8'),'as':_0x591c('0x1d0')});db['ChatTransferReport'][_0x591c('0x10d')](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d1'),'as':_0x591c('0x1d2')});db[_0x591c('0xe3')][_0x591c('0x10d')](db['User'],{'foreignKey':_0x591c('0x1d3'),'as':_0x591c('0x1d4')});db[_0x591c('0xe3')][_0x591c('0x10d')](db[_0x591c('0x60')],{'foreignKey':_0x591c('0x1d9'),'as':'ToQueue'});db[_0x591c('0xe3')][_0x591c('0x10d')](db[_0x591c('0x58')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x591c('0xe4')]['belongsTo'](db[_0x591c('0x47')],{});db['FaxTransferReport'][_0x591c('0x10d')](db['FaxInteraction'],{});db[_0x591c('0xe4')][_0x591c('0x10d')](db[_0x591c('0x42')],{'foreignKey':_0x591c('0x1da'),'as':_0x591c('0x1d0')});db[_0x591c('0xe4')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d1'),'as':_0x591c('0x1d2')});db[_0x591c('0xe4')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d3'),'as':_0x591c('0x1d4')});db[_0x591c('0xe4')][_0x591c('0x10d')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0x591c('0xe4')][_0x591c('0x10d')](db['FaxAccount'],{'foreignKey':_0x591c('0x1db'),'as':_0x591c('0x1d7')});db[_0x591c('0xe6')][_0x591c('0x10d')](db[_0x591c('0x54')],{});db[_0x591c('0xe6')][_0x591c('0x10d')](db[_0x591c('0x53')],{});db[_0x591c('0xe6')][_0x591c('0x10d')](db[_0x591c('0x129')],{'foreignKey':'FromOpenchannelAccountId','as':_0x591c('0x1d0')});db[_0x591c('0xe6')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d1'),'as':_0x591c('0x1d2')});db[_0x591c('0xe6')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d3'),'as':_0x591c('0x1d4')});db[_0x591c('0xe6')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x591c('0x1dc'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x591c('0x10d')](db[_0x591c('0x129')],{'foreignKey':_0x591c('0x1dd'),'as':_0x591c('0x1d7')});db['SmsTransferReport'][_0x591c('0x10d')](db['SmsMessage'],{});db[_0x591c('0x1de')][_0x591c('0x10d')](db[_0x591c('0x4c')],{});db['SmsTransferReport'][_0x591c('0x10d')](db[_0x591c('0x12b')],{'foreignKey':_0x591c('0x1df'),'as':_0x591c('0x1d0')});db['SmsTransferReport']['belongsTo'](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d1'),'as':_0x591c('0x1d2')});db['SmsTransferReport'][_0x591c('0x10d')](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d3'),'as':_0x591c('0x1d4')});db[_0x591c('0x1de')]['belongsTo'](db[_0x591c('0x50')],{'foreignKey':_0x591c('0x1e0'),'as':'ToQueue'});db[_0x591c('0x1de')][_0x591c('0x10d')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x591c('0x1d7')});db['CmList'][_0x591c('0x100')](db[_0x591c('0x168')],{'as':_0x591c('0x14f'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x591c('0x111')][_0x591c('0x100')](db[_0x591c('0x70')],{'as':'CustomFields','foreignKey':_0x591c('0x166')});db[_0x591c('0x111')][_0x591c('0x100')](db['CmContact'],{'as':'Contacts','onDelete':_0x591c('0x131'),'foreignKey':_0x591c('0x166')});db[_0x591c('0x111')][_0x591c('0x100')](db[_0x591c('0x6b')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x591c('0x111')][_0x591c('0x100')](db[_0x591c('0x6d')],{'as':'HopperHistory','foreignKey':_0x591c('0x166')});db[_0x591c('0x111')]['hasMany'](db[_0x591c('0x6f')],{'as':'ReportAgentPreview','foreignKey':_0x591c('0x166')});db[_0x591c('0x111')][_0x591c('0x113')](db[_0x591c('0x1b')],{'as':'Queues','through':_0x591c('0x13e')});db[_0x591c('0x111')][_0x591c('0x113')](db['User'],{'as':_0x591c('0x13f'),'through':'cm_user_has_lists'});db[_0x591c('0xea')][_0x591c('0x100')](db[_0x591c('0x17')],{'as':_0x591c('0x103'),'onDelete':_0x591c('0x131')});db[_0x591c('0xea')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':'Agents','through':'user_has_voice_prefixes'});db['UserProfile'][_0x591c('0x100')](db[_0x591c('0xfe')],{'as':_0x591c('0x15f'),'foreignKey':'userProfileId'});db['UserProfile'][_0x591c('0x100')](db['UserProfileSection'],{'as':_0x591c('0x1e1'),'foreignKey':'userProfileId','onDelete':_0x591c('0x131')});db['UserProfileSection'][_0x591c('0x100')](db['UserProfileResource'],{'as':_0x591c('0x1e2'),'foreignKey':'sectionId','onDelete':_0x591c('0x131')});db['WhatsappAccount'][_0x591c('0x100')](db[_0x591c('0x168')],{'as':_0x591c('0x14f'),'foreignKey':_0x591c('0x1e3'),'onDelete':_0x591c('0x131')});db['WhatsappAccount'][_0x591c('0x100')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x591c('0x1e3')});db[_0x591c('0xf0')][_0x591c('0x100')](db['WhatsappMessage'],{'as':_0x591c('0x142'),'foreignKey':_0x591c('0x1e3')});db[_0x591c('0xf0')][_0x591c('0x100')](db[_0x591c('0xf2')],{'as':_0x591c('0x151')});db[_0x591c('0xf0')][_0x591c('0x100')](db[_0x591c('0x1e4')],{'as':_0x591c('0x153')});db['WhatsappAccount'][_0x591c('0x10d')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x591c('0xf0')][_0x591c('0x10d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x591c('0x156')});db[_0x591c('0xf0')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x13f'),'through':'user_has_whatsapp_accounts'});db[_0x591c('0x1e4')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'onDelete':_0x591c('0x165')});db['WhatsappApplication'][_0x591c('0x10d')](db[_0x591c('0xf8')],{'onDelete':_0x591c('0x165')});db[_0x591c('0x1e4')][_0x591c('0x10d')](db[_0x591c('0xf0')],{'onDelete':_0x591c('0x165')});db[_0x591c('0x1e4')][_0x591c('0x10d')](db[_0x591c('0x77')],{'onDelete':_0x591c('0x165'),'foreignKey':_0x591c('0x13c')});db[_0x591c('0x1e4')][_0x591c('0x10d')](db['Tag'],{'onDelete':_0x591c('0x165'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x591c('0x100')](db[_0x591c('0x1e5')],{'as':_0x591c('0x142'),'onDelete':'cascade','foreignKey':_0x591c('0x1e6')});db[_0x591c('0xf2')]['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x591c('0x10d')](db['CmContact'],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db[_0x591c('0xf2')][_0x591c('0x10d')](db[_0x591c('0xfe')],{'as':_0x591c('0x15c'),'foreignKey':'UserId'});db[_0x591c('0xf2')]['belongsToMany'](db[_0x591c('0x81')],{'through':_0x591c('0x1e7'),'as':_0x591c('0x184')});db[_0x591c('0xf2')][_0x591c('0x113')](db[_0x591c('0x81')],{'through':_0x591c('0x1e7'),'as':'ThroughTags'});db[_0x591c('0xf2')][_0x591c('0x113')](db['User'],{'as':_0x591c('0x15f'),'through':'user_has_whatsapp_interactions','foreignKey':_0x591c('0x1e6')});db['WhatsappMessage'][_0x591c('0x10d')](db[_0x591c('0xfe')],{'as':_0x591c('0xfe')});db['WhatsappMessage'][_0x591c('0x10d')](db[_0x591c('0x10f')],{'onDelete':_0x591c('0x131'),'as':'Contact'});db[_0x591c('0x1e5')]['belongsTo'](db[_0x591c('0xf2')],{'onDelete':_0x591c('0x131'),'as':'Interaction','foreignKey':_0x591c('0x1e6')});db['WhatsappMessage'][_0x591c('0x10d')](db[_0x591c('0xf0')],{'as':_0x591c('0x15b'),'foreignKey':_0x591c('0x1e3')});db['WhatsappQueueReport'][_0x591c('0x10d')](db['WhatsappAccount'],{});db[_0x591c('0xf4')][_0x591c('0x10d')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x591c('0xf4')][_0x591c('0x10d')](db[_0x591c('0x10f')],{'as':_0x591c('0x14a'),'foreignKey':_0x591c('0x14b')});db['WhatsappQueueReport'][_0x591c('0x10d')](db[_0x591c('0xf2')],{});db[_0x591c('0xf4')]['belongsTo'](db[_0x591c('0xf8')],{});db[_0x591c('0xf4')][_0x591c('0x10d')](db[_0x591c('0x1e5')],{});db[_0x591c('0xf4')][_0x591c('0x10d')](db[_0x591c('0xfe')],{});db[_0x591c('0xf6')]['belongsTo'](db[_0x591c('0x1e5')],{});db[_0x591c('0xf6')][_0x591c('0x10d')](db[_0x591c('0xf2')],{});db[_0x591c('0xf6')][_0x591c('0x10d')](db[_0x591c('0xf0')],{'foreignKey':'FromWhatsappAccountId','as':_0x591c('0x1d0')});db[_0x591c('0xf6')][_0x591c('0x10d')](db[_0x591c('0xf0')],{'foreignKey':_0x591c('0x1e8'),'as':_0x591c('0x1d7')});db[_0x591c('0xf6')][_0x591c('0x10d')](db[_0x591c('0xf8')],{'foreignKey':_0x591c('0x1e9'),'as':_0x591c('0x1d6')});db['WhatsappTransferReport'][_0x591c('0x10d')](db[_0x591c('0xfe')],{'foreignKey':_0x591c('0x1d1'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x591c('0xf8')][_0x591c('0x113')](db[_0x591c('0xfe')],{'as':_0x591c('0x13f'),'through':_0x591c('0x30'),'foreignKey':'WhatsappQueueId'});db[_0x591c('0xf8')][_0x591c('0x113')](db[_0x591c('0xdc')],{'through':_0x591c('0x1c9'),'as':_0x591c('0x159')});module[_0x591c('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x5354=['ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','Action','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','Sound','../api/tag/tag.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','../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','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','Realtime','../api/realtime/realtime.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','VoiceMail','cascade','UserId','Recordings','hasMany','HopperFinals','HopperHistory','SmsInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','CmList','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Messages','Interactions','MailApplication','Applications','List','ListId','Template','TemplateId','user_has_mail_accounts','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Users','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','Dispositions','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','Answers','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','ChatApplication','OpenchannelQueueReport','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','Phones','CmCompany','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','CampaignId','Automation','OneAll','AutomationAllId','Condition','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Hopper','AllConditions','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskConfiguration','DeskField','int_desk_configuration_has_tags','Subjects','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','Dynamics365Configuration','Dynamics365Account','ToId','SessionId','ProjectId','JscriptyProject','team_has_mail_queues','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','Lists','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToQueue','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','userProfileId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','defaultsDeep','database','options','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model'];(function(_0x5cd7a3,_0x1aa14f){var _0x21235d=function(_0x3152a9){while(--_0x3152a9){_0x5cd7a3['push'](_0x5cd7a3['shift']());}};_0x21235d(++_0x1aa14f);}(_0x5354,0x18b));var _0x4535=function(_0x15db6d,_0x41dbfb){_0x15db6d=_0x15db6d-0x0;var _0x1c90eb=_0x5354[_0x15db6d];return _0x1c90eb;};'use strict';var path=require(_0x4535('0x0'));var config=require(_0x4535('0x1'));var Sequelize=require(_0x4535('0x2'));var _=require(_0x4535('0x3'));var jstz=require('jstz');var timezone=jstz['determine']();config['sequelize']=_['defaultsDeep'](config[_0x4535('0x2')],{'database':_0x4535('0x4'),'username':_0x4535('0x5'),'password':_0x4535('0x6'),'options':{'host':_0x4535('0x7'),'port':0xcea,'dialect':_0x4535('0x8'),'dialectOptions':{'charset':_0x4535('0x9')},'logging':![],'timezone':timezone[_0x4535('0xa')](),'define':{'charset':_0x4535('0xb'),'collate':'utf8_general_ci'}}});config[_0x4535('0xc')]=_[_0x4535('0xd')](config[_0x4535('0xc')],{'database':_0x4535('0x4'),'username':_0x4535('0x5'),'password':_0x4535('0x6'),'options':{'host':_0x4535('0x7'),'port':0xcea,'dialect':_0x4535('0x8'),'dialectOptions':{'charset':_0x4535('0x9')},'logging':![],'timezone':timezone[_0x4535('0xa')](),'define':{'charset':_0x4535('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x4535('0xe')],config[_0x4535('0x2')]['username'],config['sequelize']['password'],config['sequelize'][_0x4535('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4535('0xc')][_0x4535('0xe')],config[_0x4535('0xc')][_0x4535('0x10')],config[_0x4535('0xc')][_0x4535('0x11')],config[_0x4535('0xc')]['options'])};db[_0x4535('0x12')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x14'));db[_0x4535('0x15')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x16'));db[_0x4535('0x17')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/voiceContext/voiceContext.model');db[_0x4535('0x18')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x19'));db['VoiceMusicOnHold']=db['sequelize']['import'](_0x4535('0x1a'));db[_0x4535('0x1b')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x1c'));db[_0x4535('0x1d')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x1e'));db[_0x4535('0x1f')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x20'));db['VoiceMail']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x21'));db['VoiceMailMessage']=db[_0x4535('0x2')][_0x4535('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x4535('0x22')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x23'));db['VoiceDialReport']=db[_0x4535('0x2')]['import'](_0x4535('0x24'));db[_0x4535('0x25')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x26'));db[_0x4535('0x27')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x28'));db[_0x4535('0x29')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/memberReport/memberReport.model');db[_0x4535('0x2a')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x2b'));db[_0x4535('0x2c')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x2d'));db[_0x4535('0x2e')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x2f'));db[_0x4535('0x30')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x4535('0x31')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x32'));db[_0x4535('0x33')]=db[_0x4535('0x2')]['import'](_0x4535('0x34'));db[_0x4535('0x35')]=db[_0x4535('0x2')]['import']('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x36'));db[_0x4535('0x37')]=db[_0x4535('0x2')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x4535('0x38')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x39'));db[_0x4535('0x3a')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x3b'));db[_0x4535('0x3c')]=db['sequelize'][_0x4535('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x4535('0x3d')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x3e'));db[_0x4535('0x3f')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x40'));db['MailSubstatus']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x41'));db[_0x4535('0x42')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x4535('0x43')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0x4535('0x2')]['import'](_0x4535('0x44'));db[_0x4535('0x45')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x46'));db[_0x4535('0x47')]=db[_0x4535('0x2')]['import'](_0x4535('0x48'));db[_0x4535('0x49')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x4a'));db[_0x4535('0x4b')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x4c'));db[_0x4535('0x4d')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x4e'));db[_0x4535('0x4f')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x50'));db['FaxMessage']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x51'));db[_0x4535('0x52')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/faxQueue/faxQueue.model');db[_0x4535('0x53')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x54'));db['SmsAccount']=db[_0x4535('0x2')]['import'](_0x4535('0x55'));db[_0x4535('0x56')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x57'));db[_0x4535('0x58')]=db['sequelize']['import']('../api/smsInteraction/smsInteraction.model');db[_0x4535('0x59')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x5a'));db[_0x4535('0x5b')]=db[_0x4535('0x2')]['import'](_0x4535('0x5c'));db[_0x4535('0x5d')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x5e'));db[_0x4535('0x5f')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x60'));db[_0x4535('0x61')]=db[_0x4535('0x2')]['import'](_0x4535('0x62'));db['OpenchannelMessage']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x63'));db[_0x4535('0x64')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x4535('0x65')]=db['sequelize'][_0x4535('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x66'));db['ChatApplication']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x67'));db[_0x4535('0x68')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x4535('0x69')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x6a'));db[_0x4535('0x6b')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x6c'));db[_0x4535('0x6d')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x6e'));db[_0x4535('0x6f')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x70'));db[_0x4535('0x71')]=db[_0x4535('0x2')]['import'](_0x4535('0x72'));db['CmCompany']=db['sequelize']['import'](_0x4535('0x73'));db[_0x4535('0x74')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x75'));db[_0x4535('0x76')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x77'));db[_0x4535('0x78')]=db[_0x4535('0x2')]['import'](_0x4535('0x79'));db[_0x4535('0x7a')]=db[_0x4535('0x2')]['import'](_0x4535('0x7b'));db[_0x4535('0x7c')]=db['sequelize'][_0x4535('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x4535('0x7d')]=db['sequelize']['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x4535('0x7e')]=db['sequelize'][_0x4535('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x4535('0x7f')]=db['sequelize'][_0x4535('0x13')]('../api/action/action.model');db['Automation']=db[_0x4535('0x2')]['import'](_0x4535('0x80'));db[_0x4535('0x81')]=db[_0x4535('0x2')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x4535('0x82')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x83'));db['Condition']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x84'));db[_0x4535('0x85')]=db['sequelize']['import'](_0x4535('0x86'));db[_0x4535('0x87')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x88'));db[_0x4535('0x89')]=db[_0x4535('0x2')]['import'](_0x4535('0x8a'));db[_0x4535('0x8b')]=db['sequelize']['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x4535('0x8c')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/schedule/schedule.model');db[_0x4535('0x8d')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/sound/sound.model');db['Tag']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x8e'));db['ContactItemType']=db[_0x4535('0x2')]['import']('../api/contactItemType/contactItemType.model');db[_0x4535('0x8f')]=db['sequelize']['import'](_0x4535('0x90'));db[_0x4535('0x91')]=db[_0x4535('0x2')]['import'](_0x4535('0x92'));db['Template']=db[_0x4535('0x2')][_0x4535('0x13')]('../api/template/template.model');db[_0x4535('0x93')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x94'));db[_0x4535('0x95')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x96'));db[_0x4535('0x97')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x98'));db[_0x4535('0x99')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x9a'));db[_0x4535('0x9b')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x9c'));db[_0x4535('0x9d')]=db['sequelize'][_0x4535('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x4535('0x9e')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x4535('0x9f')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xa0'));db[_0x4535('0xa1')]=db['sequelize'][_0x4535('0x13')](_0x4535('0xa2'));db[_0x4535('0xa3')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xa4'));db[_0x4535('0xa5')]=db['sequelize'][_0x4535('0x13')](_0x4535('0xa6'));db[_0x4535('0xa7')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xa8'));db[_0x4535('0xa9')]=db[_0x4535('0x2')]['import'](_0x4535('0xaa'));db[_0x4535('0xab')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xac'));db[_0x4535('0xad')]=db['sequelize'][_0x4535('0x13')](_0x4535('0xae'));db[_0x4535('0xaf')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xb0'));db[_0x4535('0xb1')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xb2'));db['DeskConfiguration']=db[_0x4535('0x2')][_0x4535('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xb3'));db[_0x4535('0xb4')]=db['sequelize'][_0x4535('0x13')](_0x4535('0xb5'));db[_0x4535('0xb6')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xb7'));db[_0x4535('0xb8')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xb9'));db[_0x4535('0xba')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xbb'));db[_0x4535('0xbc')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xbd'));db['ZendeskField']=db[_0x4535('0x2')]['import'](_0x4535('0xbe'));db[_0x4535('0xbf')]=db[_0x4535('0x2')]['import'](_0x4535('0xc0'));db['FreshdeskConfiguration']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xc1'));db['FreshdeskField']=db[_0x4535('0x2')][_0x4535('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x4535('0xc2')]=db['sequelize'][_0x4535('0x13')](_0x4535('0xc3'));db[_0x4535('0xc4')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xc5'));db[_0x4535('0xc6')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xc7'));db[_0x4535('0xc8')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xc9'));db[_0x4535('0xca')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x4535('0xcb')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xcc'));db['Dynamics365Configuration']=db['sequelize'][_0x4535('0x13')](_0x4535('0xcd'));db[_0x4535('0xce')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x4535('0xcf')]=db['sequelize']['import'](_0x4535('0xd0'));db[_0x4535('0xd1')]=db['sequelize'][_0x4535('0x13')](_0x4535('0xd2'));db[_0x4535('0xd3')]=db['sequelize'][_0x4535('0x13')](_0x4535('0xd4'));db['Integration']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x98'));db['Network']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xd5'));db[_0x4535('0xd6')]=db['sequelize'][_0x4535('0x13')](_0x4535('0xd7'));db[_0x4535('0xd8')]=db['sequelize'][_0x4535('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x4535('0xd9')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xda'));db[_0x4535('0xdb')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xdc'));db[_0x4535('0xdd')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xde'));db[_0x4535('0xdf')]=db['sequelize']['import'](_0x4535('0xe0'));db['SquareReport']=db['sequelize'][_0x4535('0x13')](_0x4535('0xe1'));db['SquareDetailsReport']=db['sequelize'][_0x4535('0x13')](_0x4535('0xe2'));db['JscriptyProject']=db['sequelize']['import'](_0x4535('0xe3'));db['Setting']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xe4'));db[_0x4535('0xe5')]=db[_0x4535('0x2')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x4535('0xe6')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xe7'));db[_0x4535('0xe8')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/squareRecording/squareRecording.model');db[_0x4535('0xe9')]=db['sequelize'][_0x4535('0x13')](_0x4535('0xea'));db['Team']=db[_0x4535('0x2')]['import']('../api/team/team.model');db[_0x4535('0xeb')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xec'));db['Campaign']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xed'));db['Migration']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xee'));db[_0x4535('0xef')]=db[_0x4535('0x2')]['import']('../api/attachment/attachment.model');db[_0x4535('0xf0')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/plugin/plugin.model');db[_0x4535('0xf1')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xf2'));db['ChatTransferReport']=db['sequelize'][_0x4535('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x4535('0xf3')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xf4'));db[_0x4535('0xf5')]=db[_0x4535('0x2')]['import'](_0x4535('0xf6'));db[_0x4535('0xf7')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x4535('0x2')]['import'](_0x4535('0xf8'));db[_0x4535('0xf9')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xfa'));db[_0x4535('0xfb')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x4535('0x2')][_0x4535('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x4535('0x2')][_0x4535('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0x4535('0xfc')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xfd'));db['WhatsappAccount']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xfe'));db['WhatsappApplication']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0xff'));db[_0x4535('0x100')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x101'));db[_0x4535('0x102')]=db[_0x4535('0x2')]['import'](_0x4535('0x103'));db[_0x4535('0x104')]=db[_0x4535('0x2')]['import'](_0x4535('0x105'));db['WhatsappTransferReport']=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x106'));db[_0x4535('0x107')]=db[_0x4535('0x2')][_0x4535('0x13')](_0x4535('0x108'));db[_0x4535('0x109')]=db[_0x4535('0x2')][_0x4535('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0x4535('0x10a')]=db[_0x4535('0x2')]['import'](_0x4535('0x10b'));db[_0x4535('0x10c')]=db['sequelize'][_0x4535('0x13')](_0x4535('0x10d'));db[_0x4535('0x12')][_0x4535('0x10e')](db[_0x4535('0x10f')],{'as':_0x4535('0x10f'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x111')});db[_0x4535('0x12')]['hasMany'](db['VoiceRecording'],{'as':_0x4535('0x112'),'foreignKey':_0x4535('0x111')});db['User'][_0x4535('0x113')](db[_0x4535('0x2e')],{'as':'VoiceQueuesRt','foreignKey':_0x4535('0x111')});db[_0x4535('0x12')][_0x4535('0x113')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x4535('0x110'),'hooks':!![]});db[_0x4535('0x12')]['hasMany'](db[_0x4535('0x7a')],{'as':_0x4535('0x114'),'foreignKey':'UserId'});db[_0x4535('0x12')][_0x4535('0x113')](db[_0x4535('0x7c')],{'as':_0x4535('0x115'),'foreignKey':_0x4535('0x111')});db[_0x4535('0x12')]['hasMany'](db[_0x4535('0x7d')],{'as':_0x4535('0x7d'),'foreignKey':'UserId'});db[_0x4535('0x12')][_0x4535('0x113')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x4535('0x111')});db['User'][_0x4535('0x113')](db[_0x4535('0x68')],{'as':'ChatInteractions','foreignKey':_0x4535('0x111')});db[_0x4535('0x12')]['hasMany'](db['SmsInteraction'],{'as':_0x4535('0x116'),'foreignKey':_0x4535('0x111')});db[_0x4535('0x12')][_0x4535('0x113')](db[_0x4535('0x4f')],{'as':'FaxInteractions','foreignKey':_0x4535('0x111')});db[_0x4535('0x12')][_0x4535('0x113')](db[_0x4535('0x42')],{'as':_0x4535('0x117'),'foreignKey':_0x4535('0x111')});db[_0x4535('0x12')][_0x4535('0x113')](db[_0x4535('0x100')],{'as':_0x4535('0x118'),'foreignKey':_0x4535('0x111')});db['User']['hasMany'](db[_0x4535('0xfc')],{'as':'UserNotifications','foreignKey':_0x4535('0x119')});db['User']['belongsTo'](db['UserProfile'],{'as':_0x4535('0xfb'),'foreignKey':'userProfileId'});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x6f')],{'as':_0x4535('0x11b'),'through':_0x4535('0x11c')});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x74')],{'as':'Contacts','through':_0x4535('0x11d')});db['User'][_0x4535('0x11a')](db['CmList'],{'as':'Lists','through':_0x4535('0x11e')});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x11f')],{'through':_0x4535('0x120')});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x42')],{'as':'MailInteractions','through':_0x4535('0x121')});db['User'][_0x4535('0x11a')](db['ChatInteraction'],{'as':_0x4535('0x122'),'through':_0x4535('0x123')});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x4f')],{'as':_0x4535('0x124'),'through':_0x4535('0x125')});db[_0x4535('0x12')][_0x4535('0x11a')](db['SmsInteraction'],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db['User'][_0x4535('0x11a')](db['OpenchannelInteraction'],{'as':_0x4535('0x126'),'through':_0x4535('0x127')});db['User'][_0x4535('0x11a')](db['WhatsappInteraction'],{'as':_0x4535('0x118'),'through':_0x4535('0x128')});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x1b')],{'as':_0x4535('0x129'),'through':_0x4535('0x30'),'required':![]});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x3f')],{'as':_0x4535('0x12a'),'through':_0x4535('0x33'),'required':![]});db['User'][_0x4535('0x11a')](db[_0x4535('0x6d')],{'as':_0x4535('0x12b'),'through':_0x4535('0x31'),'required':![],'hooks':!![]});db[_0x4535('0x12')]['belongsToMany'](db[_0x4535('0x52')],{'as':_0x4535('0x12c'),'through':_0x4535('0x35'),'required':![]});db['User'][_0x4535('0x11a')](db[_0x4535('0x5b')],{'as':'SmsQueues','through':_0x4535('0x12d'),'required':![]});db[_0x4535('0x12')][_0x4535('0x11a')](db['OpenchannelQueue'],{'as':_0x4535('0x12e'),'through':_0x4535('0x37'),'required':![]});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x107')],{'as':_0x4535('0x12f'),'through':_0x4535('0x38'),'required':![]});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x130')],{'through':_0x4535('0x11e')});db[_0x4535('0x12')]['belongsToMany'](db[_0x4535('0xf9')],{'as':'VoicePrefixes','through':_0x4535('0x131'),'required':![]});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0x65')],{'as':_0x4535('0x132'),'through':_0x4535('0x133')});db[_0x4535('0x12')][_0x4535('0x11a')](db['FaxAccount'],{'as':_0x4535('0x134'),'through':_0x4535('0x135')});db['User'][_0x4535('0x11a')](db[_0x4535('0x3d')],{'as':_0x4535('0x136'),'through':'user_has_mail_accounts'});db['User']['belongsToMany'](db[_0x4535('0x5d')],{'as':'OpenchannelAccounts','through':_0x4535('0x137')});db['User']['belongsToMany'](db[_0x4535('0x138')],{'as':_0x4535('0x139'),'through':_0x4535('0x13a')});db[_0x4535('0x12')][_0x4535('0x11a')](db['WhatsappAccount'],{'as':_0x4535('0x13b'),'through':'user_has_whatsapp_accounts'});db[_0x4535('0x12')][_0x4535('0x11a')](db[_0x4535('0xe6')],{'as':_0x4535('0x13c'),'through':_0x4535('0x13d')});db['VoiceChanSpy'][_0x4535('0x113')](db[_0x4535('0x18')],{'as':_0x4535('0x13e'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x13f')});db[_0x4535('0x17')][_0x4535('0x113')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x4535('0x18')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':_0x4535('0x110')});db['VoiceMusicOnHold'][_0x4535('0x11a')](db[_0x4535('0x8d')],{'as':'Sounds','through':_0x4535('0x140')});db[_0x4535('0x1b')]['hasMany'](db[_0x4535('0x2e')],{'as':_0x4535('0x141'),'foreignKey':_0x4535('0x142')});db[_0x4535('0x1b')]['hasMany'](db[_0x4535('0x76')],{'as':_0x4535('0x143'),'foreignKey':_0x4535('0x142')});db['VoiceQueue']['hasMany'](db[_0x4535('0x7a')],{'as':'HopperFinals','foreignKey':_0x4535('0x142')});db[_0x4535('0x1b')][_0x4535('0x113')](db[_0x4535('0x7c')],{'as':_0x4535('0x144'),'foreignKey':_0x4535('0x142')});db[_0x4535('0x1b')][_0x4535('0x113')](db['ReportAgentPreview'],{'as':_0x4535('0x7d'),'foreignKey':_0x4535('0x142')});db[_0x4535('0x1b')]['hasMany'](db['CmHopperBlack'],{'as':_0x4535('0x145'),'foreignKey':'VoiceQueueId'});db[_0x4535('0x1b')]['hasMany'](db['JscriptySessionReport'],{'as':_0x4535('0x146'),'foreignKey':_0x4535('0x142')});db[_0x4535('0x1b')][_0x4535('0x147')](db[_0x4535('0x2a')],{'as':_0x4535('0x2a'),'foreignKey':_0x4535('0x148')});db[_0x4535('0x1b')][_0x4535('0x147')](db[_0x4535('0x2a')],{'as':_0x4535('0x149'),'foreignKey':_0x4535('0x14a')});db[_0x4535('0x1b')][_0x4535('0x147')](db[_0x4535('0x85')],{'as':_0x4535('0x85'),'foreignKey':_0x4535('0x14b')});db['VoiceQueue'][_0x4535('0x147')](db['Pause'],{'as':_0x4535('0x14c'),'foreignKey':_0x4535('0x14d')});db[_0x4535('0x1b')][_0x4535('0x11a')](db[_0x4535('0x130')],{'as':'Lists','through':_0x4535('0x14e')});db[_0x4535('0x1b')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':_0x4535('0x14f'),'through':_0x4535('0x30')});db[_0x4535('0x1b')][_0x4535('0x11a')](db[_0x4535('0x11f')],{'as':'Teams','through':_0x4535('0x10c')});db[_0x4535('0x1b')][_0x4535('0x11a')](db[_0x4535('0x130')],{'as':'BlackLists','through':_0x4535('0x150')});db[_0x4535('0x1d')]['belongsTo'](db['User'],{'as':_0x4535('0x12'),'foreignKey':_0x4535('0x111')});db[_0x4535('0x1f')][_0x4535('0x147')](db['User'],{'as':_0x4535('0x12'),'foreignKey':_0x4535('0x111')});db['VoiceMail'][_0x4535('0x113')](db[_0x4535('0x151')],{'as':'Messages','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x152'),'sourceKey':_0x4535('0x153')});db[_0x4535('0x151')][_0x4535('0x147')](db[_0x4535('0x10f')],{'foreignKey':_0x4535('0x152'),'targetKey':_0x4535('0x153')});db[_0x4535('0x22')][_0x4535('0x113')](db[_0x4535('0x27')],{'as':_0x4535('0x154'),'foreignKey':_0x4535('0x155'),'constraints':![]});db['VoiceCallReport'][_0x4535('0x113')](db[_0x4535('0x25')],{'as':_0x4535('0x156'),'foreignKey':'uniqueid','constraints':![]});db[_0x4535('0x22')]['belongsTo'](db['User'],{'as':_0x4535('0x12'),'foreignKey':_0x4535('0x111')});db[_0x4535('0x22')]['belongsTo'](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':_0x4535('0x158')});db[_0x4535('0x3a')][_0x4535('0x147')](db[_0x4535('0x3d')],{'as':_0x4535('0x3d'),'foreignKey':'MailAccountId'});db[_0x4535('0x3c')][_0x4535('0x147')](db[_0x4535('0x3d')],{'as':'MailAccount','foreignKey':_0x4535('0x159')});db['MailAccount'][_0x4535('0x10e')](db[_0x4535('0x3a')],{'as':_0x4535('0x15a'),'onDelete':_0x4535('0x110')});db[_0x4535('0x3d')]['hasOne'](db[_0x4535('0x3c')],{'as':_0x4535('0x15b'),'onDelete':_0x4535('0x110')});db['MailAccount'][_0x4535('0x113')](db[_0x4535('0x82')],{'as':'Dispositions','foreignKey':_0x4535('0x159'),'onDelete':'cascade'});db['MailAccount'][_0x4535('0x113')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4535('0x159')});db[_0x4535('0x3d')][_0x4535('0x113')](db[_0x4535('0x43')],{'as':_0x4535('0x15c'),'foreignKey':_0x4535('0x159')});db['MailAccount'][_0x4535('0x113')](db[_0x4535('0x42')],{'as':_0x4535('0x15d')});db[_0x4535('0x3d')][_0x4535('0x113')](db[_0x4535('0x15e')],{'as':_0x4535('0x15f')});db[_0x4535('0x3d')][_0x4535('0x147')](db[_0x4535('0x130')],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161')});db[_0x4535('0x3d')]['belongsTo'](db[_0x4535('0x162')],{'as':'Template','foreignKey':_0x4535('0x163')});db[_0x4535('0x3d')][_0x4535('0x147')](db['Pause'],{'as':_0x4535('0x14c'),'foreignKey':_0x4535('0x14d')});db[_0x4535('0x3d')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':_0x4535('0x14f'),'through':_0x4535('0x164')});db[_0x4535('0x3f')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':'Agents','through':'UserMailQueue'});db[_0x4535('0x3f')][_0x4535('0x11a')](db[_0x4535('0x11f')],{'through':'team_has_mail_queues','as':_0x4535('0x165')});db['MailInteraction'][_0x4535('0x113')](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x4535('0x166')});db[_0x4535('0x42')]['belongsTo'](db[_0x4535('0x3d')],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x159')});db[_0x4535('0x42')][_0x4535('0x147')](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':_0x4535('0x158')});db['MailInteraction'][_0x4535('0x147')](db['User'],{'as':_0x4535('0x168'),'foreignKey':_0x4535('0x111')});db[_0x4535('0x42')][_0x4535('0x11a')](db['Tag'],{'through':_0x4535('0x169'),'as':_0x4535('0x16a')});db['MailInteraction'][_0x4535('0x11a')](db[_0x4535('0x16b')],{'through':_0x4535('0x169'),'as':_0x4535('0x16c')});db[_0x4535('0x42')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':_0x4535('0x16d'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x4535('0x43')][_0x4535('0x113')](db[_0x4535('0xef')],{'as':'Attachments','onDelete':_0x4535('0x110')});db['MailMessage'][_0x4535('0x147')](db[_0x4535('0x12')],{'as':_0x4535('0x12')});db['MailMessage'][_0x4535('0x147')](db[_0x4535('0x74')],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x157')});db[_0x4535('0x43')][_0x4535('0x147')](db['MailInteraction'],{'as':_0x4535('0x16e'),'foreignKey':_0x4535('0x166')});db[_0x4535('0x43')][_0x4535('0x147')](db['MailAccount'],{'as':'Account','foreignKey':_0x4535('0x159')});db[_0x4535('0x43')][_0x4535('0x147')](db[_0x4535('0x65')],{'as':'ChatWebsite','foreignKey':_0x4535('0x16f')});db[_0x4535('0x43')][_0x4535('0x147')](db[_0x4535('0x6b')],{'as':_0x4535('0x6b'),'foreignKey':_0x4535('0x170')});db['MailApplication'][_0x4535('0x147')](db[_0x4535('0x12')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x4535('0x3f')],{'onDelete':_0x4535('0x171')});db[_0x4535('0x15e')][_0x4535('0x147')](db['MailAccount'],{'onDelete':_0x4535('0x171')});db[_0x4535('0x15e')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x4535('0x14b')});db[_0x4535('0x15e')][_0x4535('0x147')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x4535('0x172')});db[_0x4535('0x45')][_0x4535('0x147')](db[_0x4535('0x3d')],{});db['MailQueueReport'][_0x4535('0x147')](db[_0x4535('0x130')],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161')});db[_0x4535('0x45')][_0x4535('0x147')](db[_0x4535('0x74')],{'as':'Contact','foreignKey':_0x4535('0x158')});db[_0x4535('0x45')][_0x4535('0x147')](db['MailInteraction'],{});db[_0x4535('0x45')]['belongsTo'](db['MailMessage'],{});db[_0x4535('0x45')][_0x4535('0x147')](db[_0x4535('0x12')],{});db[_0x4535('0x45')][_0x4535('0x147')](db['MailQueue'],{});db[_0x4535('0x47')][_0x4535('0x113')](db[_0x4535('0x49')],{'as':'Items','onDelete':'cascade'});db[_0x4535('0x4b')][_0x4535('0x113')](db[_0x4535('0x82')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x4535('0x110')});db[_0x4535('0x4b')][_0x4535('0x113')](db[_0x4535('0x81')],{'as':'Answers','foreignKey':_0x4535('0x173')});db[_0x4535('0x4b')][_0x4535('0x113')](db[_0x4535('0x4f')],{'as':_0x4535('0x15d')});db['FaxAccount'][_0x4535('0x113')](db[_0x4535('0x4d')],{'as':_0x4535('0x15f')});db[_0x4535('0x4b')]['hasMany'](db['VoiceExtension'],{'as':_0x4535('0x174'),'onDelete':_0x4535('0x110')});db[_0x4535('0x4b')]['hasMany'](db[_0x4535('0x175')],{'as':_0x4535('0x15c')});db[_0x4535('0x4b')][_0x4535('0x147')](db[_0x4535('0x2a')],{'as':'Trunk'});db[_0x4535('0x4b')][_0x4535('0x147')](db[_0x4535('0x130')],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161')});db[_0x4535('0x4b')]['belongsTo'](db[_0x4535('0x87')],{'as':_0x4535('0x14c'),'foreignKey':_0x4535('0x14d')});db[_0x4535('0x4b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x4535('0x135')});db[_0x4535('0x4d')][_0x4535('0x147')](db[_0x4535('0x12')],{'onDelete':'restrict'});db['FaxApplication'][_0x4535('0x147')](db[_0x4535('0x52')],{'onDelete':_0x4535('0x171')});db['FaxApplication']['belongsTo'](db[_0x4535('0x4b')],{'onDelete':'restrict'});db['FaxApplication'][_0x4535('0x147')](db[_0x4535('0x16b')],{'onDelete':_0x4535('0x171'),'foreignKey':_0x4535('0x172')});db['FaxInteraction'][_0x4535('0x113')](db['FaxMessage'],{'as':_0x4535('0x15c'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x176')});db[_0x4535('0x4f')][_0x4535('0x147')](db[_0x4535('0x4b')],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x173')});db[_0x4535('0x4f')][_0x4535('0x147')](db['CmContact'],{'as':_0x4535('0x157'),'foreignKey':_0x4535('0x158')});db[_0x4535('0x4f')][_0x4535('0x147')](db[_0x4535('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x4535('0x4f')][_0x4535('0x11a')](db[_0x4535('0x16b')],{'through':_0x4535('0x177'),'as':_0x4535('0x16a')});db['FaxInteraction'][_0x4535('0x11a')](db[_0x4535('0x16b')],{'through':'fax_interaction_has_tags','as':_0x4535('0x16c')});db[_0x4535('0x4f')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':'Users','through':_0x4535('0x125'),'foreignKey':_0x4535('0x176')});db['FaxMessage'][_0x4535('0x147')](db['User'],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x12')});db['FaxMessage'][_0x4535('0x147')](db[_0x4535('0x4f')],{'as':_0x4535('0x16e'),'foreignKey':_0x4535('0x176')});db[_0x4535('0x175')][_0x4535('0x147')](db[_0x4535('0x74')],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x157')});db['FaxMessage'][_0x4535('0x147')](db['Attachment'],{'as':_0x4535('0xef'),'foreignKey':_0x4535('0x178')});db[_0x4535('0x175')]['belongsTo'](db[_0x4535('0x4b')],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x173')});db[_0x4535('0x52')]['belongsToMany'](db[_0x4535('0x12')],{'as':_0x4535('0x14f'),'through':_0x4535('0x35')});db[_0x4535('0x52')][_0x4535('0x11a')](db[_0x4535('0x11f')],{'through':_0x4535('0x179'),'as':_0x4535('0x165')});db['FaxQueueReport'][_0x4535('0x147')](db[_0x4535('0x4b')],{});db[_0x4535('0x53')][_0x4535('0x147')](db['CmList'],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161')});db[_0x4535('0x53')][_0x4535('0x147')](db['CmContact'],{'as':_0x4535('0x157'),'foreignKey':'ContactId'});db['FaxQueueReport']['belongsTo'](db[_0x4535('0x4f')],{});db['FaxQueueReport'][_0x4535('0x147')](db[_0x4535('0x175')],{});db['FaxQueueReport'][_0x4535('0x147')](db[_0x4535('0x12')],{});db[_0x4535('0x53')][_0x4535('0x147')](db[_0x4535('0x52')],{});db[_0x4535('0x138')][_0x4535('0x113')](db[_0x4535('0x82')],{'as':_0x4535('0x17a'),'foreignKey':_0x4535('0x17b'),'onDelete':_0x4535('0x110')});db['SmsAccount'][_0x4535('0x113')](db[_0x4535('0x81')],{'as':'Answers','foreignKey':_0x4535('0x17b')});db[_0x4535('0x138')][_0x4535('0x113')](db['SmsMessage'],{'as':_0x4535('0x15c'),'foreignKey':_0x4535('0x17b')});db[_0x4535('0x138')][_0x4535('0x113')](db[_0x4535('0x58')],{'as':_0x4535('0x15d')});db['SmsAccount'][_0x4535('0x113')](db['SmsApplication'],{'as':_0x4535('0x15f')});db[_0x4535('0x138')][_0x4535('0x147')](db[_0x4535('0x130')],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161')});db['SmsAccount'][_0x4535('0x147')](db[_0x4535('0x87')],{'as':_0x4535('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4535('0x138')][_0x4535('0x11a')](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x4535('0x56')]['belongsTo'](db[_0x4535('0x12')],{'onDelete':_0x4535('0x171')});db[_0x4535('0x56')][_0x4535('0x147')](db['SmsQueue'],{'onDelete':_0x4535('0x171')});db[_0x4535('0x56')][_0x4535('0x147')](db[_0x4535('0x138')],{'onDelete':'restrict'});db[_0x4535('0x56')][_0x4535('0x147')](db['Interval'],{'onDelete':_0x4535('0x171'),'foreignKey':'IntervalId'});db[_0x4535('0x56')][_0x4535('0x147')](db[_0x4535('0x16b')],{'onDelete':_0x4535('0x171'),'foreignKey':_0x4535('0x172')});db[_0x4535('0x58')]['hasMany'](db['SmsMessage'],{'as':_0x4535('0x15c'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x17c')});db[_0x4535('0x58')][_0x4535('0x147')](db[_0x4535('0x138')],{'as':_0x4535('0x167'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x4535('0x147')](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':_0x4535('0x158')});db['SmsInteraction'][_0x4535('0x147')](db[_0x4535('0x12')],{'as':_0x4535('0x168'),'foreignKey':'UserId'});db['SmsInteraction'][_0x4535('0x11a')](db[_0x4535('0x16b')],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0x4535('0x58')][_0x4535('0x11a')](db['Tag'],{'through':_0x4535('0x17d'),'as':'ThroughTags'});db[_0x4535('0x58')][_0x4535('0x11a')](db['User'],{'as':_0x4535('0x16d'),'through':_0x4535('0x17e'),'foreignKey':_0x4535('0x17c')});db[_0x4535('0x59')]['belongsTo'](db[_0x4535('0x12')],{'as':_0x4535('0x12')});db[_0x4535('0x59')][_0x4535('0x147')](db[_0x4535('0x74')],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x157')});db[_0x4535('0x59')][_0x4535('0x147')](db[_0x4535('0x58')],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x16e'),'foreignKey':'SmsInteractionId'});db[_0x4535('0x59')]['belongsTo'](db['SmsAccount'],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x17b')});db[_0x4535('0x5b')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':_0x4535('0x14f'),'through':_0x4535('0x12d'),'foreignKey':_0x4535('0x17f')});db[_0x4535('0x5b')][_0x4535('0x11a')](db[_0x4535('0x11f')],{'through':_0x4535('0x180'),'as':_0x4535('0x165')});db[_0x4535('0x5d')][_0x4535('0x113')](db[_0x4535('0x82')],{'as':'Dispositions','foreignKey':_0x4535('0x181'),'onDelete':_0x4535('0x110')});db[_0x4535('0x5d')][_0x4535('0x113')](db[_0x4535('0x81')],{'as':_0x4535('0x182'),'foreignKey':_0x4535('0x181')});db[_0x4535('0x5d')][_0x4535('0x113')](db['OpenchannelInteraction'],{'as':_0x4535('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0x4535('0x5d')][_0x4535('0x113')](db['OpenchannelMessage'],{'as':_0x4535('0x15c'),'foreignKey':_0x4535('0x181')});db[_0x4535('0x5d')][_0x4535('0x113')](db[_0x4535('0x5f')],{'as':_0x4535('0x15f'),'foreignKey':_0x4535('0x181')});db[_0x4535('0x5d')][_0x4535('0x147')](db[_0x4535('0x130')],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161')});db['OpenchannelAccount'][_0x4535('0x147')](db[_0x4535('0x87')],{'as':_0x4535('0x14c'),'foreignKey':_0x4535('0x14d')});db[_0x4535('0x5d')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':_0x4535('0x14f'),'through':_0x4535('0x137')});db['OpenchannelApplication'][_0x4535('0x147')](db[_0x4535('0x12')],{'onDelete':_0x4535('0x171')});db[_0x4535('0x5f')]['belongsTo'](db[_0x4535('0x64')],{'onDelete':_0x4535('0x171'),'foreignKey':'OpenchannelQueueId'});db[_0x4535('0x5f')][_0x4535('0x147')](db[_0x4535('0x5d')],{'onDelete':_0x4535('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x4535('0x5f')][_0x4535('0x147')](db[_0x4535('0x85')],{'onDelete':_0x4535('0x171'),'foreignKey':_0x4535('0x14b')});db['OpenchannelApplication'][_0x4535('0x147')](db[_0x4535('0x16b')],{'onDelete':_0x4535('0x171'),'foreignKey':_0x4535('0x172')});db[_0x4535('0x61')][_0x4535('0x113')](db[_0x4535('0x183')],{'as':_0x4535('0x15c'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x184')});db[_0x4535('0x61')][_0x4535('0x147')](db['OpenchannelAccount'],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x181')});db[_0x4535('0x61')][_0x4535('0x147')](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':_0x4535('0x158')});db['OpenchannelInteraction'][_0x4535('0x147')](db['User'],{'as':_0x4535('0x168'),'foreignKey':_0x4535('0x111')});db['OpenchannelInteraction'][_0x4535('0x11a')](db['Tag'],{'through':_0x4535('0x185'),'as':_0x4535('0x16a')});db[_0x4535('0x61')][_0x4535('0x11a')](db[_0x4535('0x16b')],{'through':_0x4535('0x185'),'as':_0x4535('0x16c')});db[_0x4535('0x61')]['belongsToMany'](db[_0x4535('0x12')],{'as':_0x4535('0x16d'),'through':_0x4535('0x127'),'foreignKey':_0x4535('0x184')});db[_0x4535('0x183')][_0x4535('0x147')](db['User'],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x12')});db['OpenchannelMessage'][_0x4535('0x147')](db['CmContact'],{'onDelete':'cascade','as':_0x4535('0x157')});db[_0x4535('0x183')][_0x4535('0x147')](db[_0x4535('0x61')],{'onDelete':'cascade','as':_0x4535('0x16e'),'foreignKey':_0x4535('0x184')});db['OpenchannelMessage']['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x4535('0x178')});db[_0x4535('0x183')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x181')});db[_0x4535('0x64')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x4535('0x37'),'foreignKey':'OpenchannelQueueId'});db[_0x4535('0x64')]['belongsToMany'](db[_0x4535('0x11f')],{'through':'team_has_openchannel_queues','as':_0x4535('0x165')});db[_0x4535('0x65')][_0x4535('0x113')](db['Disposition'],{'as':_0x4535('0x17a'),'foreignKey':_0x4535('0x16f'),'onDelete':'cascade'});db[_0x4535('0x65')][_0x4535('0x113')](db['CannedAnswer'],{'as':_0x4535('0x182'),'foreignKey':_0x4535('0x16f')});db['ChatWebsite']['hasMany'](db[_0x4535('0x71')],{'as':_0x4535('0x186')});db[_0x4535('0x65')][_0x4535('0x113')](db[_0x4535('0x68')],{'as':_0x4535('0x15d')});db[_0x4535('0x65')][_0x4535('0x113')](db[_0x4535('0x187')],{'as':_0x4535('0x15f')});db[_0x4535('0x65')]['hasMany'](db['ChatMessage'],{'as':'Messages'});db[_0x4535('0x65')][_0x4535('0x147')](db[_0x4535('0x130')],{'as':_0x4535('0x160'),'foreignKey':'ListId'});db[_0x4535('0x65')][_0x4535('0x147')](db[_0x4535('0x85')],{'as':'Interval','foreignKey':_0x4535('0x14b')});db[_0x4535('0x65')][_0x4535('0x147')](db[_0x4535('0x3d')],{'as':_0x4535('0x3d'),'foreignKey':_0x4535('0x159')});db[_0x4535('0x65')][_0x4535('0x147')](db[_0x4535('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x4535('0x14d')});db[_0x4535('0x65')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':'Agents','through':_0x4535('0x133')});db['OpenchannelQueueReport'][_0x4535('0x147')](db['OpenchannelAccount'],{});db[_0x4535('0x188')][_0x4535('0x147')](db[_0x4535('0x130')],{'as':'List','foreignKey':'ListId'});db[_0x4535('0x188')]['belongsTo'](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':'ContactId'});db[_0x4535('0x188')][_0x4535('0x147')](db[_0x4535('0x61')],{});db[_0x4535('0x188')][_0x4535('0x147')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x4535('0x147')](db['User'],{});db['OpenchannelQueueReport'][_0x4535('0x147')](db[_0x4535('0x64')],{});db[_0x4535('0x187')][_0x4535('0x147')](db[_0x4535('0x12')],{'as':_0x4535('0x189'),'foreignKey':'UserId','onDelete':'restrict'});db[_0x4535('0x187')]['belongsTo'](db[_0x4535('0x6d')],{'as':_0x4535('0x18a'),'foreignKey':'ChatQueueId','onDelete':_0x4535('0x171')});db[_0x4535('0x187')][_0x4535('0x147')](db[_0x4535('0x65')],{'as':_0x4535('0x18b'),'foreignKey':_0x4535('0x16f'),'onDelete':'restrict'});db[_0x4535('0x187')]['belongsTo'](db[_0x4535('0x16b')],{'onDelete':'restrict','foreignKey':_0x4535('0x172')});db[_0x4535('0x68')]['hasMany'](db[_0x4535('0x69')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x4535('0x18c')});db['ChatInteraction'][_0x4535('0x147')](db[_0x4535('0x65')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x4535('0x68')][_0x4535('0x147')](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':'ContactId'});db[_0x4535('0x68')][_0x4535('0x147')](db[_0x4535('0x12')],{'as':_0x4535('0x168'),'foreignKey':_0x4535('0x111')});db[_0x4535('0x68')]['belongsToMany'](db[_0x4535('0x16b')],{'through':_0x4535('0x18d'),'as':_0x4535('0x16a')});db[_0x4535('0x68')][_0x4535('0x11a')](db['Tag'],{'through':_0x4535('0x18d'),'as':_0x4535('0x16c')});db['ChatInteraction'][_0x4535('0x11a')](db['User'],{'as':_0x4535('0x16d'),'through':_0x4535('0x123'),'foreignKey':_0x4535('0x18c')});db[_0x4535('0x69')][_0x4535('0x147')](db[_0x4535('0x12')],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x12')});db[_0x4535('0x69')][_0x4535('0x147')](db['CmContact'],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x157'),'foreignKey':'ContactId'});db[_0x4535('0x69')][_0x4535('0x147')](db[_0x4535('0x68')],{'onDelete':_0x4535('0x110'),'as':'Interaction','foreignKey':_0x4535('0x18c')});db[_0x4535('0x69')]['belongsTo'](db[_0x4535('0xef')],{'as':_0x4535('0xef'),'foreignKey':_0x4535('0x178')});db[_0x4535('0x69')][_0x4535('0x147')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x4535('0x16f')});db[_0x4535('0x6b')][_0x4535('0x113')](db[_0x4535('0xef')],{'as':_0x4535('0x18e'),'foreignKey':_0x4535('0x170'),'onDelete':'cascade','hooks':!![]});db[_0x4535('0x6b')][_0x4535('0x147')](db['CmContact'],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x157'),'foreignKey':_0x4535('0x158')});db[_0x4535('0x6b')][_0x4535('0x147')](db[_0x4535('0x65')],{'as':'Account','foreignKey':_0x4535('0x16f')});db[_0x4535('0x6d')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':_0x4535('0x14f'),'through':_0x4535('0x31'),'hooks':!![]});db[_0x4535('0x6d')][_0x4535('0x11a')](db[_0x4535('0x11f')],{'through':_0x4535('0x18f'),'as':_0x4535('0x165')});db[_0x4535('0x6f')][_0x4535('0x113')](db[_0x4535('0xd8')],{'as':_0x4535('0x15c'),'foreignKey':_0x4535('0x190'),'onDelete':'cascade'});db[_0x4535('0x6f')]['belongsToMany'](db['User'],{'as':_0x4535('0x141'),'through':_0x4535('0x11c')});db['ChatProactiveAction'][_0x4535('0x147')](db[_0x4535('0x65')],{'as':_0x4535('0x18b'),'foreignKey':_0x4535('0x16f')});db['CmCompany']['hasMany'](db['CmContact'],{'as':_0x4535('0x191'),'foreignKey':_0x4535('0x192')});db[_0x4535('0x74')][_0x4535('0x113')](db['CmContactHasItem'],{'as':_0x4535('0x193'),'foreignKey':'CmContactId'});db[_0x4535('0x74')][_0x4535('0x113')](db[_0x4535('0x76')],{'as':_0x4535('0x143'),'foreignKey':_0x4535('0x158')});db[_0x4535('0x74')]['hasMany'](db[_0x4535('0x7a')],{'as':_0x4535('0x114'),'foreignKey':_0x4535('0x158')});db[_0x4535('0x74')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x4535('0x74')]['hasMany'](db['ReportAgentPreview'],{'as':_0x4535('0x7d'),'foreignKey':_0x4535('0x158')});db[_0x4535('0x74')][_0x4535('0x113')](db[_0x4535('0xdd')],{'as':_0x4535('0x146'),'foreignKey':_0x4535('0x158')});db[_0x4535('0x74')][_0x4535('0x113')](db[_0x4535('0x61')],{'as':_0x4535('0x126'),'foreignKey':_0x4535('0x158'),'onDelete':_0x4535('0x171')});db[_0x4535('0x74')][_0x4535('0x113')](db[_0x4535('0x68')],{'as':_0x4535('0x122'),'foreignKey':_0x4535('0x158'),'onDelete':_0x4535('0x171')});db['CmContact'][_0x4535('0x113')](db[_0x4535('0x58')],{'as':'SmsInteractions','foreignKey':_0x4535('0x158'),'onDelete':_0x4535('0x171')});db[_0x4535('0x74')][_0x4535('0x113')](db['FaxInteraction'],{'as':_0x4535('0x124'),'foreignKey':_0x4535('0x158'),'onDelete':_0x4535('0x171')});db['CmContact'][_0x4535('0x113')](db[_0x4535('0x42')],{'as':_0x4535('0x117'),'foreignKey':_0x4535('0x158'),'onDelete':_0x4535('0x171')});db[_0x4535('0x74')][_0x4535('0x147')](db[_0x4535('0x194')],{'as':_0x4535('0x195'),'foreignKey':_0x4535('0x192')});db[_0x4535('0x74')][_0x4535('0x147')](db[_0x4535('0x130')],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161'),'onDelete':_0x4535('0x110')});db[_0x4535('0x74')]['belongsToMany'](db[_0x4535('0x12')],{'as':'Users','through':_0x4535('0x11d')});db[_0x4535('0x74')][_0x4535('0x11a')](db[_0x4535('0x16b')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x4535('0x74')][_0x4535('0x11a')](db[_0x4535('0x16b')],{'through':_0x4535('0x196'),'as':_0x4535('0x16c')});db[_0x4535('0x76')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0x4535('0x197'),'foreignKey':_0x4535('0x198')});db['CmHopper']['belongsTo'](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':'ContactId','onDelete':_0x4535('0x110')});db['CmHopper'][_0x4535('0x147')](db[_0x4535('0x130')],{'as':'List','foreignKey':'ListId','onDelete':_0x4535('0x110')});db['CmHopper'][_0x4535('0x147')](db[_0x4535('0x12')],{'as':'Agent','foreignKey':_0x4535('0x111')});db[_0x4535('0x76')][_0x4535('0x147')](db[_0x4535('0x1b')],{'as':_0x4535('0x18a'),'foreignKey':_0x4535('0x142'),'onDelete':_0x4535('0x110')});db['CmHopper'][_0x4535('0x147')](db['Campaign'],{'as':_0x4535('0x199'),'foreignKey':_0x4535('0x19a'),'onDelete':_0x4535('0x110')});db['CmHopper'][_0x4535('0x147')](db[_0x4535('0x12')],{'as':_0x4535('0x168'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x4535('0x147')](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':_0x4535('0x158'),'onDelete':_0x4535('0x110')});db[_0x4535('0x78')][_0x4535('0x147')](db['CmList'],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161'),'onDelete':'cascade'});db['CmHopperBlack'][_0x4535('0x147')](db[_0x4535('0x1b')],{'as':_0x4535('0x18a'),'foreignKey':_0x4535('0x142'),'onDelete':_0x4535('0x110')});db[_0x4535('0x78')][_0x4535('0x147')](db[_0x4535('0x199')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x4535('0x110')});db[_0x4535('0x19b')]['hasMany'](db['Condition'],{'as':{'plural':'All','singular':_0x4535('0x19c')},'foreignKey':_0x4535('0x19d'),'onDelete':'cascade','hooks':!![]});db[_0x4535('0x19b')][_0x4535('0x113')](db[_0x4535('0x19e')],{'as':{'plural':_0x4535('0x19f'),'singular':_0x4535('0x1a0')},'foreignKey':_0x4535('0x1a1'),'onDelete':_0x4535('0x110'),'hooks':!![]});db[_0x4535('0x19b')][_0x4535('0x113')](db['Action'],{'as':_0x4535('0x1a2'),'foreignKey':_0x4535('0x1a3'),'onDelete':_0x4535('0x110'),'hooks':!![]});db['Disposition']['hasMany'](db[_0x4535('0x82')],{'as':_0x4535('0x17a'),'foreignKey':_0x4535('0x1a4'),'onDelete':_0x4535('0x110')});db[_0x4535('0x85')]['hasMany'](db[_0x4535('0x85')],{'as':_0x4535('0x1a5'),'foreignKey':_0x4535('0x14b'),'onDelete':_0x4535('0x110'),'hooks':!![],'required':![]});db[_0x4535('0x85')][_0x4535('0x113')](db['VoiceExtension'],{'as':_0x4535('0x1a6'),'foreignKey':_0x4535('0x14b'),'onDelete':_0x4535('0x171')});db['Interval'][_0x4535('0x113')](db[_0x4535('0x15e')],{'as':_0x4535('0x1a7'),'foreignKey':_0x4535('0x14b')});db['Interval'][_0x4535('0x113')](db[_0x4535('0x187')],{'as':_0x4535('0x1a8'),'foreignKey':_0x4535('0x14b')});db[_0x4535('0x85')]['hasMany'](db[_0x4535('0x4d')],{'as':'FaxApplications','foreignKey':_0x4535('0x14b')});db[_0x4535('0x85')][_0x4535('0x113')](db['SmsApplication'],{'as':_0x4535('0x1a9'),'foreignKey':'IntervalId'});db[_0x4535('0x8c')][_0x4535('0x147')](db[_0x4535('0x3d')],{});db[_0x4535('0x8c')][_0x4535('0x147')](db['AnalyticDefaultReport'],{'foreignKey':_0x4535('0x1aa')});db[_0x4535('0x8c')]['belongsTo'](db[_0x4535('0x9b')],{'foreignKey':_0x4535('0x1ab')});db[_0x4535('0x8d')][_0x4535('0x11a')](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x4535('0x140'),'onDelete':_0x4535('0x171')});db[_0x4535('0x16b')][_0x4535('0x11a')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x4535('0x16b')][_0x4535('0x11a')](db[_0x4535('0x68')],{'through':_0x4535('0x18d')});db[_0x4535('0x16b')][_0x4535('0x11a')](db[_0x4535('0x42')],{'through':_0x4535('0x169')});db[_0x4535('0x16b')][_0x4535('0x11a')](db[_0x4535('0x58')],{'through':_0x4535('0x17d')});db[_0x4535('0x16b')][_0x4535('0x11a')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x4535('0x16b')][_0x4535('0x11a')](db['OpenchannelInteraction'],{'through':_0x4535('0x185')});db[_0x4535('0x16b')][_0x4535('0x11a')](db[_0x4535('0x100')],{'through':_0x4535('0x1ac')});db[_0x4535('0x8f')]['belongsTo'](db[_0x4535('0x1ad')],{'as':_0x4535('0x1ae'),'foreignKey':_0x4535('0x1af')});db['CmHopperAdditionalPhone'][_0x4535('0x147')](db[_0x4535('0x76')],{'as':_0x4535('0x1b0'),'foreignKey':'CmHopperId'});db[_0x4535('0x93')][_0x4535('0x113')](db[_0x4535('0x19e')],{'as':{'plural':_0x4535('0x1b1'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x4535('0x110'),'hooks':!![]});db[_0x4535('0x93')][_0x4535('0x113')](db[_0x4535('0x19e')],{'as':{'plural':_0x4535('0x1b2'),'singular':'AnyCondition'},'foreignKey':_0x4535('0x1b3'),'onDelete':_0x4535('0x110'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':_0x4535('0x1a2'),'foreignKey':_0x4535('0x1b4'),'onDelete':_0x4535('0x110'),'hooks':!![]});db[_0x4535('0x9b')][_0x4535('0x113')](db['AnalyticFieldReport'],{'as':_0x4535('0x1b5'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1ab'),'hooks':!![]});db[_0x4535('0x9d')]['hasMany'](db[_0x4535('0xa1')],{'as':_0x4535('0x1b5'),'onDelete':'cascade','foreignKey':_0x4535('0x1aa')});db[_0x4535('0x9f')]['hasMany'](db[_0x4535('0xa1')],{'as':'Fields','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b6')});db['AnalyticFieldReport'][_0x4535('0x147')](db[_0x4535('0x9f')],{'foreignKey':_0x4535('0x1b6')});db[_0x4535('0xa5')][_0x4535('0x113')](db[_0x4535('0xa7')],{'as':_0x4535('0x1b7'),'onDelete':'cascade','foreignKey':_0x4535('0x1b8')});db['SalesforceConfiguration'][_0x4535('0x113')](db[_0x4535('0xa9')],{'as':'Subjects','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b9')});db['SalesforceConfiguration'][_0x4535('0x113')](db[_0x4535('0xa9')],{'as':_0x4535('0x1ba'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1bb')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1bc')});db[_0x4535('0xa7')][_0x4535('0x147')](db['SalesforceAccount'],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x1b8')});db[_0x4535('0xa9')]['hasMany'](db['SalesforceField'],{'as':_0x4535('0x1bd'),'foreignKey':_0x4535('0x1b9')});db[_0x4535('0xa9')][_0x4535('0x113')](db[_0x4535('0xa9')],{'as':_0x4535('0x1be'),'foreignKey':'DescriptionId'});db[_0x4535('0xa9')]['hasMany'](db[_0x4535('0xa9')],{'as':_0x4535('0x1bf'),'foreignKey':'FieldId'});db[_0x4535('0xa9')][_0x4535('0x147')](db['Variable'],{'as':_0x4535('0x95'),'foreignKey':_0x4535('0x1c0')});db[_0x4535('0xab')]['hasMany'](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b8')});db[_0x4535('0xad')][_0x4535('0x113')](db[_0x4535('0xaf')],{'as':'Subjects','onDelete':_0x4535('0x110'),'foreignKey':'SubjectId'});db[_0x4535('0xad')][_0x4535('0x113')](db[_0x4535('0xaf')],{'as':_0x4535('0x1ba'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1bb')});db[_0x4535('0xad')][_0x4535('0x113')](db[_0x4535('0xaf')],{'as':_0x4535('0x1b5'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1bc')});db[_0x4535('0xad')][_0x4535('0x147')](db['SugarcrmAccount'],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x1b8')});db[_0x4535('0xaf')][_0x4535('0x113')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x4535('0x1b9')});db['SugarcrmField'][_0x4535('0x113')](db[_0x4535('0xaf')],{'as':_0x4535('0x1be'),'foreignKey':_0x4535('0x1bb')});db['SugarcrmField']['hasMany'](db[_0x4535('0xaf')],{'as':_0x4535('0x1bf'),'foreignKey':_0x4535('0x1bc')});db[_0x4535('0xaf')][_0x4535('0x147')](db[_0x4535('0x95')],{'as':_0x4535('0x95'),'foreignKey':_0x4535('0x1c0')});db[_0x4535('0xb1')][_0x4535('0x113')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b8')});db['DeskConfiguration'][_0x4535('0x113')](db['DeskField'],{'as':'Subjects','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b9')});db[_0x4535('0x1c1')][_0x4535('0x113')](db[_0x4535('0x1c2')],{'as':_0x4535('0x1ba'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1bb')});db[_0x4535('0x1c1')][_0x4535('0x113')](db[_0x4535('0x1c2')],{'as':_0x4535('0x1b5'),'onDelete':'cascade','foreignKey':_0x4535('0x1bc')});db[_0x4535('0x1c1')][_0x4535('0x147')](db[_0x4535('0xb1')],{'as':'Account','foreignKey':_0x4535('0x1b8')});db[_0x4535('0x1c1')][_0x4535('0x11a')](db[_0x4535('0x16b')],{'through':_0x4535('0x1c3')});db[_0x4535('0x1c2')][_0x4535('0x113')](db['DeskField'],{'as':_0x4535('0x1bd'),'foreignKey':_0x4535('0x1b9')});db[_0x4535('0x1c2')]['hasMany'](db[_0x4535('0x1c2')],{'as':_0x4535('0x1be'),'foreignKey':'DescriptionId'});db[_0x4535('0x1c2')][_0x4535('0x113')](db[_0x4535('0x1c2')],{'as':_0x4535('0x1bf'),'foreignKey':_0x4535('0x1bc')});db[_0x4535('0x1c2')][_0x4535('0x147')](db[_0x4535('0x95')],{'as':_0x4535('0x95'),'foreignKey':_0x4535('0x1c0')});db[_0x4535('0xb4')][_0x4535('0x113')](db[_0x4535('0xb6')],{'as':_0x4535('0x1b7'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b8')});db[_0x4535('0xb6')][_0x4535('0x113')](db[_0x4535('0xb8')],{'as':_0x4535('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x4535('0x113')](db[_0x4535('0xb8')],{'as':_0x4535('0x1ba'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1bb')});db[_0x4535('0xb6')][_0x4535('0x113')](db[_0x4535('0xb8')],{'as':_0x4535('0x1b5'),'onDelete':_0x4535('0x110'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0x4535('0x147')](db[_0x4535('0xb4')],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x1b8')});db['ZohoField'][_0x4535('0x113')](db[_0x4535('0xb8')],{'as':_0x4535('0x1bd'),'foreignKey':_0x4535('0x1b9')});db['ZohoField'][_0x4535('0x113')](db[_0x4535('0xb8')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0x4535('0x113')](db[_0x4535('0xb8')],{'as':_0x4535('0x1bf'),'foreignKey':_0x4535('0x1bc')});db[_0x4535('0xb8')][_0x4535('0x147')](db[_0x4535('0x95')],{'as':_0x4535('0x95'),'foreignKey':_0x4535('0x1c0')});db[_0x4535('0xba')][_0x4535('0x113')](db['ZendeskConfiguration'],{'as':_0x4535('0x1b7'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b8')});db['ZendeskConfiguration']['hasMany'](db[_0x4535('0x1c5')],{'as':_0x4535('0x1c4'),'foreignKey':_0x4535('0x1b9')});db['ZendeskConfiguration'][_0x4535('0x113')](db[_0x4535('0x1c5')],{'as':_0x4535('0x1ba'),'foreignKey':_0x4535('0x1bb')});db[_0x4535('0xbc')][_0x4535('0x113')](db[_0x4535('0x1c5')],{'as':_0x4535('0x1b5'),'foreignKey':_0x4535('0x1bc')});db[_0x4535('0xbc')][_0x4535('0x147')](db[_0x4535('0xba')],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x1b8')});db[_0x4535('0xbc')][_0x4535('0x11a')](db[_0x4535('0x16b')],{'through':_0x4535('0x1c6')});db[_0x4535('0x1c5')][_0x4535('0x113')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4535('0x1c5')][_0x4535('0x113')](db[_0x4535('0x1c5')],{'as':_0x4535('0x1be'),'foreignKey':'DescriptionId'});db[_0x4535('0x1c5')][_0x4535('0x113')](db[_0x4535('0x1c5')],{'as':'Field','foreignKey':_0x4535('0x1bc')});db['ZendeskField'][_0x4535('0x147')](db[_0x4535('0x95')],{'as':_0x4535('0x95'),'foreignKey':_0x4535('0x1c0')});db[_0x4535('0xbf')][_0x4535('0x113')](db[_0x4535('0x1c7')],{'as':'Configurations','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b8')});db[_0x4535('0x1c7')][_0x4535('0x113')](db[_0x4535('0x1c8')],{'as':_0x4535('0x1c4'),'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b9')});db[_0x4535('0x1c7')][_0x4535('0x113')](db[_0x4535('0x1c8')],{'as':_0x4535('0x1ba'),'onDelete':_0x4535('0x110'),'foreignKey':'DescriptionId'});db[_0x4535('0x1c7')][_0x4535('0x113')](db[_0x4535('0x1c8')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x4535('0x1c7')][_0x4535('0x147')](db[_0x4535('0xbf')],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x1b8')});db[_0x4535('0x1c7')][_0x4535('0x11a')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0x4535('0x1c8')][_0x4535('0x113')](db[_0x4535('0x1c8')],{'as':_0x4535('0x1bd'),'foreignKey':_0x4535('0x1b9')});db[_0x4535('0x1c8')][_0x4535('0x113')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x4535('0x113')](db[_0x4535('0x1c8')],{'as':'Field','foreignKey':_0x4535('0x1bc')});db[_0x4535('0x1c8')][_0x4535('0x147')](db[_0x4535('0x95')],{'as':_0x4535('0x95'),'foreignKey':_0x4535('0x1c0')});db['VtigerAccount'][_0x4535('0x113')](db[_0x4535('0xc4')],{'as':_0x4535('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db['VtigerConfiguration']['hasMany'](db[_0x4535('0xc6')],{'as':_0x4535('0x1c4'),'foreignKey':'SubjectId'});db[_0x4535('0xc4')]['hasMany'](db[_0x4535('0xc6')],{'as':_0x4535('0x1ba'),'foreignKey':'DescriptionId'});db[_0x4535('0xc4')][_0x4535('0x113')](db[_0x4535('0xc6')],{'as':_0x4535('0x1b5'),'foreignKey':_0x4535('0x1bc')});db[_0x4535('0xc4')]['belongsTo'](db[_0x4535('0xc2')],{'as':_0x4535('0x167'),'foreignKey':'AccountId'});db[_0x4535('0xc6')][_0x4535('0x113')](db[_0x4535('0xc6')],{'as':_0x4535('0x1bd'),'foreignKey':_0x4535('0x1b9')});db[_0x4535('0xc6')][_0x4535('0x113')](db[_0x4535('0xc6')],{'as':_0x4535('0x1be'),'foreignKey':_0x4535('0x1bb')});db[_0x4535('0xc6')][_0x4535('0x113')](db[_0x4535('0xc6')],{'as':'Field','foreignKey':_0x4535('0x1bc')});db['VtigerField']['belongsTo'](db[_0x4535('0x95')],{'as':_0x4535('0x95'),'foreignKey':_0x4535('0x1c0')});db[_0x4535('0xc8')]['hasMany'](db[_0x4535('0xca')],{'as':'Configurations','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1b8')});db['ServicenowConfiguration']['hasMany'](db[_0x4535('0xcb')],{'as':_0x4535('0x1c4'),'foreignKey':_0x4535('0x1b9')});db[_0x4535('0xca')]['hasMany'](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x4535('0x1bb')});db[_0x4535('0xca')]['hasMany'](db[_0x4535('0xcb')],{'as':'Fields','foreignKey':_0x4535('0x1bc')});db['ServicenowConfiguration'][_0x4535('0x147')](db[_0x4535('0xc8')],{'as':'Account','foreignKey':_0x4535('0x1b8')});db[_0x4535('0xcb')][_0x4535('0x113')](db['ServicenowField'],{'as':_0x4535('0x1bd'),'foreignKey':'SubjectId'});db[_0x4535('0xcb')][_0x4535('0x113')](db[_0x4535('0xcb')],{'as':_0x4535('0x1be'),'foreignKey':'DescriptionId'});db[_0x4535('0xcb')][_0x4535('0x113')](db[_0x4535('0xcb')],{'as':_0x4535('0x1bf'),'foreignKey':_0x4535('0x1bc')});db[_0x4535('0xcb')][_0x4535('0x147')](db[_0x4535('0x95')],{'as':_0x4535('0x95'),'foreignKey':'VariableId'});db['Dynamics365Account']['hasMany'](db[_0x4535('0x1c9')],{'as':_0x4535('0x1b7'),'onDelete':'cascade','foreignKey':_0x4535('0x1b8')});db['Dynamics365Configuration'][_0x4535('0x113')](db[_0x4535('0xce')],{'as':_0x4535('0x1c4'),'onDelete':_0x4535('0x110'),'foreignKey':'SubjectId'});db[_0x4535('0x1c9')]['hasMany'](db[_0x4535('0xce')],{'as':_0x4535('0x1ba'),'onDelete':_0x4535('0x110'),'foreignKey':'DescriptionId'});db[_0x4535('0x1c9')][_0x4535('0x113')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1bc')});db['Dynamics365Configuration'][_0x4535('0x147')](db[_0x4535('0x1ca')],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x1b8')});db['Dynamics365Field']['hasMany'](db[_0x4535('0xce')],{'as':'Subject','foreignKey':_0x4535('0x1b9')});db[_0x4535('0xce')][_0x4535('0x113')](db[_0x4535('0xce')],{'as':'Description','foreignKey':_0x4535('0x1bb')});db[_0x4535('0xce')][_0x4535('0x113')](db[_0x4535('0xce')],{'as':_0x4535('0x1bf'),'foreignKey':'FieldId'});db[_0x4535('0xce')][_0x4535('0x147')](db[_0x4535('0x95')],{'as':_0x4535('0x95'),'foreignKey':_0x4535('0x1c0')});db['FreshsalesAccount'][_0x4535('0x113')](db[_0x4535('0xd1')],{'as':_0x4535('0x1b7'),'onDelete':_0x4535('0x110'),'foreignKey':'AccountId'});db[_0x4535('0xd1')]['hasMany'](db[_0x4535('0xd3')],{'as':_0x4535('0x1c4'),'foreignKey':_0x4535('0x1b9')});db['FreshsalesConfiguration'][_0x4535('0x113')](db[_0x4535('0xd3')],{'as':_0x4535('0x1ba'),'foreignKey':'DescriptionId'});db[_0x4535('0xd1')][_0x4535('0x113')](db[_0x4535('0xd3')],{'as':_0x4535('0x1b5'),'foreignKey':_0x4535('0x1bc')});db[_0x4535('0xd1')][_0x4535('0x147')](db[_0x4535('0xcf')],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x1b8')});db[_0x4535('0xd3')][_0x4535('0x113')](db['FreshsalesField'],{'as':_0x4535('0x1bd'),'foreignKey':'SubjectId'});db[_0x4535('0xd3')][_0x4535('0x113')](db[_0x4535('0xd3')],{'as':'Description','foreignKey':_0x4535('0x1bb')});db['FreshsalesField']['hasMany'](db[_0x4535('0xd3')],{'as':'Field','foreignKey':_0x4535('0x1bc')});db['FreshsalesField'][_0x4535('0x147')](db[_0x4535('0x95')],{'as':_0x4535('0x95'),'foreignKey':_0x4535('0x1c0')});db['ChatQueueReport']['belongsTo'](db[_0x4535('0x65')],{});db['ChatQueueReport'][_0x4535('0x147')](db[_0x4535('0x130')],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161')});db[_0x4535('0xd6')][_0x4535('0x147')](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':_0x4535('0x158')});db[_0x4535('0xd6')][_0x4535('0x147')](db[_0x4535('0x68')],{});db[_0x4535('0xd6')][_0x4535('0x147')](db[_0x4535('0x69')],{});db['ChatQueueReport']['belongsTo'](db[_0x4535('0x12')],{});db[_0x4535('0xd6')]['belongsTo'](db[_0x4535('0x6d')],{});db[_0x4535('0xd8')]['belongsTo'](db[_0x4535('0x12')],{'onDelete':_0x4535('0x110'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x4535('0x147')](db[_0x4535('0x12')],{'onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x1cb')});db[_0x4535('0xdd')][_0x4535('0x113')](db[_0x4535('0xdb')],{'foreignKey':'SessionId','onDelete':'cascade'});db['JscriptySessionReport'][_0x4535('0x113')](db[_0x4535('0xd9')],{'foreignKey':_0x4535('0x1cc'),'onDelete':_0x4535('0x110')});db[_0x4535('0xdf')][_0x4535('0x147')](db[_0x4535('0x138')],{});db['SmsQueueReport'][_0x4535('0x147')](db['CmList'],{'as':_0x4535('0x160'),'foreignKey':_0x4535('0x161')});db[_0x4535('0xdf')][_0x4535('0x147')](db[_0x4535('0x74')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4535('0xdf')][_0x4535('0x147')](db[_0x4535('0x58')],{});db['SmsQueueReport'][_0x4535('0x147')](db[_0x4535('0x59')],{});db['SmsQueueReport'][_0x4535('0x147')](db[_0x4535('0x12')],{});db[_0x4535('0xdf')][_0x4535('0x147')](db['SmsQueue'],{});db['JscriptyProject'][_0x4535('0x113')](db[_0x4535('0xdd')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x4535('0x113')](db['JscriptyQuestionReport'],{'foreignKey':_0x4535('0x1cd')});db[_0x4535('0x1ce')][_0x4535('0x113')](db[_0x4535('0xd9')],{'foreignKey':'ProjectId'});db[_0x4535('0xe6')][_0x4535('0x11a')](db['User'],{'as':_0x4535('0x16d'),'through':_0x4535('0x13d')});db['Team'][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':'Agents','through':_0x4535('0x120')});db[_0x4535('0x11f')][_0x4535('0x11a')](db[_0x4535('0x1b')],{'through':_0x4535('0x10c'),'as':_0x4535('0x129')});db[_0x4535('0x11f')][_0x4535('0x11a')](db[_0x4535('0x3f')],{'through':_0x4535('0x1cf'),'as':'MailQueues'});db[_0x4535('0x11f')][_0x4535('0x11a')](db[_0x4535('0x6d')],{'through':_0x4535('0x18f'),'as':'ChatQueues'});db[_0x4535('0x11f')][_0x4535('0x11a')](db[_0x4535('0x52')],{'through':_0x4535('0x179'),'as':_0x4535('0x12c')});db[_0x4535('0x11f')][_0x4535('0x11a')](db[_0x4535('0x5b')],{'through':_0x4535('0x180'),'as':_0x4535('0x1d0')});db[_0x4535('0x11f')][_0x4535('0x11a')](db[_0x4535('0x64')],{'through':_0x4535('0x1d1'),'as':_0x4535('0x12e')});db['Team']['belongsToMany'](db[_0x4535('0x107')],{'through':_0x4535('0x1d2'),'as':_0x4535('0x12f')});db[_0x4535('0x199')][_0x4535('0x113')](db[_0x4535('0x76')],{'as':_0x4535('0x143'),'foreignKey':_0x4535('0x19a')});db[_0x4535('0x199')][_0x4535('0x113')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x4535('0x19a')});db[_0x4535('0x199')][_0x4535('0x113')](db[_0x4535('0x7c')],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x4535('0x199')]['hasMany'](db[_0x4535('0x78')],{'as':_0x4535('0x145'),'foreignKey':_0x4535('0x19a')});db[_0x4535('0x199')][_0x4535('0x147')](db[_0x4535('0x2a')],{'as':_0x4535('0x2a'),'foreignKey':_0x4535('0x148')});db[_0x4535('0x199')][_0x4535('0x147')](db[_0x4535('0x2a')],{'as':_0x4535('0x149'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x4535('0x147')](db[_0x4535('0x85')],{'as':'Interval','foreignKey':_0x4535('0x14b')});db['Campaign'][_0x4535('0x147')](db[_0x4535('0xe6')],{'as':_0x4535('0xe6'),'foreignKey':_0x4535('0x1d3')});db['Campaign'][_0x4535('0x11a')](db[_0x4535('0x130')],{'as':_0x4535('0x1d4'),'through':_0x4535('0x1d5')});db[_0x4535('0x199')][_0x4535('0x11a')](db[_0x4535('0x130')],{'as':_0x4535('0x1d6'),'through':_0x4535('0x1d7')});db['Attachment']['belongsTo'](db[_0x4535('0x6b')],{'as':_0x4535('0x6b'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x4535('0x147')](db['MailMessage'],{});db[_0x4535('0xf1')][_0x4535('0x147')](db[_0x4535('0x42')],{});db[_0x4535('0xf1')]['belongsTo'](db[_0x4535('0x3d')],{'foreignKey':_0x4535('0x1d8'),'as':_0x4535('0x1d9')});db[_0x4535('0xf1')]['belongsTo'](db[_0x4535('0x12')],{'foreignKey':_0x4535('0x1da'),'as':_0x4535('0x1db')});db[_0x4535('0xf1')][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':_0x4535('0x1dc'),'as':_0x4535('0x1dd')});db[_0x4535('0xf1')][_0x4535('0x147')](db[_0x4535('0x3f')],{'foreignKey':_0x4535('0x1de'),'as':'ToQueue'});db[_0x4535('0xf1')][_0x4535('0x147')](db[_0x4535('0x3d')],{'foreignKey':'ToMailAccountId','as':_0x4535('0x1df')});db[_0x4535('0x1e0')][_0x4535('0x147')](db[_0x4535('0x69')],{});db[_0x4535('0x1e0')]['belongsTo'](db[_0x4535('0x68')],{});db[_0x4535('0x1e0')][_0x4535('0x147')](db[_0x4535('0x65')],{'foreignKey':_0x4535('0x1e1'),'as':_0x4535('0x1d9')});db[_0x4535('0x1e0')][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':'FromUserId','as':_0x4535('0x1db')});db['ChatTransferReport'][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':_0x4535('0x1dc'),'as':'ToAgent'});db[_0x4535('0x1e0')][_0x4535('0x147')](db[_0x4535('0x6d')],{'foreignKey':_0x4535('0x1e2'),'as':'ToQueue'});db['ChatTransferReport'][_0x4535('0x147')](db[_0x4535('0x65')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x4535('0xf3')][_0x4535('0x147')](db[_0x4535('0x175')],{});db[_0x4535('0xf3')][_0x4535('0x147')](db[_0x4535('0x4f')],{});db[_0x4535('0xf3')][_0x4535('0x147')](db[_0x4535('0x4b')],{'foreignKey':_0x4535('0x1e3'),'as':'FromAccount'});db['FaxTransferReport'][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':_0x4535('0x1da'),'as':_0x4535('0x1db')});db['FaxTransferReport'][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':_0x4535('0x1dc'),'as':_0x4535('0x1dd')});db['FaxTransferReport'][_0x4535('0x147')](db['FaxQueue'],{'foreignKey':_0x4535('0x1e4'),'as':'ToQueue'});db[_0x4535('0xf3')][_0x4535('0x147')](db[_0x4535('0x4b')],{'foreignKey':_0x4535('0x1e5'),'as':_0x4535('0x1df')});db[_0x4535('0xf5')][_0x4535('0x147')](db[_0x4535('0x183')],{});db[_0x4535('0xf5')][_0x4535('0x147')](db[_0x4535('0x61')],{});db['OpenchannelTransferReport'][_0x4535('0x147')](db[_0x4535('0x5d')],{'foreignKey':_0x4535('0x1e6'),'as':_0x4535('0x1d9')});db[_0x4535('0xf5')][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x4535('0xf5')][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':_0x4535('0x1dc'),'as':_0x4535('0x1dd')});db['OpenchannelTransferReport']['belongsTo'](db[_0x4535('0x64')],{'foreignKey':_0x4535('0x1e7'),'as':_0x4535('0x1e8')});db[_0x4535('0xf5')][_0x4535('0x147')](db[_0x4535('0x5d')],{'foreignKey':_0x4535('0x1e9'),'as':_0x4535('0x1df')});db[_0x4535('0xf7')][_0x4535('0x147')](db['SmsMessage'],{});db[_0x4535('0xf7')][_0x4535('0x147')](db[_0x4535('0x58')],{});db['SmsTransferReport'][_0x4535('0x147')](db[_0x4535('0x138')],{'foreignKey':_0x4535('0x1ea'),'as':'FromAccount'});db['SmsTransferReport'][_0x4535('0x147')](db['User'],{'foreignKey':_0x4535('0x1da'),'as':'FromAgent'});db['SmsTransferReport'][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':_0x4535('0x1dc'),'as':_0x4535('0x1dd')});db[_0x4535('0xf7')][_0x4535('0x147')](db[_0x4535('0x5b')],{'foreignKey':_0x4535('0x1eb'),'as':_0x4535('0x1e8')});db['SmsTransferReport'][_0x4535('0x147')](db[_0x4535('0x138')],{'foreignKey':_0x4535('0x1ec'),'as':_0x4535('0x1df')});db['CmList'][_0x4535('0x113')](db[_0x4535('0x82')],{'as':'Dispositions','foreignKey':_0x4535('0x161'),'onDelete':'cascade'});db[_0x4535('0x130')]['hasMany'](db['CmCustomField'],{'as':_0x4535('0x1ed'),'foreignKey':_0x4535('0x161')});db[_0x4535('0x130')][_0x4535('0x113')](db[_0x4535('0x74')],{'as':'Contacts','onDelete':_0x4535('0x110'),'foreignKey':_0x4535('0x161')});db[_0x4535('0x130')][_0x4535('0x113')](db['CmHopperFinal'],{'as':_0x4535('0x114'),'foreignKey':_0x4535('0x161')});db[_0x4535('0x130')][_0x4535('0x113')](db[_0x4535('0x7c')],{'as':_0x4535('0x115'),'foreignKey':_0x4535('0x161')});db['CmList']['hasMany'](db[_0x4535('0x7d')],{'as':_0x4535('0x7d'),'foreignKey':_0x4535('0x161')});db[_0x4535('0x130')][_0x4535('0x11a')](db['VoiceQueue'],{'as':'Queues','through':_0x4535('0x14e')});db[_0x4535('0x130')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':_0x4535('0x14f'),'through':'cm_user_has_lists'});db[_0x4535('0xf9')][_0x4535('0x113')](db[_0x4535('0x18')],{'as':_0x4535('0x1a6'),'onDelete':_0x4535('0x110')});db[_0x4535('0xf9')][_0x4535('0x11a')](db['User'],{'as':_0x4535('0x14f'),'through':_0x4535('0x131')});db[_0x4535('0xfb')]['hasMany'](db[_0x4535('0x12')],{'as':_0x4535('0x16d'),'foreignKey':_0x4535('0x1ee')});db[_0x4535('0xfb')]['hasMany'](db[_0x4535('0x1ef')],{'as':_0x4535('0x1f0'),'foreignKey':_0x4535('0x1ee'),'onDelete':_0x4535('0x110')});db[_0x4535('0x1ef')][_0x4535('0x113')](db['UserProfileResource'],{'as':_0x4535('0x1f1'),'foreignKey':_0x4535('0x1f2'),'onDelete':_0x4535('0x110')});db[_0x4535('0x1f3')][_0x4535('0x113')](db['Disposition'],{'as':_0x4535('0x17a'),'foreignKey':_0x4535('0x1f4'),'onDelete':_0x4535('0x110')});db[_0x4535('0x1f3')][_0x4535('0x113')](db[_0x4535('0x81')],{'as':_0x4535('0x182'),'foreignKey':_0x4535('0x1f4')});db[_0x4535('0x1f3')][_0x4535('0x113')](db[_0x4535('0x102')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x4535('0x1f3')][_0x4535('0x113')](db[_0x4535('0x100')],{'as':_0x4535('0x15d')});db[_0x4535('0x1f3')][_0x4535('0x113')](db[_0x4535('0x1f5')],{'as':'Applications'});db[_0x4535('0x1f3')][_0x4535('0x147')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x4535('0x1f3')]['belongsTo'](db[_0x4535('0x87')],{'as':_0x4535('0x14c'),'foreignKey':_0x4535('0x14d')});db[_0x4535('0x1f3')][_0x4535('0x11a')](db[_0x4535('0x12')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x4535('0x1f5')][_0x4535('0x147')](db[_0x4535('0x12')],{'onDelete':_0x4535('0x171')});db[_0x4535('0x1f5')]['belongsTo'](db[_0x4535('0x107')],{'onDelete':_0x4535('0x171')});db[_0x4535('0x1f5')][_0x4535('0x147')](db[_0x4535('0x1f3')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x4535('0x85')],{'onDelete':'restrict','foreignKey':_0x4535('0x14b')});db[_0x4535('0x1f5')][_0x4535('0x147')](db[_0x4535('0x16b')],{'onDelete':_0x4535('0x171'),'foreignKey':'TagId'});db[_0x4535('0x100')]['hasMany'](db[_0x4535('0x102')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x4535('0x1f6')});db[_0x4535('0x100')][_0x4535('0x147')](db[_0x4535('0x1f3')],{'as':_0x4535('0x167'),'foreignKey':_0x4535('0x1f4')});db['WhatsappInteraction'][_0x4535('0x147')](db[_0x4535('0x74')],{'as':'Contact','foreignKey':_0x4535('0x158')});db[_0x4535('0x100')][_0x4535('0x147')](db[_0x4535('0x12')],{'as':'Owner','foreignKey':_0x4535('0x111')});db['WhatsappInteraction']['belongsToMany'](db[_0x4535('0x16b')],{'through':_0x4535('0x1ac'),'as':'Tags'});db[_0x4535('0x100')][_0x4535('0x11a')](db[_0x4535('0x16b')],{'through':_0x4535('0x1ac'),'as':_0x4535('0x16c')});db['WhatsappInteraction']['belongsToMany'](db[_0x4535('0x12')],{'as':_0x4535('0x16d'),'through':_0x4535('0x128'),'foreignKey':_0x4535('0x1f6')});db[_0x4535('0x102')][_0x4535('0x147')](db[_0x4535('0x12')],{'as':_0x4535('0x12')});db[_0x4535('0x102')][_0x4535('0x147')](db[_0x4535('0x74')],{'onDelete':'cascade','as':_0x4535('0x157')});db[_0x4535('0x102')][_0x4535('0x147')](db['WhatsappInteraction'],{'onDelete':_0x4535('0x110'),'as':_0x4535('0x16e'),'foreignKey':_0x4535('0x1f6')});db[_0x4535('0x102')][_0x4535('0x147')](db[_0x4535('0x1f3')],{'as':'Account','foreignKey':_0x4535('0x1f4')});db[_0x4535('0x104')][_0x4535('0x147')](db[_0x4535('0x1f3')],{});db[_0x4535('0x104')][_0x4535('0x147')](db[_0x4535('0x130')],{'as':_0x4535('0x160'),'foreignKey':'ListId'});db[_0x4535('0x104')]['belongsTo'](db[_0x4535('0x74')],{'as':_0x4535('0x157'),'foreignKey':_0x4535('0x158')});db['WhatsappQueueReport'][_0x4535('0x147')](db[_0x4535('0x100')],{});db[_0x4535('0x104')]['belongsTo'](db['WhatsappQueue'],{});db[_0x4535('0x104')]['belongsTo'](db['WhatsappMessage'],{});db[_0x4535('0x104')][_0x4535('0x147')](db[_0x4535('0x12')],{});db[_0x4535('0x1f7')]['belongsTo'](db[_0x4535('0x102')],{});db[_0x4535('0x1f7')][_0x4535('0x147')](db[_0x4535('0x100')],{});db[_0x4535('0x1f7')][_0x4535('0x147')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x4535('0x1f7')][_0x4535('0x147')](db[_0x4535('0x1f3')],{'foreignKey':_0x4535('0x1f8'),'as':_0x4535('0x1df')});db[_0x4535('0x1f7')][_0x4535('0x147')](db[_0x4535('0x107')],{'foreignKey':_0x4535('0x1f9'),'as':'ToQueue'});db[_0x4535('0x1f7')][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':'FromUserId','as':_0x4535('0x1db')});db[_0x4535('0x1f7')][_0x4535('0x147')](db[_0x4535('0x12')],{'foreignKey':_0x4535('0x1dc'),'as':_0x4535('0x1dd')});db[_0x4535('0x107')]['belongsToMany'](db[_0x4535('0x12')],{'as':_0x4535('0x14f'),'through':_0x4535('0x38'),'foreignKey':_0x4535('0x1fa')});db[_0x4535('0x107')][_0x4535('0x11a')](db[_0x4535('0x11f')],{'through':'team_has_whatsapp_queues','as':_0x4535('0x165')});module[_0x4535('0x1fb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ee0b4f8..0e2452f 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bd7=['./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./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/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./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/square/reports','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','root','/demo','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','username','newPassword','apiKey','firstName','lastName','street','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','oldPassword','isArray','length','isPlainObject','@@{','replace','}@@','lodash','path','express','express-winston','./errors','./config/logger','api','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','role','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelInteraction','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','./api/integrationReport','/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/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields'];(function(_0xaca050,_0xdce6e1){var _0x25d17d=function(_0x29c23c){while(--_0x29c23c){_0xaca050['push'](_0xaca050['shift']());}};_0x25d17d(++_0xdce6e1);}(_0x2bd7,0xac));var _0x72bd=function(_0x50ba16,_0x31127f){_0x50ba16=_0x50ba16-0x0;var _0x5834b2=_0x2bd7[_0x50ba16];return _0x5834b2;};'use strict';var _=require(_0x72bd('0x0'));var path=require(_0x72bd('0x1'));var express=require(_0x72bd('0x2'));var ewinston=require(_0x72bd('0x3'));var util=require('util');var errors=require(_0x72bd('0x4'));var config=require('./config/environment');var logger=require(_0x72bd('0x5'))(_0x72bd('0x6'));var authLogger=require('./config/logger')(_0x72bd('0x7'));exports[_0x72bd('0x8')]=function(_0x4b1242){_0x4b1242[_0x72bd('0x9')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1110a9,_0x3ed92c){var _0x439f1c=_0x72bd('0xa');if(!_['isEmpty'](_0x1110a9['body'])){_0x439f1c+='\x20body=%s';var _0x41b637=_0x1110a9[_0x72bd('0xb')];maskSensitiveData(_0x41b637);}return util['format'](_0x439f1c,_0x1110a9['method'],_0x1110a9[_0x72bd('0xc')][_0x72bd('0xd')]?_0x1110a9[_0x72bd('0xc')][_0x72bd('0xd')]:_0x1110a9[_0x72bd('0xe')][_0x72bd('0xf')]||_0x1110a9['ip'],_0x1110a9[_0x72bd('0x10')],_0x3ed92c['statusCode'],_0x3ed92c[_0x72bd('0x11')],_0x1110a9['user']?_0x1110a9[_0x72bd('0x12')]['id']:null,_0x1110a9['user']?_0x1110a9[_0x72bd('0x12')][_0x72bd('0x13')]:null,_0x1110a9[_0x72bd('0x12')]?_0x1110a9[_0x72bd('0x12')]['role']:null,_0x41b637?util[_0x72bd('0x14')](_0x41b637,![],null):'');}}));_0x4b1242[_0x72bd('0x9')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x36f428,_0x109616){var _0x1b9bdb=_0x72bd('0x15');if(_0x36f428[_0x72bd('0xb')]&&_0x36f428[_0x72bd('0xb')]['device']&&_0x36f428[_0x72bd('0xb')][_0x72bd('0x16')]){_0x1b9bdb=_0x72bd('0x17');}return util[_0x72bd('0x18')](_0x1b9bdb,_0x36f428[_0x72bd('0x19')],_0x36f428[_0x72bd('0xc')]['x-forwarded-for']?_0x36f428['headers'][_0x72bd('0xd')]:_0x36f428[_0x72bd('0xe')][_0x72bd('0xf')]||_0x36f428['ip'],_0x36f428['url'],_0x109616['statusCode'],_0x109616[_0x72bd('0x11')],_0x36f428['user']?_0x36f428[_0x72bd('0x12')]['id']:null,_0x36f428[_0x72bd('0x12')]?_0x36f428[_0x72bd('0x12')][_0x72bd('0x13')]:null,_0x36f428['user']?_0x36f428[_0x72bd('0x12')][_0x72bd('0x1a')]:null,_0x36f428['body']&&_0x36f428[_0x72bd('0xb')][_0x72bd('0x1b')]?_0x36f428[_0x72bd('0xb')][_0x72bd('0x1b')]:_0x72bd('0x1c'),_0x36f428[_0x72bd('0xb')]&&_0x36f428[_0x72bd('0xb')][_0x72bd('0x16')]?_0x36f428[_0x72bd('0xb')][_0x72bd('0x16')]:'',_0x36f428[_0x72bd('0xb')]&&_0x36f428['body'][_0x72bd('0x1d')]?_0x36f428[_0x72bd('0xb')][_0x72bd('0x1d')]:'');},'ignoreRoute':function(_0x568960){var _0x1ca57=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1ca57[_0x72bd('0x1e')](_0x568960[_0x72bd('0x10')]);}}));_0x4b1242['use'](_0x72bd('0x1f'),require(_0x72bd('0x20')));_0x4b1242['use'](_0x72bd('0x21'),require('./api/voiceChanSpy'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x22'),require(_0x72bd('0x23')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x24'),require('./api/voiceExtension'));_0x4b1242[_0x72bd('0x9')]('/api/voice/mohs',require(_0x72bd('0x25')));_0x4b1242[_0x72bd('0x9')]('/api/voice/queues',require(_0x72bd('0x26')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x27'),require('./api/voiceRecording'));_0x4b1242[_0x72bd('0x9')]('/api/screen/recordings',require(_0x72bd('0x28')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x29'),require(_0x72bd('0x2a')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x2b'),require(_0x72bd('0x2c')));_0x4b1242['use'](_0x72bd('0x2d'),require(_0x72bd('0x2e')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x2f'),require(_0x72bd('0x30')));_0x4b1242[_0x72bd('0x9')]('/api/voice/agents/reports',require(_0x72bd('0x31')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x32'),require('./api/voiceQueueReport'));_0x4b1242['use'](_0x72bd('0x33'),require('./api/memberReport'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x34'),require('./api/trunk'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x35'),require('./api/voiceTransferReport'));_0x4b1242['use'](_0x72bd('0x36'),require(_0x72bd('0x37')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x38'),require('./api/mailAccount'));_0x4b1242['use'](_0x72bd('0x39'),require('./api/mailQueue'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x3a'),require(_0x72bd('0x3b')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x3c'),require(_0x72bd('0x3d')));_0x4b1242[_0x72bd('0x9')]('/api/mail/messages',require('./api/mailMessage'));_0x4b1242[_0x72bd('0x9')]('/api/mail/applications',require(_0x72bd('0x3e')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x3f'),require(_0x72bd('0x40')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x41'),require(_0x72bd('0x42')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x43'),require(_0x72bd('0x44')));_0x4b1242['use'](_0x72bd('0x45'),require(_0x72bd('0x46')));_0x4b1242[_0x72bd('0x9')]('/api/fax/applications',require(_0x72bd('0x47')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x48'),require(_0x72bd('0x49')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x4a'),require(_0x72bd('0x4b')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x4c'),require(_0x72bd('0x4d')));_0x4b1242['use']('/api/fax/reports/queue',require(_0x72bd('0x4e')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x4f'),require(_0x72bd('0x50')));_0x4b1242[_0x72bd('0x9')]('/api/sms/applications',require(_0x72bd('0x51')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x52'),require(_0x72bd('0x53')));_0x4b1242['use'](_0x72bd('0x54'),require('./api/smsMessage'));_0x4b1242[_0x72bd('0x9')]('/api/sms/queues',require(_0x72bd('0x55')));_0x4b1242['use'](_0x72bd('0x56'),require(_0x72bd('0x57')));_0x4b1242[_0x72bd('0x9')]('/api/openchannel/applications',require(_0x72bd('0x58')));_0x4b1242['use']('/api/openchannel/interactions',require(_0x72bd('0x59')));_0x4b1242[_0x72bd('0x9')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x4b1242[_0x72bd('0x9')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x5a'),require(_0x72bd('0x5b')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x5c'),require(_0x72bd('0x5d')));_0x4b1242['use'](_0x72bd('0x5e'),require(_0x72bd('0x5f')));_0x4b1242['use'](_0x72bd('0x60'),require('./api/chatInteraction'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x61'),require(_0x72bd('0x62')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x63'),require('./api/chatOfflineMessage'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x64'),require(_0x72bd('0x65')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x66'),require(_0x72bd('0x67')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x68'),require(_0x72bd('0x69')));_0x4b1242['use'](_0x72bd('0x6a'),require('./api/cmCompany'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x6b'),require('./api/cmContact'));_0x4b1242['use'](_0x72bd('0x6c'),require('./api/cmHopper'));_0x4b1242['use'](_0x72bd('0x6d'),require(_0x72bd('0x6e')));_0x4b1242['use'](_0x72bd('0x6f'),require('./api/cmHopperFinal'));_0x4b1242['use'](_0x72bd('0x70'),require(_0x72bd('0x71')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x72'),require(_0x72bd('0x73')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x74'),require(_0x72bd('0x75')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x76'),require(_0x72bd('0x77')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x78'),require(_0x72bd('0x79')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x7a'),require(_0x72bd('0x7b')));_0x4b1242['use']('/api/conditions',require(_0x72bd('0x7c')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x7d'),require(_0x72bd('0x7e')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x7f'),require(_0x72bd('0x80')));_0x4b1242[_0x72bd('0x9')]('/api/cdr',require(_0x72bd('0x81')));_0x4b1242[_0x72bd('0x9')]('/api/voiceQueuesLog',require(_0x72bd('0x82')));_0x4b1242['use'](_0x72bd('0x83'),require(_0x72bd('0x84')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x85'),require(_0x72bd('0x86')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x87'),require(_0x72bd('0x88')));_0x4b1242['use'](_0x72bd('0x89'),require('./api/contactItemType'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x8a'),require('./api/cmContactHasItem'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x8b'),require('./api/cmHopperAdditionalPhone'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x8c'),require(_0x72bd('0x8d')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x8e'),require(_0x72bd('0x8f')));_0x4b1242[_0x72bd('0x9')]('/api/variables',require('./api/variable'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x90'),require(_0x72bd('0x91')));_0x4b1242[_0x72bd('0x9')]('/api/integrations/reports',require(_0x72bd('0x92')));_0x4b1242[_0x72bd('0x9')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x93'),require(_0x72bd('0x94')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x95'),require(_0x72bd('0x96')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x97'),require(_0x72bd('0x98')));_0x4b1242['use'](_0x72bd('0x99'),require(_0x72bd('0x9a')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x9b'),require('./api/analyticTreeReport'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x9c'),require(_0x72bd('0x9d')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x9e'),require(_0x72bd('0x9f')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xa0'),require('./api/intSalesforceField'));_0x4b1242[_0x72bd('0x9')]('/api/integrations/sugarcrm/accounts',require(_0x72bd('0xa1')));_0x4b1242['use'](_0x72bd('0xa2'),require(_0x72bd('0xa3')));_0x4b1242['use']('/api/integrations/sugarcrm/fields',require(_0x72bd('0xa4')));_0x4b1242['use'](_0x72bd('0xa5'),require(_0x72bd('0xa6')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xa7'),require(_0x72bd('0xa8')));_0x4b1242['use'](_0x72bd('0xa9'),require(_0x72bd('0xaa')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xab'),require(_0x72bd('0xac')));_0x4b1242[_0x72bd('0x9')]('/api/integrations/zoho/configurations',require(_0x72bd('0xad')));_0x4b1242[_0x72bd('0x9')]('/api/integrations/zoho/fields',require(_0x72bd('0xae')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xaf'),require(_0x72bd('0xb0')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xb1'),require(_0x72bd('0xb2')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xb3'),require(_0x72bd('0xb4')));_0x4b1242['use']('/api/integrations/freshdesk/accounts',require(_0x72bd('0xb5')));_0x4b1242[_0x72bd('0x9')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xb6'),require('./api/intFreshdeskField'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xb7'),require(_0x72bd('0xb8')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xb9'),require(_0x72bd('0xba')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xbb'),require(_0x72bd('0xbc')));_0x4b1242[_0x72bd('0x9')]('/api/integrations/servicenow/accounts',require(_0x72bd('0xbd')));_0x4b1242['use'](_0x72bd('0xbe'),require(_0x72bd('0xbf')));_0x4b1242['use'](_0x72bd('0xc0'),require('./api/intServicenowField'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xc1'),require(_0x72bd('0xc2')));_0x4b1242['use'](_0x72bd('0xc3'),require('./api/intDynamics365Configuration'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xc4'),require(_0x72bd('0xc5')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xc6'),require(_0x72bd('0xc7')));_0x4b1242['use']('/api/integrations/freshsales/configurations',require(_0x72bd('0xc8')));_0x4b1242[_0x72bd('0x9')]('/api/integrations/freshsales/fields',require(_0x72bd('0xc9')));_0x4b1242[_0x72bd('0x9')]('/api/networks',require(_0x72bd('0xca')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xcb'),require(_0x72bd('0xcc')));_0x4b1242['use']('/api/chat/internal/messages',require(_0x72bd('0xcd')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xce'),require('./api/jscriptyAnswerReport'));_0x4b1242['use']('/api/jscripty/questions/reports',require(_0x72bd('0xcf')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xd0'),require(_0x72bd('0xd1')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xd2'),require(_0x72bd('0xd3')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xd4'),require('./api/squareReport'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xd5'),require(_0x72bd('0xd6')));_0x4b1242[_0x72bd('0x9')]('/api/jscripty/projects',require(_0x72bd('0xd7')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xd8'),require(_0x72bd('0xd9')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xda'),require(_0x72bd('0xdb')));_0x4b1242[_0x72bd('0x9')]('/api/square/projects',require(_0x72bd('0xdc')));_0x4b1242['use']('/api/square/recordings',require(_0x72bd('0xdd')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xde'),require(_0x72bd('0xdf')));_0x4b1242[_0x72bd('0x9')]('/api/teams',require(_0x72bd('0xe0')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xe1'),require(_0x72bd('0xe2')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xe3'),require(_0x72bd('0xe4')));_0x4b1242['use'](_0x72bd('0xe5'),require(_0x72bd('0xe6')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xe7'),require('./api/attachment'));_0x4b1242['use'](_0x72bd('0xe8'),require(_0x72bd('0xe9')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xea'),require(_0x72bd('0xeb')));_0x4b1242[_0x72bd('0x9')]('/api/chat/reports/transfer',require(_0x72bd('0xec')));_0x4b1242[_0x72bd('0x9')]('/api/fax/reports/transfer',require(_0x72bd('0xed')));_0x4b1242[_0x72bd('0x9')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xee'),require(_0x72bd('0xef')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xf0'),require(_0x72bd('0xf1')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xf2'),require(_0x72bd('0xf3')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xf4'),require(_0x72bd('0xf5')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xf6'),require(_0x72bd('0xf7')));_0x4b1242['use'](_0x72bd('0xf8'),require(_0x72bd('0xf9')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xfa'),require('./api/userNotification'));_0x4b1242[_0x72bd('0x9')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x4b1242[_0x72bd('0x9')]('/api/whatsapp/applications',require(_0x72bd('0xfb')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0xfc'),require(_0x72bd('0xfd')));_0x4b1242['use'](_0x72bd('0xfe'),require(_0x72bd('0xff')));_0x4b1242['use'](_0x72bd('0x100'),require(_0x72bd('0x101')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x102'),require(_0x72bd('0x103')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x104'),require('./api/whatsappQueue'));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x105'),require(_0x72bd('0x106')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x107'),require(_0x72bd('0x108')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x109'),require(_0x72bd('0x10a')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x10b'),require(_0x72bd('0x10c')));_0x4b1242['use'](_0x72bd('0x10d'),require(_0x72bd('0x10e')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x10f'),require(_0x72bd('0x110')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x111'),require(_0x72bd('0x112')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x113'),require(_0x72bd('0x114')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x115'),require(_0x72bd('0x116')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x117'),require(_0x72bd('0x118')));_0x4b1242['use']('/apidoc',express[_0x72bd('0x119')](path[_0x72bd('0x11a')](config[_0x72bd('0x11b')],'/apidoc')));_0x4b1242[_0x72bd('0x9')]('/www',express[_0x72bd('0x119')](path[_0x72bd('0x11a')](config[_0x72bd('0x11b')],'/www')));_0x4b1242[_0x72bd('0x9')](_0x72bd('0x11c'),express[_0x72bd('0x119')](path[_0x72bd('0x11a')](config[_0x72bd('0x11b')],_0x72bd('0x11c'))));_0x4b1242[_0x72bd('0x9')]('/snippet',express[_0x72bd('0x119')](path[_0x72bd('0x11a')](config[_0x72bd('0x11b')],_0x72bd('0x11d'),'3.0.0')));_0x4b1242['use'](_0x72bd('0x11e'),express[_0x72bd('0x119')](path[_0x72bd('0x11a')](config['root'],_0x72bd('0x11f'))));_0x4b1242[_0x72bd('0x120')](_0x72bd('0x121'))[_0x72bd('0x122')](errors[0x194]);_0x4b1242['route']('/*')[_0x72bd('0x122')](function(_0x131c19,_0x34a844){_0x34a844[_0x72bd('0x123')](path[_0x72bd('0x124')](_0x4b1242[_0x72bd('0x122')]('appPath')+'/index.html'));});};var sensitiveFields=[_0x72bd('0x125'),'password',_0x72bd('0x126'),_0x72bd('0x127'),_0x72bd('0x128'),_0x72bd('0x129'),_0x72bd('0x12a'),'phone',_0x72bd('0x12b'),_0x72bd('0x12c'),_0x72bd('0x12d'),_0x72bd('0x12e'),_0x72bd('0x12f'),_0x72bd('0x130'),_0x72bd('0x131'),_0x72bd('0x132'),_0x72bd('0x133'),_0x72bd('0x134'),_0x72bd('0x135'),'accessToken','accessTokenSecret',_0x72bd('0x136'),_0x72bd('0x137'),_0x72bd('0x138'),_0x72bd('0x139'),'calleridname',_0x72bd('0x13a'),_0x72bd('0x13b'),_0x72bd('0x13c'),_0x72bd('0x13d'),'privateKey',_0x72bd('0x13e'),_0x72bd('0x13f'),_0x72bd('0x140'),'user',_0x72bd('0x141'),_0x72bd('0x142'),_0x72bd('0x143'),_0x72bd('0x144'),'secret',_0x72bd('0x145'),_0x72bd('0x146')];function maskSensitiveData(_0x5c5545){var _0xd15994=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x5c5545))return;for(var _0x430a33 in _0x5c5545){if(_[_0x72bd('0x147')](_0x5c5545[_0x430a33])){for(var _0x508181=0x0;_0x508181<_0x5c5545[_0x430a33][_0x72bd('0x148')];_0x508181++){maskSensitiveData(_0x5c5545[_0x430a33][_0x508181]);}}else if(_[_0x72bd('0x149')](_0x5c5545[_0x430a33])){maskSensitiveData(_0x5c5545[_0x430a33]);}else if(_['isString'](_0x5c5545[_0x430a33])){_0x5c5545[_0x430a33]=_0x5c5545[_0x430a33]['replace'](/{{{/g,_0x72bd('0x14a'))[_0x72bd('0x14b')](/}}}/g,_0x72bd('0x14c'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x430a33)){_0x5c5545[_0x430a33]=_0x5c5545[_0x430a33][_0x72bd('0x14b')](_0xd15994,'*');}}}} \ No newline at end of file +var _0x94d1=['/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','lastName','street','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerSecret','membername','exten','clientEmail','privateKey','accesskeyid','key','pass','accountSid','localstationid','dsn','secret','isPlainObject','isArray','length','isString','@@{','}@@','replace','includes','lodash','path','express','util','./errors','api','./config/logger','auth','default','use','logger','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','device','other','agent_id','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','./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/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./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/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','/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/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','./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/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/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/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration'];(function(_0x54d2e,_0x38a3bc){var _0x1ee7e9=function(_0xe8f238){while(--_0xe8f238){_0x54d2e['push'](_0x54d2e['shift']());}};_0x1ee7e9(++_0x38a3bc);}(_0x94d1,0x1e5));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x194d('0x0'));var path=require(_0x194d('0x1'));var express=require(_0x194d('0x2'));var ewinston=require('express-winston');var util=require(_0x194d('0x3'));var errors=require(_0x194d('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x194d('0x5'));var authLogger=require(_0x194d('0x6'))(_0x194d('0x7'));exports[_0x194d('0x8')]=function(_0x34ff43){_0x34ff43[_0x194d('0x9')](ewinston[_0x194d('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x18988a,_0x5b0115){var _0x21b0cf='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x194d('0xb')](_0x18988a[_0x194d('0xc')])){_0x21b0cf+=_0x194d('0xd');var _0xf70dd=_0x18988a[_0x194d('0xc')];maskSensitiveData(_0xf70dd);}return util[_0x194d('0xe')](_0x21b0cf,_0x18988a[_0x194d('0xf')],_0x18988a[_0x194d('0x10')][_0x194d('0x11')]?_0x18988a[_0x194d('0x10')][_0x194d('0x11')]:_0x18988a[_0x194d('0x12')][_0x194d('0x13')]||_0x18988a['ip'],_0x18988a[_0x194d('0x14')],_0x5b0115[_0x194d('0x15')],_0x5b0115['responseTime'],_0x18988a[_0x194d('0x16')]?_0x18988a[_0x194d('0x16')]['id']:null,_0x18988a[_0x194d('0x16')]?_0x18988a[_0x194d('0x16')][_0x194d('0x17')]:null,_0x18988a[_0x194d('0x16')]?_0x18988a[_0x194d('0x16')]['role']:null,_0xf70dd?util[_0x194d('0x18')](_0xf70dd,![],null):'');}}));_0x34ff43[_0x194d('0x9')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x21823f,_0x280e9c){var _0x1a14fe='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x21823f['body']&&_0x21823f['body']['device']&&_0x21823f['body']['agent_id']){_0x1a14fe=_0x194d('0x19');}return util[_0x194d('0xe')](_0x1a14fe,_0x21823f[_0x194d('0xf')],_0x21823f[_0x194d('0x10')][_0x194d('0x11')]?_0x21823f['headers']['x-forwarded-for']:_0x21823f[_0x194d('0x12')][_0x194d('0x13')]||_0x21823f['ip'],_0x21823f['url'],_0x280e9c[_0x194d('0x15')],_0x280e9c[_0x194d('0x1a')],_0x21823f[_0x194d('0x16')]?_0x21823f[_0x194d('0x16')]['id']:null,_0x21823f[_0x194d('0x16')]?_0x21823f[_0x194d('0x16')][_0x194d('0x17')]:null,_0x21823f['user']?_0x21823f[_0x194d('0x16')]['role']:null,_0x21823f[_0x194d('0xc')]&&_0x21823f['body'][_0x194d('0x1b')]?_0x21823f['body'][_0x194d('0x1b')]:_0x194d('0x1c'),_0x21823f[_0x194d('0xc')]&&_0x21823f['body'][_0x194d('0x1d')]?_0x21823f[_0x194d('0xc')][_0x194d('0x1d')]:'',_0x21823f[_0x194d('0xc')]&&_0x21823f['body']['agent_name']?_0x21823f[_0x194d('0xc')][_0x194d('0x1e')]:'');},'ignoreRoute':function(_0x39f87f){var _0x2f93a2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2f93a2[_0x194d('0x1f')](_0x39f87f[_0x194d('0x14')]);}}));_0x34ff43['use']('/api/users',require(_0x194d('0x20')));_0x34ff43[_0x194d('0x9')](_0x194d('0x21'),require(_0x194d('0x22')));_0x34ff43[_0x194d('0x9')](_0x194d('0x23'),require(_0x194d('0x24')));_0x34ff43[_0x194d('0x9')](_0x194d('0x25'),require(_0x194d('0x26')));_0x34ff43[_0x194d('0x9')]('/api/voice/mohs',require(_0x194d('0x27')));_0x34ff43[_0x194d('0x9')](_0x194d('0x28'),require('./api/voiceQueue'));_0x34ff43[_0x194d('0x9')]('/api/voice/recordings',require(_0x194d('0x29')));_0x34ff43[_0x194d('0x9')](_0x194d('0x2a'),require(_0x194d('0x2b')));_0x34ff43[_0x194d('0x9')](_0x194d('0x2c'),require(_0x194d('0x2d')));_0x34ff43[_0x194d('0x9')](_0x194d('0x2e'),require('./api/voiceMailMessage'));_0x34ff43['use'](_0x194d('0x2f'),require(_0x194d('0x30')));_0x34ff43[_0x194d('0x9')](_0x194d('0x31'),require(_0x194d('0x32')));_0x34ff43['use'](_0x194d('0x33'),require(_0x194d('0x34')));_0x34ff43[_0x194d('0x9')](_0x194d('0x35'),require('./api/voiceQueueReport'));_0x34ff43[_0x194d('0x9')](_0x194d('0x36'),require(_0x194d('0x37')));_0x34ff43['use'](_0x194d('0x38'),require(_0x194d('0x39')));_0x34ff43[_0x194d('0x9')](_0x194d('0x3a'),require(_0x194d('0x3b')));_0x34ff43[_0x194d('0x9')]('/api/mail/out_servers',require(_0x194d('0x3c')));_0x34ff43[_0x194d('0x9')](_0x194d('0x3d'),require(_0x194d('0x3e')));_0x34ff43[_0x194d('0x9')](_0x194d('0x3f'),require(_0x194d('0x40')));_0x34ff43[_0x194d('0x9')]('/api/mail/substatuses',require(_0x194d('0x41')));_0x34ff43[_0x194d('0x9')](_0x194d('0x42'),require(_0x194d('0x43')));_0x34ff43[_0x194d('0x9')](_0x194d('0x44'),require('./api/mailMessage'));_0x34ff43[_0x194d('0x9')](_0x194d('0x45'),require(_0x194d('0x46')));_0x34ff43['use'](_0x194d('0x47'),require(_0x194d('0x48')));_0x34ff43['use'](_0x194d('0x49'),require(_0x194d('0x4a')));_0x34ff43['use']('/api/dashboards/items',require('./api/dashboardItem'));_0x34ff43[_0x194d('0x9')](_0x194d('0x4b'),require(_0x194d('0x4c')));_0x34ff43[_0x194d('0x9')](_0x194d('0x4d'),require('./api/faxApplication'));_0x34ff43[_0x194d('0x9')](_0x194d('0x4e'),require(_0x194d('0x4f')));_0x34ff43[_0x194d('0x9')](_0x194d('0x50'),require(_0x194d('0x51')));_0x34ff43[_0x194d('0x9')](_0x194d('0x52'),require(_0x194d('0x53')));_0x34ff43[_0x194d('0x9')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x34ff43[_0x194d('0x9')](_0x194d('0x54'),require('./api/smsAccount'));_0x34ff43['use'](_0x194d('0x55'),require(_0x194d('0x56')));_0x34ff43[_0x194d('0x9')](_0x194d('0x57'),require(_0x194d('0x58')));_0x34ff43[_0x194d('0x9')]('/api/sms/messages',require('./api/smsMessage'));_0x34ff43['use']('/api/sms/queues',require(_0x194d('0x59')));_0x34ff43[_0x194d('0x9')](_0x194d('0x5a'),require(_0x194d('0x5b')));_0x34ff43['use']('/api/openchannel/applications',require(_0x194d('0x5c')));_0x34ff43[_0x194d('0x9')](_0x194d('0x5d'),require(_0x194d('0x5e')));_0x34ff43[_0x194d('0x9')]('/api/openchannel/messages',require(_0x194d('0x5f')));_0x34ff43[_0x194d('0x9')]('/api/openchannel/queues',require(_0x194d('0x60')));_0x34ff43[_0x194d('0x9')](_0x194d('0x61'),require(_0x194d('0x62')));_0x34ff43[_0x194d('0x9')](_0x194d('0x63'),require('./api/openchannelQueueReport'));_0x34ff43[_0x194d('0x9')](_0x194d('0x64'),require(_0x194d('0x65')));_0x34ff43[_0x194d('0x9')](_0x194d('0x66'),require(_0x194d('0x67')));_0x34ff43[_0x194d('0x9')](_0x194d('0x68'),require('./api/chatMessage'));_0x34ff43['use'](_0x194d('0x69'),require(_0x194d('0x6a')));_0x34ff43['use']('/api/chat/queues',require(_0x194d('0x6b')));_0x34ff43[_0x194d('0x9')](_0x194d('0x6c'),require(_0x194d('0x6d')));_0x34ff43[_0x194d('0x9')](_0x194d('0x6e'),require('./api/chatProactiveAction'));_0x34ff43[_0x194d('0x9')](_0x194d('0x6f'),require(_0x194d('0x70')));_0x34ff43['use'](_0x194d('0x71'),require(_0x194d('0x72')));_0x34ff43[_0x194d('0x9')](_0x194d('0x73'),require('./api/cmHopper'));_0x34ff43[_0x194d('0x9')](_0x194d('0x74'),require('./api/cmHopperBlack'));_0x34ff43[_0x194d('0x9')](_0x194d('0x75'),require('./api/cmHopperFinal'));_0x34ff43[_0x194d('0x9')](_0x194d('0x76'),require(_0x194d('0x77')));_0x34ff43[_0x194d('0x9')]('/api/cm/custom_fields',require(_0x194d('0x78')));_0x34ff43[_0x194d('0x9')](_0x194d('0x79'),require(_0x194d('0x7a')));_0x34ff43[_0x194d('0x9')](_0x194d('0x7b'),require(_0x194d('0x7c')));_0x34ff43[_0x194d('0x9')](_0x194d('0x7d'),require(_0x194d('0x7e')));_0x34ff43[_0x194d('0x9')]('/api/dispositions',require(_0x194d('0x7f')));_0x34ff43[_0x194d('0x9')](_0x194d('0x80'),require(_0x194d('0x81')));_0x34ff43[_0x194d('0x9')](_0x194d('0x82'),require('./api/interval'));_0x34ff43[_0x194d('0x9')](_0x194d('0x83'),require('./api/pause'));_0x34ff43[_0x194d('0x9')](_0x194d('0x84'),require(_0x194d('0x85')));_0x34ff43['use'](_0x194d('0x86'),require(_0x194d('0x87')));_0x34ff43['use'](_0x194d('0x88'),require('./api/schedule'));_0x34ff43[_0x194d('0x9')](_0x194d('0x89'),require(_0x194d('0x8a')));_0x34ff43[_0x194d('0x9')]('/api/tags',require(_0x194d('0x8b')));_0x34ff43[_0x194d('0x9')](_0x194d('0x8c'),require('./api/contactItemType'));_0x34ff43['use'](_0x194d('0x8d'),require(_0x194d('0x8e')));_0x34ff43['use'](_0x194d('0x8f'),require(_0x194d('0x90')));_0x34ff43[_0x194d('0x9')](_0x194d('0x91'),require(_0x194d('0x92')));_0x34ff43['use'](_0x194d('0x93'),require(_0x194d('0x94')));_0x34ff43[_0x194d('0x9')](_0x194d('0x95'),require('./api/variable'));_0x34ff43[_0x194d('0x9')]('/api/integrations',require(_0x194d('0x96')));_0x34ff43[_0x194d('0x9')](_0x194d('0x97'),require(_0x194d('0x98')));_0x34ff43[_0x194d('0x9')](_0x194d('0x99'),require(_0x194d('0x9a')));_0x34ff43['use'](_0x194d('0x9b'),require(_0x194d('0x9c')));_0x34ff43['use'](_0x194d('0x9d'),require(_0x194d('0x9e')));_0x34ff43[_0x194d('0x9')](_0x194d('0x9f'),require(_0x194d('0xa0')));_0x34ff43[_0x194d('0x9')](_0x194d('0xa1'),require(_0x194d('0xa2')));_0x34ff43[_0x194d('0x9')]('/api/analytics/tree_reports',require(_0x194d('0xa3')));_0x34ff43[_0x194d('0x9')](_0x194d('0xa4'),require(_0x194d('0xa5')));_0x34ff43[_0x194d('0x9')]('/api/integrations/salesforce/configurations',require(_0x194d('0xa6')));_0x34ff43[_0x194d('0x9')]('/api/integrations/salesforce/fields',require(_0x194d('0xa7')));_0x34ff43[_0x194d('0x9')](_0x194d('0xa8'),require(_0x194d('0xa9')));_0x34ff43[_0x194d('0x9')](_0x194d('0xaa'),require(_0x194d('0xab')));_0x34ff43['use'](_0x194d('0xac'),require(_0x194d('0xad')));_0x34ff43[_0x194d('0x9')](_0x194d('0xae'),require('./api/intDeskAccount'));_0x34ff43['use'](_0x194d('0xaf'),require(_0x194d('0xb0')));_0x34ff43['use'](_0x194d('0xb1'),require(_0x194d('0xb2')));_0x34ff43['use'](_0x194d('0xb3'),require(_0x194d('0xb4')));_0x34ff43[_0x194d('0x9')]('/api/integrations/zoho/configurations',require(_0x194d('0xb5')));_0x34ff43[_0x194d('0x9')](_0x194d('0xb6'),require(_0x194d('0xb7')));_0x34ff43['use'](_0x194d('0xb8'),require(_0x194d('0xb9')));_0x34ff43[_0x194d('0x9')](_0x194d('0xba'),require(_0x194d('0xbb')));_0x34ff43[_0x194d('0x9')](_0x194d('0xbc'),require(_0x194d('0xbd')));_0x34ff43[_0x194d('0x9')](_0x194d('0xbe'),require(_0x194d('0xbf')));_0x34ff43[_0x194d('0x9')](_0x194d('0xc0'),require(_0x194d('0xc1')));_0x34ff43[_0x194d('0x9')](_0x194d('0xc2'),require('./api/intFreshdeskField'));_0x34ff43[_0x194d('0x9')](_0x194d('0xc3'),require(_0x194d('0xc4')));_0x34ff43[_0x194d('0x9')](_0x194d('0xc5'),require(_0x194d('0xc6')));_0x34ff43['use'](_0x194d('0xc7'),require('./api/intVtigerField'));_0x34ff43[_0x194d('0x9')](_0x194d('0xc8'),require('./api/intServicenowAccount'));_0x34ff43[_0x194d('0x9')](_0x194d('0xc9'),require(_0x194d('0xca')));_0x34ff43[_0x194d('0x9')](_0x194d('0xcb'),require(_0x194d('0xcc')));_0x34ff43[_0x194d('0x9')](_0x194d('0xcd'),require(_0x194d('0xce')));_0x34ff43[_0x194d('0x9')](_0x194d('0xcf'),require('./api/intDynamics365Configuration'));_0x34ff43[_0x194d('0x9')](_0x194d('0xd0'),require(_0x194d('0xd1')));_0x34ff43[_0x194d('0x9')](_0x194d('0xd2'),require(_0x194d('0xd3')));_0x34ff43[_0x194d('0x9')]('/api/integrations/freshsales/configurations',require(_0x194d('0xd4')));_0x34ff43['use'](_0x194d('0xd5'),require('./api/intFreshsalesField'));_0x34ff43[_0x194d('0x9')](_0x194d('0xd6'),require(_0x194d('0xd7')));_0x34ff43['use'](_0x194d('0xd8'),require(_0x194d('0xd9')));_0x34ff43[_0x194d('0x9')](_0x194d('0xda'),require(_0x194d('0xdb')));_0x34ff43[_0x194d('0x9')](_0x194d('0xdc'),require('./api/jscriptyAnswerReport'));_0x34ff43[_0x194d('0x9')](_0x194d('0xdd'),require(_0x194d('0xde')));_0x34ff43[_0x194d('0x9')](_0x194d('0xdf'),require(_0x194d('0xe0')));_0x34ff43['use']('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x34ff43[_0x194d('0x9')](_0x194d('0xe1'),require(_0x194d('0xe2')));_0x34ff43['use'](_0x194d('0xe3'),require(_0x194d('0xe4')));_0x34ff43[_0x194d('0x9')]('/api/jscripty/projects',require(_0x194d('0xe5')));_0x34ff43[_0x194d('0x9')]('/api/settings',require('./api/setting'));_0x34ff43['use'](_0x194d('0xe6'),require(_0x194d('0xe7')));_0x34ff43[_0x194d('0x9')](_0x194d('0xe8'),require(_0x194d('0xe9')));_0x34ff43[_0x194d('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x34ff43['use']('/api/square/messages',require(_0x194d('0xea')));_0x34ff43['use']('/api/teams',require(_0x194d('0xeb')));_0x34ff43[_0x194d('0x9')](_0x194d('0xec'),require(_0x194d('0xed')));_0x34ff43[_0x194d('0x9')](_0x194d('0xee'),require(_0x194d('0xef')));_0x34ff43[_0x194d('0x9')]('/api/migrations',require(_0x194d('0xf0')));_0x34ff43[_0x194d('0x9')]('/api/attachments',require(_0x194d('0xf1')));_0x34ff43[_0x194d('0x9')](_0x194d('0xf2'),require('./api/plugin'));_0x34ff43[_0x194d('0x9')](_0x194d('0xf3'),require(_0x194d('0xf4')));_0x34ff43[_0x194d('0x9')]('/api/chat/reports/transfer',require(_0x194d('0xf5')));_0x34ff43[_0x194d('0x9')](_0x194d('0xf6'),require('./api/faxTransferReport'));_0x34ff43[_0x194d('0x9')](_0x194d('0xf7'),require(_0x194d('0xf8')));_0x34ff43['use'](_0x194d('0xf9'),require(_0x194d('0xfa')));_0x34ff43[_0x194d('0x9')](_0x194d('0xfb'),require(_0x194d('0xfc')));_0x34ff43[_0x194d('0x9')](_0x194d('0xfd'),require(_0x194d('0xfe')));_0x34ff43['use'](_0x194d('0xff'),require(_0x194d('0x100')));_0x34ff43[_0x194d('0x9')](_0x194d('0x101'),require(_0x194d('0x102')));_0x34ff43['use'](_0x194d('0x103'),require(_0x194d('0x104')));_0x34ff43[_0x194d('0x9')]('/api/userNotifications',require(_0x194d('0x105')));_0x34ff43[_0x194d('0x9')]('/api/whatsapp/accounts',require(_0x194d('0x106')));_0x34ff43[_0x194d('0x9')](_0x194d('0x107'),require('./api/whatsappApplication'));_0x34ff43[_0x194d('0x9')](_0x194d('0x108'),require(_0x194d('0x109')));_0x34ff43[_0x194d('0x9')](_0x194d('0x10a'),require(_0x194d('0x10b')));_0x34ff43[_0x194d('0x9')]('/api/whatsapp/reports/queue',require(_0x194d('0x10c')));_0x34ff43[_0x194d('0x9')](_0x194d('0x10d'),require(_0x194d('0x10e')));_0x34ff43[_0x194d('0x9')](_0x194d('0x10f'),require(_0x194d('0x110')));_0x34ff43[_0x194d('0x9')](_0x194d('0x111'),require(_0x194d('0x112')));_0x34ff43[_0x194d('0x9')](_0x194d('0x113'),require(_0x194d('0x114')));_0x34ff43[_0x194d('0x9')](_0x194d('0x115'),require('./api/authLocal'));_0x34ff43[_0x194d('0x9')](_0x194d('0x116'),require(_0x194d('0x117')));_0x34ff43['use'](_0x194d('0x118'),require(_0x194d('0x119')));_0x34ff43[_0x194d('0x9')](_0x194d('0x11a'),require('./api/rpc'));_0x34ff43[_0x194d('0x9')](_0x194d('0x11b'),require(_0x194d('0x11c')));_0x34ff43[_0x194d('0x9')](_0x194d('0x11d'),require('./api/system'));_0x34ff43['use'](_0x194d('0x11e'),require(_0x194d('0x11f')));_0x34ff43[_0x194d('0x9')](_0x194d('0x120'),require(_0x194d('0x121')));_0x34ff43['use'](_0x194d('0x122'),express[_0x194d('0x123')](path[_0x194d('0x124')](config[_0x194d('0x125')],_0x194d('0x122'))));_0x34ff43['use']('/www',express[_0x194d('0x123')](path[_0x194d('0x124')](config['root'],_0x194d('0x126'))));_0x34ff43[_0x194d('0x9')](_0x194d('0x127'),express[_0x194d('0x123')](path['join'](config[_0x194d('0x125')],_0x194d('0x127'))));_0x34ff43[_0x194d('0x9')](_0x194d('0x128'),express['static'](path[_0x194d('0x124')](config[_0x194d('0x125')],_0x194d('0x129'),'3.0.0')));_0x34ff43[_0x194d('0x9')]('/plugins',express[_0x194d('0x123')](path[_0x194d('0x124')](config[_0x194d('0x125')],_0x194d('0x12a'))));_0x34ff43[_0x194d('0x12b')](_0x194d('0x12c'))['get'](errors[0x194]);_0x34ff43['route']('/*')[_0x194d('0x12d')](function(_0x52a29a,_0x40139d){_0x40139d[_0x194d('0x12e')](path[_0x194d('0x12f')](_0x34ff43[_0x194d('0x12d')](_0x194d('0x130'))+_0x194d('0x131')));});};var sensitiveFields=[_0x194d('0x132'),_0x194d('0x133'),_0x194d('0x134'),'apiKey','firstName',_0x194d('0x135'),_0x194d('0x136'),'phone',_0x194d('0x137'),_0x194d('0x138'),_0x194d('0x139'),_0x194d('0x13a'),_0x194d('0x13b'),_0x194d('0x13c'),_0x194d('0x13d'),_0x194d('0x13e'),'tenantId',_0x194d('0x13f'),_0x194d('0x140'),_0x194d('0x141'),_0x194d('0x142'),_0x194d('0x143'),'consumerKey',_0x194d('0x144'),_0x194d('0x145'),'calleridname','calleridnum',_0x194d('0x146'),'vidaooApiKey',_0x194d('0x147'),_0x194d('0x148'),_0x194d('0x149'),'secretaccesskey',_0x194d('0x14a'),_0x194d('0x16'),_0x194d('0x14b'),_0x194d('0x14c'),_0x194d('0x14d'),_0x194d('0x14e'),_0x194d('0x14f'),'registry','oldPassword'];function maskSensitiveData(_0x25b33e){var _0x28774b=/(?!^)[\s\S](?!$)/g;if(!_[_0x194d('0x150')](_0x25b33e))return;for(var _0x444a8d in _0x25b33e){if(_[_0x194d('0x151')](_0x25b33e[_0x444a8d])){for(var _0x3cbe61=0x0;_0x3cbe61<_0x25b33e[_0x444a8d][_0x194d('0x152')];_0x3cbe61++){maskSensitiveData(_0x25b33e[_0x444a8d][_0x3cbe61]);}}else if(_['isPlainObject'](_0x25b33e[_0x444a8d])){maskSensitiveData(_0x25b33e[_0x444a8d]);}else if(_[_0x194d('0x153')](_0x25b33e[_0x444a8d])){_0x25b33e[_0x444a8d]=_0x25b33e[_0x444a8d]['replace'](/{{{/g,_0x194d('0x154'))['replace'](/}}}/g,_0x194d('0x155'))[_0x194d('0x156')](/{{/g,'@{')[_0x194d('0x156')](/}}/g,'}@');if(_[_0x194d('0x157')](sensitiveFields,_0x444a8d)){_0x25b33e[_0x444a8d]=_0x25b33e[_0x444a8d][_0x194d('0x156')](_0x28774b,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 867dcf8..d6d6ad3 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8f6=['../api/whatsappQueueReport/whatsappQueueReport.rpc','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.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/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc'];(function(_0x1020ca,_0x4a3819){var _0x1e4ed4=function(_0x1c1940){while(--_0x1c1940){_0x1020ca['push'](_0x1020ca['shift']());}};_0x1e4ed4(++_0x4a3819);}(_0xc8f6,0x13a));var _0x6c8f=function(_0x1fcbc1,_0x2b982c){_0x1fcbc1=_0x1fcbc1-0x0;var _0xcf5761=_0xc8f6[_0x1fcbc1];return _0xcf5761;};'use strict';var jayson=require(_0x6c8f('0x0'));var BPromise=require(_0x6c8f('0x1'));var _=require(_0x6c8f('0x2'));var config=require(_0x6c8f('0x3'));exports[_0x6c8f('0x4')]=function(){return new BPromise(function(_0x1ec064,_0x504583){var _0x76827f={};_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x6')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x7')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x8')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x9')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0xa')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0xb')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0xc')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0xd')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0xe')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/trunk/trunk.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0xf')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x10')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x11')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/mailAccount/mailAccount.rpc'));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x12')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x13')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/mailMessage/mailMessage.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x14')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x15')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/faxAccount/faxAccount.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x16')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x17')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x18')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x19')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x1a')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x1b')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x1c')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x1d')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x1e')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x1f')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x20')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x21')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x22')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x23')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x24')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x25')));_0x76827f=_['merge'](_0x76827f,require('../api/chatQueue/chatQueue.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x26')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x27')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x28')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x29')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x2a')));_0x76827f=_['merge'](_0x76827f,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x2b')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/pause/pause.rpc'));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x2c')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x2d')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x2e')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x2f')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x30')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x31')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x32')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x33')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x34')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x35')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x36')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x37')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x38')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x39')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x3a')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x3b')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/squareProject/squareProject.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/squareRecording/squareRecording.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x3c')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x3d')));_0x76827f=_['merge'](_0x76827f,require('../api/attachment/attachment.rpc'));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x3e')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x3f')));_0x76827f=_['merge'](_0x76827f,require(_0x6c8f('0x40')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x41')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require(_0x6c8f('0x42')));_0x76827f=_[_0x6c8f('0x5')](_0x76827f,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x318384=jayson['server'](_0x76827f)[_0x6c8f('0x43')]();var _0xf6f2c8=config['rpc'][_0x6c8f('0x44')]||config[_0x6c8f('0x44')]+0x1;var _0x401eaa=config[_0x6c8f('0x45')]['ip']||_0x6c8f('0x46');_0x318384['on'](_0x6c8f('0x47'),function(_0x256472){return _0x504583(_0x256472);});_0x318384['listen'](_0xf6f2c8,_0x401eaa,function(){console[_0x6c8f('0x48')](_0x6c8f('0x49'),_0x401eaa,_0xf6f2c8);require('../config/triggers')[_0x6c8f('0x4a')]();return _0x1ec064(_0x6c8f('0x4b')+_0x401eaa+':'+_0xf6f2c8);});});}; \ No newline at end of file +var _0x3325=['../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.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/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.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/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc'];(function(_0x2659ac,_0x2bf93b){var _0x1d3167=function(_0x237b73){while(--_0x237b73){_0x2659ac['push'](_0x2659ac['shift']());}};_0x1d3167(++_0x2bf93b);}(_0x3325,0x1c9));var _0x5332=function(_0x5bdd93,_0x208ccb){_0x5bdd93=_0x5bdd93-0x0;var _0x2caf5e=_0x3325[_0x5bdd93];return _0x2caf5e;};'use strict';var jayson=require(_0x5332('0x0'));var BPromise=require(_0x5332('0x1'));var _=require('lodash');var config=require(_0x5332('0x2'));exports[_0x5332('0x3')]=function(){return new BPromise(function(_0x41703f,_0x59be96){var _0x3d1223={};_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x5')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/voiceExtension/voiceExtension.rpc'));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x6')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/voiceRecording/voiceRecording.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x7')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x8')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x9')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0xa')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0xb')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0xc')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0xd')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0xe')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0xf')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/mailAccount/mailAccount.rpc'));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x10')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x11')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x12')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x13')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x14')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x15')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x16')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x17')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x18')));_0x3d1223=_['merge'](_0x3d1223,require('../api/faxQueue/faxQueue.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x19')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x1a')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x1b')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x1c')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/smsQueue/smsQueue.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x1d')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x1e')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x1f')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x20')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x21')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x22')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/cmContact/cmContact.rpc'));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x23')));_0x3d1223=_['merge'](_0x3d1223,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x24')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x25')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x26')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x27')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x28')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/sound/sound.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x29')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x2a')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x2b')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x2c')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x2d')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x2e')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x2f')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x30')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x31')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x32')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x33')));_0x3d1223=_['merge'](_0x3d1223,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x34')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x35')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/squareReport/squareReport.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x36')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x37')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/squareOdbc/squareOdbc.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x38')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x39')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x3a')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x3b')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x3c')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x3d')));_0x3d1223=_['merge'](_0x3d1223,require(_0x5332('0x3e')));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3d1223=_[_0x5332('0x4')](_0x3d1223,require(_0x5332('0x3f')));_0x3d1223=_['merge'](_0x3d1223,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x4b7f30=jayson[_0x5332('0x40')](_0x3d1223)[_0x5332('0x41')]();var _0x5c80d7=config[_0x5332('0x42')][_0x5332('0x43')]||config[_0x5332('0x43')]+0x1;var _0x1325d5=config[_0x5332('0x42')]['ip']||_0x5332('0x44');_0x4b7f30['on']('error',function(_0x15f6e7){return _0x59be96(_0x15f6e7);});_0x4b7f30['listen'](_0x5c80d7,_0x1325d5,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1325d5,_0x5c80d7);require(_0x5332('0x45'))['default']();return _0x41703f(_0x5332('0x46')+_0x1325d5+':'+_0x5c80d7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index cffe2b8..3c5535e 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 _0x2e88=['setEncoding','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','command','function','write','sync','prototype','answer','ANSWER','getData','sendRequest','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','wait','WAIT','label','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout'];(function(_0x1834f8,_0x4c0dba){var _0x4cdb94=function(_0x571cab){while(--_0x571cab){_0x1834f8['push'](_0x1834f8['shift']());}};_0x4cdb94(++_0x4c0dba);}(_0x2e88,0x95));var _0x82e8=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0x2e88[_0x2c0ded];return _0x4473e5;};'use strict';var util=require(_0x82e8('0x0'));var _=require(_0x82e8('0x1'));var EventEmitter=require(_0x82e8('0x2'))[_0x82e8('0x3')];var AGIReply=require(_0x82e8('0x4'));var AGIError=require(_0x82e8('0x5'));function AGIChannel(_0x552153){var _0x40c9c5=this,_0x1d7415=new AGIReply(),_0x576435=![],_0x3aed37={};EventEmitter[_0x82e8('0x6')](_0x40c9c5);_0x552153['setEncoding'](_0x82e8('0x7'));_0x552153[_0x82e8('0x8')](0x8*0x3c*0x3c*0x3e8);_0x1d7415[_0x82e8('0x9')](_0x82e8('0x7'));_0x1d7415['on'](_0x82e8('0xa'),function(_0x1ecc8f){for(var _0x1a7d8c in _0x1ecc8f){_0x40c9c5[_0x1a7d8c]=_0x1ecc8f[_0x1a7d8c];}_0x40c9c5[_0x82e8('0xb')](_0x82e8('0xc'));});_0x1d7415['on'](_0x82e8('0xd'),function(_0xfef25b){if(_0xfef25b['toLowerCase']()==_0x82e8('0xe')){_0x40c9c5[_0x82e8('0xb')](_0x82e8('0xe'));return;}if(_0xfef25b[_0x82e8('0xf')](0x0,0xb)==_0x82e8('0x10')){_0x576435=!![];}if(_0x576435){_0x3aed37['rx']+=_0xfef25b+'\x0a';if(_0xfef25b[_0x82e8('0x11')](_0x82e8('0x12'))!=-0x1){_0x576435=![];}}else{_0x3aed37['rx']=_0xfef25b;}if(_0x576435){return;}if(typeof _0x3aed37['cb']=='function'){var _0x253a36=_0x3aed37['rx'][_0x82e8('0xf')](0x0,0x3),_0xdf1b65=null,_0xb6d94a=null;_0x253a36=parseInt(_0x253a36);if(isNaN(_0x253a36)){_0x3aed37['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x82e8('0x13')});return;}if(_0x253a36!=0xc8){_0x3aed37['cb'](null,{'code':_0x253a36,'result':-0x1,'extra':'KO'});return;}_0xdf1b65=_0x3aed37['rx']['substring'](0x4)[_0x82e8('0x14')](_0x82e8('0x15'),'');if(_0xdf1b65[_0x82e8('0x16')]('\x20')!=-0x1){_0xdf1b65=_0xdf1b65[_0x82e8('0x17')](0x0,_0xdf1b65['indexOf']('\x20'));}if(_[_0x82e8('0x18')](_0xdf1b65,'-1')){_0xdf1b65=parseInt(_0xdf1b65);}_0xb6d94a=_0x3aed37['rx'][_0x82e8('0x19')]('\x20');if(_0xb6d94a[_0x82e8('0x1a')]==0x3){_0xb6d94a=_0xb6d94a[0x2][_0x82e8('0xf')](0x1,_0xb6d94a[0x2][_0x82e8('0x1a')]-0x1);}else if(_0xb6d94a['length']>0x3){var _0x39e7bc=/\((.+)\)/;var _0x64e4fa=_0x3aed37['rx']['match'](_0x39e7bc);if(_0x64e4fa){_0xb6d94a=_0x64e4fa[0x1];}else{_0xb6d94a=null;}}else{_0xb6d94a=null;}_0x3aed37['cb'](null,{'code':_0x253a36,'result':_0xdf1b65,'extra':_0xb6d94a});}});_0x552153['on'](_0x82e8('0x1b'),function(_0xf287da){_0x40c9c5[_0x82e8('0xb')](_0x82e8('0x1b'),new AGIError(_0x82e8('0x1c'),_0xf287da[_0x82e8('0x1d')]));});_0x552153['on'](_0x82e8('0x1e'),function(){_0x40c9c5['emit'](_0x82e8('0x1e'),new AGIError(_0x82e8('0x1f')));});_0x552153['on'](_0x82e8('0x20'),function(){_0x40c9c5[_0x82e8('0xb')](_0x82e8('0x20'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x552153[_0x82e8('0x21')]();});_0x552153['pipe'](_0x1d7415);this[_0x82e8('0x22')]=function(_0x13e0e5,_0x1475cf){var _0x13e0e5=_0x13e0e5||'',_0x1475cf=typeof _0x1475cf==_0x82e8('0x23')?_0x1475cf:new Function();_0x3aed37={'tx':_0x13e0e5,'rx':'','cb':_0x1475cf};_0x552153[_0x82e8('0x24')](_0x13e0e5+'\x0a');},this['close']=function(){_0x552153[_0x82e8('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x47389b){return this['command'][_0x82e8('0x25')](this,_0x47389b);};AGIChannel[_0x82e8('0x26')][_0x82e8('0x27')]=function(){return this['sendRequest'](_0x82e8('0x28'));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x29')]=function(_0x2400c5,_0x247096,_0x5b2833){_0x2400c5=_0x2400c5===undefined?'beep':_0x2400c5;_0x247096=_0x247096===undefined?'5':_0x247096;_0x5b2833=_0x5b2833===undefined?'1':_0x5b2833;return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x2c'),_0x2400c5,_0x247096*0x3e8,_0x5b2833));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x2d')]=function(_0x4756ac){_0x4756ac=_0x4756ac||_0x82e8('0x2e');return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x2f'),_0x4756ac));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x30')]=function(_0x7d089d,_0x4902af){if(_[_0x82e8('0x31')](_0x4902af)){return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x32'),_0x7d089d,_0x4902af[_0x82e8('0x33')](',')));}return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x32'),_0x7d089d,_0x4902af));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x34')]=function(_0x1ed0f5){return this['sendRequest'](util[_0x82e8('0x2b')](_0x82e8('0x35'),_0x1ed0f5));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x36')]=function(_0x472875){return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x37'),_0x472875));};AGIChannel['prototype'][_0x82e8('0x38')]=function(_0x4aa077){return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')]('SET\x20PRIORITY\x20%s',_0x4aa077));};AGIChannel['prototype'][_0x82e8('0xe')]=function(){return this['sendRequest'](_0x82e8('0x39'));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x3a')]=function(_0x1c95a3,_0x267ee5){var _0x14f4b5=_[_0x82e8('0x3b')](_0x267ee5)||_[_0x82e8('0x3c')](_0x267ee5)?_0x267ee5[_0x82e8('0x3d')]():_0x267ee5;return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x3e'),_0x1c95a3,_0x14f4b5?_0x14f4b5['toString']()[_0x82e8('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x3f')]=function(_0x4cc61e,_0x7c03bd){return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x40'),_0x4cc61e,_0x7c03bd));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x41')]=function(_0x3c8324,_0x1eceef){return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x42'),_0x3c8324,_0x1eceef));};AGIChannel['prototype'][_0x82e8('0x43')]=function(_0x3f379d,_0x137525){return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x44'),_0x3f379d,_0x137525));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x45')]=function(_0x35671c,_0x795b3a,_0x3da44d){_0x795b3a=_0x795b3a||this[_0x82e8('0x46')];_0x3da44d=_0x3da44d||0x1;this[_0x82e8('0x34')](_0x35671c);this[_0x82e8('0x36')](_0x795b3a);this[_0x82e8('0x38')](_0x3da44d);return this['noop'](util[_0x82e8('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x35671c,_0x795b3a,_0x3da44d));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x47')]=function(_0x8428e1){return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')](_0x82e8('0x48'),_0x8428e1));};AGIChannel['prototype'][_0x82e8('0x49')]=function(_0x58a619,_0xa47699,_0xe86921,_0x2df120,_0x3b6996,_0x394b41){_0xa47699=_0xa47699||'wav';_0xe86921=_0xe86921||'';_0x2df120=_0x2df120===undefined?-0x1:_0x2df120==='-1'?-0x1:_0x2df120*0x3e8;_0x3b6996=_0x3b6996===undefined?'':'s='+_0x3b6996;_0x394b41=_0x394b41?'BEEP':'';return this[_0x82e8('0x2a')](util['format'](_0x82e8('0x4a'),_0x58a619,_0xa47699,_0xe86921,_0x2df120,_0x394b41,_0x3b6996));};AGIChannel['prototype']['streamFile']=function(_0x543cd2,_0x5b8141){_0x5b8141=_0x5b8141||'';return this[_0x82e8('0x2a')](util[_0x82e8('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x543cd2,_0x5b8141));};AGIChannel[_0x82e8('0x26')][_0x82e8('0x4b')]=function(_0x52333d){return this[_0x82e8('0x30')]('AGI',_0x52333d);};AGIChannel[_0x82e8('0x26')][_0x82e8('0x4c')]=function(_0x4069bb){return this[_0x82e8('0x30')](_0x82e8('0x4d'),_0x4069bb);};AGIChannel[_0x82e8('0x26')]['error']=function(_0x3fe65a,_0x40fcae){this[_0x82e8('0x2d')](util[_0x82e8('0x2b')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3fe65a['id'],_0x3fe65a[_0x82e8('0x4e')],_0x40fcae));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xe8a3=['destroy','inherits','sendRequest','sync','prototype','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','./reply','./error','call','setEncoding','setTimeout','utf8','emit','ready','line','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','substring','no\x20code','replace','result=','indexOf','startsWith','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','function','write'];(function(_0x549bf0,_0x545544){var _0x583eca=function(_0x2f5ebc){while(--_0x2f5ebc){_0x549bf0['push'](_0x549bf0['shift']());}};_0x583eca(++_0x545544);}(_0xe8a3,0x19d));var _0x3e8a=function(_0x392ec2,_0x4e9f85){_0x392ec2=_0x392ec2-0x0;var _0x16e517=_0xe8a3[_0x392ec2];return _0x16e517;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3e8a('0x0'))['EventEmitter'];var AGIReply=require(_0x3e8a('0x1'));var AGIError=require(_0x3e8a('0x2'));function AGIChannel(_0x348242){var _0x390b60=this,_0xbeff3d=new AGIReply(),_0x397b05=![],_0x5c1bee={};EventEmitter[_0x3e8a('0x3')](_0x390b60);_0x348242[_0x3e8a('0x4')]('utf8');_0x348242[_0x3e8a('0x5')](0x8*0x3c*0x3c*0x3e8);_0xbeff3d[_0x3e8a('0x4')](_0x3e8a('0x6'));_0xbeff3d['on']('headers',function(_0x1f64a5){for(var _0x45ca6e in _0x1f64a5){_0x390b60[_0x45ca6e]=_0x1f64a5[_0x45ca6e];}_0x390b60[_0x3e8a('0x7')](_0x3e8a('0x8'));});_0xbeff3d['on'](_0x3e8a('0x9'),function(_0x41383b){if(_0x41383b[_0x3e8a('0xa')]()==_0x3e8a('0xb')){_0x390b60[_0x3e8a('0x7')](_0x3e8a('0xb'));return;}if(_0x41383b['substring'](0x0,0xb)==_0x3e8a('0xc')){_0x397b05=!![];}if(_0x397b05){_0x5c1bee['rx']+=_0x41383b+'\x0a';if(_0x41383b['search'](_0x3e8a('0xd'))!=-0x1){_0x397b05=![];}}else{_0x5c1bee['rx']=_0x41383b;}if(_0x397b05){return;}if(typeof _0x5c1bee['cb']=='function'){var _0x1a77e8=_0x5c1bee['rx'][_0x3e8a('0xe')](0x0,0x3),_0x35bf18=null,_0x24a81c=null;_0x1a77e8=parseInt(_0x1a77e8);if(isNaN(_0x1a77e8)){_0x5c1bee['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3e8a('0xf')});return;}if(_0x1a77e8!=0xc8){_0x5c1bee['cb'](null,{'code':_0x1a77e8,'result':-0x1,'extra':'KO'});return;}_0x35bf18=_0x5c1bee['rx']['substring'](0x4)[_0x3e8a('0x10')](_0x3e8a('0x11'),'');if(_0x35bf18[_0x3e8a('0x12')]('\x20')!=-0x1){_0x35bf18=_0x35bf18['substr'](0x0,_0x35bf18['indexOf']('\x20'));}if(_[_0x3e8a('0x13')](_0x35bf18,'-1')){_0x35bf18=parseInt(_0x35bf18);}_0x24a81c=_0x5c1bee['rx']['split']('\x20');if(_0x24a81c[_0x3e8a('0x14')]==0x3){_0x24a81c=_0x24a81c[0x2][_0x3e8a('0xe')](0x1,_0x24a81c[0x2][_0x3e8a('0x14')]-0x1);}else if(_0x24a81c[_0x3e8a('0x14')]>0x3){var _0x379ce3=/\((.+)\)/;var _0xf815b1=_0x5c1bee['rx']['match'](_0x379ce3);if(_0xf815b1){_0x24a81c=_0xf815b1[0x1];}else{_0x24a81c=null;}}else{_0x24a81c=null;}_0x5c1bee['cb'](null,{'code':_0x1a77e8,'result':_0x35bf18,'extra':_0x24a81c});}});_0x348242['on'](_0x3e8a('0x15'),function(_0x1c254e){_0x390b60[_0x3e8a('0x7')](_0x3e8a('0x15'),new AGIError('E_AGI_SOCKET_ERROR',_0x1c254e[_0x3e8a('0x16')]));});_0x348242['on'](_0x3e8a('0x17'),function(){_0x390b60[_0x3e8a('0x7')]('close',new AGIError(_0x3e8a('0x18')));});_0x348242['on'](_0x3e8a('0x19'),function(){_0x390b60['emit']('timeout',new AGIError(_0x3e8a('0x1a')));_0x348242['destroy']();});_0x348242[_0x3e8a('0x1b')](_0xbeff3d);this[_0x3e8a('0x1c')]=function(_0x1ae8cb,_0x34a11e){var _0x1ae8cb=_0x1ae8cb||'',_0x34a11e=typeof _0x34a11e==_0x3e8a('0x1d')?_0x34a11e:new Function();_0x5c1bee={'tx':_0x1ae8cb,'rx':'','cb':_0x34a11e};_0x348242[_0x3e8a('0x1e')](_0x1ae8cb+'\x0a');},this[_0x3e8a('0x17')]=function(){_0x348242[_0x3e8a('0x1f')]();};}util[_0x3e8a('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x3e8a('0x21')]=function(_0x3083ce){return this[_0x3e8a('0x1c')][_0x3e8a('0x22')](this,_0x3083ce);};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x24')]=function(){return this[_0x3e8a('0x21')]('ANSWER');};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x25')]=function(_0x36a014,_0x382cdf,_0x425635){_0x36a014=_0x36a014===undefined?_0x3e8a('0x26'):_0x36a014;_0x382cdf=_0x382cdf===undefined?'5':_0x382cdf;_0x425635=_0x425635===undefined?'1':_0x425635;return this['sendRequest'](util[_0x3e8a('0x27')](_0x3e8a('0x28'),_0x36a014,_0x382cdf*0x3e8,_0x425635));};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x29')]=function(_0x40aee6){_0x40aee6=_0x40aee6||_0x3e8a('0x2a');return this[_0x3e8a('0x21')](util[_0x3e8a('0x27')](_0x3e8a('0x2b'),_0x40aee6));};AGIChannel['prototype'][_0x3e8a('0x2c')]=function(_0x331d3d,_0x2a97c2){if(_['isArray'](_0x2a97c2)){return this['sendRequest'](util['format'](_0x3e8a('0x2d'),_0x331d3d,_0x2a97c2[_0x3e8a('0x2e')](',')));}return this[_0x3e8a('0x21')](util[_0x3e8a('0x27')](_0x3e8a('0x2d'),_0x331d3d,_0x2a97c2));};AGIChannel['prototype'][_0x3e8a('0x2f')]=function(_0x7d9e7a){return this[_0x3e8a('0x21')](util[_0x3e8a('0x27')](_0x3e8a('0x30'),_0x7d9e7a));};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x31')]=function(_0x1cbc94){return this[_0x3e8a('0x21')](util[_0x3e8a('0x27')]('SET\x20EXTENSION\x20%s',_0x1cbc94));};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x32')]=function(_0x4b1d83){return this[_0x3e8a('0x21')](util[_0x3e8a('0x27')](_0x3e8a('0x33'),_0x4b1d83));};AGIChannel['prototype'][_0x3e8a('0xb')]=function(){return this['sendRequest'](_0x3e8a('0x34'));};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x35')]=function(_0x521a79,_0x31170a){var _0x2be72f=_['isBoolean'](_0x31170a)||_[_0x3e8a('0x36')](_0x31170a)?_0x31170a['toString']():_0x31170a;return this[_0x3e8a('0x21')](util[_0x3e8a('0x27')](_0x3e8a('0x37'),_0x521a79,_0x2be72f?_0x2be72f[_0x3e8a('0x38')]()[_0x3e8a('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x22f901,_0x4acb62){return this['sendRequest'](util['format'](_0x3e8a('0x39'),_0x22f901,_0x4acb62));};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x3a')]=function(_0x2e7a9b,_0x5bd7cb){return this['sendRequest'](util[_0x3e8a('0x27')](_0x3e8a('0x3b'),_0x2e7a9b,_0x5bd7cb));};AGIChannel['prototype'][_0x3e8a('0x3c')]=function(_0x243f38,_0x266950){return this[_0x3e8a('0x21')](util[_0x3e8a('0x27')](_0x3e8a('0x3d'),_0x243f38,_0x266950));};AGIChannel['prototype'][_0x3e8a('0x3e')]=function(_0x274ec0,_0x57d8c7,_0xc1dbf0){_0x57d8c7=_0x57d8c7||this['extension'];_0xc1dbf0=_0xc1dbf0||0x1;this[_0x3e8a('0x2f')](_0x274ec0);this[_0x3e8a('0x31')](_0x57d8c7);this[_0x3e8a('0x32')](_0xc1dbf0);return this[_0x3e8a('0x29')](util[_0x3e8a('0x27')](_0x3e8a('0x3f'),_0x274ec0,_0x57d8c7,_0xc1dbf0));};AGIChannel['prototype'][_0x3e8a('0x40')]=function(_0xadb3a0){return this['sendRequest'](util['format'](_0x3e8a('0x41'),_0xadb3a0));};AGIChannel['prototype']['recordFile']=function(_0x3c01f4,_0x19c4f2,_0x1e8dfe,_0x2b5d4e,_0xc69984,_0x244615){_0x19c4f2=_0x19c4f2||_0x3e8a('0x42');_0x1e8dfe=_0x1e8dfe||'';_0x2b5d4e=_0x2b5d4e===undefined?-0x1:_0x2b5d4e==='-1'?-0x1:_0x2b5d4e*0x3e8;_0xc69984=_0xc69984===undefined?'':'s='+_0xc69984;_0x244615=_0x244615?_0x3e8a('0x43'):'';return this[_0x3e8a('0x21')](util['format'](_0x3e8a('0x44'),_0x3c01f4,_0x19c4f2,_0x1e8dfe,_0x2b5d4e,_0x244615,_0xc69984));};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x45')]=function(_0xd2f9fc,_0x1d18f7){_0x1d18f7=_0x1d18f7||'';return this[_0x3e8a('0x21')](util[_0x3e8a('0x27')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xd2f9fc,_0x1d18f7));};AGIChannel[_0x3e8a('0x23')]['agi']=function(_0x335adf){return this[_0x3e8a('0x2c')](_0x3e8a('0x46'),_0x335adf);};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x47')]=function(_0x34ae8b){return this[_0x3e8a('0x2c')]('WAIT',_0x34ae8b);};AGIChannel[_0x3e8a('0x23')][_0x3e8a('0x15')]=function(_0x183a71,_0x3a1bc7){this[_0x3e8a('0x29')](util[_0x3e8a('0x27')](_0x3e8a('0x48'),_0x183a71['id'],_0x183a71[_0x3e8a('0x49')],_0x3a1bc7));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 06bdb0b..37052b6 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 _0x41c2=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x490893,_0x30e994){var _0x32f3ac=function(_0x21076c){while(--_0x21076c){_0x490893['push'](_0x490893['shift']());}};_0x32f3ac(++_0x30e994);}(_0x41c2,0x1af));var _0x241c=function(_0x1baeb8,_0x2a5c7f){_0x1baeb8=_0x1baeb8-0x0;var _0x38d7cf=_0x41c2[_0x1baeb8];return _0x38d7cf;};'use strict';var util=require(_0x241c('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x241c('0x1'),'E_AGI_SERVER_ERROR':_0x241c('0x2'),'E_AGI_SERVER_CLOSE':_0x241c('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x241c('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x241c('0x5'),'E_AGI_SOCKET_ERROR':_0x241c('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x241c('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x241c('0x8'),'E_AGI_IVR_ENTRY':_0x241c('0x9')};function AGIError(_0x47fb46){var _0x47fb46=_0x47fb46||null,_0x2c51ac=_0x2c51ac||[],_0x5c1445=0x1,_0x15e2f8='';if(!error[_0x47fb46]){_0x47fb46='E_AGI_UNDEFINED';}_0x2c51ac[_0x241c('0xa')](error[_0x47fb46]);while(arguments[_0x5c1445]){_0x2c51ac[_0x241c('0xa')](arguments[_0x5c1445]);_0x5c1445++;}_0x15e2f8=util[_0x241c('0xb')][_0x241c('0xc')](util,_0x2c51ac);this[_0x241c('0xd')]=_0x15e2f8;this['name']=_0x47fb46;}module[_0x241c('0xe')]=AGIError; \ No newline at end of file +var _0x01a4=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x177d91,_0x100749){var _0x225e7a=function(_0x3c7a22){while(--_0x3c7a22){_0x177d91['push'](_0x177d91['shift']());}};_0x225e7a(++_0x100749);}(_0x01a4,0xce));var _0x401a=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x01a4[_0x506d83];return _0x335e8b;};'use strict';var util=require(_0x401a('0x0'));var error={'E_AGI_UNDEFINED':_0x401a('0x1'),'E_AGI_ARGUMENT_PORT':_0x401a('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x401a('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x401a('0x4'),'E_AGI_SOCKET_ERROR':_0x401a('0x5'),'E_AGI_SOCKET_CLOSE':_0x401a('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x401a('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x401a('0x8'),'E_AGI_IVR_ENTRY':_0x401a('0x9')};function AGIError(_0x47543c){var _0x47543c=_0x47543c||null,_0x2c4b90=_0x2c4b90||[],_0xfa064c=0x1,_0x3e6649='';if(!error[_0x47543c]){_0x47543c=_0x401a('0xa');}_0x2c4b90[_0x401a('0xb')](error[_0x47543c]);while(arguments[_0xfa064c]){_0x2c4b90[_0x401a('0xb')](arguments[_0xfa064c]);_0xfa064c++;}_0x3e6649=util['format']['apply'](util,_0x2c4b90);this[_0x401a('0xc')]=_0x3e6649;this[_0x401a('0xd')]=_0x47543c;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index aca6739..38a7901 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 _0x1364=['invalid','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu','getsecretdigits','edges','numberOfEdges','prototype','vertices','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','split','agicommand','vswitch','target'];(function(_0x42370f,_0x2c8cad){var _0x3838ca=function(_0x321e3e){while(--_0x321e3e){_0x42370f['push'](_0x42370f['shift']());}};_0x3838ca(++_0x2c8cad);}(_0x1364,0x1eb));var _0x4136=function(_0x5885ad,_0x3f4771){_0x5885ad=_0x5885ad-0x0;var _0x2a608b=_0x1364[_0x5885ad];return _0x2a608b;};'use strict';var _=require(_0x4136('0x0'));var logger=require('../../../config/logger')(_0x4136('0x1'));var verticesWithRetry=[_0x4136('0x2'),'getdigits',_0x4136('0x3')];var Graph=function(){this['vertices']={};this[_0x4136('0x4')]={};this[_0x4136('0x5')]=0x0;};Graph[_0x4136('0x6')]['addVertex']=function(_0x47d8f8){this[_0x4136('0x7')][_0x47d8f8['id']]=_0x47d8f8;this['edges'][_0x47d8f8['id']]=[];};Graph[_0x4136('0x6')][_0x4136('0x8')]=function(_0x37c8f8,_0xa9e0bc,_0x1701cc){this[_0x4136('0x4')][_0x37c8f8]['push']({'target':_0xa9e0bc,'condition':_0x1701cc});this[_0x4136('0x5')]+=0x1;};Graph[_0x4136('0x6')]['size']=function(){return _[_0x4136('0x9')](this[_0x4136('0x7')]);};Graph[_0x4136('0x6')][_0x4136('0xa')]=function(){return this[_0x4136('0x5')];};Graph['prototype'][_0x4136('0xb')]=function(_0x3ba45d){return this['vertices'][_0x3ba45d];};Graph['prototype'][_0x4136('0xc')]=function(_0x2d7db8,_0x30ab26){if(!this['vertices'][_0x2d7db8]){return logger[_0x4136('0xd')](_0x4136('0xe'));}var _0x40ccf5=_0x30ab26(this[_0x4136('0x7')][_0x2d7db8]);if(!_0x40ccf5){return logger['info'](_0x4136('0xf'));}if(this[_0x4136('0x4')][_0x2d7db8][_0x4136('0x10')]===0x0){return logger[_0x4136('0xd')](_0x4136('0x11'));}for(var _0x548da2=0x0,_0x655e37=[],_0x4ae17a=![];_0x548da2\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','stringify','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','result','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','addVertex','omit','mxCell','isArray','length','source','target'];(function(_0x3b8e94,_0x234491){var _0x3c161d=function(_0x100d28){while(--_0x100d28){_0x3b8e94['push'](_0x3b8e94['shift']());}};_0x3c161d(++_0x234491);}(_0xded2,0x195));var _0x2ded=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xded2[_0xf71120];return _0xbe2fd3;};'use strict';var parser=require('xml2json');var _=require(_0x2ded('0x0'));var syncho=require(_0x2ded('0x1'));var util=require(_0x2ded('0x2'));var moment=require(_0x2ded('0x3'));var config=require(_0x2ded('0x4'));var logger=require(_0x2ded('0x5'))(_0x2ded('0x6'));var utilLicense=require(_0x2ded('0x7'));var rpc=require(_0x2ded('0x8'));var mailRpc=require(_0x2ded('0x9'));var Graph=require('./graph');var Vertices=require(_0x2ded('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x2ded('0x6')]=_[_0x2ded('0xb')](config[_0x2ded('0x6')],{'ip':_0x2ded('0xc'),'port':0x11dd});function connectionHandler(_0x1c8f5a){process[_0x2ded('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1c8f5a);agiHandler(_0x1c8f5a);}catch(_0x1ceb0f){logger[_0x2ded('0xe')](_0x1ceb0f[_0x2ded('0xf')]);}});});}function listeningHandler(){console[_0x2ded('0x10')](_0x2ded('0x11'),config[_0x2ded('0x6')][_0x2ded('0x12')]);logger['info'](util[_0x2ded('0x13')](_0x2ded('0x14'),config[_0x2ded('0x6')]['ip'],config['agi'][_0x2ded('0x12')]));}function errorHandler(_0x2ef129){if(_0x2ef129&&_0x2ef129[_0x2ded('0x15')]&&_0x2ef129[_0x2ded('0x16')]){logger['error'](util['format']('[%s]\x20%s',_0x2ef129[_0x2ded('0x15')],_0x2ef129[_0x2ded('0x16')]));}else{logger['error'](util['format']('[ERROR]\x20%s',_0x2ef129[_0x2ded('0xf')]));}}function closeHandler(){logger[_0x2ded('0x17')](util[_0x2ded('0x13')](_0x2ded('0x18'),this[_0x2ded('0x19')],this[_0x2ded('0x1a')],this[_0x2ded('0x1b')],this['dnid'],this[_0x2ded('0x1c')]));try{createSquareReport(this);}catch(_0x3e9e68){logger[_0x2ded('0xe')](_0x3e9e68[_0x2ded('0xf')]);}}function timeoutHandler(){logger['info'](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2ded('0x19')],this[_0x2ded('0x1a')],this[_0x2ded('0x1b')],this[_0x2ded('0x1d')],this[_0x2ded('0x1c')]));}function hangupHandler(){logger[_0x2ded('0x17')](util['format'](_0x2ded('0x1e'),this['arg_1'],this[_0x2ded('0x1a')],this['callerid'],this[_0x2ded('0x1d')],this['uniqueid']));this[_0x2ded('0x1f')]=!![];}function getRoot(_0x23a4c0){return parser[_0x2ded('0x20')](_0x23a4c0,{'object':!![]})[_0x2ded('0x21')][_0x2ded('0x22')];}function addVertex(_0x329925,_0x5237e2,_0x2b91b9){_0x5237e2[_0x2ded('0x23')]=_0x2b91b9;if(_0x5237e2[_0x2ded('0x24')]('retry')){_0x5237e2[_0x2ded('0x25')]=parseInt(_0x5237e2['retry'],0xa);}_0x329925[_0x2ded('0x26')](_[_0x2ded('0x27')](_0x5237e2,_0x2ded('0x28')));}function initGraph(_0x6f0a7d,_0x3a6b8b){var _0x3d741a=new Graph();for(var _0x4592a9 in _0x6f0a7d){if(_0x6f0a7d[_0x2ded('0x24')](_0x4592a9)){if(_[_0x2ded('0x29')](_0x6f0a7d[_0x4592a9])){for(var _0x4b65f2=0x0;_0x4b65f2<_0x6f0a7d[_0x4592a9][_0x2ded('0x2a')];_0x4b65f2+=0x1){addVertex(_0x3d741a,_0x6f0a7d[_0x4592a9][_0x4b65f2],_0x4592a9);}}else{addVertex(_0x3d741a,_0x6f0a7d[_0x4592a9],_0x4592a9);}}}for(var _0x1c6812=0x0;_0x1c6812<_0x3a6b8b[_0x2ded('0x2a')];_0x1c6812+=0x1){if(_0x3a6b8b[_0x1c6812][_0x2ded('0x2b')]&&_0x3a6b8b[_0x1c6812][_0x2ded('0x2c')]){_0x3d741a['addEdge'](_0x3a6b8b[_0x1c6812][_0x2ded('0x2b')],_0x3a6b8b[_0x1c6812][_0x2ded('0x2c')],_0x3a6b8b[_0x1c6812]['value']);}}return _0x3d741a;}function getSquareProject(_0x45e3ac,_0x4f48df){rpc[_0x2ded('0x2d')](_0x45e3ac)[_0x2ded('0x2e')](function(_0x4b2560){_0x4f48df(null,_0x4b2560);})[_0x2ded('0x2f')](function(_0xa3c9ef){_0x4f48df(null,_0xa3c9ef);});}function createSquareReport(_0x2e3ceb,_0x24099c){rpc['createSquareReport'](_0x2e3ceb)[_0x2ded('0x2e')](function(_0x1f6d99){if(_0x24099c){_0x24099c(null,_0x1f6d99);}})['catch'](function(_0x1e1e35){if(_0x24099c){_0x24099c(null,_0x1e1e35);}});}function setChannelVariables(_0x5219b8){for(var _0x592d95 in _0x5219b8){if(_0x5219b8[_0x2ded('0x24')](_0x592d95)){if(_0x592d95[_0x2ded('0x30')](_0x2ded('0x31'))===0x0){_0x5219b8[_0x592d95[_0x2ded('0x32')](0x4)]=_0x5219b8[_0x592d95];delete _0x5219b8[_0x592d95];}}}}function getLogFromObject(_0x2e462f){return util[_0x2ded('0x33')](_0x2e462f,{'showHidden':![],'depth':null});}function agiHandler(_0x4e3167){var _0x3816c9,_0x18c842,_0x2fb34e,_0x425169,_0x2256cc;logger[_0x2ded('0x34')]('variables',JSON['stringify'](_0x4e3167,null,0x2));logger['info'](util[_0x2ded('0x13')](_0x2ded('0x35'),_0x4e3167[_0x2ded('0x19')],_0x4e3167[_0x2ded('0x1a')],_0x4e3167['callerid'],_0x4e3167['dnid'],_0x4e3167['uniqueid']));_0x4e3167['on']('error',errorHandler);_0x4e3167['on'](_0x2ded('0x36'),closeHandler);_0x4e3167['on'](_0x2ded('0x37'),timeoutHandler);_0x4e3167[_0x2ded('0x1f')]=![];_0x4e3167['on'](_0x2ded('0x38'),hangupHandler);var _0x159300=getSquareProject[_0x2ded('0x39')](null,_0x4e3167[_0x2ded('0x19')]);if(_0x159300){if(_0x159300[_0x2ded('0x3a')]){_0x3816c9=getRoot(_0x159300['production']);if(_0x3816c9&&_0x3816c9[_0x2ded('0x3b')]){logger[_0x2ded('0x34')](_0x2ded('0x22'),JSON[_0x2ded('0x3c')](_0x3816c9,null,0x2));_0x4e3167['joinAt']=moment()[_0x2ded('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x18c842=initGraph(_[_0x2ded('0x27')](_0x3816c9,_0x2ded('0x28')),_0x3816c9[_0x2ded('0x28')]);_0x2fb34e=new Vertices(_0x4e3167,rpc,mailRpc);logger['info'](util[_0x2ded('0x13')](_0x2ded('0x3d'),_0x4e3167[_0x2ded('0x19')],_0x4e3167[_0x2ded('0x1a')],_0x4e3167[_0x2ded('0x1b')],_0x4e3167['dnid'],_0x4e3167['uniqueid']));_0x18c842['traverseBFS'](_0x3816c9[_0x2ded('0x3b')]['id'],function(_0x51ca98){try{_0x51ca98=_0x2fb34e[_0x2ded('0x3e')](_0x51ca98);logger['debug'](_0x2ded('0x3f'),JSON[_0x2ded('0x3c')](_0x51ca98,null,0x2));if(_0x51ca98[_0x2ded('0x23')]===_0x2ded('0x40')){logger[_0x2ded('0x17')](_0x2ded('0x41'));_0x4e3167[_0x2ded('0x42')]=_0x51ca98[_0x2ded('0x42')]||_0x4e3167['context'];_0x4e3167[_0x2ded('0x43')]=_0x51ca98[_0x2ded('0x43')];_0x4e3167[_0x2ded('0x44')]=_0x51ca98[_0x2ded('0x44')]?_0x51ca98[_0x2ded('0x44')]-0x1:0x1;return null;}else if(_0x51ca98&&_0x2fb34e[_0x51ca98['agicommand']]){_0x2256cc=_0x2fb34e[_0x51ca98[_0x2ded('0x23')]](_0x51ca98);logger[_0x2ded('0x17')](_0x2ded('0x45'),JSON[_0x2ded('0x3c')](_0x2256cc,null,0x2));if(_0x2256cc&&_0x2256cc[_0x2ded('0x46')]===AGI_CODE_SUCCESS&&_0x2256cc['result']!==AGI_RESULT_ERROR&&!_0x4e3167[_0x2ded('0x1f')]){logger[_0x2ded('0x34')](_0x2ded('0x45'),getLogFromObject(_0x2256cc));return _[_0x2ded('0x47')](_0x2256cc['result'])?null:_0x2256cc['result'][_0x2ded('0x48')]();}else{logger[_0x2ded('0xe')](_0x2ded('0x45'),getLogFromObject(_0x2256cc));return null;}}else{logger['error'](_0x2ded('0x49'));return null;}}catch(_0x267a49){logger[_0x2ded('0xe')](_0x267a49[_0x2ded('0xf')]);return null;}});if(_0x3816c9[_0x2ded('0x4a')]){logger['info'](util[_0x2ded('0x13')](_0x2ded('0x4b'),_0x4e3167[_0x2ded('0x19')],_0x4e3167['calleridname'],_0x4e3167[_0x2ded('0x1b')],_0x4e3167[_0x2ded('0x1d')],_0x4e3167[_0x2ded('0x1c')]));_0x18c842[_0x2ded('0x4c')](_0x3816c9[_0x2ded('0x4a')]['id'],function(_0x2af793){try{_0x2af793=_0x2fb34e[_0x2ded('0x3e')](_0x2af793);logger[_0x2ded('0x34')](_0x2ded('0x3f'),JSON['stringify'](_0x2af793,null,0x2));if(_0x2af793&&_0x2fb34e[_0x2af793[_0x2ded('0x23')]]){_0x2256cc=_0x2fb34e[_0x2af793['agicommand']](_0x2af793);if(_0x2256cc){logger[_0x2ded('0x34')](_0x2ded('0x45'),getLogFromObject(_0x2256cc));return _[_0x2ded('0x47')](_0x2256cc[_0x2ded('0x4d')])?null:_0x2256cc[_0x2ded('0x4d')]['toString']();}else{logger['error'](_0x2ded('0x45'),getLogFromObject(_0x2256cc));return null;}}else{logger[_0x2ded('0xe')](_0x2ded('0x49'));return null;}}catch(_0x42188f){logger[_0x2ded('0xe')](_0x42188f[_0x2ded('0xf')]);return null;}});}logger[_0x2ded('0x17')](util[_0x2ded('0x13')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4e3167[_0x2ded('0x19')],_0x4e3167[_0x2ded('0x1a')],_0x4e3167[_0x2ded('0x1b')],_0x4e3167['dnid'],_0x4e3167[_0x2ded('0x1c')]));logger[_0x2ded('0x17')](util['format'](_0x2ded('0x4e'),_0x4e3167[_0x2ded('0x42')],_0x4e3167['extension'],parseInt(_0x4e3167['priority'],0xa)+0x1));_0x4e3167['continueAt'](_0x4e3167[_0x2ded('0x42')],_0x4e3167[_0x2ded('0x43')],parseInt(_0x4e3167['priority'],0xa)+0x1);_0x4e3167[_0x2ded('0x36')]();}}else{logger[_0x2ded('0xe')](util['format'](_0x2ded('0x4f'),_0x4e3167['arg_1']));_0x4e3167['continueAt'](_0x4e3167['context'],_0x4e3167[_0x2ded('0x43')],parseInt(_0x4e3167[_0x2ded('0x44')],0xa)+0x1);_0x4e3167['close']();}}else{logger[_0x2ded('0xe')](util[_0x2ded('0x13')](_0x2ded('0x50'),_0x4e3167[_0x2ded('0x19')]));_0x4e3167[_0x2ded('0x51')](_0x4e3167[_0x2ded('0x42')],_0x4e3167[_0x2ded('0x43')],parseInt(_0x4e3167[_0x2ded('0x44')],0xa)+0x1);_0x4e3167[_0x2ded('0x36')]();}}function main(){var _0x5b93eb;return utilLicense[_0x2ded('0x52')]()[_0x2ded('0x2e')](function(_0x5ce298){if(_0x5ce298){if(_0x5ce298[_0x2ded('0x53')]){if(_0x5ce298[_0x2ded('0x54')]&&_0x5ce298[_0x2ded('0x54')]>0x0){logger['info'](util[_0x2ded('0x13')](_0x2ded('0x55'),_0x5ce298[_0x2ded('0x54')]));_0x5b93eb=_0x5ce298['callysquare'];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x2ded('0x17')](_0x2ded('0x56'));_0x5b93eb=-0x1;}}})[_0x2ded('0x2f')](function(_0x3eb762){logger[_0x2ded('0xe')](_0x2ded('0x57'),_0x3eb762[_0x2ded('0xf')]);})['finally'](function(){var _0x47c601=require(_0x2ded('0x58'))(config['agi']['port'],config[_0x2ded('0x6')]['ip'],_0x5b93eb);_0x47c601['on'](_0x2ded('0xe'),errorHandler);_0x47c601['on']('listening',listeningHandler);_0x47c601['on'](_0x2ded('0x59'),connectionHandler);_0x47c601['on'](_0x2ded('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0xfdb7=['arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','variables','stringify','close','timeout','hangup','sync','production','debug','root','joinAt','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','start','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','agicommand\x20not\x20found','finally','traverseBFS','[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\x20published','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%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'];(function(_0x43e532,_0x22f68e){var _0x3d1ebd=function(_0x43e1f8){while(--_0x43e1f8){_0x43e532['push'](_0x43e532['shift']());}};_0x3d1ebd(++_0x22f68e);}(_0xfdb7,0x155));var _0x7fdb=function(_0x27a3b6,_0x25811c){_0x27a3b6=_0x27a3b6-0x0;var _0x28e95e=_0xfdb7[_0x27a3b6];return _0x28e95e;};'use strict';var parser=require(_0x7fdb('0x0'));var _=require(_0x7fdb('0x1'));var syncho=require('syncho');var util=require('util');var moment=require(_0x7fdb('0x2'));var config=require(_0x7fdb('0x3'));var logger=require('../../config/logger')(_0x7fdb('0x4'));var utilLicense=require(_0x7fdb('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x7fdb('0x6'));var Graph=require(_0x7fdb('0x7'));var Vertices=require(_0x7fdb('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7fdb('0x4')]=_[_0x7fdb('0x9')](config[_0x7fdb('0x4')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x5a41f6){process[_0x7fdb('0xa')](function(){syncho(function(){try{setChannelVariables(_0x5a41f6);agiHandler(_0x5a41f6);}catch(_0x472141){logger[_0x7fdb('0xb')](_0x472141[_0x7fdb('0xc')]);}});});}function listeningHandler(){console['log'](_0x7fdb('0xd'),config[_0x7fdb('0x4')][_0x7fdb('0xe')]);logger['info'](util[_0x7fdb('0xf')](_0x7fdb('0x10'),config[_0x7fdb('0x4')]['ip'],config[_0x7fdb('0x4')]['port']));}function errorHandler(_0x107842){if(_0x107842&&_0x107842[_0x7fdb('0x11')]&&_0x107842[_0x7fdb('0x12')]){logger[_0x7fdb('0xb')](util[_0x7fdb('0xf')](_0x7fdb('0x13'),_0x107842['name'],_0x107842['message']));}else{logger['error'](util[_0x7fdb('0xf')](_0x7fdb('0x14'),_0x107842[_0x7fdb('0xc')]));}}function closeHandler(){logger[_0x7fdb('0x15')](util[_0x7fdb('0xf')](_0x7fdb('0x16'),this[_0x7fdb('0x17')],this[_0x7fdb('0x18')],this[_0x7fdb('0x19')],this[_0x7fdb('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4c253d){logger[_0x7fdb('0xb')](_0x4c253d['stack']);}}function timeoutHandler(){logger['info'](util['format'](_0x7fdb('0x1b'),this[_0x7fdb('0x17')],this[_0x7fdb('0x18')],this[_0x7fdb('0x19')],this[_0x7fdb('0x1a')],this[_0x7fdb('0x1c')]));}function hangupHandler(){logger['info'](util[_0x7fdb('0xf')](_0x7fdb('0x1d'),this[_0x7fdb('0x17')],this[_0x7fdb('0x18')],this[_0x7fdb('0x19')],this[_0x7fdb('0x1a')],this['uniqueid']));this[_0x7fdb('0x1e')]=!![];}function getRoot(_0xdda8d8){return parser[_0x7fdb('0x1f')](_0xdda8d8,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x3e565c,_0x4ef176,_0x3b7150){_0x4ef176[_0x7fdb('0x20')]=_0x3b7150;if(_0x4ef176['hasOwnProperty'](_0x7fdb('0x21'))){_0x4ef176[_0x7fdb('0x22')]=parseInt(_0x4ef176[_0x7fdb('0x21')],0xa);}_0x3e565c[_0x7fdb('0x23')](_[_0x7fdb('0x24')](_0x4ef176,_0x7fdb('0x25')));}function initGraph(_0x241fe6,_0x1a4791){var _0x21f626=new Graph();for(var _0x4e8474 in _0x241fe6){if(_0x241fe6[_0x7fdb('0x26')](_0x4e8474)){if(_[_0x7fdb('0x27')](_0x241fe6[_0x4e8474])){for(var _0x586b7a=0x0;_0x586b7a<_0x241fe6[_0x4e8474][_0x7fdb('0x28')];_0x586b7a+=0x1){addVertex(_0x21f626,_0x241fe6[_0x4e8474][_0x586b7a],_0x4e8474);}}else{addVertex(_0x21f626,_0x241fe6[_0x4e8474],_0x4e8474);}}}for(var _0x25c108=0x0;_0x25c108<_0x1a4791[_0x7fdb('0x28')];_0x25c108+=0x1){if(_0x1a4791[_0x25c108][_0x7fdb('0x29')]&&_0x1a4791[_0x25c108][_0x7fdb('0x2a')]){_0x21f626[_0x7fdb('0x2b')](_0x1a4791[_0x25c108][_0x7fdb('0x29')],_0x1a4791[_0x25c108]['target'],_0x1a4791[_0x25c108][_0x7fdb('0x2c')]);}}return _0x21f626;}function getSquareProject(_0x2cf0d9,_0x17fb9b){rpc[_0x7fdb('0x2d')](_0x2cf0d9)[_0x7fdb('0x2e')](function(_0x550441){_0x17fb9b(null,_0x550441);})[_0x7fdb('0x2f')](function(_0x22ee10){_0x17fb9b(null,_0x22ee10);});}function createSquareReport(_0x50c59e,_0x282833){rpc[_0x7fdb('0x30')](_0x50c59e)[_0x7fdb('0x2e')](function(_0x343029){if(_0x282833){_0x282833(null,_0x343029);}})[_0x7fdb('0x2f')](function(_0x4ea6cd){if(_0x282833){_0x282833(null,_0x4ea6cd);}});}function setChannelVariables(_0x7a410c){for(var _0x26721d in _0x7a410c){if(_0x7a410c[_0x7fdb('0x26')](_0x26721d)){if(_0x26721d[_0x7fdb('0x31')](_0x7fdb('0x32'))===0x0){_0x7a410c[_0x26721d[_0x7fdb('0x33')](0x4)]=_0x7a410c[_0x26721d];delete _0x7a410c[_0x26721d];}}}}function getLogFromObject(_0x17fb2c){return util[_0x7fdb('0x34')](_0x17fb2c,{'showHidden':![],'depth':null});}function agiHandler(_0xac7584){var _0x3e1512,_0x2f1045,_0x5428fc,_0x3cd15f,_0x2c25bc;logger['debug'](_0x7fdb('0x35'),JSON[_0x7fdb('0x36')](_0xac7584,null,0x2));logger[_0x7fdb('0x15')](util[_0x7fdb('0xf')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xac7584['arg_1'],_0xac7584[_0x7fdb('0x18')],_0xac7584[_0x7fdb('0x19')],_0xac7584[_0x7fdb('0x1a')],_0xac7584[_0x7fdb('0x1c')]));_0xac7584['on']('error',errorHandler);_0xac7584['on'](_0x7fdb('0x37'),closeHandler);_0xac7584['on'](_0x7fdb('0x38'),timeoutHandler);_0xac7584[_0x7fdb('0x1e')]=![];_0xac7584['on'](_0x7fdb('0x39'),hangupHandler);var _0x17ea02=getSquareProject[_0x7fdb('0x3a')](null,_0xac7584[_0x7fdb('0x17')]);if(_0x17ea02){if(_0x17ea02[_0x7fdb('0x3b')]){_0x3e1512=getRoot(_0x17ea02[_0x7fdb('0x3b')]);if(_0x3e1512&&_0x3e1512['start']){logger[_0x7fdb('0x3c')](_0x7fdb('0x3d'),JSON['stringify'](_0x3e1512,null,0x2));_0xac7584[_0x7fdb('0x3e')]=moment()[_0x7fdb('0xf')](_0x7fdb('0x3f'));_0x2f1045=initGraph(_['omit'](_0x3e1512,_0x7fdb('0x25')),_0x3e1512['mxCell']);_0x5428fc=new Vertices(_0xac7584,rpc,mailRpc);logger['info'](util[_0x7fdb('0xf')](_0x7fdb('0x40'),_0xac7584['arg_1'],_0xac7584[_0x7fdb('0x18')],_0xac7584[_0x7fdb('0x19')],_0xac7584[_0x7fdb('0x1a')],_0xac7584[_0x7fdb('0x1c')]));_0x2f1045['traverseBFS'](_0x3e1512[_0x7fdb('0x41')]['id'],function(_0x5f3e1d){try{_0x5f3e1d=_0x5428fc[_0x7fdb('0x42')](_0x5f3e1d);logger[_0x7fdb('0x3c')](_0x7fdb('0x43'),JSON['stringify'](_0x5f3e1d,null,0x2));if(_0x5f3e1d['agicommand']==='gotoc'){logger['info'](_0x7fdb('0x44'));_0xac7584[_0x7fdb('0x45')]=_0x5f3e1d[_0x7fdb('0x45')]||_0xac7584[_0x7fdb('0x45')];_0xac7584[_0x7fdb('0x46')]=_0x5f3e1d[_0x7fdb('0x46')];_0xac7584[_0x7fdb('0x47')]=_0x5f3e1d[_0x7fdb('0x47')]?_0x5f3e1d[_0x7fdb('0x47')]-0x1:0x1;return null;}else if(_0x5f3e1d&&_0x5428fc[_0x5f3e1d[_0x7fdb('0x20')]]){_0x2c25bc=_0x5428fc[_0x5f3e1d['agicommand']](_0x5f3e1d);logger['info'](_0x7fdb('0x48'),JSON[_0x7fdb('0x36')](_0x2c25bc,null,0x2));if(_0x2c25bc&&_0x2c25bc[_0x7fdb('0x49')]===AGI_CODE_SUCCESS&&_0x2c25bc['result']!==AGI_RESULT_ERROR&&!_0xac7584['evtHangup']){logger[_0x7fdb('0x3c')]('response',getLogFromObject(_0x2c25bc));return _[_0x7fdb('0x4a')](_0x2c25bc['result'])?null:_0x2c25bc[_0x7fdb('0x4b')][_0x7fdb('0x4c')]();}else{logger[_0x7fdb('0xb')](_0x7fdb('0x48'),getLogFromObject(_0x2c25bc));return null;}}else{logger[_0x7fdb('0xb')](_0x7fdb('0x4d'));return null;}}catch(_0x2ab86a){logger[_0x7fdb('0xb')](_0x2ab86a[_0x7fdb('0xc')]);return null;}});if(_0x3e1512[_0x7fdb('0x4e')]){logger[_0x7fdb('0x15')](util[_0x7fdb('0xf')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xac7584[_0x7fdb('0x17')],_0xac7584[_0x7fdb('0x18')],_0xac7584[_0x7fdb('0x19')],_0xac7584[_0x7fdb('0x1a')],_0xac7584[_0x7fdb('0x1c')]));_0x2f1045[_0x7fdb('0x4f')](_0x3e1512[_0x7fdb('0x4e')]['id'],function(_0x26025e){try{_0x26025e=_0x5428fc[_0x7fdb('0x42')](_0x26025e);logger[_0x7fdb('0x3c')]('vertex',JSON[_0x7fdb('0x36')](_0x26025e,null,0x2));if(_0x26025e&&_0x5428fc[_0x26025e[_0x7fdb('0x20')]]){_0x2c25bc=_0x5428fc[_0x26025e[_0x7fdb('0x20')]](_0x26025e);if(_0x2c25bc){logger[_0x7fdb('0x3c')](_0x7fdb('0x48'),getLogFromObject(_0x2c25bc));return _[_0x7fdb('0x4a')](_0x2c25bc['result'])?null:_0x2c25bc[_0x7fdb('0x4b')][_0x7fdb('0x4c')]();}else{logger[_0x7fdb('0xb')](_0x7fdb('0x48'),getLogFromObject(_0x2c25bc));return null;}}else{logger['error'](_0x7fdb('0x4d'));return null;}}catch(_0x33c7f9){logger[_0x7fdb('0xb')](_0x33c7f9[_0x7fdb('0xc')]);return null;}});}logger[_0x7fdb('0x15')](util[_0x7fdb('0xf')](_0x7fdb('0x50'),_0xac7584[_0x7fdb('0x17')],_0xac7584[_0x7fdb('0x18')],_0xac7584[_0x7fdb('0x19')],_0xac7584['dnid'],_0xac7584[_0x7fdb('0x1c')]));logger[_0x7fdb('0x15')](util[_0x7fdb('0xf')](_0x7fdb('0x51'),_0xac7584[_0x7fdb('0x45')],_0xac7584[_0x7fdb('0x46')],parseInt(_0xac7584[_0x7fdb('0x47')],0xa)+0x1));_0xac7584[_0x7fdb('0x52')](_0xac7584[_0x7fdb('0x45')],_0xac7584[_0x7fdb('0x46')],parseInt(_0xac7584[_0x7fdb('0x47')],0xa)+0x1);_0xac7584[_0x7fdb('0x37')]();}}else{logger[_0x7fdb('0xb')](util['format'](_0x7fdb('0x53'),_0xac7584[_0x7fdb('0x17')]));_0xac7584[_0x7fdb('0x52')](_0xac7584[_0x7fdb('0x45')],_0xac7584[_0x7fdb('0x46')],parseInt(_0xac7584['priority'],0xa)+0x1);_0xac7584['close']();}}else{logger['error'](util[_0x7fdb('0xf')]('Project\x20%s\x20not\x20found',_0xac7584[_0x7fdb('0x17')]));_0xac7584[_0x7fdb('0x52')](_0xac7584['context'],_0xac7584[_0x7fdb('0x46')],parseInt(_0xac7584['priority'],0xa)+0x1);_0xac7584[_0x7fdb('0x37')]();}}function main(){var _0x3bbdb3;return utilLicense[_0x7fdb('0x54')]()['then'](function(_0x11241){if(_0x11241){if(_0x11241['voice']){if(_0x11241[_0x7fdb('0x55')]&&_0x11241[_0x7fdb('0x55')]>0x0){logger[_0x7fdb('0x15')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x11241[_0x7fdb('0x55')]));_0x3bbdb3=_0x11241[_0x7fdb('0x55')];}else{logger[_0x7fdb('0x15')](_0x7fdb('0x56'));}}else{logger[_0x7fdb('0x15')](_0x7fdb('0x57'));_0x3bbdb3=-0x1;}}})[_0x7fdb('0x2f')](function(_0x4225bf){logger[_0x7fdb('0xb')](_0x7fdb('0x58'),_0x4225bf[_0x7fdb('0xc')]);})[_0x7fdb('0x4e')](function(){var _0x4bcc62=require(_0x7fdb('0x59'))(config['agi'][_0x7fdb('0xe')],config['agi']['ip'],_0x3bbdb3);_0x4bcc62['on'](_0x7fdb('0xb'),errorHandler);_0x4bcc62['on'](_0x7fdb('0x5a'),listeningHandler);_0x4bcc62['on']('connection',connectionHandler);_0x4bcc62['on'](_0x7fdb('0x37'),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 927b84a..8f3353e 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 _0xc184=['catch','sendMailMessage','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc184,0x1b2));var _0x4c18=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xc184[_0x3c4f1f];return _0x19cb69;};'use strict';var BPromise=require(_0x4c18('0x0'));var jayson=require(_0x4c18('0x1'));var client=jayson[_0x4c18('0x2')][_0x4c18('0x3')]({'port':0x232b});function request(_0x571233,_0x487d4b){return new BPromise(function(_0x1560df,_0xddd2a0){return client[_0x4c18('0x4')](_0x571233,_0x487d4b)[_0x4c18('0x5')](function(_0xf711b4){if(_0xf711b4[_0x4c18('0x6')]){return _0xddd2a0(_0xf711b4['error']['message']);}else{return _0x1560df(_0xf711b4['result']);}})[_0x4c18('0x7')](function(_0x5a683f){return _0xddd2a0(_0x5a683f);});});}exports[_0x4c18('0x8')]=function(_0x4e3b29,_0x4b98ec){return request('SendMail',{'account':_0x4e3b29,'message':_0x4b98ec});}; \ No newline at end of file +var _0xcabb=['then','error','message','result','sendMailMessage','SendMail','bluebird','client','http','request'];(function(_0x2562f3,_0x644c8){var _0x218af3=function(_0x46ec0e){while(--_0x46ec0e){_0x2562f3['push'](_0x2562f3['shift']());}};_0x218af3(++_0x644c8);}(_0xcabb,0x1aa));var _0xbcab=function(_0x4bb2c0,_0x4d9659){_0x4bb2c0=_0x4bb2c0-0x0;var _0x84fc=_0xcabb[_0x4bb2c0];return _0x84fc;};'use strict';var BPromise=require(_0xbcab('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xbcab('0x1')][_0xbcab('0x2')]({'port':0x232b});function request(_0x4fc4a1,_0xa4bbeb){return new BPromise(function(_0x3664ab,_0xd2d6e){return client[_0xbcab('0x3')](_0x4fc4a1,_0xa4bbeb)[_0xbcab('0x4')](function(_0x12cbe2){if(_0x12cbe2[_0xbcab('0x5')]){return _0xd2d6e(_0x12cbe2[_0xbcab('0x5')][_0xbcab('0x6')]);}else{return _0x3664ab(_0x12cbe2[_0xbcab('0x7')]);}})['catch'](function(_0xf3165d){return _0xd2d6e(_0xf3165d);});});}exports[_0xbcab('0x8')]=function(_0x2de819,_0x4a1f91){return request(_0xbcab('0x9'),{'account':_0x2de819,'message':_0x4a1f91});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index e332e51..e44862b 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 _0x0ce2=['_localBuffer','_inBody','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','emit','headers','exports','util','Transform','call'];(function(_0x1b2c7f,_0x38a7ef){var _0x293375=function(_0x6442b1){while(--_0x6442b1){_0x1b2c7f['push'](_0x1b2c7f['shift']());}};_0x293375(++_0x38a7ef);}(_0x0ce2,0xfd));var _0x20ce=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0ce2[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0x20ce('0x0'));var Transform=require('stream')[_0x20ce('0x1')];function AGIReply(_0x39d98c){Transform[_0x20ce('0x2')](this,_0x39d98c);this[_0x20ce('0x3')]='';this[_0x20ce('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x20ce('0x5')]=function(_0x4eb8e8,_0x3cc2f4,_0x208e54){var _0x5ae7b2='\x0a',_0x52154a=['\x0a\x0a',_0x20ce('0x6')],_0xb3d677=-0x1,_0x2d08e0=-0x1,_0x3ffcbb='',_0x51f566=0x0,_0xb77860='',_0x478551='';this[_0x20ce('0x3')]+=_0x4eb8e8['toString']();_0xb77860=this[_0x20ce('0x3')];if(!this['_inBody']){_0x51f566=0x0;while(_0x52154a[_0x51f566]){while((_0x2d08e0=_0xb77860[_0x20ce('0x7')](_0x52154a[_0x51f566]))!=-0x1){_0x3ffcbb=_0x52154a[_0x51f566];_0x478551=_0xb77860[_0x20ce('0x8')](0x0,_0x2d08e0);_0xb77860=_0xb77860['substring'](_0x2d08e0+_0x3ffcbb[_0x20ce('0x9')]);var _0x5cb2a2=_0x478551[_0x20ce('0xa')](_0x5ae7b2),_0x3e1e6f=0x0,_0x4e5d05={},_0x7c1adf='',_0x4a20a0='',_0x1ab61d=-0x1;while(_0x5cb2a2[_0x3e1e6f]){_0x1ab61d=_0x5cb2a2[_0x3e1e6f][_0x20ce('0x7')](':');if(_0x1ab61d!=-0x1){_0x7c1adf=_0x5cb2a2[_0x3e1e6f][_0x20ce('0xb')](0x0,_0x1ab61d)[_0x20ce('0xc')]();_0x4a20a0=_0x5cb2a2[_0x3e1e6f][_0x20ce('0xb')](_0x1ab61d+0x1)[_0x20ce('0xc')]();if(_0x7c1adf['length']>0x0){_0x4e5d05[_0x7c1adf]=_0x4a20a0;}}else{}_0x3e1e6f++;}this[_0x20ce('0xd')](_0x20ce('0xe'),_0x4e5d05);this[_0x20ce('0x4')]=!![];}_0x51f566++;}this[_0x20ce('0x3')]=_0xb77860;}else{while((_0xb3d677=_0xb77860[_0x20ce('0x7')](_0x5ae7b2))!=-0x1){_0x478551=_0xb77860['substring'](0x0,_0xb3d677);this[_0x20ce('0xd')]('line',_0x478551);_0xb77860=_0xb77860[_0x20ce('0x8')](_0xb3d677+_0x5ae7b2['length']);}this[_0x20ce('0x3')]=_0xb77860;}_0x208e54();};module[_0x20ce('0xf')]=AGIReply; \ No newline at end of file +var _0x3caa=['slice','emit','exports','util','stream','call','_localBuffer','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','trim'];(function(_0x397004,_0x7949f){var _0xa7a10=function(_0x377854){while(--_0x377854){_0x397004['push'](_0x397004['shift']());}};_0xa7a10(++_0x7949f);}(_0x3caa,0x99));var _0xa3ca=function(_0x5cd0bd,_0x189b08){_0x5cd0bd=_0x5cd0bd-0x0;var _0x1bcadf=_0x3caa[_0x5cd0bd];return _0x1bcadf;};'use strict';var util=require(_0xa3ca('0x0'));var Transform=require(_0xa3ca('0x1'))['Transform'];function AGIReply(_0x24754b){Transform[_0xa3ca('0x2')](this,_0x24754b);this[_0xa3ca('0x3')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x3eb1fe,_0x39925a,_0x1f7dec){var _0x55d4b1='\x0a',_0xcc654a=['\x0a\x0a',_0xa3ca('0x4')],_0x200f3b=-0x1,_0x949059=-0x1,_0x4e1be8='',_0x534443=0x0,_0x60dbb5='',_0x4260cb='';this[_0xa3ca('0x3')]+=_0x3eb1fe[_0xa3ca('0x5')]();_0x60dbb5=this['_localBuffer'];if(!this[_0xa3ca('0x6')]){_0x534443=0x0;while(_0xcc654a[_0x534443]){while((_0x949059=_0x60dbb5[_0xa3ca('0x7')](_0xcc654a[_0x534443]))!=-0x1){_0x4e1be8=_0xcc654a[_0x534443];_0x4260cb=_0x60dbb5[_0xa3ca('0x8')](0x0,_0x949059);_0x60dbb5=_0x60dbb5[_0xa3ca('0x8')](_0x949059+_0x4e1be8[_0xa3ca('0x9')]);var _0x5c6128=_0x4260cb[_0xa3ca('0xa')](_0x55d4b1),_0xe146e7=0x0,_0xa74a8c={},_0x433738='',_0x779aa7='',_0x47e61e=-0x1;while(_0x5c6128[_0xe146e7]){_0x47e61e=_0x5c6128[_0xe146e7][_0xa3ca('0x7')](':');if(_0x47e61e!=-0x1){_0x433738=_0x5c6128[_0xe146e7]['slice'](0x0,_0x47e61e)[_0xa3ca('0xb')]();_0x779aa7=_0x5c6128[_0xe146e7][_0xa3ca('0xc')](_0x47e61e+0x1)[_0xa3ca('0xb')]();if(_0x433738[_0xa3ca('0x9')]>0x0){_0xa74a8c[_0x433738]=_0x779aa7;}}else{}_0xe146e7++;}this[_0xa3ca('0xd')]('headers',_0xa74a8c);this[_0xa3ca('0x6')]=!![];}_0x534443++;}this['_localBuffer']=_0x60dbb5;}else{while((_0x200f3b=_0x60dbb5['indexOf'](_0x55d4b1))!=-0x1){_0x4260cb=_0x60dbb5[_0xa3ca('0x8')](0x0,_0x200f3b);this['emit']('line',_0x4260cb);_0x60dbb5=_0x60dbb5['substring'](_0x200f3b+_0x55d4b1[_0xa3ca('0x9')]);}this[_0xa3ca('0x3')]=_0x60dbb5;}_0x1f7dec();};module[_0xa3ca('0xe')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index e0ab347..a1c8b62 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 _0xaab7=['createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','Smtp','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xaab7,0x8e));var _0x7aab=function(_0x8bd3ff,_0x2a53d9){_0x8bd3ff=_0x8bd3ff-0x0;var _0x24ec1a=_0xaab7[_0x8bd3ff];return _0x24ec1a;};'use strict';var BPromise=require(_0x7aab('0x0'));var moment=require(_0x7aab('0x1'));var _=require(_0x7aab('0x2'));var util=require(_0x7aab('0x3'));var jayson=require(_0x7aab('0x4'));var client=jayson[_0x7aab('0x5')][_0x7aab('0x6')]({'port':0x2329});function request(_0x383b11,_0x45cbc3){return new BPromise(function(_0x15e115,_0xf9f2ce){return client[_0x7aab('0x7')](_0x383b11,_0x45cbc3)['then'](function(_0xfaea57){if(_0xfaea57[_0x7aab('0x8')]){return _0xf9f2ce(_0xfaea57[_0x7aab('0x8')][_0x7aab('0x9')]);}else{return _0x15e115(_0xfaea57[_0x7aab('0xa')]);}})[_0x7aab('0xb')](function(_0x56bb94){return _0xf9f2ce(_0x56bb94);});});}exports[_0x7aab('0xc')]=function(_0x3d5aaa){return request(_0x7aab('0xd'),{'options':{'raw':![],'where':{'name':_0x3d5aaa},'attributes':[_0x7aab('0xe')]}});};exports[_0x7aab('0xf')]=function(_0x19119f){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x19119f},'include':[{'model':'MailServerOut','as':_0x7aab('0x10')}],'attributes':['id','name','email']}});};exports[_0x7aab('0x11')]=function(_0x5e2383){return request(_0x7aab('0xd'),{'options':{'where':{'id':_0x5e2383},'attributes':[_0x7aab('0x12')]}});};exports[_0x7aab('0x13')]=function(_0xd40cea){return request(_0x7aab('0x14'),{'options':{'where':{'id':_0xd40cea},'attributes':[_0x7aab('0x12')]}});};exports[_0x7aab('0x15')]=function(_0x4b61d9){return request(_0x7aab('0x16'),{'options':{'where':{'id':_0x4b61d9},'attributes':[_0x7aab('0x12')]}});};exports[_0x7aab('0x17')]=function(_0xbf9ad1){return request(_0x7aab('0x18'),{'options':{'where':{'id':_0xbf9ad1},'attributes':[_0x7aab('0x19')]}});};exports[_0x7aab('0x1a')]=function(_0x37042b){return request('ShowUser',{'options':{'where':{'id':_0x37042b},'attributes':['name']}});};exports[_0x7aab('0x1b')]=function(_0x207c29){return request(_0x7aab('0x1c'),{'options':{'where':{'id':_0x207c29},'attributes':['name']}});};exports['getSoundById']=function(_0x551f66){return request(_0x7aab('0x1d'),{'options':{'where':{'id':_0x551f66},'attributes':[_0x7aab('0x1e')]}});};exports[_0x7aab('0x1f')]=function(_0x5e7c1c){return request(_0x7aab('0x20'),{'options':{'raw':![],'where':{'id':_0x5e7c1c},'include':[{'model':_0x7aab('0x21'),'as':'Intervals'}]}});};exports[_0x7aab('0x22')]=function(_0x2aed33){return request('ShowSmsAccount',{'options':{'where':{'id':_0x2aed33},'attributes':['id',_0x7aab('0x12')]}});};exports[_0x7aab('0x23')]=function(_0x3230ac){return request('CreateSmsMessage',{'body':_0x3230ac});};exports[_0x7aab('0x24')]=function(_0x3b859c){return request(_0x7aab('0x25'),{'body':_0x3b859c});};exports[_0x7aab('0x26')]=function(_0x34b538){return request(_0x7aab('0x27'),{'body':_[_0x7aab('0x28')](_0x34b538,{'project_name':_0x34b538[_0x7aab('0x29')],'prev_project_name':_0x34b538[_0x7aab('0x2a')]||'','is_subproject':_0x34b538[_0x7aab('0x2a')]?!![]:![],'leaveAt':moment()[_0x7aab('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x7aab('0x2c')]=function(_0x4f7b65){return request(_0x7aab('0x2d'),{'body':_0x4f7b65});};exports['createSquareMessage']=function(_0x120263){return request(_0x7aab('0x2e'),{'body':_0x120263});};exports[_0x7aab('0x2f')]=function(_0x27331b){return request(_0x7aab('0x30'),{'options':{'raw':![],'where':{'phone':_0x27331b['phone'],'ListId':_0x27331b[_0x7aab('0x31')]}}})[_0x7aab('0x32')](function(_0x3fd6e6){if(_0x3fd6e6){return _0x3fd6e6;}return request(_0x7aab('0x33'),{'body':_0x27331b});});};exports['getPauseById']=function(_0x25aa23){return request(_0x7aab('0x34'),{'options':{'where':{'id':_0x25aa23},'attributes':['name']}});};exports[_0x7aab('0x35')]=function(_0x4626f0,_0x59fad0){return request('LoginUser',{'body':{'interface':_0x59fad0},'options':{'where':_0x4626f0}});};exports[_0x7aab('0x36')]=function(_0x160316,_0x2bb1b6,_0x393548){return request(_0x7aab('0x37'),{'body':{'type':_0x2bb1b6,'uniqueid':_0x393548},'options':{'where':_0x160316}});};exports['agentUnpause']=function(_0x412718){return request(_0x7aab('0x38'),{'body':{},'options':{'where':_0x412718}});};exports[_0x7aab('0x39')]=function(_0x939dab){return request(_0x7aab('0x3a'),{'body':{},'options':{'where':_0x939dab}});}; \ No newline at end of file +var _0xee8c=['phone','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','UnpauseUser','agentLogout','moment','lodash','util','client','http','then','message','result','getSquareProject','getMailAccountById','MailServerOut','Smtp','email','getSquareProjectById','ShowSquareProject','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','ShowCmHopper'];(function(_0x2a25eb,_0x131fe3){var _0x23e20a=function(_0x3524ad){while(--_0x3524ad){_0x2a25eb['push'](_0x2a25eb['shift']());}};_0x23e20a(++_0x131fe3);}(_0xee8c,0x108));var _0xcee8=function(_0xff7c19,_0x3851ad){_0xff7c19=_0xff7c19-0x0;var _0x4cf916=_0xee8c[_0xff7c19];return _0x4cf916;};'use strict';var BPromise=require('bluebird');var moment=require(_0xcee8('0x0'));var _=require(_0xcee8('0x1'));var util=require(_0xcee8('0x2'));var jayson=require('jayson/promise');var client=jayson[_0xcee8('0x3')][_0xcee8('0x4')]({'port':0x2329});function request(_0x2e2ddc,_0x47c229){return new BPromise(function(_0x101812,_0x373471){return client['request'](_0x2e2ddc,_0x47c229)[_0xcee8('0x5')](function(_0x52471a){if(_0x52471a['error']){return _0x373471(_0x52471a['error'][_0xcee8('0x6')]);}else{return _0x101812(_0x52471a[_0xcee8('0x7')]);}})['catch'](function(_0x32b1c3){return _0x373471(_0x32b1c3);});});}exports[_0xcee8('0x8')]=function(_0x18d3a4){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x18d3a4},'attributes':['production']}});};exports[_0xcee8('0x9')]=function(_0x110b83){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x110b83},'include':[{'model':_0xcee8('0xa'),'as':_0xcee8('0xb')}],'attributes':['id','name',_0xcee8('0xc')]}});};exports[_0xcee8('0xd')]=function(_0x485170){return request(_0xcee8('0xe'),{'options':{'where':{'id':_0x485170},'attributes':[_0xcee8('0xf')]}});};exports[_0xcee8('0x10')]=function(_0x34fae2){return request(_0xcee8('0x11'),{'options':{'where':{'id':_0x34fae2},'attributes':[_0xcee8('0xf')]}});};exports[_0xcee8('0x12')]=function(_0x3bffb9){return request('ShowVariable',{'options':{'where':{'id':_0x3bffb9},'attributes':[_0xcee8('0xf')]}});};exports['getSquareOdbcById']=function(_0x24949d){return request(_0xcee8('0x13'),{'options':{'where':{'id':_0x24949d},'attributes':['dsn']}});};exports[_0xcee8('0x14')]=function(_0x579f6a){return request(_0xcee8('0x15'),{'options':{'where':{'id':_0x579f6a},'attributes':['name']}});};exports[_0xcee8('0x16')]=function(_0x33ecd7){return request(_0xcee8('0x17'),{'options':{'where':{'id':_0x33ecd7},'attributes':[_0xcee8('0xf')]}});};exports[_0xcee8('0x18')]=function(_0xeab999){return request(_0xcee8('0x19'),{'options':{'where':{'id':_0xeab999},'attributes':['save_name']}});};exports[_0xcee8('0x1a')]=function(_0x13ab12){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x13ab12},'include':[{'model':_0xcee8('0x1b'),'as':_0xcee8('0x1c')}]}});};exports[_0xcee8('0x1d')]=function(_0x2f7ed9){return request(_0xcee8('0x1e'),{'options':{'where':{'id':_0x2f7ed9},'attributes':['id',_0xcee8('0xf')]}});};exports[_0xcee8('0x1f')]=function(_0x22b695){return request(_0xcee8('0x20'),{'body':_0x22b695});};exports[_0xcee8('0x21')]=function(_0x3dfad2){return request(_0xcee8('0x22'),{'body':_0x3dfad2});};exports[_0xcee8('0x23')]=function(_0x5f0177){return request(_0xcee8('0x24'),{'body':_['merge'](_0x5f0177,{'project_name':_0x5f0177['arg_1'],'prev_project_name':_0x5f0177[_0xcee8('0x25')]||'','is_subproject':_0x5f0177[_0xcee8('0x25')]?!![]:![],'leaveAt':moment()['format'](_0xcee8('0x26'))})});};exports[_0xcee8('0x27')]=function(_0x13449d){return request('CreateSquareRecording',{'body':_0x13449d});};exports[_0xcee8('0x28')]=function(_0x122bc3){return request('CreateSquareMessage',{'body':_0x122bc3});};exports['createCmContact']=function(_0x3aa39d){return request(_0xcee8('0x29'),{'options':{'raw':![],'where':{'phone':_0x3aa39d[_0xcee8('0x2a')],'ListId':_0x3aa39d[_0xcee8('0x2b')]}}})['then'](function(_0x5d3464){if(_0x5d3464){return _0x5d3464;}return request(_0xcee8('0x2c'),{'body':_0x3aa39d});});};exports[_0xcee8('0x2d')]=function(_0x4ec842){return request(_0xcee8('0x2e'),{'options':{'where':{'id':_0x4ec842},'attributes':[_0xcee8('0xf')]}});};exports['agentLogin']=function(_0x6f8fa4,_0x412ef3){return request(_0xcee8('0x2f'),{'body':{'interface':_0x412ef3},'options':{'where':_0x6f8fa4}});};exports[_0xcee8('0x30')]=function(_0x42d4f9,_0x333ae0,_0x100ee6){return request('PauseUser',{'body':{'type':_0x333ae0,'uniqueid':_0x100ee6},'options':{'where':_0x42d4f9}});};exports['agentUnpause']=function(_0x5b2f87){return request(_0xcee8('0x31'),{'body':{},'options':{'where':_0x5b2f87}});};exports[_0xcee8('0x32')]=function(_0x1b35c3){return request('LogoutUser',{'body':{},'options':{'where':_0x1b35c3}});}; \ 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 2e7e59e..e4691e8 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 _0xd9a8=['./polly','./lex','exports'];(function(_0xca1185,_0x440933){var _0x1ac44e=function(_0x1fde4f){while(--_0x1fde4f){_0xca1185['push'](_0xca1185['shift']());}};_0x1ac44e(++_0x440933);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x57e172,_0x3f7e02){_0x57e172=_0x57e172-0x0;var _0x33d96c=_0xd9a8[_0x57e172];return _0x33d96c;};var polly=require(_0x8d9a('0x0'));var lex=require(_0x8d9a('0x1'));module[_0x8d9a('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7ebb=['./lex','exports','./polly'];(function(_0x2ed6f3,_0x4e5db9){var _0x455e65=function(_0x490f66){while(--_0x490f66){_0x2ed6f3['push'](_0x2ed6f3['shift']());}};_0x455e65(++_0x4e5db9);}(_0x7ebb,0x161));var _0xb7eb=function(_0x35a1cb,_0x5985c3){_0x35a1cb=_0x35a1cb-0x0;var _0x2cd095=_0x7ebb[_0x35a1cb];return _0x2cd095;};var polly=require(_0xb7eb('0x0'));var lex=require(_0xb7eb('0x1'));module[_0xb7eb('0x2')]={'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 f545596..1c12fd9 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. * // * * // ************************************************************************* -var _0xa571=['exports','./lib/api'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xa571,0x107));var _0x1a57=function(_0x4c8890,_0x34c779){_0x4c8890=_0x4c8890-0x0;var _0x2e7ed5=_0xa571[_0x4c8890];return _0x2e7ed5;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ No newline at end of file +var _0x2547=['exports'];(function(_0x2c3642,_0x5cd3a0){var _0x302dfc=function(_0x317eec){while(--_0x317eec){_0x2c3642['push'](_0x2c3642['shift']());}};_0x302dfc(++_0x5cd3a0);}(_0x2547,0x1cd));var _0x7254=function(_0x226992,_0x5bcfa5){_0x226992=_0x226992-0x0;var _0x5c7f48=_0x2547[_0x226992];return _0x5c7f48;};'use strict';var lex=require('./lib/api');module[_0x7254('0x0')]=function(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435){return lex(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435);}; \ 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 f48c02d..351eb25 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(_0x49079b,_0x55d6e2){var _0x11ff34=function(_0x1572e4){while(--_0x1572e4){_0x49079b['push'](_0x49079b['shift']());}};_0x11ff34(++_0x55d6e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x52fd5d,_0x32ef67){var _0x4cdadf=function(_0x266c81){while(--_0x266c81){_0x52fd5d['push'](_0x52fd5d['shift']());}};_0x4cdadf(++_0x32ef67);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 8183141..2890401 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 _0xc4e0=['./lib/api','exports'];(function(_0x40f5b7,_0xb3243e){var _0x3c884a=function(_0x4fc27b){while(--_0x4fc27b){_0x40f5b7['push'](_0x40f5b7['shift']());}};_0x3c884a(++_0xb3243e);}(_0xc4e0,0x15a));var _0x0c4e=function(_0x13f3cb,_0x5f1c58){_0x13f3cb=_0x13f3cb-0x0;var _0x358eba=_0xc4e0[_0x13f3cb];return _0x358eba;};'use strict';var polly=require(_0x0c4e('0x0'));module[_0x0c4e('0x1')]=function(_0x260922,_0x41b1d1,_0x1bbf69,_0x1b9d94,_0x1f6558,_0x3d075b,_0x2ee452){return polly(_0x260922,_0x41b1d1,_0x1bbf69,_0x1b9d94,_0x1f6558,_0x3d075b,_0x2ee452);}; \ No newline at end of file +var _0xaad8=['./lib/api','exports'];(function(_0x4013a4,_0x3dea38){var _0x33be86=function(_0x1e42ee){while(--_0x1e42ee){_0x4013a4['push'](_0x4013a4['shift']());}};_0x33be86(++_0x3dea38);}(_0xaad8,0x110));var _0x8aad=function(_0x51c235,_0x4d3844){_0x51c235=_0x51c235-0x0;var _0x5dd506=_0xaad8[_0x51c235];return _0x5dd506;};'use strict';var polly=require(_0x8aad('0x0'));module[_0x8aad('0x1')]=function(_0x966c0f,_0x5ef458,_0x5ddb53,_0x2f2f0e,_0x43db9d,_0x3802f2,_0x1b3fa0){return polly(_0x966c0f,_0x5ef458,_0x5ddb53,_0x2f2f0e,_0x43db9d,_0x3802f2,_0x1b3fa0);}; \ 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 469ec50..6ee1181 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 _0x934f=['randomstring','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3'];(function(_0x338265,_0x7f0499){var _0xfef9ec=function(_0x56e876){while(--_0x56e876){_0x338265['push'](_0x338265['shift']());}};_0xfef9ec(++_0x7f0499);}(_0x934f,0x68));var _0xf934=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0x934f[_0x3c6b7d];return _0x1d3ed2;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0xf934('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x1ebc46,_0x537f84,_0x4faf11){return new BPromise(function(_0x49aa85,_0x273d8b){_0x1ebc46[_0xf934('0x1')](_0x537f84,function(_0x20ef72,_0xde14dc){if(_0x20ef72){_0x273d8b(_0x20ef72);}else if(_0xde14dc){if(_0xde14dc[_0xf934('0x2')]instanceof Buffer){fs[_0xf934('0x3')](_0x4faf11,_0xde14dc[_0xf934('0x2')],function(_0x3d2b8c){if(_0x3d2b8c){_0x273d8b(_0x3d2b8c);}else{_0x49aa85();}});}else{_0x273d8b(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x273d8b(new Error(_0xf934('0x4')));}});});}module[_0xf934('0x5')]=function(_0x568963,_0x2eb4d0,_0x57dae1,_0x5a0df8,_0x3be531,_0x240af0,_0x2ea2e1){var _0x650383=new AWS[(_0xf934('0x6'))]({'accessKeyId':_0x568963,'secretAccessKey':_0x2eb4d0,'region':_0x57dae1});var _0x23b4b9={'Text':_0x3be531,'TextType':_0x240af0||'text','OutputFormat':_0xf934('0x7'),'VoiceId':_0x5a0df8};return pollyResult(_0x650383,_0x23b4b9,_0x2ea2e1);}; \ No newline at end of file +var _0x50bb=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x50bb,0x66));var _0xb50b=function(_0x4545c4,_0x4967a0){_0x4545c4=_0x4545c4-0x0;var _0x1d17c2=_0x50bb[_0x4545c4];return _0x1d17c2;};'use strict';var fs=require('fs');var path=require(_0xb50b('0x0'));var BPromise=require(_0xb50b('0x1'));var rs=require(_0xb50b('0x2'));var AWS=require(_0xb50b('0x3'));function pollyResult(_0x327dcc,_0x5d5046,_0x5aec8a){return new BPromise(function(_0x4b80cf,_0x527ad3){_0x327dcc[_0xb50b('0x4')](_0x5d5046,function(_0x24861c,_0x44f7cf){if(_0x24861c){_0x527ad3(_0x24861c);}else if(_0x44f7cf){if(_0x44f7cf[_0xb50b('0x5')]instanceof Buffer){fs[_0xb50b('0x6')](_0x5aec8a,_0x44f7cf['AudioStream'],function(_0x53c861){if(_0x53c861){_0x527ad3(_0x53c861);}else{_0x4b80cf();}});}else{_0x527ad3(new Error(_0xb50b('0x7')));}}else{_0x527ad3(new Error(_0xb50b('0x8')));}});});}module[_0xb50b('0x9')]=function(_0x1ebb65,_0x5ccbcb,_0x35d0f9,_0x37d603,_0x4bb900,_0x4bcb5e,_0xa3e4d4){var _0x2cfaa7=new AWS['Polly']({'accessKeyId':_0x1ebb65,'secretAccessKey':_0x5ccbcb,'region':_0x35d0f9});var _0xd5b4e2={'Text':_0x4bb900,'TextType':_0x4bcb5e||_0xb50b('0xa'),'OutputFormat':_0xb50b('0xb'),'VoiceId':_0x37d603};return pollyResult(_0x2cfaa7,_0xd5b4e2,_0xa3e4d4);}; \ 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 cd89a4e..31a3831 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 _0x41ba=['./lib/api','exports'];(function(_0x510bb4,_0x54fef3){var _0x3ad641=function(_0x2204af){while(--_0x2204af){_0x510bb4['push'](_0x510bb4['shift']());}};_0x3ad641(++_0x54fef3);}(_0x41ba,0x15e));var _0xa41b=function(_0x3680ce,_0x14aa82){_0x3680ce=_0x3680ce-0x0;var _0x535e8b=_0x41ba[_0x3680ce];return _0x535e8b;};'use strict';var asr=require(_0xa41b('0x0'));module[_0xa41b('0x1')]=function(_0x25bb88,_0x25c39e,_0x1a954e,_0x4ecec8){return asr(_0x25bb88,_0x25c39e,_0x1a954e);}; \ No newline at end of file +var _0x7685=['./lib/api'];(function(_0x23ab91,_0x7876cb){var _0x4b681c=function(_0x482ec6){while(--_0x482ec6){_0x23ab91['push'](_0x23ab91['shift']());}};_0x4b681c(++_0x7876cb);}(_0x7685,0x1e8));var _0x5768=function(_0x1968f4,_0x60bc27){_0x1968f4=_0x1968f4-0x0;var _0x15c6ef=_0x7685[_0x1968f4];return _0x15c6ef;};'use strict';var asr=require(_0x5768('0x0'));module['exports']=function(_0x9da3c0,_0x26bd2f,_0x5c97c5,_0x59e618){return asr(_0x9da3c0,_0x26bd2f,_0x5c97c5);}; \ 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 68bc1d2..0727330 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 _0x78f0=['base64','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x78f0,0x15d));var _0x078f=function(_0x1d5387,_0x2ddf79){_0x1d5387=_0x1d5387-0x0;var _0x4754b3=_0x78f0[_0x1d5387];return _0x4754b3;};'use strict';var url=require(_0x078f('0x0'));var BPromise=require(_0x078f('0x1'));var fs=require('fs');var host=_0x078f('0x2');module[_0x078f('0x3')]=function(_0x11b4c1,_0x2bde34,_0x34a715){return new BPromise(function(_0x316f1c,_0x5785fd){var _0x2f3d53;if(typeof _0x11b4c1!==_0x078f('0x4')||_0x11b4c1[_0x078f('0x5')]===0x0){return _0x5785fd(_0x078f('0x6'));}if(typeof _0x2bde34!=='string'||_0x2bde34[_0x078f('0x5')]===0x0){return _0x5785fd(_0x078f('0x7'));}if(typeof _0x34a715!=='undefined'&&(typeof _0x34a715!==_0x078f('0x4')||_0x34a715[_0x078f('0x5')]===0x0)){return _0x5785fd(_0x078f('0x8'));}try{_0x2f3d53=fs[_0x078f('0x9')](_0x11b4c1)[_0x078f('0xa')](_0x078f('0xb'));}catch(_0x4207d0){return _0x5785fd(_0x4207d0);}return _0x316f1c({'method':_0x078f('0xc'),'uri':host+'/v1/speech:recognize?key='+_0x2bde34,'body':{'config':{'encoding':_0x078f('0xd'),'sampleRateHertz':_0x078f('0xe'),'languageCode':_0x34a715},'audio':{'content':_0x2f3d53}},'json':!![]});});}; \ No newline at end of file +var _0x34b2=['POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x34b2,0x11c));var _0x234b=function(_0xfac6cd,_0x32fb94){_0xfac6cd=_0xfac6cd-0x0;var _0xeb2337=_0x34b2[_0xfac6cd];return _0xeb2337;};'use strict';var url=require(_0x234b('0x0'));var BPromise=require(_0x234b('0x1'));var fs=require('fs');var host=_0x234b('0x2');module[_0x234b('0x3')]=function(_0x373af7,_0x15fe02,_0x1f63a5){return new BPromise(function(_0x224eb0,_0x43cd81){var _0x55819c;if(typeof _0x373af7!==_0x234b('0x4')||_0x373af7[_0x234b('0x5')]===0x0){return _0x43cd81(_0x234b('0x6'));}if(typeof _0x15fe02!=='string'||_0x15fe02['length']===0x0){return _0x43cd81('key\x20should\x20be\x20a\x20string');}if(typeof _0x1f63a5!==_0x234b('0x7')&&(typeof _0x1f63a5!==_0x234b('0x4')||_0x1f63a5[_0x234b('0x5')]===0x0)){return _0x43cd81(_0x234b('0x8'));}try{_0x55819c=fs['readFileSync'](_0x373af7)['toString'](_0x234b('0x9'));}catch(_0x3a900b){return _0x43cd81(_0x3a900b);}return _0x224eb0({'method':_0x234b('0xa'),'uri':host+_0x234b('0xb')+_0x15fe02,'body':{'config':{'encoding':_0x234b('0xc'),'sampleRateHertz':_0x234b('0xd'),'languageCode':_0x1f63a5},'audio':{'content':_0x55819c}},'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 c30b886..dd8874a 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 _0x782f=['exports','./asr'];(function(_0x54b23e,_0x4af18f){var _0x46d8f5=function(_0x37247b){while(--_0x37247b){_0x54b23e['push'](_0x54b23e['shift']());}};_0x46d8f5(++_0x4af18f);}(_0x782f,0x125));var _0xf782=function(_0x30b6e5,_0x54d8de){_0x30b6e5=_0x30b6e5-0x0;var _0x396ab4=_0x782f[_0x30b6e5];return _0x396ab4;};var asr=require(_0xf782('0x0'));module[_0xf782('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1bf2=['exports'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x1bf2,0x1ac));var _0x21bf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1bf2[_0x5ddb1c];return _0x354adc;};var asr=require('./asr');module[_0x21bf('0x0')]={'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 63b2af6..145a389 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 _0xf746=['https://api.ispeech.org/api/rest','host','path','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','close','error','unlink','download\x20error','pipe','end','protocol','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','audioConfig','MP3','text:synthesize','POST','then','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','.mp3','awsLex','lex','ispeechTTS','format','ispeechASR','model=%s','freeform=3','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','md5','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','../../../config/logger'];(function(_0x48b3fb,_0x4b07bf){var _0x458604=function(_0x5484a2){while(--_0x5484a2){_0x48b3fb['push'](_0x48b3fb['shift']());}};_0x458604(++_0x4b07bf);}(_0xf746,0x185));var _0x6f74=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xf746[_0x1d9aa0];return _0x226868;};'use strict';var apiai=require(_0x6f74('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x6f74('0x1'));var path=require('path');var querystring=require(_0x6f74('0x2'));var rp=require(_0x6f74('0x3'));var rs=require(_0x6f74('0x4'));var sox=require(_0x6f74('0x5'));var tts=require(_0x6f74('0x6'));var urlParse=require('url')[_0x6f74('0x7')];var util=require(_0x6f74('0x8'));var aws=require(_0x6f74('0x9'));var google=require(_0x6f74('0xa'));var sestek=require(_0x6f74('0xb'));var tilde=require('./tilde');var logger=require(_0x6f74('0xc'))('agi');var ISPEECH_API=_0x6f74('0xd');function downloadFile(_0x573eab,_0x485528){return new BPromise(function(_0x207588,_0x466932){var _0x204782=urlParse(_0x573eab);var _0x15f917=_0x204782['protocol']==='https:'?https:http;var _0x1dd7b3={'host':_0x204782[_0x6f74('0xe')],'path':_0x204782[_0x6f74('0xf')],'headers':{'user-agent':'WHAT_EVER'}};_0x15f917[_0x6f74('0x10')](_0x1dd7b3,function(_0xd4be68){if(_0xd4be68[_0x6f74('0x11')]!==0xc8){logger['error'](_0x6f74('0x12')+_0x573eab+_0x6f74('0x13')+_0xd4be68[_0x6f74('0x11')]+'\x20('+_0xd4be68[_0x6f74('0x14')]+')');_0x466932(new Error(_0x6f74('0x12')+_0x573eab+_0x6f74('0x13')+_0xd4be68['statusCode']+'\x20('+_0xd4be68[_0x6f74('0x14')]+')'));return;}var _0x392c3a=fs[_0x6f74('0x15')](_0x485528);_0x392c3a['on']('finish',function(){logger[_0x6f74('0x16')]('finish\x20download\x20file');_0x392c3a[_0x6f74('0x17')](_0x207588);});_0x392c3a['on'](_0x6f74('0x18'),function(_0x20316f){fs[_0x6f74('0x19')](_0x485528);logger[_0x6f74('0x18')](_0x6f74('0x1a'),_0x20316f);_0x466932(_0x20316f);});_0xd4be68[_0x6f74('0x1b')](_0x392c3a);})['on'](_0x6f74('0x18'),function(_0x4023cb){logger['error'](_0x4023cb);_0x466932(_0x4023cb);})[_0x6f74('0x1c')]();});}function uploadFile(_0x2a2a98){return new BPromise(function(_0x5666ff,_0x1315fe){var _0x3e6bbd=urlParse(_0x2a2a98);var _0x4bbb29=_0x3e6bbd[_0x6f74('0x1d')]==='https:'?https:http;var _0x57f547={'host':_0x3e6bbd['host'],'path':_0x3e6bbd[_0x6f74('0xf')],'headers':{'user-agent':'WHAT_EVER'}};_0x4bbb29[_0x6f74('0x10')](_0x57f547,function(_0x59d4c0){if(_0x59d4c0['statusCode']!==0xc8){_0x1315fe(new Error('request\x20to\x20'+_0x2a2a98+_0x6f74('0x13')+_0x59d4c0[_0x6f74('0x11')]+'\x20('+_0x59d4c0[_0x6f74('0x14')]+')'));return;}var _0x3abfc4='';_0x59d4c0['on'](_0x6f74('0x1e'),function(_0x1818d0){_0x3abfc4+=_0x1818d0;});_0x59d4c0['on']('end',function(){_0x5666ff(_0x3abfc4);});})['on'](_0x6f74('0x18'),function(_0x3bee91){_0x1315fe(_0x3bee91);})[_0x6f74('0x1c')]();});}function convertFile(_0x2c1e47,_0x1135f8){return new BPromise(function(_0x3c052c,_0x57863f){var _0x1c01ff=sox[_0x6f74('0x1f')](_0x2c1e47,_0x1135f8,{'sampleRate':0x1f40,'format':_0x6f74('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c01ff['on'](_0x6f74('0x18'),function(_0xbe21c){logger[_0x6f74('0x18')](_0x6f74('0x21'),_0xbe21c);_0x57863f(_0xbe21c);});_0x1c01ff['on'](_0x6f74('0x1c'),function(){logger[_0x6f74('0x16')](_0x6f74('0x22'));_0x3c052c();});_0x1c01ff[_0x6f74('0x23')]();});}function base64Decode(_0x459672,_0x59c988){var _0x536495=path[_0x6f74('0x24')](__dirname,_0x6f74('0x25'),rs[_0x6f74('0x26')](0x4)+_0x6f74('0x27'));fs[_0x6f74('0x28')](_0x536495,_0x459672,_0x6f74('0x29'));return convertFile(_0x536495,_0x59c988)['then'](function(){try{fs[_0x6f74('0x19')](_0x536495);fs[_0x6f74('0x2a')](_0x59c988,_0x6f74('0x2b'));}catch(_0x1a8ba0){logger[_0x6f74('0x18')](_0x1a8ba0);}return _0x59c988[_0x6f74('0x2c')]('.')[0x0];});}function base64Encode(_0x3055c1){var _0x26ff14=fs[_0x6f74('0x2d')](_0x3055c1);return new Buffer(_0x26ff14)[_0x6f74('0x2e')](_0x6f74('0x29'));}exports[_0x6f74('0x2f')]=function(_0x47908f,_0x1f8c13,_0x335d90,_0x212506,_0x29652c,_0x506946){var _0x27e395,_0x416577;var _0x16245f=_0x6f74('0x30');var _0x12a55b='?key='+_0x47908f;var _0x12b8d2={};if(_0x1f8c13==='ssml'){_0x12b8d2[_0x6f74('0x31')]={'ssml':_0x335d90};}else{_0x12b8d2[_0x6f74('0x31')]={'text':_0x335d90};};_0x12b8d2['voice']={'languageCode':_0x212506,'ssmlGender':_0x29652c};_0x12b8d2[_0x6f74('0x32')]={'audioEncoding':_0x6f74('0x33'),'sampleRateHertz':0x1f40};var _0x399db8={'url':_0x16245f+_0x6f74('0x34')+_0x12a55b,'method':_0x6f74('0x35'),'json':!![],'body':_0x12b8d2};return rp(_0x399db8)[_0x6f74('0x36')](function(_0x6184bf){return new BPromise(function(_0x122c6b,_0x7a7504){_0x27e395=path[_0x6f74('0x24')](__dirname,'tmp',rs[_0x6f74('0x26')](0x4)+'.mp3');var _0x1c150e=Buffer[_0x6f74('0x37')](_0x6184bf[_0x6f74('0x38')],'base64');return fs[_0x6f74('0x39')](_0x27e395,_0x1c150e,function(_0x288e0e){_0x7a7504(_0x288e0e);},function(_0x1d6fe4){fs[_0x6f74('0x2a')](_0x27e395,_0x6f74('0x2b'));_0x122c6b(_0x1d6fe4);});});})[_0x6f74('0x36')](function(_0x29a7d6){_0x416577=path[_0x6f74('0x24')](__dirname,'tmp',rs[_0x6f74('0x26')](0x4)+'.wav');return convertFile(_0x27e395,_0x416577);})[_0x6f74('0x36')](function(){try{fs['unlink'](_0x27e395);fs['chmodSync'](_0x416577,_0x6f74('0x2b'));}catch(_0x26ac9c){logger[_0x6f74('0x18')](_0x26ac9c);}logger[_0x6f74('0x16')](_0x6f74('0x3a'),_0x416577['split']('.')[0x0]);return _0x416577[_0x6f74('0x2c')]('.')[0x0];});};exports[_0x6f74('0x3b')]=function(_0x3a5e2e,_0x162d7b){var _0xf3205f=_0x6f74('0x3c');var _0x4b7f73,_0x4538dc;var _0x55c1a2;var _0x29f446={'encoding':_0x6f74('0x3d'),'method':'POST','timeout':0x2710,'url':_0xf3205f,'headers':{'Content-Type':_0x6f74('0x3e')},'body':_0x6f74('0x3f')+encodeURIComponent(JSON[_0x6f74('0x40')]([[[_0x6f74('0x41'),JSON[_0x6f74('0x40')]([_0x3a5e2e,_0x162d7b||'en',![],_0x6f74('0x42')]),null,_0x6f74('0x43')]]]))};return rp(_0x29f446)[_0x6f74('0x36')](function(_0x2f36c2){try{_0x55c1a2=eval(_0x2f36c2[_0x6f74('0x44')](0x5))[0x0][0x2];}catch(_0x41e316){throw new Error(_0x6f74('0x45')+_0x2f36c2[_0x6f74('0x1e')]);}if(!_0x55c1a2){if(_0x3a5e2e[_0x6f74('0x46')]>0xc8){throw new Error(_0x6f74('0x47'));}else{throw new Error(_0x6f74('0x48')+_0x162d7b+_0x6f74('0x49'));}}try{_0x55c1a2=eval(_0x55c1a2)[0x0];}catch(_0x55809a){throw new Error(_0x6f74('0x45')+res['data']);}const _0x4b0899=_0x55c1a2;_0x4b7f73=path[_0x6f74('0x24')](__dirname,_0x6f74('0x25'),rs[_0x6f74('0x26')](0x4)+'.mp3');fs[_0x6f74('0x28')](_0x4b7f73,_0x55c1a2,{'encoding':_0x6f74('0x29')});_0x4538dc=path[_0x6f74('0x24')](__dirname,'tmp',rs[_0x6f74('0x26')](0x4)+_0x6f74('0x27'));return convertFile(_0x4b7f73,_0x4538dc);})[_0x6f74('0x36')](function(){try{fs['unlink'](_0x4b7f73);fs[_0x6f74('0x2a')](_0x4538dc,_0x6f74('0x2b'));}catch(_0x46b4ee){logger['error'](_0x46b4ee);}logger['info']('goggleTTS\x20path',_0x4538dc[_0x6f74('0x2c')]('.')[0x0]);return _0x4538dc[_0x6f74('0x2c')]('.')[0x0];});};exports[_0x6f74('0x4a')]=function(_0x53e20d,_0x36af8c,_0x1aad86){return google[_0x6f74('0x4b')](_0x53e20d,_0x36af8c,_0x1aad86)[_0x6f74('0x36')](function(_0x224636){logger[_0x6f74('0x16')](_0x224636[_0x6f74('0x4c')]);return rp(_0x224636);})[_0x6f74('0x36')](function(_0x4edcf7){var _0x2c4a81='';var _0x75ac1f=0x0;try{fs[_0x6f74('0x19')](_0x53e20d);}catch(_0x240c08){logger[_0x6f74('0x18')](_0x240c08);}if(_0x4edcf7&&_0x4edcf7[_0x6f74('0x4d')]){_0x2c4a81=_0x4edcf7[_0x6f74('0x4d')][_0x6f74('0x4e')](function(_0x56d429){return _0x56d429&&_0x56d429[_0x6f74('0x4f')][0x0]&&_0x56d429[_0x6f74('0x4f')][0x0]['transcript']?_0x56d429['alternatives'][0x0][_0x6f74('0x50')]:'';})[_0x6f74('0x51')]('\x0a');_0x75ac1f=_0x4edcf7[_0x6f74('0x4d')][_0x6f74('0x4e')](function(_0x1522aa){return _0x1522aa&&_0x1522aa[_0x6f74('0x4f')][0x0]&&_0x1522aa[_0x6f74('0x4f')][0x0][_0x6f74('0x52')]?_0x1522aa[_0x6f74('0x4f')][0x0][_0x6f74('0x52')]:0x0;})[_0x6f74('0x51')]('\x0a');}logger[_0x6f74('0x16')](_0x6f74('0x53'),_0x2c4a81);logger[_0x6f74('0x16')](_0x6f74('0x54'),_0x75ac1f);return{'transcript':_0x2c4a81,'confidence':_0x75ac1f};})[_0x6f74('0x55')](function(_0x4262d8){logger[_0x6f74('0x18')]('[%s]\x20%s:%s',_0x4262d8['statusCode'],_0x4262d8[_0x6f74('0x56')],_0x4262d8[_0x6f74('0x57')]);});};exports['googleDialogflow']=function(_0x2e5ac5,_0x49ce19,_0x1c0fc0,_0x56c864){var _0x186a37=apiai(_0x49ce19,{'language':_0x56c864||'en'});return _0x186a37[_0x6f74('0x58')](_0x1c0fc0,{'sessionId':md5(_0x2e5ac5)})[_0x6f74('0x36')](function(_0x5615d2){logger['info'](JSON['stringify'](_0x5615d2));return{'source':_0x5615d2[_0x6f74('0x59')][_0x6f74('0x5a')],'resolvedQuery':_0x5615d2[_0x6f74('0x59')][_0x6f74('0x5b')],'action':_0x5615d2[_0x6f74('0x59')][_0x6f74('0x5c')],'actionIncomplete':_0x5615d2[_0x6f74('0x59')][_0x6f74('0x5d')],'speech':_0x5615d2[_0x6f74('0x59')][_0x6f74('0x5e')][_0x6f74('0x5f')],'score':_0x5615d2[_0x6f74('0x59')][_0x6f74('0x60')],'statusCode':_0x5615d2['status']['code'],'endConversation':_0x5615d2['result'][_0x6f74('0x61')][_0x6f74('0x62')]||![],'isFallbackIntent':_0x5615d2[_0x6f74('0x59')][_0x6f74('0x61')]['isFallbackIntent']};});};exports[_0x6f74('0x63')]=function(_0x5f2e71,_0x2f954d,_0xbbb989,_0x3a0bae,_0x527dc8,_0xb9c63c){var _0x4f0354=_0x3a0bae[_0x6f74('0x64')](/\\n/g,'\x0a');var _0x11dfa9={'credentials':{'private_key':_0x4f0354,'client_email':_0xbbb989}};var _0x48476a=new dialogflow[(_0x6f74('0x65'))](_0x11dfa9);var _0x696bf3=_0x48476a['sessionPath'](_0x2f954d,md5(_0x5f2e71));var _0x503044={'session':_0x696bf3,'queryInput':{'text':{'text':_0x527dc8,'languageCode':_0xb9c63c}}};return _0x48476a[_0x6f74('0x66')](_0x503044)['then'](function(_0x91dc0a){if(_0x91dc0a&&_0x91dc0a[_0x6f74('0x46')]){logger[_0x6f74('0x16')](_0x6f74('0x67'),JSON['stringify'](_0x91dc0a));var _0x1ecb9f=_0x91dc0a[0x0];if(_0x1ecb9f){var _0x191aa4={'action':_0x1ecb9f[_0x6f74('0x68')][_0x6f74('0x5c')],'allRequiredParamsPresent':_0x1ecb9f[_0x6f74('0x68')][_0x6f74('0x69')],'endConversation':_0x1ecb9f[_0x6f74('0x68')][_0x6f74('0x6a')]&&_0x1ecb9f[_0x6f74('0x68')][_0x6f74('0x6a')]['fields']?_0x1ecb9f['queryResult'][_0x6f74('0x6a')][_0x6f74('0x6b')][_0x6f74('0x6c')]['boolValue']:![],'fulfillmentText':_0x1ecb9f[_0x6f74('0x68')][_0x6f74('0x6d')],'intentName':_0x1ecb9f[_0x6f74('0x68')][_0x6f74('0x6e')]['name'],'intentDisplayName':_0x1ecb9f['queryResult'][_0x6f74('0x6e')][_0x6f74('0x6f')],'isFallbackIntent':_0x1ecb9f[_0x6f74('0x68')]['intent'][_0x6f74('0x70')],'languageCode':_0x1ecb9f['queryResult'][_0x6f74('0x71')],'queryText':_0x1ecb9f[_0x6f74('0x68')][_0x6f74('0x72')],'responseId':_0x1ecb9f[_0x6f74('0x73')],'score':_0x1ecb9f[_0x6f74('0x68')][_0x6f74('0x74')],'speech':_0x1ecb9f[_0x6f74('0x68')][_0x6f74('0x6d')],'providerResponse':JSON[_0x6f74('0x40')](_0x91dc0a)};return _0x191aa4;}}});};exports['tildeASR']=function(_0x2a714d,_0x3cb894,_0x1596e2,_0x2723c5){return tilde['asr'](_0x2a714d,_0x3cb894,_0x1596e2,_0x2723c5)[_0x6f74('0x36')](function(_0x4ff233){try{fs['unlink'](_0x2a714d);}catch(_0x44c810){logger[_0x6f74('0x18')](_0x44c810);}logger['info'](_0x6f74('0x75'),_0x4ff233['transcript']);logger[_0x6f74('0x16')]('Tilde\x20ASR\x20confidence',_0x4ff233[_0x6f74('0x52')]);return _0x4ff233;});};exports[_0x6f74('0x76')]=function(_0x2d2a78,_0x1b1a9e,_0x3b2af6,_0x567a5d,_0x12c53b,_0x1f460f){var _0x3d3c6e=path[_0x6f74('0x24')](__dirname,_0x6f74('0x25'),rs[_0x6f74('0x26')](0x4)+_0x6f74('0x77'));var _0x24a8e7;return aws['polly'](_0x2d2a78,_0x1b1a9e,_0x3b2af6,_0x567a5d,_0x12c53b,_0x1f460f,_0x3d3c6e)[_0x6f74('0x36')](function(){_0x24a8e7=path[_0x6f74('0x24')](__dirname,_0x6f74('0x25'),rs[_0x6f74('0x26')](0x4)+'.wav');return convertFile(_0x3d3c6e,_0x24a8e7);})[_0x6f74('0x36')](function(){try{fs[_0x6f74('0x19')](_0x3d3c6e);fs['chmodSync'](_0x24a8e7,_0x6f74('0x2b'));}catch(_0x1124b1){logger[_0x6f74('0x18')](_0x1124b1);}return _0x24a8e7[_0x6f74('0x2c')]('.')[0x0];});};exports[_0x6f74('0x78')]=function(_0x579e78,_0x237c21,_0x46fa60,_0x456752,_0x2e8802,_0x5cddf6){return aws[_0x6f74('0x79')](_0x579e78,_0x237c21,_0x46fa60,_0x456752,_0x2e8802,_0x5cddf6)[_0x6f74('0x36')](function(_0x32d624){logger['info'](JSON[_0x6f74('0x40')](_0x32d624));return _0x32d624;});};exports[_0x6f74('0x7a')]=function(_0x3b8430,_0x192321,_0x326430,_0x39e1a6){var _0x4efc18=util[_0x6f74('0x7b')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3b8430,encodeURIComponent(_0x192321),_0x326430,_0x39e1a6);var _0x4854e7=path[_0x6f74('0x24')](__dirname,_0x6f74('0x25'),rs[_0x6f74('0x26')](0x4)+'.mp3');var _0x4f7f16;return downloadFile(_0x4efc18,_0x4854e7)[_0x6f74('0x36')](function(){_0x4f7f16=path[_0x6f74('0x24')](__dirname,_0x6f74('0x25'),rs[_0x6f74('0x26')](0x4)+_0x6f74('0x27'));return convertFile(_0x4854e7,_0x4f7f16);})[_0x6f74('0x36')](function(){try{fs[_0x6f74('0x19')](_0x4854e7);fs[_0x6f74('0x2a')](_0x4f7f16,_0x6f74('0x2b'));}catch(_0x4fa3c6){logger[_0x6f74('0x18')](_0x4fa3c6);}return _0x4f7f16[_0x6f74('0x2c')]('.')[0x0];});};exports[_0x6f74('0x7c')]=function(_0x2926a6,_0x1d35ef,_0x4c2672,_0x327b6e){var _0x3345db=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1d35ef,_0x4c2672,base64Encode(_0x2926a6),_0x327b6e?util[_0x6f74('0x7b')](_0x6f74('0x7d'),encodeURIComponent(_0x327b6e)):_0x6f74('0x7e'));return uploadFile(_0x3345db)[_0x6f74('0x36')](function(_0x5b0b93){return querystring[_0x6f74('0x7')](_0x5b0b93);});};exports[_0x6f74('0x7f')]=function(_0x283908,_0x12a46d){return sestek[_0x6f74('0x80')](_0x283908,_0x12a46d)['then'](function(_0x4a6cdb){logger[_0x6f74('0x16')](JSON['stringify'](_0x4a6cdb));var _0x36d9b4={'speech':_0x4a6cdb['text'],'action':_0x4a6cdb['channelData']?_0x4a6cdb[_0x6f74('0x81')]['CustomAction']:undefined,'actiondata':_0x4a6cdb[_0x6f74('0x81')]?_0x4a6cdb[_0x6f74('0x81')][_0x6f74('0x82')]:undefined};if(_0x4a6cdb['channelData']&&_0x4a6cdb['channelData'][_0x6f74('0x83')]){return base64Decode(_0x4a6cdb[_0x6f74('0x81')][_0x6f74('0x83')][_0x6f74('0x84')],path[_0x6f74('0x24')](__dirname,_0x6f74('0x25'),rs['generate'](0x4)+'.wav'))[_0x6f74('0x36')](function(_0x27ec70){_0x36d9b4[_0x6f74('0x85')]=_0x27ec70;return _0x36d9b4;});}return _0x36d9b4;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xedc7=['./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','info','pipe','end','path','get','data','wav','error\x20convert','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','POST','resolve','.mp3','from','audioContent','unlink','googleCloudTTS\x20path','googleTTS','utf8','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','action','fulfillment','speech','code','metadata','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','md5','querystring','randomstring','sox','url','parse','util','./aws','./google'];(function(_0xefb4e,_0xe56689){var _0x36c78c=function(_0x158fe3){while(--_0x158fe3){_0xefb4e['push'](_0xefb4e['shift']());}};_0x36c78c(++_0xe56689);}(_0xedc7,0x77));var _0x7edc=function(_0x486442,_0xfcf71f){_0x486442=_0x486442-0x0;var _0x4be075=_0xedc7[_0x486442];return _0x4be075;};'use strict';var apiai=require(_0x7edc('0x0'));var BPromise=require(_0x7edc('0x1'));var dialogflow=require(_0x7edc('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x7edc('0x3'));var path=require('path');var querystring=require(_0x7edc('0x4'));var rp=require('request-promise');var rs=require(_0x7edc('0x5'));var sox=require(_0x7edc('0x6'));var tts=require('google-tts-api');var urlParse=require(_0x7edc('0x7'))[_0x7edc('0x8')];var util=require(_0x7edc('0x9'));var aws=require(_0x7edc('0xa'));var google=require(_0x7edc('0xb'));var sestek=require(_0x7edc('0xc'));var tilde=require(_0x7edc('0xd'));var logger=require('../../../config/logger')(_0x7edc('0xe'));var ISPEECH_API=_0x7edc('0xf');function downloadFile(_0x58d22b,_0x22b953){return new BPromise(function(_0x1a59d1,_0x22189a){var _0x298a5d=urlParse(_0x58d22b);var _0x54789a=_0x298a5d[_0x7edc('0x10')]===_0x7edc('0x11')?https:http;var _0x18b6b4={'host':_0x298a5d[_0x7edc('0x12')],'path':_0x298a5d['path'],'headers':{'user-agent':_0x7edc('0x13')}};_0x54789a['get'](_0x18b6b4,function(_0x2ff9ae){if(_0x2ff9ae[_0x7edc('0x14')]!==0xc8){logger[_0x7edc('0x15')]('request\x20to\x20'+_0x58d22b+_0x7edc('0x16')+_0x2ff9ae[_0x7edc('0x14')]+'\x20('+_0x2ff9ae[_0x7edc('0x17')]+')');_0x22189a(new Error(_0x7edc('0x18')+_0x58d22b+_0x7edc('0x16')+_0x2ff9ae[_0x7edc('0x14')]+'\x20('+_0x2ff9ae[_0x7edc('0x17')]+')'));return;}var _0x152f15=fs['createWriteStream'](_0x22b953);_0x152f15['on']('finish',function(){logger[_0x7edc('0x19')]('finish\x20download\x20file');_0x152f15['close'](_0x1a59d1);});_0x152f15['on']('error',function(_0x21cebf){fs['unlink'](_0x22b953);logger[_0x7edc('0x15')]('download\x20error',_0x21cebf);_0x22189a(_0x21cebf);});_0x2ff9ae[_0x7edc('0x1a')](_0x152f15);})['on'](_0x7edc('0x15'),function(_0x4674d4){logger[_0x7edc('0x15')](_0x4674d4);_0x22189a(_0x4674d4);})[_0x7edc('0x1b')]();});}function uploadFile(_0xd62da6){return new BPromise(function(_0x17f01b,_0xb942b1){var _0x38921a=urlParse(_0xd62da6);var _0x488468=_0x38921a[_0x7edc('0x10')]===_0x7edc('0x11')?https:http;var _0x2d5fec={'host':_0x38921a[_0x7edc('0x12')],'path':_0x38921a[_0x7edc('0x1c')],'headers':{'user-agent':_0x7edc('0x13')}};_0x488468[_0x7edc('0x1d')](_0x2d5fec,function(_0x7d628b){if(_0x7d628b[_0x7edc('0x14')]!==0xc8){_0xb942b1(new Error(_0x7edc('0x18')+_0xd62da6+'\x20failed,\x20status\x20code\x20=\x20'+_0x7d628b['statusCode']+'\x20('+_0x7d628b[_0x7edc('0x17')]+')'));return;}var _0x1a8ca8='';_0x7d628b['on'](_0x7edc('0x1e'),function(_0x54b024){_0x1a8ca8+=_0x54b024;});_0x7d628b['on']('end',function(){_0x17f01b(_0x1a8ca8);});})['on'](_0x7edc('0x15'),function(_0xaa76be){_0xb942b1(_0xaa76be);})[_0x7edc('0x1b')]();});}function convertFile(_0x26065d,_0xfd763c){return new BPromise(function(_0xa0b4d6,_0x973273){var _0x20eb1b=sox['transcode'](_0x26065d,_0xfd763c,{'sampleRate':0x1f40,'format':_0x7edc('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x20eb1b['on']('error',function(_0x59e712){logger[_0x7edc('0x15')](_0x7edc('0x20'),_0x59e712);_0x973273(_0x59e712);});_0x20eb1b['on'](_0x7edc('0x1b'),function(){logger['info']('finish\x20to\x20convert');_0xa0b4d6();});_0x20eb1b['start']();});}function base64Decode(_0x555736,_0x1e0d96){var _0x34afd5=path['resolve'](__dirname,_0x7edc('0x21'),rs[_0x7edc('0x22')](0x4)+_0x7edc('0x23'));fs[_0x7edc('0x24')](_0x34afd5,_0x555736,_0x7edc('0x25'));return convertFile(_0x34afd5,_0x1e0d96)[_0x7edc('0x26')](function(){try{fs['unlink'](_0x34afd5);fs[_0x7edc('0x27')](_0x1e0d96,_0x7edc('0x28'));}catch(_0x2fb9f2){logger[_0x7edc('0x15')](_0x2fb9f2);}return _0x1e0d96[_0x7edc('0x29')]('.')[0x0];});}function base64Encode(_0xcf3b78){var _0x13202f=fs[_0x7edc('0x2a')](_0xcf3b78);return new Buffer(_0x13202f)[_0x7edc('0x2b')]('base64');}exports[_0x7edc('0x2c')]=function(_0x18ea4e,_0x1c0501,_0x5803dc,_0x5b259e,_0x3be892,_0x1cd4d5){var _0x1e794b,_0x523601;var _0x577e1f=_0x7edc('0x2d');var _0xda926f=_0x7edc('0x2e')+_0x18ea4e;var _0x5855c5={};if(_0x1c0501==='ssml'){_0x5855c5[_0x7edc('0x2f')]={'ssml':_0x5803dc};}else{_0x5855c5['input']={'text':_0x5803dc};};_0x5855c5[_0x7edc('0x30')]={'languageCode':_0x5b259e,'ssmlGender':_0x3be892};_0x5855c5[_0x7edc('0x31')]={'audioEncoding':_0x7edc('0x32'),'sampleRateHertz':0x1f40};var _0x1315ea={'url':_0x577e1f+'text:synthesize'+_0xda926f,'method':_0x7edc('0x33'),'json':!![],'body':_0x5855c5};return rp(_0x1315ea)[_0x7edc('0x26')](function(_0x3fc518){return new BPromise(function(_0x713a27,_0x1e001d){_0x1e794b=path[_0x7edc('0x34')](__dirname,_0x7edc('0x21'),rs[_0x7edc('0x22')](0x4)+_0x7edc('0x35'));var _0x2fe6aa=Buffer[_0x7edc('0x36')](_0x3fc518[_0x7edc('0x37')],_0x7edc('0x25'));return fs['writeFile'](_0x1e794b,_0x2fe6aa,function(_0x208a7f){_0x1e001d(_0x208a7f);},function(_0x22bc9c){fs[_0x7edc('0x27')](_0x1e794b,'777');_0x713a27(_0x22bc9c);});});})['then'](function(_0x480ba1){_0x523601=path['resolve'](__dirname,_0x7edc('0x21'),rs['generate'](0x4)+_0x7edc('0x23'));return convertFile(_0x1e794b,_0x523601);})[_0x7edc('0x26')](function(){try{fs[_0x7edc('0x38')](_0x1e794b);fs['chmodSync'](_0x523601,_0x7edc('0x28'));}catch(_0x555d09){logger[_0x7edc('0x15')](_0x555d09);}logger['info'](_0x7edc('0x39'),_0x523601[_0x7edc('0x29')]('.')[0x0]);return _0x523601[_0x7edc('0x29')]('.')[0x0];});};exports[_0x7edc('0x3a')]=function(_0x144bfa,_0x5cb37d){var _0xd9be7b='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5400b6,_0x4e0f2d;var _0x76054d;var _0x45c9b5={'encoding':_0x7edc('0x3b'),'method':_0x7edc('0x33'),'timeout':0x2710,'url':_0xd9be7b,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x7edc('0x3c')+encodeURIComponent(JSON[_0x7edc('0x3d')]([[['jQ1olc',JSON[_0x7edc('0x3d')]([_0x144bfa,_0x5cb37d||'en',![],_0x7edc('0x3e')]),null,_0x7edc('0x3f')]]]))};return rp(_0x45c9b5)[_0x7edc('0x26')](function(_0x4740e1){try{_0x76054d=eval(_0x4740e1[_0x7edc('0x40')](0x5))[0x0][0x2];}catch(_0x5aa679){throw new Error(_0x7edc('0x41')+_0x4740e1[_0x7edc('0x1e')]);}if(!_0x76054d){if(_0x144bfa[_0x7edc('0x42')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x5cb37d+_0x7edc('0x43'));}}try{_0x76054d=eval(_0x76054d)[0x0];}catch(_0x53497b){throw new Error(_0x7edc('0x41')+res[_0x7edc('0x1e')]);}const _0x1504ae=_0x76054d;_0x5400b6=path['resolve'](__dirname,_0x7edc('0x21'),rs[_0x7edc('0x22')](0x4)+_0x7edc('0x35'));fs[_0x7edc('0x24')](_0x5400b6,_0x76054d,{'encoding':'base64'});_0x4e0f2d=path[_0x7edc('0x34')](__dirname,_0x7edc('0x21'),rs[_0x7edc('0x22')](0x4)+_0x7edc('0x23'));return convertFile(_0x5400b6,_0x4e0f2d);})['then'](function(){try{fs[_0x7edc('0x38')](_0x5400b6);fs[_0x7edc('0x27')](_0x4e0f2d,_0x7edc('0x28'));}catch(_0x2b294e){logger['error'](_0x2b294e);}logger[_0x7edc('0x19')](_0x7edc('0x44'),_0x4e0f2d[_0x7edc('0x29')]('.')[0x0]);return _0x4e0f2d[_0x7edc('0x29')]('.')[0x0];});};exports['googleASR']=function(_0x5a2a15,_0x358124,_0x2b0fa7){return google[_0x7edc('0x45')](_0x5a2a15,_0x358124,_0x2b0fa7)['then'](function(_0x1e8e6d){logger[_0x7edc('0x19')](_0x1e8e6d[_0x7edc('0x46')]);return rp(_0x1e8e6d);})[_0x7edc('0x26')](function(_0x3595de){var _0x2cad48='';var _0x2ca9b5=0x0;try{fs[_0x7edc('0x38')](_0x5a2a15);}catch(_0x46125d){logger[_0x7edc('0x15')](_0x46125d);}if(_0x3595de&&_0x3595de[_0x7edc('0x47')]){_0x2cad48=_0x3595de['results'][_0x7edc('0x48')](function(_0x45b997){return _0x45b997&&_0x45b997['alternatives'][0x0]&&_0x45b997[_0x7edc('0x49')][0x0][_0x7edc('0x4a')]?_0x45b997[_0x7edc('0x49')][0x0][_0x7edc('0x4a')]:'';})[_0x7edc('0x4b')]('\x0a');_0x2ca9b5=_0x3595de[_0x7edc('0x47')][_0x7edc('0x48')](function(_0x33c083){return _0x33c083&&_0x33c083['alternatives'][0x0]&&_0x33c083[_0x7edc('0x49')][0x0]['confidence']?_0x33c083[_0x7edc('0x49')][0x0]['confidence']:0x0;})[_0x7edc('0x4b')]('\x0a');}logger['info'](_0x7edc('0x4c'),_0x2cad48);logger[_0x7edc('0x19')](_0x7edc('0x4d'),_0x2ca9b5);return{'transcript':_0x2cad48,'confidence':_0x2ca9b5};})[_0x7edc('0x4e')](function(_0x33e74a){logger[_0x7edc('0x15')](_0x7edc('0x4f'),_0x33e74a[_0x7edc('0x14')],_0x33e74a[_0x7edc('0x50')],_0x33e74a[_0x7edc('0x51')]);});};exports[_0x7edc('0x52')]=function(_0xc7f3c8,_0x29aa11,_0x382205,_0x410fc1){var _0xf02d18=apiai(_0x29aa11,{'language':_0x410fc1||'en'});return _0xf02d18[_0x7edc('0x53')](_0x382205,{'sessionId':md5(_0xc7f3c8)})[_0x7edc('0x26')](function(_0x526942){logger[_0x7edc('0x19')](JSON[_0x7edc('0x3d')](_0x526942));return{'source':_0x526942['result'][_0x7edc('0x54')],'resolvedQuery':_0x526942[_0x7edc('0x55')]['resolvedQuery'],'action':_0x526942['result'][_0x7edc('0x56')],'actionIncomplete':_0x526942['result']['actionIncomplete'],'speech':_0x526942[_0x7edc('0x55')][_0x7edc('0x57')][_0x7edc('0x58')],'score':_0x526942[_0x7edc('0x55')]['score'],'statusCode':_0x526942['status'][_0x7edc('0x59')],'endConversation':_0x526942[_0x7edc('0x55')][_0x7edc('0x5a')]['endConversation']||![],'isFallbackIntent':_0x526942[_0x7edc('0x55')]['metadata'][_0x7edc('0x5b')]};});};exports[_0x7edc('0x5c')]=function(_0x437f7f,_0x1bf1b3,_0x125c88,_0x2b69c8,_0x30cda1,_0xff4013){var _0x42a9f2=_0x2b69c8[_0x7edc('0x5d')](/\\n/g,'\x0a');var _0x5076e0={'credentials':{'private_key':_0x42a9f2,'client_email':_0x125c88}};var _0x9b10e6=new dialogflow['SessionsClient'](_0x5076e0);var _0x4baa46=_0x9b10e6[_0x7edc('0x5e')](_0x1bf1b3,md5(_0x437f7f));var _0x2a551c={'session':_0x4baa46,'queryInput':{'text':{'text':_0x30cda1,'languageCode':_0xff4013}}};return _0x9b10e6[_0x7edc('0x5f')](_0x2a551c)[_0x7edc('0x26')](function(_0x23fa0f){if(_0x23fa0f&&_0x23fa0f[_0x7edc('0x42')]){logger[_0x7edc('0x19')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x23fa0f));var _0x13aa99=_0x23fa0f[0x0];if(_0x13aa99){var _0x51ded1={'action':_0x13aa99[_0x7edc('0x60')][_0x7edc('0x56')],'allRequiredParamsPresent':_0x13aa99[_0x7edc('0x60')][_0x7edc('0x61')],'endConversation':_0x13aa99[_0x7edc('0x60')][_0x7edc('0x62')]&&_0x13aa99['queryResult'][_0x7edc('0x62')][_0x7edc('0x63')]?_0x13aa99['queryResult'][_0x7edc('0x62')][_0x7edc('0x63')][_0x7edc('0x64')][_0x7edc('0x65')]:![],'fulfillmentText':_0x13aa99['queryResult']['fulfillmentText'],'intentName':_0x13aa99[_0x7edc('0x60')][_0x7edc('0x66')][_0x7edc('0x50')],'intentDisplayName':_0x13aa99['queryResult']['intent'][_0x7edc('0x67')],'isFallbackIntent':_0x13aa99[_0x7edc('0x60')][_0x7edc('0x66')][_0x7edc('0x68')],'languageCode':_0x13aa99[_0x7edc('0x60')]['languageCode'],'queryText':_0x13aa99[_0x7edc('0x60')][_0x7edc('0x69')],'responseId':_0x13aa99[_0x7edc('0x6a')],'score':_0x13aa99[_0x7edc('0x60')][_0x7edc('0x6b')],'speech':_0x13aa99[_0x7edc('0x60')][_0x7edc('0x6c')],'providerResponse':JSON[_0x7edc('0x3d')](_0x23fa0f)};return _0x51ded1;}}});};exports[_0x7edc('0x6d')]=function(_0x1daaef,_0x263d2b,_0x407272,_0x46a383){return tilde[_0x7edc('0x45')](_0x1daaef,_0x263d2b,_0x407272,_0x46a383)['then'](function(_0x50146c){try{fs['unlink'](_0x1daaef);}catch(_0x47402a){logger['error'](_0x47402a);}logger[_0x7edc('0x19')](_0x7edc('0x6e'),_0x50146c[_0x7edc('0x4a')]);logger[_0x7edc('0x19')](_0x7edc('0x6f'),_0x50146c[_0x7edc('0x70')]);return _0x50146c;});};exports[_0x7edc('0x71')]=function(_0x86b3a,_0x12a79b,_0x3dc26f,_0x3fd4c4,_0x580741,_0x59e56f){var _0x4b2608=path[_0x7edc('0x34')](__dirname,_0x7edc('0x21'),rs[_0x7edc('0x22')](0x4)+_0x7edc('0x35'));var _0x427abe;return aws[_0x7edc('0x72')](_0x86b3a,_0x12a79b,_0x3dc26f,_0x3fd4c4,_0x580741,_0x59e56f,_0x4b2608)['then'](function(){_0x427abe=path[_0x7edc('0x34')](__dirname,_0x7edc('0x21'),rs[_0x7edc('0x22')](0x4)+_0x7edc('0x23'));return convertFile(_0x4b2608,_0x427abe);})[_0x7edc('0x26')](function(){try{fs[_0x7edc('0x38')](_0x4b2608);fs[_0x7edc('0x27')](_0x427abe,_0x7edc('0x28'));}catch(_0x13ba31){logger[_0x7edc('0x15')](_0x13ba31);}return _0x427abe[_0x7edc('0x29')]('.')[0x0];});};exports[_0x7edc('0x73')]=function(_0x49570a,_0x4e5898,_0x4a9aed,_0x1a1198,_0x30249e,_0x52b2db){return aws['lex'](_0x49570a,_0x4e5898,_0x4a9aed,_0x1a1198,_0x30249e,_0x52b2db)['then'](function(_0x9d9057){logger[_0x7edc('0x19')](JSON[_0x7edc('0x3d')](_0x9d9057));return _0x9d9057;});};exports[_0x7edc('0x74')]=function(_0x4385d6,_0x186b56,_0x2c6887,_0x495df6){var _0x5c8324=util[_0x7edc('0x75')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4385d6,encodeURIComponent(_0x186b56),_0x2c6887,_0x495df6);var _0x36086e=path['resolve'](__dirname,_0x7edc('0x21'),rs[_0x7edc('0x22')](0x4)+'.mp3');var _0x35c66a;return downloadFile(_0x5c8324,_0x36086e)[_0x7edc('0x26')](function(){_0x35c66a=path[_0x7edc('0x34')](__dirname,_0x7edc('0x21'),rs[_0x7edc('0x22')](0x4)+_0x7edc('0x23'));return convertFile(_0x36086e,_0x35c66a);})['then'](function(){try{fs['unlink'](_0x36086e);fs[_0x7edc('0x27')](_0x35c66a,_0x7edc('0x28'));}catch(_0x2e8857){logger[_0x7edc('0x15')](_0x2e8857);}return _0x35c66a[_0x7edc('0x29')]('.')[0x0];});};exports[_0x7edc('0x76')]=function(_0x59c347,_0x56deaf,_0x42620b,_0x1b3234){var _0x5e0c14=util['format'](_0x7edc('0x77'),ISPEECH_API,_0x56deaf,_0x42620b,base64Encode(_0x59c347),_0x1b3234?util['format'](_0x7edc('0x78'),encodeURIComponent(_0x1b3234)):_0x7edc('0x79'));return uploadFile(_0x5e0c14)[_0x7edc('0x26')](function(_0x45c40c){return querystring[_0x7edc('0x8')](_0x45c40c);});};exports[_0x7edc('0x7a')]=function(_0x376722,_0x1a9efa){return sestek[_0x7edc('0x7b')](_0x376722,_0x1a9efa)[_0x7edc('0x26')](function(_0x5575c0){logger[_0x7edc('0x19')](JSON[_0x7edc('0x3d')](_0x5575c0));var _0x294dda={'speech':_0x5575c0[_0x7edc('0x7c')],'action':_0x5575c0[_0x7edc('0x7d')]?_0x5575c0[_0x7edc('0x7d')][_0x7edc('0x7e')]:undefined,'actiondata':_0x5575c0[_0x7edc('0x7d')]?_0x5575c0['channelData'][_0x7edc('0x7f')]:undefined};if(_0x5575c0['channelData']&&_0x5575c0['channelData']['AudioFromTts']){return base64Decode(_0x5575c0[_0x7edc('0x7d')][_0x7edc('0x80')][_0x7edc('0x81')],path[_0x7edc('0x34')](__dirname,_0x7edc('0x21'),rs[_0x7edc('0x22')](0x4)+_0x7edc('0x23')))['then'](function(_0x4df8ed){_0x294dda[_0x7edc('0x82')]=_0x4df8ed;return _0x294dda;});}return _0x294dda;});};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 137af2e..49aaa5b 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 _0x5138=['exports','./nda'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x5138,0x155));var _0x8513=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x5138[_0x14a0a0];return _0x56b651;};var nda=require(_0x8513('0x0'));module[_0x8513('0x1')]={'nda':nda}; \ No newline at end of file +var _0x1dca=['./nda','exports'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0x1dca,0x72));var _0xa1dc=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x1dca[_0x342baa];return _0x1208f3;};var nda=require(_0xa1dc('0x0'));module[_0xa1dc('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 bd4c440..795faa1 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 _0xd816=['calleridname','dnid','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','agi','POST','resolve','ndauth_url','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','callerid'];(function(_0x5915fa,_0x355000){var _0x52edb8=function(_0x4bf150){while(--_0x4bf150){_0x5915fa['push'](_0x5915fa['shift']());}};_0x52edb8(++_0x355000);}(_0xd816,0xd5));var _0x6d81=function(_0x1150f0,_0x319e3d){_0x1150f0=_0x1150f0-0x0;var _0x3fbc4d=_0xd816[_0x1150f0];return _0x3fbc4d;};'use strict';var rp=require(_0x6d81('0x0'));var url=require(_0x6d81('0x1'));var logger=require('../../../../../config/logger')(_0x6d81('0x2'));module['exports']=function(_0x540f68,_0x5d99e4){var _0x2a4988={'method':_0x6d81('0x3'),'uri':url[_0x6d81('0x4')](_0x5d99e4[_0x6d81('0x5')],'/token'),'form':{'grant_type':_0x6d81('0x6'),'username':_0x5d99e4['username'],'password':_0x5d99e4[_0x6d81('0x6')]},'json':!![]};return rp(_0x2a4988)['then'](function(_0x96d1ac){var _0x15d634={'method':'POST','uri':url[_0x6d81('0x4')](_0x5d99e4[_0x6d81('0x7')],_0x6d81('0x8')),'body':{'type':_0x5d99e4[_0x6d81('0x9')]||'message','channelId':_0x6d81('0xa'),'conversation':{'id':_0x540f68['uniqueid']},'from':{'id':_0x540f68[_0x6d81('0xb')],'name':_0x540f68[_0x6d81('0xc')]},'recipient':{'id':_0x540f68[_0x6d81('0xd')],'name':_0x540f68['extension']},'text':_0x5d99e4['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x96d1ac['access_token']},'json':!![]};if(_0x5d99e4[_0x6d81('0xe')]){_0x15d634[_0x6d81('0xf')][_0x6d81('0x10')][_0x6d81('0x11')]=_0x5d99e4['project'];}if(_0x5d99e4[_0x6d81('0x12')]=='1'){_0x15d634[_0x6d81('0xf')][_0x6d81('0x10')][_0x6d81('0x13')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5d99e4[_0x6d81('0x14')]){_0x15d634['body']['channelData'][_0x6d81('0x15')]=_0x5d99e4[_0x6d81('0x14')];if(_0x5d99e4[_0x6d81('0x16')]){_0x15d634[_0x6d81('0xf')][_0x6d81('0x10')][_0x6d81('0x17')]=_0x5d99e4[_0x6d81('0x16')];}}logger['info'](JSON[_0x6d81('0x18')](_0x15d634));return rp(_0x15d634);});}; \ No newline at end of file +var _0x9e0d=['channelData','AudioOutputSettings','audio/wav','custom_action','CustomActionData','custom_action_data','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','Bearer\x20','access_token','project','body'];(function(_0x268cfd,_0x5a4f92){var _0x33cf10=function(_0x5cbb71){while(--_0x5cbb71){_0x268cfd['push'](_0x268cfd['shift']());}};_0x33cf10(++_0x5a4f92);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x3b46d6,_0x56d71f){_0x3b46d6=_0x3b46d6-0x0;var _0x33dc0a=_0x9e0d[_0x3b46d6];return _0x33dc0a;};'use strict';var rp=require(_0xd9e0('0x0'));var url=require(_0xd9e0('0x1'));var logger=require(_0xd9e0('0x2'))(_0xd9e0('0x3'));module['exports']=function(_0x2c5792,_0x3ec198){var _0x145133={'method':_0xd9e0('0x4'),'uri':url[_0xd9e0('0x5')](_0x3ec198[_0xd9e0('0x6')],'/token'),'form':{'grant_type':'password','username':_0x3ec198[_0xd9e0('0x7')],'password':_0x3ec198[_0xd9e0('0x8')]},'json':!![]};return rp(_0x145133)[_0xd9e0('0x9')](function(_0x3f8bb2){var _0x256df0={'method':_0xd9e0('0x4'),'uri':url['resolve'](_0x3ec198[_0xd9e0('0xa')],_0xd9e0('0xb')),'body':{'type':_0x3ec198[_0xd9e0('0xc')]||_0xd9e0('0xd'),'channelId':_0xd9e0('0xe'),'conversation':{'id':_0x2c5792[_0xd9e0('0xf')]},'from':{'id':_0x2c5792[_0xd9e0('0x10')],'name':_0x2c5792['calleridname']},'recipient':{'id':_0x2c5792[_0xd9e0('0x11')],'name':_0x2c5792[_0xd9e0('0x12')]},'text':_0x3ec198['text'],'channelData':{}},'headers':{'Authorization':_0xd9e0('0x13')+_0x3f8bb2[_0xd9e0('0x14')]},'json':!![]};if(_0x3ec198[_0xd9e0('0x15')]){_0x256df0[_0xd9e0('0x16')][_0xd9e0('0x17')]['ProjectName']=_0x3ec198[_0xd9e0('0x15')];}if(_0x3ec198['ndagenerate_audio']=='1'){_0x256df0[_0xd9e0('0x16')]['channelData'][_0xd9e0('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xd9e0('0x19')};}if(_0x3ec198[_0xd9e0('0x1a')]){_0x256df0[_0xd9e0('0x16')][_0xd9e0('0x17')]['CustomAction']=_0x3ec198['custom_action'];if(_0x3ec198['custom_action_data']){_0x256df0[_0xd9e0('0x16')][_0xd9e0('0x17')][_0xd9e0('0x1b')]=_0x3ec198[_0xd9e0('0x1c')];}}logger['info'](JSON[_0xd9e0('0x1d')](_0x256df0));return rp(_0x256df0);});}; \ 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 f0bb2a7..d38b74b 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 _0xc2f6=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2f6,0x8d));var _0x6c2f=function(_0x28c960,_0x283edf){_0x28c960=_0x28c960-0x0;var _0x376e0b=_0xc2f6[_0x28c960];return _0x376e0b;};'use strict';var asr=require(_0x6c2f('0x0'));module[_0x6c2f('0x1')]=function(_0x514cd6,_0x39bd2f,_0x363c6d,_0x2ede22){return asr(_0x514cd6,_0x39bd2f,_0x363c6d,_0x2ede22);}; \ No newline at end of file +var _0x1647=['exports'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x1647,0x148));var _0x7164=function(_0x35dcca,_0x14e01d){_0x35dcca=_0x35dcca-0x0;var _0x4d843c=_0x1647[_0x35dcca];return _0x4d843c;};'use strict';var asr=require('./lib/api');module[_0x7164('0x0')]=function(_0x55716c,_0x4cdb68,_0x3aa483,_0x5be4a5){return asr(_0x55716c,_0x4cdb68,_0x3aa483,_0x5be4a5);}; \ 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 01339da..e57eb58 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 _0x1069=['status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','moment','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1069,0xf9));var _0x9106=function(_0x1fe9a8,_0x1d18dc){_0x1fe9a8=_0x1fe9a8-0x0;var _0x2d03ec=_0x1069[_0x1fe9a8];return _0x2d03ec;};'use strict';var BPromise=require(_0x9106('0x0'));var _=require(_0x9106('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9106('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x9106('0x3'));module[_0x9106('0x4')]=function(_0x585242,_0x2d38a9,_0x192448,_0x2c9d97){return new BPromise(function(_0x3e8ba4,_0x44f699){logger['info'](_0x9106('0x5'),_0x2c9d97||_0x9106('0x6'));var _0x32804c=new WebSocket(_0x2c9d97||_0x9106('0x6'),{'perMessageDeflate':![]});var _0x1c2a0e='';var _0x256d8e='0';var _0x5d69e9='1';var _0x406ecc=_0x9106('0x7');function _0xc44ba9(_0x4b4623){var _0x54e30f=crypto[_0x9106('0x8')]('sha1');_0x54e30f[_0x9106('0x9')](_0x4b4623);return _0x54e30f[_0x9106('0xa')](_0x9106('0xb'));}function _0x48d9af(){try{logger[_0x9106('0xc')](_0x9106('0xd'));var _0x1d6186=moment()[_0x9106('0xe')]();var _0x2b30bc=_0xc44ba9(_0x1d6186+_0x2d38a9+_0x192448);_0x32804c[_0x9106('0xf')](JSON['stringify']({'appID':_0x2d38a9,'timestamp':_0x1d6186,'appKey':_0x2b30bc}));var _0x3c716f=fs[_0x9106('0x10')](_0x585242);_0x3c716f['on'](_0x9106('0x11'),function(_0x3dd106){_0x32804c[_0x9106('0xf')](_0x3dd106);});_0x3c716f['on'](_0x9106('0x12'),function(){_0x32804c['send'](_0x9106('0x13'));});}catch(_0x5e64ca){logger['error'](_0x9106('0x14'),JSON[_0x9106('0x15')](_0x5e64ca));_0x32804c[_0x9106('0x16')]();}}function _0x55e7ad(_0x4e2185){try{if(_0x4e2185){var _0x3d9bf5=JSON[_0x9106('0x17')](_0x4e2185);switch(_0x3d9bf5[_0x9106('0x18')]){case 0x0:if(_0x3d9bf5['result']){if(_0x3d9bf5[_0x9106('0x19')][_0x9106('0x1a')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x9106('0x15')](_0x3d9bf5[_0x9106('0x19')][_0x9106('0x1b')]));_0x1c2a0e=_0x3d9bf5[_0x9106('0x19')][_0x9106('0x1b')][0x0][_0x9106('0x1c')];_0x256d8e=_0x3d9bf5[_0x9106('0x19')]['hypotheses'][0x0][_0x9106('0x1d')];_0x5d69e9='0';_0x406ecc=_0x9106('0x1e');_0x32804c[_0x9106('0x16')]();}}break;case 0x1:logger['info'](_0x9106('0x7'));_0x5d69e9='1';_0x406ecc=_0x9106('0x7');break;case 0x2:logger[_0x9106('0xc')](_0x9106('0x1f'));_0x5d69e9='2';_0x406ecc=_0x9106('0x1f');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5d69e9='9';_0x406ecc='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x9106('0xc')](_0x9106('0x20'));_0x5d69e9='10';_0x406ecc=_0x9106('0x20');break;case 0xb:logger[_0x9106('0xc')](_0x9106('0x21'));_0x5d69e9='11';_0x406ecc=_0x9106('0x21');}}}catch(_0x53a323){logger[_0x9106('0x22')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x53a323));_0x32804c[_0x9106('0x16')]();}}function _0x23c856(){logger[_0x9106('0xc')]('Close\x20Tilde\x20ASR\x20socket');_0x3e8ba4({'transcript':_0x1c2a0e,'confidence':_0x256d8e,'status':_0x5d69e9,'status_message':_0x406ecc});}function _0x42e3e6(_0x593ba5){logger[_0x9106('0x22')](_0x9106('0x23'));if(!_[_0x9106('0x24')](_0x593ba5)){logger[_0x9106('0x22')](_[_0x9106('0x25')](_0x593ba5)?JSON['stringify'](_0x593ba5):_0x593ba5);}}_0x32804c['on'](_0x9106('0x26'),_0x48d9af);_0x32804c['on']('message',_0x55e7ad);_0x32804c['on'](_0x9106('0x12'),_0x23c856);_0x32804c['on']('error',_0x42e3e6);});}; \ No newline at end of file +var _0xe873=['moment','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','status','result','final','hypotheses','transcript','likelihood','Success.','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.','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash'];(function(_0x11daaa,_0x3236fc){var _0x99432d=function(_0x4a8739){while(--_0x4a8739){_0x11daaa['push'](_0x11daaa['shift']());}};_0x99432d(++_0x3236fc);}(_0xe873,0x8e));var _0x3e87=function(_0x58f75d,_0x1f5811){_0x58f75d=_0x58f75d-0x0;var _0x15189f=_0xe873[_0x58f75d];return _0x15189f;};'use strict';var BPromise=require(_0x3e87('0x0'));var _=require(_0x3e87('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3e87('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')('agi');module[_0x3e87('0x3')]=function(_0xb8466c,_0x402cb9,_0x5983e6,_0x573d21){return new BPromise(function(_0x74e779,_0x5534c7){logger[_0x3e87('0x4')](_0x3e87('0x5'),_0x573d21||_0x3e87('0x6'));var _0x2f75d6=new WebSocket(_0x573d21||_0x3e87('0x6'),{'perMessageDeflate':![]});var _0x3c6546='';var _0x1a0be7='0';var _0x48b78e='1';var _0x279fc1=_0x3e87('0x7');function _0x11aab5(_0x19c627){var _0x5f1212=crypto['createHash']('sha1');_0x5f1212['update'](_0x19c627);return _0x5f1212[_0x3e87('0x8')]('hex');}function _0x37a0f9(){try{logger['info'](_0x3e87('0x9'));var _0x4f9080=moment()[_0x3e87('0xa')]();var _0x3f5a71=_0x11aab5(_0x4f9080+_0x402cb9+_0x5983e6);_0x2f75d6[_0x3e87('0xb')](JSON['stringify']({'appID':_0x402cb9,'timestamp':_0x4f9080,'appKey':_0x3f5a71}));var _0x3d5014=fs[_0x3e87('0xc')](_0xb8466c);_0x3d5014['on'](_0x3e87('0xd'),function(_0x4f6c43){_0x2f75d6[_0x3e87('0xb')](_0x4f6c43);});_0x3d5014['on'](_0x3e87('0xe'),function(){_0x2f75d6['send'](_0x3e87('0xf'));});}catch(_0x19d391){logger[_0x3e87('0x10')](_0x3e87('0x11'),JSON[_0x3e87('0x12')](_0x19d391));_0x2f75d6[_0x3e87('0x13')]();}}function _0x347651(_0x364be2){try{if(_0x364be2){var _0x1ef711=JSON['parse'](_0x364be2);switch(_0x1ef711[_0x3e87('0x14')]){case 0x0:if(_0x1ef711[_0x3e87('0x15')]){if(_0x1ef711[_0x3e87('0x15')][_0x3e87('0x16')]){logger[_0x3e87('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0x3e87('0x12')](_0x1ef711[_0x3e87('0x15')][_0x3e87('0x17')]));_0x3c6546=_0x1ef711[_0x3e87('0x15')][_0x3e87('0x17')][0x0][_0x3e87('0x18')];_0x1a0be7=_0x1ef711[_0x3e87('0x15')][_0x3e87('0x17')][0x0][_0x3e87('0x19')];_0x48b78e='0';_0x279fc1=_0x3e87('0x1a');_0x2f75d6[_0x3e87('0x13')]();}}break;case 0x1:logger['info'](_0x3e87('0x7'));_0x48b78e='1';_0x279fc1=_0x3e87('0x7');break;case 0x2:logger[_0x3e87('0x4')](_0x3e87('0x1b'));_0x48b78e='2';_0x279fc1=_0x3e87('0x1b');break;case 0x9:logger[_0x3e87('0x4')](_0x3e87('0x1c'));_0x48b78e='9';_0x279fc1=_0x3e87('0x1c');break;case 0xa:logger['info'](_0x3e87('0x1d'));_0x48b78e='10';_0x279fc1=_0x3e87('0x1d');break;case 0xb:logger['info'](_0x3e87('0x1e'));_0x48b78e='11';_0x279fc1=_0x3e87('0x1e');}}}catch(_0x173cea){logger[_0x3e87('0x10')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x173cea));_0x2f75d6[_0x3e87('0x13')]();}}function _0x187b76(){logger[_0x3e87('0x4')](_0x3e87('0x1f'));_0x74e779({'transcript':_0x3c6546,'confidence':_0x1a0be7,'status':_0x48b78e,'status_message':_0x279fc1});}function _0x37e46e(_0x2a1ffc){logger[_0x3e87('0x10')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x3e87('0x20')](_0x2a1ffc)){logger[_0x3e87('0x10')](_[_0x3e87('0x21')](_0x2a1ffc)?JSON['stringify'](_0x2a1ffc):_0x2a1ffc);}}_0x2f75d6['on'](_0x3e87('0x22'),_0x37a0f9);_0x2f75d6['on'](_0x3e87('0x23'),_0x347651);_0x2f75d6['on']('close',_0x187b76);_0x2f75d6['on'](_0x3e87('0x10'),_0x37e46e);});}; \ 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 4a0947a..8e9068d 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 _0x8445=['exports','./asr'];(function(_0x54f025,_0x482f09){var _0xe70338=function(_0x31530f){while(--_0x31530f){_0x54f025['push'](_0x54f025['shift']());}};_0xe70338(++_0x482f09);}(_0x8445,0xb3));var _0x5844=function(_0x47b37e,_0x5afb98){_0x47b37e=_0x47b37e-0x0;var _0x1c1eb9=_0x8445[_0x47b37e];return _0x1c1eb9;};var asr=require(_0x5844('0x0'));module[_0x5844('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4743=['./asr'];(function(_0x3d7c62,_0x3ab008){var _0x384fe7=function(_0x3218f8){while(--_0x3218f8){_0x3d7c62['push'](_0x3d7c62['shift']());}};_0x384fe7(++_0x3ab008);}(_0x4743,0x1c5));var _0x3474=function(_0x112db5,_0x38a06d){_0x112db5=_0x112db5-0x0;var _0x1d7d06=_0x4743[_0x112db5];return _0x1d7d06;};var asr=require(_0x3474('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 7a73cde..63d9300 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 _0x4a38=['net','events','EventEmitter','./error','127.0.0.1','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util'];(function(_0x12ad0e,_0x149bec){var _0x4af880=function(_0x38d8a0){while(--_0x38d8a0){_0x12ad0e['push'](_0x12ad0e['shift']());}};_0x4af880(++_0x149bec);}(_0x4a38,0xce));var _0x84a3=function(_0x44c02b,_0x3a13b0){_0x44c02b=_0x44c02b-0x0;var _0x3aa190=_0x4a38[_0x44c02b];return _0x3aa190;};'use strict';var util=require(_0x84a3('0x0'));var net=require(_0x84a3('0x1'));var EventEmitter=require(_0x84a3('0x2'))[_0x84a3('0x3')];var AGIError=require(_0x84a3('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0xf2013,_0x49d2e5,_0x573d11){var _0x232970=this,_0xf2013=_0xf2013||0x11dd,_0x49d2e5=_0x49d2e5||_0x84a3('0x5'),_0x41be68=null,_0x5a7802=0x0;EventEmitter['call'](_0x232970);function _0x539901(){if(!_0xf2013){_0x232970['emit'](_0x84a3('0x6'),new AGIError(_0x84a3('0x7')));return![];}_0x41be68=net['createServer']();_0x41be68[_0x84a3('0x8')](_0xf2013,_0x49d2e5);_0x41be68['on'](_0x84a3('0x9'),function(){_0x232970[_0x84a3('0xa')](_0x84a3('0x9'));});_0x41be68['on'](_0x84a3('0xb'),function(_0x5dc3e7){_0x41be68[_0x84a3('0xc')](function(_0x5d02b8,_0x170b33){if(_0x5d02b8){_0x232970[_0x84a3('0xa')]('error',new AGIError(_0x84a3('0xd'),_0x5d02b8));}else if(_0x573d11&&_0x573d11<0x0){_0x232970['emit'](_0x84a3('0x6'),new AGIError(_0x84a3('0xe')));_0x5dc3e7[_0x84a3('0xf')]();}else if(_0x573d11&&_0x573d11>0x0&&_0x573d11<_0x170b33){_0x5a7802+=0x1;_0x232970[_0x84a3('0xa')]('error',new AGIError(_0x84a3('0x10'),_0x5a7802));_0x5dc3e7[_0x84a3('0xf')]();}else{var _0x591202=new AGIChannel(_0x5dc3e7);_0x591202['on']('ready',function(){_0x232970[_0x84a3('0xa')](_0x84a3('0xb'),_0x591202);});}});});_0x41be68['on']('error',function(_0x2bfbb5){_0x232970['emit'](_0x84a3('0x6'),new AGIError(_0x84a3('0xd'),_0x2bfbb5[_0x84a3('0x11')]));});_0x41be68['on'](_0x84a3('0x12'),function(){_0x232970[_0x84a3('0xa')](_0x84a3('0x12'),new AGIError(_0x84a3('0x13')));});}process[_0x84a3('0x14')](function(){_0x539901();});};util[_0x84a3('0x15')](AGIServer,EventEmitter);module[_0x84a3('0x16')]=function(_0x4e3618,_0x1c7fa7,_0x439f6b){return new AGIServer(_0x4e3618,_0x1c7fa7,_0x439f6b);}; \ No newline at end of file +var _0xf78f=['events','EventEmitter','./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','destroy','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net'];(function(_0x40cbbd,_0x10185b){var _0x2ff260=function(_0x32037b){while(--_0x32037b){_0x40cbbd['push'](_0x40cbbd['shift']());}};_0x2ff260(++_0x10185b);}(_0xf78f,0x18a));var _0xff78=function(_0x17d30a,_0x1e5a9f){_0x17d30a=_0x17d30a-0x0;var _0x1e677f=_0xf78f[_0x17d30a];return _0x1e677f;};'use strict';var util=require(_0xff78('0x0'));var net=require(_0xff78('0x1'));var EventEmitter=require(_0xff78('0x2'))[_0xff78('0x3')];var AGIError=require(_0xff78('0x4'));var AGIChannel=require(_0xff78('0x5'));var AGIServer=function(_0x992ccf,_0xa84737,_0x1d8828){var _0x2e663c=this,_0x992ccf=_0x992ccf||0x11dd,_0xa84737=_0xa84737||'127.0.0.1',_0x5671de=null,_0xe6cec=0x0;EventEmitter[_0xff78('0x6')](_0x2e663c);function _0x3b354c(){if(!_0x992ccf){_0x2e663c[_0xff78('0x7')](_0xff78('0x8'),new AGIError(_0xff78('0x9')));return![];}_0x5671de=net[_0xff78('0xa')]();_0x5671de['listen'](_0x992ccf,_0xa84737);_0x5671de['on']('listening',function(){_0x2e663c[_0xff78('0x7')](_0xff78('0xb'));});_0x5671de['on']('connection',function(_0x1470f0){_0x5671de[_0xff78('0xc')](function(_0x13e129,_0x37645b){if(_0x13e129){_0x2e663c[_0xff78('0x7')]('error',new AGIError(_0xff78('0xd'),_0x13e129));}else if(_0x1d8828&&_0x1d8828<0x0){_0x2e663c[_0xff78('0x7')](_0xff78('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x1470f0['destroy']();}else if(_0x1d8828&&_0x1d8828>0x0&&_0x1d8828<_0x37645b){_0xe6cec+=0x1;_0x2e663c['emit'](_0xff78('0x8'),new AGIError(_0xff78('0xe'),_0xe6cec));_0x1470f0[_0xff78('0xf')]();}else{var _0x3889c9=new AGIChannel(_0x1470f0);_0x3889c9['on']('ready',function(){_0x2e663c['emit'](_0xff78('0x10'),_0x3889c9);});}});});_0x5671de['on'](_0xff78('0x8'),function(_0x5d98c4){_0x2e663c[_0xff78('0x7')]('error',new AGIError(_0xff78('0xd'),_0x5d98c4[_0xff78('0x11')]));});_0x5671de['on'](_0xff78('0x12'),function(){_0x2e663c[_0xff78('0x7')]('close',new AGIError(_0xff78('0x13')));});}process[_0xff78('0x14')](function(){_0x3b354c();});};util['inherits'](AGIServer,EventEmitter);module[_0xff78('0x15')]=function(_0xf44626,_0x4d3b33,_0x269b0e){return new AGIServer(_0xf44626,_0x4d3b33,_0x269b0e);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b63e449..1e52987 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 _0xdb28=['SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','out','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','password','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','false','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','.wav','login','findBy','no\x20find\x20by\x20configured','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','no\x20operation\x20configured','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','service','host','port','secure','auth','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','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','streamFile','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MP3','googleTTS','google_tts_language','restAPI','method','timeout','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','render','url','parse','stringify','statusCode','statusMessage','message','options','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','exec','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE'];(function(_0x4801e3,_0x597059){var _0x490010=function(_0x5ab93e){while(--_0x5ab93e){_0x4801e3['push'](_0x4801e3['shift']());}};_0x490010(++_0x597059);}(_0xdb28,0x106));var _0x8db2=function(_0x9ad436,_0x2998ea){_0x9ad436=_0x9ad436-0x0;var _0x58de01=_0xdb28[_0x9ad436];return _0x58de01;};'use strict';var fs=require('fs');var path=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var sh=require(_0x8db2('0x3'));var odbc=require('odbc')();var rs=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var rp=require(_0x8db2('0x7'));var logger=require(_0x8db2('0x8'))('agi');var config=require(_0x8db2('0x9'));var scripts=require(_0x8db2('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x8db2('0xb')];var verticesWithRetry=[_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe')];var AGIVertices=function(_0x2f3f2f,_0x1ff362,_0x126c78){this['channel']=_0x2f3f2f;this[_0x8db2('0xf')]=_0x1ff362;this[_0x8db2('0x10')]=_0x126c78;};AGIVertices[_0x8db2('0x11')]['getVariable']=function(_0x1d9371,_0x150942){this['rpc'][_0x8db2('0x12')](_0x1d9371)[_0x8db2('0x13')](function(_0x1349f6){_0x150942(null,_0x1349f6?_0x1349f6[_0x8db2('0x14')]:![]);})[_0x8db2('0x15')](function(_0x559fb1){_0x150942(_0x559fb1);});};AGIVertices['prototype'][_0x8db2('0x16')]=function(_0x15e87c,_0x350d61){this[_0x8db2('0xf')][_0x8db2('0x17')](_0x15e87c)[_0x8db2('0x13')](function(_0x2f177a){_0x350d61(null,_0x2f177a?_0x2f177a[_0x8db2('0x14')]:![]);})[_0x8db2('0x15')](function(_0x16c8c2){_0x350d61(_0x16c8c2);});};AGIVertices['prototype'][_0x8db2('0x18')]=function(_0x24da1b,_0x48101e){this[_0x8db2('0xf')][_0x8db2('0x19')](_0x24da1b)[_0x8db2('0x13')](function(_0x3fddc2){_0x48101e(null,_0x3fddc2?_0x3fddc2[_0x8db2('0x14')]:![]);})[_0x8db2('0x15')](function(_0x51d60d){_0x48101e(_0x51d60d);});};AGIVertices['prototype'][_0x8db2('0x1a')]=function(_0x104e33,_0x1310d3){this[_0x8db2('0xf')]['getSquareOdbcById'](_0x104e33)[_0x8db2('0x13')](function(_0x36a9ff){_0x1310d3(null,_0x36a9ff?_0x36a9ff[_0x8db2('0x1b')]:![]);})[_0x8db2('0x15')](function(_0x3dbe8e){_0x1310d3(_0x3dbe8e);});};AGIVertices['prototype'][_0x8db2('0x1c')]=function(_0x3e30e6,_0x18f69c){this[_0x8db2('0xf')][_0x8db2('0x1d')](_0x3e30e6)[_0x8db2('0x13')](function(_0x796ec1){_0x18f69c(null,_0x796ec1?_0x796ec1['name']:![]);})[_0x8db2('0x15')](function(_0x4f6516){_0x18f69c(_0x4f6516);});};AGIVertices['prototype']['getTrunk']=function(_0x4d923c,_0xec8cd2){this[_0x8db2('0xf')][_0x8db2('0x1e')](_0x4d923c)[_0x8db2('0x13')](function(_0x145328){_0xec8cd2(null,_0x145328?_0x145328[_0x8db2('0x14')]:![]);})['catch'](function(_0x3544ba){_0xec8cd2(_0x3544ba);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x1f')]=function(_0x8b7cec,_0x483aee){var _0x2e0691=this;this[_0x8db2('0xf')][_0x8db2('0x20')](_0x8b7cec)[_0x8db2('0x13')](function(_0xbe5ece){_0x483aee(null,_0xbe5ece?_0x2e0691[_0x8db2('0x21')](_0xbe5ece[_0x8db2('0x22')]):![]);})[_0x8db2('0x15')](function(_0xbc5366){_0x483aee(_0xbc5366);});};AGIVertices['prototype'][_0x8db2('0x23')]=function(_0x50b28d,_0x59cb77){this[_0x8db2('0xf')][_0x8db2('0x24')](_0x50b28d)[_0x8db2('0x13')](function(_0x49b2b3){_0x59cb77(null,_0x49b2b3?_0x49b2b3:![]);})[_0x8db2('0x15')](function(_0x56b71a){_0x59cb77(_0x56b71a);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x25')]=function(_0x14bd12,_0x4d9e26,_0x56e9c1){this[_0x8db2('0x10')][_0x8db2('0x25')](_0x14bd12,_0x4d9e26)['then'](function(){_0x56e9c1(null);})['catch'](function(_0x173989){_0x56e9c1(_0x173989);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x26')]=function(_0x2a2d65,_0x17ad44){this[_0x8db2('0xf')][_0x8db2('0x27')](_0x2a2d65)[_0x8db2('0x13')](function(_0x46e0c8){if(_0x46e0c8){if(_0x46e0c8[_0x8db2('0x28')]){_0x17ad44(null,[_0x46e0c8['interval']]);}else{_0x17ad44(null,_[_0x8db2('0x29')](_0x46e0c8[_0x8db2('0x2a')],'interval'));}}else{_0x17ad44(null,![]);}})[_0x8db2('0x15')](function(_0x3ca80b){_0x17ad44(_0x3ca80b);});};AGIVertices['prototype']['getSoundPath']=function(_0x3c1983){return util['format'](_0x8db2('0x2b'),FILES_PATH,_0x3c1983);};AGIVertices[_0x8db2('0x11')][_0x8db2('0x2c')]=function(_0x22c896,_0x5cc419,_0x2d3e98){odbc['open'](_0x22c896,function(_0x227a08){if(_0x227a08){logger[_0x8db2('0x2d')](_0x8db2('0x2e'),_0x227a08);_0x2d3e98(_0x227a08);}else{logger[_0x8db2('0x2f')]('ODBC\x20connection\x20successfully');odbc['query'](_0x5cc419,function(_0x2acd1f,_0x2c0507){if(_0x2acd1f){logger['info'](_0x8db2('0x30'),_0x5cc419);_0x2d3e98(_0x2acd1f);}else{logger[_0x8db2('0x2f')](_0x8db2('0x31'),_0x5cc419);odbc['close'](function(_0x152e15){if(_0x152e15){logger[_0x8db2('0x2d')](_0x8db2('0x32'),_0x152e15);}_0x2d3e98(null,_0x2c0507);});}});}});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x33')]=function(_0x40d82a,_0x380046){this[_0x8db2('0xf')][_0x8db2('0x34')](_0x40d82a)[_0x8db2('0x13')](function(_0x21cf7c){_0x380046(null,_0x21cf7c?_0x21cf7c:![]);})[_0x8db2('0x15')](function(_0x1d9025){_0x380046(_0x1d9025);});};AGIVertices['prototype'][_0x8db2('0x35')]=function(_0x2b2472,_0x5e0382){this['rpc'][_0x8db2('0x35')](_0x2b2472)['then'](function(_0x130eb9){_0x5e0382(null,_0x130eb9);})[_0x8db2('0x15')](function(_0x313130){_0x5e0382(_0x313130);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x36')]=function(_0x30d606,_0xa53fba,_0x5c97ef){this[_0x8db2('0xf')][_0x8db2('0x36')]({'uniqueid':this[_0x8db2('0x37')][_0x8db2('0x38')],'node':_0x30d606['label'],'application':_0x30d606[_0x8db2('0x39')],'data':_0xa53fba||null,'project_name':this[_0x8db2('0x37')][_0x8db2('0x3a')],'callerid':this[_0x8db2('0x37')]['callerid']})[_0x8db2('0x13')](function(_0x4e0749){if(_0x5c97ef){_0x5c97ef(null,_0x4e0749);}})[_0x8db2('0x15')](function(_0x116b69){if(_0x5c97ef){_0x5c97ef(_0x116b69);}});};AGIVertices[_0x8db2('0x11')]['createSquareRecording']=function(_0x4b0e72,_0x1ec3d0,_0x47c556,_0x173cc7){this[_0x8db2('0xf')][_0x8db2('0x3b')]({'uniqueid':this[_0x8db2('0x37')][_0x8db2('0x38')],'callerid':this[_0x8db2('0x37')][_0x8db2('0x3c')],'calleridname':this[_0x8db2('0x37')][_0x8db2('0x3d')],'context':this[_0x8db2('0x37')][_0x8db2('0x3e')],'extension':this[_0x8db2('0x37')]['extension'],'priority':this[_0x8db2('0x37')][_0x8db2('0x3f')],'accountcode':this[_0x8db2('0x37')][_0x8db2('0x40')],'dnid':this['channel']['dnid'],'projectName':this[_0x8db2('0x37')][_0x8db2('0x3a')],'saveName':_0x1ec3d0,'filename':_0x4b0e72[_0x8db2('0x41')]||_0x1ec3d0,'savePath':_0x47c556})['then'](function(_0x540d90){_0x173cc7(null,_0x540d90);})['catch'](function(_0x44ac56){_0x173cc7(_0x44ac56);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x42')]=function(_0x383fa1,_0xaab731,_0x4195ef,_0x2fa118,_0x511718){this['rpc'][_0x8db2('0x42')]({'uniqueid':this[_0x8db2('0x37')][_0x8db2('0x38')],'body':_0x383fa1,'direction':_0xaab731,'providerName':_0x4195ef,'providerResponse':_0x2fa118})[_0x8db2('0x13')](function(_0x3daed6){if(_0x511718){_0x511718(null,_0x3daed6);}})[_0x8db2('0x15')](function(_0x1f0f7c){if(_0x511718){_0x511718(_0x1f0f7c);}});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x43')]=function(_0x426ae0,_0x3bc632){this[_0x8db2('0xf')][_0x8db2('0x43')]({'firstName':_[_0x8db2('0x44')](_0x426ae0[_0x8db2('0x14')])||_['isNil'](_0x426ae0[_0x8db2('0x14')])?_0x8db2('0x45')+Math['random']():_0x426ae0[_0x8db2('0x14')],'lastName':_[_0x8db2('0x44')](_0x426ae0[_0x8db2('0x46')])||_['isNil'](_0x426ae0[_0x8db2('0x46')])?null:_0x426ae0[_0x8db2('0x46')],'phone':_0x426ae0[_0x8db2('0x47')],'ListId':_0x426ae0[_0x8db2('0x48')],'scheduledat':_0x426ae0[_0x8db2('0x49')],'callbackUniqueid':this['channel'][_0x8db2('0x38')],'tags':_0x8db2('0x4a'),'description':_0x8db2('0x4b')+_0x426ae0['scheduledAt'][_0x8db2('0x4c')](),'priority':_0x426ae0[_0x8db2('0x4d')]})[_0x8db2('0x13')](function(_0x7b0de8){_0x3bc632(null,_0x7b0de8);})[_0x8db2('0x15')](function(_0x16d897){_0x3bc632(_0x16d897);});};AGIVertices[_0x8db2('0x11')]['getPause']=function(_0x39ff90,_0x4033c0){this['rpc'][_0x8db2('0x4e')](_0x39ff90)[_0x8db2('0x13')](function(_0x533e41){_0x4033c0(null,_0x533e41?_0x533e41[_0x8db2('0x14')]:![]);})[_0x8db2('0x15')](function(_0x63e8f7){_0x4033c0(_0x63e8f7);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x4f')]=function(_0x3c7d8c,_0x10f267,_0x33a600){var _0x120ef2={'role':_0x8db2('0x50')};_0x120ef2[_0x3c7d8c]=this[_0x8db2('0x37')][_0x8db2('0x3c')];this[_0x8db2('0xf')][_0x8db2('0x4f')](_0x120ef2,_0x10f267,this[_0x8db2('0x37')][_0x8db2('0x38')])['then'](function(_0xe0c3e){_0x33a600(null,_[_0x8db2('0x51')](_0xe0c3e)?![]:!![]);})[_0x8db2('0x15')](function(_0xc27a7e){logger[_0x8db2('0x2d')](_0xc27a7e);_0x33a600(null,![]);});};AGIVertices['prototype'][_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={'role':_0x8db2('0x50')};_0x1e1c0d[_0x2c3087]=this[_0x8db2('0x37')][_0x8db2('0x3c')];this[_0x8db2('0xf')][_0x8db2('0x52')](_0x1e1c0d)[_0x8db2('0x13')](function(_0x10f42a){_0x3ab670(null,_[_0x8db2('0x51')](_0x10f42a)?![]:!![]);})[_0x8db2('0x15')](function(_0x2228d1){logger[_0x8db2('0x2d')](_0x2228d1);_0x3ab670(null,![]);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x53')]=function(_0xefb12,_0x5a719f){var _0x3273dd={'role':'agent'};_0x3273dd[_0xefb12]=this[_0x8db2('0x37')]['callerid'];this[_0x8db2('0xf')][_0x8db2('0x53')](_0x3273dd)[_0x8db2('0x13')](function(_0x1e2ccd){_0x5a719f(null,_[_0x8db2('0x51')](_0x1e2ccd)?![]:!![]);})['catch'](function(_0x50c5fb){logger[_0x8db2('0x2d')](_0x50c5fb);_0x5a719f(null,![]);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x54')]=function(_0x3ba1d2,_0x20b49c){var _0x1f28d2={'role':_0x8db2('0x50')};_0x1f28d2[_0x3ba1d2]=this[_0x8db2('0x37')]['callerid'];var _0x2bde16=_0x3ba1d2!=_0x8db2('0x55')?util[_0x8db2('0x56')](_0x8db2('0x57'),_0x8db2('0x58'),this[_0x8db2('0x37')][_0x8db2('0x3c')]):undefined;this[_0x8db2('0xf')]['agentLogin'](_0x1f28d2,_0x2bde16)['then'](function(_0x358009){_0x20b49c(null,_[_0x8db2('0x51')](_0x358009)?![]:!![]);})[_0x8db2('0x15')](function(_0x27f4cd){logger[_0x8db2('0x2d')](_0x27f4cd);_0x20b49c(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x3611da,_0x364807){sh['exec'](_[_0x8db2('0x59')](_0x3611da),function(_0x2be647,_0x1ab84c){var _0x5093e8=_0x1ab84c[_0x8db2('0x5a')](/(\r\n|\n|\r)/gm,'');_0x364807(null,_0x5093e8);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x5b')]=function(_0x4f5458,_0x3ff023){scripts[_0x8db2('0x5b')](_0x4f5458[_0x8db2('0x5c')],_0x4f5458[_0x8db2('0x5d')]||_0x8db2('0x5e'),_0x4f5458['text'],_0x4f5458[_0x8db2('0x5f')]||_0x8db2('0x60'),_0x4f5458[_0x8db2('0x61')]||'MALE',_0x4f5458['audioEncoding']||_0x8db2('0x62'))[_0x8db2('0x13')](function(_0x487dcb){_0x3ff023(null,_0x487dcb);})[_0x8db2('0x15')](function(_0x40a1f4){_0x3ff023(_0x40a1f4);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x63')]=function(_0xbf1fce,_0x16848b){scripts[_0x8db2('0x63')](_0xbf1fce[_0x8db2('0x5e')],_0xbf1fce[_0x8db2('0x64')]||'en',0x1)[_0x8db2('0x13')](function(_0x302f6e){_0x16848b(null,_0x302f6e);})[_0x8db2('0x15')](function(_0x24a52d){_0x16848b(_0x24a52d);});};AGIVertices['prototype'][_0x8db2('0x65')]=function(_0x4f29f1,_0x24f1a7){var _0x3015ab={'uri':_0x4f29f1['url'],'method':_0x4f29f1[_0x8db2('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4f29f1[_0x8db2('0x67')])==='number'&&parseInt(_0x4f29f1[_0x8db2('0x67')])>=0x1?parseInt(_0x4f29f1[_0x8db2('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x8db2('0x68')]([_0x8db2('0x69'),_0x8db2('0x6a')],_0x3015ab[_0x8db2('0x66')][_0x8db2('0x6b')]())){try{_0x3015ab[_0x8db2('0x6c')]=_0x4f29f1[_0x8db2('0xb')]?JSON['parse'](_0x4f29f1['rawBody']):{};}catch(_0x198c3b){logger['error'](_0x8db2('0x6d'),_0x198c3b);}}try{_0x3015ab[_0x8db2('0x6e')]=_0x4f29f1[_0x8db2('0x6f')]?JSON['parse'](_0x4f29f1[_0x8db2('0x6f')]):{};}catch(_0x9675c1){logger[_0x8db2('0x2d')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x9675c1);}if(_0x4f29f1[_0x8db2('0x70')]){try{var _0x24369f=require(_0x4f29f1[_0x8db2('0x70')])[_0x8db2('0x71')](this,_0x3015ab);_0x3015ab['uri']=Mustache[_0x8db2('0x72')](_0x4f29f1[_0x8db2('0x73')],_0x24369f,{},['$$','$$']);if(_0x3015ab[_0x8db2('0x6e')]){_0x3015ab[_0x8db2('0x6e')]=JSON[_0x8db2('0x74')](Mustache[_0x8db2('0x72')](JSON[_0x8db2('0x75')](_0x3015ab[_0x8db2('0x6e')]),_0x24369f,{},['$$','$$']));}if(_0x3015ab[_0x8db2('0x6c')]){_0x3015ab[_0x8db2('0x6c')]=JSON[_0x8db2('0x74')](Mustache['render'](JSON[_0x8db2('0x75')](_0x3015ab[_0x8db2('0x6c')]),_0x24369f,{},['$$','$$']));}}catch(_0x377fb4){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x377fb4);}}rp(_0x3015ab)['then'](function(_0xa09b1d){var _0xdba223={'statusCode':_0xa09b1d[_0x8db2('0x76')]||0xc8,'statusMessage':_0xa09b1d[_0x8db2('0x77')]||'OK','headers':_0xa09b1d[_0x8db2('0x6e')]||{},'body':_0xa09b1d[_0x8db2('0x6c')]||{}};_0x24f1a7(null,_0xdba223);})[_0x8db2('0x15')](function(_0x3c2d3c){var _0x3b1929={'statusCode':_0x3c2d3c[_0x8db2('0x76')]||0x1f4,'statusMessage':_0x3c2d3c[_0x8db2('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x3c2d3c[_0x8db2('0x79')][_0x8db2('0x6e')]||{},'body':_0x3c2d3c[_0x8db2('0x79')][_0x8db2('0x6c')]||{}};_0x24f1a7(null,_0x3b1929);});};AGIVertices['prototype']['googleDialogflow']=function(_0x15f498,_0x3c3f3e){scripts['googleDialogflow'](this[_0x8db2('0x37')][_0x8db2('0x38')],_0x15f498[_0x8db2('0x7a')],_0x15f498['text'],_0x15f498['dialogflow_language']||'en')['then'](function(_0x468f90){_0x3c3f3e(null,_0x468f90);})[_0x8db2('0x15')](function(_0x281e48){_0x3c3f3e(_0x281e48);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x7b')]=function(_0x4e8aac,_0x30930a){scripts['googleDialogflowV2'](this[_0x8db2('0x37')][_0x8db2('0x38')],_0x4e8aac[_0x8db2('0x7c')],_0x4e8aac[_0x8db2('0x7d')],_0x4e8aac[_0x8db2('0x7e')],_0x4e8aac['text'],_0x4e8aac['dialogflowV2_language']||'en')[_0x8db2('0x13')](function(_0x51afcf){_0x30930a(null,_0x51afcf);})[_0x8db2('0x15')](function(_0x249b37){_0x30930a(_0x249b37);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x7f')]=function(_0x2b7224,_0x456d5e){scripts['sestekNDA'](this[_0x8db2('0x37')],_0x2b7224)[_0x8db2('0x13')](function(_0x990393){_0x456d5e(null,_0x990393);})['catch'](function(_0x1048b0){_0x456d5e(_0x1048b0);});};AGIVertices[_0x8db2('0x11')]['ispeechTTS']=function(_0x2d7abf,_0x7cb97d){scripts[_0x8db2('0x80')](_0x2d7abf[_0x8db2('0x7a')],_0x2d7abf[_0x8db2('0x5e')],_0x2d7abf[_0x8db2('0x81')]||_0x8db2('0x60'),_0x2d7abf[_0x8db2('0x82')])[_0x8db2('0x13')](function(_0x5cad4a){_0x7cb97d(null,_0x5cad4a);})[_0x8db2('0x15')](function(_0x1fa851){_0x7cb97d(_0x1fa851);});};AGIVertices[_0x8db2('0x11')][_0x8db2('0x83')]=function(_0x84e15,_0x345ff9,_0x16d1c5){scripts[_0x8db2('0x83')](_0x345ff9,_0x84e15[_0x8db2('0x7a')],_0x84e15[_0x8db2('0x84')]||'en-US',this[_0x8db2('0x85')](_0x84e15[_0x8db2('0x86')])?_0x84e15[_0x8db2('0x86')]:undefined)[_0x8db2('0x13')](function(_0x5d371b){_0x16d1c5(null,_0x5d371b);})[_0x8db2('0x15')](function(_0x6d97b9){_0x16d1c5(_0x6d97b9);});};AGIVertices[_0x8db2('0x11')]['awsPolly']=function(_0x59fbe1,_0x1fdeee){scripts[_0x8db2('0x87')](_0x59fbe1[_0x8db2('0x88')],_0x59fbe1[_0x8db2('0x89')],_0x59fbe1['aws_polly_region'],_0x59fbe1[_0x8db2('0x8a')]||_0x8db2('0x8b'),_0x59fbe1[_0x8db2('0x5e')],_0x59fbe1[_0x8db2('0x8c')]||'text')[_0x8db2('0x13')](function(_0x1d6eef){_0x1fdeee(null,_0x1d6eef);})[_0x8db2('0x15')](function(_0x5121be){_0x1fdeee(_0x5121be);});};AGIVertices['prototype']['awsLex']=function(_0x1ba097,_0x2d82c9){scripts[_0x8db2('0x8d')](this[_0x8db2('0x37')]['uniqueid'],_0x1ba097['aws_access_key_id'],_0x1ba097[_0x8db2('0x89')],_0x1ba097[_0x8db2('0x8e')],_0x1ba097[_0x8db2('0x5e')],_0x1ba097[_0x8db2('0x8f')])[_0x8db2('0x13')](function(_0x19b52a){_0x2d82c9(null,_0x19b52a);})['catch'](function(_0x2942eb){_0x2d82c9(_0x2942eb);});};AGIVertices['prototype'][_0x8db2('0x90')]=function(_0x23457b,_0x1ef898,_0x39f2d3){scripts[_0x8db2('0x90')](_0x1ef898,_0x23457b['key'],_0x23457b[_0x8db2('0x91')]||_0x8db2('0x60'))['then'](function(_0x28beec){_0x39f2d3(null,_0x28beec);})[_0x8db2('0x15')](function(_0x6cf197){_0x39f2d3(_0x6cf197);});};AGIVertices[_0x8db2('0x11')]['tildeASR']=function(_0x5ef09c,_0x47bbea,_0x58ab95){scripts[_0x8db2('0x92')](_0x47bbea,_0x5ef09c[_0x8db2('0x93')],_0x5ef09c[_0x8db2('0x94')],_0x5ef09c[_0x8db2('0x95')])[_0x8db2('0x13')](function(_0x46254a){_0x58ab95(null,_0x46254a);})[_0x8db2('0x15')](function(_0x48c718){_0x58ab95(_0x48c718);});};AGIVertices[_0x8db2('0x11')]['clear']=function(_0x4bbf03){var _0x2f473e=_['includes'](verticesWithRetry,_0x4bbf03['agicommand'])?_0x4bbf03:_[_0x8db2('0x96')](_0x4bbf03);for(var _0x1642a7 in _0x2f473e){if(_0x2f473e[_0x8db2('0x97')](_0x1642a7)){if(_0x2f473e[_0x1642a7]&&_['isString'](_0x2f473e[_0x1642a7])){if(_[_0x8db2('0x68')](recursiveMapAttributes,_0x1642a7)){_0x2f473e[_0x1642a7]=this[_0x8db2('0x98')](_0x2f473e[_0x1642a7]);}else{_0x2f473e[_0x1642a7]=this[_0x8db2('0x99')](_0x2f473e[_0x1642a7]);}}}}return _0x2f473e;};AGIVertices['prototype'][_0x8db2('0x9a')]=function(_0x1a21bd){for(var _0x3bc817 in _0x1a21bd){if(_0x1a21bd[_0x8db2('0x97')](_0x3bc817)){if(_[_0x8db2('0x9b')](_0x1a21bd[_0x3bc817])){this[_0x8db2('0x9a')](_0x1a21bd[_0x3bc817]);}else if(_[_0x8db2('0x9c')](_0x1a21bd[_0x3bc817])){for(var _0x24cbd2=0x0;_0x24cbd2<_0x1a21bd[_0x3bc817]['length'];_0x24cbd2++){this[_0x8db2('0x9a')](_0x1a21bd[_0x3bc817][_0x24cbd2]);}}else if(_[_0x8db2('0x9d')](_0x1a21bd[_0x3bc817])){_0x1a21bd[_0x3bc817]=this[_0x8db2('0x99')](_0x1a21bd[_0x3bc817]);}}}};AGIVertices[_0x8db2('0x11')][_0x8db2('0x9e')]=function(_0x36199d,_0x41985a){for(var _0x2910c8 in _0x36199d){if(_0x36199d[_0x8db2('0x97')](_0x2910c8)){if(_[_0x8db2('0x9b')](_0x36199d[_0x2910c8])){if(!_[_0x8db2('0x44')](_0x36199d[_0x2910c8])){this['saveRestApiResult'](_0x36199d[_0x2910c8],util[_0x8db2('0x56')](_0x8db2('0x9f'),_0x41985a,_0x2910c8));}}else if(_[_0x8db2('0x9c')](_0x36199d[_0x2910c8])){for(var _0x58063b=0x0;_0x58063b<_0x36199d[_0x2910c8][_0x8db2('0xa0')];_0x58063b++){this[_0x8db2('0x9e')](_0x36199d[_0x2910c8][_0x58063b],util[_0x8db2('0x56')]('%s.%s',_0x41985a,_0x2910c8+'['+_0x58063b+']'));}}else{if(!_['isNil'](_0x36199d[_0x2910c8])){this[_0x8db2('0x37')][_0x8db2('0xa1')](util[_0x8db2('0x56')](_0x8db2('0x9f'),_0x41985a,_0x2910c8),_0x36199d[_0x2910c8]);}}}}};AGIVertices[_0x8db2('0x11')][_0x8db2('0x98')]=function(_0x2824ac){try{var _0x1f1aa5=JSON[_0x8db2('0x74')](_0x2824ac);this[_0x8db2('0x9a')](_0x1f1aa5);return JSON['stringify'](_0x1f1aa5);}catch(_0x1ef1c0){return this[_0x8db2('0x99')](_0x2824ac);}};AGIVertices['prototype'][_0x8db2('0x99')]=function(_0x113c08){var _0x2a0424=_0x113c08[_0x8db2('0xa2')]('{');for(var _0x81bb0f=0x1;_0x81bb0f<_0x2a0424[_0x8db2('0xa0')];_0x81bb0f+=0x1){var _0x8f84e4=_0x2a0424[_0x81bb0f][_0x8db2('0xa2')]('}');if(_0x8f84e4[_0x8db2('0xa0')]>0x1){_0x113c08=_0x113c08[_0x8db2('0xa3')]('{'+_0x8f84e4[0x0]+'}',this[_0x8db2('0x37')]['getVariable'](_0x8f84e4[0x0])[_0x8db2('0xa4')]||_0x8f84e4[0x0]);}}if(_0x2a0424[_0x8db2('0xa0')]===0x1){return _0x113c08[_0x8db2('0x4c')]();}return this[_0x8db2('0x99')](_0x113c08);};AGIVertices[_0x8db2('0x11')][_0x8db2('0xa5')]=function(_0x551f1b,_0x137788){var _0x19bc4d=this[_0x8db2('0x37')][_0x8db2('0xa6')](_0x551f1b);if(_0x19bc4d[_0x8db2('0xa7')]===-0x1){return _0x19bc4d;}logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0xa8'),_0x137788,_0x19bc4d[_0x8db2('0xa4')]));return this[_0x8db2('0x37')][_0x8db2('0xa1')](_0x137788,_0x19bc4d['extra']);};AGIVertices['prototype'][_0x8db2('0x85')]=function(_0x56f59b){return _0x56f59b&&_0x56f59b!=='0'&&_0x56f59b!=='-1'&&_0x56f59b!=='';};AGIVertices[_0x8db2('0x11')][_0x8db2('0xa9')]=function(_0x2428f1){this['createSquareDetailsReport'][_0x8db2('0x71')](this,_0x2428f1,'-');_0x2428f1[_0x8db2('0xaa')]=_0x2428f1[_0x8db2('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8db2('0x11')]['mrcpsynth']=function(_0x441fde){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x441fde[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x441fde[_0x8db2('0x5e')])){return this['channel'][_0x8db2('0xac')](_0x8db2('0xad'));}var _0x41957f='\x22'+_0x441fde['text']+'\x22';if(this[_0x8db2('0x85')](_0x441fde[_0x8db2('0x79')])){_0x41957f+=','+_0x441fde['options'];}var _0x348e8b=this[_0x8db2('0x37')]['exec'](_0x8db2('0xae'),_0x41957f);if(_0x348e8b[_0x8db2('0xa7')]===-0x1){return _0x348e8b;}return this[_0x8db2('0x37')]['noop'](util['format'](_0x8db2('0xaf'),_0x41957f));};AGIVertices['prototype']['mrcprecog']=function(_0x44b0fc){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0xb0'),_0x44b0fc[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x44b0fc['grammar'])){return this['channel'][_0x8db2('0xac')](_0x8db2('0xb1'));}var _0xf8774e=_0x44b0fc[_0x8db2('0xb2')];if(this['isConfigured'](_0x44b0fc[_0x8db2('0x79')])){_0xf8774e+=','+_0x44b0fc['options'];}var _0x385ddf=this['channel'][_0x8db2('0xb3')](_0x8db2('0xb4'),_0xf8774e);if(_0x385ddf[_0x8db2('0xa7')]===-0x1){return _0x385ddf;}var _0x780e83=this[_0x8db2('0xa5')](_0x8db2('0xb5'),'MRCP_RECOG_CONFIDENCE');if(_0x780e83['result']===-0x1){return _0x780e83;}var _0x350fc4=this[_0x8db2('0xa5')](_0x8db2('0xb6'),'MRCP_RECOG_TRANSCRIPT');if(_0x350fc4['result']===-0x1){return _0x350fc4;}var _0x175eae=this[_0x8db2('0xa5')](_0x8db2('0xb7'),'MRCP_RECOG_INSTANCE');if(_0x175eae['result']===-0x1){return _0x175eae;}return this[_0x8db2('0x37')][_0x8db2('0xac')](util['format'](_0x8db2('0xb8'),_0xf8774e));};AGIVertices[_0x8db2('0x11')][_0x8db2('0xb9')]=function(_0x25795d){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0xba'),_0x25795d[_0x8db2('0xab')]));return this[_0x8db2('0x37')]['agi']([_0x25795d['command'],_0x25795d['args']]);};AGIVertices[_0x8db2('0x11')][_0x8db2('0xbb')]=function(_0x46951c){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x46951c[_0x8db2('0xab')]));if(this['isConfigured'](_0x46951c[_0x8db2('0x67')])){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0xbc'),_0x46951c['timeout']));var _0x44da4b=this['channel'][_0x8db2('0xbd')](_0x46951c[_0x8db2('0x67')]);if(_0x44da4b['result']===-0x1){return _0x44da4b;}}return this['channel']['answer']();};AGIVertices[_0x8db2('0x11')][_0x8db2('0x4a')]=function(_0x2dda37){logger[_0x8db2('0x2f')](util['format'](_0x8db2('0xbe'),_0x2dda37[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x2dda37[_0x8db2('0x48')])){return this[_0x8db2('0x37')]['error'](_0x2dda37,'no\x20list\x20selected');}_0x2dda37[_0x8db2('0x49')]=moment();if(this[_0x8db2('0x85')](_0x2dda37['delay'])){_0x2dda37[_0x8db2('0x49')]=moment()[_0x8db2('0xbf')](_0x2dda37[_0x8db2('0xc0')],'minutes');}if(!this[_0x8db2('0x85')](_0x2dda37[_0x8db2('0x4d')])){_0x2dda37[_0x8db2('0x4d')]=0x2;}this[_0x8db2('0x43')][_0x8db2('0x71')](this,_0x2dda37);return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0xc1'),_0x2dda37[_0x8db2('0x47')],_0x2dda37[_0x8db2('0x48')],_0x2dda37[_0x8db2('0x49')]));};AGIVertices['prototype'][_0x8db2('0xc2')]=function(_0x2819aa){logger['info'](util[_0x8db2('0x56')](_0x8db2('0xc3'),_0x2819aa[_0x8db2('0xab')]));var _0xad0d4e=this[_0x8db2('0x37')][_0x8db2('0xb3')](_0x2819aa[_0x8db2('0xc4')],_0x2819aa[_0x8db2('0x79')]);if(_0xad0d4e[_0x8db2('0xa7')]===-0x1){return _0xad0d4e;}return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')]('Executed\x20command\x20%s\x20%s',_0x2819aa['application'],_0x2819aa[_0x8db2('0x79')]));};AGIVertices[_0x8db2('0x11')]['lumenvoxtts']=function(_0x2c6726){logger['info'](util[_0x8db2('0x56')](_0x8db2('0xc5'),_0x2c6726[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x2c6726[_0x8db2('0x5e')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xad'));}var _0x505017='\x22'+_0x2c6726[_0x8db2('0x5e')]+'\x22';if(this[_0x8db2('0x85')](_0x2c6726[_0x8db2('0x79')])){_0x505017+=','+_0x2c6726[_0x8db2('0x79')];}var _0x4d43fb=this[_0x8db2('0x37')]['exec'](_0x8db2('0xae'),_0x505017);if(_0x4d43fb['result']===-0x1){return _0x4d43fb;}return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0xaf'),_0x505017));};AGIVertices['prototype'][_0x8db2('0xc6')]=function(_0x1fa9cc){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0xc7'),_0x1fa9cc[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x1fa9cc[_0x8db2('0x5e')])){return this[_0x8db2('0x37')][_0x8db2('0xac')]('no\x20text\x20configured');}var _0x489ef7='\x22'+_0x1fa9cc['text']+'\x22';if(this[_0x8db2('0x85')](_0x1fa9cc[_0x8db2('0x79')])){_0x489ef7+=','+_0x1fa9cc[_0x8db2('0x79')];}var _0x179a74=this[_0x8db2('0x37')][_0x8db2('0xb3')](_0x8db2('0xae'),_0x489ef7);if(_0x179a74[_0x8db2('0xa7')]===-0x1){return _0x179a74;}return this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0xaf'),_0x489ef7));};AGIVertices[_0x8db2('0x11')][_0x8db2('0xc8')]=function(_0x34d221){logger['info'](util[_0x8db2('0x56')](_0x8db2('0xc9'),_0x34d221['label']));if(!this[_0x8db2('0x85')](_0x34d221[_0x8db2('0xb2')])){return this['channel'][_0x8db2('0xac')]('no\x20grammar\x20configured');}var _0x247bf6=_0x34d221[_0x8db2('0xb2')];if(this[_0x8db2('0x85')](_0x34d221[_0x8db2('0x79')])){_0x247bf6+=','+_0x34d221[_0x8db2('0x79')];}var _0x335cec=this[_0x8db2('0x37')]['exec']('MRCPRecog',_0x247bf6);if(_0x335cec[_0x8db2('0xa7')]===-0x1){return _0x335cec;}var _0x5cece6=this[_0x8db2('0xa5')]('RECOG_CONFIDENCE()',_0x8db2('0xca'));if(_0x5cece6['result']===-0x1){return _0x5cece6;}var _0x2269e0=this[_0x8db2('0xa5')](_0x8db2('0xb6'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2269e0[_0x8db2('0xa7')]===-0x1){return _0x2269e0;}var _0x3345e3=this[_0x8db2('0xa5')](_0x8db2('0xb7'),'LUMENVOX_ASR_INSTANCE');if(_0x3345e3[_0x8db2('0xa7')]===-0x1){return _0x3345e3;}return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0xb8'),_0x247bf6));};AGIVertices[_0x8db2('0x11')]['sestekasr']=function(_0x196119){logger['info'](util['format'](_0x8db2('0xcb'),_0x196119[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x196119[_0x8db2('0xb2')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xb1'));}var _0x1a121c=_0x196119[_0x8db2('0xb2')];if(this['isConfigured'](_0x196119['options'])){_0x1a121c+=','+_0x196119[_0x8db2('0x79')];}var _0x16eb87=this['channel'][_0x8db2('0xb3')](_0x8db2('0xb4'),_0x1a121c);if(_0x16eb87[_0x8db2('0xa7')]===-0x1){return _0x16eb87;}var _0x4ba87d=this[_0x8db2('0xa5')]('RECOG_CONFIDENCE()',_0x8db2('0xcc'));if(_0x4ba87d[_0x8db2('0xa7')]===-0x1){return _0x4ba87d;}var _0x1f0eb5=this[_0x8db2('0xa5')](_0x8db2('0xb6'),_0x8db2('0xcd'));if(_0x1f0eb5[_0x8db2('0xa7')]===-0x1){return _0x1f0eb5;}var _0x237377=this[_0x8db2('0xa5')](_0x8db2('0xb7'),_0x8db2('0xce'));if(_0x237377[_0x8db2('0xa7')]===-0x1){return _0x237377;}return this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0xb8'),_0x1a121c));};AGIVertices[_0x8db2('0x11')][_0x8db2('0xcf')]=function(_0x56938e){logger['info'](util[_0x8db2('0x56')](_0x8db2('0xd0'),_0x56938e[_0x8db2('0xab')]));if(!this['isConfigured'](_0x56938e['odbc_id'])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x56938e,'no\x20database\x20selected');}var _0x303398=this['getSquareOdbc'][_0x8db2('0x71')](this,_0x56938e[_0x8db2('0xd1')]);if(!_0x303398){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x56938e,_0x8db2('0xd2'));}if(!this[_0x8db2('0x85')](_0x56938e[_0x8db2('0xd3')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x56938e,_0x8db2('0xd4'));}var _0x675db4=_0x56938e[_0x8db2('0xd3')][_0x8db2('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0xd5'),_0x675db4));var _0x51296a=this[_0x8db2('0x2c')]['sync'](this,_0x303398,_0x675db4);this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0x56938e,_0x675db4);if(!this[_0x8db2('0x85')](_0x56938e[_0x8db2('0xd6')])){return this['channel'][_0x8db2('0xac')](_0x8db2('0xd7'));}var _0x1c1581=this['getVariable'][_0x8db2('0x71')](this,_0x56938e[_0x8db2('0xd6')]);if(!_0x1c1581){return this['channel'][_0x8db2('0x2d')](_0x56938e,'no\x20variable\x20found');}var _0x3d24bc=this;_0x51296a[_0x8db2('0xd8')](function(_0x35edb1,_0x43ba9e){Object[_0x8db2('0xd9')](_0x35edb1)[_0x8db2('0xd8')](function(_0x2f6a02){_0x3d24bc[_0x8db2('0x37')][_0x8db2('0xa1')](util[_0x8db2('0x56')](_0x8db2('0xda'),_0x1c1581,_0x43ba9e,_0x2f6a02),_0x35edb1[_0x2f6a02]);});});this[_0x8db2('0x37')][_0x8db2('0xa1')](util[_0x8db2('0x56')]('%s_ROWS_COUNT',_0x1c1581),_0x51296a[_0x8db2('0xa0')]);return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')]('variable\x20%s\x20set',_0x1c1581));};AGIVertices[_0x8db2('0x11')][_0x8db2('0xdb')]=function(_0x336ae8){logger['debug'](util[_0x8db2('0x56')](_0x8db2('0xdc'),_0x336ae8[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x336ae8[_0x8db2('0xdd')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x336ae8,_0x8db2('0xde'));}var _0x661068=this[_0x8db2('0x1c')][_0x8db2('0x71')](this,_0x336ae8['sip_id']);if(!_0x661068){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x336ae8,_0x8db2('0xdf'));}var _0x47db31=this[_0x8db2('0x37')][_0x8db2('0xb3')](_0x8db2('0xe0'),[util['format'](_0x8db2('0xe1'),_0x661068),_0x336ae8[_0x8db2('0x67')],_0x336ae8[_0x8db2('0xe2')],_0x336ae8[_0x8db2('0x73')]]);if(_0x47db31[_0x8db2('0xa7')]===-0x1){return _0x47db31;}return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')]('Executed\x20command\x20%s',_0x8db2('0xe0')));};AGIVertices[_0x8db2('0x11')][_0x8db2('0xe3')]=function(_0x5b2405){logger['info'](util[_0x8db2('0x56')](_0x8db2('0xe4'),_0x5b2405[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x5b2405[_0x8db2('0x7a')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xe5'));}if(!this['isConfigured'](_0x5b2405[_0x8db2('0x5e')])){return this['channel'][_0x8db2('0xac')](_0x8db2('0xad'));}this['channel'][_0x8db2('0xe6')]=!![];this[_0x8db2('0x36')](_0x5b2405);this[_0x8db2('0x42')](_0x5b2405['text'],'in','','');this['channel'][_0x8db2('0xac')](util['format'](_0x8db2('0xe7'),_0x5b2405[_0x8db2('0x5e')]));var _0x48aef4=this[_0x8db2('0xe8')][_0x8db2('0x71')](this,_0x5b2405);if(_0x48aef4){for(var _0x4d4a75 in _0x48aef4){if(_0x48aef4[_0x8db2('0x97')](_0x4d4a75)){this[_0x8db2('0x37')][_0x8db2('0xa1')](util[_0x8db2('0x56')](_0x8db2('0xe9'),_0x4d4a75[_0x8db2('0x6b')]()),_0x48aef4[_0x4d4a75]);}}this['createSquareMessage'](_0x48aef4[_0x8db2('0xea')],'out',_0x8db2('0xe3'),'');return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0xeb'),_0x48aef4[_0x8db2('0xea')]));}return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x5b2405,_0x8db2('0xec'));};AGIVertices['prototype']['dialogflowV2']=function(_0x399c3c){logger[_0x8db2('0x2f')](util['format'](_0x8db2('0xed'),_0x399c3c['label']));if(!this[_0x8db2('0x85')](_0x399c3c[_0x8db2('0x7c')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xee'));}if(!this[_0x8db2('0x85')](_0x399c3c[_0x8db2('0x7d')])){return this['channel'][_0x8db2('0xac')](_0x8db2('0xef'));}if(!this[_0x8db2('0x85')](_0x399c3c[_0x8db2('0x7e')])){return this[_0x8db2('0x37')][_0x8db2('0xac')]('no\x20private_key\x20configured');}if(!this[_0x8db2('0x85')](_0x399c3c[_0x8db2('0xf0')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xf1'));}if(!this[_0x8db2('0x85')](_0x399c3c[_0x8db2('0x5e')])){return this[_0x8db2('0x37')]['noop'](_0x8db2('0xad'));}this['channel'][_0x8db2('0xe6')]=!![];this[_0x8db2('0x36')](_0x399c3c);this[_0x8db2('0x42')](_0x399c3c['text'],'in','','');this[_0x8db2('0x37')]['noop'](util['format']('Trying\x20DialogflowV2:\x20%s',_0x399c3c[_0x8db2('0x5e')]));var _0x2f4073=this[_0x8db2('0x7b')][_0x8db2('0x71')](this,_0x399c3c);if(_0x2f4073){for(var _0x53b664 in _0x2f4073){if(_0x2f4073[_0x8db2('0x97')](_0x53b664)){if(_0x53b664!=='providerResponse'){this[_0x8db2('0x37')]['setVariable'](util['format'](_0x8db2('0xe9'),_0x53b664[_0x8db2('0x6b')]()),_0x2f4073[_0x53b664]);}}}this[_0x8db2('0x42')](_0x2f4073[_0x8db2('0xea')],_0x8db2('0xf2'),'dialogflowV2',_0x2f4073[_0x8db2('0xf3')]);return this['channel'][_0x8db2('0xac')](util['format']('DialogflowV2\x20Result\x20%s',_0x2f4073['speech']));}return this['channel'][_0x8db2('0x2d')](_0x399c3c,_0x8db2('0xf4'));};AGIVertices[_0x8db2('0x11')][_0x8db2('0xf5')]=function(_0x40a68e){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x40a68e[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x40a68e[_0x8db2('0xf6')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xf7'));}if(!this['isConfigured'](_0x40a68e['username'])){return this[_0x8db2('0x37')][_0x8db2('0xac')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x40a68e[_0x8db2('0xf8')])){return this[_0x8db2('0x37')][_0x8db2('0xac')]('no\x20password\x20configured');}if(!this[_0x8db2('0x85')](_0x40a68e['ndassistant_url'])){return this[_0x8db2('0x37')]['noop']('no\x20text\x20configured');}this[_0x8db2('0x37')]['bot']=!![];this[_0x8db2('0x36')](_0x40a68e);this['createSquareMessage'](_0x40a68e[_0x8db2('0x5e')],'in','','');this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0xf9'),_0x40a68e[_0x8db2('0x5e')]));var _0x5c747f=this[_0x8db2('0x7f')]['sync'](this,_0x40a68e);if(_0x5c747f){for(var _0x3da348 in _0x5c747f){if(_0x5c747f[_0x8db2('0x97')](_0x3da348)){this['channel']['setVariable'](util[_0x8db2('0x56')]('SESTEK_NDA_%s',_0x3da348[_0x8db2('0x6b')]()),_0x5c747f[_0x3da348]);}}this['createSquareMessage'](_0x5c747f[_0x8db2('0xea')],_0x8db2('0xf2'),_0x8db2('0xf5'),'');if(_0x5c747f[_0x8db2('0xfa')]){this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0xfb'),_0x5c747f[_0x8db2('0xfa')]));var _0x2c8e82=this[_0x8db2('0x37')]['streamFile'](_0x5c747f[_0x8db2('0xfa')]);try{fs[_0x8db2('0xfc')](_0x5c747f[_0x8db2('0xfa')]+'.wav');}catch(_0x3cf632){logger[_0x8db2('0x2d')](_0x3cf632);}return _0x2c8e82;}else{return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')]('SestekNDA\x20Result\x20%s',_0x5c747f[_0x8db2('0xea')]));}}return this[_0x8db2('0x37')]['error'](_0x40a68e,_0x8db2('0xfd'));};AGIVertices[_0x8db2('0x11')][_0x8db2('0xfe')]=function(_0x418a5c){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0xff'),_0x418a5c['label']));return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xfe'));};AGIVertices['prototype'][_0x8db2('0x100')]=function(_0x530f9a){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x101'),_0x530f9a[_0x8db2('0xab')]));var _0x23e06f='';if(_0x530f9a[_0x8db2('0x102')]){if(!this[_0x8db2('0x85')](_0x530f9a[_0x8db2('0x102')])){return this[_0x8db2('0x37')]['error'](_0x530f9a,_0x8db2('0x103'));}else{var _0x5bf6a7=parseInt(_0x530f9a[_0x8db2('0x102')],0xa);if(isNaN(_0x5bf6a7)){_0x23e06f=_0x530f9a[_0x8db2('0x102')];}else{_0x23e06f=this[_0x8db2('0x104')][_0x8db2('0x71')](this,_0x530f9a[_0x8db2('0x102')]);if(!_0x23e06f){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x530f9a,_0x8db2('0x105'));}}}}else if(_0x530f9a[_0x8db2('0x106')]){_0x23e06f=_0x530f9a['trunk_name'];}else{return this[_0x8db2('0x37')]['error'](_0x530f9a,_0x8db2('0x103'));}var _0xf14e59=this[_0x8db2('0x37')][_0x8db2('0xb3')](_0x8db2('0xe0'),[util[_0x8db2('0x56')](_0x8db2('0x107'),_0x23e06f,_0x530f9a[_0x8db2('0x47')]),_0x530f9a[_0x8db2('0x67')],_0x530f9a[_0x8db2('0xe2')],_0x530f9a['url']]);if(_0xf14e59[_0x8db2('0xa7')]===-0x1){return _0xf14e59;}return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x108'),_0x8db2('0xe0')));};AGIVertices[_0x8db2('0x11')]['finally']=function(_0x768897){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x109'),_0x768897[_0x8db2('0xab')]));return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0x10a'));};AGIVertices[_0x8db2('0x11')][_0x8db2('0xd')]=function(_0x2e117f){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x10b'),_0x2e117f['label']));if(_0x2e117f['retry']===0x0){return this[_0x8db2('0xa9')](_0x2e117f);}_0x2e117f[_0x8db2('0xaa')]-=0x1;if(!this[_0x8db2('0x85')](_0x2e117f[_0x8db2('0x10c')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x2e117f,_0x8db2('0x10d'));}var _0x48b41e=this[_0x8db2('0x1f')][_0x8db2('0x71')](this,_0x2e117f['file_id']);if(!_0x48b41e){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x2e117f,_0x8db2('0x10e'));}if(!this[_0x8db2('0x85')](_0x2e117f[_0x8db2('0xd6')])){return this[_0x8db2('0x37')]['error'](_0x8db2('0xd7'));}var _0x4894e3=this['channel'][_0x8db2('0x10f')](_0x48b41e,_0x2e117f[_0x8db2('0x110')],_0x2e117f[_0x8db2('0x111')]);var _0x6f6b1a=_0x4894e3[_0x8db2('0xa7')]?_0x4894e3[_0x8db2('0xa7')][_0x8db2('0x4c')]():'';logger[_0x8db2('0x2f')](_0x8db2('0x112'),JSON['stringify'](_0x4894e3));if(_0x4894e3[_0x8db2('0xa7')]===-0x1){this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0x2e117f,_0x6f6b1a);return _0x4894e3;}else if(_0x4894e3[_0x8db2('0xa4')]==='timeout'){_0x4894e3[_0x8db2('0xa7')]=_0x6f6b1a[_0x8db2('0xa0')]>=parseInt(_0x2e117f[_0x8db2('0x113')])?'x':'i';}else{_0x4894e3[_0x8db2('0xa7')]=_0x6f6b1a[_0x8db2('0xa0')]>=parseInt(_0x2e117f['mindigit'])&&_0x6f6b1a[_0x8db2('0xa0')]<=parseInt(_0x2e117f[_0x8db2('0x111')])?'x':'i';}var _0x17075f=this['getVariable']['sync'](this,_0x2e117f[_0x8db2('0xd6')]);if(!_0x17075f){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x2e117f,_0x8db2('0x114'));}this['channel'][_0x8db2('0xa1')](_0x17075f,_0x6f6b1a);if(this[_0x8db2('0x85')](_0x2e117f[_0x8db2('0x115')])){var _0x1d1796=parseInt(_0x2e117f['hiddendigitsnum'],0xa);var _0x5c82fb=rs[_0x8db2('0x116')]({'charset':'*','length':_0x1d1796});var _0x3b898b=_0x6f6b1a[_0x8db2('0xa0')];if(_0x3b898b>0x0){if(_0x3b898b>_0x1d1796){this['createSquareDetailsReport'][_0x8db2('0x71')](this,_0x2e117f,_0x2e117f[_0x8db2('0x117')]===_0x8db2('0x118')?_0x5c82fb+_0x6f6b1a['substr'](_0x1d1796):_0x6f6b1a[_0x8db2('0x119')](0x0,_0x3b898b-_0x1d1796)+_0x5c82fb);}else{this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0x2e117f,rs[_0x8db2('0x116')]({'charset':'*','length':_0x3b898b}));}}else{this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0x2e117f,'');}}else{this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0x2e117f,_0x6f6b1a);}return _0x4894e3;};AGIVertices[_0x8db2('0x11')][_0x8db2('0xe')]=function(_0x398157){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x11a'),_0x398157[_0x8db2('0xab')]));return this[_0x8db2('0xd')](_0x398157);};AGIVertices[_0x8db2('0x11')][_0x8db2('0x11b')]=function(_0xbd6d62){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x11c'),_0xbd6d62[_0x8db2('0xab')]));this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0xbd6d62,_0xbd6d62['goalname']);return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x11d'),_0xbd6d62[_0x8db2('0x11e')]));};AGIVertices['prototype'][_0x8db2('0x11f')]=function(_0x482236){logger['info'](util['format'](_0x8db2('0x120'),_0x482236[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x482236[_0x8db2('0x88')])||!this[_0x8db2('0x85')](_0x482236['aws_secret_access_key'])){return this[_0x8db2('0x37')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x8db2('0x85')](_0x482236[_0x8db2('0x5e')])){return this['channel'][_0x8db2('0xac')](_0x8db2('0xad'));}this[_0x8db2('0x37')]['noop'](util[_0x8db2('0x56')](_0x8db2('0x121'),_0x482236[_0x8db2('0x5e')]));var _0x10d039=this['awsPolly'][_0x8db2('0x71')](this,_0x482236);if(_0x10d039){this[_0x8db2('0x37')][_0x8db2('0xac')](util['format'](_0x8db2('0x122'),_0x10d039));var _0x537b80=this['channel']['streamFile'](_0x10d039);try{fs[_0x8db2('0xfc')](_0x10d039+'.wav');}catch(_0x554d60){logger[_0x8db2('0x2d')](_0x554d60);}return _0x537b80;}return this['channel'][_0x8db2('0x2d')](_0x482236,_0x8db2('0x123'));};AGIVertices['prototype'][_0x8db2('0x124')]=function(_0x5cd6cc){logger['info'](util['format'](_0x8db2('0x125'),_0x5cd6cc[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x5cd6cc[_0x8db2('0x88')])||!this[_0x8db2('0x85')](_0x5cd6cc[_0x8db2('0x89')])){return this['channel'][_0x8db2('0xac')](_0x8db2('0x126'));}if(!this[_0x8db2('0x85')](_0x5cd6cc['aws_bot_name'])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0x127'));}if(!this[_0x8db2('0x85')](_0x5cd6cc[_0x8db2('0x5e')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xad'));}this[_0x8db2('0x37')]['bot']=!![];this[_0x8db2('0x36')](_0x5cd6cc);this[_0x8db2('0x42')](_0x5cd6cc[_0x8db2('0x5e')],'in','','');this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')]('Trying\x20Amazon\x20Lex:\x20%s',_0x5cd6cc['text']));var _0x3f4e79=this[_0x8db2('0x8d')][_0x8db2('0x71')](this,_0x5cd6cc);if(_0x3f4e79){for(var _0x4541d6 in _0x3f4e79){if(_0x3f4e79[_0x8db2('0x97')](_0x4541d6)&&_['isString'](_0x3f4e79[_0x4541d6])){this[_0x8db2('0x37')]['setVariable'](util['format']('AWS_LEX_%s',_0x4541d6['toUpperCase']()),_0x3f4e79[_0x4541d6]);}}if(_['isNil'](_0x3f4e79[_0x8db2('0x78')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0x128'));}else{this['createSquareMessage'](_0x3f4e79[_0x8db2('0x78')],_0x8db2('0xf2'),'amazonlex','');return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x129'),_0x3f4e79[_0x8db2('0x78')]));}}return this['channel']['error'](_0x5cd6cc,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x8db2('0x11')][_0x8db2('0x12a')]=function(_0x561977){logger['info'](util['format'](_0x8db2('0x12b'),_0x561977[_0x8db2('0xab')],_0x561977['timeout']));if(!this['isConfigured'](_0x561977[_0x8db2('0x7a')])){return this[_0x8db2('0x37')][_0x8db2('0xac')]('no\x20key\x20configured');}var _0x3b7c68=_0x8db2('0x12c');var _0x290924=util['format'](_0x8db2('0x12d'),FILES_PATH,rs[_0x8db2('0x116')](0x4));var _0x4878df=util[_0x8db2('0x56')]('%s.%s',_0x290924,_0x3b7c68);var _0xec028f=!![];if(_0x561977['beep']===_0x8db2('0x12e')){_0xec028f=![];}var _0xeb6ff6=this[_0x8db2('0x37')][_0x8db2('0x12f')](_0x290924,_0x3b7c68,_0x561977[_0x8db2('0x130')],_0x561977[_0x8db2('0x67')],undefined,_0xec028f);if(_0xeb6ff6['result']!==-0x1){this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')]('google\x20%s\x20file\x20created',_0x4878df));var _0x525f8e=this[_0x8db2('0x90')]['sync'](this,_0x561977,_0x4878df);if(_0x525f8e){for(var _0x3ef2d6 in _0x525f8e){if(_0x525f8e[_0x8db2('0x97')](_0x3ef2d6)){this['channel'][_0x8db2('0xa1')](util['format'](_0x8db2('0x131'),_0x3ef2d6[_0x8db2('0x6b')]()),_0x525f8e[_0x3ef2d6]);}}return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')]('GoogleASR\x20Result\x20%s',JSON[_0x8db2('0x75')](_0x525f8e)));}}return _0xeb6ff6;};AGIVertices['prototype'][_0x8db2('0x132')]=function(_0x55f1b0){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x133'),_0x55f1b0['label']));if(!this[_0x8db2('0x85')](_0x55f1b0[_0x8db2('0x93')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0x134'));}if(!this[_0x8db2('0x85')](_0x55f1b0[_0x8db2('0x94')])){return this[_0x8db2('0x37')]['noop'](_0x8db2('0x135'));}var _0x56b879=_0x8db2('0x12c');var _0x3a8e21=util[_0x8db2('0x56')]('%s/recordings/%s',FILES_PATH,rs[_0x8db2('0x116')](0x4));var _0x22a89f=util[_0x8db2('0x56')](_0x8db2('0x9f'),_0x3a8e21,_0x56b879);var _0xf91298=!![];if(_0x55f1b0['beep']===_0x8db2('0x12e')){_0xf91298=![];}var _0x4e01d4=this[_0x8db2('0x37')][_0x8db2('0x12f')](_0x3a8e21,_0x56b879,_0x55f1b0[_0x8db2('0x130')],_0x55f1b0[_0x8db2('0x67')],undefined,_0xf91298);if(_0x4e01d4['result']!==-0x1){this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x136'),_0x22a89f));var _0x3d9f70=this[_0x8db2('0x92')][_0x8db2('0x71')](this,_0x55f1b0,_0x22a89f);if(_0x3d9f70){for(var _0x48e95a in _0x3d9f70){if(_0x3d9f70[_0x8db2('0x97')](_0x48e95a)){this[_0x8db2('0x37')][_0x8db2('0xa1')](util['format'](_0x8db2('0x137'),_0x48e95a[_0x8db2('0x6b')]()),_0x3d9f70[_0x48e95a]);}}return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x138'),JSON[_0x8db2('0x75')](_0x3d9f70)));}}return _0x4e01d4;};AGIVertices['prototype'][_0x8db2('0x139')]=function(_0x3b26b2){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x13a'),_0x3b26b2['label']));return this[_0x8db2('0x37')][_0x8db2('0x13b')](_0x3b26b2[_0x8db2('0x3e')],_0x3b26b2[_0x8db2('0x13c')],_0x3b26b2[_0x8db2('0x3f')]);};AGIVertices['prototype'][_0x8db2('0x13d')]=function(_0x32f65a){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x13e'),_0x32f65a['label']));if(!this['isConfigured'](_0x32f65a[_0x8db2('0x13f')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x32f65a,_0x8db2('0x140'));}try{var _0x23d094=eval(_0x32f65a[_0x8db2('0x13f')])?'true':'false';this[_0x8db2('0x37')][_0x8db2('0xac')](util['format'](_0x8db2('0x141'),_0x32f65a[_0x8db2('0x13f')],_0x23d094));return{'code':0xc8,'result':_0x23d094};}catch(_0xf27eb8){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x8db2('0x11')][_0x8db2('0x142')]=function(_0x24e583){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x24e583[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x24e583['interval_id'])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x24e583,_0x8db2('0x143'));}var _0xcd5bca=this[_0x8db2('0x26')][_0x8db2('0x71')](this,_0x24e583['interval_id']);if(!_0xcd5bca){return this['channel'][_0x8db2('0x2d')](_0x24e583,_0x8db2('0x144'));}for(var _0x55c693=0x0;_0x55c693<_0xcd5bca[_0x8db2('0xa0')];_0x55c693+=0x1){var _0x494af6=this['channel']['getVariable'](util[_0x8db2('0x56')](_0x8db2('0x145'),_0xcd5bca[_0x55c693]));if(_0x494af6['result']===-0x1){return _0x494af6;}logger['info'](util[_0x8db2('0x56')](_0x8db2('0x146'),_0xcd5bca[_0x55c693],_0x494af6[_0x8db2('0xa4')]));if(_0x494af6['extra']==='true'){logger[_0x8db2('0x2f')](util['format'](_0x8db2('0x146'),_0xcd5bca[_0x55c693],'true'));this[_0x8db2('0x37')][_0x8db2('0xac')](util['format'](_0x8db2('0x146'),_0xcd5bca[_0x55c693],_0x8db2('0x147')));return{'code':0xc8,'result':_0x8db2('0x147')};}else{logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x146'),_0xcd5bca[_0x55c693],_0x8db2('0x148')));this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x146'),_0xcd5bca[_0x55c693],_0x8db2('0x148')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x8db2('0x11')]['hangup']=function(_0x44b747){logger[_0x8db2('0x2f')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x44b747[_0x8db2('0xab')]));return this[_0x8db2('0x37')][_0x8db2('0x149')]();};AGIVertices['prototype']['ispeechasr']=function(_0x188846){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x14a'),_0x188846[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x188846['key'])){return this[_0x8db2('0x37')][_0x8db2('0xac')]('no\x20key\x20configured');}var _0x57e20f=_0x8db2('0x12c');var _0x5c8cd8=util[_0x8db2('0x56')](_0x8db2('0x12d'),FILES_PATH,rs[_0x8db2('0x116')](0x4));var _0x1c6149=util[_0x8db2('0x56')]('%s.%s',_0x5c8cd8,_0x57e20f);var _0xc438bb=!![];if(_0x188846['beep']===_0x8db2('0x12e')){_0xc438bb=![];}var _0x5ef2d8=this[_0x8db2('0x37')][_0x8db2('0x12f')](_0x5c8cd8,_0x57e20f,_0x188846[_0x8db2('0x130')],_0x188846[_0x8db2('0x67')],undefined,_0xc438bb);if(_0x5ef2d8[_0x8db2('0xa7')]!==-0x1){this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x14b'),_0x1c6149));var _0x422eac=this[_0x8db2('0x83')][_0x8db2('0x71')](this,_0x188846,_0x1c6149);if(_0x422eac){for(var _0x6e617e in _0x422eac){if(_0x422eac[_0x8db2('0x97')](_0x6e617e)){this[_0x8db2('0x37')][_0x8db2('0xa1')](util['format'](_0x8db2('0x14c'),_0x6e617e['toUpperCase']()),_0x422eac[_0x6e617e]);}}return this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x14d'),JSON['stringify'](_0x422eac)));}}return _0x5ef2d8;};AGIVertices[_0x8db2('0x11')][_0x8db2('0x14e')]=function(_0x30a243){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x30a243[_0x8db2('0xab')]));if(!this['isConfigured'](_0x30a243[_0x8db2('0x7a')])){return this[_0x8db2('0x37')][_0x8db2('0xac')]('no\x20key\x20configured');}if(!this[_0x8db2('0x85')](_0x30a243[_0x8db2('0x5e')])){return this['channel'][_0x8db2('0xac')](_0x8db2('0xad'));}this['channel']['noop'](util[_0x8db2('0x56')](_0x8db2('0x14f'),_0x30a243[_0x8db2('0x5e')]));var _0x16127e=this[_0x8db2('0x80')][_0x8db2('0x71')](this,_0x30a243);if(_0x16127e){this[_0x8db2('0x37')][_0x8db2('0xac')](util['format'](_0x8db2('0x14b'),_0x16127e));var _0x3e2b24=this['channel']['streamFile'](_0x16127e,_0x30a243['intKey']);try{fs['unlink'](_0x16127e+_0x8db2('0x150'));}catch(_0xb4b494){logger[_0x8db2('0x2d')](_0xb4b494);}return _0x3e2b24;}return this[_0x8db2('0x37')]['error'](_0x30a243,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8db2('0x11')][_0x8db2('0x151')]=function(_0x5401ee){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x5401ee['label']));if(!this[_0x8db2('0x85')](_0x5401ee[_0x8db2('0x152')])){return this[_0x8db2('0x37')]['error'](_0x5401ee,_0x8db2('0x153'));}logger[_0x8db2('0x2f')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x5401ee[_0x8db2('0x152')]));var _0x3d0d1d=this['agentLogin'][_0x8db2('0x71')](this,_0x5401ee[_0x8db2('0x152')]);if(_0x3d0d1d){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x154'),this[_0x8db2('0x37')]['callerid'],_0x5401ee['findBy']));this[_0x8db2('0x37')][_0x8db2('0xac')](util['format'](_0x8db2('0x154'),this[_0x8db2('0x37')]['callerid'],_0x5401ee[_0x8db2('0x152')]));return{'code':0xc8,'result':_0x8db2('0x155')};}else{logger[_0x8db2('0x2f')](util['format'](_0x8db2('0x156'),this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x5401ee[_0x8db2('0x152')]));this[_0x8db2('0x37')]['noop'](util[_0x8db2('0x56')](_0x8db2('0x156'),this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x5401ee[_0x8db2('0x152')]));return{'code':0xc8,'result':_0x8db2('0x157')};}};AGIVertices[_0x8db2('0x11')][_0x8db2('0x158')]=function(_0x2e3000){logger['info'](util[_0x8db2('0x56')](_0x8db2('0x159'),_0x2e3000[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x2e3000[_0x8db2('0x152')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x2e3000,'no\x20find\x20by\x20configured');}logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x2e3000[_0x8db2('0x152')]));var _0x325d24=this['agentLogout'][_0x8db2('0x71')](this,_0x2e3000[_0x8db2('0x152')]);if(_0x325d24){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x154'),this['channel'][_0x8db2('0x3c')],_0x2e3000['findBy']));this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x154'),this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x2e3000[_0x8db2('0x152')]));return{'code':0xc8,'result':_0x8db2('0x155')};}else{logger[_0x8db2('0x2f')](util['format'](_0x8db2('0x156'),this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x2e3000['findBy']));this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x156'),this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x2e3000[_0x8db2('0x152')]));return{'code':0xc8,'result':_0x8db2('0x157')};}};AGIVertices[_0x8db2('0x11')][_0x8db2('0x15a')]=function(_0x300ea3){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x15b'),_0x300ea3[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x300ea3[_0x8db2('0x15c')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x300ea3,_0x8db2('0x15d'));}this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')]('math\x20%s',_0x300ea3['operation']));var _0x3a5ac4=eval(_0x300ea3[_0x8db2('0x15c')]);if(!this[_0x8db2('0x85')](_0x300ea3[_0x8db2('0xd6')])){return this[_0x8db2('0x37')][_0x8db2('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3d17d5=this['getVariable']['sync'](this,_0x300ea3['variable_id']);if(!_0x3d17d5){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x300ea3,_0x8db2('0x114'));}if(_['isArray'](_0x3a5ac4)){var _0x253bcf=this;_0x3a5ac4[_0x8db2('0xd8')](function(_0x533f48,_0x10c820){_0x253bcf[_0x8db2('0x37')]['setVariable'](util[_0x8db2('0x56')]('%s[%s]',_0x3d17d5,_0x10c820),_0x533f48);});return this[_0x8db2('0x37')]['noop'](util[_0x8db2('0x56')](_0x8db2('0x15e'),_0x3d17d5));}else{return this[_0x8db2('0x37')][_0x8db2('0xa1')](_0x3d17d5,_0x3a5ac4);}};AGIVertices[_0x8db2('0x11')][_0x8db2('0xc')]=function(_0x4c9bbe){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x15f'),_0x4c9bbe[_0x8db2('0xab')]));if(_0x4c9bbe['retry']===0x0){return this[_0x8db2('0xa9')](_0x4c9bbe);}_0x4c9bbe[_0x8db2('0xaa')]-=0x1;if(!this[_0x8db2('0x85')](_0x4c9bbe[_0x8db2('0x10c')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x4c9bbe,_0x8db2('0x10d'));}var _0x3f98cf=this[_0x8db2('0x1f')]['sync'](this,_0x4c9bbe[_0x8db2('0x10c')]);if(!_0x3f98cf){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x4c9bbe,_0x8db2('0x10e'));}var _0x4e0dd9=this[_0x8db2('0x37')][_0x8db2('0x10f')](_0x3f98cf,_0x4c9bbe[_0x8db2('0x110')],_0x4c9bbe[_0x8db2('0x160')]);var _0x23130e=_0x4e0dd9['result'];if(_0x4e0dd9[_0x8db2('0xa7')]===-0x1){this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0x4c9bbe,'-1');return _0x4e0dd9;}else if(_0x4e0dd9[_0x8db2('0xa4')]===_0x8db2('0x67')){_0x4e0dd9[_0x8db2('0xa7')]=_0x4e0dd9[_0x8db2('0xa7')][_0x8db2('0xa0')]>0x0?_0x4e0dd9[_0x8db2('0xa7')]:'t';}else if(_['isEmpty'](_0x4e0dd9[_0x8db2('0xa7')])){_0x4e0dd9[_0x8db2('0xa7')]='#';_0x23130e='#';}if(!this[_0x8db2('0x85')](_0x4c9bbe[_0x8db2('0xd6')])){this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xd7'));}else{var _0x460a6a=this[_0x8db2('0xa6')][_0x8db2('0x71')](this,_0x4c9bbe[_0x8db2('0xd6')]);if(!_0x460a6a){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x4c9bbe,_0x8db2('0x114'));}this[_0x8db2('0x37')][_0x8db2('0xa1')](_0x460a6a,_0x23130e);}this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0x4c9bbe,_0x23130e);return _0x4e0dd9;};AGIVertices[_0x8db2('0x11')][_0x8db2('0xac')]=function(_0x114fab){logger['info'](util[_0x8db2('0x56')](_0x8db2('0x161'),_0x114fab[_0x8db2('0xab')]));return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x114fab[_0x8db2('0x162')]||_0x114fab[_0x8db2('0xab')]);};AGIVertices[_0x8db2('0x11')][_0x8db2('0x163')]=function(_0x27f224){logger['info'](util[_0x8db2('0x56')](_0x8db2('0x164'),_0x27f224['label']));if(!this[_0x8db2('0x85')](_0x27f224[_0x8db2('0x152')])){return this['channel']['error'](_0x27f224,_0x8db2('0x153'));}logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x165'),this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x27f224['findBy']));var _0x5b99d9=this[_0x8db2('0x166')][_0x8db2('0x71')](this,_0x27f224[_0x8db2('0x167')]);var _0x1e5697=this[_0x8db2('0x4f')][_0x8db2('0x71')](this,_0x27f224[_0x8db2('0x152')],_0x5b99d9);if(_0x1e5697){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x154'),this[_0x8db2('0x37')]['callerid'],_0x27f224[_0x8db2('0x152')]));this[_0x8db2('0x37')]['noop'](util[_0x8db2('0x56')](_0x8db2('0x154'),this['channel']['callerid'],_0x27f224[_0x8db2('0x152')]));return{'code':0xc8,'result':_0x8db2('0x155')};}else{logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x156'),this[_0x8db2('0x37')]['callerid'],_0x27f224[_0x8db2('0x152')]));this[_0x8db2('0x37')][_0x8db2('0xac')](util['format'](_0x8db2('0x154'),this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x27f224['findBy']));return{'code':0xc8,'result':_0x8db2('0x157')};}};AGIVertices['prototype'][_0x8db2('0x168')]=function(_0x33cbad){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x169'),_0x33cbad[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x33cbad[_0x8db2('0x10c')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x33cbad,'no\x20file\x20audio\x20selected');}var _0x1a4f83=this['getSound']['sync'](this,_0x33cbad[_0x8db2('0x10c')]);if(!_0x1a4f83){return this[_0x8db2('0x37')]['error'](_0x33cbad,_0x8db2('0x10e'));}var _0x361ddd=this[_0x8db2('0x37')][_0x8db2('0xb3')](_0x8db2('0x16a'),[_0x1a4f83,_0x33cbad[_0x8db2('0xe2')]]);if(_0x361ddd[_0x8db2('0xa7')]===-0x1){return _0x361ddd;}return this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')]('Executed\x20command\x20%s\x20%s',_0x8db2('0x16a'),_0x1a4f83));};AGIVertices['prototype'][_0x8db2('0x16b')]=function(_0xc26721){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x16c'),_0xc26721[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0xc26721[_0x8db2('0x16d')])){return this['channel']['error'](_0xc26721,_0x8db2('0x16e'));}var _0x587452='';var _0x4ce188=parseInt(_0xc26721[_0x8db2('0x16d')],0xa);if(isNaN(_0x4ce188)){_0x587452=_0xc26721['queue_id'];}else{_0x587452=this[_0x8db2('0x16')][_0x8db2('0x71')](this,_0xc26721[_0x8db2('0x16d')]);if(!_0x587452){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0xc26721,_0x8db2('0x16f'));}}var _0x5695f6='';if(this[_0x8db2('0x85')](_0xc26721[_0x8db2('0x10c')])){var _0x439e54=this[_0x8db2('0x1f')]['sync'](this,_0xc26721[_0x8db2('0x10c')]);if(_0x439e54){_0x5695f6=_0x439e54;}}this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0xc26721,_0x587452);if(_0xc26721[_0x8db2('0xe2')][_0x8db2('0x170')]('x')<0x0){_0xc26721['opts']+='x';}if(_0xc26721[_0x8db2('0xe2')][_0x8db2('0x170')]('X')<0x0){_0xc26721[_0x8db2('0xe2')]+='X';}this[_0x8db2('0x37')][_0x8db2('0xa1')](_0x8db2('0x171'),_0x587452?_0x587452['toLowerCase']():'');var _0x2d9d6a=this['channel'][_0x8db2('0xb3')](_0x8db2('0x172'),[_0x587452,_0xc26721[_0x8db2('0xe2')],_0xc26721[_0x8db2('0x73')],_0x5695f6,_0xc26721[_0x8db2('0x67')],_0xc26721[_0x8db2('0xb9')],_0xc26721[_0x8db2('0x173')],_0xc26721[_0x8db2('0x174')],'',_0xc26721[_0x8db2('0x175')]]);if(_0x2d9d6a[_0x8db2('0xa7')]===-0x1){return _0x2d9d6a;}return this[_0x8db2('0x37')]['noop'](util[_0x8db2('0x56')](_0x8db2('0x176'),_0x8db2('0x172'),_0x587452));};AGIVertices[_0x8db2('0x11')][_0x8db2('0x177')]=function(_0xad570e){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0xad570e[_0x8db2('0xab')]));var _0x12527c=_0xad570e[_0x8db2('0x178')]||'wav';var _0x536ee0=util['format'](_0x8db2('0x179'),this['channel'][_0x8db2('0x38')],rs[_0x8db2('0x116')](0x5));var _0x1d8d66=util[_0x8db2('0x56')](_0x8db2('0x17a'),FILES_PATH,_0x536ee0,_0x12527c);var _0x589bac=util['format'](_0x8db2('0x12d'),FILES_PATH,_0x536ee0);this[_0x8db2('0x3b')][_0x8db2('0x71')](this,_0xad570e,_0x536ee0,_0x1d8d66);this[_0x8db2('0x37')][_0x8db2('0xa1')](_0x8db2('0x17b'),_0x536ee0);logger[_0x8db2('0x2f')](_0x8db2('0x17c'),_0x589bac,_0x12527c,_0xad570e[_0x8db2('0x17d')],_0xad570e['timeout']);return this[_0x8db2('0x37')][_0x8db2('0x12f')](_0x589bac,_0x12527c,_0xad570e[_0x8db2('0x17d')],_0xad570e[_0x8db2('0x67')],undefined,!![]);};AGIVertices[_0x8db2('0x11')]['restapi']=function(_0x52beef){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x17e'),_0x52beef[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x52beef[_0x8db2('0x73')])){return this[_0x8db2('0x37')]['noop'](_0x8db2('0x17f'));}var _0x3b1261=this[_0x8db2('0x65')][_0x8db2('0x71')](this,_0x52beef);logger[_0x8db2('0x2f')](util['format'](_0x8db2('0x180'),util[_0x8db2('0x181')](_0x3b1261,{'showHidden':![],'depth':null})));if(!this[_0x8db2('0x85')](_0x52beef[_0x8db2('0xd6')])){return this[_0x8db2('0x37')]['noop'](_0x8db2('0x182'));}var _0x4fe956=this[_0x8db2('0xa6')][_0x8db2('0x71')](this,_0x52beef[_0x8db2('0xd6')]);if(!_0x4fe956){return this[_0x8db2('0x37')]['error'](_0x52beef,_0x8db2('0x114'));}this['channel'][_0x8db2('0xa1')](util[_0x8db2('0x56')]('%s_STATUS_CODE',_0x4fe956),_0x3b1261[_0x8db2('0x76')]?_0x3b1261['statusCode']:_0x8db2('0x183'));this[_0x8db2('0x37')]['setVariable'](util[_0x8db2('0x56')](_0x8db2('0x184'),_0x4fe956),_0x3b1261['statusMessage']?_0x3b1261['statusMessage']:'OK');if(_0x3b1261[_0x8db2('0x6c')]){try{this[_0x8db2('0x9e')](_0x3b1261[_0x8db2('0x6c')],_0x4fe956);}catch(_0x3cb225){logger[_0x8db2('0x2d')](util['format'](_0x8db2('0x185'),_0x4fe956));}}return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x186'),_0x4fe956));};AGIVertices['prototype'][_0x8db2('0x187')]=function(_0xf1386e){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xf1386e[_0x8db2('0xab')]));return this['channel'][_0x8db2('0x188')](_0xf1386e[_0x8db2('0x189')][_0x8db2('0x5a')](/\s+/g,''),_0xf1386e[_0x8db2('0x17d')]);};AGIVertices[_0x8db2('0x11')][_0x8db2('0x18a')]=function(_0xa7fbbd){logger['info'](util[_0x8db2('0x56')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xa7fbbd['label']));return this[_0x8db2('0x37')][_0x8db2('0x18b')](_0xa7fbbd[_0x8db2('0x18c')]['replace'](/\s+/g,''),_0xa7fbbd[_0x8db2('0x17d')]);};AGIVertices[_0x8db2('0x11')][_0x8db2('0x18d')]=function(_0x1851ad){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x18e'),_0x1851ad[_0x8db2('0xab')]));return this['channel'][_0x8db2('0x18f')](_0x1851ad[_0x8db2('0x5e')],_0x1851ad[_0x8db2('0x17d')]);};AGIVertices[_0x8db2('0x11')][_0x8db2('0x190')]=function(_0xfa9ce2){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xfa9ce2[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0xfa9ce2[_0x8db2('0x191')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0x192'));}var _0x3ca408=this[_0x8db2('0x23')][_0x8db2('0x71')](this,_0xfa9ce2[_0x8db2('0x191')]);if(!_0x3ca408||!_0x3ca408['Smtp']){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0xfa9ce2,_0x8db2('0x193'));}var _0x4fa029={'from':util[_0x8db2('0x56')](_0x8db2('0x194'),_0x3ca408[_0x8db2('0x14')],_0x3ca408[_0x8db2('0x195')]||_0x3ca408[_0x8db2('0x196')][_0x8db2('0x197')]),'to':_0xfa9ce2['to']||'','cc':_0xfa9ce2['cc']||'','bcc':_0xfa9ce2[_0x8db2('0x198')]||'','subject':_0xfa9ce2['subject'],'html':_0xfa9ce2['text'],'text':_0xfa9ce2[_0x8db2('0x5e')]};var _0x20c7c4={'tls':{'rejectUnauthorized':![]}};if(_0x3ca408['Smtp'][_0x8db2('0x199')]){_0x20c7c4['service']=_0x3ca408[_0x8db2('0x196')][_0x8db2('0x199')];}else{_0x20c7c4[_0x8db2('0x19a')]=_0x3ca408[_0x8db2('0x196')][_0x8db2('0x19a')];_0x20c7c4[_0x8db2('0x19b')]=_0x3ca408['Smtp'][_0x8db2('0x19b')];_0x20c7c4[_0x8db2('0x19c')]=_0x3ca408[_0x8db2('0x196')]['secure'];}if(_0x3ca408['Smtp']['authentication']){_0x20c7c4[_0x8db2('0x19d')]={'user':_0x3ca408[_0x8db2('0x196')]['user'],'pass':_0x3ca408[_0x8db2('0x196')][_0x8db2('0x19e')]};}if(this[_0x8db2('0x85')](_0xfa9ce2[_0x8db2('0x19f')])){}logger[_0x8db2('0x1a0')](_0x8db2('0x1a1'),JSON[_0x8db2('0x75')](_0x4fa029));this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0xfa9ce2,_0xfa9ce2[_0x8db2('0x191')]);this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x1a2'),_0x3ca408[_0x8db2('0x14')]));this[_0x8db2('0x25')][_0x8db2('0x71')](this,_0x20c7c4,_0x4fa029);return this[_0x8db2('0x37')][_0x8db2('0xac')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x8db2('0x11')][_0x8db2('0x1a3')]=function(_0x460aa5){logger['info'](util[_0x8db2('0x56')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x460aa5[_0x8db2('0xab')]));return this['channel']['noop'](_0x8db2('0x1a4'));};AGIVertices[_0x8db2('0x11')][_0x8db2('0x1a5')]=function(_0x194be2){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x194be2[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x194be2[_0x8db2('0x1a6')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0x1a7'));}var _0x4454e7=this[_0x8db2('0x33')][_0x8db2('0x71')](this,_0x194be2[_0x8db2('0x1a6')]);if(!_0x4454e7){return this['channel'][_0x8db2('0x2d')](_0x194be2,_0x8db2('0x1a8'));}var _0x37ef27={'body':_0x194be2[_0x8db2('0x1a9')],'phone':_0x194be2['to']||'','SmsAccountId':_0x4454e7['id']};logger['debug'](_0x8db2('0x1aa'),JSON['stringify'](_0x37ef27));this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0x194be2,_0x194be2[_0x8db2('0x1a6')]);this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x1ab'),_0x4454e7[_0x8db2('0x14')]));this[_0x8db2('0x35')]['sync'](this,_0x37ef27);return this['channel'][_0x8db2('0xac')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x8db2('0x1ac')]=function(_0x406698){logger['info'](util[_0x8db2('0x56')](_0x8db2('0x1ad'),_0x406698[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x406698[_0x8db2('0xd6')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x406698,_0x8db2('0x1ae'));}var _0x1bad36=this['getVariable'][_0x8db2('0x71')](this,_0x406698['variable_id']);if(!_0x1bad36){return this[_0x8db2('0x37')]['error'](_0x406698,'no\x20variable\x20found');}return this[_0x8db2('0x37')][_0x8db2('0xa1')](_0x1bad36,_0x406698[_0x8db2('0x1af')]);};AGIVertices['prototype'][_0x8db2('0x1b0')]=function(_0x111166){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x1b1'),_0x111166[_0x8db2('0xab')]));this['channel'][_0x8db2('0xac')]('START\x20CALLY\x20SQUARE');if(_0x111166['answer']===_0x8db2('0x1b2')){this[_0x8db2('0x37')]['noop'](_0x8db2('0x1b3'));return this[_0x8db2('0x37')]['answer']();}return this[_0x8db2('0x37')]['noop'](_0x8db2('0x1b4'));};AGIVertices[_0x8db2('0x11')][_0x8db2('0x1b5')]=function(_0x5ab32d){logger['info'](util[_0x8db2('0x56')](_0x8db2('0x1b6'),_0x5ab32d['label']));if(!this[_0x8db2('0x85')](_0x5ab32d[_0x8db2('0x1b7')])){return this[_0x8db2('0x37')]['error'](_0x5ab32d,'no\x20subproject\x20selected');}var _0x4de007=this[_0x8db2('0x18')]['sync'](this,_0x5ab32d[_0x8db2('0x1b7')]);if(!this[_0x8db2('0x85')](_0x4de007)){return this['channel'][_0x8db2('0x2d')](_0x5ab32d,util[_0x8db2('0x56')](_0x8db2('0x1b8'),_0x5ab32d['project_id']));}if(_0x4de007===this[_0x8db2('0x37')]['arg_1']){return this['channel']['error'](_0x5ab32d,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x8db2('0x71')](this,_0x5ab32d,_0x4de007);var _0x5ee54b=this['channel'][_0x8db2('0xb3')](_0x8db2('0x1b9'),util[_0x8db2('0x56')](_0x8db2('0x1ba'),config[_0x8db2('0xb9')][_0x8db2('0x19a')]||_0x8db2('0x1bb'),_0x4de007,this[_0x8db2('0x37')][_0x8db2('0x3a')]));if(_0x5ee54b[_0x8db2('0xa7')]===-0x1){return _0x5ee54b;}return this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x176'),_0x8db2('0x1b9'),_0x4de007));};AGIVertices[_0x8db2('0x11')][_0x8db2('0x1bc')]=function(_0x4b6d66){logger['info'](util[_0x8db2('0x56')](_0x8db2('0x1bd'),_0x4b6d66[_0x8db2('0xab')]));var _0x32421b=this['shellCommand'][_0x8db2('0x71')](this,_0x4b6d66[_0x8db2('0x1be')]);this[_0x8db2('0x36')][_0x8db2('0x71')](this,_0x4b6d66,_0x4b6d66[_0x8db2('0x1be')]);if(this[_0x8db2('0x85')](_0x4b6d66[_0x8db2('0xd6')])){var _0x5b1e74=this[_0x8db2('0xa6')][_0x8db2('0x71')](this,_0x4b6d66[_0x8db2('0xd6')]);if(_0x5b1e74){this[_0x8db2('0x37')][_0x8db2('0xa1')](_0x5b1e74,_0x32421b);return this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x1bf'),_0x4b6d66['command'],_0x5b1e74));}}return this[_0x8db2('0x37')]['noop'](util[_0x8db2('0x56')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4b6d66[_0x8db2('0x1be')]));};AGIVertices[_0x8db2('0x11')]['google_cloud_tts']=function(_0x15ec1d){logger['info'](util[_0x8db2('0x56')](_0x8db2('0x1c0'),_0x15ec1d[_0x8db2('0xab')]));_0x15ec1d['text']=_0x15ec1d['text'][_0x8db2('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8db2('0x85')](_0x15ec1d[_0x8db2('0x5c')])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0x1c1'));}if(!this['isConfigured'](_0x15ec1d[_0x8db2('0x5e')])){return this['channel'][_0x8db2('0xac')](_0x8db2('0xad'));}this[_0x8db2('0x37')]['noop'](util[_0x8db2('0x56')](_0x8db2('0x1c2'),_0x15ec1d[_0x8db2('0x5e')]));var _0x4e78b2=this['googleCloudTTS'][_0x8db2('0x71')](this,_0x15ec1d);if(_0x4e78b2){this[_0x8db2('0x37')][_0x8db2('0xac')](util['format'](_0x8db2('0x1c3'),_0x4e78b2));var _0x1b1e9a=this['channel'][_0x8db2('0x1c4')](_0x4e78b2);try{fs[_0x8db2('0xfc')](_0x4e78b2+_0x8db2('0x150'));}catch(_0x379800){logger[_0x8db2('0x2d')](_0x379800);}return _0x1b1e9a;}return this['channel']['error'](_0x15ec1d,_0x8db2('0x1c5'));};AGIVertices[_0x8db2('0x11')][_0x8db2('0x1c6')]=function(_0x46295c){logger['info'](util[_0x8db2('0x56')](_0x8db2('0x1c7'),_0x46295c[_0x8db2('0xab')]));_0x46295c['text']=_0x46295c[_0x8db2('0x5e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8db2('0x85')](_0x46295c['text'])){return this[_0x8db2('0x37')][_0x8db2('0xac')](_0x8db2('0xad'));}this[_0x8db2('0x37')]['noop'](util[_0x8db2('0x56')](_0x8db2('0x1c8'),_0x46295c[_0x8db2('0x5e')]));var _0xd1136=this['googleTTS'][_0x8db2('0x71')](this,_0x46295c);if(_0xd1136){this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x1c9'),_0xd1136));var _0x2d1aec=this[_0x8db2('0x37')]['streamFile'](_0xd1136);try{fs['unlink'](_0xd1136+_0x8db2('0x150'));}catch(_0x54522d){logger[_0x8db2('0x2d')](_0x54522d);}return _0x2d1aec;}return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x46295c,_0x8db2('0x1ca'));};AGIVertices[_0x8db2('0x11')][_0x8db2('0x1cb')]=function(_0x147ada){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x1cc'),_0x147ada[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x147ada['findBy'])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x147ada,_0x8db2('0x153'));}logger[_0x8db2('0x2f')](util[_0x8db2('0x56')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x147ada['findBy']));var _0x585c63=this['agentUnpause']['sync'](this,_0x147ada['findBy']);if(_0x585c63){logger['info'](util[_0x8db2('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x147ada[_0x8db2('0x152')]));this[_0x8db2('0x37')][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x154'),this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x147ada[_0x8db2('0x152')]));return{'code':0xc8,'result':_0x8db2('0x155')};}else{logger['info'](util['format'](_0x8db2('0x156'),this[_0x8db2('0x37')][_0x8db2('0x3c')],_0x147ada[_0x8db2('0x152')]));this[_0x8db2('0x37')]['noop'](util[_0x8db2('0x56')](_0x8db2('0x156'),this['channel']['callerid'],_0x147ada[_0x8db2('0x152')]));return{'code':0xc8,'result':_0x8db2('0x157')};}};AGIVertices[_0x8db2('0x11')][_0x8db2('0x1cd')]=function(_0x18f93c){logger[_0x8db2('0x2f')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x18f93c[_0x8db2('0xab')]));var _0x51a70b=this[_0x8db2('0x37')][_0x8db2('0xb3')]('VOICEMAIL',[_0x18f93c[_0x8db2('0x1ce')],_0x18f93c['options']]);if(_0x51a70b[_0x8db2('0xa7')]===-0x1){return _0x51a70b;}return this['channel'][_0x8db2('0xac')](util[_0x8db2('0x56')](_0x8db2('0x176'),_0x8db2('0x1cf'),_0x18f93c[_0x8db2('0x1ce')]));};AGIVertices['prototype'][_0x8db2('0x1d0')]=function(_0x1a19cb){logger[_0x8db2('0x2f')](util[_0x8db2('0x56')](_0x8db2('0x1d1'),_0x1a19cb[_0x8db2('0xab')]));if(!this[_0x8db2('0x85')](_0x1a19cb[_0x8db2('0xd6')])){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x1a19cb,_0x8db2('0x1ae'));}var _0xa3b155=this[_0x8db2('0xa6')]['sync'](this,_0x1a19cb[_0x8db2('0xd6')]);if(!_0xa3b155){return this[_0x8db2('0x37')][_0x8db2('0x2d')](_0x1a19cb,_0x8db2('0x114'));}var _0x1fb8a5=this['channel'][_0x8db2('0xa6')](_0xa3b155);return{'code':0xc8,'result':_0x1fb8a5[_0x8db2('0xa4')]?_0x1fb8a5[_0x8db2('0xa4')]:'-'};};String[_0x8db2('0x11')][_0x8db2('0xa3')]=function(_0x291b7f,_0x5141d8){return this[_0x8db2('0xa2')](_0x291b7f)['join'](_0x5141d8);};module[_0x8db2('0x1d2')]=AGIVertices; \ No newline at end of file +var _0xa965=['en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','%s.%s','length','saveRestApiResult','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','createSquareDetailsReport','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','isString','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','no\x20file\x20audio\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','success','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%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','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','\x22%s\x22\x20<%s>','email','bcc','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','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','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unlink','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','shelljs','odbc','randomstring','moment','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervals','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','agicommand','createSquareRecording','calleridname','context','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','callerid','agentPause','agentUnpause','agentLogout','internal','LOCAL','agentLogin','shellCommand','exec','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode'];(function(_0x56cb4b,_0x10a591){var _0x38837c=function(_0x3bcab8){while(--_0x3bcab8){_0x56cb4b['push'](_0x56cb4b['shift']());}};_0x38837c(++_0x10a591);}(_0xa965,0x172));var _0x5a96=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xa965[_0x295314];return _0x584b0c;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require('lodash');var sh=require(_0x5a96('0x0'));var odbc=require(_0x5a96('0x1'))();var rs=require(_0x5a96('0x2'));var moment=require(_0x5a96('0x3'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x5a96('0x4'))('agi');var config=require(_0x5a96('0x5'));var scripts=require(_0x5a96('0x6'));var FILES_PATH=_0x5a96('0x7');var recursiveMapAttributes=[_0x5a96('0x8'),'rawBody'];var verticesWithRetry=[_0x5a96('0x9'),_0x5a96('0xa'),_0x5a96('0xb')];var AGIVertices=function(_0x191da2,_0x4ed0cf,_0x3db79f){this[_0x5a96('0xc')]=_0x191da2;this[_0x5a96('0xd')]=_0x4ed0cf;this['mailRpc']=_0x3db79f;};AGIVertices[_0x5a96('0xe')][_0x5a96('0xf')]=function(_0x11b8d1,_0x3fa616){this[_0x5a96('0xd')][_0x5a96('0x10')](_0x11b8d1)[_0x5a96('0x11')](function(_0xa63dac){_0x3fa616(null,_0xa63dac?_0xa63dac[_0x5a96('0x12')]:![]);})[_0x5a96('0x13')](function(_0x2ecf53){_0x3fa616(_0x2ecf53);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x14')]=function(_0x3d9618,_0x33a156){this[_0x5a96('0xd')][_0x5a96('0x15')](_0x3d9618)[_0x5a96('0x11')](function(_0x5791d1){_0x33a156(null,_0x5791d1?_0x5791d1[_0x5a96('0x12')]:![]);})[_0x5a96('0x13')](function(_0x4ed18b){_0x33a156(_0x4ed18b);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x16')]=function(_0x325239,_0x75cb1a){this[_0x5a96('0xd')][_0x5a96('0x17')](_0x325239)[_0x5a96('0x11')](function(_0x2400bd){_0x75cb1a(null,_0x2400bd?_0x2400bd['name']:![]);})[_0x5a96('0x13')](function(_0x2a859b){_0x75cb1a(_0x2a859b);});};AGIVertices[_0x5a96('0xe')]['getSquareOdbc']=function(_0x1b7c39,_0x3b12bb){this[_0x5a96('0xd')][_0x5a96('0x18')](_0x1b7c39)['then'](function(_0x4fcba0){_0x3b12bb(null,_0x4fcba0?_0x4fcba0['dsn']:![]);})[_0x5a96('0x13')](function(_0x120aac){_0x3b12bb(_0x120aac);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x19')]=function(_0x2d23b4,_0x3846df){this['rpc'][_0x5a96('0x1a')](_0x2d23b4)[_0x5a96('0x11')](function(_0x53508b){_0x3846df(null,_0x53508b?_0x53508b[_0x5a96('0x12')]:![]);})[_0x5a96('0x13')](function(_0x406337){_0x3846df(_0x406337);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x1b')]=function(_0x5c16af,_0x34aed1){this[_0x5a96('0xd')][_0x5a96('0x1c')](_0x5c16af)[_0x5a96('0x11')](function(_0x22fbc6){_0x34aed1(null,_0x22fbc6?_0x22fbc6[_0x5a96('0x12')]:![]);})[_0x5a96('0x13')](function(_0x24f88c){_0x34aed1(_0x24f88c);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x1d')]=function(_0x4534cb,_0x7ad3f){var _0x28578f=this;this[_0x5a96('0xd')]['getSoundById'](_0x4534cb)[_0x5a96('0x11')](function(_0x4e1114){_0x7ad3f(null,_0x4e1114?_0x28578f[_0x5a96('0x1e')](_0x4e1114[_0x5a96('0x1f')]):![]);})[_0x5a96('0x13')](function(_0x1d267f){_0x7ad3f(_0x1d267f);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x20')]=function(_0x2ef9fa,_0x471adc){this[_0x5a96('0xd')][_0x5a96('0x21')](_0x2ef9fa)[_0x5a96('0x11')](function(_0x450e83){_0x471adc(null,_0x450e83?_0x450e83:![]);})['catch'](function(_0x3d8edd){_0x471adc(_0x3d8edd);});};AGIVertices[_0x5a96('0xe')]['sendMailMessage']=function(_0x4fc7c0,_0x17d2ea,_0x3d343d){this[_0x5a96('0x22')][_0x5a96('0x23')](_0x4fc7c0,_0x17d2ea)['then'](function(){_0x3d343d(null);})['catch'](function(_0x5324e4){_0x3d343d(_0x5324e4);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x24')]=function(_0x57afa1,_0x1dd180){this[_0x5a96('0xd')]['getIntervalById'](_0x57afa1)[_0x5a96('0x11')](function(_0x362b08){if(_0x362b08){if(_0x362b08['IntervalId']){_0x1dd180(null,[_0x362b08[_0x5a96('0x25')]]);}else{_0x1dd180(null,_['map'](_0x362b08[_0x5a96('0x26')],'interval'));}}else{_0x1dd180(null,![]);}})[_0x5a96('0x13')](function(_0x377fd0){_0x1dd180(_0x377fd0);});};AGIVertices[_0x5a96('0xe')]['getSoundPath']=function(_0xa93b06){return util[_0x5a96('0x27')](_0x5a96('0x28'),FILES_PATH,_0xa93b06);};AGIVertices['prototype'][_0x5a96('0x29')]=function(_0x19efdd,_0x2b5b79,_0x3807a5){odbc['open'](_0x19efdd,function(_0x34b31b){if(_0x34b31b){logger[_0x5a96('0x2a')](_0x5a96('0x2b'),_0x34b31b);_0x3807a5(_0x34b31b);}else{logger[_0x5a96('0x2c')](_0x5a96('0x2d'));odbc[_0x5a96('0x2e')](_0x2b5b79,function(_0x21aa42,_0x5a2071){if(_0x21aa42){logger['info']('Error\x20executing\x20query\x20%s',_0x2b5b79);_0x3807a5(_0x21aa42);}else{logger[_0x5a96('0x2c')](_0x5a96('0x2f'),_0x2b5b79);odbc[_0x5a96('0x30')](function(_0xa1bcc7){if(_0xa1bcc7){logger[_0x5a96('0x2a')](_0x5a96('0x31'),_0xa1bcc7);}_0x3807a5(null,_0x5a2071);});}});}});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x32')]=function(_0x5746cb,_0x30bb6c){this[_0x5a96('0xd')][_0x5a96('0x33')](_0x5746cb)['then'](function(_0x40602e){_0x30bb6c(null,_0x40602e?_0x40602e:![]);})['catch'](function(_0x556514){_0x30bb6c(_0x556514);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x34')]=function(_0x5b24cb,_0x39cbe){this[_0x5a96('0xd')][_0x5a96('0x34')](_0x5b24cb)[_0x5a96('0x11')](function(_0x5c90ff){_0x39cbe(null,_0x5c90ff);})[_0x5a96('0x13')](function(_0x54d665){_0x39cbe(_0x54d665);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x1c8b8e,_0x10df76,_0x208dbb){this[_0x5a96('0xd')]['createSquareDetailsReport']({'uniqueid':this[_0x5a96('0xc')][_0x5a96('0x35')],'node':_0x1c8b8e[_0x5a96('0x36')],'application':_0x1c8b8e[_0x5a96('0x37')],'data':_0x10df76||null,'project_name':this[_0x5a96('0xc')]['arg_1'],'callerid':this[_0x5a96('0xc')]['callerid']})[_0x5a96('0x11')](function(_0x39be9f){if(_0x208dbb){_0x208dbb(null,_0x39be9f);}})[_0x5a96('0x13')](function(_0x4fa946){if(_0x208dbb){_0x208dbb(_0x4fa946);}});};AGIVertices['prototype'][_0x5a96('0x38')]=function(_0x20f2c4,_0x448dfe,_0x3e6af0,_0x2901ce){this[_0x5a96('0xd')][_0x5a96('0x38')]({'uniqueid':this[_0x5a96('0xc')]['uniqueid'],'callerid':this[_0x5a96('0xc')]['callerid'],'calleridname':this[_0x5a96('0xc')][_0x5a96('0x39')],'context':this[_0x5a96('0xc')][_0x5a96('0x3a')],'extension':this[_0x5a96('0xc')]['extension'],'priority':this['channel']['priority'],'accountcode':this[_0x5a96('0xc')][_0x5a96('0x3b')],'dnid':this['channel'][_0x5a96('0x3c')],'projectName':this[_0x5a96('0xc')][_0x5a96('0x3d')],'saveName':_0x448dfe,'filename':_0x20f2c4[_0x5a96('0x3e')]||_0x448dfe,'savePath':_0x3e6af0})[_0x5a96('0x11')](function(_0x462160){_0x2901ce(null,_0x462160);})[_0x5a96('0x13')](function(_0x4635d7){_0x2901ce(_0x4635d7);});};AGIVertices[_0x5a96('0xe')]['createSquareMessage']=function(_0x4b52df,_0x10fd59,_0x30abdc,_0x1bc353,_0x135909){this[_0x5a96('0xd')][_0x5a96('0x3f')]({'uniqueid':this[_0x5a96('0xc')]['uniqueid'],'body':_0x4b52df,'direction':_0x10fd59,'providerName':_0x30abdc,'providerResponse':_0x1bc353})[_0x5a96('0x11')](function(_0x32c996){if(_0x135909){_0x135909(null,_0x32c996);}})[_0x5a96('0x13')](function(_0x5a8dd4){if(_0x135909){_0x135909(_0x5a8dd4);}});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x40')]=function(_0x539ea0,_0x1babbd){this[_0x5a96('0xd')][_0x5a96('0x40')]({'firstName':_[_0x5a96('0x41')](_0x539ea0['name'])||_[_0x5a96('0x42')](_0x539ea0[_0x5a96('0x12')])?_0x5a96('0x43')+Math[_0x5a96('0x44')]():_0x539ea0[_0x5a96('0x12')],'lastName':_['isEmpty'](_0x539ea0[_0x5a96('0x45')])||_[_0x5a96('0x42')](_0x539ea0[_0x5a96('0x45')])?null:_0x539ea0[_0x5a96('0x45')],'phone':_0x539ea0[_0x5a96('0x46')],'ListId':_0x539ea0['list_id'],'scheduledat':_0x539ea0['scheduledAt'],'callbackUniqueid':this[_0x5a96('0xc')]['uniqueid'],'tags':_0x5a96('0x47'),'description':_0x5a96('0x48')+_0x539ea0[_0x5a96('0x49')][_0x5a96('0x4a')](),'priority':_0x539ea0[_0x5a96('0x4b')]})[_0x5a96('0x11')](function(_0x3aaa24){_0x1babbd(null,_0x3aaa24);})[_0x5a96('0x13')](function(_0x1c02e5){_0x1babbd(_0x1c02e5);});};AGIVertices['prototype'][_0x5a96('0x4c')]=function(_0x2012b4,_0x1f18a9){this[_0x5a96('0xd')][_0x5a96('0x4d')](_0x2012b4)[_0x5a96('0x11')](function(_0x2f36c8){_0x1f18a9(null,_0x2f36c8?_0x2f36c8['name']:![]);})['catch'](function(_0x48552b){_0x1f18a9(_0x48552b);});};AGIVertices[_0x5a96('0xe')]['agentPause']=function(_0x42e678,_0x33a1ab,_0x384034){var _0x3629c7={'role':_0x5a96('0x4e')};_0x3629c7[_0x42e678]=this['channel'][_0x5a96('0x4f')];this['rpc'][_0x5a96('0x50')](_0x3629c7,_0x33a1ab,this[_0x5a96('0xc')][_0x5a96('0x35')])[_0x5a96('0x11')](function(_0x1c9d83){_0x384034(null,_['isNil'](_0x1c9d83)?![]:!![]);})['catch'](function(_0x7faad7){logger[_0x5a96('0x2a')](_0x7faad7);_0x384034(null,![]);});};AGIVertices['prototype'][_0x5a96('0x51')]=function(_0x315b5c,_0x165ca5){var _0x3b347a={'role':_0x5a96('0x4e')};_0x3b347a[_0x315b5c]=this['channel'][_0x5a96('0x4f')];this[_0x5a96('0xd')][_0x5a96('0x51')](_0x3b347a)[_0x5a96('0x11')](function(_0x561f92){_0x165ca5(null,_[_0x5a96('0x42')](_0x561f92)?![]:!![]);})[_0x5a96('0x13')](function(_0x4a399b){logger[_0x5a96('0x2a')](_0x4a399b);_0x165ca5(null,![]);});};AGIVertices[_0x5a96('0xe')]['agentLogout']=function(_0x51c986,_0x54976a){var _0x578b97={'role':'agent'};_0x578b97[_0x51c986]=this[_0x5a96('0xc')][_0x5a96('0x4f')];this[_0x5a96('0xd')][_0x5a96('0x52')](_0x578b97)[_0x5a96('0x11')](function(_0x4524ef){_0x54976a(null,_[_0x5a96('0x42')](_0x4524ef)?![]:!![]);})[_0x5a96('0x13')](function(_0x438951){logger[_0x5a96('0x2a')](_0x438951);_0x54976a(null,![]);});};AGIVertices[_0x5a96('0xe')]['agentLogin']=function(_0x3885a0,_0x3320d7){var _0x1a8bd4={'role':_0x5a96('0x4e')};_0x1a8bd4[_0x3885a0]=this[_0x5a96('0xc')][_0x5a96('0x4f')];var _0x3da80b=_0x3885a0!=_0x5a96('0x53')?util[_0x5a96('0x27')]('%s/%s@from-sip/n',_0x5a96('0x54'),this[_0x5a96('0xc')][_0x5a96('0x4f')]):undefined;this[_0x5a96('0xd')][_0x5a96('0x55')](_0x1a8bd4,_0x3da80b)['then'](function(_0x3b1b33){_0x3320d7(null,_[_0x5a96('0x42')](_0x3b1b33)?![]:!![]);})['catch'](function(_0x3cfb59){logger[_0x5a96('0x2a')](_0x3cfb59);_0x3320d7(null,![]);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x56')]=function(_0x204db3,_0x399784){sh[_0x5a96('0x57')](_['trim'](_0x204db3),function(_0x822c4f,_0x5e9f8c){var _0x436df5=_0x5e9f8c[_0x5a96('0x58')](/(\r\n|\n|\r)/gm,'');_0x399784(null,_0x436df5);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x59')]=function(_0x2b67fc,_0x492291){scripts[_0x5a96('0x59')](_0x2b67fc['apiKey'],_0x2b67fc[_0x5a96('0x5a')]||'text',_0x2b67fc[_0x5a96('0x5b')],_0x2b67fc[_0x5a96('0x5c')]||_0x5a96('0x5d'),_0x2b67fc['ssmlGender']||_0x5a96('0x5e'),_0x2b67fc[_0x5a96('0x5f')]||_0x5a96('0x60'))['then'](function(_0xb98026){_0x492291(null,_0xb98026);})[_0x5a96('0x13')](function(_0x162fa3){_0x492291(_0x162fa3);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x61')]=function(_0x716bb,_0x114744){scripts[_0x5a96('0x61')](_0x716bb[_0x5a96('0x5b')],_0x716bb[_0x5a96('0x62')]||'en',0x1)[_0x5a96('0x11')](function(_0x1a06a2){_0x114744(null,_0x1a06a2);})[_0x5a96('0x13')](function(_0x1cf2d3){_0x114744(_0x1cf2d3);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x63')]=function(_0x117356,_0x596dac){var _0x234f8a={'uri':_0x117356[_0x5a96('0x64')],'method':_0x117356[_0x5a96('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x117356[_0x5a96('0x66')])===_0x5a96('0x67')&&parseInt(_0x117356[_0x5a96('0x66')])>=0x1?parseInt(_0x117356[_0x5a96('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x5a96('0x68')]([_0x5a96('0x69'),_0x5a96('0x6a')],_0x234f8a[_0x5a96('0x65')][_0x5a96('0x6b')]())){try{_0x234f8a[_0x5a96('0x6c')]=_0x117356['rawBody']?JSON[_0x5a96('0x6d')](_0x117356['rawBody']):{};}catch(_0x126750){logger[_0x5a96('0x2a')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x126750);}}try{_0x234f8a['headers']=_0x117356['rawHeaders']?JSON[_0x5a96('0x6d')](_0x117356[_0x5a96('0x8')]):{};}catch(_0x2386ee){logger['error'](_0x5a96('0x6e'),_0x2386ee);}if(_0x117356[_0x5a96('0x6f')]){try{var _0x1f6860=require(_0x117356[_0x5a96('0x6f')])[_0x5a96('0x70')](this,_0x234f8a);_0x234f8a['uri']=Mustache['render'](_0x117356[_0x5a96('0x64')],_0x1f6860,{},['$$','$$']);if(_0x234f8a['headers']){_0x234f8a[_0x5a96('0x71')]=JSON['parse'](Mustache[_0x5a96('0x72')](JSON[_0x5a96('0x73')](_0x234f8a[_0x5a96('0x71')]),_0x1f6860,{},['$$','$$']));}if(_0x234f8a[_0x5a96('0x6c')]){_0x234f8a[_0x5a96('0x6c')]=JSON[_0x5a96('0x6d')](Mustache[_0x5a96('0x72')](JSON[_0x5a96('0x73')](_0x234f8a['body']),_0x1f6860,{},['$$','$$']));}}catch(_0x58f644){logger[_0x5a96('0x2a')](_0x5a96('0x74'),_0x58f644);}}rp(_0x234f8a)['then'](function(_0xb2866f){var _0x47f4b0={'statusCode':_0xb2866f[_0x5a96('0x75')]||0xc8,'statusMessage':_0xb2866f[_0x5a96('0x76')]||'OK','headers':_0xb2866f[_0x5a96('0x71')]||{},'body':_0xb2866f[_0x5a96('0x6c')]||{}};_0x596dac(null,_0x47f4b0);})[_0x5a96('0x13')](function(_0x2a9c04){var _0x4441a8={'statusCode':_0x2a9c04[_0x5a96('0x75')]||0x1f4,'statusMessage':_0x2a9c04[_0x5a96('0x77')]||_0x5a96('0x78'),'headers':_0x2a9c04[_0x5a96('0x79')][_0x5a96('0x71')]||{},'body':_0x2a9c04[_0x5a96('0x79')][_0x5a96('0x6c')]||{}};_0x596dac(null,_0x4441a8);});};AGIVertices[_0x5a96('0xe')]['googleDialogflow']=function(_0x1dff46,_0x45d9c4){scripts['googleDialogflow'](this[_0x5a96('0xc')][_0x5a96('0x35')],_0x1dff46['key'],_0x1dff46['text'],_0x1dff46[_0x5a96('0x7a')]||'en')['then'](function(_0x5d6922){_0x45d9c4(null,_0x5d6922);})[_0x5a96('0x13')](function(_0x377716){_0x45d9c4(_0x377716);});};AGIVertices['prototype'][_0x5a96('0x7b')]=function(_0x1c52f0,_0x4ab07b){scripts[_0x5a96('0x7b')](this[_0x5a96('0xc')][_0x5a96('0x35')],_0x1c52f0[_0x5a96('0x7c')],_0x1c52f0[_0x5a96('0x7d')],_0x1c52f0[_0x5a96('0x7e')],_0x1c52f0['text'],_0x1c52f0[_0x5a96('0x7f')]||'en')[_0x5a96('0x11')](function(_0x107186){_0x4ab07b(null,_0x107186);})['catch'](function(_0x31f478){_0x4ab07b(_0x31f478);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x80')]=function(_0xba9ecc,_0x4223cd){scripts[_0x5a96('0x80')](this[_0x5a96('0xc')],_0xba9ecc)[_0x5a96('0x11')](function(_0x40c58d){_0x4223cd(null,_0x40c58d);})['catch'](function(_0x2c34d0){_0x4223cd(_0x2c34d0);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x81')]=function(_0x240f52,_0x316eee){scripts[_0x5a96('0x81')](_0x240f52[_0x5a96('0x82')],_0x240f52[_0x5a96('0x5b')],_0x240f52['ispeech_tts_language']||_0x5a96('0x5d'),_0x240f52[_0x5a96('0x83')])[_0x5a96('0x11')](function(_0x289e89){_0x316eee(null,_0x289e89);})[_0x5a96('0x13')](function(_0x1aac94){_0x316eee(_0x1aac94);});};AGIVertices[_0x5a96('0xe')]['ispeechASR']=function(_0x3f1507,_0x185dd5,_0x18389e){scripts[_0x5a96('0x84')](_0x185dd5,_0x3f1507[_0x5a96('0x82')],_0x3f1507[_0x5a96('0x85')]||_0x5a96('0x5d'),this[_0x5a96('0x86')](_0x3f1507[_0x5a96('0x87')])?_0x3f1507['model']:undefined)[_0x5a96('0x11')](function(_0x2e5509){_0x18389e(null,_0x2e5509);})[_0x5a96('0x13')](function(_0x19877b){_0x18389e(_0x19877b);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x88')]=function(_0x1a2629,_0x54e517){scripts[_0x5a96('0x88')](_0x1a2629[_0x5a96('0x89')],_0x1a2629['aws_secret_access_key'],_0x1a2629[_0x5a96('0x8a')],_0x1a2629[_0x5a96('0x8b')]||_0x5a96('0x8c'),_0x1a2629[_0x5a96('0x5b')],_0x1a2629[_0x5a96('0x8d')]||_0x5a96('0x5b'))['then'](function(_0x3e05df){_0x54e517(null,_0x3e05df);})[_0x5a96('0x13')](function(_0x86c10f){_0x54e517(_0x86c10f);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x8e')]=function(_0x792b77,_0x549ee9){scripts[_0x5a96('0x8e')](this[_0x5a96('0xc')][_0x5a96('0x35')],_0x792b77[_0x5a96('0x89')],_0x792b77['aws_secret_access_key'],_0x792b77[_0x5a96('0x8f')],_0x792b77[_0x5a96('0x5b')],_0x792b77[_0x5a96('0x90')])['then'](function(_0x589b1b){_0x549ee9(null,_0x589b1b);})[_0x5a96('0x13')](function(_0x2e396a){_0x549ee9(_0x2e396a);});};AGIVertices['prototype'][_0x5a96('0x91')]=function(_0x4b2223,_0x5095c5,_0x464ccd){scripts[_0x5a96('0x91')](_0x5095c5,_0x4b2223[_0x5a96('0x82')],_0x4b2223[_0x5a96('0x92')]||'en-US')[_0x5a96('0x11')](function(_0x425d9c){_0x464ccd(null,_0x425d9c);})[_0x5a96('0x13')](function(_0x1b4324){_0x464ccd(_0x1b4324);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x93')]=function(_0x4e787a,_0x3fea9d,_0x4c5153){scripts[_0x5a96('0x93')](_0x3fea9d,_0x4e787a['appid'],_0x4e787a[_0x5a96('0x94')],_0x4e787a['uri'])[_0x5a96('0x11')](function(_0x3819df){_0x4c5153(null,_0x3819df);})[_0x5a96('0x13')](function(_0x29e60c){_0x4c5153(_0x29e60c);});};AGIVertices[_0x5a96('0xe')][_0x5a96('0x95')]=function(_0x1b1e29){var _0x24a845=_[_0x5a96('0x68')](verticesWithRetry,_0x1b1e29[_0x5a96('0x37')])?_0x1b1e29:_[_0x5a96('0x96')](_0x1b1e29);for(var _0x5165c7 in _0x24a845){if(_0x24a845[_0x5a96('0x97')](_0x5165c7)){if(_0x24a845[_0x5165c7]&&_['isString'](_0x24a845[_0x5165c7])){if(_[_0x5a96('0x68')](recursiveMapAttributes,_0x5165c7)){_0x24a845[_0x5165c7]=this[_0x5a96('0x98')](_0x24a845[_0x5165c7]);}else{_0x24a845[_0x5165c7]=this[_0x5a96('0x99')](_0x24a845[_0x5165c7]);}}}}return _0x24a845;};AGIVertices[_0x5a96('0xe')][_0x5a96('0x9a')]=function(_0x5918cb){for(var _0x383861 in _0x5918cb){if(_0x5918cb['hasOwnProperty'](_0x383861)){if(_[_0x5a96('0x9b')](_0x5918cb[_0x383861])){this[_0x5a96('0x9a')](_0x5918cb[_0x383861]);}else if(_[_0x5a96('0x9c')](_0x5918cb[_0x383861])){for(var _0x546cc3=0x0;_0x546cc3<_0x5918cb[_0x383861]['length'];_0x546cc3++){this[_0x5a96('0x9a')](_0x5918cb[_0x383861][_0x546cc3]);}}else if(_['isString'](_0x5918cb[_0x383861])){_0x5918cb[_0x383861]=this[_0x5a96('0x99')](_0x5918cb[_0x383861]);}}}};AGIVertices[_0x5a96('0xe')]['saveRestApiResult']=function(_0x3f553a,_0x425e4b){for(var _0x1301f4 in _0x3f553a){if(_0x3f553a[_0x5a96('0x97')](_0x1301f4)){if(_['isPlainObject'](_0x3f553a[_0x1301f4])){if(!_['isEmpty'](_0x3f553a[_0x1301f4])){this['saveRestApiResult'](_0x3f553a[_0x1301f4],util[_0x5a96('0x27')](_0x5a96('0x9d'),_0x425e4b,_0x1301f4));}}else if(_[_0x5a96('0x9c')](_0x3f553a[_0x1301f4])){for(var _0x3c2cbc=0x0;_0x3c2cbc<_0x3f553a[_0x1301f4][_0x5a96('0x9e')];_0x3c2cbc++){this[_0x5a96('0x9f')](_0x3f553a[_0x1301f4][_0x3c2cbc],util[_0x5a96('0x27')]('%s.%s',_0x425e4b,_0x1301f4+'['+_0x3c2cbc+']'));}}else{if(!_[_0x5a96('0x42')](_0x3f553a[_0x1301f4])){this[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0x9d'),_0x425e4b,_0x1301f4),_0x3f553a[_0x1301f4]);}}}}};AGIVertices[_0x5a96('0xe')][_0x5a96('0x98')]=function(_0x535e7e){try{var _0x290a17=JSON['parse'](_0x535e7e);this[_0x5a96('0x9a')](_0x290a17);return JSON['stringify'](_0x290a17);}catch(_0x2b959c){return this[_0x5a96('0x99')](_0x535e7e);}};AGIVertices[_0x5a96('0xe')][_0x5a96('0x99')]=function(_0x36695c){var _0x14f726=_0x36695c[_0x5a96('0xa1')]('{');for(var _0x4e62ad=0x1;_0x4e62ad<_0x14f726[_0x5a96('0x9e')];_0x4e62ad+=0x1){var _0x4ba5cf=_0x14f726[_0x4e62ad][_0x5a96('0xa1')]('}');if(_0x4ba5cf[_0x5a96('0x9e')]>0x1){_0x36695c=_0x36695c[_0x5a96('0xa2')]('{'+_0x4ba5cf[0x0]+'}',this[_0x5a96('0xc')][_0x5a96('0xf')](_0x4ba5cf[0x0])['extra']||_0x4ba5cf[0x0]);}}if(_0x14f726[_0x5a96('0x9e')]===0x1){return _0x36695c[_0x5a96('0x4a')]();}return this[_0x5a96('0x99')](_0x36695c);};AGIVertices[_0x5a96('0xe')][_0x5a96('0xa3')]=function(_0x509f59,_0x2161a5){var _0x2a08ad=this[_0x5a96('0xc')][_0x5a96('0xf')](_0x509f59);if(_0x2a08ad[_0x5a96('0xa4')]===-0x1){return _0x2a08ad;}logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0xa5'),_0x2161a5,_0x2a08ad[_0x5a96('0xa6')]));return this[_0x5a96('0xc')][_0x5a96('0xa0')](_0x2161a5,_0x2a08ad[_0x5a96('0xa6')]);};AGIVertices['prototype'][_0x5a96('0x86')]=function(_0x22f2fe){return _0x22f2fe&&_0x22f2fe!=='0'&&_0x22f2fe!=='-1'&&_0x22f2fe!=='';};AGIVertices[_0x5a96('0xe')]['maxRetry']=function(_0x232f3b){this['createSquareDetailsReport'][_0x5a96('0x70')](this,_0x232f3b,'-');_0x232f3b['retry']=_0x232f3b[_0x5a96('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5a96('0xe')][_0x5a96('0xa8')]=function(_0x176b92){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0xa9'),_0x176b92[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x176b92[_0x5a96('0x5b')])){return this[_0x5a96('0xc')]['noop']('no\x20text\x20configured');}var _0x1f554d='\x22'+_0x176b92[_0x5a96('0x5b')]+'\x22';if(this['isConfigured'](_0x176b92['options'])){_0x1f554d+=','+_0x176b92[_0x5a96('0x79')];}var _0x30fbf0=this[_0x5a96('0xc')][_0x5a96('0x57')]('MRCPSynth',_0x1f554d);if(_0x30fbf0[_0x5a96('0xa4')]===-0x1){return _0x30fbf0;}return this['channel'][_0x5a96('0xaa')](util['format'](_0x5a96('0xab'),_0x1f554d));};AGIVertices['prototype'][_0x5a96('0xac')]=function(_0x324de6){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x324de6[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x324de6[_0x5a96('0xad')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xae'));}var _0x101930=_0x324de6[_0x5a96('0xad')];if(this[_0x5a96('0x86')](_0x324de6[_0x5a96('0x79')])){_0x101930+=','+_0x324de6[_0x5a96('0x79')];}var _0x57edda=this[_0x5a96('0xc')][_0x5a96('0x57')](_0x5a96('0xaf'),_0x101930);if(_0x57edda[_0x5a96('0xa4')]===-0x1){return _0x57edda;}var _0x25c41f=this[_0x5a96('0xa3')]('RECOG_CONFIDENCE()',_0x5a96('0xb0'));if(_0x25c41f[_0x5a96('0xa4')]===-0x1){return _0x25c41f;}var _0x26ad7b=this[_0x5a96('0xa3')](_0x5a96('0xb1'),_0x5a96('0xb2'));if(_0x26ad7b[_0x5a96('0xa4')]===-0x1){return _0x26ad7b;}var _0x430b0d=this[_0x5a96('0xa3')](_0x5a96('0xb3'),_0x5a96('0xb4'));if(_0x430b0d[_0x5a96('0xa4')]===-0x1){return _0x430b0d;}return this['channel'][_0x5a96('0xaa')](util[_0x5a96('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x101930));};AGIVertices[_0x5a96('0xe')][_0x5a96('0xb5')]=function(_0x5b99fe){logger['info'](util[_0x5a96('0x27')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x5b99fe[_0x5a96('0x36')]));return this['channel'][_0x5a96('0xb5')]([_0x5b99fe[_0x5a96('0xb6')],_0x5b99fe[_0x5a96('0xb7')]]);};AGIVertices[_0x5a96('0xe')]['answer']=function(_0x2be2b8){logger['info'](util[_0x5a96('0x27')](_0x5a96('0xb8'),_0x2be2b8[_0x5a96('0x36')]));if(this[_0x5a96('0x86')](_0x2be2b8[_0x5a96('0x66')])){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0xb9'),_0x2be2b8[_0x5a96('0x66')]));var _0x58e333=this[_0x5a96('0xc')][_0x5a96('0xba')](_0x2be2b8[_0x5a96('0x66')]);if(_0x58e333[_0x5a96('0xa4')]===-0x1){return _0x58e333;}}return this[_0x5a96('0xc')][_0x5a96('0xbb')]();};AGIVertices['prototype'][_0x5a96('0x47')]=function(_0x3b46a6){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0xbc'),_0x3b46a6[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x3b46a6[_0x5a96('0xbd')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x3b46a6,_0x5a96('0xbe'));}_0x3b46a6[_0x5a96('0x49')]=moment();if(this[_0x5a96('0x86')](_0x3b46a6[_0x5a96('0xbf')])){_0x3b46a6[_0x5a96('0x49')]=moment()['add'](_0x3b46a6['delay'],_0x5a96('0xc0'));}if(!this[_0x5a96('0x86')](_0x3b46a6[_0x5a96('0x4b')])){_0x3b46a6[_0x5a96('0x4b')]=0x2;}this[_0x5a96('0x40')]['sync'](this,_0x3b46a6);return this['channel'][_0x5a96('0xaa')](util['format'](_0x5a96('0xc1'),_0x3b46a6['phone'],_0x3b46a6[_0x5a96('0xbd')],_0x3b46a6['scheduledAt']));};AGIVertices[_0x5a96('0xe')]['custom_app']=function(_0x417da6){logger[_0x5a96('0x2c')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x417da6[_0x5a96('0x36')]));var _0x2607da=this[_0x5a96('0xc')][_0x5a96('0x57')](_0x417da6['application'],_0x417da6[_0x5a96('0x79')]);if(_0x2607da[_0x5a96('0xa4')]===-0x1){return _0x2607da;}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')]('Executed\x20command\x20%s\x20%s',_0x417da6[_0x5a96('0xc2')],_0x417da6[_0x5a96('0x79')]));};AGIVertices[_0x5a96('0xe')][_0x5a96('0xc3')]=function(_0x5e5be1){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0xc4'),_0x5e5be1[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x5e5be1[_0x5a96('0x5b')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xc5'));}var _0x58002c='\x22'+_0x5e5be1[_0x5a96('0x5b')]+'\x22';if(this[_0x5a96('0x86')](_0x5e5be1[_0x5a96('0x79')])){_0x58002c+=','+_0x5e5be1[_0x5a96('0x79')];}var _0x3965be=this[_0x5a96('0xc')][_0x5a96('0x57')](_0x5a96('0xc6'),_0x58002c);if(_0x3965be[_0x5a96('0xa4')]===-0x1){return _0x3965be;}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x58002c));};AGIVertices[_0x5a96('0xe')][_0x5a96('0xc7')]=function(_0x9c0950){logger['info'](util[_0x5a96('0x27')](_0x5a96('0xc8'),_0x9c0950[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x9c0950[_0x5a96('0x5b')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xc5'));}var _0x402adb='\x22'+_0x9c0950[_0x5a96('0x5b')]+'\x22';if(this[_0x5a96('0x86')](_0x9c0950[_0x5a96('0x79')])){_0x402adb+=','+_0x9c0950[_0x5a96('0x79')];}var _0x48d115=this[_0x5a96('0xc')][_0x5a96('0x57')]('MRCPSynth',_0x402adb);if(_0x48d115[_0x5a96('0xa4')]===-0x1){return _0x48d115;}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0xab'),_0x402adb));};AGIVertices[_0x5a96('0xe')][_0x5a96('0xc9')]=function(_0x36ff3e){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0xca'),_0x36ff3e[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x36ff3e[_0x5a96('0xad')])){return this['channel'][_0x5a96('0xaa')](_0x5a96('0xae'));}var _0x461767=_0x36ff3e[_0x5a96('0xad')];if(this[_0x5a96('0x86')](_0x36ff3e[_0x5a96('0x79')])){_0x461767+=','+_0x36ff3e[_0x5a96('0x79')];}var _0x53fafb=this['channel'][_0x5a96('0x57')]('MRCPRecog',_0x461767);if(_0x53fafb[_0x5a96('0xa4')]===-0x1){return _0x53fafb;}var _0x22aec9=this[_0x5a96('0xa3')](_0x5a96('0xcb'),_0x5a96('0xcc'));if(_0x22aec9['result']===-0x1){return _0x22aec9;}var _0x3f0fa2=this[_0x5a96('0xa3')](_0x5a96('0xb1'),_0x5a96('0xcd'));if(_0x3f0fa2['result']===-0x1){return _0x3f0fa2;}var _0x153d5e=this[_0x5a96('0xa3')]('RECOG_INSTANCE()',_0x5a96('0xce'));if(_0x153d5e[_0x5a96('0xa4')]===-0x1){return _0x153d5e;}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0xcf'),_0x461767));};AGIVertices[_0x5a96('0xe')]['sestekasr']=function(_0x16f18e){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x16f18e[_0x5a96('0x36')]));if(!this['isConfigured'](_0x16f18e[_0x5a96('0xad')])){return this[_0x5a96('0xc')]['noop'](_0x5a96('0xae'));}var _0x17b135=_0x16f18e['grammar'];if(this[_0x5a96('0x86')](_0x16f18e[_0x5a96('0x79')])){_0x17b135+=','+_0x16f18e[_0x5a96('0x79')];}var _0x257072=this[_0x5a96('0xc')][_0x5a96('0x57')](_0x5a96('0xaf'),_0x17b135);if(_0x257072[_0x5a96('0xa4')]===-0x1){return _0x257072;}var _0x168593=this[_0x5a96('0xa3')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x168593['result']===-0x1){return _0x168593;}var _0x18d4af=this['getAndSetVariable'](_0x5a96('0xb1'),_0x5a96('0xd0'));if(_0x18d4af[_0x5a96('0xa4')]===-0x1){return _0x18d4af;}var _0x3eb776=this[_0x5a96('0xa3')](_0x5a96('0xb3'),_0x5a96('0xd1'));if(_0x3eb776[_0x5a96('0xa4')]===-0x1){return _0x3eb776;}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0xcf'),_0x17b135));};AGIVertices[_0x5a96('0xe')][_0x5a96('0xd2')]=function(_0x34bf9e){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0xd3'),_0x34bf9e[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x34bf9e[_0x5a96('0xd4')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x34bf9e,_0x5a96('0xd5'));}var _0x2067e1=this[_0x5a96('0xd6')]['sync'](this,_0x34bf9e['odbc_id']);if(!_0x2067e1){return this['channel']['error'](_0x34bf9e,_0x5a96('0xd7'));}if(!this[_0x5a96('0x86')](_0x34bf9e[_0x5a96('0x2e')])){return this[_0x5a96('0xc')]['error'](_0x34bf9e,_0x5a96('0xd8'));}var _0x1c037e=_0x34bf9e[_0x5a96('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x5a96('0xc')]['noop'](util['format'](_0x5a96('0xd9'),_0x1c037e));var _0x559be7=this[_0x5a96('0x29')][_0x5a96('0x70')](this,_0x2067e1,_0x1c037e);this[_0x5a96('0xda')][_0x5a96('0x70')](this,_0x34bf9e,_0x1c037e);if(!this[_0x5a96('0x86')](_0x34bf9e['variable_id'])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xdb'));}var _0x53cc65=this[_0x5a96('0xf')][_0x5a96('0x70')](this,_0x34bf9e[_0x5a96('0xdc')]);if(!_0x53cc65){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x34bf9e,'no\x20variable\x20found');}var _0x36e3ee=this;_0x559be7['forEach'](function(_0x2fa3c7,_0x357fd5){Object[_0x5a96('0xdd')](_0x2fa3c7)[_0x5a96('0xde')](function(_0x41e035){_0x36e3ee[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0xdf'),_0x53cc65,_0x357fd5,_0x41e035),_0x2fa3c7[_0x41e035]);});});this[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0xe0'),_0x53cc65),_0x559be7[_0x5a96('0x9e')]);return this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')](_0x5a96('0xe1'),_0x53cc65));};AGIVertices[_0x5a96('0xe')][_0x5a96('0xe2')]=function(_0x557beb){logger[_0x5a96('0xe3')](util[_0x5a96('0x27')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x557beb[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x557beb['sip_id'])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x557beb,_0x5a96('0xe4'));}var _0x868d19=this['getUser'][_0x5a96('0x70')](this,_0x557beb['sip_id']);if(!_0x868d19){return this[_0x5a96('0xc')]['error'](_0x557beb,_0x5a96('0xe5'));}var _0x525762=this['channel']['exec'](_0x5a96('0xe6'),[util[_0x5a96('0x27')](_0x5a96('0xe7'),_0x868d19),_0x557beb[_0x5a96('0x66')],_0x557beb['opts'],_0x557beb[_0x5a96('0x64')]]);if(_0x525762[_0x5a96('0xa4')]===-0x1){return _0x525762;}return this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')](_0x5a96('0xe8'),_0x5a96('0xe6')));};AGIVertices[_0x5a96('0xe')]['dialogflow']=function(_0x52e9d3){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x52e9d3[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x52e9d3['key'])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xe9'));}if(!this[_0x5a96('0x86')](_0x52e9d3['text'])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xc5'));}this[_0x5a96('0xc')][_0x5a96('0xea')]=!![];this[_0x5a96('0xda')](_0x52e9d3);this[_0x5a96('0x3f')](_0x52e9d3[_0x5a96('0x5b')],'in','','');this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0xeb'),_0x52e9d3['text']));var _0x1d2eba=this[_0x5a96('0xec')][_0x5a96('0x70')](this,_0x52e9d3);if(_0x1d2eba){for(var _0x59e96e in _0x1d2eba){if(_0x1d2eba['hasOwnProperty'](_0x59e96e)){this[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0xed'),_0x59e96e[_0x5a96('0x6b')]()),_0x1d2eba[_0x59e96e]);}}this[_0x5a96('0x3f')](_0x1d2eba[_0x5a96('0xee')],_0x5a96('0xef'),_0x5a96('0xf0'),'');return this[_0x5a96('0xc')][_0x5a96('0xaa')](util['format'](_0x5a96('0xf1'),_0x1d2eba[_0x5a96('0xee')]));}return this[_0x5a96('0xc')]['error'](_0x52e9d3,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x5a96('0xe')]['dialogflowV2']=function(_0x3f6b76){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0xf2'),_0x3f6b76[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x3f6b76['dialogflowV2_project_id'])){return this['channel'][_0x5a96('0xaa')](_0x5a96('0xf3'));}if(!this[_0x5a96('0x86')](_0x3f6b76[_0x5a96('0x7d')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')]('no\x20client_email\x20configured');}if(!this[_0x5a96('0x86')](_0x3f6b76[_0x5a96('0x7e')])){return this['channel']['noop'](_0x5a96('0xf4'));}if(!this[_0x5a96('0x86')](_0x3f6b76[_0x5a96('0x7f')])){return this['channel'][_0x5a96('0xaa')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x3f6b76[_0x5a96('0x5b')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xc5'));}this[_0x5a96('0xc')][_0x5a96('0xea')]=!![];this['createSquareDetailsReport'](_0x3f6b76);this[_0x5a96('0x3f')](_0x3f6b76['text'],'in','','');this['channel']['noop'](util[_0x5a96('0x27')](_0x5a96('0xf5'),_0x3f6b76[_0x5a96('0x5b')]));var _0x396920=this[_0x5a96('0x7b')]['sync'](this,_0x3f6b76);if(_0x396920){for(var _0x727f5a in _0x396920){if(_0x396920[_0x5a96('0x97')](_0x727f5a)){if(_0x727f5a!==_0x5a96('0xf6')){this[_0x5a96('0xc')][_0x5a96('0xa0')](util['format'](_0x5a96('0xed'),_0x727f5a[_0x5a96('0x6b')]()),_0x396920[_0x727f5a]);}}}this[_0x5a96('0x3f')](_0x396920[_0x5a96('0xee')],'out',_0x5a96('0xf7'),_0x396920[_0x5a96('0xf6')]);return this[_0x5a96('0xc')][_0x5a96('0xaa')](util['format'](_0x5a96('0xf8'),_0x396920[_0x5a96('0xee')]));}return this[_0x5a96('0xc')]['error'](_0x3f6b76,_0x5a96('0xf9'));};AGIVertices[_0x5a96('0xe')][_0x5a96('0xfa')]=function(_0x4b8d5d){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0xfb'),_0x4b8d5d[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x4b8d5d[_0x5a96('0xfc')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xfd'));}if(!this[_0x5a96('0x86')](_0x4b8d5d[_0x5a96('0xfe')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')]('no\x20username\x20configured');}if(!this[_0x5a96('0x86')](_0x4b8d5d[_0x5a96('0xff')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x100'));}if(!this[_0x5a96('0x86')](_0x4b8d5d[_0x5a96('0x101')])){return this[_0x5a96('0xc')]['noop'](_0x5a96('0xc5'));}this[_0x5a96('0xc')][_0x5a96('0xea')]=!![];this[_0x5a96('0xda')](_0x4b8d5d);this[_0x5a96('0x3f')](_0x4b8d5d['text'],'in','','');this['channel']['noop'](util[_0x5a96('0x27')](_0x5a96('0x102'),_0x4b8d5d[_0x5a96('0x5b')]));var _0x19755c=this[_0x5a96('0x80')]['sync'](this,_0x4b8d5d);if(_0x19755c){for(var _0x33d8a4 in _0x19755c){if(_0x19755c[_0x5a96('0x97')](_0x33d8a4)){this[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0x103'),_0x33d8a4[_0x5a96('0x6b')]()),_0x19755c[_0x33d8a4]);}}this['createSquareMessage'](_0x19755c[_0x5a96('0xee')],'out',_0x5a96('0xfa'),'');if(_0x19755c[_0x5a96('0x104')]){this[_0x5a96('0xc')][_0x5a96('0xaa')](util['format'](_0x5a96('0x105'),_0x19755c[_0x5a96('0x104')]));var _0x9c102a=this['channel'][_0x5a96('0x106')](_0x19755c[_0x5a96('0x104')]);try{fs['unlink'](_0x19755c[_0x5a96('0x104')]+_0x5a96('0x107'));}catch(_0x1840eb){logger['error'](_0x1840eb);}return _0x9c102a;}else{return this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')](_0x5a96('0x108'),_0x19755c[_0x5a96('0xee')]));}}return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x4b8d5d,_0x5a96('0x109'));};AGIVertices[_0x5a96('0xe')][_0x5a96('0x10a')]=function(_0xd8ad2f){logger[_0x5a96('0x2c')](util['format'](_0x5a96('0x10b'),_0xd8ad2f[_0x5a96('0x36')]));return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x10a'));};AGIVertices[_0x5a96('0xe')][_0x5a96('0x10c')]=function(_0x3f567a){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x3f567a['label']));var _0x52c1a6='';if(_0x3f567a[_0x5a96('0x10d')]){if(!this[_0x5a96('0x86')](_0x3f567a[_0x5a96('0x10d')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x3f567a,_0x5a96('0x10e'));}else{var _0x9a5765=parseInt(_0x3f567a[_0x5a96('0x10d')],0xa);if(isNaN(_0x9a5765)){_0x52c1a6=_0x3f567a[_0x5a96('0x10d')];}else{_0x52c1a6=this[_0x5a96('0x1b')]['sync'](this,_0x3f567a[_0x5a96('0x10d')]);if(!_0x52c1a6){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x3f567a,_0x5a96('0x10f'));}}}}else if(_0x3f567a[_0x5a96('0x110')]){_0x52c1a6=_0x3f567a[_0x5a96('0x110')];}else{return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x3f567a,_0x5a96('0x10e'));}var _0x377571=this[_0x5a96('0xc')][_0x5a96('0x57')](_0x5a96('0xe6'),[util[_0x5a96('0x27')](_0x5a96('0x111'),_0x52c1a6,_0x3f567a[_0x5a96('0x46')]),_0x3f567a[_0x5a96('0x66')],_0x3f567a[_0x5a96('0x112')],_0x3f567a[_0x5a96('0x64')]]);if(_0x377571[_0x5a96('0xa4')]===-0x1){return _0x377571;}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0xe8'),_0x5a96('0xe6')));};AGIVertices['prototype'][_0x5a96('0x113')]=function(_0x5ab560){logger[_0x5a96('0x2c')](util['format'](_0x5a96('0x114'),_0x5ab560[_0x5a96('0x36')]));return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x113'));};AGIVertices[_0x5a96('0xe')][_0x5a96('0xa')]=function(_0x4b0b63){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4b0b63[_0x5a96('0x36')]));if(_0x4b0b63['retry']===0x0){return this[_0x5a96('0xa7')](_0x4b0b63);}_0x4b0b63[_0x5a96('0x115')]-=0x1;if(!this[_0x5a96('0x86')](_0x4b0b63[_0x5a96('0x116')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x4b0b63,_0x5a96('0x117'));}var _0x3a9601=this[_0x5a96('0x1d')][_0x5a96('0x70')](this,_0x4b0b63[_0x5a96('0x116')]);if(!_0x3a9601){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x4b0b63,'no\x20file\x20audio\x20found');}if(!this[_0x5a96('0x86')](_0x4b0b63[_0x5a96('0xdc')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x5a96('0xdb'));}var _0x3ca014=this[_0x5a96('0xc')][_0x5a96('0x118')](_0x3a9601,_0x4b0b63[_0x5a96('0x119')],_0x4b0b63[_0x5a96('0x11a')]);var _0x3919f6=_0x3ca014[_0x5a96('0xa4')]?_0x3ca014[_0x5a96('0xa4')]['toString']():'';logger[_0x5a96('0x2c')]('test',JSON[_0x5a96('0x73')](_0x3ca014));if(_0x3ca014[_0x5a96('0xa4')]===-0x1){this['createSquareDetailsReport'][_0x5a96('0x70')](this,_0x4b0b63,_0x3919f6);return _0x3ca014;}else if(_0x3ca014[_0x5a96('0xa6')]===_0x5a96('0x66')){_0x3ca014[_0x5a96('0xa4')]=_0x3919f6[_0x5a96('0x9e')]>=parseInt(_0x4b0b63[_0x5a96('0x11b')])?'x':'i';}else{_0x3ca014[_0x5a96('0xa4')]=_0x3919f6[_0x5a96('0x9e')]>=parseInt(_0x4b0b63[_0x5a96('0x11b')])&&_0x3919f6['length']<=parseInt(_0x4b0b63[_0x5a96('0x11a')])?'x':'i';}var _0x4082ff=this[_0x5a96('0xf')][_0x5a96('0x70')](this,_0x4b0b63[_0x5a96('0xdc')]);if(!_0x4082ff){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x4b0b63,_0x5a96('0x11c'));}this['channel']['setVariable'](_0x4082ff,_0x3919f6);if(this[_0x5a96('0x86')](_0x4b0b63[_0x5a96('0x11d')])){var _0x86ab0f=parseInt(_0x4b0b63[_0x5a96('0x11d')],0xa);var _0x3a0946=rs[_0x5a96('0x11e')]({'charset':'*','length':_0x86ab0f});var _0x489d97=_0x3919f6[_0x5a96('0x9e')];if(_0x489d97>0x0){if(_0x489d97>_0x86ab0f){this[_0x5a96('0xda')][_0x5a96('0x70')](this,_0x4b0b63,_0x4b0b63[_0x5a96('0x11f')]===_0x5a96('0x120')?_0x3a0946+_0x3919f6[_0x5a96('0x121')](_0x86ab0f):_0x3919f6[_0x5a96('0x121')](0x0,_0x489d97-_0x86ab0f)+_0x3a0946);}else{this['createSquareDetailsReport']['sync'](this,_0x4b0b63,rs['generate']({'charset':'*','length':_0x489d97}));}}else{this[_0x5a96('0xda')][_0x5a96('0x70')](this,_0x4b0b63,'');}}else{this[_0x5a96('0xda')]['sync'](this,_0x4b0b63,_0x3919f6);}return _0x3ca014;};AGIVertices[_0x5a96('0xe')][_0x5a96('0xb')]=function(_0x36b58c){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x122'),_0x36b58c[_0x5a96('0x36')]));return this[_0x5a96('0xa')](_0x36b58c);};AGIVertices[_0x5a96('0xe')][_0x5a96('0x123')]=function(_0x4b2997){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x124'),_0x4b2997['label']));this[_0x5a96('0xda')]['sync'](this,_0x4b2997,_0x4b2997[_0x5a96('0x125')]);return this['channel'][_0x5a96('0xaa')](util['format'](_0x5a96('0x126'),_0x4b2997[_0x5a96('0x125')]));};AGIVertices[_0x5a96('0xe')][_0x5a96('0x127')]=function(_0x4b0579){logger[_0x5a96('0x2c')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4b0579[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x4b0579['aws_access_key_id'])||!this[_0x5a96('0x86')](_0x4b0579[_0x5a96('0x128')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x129'));}if(!this[_0x5a96('0x86')](_0x4b0579['text'])){return this['channel']['noop'](_0x5a96('0xc5'));}this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x12a'),_0x4b0579[_0x5a96('0x5b')]));var _0x4f3745=this['awsPolly'][_0x5a96('0x70')](this,_0x4b0579);if(_0x4f3745){this['channel'][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x12b'),_0x4f3745));var _0x15aa44=this[_0x5a96('0xc')][_0x5a96('0x106')](_0x4f3745);try{fs['unlink'](_0x4f3745+_0x5a96('0x107'));}catch(_0x3612f3){logger[_0x5a96('0x2a')](_0x3612f3);}return _0x15aa44;}return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x4b0579,_0x5a96('0x12c'));};AGIVertices['prototype'][_0x5a96('0x12d')]=function(_0x18f54e){logger['info'](util[_0x5a96('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x18f54e['label']));if(!this[_0x5a96('0x86')](_0x18f54e[_0x5a96('0x89')])||!this['isConfigured'](_0x18f54e[_0x5a96('0x128')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x129'));}if(!this['isConfigured'](_0x18f54e[_0x5a96('0x90')])){return this['channel'][_0x5a96('0xaa')](_0x5a96('0x12e'));}if(!this['isConfigured'](_0x18f54e[_0x5a96('0x5b')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xc5'));}this[_0x5a96('0xc')]['bot']=!![];this[_0x5a96('0xda')](_0x18f54e);this[_0x5a96('0x3f')](_0x18f54e[_0x5a96('0x5b')],'in','','');this['channel']['noop'](util['format'](_0x5a96('0x12f'),_0x18f54e[_0x5a96('0x5b')]));var _0x55e71b=this['awsLex'][_0x5a96('0x70')](this,_0x18f54e);if(_0x55e71b){for(var _0x3238b7 in _0x55e71b){if(_0x55e71b[_0x5a96('0x97')](_0x3238b7)&&_[_0x5a96('0x130')](_0x55e71b[_0x3238b7])){this[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0x131'),_0x3238b7['toUpperCase']()),_0x55e71b[_0x3238b7]);}}if(_[_0x5a96('0x42')](_0x55e71b[_0x5a96('0x77')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x55e71b[_0x5a96('0x77')],_0x5a96('0xef'),_0x5a96('0x132'),'');return this[_0x5a96('0xc')][_0x5a96('0xaa')](util['format'](_0x5a96('0x133'),_0x55e71b['message']));}}return this['channel'][_0x5a96('0x2a')](_0x18f54e,_0x5a96('0x134'));};AGIVertices[_0x5a96('0xe')]['googleasr']=function(_0x6911be){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x135'),_0x6911be[_0x5a96('0x36')],_0x6911be['timeout']));if(!this['isConfigured'](_0x6911be[_0x5a96('0x82')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xe9'));}var _0x136ca9='wav';var _0xc3d02e=util[_0x5a96('0x27')](_0x5a96('0x136'),FILES_PATH,rs[_0x5a96('0x11e')](0x4));var _0x34d253=util[_0x5a96('0x27')](_0x5a96('0x9d'),_0xc3d02e,_0x136ca9);var _0x2c97af=!![];if(_0x6911be[_0x5a96('0x137')]===_0x5a96('0x138')){_0x2c97af=![];}var _0x2e6bae=this['channel']['recordFile'](_0xc3d02e,_0x136ca9,_0x6911be[_0x5a96('0x139')],_0x6911be['timeout'],undefined,_0x2c97af);if(_0x2e6bae[_0x5a96('0xa4')]!==-0x1){this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')](_0x5a96('0x13a'),_0x34d253));var _0x25cadf=this[_0x5a96('0x91')][_0x5a96('0x70')](this,_0x6911be,_0x34d253);if(_0x25cadf){for(var _0x274741 in _0x25cadf){if(_0x25cadf['hasOwnProperty'](_0x274741)){this[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0x13b'),_0x274741[_0x5a96('0x6b')]()),_0x25cadf[_0x274741]);}}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x13c'),JSON['stringify'](_0x25cadf)));}}return _0x2e6bae;};AGIVertices[_0x5a96('0xe')][_0x5a96('0x13d')]=function(_0x3a848a){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x13e'),_0x3a848a[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x3a848a[_0x5a96('0x13f')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x140'));}if(!this[_0x5a96('0x86')](_0x3a848a[_0x5a96('0x94')])){return this['channel']['noop'](_0x5a96('0x141'));}var _0x578a89='wav';var _0x54c7ce=util['format'](_0x5a96('0x136'),FILES_PATH,rs[_0x5a96('0x11e')](0x4));var _0x219eeb=util[_0x5a96('0x27')](_0x5a96('0x9d'),_0x54c7ce,_0x578a89);var _0x15264c=!![];if(_0x3a848a['beep']===_0x5a96('0x138')){_0x15264c=![];}var _0x1b3348=this[_0x5a96('0xc')][_0x5a96('0x142')](_0x54c7ce,_0x578a89,_0x3a848a['intKey'],_0x3a848a[_0x5a96('0x66')],undefined,_0x15264c);if(_0x1b3348['result']!==-0x1){this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x143'),_0x219eeb));var _0x75caa3=this['tildeASR'][_0x5a96('0x70')](this,_0x3a848a,_0x219eeb);if(_0x75caa3){for(var _0x1357ec in _0x75caa3){if(_0x75caa3[_0x5a96('0x97')](_0x1357ec)){this[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0x144'),_0x1357ec[_0x5a96('0x6b')]()),_0x75caa3[_0x1357ec]);}}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')]('TildeASR\x20Result\x20%s',JSON[_0x5a96('0x73')](_0x75caa3)));}}return _0x1b3348;};AGIVertices[_0x5a96('0xe')][_0x5a96('0x145')]=function(_0x3e7eac){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3e7eac[_0x5a96('0x36')]));return this[_0x5a96('0xc')][_0x5a96('0x146')](_0x3e7eac[_0x5a96('0x3a')],_0x3e7eac[_0x5a96('0x147')],_0x3e7eac[_0x5a96('0x148')]);};AGIVertices['prototype'][_0x5a96('0x149')]=function(_0x2f987e){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x14a'),_0x2f987e[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x2f987e[_0x5a96('0x14b')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x2f987e,_0x5a96('0x14c'));}try{var _0x3a403c=eval(_0x2f987e['condition'])?_0x5a96('0x14d'):_0x5a96('0x14e');this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x14f'),_0x2f987e[_0x5a96('0x14b')],_0x3a403c));return{'code':0xc8,'result':_0x3a403c};}catch(_0x32de55){return{'code':0xc8,'result':_0x5a96('0x14e')};}};AGIVertices[_0x5a96('0xe')][_0x5a96('0x150')]=function(_0x352738){logger['info'](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x352738[_0x5a96('0x36')]));if(!this['isConfigured'](_0x352738[_0x5a96('0x151')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x352738,'no\x20interval\x20configured');}var _0x3e1d0e=this[_0x5a96('0x24')]['sync'](this,_0x352738[_0x5a96('0x151')]);if(!_0x3e1d0e){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x352738,_0x5a96('0x152'));}for(var _0x32eb99=0x0;_0x32eb99<_0x3e1d0e['length'];_0x32eb99+=0x1){var _0x5e239a=this[_0x5a96('0xc')]['getVariable'](util[_0x5a96('0x27')](_0x5a96('0x153'),_0x3e1d0e[_0x32eb99]));if(_0x5e239a[_0x5a96('0xa4')]===-0x1){return _0x5e239a;}logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x154'),_0x3e1d0e[_0x32eb99],_0x5e239a[_0x5a96('0xa6')]));if(_0x5e239a[_0x5a96('0xa6')]===_0x5a96('0x14d')){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x154'),_0x3e1d0e[_0x32eb99],_0x5a96('0x14d')));this['channel']['noop'](util[_0x5a96('0x27')](_0x5a96('0x154'),_0x3e1d0e[_0x32eb99],'true'));return{'code':0xc8,'result':_0x5a96('0x14d')};}else{logger[_0x5a96('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x3e1d0e[_0x32eb99],_0x5a96('0x14e')));this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')]('IFTIME\x20%s\x20%s',_0x3e1d0e[_0x32eb99],_0x5a96('0x14e')));}}return{'code':0xc8,'result':_0x5a96('0x14e')};};AGIVertices[_0x5a96('0xe')][_0x5a96('0x155')]=function(_0x206da9){logger[_0x5a96('0x2c')](util['format'](_0x5a96('0x156'),_0x206da9['label']));return this['channel']['hangup']();};AGIVertices[_0x5a96('0xe')][_0x5a96('0x157')]=function(_0x10a0d6){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x158'),_0x10a0d6[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x10a0d6[_0x5a96('0x82')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xe9'));}var _0x52d4b0=_0x5a96('0x159');var _0x57cd4d=util[_0x5a96('0x27')](_0x5a96('0x136'),FILES_PATH,rs['generate'](0x4));var _0x174247=util[_0x5a96('0x27')]('%s.%s',_0x57cd4d,_0x52d4b0);var _0x1a6bf3=!![];if(_0x10a0d6[_0x5a96('0x137')]===_0x5a96('0x138')){_0x1a6bf3=![];}var _0x156dd9=this[_0x5a96('0xc')][_0x5a96('0x142')](_0x57cd4d,_0x52d4b0,_0x10a0d6[_0x5a96('0x139')],_0x10a0d6[_0x5a96('0x66')],undefined,_0x1a6bf3);if(_0x156dd9[_0x5a96('0xa4')]!==-0x1){this['channel'][_0x5a96('0xaa')](util[_0x5a96('0x27')]('ispeech\x20%s\x20file\x20created',_0x174247));var _0x5e5682=this[_0x5a96('0x84')][_0x5a96('0x70')](this,_0x10a0d6,_0x174247);if(_0x5e5682){for(var _0x228900 in _0x5e5682){if(_0x5e5682[_0x5a96('0x97')](_0x228900)){this[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0x15a'),_0x228900[_0x5a96('0x6b')]()),_0x5e5682[_0x228900]);}}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x15b'),JSON[_0x5a96('0x73')](_0x5e5682)));}}return _0x156dd9;};AGIVertices[_0x5a96('0xe')]['ispeechtts']=function(_0x412a1){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x15c'),_0x412a1['label']));if(!this[_0x5a96('0x86')](_0x412a1['key'])){return this['channel'][_0x5a96('0xaa')](_0x5a96('0xe9'));}if(!this['isConfigured'](_0x412a1['text'])){return this['channel'][_0x5a96('0xaa')](_0x5a96('0xc5'));}this['channel'][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x15d'),_0x412a1[_0x5a96('0x5b')]));var _0x41eca3=this[_0x5a96('0x81')]['sync'](this,_0x412a1);if(_0x41eca3){this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')]('ispeech\x20%s\x20file\x20created',_0x41eca3));var _0x4ec045=this[_0x5a96('0xc')][_0x5a96('0x106')](_0x41eca3,_0x412a1['intKey']);try{fs['unlink'](_0x41eca3+_0x5a96('0x107'));}catch(_0x2dee18){logger[_0x5a96('0x2a')](_0x2dee18);}return _0x4ec045;}return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x412a1,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['login']=function(_0x278af1){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x15e'),_0x278af1[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x278af1['findBy'])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x278af1,_0x5a96('0x15f'));}logger['info'](util[_0x5a96('0x27')](_0x5a96('0x160'),this['channel'][_0x5a96('0x4f')],_0x278af1[_0x5a96('0x161')]));var _0x32f73d=this[_0x5a96('0x55')][_0x5a96('0x70')](this,_0x278af1[_0x5a96('0x161')]);if(_0x32f73d){logger[_0x5a96('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x278af1['findBy']));this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x162'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x278af1[_0x5a96('0x161')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x5a96('0x27')](_0x5a96('0x163'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x278af1['findBy']));this['channel'][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x163'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x278af1[_0x5a96('0x161')]));return{'code':0xc8,'result':_0x5a96('0x164')};}};AGIVertices['prototype'][_0x5a96('0x165')]=function(_0x3c9968){logger[_0x5a96('0x2c')](util['format'](_0x5a96('0x166'),_0x3c9968[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x3c9968[_0x5a96('0x161')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x3c9968,'no\x20find\x20by\x20configured');}logger[_0x5a96('0x2c')](util['format'](_0x5a96('0x160'),this['channel'][_0x5a96('0x4f')],_0x3c9968[_0x5a96('0x161')]));var _0x5eb7fa=this[_0x5a96('0x52')][_0x5a96('0x70')](this,_0x3c9968[_0x5a96('0x161')]);if(_0x5eb7fa){logger['info'](util[_0x5a96('0x27')](_0x5a96('0x162'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x3c9968[_0x5a96('0x161')]));this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')](_0x5a96('0x162'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x3c9968[_0x5a96('0x161')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5a96('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5a96('0xc')]['callerid'],_0x3c9968[_0x5a96('0x161')]));this['channel'][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x163'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x3c9968[_0x5a96('0x161')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5a96('0xe')]['math']=function(_0x2f208c){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x167'),_0x2f208c[_0x5a96('0x36')]));if(!this['isConfigured'](_0x2f208c[_0x5a96('0x168')])){return this['channel'][_0x5a96('0x2a')](_0x2f208c,'no\x20operation\x20configured');}this['channel'][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x169'),_0x2f208c[_0x5a96('0x168')]));var _0x60a05f=eval(_0x2f208c['operation']);if(!this[_0x5a96('0x86')](_0x2f208c[_0x5a96('0xdc')])){return this[_0x5a96('0xc')]['noop'](_0x5a96('0xdb'));}var _0xa0d438=this[_0x5a96('0xf')][_0x5a96('0x70')](this,_0x2f208c[_0x5a96('0xdc')]);if(!_0xa0d438){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x2f208c,_0x5a96('0x11c'));}if(_[_0x5a96('0x9c')](_0x60a05f)){var _0x3efeab=this;_0x60a05f[_0x5a96('0xde')](function(_0x2b41a1,_0x4611e6){_0x3efeab[_0x5a96('0xc')][_0x5a96('0xa0')](util['format'](_0x5a96('0x16a'),_0xa0d438,_0x4611e6),_0x2b41a1);});return this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')]('variable\x20%s[key]\x20set',_0xa0d438));}else{return this[_0x5a96('0xc')]['setVariable'](_0xa0d438,_0x60a05f);}};AGIVertices[_0x5a96('0xe')][_0x5a96('0x9')]=function(_0xfc96d1){logger[_0x5a96('0x2c')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0xfc96d1['label']));if(_0xfc96d1['retry']===0x0){return this['maxRetry'](_0xfc96d1);}_0xfc96d1[_0x5a96('0x115')]-=0x1;if(!this[_0x5a96('0x86')](_0xfc96d1[_0x5a96('0x116')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0xfc96d1,_0x5a96('0x117'));}var _0x49e925=this[_0x5a96('0x1d')]['sync'](this,_0xfc96d1[_0x5a96('0x116')]);if(!_0x49e925){return this[_0x5a96('0xc')]['error'](_0xfc96d1,_0x5a96('0x16b'));}var _0x1ece35=this[_0x5a96('0xc')][_0x5a96('0x118')](_0x49e925,_0xfc96d1[_0x5a96('0x119')],_0xfc96d1['digit']);var _0x1c6060=_0x1ece35[_0x5a96('0xa4')];if(_0x1ece35[_0x5a96('0xa4')]===-0x1){this['createSquareDetailsReport'][_0x5a96('0x70')](this,_0xfc96d1,'-1');return _0x1ece35;}else if(_0x1ece35[_0x5a96('0xa6')]===_0x5a96('0x66')){_0x1ece35[_0x5a96('0xa4')]=_0x1ece35['result'][_0x5a96('0x9e')]>0x0?_0x1ece35[_0x5a96('0xa4')]:'t';}else if(_[_0x5a96('0x41')](_0x1ece35['result'])){_0x1ece35['result']='#';_0x1c6060='#';}if(!this[_0x5a96('0x86')](_0xfc96d1[_0x5a96('0xdc')])){this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xdb'));}else{var _0x17d6a1=this['getVariable'][_0x5a96('0x70')](this,_0xfc96d1[_0x5a96('0xdc')]);if(!_0x17d6a1){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0xfc96d1,_0x5a96('0x11c'));}this[_0x5a96('0xc')][_0x5a96('0xa0')](_0x17d6a1,_0x1c6060);}this[_0x5a96('0xda')][_0x5a96('0x70')](this,_0xfc96d1,_0x1c6060);return _0x1ece35;};AGIVertices[_0x5a96('0xe')][_0x5a96('0xaa')]=function(_0x12c731){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x16c'),_0x12c731[_0x5a96('0x36')]));return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x12c731[_0x5a96('0x16d')]||_0x12c731['label']);};AGIVertices[_0x5a96('0xe')]['pause']=function(_0x4799db){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x16e'),_0x4799db[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x4799db[_0x5a96('0x161')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x4799db,_0x5a96('0x15f'));}logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x160'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x4799db[_0x5a96('0x161')]));var _0x4ec6d3=this[_0x5a96('0x4c')]['sync'](this,_0x4799db['pause_id']);var _0x35662e=this[_0x5a96('0x50')]['sync'](this,_0x4799db[_0x5a96('0x161')],_0x4ec6d3);if(_0x35662e){logger['info'](util[_0x5a96('0x27')](_0x5a96('0x162'),this[_0x5a96('0xc')]['callerid'],_0x4799db['findBy']));this['channel'][_0x5a96('0xaa')](util[_0x5a96('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x4799db[_0x5a96('0x161')]));return{'code':0xc8,'result':_0x5a96('0x16f')};}else{logger[_0x5a96('0x2c')](util['format'](_0x5a96('0x163'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x4799db[_0x5a96('0x161')]));this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x4799db['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x5a96('0xe')][_0x5a96('0x170')]=function(_0x29341a){logger['info'](util[_0x5a96('0x27')](_0x5a96('0x171'),_0x29341a[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x29341a[_0x5a96('0x116')])){return this[_0x5a96('0xc')]['error'](_0x29341a,'no\x20file\x20audio\x20selected');}var _0x467f93=this[_0x5a96('0x1d')][_0x5a96('0x70')](this,_0x29341a[_0x5a96('0x116')]);if(!_0x467f93){return this[_0x5a96('0xc')]['error'](_0x29341a,_0x5a96('0x16b'));}var _0x146c8f=this[_0x5a96('0xc')][_0x5a96('0x57')](_0x5a96('0x172'),[_0x467f93,_0x29341a['opts']]);if(_0x146c8f[_0x5a96('0xa4')]===-0x1){return _0x146c8f;}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x173'),'PLAYBACK',_0x467f93));};AGIVertices[_0x5a96('0xe')][_0x5a96('0x174')]=function(_0x2348dc){logger['info'](util[_0x5a96('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2348dc[_0x5a96('0x36')]));if(!this['isConfigured'](_0x2348dc[_0x5a96('0x175')])){return this[_0x5a96('0xc')]['error'](_0x2348dc,'no\x20queue\x20selected');}var _0x24c4cb='';var _0x42cc10=parseInt(_0x2348dc[_0x5a96('0x175')],0xa);if(isNaN(_0x42cc10)){_0x24c4cb=_0x2348dc[_0x5a96('0x175')];}else{_0x24c4cb=this[_0x5a96('0x14')]['sync'](this,_0x2348dc[_0x5a96('0x175')]);if(!_0x24c4cb){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x2348dc,_0x5a96('0x176'));}}var _0x317336='';if(this[_0x5a96('0x86')](_0x2348dc[_0x5a96('0x116')])){var _0x1035ad=this[_0x5a96('0x1d')][_0x5a96('0x70')](this,_0x2348dc[_0x5a96('0x116')]);if(_0x1035ad){_0x317336=_0x1035ad;}}this[_0x5a96('0xda')]['sync'](this,_0x2348dc,_0x24c4cb);if(_0x2348dc[_0x5a96('0x112')][_0x5a96('0x177')]('x')<0x0){_0x2348dc[_0x5a96('0x112')]+='x';}if(_0x2348dc[_0x5a96('0x112')][_0x5a96('0x177')]('X')<0x0){_0x2348dc['opts']+='X';}this[_0x5a96('0xc')][_0x5a96('0xa0')]('XMCS-QUEUE',_0x24c4cb?_0x24c4cb[_0x5a96('0x178')]():'');var _0x232a6b=this[_0x5a96('0xc')]['exec'](_0x5a96('0x179'),[_0x24c4cb,_0x2348dc[_0x5a96('0x112')],_0x2348dc[_0x5a96('0x64')],_0x317336,_0x2348dc['timeout'],_0x2348dc[_0x5a96('0xb5')],_0x2348dc[_0x5a96('0x17a')],_0x2348dc['gosub'],'',_0x2348dc['position']]);if(_0x232a6b[_0x5a96('0xa4')]===-0x1){return _0x232a6b;}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x24c4cb));};AGIVertices[_0x5a96('0xe')]['record']=function(_0x24de6e){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x17b'),_0x24de6e['label']));var _0x5b0e06=_0x24de6e[_0x5a96('0x17c')]||_0x5a96('0x159');var _0xa36b68=util[_0x5a96('0x27')]('%s_%s',this[_0x5a96('0xc')][_0x5a96('0x35')],rs[_0x5a96('0x11e')](0x5));var _0x463420=util[_0x5a96('0x27')](_0x5a96('0x17d'),FILES_PATH,_0xa36b68,_0x5b0e06);var _0x209072=util['format'](_0x5a96('0x136'),FILES_PATH,_0xa36b68);this[_0x5a96('0x38')]['sync'](this,_0x24de6e,_0xa36b68,_0x463420);this[_0x5a96('0xc')][_0x5a96('0xa0')](_0x5a96('0x17e'),_0xa36b68);logger[_0x5a96('0x2c')](_0x5a96('0x17f'),_0x209072,_0x5b0e06,_0x24de6e[_0x5a96('0x180')],_0x24de6e['timeout']);return this['channel'][_0x5a96('0x142')](_0x209072,_0x5b0e06,_0x24de6e[_0x5a96('0x180')],_0x24de6e[_0x5a96('0x66')],undefined,!![]);};AGIVertices[_0x5a96('0xe')][_0x5a96('0x181')]=function(_0x51c5c6){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x182'),_0x51c5c6[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x51c5c6[_0x5a96('0x64')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x183'));}var _0x133563=this['restAPI'][_0x5a96('0x70')](this,_0x51c5c6);logger[_0x5a96('0x2c')](util[_0x5a96('0x27')]('Response:',util[_0x5a96('0x184')](_0x133563,{'showHidden':![],'depth':null})));if(!this[_0x5a96('0x86')](_0x51c5c6[_0x5a96('0xdc')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x185'));}var _0x46c728=this[_0x5a96('0xf')][_0x5a96('0x70')](this,_0x51c5c6[_0x5a96('0xdc')]);if(!_0x46c728){return this['channel'][_0x5a96('0x2a')](_0x51c5c6,'no\x20variable\x20found');}this[_0x5a96('0xc')][_0x5a96('0xa0')](util[_0x5a96('0x27')](_0x5a96('0x186'),_0x46c728),_0x133563[_0x5a96('0x75')]?_0x133563[_0x5a96('0x75')]:_0x5a96('0x187'));this[_0x5a96('0xc')][_0x5a96('0xa0')](util['format'](_0x5a96('0x188'),_0x46c728),_0x133563[_0x5a96('0x76')]?_0x133563['statusMessage']:'OK');if(_0x133563[_0x5a96('0x6c')]){try{this[_0x5a96('0x9f')](_0x133563['body'],_0x46c728);}catch(_0x3bb70d){logger[_0x5a96('0x2a')](util[_0x5a96('0x27')](_0x5a96('0x189'),_0x46c728));}}return this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0xe1'),_0x46c728));};AGIVertices[_0x5a96('0xe')][_0x5a96('0x18a')]=function(_0x240b86){logger['info'](util['format'](_0x5a96('0x18b'),_0x240b86[_0x5a96('0x36')]));return this[_0x5a96('0xc')][_0x5a96('0x18c')](_0x240b86[_0x5a96('0x18d')][_0x5a96('0x58')](/\s+/g,''),_0x240b86['escape_digits']);};AGIVertices['prototype'][_0x5a96('0x18e')]=function(_0x54ca74){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x54ca74[_0x5a96('0x36')]));return this['channel'][_0x5a96('0x18f')](_0x54ca74[_0x5a96('0x67')][_0x5a96('0x58')](/\s+/g,''),_0x54ca74[_0x5a96('0x180')]);};AGIVertices[_0x5a96('0xe')][_0x5a96('0x190')]=function(_0x42c80d){logger['info'](util[_0x5a96('0x27')](_0x5a96('0x191'),_0x42c80d[_0x5a96('0x36')]));return this[_0x5a96('0xc')][_0x5a96('0x192')](_0x42c80d[_0x5a96('0x5b')],_0x42c80d['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x10827e){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x193'),_0x10827e[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x10827e[_0x5a96('0x194')])){return this['channel'][_0x5a96('0xaa')]('no\x20mail\x20account\x20configured');}var _0x5ed661=this[_0x5a96('0x20')]['sync'](this,_0x10827e[_0x5a96('0x194')]);if(!_0x5ed661||!_0x5ed661[_0x5a96('0x195')]){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x10827e,'no\x20mail\x20account\x20found');}var _0x364c41={'from':util[_0x5a96('0x27')](_0x5a96('0x196'),_0x5ed661['name'],_0x5ed661[_0x5a96('0x197')]||_0x5ed661[_0x5a96('0x195')]['user']),'to':_0x10827e['to']||'','cc':_0x10827e['cc']||'','bcc':_0x10827e[_0x5a96('0x198')]||'','subject':_0x10827e['subject'],'html':_0x10827e[_0x5a96('0x5b')],'text':_0x10827e['text']};var _0x4fe4fb={'tls':{'rejectUnauthorized':![]}};if(_0x5ed661[_0x5a96('0x195')][_0x5a96('0x199')]){_0x4fe4fb[_0x5a96('0x199')]=_0x5ed661['Smtp'][_0x5a96('0x199')];}else{_0x4fe4fb[_0x5a96('0x19a')]=_0x5ed661[_0x5a96('0x195')][_0x5a96('0x19a')];_0x4fe4fb[_0x5a96('0x19b')]=_0x5ed661[_0x5a96('0x195')][_0x5a96('0x19b')];_0x4fe4fb[_0x5a96('0x19c')]=_0x5ed661[_0x5a96('0x195')]['secure'];}if(_0x5ed661['Smtp'][_0x5a96('0x19d')]){_0x4fe4fb[_0x5a96('0x19e')]={'user':_0x5ed661['Smtp']['user'],'pass':_0x5ed661[_0x5a96('0x195')][_0x5a96('0x19f')]};}if(this['isConfigured'](_0x10827e[_0x5a96('0x1a0')])){}logger['debug'](_0x5a96('0x1a1'),JSON[_0x5a96('0x73')](_0x364c41));this[_0x5a96('0xda')][_0x5a96('0x70')](this,_0x10827e,_0x10827e[_0x5a96('0x194')]);this[_0x5a96('0xc')][_0x5a96('0xaa')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x5ed661[_0x5a96('0x12')]));this['sendMailMessage'][_0x5a96('0x70')](this,_0x4fe4fb,_0x364c41);return this['channel']['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x5a96('0x1a2')]=function(_0x946a79){logger['info'](util['format'](_0x5a96('0x1a3'),_0x946a79[_0x5a96('0x36')]));return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x1a4'));};AGIVertices[_0x5a96('0xe')]['sendSMS']=function(_0x183c2e){logger['info'](util[_0x5a96('0x27')](_0x5a96('0x1a5'),_0x183c2e[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x183c2e[_0x5a96('0x1a6')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x1a7'));}var _0x39a7c6=this['getSmsAccount'][_0x5a96('0x70')](this,_0x183c2e['sms_account_id']);if(!_0x39a7c6){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x183c2e,_0x5a96('0x1a8'));}var _0x43cf9d={'body':_0x183c2e[_0x5a96('0x1a9')],'phone':_0x183c2e['to']||'','SmsAccountId':_0x39a7c6['id']};logger[_0x5a96('0xe3')]('sendSMS\x20message',JSON['stringify'](_0x43cf9d));this[_0x5a96('0xda')][_0x5a96('0x70')](this,_0x183c2e,_0x183c2e[_0x5a96('0x1a6')]);this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')](_0x5a96('0x1aa'),_0x39a7c6['name']));this[_0x5a96('0x34')][_0x5a96('0x70')](this,_0x43cf9d);return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x1ab'));};AGIVertices[_0x5a96('0xe')][_0x5a96('0x1ac')]=function(_0x5ae973){logger['info'](util[_0x5a96('0x27')](_0x5a96('0x1ad'),_0x5ae973[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x5ae973[_0x5a96('0xdc')])){return this['channel'][_0x5a96('0x2a')](_0x5ae973,_0x5a96('0x1ae'));}var _0x4eff28=this[_0x5a96('0xf')][_0x5a96('0x70')](this,_0x5ae973[_0x5a96('0xdc')]);if(!_0x4eff28){return this['channel'][_0x5a96('0x2a')](_0x5ae973,_0x5a96('0x11c'));}return this[_0x5a96('0xc')][_0x5a96('0xa0')](_0x4eff28,_0x5ae973[_0x5a96('0x1af')]);};AGIVertices['prototype']['start']=function(_0x330d93){logger['info'](util[_0x5a96('0x27')](_0x5a96('0x1b0'),_0x330d93[_0x5a96('0x36')]));this[_0x5a96('0xc')]['noop'](_0x5a96('0x1b1'));if(_0x330d93['answer']==='yes'){this[_0x5a96('0xc')]['noop'](_0x5a96('0x1b2'));return this[_0x5a96('0xc')][_0x5a96('0xbb')]();}return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0x1b3'));};AGIVertices[_0x5a96('0xe')][_0x5a96('0x1b4')]=function(_0x514030){logger[_0x5a96('0x2c')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x514030[_0x5a96('0x36')]));if(!this['isConfigured'](_0x514030[_0x5a96('0x1b5')])){return this['channel'][_0x5a96('0x2a')](_0x514030,_0x5a96('0x1b6'));}var _0x279fbf=this['getSquareProject']['sync'](this,_0x514030[_0x5a96('0x1b5')]);if(!this['isConfigured'](_0x279fbf)){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x514030,util[_0x5a96('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x514030[_0x5a96('0x1b5')]));}if(_0x279fbf===this[_0x5a96('0xc')][_0x5a96('0x3d')]){return this[_0x5a96('0xc')]['error'](_0x514030,_0x5a96('0x1b7'));}this['createSquareDetailsReport'][_0x5a96('0x70')](this,_0x514030,_0x279fbf);var _0x417348=this[_0x5a96('0xc')][_0x5a96('0x57')]('AGI',util[_0x5a96('0x27')](_0x5a96('0x1b8'),config[_0x5a96('0xb5')][_0x5a96('0x19a')]||_0x5a96('0x1b9'),_0x279fbf,this[_0x5a96('0xc')][_0x5a96('0x3d')]));if(_0x417348[_0x5a96('0xa4')]===-0x1){return _0x417348;}return this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')](_0x5a96('0x173'),_0x5a96('0x1ba'),_0x279fbf));};AGIVertices[_0x5a96('0xe')]['system']=function(_0x3a95d8){logger[_0x5a96('0x2c')](util['format'](_0x5a96('0x1bb'),_0x3a95d8['label']));var _0x451177=this[_0x5a96('0x56')][_0x5a96('0x70')](this,_0x3a95d8[_0x5a96('0xb6')]);this['createSquareDetailsReport'][_0x5a96('0x70')](this,_0x3a95d8,_0x3a95d8['command']);if(this[_0x5a96('0x86')](_0x3a95d8['variable_id'])){var _0x58ecb2=this[_0x5a96('0xf')][_0x5a96('0x70')](this,_0x3a95d8['variable_id']);if(_0x58ecb2){this['channel']['setVariable'](_0x58ecb2,_0x451177);return this['channel']['noop'](util[_0x5a96('0x27')](_0x5a96('0x1bc'),_0x3a95d8[_0x5a96('0xb6')],_0x58ecb2));}}return this['channel'][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x1bd'),_0x3a95d8[_0x5a96('0xb6')]));};AGIVertices['prototype'][_0x5a96('0x1be')]=function(_0x1b62c3){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1b62c3[_0x5a96('0x36')]));_0x1b62c3[_0x5a96('0x5b')]=_0x1b62c3[_0x5a96('0x5b')][_0x5a96('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5a96('0x86')](_0x1b62c3[_0x5a96('0x1bf')])){return this[_0x5a96('0xc')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x5a96('0x86')](_0x1b62c3['text'])){return this[_0x5a96('0xc')][_0x5a96('0xaa')]('no\x20text\x20configured');}this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x1c0'),_0x1b62c3[_0x5a96('0x5b')]));var _0x13c295=this['googleCloudTTS'][_0x5a96('0x70')](this,_0x1b62c3);if(_0x13c295){this[_0x5a96('0xc')]['noop'](util[_0x5a96('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x13c295));var _0x140e57=this[_0x5a96('0xc')]['streamFile'](_0x13c295);try{fs['unlink'](_0x13c295+'.wav');}catch(_0xb4b66e){logger[_0x5a96('0x2a')](_0xb4b66e);}return _0x140e57;}return this[_0x5a96('0xc')]['error'](_0x1b62c3,_0x5a96('0x1c1'));};AGIVertices[_0x5a96('0xe')][_0x5a96('0x1c2')]=function(_0x4fed84){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x1c3'),_0x4fed84[_0x5a96('0x36')]));_0x4fed84[_0x5a96('0x5b')]=_0x4fed84[_0x5a96('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5a96('0x86')](_0x4fed84[_0x5a96('0x5b')])){return this[_0x5a96('0xc')][_0x5a96('0xaa')](_0x5a96('0xc5'));}this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x1c4'),_0x4fed84[_0x5a96('0x5b')]));var _0x461ff6=this[_0x5a96('0x61')]['sync'](this,_0x4fed84);if(_0x461ff6){this['channel'][_0x5a96('0xaa')](util['format'](_0x5a96('0x1c5'),_0x461ff6));var _0x56b819=this[_0x5a96('0xc')][_0x5a96('0x106')](_0x461ff6);try{fs[_0x5a96('0x1c6')](_0x461ff6+_0x5a96('0x107'));}catch(_0x412d3c){logger[_0x5a96('0x2a')](_0x412d3c);}return _0x56b819;}return this['channel'][_0x5a96('0x2a')](_0x4fed84,_0x5a96('0x1c7'));};AGIVertices[_0x5a96('0xe')][_0x5a96('0x1c8')]=function(_0x515240){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x515240[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x515240[_0x5a96('0x161')])){return this[_0x5a96('0xc')]['error'](_0x515240,_0x5a96('0x15f'));}logger[_0x5a96('0x2c')](util['format'](_0x5a96('0x160'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x515240['findBy']));var _0x1bc8df=this[_0x5a96('0x51')][_0x5a96('0x70')](this,_0x515240[_0x5a96('0x161')]);if(_0x1bc8df){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x162'),this['channel'][_0x5a96('0x4f')],_0x515240[_0x5a96('0x161')]));this[_0x5a96('0xc')][_0x5a96('0xaa')](util[_0x5a96('0x27')](_0x5a96('0x162'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x515240[_0x5a96('0x161')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x163'),this[_0x5a96('0xc')][_0x5a96('0x4f')],_0x515240[_0x5a96('0x161')]));this[_0x5a96('0xc')][_0x5a96('0xaa')](util['format'](_0x5a96('0x163'),this['channel'][_0x5a96('0x4f')],_0x515240[_0x5a96('0x161')]));return{'code':0xc8,'result':_0x5a96('0x164')};}};AGIVertices[_0x5a96('0xe')][_0x5a96('0x1c9')]=function(_0x23b3b1){logger['info'](util[_0x5a96('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x23b3b1[_0x5a96('0x36')]));var _0x5bdffd=this[_0x5a96('0xc')][_0x5a96('0x57')](_0x5a96('0x1ca'),[_0x23b3b1[_0x5a96('0x1cb')],_0x23b3b1[_0x5a96('0x79')]]);if(_0x5bdffd[_0x5a96('0xa4')]===-0x1){return _0x5bdffd;}return this['channel'][_0x5a96('0xaa')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x23b3b1[_0x5a96('0x1cb')]));};AGIVertices[_0x5a96('0xe')]['vswitch']=function(_0x454a3f){logger[_0x5a96('0x2c')](util[_0x5a96('0x27')](_0x5a96('0x1cc'),_0x454a3f[_0x5a96('0x36')]));if(!this[_0x5a96('0x86')](_0x454a3f[_0x5a96('0xdc')])){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x454a3f,_0x5a96('0x1ae'));}var _0x574d93=this[_0x5a96('0xf')]['sync'](this,_0x454a3f[_0x5a96('0xdc')]);if(!_0x574d93){return this[_0x5a96('0xc')][_0x5a96('0x2a')](_0x454a3f,'no\x20variable\x20found');}var _0x122c81=this[_0x5a96('0xc')]['getVariable'](_0x574d93);return{'code':0xc8,'result':_0x122c81['extra']?_0x122c81['extra']:'-'};};String[_0x5a96('0xe')][_0x5a96('0xa2')]=function(_0x386b9e,_0x814dfe){return this[_0x5a96('0xa1')](_0x386b9e)[_0x5a96('0x1cd')](_0x814dfe);};module[_0x5a96('0x1ce')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index bb1e278..4b15960 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 _0xa482=['finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','error','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','voicePause','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]'];(function(_0x17c0c7,_0x243ec5){var _0x3287ae=function(_0x49bbbe){while(--_0x49bbbe){_0x17c0c7['push'](_0x17c0c7['shift']());}};_0x3287ae(++_0x243ec5);}(_0xa482,0x163));var _0x2a48=function(_0x3c421a,_0x3b5644){_0x3c421a=_0x3c421a-0x0;var _0x3cbd60=_0xa482[_0x3c421a];return _0x3cbd60;};'use strict';var util=require(_0x2a48('0x0'));var _=require(_0x2a48('0x1'));var moment=require(_0x2a48('0x2'));var ami=require(_0x2a48('0x3'));var logger=require(_0x2a48('0x4'))('acw');var RpcUser=require(_0x2a48('0x5'));var RpcVoiceAgentReport=require(_0x2a48('0x6'));function Acw(_0x5889f3){this[_0x2a48('0x7')]=_0x5889f3[_0x2a48('0x7')];this[_0x2a48('0x8')]=_0x5889f3[_0x2a48('0x8')];this[_0x2a48('0x9')]=_0x5889f3['timers'];this['channels']={};ami['on'](_0x2a48('0xa'),this[_0x2a48('0xb')][_0x2a48('0xc')](this));ami['on']('hanguprequest',this[_0x2a48('0xd')][_0x2a48('0xc')](this));ami['on'](_0x2a48('0xe'),this[_0x2a48('0xf')][_0x2a48('0xc')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x2a48('0xc')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0x2a48('0x10')]['bind'](this));ami['on'](_0x2a48('0x11'),this[_0x2a48('0x12')]['bind'](this));}function getDiff(_0x37b5e8){var _0x5b1d28=moment()[_0x2a48('0x13')](0x0);var _0x4c611f=moment(_0x37b5e8)['milliseconds'](0x0);return _0x5b1d28[_0x2a48('0x14')](_0x4c611f,_0x2a48('0x15'));}Acw[_0x2a48('0x16')][_0x2a48('0x17')]=function(_0x2a8bc8){try{var _0xe60b92=this;var _0x1409c8=this[_0x2a48('0x18')][_0x2a8bc8][_0x2a48('0x19')];var _0x50cce3=this[_0x2a48('0x18')][_0x2a8bc8][_0x2a48('0x1a')];var _0x2f39e8=this['voiceQueues'][_0x50cce3];var _0x21de93=![];var _0xc930f3=_0x2a48('0x1b');if(_0x2f39e8[_0x2a48('0x1c')]){if(_0x2f39e8[_0x2a48('0x1d')][_0x2a48('0x1e')]){_0x21de93=!![];_0xc930f3=_0x2f39e8[_0x2a48('0x1d')][_0x2a48('0x1e')];}}ami['Action']({'action':'QueuePause','interface':_0x1409c8,'paused':!![],'reason':_0xc930f3})[_0x2a48('0x1f')](function(_0x35f97c){if(_0xe60b92[_0x2a48('0x8')][_0x1409c8]){return RpcUser[_0x2a48('0x20')](_0xe60b92[_0x2a48('0x8')][_0x1409c8]['id'])['then'](function(_0x1e7eba){if(_0x1e7eba&&!_0x1e7eba[_0x2a48('0x21')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x2a8bc8,_0x1409c8,_0x50cce3);var _0xce7b84=_0xe60b92['channels'][_0x2a8bc8][_0x2a48('0x22')]&&_0xe60b92[_0x2a48('0x18')][_0x2a8bc8][_0x2a48('0x23')]?_0xe60b92['channels'][_0x2a8bc8][_0x2a48('0x23')]:_0x2a8bc8;return RpcUser[_0x2a48('0x24')](_0xe60b92[_0x2a48('0x8')][_0x1409c8],_0xc930f3,_0xce7b84)[_0x2a48('0x1f')](function(_0x33c2a7){if(!_0x21de93){_0xe60b92['timers'][_0x1409c8]={};logger[_0x2a48('0x25')](_0x2a48('0x26'),_0x2a8bc8,_0xe60b92[_0x2a48('0x7')][_0x50cce3][_0x2a48('0x27')],_0x1409c8,_0x50cce3);_0xe60b92[_0x2a48('0x9')][_0x1409c8][_0x2a48('0x28')]=setTimeout(_0xe60b92[_0x2a48('0x29')][_0x2a48('0xc')](_0xe60b92,_0x1409c8),_0xe60b92[_0x2a48('0x7')][_0x50cce3][_0x2a48('0x27')]*0x3e8);_0xe60b92[_0x2a48('0x9')][_0x1409c8][_0x2a48('0x2a')]=moment()['format'](_0x2a48('0x2b'));_0xe60b92['timers'][_0x1409c8][_0x2a48('0x2c')]=_0x2a8bc8;_0xe60b92[_0x2a48('0x9')][_0x1409c8][_0x2a48('0x1a')]=_0x50cce3;_0xe60b92['timers'][_0x1409c8][_0x2a48('0x2d')]=function(){var _0x330212=getDiff(_0xe60b92[_0x2a48('0x9')][_0x1409c8][_0x2a48('0x2a')]);clearTimeout(_0xe60b92[_0x2a48('0x9')][_0x1409c8][_0x2a48('0x28')]);_0xe60b92[_0x2a48('0x9')][_0x1409c8][_0x2a48('0x28')]=![];RpcVoiceAgentReport[_0x2a48('0x2e')]({'acwtime':_0x330212},_0xe60b92[_0x2a48('0x9')][_0x1409c8][_0x2a48('0x2c')],_0x1409c8)[_0x2a48('0x1f')](function(_0x1d5a50){logger['info'](_0x2a48('0x2f'),_0x2a8bc8,_0x330212,_0x1d5a50);})[_0x2a48('0x30')](function(_0x3ee127){logger['error'](_0x2a48('0x31'),_0x2a8bc8,_0x3ee127);});delete _0xe60b92['timers'][_0x1409c8];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2a8bc8,_0x1409c8,_0x50cce3);}});}})[_0x2a48('0x30')](function(_0x41217d){logger['error'](_0x2a48('0x26'),_0x2a8bc8,_0xe60b92['voiceQueues'][_0x50cce3][_0x2a48('0x27')],_0x1409c8,_0x50cce3);})[_0x2a48('0x32')](function(){delete _0xe60b92[_0x2a48('0x18')][_0x2a8bc8];});}catch(_0xdb009b){logger['error'](_0x2a48('0x33'),_0xdb009b[_0x2a48('0x34')]);}};Acw['prototype'][_0x2a48('0x29')]=function(_0x31e37b){try{var _0x75a8a9=this;if(_0x75a8a9[_0x2a48('0x9')][_0x31e37b]){_0x75a8a9[_0x2a48('0x9')][_0x31e37b][_0x2a48('0x28')]=![];var _0x5622dd=_0x75a8a9[_0x2a48('0x9')][_0x31e37b][_0x2a48('0x2c')];var _0x356c32=_0x75a8a9[_0x2a48('0x9')][_0x31e37b][_0x2a48('0x1a')];var _0x4f7d2d=_0x75a8a9['voiceQueues'][_0x356c32]['acwTimeout'];logger[_0x2a48('0x25')](_0x2a48('0x35'),_0x5622dd,_0x31e37b);RpcUser['saveUnpause'](this[_0x2a48('0x8')][_0x31e37b]);RpcVoiceAgentReport[_0x2a48('0x2e')]({'acwtime':_0x4f7d2d,'agentacw':!![]},_0x5622dd,_0x31e37b)[_0x2a48('0x1f')](function(_0x5236a7){logger[_0x2a48('0x25')](_0x2a48('0x2f'),_0x5622dd,_0x4f7d2d,_0x5236a7);})[_0x2a48('0x30')](function(_0x1d3f93){logger['error'](_0x2a48('0x31'),_0x5622dd,_0x1d3f93);});}else{logger[_0x2a48('0x36')](_0x2a48('0x37'),_0x31e37b);if(_0x75a8a9[_0x2a48('0x9')]){logger[_0x2a48('0x25')](_0x2a48('0x38'),JSON[_0x2a48('0x39')](_0x75a8a9['timers']));}}}catch(_0x6db2e4){logger['error']('[ACW][STOP]\x20%s',_0x6db2e4[_0x2a48('0x34')]);}};Acw[_0x2a48('0x16')][_0x2a48('0xb')]=function(_0x21c6cf){try{if(this[_0x2a48('0x7')][_0x21c6cf['queue']]&&(this[_0x2a48('0x7')][_0x21c6cf[_0x2a48('0x1a')]][_0x2a48('0x3a')]||this['voiceQueues'][_0x21c6cf[_0x2a48('0x1a')]]['mandatoryDisposition'])){if(this[_0x2a48('0x8')][_0x21c6cf[_0x2a48('0x19')]]){this[_0x2a48('0x18')][_0x21c6cf[_0x2a48('0x2c')]]={'queue':_0x21c6cf[_0x2a48('0x1a')],'interface':_0x21c6cf['interface'],'destlinkedid':_0x21c6cf['destlinkedid']};}}}catch(_0x864bb4){logger[_0x2a48('0x36')](_0x2a48('0x3b'),_0x864bb4[_0x2a48('0x34')]);}};Acw[_0x2a48('0x16')][_0x2a48('0x12')]=function(_0x406569){try{if(this['voiceQueues'][_0x406569[_0x2a48('0x1a')]]&&(this[_0x2a48('0x7')][_0x406569[_0x2a48('0x1a')]]['acw']||this[_0x2a48('0x7')][_0x406569[_0x2a48('0x1a')]][_0x2a48('0x1c')])){if(this[_0x2a48('0x8')][_0x406569[_0x2a48('0x19')]]){this[_0x2a48('0x18')][_0x406569['uniqueid']]={'queue':_0x406569[_0x2a48('0x1a')],'interface':_0x406569[_0x2a48('0x19')]};}}}catch(_0x133f4a){logger[_0x2a48('0x36')]('[ACW][syncAgentConnectPreview]\x20%s',_0x133f4a['message']);}};Acw[_0x2a48('0x16')][_0x2a48('0xd')]=function(_0x1f5dfa){try{if(this[_0x2a48('0x18')][_0x1f5dfa[_0x2a48('0x2c')]]&&_[_0x2a48('0x3c')](this[_0x2a48('0x18')][_0x1f5dfa[_0x2a48('0x2c')]][_0x2a48('0x22')])){logger[_0x2a48('0x25')](_0x2a48('0x3d'),_0x1f5dfa[_0x2a48('0x2c')]);this['startAcw'](_0x1f5dfa[_0x2a48('0x2c')]);}else if(this['channels'][_0x1f5dfa[_0x2a48('0x3e')]]&&_[_0x2a48('0x3c')](this[_0x2a48('0x18')][_0x1f5dfa[_0x2a48('0x3e')]]['attended'])){logger[_0x2a48('0x25')](_0x2a48('0x3f'),_0x1f5dfa['linkedid']);this[_0x2a48('0x17')](_0x1f5dfa[_0x2a48('0x3e')]);}}catch(_0x5a88c8){logger[_0x2a48('0x36')]('[ACW][syncHangupRequest]\x20%s',_0x5a88c8[_0x2a48('0x34')]);}};Acw[_0x2a48('0x16')][_0x2a48('0xf')]=function(_0x461d9b){try{if(this[_0x2a48('0x18')][_0x461d9b[_0x2a48('0x2c')]]&&this[_0x2a48('0x18')][_0x461d9b[_0x2a48('0x2c')]][_0x2a48('0x22')]){logger[_0x2a48('0x25')](_0x2a48('0x40'),_0x461d9b[_0x2a48('0x2c')]);this[_0x2a48('0x17')](_0x461d9b['uniqueid']);}else if(this['channels'][_0x461d9b[_0x2a48('0x3e')]]&&this[_0x2a48('0x18')][_0x461d9b[_0x2a48('0x3e')]]['attended']){logger[_0x2a48('0x25')](_0x2a48('0x41'),_0x461d9b['linkedid']);this[_0x2a48('0x17')](_0x461d9b[_0x2a48('0x3e')]);}}catch(_0xe3e3f){logger[_0x2a48('0x36')]('[ACW][syncHangup]\x20%s',_0xe3e3f[_0x2a48('0x34')]);}};Acw[_0x2a48('0x16')]['syncAttendedTransfer']=function(_0x10256f){try{if(!_[_0x2a48('0x42')](this['channels'][_0x10256f[_0x2a48('0x43')]])){this[_0x2a48('0x17')](_0x10256f[_0x2a48('0x43')]);if(this[_0x2a48('0x18')][_0x10256f[_0x2a48('0x44')]]){this[_0x2a48('0x18')][_0x10256f[_0x2a48('0x44')]][_0x2a48('0x22')]=!![];this[_0x2a48('0x18')][_0x10256f['transfertargetuniqueid']]=this['channels'][_0x10256f[_0x2a48('0x44')]];delete this['channels'][_0x10256f['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x2a48('0x18')][_0x10256f[_0x2a48('0x45')]])){this[_0x2a48('0x17')](_0x10256f['transfertargetuniqueid']);if(this[_0x2a48('0x18')][_0x10256f[_0x2a48('0x46')]]){this[_0x2a48('0x18')][_0x10256f[_0x2a48('0x46')]][_0x2a48('0x22')]=!![];this['channels'][_0x10256f[_0x2a48('0x43')]]=this[_0x2a48('0x18')][_0x10256f[_0x2a48('0x46')]];delete this['channels'][_0x10256f['origtransfereruniqueid']];}}}catch(_0x47c140){logger[_0x2a48('0x36')](_0x2a48('0x47'),_0x47c140[_0x2a48('0x34')]);}};Acw[_0x2a48('0x16')][_0x2a48('0x10')]=function(_0x2b4c19){try{if(this[_0x2a48('0x18')][_0x2b4c19[_0x2a48('0x48')]]){logger[_0x2a48('0x25')](_0x2a48('0x49'),JSON['stringify'](_0x2b4c19[_0x2a48('0x48')]));this[_0x2a48('0x17')](_0x2b4c19[_0x2a48('0x48')]);}else if(this['channels'][_0x2b4c19[_0x2a48('0x4a')]]){logger[_0x2a48('0x25')](_0x2a48('0x4b'),JSON[_0x2a48('0x39')](_0x2b4c19['transfererlinkedid']));this[_0x2a48('0x17')](_0x2b4c19['transfererlinkedid']);}}catch(_0x2abbe1){logger[_0x2a48('0x36')](_0x2a48('0x4c'),_0x2abbe1[_0x2a48('0x34')]);}};Acw[_0x2a48('0x16')][_0x2a48('0x4d')]=function(_0x2a64e5){try{if(this[_0x2a48('0x7')][_0x2a64e5[_0x2a48('0x1a')]]&&this[_0x2a48('0x7')][_0x2a64e5[_0x2a48('0x1a')]]['autopause']==='all'){if(this[_0x2a48('0x8')][_0x2a64e5['interface']]){logger[_0x2a48('0x25')](_0x2a48('0x4e'),_0x2a64e5[_0x2a48('0x2c')],_0x2a64e5[_0x2a48('0x19')],_0x2a64e5[_0x2a48('0x1a')]);return RpcUser[_0x2a48('0x24')](this[_0x2a48('0x8')][_0x2a64e5[_0x2a48('0x19')]],_0x2a48('0x4f'),_0x2a64e5[_0x2a48('0x2c')]);}}}catch(_0x4317f2){logger[_0x2a48('0x36')](_0x2a48('0x50'),_0x4317f2['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x1022=['acw','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','agents','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','stringify','[ACW][STOP]\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1022,0x174));var _0x2102=function(_0x5e49e4,_0x23fa81){_0x5e49e4=_0x5e49e4-0x0;var _0x376049=_0x1022[_0x5e49e4];return _0x376049;};'use strict';var util=require(_0x2102('0x0'));var _=require(_0x2102('0x1'));var moment=require(_0x2102('0x2'));var ami=require(_0x2102('0x3'));var logger=require(_0x2102('0x4'))('acw');var RpcUser=require(_0x2102('0x5'));var RpcVoiceAgentReport=require(_0x2102('0x6'));function Acw(_0x528ffa){this[_0x2102('0x7')]=_0x528ffa[_0x2102('0x7')];this['agents']=_0x528ffa['agents'];this['timers']=_0x528ffa['timers'];this[_0x2102('0x8')]={};ami['on'](_0x2102('0x9'),this[_0x2102('0xa')][_0x2102('0xb')](this));ami['on']('hanguprequest',this[_0x2102('0xc')][_0x2102('0xb')](this));ami['on'](_0x2102('0xd'),this[_0x2102('0xe')][_0x2102('0xb')](this));ami['on'](_0x2102('0xf'),this[_0x2102('0x10')][_0x2102('0xb')](this));ami['on'](_0x2102('0x11'),this['syncAttendedTransfer'][_0x2102('0xb')](this));ami['on'](_0x2102('0x12'),this[_0x2102('0x13')][_0x2102('0xb')](this));ami['on'](_0x2102('0x14'),this['syncAgentConnectPreview'][_0x2102('0xb')](this));}function getDiff(_0x260a42){var _0x3a293d=moment()['milliseconds'](0x0);var _0x42ae81=moment(_0x260a42)[_0x2102('0x15')](0x0);return _0x3a293d['diff'](_0x42ae81,_0x2102('0x16'));}Acw[_0x2102('0x17')][_0x2102('0x18')]=function(_0x102d8c){try{var _0x29364c=this;var _0x384fd0=this[_0x2102('0x8')][_0x102d8c]['interface'];var _0x14312a=this[_0x2102('0x8')][_0x102d8c][_0x2102('0x19')];var _0x266c6a=this[_0x2102('0x7')][_0x14312a];var _0x292b6a=![];var _0x56fe22=_0x2102('0x1a');if(_0x266c6a[_0x2102('0x1b')]){if(_0x266c6a[_0x2102('0x1c')][_0x2102('0x1d')]){_0x292b6a=!![];_0x56fe22=_0x266c6a['mandatoryDispositionPause'][_0x2102('0x1d')];}}ami[_0x2102('0x1e')]({'action':_0x2102('0x1f'),'interface':_0x384fd0,'paused':!![],'reason':_0x56fe22})['then'](function(_0x49977f){if(_0x29364c[_0x2102('0x20')][_0x384fd0]){return RpcUser[_0x2102('0x21')](_0x29364c[_0x2102('0x20')][_0x384fd0]['id'])[_0x2102('0x22')](function(_0x3b07f5){if(_0x3b07f5&&!_0x3b07f5[_0x2102('0x23')]){logger[_0x2102('0x24')](_0x2102('0x25'),_0x102d8c,_0x384fd0,_0x14312a);var _0x19f728=_0x29364c[_0x2102('0x8')][_0x102d8c][_0x2102('0x26')]&&_0x29364c[_0x2102('0x8')][_0x102d8c]['destlinkedid']?_0x29364c[_0x2102('0x8')][_0x102d8c][_0x2102('0x27')]:_0x102d8c;return RpcUser[_0x2102('0x28')](_0x29364c[_0x2102('0x20')][_0x384fd0],_0x56fe22,_0x19f728)[_0x2102('0x22')](function(_0x4a1d92){if(!_0x292b6a){_0x29364c[_0x2102('0x29')][_0x384fd0]={};logger[_0x2102('0x24')](_0x2102('0x2a'),_0x102d8c,_0x29364c[_0x2102('0x7')][_0x14312a][_0x2102('0x2b')],_0x384fd0,_0x14312a);_0x29364c['timers'][_0x384fd0][_0x2102('0x2c')]=setTimeout(_0x29364c[_0x2102('0x2d')][_0x2102('0xb')](_0x29364c,_0x384fd0),_0x29364c[_0x2102('0x7')][_0x14312a]['acwTimeout']*0x3e8);_0x29364c['timers'][_0x384fd0][_0x2102('0x2e')]=moment()[_0x2102('0x2f')](_0x2102('0x30'));_0x29364c[_0x2102('0x29')][_0x384fd0]['uniqueid']=_0x102d8c;_0x29364c[_0x2102('0x29')][_0x384fd0][_0x2102('0x19')]=_0x14312a;_0x29364c[_0x2102('0x29')][_0x384fd0][_0x2102('0x31')]=function(){var _0x2bfc4c=getDiff(_0x29364c[_0x2102('0x29')][_0x384fd0][_0x2102('0x2e')]);clearTimeout(_0x29364c['timers'][_0x384fd0][_0x2102('0x2c')]);_0x29364c[_0x2102('0x29')][_0x384fd0][_0x2102('0x2c')]=![];RpcVoiceAgentReport[_0x2102('0x32')]({'acwtime':_0x2bfc4c},_0x29364c['timers'][_0x384fd0][_0x2102('0x33')],_0x384fd0)['then'](function(_0x5b13b2){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x102d8c,_0x2bfc4c,_0x5b13b2);})[_0x2102('0x34')](function(_0x4d3795){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x102d8c,_0x4d3795);});delete _0x29364c[_0x2102('0x29')][_0x384fd0];};}});}else{logger['info'](_0x2102('0x35'),_0x102d8c,_0x384fd0,_0x14312a);}});}})['catch'](function(_0x48aa77){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x102d8c,_0x29364c[_0x2102('0x7')][_0x14312a][_0x2102('0x2b')],_0x384fd0,_0x14312a);})['finally'](function(){delete _0x29364c[_0x2102('0x8')][_0x102d8c];});}catch(_0x59a81b){logger[_0x2102('0x36')](_0x2102('0x37'),_0x59a81b[_0x2102('0x38')]);}};Acw[_0x2102('0x17')][_0x2102('0x2d')]=function(_0x68b9c1){try{var _0x172069=this;if(_0x172069['timers'][_0x68b9c1]){_0x172069['timers'][_0x68b9c1][_0x2102('0x2c')]=![];var _0x1253f5=_0x172069[_0x2102('0x29')][_0x68b9c1]['uniqueid'];var _0x326b3d=_0x172069[_0x2102('0x29')][_0x68b9c1][_0x2102('0x19')];var _0x3826c6=_0x172069[_0x2102('0x7')][_0x326b3d]['acwTimeout'];logger[_0x2102('0x24')](_0x2102('0x39'),_0x1253f5,_0x68b9c1);RpcUser[_0x2102('0x3a')](this['agents'][_0x68b9c1]);RpcVoiceAgentReport['update']({'acwtime':_0x3826c6,'agentacw':!![]},_0x1253f5,_0x68b9c1)[_0x2102('0x22')](function(_0x3491ae){logger['info'](_0x2102('0x3b'),_0x1253f5,_0x3826c6,_0x3491ae);})[_0x2102('0x34')](function(_0x51ff61){logger[_0x2102('0x36')](_0x2102('0x3c'),_0x1253f5,_0x51ff61);});}else{logger[_0x2102('0x36')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x68b9c1);if(_0x172069[_0x2102('0x29')]){logger['info']('[ACW][TIMERS]',JSON[_0x2102('0x3d')](_0x172069[_0x2102('0x29')]));}}}catch(_0x521b86){logger[_0x2102('0x36')](_0x2102('0x3e'),_0x521b86[_0x2102('0x38')]);}};Acw[_0x2102('0x17')][_0x2102('0xa')]=function(_0x29f59a){try{if(this[_0x2102('0x7')][_0x29f59a[_0x2102('0x19')]]&&(this[_0x2102('0x7')][_0x29f59a['queue']][_0x2102('0x3f')]||this[_0x2102('0x7')][_0x29f59a[_0x2102('0x19')]]['mandatoryDisposition'])){if(this[_0x2102('0x20')][_0x29f59a[_0x2102('0x40')]]){this[_0x2102('0x8')][_0x29f59a[_0x2102('0x33')]]={'queue':_0x29f59a[_0x2102('0x19')],'interface':_0x29f59a[_0x2102('0x40')],'destlinkedid':_0x29f59a[_0x2102('0x27')]};}}}catch(_0x18bb8c){logger[_0x2102('0x36')](_0x2102('0x41'),_0x18bb8c[_0x2102('0x38')]);}};Acw[_0x2102('0x17')][_0x2102('0x42')]=function(_0x1e5052){try{if(this[_0x2102('0x7')][_0x1e5052[_0x2102('0x19')]]&&(this[_0x2102('0x7')][_0x1e5052['queue']][_0x2102('0x3f')]||this['voiceQueues'][_0x1e5052['queue']][_0x2102('0x1b')])){if(this[_0x2102('0x20')][_0x1e5052[_0x2102('0x40')]]){this[_0x2102('0x8')][_0x1e5052[_0x2102('0x33')]]={'queue':_0x1e5052[_0x2102('0x19')],'interface':_0x1e5052[_0x2102('0x40')]};}}}catch(_0x3cbd8){logger[_0x2102('0x36')](_0x2102('0x43'),_0x3cbd8['message']);}};Acw[_0x2102('0x17')][_0x2102('0xc')]=function(_0x27e3b8){try{if(this[_0x2102('0x8')][_0x27e3b8[_0x2102('0x33')]]&&_[_0x2102('0x44')](this[_0x2102('0x8')][_0x27e3b8['uniqueid']][_0x2102('0x26')])){logger[_0x2102('0x24')]('[%s][HANGUP:UNIQUEID]',_0x27e3b8[_0x2102('0x33')]);this[_0x2102('0x18')](_0x27e3b8[_0x2102('0x33')]);}else if(this[_0x2102('0x8')][_0x27e3b8[_0x2102('0x45')]]&&_[_0x2102('0x44')](this[_0x2102('0x8')][_0x27e3b8[_0x2102('0x45')]]['attended'])){logger[_0x2102('0x24')](_0x2102('0x46'),_0x27e3b8[_0x2102('0x45')]);this[_0x2102('0x18')](_0x27e3b8['linkedid']);}}catch(_0xf0949){logger[_0x2102('0x36')]('[ACW][syncHangupRequest]\x20%s',_0xf0949[_0x2102('0x38')]);}};Acw[_0x2102('0x17')][_0x2102('0xe')]=function(_0x415556){try{if(this['channels'][_0x415556[_0x2102('0x33')]]&&this['channels'][_0x415556[_0x2102('0x33')]][_0x2102('0x26')]){logger[_0x2102('0x24')](_0x2102('0x47'),_0x415556[_0x2102('0x33')]);this[_0x2102('0x18')](_0x415556[_0x2102('0x33')]);}else if(this['channels'][_0x415556[_0x2102('0x45')]]&&this[_0x2102('0x8')][_0x415556[_0x2102('0x45')]][_0x2102('0x26')]){logger['info'](_0x2102('0x48'),_0x415556[_0x2102('0x45')]);this[_0x2102('0x18')](_0x415556[_0x2102('0x45')]);}}catch(_0x28c384){logger[_0x2102('0x36')](_0x2102('0x49'),_0x28c384[_0x2102('0x38')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x465534){try{if(!_['isNil'](this['channels'][_0x465534[_0x2102('0x4a')]])){this[_0x2102('0x18')](_0x465534[_0x2102('0x4a')]);if(this[_0x2102('0x8')][_0x465534[_0x2102('0x4b')]]){this[_0x2102('0x8')][_0x465534[_0x2102('0x4b')]]['attended']=!![];this['channels'][_0x465534[_0x2102('0x4c')]]=this[_0x2102('0x8')][_0x465534[_0x2102('0x4b')]];delete this['channels'][_0x465534[_0x2102('0x4b')]];}}else if(!_['isNil'](this[_0x2102('0x8')][_0x465534['transfertargetuniqueid']])){this[_0x2102('0x18')](_0x465534[_0x2102('0x4c')]);if(this[_0x2102('0x8')][_0x465534[_0x2102('0x4d')]]){this['channels'][_0x465534[_0x2102('0x4d')]][_0x2102('0x26')]=!![];this[_0x2102('0x8')][_0x465534['transfereeuniqueid']]=this[_0x2102('0x8')][_0x465534[_0x2102('0x4d')]];delete this[_0x2102('0x8')][_0x465534['origtransfereruniqueid']];}}}catch(_0x421fc1){logger[_0x2102('0x36')](_0x2102('0x4e'),_0x421fc1[_0x2102('0x38')]);}};Acw['prototype'][_0x2102('0x13')]=function(_0x209b5c){try{if(this[_0x2102('0x8')][_0x209b5c[_0x2102('0x4f')]]){logger[_0x2102('0x24')](_0x2102('0x50'),JSON[_0x2102('0x3d')](_0x209b5c[_0x2102('0x4f')]));this[_0x2102('0x18')](_0x209b5c[_0x2102('0x4f')]);}else if(this[_0x2102('0x8')][_0x209b5c[_0x2102('0x51')]]){logger[_0x2102('0x24')](_0x2102('0x52'),JSON[_0x2102('0x3d')](_0x209b5c[_0x2102('0x51')]));this[_0x2102('0x18')](_0x209b5c['transfererlinkedid']);}}catch(_0x144781){logger[_0x2102('0x36')](_0x2102('0x53'),_0x144781['message']);}};Acw[_0x2102('0x17')]['syncAgentRingNoAnswer']=function(_0x554ffb){try{if(this[_0x2102('0x7')][_0x554ffb[_0x2102('0x19')]]&&this[_0x2102('0x7')][_0x554ffb[_0x2102('0x19')]]['autopause']===_0x2102('0x54')){if(this[_0x2102('0x20')][_0x554ffb[_0x2102('0x40')]]){logger[_0x2102('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x554ffb[_0x2102('0x33')],_0x554ffb['interface'],_0x554ffb[_0x2102('0x19')]);return RpcUser['savePause'](this[_0x2102('0x20')][_0x554ffb[_0x2102('0x40')]],'Auto-Pause',_0x554ffb[_0x2102('0x33')]);}}}catch(_0x22bfe4){logger['error'](_0x2102('0x55'),_0x22bfe4[_0x2102('0x38')]);}};module[_0x2102('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 228b61a..c847583 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 _0xb320=['catch','log','exports','asterisk-manager','bluebird','moment','util','lodash','ami','port','asterisk','password','keepConnected','Action','promisify','action','format','username','inspect','error','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then'];(function(_0x3b695f,_0x287f1c){var _0x29e3f0=function(_0x39ef66){while(--_0x39ef66){_0x3b695f['push'](_0x3b695f['shift']());}};_0x29e3f0(++_0x287f1c);}(_0xb320,0x1d7));var _0x0b32=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb320[_0xaa0309];return _0x5de7ce;};'use strict';var Manager=require(_0x0b32('0x0'));var BPromise=require(_0x0b32('0x1'));var moment=require(_0x0b32('0x2'));var util=require(_0x0b32('0x3'));var _=require(_0x0b32('0x4'));var logger=require('../../config/logger')(_0x0b32('0x5'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x0b32('0x6')],config[_0x0b32('0x7')]['ip'],config[_0x0b32('0x7')]['username'],config['asterisk'][_0x0b32('0x8')],!![]);ami[_0x0b32('0x9')]();ami[_0x0b32('0xa')]=BPromise[_0x0b32('0xb')](ami[_0x0b32('0xc')]);function error(_0xd0a2d0){logger['error'](util[_0x0b32('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x0b32('0xe')],config[_0x0b32('0x7')]['ip'],config[_0x0b32('0x7')][_0x0b32('0x6')],util[_0x0b32('0xf')](_0xd0a2d0,![],null)));}function close(){logger[_0x0b32('0x10')](util[_0x0b32('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0x0b32('0x7')]['ip'],config['asterisk'][_0x0b32('0x6')]));}ami[_0x0b32('0x11')]=function(){return function(){return ami[_0x0b32('0xa')]({'action':_0x0b32('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x0b32('0xa')]({'action':_0x0b32('0x13')});};};ami[_0x0b32('0x14')]=function(){return function(){return ami[_0x0b32('0xa')]({'action':_0x0b32('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0b32('0x16')});};};ami[_0x0b32('0x17')]=function(){return function(){return ami['Action']({'action':_0x0b32('0x18')});};};function connect(_0x32fb22){logger[_0x0b32('0x19')](util[_0x0b32('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x0b32('0x7')]['username'],config[_0x0b32('0x7')]['ip'],config['asterisk']['port']));ami[_0x0b32('0x1a')](_0x0b32('0x10'),error);ami['once'](_0x0b32('0x1b'),close);}ami['on'](_0x0b32('0x1c'),connect);ami['on'](_0x0b32('0x1d'),function(_0x1a3208){logger[_0x0b32('0x19')](util[_0x0b32('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x0b32('0x7')][_0x0b32('0xe')],config[_0x0b32('0x7')]['ip'],config[_0x0b32('0x7')][_0x0b32('0x6')],util[_0x0b32('0xf')](_0x1a3208,![],null)));});ami['on'](_0x0b32('0x1e'),function(_0x145ccb){logger[_0x0b32('0x19')](util[_0x0b32('0xd')](_0x0b32('0x1f'),config[_0x0b32('0x7')][_0x0b32('0xe')],config[_0x0b32('0x7')]['ip'],config['asterisk'][_0x0b32('0x6')]));return BPromise['resolve']()[_0x0b32('0x20')](ami[_0x0b32('0x11')]())[_0x0b32('0x20')](ami['actionDeviceStateList']())[_0x0b32('0x20')](ami[_0x0b32('0x14')]())['then'](ami['actionQueueSummary']())[_0x0b32('0x20')](ami['actionCoreShowChannels']())[_0x0b32('0x21')](function(_0x5a11f2){console[_0x0b32('0x22')](_0x5a11f2);});});ami[_0x0b32('0x1a')](_0x0b32('0x10'),error);ami[_0x0b32('0x1a')]('close',close);module[_0x0b32('0x23')]=ami; \ No newline at end of file +var _0x0836=['actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionQueueSummary','catch','close','exports','asterisk-manager','moment','util','lodash','ami','../../config/environment','asterisk','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','queuesummary'];(function(_0x14f3bd,_0x5026b7){var _0x4f6bb9=function(_0x5aac9e){while(--_0x5aac9e){_0x14f3bd['push'](_0x14f3bd['shift']());}};_0x4f6bb9(++_0x5026b7);}(_0x0836,0xc2));var _0x6083=function(_0x49f1fc,_0x4ca5a9){_0x49f1fc=_0x49f1fc-0x0;var _0x2554a6=_0x0836[_0x49f1fc];return _0x2554a6;};'use strict';var Manager=require(_0x6083('0x0'));var BPromise=require('bluebird');var moment=require(_0x6083('0x1'));var util=require(_0x6083('0x2'));var _=require(_0x6083('0x3'));var logger=require('../../config/logger')(_0x6083('0x4'));var config=require(_0x6083('0x5'));var ami=new Manager(config[_0x6083('0x6')]['port'],config['asterisk']['ip'],config[_0x6083('0x6')][_0x6083('0x7')],config[_0x6083('0x6')][_0x6083('0x8')],!![]);ami[_0x6083('0x9')]();ami['Action']=BPromise[_0x6083('0xa')](ami[_0x6083('0xb')]);function error(_0x2c0f02){logger[_0x6083('0xc')](util[_0x6083('0xd')](_0x6083('0xe'),config[_0x6083('0x6')]['username'],config['asterisk']['ip'],config[_0x6083('0x6')][_0x6083('0xf')],util[_0x6083('0x10')](_0x2c0f02,![],null)));}function close(){logger['error'](util[_0x6083('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x6083('0x6')][_0x6083('0x7')],config[_0x6083('0x6')]['ip'],config['asterisk'][_0x6083('0xf')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x6083('0x11')]({'action':_0x6083('0x12')});};};ami[_0x6083('0x13')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x6083('0x14')]=function(){return function(){return ami[_0x6083('0x11')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x6083('0x11')]({'action':_0x6083('0x15')});};};ami[_0x6083('0x16')]=function(){return function(){return ami[_0x6083('0x11')]({'action':_0x6083('0x17')});};};function connect(_0x5c6cd0){logger[_0x6083('0x18')](util[_0x6083('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x6083('0x6')][_0x6083('0x7')],config[_0x6083('0x6')]['ip'],config[_0x6083('0x6')][_0x6083('0xf')]));ami[_0x6083('0x19')](_0x6083('0xc'),error);ami[_0x6083('0x19')]('close',close);}ami['on'](_0x6083('0x1a'),connect);ami['on'](_0x6083('0x1b'),function(_0x32e8e6){logger[_0x6083('0x18')](util['format'](_0x6083('0x1c'),config[_0x6083('0x6')][_0x6083('0x7')],config['asterisk']['ip'],config[_0x6083('0x6')][_0x6083('0xf')],util[_0x6083('0x10')](_0x32e8e6,![],null)));});ami['on'](_0x6083('0x1d'),function(_0x31101e){logger[_0x6083('0x18')](util[_0x6083('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x6083('0x6')][_0x6083('0x7')],config[_0x6083('0x6')]['ip'],config[_0x6083('0x6')][_0x6083('0xf')]));return BPromise[_0x6083('0x1e')]()[_0x6083('0x1f')](ami['actionSipShowRegistry']())[_0x6083('0x1f')](ami[_0x6083('0x13')]())[_0x6083('0x1f')](ami[_0x6083('0x14')]())[_0x6083('0x1f')](ami[_0x6083('0x20')]())[_0x6083('0x1f')](ami[_0x6083('0x16')]())[_0x6083('0x21')](function(_0x3b4159){console['log'](_0x3b4159);});});ami['once']('error',error);ami[_0x6083('0x19')](_0x6083('0x22'),close);module[_0x6083('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index af6007c..2c14cc2 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x5a560e,_0x3ccea6){var _0x4e2db=function(_0x1f8cf0){while(--_0x1f8cf0){_0x5a560e['push'](_0x5a560e['shift']());}};_0x4e2db(++_0x3ccea6);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4e7306,_0x51515f){_0x4e7306=_0x4e7306-0x0;var _0x403bbe=_0xbdb7[_0x4e7306];return _0x403bbe;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0xb7e7,0x121));var _0x7b7e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb7e7[_0xd1d19a];return _0x52a79d;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index a70e703..fbb7f17 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15e9=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','string','voiceQueue','name','Contact','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x15e9,0xb8));var _0x915e=function(_0xe7446d,_0x5185b3){_0xe7446d=_0xe7446d-0x0;var _0x3c1196=_0x15e9[_0xe7446d];return _0x3c1196;};'use strict';var util=require(_0x915e('0x0'));var _=require(_0x915e('0x1'));var moment=require(_0x915e('0x2'));function checkNameSurname(_0x27b351,_0x2e243e,_0x40df89){var _0x48e329='';if(!_['isNil'](_0x2e243e)&&_0x915e('0x3')===typeof _0x2e243e){_0x48e329+=_0x2e243e;}if(!_['isNil'](_0x40df89)&&_0x915e('0x3')===typeof _0x40df89){_0x48e329+='\x20'+_0x40df89;}if(_0x48e329!==''){return _0x48e329;}return _0x27b351;}function Action(_0x4846a1,_0x308386,_0x53d3a9){this[_0x915e('0x4')]=_0x4846a1;this['uniqueid']=_0x53d3a9||undefined;this[_0x915e('0x5')]=checkNameSurname(_0x308386[_0x915e('0x6')]['phone'],_0x308386['Contact'][_0x915e('0x7')],_0x308386[_0x915e('0x6')]['lastName']);this[_0x915e('0x8')]=_0x308386['phone'];this[_0x915e('0x9')]=_0x4846a1['name'];this[_0x915e('0xa')]=_0x308386[_0x915e('0xa')]||![];this[_0x915e('0xb')]=_0x4846a1['type'];this[_0x915e('0xc')]=_0x4846a1[_0x915e('0xc')]||0x3;this[_0x915e('0xd')]=_0x308386['scheduledat'];this['countbusyretry']=_0x308386['countbusyretry'];this[_0x915e('0xe')]=_0x308386[_0x915e('0xe')];this['countnoanswerretry']=_0x308386[_0x915e('0xf')];this['countnosuchnumberretry']=_0x308386['countnosuchnumberretry'];this[_0x915e('0x10')]=_0x308386[_0x915e('0x10')];this[_0x915e('0x11')]=_0x308386[_0x915e('0x11')];this[_0x915e('0x12')]=_0x308386[_0x915e('0x12')];this[_0x915e('0x13')]=_0x308386[_0x915e('0x13')];this[_0x915e('0x14')]=_0x308386[_0x915e('0x14')];this['ListId']=_0x308386['ListId'];this[_0x915e('0x15')]=_0x308386[_0x915e('0x15')];this['VoiceQueueId']=_0x308386[_0x915e('0x16')];this[_0x915e('0x17')]=_0x308386[_0x915e('0x17')];this[_0x915e('0x18')]=_0x308386['id'];this[_0x915e('0x19')]=_0x308386[_0x915e('0x6')][_0x915e('0x7')]||'';this[_0x915e('0x1a')]=moment()[_0x915e('0x1b')](_0x915e('0x1c'));this[_0x915e('0x1d')]=_0x308386[_0x915e('0x1d')];this[_0x915e('0x1e')]=_0x308386[_0x915e('0x1e')];this[_0x915e('0x1f')]=_0x308386[_0x915e('0x1f')];this[_0x915e('0x20')]=_0x308386[_0x915e('0x20')];this[_0x915e('0x21')]='';this[_0x915e('0x22')]='';}Action[_0x915e('0x23')]['getCaller']=function(){return util[_0x915e('0x1b')](_0x915e('0x24'),this['name'],this[_0x915e('0x4')][_0x915e('0x25')]>0x0?this[_0x915e('0x8')][_0x915e('0x26')](this[_0x915e('0x4')][_0x915e('0x25')]):this[_0x915e('0x8')]);};Action[_0x915e('0x23')][_0x915e('0x27')]=function(){return this[_0x915e('0x9')];};module[_0x915e('0x28')]=Action; \ No newline at end of file +var _0x5644=['phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5644,0x15f));var _0x4564=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x5644[_0xb0fe92];return _0x41787f;};'use strict';var util=require(_0x4564('0x0'));var _=require(_0x4564('0x1'));var moment=require(_0x4564('0x2'));function checkNameSurname(_0x2e7e25,_0x45f656,_0x396144){var _0x9363f0='';if(!_[_0x4564('0x3')](_0x45f656)&&_0x4564('0x4')===typeof _0x45f656){_0x9363f0+=_0x45f656;}if(!_['isNil'](_0x396144)&&_0x4564('0x4')===typeof _0x396144){_0x9363f0+='\x20'+_0x396144;}if(_0x9363f0!==''){return _0x9363f0;}return _0x2e7e25;}function Action(_0x16ada2,_0xf50dab,_0xbc2c1f){this[_0x4564('0x5')]=_0x16ada2;this[_0x4564('0x6')]=_0xbc2c1f||undefined;this[_0x4564('0x7')]=checkNameSurname(_0xf50dab[_0x4564('0x8')][_0x4564('0x9')],_0xf50dab[_0x4564('0x8')][_0x4564('0xa')],_0xf50dab[_0x4564('0x8')][_0x4564('0xb')]);this[_0x4564('0xc')]=_0xf50dab['phone'];this[_0x4564('0xd')]=_0x16ada2['name'];this[_0x4564('0xe')]=_0xf50dab[_0x4564('0xe')]||![];this[_0x4564('0xf')]=_0x16ada2[_0x4564('0xf')];this[_0x4564('0x10')]=_0x16ada2[_0x4564('0x10')]||0x3;this[_0x4564('0x11')]=_0xf50dab[_0x4564('0x11')];this[_0x4564('0x12')]=_0xf50dab[_0x4564('0x12')];this[_0x4564('0x13')]=_0xf50dab[_0x4564('0x13')];this[_0x4564('0x14')]=_0xf50dab['countnoanswerretry'];this['countnosuchnumberretry']=_0xf50dab[_0x4564('0x15')];this[_0x4564('0x16')]=_0xf50dab['countdropretry'];this[_0x4564('0x17')]=_0xf50dab[_0x4564('0x17')];this['countmachineretry']=_0xf50dab['countmachineretry'];this[_0x4564('0x18')]=_0xf50dab[_0x4564('0x18')];this[_0x4564('0x19')]=_0xf50dab[_0x4564('0x19')];this[_0x4564('0x1a')]=_0xf50dab[_0x4564('0x1a')];this[_0x4564('0x1b')]=_0xf50dab[_0x4564('0x1b')];this[_0x4564('0x1c')]=_0xf50dab[_0x4564('0x1c')];this[_0x4564('0x1d')]=_0xf50dab[_0x4564('0x1d')];this[_0x4564('0x1e')]=_0xf50dab['id'];this['ContactFirstName']=_0xf50dab[_0x4564('0x8')][_0x4564('0xa')]||'';this[_0x4564('0x1f')]=moment()[_0x4564('0x20')](_0x4564('0x21'));this['callback']=_0xf50dab[_0x4564('0x22')];this[_0x4564('0x23')]=_0xf50dab[_0x4564('0x23')];this[_0x4564('0x24')]=_0xf50dab[_0x4564('0x24')];this[_0x4564('0x25')]=_0xf50dab['recallme'];this[_0x4564('0x26')]='';this[_0x4564('0x27')]='';}Action[_0x4564('0x28')]['getCaller']=function(){return util['format'](_0x4564('0x29'),this[_0x4564('0x7')],this['voiceQueue'][_0x4564('0x2a')]>0x0?this['number'][_0x4564('0x2b')](this[_0x4564('0x5')]['dialCutDigit']):this[_0x4564('0xc')]);};Action['prototype']['getQueue']=function(){return this[_0x4564('0xd')];};module[_0x4564('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index f004f69..ed237c1 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x076e=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','name','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x474aaf,_0x3e92fc){var _0x31d1a5=function(_0x2cebc4){while(--_0x2cebc4){_0x474aaf['push'](_0x474aaf['shift']());}};_0x31d1a5(++_0x3e92fc);}(_0x076e,0x13c));var _0xe076=function(_0x358475,_0x4e46be){_0x358475=_0x358475-0x0;var _0x14b7ba=_0x076e[_0x358475];return _0x14b7ba;};'use strict';var util=require('util');var _=require(_0xe076('0x0'));var moment=require('moment');function getSeconds(_0x16d4ea,_0x4ad81c){var _0x3149da=moment(_0x16d4ea)['milliseconds'](0x0);var _0x53cec4=moment(_0x4ad81c)[_0xe076('0x1')](0x0);return _0x3149da[_0xe076('0x2')](_0x53cec4,_0xe076('0x3'));}function AdditionalPhone(_0x45ebe0){this[_0xe076('0x4')]=_0x45ebe0['uniqueid'];this[_0xe076('0x5')]=_0x45ebe0[_0xe076('0x5')]||undefined;this[_0xe076('0x6')]=_0x45ebe0[_0xe076('0x6')];this[_0xe076('0x7')]=_0x45ebe0['type']===_0xe076('0x8')?'queue':_0x45ebe0[_0xe076('0x6')];this[_0xe076('0x9')]=_0x45ebe0['countbusyretry'];this[_0xe076('0xa')]=_0x45ebe0['countcongestionretry'];this[_0xe076('0xb')]=_0x45ebe0[_0xe076('0xb')];this[_0xe076('0xc')]=_0x45ebe0[_0xe076('0x9')]+_0x45ebe0[_0xe076('0xa')]+_0x45ebe0[_0xe076('0xb')]+_0x45ebe0[_0xe076('0xd')]+_0x45ebe0[_0xe076('0xe')]+_0x45ebe0['countabandonedretry']+_0x45ebe0[_0xe076('0xf')]+_0x45ebe0[_0xe076('0x10')];this[_0xe076('0xd')]=_0x45ebe0[_0xe076('0xd')];this[_0xe076('0xe')]=_0x45ebe0['countdropretry'];this[_0xe076('0x11')]=_0x45ebe0[_0xe076('0x11')];this['countmachineretry']=_0x45ebe0[_0xe076('0xf')];this['countagentrejectretry']=_0x45ebe0[_0xe076('0x10')];this[_0xe076('0x12')]=_0x45ebe0[_0xe076('0x12')];this[_0xe076('0x13')]=_0x45ebe0[_0xe076('0x14')];this['calleridnum']=_0x45ebe0['number'];this[_0xe076('0x15')]=_0x45ebe0[_0xe076('0x15')];this[_0xe076('0x16')]=_0x45ebe0[_0xe076('0x16')];this[_0xe076('0x17')]=_0x45ebe0[_0xe076('0x16')];this[_0xe076('0x18')]=getSeconds(_0x45ebe0[_0xe076('0x16')],_0x45ebe0[_0xe076('0x15')]);this[_0xe076('0x19')]=0x0;this['talktime']=0x0;this[_0xe076('0x1a')]=_0x45ebe0[_0xe076('0x1a')];this['callbackuniqueid']=_0x45ebe0[_0xe076('0x1b')];this[_0xe076('0x1c')]=_0x45ebe0[_0xe076('0x1c')];this[_0xe076('0x1d')]=_0x45ebe0[_0xe076('0x1d')];this['ContactId']=_0x45ebe0[_0xe076('0x1e')];this['ListId']=_0x45ebe0[_0xe076('0x1f')];this[_0xe076('0x20')]=_0x45ebe0[_0xe076('0x20')];this[_0xe076('0x21')]=_0x45ebe0[_0xe076('0x21')];this['CampaignId']=_0x45ebe0[_0xe076('0x22')];this['originatecalleridnum']=_0x45ebe0[_0xe076('0x23')]||'';this[_0xe076('0x24')]=_0x45ebe0[_0xe076('0x24')]||'';}module[_0xe076('0x25')]=History; \ No newline at end of file +var _0xe678=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe678,0x1ee));var _0x8e67=function(_0x36f104,_0xfae805){_0x36f104=_0x36f104-0x0;var _0x985b3d=_0xe678[_0x36f104];return _0x985b3d;};'use strict';var util=require(_0x8e67('0x0'));var _=require(_0x8e67('0x1'));var moment=require(_0x8e67('0x2'));function getSeconds(_0x3b8d38,_0x436e43){var _0x4112c6=moment(_0x3b8d38)[_0x8e67('0x3')](0x0);var _0x34091c=moment(_0x436e43)[_0x8e67('0x3')](0x0);return _0x4112c6[_0x8e67('0x4')](_0x34091c,_0x8e67('0x5'));}function AdditionalPhone(_0x58f8bd){this['uniqueid']=_0x58f8bd['uniqueid'];this['scheduledat']=_0x58f8bd['scheduledat']||undefined;this[_0x8e67('0x6')]=_0x58f8bd[_0x8e67('0x6')];this['campaigntype']=_0x58f8bd['type']===_0x8e67('0x7')?_0x8e67('0x8'):_0x58f8bd['type'];this[_0x8e67('0x9')]=_0x58f8bd['countbusyretry'];this[_0x8e67('0xa')]=_0x58f8bd[_0x8e67('0xa')];this[_0x8e67('0xb')]=_0x58f8bd[_0x8e67('0xb')];this[_0x8e67('0xc')]=_0x58f8bd[_0x8e67('0x9')]+_0x58f8bd[_0x8e67('0xa')]+_0x58f8bd['countnoanswerretry']+_0x58f8bd['countnosuchnumberretry']+_0x58f8bd[_0x8e67('0xd')]+_0x58f8bd[_0x8e67('0xe')]+_0x58f8bd[_0x8e67('0xf')]+_0x58f8bd[_0x8e67('0x10')];this[_0x8e67('0x11')]=_0x58f8bd[_0x8e67('0x11')];this[_0x8e67('0xd')]=_0x58f8bd['countdropretry'];this[_0x8e67('0xe')]=_0x58f8bd['countabandonedretry'];this[_0x8e67('0xf')]=_0x58f8bd[_0x8e67('0xf')];this['countagentrejectretry']=_0x58f8bd[_0x8e67('0x10')];this[_0x8e67('0x8')]=_0x58f8bd[_0x8e67('0x8')];this[_0x8e67('0x12')]=_0x58f8bd[_0x8e67('0x13')];this[_0x8e67('0x14')]=_0x58f8bd[_0x8e67('0x15')];this[_0x8e67('0x16')]=_0x58f8bd[_0x8e67('0x16')];this[_0x8e67('0x17')]=_0x58f8bd[_0x8e67('0x17')];this['endtime']=_0x58f8bd[_0x8e67('0x17')];this[_0x8e67('0x18')]=getSeconds(_0x58f8bd['responsetime'],_0x58f8bd['starttime']);this[_0x8e67('0x19')]=0x0;this[_0x8e67('0x1a')]=0x0;this[_0x8e67('0x1b')]=_0x58f8bd[_0x8e67('0x1b')];this[_0x8e67('0x1c')]=_0x58f8bd[_0x8e67('0x1c')];this[_0x8e67('0x1d')]=_0x58f8bd[_0x8e67('0x1d')];this[_0x8e67('0x1e')]=_0x58f8bd['recallme'];this[_0x8e67('0x1f')]=_0x58f8bd[_0x8e67('0x1f')];this['ListId']=_0x58f8bd[_0x8e67('0x20')];this[_0x8e67('0x21')]=_0x58f8bd[_0x8e67('0x21')];this[_0x8e67('0x22')]=_0x58f8bd[_0x8e67('0x22')];this[_0x8e67('0x23')]=_0x58f8bd[_0x8e67('0x23')];this[_0x8e67('0x24')]=_0x58f8bd[_0x8e67('0x24')]||'';this[_0x8e67('0x25')]=_0x58f8bd[_0x8e67('0x25')]||'';}module[_0x8e67('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index f452863..f7be948 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7317=['endtime','format','ringtime','starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime'];(function(_0x150068,_0x14db51){var _0x8ca19b=function(_0x4c0126){while(--_0x4c0126){_0x150068['push'](_0x150068['shift']());}};_0x8ca19b(++_0x14db51);}(_0x7317,0x1c4));var _0x7731=function(_0x5b0aa3,_0x2b4e51){_0x5b0aa3=_0x5b0aa3-0x0;var _0xf0668=_0x7317[_0x5b0aa3];return _0xf0668;};'use strict';var util=require('util');var _=require(_0x7731('0x0'));var moment=require(_0x7731('0x1'));function getSeconds(_0x3f572e,_0x1b0e57){var _0x33aa2f=moment(_0x3f572e)[_0x7731('0x2')](0x0);var _0x1f1da1=moment(_0x1b0e57)['milliseconds'](0x0);return _0x33aa2f[_0x7731('0x3')](_0x1f1da1,_0x7731('0x4'));}function AgentComplete(_0x465393,_0x2cc2c2){this[_0x7731('0x5')]=0x4;this[_0x7731('0x6')]='Answer';this[_0x7731('0x7')]=_0x465393[_0x7731('0x7')];this[_0x7731('0x8')]=_0x465393[_0x7731('0x8')];this[_0x7731('0x9')]=_0x465393[_0x7731('0x8')]===_0x7731('0xa')?_0x7731('0xb'):_0x465393[_0x7731('0x8')];this['countbusyretry']=_0x465393['countbusyretry'];this['countcongestionretry']=_0x465393[_0x7731('0xc')];this[_0x7731('0xd')]=_0x465393[_0x7731('0xd')];this[_0x7731('0xe')]=_0x465393[_0x7731('0xf')]+_0x465393[_0x7731('0xc')]+_0x465393[_0x7731('0xd')]+_0x465393[_0x7731('0x10')]+_0x465393[_0x7731('0x11')]+_0x465393[_0x7731('0x12')]+_0x465393[_0x7731('0x13')]+_0x465393['countagentrejectretry'];this['countnosuchnumberretry']=_0x465393['countnosuchnumberretry'];this[_0x7731('0x11')]=_0x465393['countdropretry'];this['countabandonedretry']=_0x465393[_0x7731('0x12')];this['countmachineretry']=_0x465393[_0x7731('0x13')];this[_0x7731('0x14')]=_0x465393['countagentrejectretry'];this[_0x7731('0x15')]=_0x2cc2c2[_0x7731('0x15')];this[_0x7731('0x16')]=_0x465393[_0x7731('0x17')];this[_0x7731('0x18')]=_0x465393[_0x7731('0x19')];this['starttime']=_0x465393['starttime'];this[_0x7731('0x1a')]=_0x465393[_0x7731('0x1a')];this[_0x7731('0x1b')]=_0x465393[_0x7731('0x1b')];this[_0x7731('0x1c')]=moment()[_0x7731('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7731('0x1e')]=getSeconds(_0x465393[_0x7731('0x1a')],_0x465393[_0x7731('0x1f')]);this[_0x7731('0x20')]=getSeconds(_0x465393[_0x7731('0x1b')],_0x465393[_0x7731('0x1a')]);this[_0x7731('0x21')]=getSeconds(this['endtime'],_0x465393['answertime']);this[_0x7731('0xb')]=_0x2cc2c2[_0x7731('0xb')];this[_0x7731('0x22')]=_0x2cc2c2[_0x7731('0x22')];this['reason']=_0x2cc2c2[_0x7731('0x23')];this[_0x7731('0x24')]=_0x465393[_0x7731('0x24')];this[_0x7731('0x25')]=_0x465393[_0x7731('0x25')];this[_0x7731('0x26')]=_0x465393[_0x7731('0x26')];this[_0x7731('0x27')]=_0x465393[_0x7731('0x27')];this[_0x7731('0x28')]=_0x465393[_0x7731('0x28')];this['ListId']=_0x465393[_0x7731('0x29')];this[_0x7731('0x2a')]=_0x465393[_0x7731('0x2a')];this[_0x7731('0x2b')]=_0x465393[_0x7731('0x2b')];this[_0x7731('0x2c')]=_0x465393[_0x7731('0x2c')];this[_0x7731('0x2d')]=_0x465393['originatecalleridnum']||'';this[_0x7731('0x2e')]=_0x465393[_0x7731('0x2e')]||'';}module[_0x7731('0x2f')]=AgentComplete; \ No newline at end of file +var _0x7918=['number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum'];(function(_0x43a5c3,_0x3ac4d5){var _0x2cd48b=function(_0x474672){while(--_0x474672){_0x43a5c3['push'](_0x43a5c3['shift']());}};_0x2cd48b(++_0x3ac4d5);}(_0x7918,0x109));var _0x8791=function(_0x5c80c1,_0x4f80ca){_0x5c80c1=_0x5c80c1-0x0;var _0xb74ac=_0x7918[_0x5c80c1];return _0xb74ac;};'use strict';var util=require('util');var _=require(_0x8791('0x0'));var moment=require(_0x8791('0x1'));function getSeconds(_0x2b83a0,_0x4a8109){var _0x4ba646=moment(_0x2b83a0)['milliseconds'](0x0);var _0x10a386=moment(_0x4a8109)[_0x8791('0x2')](0x0);return _0x4ba646[_0x8791('0x3')](_0x10a386,'seconds');}function AgentComplete(_0x44fb00,_0x4e006f){this['state']=0x4;this[_0x8791('0x4')]=_0x8791('0x5');this['scheduledat']=_0x44fb00[_0x8791('0x6')];this[_0x8791('0x7')]=_0x44fb00['type'];this[_0x8791('0x8')]=_0x44fb00[_0x8791('0x7')]===_0x8791('0x9')?'queue':_0x44fb00[_0x8791('0x7')];this[_0x8791('0xa')]=_0x44fb00[_0x8791('0xa')];this[_0x8791('0xb')]=_0x44fb00[_0x8791('0xb')];this[_0x8791('0xc')]=_0x44fb00[_0x8791('0xc')];this[_0x8791('0xd')]=_0x44fb00[_0x8791('0xa')]+_0x44fb00[_0x8791('0xb')]+_0x44fb00[_0x8791('0xc')]+_0x44fb00['countnosuchnumberretry']+_0x44fb00['countdropretry']+_0x44fb00['countabandonedretry']+_0x44fb00[_0x8791('0xe')]+_0x44fb00[_0x8791('0xf')];this[_0x8791('0x10')]=_0x44fb00[_0x8791('0x10')];this[_0x8791('0x11')]=_0x44fb00[_0x8791('0x11')];this['countabandonedretry']=_0x44fb00[_0x8791('0x12')];this[_0x8791('0xe')]=_0x44fb00['countmachineretry'];this[_0x8791('0xf')]=_0x44fb00[_0x8791('0xf')];this[_0x8791('0x13')]=_0x4e006f[_0x8791('0x13')];this[_0x8791('0x14')]=_0x44fb00[_0x8791('0x15')];this[_0x8791('0x16')]=_0x44fb00[_0x8791('0x17')];this[_0x8791('0x18')]=_0x44fb00[_0x8791('0x18')];this[_0x8791('0x19')]=_0x44fb00['responsetime'];this[_0x8791('0x1a')]=_0x44fb00['answertime'];this['endtime']=moment()[_0x8791('0x1b')](_0x8791('0x1c'));this[_0x8791('0x1d')]=getSeconds(_0x44fb00[_0x8791('0x19')],_0x44fb00['starttime']);this[_0x8791('0x1e')]=getSeconds(_0x44fb00[_0x8791('0x1a')],_0x44fb00[_0x8791('0x19')]);this[_0x8791('0x1f')]=getSeconds(this[_0x8791('0x20')],_0x44fb00[_0x8791('0x1a')]);this[_0x8791('0x21')]=_0x4e006f[_0x8791('0x21')];this[_0x8791('0x22')]=_0x4e006f['membername'];this[_0x8791('0x23')]=_0x4e006f['reason'];this['callback']=_0x44fb00[_0x8791('0x24')];this[_0x8791('0x25')]=_0x44fb00[_0x8791('0x25')];this['callbackat']=_0x44fb00[_0x8791('0x26')];this[_0x8791('0x27')]=_0x44fb00[_0x8791('0x27')];this[_0x8791('0x28')]=_0x44fb00['ContactId'];this[_0x8791('0x29')]=_0x44fb00['ListId'];this['UserId']=_0x44fb00[_0x8791('0x2a')];this[_0x8791('0x2b')]=_0x44fb00[_0x8791('0x2b')];this[_0x8791('0x2c')]=_0x44fb00[_0x8791('0x2c')];this[_0x8791('0x2d')]=_0x44fb00[_0x8791('0x2d')]||'';this['originatecalleridname']=_0x44fb00[_0x8791('0x2e')]||'';}module[_0x8791('0x2f')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index cac5090..57502e2 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5075=['seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff'];(function(_0x30c19a,_0x31e308){var _0xbe7598=function(_0x51ec6e){while(--_0x51ec6e){_0x30c19a['push'](_0x30c19a['shift']());}};_0xbe7598(++_0x31e308);}(_0x5075,0x73));var _0x5507=function(_0xeeb6dd,_0x3e5f7b){_0xeeb6dd=_0xeeb6dd-0x0;var _0x95d347=_0x5075[_0xeeb6dd];return _0x95d347;};'use strict';var util=require(_0x5507('0x0'));var _=require(_0x5507('0x1'));var moment=require(_0x5507('0x2'));function getSeconds(_0x1a552a,_0x3ec62f){var _0x2b444e=moment(_0x1a552a)[_0x5507('0x3')](0x0);var _0x518ca7=moment(_0x3ec62f)[_0x5507('0x3')](0x0);return _0x2b444e[_0x5507('0x4')](_0x518ca7,_0x5507('0x5'));}function Final(_0x54267f){this['uniqueid']=_0x54267f[_0x5507('0x6')];this[_0x5507('0x7')]=_0x54267f['scheduledat'];this[_0x5507('0x8')]=_0x54267f[_0x5507('0x8')];this[_0x5507('0x9')]=_0x54267f['type']==='outbound'?_0x5507('0xa'):_0x54267f[_0x5507('0x8')];this[_0x5507('0xb')]=_0x54267f[_0x5507('0xb')];this['countcongestionretry']=_0x54267f[_0x5507('0xc')];this[_0x5507('0xd')]=_0x54267f['countnoanswerretry'];this[_0x5507('0xe')]=_0x54267f[_0x5507('0xb')]+_0x54267f['countcongestionretry']+_0x54267f[_0x5507('0xd')]+_0x54267f[_0x5507('0xf')]+_0x54267f[_0x5507('0x10')]+_0x54267f[_0x5507('0x11')]+_0x54267f[_0x5507('0x12')]+_0x54267f[_0x5507('0x13')];this['countnosuchnumberretry']=_0x54267f[_0x5507('0xf')];this[_0x5507('0x10')]=_0x54267f[_0x5507('0x10')];this[_0x5507('0x11')]=_0x54267f['countabandonedretry'];this[_0x5507('0x12')]=_0x54267f[_0x5507('0x12')];this[_0x5507('0x13')]=_0x54267f[_0x5507('0x13')];this[_0x5507('0xa')]=_0x54267f[_0x5507('0xa')];this[_0x5507('0x14')]=_0x54267f[_0x5507('0x14')];this[_0x5507('0x15')]=_0x54267f[_0x5507('0x15')];this[_0x5507('0x16')]=_0x54267f[_0x5507('0x16')];this[_0x5507('0x17')]=_0x54267f['responsetime'];this[_0x5507('0x18')]=_0x54267f[_0x5507('0x17')];this[_0x5507('0x19')]=_0x54267f[_0x5507('0x19')]||0x0;this['holdtime']=_0x54267f[_0x5507('0x1a')]||0x0;this[_0x5507('0x1b')]=_0x54267f[_0x5507('0x1b')]||0x0;this[_0x5507('0x1c')]=_0x54267f[_0x5507('0x1c')];this[_0x5507('0x1d')]=_0x54267f['callbackuniqueid'];this[_0x5507('0x1e')]=_0x54267f[_0x5507('0x1e')];this[_0x5507('0x1f')]=_0x54267f[_0x5507('0x1f')];this[_0x5507('0x20')]=_0x54267f[_0x5507('0x20')];this[_0x5507('0x21')]=_0x54267f[_0x5507('0x21')];this[_0x5507('0x22')]=_0x54267f[_0x5507('0x22')];this[_0x5507('0x23')]=_0x54267f[_0x5507('0x23')];this[_0x5507('0x24')]=_0x54267f[_0x5507('0x24')];this[_0x5507('0x25')]=_0x54267f['originatecalleridnum']||'';this[_0x5507('0x26')]=_0x54267f['originatecalleridname']||'';}module[_0x5507('0x27')]=Final; \ No newline at end of file +var _0xbd50=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xbd50,0x196));var _0x0bd5=function(_0x53d74f,_0x22463f){_0x53d74f=_0x53d74f-0x0;var _0x4cfd67=_0xbd50[_0x53d74f];return _0x4cfd67;};'use strict';var util=require(_0x0bd5('0x0'));var _=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));function getSeconds(_0x4acbd6,_0x44fcb9){var _0x167372=moment(_0x4acbd6)[_0x0bd5('0x3')](0x0);var _0x1e9877=moment(_0x44fcb9)[_0x0bd5('0x3')](0x0);return _0x167372['diff'](_0x1e9877,'seconds');}function Final(_0x560cf1){this[_0x0bd5('0x4')]=_0x560cf1[_0x0bd5('0x4')];this[_0x0bd5('0x5')]=_0x560cf1[_0x0bd5('0x5')];this[_0x0bd5('0x6')]=_0x560cf1['type'];this['campaigntype']=_0x560cf1[_0x0bd5('0x6')]===_0x0bd5('0x7')?_0x0bd5('0x8'):_0x560cf1['type'];this[_0x0bd5('0x9')]=_0x560cf1[_0x0bd5('0x9')];this['countcongestionretry']=_0x560cf1[_0x0bd5('0xa')];this[_0x0bd5('0xb')]=_0x560cf1['countnoanswerretry'];this[_0x0bd5('0xc')]=_0x560cf1[_0x0bd5('0x9')]+_0x560cf1[_0x0bd5('0xa')]+_0x560cf1['countnoanswerretry']+_0x560cf1[_0x0bd5('0xd')]+_0x560cf1[_0x0bd5('0xe')]+_0x560cf1[_0x0bd5('0xf')]+_0x560cf1[_0x0bd5('0x10')]+_0x560cf1[_0x0bd5('0x11')];this[_0x0bd5('0xd')]=_0x560cf1[_0x0bd5('0xd')];this[_0x0bd5('0xe')]=_0x560cf1['countdropretry'];this[_0x0bd5('0xf')]=_0x560cf1[_0x0bd5('0xf')];this['countmachineretry']=_0x560cf1[_0x0bd5('0x10')];this[_0x0bd5('0x11')]=_0x560cf1[_0x0bd5('0x11')];this[_0x0bd5('0x8')]=_0x560cf1['queue'];this[_0x0bd5('0x12')]=_0x560cf1[_0x0bd5('0x12')];this[_0x0bd5('0x13')]=_0x560cf1[_0x0bd5('0x13')];this[_0x0bd5('0x14')]=_0x560cf1[_0x0bd5('0x14')];this[_0x0bd5('0x15')]=_0x560cf1[_0x0bd5('0x15')];this[_0x0bd5('0x16')]=_0x560cf1[_0x0bd5('0x15')];this[_0x0bd5('0x17')]=_0x560cf1[_0x0bd5('0x17')]||0x0;this[_0x0bd5('0x18')]=_0x560cf1[_0x0bd5('0x18')]||0x0;this['talktime']=_0x560cf1['talktime']||0x0;this['callback']=_0x560cf1['callback'];this['callbackuniqueid']=_0x560cf1[_0x0bd5('0x19')];this[_0x0bd5('0x1a')]=_0x560cf1[_0x0bd5('0x1a')];this[_0x0bd5('0x1b')]=_0x560cf1[_0x0bd5('0x1b')];this['ContactId']=_0x560cf1[_0x0bd5('0x1c')];this[_0x0bd5('0x1d')]=_0x560cf1[_0x0bd5('0x1d')];this['UserId']=_0x560cf1[_0x0bd5('0x1e')];this['VoiceQueueId']=_0x560cf1['VoiceQueueId'];this[_0x0bd5('0x1f')]=_0x560cf1[_0x0bd5('0x1f')];this[_0x0bd5('0x20')]=_0x560cf1['originatecalleridnum']||'';this[_0x0bd5('0x21')]=_0x560cf1['originatecalleridname']||'';}module[_0x0bd5('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index c51ca28..508cc0a 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28be=['milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','endtime','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash'];(function(_0x1ca9a0,_0x17be2b){var _0x4a80d6=function(_0x31962d){while(--_0x31962d){_0x1ca9a0['push'](_0x1ca9a0['shift']());}};_0x4a80d6(++_0x17be2b);}(_0x28be,0x7c));var _0xe28b=function(_0x1526b5,_0x497bca){_0x1526b5=_0x1526b5-0x0;var _0x12dbdc=_0x28be[_0x1526b5];return _0x12dbdc;};'use strict';var util=require(_0xe28b('0x0'));var _=require(_0xe28b('0x1'));var moment=require('moment');function getSeconds(_0x14a0e2,_0x1d46ff){var _0x57b611=moment(_0x14a0e2)[_0xe28b('0x2')](0x0);var _0x344a89=moment(_0x1d46ff)[_0xe28b('0x2')](0x0);return _0x57b611[_0xe28b('0x3')](_0x344a89,'seconds');}function Hangup(_0x478fc0,_0x10e815){this[_0xe28b('0x4')]=0x4;this['statedesc']=_0xe28b('0x5');this[_0xe28b('0x6')]=_0x478fc0[_0xe28b('0x6')];this[_0xe28b('0x7')]=_0x478fc0[_0xe28b('0x7')];this[_0xe28b('0x8')]=_0x478fc0[_0xe28b('0x7')]===_0xe28b('0x9')?_0xe28b('0xa'):_0x478fc0[_0xe28b('0x7')];this[_0xe28b('0xb')]=_0x478fc0[_0xe28b('0xb')];this[_0xe28b('0xc')]=_0x478fc0[_0xe28b('0xc')];this[_0xe28b('0xd')]=_0x478fc0[_0xe28b('0xd')];this['countglobal']=_0x478fc0[_0xe28b('0xb')]+_0x478fc0[_0xe28b('0xc')]+_0x478fc0[_0xe28b('0xd')]+_0x478fc0[_0xe28b('0xe')]+_0x478fc0[_0xe28b('0xf')]+_0x478fc0[_0xe28b('0x10')]+_0x478fc0['countmachineretry']+_0x478fc0[_0xe28b('0x11')];this[_0xe28b('0xe')]=_0x478fc0[_0xe28b('0xe')];this['countdropretry']=_0x478fc0['countdropretry'];this[_0xe28b('0x10')]=_0x478fc0[_0xe28b('0x10')];this['countmachineretry']=_0x478fc0[_0xe28b('0x12')];this[_0xe28b('0x11')]=_0x478fc0[_0xe28b('0x11')];this[_0xe28b('0x13')]=_0x10e815['uniqueid'];this[_0xe28b('0x14')]=_0x478fc0['name'];this[_0xe28b('0x15')]=_0x478fc0[_0xe28b('0x16')];this[_0xe28b('0x17')]=_0x478fc0[_0xe28b('0x17')];this[_0xe28b('0x18')]=_0x478fc0['responsetime'];this['endtime']=moment()[_0xe28b('0x19')](_0xe28b('0x1a'));this[_0xe28b('0x1b')]=getSeconds(_0x478fc0[_0xe28b('0x18')],_0x478fc0[_0xe28b('0x17')]);this[_0xe28b('0x1c')]=0x0;this['talktime']=getSeconds(this[_0xe28b('0x1d')],_0x478fc0['responsetime']);this[_0xe28b('0xa')]=_0x478fc0[_0xe28b('0xa')];this['membername']=_0xe28b('0x1e');this[_0xe28b('0x1f')]=_0x10e815['cause-txt'];this['callback']=_0x478fc0[_0xe28b('0x20')];this[_0xe28b('0x21')]=_0x478fc0['callbackuniqueid'];this[_0xe28b('0x22')]=_0x478fc0[_0xe28b('0x22')];this[_0xe28b('0x23')]=_0x478fc0['recallme'];this[_0xe28b('0x24')]=_0x478fc0['ContactId'];this[_0xe28b('0x25')]=_0x478fc0['ListId'];this['UserId']=_0x478fc0[_0xe28b('0x26')];this[_0xe28b('0x27')]=_0x478fc0[_0xe28b('0x27')];this[_0xe28b('0x28')]=_0x478fc0[_0xe28b('0x28')];}module[_0xe28b('0x29')]=Hangup; \ No newline at end of file +var _0x4ebd=['IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x4ebd,0xe8));var _0xd4eb=function(_0x324a4c,_0xae0424){_0x324a4c=_0x324a4c-0x0;var _0x3211d9=_0x4ebd[_0x324a4c];return _0x3211d9;};'use strict';var util=require(_0xd4eb('0x0'));var _=require(_0xd4eb('0x1'));var moment=require(_0xd4eb('0x2'));function getSeconds(_0x496247,_0x3bf05e){var _0xf18f71=moment(_0x496247)[_0xd4eb('0x3')](0x0);var _0x2640c3=moment(_0x3bf05e)['milliseconds'](0x0);return _0xf18f71[_0xd4eb('0x4')](_0x2640c3,_0xd4eb('0x5'));}function Hangup(_0x2d4b33,_0x3668fb){this[_0xd4eb('0x6')]=0x4;this[_0xd4eb('0x7')]=_0xd4eb('0x8');this['scheduledat']=_0x2d4b33[_0xd4eb('0x9')];this[_0xd4eb('0xa')]=_0x2d4b33['type'];this[_0xd4eb('0xb')]=_0x2d4b33['type']==='outbound'?_0xd4eb('0xc'):_0x2d4b33[_0xd4eb('0xa')];this['countbusyretry']=_0x2d4b33['countbusyretry'];this[_0xd4eb('0xd')]=_0x2d4b33[_0xd4eb('0xd')];this['countnoanswerretry']=_0x2d4b33[_0xd4eb('0xe')];this[_0xd4eb('0xf')]=_0x2d4b33[_0xd4eb('0x10')]+_0x2d4b33[_0xd4eb('0xd')]+_0x2d4b33['countnoanswerretry']+_0x2d4b33[_0xd4eb('0x11')]+_0x2d4b33['countdropretry']+_0x2d4b33[_0xd4eb('0x12')]+_0x2d4b33[_0xd4eb('0x13')]+_0x2d4b33[_0xd4eb('0x14')];this[_0xd4eb('0x11')]=_0x2d4b33[_0xd4eb('0x11')];this[_0xd4eb('0x15')]=_0x2d4b33['countdropretry'];this[_0xd4eb('0x12')]=_0x2d4b33['countabandonedretry'];this[_0xd4eb('0x13')]=_0x2d4b33['countmachineretry'];this[_0xd4eb('0x14')]=_0x2d4b33[_0xd4eb('0x14')];this['uniqueid']=_0x3668fb[_0xd4eb('0x16')];this['calleridname']=_0x2d4b33[_0xd4eb('0x17')];this[_0xd4eb('0x18')]=_0x2d4b33['number'];this['starttime']=_0x2d4b33[_0xd4eb('0x19')];this[_0xd4eb('0x1a')]=_0x2d4b33[_0xd4eb('0x1a')];this[_0xd4eb('0x1b')]=moment()[_0xd4eb('0x1c')](_0xd4eb('0x1d'));this['ringtime']=getSeconds(_0x2d4b33[_0xd4eb('0x1a')],_0x2d4b33['starttime']);this['holdtime']=0x0;this[_0xd4eb('0x1e')]=getSeconds(this[_0xd4eb('0x1b')],_0x2d4b33[_0xd4eb('0x1a')]);this['queue']=_0x2d4b33[_0xd4eb('0xc')];this[_0xd4eb('0x1f')]=_0xd4eb('0x20');this['reason']=_0x3668fb[_0xd4eb('0x21')];this[_0xd4eb('0x22')]=_0x2d4b33[_0xd4eb('0x22')];this['callbackuniqueid']=_0x2d4b33[_0xd4eb('0x23')];this['callbackat']=_0x2d4b33[_0xd4eb('0x24')];this[_0xd4eb('0x25')]=_0x2d4b33['recallme'];this[_0xd4eb('0x26')]=_0x2d4b33[_0xd4eb('0x26')];this[_0xd4eb('0x27')]=_0x2d4b33[_0xd4eb('0x27')];this[_0xd4eb('0x28')]=_0x2d4b33[_0xd4eb('0x28')];this[_0xd4eb('0x29')]=_0x2d4b33['VoiceQueueId'];this[_0xd4eb('0x2a')]=_0x2d4b33[_0xd4eb('0x2a')];}module[_0xd4eb('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index ae9f4ef..b38d7e6 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb71d=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xb71d,0x1f3));var _0xdb71=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb71d[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0xdb71('0x0'));var _=require(_0xdb71('0x1'));var moment=require(_0xdb71('0x2'));function getSeconds(_0x5db3f9,_0x5be0c0){var _0x3029e9=moment(_0x5db3f9)[_0xdb71('0x3')](0x0);var _0x3dcac1=moment(_0x5be0c0)['milliseconds'](0x0);return _0x3029e9[_0xdb71('0x4')](_0x3dcac1,_0xdb71('0x5'));}function History(_0xc67458){this[_0xdb71('0x6')]=_0xc67458[_0xdb71('0x6')];this[_0xdb71('0x7')]=_0xc67458[_0xdb71('0x7')]||undefined;this[_0xdb71('0x8')]=_0xc67458['type'];this[_0xdb71('0x9')]=_0xc67458[_0xdb71('0x8')]===_0xdb71('0xa')?_0xdb71('0xb'):_0xc67458[_0xdb71('0x8')];this['countbusyretry']=_0xc67458[_0xdb71('0xc')];this[_0xdb71('0xd')]=_0xc67458['countcongestionretry'];this[_0xdb71('0xe')]=_0xc67458[_0xdb71('0xe')];this[_0xdb71('0xf')]=_0xc67458['countbusyretry']+_0xc67458[_0xdb71('0xd')]+_0xc67458[_0xdb71('0xe')]+_0xc67458[_0xdb71('0x10')]+_0xc67458[_0xdb71('0x11')]+_0xc67458[_0xdb71('0x12')]+_0xc67458[_0xdb71('0x13')]+_0xc67458[_0xdb71('0x14')];this[_0xdb71('0x10')]=_0xc67458['countnosuchnumberretry'];this[_0xdb71('0x11')]=_0xc67458[_0xdb71('0x11')];this[_0xdb71('0x12')]=_0xc67458[_0xdb71('0x12')];this[_0xdb71('0x13')]=_0xc67458[_0xdb71('0x13')];this[_0xdb71('0x14')]=_0xc67458[_0xdb71('0x14')];this[_0xdb71('0xb')]=_0xc67458[_0xdb71('0xb')];this['calleridname']=_0xc67458[_0xdb71('0x15')];this[_0xdb71('0x16')]=_0xc67458[_0xdb71('0x17')];this[_0xdb71('0x18')]=_0xc67458['starttime'];this[_0xdb71('0x19')]=_0xc67458[_0xdb71('0x19')];this[_0xdb71('0x1a')]=_0xc67458[_0xdb71('0x19')];this[_0xdb71('0x1b')]=getSeconds(_0xc67458[_0xdb71('0x19')],_0xc67458['starttime']);this[_0xdb71('0x1c')]=0x0;this[_0xdb71('0x1d')]=0x0;this['callback']=_0xc67458[_0xdb71('0x1e')];this[_0xdb71('0x1f')]=_0xc67458[_0xdb71('0x1f')];this[_0xdb71('0x20')]=_0xc67458[_0xdb71('0x20')];this['recallme']=_0xc67458[_0xdb71('0x21')];this[_0xdb71('0x22')]=_0xc67458[_0xdb71('0x22')];this[_0xdb71('0x23')]=_0xc67458['ListId'];this[_0xdb71('0x24')]=_0xc67458[_0xdb71('0x24')];this[_0xdb71('0x25')]=_0xc67458[_0xdb71('0x25')];this[_0xdb71('0x26')]=_0xc67458[_0xdb71('0x26')];this[_0xdb71('0x27')]=_0xc67458['originatecalleridnum']||'';this['originatecalleridname']=_0xc67458[_0xdb71('0x28')]||'';}module['exports']=History; \ No newline at end of file +var _0x41bb=['milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','name','calleridnum','number','responsetime','endtime','ringtime','starttime','holdtime','callback','callbackuniqueid','recallme','ContactId','ListId','CampaignId','originatecalleridnum','originatecalleridname','util'];(function(_0xacefaa,_0x562ae4){var _0x302ada=function(_0x36b7f6){while(--_0x36b7f6){_0xacefaa['push'](_0xacefaa['shift']());}};_0x302ada(++_0x562ae4);}(_0x41bb,0x68));var _0xb41b=function(_0x49c74d,_0x49de9c){_0x49c74d=_0x49c74d-0x0;var _0x2c687d=_0x41bb[_0x49c74d];return _0x2c687d;};'use strict';var util=require(_0xb41b('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x2b5ee7,_0x44df92){var _0x4ee568=moment(_0x2b5ee7)[_0xb41b('0x1')](0x0);var _0x48380e=moment(_0x44df92)['milliseconds'](0x0);return _0x4ee568['diff'](_0x48380e,_0xb41b('0x2'));}function History(_0xbe053c){this[_0xb41b('0x3')]=_0xbe053c['uniqueid'];this[_0xb41b('0x4')]=_0xbe053c[_0xb41b('0x4')]||undefined;this[_0xb41b('0x5')]=_0xbe053c[_0xb41b('0x5')];this[_0xb41b('0x6')]=_0xbe053c[_0xb41b('0x5')]===_0xb41b('0x7')?_0xb41b('0x8'):_0xbe053c[_0xb41b('0x5')];this[_0xb41b('0x9')]=_0xbe053c['countbusyretry'];this[_0xb41b('0xa')]=_0xbe053c['countcongestionretry'];this[_0xb41b('0xb')]=_0xbe053c[_0xb41b('0xb')];this[_0xb41b('0xc')]=_0xbe053c[_0xb41b('0x9')]+_0xbe053c[_0xb41b('0xa')]+_0xbe053c[_0xb41b('0xb')]+_0xbe053c[_0xb41b('0xd')]+_0xbe053c[_0xb41b('0xe')]+_0xbe053c['countabandonedretry']+_0xbe053c[_0xb41b('0xf')]+_0xbe053c['countagentrejectretry'];this[_0xb41b('0xd')]=_0xbe053c[_0xb41b('0xd')];this[_0xb41b('0xe')]=_0xbe053c[_0xb41b('0xe')];this[_0xb41b('0x10')]=_0xbe053c[_0xb41b('0x10')];this[_0xb41b('0xf')]=_0xbe053c['countmachineretry'];this[_0xb41b('0x11')]=_0xbe053c[_0xb41b('0x11')];this[_0xb41b('0x8')]=_0xbe053c[_0xb41b('0x8')];this[_0xb41b('0x12')]=_0xbe053c[_0xb41b('0x13')];this[_0xb41b('0x14')]=_0xbe053c[_0xb41b('0x15')];this['starttime']=_0xbe053c['starttime'];this[_0xb41b('0x16')]=_0xbe053c['responsetime'];this[_0xb41b('0x17')]=_0xbe053c['responsetime'];this[_0xb41b('0x18')]=getSeconds(_0xbe053c[_0xb41b('0x16')],_0xbe053c[_0xb41b('0x19')]);this[_0xb41b('0x1a')]=0x0;this['talktime']=0x0;this['callback']=_0xbe053c[_0xb41b('0x1b')];this[_0xb41b('0x1c')]=_0xbe053c['callbackuniqueid'];this['callbackat']=_0xbe053c['callbackat'];this[_0xb41b('0x1d')]=_0xbe053c['recallme'];this[_0xb41b('0x1e')]=_0xbe053c[_0xb41b('0x1e')];this['ListId']=_0xbe053c[_0xb41b('0x1f')];this['UserId']=_0xbe053c['UserId'];this['VoiceQueueId']=_0xbe053c['VoiceQueueId'];this[_0xb41b('0x20')]=_0xbe053c[_0xb41b('0x20')];this[_0xb41b('0x21')]=_0xbe053c[_0xb41b('0x21')]||'';this['originatecalleridname']=_0xbe053c[_0xb41b('0x22')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 308596f..7a77cf2 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 _0x9158=['catch','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','Machine','countglobal','countnosuchnumberretry','stateGlobal','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','additional','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','syncNewExten','strategy','actionid','locked','paused','stateinterface','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','pick','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','indexOf','true','iftime\x20%s,%s','content','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','dialMethod','power','dialPowerLevel','handlePower','Queue','launchHandleIvr','dialActive','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','checkIfTime','[syncCampaigns]','\x5cw{0,','pow','replace','match','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','responsetime','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','push','dialOrderByScheduledAt','[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','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','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','----\x20Agent\x20Busy\x20Factor\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','lodash','bluebird','moment','ioredis','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','milliseconds','diff','seconds','outbound','answered','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','md5','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','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','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','Action','status','channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','resolve'];(function(_0x57e41c,_0x149468){var _0x3cbdfd=function(_0x5d138b){while(--_0x5d138b){_0x57e41c['push'](_0x57e41c['shift']());}};_0x3cbdfd(++_0x149468);}(_0x9158,0x16e));var _0x8915=function(_0x53ee2c,_0x50cf55){_0x53ee2c=_0x53ee2c-0x0;var _0x22d936=_0x9158[_0x53ee2c];return _0x22d936;};'use strict';var util=require(_0x8915('0x0'));var _=require(_0x8915('0x1'));var BPromise=require(_0x8915('0x2'));var uuid=require('uuid');var moment=require(_0x8915('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x8915('0x4'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x8915('0x5'))(_0x8915('0x6'));var loggerBooked=require(_0x8915('0x5'))(_0x8915('0x7'));var loggerPredictive=require(_0x8915('0x5'))(_0x8915('0x8'));var loggerPredictiveCalls=require(_0x8915('0x5'))(_0x8915('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x8915('0xa'));var ami=require(_0x8915('0xb'));config[_0x8915('0xc')]=_[_0x8915('0xd')](config[_0x8915('0xc')],{'host':_0x8915('0xe'),'port':0x18eb});var io=require(_0x8915('0xf'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x8915('0x10'));var cmHopperFinal=require(_0x8915('0x11'));var cmHopperAdditionalPhone=require(_0x8915('0x12'));var cmHopperBlack=require(_0x8915('0x13'));var voiceQueueRt=require(_0x8915('0x14'));var Action=require(_0x8915('0x15'));var History=require('./history');var Final=require(_0x8915('0x16'));var AgentComplete=require(_0x8915('0x17'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x8915('0x18'));var ipAgi=process['env'][_0x8915('0x19')]||'127.0.0.1';var strategy={'rrmemory':_0x8915('0x1a'),'roundrobin':_0x8915('0x1b')};var Sequence=function(){};Sequence[_0x8915('0x1c')][_0x8915('0x1d')]=function(_0x8dff4d){this[_0x8915('0x1e')]=this[_0x8915('0x1e')]?this[_0x8915('0x1e')][_0x8915('0x1f')](_0x8dff4d):_0x8dff4d();};function Dialer(_0x3f541c,_0x2a0514){this['sequence']=new Sequence();this[_0x8915('0x20')]=_0x2a0514;this[_0x8915('0x21')]=_0x3f541c['voiceQueues'];this['campaigns']=_0x3f541c[_0x8915('0x22')];this[_0x8915('0x23')]=_0x3f541c[_0x8915('0x23')];this[_0x8915('0x24')]=_0x3f541c[_0x8915('0x24')];this[_0x8915('0x25')]=config[_0x8915('0x25')]||0x2;this[_0x8915('0x26')]={};this['actions']={};this['contactsId']={};this[_0x8915('0x27')]={};this[_0x8915('0x28')]={};this[_0x8915('0x29')]={};this[_0x8915('0x2a')]={};this['ivrOriginated']={};this[_0x8915('0x2b')]={};this[_0x8915('0x2c')]={};ami['on'](_0x8915('0x2d'),this[_0x8915('0x2e')][_0x8915('0x2f')](this));ami['on'](_0x8915('0x30'),this[_0x8915('0x31')][_0x8915('0x2f')](this));ami['on']('originateresponse',this[_0x8915('0x32')]['bind'](this));ami['on'](_0x8915('0x33'),this[_0x8915('0x34')]['bind'](this));ami['on'](_0x8915('0x35'),this[_0x8915('0xa')][_0x8915('0x2f')](this));ami['on'](_0x8915('0x36'),this[_0x8915('0x37')][_0x8915('0x2f')](this));ami['on'](_0x8915('0x38'),this['syncNewExten'][_0x8915('0x2f')](this));ami['on'](_0x8915('0x39'),this['syncVarSet'][_0x8915('0x2f')](this));ami['on']('queuemember',this[_0x8915('0x3a')]['bind'](this));ami['on'](_0x8915('0x3b'),this[_0x8915('0x3c')]['bind'](this));this[_0x8915('0x3d')]();this[_0x8915('0x3e')]();}function isNotNull(_0x18296c){return _0x18296c!==null&&!_[_0x8915('0x3f')](_0x18296c);}function checkIsLoggedIn(_0xd3eccb,_0x492fa7){return function(){if(_0x492fa7<=0x0){_0xd3eccb[_0x8915('0x40')]='AGENTS_NOT_LOGGED';throw _0xd3eccb[_0x8915('0x41')]+_0x8915('0x42');}};}function isActive(_0x1e5cc3){return _0x1e5cc3;}function checkIsActive(_0x4c1c06,_0x55aaff){return function(){if(!isActive(_0x55aaff)){_0x4c1c06[_0x8915('0x40')]=_0x8915('0x43');throw _0x4c1c06['name']+_0x8915('0x44');}};}function checkInterval(_0x4e6868){return function(){if(!isNotNull(_0x4e6868[_0x8915('0x45')])){_0x4e6868[_0x8915('0x40')]=_0x8915('0x46');throw _0x4e6868[_0x8915('0x41')]+_0x8915('0x47');}if(!isNotNull(_0x4e6868[_0x8915('0x45')][_0x8915('0x48')])){_0x4e6868[_0x8915('0x40')]=_0x8915('0x46');throw _0x4e6868[_0x8915('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x8915('0x49')](_0x4e6868[_0x8915('0x45')][_0x8915('0x48')]))){_0x4e6868['message']='INTERVAL_IS_NULL';throw _0x4e6868[_0x8915('0x41')]+_0x8915('0x47');}};}function msgResponse(_0x393d7e,_0x20c9e8,_0x25759d){return{'action':_0x393d7e,'response':_0x20c9e8,'message':_0x25759d,'stack':_0x25759d};}function myreject(_0x37ef34){return function(_0x38b27e){return _0x37ef34(msgResponse('[ifTime][Action]',_0x8915('0x4a'),JSON[_0x8915('0x4b')](_0x38b27e)));};}function getSeconds(_0x42b1d2,_0x15f1d4){var _0x2e55c0=moment(_0x42b1d2)[_0x8915('0x4c')](0x0);var _0x2eeb72=moment(_0x15f1d4)[_0x8915('0x4c')](0x0);return _0x2e55c0[_0x8915('0x4d')](_0x2eeb72,_0x8915('0x4e'));}function emit(_0x3a2d37,_0x208b4e,_0xa04761){io['to'](_0x3a2d37)['emit'](_0x208b4e,_0xa04761);}function emitVoiceQueueSummary(_0x1cb7da){if(_0x1cb7da['type']===_0x8915('0x4f')){var _0x2e075e={'id':_0x1cb7da['id'],'name':_0x1cb7da[_0x8915('0x41')],'strategy':_0x1cb7da['strategy'],'answered':_0x1cb7da[_0x8915('0x50')],'available':_0x1cb7da['available'],'loggedIn':_0x1cb7da['loggedIn'],'pTalking':_0x1cb7da[_0x8915('0x51')],'sumBillable':_0x1cb7da[_0x8915('0x52')],'sumDuration':_0x1cb7da[_0x8915('0x53')],'sumHoldTime':_0x1cb7da[_0x8915('0x54')]||0x0,'talking':_0x1cb7da['talking'],'total':_0x1cb7da['total'],'type':_0x1cb7da[_0x8915('0x55')],'unmanaged':_0x1cb7da[_0x8915('0x56')],'abandoned':_0x1cb7da['abandoned'],'waiting':_0x1cb7da[_0x8915('0x57')],'loggedInDb':_0x1cb7da[_0x8915('0x58')],'dialActive':_0x1cb7da['dialActive'],'dialMethod':_0x1cb7da['dialMethod'],'dialOriginateCallerIdName':_0x1cb7da[_0x8915('0x59')],'dialOriginateCallerIdNumber':_0x1cb7da[_0x8915('0x5a')],'dialOriginateTimeout':_0x1cb7da['dialOriginateTimeout'],'dialPrefix':_0x1cb7da[_0x8915('0x5b')],'outboundAnswerAgiCallsDay':_0x1cb7da['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1cb7da[_0x8915('0x5c')],'outboundBlacklistCallsDay':_0x1cb7da[_0x8915('0x5d')],'outboundBusyCallsDay':_0x1cb7da[_0x8915('0x5e')],'outboundCongestionCallsDay':_0x1cb7da[_0x8915('0x5f')],'outboundDropCallsDayACS':_0x1cb7da[_0x8915('0x60')],'outboundDropCallsDayCallersExit':_0x1cb7da['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x1cb7da[_0x8915('0x61')],'outboundNoAnswerCallsDay':_0x1cb7da[_0x8915('0x62')],'outboundNoSuchCallsDay':_0x1cb7da[_0x8915('0x63')],'outboundOriginateFailureCallsDay':_0x1cb7da[_0x8915('0x64')],'outboundReCallsDay':_0x1cb7da['outboundReCallsDay'],'outboundRejectCallsDay':_0x1cb7da[_0x8915('0x65')],'outboundUnknownCallsDay':_0x1cb7da[_0x8915('0x66')],'predictiveIntervalAnsweredCalls':_0x1cb7da['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1cb7da[_0x8915('0x67')],'predictiveIntervalAvgTalktime':_0x1cb7da[_0x8915('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x1cb7da['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1cb7da['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1cb7da[_0x8915('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x1cb7da[_0x8915('0x6a')],'predictiveIntervalHitRate':_0x1cb7da[_0x8915('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x1cb7da[_0x8915('0x6c')],'predictiveIntervalPauses':_0x1cb7da[_0x8915('0x6d')],'predictiveIntervalAvailable':_0x1cb7da['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1cb7da[_0x8915('0x6e')],'message':_0x1cb7da['message'],'originated':_0x1cb7da[_0x8915('0x6f')],'erlangCalls':_0x1cb7da[_0x8915('0x70')],'erlangCallToSecond':_0x1cb7da[_0x8915('0x71')],'erlangAbandonmentRate':_0x1cb7da[_0x8915('0x72')],'erlangBusyFactor':_0x1cb7da[_0x8915('0x73')],'startPredictive':_0x1cb7da[_0x8915('0x29')],'startProgressive':_0x1cb7da[_0x8915('0x2a')]};if(_0x1cb7da['Trunk']){_0x2e075e[_0x8915('0x74')]={'id':_0x1cb7da[_0x8915('0x74')]['id'],'name':_0x1cb7da[_0x8915('0x74')][_0x8915('0x41')],'active':_0x1cb7da[_0x8915('0x74')][_0x8915('0x75')],'callerid':_0x1cb7da[_0x8915('0x74')]['callerid']};}if(_0x1cb7da[_0x8915('0x45')]){_0x2e075e[_0x8915('0x45')]={'id':_0x1cb7da[_0x8915('0x45')]['id'],'name':_0x1cb7da[_0x8915('0x45')][_0x8915('0x41')]};}var _0x5672ba=md5(JSON['stringify'](_0x2e075e));if(_0x1cb7da[_0x8915('0x76')]!==_0x5672ba){_0x1cb7da[_0x8915('0x76')]=_0x5672ba;emit(util['format'](_0x8915('0x77'),_0x2e075e[_0x8915('0x41')]),_0x8915('0x78'),_0x2e075e);}}}function emitCampaignSummary(_0x5eab00){if(_0x5eab00[_0x8915('0x55')]===_0x8915('0x79')){emit(util['format'](_0x8915('0x7a'),_0x5eab00[_0x8915('0x41')]),_0x8915('0x7b'),_0x5eab00);}}function checkGetDataPredictive(_0x33e91e){if(isNotNull(_0x33e91e)&&!_['isEmpty'](_0x33e91e)){loggerPredictive['info'](_0x8915('0x7c'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33e91e[_0x8915('0x6e')]);loggerPredictive[_0x8915('0x7d')](_0x8915('0x7e'),_0x33e91e[_0x8915('0x7f')]);loggerPredictive[_0x8915('0x7d')](_0x8915('0x80'),_0x33e91e[_0x8915('0x81')]);loggerPredictive[_0x8915('0x7d')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33e91e[_0x8915('0x82')]);loggerPredictive[_0x8915('0x7d')](_0x8915('0x83'),_0x33e91e[_0x8915('0x67')]);loggerPredictive[_0x8915('0x7d')](_0x8915('0x84'),_0x33e91e[_0x8915('0x68')]);loggerPredictive[_0x8915('0x7d')](_0x8915('0x85'));if(_0x33e91e[_0x8915('0x6e')]>0x0){if(!_[_0x8915('0x3f')](_0x33e91e['predictiveIntervalAvgTalktime'])&&_0x33e91e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x8915('0x7d')](_0x8915('0x86'));if(!_[_0x8915('0x3f')](_0x33e91e[_0x8915('0x67')])&&_0x33e91e[_0x8915('0x67')]>0x0){return!![];}loggerPredictive[_0x8915('0x7d')](_0x8915('0x87'));}else{loggerPredictive[_0x8915('0x7d')](_0x8915('0x88'));}}else{loggerPredictive[_0x8915('0x7d')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x26d035){return function(_0x5f2df2){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x8915('0x7d')](_0x8915('0x89'),_0x5f2df2[_0x8915('0x70')]);loggerPredictive[_0x8915('0x7d')](_0x8915('0x8a'),_0x5f2df2['erlangCallToSecond']);loggerPredictive[_0x8915('0x7d')](_0x8915('0x8b'),_0x5f2df2['erlangAbandonmentRate']);loggerPredictive[_0x8915('0x7d')](_0x8915('0x8c'),_0x5f2df2[_0x8915('0x73')]);loggerPredictive[_0x8915('0x7d')](_0x8915('0x8b'),_0x5f2df2['erlangAbandonmentRate']);loggerPredictive[_0x8915('0x7d')](_0x8915('0x85'));_[_0x8915('0x8d')](_0x26d035,_0x5f2df2);};}function getDiff(_0x301361){var _0x3725e2=moment()[_0x8915('0x4c')](0x0);var _0x360bed=moment(_0x301361)[_0x8915('0x4c')](0x0);return _0x3725e2['diff'](_0x360bed,_0x8915('0x4e'));}function ifInterval(_0x5adb88,_0x2e9aeb){if(_[_0x8915('0x3f')](_0x2e9aeb)){return![];}return getDiff(_0x2e9aeb)<_0x5adb88*0x3c;}function freeVariablesPredictive(_0x4a8141){if(isNotNull(_0x4a8141)){if(!_[_0x8915('0x3f')](_0x4a8141[_0x8915('0x2a')])){_0x4a8141[_0x8915('0x2a')]=undefined;loggerPredictive[_0x8915('0x7d')](_0x4a8141[_0x8915('0x41')],_0x8915('0x8e'));}if(!_[_0x8915('0x3f')](_0x4a8141[_0x8915('0x29')])){_0x4a8141[_0x8915('0x29')]=undefined;loggerPredictive[_0x8915('0x7d')](_0x4a8141[_0x8915('0x41')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x8915('0x3f')](_0x4a8141[_0x8915('0x8f')])){clearInterval(_0x4a8141[_0x8915('0x8f')]);_0x4a8141['handlePredictive']=undefined;loggerPredictive[_0x8915('0x7d')](_0x4a8141[_0x8915('0x41')],_0x8915('0x90'));}}}function erlangb(_0x5dc288,_0x2925ab){if(_0x2925ab===0x0){return 0x0;}var _0x22dea4=0x1;for(var _0x18ab64=0x1;_0x18ab64<=_0x2925ab;_0x18ab64+=0x1){_0x22dea4=0x1+_0x22dea4*_0x18ab64/_0x5dc288;}return 0x1/_0x22dea4;}function isVoiceQueueOutbound(_0x26be82){return _0x26be82===_0x8915('0x4f');}function isNotPreview(_0x2d6021){return _0x2d6021!==_0x8915('0x20');}function isCampaignIvr(_0x4a1611){return _0x4a1611===_0x8915('0x79');}function getCallerId(_0xd180fd,_0x2bd3e9,_0x3b6287){if(!_['isUndefined'](_0x3b6287)&&typeof _0x3b6287===_0x8915('0x91')&&!_[_0x8915('0x49')](_0x3b6287)){if(!_[_0x8915('0x3f')](_0x2bd3e9)&&typeof _0x2bd3e9==='string'&&!_[_0x8915('0x49')](_0x2bd3e9)){return util[_0x8915('0x92')]('\x22%s\x22\x20<%s>',_0x2bd3e9,_0x3b6287);}return util[_0x8915('0x92')](_0x8915('0x93'),_0x3b6287,_0x3b6287);}if(!_[_0x8915('0x3f')](_0xd180fd)&&typeof _0xd180fd===_0x8915('0x91')&&!_[_0x8915('0x49')](_0xd180fd)){return _0xd180fd;}return _0x8915('0x94');}function loggerCatchQueueSummary(_0x186511,_0x359a98){return function(_0x460e9a){freeVariablesPredictive(_0x359a98);emitVoiceQueueSummary(_0x359a98);emitCampaignSummary(_0x359a98);loggerSyncQueueSummary[_0x8915('0x95')](_0x186511,util[_0x8915('0x96')](_0x460e9a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3d0330,_0x305fdf){return function(_0x1fd4cc){loggerPredictive[_0x8915('0x95')](_0x305fdf[_0x8915('0x41')],_0x3d0330);loggerPredictive[_0x8915('0x95')](_0x1fd4cc['stack']);freeVariablesPredictive(_0x305fdf);};}function loggerCatch(_0x4a2ecc){return function(_0x1fea9b){logger[_0x8915('0x95')](_0x4a2ecc,util['inspect'](_0x1fea9b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1d2266){return _0x1d2266&&!_[_0x8915('0x3f')](_0x1d2266)&&_0x1d2266[_0x8915('0x97')]>0x0;}function decremetOriginate(_0x533a7b){if(!_[_0x8915('0x3f')](_0x533a7b)&&_0x533a7b!==null){if(typeof _0x533a7b[_0x8915('0x6f')]!==_0x8915('0x98')){if(_0x533a7b[_0x8915('0x6f')]>0x0){_0x533a7b['originated']-=0x1;}else{logger['error'](_0x8915('0x99'));}}}else{logger[_0x8915('0x95')](_0x8915('0x9a'));}}function checkContactLowerLimitOriginate(_0x57bb2f,_0x4e924f,_0x124516){if(_0x4e924f>_0x124516){for(var _0x4962f8=0x0;_0x4962f8<_0x4e924f-_0x124516;_0x4962f8+=0x1){decremetOriginate(_0x57bb2f);}}}function loggerGetContactDialer(_0x141ec8,_0xfbfa5d,_0x3f3b77){return function(_0x487368){checkContactLowerLimitOriginate(_0xfbfa5d,_0x3f3b77,0x0);logger[_0x8915('0x95')](_0x141ec8,util[_0x8915('0x96')](_0x487368,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4f2c0f){return function(_0x4ff3c0){if(isNotNull(_0x4ff3c0)&&isNotNull(_0x4ff3c0[0x0])){if(_0x4ff3c0[0x0][_0x8915('0x9b')]>0x0){_0x4f2c0f[_0x8915('0x40')]=_0x8915('0x9c');logger[_0x8915('0x7d')](_0x8915('0x9d')+_0x4f2c0f[_0x8915('0x41')],_0x4ff3c0[0x0][_0x8915('0x9b')],'contacts');}else{_0x4f2c0f[_0x8915('0x40')]=_0x8915('0x9e');logger[_0x8915('0x7d')](_0x8915('0x9f')+_0x4f2c0f[_0x8915('0x41')]);}}};}function notSendMessagesQueue(_0x8bb71a){if(_0x8bb71a[_0x8915('0xa0')]){freeVariablesPredictive(_0x8bb71a);if(_0x8bb71a[_0x8915('0x6f')]===0x0&&_0x8bb71a[_0x8915('0xa1')]===0x0&&_0x8bb71a[_0x8915('0x57')]===0x0&&(_0x8bb71a['pTalking']||0x0)===0x0){_0x8bb71a[_0x8915('0xa0')]=![];_0x8bb71a[_0x8915('0xa2')]=0x0;_0x8bb71a[_0x8915('0x40')]=_0x8915('0x43');loggerSyncQueueSummary[_0x8915('0x95')](_0x8915('0xa3'),_0x8bb71a[_0x8915('0x41')],_0x8915('0xa4'));}else{_0x8bb71a[_0x8915('0x40')]=_0x8915('0xa5');loggerSyncQueueSummary[_0x8915('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x8bb71a['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x8bb71a);}}function notSendMessagesCampaign(_0x269359){if(_0x269359[_0x8915('0xa0')]){if(_0x269359['originated']===0x0){_0x269359['sendMessageOneNotActive']=![];_0x269359[_0x8915('0x40')]=_0x8915('0x43');loggerSyncQueueSummary[_0x8915('0x95')](_0x8915('0xa6'),_0x269359[_0x8915('0x41')],_0x8915('0xa4'));}else{_0x269359[_0x8915('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x8915('0x95')](_0x8915('0xa6'),_0x269359[_0x8915('0x41')],_0x8915('0xa7'));}emitCampaignSummary(_0x269359);}}function createObjHistory(_0x18f7bf,_0x10efb3,_0x2ea13e,_0x425ca6,_0x1795cb){_0x18f7bf['message']=_0x2ea13e;var _0x13945d=new Action(_0x18f7bf,_0x10efb3);var _0x513f99=new History(_0x13945d);_0x513f99[_0x8915('0xa8')]=_0x425ca6;_0x513f99[_0x8915('0xa9')]=_0x1795cb;_0x513f99[_0x8915('0xaa')]=_0x13945d[_0x8915('0xab')];return _0x513f99;}Dialer[_0x8915('0x1c')][_0x8915('0x3e')]=function(){var _0x3ee1ad=this;setInterval(function(){_0x3ee1ad[_0x8915('0xac')](_0x3ee1ad[_0x8915('0x27')],_0x8915('0xad'));_0x3ee1ad[_0x8915('0xac')](_0x3ee1ad[_0x8915('0xae')],_0x8915('0xaf'));},0x32c8);};Dialer[_0x8915('0x1c')]['clearZombieChannels']=function(_0xa2afdd,_0x41b58a){var _0x1c5bcd=this;for(var _0x22beed in _0xa2afdd){if(typeof _0xa2afdd[_0x22beed]!==_0x8915('0x98')){this[_0x8915('0xb0')][_0x8915('0x1d')](function(){if(!_['isNil'](_0xa2afdd[_0x22beed])){return ami[_0x8915('0xb1')]({'action':_0x8915('0xb2'),'channel':_0xa2afdd[_0x22beed][_0x8915('0xb3')]})['catch'](function(_0x35e769){if(_0x35e769[_0x8915('0x40')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xa2afdd[_0x22beed]&&_0xa2afdd[_0x22beed][_0x8915('0x55')]!=='ivr'){_0x1c5bcd['updateOriginated'](_0x1c5bcd['voiceQueues'][_0xa2afdd[_0x22beed][_0x8915('0xb4')]]);logger[_0x8915('0x95')](_0x8915('0xb5'),_0x41b58a,_0x22beed,_0xa2afdd[_0x22beed]['queue']);delete _0xa2afdd[_0x22beed];}if(_0xa2afdd[_0x22beed]&&_0xa2afdd[_0x22beed][_0x8915('0x55')]===_0x8915('0x79')){_0x1c5bcd[_0x8915('0xb6')](_0x1c5bcd['campaigns'][_0xa2afdd[_0x22beed]['queue']]);logger['error'](_0x8915('0xb7'),_0x41b58a,_0x22beed,_0xa2afdd[_0x22beed][_0x8915('0xb4')]);delete _0xa2afdd[_0x22beed];}},0x2328);}});}});}}};Dialer[_0x8915('0x1c')]['countReScheduled']=function(_0x31507f){return BPromise[_0x8915('0xb8')]()['then'](cmHopper['countReScheduled'](_0x31507f))[_0x8915('0xb9')](loggerCatch(_0x8915('0xba')));};Dialer[_0x8915('0x1c')][_0x8915('0xbb')]=function(_0x187536){return BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](cmHopperBlack[_0x8915('0xbb')](_0x187536))[_0x8915('0xb9')](loggerCatch(_0x8915('0xbd')));};Dialer['prototype'][_0x8915('0xbe')]=function(_0x2613f6,_0xcc6773,_0x35e114){return BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](cmHopperAdditionalPhone[_0x8915('0xbe')](_0x2613f6,_0xcc6773,_0x35e114))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x8915('0x1c')][_0x8915('0xbf')]=function(_0x5d7721,_0x2cca81,_0x3ca252){return BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](cmHopperAdditionalPhone[_0x8915('0xbf')](_0x5d7721,_0x2cca81,_0x3ca252))[_0x8915('0xb9')](loggerCatch(_0x8915('0xc0')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0xfeb69c){return BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](cmHopperBlack[_0x8915('0xc1')](_0xfeb69c))['catch'](loggerCatch(_0x8915('0xc2')));};Dialer[_0x8915('0x1c')][_0x8915('0xc3')]=function(_0x209799){return BPromise['resolve']()[_0x8915('0xbc')](cmHopperHistory[_0x8915('0xc4')](_0x209799))[_0x8915('0xb9')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x8915('0x1c')][_0x8915('0xc5')]=function(_0x2f0a6d){return BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](cmHopper[_0x8915('0xc5')](_0x2f0a6d))[_0x8915('0xb9')](loggerCatch(_0x8915('0xc6')));};Dialer['prototype'][_0x8915('0xc7')]=function(_0x3c169b,_0x30018c,_0x50ab73){return BPromise['resolve']()['then'](cmHopper[_0x8915('0xc7')](_0x3c169b,_0x30018c,_0x50ab73))[_0x8915('0xb9')](loggerCatch(_0x8915('0xc8')));};Dialer[_0x8915('0x1c')][_0x8915('0xc9')]=function(_0x2e5b2e,_0x346309,_0x501841,_0x4127c8,_0x3d2d89){return BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](cmHopper[_0x8915('0xc9')](_0x2e5b2e,_0x346309,_0x501841,_0x4127c8))[_0x8915('0xb9')](function(_0x5db805){_0x3d2d89[_0x8915('0xca')]-=_0x501841;_0x3d2d89['temp']=_0x3d2d89[_0x8915('0xca')]>0x0?_0x3d2d89[_0x8915('0xca')]:0x0;loggerCatch(_0x8915('0xcb'))(_0x5db805);});};Dialer[_0x8915('0x1c')][_0x8915('0xcc')]=function(_0x4520a5,_0x25056f,_0x495d71,_0x396735){return BPromise['resolve']()[_0x8915('0xbc')](cmHopper[_0x8915('0xcc')](_0x4520a5,_0x25056f,_0x495d71))[_0x8915('0xb9')](function(_0x255ad1){_0x396735[_0x8915('0xca')]-=_0x25056f;_0x396735[_0x8915('0xca')]=_0x396735[_0x8915('0xca')]>0x0?_0x396735[_0x8915('0xca')]:0x0;loggerCatch(_0x8915('0xcd'))(_0x255ad1);});};Dialer[_0x8915('0x1c')][_0x8915('0xce')]=function(_0x30008d){return BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](voiceQueueRt[_0x8915('0xce')](_0x30008d))['catch'](loggerCatch(_0x8915('0xcf')));};Dialer['prototype'][_0x8915('0xd0')]=function(_0x2dcab2){return BPromise[_0x8915('0xb8')]()['then'](cmHopper['moveContactManagedDialer'](_0x2dcab2))[_0x8915('0xb9')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x8915('0x1c')][_0x8915('0xd1')]=function(_0x48444a){return BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](cmHopperHistory[_0x8915('0xd1')](_0x48444a))['catch'](loggerCatch(_0x8915('0xd2')));};Dialer[_0x8915('0x1c')][_0x8915('0xb6')]=function(_0x3d5ddb){if(!_[_0x8915('0x3f')](_0x3d5ddb)&&_0x3d5ddb!==null){if(typeof _0x3d5ddb['originated']!=='undefined'){if(_0x3d5ddb['originated']>0x0){_0x3d5ddb['originated']-=0x1;}else{logger[_0x8915('0x95')](_0x8915('0xd3'));}}}else{logger[_0x8915('0x95')](_0x8915('0xd4'));}};Dialer[_0x8915('0x1c')][_0x8915('0xd5')]=function(_0xf95705,_0x271932){var _0x26df14=this;return function(_0x24cfad){_0x26df14['updateOriginated'](_0x271932);logger['error'](_0xf95705,util[_0x8915('0x96')](_0x24cfad,{'showHidden':![],'depth':null}));};};Dialer[_0x8915('0x1c')][_0x8915('0xd6')]=function(_0x5dab30,_0x2a1d9e,_0x838748){var _0x396a7c={'state':0x19,'statedesc':_0x8915('0xd7')};this[_0x8915('0xb6')](_0x2a1d9e);this[_0x8915('0xd8')](_[_0x8915('0x8d')](_0x396a7c,_['pick'](_0x838748,[_0x8915('0xd9'),_0x8915('0xda'),_0x8915('0xdb'),_0x8915('0xdc'),_0x8915('0xdd')])),_0x8915('0xde'),_0x8915('0xdf'));logger['error'](_0x5dab30);};Dialer[_0x8915('0x1c')][_0x8915('0xe0')]=function(_0x55e3bc){return _0x55e3bc===_0x8915('0xe1');};Dialer['prototype'][_0x8915('0xe2')]=function(_0x207309){return!_[_0x8915('0x3f')](_0x207309)&&_0x207309&&!_['isUndefined'](_0x207309[_0x8915('0x41')])&&!_[_0x8915('0x3f')](_0x207309['active'])&&_0x207309[_0x8915('0x75')]&&(this[_0x8915('0x24')][util[_0x8915('0x92')](_0x8915('0xe3'),_0x207309[_0x8915('0x41')])][_0x8915('0xb2')]===_0x8915('0xe4')||this[_0x8915('0x24')][util['format'](_0x8915('0xe3'),_0x207309[_0x8915('0x41')])][_0x8915('0xb2')]===_0x8915('0xe5'));};Dialer['prototype'][_0x8915('0xd8')]=function(_0x418375,_0x32688f,_0x259c23){this[_0x8915('0xd1')](_0x418375)[_0x8915('0xb9')](loggerCatch(_0x32688f));this['moveContactManagedDialer'](_0x418375)['catch'](loggerCatch(_0x259c23));};Dialer[_0x8915('0x1c')][_0x8915('0xe6')]=function(_0x50da3d){var _0x39ad96=this['uniqueId'][_0x50da3d[_0x8915('0xe7')]];var _0x117b1b;if(!_[_0x8915('0xe8')](_0x50da3d)&&!_[_0x8915('0xe8')](_0x50da3d[_0x8915('0xe9')])&&!_[_0x8915('0xe8')](_0x50da3d[_0x8915('0xe9')][_0x8915('0xea')])&&_0x50da3d[_0x8915('0xeb')]===_0x8915('0xec')&&_0x39ad96){if(_0x39ad96[_0x8915('0x55')]!==_0x8915('0x79')&&this[_0x8915('0x21')][_0x39ad96[_0x8915('0xb4')]][_0x8915('0xed')]&&_0x50da3d[_0x8915('0xee')]===_0x8915('0xef')){delete this[_0x8915('0x27')][_0x50da3d['uniqueid']];this[_0x8915('0xb6')](this[_0x8915('0x21')][_0x39ad96[_0x8915('0xb4')]]);this[_0x8915('0x21')][_0x39ad96[_0x8915('0xb4')]]['outboundAnswerCallsDay']+=0x1;this[_0x8915('0x21')][_0x39ad96[_0x8915('0xb4')]][_0x8915('0xf0')]+=0x1;_0x117b1b=new Hangup(_0x39ad96,_0x50da3d);_0x117b1b[_0x8915('0xa8')]=0x12;_0x117b1b[_0x8915('0xa9')]=_0x8915('0xf1');_0x117b1b[_0x8915('0xf2')]=_0x8915('0xf3');ami[_0x8915('0xf4')](_0x8915('0xf5'),ut[_0x8915('0xf6')](_0x117b1b,_0x8915('0xf7')));this[_0x8915('0xd8')](_0x117b1b,'[syncHangupInAMD][createHistory]',_0x8915('0xf8'));}if(_0x39ad96['type']!=='ivr'&&this[_0x8915('0x21')][_0x39ad96['queue']][_0x8915('0xed')]&&_0x50da3d['value']===_0x8915('0xf9')){var _0xb19068=this;return new BPromise(function(_0x495b5b,_0x5c4c04){delete _0xb19068[_0x8915('0x27')][_0x50da3d['uniqueid']];_0xb19068['updateOriginated'](_0xb19068[_0x8915('0x21')][_0x39ad96['queue']]);_0xb19068[_0x8915('0x21')][_0x39ad96['queue']][_0x8915('0x5c')]+=0x1;_0xb19068[_0x8915('0x21')][_0x39ad96[_0x8915('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x279dc1=_0xb19068['voiceQueues'][_0x39ad96[_0x8915('0xb4')]];var _0x28875b=new Hangup(_0x39ad96,_0x50da3d);_0x28875b[_0x8915('0xa8')]=0x13;_0x28875b['statedesc']='Machine';_0x28875b[_0x8915('0xf2')]='AMD';_0x28875b[_0x8915('0xfa')]+=0x1;_0x28875b['countglobal']+=0x1;_0x28875b[_0x8915('0xf7')]=!![];ami['emit'](_0x8915('0xf5'),ut[_0x8915('0xf6')](_0x28875b,_0x8915('0xf7')));_0xb19068['createHistory'](_0x28875b)['catch'](loggerCatch(_0x8915('0xfb')));if(_0x28875b[_0x8915('0xfc')]+_0x28875b[_0x8915('0xfd')]+_0x28875b[_0x8915('0xfe')]+_0x28875b['countnosuchnumberretry']+_0x28875b[_0x8915('0xff')]+_0x28875b[_0x8915('0x100')]+_0x28875b[_0x8915('0xfa')]+_0x28875b[_0x8915('0x101')]>=_0x279dc1[_0x8915('0x102')]){_0xb19068['stateGlobal'](_0x28875b,_0x495b5b,_0x5c4c04,_0x8915('0x103'));}else{if(_0x28875b['countmachineretry']>=_0x279dc1['dialMachineMaxRetry']){_0xb19068['createStateFinal'](_0x28875b,_0x495b5b,_0x5c4c04,_0x8915('0x104'));}else{_0xb19068[_0x8915('0xc5')]({'active':![],'countmachineretry':_0x28875b[_0x8915('0xfa')],'scheduledat':moment()[_0x8915('0x105')](_0x279dc1[_0x8915('0x106')],_0x8915('0x107'))[_0x8915('0x92')](_0x8915('0x108')),'ContactId':_0x28875b[_0x8915('0xd9')],'ListId':_0x28875b[_0x8915('0xda')],'VoiceQueueId':_0x28875b[_0x8915('0xdc')]||undefined,'CampaignId':_0x28875b[_0x8915('0xdd')]||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x109')));_0x495b5b({'reschedule':0x1});}}});}if(_0x39ad96['type']===_0x8915('0x79')&&this['campaigns'][_0x39ad96[_0x8915('0xb4')]][_0x8915('0xed')]&&_0x50da3d[_0x8915('0xee')]===_0x8915('0xef')){delete this['uniqueId'][_0x50da3d[_0x8915('0xe7')]];this[_0x8915('0xb6')](this['campaigns'][_0x39ad96[_0x8915('0xb4')]]);_0x117b1b=new Hangup(_0x39ad96,_0x50da3d);_0x117b1b['state']=0x12;_0x117b1b['statedesc']=_0x8915('0xf1');_0x117b1b[_0x8915('0xf2')]='AMD';ami[_0x8915('0xf4')](_0x8915('0xf5'),ut[_0x8915('0xf6')](_0x117b1b,_0x8915('0xf7')));this[_0x8915('0xd8')](_0x117b1b,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x39ad96[_0x8915('0x55')]===_0x8915('0x79')&&this['campaigns'][_0x39ad96['queue']][_0x8915('0xed')]&&_0x50da3d['value']==='MACHINE'){var _0xb19068=this;return new BPromise(function(_0x1ff86f,_0x24ec63){delete _0xb19068['uniqueId'][_0x50da3d[_0x8915('0xe7')]];_0xb19068[_0x8915('0xb6')](_0xb19068[_0x8915('0x22')][_0x39ad96['queue']]);_0xb19068[_0x8915('0x22')][_0x39ad96[_0x8915('0xb4')]]['outboundAnswerCallsDay']+=0x1;_0xb19068[_0x8915('0x22')][_0x39ad96[_0x8915('0xb4')]][_0x8915('0xf0')]+=0x1;var _0xa6177f=_0xb19068[_0x8915('0x22')][_0x39ad96[_0x8915('0xb4')]];var _0x5b2a68=new Hangup(_0x39ad96,_0x50da3d);_0x5b2a68['state']=0x13;_0x5b2a68[_0x8915('0xa9')]=_0x8915('0x10a');_0x5b2a68[_0x8915('0xf2')]=_0x8915('0xf3');_0x5b2a68['countmachineretry']+=0x1;_0x5b2a68[_0x8915('0x10b')]+=0x1;_0x5b2a68[_0x8915('0xf7')]=!![];ami[_0x8915('0xf4')](_0x8915('0xf5'),ut[_0x8915('0xf6')](_0x5b2a68,_0x8915('0xf7')));_0xb19068[_0x8915('0xd1')](_0x5b2a68)[_0x8915('0xb9')](loggerCatch(_0x8915('0xfb')));if(_0x5b2a68[_0x8915('0xfc')]+_0x5b2a68[_0x8915('0xfd')]+_0x5b2a68['countnoanswerretry']+_0x5b2a68[_0x8915('0x10c')]+_0x5b2a68[_0x8915('0xff')]+_0x5b2a68[_0x8915('0x100')]+_0x5b2a68['countmachineretry']+_0x5b2a68['countagentrejectretry']>=_0xa6177f['dialGlobalMaxRetry']){_0xb19068[_0x8915('0x10d')](_0x5b2a68,_0x1ff86f,_0x24ec63,_0x8915('0x103'));}else{if(_0x5b2a68[_0x8915('0xfa')]>=_0xa6177f['dialMachineMaxRetry']){_0xb19068[_0x8915('0x10e')](_0x5b2a68,_0x1ff86f,_0x24ec63,_0x8915('0x104'));}else{_0xb19068[_0x8915('0xc5')]({'active':![],'countmachineretry':_0x5b2a68[_0x8915('0xfa')],'scheduledat':moment()[_0x8915('0x105')](_0xa6177f['dialMachineRetryFrequency'],_0x8915('0x107'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5b2a68[_0x8915('0xd9')],'ListId':_0x5b2a68[_0x8915('0xda')],'VoiceQueueId':_0x5b2a68[_0x8915('0xdc')]||undefined,'CampaignId':_0x5b2a68[_0x8915('0xdd')]||undefined})[_0x8915('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0x1ff86f({'reschedule':0x1});}}});}}};Dialer[_0x8915('0x1c')][_0x8915('0x37')]=function(_0x32f55d){var _0x420a41=this[_0x8915('0x27')][_0x32f55d['uniqueid']];var _0x56c768=this;var _0x53c20c;if(_0x420a41&&_0x420a41[_0x8915('0x55')]===_0x8915('0x79')){delete this[_0x8915('0x27')][_0x32f55d[_0x8915('0xe7')]];this['updateOriginated'](this[_0x8915('0x22')][_0x420a41[_0x8915('0xb4')]]);this['campaigns'][_0x420a41[_0x8915('0xb4')]][_0x8915('0x10f')]+=0x1;_0x53c20c=new Hangup(_0x420a41,_0x32f55d);this[_0x8915('0xd1')](_0x53c20c)['catch'](loggerCatch(_0x8915('0x110')));this['moveContactManagedDialer'](_0x53c20c)[_0x8915('0xb9')](loggerCatch(_0x8915('0x111')));}if(_0x420a41&&_0x420a41['type']!=='ivr'&&isNotNull(this[_0x8915('0x21')][_0x420a41[_0x8915('0xb4')]][_0x8915('0x112')])){delete this[_0x8915('0x27')][_0x32f55d[_0x8915('0xe7')]];this[_0x8915('0xb6')](this['voiceQueues'][_0x420a41[_0x8915('0xb4')]]);this['voiceQueues'][_0x420a41[_0x8915('0xb4')]]['outboundAnswerCallsDay']+=0x1;this[_0x8915('0x21')][_0x420a41['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x53c20c=new Hangup(_0x420a41,_0x32f55d);_0x53c20c[_0x8915('0xa8')]=0x10;_0x53c20c[_0x8915('0xa9')]=_0x8915('0x113');_0x53c20c[_0x8915('0xf2')]='AGI';this[_0x8915('0xd1')](_0x53c20c)[_0x8915('0xb9')](loggerCatch(_0x8915('0x110')));this[_0x8915('0xd0')](_0x53c20c)['catch'](loggerCatch(_0x8915('0x111')));}if(_0x420a41&&_0x420a41[_0x8915('0x55')]!==_0x8915('0x79')&&!isNotNull(this[_0x8915('0x21')][_0x420a41[_0x8915('0xb4')]][_0x8915('0x112')])){delete this[_0x8915('0x27')][_0x32f55d[_0x8915('0xe7')]];this[_0x8915('0xb6')](this[_0x8915('0x21')][_0x420a41['queue']]);this[_0x8915('0x21')][_0x420a41[_0x8915('0xb4')]][_0x8915('0x66')]+=0x1;_0x53c20c=new Hangup(_0x420a41,_0x32f55d);_0x53c20c[_0x8915('0xa8')]=0xc;_0x53c20c[_0x8915('0xa9')]=_0x32f55d[_0x8915('0x114')];_0x53c20c[_0x8915('0xf2')]=_0x8915('0x115');this[_0x8915('0xd1')](_0x53c20c)[_0x8915('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8915('0xd0')](_0x53c20c)[_0x8915('0xb9')](loggerCatch(_0x8915('0x111')));}};Dialer[_0x8915('0x1c')][_0x8915('0x34')]=function(_0x26b2a2){var _0x28b34a=this['uniqueId'][_0x26b2a2[_0x8915('0xe7')]];var _0x420e32=this;if(this[_0x8915('0x21')][_0x26b2a2[_0x8915('0xb4')]]){if(_0x28b34a&&_0x28b34a[_0x8915('0x55')]!==_0x8915('0x79')){delete this[_0x8915('0x27')][_0x26b2a2[_0x8915('0xe7')]];this[_0x8915('0x21')][_0x26b2a2[_0x8915('0xb4')]]['outboundAnswerCallsDay']+=0x1;var _0x4033d6=new AgentComplete(_0x28b34a,_0x26b2a2);if(_0x26b2a2[_0x8915('0x116')]==='agent'){_0x4033d6[_0x8915('0x117')]=this[_0x8915('0x21')][_0x26b2a2[_0x8915('0xb4')]][_0x8915('0x118')]&&this['voiceQueues'][_0x26b2a2[_0x8915('0xb4')]][_0x8915('0x119')]?moment()[_0x8915('0x92')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x8915('0xd1')](_0x4033d6)[_0x8915('0xb9')](loggerCatch(_0x8915('0x11a')));this['moveContactManagedDialer'](_0x4033d6)['catch'](loggerCatch(_0x8915('0x11b')));}}};Dialer[_0x8915('0x1c')][_0x8915('0x2e')]=function(_0x5303bd){if(this[_0x8915('0x21')][_0x5303bd['queue']]){if(this[_0x8915('0x27')][_0x5303bd[_0x8915('0xe7')]]&&this['uniqueId'][_0x5303bd[_0x8915('0xe7')]]['type']!==_0x8915('0x79')){this[_0x8915('0xb6')](this[_0x8915('0x21')][_0x5303bd['queue']]);this[_0x8915('0x27')][_0x5303bd[_0x8915('0xe7')]][_0x8915('0x11c')]=moment()[_0x8915('0x92')](_0x8915('0x108'));}}};Dialer[_0x8915('0x1c')][_0x8915('0x11d')]=function(_0x104892,_0x453dd7){this['createHistory'](_0x104892)[_0x8915('0xb9')](loggerCatch(_0x8915('0x11a')));if(_0x453dd7==0x0){this['moveContactManagedDialer'](_0x104892)[_0x8915('0xb9')](loggerCatch(_0x8915('0x11e')));}};Dialer[_0x8915('0x1c')]['syncQueueCallerAbandon']=function(_0x4c2057){var _0x2b5ba1=this[_0x8915('0x27')][_0x4c2057['uniqueid']];var _0x49b3cc=this;var _0x5de83b=![];var _0x30c894;var _0x10f976;if(this['voiceQueues'][_0x4c2057[_0x8915('0xb4')]]){if(_0x2b5ba1&&_0x2b5ba1[_0x8915('0x55')]!==_0x8915('0x79')){delete this['uniqueId'][_0x4c2057['uniqueid']];this['updateOriginated'](this[_0x8915('0x21')][_0x4c2057[_0x8915('0xb4')]]);_0x2b5ba1[_0x8915('0x11f')]=moment()[_0x8915('0x92')](_0x8915('0x108'));var _0x111718=new QueueCallerAbandon(_0x2b5ba1,_0x4c2057);if(getSeconds(_0x2b5ba1[_0x8915('0x11f')],_0x2b5ba1['responsetime'])>=_0x2b5ba1[_0x8915('0x120')]){this[_0x8915('0x21')][_0x4c2057[_0x8915('0xb4')]][_0x8915('0x81')]+=0x1;this[_0x8915('0x21')][_0x4c2057[_0x8915('0xb4')]][_0x8915('0x61')]+=0x1;this[_0x8915('0x21')][_0x4c2057[_0x8915('0xb4')]][_0x8915('0x6a')]+=0x1;_0x111718[_0x8915('0xa8')]=0xa;_0x111718[_0x8915('0xa9')]=_0x8915('0x121');_0x111718[_0x8915('0x122')]=_0x8915('0x123');_0x111718[_0x8915('0x117')]=this['voiceQueues'][_0x4c2057[_0x8915('0xb4')]]['dialQueueProject2']?moment()[_0x8915('0x92')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x111718[_0x8915('0xff')]+=0x1;_0x111718[_0x8915('0x10b')]+=0x1;_0x30c894=this['voiceQueues'][_0x4c2057[_0x8915('0xb4')]][_0x8915('0x124')];_0x10f976=this['voiceQueues'][_0x4c2057[_0x8915('0xb4')]][_0x8915('0x125')];_0x49b3cc[_0x8915('0xbe')](_0x111718,_0x111718[_0x8915('0xa8')],_0x2b5ba1['voiceQueue'])[_0x8915('0xbc')](function(_0x2280d1){_0x5de83b=_0x2280d1['additional']==0x1;if(_0x111718[_0x8915('0xff')]>=_0x49b3cc['voiceQueues'][_0x4c2057[_0x8915('0xb4')]]['dialDropMaxRetry']){_0x49b3cc[_0x8915('0x11d')](_0x111718,_0x2280d1[_0x8915('0x126')]);}else{_0x49b3cc['rescheduleContact']({'active':![],'countdropretry':_0x111718[_0x8915('0xff')],'scheduledat':moment()[_0x8915('0x105')](_0x49b3cc[_0x8915('0x21')][_0x4c2057[_0x8915('0xb4')]][_0x8915('0x124')],_0x8915('0x107'))[_0x8915('0x92')](_0x8915('0x108')),'ContactId':_0x2b5ba1[_0x8915('0xd9')],'ListId':_0x2b5ba1[_0x8915('0xda')],'VoiceQueueId':_0x2b5ba1[_0x8915('0xdc')]||undefined,'CampaignId':_0x2b5ba1[_0x8915('0xdd')]||undefined})['catch'](loggerCatch(_0x8915('0x127')));var _0x5c5bdb=new History(_0x111718);_0x5c5bdb[_0x8915('0xa8')]=0xa;_0x5c5bdb[_0x8915('0xa9')]='Drop';_0x5c5bdb[_0x8915('0xab')]=moment()['format'](_0x8915('0x108'));_0x5c5bdb[_0x8915('0xaa')]=_0x5c5bdb[_0x8915('0xab')];_0x5c5bdb[_0x8915('0x128')]=_0x111718['calleridname'];_0x5c5bdb['calleridnum']=_0x111718[_0x8915('0x129')];_0x49b3cc[_0x8915('0xd1')](_0x5c5bdb)['catch'](loggerCatch(_0x8915('0x12a')));}})[_0x8915('0xbc')](function(_0x4cd6a9){if(_0x5de83b)_0x49b3cc[_0x8915('0xbf')](_0x111718,_0x30c894,_0x10f976)[_0x8915('0xbc')](function(_0x34576e){return 0x1;});});}else{this[_0x8915('0x21')][_0x4c2057[_0x8915('0xb4')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x8915('0x21')][_0x4c2057[_0x8915('0xb4')]]['outboundDropCallsDayCallersExit']+=0x1;_0x111718[_0x8915('0xa8')]=0xb;_0x111718['statedesc']=_0x8915('0x12b');_0x111718['dropreason']=_0x8915('0x12c');_0x111718[_0x8915('0x100')]+=0x1;_0x111718['countglobal']+=0x1;_0x30c894=this[_0x8915('0x21')][_0x4c2057['queue']][_0x8915('0x12d')];_0x10f976=this['voiceQueues'][_0x4c2057['queue']][_0x8915('0x125')];_0x49b3cc[_0x8915('0xbe')](_0x111718,_0x111718[_0x8915('0xa8')],_0x2b5ba1[_0x8915('0x12e')])['then'](function(_0x71d8a5){if(_0x111718[_0x8915('0x100')]>=_0x49b3cc[_0x8915('0x21')][_0x4c2057[_0x8915('0xb4')]][_0x8915('0x12f')]){_0x49b3cc[_0x8915('0x11d')](_0x111718,_0x71d8a5[_0x8915('0x126')]);}else{_0x49b3cc[_0x8915('0xc5')]({'active':![],'countabandonedretry':_0x111718[_0x8915('0x100')],'scheduledat':moment()[_0x8915('0x105')](_0x49b3cc[_0x8915('0x21')][_0x4c2057[_0x8915('0xb4')]][_0x8915('0x12d')],'minutes')[_0x8915('0x92')](_0x8915('0x108')),'ContactId':_0x2b5ba1[_0x8915('0xd9')],'ListId':_0x2b5ba1[_0x8915('0xda')],'VoiceQueueId':_0x2b5ba1['VoiceQueueId']||undefined,'CampaignId':_0x2b5ba1[_0x8915('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x1abd5a=new History(_0x111718);_0x1abd5a[_0x8915('0xa8')]=0xb;_0x1abd5a[_0x8915('0xa9')]='Abandoned';_0x1abd5a[_0x8915('0xab')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1abd5a['endtime']=_0x1abd5a[_0x8915('0xab')];_0x1abd5a[_0x8915('0x128')]=_0x111718[_0x8915('0x128')];_0x1abd5a[_0x8915('0x129')]=_0x111718['calleridnum'];_0x49b3cc['createHistory'](_0x1abd5a)[_0x8915('0xb9')](loggerCatch(_0x8915('0x130')));}})['then'](function(_0x3bd0cd){if(_0x5de83b)_0x49b3cc[_0x8915('0xbf')](_0x111718,_0x30c894,_0x10f976)[_0x8915('0xbc')](function(_0x850d9c){return 0x1;});});}}}};Dialer[_0x8915('0x1c')][_0x8915('0x131')]=function(_0x5de835){if(this[_0x8915('0xae')][_0x5de835['uniqueid']]){this[_0x8915('0xae')][_0x5de835[_0x8915('0xe7')]][_0x8915('0xb3')]=_0x5de835[_0x8915('0xb3')];}if(this[_0x8915('0x27')][_0x5de835[_0x8915('0xe7')]]){this[_0x8915('0x27')][_0x5de835['uniqueid']]['channel']=_0x5de835[_0x8915('0xb3')];}};Dialer[_0x8915('0x1c')][_0x8915('0x3a')]=function(_0x166063){if(strategy[this['voiceQueues'][this['actions'][_0x166063['actionid']][_0x8915('0xb4')]][_0x8915('0x132')]]===_0x8915('0x1b')){if(this[_0x8915('0xae')][_0x166063['actionid']]&&_[_0x8915('0xe8')](this['actions'][_0x166063[_0x8915('0x133')]][_0x8915('0x134')])&&_0x166063[_0x8915('0xb2')]==='1'&&_0x166063[_0x8915('0x135')]==='0'){if(this[_0x8915('0x23')][_0x166063['stateinterface']]){if(!this[_0x8915('0x23')][_0x166063['stateinterface']]['locked']){this[_0x8915('0x23')][_0x166063[_0x8915('0x136')]][_0x8915('0x134')]=!![];this[_0x8915('0xae')][_0x166063[_0x8915('0x133')]]['locked']=!![];this[_0x8915('0xae')][_0x166063[_0x8915('0x133')]][_0x8915('0x136')]=_0x166063['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x8915('0xae')][_0x166063[_0x8915('0x133')]][_0x8915('0xb4')]][_0x8915('0x132')]]||_0x8915('0x1a'))==='rrmemory'){if(this[_0x8915('0xae')][_0x166063[_0x8915('0x133')]]){if(this[_0x8915('0x23')][_0x166063[_0x8915('0x136')]]){this[_0x8915('0xae')][_0x166063[_0x8915('0x133')]][_0x8915('0x136')]=_0x166063[_0x8915('0x136')];if(_[_0x8915('0xe8')](this['queueBooked'][this['actions'][_0x166063[_0x8915('0x133')]][_0x8915('0xb4')]])){this[_0x8915('0x2b')][this[_0x8915('0xae')][_0x166063[_0x8915('0x133')]][_0x8915('0xb4')]]=[];}this['queueBooked'][this[_0x8915('0xae')][_0x166063['actionid']][_0x8915('0xb4')]]['push'](_['merge'](_['pick'](this[_0x8915('0xae')][_0x166063['actionid']],[_0x8915('0x137'),_0x8915('0x136')]),{'status':_0x166063[_0x8915('0xb2')],'paused':_0x166063[_0x8915('0x135')]}));}}}};function unlockQueueStatus(_0x2dd759,_0x53d66d){setTimeout(function(){if(_[_0x8915('0x3f')](_0x2dd759[_0x8915('0x138')])){loggerBooked[_0x8915('0x95')](_0x8915('0x139'),_0x53d66d);}_0x2dd759['queueStatusComplete']=!![];loggerBooked[_0x8915('0x7d')](_0x8915('0x13a'),_0x53d66d,JSON['stringify'](_['pick'](_0x2dd759,[_0x8915('0x41'),_0x8915('0x138')])));},0x1f3);}Dialer[_0x8915('0x1c')][_0x8915('0x3c')]=function(_0x34ba52){var _0x276e83=this;var _0x44a5e9=_0x276e83[_0x8915('0x21')][_0x276e83[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xb4')]];if(strategy[this[_0x8915('0x21')][this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xb4')]][_0x8915('0x132')]]==='roundrobin'){if(this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]]&&this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0x136')]){this['preview']['run'](this[_0x8915('0xae')][_0x34ba52['actionid']][_0x8915('0x137')],this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0x136')])[_0x8915('0xb9')](function(_0x4caf35){logger[_0x8915('0x95')](_0x8915('0x13b'),util[_0x8915('0x96')](_0x4caf35,{'showHidden':![],'depth':null}));})['finally'](function(){_0x276e83['updateOriginated'](_0x276e83['voiceQueues'][_0x276e83['actions'][_0x34ba52[_0x8915('0x133')]][_0x8915('0xb4')]]);_0x276e83[_0x8915('0x23')][_0x276e83['actions'][_0x34ba52['actionid']][_0x8915('0x136')]][_0x8915('0x134')]=![];delete _0x276e83[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]];unlockQueueStatus(_0x44a5e9);});}else{this[_0x8915('0xb6')](this[_0x8915('0x21')][this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xb4')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xd9')],'ListId':this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xda')],'VoiceQueueId':this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xdc')]||undefined,'CampaignId':this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xdd')]||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x13c')));delete this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]];unlockQueueStatus(_0x44a5e9);}}else if((strategy[this['voiceQueues'][this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xb4')]]['strategy']]||_0x8915('0x1a'))==='rrmemory'){var _0x3a7237;if(this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]]&&!_[_0x8915('0x49')](this[_0x8915('0x2b')][this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xb4')]])){if(this[_0x8915('0x2c')][_0x276e83[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]]['queue']]){this['queueBookedRR'][_0x276e83['actions'][_0x34ba52[_0x8915('0x133')]]['queue']]=this[_0x8915('0x2c')][this['actions'][_0x34ba52['actionid']][_0x8915('0xb4')]]?this[_0x8915('0x2c')][this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xb4')]]:this[_0x8915('0x2b')][this['actions'][_0x34ba52[_0x8915('0x133')]]['queue']]?this[_0x8915('0x2b')][this['actions'][_0x34ba52[_0x8915('0x133')]]['queue']][_0x8915('0x13d')]||0x0:0x0;}this[_0x8915('0x2b')][this[_0x8915('0xae')][_0x34ba52[_0x8915('0x133')]][_0x8915('0xb4')]][_0x8915('0x13d')]=this[_0x8915('0x2c')][this['actions'][_0x34ba52[_0x8915('0x133')]][_0x8915('0xb4')]];for(var _0x3a06f3=0x0;_0x3a06f3=0x0;})[_0x8915('0xb9')](myreject(_0x5d730c)));}}else{_0x2f139f['push'](ami['Action']({'action':_0x8915('0x153'),'command':util[_0x8915('0x92')](_0x8915('0x156'),_0x1504b3,!_[_0x8915('0x3f')](config[_0x8915('0x151')][_0x3ed75f])?_0x3ed75f:'')})[_0x8915('0xbc')](function(_0x335b90){return _0x335b90[_0x8915('0x157')][_0x8915('0x154')](_0x8915('0x155'))>=0x0;})[_0x8915('0xb9')](myreject(_0x5d730c)));}BPromise[_0x8915('0x158')](_0x2f139f)['then'](function(_0x3f9dc0){var _0x270693=_[_0x8915('0x159')](_0x3f9dc0);if(_0x270693){return _0x2a3c6a(_0x270693);}else{_0x11b0be[_0x8915('0x40')]=_0x5ddcdf?'GLOBAL_INTERVAL_IS_OVERTIME':_0x8915('0x15a');return _0x5d730c(msgResponse(_0x8915('0x15b'),'Failure','Global:\x20'+_0x5ddcdf+'\x20'+_0x2d95b2+_0x8915('0x15c')+util[_0x8915('0x96')](_0x1504b3,{'showHidden':![],'depth':null})+_0x8915('0x15d')+_0x3ed75f));}})['catch'](function(_0x581d84){return _0x5d730c(msgResponse(_0x8915('0x14c'),_0x8915('0x14e'),JSON[_0x8915('0x4b')](_0x581d84)));});});};Dialer[_0x8915('0x1c')]['checkDialMethod']=function(_0x3b0ad4){var _0x1a11c3=this;return function(){switch(_0x3b0ad4[_0x8915('0x15e')]){case'progressive':freeVariablesPredictive(_0x3b0ad4);_0x1a11c3['handlePower'](_0x3b0ad4,0x1);break;case _0x8915('0x15f'):freeVariablesPredictive(_0x3b0ad4);_0x1a11c3['handlePower'](_0x3b0ad4,_0x3b0ad4[_0x8915('0x160')]);break;case _0x8915('0x8'):_0x1a11c3[_0x8915('0x8')](_0x3b0ad4);break;case _0x8915('0x7'):freeVariablesPredictive(_0x3b0ad4);_0x1a11c3[_0x8915('0x161')](_0x3b0ad4,0x1);break;default:freeVariablesPredictive(_0x3b0ad4);logger[_0x8915('0x95')](_0x8915('0x162'),_0x3b0ad4[_0x8915('0x41')],'method\x20not\x20recognized');}};};Dialer[_0x8915('0x1c')][_0x8915('0x163')]=function(_0x4c3d42){var _0x483e51=this;return function(){_0x483e51['handleIvr'](_0x4c3d42);};};Dialer[_0x8915('0x1c')]['syncQueueSummary']=function(_0x3defcc){var _0x57c307=this;if(isNotPreview(_0x3defcc[_0x8915('0x15e')])){if(isVoiceQueueOutbound(_0x3defcc[_0x8915('0x55')])&&isActive(_0x3defcc['dialActive'])){_0x3defcc[_0x8915('0xa0')]=!![];BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](checkIsLoggedIn(_0x3defcc,_0x3defcc['loggedIn']))[_0x8915('0xbc')](checkIsActive(_0x3defcc,_0x3defcc[_0x8915('0x164')]))['then'](checkInterval(_0x3defcc))[_0x8915('0xbc')](_0x57c307[_0x8915('0x149')](_0x3defcc))[_0x8915('0xbc')](_0x57c307['checkIfTime'](_0x3defcc[_0x8915('0x165')],_0x3defcc[_0x8915('0x166')],_0x3defcc[_0x8915('0x41')],_0x3defcc))['then'](_0x57c307[_0x8915('0x14d')](_0x3defcc[_0x8915('0x45')],_0x3defcc[_0x8915('0x166')],_0x3defcc[_0x8915('0x41')],_0x3defcc))[_0x8915('0xbc')](_0x57c307[_0x8915('0x167')](_0x3defcc))['catch'](loggerCatchQueueSummary(_0x8915('0x168'),_0x3defcc));}else{notSendMessagesQueue(_0x3defcc);}}else{freeVariablesPredictive(_0x3defcc);}};Dialer[_0x8915('0x1c')]['syncCampaigns']=function(){var _0x5d6ad7=this;var _0x320131;for(var _0x1fef51 in this[_0x8915('0x22')]){if(typeof this[_0x8915('0x22')][_0x1fef51]!==_0x8915('0x98')){_0x320131=this[_0x8915('0x22')][_0x1fef51];if(isCampaignIvr(_0x320131[_0x8915('0x55')])&&isActive(_0x320131[_0x8915('0x75')])){_0x320131[_0x8915('0xa0')]=!![];BPromise[_0x8915('0xb8')]()[_0x8915('0xbc')](checkIsActive(_0x320131,_0x320131[_0x8915('0x75')]))[_0x8915('0xbc')](checkInterval(_0x320131))[_0x8915('0xbc')](_0x5d6ad7['checkIsTrunkReachable'](_0x320131))[_0x8915('0xbc')](_0x5d6ad7[_0x8915('0x169')](_0x320131[_0x8915('0x165')],_0x320131[_0x8915('0x166')],_0x320131[_0x8915('0x41')],_0x320131))['then'](_0x5d6ad7[_0x8915('0x14d')](_0x320131['Interval'],_0x320131[_0x8915('0x166')],_0x320131[_0x8915('0x41')],_0x320131))[_0x8915('0xbc')](_0x5d6ad7[_0x8915('0x163')](_0x320131))['catch'](loggerCatchQueueSummary(_0x8915('0x16a'),_0x320131));}else{notSendMessagesCampaign(_0x320131);}}}};function getCallerIdRandom(_0x51edc0,_0x48d73a){var _0x2616f0;var _0x48d5a9;var _0x57e41d;if(_0x48d73a<=0x0){_0x48d73a=0x1;}_0x2616f0=new RegExp(_0x8915('0x16b')+_0x48d73a+'}$');_0x48d5a9=Math[_0x8915('0x16c')](0xa,_0x48d73a-0x1);_0x57e41d=Math[_0x8915('0x16c')](0xa,_0x48d73a)-0x1;return util[_0x8915('0x92')]('%s',_[_0x8915('0x16d')](_0x51edc0,_0x2616f0,_['random'](_0x48d5a9,_0x57e41d)));}function extractCalleridName(_0x56b11e){var _0x13b665=_0x56b11e[_0x8915('0x16e')](/"(.*?)"/);return _0x13b665?_0x13b665[0x1]:_0x56b11e;}function extractCalleridNumber(_0x2acc2a){var _0x1bd7a3=_0x2acc2a[_0x8915('0x16e')](/<(.*?)>/);return _0x1bd7a3?_0x1bd7a3[0x1]:_0x2acc2a;}Dialer[_0x8915('0x1c')]['actionOriginate']=function(_0x504495,_0x1d031b){var _0x43fbe6=this;var _0x1873ca=uuid['v4']();this[_0x8915('0xae')][_0x1873ca]=new Action(_0x504495,_0x1d031b,_0x1873ca);return new BPromise(function(_0x24c1ce,_0x48b70d){if(_[_0x8915('0x3f')](_0x504495)&&typeof _0x504495!=='object'){return _0x48b70d(msgResponse(_0x8915('0x16f'),_0x8915('0x14e'),'voiceQueue\x20is\x20undefine'));}if(_[_0x8915('0x3f')](_0x1d031b[_0x8915('0x170')])||_0x1d031b[_0x8915('0x170')]===null){return _0x48b70d(msgResponse('originate',_0x8915('0x14e'),_0x8915('0x171')));}var _0x392bae={'XMD-CALLERID':_0x43fbe6[_0x8915('0xae')][_0x1873ca][_0x8915('0x172')](),'XMD-AGI':_0x504495[_0x8915('0x112')]?util[_0x8915('0x92')](_0x8915('0x173'),ipAgi,_0x504495['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x504495[_0x8915('0x118')]?util[_0x8915('0x92')]('\x22agi://%s/square,%s\x22',ipAgi,_0x504495[_0x8915('0x118')]):'NONE','XMD-QUEUE':_0x504495[_0x8915('0x55')]==='outbound'?util['format']('\x22%s,%s%s,,,%s\x22',_0x504495[_0x8915('0x41')],_0x504495['dialQueueOptions']||'',_0x504495[_0x8915('0x119')]?'c':'',_0x504495[_0x8915('0x120')]||0x3):_0x8915('0x174'),'XMD-CONTACTID':_0x1d031b[_0x8915('0xd9')],'XMD-CDRTYPE':_0x8915('0x6'),'CALLERID(all)':_0x43fbe6[_0x8915('0xae')][_0x1873ca][_0x8915('0x172')](),'XMD-AMD':_0x504495[_0x8915('0xed')]?_0x8915('0x175'):_0x8915('0x174'),'XMD-DESTINATION':_0x8915('0xec')};if(_0x504495['dialAMDActive']){_0x392bae['XMD-AMDINITIALSILENCE']=_0x504495[_0x8915('0x176')]||0x9c4;_0x392bae['XMD-AMDGREETING']=_0x504495[_0x8915('0x177')]||0x5dc;_0x392bae[_0x8915('0x178')]=_0x504495[_0x8915('0x179')]||0x320;_0x392bae[_0x8915('0x17a')]=_0x504495['dialAMDTotalAnalysisTime']||0x1388;_0x392bae[_0x8915('0x17b')]=_0x504495[_0x8915('0x17c')]||0x64;_0x392bae[_0x8915('0x17d')]=_0x504495['dialAMDBetweenWordsSilence']||0x32;_0x392bae[_0x8915('0x17e')]=_0x504495[_0x8915('0x17f')]||0x3;_0x392bae[_0x8915('0x180')]=_0x504495[_0x8915('0x181')]||0x100;_0x392bae[_0x8915('0x182')]=_0x504495[_0x8915('0x183')]||0x1388;}if(_0x504495['type']===_0x8915('0x4f')){_0x392bae[_0x8915('0x184')]=_0x1d031b[_0x8915('0xdc')];}else{_0x392bae[_0x8915('0x185')]=_0x1d031b[_0x8915('0xdd')];}for(var _0x5b26cb in _0x1d031b[_0x8915('0x186')]){if(typeof _0x1d031b[_0x8915('0x186')][_0x5b26cb]!==_0x8915('0x98')){if(isNotNull(_0x1d031b[_0x8915('0x186')][_0x5b26cb])&&_0x5b26cb!=='id'&&_0x5b26cb!=='tags'&&_0x5b26cb!==_0x8915('0x187')&&_0x5b26cb!==_0x8915('0x188')){_0x392bae[util[_0x8915('0x92')](_0x8915('0x189'),_0x8915('0x18a'),_[_0x8915('0x18b')](_0x5b26cb))]=_0x1d031b['Contact'][_0x5b26cb];}}}var _0x503fc6=_0x43fbe6[_0x8915('0xe2')](_0x504495[_0x8915('0x74')])?getCallerId(_0x504495[_0x8915('0x74')][_0x8915('0x18c')],_0x504495[_0x8915('0x59')],_0x504495[_0x8915('0x18d')]>0x0?getCallerIdRandom(_0x504495['dialOriginateCallerIdNumber'],_0x504495[_0x8915('0x18d')]):_0x504495['dialOriginateCallerIdNumber']):getCallerId(_[_0x8915('0xe8')](_0x504495['TrunkBackup'])?_0x504495['Trunk'][_0x8915('0x18c')]:_0x504495[_0x8915('0x18e')]['callerid'],_0x504495[_0x8915('0x59')],_0x504495[_0x8915('0x18d')]>0x0?getCallerIdRandom(_0x504495['dialOriginateCallerIdNumber'],_0x504495[_0x8915('0x18d')]):_0x504495[_0x8915('0x5a')]);if(_0x503fc6){_0x392bae[_0x8915('0x18f')]=_0x43fbe6[_0x8915('0xae')][_0x1873ca]['originatecalleridname']=extractCalleridName(_0x503fc6);_0x392bae[_0x8915('0x190')]=_0x1d031b['phone'];}return ami[_0x8915('0xb1')]({'actionid':_0x1873ca,'action':_0x8915('0x16f'),'channel':_0x43fbe6[_0x8915('0xe2')](_0x504495[_0x8915('0x74')])?util['format'](_0x8915('0x191'),_0x504495[_0x8915('0x74')][_0x8915('0x41')],isNotNull(_0x504495[_0x8915('0x5b')])?_0x504495[_0x8915('0x5b')][_0x8915('0x192')]()||'':'',_0x504495['dialCutDigit']>0x0?_0x1d031b['phone'][_0x8915('0x193')](_0x504495['dialCutDigit']):_0x1d031b[_0x8915('0x170')]):util[_0x8915('0x92')]('SIP/%s/%s%s',_['isNil'](_0x504495[_0x8915('0x18e')])?_0x504495['Trunk'][_0x8915('0x41')]:_0x504495['TrunkBackup'][_0x8915('0x41')],isNotNull(_0x504495[_0x8915('0x5b')])?_0x504495[_0x8915('0x5b')][_0x8915('0x192')]()||'':'',_0x504495[_0x8915('0x194')]>0x0?_0x1d031b[_0x8915('0x170')][_0x8915('0x193')](_0x504495[_0x8915('0x194')]):_0x1d031b[_0x8915('0x170')]),'callerid':_0x503fc6,'Exten':_0x8915('0xec'),'Context':_0x8915('0x195'),'Priority':'1','variable':_0x392bae,'timeout':(_0x504495['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1873ca})[_0x8915('0xbc')](function(_0x549250){return _0x24c1ce(_0x549250);})[_0x8915('0xb9')](function(_0x5e8e3b){_0x504495['outboundOriginateFailureCallsDay']+=0x1;var _0x5ec568=new History(_0x43fbe6[_0x8915('0xae')][_0x1873ca]);logger[_0x8915('0x95')](util[_0x8915('0x92')](_0x8915('0x196'),JSON[_0x8915('0x4b')](_0x5e8e3b)));_0x5ec568['state']=0xe;_0x5ec568[_0x8915('0xa9')]='OriginateError';_0x5ec568['starttime']=moment()[_0x8915('0x92')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ec568['endtime']=_0x5ec568['starttime'];_0x43fbe6['createHistory'](_0x5ec568)[_0x8915('0xb9')](loggerCatch(_0x8915('0x197')));_0x43fbe6[_0x8915('0xd0')](_0x5ec568)[_0x8915('0xb9')](loggerCatch(_0x8915('0x197')))[_0x8915('0x1f')](function(){delete _0x43fbe6[_0x8915('0xae')][_0x1873ca];return _0x48b70d(msgResponse(_0x8915('0x16f'),_0x8915('0x4a'),_0x8915('0x198')));});});});};Dialer[_0x8915('0x1c')]['syncOriginateResponse']=function(_0x378952){var _0x50f36b=this[_0x8915('0xae')][_0x378952[_0x8915('0x133')]];if(_0x50f36b){delete this[_0x8915('0xae')][_0x378952[_0x8915('0x133')]];_0x50f36b[_0x8915('0x199')]=moment()[_0x8915('0x92')](_0x8915('0x108'));var _0x5cfe97=_0x50f36b[_0x8915('0x55')]===_0x8915('0x79')?this[_0x8915('0x22')][_0x50f36b[_0x8915('0xb4')]]:this[_0x8915('0x21')][_0x50f36b['getQueue']()];if(!this[_0x8915('0xe0')](_0x378952['response'])){this[_0x8915('0xb6')](_0x5cfe97);return this[_0x8915('0x19a')](_0x50f36b,_0x5cfe97,_0x378952)[_0x8915('0xb9')](loggerCatch(_0x8915('0x19b')));}this['uniqueId'][_0x378952['uniqueid']]=_0x50f36b;}};Dialer[_0x8915('0x1c')][_0x8915('0x19c')]=function(_0x26fcd7,_0x17661e,_0x378bdf){var _0x2e02ff=new History(_0x17661e);if(_0x2e02ff['countbusyretry']+_0x2e02ff[_0x8915('0xfd')]+_0x2e02ff[_0x8915('0xfe')]+_0x2e02ff[_0x8915('0x10c')]+_0x2e02ff[_0x8915('0xff')]+_0x2e02ff[_0x8915('0x100')]+_0x2e02ff[_0x8915('0xfa')]+_0x2e02ff['countagentrejectretry']>=_0x378bdf['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x26fcd7){case 0x3:if(_0x2e02ff[_0x8915('0xfe')]>=_0x378bdf[_0x8915('0x19d')]-0x1){return!![];}this[_0x8915('0xc5')]({'active':![],'countnoanswerretry':_0x2e02ff['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x8915('0x105')](_0x378bdf[_0x8915('0x19e')],_0x8915('0x107'))[_0x8915('0x92')](_0x8915('0x108')),'ContactId':_0x2e02ff[_0x8915('0xd9')],'ListId':_0x2e02ff[_0x8915('0xda')],'VoiceQueueId':_0x2e02ff[_0x8915('0xdc')]||undefined,'CampaignId':_0x2e02ff[_0x8915('0xdd')]||undefined})[_0x8915('0xb9')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2e02ff[_0x8915('0xfc')]>=_0x378bdf[_0x8915('0x19f')]-0x1){return!![];}this[_0x8915('0xc5')]({'active':![],'countbusyretry':_0x2e02ff['countbusyretry']+=0x1,'scheduledat':moment()[_0x8915('0x105')](_0x378bdf['dialBusyRetryFrequency'],_0x8915('0x107'))[_0x8915('0x92')](_0x8915('0x108')),'ContactId':_0x2e02ff['ContactId'],'ListId':_0x2e02ff[_0x8915('0xda')],'VoiceQueueId':_0x2e02ff[_0x8915('0xdc')]||undefined,'CampaignId':_0x2e02ff['CampaignId']||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x1a0')));break;case 0x8:if(_0x2e02ff['countcongestionretry']>=_0x378bdf[_0x8915('0x1a1')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x2e02ff[_0x8915('0xfd')]+=0x1,'scheduledat':moment()['add'](_0x378bdf['dialCongestionRetryFrequency'],_0x8915('0x107'))['format'](_0x8915('0x108')),'ContactId':_0x2e02ff[_0x8915('0xd9')],'ListId':_0x2e02ff[_0x8915('0xda')],'VoiceQueueId':_0x2e02ff['VoiceQueueId']||undefined,'CampaignId':_0x2e02ff['CampaignId']||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x1a2')));break;case 0x0:if(_0x2e02ff['countnosuchnumberretry']>=_0x378bdf[_0x8915('0x1a3')]-0x1){return!![];}else{this[_0x8915('0xc5')]({'active':![],'countnosuchnumberretry':_0x2e02ff['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x8915('0x105')](_0x378bdf[_0x8915('0x1a4')],_0x8915('0x107'))[_0x8915('0x92')](_0x8915('0x108')),'ContactId':_0x2e02ff[_0x8915('0xd9')],'ListId':_0x2e02ff[_0x8915('0xda')],'VoiceQueueId':_0x2e02ff[_0x8915('0xdc')]||undefined,'CampaignId':_0x2e02ff[_0x8915('0xdd')]||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x1a5')));}break;case 0xa:if(_0x2e02ff[_0x8915('0xff')]>=_0x378bdf[_0x8915('0x1a6')]-0x1){return!![];}this[_0x8915('0xc5')]({'active':![],'countdropretry':_0x2e02ff[_0x8915('0xff')]+=0x1,'scheduledat':moment()[_0x8915('0x105')](_0x378bdf[_0x8915('0x124')],_0x8915('0x107'))['format'](_0x8915('0x108')),'ContactId':_0x2e02ff['ContactId'],'ListId':_0x2e02ff[_0x8915('0xda')],'VoiceQueueId':_0x2e02ff[_0x8915('0xdc')]||undefined,'CampaignId':_0x2e02ff[_0x8915('0xdd')]||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x127')));break;case 0xb:if(_0x2e02ff[_0x8915('0x100')]>=_0x378bdf[_0x8915('0x12f')]-0x1){return!![];}this[_0x8915('0xc5')]({'active':![],'countabandonedretry':_0x2e02ff[_0x8915('0x100')]+=0x1,'scheduledat':moment()[_0x8915('0x105')](_0x378bdf[_0x8915('0x12d')],_0x8915('0x107'))[_0x8915('0x92')](_0x8915('0x108')),'ContactId':_0x2e02ff[_0x8915('0xd9')],'ListId':_0x2e02ff[_0x8915('0xda')],'VoiceQueueId':_0x2e02ff[_0x8915('0xdc')]||undefined,'CampaignId':_0x2e02ff['CampaignId']||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x1a7')));break;case 0x13:if(_0x2e02ff[_0x8915('0xfa')]>=_0x378bdf[_0x8915('0x1a8')]-0x1){return!![];}this[_0x8915('0xc5')]({'active':![],'countmachineretry':_0x2e02ff[_0x8915('0xfa')]+=0x1,'scheduledat':moment()[_0x8915('0x105')](_0x378bdf[_0x8915('0x106')],_0x8915('0x107'))[_0x8915('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e02ff['ContactId'],'ListId':_0x2e02ff[_0x8915('0xda')],'VoiceQueueId':_0x2e02ff[_0x8915('0xdc')]||undefined,'CampaignId':_0x2e02ff['CampaignId']||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x109')));break;case 0x14:if(_0x2e02ff[_0x8915('0x101')]>=_0x378bdf[_0x8915('0x1a9')]-0x1){return!![];}this[_0x8915('0xc5')]({'active':![],'countagentrejectretry':_0x2e02ff[_0x8915('0x101')]+=0x1,'scheduledat':moment()[_0x8915('0x105')](_0x378bdf[_0x8915('0x1aa')],_0x8915('0x107'))['format'](_0x8915('0x108')),'ContactId':_0x2e02ff[_0x8915('0xd9')],'ListId':_0x2e02ff[_0x8915('0xda')],'VoiceQueueId':_0x2e02ff['VoiceQueueId']||undefined,'CampaignId':_0x2e02ff[_0x8915('0xdd')]||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x1ab')));break;default:return!![];}};Dialer['prototype'][_0x8915('0x19a')]=function(_0xc51bc2,_0xe9b88f,_0x5def7b){var _0x5ef67e=this;var _0x13064b=new History(_0xc51bc2);var _0x18cf52=![];var _0x42985f;var _0x3f6bb1;return new BPromise(function(_0x3dba04,_0xa9841f){if(_[_0x8915('0x3f')](_0xe9b88f)&&typeof _0xe9b88f!==_0x8915('0x1ac')){return _0xa9841f(msgResponse(_0x8915('0x1ad'),_0x8915('0x14e'),_0x8915('0x1ae')));}if(_[_0x8915('0x3f')](_0x5def7b)&&typeof _0x5def7b!==_0x8915('0x1ac')){return _0xa9841f(msgResponse('[callProgressDetecting]',_0x8915('0x14e'),_0x8915('0x1af')));}_0x5ef67e[_0x8915('0xbe')](_0x13064b,_0x5def7b[_0x8915('0x116')],_0xe9b88f)[_0x8915('0xbc')](function(_0x1fa32c){if(_0x1fa32c[_0x8915('0x126')]==0x1)_0x18cf52=!![];switch(_0x5def7b[_0x8915('0x116')]){case'0':_0xe9b88f[_0x8915('0x63')]+=0x1;_0x13064b['state']=0x0;_0x13064b[_0x8915('0xa9')]='NoSuchNumber';_0x13064b['countnosuchnumberretry']+=0x1;_0x13064b[_0x8915('0x10b')]+=0x1;ami[_0x8915('0xf4')](_0x8915('0x1b0'),ut[_0x8915('0xf6')](_0xc51bc2,_0x8915('0x1b1')));_0x42985f=_0xe9b88f[_0x8915('0x1a4')];_0x3f6bb1=_0xe9b88f['callAdditionalPhoneAfterMin'];_0x5ef67e[_0x8915('0xd1')](_0x13064b)[_0x8915('0xb9')](loggerCatch(_0x8915('0xfb')));if(_0x5ef67e[_0x8915('0x19c')](0x0,_0xc51bc2,_0xe9b88f)&&!_0x18cf52){if(_0x13064b['countnosuchnumberretry']>=_0xe9b88f[_0x8915('0x1a3')]){_0x5ef67e['createStateFinal'](_0x13064b,_0x3dba04,_0xa9841f,_0x8915('0x1b2'));}else{_0x5ef67e['stateGlobal'](_0x13064b,_0x3dba04,_0xa9841f,_0x8915('0x1b2'));}}break;case'3':_0xe9b88f['outboundNoAnswerCallsDay']+=0x1;_0x13064b[_0x8915('0xa8')]=0x3;_0x13064b[_0x8915('0xa9')]=_0x8915('0x1b3');_0x13064b[_0x8915('0xfe')]+=0x1;_0x13064b[_0x8915('0x10b')]+=0x1;ami[_0x8915('0xf4')](_0x8915('0x1b4'),ut[_0x8915('0xf6')](_0xc51bc2,_0x8915('0x1b5')));_0x42985f=_0xe9b88f[_0x8915('0x19e')];_0x3f6bb1=_0xe9b88f[_0x8915('0x125')];_0x5ef67e['createHistory'](_0x13064b)['catch'](loggerCatch(_0x8915('0x1b6')));if(_0x5ef67e[_0x8915('0x19c')](0x3,_0xc51bc2,_0xe9b88f)&&!_0x18cf52){if(_0x13064b[_0x8915('0xfe')]>=_0xe9b88f[_0x8915('0x19d')]){_0x5ef67e[_0x8915('0x10e')](_0x13064b,_0x3dba04,_0xa9841f,_0x8915('0x1b7'));}else{_0x5ef67e[_0x8915('0x10d')](_0x13064b,_0x3dba04,_0xa9841f,_0x8915('0x1b7'));}}break;case'5':_0xe9b88f['outboundBusyCallsDay']+=0x1;_0x13064b[_0x8915('0xa8')]=0x5;_0x13064b[_0x8915('0xa9')]='Busy';_0x13064b[_0x8915('0xfc')]+=0x1;_0x13064b[_0x8915('0x10b')]+=0x1;ami[_0x8915('0xf4')](_0x8915('0x1b8'),ut[_0x8915('0xf6')](_0xc51bc2,'busy'));_0x42985f=_0xe9b88f[_0x8915('0x1b9')];_0x3f6bb1=_0xe9b88f[_0x8915('0x125')];_0x5ef67e['createHistory'](_0x13064b)['catch'](loggerCatch(_0x8915('0x1ba')));if(_0x5ef67e['checkRetriveMax'](0x5,_0xc51bc2,_0xe9b88f)&&!_0x18cf52){if(_0x13064b[_0x8915('0xfc')]>=_0xe9b88f[_0x8915('0x19f')]){_0x5ef67e['createStateFinal'](_0x13064b,_0x3dba04,_0xa9841f,'reason\x205\x20busy');}else{_0x5ef67e['stateGlobal'](_0x13064b,_0x3dba04,_0xa9841f,_0x8915('0x1bb'));}}break;case'8':_0xe9b88f['outboundCongestionCallsDay']+=0x1;_0x13064b[_0x8915('0xa8')]=0x8;_0x13064b[_0x8915('0xa9')]=_0x8915('0x1bc');_0x13064b[_0x8915('0xfd')]+=0x1;_0x13064b[_0x8915('0x10b')]+=0x1;_0x42985f=_0xe9b88f[_0x8915('0x1bd')];_0x3f6bb1=_0xe9b88f[_0x8915('0x125')];ami[_0x8915('0xf4')](_0x8915('0x1be'),ut[_0x8915('0xf6')](_0xc51bc2,_0x8915('0x1bf')));_0x5ef67e[_0x8915('0xd1')](_0x13064b)[_0x8915('0xb9')](loggerCatch(_0x8915('0x1c0')));if(_0x5ef67e[_0x8915('0x19c')](0x8,_0xc51bc2,_0xe9b88f)&&!_0x18cf52){if(_0x13064b['countcongestionretry']>=_0xe9b88f[_0x8915('0x1a1')]){_0x5ef67e[_0x8915('0x10e')](_0x13064b,_0x3dba04,_0xa9841f,_0x8915('0x1c1'));}else{_0x5ef67e[_0x8915('0x10d')](_0x13064b,_0x3dba04,_0xa9841f,'reason\x208\x20congestion');}}break;case'11':_0xe9b88f[_0x8915('0x1c2')]+=0x1;_0x13064b[_0x8915('0xa8')]=0xb;_0x13064b['statedesc']='Abandoned';_0x13064b['countabandonedretry']+=0x1;_0x13064b[_0x8915('0x10b')]+=0x1;_0x42985f=_0xe9b88f[_0x8915('0x12d')];_0x3f6bb1=_0xe9b88f[_0x8915('0x125')];_0x5ef67e[_0x8915('0xd1')](_0x13064b)[_0x8915('0xb9')](loggerCatch(_0x8915('0x130')));if(_0x5ef67e['checkRetriveMax'](0xb,_0xc51bc2,_0xe9b88f)&&!_0x18cf52){if(_0x13064b['countabandonedretry']>=_0xe9b88f[_0x8915('0x12f')]){_0x5ef67e[_0x8915('0x10e')](_0x13064b,_0x3dba04,_0xa9841f,'reason\x2011\x20abandoned');}else{_0x5ef67e[_0x8915('0x10d')](_0x13064b,_0x3dba04,_0xa9841f,_0x8915('0x1c3'));}}break;case'20':_0xe9b88f[_0x8915('0x65')]+=0x1;_0x13064b[_0x8915('0xa8')]=0x14;_0x13064b[_0x8915('0xa9')]=_0x8915('0x1c4');_0x13064b[_0x8915('0x101')]+=0x1;_0x13064b[_0x8915('0x10b')]+=0x1;_0x42985f=_0xe9b88f[_0x8915('0x1aa')];_0x3f6bb1=_0xe9b88f['callAdditionalPhoneAfterMin'];ami[_0x8915('0xf4')](_0x8915('0x1c5'),ut[_0x8915('0xf6')](_0xc51bc2,_0x8915('0x1c6')));_0x5ef67e[_0x8915('0xd1')](_0x13064b)[_0x8915('0xb9')](loggerCatch(_0x8915('0x1c7')));if(_0x5ef67e['checkRetriveMax'](0x14,_0xc51bc2,_0xe9b88f)&&!_0x18cf52){if(_0x13064b[_0x8915('0x101')]>=_0xe9b88f[_0x8915('0x1a9')]){_0x5ef67e[_0x8915('0x10e')](_0x13064b,_0x3dba04,_0xa9841f,_0x8915('0x1c8'));}else{_0x5ef67e['stateGlobal'](_0x13064b,_0x3dba04,_0xa9841f,_0x8915('0x1c8'));}}break;default:_0xe9b88f['outboundUnknownCallsDay']+=0x1;_0x13064b[_0x8915('0xa8')]=0xc;_0x13064b[_0x8915('0xa9')]=_0x5def7b[_0x8915('0x116')];_0x42985f=_0xe9b88f[_0x8915('0x1aa')];_0x3f6bb1=_0xe9b88f['callAdditionalPhoneAfterMin'];_0x5ef67e[_0x8915('0xd1')](_0x13064b)[_0x8915('0xb9')](loggerCatch(_0x8915('0x1c9')));if(_0x5ef67e[_0x8915('0x19c')](_0x5def7b[_0x8915('0x116')],_0xc51bc2,_0xe9b88f)&&!_0x18cf52){if(_0x13064b['countbusyretry']+_0x13064b[_0x8915('0xfd')]+_0x13064b['countnoanswerretry']+_0x13064b['countnosuchnumberretry']+_0x13064b[_0x8915('0xff')]+_0x13064b[_0x8915('0x100')]+_0x13064b[_0x8915('0xfa')]+_0x13064b[_0x8915('0x101')]>=_0xe9b88f[_0x8915('0x102')]){_0x5ef67e[_0x8915('0x10d')](_0x13064b,_0x3dba04,_0xa9841f,_0x5def7b['reason']);}else{_0x5ef67e['createStateFinal'](_0x13064b,_0x3dba04,_0xa9841f,_0x5def7b[_0x8915('0x116')]);}}}})[_0x8915('0xbc')](function(_0x5353f3){if(_0x18cf52){_0x5ef67e['swapAdditionalPhones'](_0x13064b,_0x42985f,_0x3f6bb1)['then'](function(_0x5af695){return _0x3dba04(0x1);});}});});};Dialer[_0x8915('0x1c')]['stateGlobal']=function(_0x412e18,_0x44a051,_0x54d425,_0x1bc518){var _0x5c2cda=new Final(_0x412e18);_0x5c2cda[_0x8915('0xa8')]=0xf;_0x5c2cda[_0x8915('0xa9')]=_0x8915('0x1ca');this[_0x8915('0x10e')](_0x5c2cda,_0x44a051,_0x54d425,_0x1bc518);};Dialer['prototype']['createStateFinal']=function(_0x473b40,_0x3c2e3c,_0x57d603,_0x3e4428){this[_0x8915('0xd0')](_0x473b40)[_0x8915('0xbc')](function(){return _0x3c2e3c(msgResponse(_0x8915('0x1ad'),_0x8915('0xe1'),_0x3e4428));})[_0x8915('0xb9')](function(){return _0x57d603(msgResponse('[moveContactManagedDialer][0]',_0x8915('0x14e'),_0x8915('0x1cb')));});};Dialer[_0x8915('0x1c')][_0x8915('0x8')]=function(_0x4aebc6){var _0x49ab49=_0x4aebc6[_0x8915('0x1cc')]/0x64;var _0x231598=_0x4aebc6[_0x8915('0x61')]/(_0x4aebc6[_0x8915('0x61')]+_0x4aebc6[_0x8915('0x5c')]);var _0xddaff0=Math[_0x8915('0x1cd')](_0x4aebc6[_0x8915('0x1ce')]*(_0x4aebc6[_0x8915('0x1cf')]/0x64));var _0x11064a=Math[_0x8915('0x1cd')](_0x4aebc6[_0x8915('0x1ce')]*(_0x4aebc6[_0x8915('0x1d0')]/0x64));var _0x3caa1a=_0x4aebc6['available']+_0x4aebc6[_0x8915('0xa1')];var _0x41fc2b=Math[_0x8915('0x1d1')](_0x4aebc6['erlangCalls']*_0x4aebc6['erlangAbandonmentRate']*_0x4aebc6[_0x8915('0x6b')]*_0x4aebc6[_0x8915('0x6c')]);if(_[_0x8915('0x3f')](_0x4aebc6[_0x8915('0x2a')])){if(!_[_0x8915('0x3f')](_0x4aebc6[_0x8915('0x29')])){_0x4aebc6['startPredictive']=undefined;loggerPredictive[_0x8915('0x95')]('[startMethodPredictive][StartProgressive]',_0x8915('0x1d2'));}if(!_['isUndefined'](_0x4aebc6[_0x8915('0x8f')])){loggerPredictive[_0x8915('0x95')](_0x8915('0x1d3'),_0x8915('0x1d4'));clearInterval(_0x4aebc6[_0x8915('0x8f')]);_0x4aebc6['handlePredictive']=undefined;}_0x4aebc6['startProgressive']=moment()[_0x8915('0x92')](_0x8915('0x108'));loggerPredictive[_0x8915('0x7d')](_0x4aebc6[_0x8915('0x41')],'collection\x20data\x20in\x20progressive\x20at',_0x4aebc6['startProgressive']);this['handlePower'](_0x4aebc6,0x1);}else if(ifInterval(_0x4aebc6[_0x8915('0x1d5')],_0x4aebc6[_0x8915('0x2a')])){this[_0x8915('0x161')](_0x4aebc6,0x1);loggerPredictiveCalls['info'](_0x8915('0x1d6'),_0x4aebc6[_0x8915('0x2a')],_0x4aebc6[_0x8915('0x41')]);_0x4aebc6[_0x8915('0x70')]=0x0;_0x4aebc6[_0x8915('0x6a')]=0x0;}else if(_0x49ab49<_0x231598&&_0x4aebc6['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x4aebc6);loggerPredictive[_0x8915('0x7d')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x8915('0x1d7'),_0x231598,_0x8915('0x2a'),_0x4aebc6['name']);}else if(_0x41fc2b<_0x4aebc6[_0x8915('0x6a')]&&_0x4aebc6['dialPredictiveOptimization']===_0x8915('0x1d8')){freeVariablesPredictive(_0x4aebc6);loggerPredictive[_0x8915('0x7d')](_0x8915('0x1d9'),_0x8915('0x1da'),_0x41fc2b,'Drop\x20in\x20this\x20interval',_0x4aebc6[_0x8915('0x6a')],_0x8915('0x2a'),_0x4aebc6[_0x8915('0x41')]);}else if(!ifInterval(_0x4aebc6[_0x8915('0x1d5')],_0x4aebc6[_0x8915('0x2a')])&&_[_0x8915('0x3f')](_0x4aebc6[_0x8915('0x29')])&&!_[_0x8915('0x3f')](_0x4aebc6[_0x8915('0x2a')])){_0x4aebc6[_0x8915('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8915('0x7d')](_0x4aebc6[_0x8915('0x41')],_0x8915('0x1db'),_0x4aebc6[_0x8915('0x29')]);this[_0x8915('0xc3')](_0x4aebc6[_0x8915('0x1d5')])[_0x8915('0xbc')](this[_0x8915('0x1dc')](_0x4aebc6))[_0x8915('0xbc')](mergeDataErlangB(_0x4aebc6))['then'](this[_0x8915('0x1dd')](_0x4aebc6))[_0x8915('0xb9')](loggerCatchPredictive(_0x8915('0x1de'),_0x4aebc6));}else if(!ifInterval(_0x4aebc6[_0x8915('0x1d5')],_0x4aebc6[_0x8915('0x29')])){_0x4aebc6[_0x8915('0x6a')]=0x0;_0x4aebc6[_0x8915('0x29')]=moment()['format'](_0x8915('0x108'));loggerPredictive[_0x8915('0x7d')](_0x4aebc6[_0x8915('0x41')],_0x8915('0x1df'),_0x4aebc6['startPredictive']);clearInterval(_0x4aebc6[_0x8915('0x8f')]);_0x4aebc6['handlePredictive']=undefined;this['averageHandleTime'](_0x4aebc6[_0x8915('0x1d5')])['then'](this[_0x8915('0x1dc')](_0x4aebc6))[_0x8915('0xbc')](mergeDataErlangB(_0x4aebc6))[_0x8915('0xbc')](this[_0x8915('0x1dd')](_0x4aebc6))['catch'](loggerCatchPredictive(_0x8915('0x1e0'),_0x4aebc6));}else if(_0x4aebc6[_0x8915('0x1ce')]&&_0x3caa1a<_0x4aebc6[_0x8915('0x1ce')]-_0x11064a){freeVariablesPredictive(_0x4aebc6);loggerPredictive[_0x8915('0x7d')](_0x4aebc6['name'],_0x8915('0x1e1'),_0x3caa1a,_0x8915('0x1e2'),_0x4aebc6[_0x8915('0x1ce')],'-',_0x11064a,'=',_0x4aebc6[_0x8915('0x1ce')]-_0x11064a,')');}else if(_0x4aebc6[_0x8915('0x1ce')]&&_0x3caa1a>_0x4aebc6[_0x8915('0x1ce')]+_0xddaff0){freeVariablesPredictive(_0x4aebc6);loggerPredictive['info'](_0x4aebc6[_0x8915('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3caa1a,_0x8915('0x1e3'),_0x4aebc6[_0x8915('0x1ce')],'+',_0xddaff0,'=',_0x4aebc6[_0x8915('0x1ce')]+_0xddaff0,')');}};Dialer[_0x8915('0x1c')][_0x8915('0x1dc')]=function(_0x2ecff4){var _0x41e662=this;return function(_0x2e92e0){return new BPromise(function(_0x2dd6ae,_0x3de06e){_[_0x8915('0x8d')](_0x2ecff4,_0x2e92e0[0x0]);if(checkGetDataPredictive(_0x2e92e0[0x0])){var _0x26f517=_0x2ecff4[_0x8915('0x1ce')]=_0x2ecff4[_0x8915('0xa1')]+_0x2ecff4[_0x8915('0xa2')];var _0x1a5dff=_0x2ecff4['dialPredictiveInterval']*0x3c;var _0x36e0ff=_0x2e92e0[0x0][_0x8915('0x68')]+_0x2e92e0[0x0][_0x8915('0x67')];var _0x506f36=(_0x2e92e0[0x0][_0x8915('0x7f')]+_0x2e92e0[0x0][_0x8915('0x81')]+_0x2e92e0[0x0][_0x8915('0x82')])/_0x2e92e0[0x0][_0x8915('0x6e')];_0x2ecff4[_0x8915('0x6b')]=_0x506f36>0x0?_0x506f36:0x1;switch(_0x2ecff4[_0x8915('0x1e4')]){case _0x8915('0x1d8'):var _0x2d7e85=_0x2ecff4[_0x8915('0x1cc')]/0x64;return _0x41e662[_0x8915('0x1e5')](_0x26f517,_0x1a5dff,_0x36e0ff,_0x506f36,_0x2d7e85)[_0x8915('0xbc')](function(_0x34c121){return _0x2dd6ae(_0x34c121);});case _0x8915('0x1e6'):var _0x65920d=_0x2ecff4[_0x8915('0x1cc')]/0x64;return _0x41e662[_0x8915('0x1e7')](_0x26f517,_0x1a5dff,_0x36e0ff,_0x506f36,_0x65920d)[_0x8915('0xbc')](function(_0x29c9cb){return _0x2dd6ae(_0x29c9cb);});default:return _0x3de06e(msgResponse(_0x8915('0x1e8'),'Failure',_0x8915('0x1e9')));}}else{return _0x3de06e(msgResponse(_0x8915('0x1e8'),'Failure',_0x8915('0x1ea')));}});};};Dialer[_0x8915('0x1c')]['getDataPredictiveOld']=function(_0x25f41a){var _0x13a545=this;return function(_0x34aa67){return new BPromise(function(_0x496cc5,_0x36a0d2){_[_0x8915('0x8d')](_0x25f41a,_0x34aa67[0x0]);if(checkGetDataPredictive(_0x34aa67[0x0])){loggerPredictive[_0x8915('0x7d')](JSON[_0x8915('0x4b')](_0x34aa67[0x0]));if(_0x25f41a[_0x8915('0x1e4')]===_0x8915('0x1d8')){return _0x13a545['getVoiceQueueRtPauses'](_0x25f41a['id'])[_0x8915('0xbc')](function(_0x5f3e7b){var _0x3df792=_0x25f41a[_0x8915('0x1eb')]-_0x5f3e7b[0x0][_0x8915('0x1ec')];var _0xc3d0e2=_0x25f41a[_0x8915('0x1d5')]*0x3c;var _0x567a33=_0x34aa67[0x0][_0x8915('0x68')]+_0x34aa67[0x0][_0x8915('0x67')];var _0x2305cb=(_0x34aa67[0x0]['predictiveIntervalAnsweredCalls']+_0x34aa67[0x0][_0x8915('0x81')]+_0x34aa67[0x0][_0x8915('0x82')])/_0x34aa67[0x0]['predictiveIntervalTotalCalls'];var _0x514887=_0x25f41a[_0x8915('0x1cc')]/0x64;_0x25f41a[_0x8915('0x6d')]=_0x5f3e7b[0x0][_0x8915('0x1ec')]||0x0;_0x25f41a[_0x8915('0x6b')]=_0x2305cb>0x0?_0x2305cb:0x1;return _0x13a545['abandonmentRate'](_0x3df792,_0xc3d0e2,_0x567a33,_0x2305cb,_0x514887);})[_0x8915('0xbc')](function(_0x3ac56b){return _0x496cc5(_0x3ac56b);})['catch'](function(_0x72481a){return _0x36a0d2(msgResponse(_0x8915('0x1ed'),_0x8915('0x14e'),JSON[_0x8915('0x4b')](_0x72481a)));});}if(_0x25f41a[_0x8915('0x1e4')]===_0x8915('0x1e6')){return _0x13a545[_0x8915('0xce')](_0x25f41a['id'])[_0x8915('0xbc')](function(_0x4c5bdb){var _0x23ac92=_0x25f41a[_0x8915('0x1eb')]-_0x4c5bdb[0x0]['outboundQueuePauses'];var _0x4dace1=_0x25f41a['dialPredictiveInterval']*0x3c;var _0x23f207=_0x34aa67[0x0][_0x8915('0x68')]+_0x34aa67[0x0]['predictiveIntervalAvgHoldtime'];var _0x1106ea=(_0x34aa67[0x0][_0x8915('0x7f')]+_0x34aa67[0x0][_0x8915('0x81')]+_0x34aa67[0x0][_0x8915('0x82')])/_0x34aa67[0x0]['predictiveIntervalTotalCalls'];var _0x233b4a=_0x25f41a[_0x8915('0x1cc')]/0x64;_0x25f41a[_0x8915('0x6d')]=_0x4c5bdb[0x0][_0x8915('0x1ec')]||0x0;_0x25f41a[_0x8915('0x6b')]=_0x1106ea>0x0?_0x1106ea:0x1;return _0x13a545['busyFactor'](_0x23ac92,_0x4dace1,_0x23f207,_0x1106ea,_0x233b4a);})['then'](function(_0x373b24){return _0x496cc5(_0x373b24);})[_0x8915('0xb9')](function(_0x2f4fdf){return _0x36a0d2(msgResponse(_0x8915('0x1ed'),'Failure',JSON['stringify'](_0x2f4fdf)));});}}else{return _0x36a0d2(msgResponse('[getDataPredictive]',_0x8915('0x14e'),_0x8915('0x1ea')));}});};};Dialer[_0x8915('0x1c')][_0x8915('0x1dd')]=function(_0x5a8dee){var _0x13e233=this;return function(){var _0x427ec2=0x0;var _0x2dae3c=Math[_0x8915('0x1d1')](_0x5a8dee['erlangCallToSecond']*0x3e8);if(_0x2dae3c>0x0){_0x2dae3c=_0x2dae3c<0x64?0x64:_0x2dae3c;loggerPredictive[_0x8915('0x7d')](_0x5a8dee[_0x8915('0x41')],_0x8915('0x1ee'),_0x2dae3c,_0x8915('0x4c'));_0x5a8dee[_0x8915('0x8f')]=setInterval(function(){_0x13e233['handlePredictive'](_0x5a8dee);loggerPredictiveCalls[_0x8915('0x7d')](_0x8915('0x1ef'),_0x427ec2+=0x1);},_0x2dae3c);}else{loggerPredictive[_0x8915('0x7d')](_0x5a8dee[_0x8915('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x8915('0x1c')][_0x8915('0x1f0')]=function(_0x44d2b6,_0x91385d){var _0x4d00a=this;return function(_0x3524b3){if(_[_0x8915('0x49')](_0x3524b3)){if(_['isNil'](_0x91385d[_0x8915('0xdb')])||!_0x91385d[_0x8915('0x1f1')]){if(_0x44d2b6['dialMethod']===_0x8915('0x7')){_0x44d2b6[_0x8915('0x138')]=_['isUndefined'](_0x44d2b6[_0x8915('0x138')])?!![]:_0x44d2b6[_0x8915('0x138')];var _0x258aa7=uuid['v4']();_0x4d00a[_0x8915('0xae')][_0x258aa7]=new Action(_0x44d2b6,_0x91385d,_0x258aa7);loggerBooked[_0x8915('0x7d')](_0x8915('0x1f2'),_0x258aa7,_0x8915('0x1f3'),JSON['stringify'](_0x44d2b6[_0x8915('0x138')]),_0x8915('0x1f4'),_0x44d2b6[_0x8915('0x41')]);if(_0x44d2b6[_0x8915('0x138')]){_0x44d2b6[_0x8915('0x138')]=![];_0x4d00a[_0x8915('0x2b')][_0x4d00a[_0x8915('0xae')][_0x258aa7]['queue']]=[];ami['Action']({'actionid':_0x258aa7,'action':_0x8915('0x1f5'),'queue':_0x44d2b6[_0x8915('0x41')]})['catch'](function(){_0x4d00a[_0x8915('0xb6')](_0x44d2b6);_0x4d00a[_0x8915('0xc5')]({'active':![],'ContactId':_0x4d00a[_0x8915('0xae')][_0x258aa7][_0x8915('0xd9')],'ListId':_0x4d00a[_0x8915('0xae')][_0x258aa7][_0x8915('0xda')],'VoiceQueueId':_0x4d00a[_0x8915('0xae')][_0x258aa7][_0x8915('0xdc')]||undefined,'CampaignId':_0x4d00a['actions'][_0x258aa7][_0x8915('0xdd')]||undefined})['catch'](loggerCatch(_0x8915('0x1f6')));delete _0x4d00a[_0x8915('0xae')][_0x258aa7];});}else{loggerBooked[_0x8915('0x7d')](_0x8915('0x1f7'),JSON[_0x8915('0x4b')](_0x44d2b6[_0x8915('0x138')]),'Queue:\x20',_0x44d2b6[_0x8915('0x41')]);_0x4d00a[_0x8915('0xb6')](_0x44d2b6);_0x4d00a['rescheduleContact']({'active':![],'ContactId':_0x4d00a[_0x8915('0xae')][_0x258aa7][_0x8915('0xd9')],'ListId':_0x4d00a[_0x8915('0xae')][_0x258aa7][_0x8915('0xda')],'VoiceQueueId':_0x4d00a[_0x8915('0xae')][_0x258aa7][_0x8915('0xdc')]||undefined,'CampaignId':_0x4d00a[_0x8915('0xae')][_0x258aa7][_0x8915('0xdd')]||undefined})['catch'](loggerCatch(_0x8915('0x1f6')));delete _0x4d00a[_0x8915('0xae')][_0x258aa7];}}else{return _0x4d00a[_0x8915('0x1f8')](_0x44d2b6,_0x91385d);}}else{if(getDiff(_0x91385d[_0x8915('0x1f9')])<_0x44d2b6['dialRecallMeTimeout']*0x3c){if(_0x91385d['Agent']&&!_0x91385d[_0x8915('0x1fa')][_0x8915('0x1fb')]){_0x4d00a[_0x8915('0x20')]['run'](_0x91385d['id'])[_0x8915('0x1f')](function(){_0x4d00a[_0x8915('0xb6')](_0x44d2b6);});}else{_0x4d00a[_0x8915('0xc7')]({'active':![]},_0x91385d['id'],0x1)[_0x8915('0x1f')](function(){_0x4d00a[_0x8915('0xb6')](_0x44d2b6);});}}else{_0x44d2b6[_0x8915('0x1fc')]+=0x1;_0x4d00a[_0x8915('0xb6')](_0x44d2b6);if(_0x44d2b6[_0x8915('0x1fd')]){_0x4d00a[_0x8915('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x91385d[_0x8915('0xd9')],'ListId':_0x91385d[_0x8915('0xda')],'VoiceQueueId':_0x91385d[_0x8915('0xdc')]||undefined,'CampaignId':_0x91385d[_0x8915('0xdd')]||undefined})[_0x8915('0xb9')](loggerCatch(_0x8915('0x1fe')));_0x4d00a['createHistory'](createObjHistory(_0x44d2b6,_0x91385d,_0x8915('0x1ff'),0x17,_0x8915('0x200')))[_0x8915('0xb9')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4d00a[_0x8915('0xd8')](createObjHistory(_0x44d2b6,_0x91385d,_0x8915('0x201'),0x16,_0x8915('0x202')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x44d2b6[_0x8915('0x5d')]+=0x1;_0x4d00a[_0x8915('0xd8')](createObjHistory(_0x44d2b6,_0x91385d,_0x8915('0x203'),0xd,'Blacklist'),_0x8915('0x204'),_0x8915('0x205'));throw'inBlackList';}};};Dialer[_0x8915('0x1c')][_0x8915('0x206')]=function(_0x23b834){var _0x37b200=this;var _0x1e0088=_0x23b834['limitCalls']-_0x23b834['originated']-_0x23b834[_0x8915('0xca')];emitCampaignSummary(_0x23b834);if(_0x1e0088>0x0){if(_0x1e0088>this['maxNumberOriginate']){_0x1e0088=this[_0x8915('0x25')];}_0x23b834[_0x8915('0xca')]+=_0x1e0088;this['getContactDialerIvr'](_0x23b834['id'],_0x1e0088,_0x23b834['dialOrderByScheduledAt'],_0x23b834)[_0x8915('0xbc')](function(_0x45bf47){_0x23b834[_0x8915('0xca')]-=_0x1e0088;_0x23b834[_0x8915('0xca')]=_0x23b834[_0x8915('0xca')]>0x0?_0x23b834[_0x8915('0xca')]:0x0;if(!checkContactEmpty(_0x45bf47)){_0x23b834[_0x8915('0x40')]=_0x8915('0x9e');logger[_0x8915('0x7d')](_0x8915('0x207')+_0x23b834['name']);}else{_0x23b834[_0x8915('0x6f')]+=_0x45bf47[_0x8915('0x97')];_0x23b834[_0x8915('0x40')]=_0x8915('0x208');for(var _0x3cf4c1=0x0;_0x3cf4c1<_0x45bf47[_0x8915('0x97')];_0x3cf4c1+=0x1){_0x23b834[_0x8915('0x209')]+=0x1;if(_[_0x8915('0xe8')](_0x45bf47[_0x3cf4c1])||_[_0x8915('0xe8')](_0x45bf47[_0x3cf4c1]['Contact'])||_[_0x8915('0xe8')](_0x45bf47[_0x3cf4c1][_0x8915('0x170')])){_0x37b200[_0x8915('0xd6')](_0x8915('0x20a'),_0x23b834,_0x45bf47[_0x3cf4c1]);}else{_0x37b200[_0x8915('0xc1')](_['pick'](_0x45bf47[_0x3cf4c1],['CampaignId',_0x8915('0x20b')]))['then'](_0x37b200[_0x8915('0x1f0')](_0x23b834,_0x45bf47[_0x3cf4c1]))[_0x8915('0xb9')](_0x37b200['loggerHandler']('[actionOriginateIvr]\x20',_0x23b834));}}}})[_0x8915('0xb9')](loggerGetContactDialer(_0x8915('0x20c'),_0x23b834,_0x1e0088));}};Dialer[_0x8915('0x1c')][_0x8915('0x161')]=function(_0x61fa07,_0x24195f){var _0x4f317e=this;var _0x4b3636=[];var _0x36d22f=_0x24195f>=0x1?_0x24195f:0x1;if(_0x61fa07['dialMethod']===_0x8915('0x7')){_0x36d22f=0x1;}var _0x399344=Math[_0x8915('0x1d1')](_0x61fa07[_0x8915('0xa2')]*_0x36d22f)-_0x61fa07[_0x8915('0x6f')]-_0x61fa07[_0x8915('0xca')];emitVoiceQueueSummary(_0x61fa07);if(_0x61fa07['dialLimitQueue']>0x0){var _0x2558fb=_0x61fa07[_0x8915('0x20d')]-_0x61fa07[_0x8915('0x6f')]-_0x61fa07['talking']-_0x61fa07['temp']-_0x61fa07[_0x8915('0x51')];if(_0x399344>_0x2558fb){_0x399344=_0x2558fb;}}if(_0x399344>0x0){if(_0x61fa07[_0x8915('0x15e')]===_0x8915('0x7')){_0x399344=0x1;}if(_0x399344>this[_0x8915('0x25')]){_0x399344=this[_0x8915('0x25')];}_0x61fa07[_0x8915('0xca')]+=_0x399344;for(var _0x366d03 in this['agents']){if(typeof this[_0x8915('0x23')][_0x366d03]!=='undefined'){if(this[_0x8915('0x23')][_0x366d03][_0x8915('0xa8')]===_0x8915('0x20e')&&this[_0x8915('0x23')][_0x366d03]['status']===_0x8915('0xe4')){_0x4b3636['push'](this[_0x8915('0x23')][_0x366d03]['id']);}}}this['getContactDialer'](_0x61fa07['id'],_0x4b3636,_0x399344,_0x61fa07['dialOrderByScheduledAt'],_0x61fa07)['then'](function(_0x37b3c9){_0x61fa07[_0x8915('0xca')]-=_0x399344;_0x61fa07[_0x8915('0xca')]=_0x61fa07[_0x8915('0xca')]>0x0?_0x61fa07[_0x8915('0xca')]:0x0;if(!checkContactEmpty(_0x37b3c9)){_0x4f317e[_0x8915('0x20f')](_0x61fa07)[_0x8915('0xbc')](sendMessageReschedule(_0x61fa07))[_0x8915('0xb9')](loggerCatch(_0x8915('0xba')));}else{_0x61fa07['originated']+=_0x37b3c9[_0x8915('0x97')];_0x61fa07[_0x8915('0x40')]=_0x61fa07['dialMethod']===_0x8915('0x7')?_0x8915('0x175'):_0x8915('0x208');for(var _0xa49ae4=0x0;_0xa49ae4<_0x37b3c9[_0x8915('0x97')];_0xa49ae4+=0x1){if(_[_0x8915('0xe8')](_0x37b3c9[_0xa49ae4])||_['isNil'](_0x37b3c9[_0xa49ae4][_0x8915('0x186')])||_[_0x8915('0xe8')](_0x37b3c9[_0xa49ae4]['phone'])){_0x4f317e[_0x8915('0xd6')](_0x8915('0x20a'),_0x61fa07,_0x37b3c9[_0xa49ae4]);}else{_0x4f317e[_0x8915('0xbb')](_[_0x8915('0x140')](_0x37b3c9[_0xa49ae4],[_0x8915('0xdc'),'Contact.phone']))[_0x8915('0xbc')](_0x4f317e['checkContactBlack'](_0x61fa07,_0x37b3c9[_0xa49ae4]))[_0x8915('0xb9')](_0x4f317e['loggerHandler'](_0x8915('0x20a'),_0x61fa07));}}}})[_0x8915('0xb9')](loggerGetContactDialer(_0x8915('0x210'),_0x61fa07,_0x399344));}};Dialer['prototype'][_0x8915('0x8f')]=function(_0x8c74e2){if(_0x8c74e2['dialLimitQueue']>0x0){var _0x594c37=_0x8c74e2[_0x8915('0x20d')]-_0x8c74e2[_0x8915('0x6f')]-_0x8c74e2[_0x8915('0xa1')];if(_0x594c37>0x0){this['tryOriginatePredictive'](_0x8c74e2);}else{loggerPredictiveCalls[_0x8915('0x7d')](_0x8915('0x211'));}}else{this[_0x8915('0x212')](_0x8c74e2);}};Dialer['prototype'][_0x8915('0x212')]=function(_0x245f10){var _0x5c4384=this;var _0x252d16=[];_0x245f10[_0x8915('0x6f')]+=0x1;for(var _0x5ccd19 in this[_0x8915('0x23')]){if(typeof this[_0x8915('0x23')][_0x5ccd19]!==_0x8915('0x98')){if(this[_0x8915('0x23')][_0x5ccd19][_0x8915('0xa8')]===_0x8915('0x20e')&&this['agents'][_0x5ccd19][_0x8915('0xb2')]===_0x8915('0xe4')){_0x252d16[_0x8915('0x213')](this[_0x8915('0x23')][_0x5ccd19]['id']);}}}this[_0x8915('0xc9')](_0x245f10['id'],_0x252d16,0x1,_0x245f10[_0x8915('0x214')],_0x245f10)[_0x8915('0xbc')](function(_0x19b39b){if(!checkContactEmpty(_0x19b39b)){checkContactLowerLimitOriginate(_0x245f10,0x1,0x0);_0x5c4384[_0x8915('0x20f')](_0x245f10)['then'](sendMessageReschedule(_0x245f10))[_0x8915('0xb9')](loggerCatch(_0x8915('0xba')));}else{_0x245f10[_0x8915('0x40')]=_0x8915('0x208');if(_[_0x8915('0xe8')](_0x19b39b[0x0])||_[_0x8915('0xe8')](_0x19b39b[0x0][_0x8915('0x186')])||_[_0x8915('0xe8')](_0x19b39b[0x0]['phone'])){_0x5c4384[_0x8915('0xd6')](_0x8915('0x20a'),_0x245f10,_0x19b39b[0x0]);}else{_0x5c4384[_0x8915('0xbb')](_[_0x8915('0x140')](_0x19b39b[0x0],[_0x8915('0xdc'),'Contact.phone']))['then'](_0x5c4384[_0x8915('0x1f0')](_0x245f10,_0x19b39b[0x0]))[_0x8915('0xb9')](_0x5c4384[_0x8915('0xd5')](_0x8915('0x215'),_0x245f10));}}})['catch'](loggerGetContactDialer(_0x8915('0x216'),_0x245f10,0x1));emitVoiceQueueSummary(_0x245f10);};Dialer[_0x8915('0x1c')][_0x8915('0x1e5')]=function(_0x104edd,_0x47fbe3,_0x54538f,_0xe6cd5a,_0x27e12b,_0x339cb8){loggerPredictive[_0x8915('0x7d')](_0x8915('0x217'));loggerPredictive[_0x8915('0x7d')](_0x8915('0x218'),_0x104edd);loggerPredictive[_0x8915('0x7d')](_0x8915('0x219'),_0x47fbe3);loggerPredictive[_0x8915('0x7d')](_0x8915('0x21a'),_0x54538f);loggerPredictive[_0x8915('0x7d')](_0x8915('0x21b'),_0xe6cd5a);loggerPredictive[_0x8915('0x7d')](_0x8915('0x21c'),_0x27e12b);loggerPredictive[_0x8915('0x7d')](_0x8915('0x85'));return new BPromise(function(_0x25225d,_0xbeafef){if(_0x104edd<=0x0||isNaN(_0x104edd)){return _0xbeafef(msgResponse(_0x8915('0x21d'),_0x8915('0x4a'),_0x8915('0x21e')+_0x104edd));}if(_0x54538f<=0x0||isNaN(_0x54538f)){return _0xbeafef(msgResponse(_0x8915('0x21d'),_0x8915('0x4a'),_0x8915('0x21f')+_0x54538f));}if(_0xe6cd5a<=0x0||isNaN(_0xe6cd5a)){return _0xbeafef(msgResponse(_0x8915('0x21d'),'Error',_0x8915('0x220')+_0xe6cd5a));}if(_0x47fbe3<=0x0||isNaN(_0x47fbe3)){return _0xbeafef(msgResponse(_0x8915('0x21d'),_0x8915('0x4a'),_0x8915('0x221')+_0x47fbe3));}if(_0x27e12b<=0x0||isNaN(_0x27e12b)){return _0xbeafef(msgResponse(_0x8915('0x21d'),'Error',_0x8915('0x222')+_0x27e12b));}_0x339cb8=_0x339cb8||0x0;var _0x32a3bf=0x1/_0x54538f;var _0x5d2ed8=0x0;var _0x5e2613=0x0;var _0x2470ac=0x0;var _0x310387=0x0;for(var _0x31b07a=0x0;_0x2470ac<_0x27e12b;_0x31b07a+=0x1){_0x5e2613=_0x31b07a/_0x47fbe3;_0x5d2ed8=(_0xe6cd5a*_0x5e2613+_0x339cb8)/_0x32a3bf;_0x2470ac=erlangb(_0x5d2ed8,_0x104edd);_0x310387=_0x5d2ed8/_0x104edd*(0x1-erlangb(_0x5d2ed8,_0x104edd));}return _0x25225d({'erlangCalls':_0x31b07a,'erlangCallToSecond':_0x47fbe3/_0x31b07a,'erlangAbandonmentRate':_0x2470ac,'erlangBusyFactor':_0x310387});});};Dialer['prototype'][_0x8915('0x1e7')]=function(_0x2f5c52,_0x53eaf8,_0x23a720,_0x44b33c,_0x30c2ec,_0x23fccb){loggerPredictive[_0x8915('0x7d')](_0x8915('0x223'));loggerPredictive[_0x8915('0x7d')](_0x8915('0x218'),_0x2f5c52);loggerPredictive[_0x8915('0x7d')](_0x8915('0x219'),_0x53eaf8);loggerPredictive['info'](_0x8915('0x21a'),_0x23a720);loggerPredictive[_0x8915('0x7d')](_0x8915('0x21b'),_0x44b33c);loggerPredictive[_0x8915('0x7d')](_0x8915('0x224'),_0x30c2ec);loggerPredictive[_0x8915('0x7d')](_0x8915('0x85'));return new BPromise(function(_0x22b9d6,_0x241d2d){if(_0x2f5c52<=0x0||isNaN(_0x2f5c52)){return _0x241d2d(msgResponse(_0x8915('0x225'),_0x8915('0x4a'),_0x8915('0x21e')+_0x2f5c52));}if(_0x23a720<=0x0||isNaN(_0x23a720)){return _0x241d2d(msgResponse(_0x8915('0x225'),_0x8915('0x4a'),_0x8915('0x21f')+_0x23a720));}if(_0x44b33c<=0x0||isNaN(_0x44b33c)){return _0x241d2d(msgResponse(_0x8915('0x225'),_0x8915('0x4a'),_0x8915('0x220')+_0x44b33c));}if(_0x53eaf8<=0x0||isNaN(_0x53eaf8)){return _0x241d2d(msgResponse(_0x8915('0x225'),_0x8915('0x4a'),_0x8915('0x221')+_0x53eaf8));}if(_0x30c2ec<=0x0||isNaN(_0x30c2ec)){return _0x241d2d(msgResponse('[busyFactor]',_0x8915('0x4a'),'Umin\x20=\x20'+_0x30c2ec));}_0x23fccb=_0x23fccb||0x0;var _0x562972=0x1/_0x23a720;var _0x73b176=0x0;var _0x176f6b=0x0;var _0x4f8c43=0x0;var _0x2390b5=0x0;for(var _0x3d8069=0x0;_0x2390b5<_0x30c2ec;_0x3d8069+=0x1){_0x176f6b=_0x3d8069/_0x53eaf8;_0x73b176=(_0x44b33c*_0x176f6b+_0x23fccb)/_0x562972;_0x4f8c43=erlangb(_0x73b176,_0x2f5c52);_0x2390b5=_0x73b176/_0x2f5c52*(0x1-erlangb(_0x73b176,_0x2f5c52));}return _0x22b9d6({'erlangCalls':_0x3d8069,'erlangCallToSecond':_0x53eaf8/_0x3d8069,'erlangAbandonmentRate':_0x4f8c43,'erlangBusyFactor':_0x2390b5});});};module[_0x8915('0x226')]=Dialer; \ No newline at end of file +var _0xde9f=['dialQueueProject','AnswerAGI','cause-txt','Unknow','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','agiafterat','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','starttime','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','strategy','push','merge','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','finally','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','substring','trim','from-sip','[originateError]:\x20%s','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','dialPredictiveOptimization','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','startMethodPredictive','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','[countReScheduled]\x20','ACTIVE','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\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','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','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','interval\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','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','uuid','moment','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./agentComplete','./queueCallerAbandon','./hangup','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','name','Interval','Intervals','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','handlePredictive','preview','string','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','waiting','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','catch','updateOriginated','voiceQueues','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','AMD','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countcongestionretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]'];(function(_0x4bcfb2,_0x43c1d1){var _0x25579b=function(_0x205028){while(--_0x205028){_0x4bcfb2['push'](_0x4bcfb2['shift']());}};_0x25579b(++_0x43c1d1);}(_0xde9f,0x118));var _0xfde9=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0xde9f[_0xb5fc3e];return _0x2efc3c;};'use strict';var util=require(_0xfde9('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xfde9('0x1'));var moment=require(_0xfde9('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xfde9('0x3'));var ut=require(_0xfde9('0x4'));var config=require('../../../config/environment/');var logger=require(_0xfde9('0x5'))(_0xfde9('0x6'));var loggerBooked=require(_0xfde9('0x5'))(_0xfde9('0x7'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0xfde9('0x5'))(_0xfde9('0x8'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xfde9('0x9'));var ami=require(_0xfde9('0xa'));config[_0xfde9('0xb')]=_[_0xfde9('0xc')](config[_0xfde9('0xb')],{'host':_0xfde9('0xd'),'port':0x18eb});var io=require(_0xfde9('0xe'))(new Redis(config[_0xfde9('0xb')]));var cmHopper=require(_0xfde9('0xf'));var cmHopperHistory=require(_0xfde9('0x10'));var cmHopperFinal=require(_0xfde9('0x11'));var cmHopperAdditionalPhone=require(_0xfde9('0x12'));var cmHopperBlack=require(_0xfde9('0x13'));var voiceQueueRt=require(_0xfde9('0x14'));var Action=require('./action');var History=require('./history');var Final=require(_0xfde9('0x15'));var AgentComplete=require(_0xfde9('0x16'));var QueueCallerAbandon=require(_0xfde9('0x17'));var Hangup=require(_0xfde9('0x18'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xfde9('0x19');var strategy={'rrmemory':_0xfde9('0x1a'),'roundrobin':_0xfde9('0x1b')};var Sequence=function(){};Sequence[_0xfde9('0x1c')][_0xfde9('0x1d')]=function(_0x489841){this[_0xfde9('0x1e')]=this[_0xfde9('0x1e')]?this[_0xfde9('0x1e')]['finally'](_0x489841):_0x489841();};function Dialer(_0x31b1c7,_0x6a5413){this[_0xfde9('0x1f')]=new Sequence();this['preview']=_0x6a5413;this['voiceQueues']=_0x31b1c7['voiceQueues'];this['campaigns']=_0x31b1c7[_0xfde9('0x20')];this[_0xfde9('0x21')]=_0x31b1c7['agents'];this['trunks']=_0x31b1c7[_0xfde9('0x22')];this[_0xfde9('0x23')]=config[_0xfde9('0x23')]||0x2;this[_0xfde9('0x24')]={};this[_0xfde9('0x25')]={};this[_0xfde9('0x26')]={};this[_0xfde9('0x27')]={};this[_0xfde9('0x28')]={};this[_0xfde9('0x29')]={};this[_0xfde9('0x2a')]={};this[_0xfde9('0x2b')]={};this[_0xfde9('0x2c')]={};this['queueBookedRR']={};ami['on'](_0xfde9('0x2d'),this['syncAgentConnect'][_0xfde9('0x2e')](this));ami['on'](_0xfde9('0x2f'),this[_0xfde9('0x30')]['bind'](this));ami['on'](_0xfde9('0x31'),this[_0xfde9('0x32')]['bind'](this));ami['on'](_0xfde9('0x33'),this[_0xfde9('0x34')][_0xfde9('0x2e')](this));ami['on'](_0xfde9('0x35'),this[_0xfde9('0x9')][_0xfde9('0x2e')](this));ami['on'](_0xfde9('0x36'),this[_0xfde9('0x37')][_0xfde9('0x2e')](this));ami['on'](_0xfde9('0x38'),this[_0xfde9('0x39')][_0xfde9('0x2e')](this));ami['on'](_0xfde9('0x3a'),this[_0xfde9('0x3b')][_0xfde9('0x2e')](this));ami['on'](_0xfde9('0x3c'),this['syncQueueMember']['bind'](this));ami['on'](_0xfde9('0x3d'),this[_0xfde9('0x3e')]['bind'](this));this[_0xfde9('0x3f')]();this[_0xfde9('0x40')]();}function isNotNull(_0x1651e0){return _0x1651e0!==null&&!_[_0xfde9('0x41')](_0x1651e0);}function checkIsLoggedIn(_0x3c8c48,_0x595b4e){return function(){if(_0x595b4e<=0x0){_0x3c8c48[_0xfde9('0x42')]=_0xfde9('0x43');throw _0x3c8c48['name']+_0xfde9('0x44');}};}function isActive(_0x25b046){return _0x25b046;}function checkIsActive(_0x1613d7,_0x24bf33){return function(){if(!isActive(_0x24bf33)){_0x1613d7[_0xfde9('0x42')]='NOT_ACTIVE';throw _0x1613d7[_0xfde9('0x45')]+'\x20NOT\x20Active';}};}function checkInterval(_0x35dfe5){return function(){if(!isNotNull(_0x35dfe5['Interval'])){_0x35dfe5[_0xfde9('0x42')]='INTERVAL_IS_NULL';throw _0x35dfe5[_0xfde9('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x35dfe5[_0xfde9('0x46')][_0xfde9('0x47')])){_0x35dfe5[_0xfde9('0x42')]=_0xfde9('0x48');throw _0x35dfe5[_0xfde9('0x45')]+_0xfde9('0x49');}if(!isNotNull(_[_0xfde9('0x4a')](_0x35dfe5[_0xfde9('0x46')][_0xfde9('0x47')]))){_0x35dfe5[_0xfde9('0x42')]=_0xfde9('0x48');throw _0x35dfe5['name']+_0xfde9('0x49');}};}function msgResponse(_0x223949,_0x20c2a4,_0x304323){return{'action':_0x223949,'response':_0x20c2a4,'message':_0x304323,'stack':_0x304323};}function myreject(_0x4f6b6e){return function(_0x3cd49c){return _0x4f6b6e(msgResponse(_0xfde9('0x4b'),_0xfde9('0x4c'),JSON[_0xfde9('0x4d')](_0x3cd49c)));};}function getSeconds(_0x21b30f,_0x29bb5f){var _0x481488=moment(_0x21b30f)[_0xfde9('0x4e')](0x0);var _0x4f96a5=moment(_0x29bb5f)[_0xfde9('0x4e')](0x0);return _0x481488[_0xfde9('0x4f')](_0x4f96a5,_0xfde9('0x50'));}function emit(_0x5bd53a,_0xe47e34,_0x350977){io['to'](_0x5bd53a)[_0xfde9('0x51')](_0xe47e34,_0x350977);}function emitVoiceQueueSummary(_0x2f8f83){if(_0x2f8f83[_0xfde9('0x52')]===_0xfde9('0x53')){var _0x3da564={'id':_0x2f8f83['id'],'name':_0x2f8f83[_0xfde9('0x45')],'strategy':_0x2f8f83['strategy'],'answered':_0x2f8f83[_0xfde9('0x54')],'available':_0x2f8f83[_0xfde9('0x55')],'loggedIn':_0x2f8f83[_0xfde9('0x56')],'pTalking':_0x2f8f83[_0xfde9('0x57')],'sumBillable':_0x2f8f83[_0xfde9('0x58')],'sumDuration':_0x2f8f83['sumDuration'],'sumHoldTime':_0x2f8f83[_0xfde9('0x59')]||0x0,'talking':_0x2f8f83[_0xfde9('0x5a')],'total':_0x2f8f83['total'],'type':_0x2f8f83[_0xfde9('0x52')],'unmanaged':_0x2f8f83[_0xfde9('0x5b')],'abandoned':_0x2f8f83[_0xfde9('0x5c')],'waiting':_0x2f8f83['waiting'],'loggedInDb':_0x2f8f83['loggedInDb'],'dialActive':_0x2f8f83['dialActive'],'dialMethod':_0x2f8f83[_0xfde9('0x5d')],'dialOriginateCallerIdName':_0x2f8f83[_0xfde9('0x5e')],'dialOriginateCallerIdNumber':_0x2f8f83[_0xfde9('0x5f')],'dialOriginateTimeout':_0x2f8f83[_0xfde9('0x60')],'dialPrefix':_0x2f8f83[_0xfde9('0x61')],'outboundAnswerAgiCallsDay':_0x2f8f83[_0xfde9('0x62')],'outboundAnswerCallsDay':_0x2f8f83[_0xfde9('0x63')],'outboundBlacklistCallsDay':_0x2f8f83[_0xfde9('0x64')],'outboundBusyCallsDay':_0x2f8f83[_0xfde9('0x65')],'outboundCongestionCallsDay':_0x2f8f83[_0xfde9('0x66')],'outboundDropCallsDayACS':_0x2f8f83[_0xfde9('0x67')],'outboundDropCallsDayCallersExit':_0x2f8f83[_0xfde9('0x68')],'outboundDropCallsDayTimeout':_0x2f8f83['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2f8f83['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2f8f83['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x2f8f83['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2f8f83[_0xfde9('0x69')],'outboundRejectCallsDay':_0x2f8f83[_0xfde9('0x6a')],'outboundUnknownCallsDay':_0x2f8f83[_0xfde9('0x6b')],'predictiveIntervalAnsweredCalls':_0x2f8f83[_0xfde9('0x6c')],'predictiveIntervalAvgHoldtime':_0x2f8f83[_0xfde9('0x6d')],'predictiveIntervalAvgTalktime':_0x2f8f83[_0xfde9('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x2f8f83[_0xfde9('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x2f8f83[_0xfde9('0x70')],'predictiveIntervalErlangCalls':_0x2f8f83[_0xfde9('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x2f8f83[_0xfde9('0x72')],'predictiveIntervalHitRate':_0x2f8f83[_0xfde9('0x73')],'predictiveIntervalMultiplicativeFactor':_0x2f8f83[_0xfde9('0x74')],'predictiveIntervalPauses':_0x2f8f83[_0xfde9('0x75')],'predictiveIntervalAvailable':_0x2f8f83[_0xfde9('0x76')],'predictiveIntervalTotalCalls':_0x2f8f83[_0xfde9('0x77')],'message':_0x2f8f83[_0xfde9('0x42')],'originated':_0x2f8f83[_0xfde9('0x78')],'erlangCalls':_0x2f8f83[_0xfde9('0x79')],'erlangCallToSecond':_0x2f8f83[_0xfde9('0x7a')],'erlangAbandonmentRate':_0x2f8f83['erlangAbandonmentRate'],'erlangBusyFactor':_0x2f8f83[_0xfde9('0x7b')],'startPredictive':_0x2f8f83[_0xfde9('0x29')],'startProgressive':_0x2f8f83[_0xfde9('0x2a')]};if(_0x2f8f83[_0xfde9('0x7c')]){_0x3da564[_0xfde9('0x7c')]={'id':_0x2f8f83[_0xfde9('0x7c')]['id'],'name':_0x2f8f83['Trunk'][_0xfde9('0x45')],'active':_0x2f8f83['Trunk'][_0xfde9('0x7d')],'callerid':_0x2f8f83['Trunk'][_0xfde9('0x7e')]};}if(_0x2f8f83[_0xfde9('0x46')]){_0x3da564[_0xfde9('0x46')]={'id':_0x2f8f83[_0xfde9('0x46')]['id'],'name':_0x2f8f83[_0xfde9('0x46')]['name']};}var _0x1c9140=md5(JSON[_0xfde9('0x4d')](_0x3da564));if(_0x2f8f83[_0xfde9('0x7f')]!==_0x1c9140){_0x2f8f83[_0xfde9('0x7f')]=_0x1c9140;emit(util[_0xfde9('0x80')](_0xfde9('0x81'),_0x3da564[_0xfde9('0x45')]),_0xfde9('0x82'),_0x3da564);}}}function emitCampaignSummary(_0x76df85){if(_0x76df85[_0xfde9('0x52')]===_0xfde9('0x83')){emit(util['format'](_0xfde9('0x84'),_0x76df85[_0xfde9('0x45')]),_0xfde9('0x85'),_0x76df85);}}function checkGetDataPredictive(_0xaa49a5){if(isNotNull(_0xaa49a5)&&!_[_0xfde9('0x4a')](_0xaa49a5)){loggerPredictive[_0xfde9('0x86')](_0xfde9('0x87'));loggerPredictive[_0xfde9('0x86')](_0xfde9('0x88'),_0xaa49a5[_0xfde9('0x77')]);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x89'),_0xaa49a5[_0xfde9('0x6c')]);loggerPredictive['info'](_0xfde9('0x8a'),_0xaa49a5['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xfde9('0x8b'),_0xaa49a5[_0xfde9('0x6f')]);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x8c'),_0xaa49a5['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x8d'),_0xaa49a5[_0xfde9('0x6e')]);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x8e'));if(_0xaa49a5['predictiveIntervalTotalCalls']>0x0){if(!_[_0xfde9('0x41')](_0xaa49a5[_0xfde9('0x6e')])&&_0xaa49a5[_0xfde9('0x6e')]>0x0){return!![];}loggerPredictive[_0xfde9('0x86')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xfde9('0x41')](_0xaa49a5['predictiveIntervalAvgHoldtime'])&&_0xaa49a5[_0xfde9('0x6d')]>0x0){return!![];}loggerPredictive[_0xfde9('0x86')](_0xfde9('0x8f'));}else{loggerPredictive[_0xfde9('0x86')](_0xfde9('0x90'));}}else{loggerPredictive[_0xfde9('0x86')](_0xfde9('0x91'));}return![];}function mergeDataErlangB(_0x1faa9d){return function(_0x12ff2b){loggerPredictive[_0xfde9('0x86')](_0xfde9('0x92'));loggerPredictive[_0xfde9('0x86')](_0xfde9('0x93'),_0x12ff2b['erlangCalls']);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x94'),_0x12ff2b['erlangCallToSecond']);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x95'),_0x12ff2b[_0xfde9('0x96')]);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x97'),_0x12ff2b[_0xfde9('0x7b')]);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x95'),_0x12ff2b[_0xfde9('0x96')]);loggerPredictive['info'](_0xfde9('0x8e'));_['merge'](_0x1faa9d,_0x12ff2b);};}function getDiff(_0x404f2c){var _0x25b0c4=moment()['milliseconds'](0x0);var _0xdd9962=moment(_0x404f2c)[_0xfde9('0x4e')](0x0);return _0x25b0c4['diff'](_0xdd9962,_0xfde9('0x50'));}function ifInterval(_0x25342c,_0x4d8fdc){if(_[_0xfde9('0x41')](_0x4d8fdc)){return![];}return getDiff(_0x4d8fdc)<_0x25342c*0x3c;}function freeVariablesPredictive(_0x1538c6){if(isNotNull(_0x1538c6)){if(!_[_0xfde9('0x41')](_0x1538c6['startProgressive'])){_0x1538c6[_0xfde9('0x2a')]=undefined;loggerPredictive[_0xfde9('0x86')](_0x1538c6[_0xfde9('0x45')],_0xfde9('0x98'));}if(!_[_0xfde9('0x41')](_0x1538c6['startPredictive'])){_0x1538c6[_0xfde9('0x29')]=undefined;loggerPredictive[_0xfde9('0x86')](_0x1538c6['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xfde9('0x41')](_0x1538c6[_0xfde9('0x99')])){clearInterval(_0x1538c6[_0xfde9('0x99')]);_0x1538c6[_0xfde9('0x99')]=undefined;loggerPredictive[_0xfde9('0x86')](_0x1538c6[_0xfde9('0x45')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x2eedf4,_0x113c67){if(_0x113c67===0x0){return 0x0;}var _0x140815=0x1;for(var _0x3672a6=0x1;_0x3672a6<=_0x113c67;_0x3672a6+=0x1){_0x140815=0x1+_0x140815*_0x3672a6/_0x2eedf4;}return 0x1/_0x140815;}function isVoiceQueueOutbound(_0x49ec58){return _0x49ec58==='outbound';}function isNotPreview(_0x377999){return _0x377999!==_0xfde9('0x9a');}function isCampaignIvr(_0x52e5f3){return _0x52e5f3===_0xfde9('0x83');}function getCallerId(_0x2a48a3,_0x5b5952,_0x3944f1){if(!_[_0xfde9('0x41')](_0x3944f1)&&typeof _0x3944f1===_0xfde9('0x9b')&&!_[_0xfde9('0x4a')](_0x3944f1)){if(!_[_0xfde9('0x41')](_0x5b5952)&&typeof _0x5b5952===_0xfde9('0x9b')&&!_[_0xfde9('0x4a')](_0x5b5952)){return util[_0xfde9('0x80')]('\x22%s\x22\x20<%s>',_0x5b5952,_0x3944f1);}return util[_0xfde9('0x80')]('\x22%s\x22\x20<%s>',_0x3944f1,_0x3944f1);}if(!_['isUndefined'](_0x2a48a3)&&typeof _0x2a48a3===_0xfde9('0x9b')&&!_[_0xfde9('0x4a')](_0x2a48a3)){return _0x2a48a3;}return _0xfde9('0x9c');}function loggerCatchQueueSummary(_0x16a2f6,_0x4dc93b){return function(_0x365fea){freeVariablesPredictive(_0x4dc93b);emitVoiceQueueSummary(_0x4dc93b);emitCampaignSummary(_0x4dc93b);loggerSyncQueueSummary[_0xfde9('0x9d')](_0x16a2f6,util[_0xfde9('0x9e')](_0x365fea,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x279b72,_0x3ff27b){return function(_0x575e31){loggerPredictive[_0xfde9('0x9d')](_0x3ff27b[_0xfde9('0x45')],_0x279b72);loggerPredictive[_0xfde9('0x9d')](_0x575e31[_0xfde9('0x9f')]);freeVariablesPredictive(_0x3ff27b);};}function loggerCatch(_0x566b97){return function(_0x1a1bb0){logger[_0xfde9('0x9d')](_0x566b97,util[_0xfde9('0x9e')](_0x1a1bb0,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x512033){return _0x512033&&!_[_0xfde9('0x41')](_0x512033)&&_0x512033[_0xfde9('0xa0')]>0x0;}function decremetOriginate(_0x4151f4){if(!_[_0xfde9('0x41')](_0x4151f4)&&_0x4151f4!==null){if(typeof _0x4151f4[_0xfde9('0x78')]!=='undefined'){if(_0x4151f4[_0xfde9('0x78')]>0x0){_0x4151f4[_0xfde9('0x78')]-=0x1;}else{logger[_0xfde9('0x9d')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xfde9('0x9d')](_0xfde9('0xa1'));}}function checkContactLowerLimitOriginate(_0x48066e,_0x5f0468,_0x4b9506){if(_0x5f0468>_0x4b9506){for(var _0x6ec80e=0x0;_0x6ec80e<_0x5f0468-_0x4b9506;_0x6ec80e+=0x1){decremetOriginate(_0x48066e);}}}function loggerGetContactDialer(_0x1566e5,_0x540234,_0x487d56){return function(_0x1a7fd2){checkContactLowerLimitOriginate(_0x540234,_0x487d56,0x0);logger[_0xfde9('0x9d')](_0x1566e5,util['inspect'](_0x1a7fd2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x522342){return function(_0x4347c2){if(isNotNull(_0x4347c2)&&isNotNull(_0x4347c2[0x0])){if(_0x4347c2[0x0][_0xfde9('0xa2')]>0x0){_0x522342[_0xfde9('0x42')]='RESCHEDULED_CONTACTS';logger[_0xfde9('0x86')](_0xfde9('0xa3')+_0x522342[_0xfde9('0x45')],_0x4347c2[0x0]['contactsRescheduled'],'contacts');}else{_0x522342['message']=_0xfde9('0xa4');logger[_0xfde9('0x86')]('[getContactDialer2][Empty]'+_0x522342[_0xfde9('0x45')]);}}};}function notSendMessagesQueue(_0x3fd1c2){if(_0x3fd1c2['sendMessageOneNotActive']){freeVariablesPredictive(_0x3fd1c2);if(_0x3fd1c2[_0xfde9('0x78')]===0x0&&_0x3fd1c2['talking']===0x0&&_0x3fd1c2[_0xfde9('0xa5')]===0x0&&(_0x3fd1c2['pTalking']||0x0)===0x0){_0x3fd1c2[_0xfde9('0xa6')]=![];_0x3fd1c2['available']=0x0;_0x3fd1c2[_0xfde9('0x42')]=_0xfde9('0xa7');loggerSyncQueueSummary[_0xfde9('0x9d')](_0xfde9('0xa8'),_0x3fd1c2[_0xfde9('0x45')],_0xfde9('0xa9'));}else{_0x3fd1c2[_0xfde9('0x42')]=_0xfde9('0xaa');loggerSyncQueueSummary[_0xfde9('0x9d')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3fd1c2[_0xfde9('0x45')],_0xfde9('0xab'));}emitVoiceQueueSummary(_0x3fd1c2);}}function notSendMessagesCampaign(_0x75364a){if(_0x75364a[_0xfde9('0xa6')]){if(_0x75364a[_0xfde9('0x78')]===0x0){_0x75364a[_0xfde9('0xa6')]=![];_0x75364a[_0xfde9('0x42')]=_0xfde9('0xa7');loggerSyncQueueSummary[_0xfde9('0x9d')](_0xfde9('0xac'),_0x75364a[_0xfde9('0x45')],'is\x20not\x20active');}else{_0x75364a[_0xfde9('0x42')]=_0xfde9('0xaa');loggerSyncQueueSummary[_0xfde9('0x9d')](_0xfde9('0xac'),_0x75364a[_0xfde9('0x45')],_0xfde9('0xab'));}emitCampaignSummary(_0x75364a);}}function createObjHistory(_0x217799,_0x22afee,_0xff80b,_0xfd764d,_0x4b8b7e){_0x217799[_0xfde9('0x42')]=_0xff80b;var _0x3d0569=new Action(_0x217799,_0x22afee);var _0x1f4046=new History(_0x3d0569);_0x1f4046[_0xfde9('0xad')]=_0xfd764d;_0x1f4046['statedesc']=_0x4b8b7e;_0x1f4046[_0xfde9('0xae')]=_0x3d0569['starttime'];return _0x1f4046;}Dialer[_0xfde9('0x1c')]['loopClearZombieChannels']=function(){var _0x54a781=this;setInterval(function(){_0x54a781[_0xfde9('0xaf')](_0x54a781['uniqueId'],_0xfde9('0xb0'));_0x54a781[_0xfde9('0xaf')](_0x54a781[_0xfde9('0x25')],_0xfde9('0xb1'));},0x32c8);};Dialer[_0xfde9('0x1c')]['clearZombieChannels']=function(_0x40b1a2,_0x5977e7){var _0x34a750=this;for(var _0x2ec37b in _0x40b1a2){if(typeof _0x40b1a2[_0x2ec37b]!==_0xfde9('0xb2')){this['sequence'][_0xfde9('0x1d')](function(){if(!_[_0xfde9('0xb3')](_0x40b1a2[_0x2ec37b])){return ami[_0xfde9('0xb4')]({'action':_0xfde9('0xb5'),'channel':_0x40b1a2[_0x2ec37b]['channel']})[_0xfde9('0xb6')](function(_0xf2f3ff){if(_0xf2f3ff[_0xfde9('0x42')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x40b1a2[_0x2ec37b]&&_0x40b1a2[_0x2ec37b][_0xfde9('0x52')]!=='ivr'){_0x34a750[_0xfde9('0xb7')](_0x34a750[_0xfde9('0xb8')][_0x40b1a2[_0x2ec37b][_0xfde9('0xb9')]]);logger[_0xfde9('0x9d')]('[Dialer][checkChannel]',_0x5977e7,_0x2ec37b,_0x40b1a2[_0x2ec37b][_0xfde9('0xb9')]);delete _0x40b1a2[_0x2ec37b];}if(_0x40b1a2[_0x2ec37b]&&_0x40b1a2[_0x2ec37b][_0xfde9('0x52')]===_0xfde9('0x83')){_0x34a750[_0xfde9('0xb7')](_0x34a750[_0xfde9('0x20')][_0x40b1a2[_0x2ec37b][_0xfde9('0xb9')]]);logger[_0xfde9('0x9d')](_0xfde9('0xba'),_0x5977e7,_0x2ec37b,_0x40b1a2[_0x2ec37b][_0xfde9('0xb9')]);delete _0x40b1a2[_0x2ec37b];}},0x2328);}});}});}}};Dialer['prototype'][_0xfde9('0xbb')]=function(_0xf5ef10){return BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](cmHopper[_0xfde9('0xbb')](_0xf5ef10))[_0xfde9('0xb6')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xfde9('0x1c')][_0xfde9('0xbe')]=function(_0x15bf5d){return BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](cmHopperBlack['checkIsBlackList'](_0x15bf5d))[_0xfde9('0xb6')](loggerCatch(_0xfde9('0xbf')));};Dialer[_0xfde9('0x1c')]['verifyAdditionalPhones']=function(_0x151e4d,_0x584984,_0xa7756f){return BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](cmHopperAdditionalPhone[_0xfde9('0xc0')](_0x151e4d,_0x584984,_0xa7756f))[_0xfde9('0xb6')](loggerCatch(_0xfde9('0xc1')));};Dialer[_0xfde9('0x1c')][_0xfde9('0xc2')]=function(_0x58d7b8,_0x57e3f3,_0x41cdbb){return BPromise['resolve']()['then'](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x58d7b8,_0x57e3f3,_0x41cdbb))['catch'](loggerCatch(_0xfde9('0xc3')));};Dialer[_0xfde9('0x1c')]['checkIsBlackListIvr']=function(_0x2d709f){return BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](cmHopperBlack['checkIsBlackListIvr'](_0x2d709f))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0xfde9('0xc4')]=function(_0x4d6f0e){return BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](cmHopperHistory[_0xfde9('0xc5')](_0x4d6f0e))[_0xfde9('0xb6')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xfde9('0x1c')][_0xfde9('0xc6')]=function(_0x1dbb64){return BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](cmHopper[_0xfde9('0xc6')](_0x1dbb64))[_0xfde9('0xb6')](loggerCatch(_0xfde9('0xc7')));};Dialer[_0xfde9('0x1c')][_0xfde9('0xc8')]=function(_0x554ee9,_0x39ae38,_0x574b41){return BPromise[_0xfde9('0xbc')]()['then'](cmHopper[_0xfde9('0xc8')](_0x554ee9,_0x39ae38,_0x574b41))[_0xfde9('0xb6')](loggerCatch(_0xfde9('0xc9')));};Dialer['prototype'][_0xfde9('0xca')]=function(_0x36cea0,_0x4a4302,_0x524582,_0x11d97c,_0x5e60e4){return BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](cmHopper[_0xfde9('0xca')](_0x36cea0,_0x4a4302,_0x524582,_0x11d97c))[_0xfde9('0xb6')](function(_0x2c1334){_0x5e60e4['temp']-=_0x524582;_0x5e60e4[_0xfde9('0xcb')]=_0x5e60e4[_0xfde9('0xcb')]>0x0?_0x5e60e4[_0xfde9('0xcb')]:0x0;loggerCatch(_0xfde9('0xcc'))(_0x2c1334);});};Dialer['prototype'][_0xfde9('0xcd')]=function(_0x545f81,_0x4e07a8,_0x554317,_0x2628b1){return BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](cmHopper[_0xfde9('0xcd')](_0x545f81,_0x4e07a8,_0x554317))[_0xfde9('0xb6')](function(_0x404bdb){_0x2628b1[_0xfde9('0xcb')]-=_0x4e07a8;_0x2628b1[_0xfde9('0xcb')]=_0x2628b1[_0xfde9('0xcb')]>0x0?_0x2628b1[_0xfde9('0xcb')]:0x0;loggerCatch(_0xfde9('0xce'))(_0x404bdb);});};Dialer['prototype'][_0xfde9('0xcf')]=function(_0x8fbb4c){return BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](voiceQueueRt[_0xfde9('0xcf')](_0x8fbb4c))[_0xfde9('0xb6')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xfde9('0x1c')][_0xfde9('0xd0')]=function(_0x43c1ca){return BPromise['resolve']()[_0xfde9('0xbd')](cmHopper[_0xfde9('0xd0')](_0x43c1ca))[_0xfde9('0xb6')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xfde9('0x1c')][_0xfde9('0xd1')]=function(_0xca42cb){return BPromise['resolve']()[_0xfde9('0xbd')](cmHopperHistory[_0xfde9('0xd1')](_0xca42cb))['catch'](loggerCatch(_0xfde9('0xd2')));};Dialer['prototype']['updateOriginated']=function(_0xad3791){if(!_['isUndefined'](_0xad3791)&&_0xad3791!==null){if(typeof _0xad3791[_0xfde9('0x78')]!==_0xfde9('0xb2')){if(_0xad3791[_0xfde9('0x78')]>0x0){_0xad3791[_0xfde9('0x78')]-=0x1;}else{logger[_0xfde9('0x9d')](_0xfde9('0xd3'));}}}else{logger[_0xfde9('0x9d')](_0xfde9('0xd4'));}};Dialer[_0xfde9('0x1c')][_0xfde9('0xd5')]=function(_0x3016b2,_0x36b601){var _0x2b15e4=this;return function(_0x5175ef){_0x2b15e4['updateOriginated'](_0x36b601);logger[_0xfde9('0x9d')](_0x3016b2,util[_0xfde9('0x9e')](_0x5175ef,{'showHidden':![],'depth':null}));};};Dialer[_0xfde9('0x1c')][_0xfde9('0xd6')]=function(_0x4ec9f2,_0x555cb5,_0x533f54){var _0xf36734={'state':0x19,'statedesc':_0xfde9('0xd7')};this[_0xfde9('0xb7')](_0x555cb5);this[_0xfde9('0xd8')](_['merge'](_0xf36734,_[_0xfde9('0xd9')](_0x533f54,[_0xfde9('0xda'),_0xfde9('0xdb'),_0xfde9('0xdc'),_0xfde9('0xdd'),_0xfde9('0xde')])),_0xfde9('0xdf'),_0xfde9('0xe0'));logger[_0xfde9('0x9d')](_0x4ec9f2);};Dialer[_0xfde9('0x1c')][_0xfde9('0xe1')]=function(_0x1d1369){return _0x1d1369==='Success';};Dialer['prototype']['isTrunkReachable']=function(_0x421db2){return!_['isUndefined'](_0x421db2)&&_0x421db2&&!_[_0xfde9('0x41')](_0x421db2['name'])&&!_['isUndefined'](_0x421db2[_0xfde9('0x7d')])&&_0x421db2['active']&&(this['trunks'][util[_0xfde9('0x80')](_0xfde9('0xe2'),_0x421db2[_0xfde9('0x45')])]['status']===_0xfde9('0xe3')||this['trunks'][util['format'](_0xfde9('0xe2'),_0x421db2[_0xfde9('0x45')])][_0xfde9('0xb5')]===_0xfde9('0xe4'));};Dialer['prototype'][_0xfde9('0xd8')]=function(_0x41c1a1,_0x31e1ad,_0x447e79){this[_0xfde9('0xd1')](_0x41c1a1)[_0xfde9('0xb6')](loggerCatch(_0x31e1ad));this[_0xfde9('0xd0')](_0x41c1a1)[_0xfde9('0xb6')](loggerCatch(_0x447e79));};Dialer[_0xfde9('0x1c')][_0xfde9('0x3b')]=function(_0xe6f988){var _0x4eb6a4=this['uniqueId'][_0xe6f988[_0xfde9('0xe5')]];var _0x2a642d;if(!_['isNil'](_0xe6f988)&&!_['isNil'](_0xe6f988[_0xfde9('0xe6')])&&!_['isNil'](_0xe6f988[_0xfde9('0xe6')][_0xfde9('0xe7')])&&_0xe6f988[_0xfde9('0xe8')]===_0xfde9('0xe9')&&_0x4eb6a4){if(_0x4eb6a4['type']!==_0xfde9('0x83')&&this[_0xfde9('0xb8')][_0x4eb6a4[_0xfde9('0xb9')]][_0xfde9('0xea')]&&_0xe6f988[_0xfde9('0xeb')]===_0xfde9('0xec')){delete this[_0xfde9('0x27')][_0xe6f988[_0xfde9('0xe5')]];this[_0xfde9('0xb7')](this['voiceQueues'][_0x4eb6a4[_0xfde9('0xb9')]]);this[_0xfde9('0xb8')][_0x4eb6a4['queue']][_0xfde9('0x63')]+=0x1;this[_0xfde9('0xb8')][_0x4eb6a4[_0xfde9('0xb9')]][_0xfde9('0x62')]+=0x1;_0x2a642d=new Hangup(_0x4eb6a4,_0xe6f988);_0x2a642d[_0xfde9('0xad')]=0x12;_0x2a642d[_0xfde9('0xed')]=_0xfde9('0xee');_0x2a642d[_0xfde9('0xef')]=_0xfde9('0xf0');ami[_0xfde9('0x51')](_0xfde9('0xf1'),ut['buildObj'](_0x2a642d,_0xfde9('0xf2')));this[_0xfde9('0xd8')](_0x2a642d,_0xfde9('0xf3'),_0xfde9('0xf4'));}if(_0x4eb6a4[_0xfde9('0x52')]!==_0xfde9('0x83')&&this[_0xfde9('0xb8')][_0x4eb6a4[_0xfde9('0xb9')]][_0xfde9('0xea')]&&_0xe6f988['value']==='MACHINE'){var _0x965c99=this;return new BPromise(function(_0x132067,_0x2c8213){delete _0x965c99[_0xfde9('0x27')][_0xe6f988[_0xfde9('0xe5')]];_0x965c99[_0xfde9('0xb7')](_0x965c99[_0xfde9('0xb8')][_0x4eb6a4[_0xfde9('0xb9')]]);_0x965c99['voiceQueues'][_0x4eb6a4[_0xfde9('0xb9')]]['outboundAnswerCallsDay']+=0x1;_0x965c99['voiceQueues'][_0x4eb6a4[_0xfde9('0xb9')]][_0xfde9('0x62')]+=0x1;var _0x1f8755=_0x965c99['voiceQueues'][_0x4eb6a4[_0xfde9('0xb9')]];var _0x392a0e=new Hangup(_0x4eb6a4,_0xe6f988);_0x392a0e['state']=0x13;_0x392a0e[_0xfde9('0xed')]=_0xfde9('0xf5');_0x392a0e[_0xfde9('0xef')]=_0xfde9('0xf0');_0x392a0e[_0xfde9('0xf6')]+=0x1;_0x392a0e[_0xfde9('0xf7')]+=0x1;_0x392a0e[_0xfde9('0xf2')]=!![];ami[_0xfde9('0x51')](_0xfde9('0xf1'),ut[_0xfde9('0xf8')](_0x392a0e,_0xfde9('0xf2')));_0x965c99['createHistory'](_0x392a0e)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0xf9')));if(_0x392a0e[_0xfde9('0xfa')]+_0x392a0e['countcongestionretry']+_0x392a0e[_0xfde9('0xfb')]+_0x392a0e[_0xfde9('0xfc')]+_0x392a0e[_0xfde9('0xfd')]+_0x392a0e[_0xfde9('0xfe')]+_0x392a0e[_0xfde9('0xf6')]+_0x392a0e['countagentrejectretry']>=_0x1f8755[_0xfde9('0xff')]){_0x965c99[_0xfde9('0x100')](_0x392a0e,_0x132067,_0x2c8213,_0xfde9('0x101'));}else{if(_0x392a0e[_0xfde9('0xf6')]>=_0x1f8755[_0xfde9('0x102')]){_0x965c99[_0xfde9('0x103')](_0x392a0e,_0x132067,_0x2c8213,_0xfde9('0x104'));}else{_0x965c99['rescheduleContact']({'active':![],'countmachineretry':_0x392a0e[_0xfde9('0xf6')],'scheduledat':moment()[_0xfde9('0x105')](_0x1f8755[_0xfde9('0x106')],_0xfde9('0x107'))[_0xfde9('0x80')](_0xfde9('0x108')),'ContactId':_0x392a0e[_0xfde9('0xda')],'ListId':_0x392a0e[_0xfde9('0xdb')],'VoiceQueueId':_0x392a0e[_0xfde9('0xdd')]||undefined,'CampaignId':_0x392a0e['CampaignId']||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x109')));_0x132067({'reschedule':0x1});}}});}if(_0x4eb6a4[_0xfde9('0x52')]==='ivr'&&this[_0xfde9('0x20')][_0x4eb6a4['queue']][_0xfde9('0xea')]&&_0xe6f988[_0xfde9('0xeb')]===_0xfde9('0xec')){delete this[_0xfde9('0x27')][_0xe6f988[_0xfde9('0xe5')]];this[_0xfde9('0xb7')](this[_0xfde9('0x20')][_0x4eb6a4[_0xfde9('0xb9')]]);_0x2a642d=new Hangup(_0x4eb6a4,_0xe6f988);_0x2a642d[_0xfde9('0xad')]=0x12;_0x2a642d[_0xfde9('0xed')]=_0xfde9('0xee');_0x2a642d[_0xfde9('0xef')]=_0xfde9('0xf0');ami['emit'](_0xfde9('0xf1'),ut[_0xfde9('0xf8')](_0x2a642d,_0xfde9('0xf2')));this[_0xfde9('0xd8')](_0x2a642d,_0xfde9('0x10a'),_0xfde9('0x10b'));}if(_0x4eb6a4[_0xfde9('0x52')]===_0xfde9('0x83')&&this[_0xfde9('0x20')][_0x4eb6a4['queue']][_0xfde9('0xea')]&&_0xe6f988[_0xfde9('0xeb')]===_0xfde9('0x10c')){var _0x965c99=this;return new BPromise(function(_0x1e89a1,_0x404146){delete _0x965c99[_0xfde9('0x27')][_0xe6f988[_0xfde9('0xe5')]];_0x965c99[_0xfde9('0xb7')](_0x965c99['campaigns'][_0x4eb6a4[_0xfde9('0xb9')]]);_0x965c99[_0xfde9('0x20')][_0x4eb6a4[_0xfde9('0xb9')]][_0xfde9('0x63')]+=0x1;_0x965c99[_0xfde9('0x20')][_0x4eb6a4[_0xfde9('0xb9')]][_0xfde9('0x62')]+=0x1;var _0xe0d679=_0x965c99[_0xfde9('0x20')][_0x4eb6a4['queue']];var _0x55394f=new Hangup(_0x4eb6a4,_0xe6f988);_0x55394f[_0xfde9('0xad')]=0x13;_0x55394f[_0xfde9('0xed')]=_0xfde9('0xf5');_0x55394f[_0xfde9('0xef')]=_0xfde9('0xf0');_0x55394f[_0xfde9('0xf6')]+=0x1;_0x55394f[_0xfde9('0xf7')]+=0x1;_0x55394f[_0xfde9('0xf2')]=!![];ami[_0xfde9('0x51')](_0xfde9('0xf1'),ut[_0xfde9('0xf8')](_0x55394f,_0xfde9('0xf2')));_0x965c99[_0xfde9('0xd1')](_0x55394f)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0xf9')));if(_0x55394f['countbusyretry']+_0x55394f[_0xfde9('0x10d')]+_0x55394f['countnoanswerretry']+_0x55394f[_0xfde9('0xfc')]+_0x55394f['countdropretry']+_0x55394f[_0xfde9('0xfe')]+_0x55394f[_0xfde9('0xf6')]+_0x55394f['countagentrejectretry']>=_0xe0d679[_0xfde9('0xff')]){_0x965c99[_0xfde9('0x100')](_0x55394f,_0x1e89a1,_0x404146,'reason19\x20machine....');}else{if(_0x55394f[_0xfde9('0xf6')]>=_0xe0d679['dialMachineMaxRetry']){_0x965c99['createStateFinal'](_0x55394f,_0x1e89a1,_0x404146,_0xfde9('0x104'));}else{_0x965c99[_0xfde9('0xc6')]({'active':![],'countmachineretry':_0x55394f[_0xfde9('0xf6')],'scheduledat':moment()[_0xfde9('0x105')](_0xe0d679[_0xfde9('0x106')],_0xfde9('0x107'))[_0xfde9('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55394f[_0xfde9('0xda')],'ListId':_0x55394f['ListId'],'VoiceQueueId':_0x55394f['VoiceQueueId']||undefined,'CampaignId':_0x55394f['CampaignId']||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x109')));_0x1e89a1({'reschedule':0x1});}}});}}};Dialer[_0xfde9('0x1c')][_0xfde9('0x37')]=function(_0x12db22){var _0x2f4dec=this[_0xfde9('0x27')][_0x12db22['uniqueid']];var _0x423f2f=this;var _0x344c52;if(_0x2f4dec&&_0x2f4dec[_0xfde9('0x52')]===_0xfde9('0x83')){delete this[_0xfde9('0x27')][_0x12db22[_0xfde9('0xe5')]];this[_0xfde9('0xb7')](this[_0xfde9('0x20')][_0x2f4dec[_0xfde9('0xb9')]]);this[_0xfde9('0x20')][_0x2f4dec[_0xfde9('0xb9')]][_0xfde9('0x10e')]+=0x1;_0x344c52=new Hangup(_0x2f4dec,_0x12db22);this['createHistory'](_0x344c52)['catch'](loggerCatch(_0xfde9('0x10f')));this['moveContactManagedDialer'](_0x344c52)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x110')));}if(_0x2f4dec&&_0x2f4dec['type']!==_0xfde9('0x83')&&isNotNull(this[_0xfde9('0xb8')][_0x2f4dec[_0xfde9('0xb9')]][_0xfde9('0x111')])){delete this['uniqueId'][_0x12db22['uniqueid']];this[_0xfde9('0xb7')](this[_0xfde9('0xb8')][_0x2f4dec[_0xfde9('0xb9')]]);this[_0xfde9('0xb8')][_0x2f4dec['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xfde9('0xb8')][_0x2f4dec[_0xfde9('0xb9')]]['outboundAnswerAgiCallsDay']+=0x1;_0x344c52=new Hangup(_0x2f4dec,_0x12db22);_0x344c52[_0xfde9('0xad')]=0x10;_0x344c52[_0xfde9('0xed')]=_0xfde9('0x112');_0x344c52[_0xfde9('0xef')]='AGI';this[_0xfde9('0xd1')](_0x344c52)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x10f')));this['moveContactManagedDialer'](_0x344c52)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x110')));}if(_0x2f4dec&&_0x2f4dec[_0xfde9('0x52')]!==_0xfde9('0x83')&&!isNotNull(this[_0xfde9('0xb8')][_0x2f4dec[_0xfde9('0xb9')]][_0xfde9('0x111')])){delete this[_0xfde9('0x27')][_0x12db22[_0xfde9('0xe5')]];this[_0xfde9('0xb7')](this[_0xfde9('0xb8')][_0x2f4dec[_0xfde9('0xb9')]]);this[_0xfde9('0xb8')][_0x2f4dec[_0xfde9('0xb9')]]['outboundUnknownCallsDay']+=0x1;_0x344c52=new Hangup(_0x2f4dec,_0x12db22);_0x344c52[_0xfde9('0xad')]=0xc;_0x344c52['statedesc']=_0x12db22[_0xfde9('0x113')];_0x344c52['membername']=_0xfde9('0x114');this[_0xfde9('0xd1')](_0x344c52)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x10f')));this[_0xfde9('0xd0')](_0x344c52)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x110')));}};Dialer['prototype'][_0xfde9('0x34')]=function(_0x55bbbb){var _0x5c83d3=this[_0xfde9('0x27')][_0x55bbbb[_0xfde9('0xe5')]];var _0x242afe=this;if(this['voiceQueues'][_0x55bbbb[_0xfde9('0xb9')]]){if(_0x5c83d3&&_0x5c83d3['type']!=='ivr'){delete this['uniqueId'][_0x55bbbb[_0xfde9('0xe5')]];this['voiceQueues'][_0x55bbbb[_0xfde9('0xb9')]][_0xfde9('0x63')]+=0x1;var _0x332aee=new AgentComplete(_0x5c83d3,_0x55bbbb);if(_0x55bbbb[_0xfde9('0x115')]===_0xfde9('0x116')){_0x332aee['agiafterat']=this['voiceQueues'][_0x55bbbb[_0xfde9('0xb9')]][_0xfde9('0x117')]&&this[_0xfde9('0xb8')][_0x55bbbb[_0xfde9('0xb9')]][_0xfde9('0x118')]?moment()['format'](_0xfde9('0x108')):undefined;}this['createHistory'](_0x332aee)['catch'](loggerCatch(_0xfde9('0x119')));this[_0xfde9('0xd0')](_0x332aee)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x11a')));}}};Dialer[_0xfde9('0x1c')]['syncAgentConnect']=function(_0x113129){if(this[_0xfde9('0xb8')][_0x113129[_0xfde9('0xb9')]]){if(this[_0xfde9('0x27')][_0x113129[_0xfde9('0xe5')]]&&this[_0xfde9('0x27')][_0x113129[_0xfde9('0xe5')]][_0xfde9('0x52')]!=='ivr'){this[_0xfde9('0xb7')](this[_0xfde9('0xb8')][_0x113129[_0xfde9('0xb9')]]);this[_0xfde9('0x27')][_0x113129['uniqueid']][_0xfde9('0x11b')]=moment()[_0xfde9('0x80')](_0xfde9('0x108'));}}};Dialer[_0xfde9('0x1c')]['queueCallerAbandonCreateState']=function(_0x1e22f0,_0x413a07){this[_0xfde9('0xd1')](_0x1e22f0)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x119')));if(_0x413a07==0x0){this['moveContactManagedDialer'](_0x1e22f0)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x11c')));}};Dialer[_0xfde9('0x1c')][_0xfde9('0x30')]=function(_0x9696a9){var _0x488a5b=this[_0xfde9('0x27')][_0x9696a9[_0xfde9('0xe5')]];var _0x24ea47=this;var _0x53c1a7=![];var _0x552fb0;var _0x2493ed;if(this[_0xfde9('0xb8')][_0x9696a9['queue']]){if(_0x488a5b&&_0x488a5b[_0xfde9('0x52')]!==_0xfde9('0x83')){delete this[_0xfde9('0x27')][_0x9696a9[_0xfde9('0xe5')]];this['updateOriginated'](this['voiceQueues'][_0x9696a9[_0xfde9('0xb9')]]);_0x488a5b[_0xfde9('0x11d')]=moment()[_0xfde9('0x80')](_0xfde9('0x108'));var _0x2a510c=new QueueCallerAbandon(_0x488a5b,_0x9696a9);if(getSeconds(_0x488a5b['droptime'],_0x488a5b[_0xfde9('0x11e')])>=_0x488a5b[_0xfde9('0x11f')]){this['voiceQueues'][_0x9696a9[_0xfde9('0xb9')]][_0xfde9('0x70')]+=0x1;this[_0xfde9('0xb8')][_0x9696a9['queue']][_0xfde9('0x120')]+=0x1;this['voiceQueues'][_0x9696a9[_0xfde9('0xb9')]][_0xfde9('0x72')]+=0x1;_0x2a510c[_0xfde9('0xad')]=0xa;_0x2a510c[_0xfde9('0xed')]=_0xfde9('0x121');_0x2a510c[_0xfde9('0x122')]=_0xfde9('0x123');_0x2a510c[_0xfde9('0x124')]=this[_0xfde9('0xb8')][_0x9696a9['queue']][_0xfde9('0x117')]?moment()[_0xfde9('0x80')](_0xfde9('0x108')):undefined;_0x2a510c['countdropretry']+=0x1;_0x2a510c[_0xfde9('0xf7')]+=0x1;_0x552fb0=this[_0xfde9('0xb8')][_0x9696a9[_0xfde9('0xb9')]]['dialDropRetryFrequency'];_0x2493ed=this[_0xfde9('0xb8')][_0x9696a9[_0xfde9('0xb9')]][_0xfde9('0x125')];_0x24ea47[_0xfde9('0xc0')](_0x2a510c,_0x2a510c['state'],_0x488a5b[_0xfde9('0x126')])[_0xfde9('0xbd')](function(_0x4bf6fd){_0x53c1a7=_0x4bf6fd[_0xfde9('0x127')]==0x1;if(_0x2a510c[_0xfde9('0xfd')]>=_0x24ea47[_0xfde9('0xb8')][_0x9696a9[_0xfde9('0xb9')]][_0xfde9('0x128')]){_0x24ea47['queueCallerAbandonCreateState'](_0x2a510c,_0x4bf6fd[_0xfde9('0x127')]);}else{_0x24ea47[_0xfde9('0xc6')]({'active':![],'countdropretry':_0x2a510c['countdropretry'],'scheduledat':moment()['add'](_0x24ea47[_0xfde9('0xb8')][_0x9696a9[_0xfde9('0xb9')]]['dialDropRetryFrequency'],_0xfde9('0x107'))['format'](_0xfde9('0x108')),'ContactId':_0x488a5b[_0xfde9('0xda')],'ListId':_0x488a5b[_0xfde9('0xdb')],'VoiceQueueId':_0x488a5b[_0xfde9('0xdd')]||undefined,'CampaignId':_0x488a5b['CampaignId']||undefined})[_0xfde9('0xb6')](loggerCatch('[rescheduleContact][Drop]'));var _0x2744e3=new History(_0x2a510c);_0x2744e3['state']=0xa;_0x2744e3[_0xfde9('0xed')]='Drop';_0x2744e3[_0xfde9('0x129')]=moment()[_0xfde9('0x80')]('YYYY-MM-DD\x20HH:mm:ss');_0x2744e3[_0xfde9('0xae')]=_0x2744e3[_0xfde9('0x129')];_0x2744e3[_0xfde9('0x12a')]=_0x2a510c[_0xfde9('0x12a')];_0x2744e3[_0xfde9('0x12b')]=_0x2a510c[_0xfde9('0x12b')];_0x24ea47['createHistory'](_0x2744e3)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xfde9('0xbd')](function(_0x4ae575){if(_0x53c1a7)_0x24ea47[_0xfde9('0xc2')](_0x2a510c,_0x552fb0,_0x2493ed)[_0xfde9('0xbd')](function(_0x5bdcc9){return 0x1;});});}else{this[_0xfde9('0xb8')][_0x9696a9[_0xfde9('0xb9')]][_0xfde9('0x6f')]+=0x1;this[_0xfde9('0xb8')][_0x9696a9[_0xfde9('0xb9')]][_0xfde9('0x68')]+=0x1;_0x2a510c[_0xfde9('0xad')]=0xb;_0x2a510c['statedesc']=_0xfde9('0x12c');_0x2a510c[_0xfde9('0x122')]=_0xfde9('0x12d');_0x2a510c[_0xfde9('0xfe')]+=0x1;_0x2a510c[_0xfde9('0xf7')]+=0x1;_0x552fb0=this[_0xfde9('0xb8')][_0x9696a9[_0xfde9('0xb9')]][_0xfde9('0x12e')];_0x2493ed=this['voiceQueues'][_0x9696a9[_0xfde9('0xb9')]][_0xfde9('0x125')];_0x24ea47['verifyAdditionalPhones'](_0x2a510c,_0x2a510c['state'],_0x488a5b[_0xfde9('0x126')])[_0xfde9('0xbd')](function(_0x3beee6){if(_0x2a510c['countabandonedretry']>=_0x24ea47['voiceQueues'][_0x9696a9[_0xfde9('0xb9')]][_0xfde9('0x12f')]){_0x24ea47[_0xfde9('0x130')](_0x2a510c,_0x3beee6[_0xfde9('0x127')]);}else{_0x24ea47[_0xfde9('0xc6')]({'active':![],'countabandonedretry':_0x2a510c[_0xfde9('0xfe')],'scheduledat':moment()[_0xfde9('0x105')](_0x24ea47['voiceQueues'][_0x9696a9[_0xfde9('0xb9')]]['dialAbandonedRetryFrequency'],_0xfde9('0x107'))[_0xfde9('0x80')](_0xfde9('0x108')),'ContactId':_0x488a5b['ContactId'],'ListId':_0x488a5b[_0xfde9('0xdb')],'VoiceQueueId':_0x488a5b['VoiceQueueId']||undefined,'CampaignId':_0x488a5b[_0xfde9('0xde')]||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x131')));var _0xcd46b9=new History(_0x2a510c);_0xcd46b9[_0xfde9('0xad')]=0xb;_0xcd46b9[_0xfde9('0xed')]=_0xfde9('0x12c');_0xcd46b9['starttime']=moment()['format'](_0xfde9('0x108'));_0xcd46b9[_0xfde9('0xae')]=_0xcd46b9[_0xfde9('0x129')];_0xcd46b9[_0xfde9('0x12a')]=_0x2a510c['calleridname'];_0xcd46b9[_0xfde9('0x12b')]=_0x2a510c[_0xfde9('0x12b')];_0x24ea47[_0xfde9('0xd1')](_0xcd46b9)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x132')));}})[_0xfde9('0xbd')](function(_0x426794){if(_0x53c1a7)_0x24ea47[_0xfde9('0xc2')](_0x2a510c,_0x552fb0,_0x2493ed)[_0xfde9('0xbd')](function(_0xf9ba5f){return 0x1;});});}}}};Dialer[_0xfde9('0x1c')][_0xfde9('0x39')]=function(_0x7bfc5f){if(this[_0xfde9('0x25')][_0x7bfc5f[_0xfde9('0xe5')]]){this[_0xfde9('0x25')][_0x7bfc5f[_0xfde9('0xe5')]][_0xfde9('0x133')]=_0x7bfc5f['channel'];}if(this[_0xfde9('0x27')][_0x7bfc5f['uniqueid']]){this[_0xfde9('0x27')][_0x7bfc5f['uniqueid']][_0xfde9('0x133')]=_0x7bfc5f[_0xfde9('0x133')];}};Dialer[_0xfde9('0x1c')]['syncQueueMember']=function(_0x3e04c1){if(strategy[this[_0xfde9('0xb8')][this[_0xfde9('0x25')][_0x3e04c1['actionid']][_0xfde9('0xb9')]]['strategy']]===_0xfde9('0x1b')){if(this['actions'][_0x3e04c1[_0xfde9('0x134')]]&&_['isNil'](this[_0xfde9('0x25')][_0x3e04c1['actionid']][_0xfde9('0x135')])&&_0x3e04c1[_0xfde9('0xb5')]==='1'&&_0x3e04c1[_0xfde9('0x136')]==='0'){if(this[_0xfde9('0x21')][_0x3e04c1[_0xfde9('0x137')]]){if(!this['agents'][_0x3e04c1[_0xfde9('0x137')]][_0xfde9('0x135')]){this['agents'][_0x3e04c1[_0xfde9('0x137')]]['locked']=!![];this[_0xfde9('0x25')][_0x3e04c1[_0xfde9('0x134')]][_0xfde9('0x135')]=!![];this[_0xfde9('0x25')][_0x3e04c1['actionid']][_0xfde9('0x137')]=_0x3e04c1[_0xfde9('0x137')];}}}}else if((strategy[this[_0xfde9('0xb8')][this['actions'][_0x3e04c1[_0xfde9('0x134')]][_0xfde9('0xb9')]][_0xfde9('0x138')]]||_0xfde9('0x1a'))==='rrmemory'){if(this[_0xfde9('0x25')][_0x3e04c1[_0xfde9('0x134')]]){if(this[_0xfde9('0x21')][_0x3e04c1[_0xfde9('0x137')]]){this[_0xfde9('0x25')][_0x3e04c1[_0xfde9('0x134')]][_0xfde9('0x137')]=_0x3e04c1[_0xfde9('0x137')];if(_[_0xfde9('0xb3')](this[_0xfde9('0x2c')][this[_0xfde9('0x25')][_0x3e04c1[_0xfde9('0x134')]][_0xfde9('0xb9')]])){this[_0xfde9('0x2c')][this[_0xfde9('0x25')][_0x3e04c1[_0xfde9('0x134')]][_0xfde9('0xb9')]]=[];}this['queueBooked'][this[_0xfde9('0x25')][_0x3e04c1[_0xfde9('0x134')]][_0xfde9('0xb9')]][_0xfde9('0x139')](_[_0xfde9('0x13a')](_[_0xfde9('0xd9')](this['actions'][_0x3e04c1[_0xfde9('0x134')]],['idHopper','stateinterface']),{'status':_0x3e04c1['status'],'paused':_0x3e04c1[_0xfde9('0x136')]}));}}}};function unlockQueueStatus(_0x27e1c4,_0x4221f7){setTimeout(function(){if(_['isUndefined'](_0x27e1c4[_0xfde9('0x13b')])){loggerBooked[_0xfde9('0x9d')](_0xfde9('0x13c'),_0x4221f7);}_0x27e1c4['queueStatusComplete']=!![];loggerBooked[_0xfde9('0x86')](_0xfde9('0x13d'),_0x4221f7,JSON[_0xfde9('0x4d')](_[_0xfde9('0xd9')](_0x27e1c4,[_0xfde9('0x45'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xfde9('0x1c')][_0xfde9('0x3e')]=function(_0x50d98c){var _0x3caafb=this;var _0x5c7d9c=_0x3caafb[_0xfde9('0xb8')][_0x3caafb['actions'][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xb9')]];if(strategy[this['voiceQueues'][this[_0xfde9('0x25')][_0x50d98c['actionid']][_0xfde9('0xb9')]][_0xfde9('0x138')]]===_0xfde9('0x1b')){if(this[_0xfde9('0x25')][_0x50d98c['actionid']]&&this[_0xfde9('0x25')][_0x50d98c['actionid']][_0xfde9('0x137')]){this[_0xfde9('0x9a')][_0xfde9('0x13e')](this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0x13f')],this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0x137')])[_0xfde9('0xb6')](function(_0x30fbe7){logger[_0xfde9('0x9d')](_0xfde9('0x140'),util[_0xfde9('0x9e')](_0x30fbe7,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3caafb[_0xfde9('0xb7')](_0x3caafb[_0xfde9('0xb8')][_0x3caafb[_0xfde9('0x25')][_0x50d98c['actionid']][_0xfde9('0xb9')]]);_0x3caafb['agents'][_0x3caafb['actions'][_0x50d98c['actionid']][_0xfde9('0x137')]][_0xfde9('0x135')]=![];delete _0x3caafb[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]];unlockQueueStatus(_0x5c7d9c);});}else{this[_0xfde9('0xb7')](this[_0xfde9('0xb8')][this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]]['queue']]);this[_0xfde9('0xc6')]({'active':![],'ContactId':this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]]['ContactId'],'ListId':this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xdb')],'VoiceQueueId':this[_0xfde9('0x25')][_0x50d98c['actionid']][_0xfde9('0xdd')]||undefined,'CampaignId':this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xde')]||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x141')));delete this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]];unlockQueueStatus(_0x5c7d9c);}}else if((strategy[this[_0xfde9('0xb8')][this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xb9')]][_0xfde9('0x138')]]||_0xfde9('0x1a'))===_0xfde9('0x1a')){var _0xbc8c1d;if(this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]]&&!_['isEmpty'](this[_0xfde9('0x2c')][this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xb9')]])){if(this['queueBookedRR'][_0x3caafb[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xb9')]]){this[_0xfde9('0x142')][_0x3caafb[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xb9')]]=this['queueBookedRR'][this['actions'][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xb9')]]?this['queueBookedRR'][this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xb9')]]:this[_0xfde9('0x2c')][this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]]['queue']]?this[_0xfde9('0x2c')][this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xb9')]][_0xfde9('0x143')]||0x0:0x0;}this[_0xfde9('0x2c')][this[_0xfde9('0x25')][_0x50d98c[_0xfde9('0x134')]][_0xfde9('0xb9')]]['_rr']=this['queueBookedRR'][this['actions'][_0x50d98c[_0xfde9('0x134')]]['queue']];for(var _0x490b57=0x0;_0x490b57=0x0;})[_0xfde9('0xb6')](myreject(_0x4f91a5)));}}else{_0x5c6229[_0xfde9('0x139')](ami[_0xfde9('0xb4')]({'action':_0xfde9('0x15a'),'command':util[_0xfde9('0x80')](_0xfde9('0x15b'),_0x217f18,!_[_0xfde9('0x41')](config[_0xfde9('0x158')][_0x3355c8])?_0x3355c8:'')})['then'](function(_0x302921){return _0x302921[_0xfde9('0x15d')][_0xfde9('0x15e')](_0xfde9('0x15f'))>=0x0;})['catch'](myreject(_0x4f91a5)));}BPromise[_0xfde9('0x160')](_0x5c6229)[_0xfde9('0xbd')](function(_0x1aeb30){var _0x15456e=_[_0xfde9('0x161')](_0x1aeb30);if(_0x15456e){return _0x1201b3(_0x15456e);}else{_0x28e80b[_0xfde9('0x42')]=_0x597f94?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x4f91a5(msgResponse('[ifTime][promiseAll]',_0xfde9('0x155'),_0xfde9('0x162')+_0x597f94+'\x20'+_0x342f78+_0xfde9('0x163')+util['inspect'](_0x217f18,{'showHidden':![],'depth':null})+_0xfde9('0x164')+_0x3355c8));}})['catch'](function(_0x4a0d3d){return _0x4f91a5(msgResponse(_0xfde9('0x154'),_0xfde9('0x155'),JSON['stringify'](_0x4a0d3d)));});});};Dialer[_0xfde9('0x1c')][_0xfde9('0x165')]=function(_0xde8928){var _0x32e9f2=this;return function(){switch(_0xde8928['dialMethod']){case _0xfde9('0x166'):freeVariablesPredictive(_0xde8928);_0x32e9f2['handlePower'](_0xde8928,0x1);break;case _0xfde9('0x167'):freeVariablesPredictive(_0xde8928);_0x32e9f2[_0xfde9('0x168')](_0xde8928,_0xde8928[_0xfde9('0x169')]);break;case _0xfde9('0x16a'):_0x32e9f2['predictive'](_0xde8928);break;case'booked':freeVariablesPredictive(_0xde8928);_0x32e9f2['handlePower'](_0xde8928,0x1);break;default:freeVariablesPredictive(_0xde8928);logger[_0xfde9('0x9d')](_0xfde9('0x16b'),_0xde8928[_0xfde9('0x45')],_0xfde9('0x16c'));}};};Dialer[_0xfde9('0x1c')][_0xfde9('0x16d')]=function(_0x5080d7){var _0xf6378b=this;return function(){_0xf6378b[_0xfde9('0x16e')](_0x5080d7);};};Dialer['prototype']['syncQueueSummary']=function(_0x3851fc){var _0x47e818=this;if(isNotPreview(_0x3851fc[_0xfde9('0x5d')])){if(isVoiceQueueOutbound(_0x3851fc[_0xfde9('0x52')])&&isActive(_0x3851fc[_0xfde9('0x16f')])){_0x3851fc[_0xfde9('0xa6')]=!![];BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](checkIsLoggedIn(_0x3851fc,_0x3851fc[_0xfde9('0x56')]))[_0xfde9('0xbd')](checkIsActive(_0x3851fc,_0x3851fc[_0xfde9('0x16f')]))[_0xfde9('0xbd')](checkInterval(_0x3851fc))[_0xfde9('0xbd')](_0x47e818[_0xfde9('0x170')](_0x3851fc))[_0xfde9('0xbd')](_0x47e818['checkIfTime'](_0x3851fc[_0xfde9('0x171')],_0x3851fc[_0xfde9('0x172')],_0x3851fc[_0xfde9('0x45')],_0x3851fc))[_0xfde9('0xbd')](_0x47e818[_0xfde9('0x153')](_0x3851fc['Interval'],_0x3851fc['dialTimezone'],_0x3851fc[_0xfde9('0x45')],_0x3851fc))['then'](_0x47e818['checkDialMethod'](_0x3851fc))[_0xfde9('0xb6')](loggerCatchQueueSummary('[syncQueueSummary]',_0x3851fc));}else{notSendMessagesQueue(_0x3851fc);}}else{freeVariablesPredictive(_0x3851fc);}};Dialer[_0xfde9('0x1c')]['syncCampaigns']=function(){var _0x22b26a=this;var _0x149402;for(var _0x7f7652 in this[_0xfde9('0x20')]){if(typeof this['campaigns'][_0x7f7652]!==_0xfde9('0xb2')){_0x149402=this[_0xfde9('0x20')][_0x7f7652];if(isCampaignIvr(_0x149402[_0xfde9('0x52')])&&isActive(_0x149402[_0xfde9('0x7d')])){_0x149402[_0xfde9('0xa6')]=!![];BPromise[_0xfde9('0xbc')]()[_0xfde9('0xbd')](checkIsActive(_0x149402,_0x149402['active']))[_0xfde9('0xbd')](checkInterval(_0x149402))[_0xfde9('0xbd')](_0x22b26a[_0xfde9('0x170')](_0x149402))[_0xfde9('0xbd')](_0x22b26a[_0xfde9('0x152')](_0x149402[_0xfde9('0x171')],_0x149402[_0xfde9('0x172')],_0x149402[_0xfde9('0x45')],_0x149402))['then'](_0x22b26a[_0xfde9('0x153')](_0x149402[_0xfde9('0x46')],_0x149402[_0xfde9('0x172')],_0x149402[_0xfde9('0x45')],_0x149402))[_0xfde9('0xbd')](_0x22b26a['launchHandleIvr'](_0x149402))[_0xfde9('0xb6')](loggerCatchQueueSummary(_0xfde9('0x173'),_0x149402));}else{notSendMessagesCampaign(_0x149402);}}}};function getCallerIdRandom(_0x5b33a1,_0x24dd59){var _0x3bd1bf;var _0x57c1b3;var _0x1ab818;if(_0x24dd59<=0x0){_0x24dd59=0x1;}_0x3bd1bf=new RegExp(_0xfde9('0x174')+_0x24dd59+'}$');_0x57c1b3=Math[_0xfde9('0x175')](0xa,_0x24dd59-0x1);_0x1ab818=Math['pow'](0xa,_0x24dd59)-0x1;return util[_0xfde9('0x80')]('%s',_[_0xfde9('0x176')](_0x5b33a1,_0x3bd1bf,_[_0xfde9('0x177')](_0x57c1b3,_0x1ab818)));}function extractCalleridName(_0x6851c){var _0x5b7015=_0x6851c['match'](/"(.*?)"/);return _0x5b7015?_0x5b7015[0x1]:_0x6851c;}function extractCalleridNumber(_0x4583b8){var _0x281cfe=_0x4583b8['match'](/<(.*?)>/);return _0x281cfe?_0x281cfe[0x1]:_0x4583b8;}Dialer[_0xfde9('0x1c')][_0xfde9('0x178')]=function(_0x50527a,_0x295937){var _0x381577=this;var _0x439568=uuid['v4']();this[_0xfde9('0x25')][_0x439568]=new Action(_0x50527a,_0x295937,_0x439568);return new BPromise(function(_0x56c498,_0x3f462d){if(_[_0xfde9('0x41')](_0x50527a)&&typeof _0x50527a!==_0xfde9('0x179')){return _0x3f462d(msgResponse(_0xfde9('0x17a'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xfde9('0x41')](_0x295937[_0xfde9('0x17b')])||_0x295937['phone']===null){return _0x3f462d(msgResponse(_0xfde9('0x17a'),_0xfde9('0x155'),_0xfde9('0x17c')));}var _0x43007b={'XMD-CALLERID':_0x381577[_0xfde9('0x25')][_0x439568][_0xfde9('0x17d')](),'XMD-AGI':_0x50527a['dialQueueProject']?util[_0xfde9('0x80')](_0xfde9('0x17e'),ipAgi,_0x50527a['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x50527a[_0xfde9('0x117')]?util[_0xfde9('0x80')]('\x22agi://%s/square,%s\x22',ipAgi,_0x50527a[_0xfde9('0x117')]):_0xfde9('0x17f'),'XMD-QUEUE':_0x50527a[_0xfde9('0x52')]===_0xfde9('0x53')?util['format'](_0xfde9('0x180'),_0x50527a[_0xfde9('0x45')],_0x50527a[_0xfde9('0x181')]||'',_0x50527a[_0xfde9('0x118')]?'c':'',_0x50527a[_0xfde9('0x11f')]||0x3):'NONE','XMD-CONTACTID':_0x295937[_0xfde9('0xda')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x381577[_0xfde9('0x25')][_0x439568]['getCaller'](),'XMD-AMD':_0x50527a[_0xfde9('0xea')]?'ACTIVE':_0xfde9('0x17f'),'XMD-DESTINATION':_0xfde9('0xe9')};if(_0x50527a[_0xfde9('0xea')]){_0x43007b['XMD-AMDINITIALSILENCE']=_0x50527a['dialAMDInitialSilence']||0x9c4;_0x43007b[_0xfde9('0x182')]=_0x50527a[_0xfde9('0x183')]||0x5dc;_0x43007b[_0xfde9('0x184')]=_0x50527a[_0xfde9('0x185')]||0x320;_0x43007b['XMD-AMDTOTALANALYSISTIME']=_0x50527a[_0xfde9('0x186')]||0x1388;_0x43007b[_0xfde9('0x187')]=_0x50527a[_0xfde9('0x188')]||0x64;_0x43007b[_0xfde9('0x189')]=_0x50527a[_0xfde9('0x18a')]||0x32;_0x43007b[_0xfde9('0x18b')]=_0x50527a['dialAMDMaximumNumberOfWords']||0x3;_0x43007b[_0xfde9('0x18c')]=_0x50527a[_0xfde9('0x18d')]||0x100;_0x43007b['XMD-AMDMAXIMUMWORDLENGTH']=_0x50527a[_0xfde9('0x18e')]||0x1388;}if(_0x50527a['type']===_0xfde9('0x53')){_0x43007b[_0xfde9('0x18f')]=_0x295937[_0xfde9('0xdd')];}else{_0x43007b[_0xfde9('0x190')]=_0x295937[_0xfde9('0xde')];}for(var _0x30c867 in _0x295937[_0xfde9('0x191')]){if(typeof _0x295937[_0xfde9('0x191')][_0x30c867]!==_0xfde9('0xb2')){if(isNotNull(_0x295937['Contact'][_0x30c867])&&_0x30c867!=='id'&&_0x30c867!==_0xfde9('0x192')&&_0x30c867!==_0xfde9('0x193')&&_0x30c867!==_0xfde9('0x194')){_0x43007b[util[_0xfde9('0x80')](_0xfde9('0x195'),_0xfde9('0x196'),_[_0xfde9('0x197')](_0x30c867))]=_0x295937[_0xfde9('0x191')][_0x30c867];}}}var _0x481e0b=_0x381577[_0xfde9('0x14e')](_0x50527a['Trunk'])?getCallerId(_0x50527a[_0xfde9('0x7c')][_0xfde9('0x7e')],_0x50527a[_0xfde9('0x5e')],_0x50527a[_0xfde9('0x198')]>0x0?getCallerIdRandom(_0x50527a[_0xfde9('0x5f')],_0x50527a[_0xfde9('0x198')]):_0x50527a[_0xfde9('0x5f')]):getCallerId(_[_0xfde9('0xb3')](_0x50527a[_0xfde9('0x14f')])?_0x50527a[_0xfde9('0x7c')][_0xfde9('0x7e')]:_0x50527a[_0xfde9('0x14f')]['callerid'],_0x50527a[_0xfde9('0x5e')],_0x50527a[_0xfde9('0x198')]>0x0?getCallerIdRandom(_0x50527a['dialOriginateCallerIdNumber'],_0x50527a[_0xfde9('0x198')]):_0x50527a['dialOriginateCallerIdNumber']);if(_0x481e0b){_0x43007b['XMD-ORIGINATECALLERIDNAME']=_0x381577[_0xfde9('0x25')][_0x439568][_0xfde9('0x199')]=extractCalleridName(_0x481e0b);_0x43007b[_0xfde9('0x19a')]=_0x295937[_0xfde9('0x17b')];}return ami[_0xfde9('0xb4')]({'actionid':_0x439568,'action':_0xfde9('0x17a'),'channel':_0x381577[_0xfde9('0x14e')](_0x50527a[_0xfde9('0x7c')])?util['format'](_0xfde9('0x19b'),_0x50527a[_0xfde9('0x7c')][_0xfde9('0x45')],isNotNull(_0x50527a[_0xfde9('0x61')])?_0x50527a[_0xfde9('0x61')]['trim']()||'':'',_0x50527a[_0xfde9('0x19c')]>0x0?_0x295937[_0xfde9('0x17b')][_0xfde9('0x19d')](_0x50527a[_0xfde9('0x19c')]):_0x295937[_0xfde9('0x17b')]):util[_0xfde9('0x80')](_0xfde9('0x19b'),_[_0xfde9('0xb3')](_0x50527a[_0xfde9('0x14f')])?_0x50527a[_0xfde9('0x7c')][_0xfde9('0x45')]:_0x50527a[_0xfde9('0x14f')][_0xfde9('0x45')],isNotNull(_0x50527a[_0xfde9('0x61')])?_0x50527a['dialPrefix'][_0xfde9('0x19e')]()||'':'',_0x50527a[_0xfde9('0x19c')]>0x0?_0x295937[_0xfde9('0x17b')][_0xfde9('0x19d')](_0x50527a[_0xfde9('0x19c')]):_0x295937[_0xfde9('0x17b')]),'callerid':_0x481e0b,'Exten':_0xfde9('0xe9'),'Context':_0xfde9('0x19f'),'Priority':'1','variable':_0x43007b,'timeout':(_0x50527a['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x439568})[_0xfde9('0xbd')](function(_0x4c0976){return _0x56c498(_0x4c0976);})['catch'](function(_0x12084d){_0x50527a['outboundOriginateFailureCallsDay']+=0x1;var _0x129e74=new History(_0x381577[_0xfde9('0x25')][_0x439568]);logger[_0xfde9('0x9d')](util[_0xfde9('0x80')](_0xfde9('0x1a0'),JSON[_0xfde9('0x4d')](_0x12084d)));_0x129e74[_0xfde9('0xad')]=0xe;_0x129e74[_0xfde9('0xed')]='OriginateError';_0x129e74[_0xfde9('0x129')]=moment()['format'](_0xfde9('0x108'));_0x129e74['endtime']=_0x129e74['starttime'];_0x381577[_0xfde9('0xd1')](_0x129e74)[_0xfde9('0xb6')](loggerCatch('[originate][error]'));_0x381577[_0xfde9('0xd0')](_0x129e74)['catch'](loggerCatch('[originate][error]'))[_0xfde9('0x147')](function(){delete _0x381577[_0xfde9('0x25')][_0x439568];return _0x3f462d(msgResponse(_0xfde9('0x17a'),'Error',_0xfde9('0x1a1')));});});});};Dialer[_0xfde9('0x1c')][_0xfde9('0x32')]=function(_0x44a9b3){var _0x4b6e13=this[_0xfde9('0x25')][_0x44a9b3[_0xfde9('0x134')]];if(_0x4b6e13){delete this['actions'][_0x44a9b3[_0xfde9('0x134')]];_0x4b6e13[_0xfde9('0x11e')]=moment()[_0xfde9('0x80')](_0xfde9('0x108'));var _0xa58a12=_0x4b6e13[_0xfde9('0x52')]===_0xfde9('0x83')?this[_0xfde9('0x20')][_0x4b6e13[_0xfde9('0xb9')]]:this['voiceQueues'][_0x4b6e13['getQueue']()];if(!this[_0xfde9('0xe1')](_0x44a9b3[_0xfde9('0x1a2')])){this['updateOriginated'](_0xa58a12);return this[_0xfde9('0x1a3')](_0x4b6e13,_0xa58a12,_0x44a9b3)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x1a4')));}this[_0xfde9('0x27')][_0x44a9b3[_0xfde9('0xe5')]]=_0x4b6e13;}};Dialer[_0xfde9('0x1c')]['checkRetriveMax']=function(_0x3de940,_0x5d3e4d,_0x1e7b63){var _0x2bd6a3=new History(_0x5d3e4d);if(_0x2bd6a3[_0xfde9('0xfa')]+_0x2bd6a3['countcongestionretry']+_0x2bd6a3[_0xfde9('0xfb')]+_0x2bd6a3[_0xfde9('0xfc')]+_0x2bd6a3[_0xfde9('0xfd')]+_0x2bd6a3['countabandonedretry']+_0x2bd6a3[_0xfde9('0xf6')]+_0x2bd6a3['countagentrejectretry']>=_0x1e7b63[_0xfde9('0xff')]-0x1){return!![];}switch(_0x3de940){case 0x3:if(_0x2bd6a3[_0xfde9('0xfb')]>=_0x1e7b63[_0xfde9('0x1a5')]-0x1){return!![];}this[_0xfde9('0xc6')]({'active':![],'countnoanswerretry':_0x2bd6a3[_0xfde9('0xfb')]+=0x1,'scheduledat':moment()[_0xfde9('0x105')](_0x1e7b63[_0xfde9('0x1a6')],_0xfde9('0x107'))[_0xfde9('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2bd6a3[_0xfde9('0xda')],'ListId':_0x2bd6a3['ListId'],'VoiceQueueId':_0x2bd6a3['VoiceQueueId']||undefined,'CampaignId':_0x2bd6a3[_0xfde9('0xde')]||undefined})['catch'](loggerCatch(_0xfde9('0x1a7')));break;case 0x5:if(_0x2bd6a3['countbusyretry']>=_0x1e7b63[_0xfde9('0x1a8')]-0x1){return!![];}this[_0xfde9('0xc6')]({'active':![],'countbusyretry':_0x2bd6a3[_0xfde9('0xfa')]+=0x1,'scheduledat':moment()[_0xfde9('0x105')](_0x1e7b63[_0xfde9('0x1a9')],_0xfde9('0x107'))[_0xfde9('0x80')](_0xfde9('0x108')),'ContactId':_0x2bd6a3[_0xfde9('0xda')],'ListId':_0x2bd6a3[_0xfde9('0xdb')],'VoiceQueueId':_0x2bd6a3[_0xfde9('0xdd')]||undefined,'CampaignId':_0x2bd6a3[_0xfde9('0xde')]||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x1aa')));break;case 0x8:if(_0x2bd6a3[_0xfde9('0x10d')]>=_0x1e7b63[_0xfde9('0x1ab')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x2bd6a3['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x1e7b63['dialCongestionRetryFrequency'],'minutes')[_0xfde9('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2bd6a3[_0xfde9('0xda')],'ListId':_0x2bd6a3['ListId'],'VoiceQueueId':_0x2bd6a3[_0xfde9('0xdd')]||undefined,'CampaignId':_0x2bd6a3[_0xfde9('0xde')]||undefined})['catch'](loggerCatch(_0xfde9('0x1ac')));break;case 0x0:if(_0x2bd6a3[_0xfde9('0xfc')]>=_0x1e7b63[_0xfde9('0x1ad')]-0x1){return!![];}else{this[_0xfde9('0xc6')]({'active':![],'countnosuchnumberretry':_0x2bd6a3['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xfde9('0x105')](_0x1e7b63['dialNoSuchNumberRetryFrequency'],_0xfde9('0x107'))[_0xfde9('0x80')](_0xfde9('0x108')),'ContactId':_0x2bd6a3[_0xfde9('0xda')],'ListId':_0x2bd6a3['ListId'],'VoiceQueueId':_0x2bd6a3['VoiceQueueId']||undefined,'CampaignId':_0x2bd6a3[_0xfde9('0xde')]||undefined})['catch'](loggerCatch(_0xfde9('0x1ae')));}break;case 0xa:if(_0x2bd6a3[_0xfde9('0xfd')]>=_0x1e7b63['dialDropMaxRetry']-0x1){return!![];}this[_0xfde9('0xc6')]({'active':![],'countdropretry':_0x2bd6a3[_0xfde9('0xfd')]+=0x1,'scheduledat':moment()[_0xfde9('0x105')](_0x1e7b63[_0xfde9('0x1af')],_0xfde9('0x107'))['format'](_0xfde9('0x108')),'ContactId':_0x2bd6a3[_0xfde9('0xda')],'ListId':_0x2bd6a3[_0xfde9('0xdb')],'VoiceQueueId':_0x2bd6a3[_0xfde9('0xdd')]||undefined,'CampaignId':_0x2bd6a3['CampaignId']||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x1b0')));break;case 0xb:if(_0x2bd6a3[_0xfde9('0xfe')]>=_0x1e7b63['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xfde9('0xc6')]({'active':![],'countabandonedretry':_0x2bd6a3[_0xfde9('0xfe')]+=0x1,'scheduledat':moment()[_0xfde9('0x105')](_0x1e7b63[_0xfde9('0x12e')],_0xfde9('0x107'))[_0xfde9('0x80')](_0xfde9('0x108')),'ContactId':_0x2bd6a3[_0xfde9('0xda')],'ListId':_0x2bd6a3[_0xfde9('0xdb')],'VoiceQueueId':_0x2bd6a3[_0xfde9('0xdd')]||undefined,'CampaignId':_0x2bd6a3['CampaignId']||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x131')));break;case 0x13:if(_0x2bd6a3[_0xfde9('0xf6')]>=_0x1e7b63[_0xfde9('0x102')]-0x1){return!![];}this[_0xfde9('0xc6')]({'active':![],'countmachineretry':_0x2bd6a3['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x1e7b63[_0xfde9('0x106')],_0xfde9('0x107'))[_0xfde9('0x80')](_0xfde9('0x108')),'ContactId':_0x2bd6a3[_0xfde9('0xda')],'ListId':_0x2bd6a3[_0xfde9('0xdb')],'VoiceQueueId':_0x2bd6a3['VoiceQueueId']||undefined,'CampaignId':_0x2bd6a3[_0xfde9('0xde')]||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x109')));break;case 0x14:if(_0x2bd6a3['countagentrejectretry']>=_0x1e7b63[_0xfde9('0x1b1')]-0x1){return!![];}this[_0xfde9('0xc6')]({'active':![],'countagentrejectretry':_0x2bd6a3[_0xfde9('0x1b2')]+=0x1,'scheduledat':moment()[_0xfde9('0x105')](_0x1e7b63[_0xfde9('0x1b3')],_0xfde9('0x107'))[_0xfde9('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2bd6a3['ContactId'],'ListId':_0x2bd6a3[_0xfde9('0xdb')],'VoiceQueueId':_0x2bd6a3[_0xfde9('0xdd')]||undefined,'CampaignId':_0x2bd6a3[_0xfde9('0xde')]||undefined})[_0xfde9('0xb6')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xfde9('0x1a3')]=function(_0x7ff81a,_0x3e9c28,_0x281d1b){var _0x1a88e8=this;var _0x17854a=new History(_0x7ff81a);var _0x8f2cc2=![];var _0x445bd4;var _0x40c586;return new BPromise(function(_0x207f25,_0x1c4706){if(_[_0xfde9('0x41')](_0x3e9c28)&&typeof _0x3e9c28!==_0xfde9('0x179')){return _0x1c4706(msgResponse('[callProgressDetecting]',_0xfde9('0x155'),_0xfde9('0x1b4')));}if(_[_0xfde9('0x41')](_0x281d1b)&&typeof _0x281d1b!==_0xfde9('0x179')){return _0x1c4706(msgResponse(_0xfde9('0x1b5'),_0xfde9('0x155'),'evt\x20is\x20undefine'));}_0x1a88e8[_0xfde9('0xc0')](_0x17854a,_0x281d1b[_0xfde9('0x115')],_0x3e9c28)[_0xfde9('0xbd')](function(_0x2646d6){if(_0x2646d6[_0xfde9('0x127')]==0x1)_0x8f2cc2=!![];switch(_0x281d1b[_0xfde9('0x115')]){case'0':_0x3e9c28[_0xfde9('0x1b6')]+=0x1;_0x17854a['state']=0x0;_0x17854a['statedesc']=_0xfde9('0x1b7');_0x17854a[_0xfde9('0xfc')]+=0x1;_0x17854a[_0xfde9('0xf7')]+=0x1;ami[_0xfde9('0x51')](_0xfde9('0x1b8'),ut[_0xfde9('0xf8')](_0x7ff81a,_0xfde9('0x1b9')));_0x445bd4=_0x3e9c28[_0xfde9('0x1ba')];_0x40c586=_0x3e9c28[_0xfde9('0x125')];_0x1a88e8[_0xfde9('0xd1')](_0x17854a)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0xf9')));if(_0x1a88e8['checkRetriveMax'](0x0,_0x7ff81a,_0x3e9c28)&&!_0x8f2cc2){if(_0x17854a['countnosuchnumberretry']>=_0x3e9c28['dialNoSuchNumberMaxRetry']){_0x1a88e8[_0xfde9('0x103')](_0x17854a,_0x207f25,_0x1c4706,_0xfde9('0x1bb'));}else{_0x1a88e8[_0xfde9('0x100')](_0x17854a,_0x207f25,_0x1c4706,_0xfde9('0x1bb'));}}break;case'3':_0x3e9c28[_0xfde9('0x1bc')]+=0x1;_0x17854a['state']=0x3;_0x17854a[_0xfde9('0xed')]=_0xfde9('0x1bd');_0x17854a[_0xfde9('0xfb')]+=0x1;_0x17854a[_0xfde9('0xf7')]+=0x1;ami[_0xfde9('0x51')](_0xfde9('0x1be'),ut['buildObj'](_0x7ff81a,_0xfde9('0x1bf')));_0x445bd4=_0x3e9c28[_0xfde9('0x1a6')];_0x40c586=_0x3e9c28[_0xfde9('0x125')];_0x1a88e8[_0xfde9('0xd1')](_0x17854a)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x1c0')));if(_0x1a88e8[_0xfde9('0x1c1')](0x3,_0x7ff81a,_0x3e9c28)&&!_0x8f2cc2){if(_0x17854a[_0xfde9('0xfb')]>=_0x3e9c28['dialNoAnswerMaxRetry']){_0x1a88e8[_0xfde9('0x103')](_0x17854a,_0x207f25,_0x1c4706,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1a88e8['stateGlobal'](_0x17854a,_0x207f25,_0x1c4706,_0xfde9('0x1c2'));}}break;case'5':_0x3e9c28[_0xfde9('0x65')]+=0x1;_0x17854a[_0xfde9('0xad')]=0x5;_0x17854a[_0xfde9('0xed')]='Busy';_0x17854a[_0xfde9('0xfa')]+=0x1;_0x17854a['countglobal']+=0x1;ami['emit'](_0xfde9('0x1c3'),ut[_0xfde9('0xf8')](_0x7ff81a,_0xfde9('0x1c4')));_0x445bd4=_0x3e9c28['dialBusyRetryFrequency'];_0x40c586=_0x3e9c28[_0xfde9('0x125')];_0x1a88e8[_0xfde9('0xd1')](_0x17854a)[_0xfde9('0xb6')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1a88e8[_0xfde9('0x1c1')](0x5,_0x7ff81a,_0x3e9c28)&&!_0x8f2cc2){if(_0x17854a[_0xfde9('0xfa')]>=_0x3e9c28[_0xfde9('0x1a8')]){_0x1a88e8[_0xfde9('0x103')](_0x17854a,_0x207f25,_0x1c4706,_0xfde9('0x1c5'));}else{_0x1a88e8[_0xfde9('0x100')](_0x17854a,_0x207f25,_0x1c4706,'reason\x205\x20busy');}}break;case'8':_0x3e9c28[_0xfde9('0x66')]+=0x1;_0x17854a[_0xfde9('0xad')]=0x8;_0x17854a['statedesc']=_0xfde9('0x1c6');_0x17854a[_0xfde9('0x10d')]+=0x1;_0x17854a[_0xfde9('0xf7')]+=0x1;_0x445bd4=_0x3e9c28[_0xfde9('0x1c7')];_0x40c586=_0x3e9c28[_0xfde9('0x125')];ami[_0xfde9('0x51')](_0xfde9('0x1c8'),ut[_0xfde9('0xf8')](_0x7ff81a,_0xfde9('0x1c9')));_0x1a88e8['createHistory'](_0x17854a)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x1ca')));if(_0x1a88e8[_0xfde9('0x1c1')](0x8,_0x7ff81a,_0x3e9c28)&&!_0x8f2cc2){if(_0x17854a['countcongestionretry']>=_0x3e9c28[_0xfde9('0x1ab')]){_0x1a88e8['createStateFinal'](_0x17854a,_0x207f25,_0x1c4706,'reason\x208\x20congestion');}else{_0x1a88e8[_0xfde9('0x100')](_0x17854a,_0x207f25,_0x1c4706,_0xfde9('0x1cb'));}}break;case'11':_0x3e9c28['outboundAbandonedCallsDay']+=0x1;_0x17854a['state']=0xb;_0x17854a[_0xfde9('0xed')]='Abandoned';_0x17854a[_0xfde9('0xfe')]+=0x1;_0x17854a[_0xfde9('0xf7')]+=0x1;_0x445bd4=_0x3e9c28[_0xfde9('0x12e')];_0x40c586=_0x3e9c28[_0xfde9('0x125')];_0x1a88e8['createHistory'](_0x17854a)[_0xfde9('0xb6')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x1a88e8[_0xfde9('0x1c1')](0xb,_0x7ff81a,_0x3e9c28)&&!_0x8f2cc2){if(_0x17854a[_0xfde9('0xfe')]>=_0x3e9c28['dialAbandonedMaxRetry']){_0x1a88e8[_0xfde9('0x103')](_0x17854a,_0x207f25,_0x1c4706,_0xfde9('0x1cc'));}else{_0x1a88e8[_0xfde9('0x100')](_0x17854a,_0x207f25,_0x1c4706,_0xfde9('0x1cc'));}}break;case'20':_0x3e9c28[_0xfde9('0x6a')]+=0x1;_0x17854a[_0xfde9('0xad')]=0x14;_0x17854a[_0xfde9('0xed')]=_0xfde9('0x1cd');_0x17854a[_0xfde9('0x1b2')]+=0x1;_0x17854a[_0xfde9('0xf7')]+=0x1;_0x445bd4=_0x3e9c28[_0xfde9('0x1b3')];_0x40c586=_0x3e9c28[_0xfde9('0x125')];ami[_0xfde9('0x51')]('custom:agentreject',ut[_0xfde9('0xf8')](_0x7ff81a,_0xfde9('0x1ce')));_0x1a88e8[_0xfde9('0xd1')](_0x17854a)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x1cf')));if(_0x1a88e8[_0xfde9('0x1c1')](0x14,_0x7ff81a,_0x3e9c28)&&!_0x8f2cc2){if(_0x17854a[_0xfde9('0x1b2')]>=_0x3e9c28[_0xfde9('0x1b1')]){_0x1a88e8[_0xfde9('0x103')](_0x17854a,_0x207f25,_0x1c4706,_0xfde9('0x1d0'));}else{_0x1a88e8['stateGlobal'](_0x17854a,_0x207f25,_0x1c4706,_0xfde9('0x1d0'));}}break;default:_0x3e9c28[_0xfde9('0x6b')]+=0x1;_0x17854a[_0xfde9('0xad')]=0xc;_0x17854a['statedesc']=_0x281d1b[_0xfde9('0x115')];_0x445bd4=_0x3e9c28[_0xfde9('0x1b3')];_0x40c586=_0x3e9c28[_0xfde9('0x125')];_0x1a88e8[_0xfde9('0xd1')](_0x17854a)[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x1d1')));if(_0x1a88e8[_0xfde9('0x1c1')](_0x281d1b['reason'],_0x7ff81a,_0x3e9c28)&&!_0x8f2cc2){if(_0x17854a[_0xfde9('0xfa')]+_0x17854a[_0xfde9('0x10d')]+_0x17854a[_0xfde9('0xfb')]+_0x17854a[_0xfde9('0xfc')]+_0x17854a['countdropretry']+_0x17854a['countabandonedretry']+_0x17854a['countmachineretry']+_0x17854a['countagentrejectretry']>=_0x3e9c28[_0xfde9('0xff')]){_0x1a88e8['stateGlobal'](_0x17854a,_0x207f25,_0x1c4706,_0x281d1b[_0xfde9('0x115')]);}else{_0x1a88e8['createStateFinal'](_0x17854a,_0x207f25,_0x1c4706,_0x281d1b[_0xfde9('0x115')]);}}}})[_0xfde9('0xbd')](function(_0x4f304f){if(_0x8f2cc2){_0x1a88e8[_0xfde9('0xc2')](_0x17854a,_0x445bd4,_0x40c586)[_0xfde9('0xbd')](function(_0x2c47b5){return _0x207f25(0x1);});}});});};Dialer[_0xfde9('0x1c')][_0xfde9('0x100')]=function(_0x94b68d,_0xfb2948,_0x1f3bdb,_0x571382){var _0x59e6b4=new Final(_0x94b68d);_0x59e6b4[_0xfde9('0xad')]=0xf;_0x59e6b4[_0xfde9('0xed')]='Global';this[_0xfde9('0x103')](_0x59e6b4,_0xfb2948,_0x1f3bdb,_0x571382);};Dialer[_0xfde9('0x1c')][_0xfde9('0x103')]=function(_0x4d65af,_0x448f93,_0x594274,_0x3793a6){this[_0xfde9('0xd0')](_0x4d65af)['then'](function(){return _0x448f93(msgResponse(_0xfde9('0x1b5'),_0xfde9('0x1d2'),_0x3793a6));})[_0xfde9('0xb6')](function(){return _0x594274(msgResponse('[moveContactManagedDialer][0]',_0xfde9('0x155'),_0xfde9('0x1d3')));});};Dialer[_0xfde9('0x1c')]['predictive']=function(_0x3f676e){var _0x293e76=_0x3f676e[_0xfde9('0x1d4')]/0x64;var _0x425973=_0x3f676e[_0xfde9('0x120')]/(_0x3f676e[_0xfde9('0x120')]+_0x3f676e[_0xfde9('0x63')]);var _0x1a483a=Math['round'](_0x3f676e[_0xfde9('0x76')]*(_0x3f676e[_0xfde9('0x1d5')]/0x64));var _0x13b3e3=Math[_0xfde9('0x1d6')](_0x3f676e[_0xfde9('0x76')]*(_0x3f676e[_0xfde9('0x1d7')]/0x64));var _0x55f798=_0x3f676e[_0xfde9('0x55')]+_0x3f676e[_0xfde9('0x5a')];var _0x564bb5=Math['floor'](_0x3f676e[_0xfde9('0x79')]*_0x3f676e['erlangAbandonmentRate']*_0x3f676e[_0xfde9('0x73')]*_0x3f676e[_0xfde9('0x74')]);if(_[_0xfde9('0x41')](_0x3f676e['startProgressive'])){if(!_[_0xfde9('0x41')](_0x3f676e[_0xfde9('0x29')])){_0x3f676e[_0xfde9('0x29')]=undefined;loggerPredictive[_0xfde9('0x9d')](_0xfde9('0x1d8'),_0xfde9('0x1d9'));}if(!_[_0xfde9('0x41')](_0x3f676e[_0xfde9('0x99')])){loggerPredictive[_0xfde9('0x9d')]('[startMethodPredictive][StartProgressive]',_0xfde9('0x1da'));clearInterval(_0x3f676e[_0xfde9('0x99')]);_0x3f676e['handlePredictive']=undefined;}_0x3f676e[_0xfde9('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3f676e['name'],_0xfde9('0x1db'),_0x3f676e[_0xfde9('0x2a')]);this['handlePower'](_0x3f676e,0x1);}else if(ifInterval(_0x3f676e[_0xfde9('0x1dc')],_0x3f676e[_0xfde9('0x2a')])){this[_0xfde9('0x168')](_0x3f676e,0x1);loggerPredictiveCalls[_0xfde9('0x86')](_0xfde9('0x1dd'),_0x3f676e['startProgressive'],_0x3f676e['name']);_0x3f676e['erlangCalls']=0x0;_0x3f676e[_0xfde9('0x72')]=0x0;}else if(_0x293e76<_0x425973&&_0x3f676e['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x3f676e);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x1de'),'Dropped\x20calls\x20day',_0x425973,_0xfde9('0x2a'),_0x3f676e[_0xfde9('0x45')]);}else if(_0x564bb5<_0x3f676e[_0xfde9('0x72')]&&_0x3f676e['dialPredictiveOptimization']===_0xfde9('0x1df')){freeVariablesPredictive(_0x3f676e);loggerPredictive[_0xfde9('0x86')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xfde9('0x1e0'),_0x564bb5,_0xfde9('0x1e1'),_0x3f676e[_0xfde9('0x72')],_0xfde9('0x2a'),_0x3f676e[_0xfde9('0x45')]);}else if(!ifInterval(_0x3f676e[_0xfde9('0x1dc')],_0x3f676e[_0xfde9('0x2a')])&&_[_0xfde9('0x41')](_0x3f676e[_0xfde9('0x29')])&&!_[_0xfde9('0x41')](_0x3f676e[_0xfde9('0x2a')])){_0x3f676e[_0xfde9('0x29')]=moment()[_0xfde9('0x80')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xfde9('0x86')](_0x3f676e['name'],_0xfde9('0x1e2'),_0x3f676e[_0xfde9('0x29')]);this[_0xfde9('0xc4')](_0x3f676e[_0xfde9('0x1dc')])[_0xfde9('0xbd')](this['getDataPredictive'](_0x3f676e))[_0xfde9('0xbd')](mergeDataErlangB(_0x3f676e))['then'](this['startMethodPredictive'](_0x3f676e))[_0xfde9('0xb6')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x3f676e));}else if(!ifInterval(_0x3f676e['dialPredictiveInterval'],_0x3f676e[_0xfde9('0x29')])){_0x3f676e['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3f676e['startPredictive']=moment()['format'](_0xfde9('0x108'));loggerPredictive[_0xfde9('0x86')](_0x3f676e['name'],'recalculate\x20predictive\x20at',_0x3f676e[_0xfde9('0x29')]);clearInterval(_0x3f676e[_0xfde9('0x99')]);_0x3f676e[_0xfde9('0x99')]=undefined;this['averageHandleTime'](_0x3f676e[_0xfde9('0x1dc')])[_0xfde9('0xbd')](this['getDataPredictive'](_0x3f676e))['then'](mergeDataErlangB(_0x3f676e))['then'](this['startMethodPredictive'](_0x3f676e))['catch'](loggerCatchPredictive(_0xfde9('0x1e3'),_0x3f676e));}else if(_0x3f676e[_0xfde9('0x76')]&&_0x55f798<_0x3f676e[_0xfde9('0x76')]-_0x13b3e3){freeVariablesPredictive(_0x3f676e);loggerPredictive[_0xfde9('0x86')](_0x3f676e['name'],_0xfde9('0x1e4'),_0x55f798,_0xfde9('0x1e5'),_0x3f676e[_0xfde9('0x76')],'-',_0x13b3e3,'=',_0x3f676e['predictiveIntervalAvailable']-_0x13b3e3,')');}else if(_0x3f676e[_0xfde9('0x76')]&&_0x55f798>_0x3f676e[_0xfde9('0x76')]+_0x1a483a){freeVariablesPredictive(_0x3f676e);loggerPredictive[_0xfde9('0x86')](_0x3f676e[_0xfde9('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x55f798,_0xfde9('0x1e6'),_0x3f676e[_0xfde9('0x76')],'+',_0x1a483a,'=',_0x3f676e[_0xfde9('0x76')]+_0x1a483a,')');}};Dialer[_0xfde9('0x1c')][_0xfde9('0x1e7')]=function(_0x3b1607){var _0x1af3cb=this;return function(_0x4b1424){return new BPromise(function(_0x106ddd,_0x284d05){_[_0xfde9('0x13a')](_0x3b1607,_0x4b1424[0x0]);if(checkGetDataPredictive(_0x4b1424[0x0])){var _0x30cbee=_0x3b1607[_0xfde9('0x76')]=_0x3b1607[_0xfde9('0x5a')]+_0x3b1607['available'];var _0x1da0a0=_0x3b1607[_0xfde9('0x1dc')]*0x3c;var _0x3e6d21=_0x4b1424[0x0][_0xfde9('0x6e')]+_0x4b1424[0x0]['predictiveIntervalAvgHoldtime'];var _0x1d919d=(_0x4b1424[0x0]['predictiveIntervalAnsweredCalls']+_0x4b1424[0x0][_0xfde9('0x70')]+_0x4b1424[0x0][_0xfde9('0x6f')])/_0x4b1424[0x0]['predictiveIntervalTotalCalls'];_0x3b1607['predictiveIntervalHitRate']=_0x1d919d>0x0?_0x1d919d:0x1;switch(_0x3b1607['dialPredictiveOptimization']){case _0xfde9('0x1df'):var _0x4ebe01=_0x3b1607['dialPredictiveOptimizationPercentage']/0x64;return _0x1af3cb[_0xfde9('0x1e8')](_0x30cbee,_0x1da0a0,_0x3e6d21,_0x1d919d,_0x4ebe01)['then'](function(_0x2b22f1){return _0x106ddd(_0x2b22f1);});case'agentBusyFactor':var _0xac16ba=_0x3b1607[_0xfde9('0x1d4')]/0x64;return _0x1af3cb[_0xfde9('0x1e9')](_0x30cbee,_0x1da0a0,_0x3e6d21,_0x1d919d,_0xac16ba)[_0xfde9('0xbd')](function(_0x2234bd){return _0x106ddd(_0x2234bd);});default:return _0x284d05(msgResponse(_0xfde9('0x1ea'),_0xfde9('0x155'),_0xfde9('0x1eb')));}}else{return _0x284d05(msgResponse(_0xfde9('0x1ea'),_0xfde9('0x155'),_0xfde9('0x1ec')));}});};};Dialer[_0xfde9('0x1c')][_0xfde9('0x1ed')]=function(_0xe25806){var _0x5edcd7=this;return function(_0x52e523){return new BPromise(function(_0xd237e8,_0x249d46){_[_0xfde9('0x13a')](_0xe25806,_0x52e523[0x0]);if(checkGetDataPredictive(_0x52e523[0x0])){loggerPredictive[_0xfde9('0x86')](JSON['stringify'](_0x52e523[0x0]));if(_0xe25806[_0xfde9('0x1ee')]===_0xfde9('0x1df')){return _0x5edcd7[_0xfde9('0xcf')](_0xe25806['id'])['then'](function(_0x36dc03){var _0x6edd28=_0xe25806[_0xfde9('0x56')]-_0x36dc03[0x0][_0xfde9('0x1ef')];var _0x4e938b=_0xe25806['dialPredictiveInterval']*0x3c;var _0x1105a1=_0x52e523[0x0][_0xfde9('0x6e')]+_0x52e523[0x0]['predictiveIntervalAvgHoldtime'];var _0x3268bc=(_0x52e523[0x0][_0xfde9('0x6c')]+_0x52e523[0x0][_0xfde9('0x70')]+_0x52e523[0x0][_0xfde9('0x6f')])/_0x52e523[0x0][_0xfde9('0x77')];var _0x228c39=_0xe25806[_0xfde9('0x1d4')]/0x64;_0xe25806[_0xfde9('0x75')]=_0x36dc03[0x0]['outboundQueuePauses']||0x0;_0xe25806[_0xfde9('0x73')]=_0x3268bc>0x0?_0x3268bc:0x1;return _0x5edcd7[_0xfde9('0x1e8')](_0x6edd28,_0x4e938b,_0x1105a1,_0x3268bc,_0x228c39);})[_0xfde9('0xbd')](function(_0x5622cc){return _0xd237e8(_0x5622cc);})['catch'](function(_0x2e7757){return _0x249d46(msgResponse(_0xfde9('0x1f0'),'Failure',JSON[_0xfde9('0x4d')](_0x2e7757)));});}if(_0xe25806['dialPredictiveOptimization']===_0xfde9('0x1f1')){return _0x5edcd7[_0xfde9('0xcf')](_0xe25806['id'])['then'](function(_0x5ef443){var _0x4c1bfa=_0xe25806[_0xfde9('0x56')]-_0x5ef443[0x0][_0xfde9('0x1ef')];var _0x4a789a=_0xe25806[_0xfde9('0x1dc')]*0x3c;var _0x1abd8c=_0x52e523[0x0][_0xfde9('0x6e')]+_0x52e523[0x0][_0xfde9('0x6d')];var _0x611066=(_0x52e523[0x0][_0xfde9('0x6c')]+_0x52e523[0x0][_0xfde9('0x70')]+_0x52e523[0x0][_0xfde9('0x6f')])/_0x52e523[0x0]['predictiveIntervalTotalCalls'];var _0x1ea7f8=_0xe25806[_0xfde9('0x1d4')]/0x64;_0xe25806[_0xfde9('0x75')]=_0x5ef443[0x0][_0xfde9('0x1ef')]||0x0;_0xe25806[_0xfde9('0x73')]=_0x611066>0x0?_0x611066:0x1;return _0x5edcd7[_0xfde9('0x1e9')](_0x4c1bfa,_0x4a789a,_0x1abd8c,_0x611066,_0x1ea7f8);})['then'](function(_0x5669ba){return _0xd237e8(_0x5669ba);})[_0xfde9('0xb6')](function(_0x3fd545){return _0x249d46(msgResponse(_0xfde9('0x1f0'),'Failure',JSON[_0xfde9('0x4d')](_0x3fd545)));});}}else{return _0x249d46(msgResponse(_0xfde9('0x1ea'),_0xfde9('0x155'),_0xfde9('0x1ec')));}});};};Dialer[_0xfde9('0x1c')][_0xfde9('0x1f2')]=function(_0x13344f){var _0x112d82=this;return function(){var _0x24b733=0x0;var _0x40c8ba=Math['floor'](_0x13344f[_0xfde9('0x7a')]*0x3e8);if(_0x40c8ba>0x0){_0x40c8ba=_0x40c8ba<0x64?0x64:_0x40c8ba;loggerPredictive[_0xfde9('0x86')](_0x13344f[_0xfde9('0x45')],_0xfde9('0x1f3'),_0x40c8ba,_0xfde9('0x4e'));_0x13344f[_0xfde9('0x99')]=setInterval(function(){_0x112d82[_0xfde9('0x99')](_0x13344f);loggerPredictiveCalls[_0xfde9('0x86')](_0xfde9('0x1f4'),_0x24b733+=0x1);},_0x40c8ba);}else{loggerPredictive[_0xfde9('0x86')](_0x13344f[_0xfde9('0x45')],_0xfde9('0x1f5'));}};};Dialer[_0xfde9('0x1c')]['checkContactBlack']=function(_0x451053,_0x27825d){var _0x44eb01=this;return function(_0x56bb24){if(_['isEmpty'](_0x56bb24)){if(_[_0xfde9('0xb3')](_0x27825d['UserId'])||!_0x27825d[_0xfde9('0x1f6')]){if(_0x451053[_0xfde9('0x5d')]==='booked'){_0x451053[_0xfde9('0x13b')]=_[_0xfde9('0x41')](_0x451053[_0xfde9('0x13b')])?!![]:_0x451053[_0xfde9('0x13b')];var _0x52c756=uuid['v4']();_0x44eb01[_0xfde9('0x25')][_0x52c756]=new Action(_0x451053,_0x27825d,_0x52c756);loggerBooked[_0xfde9('0x86')]('[booked][checkContactBlack]',_0x52c756,_0xfde9('0x1f7'),JSON[_0xfde9('0x4d')](_0x451053[_0xfde9('0x13b')]),'Queue:\x20',_0x451053[_0xfde9('0x45')]);if(_0x451053['queueStatusComplete']){_0x451053['queueStatusComplete']=![];_0x44eb01['queueBooked'][_0x44eb01[_0xfde9('0x25')][_0x52c756]['queue']]=[];ami['Action']({'actionid':_0x52c756,'action':'queuestatus','queue':_0x451053[_0xfde9('0x45')]})[_0xfde9('0xb6')](function(){_0x44eb01['updateOriginated'](_0x451053);_0x44eb01[_0xfde9('0xc6')]({'active':![],'ContactId':_0x44eb01[_0xfde9('0x25')][_0x52c756]['ContactId'],'ListId':_0x44eb01[_0xfde9('0x25')][_0x52c756][_0xfde9('0xdb')],'VoiceQueueId':_0x44eb01[_0xfde9('0x25')][_0x52c756][_0xfde9('0xdd')]||undefined,'CampaignId':_0x44eb01[_0xfde9('0x25')][_0x52c756][_0xfde9('0xde')]||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x1f8')));delete _0x44eb01[_0xfde9('0x25')][_0x52c756];});}else{loggerBooked[_0xfde9('0x86')](_0xfde9('0x1f9'),JSON[_0xfde9('0x4d')](_0x451053[_0xfde9('0x13b')]),_0xfde9('0x1fa'),_0x451053[_0xfde9('0x45')]);_0x44eb01[_0xfde9('0xb7')](_0x451053);_0x44eb01[_0xfde9('0xc6')]({'active':![],'ContactId':_0x44eb01[_0xfde9('0x25')][_0x52c756][_0xfde9('0xda')],'ListId':_0x44eb01[_0xfde9('0x25')][_0x52c756][_0xfde9('0xdb')],'VoiceQueueId':_0x44eb01[_0xfde9('0x25')][_0x52c756][_0xfde9('0xdd')]||undefined,'CampaignId':_0x44eb01['actions'][_0x52c756][_0xfde9('0xde')]||undefined})['catch'](loggerCatch(_0xfde9('0x1f8')));delete _0x44eb01[_0xfde9('0x25')][_0x52c756];}}else{return _0x44eb01[_0xfde9('0x178')](_0x451053,_0x27825d);}}else{if(getDiff(_0x27825d[_0xfde9('0x1fb')])<_0x451053[_0xfde9('0x1fc')]*0x3c){if(_0x27825d[_0xfde9('0x1fd')]&&!_0x27825d[_0xfde9('0x1fd')]['voicePause']){_0x44eb01[_0xfde9('0x9a')][_0xfde9('0x13e')](_0x27825d['id'])[_0xfde9('0x147')](function(){_0x44eb01[_0xfde9('0xb7')](_0x451053);});}else{_0x44eb01['unlockContact']({'active':![]},_0x27825d['id'],0x1)['finally'](function(){_0x44eb01[_0xfde9('0xb7')](_0x451053);});}}else{_0x451053['outboundReCallsDay']+=0x1;_0x44eb01['updateOriginated'](_0x451053);if(_0x451053['dialRecallInQueue']){_0x44eb01[_0xfde9('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x27825d['ContactId'],'ListId':_0x27825d['ListId'],'VoiceQueueId':_0x27825d['VoiceQueueId']||undefined,'CampaignId':_0x27825d[_0xfde9('0xde')]||undefined})[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x1fe')));_0x44eb01['createHistory'](createObjHistory(_0x451053,_0x27825d,_0xfde9('0x1ff'),0x17,'RecallInQueue'))[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x200')));}else{_0x44eb01[_0xfde9('0xd8')](createObjHistory(_0x451053,_0x27825d,_0xfde9('0x201'),0x16,_0xfde9('0x202')),_0xfde9('0x203'),_0xfde9('0x204'));}}}}else{_0x451053[_0xfde9('0x64')]+=0x1;_0x44eb01[_0xfde9('0xd8')](createObjHistory(_0x451053,_0x27825d,_0xfde9('0x205'),0xd,'Blacklist'),_0xfde9('0x206'),'[Originate][MoveBlacklist]');throw _0xfde9('0x207');}};};Dialer[_0xfde9('0x1c')][_0xfde9('0x16e')]=function(_0x22eb15){var _0x5f500d=this;var _0x29bec1=_0x22eb15['limitCalls']-_0x22eb15['originated']-_0x22eb15[_0xfde9('0xcb')];emitCampaignSummary(_0x22eb15);if(_0x29bec1>0x0){if(_0x29bec1>this[_0xfde9('0x23')]){_0x29bec1=this[_0xfde9('0x23')];}_0x22eb15[_0xfde9('0xcb')]+=_0x29bec1;this['getContactDialerIvr'](_0x22eb15['id'],_0x29bec1,_0x22eb15[_0xfde9('0x208')],_0x22eb15)[_0xfde9('0xbd')](function(_0x41728d){_0x22eb15[_0xfde9('0xcb')]-=_0x29bec1;_0x22eb15[_0xfde9('0xcb')]=_0x22eb15[_0xfde9('0xcb')]>0x0?_0x22eb15['temp']:0x0;if(!checkContactEmpty(_0x41728d)){_0x22eb15[_0xfde9('0x42')]=_0xfde9('0xa4');logger[_0xfde9('0x86')](_0xfde9('0x209')+_0x22eb15[_0xfde9('0x45')]);}else{_0x22eb15[_0xfde9('0x78')]+=_0x41728d[_0xfde9('0xa0')];_0x22eb15[_0xfde9('0x42')]=_0xfde9('0x20a');for(var _0x28c8ef=0x0;_0x28c8ef<_0x41728d[_0xfde9('0xa0')];_0x28c8ef+=0x1){_0x22eb15[_0xfde9('0x20b')]+=0x1;if(_[_0xfde9('0xb3')](_0x41728d[_0x28c8ef])||_[_0xfde9('0xb3')](_0x41728d[_0x28c8ef][_0xfde9('0x191')])||_[_0xfde9('0xb3')](_0x41728d[_0x28c8ef][_0xfde9('0x17b')])){_0x5f500d[_0xfde9('0xd6')](_0xfde9('0x20c'),_0x22eb15,_0x41728d[_0x28c8ef]);}else{_0x5f500d[_0xfde9('0x20d')](_['pick'](_0x41728d[_0x28c8ef],[_0xfde9('0xde'),'Contact.phone']))['then'](_0x5f500d[_0xfde9('0x20e')](_0x22eb15,_0x41728d[_0x28c8ef]))[_0xfde9('0xb6')](_0x5f500d[_0xfde9('0xd5')](_0xfde9('0x20f'),_0x22eb15));}}}})['catch'](loggerGetContactDialer(_0xfde9('0x210'),_0x22eb15,_0x29bec1));}};Dialer[_0xfde9('0x1c')][_0xfde9('0x168')]=function(_0x3b5bb0,_0x290086){var _0x4622dd=this;var _0x229bab=[];var _0x5aed4b=_0x290086>=0x1?_0x290086:0x1;if(_0x3b5bb0[_0xfde9('0x5d')]===_0xfde9('0x7')){_0x5aed4b=0x1;}var _0x3037c2=Math[_0xfde9('0x211')](_0x3b5bb0[_0xfde9('0x55')]*_0x5aed4b)-_0x3b5bb0[_0xfde9('0x78')]-_0x3b5bb0[_0xfde9('0xcb')];emitVoiceQueueSummary(_0x3b5bb0);if(_0x3b5bb0['dialLimitQueue']>0x0){var _0x187bdf=_0x3b5bb0[_0xfde9('0x212')]-_0x3b5bb0[_0xfde9('0x78')]-_0x3b5bb0[_0xfde9('0x5a')]-_0x3b5bb0[_0xfde9('0xcb')]-_0x3b5bb0[_0xfde9('0x57')];if(_0x3037c2>_0x187bdf){_0x3037c2=_0x187bdf;}}if(_0x3037c2>0x0){if(_0x3b5bb0[_0xfde9('0x5d')]===_0xfde9('0x7')){_0x3037c2=0x1;}if(_0x3037c2>this['maxNumberOriginate']){_0x3037c2=this[_0xfde9('0x23')];}_0x3b5bb0[_0xfde9('0xcb')]+=_0x3037c2;for(var _0x3454ad in this[_0xfde9('0x21')]){if(typeof this['agents'][_0x3454ad]!=='undefined'){if(this[_0xfde9('0x21')][_0x3454ad][_0xfde9('0xad')]===_0xfde9('0x213')&&this[_0xfde9('0x21')][_0x3454ad][_0xfde9('0xb5')]==='reachable'){_0x229bab[_0xfde9('0x139')](this['agents'][_0x3454ad]['id']);}}}this[_0xfde9('0xca')](_0x3b5bb0['id'],_0x229bab,_0x3037c2,_0x3b5bb0[_0xfde9('0x208')],_0x3b5bb0)[_0xfde9('0xbd')](function(_0x261d90){_0x3b5bb0[_0xfde9('0xcb')]-=_0x3037c2;_0x3b5bb0['temp']=_0x3b5bb0[_0xfde9('0xcb')]>0x0?_0x3b5bb0[_0xfde9('0xcb')]:0x0;if(!checkContactEmpty(_0x261d90)){_0x4622dd[_0xfde9('0xbb')](_0x3b5bb0)[_0xfde9('0xbd')](sendMessageReschedule(_0x3b5bb0))['catch'](loggerCatch(_0xfde9('0x214')));}else{_0x3b5bb0[_0xfde9('0x78')]+=_0x261d90[_0xfde9('0xa0')];_0x3b5bb0[_0xfde9('0x42')]=_0x3b5bb0[_0xfde9('0x5d')]===_0xfde9('0x7')?_0xfde9('0x215'):_0xfde9('0x20a');for(var _0x226864=0x0;_0x226864<_0x261d90[_0xfde9('0xa0')];_0x226864+=0x1){if(_[_0xfde9('0xb3')](_0x261d90[_0x226864])||_['isNil'](_0x261d90[_0x226864][_0xfde9('0x191')])||_[_0xfde9('0xb3')](_0x261d90[_0x226864]['phone'])){_0x4622dd[_0xfde9('0xd6')]('[actionOriginate]\x20',_0x3b5bb0,_0x261d90[_0x226864]);}else{_0x4622dd[_0xfde9('0xbe')](_[_0xfde9('0xd9')](_0x261d90[_0x226864],[_0xfde9('0xdd'),_0xfde9('0x216')]))[_0xfde9('0xbd')](_0x4622dd[_0xfde9('0x20e')](_0x3b5bb0,_0x261d90[_0x226864]))[_0xfde9('0xb6')](_0x4622dd[_0xfde9('0xd5')](_0xfde9('0x20c'),_0x3b5bb0));}}}})['catch'](loggerGetContactDialer(_0xfde9('0x217'),_0x3b5bb0,_0x3037c2));}};Dialer[_0xfde9('0x1c')][_0xfde9('0x99')]=function(_0x148a4c){if(_0x148a4c[_0xfde9('0x212')]>0x0){var _0x1843e8=_0x148a4c[_0xfde9('0x212')]-_0x148a4c[_0xfde9('0x78')]-_0x148a4c['talking'];if(_0x1843e8>0x0){this[_0xfde9('0x218')](_0x148a4c);}else{loggerPredictiveCalls[_0xfde9('0x86')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x148a4c);}};Dialer[_0xfde9('0x1c')][_0xfde9('0x218')]=function(_0x1cdf15){var _0x37208c=this;var _0x29f3fd=[];_0x1cdf15[_0xfde9('0x78')]+=0x1;for(var _0xc23220 in this['agents']){if(typeof this[_0xfde9('0x21')][_0xc23220]!==_0xfde9('0xb2')){if(this[_0xfde9('0x21')][_0xc23220][_0xfde9('0xad')]===_0xfde9('0x213')&&this[_0xfde9('0x21')][_0xc23220][_0xfde9('0xb5')]===_0xfde9('0xe3')){_0x29f3fd[_0xfde9('0x139')](this[_0xfde9('0x21')][_0xc23220]['id']);}}}this[_0xfde9('0xca')](_0x1cdf15['id'],_0x29f3fd,0x1,_0x1cdf15[_0xfde9('0x208')],_0x1cdf15)[_0xfde9('0xbd')](function(_0x3f7883){if(!checkContactEmpty(_0x3f7883)){checkContactLowerLimitOriginate(_0x1cdf15,0x1,0x0);_0x37208c[_0xfde9('0xbb')](_0x1cdf15)[_0xfde9('0xbd')](sendMessageReschedule(_0x1cdf15))[_0xfde9('0xb6')](loggerCatch(_0xfde9('0x214')));}else{_0x1cdf15[_0xfde9('0x42')]=_0xfde9('0x20a');if(_[_0xfde9('0xb3')](_0x3f7883[0x0])||_[_0xfde9('0xb3')](_0x3f7883[0x0][_0xfde9('0x191')])||_[_0xfde9('0xb3')](_0x3f7883[0x0][_0xfde9('0x17b')])){_0x37208c[_0xfde9('0xd6')](_0xfde9('0x20c'),_0x1cdf15,_0x3f7883[0x0]);}else{_0x37208c[_0xfde9('0xbe')](_[_0xfde9('0xd9')](_0x3f7883[0x0],[_0xfde9('0xdd'),_0xfde9('0x216')]))[_0xfde9('0xbd')](_0x37208c[_0xfde9('0x20e')](_0x1cdf15,_0x3f7883[0x0]))[_0xfde9('0xb6')](_0x37208c[_0xfde9('0xd5')](_0xfde9('0x219'),_0x1cdf15));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x1cdf15,0x1));emitVoiceQueueSummary(_0x1cdf15);};Dialer[_0xfde9('0x1c')][_0xfde9('0x1e8')]=function(_0x58f2f1,_0x3e6624,_0x42350e,_0x1b55c2,_0x1939bf,_0x34c728){loggerPredictive[_0xfde9('0x86')](_0xfde9('0x21a'));loggerPredictive[_0xfde9('0x86')](_0xfde9('0x21b'),_0x58f2f1);loggerPredictive['info'](_0xfde9('0x21c'),_0x3e6624);loggerPredictive[_0xfde9('0x86')]('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',_0x42350e);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x21d'),_0x1b55c2);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x21e'),_0x1939bf);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x8e'));return new BPromise(function(_0x36ceff,_0x50bae1){if(_0x58f2f1<=0x0||isNaN(_0x58f2f1)){return _0x50bae1(msgResponse('[abandonmentRate]',_0xfde9('0x4c'),_0xfde9('0x21f')+_0x58f2f1));}if(_0x42350e<=0x0||isNaN(_0x42350e)){return _0x50bae1(msgResponse(_0xfde9('0x220'),_0xfde9('0x4c'),_0xfde9('0x221')+_0x42350e));}if(_0x1b55c2<=0x0||isNaN(_0x1b55c2)){return _0x50bae1(msgResponse(_0xfde9('0x220'),'Error',_0xfde9('0x222')+_0x1b55c2));}if(_0x3e6624<=0x0||isNaN(_0x3e6624)){return _0x50bae1(msgResponse(_0xfde9('0x220'),_0xfde9('0x4c'),_0xfde9('0x223')+_0x3e6624));}if(_0x1939bf<=0x0||isNaN(_0x1939bf)){return _0x50bae1(msgResponse('[abandonmentRate]',_0xfde9('0x4c'),'Amax\x20=\x20'+_0x1939bf));}_0x34c728=_0x34c728||0x0;var _0x1b53c3=0x1/_0x42350e;var _0x474404=0x0;var _0x589a25=0x0;var _0x37b20f=0x0;var _0x5dfdec=0x0;for(var _0x5f6ac6=0x0;_0x37b20f<_0x1939bf;_0x5f6ac6+=0x1){_0x589a25=_0x5f6ac6/_0x3e6624;_0x474404=(_0x1b55c2*_0x589a25+_0x34c728)/_0x1b53c3;_0x37b20f=erlangb(_0x474404,_0x58f2f1);_0x5dfdec=_0x474404/_0x58f2f1*(0x1-erlangb(_0x474404,_0x58f2f1));}return _0x36ceff({'erlangCalls':_0x5f6ac6,'erlangCallToSecond':_0x3e6624/_0x5f6ac6,'erlangAbandonmentRate':_0x37b20f,'erlangBusyFactor':_0x5dfdec});});};Dialer[_0xfde9('0x1c')]['busyFactor']=function(_0x4d4ab4,_0x26a970,_0x33c61c,_0x2b8f52,_0x463233,_0x3cb379){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xfde9('0x21b'),_0x4d4ab4);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x21c'),_0x26a970);loggerPredictive['info'](_0xfde9('0x224'),_0x33c61c);loggerPredictive[_0xfde9('0x86')](_0xfde9('0x21d'),_0x2b8f52);loggerPredictive['info'](_0xfde9('0x225'),_0x463233);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x4446a8,_0x48c058){if(_0x4d4ab4<=0x0||isNaN(_0x4d4ab4)){return _0x48c058(msgResponse('[busyFactor]','Error',_0xfde9('0x21f')+_0x4d4ab4));}if(_0x33c61c<=0x0||isNaN(_0x33c61c)){return _0x48c058(msgResponse(_0xfde9('0x226'),'Error',_0xfde9('0x221')+_0x33c61c));}if(_0x2b8f52<=0x0||isNaN(_0x2b8f52)){return _0x48c058(msgResponse('[busyFactor]','Error',_0xfde9('0x222')+_0x2b8f52));}if(_0x26a970<=0x0||isNaN(_0x26a970)){return _0x48c058(msgResponse(_0xfde9('0x226'),_0xfde9('0x4c'),_0xfde9('0x223')+_0x26a970));}if(_0x463233<=0x0||isNaN(_0x463233)){return _0x48c058(msgResponse('[busyFactor]',_0xfde9('0x4c'),_0xfde9('0x227')+_0x463233));}_0x3cb379=_0x3cb379||0x0;var _0x23d956=0x1/_0x33c61c;var _0x55913d=0x0;var _0x2ee14a=0x0;var _0x385812=0x0;var _0x263fae=0x0;for(var _0x11adf7=0x0;_0x263fae<_0x463233;_0x11adf7+=0x1){_0x2ee14a=_0x11adf7/_0x26a970;_0x55913d=(_0x2b8f52*_0x2ee14a+_0x3cb379)/_0x23d956;_0x385812=erlangb(_0x55913d,_0x4d4ab4);_0x263fae=_0x55913d/_0x4d4ab4*(0x1-erlangb(_0x55913d,_0x4d4ab4));}return _0x4446a8({'erlangCalls':_0x11adf7,'erlangCallToSecond':_0x26a970/_0x11adf7,'erlangAbandonmentRate':_0x385812,'erlangBusyFactor':_0x263fae});});};module[_0xfde9('0x228')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index da68aa7..c8e2b07 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe974=['talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0xe974,0x14b));var _0x4e97=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0xe974[_0x81dcac];return _0xc7803b;};'use strict';var util=require(_0x4e97('0x0'));var _=require(_0x4e97('0x1'));var moment=require(_0x4e97('0x2'));function getSeconds(_0x1790af,_0x452b8f){var _0x5c09b5=moment(_0x1790af)[_0x4e97('0x3')](0x0);var _0x370e6e=moment(_0x452b8f)[_0x4e97('0x3')](0x0);return _0x5c09b5['diff'](_0x370e6e,_0x4e97('0x4'));}function QueueCallerAbandon(_0x484330,_0x1becec){this[_0x4e97('0x5')]=_0x484330[_0x4e97('0x5')];this[_0x4e97('0x6')]=_0x484330['type'];this[_0x4e97('0x7')]=_0x484330[_0x4e97('0x6')]===_0x4e97('0x8')?_0x4e97('0x9'):_0x484330['type'];this['countbusyretry']=_0x484330[_0x4e97('0xa')];this[_0x4e97('0xb')]=_0x484330[_0x4e97('0xb')];this[_0x4e97('0xc')]=_0x484330[_0x4e97('0xc')];this[_0x4e97('0xd')]=_0x484330['countbusyretry']+_0x484330[_0x4e97('0xb')]+_0x484330[_0x4e97('0xc')]+_0x484330[_0x4e97('0xe')]+_0x484330['countdropretry']+_0x484330[_0x4e97('0xf')]+_0x484330[_0x4e97('0x10')]+_0x484330['countagentrejectretry'];this[_0x4e97('0xe')]=_0x484330['countnosuchnumberretry'];this[_0x4e97('0x11')]=_0x484330[_0x4e97('0x11')];this['countabandonedretry']=_0x484330[_0x4e97('0xf')];this['countmachineretry']=_0x484330['countmachineretry'];this[_0x4e97('0x12')]=_0x484330[_0x4e97('0x12')];this[_0x4e97('0x13')]=_0x1becec[_0x4e97('0x13')];this[_0x4e97('0x14')]=_0x484330[_0x4e97('0x15')];this[_0x4e97('0x16')]=_0x484330[_0x4e97('0x17')];this[_0x4e97('0x18')]=_0x484330['starttime'];this['responsetime']=_0x484330[_0x4e97('0x19')];this[_0x4e97('0x1a')]=_0x484330[_0x4e97('0x1a')];this[_0x4e97('0x1b')]=this['droptime'];this['ringtime']=getSeconds(_0x484330[_0x4e97('0x19')],_0x484330[_0x4e97('0x18')]);this[_0x4e97('0x1c')]=getSeconds(this['droptime'],_0x484330[_0x4e97('0x19')]);this[_0x4e97('0x1d')]=0x0;this[_0x4e97('0x9')]=_0x1becec[_0x4e97('0x9')];this[_0x4e97('0x1e')]=_0x1becec[_0x4e97('0x1f')];this[_0x4e97('0x20')]=_0x1becec[_0x4e97('0x20')];this[_0x4e97('0x21')]=_0x484330['callback'];this[_0x4e97('0x22')]=_0x484330[_0x4e97('0x22')];this[_0x4e97('0x23')]=_0x484330[_0x4e97('0x23')];this[_0x4e97('0x24')]=_0x484330[_0x4e97('0x24')];this[_0x4e97('0x25')]=_0x484330['ContactId'];this[_0x4e97('0x26')]=_0x484330[_0x4e97('0x26')];this[_0x4e97('0x27')]=_0x484330[_0x4e97('0x27')];this[_0x4e97('0x28')]=_0x484330[_0x4e97('0x28')];this[_0x4e97('0x29')]=_0x484330['CampaignId'];this['originatecalleridnum']=_0x484330[_0x4e97('0x2a')]||'';this[_0x4e97('0x2b')]=_0x484330[_0x4e97('0x2b')]||'';}module[_0x4e97('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0x5bd8=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x5bd8,0x1ea));var _0x85bd=function(_0x1cc7bf,_0x143305){_0x1cc7bf=_0x1cc7bf-0x0;var _0x2ca440=_0x5bd8[_0x1cc7bf];return _0x2ca440;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x1a5ccb,_0x787655){var _0x222e2f=moment(_0x1a5ccb)[_0x85bd('0x0')](0x0);var _0x1415f2=moment(_0x787655)[_0x85bd('0x0')](0x0);return _0x222e2f[_0x85bd('0x1')](_0x1415f2,_0x85bd('0x2'));}function QueueCallerAbandon(_0x2a8ad0,_0x5339df){this[_0x85bd('0x3')]=_0x2a8ad0[_0x85bd('0x3')];this[_0x85bd('0x4')]=_0x2a8ad0[_0x85bd('0x4')];this[_0x85bd('0x5')]=_0x2a8ad0[_0x85bd('0x4')]===_0x85bd('0x6')?_0x85bd('0x7'):_0x2a8ad0[_0x85bd('0x4')];this[_0x85bd('0x8')]=_0x2a8ad0['countbusyretry'];this['countcongestionretry']=_0x2a8ad0[_0x85bd('0x9')];this[_0x85bd('0xa')]=_0x2a8ad0[_0x85bd('0xa')];this['countglobal']=_0x2a8ad0[_0x85bd('0x8')]+_0x2a8ad0[_0x85bd('0x9')]+_0x2a8ad0[_0x85bd('0xa')]+_0x2a8ad0['countnosuchnumberretry']+_0x2a8ad0[_0x85bd('0xb')]+_0x2a8ad0['countabandonedretry']+_0x2a8ad0[_0x85bd('0xc')]+_0x2a8ad0[_0x85bd('0xd')];this[_0x85bd('0xe')]=_0x2a8ad0[_0x85bd('0xe')];this['countdropretry']=_0x2a8ad0[_0x85bd('0xb')];this[_0x85bd('0xf')]=_0x2a8ad0['countabandonedretry'];this['countmachineretry']=_0x2a8ad0[_0x85bd('0xc')];this[_0x85bd('0xd')]=_0x2a8ad0[_0x85bd('0xd')];this[_0x85bd('0x10')]=_0x5339df[_0x85bd('0x10')];this[_0x85bd('0x11')]=_0x2a8ad0[_0x85bd('0x12')];this[_0x85bd('0x13')]=_0x2a8ad0[_0x85bd('0x14')];this[_0x85bd('0x15')]=_0x2a8ad0['starttime'];this[_0x85bd('0x16')]=_0x2a8ad0['responsetime'];this[_0x85bd('0x17')]=_0x2a8ad0[_0x85bd('0x17')];this['endtime']=this[_0x85bd('0x17')];this['ringtime']=getSeconds(_0x2a8ad0[_0x85bd('0x16')],_0x2a8ad0[_0x85bd('0x15')]);this[_0x85bd('0x18')]=getSeconds(this[_0x85bd('0x17')],_0x2a8ad0[_0x85bd('0x16')]);this['talktime']=0x0;this['queue']=_0x5339df['queue'];this[_0x85bd('0x19')]=_0x5339df[_0x85bd('0x1a')];this[_0x85bd('0x1b')]=_0x5339df['reason'];this[_0x85bd('0x1c')]=_0x2a8ad0[_0x85bd('0x1c')];this[_0x85bd('0x1d')]=_0x2a8ad0[_0x85bd('0x1d')];this[_0x85bd('0x1e')]=_0x2a8ad0[_0x85bd('0x1e')];this[_0x85bd('0x1f')]=_0x2a8ad0['recallme'];this[_0x85bd('0x20')]=_0x2a8ad0[_0x85bd('0x20')];this['ListId']=_0x2a8ad0[_0x85bd('0x21')];this[_0x85bd('0x22')]=_0x2a8ad0[_0x85bd('0x22')];this[_0x85bd('0x23')]=_0x2a8ad0[_0x85bd('0x23')];this['CampaignId']=_0x2a8ad0[_0x85bd('0x24')];this[_0x85bd('0x25')]=_0x2a8ad0[_0x85bd('0x25')]||'';this['originatecalleridname']=_0x2a8ad0[_0x85bd('0x26')]||'';}module[_0x85bd('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 56c8072..fa54d7a 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(_0x35cd56,_0x439be8){var _0x35064e=function(_0x4b9c38){while(--_0x4b9c38){_0x35cd56['push'](_0x35cd56['shift']());}};_0x35064e(++_0x439be8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x2e2ab7,_0x4d6403){var _0x30b9ca=function(_0x1b6991){while(--_0x1b6991){_0x2e2ab7['push'](_0x2e2ab7['shift']());}};_0x30b9ca(++_0x4d6403);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 bcaf05e..c6798b8 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 _0xd991=['lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','parse','then','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','isValid','Trunk\x20Reachable','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','%s/%s.tif','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','exports','util'];(function(_0x213d75,_0x4d0123){var _0x30c944=function(_0x40a539){while(--_0x40a539){_0x213d75['push'](_0x213d75['shift']());}};_0x30c944(++_0x4d0123);}(_0xd991,0xe3));var _0x1d99=function(_0x52da07,_0x2a8d39){_0x52da07=_0x52da07-0x0;var _0x593046=_0xd991[_0x52da07];return _0x593046;};'use strict';var util=require(_0x1d99('0x0'));var _=require(_0x1d99('0x1'));var BPromise=require(_0x1d99('0x2'));var uuid=require(_0x1d99('0x3'));var moment=require(_0x1d99('0x4'));var path=require(_0x1d99('0x5'));var tiff2pdf=require(_0x1d99('0x6'));var gs=require('./util/gs');var logger=require(_0x1d99('0x7'))(_0x1d99('0x8'));var ami=require(_0x1d99('0x9'));var rpcDb=require(_0x1d99('0xa'));var Channel=require(_0x1d99('0xb'));var ut=require(_0x1d99('0xc'));var Action=require(_0x1d99('0xd'));var faxAccount=require(_0x1d99('0xe'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x1d99('0xf'));function Fax(_0x46aae1){this[_0x1d99('0x10')]={};this[_0x1d99('0x11')]=_0x46aae1[_0x1d99('0x11')];this[_0x1d99('0x12')]=_0x46aae1[_0x1d99('0x12')];this[_0x1d99('0x13')]={};ami['on'](_0x1d99('0x14'),this[_0x1d99('0x15')][_0x1d99('0x16')](this));ami['on'](_0x1d99('0x17'),this[_0x1d99('0x18')][_0x1d99('0x16')](this));ami['on'](_0x1d99('0x19'),this[_0x1d99('0x1a')][_0x1d99('0x16')](this));ami['on'](_0x1d99('0x1b'),this[_0x1d99('0x1c')]['bind'](this));ami['on'](_0x1d99('0x1d'),this[_0x1d99('0x1e')][_0x1d99('0x16')](this));ami['on']('receivefax',this[_0x1d99('0x1f')]['bind'](this));ami['on']('hangup',this[_0x1d99('0x20')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x1d99('0x16')](this));}Fax[_0x1d99('0x21')][_0x1d99('0x15')]=function(_0x336c54){if(_0x336c54[_0x1d99('0x22')]===_0x1d99('0x23')){for(var _0x59be69 in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x59be69)){if(_0x336c54[_0x1d99('0x24')]===this[_0x1d99('0x11')][_0x59be69][_0x1d99('0x25')]){this['channels'][_0x336c54[_0x1d99('0x26')]]={};this[_0x1d99('0x10')][_0x336c54[_0x1d99('0x26')]][_0x1d99('0x27')]=_0x336c54[_0x1d99('0x27')];this['channels'][_0x336c54[_0x1d99('0x26')]]['id']=this[_0x1d99('0x11')][_0x59be69]['id'];this[_0x1d99('0x10')][_0x336c54[_0x1d99('0x26')]][_0x1d99('0x28')]=this[_0x1d99('0x11')][_0x59be69][_0x1d99('0x28')];logger['info'](_0x336c54[_0x1d99('0x26')],_0x1d99('0x29'));}}}}if(this[_0x1d99('0x13')][_0x336c54[_0x1d99('0x26')]]){this['channels'][_0x336c54['uniqueid']]={};this[_0x1d99('0x10')][_0x336c54[_0x1d99('0x26')]][_0x1d99('0x27')]=_0x336c54[_0x1d99('0x27')];logger[_0x1d99('0x2a')](_0x336c54[_0x1d99('0x26')],_0x1d99('0x29'));}};Fax[_0x1d99('0x21')]['syncVarSet']=function(_0x2f3856){if(this[_0x1d99('0x10')][_0x2f3856[_0x1d99('0x26')]]){for(var _0x53c509 in _0x2f3856[_0x1d99('0x2b')]){if(_0x2f3856[_0x1d99('0x2b')][_0x1d99('0x2c')](_0x53c509)){this['channels'][_0x2f3856['uniqueid']][_0x53c509]=_0x2f3856[_0x1d99('0x2d')];}}}};Fax[_0x1d99('0x21')][_0x1d99('0x1a')]=function(_0x45e037){if(this[_0x1d99('0x10')][_0x45e037['uniqueid']]){this['channels'][_0x45e037[_0x1d99('0x26')]]['channelstate']=_0x45e037[_0x1d99('0x2e')];this[_0x1d99('0x10')][_0x45e037[_0x1d99('0x26')]][_0x1d99('0x2f')]=_0x45e037[_0x1d99('0x2f')];}};Fax[_0x1d99('0x21')][_0x1d99('0x1c')]=function(_0x4cdc89){if(this[_0x1d99('0x10')][_0x4cdc89[_0x1d99('0x26')]]){for(var _0x2787c2 in _0x4cdc89[_0x1d99('0x2b')]){if(_0x4cdc89[_0x1d99('0x2b')][_0x1d99('0x2c')](_0x2787c2)){this[_0x1d99('0x10')][_0x4cdc89[_0x1d99('0x26')]][_0x2787c2]=_0x4cdc89['value'];}}}};Fax[_0x1d99('0x21')]['syncFaxStatus']=function(_0x283539){if(this[_0x1d99('0x10')][_0x283539[_0x1d99('0x26')]]){this[_0x1d99('0x10')][_0x283539[_0x1d99('0x26')]]['operation']=_0x283539[_0x1d99('0x30')];this[_0x1d99('0x10')][_0x283539[_0x1d99('0x26')]]['status']=_0x283539[_0x1d99('0x31')];this[_0x1d99('0x10')][_0x283539[_0x1d99('0x26')]][_0x1d99('0x25')]=_0x283539['localstationid'];this[_0x1d99('0x10')][_0x283539[_0x1d99('0x26')]][_0x1d99('0x32')]=_0x283539[_0x1d99('0x32')];logger[_0x1d99('0x2a')](_0x283539[_0x1d99('0x26')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x1d99('0x1f')]=function(_0xfbba50){var _0x486975=this;if(this[_0x1d99('0x10')][_0xfbba50[_0x1d99('0x26')]]){var _0x1f644a=this[_0x1d99('0x10')][_0xfbba50[_0x1d99('0x26')]]['id'];this['channels'][_0xfbba50['uniqueid']][_0x1d99('0x33')]=_0xfbba50[_0x1d99('0x33')];this[_0x1d99('0x10')][_0xfbba50[_0x1d99('0x26')]][_0x1d99('0x34')]=_0xfbba50['pagestransferred'];this[_0x1d99('0x10')][_0xfbba50[_0x1d99('0x26')]][_0x1d99('0x25')]=_0xfbba50['localstationid'];this['channels'][_0xfbba50[_0x1d99('0x26')]][_0x1d99('0x35')]=_0xfbba50['resolution'];this[_0x1d99('0x10')][_0xfbba50[_0x1d99('0x26')]][_0x1d99('0x36')]=_0xfbba50[_0x1d99('0x36')];this['channels'][_0xfbba50[_0x1d99('0x26')]]['filename']=_0xfbba50[_0x1d99('0x32')];this[_0x1d99('0x10')][_0xfbba50[_0x1d99('0x26')]][_0x1d99('0x37')]=_0xfbba50[_0x1d99('0x37')];if(this[_0x1d99('0x10')][_0xfbba50['uniqueid']][_0x1d99('0x34')]>0x0){tiff2pdf(_0xfbba50[_0x1d99('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x4ed21e){logger[_0x1d99('0x2a')](_0xfbba50[_0x1d99('0x26')],'\x20result\x20conversion\x20file\x20',_0x4ed21e[_0x1d99('0x38')]);attachment['create']({'name':path[_0x1d99('0x39')](_0xfbba50[_0x1d99('0x32')])[_0x1d99('0x28')],'basename':path[_0x1d99('0x39')](_0xfbba50[_0x1d99('0x32')])[_0x1d99('0x28')]+'.pdf','type':'application/pdf'})[_0x1d99('0x3a')](function(_0x4da35d){faxAccount['notify'](_0x1f644a,{'from':_0xfbba50[_0x1d99('0x37')],'mapKey':'fax','body':path[_0x1d99('0x39')](_0xfbba50['filename'])[_0x1d99('0x28')]+_0x1d99('0x3b'),'AttachmentId':_0x4da35d['id']})[_0x1d99('0x3c')](function(_0x513a4b){logger[_0x1d99('0x3d')](_0xfbba50['uniqueid'],_0x1d99('0x3e'),JSON[_0x1d99('0x3f')](_0x513a4b));});})[_0x1d99('0x3c')](function(_0x347264){logger[_0x1d99('0x3d')](_0xfbba50[_0x1d99('0x26')],'\x20receiveFax\x20',JSON[_0x1d99('0x3f')](_0x347264));});});}logger[_0x1d99('0x2a')](_0xfbba50['uniqueid'],_0x1d99('0x40'));}};Fax['prototype'][_0x1d99('0x41')]=function(_0xd20292){if(this[_0x1d99('0x13')][_0xd20292[_0x1d99('0x26')]]){_[_0x1d99('0x42')](this[_0x1d99('0x10')][_0xd20292[_0x1d99('0x26')]],_['pick'](_0xd20292,[_0x1d99('0x43'),'reason']));}};function updateStatus(_0x4341f0){if(_0x4341f0[_0x1d99('0x44')]){faxMessage[_0x1d99('0x45')](_0x4341f0[_0x1d99('0x44')],{'failMessage':_0x1d99('0x46')})[_0x1d99('0x3a')](function(_0x2ef3d5){ut[_0x1d99('0x47')](_0x1d99('0x48'),_0x2ef3d5);})[_0x1d99('0x3c')](function(_0x161fb6){ut[_0x1d99('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x161fb6);});}else{ut[_0x1d99('0x47')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x1d99('0x21')][_0x1d99('0x49')]=function(_0x53003d,_0x4a0f06,_0x3d8c0c){var _0x509ffe=this;var _0xcc32ad={};if(_0x4a0f06){_0xcc32ad={'read':_0x4a0f06};}else{_0xcc32ad={'failMessage':_0x3d8c0c};}if(this[_0x1d99('0x13')][_0x53003d][_0x1d99('0x44')]){faxMessage[_0x1d99('0x45')](this[_0x1d99('0x13')][_0x53003d][_0x1d99('0x44')],_0xcc32ad)[_0x1d99('0x3a')](function(_0x28f6c9){ut[_0x1d99('0x47')](_0x1d99('0x4a'),_0x28f6c9);})[_0x1d99('0x3c')](function(_0x2fe058){ut[_0x1d99('0x47')](_0x1d99('0x4b'),_0x2fe058);})[_0x1d99('0x4c')](function(){delete _0x509ffe['channels'][_0x53003d];delete _0x509ffe[_0x1d99('0x13')][_0x53003d];});}else{ut['logger'](_0x1d99('0x4d'));delete this['channels'][_0x53003d];delete this['actions'][_0x53003d];}};Fax[_0x1d99('0x21')][_0x1d99('0x20')]=function(_0xbdb02a){var _0x42c711=this;if(this[_0x1d99('0x10')][_0xbdb02a[_0x1d99('0x26')]]){if(this[_0x1d99('0x13')][_0xbdb02a[_0x1d99('0x26')]]){this[_0x1d99('0x10')][_0xbdb02a[_0x1d99('0x26')]]['id']=this[_0x1d99('0x13')][_0xbdb02a[_0x1d99('0x26')]]['id'];this[_0x1d99('0x10')][_0xbdb02a[_0x1d99('0x26')]]['name']=this['actions'][_0xbdb02a[_0x1d99('0x26')]][_0x1d99('0x28')];}logger[_0x1d99('0x2a')](_0xbdb02a[_0x1d99('0x26')],this[_0x1d99('0x13')][_0xbdb02a[_0x1d99('0x26')]]?_0x1d99('0x4e'):_0x1d99('0x4f'),JSON['stringify'](this[_0x1d99('0x10')][_0xbdb02a[_0x1d99('0x26')]]));if(this['actions'][_0xbdb02a[_0x1d99('0x26')]]){if(this[_0x1d99('0x10')][_0xbdb02a[_0x1d99('0x26')]][_0x1d99('0x50')]>0x0&&this[_0x1d99('0x10')][_0xbdb02a[_0x1d99('0x26')]][_0x1d99('0x1d')]===_0x1d99('0x51')){this[_0x1d99('0x49')](_0xbdb02a[_0x1d99('0x26')],!![]);}else{this['updateStatus'](_0xbdb02a[_0x1d99('0x26')],![],this[_0x1d99('0x10')][_0xbdb02a['uniqueid']][_0x1d99('0x52')]?_0x1d99('0x53')+this['channels'][_0xbdb02a[_0x1d99('0x26')]]['faxstatusstring']:_0x1d99('0x54'));}}}};Fax[_0x1d99('0x21')][_0x1d99('0x55')]=function(_0x59f50c){var _0x47b869=this;return new BPromise(function(_0x1a6425,_0x46d318){_0x47b869[_0x1d99('0x56')](_0x59f50c,_0x47b869[_0x1d99('0x11')][_0x59f50c[_0x1d99('0x57')]])['then'](function(_0x483d7b){ut[_0x1d99('0x47')](_0x1d99('0x58'),_0x483d7b);_0x1a6425(ut['message'](_0x1d99('0x59')));})[_0x1d99('0x3c')](function(_0x2d2ec6){ut['logger'](_0x1d99('0x5a'),_0x2d2ec6);updateStatus(_0x59f50c);_0x46d318(ut[_0x1d99('0x38')]('Fax\x20failed'));});});};Fax[_0x1d99('0x21')][_0x1d99('0x5b')]=function(_0x48964f){var _0x4ea4f3=this;return new BPromise(function(_0xc37656,_0x162f2c){var _0x4b512c=_0x4ea4f3['checkTrunk'](_0x4ea4f3[_0x1d99('0x11')][_0x48964f[_0x1d99('0x57')]]['Trunk'],_0x48964f);if(_0x4b512c[_0x1d99('0x5c')]){_0xc37656(ut[_0x1d99('0x38')](_0x1d99('0x5d')));}else{_0x162f2c(ut[_0x1d99('0x38')](_0x4b512c[_0x1d99('0x38')]));}});};function originate(_0x49737a,_0x200684,_0xa06e94){return new BPromise(function(_0x71ee90,_0x5ab99f){if(_0xa06e94){var _0x134b90=util[_0x1d99('0x5e')](_0x1d99('0x5f'),path['parse'](_0x49737a[_0x1d99('0x5')])[_0x1d99('0x28')],_0x49737a[_0x1d99('0x5')]);gs['execute'](_0x134b90)[_0x1d99('0x3a')](function(){_0x49737a[_0x1d99('0x5')]=util[_0x1d99('0x5e')](_0x1d99('0x60'),path['parse'](_0x49737a[_0x1d99('0x5')])['dir'],path[_0x1d99('0x39')](_0x49737a[_0x1d99('0x5')])[_0x1d99('0x28')]);_0x200684[_0x1d99('0x61')]=_0x49737a['path'];ut[_0x1d99('0x47')]('Convert\x20pdf\x20to\x20tif','');ami[_0x1d99('0x62')](ut[_0x1d99('0x63')](_0x49737a,_0x200684))[_0x1d99('0x3a')](function(_0x33b39e){_0x71ee90(_0x33b39e);})[_0x1d99('0x3c')](function(_0x2ead26){_0x5ab99f(_0x2ead26);});})[_0x1d99('0x3c')](function(_0x1e2b16){_0x5ab99f(_0x1e2b16);});}else{ami[_0x1d99('0x62')](ut[_0x1d99('0x63')](_0x49737a,_0x200684))[_0x1d99('0x3a')](function(_0x5d6325){_0x71ee90(_0x5d6325);})['catch'](function(_0x5157e6){_0x5ab99f(_0x5157e6);});}});}Fax['prototype'][_0x1d99('0x56')]=function(_0x58f535,_0x197e24){var _0x4bf5dd=this;return new BPromise(function(_0xe9bd40,_0x1ed77a){var _0x1de916=uuid['v4']();var _0x43747d=ut[_0x1d99('0x64')](_0x58f535,_0x197e24);_0x4bf5dd[_0x1d99('0x13')][_0x1de916]=new Action(_0x1de916,_0x197e24,_0x58f535);var _0x25cfbc=_0x4bf5dd[_0x1d99('0x13')][_0x1de916];if(path['parse'](_0x58f535[_0x1d99('0x5')])[_0x1d99('0x65')]===_0x1d99('0x3b')){originate(_0x25cfbc,_0x43747d,!![])[_0x1d99('0x3a')](function(_0x171861){_0xe9bd40(_0x171861);})[_0x1d99('0x3c')](function(_0x384549){_0x1ed77a(_0x384549);});}else{originate(_0x25cfbc,_0x43747d,![])[_0x1d99('0x3a')](function(_0x59e25b){_0xe9bd40(_0x59e25b);})['catch'](function(_0x2c115e){_0x1ed77a(_0x2c115e);});}});};Fax[_0x1d99('0x21')][_0x1d99('0x66')]=function(_0x188e50){return!_[_0x1d99('0x67')](_0x188e50)&&!_[_0x1d99('0x67')](_0x188e50[_0x1d99('0x28')])&&!_['isNil'](_0x188e50[_0x1d99('0x68')])&&_0x188e50[_0x1d99('0x68')]&&!_[_0x1d99('0x67')](this['trunks'][util[_0x1d99('0x5e')](_0x1d99('0x69'),_0x188e50['name'])])&&!_[_0x1d99('0x67')](this[_0x1d99('0x12')][util[_0x1d99('0x5e')](_0x1d99('0x69'),_0x188e50['name'])][_0x1d99('0x31')])&&(this['trunks'][util[_0x1d99('0x5e')]('SIP/%s',_0x188e50['name'])]['status']===_0x1d99('0x6a')||this[_0x1d99('0x12')][util[_0x1d99('0x5e')]('SIP/%s',_0x188e50[_0x1d99('0x28')])][_0x1d99('0x31')]===_0x1d99('0x6b'));};Fax[_0x1d99('0x21')]['checkTrunk']=function(_0xca6f04,_0x33f9e5){if(!this[_0x1d99('0x66')](_0xca6f04)){ut[_0x1d99('0x47')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x1d99('0x67')](_0xca6f04)?'':_0xca6f04['name']+_0x1d99('0x6c'));return{'isValid':![],'message':_0x1d99('0x6d')};}if(_['isNil'](_0x33f9e5[_0x1d99('0x8')])){ut[_0x1d99('0x47')](_0x1d99('0x6e'),JSON[_0x1d99('0x3f')](_0x33f9e5));return{'isValid':![],'message':_0x1d99('0x6f')};}if(_[_0x1d99('0x67')](_0x33f9e5['path'])){ut[_0x1d99('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x33f9e5));return{'isValid':![],'message':_0x1d99('0x70')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x1d99('0x71')]=Fax; \ No newline at end of file +var _0x7b1a=['Action','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','moment','path','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','hangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','\x20syncNewchannel\x20','actions','info','prototype','value','channelstate','channelstatedesc','variable','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','calleridnum','.pdf','catch','error','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','checkTrunk','Trunk','isValid','Trunk\x20Reachable','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','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','variablesAction'];(function(_0x4cb280,_0x2b649d){var _0x3a05ae=function(_0x49f8bd){while(--_0x49f8bd){_0x4cb280['push'](_0x4cb280['shift']());}};_0x3a05ae(++_0x2b649d);}(_0x7b1a,0x1db));var _0xa7b1=function(_0x2177e4,_0xdb658f){_0x2177e4=_0x2177e4-0x0;var _0x18130d=_0x7b1a[_0x2177e4];return _0x18130d;};'use strict';var util=require(_0xa7b1('0x0'));var _=require(_0xa7b1('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xa7b1('0x2'));var path=require(_0xa7b1('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xa7b1('0x4'));var logger=require(_0xa7b1('0x5'))(_0xa7b1('0x6'));var ami=require(_0xa7b1('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0xa7b1('0x8'));var ut=require(_0xa7b1('0x9'));var Action=require(_0xa7b1('0xa'));var faxAccount=require(_0xa7b1('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0xe46420){this[_0xa7b1('0xc')]={};this[_0xa7b1('0xd')]=_0xe46420[_0xa7b1('0xd')];this[_0xa7b1('0xe')]=_0xe46420[_0xa7b1('0xe')];this['actions']={};ami['on']('newchannel',this[_0xa7b1('0xf')][_0xa7b1('0x10')](this));ami['on']('varset',this[_0xa7b1('0x11')]['bind'](this));ami['on'](_0xa7b1('0x12'),this[_0xa7b1('0x13')][_0xa7b1('0x10')](this));ami['on'](_0xa7b1('0x14'),this[_0xa7b1('0x15')][_0xa7b1('0x10')](this));ami['on']('faxstatus',this[_0xa7b1('0x16')][_0xa7b1('0x10')](this));ami['on'](_0xa7b1('0x17'),this['syncReceiveFax'][_0xa7b1('0x10')](this));ami['on'](_0xa7b1('0x18'),this['syncHangup'][_0xa7b1('0x10')](this));ami['on'](_0xa7b1('0x19'),this[_0xa7b1('0x1a')]['bind'](this));}Fax['prototype'][_0xa7b1('0xf')]=function(_0x3b5e15){if(_0x3b5e15[_0xa7b1('0x1b')]===_0xa7b1('0x1c')){for(var _0x1ec6a3 in this[_0xa7b1('0xd')]){if(this['faxAccounts'][_0xa7b1('0x1d')](_0x1ec6a3)){if(_0x3b5e15[_0xa7b1('0x1e')]===this['faxAccounts'][_0x1ec6a3]['localstationid']){this[_0xa7b1('0xc')][_0x3b5e15['uniqueid']]={};this[_0xa7b1('0xc')][_0x3b5e15[_0xa7b1('0x1f')]][_0xa7b1('0x20')]=_0x3b5e15['channel'];this[_0xa7b1('0xc')][_0x3b5e15[_0xa7b1('0x1f')]]['id']=this[_0xa7b1('0xd')][_0x1ec6a3]['id'];this[_0xa7b1('0xc')][_0x3b5e15[_0xa7b1('0x1f')]][_0xa7b1('0x21')]=this['faxAccounts'][_0x1ec6a3][_0xa7b1('0x21')];logger['info'](_0x3b5e15[_0xa7b1('0x1f')],_0xa7b1('0x22'));}}}}if(this[_0xa7b1('0x23')][_0x3b5e15[_0xa7b1('0x1f')]]){this['channels'][_0x3b5e15[_0xa7b1('0x1f')]]={};this['channels'][_0x3b5e15[_0xa7b1('0x1f')]][_0xa7b1('0x20')]=_0x3b5e15[_0xa7b1('0x20')];logger[_0xa7b1('0x24')](_0x3b5e15[_0xa7b1('0x1f')],_0xa7b1('0x22'));}};Fax[_0xa7b1('0x25')][_0xa7b1('0x11')]=function(_0x3ba982){if(this[_0xa7b1('0xc')][_0x3ba982['uniqueid']]){for(var _0x46105b in _0x3ba982['variable']){if(_0x3ba982['variable']['hasOwnProperty'](_0x46105b)){this[_0xa7b1('0xc')][_0x3ba982[_0xa7b1('0x1f')]][_0x46105b]=_0x3ba982[_0xa7b1('0x26')];}}}};Fax[_0xa7b1('0x25')]['syncNewState']=function(_0x594a6b){if(this[_0xa7b1('0xc')][_0x594a6b['uniqueid']]){this[_0xa7b1('0xc')][_0x594a6b[_0xa7b1('0x1f')]][_0xa7b1('0x27')]=_0x594a6b[_0xa7b1('0x27')];this['channels'][_0x594a6b['uniqueid']][_0xa7b1('0x28')]=_0x594a6b['channelstatedesc'];}};Fax[_0xa7b1('0x25')][_0xa7b1('0x15')]=function(_0x33a924){if(this[_0xa7b1('0xc')][_0x33a924[_0xa7b1('0x1f')]]){for(var _0x326ec7 in _0x33a924[_0xa7b1('0x29')]){if(_0x33a924[_0xa7b1('0x29')]['hasOwnProperty'](_0x326ec7)){this[_0xa7b1('0xc')][_0x33a924[_0xa7b1('0x1f')]][_0x326ec7]=_0x33a924[_0xa7b1('0x26')];}}}};Fax['prototype'][_0xa7b1('0x16')]=function(_0x59adb8){if(this[_0xa7b1('0xc')][_0x59adb8['uniqueid']]){this[_0xa7b1('0xc')][_0x59adb8[_0xa7b1('0x1f')]][_0xa7b1('0x2a')]=_0x59adb8[_0xa7b1('0x2a')];this[_0xa7b1('0xc')][_0x59adb8[_0xa7b1('0x1f')]][_0xa7b1('0x2b')]=_0x59adb8['status'];this[_0xa7b1('0xc')][_0x59adb8[_0xa7b1('0x1f')]][_0xa7b1('0x2c')]=_0x59adb8['localstationid'];this['channels'][_0x59adb8[_0xa7b1('0x1f')]][_0xa7b1('0x2d')]=_0x59adb8[_0xa7b1('0x2d')];logger[_0xa7b1('0x24')](_0x59adb8[_0xa7b1('0x1f')],_0xa7b1('0x2e'));}};Fax[_0xa7b1('0x25')][_0xa7b1('0x2f')]=function(_0xf3ee29){var _0x20b42c=this;if(this['channels'][_0xf3ee29['uniqueid']]){var _0x5bfbf7=this['channels'][_0xf3ee29['uniqueid']]['id'];this[_0xa7b1('0xc')][_0xf3ee29['uniqueid']][_0xa7b1('0x30')]=_0xf3ee29[_0xa7b1('0x30')];this['channels'][_0xf3ee29[_0xa7b1('0x1f')]][_0xa7b1('0x31')]=_0xf3ee29[_0xa7b1('0x31')];this['channels'][_0xf3ee29[_0xa7b1('0x1f')]][_0xa7b1('0x2c')]=_0xf3ee29['localstationid'];this[_0xa7b1('0xc')][_0xf3ee29[_0xa7b1('0x1f')]][_0xa7b1('0x32')]=_0xf3ee29[_0xa7b1('0x32')];this[_0xa7b1('0xc')][_0xf3ee29[_0xa7b1('0x1f')]][_0xa7b1('0x33')]=_0xf3ee29[_0xa7b1('0x33')];this[_0xa7b1('0xc')][_0xf3ee29[_0xa7b1('0x1f')]][_0xa7b1('0x2d')]=_0xf3ee29[_0xa7b1('0x2d')];this[_0xa7b1('0xc')][_0xf3ee29[_0xa7b1('0x1f')]]['calleridnum']=_0xf3ee29['calleridnum'];if(this[_0xa7b1('0xc')][_0xf3ee29[_0xa7b1('0x1f')]]['pagestransferred']>0x0){tiff2pdf(_0xf3ee29[_0xa7b1('0x2d')],_0xa7b1('0x34'),function(_0x5b091a){logger[_0xa7b1('0x24')](_0xf3ee29[_0xa7b1('0x1f')],_0xa7b1('0x35'),_0x5b091a['message']);attachment['create']({'name':path[_0xa7b1('0x36')](_0xf3ee29[_0xa7b1('0x2d')])['name'],'basename':path[_0xa7b1('0x36')](_0xf3ee29[_0xa7b1('0x2d')])['name']+'.pdf','type':'application/pdf'})['then'](function(_0x3bcfb0){faxAccount['notify'](_0x5bfbf7,{'from':_0xf3ee29[_0xa7b1('0x37')],'mapKey':_0xa7b1('0x6'),'body':path[_0xa7b1('0x36')](_0xf3ee29[_0xa7b1('0x2d')])[_0xa7b1('0x21')]+_0xa7b1('0x38'),'AttachmentId':_0x3bcfb0['id']})[_0xa7b1('0x39')](function(_0x187a9b){logger[_0xa7b1('0x3a')](_0xf3ee29[_0xa7b1('0x1f')],'\x20notify\x20',JSON[_0xa7b1('0x3b')](_0x187a9b));});})[_0xa7b1('0x39')](function(_0x4a62d5){logger[_0xa7b1('0x3a')](_0xf3ee29[_0xa7b1('0x1f')],_0xa7b1('0x3c'),JSON[_0xa7b1('0x3b')](_0x4a62d5));});});}logger[_0xa7b1('0x24')](_0xf3ee29[_0xa7b1('0x1f')],_0xa7b1('0x3c'));}};Fax[_0xa7b1('0x25')][_0xa7b1('0x1a')]=function(_0x353281){if(this[_0xa7b1('0x23')][_0x353281[_0xa7b1('0x1f')]]){_[_0xa7b1('0x3d')](this[_0xa7b1('0xc')][_0x353281[_0xa7b1('0x1f')]],_[_0xa7b1('0x3e')](_0x353281,['response',_0xa7b1('0x3f')]));}};function updateStatus(_0x14baed){if(_0x14baed[_0xa7b1('0x40')]){faxMessage['update'](_0x14baed['AttachmentId'],{'failMessage':_0xa7b1('0x41')})[_0xa7b1('0x42')](function(_0x243d8a){ut['logger'](_0xa7b1('0x43'),_0x243d8a);})[_0xa7b1('0x39')](function(_0x1dcfd6){ut[_0xa7b1('0x44')](_0xa7b1('0x45'),_0x1dcfd6);});}else{ut[_0xa7b1('0x44')](_0xa7b1('0x46'));}}Fax[_0xa7b1('0x25')][_0xa7b1('0x47')]=function(_0x386270,_0x235715,_0x255653){var _0x2872ad=this;var _0x49852f={};if(_0x235715){_0x49852f={'read':_0x235715};}else{_0x49852f={'failMessage':_0x255653};}if(this[_0xa7b1('0x23')][_0x386270][_0xa7b1('0x40')]){faxMessage[_0xa7b1('0x48')](this[_0xa7b1('0x23')][_0x386270][_0xa7b1('0x40')],_0x49852f)[_0xa7b1('0x42')](function(_0x5b3b55){ut[_0xa7b1('0x44')](_0xa7b1('0x49'),_0x5b3b55);})['catch'](function(_0x9191f8){ut[_0xa7b1('0x44')](_0xa7b1('0x4a'),_0x9191f8);})['finally'](function(){delete _0x2872ad[_0xa7b1('0xc')][_0x386270];delete _0x2872ad[_0xa7b1('0x23')][_0x386270];});}else{ut[_0xa7b1('0x44')](_0xa7b1('0x4b'));delete this[_0xa7b1('0xc')][_0x386270];delete this[_0xa7b1('0x23')][_0x386270];}};Fax[_0xa7b1('0x25')][_0xa7b1('0x4c')]=function(_0x21875c){var _0x20144a=this;if(this[_0xa7b1('0xc')][_0x21875c[_0xa7b1('0x1f')]]){if(this[_0xa7b1('0x23')][_0x21875c[_0xa7b1('0x1f')]]){this[_0xa7b1('0xc')][_0x21875c[_0xa7b1('0x1f')]]['id']=this[_0xa7b1('0x23')][_0x21875c['uniqueid']]['id'];this[_0xa7b1('0xc')][_0x21875c['uniqueid']][_0xa7b1('0x21')]=this[_0xa7b1('0x23')][_0x21875c[_0xa7b1('0x1f')]]['name'];}logger[_0xa7b1('0x24')](_0x21875c[_0xa7b1('0x1f')],this[_0xa7b1('0x23')][_0x21875c[_0xa7b1('0x1f')]]?_0xa7b1('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON[_0xa7b1('0x3b')](this[_0xa7b1('0xc')][_0x21875c['uniqueid']]));if(this[_0xa7b1('0x23')][_0x21875c[_0xa7b1('0x1f')]]){if(this['channels'][_0x21875c[_0xa7b1('0x1f')]]['faxpages']>0x0&&this[_0xa7b1('0xc')][_0x21875c[_0xa7b1('0x1f')]][_0xa7b1('0x4e')]===_0xa7b1('0x4f')){this[_0xa7b1('0x47')](_0x21875c[_0xa7b1('0x1f')],!![]);}else{this[_0xa7b1('0x47')](_0x21875c['uniqueid'],![],this[_0xa7b1('0xc')][_0x21875c[_0xa7b1('0x1f')]][_0xa7b1('0x50')]?_0xa7b1('0x51')+this[_0xa7b1('0xc')][_0x21875c['uniqueid']][_0xa7b1('0x50')]:_0xa7b1('0x52'));}}}};Fax[_0xa7b1('0x25')][_0xa7b1('0x53')]=function(_0x2a6460){var _0x12e31e=this;return new BPromise(function(_0x38b170,_0x60748a){_0x12e31e[_0xa7b1('0x54')](_0x2a6460,_0x12e31e[_0xa7b1('0xd')][_0x2a6460[_0xa7b1('0x55')]])[_0xa7b1('0x42')](function(_0x5b3649){ut['logger'](_0xa7b1('0x56'),_0x5b3649);_0x38b170(ut[_0xa7b1('0x57')](_0xa7b1('0x58')));})['catch'](function(_0xb7b280){ut[_0xa7b1('0x44')]('[Fax][execOriginate][failure]',_0xb7b280);updateStatus(_0x2a6460);_0x60748a(ut['message']('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x5beaf1){var _0x56a44f=this;return new BPromise(function(_0x49b500,_0x3001b4){var _0x105826=_0x56a44f[_0xa7b1('0x59')](_0x56a44f['faxAccounts'][_0x5beaf1[_0xa7b1('0x55')]][_0xa7b1('0x5a')],_0x5beaf1);if(_0x105826[_0xa7b1('0x5b')]){_0x49b500(ut[_0xa7b1('0x57')](_0xa7b1('0x5c')));}else{_0x3001b4(ut['message'](_0x105826['message']));}});};function originate(_0x3ef77f,_0x4d2d95,_0x25d1c7){return new BPromise(function(_0x2bb464,_0x369ba8){if(_0x25d1c7){var _0x2029b2=util[_0xa7b1('0x5d')](_0xa7b1('0x5e'),path[_0xa7b1('0x36')](_0x3ef77f[_0xa7b1('0x3')])[_0xa7b1('0x21')],_0x3ef77f[_0xa7b1('0x3')]);gs[_0xa7b1('0x5f')](_0x2029b2)[_0xa7b1('0x42')](function(){_0x3ef77f['path']=util[_0xa7b1('0x5d')](_0xa7b1('0x60'),path[_0xa7b1('0x36')](_0x3ef77f[_0xa7b1('0x3')])[_0xa7b1('0x61')],path['parse'](_0x3ef77f['path'])[_0xa7b1('0x21')]);_0x4d2d95['XMF-PATH']=_0x3ef77f[_0xa7b1('0x3')];ut[_0xa7b1('0x44')](_0xa7b1('0x62'),'');ami['Action'](ut[_0xa7b1('0x63')](_0x3ef77f,_0x4d2d95))[_0xa7b1('0x42')](function(_0x159d69){_0x2bb464(_0x159d69);})[_0xa7b1('0x39')](function(_0x5593b9){_0x369ba8(_0x5593b9);});})[_0xa7b1('0x39')](function(_0x200b2e){_0x369ba8(_0x200b2e);});}else{ami[_0xa7b1('0x64')](ut['variablesAction'](_0x3ef77f,_0x4d2d95))[_0xa7b1('0x42')](function(_0x449ac7){_0x2bb464(_0x449ac7);})[_0xa7b1('0x39')](function(_0xc3958e){_0x369ba8(_0xc3958e);});}});}Fax[_0xa7b1('0x25')][_0xa7b1('0x54')]=function(_0x3333f4,_0x3291ef){var _0x38ebd9=this;return new BPromise(function(_0x4305bd,_0x5afda6){var _0x2e353b=uuid['v4']();var _0x62ebba=ut['addVariables'](_0x3333f4,_0x3291ef);_0x38ebd9[_0xa7b1('0x23')][_0x2e353b]=new Action(_0x2e353b,_0x3291ef,_0x3333f4);var _0x46ddb5=_0x38ebd9['actions'][_0x2e353b];if(path[_0xa7b1('0x36')](_0x3333f4['path'])[_0xa7b1('0x65')]===_0xa7b1('0x38')){originate(_0x46ddb5,_0x62ebba,!![])[_0xa7b1('0x42')](function(_0x4ee80a){_0x4305bd(_0x4ee80a);})[_0xa7b1('0x39')](function(_0x16c682){_0x5afda6(_0x16c682);});}else{originate(_0x46ddb5,_0x62ebba,![])['then'](function(_0x30a03c){_0x4305bd(_0x30a03c);})[_0xa7b1('0x39')](function(_0x484133){_0x5afda6(_0x484133);});}});};Fax[_0xa7b1('0x25')][_0xa7b1('0x66')]=function(_0x5eb4fd){return!_[_0xa7b1('0x67')](_0x5eb4fd)&&!_[_0xa7b1('0x67')](_0x5eb4fd[_0xa7b1('0x21')])&&!_[_0xa7b1('0x67')](_0x5eb4fd[_0xa7b1('0x68')])&&_0x5eb4fd['active']&&!_['isNil'](this[_0xa7b1('0xe')][util[_0xa7b1('0x5d')](_0xa7b1('0x69'),_0x5eb4fd[_0xa7b1('0x21')])])&&!_['isNil'](this[_0xa7b1('0xe')][util[_0xa7b1('0x5d')]('SIP/%s',_0x5eb4fd[_0xa7b1('0x21')])]['status'])&&(this[_0xa7b1('0xe')][util['format']('SIP/%s',_0x5eb4fd[_0xa7b1('0x21')])][_0xa7b1('0x2b')]===_0xa7b1('0x6a')||this['trunks'][util[_0xa7b1('0x5d')](_0xa7b1('0x69'),_0x5eb4fd[_0xa7b1('0x21')])][_0xa7b1('0x2b')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x22b53e,_0x4f1a76){if(!this[_0xa7b1('0x66')](_0x22b53e)){ut[_0xa7b1('0x44')](_0xa7b1('0x6b'),_[_0xa7b1('0x67')](_0x22b53e)?'':_0x22b53e[_0xa7b1('0x21')]+_0xa7b1('0x6c'));return{'isValid':![],'message':_0xa7b1('0x6d')};}if(_[_0xa7b1('0x67')](_0x4f1a76[_0xa7b1('0x6')])){ut['logger'](_0xa7b1('0x6e'),JSON['stringify'](_0x4f1a76));return{'isValid':![],'message':_0xa7b1('0x6f')};}if(_[_0xa7b1('0x67')](_0x4f1a76[_0xa7b1('0x3')])){ut[_0xa7b1('0x44')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x4f1a76));return{'isValid':![],'message':_0xa7b1('0x70')};}return{'isValid':!![],'message':_0xa7b1('0x71')};};module[_0xa7b1('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index c5d085a..c9220d5 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 _0xf07e=['notify','resolve','then','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount','error'];(function(_0xa6eb75,_0x1cb6f3){var _0x563d3f=function(_0x8c3ebb){while(--_0x8c3ebb){_0xa6eb75['push'](_0xa6eb75['shift']());}};_0x563d3f(++_0x1cb6f3);}(_0xf07e,0xfe));var _0xef07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf07e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xef07('0x0'));var BPromise=require(_0xef07('0x1'));var logger=require('../../../config/logger')(_0xef07('0x2'));var _=require(_0xef07('0x3'));var faxAccount=require(_0xef07('0x4'));function loggerCatch(_0x292658){return function(_0x2ad05f){logger[_0xef07('0x5')](_0x292658,util['inspect'](_0x2ad05f,{'showHidden':![],'depth':null}));};}exports[_0xef07('0x6')]=function(_0x466ad6,_0x4667d2){return BPromise[_0xef07('0x7')]()[_0xef07('0x8')](faxAccount[_0xef07('0x6')](_0x466ad6,_0x4667d2))['catch'](loggerCatch(_0xef07('0x9')));}; \ No newline at end of file +var _0x2521=['preview','lodash','notify','resolve','then','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x2521,0x138));var _0x1252=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x2521[_0x102f97];return _0xd22058;};'use strict';var util=require(_0x1252('0x0'));var BPromise=require(_0x1252('0x1'));var logger=require(_0x1252('0x2'))(_0x1252('0x3'));var _=require(_0x1252('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x3fb678){return function(_0x4c4461){logger['error'](_0x3fb678,util['inspect'](_0x4c4461,{'showHidden':![],'depth':null}));};}exports[_0x1252('0x5')]=function(_0x50cd30,_0x179ea6){return BPromise[_0x1252('0x6')]()[_0x1252('0x7')](faxAccount['notify'](_0x50cd30,_0x179ea6))['catch'](loggerCatch(_0x1252('0x8')));}; \ 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 4f4822c..d223568 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 _0x1514=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process'];(function(_0xc3d8e6,_0x1d47f4){var _0x435e05=function(_0x1fef9d){while(--_0x1fef9d){_0xc3d8e6['push'](_0xc3d8e6['shift']());}};_0x435e05(++_0x1d47f4);}(_0x1514,0x11c));var _0x4151=function(_0x3db55b,_0x2096cb){_0x3db55b=_0x3db55b-0x0;var _0x4342b7=_0x1514[_0x3db55b];return _0x4342b7;};'use strict';var util=require(_0x4151('0x0'));var logger=require(_0x4151('0x1'))(_0x4151('0x2'));var BPromise=require('bluebird');var exec=require(_0x4151('0x3'))['exec'];exports[_0x4151('0x4')]=function(_0x3a2f80){return new BPromise(function(_0x529acc,_0x2ddf29){exec(_0x3a2f80,function(_0x16c08a,_0x1309c6,_0x404e59){logger[_0x4151('0x5')]('Exec\x20gs',_0x1309c6);if(_0x16c08a){logger[_0x4151('0x5')](_0x4151('0x6'),_0x4151('0x7'),util[_0x4151('0x8')](_0x16c08a,{'showHidden':![],'depth':null}),_0x1309c6,_0x404e59);_0x2ddf29(_0x16c08a);}_0x529acc(_0x1309c6);});});}; \ No newline at end of file +var _0xd22b=['info','Exec\x20gs','util','fax','child_process','exec','execute'];(function(_0xd8768,_0x3fedcb){var _0x46228f=function(_0x65a836){while(--_0x65a836){_0xd8768['push'](_0xd8768['shift']());}};_0x46228f(++_0x3fedcb);}(_0xd22b,0x113));var _0xbd22=function(_0x5a9319,_0x1e8a58){_0x5a9319=_0x5a9319-0x0;var _0x35f131=_0xd22b[_0x5a9319];return _0x35f131;};'use strict';var util=require(_0xbd22('0x0'));var logger=require('../../../../config/logger')(_0xbd22('0x1'));var BPromise=require('bluebird');var exec=require(_0xbd22('0x2'))[_0xbd22('0x3')];exports[_0xbd22('0x4')]=function(_0x19e131){return new BPromise(function(_0x4027cc,_0x2b7883){exec(_0x19e131,function(_0x2d2146,_0x3ffd81,_0x305730){logger[_0xbd22('0x5')]('Exec\x20gs',_0x3ffd81);if(_0x2d2146){logger[_0xbd22('0x5')](_0xbd22('0x6'),'\x20Error\x20:',util['inspect'](_0x2d2146,{'showHidden':![],'depth':null}),_0x3ffd81,_0x305730);_0x2b7883(_0x2d2146);}_0x4027cc(_0x3ffd81);});});}; \ 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 b8e51c9..ff2efb7 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 _0x1a83=['minrate','\x22%s\x22','gateway','faxdetect','path','variablesAction','uniqueid','originate','from-sip','format','localstationid','util','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo'];(function(_0x4fa1b0,_0x3cafac){var _0x3c2e33=function(_0xee1347){while(--_0xee1347){_0x4fa1b0['push'](_0x4fa1b0['shift']());}};_0x3c2e33(++_0x3cafac);}(_0x1a83,0x1c3));var _0x31a8=function(_0x53a84f,_0x19dd24){_0x53a84f=_0x53a84f-0x0;var _0x4264ab=_0x1a83[_0x53a84f];return _0x4264ab;};'use strict';var util=require(_0x31a8('0x0'));var _=require('lodash');var moment=require(_0x31a8('0x1'));var logger=require(_0x31a8('0x2'))(_0x31a8('0x3'));exports[_0x31a8('0x4')]=function(_0x2d7fee){return{'message':_0x2d7fee};};exports[_0x31a8('0x5')]=function(_0xc5e2b0,_0x51f1aa){logger[_0x31a8('0x6')](_0xc5e2b0,util[_0x31a8('0x7')](_0x51f1aa,{'showHidden':![],'depth':null}));};exports[_0x31a8('0x8')]=function(_0x34ba01,_0x2700fe){var _0x30e4b4={'XMF-ECM':_0x2700fe[_0x31a8('0x9')],'XMF-HEADERINFO':_0x2700fe[_0x31a8('0xa')],'XMF-MINRATE':_0x2700fe[_0x31a8('0xb')],'XMF-MAXRATE':_0x2700fe['maxrate'],'XMF-MODEM':util['format'](_0x31a8('0xc'),_0x2700fe['modem']),'XMF-GATEWAY':_0x2700fe[_0x31a8('0xd')],'XMF-FAXDETECT':_0x2700fe[_0x31a8('0xe')],'XMF-T38TIMEOUT':_0x2700fe['t38timeout'],'XMF-LOCALSTATIONID':_0x2700fe['localstationid'],'XMF-PATH':_0x34ba01[_0x31a8('0xf')]};return _0x30e4b4;};exports[_0x31a8('0x10')]=function(_0x49dbd6,_0x1967a1){return{'actionid':_0x49dbd6[_0x31a8('0x11')],'action':_0x31a8('0x12'),'channel':_0x49dbd6['channel'],'Exten':'xcally-motion-fax','Context':_0x31a8('0x13'),'Priority':'1','callerid':util[_0x31a8('0x14')]('\x22%s\x22\x20<%s>',_0x49dbd6['headerinfo']?_0x49dbd6[_0x31a8('0xa')]:'',_0x49dbd6[_0x31a8('0x15')]),'variable':_0x1967a1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x49dbd6[_0x31a8('0x11')]};}; \ No newline at end of file +var _0xc7a2=['minrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','\x22%s\x22\x20<%s>','headerinfo','util','moment','message','info','inspect','addVariables','ecm'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc7a2,0x1c5));var _0x2c7a=function(_0x2c654f,_0x11ce94){_0x2c654f=_0x2c654f-0x0;var _0xa53d15=_0xc7a2[_0x2c654f];return _0xa53d15;};'use strict';var util=require(_0x2c7a('0x0'));var _=require('lodash');var moment=require(_0x2c7a('0x1'));var logger=require('../../../../config/logger')('fax');exports[_0x2c7a('0x2')]=function(_0x5ec58e){return{'message':_0x5ec58e};};exports['logger']=function(_0xae4fb,_0x5e767c){logger[_0x2c7a('0x3')](_0xae4fb,util[_0x2c7a('0x4')](_0x5e767c,{'showHidden':![],'depth':null}));};exports[_0x2c7a('0x5')]=function(_0x10adbd,_0x1c801e){var _0x48307c={'XMF-ECM':_0x1c801e[_0x2c7a('0x6')],'XMF-HEADERINFO':_0x1c801e['headerinfo'],'XMF-MINRATE':_0x1c801e[_0x2c7a('0x7')],'XMF-MAXRATE':_0x1c801e['maxrate'],'XMF-MODEM':util[_0x2c7a('0x8')](_0x2c7a('0x9'),_0x1c801e['modem']),'XMF-GATEWAY':_0x1c801e[_0x2c7a('0xa')],'XMF-FAXDETECT':_0x1c801e[_0x2c7a('0xb')],'XMF-T38TIMEOUT':_0x1c801e[_0x2c7a('0xc')],'XMF-LOCALSTATIONID':_0x1c801e[_0x2c7a('0xd')],'XMF-PATH':_0x10adbd[_0x2c7a('0xe')]};return _0x48307c;};exports[_0x2c7a('0xf')]=function(_0x1f6685,_0x4d27d8){return{'actionid':_0x1f6685[_0x2c7a('0x10')],'action':_0x2c7a('0x11'),'channel':_0x1f6685['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x2c7a('0x8')](_0x2c7a('0x12'),_0x1f6685[_0x2c7a('0x13')]?_0x1f6685[_0x2c7a('0x13')]:'',_0x1f6685[_0x2c7a('0xd')]),'variable':_0x4d27d8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1f6685[_0x2c7a('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9df5a13..8eeebb0 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 _0xdf1b=['getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./trigger','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','getTelephones','initTelephones'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0xdf1b,0x131));var _0xbdf1=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0xdf1b[_0x202d24];return _0x2b3a8e;};'use strict';var BPromise=require(_0xbdf1('0x0'));var util=require(_0xbdf1('0x1'));var moment=require(_0xbdf1('0x2'));var server=require(_0xbdf1('0x3'));var Realtime=require(_0xbdf1('0x4'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xbdf1('0x5'));var Dialer=require(_0xbdf1('0x6'));var Preview=require(_0xbdf1('0x7'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0xbdf1('0x8'));var voiceQueueReport=require(_0xbdf1('0x9'));var voiceCallReport=require(_0xbdf1('0xa'));var trunk=require(_0xbdf1('0xb'));var trigger=require(_0xbdf1('0xc'));var template=require(_0xbdf1('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xbdf1('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xbdf1('0xf'));var zendesk=require(_0xbdf1('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xbdf1('0x11'));var freshdesk=require(_0xbdf1('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xbdf1('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xbdf1('0x14'));var servicenow=require(_0xbdf1('0x15'));var dynamics365=require(_0xbdf1('0x16'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xbdf1('0x17')](_0xbdf1('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xbdf1('0x17')](_0xbdf1('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xbdf1('0x19')]()[_0xbdf1('0x1a')](user[_0xbdf1('0x1b')]())[_0xbdf1('0x1a')](realtime['initAgents']())[_0xbdf1('0x1a')](user[_0xbdf1('0x1c')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x1d')]())[_0xbdf1('0x1a')](trunk[_0xbdf1('0x1e')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x1f')]())['then'](voiceQueue[_0xbdf1('0x20')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x21')]())[_0xbdf1('0x1a')](trigger[_0xbdf1('0x22')]())['then'](realtime[_0xbdf1('0x23')]())['then'](template[_0xbdf1('0x24')]())['then'](realtime['initTemplates']())[_0xbdf1('0x1a')](zendesk[_0xbdf1('0x25')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x26')]())[_0xbdf1('0x1a')](salesforce[_0xbdf1('0x27')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x28')]())[_0xbdf1('0x1a')](sugarcrm[_0xbdf1('0x29')]())['then'](realtime[_0xbdf1('0x2a')]())[_0xbdf1('0x1a')](freshdesk[_0xbdf1('0x2b')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x2c')]())[_0xbdf1('0x1a')](desk[_0xbdf1('0x2d')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x2e')]())[_0xbdf1('0x1a')](zoho['getZohoAccounts']())[_0xbdf1('0x1a')](realtime['initZohoAccounts']())['then'](vtiger[_0xbdf1('0x2f')]())['then'](realtime[_0xbdf1('0x30')]())[_0xbdf1('0x1a')](freshsales[_0xbdf1('0x31')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x32')]())[_0xbdf1('0x1a')](servicenow['getServicenowAccounts']())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x33')]())[_0xbdf1('0x1a')](dynamics365[_0xbdf1('0x34')]())[_0xbdf1('0x1a')](realtime['initDynamics365Accounts']())[_0xbdf1('0x1a')](campaign['getCampaigns']())['then'](realtime[_0xbdf1('0x35')]())[_0xbdf1('0x1a')](voiceExtension[_0xbdf1('0x36')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x37')]())[_0xbdf1('0x1a')](faxAccount[_0xbdf1('0x38')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x39')]())[_0xbdf1('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0xbdf1('0x19')]()[_0xbdf1('0x1a')](voiceQueueReport[_0xbdf1('0x3a')]())['then'](realtime[_0xbdf1('0x3b')]())[_0xbdf1('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xbdf1('0x3c')]())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x3d')]())[_0xbdf1('0x1a')](voiceCallReport['getVoiceCallReports']())[_0xbdf1('0x1a')](realtime[_0xbdf1('0x3e')]())[_0xbdf1('0x1a')](function(_0x5547f9){})[_0xbdf1('0x3f')](function(_0x2862ac){console[_0xbdf1('0x40')](_0x2862ac);});}function main(){return server[_0xbdf1('0x41')](realtime,preview,fax)['then'](function(_0x5550ff){return initRealtime();})['then'](function(){return initParams();})[_0xbdf1('0x1a')](function(){report[_0xbdf1('0x42')]();setInterval(initRealtime,0x1388);})[_0xbdf1('0x3f')](function(_0x47cf68){console[_0xbdf1('0x40')](_0x47cf68);});}main(); \ No newline at end of file +var _0xc435=['initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','sync','bluebird','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','getAgents','then','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts'];(function(_0x248b16,_0x50d61b){var _0x2fbfe8=function(_0x332262){while(--_0x332262){_0x248b16['push'](_0x248b16['shift']());}};_0x2fbfe8(++_0x50d61b);}(_0xc435,0xd7));var _0x5c43=function(_0x22f724,_0x547ff5){_0x22f724=_0x22f724-0x0;var _0x6a15cb=_0xc435[_0x22f724];return _0x6a15cb;};'use strict';var BPromise=require(_0x5c43('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x5c43('0x1'));var Realtime=require(_0x5c43('0x2'));var Report=require(_0x5c43('0x3'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x5c43('0x4'));var Preview=require(_0x5c43('0x5'));var Fax=require(_0x5c43('0x6'));var user=require(_0x5c43('0x7'));var voiceQueue=require(_0x5c43('0x8'));var voiceQueueReport=require(_0x5c43('0x9'));var voiceCallReport=require(_0x5c43('0xa'));var trunk=require(_0x5c43('0xb'));var trigger=require(_0x5c43('0xc'));var template=require(_0x5c43('0xd'));var cmHopperHistory=require(_0x5c43('0xe'));var campaign=require(_0x5c43('0xf'));var voiceExtension=require(_0x5c43('0x10'));var faxAccount=require(_0x5c43('0x11'));var zendesk=require(_0x5c43('0x12'));var salesforce=require(_0x5c43('0x13'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x5c43('0x14'));var vtiger=require(_0x5c43('0x15'));var freshsales=require(_0x5c43('0x16'));var servicenow=require(_0x5c43('0x17'));var dynamics365=require(_0x5c43('0x18'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5c43('0x19')](_0x5c43('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5c43('0x19')](_0x5c43('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0x5c43('0x1b')]())[_0x5c43('0x1c')](realtime[_0x5c43('0x1d')]())['then'](user[_0x5c43('0x1e')]())[_0x5c43('0x1c')](realtime['initTelephones']())[_0x5c43('0x1c')](trunk[_0x5c43('0x1f')]())['then'](realtime[_0x5c43('0x20')]())[_0x5c43('0x1c')](voiceQueue['getVoiceQueues']())[_0x5c43('0x1c')](realtime[_0x5c43('0x21')]())[_0x5c43('0x1c')](trigger[_0x5c43('0x22')]())[_0x5c43('0x1c')](realtime[_0x5c43('0x23')]())[_0x5c43('0x1c')](template[_0x5c43('0x24')]())[_0x5c43('0x1c')](realtime[_0x5c43('0x25')]())['then'](zendesk[_0x5c43('0x26')]())[_0x5c43('0x1c')](realtime[_0x5c43('0x27')]())['then'](salesforce[_0x5c43('0x28')]())[_0x5c43('0x1c')](realtime['initSalesforceAccounts']())[_0x5c43('0x1c')](sugarcrm[_0x5c43('0x29')]())[_0x5c43('0x1c')](realtime['initSugarcrmAccounts']())[_0x5c43('0x1c')](freshdesk[_0x5c43('0x2a')]())[_0x5c43('0x1c')](realtime[_0x5c43('0x2b')]())[_0x5c43('0x1c')](desk[_0x5c43('0x2c')]())[_0x5c43('0x1c')](realtime[_0x5c43('0x2d')]())[_0x5c43('0x1c')](zoho[_0x5c43('0x2e')]())[_0x5c43('0x1c')](realtime[_0x5c43('0x2f')]())[_0x5c43('0x1c')](vtiger['getVtigerAccounts']())[_0x5c43('0x1c')](realtime[_0x5c43('0x30')]())[_0x5c43('0x1c')](freshsales['getFreshsalesAccounts']())[_0x5c43('0x1c')](realtime[_0x5c43('0x31')]())[_0x5c43('0x1c')](servicenow[_0x5c43('0x32')]())['then'](realtime[_0x5c43('0x33')]())['then'](dynamics365[_0x5c43('0x34')]())['then'](realtime[_0x5c43('0x35')]())['then'](campaign[_0x5c43('0x36')]())['then'](realtime[_0x5c43('0x37')]())[_0x5c43('0x1c')](voiceExtension['getVoiceExtensions']())[_0x5c43('0x1c')](realtime[_0x5c43('0x38')]())[_0x5c43('0x1c')](faxAccount[_0x5c43('0x39')]())['then'](realtime[_0x5c43('0x3a')]())[_0x5c43('0x1c')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x5c43('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x5c43('0x1c')](realtime[_0x5c43('0x3b')]())[_0x5c43('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x5c43('0x3c')]())[_0x5c43('0x1c')](cmHopperHistory[_0x5c43('0x3d')]())[_0x5c43('0x1c')](realtime['initCampaignHopperHistory']())[_0x5c43('0x1c')](voiceCallReport[_0x5c43('0x3e')]())[_0x5c43('0x1c')](realtime[_0x5c43('0x3f')]())['then'](function(_0x41591f){})['catch'](function(_0xb739af){console[_0x5c43('0x40')](_0xb739af);});}function main(){return server[_0x5c43('0x41')](realtime,preview,fax)[_0x5c43('0x1c')](function(_0x56aae3){return initRealtime();})['then'](function(){return initParams();})[_0x5c43('0x1c')](function(){report[_0x5c43('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x403b95){console[_0x5c43('0x40')](_0x403b95);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 66af401..9c2f64e 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x5cd89b,_0x2f9f73){var _0x226c3d=function(_0x7f22d5){while(--_0x7f22d5){_0x5cd89b['push'](_0x5cd89b['shift']());}};_0x226c3d(++_0x2f9f73);}(_0xe706,0xa3));var _0x6e70=function(_0x200703,_0x4cccfd){_0x200703=_0x200703-0x0;var _0x5a32dc=_0xe706[_0x200703];return _0x5a32dc;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x218267,_0x17c7f8){var _0x1d1abd=function(_0x3fd2be){while(--_0x3fd2be){_0x218267['push'](_0x218267['shift']());}};_0x1d1abd(++_0x17c7f8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 0eaa638..e7b6d4b 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 _0x120f=['temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign'];(function(_0x5d7ad5,_0x16f51c){var _0x4892eb=function(_0x13001b){while(--_0x13001b){_0x5d7ad5['push'](_0x5d7ad5['shift']());}};_0x4892eb(++_0x16f51c);}(_0x120f,0x154));var _0xf120=function(_0x2e6939,_0x18d0f5){_0x2e6939=_0x2e6939-0x0;var _0x303fe9=_0x120f[_0x2e6939];return _0x303fe9;};'use strict';function Campaign(_0x1e1f52){this['id']=_0x1e1f52['id']||0x0;this[_0xf120('0x0')]=_0x1e1f52['name']||'';this['type']=_0x1e1f52[_0xf120('0x1')]||_0xf120('0x2');this['originated']=0x0;this[_0xf120('0x3')]=0x0;this[_0xf120('0x4')]=0x0;this[_0xf120('0x5')]=0x0;this['message']='';this[_0xf120('0x6')]=!![];this[_0xf120('0x7')]=_0x1e1f52[_0xf120('0x7')];this[_0xf120('0x8')]=_0x1e1f52[_0xf120('0x8')];this[_0xf120('0x9')]=_0x1e1f52[_0xf120('0x9')]||null;this['dialGlobalInterval']=_0x1e1f52['dialGlobalInterval']?_0x1e1f52['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x1e1f52['dialOriginateCallerIdName'];this[_0xf120('0xa')]=_0x1e1f52['dialOriginateCallerIdNumber'];this[_0xf120('0xb')]=_0x1e1f52['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x1e1f52[_0xf120('0xc')];this[_0xf120('0xd')]=_0x1e1f52[_0xf120('0xd')];this[_0xf120('0xe')]=_0x1e1f52[_0xf120('0xe')];this[_0xf120('0xf')]=_0x1e1f52[_0xf120('0xf')];this['dialNoAnswerMaxRetry']=_0x1e1f52[_0xf120('0x10')];this[_0xf120('0x11')]=_0x1e1f52[_0xf120('0x11')];this[_0xf120('0x12')]=_0x1e1f52['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x1e1f52[_0xf120('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1e1f52[_0xf120('0x14')]||0x96;this[_0xf120('0x15')]=_0x1e1f52[_0xf120('0x15')]||0x3;this[_0xf120('0x16')]=_0x1e1f52['dialDropRetryFrequency']||0x96;this[_0xf120('0x17')]=_0x1e1f52[_0xf120('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x1e1f52[_0xf120('0x18')]||0x96;this[_0xf120('0x19')]=_0x1e1f52['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x1e1f52[_0xf120('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x1e1f52[_0xf120('0x1b')]||0x3;this[_0xf120('0x1c')]=_0x1e1f52[_0xf120('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x1e1f52[_0xf120('0x1d')]||_0xf120('0x1e');this[_0xf120('0x1f')]=_0x1e1f52[_0xf120('0x1f')]||undefined;this[_0xf120('0x20')]=_0x1e1f52['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf120('0x21')]=_0x1e1f52['dialCutDigit']||undefined;this['TrunkBackup']=_0x1e1f52['TrunkBackup']?_0x1e1f52[_0xf120('0x22')]:undefined;this[_0xf120('0x23')]=_0x1e1f52['Trunk']?_0x1e1f52[_0xf120('0x23')]:undefined;this['Interval']=_0x1e1f52[_0xf120('0x24')]?_0x1e1f52[_0xf120('0x24')]:undefined;this[_0xf120('0x25')]=_0x1e1f52['SquareProject']?_0x1e1f52[_0xf120('0x25')]:undefined;this['dialQueueProject']=_0x1e1f52[_0xf120('0x25')]?_0x1e1f52[_0xf120('0x25')][_0xf120('0x0')]:undefined;this[_0xf120('0x26')]=_0x1e1f52[_0xf120('0x26')]||![];this[_0xf120('0x27')]=_0x1e1f52['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1e1f52[_0xf120('0x28')];this[_0xf120('0x29')]=_0x1e1f52['dialAMDAfterGreetingSilence'];this[_0xf120('0x2a')]=_0x1e1f52[_0xf120('0x2a')];this[_0xf120('0x2b')]=_0x1e1f52[_0xf120('0x2b')];this[_0xf120('0x2c')]=_0x1e1f52['dialAMDBetweenWordsSilence'];this[_0xf120('0x2d')]=_0x1e1f52['dialAMDMaximumNumberOfWords'];this[_0xf120('0x2e')]=_0x1e1f52[_0xf120('0x2e')];this['dialAMDMaximumWordLength']=_0x1e1f52[_0xf120('0x2f')];}module[_0xf120('0x30')]=Campaign; \ No newline at end of file +var _0xc386=['name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x2946ba,_0x3256a3){var _0x31458f=function(_0xc47568){while(--_0xc47568){_0x2946ba['push'](_0x2946ba['shift']());}};_0x31458f(++_0x3256a3);}(_0xc386,0xc4));var _0x6c38=function(_0x4c5eff,_0x1a6f74){_0x4c5eff=_0x4c5eff-0x0;var _0x5aa9c7=_0xc386[_0x4c5eff];return _0x5aa9c7;};'use strict';function Campaign(_0x3a9166){this['id']=_0x3a9166['id']||0x0;this[_0x6c38('0x0')]=_0x3a9166['name']||'';this[_0x6c38('0x1')]=_0x3a9166[_0x6c38('0x1')]||_0x6c38('0x2');this[_0x6c38('0x3')]=0x0;this[_0x6c38('0x4')]=0x0;this[_0x6c38('0x5')]=0x0;this[_0x6c38('0x6')]=0x0;this['message']='';this[_0x6c38('0x7')]=!![];this[_0x6c38('0x8')]=_0x3a9166['active'];this[_0x6c38('0x9')]=_0x3a9166[_0x6c38('0x9')];this[_0x6c38('0xa')]=_0x3a9166['dialTimezone']||null;this[_0x6c38('0xb')]=_0x3a9166['dialGlobalInterval']?_0x3a9166[_0x6c38('0xb')]:null;this[_0x6c38('0xc')]=_0x3a9166[_0x6c38('0xc')];this[_0x6c38('0xd')]=_0x3a9166[_0x6c38('0xd')];this[_0x6c38('0xe')]=_0x3a9166[_0x6c38('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x3a9166[_0x6c38('0xf')];this[_0x6c38('0x10')]=_0x3a9166[_0x6c38('0x10')];this[_0x6c38('0x11')]=_0x3a9166[_0x6c38('0x11')];this[_0x6c38('0x12')]=_0x3a9166['dialBusyRetryFrequency'];this[_0x6c38('0x13')]=_0x3a9166['dialNoAnswerMaxRetry'];this[_0x6c38('0x14')]=_0x3a9166[_0x6c38('0x14')];this[_0x6c38('0x15')]=_0x3a9166[_0x6c38('0x15')];this[_0x6c38('0x16')]=_0x3a9166[_0x6c38('0x16')]||0x3;this[_0x6c38('0x17')]=_0x3a9166[_0x6c38('0x17')]||0x96;this[_0x6c38('0x18')]=_0x3a9166['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x3a9166['dialDropRetryFrequency']||0x96;this[_0x6c38('0x19')]=_0x3a9166['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x3a9166[_0x6c38('0x1a')]||0x96;this[_0x6c38('0x1b')]=_0x3a9166[_0x6c38('0x1b')]||0x3;this[_0x6c38('0x1c')]=_0x3a9166[_0x6c38('0x1c')]||0x96;this[_0x6c38('0x1d')]=_0x3a9166[_0x6c38('0x1d')]||0x3;this[_0x6c38('0x1e')]=_0x3a9166['dialAgentRejectRetryFrequency']||0x96;this[_0x6c38('0x1f')]=_0x3a9166[_0x6c38('0x1f')]||_0x6c38('0x20');this[_0x6c38('0x21')]=_0x3a9166[_0x6c38('0x21')]||undefined;this[_0x6c38('0x22')]=_0x3a9166['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6c38('0x23')]=_0x3a9166[_0x6c38('0x23')]||undefined;this['TrunkBackup']=_0x3a9166['TrunkBackup']?_0x3a9166[_0x6c38('0x24')]:undefined;this['Trunk']=_0x3a9166[_0x6c38('0x25')]?_0x3a9166[_0x6c38('0x25')]:undefined;this[_0x6c38('0x26')]=_0x3a9166['Interval']?_0x3a9166[_0x6c38('0x26')]:undefined;this[_0x6c38('0x27')]=_0x3a9166[_0x6c38('0x27')]?_0x3a9166[_0x6c38('0x27')]:undefined;this[_0x6c38('0x28')]=_0x3a9166[_0x6c38('0x27')]?_0x3a9166['SquareProject'][_0x6c38('0x0')]:undefined;this[_0x6c38('0x29')]=_0x3a9166[_0x6c38('0x29')]||![];this['dialAMDInitialSilence']=_0x3a9166['dialAMDInitialSilence'];this[_0x6c38('0x2a')]=_0x3a9166[_0x6c38('0x2a')];this[_0x6c38('0x2b')]=_0x3a9166[_0x6c38('0x2b')];this['dialAMDTotalAnalysisTime']=_0x3a9166['dialAMDTotalAnalysisTime'];this[_0x6c38('0x2c')]=_0x3a9166[_0x6c38('0x2c')];this[_0x6c38('0x2d')]=_0x3a9166['dialAMDBetweenWordsSilence'];this[_0x6c38('0x2e')]=_0x3a9166[_0x6c38('0x2e')];this['dialAMDSilenceThreshold']=_0x3a9166[_0x6c38('0x2f')];this[_0x6c38('0x30')]=_0x3a9166[_0x6c38('0x30')];}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 91a4eef..86065a2 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 _0x7e56=['channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','exten','answered','endtime','abandoned','duration','billableseconds','holdtime','type','tag','disposition','queue','monitors','transferType','mohtime','starttime'];(function(_0x17d225,_0xf71d22){var _0xd866ac=function(_0x2e4a91){while(--_0x2e4a91){_0x17d225['push'](_0x17d225['shift']());}};_0xd866ac(++_0xf71d22);}(_0x7e56,0x107));var _0x67e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e56[_0x14add3];return _0x4a174f;};'use strict';function Channel(){this[_0x67e5('0x0')]=null;this[_0x67e5('0x1')]='';this[_0x67e5('0x2')]='';this['calleridnum']=0x0;this[_0x67e5('0x3')]='';this[_0x67e5('0x4')]=undefined;this[_0x67e5('0x5')]=undefined;this[_0x67e5('0x6')]=0x0;this[_0x67e5('0x7')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x67e5('0x8')]=0x0;this[_0x67e5('0x9')]=![];this['answertime']=null;this[_0x67e5('0xa')]=null;this['unmanaged']=![];this[_0x67e5('0xb')]=![];this['lastapplication']='';this['lastdata']='';this[_0x67e5('0xc')]=0x0;this[_0x67e5('0xd')]=0x0;this[_0x67e5('0xe')]=0x0;this[_0x67e5('0xf')]=null;this[_0x67e5('0x10')]=null;this[_0x67e5('0x11')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x67e5('0x12')]=null;this[_0x67e5('0x13')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x67e5('0x14')]=undefined;this[_0x67e5('0x15')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x3ef1=['lastapplication','duration','holdtime','type','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferType','mohtime','exports','starttime','channel','calleridname','connectedlinename','accountcode','uniqueid','answertime','unmanaged'];(function(_0x50eed4,_0x57242b){var _0x48fd03=function(_0x28a771){while(--_0x28a771){_0x50eed4['push'](_0x50eed4['shift']());}};_0x48fd03(++_0x57242b);}(_0x3ef1,0x187));var _0x13ef=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3ef1[_0x167cc1];return _0x10bc4b;};'use strict';function Channel(){this[_0x13ef('0x0')]=null;this[_0x13ef('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0x13ef('0x2')]='';this['connectedlinenum']=undefined;this[_0x13ef('0x3')]=undefined;this[_0x13ef('0x4')]=0x0;this['context']='';this[_0x13ef('0x5')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this['answered']=![];this[_0x13ef('0x6')]=null;this['endtime']=null;this[_0x13ef('0x7')]=![];this['abandoned']=![];this[_0x13ef('0x8')]='';this['lastdata']='';this[_0x13ef('0x9')]=0x0;this['billableseconds']=0x0;this[_0x13ef('0xa')]=0x0;this[_0x13ef('0xb')]=null;this[_0x13ef('0xc')]=null;this[_0x13ef('0xd')]=null;this[_0x13ef('0xe')]=![];this[_0x13ef('0xf')]=null;this[_0x13ef('0x10')]=null;this['monitors']=[];this[_0x13ef('0x11')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x13ef('0x12')]=undefined;this[_0x13ef('0x13')]=0x0;}module[_0x13ef('0x14')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index f7756da..bdb5f50 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 _0x9e18=['exports','name','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x1fd7c2,_0x17d9d8){var _0xd431cc=function(_0x3bfebe){while(--_0x3bfebe){_0x1fd7c2['push'](_0x1fd7c2['shift']());}};_0xd431cc(++_0x17d9d8);}(_0x9e18,0x115));var _0x89e1=function(_0x435ce7,_0x5bf1ef){_0x435ce7=_0x435ce7-0x0;var _0x47edc0=_0x9e18[_0x435ce7];return _0x47edc0;};'use strict';function DeskAccount(_0x2fcae0){this['id']=_0x2fcae0['id']||0x0;this[_0x89e1('0x0')]=_0x2fcae0[_0x89e1('0x0')]||'';this[_0x89e1('0x1')]=_0x2fcae0['username']||'';this[_0x89e1('0x2')]=_0x2fcae0[_0x89e1('0x2')]||'';this['authType']=_0x2fcae0['authType']||'';this[_0x89e1('0x3')]=_0x2fcae0[_0x89e1('0x3')]||'';this[_0x89e1('0x4')]=_0x2fcae0[_0x89e1('0x4')]||'';this[_0x89e1('0x5')]=_0x2fcae0['consumerSecret']||'';this[_0x89e1('0x6')]=_0x2fcae0[_0x89e1('0x6')]||'';this[_0x89e1('0x7')]=_0x2fcae0[_0x89e1('0x7')]||'';this[_0x89e1('0x8')]=_0x2fcae0[_0x89e1('0x8')]||'';this[_0x89e1('0x9')]=_0x2fcae0[_0x89e1('0x9')]||'';this[_0x89e1('0xa')]=_0x2fcae0['Configurations']||{};}module[_0x89e1('0xb')]=DeskAccount; \ No newline at end of file +var _0x6fb2=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x3d2c73,_0x431958){var _0xb7712f=function(_0x56ec21){while(--_0x56ec21){_0x3d2c73['push'](_0x3d2c73['shift']());}};_0xb7712f(++_0x431958);}(_0x6fb2,0x163));var _0x26fb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6fb2[_0x501510];return _0x1e6ee5;};'use strict';function DeskAccount(_0x297ed1){this['id']=_0x297ed1['id']||0x0;this[_0x26fb('0x0')]=_0x297ed1['name']||'';this['username']=_0x297ed1[_0x26fb('0x1')]||'';this['remoteUri']=_0x297ed1[_0x26fb('0x2')]||'';this['authType']=_0x297ed1[_0x26fb('0x3')]||'';this[_0x26fb('0x4')]=_0x297ed1[_0x26fb('0x4')]||'';this[_0x26fb('0x5')]=_0x297ed1[_0x26fb('0x5')]||'';this['consumerSecret']=_0x297ed1[_0x26fb('0x6')]||'';this[_0x26fb('0x7')]=_0x297ed1[_0x26fb('0x7')]||'';this[_0x26fb('0x8')]=_0x297ed1[_0x26fb('0x8')]||'';this[_0x26fb('0x9')]=_0x297ed1[_0x26fb('0x9')]||'';this['serverUrl']=_0x297ed1[_0x26fb('0xa')]||'';this[_0x26fb('0xb')]=_0x297ed1[_0x26fb('0xb')]||{};}module[_0x26fb('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 748cb1f..1c330bf 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 _0x5ff3=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x13e55f,_0x34fb6c){var _0x32e1a7=function(_0x3deddb){while(--_0x3deddb){_0x13e55f['push'](_0x13e55f['shift']());}};_0x32e1a7(++_0x34fb6c);}(_0x5ff3,0x17d));var _0x35ff=function(_0x2aaf12,_0x3b287a){_0x2aaf12=_0x2aaf12-0x0;var _0x205ca7=_0x5ff3[_0x2aaf12];return _0x205ca7;};'use strict';function Dynamics365Account(_0x2fc021){this['id']=_0x2fc021['id']||0x0;this[_0x35ff('0x0')]=_0x2fc021['name']||'';this[_0x35ff('0x1')]=_0x2fc021['username']||'';this[_0x35ff('0x2')]=_0x2fc021[_0x35ff('0x2')]||'';this[_0x35ff('0x3')]=_0x2fc021[_0x35ff('0x3')]||'';this['tenantId']=_0x2fc021[_0x35ff('0x4')]||'';this[_0x35ff('0x5')]=_0x2fc021[_0x35ff('0x5')]||'';this[_0x35ff('0x6')]=_0x2fc021[_0x35ff('0x6')]||{};this['serverUrl']=_0x2fc021[_0x35ff('0x7')]||'';this['Configurations']=_0x2fc021[_0x35ff('0x8')]||{};}module[_0x35ff('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xb58b=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x1c3073,_0x1bfa1e){var _0x3cb69c=function(_0x2c1851){while(--_0x2c1851){_0x1c3073['push'](_0x1c3073['shift']());}};_0x3cb69c(++_0x1bfa1e);}(_0xb58b,0x1f1));var _0xbb58=function(_0x1787fd,_0xf44dec){_0x1787fd=_0x1787fd-0x0;var _0xbf4c6=_0xb58b[_0x1787fd];return _0xbf4c6;};'use strict';function Dynamics365Account(_0x250573){this['id']=_0x250573['id']||0x0;this[_0xbb58('0x0')]=_0x250573[_0xbb58('0x0')]||'';this[_0xbb58('0x1')]=_0x250573['username']||'';this[_0xbb58('0x2')]=_0x250573[_0xbb58('0x2')]||'';this['remoteUri']=_0x250573[_0xbb58('0x3')]||'';this['tenantId']=_0x250573[_0xbb58('0x4')]||'';this[_0xbb58('0x5')]=_0x250573[_0xbb58('0x5')]||'';this['clientSecret']=_0x250573[_0xbb58('0x6')]||{};this[_0xbb58('0x7')]=_0x250573[_0xbb58('0x7')]||'';this[_0xbb58('0x8')]=_0x250573[_0xbb58('0x8')]||{};}module[_0xbb58('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index e1cf194..47d834e 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 _0xf30f=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','headerinfo','localstationid','minrate','maxrate'];(function(_0x494fa9,_0x2c2156){var _0x38c8d4=function(_0xafcbe3){while(--_0xafcbe3){_0x494fa9['push'](_0x494fa9['shift']());}};_0x38c8d4(++_0x2c2156);}(_0xf30f,0x82));var _0xff30=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf30f[_0x3bf83f];return _0x22c4a9;};'use strict';function FaxAccount(_0x857f6){this['id']=_0x857f6['id']||0x0;this['name']=_0x857f6[_0xff30('0x0')]||'';this['description']=_0x857f6[_0xff30('0x1')];this['ecm']=_0x857f6['ecm'];this[_0xff30('0x2')]=_0x857f6[_0xff30('0x2')];this[_0xff30('0x3')]=_0x857f6['localstationid'];this['minrate']=_0x857f6[_0xff30('0x4')]||0x960;this[_0xff30('0x5')]=_0x857f6[_0xff30('0x5')]||0x3840;this[_0xff30('0x6')]=_0x857f6[_0xff30('0x6')]||_0xff30('0x7');this[_0xff30('0x8')]=_0x857f6[_0xff30('0x8')]||'no';this[_0xff30('0x9')]=_0x857f6[_0xff30('0x9')]||'no';this[_0xff30('0xa')]=_0x857f6[_0xff30('0xa')]||0x1388;this[_0xff30('0xb')]=_0x857f6[_0xff30('0xb')]||_0xff30('0xc');this[_0xff30('0xd')]=_0x857f6['Trunk']?_0x857f6[_0xff30('0xd')]:undefined;this[_0xff30('0xe')]=_0x857f6['ListId'];this[_0xff30('0xf')]=_0x857f6[_0xff30('0xf')];}module[_0xff30('0x10')]=FaxAccount; \ No newline at end of file +var _0x5e58=['exports','name','description','ecm','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x1d20e5,_0x3d4f74){var _0x14c8d3=function(_0x368a35){while(--_0x368a35){_0x1d20e5['push'](_0x1d20e5['shift']());}};_0x14c8d3(++_0x3d4f74);}(_0x5e58,0x6a));var _0x85e5=function(_0x5276f1,_0x1fcf3f){_0x5276f1=_0x5276f1-0x0;var _0xa2d451=_0x5e58[_0x5276f1];return _0xa2d451;};'use strict';function FaxAccount(_0x103a59){this['id']=_0x103a59['id']||0x0;this[_0x85e5('0x0')]=_0x103a59[_0x85e5('0x0')]||'';this[_0x85e5('0x1')]=_0x103a59[_0x85e5('0x1')];this[_0x85e5('0x2')]=_0x103a59[_0x85e5('0x2')];this['headerinfo']=_0x103a59['headerinfo'];this['localstationid']=_0x103a59[_0x85e5('0x3')];this[_0x85e5('0x4')]=_0x103a59[_0x85e5('0x4')]||0x960;this[_0x85e5('0x5')]=_0x103a59[_0x85e5('0x5')]||0x3840;this[_0x85e5('0x6')]=_0x103a59['modem']||'v17,v27,v29';this['gateway']=_0x103a59[_0x85e5('0x7')]||'no';this[_0x85e5('0x8')]=_0x103a59[_0x85e5('0x8')]||'no';this[_0x85e5('0x9')]=_0x103a59[_0x85e5('0x9')]||0x1388;this['tech']=_0x103a59[_0x85e5('0xa')]||_0x85e5('0xb');this[_0x85e5('0xc')]=_0x103a59['Trunk']?_0x103a59[_0x85e5('0xc')]:undefined;this[_0x85e5('0xd')]=_0x103a59[_0x85e5('0xd')];this['key']=_0x103a59['key'];}module[_0x85e5('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 464bf39..414f5c5 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 _0xca10=['apiKey','token','serverUrl','name','username'];(function(_0x2d8da7,_0x5253f3){var _0x340b9c=function(_0x219c6b){while(--_0x219c6b){_0x2d8da7['push'](_0x2d8da7['shift']());}};_0x340b9c(++_0x5253f3);}(_0xca10,0x11b));var _0x0ca1=function(_0x44e991,_0x47f5c9){_0x44e991=_0x44e991-0x0;var _0x58db8d=_0xca10[_0x44e991];return _0x58db8d;};'use strict';function FreshdeskAccount(_0x19787c){this['id']=_0x19787c['id']||0x0;this[_0x0ca1('0x0')]=_0x19787c[_0x0ca1('0x0')]||'';this[_0x0ca1('0x1')]=_0x19787c[_0x0ca1('0x1')]||'';this[_0x0ca1('0x2')]=_0x19787c[_0x0ca1('0x3')]||'';this['remoteUri']=_0x19787c['remoteUri']||'';this[_0x0ca1('0x4')]=_0x19787c[_0x0ca1('0x4')]||'';this['Configurations']=_0x19787c['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xffbc=['exports','username','token','remoteUri','serverUrl','Configurations'];(function(_0x357979,_0x56feef){var _0xabb42f=function(_0x447f9d){while(--_0x447f9d){_0x357979['push'](_0x357979['shift']());}};_0xabb42f(++_0x56feef);}(_0xffbc,0x16f));var _0xcffb=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xffbc[_0x55e08b];return _0xd1a7ff;};'use strict';function FreshdeskAccount(_0x15adb0){this['id']=_0x15adb0['id']||0x0;this['name']=_0x15adb0['name']||'';this[_0xcffb('0x0')]=_0x15adb0[_0xcffb('0x0')]||'';this['apiKey']=_0x15adb0[_0xcffb('0x1')]||'';this[_0xcffb('0x2')]=_0x15adb0[_0xcffb('0x2')]||'';this[_0xcffb('0x3')]=_0x15adb0['serverUrl']||'';this[_0xcffb('0x4')]=_0x15adb0['Configurations']||{};}module[_0xcffb('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 29756c1..0a59a24 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 _0xf52f=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x2c1116,_0x3c5c19){var _0x3248d3=function(_0x101a64){while(--_0x101a64){_0x2c1116['push'](_0x2c1116['shift']());}};_0x3248d3(++_0x3c5c19);}(_0xf52f,0x113));var _0xff52=function(_0x8ae747,_0x135483){_0x8ae747=_0x8ae747-0x0;var _0x16d68b=_0xf52f[_0x8ae747];return _0x16d68b;};'use strict';function FreshsalesAccount(_0x15cdf1){this['id']=_0x15cdf1['id']||0x0;this[_0xff52('0x0')]=_0x15cdf1[_0xff52('0x0')]||'';this['username']=_0x15cdf1[_0xff52('0x1')]||'';this[_0xff52('0x2')]=_0x15cdf1[_0xff52('0x3')]||'';this['remoteUri']=_0x15cdf1[_0xff52('0x4')]||'';this[_0xff52('0x5')]=_0x15cdf1['serverUrl']||'';this[_0xff52('0x6')]=_0x15cdf1[_0xff52('0x6')]||{};}module[_0xff52('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x2123=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x4f5ef9,_0x2eaea0){var _0x4e43c1=function(_0x5845ca){while(--_0x5845ca){_0x4f5ef9['push'](_0x4f5ef9['shift']());}};_0x4e43c1(++_0x2eaea0);}(_0x2123,0x190));var _0x3212=function(_0x424116,_0x502c85){_0x424116=_0x424116-0x0;var _0x5408c8=_0x2123[_0x424116];return _0x5408c8;};'use strict';function FreshsalesAccount(_0x4a2fc9){this['id']=_0x4a2fc9['id']||0x0;this[_0x3212('0x0')]=_0x4a2fc9[_0x3212('0x0')]||'';this[_0x3212('0x1')]=_0x4a2fc9[_0x3212('0x1')]||'';this[_0x3212('0x2')]=_0x4a2fc9[_0x3212('0x3')]||'';this[_0x3212('0x4')]=_0x4a2fc9[_0x3212('0x4')]||'';this[_0x3212('0x5')]=_0x4a2fc9[_0x3212('0x5')]||'';this[_0x3212('0x6')]=_0x4a2fc9['Configurations']||{};}module[_0x3212('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 912012f..a9f0eb0 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 _0xc80d=['queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x175249,_0x21e5f5){var _0x6d22e8=function(_0x141fc1){while(--_0x141fc1){_0x175249['push'](_0x175249['shift']());}};_0x6d22e8(++_0x21e5f5);}(_0xc80d,0x121));var _0xdc80=function(_0xc8149,_0x3d77a0){_0xc8149=_0xc8149-0x0;var _0x2b0aa4=_0xc80d[_0xc8149];return _0x2b0aa4;};'use strict';function QueueReport(){this['type']=_0xdc80('0x0');this[_0xdc80('0x1')]='';this[_0xdc80('0x2')]='';this[_0xdc80('0x3')]='';this[_0xdc80('0x4')]='';this['queuecallerjoinAt']=null;this[_0xdc80('0x5')]=null;this[_0xdc80('0x6')]=0x1;this['count']=0x1;this[_0xdc80('0x7')]=![];this[_0xdc80('0x8')]=null;this[_0xdc80('0x9')]=![];this[_0xdc80('0xa')]=null;this[_0xdc80('0xb')]=![];this[_0xdc80('0xc')]=null;this[_0xdc80('0xd')]=0x1;this[_0xdc80('0xe')]='';this[_0xdc80('0xf')]='';this['connectedlinename']='';this['accountcode']='';this[_0xdc80('0x10')]='';this[_0xdc80('0x11')]='';this[_0xdc80('0x12')]='';this[_0xdc80('0x13')]=0x0;this[_0xdc80('0x14')]=![];this[_0xdc80('0x15')]='';this[_0xdc80('0x16')]=0x0;this[_0xdc80('0x17')]={};}module[_0xdc80('0x18')]=QueueReport; \ No newline at end of file +var _0xbca0=['count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position'];(function(_0x3b223c,_0x31f0a3){var _0x1aed3c=function(_0x19e840){while(--_0x19e840){_0x3b223c['push'](_0x3b223c['shift']());}};_0x1aed3c(++_0x31f0a3);}(_0xbca0,0x132));var _0x0bca=function(_0x15f174,_0x1e35fb){_0x15f174=_0x15f174-0x0;var _0x585e95=_0xbca0[_0x15f174];return _0x585e95;};'use strict';function QueueReport(){this['type']='inbound';this[_0x0bca('0x0')]='';this[_0x0bca('0x1')]='';this['calleridname']='';this[_0x0bca('0x2')]='';this[_0x0bca('0x3')]=null;this[_0x0bca('0x4')]=null;this[_0x0bca('0x5')]=0x1;this[_0x0bca('0x6')]=0x1;this[_0x0bca('0x7')]=![];this[_0x0bca('0x8')]=null;this[_0x0bca('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x0bca('0xa')]=null;this[_0x0bca('0xb')]=0x1;this[_0x0bca('0xc')]='';this[_0x0bca('0xd')]='';this[_0x0bca('0xe')]='';this[_0x0bca('0xf')]='';this[_0x0bca('0x10')]='';this[_0x0bca('0x11')]='';this[_0x0bca('0x12')]='';this[_0x0bca('0x13')]=0x0;this[_0x0bca('0x14')]=![];this[_0x0bca('0x15')]='';this[_0x0bca('0x16')]=0x0;this['variables']={};}module[_0x0bca('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 043331b..6d73f52 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 _0xfe89=['serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0xa85dbd,_0x2838a5){var _0x3be7aa=function(_0x2573f8){while(--_0x2573f8){_0xa85dbd['push'](_0xa85dbd['shift']());}};_0x3be7aa(++_0x2838a5);}(_0xfe89,0x12b));var _0x9fe8=function(_0x2cc3ca,_0xf40fd9){_0x2cc3ca=_0x2cc3ca-0x0;var _0x31b90a=_0xfe89[_0x2cc3ca];return _0x31b90a;};'use strict';function SalesforceAccount(_0x4e86a4){this['id']=_0x4e86a4['id']||0x0;this[_0x9fe8('0x0')]=_0x4e86a4[_0x9fe8('0x0')]||'';this[_0x9fe8('0x1')]=_0x4e86a4[_0x9fe8('0x1')]||'';this['remoteUri']=_0x4e86a4[_0x9fe8('0x2')]||'';this['password']=_0x4e86a4[_0x9fe8('0x3')]||'';this[_0x9fe8('0x4')]=_0x4e86a4[_0x9fe8('0x4')]||'';this[_0x9fe8('0x5')]=_0x4e86a4[_0x9fe8('0x5')]||'';this[_0x9fe8('0x6')]=_0x4e86a4[_0x9fe8('0x6')]||'';this[_0x9fe8('0x7')]=_0x4e86a4[_0x9fe8('0x7')]||_0x9fe8('0x8');this['serverUrl']=_0x4e86a4[_0x9fe8('0x9')]||'';this[_0x9fe8('0xa')]=_0x4e86a4['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x9beb=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x1cac92,_0x39fce7){var _0x2a82e1=function(_0x1f65eb){while(--_0x1f65eb){_0x1cac92['push'](_0x1cac92['shift']());}};_0x2a82e1(++_0x39fce7);}(_0x9beb,0x151));var _0xb9be=function(_0x6c4231,_0x4a471e){_0x6c4231=_0x6c4231-0x0;var _0x52de9a=_0x9beb[_0x6c4231];return _0x52de9a;};'use strict';function SalesforceAccount(_0x15d8c7){this['id']=_0x15d8c7['id']||0x0;this[_0xb9be('0x0')]=_0x15d8c7[_0xb9be('0x0')]||'';this[_0xb9be('0x1')]=_0x15d8c7[_0xb9be('0x1')]||'';this[_0xb9be('0x2')]=_0x15d8c7['remoteUri']||'';this[_0xb9be('0x3')]=_0x15d8c7['password']||'';this[_0xb9be('0x4')]=_0x15d8c7[_0xb9be('0x4')]||'';this['clientSecret']=_0x15d8c7[_0xb9be('0x5')]||'';this[_0xb9be('0x6')]=_0x15d8c7[_0xb9be('0x6')]||'';this['type']=_0x15d8c7[_0xb9be('0x7')]||_0xb9be('0x8');this[_0xb9be('0x9')]=_0x15d8c7[_0xb9be('0x9')]||'';this['Configurations']=_0x15d8c7[_0xb9be('0xa')]||{};}module[_0xb9be('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 61a25b7..9bda834 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 _0xd0fc=['exports','name','username','password','remoteUri','Configurations'];(function(_0x4da913,_0x41e07f){var _0x5e502b=function(_0xf6fc74){while(--_0xf6fc74){_0x4da913['push'](_0x4da913['shift']());}};_0x5e502b(++_0x41e07f);}(_0xd0fc,0x109));var _0xcd0f=function(_0x228df6,_0x11811d){_0x228df6=_0x228df6-0x0;var _0x4aa13e=_0xd0fc[_0x228df6];return _0x4aa13e;};'use strict';function ServicenowAccount(_0x39e3f3){this['id']=_0x39e3f3['id']||0x0;this[_0xcd0f('0x0')]=_0x39e3f3[_0xcd0f('0x0')]||'';this[_0xcd0f('0x1')]=_0x39e3f3[_0xcd0f('0x1')]||'';this[_0xcd0f('0x2')]=_0x39e3f3[_0xcd0f('0x2')]||'';this[_0xcd0f('0x3')]=_0x39e3f3['remoteUri']||'';this['serverUrl']=_0x39e3f3['serverUrl']||'';this[_0xcd0f('0x4')]=_0x39e3f3[_0xcd0f('0x4')]||{};}module[_0xcd0f('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x14cd=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x14cd,0x1b4));var _0xd14c=function(_0x44d3a1,_0x36fc67){_0x44d3a1=_0x44d3a1-0x0;var _0x1e9dd2=_0x14cd[_0x44d3a1];return _0x1e9dd2;};'use strict';function ServicenowAccount(_0x2746d6){this['id']=_0x2746d6['id']||0x0;this['name']=_0x2746d6[_0xd14c('0x0')]||'';this[_0xd14c('0x1')]=_0x2746d6[_0xd14c('0x1')]||'';this[_0xd14c('0x2')]=_0x2746d6[_0xd14c('0x2')]||'';this[_0xd14c('0x3')]=_0x2746d6['remoteUri']||'';this['serverUrl']=_0x2746d6[_0xd14c('0x4')]||'';this[_0xd14c('0x5')]=_0x2746d6[_0xd14c('0x5')]||{};}module[_0xd14c('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 44e9a1d..dcfc24f 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 _0x14ec=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4dfce7,_0x3a358a){var _0x1bce36=function(_0x1a31aa){while(--_0x1a31aa){_0x4dfce7['push'](_0x4dfce7['shift']());}};_0x1bce36(++_0x3a358a);}(_0x14ec,0xa7));var _0xc14e=function(_0x2aebac,_0x237c41){_0x2aebac=_0x2aebac-0x0;var _0x217c96=_0x14ec[_0x2aebac];return _0x217c96;};'use strict';function SugarcrmAccount(_0x151f61){this['id']=_0x151f61['id']||0x0;this[_0xc14e('0x0')]=_0x151f61['name']||'';this[_0xc14e('0x1')]=_0x151f61[_0xc14e('0x1')]||'';this['password']=_0x151f61[_0xc14e('0x2')]||'';this[_0xc14e('0x3')]=_0x151f61[_0xc14e('0x3')]||'';this[_0xc14e('0x4')]=_0x151f61[_0xc14e('0x4')]||'';this[_0xc14e('0x5')]=_0x151f61[_0xc14e('0x5')]||{};}module[_0xc14e('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x973b=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x577211,_0x842174){var _0x48d24d=function(_0x1dec20){while(--_0x1dec20){_0x577211['push'](_0x577211['shift']());}};_0x48d24d(++_0x842174);}(_0x973b,0xb9));var _0xb973=function(_0x3267d3,_0x85822e){_0x3267d3=_0x3267d3-0x0;var _0x1f5b99=_0x973b[_0x3267d3];return _0x1f5b99;};'use strict';function SugarcrmAccount(_0x5c899f){this['id']=_0x5c899f['id']||0x0;this[_0xb973('0x0')]=_0x5c899f[_0xb973('0x0')]||'';this[_0xb973('0x1')]=_0x5c899f['username']||'';this[_0xb973('0x2')]=_0x5c899f[_0xb973('0x2')]||'';this[_0xb973('0x3')]=_0x5c899f[_0xb973('0x3')]||'';this[_0xb973('0x4')]=_0x5c899f[_0xb973('0x4')]||'';this[_0xb973('0x5')]=_0x5c899f['Configurations']||{};}module[_0xb973('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 d8b131e..84a1056 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 _0x0796=['address','name','accountcode','unknown','stateTime','status'];(function(_0x12aa87,_0x25ffe1){var _0x36d97f=function(_0x385f27){while(--_0x385f27){_0x12aa87['push'](_0x12aa87['shift']());}};_0x36d97f(++_0x25ffe1);}(_0x0796,0x12d));var _0x6079=function(_0x45d7c4,_0x2adcaf){_0x45d7c4=_0x45d7c4-0x0;var _0x2d48e0=_0x0796[_0x45d7c4];return _0x2d48e0;};'use strict';function Telephone(_0x2e6dd4){this['id']=_0x2e6dd4['id']||0x0;this[_0x6079('0x0')]=_0x2e6dd4[_0x6079('0x0')]||'';this[_0x6079('0x1')]=_0x2e6dd4[_0x6079('0x1')]||'';this['state']=_0x6079('0x2');this[_0x6079('0x3')]=0x0;this[_0x6079('0x4')]=_0x6079('0x2');this[_0x6079('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x48cb=['accountcode','state','unknown','stateTime','status','address','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48cb,0x16f));var _0xb48c=function(_0xe9c770,_0x4f76c4){_0xe9c770=_0xe9c770-0x0;var _0x48f174=_0x48cb[_0xe9c770];return _0x48f174;};'use strict';function Telephone(_0x43c47b){this['id']=_0x43c47b['id']||0x0;this[_0xb48c('0x0')]=_0x43c47b[_0xb48c('0x0')]||'';this[_0xb48c('0x1')]=_0x43c47b['accountcode']||'';this[_0xb48c('0x2')]=_0xb48c('0x3');this[_0xb48c('0x4')]=0x0;this[_0xb48c('0x5')]=_0xb48c('0x3');this[_0xb48c('0x6')]='';}module[_0xb48c('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 4245682..ed6dee1 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 _0xa9e0=['exports','name'];(function(_0x51a5b4,_0x1c7da7){var _0x13ba07=function(_0x308993){while(--_0x308993){_0x51a5b4['push'](_0x51a5b4['shift']());}};_0x13ba07(++_0x1c7da7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 +var _0xb10b=['name','html'];(function(_0x59a9cd,_0xf0ab10){var _0x19b8da=function(_0x293ce7){while(--_0x293ce7){_0x59a9cd['push'](_0x59a9cd['shift']());}};_0x19b8da(++_0xf0ab10);}(_0xb10b,0x12a));var _0xbb10=function(_0x437472,_0x31db2d){_0x437472=_0x437472-0x0;var _0x217fce=_0xb10b[_0x437472];return _0x217fce;};'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 diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 422ca92..b49a505 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x3f6b67,_0x2736d1){var _0x3d2b4c=function(_0x402dd4){while(--_0x402dd4){_0x3f6b67['push'](_0x3f6b67['shift']());}};_0x3d2b4c(++_0x2736d1);}(_0x4fc2,0x111));var _0x24fc=function(_0x59e1b8,_0x3906af){_0x59e1b8=_0x59e1b8-0x0;var _0xdcbac8=_0x4fc2[_0x59e1b8];return _0xdcbac8;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x3dbb0c,_0x437ac4){var _0x5134b1=function(_0x24a10b){while(--_0x24a10b){_0x3dbb0c['push'](_0x3dbb0c['shift']());}};_0x5134b1(++_0x437ac4);}(_0xb10b,0x12a));var _0xbb10=function(_0x4caade,_0x549ce1){_0x4caade=_0x4caade-0x0;var _0x2041ff=_0xb10b[_0x4caade];return _0x2041ff;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 08d8825..64b4bcf 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 _0xa63f=['defaultuser','active','state','unknown','stateTime','status','registry','split','host','domain','stateRegistry','registrationtime','address'];(function(_0x78007f,_0x45269b){var _0x1cb2ee=function(_0x16a7ee){while(--_0x16a7ee){_0x78007f['push'](_0x78007f['shift']());}};_0x1cb2ee(++_0x45269b);}(_0xa63f,0x1ef));var _0xfa63=function(_0x16bd44,_0x3c91ba){_0x16bd44=_0x16bd44-0x0;var _0x368a61=_0xa63f[_0x16bd44];return _0x368a61;};'use strict';function Trunk(_0x5b3977){this['id']=_0x5b3977['id']||0x0;this[_0xfa63('0x0')]=_0x5b3977[_0xfa63('0x0')]||![];this['name']=_0x5b3977['name']||'';this[_0xfa63('0x1')]=_0xfa63('0x2');this[_0xfa63('0x3')]=0x0;this[_0xfa63('0x4')]=_0xfa63('0x2');this['registry']=_0x5b3977[_0xfa63('0x5')]&&_0x5b3977[_0xfa63('0x5')]['indexOf'](':')?_0x5b3977[_0xfa63('0x5')][_0xfa63('0x6')](':')[0x0]:'';this[_0xfa63('0x7')]='';this['port']='';this[_0xfa63('0x8')]='';this['domainport']='';this['refresh']='';this[_0xfa63('0x9')]=_0xfa63('0x2');this[_0xfa63('0xa')]='';this[_0xfa63('0xb')]='';this[_0xfa63('0xc')]=_0x5b3977[_0xfa63('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xe57f=['unknown','stateTime','registry','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active'];(function(_0x5938c8,_0x4a9ca){var _0x4353f7=function(_0x50764f){while(--_0x50764f){_0x5938c8['push'](_0x5938c8['shift']());}};_0x4353f7(++_0x4a9ca);}(_0xe57f,0x1bf));var _0xfe57=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe57f[_0xa464c9];return _0x3d73c4;};'use strict';function Trunk(_0x4138b1){this['id']=_0x4138b1['id']||0x0;this[_0xfe57('0x0')]=_0x4138b1[_0xfe57('0x0')]||![];this['name']=_0x4138b1['name']||'';this['state']=_0xfe57('0x1');this[_0xfe57('0x2')]=0x0;this['status']=_0xfe57('0x1');this[_0xfe57('0x3')]=_0x4138b1[_0xfe57('0x3')]&&_0x4138b1[_0xfe57('0x3')]['indexOf'](':')?_0x4138b1['registry'][_0xfe57('0x4')](':')[0x0]:'';this[_0xfe57('0x5')]='';this[_0xfe57('0x6')]='';this[_0xfe57('0x7')]='';this[_0xfe57('0x8')]='';this[_0xfe57('0x9')]='';this[_0xfe57('0xa')]=_0xfe57('0x1');this[_0xfe57('0xb')]='';this[_0xfe57('0xc')]='';this['defaultuser']=_0x4138b1[_0xfe57('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 6298e6f..ee85bc4 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 _0xfca9=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x27d11f,_0x2c59a8){var _0x36c1a5=function(_0x2334ae){while(--_0x2334ae){_0x27d11f['push'](_0x27d11f['shift']());}};_0x36c1a5(++_0x2c59a8);}(_0xfca9,0x1a2));var _0x9fca=function(_0x554c9a,_0x5384a1){_0x554c9a=_0x554c9a-0x0;var _0x10b22a=_0xfca9[_0x554c9a];return _0x10b22a;};'use strict';function voiceExtension(_0x58078b){this['id']=_0x58078b['id']||0x0;this[_0x9fca('0x0')]=_0x58078b[_0x9fca('0x0')]||'';this[_0x9fca('0x1')]=_0x58078b['recordingFormat']||_0x9fca('0x2');this['mandatoryDisposition']=_0x58078b[_0x9fca('0x3')]||![];}module[_0x9fca('0x4')]=voiceExtension; \ No newline at end of file +var _0xa2f4=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x588e40,_0x2a6615){var _0x45b8c2=function(_0x214739){while(--_0x214739){_0x588e40['push'](_0x588e40['shift']());}};_0x45b8c2(++_0x2a6615);}(_0xa2f4,0x11f));var _0x4a2f=function(_0x59f0ea,_0x12b743){_0x59f0ea=_0x59f0ea-0x0;var _0x32db39=_0xa2f4[_0x59f0ea];return _0x32db39;};'use strict';function voiceExtension(_0x1c5f39){this['id']=_0x1c5f39['id']||0x0;this[_0x4a2f('0x0')]=_0x1c5f39['exten']||'';this[_0x4a2f('0x1')]=_0x1c5f39[_0x4a2f('0x1')]||'none';this['mandatoryDisposition']=_0x1c5f39[_0x4a2f('0x2')]||![];}module[_0x4a2f('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5a67373..a583208 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 _0x9a44=['invalid','unavailable','ringing','ringinuse','onhold','gsm','name','monitor_format','type','inbound','waiting','talking','sumDuration','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','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','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x9a44,0xe0));var _0x49a4=function(_0x109727,_0x1c3acf){_0x109727=_0x109727-0x0;var _0x20722d=_0x9a44[_0x109727];return _0x20722d;};'use strict';var statusDesc=[_0x49a4('0x0'),_0x49a4('0x1'),_0x49a4('0x2'),_0x49a4('0x3'),_0x49a4('0x4'),_0x49a4('0x5'),_0x49a4('0x6'),_0x49a4('0x7'),_0x49a4('0x8')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x49a4('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x2e3167){this['id']=_0x2e3167['id']||0x0;this[_0x49a4('0xa')]=_0x2e3167[_0x49a4('0xa')]||'';this[_0x49a4('0xb')]=_0x2e3167['monitor_format']||'';this[_0x49a4('0xc')]=_0x2e3167[_0x49a4('0xc')]||_0x49a4('0xd');this[_0x49a4('0xe')]=0x0;this[_0x49a4('0xf')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x49a4('0x10')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x49a4('0x11')]=0x0;this[_0x49a4('0x12')]=0x0;this[_0x49a4('0x13')]=0x0;this['acw']=_0x2e3167[_0x49a4('0x14')]||![];this[_0x49a4('0x15')]=_0x2e3167[_0x49a4('0x15')]||0xa;this[_0x49a4('0x16')]=_0x2e3167[_0x49a4('0x16')]||'no';this[_0x49a4('0x17')]=!![];this[_0x49a4('0x18')]='';this[_0x49a4('0x19')]=0x0;this[_0x49a4('0x1a')]=0x0;this[_0x49a4('0x1b')]=_0x2e3167['dialTimezone']||null;this[_0x49a4('0x1c')]=_0x2e3167[_0x49a4('0x1c')]?_0x2e3167[_0x49a4('0x1c')]:null;this['dialActive']=_0x2e3167[_0x49a4('0x1d')];this[_0x49a4('0x1e')]=_0x2e3167[_0x49a4('0x1e')]||_0x49a4('0x1f');this['dialLimitChannel']=_0x2e3167[_0x49a4('0x20')]||0x0;this[_0x49a4('0x21')]=_0x2e3167['dialLimitQueue']||0x0;this[_0x49a4('0x22')]=_0x2e3167[_0x49a4('0x22')]||0x1;this['dialPredictiveOptimization']=_0x2e3167['dialPredictiveOptimization']||'dropRate';this[_0x49a4('0x23')]=_0x2e3167[_0x49a4('0x23')]||0.03;this[_0x49a4('0x24')]=_0x2e3167['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x2e3167[_0x49a4('0x25')]||_0x49a4('0x26');this[_0x49a4('0x27')]=_0x2e3167[_0x49a4('0x27')]||_0x49a4('0x26');this[_0x49a4('0x28')]=_0x2e3167['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x2e3167['dialQueueOptions']||_0x49a4('0x29');this['dialQueueTimeout']=_0x2e3167[_0x49a4('0x2a')]||0x3;this['dialQueueProject']=_0x2e3167[_0x49a4('0x2b')]||undefined;this['dialCongestionMaxRetry']=_0x2e3167[_0x49a4('0x2c')]||0x3;this[_0x49a4('0x2d')]=_0x2e3167[_0x49a4('0x2d')]||0x96;this[_0x49a4('0x2e')]=_0x2e3167[_0x49a4('0x2e')]||0x3;this[_0x49a4('0x2f')]=_0x2e3167[_0x49a4('0x2f')]||0x96;this[_0x49a4('0x30')]=_0x2e3167[_0x49a4('0x30')]||0x3;this[_0x49a4('0x31')]=_0x2e3167[_0x49a4('0x31')]||0x96;this[_0x49a4('0x32')]=_0x2e3167['dialNoSuchNumberMaxRetry']||0x3;this[_0x49a4('0x33')]=_0x2e3167[_0x49a4('0x33')]||0x96;this[_0x49a4('0x34')]=_0x2e3167[_0x49a4('0x34')]||0x3;this[_0x49a4('0x35')]=_0x2e3167[_0x49a4('0x35')]||0x96;this[_0x49a4('0x36')]=_0x2e3167[_0x49a4('0x36')]||0x3;this[_0x49a4('0x37')]=_0x2e3167[_0x49a4('0x37')]||0x96;this[_0x49a4('0x38')]=_0x2e3167[_0x49a4('0x38')]||0x3;this[_0x49a4('0x39')]=_0x2e3167['dialMachineRetryFrequency']||0x96;this[_0x49a4('0x3a')]=_0x2e3167['dialAgentRejectMaxRetry']||0x3;this[_0x49a4('0x3b')]=_0x2e3167['dialAgentRejectRetryFrequency']||0x96;this[_0x49a4('0x3c')]=_0x2e3167[_0x49a4('0x3c')]||0x3;this[_0x49a4('0x3d')]=_0x2e3167[_0x49a4('0x3d')]||0x4;this[_0x49a4('0x3e')]=_0x2e3167['Trunk']?_0x2e3167[_0x49a4('0x3e')]:undefined;this[_0x49a4('0x3f')]=_0x2e3167[_0x49a4('0x3f')]?_0x2e3167['TrunkBackup']:undefined;this[_0x49a4('0x40')]=_0x2e3167['dialPrefix']||undefined;this['Interval']=_0x2e3167[_0x49a4('0x41')]?_0x2e3167['Interval']:undefined;this[_0x49a4('0x42')]=_0x2e3167[_0x49a4('0x42')]||_0x49a4('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x2e3167['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x49a4('0x44')]=_0x2e3167[_0x49a4('0x44')]||undefined;this['strategy']=strategy[_0x2e3167[_0x49a4('0x45')]]||_0x49a4('0x46');this['queueStatusComplete']=!![];this[_0x49a4('0x47')]=_0x2e3167['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2e3167[_0x49a4('0x48')];this[_0x49a4('0x49')]=_0x2e3167[_0x49a4('0x49')];this[_0x49a4('0x4a')]=_0x2e3167[_0x49a4('0x4a')];this[_0x49a4('0x4b')]=_0x2e3167['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x2e3167[_0x49a4('0x4c')];this['dialAMDBetweenWordsSilence']=_0x2e3167[_0x49a4('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x2e3167[_0x49a4('0x4e')];this[_0x49a4('0x4f')]=_0x2e3167[_0x49a4('0x4f')];this[_0x49a4('0x50')]=_0x2e3167['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x49a4('0x51')]=_0x2e3167['timeout'];this[_0x49a4('0x52')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x49a4('0x53')]=0x0;this[_0x49a4('0x54')]=0x0;this[_0x49a4('0x55')]=0x0;this[_0x49a4('0x56')]=0x0;this[_0x49a4('0x57')]=0x0;this[_0x49a4('0x58')]=0x0;this[_0x49a4('0x59')]=0x0;this[_0x49a4('0x5a')]=0x0;this[_0x49a4('0x5b')]=0x0;this['outboundReCallsDay']=0x0;this[_0x49a4('0x5c')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x49a4('0x5d')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x49a4('0x5e')]=0x0;this[_0x49a4('0x5f')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x49a4('0x60')]=0x0;this[_0x49a4('0x61')]=0x0;this[_0x49a4('0x62')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x49a4('0x63')]=_0x2e3167[_0x49a4('0x64')]||0x14;this[_0x49a4('0x65')]=_0x2e3167[_0x49a4('0x64')]||0xa;this[_0x49a4('0x66')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x49a4('0x67')]=0x0;this[_0x49a4('0x68')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x49a4('0x69')]=0x0;this[_0x49a4('0x6a')]=_0x2e3167['dialRecallMeTimeout']||0x1e;this[_0x49a4('0x6b')]=_0x2e3167[_0x49a4('0x6b')]||![];this[_0x49a4('0x6c')]=_0x2e3167[_0x49a4('0x6c')]||undefined;this[_0x49a4('0x6d')]=_0x2e3167['dialAgiAfterHangupClient']||![];this[_0x49a4('0x6e')]=_0x2e3167[_0x49a4('0x6e')]||![];this[_0x49a4('0xb')]=monitorFormat[_0x2e3167[_0x49a4('0xb')]]?monitorFormat[_0x2e3167['monitor_format']]:undefined;this[_0x49a4('0x6f')]=_0x2e3167['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x2e3167['mandatoryDispositionPause']?_0x2e3167[_0x49a4('0x70')]:undefined;}module[_0x49a4('0x71')]=VoiceQueue; \ No newline at end of file +var _0xdda3=['startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','invalid','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay'];(function(_0x3c19ca,_0x131d1c){var _0x425bee=function(_0x463ae3){while(--_0x463ae3){_0x3c19ca['push'](_0x3c19ca['shift']());}};_0x425bee(++_0x131d1c);}(_0xdda3,0x10d));var _0x3dda=function(_0x5538a4,_0xe0b8b0){_0x5538a4=_0x5538a4-0x0;var _0x530a52=_0xdda3[_0x5538a4];return _0x530a52;};'use strict';var statusDesc=[_0x3dda('0x0'),_0x3dda('0x1'),_0x3dda('0x2'),'busy',_0x3dda('0x3'),'unavailable','ringing','ringinuse',_0x3dda('0x4')];var monitorFormat={'wav':_0x3dda('0x5'),'wav49':_0x3dda('0x6'),'gsm':_0x3dda('0x7')};var strategy={'rrmemory':_0x3dda('0x8'),'roundrobin':_0x3dda('0x9')};function VoiceQueue(_0x4cf418){this['id']=_0x4cf418['id']||0x0;this[_0x3dda('0xa')]=_0x4cf418[_0x3dda('0xa')]||'';this[_0x3dda('0xb')]=_0x4cf418['monitor_format']||'';this[_0x3dda('0xc')]=_0x4cf418[_0x3dda('0xc')]||_0x3dda('0xd');this[_0x3dda('0xe')]=0x0;this[_0x3dda('0xf')]=0x0;this['total']=0x0;this[_0x3dda('0x10')]=0x0;this[_0x3dda('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x3dda('0x12')]=0x0;this[_0x3dda('0x13')]=0x0;this[_0x3dda('0x14')]=0x0;this[_0x3dda('0x15')]=0x0;this['available']=0x0;this[_0x3dda('0x16')]=_0x4cf418[_0x3dda('0x16')]||![];this[_0x3dda('0x17')]=_0x4cf418[_0x3dda('0x17')]||0xa;this['autopause']=_0x4cf418[_0x3dda('0x18')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x3dda('0x19')]=0x0;this[_0x3dda('0x1a')]=0x0;this[_0x3dda('0x1b')]=_0x4cf418['dialTimezone']||null;this[_0x3dda('0x1c')]=_0x4cf418['dialGlobalInterval']?_0x4cf418[_0x3dda('0x1c')]:null;this[_0x3dda('0x1d')]=_0x4cf418[_0x3dda('0x1d')];this[_0x3dda('0x1e')]=_0x4cf418['dialMethod']||_0x3dda('0x1f');this[_0x3dda('0x20')]=_0x4cf418[_0x3dda('0x20')]||0x0;this['dialLimitQueue']=_0x4cf418['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x4cf418[_0x3dda('0x21')]||0x1;this[_0x3dda('0x22')]=_0x4cf418[_0x3dda('0x22')]||_0x3dda('0x23');this[_0x3dda('0x24')]=_0x4cf418[_0x3dda('0x24')]||0.03;this[_0x3dda('0x25')]=_0x4cf418[_0x3dda('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x4cf418[_0x3dda('0x26')]||_0x3dda('0x27');this[_0x3dda('0x28')]=_0x4cf418[_0x3dda('0x28')]||'anonymous';this['dialOriginateTimeout']=_0x4cf418[_0x3dda('0x29')]||0x1e;this[_0x3dda('0x2a')]=_0x4cf418['dialQueueOptions']||_0x3dda('0x2b');this[_0x3dda('0x2c')]=_0x4cf418['dialQueueTimeout']||0x3;this[_0x3dda('0x2d')]=_0x4cf418[_0x3dda('0x2d')]||undefined;this[_0x3dda('0x2e')]=_0x4cf418[_0x3dda('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x4cf418['dialCongestionRetryFrequency']||0x96;this[_0x3dda('0x2f')]=_0x4cf418[_0x3dda('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x4cf418[_0x3dda('0x30')]||0x96;this[_0x3dda('0x31')]=_0x4cf418[_0x3dda('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4cf418[_0x3dda('0x32')]||0x96;this[_0x3dda('0x33')]=_0x4cf418[_0x3dda('0x33')]||0x3;this[_0x3dda('0x34')]=_0x4cf418['dialNoSuchNumberRetryFrequency']||0x96;this[_0x3dda('0x35')]=_0x4cf418['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4cf418['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x4cf418[_0x3dda('0x36')]||0x3;this[_0x3dda('0x37')]=_0x4cf418['dialAbandonedRetryFrequency']||0x96;this[_0x3dda('0x38')]=_0x4cf418[_0x3dda('0x38')]||0x3;this[_0x3dda('0x39')]=_0x4cf418[_0x3dda('0x39')]||0x96;this[_0x3dda('0x3a')]=_0x4cf418['dialAgentRejectMaxRetry']||0x3;this[_0x3dda('0x3b')]=_0x4cf418[_0x3dda('0x3b')]||0x96;this['callAdditionalPhoneAfterMin']=_0x4cf418[_0x3dda('0x3c')]||0x3;this[_0x3dda('0x3d')]=_0x4cf418[_0x3dda('0x3d')]||0x4;this[_0x3dda('0x3e')]=_0x4cf418['Trunk']?_0x4cf418[_0x3dda('0x3e')]:undefined;this[_0x3dda('0x3f')]=_0x4cf418['TrunkBackup']?_0x4cf418[_0x3dda('0x3f')]:undefined;this[_0x3dda('0x40')]=_0x4cf418['dialPrefix']||undefined;this[_0x3dda('0x41')]=_0x4cf418['Interval']?_0x4cf418[_0x3dda('0x41')]:undefined;this['dialOrderByScheduledAt']=_0x4cf418[_0x3dda('0x42')]||_0x3dda('0x43');this[_0x3dda('0x44')]=_0x4cf418[_0x3dda('0x44')]||undefined;this[_0x3dda('0x45')]=_0x4cf418['dialCutDigit']||undefined;this[_0x3dda('0x46')]=strategy[_0x4cf418[_0x3dda('0x46')]]||_0x3dda('0x8');this[_0x3dda('0x47')]=!![];this['dialAMDActive']=_0x4cf418[_0x3dda('0x48')]||![];this[_0x3dda('0x49')]=_0x4cf418[_0x3dda('0x49')];this[_0x3dda('0x4a')]=_0x4cf418[_0x3dda('0x4a')];this[_0x3dda('0x4b')]=_0x4cf418[_0x3dda('0x4b')];this['dialAMDTotalAnalysisTime']=_0x4cf418['dialAMDTotalAnalysisTime'];this[_0x3dda('0x4c')]=_0x4cf418[_0x3dda('0x4c')];this[_0x3dda('0x4d')]=_0x4cf418['dialAMDBetweenWordsSilence'];this[_0x3dda('0x4e')]=_0x4cf418[_0x3dda('0x4e')];this[_0x3dda('0x4f')]=_0x4cf418['dialAMDSilenceThreshold'];this[_0x3dda('0x50')]=_0x4cf418[_0x3dda('0x50')];this['outboundRejectCallsDay']=0x0;this[_0x3dda('0x51')]=0x0;this['timeout']=_0x4cf418[_0x3dda('0x52')];this[_0x3dda('0x53')]=0x0;this[_0x3dda('0x54')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x3dda('0x55')]=0x0;this[_0x3dda('0x56')]=0x0;this[_0x3dda('0x57')]=0x0;this[_0x3dda('0x58')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x3dda('0x59')]=0x0;this[_0x3dda('0x5a')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x3dda('0x5b')]=0x0;this[_0x3dda('0x5c')]=0x0;this[_0x3dda('0x5d')]=0x0;this[_0x3dda('0x5e')]=undefined;this[_0x3dda('0x5f')]=undefined;this[_0x3dda('0x60')]=undefined;this[_0x3dda('0x61')]=1.05;this[_0x3dda('0x62')]=0x0;this[_0x3dda('0x63')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x3dda('0x64')]=0x0;this[_0x3dda('0x65')]=0x0;this[_0x3dda('0x66')]=0x0;this[_0x3dda('0x67')]=0x0;this[_0x3dda('0x68')]=0x0;this[_0x3dda('0x69')]=_0x4cf418[_0x3dda('0x6a')]||0x14;this[_0x3dda('0x6b')]=_0x4cf418[_0x3dda('0x6a')]||0xa;this[_0x3dda('0x6c')]=0x0;this[_0x3dda('0x6d')]=0x0;this[_0x3dda('0x6e')]=0x1;this[_0x3dda('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this[_0x3dda('0x70')]=0x0;this[_0x3dda('0x71')]=0x0;this[_0x3dda('0x72')]=_0x4cf418['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x4cf418[_0x3dda('0x73')]||![];this[_0x3dda('0x74')]=_0x4cf418[_0x3dda('0x74')]||undefined;this[_0x3dda('0x75')]=_0x4cf418[_0x3dda('0x75')]||![];this[_0x3dda('0x76')]=_0x4cf418[_0x3dda('0x76')]||![];this['monitor_format']=monitorFormat[_0x4cf418[_0x3dda('0xb')]]?monitorFormat[_0x4cf418[_0x3dda('0xb')]]:undefined;this[_0x3dda('0x77')]=_0x4cf418[_0x3dda('0x77')]||![];this[_0x3dda('0x78')]=_0x4cf418['mandatoryDispositionPause']?_0x4cf418[_0x3dda('0x78')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 728086e..7fa1cb7 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 _0x83e0=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5a51d6,_0x24a391){var _0x1eaeec=function(_0xfe47aa){while(--_0xfe47aa){_0x5a51d6['push'](_0x5a51d6['shift']());}};_0x1eaeec(++_0x24a391);}(_0x83e0,0x8f));var _0x083e=function(_0x4db04d,_0x52cba1){_0x4db04d=_0x4db04d-0x0;var _0x2cffe8=_0x83e0[_0x4db04d];return _0x2cffe8;};'use strict';function VtigerAccount(_0x2c25f3){this['id']=_0x2c25f3['id']||0x0;this[_0x083e('0x0')]=_0x2c25f3[_0x083e('0x0')]||'';this[_0x083e('0x1')]=_0x2c25f3['username']||'';this['accessKey']=_0x2c25f3['accessKey']||'';this[_0x083e('0x2')]=_0x2c25f3[_0x083e('0x2')]||'';this[_0x083e('0x3')]=_0x2c25f3[_0x083e('0x3')]||'';this['Configurations']=_0x2c25f3[_0x083e('0x4')]||{};}module[_0x083e('0x5')]=VtigerAccount; \ No newline at end of file +var _0x6194=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x2bfde2,_0xdd460a){var _0x1f9f01=function(_0x1068a7){while(--_0x1068a7){_0x2bfde2['push'](_0x2bfde2['shift']());}};_0x1f9f01(++_0xdd460a);}(_0x6194,0x173));var _0x4619=function(_0x2d8db5,_0x3c9c8d){_0x2d8db5=_0x2d8db5-0x0;var _0xdc5579=_0x6194[_0x2d8db5];return _0xdc5579;};'use strict';function VtigerAccount(_0x5d141b){this['id']=_0x5d141b['id']||0x0;this[_0x4619('0x0')]=_0x5d141b[_0x4619('0x0')]||'';this['username']=_0x5d141b[_0x4619('0x1')]||'';this['accessKey']=_0x5d141b[_0x4619('0x2')]||'';this[_0x4619('0x3')]=_0x5d141b['remoteUri']||'';this[_0x4619('0x4')]=_0x5d141b[_0x4619('0x4')]||'';this['Configurations']=_0x5d141b[_0x4619('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 9c7181e..408c176 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 _0xe6e8=['type','integrationTab','serverUrl','Configurations','exports','username','password','token','remoteUri','authType'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xe6e8,0x113));var _0x8e6e=function(_0x5ba5a9,_0x2d8947){_0x5ba5a9=_0x5ba5a9-0x0;var _0x3cbf06=_0xe6e8[_0x5ba5a9];return _0x3cbf06;};'use strict';function ZendeskAccount(_0x275f7e){this['id']=_0x275f7e['id']||0x0;this['name']=_0x275f7e['name']||'';this['username']=_0x275f7e[_0x8e6e('0x0')]||'';this[_0x8e6e('0x1')]=_0x275f7e[_0x8e6e('0x1')]||'';this[_0x8e6e('0x2')]=_0x275f7e['token']||'';this[_0x8e6e('0x3')]=_0x275f7e['remoteUri']||'';this[_0x8e6e('0x4')]=_0x275f7e[_0x8e6e('0x4')]||'';this['type']=_0x275f7e[_0x8e6e('0x5')]||_0x8e6e('0x6');this[_0x8e6e('0x7')]=_0x275f7e[_0x8e6e('0x7')]||'';this[_0x8e6e('0x8')]=_0x275f7e[_0x8e6e('0x8')]||{};}module[_0x8e6e('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x0370=['authType','type','serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0370,0x184));var _0x0037=function(_0x11fef0,_0x7d5c89){_0x11fef0=_0x11fef0-0x0;var _0x5d9b58=_0x0370[_0x11fef0];return _0x5d9b58;};'use strict';function ZendeskAccount(_0x2bccd7){this['id']=_0x2bccd7['id']||0x0;this[_0x0037('0x0')]=_0x2bccd7[_0x0037('0x0')]||'';this[_0x0037('0x1')]=_0x2bccd7[_0x0037('0x1')]||'';this[_0x0037('0x2')]=_0x2bccd7[_0x0037('0x2')]||'';this['token']=_0x2bccd7['token']||'';this[_0x0037('0x3')]=_0x2bccd7[_0x0037('0x3')]||'';this[_0x0037('0x4')]=_0x2bccd7[_0x0037('0x4')]||'';this[_0x0037('0x5')]=_0x2bccd7[_0x0037('0x5')]||'integrationTab';this[_0x0037('0x6')]=_0x2bccd7[_0x0037('0x6')]||'';this[_0x0037('0x7')]=_0x2bccd7[_0x0037('0x7')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 7088d74..3f8097c 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 _0xae81=['name','description','host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0xc568c4,_0x5e1c2d){var _0x1d8c0d=function(_0x183048){while(--_0x183048){_0xc568c4['push'](_0xc568c4['shift']());}};_0x1d8c0d(++_0x5e1c2d);}(_0xae81,0x132));var _0x1ae8=function(_0xe2b584,_0xafae0b){_0xe2b584=_0xe2b584-0x0;var _0x27a06f=_0xae81[_0xe2b584];return _0x27a06f;};'use strict';function ZohoAccount(_0x4750aa){this['id']=_0x4750aa['id']||0x0;this[_0x1ae8('0x0')]=_0x4750aa['name']||'';this[_0x1ae8('0x1')]=_0x4750aa['description']||'';this[_0x1ae8('0x2')]=_0x4750aa[_0x1ae8('0x2')]||'';this['zone']=_0x4750aa['zone']||'';this[_0x1ae8('0x3')]=_0x4750aa[_0x1ae8('0x3')]||'';this['clientSecret']=_0x4750aa[_0x1ae8('0x4')]||'';this[_0x1ae8('0x5')]=_0x4750aa[_0x1ae8('0x5')]||'';this[_0x1ae8('0x6')]=_0x4750aa[_0x1ae8('0x6')]||'';this[_0x1ae8('0x7')]=_0x4750aa[_0x1ae8('0x7')]||'';this[_0x1ae8('0x8')]=_0x4750aa[_0x1ae8('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x7cee=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name'];(function(_0x5b54d5,_0x19a84f){var _0x583fd4=function(_0x4a0981){while(--_0x4a0981){_0x5b54d5['push'](_0x5b54d5['shift']());}};_0x583fd4(++_0x19a84f);}(_0x7cee,0x135));var _0xe7ce=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x7cee[_0x5ff517];return _0x19a245;};'use strict';function ZohoAccount(_0x678629){this['id']=_0x678629['id']||0x0;this[_0xe7ce('0x0')]=_0x678629[_0xe7ce('0x0')]||'';this[_0xe7ce('0x1')]=_0x678629[_0xe7ce('0x1')]||'';this['host']=_0x678629[_0xe7ce('0x2')]||'';this[_0xe7ce('0x3')]=_0x678629['zone']||'';this[_0xe7ce('0x4')]=_0x678629[_0xe7ce('0x4')]||'';this[_0xe7ce('0x5')]=_0x678629[_0xe7ce('0x5')]||'';this['serverUrl']=_0x678629[_0xe7ce('0x6')]||'';this[_0xe7ce('0x7')]=_0x678629[_0xe7ce('0x7')]||'';this[_0xe7ce('0x8')]=_0x678629['refreshToken']||'';this[_0xe7ce('0x9')]=_0x678629[_0xe7ce('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index d61efc1..3499ac6 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 _0x25e7=['ListId','UserId','Agent','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','channelAgent','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme'];(function(_0x3ed29d,_0x483ff6){var _0x546532=function(_0xc82e7f){while(--_0xc82e7f){_0x3ed29d['push'](_0x3ed29d['shift']());}};_0x546532(++_0x483ff6);}(_0x25e7,0x1d6));var _0x725e=function(_0x54d879,_0x35c691){_0x54d879=_0x54d879-0x0;var _0xf1c912=_0x25e7[_0x54d879];return _0xf1c912;};'use strict';var util=require(_0x725e('0x0'));var _=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));function checkNameSurname(_0x3fdca4,_0x3644c1,_0x1c3b9){var _0x223d77='';if(!_[_0x725e('0x3')](_0x3644c1)&&_0x725e('0x4')===typeof _0x3644c1){_0x223d77+=_0x3644c1;}if(!_[_0x725e('0x3')](_0x1c3b9)&&'string'===typeof _0x1c3b9){_0x223d77+='\x20'+_0x1c3b9;}if(_0x223d77!==''){return _0x223d77;}return _0x3fdca4;}function Action(_0x5e17a9,_0x2497a5,_0x480945,_0x481316,_0x111a50){this[_0x725e('0x5')]=_0x480945||undefined;this[_0x725e('0x6')]=_0x5e17a9['id'];this[_0x725e('0x7')]=_0x2497a5[_0x725e('0x8')];this[_0x725e('0x9')]=_0x2497a5[_0x725e('0x9')];this[_0x725e('0xa')]=_0x725e('0x7');this[_0x725e('0xb')]=![];this[_0x725e('0xc')]=_[_0x725e('0x3')](_0x5e17a9['Agent'])?undefined:_0x5e17a9['Agent'][_0x725e('0x8')];this[_0x725e('0xd')]=this['membername']?util['format'](_0x725e('0xe'),this[_0x725e('0xc')]):_0x481316||undefined;this['calleridname']=checkNameSurname(_0x5e17a9[_0x725e('0xf')][_0x725e('0x10')],_0x5e17a9[_0x725e('0xf')]['firstName'],_0x5e17a9[_0x725e('0xf')][_0x725e('0x11')]);this[_0x725e('0x12')]=_0x5e17a9[_0x725e('0x12')]||![];this[_0x725e('0x13')]=_0x5e17a9[_0x725e('0x10')];this['scheduledat']=_0x5e17a9[_0x725e('0x14')];this[_0x725e('0x15')]=_0x5e17a9[_0x725e('0x15')]||0x0;this['countcongestionretry']=_0x5e17a9[_0x725e('0x16')]||0x0;this[_0x725e('0x17')]=_0x5e17a9[_0x725e('0x17')]||0x0;this[_0x725e('0x18')]=(_0x5e17a9[_0x725e('0x15')]||0x0)+(_0x5e17a9[_0x725e('0x16')]||0x0)+(_0x5e17a9['countnoanswerretry']||0x0)+(_0x5e17a9[_0x725e('0x19')]||0x0)+(_0x5e17a9[_0x725e('0x1a')]||0x0)+(_0x5e17a9[_0x725e('0x1b')]||0x0)+(_0x5e17a9[_0x725e('0x1c')]||0x0)+(_0x5e17a9[_0x725e('0x1d')]||0x0);this[_0x725e('0x19')]=_0x5e17a9['countnosuchnumberretry']||0x0;this[_0x725e('0x1a')]=_0x5e17a9[_0x725e('0x1a')]||0x0;this[_0x725e('0x1b')]=_0x5e17a9[_0x725e('0x1b')]||0x0;this[_0x725e('0x1c')]=_0x5e17a9[_0x725e('0x1c')]||0x0;this[_0x725e('0x1d')]=_0x5e17a9[_0x725e('0x1d')]||0x0;this[_0x725e('0x1e')]=_0x5e17a9['callback'];this[_0x725e('0x1f')]=_0x5e17a9[_0x725e('0x1f')];this[_0x725e('0x20')]=_0x5e17a9[_0x725e('0x20')];this['recallme']=_0x5e17a9[_0x725e('0x21')];this['ContactId']=_0x5e17a9['ContactId'];this['ListId']=_0x5e17a9[_0x725e('0x22')];this[_0x725e('0x23')]=_[_0x725e('0x3')](_0x5e17a9['Agent'])?_0x5e17a9[_0x725e('0x23')]:_0x5e17a9[_0x725e('0x24')]['id'];this['VoiceQueueId']=_0x5e17a9[_0x725e('0x25')];this[_0x725e('0x26')]='';this['originatecalleridname']='';}Action[_0x725e('0x27')]['getCaller']=function(){return util['format'](_0x725e('0x28'),this['calleridname'],this[_0x725e('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0x77e6=['VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x54613f,_0x47a2b9){var _0x1a51b2=function(_0x244f7f){while(--_0x244f7f){_0x54613f['push'](_0x54613f['shift']());}};_0x1a51b2(++_0x47a2b9);}(_0x77e6,0x1a6));var _0x677e=function(_0x580edc,_0x5297d7){_0x580edc=_0x580edc-0x0;var _0x22d06a=_0x77e6[_0x580edc];return _0x22d06a;};'use strict';var util=require(_0x677e('0x0'));var _=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));function checkNameSurname(_0xa48f0c,_0x2dba41,_0x3a0a0e){var _0x4142a3='';if(!_[_0x677e('0x3')](_0x2dba41)&&'string'===typeof _0x2dba41){_0x4142a3+=_0x2dba41;}if(!_[_0x677e('0x3')](_0x3a0a0e)&&_0x677e('0x4')===typeof _0x3a0a0e){_0x4142a3+='\x20'+_0x3a0a0e;}if(_0x4142a3!==''){return _0x4142a3;}return _0xa48f0c;}function Action(_0x52e3f9,_0x18c5e1,_0x591b21,_0x40d314,_0x4d1a57){this['uniqueid']=_0x591b21||undefined;this[_0x677e('0x5')]=_0x52e3f9['id'];this[_0x677e('0x6')]=_0x18c5e1[_0x677e('0x7')];this[_0x677e('0x8')]=_0x18c5e1['type'];this[_0x677e('0x9')]='queue';this[_0x677e('0xa')]=![];this[_0x677e('0xb')]=_[_0x677e('0x3')](_0x52e3f9[_0x677e('0xc')])?undefined:_0x52e3f9[_0x677e('0xc')][_0x677e('0x7')];this[_0x677e('0xd')]=this[_0x677e('0xb')]?util[_0x677e('0xe')](_0x677e('0xf'),this[_0x677e('0xb')]):_0x40d314||undefined;this[_0x677e('0x10')]=checkNameSurname(_0x52e3f9[_0x677e('0x11')][_0x677e('0x12')],_0x52e3f9['Contact']['firstName'],_0x52e3f9['Contact'][_0x677e('0x13')]);this[_0x677e('0x14')]=_0x52e3f9[_0x677e('0x14')]||![];this[_0x677e('0x15')]=_0x52e3f9[_0x677e('0x12')];this[_0x677e('0x16')]=_0x52e3f9[_0x677e('0x16')];this[_0x677e('0x17')]=_0x52e3f9[_0x677e('0x17')]||0x0;this[_0x677e('0x18')]=_0x52e3f9[_0x677e('0x18')]||0x0;this[_0x677e('0x19')]=_0x52e3f9['countnoanswerretry']||0x0;this[_0x677e('0x1a')]=(_0x52e3f9[_0x677e('0x17')]||0x0)+(_0x52e3f9[_0x677e('0x18')]||0x0)+(_0x52e3f9[_0x677e('0x19')]||0x0)+(_0x52e3f9[_0x677e('0x1b')]||0x0)+(_0x52e3f9[_0x677e('0x1c')]||0x0)+(_0x52e3f9['countabandonedretry']||0x0)+(_0x52e3f9[_0x677e('0x1d')]||0x0)+(_0x52e3f9['countagentrejectretry']||0x0);this[_0x677e('0x1b')]=_0x52e3f9[_0x677e('0x1b')]||0x0;this[_0x677e('0x1c')]=_0x52e3f9['countdropretry']||0x0;this[_0x677e('0x1e')]=_0x52e3f9[_0x677e('0x1e')]||0x0;this[_0x677e('0x1d')]=_0x52e3f9[_0x677e('0x1d')]||0x0;this[_0x677e('0x1f')]=_0x52e3f9[_0x677e('0x1f')]||0x0;this[_0x677e('0x20')]=_0x52e3f9['callback'];this['callbackuniqueid']=_0x52e3f9['callbackuniqueid'];this[_0x677e('0x21')]=_0x52e3f9[_0x677e('0x21')];this[_0x677e('0x22')]=_0x52e3f9[_0x677e('0x22')];this[_0x677e('0x23')]=_0x52e3f9[_0x677e('0x23')];this[_0x677e('0x24')]=_0x52e3f9[_0x677e('0x24')];this[_0x677e('0x25')]=_[_0x677e('0x3')](_0x52e3f9['Agent'])?_0x52e3f9['UserId']:_0x52e3f9[_0x677e('0xc')]['id'];this[_0x677e('0x26')]=_0x52e3f9['VoiceQueueId'];this[_0x677e('0x27')]='';this[_0x677e('0x28')]='';}Action[_0x677e('0x29')][_0x677e('0x2a')]=function(){return util[_0x677e('0xe')](_0x677e('0x2b'),this['calleridname'],this[_0x677e('0x2c')]);};module[_0x677e('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 14666a1..9b6c779 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 _0x315e=['calleridnum','user:agentconnect','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','syncOriginateResponse','actionid','logLookAgent','clone','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','variables','filterKey','keys','variable','addVariable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','voiceQueues','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','type','outbound','name','strategy','answered','available','pTalking','sumDuration','sumHoldTime','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','recallMe','clearZombieChannel','actions','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','getContactRecallMe','agentReadyId','agents','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','countnosuchnumberretry','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','callAdditionalPhoneAfterMin','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','activeContact','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','isNil','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','execCall','Queue:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','trunks','SIP/%s','reachable','unmonitored','execRun','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','variablesAction','channelAgent','destconnectedlinenum'];(function(_0x5147df,_0x47f6ff){var _0x1a8556=function(_0x6661a8){while(--_0x6661a8){_0x5147df['push'](_0x5147df['shift']());}};_0x1a8556(++_0x47f6ff);}(_0x315e,0x186));var _0xe315=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x315e[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require(_0xe315('0x0'));var _=require('lodash');var BPromise=require(_0xe315('0x1'));var uuid=require(_0xe315('0x2'));var moment=require(_0xe315('0x3'));var md5=require(_0xe315('0x4'));var Redis=require('ioredis');var config=require(_0xe315('0x5'));var logger=require('../../../config/logger')(_0xe315('0x6'));var loggerAction=require(_0xe315('0x7'))(_0xe315('0x8'));var ami=require(_0xe315('0x9'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xe315('0xa'));config[_0xe315('0xb')]=_[_0xe315('0xc')](config['redis'],{'host':_0xe315('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe315('0xb')]));var Sequence=function(){};Sequence[_0xe315('0xe')][_0xe315('0xf')]=function(_0x47d830){this[_0xe315('0x10')]=this[_0xe315('0x10')]?this[_0xe315('0x10')][_0xe315('0x11')](_0x47d830):_0x47d830();};function Preview(_0x3009da){this[_0xe315('0x12')]=new Sequence();this['campaignsPreview']=_0x3009da[_0xe315('0x13')];this['trunks']=_0x3009da['trunks'];this['actions']={};this['agents']=_0x3009da['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0xe315('0x14'),this[_0xe315('0x15')][_0xe315('0x16')](this));ami['on'](_0xe315('0x17'),this[_0xe315('0x18')][_0xe315('0x16')](this));ami['on']('dialend',this[_0xe315('0x19')]['bind'](this));ami['on'](_0xe315('0x1a'),this['syncNewExten'][_0xe315('0x16')](this));ami['on'](_0xe315('0x1b'),this[_0xe315('0x1c')][_0xe315('0x16')](this));ami['on'](_0xe315('0x1d'),this[_0xe315('0x1e')][_0xe315('0x16')](this));ami['on'](_0xe315('0x1f'),this[_0xe315('0x20')][_0xe315('0x16')](this));this['loopCampaigns'](this[_0xe315('0x21')]);}function emit(_0x54d00f,_0x23e5a7,_0x49b1f0){io['to'](_0x54d00f)[_0xe315('0x22')](_0x23e5a7,_0x49b1f0);}function emitCampaignPreview(_0x1e77f1){if(_0x1e77f1[_0xe315('0x23')]===_0xe315('0x24')){var _0x26e9a3={'id':_0x1e77f1['id'],'name':_0x1e77f1[_0xe315('0x25')],'strategy':_0x1e77f1[_0xe315('0x26')],'answered':_0x1e77f1[_0xe315('0x27')],'available':_0x1e77f1[_0xe315('0x28')],'loggedIn':_0x1e77f1['loggedIn'],'pTalking':_0x1e77f1[_0xe315('0x29')],'sumBillable':_0x1e77f1['sumBillable'],'sumDuration':_0x1e77f1[_0xe315('0x2a')],'sumHoldTime':_0x1e77f1[_0xe315('0x2b')]||0x0,'talking':_0x1e77f1['talking'],'total':_0x1e77f1[_0xe315('0x2c')],'type':_0x1e77f1[_0xe315('0x23')],'unmanaged':_0x1e77f1['unmanaged'],'abandoned':_0x1e77f1[_0xe315('0x2d')],'waiting':_0x1e77f1[_0xe315('0x2e')],'loggedInDb':_0x1e77f1[_0xe315('0x2f')],'dialActive':_0x1e77f1[_0xe315('0x30')],'dialMethod':_0x1e77f1[_0xe315('0x31')],'dialOriginateCallerIdName':_0x1e77f1[_0xe315('0x32')],'dialOriginateCallerIdNumber':_0x1e77f1[_0xe315('0x33')],'dialOriginateTimeout':_0x1e77f1['dialOriginateTimeout'],'dialPrefix':_0x1e77f1[_0xe315('0x34')],'outboundAnswerAgiCallsDay':_0x1e77f1[_0xe315('0x35')],'outboundAnswerCallsDay':_0x1e77f1['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1e77f1['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1e77f1['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1e77f1[_0xe315('0x36')],'outboundDropCallsDayACS':_0x1e77f1[_0xe315('0x37')],'outboundDropCallsDayCallersExit':_0x1e77f1['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x1e77f1[_0xe315('0x38')],'outboundNoAnswerCallsDay':_0x1e77f1[_0xe315('0x39')],'outboundNoSuchCallsDay':_0x1e77f1['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1e77f1[_0xe315('0x3a')],'outboundReCallsDay':_0x1e77f1[_0xe315('0x3b')],'outboundRejectCallsDay':_0x1e77f1[_0xe315('0x3c')],'outboundUnknownCallsDay':_0x1e77f1['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x1e77f1[_0xe315('0x3d')],'predictiveIntervalAnsweredCalls':_0x1e77f1[_0xe315('0x3e')],'predictiveIntervalAvgHoldtime':_0x1e77f1[_0xe315('0x3f')],'predictiveIntervalAvgTalktime':_0x1e77f1[_0xe315('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x1e77f1['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1e77f1[_0xe315('0x41')],'predictiveIntervalErlangCalls':_0x1e77f1[_0xe315('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x1e77f1[_0xe315('0x43')],'predictiveIntervalHitRate':_0x1e77f1[_0xe315('0x44')],'predictiveIntervalMultiplicativeFactor':_0x1e77f1[_0xe315('0x45')],'predictiveIntervalPauses':_0x1e77f1[_0xe315('0x46')],'predictiveIntervalAvailable':_0x1e77f1[_0xe315('0x47')],'predictiveIntervalTotalCalls':_0x1e77f1[_0xe315('0x48')],'message':_0x1e77f1[_0xe315('0x49')],'originated':_0x1e77f1[_0xe315('0x4a')],'erlangCalls':_0x1e77f1[_0xe315('0x4b')],'erlangCallToSecond':_0x1e77f1[_0xe315('0x4c')],'erlangAbandonmentRate':_0x1e77f1['erlangAbandonmentRate'],'erlangBusyFactor':_0x1e77f1[_0xe315('0x4d')],'startPredictive':_0x1e77f1[_0xe315('0x4e')],'startProgressive':_0x1e77f1[_0xe315('0x4f')]};if(_0x1e77f1[_0xe315('0x50')]){_0x26e9a3['Trunk']={'id':_0x1e77f1[_0xe315('0x50')]['id'],'name':_0x1e77f1[_0xe315('0x50')][_0xe315('0x25')],'active':_0x1e77f1[_0xe315('0x50')][_0xe315('0x51')],'callerid':_0x1e77f1[_0xe315('0x50')][_0xe315('0x52')]};}if(_0x1e77f1['Interval']){_0x26e9a3[_0xe315('0x53')]={'id':_0x1e77f1[_0xe315('0x53')]['id'],'name':_0x1e77f1[_0xe315('0x53')][_0xe315('0x25')]};}var _0x5c2549=md5(JSON[_0xe315('0x54')](_0x26e9a3));if(_0x1e77f1[_0xe315('0x4')]!==_0x5c2549){_0x1e77f1['md5']=_0x5c2549;emit(util[_0xe315('0x55')](_0xe315('0x56'),_0x26e9a3[_0xe315('0x25')]),_0xe315('0x57'),_0x26e9a3);}}}function emitVoiceQueueChannelRemove(_0x9d8b8e){logger[_0xe315('0x58')](_0xe315('0x59'),JSON[_0xe315('0x54')](_0x9d8b8e));emit(util[_0xe315('0x55')](_0xe315('0x56'),_0x9d8b8e[_0xe315('0x25')]),_0xe315('0x5a'),_0x9d8b8e);io['emit'](_0xe315('0x5b'),_0x9d8b8e);}function notSendMessagesQueue(_0x85c7bd){if(_0x85c7bd[_0xe315('0x5c')]){if(_0x85c7bd['originated']===0x0&&_0x85c7bd['pTalking']===0x0){_0x85c7bd[_0xe315('0x5c')]=![];_0x85c7bd[_0xe315('0x28')]=0x0;_0x85c7bd[_0xe315('0x5d')]=0x0;_0x85c7bd['message']='NOT_ACTIVE';ut['logger'](_0xe315('0x5e'),_0x85c7bd['name']+_0xe315('0x5f'));}else{_0x85c7bd['message']=_0xe315('0x60');ut[_0xe315('0x61')](_0xe315('0x5e'),_0x85c7bd['name']+_0xe315('0x62'));}emitCampaignPreview(_0x85c7bd);}}Preview[_0xe315('0xe')][_0xe315('0x63')]=function(){var _0x8c5137=this;setInterval(function(){_0x8c5137[_0xe315('0x64')]();},0x7cf);};Preview[_0xe315('0xe')][_0xe315('0x64')]=function(){var _0x1bb4b9=this['campaignsPreview'];this[_0xe315('0x65')]+=0x1;for(var _0xd8022e in _0x1bb4b9){if(_0x1bb4b9[_0xe315('0x66')](_0xd8022e)&&(_0x1bb4b9[_0xd8022e][_0xe315('0x31')]==='preview'||_0x1bb4b9[_0xd8022e][_0xe315('0x31')]===_0xe315('0x67'))&&_0x1bb4b9[_0xd8022e]['type']==='outbound'){if(this[_0xe315('0x65')]>0x7){this[_0xe315('0x65')]=0x0;this[_0xe315('0x68')]();}}if(_0x1bb4b9[_0xe315('0x66')](_0xd8022e)&&_0x1bb4b9[_0xd8022e]['dialMethod']===_0xe315('0x6')&&_0x1bb4b9[_0xd8022e]['type']===_0xe315('0x24')){if(_0x1bb4b9[_0xd8022e]['dialActive']){this['setMessage'](_0x1bb4b9[_0xd8022e]);this[_0xe315('0x69')](_0x1bb4b9[_0xd8022e]);}else{notSendMessagesQueue(_0x1bb4b9[_0xd8022e]);}}}};Preview[_0xe315('0xe')][_0xe315('0x6a')]=function(_0x4ab53b){var _0x244395=this;this[_0xe315('0x12')][_0xe315('0xf')](function(){if(!_['isNil'](_0x244395[_0xe315('0x6b')][_0x4ab53b])){loggerAction[_0xe315('0x58')](_0xe315('0x6c'),_0x4ab53b,'Queue',_0x244395[_0xe315('0x6b')][_0x4ab53b]['queue'],'originated:\x20',JSON['stringify'](_0x244395[_0xe315('0x21')][_0x244395[_0xe315('0x6b')][_0x4ab53b][_0xe315('0x6d')]]['originated']),_0xe315('0x6e'),JSON[_0xe315('0x54')](_0x244395[_0xe315('0x21')][_0x244395[_0xe315('0x6b')][_0x4ab53b]['queue']]['pTalking']),JSON['stringify'](_0x244395[_0xe315('0x6b')][_0x4ab53b][_0xe315('0x6f')]),JSON[_0xe315('0x54')](_[_0xe315('0x70')](_0x244395[_0xe315('0x6b')][_0x4ab53b],['contactId',_0xe315('0x71'),_0xe315('0x72'),_0xe315('0x73')])));return ami[_0xe315('0x74')]({'action':_0xe315('0x75'),'channel':_0x244395[_0xe315('0x6b')][_0x4ab53b][_0xe315('0x76')]})[_0xe315('0x77')](function(_0x44241b){if(_0x44241b[_0xe315('0x49')]===_0xe315('0x78')){setTimeout(function(){if(_0x244395[_0xe315('0x6b')][_0x4ab53b]){ut[_0xe315('0x79')](_0x244395['campaignsPreview'][_0x244395[_0xe315('0x6b')][_0x4ab53b]['queue']],_0xe315('0x7a'));if(_0x244395[_0xe315('0x6b')][_0x4ab53b]['dialAnswer']===!![]){ut[_0xe315('0x7b')](_0x244395[_0xe315('0x21')][_0x244395['actions'][_0x4ab53b][_0xe315('0x6d')]],'[clearZombieChannel]');ut[_0xe315('0x7c')](_0xe315('0x7d')+_0x4ab53b,_0x244395['actions'][_0x4ab53b][_0xe315('0x6d')]);}ut[_0xe315('0x7c')]('[Dialer][checkChannel][Preview]'+_0x4ab53b,_0x244395[_0xe315('0x6b')][_0x4ab53b][_0xe315('0x6d')]);delete _0x244395['actions'][_0x4ab53b];}},0x2328);}});}});};Preview[_0xe315('0xe')]['clearZombieChannels']=function(){var _0x2a9889=this;loggerAction[_0xe315('0x58')](_0xe315('0x7e'),_[_0xe315('0x7f')](this['actions']));for(var _0x45c762 in this['actions']){if(_0x2a9889['actions']['hasOwnProperty'](_0x45c762)){_0x2a9889['clearZombieChannel'](_0x45c762);}}};Preview['prototype'][_0xe315('0x69')]=function(_0x47f358){var _0x27c3e5=this;rpcDb[_0xe315('0x80')](_0x47f358['id'],ut[_0xe315('0x81')](this[_0xe315('0x82')]))[_0xe315('0x83')](function(_0x5656a2){if(!_['isNil'](_0x5656a2)){for(var _0x36820f=0x0;_0x36820f<_0x5656a2[_0xe315('0x84')];_0x36820f+=0x1){if(ut['getDiff'](_0x5656a2[_0x36820f][_0xe315('0x85')])<_0x47f358[_0xe315('0x86')]*0x3c){if(_0x5656a2[_0x36820f][_0xe315('0x87')]&&!_0x5656a2[_0x36820f][_0xe315('0x87')][_0xe315('0x88')]){_0x27c3e5[_0xe315('0x89')](_0x5656a2[_0x36820f]['id'])['then'](ut[_0xe315('0x8a')](_0xe315('0x8b')))[_0xe315('0x77')](ut[_0xe315('0x8a')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x5656a2[_0x36820f]['id']);}}else{var _0x124e7e=new Action(_0x5656a2[_0x36820f],_0x47f358);_0x124e7e['starttime']=moment()[_0xe315('0x55')](_0xe315('0x8c'));_0x47f358['outboundReCallsDay']+=0x1;ut[_0xe315('0x8d')](_0x124e7e,0x17,'RecallInQueue');if(_0x47f358[_0xe315('0x8e')]){rpcDb['rescheduleContactInQueue'](ut[_0xe315('0x8f')](_0x5656a2[_0x36820f]));rpcDb[_0xe315('0x90')](_0x124e7e,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xe315('0x8d')](_0x124e7e,0x16,_0xe315('0x91'));rpcDb['createCustomerHistory'](_0x124e7e,_0xe315('0x92'));rpcDb[_0xe315('0x93')](_0x124e7e,_0xe315('0x92'));}}}}})[_0xe315('0x77')](ut[_0xe315('0x8a')]('[getContactRecallMe]'));};Preview[_0xe315('0xe')]['setMessage']=function(_0xc630fc){_0xc630fc[_0xe315('0x5c')]=!![];if(ut['IsNotLoggedIn'](_0xc630fc['loggedIn'])){_0xc630fc[_0xe315('0x49')]=_0xe315('0x94');}else if(!ut[_0xe315('0x95')](_0xc630fc[_0xe315('0x30')])){_0xc630fc[_0xe315('0x49')]=_0xe315('0x96');}else if(!this['isTrunkReachable'](_0xc630fc[_0xe315('0x50')])){if(!this[_0xe315('0x97')](_0xc630fc[_0xe315('0x98')])){_0xc630fc[_0xe315('0x49')]='TRUNK_IS_NOT_REACHABLE';}else{_0xc630fc[_0xe315('0x49')]=_0xe315('0x99');}}else{_0xc630fc['message']=_0xe315('0x99');}emitCampaignPreview(_0xc630fc);};Preview['prototype'][_0xe315('0x9a')]=function(_0x12454f,_0x1e87ba,_0x5478fb){var _0x5416a2=this;var _0x35d5e4=this[_0xe315('0x6b')][_0x1e87ba];var _0xa31359=this[_0xe315('0x21')][_0x35d5e4[_0xe315('0x6d')]];var _0x135a00;var _0x43f52a=![];var _0x233163=0x2;var _0x1a10b6=0x3;if(_0xa31359){switch(_0x5478fb){case'1':_0xa31359[_0xe315('0x9b')]+=0x1;_0x35d5e4['countnosuchnumberretry']+=0x1;_0x35d5e4[_0xe315('0x9c')]=ut[_0xe315('0x9d')](_0x35d5e4);ut['logCustomer'](_0x35d5e4,0x0,_0xe315('0x9e'));ami[_0xe315('0x22')]('custom:agentnosuchnumber',ut[_0xe315('0x9f')](_0x35d5e4,_0xe315('0xa0')));rpcDb[_0xe315('0x90')](_0x35d5e4,_0xe315('0xa1'));_0x5416a2[_0xe315('0xa2')](_0x35d5e4,'0',_0xa31359)[_0xe315('0x83')](function(_0x473762){_0x43f52a=_0x473762[_0xe315('0xa3')]==0x1;_0x233163=_0xa31359[_0xe315('0xa4')];_0x1a10b6=_0xa31359['callAdditionalPhoneAfterMin'];if(!_0x43f52a){if(ut['totalGlobal'](_0x35d5e4)>=_0xa31359[_0xe315('0xa5')]){_0x135a00=ut[_0xe315('0xa6')](_0x35d5e4,0xf,_0xe315('0xa7'));rpcDb[_0xe315('0x93')](_0x135a00,_0xe315('0xa8'));}else{if(_0x35d5e4['countnosuchnumberretry']>=_0xa31359[_0xe315('0xa9')]){rpcDb[_0xe315('0x93')](_0x35d5e4,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xe315('0xaa')](ut[_0xe315('0xab')](_0x35d5e4,_0xe315('0xac'),_0xa31359['dialNoSuchNumberRetryFrequency']),_0x35d5e4['unlockAgent'],_0x35d5e4['activeContact']);}}delete this[_0xe315('0x6b')][_0x12454f[_0xe315('0xad')]];}else{_0x35d5e4[_0xe315('0xac')]++;logger[_0xe315('0x58')](_0xe315('0xae'),_0x35d5e4[_0xe315('0xac')]);logger['info']('id',_0x35d5e4[_0xe315('0xaf')]);_0x5416a2[_0xe315('0xb0')]({'id':_0x35d5e4['idContact'],'field':{'countnosuchnumberretry':_0x35d5e4[_0xe315('0xac')]}})['then'](function(){_0x5416a2[_0xe315('0xb1')](_0x35d5e4,_0x233163,_0x1a10b6)['then'](function(){});});}});break;case _0xe315('0xb2'):var _0x4f6d87=moment()[_0xe315('0x55')](_0xe315('0x8c'));_0x35d5e4['responsetime']=_0x4f6d87;_0x35d5e4[_0xe315('0xb3')]=_0x4f6d87;_0x35d5e4[_0xe315('0x6f')]=!![];_0xa31359['pTalking']+=0x1;logger['info']('[syncHangup][talking][increment]',_0x35d5e4['uniqueid'],_0xe315('0xb4'),_0xa31359[_0xe315('0x25')],_0xe315('0x6e'),_0xa31359['pTalking']);ami[_0xe315('0x22')](_0xe315('0xb5'),ut[_0xe315('0x9f')](_0x35d5e4,'connect',this[_0xe315('0x21')][_0x35d5e4[_0xe315('0x6d')]]));if(_0xa31359[_0xe315('0xb6')]){ami['emit'](_0xe315('0xb7'),ut[_0xe315('0xb8')](_0x35d5e4));}break;case'16':ami['emit'](_0xe315('0xb9'),ut[_0xe315('0x9f')](_0x35d5e4,_0xe315('0xba'),this[_0xe315('0x21')][_0x35d5e4['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x35d5e4,'complete'));_0xa31359[_0xe315('0xbb')]+=0x1;_0xa31359[_0xe315('0x2c')]+=0x1;_0xa31359[_0xe315('0x27')]+=0x1;ut['decrementTalkink'](_0xa31359,'[16]');_0x35d5e4[_0xe315('0x9c')]=ut[_0xe315('0x9d')](_0x35d5e4);ut[_0xe315('0x8d')](_0x35d5e4,0x4,_0xe315('0xbc'));rpcDb[_0xe315('0x90')](_0x35d5e4,_0xe315('0xbd'));rpcDb[_0xe315('0x93')](_0x35d5e4,_0xe315('0xbe'));rpcDb['crateCustomerReportQueue'](_0x35d5e4);_0xa31359[_0xe315('0x2a')]+=_0x35d5e4[_0xe315('0xbf')];_0xa31359[_0xe315('0xc0')]+=_0x35d5e4[_0xe315('0xbf')];logger[_0xe315('0x58')](_0xe315('0xc1'),_0x35d5e4[_0xe315('0xc2')],_0xe315('0xb4'),_0xa31359[_0xe315('0x25')],_0xe315('0x6e'),_0xa31359[_0xe315('0x29')]);delete this[_0xe315('0x6b')][_0x12454f[_0xe315('0xad')]];break;case _0xe315('0xc3'):_0xa31359[_0xe315('0xc4')]+=0x1;_0x35d5e4[_0xe315('0xc5')]+=0x1;_0x35d5e4['countglobal']=ut[_0xe315('0x9d')](_0x35d5e4);ut[_0xe315('0x8d')](_0x35d5e4,0x5,_0xe315('0xc6'));_0x233163=_0xa31359['dialBusyRetryFrequency'];_0x1a10b6=_0xa31359[_0xe315('0xc7')];ami[_0xe315('0x22')](_0xe315('0xc8'),ut[_0xe315('0x9f')](_0x35d5e4,'busy'));rpcDb[_0xe315('0x90')](_0x35d5e4,_0xe315('0xc9'));_0x5416a2['verifyAdditionalPhones'](_0x35d5e4,'5',_0xa31359)[_0xe315('0x83')](function(_0x2eef63){_0x43f52a=_0x2eef63[_0xe315('0xa3')]==0x1;if(!_0x43f52a){if(ut[_0xe315('0x9d')](_0x35d5e4)>=_0xa31359[_0xe315('0xa5')]){_0x135a00=ut[_0xe315('0xa6')](_0x35d5e4,0xf,_0xe315('0xa7'));rpcDb[_0xe315('0x93')](_0x135a00,_0xe315('0xca'));}else{if(_0x35d5e4['countbusyretry']>=_0xa31359[_0xe315('0xcb')]){rpcDb[_0xe315('0x93')](_0x35d5e4,_0xe315('0xc9'));}else{rpcDb[_0xe315('0xaa')](ut[_0xe315('0xab')](_0x35d5e4,'countbusyretry',_0xa31359[_0xe315('0xcc')]),_0x35d5e4[_0xe315('0xcd')],_0x35d5e4[_0xe315('0xce')]);}}}else{_0x35d5e4[_0xe315('0xc5')]++;_0x5416a2[_0xe315('0xb0')]({'id':_0x35d5e4[_0xe315('0xaf')],'field':{'countbusyretry':_0x35d5e4[_0xe315('0xc5')]}})[_0xe315('0x83')](function(){_0x5416a2[_0xe315('0xb1')](_0x35d5e4,_0x233163,_0x1a10b6)[_0xe315('0x83')](function(){});});}});break;case'NOANSWER':_0xa31359[_0xe315('0x39')]+=0x1;_0x35d5e4['countnoanswerretry']+=0x1;_0x35d5e4[_0xe315('0x9c')]=ut['totalGlobal'](_0x35d5e4);ut[_0xe315('0x8d')](_0x35d5e4,0x3,_0xe315('0xcf'));_0x233163=_0xa31359[_0xe315('0xd0')];_0x1a10b6=_0xa31359[_0xe315('0xc7')];ami[_0xe315('0x22')](_0xe315('0xd1'),ut[_0xe315('0x9f')](_0x35d5e4,_0xe315('0xd2')));rpcDb[_0xe315('0x90')](_0x35d5e4,_0xe315('0xd3'));_0x5416a2['verifyAdditionalPhones'](_0x35d5e4,'3',_0xa31359)['then'](function(_0x4cc3d3){_0x43f52a=_0x4cc3d3['additional']==0x1;if(!_0x43f52a){if(ut[_0xe315('0x9d')](_0x35d5e4)>=_0xa31359[_0xe315('0xa5')]){_0x135a00=ut[_0xe315('0xa6')](_0x35d5e4,0xf,_0xe315('0xa7'));rpcDb[_0xe315('0x93')](_0x135a00,_0xe315('0xd4'));}else{if(_0x35d5e4['countnoanswerretry']>=_0xa31359[_0xe315('0xd5')]){rpcDb[_0xe315('0x93')](_0x35d5e4,_0xe315('0xd3'));}else{rpcDb[_0xe315('0xaa')](ut[_0xe315('0xab')](_0x35d5e4,'countnoanswerretry',_0xa31359[_0xe315('0xd0')]),_0x35d5e4[_0xe315('0xcd')],_0x35d5e4[_0xe315('0xce')]);}}}else{_0x35d5e4[_0xe315('0xd6')]++;_0x5416a2['incrementPreviewCounters']({'id':_0x35d5e4[_0xe315('0xaf')],'field':{'countnoanswerretry':_0x35d5e4['countnoanswerretry']}})[_0xe315('0x83')](function(){_0x5416a2[_0xe315('0xb1')](_0x35d5e4,_0x233163,_0x1a10b6)['then'](function(){});});}});break;case _0xe315('0xd7'):_0xa31359['outboundCongestionCallsDay']+=0x1;_0x35d5e4[_0xe315('0xd8')]+=0x1;_0x35d5e4['countglobal']=ut['totalGlobal'](_0x35d5e4);ut[_0xe315('0x8d')](_0x35d5e4,0x8,_0xe315('0xd9'));_0x233163=_0xa31359[_0xe315('0xda')];_0x1a10b6=_0xa31359[_0xe315('0xc7')];ami['emit'](_0xe315('0xdb'),ut['buildObj'](_0x35d5e4,_0xe315('0xdc')));rpcDb['createCustomerHistory'](_0x35d5e4,'[callProgressDetectingCustomer][logCongestion]');_0x5416a2[_0xe315('0xa2')](_0x35d5e4,'8',_0xa31359)[_0xe315('0x83')](function(_0x5c96bd){_0x43f52a=_0x5c96bd[_0xe315('0xa3')]==0x1;if(!_0x43f52a){if(ut[_0xe315('0x9d')](_0x35d5e4)>=_0xa31359['dialGlobalMaxRetry']){_0x135a00=ut[_0xe315('0xa6')](_0x35d5e4,0xf,_0xe315('0xa7'));rpcDb[_0xe315('0x93')](_0x135a00,_0xe315('0xdd'));}else{if(_0x35d5e4[_0xe315('0xd8')]>=_0xa31359[_0xe315('0xde')]){rpcDb['createCustomerFinal'](_0x35d5e4,_0xe315('0xdf'));}else{rpcDb[_0xe315('0xaa')](ut[_0xe315('0xab')](_0x35d5e4,'countcongestionretry',_0xa31359['dialBusyRetryFrequency']),_0x35d5e4[_0xe315('0xcd')],_0x35d5e4[_0xe315('0xce')]);}}}else{_0x35d5e4[_0xe315('0xd8')]++;_0x5416a2[_0xe315('0xb0')]({'id':_0x35d5e4[_0xe315('0xaf')],'field':{'countcongestionretry':_0x35d5e4[_0xe315('0xd8')]}})[_0xe315('0x83')](function(){_0x5416a2['swapAdditionalPhones'](_0x35d5e4,_0x233163,_0x1a10b6)['then'](function(){});});}});break;case _0xe315('0xe0'):_0xa31359[_0xe315('0x3c')]+=0x1;_0x35d5e4[_0xe315('0xe1')]+=0x1;_0x35d5e4['countglobal']=ut[_0xe315('0x9d')](_0x35d5e4);ut[_0xe315('0x8d')](_0x35d5e4,0x14,_0xe315('0xe2'));_0x233163=_0xa31359[_0xe315('0xe3')];_0x1a10b6=_0xa31359[_0xe315('0xc7')];ami[_0xe315('0x22')]('custom:agentreject',ut['buildObj'](_0x35d5e4,_0xe315('0xe4')));rpcDb[_0xe315('0x90')](_0x35d5e4,_0xe315('0xe5'));_0x5416a2['verifyAdditionalPhones'](_0x35d5e4,'20',_0xa31359)[_0xe315('0x83')](function(_0x1c833b){_0x43f52a=_0x1c833b['additional']==0x1;if(!_0x43f52a){if(ut[_0xe315('0x9d')](_0x35d5e4)>=_0xa31359['dialGlobalMaxRetry']){_0x135a00=ut['cloneAction'](_0x35d5e4,0x14,_0xe315('0xe2'));rpcDb[_0xe315('0x93')](_0x135a00,_0xe315('0xe6'));}else{if(_0x35d5e4['countagentrejectretry']>=_0xa31359['dialAgentRejectMaxRetry']){rpcDb[_0xe315('0x93')](_0x35d5e4,_0xe315('0xe6'));}else{rpcDb['rescheduleContact'](ut[_0xe315('0xab')](_0x35d5e4,'countagentrejectretry',_0xa31359[_0xe315('0xe3')]),_0x35d5e4['unlockAgent'],_0x35d5e4[_0xe315('0xce')]);}}}else{_0x35d5e4['countnoanswerretry']++;_0x5416a2[_0xe315('0xb0')]({'id':_0x35d5e4['idContact'],'field':{'countnoanswerretry':_0x35d5e4[_0xe315('0xd6')]}})[_0xe315('0x83')](function(){_0x5416a2['swapAdditionalPhones'](_0x35d5e4,_0x233163,_0x1a10b6)[_0xe315('0x83')](function(){});});}});break;case'ABANDONED':_0xa31359[_0xe315('0x3d')]+=0x1;_0x35d5e4[_0xe315('0xe7')]+=0x1;_0x35d5e4[_0xe315('0x9c')]=ut[_0xe315('0x9d')](_0x35d5e4);ut[_0xe315('0x8d')](_0x35d5e4,0xb,_0xe315('0xe8'));rpcDb[_0xe315('0x90')](_0x35d5e4,_0xe315('0xe9'));_0x5416a2[_0xe315('0xa2')](_0x35d5e4,'11',_0xa31359)[_0xe315('0x83')](function(_0x498fd2){_0x43f52a=_0x498fd2[_0xe315('0xa3')]==0x1;if(!_0x43f52a){if(ut['totalGlobal'](_0x35d5e4)>=_0xa31359[_0xe315('0xa5')]){_0x135a00=ut[_0xe315('0xa6')](_0x35d5e4,0xf,_0xe315('0xa7'));rpcDb[_0xe315('0x93')](_0x135a00,_0xe315('0xe9'));}else{if(_0x35d5e4[_0xe315('0xea')]>=_0xa31359[_0xe315('0xeb')]){rpcDb[_0xe315('0x93')](_0x35d5e4,_0xe315('0xe9'));}else{rpcDb[_0xe315('0xaa')](ut[_0xe315('0xab')](_0x35d5e4,_0xe315('0xe7'),_0xa31359[_0xe315('0xec')]),_0x35d5e4[_0xe315('0xcd')],_0x35d5e4[_0xe315('0xce')]);}}}else{_0x35d5e4[_0xe315('0xd6')]++;_0x5416a2[_0xe315('0xb0')]({'id':_0x35d5e4[_0xe315('0xaf')],'field':{'countnoanswerretry':_0x35d5e4[_0xe315('0xd6')]}})[_0xe315('0x83')](function(){_0x5416a2[_0xe315('0xb1')](_0x35d5e4,_0x233163,_0x1a10b6)[_0xe315('0x83')](function(){});});}});break;case'18':_0xa31359[_0xe315('0xed')]+=0x1;_0x35d5e4[_0xe315('0xee')]+=0x1;_0x35d5e4[_0xe315('0x9c')]=ut[_0xe315('0x9d')](_0x35d5e4);ut[_0xe315('0x8d')](_0x35d5e4,0x12,_0x12454f['cause-txt']||_0x12454f[_0xe315('0xef')]);ami[_0xe315('0x22')](_0xe315('0xf0'),ut['buildObj'](_0x35d5e4,_0xe315('0xf1')));rpcDb[_0xe315('0x90')](_0x35d5e4,'[callProgressDetectingCustomer][hangupInAMD]');_0x5416a2[_0xe315('0xa2')](_0x35d5e4,'18',_0xa31359)['then'](function(_0x684fb){_0x43f52a=_0x684fb['additional']==0x1;if(!_0x43f52a){if(ut[_0xe315('0x9d')](_0x35d5e4)>=_0xa31359[_0xe315('0xa5')]){_0x135a00=ut[_0xe315('0xa6')](_0x35d5e4,0x12,_0xe315('0xa7'));rpcDb['createCustomerFinal'](_0x135a00,_0xe315('0xf2'));}else{rpcDb[_0xe315('0x93')](_0x35d5e4,_0xe315('0xf2'));}}else{_0x35d5e4[_0xe315('0xd6')]++;_0x5416a2['incrementPreviewCounters']({'id':_0x35d5e4['idContact'],'field':{'countnoanswerretry':_0x35d5e4[_0xe315('0xd6')]}})[_0xe315('0x83')](function(){_0x5416a2[_0xe315('0xb1')](_0x35d5e4,_0x233163,_0x1a10b6)[_0xe315('0x83')](function(){});});}});delete this[_0xe315('0x6b')][_0x12454f[_0xe315('0xad')]];break;case'19':_0xa31359['outboundUnknownCallsDay']+=0x1;_0x35d5e4[_0xe315('0x9c')]=ut['totalGlobal'](_0x35d5e4);ut[_0xe315('0x8d')](_0x35d5e4,0x13,_0x12454f['cause-txt']||_0x12454f[_0xe315('0xef')]);ami[_0xe315('0x22')](_0xe315('0xf0'),ut[_0xe315('0x9f')](_0x35d5e4,'amd'));rpcDb[_0xe315('0x90')](_0x35d5e4,_0xe315('0xf3'));_0x5416a2['verifyAdditionalPhones'](_0x35d5e4,'18',_0xa31359)[_0xe315('0x83')](function(_0x2790c5){_0x43f52a=_0x2790c5['additional']==0x1;if(!_0x43f52a){if(ut[_0xe315('0x9d')](_0x35d5e4)>=_0xa31359[_0xe315('0xa5')]){_0x135a00=ut[_0xe315('0xa6')](_0x35d5e4,0xf,_0xe315('0xa7'));rpcDb[_0xe315('0x93')](_0x135a00,_0xe315('0xf3'));}else{rpcDb[_0xe315('0x93')](_0x35d5e4,_0xe315('0xf3'));}}else{_0x35d5e4[_0xe315('0xd6')]++;_0x5416a2[_0xe315('0xb0')]({'id':_0x35d5e4['idContact'],'field':{'countnoanswerretry':_0x35d5e4[_0xe315('0xd6')]}})[_0xe315('0x83')](function(){_0x5416a2['swapAdditionalPhones'](_0x35d5e4,_0x233163,_0x1a10b6)[_0xe315('0x83')](function(){});});}});delete this[_0xe315('0x6b')][_0x12454f[_0xe315('0xad')]];break;default:if(_0x35d5e4['dialAnswer']){ut[_0xe315('0x7b')](_0xa31359,_0xe315('0xf4'));ut[_0xe315('0x7c')](_0xe315('0xf5')+_0xa31359[_0xe315('0x25')],_0x12454f);}_0xa31359[_0xe315('0xed')]+=0x1;_0x35d5e4[_0xe315('0x9c')]=ut[_0xe315('0x9d')](_0x35d5e4);ut[_0xe315('0x8d')](_0x35d5e4,0xc,_0x12454f[_0xe315('0xf6')]||_0x12454f[_0xe315('0xef')]);_0x233163=_0xa31359[_0xe315('0xe3')];_0x1a10b6=_0xa31359['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x35d5e4,_0xe315('0xf7'));_0x5416a2[_0xe315('0xa2')](_0x35d5e4,'20',_0xa31359)[_0xe315('0x83')](function(_0x52e81e){_0x43f52a=_0x52e81e['additional']==0x1;if(!_0x43f52a){if(ut['totalGlobal'](_0x35d5e4)>=_0xa31359[_0xe315('0xa5')]){_0x135a00=ut[_0xe315('0xa6')](_0x35d5e4,0xf,_0xe315('0xa7'));rpcDb[_0xe315('0x93')](_0x135a00,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x35d5e4,_0xe315('0xf8'));}delete this[_0xe315('0x6b')][_0x12454f[_0xe315('0xad')]];}else{_0x5416a2['swapAdditionalPhones'](_0x35d5e4,_0x233163,_0x1a10b6)[_0xe315('0x83')](function(_0x21e868){});}});}if(!(_0x35d5e4[_0xe315('0x6f')]&&_0x5478fb==='16')){ut[_0xe315('0x79')](_0xa31359,_0xe315('0xf9'));logger[_0xe315('0x58')](_0xe315('0xfa'),_0x35d5e4['uniqueid'],'\x20Queue',_0xa31359['name'],_0xe315('0xfb'),_0xa31359[_0xe315('0x4a')]);}if(_0x5478fb!==_0xe315('0xb2')){delete this[_0xe315('0x6b')][_0x12454f[_0xe315('0xad')]];delete this[_0xe315('0x6b')][_0x12454f['destlinkedid']];}}};Preview['prototype'][_0xe315('0xfc')]=function(_0xdba973,_0x1789dd,_0x3b3766){if(_[_0xe315('0xfd')](_0x1789dd)&&_0xe315('0xfe')!==typeof _0x1789dd){return;}if(_[_0xe315('0xfd')](_0x3b3766)&&'object'!==typeof _0x3b3766){return;}switch(_0x3b3766[_0xe315('0xff')]){case'0':ut[_0xe315('0x100')](_0xdba973,0x0,_0xe315('0x9e'));rpcDb[_0xe315('0x101')](_0xdba973,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xe315('0x100')](_0xdba973,0x3,'NoAnswer');rpcDb[_0xe315('0x101')](_0xdba973,_0xe315('0x102'));break;case'5':ut['logAgent'](_0xdba973,0x5,_0xe315('0xc6'));rpcDb[_0xe315('0x101')](_0xdba973,_0xe315('0x103'));break;case'8':ut['logAgent'](_0xdba973,0x8,'Congestion');rpcDb[_0xe315('0x101')](_0xdba973,_0xe315('0x104'));break;case'22':ut['logAgent'](_0xdba973,0x16,_0xe315('0x105'));rpcDb[_0xe315('0x101')](_0xdba973,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xe315('0x100')](_0xdba973,0xc,_0x3b3766[_0xe315('0xff')]);rpcDb[_0xe315('0x101')](_0xdba973,_0xe315('0x104'));}ut[_0xe315('0x79')](_0x1789dd,'[callProgressDetectingAgent]');logger[_0xe315('0x58')](_0xe315('0x106'),_0xdba973[_0xe315('0xc2')],'\x20Queue',_0x1789dd[_0xe315('0x25')],_0xe315('0xfb'),_0x1789dd[_0xe315('0x4a')]);delete this[_0xe315('0x6b')][_0xdba973['uniqueid']];};Preview[_0xe315('0xe')][_0xe315('0xa2')]=function(_0x1e2675,_0x4204ec,_0x280caf){return BPromise[_0xe315('0x107')]()[_0xe315('0x83')](cmHopperAdditionalPhone[_0xe315('0xa2')](_0x1e2675,_0x4204ec,_0x280caf))['catch'](logger[_0xe315('0x58')]('[verifyAdditionalPhone]\x20'));};Preview[_0xe315('0xe')][_0xe315('0xb1')]=function(_0x4b8b7f,_0x4e0346,_0x31ec64){return BPromise[_0xe315('0x107')]()[_0xe315('0x83')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x4b8b7f,_0x4e0346,_0x31ec64))[_0xe315('0x77')](logger[_0xe315('0x58')](_0xe315('0x108')));};Preview[_0xe315('0xe')][_0xe315('0xb0')]=function(_0x31caa0){return BPromise[_0xe315('0x107')]()[_0xe315('0x83')](cmHopperAdditionalPhone[_0xe315('0xb0')](_0x31caa0))[_0xe315('0x77')](logger[_0xe315('0x58')](_0xe315('0x109')));};Preview['prototype'][_0xe315('0x10a')]=function(_0x58dbb6,_0x31a32d,_0x2b3a92,_0x237544,_0x29247a){var _0x578c41=this;return new BPromise(function(_0x1b221c,_0x8ae923){if(_['isNil'](_0x31a32d)||_[_0xe315('0x10b')](_0x31a32d[_0xe315('0x10c')])||_[_0xe315('0x10b')](_0x31a32d[_0xe315('0x10d')])||_[_0xe315('0x10b')](_0x31a32d[_0xe315('0x72')])){_0x8ae923(ut[_0xe315('0x49')](_0xe315('0x10e'),_0x237544,_0x29247a));return;}var _0xfb1921=uuid['v4']();var _0x4f55d7=_0x578c41[_0xe315('0x21')][_0x31a32d[_0xe315('0x10f')][_0xe315('0x25')]];var _0x1f2836=_0x2b3a92?_0x578c41[_0xe315('0x82')][_0x2b3a92]['id']:undefined;_0x578c41['actions'][_0xfb1921]=new Action(_0x31a32d,_0x4f55d7,_0xfb1921,_0x2b3a92,_0x1f2836);var _0x5a7230=_0x578c41[_0xe315('0x6b')][_0xfb1921];_0x5a7230[_0xe315('0xcd')]=_0x237544;_0x5a7230[_0xe315('0xce')]=_0x29247a;_0x5a7230[_0xe315('0x110')]=_0x2b3a92;if(_['isEmpty'](_0x58dbb6)){_0x578c41[_0xe315('0x111')](_0x5a7230,_0x4f55d7,_0x31a32d,_0x2b3a92)['then'](function(_0x53a754){logger[_0xe315('0x58')]('[Preview][execCall][success]',_0xe315('0x112')+_0x5a7230[_0xe315('0x6d')]+'\x20IdHopper:\x20'+_0x5a7230[_0xe315('0xaf')],JSON[_0xe315('0x54')](_0x53a754));ami[_0xe315('0x22')](_0xe315('0x113'),ut[_0xe315('0x9f')](_0x5a7230,_0xe315('0x114'),_0x578c41[_0xe315('0x21')][_0x5a7230[_0xe315('0x6d')]]));_0x1b221c(ut['message'](_0xe315('0x115')));})[_0xe315('0x77')](function(_0x491068){ut[_0xe315('0x61')]('[Preview][execCall][failure]',_0x491068);_0x8ae923(ut[_0xe315('0x49')](_0xe315('0x116'),_0x237544,_0x29247a));});}else{_0x4f55d7['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x5a7230);rpcDb[_0xe315('0x117')](_0x5a7230,_0xe315('0x118'));delete _0x578c41[_0xe315('0x6b')][_0xfb1921];_0x8ae923(ut[_0xe315('0x49')](_0xe315('0x119'),_0x237544,_0x29247a));}});};Preview[_0xe315('0xe')][_0xe315('0x97')]=function(_0x2be1c0){return!_[_0xe315('0x10b')](_0x2be1c0)&&!_['isNil'](_0x2be1c0[_0xe315('0x25')])&&!_[_0xe315('0x10b')](_0x2be1c0['active'])&&_0x2be1c0[_0xe315('0x51')]&&!_['isNil'](this[_0xe315('0x11a')][util[_0xe315('0x55')](_0xe315('0x11b'),_0x2be1c0[_0xe315('0x25')])])&&!_[_0xe315('0x10b')](this[_0xe315('0x11a')][util[_0xe315('0x55')]('SIP/%s',_0x2be1c0['name'])][_0xe315('0x75')])&&(this[_0xe315('0x11a')][util['format'](_0xe315('0x11b'),_0x2be1c0[_0xe315('0x25')])][_0xe315('0x75')]===_0xe315('0x11c')||this['trunks'][util['format'](_0xe315('0x11b'),_0x2be1c0[_0xe315('0x25')])][_0xe315('0x75')]===_0xe315('0x11d'));};Preview[_0xe315('0xe')][_0xe315('0x89')]=function(_0x493450,_0x1166e6){var _0x565c87=this;return new BPromise(function(_0x49558a,_0x4d7535){_0x565c87[_0xe315('0x11e')](_0x493450,_0x1166e6)[_0xe315('0x83')](function(_0x4339b4){_0x49558a(_[_0xe315('0x70')](_0x4339b4,[_0xe315('0x49')]));})['catch'](function(_0x5a6142){if(_0x5a6142['unlock']){rpcDb[_0xe315('0x11f')](_0x493450);}if(_0x5a6142['active']){rpcDb[_0xe315('0x120')](_0x493450);}_0x4d7535(_['pick'](_0x5a6142,[_0xe315('0x49')]));});});};Preview[_0xe315('0xe')]['execRun']=function(_0x51cfc9,_0xcbc19b){var _0x5b94ae=this;return new BPromise(function(_0x4d791f,_0x69ef67){var _0x4bd8bd,_0x5423f7;rpcDb[_0xe315('0x121')](_0x51cfc9)[_0xe315('0x83')](function(_0x44ea01){if(!_['isNil'](_0x44ea01[0x0])){_0x5423f7=_0x44ea01[0x0][_0xe315('0x122')]?![]:!![];_0x4bd8bd=_0x44ea01[0x0][_0xe315('0x122')]?!![]:![];_0x4bd8bd=_0xcbc19b?!![]:_0x4bd8bd;}var _0x47ff75=_0x5b94ae[_0xe315('0x123')](_0x44ea01);if(_0x47ff75[_0xe315('0x124')]){rpcDb[_0xe315('0x125')](_[_0xe315('0x70')](_0x44ea01[0x0],['VoiceQueueId','phone']))[_0xe315('0x83')](function(_0x1a64dc){_0x5b94ae['checkInBlack'](_0x1a64dc,_0x44ea01[0x0],_0xcbc19b,_0x5423f7,_0x4bd8bd)[_0xe315('0x83')](function(_0x5c3a57){_0x4d791f(_0x5c3a57);})[_0xe315('0x77')](function(_0x133a39){_0x69ef67(_0x133a39);});})[_0xe315('0x77')](function(_0x23a00c){ut[_0xe315('0x61')](_0xe315('0x126'),_0x23a00c);_0x69ef67(ut['message']('Call\x20unsuccessful',_0x5423f7,_0x4bd8bd));});}else{_0x69ef67(ut['message'](_0x47ff75[_0xe315('0x49')],_0x5423f7,_0x4bd8bd));}})[_0xe315('0x77')](function(_0x36f337){ut[_0xe315('0x61')](_0xe315('0x127'),_0x36f337);_0x69ef67(ut[_0xe315('0x49')](_0xe315('0x128'),![],!![]));});});};Preview['prototype'][_0xe315('0x123')]=function(_0x558b00){if(_['isNil'](_0x558b00)||_['isEmpty'](_0x558b00)||!_[_0xe315('0x10b')](_0x558b00[0x0][_0xe315('0x87')])&&_[_0xe315('0x10b')](_0x558b00[0x0][_0xe315('0x87')]['name'])){ut['logger'](_0xe315('0x129'),_0x558b00);return{'isValid':![],'message':_0xe315('0x12a')};}var _0x5bb982=this['campaignsPreview'][_0x558b00[0x0]['Queue'][_0xe315('0x25')]];_0x5bb982[_0xe315('0x49')]=_0xe315('0x99');if(_[_0xe315('0x10b')](_0x5bb982)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x5bb982);return{'isValid':![],'message':_0xe315('0x12b')};}if(!this[_0xe315('0x97')](_0x5bb982[_0xe315('0x50')])){ut['logger'](_0xe315('0x12c'),_0xe315('0x12d')+_0x5bb982[_0xe315('0x25')]+_0xe315('0x12e'));if(!this['isTrunkReachable'](_0x5bb982[_0xe315('0x98')])){ut['logger'](_0xe315('0x12c'),_0x5bb982[_0xe315('0x25')]+_0xe315('0x12f'));return{'isValid':![],'message':_0xe315('0x130')};}}if(!ut[_0xe315('0x95')](_0x5bb982[_0xe315('0x30')])){ut['logger'](_0xe315('0x131'),_0x5bb982[_0xe315('0x25')]+_0xe315('0x132'));return{'isValid':![],'message':_0xe315('0x12d')+_0x5bb982[_0xe315('0x25')]+_0xe315('0x132')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xe315('0xe')][_0xe315('0x111')]=function(_0x43e923,_0x10bb9a,_0x563c4a,_0x4c3865){var _0x23ca08=this;return new BPromise(function(_0x3afa95,_0x42bb43){var _0x20cf7f=_0x43e923[_0xe315('0xc2')];var _0xe048d1=_0x23ca08[_0xe315('0x97')](_0x10bb9a['Trunk'])?util[_0xe315('0x55')]('SIP/%s/%s%s',_0x10bb9a[_0xe315('0x50')][_0xe315('0x25')],_['isNil'](_0x10bb9a['dialPrefix'])?'':_0x10bb9a[_0xe315('0x34')]['trim']()||'',_0x10bb9a[_0xe315('0x133')]>0x0?_0x563c4a[_0xe315('0x10d')][_0xe315('0x134')](_0x10bb9a[_0xe315('0x133')]):_0x563c4a[_0xe315('0x10d')]):util['format'](_0xe315('0x135'),_[_0xe315('0x10b')](_0x10bb9a[_0xe315('0x98')])?_0x10bb9a['Trunk'][_0xe315('0x25')]:_0x10bb9a[_0xe315('0x98')][_0xe315('0x25')],_[_0xe315('0x10b')](_0x10bb9a[_0xe315('0x34')])?'':_0x10bb9a[_0xe315('0x34')]['trim']()||'',_0x10bb9a[_0xe315('0x133')]>0x0?_0x563c4a[_0xe315('0x10d')][_0xe315('0x134')](_0x10bb9a[_0xe315('0x133')]):_0x563c4a[_0xe315('0x10d')]);var _0x80b0bf=_0x23ca08[_0xe315('0x97')](_0x10bb9a[_0xe315('0x50')])?ut[_0xe315('0x136')](_0x10bb9a[_0xe315('0x50')][_0xe315('0x52')],_0x10bb9a['dialOriginateCallerIdName'],_0x10bb9a[_0xe315('0x137')]>0x0?ut[_0xe315('0x138')](_0x10bb9a[_0xe315('0x33')],_0x10bb9a[_0xe315('0x137')]):_0x10bb9a[_0xe315('0x33')]):ut['getCallerId'](_[_0xe315('0x10b')](_0x10bb9a['TrunkBackup'])?_0x10bb9a[_0xe315('0x50')]['callerid']:_0x10bb9a['TrunkBackup'][_0xe315('0x52')],_0x10bb9a[_0xe315('0x32')],_0x10bb9a[_0xe315('0x137')]>0x0?ut[_0xe315('0x138')](_0x10bb9a[_0xe315('0x33')],_0x10bb9a[_0xe315('0x137')]):_0x10bb9a[_0xe315('0x33')]);if(_0x80b0bf){_0x43e923[_0xe315('0x139')]=ut[_0xe315('0x13a')](_0x80b0bf);_0x43e923[_0xe315('0x13b')]=ut[_0xe315('0x13c')](_0x80b0bf);}var _0x1b69a5=ut[_0xe315('0x13d')](_0x10bb9a,_0x563c4a,_0xe048d1,_0x80b0bf,_0x20cf7f,_0x43e923);_[_0xe315('0x13e')](_0x43e923,ut[_0xe315('0x13f')](_0x1b69a5));_0x43e923[_0xe315('0x140')]=moment()[_0xe315('0x55')](_0xe315('0x8c'));ami['Action'](ut[_0xe315('0x141')](_0x43e923,_0x10bb9a,_0x1b69a5,_0x43e923[_0xe315('0xce')],_0x4c3865))[_0xe315('0x83')](function(_0x526695){var _0x15aa5a=_0x43e923[_0xe315('0x142')];if(!_[_0xe315('0x10b')](_0x15aa5a)){if(!_[_0xe315('0x10b')](_0x23ca08[_0xe315('0x82')][_0x15aa5a])){_0x23ca08[_0xe315('0x82')][_0x15aa5a][_0xe315('0x143')]=_0x43e923[_0xe315('0x144')];emit(util[_0xe315('0x55')]('user:%s',_0x23ca08[_0xe315('0x82')][_0x15aa5a][_0xe315('0x25')]),_0xe315('0x145'),{'destaccountcode':_0x23ca08['agents'][_0x15aa5a]['accountcode'],'destconnectedlinenum':_0x43e923['calleridnum']});}}_0x10bb9a[_0xe315('0x4a')]+=0x1;logger['info'](_0xe315('0x146'),_0x20cf7f,_0xe315('0xb4'),_0x10bb9a['name'],_0xe315('0xfb'),_0x10bb9a[_0xe315('0x4a')]);_0x3afa95(_0x526695);})['catch'](function(_0x16336b){ut[_0xe315('0x100')](_0x43e923,0xe,_0xe315('0x147'));rpcDb[_0xe315('0x101')](_0x43e923,_0xe315('0x148'));_0x42bb43(_0x16336b);});});};Preview[_0xe315('0xe')][_0xe315('0x149')]=function(_0x36c65f){if(this[_0xe315('0x6b')][_0x36c65f[_0xe315('0xad')]]){this[_0xe315('0x6b')][_0x36c65f[_0xe315('0xad')]][_0xe315('0x76')]=_0x36c65f['channel'];}};Preview[_0xe315('0xe')][_0xe315('0x14a')]=function(_0x2153df){var _0x3a6e1d=this;var _0x2d8157=this[_0xe315('0x6b')][_0x2153df[_0xe315('0x14b')]];if(_0x2d8157){if(_0x2d8157[_0xe315('0x110')]&&this[_0xe315('0x82')][_0x2d8157[_0xe315('0x110')]]){ut[_0xe315('0x14c')](_0x2d8157,this[_0xe315('0x82')][_0x2d8157['lookAgent']]['name'],this[_0xe315('0x82')][_0x2d8157['lookAgent']]['id']);}var _0x5d547e=_[_0xe315('0x14d')](_0x2d8157);_0x5d547e['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x45e788=_0x3a6e1d[_0xe315('0x21')][_0x2d8157[_0xe315('0x6d')]];if(ut['isFailure'](_0x2153df['response'])){if(_0x2d8157[_0xe315('0xcd')]){rpcDb[_0xe315('0x11f')](_0x2d8157['idContact']);}if(_0x2d8157[_0xe315('0xce')]){rpcDb[_0xe315('0x120')](_0x2d8157[_0xe315('0xaf')]);}ami[_0xe315('0x22')](_0xe315('0x14e'),ut[_0xe315('0x9f')](_0x2d8157,'rejected',this['campaignsPreview'][_0x2d8157['queue']]));this[_0xe315('0xfc')](_0x5d547e,_0x45e788,_0x2153df);}else{_0x2d8157[_0xe315('0x140')]=moment()[_0xe315('0x55')](_0xe315('0x8c'));ut[_0xe315('0x100')](_0x5d547e,0x4,_0xe315('0xbc'));rpcDb[_0xe315('0x101')](_0x5d547e,_0xe315('0x14f'));}}};Preview['prototype'][_0xe315('0x15')]=function(_0x205656){var _0x50cce7=this;var _0xb2f6ce=this[_0xe315('0x6b')][_0x205656[_0xe315('0xad')]];var _0x2ae711;if(_0xb2f6ce){_0x2ae711=this[_0xe315('0x21')][_0xb2f6ce[_0xe315('0x6d')]];logger[_0xe315('0x58')](_0xe315('0x150'),_0x205656['linkedid'],'\x20Queue',_0x2ae711[_0xe315('0x25')],_0xe315('0x6e'),_0x2ae711['pTalking']);}if(this[_0xe315('0x6b')][_0x205656[_0xe315('0xad')]]&&_0x205656[_0xe315('0xad')]!==_0x205656[_0xe315('0xc2')]){if(_0x205656['cause']==='16'&&this[_0xe315('0x6b')][_0x205656['linkedid']][_0xe315('0x6f')]){this['callProgressDetectingCustomer'](_0x205656,_0x205656[_0xe315('0xad')],_0x205656[_0xe315('0x151')]);}else if(this['actions'][_0x205656['linkedid']][_0xe315('0x6f')]){logger[_0xe315('0x58')]('[syncHangup][talking][cause]',_0x205656[_0xe315('0xad')],_0x205656[_0xe315('0x151')],'\x20Queue',_0x2ae711[_0xe315('0x25')],_0xe315('0x6e'),_0x2ae711['pTalking']);this['callProgressDetectingCustomer'](_0x205656,_0x205656[_0xe315('0xad')],_0x205656[_0xe315('0x151')]);}}else if(_0xb2f6ce&&_['isNil'](_0xb2f6ce[_0xe315('0x152')])&&_0x2ae711[_0xe315('0x153')]&&_0x205656['linkedid']===_0x205656[_0xe315('0xc2')]&&_[_0xe315('0x10b')](_0x205656['reason'])&&_0x205656[_0xe315('0x151')]==='16'&&_0x205656[_0xe315('0x154')]==='6'&&_[_0xe315('0xfd')](_0xb2f6ce['transfer'])){if(_0xb2f6ce[_0xe315('0xcd')]){rpcDb[_0xe315('0x11f')](_0xb2f6ce[_0xe315('0xaf')]);}if(_0xb2f6ce['activeContact']){rpcDb[_0xe315('0x120')](_0xb2f6ce[_0xe315('0xaf')]);}_0x205656[_0xe315('0xff')]='22';this[_0xe315('0xfc')](_0xb2f6ce,_0x2ae711,_0x205656);}else if(_0xb2f6ce&&_0xb2f6ce[_0xe315('0x155')]){if(_0x205656[_0xe315('0x151')]==='16'&&this[_0xe315('0x6b')][_0x205656['linkedid']][_0xe315('0x6f')]){logger[_0xe315('0x58')](_0xe315('0x156'),_0x205656[_0xe315('0xad')],_0x205656['cause'],'\x20Queue',_0x2ae711[_0xe315('0x25')],_0xe315('0x6e'),_0x2ae711[_0xe315('0x29')]);this[_0xe315('0x9a')](_0x205656,_0x205656[_0xe315('0xad')],_0x205656[_0xe315('0x151')]);}else if(this[_0xe315('0x6b')][_0x205656[_0xe315('0xad')]][_0xe315('0x6f')]){logger[_0xe315('0x58')](_0xe315('0x157'),_0x205656[_0xe315('0xad')],_0x205656[_0xe315('0x151')],_0xe315('0xb4'),_0x2ae711[_0xe315('0x25')],_0xe315('0x6e'),_0x2ae711[_0xe315('0x29')]);this[_0xe315('0x9a')](_0x205656,_0x205656[_0xe315('0xad')],_0x205656[_0xe315('0x151')]);}}};Preview[_0xe315('0xe')][_0xe315('0x19')]=function(_0x3ef128){if(this[_0xe315('0x6b')][_0x3ef128[_0xe315('0x158')]]&&_0x3ef128['destlinkedid']!==_0x3ef128[_0xe315('0x159')]){this['callProgressDetectingCustomer'](_0x3ef128,_0x3ef128['destlinkedid'],_0x3ef128['dialstatus']);}};Preview['prototype'][_0xe315('0x18')]=function(_0x127e45){if(this[_0xe315('0x6b')][_0x127e45[_0xe315('0xad')]]&&_0x127e45[_0xe315('0xad')]!==_0x127e45[_0xe315('0xc2')]&&!this[_0xe315('0x6b')][_0x127e45[_0xe315('0xad')]][_0xe315('0x6f')]){if(_0x127e45['cause']==='1'){this[_0xe315('0x9a')](_0x127e45,_0x127e45[_0xe315('0xad')],_0x127e45['cause']);}}};Preview[_0xe315('0xe')]['addVariable']=function(_0x1ac9fd,_0x4938f5,_0x3f0035){if(this['actions'][_0x1ac9fd]){if(_['isNil'](this[_0xe315('0x6b')][_0x1ac9fd][_0xe315('0x15a')])){this[_0xe315('0x6b')][_0x1ac9fd][_0xe315('0x15a')]={};}this['actions'][_0x1ac9fd][_0xe315('0x15a')][_0x4938f5]=_0x3f0035;}};Preview[_0xe315('0xe')]['syncVarSet']=function(_0x1cdf60){try{if(!_[_0xe315('0x10b')](_0x1cdf60)){if(ut[_0xe315('0x15b')](_[_0xe315('0x15c')](_0x1cdf60[_0xe315('0x15d')])[0x0])){this[_0xe315('0x15e')](_0x1cdf60[_0xe315('0xc2')],_['keys'](_0x1cdf60[_0xe315('0x15d')])[0x0],_0x1cdf60[_0xe315('0x15f')]);}}}catch(_0x2dc273){logger['error'](_0xe315('0x160'),util[_0xe315('0x161')](_0x2dc273,{'showHidden':![],'depth':null}));}};Preview[_0xe315('0xe')][_0xe315('0x1e')]=function(_0x56b1a9){if(_0x56b1a9){if(this['actions'][_0x56b1a9[_0xe315('0x162')]]){this[_0xe315('0x6b')][_0x56b1a9[_0xe315('0x162')]][_0xe315('0x155')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x207eac){if(_0x207eac){if(this['actions'][_0x207eac[_0xe315('0x163')]]){this['actions'][_0x207eac[_0xe315('0x163')]][_0xe315('0x155')]=!![];}}};module[_0xe315('0x164')]=Preview; \ No newline at end of file +var _0x0065=['\x20Queue','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','Global','activeContact','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','Contact','VoiceQueueId','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','run','execRun','unlockContact','getContactPreview','recallme','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','trim','phone','SIP/%s/%s%s','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','variablesAction','destconnectedlinenum','calleridnum','user:%s','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','dialQueueProject','cause','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','syncHangupRequest','syncDialEnd','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','available','pTalking','sumBillable','sumDuration','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','format','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','campaignsPreview','hasOwnProperty','booked','clearZombieChannels','recallMe','clearZombieChannel','enqueue','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','uniqueid'];(function(_0x1a84fc,_0x32fb6f){var _0x178d3a=function(_0x50cadc){while(--_0x50cadc){_0x1a84fc['push'](_0x1a84fc['shift']());}};_0x178d3a(++_0x32fb6f);}(_0x0065,0x97));var _0x5006=function(_0x3dbf08,_0x1bbc94){_0x3dbf08=_0x3dbf08-0x0;var _0x258697=_0x0065[_0x3dbf08];return _0x258697;};'use strict';var util=require('util');var _=require(_0x5006('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require(_0x5006('0x1'));var Redis=require(_0x5006('0x2'));var config=require(_0x5006('0x3'));var logger=require(_0x5006('0x4'))(_0x5006('0x5'));var loggerAction=require(_0x5006('0x4'))(_0x5006('0x6'));var ami=require(_0x5006('0x7'));var rpcDb=require(_0x5006('0x8'));var cmHopperAdditionalPhone=require(_0x5006('0x9'));var Action=require(_0x5006('0xa'));var ut=require(_0x5006('0xb'));config[_0x5006('0xc')]=_[_0x5006('0xd')](config[_0x5006('0xc')],{'host':_0x5006('0xe'),'port':0x18eb});var io=require(_0x5006('0xf'))(new Redis(config[_0x5006('0xc')]));var Sequence=function(){};Sequence[_0x5006('0x10')]['enqueue']=function(_0x2ecb42){this[_0x5006('0x11')]=this[_0x5006('0x11')]?this[_0x5006('0x11')][_0x5006('0x12')](_0x2ecb42):_0x2ecb42();};function Preview(_0x7706ba){this[_0x5006('0x13')]=new Sequence();this['campaignsPreview']=_0x7706ba['voiceQueues'];this[_0x5006('0x14')]=_0x7706ba[_0x5006('0x14')];this[_0x5006('0x15')]={};this['agents']=_0x7706ba[_0x5006('0x16')];this[_0x5006('0x17')]=0x0;ami['on'](_0x5006('0x18'),this['syncOriginateResponse'][_0x5006('0x19')](this));ami['on']('hangup',this[_0x5006('0x1a')][_0x5006('0x19')](this));ami['on']('hanguprequest',this[_0x5006('0x1b')][_0x5006('0x19')](this));ami['on']('dialend',this[_0x5006('0x1c')][_0x5006('0x19')](this));ami['on'](_0x5006('0x1d'),this[_0x5006('0x1e')][_0x5006('0x19')](this));ami['on']('varset',this[_0x5006('0x1f')][_0x5006('0x19')](this));ami['on']('attendedtransfer',this[_0x5006('0x20')][_0x5006('0x19')](this));ami['on'](_0x5006('0x21'),this[_0x5006('0x22')][_0x5006('0x19')](this));this[_0x5006('0x23')](this['campaignsPreview']);}function emit(_0x5b3767,_0x27edbe,_0x3262e5){io['to'](_0x5b3767)['emit'](_0x27edbe,_0x3262e5);}function emitCampaignPreview(_0x5791d4){if(_0x5791d4[_0x5006('0x24')]===_0x5006('0x25')){var _0x1a4c1c={'id':_0x5791d4['id'],'name':_0x5791d4[_0x5006('0x26')],'strategy':_0x5791d4['strategy'],'answered':_0x5791d4['answered'],'available':_0x5791d4[_0x5006('0x27')],'loggedIn':_0x5791d4['loggedIn'],'pTalking':_0x5791d4[_0x5006('0x28')],'sumBillable':_0x5791d4[_0x5006('0x29')],'sumDuration':_0x5791d4[_0x5006('0x2a')],'sumHoldTime':_0x5791d4['sumHoldTime']||0x0,'talking':_0x5791d4['talking'],'total':_0x5791d4[_0x5006('0x2b')],'type':_0x5791d4['type'],'unmanaged':_0x5791d4[_0x5006('0x2c')],'abandoned':_0x5791d4[_0x5006('0x2d')],'waiting':_0x5791d4[_0x5006('0x2e')],'loggedInDb':_0x5791d4[_0x5006('0x2f')],'dialActive':_0x5791d4[_0x5006('0x30')],'dialMethod':_0x5791d4[_0x5006('0x31')],'dialOriginateCallerIdName':_0x5791d4['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5791d4['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5791d4[_0x5006('0x32')],'dialPrefix':_0x5791d4[_0x5006('0x33')],'outboundAnswerAgiCallsDay':_0x5791d4[_0x5006('0x34')],'outboundAnswerCallsDay':_0x5791d4[_0x5006('0x35')],'outboundBlacklistCallsDay':_0x5791d4['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5791d4[_0x5006('0x36')],'outboundCongestionCallsDay':_0x5791d4[_0x5006('0x37')],'outboundDropCallsDayACS':_0x5791d4[_0x5006('0x38')],'outboundDropCallsDayCallersExit':_0x5791d4[_0x5006('0x39')],'outboundDropCallsDayTimeout':_0x5791d4[_0x5006('0x3a')],'outboundNoAnswerCallsDay':_0x5791d4['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5791d4[_0x5006('0x3b')],'outboundOriginateFailureCallsDay':_0x5791d4['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5791d4[_0x5006('0x3c')],'outboundRejectCallsDay':_0x5791d4[_0x5006('0x3d')],'outboundUnknownCallsDay':_0x5791d4[_0x5006('0x3e')],'outboundAbandonedCallsDay':_0x5791d4[_0x5006('0x3f')],'predictiveIntervalAnsweredCalls':_0x5791d4[_0x5006('0x40')],'predictiveIntervalAvgHoldtime':_0x5791d4[_0x5006('0x41')],'predictiveIntervalAvgTalktime':_0x5791d4[_0x5006('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x5791d4[_0x5006('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x5791d4[_0x5006('0x44')],'predictiveIntervalErlangCalls':_0x5791d4[_0x5006('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x5791d4[_0x5006('0x46')],'predictiveIntervalHitRate':_0x5791d4[_0x5006('0x47')],'predictiveIntervalMultiplicativeFactor':_0x5791d4['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5791d4[_0x5006('0x48')],'predictiveIntervalAvailable':_0x5791d4['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5791d4[_0x5006('0x49')],'message':_0x5791d4[_0x5006('0x4a')],'originated':_0x5791d4[_0x5006('0x4b')],'erlangCalls':_0x5791d4['erlangCalls'],'erlangCallToSecond':_0x5791d4[_0x5006('0x4c')],'erlangAbandonmentRate':_0x5791d4['erlangAbandonmentRate'],'erlangBusyFactor':_0x5791d4[_0x5006('0x4d')],'startPredictive':_0x5791d4[_0x5006('0x4e')],'startProgressive':_0x5791d4[_0x5006('0x4f')]};if(_0x5791d4[_0x5006('0x50')]){_0x1a4c1c[_0x5006('0x50')]={'id':_0x5791d4[_0x5006('0x50')]['id'],'name':_0x5791d4[_0x5006('0x50')][_0x5006('0x26')],'active':_0x5791d4[_0x5006('0x50')]['active'],'callerid':_0x5791d4[_0x5006('0x50')][_0x5006('0x51')]};}if(_0x5791d4[_0x5006('0x52')]){_0x1a4c1c[_0x5006('0x52')]={'id':_0x5791d4['Interval']['id'],'name':_0x5791d4[_0x5006('0x52')][_0x5006('0x26')]};}var _0x40f365=md5(JSON[_0x5006('0x53')](_0x1a4c1c));if(_0x5791d4[_0x5006('0x1')]!==_0x40f365){_0x5791d4[_0x5006('0x1')]=_0x40f365;emit(util['format'](_0x5006('0x54'),_0x1a4c1c[_0x5006('0x26')]),_0x5006('0x55'),_0x1a4c1c);}}}function emitVoiceQueueChannelRemove(_0x36e258){logger[_0x5006('0x56')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x5006('0x53')](_0x36e258));emit(util[_0x5006('0x57')](_0x5006('0x54'),_0x36e258[_0x5006('0x26')]),_0x5006('0x58'),_0x36e258);io[_0x5006('0x59')](_0x5006('0x5a'),_0x36e258);}function notSendMessagesQueue(_0x4a68f8){if(_0x4a68f8[_0x5006('0x5b')]){if(_0x4a68f8[_0x5006('0x4b')]===0x0&&_0x4a68f8[_0x5006('0x28')]===0x0){_0x4a68f8[_0x5006('0x5b')]=![];_0x4a68f8[_0x5006('0x27')]=0x0;_0x4a68f8[_0x5006('0x5c')]=0x0;_0x4a68f8[_0x5006('0x4a')]=_0x5006('0x5d');ut[_0x5006('0x5e')](_0x5006('0x5f'),_0x4a68f8[_0x5006('0x26')]+_0x5006('0x60'));}else{_0x4a68f8[_0x5006('0x4a')]=_0x5006('0x61');ut[_0x5006('0x5e')](_0x5006('0x5f'),_0x4a68f8[_0x5006('0x26')]+_0x5006('0x62'));}emitCampaignPreview(_0x4a68f8);}}Preview[_0x5006('0x10')]['loopCampaigns']=function(){var _0x227298=this;setInterval(function(){_0x227298[_0x5006('0x63')]();},0x7cf);};Preview[_0x5006('0x10')][_0x5006('0x63')]=function(){var _0x45de17=this[_0x5006('0x64')];this[_0x5006('0x17')]+=0x1;for(var _0x1e28df in _0x45de17){if(_0x45de17[_0x5006('0x65')](_0x1e28df)&&(_0x45de17[_0x1e28df][_0x5006('0x31')]===_0x5006('0x5')||_0x45de17[_0x1e28df][_0x5006('0x31')]===_0x5006('0x66'))&&_0x45de17[_0x1e28df][_0x5006('0x24')]===_0x5006('0x25')){if(this[_0x5006('0x17')]>0x7){this[_0x5006('0x17')]=0x0;this[_0x5006('0x67')]();}}if(_0x45de17[_0x5006('0x65')](_0x1e28df)&&_0x45de17[_0x1e28df][_0x5006('0x31')]==='preview'&&_0x45de17[_0x1e28df][_0x5006('0x24')]===_0x5006('0x25')){if(_0x45de17[_0x1e28df]['dialActive']){this['setMessage'](_0x45de17[_0x1e28df]);this[_0x5006('0x68')](_0x45de17[_0x1e28df]);}else{notSendMessagesQueue(_0x45de17[_0x1e28df]);}}}};Preview[_0x5006('0x10')][_0x5006('0x69')]=function(_0x57a8e4){var _0xaa39c2=this;this[_0x5006('0x13')][_0x5006('0x6a')](function(){if(!_[_0x5006('0x6b')](_0xaa39c2[_0x5006('0x15')][_0x57a8e4])){loggerAction[_0x5006('0x56')]('[clearZombieChannels][talking]',_0x57a8e4,_0x5006('0x6c'),_0xaa39c2['actions'][_0x57a8e4][_0x5006('0x6d')],_0x5006('0x6e'),JSON[_0x5006('0x53')](_0xaa39c2[_0x5006('0x64')][_0xaa39c2['actions'][_0x57a8e4][_0x5006('0x6d')]][_0x5006('0x4b')]),_0x5006('0x6f'),JSON[_0x5006('0x53')](_0xaa39c2[_0x5006('0x64')][_0xaa39c2[_0x5006('0x15')][_0x57a8e4][_0x5006('0x6d')]][_0x5006('0x28')]),JSON[_0x5006('0x53')](_0xaa39c2['actions'][_0x57a8e4][_0x5006('0x70')]),JSON[_0x5006('0x53')](_[_0x5006('0x71')](_0xaa39c2['actions'][_0x57a8e4],['contactId','UserId','VoiceQueueId',_0x5006('0x72')])));return ami[_0x5006('0x73')]({'action':_0x5006('0x74'),'channel':_0xaa39c2[_0x5006('0x15')][_0x57a8e4][_0x5006('0x75')]})[_0x5006('0x76')](function(_0x54a50e){if(_0x54a50e[_0x5006('0x4a')]===_0x5006('0x77')){setTimeout(function(){if(_0xaa39c2[_0x5006('0x15')][_0x57a8e4]){ut['updateOriginated'](_0xaa39c2[_0x5006('0x64')][_0xaa39c2['actions'][_0x57a8e4][_0x5006('0x6d')]],_0x5006('0x78'));if(_0xaa39c2[_0x5006('0x15')][_0x57a8e4][_0x5006('0x70')]===!![]){ut[_0x5006('0x79')](_0xaa39c2['campaignsPreview'][_0xaa39c2[_0x5006('0x15')][_0x57a8e4][_0x5006('0x6d')]],_0x5006('0x78'));ut[_0x5006('0x7a')](_0x5006('0x7b')+_0x57a8e4,_0xaa39c2['actions'][_0x57a8e4]['queue']);}ut[_0x5006('0x7a')](_0x5006('0x7c')+_0x57a8e4,_0xaa39c2['actions'][_0x57a8e4][_0x5006('0x6d')]);delete _0xaa39c2[_0x5006('0x15')][_0x57a8e4];}},0x2328);}});}});};Preview['prototype'][_0x5006('0x67')]=function(){var _0x39ac60=this;loggerAction[_0x5006('0x56')](_0x5006('0x7d'),_[_0x5006('0x7e')](this[_0x5006('0x15')]));for(var _0x95d774 in this['actions']){if(_0x39ac60['actions'][_0x5006('0x65')](_0x95d774)){_0x39ac60[_0x5006('0x69')](_0x95d774);}}};Preview[_0x5006('0x10')]['recallMe']=function(_0x518c3c){var _0x4925e3=this;rpcDb['getContactRecallMe'](_0x518c3c['id'],ut[_0x5006('0x7f')](this[_0x5006('0x16')]))[_0x5006('0x80')](function(_0x3f77f4){if(!_['isNil'](_0x3f77f4)){for(var _0x32216b=0x0;_0x32216b<_0x3f77f4['length'];_0x32216b+=0x1){if(ut['getDiff'](_0x3f77f4[_0x32216b][_0x5006('0x81')])<_0x518c3c[_0x5006('0x82')]*0x3c){if(_0x3f77f4[_0x32216b][_0x5006('0x83')]&&!_0x3f77f4[_0x32216b][_0x5006('0x83')][_0x5006('0x84')]){_0x4925e3['run'](_0x3f77f4[_0x32216b]['id'])[_0x5006('0x80')](ut[_0x5006('0x85')](_0x5006('0x86')))['catch'](ut[_0x5006('0x85')]('[RecallMe]'));}else{rpcDb[_0x5006('0x87')](_0x3f77f4[_0x32216b]['id']);}}else{var _0x32c8b3=new Action(_0x3f77f4[_0x32216b],_0x518c3c);_0x32c8b3[_0x5006('0x88')]=moment()['format'](_0x5006('0x89'));_0x518c3c[_0x5006('0x3c')]+=0x1;ut[_0x5006('0x8a')](_0x32c8b3,0x17,_0x5006('0x8b'));if(_0x518c3c[_0x5006('0x8c')]){rpcDb[_0x5006('0x8d')](ut['createBody'](_0x3f77f4[_0x32216b]));rpcDb[_0x5006('0x8e')](_0x32c8b3,_0x5006('0x8f'));}else{ut[_0x5006('0x8a')](_0x32c8b3,0x16,_0x5006('0x90'));rpcDb['createCustomerHistory'](_0x32c8b3,_0x5006('0x91'));rpcDb[_0x5006('0x92')](_0x32c8b3,'[HistoryRecallClose]');}}}}})[_0x5006('0x76')](ut['logger2'](_0x5006('0x93')));};Preview['prototype'][_0x5006('0x94')]=function(_0x42fb56){_0x42fb56[_0x5006('0x5b')]=!![];if(ut[_0x5006('0x95')](_0x42fb56['loggedIn'])){_0x42fb56[_0x5006('0x4a')]=_0x5006('0x96');}else if(!ut[_0x5006('0x97')](_0x42fb56['dialActive'])){_0x42fb56[_0x5006('0x4a')]=_0x5006('0x5d');}else if(!this[_0x5006('0x98')](_0x42fb56[_0x5006('0x50')])){if(!this[_0x5006('0x98')](_0x42fb56['TrunkBackup'])){_0x42fb56[_0x5006('0x4a')]=_0x5006('0x99');}else{_0x42fb56[_0x5006('0x4a')]=_0x5006('0x9a');}}else{_0x42fb56[_0x5006('0x4a')]=_0x5006('0x9a');}emitCampaignPreview(_0x42fb56);};Preview[_0x5006('0x10')][_0x5006('0x9b')]=function(_0x4c4885,_0x433e82,_0x55c8ae){var _0x124b15=this;var _0x564c3b=this[_0x5006('0x15')][_0x433e82];var _0x4b6cbb=this['campaignsPreview'][_0x564c3b[_0x5006('0x6d')]];var _0x26d88e;var _0x11d1ef=![];var _0x2cbf24=0x2;var _0x19c78b=0x3;if(_0x4b6cbb){switch(_0x55c8ae){case'1':_0x4b6cbb[_0x5006('0x3b')]+=0x1;_0x564c3b[_0x5006('0x9c')]+=0x1;_0x564c3b[_0x5006('0x9d')]=ut[_0x5006('0x9e')](_0x564c3b);ut[_0x5006('0x8a')](_0x564c3b,0x0,_0x5006('0x9f'));ami['emit']('custom:agentnosuchnumber',ut[_0x5006('0xa0')](_0x564c3b,_0x5006('0xa1')));rpcDb['createCustomerHistory'](_0x564c3b,_0x5006('0xa2'));_0x124b15[_0x5006('0xa3')](_0x564c3b,'0',_0x4b6cbb)[_0x5006('0x80')](function(_0x231818){_0x11d1ef=_0x231818[_0x5006('0xa4')]==0x1;_0x2cbf24=_0x4b6cbb[_0x5006('0xa5')];_0x19c78b=_0x4b6cbb[_0x5006('0xa6')];if(!_0x11d1ef){if(ut['totalGlobal'](_0x564c3b)>=_0x4b6cbb[_0x5006('0xa7')]){_0x26d88e=ut['cloneAction'](_0x564c3b,0xf,'Global');rpcDb['createCustomerFinal'](_0x26d88e,_0x5006('0xa8'));}else{if(_0x564c3b[_0x5006('0x9c')]>=_0x4b6cbb['dialNoSuchNumberMaxRetry']){rpcDb[_0x5006('0x92')](_0x564c3b,_0x5006('0xa8'));}else{rpcDb[_0x5006('0xa9')](ut[_0x5006('0xaa')](_0x564c3b,_0x5006('0x9c'),_0x4b6cbb[_0x5006('0xa5')]),_0x564c3b[_0x5006('0xab')],_0x564c3b['activeContact']);}}delete this[_0x5006('0x15')][_0x4c4885[_0x5006('0xac')]];}else{_0x564c3b[_0x5006('0x9c')]++;logger[_0x5006('0x56')](_0x5006('0xad'),_0x564c3b['countnosuchnumberretry']);logger[_0x5006('0x56')]('id',_0x564c3b['idContact']);_0x124b15[_0x5006('0xae')]({'id':_0x564c3b[_0x5006('0xaf')],'field':{'countnosuchnumberretry':_0x564c3b['countnosuchnumberretry']}})[_0x5006('0x80')](function(){_0x124b15[_0x5006('0xb0')](_0x564c3b,_0x2cbf24,_0x19c78b)['then'](function(){});});}});break;case _0x5006('0xb1'):var _0x1f10f8=moment()[_0x5006('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x564c3b[_0x5006('0xb2')]=_0x1f10f8;_0x564c3b['answertime']=_0x1f10f8;_0x564c3b[_0x5006('0x70')]=!![];_0x4b6cbb[_0x5006('0x28')]+=0x1;logger['info'](_0x5006('0xb3'),_0x564c3b['uniqueid'],'\x20Queue',_0x4b6cbb[_0x5006('0x26')],_0x5006('0x6f'),_0x4b6cbb[_0x5006('0x28')]);ami[_0x5006('0x59')]('custom:agentconnect',ut['buildObj'](_0x564c3b,_0x5006('0xb4'),this[_0x5006('0x64')][_0x564c3b[_0x5006('0x6d')]]));if(_0x4b6cbb['acw']){ami['emit'](_0x5006('0xb5'),ut[_0x5006('0xb6')](_0x564c3b));}break;case'16':ami['emit'](_0x5006('0xb7'),ut['buildObj'](_0x564c3b,_0x5006('0xb8'),this[_0x5006('0x64')][_0x564c3b[_0x5006('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0x5006('0xa0')](_0x564c3b,'complete'));_0x4b6cbb[_0x5006('0x35')]+=0x1;_0x4b6cbb[_0x5006('0x2b')]+=0x1;_0x4b6cbb[_0x5006('0xb9')]+=0x1;ut['decrementTalkink'](_0x4b6cbb,_0x5006('0xba'));_0x564c3b['countglobal']=ut[_0x5006('0x9e')](_0x564c3b);ut[_0x5006('0x8a')](_0x564c3b,0x4,'Answer');rpcDb[_0x5006('0x8e')](_0x564c3b,_0x5006('0xbb'));rpcDb[_0x5006('0x92')](_0x564c3b,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x5006('0xbc')](_0x564c3b);_0x4b6cbb[_0x5006('0x2a')]+=_0x564c3b['talktime'];_0x4b6cbb[_0x5006('0x29')]+=_0x564c3b[_0x5006('0xbd')];logger[_0x5006('0x56')]('[syncHangup][talking][decrement]',_0x564c3b[_0x5006('0xbe')],_0x5006('0xbf'),_0x4b6cbb[_0x5006('0x26')],_0x5006('0x6f'),_0x4b6cbb[_0x5006('0x28')]);delete this['actions'][_0x4c4885['linkedid']];break;case'BUSY':_0x4b6cbb[_0x5006('0x36')]+=0x1;_0x564c3b[_0x5006('0xc0')]+=0x1;_0x564c3b[_0x5006('0x9d')]=ut[_0x5006('0x9e')](_0x564c3b);ut[_0x5006('0x8a')](_0x564c3b,0x5,_0x5006('0xc1'));_0x2cbf24=_0x4b6cbb[_0x5006('0xc2')];_0x19c78b=_0x4b6cbb[_0x5006('0xa6')];ami[_0x5006('0x59')]('custom:agentbusy',ut[_0x5006('0xa0')](_0x564c3b,_0x5006('0xc3')));rpcDb['createCustomerHistory'](_0x564c3b,_0x5006('0xc4'));_0x124b15['verifyAdditionalPhones'](_0x564c3b,'5',_0x4b6cbb)[_0x5006('0x80')](function(_0x34f160){_0x11d1ef=_0x34f160[_0x5006('0xa4')]==0x1;if(!_0x11d1ef){if(ut['totalGlobal'](_0x564c3b)>=_0x4b6cbb[_0x5006('0xa7')]){_0x26d88e=ut[_0x5006('0xc5')](_0x564c3b,0xf,_0x5006('0xc6'));rpcDb[_0x5006('0x92')](_0x26d88e,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x564c3b['countbusyretry']>=_0x4b6cbb['dialBusyMaxRetry']){rpcDb[_0x5006('0x92')](_0x564c3b,_0x5006('0xc4'));}else{rpcDb[_0x5006('0xa9')](ut[_0x5006('0xaa')](_0x564c3b,_0x5006('0xc0'),_0x4b6cbb[_0x5006('0xc2')]),_0x564c3b[_0x5006('0xab')],_0x564c3b[_0x5006('0xc7')]);}}}else{_0x564c3b[_0x5006('0xc0')]++;_0x124b15[_0x5006('0xae')]({'id':_0x564c3b[_0x5006('0xaf')],'field':{'countbusyretry':_0x564c3b[_0x5006('0xc0')]}})[_0x5006('0x80')](function(){_0x124b15[_0x5006('0xb0')](_0x564c3b,_0x2cbf24,_0x19c78b)['then'](function(){});});}});break;case'NOANSWER':_0x4b6cbb['outboundNoAnswerCallsDay']+=0x1;_0x564c3b[_0x5006('0xc8')]+=0x1;_0x564c3b[_0x5006('0x9d')]=ut['totalGlobal'](_0x564c3b);ut[_0x5006('0x8a')](_0x564c3b,0x3,'NoAnswer');_0x2cbf24=_0x4b6cbb['dialNoAnswerRetryFrequency'];_0x19c78b=_0x4b6cbb[_0x5006('0xa6')];ami[_0x5006('0x59')](_0x5006('0xc9'),ut[_0x5006('0xa0')](_0x564c3b,_0x5006('0xca')));rpcDb[_0x5006('0x8e')](_0x564c3b,_0x5006('0xcb'));_0x124b15[_0x5006('0xa3')](_0x564c3b,'3',_0x4b6cbb)['then'](function(_0x195727){_0x11d1ef=_0x195727[_0x5006('0xa4')]==0x1;if(!_0x11d1ef){if(ut[_0x5006('0x9e')](_0x564c3b)>=_0x4b6cbb['dialGlobalMaxRetry']){_0x26d88e=ut[_0x5006('0xc5')](_0x564c3b,0xf,_0x5006('0xc6'));rpcDb[_0x5006('0x92')](_0x26d88e,_0x5006('0xcc'));}else{if(_0x564c3b['countnoanswerretry']>=_0x4b6cbb['dialNoAnswerMaxRetry']){rpcDb[_0x5006('0x92')](_0x564c3b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x5006('0xa9')](ut[_0x5006('0xaa')](_0x564c3b,_0x5006('0xc8'),_0x4b6cbb[_0x5006('0xcd')]),_0x564c3b[_0x5006('0xab')],_0x564c3b['activeContact']);}}}else{_0x564c3b[_0x5006('0xc8')]++;_0x124b15[_0x5006('0xae')]({'id':_0x564c3b[_0x5006('0xaf')],'field':{'countnoanswerretry':_0x564c3b[_0x5006('0xc8')]}})['then'](function(){_0x124b15[_0x5006('0xb0')](_0x564c3b,_0x2cbf24,_0x19c78b)[_0x5006('0x80')](function(){});});}});break;case'CONGESTION':_0x4b6cbb['outboundCongestionCallsDay']+=0x1;_0x564c3b['countcongestionretry']+=0x1;_0x564c3b[_0x5006('0x9d')]=ut[_0x5006('0x9e')](_0x564c3b);ut[_0x5006('0x8a')](_0x564c3b,0x8,_0x5006('0xce'));_0x2cbf24=_0x4b6cbb[_0x5006('0xcf')];_0x19c78b=_0x4b6cbb[_0x5006('0xa6')];ami[_0x5006('0x59')](_0x5006('0xd0'),ut['buildObj'](_0x564c3b,_0x5006('0xd1')));rpcDb['createCustomerHistory'](_0x564c3b,'[callProgressDetectingCustomer][logCongestion]');_0x124b15['verifyAdditionalPhones'](_0x564c3b,'8',_0x4b6cbb)[_0x5006('0x80')](function(_0x53f796){_0x11d1ef=_0x53f796['additional']==0x1;if(!_0x11d1ef){if(ut[_0x5006('0x9e')](_0x564c3b)>=_0x4b6cbb[_0x5006('0xa7')]){_0x26d88e=ut[_0x5006('0xc5')](_0x564c3b,0xf,_0x5006('0xc6'));rpcDb['createCustomerFinal'](_0x26d88e,_0x5006('0xd2'));}else{if(_0x564c3b[_0x5006('0xd3')]>=_0x4b6cbb[_0x5006('0xd4')]){rpcDb[_0x5006('0x92')](_0x564c3b,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x5006('0xa9')](ut[_0x5006('0xaa')](_0x564c3b,'countcongestionretry',_0x4b6cbb[_0x5006('0xc2')]),_0x564c3b[_0x5006('0xab')],_0x564c3b[_0x5006('0xc7')]);}}}else{_0x564c3b[_0x5006('0xd3')]++;_0x124b15[_0x5006('0xae')]({'id':_0x564c3b['idContact'],'field':{'countcongestionretry':_0x564c3b[_0x5006('0xd3')]}})['then'](function(){_0x124b15['swapAdditionalPhones'](_0x564c3b,_0x2cbf24,_0x19c78b)[_0x5006('0x80')](function(){});});}});break;case _0x5006('0xd5'):_0x4b6cbb['outboundRejectCallsDay']+=0x1;_0x564c3b[_0x5006('0xd6')]+=0x1;_0x564c3b['countglobal']=ut['totalGlobal'](_0x564c3b);ut[_0x5006('0x8a')](_0x564c3b,0x14,_0x5006('0xd7'));_0x2cbf24=_0x4b6cbb[_0x5006('0xd8')];_0x19c78b=_0x4b6cbb[_0x5006('0xa6')];ami['emit'](_0x5006('0xd9'),ut['buildObj'](_0x564c3b,_0x5006('0xda')));rpcDb[_0x5006('0x8e')](_0x564c3b,_0x5006('0xdb'));_0x124b15[_0x5006('0xa3')](_0x564c3b,'20',_0x4b6cbb)[_0x5006('0x80')](function(_0x2f02be){_0x11d1ef=_0x2f02be['additional']==0x1;if(!_0x11d1ef){if(ut[_0x5006('0x9e')](_0x564c3b)>=_0x4b6cbb[_0x5006('0xa7')]){_0x26d88e=ut[_0x5006('0xc5')](_0x564c3b,0x14,_0x5006('0xd7'));rpcDb['createCustomerFinal'](_0x26d88e,_0x5006('0xdc'));}else{if(_0x564c3b['countagentrejectretry']>=_0x4b6cbb['dialAgentRejectMaxRetry']){rpcDb[_0x5006('0x92')](_0x564c3b,_0x5006('0xdc'));}else{rpcDb[_0x5006('0xa9')](ut[_0x5006('0xaa')](_0x564c3b,_0x5006('0xd6'),_0x4b6cbb[_0x5006('0xd8')]),_0x564c3b[_0x5006('0xab')],_0x564c3b[_0x5006('0xc7')]);}}}else{_0x564c3b['countnoanswerretry']++;_0x124b15[_0x5006('0xae')]({'id':_0x564c3b['idContact'],'field':{'countnoanswerretry':_0x564c3b['countnoanswerretry']}})[_0x5006('0x80')](function(){_0x124b15[_0x5006('0xb0')](_0x564c3b,_0x2cbf24,_0x19c78b)[_0x5006('0x80')](function(){});});}});break;case _0x5006('0xdd'):_0x4b6cbb[_0x5006('0x3f')]+=0x1;_0x564c3b[_0x5006('0xde')]+=0x1;_0x564c3b[_0x5006('0x9d')]=ut[_0x5006('0x9e')](_0x564c3b);ut['logCustomer'](_0x564c3b,0xb,_0x5006('0xdf'));rpcDb[_0x5006('0x8e')](_0x564c3b,_0x5006('0xe0'));_0x124b15[_0x5006('0xa3')](_0x564c3b,'11',_0x4b6cbb)[_0x5006('0x80')](function(_0x484fc6){_0x11d1ef=_0x484fc6['additional']==0x1;if(!_0x11d1ef){if(ut[_0x5006('0x9e')](_0x564c3b)>=_0x4b6cbb[_0x5006('0xa7')]){_0x26d88e=ut[_0x5006('0xc5')](_0x564c3b,0xf,_0x5006('0xc6'));rpcDb['createCustomerFinal'](_0x26d88e,_0x5006('0xe0'));}else{if(_0x564c3b['countabandonedetry']>=_0x4b6cbb[_0x5006('0xe1')]){rpcDb['createCustomerFinal'](_0x564c3b,_0x5006('0xe0'));}else{rpcDb[_0x5006('0xa9')](ut[_0x5006('0xaa')](_0x564c3b,_0x5006('0xde'),_0x4b6cbb[_0x5006('0xe2')]),_0x564c3b[_0x5006('0xab')],_0x564c3b[_0x5006('0xc7')]);}}}else{_0x564c3b[_0x5006('0xc8')]++;_0x124b15[_0x5006('0xae')]({'id':_0x564c3b[_0x5006('0xaf')],'field':{'countnoanswerretry':_0x564c3b['countnoanswerretry']}})[_0x5006('0x80')](function(){_0x124b15['swapAdditionalPhones'](_0x564c3b,_0x2cbf24,_0x19c78b)[_0x5006('0x80')](function(){});});}});break;case'18':_0x4b6cbb[_0x5006('0x3e')]+=0x1;_0x564c3b['countmachineretry']+=0x1;_0x564c3b[_0x5006('0x9d')]=ut['totalGlobal'](_0x564c3b);ut[_0x5006('0x8a')](_0x564c3b,0x12,_0x4c4885[_0x5006('0xe3')]||_0x4c4885['dialstatus']);ami['emit'](_0x5006('0xe4'),ut[_0x5006('0xa0')](_0x564c3b,_0x5006('0xe5')));rpcDb[_0x5006('0x8e')](_0x564c3b,_0x5006('0xe6'));_0x124b15[_0x5006('0xa3')](_0x564c3b,'18',_0x4b6cbb)[_0x5006('0x80')](function(_0x5e8696){_0x11d1ef=_0x5e8696[_0x5006('0xa4')]==0x1;if(!_0x11d1ef){if(ut[_0x5006('0x9e')](_0x564c3b)>=_0x4b6cbb['dialGlobalMaxRetry']){_0x26d88e=ut[_0x5006('0xc5')](_0x564c3b,0x12,'Global');rpcDb['createCustomerFinal'](_0x26d88e,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x5006('0x92')](_0x564c3b,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x564c3b[_0x5006('0xc8')]++;_0x124b15['incrementPreviewCounters']({'id':_0x564c3b['idContact'],'field':{'countnoanswerretry':_0x564c3b[_0x5006('0xc8')]}})[_0x5006('0x80')](function(){_0x124b15[_0x5006('0xb0')](_0x564c3b,_0x2cbf24,_0x19c78b)[_0x5006('0x80')](function(){});});}});delete this[_0x5006('0x15')][_0x4c4885[_0x5006('0xac')]];break;case'19':_0x4b6cbb[_0x5006('0x3e')]+=0x1;_0x564c3b[_0x5006('0x9d')]=ut['totalGlobal'](_0x564c3b);ut['logCustomer'](_0x564c3b,0x13,_0x4c4885[_0x5006('0xe3')]||_0x4c4885[_0x5006('0xe7')]);ami[_0x5006('0x59')](_0x5006('0xe4'),ut[_0x5006('0xa0')](_0x564c3b,_0x5006('0xe5')));rpcDb[_0x5006('0x8e')](_0x564c3b,_0x5006('0xe8'));_0x124b15[_0x5006('0xa3')](_0x564c3b,'18',_0x4b6cbb)[_0x5006('0x80')](function(_0x3008d8){_0x11d1ef=_0x3008d8[_0x5006('0xa4')]==0x1;if(!_0x11d1ef){if(ut[_0x5006('0x9e')](_0x564c3b)>=_0x4b6cbb[_0x5006('0xa7')]){_0x26d88e=ut[_0x5006('0xc5')](_0x564c3b,0xf,_0x5006('0xc6'));rpcDb[_0x5006('0x92')](_0x26d88e,_0x5006('0xe8'));}else{rpcDb[_0x5006('0x92')](_0x564c3b,_0x5006('0xe8'));}}else{_0x564c3b[_0x5006('0xc8')]++;_0x124b15[_0x5006('0xae')]({'id':_0x564c3b['idContact'],'field':{'countnoanswerretry':_0x564c3b[_0x5006('0xc8')]}})['then'](function(){_0x124b15['swapAdditionalPhones'](_0x564c3b,_0x2cbf24,_0x19c78b)['then'](function(){});});}});delete this[_0x5006('0x15')][_0x4c4885[_0x5006('0xac')]];break;default:if(_0x564c3b['dialAnswer']){ut[_0x5006('0x79')](_0x4b6cbb,_0x5006('0xe9'));ut['loggerError'](_0x5006('0xea')+_0x4b6cbb[_0x5006('0x26')],_0x4c4885);}_0x4b6cbb[_0x5006('0x3e')]+=0x1;_0x564c3b[_0x5006('0x9d')]=ut['totalGlobal'](_0x564c3b);ut[_0x5006('0x8a')](_0x564c3b,0xc,_0x4c4885[_0x5006('0xe3')]||_0x4c4885[_0x5006('0xe7')]);_0x2cbf24=_0x4b6cbb[_0x5006('0xd8')];_0x19c78b=_0x4b6cbb[_0x5006('0xa6')];rpcDb[_0x5006('0x8e')](_0x564c3b,'[callProgressDetectingCustomer][logUnknown]');_0x124b15[_0x5006('0xa3')](_0x564c3b,'20',_0x4b6cbb)['then'](function(_0x2818b7){_0x11d1ef=_0x2818b7['additional']==0x1;if(!_0x11d1ef){if(ut[_0x5006('0x9e')](_0x564c3b)>=_0x4b6cbb['dialGlobalMaxRetry']){_0x26d88e=ut[_0x5006('0xc5')](_0x564c3b,0xf,_0x5006('0xc6'));rpcDb[_0x5006('0x92')](_0x26d88e,_0x5006('0xeb'));}else{rpcDb[_0x5006('0x92')](_0x564c3b,_0x5006('0xeb'));}delete this[_0x5006('0x15')][_0x4c4885['linkedid']];}else{_0x124b15[_0x5006('0xb0')](_0x564c3b,_0x2cbf24,_0x19c78b)[_0x5006('0x80')](function(_0x4f9fba){});}});}if(!(_0x564c3b[_0x5006('0x70')]&&_0x55c8ae==='16')){ut['updateOriginated'](_0x4b6cbb,_0x5006('0xec'));logger[_0x5006('0x56')]('[originated][decrement][callProgressDetectingCustomer]',_0x564c3b['uniqueid'],'\x20Queue',_0x4b6cbb['name'],'originated:\x20',_0x4b6cbb[_0x5006('0x4b')]);}if(_0x55c8ae!==_0x5006('0xb1')){delete this[_0x5006('0x15')][_0x4c4885[_0x5006('0xac')]];delete this[_0x5006('0x15')][_0x4c4885[_0x5006('0xed')]];}}};Preview[_0x5006('0x10')]['callProgressDetectingAgent']=function(_0x476541,_0x2f1341,_0x205a0){if(_[_0x5006('0xee')](_0x2f1341)&&_0x5006('0xef')!==typeof _0x2f1341){return;}if(_[_0x5006('0xee')](_0x205a0)&&_0x5006('0xef')!==typeof _0x205a0){return;}switch(_0x205a0[_0x5006('0xf0')]){case'0':ut['logAgent'](_0x476541,0x0,_0x5006('0x9f'));rpcDb[_0x5006('0xf1')](_0x476541,_0x5006('0xf2'));break;case'3':ut[_0x5006('0xf3')](_0x476541,0x3,_0x5006('0xf4'));rpcDb[_0x5006('0xf1')](_0x476541,_0x5006('0xf5'));break;case'5':ut['logAgent'](_0x476541,0x5,'Busy');rpcDb[_0x5006('0xf1')](_0x476541,_0x5006('0xf6'));break;case'8':ut[_0x5006('0xf3')](_0x476541,0x8,'Congestion');rpcDb['createAgentHistory'](_0x476541,_0x5006('0xf7'));break;case'22':ut['logAgent'](_0x476541,0x16,'AnswerAGI');rpcDb[_0x5006('0xf1')](_0x476541,_0x5006('0xf8'));break;default:ut[_0x5006('0xf3')](_0x476541,0xc,_0x205a0[_0x5006('0xf0')]);rpcDb[_0x5006('0xf1')](_0x476541,_0x5006('0xf7'));}ut[_0x5006('0xf9')](_0x2f1341,'[callProgressDetectingAgent]');logger[_0x5006('0x56')](_0x5006('0xfa'),_0x476541[_0x5006('0xbe')],_0x5006('0xbf'),_0x2f1341[_0x5006('0x26')],_0x5006('0x6e'),_0x2f1341[_0x5006('0x4b')]);delete this[_0x5006('0x15')][_0x476541[_0x5006('0xbe')]];};Preview[_0x5006('0x10')][_0x5006('0xa3')]=function(_0x2ac63d,_0x51e143,_0x4dbdfc){return BPromise[_0x5006('0xfb')]()['then'](cmHopperAdditionalPhone[_0x5006('0xa3')](_0x2ac63d,_0x51e143,_0x4dbdfc))['catch'](logger['info'](_0x5006('0xfc')));};Preview[_0x5006('0x10')]['swapAdditionalPhones']=function(_0x3a855b,_0xbea293,_0x21d0ad){return BPromise[_0x5006('0xfb')]()['then'](cmHopperAdditionalPhone[_0x5006('0xb0')](_0x3a855b,_0xbea293,_0x21d0ad))[_0x5006('0x76')](logger[_0x5006('0x56')](_0x5006('0xfd')));};Preview[_0x5006('0x10')][_0x5006('0xae')]=function(_0x46cd7a){return BPromise[_0x5006('0xfb')]()[_0x5006('0x80')](cmHopperAdditionalPhone[_0x5006('0xae')](_0x46cd7a))[_0x5006('0x76')](logger[_0x5006('0x56')]('[incrementPreviewCounters]\x20'));};Preview[_0x5006('0x10')]['checkInBlack']=function(_0xb2c3e3,_0x174224,_0x1f1ed8,_0x11e8a4,_0x41ab2e){var _0x3b0aae=this;return new BPromise(function(_0x40ced2,_0x7dab04){if(_[_0x5006('0x6b')](_0x174224)||_[_0x5006('0x6b')](_0x174224[_0x5006('0xfe')])||_[_0x5006('0x6b')](_0x174224['phone'])||_[_0x5006('0x6b')](_0x174224[_0x5006('0xff')])){_0x7dab04(ut[_0x5006('0x4a')]('Contact\x20is\x20undefined',_0x11e8a4,_0x41ab2e));return;}var _0x3b53d5=uuid['v4']();var _0x8b670b=_0x3b0aae['campaignsPreview'][_0x174224[_0x5006('0x6c')]['name']];var _0x38c547=_0x1f1ed8?_0x3b0aae[_0x5006('0x16')][_0x1f1ed8]['id']:undefined;_0x3b0aae[_0x5006('0x15')][_0x3b53d5]=new Action(_0x174224,_0x8b670b,_0x3b53d5,_0x1f1ed8,_0x38c547);var _0x3a4f83=_0x3b0aae['actions'][_0x3b53d5];_0x3a4f83[_0x5006('0xab')]=_0x11e8a4;_0x3a4f83[_0x5006('0xc7')]=_0x41ab2e;_0x3a4f83[_0x5006('0x100')]=_0x1f1ed8;if(_[_0x5006('0x101')](_0xb2c3e3)){_0x3b0aae['execCall'](_0x3a4f83,_0x8b670b,_0x174224,_0x1f1ed8)['then'](function(_0x2abf1b){logger[_0x5006('0x56')](_0x5006('0x102'),_0x5006('0x103')+_0x3a4f83[_0x5006('0x6d')]+_0x5006('0x104')+_0x3a4f83[_0x5006('0xaf')],JSON['stringify'](_0x2abf1b));ami[_0x5006('0x59')](_0x5006('0x105'),ut[_0x5006('0xa0')](_0x3a4f83,'called',_0x3b0aae[_0x5006('0x64')][_0x3a4f83[_0x5006('0x6d')]]));_0x40ced2(ut[_0x5006('0x4a')](_0x5006('0x106')));})[_0x5006('0x76')](function(_0x148f0f){ut[_0x5006('0x5e')](_0x5006('0x107'),_0x148f0f);_0x7dab04(ut[_0x5006('0x4a')](_0x5006('0x108'),_0x11e8a4,_0x41ab2e));});}else{_0x8b670b[_0x5006('0x109')]+=0x1;ut[_0x5006('0x10a')](_0x3a4f83);rpcDb['createHistory'](_0x3a4f83,_0x5006('0x10b'));delete _0x3b0aae[_0x5006('0x15')][_0x3b53d5];_0x7dab04(ut[_0x5006('0x4a')]('Contact\x20in\x20black\x20List',_0x11e8a4,_0x41ab2e));}});};Preview[_0x5006('0x10')]['isTrunkReachable']=function(_0x33edd0){return!_['isNil'](_0x33edd0)&&!_['isNil'](_0x33edd0[_0x5006('0x26')])&&!_[_0x5006('0x6b')](_0x33edd0['active'])&&_0x33edd0[_0x5006('0x10c')]&&!_[_0x5006('0x6b')](this[_0x5006('0x14')][util['format'](_0x5006('0x10d'),_0x33edd0[_0x5006('0x26')])])&&!_['isNil'](this[_0x5006('0x14')][util[_0x5006('0x57')]('SIP/%s',_0x33edd0[_0x5006('0x26')])]['status'])&&(this['trunks'][util[_0x5006('0x57')](_0x5006('0x10d'),_0x33edd0[_0x5006('0x26')])]['status']===_0x5006('0x10e')||this[_0x5006('0x14')][util['format'](_0x5006('0x10d'),_0x33edd0[_0x5006('0x26')])][_0x5006('0x74')]===_0x5006('0x10f'));};Preview[_0x5006('0x10')][_0x5006('0x110')]=function(_0x4cab0c,_0x171f9d){var _0x580524=this;return new BPromise(function(_0x39a10f,_0x14d88c){_0x580524[_0x5006('0x111')](_0x4cab0c,_0x171f9d)[_0x5006('0x80')](function(_0x291f0c){_0x39a10f(_[_0x5006('0x71')](_0x291f0c,[_0x5006('0x4a')]));})[_0x5006('0x76')](function(_0x399a7a){if(_0x399a7a['unlock']){rpcDb[_0x5006('0x112')](_0x4cab0c);}if(_0x399a7a[_0x5006('0x10c')]){rpcDb[_0x5006('0x87')](_0x4cab0c);}_0x14d88c(_[_0x5006('0x71')](_0x399a7a,['message']));});});};Preview[_0x5006('0x10')][_0x5006('0x111')]=function(_0x2b2000,_0x39b087){var _0x9958b0=this;return new BPromise(function(_0x1b5961,_0x31e876){var _0x6e2d1e,_0x38ca26;rpcDb[_0x5006('0x113')](_0x2b2000)[_0x5006('0x80')](function(_0x34c78a){if(!_[_0x5006('0x6b')](_0x34c78a[0x0])){_0x38ca26=_0x34c78a[0x0][_0x5006('0x114')]?![]:!![];_0x6e2d1e=_0x34c78a[0x0][_0x5006('0x114')]?!![]:![];_0x6e2d1e=_0x39b087?!![]:_0x6e2d1e;}var _0x166112=_0x9958b0['validateContact'](_0x34c78a);if(_0x166112['isValid']){rpcDb[_0x5006('0x115')](_[_0x5006('0x71')](_0x34c78a[0x0],[_0x5006('0xff'),'phone']))[_0x5006('0x80')](function(_0x527ea4){_0x9958b0[_0x5006('0x116')](_0x527ea4,_0x34c78a[0x0],_0x39b087,_0x38ca26,_0x6e2d1e)[_0x5006('0x80')](function(_0x2195e0){_0x1b5961(_0x2195e0);})['catch'](function(_0xbf1e1c){_0x31e876(_0xbf1e1c);});})[_0x5006('0x76')](function(_0x39fbd7){ut[_0x5006('0x5e')](_0x5006('0x117'),_0x39fbd7);_0x31e876(ut[_0x5006('0x4a')]('Call\x20unsuccessful',_0x38ca26,_0x6e2d1e));});}else{_0x31e876(ut['message'](_0x166112[_0x5006('0x4a')],_0x38ca26,_0x6e2d1e));}})['catch'](function(_0x40f5e8){ut[_0x5006('0x5e')](_0x5006('0x118'),_0x40f5e8);_0x31e876(ut[_0x5006('0x4a')](_0x5006('0x119'),![],!![]));});});};Preview['prototype'][_0x5006('0x11a')]=function(_0x9624b2){if(_['isNil'](_0x9624b2)||_['isEmpty'](_0x9624b2)||!_[_0x5006('0x6b')](_0x9624b2[0x0]['Agent'])&&_[_0x5006('0x6b')](_0x9624b2[0x0][_0x5006('0x83')]['name'])){ut[_0x5006('0x5e')]('[Preview][validateContact][Empty\x20Contact]',_0x9624b2);return{'isValid':![],'message':_0x5006('0x11b')};}var _0x52582b=this[_0x5006('0x64')][_0x9624b2[0x0][_0x5006('0x6c')][_0x5006('0x26')]];_0x52582b[_0x5006('0x4a')]=_0x5006('0x9a');if(_[_0x5006('0x6b')](_0x52582b)){ut[_0x5006('0x5e')](_0x5006('0x11c'),_0x52582b);return{'isValid':![],'message':_0x5006('0x11d')};}if(!this['isTrunkReachable'](_0x52582b[_0x5006('0x50')])){ut[_0x5006('0x5e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x5006('0x11e')+_0x52582b[_0x5006('0x26')]+_0x5006('0x11f'));if(!this[_0x5006('0x98')](_0x52582b[_0x5006('0x120')])){ut[_0x5006('0x5e')](_0x5006('0x121'),_0x52582b[_0x5006('0x26')]+_0x5006('0x122'));return{'isValid':![],'message':_0x5006('0x123')};}}if(!ut[_0x5006('0x97')](_0x52582b[_0x5006('0x30')])){ut['logger'](_0x5006('0x124'),_0x52582b[_0x5006('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x5006('0x11e')+_0x52582b[_0x5006('0x26')]+_0x5006('0x125')};}return{'isValid':!![],'message':_0x5006('0x126')};};Preview[_0x5006('0x10')][_0x5006('0x127')]=function(_0x10d667,_0x6f08f0,_0x22c105,_0x315e14){var _0x7d41fd=this;return new BPromise(function(_0x28ada5,_0x825b87){var _0x3ea472=_0x10d667['uniqueid'];var _0x7d65e3=_0x7d41fd[_0x5006('0x98')](_0x6f08f0[_0x5006('0x50')])?util[_0x5006('0x57')]('SIP/%s/%s%s',_0x6f08f0['Trunk']['name'],_[_0x5006('0x6b')](_0x6f08f0[_0x5006('0x33')])?'':_0x6f08f0[_0x5006('0x33')][_0x5006('0x128')]()||'',_0x6f08f0['dialCutDigit']>0x0?_0x22c105[_0x5006('0x129')]['substring'](_0x6f08f0['dialCutDigit']):_0x22c105[_0x5006('0x129')]):util['format'](_0x5006('0x12a'),_['isNil'](_0x6f08f0[_0x5006('0x120')])?_0x6f08f0['Trunk'][_0x5006('0x26')]:_0x6f08f0['TrunkBackup'][_0x5006('0x26')],_[_0x5006('0x6b')](_0x6f08f0[_0x5006('0x33')])?'':_0x6f08f0[_0x5006('0x33')][_0x5006('0x128')]()||'',_0x6f08f0['dialCutDigit']>0x0?_0x22c105[_0x5006('0x129')][_0x5006('0x12b')](_0x6f08f0['dialCutDigit']):_0x22c105['phone']);var _0x56f243=_0x7d41fd[_0x5006('0x98')](_0x6f08f0[_0x5006('0x50')])?ut[_0x5006('0x12c')](_0x6f08f0[_0x5006('0x50')][_0x5006('0x51')],_0x6f08f0[_0x5006('0x12d')],_0x6f08f0[_0x5006('0x12e')]>0x0?ut[_0x5006('0x12f')](_0x6f08f0[_0x5006('0x130')],_0x6f08f0[_0x5006('0x12e')]):_0x6f08f0[_0x5006('0x130')]):ut[_0x5006('0x12c')](_[_0x5006('0x6b')](_0x6f08f0[_0x5006('0x120')])?_0x6f08f0[_0x5006('0x50')][_0x5006('0x51')]:_0x6f08f0[_0x5006('0x120')]['callerid'],_0x6f08f0[_0x5006('0x12d')],_0x6f08f0[_0x5006('0x12e')]>0x0?ut['getCallerIdRandom'](_0x6f08f0[_0x5006('0x130')],_0x6f08f0[_0x5006('0x12e')]):_0x6f08f0['dialOriginateCallerIdNumber']);if(_0x56f243){_0x10d667[_0x5006('0x131')]=ut['extractCalleridName'](_0x56f243);_0x10d667[_0x5006('0x132')]=ut[_0x5006('0x133')](_0x56f243);}var _0x45c791=ut['addVariables'](_0x6f08f0,_0x22c105,_0x7d65e3,_0x56f243,_0x3ea472,_0x10d667);_['merge'](_0x10d667,ut['toLowerVariables'](_0x45c791));_0x10d667[_0x5006('0x88')]=moment()[_0x5006('0x57')](_0x5006('0x89'));ami[_0x5006('0x73')](ut[_0x5006('0x134')](_0x10d667,_0x6f08f0,_0x45c791,_0x10d667[_0x5006('0xc7')],_0x315e14))[_0x5006('0x80')](function(_0x3b7dda){var _0xc13337=_0x10d667['channelAgent'];if(!_['isNil'](_0xc13337)){if(!_[_0x5006('0x6b')](_0x7d41fd['agents'][_0xc13337])){_0x7d41fd[_0x5006('0x16')][_0xc13337][_0x5006('0x135')]=_0x10d667[_0x5006('0x136')];emit(util[_0x5006('0x57')](_0x5006('0x137'),_0x7d41fd['agents'][_0xc13337]['name']),'user:agentconnect',{'destaccountcode':_0x7d41fd[_0x5006('0x16')][_0xc13337]['accountcode'],'destconnectedlinenum':_0x10d667[_0x5006('0x136')]});}}_0x6f08f0[_0x5006('0x4b')]+=0x1;logger[_0x5006('0x56')](_0x5006('0x138'),_0x3ea472,_0x5006('0xbf'),_0x6f08f0['name'],_0x5006('0x6e'),_0x6f08f0[_0x5006('0x4b')]);_0x28ada5(_0x3b7dda);})[_0x5006('0x76')](function(_0x5c550b){ut[_0x5006('0xf3')](_0x10d667,0xe,_0x5006('0x139'));rpcDb[_0x5006('0xf1')](_0x10d667,_0x5006('0x13a'));_0x825b87(_0x5c550b);});});};Preview[_0x5006('0x10')][_0x5006('0x1e')]=function(_0x346522){if(this[_0x5006('0x15')][_0x346522[_0x5006('0xac')]]){this[_0x5006('0x15')][_0x346522[_0x5006('0xac')]][_0x5006('0x75')]=_0x346522['channel'];}};Preview['prototype'][_0x5006('0x13b')]=function(_0x2a19f2){var _0xc8a040=this;var _0x148a8d=this[_0x5006('0x15')][_0x2a19f2[_0x5006('0x13c')]];if(_0x148a8d){if(_0x148a8d[_0x5006('0x100')]&&this[_0x5006('0x16')][_0x148a8d[_0x5006('0x100')]]){ut[_0x5006('0x13d')](_0x148a8d,this['agents'][_0x148a8d[_0x5006('0x100')]]['name'],this[_0x5006('0x16')][_0x148a8d[_0x5006('0x100')]]['id']);}var _0x56f50e=_[_0x5006('0x13e')](_0x148a8d);_0x56f50e[_0x5006('0xb2')]=moment()['format'](_0x5006('0x89'));var _0x303b82=_0xc8a040[_0x5006('0x64')][_0x148a8d[_0x5006('0x6d')]];if(ut[_0x5006('0x13f')](_0x2a19f2[_0x5006('0x140')])){if(_0x148a8d[_0x5006('0xab')]){rpcDb[_0x5006('0x112')](_0x148a8d['idContact']);}if(_0x148a8d['activeContact']){rpcDb['disableContact'](_0x148a8d[_0x5006('0xaf')]);}ami[_0x5006('0x59')](_0x5006('0x141'),ut[_0x5006('0xa0')](_0x148a8d,_0x5006('0x142'),this['campaignsPreview'][_0x148a8d[_0x5006('0x6d')]]));this[_0x5006('0x143')](_0x56f50e,_0x303b82,_0x2a19f2);}else{_0x148a8d[_0x5006('0x88')]=moment()[_0x5006('0x57')](_0x5006('0x89'));ut[_0x5006('0xf3')](_0x56f50e,0x4,'Answer');rpcDb[_0x5006('0xf1')](_0x56f50e,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x5006('0x10')]['syncHangup']=function(_0x489bf5){var _0x28a65c=this;var _0x1a2306=this[_0x5006('0x15')][_0x489bf5[_0x5006('0xac')]];var _0x2465d6;if(_0x1a2306){_0x2465d6=this['campaignsPreview'][_0x1a2306[_0x5006('0x6d')]];logger[_0x5006('0x56')]('[syncHangup][talking]',_0x489bf5[_0x5006('0xac')],_0x5006('0xbf'),_0x2465d6['name'],_0x5006('0x6f'),_0x2465d6[_0x5006('0x28')]);}if(this[_0x5006('0x15')][_0x489bf5[_0x5006('0xac')]]&&_0x489bf5[_0x5006('0xac')]!==_0x489bf5[_0x5006('0xbe')]){if(_0x489bf5['cause']==='16'&&this[_0x5006('0x15')][_0x489bf5[_0x5006('0xac')]]['dialAnswer']){this[_0x5006('0x9b')](_0x489bf5,_0x489bf5[_0x5006('0xac')],_0x489bf5['cause']);}else if(this[_0x5006('0x15')][_0x489bf5[_0x5006('0xac')]][_0x5006('0x70')]){logger[_0x5006('0x56')]('[syncHangup][talking][cause]',_0x489bf5[_0x5006('0xac')],_0x489bf5['cause'],_0x5006('0xbf'),_0x2465d6['name'],_0x5006('0x6f'),_0x2465d6[_0x5006('0x28')]);this[_0x5006('0x9b')](_0x489bf5,_0x489bf5[_0x5006('0xac')],_0x489bf5['cause']);}}else if(_0x1a2306&&_['isNil'](_0x1a2306['statedesc'])&&_0x2465d6[_0x5006('0x144')]&&_0x489bf5[_0x5006('0xac')]===_0x489bf5[_0x5006('0xbe')]&&_['isNil'](_0x489bf5[_0x5006('0xf0')])&&_0x489bf5[_0x5006('0x145')]==='16'&&_0x489bf5[_0x5006('0x146')]==='6'&&_[_0x5006('0xee')](_0x1a2306[_0x5006('0x147')])){if(_0x1a2306[_0x5006('0xab')]){rpcDb[_0x5006('0x112')](_0x1a2306[_0x5006('0xaf')]);}if(_0x1a2306[_0x5006('0xc7')]){rpcDb['disableContact'](_0x1a2306[_0x5006('0xaf')]);}_0x489bf5[_0x5006('0xf0')]='22';this[_0x5006('0x143')](_0x1a2306,_0x2465d6,_0x489bf5);}else if(_0x1a2306&&_0x1a2306[_0x5006('0x147')]){if(_0x489bf5['cause']==='16'&&this[_0x5006('0x15')][_0x489bf5[_0x5006('0xac')]]['dialAnswer']){logger['info'](_0x5006('0x148'),_0x489bf5[_0x5006('0xac')],_0x489bf5['cause'],_0x5006('0xbf'),_0x2465d6['name'],_0x5006('0x6f'),_0x2465d6[_0x5006('0x28')]);this[_0x5006('0x9b')](_0x489bf5,_0x489bf5[_0x5006('0xac')],_0x489bf5[_0x5006('0x145')]);}else if(this[_0x5006('0x15')][_0x489bf5[_0x5006('0xac')]][_0x5006('0x70')]){logger[_0x5006('0x56')]('[syncHangup][talking][cause]',_0x489bf5['linkedid'],_0x489bf5['cause'],_0x5006('0xbf'),_0x2465d6[_0x5006('0x26')],_0x5006('0x6f'),_0x2465d6[_0x5006('0x28')]);this['callProgressDetectingCustomer'](_0x489bf5,_0x489bf5[_0x5006('0xac')],_0x489bf5[_0x5006('0x145')]);}}};Preview[_0x5006('0x10')][_0x5006('0x1c')]=function(_0x5bf525){if(this[_0x5006('0x15')][_0x5bf525['destlinkedid']]&&_0x5bf525[_0x5006('0xed')]!==_0x5bf525[_0x5006('0x149')]){this[_0x5006('0x9b')](_0x5bf525,_0x5bf525[_0x5006('0xed')],_0x5bf525[_0x5006('0xe7')]);}};Preview[_0x5006('0x10')][_0x5006('0x1b')]=function(_0x1bdde3){if(this[_0x5006('0x15')][_0x1bdde3[_0x5006('0xac')]]&&_0x1bdde3[_0x5006('0xac')]!==_0x1bdde3[_0x5006('0xbe')]&&!this[_0x5006('0x15')][_0x1bdde3[_0x5006('0xac')]][_0x5006('0x70')]){if(_0x1bdde3['cause']==='1'){this[_0x5006('0x9b')](_0x1bdde3,_0x1bdde3[_0x5006('0xac')],_0x1bdde3[_0x5006('0x145')]);}}};Preview[_0x5006('0x10')][_0x5006('0x14a')]=function(_0x525786,_0x5af79c,_0x3cbe27){if(this[_0x5006('0x15')][_0x525786]){if(_['isNil'](this[_0x5006('0x15')][_0x525786][_0x5006('0x14b')])){this['actions'][_0x525786][_0x5006('0x14b')]={};}this[_0x5006('0x15')][_0x525786]['variables'][_0x5af79c]=_0x3cbe27;}};Preview[_0x5006('0x10')]['syncVarSet']=function(_0x306c48){try{if(!_[_0x5006('0x6b')](_0x306c48)){if(ut[_0x5006('0x14c')](_[_0x5006('0x14d')](_0x306c48[_0x5006('0x14e')])[0x0])){this[_0x5006('0x14a')](_0x306c48[_0x5006('0xbe')],_[_0x5006('0x14d')](_0x306c48[_0x5006('0x14e')])[0x0],_0x306c48[_0x5006('0x14f')]);}}}catch(_0x207ab5){logger[_0x5006('0x150')](_0x5006('0x151'),util[_0x5006('0x152')](_0x207ab5,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x4b49fa){if(_0x4b49fa){if(this[_0x5006('0x15')][_0x4b49fa[_0x5006('0x153')]]){this[_0x5006('0x15')][_0x4b49fa[_0x5006('0x153')]][_0x5006('0x147')]=!![];}}};Preview[_0x5006('0x10')]['syncBlindTransfer']=function(_0xd47e3f){if(_0xd47e3f){if(this[_0x5006('0x15')][_0xd47e3f[_0x5006('0x154')]]){this[_0x5006('0x15')][_0xd47e3f[_0x5006('0x154')]]['transfer']=!![];}}};module[_0x5006('0x155')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index f4220b0..c5be0d8 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 _0x90f5=['error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[countReScheduled]\x20','[unlockContact]\x20','disableContact','[activeContact]\x20','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport'];(function(_0x33826e,_0x5b3c00){var _0xe2f9f6=function(_0x4a7b13){while(--_0x4a7b13){_0x33826e['push'](_0x33826e['shift']());}};_0xe2f9f6(++_0x5b3c00);}(_0x90f5,0x1d3));var _0x590f=function(_0x5a385e,_0x393e37){_0x5a385e=_0x5a385e-0x0;var _0x54b45a=_0x90f5[_0x5a385e];return _0x54b45a;};'use strict';var util=require(_0x590f('0x0'));var BPromise=require(_0x590f('0x1'));var logger=require('../../../config/logger')(_0x590f('0x2'));var _=require(_0x590f('0x3'));var cmHopper=require(_0x590f('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x590f('0x5'));var cmHopperBlack=require(_0x590f('0x6'));var voiceQueueRt=require(_0x590f('0x7'));var agentReportPreview=require(_0x590f('0x8'));var voiceQueueReport=require(_0x590f('0x9'));function loggerCatch(_0x5bb84f){return function(_0x2fff5f){logger[_0x590f('0xa')](_0x5bb84f,util[_0x590f('0xb')](_0x2fff5f,{'showHidden':![],'depth':null}));};}function create(_0x4f7c4d){return BPromise[_0x590f('0xc')]()[_0x590f('0xd')](cmHopperHistory[_0x590f('0xe')](_0x4f7c4d))[_0x590f('0xf')](loggerCatch(_0x590f('0x10')));}function createAgent(_0x2c67fa){return BPromise[_0x590f('0xc')]()['then'](agentReportPreview['createHistory'](_0x2c67fa))[_0x590f('0xf')](loggerCatch(_0x590f('0x10')));}function moveContact(_0x19c21a){return BPromise[_0x590f('0xc')]()[_0x590f('0xd')](cmHopper['moveContactManagedDialer'](_0x19c21a,!![]))[_0x590f('0xf')](loggerCatch(_0x590f('0x11')));}exports[_0x590f('0x12')]=function(_0x43441e){return BPromise[_0x590f('0xc')]()[_0x590f('0xd')](cmHopperBlack[_0x590f('0x12')](_0x43441e))[_0x590f('0xf')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x590f('0x13')]=function(_0x4f60eb){return BPromise[_0x590f('0xc')]()[_0x590f('0xd')](cmHopper[_0x590f('0x13')](_0x4f60eb))[_0x590f('0xf')](loggerCatch(_0x590f('0x14')));};exports[_0x590f('0xe')]=function(_0x524bfb,_0x576d4d){create(_0x524bfb)['catch'](loggerCatch(_0x576d4d));moveContact(_0x524bfb)[_0x590f('0xf')](loggerCatch(_0x576d4d));};exports['createAgentHistory']=function(_0x625f5,_0x4c4cba){createAgent(_0x625f5)[_0x590f('0xf')](loggerCatch(_0x4c4cba));};exports[_0x590f('0x15')]=function(_0x54d8ad,_0x1218a0){create(_0x54d8ad)[_0x590f('0xf')](loggerCatch(_0x1218a0));};exports[_0x590f('0x16')]=function(_0x46a768,_0x3bb074){moveContact(_0x46a768)[_0x590f('0xf')](loggerCatch(_0x3bb074));};exports[_0x590f('0x17')]=function(_0x428355,_0x291e69,_0x41099e){if(_0x291e69){_0x428355[_0x590f('0x18')]=null;}if(_0x41099e){_0x428355[_0x590f('0x19')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x590f('0x17')](_0x428355))[_0x590f('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x1a04d5){return BPromise[_0x590f('0xc')]()[_0x590f('0xd')](cmHopper['countReScheduled'](_0x1a04d5))[_0x590f('0xf')](loggerCatch(_0x590f('0x1a')));};exports['unlockContact']=function(_0x154316){return BPromise[_0x590f('0xc')]()[_0x590f('0xd')](cmHopper['unlockContact']({'UserId':null},_0x154316,0x1))[_0x590f('0xf')](loggerCatch(_0x590f('0x1b')));};exports[_0x590f('0x1c')]=function(_0x58fce0){return BPromise['resolve']()[_0x590f('0xd')](cmHopper['unlockContact']({'active':![]},_0x58fce0,0x1))[_0x590f('0xf')](loggerCatch(_0x590f('0x1d')));};exports['crateCustomerReportQueue']=function(_0x11f12c){var _0x3ebe96={};_0x3ebe96[_0x590f('0x1e')]=_0x11f12c['type'];_0x3ebe96['uniqueid']=_0x11f12c['uniqueid'];_0x3ebe96[_0x590f('0x1f')]=_0x11f12c[_0x590f('0x1f')];_0x3ebe96[_0x590f('0x20')]=_0x11f12c[_0x590f('0x20')];_0x3ebe96[_0x590f('0x21')]=_0x11f12c[_0x590f('0x21')];_0x3ebe96[_0x590f('0x22')]=_0x11f12c[_0x590f('0x23')];_0x3ebe96['queuecallerleaveAt']=_0x11f12c['answertime'];_0x3ebe96[_0x590f('0x24')]=0x1;_0x3ebe96[_0x590f('0x25')]=_0x11f12c['endtime'];_0x3ebe96[_0x590f('0x26')]=_0x11f12c[_0x590f('0x27')];_0x3ebe96[_0x590f('0x28')]=_0x590f('0x29');_0x3ebe96['exten']=_0x590f('0x2a');_0x3ebe96['holdtime']=0x0;_0x3ebe96[_0x590f('0x2b')]=0x1;_0x3ebe96[_0x590f('0x2c')]=_0x11f12c['membername'];_0x3ebe96[_0x590f('0x2d')]=_0x590f('0x2e');return BPromise[_0x590f('0xc')]()[_0x590f('0xd')](voiceQueueReport[_0x590f('0x2f')](_0x3ebe96))[_0x590f('0xf')](loggerCatch(_0x590f('0x30')));};exports['getContactRecallMe']=function(_0x28e531,_0x3fb4f2){return BPromise[_0x590f('0xc')]()['then'](cmHopper[_0x590f('0x31')](_0x28e531,_0x3fb4f2))[_0x590f('0xf')](loggerCatch(_0x590f('0x32')));};exports[_0x590f('0x33')]=function(_0x2b41a5){return BPromise[_0x590f('0xc')]()['then'](cmHopper[_0x590f('0x17')](_0x2b41a5,!![],!![]))['catch'](loggerCatch(_0x590f('0x34')));}; \ No newline at end of file +var _0x0392=['preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger'];(function(_0x30e874,_0x728fa0){var _0x1ebbc1=function(_0xbe3020){while(--_0xbe3020){_0x30e874['push'](_0x30e874['shift']());}};_0x1ebbc1(++_0x728fa0);}(_0x0392,0x124));var _0x2039=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0x0392[_0x2eea9a];return _0x1ec61e;};'use strict';var util=require(_0x2039('0x0'));var BPromise=require(_0x2039('0x1'));var logger=require(_0x2039('0x2'))(_0x2039('0x3'));var _=require(_0x2039('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x2039('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2039('0x6'));var voiceQueueRt=require(_0x2039('0x7'));var agentReportPreview=require(_0x2039('0x8'));var voiceQueueReport=require(_0x2039('0x9'));function loggerCatch(_0x2c9fe4){return function(_0x42d6ea){logger[_0x2039('0xa')](_0x2c9fe4,util[_0x2039('0xb')](_0x42d6ea,{'showHidden':![],'depth':null}));};}function create(_0x3721a9){return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](cmHopperHistory[_0x2039('0xe')](_0x3721a9))[_0x2039('0xf')](loggerCatch(_0x2039('0x10')));}function createAgent(_0x303017){return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](agentReportPreview['createHistory'](_0x303017))[_0x2039('0xf')](loggerCatch(_0x2039('0x10')));}function moveContact(_0x24db70){return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](cmHopper[_0x2039('0x11')](_0x24db70,!![]))[_0x2039('0xf')](loggerCatch(_0x2039('0x12')));}exports[_0x2039('0x13')]=function(_0x50fe65){return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](cmHopperBlack[_0x2039('0x13')](_0x50fe65))[_0x2039('0xf')](loggerCatch(_0x2039('0x14')));};exports[_0x2039('0x15')]=function(_0x50c7f0){return BPromise['resolve']()[_0x2039('0xd')](cmHopper[_0x2039('0x15')](_0x50c7f0))['catch'](loggerCatch(_0x2039('0x16')));};exports[_0x2039('0xe')]=function(_0x3d8c72,_0x2447fa){create(_0x3d8c72)[_0x2039('0xf')](loggerCatch(_0x2447fa));moveContact(_0x3d8c72)[_0x2039('0xf')](loggerCatch(_0x2447fa));};exports[_0x2039('0x17')]=function(_0x2df4b1,_0x34e824){createAgent(_0x2df4b1)['catch'](loggerCatch(_0x34e824));};exports[_0x2039('0x18')]=function(_0x90f565,_0x4c84c0){create(_0x90f565)['catch'](loggerCatch(_0x4c84c0));};exports['createCustomerFinal']=function(_0x3e1252,_0x3193fb){moveContact(_0x3e1252)[_0x2039('0xf')](loggerCatch(_0x3193fb));};exports[_0x2039('0x19')]=function(_0x4fbced,_0x53afac,_0x733916){if(_0x53afac){_0x4fbced[_0x2039('0x1a')]=null;}if(_0x733916){_0x4fbced[_0x2039('0x1b')]=![];}return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](cmHopper[_0x2039('0x19')](_0x4fbced))[_0x2039('0xf')](loggerCatch(_0x2039('0x1c')));};exports[_0x2039('0x1d')]=function(_0x2bd6e3){return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](cmHopper[_0x2039('0x1d')](_0x2bd6e3))[_0x2039('0xf')](loggerCatch(_0x2039('0x1e')));};exports['unlockContact']=function(_0x35b8ef){return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](cmHopper['unlockContact']({'UserId':null},_0x35b8ef,0x1))[_0x2039('0xf')](loggerCatch(_0x2039('0x1f')));};exports[_0x2039('0x20')]=function(_0x49a6a3){return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](cmHopper[_0x2039('0x21')]({'active':![]},_0x49a6a3,0x1))[_0x2039('0xf')](loggerCatch(_0x2039('0x22')));};exports[_0x2039('0x23')]=function(_0xfd212f){var _0xa102f3={};_0xa102f3['type']=_0xfd212f['type'];_0xa102f3['uniqueid']=_0xfd212f['uniqueid'];_0xa102f3[_0x2039('0x24')]=_0xfd212f[_0x2039('0x24')];_0xa102f3[_0x2039('0x25')]=_0xfd212f[_0x2039('0x25')];_0xa102f3['queue']=_0xfd212f[_0x2039('0x26')];_0xa102f3[_0x2039('0x27')]=_0xfd212f[_0x2039('0x28')];_0xa102f3['queuecallerleaveAt']=_0xfd212f[_0x2039('0x28')];_0xa102f3[_0x2039('0x29')]=0x1;_0xa102f3[_0x2039('0x2a')]=_0xfd212f['endtime'];_0xa102f3[_0x2039('0x2b')]=_0xfd212f[_0x2039('0x2c')];_0xa102f3[_0x2039('0x2d')]=_0x2039('0x2e');_0xa102f3[_0x2039('0x2f')]=_0x2039('0x30');_0xa102f3[_0x2039('0x31')]=0x0;_0xa102f3[_0x2039('0x32')]=0x1;_0xa102f3['lastAssignedTo']=_0xfd212f[_0x2039('0x2c')];_0xa102f3[_0x2039('0x33')]=_0x2039('0x34');return BPromise[_0x2039('0xc')]()['then'](voiceQueueReport[_0x2039('0x35')](_0xa102f3))['catch'](loggerCatch(_0x2039('0x36')));};exports[_0x2039('0x37')]=function(_0x385cbb,_0x176070){return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](cmHopper[_0x2039('0x37')](_0x385cbb,_0x176070))[_0x2039('0xf')](loggerCatch(_0x2039('0x38')));};exports[_0x2039('0x39')]=function(_0x590e6e){return BPromise[_0x2039('0xc')]()[_0x2039('0xd')](cmHopper[_0x2039('0x19')](_0x590e6e,!![],!![]))[_0x2039('0xf')](loggerCatch(_0x2039('0x3a')));}; \ 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 1db6674..d262517 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 _0xac6a=['Contact','tags','createdAt','updatedAt','XMD-','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','interface','mandatoryDisposition','buildAcw','queue','status','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','type','dialAnswer','countnoanswerretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID'];(function(_0x30b094,_0x555417){var _0x4337f3=function(_0x593f40){while(--_0x593f40){_0x30b094['push'](_0x30b094['shift']());}};_0x4337f3(++_0x555417);}(_0xac6a,0x188));var _0xaac6=function(_0x597ad5,_0x508711){_0x597ad5=_0x597ad5-0x0;var _0x4aa714=_0xac6a[_0x597ad5];return _0x4aa714;};'use strict';var util=require(_0xaac6('0x0'));var _=require(_0xaac6('0x1'));var moment=require(_0xaac6('0x2'));var logger=require(_0xaac6('0x3'))(_0xaac6('0x4'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xaac6('0x5');function getSeconds(_0xf397c6,_0x11b621){var _0x43ba6c=moment(_0xf397c6)[_0xaac6('0x6')](0x0);var _0x2202bc=moment(_0x11b621)['milliseconds'](0x0);return _0x43ba6c['diff'](_0x2202bc,_0xaac6('0x7'));}exports[_0xaac6('0x8')]=function(_0x34eca2){return function(_0x4b5fb8){logger[_0xaac6('0x9')](_0x34eca2,util[_0xaac6('0xa')](_0x4b5fb8,{'showHidden':![],'depth':null}));};};exports[_0xaac6('0xb')]=function(_0x13b3f6,_0x36e1da){logger[_0xaac6('0xc')](_0x13b3f6,util[_0xaac6('0xa')](_0x36e1da,{'showHidden':![],'depth':null}));};exports[_0xaac6('0xd')]=function(_0x45eedd,_0x1919db){logger[_0xaac6('0x9')](_0x45eedd,util[_0xaac6('0xa')](_0x1919db,{'showHidden':![],'depth':null}));};exports[_0xaac6('0xe')]=function(_0x31d5d2){return function(_0x1f925e){logger[_0xaac6('0xc')](_0x31d5d2,util[_0xaac6('0xa')](_0x1f925e,{'showHidden':![],'depth':null}));};};exports[_0xaac6('0xf')]=function(_0x1549ef,_0x30a441,_0x1bee7e){return{'message':_0x1549ef,'unlock':_0x30a441,'active':_0x1bee7e};};exports[_0xaac6('0x10')]=function(_0xe6b59e,_0x21a66f,_0x43cbcd){if(!_[_0xaac6('0x11')](_0x43cbcd)&&_0xaac6('0x12')===typeof _0x43cbcd&&!_[_0xaac6('0x13')](_0x43cbcd)){if(!_[_0xaac6('0x11')](_0x21a66f)&&'string'===typeof _0x21a66f&&!_[_0xaac6('0x13')](_0x21a66f)){return util[_0xaac6('0x14')](_0xaac6('0x15'),_0x21a66f,_0x43cbcd);}return util[_0xaac6('0x14')](_0xaac6('0x15'),_0x43cbcd,_0x43cbcd);}if(!_['isUndefined'](_0xe6b59e)&&_0xaac6('0x12')===typeof _0xe6b59e&&!_[_0xaac6('0x13')](_0xe6b59e)){return _0xe6b59e;}return _0xaac6('0x16');};exports[_0xaac6('0x17')]=function(_0x5960cb){if(_[_0xaac6('0x18')](_0x5960cb)){return![];}return _0x5960cb;};exports[_0xaac6('0x19')]=function(_0x494b53,_0x3046ce,_0x1e446e,_0x342fb8,_0x5cbcd9,_0x363c15){var _0x551394={'XMD-QUEUE':_0x3046ce[_0xaac6('0x1a')]?_0x3046ce[_0xaac6('0x1a')]['name']:'','XMD-CALLERID':_0x342fb8,'XMD-CALLERID-PREVIEW':_0x363c15?util[_0xaac6('0x14')]('\x22%s\x22\x20<%s>',_0x363c15[_0xaac6('0x1b')],_0x363c15[_0xaac6('0x1c')]):_0x342fb8,'XMD-DIALID':_0x5cbcd9,'XMD-CONTACTID':_0x3046ce[_0xaac6('0x1d')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x342fb8,'XMD-VOICEQUEUEID':_0x3046ce[_0xaac6('0x1e')],'XMD-DIALCHANNEL':_0x1e446e,'XMD-DIALTIMEOUT':_0x494b53['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xaac6('0x14')](_0xaac6('0x1f'),_0x494b53[_0xaac6('0x20')]?'g':'',_[_0xaac6('0x13')](_0x494b53[_0xaac6('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x494b53[_0xaac6('0x22')]||'','XMD-AGI':_0x494b53[_0xaac6('0x23')]?util[_0xaac6('0x14')](_0xaac6('0x24'),ipAgi,_0x494b53['dialQueueProject']):_0xaac6('0x25'),'XMD-AGIAFTER':_0x494b53[_0xaac6('0x20')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x494b53[_0xaac6('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x363c15?_0x363c15[_0xaac6('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x363c15?_0x363c15[_0xaac6('0x27')]:'','XMD-DESTINATION':_0xaac6('0x28')};if(!_[_0xaac6('0x13')](_0x494b53[_0xaac6('0x21')])){_0x551394[util[_0xaac6('0x14')]('%s',_0xaac6('0x29'))]=_0x494b53[_0xaac6('0x21')];_0x551394[util['format']('%s',_0xaac6('0x2a'))]=_0x5cbcd9;}if(_0x3046ce&&_0x3046ce[_0xaac6('0x2b')]){for(var _0x265d17 in _0x3046ce[_0xaac6('0x2b')]){if(_0x3046ce[_0xaac6('0x2b')]['hasOwnProperty'](_0x265d17)){if(!_[_0xaac6('0x18')](_0x3046ce['Contact'][_0x265d17])&&_0x265d17!=='id'&&_0x265d17!==_0xaac6('0x2c')&&_0x265d17!==_0xaac6('0x2d')&&_0x265d17!==_0xaac6('0x2e')){_0x551394[util[_0xaac6('0x14')]('%s%s',_0xaac6('0x2f'),_['toUpper'](_0x265d17))]=_0x3046ce[_0xaac6('0x2b')][_0x265d17];}}}}return _0x551394;};exports[_0xaac6('0x30')]=function(_0xafc3ca){var _0x4cebe5={};for(var _0x116788 in _0xafc3ca){if(_0xafc3ca['hasOwnProperty'](_0x116788)){_0x4cebe5[util['format']('%s',_[_0xaac6('0x31')](_0x116788))]=_0xafc3ca[_0x116788];}}return{'variables':_0x4cebe5};};exports[_0xaac6('0x32')]=function(_0x138ac2,_0xaf9790){if(!_[_0xaac6('0x18')](_0x138ac2)){if(_0x138ac2[_0xaac6('0x33')]('originated')){if(_0x138ac2[_0xaac6('0x34')]>0x0){_0x138ac2[_0xaac6('0x34')]-=0x1;}else{logger[_0xaac6('0x9')](_0xaac6('0x35'),_0xaf9790);}}}else{logger[_0xaac6('0x9')](_0xaac6('0x36'),_0xaf9790);}};exports['logBlacklist']=function(_0x368b7f){var _0x4d3b4c=moment()[_0xaac6('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x368b7f[_0xaac6('0x37')]=0xd;_0x368b7f[_0xaac6('0x38')]=_0xaac6('0x39');_0x368b7f[_0xaac6('0x3a')]=_0x4d3b4c;_0x368b7f[_0xaac6('0x3b')]=_0x4d3b4c;_0x368b7f[_0xaac6('0x3c')]=_0x4d3b4c;};exports[_0xaac6('0x3d')]=function(_0x55c10a,_0x583552,_0x252679){var _0x5dcad9=moment()['format'](_0xaac6('0x3e'));_0x55c10a[_0xaac6('0x37')]=_0x583552;_0x55c10a[_0xaac6('0x38')]=_0x252679;_0x55c10a['responsetime']=_0x5dcad9;_0x55c10a[_0xaac6('0x3f')]=getSeconds(_0x55c10a['responsetime'],_0x55c10a[_0xaac6('0x3a')]);};exports[_0xaac6('0x40')]=function(_0x1c712a,_0x93ddc9,_0x1c705f){_0x1c712a[_0xaac6('0x41')]=_0x93ddc9;_0x1c712a[_0xaac6('0x42')]=_0x1c705f;};exports['logCustomer']=function(_0x3fc012,_0x1bf8b4,_0x24531b){var _0x5df5be=moment()[_0xaac6('0x14')](_0xaac6('0x3e'));_0x3fc012[_0xaac6('0x37')]=_0x1bf8b4;_0x3fc012[_0xaac6('0x38')]=_0x24531b;_0x3fc012[_0xaac6('0x3b')]=_0x3fc012['responsetime']?_0x3fc012[_0xaac6('0x3b')]:_0x5df5be;_0x3fc012['endtime']=_0x3fc012['endtime']?_0x3fc012['endtime']:_0x5df5be;_0x3fc012[_0xaac6('0x3f')]=getSeconds(_0x3fc012[_0xaac6('0x3b')]||0x0,_0x3fc012[_0xaac6('0x3a')]||0x0);_0x3fc012[_0xaac6('0x43')]=_0x3fc012[_0xaac6('0x44')]?getSeconds(_0x3fc012[_0xaac6('0x3c')],_0x3fc012[_0xaac6('0x44')]):0x0;};exports[_0xaac6('0x45')]=function(_0x2c2424){return _0x2c2424===_0xaac6('0x46');};exports[_0xaac6('0x47')]=function(_0x143712,_0x4fd0e8,_0x154702,_0x7f482c,_0x2c1ed3){var _0x1bc176=_0x7f482c?_0xaac6('0x48'):_0x143712[_0xaac6('0x1b')];_0x1bc176=_0x2c1ed3?_0xaac6('0x49'):_0x1bc176;return{'actionid':_0x143712[_0xaac6('0x4a')],'action':_0xaac6('0x4b'),'channel':_0x143712[_0xaac6('0x4c')],'callerid':util[_0xaac6('0x14')]('\x22%s\x22\x20<%s>',_0x1bc176,_0x143712['calleridnum']),'Exten':_0xaac6('0x28'),'Context':_0xaac6('0x4d'),'Priority':'1','variable':_0x154702,'timeout':(_0x4fd0e8[_0xaac6('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x143712['uniqueid']};};exports[_0xaac6('0x4f')]=function(_0x42ade5){return _0x42ade5[_0xaac6('0x50')]+_0x42ade5[_0xaac6('0x51')]+_0x42ade5['countnoanswerretry']+_0x42ade5[_0xaac6('0x52')]+_0x42ade5[_0xaac6('0x53')];};exports[_0xaac6('0x54')]=function(_0x532309){var _0x4bebdc=_[_0xaac6('0x55')](_0x532309);_0x4bebdc[_0xaac6('0x37')]=0xf;_0x4bebdc['statedesc']=_0xaac6('0x56');return _0x4bebdc;};exports['scheduledAt']=function(_0x58c4eb,_0x58a78f,_0x13202b){var _0x5db40a={};_0x5db40a[_0x58a78f]=_0x58c4eb[_0x58a78f];_0x5db40a[_0xaac6('0x57')]=![];_0x5db40a[_0xaac6('0x58')]=moment()[_0xaac6('0x59')](_0x13202b,_0xaac6('0x5a'))[_0xaac6('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x5db40a['ContactId']=_0x58c4eb[_0xaac6('0x1d')];_0x5db40a[_0xaac6('0x5b')]=_0x58c4eb[_0xaac6('0x5b')];_0x5db40a[_0xaac6('0x1e')]=_0x58c4eb['VoiceQueueId']||undefined;return _0x5db40a;};exports['decrementTalkink']=function(_0x422622,_0x3c5ab8){if(!_['isNil'](_0x422622)){if(_0x422622[_0xaac6('0x5c')]>0x0){_0x422622[_0xaac6('0x5c')]-=0x1;}else{logger[_0xaac6('0x9')](_0x3c5ab8,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xaac6('0x9')](_0x3c5ab8,_0xaac6('0x5d'));}};exports[_0xaac6('0x5e')]=function(_0x1a6f1f){if(_0x1a6f1f<=0x0){return!![];}return![];};exports[_0xaac6('0x5f')]=function(_0x20cb60,_0x1086b8,_0x20d2a7){_0x20cb60[_0xaac6('0x60')]=_0x1086b8;_0x20cb60[_0xaac6('0x61')]=_0x20cb60['queue'];_0x20cb60[_0xaac6('0x62')]=_0x20cb60[_0xaac6('0x4c')];if(_0x20d2a7){_0x20cb60[_0xaac6('0x63')]=_0x20d2a7[_0xaac6('0x63')];}return _0x20cb60;};exports[_0xaac6('0x64')]=function(_0x4c258e){var _0x4f184b={};_0x4f184b[_0xaac6('0x65')]=_0x4c258e[_0xaac6('0x65')];_0x4f184b[_0xaac6('0x62')]=_0x4c258e[_0xaac6('0x4c')];_0x4f184b[_0xaac6('0x4a')]=_0x4c258e[_0xaac6('0x4a')];return _0x4f184b;};exports['agentReadyId']=function(_0x580e4c){var _0xe49468=[];for(var _0x1b52b9 in _0x580e4c){if(_0x580e4c[_0xaac6('0x33')](_0x1b52b9)){if(!_[_0xaac6('0x18')](_0x580e4c[_0x1b52b9])&&_0x580e4c[_0x1b52b9][_0xaac6('0x37')]==='not_inuse'&&_0x580e4c[_0x1b52b9][_0xaac6('0x66')]===_0xaac6('0x67')){_0xe49468[_0xaac6('0x68')](_0x580e4c[_0x1b52b9]['id']);}}}return _0xe49468;};exports[_0xaac6('0x69')]=function(_0x38878d){var _0x3a5260=moment()['milliseconds'](0x0);var _0x2b351b=moment(_0x38878d)[_0xaac6('0x6')](0x0);return _0x3a5260[_0xaac6('0x6a')](_0x2b351b,_0xaac6('0x7'));};exports[_0xaac6('0x6b')]=function(_0x327071){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x327071[_0xaac6('0x1d')],'ListId':_0x327071[_0xaac6('0x5b')],'VoiceQueueId':_0x327071['VoiceQueueId']||undefined,'CampaignId':_0x327071[_0xaac6('0x6c')]||undefined};};exports[_0xaac6('0x6d')]=function(_0xd61545){if(_0xd61545===_0xaac6('0x4a')||_0xd61545==='idContact'||_0xd61545==='queue'||_0xd61545===_0xaac6('0x6e')||_0xd61545==='campaigntype'||_0xd61545===_0xaac6('0x6f')||_0xd61545===_0xaac6('0x41')||_0xd61545==='channelAgent'||_0xd61545===_0xaac6('0x1b')||_0xd61545===_0xaac6('0x57')||_0xd61545===_0xaac6('0x1c')||_0xd61545==='scheduledat'||_0xd61545===_0xaac6('0x50')||_0xd61545==='countcongestionretry'||_0xd61545===_0xaac6('0x70')||_0xd61545==='countglobal'||_0xd61545===_0xaac6('0x71')||_0xd61545===_0xaac6('0x72')||_0xd61545===_0xaac6('0x73')||_0xd61545===_0xaac6('0x74')||_0xd61545===_0xaac6('0x1d')||_0xd61545===_0xaac6('0x5b')||_0xd61545===_0xaac6('0x42')||_0xd61545===_0xaac6('0x1e')||_0xd61545===_0xaac6('0x75')||_0xd61545===_0xaac6('0x76')||_0xd61545===_0xaac6('0x77')||_0xd61545===_0xaac6('0x78')||_0xd61545==='xmd-listid'||_0xd61545==='xmd-dialurl'||_0xd61545===_0xaac6('0x79')||_0xd61545===_0xaac6('0x7a')||_0xd61545===_0xaac6('0x7b')||_0xd61545===_0xaac6('0x7c')||_0xd61545==='xmd-contactid'||_0xd61545===_0xaac6('0x7d')||_0xd61545===_0xaac6('0x7e')||_0xd61545===_0xaac6('0x7f')||_0xd61545==='xmd-agi'||_0xd61545===_0xaac6('0x80')||_0xd61545===_0xaac6('0x81')||_0xd61545===_0xaac6('0x82')||_0xd61545===_0xaac6('0x83')||_0xd61545===_0xaac6('0x84')||_0xd61545===_0xaac6('0x85')||_0xd61545==='rtpaudioqosrtt'||_0xd61545===_0xaac6('0x86')||_0xd61545==='rtpaudioqos'||_0xd61545===_0xaac6('0x81')||_0xd61545===_0xaac6('0x82')||_0xd61545===_0xaac6('0x83')||_0xd61545===_0xaac6('0x84')||_0xd61545==='rtpaudioqoslossbridged'||_0xd61545===_0xaac6('0x87')||_0xd61545===_0xaac6('0x86')||_0xd61545===_0xaac6('0x88')||_0xd61545===_0xaac6('0x89')||_0xd61545===_0xaac6('0x37')||_0xd61545==='statedesc'){return![];}return!![];};exports[_0xaac6('0x8a')]=function(_0x14befd,_0x9b1f4){var _0x41d1c3,_0x3b14e6,_0x4a02b8;if(_0x9b1f4<=0x0){_0x9b1f4=0x1;}_0x41d1c3=new RegExp(_0xaac6('0x8b')+_0x9b1f4+'}$');_0x3b14e6=Math[_0xaac6('0x8c')](0xa,_0x9b1f4-0x1);_0x4a02b8=Math[_0xaac6('0x8c')](0xa,_0x9b1f4)-0x1;return util[_0xaac6('0x14')]('%s',_[_0xaac6('0x8d')](_0x14befd,_0x41d1c3,_[_0xaac6('0x8e')](_0x3b14e6,_0x4a02b8)));};exports[_0xaac6('0x8f')]=function(_0x5f300b){var _0x325a67=_0x5f300b[_0xaac6('0x90')](/"(.*?)"/);return _0x325a67?_0x325a67[0x1]:_0x5f300b;};exports['extractCalleridNumber']=function(_0x581561){var _0x194e60=_0x581561[_0xaac6('0x90')](/<(.*?)>/);return _0x194e60?_0x194e60[0x1]:_0x581561;}; \ No newline at end of file +var _0x0849=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','moment','../../../../config/logger','env','127.0.0.1','milliseconds','seconds','inspect','info','loggerError','error','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','Failure','RECALL','BOOKED','uniqueid','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','push','getDiff','diff','CampaignId','idContact','type','campaigntype','dialAnswer','callbackat','recallme','sipcallid','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi'];(function(_0x5cb723,_0x19cfff){var _0x421929=function(_0x27ce2f){while(--_0x27ce2f){_0x5cb723['push'](_0x5cb723['shift']());}};_0x421929(++_0x19cfff);}(_0x0849,0x1a3));var _0x9084=function(_0x87eff8,_0x17ee9a){_0x87eff8=_0x87eff8-0x0;var _0x585883=_0x0849[_0x87eff8];return _0x585883;};'use strict';var util=require(_0x9084('0x0'));var _=require('lodash');var moment=require(_0x9084('0x1'));var logger=require(_0x9084('0x2'))('preview');var ipAgi=process[_0x9084('0x3')]['XCALLY_IP_AGI']||_0x9084('0x4');function getSeconds(_0x325f79,_0x116db4){var _0x5baf6a=moment(_0x325f79)[_0x9084('0x5')](0x0);var _0x1b657d=moment(_0x116db4)[_0x9084('0x5')](0x0);return _0x5baf6a['diff'](_0x1b657d,_0x9084('0x6'));}exports['loggerCatch']=function(_0x22783b){return function(_0x257709){logger['error'](_0x22783b,util[_0x9084('0x7')](_0x257709,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x47a281,_0x19a97a){logger[_0x9084('0x8')](_0x47a281,util[_0x9084('0x7')](_0x19a97a,{'showHidden':![],'depth':null}));};exports[_0x9084('0x9')]=function(_0x5d17d8,_0x2e808f){logger[_0x9084('0xa')](_0x5d17d8,util[_0x9084('0x7')](_0x2e808f,{'showHidden':![],'depth':null}));};exports[_0x9084('0xb')]=function(_0x5198a6){return function(_0x5b2395){logger[_0x9084('0x8')](_0x5198a6,util[_0x9084('0x7')](_0x5b2395,{'showHidden':![],'depth':null}));};};exports[_0x9084('0xc')]=function(_0x46c08a,_0x27b2cc,_0x4cbb57){return{'message':_0x46c08a,'unlock':_0x27b2cc,'active':_0x4cbb57};};exports[_0x9084('0xd')]=function(_0x80b54,_0x2ecb0f,_0x6181ff){if(!_['isUndefined'](_0x6181ff)&&_0x9084('0xe')===typeof _0x6181ff&&!_[_0x9084('0xf')](_0x6181ff)){if(!_[_0x9084('0x10')](_0x2ecb0f)&&_0x9084('0xe')===typeof _0x2ecb0f&&!_[_0x9084('0xf')](_0x2ecb0f)){return util[_0x9084('0x11')](_0x9084('0x12'),_0x2ecb0f,_0x6181ff);}return util[_0x9084('0x11')](_0x9084('0x12'),_0x6181ff,_0x6181ff);}if(!_[_0x9084('0x10')](_0x80b54)&&'string'===typeof _0x80b54&&!_[_0x9084('0xf')](_0x80b54)){return _0x80b54;}return _0x9084('0x13');};exports['isActive']=function(_0x1058e4){if(_[_0x9084('0x14')](_0x1058e4)){return![];}return _0x1058e4;};exports[_0x9084('0x15')]=function(_0x50dd4c,_0x2410cb,_0x4199cb,_0xee7863,_0x49e1dd,_0x374472){var _0x1db882={'XMD-QUEUE':_0x2410cb[_0x9084('0x16')]?_0x2410cb[_0x9084('0x16')][_0x9084('0x17')]:'','XMD-CALLERID':_0xee7863,'XMD-CALLERID-PREVIEW':_0x374472?util[_0x9084('0x11')](_0x9084('0x12'),_0x374472[_0x9084('0x18')],_0x374472[_0x9084('0x19')]):_0xee7863,'XMD-DIALID':_0x49e1dd,'XMD-CONTACTID':_0x2410cb[_0x9084('0x1a')],'XMD-CDRTYPE':_0x9084('0x1b'),'CALLERID(all)':_0xee7863,'XMD-VOICEQUEUEID':_0x2410cb[_0x9084('0x1c')],'XMD-DIALCHANNEL':_0x4199cb,'XMD-DIALTIMEOUT':_0x50dd4c[_0x9084('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x9084('0x11')]('\x22rtTxX%s%s\x22',_0x50dd4c[_0x9084('0x1e')]?'g':'',_['isEmpty'](_0x50dd4c[_0x9084('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x50dd4c['dialPreviewUrl']||'','XMD-AGI':_0x50dd4c[_0x9084('0x20')]?util[_0x9084('0x11')](_0x9084('0x21'),ipAgi,_0x50dd4c[_0x9084('0x20')]):'NONE','XMD-AGIAFTER':_0x50dd4c[_0x9084('0x1e')]?util[_0x9084('0x11')](_0x9084('0x21'),ipAgi,_0x50dd4c[_0x9084('0x1e')]):_0x9084('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x374472?_0x374472[_0x9084('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x374472?_0x374472[_0x9084('0x24')]:'','XMD-DESTINATION':_0x9084('0x25')};if(!_['isEmpty'](_0x50dd4c[_0x9084('0x1f')])){_0x1db882[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x50dd4c['monitor_format'];_0x1db882[util[_0x9084('0x11')]('%s',_0x9084('0x26'))]=_0x49e1dd;}if(_0x2410cb&&_0x2410cb['Contact']){for(var _0x3bc505 in _0x2410cb[_0x9084('0x27')]){if(_0x2410cb[_0x9084('0x27')][_0x9084('0x28')](_0x3bc505)){if(!_['isNil'](_0x2410cb['Contact'][_0x3bc505])&&_0x3bc505!=='id'&&_0x3bc505!==_0x9084('0x29')&&_0x3bc505!==_0x9084('0x2a')&&_0x3bc505!==_0x9084('0x2b')){_0x1db882[util[_0x9084('0x11')](_0x9084('0x2c'),_0x9084('0x2d'),_[_0x9084('0x2e')](_0x3bc505))]=_0x2410cb[_0x9084('0x27')][_0x3bc505];}}}}return _0x1db882;};exports[_0x9084('0x2f')]=function(_0x386e41){var _0x5b146d={};for(var _0x2223f1 in _0x386e41){if(_0x386e41[_0x9084('0x28')](_0x2223f1)){_0x5b146d[util[_0x9084('0x11')]('%s',_['toLower'](_0x2223f1))]=_0x386e41[_0x2223f1];}}return{'variables':_0x5b146d};};exports[_0x9084('0x30')]=function(_0x2b0c34,_0x4d8c9e){if(!_[_0x9084('0x14')](_0x2b0c34)){if(_0x2b0c34[_0x9084('0x28')](_0x9084('0x31'))){if(_0x2b0c34[_0x9084('0x31')]>0x0){_0x2b0c34['originated']-=0x1;}else{logger[_0x9084('0xa')](_0x9084('0x32'),_0x4d8c9e);}}}else{logger[_0x9084('0xa')](_0x9084('0x33'),_0x4d8c9e);}};exports[_0x9084('0x34')]=function(_0x3cdb43){var _0x29bd26=moment()[_0x9084('0x11')](_0x9084('0x35'));_0x3cdb43[_0x9084('0x36')]=0xd;_0x3cdb43[_0x9084('0x37')]=_0x9084('0x38');_0x3cdb43[_0x9084('0x39')]=_0x29bd26;_0x3cdb43[_0x9084('0x3a')]=_0x29bd26;_0x3cdb43[_0x9084('0x3b')]=_0x29bd26;};exports['logAgent']=function(_0x50886e,_0x253421,_0x439173){var _0x1bd59e=moment()[_0x9084('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x50886e['state']=_0x253421;_0x50886e[_0x9084('0x37')]=_0x439173;_0x50886e[_0x9084('0x3a')]=_0x1bd59e;_0x50886e[_0x9084('0x3c')]=getSeconds(_0x50886e[_0x9084('0x3a')],_0x50886e['starttime']);};exports[_0x9084('0x3d')]=function(_0x404a28,_0x246184,_0x29b267){_0x404a28[_0x9084('0x3e')]=_0x246184;_0x404a28[_0x9084('0x3f')]=_0x29b267;};exports[_0x9084('0x40')]=function(_0x5931f5,_0x42c625,_0x272da4){var _0x5188ed=moment()[_0x9084('0x11')](_0x9084('0x35'));_0x5931f5[_0x9084('0x36')]=_0x42c625;_0x5931f5[_0x9084('0x37')]=_0x272da4;_0x5931f5['responsetime']=_0x5931f5['responsetime']?_0x5931f5[_0x9084('0x3a')]:_0x5188ed;_0x5931f5[_0x9084('0x3b')]=_0x5931f5[_0x9084('0x3b')]?_0x5931f5['endtime']:_0x5188ed;_0x5931f5['ringtime']=getSeconds(_0x5931f5[_0x9084('0x3a')]||0x0,_0x5931f5[_0x9084('0x39')]||0x0);_0x5931f5[_0x9084('0x41')]=_0x5931f5['answertime']?getSeconds(_0x5931f5[_0x9084('0x3b')],_0x5931f5['answertime']):0x0;};exports['isFailure']=function(_0x3f4162){return _0x3f4162===_0x9084('0x42');};exports['variablesAction']=function(_0x21aade,_0x5e62bd,_0xa7bce7,_0x5a9b7b,_0xfa2931){var _0x4adf23=_0x5a9b7b?_0x9084('0x43'):_0x21aade[_0x9084('0x18')];_0x4adf23=_0xfa2931?_0x9084('0x44'):_0x4adf23;return{'actionid':_0x21aade[_0x9084('0x45')],'action':'originate','channel':_0x21aade[_0x9084('0x46')],'callerid':util[_0x9084('0x11')]('\x22%s\x22\x20<%s>',_0x4adf23,_0x21aade[_0x9084('0x19')]),'Exten':_0x9084('0x25'),'Context':_0x9084('0x47'),'Priority':'1','variable':_0xa7bce7,'timeout':(_0x5e62bd['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x21aade['uniqueid']};};exports[_0x9084('0x48')]=function(_0x1a8c01){return _0x1a8c01[_0x9084('0x49')]+_0x1a8c01[_0x9084('0x4a')]+_0x1a8c01[_0x9084('0x4b')]+_0x1a8c01[_0x9084('0x4c')]+_0x1a8c01['countnosuchnumberretry'];};exports[_0x9084('0x4d')]=function(_0x234f89){var _0x284894=_[_0x9084('0x4e')](_0x234f89);_0x284894[_0x9084('0x36')]=0xf;_0x284894[_0x9084('0x37')]='Global';return _0x284894;};exports[_0x9084('0x4f')]=function(_0x18ef0f,_0xe64342,_0x4d7711){var _0x10e278={};_0x10e278[_0xe64342]=_0x18ef0f[_0xe64342];_0x10e278[_0x9084('0x50')]=![];_0x10e278['scheduledat']=moment()[_0x9084('0x51')](_0x4d7711,_0x9084('0x52'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x10e278[_0x9084('0x1a')]=_0x18ef0f[_0x9084('0x1a')];_0x10e278[_0x9084('0x53')]=_0x18ef0f[_0x9084('0x53')];_0x10e278['VoiceQueueId']=_0x18ef0f[_0x9084('0x1c')]||undefined;return _0x10e278;};exports[_0x9084('0x54')]=function(_0x4f1de1,_0x49b1c0){if(!_[_0x9084('0x14')](_0x4f1de1)){if(_0x4f1de1[_0x9084('0x55')]>0x0){_0x4f1de1['pTalking']-=0x1;}else{logger[_0x9084('0xa')](_0x49b1c0,_0x9084('0x56'));}}else{logger['error'](_0x49b1c0,_0x9084('0x57'));}};exports[_0x9084('0x58')]=function(_0x4cff00){if(_0x4cff00<=0x0){return!![];}return![];};exports[_0x9084('0x59')]=function(_0x4dc1a1,_0x423469,_0x141840){_0x4dc1a1[_0x9084('0x5a')]=_0x423469;_0x4dc1a1['name']=_0x4dc1a1[_0x9084('0x5b')];_0x4dc1a1[_0x9084('0x5c')]=_0x4dc1a1[_0x9084('0x46')];if(_0x141840){_0x4dc1a1[_0x9084('0x5d')]=_0x141840[_0x9084('0x5d')];}return _0x4dc1a1;};exports[_0x9084('0x5e')]=function(_0x5ddc35){var _0xb3cf03={};_0xb3cf03[_0x9084('0x5b')]=_0x5ddc35[_0x9084('0x5b')];_0xb3cf03[_0x9084('0x5c')]=_0x5ddc35['channelAgent'];_0xb3cf03['uniqueid']=_0x5ddc35[_0x9084('0x45')];return _0xb3cf03;};exports[_0x9084('0x5f')]=function(_0x3662ad){var _0x504d09=[];for(var _0x2a2621 in _0x3662ad){if(_0x3662ad[_0x9084('0x28')](_0x2a2621)){if(!_['isNil'](_0x3662ad[_0x2a2621])&&_0x3662ad[_0x2a2621][_0x9084('0x36')]===_0x9084('0x60')&&_0x3662ad[_0x2a2621]['status']==='reachable'){_0x504d09[_0x9084('0x61')](_0x3662ad[_0x2a2621]['id']);}}}return _0x504d09;};exports[_0x9084('0x62')]=function(_0x4efbce){var _0xdf2f63=moment()[_0x9084('0x5')](0x0);var _0x43b921=moment(_0x4efbce)[_0x9084('0x5')](0x0);return _0xdf2f63[_0x9084('0x63')](_0x43b921,'seconds');};exports['createBody']=function(_0x257296){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x257296['ContactId'],'ListId':_0x257296[_0x9084('0x53')],'VoiceQueueId':_0x257296[_0x9084('0x1c')]||undefined,'CampaignId':_0x257296[_0x9084('0x64')]||undefined};};exports['filterKey']=function(_0x870237){if(_0x870237===_0x9084('0x45')||_0x870237===_0x9084('0x65')||_0x870237===_0x9084('0x5b')||_0x870237===_0x9084('0x66')||_0x870237===_0x9084('0x67')||_0x870237===_0x9084('0x68')||_0x870237===_0x9084('0x3e')||_0x870237===_0x9084('0x46')||_0x870237==='calleridname'||_0x870237==='active'||_0x870237===_0x9084('0x19')||_0x870237==='scheduledat'||_0x870237===_0x9084('0x49')||_0x870237===_0x9084('0x4a')||_0x870237==='countnoanswerretry'||_0x870237==='countglobal'||_0x870237==='callback'||_0x870237==='callbackuniqueid'||_0x870237===_0x9084('0x69')||_0x870237===_0x9084('0x6a')||_0x870237==='ContactId'||_0x870237==='ListId'||_0x870237===_0x9084('0x3f')||_0x870237===_0x9084('0x1c')||_0x870237===_0x9084('0x6b')||_0x870237==='xmd-voicequeueid'||_0x870237==='xmd-queue'||_0x870237===_0x9084('0x6c')||_0x870237==='xmd-listid'||_0x870237===_0x9084('0x6d')||_0x870237===_0x9084('0x6e')||_0x870237==='xmd-dialoptions'||_0x870237===_0x9084('0x6f')||_0x870237===_0x9084('0x70')||_0x870237===_0x9084('0x71')||_0x870237===_0x9084('0x72')||_0x870237===_0x9084('0x73')||_0x870237==='xmd-agiafter'||_0x870237===_0x9084('0x74')||_0x870237===_0x9084('0x75')||_0x870237===_0x9084('0x76')||_0x870237===_0x9084('0x77')||_0x870237===_0x9084('0x78')||_0x870237===_0x9084('0x79')||_0x870237===_0x9084('0x7a')||_0x870237===_0x9084('0x7b')||_0x870237===_0x9084('0x7c')||_0x870237===_0x9084('0x75')||_0x870237===_0x9084('0x76')||_0x870237===_0x9084('0x77')||_0x870237===_0x9084('0x78')||_0x870237==='rtpaudioqosloss'||_0x870237===_0x9084('0x7a')||_0x870237==='rtpaudioqosrtt'||_0x870237===_0x9084('0x7c')||_0x870237===_0x9084('0x7d')||_0x870237===_0x9084('0x7e')||_0x870237===_0x9084('0x36')||_0x870237===_0x9084('0x37')){return![];}return!![];};exports[_0x9084('0x7f')]=function(_0x22f640,_0x279ed){var _0x6f75bb,_0x3f31ac,_0xc062a0;if(_0x279ed<=0x0){_0x279ed=0x1;}_0x6f75bb=new RegExp(_0x9084('0x80')+_0x279ed+'}$');_0x3f31ac=Math[_0x9084('0x81')](0xa,_0x279ed-0x1);_0xc062a0=Math[_0x9084('0x81')](0xa,_0x279ed)-0x1;return util[_0x9084('0x11')]('%s',_[_0x9084('0x82')](_0x22f640,_0x6f75bb,_[_0x9084('0x83')](_0x3f31ac,_0xc062a0)));};exports['extractCalleridName']=function(_0x1b03ec){var _0x1c588f=_0x1b03ec[_0x9084('0x84')](/"(.*?)"/);return _0x1c588f?_0x1c588f[0x1]:_0x1b03ec;};exports[_0x9084('0x85')]=function(_0x2d5353){var _0x1c37f6=_0x2d5353['match'](/<(.*?)>/);return _0x1c37f6?_0x1c37f6[0x1]:_0x2d5353;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 96e414d..0bb06a9 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 _0x3f38=['voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x1ace28,_0x45c297){var _0x20cf85=function(_0x10faae){while(--_0x10faae){_0x1ace28['push'](_0x1ace28['shift']());}};_0x20cf85(++_0x45c297);}(_0x3f38,0x18d));var _0x83f3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3f38[_0x397e5f];return _0x5302b8;};'use strict';exports[_0x83f3('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x83f3('0x1'),'required':!![]},'membername':{'type':_0x83f3('0x1'),'required':!![]},'penalty':{'type':_0x83f3('0x2'),'required':![]},'paused':{'type':_0x83f3('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x83f3('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x83f3('0x4')]={'interface':{'type':_0x83f3('0x1'),'required':!![]},'paused':{'type':_0x83f3('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x83f3('0x1'),'required':![]}};exports[_0x83f3('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x83f3('0x6')]={'uniqueid':{'type':_0x83f3('0x1'),'required':!![]},'filename':{'type':_0x83f3('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x83f3('0x1')}};exports[_0x83f3('0x7')]={'uniqueid':{'type':_0x83f3('0x1'),'required':!![]}};exports[_0x83f3('0x8')]={'uniqueid':{'type':_0x83f3('0x1'),'required':!![]},'exten':{'type':_0x83f3('0x1'),'required':!![]},'context':{'type':_0x83f3('0x1')}}; \ No newline at end of file +var _0x4c12=['string','number','boolean','queueremove','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x386ceb,_0x1239d4){var _0x27bf8f=function(_0x210ff7){while(--_0x210ff7){_0x386ceb['push'](_0x386ceb['shift']());}};_0x27bf8f(++_0x1239d4);}(_0x4c12,0x19d));var _0x24c1=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x4c12[_0x2fee96];return _0x2e6ad1;};'use strict';exports[_0x24c1('0x0')]={'queue':{'type':_0x24c1('0x1'),'required':!![]},'interface':{'type':_0x24c1('0x1'),'required':!![]},'membername':{'type':_0x24c1('0x1'),'required':!![]},'penalty':{'type':_0x24c1('0x2'),'required':![]},'paused':{'type':_0x24c1('0x3'),'required':![]}};exports[_0x24c1('0x4')]={'queue':{'type':_0x24c1('0x1'),'required':!![]},'interface':{'type':_0x24c1('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x24c1('0x1'),'required':!![]},'paused':{'type':_0x24c1('0x3')},'reason':{'type':_0x24c1('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x24c1('0x1'),'required':![]}};exports[_0x24c1('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x24c1('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x24c1('0x1')},'mixmonitorid':{'type':_0x24c1('0x1')}};exports[_0x24c1('0x7')]={'uniqueid':{'type':_0x24c1('0x1'),'required':!![]}};exports[_0x24c1('0x8')]={'uniqueid':{'type':_0x24c1('0x1'),'required':!![]},'exten':{'type':_0x24c1('0x1'),'required':!![]},'context':{'type':_0x24c1('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d93564f..38fd537 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 _0x4193=['../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','initTelephones','isUndefined','initTrunks','trunks','initVoiceQueues','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount'];(function(_0x3a902a,_0xca8442){var _0x24f2d5=function(_0xb6799a){while(--_0xb6799a){_0x3a902a['push'](_0x3a902a['shift']());}};_0x24f2d5(++_0xca8442);}(_0x4193,0x141));var _0x3419=function(_0x331449,_0x5a82c2){_0x331449=_0x331449-0x0;var _0x31bba2=_0x4193[_0x331449];return _0x31bba2;};'use strict';var BPromise=require(_0x3419('0x0'));var util=require(_0x3419('0x1'));var _=require(_0x3419('0x2'));var moment=require('moment');var Agent=require(_0x3419('0x3'));var Telephone=require(_0x3419('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x3419('0x5'));var Trigger=require(_0x3419('0x6'));var Template=require(_0x3419('0x7'));var Campaign=require(_0x3419('0x8'));var VoiceExtension=require(_0x3419('0x9'));var ZendeskAccount=require(_0x3419('0xa'));var SalesforceAccount=require(_0x3419('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x3419('0xc'));var ZohoAccount=require(_0x3419('0xd'));var DeskAccount=require(_0x3419('0xe'));var VtigerAccount=require(_0x3419('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x3419('0x10'));var FreshsalesAccount=require(_0x3419('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x3419('0x12')]={};this[_0x3419('0x13')]={};this['trunks']={};this[_0x3419('0x14')]={};this['triggers']={};this[_0x3419('0x15')]={};this['templates']={};this[_0x3419('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3419('0x17')]={};this[_0x3419('0x18')]={};this[_0x3419('0x19')]={};this[_0x3419('0x1a')]={};this[_0x3419('0x1b')]={};this[_0x3419('0x1c')]={};this[_0x3419('0x1d')]={};this[_0x3419('0x1e')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0x3419('0x1f')]={};this['deskAccounts']={};this[_0x3419('0x20')]={};this[_0x3419('0x21')]={};this[_0x3419('0x22')]={};this[_0x3419('0x23')]={};this['faxAccounts']={};};function freeIsNotKey(_0x598649,_0x5e6979,_0x1ae8ec){var _0x58af39=_[_0x3419('0x24')](_0x598649,function(_0x250b23,_0x224ae8){return _0x250b23[_0x1ae8ec];});for(var _0x20aec9 in _0x5e6979){if(_0x5e6979[_0x3419('0x25')](_0x20aec9)){if(!_0x58af39[_0x20aec9]){delete _0x5e6979[_0x20aec9];}}}}function freeIsNotKeySip(_0x544716,_0x3f6574){var _0x37bfd4=_['mapKeys'](_0x544716,function(_0x1ab1b0,_0xa651de){return util[_0x3419('0x26')](_0x3419('0x27'),_0x1ab1b0[_0x3419('0x28')]);});for(var _0x3398c0 in _0x3f6574){if(_0x3f6574[_0x3419('0x25')](_0x3398c0)){if(!_0x37bfd4[_0x3398c0]){delete _0x3f6574[_0x3398c0];}}}}function freeIsNotKeyAgent(_0x5a29ce,_0x82b016){var _0x49184e=_[_0x3419('0x24')](_0x5a29ce,function(_0x25b7ff,_0x57e2f5){var _0x21ae4c=_[_0x3419('0x29')](_0x25b7ff['interface'])?util[_0x3419('0x26')](_0x3419('0x27'),_0x25b7ff['name']):_0x25b7ff[_0x3419('0x2a')];return _0x21ae4c;});for(var _0x25ce34 in _0x82b016){if(_0x82b016[_0x3419('0x25')](_0x25ce34)){if(!_0x49184e[_0x25ce34]){delete _0x82b016[_0x25ce34];}}}}function clearVoiceCallReports(_0xe022bd){_0xe022bd['total']=0x0;_0xe022bd[_0x3419('0x2b')]=0x0;_0xe022bd['sumHoldTime']=0x0;_0xe022bd[_0x3419('0x2c')]=0x0;_0xe022bd[_0x3419('0x2d')]=0x0;}function clearCampaigns(_0x3afb68){if(!_[_0x3419('0x2e')](_0x3afb68)){for(var _0x4e351f in _0x3afb68){if(_0x3afb68[_0x3419('0x25')](_0x4e351f)){_0x3afb68[_0x4e351f][_0x3419('0x2f')]=0x0;_0x3afb68[_0x4e351f][_0x3419('0x30')]=0x0;}}}}function clearVoiceQueues(_0x2f2a1f){if(!_[_0x3419('0x2e')](_0x2f2a1f)){for(var _0x5e165c in _0x2f2a1f){if(_0x2f2a1f[_0x3419('0x25')](_0x5e165c)){_0x2f2a1f[_0x5e165c][_0x3419('0x31')]=0x0;_0x2f2a1f[_0x5e165c]['answered']=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x32')]=0x0;_0x2f2a1f[_0x5e165c]['abandoned']=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x33')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x2c')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x2d')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x34')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x35')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x36')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x37')]=0x0;_0x2f2a1f[_0x5e165c]['outboundNoSuchCallsDay']=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x38')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x39')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x3a')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x3b')]=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x3c')]=0x0;_0x2f2a1f[_0x5e165c]['outboundRejectCallsDay']=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x3d')]=0x0;_0x2f2a1f[_0x5e165c]['outboundAnswerAgiCallsDay']=0x0;_0x2f2a1f[_0x5e165c]['outboundAnswerCallsDay']=0x0;_0x2f2a1f[_0x5e165c][_0x3419('0x3e')]=!![];}}}}Realtime['prototype'][_0x3419('0x3f')]=function(_0x2387f0,_0x104952){for(var _0x3b7cbd in _0x104952){if(_0x2387f0[_0x3419('0x25')](_0x3b7cbd)){_0x2387f0[_0x3b7cbd]=_0x104952[_0x3b7cbd];}}};Realtime[_0x3419('0x40')][_0x3419('0x41')]=function(){var _0x4731bd=this;return function(_0x62cd9a){if(_0x62cd9a){freeIsNotKeyAgent(_0x62cd9a,_0x4731bd[_0x3419('0x12')]);for(var _0x3b5e25=0x0,_0x480df5={},_0x4dd3b6={};_0x3b5e25<_0x62cd9a[_0x3419('0x42')];_0x3b5e25+=0x1){_0x480df5=_0x62cd9a[_0x3b5e25];var _0x1540f2=_['isNil'](_0x480df5[_0x3419('0x2a')])?util['format'](_0x3419('0x27'),_0x480df5[_0x3419('0x28')]):_0x480df5[_0x3419('0x2a')];if(_['isUndefined'](_0x4731bd[_0x3419('0x12')][_0x1540f2])){_0x4731bd[_0x3419('0x12')][_0x1540f2]=new Agent(_0x480df5);}else{_0x4731bd['mergeFromDatabase'](_0x4731bd[_0x3419('0x12')][_0x1540f2],_0x480df5);}}}return _0x4731bd[_0x3419('0x12')];};};Realtime[_0x3419('0x40')][_0x3419('0x43')]=function(){var _0x4972ca=this;return function(_0x2cb468){if(_0x2cb468){freeIsNotKeySip(_0x2cb468,_0x4972ca[_0x3419('0x13')]);for(var _0x23315f=0x0,_0x239784={},_0x5ccd18={};_0x23315f<_0x2cb468[_0x3419('0x42')];_0x23315f+=0x1){_0x239784=_0x2cb468[_0x23315f];if(_[_0x3419('0x44')](_0x4972ca[_0x3419('0x13')][util[_0x3419('0x26')](_0x3419('0x27'),_0x239784[_0x3419('0x28')])])){_0x4972ca[_0x3419('0x13')][util['format']('SIP/%s',_0x239784[_0x3419('0x28')])]=new Telephone(_0x239784);}else{_0x4972ca[_0x3419('0x3f')](_0x4972ca['telephones'][util['format']('SIP/%s',_0x239784[_0x3419('0x28')])],_0x239784);}}}return _0x4972ca['telephones'];};};Realtime[_0x3419('0x40')][_0x3419('0x45')]=function(){var _0x4031ef=this;return function(_0x382d57){if(_0x382d57){freeIsNotKeySip(_0x382d57,_0x4031ef[_0x3419('0x46')]);for(var _0x4b92f6=0x0,_0x1e8be5={},_0x578308={};_0x4b92f6<_0x382d57[_0x3419('0x42')];_0x4b92f6+=0x1){_0x1e8be5=_0x382d57[_0x4b92f6];if(_[_0x3419('0x44')](_0x4031ef[_0x3419('0x46')][util[_0x3419('0x26')](_0x3419('0x27'),_0x1e8be5[_0x3419('0x28')])])){_0x4031ef['trunks'][util[_0x3419('0x26')](_0x3419('0x27'),_0x1e8be5[_0x3419('0x28')])]=new Trunk(_0x1e8be5);}else{_0x4031ef['mergeFromDatabase'](_0x4031ef[_0x3419('0x46')][util[_0x3419('0x26')]('SIP/%s',_0x1e8be5[_0x3419('0x28')])],_0x1e8be5);}}}return _0x4031ef[_0x3419('0x46')];};};Realtime[_0x3419('0x40')][_0x3419('0x47')]=function(){var _0x2af50f=this;return function(_0x28312e){if(_0x28312e){freeIsNotKey(_0x28312e,_0x2af50f[_0x3419('0x14')],_0x3419('0x28'));for(var _0xefaa2a=0x0,_0x172072={},_0x4da9e7={};_0xefaa2a<_0x28312e[_0x3419('0x42')];_0xefaa2a+=0x1){_0x172072=_0x28312e[_0xefaa2a];if(_[_0x3419('0x44')](_0x2af50f[_0x3419('0x14')][_0x172072['name']])){_0x2af50f[_0x3419('0x14')][_0x172072['name']]=new VoiceQueue(_0x172072);}else{_0x2af50f[_0x3419('0x3f')](_0x2af50f[_0x3419('0x14')][_0x172072['name']],_0x172072);}}}return _0x2af50f[_0x3419('0x14')];};};Realtime[_0x3419('0x40')][_0x3419('0x48')]=function(){var _0x34f34f=this;return function(_0x346a48){if(_0x346a48){freeIsNotKey(_0x346a48,_0x34f34f[_0x3419('0x49')],'id');for(var _0x1bd326=0x0,_0x4ae275={},_0x4a3c42={};_0x1bd326<_0x346a48['length'];_0x1bd326+=0x1){_0x4ae275=_0x346a48[_0x1bd326];if(_['isUndefined'](_0x34f34f[_0x3419('0x49')][_0x4ae275['id']])){_0x34f34f[_0x3419('0x49')][_0x4ae275['id']]=new Trigger(_0x4ae275);}else{_0x34f34f[_0x3419('0x3f')](_0x34f34f['triggers'][_0x4ae275['id']],_0x4ae275);}}}return _0x34f34f['triggers'];};};Realtime[_0x3419('0x40')][_0x3419('0x4a')]=function(){var _0x4640eb=this;return function(_0x9e3088){if(_0x9e3088){freeIsNotKey(_0x9e3088,_0x4640eb[_0x3419('0x4b')],'id');for(var _0x2bb621=0x0,_0x4b54a4={},_0x45f77e={};_0x2bb621<_0x9e3088[_0x3419('0x42')];_0x2bb621+=0x1){_0x4b54a4=_0x9e3088[_0x2bb621];if(_[_0x3419('0x44')](_0x4640eb[_0x3419('0x4b')][_0x4b54a4['id']])){_0x4640eb[_0x3419('0x4b')][_0x4b54a4['id']]=new Template(_0x4b54a4);}else{_0x4640eb[_0x3419('0x3f')](_0x4640eb['templates'][_0x4b54a4['id']],_0x4b54a4);}}}return _0x4640eb[_0x3419('0x4b')];};};Realtime['prototype'][_0x3419('0x4c')]=function(){var _0xead75a=this;return function(_0x1a1c58){if(_0x1a1c58){freeIsNotKey(_0x1a1c58,_0xead75a[_0x3419('0x1d')],'id');for(var _0x34c7a7=0x0,_0x109997={},_0xb879de={};_0x34c7a7<_0x1a1c58[_0x3419('0x42')];_0x34c7a7+=0x1){_0x109997=_0x1a1c58[_0x34c7a7];if(_[_0x3419('0x44')](_0xead75a[_0x3419('0x1d')][_0x109997['id']])){_0xead75a['zendeskAccounts'][_0x109997['id']]=new ZendeskAccount(_0x109997);}else{_0xead75a['mergeFromDatabase'](_0xead75a[_0x3419('0x1d')][_0x109997['id']],_0x109997);}}}return _0xead75a[_0x3419('0x1d')];};};Realtime[_0x3419('0x40')][_0x3419('0x4d')]=function(){var _0x10d363=this;return function(_0x45d3d1){if(_0x45d3d1){freeIsNotKey(_0x45d3d1,_0x10d363[_0x3419('0x1e')],'id');for(var _0x593721=0x0,_0x31a986={},_0x217a60={};_0x593721<_0x45d3d1[_0x3419('0x42')];_0x593721+=0x1){_0x31a986=_0x45d3d1[_0x593721];if(_[_0x3419('0x44')](_0x10d363[_0x3419('0x1e')][_0x31a986['id']])){_0x10d363[_0x3419('0x1e')][_0x31a986['id']]=new SalesforceAccount(_0x31a986);}else{_0x10d363['mergeFromDatabase'](_0x10d363[_0x3419('0x1e')][_0x31a986['id']],_0x31a986);}}}return _0x10d363['salesforceAccounts'];};};Realtime['prototype'][_0x3419('0x4e')]=function(){var _0x21c638=this;return function(_0x262b60){if(_0x262b60){freeIsNotKey(_0x262b60,_0x21c638['freshdeskAccounts'],'id');for(var _0x305fe0=0x0,_0x42dc65={},_0x4d7351={};_0x305fe0<_0x262b60[_0x3419('0x42')];_0x305fe0+=0x1){_0x42dc65=_0x262b60[_0x305fe0];if(_['isUndefined'](_0x21c638[_0x3419('0x4f')][_0x42dc65['id']])){_0x21c638[_0x3419('0x4f')][_0x42dc65['id']]=new FreshdeskAccount(_0x42dc65);}else{_0x21c638[_0x3419('0x3f')](_0x21c638[_0x3419('0x4f')][_0x42dc65['id']],_0x42dc65);}}}return _0x21c638[_0x3419('0x4f')];};};Realtime[_0x3419('0x40')][_0x3419('0x50')]=function(){var _0x344697=this;return function(_0x915ab9){if(_0x915ab9){freeIsNotKey(_0x915ab9,_0x344697[_0x3419('0x1f')],'id');for(var _0x2c44c6=0x0,_0x1ca72e={},_0x3605f4={};_0x2c44c6<_0x915ab9[_0x3419('0x42')];_0x2c44c6+=0x1){_0x1ca72e=_0x915ab9[_0x2c44c6];if(_[_0x3419('0x44')](_0x344697[_0x3419('0x1f')][_0x1ca72e['id']])){_0x344697['zohoAccounts'][_0x1ca72e['id']]=new ZohoAccount(_0x1ca72e);}else{_0x344697[_0x3419('0x3f')](_0x344697['zohoAccounts'][_0x1ca72e['id']],_0x1ca72e);}}}return _0x344697[_0x3419('0x1f')];};};Realtime[_0x3419('0x40')][_0x3419('0x51')]=function(){var _0x680ad5=this;return function(_0x1db081){if(_0x1db081){freeIsNotKey(_0x1db081,_0x680ad5[_0x3419('0x52')],'id');for(var _0x225033=0x0,_0x36b8ef={},_0x16663f={};_0x225033<_0x1db081[_0x3419('0x42')];_0x225033+=0x1){_0x36b8ef=_0x1db081[_0x225033];if(_['isUndefined'](_0x680ad5['deskAccounts'][_0x36b8ef['id']])){_0x680ad5['deskAccounts'][_0x36b8ef['id']]=new DeskAccount(_0x36b8ef);}else{_0x680ad5['mergeFromDatabase'](_0x680ad5[_0x3419('0x52')][_0x36b8ef['id']],_0x36b8ef);}}}return _0x680ad5['deskAccounts'];};};Realtime[_0x3419('0x40')][_0x3419('0x53')]=function(){var _0x110531=this;return function(_0x4b8401){if(_0x4b8401){freeIsNotKey(_0x4b8401,_0x110531['sugarcrmAccounts'],'id');for(var _0x344a55=0x0,_0x30a651={},_0x120ddd={};_0x344a55<_0x4b8401[_0x3419('0x42')];_0x344a55+=0x1){_0x30a651=_0x4b8401[_0x344a55];if(_[_0x3419('0x44')](_0x110531[_0x3419('0x54')][_0x30a651['id']])){_0x110531[_0x3419('0x54')][_0x30a651['id']]=new SugarcrmAccount(_0x30a651);}else{_0x110531[_0x3419('0x3f')](_0x110531[_0x3419('0x54')][_0x30a651['id']],_0x30a651);}}}return _0x110531[_0x3419('0x54')];};};Realtime[_0x3419('0x40')][_0x3419('0x55')]=function(){var _0x82e332=this;return function(_0x1df23f){if(_0x1df23f){freeIsNotKey(_0x1df23f,_0x82e332['vtigerAccounts'],'id');for(var _0x49d5ae=0x0,_0x165eea={},_0x1b8562={};_0x49d5ae<_0x1df23f[_0x3419('0x42')];_0x49d5ae+=0x1){_0x165eea=_0x1df23f[_0x49d5ae];if(_[_0x3419('0x44')](_0x82e332[_0x3419('0x20')][_0x165eea['id']])){_0x82e332['vtigerAccounts'][_0x165eea['id']]=new VtigerAccount(_0x165eea);}else{_0x82e332['mergeFromDatabase'](_0x82e332[_0x3419('0x20')][_0x165eea['id']],_0x165eea);}}}return _0x82e332[_0x3419('0x20')];};};Realtime[_0x3419('0x40')][_0x3419('0x56')]=function(){var _0x2496da=this;return function(_0xc1ecb3){if(_0xc1ecb3){freeIsNotKey(_0xc1ecb3,_0x2496da[_0x3419('0x21')],'id');for(var _0x4f5bab=0x0,_0x5ca136={},_0x27de33={};_0x4f5bab<_0xc1ecb3[_0x3419('0x42')];_0x4f5bab+=0x1){_0x5ca136=_0xc1ecb3[_0x4f5bab];if(_[_0x3419('0x44')](_0x2496da['servicenowAccounts'][_0x5ca136['id']])){_0x2496da[_0x3419('0x21')][_0x5ca136['id']]=new ServicenowAccount(_0x5ca136);}else{_0x2496da[_0x3419('0x3f')](_0x2496da[_0x3419('0x21')][_0x5ca136['id']],_0x5ca136);}}}return _0x2496da['servicenowAccounts'];};};Realtime[_0x3419('0x40')]['initDynamics365Accounts']=function(){var _0x1aaf31=this;return function(_0x12bc68){if(_0x12bc68){freeIsNotKey(_0x12bc68,_0x1aaf31[_0x3419('0x22')],'id');for(var _0x1ecbc0=0x0,_0xf908c={},_0x52541f={};_0x1ecbc0<_0x12bc68[_0x3419('0x42')];_0x1ecbc0+=0x1){_0xf908c=_0x12bc68[_0x1ecbc0];if(_[_0x3419('0x44')](_0x1aaf31[_0x3419('0x22')][_0xf908c['id']])){_0x1aaf31[_0x3419('0x22')][_0xf908c['id']]=new Dynamics365Account(_0xf908c);}else{_0x1aaf31[_0x3419('0x3f')](_0x1aaf31[_0x3419('0x22')][_0xf908c['id']],_0xf908c);}}}return _0x1aaf31[_0x3419('0x22')];};};Realtime[_0x3419('0x40')]['initFreshsalesAccounts']=function(){var _0x571e27=this;return function(_0xf9118f){if(_0xf9118f){freeIsNotKey(_0xf9118f,_0x571e27[_0x3419('0x23')],'id');for(var _0x53bdc6=0x0,_0x569f8c={},_0x54c863={};_0x53bdc6<_0xf9118f[_0x3419('0x42')];_0x53bdc6+=0x1){_0x569f8c=_0xf9118f[_0x53bdc6];if(_[_0x3419('0x44')](_0x571e27[_0x3419('0x23')][_0x569f8c['id']])){_0x571e27[_0x3419('0x23')][_0x569f8c['id']]=new FreshsalesAccount(_0x569f8c);}else{_0x571e27[_0x3419('0x3f')](_0x571e27[_0x3419('0x23')][_0x569f8c['id']],_0x569f8c);}}}return _0x571e27['freshsalesAccounts'];};};Realtime['prototype'][_0x3419('0x57')]=function(){var _0x3ef215=this;return function(_0x1b1ea0){for(var _0x221eb0=0x0;_0x221eb0<_0x1b1ea0['length'];_0x221eb0+=0x1){_[_0x3419('0x58')](_0x3ef215['voiceQueues'][_0x1b1ea0[_0x221eb0][_0x3419('0x28')]],_0x1b1ea0[_0x221eb0]);}return _0x3ef215[_0x3419('0x14')];};};Realtime[_0x3419('0x40')][_0x3419('0x59')]=function(){var _0xd89736=this;return function(_0x173025){clearVoiceQueues(_0xd89736[_0x3419('0x14')]);if(_0x173025){_0x173025=_['groupBy'](_0x173025,_0x3419('0x5a'));for(var _0x29a14a in _0x173025){if(_0x173025[_0x3419('0x25')](_0x29a14a)){var _0x2f3763={};for(var _0x51f9a2=0x0;_0x51f9a2<_0x173025[_0x29a14a]['length'];_0x51f9a2+=0x1){var _0x236a6a=_0x173025[_0x29a14a][_0x51f9a2][_0x3419('0x5b')];if(_0xd89736[_0x3419('0x14')][_0x236a6a]){if(_0x173025[_0x29a14a][_0x51f9a2][_0x3419('0x5c')]){_0xd89736[_0x3419('0x14')][_0x236a6a]['unmanaged']+=0x1;}if(_0x173025[_0x29a14a][_0x51f9a2]['queuecallerabandon']){_0xd89736[_0x3419('0x14')][_0x236a6a][_0x3419('0x5d')]+=0x1;}_0xd89736[_0x3419('0x14')][_0x236a6a][_0x3419('0x33')]+=moment(_0x173025[_0x29a14a][_0x51f9a2][_0x3419('0x5e')])[_0x3419('0x5f')](moment(_0x173025[_0x29a14a][_0x51f9a2][_0x3419('0x60')]),_0x3419('0x61'))||0x0;if(_0x51f9a2===_0x173025[_0x29a14a]['length']-0x1){_0xd89736[_0x3419('0x14')][_0x236a6a][_0x3419('0x2c')]+=moment(_0x173025[_0x29a14a][_0x51f9a2]['queuecallercompleteAt']||_0x173025[_0x29a14a][_0x51f9a2][_0x3419('0x62')]||_0x173025[_0x29a14a][_0x51f9a2][_0x3419('0x63')])['diff'](moment(_0x173025[_0x29a14a][_0x51f9a2][_0x3419('0x60')]),_0x3419('0x61'))||0x0;_0xd89736[_0x3419('0x14')][_0x236a6a][_0x3419('0x31')]+=0x1;if(_0x173025[_0x29a14a][_0x51f9a2][_0x3419('0x64')]){_0xd89736[_0x3419('0x14')][_0x236a6a][_0x3419('0x2b')]+=0x1;_0xd89736[_0x3419('0x14')][_0x236a6a][_0x3419('0x2d')]+=moment(_0x173025[_0x29a14a][_0x51f9a2]['queuecallercompleteAt'])['diff'](moment(_0x173025[_0x29a14a][_0x51f9a2][_0x3419('0x5e')]),_0x3419('0x61'))||0x0;}}else{_0xd89736[_0x3419('0x14')][_0x236a6a][_0x3419('0x2c')]+=_0xd89736[_0x3419('0x14')][_0x236a6a]['sumHoldTime']||0x0;}}}}}}return _0xd89736[_0x3419('0x14')];};};Realtime[_0x3419('0x40')][_0x3419('0x65')]=function(){var _0x50ea7d=this;return function(_0x293264){clearVoiceCallReports(_0x50ea7d[_0x3419('0x16')]);if(_0x293264){for(var _0x379b4e=0x0;_0x379b4e<_0x293264['length'];_0x379b4e+=0x1){_0x50ea7d[_0x3419('0x16')][_0x3419('0x31')]+=0x1;_0x50ea7d[_0x3419('0x16')][_0x3419('0x2c')]+=_0x293264[_0x379b4e][_0x3419('0x66')];if(_0x293264[_0x379b4e]['disposition']===_0x3419('0x67')){_0x50ea7d[_0x3419('0x16')][_0x3419('0x2b')]+=0x1;_0x50ea7d[_0x3419('0x16')][_0x3419('0x33')]+=_0x293264[_0x379b4e][_0x3419('0x66')]-_0x293264[_0x379b4e]['billableseconds']||0x0;_0x50ea7d[_0x3419('0x16')][_0x3419('0x2d')]+=_0x293264[_0x379b4e][_0x3419('0x68')];}}}return _0x50ea7d[_0x3419('0x16')];};};Realtime[_0x3419('0x40')][_0x3419('0x69')]=function(){var _0x83ade2=this;return function(_0x53d2e5){if(_0x53d2e5){freeIsNotKey(_0x53d2e5,_0x83ade2[_0x3419('0x15')],'name');for(var _0x51c680=0x0,_0x4a6f2e={};_0x51c680<_0x53d2e5[_0x3419('0x42')];_0x51c680+=0x1){_0x4a6f2e=_0x53d2e5[_0x51c680];if(_[_0x3419('0x44')](_0x83ade2[_0x3419('0x15')][_0x4a6f2e[_0x3419('0x28')]])){_0x83ade2['campaigns'][_0x4a6f2e[_0x3419('0x28')]]=new Campaign(_0x4a6f2e);}else{_0x83ade2['mergeFromDatabase'](_0x83ade2[_0x3419('0x15')][_0x4a6f2e[_0x3419('0x28')]],_0x4a6f2e);_0x83ade2[_0x3419('0x15')][_0x4a6f2e[_0x3419('0x28')]][_0x3419('0x6a')]=_0x4a6f2e[_0x3419('0x6b')]?_0x4a6f2e[_0x3419('0x6b')]['name']:undefined;}}}return _0x83ade2[_0x3419('0x15')];};};Realtime[_0x3419('0x40')]['initVoiceExtensions']=function(){var _0x3e9e46=this;return function(_0x3b8933){if(_0x3b8933){freeIsNotKey(_0x3b8933,_0x3e9e46[_0x3419('0x17')],'id');for(var _0x1a33be=0x0,_0x2c4f7f={};_0x1a33be<_0x3b8933[_0x3419('0x42')];_0x1a33be+=0x1){_0x2c4f7f=_0x3b8933[_0x1a33be];if(_[_0x3419('0x44')](_0x3e9e46[_0x3419('0x17')][_0x2c4f7f['id']])){_0x3e9e46['voiceExtensions'][_0x2c4f7f['id']]=new VoiceExtension(_0x2c4f7f);}else{_0x3e9e46[_0x3419('0x3f')](_0x3e9e46['voiceExtensions'][_0x2c4f7f['id']],_0x2c4f7f);}}}return _0x3e9e46[_0x3419('0x17')];};};Realtime[_0x3419('0x40')][_0x3419('0x6c')]=function(){var _0x3b3c33=this;return function(_0xa8967e){clearCampaigns(_0x3b3c33[_0x3419('0x15')]);for(var _0x3e4d7b=0x0;_0x3e4d7b<_0xa8967e[_0x3419('0x42')];_0x3e4d7b+=0x1){_[_0x3419('0x58')](_0x3b3c33[_0x3419('0x15')][_0xa8967e[_0x3e4d7b][_0x3419('0x28')]],_0xa8967e[_0x3e4d7b]);}return _0x3b3c33[_0x3419('0x15')];};};Realtime[_0x3419('0x40')][_0x3419('0x6d')]=function(){var _0x3818eb=this;return function(_0xfeba39){if(_0xfeba39){freeIsNotKey(_0xfeba39,_0x3818eb[_0x3419('0x6e')],'id');for(var _0xf14d40=0x0,_0x55e591={},_0x3d03f6={};_0xf14d40<_0xfeba39[_0x3419('0x42')];_0xf14d40+=0x1){_0x55e591=_0xfeba39[_0xf14d40];if(_['isUndefined'](_0x3818eb[_0x3419('0x6e')][_0x55e591['id']])){_0x3818eb[_0x3419('0x6e')][_0x55e591['id']]=new FaxAccount(_0x55e591);}else{_0x3818eb[_0x3419('0x3f')](_0x3818eb[_0x3419('0x6e')][_0x55e591['id']],_0x55e591);}}}return _0x3818eb[_0x3419('0x6e')];};};module[_0x3419('0x6f')]=Realtime; \ No newline at end of file +var _0x7dec=['../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','interface','total','answered','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','sumHoldTime','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isNil','SIP/%s','name','isUndefined','initTelephones','telephones','mergeFromDatabase','initTrunks','initVoiceQueues','voiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','moment','../model/telephone','../model/trunk','../model/trigger'];(function(_0x4495d7,_0x441091){var _0x459726=function(_0x32523b){while(--_0x32523b){_0x4495d7['push'](_0x4495d7['shift']());}};_0x459726(++_0x441091);}(_0x7dec,0x1aa));var _0xc7de=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x7dec[_0x21f931];return _0x3f083c;};'use strict';var BPromise=require(_0xc7de('0x0'));var util=require(_0xc7de('0x1'));var _=require('lodash');var moment=require(_0xc7de('0x2'));var Agent=require('../model/agent');var Telephone=require(_0xc7de('0x3'));var Trunk=require(_0xc7de('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xc7de('0x5'));var Template=require(_0xc7de('0x6'));var Campaign=require(_0xc7de('0x7'));var VoiceExtension=require(_0xc7de('0x8'));var ZendeskAccount=require(_0xc7de('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xc7de('0xa'));var SugarcrmAccount=require(_0xc7de('0xb'));var ZohoAccount=require(_0xc7de('0xc'));var DeskAccount=require(_0xc7de('0xd'));var VtigerAccount=require(_0xc7de('0xe'));var ServicenowAccount=require(_0xc7de('0xf'));var Dynamics365Account=require(_0xc7de('0x10'));var FreshsalesAccount=require(_0xc7de('0x11'));var FaxAccount=require(_0xc7de('0x12'));var Realtime=function(){this[_0xc7de('0x13')]={};this['telephones']={};this[_0xc7de('0x14')]={};this['voiceQueues']={};this[_0xc7de('0x15')]={};this[_0xc7de('0x16')]={};this[_0xc7de('0x17')]={};this[_0xc7de('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc7de('0x19')]={};this[_0xc7de('0x1a')]={};this[_0xc7de('0x1b')]={};this[_0xc7de('0x1c')]={};this[_0xc7de('0x1d')]={};this[_0xc7de('0x1e')]={};this[_0xc7de('0x1f')]={};this[_0xc7de('0x20')]={};this[_0xc7de('0x21')]={};this[_0xc7de('0x22')]={};this[_0xc7de('0x23')]={};this[_0xc7de('0x24')]={};this[_0xc7de('0x25')]={};this[_0xc7de('0x26')]={};this[_0xc7de('0x27')]={};this[_0xc7de('0x28')]={};this[_0xc7de('0x29')]={};};function freeIsNotKey(_0x4be4b5,_0x5078f3,_0x1563d1){var _0x16d122=_['mapKeys'](_0x4be4b5,function(_0x4ac20f,_0x151d6d){return _0x4ac20f[_0x1563d1];});for(var _0x1d03af in _0x5078f3){if(_0x5078f3[_0xc7de('0x2a')](_0x1d03af)){if(!_0x16d122[_0x1d03af]){delete _0x5078f3[_0x1d03af];}}}}function freeIsNotKeySip(_0x5197f3,_0x518c0e){var _0x2d193f=_['mapKeys'](_0x5197f3,function(_0x36345c,_0x13c29e){return util[_0xc7de('0x2b')]('SIP/%s',_0x36345c['name']);});for(var _0x197fbd in _0x518c0e){if(_0x518c0e[_0xc7de('0x2a')](_0x197fbd)){if(!_0x2d193f[_0x197fbd]){delete _0x518c0e[_0x197fbd];}}}}function freeIsNotKeyAgent(_0x1b9cd2,_0x5eba79){var _0x17bff1=_['mapKeys'](_0x1b9cd2,function(_0x279c1a,_0x31bca6){var _0x2561e7=_['isNil'](_0x279c1a[_0xc7de('0x2c')])?util[_0xc7de('0x2b')]('SIP/%s',_0x279c1a['name']):_0x279c1a[_0xc7de('0x2c')];return _0x2561e7;});for(var _0x30c23e in _0x5eba79){if(_0x5eba79[_0xc7de('0x2a')](_0x30c23e)){if(!_0x17bff1[_0x30c23e]){delete _0x5eba79[_0x30c23e];}}}}function clearVoiceCallReports(_0x533ef3){_0x533ef3[_0xc7de('0x2d')]=0x0;_0x533ef3[_0xc7de('0x2e')]=0x0;_0x533ef3['sumHoldTime']=0x0;_0x533ef3[_0xc7de('0x2f')]=0x0;_0x533ef3[_0xc7de('0x30')]=0x0;}function clearCampaigns(_0x154bf7){if(!_['isEmpty'](_0x154bf7)){for(var _0x3d3d38 in _0x154bf7){if(_0x154bf7[_0xc7de('0x2a')](_0x3d3d38)){_0x154bf7[_0x3d3d38][_0xc7de('0x31')]=0x0;_0x154bf7[_0x3d3d38][_0xc7de('0x32')]=0x0;}}}}function clearVoiceQueues(_0xa6cf92){if(!_[_0xc7de('0x33')](_0xa6cf92)){for(var _0x3c4c4c in _0xa6cf92){if(_0xa6cf92['hasOwnProperty'](_0x3c4c4c)){_0xa6cf92[_0x3c4c4c][_0xc7de('0x2d')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x2e')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x34')]=0x0;_0xa6cf92[_0x3c4c4c]['abandoned']=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x35')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x2f')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x30')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x36')]=0x0;_0xa6cf92[_0x3c4c4c]['outboundNoAnswerCallsDay']=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x37')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x38')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x39')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x3a')]=0x0;_0xa6cf92[_0x3c4c4c]['outboundDropCallsDayTimeout']=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x3b')]=0x0;_0xa6cf92[_0x3c4c4c]['outboundBlacklistCallsDay']=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x3c')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x3d')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x3e')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x36')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x3f')]=0x0;_0xa6cf92[_0x3c4c4c][_0xc7de('0x40')]=!![];}}}}Realtime[_0xc7de('0x41')]['mergeFromDatabase']=function(_0x44beff,_0x12728f){for(var _0x219f17 in _0x12728f){if(_0x44beff[_0xc7de('0x2a')](_0x219f17)){_0x44beff[_0x219f17]=_0x12728f[_0x219f17];}}};Realtime[_0xc7de('0x41')][_0xc7de('0x42')]=function(){var _0x3fb5be=this;return function(_0xced4fd){if(_0xced4fd){freeIsNotKeyAgent(_0xced4fd,_0x3fb5be[_0xc7de('0x13')]);for(var _0x4a8840=0x0,_0x1fe35f={},_0x33ce1d={};_0x4a8840<_0xced4fd[_0xc7de('0x43')];_0x4a8840+=0x1){_0x1fe35f=_0xced4fd[_0x4a8840];var _0x44e2a9=_[_0xc7de('0x44')](_0x1fe35f[_0xc7de('0x2c')])?util['format'](_0xc7de('0x45'),_0x1fe35f[_0xc7de('0x46')]):_0x1fe35f[_0xc7de('0x2c')];if(_[_0xc7de('0x47')](_0x3fb5be[_0xc7de('0x13')][_0x44e2a9])){_0x3fb5be[_0xc7de('0x13')][_0x44e2a9]=new Agent(_0x1fe35f);}else{_0x3fb5be['mergeFromDatabase'](_0x3fb5be[_0xc7de('0x13')][_0x44e2a9],_0x1fe35f);}}}return _0x3fb5be[_0xc7de('0x13')];};};Realtime['prototype'][_0xc7de('0x48')]=function(){var _0x33c875=this;return function(_0x2a71e5){if(_0x2a71e5){freeIsNotKeySip(_0x2a71e5,_0x33c875[_0xc7de('0x49')]);for(var _0x493ad9=0x0,_0x55064e={},_0x25bab6={};_0x493ad9<_0x2a71e5[_0xc7de('0x43')];_0x493ad9+=0x1){_0x55064e=_0x2a71e5[_0x493ad9];if(_['isUndefined'](_0x33c875['telephones'][util[_0xc7de('0x2b')](_0xc7de('0x45'),_0x55064e[_0xc7de('0x46')])])){_0x33c875[_0xc7de('0x49')][util[_0xc7de('0x2b')]('SIP/%s',_0x55064e[_0xc7de('0x46')])]=new Telephone(_0x55064e);}else{_0x33c875[_0xc7de('0x4a')](_0x33c875[_0xc7de('0x49')][util[_0xc7de('0x2b')](_0xc7de('0x45'),_0x55064e[_0xc7de('0x46')])],_0x55064e);}}}return _0x33c875['telephones'];};};Realtime[_0xc7de('0x41')][_0xc7de('0x4b')]=function(){var _0x556276=this;return function(_0x144b3e){if(_0x144b3e){freeIsNotKeySip(_0x144b3e,_0x556276['trunks']);for(var _0x32912d=0x0,_0x862a2={},_0x6b437f={};_0x32912d<_0x144b3e[_0xc7de('0x43')];_0x32912d+=0x1){_0x862a2=_0x144b3e[_0x32912d];if(_[_0xc7de('0x47')](_0x556276[_0xc7de('0x14')][util[_0xc7de('0x2b')]('SIP/%s',_0x862a2[_0xc7de('0x46')])])){_0x556276['trunks'][util[_0xc7de('0x2b')](_0xc7de('0x45'),_0x862a2[_0xc7de('0x46')])]=new Trunk(_0x862a2);}else{_0x556276[_0xc7de('0x4a')](_0x556276[_0xc7de('0x14')][util[_0xc7de('0x2b')](_0xc7de('0x45'),_0x862a2[_0xc7de('0x46')])],_0x862a2);}}}return _0x556276[_0xc7de('0x14')];};};Realtime['prototype'][_0xc7de('0x4c')]=function(){var _0x55e0da=this;return function(_0x130845){if(_0x130845){freeIsNotKey(_0x130845,_0x55e0da[_0xc7de('0x4d')],_0xc7de('0x46'));for(var _0x7a463=0x0,_0x11c295={},_0x4d0c58={};_0x7a463<_0x130845[_0xc7de('0x43')];_0x7a463+=0x1){_0x11c295=_0x130845[_0x7a463];if(_[_0xc7de('0x47')](_0x55e0da[_0xc7de('0x4d')][_0x11c295['name']])){_0x55e0da[_0xc7de('0x4d')][_0x11c295['name']]=new VoiceQueue(_0x11c295);}else{_0x55e0da['mergeFromDatabase'](_0x55e0da[_0xc7de('0x4d')][_0x11c295[_0xc7de('0x46')]],_0x11c295);}}}return _0x55e0da[_0xc7de('0x4d')];};};Realtime[_0xc7de('0x41')]['initTriggers']=function(){var _0x479d0c=this;return function(_0x33bdd6){if(_0x33bdd6){freeIsNotKey(_0x33bdd6,_0x479d0c[_0xc7de('0x15')],'id');for(var _0x5cd5ac=0x0,_0xd1beaf={},_0x230cf8={};_0x5cd5ac<_0x33bdd6['length'];_0x5cd5ac+=0x1){_0xd1beaf=_0x33bdd6[_0x5cd5ac];if(_['isUndefined'](_0x479d0c['triggers'][_0xd1beaf['id']])){_0x479d0c[_0xc7de('0x15')][_0xd1beaf['id']]=new Trigger(_0xd1beaf);}else{_0x479d0c[_0xc7de('0x4a')](_0x479d0c[_0xc7de('0x15')][_0xd1beaf['id']],_0xd1beaf);}}}return _0x479d0c[_0xc7de('0x15')];};};Realtime[_0xc7de('0x41')][_0xc7de('0x4e')]=function(){var _0x2c133e=this;return function(_0x36b01c){if(_0x36b01c){freeIsNotKey(_0x36b01c,_0x2c133e[_0xc7de('0x17')],'id');for(var _0x15e9c7=0x0,_0x2b1f97={},_0x3248df={};_0x15e9c7<_0x36b01c[_0xc7de('0x43')];_0x15e9c7+=0x1){_0x2b1f97=_0x36b01c[_0x15e9c7];if(_['isUndefined'](_0x2c133e[_0xc7de('0x17')][_0x2b1f97['id']])){_0x2c133e['templates'][_0x2b1f97['id']]=new Template(_0x2b1f97);}else{_0x2c133e[_0xc7de('0x4a')](_0x2c133e[_0xc7de('0x17')][_0x2b1f97['id']],_0x2b1f97);}}}return _0x2c133e[_0xc7de('0x17')];};};Realtime['prototype'][_0xc7de('0x4f')]=function(){var _0x28f620=this;return function(_0x450b35){if(_0x450b35){freeIsNotKey(_0x450b35,_0x28f620['zendeskAccounts'],'id');for(var _0x482ba7=0x0,_0x247471={},_0x3a45b0={};_0x482ba7<_0x450b35['length'];_0x482ba7+=0x1){_0x247471=_0x450b35[_0x482ba7];if(_[_0xc7de('0x47')](_0x28f620[_0xc7de('0x1f')][_0x247471['id']])){_0x28f620[_0xc7de('0x1f')][_0x247471['id']]=new ZendeskAccount(_0x247471);}else{_0x28f620[_0xc7de('0x4a')](_0x28f620[_0xc7de('0x1f')][_0x247471['id']],_0x247471);}}}return _0x28f620['zendeskAccounts'];};};Realtime[_0xc7de('0x41')][_0xc7de('0x50')]=function(){var _0x42da4b=this;return function(_0x1bc045){if(_0x1bc045){freeIsNotKey(_0x1bc045,_0x42da4b[_0xc7de('0x20')],'id');for(var _0x49a126=0x0,_0x6a0734={},_0x365a30={};_0x49a126<_0x1bc045[_0xc7de('0x43')];_0x49a126+=0x1){_0x6a0734=_0x1bc045[_0x49a126];if(_[_0xc7de('0x47')](_0x42da4b[_0xc7de('0x20')][_0x6a0734['id']])){_0x42da4b[_0xc7de('0x20')][_0x6a0734['id']]=new SalesforceAccount(_0x6a0734);}else{_0x42da4b[_0xc7de('0x4a')](_0x42da4b['salesforceAccounts'][_0x6a0734['id']],_0x6a0734);}}}return _0x42da4b[_0xc7de('0x20')];};};Realtime[_0xc7de('0x41')]['initFreshdeskAccounts']=function(){var _0x45741d=this;return function(_0x1d05bf){if(_0x1d05bf){freeIsNotKey(_0x1d05bf,_0x45741d[_0xc7de('0x22')],'id');for(var _0x14c798=0x0,_0x3aec49={},_0x482425={};_0x14c798<_0x1d05bf[_0xc7de('0x43')];_0x14c798+=0x1){_0x3aec49=_0x1d05bf[_0x14c798];if(_[_0xc7de('0x47')](_0x45741d[_0xc7de('0x22')][_0x3aec49['id']])){_0x45741d[_0xc7de('0x22')][_0x3aec49['id']]=new FreshdeskAccount(_0x3aec49);}else{_0x45741d[_0xc7de('0x4a')](_0x45741d[_0xc7de('0x22')][_0x3aec49['id']],_0x3aec49);}}}return _0x45741d[_0xc7de('0x22')];};};Realtime[_0xc7de('0x41')][_0xc7de('0x51')]=function(){var _0x1ab38d=this;return function(_0x340567){if(_0x340567){freeIsNotKey(_0x340567,_0x1ab38d[_0xc7de('0x23')],'id');for(var _0x49e9b=0x0,_0x2edbb6={},_0x139b3b={};_0x49e9b<_0x340567[_0xc7de('0x43')];_0x49e9b+=0x1){_0x2edbb6=_0x340567[_0x49e9b];if(_[_0xc7de('0x47')](_0x1ab38d['zohoAccounts'][_0x2edbb6['id']])){_0x1ab38d[_0xc7de('0x23')][_0x2edbb6['id']]=new ZohoAccount(_0x2edbb6);}else{_0x1ab38d[_0xc7de('0x4a')](_0x1ab38d[_0xc7de('0x23')][_0x2edbb6['id']],_0x2edbb6);}}}return _0x1ab38d['zohoAccounts'];};};Realtime[_0xc7de('0x41')]['initDeskAccounts']=function(){var _0x141458=this;return function(_0x425ddc){if(_0x425ddc){freeIsNotKey(_0x425ddc,_0x141458[_0xc7de('0x24')],'id');for(var _0x170fa3=0x0,_0xcf9575={},_0x355487={};_0x170fa3<_0x425ddc[_0xc7de('0x43')];_0x170fa3+=0x1){_0xcf9575=_0x425ddc[_0x170fa3];if(_[_0xc7de('0x47')](_0x141458['deskAccounts'][_0xcf9575['id']])){_0x141458[_0xc7de('0x24')][_0xcf9575['id']]=new DeskAccount(_0xcf9575);}else{_0x141458[_0xc7de('0x4a')](_0x141458[_0xc7de('0x24')][_0xcf9575['id']],_0xcf9575);}}}return _0x141458['deskAccounts'];};};Realtime[_0xc7de('0x41')][_0xc7de('0x52')]=function(){var _0x5b2db8=this;return function(_0x4f3b72){if(_0x4f3b72){freeIsNotKey(_0x4f3b72,_0x5b2db8['sugarcrmAccounts'],'id');for(var _0x2e9fd3=0x0,_0x2e5ce1={},_0x305769={};_0x2e9fd3<_0x4f3b72[_0xc7de('0x43')];_0x2e9fd3+=0x1){_0x2e5ce1=_0x4f3b72[_0x2e9fd3];if(_[_0xc7de('0x47')](_0x5b2db8['sugarcrmAccounts'][_0x2e5ce1['id']])){_0x5b2db8[_0xc7de('0x21')][_0x2e5ce1['id']]=new SugarcrmAccount(_0x2e5ce1);}else{_0x5b2db8[_0xc7de('0x4a')](_0x5b2db8[_0xc7de('0x21')][_0x2e5ce1['id']],_0x2e5ce1);}}}return _0x5b2db8[_0xc7de('0x21')];};};Realtime['prototype'][_0xc7de('0x53')]=function(){var _0x5beb6a=this;return function(_0x460300){if(_0x460300){freeIsNotKey(_0x460300,_0x5beb6a['vtigerAccounts'],'id');for(var _0x2d8297=0x0,_0x3a371e={},_0x66e5df={};_0x2d8297<_0x460300[_0xc7de('0x43')];_0x2d8297+=0x1){_0x3a371e=_0x460300[_0x2d8297];if(_[_0xc7de('0x47')](_0x5beb6a[_0xc7de('0x25')][_0x3a371e['id']])){_0x5beb6a[_0xc7de('0x25')][_0x3a371e['id']]=new VtigerAccount(_0x3a371e);}else{_0x5beb6a[_0xc7de('0x4a')](_0x5beb6a[_0xc7de('0x25')][_0x3a371e['id']],_0x3a371e);}}}return _0x5beb6a[_0xc7de('0x25')];};};Realtime[_0xc7de('0x41')][_0xc7de('0x54')]=function(){var _0x52ea6d=this;return function(_0x5854de){if(_0x5854de){freeIsNotKey(_0x5854de,_0x52ea6d['servicenowAccounts'],'id');for(var _0x41c9aa=0x0,_0x3fe411={},_0x1fbddd={};_0x41c9aa<_0x5854de[_0xc7de('0x43')];_0x41c9aa+=0x1){_0x3fe411=_0x5854de[_0x41c9aa];if(_['isUndefined'](_0x52ea6d[_0xc7de('0x26')][_0x3fe411['id']])){_0x52ea6d[_0xc7de('0x26')][_0x3fe411['id']]=new ServicenowAccount(_0x3fe411);}else{_0x52ea6d['mergeFromDatabase'](_0x52ea6d[_0xc7de('0x26')][_0x3fe411['id']],_0x3fe411);}}}return _0x52ea6d[_0xc7de('0x26')];};};Realtime[_0xc7de('0x41')]['initDynamics365Accounts']=function(){var _0x493b95=this;return function(_0x50bb61){if(_0x50bb61){freeIsNotKey(_0x50bb61,_0x493b95['dynamics365Accounts'],'id');for(var _0x29b164=0x0,_0x592105={},_0x520350={};_0x29b164<_0x50bb61[_0xc7de('0x43')];_0x29b164+=0x1){_0x592105=_0x50bb61[_0x29b164];if(_[_0xc7de('0x47')](_0x493b95['dynamics365Accounts'][_0x592105['id']])){_0x493b95[_0xc7de('0x27')][_0x592105['id']]=new Dynamics365Account(_0x592105);}else{_0x493b95[_0xc7de('0x4a')](_0x493b95[_0xc7de('0x27')][_0x592105['id']],_0x592105);}}}return _0x493b95[_0xc7de('0x27')];};};Realtime['prototype'][_0xc7de('0x55')]=function(){var _0x2170c6=this;return function(_0x3e1f58){if(_0x3e1f58){freeIsNotKey(_0x3e1f58,_0x2170c6['freshsalesAccounts'],'id');for(var _0x58e05b=0x0,_0x30f031={},_0x39b915={};_0x58e05b<_0x3e1f58[_0xc7de('0x43')];_0x58e05b+=0x1){_0x30f031=_0x3e1f58[_0x58e05b];if(_['isUndefined'](_0x2170c6[_0xc7de('0x28')][_0x30f031['id']])){_0x2170c6['freshsalesAccounts'][_0x30f031['id']]=new FreshsalesAccount(_0x30f031);}else{_0x2170c6[_0xc7de('0x4a')](_0x2170c6[_0xc7de('0x28')][_0x30f031['id']],_0x30f031);}}}return _0x2170c6[_0xc7de('0x28')];};};Realtime['prototype'][_0xc7de('0x56')]=function(){var _0x2f503b=this;return function(_0x31ab6a){for(var _0x249e06=0x0;_0x249e06<_0x31ab6a[_0xc7de('0x43')];_0x249e06+=0x1){_[_0xc7de('0x57')](_0x2f503b[_0xc7de('0x4d')][_0x31ab6a[_0x249e06][_0xc7de('0x46')]],_0x31ab6a[_0x249e06]);}return _0x2f503b[_0xc7de('0x4d')];};};Realtime[_0xc7de('0x41')]['initVoiceQueueReports']=function(){var _0xe6bc54=this;return function(_0x222cf9){clearVoiceQueues(_0xe6bc54[_0xc7de('0x4d')]);if(_0x222cf9){_0x222cf9=_['groupBy'](_0x222cf9,'uniqueid');for(var _0x56bee6 in _0x222cf9){if(_0x222cf9[_0xc7de('0x2a')](_0x56bee6)){var _0x9c60af={};for(var _0x13700b=0x0;_0x13700b<_0x222cf9[_0x56bee6]['length'];_0x13700b+=0x1){var _0x7478a8=_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x58')];if(_0xe6bc54['voiceQueues'][_0x7478a8]){if(_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x59')]){_0xe6bc54[_0xc7de('0x4d')][_0x7478a8][_0xc7de('0x34')]+=0x1;}if(_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x5a')]){_0xe6bc54['voiceQueues'][_0x7478a8][_0xc7de('0x5b')]+=0x1;}_0xe6bc54[_0xc7de('0x4d')][_0x7478a8][_0xc7de('0x35')]+=moment(_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x5c')])[_0xc7de('0x5d')](moment(_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x5e')]),_0xc7de('0x5f'))||0x0;if(_0x13700b===_0x222cf9[_0x56bee6][_0xc7de('0x43')]-0x1){_0xe6bc54['voiceQueues'][_0x7478a8][_0xc7de('0x2f')]+=moment(_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x60')]||_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x61')]||_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x62')])['diff'](moment(_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x5e')]),_0xc7de('0x5f'))||0x0;_0xe6bc54[_0xc7de('0x4d')][_0x7478a8][_0xc7de('0x2d')]+=0x1;if(_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x63')]){_0xe6bc54[_0xc7de('0x4d')][_0x7478a8]['answered']+=0x1;_0xe6bc54[_0xc7de('0x4d')][_0x7478a8][_0xc7de('0x30')]+=moment(_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x60')])[_0xc7de('0x5d')](moment(_0x222cf9[_0x56bee6][_0x13700b][_0xc7de('0x5c')]),'seconds')||0x0;}}else{_0xe6bc54[_0xc7de('0x4d')][_0x7478a8][_0xc7de('0x2f')]+=_0xe6bc54['voiceQueues'][_0x7478a8]['sumHoldTime']||0x0;}}}}}}return _0xe6bc54[_0xc7de('0x4d')];};};Realtime[_0xc7de('0x41')][_0xc7de('0x64')]=function(){var _0x61c042=this;return function(_0x12a9a8){clearVoiceCallReports(_0x61c042[_0xc7de('0x18')]);if(_0x12a9a8){for(var _0x5c9edc=0x0;_0x5c9edc<_0x12a9a8[_0xc7de('0x43')];_0x5c9edc+=0x1){_0x61c042[_0xc7de('0x18')][_0xc7de('0x2d')]+=0x1;_0x61c042[_0xc7de('0x18')][_0xc7de('0x2f')]+=_0x12a9a8[_0x5c9edc][_0xc7de('0x65')];if(_0x12a9a8[_0x5c9edc]['disposition']===_0xc7de('0x66')){_0x61c042[_0xc7de('0x18')]['answered']+=0x1;_0x61c042[_0xc7de('0x18')]['sumHoldTime']+=_0x12a9a8[_0x5c9edc][_0xc7de('0x65')]-_0x12a9a8[_0x5c9edc]['billableseconds']||0x0;_0x61c042[_0xc7de('0x18')][_0xc7de('0x30')]+=_0x12a9a8[_0x5c9edc][_0xc7de('0x67')];}}}return _0x61c042[_0xc7de('0x18')];};};Realtime['prototype']['initCampaigns']=function(){var _0xa1459f=this;return function(_0x406c3a){if(_0x406c3a){freeIsNotKey(_0x406c3a,_0xa1459f[_0xc7de('0x16')],'name');for(var _0x2f1dc8=0x0,_0x8b9b48={};_0x2f1dc8<_0x406c3a[_0xc7de('0x43')];_0x2f1dc8+=0x1){_0x8b9b48=_0x406c3a[_0x2f1dc8];if(_[_0xc7de('0x47')](_0xa1459f[_0xc7de('0x16')][_0x8b9b48['name']])){_0xa1459f[_0xc7de('0x16')][_0x8b9b48[_0xc7de('0x46')]]=new Campaign(_0x8b9b48);}else{_0xa1459f[_0xc7de('0x4a')](_0xa1459f[_0xc7de('0x16')][_0x8b9b48[_0xc7de('0x46')]],_0x8b9b48);_0xa1459f['campaigns'][_0x8b9b48['name']]['dialQueueProject']=_0x8b9b48[_0xc7de('0x68')]?_0x8b9b48[_0xc7de('0x68')][_0xc7de('0x46')]:undefined;}}}return _0xa1459f[_0xc7de('0x16')];};};Realtime['prototype'][_0xc7de('0x69')]=function(){var _0x3bb049=this;return function(_0x5a2838){if(_0x5a2838){freeIsNotKey(_0x5a2838,_0x3bb049['voiceExtensions'],'id');for(var _0x3704f2=0x0,_0x168162={};_0x3704f2<_0x5a2838[_0xc7de('0x43')];_0x3704f2+=0x1){_0x168162=_0x5a2838[_0x3704f2];if(_[_0xc7de('0x47')](_0x3bb049[_0xc7de('0x19')][_0x168162['id']])){_0x3bb049['voiceExtensions'][_0x168162['id']]=new VoiceExtension(_0x168162);}else{_0x3bb049[_0xc7de('0x4a')](_0x3bb049[_0xc7de('0x19')][_0x168162['id']],_0x168162);}}}return _0x3bb049[_0xc7de('0x19')];};};Realtime[_0xc7de('0x41')][_0xc7de('0x6a')]=function(){var _0x5c7fd1=this;return function(_0x2ccbfa){clearCampaigns(_0x5c7fd1[_0xc7de('0x16')]);for(var _0x1c7f57=0x0;_0x1c7f57<_0x2ccbfa[_0xc7de('0x43')];_0x1c7f57+=0x1){_[_0xc7de('0x57')](_0x5c7fd1[_0xc7de('0x16')][_0x2ccbfa[_0x1c7f57][_0xc7de('0x46')]],_0x2ccbfa[_0x1c7f57]);}return _0x5c7fd1[_0xc7de('0x16')];};};Realtime[_0xc7de('0x41')][_0xc7de('0x6b')]=function(){var _0x2aa71d=this;return function(_0x2916ad){if(_0x2916ad){freeIsNotKey(_0x2916ad,_0x2aa71d['faxAccounts'],'id');for(var _0x1b5fc2=0x0,_0x9a0a49={},_0x25f417={};_0x1b5fc2<_0x2916ad['length'];_0x1b5fc2+=0x1){_0x9a0a49=_0x2916ad[_0x1b5fc2];if(_[_0xc7de('0x47')](_0x2aa71d['faxAccounts'][_0x9a0a49['id']])){_0x2aa71d[_0xc7de('0x29')][_0x9a0a49['id']]=new FaxAccount(_0x9a0a49);}else{_0x2aa71d[_0xc7de('0x4a')](_0x2aa71d['faxAccounts'][_0x9a0a49['id']],_0x9a0a49);}}}return _0x2aa71d[_0xc7de('0x29')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f459cc9..57b05a0 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 _0xee06=['destinationchannel','channel','callerid','disposition','ANSWERED','connectedlinenum','calleridname','transfers','transfereelinkedid','linkedid','monitor','monitors','length','monitorFilename','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','isNil','SIP/%s','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','agents','accountcode','name','interface','format','findAgent','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum'];(function(_0x478829,_0x4ef2bb){var _0x59a14a=function(_0x11e88c){while(--_0x11e88c){_0x478829['push'](_0x478829['shift']());}};_0x59a14a(++_0x4ef2bb);}(_0xee06,0x76));var _0x6ee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee06[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6ee0('0x0'));var moment=require(_0x6ee0('0x1'));var util=require(_0x6ee0('0x2'));var config=require(_0x6ee0('0x3'));var ami=require(_0x6ee0('0x4'));var RpcVoiceAgentReport=require(_0x6ee0('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x6ee0('0x6'));var RpcMemberReport=require(_0x6ee0('0x7'));var RpcVoiceQueueReport=require(_0x6ee0('0x8'));var RpcVoiceRecording=require(_0x6ee0('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x6ee0('0xa'));var VoiceCallReport=require(_0x6ee0('0xb'));var VoiceAgentReport=require(_0x6ee0('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x6ee0('0xd'));function Report(_0x485f2f){this[_0x6ee0('0xe')]=_0x485f2f;this['agents']=_0x485f2f['agents'];this[_0x6ee0('0xf')]=_0x485f2f['telephones'];}Report[_0x6ee0('0x10')][_0x6ee0('0x11')]=function(_0x5c6ca3){var _0x2905b2=new VoiceQueueReport(this[_0x6ee0('0xe')]);var _0x2762cf=new VoiceAgentReport(this[_0x6ee0('0xe')]);var _0x18292f=new VoiceDialReport(this['realtime']);var _0x3fc502=new VoiceCallReport(this[_0x6ee0('0xe')]);var _0x5b2e24=new UserReport(this[_0x6ee0('0xe')]);if(config[_0x6ee0('0x12')]&&config[_0x6ee0('0x12')][_0x6ee0('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x6ee0('0x14')]['bind'](this));ami['on'](_0x6ee0('0x15'),this[_0x6ee0('0x16')][_0x6ee0('0x17')](this));ami['on'](_0x6ee0('0x18'),this[_0x6ee0('0x19')][_0x6ee0('0x17')](this));ami['on'](_0x6ee0('0x1a'),this[_0x6ee0('0x1b')][_0x6ee0('0x17')](this));ami['on'](_0x6ee0('0x1c'),this[_0x6ee0('0x1d')][_0x6ee0('0x17')](this));ami['on'](_0x6ee0('0x1e'),this[_0x6ee0('0x1f')][_0x6ee0('0x17')](this));}};Report['prototype']['findAgent']=function(_0x2b9e4c){var _0x370f79;_0x370f79=_[_0x6ee0('0x20')](this[_0x6ee0('0x21')],function(_0xeec80c){return _0xeec80c[_0x6ee0('0x22')]==_0x2b9e4c||_0xeec80c[_0x6ee0('0x23')]==_0x2b9e4c;});if(_['isNil'](_0x370f79)){var _0x315713=_['find'](this[_0x6ee0('0xf')],function(_0x696e23){return _0x696e23[_0x6ee0('0x22')]==_0x2b9e4c||_0x696e23[_0x6ee0('0x23')]==_0x2b9e4c;});if(_0x315713){_0x370f79=_[_0x6ee0('0x20')](this[_0x6ee0('0x21')],function(_0x14f670){return _0x14f670[_0x6ee0('0x24')]==util[_0x6ee0('0x25')]('SIP/%s',_0x315713['name']);});}}return _0x370f79;};Report[_0x6ee0('0x10')][_0x6ee0('0x14')]=function(_0x37acfd){for(var _0x29c480=0x0;_0x29c480<_0x37acfd['length'];_0x29c480+=0x1){var _0x28d607=this[_0x6ee0('0x26')](_0x37acfd[_0x29c480]['connectedlinenum']);if(_0x28d607){_0x37acfd[_0x29c480][_0x6ee0('0x22')]=_0x28d607[_0x6ee0('0x22')];_0x37acfd[_0x29c480][_0x6ee0('0x27')]=!![];_0x37acfd[_0x29c480][_0x6ee0('0x28')]=_0x28d607['name'];_0x37acfd[_0x29c480]['interface']=_['isNil'](_0x28d607[_0x6ee0('0x24')])?util[_0x6ee0('0x25')]('SIP/%s',_0x28d607['name']):_0x28d607[_0x6ee0('0x24')];if(_0x37acfd[_0x29c480][_0x6ee0('0x29')]){_0x37acfd[_0x29c480][_0x6ee0('0x2a')]=moment()['format'](_0x6ee0('0x2b'));}if(_0x37acfd[_0x29c480][_0x6ee0('0x2c')]){_0x37acfd[_0x29c480][_0x6ee0('0x2d')]=moment()[_0x6ee0('0x25')](_0x6ee0('0x2b'));}RpcMemberReport[_0x6ee0('0x14')](_0x37acfd[_0x29c480]);}RpcVoiceQueueReport[_0x6ee0('0x2e')](_0x37acfd[_0x29c480]);}};function extractCalleridNumber(_0x31e61c){var _0x4f7673=_0x31e61c[_0x6ee0('0x2f')](/<(.*?)>/);return _0x4f7673?_0x4f7673[0x1]:_0x31e61c;}Report[_0x6ee0('0x10')]['voiceCallReport']=function(_0x1c4742){_0x1c4742[_0x6ee0('0x30')]=_0x1c4742[_0x6ee0('0x30')]||_0x1c4742[_0x6ee0('0x31')];if(_0x1c4742[_0x6ee0('0x32')]==_0x6ee0('0x33')){_0x1c4742[_0x6ee0('0x34')]=_0x6ee0('0x35');_0x1c4742[_0x6ee0('0x36')]=_0x1c4742['queue'];if(_0x1c4742[_0x6ee0('0x37')]=='from-voip-provider'){_0x1c4742[_0x6ee0('0x22')]='';_0x1c4742[_0x6ee0('0x30')]=extractCalleridNumber(_0x1c4742['callerid']);}else if(_0x1c4742[_0x6ee0('0x37')]=='from-sip'){if(_0x1c4742[_0x6ee0('0x30')]==_0x6ee0('0x38')){_0x1c4742['destination']=extractCalleridNumber(_0x1c4742[_0x6ee0('0x39')]);_0x1c4742[_0x6ee0('0x3a')]=_0x1c4742[_0x6ee0('0x3b')];_0x1c4742[_0x6ee0('0x3c')]=[_0x1c4742[_0x6ee0('0x3d')],_0x1c4742[_0x6ee0('0x3d')]=_0x1c4742[_0x6ee0('0x3c')]][0x0];_0x1c4742[_0x6ee0('0x3e')]=_0x1c4742[_0x6ee0('0x39')];}else{_0x1c4742[_0x6ee0('0x30')]=_0x1c4742[_0x6ee0('0x3a')];_0x1c4742[_0x6ee0('0x3a')]=_0x1c4742[_0x6ee0('0x3b')];if(_0x1c4742[_0x6ee0('0x3f')]==_0x6ee0('0x40')){_0x1c4742[_0x6ee0('0x22')]=_0x1c4742[_0x6ee0('0x41')];}else{_0x1c4742[_0x6ee0('0x22')]='';}}}}else{_0x1c4742[_0x6ee0('0x3e')]=util[_0x6ee0('0x25')]('\x22%s\x22\x20<%s>',_0x1c4742[_0x6ee0('0x42')],_0x1c4742[_0x6ee0('0x3a')]);}if(RpcVoiceTransferReport[_0x6ee0('0x43')][_0x1c4742['linkedid']]){var _0x36d4b9=RpcVoiceTransferReport[_0x6ee0('0x43')][_0x1c4742['linkedid']];_0x36d4b9[_0x6ee0('0x44')]=_0x1c4742['uniqueid'];RpcVoiceTransferReport[_0x6ee0('0x1d')](_0x36d4b9);delete RpcVoiceTransferReport[_0x6ee0('0x43')][_0x1c4742[_0x6ee0('0x45')]];}RpcVoiceCallReport[_0x6ee0('0x2e')](_0x1c4742);if(_0x1c4742[_0x6ee0('0x46')]){for(var _0x288568=0x0;_0x288568<_0x1c4742[_0x6ee0('0x47')][_0x6ee0('0x48')];_0x288568+=0x1){_0x1c4742[_0x6ee0('0x49')]=_0x1c4742['monitors'][_0x288568]['filename'];_0x1c4742['createdAt']=_0x1c4742['monitors'][_0x288568]['createdAt'];if(_0x1c4742[_0x6ee0('0x31')]==_0x6ee0('0x38')){_0x1c4742[_0x6ee0('0x3a')]=_0x1c4742[_0x6ee0('0x41')];_0x1c4742[_0x6ee0('0x42')]=_0x1c4742[_0x6ee0('0x4a')];_0x1c4742['connectedlinenum']=_0x1c4742[_0x6ee0('0x22')];_0x1c4742[_0x6ee0('0x4a')]=_0x1c4742[_0x6ee0('0x4b')];_0x1c4742[_0x6ee0('0x31')]=_0x1c4742['originatecalleridnum'];}else if(_0x1c4742['exten']==_0x6ee0('0x4c')){_0x1c4742[_0x6ee0('0x3a')]=_0x1c4742[_0x6ee0('0x30')];_0x1c4742[_0x6ee0('0x31')]=_0x1c4742[_0x6ee0('0x3b')];}RpcVoiceRecording['create'](_0x1c4742);}}};Report[_0x6ee0('0x10')][_0x6ee0('0x19')]=function(_0x1ff970){if(_[_0x6ee0('0x4d')](_0x1ff970)){_0x1ff970[_0x6ee0('0x4e')](function(_0x2e5571){RpcVoiceAgentReport[_0x6ee0('0x2e')](_0x2e5571);});}else{RpcVoiceAgentReport[_0x6ee0('0x2e')](_0x1ff970);}};Report[_0x6ee0('0x10')][_0x6ee0('0x1b')]=function(_0x2e263c){RpcVoiceDialReport[_0x6ee0('0x2e')](_0x2e263c);var _0x50a4a1;var _0x395cca;var _0x119bff=_0x2e263c[_0x6ee0('0x3d')];if(_[_0x6ee0('0x4f')](_0x119bff,_0x6ee0('0x50'))){_0x395cca=_0x119bff['substring'](_0x119bff[_0x6ee0('0x51')]('/')+0x1,_0x119bff[_0x6ee0('0x51')]('@'));_0x50a4a1=_[_0x6ee0('0x20')](this[_0x6ee0('0x21')],function(_0x20221b){return _0x20221b[_0x6ee0('0x52')]==_0x395cca||_0x20221b[_0x6ee0('0x53')]==_0x395cca||_0x20221b[_0x6ee0('0x22')]==_0x395cca;});}else{_0x395cca=_0x119bff[_0x6ee0('0x54')](_0x119bff['indexOf']('/')+0x1,_0x119bff[_0x6ee0('0x55')]('-'));_0x50a4a1=this[_0x6ee0('0x26')](_0x395cca);}if(_0x50a4a1){_0x2e263c[_0x6ee0('0x24')]=_[_0x6ee0('0x56')](_0x50a4a1[_0x6ee0('0x24')])?util[_0x6ee0('0x25')](_0x6ee0('0x57'),_0x50a4a1['name']):_0x50a4a1[_0x6ee0('0x24')];_0x2e263c[_0x6ee0('0x4b')]=_0x50a4a1[_0x6ee0('0x23')];_0x2e263c[_0x6ee0('0x22')]=_0x50a4a1[_0x6ee0('0x22')];RpcMemberReport[_0x6ee0('0x1b')](_0x2e263c);}};Report[_0x6ee0('0x10')]['blindTransfer']=function(_0x303c3b){RpcVoiceTransferReport['transfers'][_0x303c3b['transfererlinkedid']]=_0x303c3b;};Report[_0x6ee0('0x10')][_0x6ee0('0x1f')]=function(_0x34b361){RpcVoiceTransferReport[_0x6ee0('0x1f')](_0x34b361);};module[_0x6ee0('0x58')]=Report; \ No newline at end of file +var _0xccc6=['dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','calleridnum','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','monitors','monitorFilename','filename','createdAt','membername','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','length','assigned','lastAssignedTo','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','destination','exten','type'];(function(_0x1f01e9,_0x47e086){var _0x265f36=function(_0x2f7910){while(--_0x2f7910){_0x1f01e9['push'](_0x1f01e9['shift']());}};_0x265f36(++_0x47e086);}(_0xccc6,0x17f));var _0x6ccc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccc6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6ccc('0x0'));var moment=require(_0x6ccc('0x1'));var util=require('util');var config=require(_0x6ccc('0x2'));var ami=require(_0x6ccc('0x3'));var RpcVoiceAgentReport=require(_0x6ccc('0x4'));var RpcVoiceCallReport=require(_0x6ccc('0x5'));var RpcVoiceDialReport=require(_0x6ccc('0x6'));var RpcMemberReport=require(_0x6ccc('0x7'));var RpcVoiceQueueReport=require(_0x6ccc('0x8'));var RpcVoiceRecording=require(_0x6ccc('0x9'));var RpcVoiceTransferReport=require(_0x6ccc('0xa'));var VoiceQueueReport=require(_0x6ccc('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x6ccc('0xc'));var VoiceDialReport=require(_0x6ccc('0xd'));var UserReport=require(_0x6ccc('0xe'));function Report(_0x48f5be){this['realtime']=_0x48f5be;this['agents']=_0x48f5be[_0x6ccc('0xf')];this[_0x6ccc('0x10')]=_0x48f5be[_0x6ccc('0x10')];}Report[_0x6ccc('0x11')]['sync']=function(_0xb03e4c){var _0x23b0d4=new VoiceQueueReport(this[_0x6ccc('0x12')]);var _0x54c657=new VoiceAgentReport(this[_0x6ccc('0x12')]);var _0x172ce7=new VoiceDialReport(this[_0x6ccc('0x12')]);var _0x4af370=new VoiceCallReport(this[_0x6ccc('0x12')]);var _0x3c159b=new UserReport(this[_0x6ccc('0x12')]);if(config[_0x6ccc('0x13')]&&config[_0x6ccc('0x13')]['disabled']){ami['on'](_0x6ccc('0x14'),this[_0x6ccc('0x15')][_0x6ccc('0x16')](this));ami['on'](_0x6ccc('0x17'),this[_0x6ccc('0x18')][_0x6ccc('0x16')](this));ami['on'](_0x6ccc('0x19'),this[_0x6ccc('0x1a')][_0x6ccc('0x16')](this));ami['on'](_0x6ccc('0x1b'),this[_0x6ccc('0x1c')][_0x6ccc('0x16')](this));ami['on'](_0x6ccc('0x1d'),this[_0x6ccc('0x1e')][_0x6ccc('0x16')](this));ami['on'](_0x6ccc('0x1f'),this[_0x6ccc('0x20')][_0x6ccc('0x16')](this));}};Report[_0x6ccc('0x11')][_0x6ccc('0x21')]=function(_0x3323bd){var _0x3de2dd;_0x3de2dd=_[_0x6ccc('0x22')](this['agents'],function(_0x3e2c1c){return _0x3e2c1c[_0x6ccc('0x23')]==_0x3323bd||_0x3e2c1c['name']==_0x3323bd;});if(_['isNil'](_0x3de2dd)){var _0x1c8262=_[_0x6ccc('0x22')](this[_0x6ccc('0x10')],function(_0x84a211){return _0x84a211['accountcode']==_0x3323bd||_0x84a211[_0x6ccc('0x24')]==_0x3323bd;});if(_0x1c8262){_0x3de2dd=_['find'](this[_0x6ccc('0xf')],function(_0x55875e){return _0x55875e[_0x6ccc('0x25')]==util['format']('SIP/%s',_0x1c8262[_0x6ccc('0x24')]);});}}return _0x3de2dd;};Report[_0x6ccc('0x11')]['voiceQueueReport']=function(_0x421e44){for(var _0xdf78f6=0x0;_0xdf78f6<_0x421e44[_0x6ccc('0x26')];_0xdf78f6+=0x1){var _0x29218a=this[_0x6ccc('0x21')](_0x421e44[_0xdf78f6]['connectedlinenum']);if(_0x29218a){_0x421e44[_0xdf78f6][_0x6ccc('0x23')]=_0x29218a[_0x6ccc('0x23')];_0x421e44[_0xdf78f6][_0x6ccc('0x27')]=!![];_0x421e44[_0xdf78f6][_0x6ccc('0x28')]=_0x29218a[_0x6ccc('0x24')];_0x421e44[_0xdf78f6]['interface']=_['isNil'](_0x29218a[_0x6ccc('0x25')])?util[_0x6ccc('0x29')](_0x6ccc('0x2a'),_0x29218a['name']):_0x29218a[_0x6ccc('0x25')];if(_0x421e44[_0xdf78f6][_0x6ccc('0x2b')]){_0x421e44[_0xdf78f6][_0x6ccc('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x421e44[_0xdf78f6][_0x6ccc('0x2d')]){_0x421e44[_0xdf78f6][_0x6ccc('0x2e')]=moment()[_0x6ccc('0x29')](_0x6ccc('0x2f'));}RpcMemberReport['voiceQueueReport'](_0x421e44[_0xdf78f6]);}RpcVoiceQueueReport[_0x6ccc('0x30')](_0x421e44[_0xdf78f6]);}};function extractCalleridNumber(_0x25c236){var _0x2303fd=_0x25c236['match'](/<(.*?)>/);return _0x2303fd?_0x2303fd[0x1]:_0x25c236;}Report['prototype'][_0x6ccc('0x18')]=function(_0x21d505){_0x21d505['destination']=_0x21d505[_0x6ccc('0x31')]||_0x21d505[_0x6ccc('0x32')];if(_0x21d505[_0x6ccc('0x33')]==_0x6ccc('0x34')){_0x21d505[_0x6ccc('0x35')]=_0x6ccc('0x36');_0x21d505[_0x6ccc('0x37')]=_0x21d505[_0x6ccc('0x36')];if(_0x21d505[_0x6ccc('0x38')]==_0x6ccc('0x39')){_0x21d505[_0x6ccc('0x23')]='';_0x21d505[_0x6ccc('0x31')]=extractCalleridNumber(_0x21d505[_0x6ccc('0x3a')]);}else if(_0x21d505[_0x6ccc('0x38')]==_0x6ccc('0x3b')){if(_0x21d505[_0x6ccc('0x31')]==_0x6ccc('0x3c')){_0x21d505[_0x6ccc('0x31')]=extractCalleridNumber(_0x21d505['calleridpreview']);_0x21d505['calleridnum']=_0x21d505[_0x6ccc('0x3d')];_0x21d505[_0x6ccc('0x3e')]=[_0x21d505[_0x6ccc('0x3f')],_0x21d505['channel']=_0x21d505['destinationchannel']][0x0];_0x21d505[_0x6ccc('0x3a')]=_0x21d505[_0x6ccc('0x40')];}else{_0x21d505['destination']=_0x21d505[_0x6ccc('0x41')];_0x21d505[_0x6ccc('0x41')]=_0x21d505[_0x6ccc('0x3d')];if(_0x21d505[_0x6ccc('0x42')]==_0x6ccc('0x43')){_0x21d505[_0x6ccc('0x23')]=_0x21d505[_0x6ccc('0x44')];}else{_0x21d505[_0x6ccc('0x23')]='';}}}}else{_0x21d505[_0x6ccc('0x3a')]=util['format'](_0x6ccc('0x45'),_0x21d505[_0x6ccc('0x46')],_0x21d505[_0x6ccc('0x41')]);}if(RpcVoiceTransferReport[_0x6ccc('0x47')][_0x21d505[_0x6ccc('0x48')]]){var _0x50d8c1=RpcVoiceTransferReport[_0x6ccc('0x47')][_0x21d505[_0x6ccc('0x48')]];_0x50d8c1['transfereelinkedid']=_0x21d505['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x50d8c1);delete RpcVoiceTransferReport['transfers'][_0x21d505['linkedid']];}RpcVoiceCallReport[_0x6ccc('0x30')](_0x21d505);if(_0x21d505['monitor']){for(var _0x13ce6a=0x0;_0x13ce6a<_0x21d505[_0x6ccc('0x49')][_0x6ccc('0x26')];_0x13ce6a+=0x1){_0x21d505[_0x6ccc('0x4a')]=_0x21d505[_0x6ccc('0x49')][_0x13ce6a][_0x6ccc('0x4b')];_0x21d505[_0x6ccc('0x4c')]=_0x21d505['monitors'][_0x13ce6a][_0x6ccc('0x4c')];if(_0x21d505[_0x6ccc('0x32')]=='xcally-motion-preview'){_0x21d505['calleridnum']=_0x21d505['connectedlinenum'];_0x21d505[_0x6ccc('0x46')]=_0x21d505['connectedlinename'];_0x21d505['connectedlinenum']=_0x21d505['accountcode'];_0x21d505['connectedlinename']=_0x21d505[_0x6ccc('0x4d')];_0x21d505['exten']=_0x21d505[_0x6ccc('0x3d')];}else if(_0x21d505[_0x6ccc('0x32')]==_0x6ccc('0x4e')){_0x21d505[_0x6ccc('0x41')]=_0x21d505[_0x6ccc('0x31')];_0x21d505[_0x6ccc('0x32')]=_0x21d505[_0x6ccc('0x3d')];}RpcVoiceRecording['create'](_0x21d505);}}};Report[_0x6ccc('0x11')]['voiceAgentReport']=function(_0x3dd010){if(_['isArray'](_0x3dd010)){_0x3dd010[_0x6ccc('0x4f')](function(_0x37aee6){RpcVoiceAgentReport['create'](_0x37aee6);});}else{RpcVoiceAgentReport[_0x6ccc('0x30')](_0x3dd010);}};Report[_0x6ccc('0x11')][_0x6ccc('0x1c')]=function(_0x7f0648){RpcVoiceDialReport[_0x6ccc('0x30')](_0x7f0648);var _0x4d96a9;var _0x512991;var _0x281124=_0x7f0648[_0x6ccc('0x3f')];if(_[_0x6ccc('0x50')](_0x281124,'Local')){_0x512991=_0x281124[_0x6ccc('0x51')](_0x281124[_0x6ccc('0x52')]('/')+0x1,_0x281124[_0x6ccc('0x52')]('@'));_0x4d96a9=_[_0x6ccc('0x22')](this[_0x6ccc('0xf')],function(_0x3fb5f3){return _0x3fb5f3[_0x6ccc('0x53')]==_0x512991||_0x3fb5f3[_0x6ccc('0x54')]==_0x512991||_0x3fb5f3[_0x6ccc('0x23')]==_0x512991;});}else{_0x512991=_0x281124[_0x6ccc('0x51')](_0x281124[_0x6ccc('0x52')]('/')+0x1,_0x281124[_0x6ccc('0x55')]('-'));_0x4d96a9=this[_0x6ccc('0x21')](_0x512991);}if(_0x4d96a9){_0x7f0648[_0x6ccc('0x25')]=_['isNil'](_0x4d96a9[_0x6ccc('0x25')])?util['format'](_0x6ccc('0x2a'),_0x4d96a9[_0x6ccc('0x24')]):_0x4d96a9[_0x6ccc('0x25')];_0x7f0648[_0x6ccc('0x4d')]=_0x4d96a9[_0x6ccc('0x24')];_0x7f0648[_0x6ccc('0x23')]=_0x4d96a9[_0x6ccc('0x23')];RpcMemberReport['voiceDialReport'](_0x7f0648);}};Report[_0x6ccc('0x11')][_0x6ccc('0x1e')]=function(_0x22b21d){RpcVoiceTransferReport['transfers'][_0x22b21d['transfererlinkedid']]=_0x22b21d;};Report[_0x6ccc('0x11')][_0x6ccc('0x20')]=function(_0x5d89cb){RpcVoiceTransferReport[_0x6ccc('0x20')](_0x5d89cb);};module[_0x6ccc('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 4fe4676..27c6b46 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d94=['info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','trunk:%s','trunk:save','device','[userReport][devicestatechange]','toLowerCase','local','stateTime','updateStatusRealtime','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','name','toNumber','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','accountcode','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','[userReport][sipshowregistry]','inspect','catch','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','syncRegistry'];(function(_0x508c0a,_0x1bcd5e){var _0x1c19b7=function(_0x21300d){while(--_0x21300d){_0x508c0a['push'](_0x508c0a['shift']());}};_0x1c19b7(++_0x1bcd5e);}(_0x8d94,0x1e5));var _0x48d9=function(_0x4e0a19,_0x597a36){_0x4e0a19=_0x4e0a19-0x0;var _0x1af934=_0x8d94[_0x4e0a19];return _0x1af934;};'use strict';var _=require('lodash');var moment=require(_0x48d9('0x0'));var util=require(_0x48d9('0x1'));var Redis=require(_0x48d9('0x2'));var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x48d9('0x3'));var ami=require(_0x48d9('0x4'));config[_0x48d9('0x5')]=_[_0x48d9('0x6')](config['redis'],{'host':_0x48d9('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x48d9('0x5')]));function UserReport(_0x378976){this[_0x48d9('0x8')]=_0x378976[_0x48d9('0x8')];this[_0x48d9('0x9')]=_0x378976['agents'];this[_0x48d9('0xa')]=_0x378976[_0x48d9('0xa')];ami['on'](_0x48d9('0xb'),this['syncRegistry'][_0x48d9('0xc')](this));ami['on'](_0x48d9('0xd'),this['syncRegistry'][_0x48d9('0xc')](this));ami['on'](_0x48d9('0xe'),this[_0x48d9('0xf')][_0x48d9('0xc')](this));ami['on']('peerstatus',this[_0x48d9('0x10')][_0x48d9('0xc')](this));return this[_0x48d9('0x11')]();}function showSipRegistrations(){Promise[_0x48d9('0x12')]()[_0x48d9('0x13')](ami[_0x48d9('0x14')]())['catch'](function(_0x5c8073){logger['error'](_0x48d9('0x15'),util[_0x48d9('0x16')](_0x5c8073,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x48d9('0x12')]()[_0x48d9('0x13')](ami['actionDeviceStateList']())[_0x48d9('0x17')](function(_0x20a54f){logger[_0x48d9('0x18')](_0x48d9('0x19'),util[_0x48d9('0x16')](_0x20a54f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x48d9('0x12')]()[_0x48d9('0x13')](ami[_0x48d9('0x1a')]())[_0x48d9('0x17')](function(_0x2fb4ca){logger[_0x48d9('0x18')](_0x48d9('0x1b'),util[_0x48d9('0x16')](_0x2fb4ca,{'showHidden':![],'depth':null}));});}UserReport[_0x48d9('0x1c')][_0x48d9('0x11')]=function(){setInterval(function(){BPromise['resolve']()[_0x48d9('0x13')](showSipRegistrations())[_0x48d9('0x13')](listDeviceStates())[_0x48d9('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x48d9('0x1c')][_0x48d9('0x1d')]=function(_0x5e46ff){return _0x5e46ff!==null&&!_[_0x48d9('0x1e')](_0x5e46ff);};UserReport[_0x48d9('0x1c')][_0x48d9('0x1f')]=function(_0x6bc5de,_0x25c91e,_0x509f02){io['to'](_0x6bc5de)['emit'](_0x25c91e,_0x509f02);};UserReport[_0x48d9('0x1c')][_0x48d9('0x20')]=function(_0x145fb3){try{if(this[_0x48d9('0x1d')](_0x145fb3)){logger[_0x48d9('0x21')](_0x48d9('0x22'),_0x145fb3[_0x48d9('0x23')],_0x145fb3[_0x48d9('0x24')]);logger[_0x48d9('0x25')](_0x48d9('0x26'),util[_0x48d9('0x16')](_0x145fb3,{'showHidden':![],'depth':null}));var _0x461c5b=_[_0x48d9('0x27')](this[_0x48d9('0x8')],{'defaultuser':_0x145fb3[_0x48d9('0x23')]});if(_0x461c5b){_0x145fb3[_0x48d9('0x28')]=_0x145fb3[_0x48d9('0x24')];_[_0x48d9('0x29')](_0x461c5b,_[_0x48d9('0x2a')](_0x145fb3,[_0x48d9('0x2b'),_0x48d9('0x2c'),_0x48d9('0x23'),'state']));logger[_0x48d9('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x48d9('0x16')](_0x461c5b,{'showHidden':![],'depth':null}));this[_0x48d9('0x1f')](util['format'](_0x48d9('0x2d'),_0x461c5b['name']),_0x48d9('0x2e'),_0x461c5b);}}}catch(_0x59b5a5){logger[_0x48d9('0x18')](_0x48d9('0x26'),util[_0x48d9('0x16')](_0x59b5a5,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x4cebdd){try{if(this[_0x48d9('0x1d')](_0x4cebdd)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x4cebdd[_0x48d9('0x2f')],_0x4cebdd[_0x48d9('0x24')]);logger['debug'](_0x48d9('0x30'),util[_0x48d9('0x16')](_0x4cebdd,{'showHidden':![],'depth':null}));if(this[_0x48d9('0x9')][_0x4cebdd[_0x48d9('0x2f')]]){if(!this['agents'][_0x4cebdd[_0x48d9('0x2f')]]['local']||_0x4cebdd['state'][_0x48d9('0x31')]()=='inuse'){this[_0x48d9('0x9')][_0x4cebdd[_0x48d9('0x2f')]][_0x48d9('0x32')]=![];if(this['agents'][_0x4cebdd[_0x48d9('0x2f')]]['state']!==_0x4cebdd['state'][_0x48d9('0x31')]()){this['agents'][_0x4cebdd[_0x48d9('0x2f')]][_0x48d9('0x33')]=_['toNumber'](moment()['format']('x'));}this[_0x48d9('0x9')][_0x4cebdd[_0x48d9('0x2f')]]['state']=_0x4cebdd[_0x48d9('0x24')][_0x48d9('0x31')]();this[_0x48d9('0x9')][_0x4cebdd[_0x48d9('0x2f')]][_0x48d9('0x34')](_0x4cebdd);}}else if(this[_0x48d9('0xa')][_0x4cebdd[_0x48d9('0x2f')]]){if(this[_0x48d9('0xa')][_0x4cebdd[_0x48d9('0x2f')]]['state']!==_0x4cebdd[_0x48d9('0x24')][_0x48d9('0x31')]()){this[_0x48d9('0xa')][_0x4cebdd[_0x48d9('0x2f')]][_0x48d9('0x33')]=_['toNumber'](moment()[_0x48d9('0x35')]('x'));}this[_0x48d9('0xa')][_0x4cebdd['device']][_0x48d9('0x24')]=_0x4cebdd['state']['toLowerCase']();logger['debug'](_0x48d9('0x36'),util['inspect'](this[_0x48d9('0xa')][_0x4cebdd['device']],{'showHidden':![],'depth':null}));this[_0x48d9('0x1f')](util[_0x48d9('0x35')](_0x48d9('0x37'),this[_0x48d9('0xa')][_0x4cebdd[_0x48d9('0x2f')]][_0x48d9('0x38')]),'telephone:save',this['telephones'][_0x4cebdd[_0x48d9('0x2f')]]);}else if(this[_0x48d9('0x8')][_0x4cebdd[_0x48d9('0x2f')]]){if(this[_0x48d9('0x8')][_0x4cebdd[_0x48d9('0x2f')]]['state']!==_0x4cebdd[_0x48d9('0x24')][_0x48d9('0x31')]()){this[_0x48d9('0x8')][_0x4cebdd['device']]['stateTime']=_[_0x48d9('0x39')](moment()[_0x48d9('0x35')]('x'));}this[_0x48d9('0x8')][_0x4cebdd[_0x48d9('0x2f')]][_0x48d9('0x24')]=_0x4cebdd[_0x48d9('0x24')][_0x48d9('0x31')]();logger[_0x48d9('0x25')](_0x48d9('0x3a'),util[_0x48d9('0x16')](this[_0x48d9('0x8')][_0x4cebdd['device']],{'showHidden':![],'depth':null}));this[_0x48d9('0x1f')](util['format']('trunk:%s',this['trunks'][_0x4cebdd[_0x48d9('0x2f')]][_0x48d9('0x38')]),_0x48d9('0x2e'),this['trunks'][_0x4cebdd[_0x48d9('0x2f')]]);}else if(_[_0x48d9('0x3b')](_0x4cebdd[_0x48d9('0x2f')],_0x48d9('0x3c'))){var _0x2f5d07=_0x4cebdd[_0x48d9('0x2f')];var _0x28c258=_0x2f5d07[_0x48d9('0x3d')](_0x2f5d07[_0x48d9('0x3e')]('/')+0x1,_0x2f5d07[_0x48d9('0x3e')]('@'));var _0x302bb3=_['find'](this[_0x48d9('0x9')],function(_0x57d43b){return _0x57d43b['mobile']==_0x28c258||_0x57d43b['phone']==_0x28c258||_0x57d43b[_0x48d9('0x3f')]==_0x28c258;});if(_0x302bb3){if(_0x302bb3[_0x48d9('0x24')]!==_0x4cebdd[_0x48d9('0x24')]['toLowerCase']()){_0x302bb3['stateTime']=_[_0x48d9('0x39')](moment()[_0x48d9('0x35')]('x'));}_0x302bb3[_0x48d9('0x24')]=_0x4cebdd['state'][_0x48d9('0x31')]();_0x302bb3[_0x48d9('0x32')]=!![];_0x302bb3[_0x48d9('0x34')](_0x4cebdd);}}}}catch(_0x363bf6){logger['error'](_0x48d9('0x30'),util[_0x48d9('0x16')](_0x363bf6,{'showHidden':![],'depth':null}));}};UserReport[_0x48d9('0x1c')][_0x48d9('0x10')]=function(_0x1c9cfa){try{if(this[_0x48d9('0x1d')](_0x1c9cfa)&&this[_0x48d9('0x1d')](_0x1c9cfa[_0x48d9('0x40')])){logger[_0x48d9('0x21')](_0x48d9('0x41'),_0x1c9cfa['peer'],_0x1c9cfa[_0x48d9('0x42')],_0x1c9cfa[_0x48d9('0x40')]);logger[_0x48d9('0x25')](_0x48d9('0x43'),util[_0x48d9('0x16')](_0x1c9cfa,{'showHidden':![],'depth':null}));if(this[_0x48d9('0x9')][_0x1c9cfa[_0x48d9('0x44')]]){if(!this[_0x48d9('0x9')][_0x1c9cfa['peer']][_0x48d9('0x32')]||_0x1c9cfa[_0x48d9('0x40')][_0x48d9('0x31')]()==_0x48d9('0x45')){this[_0x48d9('0x9')][_0x1c9cfa[_0x48d9('0x44')]][_0x48d9('0x32')]=![];this['agents'][_0x1c9cfa[_0x48d9('0x44')]][_0x48d9('0x46')]=_0x1c9cfa[_0x48d9('0x40')][_0x48d9('0x31')]();this['agents'][_0x1c9cfa[_0x48d9('0x44')]][_0x48d9('0x42')]=_0x1c9cfa[_0x48d9('0x42')];this[_0x48d9('0x9')][_0x1c9cfa[_0x48d9('0x44')]][_0x48d9('0x34')](_0x1c9cfa);}}else if(this[_0x48d9('0xa')][_0x1c9cfa[_0x48d9('0x44')]]){this[_0x48d9('0xa')][_0x1c9cfa[_0x48d9('0x44')]]['status']=_0x1c9cfa['peerstatus'][_0x48d9('0x31')]();this[_0x48d9('0xa')][_0x1c9cfa['peer']][_0x48d9('0x42')]=_0x1c9cfa[_0x48d9('0x42')];logger[_0x48d9('0x25')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x48d9('0x16')](this[_0x48d9('0xa')][_0x1c9cfa['peer']],{'showHidden':![],'depth':null}));this[_0x48d9('0x1f')](util[_0x48d9('0x35')]('telephone:%s',this['telephones'][_0x1c9cfa[_0x48d9('0x44')]][_0x48d9('0x38')]),_0x48d9('0x47'),this[_0x48d9('0xa')][_0x1c9cfa['peer']]);}else if(this[_0x48d9('0x8')][_0x1c9cfa['peer']]){this[_0x48d9('0x8')][_0x1c9cfa['peer']][_0x48d9('0x46')]=_0x1c9cfa[_0x48d9('0x40')][_0x48d9('0x31')]();this[_0x48d9('0x8')][_0x1c9cfa['peer']][_0x48d9('0x42')]=_0x1c9cfa[_0x48d9('0x42')];logger[_0x48d9('0x25')](_0x48d9('0x48'),util[_0x48d9('0x16')](this['trunks'][_0x1c9cfa[_0x48d9('0x44')]],{'showHidden':![],'depth':null}));this[_0x48d9('0x1f')](util[_0x48d9('0x35')]('trunk:%s',this[_0x48d9('0x8')][_0x1c9cfa[_0x48d9('0x44')]][_0x48d9('0x38')]),_0x48d9('0x2e'),this[_0x48d9('0x8')][_0x1c9cfa[_0x48d9('0x44')]]);}}}catch(_0x395d53){logger[_0x48d9('0x18')]('[userReport][peerstatus]',util[_0x48d9('0x16')](_0x395d53,{'showHidden':![],'depth':null}));}};module[_0x48d9('0x49')]=UserReport; \ No newline at end of file +var _0xbf26=['state','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','debug','[userReport][devicestatechange]','device','toLowerCase','inuse','local','stateTime','toNumber','format','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','phone','accountcode','peer','address','[userReport][peerstatus]','registered','status','peerstatus','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','syncRealtimeShow','resolve','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','error','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','[userReport][registry]','find','stateRegistry'];(function(_0x57d978,_0xb66619){var _0x1eca77=function(_0x2aba2e){while(--_0x2aba2e){_0x57d978['push'](_0x57d978['shift']());}};_0x1eca77(++_0xb66619);}(_0xbf26,0x198));var _0x6bf2=function(_0x1adf7b,_0x3309c7){_0x1adf7b=_0x1adf7b-0x0;var _0x1dc12b=_0xbf26[_0x1adf7b];return _0x1dc12b;};'use strict';var _=require(_0x6bf2('0x0'));var moment=require(_0x6bf2('0x1'));var util=require('util');var Redis=require(_0x6bf2('0x2'));var BPromise=require(_0x6bf2('0x3'));var config=require(_0x6bf2('0x4'));var logger=require(_0x6bf2('0x5'))('ami');var ami=require(_0x6bf2('0x6'));config[_0x6bf2('0x7')]=_[_0x6bf2('0x8')](config['redis'],{'host':_0x6bf2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x12ebe1){this['trunks']=_0x12ebe1[_0x6bf2('0xa')];this[_0x6bf2('0xb')]=_0x12ebe1['agents'];this['telephones']=_0x12ebe1[_0x6bf2('0xc')];ami['on'](_0x6bf2('0xd'),this[_0x6bf2('0xe')]['bind'](this));ami['on']('registry',this[_0x6bf2('0xe')][_0x6bf2('0xf')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x6bf2('0xf')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x6bf2('0xf')](this));return this[_0x6bf2('0x10')]();}function showSipRegistrations(){Promise[_0x6bf2('0x11')]()['then'](ami[_0x6bf2('0x12')]())[_0x6bf2('0x13')](function(_0x33fa94){logger['error'](_0x6bf2('0x14'),util[_0x6bf2('0x15')](_0x33fa94,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x6bf2('0x11')]()[_0x6bf2('0x16')](ami[_0x6bf2('0x17')]())[_0x6bf2('0x13')](function(_0x30abdf){logger[_0x6bf2('0x18')](_0x6bf2('0x19'),util[_0x6bf2('0x15')](_0x30abdf,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x6bf2('0x11')]()['then'](ami['actionSipPeerStatus']())[_0x6bf2('0x13')](function(_0x3eaf55){logger['error'](_0x6bf2('0x1a'),util['inspect'](_0x3eaf55,{'showHidden':![],'depth':null}));});}UserReport[_0x6bf2('0x1b')][_0x6bf2('0x10')]=function(){setInterval(function(){BPromise['resolve']()[_0x6bf2('0x16')](showSipRegistrations())[_0x6bf2('0x16')](listDeviceStates())[_0x6bf2('0x16')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x6bf2('0x1c')]=function(_0x340413){return _0x340413!==null&&!_['isUndefined'](_0x340413);};UserReport[_0x6bf2('0x1b')][_0x6bf2('0x1d')]=function(_0x2f1242,_0x1fac2d,_0x35fd47){io['to'](_0x2f1242)['emit'](_0x1fac2d,_0x35fd47);};UserReport[_0x6bf2('0x1b')][_0x6bf2('0xe')]=function(_0x4b59a2){try{if(this[_0x6bf2('0x1c')](_0x4b59a2)){logger[_0x6bf2('0x1e')](_0x6bf2('0x1f'),_0x4b59a2[_0x6bf2('0x20')],_0x4b59a2['state']);logger['debug'](_0x6bf2('0x21'),util[_0x6bf2('0x15')](_0x4b59a2,{'showHidden':![],'depth':null}));var _0x36c115=_[_0x6bf2('0x22')](this['trunks'],{'defaultuser':_0x4b59a2[_0x6bf2('0x20')]});if(_0x36c115){_0x4b59a2[_0x6bf2('0x23')]=_0x4b59a2[_0x6bf2('0x24')];_['merge'](_0x36c115,_[_0x6bf2('0x25')](_0x4b59a2,[_0x6bf2('0x26'),_0x6bf2('0x27'),_0x6bf2('0x20'),'state']));logger['debug'](_0x6bf2('0x28'),util[_0x6bf2('0x15')](_0x36c115,{'showHidden':![],'depth':null}));this[_0x6bf2('0x1d')](util['format'](_0x6bf2('0x29'),_0x36c115[_0x6bf2('0x2a')]),_0x6bf2('0x2b'),_0x36c115);}}}catch(_0xea89e9){logger[_0x6bf2('0x18')](_0x6bf2('0x21'),util[_0x6bf2('0x15')](_0xea89e9,{'showHidden':![],'depth':null}));}};UserReport[_0x6bf2('0x1b')][_0x6bf2('0x2c')]=function(_0x193960){try{if(this[_0x6bf2('0x1c')](_0x193960)){logger[_0x6bf2('0x1e')](_0x6bf2('0x2d'),_0x193960['device'],_0x193960[_0x6bf2('0x24')]);logger[_0x6bf2('0x2e')](_0x6bf2('0x2f'),util[_0x6bf2('0x15')](_0x193960,{'showHidden':![],'depth':null}));if(this[_0x6bf2('0xb')][_0x193960['device']]){if(!this[_0x6bf2('0xb')][_0x193960[_0x6bf2('0x30')]]['local']||_0x193960[_0x6bf2('0x24')][_0x6bf2('0x31')]()==_0x6bf2('0x32')){this[_0x6bf2('0xb')][_0x193960['device']][_0x6bf2('0x33')]=![];if(this[_0x6bf2('0xb')][_0x193960[_0x6bf2('0x30')]][_0x6bf2('0x24')]!==_0x193960[_0x6bf2('0x24')][_0x6bf2('0x31')]()){this['agents'][_0x193960[_0x6bf2('0x30')]][_0x6bf2('0x34')]=_[_0x6bf2('0x35')](moment()[_0x6bf2('0x36')]('x'));}this[_0x6bf2('0xb')][_0x193960[_0x6bf2('0x30')]][_0x6bf2('0x24')]=_0x193960[_0x6bf2('0x24')][_0x6bf2('0x31')]();this[_0x6bf2('0xb')][_0x193960['device']][_0x6bf2('0x37')](_0x193960);}}else if(this[_0x6bf2('0xc')][_0x193960['device']]){if(this['telephones'][_0x193960[_0x6bf2('0x30')]][_0x6bf2('0x24')]!==_0x193960[_0x6bf2('0x24')][_0x6bf2('0x31')]()){this['telephones'][_0x193960[_0x6bf2('0x30')]][_0x6bf2('0x34')]=_[_0x6bf2('0x35')](moment()[_0x6bf2('0x36')]('x'));}this[_0x6bf2('0xc')][_0x193960[_0x6bf2('0x30')]][_0x6bf2('0x24')]=_0x193960[_0x6bf2('0x24')][_0x6bf2('0x31')]();logger[_0x6bf2('0x2e')](_0x6bf2('0x38'),util[_0x6bf2('0x15')](this[_0x6bf2('0xc')][_0x193960['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x6bf2('0x36')](_0x6bf2('0x39'),this['telephones'][_0x193960['device']][_0x6bf2('0x2a')]),_0x6bf2('0x3a'),this[_0x6bf2('0xc')][_0x193960[_0x6bf2('0x30')]]);}else if(this['trunks'][_0x193960[_0x6bf2('0x30')]]){if(this['trunks'][_0x193960[_0x6bf2('0x30')]][_0x6bf2('0x24')]!==_0x193960[_0x6bf2('0x24')][_0x6bf2('0x31')]()){this[_0x6bf2('0xa')][_0x193960[_0x6bf2('0x30')]][_0x6bf2('0x34')]=_[_0x6bf2('0x35')](moment()['format']('x'));}this[_0x6bf2('0xa')][_0x193960[_0x6bf2('0x30')]][_0x6bf2('0x24')]=_0x193960[_0x6bf2('0x24')][_0x6bf2('0x31')]();logger[_0x6bf2('0x2e')](_0x6bf2('0x3b'),util['inspect'](this['trunks'][_0x193960[_0x6bf2('0x30')]],{'showHidden':![],'depth':null}));this[_0x6bf2('0x1d')](util[_0x6bf2('0x36')](_0x6bf2('0x29'),this[_0x6bf2('0xa')][_0x193960['device']][_0x6bf2('0x2a')]),_0x6bf2('0x2b'),this[_0x6bf2('0xa')][_0x193960[_0x6bf2('0x30')]]);}else if(_['startsWith'](_0x193960[_0x6bf2('0x30')],_0x6bf2('0x3c'))){var _0x161b8c=_0x193960[_0x6bf2('0x30')];var _0x2238dd=_0x161b8c[_0x6bf2('0x3d')](_0x161b8c[_0x6bf2('0x3e')]('/')+0x1,_0x161b8c['indexOf']('@'));var _0x2f38a9=_['find'](this[_0x6bf2('0xb')],function(_0x30a4bb){return _0x30a4bb['mobile']==_0x2238dd||_0x30a4bb[_0x6bf2('0x3f')]==_0x2238dd||_0x30a4bb[_0x6bf2('0x40')]==_0x2238dd;});if(_0x2f38a9){if(_0x2f38a9['state']!==_0x193960[_0x6bf2('0x24')][_0x6bf2('0x31')]()){_0x2f38a9[_0x6bf2('0x34')]=_[_0x6bf2('0x35')](moment()[_0x6bf2('0x36')]('x'));}_0x2f38a9[_0x6bf2('0x24')]=_0x193960[_0x6bf2('0x24')][_0x6bf2('0x31')]();_0x2f38a9['local']=!![];_0x2f38a9['updateStatusRealtime'](_0x193960);}}}}catch(_0x488299){logger['error']('[userReport][devicestatechange]',util[_0x6bf2('0x15')](_0x488299,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x4a4f52){try{if(this[_0x6bf2('0x1c')](_0x4a4f52)&&this[_0x6bf2('0x1c')](_0x4a4f52['peerstatus'])){logger[_0x6bf2('0x1e')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x4a4f52[_0x6bf2('0x41')],_0x4a4f52[_0x6bf2('0x42')],_0x4a4f52['peerstatus']);logger[_0x6bf2('0x2e')](_0x6bf2('0x43'),util[_0x6bf2('0x15')](_0x4a4f52,{'showHidden':![],'depth':null}));if(this[_0x6bf2('0xb')][_0x4a4f52['peer']]){if(!this[_0x6bf2('0xb')][_0x4a4f52[_0x6bf2('0x41')]][_0x6bf2('0x33')]||_0x4a4f52['peerstatus'][_0x6bf2('0x31')]()==_0x6bf2('0x44')){this['agents'][_0x4a4f52[_0x6bf2('0x41')]][_0x6bf2('0x33')]=![];this[_0x6bf2('0xb')][_0x4a4f52[_0x6bf2('0x41')]][_0x6bf2('0x45')]=_0x4a4f52[_0x6bf2('0x46')][_0x6bf2('0x31')]();this['agents'][_0x4a4f52[_0x6bf2('0x41')]]['address']=_0x4a4f52[_0x6bf2('0x42')];this[_0x6bf2('0xb')][_0x4a4f52[_0x6bf2('0x41')]][_0x6bf2('0x37')](_0x4a4f52);}}else if(this['telephones'][_0x4a4f52['peer']]){this[_0x6bf2('0xc')][_0x4a4f52['peer']][_0x6bf2('0x45')]=_0x4a4f52['peerstatus'][_0x6bf2('0x31')]();this[_0x6bf2('0xc')][_0x4a4f52[_0x6bf2('0x41')]]['address']=_0x4a4f52[_0x6bf2('0x42')];logger[_0x6bf2('0x2e')](_0x6bf2('0x47'),util[_0x6bf2('0x15')](this[_0x6bf2('0xc')][_0x4a4f52[_0x6bf2('0x41')]],{'showHidden':![],'depth':null}));this[_0x6bf2('0x1d')](util[_0x6bf2('0x36')]('telephone:%s',this[_0x6bf2('0xc')][_0x4a4f52[_0x6bf2('0x41')]][_0x6bf2('0x2a')]),_0x6bf2('0x3a'),this[_0x6bf2('0xc')][_0x4a4f52[_0x6bf2('0x41')]]);}else if(this['trunks'][_0x4a4f52['peer']]){this[_0x6bf2('0xa')][_0x4a4f52[_0x6bf2('0x41')]][_0x6bf2('0x45')]=_0x4a4f52[_0x6bf2('0x46')]['toLowerCase']();this[_0x6bf2('0xa')][_0x4a4f52[_0x6bf2('0x41')]]['address']=_0x4a4f52['address'];logger[_0x6bf2('0x2e')](_0x6bf2('0x48'),util[_0x6bf2('0x15')](this[_0x6bf2('0xa')][_0x4a4f52[_0x6bf2('0x41')]],{'showHidden':![],'depth':null}));this[_0x6bf2('0x1d')](util[_0x6bf2('0x36')](_0x6bf2('0x29'),this[_0x6bf2('0xa')][_0x4a4f52[_0x6bf2('0x41')]][_0x6bf2('0x2a')]),_0x6bf2('0x2b'),this['trunks'][_0x4a4f52[_0x6bf2('0x41')]]);}}}catch(_0x3f7f57){logger['error'](_0x6bf2('0x43'),util[_0x6bf2('0x15')](_0x3f7f57,{'showHidden':![],'depth':null}));}};module[_0x6bf2('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index dbbceb7..c0f5e62 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x30fc30,_0x194689){var _0xa74cb7=function(_0x5f0dc0){while(--_0x5f0dc0){_0x30fc30['push'](_0x30fc30['shift']());}};_0xa74cb7(++_0x194689);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x1fe981,_0x48c08b){var _0xe7c85c=function(_0x442248){while(--_0x442248){_0x1fe981['push'](_0x1fe981['shift']());}};_0xe7c85c(++_0x48c08b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index f4e83c7..31f97e7 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41e0=['[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','inuse','invalid','unavailable','ringing','ringinuse','set','queue','agi','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isUndefined','prototype','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','keys','from-sip','channel','split','xcally-motion-preview','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','exten','toNumber','channelstate','context','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','application','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','merge','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','connectedlinename','destinationchannel','disposition','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncMixMonitorFilename','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','diff','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','undefined','isEmpty','resolve','Action','StopMixMonitor','catch','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','some','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','BlindTransfer','transfererchannel','[%s][voiceCallReport][blindtransfer]','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x41e0,0x19f));var _0x041e=function(_0x4c2388,_0x5aefc8){_0x4c2388=_0x4c2388-0x0;var _0x318dc2=_0x41e0[_0x4c2388];return _0x318dc2;};'use strict';var BPromise=require(_0x041e('0x0'));var _=require('lodash');var moment=require(_0x041e('0x1'));var util=require('util');var path=require('path');var Redis=require('ioredis');var config=require(_0x041e('0x2'));var logger=require(_0x041e('0x3'))(_0x041e('0x4'));var ami=require(_0x041e('0x5'));var Channel=require(_0x041e('0x6'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0x041e('0x7'),'not_inuse',_0x041e('0x8'),'busy',_0x041e('0x9'),_0x041e('0xa'),_0x041e('0xb'),_0x041e('0xc'),'onhold'];var applications=[_0x041e('0xd'),_0x041e('0xe'),_0x041e('0xf'),_0x041e('0x10'),'playback',_0x041e('0x11')];var dispositions=['NO\x20ANSWER',_0x041e('0x12'),_0x041e('0x12'),'NO\x20ANSWER',_0x041e('0x13'),_0x041e('0x13'),_0x041e('0x14'),_0x041e('0x15'),_0x041e('0x12'),'FAILED',_0x041e('0x12')];var actions={};config[_0x041e('0x16')]=_['defaults'](config[_0x041e('0x16')],{'host':'localhost','port':0x18eb});var io=require(_0x041e('0x17'))(new Redis(config['redis']));function VoiceCallReport(_0x4bfa8d){this['channels']=_0x4bfa8d[_0x041e('0x18')];this[_0x041e('0x19')]=_0x4bfa8d['agents'];this[_0x041e('0x1a')]={};ami['on']('coreshowchannel',this[_0x041e('0x1b')][_0x041e('0x1c')](this));ami['on'](_0x041e('0x1d'),this[_0x041e('0x1b')][_0x041e('0x1c')](this));ami['on'](_0x041e('0x1e'),this[_0x041e('0x1f')][_0x041e('0x1c')](this));ami['on'](_0x041e('0x20'),this[_0x041e('0x21')][_0x041e('0x1c')](this));ami['on'](_0x041e('0x22'),this[_0x041e('0x23')]['bind'](this));ami['on'](_0x041e('0x24'),this[_0x041e('0x25')]['bind'](this));ami['on'](_0x041e('0x26'),this[_0x041e('0x27')][_0x041e('0x1c')](this));ami['on'](_0x041e('0x28'),this[_0x041e('0x29')][_0x041e('0x1c')](this));ami['on']('blindtransfer',this[_0x041e('0x2a')][_0x041e('0x1c')](this));ami['on'](_0x041e('0x2b'),this['syncMusicOnHoldStart'][_0x041e('0x1c')](this));ami['on'](_0x041e('0x2c'),this['syncMusicOnHoldStop'][_0x041e('0x1c')](this));try{logger[_0x041e('0x2d')](_0x041e('0x2e'));ami[_0x041e('0x2f')]();}catch(_0x10d89d){logger[_0x041e('0x30')](_0x041e('0x31'),util[_0x041e('0x32')](_0x10d89d,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x476dfb){return _0x476dfb!==null&&!_[_0x041e('0x33')](_0x476dfb);};VoiceCallReport[_0x041e('0x34')][_0x041e('0x35')]=function(_0x2c34b6,_0x36eff7,_0x122642){io['to'](_0x2c34b6)[_0x041e('0x35')](_0x36eff7,_0x122642);};VoiceCallReport[_0x041e('0x34')][_0x041e('0x27')]=function(_0x709c37){try{if(this[_0x041e('0x36')](_0x709c37)){logger[_0x041e('0x2d')](_0x041e('0x37'),_0x709c37[_0x041e('0x38')],_0x709c37[_0x041e('0x39')],_0x709c37[_0x041e('0x3a')]);logger[_0x041e('0x3b')](_0x041e('0x3c'),_0x709c37[_0x041e('0x38')],util[_0x041e('0x32')](_0x709c37,{'showHidden':![],'depth':null}));if(_0x709c37['uniqueid']===_0x709c37[_0x041e('0x3d')]){if(!_[_0x041e('0x33')](this[_0x041e('0x18')][_0x709c37['uniqueid']])){_['merge'](this[_0x041e('0x18')][_0x709c37[_0x041e('0x38')]],_[_0x041e('0x3e')](_0x709c37,_[_0x041e('0x3f')](this[_0x041e('0x18')][_0x709c37[_0x041e('0x38')]])));}}if(_0x709c37['context']===_0x041e('0x40')){if(this[_0x041e('0x19')][_0x709c37[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]]){if(_0x709c37['exten']==_0x041e('0x43')){this[_0x041e('0x19')][_0x709c37[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]]['destconnectedlinenum']=_0x709c37[_0x041e('0x44')];this[_0x041e('0x35')](util[_0x041e('0x45')](_0x041e('0x46'),this[_0x041e('0x19')][_0x709c37['channel'][_0x041e('0x42')]('-')[0x0]][_0x041e('0x47')]),_0x041e('0x48'),{'destaccountcode':this[_0x041e('0x19')][_0x709c37[_0x041e('0x41')]['split']('-')[0x0]][_0x041e('0x49')],'destconnectedlinenum':_0x709c37[_0x041e('0x44')]});}}}}}catch(_0x22f91f){logger[_0x041e('0x30')](_0x041e('0x4a'),_0x709c37[_0x041e('0x38')],util[_0x041e('0x32')](_0x22f91f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x041e('0x34')]['syncNewChannel']=function(_0x52fc7a){try{if(this[_0x041e('0x36')](_0x52fc7a)){logger[_0x041e('0x3b')](_0x041e('0x4b'),_0x52fc7a[_0x041e('0x38')],util[_0x041e('0x32')](_0x52fc7a,{'showHidden':![],'depth':null}));if(_0x52fc7a[_0x041e('0x38')]===_0x52fc7a[_0x041e('0x3d')]&&_0x52fc7a['channel']!=_0x041e('0x4c')){if(_[_0x041e('0x33')](this['channels'][_0x52fc7a[_0x041e('0x38')]])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x52fc7a['uniqueid'],_0x52fc7a['context'],_0x52fc7a[_0x041e('0x4d')]);this[_0x041e('0x18')][_0x52fc7a[_0x041e('0x38')]]=new Channel();this['channels'][_0x52fc7a[_0x041e('0x38')]]['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x041e('0x18')][_0x52fc7a['uniqueid']]['disposition']=dispositions[_[_0x041e('0x4e')](_0x52fc7a[_0x041e('0x4f')])];_['merge'](this[_0x041e('0x18')][_0x52fc7a[_0x041e('0x38')]],_[_0x041e('0x3e')](_0x52fc7a,_[_0x041e('0x3f')](this[_0x041e('0x18')][_0x52fc7a[_0x041e('0x38')]])));if(_0x52fc7a[_0x041e('0x50')]===_0x041e('0x40')){if(this['agents'][_0x52fc7a[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]]){if(_[_0x041e('0x33')](this['agents'][_0x52fc7a[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]][_0x041e('0x51')])){this[_0x041e('0x19')][_0x52fc7a[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]][_0x041e('0x51')]=_0x52fc7a[_0x041e('0x4d')];logger[_0x041e('0x3b')](_0x041e('0x52'),_0x52fc7a[_0x041e('0x38')],util[_0x041e('0x32')]({'destaccountcode':this[_0x041e('0x19')][_0x52fc7a['channel'][_0x041e('0x42')]('-')[0x0]][_0x041e('0x49')],'destconnectedlinenum':_0x52fc7a['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0x041e('0x45')](_0x041e('0x46'),this[_0x041e('0x19')][_0x52fc7a['channel'][_0x041e('0x42')]('-')[0x0]][_0x041e('0x47')]),_0x041e('0x48'),{'destaccountcode':this[_0x041e('0x19')][_0x52fc7a[_0x041e('0x41')]['split']('-')[0x0]][_0x041e('0x49')],'destconnectedlinenum':_0x52fc7a[_0x041e('0x4d')]});}}}}}}}catch(_0x386e89){logger[_0x041e('0x30')](_0x041e('0x53'),_0x52fc7a['uniqueid'],util[_0x041e('0x32')](_0x386e89,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x041e('0x1b')]=function(_0x2affec){try{if(this['isNotNull'](_0x2affec)){logger[_0x041e('0x3b')](_0x041e('0x54'),_0x2affec['uniqueid'],util['inspect'](_0x2affec,{'showHidden':![],'depth':null}));if(_0x2affec[_0x041e('0x38')]===_0x2affec[_0x041e('0x3d')]&&_0x2affec[_0x041e('0x4d')]!='h'&&_0x2affec['channel']!=_0x041e('0x4c')){_0x2affec['application']=_0x2affec['application'][_0x041e('0x55')]();_0x2affec[_0x041e('0x56')]=_0x2affec[_0x041e('0x57')]&&_0x2affec[_0x041e('0x57')][_0x041e('0x58')](_0x041e('0x59'))?_0x2affec[_0x041e('0x57')]:(_0x2affec[_0x041e('0x57')]||_0x2affec[_0x041e('0x56')])[_0x041e('0x55')]();logger[_0x041e('0x2d')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2affec[_0x041e('0x38')],_0x2affec[_0x041e('0x5a')],_0x2affec[_0x041e('0x56')]);if(_[_0x041e('0x33')](this[_0x041e('0x18')][_0x2affec[_0x041e('0x38')]])){this['channels'][_0x2affec[_0x041e('0x38')]]=new Channel();this[_0x041e('0x18')][_0x2affec[_0x041e('0x38')]][_0x041e('0x5b')]=_0x2affec[_0x041e('0x5c')]?moment()[_0x041e('0x5d')](moment[_0x041e('0x5c')](_0x2affec[_0x041e('0x5c')])[_0x041e('0x5e')](),'seconds')[_0x041e('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x041e('0x45')](_0x041e('0x5f'));this['channels'][_0x2affec['uniqueid']]['disposition']=_0x041e('0x13');}_[_0x041e('0x60')](this[_0x041e('0x18')][_0x2affec[_0x041e('0x38')]],_['pick'](_0x2affec,_['keys'](this[_0x041e('0x18')][_0x2affec['uniqueid']])));if(_[_0x041e('0x61')](applications,_0x2affec[_0x041e('0x5a')])){this['channels'][_0x2affec[_0x041e('0x38')]][_0x041e('0x62')]=_0x2affec[_0x041e('0x5a')];this[_0x041e('0x18')][_0x2affec[_0x041e('0x38')]][_0x041e('0x63')]=_0x2affec[_0x041e('0x56')];if(_0x2affec[_0x041e('0x5a')]===_0x041e('0xd')&&_[_0x041e('0x58')](_0x2affec[_0x041e('0x56')][_0x041e('0x55')](),_0x041e('0x64'))){var _0x3ce50a=_0x2affec['applicationdata'][_0x041e('0x42')]('=');var _0x2eb2be=_0x3ce50a[0x0]['toLowerCase']()[_0x041e('0x65')](/cdr\((.*)\)/);if(_0x2eb2be){this[_0x041e('0x18')][_0x2affec[_0x041e('0x38')]][_0x2eb2be[0x1]]=_0x3ce50a[0x1];}}else if(_0x2affec[_0x041e('0x5a')]===_0x041e('0xe')){this[_0x041e('0x18')][_0x2affec[_0x041e('0x38')]][_0x041e('0xe')]=_0x2affec[_0x041e('0x56')]['split'](',')[0x0];}}}}}catch(_0x1a3192){logger['error'](_0x041e('0x66'),_0x2affec[_0x041e('0x38')],util['inspect'](_0x1a3192,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x041e('0x34')][_0x041e('0x21')]=function(_0x835e8e){try{if(this[_0x041e('0x36')](_0x835e8e)){logger[_0x041e('0x2d')](_0x041e('0x67'),_0x835e8e[_0x041e('0x38')],_0x835e8e[_0x041e('0x3d')],_0x835e8e[_0x041e('0x39')],_0x835e8e['calleridnum']);logger[_0x041e('0x3b')](_0x041e('0x68'),_0x835e8e['uniqueid'],util[_0x041e('0x32')](_0x835e8e,{'showHidden':![],'depth':null}));if(_0x835e8e['uniqueid']!==_0x835e8e[_0x041e('0x3d')]){if(this[_0x041e('0x18')][_0x835e8e[_0x041e('0x3d')]]){if(_0x835e8e[_0x041e('0x4f')]==='6'){if(!this[_0x041e('0x18')][_0x835e8e[_0x041e('0x3d')]][_0x041e('0x69')]){var _0x48e731=moment();this['channels'][_0x835e8e[_0x041e('0x3d')]][_0x041e('0x69')]=!![];this[_0x041e('0x18')][_0x835e8e['linkedid']][_0x041e('0x6a')]=_0x48e731[_0x041e('0x45')](_0x041e('0x5f'));if(this[_0x041e('0x18')][_0x835e8e['linkedid']][_0x041e('0x5b')]){this['channels'][_0x835e8e[_0x041e('0x3d')]]['holdtime']=_0x48e731['diff'](this[_0x041e('0x18')][_0x835e8e[_0x041e('0x3d')]][_0x041e('0x5b')],_0x041e('0x5e'));}}this[_0x041e('0x18')][_0x835e8e['linkedid']][_0x041e('0x3d')]=_0x835e8e[_0x041e('0x38')];if(_0x835e8e[_0x041e('0x3a')]!==_0x041e('0x43')){this['channels'][_0x835e8e[_0x041e('0x3d')]][_0x041e('0x44')]=_0x835e8e[_0x041e('0x3a')];}this['channels'][_0x835e8e[_0x041e('0x3d')]][_0x041e('0x6b')]=_0x835e8e[_0x041e('0x39')];this[_0x041e('0x18')][_0x835e8e[_0x041e('0x3d')]][_0x041e('0x6c')]=_0x835e8e[_0x041e('0x41')];this[_0x041e('0x18')][_0x835e8e['linkedid']][_0x041e('0x6d')]=dispositions[_[_0x041e('0x4e')](_0x835e8e[_0x041e('0x4f')])];if(this[_0x041e('0x19')][_0x835e8e[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]]){this[_0x041e('0x18')][_0x835e8e[_0x041e('0x3d')]]['UserId']=this['agents'][_0x835e8e[_0x041e('0x41')]['split']('-')[0x0]]['id'];this['channels'][_0x835e8e[_0x041e('0x3d')]]['membername']=this[_0x041e('0x19')][_0x835e8e[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]][_0x041e('0x47')];}}}}else{if(this[_0x041e('0x18')][_0x835e8e['uniqueid']]){if(_0x835e8e[_0x041e('0x4f')]==='6'){if(this[_0x041e('0x19')][_0x835e8e['channel'][_0x041e('0x42')]('-')[0x0]]){this[_0x041e('0x18')][_0x835e8e[_0x041e('0x38')]][_0x041e('0x6e')]=this[_0x041e('0x19')][_0x835e8e[_0x041e('0x41')]['split']('-')[0x0]]['id'];this[_0x041e('0x18')][_0x835e8e[_0x041e('0x38')]][_0x041e('0x6f')]=this[_0x041e('0x19')][_0x835e8e[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]][_0x041e('0x47')];}}}}if(_0x835e8e['channelstate']==='6'&&_0x835e8e[_0x041e('0x50')]===_0x041e('0x40')){if(this[_0x041e('0x19')][_0x835e8e[_0x041e('0x41')]['split']('-')[0x0]]){this[_0x041e('0x19')][_0x835e8e[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]][_0x041e('0x51')]=_0x835e8e['exten'];var _0x38be21;if(this[_0x041e('0x18')][_0x835e8e[_0x041e('0x38')]])_0x38be21=this['channels'][_0x835e8e[_0x041e('0x38')]][_0x041e('0x70')];else if(this['channels'][_0x835e8e['linkedid']])_0x38be21=this[_0x041e('0x18')][_0x835e8e[_0x041e('0x3d')]]['routealias'];logger['debug'](_0x041e('0x71'),_0x835e8e[_0x041e('0x38')],util[_0x041e('0x32')]({'destaccountcode':this[_0x041e('0x19')][_0x835e8e[_0x041e('0x41')]['split']('-')[0x0]][_0x041e('0x49')],'destconnectedlinenum':_0x835e8e['exten'],'routealias':_0x38be21},{'showHidden':![],'depth':null}));this[_0x041e('0x35')](util[_0x041e('0x45')]('user:%s',this[_0x041e('0x19')][_0x835e8e[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]][_0x041e('0x47')]),_0x041e('0x48'),{'destaccountcode':this[_0x041e('0x19')][_0x835e8e['channel'][_0x041e('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x835e8e['exten'],'routealias':_0x38be21});}}}}catch(_0x496256){logger[_0x041e('0x30')](_0x041e('0x72'),_0x835e8e[_0x041e('0x38')],util[_0x041e('0x32')](_0x496256,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x041e('0x34')]['syncMixMonitorFilename']=function(_0x230c90,_0x1b321f){try{if(this['channels'][_0x230c90]){logger[_0x041e('0x2d')](_0x041e('0x73'),_0x230c90,_0x1b321f);this[_0x041e('0x18')][_0x230c90]['monitor']=!![];if(_[_0x041e('0x74')](_0x1b321f,_0x041e('0x75'))){_0x1b321f=_0x1b321f[_0x041e('0x76')](_0x041e('0x75'),'.WAV');}this[_0x041e('0x18')][_0x230c90][_0x041e('0x77')]=_0x1b321f;var _0x10f895=_[_0x041e('0x78')](this['channels'][_0x230c90][_0x041e('0x79')],{'filename':_0x1b321f});if(_['isNil'](_0x10f895)){this[_0x041e('0x18')][_0x230c90][_0x041e('0x79')]['push']({'filename':_0x1b321f,'createdAt':moment()[_0x041e('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x041e('0x7a')});}}}catch(_0x14eaa4){logger[_0x041e('0x30')](_0x041e('0x7b'),_0x230c90,util[_0x041e('0x32')](_0x14eaa4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x041e('0x23')]=function(_0xc3b9e0){try{if(this[_0x041e('0x36')](_0xc3b9e0)){logger[_0x041e('0x3b')](_0x041e('0x7c'),_0xc3b9e0[_0x041e('0x38')],util['inspect'](_0xc3b9e0,{'showHidden':![],'depth':null}));if(this[_0x041e('0x18')][_0xc3b9e0[_0x041e('0x38')]]&&_0xc3b9e0[_0x041e('0x41')]!=_0x041e('0x4c')){if(this[_0x041e('0x36')](_0xc3b9e0[_0x041e('0x7d')])){if(this[_0x041e('0x36')](_0xc3b9e0['variable']['mixmonitor_filename'])){logger[_0x041e('0x2d')](_0x041e('0x7e'),_0xc3b9e0[_0x041e('0x38')],_0xc3b9e0['value']);this[_0x041e('0x7f')](_0xc3b9e0[_0x041e('0x38')],_0xc3b9e0[_0x041e('0x80')]);}else if(this[_0x041e('0x36')](_0xc3b9e0[_0x041e('0x7d')]['xmd-phone'])){logger[_0x041e('0x2d')](_0x041e('0x81'),_0xc3b9e0['uniqueid'],_0xc3b9e0[_0x041e('0x80')]);this[_0x041e('0x18')][_0xc3b9e0[_0x041e('0x38')]][_0x041e('0x3a')]=_0xc3b9e0[_0x041e('0x80')];}else if(this[_0x041e('0x36')](_0xc3b9e0['variable'][_0x041e('0x82')])){logger['info'](_0x041e('0x83'),_0xc3b9e0[_0x041e('0x38')],_0xc3b9e0[_0x041e('0x80')]);this['channels'][_0xc3b9e0[_0x041e('0x38')]][_0x041e('0x84')]=_0xc3b9e0[_0x041e('0x80')];}else if(this[_0x041e('0x36')](_0xc3b9e0['variable'][_0x041e('0x85')])){logger['info'](_0x041e('0x86'),_0xc3b9e0[_0x041e('0x38')],_0xc3b9e0[_0x041e('0x80')]);this[_0x041e('0x18')][_0xc3b9e0[_0x041e('0x38')]][_0x041e('0x87')]=_0xc3b9e0[_0x041e('0x80')];}else if(this['isNotNull'](_0xc3b9e0['variable'][_0x041e('0x88')])){logger[_0x041e('0x2d')](_0x041e('0x89'),_0xc3b9e0['uniqueid'],_0xc3b9e0[_0x041e('0x80')][_0x041e('0x42')](',')[0x0]);this[_0x041e('0x18')][_0xc3b9e0[_0x041e('0x38')]][_0x041e('0xe')]=_0xc3b9e0[_0x041e('0x80')][_0x041e('0x42')](',')[0x0];}else if(this[_0x041e('0x36')](_0xc3b9e0['variable'][_0x041e('0x8a')])){logger[_0x041e('0x2d')](_0x041e('0x8b'),_0xc3b9e0[_0x041e('0x38')],_0xc3b9e0[_0x041e('0x80')]);this[_0x041e('0x18')][_0xc3b9e0[_0x041e('0x38')]][_0x041e('0x8c')]=_0xc3b9e0['value'];}else if(this[_0x041e('0x36')](_0xc3b9e0[_0x041e('0x7d')][_0x041e('0x8d')])){logger[_0x041e('0x2d')](_0x041e('0x8e'),_0xc3b9e0[_0x041e('0x38')],_0xc3b9e0['value']);this[_0x041e('0x18')][_0xc3b9e0[_0x041e('0x38')]]['destination']=_0xc3b9e0['value'];}else if(this[_0x041e('0x36')](_0xc3b9e0[_0x041e('0x7d')]['xmd-callerid-preview'])){logger[_0x041e('0x2d')](_0x041e('0x8f'),_0xc3b9e0[_0x041e('0x38')],_0xc3b9e0[_0x041e('0x80')]);this[_0x041e('0x18')][_0xc3b9e0[_0x041e('0x38')]]['calleridpreview']=_0xc3b9e0[_0x041e('0x80')];}else if(this[_0x041e('0x36')](_0xc3b9e0[_0x041e('0x7d')][_0x041e('0x90')])){logger[_0x041e('0x2d')](_0x041e('0x91'),_0xc3b9e0[_0x041e('0x38')],_0xc3b9e0[_0x041e('0x80')]);this[_0x041e('0x18')][_0xc3b9e0['uniqueid']][_0x041e('0xe')]=_0xc3b9e0[_0x041e('0x80')];}else if(this[_0x041e('0x36')](_0xc3b9e0[_0x041e('0x7d')]['sipcallid'])){logger[_0x041e('0x2d')](_0x041e('0x92'),_0xc3b9e0[_0x041e('0x38')],_0xc3b9e0[_0x041e('0x80')]);this[_0x041e('0x18')][_0xc3b9e0['uniqueid']]['sipcalluniqueid']=_0xc3b9e0[_0x041e('0x80')];}}}else if(this[_0x041e('0x36')](_0xc3b9e0[_0x041e('0x7d')][_0x041e('0x93')])){if(_0xc3b9e0[_0x041e('0x80')]){var _0x184f96=path[_0x041e('0x94')](_0xc3b9e0[_0x041e('0x80')])[_0x041e('0x47')];logger[_0x041e('0x2d')](_0x041e('0x7e'),_0x184f96,_0xc3b9e0[_0x041e('0x80')]);this[_0x041e('0x7f')](_0x184f96,_0xc3b9e0['value']);}}else if(this[_0x041e('0x18')][_0xc3b9e0[_0x041e('0x3d')]]){if(this[_0x041e('0x36')](_0xc3b9e0['variable'])){if(this[_0x041e('0x36')](_0xc3b9e0[_0x041e('0x7d')]['sipcallid'])){logger[_0x041e('0x2d')](_0x041e('0x92'),_0xc3b9e0[_0x041e('0x3d')],_0xc3b9e0[_0x041e('0x80')]);this[_0x041e('0x18')][_0xc3b9e0['linkedid']][_0x041e('0x95')]=_0xc3b9e0[_0x041e('0x80')];}}}}}catch(_0x265939){logger[_0x041e('0x30')](_0x041e('0x96'),_0xc3b9e0[_0x041e('0x38')],util[_0x041e('0x32')](_0x265939,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x041e('0x34')][_0x041e('0x25')]=function(_0x5c6af8){try{if(this[_0x041e('0x36')](_0x5c6af8)){logger[_0x041e('0x3b')](_0x041e('0x97'),_0x5c6af8[_0x041e('0x38')],util[_0x041e('0x32')](_0x5c6af8,{'showHidden':![],'depth':null}));if(this[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]]){logger[_0x041e('0x2d')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x5c6af8[_0x041e('0x38')],_0x5c6af8[_0x041e('0x98')]);var _0x62c0c2=moment();this['channels'][_0x5c6af8[_0x041e('0x38')]][_0x041e('0x99')]=_0x62c0c2['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]]['duration']=_0x62c0c2[_0x041e('0x9a')](this['channels'][_0x5c6af8[_0x041e('0x38')]]['starttime'],'seconds');if(this[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]][_0x041e('0x69')]){this[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]]['billableseconds']=_0x62c0c2[_0x041e('0x9a')](this[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]][_0x041e('0x6a')],_0x041e('0x5e'));this[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]][_0x041e('0x9b')]=this[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]]['duration']-this[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]]['billableseconds'];}if(_0x5c6af8[_0x041e('0x50')]===_0x041e('0x40')){if(this[_0x041e('0x19')][_0x5c6af8[_0x041e('0x41')]['split']('-')[0x0]]){this['agents'][_0x5c6af8[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]]=_[_0x041e('0x9c')](this[_0x041e('0x19')][_0x5c6af8[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]],[_0x041e('0x51')]);logger[_0x041e('0x3b')](_0x041e('0x9d'),_0x5c6af8[_0x041e('0x38')],util[_0x041e('0x32')]({'id':this[_0x041e('0x19')][_0x5c6af8[_0x041e('0x41')][_0x041e('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x041e('0x19')][_0x5c6af8[_0x041e('0x41')]['split']('-')[0x0]][_0x041e('0x49')]},{'showHidden':![],'depth':null}));this[_0x041e('0x35')](util[_0x041e('0x45')](_0x041e('0x46'),this[_0x041e('0x19')][_0x5c6af8[_0x041e('0x41')]['split']('-')[0x0]][_0x041e('0x47')]),_0x041e('0x9e'),{'id':this[_0x041e('0x19')][_0x5c6af8['channel'][_0x041e('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x041e('0x19')][_0x5c6af8['channel'][_0x041e('0x42')]('-')[0x0]][_0x041e('0x49')]});}}var _0x4acc28=this;Promise['resolve']()[_0x041e('0x9f')](function(){var _0x5c9492=_0x4acc28[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]];if(typeof _0x5c9492[_0x041e('0xa0')]===_0x041e('0xa1'))return;if(_[_0x041e('0xa2')](_0x5c9492[_0x041e('0x79')]))return;return RpcSetting['getSettings']()[_0x041e('0x9f')](function(_0x34998a){if(!_0x34998a['stopRecordingOnTransfer'])return;return Promise[_0x041e('0xa3')]()[_0x041e('0x9f')](function(){return ami[_0x041e('0xa4')]({'action':_0x041e('0xa5'),'channel':_0x5c9492[_0x041e('0x41')]})[_0x041e('0xa6')](function(){});})[_0x041e('0x9f')](function(){return ami[_0x041e('0xa4')]({'action':_0x041e('0xa5'),'channel':_0x5c9492[_0x041e('0x6c')]})[_0x041e('0xa6')](function(){})['finally'](function(){var _0xff97ee=_0x4acc28[_0x041e('0x19')][_0x5c9492[_0x041e('0x6c')][_0x041e('0x42')]('-')[0x0]];if(!_0xff97ee)return;io[_0x041e('0x35')](_0x041e('0xa7'),{'agentId':_0xff97ee['id'],'uniqueid':_0x5c9492[_0x041e('0x38')]});});});});})[_0x041e('0x9f')](function(){if(_0x5c6af8[_0x041e('0xa8')]==='BlindTransfer'){_0x4acc28[_0x041e('0x1a')][_0x5c6af8[_0x041e('0x38')]]=_0x4acc28[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]];}else{if(_0x4acc28[_0x041e('0x18')][_0x5c6af8['uniqueid']]['type']===_0x041e('0xa9')&&_0x4acc28['blindTransfers'][_0x5c6af8['uniqueid']]){_0x4acc28[_0x041e('0x18')][_0x5c6af8['uniqueid']][_0x041e('0x38')]=[_0x4acc28[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]]['linkedid'],_0x4acc28[_0x041e('0x18')][_0x5c6af8['uniqueid']][_0x041e('0x3d')]=_0x4acc28[_0x041e('0x18')][_0x5c6af8['uniqueid']]['uniqueid']][0x0];delete _0x4acc28[_0x041e('0x1a')][_0x5c6af8[_0x041e('0x38')]];}}logger[_0x041e('0x3b')](_0x041e('0xaa'),_0x5c6af8['uniqueid'],util[_0x041e('0x32')](_0x4acc28['channels'][_0x5c6af8['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x041e('0xab'),_0x4acc28[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]]);delete _0x4acc28[_0x041e('0x18')][_0x5c6af8[_0x041e('0x38')]];});}}}catch(_0x9af89){logger[_0x041e('0x30')](_0x041e('0xac'),_0x5c6af8['uniqueid'],util['inspect'](_0x9af89,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x041e('0x34')]['syncAttendedTransfer']=function(_0x52a89a){try{if(this[_0x041e('0x36')](_0x52a89a)){logger[_0x041e('0x2d')](_0x041e('0xad'),_0x52a89a[_0x041e('0x38')],_0x52a89a[_0x041e('0xae')],_0x52a89a[_0x041e('0xaf')]);logger['debug'](_0x041e('0xb0'),_0x52a89a[_0x041e('0x38')],util[_0x041e('0x32')](_0x52a89a,{'showHidden':![],'depth':null}));if(this['channels'][_0x52a89a[_0x041e('0xb1')]]){this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb1')]][_0x041e('0xb2')]=_0x52a89a[_0x041e('0xae')];this['channels'][_0x52a89a[_0x041e('0xb1')]]['transferconnectedlinenum']=_0x52a89a[_0x041e('0xaf')];if(this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb3')]]){var _0x7f37d8=this[_0x041e('0x18')][_0x52a89a['secondtransfereruniqueid']];this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb3')]]=this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb1')]];this['channels'][_0x52a89a[_0x041e('0xb1')]]=_0x7f37d8;}}else if(this['channels'][_0x52a89a['transfertargetuniqueid']]){this[_0x041e('0x18')][_0x52a89a['transfertargetuniqueid']][_0x041e('0xb2')]=_0x52a89a[_0x041e('0xae')];this['channels'][_0x52a89a[_0x041e('0xb4')]][_0x041e('0xb5')]=_0x52a89a['transfertargetcalleridnum'];if(this[_0x041e('0x18')][_0x52a89a['origtransfereruniqueid']]){var _0x7f37d8=this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb6')]];this[_0x041e('0x18')][_0x52a89a['origtransfereruniqueid']]=this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb4')]];this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb4')]]=_0x7f37d8;}}if((this['channels'][_0x52a89a[_0x041e('0xb6')]]||this[_0x041e('0x18')][_0x52a89a['origtransfererlinkedid']])&&this[_0x041e('0x18')][_0x52a89a['secondtransfereruniqueid']]){var _0x2eabad=_[_0x041e('0xb7')]([this['channels'][_0x52a89a['origtransfereruniqueid']],this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb8')]],this['channels'][_0x52a89a[_0x041e('0xb3')]]],function(_0x216a5f){return _0x216a5f&&_0x216a5f[_0x041e('0x87')]===_0x041e('0xa9')&&_0x216a5f[_0x041e('0xb9')];});if(_0x2eabad){if(this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb6')]])this['channels'][_0x52a89a[_0x041e('0xb6')]][_0x041e('0xa0')]=_0x041e('0xba');if(this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb8')]])this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb8')]]['transferType']=_0x041e('0xba');this[_0x041e('0x18')][_0x52a89a[_0x041e('0xb3')]][_0x041e('0xa0')]=_0x041e('0xba');}}}}catch(_0x322d42){logger[_0x041e('0x30')](_0x041e('0xbb'),_0x52a89a['uniqueid'],util[_0x041e('0x32')](_0x322d42,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x041e('0x2a')]=function(_0x5a22b2){try{if(this[_0x041e('0x36')](_0x5a22b2)){logger[_0x041e('0x2d')](_0x041e('0xbc'),_0x5a22b2[_0x041e('0x38')],_0x5a22b2['transfereecalleridnum'],_0x5a22b2[_0x041e('0xbd')]);logger['debug'](_0x041e('0xbe'),_0x5a22b2[_0x041e('0x38')],util[_0x041e('0x32')](_0x5a22b2,{'showHidden':![],'depth':null}));if(this[_0x041e('0x18')][_0x5a22b2[_0x041e('0xb1')]]){this[_0x041e('0x18')][_0x5a22b2[_0x041e('0xb1')]][_0x041e('0xb2')]=_0x5a22b2[_0x041e('0xbf')];this[_0x041e('0x18')][_0x5a22b2[_0x041e('0xb1')]][_0x041e('0xb5')]=_0x5a22b2[_0x041e('0xbd')];this[_0x041e('0x18')][_0x5a22b2[_0x041e('0xb1')]][_0x041e('0xa0')]=_0x041e('0xc0');this['syncHangup']({'event':_0x041e('0xc1'),'uniqueid':_0x5a22b2[_0x041e('0xb1')],'context':_0x5a22b2[_0x041e('0x50')],'channel':_0x5a22b2[_0x041e('0xc2')]});}else{this[_0x041e('0x18')][_0x5a22b2['transfereruniqueid']][_0x041e('0xa0')]=_0x041e('0xc0');}}}catch(_0x121f2c){logger[_0x041e('0x30')](_0x041e('0xc3'),_0x5a22b2['uniqueid'],util[_0x041e('0x32')](_0x121f2c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x041e('0x34')]['syncMusicOnHoldStart']=function(_0x19e9f2){try{if(this[_0x041e('0x36')](_0x19e9f2)){logger[_0x041e('0x3b')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x19e9f2[_0x041e('0x38')],util['inspect'](_0x19e9f2,{'showHidden':![],'depth':null}));if(this[_0x041e('0x18')][_0x19e9f2[_0x041e('0x38')]]){if(!_[_0x041e('0xc4')](this['channels'][_0x19e9f2[_0x041e('0x38')]][_0x041e('0x6a')])){this[_0x041e('0x18')][_0x19e9f2[_0x041e('0x38')]]['mohstarttime']=moment()['format'](_0x041e('0x5f'));logger[_0x041e('0x2d')](_0x041e('0xc5'),_0x19e9f2['uniqueid'],this[_0x041e('0x18')][_0x19e9f2['uniqueid']][_0x041e('0xc6')]);}}}}catch(_0x33c34d){logger[_0x041e('0x30')](_0x041e('0xc7'),_0x19e9f2[_0x041e('0x38')],util['inspect'](_0x33c34d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x041e('0xc8')]=function(_0x4a9dd0){try{if(this['isNotNull'](_0x4a9dd0)){logger[_0x041e('0x3b')](_0x041e('0xc9'),_0x4a9dd0[_0x041e('0x38')],util[_0x041e('0x32')](_0x4a9dd0,{'showHidden':![],'depth':null}));if(this[_0x041e('0x18')][_0x4a9dd0['uniqueid']]){if(!_[_0x041e('0xc4')](this[_0x041e('0x18')][_0x4a9dd0[_0x041e('0x38')]][_0x041e('0xc6')])){this['channels'][_0x4a9dd0[_0x041e('0x38')]][_0x041e('0xca')]+=moment()['milliseconds'](0x0)[_0x041e('0x9a')](this[_0x041e('0x18')][_0x4a9dd0[_0x041e('0x38')]][_0x041e('0xc6')],'seconds');logger[_0x041e('0x2d')](_0x041e('0xcb'),_0x4a9dd0[_0x041e('0x38')],this['channels'][_0x4a9dd0[_0x041e('0x38')]]['mohtime']);delete this['channels'][_0x4a9dd0[_0x041e('0x38')]][_0x041e('0xc6')];}}}}catch(_0x11ae31){logger[_0x041e('0x30')](_0x041e('0xcc'),_0x4a9dd0[_0x041e('0x38')],util[_0x041e('0x32')](_0x11ae31,{'showHidden':![],'depth':null}));}};module[_0x041e('0xcd')]=VoiceCallReport; \ No newline at end of file +var _0x108a=['transfereruniqueid','BLIND','[%s][voiceCallReport][musiconholdstart]\x20event:','answertime','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','moment','util','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','queue','agi','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','inspect','linkedid','merge','pick','keys','context','from-sip','split','exten','xcally-motion-preview','channel','connectedlinenum','format','user:%s','name','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','channelstate','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','disposition','includes','lastapplication','lastdata','set','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','answered','holdtime','starttime','connectedlinename','destinationchannel','toNumber','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','resolve','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','syncBlindTransfer','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','transfererchannel'];(function(_0x67f01,_0x42ddab){var _0x44e6d2=function(_0x979be4){while(--_0x979be4){_0x67f01['push'](_0x67f01['shift']());}};_0x44e6d2(++_0x42ddab);}(_0x108a,0xd6));var _0xa108=function(_0x583b60,_0x32f412){_0x583b60=_0x583b60-0x0;var _0x503c47=_0x108a[_0x583b60];return _0x503c47;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0xa108('0x0'));var util=require(_0xa108('0x1'));var path=require('path');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xa108('0x2'))(_0xa108('0x3'));var ami=require(_0xa108('0x4'));var Channel=require(_0xa108('0x5'));var RpcSetting=require(_0xa108('0x6'));var statusDesc=[_0xa108('0x7'),_0xa108('0x8'),'inuse',_0xa108('0x9'),_0xa108('0xa'),_0xa108('0xb'),_0xa108('0xc'),_0xa108('0xd'),_0xa108('0xe')];var applications=['set',_0xa108('0xf'),_0xa108('0x10'),_0xa108('0x11'),'playback',_0xa108('0x12')];var dispositions=['NO\x20ANSWER',_0xa108('0x13'),_0xa108('0x13'),_0xa108('0x14'),'NO\x20ANSWER',_0xa108('0x14'),_0xa108('0x15'),'BUSY',_0xa108('0x13'),_0xa108('0x13'),_0xa108('0x13')];var actions={};config[_0xa108('0x16')]=_['defaults'](config[_0xa108('0x16')],{'host':'localhost','port':0x18eb});var io=require(_0xa108('0x17'))(new Redis(config[_0xa108('0x16')]));function VoiceCallReport(_0x4f8434){this['channels']=_0x4f8434[_0xa108('0x18')];this[_0xa108('0x19')]=_0x4f8434[_0xa108('0x19')];this[_0xa108('0x1a')]={};ami['on']('coreshowchannel',this[_0xa108('0x1b')][_0xa108('0x1c')](this));ami['on'](_0xa108('0x1d'),this[_0xa108('0x1b')][_0xa108('0x1c')](this));ami['on'](_0xa108('0x1e'),this['syncNewChannel'][_0xa108('0x1c')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on']('varset',this[_0xa108('0x1f')]['bind'](this));ami['on'](_0xa108('0x20'),this[_0xa108('0x21')]['bind'](this));ami['on']('newcallerid',this[_0xa108('0x22')][_0xa108('0x1c')](this));ami['on'](_0xa108('0x23'),this[_0xa108('0x24')]['bind'](this));ami['on'](_0xa108('0x25'),this['syncBlindTransfer'][_0xa108('0x1c')](this));ami['on'](_0xa108('0x26'),this[_0xa108('0x27')][_0xa108('0x1c')](this));ami['on'](_0xa108('0x28'),this[_0xa108('0x29')][_0xa108('0x1c')](this));try{logger[_0xa108('0x2a')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xa108('0x2b')]();}catch(_0x5ad480){logger[_0xa108('0x2c')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0x5ad480,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa108('0x2d')][_0xa108('0x2e')]=function(_0x5dc5f5){return _0x5dc5f5!==null&&!_[_0xa108('0x2f')](_0x5dc5f5);};VoiceCallReport[_0xa108('0x2d')]['emit']=function(_0x4bce9d,_0x444afc,_0xf09042){io['to'](_0x4bce9d)[_0xa108('0x30')](_0x444afc,_0xf09042);};VoiceCallReport[_0xa108('0x2d')][_0xa108('0x22')]=function(_0x369507){try{if(this[_0xa108('0x2e')](_0x369507)){logger[_0xa108('0x2a')](_0xa108('0x31'),_0x369507['uniqueid'],_0x369507[_0xa108('0x32')],_0x369507[_0xa108('0x33')]);logger[_0xa108('0x34')](_0xa108('0x35'),_0x369507[_0xa108('0x36')],util[_0xa108('0x37')](_0x369507,{'showHidden':![],'depth':null}));if(_0x369507[_0xa108('0x36')]===_0x369507[_0xa108('0x38')]){if(!_[_0xa108('0x2f')](this[_0xa108('0x18')][_0x369507[_0xa108('0x36')]])){_[_0xa108('0x39')](this['channels'][_0x369507[_0xa108('0x36')]],_[_0xa108('0x3a')](_0x369507,_[_0xa108('0x3b')](this[_0xa108('0x18')][_0x369507[_0xa108('0x36')]])));}}if(_0x369507[_0xa108('0x3c')]===_0xa108('0x3d')){if(this[_0xa108('0x19')][_0x369507['channel'][_0xa108('0x3e')]('-')[0x0]]){if(_0x369507[_0xa108('0x3f')]==_0xa108('0x40')){this[_0xa108('0x19')][_0x369507[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]]['destconnectedlinenum']=_0x369507[_0xa108('0x42')];this[_0xa108('0x30')](util[_0xa108('0x43')](_0xa108('0x44'),this[_0xa108('0x19')][_0x369507[_0xa108('0x41')]['split']('-')[0x0]][_0xa108('0x45')]),'user:agentconnect',{'destaccountcode':this[_0xa108('0x19')][_0x369507['channel'][_0xa108('0x3e')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x369507[_0xa108('0x42')]});}}}}}catch(_0x1126b0){logger[_0xa108('0x2c')](_0xa108('0x46'),_0x369507[_0xa108('0x36')],util[_0xa108('0x37')](_0x1126b0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x325a46){try{if(this[_0xa108('0x2e')](_0x325a46)){logger[_0xa108('0x34')]('[%s][voiceCallReport][newchannel]\x20event:',_0x325a46[_0xa108('0x36')],util['inspect'](_0x325a46,{'showHidden':![],'depth':null}));if(_0x325a46[_0xa108('0x36')]===_0x325a46[_0xa108('0x38')]&&_0x325a46[_0xa108('0x41')]!=_0xa108('0x47')){if(_[_0xa108('0x2f')](this[_0xa108('0x18')][_0x325a46[_0xa108('0x36')]])){logger[_0xa108('0x2a')](_0xa108('0x48'),_0x325a46['uniqueid'],_0x325a46[_0xa108('0x3c')],_0x325a46[_0xa108('0x3f')]);this[_0xa108('0x18')][_0x325a46['uniqueid']]=new Channel();this[_0xa108('0x18')][_0x325a46[_0xa108('0x36')]]['starttime']=moment()['format'](_0xa108('0x49'));this[_0xa108('0x18')][_0x325a46[_0xa108('0x36')]]['disposition']=dispositions[_['toNumber'](_0x325a46[_0xa108('0x4a')])];_['merge'](this[_0xa108('0x18')][_0x325a46[_0xa108('0x36')]],_[_0xa108('0x3a')](_0x325a46,_[_0xa108('0x3b')](this['channels'][_0x325a46['uniqueid']])));if(_0x325a46['context']===_0xa108('0x3d')){if(this[_0xa108('0x19')][_0x325a46[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]]){if(_['isUndefined'](this[_0xa108('0x19')][_0x325a46['channel'][_0xa108('0x3e')]('-')[0x0]][_0xa108('0x4b')])){this[_0xa108('0x19')][_0x325a46['channel']['split']('-')[0x0]][_0xa108('0x4b')]=_0x325a46['exten'];logger[_0xa108('0x34')](_0xa108('0x4c'),_0x325a46[_0xa108('0x36')],util[_0xa108('0x37')]({'destaccountcode':this['agents'][_0x325a46[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x325a46[_0xa108('0x3f')]},{'showHidden':![],'depth':null}));this[_0xa108('0x30')](util[_0xa108('0x43')](_0xa108('0x44'),this[_0xa108('0x19')][_0x325a46['channel']['split']('-')[0x0]][_0xa108('0x45')]),_0xa108('0x4d'),{'destaccountcode':this[_0xa108('0x19')][_0x325a46[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]][_0xa108('0x4e')],'destconnectedlinenum':_0x325a46[_0xa108('0x3f')]});}}}}}}}catch(_0x54110b){logger[_0xa108('0x2c')](_0xa108('0x4f'),_0x325a46[_0xa108('0x36')],util[_0xa108('0x37')](_0x54110b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa108('0x1b')]=function(_0xb9facf){try{if(this[_0xa108('0x2e')](_0xb9facf)){logger['debug'](_0xa108('0x50'),_0xb9facf[_0xa108('0x36')],util['inspect'](_0xb9facf,{'showHidden':![],'depth':null}));if(_0xb9facf[_0xa108('0x36')]===_0xb9facf['linkedid']&&_0xb9facf[_0xa108('0x3f')]!='h'&&_0xb9facf['channel']!=_0xa108('0x47')){_0xb9facf[_0xa108('0x51')]=_0xb9facf[_0xa108('0x51')][_0xa108('0x52')]();_0xb9facf[_0xa108('0x53')]=_0xb9facf[_0xa108('0x54')]&&_0xb9facf[_0xa108('0x54')][_0xa108('0x55')](_0xa108('0x56'))?_0xb9facf[_0xa108('0x54')]:(_0xb9facf[_0xa108('0x54')]||_0xb9facf['applicationdata'])['toLowerCase']();logger[_0xa108('0x2a')](_0xa108('0x57'),_0xb9facf[_0xa108('0x36')],_0xb9facf[_0xa108('0x51')],_0xb9facf[_0xa108('0x53')]);if(_[_0xa108('0x2f')](this[_0xa108('0x18')][_0xb9facf[_0xa108('0x36')]])){this[_0xa108('0x18')][_0xb9facf[_0xa108('0x36')]]=new Channel();this[_0xa108('0x18')][_0xb9facf[_0xa108('0x36')]]['starttime']=_0xb9facf[_0xa108('0x58')]?moment()['subtract'](moment[_0xa108('0x58')](_0xb9facf[_0xa108('0x58')])[_0xa108('0x59')](),_0xa108('0x59'))[_0xa108('0x43')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xa108('0x43')](_0xa108('0x49'));this['channels'][_0xb9facf[_0xa108('0x36')]][_0xa108('0x5a')]=_0xa108('0x14');}_[_0xa108('0x39')](this[_0xa108('0x18')][_0xb9facf[_0xa108('0x36')]],_[_0xa108('0x3a')](_0xb9facf,_[_0xa108('0x3b')](this['channels'][_0xb9facf['uniqueid']])));if(_[_0xa108('0x5b')](applications,_0xb9facf['application'])){this[_0xa108('0x18')][_0xb9facf[_0xa108('0x36')]][_0xa108('0x5c')]=_0xb9facf[_0xa108('0x51')];this['channels'][_0xb9facf['uniqueid']][_0xa108('0x5d')]=_0xb9facf[_0xa108('0x53')];if(_0xb9facf['application']===_0xa108('0x5e')&&_[_0xa108('0x55')](_0xb9facf['applicationdata'][_0xa108('0x52')](),_0xa108('0x5f'))){var _0x35b79f=_0xb9facf[_0xa108('0x53')][_0xa108('0x3e')]('=');var _0x327295=_0x35b79f[0x0][_0xa108('0x52')]()[_0xa108('0x60')](/cdr\((.*)\)/);if(_0x327295){this[_0xa108('0x18')][_0xb9facf['uniqueid']][_0x327295[0x1]]=_0x35b79f[0x1];}}else if(_0xb9facf['application']==='queue'){this[_0xa108('0x18')][_0xb9facf[_0xa108('0x36')]]['queue']=_0xb9facf[_0xa108('0x53')][_0xa108('0x3e')](',')[0x0];}}}}}catch(_0x50fbb2){logger['error'](_0xa108('0x61'),_0xb9facf[_0xa108('0x36')],util[_0xa108('0x37')](_0x50fbb2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa108('0x2d')][_0xa108('0x62')]=function(_0x379e77){try{if(this[_0xa108('0x2e')](_0x379e77)){logger[_0xa108('0x2a')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x379e77[_0xa108('0x36')],_0x379e77['linkedid'],_0x379e77['calleridname'],_0x379e77[_0xa108('0x33')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x379e77[_0xa108('0x36')],util[_0xa108('0x37')](_0x379e77,{'showHidden':![],'depth':null}));if(_0x379e77[_0xa108('0x36')]!==_0x379e77[_0xa108('0x38')]){if(this[_0xa108('0x18')][_0x379e77[_0xa108('0x38')]]){if(_0x379e77[_0xa108('0x4a')]==='6'){if(!this['channels'][_0x379e77[_0xa108('0x38')]][_0xa108('0x63')]){var _0x499a74=moment();this['channels'][_0x379e77[_0xa108('0x38')]]['answered']=!![];this['channels'][_0x379e77[_0xa108('0x38')]]['answertime']=_0x499a74[_0xa108('0x43')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x379e77['linkedid']]['starttime']){this[_0xa108('0x18')][_0x379e77[_0xa108('0x38')]][_0xa108('0x64')]=_0x499a74['diff'](this[_0xa108('0x18')][_0x379e77['linkedid']][_0xa108('0x65')],_0xa108('0x59'));}}this['channels'][_0x379e77[_0xa108('0x38')]][_0xa108('0x38')]=_0x379e77[_0xa108('0x36')];if(_0x379e77['calleridnum']!==_0xa108('0x40')){this[_0xa108('0x18')][_0x379e77[_0xa108('0x38')]][_0xa108('0x42')]=_0x379e77[_0xa108('0x33')];}this['channels'][_0x379e77[_0xa108('0x38')]][_0xa108('0x66')]=_0x379e77[_0xa108('0x32')];this[_0xa108('0x18')][_0x379e77['linkedid']][_0xa108('0x67')]=_0x379e77['channel'];this[_0xa108('0x18')][_0x379e77['linkedid']][_0xa108('0x5a')]=dispositions[_[_0xa108('0x68')](_0x379e77[_0xa108('0x4a')])];if(this['agents'][_0x379e77[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]]){this[_0xa108('0x18')][_0x379e77[_0xa108('0x38')]][_0xa108('0x69')]=this[_0xa108('0x19')][_0x379e77[_0xa108('0x41')]['split']('-')[0x0]]['id'];this[_0xa108('0x18')][_0x379e77[_0xa108('0x38')]][_0xa108('0x6a')]=this[_0xa108('0x19')][_0x379e77[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]][_0xa108('0x45')];}}}}else{if(this[_0xa108('0x18')][_0x379e77[_0xa108('0x36')]]){if(_0x379e77[_0xa108('0x4a')]==='6'){if(this['agents'][_0x379e77[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]]){this['channels'][_0x379e77[_0xa108('0x36')]]['UserId']=this[_0xa108('0x19')][_0x379e77[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]]['id'];this[_0xa108('0x18')][_0x379e77[_0xa108('0x36')]][_0xa108('0x6a')]=this[_0xa108('0x19')][_0x379e77[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]][_0xa108('0x45')];}}}}if(_0x379e77[_0xa108('0x4a')]==='6'&&_0x379e77['context']===_0xa108('0x3d')){if(this['agents'][_0x379e77['channel'][_0xa108('0x3e')]('-')[0x0]]){this['agents'][_0x379e77['channel'][_0xa108('0x3e')]('-')[0x0]]['destconnectedlinenum']=_0x379e77[_0xa108('0x3f')];var _0x163ce3;if(this['channels'][_0x379e77[_0xa108('0x36')]])_0x163ce3=this['channels'][_0x379e77[_0xa108('0x36')]][_0xa108('0x6b')];else if(this[_0xa108('0x18')][_0x379e77['linkedid']])_0x163ce3=this[_0xa108('0x18')][_0x379e77[_0xa108('0x38')]]['routealias'];logger[_0xa108('0x34')](_0xa108('0x6c'),_0x379e77[_0xa108('0x36')],util[_0xa108('0x37')]({'destaccountcode':this[_0xa108('0x19')][_0x379e77[_0xa108('0x41')]['split']('-')[0x0]][_0xa108('0x4e')],'destconnectedlinenum':_0x379e77['exten'],'routealias':_0x163ce3},{'showHidden':![],'depth':null}));this[_0xa108('0x30')](util[_0xa108('0x43')](_0xa108('0x44'),this[_0xa108('0x19')][_0x379e77[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]][_0xa108('0x45')]),_0xa108('0x4d'),{'destaccountcode':this['agents'][_0x379e77[_0xa108('0x41')]['split']('-')[0x0]][_0xa108('0x4e')],'destconnectedlinenum':_0x379e77[_0xa108('0x3f')],'routealias':_0x163ce3});}}}}catch(_0x5e6bbb){logger['error']('[%s][voiceCallReport][newstate]',_0x379e77['uniqueid'],util[_0xa108('0x37')](_0x5e6bbb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa108('0x2d')][_0xa108('0x6d')]=function(_0x200771,_0x477667){try{if(this['channels'][_0x200771]){logger['info'](_0xa108('0x6e'),_0x200771,_0x477667);this[_0xa108('0x18')][_0x200771][_0xa108('0x6f')]=!![];if(_[_0xa108('0x70')](_0x477667,'.wav49')){_0x477667=_0x477667['replace'](_0xa108('0x71'),_0xa108('0x72'));}this[_0xa108('0x18')][_0x200771][_0xa108('0x73')]=_0x477667;var _0x227905=_['find'](this['channels'][_0x200771][_0xa108('0x74')],{'filename':_0x477667});if(_[_0xa108('0x75')](_0x227905)){this[_0xa108('0x18')][_0x200771][_0xa108('0x74')]['push']({'filename':_0x477667,'createdAt':moment()[_0xa108('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xa108('0x76')});}}}catch(_0x54fa6e){logger['error'](_0xa108('0x77'),_0x200771,util[_0xa108('0x37')](_0x54fa6e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa108('0x2d')][_0xa108('0x1f')]=function(_0x58cd7d){try{if(this[_0xa108('0x2e')](_0x58cd7d)){logger[_0xa108('0x34')](_0xa108('0x78'),_0x58cd7d[_0xa108('0x36')],util['inspect'](_0x58cd7d,{'showHidden':![],'depth':null}));if(this[_0xa108('0x18')][_0x58cd7d[_0xa108('0x36')]]&&_0x58cd7d[_0xa108('0x41')]!=_0xa108('0x47')){if(this['isNotNull'](_0x58cd7d[_0xa108('0x79')])){if(this[_0xa108('0x2e')](_0x58cd7d['variable'][_0xa108('0x7a')])){logger[_0xa108('0x2a')](_0xa108('0x7b'),_0x58cd7d[_0xa108('0x36')],_0x58cd7d[_0xa108('0x7c')]);this[_0xa108('0x6d')](_0x58cd7d[_0xa108('0x36')],_0x58cd7d[_0xa108('0x7c')]);}else if(this[_0xa108('0x2e')](_0x58cd7d[_0xa108('0x79')][_0xa108('0x7d')])){logger[_0xa108('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x58cd7d[_0xa108('0x36')],_0x58cd7d[_0xa108('0x7c')]);this[_0xa108('0x18')][_0x58cd7d[_0xa108('0x36')]]['calleridnum']=_0x58cd7d[_0xa108('0x7c')];}else if(this[_0xa108('0x2e')](_0x58cd7d[_0xa108('0x79')]['xmd-callerid'])){logger[_0xa108('0x2a')](_0xa108('0x7e'),_0x58cd7d['uniqueid'],_0x58cd7d[_0xa108('0x7c')]);this[_0xa108('0x18')][_0x58cd7d['uniqueid']][_0xa108('0x7f')]=_0x58cd7d[_0xa108('0x7c')];}else if(this[_0xa108('0x2e')](_0x58cd7d[_0xa108('0x79')][_0xa108('0x80')])){logger[_0xa108('0x2a')](_0xa108('0x81'),_0x58cd7d[_0xa108('0x36')],_0x58cd7d[_0xa108('0x7c')]);this[_0xa108('0x18')][_0x58cd7d['uniqueid']][_0xa108('0x82')]=_0x58cd7d[_0xa108('0x7c')];}else if(this['isNotNull'](_0x58cd7d[_0xa108('0x79')][_0xa108('0x83')])){logger[_0xa108('0x2a')](_0xa108('0x84'),_0x58cd7d[_0xa108('0x36')],_0x58cd7d[_0xa108('0x7c')]['split'](',')[0x0]);this['channels'][_0x58cd7d[_0xa108('0x36')]][_0xa108('0xf')]=_0x58cd7d['value'][_0xa108('0x3e')](',')[0x0];}else if(this[_0xa108('0x2e')](_0x58cd7d[_0xa108('0x79')]['xmd-originatecalleridnum'])){logger[_0xa108('0x2a')](_0xa108('0x85'),_0x58cd7d['uniqueid'],_0x58cd7d[_0xa108('0x7c')]);this[_0xa108('0x18')][_0x58cd7d[_0xa108('0x36')]]['originatecalleridnum']=_0x58cd7d[_0xa108('0x7c')];}else if(this[_0xa108('0x2e')](_0x58cd7d[_0xa108('0x79')][_0xa108('0x86')])){logger[_0xa108('0x2a')](_0xa108('0x87'),_0x58cd7d['uniqueid'],_0x58cd7d[_0xa108('0x7c')]);this[_0xa108('0x18')][_0x58cd7d[_0xa108('0x36')]][_0xa108('0x88')]=_0x58cd7d[_0xa108('0x7c')];}else if(this[_0xa108('0x2e')](_0x58cd7d[_0xa108('0x79')][_0xa108('0x89')])){logger[_0xa108('0x2a')](_0xa108('0x8a'),_0x58cd7d[_0xa108('0x36')],_0x58cd7d['value']);this['channels'][_0x58cd7d[_0xa108('0x36')]]['calleridpreview']=_0x58cd7d['value'];}else if(this['isNotNull'](_0x58cd7d[_0xa108('0x79')][_0xa108('0x8b')])){logger[_0xa108('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x58cd7d[_0xa108('0x36')],_0x58cd7d['value']);this[_0xa108('0x18')][_0x58cd7d[_0xa108('0x36')]][_0xa108('0xf')]=_0x58cd7d[_0xa108('0x7c')];}else if(this['isNotNull'](_0x58cd7d[_0xa108('0x79')][_0xa108('0x8c')])){logger[_0xa108('0x2a')](_0xa108('0x8d'),_0x58cd7d[_0xa108('0x36')],_0x58cd7d['value']);this[_0xa108('0x18')][_0x58cd7d['uniqueid']][_0xa108('0x8e')]=_0x58cd7d[_0xa108('0x7c')];}}}else if(this['isNotNull'](_0x58cd7d[_0xa108('0x79')][_0xa108('0x7a')])){if(_0x58cd7d[_0xa108('0x7c')]){var _0x5c82a0=path[_0xa108('0x8f')](_0x58cd7d[_0xa108('0x7c')])[_0xa108('0x45')];logger[_0xa108('0x2a')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5c82a0,_0x58cd7d[_0xa108('0x7c')]);this[_0xa108('0x6d')](_0x5c82a0,_0x58cd7d[_0xa108('0x7c')]);}}else if(this[_0xa108('0x18')][_0x58cd7d[_0xa108('0x38')]]){if(this[_0xa108('0x2e')](_0x58cd7d[_0xa108('0x79')])){if(this[_0xa108('0x2e')](_0x58cd7d[_0xa108('0x79')][_0xa108('0x8c')])){logger[_0xa108('0x2a')](_0xa108('0x8d'),_0x58cd7d[_0xa108('0x38')],_0x58cd7d[_0xa108('0x7c')]);this['channels'][_0x58cd7d['linkedid']][_0xa108('0x90')]=_0x58cd7d['value'];}}}}}catch(_0xfa87fe){logger['error'](_0xa108('0x91'),_0x58cd7d[_0xa108('0x36')],util[_0xa108('0x37')](_0xfa87fe,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa108('0x21')]=function(_0x317bce){try{if(this[_0xa108('0x2e')](_0x317bce)){logger[_0xa108('0x34')](_0xa108('0x92'),_0x317bce[_0xa108('0x36')],util[_0xa108('0x37')](_0x317bce,{'showHidden':![],'depth':null}));if(this[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]]){logger[_0xa108('0x2a')](_0xa108('0x93'),_0x317bce[_0xa108('0x36')],_0x317bce[_0xa108('0x94')]);var _0x3d5d60=moment();this['channels'][_0x317bce['uniqueid']][_0xa108('0x95')]=_0x3d5d60[_0xa108('0x43')](_0xa108('0x49'));this[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x58')]=_0x3d5d60[_0xa108('0x96')](this[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x65')],'seconds');if(this[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x63')]){this[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x97')]=_0x3d5d60[_0xa108('0x96')](this[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]]['answertime'],_0xa108('0x59'));this[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x64')]=this[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x58')]-this[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x97')];}if(_0x317bce[_0xa108('0x3c')]===_0xa108('0x3d')){if(this['agents'][_0x317bce[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]]){this['agents'][_0x317bce[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]]=_[_0xa108('0x98')](this['agents'][_0x317bce[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]],[_0xa108('0x4b')]);logger[_0xa108('0x34')](_0xa108('0x99'),_0x317bce['uniqueid'],util[_0xa108('0x37')]({'id':this[_0xa108('0x19')][_0x317bce['channel'][_0xa108('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0xa108('0x19')][_0x317bce[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]][_0xa108('0x4e')]},{'showHidden':![],'depth':null}));this[_0xa108('0x30')](util['format'](_0xa108('0x44'),this[_0xa108('0x19')][_0x317bce[_0xa108('0x41')][_0xa108('0x3e')]('-')[0x0]][_0xa108('0x45')]),_0xa108('0x9a'),{'id':this[_0xa108('0x19')][_0x317bce['channel'][_0xa108('0x3e')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x317bce['channel'][_0xa108('0x3e')]('-')[0x0]]['accountcode']});}}var _0x5293a9=this;Promise['resolve']()[_0xa108('0x9b')](function(){var _0x2d8cde=_0x5293a9[_0xa108('0x18')][_0x317bce['uniqueid']];if(typeof _0x2d8cde[_0xa108('0x9c')]==='undefined')return;if(_[_0xa108('0x9d')](_0x2d8cde[_0xa108('0x74')]))return;return RpcSetting[_0xa108('0x9e')]()[_0xa108('0x9b')](function(_0x343a3c){if(!_0x343a3c[_0xa108('0x9f')])return;return Promise[_0xa108('0xa0')]()[_0xa108('0x9b')](function(){return ami[_0xa108('0xa1')]({'action':'StopMixMonitor','channel':_0x2d8cde[_0xa108('0x41')]})[_0xa108('0xa2')](function(){});})[_0xa108('0x9b')](function(){return ami[_0xa108('0xa1')]({'action':_0xa108('0xa3'),'channel':_0x2d8cde[_0xa108('0x67')]})[_0xa108('0xa2')](function(){})[_0xa108('0xa4')](function(){var _0x1df44c=_0x5293a9[_0xa108('0x19')][_0x2d8cde['destinationchannel']['split']('-')[0x0]];if(!_0x1df44c)return;io['emit'](_0xa108('0xa5'),{'agentId':_0x1df44c['id'],'uniqueid':_0x2d8cde[_0xa108('0x36')]});});});});})[_0xa108('0x9b')](function(){if(_0x317bce['event']===_0xa108('0xa6')){_0x5293a9[_0xa108('0x1a')][_0x317bce[_0xa108('0x36')]]=_0x5293a9[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]];}else{if(_0x5293a9[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x82')]===_0xa108('0xa7')&&_0x5293a9[_0xa108('0x1a')][_0x317bce[_0xa108('0x36')]]){_0x5293a9[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x36')]=[_0x5293a9[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x38')],_0x5293a9[_0xa108('0x18')][_0x317bce['uniqueid']][_0xa108('0x38')]=_0x5293a9[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]][_0xa108('0x36')]][0x0];delete _0x5293a9[_0xa108('0x1a')][_0x317bce[_0xa108('0x36')]];}}logger[_0xa108('0x34')](_0xa108('0xa8'),_0x317bce['uniqueid'],util[_0xa108('0x37')](_0x5293a9['channels'][_0x317bce['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xa108('0x30')](_0xa108('0xa9'),_0x5293a9[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]]);delete _0x5293a9[_0xa108('0x18')][_0x317bce[_0xa108('0x36')]];});}}}catch(_0x5a141b){logger['error'](_0xa108('0xaa'),_0x317bce['uniqueid'],util[_0xa108('0x37')](_0x5a141b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa108('0x24')]=function(_0x40d704){try{if(this['isNotNull'](_0x40d704)){logger['info'](_0xa108('0xab'),_0x40d704[_0xa108('0x36')],_0x40d704[_0xa108('0xac')],_0x40d704[_0xa108('0xad')]);logger[_0xa108('0x34')](_0xa108('0xae'),_0x40d704[_0xa108('0x36')],util['inspect'](_0x40d704,{'showHidden':![],'depth':null}));if(this[_0xa108('0x18')][_0x40d704[_0xa108('0xaf')]]){this[_0xa108('0x18')][_0x40d704[_0xa108('0xaf')]][_0xa108('0xb0')]=_0x40d704[_0xa108('0xac')];this['channels'][_0x40d704['transfereeuniqueid']][_0xa108('0xb1')]=_0x40d704[_0xa108('0xad')];if(this[_0xa108('0x18')][_0x40d704['secondtransfereruniqueid']]){var _0x39d573=this['channels'][_0x40d704['secondtransfereruniqueid']];this[_0xa108('0x18')][_0x40d704[_0xa108('0xb2')]]=this[_0xa108('0x18')][_0x40d704[_0xa108('0xaf')]];this[_0xa108('0x18')][_0x40d704[_0xa108('0xaf')]]=_0x39d573;}}else if(this[_0xa108('0x18')][_0x40d704[_0xa108('0xb3')]]){this[_0xa108('0x18')][_0x40d704[_0xa108('0xb3')]]['transfercalleridnum']=_0x40d704[_0xa108('0xac')];this[_0xa108('0x18')][_0x40d704[_0xa108('0xb3')]][_0xa108('0xb1')]=_0x40d704['transfertargetcalleridnum'];if(this[_0xa108('0x18')][_0x40d704[_0xa108('0xb4')]]){var _0x39d573=this[_0xa108('0x18')][_0x40d704[_0xa108('0xb4')]];this[_0xa108('0x18')][_0x40d704[_0xa108('0xb4')]]=this[_0xa108('0x18')][_0x40d704[_0xa108('0xb3')]];this[_0xa108('0x18')][_0x40d704['transfertargetuniqueid']]=_0x39d573;}}if((this[_0xa108('0x18')][_0x40d704[_0xa108('0xb4')]]||this[_0xa108('0x18')][_0x40d704[_0xa108('0xb5')]])&&this[_0xa108('0x18')][_0x40d704[_0xa108('0xb2')]]){var _0xbff822=_[_0xa108('0xb6')]([this[_0xa108('0x18')][_0x40d704[_0xa108('0xb4')]],this[_0xa108('0x18')][_0x40d704[_0xa108('0xb5')]],this[_0xa108('0x18')][_0x40d704[_0xa108('0xb2')]]],function(_0x1b6a39){return _0x1b6a39&&_0x1b6a39[_0xa108('0x82')]==='outbound'&&_0x1b6a39[_0xa108('0xb7')];});if(_0xbff822){if(this[_0xa108('0x18')][_0x40d704[_0xa108('0xb4')]])this[_0xa108('0x18')][_0x40d704[_0xa108('0xb4')]][_0xa108('0x9c')]='ATTENDED';if(this[_0xa108('0x18')][_0x40d704['origtransfererlinkedid']])this['channels'][_0x40d704[_0xa108('0xb5')]][_0xa108('0x9c')]=_0xa108('0xb8');this[_0xa108('0x18')][_0x40d704[_0xa108('0xb2')]][_0xa108('0x9c')]='ATTENDED';}}}}catch(_0x4e3592){logger[_0xa108('0x2c')]('[%s][voiceCallReport][attendedtransfer]',_0x40d704[_0xa108('0x36')],util[_0xa108('0x37')](_0x4e3592,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa108('0x2d')][_0xa108('0xb9')]=function(_0x16d6ae){try{if(this[_0xa108('0x2e')](_0x16d6ae)){logger[_0xa108('0x2a')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x16d6ae['uniqueid'],_0x16d6ae['transfereecalleridnum'],_0x16d6ae[_0xa108('0xba')]);logger[_0xa108('0x34')](_0xa108('0xbb'),_0x16d6ae[_0xa108('0x36')],util['inspect'](_0x16d6ae,{'showHidden':![],'depth':null}));if(this[_0xa108('0x18')][_0x16d6ae['transfereeuniqueid']]){this['channels'][_0x16d6ae[_0xa108('0xaf')]][_0xa108('0xb0')]=_0x16d6ae[_0xa108('0xbc')];this[_0xa108('0x18')][_0x16d6ae[_0xa108('0xaf')]][_0xa108('0xb1')]=_0x16d6ae[_0xa108('0xba')];this['channels'][_0x16d6ae[_0xa108('0xaf')]]['transferType']='BLIND';this['syncHangup']({'event':_0xa108('0xa6'),'uniqueid':_0x16d6ae[_0xa108('0xaf')],'context':_0x16d6ae[_0xa108('0x3c')],'channel':_0x16d6ae[_0xa108('0xbd')]});}else{this[_0xa108('0x18')][_0x16d6ae[_0xa108('0xbe')]]['transferType']=_0xa108('0xbf');}}}catch(_0x41a283){logger[_0xa108('0x2c')]('[%s][voiceCallReport][blindtransfer]',_0x16d6ae['uniqueid'],util[_0xa108('0x37')](_0x41a283,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa108('0x2d')]['syncMusicOnHoldStart']=function(_0x4422df){try{if(this[_0xa108('0x2e')](_0x4422df)){logger['debug'](_0xa108('0xc0'),_0x4422df[_0xa108('0x36')],util['inspect'](_0x4422df,{'showHidden':![],'depth':null}));if(this[_0xa108('0x18')][_0x4422df[_0xa108('0x36')]]){if(!_[_0xa108('0x75')](this['channels'][_0x4422df[_0xa108('0x36')]][_0xa108('0xc1')])){this[_0xa108('0x18')][_0x4422df[_0xa108('0x36')]][_0xa108('0xc2')]=moment()['format'](_0xa108('0x49'));logger[_0xa108('0x2a')](_0xa108('0xc3'),_0x4422df[_0xa108('0x36')],this['channels'][_0x4422df['uniqueid']]['mohstarttime']);}}}}catch(_0x17bce2){logger[_0xa108('0x2c')](_0xa108('0xc4'),_0x4422df[_0xa108('0x36')],util[_0xa108('0x37')](_0x17bce2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa108('0x2d')]['syncMusicOnHoldStop']=function(_0x1317bd){try{if(this[_0xa108('0x2e')](_0x1317bd)){logger[_0xa108('0x34')](_0xa108('0xc5'),_0x1317bd[_0xa108('0x36')],util['inspect'](_0x1317bd,{'showHidden':![],'depth':null}));if(this['channels'][_0x1317bd['uniqueid']]){if(!_[_0xa108('0x75')](this[_0xa108('0x18')][_0x1317bd[_0xa108('0x36')]][_0xa108('0xc2')])){this[_0xa108('0x18')][_0x1317bd['uniqueid']][_0xa108('0xc6')]+=moment()[_0xa108('0xc7')](0x0)['diff'](this['channels'][_0x1317bd['uniqueid']][_0xa108('0xc2')],_0xa108('0x59'));logger[_0xa108('0x2a')](_0xa108('0xc8'),_0x1317bd[_0xa108('0x36')],this[_0xa108('0x18')][_0x1317bd[_0xa108('0x36')]][_0xa108('0xc6')]);delete this[_0xa108('0x18')][_0x1317bd[_0xa108('0x36')]]['mohstarttime'];}}}}catch(_0x1dec24){logger[_0xa108('0x2c')]('[%s][voiceCallReport][musiconholdstop]',_0x1317bd[_0xa108('0x36')],util[_0xa108('0x37')](_0x1dec24,{'showHidden':![],'depth':null}));}};module[_0xa108('0xc9')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index f9c7c35..9c8fbf5 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdaed=['redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','bind','dialend','varset','syncNewExten','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','syncDialBegin','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','voice:outbound','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','dialstatus','connectedlinenum','connectedlinename','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','addVariable','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','diff','seconds','complete','holdtime','answertime','starttime','sumBillable','billableseconds','duration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','applicationdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','lodash','moment','util','../../../config/environment','../../../config/logger','ami','defaults'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0xdaed,0x1b1));var _0xddae=function(_0x228876,_0x3deaa9){_0x228876=_0x228876-0x0;var _0x21843d=_0xdaed[_0x228876];return _0x21843d;};'use strict';var _=require(_0xddae('0x0'));var moment=require(_0xddae('0x1'));var util=require(_0xddae('0x2'));var Redis=require('ioredis');var config=require(_0xddae('0x3'));var logger=require(_0xddae('0x4'))(_0xddae('0x5'));var ami=require('../ami');config['redis']=_[_0xddae('0x6')](config[_0xddae('0x7')],{'host':_0xddae('0x8'),'port':0x18eb});var io=require(_0xddae('0x9'))(new Redis(config[_0xddae('0x7')]));function VoiceDialReport(_0x1a936f){this[_0xddae('0xa')]=_0x1a936f[_0xddae('0xb')];this[_0xddae('0xc')]=_0x1a936f[_0xddae('0xc')];this[_0xddae('0xd')]={};this[_0xddae('0xe')]={};ami['on'](_0xddae('0xf'),this['syncDialBegin'][_0xddae('0x10')](this));ami['on'](_0xddae('0x11'),this['syncDialEnd'][_0xddae('0x10')](this));ami['on'](_0xddae('0x12'),this['syncVarSet'][_0xddae('0x10')](this));ami['on']('newexten',this[_0xddae('0x13')]['bind'](this));ami['on'](_0xddae('0x14'),this[_0xddae('0x15')][_0xddae('0x10')](this));}VoiceDialReport['prototype'][_0xddae('0x16')]=function(_0x426773){return _0x426773!==null&&!_[_0xddae('0x17')](_0x426773);};VoiceDialReport[_0xddae('0x18')]['emit']=function(_0x39469e,_0x16b556,_0x45be99){io['to'](_0x39469e)[_0xddae('0x19')](_0x16b556,_0x45be99);};VoiceDialReport['prototype'][_0xddae('0x1a')]=function(_0x3a381c){try{if(this[_0xddae('0x16')](_0x3a381c)){logger['debug'](_0xddae('0x1b'),_0x3a381c[_0xddae('0x1c')],util[_0xddae('0x1d')](_0x3a381c,{'showHidden':![],'depth':null}));if(this[_0xddae('0xa')][_0x3a381c[_0xddae('0x1c')]]){_['merge'](this[_0xddae('0xa')][_0x3a381c[_0xddae('0x1c')]],{'starttime':moment()[_0xddae('0x1e')](_0xddae('0x1f')),'lastevent':_0xddae('0x20'),'interface':_0x3a381c['channel'][_0xddae('0x21')](0x0,_0x3a381c[_0xddae('0x22')][_0xddae('0x23')]('-')),'membername':_0x3a381c[_0xddae('0x22')]['substring'](_0x3a381c['channel'][_0xddae('0x23')]('/')+0x1,_0x3a381c['channel'][_0xddae('0x23')]('-'))},_[_0xddae('0x24')](_0x3a381c,['event',_0xddae('0x25')]));logger[_0xddae('0x26')](_0xddae('0x27'),_0x3a381c['uniqueid'],this[_0xddae('0xa')][_0x3a381c[_0xddae('0x1c')]][_0xddae('0x28')],this[_0xddae('0xa')][_0x3a381c['uniqueid']][_0xddae('0x29')]);logger['debug'](_0xddae('0x2a'),_0x3a381c[_0xddae('0x1c')],util[_0xddae('0x1d')](this[_0xddae('0xa')][_0x3a381c['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0xddae('0xd')][_0x3a381c[_0xddae('0x1c')]])_[_0xddae('0x2b')](this[_0xddae('0xa')][_0x3a381c[_0xddae('0x1c')]],this[_0xddae('0xd')][_0x3a381c[_0xddae('0x1c')]]);this['emit'](_0xddae('0x2c'),'voice_outbound_channel:save',this[_0xddae('0xa')][_0x3a381c[_0xddae('0x1c')]]);logger[_0xddae('0x2d')](_0xddae('0x2e'),_0x3a381c[_0xddae('0x1c')],util[_0xddae('0x1d')](this[_0xddae('0xa')][_0x3a381c[_0xddae('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xddae('0x19')](_0xddae('0x2f'),this['channels'][_0x3a381c['uniqueid']]);}}}catch(_0x505741){logger[_0xddae('0x30')](_0xddae('0x31'),_0x3a381c[_0xddae('0x1c')],util[_0xddae('0x1d')](_0x505741,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xddae('0x32')]=function(_0x2d577a){try{if(this[_0xddae('0x16')](_0x2d577a)){logger[_0xddae('0x2d')]('[%s][voiceDialReport][dialend]\x20event:',_0x2d577a[_0xddae('0x1c')],util[_0xddae('0x1d')](_0x2d577a,{'showHidden':![],'depth':null}));if(this['channels'][_0x2d577a[_0xddae('0x1c')]]){this[_0xddae('0xa')][_0x2d577a[_0xddae('0x1c')]][_0xddae('0x33')]=_0x2d577a[_0xddae('0x33')];if(_0x2d577a[_0xddae('0x33')]==='ANSWER'){this['channels'][_0x2d577a[_0xddae('0x1c')]][_0xddae('0x34')]=_0x2d577a[_0xddae('0x34')];this['channels'][_0x2d577a[_0xddae('0x1c')]][_0xddae('0x35')]=_0x2d577a[_0xddae('0x35')];this[_0xddae('0xa')][_0x2d577a[_0xddae('0x1c')]]['answertime']=moment()[_0xddae('0x1e')](_0xddae('0x1f'));this[_0xddae('0xa')][_0x2d577a['uniqueid']][_0xddae('0x36')]=_0xddae('0x37');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x2d577a[_0xddae('0x1c')],_0x2d577a[_0xddae('0x22')]['substring'](_0x2d577a[_0xddae('0x22')][_0xddae('0x23')]('/')+0x1,_0x2d577a[_0xddae('0x22')]['lastIndexOf']('-')));logger[_0xddae('0x2d')](_0xddae('0x38'),_0x2d577a[_0xddae('0x1c')],util[_0xddae('0x1d')](this[_0xddae('0xa')][_0x2d577a[_0xddae('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xddae('0x39'),this[_0xddae('0xa')][_0x2d577a['uniqueid']]);}logger['debug'](_0xddae('0x3a'),_0x2d577a[_0xddae('0x1c')],util[_0xddae('0x1d')](this['channels'][_0x2d577a[_0xddae('0x1c')]],{'showHidden':![],'depth':null}));this[_0xddae('0x19')]('voice:outbound','voice_outbound_channel:save',this['channels'][_0x2d577a[_0xddae('0x1c')]]);}}}catch(_0x2a1d85){logger[_0xddae('0x30')](_0xddae('0x3b'),_0x2d577a[_0xddae('0x1c')],util[_0xddae('0x1d')](_0x2a1d85,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x1e9e08){try{if(this[_0xddae('0x16')](_0x1e9e08)){logger[_0xddae('0x2d')](_0xddae('0x3c'),_0x1e9e08['uniqueid'],util[_0xddae('0x1d')](_0x1e9e08,{'showHidden':![],'depth':null}));this['addVariable'](_0x1e9e08[_0xddae('0x1c')],_[_0xddae('0x3d')](_0x1e9e08[_0xddae('0x3e')])[0x0],_0x1e9e08['value']);if(this[_0xddae('0x16')](_0x1e9e08[_0xddae('0x3e')])&&this[_0xddae('0x16')](_0x1e9e08[_0xddae('0x3e')][_0xddae('0x3f')])){if(_[_0xddae('0x17')](this[_0xddae('0xa')][_0x1e9e08[_0xddae('0x1c')]])){this[_0xddae('0xa')][_0x1e9e08[_0xddae('0x1c')]]={'routeId':_0x1e9e08[_0xddae('0x40')],'variables':this[_0xddae('0xe')][_0x1e9e08[_0xddae('0x1c')]]};logger[_0xddae('0x26')](_0xddae('0x41'),_0x1e9e08[_0xddae('0x1c')],_0x1e9e08[_0xddae('0x3e')][_0xddae('0x3f')],_['keys'](_0x1e9e08[_0xddae('0x3e')])[0x0],_0x1e9e08[_0xddae('0x40')]);logger[_0xddae('0x2d')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1e9e08[_0xddae('0x1c')],util[_0xddae('0x1d')](this[_0xddae('0xa')][_0x1e9e08[_0xddae('0x1c')]],{'showHidden':![],'depth':null}));this[_0xddae('0x19')](_0xddae('0x2c'),'voice_outbound_channel:save',this[_0xddae('0xa')][_0x1e9e08[_0xddae('0x1c')]]);}}}}catch(_0x4ed72a){logger[_0xddae('0x30')](_0xddae('0x42'),_0x1e9e08[_0xddae('0x1c')],util[_0xddae('0x1d')](_0x4ed72a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xddae('0x18')][_0xddae('0x43')]=function(_0x4a8c7e,_0x114a41,_0x500c9a){var _0x4e17ab=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter',_0xddae('0x44'),_0xddae('0x45'),_0xddae('0x46'),'rtpaudioqosrtt',_0xddae('0x47'),_0xddae('0x48'),_0xddae('0x49'),'bridgepeer',_0xddae('0x4a'),_0xddae('0x4b'),_0xddae('0x4c'),_0xddae('0x4d'),'memberlastcall',_0xddae('0x28'),_0xddae('0x4e'),'memberrealtime'];if(!_['isNil'](_0x114a41)&&!_[_0xddae('0x4f')](_0x4e17ab,_0x114a41)){if(_[_0xddae('0x17')](this[_0xddae('0xe')][_0x4a8c7e])){this[_0xddae('0xe')][_0x4a8c7e]={};}this[_0xddae('0xe')][_0x4a8c7e][_0x114a41]=_0x500c9a;}};VoiceDialReport[_0xddae('0x18')]['syncHangup']=function(_0x641383){try{if(this[_0xddae('0x16')](_0x641383)){logger['debug'](_0xddae('0x50'),_0x641383[_0xddae('0x1c')],util[_0xddae('0x1d')](_0x641383,{'showHidden':![],'depth':null}));if(this['channels'][_0x641383[_0xddae('0x1c')]]){logger[_0xddae('0x26')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x641383[_0xddae('0x1c')],_0x641383[_0xddae('0x51')]);this['channels'][_0x641383['uniqueid']][_0xddae('0x52')]=moment()[_0xddae('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]]['duration']=moment(this[_0xddae('0xa')][_0x641383['uniqueid']][_0xddae('0x52')])[_0xddae('0x53')](this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]]['starttime'],_0xddae('0x54'));this['channels'][_0x641383[_0xddae('0x1c')]][_0xddae('0x36')]=_0xddae('0x55');this[_0xddae('0xc')]['total']+=0x1;if(this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]]['answertime']){this[_0xddae('0xc')]['answered']+=0x1;this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]][_0xddae('0x56')]=moment(this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]][_0xddae('0x57')])[_0xddae('0x53')](this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]][_0xddae('0x58')],'seconds');this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]]['billableseconds']=moment(this[_0xddae('0xa')][_0x641383['uniqueid']][_0xddae('0x52')])[_0xddae('0x53')](this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]][_0xddae('0x57')],_0xddae('0x54'));this[_0xddae('0xc')]['sumHoldTime']+=this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]][_0xddae('0x56')]||0x0;this['outbound'][_0xddae('0x59')]+=this[_0xddae('0xa')][_0x641383['uniqueid']][_0xddae('0x5a')];}this[_0xddae('0xc')]['sumDuration']+=this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]][_0xddae('0x5b')];logger[_0xddae('0x2d')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x641383[_0xddae('0x1c')],util['inspect'](this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xddae('0x19')](_0xddae('0x5c'),this[_0xddae('0xa')][_0x641383['uniqueid']]);logger[_0xddae('0x2d')](_0xddae('0x5d'),_0x641383[_0xddae('0x1c')],util[_0xddae('0x1d')](this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xddae('0x5e'),this[_0xddae('0xa')][_0x641383['uniqueid']]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x641383[_0xddae('0x1c')],util[_0xddae('0x1d')](this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0xddae('0x2c'),_0xddae('0x5f'),this[_0xddae('0xc')]);logger[_0xddae('0x26')](_0xddae('0x60'),JSON['stringify'](this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]]));logger[_0xddae('0x2d')](_0xddae('0x61'),_0x641383['uniqueid'],util[_0xddae('0x1d')](this['channels'][_0x641383[_0xddae('0x1c')]],{'showHidden':![],'depth':null}));this[_0xddae('0x19')]('voice:outbound','voice_outbound_channel:remove',this['channels'][_0x641383[_0xddae('0x1c')]]);delete this[_0xddae('0xa')][_0x641383[_0xddae('0x1c')]];}else if(this['channels'][_0x641383['linkedid']]){this[_0xddae('0xa')][_0x641383[_0xddae('0x62')]]['uniqueid']=this['channels'][_0x641383[_0xddae('0x62')]][_0xddae('0x63')];}if(this[_0xddae('0xe')][_0x641383[_0xddae('0x1c')]]){delete this[_0xddae('0xe')][_0x641383[_0xddae('0x1c')]];}}}catch(_0x17ede4){logger['error'](_0xddae('0x64'),_0x641383[_0xddae('0x1c')],util[_0xddae('0x1d')](_0x17ede4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xddae('0x18')][_0xddae('0x13')]=function(_0xe85626){try{if(this[_0xddae('0x16')](_0xe85626)){logger[_0xddae('0x2d')](_0xddae('0x65'),_0xe85626[_0xddae('0x1c')],util[_0xddae('0x1d')](_0xe85626,{'showHidden':![],'depth':null}));if(_0xe85626[_0xddae('0x66')]['toLowerCase']()==='set'){_0xe85626[_0xddae('0x67')]=(_0xe85626['appdata']||_0xe85626[_0xddae('0x67')])['toLowerCase']();if(_[_0xddae('0x68')](_0xe85626['applicationdata'],_0xddae('0x69'))){if(_['isUndefined'](this['applications'][_0xe85626['uniqueid']]))this[_0xddae('0xd')][_0xe85626[_0xddae('0x1c')]]={};logger[_0xddae('0x26')](_0xddae('0x6a'),_0xe85626[_0xddae('0x1c')],_0xe85626[_0xddae('0x66')],_0xe85626['applicationdata']);var _0x33f6b7=_0xe85626[_0xddae('0x67')][_0xddae('0x6b')]('=');var _0x3aac0a=_0x33f6b7[0x0][_0xddae('0x6c')](/cdr\((.*)\)/);if(_0x3aac0a)this[_0xddae('0xd')][_0xe85626[_0xddae('0x1c')]][_0x3aac0a[0x1]]=_0x33f6b7[0x1];}}}}catch(_0x4cce23){logger[_0xddae('0x30')](_0xddae('0x6d'),_0xe85626[_0xddae('0x1c')],util['inspect'](_0x4cce23,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xefc3=['addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','cause-txt','duration','endtime','starttime','seconds','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','[%s][voiceDialReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','applications','variables','syncDialEnd','bind','newexten','syncNewExten','syncHangup','prototype','isNotNull','emit','syncDialBegin','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','membername','interface','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','value','variable','outboundrouteid','isUndefined','[%s][voiceDialReport][varset]'];(function(_0xc79d1d,_0x5ac66e){var _0x4249c9=function(_0x1692a8){while(--_0x1692a8){_0xc79d1d['push'](_0xc79d1d['shift']());}};_0x4249c9(++_0x5ac66e);}(_0xefc3,0x107));var _0x3efc=function(_0x29f417,_0x396585){_0x29f417=_0x29f417-0x0;var _0x3c5b3a=_0xefc3[_0x29f417];return _0x3c5b3a;};'use strict';var _=require('lodash');var moment=require(_0x3efc('0x0'));var util=require(_0x3efc('0x1'));var Redis=require(_0x3efc('0x2'));var config=require(_0x3efc('0x3'));var logger=require(_0x3efc('0x4'))(_0x3efc('0x5'));var ami=require(_0x3efc('0x6'));config[_0x3efc('0x7')]=_[_0x3efc('0x8')](config[_0x3efc('0x7')],{'host':_0x3efc('0x9'),'port':0x18eb});var io=require(_0x3efc('0xa'))(new Redis(config['redis']));function VoiceDialReport(_0x4b21b9){this[_0x3efc('0xb')]=_0x4b21b9['outboundChannels'];this[_0x3efc('0xc')]=_0x4b21b9[_0x3efc('0xc')];this[_0x3efc('0xd')]={};this[_0x3efc('0xe')]={};ami['on']('dialbegin',this['syncDialBegin']['bind'](this));ami['on']('dialend',this[_0x3efc('0xf')][_0x3efc('0x10')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x3efc('0x11'),this[_0x3efc('0x12')][_0x3efc('0x10')](this));ami['on']('hangup',this[_0x3efc('0x13')]['bind'](this));}VoiceDialReport[_0x3efc('0x14')][_0x3efc('0x15')]=function(_0x16708c){return _0x16708c!==null&&!_['isUndefined'](_0x16708c);};VoiceDialReport['prototype'][_0x3efc('0x16')]=function(_0x4a2d76,_0x47bfc6,_0x30a9f8){io['to'](_0x4a2d76)[_0x3efc('0x16')](_0x47bfc6,_0x30a9f8);};VoiceDialReport[_0x3efc('0x14')][_0x3efc('0x17')]=function(_0xfef84a){try{if(this[_0x3efc('0x15')](_0xfef84a)){logger[_0x3efc('0x18')](_0x3efc('0x19'),_0xfef84a[_0x3efc('0x1a')],util[_0x3efc('0x1b')](_0xfef84a,{'showHidden':![],'depth':null}));if(this[_0x3efc('0xb')][_0xfef84a[_0x3efc('0x1a')]]){_[_0x3efc('0x1c')](this[_0x3efc('0xb')][_0xfef84a[_0x3efc('0x1a')]],{'starttime':moment()[_0x3efc('0x1d')](_0x3efc('0x1e')),'lastevent':_0x3efc('0x1f'),'interface':_0xfef84a[_0x3efc('0x20')]['substring'](0x0,_0xfef84a[_0x3efc('0x20')]['lastIndexOf']('-')),'membername':_0xfef84a[_0x3efc('0x20')][_0x3efc('0x21')](_0xfef84a['channel'][_0x3efc('0x22')]('/')+0x1,_0xfef84a[_0x3efc('0x20')][_0x3efc('0x22')]('-'))},_[_0x3efc('0x23')](_0xfef84a,[_0x3efc('0x24'),_0x3efc('0x25')]));logger[_0x3efc('0x26')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0xfef84a[_0x3efc('0x1a')],this[_0x3efc('0xb')][_0xfef84a[_0x3efc('0x1a')]][_0x3efc('0x27')],this[_0x3efc('0xb')][_0xfef84a[_0x3efc('0x1a')]][_0x3efc('0x28')]);logger[_0x3efc('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0xfef84a[_0x3efc('0x1a')],util[_0x3efc('0x1b')](this[_0x3efc('0xb')][_0xfef84a[_0x3efc('0x1a')]],{'showHidden':![],'depth':null}));if(this['applications'][_0xfef84a[_0x3efc('0x1a')]])_[_0x3efc('0x1c')](this[_0x3efc('0xb')][_0xfef84a[_0x3efc('0x1a')]],this['applications'][_0xfef84a[_0x3efc('0x1a')]]);this['emit'](_0x3efc('0x29'),'voice_outbound_channel:save',this[_0x3efc('0xb')][_0xfef84a[_0x3efc('0x1a')]]);logger['debug'](_0x3efc('0x2a'),_0xfef84a[_0x3efc('0x1a')],util[_0x3efc('0x1b')](this[_0x3efc('0xb')][_0xfef84a['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialbegin',this[_0x3efc('0xb')][_0xfef84a[_0x3efc('0x1a')]]);}}}catch(_0x2cce81){logger[_0x3efc('0x2b')]('[%s][voiceDialReport][dialbegin]',_0xfef84a[_0x3efc('0x1a')],util['inspect'](_0x2cce81,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3efc('0x14')]['syncDialEnd']=function(_0x4cc265){try{if(this[_0x3efc('0x15')](_0x4cc265)){logger[_0x3efc('0x18')](_0x3efc('0x2c'),_0x4cc265[_0x3efc('0x1a')],util[_0x3efc('0x1b')](_0x4cc265,{'showHidden':![],'depth':null}));if(this[_0x3efc('0xb')][_0x4cc265[_0x3efc('0x1a')]]){this['channels'][_0x4cc265[_0x3efc('0x1a')]]['dialstatus']=_0x4cc265['dialstatus'];if(_0x4cc265[_0x3efc('0x2d')]===_0x3efc('0x2e')){this['channels'][_0x4cc265[_0x3efc('0x1a')]][_0x3efc('0x2f')]=_0x4cc265['connectedlinenum'];this[_0x3efc('0xb')][_0x4cc265[_0x3efc('0x1a')]][_0x3efc('0x30')]=_0x4cc265[_0x3efc('0x30')];this[_0x3efc('0xb')][_0x4cc265[_0x3efc('0x1a')]][_0x3efc('0x31')]=moment()[_0x3efc('0x1d')](_0x3efc('0x1e'));this[_0x3efc('0xb')][_0x4cc265['uniqueid']][_0x3efc('0x32')]=_0x3efc('0x33');logger[_0x3efc('0x26')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x4cc265[_0x3efc('0x1a')],_0x4cc265[_0x3efc('0x20')][_0x3efc('0x21')](_0x4cc265[_0x3efc('0x20')][_0x3efc('0x22')]('/')+0x1,_0x4cc265[_0x3efc('0x20')][_0x3efc('0x22')]('-')));logger[_0x3efc('0x18')](_0x3efc('0x34'),_0x4cc265[_0x3efc('0x1a')],util[_0x3efc('0x1b')](this['channels'][_0x4cc265[_0x3efc('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3efc('0x16')](_0x3efc('0x35'),this['channels'][_0x4cc265[_0x3efc('0x1a')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4cc265['uniqueid'],util['inspect'](this['channels'][_0x4cc265['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x3efc('0x29'),_0x3efc('0x36'),this['channels'][_0x4cc265['uniqueid']]);}}}catch(_0x21c33e){logger['error'](_0x3efc('0x37'),_0x4cc265[_0x3efc('0x1a')],util[_0x3efc('0x1b')](_0x21c33e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3efc('0x14')][_0x3efc('0x38')]=function(_0xe7845a){try{if(this[_0x3efc('0x15')](_0xe7845a)){logger[_0x3efc('0x18')](_0x3efc('0x39'),_0xe7845a[_0x3efc('0x1a')],util[_0x3efc('0x1b')](_0xe7845a,{'showHidden':![],'depth':null}));this['addVariable'](_0xe7845a[_0x3efc('0x1a')],_[_0x3efc('0x3a')](_0xe7845a['variable'])[0x0],_0xe7845a[_0x3efc('0x3b')]);if(this[_0x3efc('0x15')](_0xe7845a[_0x3efc('0x3c')])&&this[_0x3efc('0x15')](_0xe7845a[_0x3efc('0x3c')][_0x3efc('0x3d')])){if(_[_0x3efc('0x3e')](this[_0x3efc('0xb')][_0xe7845a[_0x3efc('0x1a')]])){this[_0x3efc('0xb')][_0xe7845a[_0x3efc('0x1a')]]={'routeId':_0xe7845a['value'],'variables':this[_0x3efc('0xe')][_0xe7845a['uniqueid']]};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0xe7845a[_0x3efc('0x1a')],_0xe7845a[_0x3efc('0x3c')][_0x3efc('0x3d')],_['keys'](_0xe7845a[_0x3efc('0x3c')])[0x0],_0xe7845a[_0x3efc('0x3b')]);logger[_0x3efc('0x18')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0xe7845a[_0x3efc('0x1a')],util[_0x3efc('0x1b')](this[_0x3efc('0xb')][_0xe7845a[_0x3efc('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3efc('0x16')](_0x3efc('0x29'),_0x3efc('0x36'),this['channels'][_0xe7845a[_0x3efc('0x1a')]]);}}}}catch(_0x3eec99){logger[_0x3efc('0x2b')](_0x3efc('0x3f'),_0xe7845a[_0x3efc('0x1a')],util[_0x3efc('0x1b')](_0x3eec99,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3efc('0x14')][_0x3efc('0x40')]=function(_0x105edb,_0x3aac19,_0x1d2086){var _0x319da2=[_0x3efc('0x41'),'rtpaudioqosbridged',_0x3efc('0x42'),_0x3efc('0x43'),_0x3efc('0x44'),_0x3efc('0x45'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0x3efc('0x46'),'bridgepeer','bridgepvtcallid',_0x3efc('0x47'),_0x3efc('0x48'),_0x3efc('0x49'),_0x3efc('0x4a'),'membername',_0x3efc('0x4b'),_0x3efc('0x4c')];if(!_[_0x3efc('0x4d')](_0x3aac19)&&!_[_0x3efc('0x4e')](_0x319da2,_0x3aac19)){if(_[_0x3efc('0x3e')](this[_0x3efc('0xe')][_0x105edb])){this[_0x3efc('0xe')][_0x105edb]={};}this[_0x3efc('0xe')][_0x105edb][_0x3aac19]=_0x1d2086;}};VoiceDialReport['prototype'][_0x3efc('0x13')]=function(_0x5c834e){try{if(this[_0x3efc('0x15')](_0x5c834e)){logger[_0x3efc('0x18')]('[%s][voiceDialReport][hangup]\x20event:',_0x5c834e[_0x3efc('0x1a')],util[_0x3efc('0x1b')](_0x5c834e,{'showHidden':![],'depth':null}));if(this['channels'][_0x5c834e[_0x3efc('0x1a')]]){logger[_0x3efc('0x26')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x5c834e[_0x3efc('0x1a')],_0x5c834e[_0x3efc('0x4f')]);this['channels'][_0x5c834e[_0x3efc('0x1a')]]['endtime']=moment()[_0x3efc('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5c834e[_0x3efc('0x1a')]][_0x3efc('0x50')]=moment(this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]][_0x3efc('0x51')])['diff'](this[_0x3efc('0xb')][_0x5c834e['uniqueid']][_0x3efc('0x52')],_0x3efc('0x53'));this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]][_0x3efc('0x32')]=_0x3efc('0x54');this[_0x3efc('0xc')][_0x3efc('0x55')]+=0x1;if(this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]][_0x3efc('0x31')]){this[_0x3efc('0xc')][_0x3efc('0x56')]+=0x1;this[_0x3efc('0xb')][_0x5c834e['uniqueid']][_0x3efc('0x57')]=moment(this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]][_0x3efc('0x31')])['diff'](this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]]['starttime'],_0x3efc('0x53'));this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]][_0x3efc('0x58')]=moment(this['channels'][_0x5c834e[_0x3efc('0x1a')]]['endtime'])['diff'](this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]][_0x3efc('0x31')],_0x3efc('0x53'));this['outbound'][_0x3efc('0x59')]+=this[_0x3efc('0xb')][_0x5c834e['uniqueid']][_0x3efc('0x57')]||0x0;this[_0x3efc('0xc')][_0x3efc('0x5a')]+=this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]][_0x3efc('0x58')];}this[_0x3efc('0xc')][_0x3efc('0x5b')]+=this['channels'][_0x5c834e[_0x3efc('0x1a')]][_0x3efc('0x50')];logger[_0x3efc('0x18')](_0x3efc('0x5c'),_0x5c834e[_0x3efc('0x1a')],util[_0x3efc('0x1b')](this['channels'][_0x5c834e[_0x3efc('0x1a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]]);logger[_0x3efc('0x18')](_0x3efc('0x5d'),_0x5c834e[_0x3efc('0x1a')],util[_0x3efc('0x1b')](this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3efc('0x16')](_0x3efc('0x5e'),this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]]);logger[_0x3efc('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x5c834e[_0x3efc('0x1a')],util['inspect'](this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3efc('0x16')](_0x3efc('0x29'),'voice_outbound:save',this[_0x3efc('0xc')]);logger[_0x3efc('0x26')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]]));logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x5c834e[_0x3efc('0x1a')],util[_0x3efc('0x1b')](this[_0x3efc('0xb')][_0x5c834e['uniqueid']],{'showHidden':![],'depth':null}));this[_0x3efc('0x16')](_0x3efc('0x29'),_0x3efc('0x5f'),this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x1a')]]);delete this[_0x3efc('0xb')][_0x5c834e['uniqueid']];}else if(this['channels'][_0x5c834e['linkedid']]){this['channels'][_0x5c834e['linkedid']][_0x3efc('0x1a')]=this[_0x3efc('0xb')][_0x5c834e[_0x3efc('0x60')]][_0x3efc('0x61')];}if(this['variables'][_0x5c834e[_0x3efc('0x1a')]]){delete this[_0x3efc('0xe')][_0x5c834e[_0x3efc('0x1a')]];}}}catch(_0x3cb2a5){logger[_0x3efc('0x2b')]('[%s][voiceDialReport][hangup]',_0x5c834e[_0x3efc('0x1a')],util[_0x3efc('0x1b')](_0x3cb2a5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3efc('0x14')]['syncNewExten']=function(_0x1eb972){try{if(this[_0x3efc('0x15')](_0x1eb972)){logger[_0x3efc('0x18')](_0x3efc('0x62'),_0x1eb972[_0x3efc('0x1a')],util['inspect'](_0x1eb972,{'showHidden':![],'depth':null}));if(_0x1eb972[_0x3efc('0x63')][_0x3efc('0x64')]()===_0x3efc('0x65')){_0x1eb972[_0x3efc('0x66')]=(_0x1eb972[_0x3efc('0x67')]||_0x1eb972[_0x3efc('0x66')])[_0x3efc('0x64')]();if(_[_0x3efc('0x68')](_0x1eb972[_0x3efc('0x66')],_0x3efc('0x69'))){if(_[_0x3efc('0x3e')](this['applications'][_0x1eb972[_0x3efc('0x1a')]]))this[_0x3efc('0xd')][_0x1eb972[_0x3efc('0x1a')]]={};logger[_0x3efc('0x26')](_0x3efc('0x6a'),_0x1eb972[_0x3efc('0x1a')],_0x1eb972[_0x3efc('0x63')],_0x1eb972['applicationdata']);var _0x297076=_0x1eb972[_0x3efc('0x66')]['split']('=');var _0x695cfb=_0x297076[0x0]['match'](/cdr\((.*)\)/);if(_0x695cfb)this[_0x3efc('0xd')][_0x1eb972['uniqueid']][_0x695cfb[0x1]]=_0x297076[0x1];}}}}catch(_0x466220){logger['error'](_0x3efc('0x6b'),_0x1eb972[_0x3efc('0x1a')],util['inspect'](_0x466220,{'showHidden':![],'depth':null}));}};module[_0x3efc('0x6c')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index c435bbe..10824ae 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcee0=['exports','lodash','moment','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','channels','switch','Action','status','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','inbound','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','type','abandoned','Trunk','active','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queue','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','uniqueid','queuecallerjoinAt','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','queuecallercomplete','queuecallercompleteAt','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','emitVoiceQueueChannelRemove','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','last','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','holdtime','queuecallerexit','queuecallerexitAt','transfer','reason','startsWith','channel','toLowerCase','local/','linkedid','add','seconds','queuecallerexitreason','FORWARDTRANSFER','transfertype','FORWARD','transferexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','value','variable','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','isNil','includes','syncHangup','[%s][voiceQueueReport][hangup]','length','diff','total','answered','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','transfereeuniqueid','secondtransfererexten','transferuniqueid','ATTENDEDTRANSFER','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcee0,0x1e1));var _0x0cee=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xcee0[_0x10291b];return _0x1d5fbe;};'use strict';var _=require(_0x0cee('0x0'));var moment=require(_0x0cee('0x1'));var util=require(_0x0cee('0x2'));var md5=require(_0x0cee('0x3'));var Redis=require(_0x0cee('0x4'));var config=require(_0x0cee('0x5'));var logger=require(_0x0cee('0x6'))(_0x0cee('0x7'));var ami=require(_0x0cee('0x8'));var QueueReport=require('../model/queueReport');config[_0x0cee('0x9')]=_[_0x0cee('0xa')](config[_0x0cee('0x9')],{'host':_0x0cee('0xb'),'port':0x18eb});var io=require(_0x0cee('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x0cee('0xd')][_0x0cee('0xe')]=function(_0x34854d){this[_0x0cee('0xf')]=this[_0x0cee('0xf')]?this[_0x0cee('0xf')][_0x0cee('0x10')](_0x34854d):_0x34854d();};function VoiceQueueReport(_0x1a57fd){this[_0x0cee('0x11')]=new Sequence();this[_0x0cee('0x12')]={};this[_0x0cee('0x13')]=_0x1a57fd[_0x0cee('0x13')];this['channels']=_0x1a57fd[_0x0cee('0x14')];this[_0x0cee('0x15')]=_0x1a57fd[_0x0cee('0x15')];this[_0x0cee('0x16')]=!![];this[_0x0cee('0x17')]=_0x1a57fd[_0x0cee('0x17')];this[_0x0cee('0x18')]={};ami['on'](_0x0cee('0x19'),this['syncQueueSummary'][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x1b'),this[_0x0cee('0x1c')][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x1d'),this[_0x0cee('0x1e')][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x1f'),this['syncQueueCallerAbandon'][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x20'),this[_0x0cee('0x21')][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x22'),this[_0x0cee('0x23')][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x24'),this[_0x0cee('0x25')]['bind'](this));ami['on'](_0x0cee('0x26'),this['syncVarSet'][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x27'),this['syncHangup'][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x28'),this[_0x0cee('0x29')][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x2a'),this[_0x0cee('0x2b')][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x2c'),this[_0x0cee('0x2d')][_0x0cee('0x1a')](this));ami['on'](_0x0cee('0x2e'),this[_0x0cee('0x2f')][_0x0cee('0x1a')](this));ami['on']('attendedtransfer',this[_0x0cee('0x30')][_0x0cee('0x1a')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x0cee('0x1a')](this));this[_0x0cee('0x31')]();this[_0x0cee('0x32')]();}function clearChannels(_0x4d895f){if(!_[_0x0cee('0x33')](_0x4d895f)){for(var _0x3e4bca in _0x4d895f){if(_0x4d895f[_0x0cee('0x34')](_0x3e4bca)){delete _0x4d895f[_0x3e4bca];}}}}function clearCampaigns(_0x3bfea8){if(!_[_0x0cee('0x33')](_0x3bfea8)){for(var _0x27e266 in _0x3bfea8){if(_0x3bfea8[_0x0cee('0x34')](_0x27e266)){_0x3bfea8[_0x27e266][_0x0cee('0x35')]=0x0;}}}}function clearVoiceQueues(_0x260349){if(!_['isEmpty'](_0x260349)){for(var _0x3ceaf4 in _0x260349){if(_0x260349[_0x0cee('0x34')](_0x3ceaf4)){_0x260349[_0x3ceaf4]['originated']=0x0;_0x260349[_0x3ceaf4][_0x0cee('0x36')]=0x0;_0x260349[_0x3ceaf4][_0x0cee('0x37')]=0x0;_0x260349[_0x3ceaf4][_0x0cee('0x38')]=0x0;_0x260349[_0x3ceaf4][_0x0cee('0x39')]=!![];}}}}function clearAgentBooked(_0x5d69e2){if(!_[_0x0cee('0x33')](_0x5d69e2)){for(var _0xef2dcd in _0x5d69e2){if(_0x5d69e2[_0x0cee('0x34')](_0xef2dcd)){_0x5d69e2[_0xef2dcd][_0x0cee('0x3a')]=!![];}}}}VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x3b')]=function(){var _0x54a5b5=this;for(var _0x5b836a in this[_0x0cee('0x3c')]){if(this['channels']['hasOwnProperty'](_0x5b836a)&&!this['channels'][_0x5b836a][_0x0cee('0x3d')]){this[_0x0cee('0x11')]['enqueue'](function(){if(!_['isNil'](_0x54a5b5[_0x0cee('0x3c')][_0x5b836a])){return ami[_0x0cee('0x3e')]({'action':_0x0cee('0x3f'),'channel':_0x54a5b5[_0x0cee('0x3c')][_0x5b836a]['channel']})[_0x0cee('0x40')](function(_0x4b25ed){if(_0x4b25ed[_0x0cee('0x41')]===_0x0cee('0x42')){setTimeout(function(){if(_0x54a5b5['channels'][_0x5b836a]){delete _0x54a5b5[_0x0cee('0x3c')][_0x5b836a];logger[_0x0cee('0x43')]('[%s][voiceQueueReport][checkChannel]',_0x5b836a,util[_0x0cee('0x44')](_0x4b25ed,{'showHidden':![],'depth':null}));}if(_0x54a5b5[_0x0cee('0x12')][_0x5b836a]){delete _0x54a5b5[_0x0cee('0x12')][_0x5b836a];logger[_0x0cee('0x43')]('[%s][voiceQueueReport][checkQueueReport]',_0x5b836a,util[_0x0cee('0x44')](_0x4b25ed,{'showHidden':![],'depth':null}));}if(_0x54a5b5[_0x0cee('0x18')][_0x5b836a]){delete _0x54a5b5[_0x0cee('0x18')][_0x5b836a];logger[_0x0cee('0x43')](_0x0cee('0x45'),_0x5b836a,util[_0x0cee('0x44')](_0x4b25ed,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger['error'](_0x0cee('0x46'));clearChannels(this[_0x0cee('0x3c')]);this[_0x0cee('0x47')](this[_0x0cee('0x12')]);clearAgentBooked(this[_0x0cee('0x13')]);clearVoiceQueues(this[_0x0cee('0x15')]);clearCampaigns(this[_0x0cee('0x17')]);};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x47')]=function(_0x3e2322){var _0x148d6f=this;if(!_[_0x0cee('0x33')](_0x3e2322)){for(var _0xc73329 in _0x3e2322){if(_0x3e2322['hasOwnProperty'](_0xc73329)){_0x148d6f['emitVoiceQueueChannelRemove'](_0x3e2322[_0xc73329],'clearqueuereport');delete _0x3e2322[_0xc73329];}}}};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x48')]=function(_0x3acf6a,_0x306ef9,_0x472cb5){io['to'](_0x3acf6a)[_0x0cee('0x48')](_0x306ef9,_0x472cb5);};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x49')]=function(_0x5da5be,_0x5ed048){logger[_0x0cee('0x4a')](_0x0cee('0x4b')+_0x5ed048+_0x0cee('0x4c'),_0x5da5be['uniqueid'],util[_0x0cee('0x44')](_0x5da5be,{'showHidden':![],'depth':null}));this[_0x0cee('0x48')](util[_0x0cee('0x4d')](_0x0cee('0x4e'),_0x5da5be[_0x0cee('0x4f')]),_0x0cee('0x50'),_0x5da5be);io[_0x0cee('0x48')](_0x0cee('0x51'),_0x5da5be);};VoiceQueueReport[_0x0cee('0xd')]['emitVoiceQueueChannelRemove']=function(_0x3cc7fe,_0x468e83){logger[_0x0cee('0x4a')](_0x0cee('0x4b')+_0x468e83+_0x0cee('0x52'),_0x3cc7fe['uniqueid'],util[_0x0cee('0x44')](_0x3cc7fe,{'showHidden':![],'depth':null}));this[_0x0cee('0x48')](util[_0x0cee('0x4d')](_0x0cee('0x4e'),_0x3cc7fe[_0x0cee('0x4f')]),_0x0cee('0x53'),_0x3cc7fe);io[_0x0cee('0x48')](_0x0cee('0x54'),_0x3cc7fe);};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x55')]=function(_0x8fe55d,_0x8322d8){if(_0x8fe55d['type']===_0x0cee('0x56')){var _0x3548b1={'id':_0x8fe55d['id'],'name':_0x8fe55d[_0x0cee('0x4f')],'strategy':_0x8fe55d[_0x0cee('0x57')],'answered':_0x8fe55d['answered'],'available':_0x8fe55d[_0x0cee('0x58')],'loggedIn':_0x8fe55d[_0x0cee('0x59')],'pTalking':_0x8fe55d[_0x0cee('0x37')],'sumBillable':_0x8fe55d[_0x0cee('0x5a')],'sumDuration':_0x8fe55d[_0x0cee('0x5b')],'sumHoldTime':_0x8fe55d[_0x0cee('0x5c')]||0x0,'talking':_0x8fe55d['talking'],'total':_0x8fe55d['total'],'type':_0x8fe55d[_0x0cee('0x5d')],'unmanaged':_0x8fe55d['unmanaged'],'abandoned':_0x8fe55d[_0x0cee('0x5e')],'waiting':_0x8fe55d[_0x0cee('0x38')]};if(_0x8fe55d[_0x0cee('0x5f')]){_0x3548b1[_0x0cee('0x5f')]={'id':_0x8fe55d[_0x0cee('0x5f')]['id'],'name':_0x8fe55d[_0x0cee('0x5f')]['name'],'active':_0x8fe55d['Trunk'][_0x0cee('0x60')],'callerid':_0x8fe55d['Trunk']['callerid']};}if(_0x8fe55d['Interval']){_0x3548b1[_0x0cee('0x61')]={'id':_0x8fe55d[_0x0cee('0x61')]['id'],'name':_0x8fe55d[_0x0cee('0x61')][_0x0cee('0x4f')]};}var _0x2bc97b=md5(JSON[_0x0cee('0x62')](_0x3548b1));if(_0x8fe55d[_0x0cee('0x3')]!==_0x2bc97b){_0x8fe55d['md5']=_0x2bc97b;logger[_0x0cee('0x4a')](_0x0cee('0x63')+_0x8322d8+_0x0cee('0x64'),util[_0x0cee('0x44')](_0x3548b1,{'showHidden':![],'depth':null}));this['emit'](util[_0x0cee('0x4d')](_0x0cee('0x4e'),_0x3548b1['name']),_0x0cee('0x65'),_0x3548b1);}}};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x66')]=function(_0x5aaa16){return _0x5aaa16!==null&&!_[_0x0cee('0x67')](_0x5aaa16);};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x32')]=function(){var _0x4512c7=this;setInterval(function(){_0x4512c7[_0x0cee('0x3b')]();ami['Action']({'action':'queues'})[_0x0cee('0x40')](function(_0x1f64d3){logger[_0x0cee('0x43')]('[voiceQueueReport][queues]',util['inspect'](_0x1f64d3,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x31')]=function(){var _0x468798=this;setInterval(function(){if(_0x468798[_0x0cee('0x16')]){return ami[_0x0cee('0x3e')]({'action':_0x0cee('0x19')})['then'](function(_0xc0f2dc){_0x468798['flagQueueSummary']=![];})[_0x0cee('0x40')](function(_0x4df4c1){logger['error']('[voiceQueueReport][queuesummary]',util[_0x0cee('0x44')](_0x4df4c1,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x51bc62){try{if(this[_0x0cee('0x66')](_0x51bc62)&&this[_0x0cee('0x66')](_0x51bc62[_0x0cee('0x68')])){logger[_0x0cee('0x4a')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x0cee('0x44')](_0x51bc62,{'showHidden':![],'depth':null}));if(this[_0x0cee('0x15')][_0x51bc62['queue']]){logger[_0x0cee('0x69')](_0x0cee('0x6a'),_0x51bc62[_0x0cee('0x68')]);var _0x5ac613=_[_0x0cee('0x6b')](this[_0x0cee('0x3c')],_0x0cee('0x68'))[_0x51bc62[_0x0cee('0x68')]]||0x0;var _0x249933=_0x5ac613-_0x51bc62[_0x0cee('0x6c')];if(this['voiceQueues'][_0x51bc62[_0x0cee('0x68')]][_0x0cee('0x38')]!==_[_0x0cee('0x6d')](_0x51bc62['callers'])||this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]][_0x0cee('0x59')]!==_[_0x0cee('0x6d')](_0x51bc62[_0x0cee('0x6e')])||this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]][_0x0cee('0x58')]!==_[_0x0cee('0x6d')](_0x51bc62['available'])||this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]]['talking']!==_0x249933){this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]]['waiting']=_[_0x0cee('0x6d')](_0x51bc62[_0x0cee('0x6c')]);this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]][_0x0cee('0x59')]=_['toNumber'](_0x51bc62[_0x0cee('0x6e')]);this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]][_0x0cee('0x58')]=_[_0x0cee('0x6d')](_0x51bc62[_0x0cee('0x58')]);this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]]['talking']=_0x249933>0x0?_0x249933:0x0;this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]][_0x0cee('0x36')]=this['voiceQueues'][_0x51bc62[_0x0cee('0x68')]][_0x0cee('0x36')]>_[_0x0cee('0x6d')](_0x51bc62[_0x0cee('0x6e')])?_[_0x0cee('0x6d')](_0x51bc62[_0x0cee('0x6e')]):this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]]['talking'];this[_0x0cee('0x55')](this[_0x0cee('0x15')][_0x51bc62['queue']],_0x0cee('0x19'));}logger[_0x0cee('0x4a')](_0x0cee('0x6f'),util[_0x0cee('0x44')](this[_0x0cee('0x15')][_0x51bc62[_0x0cee('0x68')]],{'showHidden':![],'depth':null}));ami[_0x0cee('0x48')](_0x0cee('0x70'),this[_0x0cee('0x15')][_0x51bc62['queue']]);}}}catch(_0x1664bf){logger[_0x0cee('0x43')](_0x0cee('0x71'),util[_0x0cee('0x44')](_0x1664bf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x1c')]=function(_0x1e6eaa){logger['debug'](_0x0cee('0x72'),util[_0x0cee('0x44')](_0x1e6eaa,{'showHidden':![],'depth':null}));this[_0x0cee('0x16')]=!![];};VoiceQueueReport['prototype'][_0x0cee('0x1e')]=function(_0x204b85){try{if(this[_0x0cee('0x66')](_0x204b85)){logger[_0x0cee('0x4a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x204b85[_0x0cee('0x73')],util['inspect'](_0x204b85,{'showHidden':![],'depth':null}));if(_[_0x0cee('0x67')](this['queueReports'][_0x204b85['uniqueid']]))this['queueReports'][_0x204b85[_0x0cee('0x73')]]=[];if(_[_0x0cee('0x67')](this['channels'][_0x204b85[_0x0cee('0x73')]]))this[_0x0cee('0x3c')][_0x204b85[_0x0cee('0x73')]]={};var _0x501258=new QueueReport();_0x501258[_0x0cee('0x4f')]=_0x204b85[_0x0cee('0x68')];_0x501258['type']=this[_0x0cee('0x15')][_0x501258[_0x0cee('0x4f')]]&&this[_0x0cee('0x15')][_0x501258[_0x0cee('0x4f')]]['type']?this[_0x0cee('0x15')][_0x501258[_0x0cee('0x4f')]]['type']||_0x0cee('0x56'):_0x0cee('0x56');_0x501258[_0x0cee('0x68')]=_0x204b85[_0x0cee('0x68')];_0x501258[_0x0cee('0x74')]=moment()[_0x0cee('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x501258[_0x0cee('0x75')]=_0x204b85[_0x0cee('0x75')];_0x501258[_0x0cee('0x76')]=_0x204b85[_0x0cee('0x76')];_0x501258[_0x0cee('0x73')]=_0x204b85[_0x0cee('0x73')];_0x501258[_0x0cee('0x77')]=this[_0x0cee('0x3c')][_0x204b85[_0x0cee('0x73')]][_0x0cee('0x77')];logger[_0x0cee('0x69')](_0x0cee('0x78'),_0x501258[_0x0cee('0x4f')],_0x501258[_0x0cee('0x5d')]);_[_0x0cee('0x79')](_0x501258,_[_0x0cee('0x7a')](_0x204b85,_[_0x0cee('0x7b')](_0x501258)));this[_0x0cee('0x12')][_0x204b85[_0x0cee('0x73')]][_0x0cee('0x7c')](_0x501258);this['channels'][_0x204b85['uniqueid']]=_0x501258;this['emitVoiceQueueChannelSave'](_0x501258,_0x0cee('0x1d'));}}catch(_0x44dff4){logger[_0x0cee('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x204b85[_0x0cee('0x73')],util[_0x0cee('0x44')](_0x44dff4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x7d')]=function(_0x4a54dd){try{if(this[_0x0cee('0x66')](_0x4a54dd)){logger[_0x0cee('0x4a')](_0x0cee('0x7e'),_0x4a54dd[_0x0cee('0x73')],util['inspect'](_0x4a54dd,{'showHidden':![],'depth':null}));if(this[_0x0cee('0x12')][_0x4a54dd['uniqueid']]){var _0x74c6d0=_['last'](this[_0x0cee('0x12')][_0x4a54dd[_0x0cee('0x73')]]);_0x74c6d0[_0x0cee('0x7f')]=![];_0x74c6d0[_0x0cee('0x80')]=null;_0x74c6d0['holdtime']=_0x4a54dd['holdtime'];_0x74c6d0[_0x0cee('0x81')]=_0x4a54dd[_0x0cee('0x81')];_0x74c6d0[_0x0cee('0x1f')]=!![];_0x74c6d0[_0x0cee('0x82')]=moment()[_0x0cee('0x4d')](_0x0cee('0x83'));_0x74c6d0['queuecallerexitreason']=_0x0cee('0x84');_0x74c6d0[_0x0cee('0x85')]=null;logger[_0x0cee('0x69')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x74c6d0['name'],_0x74c6d0[_0x0cee('0x5d')]);this[_0x0cee('0x3c')][_0x4a54dd[_0x0cee('0x73')]]=_0x74c6d0;this[_0x0cee('0x86')](_0x74c6d0,'queuecallerabandon');}}}catch(_0x599903){logger[_0x0cee('0x43')](_0x0cee('0x7e'),_0x4a54dd[_0x0cee('0x73')],util[_0x0cee('0x44')](_0x599903,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cee('0xd')]['syncQueueCallerLeave']=function(_0x52f07c){try{if(this['isNotNull'](_0x52f07c)){logger[_0x0cee('0x4a')](_0x0cee('0x87'),_0x52f07c[_0x0cee('0x73')],util[_0x0cee('0x44')](_0x52f07c,{'showHidden':![],'depth':null}));if(this[_0x0cee('0x12')][_0x52f07c[_0x0cee('0x73')]]){var _0x1859c2=_['last'](this[_0x0cee('0x12')][_0x52f07c['uniqueid']]);_0x1859c2[_0x0cee('0x88')]=moment()[_0x0cee('0x4d')](_0x0cee('0x83'));_0x1859c2['connectedlinenum']=_0x52f07c[_0x0cee('0x89')];_0x1859c2['connectedlinename']=_0x52f07c[_0x0cee('0x8a')];logger[_0x0cee('0x69')](_0x0cee('0x8b'),_0x1859c2['name'],_0x1859c2['type'],_0x52f07c[_0x0cee('0x89')],_0x52f07c['connectedlinename']);this[_0x0cee('0x3c')][_0x52f07c[_0x0cee('0x73')]]=_0x1859c2;this[_0x0cee('0x49')](_0x1859c2,_0x0cee('0x20'));}}}catch(_0xde39a5){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x52f07c[_0x0cee('0x73')],util['inspect'](_0xde39a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x25')]=function(_0x32591e){try{if(this[_0x0cee('0x66')](_0x32591e)){logger[_0x0cee('0x4a')]('[%s][voiceQueueReport][agentconnect]',_0x32591e[_0x0cee('0x73')],util[_0x0cee('0x44')](_0x32591e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x32591e[_0x0cee('0x73')]]){var _0x3765df=_[_0x0cee('0x8c')](this[_0x0cee('0x12')][_0x32591e[_0x0cee('0x73')]]);_0x3765df['queuecallercomplete']=!![];_0x3765df['queuecallerexitreason']=_0x0cee('0x8d');logger['info'](_0x0cee('0x8e'),_0x3765df[_0x0cee('0x4f')],_0x3765df['type']);}}}catch(_0x4728e7){logger[_0x0cee('0x43')](_0x0cee('0x8f'),_0x32591e[_0x0cee('0x73')],util['inspect'](_0x4728e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0x23')]=function(_0x303ccd){try{if(this[_0x0cee('0x66')](_0x303ccd)){logger[_0x0cee('0x4a')](_0x0cee('0x90'),_0x303ccd[_0x0cee('0x73')],util[_0x0cee('0x44')](_0x303ccd,{'showHidden':![],'depth':null}));if(this[_0x0cee('0x12')][_0x303ccd['uniqueid']]){var _0x43c959=_[_0x0cee('0x8c')](this['queueReports'][_0x303ccd['uniqueid']]);_0x43c959[_0x0cee('0x1f')]=![];_0x43c959['queuecallerabandonAt']=null;_0x43c959[_0x0cee('0x91')]=!![];_0x43c959[_0x0cee('0x85')]=_0x303ccd['membername'];_0x43c959[_0x0cee('0x92')]=_0x303ccd[_0x0cee('0x92')];_0x43c959['queuecallercomplete']=!![];_0x43c959[_0x0cee('0x93')]=![];_0x43c959[_0x0cee('0x94')]=null;if(!_0x43c959[_0x0cee('0x95')]){if(_0x303ccd[_0x0cee('0x96')]==_0x0cee('0x95')){_0x43c959['queuecallerexitreason']='COMPLETED';logger[_0x0cee('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x43c959[_0x0cee('0x4f')],_0x43c959[_0x0cee('0x5d')]);}else{if(_[_0x0cee('0x97')](_0x303ccd[_0x0cee('0x98')][_0x0cee('0x99')](),_0x0cee('0x9a'))){if(this[_0x0cee('0x12')][_0x303ccd[_0x0cee('0x9b')]]){var _0x4b031e=_[_0x0cee('0x8c')](this[_0x0cee('0x12')][_0x303ccd[_0x0cee('0x9b')]]);_0x4b031e[_0x0cee('0x7f')]=![];_0x4b031e['queuecallerexit']=!![];_0x4b031e[_0x0cee('0x94')]=moment(_0x43c959[_0x0cee('0x74')])[_0x0cee('0x9c')](_0x303ccd[_0x0cee('0x92')],_0x0cee('0x9d'))[_0x0cee('0x4d')](_0x0cee('0x83'));_0x4b031e[_0x0cee('0x9e')]=_0x0cee('0x9f');_0x4b031e[_0x0cee('0x95')]=!![];_0x4b031e[_0x0cee('0xa0')]=_0x0cee('0xa1');_0x4b031e[_0x0cee('0xa2')]=_0x303ccd['destexten'];_0x4b031e['transferuniqueid']=_0x303ccd[_0x0cee('0x73')];logger[_0x0cee('0x69')](_0x0cee('0xa3'),_0x4b031e['name'],_0x4b031e[_0x0cee('0x5d')]);var _0x3d73c8=this[_0x0cee('0x12')][_0x303ccd[_0x0cee('0x9b')]];this[_0x0cee('0x12')][_0x303ccd['linkedid']]=this['queueReports'][_0x303ccd['uniqueid']];this[_0x0cee('0x12')][_0x303ccd[_0x0cee('0x73')]]=_0x3d73c8;}}else{_0x43c959['queuecallerexitreason']=_0x0cee('0xa4')+_0x303ccd[_0x0cee('0x96')][_0x0cee('0xa5')]();logger['info'](_0x0cee('0xa6'),_0x43c959[_0x0cee('0x4f')],_0x43c959[_0x0cee('0x5d')],_0x43c959[_0x0cee('0x9e')]);}}}this[_0x0cee('0x3c')][_0x303ccd[_0x0cee('0x73')]]=_0x43c959;this['emitVoiceQueueChannelRemove'](_0x43c959,'agentcomplete');}}}catch(_0x537b31){logger[_0x0cee('0x43')](_0x0cee('0x90'),_0x303ccd[_0x0cee('0x73')],util['inspect'](_0x537b31,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0xa7')]=function(_0x382cf7){try{if(this[_0x0cee('0x66')](_0x382cf7)){logger['debug'](_0x0cee('0xa8'),_0x382cf7[_0x0cee('0x73')],util[_0x0cee('0x44')](_0x382cf7,{'showHidden':![],'depth':null}));this['addVariable'](_0x382cf7[_0x0cee('0x73')],_[_0x0cee('0x7b')](_0x382cf7['variable'])[0x0],_0x382cf7[_0x0cee('0xa9')]);if(this[_0x0cee('0x12')][_0x382cf7[_0x0cee('0x73')]]){var _0x318186=_[_0x0cee('0x8c')](this[_0x0cee('0x12')][_0x382cf7[_0x0cee('0x73')]]);if(_0x318186){if(this[_0x0cee('0x66')](_0x382cf7[_0x0cee('0xaa')])&&this[_0x0cee('0x66')](_0x382cf7[_0x0cee('0xaa')]['queuestatus'])){switch(_0x382cf7['value']){case _0x0cee('0xab'):_0x318186[_0x0cee('0x93')]=![];_0x318186[_0x0cee('0x94')]=null;break;case _0x0cee('0xac'):_0x318186['lastevent']=_0x0cee('0xad');_0x318186[_0x0cee('0x93')]=!![];_0x318186['queuecallerexitAt']=moment()[_0x0cee('0x4d')](_0x0cee('0x83'));_0x318186['queuecallerleaveAt']=moment()[_0x0cee('0x4d')](_0x0cee('0x83'));logger['debug'](_0x0cee('0xae'),_0x382cf7[_0x0cee('0x73')],util[_0x0cee('0x44')](_0x318186,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x318186);break;default:_0x318186[_0x0cee('0x93')]=!![];_0x318186[_0x0cee('0x94')]=moment()[_0x0cee('0x4d')](_0x0cee('0x83'));_0x318186['queuecallerleaveAt']=moment()[_0x0cee('0x4d')](_0x0cee('0x83'));}_0x318186['queuecallerabandon']=![];_0x318186[_0x0cee('0x82')]=null;_0x318186['queuecallerexitreason']=_0x382cf7[_0x0cee('0xa9')];this['channels'][_0x382cf7[_0x0cee('0x73')]]=_0x318186;this[_0x0cee('0x86')](_0x318186,_0x0cee('0x26'));}else if(this[_0x0cee('0x66')](_0x382cf7[_0x0cee('0xaa')])&&this['isNotNull'](_0x382cf7['variable'][_0x0cee('0xaf')])){if(!_0x318186[_0x0cee('0x1f')]){_0x318186['queuecallerexit']=!![];_0x318186[_0x0cee('0x94')]=moment()[_0x0cee('0x4d')](_0x0cee('0x83'));_0x318186[_0x0cee('0x9e')]=_0x0cee('0xb0');_0x318186[_0x0cee('0x88')]=moment()[_0x0cee('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0cee('0x3c')][_0x382cf7[_0x0cee('0x73')]]=_0x318186;}}logger[_0x0cee('0x69')](_0x0cee('0xb1'),_0x382cf7[_0x0cee('0x73')],_0x318186['name'],_0x318186['type'],_[_0x0cee('0x7b')](_0x382cf7[_0x0cee('0xaa')])[0x0],_0x382cf7[_0x0cee('0xa9')]);_0x318186[_0x0cee('0x18')]=this[_0x0cee('0x18')][_0x382cf7['uniqueid']];}}}}catch(_0x29baff){logger[_0x0cee('0x43')](_0x0cee('0xa8'),_0x382cf7['uniqueid'],util[_0x0cee('0x44')](_0x29baff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0xb2')]=function(_0x42da22,_0x4cbf85,_0x18488d){var _0x5df7ec=[_0x0cee('0xb3'),_0x0cee('0xb4'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x0cee('0xb5'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x0cee('0xb6'),_0x0cee('0xb7'),_0x0cee('0xb8'),_0x0cee('0xb9'),_0x0cee('0xba'),_0x0cee('0xbb'),_0x0cee('0xbc'),_0x0cee('0xbd'),_0x0cee('0xbe'),_0x0cee('0xbf'),'memberrealtime'];if(!_[_0x0cee('0xc0')](_0x4cbf85)&&!_[_0x0cee('0xc1')](_0x5df7ec,_0x4cbf85)){if(_['isUndefined'](this[_0x0cee('0x18')][_0x42da22])){this[_0x0cee('0x18')][_0x42da22]={};}this['variables'][_0x42da22][_0x4cbf85]=_0x18488d;}};VoiceQueueReport[_0x0cee('0xd')][_0x0cee('0xc2')]=function(_0x2619dc){try{if(this[_0x0cee('0x66')](_0x2619dc)){logger[_0x0cee('0x4a')](_0x0cee('0xc3'),_0x2619dc[_0x0cee('0x73')],util[_0x0cee('0x44')](_0x2619dc,{'showHidden':![],'depth':null}));if(this[_0x0cee('0x12')][_0x2619dc[_0x0cee('0x73')]]){for(var _0x18a519=0x0,_0x244239={};_0x18a5190x0?_0x4cbdef:0x0;this[_0xaea1('0x11')][_0x2ae2eb[_0xaea1('0x6a')]][_0xaea1('0x31')]=this[_0xaea1('0x11')][_0x2ae2eb[_0xaea1('0x6a')]][_0xaea1('0x31')]>_[_0xaea1('0x6e')](_0x2ae2eb[_0xaea1('0x70')])?_[_0xaea1('0x6e')](_0x2ae2eb['loggedin']):this[_0xaea1('0x11')][_0x2ae2eb[_0xaea1('0x6a')]][_0xaea1('0x31')];this[_0xaea1('0x55')](this[_0xaea1('0x11')][_0x2ae2eb['queue']],_0xaea1('0x15'));}logger[_0xaea1('0x49')](_0xaea1('0x71'),util[_0xaea1('0x3f')](this[_0xaea1('0x11')][_0x2ae2eb['queue']],{'showHidden':![],'depth':null}));ami[_0xaea1('0x47')]('custom:queuesummary',this['voiceQueues'][_0x2ae2eb[_0xaea1('0x6a')]]);}}}catch(_0x12a068){logger[_0xaea1('0x3d')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x12a068,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaea1('0xc')][_0xaea1('0x18')]=function(_0x3e75a0){logger['debug'](_0xaea1('0x72'),util[_0xaea1('0x3f')](_0x3e75a0,{'showHidden':![],'depth':null}));this[_0xaea1('0x12')]=!![];};VoiceQueueReport[_0xaea1('0xc')][_0xaea1('0x1a')]=function(_0x4def94){try{if(this[_0xaea1('0x69')](_0x4def94)){logger[_0xaea1('0x49')](_0xaea1('0x73'),_0x4def94[_0xaea1('0x4c')],util['inspect'](_0x4def94,{'showHidden':![],'depth':null}));if(_[_0xaea1('0x74')](this[_0xaea1('0x40')][_0x4def94['uniqueid']]))this[_0xaea1('0x40')][_0x4def94['uniqueid']]=[];if(_['isUndefined'](this[_0xaea1('0x35')][_0x4def94['uniqueid']]))this['channels'][_0x4def94['uniqueid']]={};var _0x359ab1=new QueueReport();_0x359ab1[_0xaea1('0x52')]=_0x4def94[_0xaea1('0x6a')];_0x359ab1[_0xaea1('0x56')]=this['voiceQueues'][_0x359ab1[_0xaea1('0x52')]]&&this[_0xaea1('0x11')][_0x359ab1[_0xaea1('0x52')]][_0xaea1('0x56')]?this['voiceQueues'][_0x359ab1[_0xaea1('0x52')]][_0xaea1('0x56')]||_0xaea1('0x57'):'inbound';_0x359ab1[_0xaea1('0x6a')]=_0x4def94['queue'];_0x359ab1[_0xaea1('0x75')]=moment()['format'](_0xaea1('0x76'));_0x359ab1[_0xaea1('0x77')]=_0x4def94[_0xaea1('0x77')];_0x359ab1[_0xaea1('0x78')]=_0x4def94['count'];_0x359ab1[_0xaea1('0x4c')]=_0x4def94['uniqueid'];_0x359ab1[_0xaea1('0x79')]=this[_0xaea1('0x35')][_0x4def94[_0xaea1('0x4c')]][_0xaea1('0x79')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x359ab1[_0xaea1('0x52')],_0x359ab1[_0xaea1('0x56')]);_[_0xaea1('0x7a')](_0x359ab1,_[_0xaea1('0x7b')](_0x4def94,_[_0xaea1('0x7c')](_0x359ab1)));this['queueReports'][_0x4def94[_0xaea1('0x4c')]]['push'](_0x359ab1);this[_0xaea1('0x35')][_0x4def94[_0xaea1('0x4c')]]=_0x359ab1;this[_0xaea1('0x48')](_0x359ab1,_0xaea1('0x19'));}}catch(_0x165222){logger[_0xaea1('0x3d')](_0xaea1('0x73'),_0x4def94[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x165222,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaea1('0xc')][_0xaea1('0x1c')]=function(_0x352596){try{if(this[_0xaea1('0x69')](_0x352596)){logger['debug'](_0xaea1('0x7d'),_0x352596['uniqueid'],util['inspect'](_0x352596,{'showHidden':![],'depth':null}));if(this[_0xaea1('0x40')][_0x352596[_0xaea1('0x4c')]]){var _0x42a9be=_['last'](this[_0xaea1('0x40')][_0x352596['uniqueid']]);_0x42a9be[_0xaea1('0x7e')]=![];_0x42a9be['queuecallercompleteAt']=null;_0x42a9be[_0xaea1('0x7f')]=_0x352596['holdtime'];_0x42a9be[_0xaea1('0x80')]=_0x352596[_0xaea1('0x80')];_0x42a9be['queuecallerabandon']=!![];_0x42a9be[_0xaea1('0x81')]=moment()[_0xaea1('0x51')](_0xaea1('0x76'));_0x42a9be['queuecallerexitreason']=_0xaea1('0x82');_0x42a9be[_0xaea1('0x83')]=null;logger[_0xaea1('0x6b')](_0xaea1('0x84'),_0x42a9be['name'],_0x42a9be[_0xaea1('0x56')]);this[_0xaea1('0x35')][_0x352596['uniqueid']]=_0x42a9be;this[_0xaea1('0x45')](_0x42a9be,_0xaea1('0x1b'));}}}catch(_0x1b6365){logger[_0xaea1('0x3d')](_0xaea1('0x7d'),_0x352596[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x1b6365,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaea1('0xc')][_0xaea1('0x1e')]=function(_0xa8fc4a){try{if(this['isNotNull'](_0xa8fc4a)){logger[_0xaea1('0x49')](_0xaea1('0x85'),_0xa8fc4a[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0xa8fc4a,{'showHidden':![],'depth':null}));if(this[_0xaea1('0x40')][_0xa8fc4a['uniqueid']]){var _0x4e9360=_[_0xaea1('0x86')](this[_0xaea1('0x40')][_0xa8fc4a[_0xaea1('0x4c')]]);_0x4e9360[_0xaea1('0x87')]=moment()[_0xaea1('0x51')](_0xaea1('0x76'));_0x4e9360[_0xaea1('0x88')]=_0xa8fc4a[_0xaea1('0x88')];_0x4e9360[_0xaea1('0x89')]=_0xa8fc4a[_0xaea1('0x89')];logger[_0xaea1('0x6b')](_0xaea1('0x8a'),_0x4e9360['name'],_0x4e9360[_0xaea1('0x56')],_0xa8fc4a[_0xaea1('0x88')],_0xa8fc4a[_0xaea1('0x89')]);this['channels'][_0xa8fc4a[_0xaea1('0x4c')]]=_0x4e9360;this[_0xaea1('0x48')](_0x4e9360,_0xaea1('0x1d'));}}}catch(_0x5c78ec){logger[_0xaea1('0x3d')](_0xaea1('0x85'),_0xa8fc4a[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x5c78ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaea1('0xc')]['syncAgentConnect']=function(_0x5dfbfd){try{if(this[_0xaea1('0x69')](_0x5dfbfd)){logger[_0xaea1('0x49')](_0xaea1('0x8b'),_0x5dfbfd[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x5dfbfd,{'showHidden':![],'depth':null}));if(this[_0xaea1('0x40')][_0x5dfbfd[_0xaea1('0x4c')]]){var _0x4440ac=_[_0xaea1('0x86')](this['queueReports'][_0x5dfbfd[_0xaea1('0x4c')]]);_0x4440ac[_0xaea1('0x7e')]=!![];_0x4440ac[_0xaea1('0x8c')]=_0xaea1('0x8d');logger['info'](_0xaea1('0x8e'),_0x4440ac[_0xaea1('0x52')],_0x4440ac[_0xaea1('0x56')]);}}}catch(_0x4382ca){logger[_0xaea1('0x3d')](_0xaea1('0x8b'),_0x5dfbfd[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x4382ca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaea1('0xc')][_0xaea1('0x20')]=function(_0xec1c0e){try{if(this[_0xaea1('0x69')](_0xec1c0e)){logger['debug'](_0xaea1('0x8f'),_0xec1c0e[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0xec1c0e,{'showHidden':![],'depth':null}));if(this[_0xaea1('0x40')][_0xec1c0e[_0xaea1('0x4c')]]){var _0x47a1e4=_['last'](this[_0xaea1('0x40')][_0xec1c0e[_0xaea1('0x4c')]]);_0x47a1e4[_0xaea1('0x1b')]=![];_0x47a1e4[_0xaea1('0x81')]=null;_0x47a1e4[_0xaea1('0x90')]=!![];_0x47a1e4[_0xaea1('0x83')]=_0xec1c0e['membername'];_0x47a1e4[_0xaea1('0x7f')]=_0xec1c0e[_0xaea1('0x7f')];_0x47a1e4[_0xaea1('0x7e')]=!![];_0x47a1e4[_0xaea1('0x91')]=![];_0x47a1e4['queuecallerexitAt']=null;if(!_0x47a1e4[_0xaea1('0x92')]){if(_0xec1c0e['reason']==_0xaea1('0x92')){_0x47a1e4[_0xaea1('0x8c')]=_0xaea1('0x93');logger[_0xaea1('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x47a1e4['name'],_0x47a1e4['type']);}else{if(_[_0xaea1('0x94')](_0xec1c0e['channel'][_0xaea1('0x95')](),_0xaea1('0x96'))){if(this[_0xaea1('0x40')][_0xec1c0e['linkedid']]){var _0x44aa43=_['last'](this['queueReports'][_0xec1c0e[_0xaea1('0x97')]]);_0x44aa43[_0xaea1('0x7e')]=![];_0x44aa43[_0xaea1('0x91')]=!![];_0x44aa43[_0xaea1('0x98')]=moment(_0x47a1e4['queuecallerjoinAt'])['add'](_0xec1c0e[_0xaea1('0x7f')],_0xaea1('0x99'))[_0xaea1('0x51')](_0xaea1('0x76'));_0x44aa43[_0xaea1('0x8c')]=_0xaea1('0x9a');_0x44aa43[_0xaea1('0x92')]=!![];_0x44aa43['transfertype']='FORWARD';_0x44aa43[_0xaea1('0x9b')]=_0xec1c0e[_0xaea1('0x9c')];_0x44aa43[_0xaea1('0x9d')]=_0xec1c0e[_0xaea1('0x4c')];logger[_0xaea1('0x6b')](_0xaea1('0x9e'),_0x44aa43[_0xaea1('0x52')],_0x44aa43[_0xaea1('0x56')]);var _0x3062cb=this[_0xaea1('0x40')][_0xec1c0e[_0xaea1('0x97')]];this['queueReports'][_0xec1c0e['linkedid']]=this['queueReports'][_0xec1c0e['uniqueid']];this['queueReports'][_0xec1c0e[_0xaea1('0x4c')]]=_0x3062cb;}}else{_0x47a1e4[_0xaea1('0x8c')]=_0xaea1('0x9f')+_0xec1c0e[_0xaea1('0xa0')][_0xaea1('0xa1')]();logger[_0xaea1('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x47a1e4[_0xaea1('0x52')],_0x47a1e4[_0xaea1('0x56')],_0x47a1e4['queuecallerexitreason']);}}}this[_0xaea1('0x35')][_0xec1c0e['uniqueid']]=_0x47a1e4;this['emitVoiceQueueChannelRemove'](_0x47a1e4,_0xaea1('0x1f'));}}}catch(_0x40411e){logger[_0xaea1('0x3d')](_0xaea1('0x8f'),_0xec1c0e[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x40411e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaea1('0xc')][_0xaea1('0xa2')]=function(_0x82af2a){try{if(this[_0xaea1('0x69')](_0x82af2a)){logger[_0xaea1('0x49')]('[%s][voiceQueueReport][varset]',_0x82af2a[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x82af2a,{'showHidden':![],'depth':null}));this[_0xaea1('0xa3')](_0x82af2a['uniqueid'],_['keys'](_0x82af2a[_0xaea1('0xa4')])[0x0],_0x82af2a[_0xaea1('0xa5')]);if(this[_0xaea1('0x40')][_0x82af2a['uniqueid']]){var _0x275173=_['last'](this[_0xaea1('0x40')][_0x82af2a['uniqueid']]);if(_0x275173){if(this[_0xaea1('0x69')](_0x82af2a[_0xaea1('0xa4')])&&this['isNotNull'](_0x82af2a[_0xaea1('0xa4')]['queuestatus'])){switch(_0x82af2a[_0xaea1('0xa5')]){case _0xaea1('0xa6'):_0x275173['queuecallerexit']=![];_0x275173['queuecallerexitAt']=null;break;case _0xaea1('0xa7'):_0x275173['lastevent']=_0xaea1('0xa8');_0x275173[_0xaea1('0x91')]=!![];_0x275173[_0xaea1('0x98')]=moment()[_0xaea1('0x51')](_0xaea1('0x76'));_0x275173['queuecallerleaveAt']=moment()[_0xaea1('0x51')](_0xaea1('0x76'));logger[_0xaea1('0x49')](_0xaea1('0xa9'),_0x82af2a[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x275173,{'showHidden':![],'depth':null}));ami[_0xaea1('0x47')]('custom:timeout',_0x275173);break;default:_0x275173[_0xaea1('0x91')]=!![];_0x275173['queuecallerexitAt']=moment()[_0xaea1('0x51')](_0xaea1('0x76'));_0x275173[_0xaea1('0x87')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x275173[_0xaea1('0x1b')]=![];_0x275173[_0xaea1('0x81')]=null;_0x275173['queuecallerexitreason']=_0x82af2a[_0xaea1('0xa5')];this[_0xaea1('0x35')][_0x82af2a[_0xaea1('0x4c')]]=_0x275173;this['emitVoiceQueueChannelRemove'](_0x275173,_0xaea1('0x23'));}else if(this[_0xaea1('0x69')](_0x82af2a['variable'])&&this[_0xaea1('0x69')](_0x82af2a[_0xaea1('0xa4')][_0xaea1('0xaa')])){if(!_0x275173[_0xaea1('0x1b')]){_0x275173[_0xaea1('0x91')]=!![];_0x275173['queuecallerexitAt']=moment()[_0xaea1('0x51')](_0xaea1('0x76'));_0x275173[_0xaea1('0x8c')]=_0xaea1('0xab');_0x275173[_0xaea1('0x87')]=moment()[_0xaea1('0x51')](_0xaea1('0x76'));this['channels'][_0x82af2a[_0xaea1('0x4c')]]=_0x275173;}}logger[_0xaea1('0x6b')](_0xaea1('0xac'),_0x82af2a[_0xaea1('0x4c')],_0x275173[_0xaea1('0x52')],_0x275173['type'],_[_0xaea1('0x7c')](_0x82af2a[_0xaea1('0xa4')])[0x0],_0x82af2a[_0xaea1('0xa5')]);_0x275173[_0xaea1('0x14')]=this[_0xaea1('0x14')][_0x82af2a[_0xaea1('0x4c')]];}}}}catch(_0x5e5ea7){logger[_0xaea1('0x3d')](_0xaea1('0xad'),_0x82af2a[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x5e5ea7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaea1('0xa3')]=function(_0x421786,_0x3648b0,_0x444452){var _0x554ebf=[_0xaea1('0xae'),'rtpaudioqosbridged',_0xaea1('0xaf'),_0xaea1('0xb0'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0xaea1('0xb1'),_0xaea1('0xb2'),_0xaea1('0xb3'),_0xaea1('0xb4'),_0xaea1('0xb5'),_0xaea1('0xb6'),_0xaea1('0xb7'),_0xaea1('0xb8'),'memberinterface',_0xaea1('0xb9'),'membername','memberpenalty',_0xaea1('0xba')];if(!_['isNil'](_0x3648b0)&&!_[_0xaea1('0xbb')](_0x554ebf,_0x3648b0)){if(_[_0xaea1('0x74')](this[_0xaea1('0x14')][_0x421786])){this['variables'][_0x421786]={};}this[_0xaea1('0x14')][_0x421786][_0x3648b0]=_0x444452;}};VoiceQueueReport[_0xaea1('0xc')][_0xaea1('0x24')]=function(_0x35e5f6){try{if(this[_0xaea1('0x69')](_0x35e5f6)){logger[_0xaea1('0x49')]('[%s][voiceQueueReport][hangup]',_0x35e5f6[_0xaea1('0x4c')],util[_0xaea1('0x3f')](_0x35e5f6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x35e5f6[_0xaea1('0x4c')]]){for(var _0xb1fb25=0x0,_0x1eca1e={};_0xb1fb25=0x0?moment(_0x5f331b[_0x6b78('0x14')])[_0x6b78('0xa')](_0x5f331b['starttime'],'seconds'):null,'data1':_0x6b78('0x15'),'data2':_0x5f331b[_0x6b78('0x16')],'data3':_0x5f331b[_0x6b78('0x17')],'data4':_0x5f331b[_0x6b78('0x18')]||null,'role':_0x6b78('0xd'),'internal':_0x5f331b['accountcode']?_[_0x6b78('0x19')](_0x5f331b[_0x6b78('0x16')]):undefined,'uniqueid':_0x5f331b[_0x6b78('0x1a')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xa079=['starttime','endtime','outbound','dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','isNil','interface','SIP/%s','TALKING','diff','inbound','calleridnum','exten','agent','accountcode','toNumber','voiceDialReport','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa079,0x16c));var _0x9a07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa079[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var _=require(_0x9a07('0x0'));var util=require(_0x9a07('0x1'));var client=require(_0x9a07('0x2'));exports[_0x9a07('0x3')]=function(_0x470edd){var _0x5f2a54=_0x470edd[_0x9a07('0x4')]||_0x470edd['queuecallerexitAt'];return client[_0x9a07('0x5')](_0x9a07('0x6'),{'body':{'channel':'voice','membername':_0x470edd['lastAssignedTo'],'interface':_[_0x9a07('0x7')](_0x470edd[_0x9a07('0x8')])?util['format'](_0x9a07('0x9'),_0x470edd['lastAssignedTo']):_0x470edd[_0x9a07('0x8')],'type':_0x9a07('0xa'),'enterAt':_0x470edd['queuecallerleaveAt'],'exitAt':_0x5f2a54,'duration':moment(_0x5f2a54)[_0x9a07('0xb')](_0x470edd['queuecallerleaveAt'],'seconds'),'data1':_0x9a07('0xc'),'data2':_0x470edd[_0x9a07('0xd')],'data3':_0x470edd[_0x9a07('0xe')],'data4':null,'data5':_0x470edd['queue'],'role':_0x9a07('0xf'),'internal':_0x470edd[_0x9a07('0x10')]?_[_0x9a07('0x11')](_0x470edd[_0x9a07('0x10')]):undefined,'uniqueid':_0x470edd['uniqueid']},'log':'CreateMemberReport'});};exports[_0x9a07('0x12')]=function(_0x213a51){return client[_0x9a07('0x5')](_0x9a07('0x6'),{'body':{'channel':_0x9a07('0x13'),'membername':_0x213a51['membername'],'interface':_0x213a51[_0x9a07('0x8')],'type':_0x9a07('0xa'),'enterAt':_0x213a51[_0x9a07('0x14')],'exitAt':_0x213a51[_0x9a07('0x15')],'duration':moment(_0x213a51[_0x9a07('0x15')])[_0x9a07('0xb')](_0x213a51[_0x9a07('0x14')],'seconds')>=0x0?moment(_0x213a51[_0x9a07('0x15')])[_0x9a07('0xb')](_0x213a51['starttime'],'seconds'):null,'data1':_0x9a07('0x16'),'data2':_0x213a51[_0x9a07('0x10')],'data3':_0x213a51[_0x9a07('0xe')],'data4':_0x213a51[_0x9a07('0x17')]||null,'role':_0x9a07('0xf'),'internal':_0x213a51[_0x9a07('0x10')]?_[_0x9a07('0x11')](_0x213a51[_0x9a07('0x10')]):undefined,'uniqueid':_0x213a51['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b9cfa4c..ce0af01 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 _0x4a83=['stopRecordingOnTransfer','getSettings','Request','ShowSetting'];(function(_0x1f1912,_0x467c26){var _0x333ebd=function(_0x330d3e){while(--_0x330d3e){_0x1f1912['push'](_0x1f1912['shift']());}};_0x333ebd(++_0x467c26);}(_0x4a83,0x125));var _0x34a8=function(_0x5de39f,_0x4d6af8){_0x5de39f=_0x5de39f-0x0;var _0x5dcf02=_0x4a83[_0x5de39f];return _0x5dcf02;};'use strict';var client=require('../client');exports[_0x34a8('0x0')]=function(){return client[_0x34a8('0x1')](_0x34a8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x34a8('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xef8e=['getSettings','Request','ShowSetting','GetSettings'];(function(_0x40e74c,_0x1883a2){var _0x3a8c6b=function(_0x1a4ae4){while(--_0x1a4ae4){_0x40e74c['push'](_0x40e74c['shift']());}};_0x3a8c6b(++_0x1883a2);}(_0xef8e,0x8c));var _0xeef8=function(_0x39c8a4,_0x137a9e){_0x39c8a4=_0x39c8a4-0x0;var _0x41f618=_0xef8e[_0x39c8a4];return _0x41f618;};'use strict';var client=require('../client');exports[_0xeef8('0x0')]=function(){return client[_0xeef8('0x1')](_0xeef8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0xeef8('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index dfa4223..e8fc191 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 _0xdf10=['name','html','getTemplates','Request','GetTemplate'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdf10,0xcf));var _0x0df1=function(_0x3cf96e,_0x27e52b){_0x3cf96e=_0x3cf96e-0x0;var _0x58717d=_0xdf10[_0x3cf96e];return _0x58717d;};'use strict';var client=require('../client');exports[_0x0df1('0x0')]=function(_0x42f93c){return function(_0x1f1745){return client[_0x0df1('0x1')](_0x0df1('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0df1('0x3'),_0x0df1('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xe66d=['html','../client','getTemplates','Request','GetTemplate','name'];(function(_0x25e9df,_0x17a63a){var _0x3dea70=function(_0x3b808a){while(--_0x3b808a){_0x25e9df['push'](_0x25e9df['shift']());}};_0x3dea70(++_0x17a63a);}(_0xe66d,0x14b));var _0xde66=function(_0x3be20a,_0x223336){_0x3be20a=_0x3be20a-0x0;var _0x7382f6=_0xe66d[_0x3be20a];return _0x7382f6;};'use strict';var client=require(_0xde66('0x0'));exports[_0xde66('0x1')]=function(_0x5ee7d2){return function(_0x3facc4){return client[_0xde66('0x2')](_0xde66('0x3'),{'options':{'raw':!![],'attributes':['id',_0xde66('0x4'),_0xde66('0x5')]},'log':_0xde66('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index cc30249..9c68880 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 _0xd08d=['Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','value','Action','Actions','action','data2','data4','data5','data6','data7','getTriggers'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd08d,0xd7));var _0xdd08=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xd08d[_0xc4001c];return _0x49f7bc;};'use strict';var client=require('../client');exports[_0xdd08('0x0')]=function(_0x5455ca){return function(_0x1bed1d){return client[_0xdd08('0x1')](_0xdd08('0x2'),{'options':{'raw':![],'attributes':['id',_0xdd08('0x3'),_0xdd08('0x4'),_0xdd08('0x5')],'include':[{'model':_0xdd08('0x6'),'as':_0xdd08('0x7'),'attributes':['id','field',_0xdd08('0x8'),_0xdd08('0x9')]},{'model':_0xdd08('0x6'),'as':'AnyConditions','attributes':['id','field',_0xdd08('0x8'),'value']},{'model':_0xdd08('0xa'),'as':_0xdd08('0xb'),'attributes':['id',_0xdd08('0xc'),'data1',_0xdd08('0xd'),'data3',_0xdd08('0xe'),_0xdd08('0xf'),_0xdd08('0x10'),_0xdd08('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x8abe=['GetTrigger','name','Condition','AllConditions','operator','value','field','Action','Actions','action','data1','data3','data6','data7','../client','Request'];(function(_0x441dd0,_0xa02a45){var _0x3840a2=function(_0x11dab0){while(--_0x11dab0){_0x441dd0['push'](_0x441dd0['shift']());}};_0x3840a2(++_0xa02a45);}(_0x8abe,0x10e));var _0xe8ab=function(_0x4c5911,_0x434a9b){_0x4c5911=_0x4c5911-0x0;var _0x22de3e=_0x8abe[_0x4c5911];return _0x22de3e;};'use strict';var client=require(_0xe8ab('0x0'));exports['getTriggers']=function(_0x4034cb){return function(_0x3e87ff){return client[_0xe8ab('0x1')](_0xe8ab('0x2'),{'options':{'raw':![],'attributes':['id',_0xe8ab('0x3'),'channel','status'],'include':[{'model':_0xe8ab('0x4'),'as':_0xe8ab('0x5'),'attributes':['id','field',_0xe8ab('0x6'),_0xe8ab('0x7')]},{'model':_0xe8ab('0x4'),'as':'AnyConditions','attributes':['id',_0xe8ab('0x8'),_0xe8ab('0x6'),_0xe8ab('0x7')]},{'model':_0xe8ab('0x9'),'as':_0xe8ab('0xa'),'attributes':['id',_0xe8ab('0xb'),_0xe8ab('0xc'),'data2',_0xe8ab('0xd'),'data4','data5',_0xe8ab('0xe'),_0xe8ab('0xf')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a681a48..51e70c1 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 _0x3754=['getTrunks','registry','defaultuser','GetTrunk','../client'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x3754,0x72));var _0x4375=function(_0x58dd3c,_0x1db9da){_0x58dd3c=_0x58dd3c-0x0;var _0x4595a8=_0x3754[_0x58dd3c];return _0x4595a8;};'use strict';var client=require(_0x4375('0x0'));exports[_0x4375('0x1')]=function(_0x177448){return function(_0xcf2917){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x4375('0x2'),_0x4375('0x3')]},'log':_0x4375('0x4')});};}; \ No newline at end of file +var _0x3d12=['name','registry','getTrunks','GetTrunk'];(function(_0x16d6a9,_0x5edb18){var _0x3be7ab=function(_0x428cf1){while(--_0x428cf1){_0x16d6a9['push'](_0x16d6a9['shift']());}};_0x3be7ab(++_0x5edb18);}(_0x3d12,0x1e6));var _0x23d1=function(_0x2beb8b,_0x3c189c){_0x2beb8b=_0x2beb8b-0x0;var _0x5d0dad=_0x3d12[_0x2beb8b];return _0x5d0dad;};'use strict';var client=require('../client');exports[_0x23d1('0x0')]=function(_0x277f69){return function(_0x1c775f){return client['Request'](_0x23d1('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x23d1('0x2'),_0x23d1('0x3'),'defaultuser']},'log':_0x23d1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e67fbf4..38ac20a 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x4af7ec,_0x4f0f76){var _0x1eea8d=function(_0x1affe8){while(--_0x1affe8){_0x4af7ec['push'](_0x4af7ec['shift']());}};_0x1eea8d(++_0x4f0f76);}(_0xedd9,0xfc));var _0x9edd=function(_0x42e010,_0x41b7c3){_0x42e010=_0x42e010-0x0;var _0x4f32a4=_0xedd9[_0x42e010];return _0x4f32a4;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x91db80,_0x1041c1){var _0xa8c896=function(_0x34ee1d){while(--_0x34ee1d){_0x91db80['push'](_0x91db80['shift']());}};_0xa8c896(++_0x1041c1);}(_0xedd9,0xfc));var _0x9edd=function(_0x32e709,_0xb7f745){_0x32e709=_0x32e709-0x0;var _0x2f0fbd=_0xedd9[_0x32e709];return _0x2f0fbd;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index c67843b..05acd7f 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 _0xf6c8=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x264e1f,_0x24ecad){var _0x2a2508=function(_0x4a7ceb){while(--_0x4a7ceb){_0x264e1f['push'](_0x264e1f['shift']());}};_0x2a2508(++_0x24ecad);}(_0xf6c8,0x8a));var _0x8f6c=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xf6c8[_0x2d8fc2];return _0x3a9e53;};'use strict';var client=require(_0x8f6c('0x0'));exports[_0x8f6c('0x1')]=function(_0x292cab){return client[_0x8f6c('0x2')](_0x8f6c('0x3'),{'body':_0x292cab,'log':_0x8f6c('0x3')});};exports[_0x8f6c('0x4')]=function(_0x5392e5,_0x5f15b4,_0x44edf9){return client[_0x8f6c('0x2')](_0x8f6c('0x5'),{'body':_0x5392e5,'options':{'where':{'uniqueid':_0x5f15b4,'interface':_0x44edf9,'agentcomplete':!![]}},'log':_0x8f6c('0x5')});}; \ No newline at end of file +var _0x3142=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0x50887c,_0x43cc4f){var _0x2ac1ea=function(_0x14dcf1){while(--_0x14dcf1){_0x50887c['push'](_0x50887c['shift']());}};_0x2ac1ea(++_0x43cc4f);}(_0x3142,0xc5));var _0x2314=function(_0x5a7547,_0x5e3f7a){_0x5a7547=_0x5a7547-0x0;var _0x3c8a86=_0x3142[_0x5a7547];return _0x3c8a86;};'use strict';var client=require(_0x2314('0x0'));exports[_0x2314('0x1')]=function(_0xc3b2c7){return client['Request'](_0x2314('0x2'),{'body':_0xc3b2c7,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x1490d0,_0x363db4,_0x3b3490){return client[_0x2314('0x3')](_0x2314('0x4'),{'body':_0x1490d0,'options':{'where':{'uniqueid':_0x363db4,'interface':_0x3b3490,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9d17989..eb624b7 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 _0x8ea6=['../client','create','Request','CreateVoiceCallReport','merge','context','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment','util','lodash'];(function(_0x2de77a,_0x3bcd9b){var _0x498ecb=function(_0x472235){while(--_0x472235){_0x2de77a['push'](_0x2de77a['shift']());}};_0x498ecb(++_0x3bcd9b);}(_0x8ea6,0xd9));var _0x68ea=function(_0x4acc58,_0x4338a1){_0x4acc58=_0x4acc58-0x0;var _0x2095de=_0x8ea6[_0x4acc58];return _0x2095de;};'use strict';var moment=require(_0x68ea('0x0'));var util=require(_0x68ea('0x1'));var _=require(_0x68ea('0x2'));var client=require(_0x68ea('0x3'));exports[_0x68ea('0x4')]=function(_0x5806cb){return client[_0x68ea('0x5')](_0x68ea('0x6'),{'body':_[_0x68ea('0x7')](_0x5806cb,{'source':_0x5806cb['calleridnum'],'destinationcontext':_0x5806cb[_0x68ea('0x8')],'callerid':_0x5806cb['callerid'],'amaflags':_0x68ea('0x9')}),'log':_0x68ea('0x6')});};exports[_0x68ea('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x68ea('0xb')],'createdAt':{'$between':[moment()[_0x68ea('0xc')](_0x68ea('0xd'))[_0x68ea('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x68ea('0xe')](_0x68ea('0xf'))]}},'attributes':[_0x68ea('0x10'),_0x68ea('0x11'),_0x68ea('0x12'),_0x68ea('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x777e=['calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0x80a0d6,_0x1d1378){var _0x14f250=function(_0x58236e){while(--_0x58236e){_0x80a0d6['push'](_0x80a0d6['shift']());}};_0x14f250(++_0x1d1378);}(_0x777e,0x10a));var _0xe777=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0x777e[_0x45f111];return _0x483508;};'use strict';var moment=require(_0xe777('0x0'));var util=require('util');var _=require(_0xe777('0x1'));var client=require(_0xe777('0x2'));exports[_0xe777('0x3')]=function(_0x4c4fe2){return client[_0xe777('0x4')](_0xe777('0x5'),{'body':_[_0xe777('0x6')](_0x4c4fe2,{'source':_0x4c4fe2[_0xe777('0x7')],'destinationcontext':_0x4c4fe2['context'],'callerid':_0x4c4fe2['callerid'],'amaflags':_0xe777('0x8')}),'log':_0xe777('0x5')});};exports[_0xe777('0x9')]=function(){return function(){return client[_0xe777('0x4')](_0xe777('0xa'),{'options':{'where':{'type':[_0xe777('0xb')],'createdAt':{'$between':[moment()['startOf']('day')[_0xe777('0xc')](_0xe777('0xd')),moment()[_0xe777('0xe')](_0xe777('0xf'))[_0xe777('0xc')](_0xe777('0xd'))]}},'attributes':[_0xe777('0x10'),_0xe777('0x11'),_0xe777('0x12'),_0xe777('0x13')]},'log':_0xe777('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index e0327a2..6021d4b 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 _0x1041=['../client','create','Request','CreateVoiceDialReport'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x1041,0x110));var _0x1104=function(_0x2e93d0,_0x5d6526){_0x2e93d0=_0x2e93d0-0x0;var _0x2a88a6=_0x1041[_0x2e93d0];return _0x2a88a6;};'use strict';var client=require(_0x1104('0x0'));exports[_0x1104('0x1')]=function(_0x4cc827){return client[_0x1104('0x2')]('CreateVoiceDialReport',{'body':_0x4cc827,'log':_0x1104('0x3')});}; \ No newline at end of file +var _0x6c56=['create','Request','CreateVoiceDialReport'];(function(_0xe017b1,_0xd091ee){var _0x144370=function(_0x592bbe){while(--_0x592bbe){_0xe017b1['push'](_0xe017b1['shift']());}};_0x144370(++_0xd091ee);}(_0x6c56,0x18c));var _0x66c5=function(_0x25ba6a,_0x4422d6){_0x25ba6a=_0x25ba6a-0x0;var _0x1be09a=_0x6c56[_0x25ba6a];return _0x1be09a;};'use strict';var client=require('../client');exports[_0x66c5('0x0')]=function(_0x5170d6){return client[_0x66c5('0x1')](_0x66c5('0x2'),{'body':_0x5170d6,'log':_0x66c5('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d9e1929..a991234 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 _0x0e9f=['getVoiceExtensions','exten','../client'];(function(_0x549314,_0x4f7802){var _0x513fee=function(_0x131d27){while(--_0x131d27){_0x549314['push'](_0x549314['shift']());}};_0x513fee(++_0x4f7802);}(_0x0e9f,0x116));var _0xf0e9=function(_0x1ff00b,_0x3cd511){_0x1ff00b=_0x1ff00b-0x0;var _0x49e876=_0x0e9f[_0x1ff00b];return _0x49e876;};'use strict';var client=require(_0xf0e9('0x0'));exports[_0xf0e9('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xf0e9('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x89e8=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x176d0f,_0x11fa00){var _0x566b50=function(_0x2a554e){while(--_0x2a554e){_0x176d0f['push'](_0x176d0f['shift']());}};_0x566b50(++_0x11fa00);}(_0x89e8,0x74));var _0x889e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x89e8[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x889e('0x0'));exports[_0x889e('0x1')]=function(){return function(){return client[_0x889e('0x2')](_0x889e('0x3'),{'options':{'raw':!![],'attributes':['id',_0x889e('0x4'),_0x889e('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x889e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 324cac7..58c2d23 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 _0x99c6=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x3952dd,_0x10c0c8){var _0x133d47=function(_0x293475){while(--_0x293475){_0x3952dd['push'](_0x3952dd['shift']());}};_0x133d47(++_0x10c0c8);}(_0x99c6,0xfb));var _0x699c=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x99c6[_0x32f7d7];return _0x133d09;};'use strict';var client=require('../client');exports[_0x699c('0x0')]=function(){return function(){return client[_0x699c('0x1')](_0x699c('0x2'),{'options':{'raw':![],'attributes':['id',_0x699c('0x3'),_0x699c('0x4'),_0x699c('0x5'),_0x699c('0x6'),_0x699c('0x7'),_0x699c('0x8'),_0x699c('0x9'),'dialMethod',_0x699c('0xa'),'dialLimitQueue',_0x699c('0xb'),_0x699c('0xc'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName',_0x699c('0xd'),_0x699c('0xe'),'dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry',_0x699c('0xf'),_0x699c('0x10'),_0x699c('0x11'),'dialNoAnswerMaxRetry',_0x699c('0x12'),_0x699c('0x13'),_0x699c('0x14'),_0x699c('0x15'),_0x699c('0x16'),_0x699c('0x17'),_0x699c('0x18'),_0x699c('0x19'),_0x699c('0x1a'),_0x699c('0x1b'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x699c('0x1c'),_0x699c('0x1d'),_0x699c('0x1e'),_0x699c('0x1f'),_0x699c('0x20'),_0x699c('0x21'),'dialOrderByScheduledAt',_0x699c('0x22'),_0x699c('0x23'),_0x699c('0x24'),'monitor_format','strategy',_0x699c('0x25'),_0x699c('0x26'),_0x699c('0x27'),_0x699c('0x28'),_0x699c('0x29'),_0x699c('0x2a'),_0x699c('0x2b'),'dialAbandonedRetryFrequency',_0x699c('0x2c'),_0x699c('0x2d'),_0x699c('0x2e'),'dialAgentRejectRetryFrequency',_0x699c('0x2f'),_0x699c('0x30'),'dialPredictiveIntervalMinThreshold',_0x699c('0x31')],'include':[{'model':'Trunk','as':_0x699c('0x32'),'attributes':['id',_0x699c('0x3'),_0x699c('0x33'),_0x699c('0x34')]},{'model':_0x699c('0x35'),'as':_0x699c('0x36'),'attributes':['id',_0x699c('0x3')]},{'model':_0x699c('0x32'),'as':'TrunkBackup','attributes':['id','name','callerid',_0x699c('0x34')]},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0x699c('0x37'),'as':_0x699c('0x38'),'attributes':['id','name',_0x699c('0x39')]}]}]},'log':_0x699c('0x0')});};}; \ No newline at end of file +var _0x4328=['dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','callAdditionalPhoneAfterMin','Trunk','name','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','acw','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x4328,0x177));var _0x8432=function(_0x300f8f,_0x1bd42b){_0x300f8f=_0x300f8f-0x0;var _0x52a167=_0x4328[_0x300f8f];return _0x52a167;};'use strict';var client=require(_0x8432('0x0'));exports[_0x8432('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x8432('0x2'),'acwTimeout',_0x8432('0x3'),'monitor_format',_0x8432('0x4'),_0x8432('0x5'),_0x8432('0x6'),_0x8432('0x7'),_0x8432('0x8'),_0x8432('0x9'),_0x8432('0xa'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0x8432('0xb'),_0x8432('0xc'),_0x8432('0xd'),'dialCongestionRetryFrequency',_0x8432('0xe'),'dialBusyRetryFrequency',_0x8432('0xf'),_0x8432('0x10'),'dialGlobalMaxRetry',_0x8432('0x11'),_0x8432('0x12'),_0x8432('0x13'),_0x8432('0x14'),_0x8432('0x15'),_0x8432('0x16'),_0x8432('0x17'),_0x8432('0x18'),_0x8432('0x19'),'dialAMDMinWordLength',_0x8432('0x1a'),'dialAMDMaximumNumberOfWords',_0x8432('0x1b'),'dialAMDMaximumWordLength',_0x8432('0x1c'),_0x8432('0x1d'),_0x8432('0x1e'),'dialOrderByScheduledAt',_0x8432('0x1f'),_0x8432('0x20'),_0x8432('0x21'),_0x8432('0x22'),_0x8432('0x23'),_0x8432('0x24'),_0x8432('0x25'),_0x8432('0x26'),_0x8432('0x27'),_0x8432('0x28'),_0x8432('0x29'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x8432('0x2a'),_0x8432('0x2b'),_0x8432('0x2c'),_0x8432('0x2d'),'dialPredictiveIntervalMaxThreshold',_0x8432('0x2e'),_0x8432('0x2f')],'include':[{'model':_0x8432('0x30'),'as':_0x8432('0x30'),'attributes':['id',_0x8432('0x31'),_0x8432('0x32'),'active']},{'model':_0x8432('0x33'),'as':_0x8432('0x34'),'attributes':['id','name']},{'model':_0x8432('0x30'),'as':_0x8432('0x35'),'attributes':['id',_0x8432('0x31'),_0x8432('0x32'),_0x8432('0x36')]},{'model':_0x8432('0x37'),'as':_0x8432('0x37'),'attributes':['id','name'],'include':[{'model':_0x8432('0x37'),'as':_0x8432('0x38'),'attributes':['id',_0x8432('0x31'),_0x8432('0x39')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ec0a1ad..6da2cbf 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(_0x47dfa3,_0x10d222){var _0x30be87=function(_0x272586){while(--_0x272586){_0x47dfa3['push'](_0x47dfa3['shift']());}};_0x30be87(++_0x10d222);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0xc6e1ca,_0x395e0d){var _0x48bde1=function(_0x34bae9){while(--_0x34bae9){_0xc6e1ca['push'](_0xc6e1ca['shift']());}};_0x48bde1(++_0x395e0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 808b62f..cfbbdd3 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 _0x367c=['Request','../client','getVoiceQueueRtPauses'];(function(_0x485cb5,_0x91f1ae){var _0x208d06=function(_0x5461b0){while(--_0x5461b0){_0x485cb5['push'](_0x485cb5['shift']());}};_0x208d06(++_0x91f1ae);}(_0x367c,0x13f));var _0xc367=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x367c[_0x3be7ff];return _0x186721;};'use strict';var client=require(_0xc367('0x0'));exports[_0xc367('0x1')]=function(_0x3d5daf){return function(){return client[_0xc367('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x3d5daf,'paused':!![]},'raw':!![]},'log':_0xc367('0x1')});};}; \ No newline at end of file +var _0xd631=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x47e15b,_0x4628ea){var _0x247166=function(_0xf4780c){while(--_0xf4780c){_0x47e15b['push'](_0x47e15b['shift']());}};_0x247166(++_0x4628ea);}(_0xd631,0x1bf));var _0x1d63=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0xd631[_0x1147ab];return _0x55cb5a;};'use strict';var client=require(_0x1d63('0x0'));exports['getVoiceQueueRtPauses']=function(_0x374a17){return function(){return client[_0x1d63('0x1')](_0x1d63('0x2'),{'options':{'where':{'VoiceQueueId':_0x374a17,'paused':!![]},'raw':!![]},'log':_0x1d63('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index da6ce0d..360e248 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(_0x21da37,_0x51fa77){var _0x25e04b=function(_0x207c98){while(--_0x207c98){_0x21da37['push'](_0x21da37['shift']());}};_0x25e04b(++_0x51fa77);}(_0x7a54,0x106));var _0x47a5=function(_0x502d1b,_0x599259){_0x502d1b=_0x502d1b-0x0;var _0x1d7161=_0x7a54[_0x502d1b];return _0x1d7161;};'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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3379aa,_0x2f36cc){var _0x166c1d=function(_0x1a15ae){while(--_0x1a15ae){_0x3379aa['push'](_0x3379aa['shift']());}};_0x166c1d(++_0x2f36cc);}(_0x7a54,0x106));var _0x47a5=function(_0x3001f1,_0x4cc94e){_0x3001f1=_0x3001f1-0x0;var _0xfcc604=_0x7a54[_0x3001f1];return _0xfcc604;};'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 diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8f411d9..7aa1cde 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 _0x250d=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','transfertargetchannel','transfertargetcalleridnum'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x250d,0x104));var _0xd250=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x250d[_0x20cf8a];return _0x54e165;};'use strict';var client=require(_0xd250('0x0'));exports[_0xd250('0x1')]={};exports[_0xd250('0x2')]=function(_0x5b2ebd){return client[_0xd250('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x5b2ebd[_0xd250('0x4')],'transfererchannel':_0x5b2ebd[_0xd250('0x5')],'transferercalleridnum':_0x5b2ebd[_0xd250('0x6')],'transferercalleridname':_0x5b2ebd['transferercalleridname'],'transfererconnectedlinenum':_0x5b2ebd[_0xd250('0x7')],'transfererconnectedlinename':_0x5b2ebd[_0xd250('0x8')],'transfereraccountcode':_0x5b2ebd['transfereraccountcode'],'transferercontext':_0x5b2ebd['transferercontext'],'transfererexten':_0x5b2ebd['transfererexten'],'transfererlinkedid':_0x5b2ebd[_0xd250('0x9')],'transfereechannel':_0x5b2ebd[_0xd250('0xa')],'transfereecalleridnum':_0x5b2ebd[_0xd250('0xb')],'transfereecalleridname':_0x5b2ebd[_0xd250('0xc')],'transfereeconnectedlinenum':_0x5b2ebd['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5b2ebd[_0xd250('0xd')],'transfereeaccountcode':_0x5b2ebd[_0xd250('0xe')],'transfereecontext':_0x5b2ebd[_0xd250('0xf')],'transfereeexten':_0x5b2ebd[_0xd250('0x10')],'transfereelinkedid':_0x5b2ebd['transfereelinkedid'],'isexternal':_0x5b2ebd[_0xd250('0x11')],'context':_0x5b2ebd['context'],'extension':_0x5b2ebd['extension'],'type':_0xd250('0x12')},'log':_0xd250('0x13')});};exports[_0xd250('0x14')]=function(_0x3432f9){return client[_0xd250('0x3')](_0xd250('0x13'),{'body':{'result':_0x3432f9[_0xd250('0x4')],'transfererchannel':_0x3432f9[_0xd250('0x15')],'transferercalleridnum':_0x3432f9['origtransferercalleridnum'],'transferercalleridname':_0x3432f9[_0xd250('0x16')],'transfererconnectedlinenum':_0x3432f9[_0xd250('0x17')],'transfererconnectedlinename':_0x3432f9[_0xd250('0x18')],'transfereraccountcode':_0x3432f9[_0xd250('0x19')],'transferercontext':_0x3432f9['secondtransferercontext'],'transfererexten':_0x3432f9['secondtransfererexten'],'transfererlinkedid':_0x3432f9['origtransfererlinkedid'],'transfereechannel':_0x3432f9[_0xd250('0x1a')],'transfereecalleridnum':_0x3432f9[_0xd250('0x1b')],'transfereecalleridname':_0x3432f9[_0xd250('0x1c')],'transfereeconnectedlinenum':_0x3432f9[_0xd250('0x1d')],'transfereeconnectedlinename':_0x3432f9['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3432f9[_0xd250('0x1e')],'transfereecontext':_0x3432f9[_0xd250('0x1f')],'transfereeexten':_0x3432f9[_0xd250('0x20')],'transfereelinkedid':_0x3432f9[_0xd250('0x21')],'isexternal':_0x3432f9['isexternal'],'context':_0x3432f9[_0xd250('0x22')],'extension':_0x3432f9['origtransfererexten'],'type':_0xd250('0x23')},'log':_0xd250('0x13')});}; \ No newline at end of file +var _0xbdd5=['transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname'];(function(_0x2d46aa,_0x33a896){var _0x57ab18=function(_0x181a7e){while(--_0x181a7e){_0x2d46aa['push'](_0x2d46aa['shift']());}};_0x57ab18(++_0x33a896);}(_0xbdd5,0x139));var _0x5bdd=function(_0x34f183,_0x95ceb8){_0x34f183=_0x34f183-0x0;var _0x3f312c=_0xbdd5[_0x34f183];return _0x3f312c;};'use strict';var client=require(_0x5bdd('0x0'));exports[_0x5bdd('0x1')]={};exports[_0x5bdd('0x2')]=function(_0x21cad7){return client['Request'](_0x5bdd('0x3'),{'body':{'result':_0x21cad7[_0x5bdd('0x4')],'transfererchannel':_0x21cad7[_0x5bdd('0x5')],'transferercalleridnum':_0x21cad7['transferercalleridnum'],'transferercalleridname':_0x21cad7[_0x5bdd('0x6')],'transfererconnectedlinenum':_0x21cad7['transfererconnectedlinenum'],'transfererconnectedlinename':_0x21cad7[_0x5bdd('0x7')],'transfereraccountcode':_0x21cad7[_0x5bdd('0x8')],'transferercontext':_0x21cad7['transferercontext'],'transfererexten':_0x21cad7['transfererexten'],'transfererlinkedid':_0x21cad7[_0x5bdd('0x9')],'transfereechannel':_0x21cad7[_0x5bdd('0xa')],'transfereecalleridnum':_0x21cad7[_0x5bdd('0xb')],'transfereecalleridname':_0x21cad7[_0x5bdd('0xc')],'transfereeconnectedlinenum':_0x21cad7[_0x5bdd('0xd')],'transfereeconnectedlinename':_0x21cad7[_0x5bdd('0xe')],'transfereeaccountcode':_0x21cad7[_0x5bdd('0xf')],'transfereecontext':_0x21cad7[_0x5bdd('0x10')],'transfereeexten':_0x21cad7[_0x5bdd('0x11')],'transfereelinkedid':_0x21cad7[_0x5bdd('0x12')],'isexternal':_0x21cad7[_0x5bdd('0x13')],'context':_0x21cad7[_0x5bdd('0x14')],'extension':_0x21cad7[_0x5bdd('0x15')],'type':'blind'},'log':_0x5bdd('0x3')});};exports[_0x5bdd('0x16')]=function(_0x5bd2a3){return client['Request'](_0x5bdd('0x3'),{'body':{'result':_0x5bd2a3['result'],'transfererchannel':_0x5bd2a3[_0x5bdd('0x17')],'transferercalleridnum':_0x5bd2a3[_0x5bdd('0x18')],'transferercalleridname':_0x5bd2a3[_0x5bdd('0x19')],'transfererconnectedlinenum':_0x5bd2a3[_0x5bdd('0x1a')],'transfererconnectedlinename':_0x5bd2a3[_0x5bdd('0x1b')],'transfereraccountcode':_0x5bd2a3[_0x5bdd('0x1c')],'transferercontext':_0x5bd2a3[_0x5bdd('0x1d')],'transfererexten':_0x5bd2a3['secondtransfererexten'],'transfererlinkedid':_0x5bd2a3[_0x5bdd('0x1e')],'transfereechannel':_0x5bd2a3[_0x5bdd('0x1f')],'transfereecalleridnum':_0x5bd2a3['transfertargetcalleridnum'],'transfereecalleridname':_0x5bd2a3[_0x5bdd('0x20')],'transfereeconnectedlinenum':_0x5bd2a3[_0x5bdd('0x21')],'transfereeconnectedlinename':_0x5bd2a3['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5bd2a3['transfertargetaccountcode'],'transfereecontext':_0x5bd2a3[_0x5bdd('0x22')],'transfereeexten':_0x5bd2a3[_0x5bdd('0x23')],'transfereelinkedid':_0x5bd2a3[_0x5bdd('0x24')],'isexternal':_0x5bd2a3[_0x5bdd('0x13')],'context':_0x5bd2a3[_0x5bdd('0x25')],'extension':_0x5bd2a3[_0x5bdd('0x26')],'type':_0x5bdd('0x27')},'log':_0x5bdd('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3e79c66..483b0b8 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 _0x3914=['dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','undefined','channels','voicechannel','map','channel','format','filename','uniqueid','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','wav','values','queueChannels','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','../../../config/environment','../properties','../ami','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','message','username','join','command','content','catch','voiceQueues','hasOwnProperty','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3914,0xeb));var _0x4391=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x3914[_0x1044e5];return _0x5ad0dd;};'use strict';var _=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var jayson=require('jayson/promise');var schema=require(_0x4391('0x2'));var BPromise=require(_0x4391('0x3'));var moment=require('moment');var config=require(_0x4391('0x4'));var properties=require(_0x4391('0x5'));var ami=require(_0x4391('0x6'));exports['listen']=function(_0x1eecd4,_0x2b9b2b,_0x540b62){return new BPromise(function(_0x3717d5,_0x49819d){var _0x4733a2={'QueuePause':function(_0x5c32ac){return new Promise(function(_0x378c09,_0x17bcfb){var _0x57c763=util['format'](_0x4391('0x7'),_0x4391('0x8'),_0x5c32ac[_0x4391('0x9')]);if(_0x1eecd4['timers']&&_0x1eecd4[_0x4391('0xa')][_0x57c763]&&_0x1eecd4[_0x4391('0xa')][_0x57c763][_0x4391('0xb')]){_0x1eecd4[_0x4391('0xa')][_0x57c763]['updateAcw']();}if(_0x1eecd4[_0x4391('0xc')][_0x57c763]){_0x1eecd4[_0x4391('0xc')][_0x57c763][_0x4391('0xd')]({'statePause':_0x5c32ac[_0x4391('0xe')]?!![]:![]});}_0x378c09({'code':0xc8,'message':_0x4391('0xf')});});},'Reload':function(_0xdebb72){var _0xca9ef5=this;return new Promise(function(_0x30a975,_0x5bdd9e){if(ami[_0x4391('0x10')]()==![]){return _0x5bdd9e(_0xca9ef5[_0x4391('0x11')](0x1f4,[config[_0x4391('0x12')]['ip'],config[_0x4391('0x12')]['username'],_0x4391('0x13')]['join']('\x20')));}_0xdebb72=_[_0x4391('0x14')](_0xdebb72,_[_0x4391('0x15')](properties[_0x4391('0x16')]));_0xdebb72[_0x4391('0x17')]=_0x4391('0x18');return ami[_0x4391('0x19')](_0xdebb72)[_0x4391('0x1a')](function(_0x19924d){_0x30a975({'code':0xc8,'message':_0x19924d['message']});})['catch'](function(_0x2ecb23){_0x5bdd9e(_0xca9ef5['error'](0x1f5,_0x2ecb23[_0x4391('0x1b')]));});});},'Command':function(_0x13d63f){var _0xa9c97f=this;return new Promise(function(_0x10271e,_0x3b7709){if(ami['isConnected']()==![]){return _0x3b7709(_0xa9c97f['error'](0x1f4,[config[_0x4391('0x12')]['ip'],config[_0x4391('0x12')][_0x4391('0x1c')],'ami\x20disconnected'][_0x4391('0x1d')]('\x20')));}_0x13d63f=_[_0x4391('0x14')](_0x13d63f,_0x4391('0x1e'));_0x13d63f[_0x4391('0x17')]='Command';return ami[_0x4391('0x19')](_0x13d63f)[_0x4391('0x1a')](function(_0x3c4c9b){_0x10271e({'code':0xc8,'message':_0x3c4c9b[_0x4391('0x1f')]});})[_0x4391('0x20')](function(_0x40ff34){_0x3b7709(_0xa9c97f['error'](0x1f5,_0x40ff34[_0x4391('0x1b')]));});});},'VoiceQueues':function(_0x224e13){return new Promise(function(_0x23d8a1,_0x333ca6){var _0x540339=[];for(var _0x4b0c28 in _0x1eecd4[_0x4391('0x21')]){if(_0x1eecd4[_0x4391('0x21')][_0x4391('0x22')](_0x4b0c28)){var _0x197408=_0x1eecd4[_0x4391('0x21')][_0x4b0c28];var _0x53363c={'id':_0x197408['id'],'name':_0x197408['name'],'strategy':_0x197408['strategy'],'answered':_0x197408['answered'],'available':_0x197408[_0x4391('0x23')],'loggedIn':_0x197408[_0x4391('0x24')],'pTalking':_0x197408[_0x4391('0x25')],'sumBillable':_0x197408[_0x4391('0x26')],'sumDuration':_0x197408['sumDuration'],'sumHoldTime':_0x197408[_0x4391('0x27')]||0x0,'talking':_0x197408[_0x4391('0x28')],'total':_0x197408[_0x4391('0x29')],'type':_0x197408[_0x4391('0x2a')],'unmanaged':_0x197408[_0x4391('0x2b')],'abandoned':_0x197408['abandoned'],'waiting':_0x197408[_0x4391('0x2c')],'loggedInDb':_0x197408[_0x4391('0x2d')]};if(_0x197408[_0x4391('0x2a')]===_0x4391('0x2e')){_0x53363c[_0x4391('0x2f')]=_0x197408[_0x4391('0x2f')];_0x53363c[_0x4391('0x30')]=_0x197408[_0x4391('0x30')];_0x53363c[_0x4391('0x31')]=_0x197408[_0x4391('0x31')];_0x53363c[_0x4391('0x32')]=_0x197408['dialOriginateCallerIdNumber'];_0x53363c[_0x4391('0x33')]=_0x197408['dialOriginateTimeout'];_0x53363c[_0x4391('0x34')]=_0x197408['dialPrefix'];_0x53363c['temp']=_0x197408[_0x4391('0x35')];_0x53363c[_0x4391('0x36')]=_0x197408[_0x4391('0x36')];_0x53363c[_0x4391('0x37')]=_0x197408[_0x4391('0x37')];_0x53363c[_0x4391('0x38')]=_0x197408[_0x4391('0x38')];_0x53363c['outboundBusyCallsDay']=_0x197408[_0x4391('0x39')];_0x53363c['outboundCongestionCallsDay']=_0x197408[_0x4391('0x3a')];_0x53363c['outboundDropCallsDayACS']=_0x197408[_0x4391('0x3b')];_0x53363c[_0x4391('0x3c')]=_0x197408[_0x4391('0x3c')];_0x53363c[_0x4391('0x3d')]=_0x197408[_0x4391('0x3d')];_0x53363c[_0x4391('0x3e')]=_0x197408[_0x4391('0x3e')];_0x53363c[_0x4391('0x3f')]=_0x197408[_0x4391('0x3f')];_0x53363c[_0x4391('0x40')]=_0x197408[_0x4391('0x40')];_0x53363c[_0x4391('0x41')]=_0x197408[_0x4391('0x41')];_0x53363c[_0x4391('0x42')]=_0x197408[_0x4391('0x42')];_0x53363c[_0x4391('0x43')]=_0x197408[_0x4391('0x43')];_0x53363c[_0x4391('0x44')]=_0x197408['predictiveIntervalAnsweredCalls'];_0x53363c['predictiveIntervalAvgHoldtime']=_0x197408[_0x4391('0x45')];_0x53363c[_0x4391('0x46')]=_0x197408[_0x4391('0x46')];_0x53363c[_0x4391('0x47')]=_0x197408[_0x4391('0x47')];_0x53363c[_0x4391('0x48')]=_0x197408[_0x4391('0x48')];_0x53363c[_0x4391('0x49')]=_0x197408['predictiveIntervalErlangCalls'];_0x53363c[_0x4391('0x4a')]=_0x197408['predictiveIntervalErlangCallsDroppedCalls'];_0x53363c['predictiveIntervalHitRate']=_0x197408['predictiveIntervalHitRate'];_0x53363c['predictiveIntervalMultiplicativeFactor']=_0x197408[_0x4391('0x4b')];_0x53363c[_0x4391('0x4c')]=_0x197408[_0x4391('0x4c')];_0x53363c[_0x4391('0x4d')]=_0x197408['predictiveIntervalAvailable'];_0x53363c['predictiveIntervalTotalCalls']=_0x197408[_0x4391('0x4e')];_0x53363c['message']=_0x197408[_0x4391('0x1b')];_0x53363c[_0x4391('0x4f')]=_0x197408[_0x4391('0x4f')];_0x53363c[_0x4391('0x50')]=_0x197408[_0x4391('0x50')];_0x53363c[_0x4391('0x51')]=_0x197408['erlangCallToSecond'];_0x53363c[_0x4391('0x52')]=_0x197408[_0x4391('0x52')];_0x53363c[_0x4391('0x53')]=_0x197408[_0x4391('0x53')];_0x53363c[_0x4391('0x54')]=_0x197408[_0x4391('0x54')];_0x53363c[_0x4391('0x55')]=_0x197408['startProgressive'];}if(_0x197408[_0x4391('0x56')]){_0x53363c[_0x4391('0x56')]={'id':_0x197408[_0x4391('0x56')]['id'],'name':_0x197408[_0x4391('0x56')][_0x4391('0x9')],'active':_0x197408[_0x4391('0x56')][_0x4391('0x57')],'callerid':_0x197408['Trunk'][_0x4391('0x58')]};}if(_0x197408['Interval']){_0x53363c[_0x4391('0x59')]={'id':_0x197408[_0x4391('0x59')]['id'],'name':_0x197408[_0x4391('0x59')][_0x4391('0x9')]};}_0x540339[_0x4391('0x5a')](_0x53363c);}}_0x23d8a1({'count':_0x540339[_0x4391('0x5b')],'rows':_0x540339});});},'UpdateVoiceQueue':function(_0x34272b){return new Promise(function(_0x36ffb4,_0x2cedb6){var _0x20859b=_[_0x4391('0x5c')](_0x1eecd4[_0x4391('0x21')],{'id':parseInt(_0x34272b['id'])});var _0x125bd7=_['omit'](_0x34272b,['id']);if(_0x20859b){for(var _0x5901cf in _0x125bd7){if(typeof _0x125bd7[_0x5901cf]!==_0x4391('0x5d')&&typeof _0x20859b[_0x5901cf]!==_0x4391('0x5d')){_0x20859b[_0x5901cf]=_0x125bd7[_0x5901cf];}}_0x36ffb4(_0x20859b);}else{_0x2cedb6();}});},'VoiceChannels':function(_0x399649){return new Promise(function(_0x3ea728,_0x29fdab){var _0x25c7f6=_['values'](_0x1eecd4[_0x4391('0x5e')]);_0x3ea728({'count':_0x25c7f6['length'],'rows':_0x25c7f6});});},'VoiceChannelMixMonitor':function(_0x2c225e){var _0x51afa5=this;return new Promise(function(_0x200a3b,_0x37df37){if(ami[_0x4391('0x10')]()==![]){return _0x37df37(_0x51afa5[_0x4391('0x11')](0x1f4,[config[_0x4391('0x12')]['ip'],config[_0x4391('0x12')]['username'],_0x4391('0x13')][_0x4391('0x1d')]('\x20')));}var _0x3d4c79=schema(properties[_0x4391('0x5f')])[_0x4391('0x2')](_0x2c225e);if(_0x3d4c79[_0x4391('0x5b')]>0x0){return _0x37df37(_0x51afa5[_0x4391('0x11')](0x1f4,_[_0x4391('0x60')](_0x3d4c79,_0x4391('0x1b'))[_0x4391('0x1d')](',\x20')));}var _0x38872d=_[_0x4391('0x5c')](_0x1eecd4[_0x4391('0x5e')],{'uniqueid':_0x2c225e['uniqueid']});if(_0x38872d&&_0x38872d[_0x4391('0x61')]){var _0x44dea6=util[_0x4391('0x62')]('%s.%s',_0x2c225e[_0x4391('0x63')]||_0x2c225e[_0x4391('0x64')],_0x2c225e[_0x4391('0x62')]||'wav');return ami[_0x4391('0x19')]({'action':_0x4391('0x65'),'channel':_0x38872d['channel'],'file':_0x44dea6,'options':_0x4391('0x66')})[_0x4391('0x1a')](function(_0x231a31){var _0x18e53a=_[_0x4391('0x5c')](_0x38872d[_0x4391('0x67')],{'filename':_0x4391('0x68')+_0x44dea6['toLowerCase']()});if(_[_0x4391('0x69')](_0x18e53a)){_0x38872d[_0x4391('0x67')][_0x4391('0x5a')]({'filename':_0x4391('0x68')+_0x44dea6[_0x4391('0x6a')](),'createdAt':moment()['format'](_0x4391('0x6b')),'mixmonitorid':_0x231a31[_0x4391('0x6c')],'status':_0x4391('0x6d')});}else{_0x18e53a[_0x4391('0x6c')]=_0x231a31[_0x4391('0x6c')];_0x18e53a[_0x4391('0x6e')]='rec';}_0x200a3b({'code':0xc8,'message':[_0x2c225e[_0x4391('0x64')],'MixMonitor\x20Success',_0x231a31[_0x4391('0x6c')]][_0x4391('0x1d')]('\x20'),'mixmonitorid':_0x231a31['mixmonitorid']});})[_0x4391('0x20')](function(_0x2c0432){_0x37df37(_0x51afa5[_0x4391('0x11')](0x1f5,[_0x2c225e[_0x4391('0x64')],_0x2c0432[_0x4391('0x1b')][_0x4391('0x6a')]()][_0x4391('0x1d')]('\x20')));});}else{return _0x37df37(_0x51afa5[_0x4391('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x35b91f){var _0x4439fa=this;return new Promise(function(_0x258642,_0x2c9025){if(ami[_0x4391('0x10')]()==![]){return _0x2c9025(_0x4439fa[_0x4391('0x11')](0x1f4,[config[_0x4391('0x12')]['ip'],config['asterisk'][_0x4391('0x1c')],_0x4391('0x13')][_0x4391('0x1d')]('\x20')));}var _0x2df7bf=schema(properties[_0x4391('0x5f')])[_0x4391('0x2')](_0x35b91f);if(_0x2df7bf['length']>0x0){return _0x2c9025(_0x4439fa[_0x4391('0x11')](0x1f4,_[_0x4391('0x60')](_0x2df7bf,_0x4391('0x1b'))[_0x4391('0x1d')](',\x20')));}var _0x39735f=_[_0x4391('0x5c')](_0x1eecd4[_0x4391('0x5e')],{'uniqueid':_0x35b91f['uniqueid']});if(_0x39735f){return BPromise[_0x4391('0x6f')]()[_0x4391('0x1a')](function(){if(_0x39735f[_0x4391('0x61')]){return ami[_0x4391('0x19')]({'action':_0x4391('0x70'),'channel':_0x39735f[_0x4391('0x61')],'mixmonitorid':_0x35b91f[_0x4391('0x6c')]})[_0x4391('0x20')](function(_0x374297){});}})[_0x4391('0x1a')](function(){if(_0x39735f[_0x4391('0x71')]){return ami[_0x4391('0x19')]({'action':_0x4391('0x70'),'channel':_0x39735f[_0x4391('0x71')],'mixmonitorid':_0x35b91f[_0x4391('0x6c')]})['catch'](function(_0x115506){});}})[_0x4391('0x1a')](function(_0x217300){var _0x24dff6=_['find'](_0x39735f['monitors'],{'mixmonitorid':_0x35b91f[_0x4391('0x6c')]});if(_0x24dff6){_0x24dff6[_0x4391('0x6e')]=_0x4391('0x72');}})[_0x4391('0x1a')](function(){var _0x5daf95=util[_0x4391('0x62')](_0x4391('0x73'),_0x35b91f[_0x4391('0x63')]||_0x35b91f['uniqueid'],_0x35b91f[_0x4391('0x62')]||_0x4391('0x74'));var _0x10bdcf=_[_0x4391('0x5c')](_0x39735f['monitors'],{'filename':_0x4391('0x68')+_0x5daf95[_0x4391('0x6a')]()});if(_0x10bdcf){_0x10bdcf[_0x4391('0x6e')]=_0x4391('0x72');}})[_0x4391('0x1a')](function(){_0x258642({'code':0xc8,'message':[_0x35b91f[_0x4391('0x64')],'StopMixMonitor\x20Success'][_0x4391('0x1d')]('\x20')});})[_0x4391('0x20')](function(_0x59b093){_0x2c9025(_0x4439fa['error'](0x1f5,[_0x35b91f['uniqueid'],_0x59b093[_0x4391('0x1b')][_0x4391('0x6a')]()][_0x4391('0x1d')]('\x20')));});}else{return _0x2c9025(_0x4439fa[_0x4391('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1b30d8){return new Promise(function(_0x5cdfed,_0x22e824){var _0x4e8501=_[_0x4391('0x75')](_0x1eecd4[_0x4391('0x76')]);_0x5cdfed({'count':_0x4e8501[_0x4391('0x5b')],'rows':_0x4e8501});});},'VoiceQueuesChannel':function(_0x264751){var _0x1fbf81=this;return new Promise(function(_0xc0b378,_0x3368c0){var _0x1454df=schema(properties['voicequeuechannel'])[_0x4391('0x2')](_0x264751);if(_0x1454df[_0x4391('0x5b')]>0x0){return _0x3368c0(_0x1fbf81[_0x4391('0x11')](0x1f4,_[_0x4391('0x60')](_0x1454df,'message')['join'](',\x20')));}var _0x30dda6=_[_0x4391('0x5c')](_0x1eecd4[_0x4391('0x76')],{'uniqueid':_0x264751['uniqueid']});if(_0x30dda6){_0xc0b378(_0x30dda6);}else{return _0x3368c0(_0x1fbf81[_0x4391('0x11')](0x1f5,_0x4391('0x77')));}});},'VoiceQueuesChannelHangup':function(_0x266f1f){var _0xcffc22=this;return new Promise(function(_0x1a641f,_0x531f76){if(ami[_0x4391('0x10')]()==![]){return _0x531f76(_0xcffc22[_0x4391('0x11')](0x1f4,[config[_0x4391('0x12')]['ip'],config[_0x4391('0x12')][_0x4391('0x1c')],'ami\x20disconnected'][_0x4391('0x1d')]('\x20')));}var _0x39be42=schema(properties[_0x4391('0x78')])[_0x4391('0x2')](_0x266f1f);if(_0x39be42[_0x4391('0x5b')]>0x0){return _0x531f76(_0xcffc22[_0x4391('0x11')](0x1f4,_[_0x4391('0x60')](_0x39be42,_0x4391('0x1b'))[_0x4391('0x1d')](',\x20')));}var _0x1b64a8=_[_0x4391('0x5c')](_0x1eecd4['queueChannels'],{'uniqueid':_0x266f1f['uniqueid']});if(_0x1b64a8&&_0x1b64a8[_0x4391('0x61')]){return ami[_0x4391('0x19')]({'action':_0x4391('0x79'),'channel':_0x1b64a8[_0x4391('0x61')]})['then'](function(_0x3e23c3){_0x1a641f({'code':0xc8,'message':[_0x266f1f[_0x4391('0x64')],_0x3e23c3['message'][_0x4391('0x6a')]()]['join']('\x20')});})['catch'](function(_0x469816){_0x531f76(_0xcffc22[_0x4391('0x11')](0x1f5,[_0x266f1f[_0x4391('0x64')],_0x469816[_0x4391('0x1b')][_0x4391('0x6a')]()][_0x4391('0x1d')]('\x20')));});}else{return _0x531f76(_0xcffc22['error'](0x1f5,_0x4391('0x77')));}});},'VoiceQueuesChannelRedirect':function(_0x11cd7a){var _0x41c28f=this;return new Promise(function(_0x2abade,_0x1eca50){if(ami[_0x4391('0x10')]()==![]){return _0x1eca50(_0x41c28f[_0x4391('0x11')](0x1f4,[config[_0x4391('0x12')]['ip'],config[_0x4391('0x12')][_0x4391('0x1c')],_0x4391('0x13')][_0x4391('0x1d')]('\x20')));}var _0x1b9430=schema(properties[_0x4391('0x7a')])[_0x4391('0x2')](_0x11cd7a);if(_0x1b9430[_0x4391('0x5b')]>0x0){return _0x1eca50(_0x41c28f[_0x4391('0x11')](0x1f4,_[_0x4391('0x60')](_0x1b9430,_0x4391('0x1b'))[_0x4391('0x1d')](',\x20')));}var _0x57889e=_[_0x4391('0x5c')](_0x1eecd4['queueChannels'],{'uniqueid':_0x11cd7a[_0x4391('0x64')]});if(_0x57889e&&_0x57889e[_0x4391('0x61')]){return ami[_0x4391('0x19')]({'action':_0x4391('0x7b'),'channel':_0x57889e[_0x4391('0x61')],'exten':_0x11cd7a[_0x4391('0x7c')],'context':_0x11cd7a['context']||_0x57889e[_0x4391('0x7d')],'priority':0x1})[_0x4391('0x1a')](function(_0x430f31){_0x2abade({'code':0xc8,'message':[_0x11cd7a[_0x4391('0x64')],_0x430f31['message'][_0x4391('0x6a')]()][_0x4391('0x1d')]('\x20')});})[_0x4391('0x20')](function(_0x2c90ac){_0x1eca50(_0x41c28f[_0x4391('0x11')](0x1f5,[_0x11cd7a[_0x4391('0x64')],_0x2c90ac[_0x4391('0x1b')][_0x4391('0x6a')]()][_0x4391('0x1d')]('\x20')));});}else{return _0x1eca50(_0x41c28f[_0x4391('0x11')](0x1f5,_0x4391('0x77')));}});},'Agents':function(_0x5596de){return new Promise(function(_0x5a0f79,_0x3eed4c){var _0x495620=_[_0x4391('0x75')](_0x1eecd4[_0x4391('0xc')]);_0x5a0f79({'count':_0x495620[_0x4391('0x5b')],'rows':_0x495620});});},'Telephones':function(_0x57de59){return new Promise(function(_0x3aa677,_0x30ef9c){var _0x1906ff=_[_0x4391('0x75')](_0x1eecd4[_0x4391('0x7e')]);_0x3aa677({'count':_0x1906ff[_0x4391('0x5b')],'rows':_0x1906ff});});},'Trunks':function(_0x563d9d){return new Promise(function(_0x3d042c,_0x14de0e){var _0x20f334=_[_0x4391('0x75')](_0x1eecd4[_0x4391('0x7f')]);_0x3d042c({'count':_0x20f334['length'],'rows':_0x20f334});});},'OutboundChannels':function(_0x3ad6f6){return new Promise(function(_0x4b4ffa,_0x5502ff){var _0x50bca9=_[_0x4391('0x75')](_0x1eecd4[_0x4391('0x80')]);_0x4b4ffa({'count':_0x50bca9['length'],'rows':_0x50bca9});});},'Outbound':function(_0x5b9c8a){return new Promise(function(_0x396574,_0x14de95){_0x396574(_0x1eecd4[_0x4391('0x2e')]);});},'Campaigns':function(_0x3e09a3){return new Promise(function(_0x12b0fc,_0x92d4d2){var _0x58caec=_['values'](_0x1eecd4[_0x4391('0x81')]);_0x12b0fc({'count':_0x58caec[_0x4391('0x5b')],'rows':_0x58caec});});},'VoiceQueuesPreview':function(_0x39e9f8){var _0x3e60ed=this;return new Promise(function(_0x25c160,_0x133a96){_0x2b9b2b[_0x4391('0x82')](_0x39e9f8['id'])[_0x4391('0x1a')](function(_0x54d5b1){_0x25c160({'code':0xc8,'message':_0x54d5b1[_0x4391('0x1b')]});})[_0x4391('0x20')](function(_0x2df458){_0x133a96(_0x3e60ed[_0x4391('0x11')](0x1f4,_0x2df458[_0x4391('0x1b')]));});});},'EventManager':function(_0x4c7b96){var _0x57efc6=this;return new Promise(function(_0x11ac57,_0x329949){if(!_0x4c7b96['event']){return _0x329949(_0x57efc6[_0x4391('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x4391('0x83')](_0x4391('0x84')+_0x4c7b96[_0x4391('0x85')],_0x4c7b96['message']);_0x11ac57({'code':0xc8,'message':_0x4c7b96});});},'FaxAccounts':function(_0x3cca7e){return new Promise(function(_0x2f51cd,_0x37fafa){var _0x3b4380=_[_0x4391('0x75')](_0x1eecd4[_0x4391('0x86')]);_0x2f51cd({'count':_0x3b4380[_0x4391('0x5b')],'rows':_0x3b4380});});},'SendFax':function(_0x3fa139){var _0x372f9c=this;return new Promise(function(_0x79c3ce,_0x3c160f){_0x540b62[_0x4391('0x87')](_0x3fa139)[_0x4391('0x1a')](function(_0x37b0a1){_0x79c3ce({'code':0xc8,'message':_0x37b0a1[_0x4391('0x1b')]});})['catch'](function(_0x46be7b){_0x3c160f(_0x372f9c['error'](0x1f4,_0x46be7b[_0x4391('0x1b')]));});});},'CheckAfterSend':function(_0x58cf2d){var _0x6b1d6b=this;return new Promise(function(_0x497e98,_0x45463c){_0x540b62[_0x4391('0x88')](_0x58cf2d)['then'](function(_0x5aeb02){_0x497e98({'code':0xc8,'message':_0x5aeb02[_0x4391('0x1b')]});})['catch'](function(_0x4a48e5){_0x45463c(_0x6b1d6b[_0x4391('0x11')](0x1f4,_0x4a48e5[_0x4391('0x1b')]));});});}};var _0xf4d70e=jayson[_0x4391('0x89')](_0x4733a2)[_0x4391('0x8a')]();_0xf4d70e['on'](_0x4391('0x11'),function(_0x445dc0){return _0x49819d(_0x445dc0);});_0xf4d70e['listen'](0x232a,_0x4391('0x8b'),function(){console[_0x4391('0x8c')](_0x4391('0x8d'),0x232a);return _0x3717d5(_0x4391('0x8e')+0x232a);});});}; \ No newline at end of file +var _0x15ef=['timer','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Action','then','command','Command','content','voiceQueues','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','undefined','validate','channels','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','rec','mixmonitorid','MixMonitor\x20Success','catch','voicechannel','StopMixMonitor','destinationchannel','stop','%s.%s','status','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannelhangup','map','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','timers'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x15ef,0x80));var _0xf15e=function(_0x54d59a,_0x5b3c2c){_0x54d59a=_0x54d59a-0x0;var _0x5b52b6=_0x15ef[_0x54d59a];return _0x5b52b6;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var jayson=require(_0xf15e('0x1'));var schema=require('validate');var BPromise=require(_0xf15e('0x2'));var moment=require(_0xf15e('0x3'));var config=require(_0xf15e('0x4'));var properties=require(_0xf15e('0x5'));var ami=require(_0xf15e('0x6'));exports['listen']=function(_0x1b9a24,_0x5c0553,_0x5e96b4){return new BPromise(function(_0x5ba863,_0x66708e){var _0x232359={'QueuePause':function(_0x490097){return new Promise(function(_0x2d6e94,_0x4daf89){var _0x1168c3=util[_0xf15e('0x7')](_0xf15e('0x8'),_0xf15e('0x9'),_0x490097['name']);if(_0x1b9a24['timers']&&_0x1b9a24['timers'][_0x1168c3]&&_0x1b9a24[_0xf15e('0xa')][_0x1168c3][_0xf15e('0xb')]){_0x1b9a24['timers'][_0x1168c3]['updateAcw']();}if(_0x1b9a24['agents'][_0x1168c3]){_0x1b9a24[_0xf15e('0xc')][_0x1168c3][_0xf15e('0xd')]({'statePause':_0x490097[_0xf15e('0xe')]?!![]:![]});}_0x2d6e94({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x442d51){var _0x1b8543=this;return new Promise(function(_0x16a04a,_0x5da521){if(ami[_0xf15e('0xf')]()==![]){return _0x5da521(_0x1b8543[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config[_0xf15e('0x11')][_0xf15e('0x12')],_0xf15e('0x13')][_0xf15e('0x14')]('\x20')));}_0x442d51=_[_0xf15e('0x15')](_0x442d51,_['keys'](properties[_0xf15e('0x16')]));_0x442d51[_0xf15e('0x17')]='Reload';return ami[_0xf15e('0x18')](_0x442d51)[_0xf15e('0x19')](function(_0x45e418){_0x16a04a({'code':0xc8,'message':_0x45e418['message']});})['catch'](function(_0x3ad067){_0x5da521(_0x1b8543[_0xf15e('0x10')](0x1f5,_0x3ad067['message']));});});},'Command':function(_0x86d14f){var _0x1f1f33=this;return new Promise(function(_0xa47259,_0x4b144c){if(ami['isConnected']()==![]){return _0x4b144c(_0x1f1f33[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],'ami\x20disconnected']['join']('\x20')));}_0x86d14f=_[_0xf15e('0x15')](_0x86d14f,_0xf15e('0x1a'));_0x86d14f[_0xf15e('0x17')]=_0xf15e('0x1b');return ami['Action'](_0x86d14f)[_0xf15e('0x19')](function(_0xa09c0c){_0xa47259({'code':0xc8,'message':_0xa09c0c[_0xf15e('0x1c')]});})['catch'](function(_0x248c4b){_0x4b144c(_0x1f1f33[_0xf15e('0x10')](0x1f5,_0x248c4b['message']));});});},'VoiceQueues':function(_0x5d381a){return new Promise(function(_0x2e6d94,_0xb36af){var _0x1fd237=[];for(var _0x471079 in _0x1b9a24[_0xf15e('0x1d')]){if(_0x1b9a24['voiceQueues']['hasOwnProperty'](_0x471079)){var _0x3f9d64=_0x1b9a24[_0xf15e('0x1d')][_0x471079];var _0x4a83e5={'id':_0x3f9d64['id'],'name':_0x3f9d64[_0xf15e('0x1e')],'strategy':_0x3f9d64[_0xf15e('0x1f')],'answered':_0x3f9d64[_0xf15e('0x20')],'available':_0x3f9d64[_0xf15e('0x21')],'loggedIn':_0x3f9d64[_0xf15e('0x22')],'pTalking':_0x3f9d64[_0xf15e('0x23')],'sumBillable':_0x3f9d64[_0xf15e('0x24')],'sumDuration':_0x3f9d64[_0xf15e('0x25')],'sumHoldTime':_0x3f9d64['sumHoldTime']||0x0,'talking':_0x3f9d64[_0xf15e('0x26')],'total':_0x3f9d64[_0xf15e('0x27')],'type':_0x3f9d64[_0xf15e('0x28')],'unmanaged':_0x3f9d64['unmanaged'],'abandoned':_0x3f9d64[_0xf15e('0x29')],'waiting':_0x3f9d64[_0xf15e('0x2a')],'loggedInDb':_0x3f9d64['loggedInDb']};if(_0x3f9d64[_0xf15e('0x28')]===_0xf15e('0x2b')){_0x4a83e5[_0xf15e('0x2c')]=_0x3f9d64['dialActive'];_0x4a83e5[_0xf15e('0x2d')]=_0x3f9d64[_0xf15e('0x2d')];_0x4a83e5[_0xf15e('0x2e')]=_0x3f9d64[_0xf15e('0x2e')];_0x4a83e5['dialOriginateCallerIdNumber']=_0x3f9d64[_0xf15e('0x2f')];_0x4a83e5[_0xf15e('0x30')]=_0x3f9d64['dialOriginateTimeout'];_0x4a83e5[_0xf15e('0x31')]=_0x3f9d64[_0xf15e('0x31')];_0x4a83e5[_0xf15e('0x32')]=_0x3f9d64['temp'];_0x4a83e5[_0xf15e('0x33')]=_0x3f9d64[_0xf15e('0x33')];_0x4a83e5['outboundAnswerCallsDay']=_0x3f9d64[_0xf15e('0x34')];_0x4a83e5['outboundBlacklistCallsDay']=_0x3f9d64[_0xf15e('0x35')];_0x4a83e5[_0xf15e('0x36')]=_0x3f9d64['outboundBusyCallsDay'];_0x4a83e5['outboundCongestionCallsDay']=_0x3f9d64[_0xf15e('0x37')];_0x4a83e5[_0xf15e('0x38')]=_0x3f9d64['outboundDropCallsDayACS'];_0x4a83e5[_0xf15e('0x39')]=_0x3f9d64[_0xf15e('0x39')];_0x4a83e5[_0xf15e('0x3a')]=_0x3f9d64[_0xf15e('0x3a')];_0x4a83e5[_0xf15e('0x3b')]=_0x3f9d64[_0xf15e('0x3b')];_0x4a83e5['outboundNoSuchCallsDay']=_0x3f9d64[_0xf15e('0x3c')];_0x4a83e5[_0xf15e('0x3d')]=_0x3f9d64[_0xf15e('0x3d')];_0x4a83e5[_0xf15e('0x3e')]=_0x3f9d64[_0xf15e('0x3e')];_0x4a83e5[_0xf15e('0x3f')]=_0x3f9d64[_0xf15e('0x3f')];_0x4a83e5[_0xf15e('0x40')]=_0x3f9d64['outboundUnknownCallsDay'];_0x4a83e5[_0xf15e('0x41')]=_0x3f9d64['predictiveIntervalAnsweredCalls'];_0x4a83e5[_0xf15e('0x42')]=_0x3f9d64[_0xf15e('0x42')];_0x4a83e5[_0xf15e('0x43')]=_0x3f9d64[_0xf15e('0x43')];_0x4a83e5[_0xf15e('0x44')]=_0x3f9d64[_0xf15e('0x44')];_0x4a83e5['predictiveIntervalDroppedCallsTimeout']=_0x3f9d64[_0xf15e('0x45')];_0x4a83e5[_0xf15e('0x46')]=_0x3f9d64[_0xf15e('0x46')];_0x4a83e5[_0xf15e('0x47')]=_0x3f9d64['predictiveIntervalErlangCallsDroppedCalls'];_0x4a83e5['predictiveIntervalHitRate']=_0x3f9d64[_0xf15e('0x48')];_0x4a83e5[_0xf15e('0x49')]=_0x3f9d64[_0xf15e('0x49')];_0x4a83e5['predictiveIntervalPauses']=_0x3f9d64['predictiveIntervalPauses'];_0x4a83e5['predictiveIntervalAvailable']=_0x3f9d64['predictiveIntervalAvailable'];_0x4a83e5['predictiveIntervalTotalCalls']=_0x3f9d64[_0xf15e('0x4a')];_0x4a83e5[_0xf15e('0x4b')]=_0x3f9d64[_0xf15e('0x4b')];_0x4a83e5['originated']=_0x3f9d64[_0xf15e('0x4c')];_0x4a83e5['erlangCalls']=_0x3f9d64[_0xf15e('0x4d')];_0x4a83e5[_0xf15e('0x4e')]=_0x3f9d64[_0xf15e('0x4e')];_0x4a83e5[_0xf15e('0x4f')]=_0x3f9d64['erlangAbandonmentRate'];_0x4a83e5[_0xf15e('0x50')]=_0x3f9d64[_0xf15e('0x50')];_0x4a83e5[_0xf15e('0x51')]=_0x3f9d64[_0xf15e('0x51')];_0x4a83e5[_0xf15e('0x52')]=_0x3f9d64['startProgressive'];}if(_0x3f9d64[_0xf15e('0x53')]){_0x4a83e5[_0xf15e('0x53')]={'id':_0x3f9d64[_0xf15e('0x53')]['id'],'name':_0x3f9d64[_0xf15e('0x53')][_0xf15e('0x1e')],'active':_0x3f9d64[_0xf15e('0x53')][_0xf15e('0x54')],'callerid':_0x3f9d64['Trunk'][_0xf15e('0x55')]};}if(_0x3f9d64[_0xf15e('0x56')]){_0x4a83e5['Interval']={'id':_0x3f9d64['Interval']['id'],'name':_0x3f9d64[_0xf15e('0x56')]['name']};}_0x1fd237['push'](_0x4a83e5);}}_0x2e6d94({'count':_0x1fd237[_0xf15e('0x57')],'rows':_0x1fd237});});},'UpdateVoiceQueue':function(_0x3d99f8){return new Promise(function(_0x4cdfa6,_0x4becd6){var _0x1f2e17=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x1d')],{'id':parseInt(_0x3d99f8['id'])});var _0x33df95=_[_0xf15e('0x59')](_0x3d99f8,['id']);if(_0x1f2e17){for(var _0x31a916 in _0x33df95){if(typeof _0x33df95[_0x31a916]!==_0xf15e('0x5a')&&typeof _0x1f2e17[_0x31a916]!==_0xf15e('0x5a')){_0x1f2e17[_0x31a916]=_0x33df95[_0x31a916];}}_0x4cdfa6(_0x1f2e17);}else{_0x4becd6();}});},'VoiceChannels':function(_0x4fd67c){return new Promise(function(_0x1dba1c,_0x44f075){var _0x3b79a8=_['values'](_0x1b9a24['channels']);_0x1dba1c({'count':_0x3b79a8[_0xf15e('0x57')],'rows':_0x3b79a8});});},'VoiceChannelMixMonitor':function(_0x368a1f){var _0x382ae5=this;return new Promise(function(_0x3da6fe,_0x1cb428){if(ami[_0xf15e('0xf')]()==![]){return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],_0xf15e('0x13')]['join']('\x20')));}var _0x378492=schema(properties['voicechannel'])[_0xf15e('0x5b')](_0x368a1f);if(_0x378492[_0xf15e('0x57')]>0x0){return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f4,_['map'](_0x378492,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x30c8ac=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x5c')],{'uniqueid':_0x368a1f[_0xf15e('0x5d')]});if(_0x30c8ac&&_0x30c8ac[_0xf15e('0x5e')]){var _0x2507b3=util[_0xf15e('0x7')]('%s.%s',_0x368a1f[_0xf15e('0x5f')]||_0x368a1f[_0xf15e('0x5d')],_0x368a1f[_0xf15e('0x7')]||_0xf15e('0x60'));return ami[_0xf15e('0x18')]({'action':'MixMonitor','channel':_0x30c8ac[_0xf15e('0x5e')],'file':_0x2507b3,'options':_0xf15e('0x61')})[_0xf15e('0x19')](function(_0x25827b){var _0x3235d8=_[_0xf15e('0x58')](_0x30c8ac[_0xf15e('0x62')],{'filename':_0xf15e('0x63')+_0x2507b3[_0xf15e('0x64')]()});if(_[_0xf15e('0x65')](_0x3235d8)){_0x30c8ac[_0xf15e('0x62')][_0xf15e('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2507b3[_0xf15e('0x64')](),'createdAt':moment()[_0xf15e('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x25827b['mixmonitorid'],'status':_0xf15e('0x67')});}else{_0x3235d8[_0xf15e('0x68')]=_0x25827b['mixmonitorid'];_0x3235d8['status']=_0xf15e('0x67');}_0x3da6fe({'code':0xc8,'message':[_0x368a1f[_0xf15e('0x5d')],_0xf15e('0x69'),_0x25827b[_0xf15e('0x68')]][_0xf15e('0x14')]('\x20'),'mixmonitorid':_0x25827b[_0xf15e('0x68')]});})[_0xf15e('0x6a')](function(_0x54efa8){_0x1cb428(_0x382ae5['error'](0x1f5,[_0x368a1f[_0xf15e('0x5d')],_0x54efa8['message'][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x1cb428(_0x382ae5[_0xf15e('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x30b2f3){var _0x295d49=this;return new Promise(function(_0x469a1b,_0x13837c){if(ami['isConnected']()==![]){return _0x13837c(_0x295d49['error'](0x1f4,[config[_0xf15e('0x11')]['ip'],config[_0xf15e('0x11')]['username'],'ami\x20disconnected'][_0xf15e('0x14')]('\x20')));}var _0x1eec69=schema(properties[_0xf15e('0x6b')])[_0xf15e('0x5b')](_0x30b2f3);if(_0x1eec69['length']>0x0){return _0x13837c(_0x295d49['error'](0x1f4,_['map'](_0x1eec69,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x5f1121=_['find'](_0x1b9a24[_0xf15e('0x5c')],{'uniqueid':_0x30b2f3['uniqueid']});if(_0x5f1121){return BPromise['resolve']()['then'](function(){if(_0x5f1121['channel']){return ami['Action']({'action':_0xf15e('0x6c'),'channel':_0x5f1121[_0xf15e('0x5e')],'mixmonitorid':_0x30b2f3[_0xf15e('0x68')]})['catch'](function(_0x4979fd){});}})[_0xf15e('0x19')](function(){if(_0x5f1121[_0xf15e('0x6d')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x5f1121[_0xf15e('0x6d')],'mixmonitorid':_0x30b2f3[_0xf15e('0x68')]})[_0xf15e('0x6a')](function(_0x532f5b){});}})['then'](function(_0x37e0b2){var _0x44cefb=_['find'](_0x5f1121['monitors'],{'mixmonitorid':_0x30b2f3['mixmonitorid']});if(_0x44cefb){_0x44cefb['status']=_0xf15e('0x6e');}})[_0xf15e('0x19')](function(){var _0x53630b=util['format'](_0xf15e('0x6f'),_0x30b2f3['filename']||_0x30b2f3[_0xf15e('0x5d')],_0x30b2f3['format']||_0xf15e('0x60'));var _0x2a3255=_[_0xf15e('0x58')](_0x5f1121['monitors'],{'filename':_0xf15e('0x63')+_0x53630b['toLowerCase']()});if(_0x2a3255){_0x2a3255[_0xf15e('0x70')]=_0xf15e('0x6e');}})[_0xf15e('0x19')](function(){_0x469a1b({'code':0xc8,'message':[_0x30b2f3[_0xf15e('0x5d')],_0xf15e('0x71')][_0xf15e('0x14')]('\x20')});})[_0xf15e('0x6a')](function(_0x2ea42f){_0x13837c(_0x295d49['error'](0x1f5,[_0x30b2f3[_0xf15e('0x5d')],_0x2ea42f['message']['toLowerCase']()][_0xf15e('0x14')]('\x20')));});}else{return _0x13837c(_0x295d49['error'](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannels':function(_0x37ed48){return new Promise(function(_0x2cff3a,_0x2cf9f7){var _0x45a25a=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x74')]);_0x2cff3a({'count':_0x45a25a[_0xf15e('0x57')],'rows':_0x45a25a});});},'VoiceQueuesChannel':function(_0x18b2d2){var _0x8c9b10=this;return new Promise(function(_0x4f57f5,_0x5df791){var _0x72d9b6=schema(properties['voicequeuechannel'])['validate'](_0x18b2d2);if(_0x72d9b6[_0xf15e('0x57')]>0x0){return _0x5df791(_0x8c9b10[_0xf15e('0x10')](0x1f4,_['map'](_0x72d9b6,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x574403=_['find'](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x18b2d2['uniqueid']});if(_0x574403){_0x4f57f5(_0x574403);}else{return _0x5df791(_0x8c9b10[_0xf15e('0x10')](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x30cf00){var _0x380fb2=this;return new Promise(function(_0x19890b,_0x340451){if(ami['isConnected']()==![]){return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf15e('0x12')],_0xf15e('0x13')][_0xf15e('0x14')]('\x20')));}var _0xbf57fb=schema(properties[_0xf15e('0x75')])['validate'](_0x30cf00);if(_0xbf57fb[_0xf15e('0x57')]>0x0){return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f4,_[_0xf15e('0x76')](_0xbf57fb,_0xf15e('0x4b'))[_0xf15e('0x14')](',\x20')));}var _0x482082=_['find'](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x30cf00[_0xf15e('0x5d')]});if(_0x482082&&_0x482082[_0xf15e('0x5e')]){return ami['Action']({'action':'Hangup','channel':_0x482082[_0xf15e('0x5e')]})['then'](function(_0x449164){_0x19890b({'code':0xc8,'message':[_0x30cf00[_0xf15e('0x5d')],_0x449164['message'][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')});})['catch'](function(_0x8c5913){_0x340451(_0x380fb2['error'](0x1f5,[_0x30cf00[_0xf15e('0x5d')],_0x8c5913[_0xf15e('0x4b')][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x340451(_0x380fb2[_0xf15e('0x10')](0x1f5,_0xf15e('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x4d320f){var _0x5025bb=this;return new Promise(function(_0x3c1ac2,_0x18bc85){if(ami['isConnected']()==![]){return _0x18bc85(_0x5025bb['error'](0x1f4,[config[_0xf15e('0x11')]['ip'],config['asterisk'][_0xf15e('0x12')],'ami\x20disconnected'][_0xf15e('0x14')]('\x20')));}var _0x474c24=schema(properties['voicequeuechannelredirect'])[_0xf15e('0x5b')](_0x4d320f);if(_0x474c24['length']>0x0){return _0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f4,_[_0xf15e('0x76')](_0x474c24,_0xf15e('0x4b'))['join'](',\x20')));}var _0x40beaf=_[_0xf15e('0x58')](_0x1b9a24[_0xf15e('0x74')],{'uniqueid':_0x4d320f[_0xf15e('0x5d')]});if(_0x40beaf&&_0x40beaf[_0xf15e('0x5e')]){return ami['Action']({'action':'Redirect','channel':_0x40beaf[_0xf15e('0x5e')],'exten':_0x4d320f[_0xf15e('0x77')],'context':_0x4d320f[_0xf15e('0x78')]||_0x40beaf['context'],'priority':0x1})[_0xf15e('0x19')](function(_0x346ed4){_0x3c1ac2({'code':0xc8,'message':[_0x4d320f[_0xf15e('0x5d')],_0x346ed4[_0xf15e('0x4b')]['toLowerCase']()][_0xf15e('0x14')]('\x20')});})[_0xf15e('0x6a')](function(_0x91a322){_0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f5,[_0x4d320f[_0xf15e('0x5d')],_0x91a322[_0xf15e('0x4b')][_0xf15e('0x64')]()][_0xf15e('0x14')]('\x20')));});}else{return _0x18bc85(_0x5025bb[_0xf15e('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x34ee2f){return new Promise(function(_0x56e37c,_0x1484a4){var _0x1108bd=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0xc')]);_0x56e37c({'count':_0x1108bd['length'],'rows':_0x1108bd});});},'Telephones':function(_0x4f251c){return new Promise(function(_0x4a6ea5,_0x4ba658){var _0x532693=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x79')]);_0x4a6ea5({'count':_0x532693[_0xf15e('0x57')],'rows':_0x532693});});},'Trunks':function(_0x2450b1){return new Promise(function(_0x459d82,_0xcee4f5){var _0x387a2c=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x7a')]);_0x459d82({'count':_0x387a2c['length'],'rows':_0x387a2c});});},'OutboundChannels':function(_0x425290){return new Promise(function(_0x10406e,_0x4a3a36){var _0x299be3=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x7b')]);_0x10406e({'count':_0x299be3[_0xf15e('0x57')],'rows':_0x299be3});});},'Outbound':function(_0x48414e){return new Promise(function(_0x44c30b,_0x40f151){_0x44c30b(_0x1b9a24[_0xf15e('0x2b')]);});},'Campaigns':function(_0x39f9ce){return new Promise(function(_0x426b4b,_0x1bf82a){var _0xdf7775=_['values'](_0x1b9a24[_0xf15e('0x7c')]);_0x426b4b({'count':_0xdf7775[_0xf15e('0x57')],'rows':_0xdf7775});});},'VoiceQueuesPreview':function(_0x51d84b){var _0x295a21=this;return new Promise(function(_0x402613,_0x5b1c88){_0x5c0553[_0xf15e('0x7d')](_0x51d84b['id'])[_0xf15e('0x19')](function(_0x228a23){_0x402613({'code':0xc8,'message':_0x228a23['message']});})[_0xf15e('0x6a')](function(_0x8f566e){_0x5b1c88(_0x295a21[_0xf15e('0x10')](0x1f4,_0x8f566e[_0xf15e('0x4b')]));});});},'EventManager':function(_0x412200){var _0x3a9705=this;return new Promise(function(_0x1c2891,_0x4ee137){if(!_0x412200[_0xf15e('0x7e')]){return _0x4ee137(_0x3a9705[_0xf15e('0x10')](0x1f4,_0xf15e('0x7f')));}ami[_0xf15e('0x80')](_0xf15e('0x81')+_0x412200['event'],_0x412200['message']);_0x1c2891({'code':0xc8,'message':_0x412200});});},'FaxAccounts':function(_0x51819f){return new Promise(function(_0x26591d,_0x1a9e87){var _0x863deb=_[_0xf15e('0x73')](_0x1b9a24[_0xf15e('0x82')]);_0x26591d({'count':_0x863deb[_0xf15e('0x57')],'rows':_0x863deb});});},'SendFax':function(_0x22f526){var _0x49f1b4=this;return new Promise(function(_0x3daaf6,_0x27f242){_0x5e96b4[_0xf15e('0x83')](_0x22f526)['then'](function(_0x528d11){_0x3daaf6({'code':0xc8,'message':_0x528d11['message']});})[_0xf15e('0x6a')](function(_0x3f9a36){_0x27f242(_0x49f1b4[_0xf15e('0x10')](0x1f4,_0x3f9a36[_0xf15e('0x4b')]));});});},'CheckAfterSend':function(_0x369af7){var _0x29f953=this;return new Promise(function(_0x3a9b61,_0x38851f){_0x5e96b4[_0xf15e('0x84')](_0x369af7)[_0xf15e('0x19')](function(_0x17d407){_0x3a9b61({'code':0xc8,'message':_0x17d407[_0xf15e('0x4b')]});})[_0xf15e('0x6a')](function(_0x40b26e){_0x38851f(_0x29f953[_0xf15e('0x10')](0x1f4,_0x40b26e['message']));});});}};var _0x3f1966=jayson[_0xf15e('0x85')](_0x232359)[_0xf15e('0x86')]();_0x3f1966['on']('error',function(_0xd854c8){return _0x66708e(_0xd854c8);});_0x3f1966[_0xf15e('0x87')](0x232a,_0xf15e('0x88'),function(){console['log'](_0xf15e('0x89'),0x232a);return _0x5ba863(_0xf15e('0x8a')+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 aa227f0..ece283d 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 _0x05b8=['merge','length','lodash','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','xmd-contactid','data3','split','phone','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','ListId','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s'];(function(_0x50b16c,_0x5e9cce){var _0x4e939a=function(_0x9f560){while(--_0x9f560){_0x50b16c['push'](_0x50b16c['shift']());}};_0x4e939a(++_0x5e9cce);}(_0x05b8,0xde));var _0x805b=function(_0x36ed28,_0xdc5689){_0x36ed28=_0x36ed28-0x0;var _0x34a5db=_0x05b8[_0x36ed28];return _0x34a5db;};'use strict';var _=require(_0x805b('0x0'));var BPromise=require('bluebird');var Redis=require(_0x805b('0x1'));var util=require(_0x805b('0x2'));var config=require(_0x805b('0x3'));var logger=require('../../../../config/logger')(_0x805b('0x4'));var cmContactRpc=require(_0x805b('0x5'));config[_0x805b('0x6')]=_[_0x805b('0x7')](config[_0x805b('0x6')],{'host':_0x805b('0x8'),'port':0x18eb});var io=require(_0x805b('0x9'))(new Redis(config[_0x805b('0x6')]));function emit(_0x12f46b,_0x4831f9,_0xc6c028,_0x1d8285,_0x183a31){logger[_0x805b('0xa')](_0x805b('0xb'),_0x12f46b,_0x4831f9['id'],_0xc6c028,_0x1d8285,JSON[_0x805b('0xc')](_0x183a31));io['to'](_0xc6c028)[_0x805b('0xd')](_0x1d8285,_0x183a31);}exports['exec']=function(_0x41a63a,_0x471cec,_0x1cb85c,_0x2adee2){var _0x325c0c,_0x3bb53a;var _0x104024={};var _0x10fa95=Number(_0x1cb85c[_0x805b('0xe')]);var _0x3c08f8=_0x1cb85c[_0x805b('0xf')]?Boolean(Number(_0x1cb85c[_0x805b('0xf')])):![];var _0x2e4b79;if(_0x2adee2[_0x805b('0x10')]){_0x104024['id']=_0x2adee2['xmd-contactid'];}if(!_0x104024['id']){_0x104024['ListId']=_0x10fa95;_0x2e4b79=_0x1cb85c['data3']&&_0x1cb85c[_0x805b('0x11')]!=='0'?_0x1cb85c[_0x805b('0x11')][_0x805b('0x12')](','):[_0x805b('0x13')];_0x104024['$or']=_[_0x805b('0x14')](_0x2e4b79,function(_0x148b3d){var _0x45286e={};_0x45286e[_0x148b3d]=_0x2adee2[_0x805b('0x15')]?_0x2adee2[_0x805b('0x16')]:_0x2adee2[_0x805b('0x17')];return _0x45286e;});}var _0x49074e=['id',_0x805b('0x18'),_0x805b('0x19'),_0x805b('0x13'),_0x805b('0x1a'),'fax',_0x805b('0x1b'),_0x805b('0x1c'),_0x805b('0x1d'),_0x805b('0x1e')];var _0x1ad5b0=_[_0x805b('0x1f')](_0x49074e,_0x2e4b79);BPromise[_0x805b('0x20')]()[_0x805b('0x21')](cmContactRpc['getContacts']({'attributes':_0x1ad5b0,'where':_0x104024}))['then'](function(_0x264e38){_0x3bb53a=_0x264e38;if(!_[_0x805b('0x22')](_0x3bb53a)){if(_0x3bb53a['length']===0x1){_0x325c0c=_0x3bb53a[0x0];logger['info'](_0x805b('0x23'),_0x2adee2[_0x805b('0x24')],_0x471cec['id'],_0x325c0c['id']);}else{logger['info'](_0x805b('0x25'),_0x2adee2[_0x805b('0x24')],_0x471cec['id'],_[_0x805b('0x14')](_0x3bb53a,'id')[_0x805b('0x26')](','));}return;}else{logger[_0x805b('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2adee2['uniqueid'],_0x471cec['id']);var _0x5d0d32={'ListId':_0x10fa95};var _0x12a01b=_0x1cb85c[_0x805b('0x27')]&&_0x1cb85c[_0x805b('0x27')]!=='0'?_0x1cb85c[_0x805b('0x27')]:_0x805b('0x13');if(_0x3c08f8){logger[_0x805b('0xa')](_0x805b('0x28'),_0x2adee2[_0x805b('0x24')],_0x471cec['id']);_0x5d0d32[_0x12a01b]=_[_0x805b('0x29')](_0x2adee2[_0x805b('0x15')])?_0x2adee2[_0x805b('0x17')]:_0x2adee2[_0x805b('0x16')];if(_['isNil'](_0x2adee2[_0x805b('0x15')])){_0x5d0d32['firstName']=_0x2adee2[_0x805b('0x2a')]&&_0x2adee2[_0x805b('0x2a')]!==_0x805b('0x2b')?_0x2adee2['calleridname']:_0x805b('0x2c');}else{_0x5d0d32[_0x805b('0x18')]=_0x2adee2[_0x805b('0x2d')]&&_0x2adee2['destcalleridname']!==_0x805b('0x2b')?_0x2adee2[_0x805b('0x2d')]:_0x805b('0x2c');}return BPromise['resolve']()[_0x805b('0x21')](cmContactRpc[_0x805b('0x2e')](_0x5d0d32))[_0x805b('0x21')](function(_0x4b0772){_0x325c0c=_0x4b0772;_0x3bb53a[_0x805b('0x2f')](_0x4b0772);if(_0x325c0c){logger[_0x805b('0xa')](_0x805b('0x30'),_0x2adee2['uniqueid'],_0x471cec['id'],_0x325c0c['id']);}return;});}else{logger[_0x805b('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2adee2['uniqueid'],_0x471cec['id']);_0x5d0d32[_0x12a01b]=_[_0x805b('0x29')](_0x2adee2[_0x805b('0x15')])?_0x2adee2[_0x805b('0x17')]:_0x2adee2['destcalleridnum'];if(_['isNil'](_0x2adee2[_0x805b('0x15')])){_0x5d0d32[_0x805b('0x18')]=_0x2adee2[_0x805b('0x2a')]&&_0x2adee2[_0x805b('0x2a')]!==''?_0x2adee2[_0x805b('0x2a')]:'Unknown';}else{_0x5d0d32[_0x805b('0x18')]=_0x2adee2[_0x805b('0x2d')]&&_0x2adee2[_0x805b('0x2d')]!==''?_0x2adee2[_0x805b('0x2d')]:_0x805b('0x2c');}_0x325c0c=_0x5d0d32;_0x3bb53a['push'](_0x5d0d32);return;}}})[_0x805b('0x21')](function(){if(_0x41a63a){emit(_0x2adee2[_0x805b('0x24')],_0x471cec,util[_0x805b('0x31')](_0x805b('0x32'),_0x41a63a[_0x805b('0x33')]),util['format'](_0x805b('0x34'),_0x1cb85c['action']['toLowerCase']()),{'evt':_[_0x805b('0x35')](_0x2adee2,{'autoCreate':_0x3c08f8}),'contact':_0x325c0c===undefined?{}:_0x325c0c,'contacts':_0x3bb53a[_0x805b('0x36')]===0x0?undefined:_0x3bb53a});}});}; \ No newline at end of file +var _0x7530=['ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','localhost','socket.io-emitter','redis','[CM][%s][%s]','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','toLowerCase','lodash','bluebird'];(function(_0x295894,_0x12c140){var _0xe8e75a=function(_0x1387bd){while(--_0x1387bd){_0x295894['push'](_0x295894['shift']());}};_0xe8e75a(++_0x12c140);}(_0x7530,0x125));var _0x0753=function(_0x3b8774,_0x301a46){_0x3b8774=_0x3b8774-0x0;var _0x5bcfcc=_0x7530[_0x3b8774];return _0x5bcfcc;};'use strict';var _=require(_0x0753('0x0'));var BPromise=require(_0x0753('0x1'));var Redis=require(_0x0753('0x2'));var util=require(_0x0753('0x3'));var config=require(_0x0753('0x4'));var logger=require(_0x0753('0x5'))('trigger');var cmContactRpc=require(_0x0753('0x6'));config['redis']=_[_0x0753('0x7')](config['redis'],{'host':_0x0753('0x8'),'port':0x18eb});var io=require(_0x0753('0x9'))(new Redis(config[_0x0753('0xa')]));function emit(_0x1937b4,_0x1794dd,_0x1ede2a,_0x180f00,_0x423b5a){logger['info'](_0x0753('0xb'),_0x1937b4,_0x1794dd['id'],_0x1ede2a,_0x180f00,JSON['stringify'](_0x423b5a));io['to'](_0x1ede2a)[_0x0753('0xc')](_0x180f00,_0x423b5a);}exports[_0x0753('0xd')]=function(_0x3d3dce,_0x948dc1,_0x5b129f,_0x19c5b7){var _0x3ddb5d,_0x44c38d;var _0xc401fa={};var _0x560592=Number(_0x5b129f[_0x0753('0xe')]);var _0x1030af=_0x5b129f[_0x0753('0xf')]?Boolean(Number(_0x5b129f[_0x0753('0xf')])):![];var _0xc14310;if(_0x19c5b7[_0x0753('0x10')]){_0xc401fa['id']=_0x19c5b7[_0x0753('0x10')];}if(!_0xc401fa['id']){_0xc401fa[_0x0753('0x11')]=_0x560592;_0xc14310=_0x5b129f['data3']&&_0x5b129f[_0x0753('0x12')]!=='0'?_0x5b129f[_0x0753('0x12')][_0x0753('0x13')](','):[_0x0753('0x14')];_0xc401fa[_0x0753('0x15')]=_[_0x0753('0x16')](_0xc14310,function(_0x352ae0){var _0x433059={};_0x433059[_0x352ae0]=_0x19c5b7[_0x0753('0x17')]?_0x19c5b7[_0x0753('0x18')]:_0x19c5b7['calleridnum'];return _0x433059;});}var _0xedfa91=['id',_0x0753('0x19'),'lastName',_0x0753('0x14'),_0x0753('0x1a'),_0x0753('0x1b'),_0x0753('0x11'),_0x0753('0x1c'),_0x0753('0x1d'),_0x0753('0x1e')];var _0xc169b0=_[_0x0753('0x1f')](_0xedfa91,_0xc14310);BPromise[_0x0753('0x20')]()['then'](cmContactRpc[_0x0753('0x21')]({'attributes':_0xc169b0,'where':_0xc401fa}))[_0x0753('0x22')](function(_0x3ced99){_0x44c38d=_0x3ced99;if(!_[_0x0753('0x23')](_0x44c38d)){if(_0x44c38d[_0x0753('0x24')]===0x1){_0x3ddb5d=_0x44c38d[0x0];logger[_0x0753('0x25')](_0x0753('0x26'),_0x19c5b7[_0x0753('0x27')],_0x948dc1['id'],_0x3ddb5d['id']);}else{logger[_0x0753('0x25')](_0x0753('0x28'),_0x19c5b7[_0x0753('0x27')],_0x948dc1['id'],_[_0x0753('0x16')](_0x44c38d,'id')[_0x0753('0x29')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x19c5b7[_0x0753('0x27')],_0x948dc1['id']);var _0x191697={'ListId':_0x560592};var _0x57832a=_0x5b129f[_0x0753('0x2a')]&&_0x5b129f[_0x0753('0x2a')]!=='0'?_0x5b129f[_0x0753('0x2a')]:'phone';if(_0x1030af){logger[_0x0753('0x25')](_0x0753('0x2b'),_0x19c5b7[_0x0753('0x27')],_0x948dc1['id']);_0x191697[_0x57832a]=_[_0x0753('0x2c')](_0x19c5b7[_0x0753('0x17')])?_0x19c5b7[_0x0753('0x2d')]:_0x19c5b7[_0x0753('0x18')];if(_[_0x0753('0x2c')](_0x19c5b7['routeId'])){_0x191697[_0x0753('0x19')]=_0x19c5b7[_0x0753('0x2e')]&&_0x19c5b7[_0x0753('0x2e')]!==_0x0753('0x2f')?_0x19c5b7[_0x0753('0x2e')]:'Unknown';}else{_0x191697[_0x0753('0x19')]=_0x19c5b7[_0x0753('0x30')]&&_0x19c5b7[_0x0753('0x30')]!==_0x0753('0x2f')?_0x19c5b7[_0x0753('0x30')]:_0x0753('0x31');}return BPromise[_0x0753('0x20')]()['then'](cmContactRpc[_0x0753('0x32')](_0x191697))[_0x0753('0x22')](function(_0x14f1a9){_0x3ddb5d=_0x14f1a9;_0x44c38d[_0x0753('0x33')](_0x14f1a9);if(_0x3ddb5d){logger[_0x0753('0x25')](_0x0753('0x34'),_0x19c5b7[_0x0753('0x27')],_0x948dc1['id'],_0x3ddb5d['id']);}return;});}else{logger[_0x0753('0x25')](_0x0753('0x35'),_0x19c5b7[_0x0753('0x27')],_0x948dc1['id']);_0x191697[_0x57832a]=_[_0x0753('0x2c')](_0x19c5b7[_0x0753('0x17')])?_0x19c5b7[_0x0753('0x2d')]:_0x19c5b7[_0x0753('0x18')];if(_[_0x0753('0x2c')](_0x19c5b7[_0x0753('0x17')])){_0x191697['firstName']=_0x19c5b7[_0x0753('0x2e')]&&_0x19c5b7['calleridname']!==_0x0753('0x2f')?_0x19c5b7[_0x0753('0x2e')]:_0x0753('0x31');}else{_0x191697[_0x0753('0x19')]=_0x19c5b7[_0x0753('0x30')]&&_0x19c5b7[_0x0753('0x30')]!==_0x0753('0x2f')?_0x19c5b7[_0x0753('0x30')]:_0x0753('0x31');}_0x3ddb5d=_0x191697;_0x44c38d['push'](_0x191697);return;}}})[_0x0753('0x22')](function(){if(_0x3d3dce){emit(_0x19c5b7[_0x0753('0x27')],_0x948dc1,util[_0x0753('0x36')](_0x0753('0x37'),_0x3d3dce[_0x0753('0x38')]),util[_0x0753('0x36')]('trigger:%s',_0x5b129f[_0x0753('0x39')][_0x0753('0x3a')]()),{'evt':_['merge'](_0x19c5b7,{'autoCreate':_0x1030af}),'contact':_0x3ddb5d===undefined?{}:_0x3ddb5d,'contacts':_0x44c38d[_0x0753('0x24')]===0x0?undefined:_0x44c38d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6195e35..9e6b004 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 _0x6606=['buildUri','parse','search','replace','checkTrigger','AllConditions','every','checkConditions','AnyConditions','some','channel','account','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent','util','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','interface','merge','variables','Actions','length','action','toLowerCase','motionbar','browser','data2','render','html','template\x20not\x20found','uri','data3','isNil','data4','windowWidth','data5','800','data6','winapp','winApplication','winArguments','format','name','trigger:%s:%s','jscripty','trigger:%s','data1','user:%s','exec','integration','queue','routeId','urlforward','script'];(function(_0x2f7be9,_0x173b28){var _0x22b2ad=function(_0x2f50e4){while(--_0x2f50e4){_0x2f7be9['push'](_0x2f7be9['shift']());}};_0x22b2ad(++_0x173b28);}(_0x6606,0x101));var _0x6660=function(_0x53602d,_0x46458b){_0x53602d=_0x53602d-0x0;var _0x3f93e8=_0x6606[_0x53602d];return _0x3f93e8;};'use strict';var util=require(_0x6660('0x0'));var _=require('lodash');var url=require(_0x6660('0x1'));var Mustache=require(_0x6660('0x2'));var Redis=require(_0x6660('0x3'));var urlforward=require(_0x6660('0x4'));var integration=require(_0x6660('0x5'));var cmContact=require(_0x6660('0x6'));var script=require(_0x6660('0x7'));var config=require(_0x6660('0x8'));var logger=require(_0x6660('0x9'))('trigger');var ami=require(_0x6660('0xa'));config[_0x6660('0xb')]=_[_0x6660('0xc')](config[_0x6660('0xb')],{'host':_0x6660('0xd'),'port':0x18eb});var io=require(_0x6660('0xe'))(new Redis(config[_0x6660('0xb')]));var operators={'equals':function(_0x92a278,_0x42e92f){return _0x92a278==_0x42e92f;},'not_equals':function(_0x4c6298,_0x3b2ca2){return _0x4c6298!=_0x3b2ca2;}};var barAndWebActions=[_0x6660('0xf'),_0x6660('0x1'),'winapp'];function Trigger(_0x474d31){this['triggers']=_0x474d31[_0x6660('0x10')];this[_0x6660('0x11')]=_0x474d31[_0x6660('0x11')];this[_0x6660('0x12')]=_0x474d31[_0x6660('0x12')];this[_0x6660('0x13')]=_0x474d31[_0x6660('0x13')];this[_0x6660('0x14')]=_0x474d31['voiceExtensions'];this[_0x6660('0x15')]=_0x474d31[_0x6660('0x15')];this[_0x6660('0x16')]=_0x474d31[_0x6660('0x16')];this[_0x6660('0x17')]=_0x474d31['salesforceAccounts'];this[_0x6660('0x18')]=_0x474d31[_0x6660('0x18')];this[_0x6660('0x19')]=_0x474d31[_0x6660('0x19')];this[_0x6660('0x1a')]=_0x474d31[_0x6660('0x1a')];this['vtigerAccounts']=_0x474d31[_0x6660('0x1b')];this[_0x6660('0x1c')]=_0x474d31[_0x6660('0x1c')];this[_0x6660('0x1d')]=_0x474d31[_0x6660('0x1d')];this[_0x6660('0x1e')]=_0x474d31[_0x6660('0x1e')];this[_0x6660('0x1f')]={'zendesk':this[_0x6660('0x15')],'salesforce':this[_0x6660('0x17')],'freshdesk':this[_0x6660('0x16')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x6660('0x19')],'desk':this[_0x6660('0x1a')],'vtiger':this[_0x6660('0x1b')],'dynamics365':this[_0x6660('0x1d')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0x6660('0x20'),this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x23'),this['syncCustomEvent'][_0x6660('0x22')](this));ami['on']('custom:agentringnoanswer',this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x24'),this[_0x6660('0x21')]['bind'](this));ami['on'](_0x6660('0x25'),this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x26'),this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x27'),this['syncCustomEvent'][_0x6660('0x22')](this));ami['on']('custom:agentcongestion',this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x28'),this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x29'),this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on']('custom:queuecallerabandon',this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on']('custom:timeout',this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x2a'),this[_0x6660('0x2b')][_0x6660('0x22')](this));ami['on'](_0x6660('0x2c'),this[_0x6660('0x2b')][_0x6660('0x22')](this));ami['on'](_0x6660('0x2d'),this[_0x6660('0x2b')][_0x6660('0x22')](this));ami['on'](_0x6660('0x2e'),this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x2f'),this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x30'),this[_0x6660('0x21')][_0x6660('0x22')](this));ami['on'](_0x6660('0x31'),this[_0x6660('0x21')]['bind'](this));ami['on']('custom:acceptmessage',this[_0x6660('0x21')]['bind'](this));ami['on'](_0x6660('0x32'),this[_0x6660('0x21')][_0x6660('0x22')](this));}Trigger[_0x6660('0x33')][_0x6660('0x34')]=function(_0x26ed5d,_0x1c878f,_0x330ee3){logger[_0x6660('0x35')](_0x26ed5d,_0x1c878f,JSON[_0x6660('0x36')](_0x330ee3));io['to'](_0x26ed5d)['emit'](_0x1c878f,_0x330ee3);};Trigger[_0x6660('0x33')][_0x6660('0x21')]=function(_0x188726){var _0x2273a6=_[_0x6660('0x37')](_0x188726);this[_0x6660('0x38')](_0x2273a6);};Trigger[_0x6660('0x33')][_0x6660('0x2b')]=function(_0x428a73){if(this[_0x6660('0x11')][_0x428a73[_0x6660('0x39')]]){this[_0x6660('0x21')](_0x428a73);}};Trigger[_0x6660('0x33')][_0x6660('0x38')]=function(_0x3bc7c5){var _0x973ecd;for(var _0x146c05 in this[_0x6660('0x10')]){if(this[_0x6660('0x10')]['hasOwnProperty'](_0x146c05)){if(this[_0x6660('0x10')][_0x146c05]['status']){_0x973ecd=this['checkTrigger'](this[_0x6660('0x10')][_0x146c05],_0x3bc7c5);if(_0x973ecd){_[_0x6660('0x3a')](_0x3bc7c5,_0x3bc7c5[_0x6660('0x3b')]);for(var _0x54051f=0x0,_0x1a779d,_0x35c53c,_0x23c56d;_0x54051f0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x326f,0xd1));var _0xf326=function(_0x19b240,_0x3a9ba3){_0x19b240=_0x19b240-0x0;var _0x42a4d6=_0x326f[_0x19b240];return _0x42a4d6;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 44fbde5..ca18439 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 _0x3dc3=['/contacts(','phonecall','phonecalls','callDirection','queue','Fields','ticketId','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','format','https://login.microsoftonline.com/%s/oauth2/token','tenantId','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','4.0','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions'];(function(_0x5105e8,_0x44a2e0){var _0x53bbf5=function(_0x29dfb8){while(--_0x29dfb8){_0x5105e8['push'](_0x5105e8['shift']());}};_0x53bbf5(++_0x44a2e0);}(_0x3dc3,0xea));var _0x33dc=function(_0x14cbc9,_0x2df49e){_0x14cbc9=_0x14cbc9-0x0;var _0x42c5b3=_0x3dc3[_0x14cbc9];return _0x42c5b3;};'use strict';var _=require(_0x33dc('0x0'));var BPromise=require('bluebird');var rp=require(_0x33dc('0x1'));var util=require(_0x33dc('0x2'));var intUtil=require(_0x33dc('0x3'));var md5=require(_0x33dc('0x4'));var Redis=require(_0x33dc('0x5'));var logger=require(_0x33dc('0x6'))(_0x33dc('0x7'));var config=require(_0x33dc('0x8'));config['redis']=_['defaults'](config[_0x33dc('0x9')],{'host':_0x33dc('0xa'),'port':0x18eb});var io=require(_0x33dc('0xb'))(new Redis(config[_0x33dc('0x9')]));function getAuthToken(_0x8876c8,_0x2747ba,_0x3ab27a){var _0x5ca9a9={'method':_0x33dc('0xc'),'uri':_0x2747ba,'form':{'client_id':_0x8876c8[_0x33dc('0xd')],'resource':_0x8876c8[_0x33dc('0xe')],'username':_0x8876c8['username'],'password':_0x8876c8[_0x33dc('0xf')],'grant_type':_0x33dc('0xf'),'client_secret':_0x8876c8[_0x33dc('0x10')]},'json':!![]};return rp(_0x5ca9a9)['then'](function(_0x17bec5){return _0x17bec5[_0x33dc('0x11')];})['catch'](function(_0x4dc15a){logger['error']('['+[_0x3ab27a[_0x33dc('0x12')]()]+_0x33dc('0x13'));return _0x4dc15a[_0x33dc('0x14')];});}function getUser(_0x3e0e70,_0x2a6d10,_0x576e62,_0x1d3f0c,_0x57014b,_0x5c2baf){return new BPromise(function(_0x852cc4,_0x356c59){return getAuthToken(_0x2a6d10,_0x1d3f0c,_0x5c2baf)[_0x33dc('0x15')](function(_0x3c5394){var _0x2255c9={'method':_0x33dc('0x16'),'uri':_0x57014b+_0x33dc('0x17'),'headers':{'Authorization':'Bearer\x20'+_0x3c5394,'OData-Version':'4.0'},'json':!![]};return rp(_0x2255c9);})[_0x33dc('0x15')](function(_0xe6fe09){var _0x3e6aa2=_0xe6fe09[_0x33dc('0x18')];var _0x1a0fd9=![];var _0x4f562f=null;if(!_[_0x33dc('0x19')](_0x576e62)){if(intUtil[_0x33dc('0x1a')](_0x576e62[_0x33dc('0x1b')])){_0x3e0e70[_0x33dc('0x1c')]=_0x576e62[_0x33dc('0x1b')];for(_0x4f562f=0x0;_0x4f562f<_0x3e6aa2[_0x33dc('0x1d')];_0x4f562f++){if(_0x3e6aa2[_0x4f562f][_0x33dc('0x1e')]===_0x576e62[_0x33dc('0x1b')]&&!_0x3e6aa2[_0x4f562f][_0x33dc('0x1f')]){_0x1a0fd9=!![];logger[_0x33dc('0x20')]('['+[_0x5c2baf['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x3e6aa2[_0x4f562f][_0x33dc('0x21')]+'!');_0x3e0e70[_0x33dc('0x22')]=_0x3e6aa2[_0x4f562f][_0x33dc('0x21')];}}}}if(!_0x1a0fd9){logger[_0x33dc('0x20')]('['+[_0x5c2baf[_0x33dc('0x12')]()]+_0x33dc('0x23'));_0x3e0e70[_0x33dc('0x1c')]=_0x2a6d10[_0x33dc('0x24')];for(_0x4f562f=0x0;_0x4f562f<_0x3e6aa2[_0x33dc('0x1d')];_0x4f562f++){if(_0x3e6aa2[_0x4f562f][_0x33dc('0x1e')]===_0x2a6d10[_0x33dc('0x24')]){_0x3e0e70[_0x33dc('0x22')]=_0x3e6aa2[_0x4f562f][_0x33dc('0x21')];}}}_0x852cc4(_0x3e0e70);})[_0x33dc('0x25')](function(_0x25dd1a){_0x356c59(_0x25dd1a['message']);});});}function createEndUser(_0x3b580e,_0x1f7ef4,_0x37965d,_0xa2821c,_0x519e4e,_0x1047cf){return new BPromise(function(_0x315832,_0x3aac91){return getAuthToken(_0x1f7ef4,_0x37965d,_0x1047cf)[_0x33dc('0x15')](function(_0x408ba8){var _0x4ea028=_0x1047cf[_0x33dc('0x26')]()===_0x33dc('0x27')?_0x519e4e[_0x33dc('0x28')]:_0x519e4e[_0x33dc('0x29')];var _0x2d46f3={'method':_0x33dc('0xc'),'uri':_0xa2821c+_0x33dc('0x2a'),'body':{'telephone1':_0x4ea028,'fullname':_0x4ea028,'firstname':_0x4ea028,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x33dc('0x2b')+_0x3b580e['userId']+')'},'headers':{'Authorization':_0x33dc('0x2c')+_0x408ba8,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2d46f3);})[_0x33dc('0x15')](function(_0x592534){var _0x3c9095=_0x592534[_0x33dc('0x2d')][_0x33dc('0x2e')];var _0x1b28fc=_0x3c9095[_0x33dc('0x2f')](_0x3c9095[_0x33dc('0x30')]('(')+0x1,_0x3c9095[_0x33dc('0x30')](')'));_0x3b580e[_0x33dc('0x31')]=_0x1b28fc;_0x315832(_0x3b580e);})[_0x33dc('0x25')](function(_0x5aeba7){_0x3aac91(_0x5aeba7[_0x33dc('0x14')]);});});}function getEndUser(_0x187b57,_0x2ffe3e,_0x420afb,_0x7da940,_0x5179a4,_0x5bea4c){return new BPromise(function(_0x470195,_0x556c01){var _0x3a551e=_0x5bea4c[_0x33dc('0x26')]()===_0x33dc('0x27')?_0x5179a4['destcalleridnum']:_0x5179a4[_0x33dc('0x29')];return getAuthToken(_0x2ffe3e,_0x420afb,_0x5bea4c)[_0x33dc('0x15')](function(_0x202685){var _0x51d0c4={'method':_0x33dc('0x16'),'uri':_0x7da940+_0x33dc('0x32')+_0x3a551e[_0x33dc('0x33')]('+',_0x33dc('0x34'))+'\x27','headers':{'Authorization':_0x33dc('0x2c')+_0x202685,'If-None-Match':null,'OData-Version':_0x33dc('0x35')},'json':!![]};return rp(_0x51d0c4);})[_0x33dc('0x15')](function(_0x14e722){var _0x2ceee7=null;if(_0x14e722){var _0x47ec12=_0x14e722['value'];var _0x2a15cf=![];for(_0x2ceee7=0x0;_0x2ceee7<_0x47ec12[_0x33dc('0x1d')];_0x2ceee7++){if(_0x47ec12[_0x2ceee7][_0x33dc('0x36')]===_0x3a551e){_0x2a15cf=!![];_0x187b57[_0x33dc('0x31')]=_0x47ec12[_0x2ceee7]['contactid'];}}if(_0x2a15cf){_0x470195(_0x187b57);}else{return createEndUser(_0x187b57,_0x2ffe3e,_0x420afb,_0x7da940,_0x5179a4,_0x5bea4c)[_0x33dc('0x15')](function(_0x55228c){logger[_0x33dc('0x20')]('['+[_0x5bea4c[_0x33dc('0x12')]()]+_0x33dc('0x37'),_0x55228c[_0x33dc('0x31')]);_0x470195(_0x55228c);});}}else{return createEndUser(_0x187b57,_0x2ffe3e,_0x420afb,_0x7da940,_0x5179a4,_0x5bea4c)[_0x33dc('0x15')](function(_0x2a35fc){logger[_0x33dc('0x20')]('['+[_0x5bea4c[_0x33dc('0x12')]()]+_0x33dc('0x38'),_0x2a35fc[_0x33dc('0x31')]);_0x470195(_0x2a35fc);});}});});}function getCustomFields(_0x92d0ad,_0x507564,_0x16216b){var _0x264af9={};if(_0x92d0ad[_0x33dc('0x1d')]>0x0){_[_0x33dc('0x39')](_0x92d0ad,function(_0x4904d9){if(_['includes']([_0x33dc('0x3a'),_0x33dc('0x3b')],_0x4904d9[_0x33dc('0x3c')])&&_0x4904d9[_0x33dc('0x3d')]&&!_0x4904d9['customField']){var _0x287c33=_0x4904d9[_0x33dc('0x3e')][_0x33dc('0x26')]();var _0xfd18fe=_0x287c33['substring'](0x0,_0x287c33[_0x33dc('0x3f')]('_'));var _0x721892=_0x287c33[_0x33dc('0x2f')](_0x287c33['indexOf']('_')+0x1);if(_0xfd18fe===_0x16216b){_0x264af9[_0x721892]=_0x4904d9[_0x33dc('0x40')];}}});}return _0x264af9;}function getTicket(_0x19f560,_0x3553a7,_0x101b29,_0x4470e5,_0x563f4b,_0x324c22,_0x5844fe){return new BPromise(function(_0x343aae,_0x1bfb13){var _0xbbb4db;return getAuthToken(_0x3553a7,_0x101b29,_0x5844fe)['then'](function(_0xa835d9){if(_0x324c22[_0x33dc('0x41')]===_0x33dc('0x42')){_0xbbb4db={'method':_0x33dc('0xc'),'uri':_0x4470e5+_0x33dc('0x43'),'body':Object[_0x33dc('0x44')]({},{'title':intUtil[_0x33dc('0x45')](_0x324c22[_0x33dc('0x46')],_0x563f4b,'\x20'),'description':intUtil[_0x33dc('0x45')](_0x324c22[_0x33dc('0x47')],_0x563f4b,'\x0a'),'customerid_contact@odata.bind':_0x33dc('0x48')+_0x19f560['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x19f560[_0x33dc('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x324c22['Fields'],_0x563f4b,_0x324c22[_0x33dc('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0xa835d9,'OData-Version':_0x33dc('0x35')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x324c22[_0x33dc('0x41')]===_0x33dc('0x49')){_0xbbb4db={'method':_0x33dc('0xc'),'uri':_0x4470e5+_0x33dc('0x4a'),'body':Object[_0x33dc('0x44')]({},{'subject':intUtil['getString'](_0x324c22[_0x33dc('0x46')],_0x563f4b,'\x20'),'phonenumber':String(_0x563f4b[_0x33dc('0x29')]),'description':intUtil['getString'](_0x324c22['Descriptions'],_0x563f4b,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x19f560['enduserId']+')','ownerid@odata.bind':_0x33dc('0x2b')+_0x19f560['userId']+')','directioncode':_0x19f560[_0x33dc('0x4b')]===_0x33dc('0x4c')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x33dc('0x2b')+_0x19f560[_0x33dc('0x22')]+')','participationtypemask':_0x19f560['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x33dc('0x48')+_0x19f560[_0x33dc('0x31')]+')','participationtypemask':_0x19f560['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x324c22[_0x33dc('0x4d')],_0x563f4b,_0x324c22[_0x33dc('0x41')])),'headers':{'Authorization':_0x33dc('0x2c')+_0xa835d9,'OData-Version':_0x33dc('0x35')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xbbb4db);})[_0x33dc('0x15')](function(_0x468245){var _0x4d4932=_0x468245[_0x33dc('0x2d')][_0x33dc('0x2e')];var _0xf57c5a=_0x4d4932['substring'](_0x4d4932[_0x33dc('0x30')]('(')+0x1,_0x4d4932[_0x33dc('0x30')](')'));_0x19f560[_0x33dc('0x4e')]=_0xf57c5a;_0x343aae(_0x19f560);})[_0x33dc('0x25')](function(_0x2b578b){_0x1bfb13(_0x2b578b[_0x33dc('0x14')]);});});}function emit(_0x2ccbc6,_0x326fbe,_0x29160b,_0x2e53c5){var _0x1e7dd3={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x2ccbc6,_0x29160b,_0x2e53c5)};io['to'](util['format'](_0x33dc('0x4f'),_0x326fbe))[_0x33dc('0x50')](_0x33dc('0x51'),_0x1e7dd3);}exports['cs']=function(_0x116014,_0x2d257b,_0x206a07,_0x579db5,_0x4c6b67,_0x133ed8,_0x1974c8,_0x841cb9){var _0x573ef0={};_0x133ed8['remoteUri']=intUtil[_0x33dc('0x52')](_0x133ed8['remoteUri']);_0x133ed8[_0x33dc('0x53')]=intUtil[_0x33dc('0x52')](_0x133ed8[_0x33dc('0x53')]);_0x573ef0['callDirection']=_0x841cb9===_0x33dc('0x4c')||_0x841cb9==='unmanaged'?_0x33dc('0x4c'):'outbound';var _0x52e053=util[_0x33dc('0x54')]('%s/api/data/v9.0/',_0x133ed8[_0x33dc('0xe')]);var _0x1727a1=util[_0x33dc('0x54')](_0x33dc('0x55'),_0x133ed8[_0x33dc('0x56')]);var _0x9c34e3=util[_0x33dc('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x133ed8[_0x33dc('0x53')],_0x2d257b['uniqueid'],md5(_0x2d257b['uniqueid']));if(_0x4c6b67&&_0x4c6b67['monitor_format']){logger[_0x33dc('0x20')](_0x33dc('0x57'),_0x33dc('0x58'));_0x2d257b[_0x33dc('0x59')]=_0x9c34e3;}else if(_0x1974c8&&_0x1974c8[_0x33dc('0x5a')]&&_0x1974c8[_0x33dc('0x5a')]!==_0x33dc('0x5b')){logger['info'](_0x33dc('0x5c'),'Recording\x20is\x20enabled!');_0x2d257b['recordingURL']=_0x9c34e3;}else{_0x2d257b[_0x33dc('0x59')]='';}return getUser(_0x573ef0,_0x133ed8,_0x579db5,_0x1727a1,_0x52e053,_0x841cb9)[_0x33dc('0x15')](function(_0x2f6886){logger[_0x33dc('0x20')]('['+_0x841cb9[_0x33dc('0x12')]()+']\x20The\x20User\x20ID\x20is:',_0x2f6886[_0x33dc('0x22')]);logger[_0x33dc('0x20')]('['+_0x841cb9[_0x33dc('0x12')]()+_0x33dc('0x5d'),_0x2f6886[_0x33dc('0x1c')]);return getEndUser(_0x2f6886,_0x133ed8,_0x1727a1,_0x52e053,_0x2d257b,_0x841cb9);})[_0x33dc('0x15')](function(_0x136fdd){logger[_0x33dc('0x20')]('['+_0x841cb9['toUpperCase']()+_0x33dc('0x5e'),_0x136fdd[_0x33dc('0x31')]);logger[_0x33dc('0x20')]('['+_0x841cb9[_0x33dc('0x12')]()+_0x33dc('0x5f'),_0x2d257b[_0x33dc('0x29')]);return getTicket(_0x136fdd,_0x133ed8,_0x1727a1,_0x52e053,_0x2d257b,_0x206a07,_0x841cb9);})[_0x33dc('0x15')](function(_0xd377ef){logger[_0x33dc('0x20')](util[_0x33dc('0x54')]('['+_0x841cb9[_0x33dc('0x12')]()+_0x33dc('0x60'),_0x206a07['ticketType'],_0xd377ef[_0x33dc('0x4e')]));logger[_0x33dc('0x20')](util[_0x33dc('0x54')]('['+_0x841cb9[_0x33dc('0x12')]()+_0x33dc('0x61'),_0x841cb9));if(_0x841cb9!==_0x33dc('0x62')){logger['info']('['+_0x841cb9[_0x33dc('0x12')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x133ed8[_0x33dc('0xe')],_0x579db5[_0x33dc('0x63')],_0x206a07[_0x33dc('0x41')],_0xd377ef['ticketId']);}})['catch'](function(_0x4105a3){logger[_0x33dc('0x64')]('['+_0x841cb9['toUpperCase']()+_0x33dc('0x65'),util['inspect'](_0x4105a3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0b79=['value','isNil','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','GET','replace','%2b','4.0','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','substring','indexOf','content','ticketType','incident','POST','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','dynamics365','redis','defaults','localhost','password','then','catch','error',']\x20Wrong\x20credentials!','message','Bearer\x20'];(function(_0x3dacbc,_0x263ad2){var _0x5a031e=function(_0x8c8208){while(--_0x8c8208){_0x3dacbc['push'](_0x3dacbc['shift']());}};_0x5a031e(++_0x263ad2);}(_0x0b79,0xad));var _0x90b7=function(_0x50e0e3,_0x5bbdbc){_0x50e0e3=_0x50e0e3-0x0;var _0x105cdc=_0x0b79[_0x50e0e3];return _0x105cdc;};'use strict';var _=require(_0x90b7('0x0'));var BPromise=require(_0x90b7('0x1'));var rp=require(_0x90b7('0x2'));var util=require(_0x90b7('0x3'));var intUtil=require('./util');var md5=require(_0x90b7('0x4'));var Redis=require(_0x90b7('0x5'));var logger=require('../../../../config/logger')(_0x90b7('0x6'));var config=require('../../../../config/environment');config[_0x90b7('0x7')]=_[_0x90b7('0x8')](config[_0x90b7('0x7')],{'host':_0x90b7('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x90b7('0x7')]));function getAuthToken(_0x5c8d2a,_0x41981b,_0x3a929){var _0x381499={'method':'POST','uri':_0x41981b,'form':{'client_id':_0x5c8d2a['clientId'],'resource':_0x5c8d2a['remoteUri'],'username':_0x5c8d2a['username'],'password':_0x5c8d2a[_0x90b7('0xa')],'grant_type':_0x90b7('0xa'),'client_secret':_0x5c8d2a['clientSecret']},'json':!![]};return rp(_0x381499)[_0x90b7('0xb')](function(_0x5e817e){return _0x5e817e['access_token'];})[_0x90b7('0xc')](function(_0x3af6f7){logger[_0x90b7('0xd')]('['+[_0x3a929['toUpperCase']()]+_0x90b7('0xe'));return _0x3af6f7[_0x90b7('0xf')];});}function getUser(_0x4d7424,_0xa91d51,_0x182866,_0xb36b26,_0xd8d12,_0x5f4942){return new BPromise(function(_0x1c84cd,_0x325f68){return getAuthToken(_0xa91d51,_0xb36b26,_0x5f4942)[_0x90b7('0xb')](function(_0x357dc1){var _0x504b1c={'method':'GET','uri':_0xd8d12+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x90b7('0x10')+_0x357dc1,'OData-Version':'4.0'},'json':!![]};return rp(_0x504b1c);})[_0x90b7('0xb')](function(_0x510387){var _0x249b90=_0x510387[_0x90b7('0x11')];var _0x429c74=![];var _0x1e7d2d=null;if(!_[_0x90b7('0x12')](_0x182866)){if(intUtil['validateEmail'](_0x182866[_0x90b7('0x13')])){_0x4d7424['userEmail']=_0x182866['email'];for(_0x1e7d2d=0x0;_0x1e7d2d<_0x249b90[_0x90b7('0x14')];_0x1e7d2d++){if(_0x249b90[_0x1e7d2d][_0x90b7('0x15')]===_0x182866[_0x90b7('0x13')]&&!_0x249b90[_0x1e7d2d][_0x90b7('0x16')]){_0x429c74=!![];logger[_0x90b7('0x17')]('['+[_0x5f4942[_0x90b7('0x18')]()]+_0x90b7('0x19')+_0x249b90[_0x1e7d2d][_0x90b7('0x1a')]+'!');_0x4d7424[_0x90b7('0x1b')]=_0x249b90[_0x1e7d2d][_0x90b7('0x1a')];}}}}if(!_0x429c74){logger[_0x90b7('0x17')]('['+[_0x5f4942[_0x90b7('0x18')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4d7424['userEmail']=_0xa91d51['username'];for(_0x1e7d2d=0x0;_0x1e7d2d<_0x249b90[_0x90b7('0x14')];_0x1e7d2d++){if(_0x249b90[_0x1e7d2d]['internalemailaddress']===_0xa91d51['username']){_0x4d7424[_0x90b7('0x1b')]=_0x249b90[_0x1e7d2d][_0x90b7('0x1a')];}}}_0x1c84cd(_0x4d7424);})['catch'](function(_0x30207f){_0x325f68(_0x30207f['message']);});});}function createEndUser(_0x40aa5c,_0x13626e,_0x55e497,_0x47d4be,_0x351325,_0x37c6ef){return new BPromise(function(_0x2d6c17,_0x32aec3){return getAuthToken(_0x13626e,_0x55e497,_0x37c6ef)[_0x90b7('0xb')](function(_0x17a12a){var _0x21f8ef=_0x37c6ef[_0x90b7('0x1c')]()===_0x90b7('0x1d')?_0x351325[_0x90b7('0x1e')]:_0x351325[_0x90b7('0x1f')];var _0xcdaa62={'method':'POST','uri':_0x47d4be+_0x90b7('0x20'),'body':{'telephone1':_0x21f8ef,'fullname':_0x21f8ef,'firstname':_0x21f8ef,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x90b7('0x21')+_0x40aa5c['userId']+')'},'headers':{'Authorization':_0x90b7('0x10')+_0x17a12a,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xcdaa62);})['then'](function(_0x1784e1){var _0x45bc89=_0x1784e1[_0x90b7('0x22')][_0x90b7('0x23')];var _0x1c7db1=_0x45bc89['substring'](_0x45bc89[_0x90b7('0x24')]('(')+0x1,_0x45bc89[_0x90b7('0x24')](')'));_0x40aa5c['enduserId']=_0x1c7db1;_0x2d6c17(_0x40aa5c);})[_0x90b7('0xc')](function(_0x25a51c){_0x32aec3(_0x25a51c[_0x90b7('0xf')]);});});}function getEndUser(_0x4927ff,_0x407a5f,_0x3f1e2f,_0xcf7057,_0x34695e,_0x5ae0e9){return new BPromise(function(_0x187790,_0x3e581f){var _0x482182=_0x5ae0e9[_0x90b7('0x1c')]()==='outbound'?_0x34695e[_0x90b7('0x1e')]:_0x34695e[_0x90b7('0x1f')];return getAuthToken(_0x407a5f,_0x3f1e2f,_0x5ae0e9)[_0x90b7('0xb')](function(_0x1a62ac){var _0x5f024c={'method':_0x90b7('0x25'),'uri':_0xcf7057+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x482182[_0x90b7('0x26')]('+',_0x90b7('0x27'))+'\x27','headers':{'Authorization':_0x90b7('0x10')+_0x1a62ac,'If-None-Match':null,'OData-Version':_0x90b7('0x28')},'json':!![]};return rp(_0x5f024c);})[_0x90b7('0xb')](function(_0x1105ee){var _0xc5e235=null;if(_0x1105ee){var _0x3a811e=_0x1105ee[_0x90b7('0x11')];var _0x1ced5e=![];for(_0xc5e235=0x0;_0xc5e235<_0x3a811e['length'];_0xc5e235++){if(_0x3a811e[_0xc5e235][_0x90b7('0x29')]===_0x482182){_0x1ced5e=!![];_0x4927ff[_0x90b7('0x2a')]=_0x3a811e[_0xc5e235][_0x90b7('0x2b')];}}if(_0x1ced5e){_0x187790(_0x4927ff);}else{return createEndUser(_0x4927ff,_0x407a5f,_0x3f1e2f,_0xcf7057,_0x34695e,_0x5ae0e9)[_0x90b7('0xb')](function(_0x248bb7){logger['info']('['+[_0x5ae0e9[_0x90b7('0x18')]()]+_0x90b7('0x2c'),_0x248bb7[_0x90b7('0x2a')]);_0x187790(_0x248bb7);});}}else{return createEndUser(_0x4927ff,_0x407a5f,_0x3f1e2f,_0xcf7057,_0x34695e,_0x5ae0e9)[_0x90b7('0xb')](function(_0x3ee28e){logger[_0x90b7('0x17')]('['+[_0x5ae0e9['toUpperCase']()]+_0x90b7('0x2d'),_0x3ee28e[_0x90b7('0x2a')]);_0x187790(_0x3ee28e);});}});});}function getCustomFields(_0x53a7de,_0x56d0e6,_0x5043e4){var _0xee4f49={};if(_0x53a7de[_0x90b7('0x14')]>0x0){_[_0x90b7('0x2e')](_0x53a7de,function(_0x26977e){if(_[_0x90b7('0x2f')]([_0x90b7('0x30'),_0x90b7('0x31')],_0x26977e[_0x90b7('0x32')])&&_0x26977e[_0x90b7('0x33')]&&!_0x26977e[_0x90b7('0x34')]){var _0x1cb637=_0x26977e['idField']['toLowerCase']();var _0x2a0806=_0x1cb637[_0x90b7('0x35')](0x0,_0x1cb637[_0x90b7('0x36')]('_'));var _0x133c65=_0x1cb637[_0x90b7('0x35')](_0x1cb637[_0x90b7('0x36')]('_')+0x1);if(_0x2a0806===_0x5043e4){_0xee4f49[_0x133c65]=_0x26977e[_0x90b7('0x37')];}}});}return _0xee4f49;}function getTicket(_0x89457f,_0x39f0b9,_0x558e50,_0x1e2549,_0x33917d,_0x4e0877,_0x17354d){return new BPromise(function(_0x5aea99,_0x1fc8c2){var _0x1233e2;return getAuthToken(_0x39f0b9,_0x558e50,_0x17354d)[_0x90b7('0xb')](function(_0x346ad1){if(_0x4e0877[_0x90b7('0x38')]===_0x90b7('0x39')){_0x1233e2={'method':_0x90b7('0x3a'),'uri':_0x1e2549+_0x90b7('0x3b'),'body':Object[_0x90b7('0x3c')]({},{'title':intUtil[_0x90b7('0x3d')](_0x4e0877[_0x90b7('0x3e')],_0x33917d,'\x20'),'description':intUtil[_0x90b7('0x3d')](_0x4e0877[_0x90b7('0x3f')],_0x33917d,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x89457f[_0x90b7('0x2a')]+')','ownerid@odata.bind':_0x90b7('0x21')+_0x89457f[_0x90b7('0x1b')]+')','caseorigincode':'1'},getCustomFields(_0x4e0877[_0x90b7('0x40')],_0x33917d,_0x4e0877[_0x90b7('0x38')])),'headers':{'Authorization':_0x90b7('0x10')+_0x346ad1,'OData-Version':_0x90b7('0x28')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4e0877[_0x90b7('0x38')]===_0x90b7('0x41')){_0x1233e2={'method':_0x90b7('0x3a'),'uri':_0x1e2549+'phonecalls','body':Object[_0x90b7('0x3c')]({},{'subject':intUtil[_0x90b7('0x3d')](_0x4e0877[_0x90b7('0x3e')],_0x33917d,'\x20'),'phonenumber':String(_0x33917d['calleridnum']),'description':intUtil['getString'](_0x4e0877[_0x90b7('0x3f')],_0x33917d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x90b7('0x42')+_0x89457f[_0x90b7('0x2a')]+')','ownerid@odata.bind':_0x90b7('0x21')+_0x89457f['userId']+')','directioncode':_0x89457f[_0x90b7('0x43')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x90b7('0x21')+_0x89457f[_0x90b7('0x1b')]+')','participationtypemask':_0x89457f[_0x90b7('0x43')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x90b7('0x42')+_0x89457f[_0x90b7('0x2a')]+')','participationtypemask':_0x89457f[_0x90b7('0x43')]===_0x90b7('0x44')?0x1:0x2}]},getCustomFields(_0x4e0877[_0x90b7('0x40')],_0x33917d,_0x4e0877[_0x90b7('0x38')])),'headers':{'Authorization':_0x90b7('0x10')+_0x346ad1,'OData-Version':_0x90b7('0x28')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1233e2);})[_0x90b7('0xb')](function(_0xb5637){var _0xde6b6a=_0xb5637[_0x90b7('0x22')][_0x90b7('0x23')];var _0x250316=_0xde6b6a['substring'](_0xde6b6a[_0x90b7('0x24')]('(')+0x1,_0xde6b6a[_0x90b7('0x24')](')'));_0x89457f[_0x90b7('0x45')]=_0x250316;_0x5aea99(_0x89457f);})[_0x90b7('0xc')](function(_0x585d05){_0x1fc8c2(_0x585d05[_0x90b7('0xf')]);});});}function emit(_0x4e13e0,_0xa97d6e,_0x207026,_0x4c8fe7){var _0x277b62={'uri':util[_0x90b7('0x46')](_0x90b7('0x47'),_0x4e13e0,_0x207026,_0x4c8fe7)};io['to'](util[_0x90b7('0x46')]('user:%s',_0xa97d6e))['emit']('trigger:browser:url',_0x277b62);}exports['cs']=function(_0xc07445,_0x34da32,_0x3b03c3,_0x36e5c9,_0x48d7d6,_0x553d84,_0x15edf2,_0x47eb92){var _0x3eac99={};_0x553d84[_0x90b7('0x48')]=intUtil[_0x90b7('0x49')](_0x553d84[_0x90b7('0x48')]);_0x553d84[_0x90b7('0x4a')]=intUtil[_0x90b7('0x49')](_0x553d84['serverUrl']);_0x3eac99[_0x90b7('0x43')]=_0x47eb92===_0x90b7('0x44')||_0x47eb92===_0x90b7('0x4b')?_0x90b7('0x44'):_0x90b7('0x1d');var _0x18ffa2=util[_0x90b7('0x46')](_0x90b7('0x4c'),_0x553d84['remoteUri']);var _0x4e8c82=util[_0x90b7('0x46')](_0x90b7('0x4d'),_0x553d84[_0x90b7('0x4e')]);var _0x34ed1=util[_0x90b7('0x46')](_0x90b7('0x4f'),_0x553d84['serverUrl'],_0x34da32[_0x90b7('0x50')],md5(_0x34da32[_0x90b7('0x50')]));if(_0x48d7d6&&_0x48d7d6['monitor_format']){logger['info'](_0x90b7('0x51'),_0x90b7('0x52'));_0x34da32[_0x90b7('0x53')]=_0x34ed1;}else if(_0x15edf2&&_0x15edf2['recordingFormat']&&_0x15edf2[_0x90b7('0x54')]!==_0x90b7('0x55')){logger[_0x90b7('0x17')](_0x90b7('0x56'),_0x90b7('0x52'));_0x34da32[_0x90b7('0x53')]=_0x34ed1;}else{_0x34da32['recordingURL']='';}return getUser(_0x3eac99,_0x553d84,_0x36e5c9,_0x4e8c82,_0x18ffa2,_0x47eb92)[_0x90b7('0xb')](function(_0x4b44c4){logger[_0x90b7('0x17')]('['+_0x47eb92[_0x90b7('0x18')]()+']\x20The\x20User\x20ID\x20is:',_0x4b44c4[_0x90b7('0x1b')]);logger[_0x90b7('0x17')]('['+_0x47eb92['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x4b44c4['userEmail']);return getEndUser(_0x4b44c4,_0x553d84,_0x4e8c82,_0x18ffa2,_0x34da32,_0x47eb92);})['then'](function(_0x577f8e){logger[_0x90b7('0x17')]('['+_0x47eb92[_0x90b7('0x18')]()+_0x90b7('0x57'),_0x577f8e[_0x90b7('0x2a')]);logger[_0x90b7('0x17')]('['+_0x47eb92[_0x90b7('0x18')]()+_0x90b7('0x58'),_0x34da32[_0x90b7('0x1f')]);return getTicket(_0x577f8e,_0x553d84,_0x4e8c82,_0x18ffa2,_0x34da32,_0x3b03c3,_0x47eb92);})[_0x90b7('0xb')](function(_0x59a20c){logger[_0x90b7('0x17')](util['format']('['+_0x47eb92[_0x90b7('0x18')]()+_0x90b7('0x59'),_0x3b03c3[_0x90b7('0x38')],_0x59a20c['ticketId']));logger[_0x90b7('0x17')](util[_0x90b7('0x46')]('['+_0x47eb92['toUpperCase']()+_0x90b7('0x5a'),_0x47eb92));if(_0x47eb92!=='unmanaged'){logger[_0x90b7('0x17')]('['+_0x47eb92[_0x90b7('0x18')]()+']',_0x90b7('0x5b'));emit(_0x553d84[_0x90b7('0x48')],_0x36e5c9[_0x90b7('0x5c')],_0x3b03c3[_0x90b7('0x38')],_0x59a20c[_0x90b7('0x45')]);}})[_0x90b7('0xc')](function(_0x16bc3b){logger[_0x90b7('0xd')]('['+_0x47eb92[_0x90b7('0x18')]()+_0x90b7('0x5d'),util[_0x90b7('0x5e')](_0x16bc3b,{'showHidden':!![],'depth':null}));});}; \ 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 dc6b15b..c9afa9b 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 _0x0dde=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','request-promise','md5','ioredis','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','info','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','[HTTP]','map','includes','picklist','type','nameField','toLowerCase','content','string','idField','push','variableName','customField','customVariable','Variable','name','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum'];(function(_0x1e63dd,_0x3e2d81){var _0x54159a=function(_0x2fc465){while(--_0x2fc465){_0x1e63dd['push'](_0x1e63dd['shift']());}};_0x54159a(++_0x3e2d81);}(_0x0dde,0x112));var _0xe0dd=function(_0x5e3bb1,_0x3cfe7c){_0x5e3bb1=_0x5e3bb1-0x0;var _0x4c1278=_0x0dde[_0x5e3bb1];return _0x4c1278;};'use strict';var _=require('lodash');var rp=require(_0xe0dd('0x0'));var md5=require(_0xe0dd('0x1'));var util=require('util');var Redis=require(_0xe0dd('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xe0dd('0x3'))(_0xe0dd('0x4'));config[_0xe0dd('0x5')]=_[_0xe0dd('0x6')](config[_0xe0dd('0x5')],{'host':_0xe0dd('0x7'),'port':0x18eb});var io=require(_0xe0dd('0x8'))(new Redis(config[_0xe0dd('0x5')]));var headers={'Content-Type':'application/json','Accept':_0xe0dd('0x9')};function emit(_0x1b58fb,_0x57b1f2,_0x3abc06){io['to'](_0x1b58fb)['emit'](_0x57b1f2,_0x3abc06);}function getTicket(_0x14dbd0,_0x5284d4,_0x2e6eb0,_0x2d3117,_0x3f6daa){logger['info']('Creating\x20new\x20ticket...');var _0x298fe9=_[_0xe0dd('0xa')]({'responder_id':_0x5284d4['id'],'requester_id':_0x2e6eb0['id'],'name':util[_0xe0dd('0xb')](_0xe0dd('0xc'),_0x3f6daa[_0xe0dd('0xd')]),'phone':_0x3f6daa[_0xe0dd('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe0dd('0xf')](_0x2d3117[_0xe0dd('0x10')],_0x3f6daa,'\x20'),'description':intUtil[_0xe0dd('0xf')](_0x2d3117[_0xe0dd('0x11')],_0x3f6daa,_0xe0dd('0x12')),'tags':getTags(_0x2d3117[_0xe0dd('0x13')],'name')},getCustomFields(_0x2d3117[_0xe0dd('0x14')],_0x3f6daa));_0x298fe9[_0xe0dd('0x15')]=_[_0xe0dd('0x16')](_['keyBy'](_0x298fe9['custom_fields'],'id'),_0xe0dd('0x17'));return request({'uri':util['format'](_0xe0dd('0x18'),_0x14dbd0['remoteUri']),'method':_0xe0dd('0x19'),'body':_0x298fe9})[_0xe0dd('0x1a')](function(_0x3d16c9){logger['info'](_0xe0dd('0x1b'));return _0x3d16c9;});}function getUser(_0x1dabd5,_0x343643){if(intUtil[_0xe0dd('0x1c')](_0x343643)){return request({'uri':util[_0xe0dd('0xb')]('%s/api/v2/agents',_0x1dabd5['remoteUri']),'qs':{'email':_0x343643}})[_0xe0dd('0x1a')](function(_0x320e68){if(_0x320e68['length']){logger[_0xe0dd('0x1d')](_0xe0dd('0x1e'));return _['find'](_0x320e68,function(_0x404acc){return _0x404acc[_0xe0dd('0x1f')][_0xe0dd('0x20')]===_0x343643;});}else{logger['info'](_0xe0dd('0x21'));return request({'uri':util[_0xe0dd('0xb')]('%s/api/v2/agents/me',_0x1dabd5[_0xe0dd('0x22')])})[_0xe0dd('0x1a')](function(_0x1bff51){logger[_0xe0dd('0x1d')](_0xe0dd('0x23'));return _0x1bff51;});}});}else{logger[_0xe0dd('0x1d')](_0xe0dd('0x24'));return request({'uri':util[_0xe0dd('0xb')](_0xe0dd('0x25'),_0x1dabd5[_0xe0dd('0x22')])})[_0xe0dd('0x1a')](function(_0x27ec52){logger[_0xe0dd('0x1d')](_0xe0dd('0x23'));return _0x27ec52;});}}function getEndUser(_0x12ff8b,_0x41c297,_0xb41a30){logger['info'](_0xe0dd('0x26'),_0xb41a30);return request({'uri':util[_0xe0dd('0xb')]('%s/api/v2/contacts',_0x12ff8b[_0xe0dd('0x22')]),'qs':{'phone':_0xb41a30}})[_0xe0dd('0x1a')](function(_0x3fddec){if(_0x3fddec[_0xe0dd('0x27')]){logger[_0xe0dd('0x1d')](_0xe0dd('0x28'));return _[_0xe0dd('0x29')](_0x3fddec,{'phone':_0xb41a30});}else{logger[_0xe0dd('0x1d')](_0xe0dd('0x2a'));return request({'uri':util[_0xe0dd('0xb')](_0xe0dd('0x2b'),_0x12ff8b[_0xe0dd('0x22')]),'method':'POST','body':{'name':_0x41c297,'phone':_0xb41a30}})['then'](function(_0x1d4c47){logger[_0xe0dd('0x1d')](_0xe0dd('0x2c'));return _0x1d4c47;});}});}function getAuth(_0x1fb010){return util['format']('Basic\x20%s',new Buffer(_0x1fb010[_0xe0dd('0x2d')]+':X')[_0xe0dd('0x2e')](_0xe0dd('0x2f')));}function request(_0x5c0104){logger['debug'](_0xe0dd('0x30'),JSON['stringify'](_0x5c0104));return rp(_[_0xe0dd('0x6')](_0x5c0104,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x578458,_0x4df619){var _0x2ab5e2=[];if(_0x578458&&_0x578458[_0xe0dd('0x27')]>0x0){_0x2ab5e2=_[_0xe0dd('0x31')](_0x578458,_0x4df619);}return _0x2ab5e2;}function getCustomFields(_0xdc93b3,_0x901c43){var _0x276818=[];var _0x52f344={'custom_fields':[]};if(_0xdc93b3['length']>0x0){_['forEach'](_0xdc93b3,function(_0x1cd10b){if(_[_0xe0dd('0x32')](['string',_0xe0dd('0x33')],_0x1cd10b[_0xe0dd('0x34')])&&_0x1cd10b[_0xe0dd('0x35')]&&!_0x1cd10b['customField']){_0x52f344[_0x1cd10b['nameField'][_0xe0dd('0x36')]()]=_0x1cd10b[_0xe0dd('0x37')][_0xe0dd('0x2e')]();}else if(_[_0xe0dd('0x32')]([_0xe0dd('0x38'),_0xe0dd('0x33')],_0x1cd10b[_0xe0dd('0x34')])&&_0x1cd10b[_0xe0dd('0x39')]&&_0x1cd10b['customField']){_0x52f344['custom_fields'][_0xe0dd('0x3a')]({'id':_0x1cd10b[_0xe0dd('0x39')],'value':_0x1cd10b['content']['toString']()});}else if(_0x1cd10b[_0xe0dd('0x34')]==='variable'&&_0x1cd10b[_0xe0dd('0x3b')]&&_0x1cd10b['idField']&&_0x1cd10b[_0xe0dd('0x3c')]){_0x901c43[_0x1cd10b[_0xe0dd('0x3b')]]&&_0x52f344[_0xe0dd('0x15')]['push']({'id':_0x1cd10b[_0xe0dd('0x39')],'value':_0x901c43[_0x1cd10b['variableName']][_0xe0dd('0x2e')]()});}else if(_0x1cd10b['type']===_0xe0dd('0x3d')&&_0x1cd10b[_0xe0dd('0x3e')]&&_0x1cd10b[_0xe0dd('0x3e')][_0xe0dd('0x3f')]&&_0x1cd10b[_0xe0dd('0x39')]&&_0x1cd10b[_0xe0dd('0x3c')]){_0x901c43[_0x1cd10b[_0xe0dd('0x3e')][_0xe0dd('0x3f')][_0xe0dd('0x36')]()]&&_0x52f344[_0xe0dd('0x15')][_0xe0dd('0x3a')]({'id':_0x1cd10b[_0xe0dd('0x39')],'value':_0x901c43[_0x1cd10b[_0xe0dd('0x3e')][_0xe0dd('0x3f')][_0xe0dd('0x36')]()][_0xe0dd('0x2e')]()});}});}return _0x52f344;}exports['queue']=function(_0x3839e7,_0x394c39,_0x2db961,_0x397eac,_0x3eefaf,_0x4be3c1){var _0x3ba431,_0x188fec;_0x4be3c1['remoteUri']=intUtil['stripTrailingSlash'](_0x4be3c1[_0xe0dd('0x22')]);_0x4be3c1[_0xe0dd('0x40')]=intUtil[_0xe0dd('0x41')](_0x4be3c1[_0xe0dd('0x40')]);if(_0x3eefaf&&_0x3eefaf[_0xe0dd('0x42')]){logger[_0xe0dd('0x1d')]('[QUEUE]','Recording\x20is\x20enabled!');_0x394c39[_0xe0dd('0x43')]=util[_0xe0dd('0xb')](_0xe0dd('0x44'),_0x4be3c1[_0xe0dd('0x40')],_0x394c39[_0xe0dd('0x45')],md5(_0x394c39[_0xe0dd('0x45')]));}else{_0x394c39[_0xe0dd('0x43')]='';}headers[_0xe0dd('0x46')]=getAuth(_0x4be3c1);return getUser(_0x4be3c1,_0x397eac['email'])['then'](function(_0x58dd05){_0x3ba431=_0x58dd05;logger[_0xe0dd('0x1d')]('The\x20User\x20ID\x20is:',_0x3ba431['id']);return getEndUser(_0x4be3c1,_0x394c39['calleridname'],_0x394c39['calleridnum']);})[_0xe0dd('0x1a')](function(_0x50f0cb){_0x188fec=_0x50f0cb;logger[_0xe0dd('0x1d')](_0xe0dd('0x47'),_0x188fec['id']);return getTicket(_0x4be3c1,_0x3ba431,_0x188fec,_0x2db961,_0x394c39);})['then'](function(_0xdf8da){if(_0xdf8da&&_0xdf8da['id']){logger[_0xe0dd('0x1d')](_0xe0dd('0x1b'));logger['info'](_0xe0dd('0x48'),_0xdf8da['id']);logger[_0xe0dd('0x1d')](_0xe0dd('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe0dd('0xb')](_0xe0dd('0x4a'),_0x397eac[_0xe0dd('0x3f')]),_0xe0dd('0x4b'),{'uri':util[_0xe0dd('0xb')](_0xe0dd('0x4c'),_0x4be3c1[_0xe0dd('0x22')],_0xdf8da['id'])});}})[_0xe0dd('0x4d')](function(_0xf0abcd){logger[_0xe0dd('0x4e')](_0xe0dd('0x49'),JSON[_0xe0dd('0x4f')](_0xf0abcd));});};exports['outbound']=function(_0x3ef875,_0x31878d,_0x466779,_0x349c58,_0x5fc1c6,_0x539c7b,_0x31292c){var _0x49833a,_0x4fc962;_0x539c7b[_0xe0dd('0x22')]=intUtil[_0xe0dd('0x41')](_0x539c7b['remoteUri']);_0x539c7b['serverUrl']=intUtil[_0xe0dd('0x41')](_0x539c7b['serverUrl']);if(_0x31292c&&_0x31292c[_0xe0dd('0x50')]&&_0x31292c[_0xe0dd('0x50')]!=='none'){logger['info'](_0xe0dd('0x51'),_0xe0dd('0x52'));_0x31878d[_0xe0dd('0x43')]=util['format'](_0xe0dd('0x44'),_0x539c7b['serverUrl'],_0x31878d[_0xe0dd('0x45')],md5(_0x31878d['uniqueid']));}headers[_0xe0dd('0x46')]=getAuth(_0x539c7b);return getUser(_0x539c7b,_0x349c58[_0xe0dd('0x20')])[_0xe0dd('0x1a')](function(_0x5c0bd7){_0x49833a=_0x5c0bd7;logger[_0xe0dd('0x1d')](_0xe0dd('0x53'),_0x49833a['id']);return getEndUser(_0x539c7b,_0x31878d[_0xe0dd('0x54')],_0x31878d[_0xe0dd('0x55')]);})['then'](function(_0x3ba807){_0x4fc962=_0x3ba807;logger[_0xe0dd('0x1d')](_0xe0dd('0x47'),_0x4fc962['id']);return getTicket(_0x539c7b,_0x49833a,_0x4fc962,_0x466779,_0x31878d);})[_0xe0dd('0x1a')](function(_0x348020){if(_0x348020&&_0x348020['id']){logger[_0xe0dd('0x1d')](_0xe0dd('0x1b'));logger[_0xe0dd('0x1d')](_0xe0dd('0x48'),_0x348020['id']);logger[_0xe0dd('0x1d')](_0xe0dd('0x51'),_0xe0dd('0x56'));emit(util[_0xe0dd('0xb')]('user:%s',_0x349c58[_0xe0dd('0x3f')]),'trigger:browser:url',{'uri':util[_0xe0dd('0xb')](_0xe0dd('0x4c'),_0x539c7b[_0xe0dd('0x22')],_0x348020['id'])});}})[_0xe0dd('0x4d')](function(_0x21a9a2){logger[_0xe0dd('0x4e')](_0xe0dd('0x51'),JSON[_0xe0dd('0x4f')](_0x21a9a2));});};exports[_0xe0dd('0x57')]=function(_0x1b22a3,_0xa00b6c,_0x26bf34,_0x1c0a72,_0x5a77d8,_0x395043){var _0xd50ec,_0x1d302a;_0x395043['remoteUri']=intUtil['stripTrailingSlash'](_0x395043[_0xe0dd('0x22')]);_0x395043['serverUrl']=intUtil[_0xe0dd('0x41')](_0x395043[_0xe0dd('0x40')]);if(_0x5a77d8&&_0x5a77d8[_0xe0dd('0x42')]){logger[_0xe0dd('0x1d')]('['+_0xa00b6c[_0xe0dd('0x58')][_0xe0dd('0x59')]()+']',_0xe0dd('0x52'));_0xa00b6c[_0xe0dd('0x43')]=util[_0xe0dd('0xb')](_0xe0dd('0x44'),_0x395043['serverUrl'],_0xa00b6c[_0xe0dd('0x45')],md5(_0xa00b6c['uniqueid']));}else{_0xa00b6c['recordingURL']='';}headers['Authorization']=getAuth(_0x395043);return getUser(_0x395043,'')[_0xe0dd('0x1a')](function(_0x3f8a89){_0xd50ec=_0x3f8a89;logger[_0xe0dd('0x1d')](_0xe0dd('0x53'),_0xd50ec['id']);return getEndUser(_0x395043,_0xa00b6c['calleridname'],_0xa00b6c[_0xe0dd('0xe')]);})[_0xe0dd('0x1a')](function(_0x102877){_0x1d302a=_0x102877;logger[_0xe0dd('0x1d')](_0xe0dd('0x47'),_0x1d302a['id']);return getTicket(_0x395043,_0xd50ec,_0x1d302a,_0x26bf34,_0xa00b6c);})[_0xe0dd('0x1a')](function(_0x5d5ffa){if(_0x5d5ffa){logger[_0xe0dd('0x1d')](_0xe0dd('0x1b'));logger[_0xe0dd('0x1d')](_0xe0dd('0x48'),_0x5d5ffa['id']);}})['catch'](function(_0x31b098){logger['error']('['+_0xa00b6c[_0xe0dd('0x58')][_0xe0dd('0x59')]()+']',JSON[_0xe0dd('0x4f')](_0x31b098));});}; \ No newline at end of file +var _0x141d=['Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','serverUrl','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','Fields','mapValues','keyBy','custom_fields','value','remoteUri','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','base64','debug','stringify','GET','map','forEach','includes','picklist','type','nameField','toLowerCase','content','toString','idField','customField','push','variableName','customVariable','Variable','name','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x141d,0x133));var _0xd141=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x141d[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xd141('0x0'));var rp=require(_0xd141('0x1'));var md5=require(_0xd141('0x2'));var util=require(_0xd141('0x3'));var Redis=require(_0xd141('0x4'));var intUtil=require(_0xd141('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd141('0x6'));config[_0xd141('0x7')]=_[_0xd141('0x8')](config[_0xd141('0x7')],{'host':_0xd141('0x9'),'port':0x18eb});var io=require(_0xd141('0xa'))(new Redis(config[_0xd141('0x7')]));var headers={'Content-Type':_0xd141('0xb'),'Accept':'application/json'};function emit(_0x4a0884,_0x1559a5,_0x440b2a){io['to'](_0x4a0884)[_0xd141('0xc')](_0x1559a5,_0x440b2a);}function getTicket(_0x534d9f,_0x599960,_0x12beeb,_0x2af19e,_0x1011ae){logger[_0xd141('0xd')](_0xd141('0xe'));var _0x5b30d=_[_0xd141('0xf')]({'responder_id':_0x599960['id'],'requester_id':_0x12beeb['id'],'name':util[_0xd141('0x10')](_0xd141('0x11'),_0x1011ae[_0xd141('0x12')]),'phone':_0x1011ae['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd141('0x13')](_0x2af19e[_0xd141('0x14')],_0x1011ae,'\x20'),'description':intUtil[_0xd141('0x13')](_0x2af19e[_0xd141('0x15')],_0x1011ae,_0xd141('0x16')),'tags':getTags(_0x2af19e[_0xd141('0x17')],'name')},getCustomFields(_0x2af19e[_0xd141('0x18')],_0x1011ae));_0x5b30d['custom_fields']=_[_0xd141('0x19')](_[_0xd141('0x1a')](_0x5b30d[_0xd141('0x1b')],'id'),_0xd141('0x1c'));return request({'uri':util[_0xd141('0x10')]('%s/api/v2/tickets',_0x534d9f[_0xd141('0x1d')]),'method':'POST','body':_0x5b30d})[_0xd141('0x1e')](function(_0x32e955){logger[_0xd141('0xd')]('Ticket\x20created!');return _0x32e955;});}function getUser(_0x4a8266,_0x267d9e){if(intUtil[_0xd141('0x1f')](_0x267d9e)){return request({'uri':util[_0xd141('0x10')](_0xd141('0x20'),_0x4a8266[_0xd141('0x1d')]),'qs':{'email':_0x267d9e}})[_0xd141('0x1e')](function(_0x28e4e1){if(_0x28e4e1[_0xd141('0x21')]){logger['info'](_0xd141('0x22'));return _[_0xd141('0x23')](_0x28e4e1,function(_0x34135c){return _0x34135c[_0xd141('0x24')]['email']===_0x267d9e;});}else{logger[_0xd141('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xd141('0x25'),_0x4a8266[_0xd141('0x1d')])})[_0xd141('0x1e')](function(_0x3f7805){logger[_0xd141('0xd')](_0xd141('0x26'));return _0x3f7805;});}});}else{logger[_0xd141('0xd')](_0xd141('0x27'));return request({'uri':util[_0xd141('0x10')](_0xd141('0x25'),_0x4a8266[_0xd141('0x1d')])})[_0xd141('0x1e')](function(_0x33af6f){logger['info'](_0xd141('0x26'));return _0x33af6f;});}}function getEndUser(_0x2e9db4,_0x23cd13,_0x1cd339){logger[_0xd141('0xd')]('Searching\x20enduser\x20with\x20phone',_0x1cd339);return request({'uri':util['format'](_0xd141('0x28'),_0x2e9db4[_0xd141('0x1d')]),'qs':{'phone':_0x1cd339}})[_0xd141('0x1e')](function(_0x22c64b){if(_0x22c64b['length']){logger[_0xd141('0xd')]('Enduser\x20found!');return _['find'](_0x22c64b,{'phone':_0x1cd339});}else{logger[_0xd141('0xd')](_0xd141('0x29'));return request({'uri':util[_0xd141('0x10')](_0xd141('0x28'),_0x2e9db4[_0xd141('0x1d')]),'method':_0xd141('0x2a'),'body':{'name':_0x23cd13,'phone':_0x1cd339}})[_0xd141('0x1e')](function(_0x56804f){logger['info'](_0xd141('0x2b'));return _0x56804f;});}});}function getAuth(_0xd0cd01){return util[_0xd141('0x10')](_0xd141('0x2c'),new Buffer(_0xd0cd01['apiKey']+':X')['toString'](_0xd141('0x2d')));}function request(_0x2c019b){logger[_0xd141('0x2e')]('[HTTP]',JSON[_0xd141('0x2f')](_0x2c019b));return rp(_[_0xd141('0x8')](_0x2c019b,{'method':_0xd141('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x3bee9d,_0x89d06d){var _0x2db35d=[];if(_0x3bee9d&&_0x3bee9d[_0xd141('0x21')]>0x0){_0x2db35d=_[_0xd141('0x31')](_0x3bee9d,_0x89d06d);}return _0x2db35d;}function getCustomFields(_0x243209,_0x32307b){var _0x1f9fa5=[];var _0xc7dfd2={'custom_fields':[]};if(_0x243209['length']>0x0){_[_0xd141('0x32')](_0x243209,function(_0x222468){if(_[_0xd141('0x33')](['string',_0xd141('0x34')],_0x222468[_0xd141('0x35')])&&_0x222468[_0xd141('0x36')]&&!_0x222468['customField']){_0xc7dfd2[_0x222468[_0xd141('0x36')][_0xd141('0x37')]()]=_0x222468[_0xd141('0x38')][_0xd141('0x39')]();}else if(_['includes'](['string',_0xd141('0x34')],_0x222468[_0xd141('0x35')])&&_0x222468[_0xd141('0x3a')]&&_0x222468[_0xd141('0x3b')]){_0xc7dfd2[_0xd141('0x1b')][_0xd141('0x3c')]({'id':_0x222468['idField'],'value':_0x222468['content'][_0xd141('0x39')]()});}else if(_0x222468[_0xd141('0x35')]==='variable'&&_0x222468[_0xd141('0x3d')]&&_0x222468[_0xd141('0x3a')]&&_0x222468['customField']){_0x32307b[_0x222468['variableName']]&&_0xc7dfd2[_0xd141('0x1b')][_0xd141('0x3c')]({'id':_0x222468[_0xd141('0x3a')],'value':_0x32307b[_0x222468[_0xd141('0x3d')]]['toString']()});}else if(_0x222468['type']===_0xd141('0x3e')&&_0x222468[_0xd141('0x3f')]&&_0x222468['Variable'][_0xd141('0x40')]&&_0x222468['idField']&&_0x222468[_0xd141('0x3b')]){_0x32307b[_0x222468['Variable']['name'][_0xd141('0x37')]()]&&_0xc7dfd2[_0xd141('0x1b')][_0xd141('0x3c')]({'id':_0x222468[_0xd141('0x3a')],'value':_0x32307b[_0x222468[_0xd141('0x3f')][_0xd141('0x40')][_0xd141('0x37')]()]['toString']()});}});}return _0xc7dfd2;}exports[_0xd141('0x41')]=function(_0x224e18,_0x4f1445,_0x282ed9,_0x33380e,_0x5008a6,_0x28fca4){var _0x4128f8,_0x368967;_0x28fca4[_0xd141('0x1d')]=intUtil[_0xd141('0x42')](_0x28fca4[_0xd141('0x1d')]);_0x28fca4['serverUrl']=intUtil[_0xd141('0x42')](_0x28fca4['serverUrl']);if(_0x5008a6&&_0x5008a6[_0xd141('0x43')]){logger['info'](_0xd141('0x44'),'Recording\x20is\x20enabled!');_0x4f1445[_0xd141('0x45')]=util[_0xd141('0x10')](_0xd141('0x46'),_0x28fca4['serverUrl'],_0x4f1445[_0xd141('0x47')],md5(_0x4f1445[_0xd141('0x47')]));}else{_0x4f1445[_0xd141('0x45')]='';}headers[_0xd141('0x48')]=getAuth(_0x28fca4);return getUser(_0x28fca4,_0x33380e[_0xd141('0x49')])[_0xd141('0x1e')](function(_0x3d5027){_0x4128f8=_0x3d5027;logger['info'](_0xd141('0x4a'),_0x4128f8['id']);return getEndUser(_0x28fca4,_0x4f1445[_0xd141('0x12')],_0x4f1445[_0xd141('0x4b')]);})['then'](function(_0x4277fe){_0x368967=_0x4277fe;logger['info'](_0xd141('0x4c'),_0x368967['id']);return getTicket(_0x28fca4,_0x4128f8,_0x368967,_0x282ed9,_0x4f1445);})[_0xd141('0x1e')](function(_0x592958){if(_0x592958&&_0x592958['id']){logger[_0xd141('0xd')](_0xd141('0x4d'));logger[_0xd141('0xd')](_0xd141('0x4e'),_0x592958['id']);logger[_0xd141('0xd')](_0xd141('0x44'),_0xd141('0x4f'));emit(util[_0xd141('0x10')]('user:%s',_0x33380e[_0xd141('0x40')]),'trigger:browser:url',{'uri':util[_0xd141('0x10')]('%s/helpdesk/tickets/%d',_0x28fca4[_0xd141('0x1d')],_0x592958['id'])});}})[_0xd141('0x50')](function(_0x47e45c){logger[_0xd141('0x51')]('[QUEUE]',JSON[_0xd141('0x2f')](_0x47e45c));});};exports[_0xd141('0x52')]=function(_0x553b81,_0x3a6dd9,_0x794ce6,_0x5bb2f9,_0x597cc8,_0x4a3564,_0xa2f7e5){var _0x64dc08,_0x39bc1c;_0x4a3564[_0xd141('0x1d')]=intUtil[_0xd141('0x42')](_0x4a3564['remoteUri']);_0x4a3564[_0xd141('0x53')]=intUtil[_0xd141('0x42')](_0x4a3564[_0xd141('0x53')]);if(_0xa2f7e5&&_0xa2f7e5['recordingFormat']&&_0xa2f7e5[_0xd141('0x54')]!==_0xd141('0x55')){logger[_0xd141('0xd')]('[OUTBOUND]',_0xd141('0x56'));_0x3a6dd9[_0xd141('0x45')]=util[_0xd141('0x10')](_0xd141('0x46'),_0x4a3564[_0xd141('0x53')],_0x3a6dd9['uniqueid'],md5(_0x3a6dd9[_0xd141('0x47')]));}headers[_0xd141('0x48')]=getAuth(_0x4a3564);return getUser(_0x4a3564,_0x5bb2f9['email'])[_0xd141('0x1e')](function(_0x29a8d4){_0x64dc08=_0x29a8d4;logger[_0xd141('0xd')](_0xd141('0x4a'),_0x64dc08['id']);return getEndUser(_0x4a3564,_0x3a6dd9[_0xd141('0x57')],_0x3a6dd9[_0xd141('0x58')]);})['then'](function(_0x117db6){_0x39bc1c=_0x117db6;logger[_0xd141('0xd')](_0xd141('0x4c'),_0x39bc1c['id']);return getTicket(_0x4a3564,_0x64dc08,_0x39bc1c,_0x794ce6,_0x3a6dd9);})[_0xd141('0x1e')](function(_0x237f40){if(_0x237f40&&_0x237f40['id']){logger[_0xd141('0xd')](_0xd141('0x4d'));logger[_0xd141('0xd')](_0xd141('0x4e'),_0x237f40['id']);logger[_0xd141('0xd')](_0xd141('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd141('0x10')](_0xd141('0x5a'),_0x5bb2f9[_0xd141('0x40')]),_0xd141('0x5b'),{'uri':util['format'](_0xd141('0x5c'),_0x4a3564[_0xd141('0x1d')],_0x237f40['id'])});}})[_0xd141('0x50')](function(_0x40f744){logger[_0xd141('0x51')](_0xd141('0x59'),JSON[_0xd141('0x2f')](_0x40f744));});};exports[_0xd141('0x5d')]=function(_0x429d34,_0x5d2266,_0x40f063,_0x12c860,_0x135ad9,_0x4afcdf){var _0x3cb1fc,_0x5c4d8b;_0x4afcdf[_0xd141('0x1d')]=intUtil[_0xd141('0x42')](_0x4afcdf['remoteUri']);_0x4afcdf[_0xd141('0x53')]=intUtil[_0xd141('0x42')](_0x4afcdf[_0xd141('0x53')]);if(_0x135ad9&&_0x135ad9[_0xd141('0x43')]){logger[_0xd141('0xd')]('['+_0x5d2266[_0xd141('0x5e')][_0xd141('0x5f')]()+']',_0xd141('0x56'));_0x5d2266[_0xd141('0x45')]=util[_0xd141('0x10')](_0xd141('0x46'),_0x4afcdf[_0xd141('0x53')],_0x5d2266[_0xd141('0x47')],md5(_0x5d2266[_0xd141('0x47')]));}else{_0x5d2266['recordingURL']='';}headers[_0xd141('0x48')]=getAuth(_0x4afcdf);return getUser(_0x4afcdf,'')[_0xd141('0x1e')](function(_0x6f48b){_0x3cb1fc=_0x6f48b;logger['info']('The\x20User\x20ID\x20is:',_0x3cb1fc['id']);return getEndUser(_0x4afcdf,_0x5d2266[_0xd141('0x12')],_0x5d2266[_0xd141('0x4b')]);})[_0xd141('0x1e')](function(_0x1ac5d9){_0x5c4d8b=_0x1ac5d9;logger[_0xd141('0xd')](_0xd141('0x4c'),_0x5c4d8b['id']);return getTicket(_0x4afcdf,_0x3cb1fc,_0x5c4d8b,_0x40f063,_0x5d2266);})[_0xd141('0x1e')](function(_0x32cea8){if(_0x32cea8){logger[_0xd141('0xd')](_0xd141('0x4d'));logger[_0xd141('0xd')](_0xd141('0x4e'),_0x32cea8['id']);}})['catch'](function(_0x4e7d88){logger[_0xd141('0x51')]('['+_0x5d2266[_0xd141('0x5e')][_0xd141('0x5f')]()+']',JSON['stringify'](_0x4e7d88));});}; \ 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 1c27203..93a7a98 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 _0x3612=['none','recordingURL','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','/api/selector/owners','headers','then','users','email','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','info','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','GET','&f=','&entities=contact','find','contacts','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','adminId','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','Task\x20created:','/contacts/','emit','Token\x20token=','apiKey','remoteUri','adminEmail','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat'];(function(_0x3ac7a1,_0x151071){var _0x127a39=function(_0x5525de){while(--_0x5525de){_0x3ac7a1['push'](_0x3ac7a1['shift']());}};_0x127a39(++_0x151071);}(_0x3612,0x19b));var _0x2361=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0x3612[_0x578275];return _0xf78041;};'use strict';var _=require(_0x2361('0x0'));var rp=require(_0x2361('0x1'));var md5=require(_0x2361('0x2'));var util=require(_0x2361('0x3'));var moment=require(_0x2361('0x4'));var Promise=require(_0x2361('0x5'));var Redis=require(_0x2361('0x6'));var intUtil=require(_0x2361('0x7'));var config=require(_0x2361('0x8'));var logger=require(_0x2361('0x9'))(_0x2361('0xa'));config[_0x2361('0xb')]=_[_0x2361('0xc')](config['redis'],{'host':_0x2361('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2361('0xb')]));function getAdminId(_0x2446ae,_0x5268cf,_0x51e64e,_0x362084){return new Promise(function(_0x1c6b8d,_0x1c028b){var _0x1605a4=![];var _0x1c0416={'method':'GET','uri':_0x362084+_0x2361('0xe'),'json':!![]};_0x1c0416[_0x2361('0xf')]=_0x51e64e;logger['info']('Getting\x20admin\x20information');return rp(_0x1c0416)[_0x2361('0x10')](function(_0x2161a2){if(_0x2161a2){var _0x19907f=_0x2161a2[_0x2361('0x11')];var _0x3cb7c5=null;for(_0x3cb7c5=0x0;_0x3cb7c5<_0x19907f['length'];_0x3cb7c5++){if(_0x19907f[_0x3cb7c5][_0x2361('0x12')]===_0x2446ae['adminEmail']){_0x2446ae['adminId']=_0x19907f[_0x3cb7c5]['id'];_0x1605a4=!![];}}if(_0x1605a4){logger['info'](_0x2361('0x13'),_0x2446ae['adminId']);_0x1c6b8d(_0x2446ae);}else{_0x1c028b({'statusCode':0x194,'message':_0x2361('0x14')});}}else{_0x1c028b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x2361('0x15')](function(_0x2ecbe5){logger[_0x2361('0x16')]('['+[_0x5268cf[_0x2361('0x17')]()]+']',_0x2ecbe5[_0x2361('0x18')]);_0x1c028b(_0x2ecbe5);});});}function getUser(_0x15e98d,_0x1a1c7d,_0x1089d3){return function(_0x5d1817){return new Promise(function(_0x3fd457,_0x42bc0a){var _0xbb8027={'method':'GET','uri':_0x1089d3+_0x2361('0xe'),'json':!![]};_0xbb8027[_0x2361('0xf')]=_0x1a1c7d;logger[_0x2361('0x19')](_0x2361('0x1a'));return rp(_0xbb8027)[_0x2361('0x10')](function(_0x1079a4){if(_0x1079a4){var _0x154f73=_0x1079a4['users'];var _0x1ec459=![];var _0x3ffe92=null;if(_0x5d1817[_0x2361('0x1b')]!==null){logger[_0x2361('0x19')](_0x2361('0x1c'),_0x5d1817[_0x2361('0x1b')]);_0x5d1817[_0x2361('0x1d')]=_0x5d1817['agentEmail'];for(_0x3ffe92=0x0;_0x3ffe92<_0x154f73[_0x2361('0x1e')];_0x3ffe92++){if(_0x154f73[_0x3ffe92][_0x2361('0x12')]===_0x5d1817[_0x2361('0x1b')]){_0x1ec459=!![];_0x5d1817[_0x2361('0x1f')]=_0x154f73[_0x3ffe92]['id'];logger[_0x2361('0x19')](_0x2361('0x20'),_0x5d1817[_0x2361('0x1f')]);}}}if(!_0x1ec459){logger['info'](_0x2361('0x21'));_0x5d1817[_0x2361('0x1d')]=_0x5d1817['adminEmail'];_0x5d1817['userId']=_0x5d1817['adminId'];_0x1ec459=!![];}if(_0x1ec459){_0x3fd457(_0x5d1817);}else{_0x42bc0a({'statusCode':0x194,'message':_0x2361('0x14')});}}else{_0x42bc0a({'statusCode':0x194,'message':_0x2361('0x14')});}})['catch'](function(_0x5cfe69){logger[_0x2361('0x16')]('['+[_0x15e98d[_0x2361('0x17')]()]+']',_0x5cfe69['message']);_0x42bc0a(_0x5cfe69);});});};}function searchContact(_0x10610b,_0x4c30d0,_0x123146,_0x41c149){return new Promise(function(_0x564c8e,_0x2adeb8){var _0x1c4f78={'method':_0x2361('0x22'),'headers':_0x4c30d0,'uri':_0x10610b+'/api/lookup?q='+_0x41c149+_0x2361('0x23')+_0x123146+_0x2361('0x24'),'json':!![]};rp(_0x1c4f78)[_0x2361('0x10')](function(_0x4b2e0a){var _0x4337cd=_[_0x2361('0x25')](_0x4b2e0a[_0x2361('0x26')][_0x2361('0x26')],[_0x123146,_0x41c149]);_0x564c8e(_0x4337cd);})[_0x2361('0x15')](function(_0x5c424c){_0x2adeb8(_0x5c424c);});});}function getEndUser(_0x14e908,_0x2ab257,_0x4a91e6){return function(_0x1fb739){return new Promise(function(_0x51688b,_0x4ad93b){logger['info'](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x1fb739[_0x2361('0x27')]));searchContact(_0x4a91e6,_0x2ab257,'mobile_number',_0x1fb739[_0x2361('0x27')])[_0x2361('0x10')](function(_0x27e6d4){if(_0x27e6d4){_0x1fb739[_0x2361('0x28')]=_0x27e6d4['id'];logger[_0x2361('0x19')]('Contact\x20found\x20mobile_number:',_0x1fb739[_0x2361('0x28')]);return _0x51688b(_0x1fb739);}searchContact(_0x4a91e6,_0x2ab257,_0x2361('0x29'),_0x1fb739[_0x2361('0x27')])[_0x2361('0x10')](function(_0x19e587){if(_0x19e587){_0x1fb739['endUserId']=_0x19e587['id'];logger[_0x2361('0x19')](_0x2361('0x2a'),_0x1fb739[_0x2361('0x28')]);return _0x51688b(_0x1fb739);}createEndUser(_0x1fb739,_0x14e908,_0x2ab257,_0x4a91e6)[_0x2361('0x10')](function(_0x4b463e){logger[_0x2361('0x19')](_0x2361('0x2b'),_0x4b463e['endUserId']);return _0x51688b(_0x4b463e);});});})['catch'](function(_0x5939a8){_0x4ad93b(_0x5939a8);});});};}function createEndUser(_0x1f2a94,_0x4727ee,_0x2f2892,_0xed45d8){return new Promise(function(_0x41beeb,_0x2e62a3){var _0x41197e=moment();var _0x198778={'method':'POST','uri':_0xed45d8+_0x2361('0x2c'),'body':{'contact':{'last_name':_0x1f2a94[_0x2361('0x27')],'work_number':_0x1f2a94[_0x2361('0x27')],'mobile_number':_0x1f2a94['contactNumber'],'owner_id':_0x1f2a94[_0x2361('0x1f')],'created_at':_0x41197e[_0x2361('0x2d')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x198778[_0x2361('0xf')]=_0x2f2892;logger[_0x2361('0x19')](_0x2361('0x2e'));return rp(_0x198778)[_0x2361('0x10')](function(_0x41cdf9){_0x1f2a94[_0x2361('0x28')]=_0x41cdf9['contact']['id'];_0x41beeb(_0x1f2a94);})['catch'](function(_0x140cfc){logger[_0x2361('0x16')]('['+[_0x4727ee[_0x2361('0x17')]()]+']',_0x140cfc[_0x2361('0x18')]);_0x2e62a3(_0x140cfc[_0x2361('0x18')]);});});}function getTicket(_0x51d2aa,_0x424c2c,_0x1d3ccf,_0x3d3195,_0x501369){return function(_0x58a690){logger[_0x2361('0x19')](_0x2361('0x2f'));return new Promise(function(_0x3e924c,_0xa48d15){var _0x2abfd0=moment();var _0x56dcdf={'method':_0x2361('0x30'),'uri':_0x1d3ccf+_0x2361('0x31'),'body':{'title':intUtil[_0x2361('0x32')](_0x3d3195[_0x2361('0x33')],_0x501369,'\x20'),'description':intUtil[_0x2361('0x32')](_0x3d3195['Descriptions'],_0x501369,'\x0a'),'owner_id':_0x58a690[_0x2361('0x1f')],'creater_id':_0x58a690[_0x2361('0x34')],'targetable_id':_0x58a690[_0x2361('0x28')],'targetable_type':_0x2361('0x35'),'created_at':_0x2abfd0[_0x2361('0x2d')](_0x2361('0x36')),'due_date':_0x2abfd0['add'](0x1e,'m')[_0x2361('0x2d')](_0x2361('0x36'))},'json':!![]};_0x56dcdf[_0x2361('0xf')]=_0x424c2c;return rp(_0x56dcdf)['then'](function(_0x156b8f){_0x58a690[_0x2361('0x37')]=_0x156b8f['task']['id'];logger[_0x2361('0x19')](_0x2361('0x38'),_0x58a690['ticketId']);_0x3e924c(_0x58a690);})[_0x2361('0x15')](function(_0x2adf5e){logger[_0x2361('0x16')]('['+[_0x51d2aa[_0x2361('0x17')]()]+']',_0x2adf5e[_0x2361('0x18')]);_0xa48d15(_0x2adf5e[_0x2361('0x18')]);});});};}function emit(_0x164dde,_0xe8fa29,_0x3b4b7f){var _0x1aa9a4={'uri':_0x164dde+_0x2361('0x39')+_0x3b4b7f};io['to'](util[_0x2361('0x2d')]('user:%s',_0xe8fa29))[_0x2361('0x3a')]('trigger:browser:url',_0x1aa9a4);}exports['cs']=function(_0x442729,_0x42218b,_0x3ce0e1,_0x6aa289,_0x5e74db,_0x6f9458,_0x39e4b6,_0x36d503){var _0x1c538d={};var _0x266a75={'Authorization':_0x2361('0x3b')+_0x6f9458[_0x2361('0x3c')]};_0x6f9458['remoteUri']=intUtil['stripTrailingSlash'](_0x6f9458['remoteUri']);_0x6f9458['serverUrl']=intUtil['stripTrailingSlash'](_0x6f9458['serverUrl']);var _0xbff189=_0x6f9458[_0x2361('0x3d')];_0x1c538d[_0x2361('0x3e')]=_0x6f9458[_0x2361('0x3f')];_0x1c538d[_0x2361('0x27')]=_0x36d503[_0x2361('0x40')]()==='outbound'?_0x42218b[_0x2361('0x41')]:_0x42218b[_0x2361('0x42')];_0x1c538d[_0x2361('0x43')]=_0x36d503===_0x2361('0x44')||_0x36d503==='unmanaged'?_0x2361('0x44'):_0x2361('0x45');if(_0x6aa289){_0x1c538d[_0x2361('0x1b')]=_0x6aa289[_0x2361('0x12')];}var _0x2423ff=util[_0x2361('0x2d')](_0x2361('0x46'),_0x6f9458['serverUrl'],_0x42218b[_0x2361('0x47')],md5(_0x42218b['uniqueid']));if(_0x5e74db&&_0x5e74db[_0x2361('0x48')]){logger[_0x2361('0x19')]('[QUEUE]',_0x2361('0x49'));_0x42218b['recordingURL']=_0x2423ff;}else if(_0x39e4b6&&_0x39e4b6['recordingFormat']&&_0x39e4b6[_0x2361('0x4a')]!==_0x2361('0x4b')){logger[_0x2361('0x19')]('[OUTBOUND]',_0x2361('0x49'));_0x42218b[_0x2361('0x4c')]=_0x2423ff;}else{_0x42218b[_0x2361('0x4c')]='';}return getAdminId(_0x1c538d,_0x36d503,_0x266a75,_0xbff189)[_0x2361('0x10')](getUser(_0x36d503,_0x266a75,_0xbff189))[_0x2361('0x10')](getEndUser(_0x36d503,_0x266a75,_0xbff189))[_0x2361('0x10')](getTicket(_0x36d503,_0x266a75,_0xbff189,_0x3ce0e1,_0x42218b))[_0x2361('0x10')](function(_0x1bf296){logger[_0x2361('0x19')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x1bf296[_0x2361('0x37')]));if(_0x36d503!==_0x2361('0x4d')){logger[_0x2361('0x19')]('['+[_0x36d503[_0x2361('0x17')]()]+']',_0x2361('0x4e'));emit(_0xbff189,_0x6aa289['name'],_0x1bf296[_0x2361('0x28')]);}})[_0x2361('0x15')](function(_0x5445be){logger[_0x2361('0x16')]('['+[_0x36d503['toUpperCase']()]+_0x2361('0x4f'),util[_0x2361('0x50')](_0x5445be,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd393=['message','Getting\x20user\x20with\x20email','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','adminId','toUpperCase','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','util','moment','bluebird','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error'];(function(_0x627b1b,_0x462114){var _0x2fd022=function(_0x2059c5){while(--_0x2059c5){_0x627b1b['push'](_0x627b1b['shift']());}};_0x2fd022(++_0x462114);}(_0xd393,0x12c));var _0x3d39=function(_0x25af72,_0x5ef6d2){_0x25af72=_0x25af72-0x0;var _0x310697=_0xd393[_0x25af72];return _0x310697;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x3d39('0x0'));var moment=require(_0x3d39('0x1'));var Promise=require(_0x3d39('0x2'));var Redis=require(_0x3d39('0x3'));var intUtil=require(_0x3d39('0x4'));var config=require('../../../../config/environment');var logger=require(_0x3d39('0x5'))('freshsales');config[_0x3d39('0x6')]=_[_0x3d39('0x7')](config['redis'],{'host':_0x3d39('0x8'),'port':0x18eb});var io=require(_0x3d39('0x9'))(new Redis(config[_0x3d39('0x6')]));function getAdminId(_0x1f27da,_0x5ddd24,_0x51dae5,_0x45e12d){return new Promise(function(_0x4c7261,_0x418622){var _0x13150a=![];var _0x34e0f3={'method':_0x3d39('0xa'),'uri':_0x45e12d+_0x3d39('0xb'),'json':!![]};_0x34e0f3[_0x3d39('0xc')]=_0x51dae5;logger[_0x3d39('0xd')](_0x3d39('0xe'));return rp(_0x34e0f3)[_0x3d39('0xf')](function(_0x48d5e0){if(_0x48d5e0){var _0x5147b8=_0x48d5e0[_0x3d39('0x10')];var _0x2dc2fa=null;for(_0x2dc2fa=0x0;_0x2dc2fa<_0x5147b8[_0x3d39('0x11')];_0x2dc2fa++){if(_0x5147b8[_0x2dc2fa][_0x3d39('0x12')]===_0x1f27da[_0x3d39('0x13')]){_0x1f27da['adminId']=_0x5147b8[_0x2dc2fa]['id'];_0x13150a=!![];}}if(_0x13150a){logger['info'](_0x3d39('0x14'),_0x1f27da['adminId']);_0x4c7261(_0x1f27da);}else{_0x418622({'statusCode':0x194,'message':_0x3d39('0x15')});}}else{_0x418622({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x3d39('0x16')](function(_0x3aff43){logger[_0x3d39('0x17')]('['+[_0x5ddd24['toUpperCase']()]+']',_0x3aff43[_0x3d39('0x18')]);_0x418622(_0x3aff43);});});}function getUser(_0x3e18e7,_0x2124a1,_0x162c3e){return function(_0x163a0b){return new Promise(function(_0xec4000,_0xfbf68a){var _0x1f36ef={'method':'GET','uri':_0x162c3e+_0x3d39('0xb'),'json':!![]};_0x1f36ef[_0x3d39('0xc')]=_0x2124a1;logger[_0x3d39('0xd')]('Getting\x20user\x20list');return rp(_0x1f36ef)['then'](function(_0x5a89e3){if(_0x5a89e3){var _0x9c7675=_0x5a89e3[_0x3d39('0x10')];var _0x2ef79=![];var _0x465a46=null;if(_0x163a0b['agentEmail']!==null){logger['info'](_0x3d39('0x19'),_0x163a0b[_0x3d39('0x1a')]);_0x163a0b[_0x3d39('0x1b')]=_0x163a0b[_0x3d39('0x1a')];for(_0x465a46=0x0;_0x465a46<_0x9c7675[_0x3d39('0x11')];_0x465a46++){if(_0x9c7675[_0x465a46][_0x3d39('0x12')]===_0x163a0b['agentEmail']){_0x2ef79=!![];_0x163a0b['userId']=_0x9c7675[_0x465a46]['id'];logger[_0x3d39('0xd')](_0x3d39('0x1c'),_0x163a0b[_0x3d39('0x1d')]);}}}if(!_0x2ef79){logger[_0x3d39('0xd')](_0x3d39('0x1e'));_0x163a0b[_0x3d39('0x1b')]=_0x163a0b[_0x3d39('0x13')];_0x163a0b[_0x3d39('0x1d')]=_0x163a0b[_0x3d39('0x1f')];_0x2ef79=!![];}if(_0x2ef79){_0xec4000(_0x163a0b);}else{_0xfbf68a({'statusCode':0x194,'message':_0x3d39('0x15')});}}else{_0xfbf68a({'statusCode':0x194,'message':_0x3d39('0x15')});}})[_0x3d39('0x16')](function(_0x3f0691){logger[_0x3d39('0x17')]('['+[_0x3e18e7[_0x3d39('0x20')]()]+']',_0x3f0691[_0x3d39('0x18')]);_0xfbf68a(_0x3f0691);});});};}function searchContact(_0x1c0de1,_0x5ac703,_0x9f7247,_0x55f52a){return new Promise(function(_0x27ba0b,_0x29d4b9){var _0x433ff9={'method':_0x3d39('0xa'),'headers':_0x5ac703,'uri':_0x1c0de1+'/api/lookup?q='+_0x55f52a+'&f='+_0x9f7247+_0x3d39('0x21'),'json':!![]};rp(_0x433ff9)[_0x3d39('0xf')](function(_0x57527b){var _0x5654cc=_['find'](_0x57527b[_0x3d39('0x22')][_0x3d39('0x22')],[_0x9f7247,_0x55f52a]);_0x27ba0b(_0x5654cc);})[_0x3d39('0x16')](function(_0x16b3eb){_0x29d4b9(_0x16b3eb);});});}function getEndUser(_0x5542bc,_0x3ac1fe,_0x24f341){return function(_0x5462d5){return new Promise(function(_0x400002,_0x16c351){logger['info'](util[_0x3d39('0x23')](_0x3d39('0x24'),_0x5462d5[_0x3d39('0x25')]));searchContact(_0x24f341,_0x3ac1fe,'mobile_number',_0x5462d5['contactNumber'])[_0x3d39('0xf')](function(_0xa60182){if(_0xa60182){_0x5462d5[_0x3d39('0x26')]=_0xa60182['id'];logger[_0x3d39('0xd')](_0x3d39('0x27'),_0x5462d5['endUserId']);return _0x400002(_0x5462d5);}searchContact(_0x24f341,_0x3ac1fe,_0x3d39('0x28'),_0x5462d5['contactNumber'])[_0x3d39('0xf')](function(_0x16ba88){if(_0x16ba88){_0x5462d5['endUserId']=_0x16ba88['id'];logger[_0x3d39('0xd')](_0x3d39('0x29'),_0x5462d5[_0x3d39('0x26')]);return _0x400002(_0x5462d5);}createEndUser(_0x5462d5,_0x5542bc,_0x3ac1fe,_0x24f341)[_0x3d39('0xf')](function(_0x4fc325){logger[_0x3d39('0xd')]('Contact\x20created:',_0x4fc325[_0x3d39('0x26')]);return _0x400002(_0x4fc325);});});})[_0x3d39('0x16')](function(_0x44ef4b){_0x16c351(_0x44ef4b);});});};}function createEndUser(_0xe5e795,_0x2bd0a5,_0x25fefc,_0x444ea7){return new Promise(function(_0xdbf424,_0x803c76){var _0x439939=moment();var _0x38b5f7={'method':_0x3d39('0x2a'),'uri':_0x444ea7+'/api/contacts','body':{'contact':{'last_name':_0xe5e795['contactNumber'],'work_number':_0xe5e795[_0x3d39('0x25')],'mobile_number':_0xe5e795[_0x3d39('0x25')],'owner_id':_0xe5e795[_0x3d39('0x1d')],'created_at':_0x439939[_0x3d39('0x23')](_0x3d39('0x2b'))}},'json':!![]};_0x38b5f7[_0x3d39('0xc')]=_0x25fefc;logger[_0x3d39('0xd')](_0x3d39('0x2c'));return rp(_0x38b5f7)['then'](function(_0x3bcd8c){_0xe5e795[_0x3d39('0x26')]=_0x3bcd8c[_0x3d39('0x2d')]['id'];_0xdbf424(_0xe5e795);})[_0x3d39('0x16')](function(_0x24b812){logger['error']('['+[_0x2bd0a5[_0x3d39('0x20')]()]+']',_0x24b812[_0x3d39('0x18')]);_0x803c76(_0x24b812[_0x3d39('0x18')]);});});}function getTicket(_0x21109b,_0x4c9c31,_0x5a0d62,_0x45e4ae,_0x1b51a3){return function(_0x247b73){logger['info'](_0x3d39('0x2e'));return new Promise(function(_0x11724f,_0x3ce47f){var _0x51e8f1=moment();var _0x3f1f5d={'method':_0x3d39('0x2a'),'uri':_0x5a0d62+_0x3d39('0x2f'),'body':{'title':intUtil[_0x3d39('0x30')](_0x45e4ae[_0x3d39('0x31')],_0x1b51a3,'\x20'),'description':intUtil['getString'](_0x45e4ae['Descriptions'],_0x1b51a3,'\x0a'),'owner_id':_0x247b73[_0x3d39('0x1d')],'creater_id':_0x247b73['adminId'],'targetable_id':_0x247b73[_0x3d39('0x26')],'targetable_type':_0x3d39('0x32'),'created_at':_0x51e8f1[_0x3d39('0x23')](_0x3d39('0x2b')),'due_date':_0x51e8f1[_0x3d39('0x33')](0x1e,'m')[_0x3d39('0x23')](_0x3d39('0x2b'))},'json':!![]};_0x3f1f5d[_0x3d39('0xc')]=_0x4c9c31;return rp(_0x3f1f5d)['then'](function(_0x1238c8){_0x247b73[_0x3d39('0x34')]=_0x1238c8[_0x3d39('0x35')]['id'];logger[_0x3d39('0xd')]('Task\x20created:',_0x247b73['ticketId']);_0x11724f(_0x247b73);})[_0x3d39('0x16')](function(_0xcd88da){logger[_0x3d39('0x17')]('['+[_0x21109b[_0x3d39('0x20')]()]+']',_0xcd88da['message']);_0x3ce47f(_0xcd88da[_0x3d39('0x18')]);});});};}function emit(_0x178453,_0x4c959c,_0x49efe9){var _0x37eb69={'uri':_0x178453+_0x3d39('0x36')+_0x49efe9};io['to'](util['format'](_0x3d39('0x37'),_0x4c959c))[_0x3d39('0x38')](_0x3d39('0x39'),_0x37eb69);}exports['cs']=function(_0x5dad89,_0x50c909,_0x88278d,_0x23d1cb,_0x2ca504,_0x4fa254,_0x1c077d,_0x4fe30e){var _0x4fe2ed={};var _0x39fda9={'Authorization':'Token\x20token='+_0x4fa254[_0x3d39('0x3a')]};_0x4fa254['remoteUri']=intUtil[_0x3d39('0x3b')](_0x4fa254['remoteUri']);_0x4fa254[_0x3d39('0x3c')]=intUtil[_0x3d39('0x3b')](_0x4fa254['serverUrl']);var _0x3b7bab=_0x4fa254[_0x3d39('0x3d')];_0x4fe2ed[_0x3d39('0x13')]=_0x4fa254[_0x3d39('0x3e')];_0x4fe2ed[_0x3d39('0x25')]=_0x4fe30e[_0x3d39('0x3f')]()===_0x3d39('0x40')?_0x50c909[_0x3d39('0x41')]:_0x50c909[_0x3d39('0x42')];_0x4fe2ed[_0x3d39('0x43')]=_0x4fe30e===_0x3d39('0x44')||_0x4fe30e===_0x3d39('0x45')?_0x3d39('0x44'):_0x3d39('0x40');if(_0x23d1cb){_0x4fe2ed['agentEmail']=_0x23d1cb[_0x3d39('0x12')];}var _0x356903=util['format'](_0x3d39('0x46'),_0x4fa254[_0x3d39('0x3c')],_0x50c909[_0x3d39('0x47')],md5(_0x50c909[_0x3d39('0x47')]));if(_0x2ca504&&_0x2ca504['monitor_format']){logger[_0x3d39('0xd')](_0x3d39('0x48'),_0x3d39('0x49'));_0x50c909[_0x3d39('0x4a')]=_0x356903;}else if(_0x1c077d&&_0x1c077d[_0x3d39('0x4b')]&&_0x1c077d[_0x3d39('0x4b')]!==_0x3d39('0x4c')){logger[_0x3d39('0xd')](_0x3d39('0x4d'),'Recording\x20is\x20enabled!');_0x50c909['recordingURL']=_0x356903;}else{_0x50c909[_0x3d39('0x4a')]='';}return getAdminId(_0x4fe2ed,_0x4fe30e,_0x39fda9,_0x3b7bab)['then'](getUser(_0x4fe30e,_0x39fda9,_0x3b7bab))[_0x3d39('0xf')](getEndUser(_0x4fe30e,_0x39fda9,_0x3b7bab))['then'](getTicket(_0x4fe30e,_0x39fda9,_0x3b7bab,_0x88278d,_0x50c909))[_0x3d39('0xf')](function(_0x550e48){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x550e48[_0x3d39('0x34')]));if(_0x4fe30e!==_0x3d39('0x45')){logger[_0x3d39('0xd')]('['+[_0x4fe30e[_0x3d39('0x20')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3b7bab,_0x23d1cb[_0x3d39('0x4e')],_0x550e48[_0x3d39('0x26')]);}})[_0x3d39('0x16')](function(_0x27024d){logger['error']('['+[_0x4fe30e[_0x3d39('0x20')]()]+_0x3d39('0x4f'),util[_0x3d39('0x50')](_0x27024d,{'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 6245536..8e3a89d 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 _0xfa25=['find','data3','queue','outbound','log','EVENT\x20UNKNOWN','freshdesk','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','zendesk','salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','includes','toLowerCase','data1'];(function(_0xfad00d,_0x311d9b){var _0x28328c=function(_0x5bb4b1){while(--_0x5bb4b1){_0xfad00d['push'](_0xfad00d['shift']());}};_0x28328c(++_0x311d9b);}(_0xfa25,0xba));var _0x5fa2=function(_0x41054b,_0xe82034){_0x41054b=_0x41054b-0x0;var _0x468e13=_0xfa25[_0x41054b];return _0x468e13;};'use strict';var _=require('lodash');var util=require(_0x5fa2('0x0'));var zendesk=require(_0x5fa2('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x5fa2('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x5fa2('0x3'));var desk=require(_0x5fa2('0x4'));var vtiger=require(_0x5fa2('0x5'));var servicenow=require(_0x5fa2('0x6'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x5fa2('0x7'),_0x5fa2('0x8'),_0x5fa2('0x9'),'freshdesk',_0x5fa2('0xa'),'desk',_0x5fa2('0xb'),_0x5fa2('0xc'),_0x5fa2('0xd'),_0x5fa2('0xe')];exports['exec']=function(_0x480445,_0x420f76,_0xc820d,_0x333595,_0x2c28a3,_0x5daa33){if(_0xc820d){if(_[_0x5fa2('0xf')](integrations,_0x480445['data1'][_0x5fa2('0x10')]())){try{var _0x19f8ed=null;var _0x494275='';var _0x25069e=_0xc820d[_0x480445[_0x5fa2('0x11')][_0x5fa2('0x10')]()];if(_0x25069e){var _0x4f059c=_0x25069e[_0x480445['data2']];if(_0x4f059c){var _0x45ebe9=_[_0x5fa2('0x12')](_0x4f059c['Configurations'],{'id':parseInt(_0x480445[_0x5fa2('0x13')],0xa)});if(_0x45ebe9){if(_0x333595){if(_0x2c28a3&&_0x420f76[_0x5fa2('0x14')]){_0x494275=_0x5fa2('0x14');}else if(_0x420f76['routeId']){_0x494275=_0x5fa2('0x15');}else{console[_0x5fa2('0x16')](_0x5fa2('0x17'),_0x420f76);}}else{_0x494275='unmanaged';}switch(_0x480445[_0x5fa2('0x11')][_0x5fa2('0x10')]()){case _0x5fa2('0x7'):zendesk[_0x494275](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33);break;case _0x5fa2('0x8'):salesforce[_0x494275](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33);break;case _0x5fa2('0x9'):sugarcrm[_0x494275](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33);break;case _0x5fa2('0x18'):freshdesk[_0x494275](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33);break;case _0x5fa2('0xa'):zoho[_0x494275](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33);break;case _0x5fa2('0x19'):desk[_0x494275](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33);break;case'vtiger':vtiger[_0x494275](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33);break;case _0x5fa2('0xd'):freshsales['cs'](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33,_0x494275);break;case _0x5fa2('0xe'):servicenow['cs'](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33,_0x494275);break;case _0x5fa2('0xc'):dynamics365['cs'](_0x480445,_0x420f76,_0x45ebe9,_0x333595,_0x2c28a3,_0x4f059c,_0x5daa33,_0x494275);break;default:console[_0x5fa2('0x16')](_0x5fa2('0x1a'));}}else{_0x19f8ed=require(_0x5fa2('0x1b'))(_0x480445[_0x5fa2('0x11')][_0x5fa2('0x10')]());_0x19f8ed[_0x5fa2('0x1c')](_0x5fa2('0x1d'),util[_0x5fa2('0x1e')](_0x5fa2('0x1f'),_0x480445[_0x5fa2('0x11')][_0x5fa2('0x10')](),_0x480445[_0x5fa2('0x13')]));}}else{_0x19f8ed=require(_0x5fa2('0x1b'))(_0x480445[_0x5fa2('0x11')][_0x5fa2('0x10')]());_0x19f8ed[_0x5fa2('0x1c')](_0x5fa2('0x1d'),util['format'](_0x5fa2('0x20'),_0x480445['data1']['toLowerCase'](),_0x480445[_0x5fa2('0x21')]));}}else{}}catch(_0x4294ee){console[_0x5fa2('0x1c')](_0x4294ee);}}}}; \ No newline at end of file +var _0xd9f3=['freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xd9f3,0x183));var _0x3d9f=function(_0x78f5eb,_0x47a1dd){_0x78f5eb=_0x78f5eb-0x0;var _0x580dcc=_0xd9f3[_0x78f5eb];return _0x580dcc;};'use strict';var _=require('lodash');var util=require(_0x3d9f('0x0'));var zendesk=require(_0x3d9f('0x1'));var salesforce=require(_0x3d9f('0x2'));var sugarcrm=require(_0x3d9f('0x3'));var freshdesk=require(_0x3d9f('0x4'));var zoho=require(_0x3d9f('0x5'));var desk=require(_0x3d9f('0x6'));var vtiger=require(_0x3d9f('0x7'));var servicenow=require(_0x3d9f('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0x3d9f('0x9'));var integrations=[_0x3d9f('0xa'),_0x3d9f('0xb'),_0x3d9f('0xc'),_0x3d9f('0xd'),_0x3d9f('0xe'),_0x3d9f('0xf'),_0x3d9f('0x10'),_0x3d9f('0x11'),_0x3d9f('0x12'),_0x3d9f('0x13')];exports[_0x3d9f('0x14')]=function(_0x2e3dd2,_0x14439a,_0x3a94fb,_0x43be02,_0x231865,_0x101b9a){if(_0x3a94fb){if(_[_0x3d9f('0x15')](integrations,_0x2e3dd2['data1'][_0x3d9f('0x16')]())){try{var _0x5a20de=null;var _0x5b4d46='';var _0x4bf1ea=_0x3a94fb[_0x2e3dd2[_0x3d9f('0x17')][_0x3d9f('0x16')]()];if(_0x4bf1ea){var _0x1da5b=_0x4bf1ea[_0x2e3dd2['data2']];if(_0x1da5b){var _0x4cac10=_[_0x3d9f('0x18')](_0x1da5b[_0x3d9f('0x19')],{'id':parseInt(_0x2e3dd2[_0x3d9f('0x1a')],0xa)});if(_0x4cac10){if(_0x43be02){if(_0x231865&&_0x14439a[_0x3d9f('0x1b')]){_0x5b4d46='queue';}else if(_0x14439a[_0x3d9f('0x1c')]){_0x5b4d46=_0x3d9f('0x1d');}else{console[_0x3d9f('0x1e')](_0x3d9f('0x1f'),_0x14439a);}}else{_0x5b4d46=_0x3d9f('0x20');}switch(_0x2e3dd2['data1'][_0x3d9f('0x16')]()){case _0x3d9f('0xa'):zendesk[_0x5b4d46](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a);break;case _0x3d9f('0xb'):salesforce[_0x5b4d46](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a);break;case'sugarcrm':sugarcrm[_0x5b4d46](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a);break;case'freshdesk':freshdesk[_0x5b4d46](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a);break;case _0x3d9f('0xe'):zoho[_0x5b4d46](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a);break;case _0x3d9f('0xf'):desk[_0x5b4d46](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a);break;case _0x3d9f('0x10'):vtiger[_0x5b4d46](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a);break;case'freshsales':freshsales['cs'](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a,_0x5b4d46);break;case'servicenow':servicenow['cs'](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a,_0x5b4d46);break;case'dynamics365':dynamics365['cs'](_0x2e3dd2,_0x14439a,_0x4cac10,_0x43be02,_0x231865,_0x1da5b,_0x101b9a,_0x5b4d46);break;default:console[_0x3d9f('0x1e')](_0x3d9f('0x21'));}}else{_0x5a20de=require(_0x3d9f('0x22'))(_0x2e3dd2[_0x3d9f('0x17')][_0x3d9f('0x16')]());_0x5a20de[_0x3d9f('0x23')](_0x3d9f('0x24'),util['format'](_0x3d9f('0x25'),_0x2e3dd2[_0x3d9f('0x17')][_0x3d9f('0x16')](),_0x2e3dd2[_0x3d9f('0x1a')]));}}else{_0x5a20de=require(_0x3d9f('0x22'))(_0x2e3dd2[_0x3d9f('0x17')]['toLowerCase']());_0x5a20de['error'](_0x3d9f('0x24'),util[_0x3d9f('0x26')](_0x3d9f('0x27'),_0x2e3dd2[_0x3d9f('0x17')]['toLowerCase'](),_0x2e3dd2['data2']));}}else{}}catch(_0x573bab){console[_0x3d9f('0x23')](_0x573bab);}}}}; \ 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 9587ede..f98f504 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 _0xd6c3=['account_contact_lead','cloneDeep','additionalSearchAccount','merge','Account','first','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','No\x20Company','upperFirst','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','remoteUri','https://login.salesforce.com','clientId','clientSecret','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','newTab','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase','calleridnum','Fields',']\x20Integration\x20account\x20type\x20%s.','error','lodash','request-promise','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','endUserType','contact','lead','WhoId','account','AccountId','leadId','info','create','isNil','sobject','User','find','execute','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','$or','Contact','additionalSearchLead','Lead'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xd6c3,0x138));var _0x3d6c=function(_0x51c30c,_0x1b39f4){_0x51c30c=_0x51c30c-0x0;var _0x3f57bc=_0xd6c3[_0x51c30c];return _0x3f57bc;};'use strict';var _=require(_0x3d6c('0x0'));var rp=require(_0x3d6c('0x1'));var moment=require('moment');var BPromise=require(_0x3d6c('0x2'));var md5=require('md5');var jsforce=require(_0x3d6c('0x3'));var util=require(_0x3d6c('0x4'));var Redis=require(_0x3d6c('0x5'));var intUtil=require(_0x3d6c('0x6'));var config=require(_0x3d6c('0x7'));var logger=require(_0x3d6c('0x8'))(_0x3d6c('0x9'));config[_0x3d6c('0xa')]=_[_0x3d6c('0xb')](config[_0x3d6c('0xa')],{'host':_0x3d6c('0xc'),'port':0x18eb});var io=require(_0x3d6c('0xd'))(new Redis(config[_0x3d6c('0xa')]));function emit(_0x5e7458,_0x23a9a6,_0x301ebd){io['to'](_0x5e7458)[_0x3d6c('0xe')](_0x23a9a6,_0x301ebd);}function getTicket(_0x1b33c3,_0x4d1d3e,_0xe052fb,_0x452cf7,_0x5c1981,_0x49a6d0,_0xc0b573,_0x513684){var _0x407326=Object['assign']({},{'OwnerId':_0x4d1d3e['id'],'Subject':intUtil[_0x3d6c('0xf')](_0x452cf7[_0x3d6c('0x10')],_0x5c1981,'\x20'),'Description':intUtil['getString'](_0x452cf7[_0x3d6c('0x11')],_0x5c1981,'\x0a')},getCustomFields(_0x49a6d0,_0x5c1981));if(_0xe052fb){if(_0x452cf7[_0x3d6c('0x12')]==='Task'){_0x407326[_0x3d6c('0x13')]=moment[_0x3d6c('0x14')]();_0x407326[_0x3d6c('0x15')]=![];_0x407326['IsRecurrence']=![];if(_0xe052fb[_0x3d6c('0x16')]===_0x3d6c('0x17')||_0xe052fb[_0x3d6c('0x16')]===_0x3d6c('0x18')){_0x407326[_0x3d6c('0x19')]=_0xe052fb['id'];}else if(_0xe052fb[_0x3d6c('0x16')]===_0x3d6c('0x1a')){_0x407326['WhatId']=_0xe052fb['id'];}}else if(_0x452cf7[_0x3d6c('0x12')]==='Case'){if(_0xe052fb[_0x3d6c('0x16')]===_0x3d6c('0x17')){_0x407326['ContactId']=_0xe052fb['id'];}else if(_0xe052fb[_0x3d6c('0x16')]===_0x3d6c('0x1a')){_0x407326[_0x3d6c('0x1b')]=_0xe052fb['id'];}else if(_0xe052fb['endUserType']===_0x3d6c('0x18')&&_0x452cf7[_0x3d6c('0x1c')]){_0x407326[_0x452cf7[_0x3d6c('0x1c')]]=_0xe052fb['id'];}else{logger[_0x3d6c('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xc0b573['sobject'](_0x452cf7[_0x3d6c('0x12')])[_0x3d6c('0x1e')](_0x407326);}function getUser(_0x434ce0,_0x56f374,_0x2e04be){if(!_[_0x3d6c('0x1f')](_0x56f374)&&intUtil['validateEmail'](_0x56f374)){var _0x4e063c={'Email':_0x56f374};var _0x183ce6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2e04be[_0x3d6c('0x20')](_0x3d6c('0x21'))[_0x3d6c('0x22')](_0x4e063c,_0x183ce6)[_0x3d6c('0x23')]()['then'](function(_0x1837ca){if(_0x1837ca[_0x3d6c('0x24')]){var _0x3df058=_['find'](_0x1837ca,function(_0x777a5c){return _0x777a5c[_0x3d6c('0x25')]===_0x56f374;});if(_0x3df058){logger[_0x3d6c('0x1d')]('Agent\x20%s\x20found.',_0x56f374);return BPromise[_0x3d6c('0x26')]({'id':_0x3df058['Id'],'name':_0x3df058[_0x3d6c('0x27')]});}}else{logger['info'](_0x3d6c('0x28'),_0x56f374);return _0x2e04be['identity']()[_0x3d6c('0x29')](function(_0x497cbd){return BPromise['resolve']({'id':_0x497cbd[_0x3d6c('0x2a')],'name':_0x497cbd[_0x3d6c('0x2b')]});});}});}else{logger['info'](_0x3d6c('0x28'),_0x56f374);return _0x2e04be['identity']()['then'](function(_0x1b5acd){return BPromise[_0x3d6c('0x26')]({'id':_0x1b5acd['user_id'],'name':_0x1b5acd[_0x3d6c('0x2b')]});});}}function getEndUser(_0x1d8573,_0x58e59c,_0x4c4a27,_0x44b464,_0x4021fb){var _0x404d56={'$or':{'Phone':_0x44b464}};var _0x46c98e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3d6c('0x26')]()[_0x3d6c('0x29')](function(){logger[_0x3d6c('0x1d')](_0x3d6c('0x2c'),_0x44b464,_0x58e59c[_0x3d6c('0x2d')]);switch(_0x58e59c[_0x3d6c('0x2d')]){case'contact_lead':var _0x3a469d=_['cloneDeep'](_0x404d56);if(_0x58e59c['additionalSearchContact']){var _0x344d20={};_0x344d20[_0x58e59c[_0x3d6c('0x2e')]]=_0x44b464;_['merge'](_0x3a469d[_0x3d6c('0x2f')],_0x344d20);}return _0x4021fb['sobject'](_0x3d6c('0x30'))[_0x3d6c('0x22')](_0x3a469d,_0x46c98e)['execute']()[_0x3d6c('0x29')](function(_0x2a664f){if(_0x2a664f&&_0x2a664f[_0x3d6c('0x24')]){return _0x2a664f;}else{var _0x32663a=_['cloneDeep'](_0x404d56);if(_0x58e59c['additionalSearchLead']){var _0x51540b={};_0x51540b[_0x58e59c[_0x3d6c('0x31')]]=_0x44b464;_['merge'](_0x32663a[_0x3d6c('0x2f')],_0x51540b);}return _0x4021fb[_0x3d6c('0x20')](_0x3d6c('0x32'))[_0x3d6c('0x22')](_0x32663a,_0x46c98e);}});case _0x3d6c('0x33'):var _0x471a86=_[_0x3d6c('0x34')](_0x404d56);if(_0x58e59c[_0x3d6c('0x35')]){var _0x344d20={};_0x344d20[_0x58e59c[_0x3d6c('0x35')]]=_0x44b464;_[_0x3d6c('0x36')](_0x471a86['$or'],_0x344d20);}return _0x4021fb[_0x3d6c('0x20')](_0x3d6c('0x37'))['find'](_0x471a86,_0x46c98e)['execute']()['then'](function(_0x1435ba){if(_0x1435ba&&_0x1435ba[_0x3d6c('0x24')]){return _0x1435ba;}else{var _0x21e345=_['cloneDeep'](_0x404d56);if(_0x58e59c[_0x3d6c('0x2e')]){var _0x4d33e9={};_0x4d33e9[_0x58e59c['additionalSearchContact']]=_0x44b464;_[_0x3d6c('0x36')](_0x21e345[_0x3d6c('0x2f')],_0x4d33e9);}return _0x4021fb[_0x3d6c('0x20')]('Contact')[_0x3d6c('0x22')](_0x21e345,_0x46c98e)[_0x3d6c('0x29')](function(_0x337364){if(_0x337364&&_0x337364[_0x3d6c('0x24')]){return _0x337364;}else{var _0x15b565=_[_0x3d6c('0x34')](_0x404d56);if(_0x58e59c['additionalSearchLead']){var _0x212594={};_0x212594[_0x58e59c['additionalSearchLead']]=_0x44b464;_[_0x3d6c('0x36')](_0x15b565[_0x3d6c('0x2f')],_0x212594);}return _0x4021fb[_0x3d6c('0x20')](_0x3d6c('0x32'))[_0x3d6c('0x22')](_0x15b565,_0x46c98e);}});}});case _0x3d6c('0x17'):var _0x3a469d=_['cloneDeep'](_0x404d56);if(_0x58e59c[_0x3d6c('0x2e')]){var _0x344d20={};_0x344d20[_0x58e59c['additionalSearchContact']]=_0x44b464;_['merge'](_0x3a469d[_0x3d6c('0x2f')],_0x344d20);}return _0x4021fb[_0x3d6c('0x20')](_0x3d6c('0x30'))[_0x3d6c('0x22')](_0x3a469d,_0x46c98e)['execute']();case'lead':var _0x4f63d1=_[_0x3d6c('0x34')](_0x404d56);if(_0x58e59c[_0x3d6c('0x31')]){var _0x344d20={};_0x344d20[_0x58e59c['additionalSearchLead']]=_0x44b464;_[_0x3d6c('0x36')](_0x4f63d1['$or'],_0x344d20);}return _0x4021fb[_0x3d6c('0x20')](_0x3d6c('0x32'))[_0x3d6c('0x22')](_0x4f63d1,_0x46c98e);case _0x3d6c('0x1a'):var _0x471a86=_['cloneDeep'](_0x404d56);if(_0x58e59c[_0x3d6c('0x35')]){var _0x344d20={};_0x344d20[_0x58e59c[_0x3d6c('0x35')]]=_0x44b464;_[_0x3d6c('0x36')](_0x471a86[_0x3d6c('0x2f')],_0x344d20);}return _0x4021fb['sobject'](_0x3d6c('0x37'))[_0x3d6c('0x22')](_0x471a86,_0x46c98e);default:return null;}})[_0x3d6c('0x29')](function(_0x36713e){if(_0x36713e&&_0x36713e['length']){var _0x50a2aa=_[_0x3d6c('0x38')](_0x36713e);if(_0x50a2aa){return BPromise[_0x3d6c('0x26')]({'id':_0x50a2aa['Id'],'name':_0x50a2aa[_0x3d6c('0x27')],'phone':_0x50a2aa[_0x3d6c('0x39')],'endUserType':_0x50a2aa[_0x3d6c('0x3a')][_0x3d6c('0x3b')][_0x3d6c('0x3c')]()});}}})[_0x3d6c('0x29')](function(_0x76a430){if(_0x76a430){logger[_0x3d6c('0x1d')](_0x3d6c('0x3d'),_0x76a430[_0x3d6c('0x16')],_0x44b464);return BPromise[_0x3d6c('0x26')](_0x76a430);}else{logger[_0x3d6c('0x1d')](_0x3d6c('0x3e'),_0x44b464);var _0x1761c4={'Phone':_0x44b464};if(_0x58e59c[_0x3d6c('0x3f')]){if(_0x58e59c[_0x3d6c('0x3f')]===_0x3d6c('0x17')){logger['info'](_0x3d6c('0x40'),_0x44b464,_0x58e59c[_0x3d6c('0x3f')]);_0x1761c4[_0x3d6c('0x41')]=_0x4c4a27!==_0x3d6c('0x42')?_0x4c4a27:util[_0x3d6c('0x43')](_0x3d6c('0x44'),_0x44b464);}else if(_0x58e59c[_0x3d6c('0x3f')]===_0x3d6c('0x18')){logger[_0x3d6c('0x1d')](_0x3d6c('0x40'),_0x44b464,_0x58e59c['moduleCreate']);_0x1761c4[_0x3d6c('0x41')]=_0x4c4a27!==_0x3d6c('0x42')?_0x4c4a27:util[_0x3d6c('0x43')](_0x3d6c('0x44'),_0x44b464);_0x1761c4[_0x3d6c('0x45')]=_0x3d6c('0x46');}else if(_0x58e59c[_0x3d6c('0x3f')]===_0x3d6c('0x1a')){logger[_0x3d6c('0x1d')](_0x3d6c('0x40'),_0x44b464,_0x58e59c[_0x3d6c('0x3f')]);_0x1761c4[_0x3d6c('0x27')]=_0x4c4a27!==_0x3d6c('0x42')?_0x4c4a27:util[_0x3d6c('0x43')](_0x3d6c('0x44'),_0x44b464);}else{return null;}}return _0x4021fb[_0x3d6c('0x20')](_[_0x3d6c('0x47')](_0x58e59c['moduleCreate']))[_0x3d6c('0x1e')](_0x1761c4)[_0x3d6c('0x29')](function(_0x4ce2f8){return BPromise['resolve']({'id':_0x4ce2f8['id'],'endUserType':_0x58e59c[_0x3d6c('0x3f')]});});}});}function getCustomFields(_0x512bfe,_0xa1d168){var _0x5ac6d7={};if(_0x512bfe[_0x3d6c('0x24')]>0x0){_['forEach'](_0x512bfe,function(_0x487921){if(_[_0x3d6c('0x48')]([_0x3d6c('0x49'),_0x3d6c('0x4a')],_0x487921[_0x3d6c('0x3b')])&&_0x487921[_0x3d6c('0x4b')]){_0x5ac6d7[_0x487921[_0x3d6c('0x4b')]]=_0x487921[_0x3d6c('0x4c')][_0x3d6c('0x4d')]();}else if(_0x487921[_0x3d6c('0x3b')]===_0x3d6c('0x4e')&&_0x487921['variableName']&&_0x487921['idField']){_0xa1d168[_0x487921[_0x3d6c('0x4f')]]&&(_0x5ac6d7[_0x487921[_0x3d6c('0x4b')]]=_0xa1d168[_0x487921['variableName']][_0x3d6c('0x4d')]());}else if(_0x487921[_0x3d6c('0x3b')]==='customVariable'&&_0x487921[_0x3d6c('0x50')]&&_0x487921[_0x3d6c('0x50')][_0x3d6c('0x51')]&&_0x487921[_0x3d6c('0x4b')]){_0xa1d168[_0x487921[_0x3d6c('0x50')][_0x3d6c('0x51')][_0x3d6c('0x3c')]()]&&(_0x5ac6d7[_0x487921[_0x3d6c('0x4b')]]=_0xa1d168[_0x487921[_0x3d6c('0x50')][_0x3d6c('0x51')][_0x3d6c('0x3c')]()][_0x3d6c('0x4d')]());}});}return _0x5ac6d7;}function getConnection(_0x32a843){var _0x42c9c1=_0x32a843[_0x3d6c('0x52')]['concat'](_0x32a843['securityToken']);var _0x1142c9=new jsforce['Connection']({'oauth2':{'loginUrl':_0x32a843[_0x3d6c('0x53')]||_0x3d6c('0x54'),'clientId':_0x32a843[_0x3d6c('0x55')],'clientSecret':_0x32a843[_0x3d6c('0x56')]}});return _0x1142c9['login'](_0x32a843['username'],_0x42c9c1)[_0x3d6c('0x29')](function(){logger[_0x3d6c('0x1d')]('Connection\x20established.');return _0x1142c9;});}exports['queue']=function(_0x62c89d,_0x17f384,_0x3e98d5,_0x4221c0,_0x174581,_0x187598){var _0x37c171,_0x4c558c,_0x370089,_0x470f01;_0x187598['serverUrl']=intUtil['stripTrailingSlash'](_0x187598[_0x3d6c('0x57')]);_0x187598[_0x3d6c('0x53')]=intUtil[_0x3d6c('0x58')](_0x187598[_0x3d6c('0x53')]);if(_0x174581&&_0x174581[_0x3d6c('0x59')]){logger[_0x3d6c('0x1d')]('[QUEUE]','Recording\x20is\x20enabled!');_0x17f384[_0x3d6c('0x5a')]=util['format'](_0x3d6c('0x5b'),_0x187598[_0x3d6c('0x57')],_0x17f384[_0x3d6c('0x5c')],md5(_0x17f384['uniqueid']));}else{_0x17f384[_0x3d6c('0x5a')]='';}return getConnection(_0x187598)[_0x3d6c('0x29')](function(_0x58234d){_0x470f01=_0x58234d;return getUser(_0x187598,_0x4221c0[_0x3d6c('0x5d')],_0x470f01);})[_0x3d6c('0x29')](function(_0x4555f1){_0x37c171=_0x4555f1;return getEndUser(_0x187598,_0x3e98d5,_0x17f384[_0x3d6c('0x5e')],_0x17f384['calleridnum'],_0x470f01);})[_0x3d6c('0x29')](function(_0x129c59){_0x4c558c=_0x129c59;return getTicket(_0x187598,_0x37c171,_0x4c558c,_0x3e98d5,_0x17f384,_0x3e98d5['Fields'],_0x470f01,'queue');})['then'](function(_0x5d0bfc){_0x370089=_0x5d0bfc;logger[_0x3d6c('0x1d')](_0x3d6c('0x5f'),_0x370089['id']);logger[_0x3d6c('0x1d')](_0x3d6c('0x60'),_0x370089['id'],_0x4221c0[_0x3d6c('0x51')],_0x187598[_0x3d6c('0x3b')]);switch(_0x187598['type']){case'integrationTab':emit(util[_0x3d6c('0x43')](_0x3d6c('0x61'),_0x4221c0['name']),'trigger:salesforce:display',{'recordId':_0x370089['id']});break;case _0x3d6c('0x62'):emit(util[_0x3d6c('0x43')](_0x3d6c('0x61'),_0x4221c0[_0x3d6c('0x51')]),_0x3d6c('0x63'),{'uri':util[_0x3d6c('0x43')]('%s/%s/e',_0x470f01[_0x3d6c('0x64')],_0x370089['id'])});break;default:logger['error'](_0x3d6c('0x65'));}})['catch'](function(_0x1c2bc9){logger['error'](_0x3d6c('0x66'),_0x1c2bc9);});};exports[_0x3d6c('0x67')]=function(_0x3d7cd5,_0x367565,_0x22c35b,_0x5ebbb5,_0x18465e,_0x534e57,_0x35bcc0){var _0x42a4ab,_0x2360d6,_0x1df75c,_0x4d6191;_0x534e57[_0x3d6c('0x57')]=intUtil['stripTrailingSlash'](_0x534e57[_0x3d6c('0x57')]);_0x534e57[_0x3d6c('0x53')]=intUtil[_0x3d6c('0x58')](_0x534e57[_0x3d6c('0x53')]);if(_0x35bcc0&&_0x35bcc0[_0x3d6c('0x68')]&&_0x35bcc0[_0x3d6c('0x68')]!==_0x3d6c('0x69')){logger[_0x3d6c('0x1d')](_0x3d6c('0x6a'),_0x3d6c('0x6b'));_0x367565[_0x3d6c('0x5a')]=util[_0x3d6c('0x43')](_0x3d6c('0x5b'),_0x534e57[_0x3d6c('0x57')],_0x367565['uniqueid'],md5(_0x367565[_0x3d6c('0x5c')]));}return getConnection(_0x534e57)[_0x3d6c('0x29')](function(_0x591794){_0x4d6191=_0x591794;return getUser(_0x534e57,_0x5ebbb5[_0x3d6c('0x5d')],_0x4d6191);})[_0x3d6c('0x29')](function(_0x4df9d0){_0x42a4ab=_0x4df9d0;return getEndUser(_0x534e57,_0x22c35b,_0x367565[_0x3d6c('0x6c')],_0x367565[_0x3d6c('0x6d')],_0x4d6191);})['then'](function(_0x17788b){_0x2360d6=_0x17788b;return getTicket(_0x534e57,_0x42a4ab,_0x2360d6,_0x22c35b,_0x367565,_0x22c35b['Fields'],_0x4d6191,_0x3d6c('0x67'));})[_0x3d6c('0x29')](function(_0x31d7b3){_0x1df75c=_0x31d7b3;logger[_0x3d6c('0x1d')](_0x3d6c('0x6e'),_0x1df75c['id']);logger[_0x3d6c('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1df75c['id'],_0x5ebbb5[_0x3d6c('0x51')],_0x534e57[_0x3d6c('0x3b')]);switch(_0x534e57[_0x3d6c('0x3b')]){case'integrationTab':emit(util[_0x3d6c('0x43')](_0x3d6c('0x61'),_0x5ebbb5[_0x3d6c('0x51')]),_0x3d6c('0x6f'),{'recordId':_0x1df75c['id']});break;case'newTab':emit(util['format'](_0x3d6c('0x61'),_0x5ebbb5[_0x3d6c('0x51')]),_0x3d6c('0x63'),{'uri':util[_0x3d6c('0x43')](_0x3d6c('0x70'),_0x4d6191[_0x3d6c('0x64')],_0x1df75c['id'])});break;default:logger['error'](_0x3d6c('0x6a'),_0x3d6c('0x71'));}})[_0x3d6c('0x72')](function(_0x43e487){logger['error'](_0x3d6c('0x6a'),_0x43e487);});};exports['unmanaged']=function(_0x3b5aa3,_0x7f635,_0x4fb177,_0x30d0b3,_0x3832b4,_0x39c36f){var _0x4e5f07,_0x49f893,_0x161b99,_0x4ea800;_0x39c36f[_0x3d6c('0x57')]=intUtil[_0x3d6c('0x58')](_0x39c36f[_0x3d6c('0x57')]);_0x39c36f[_0x3d6c('0x53')]=intUtil[_0x3d6c('0x58')](_0x39c36f[_0x3d6c('0x53')]);if(_0x3832b4&&_0x3832b4[_0x3d6c('0x59')]){logger['info']('['+_0x7f635[_0x3d6c('0x73')][_0x3d6c('0x74')]()+']','Recording\x20is\x20enabled!');_0x7f635['recordingURL']=util['format'](_0x3d6c('0x5b'),_0x39c36f['serverUrl'],_0x7f635[_0x3d6c('0x5c')],md5(_0x7f635['uniqueid']));}else{_0x7f635[_0x3d6c('0x5a')]='';}return getConnection(_0x39c36f)[_0x3d6c('0x29')](function(_0x46bf7d){_0x4ea800=_0x46bf7d;if(!_[_0x3d6c('0x1f')](_0x30d0b3)){return getUser(_0x39c36f,_0x30d0b3[_0x3d6c('0x51')],_0x4ea800);}else{return getUser(_0x39c36f,null,_0x4ea800);}})[_0x3d6c('0x29')](function(_0x1e6385){_0x4e5f07=_0x1e6385;return getEndUser(_0x39c36f,_0x4fb177,_0x7f635[_0x3d6c('0x5e')],_0x7f635[_0x3d6c('0x75')],_0x4ea800);})['then'](function(_0x1b926d){_0x49f893=_0x1b926d;return getTicket(_0x39c36f,_0x4e5f07,_0x49f893,_0x4fb177,_0x7f635,_0x4fb177[_0x3d6c('0x76')],_0x4ea800);})['then'](function(_0x2588c0){_0x161b99=_0x2588c0;logger[_0x3d6c('0x1d')]('['+_0x7f635['lastevent'][_0x3d6c('0x74')]()+']\x20Ticket\x20%s\x20created.',_0x161b99['id']);logger[_0x3d6c('0x1d')]('['+_0x7f635[_0x3d6c('0x73')]['toUpperCase']()+_0x3d6c('0x77'),_0x39c36f['type']);})[_0x3d6c('0x72')](function(_0x3d96cb){logger[_0x3d6c('0x78')]('['+_0x7f635[_0x3d6c('0x73')][_0x3d6c('0x74')]()+']',_0x3d96cb);});}; \ No newline at end of file +var _0x5497=['resolve','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchLead','first','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','No\x20Company','upperFirst','includes','string','idField','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','trigger:salesforce:display','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','user:%s','newTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','moment','util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','Task','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','ticketType','Case','ContactId','account','AccountId','leadId','info','sobject','create','isNil','User','execute','then','length','find','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.'];(function(_0x53ce5b,_0x177d83){var _0x19595e=function(_0x355e5b){while(--_0x355e5b){_0x53ce5b['push'](_0x53ce5b['shift']());}};_0x19595e(++_0x177d83);}(_0x5497,0xca));var _0x7549=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0x5497[_0x35b18a];return _0x4db1bd;};'use strict';var _=require(_0x7549('0x0'));var rp=require('request-promise');var moment=require(_0x7549('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x7549('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x7549('0x3'))('salesforce');config['redis']=_[_0x7549('0x4')](config[_0x7549('0x5')],{'host':_0x7549('0x6'),'port':0x18eb});var io=require(_0x7549('0x7'))(new Redis(config[_0x7549('0x5')]));function emit(_0x22a031,_0x161494,_0x48aca1){io['to'](_0x22a031)[_0x7549('0x8')](_0x161494,_0x48aca1);}function getTicket(_0x5f32f7,_0x2556a8,_0x2932ed,_0x4143ea,_0x1eb2da,_0x32056c,_0x519f70,_0x2d9650){var _0x54e250=Object[_0x7549('0x9')]({},{'OwnerId':_0x2556a8['id'],'Subject':intUtil[_0x7549('0xa')](_0x4143ea[_0x7549('0xb')],_0x1eb2da,'\x20'),'Description':intUtil[_0x7549('0xa')](_0x4143ea[_0x7549('0xc')],_0x1eb2da,'\x0a')},getCustomFields(_0x32056c,_0x1eb2da));if(_0x2932ed){if(_0x4143ea['ticketType']===_0x7549('0xd')){_0x54e250['ActivityDate']=moment[_0x7549('0xe')]();_0x54e250[_0x7549('0xf')]=![];_0x54e250[_0x7549('0x10')]=![];if(_0x2932ed['endUserType']===_0x7549('0x11')||_0x2932ed[_0x7549('0x12')]===_0x7549('0x13')){_0x54e250[_0x7549('0x14')]=_0x2932ed['id'];}else if(_0x2932ed[_0x7549('0x12')]==='account'){_0x54e250['WhatId']=_0x2932ed['id'];}}else if(_0x4143ea[_0x7549('0x15')]===_0x7549('0x16')){if(_0x2932ed[_0x7549('0x12')]===_0x7549('0x11')){_0x54e250[_0x7549('0x17')]=_0x2932ed['id'];}else if(_0x2932ed['endUserType']===_0x7549('0x18')){_0x54e250[_0x7549('0x19')]=_0x2932ed['id'];}else if(_0x2932ed['endUserType']==='lead'&&_0x4143ea[_0x7549('0x1a')]){_0x54e250[_0x4143ea['leadId']]=_0x2932ed['id'];}else{logger[_0x7549('0x1b')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x519f70[_0x7549('0x1c')](_0x4143ea['ticketType'])[_0x7549('0x1d')](_0x54e250);}function getUser(_0x3b1747,_0x1b47c6,_0x292792){if(!_[_0x7549('0x1e')](_0x1b47c6)&&intUtil['validateEmail'](_0x1b47c6)){var _0x2f36ad={'Email':_0x1b47c6};var _0x1428ad={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x292792[_0x7549('0x1c')](_0x7549('0x1f'))['find'](_0x2f36ad,_0x1428ad)[_0x7549('0x20')]()[_0x7549('0x21')](function(_0x245de4){if(_0x245de4[_0x7549('0x22')]){var _0x142e5c=_[_0x7549('0x23')](_0x245de4,function(_0x21305f){return _0x21305f[_0x7549('0x24')]===_0x1b47c6;});if(_0x142e5c){logger[_0x7549('0x1b')](_0x7549('0x25'),_0x1b47c6);return BPromise['resolve']({'id':_0x142e5c['Id'],'name':_0x142e5c[_0x7549('0x26')]});}}else{logger[_0x7549('0x1b')](_0x7549('0x27'),_0x1b47c6);return _0x292792['identity']()[_0x7549('0x21')](function(_0x2e8978){return BPromise[_0x7549('0x28')]({'id':_0x2e8978[_0x7549('0x29')],'name':_0x2e8978[_0x7549('0x2a')]});});}});}else{logger[_0x7549('0x1b')](_0x7549('0x27'),_0x1b47c6);return _0x292792['identity']()[_0x7549('0x21')](function(_0x476f36){return BPromise[_0x7549('0x28')]({'id':_0x476f36[_0x7549('0x29')],'name':_0x476f36[_0x7549('0x2a')]});});}}function getEndUser(_0x3d6a90,_0x5a9a34,_0x4696cc,_0x48cdea,_0x548dd2){var _0x4e8a61={'$or':{'Phone':_0x48cdea}};var _0x4b6ccb={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7549('0x28')]()['then'](function(){logger[_0x7549('0x1b')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x48cdea,_0x5a9a34[_0x7549('0x2b')]);switch(_0x5a9a34[_0x7549('0x2b')]){case _0x7549('0x2c'):var _0x30f6a3=_[_0x7549('0x2d')](_0x4e8a61);if(_0x5a9a34[_0x7549('0x2e')]){var _0x575705={};_0x575705[_0x5a9a34['additionalSearchContact']]=_0x48cdea;_[_0x7549('0x2f')](_0x30f6a3[_0x7549('0x30')],_0x575705);}return _0x548dd2[_0x7549('0x1c')](_0x7549('0x31'))[_0x7549('0x23')](_0x30f6a3,_0x4b6ccb)[_0x7549('0x20')]()[_0x7549('0x21')](function(_0x11288a){if(_0x11288a&&_0x11288a[_0x7549('0x22')]){return _0x11288a;}else{var _0x34f460=_[_0x7549('0x2d')](_0x4e8a61);if(_0x5a9a34['additionalSearchLead']){var _0x27f04a={};_0x27f04a[_0x5a9a34['additionalSearchLead']]=_0x48cdea;_['merge'](_0x34f460[_0x7549('0x30')],_0x27f04a);}return _0x548dd2[_0x7549('0x1c')](_0x7549('0x32'))[_0x7549('0x23')](_0x34f460,_0x4b6ccb);}});case _0x7549('0x33'):var _0x3b4b8d=_[_0x7549('0x2d')](_0x4e8a61);if(_0x5a9a34[_0x7549('0x34')]){var _0x575705={};_0x575705[_0x5a9a34[_0x7549('0x34')]]=_0x48cdea;_[_0x7549('0x2f')](_0x3b4b8d['$or'],_0x575705);}return _0x548dd2[_0x7549('0x1c')](_0x7549('0x35'))[_0x7549('0x23')](_0x3b4b8d,_0x4b6ccb)[_0x7549('0x20')]()['then'](function(_0x32be16){if(_0x32be16&&_0x32be16[_0x7549('0x22')]){return _0x32be16;}else{var _0x577de5=_[_0x7549('0x2d')](_0x4e8a61);if(_0x5a9a34['additionalSearchContact']){var _0x9df0b6={};_0x9df0b6[_0x5a9a34[_0x7549('0x2e')]]=_0x48cdea;_[_0x7549('0x2f')](_0x577de5['$or'],_0x9df0b6);}return _0x548dd2['sobject'](_0x7549('0x31'))[_0x7549('0x23')](_0x577de5,_0x4b6ccb)[_0x7549('0x21')](function(_0x72fffc){if(_0x72fffc&&_0x72fffc[_0x7549('0x22')]){return _0x72fffc;}else{var _0x58e119=_['cloneDeep'](_0x4e8a61);if(_0x5a9a34[_0x7549('0x36')]){var _0x16cee9={};_0x16cee9[_0x5a9a34[_0x7549('0x36')]]=_0x48cdea;_['merge'](_0x58e119['$or'],_0x16cee9);}return _0x548dd2[_0x7549('0x1c')](_0x7549('0x32'))[_0x7549('0x23')](_0x58e119,_0x4b6ccb);}});}});case _0x7549('0x11'):var _0x30f6a3=_[_0x7549('0x2d')](_0x4e8a61);if(_0x5a9a34[_0x7549('0x2e')]){var _0x575705={};_0x575705[_0x5a9a34['additionalSearchContact']]=_0x48cdea;_[_0x7549('0x2f')](_0x30f6a3[_0x7549('0x30')],_0x575705);}return _0x548dd2[_0x7549('0x1c')](_0x7549('0x31'))[_0x7549('0x23')](_0x30f6a3,_0x4b6ccb)['execute']();case'lead':var _0x41ee4f=_[_0x7549('0x2d')](_0x4e8a61);if(_0x5a9a34[_0x7549('0x36')]){var _0x575705={};_0x575705[_0x5a9a34[_0x7549('0x36')]]=_0x48cdea;_['merge'](_0x41ee4f[_0x7549('0x30')],_0x575705);}return _0x548dd2[_0x7549('0x1c')]('Lead')[_0x7549('0x23')](_0x41ee4f,_0x4b6ccb);case'account':var _0x3b4b8d=_[_0x7549('0x2d')](_0x4e8a61);if(_0x5a9a34['additionalSearchAccount']){var _0x575705={};_0x575705[_0x5a9a34[_0x7549('0x34')]]=_0x48cdea;_['merge'](_0x3b4b8d[_0x7549('0x30')],_0x575705);}return _0x548dd2[_0x7549('0x1c')]('Account')[_0x7549('0x23')](_0x3b4b8d,_0x4b6ccb);default:return null;}})['then'](function(_0x2b2d70){if(_0x2b2d70&&_0x2b2d70[_0x7549('0x22')]){var _0x2794fc=_[_0x7549('0x37')](_0x2b2d70);if(_0x2794fc){return BPromise[_0x7549('0x28')]({'id':_0x2794fc['Id'],'name':_0x2794fc['Name'],'phone':_0x2794fc['Phone'],'endUserType':_0x2794fc[_0x7549('0x38')][_0x7549('0x39')][_0x7549('0x3a')]()});}}})['then'](function(_0x2d1aba){if(_0x2d1aba){logger[_0x7549('0x1b')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x2d1aba[_0x7549('0x12')],_0x48cdea);return BPromise[_0x7549('0x28')](_0x2d1aba);}else{logger[_0x7549('0x1b')](_0x7549('0x3b'),_0x48cdea);var _0x186c60={'Phone':_0x48cdea};if(_0x5a9a34[_0x7549('0x3c')]){if(_0x5a9a34['moduleCreate']==='contact'){logger[_0x7549('0x1b')](_0x7549('0x3d'),_0x48cdea,_0x5a9a34[_0x7549('0x3c')]);_0x186c60[_0x7549('0x3e')]=_0x4696cc!==_0x7549('0x3f')?_0x4696cc:util['format'](_0x7549('0x40'),_0x48cdea);}else if(_0x5a9a34[_0x7549('0x3c')]===_0x7549('0x13')){logger[_0x7549('0x1b')](_0x7549('0x3d'),_0x48cdea,_0x5a9a34[_0x7549('0x3c')]);_0x186c60['LastName']=_0x4696cc!==''?_0x4696cc:util[_0x7549('0x41')](_0x7549('0x40'),_0x48cdea);_0x186c60[_0x7549('0x42')]=_0x7549('0x43');}else if(_0x5a9a34[_0x7549('0x3c')]===_0x7549('0x18')){logger[_0x7549('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x48cdea,_0x5a9a34[_0x7549('0x3c')]);_0x186c60[_0x7549('0x26')]=_0x4696cc!==_0x7549('0x3f')?_0x4696cc:util[_0x7549('0x41')](_0x7549('0x40'),_0x48cdea);}else{return null;}}return _0x548dd2[_0x7549('0x1c')](_[_0x7549('0x44')](_0x5a9a34[_0x7549('0x3c')]))[_0x7549('0x1d')](_0x186c60)[_0x7549('0x21')](function(_0x1cfc96){return BPromise[_0x7549('0x28')]({'id':_0x1cfc96['id'],'endUserType':_0x5a9a34[_0x7549('0x3c')]});});}});}function getCustomFields(_0x1bd5c7,_0x5788b7){var _0x27b450={};if(_0x1bd5c7[_0x7549('0x22')]>0x0){_['forEach'](_0x1bd5c7,function(_0x2bf193){if(_[_0x7549('0x45')]([_0x7549('0x46'),'picklist'],_0x2bf193['type'])&&_0x2bf193[_0x7549('0x47')]){_0x27b450[_0x2bf193['idField']]=_0x2bf193['content'][_0x7549('0x48')]();}else if(_0x2bf193[_0x7549('0x39')]===_0x7549('0x49')&&_0x2bf193[_0x7549('0x4a')]&&_0x2bf193[_0x7549('0x47')]){_0x5788b7[_0x2bf193['variableName']]&&(_0x27b450[_0x2bf193[_0x7549('0x47')]]=_0x5788b7[_0x2bf193['variableName']][_0x7549('0x48')]());}else if(_0x2bf193[_0x7549('0x39')]===_0x7549('0x4b')&&_0x2bf193[_0x7549('0x4c')]&&_0x2bf193[_0x7549('0x4c')][_0x7549('0x4d')]&&_0x2bf193[_0x7549('0x47')]){_0x5788b7[_0x2bf193[_0x7549('0x4c')][_0x7549('0x4d')]['toLowerCase']()]&&(_0x27b450[_0x2bf193[_0x7549('0x47')]]=_0x5788b7[_0x2bf193['Variable'][_0x7549('0x4d')][_0x7549('0x3a')]()]['toString']());}});}return _0x27b450;}function getConnection(_0x5476b2){var _0x3fcfba=_0x5476b2['password'][_0x7549('0x4e')](_0x5476b2[_0x7549('0x4f')]);var _0x49274b=new jsforce[(_0x7549('0x50'))]({'oauth2':{'loginUrl':_0x5476b2[_0x7549('0x51')]||_0x7549('0x52'),'clientId':_0x5476b2[_0x7549('0x53')],'clientSecret':_0x5476b2[_0x7549('0x54')]}});return _0x49274b[_0x7549('0x55')](_0x5476b2[_0x7549('0x56')],_0x3fcfba)[_0x7549('0x21')](function(){logger[_0x7549('0x1b')](_0x7549('0x57'));return _0x49274b;});}exports[_0x7549('0x58')]=function(_0x38e8bf,_0x350125,_0x569a0f,_0x3df59d,_0x373555,_0x5bc2dd){var _0x3161f7,_0x1fdef5,_0x4a763e,_0x18cd50;_0x5bc2dd[_0x7549('0x59')]=intUtil[_0x7549('0x5a')](_0x5bc2dd[_0x7549('0x59')]);_0x5bc2dd[_0x7549('0x51')]=intUtil[_0x7549('0x5a')](_0x5bc2dd[_0x7549('0x51')]);if(_0x373555&&_0x373555[_0x7549('0x5b')]){logger[_0x7549('0x1b')]('[QUEUE]',_0x7549('0x5c'));_0x350125[_0x7549('0x5d')]=util[_0x7549('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5bc2dd[_0x7549('0x59')],_0x350125[_0x7549('0x5e')],md5(_0x350125[_0x7549('0x5e')]));}else{_0x350125[_0x7549('0x5d')]='';}return getConnection(_0x5bc2dd)[_0x7549('0x21')](function(_0x13f31a){_0x18cd50=_0x13f31a;return getUser(_0x5bc2dd,_0x3df59d['email'],_0x18cd50);})[_0x7549('0x21')](function(_0x21a578){_0x3161f7=_0x21a578;return getEndUser(_0x5bc2dd,_0x569a0f,_0x350125[_0x7549('0x5f')],_0x350125[_0x7549('0x60')],_0x18cd50);})[_0x7549('0x21')](function(_0x4f637d){_0x1fdef5=_0x4f637d;return getTicket(_0x5bc2dd,_0x3161f7,_0x1fdef5,_0x569a0f,_0x350125,_0x569a0f[_0x7549('0x61')],_0x18cd50,_0x7549('0x58'));})[_0x7549('0x21')](function(_0x2817e6){_0x4a763e=_0x2817e6;logger[_0x7549('0x1b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x4a763e['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4a763e['id'],_0x3df59d[_0x7549('0x4d')],_0x5bc2dd[_0x7549('0x39')]);switch(_0x5bc2dd[_0x7549('0x39')]){case'integrationTab':emit(util[_0x7549('0x41')]('user:%s',_0x3df59d[_0x7549('0x4d')]),_0x7549('0x62'),{'recordId':_0x4a763e['id']});break;case'newTab':emit(util[_0x7549('0x41')]('user:%s',_0x3df59d[_0x7549('0x4d')]),_0x7549('0x63'),{'uri':util['format']('%s/%s/e',_0x18cd50['instanceUrl'],_0x4a763e['id'])});break;default:logger[_0x7549('0x64')](_0x7549('0x65'));}})[_0x7549('0x66')](function(_0x70facf){logger[_0x7549('0x64')](_0x7549('0x67'),_0x70facf);});};exports[_0x7549('0x68')]=function(_0xd9ef6d,_0x1eec29,_0x144318,_0x4184fb,_0x50989c,_0x17849a,_0x5df5f6){var _0x2db7f4,_0x494922,_0x209829,_0x5046f7;_0x17849a[_0x7549('0x59')]=intUtil[_0x7549('0x5a')](_0x17849a['serverUrl']);_0x17849a[_0x7549('0x51')]=intUtil[_0x7549('0x5a')](_0x17849a[_0x7549('0x51')]);if(_0x5df5f6&&_0x5df5f6['recordingFormat']&&_0x5df5f6[_0x7549('0x69')]!==_0x7549('0x6a')){logger[_0x7549('0x1b')](_0x7549('0x6b'),_0x7549('0x5c'));_0x1eec29[_0x7549('0x5d')]=util[_0x7549('0x41')](_0x7549('0x6c'),_0x17849a[_0x7549('0x59')],_0x1eec29[_0x7549('0x5e')],md5(_0x1eec29[_0x7549('0x5e')]));}return getConnection(_0x17849a)['then'](function(_0x4eb750){_0x5046f7=_0x4eb750;return getUser(_0x17849a,_0x4184fb[_0x7549('0x6d')],_0x5046f7);})['then'](function(_0x4dbce9){_0x2db7f4=_0x4dbce9;return getEndUser(_0x17849a,_0x144318,_0x1eec29[_0x7549('0x6e')],_0x1eec29['destcalleridnum'],_0x5046f7);})[_0x7549('0x21')](function(_0x2b2813){_0x494922=_0x2b2813;return getTicket(_0x17849a,_0x2db7f4,_0x494922,_0x144318,_0x1eec29,_0x144318[_0x7549('0x61')],_0x5046f7,_0x7549('0x68'));})[_0x7549('0x21')](function(_0x2b9b37){_0x209829=_0x2b9b37;logger['info'](_0x7549('0x6f'),_0x209829['id']);logger[_0x7549('0x1b')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x209829['id'],_0x4184fb['name'],_0x17849a[_0x7549('0x39')]);switch(_0x17849a['type']){case _0x7549('0x70'):emit(util['format'](_0x7549('0x71'),_0x4184fb[_0x7549('0x4d')]),_0x7549('0x62'),{'recordId':_0x209829['id']});break;case _0x7549('0x72'):emit(util[_0x7549('0x41')](_0x7549('0x71'),_0x4184fb[_0x7549('0x4d')]),_0x7549('0x63'),{'uri':util['format'](_0x7549('0x73'),_0x5046f7['instanceUrl'],_0x209829['id'])});break;default:logger[_0x7549('0x64')](_0x7549('0x6b'),_0x7549('0x74'));}})[_0x7549('0x66')](function(_0x28bfea){logger[_0x7549('0x64')](_0x7549('0x6b'),_0x28bfea);});};exports[_0x7549('0x75')]=function(_0x298fa4,_0x2fa704,_0x418223,_0x165359,_0x25d7db,_0x24625b){var _0x497c1b,_0xb5c6fe,_0x33592b,_0x1e4bfa;_0x24625b[_0x7549('0x59')]=intUtil[_0x7549('0x5a')](_0x24625b[_0x7549('0x59')]);_0x24625b[_0x7549('0x51')]=intUtil[_0x7549('0x5a')](_0x24625b[_0x7549('0x51')]);if(_0x25d7db&&_0x25d7db[_0x7549('0x5b')]){logger['info']('['+_0x2fa704[_0x7549('0x76')][_0x7549('0x77')]()+']','Recording\x20is\x20enabled!');_0x2fa704[_0x7549('0x5d')]=util[_0x7549('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x24625b[_0x7549('0x59')],_0x2fa704[_0x7549('0x5e')],md5(_0x2fa704['uniqueid']));}else{_0x2fa704['recordingURL']='';}return getConnection(_0x24625b)[_0x7549('0x21')](function(_0x4d6752){_0x1e4bfa=_0x4d6752;if(!_[_0x7549('0x1e')](_0x165359)){return getUser(_0x24625b,_0x165359[_0x7549('0x4d')],_0x1e4bfa);}else{return getUser(_0x24625b,null,_0x1e4bfa);}})[_0x7549('0x21')](function(_0x125a8a){_0x497c1b=_0x125a8a;return getEndUser(_0x24625b,_0x418223,_0x2fa704[_0x7549('0x5f')],_0x2fa704[_0x7549('0x60')],_0x1e4bfa);})[_0x7549('0x21')](function(_0x4b98f8){_0xb5c6fe=_0x4b98f8;return getTicket(_0x24625b,_0x497c1b,_0xb5c6fe,_0x418223,_0x2fa704,_0x418223[_0x7549('0x61')],_0x1e4bfa);})[_0x7549('0x21')](function(_0x37d2aa){_0x33592b=_0x37d2aa;logger[_0x7549('0x1b')]('['+_0x2fa704[_0x7549('0x76')]['toUpperCase']()+_0x7549('0x78'),_0x33592b['id']);logger[_0x7549('0x1b')]('['+_0x2fa704[_0x7549('0x76')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x24625b['type']);})[_0x7549('0x66')](function(_0x50e647){logger[_0x7549('0x64')]('['+_0x2fa704[_0x7549('0x76')][_0x7549('0x77')]()+']',_0x50e647);});}; \ 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 e754f4c..88757ae 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 _0x823a=['],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','catch','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','then','result','length','adminId','sys_id','info','toUpperCase','error','message','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x823a,0x1ee));var _0xa823=function(_0x276cc9,_0x17774c){_0x276cc9=_0x276cc9-0x0;var _0x31ac6b=_0x823a[_0x276cc9];return _0x31ac6b;};'use strict';var _=require(_0xa823('0x0'));var Promise=require(_0xa823('0x1'));var rp=require(_0xa823('0x2'));var util=require('util');var md5=require(_0xa823('0x3'));var Redis=require('ioredis');var intUtil=require(_0xa823('0x4'));var config=require(_0xa823('0x5'));var logger=require(_0xa823('0x6'))(_0xa823('0x7'));config['redis']=_[_0xa823('0x8')](config[_0xa823('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x52b96a,_0x5e92ec,_0x4fe744,_0x905151,_0x392ea7,_0x4f71f2){return new Promise(function(_0xda89fa,_0x549518){var _0x522dce={'method':'GET','uri':_0x905151+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x392ea7+'&'+_0x4f71f2,'auth':_0x5e92ec,'json':!![]};return rp(_0x522dce)[_0xa823('0xa')](function(_0x2555ff){if(_0x2555ff[_0xa823('0xb')][_0xa823('0xc')]>0x0){_0x4fe744[_0xa823('0xd')]=_0x2555ff['result'][0x0][_0xa823('0xe')];}logger[_0xa823('0xf')]('['+[_0x52b96a[_0xa823('0x10')]()]+'],\x20getAdminUser\x20crm',_0x4fe744);_0xda89fa(_0x4fe744);})['catch'](function(_0x9301ec){logger[_0xa823('0x11')]('['+[_0x52b96a[_0xa823('0x10')]()]+']',_0x9301ec['message']);_0x549518(_0x9301ec[_0xa823('0x12')]);});});}function getUser(_0x17f3e0,_0x117a99,_0x3efd32,_0x8b409f,_0x52e9dc){return function(_0x22b0e8){logger['info']('['+[_0x17f3e0[_0xa823('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x22b0e8);return new Promise(function(_0x4692bc,_0x4228d8){if(intUtil[_0xa823('0x13')](_0x22b0e8[_0xa823('0x14')])){var _0xaded11={'method':_0xa823('0x15'),'uri':_0x3efd32+_0xa823('0x16')+_0x22b0e8[_0xa823('0x14')]+'&'+_0x8b409f+'&'+_0x52e9dc,'auth':_0x117a99,'json':!![]};logger[_0xa823('0xf')]('['+[_0x17f3e0['toUpperCase']()]+_0xa823('0x17'),_0xaded11);return rp(_0xaded11)[_0xa823('0xa')](function(_0x541d40){logger['info']('['+[_0x17f3e0[_0xa823('0x10')]()]+'],\x20getUser\x20entity',_0x541d40);if(_0x541d40[_0xa823('0xb')][_0xa823('0xc')]>0x0&&String(_0x541d40[_0xa823('0xb')][0x0][_0xa823('0x18')])===_0xa823('0x19')){_0x22b0e8[_0xa823('0x1a')]=_0x541d40['result'][0x0][_0xa823('0xe')];}else{_0x22b0e8[_0xa823('0x1a')]=_0x22b0e8[_0xa823('0xd')];_0x22b0e8[_0xa823('0x14')]=_0x22b0e8[_0xa823('0x1b')];}logger['info']('['+[_0x17f3e0[_0xa823('0x10')]()]+'],\x20getUser\x20crm',_0x22b0e8);_0x4692bc(_0x22b0e8);})['catch'](function(_0x370930){logger['error']('['+[_0x17f3e0['toUpperCase']()]+']',_0x370930['message']);_0x4228d8(_0x370930['message']);});}else{logger[_0xa823('0xf')]('['+[_0x17f3e0[_0xa823('0x10')]()]+_0xa823('0x1c'));_0x22b0e8[_0xa823('0x1a')]=_0x22b0e8['adminId'];_0x22b0e8[_0xa823('0x14')]=_0x22b0e8[_0xa823('0x1b')];_0x4692bc(_0x22b0e8);}});};}function createEndUser(_0x102e50,_0x1a3a9d,_0xa41a5b,_0x267b39,_0x99609c){logger[_0xa823('0xf')]('['+[_0x102e50[_0xa823('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0xa41a5b);return new Promise(function(_0x37ec44,_0xd78402){var _0x33a244={'method':_0xa823('0x1d'),'uri':_0x267b39+_0xa823('0x1e')+_0x99609c,'body':{'user_name':_0xa41a5b[_0xa823('0x1f')],'roles':_0xa823('0x20'),'first_name':_0xa41a5b[_0xa823('0x1f')],'active':_0xa823('0x19'),'date_format':_0xa823('0x21'),'phone':_0xa41a5b[_0xa823('0x1f')]},'auth':_0x1a3a9d,'json':!![]};return rp(_0x33a244)['then'](function(_0x55625a){logger['info']('['+[_0x102e50[_0xa823('0x10')]()]+_0xa823('0x22'),_0x55625a[_0xa823('0xb')]);_0xa41a5b[_0xa823('0x23')]=_0x55625a[_0xa823('0xb')]['sys_id'];_0x37ec44(_0xa41a5b);})['catch'](function(_0xb182cf){logger[_0xa823('0x11')]('['+[_0x102e50[_0xa823('0x10')]()]+']',_0xb182cf[_0xa823('0x12')]);_0xd78402(_0xb182cf[_0xa823('0x12')]);});});}function getEndUser(_0x1bd86a,_0x3fcc3d,_0xa735ff,_0x4379f5,_0xbc86ff){return function(_0x4f9b71){logger['info']('['+[_0x1bd86a[_0xa823('0x10')]()]+_0xa823('0x24'),_0x4f9b71);return new Promise(function(_0x2a15d6,_0x510999){var _0x37fbb2={'method':'GET','uri':_0xa735ff+_0xa823('0x25')+_0x4f9b71[_0xa823('0x1f')]+'&'+_0x4379f5+'&'+_0xbc86ff,'auth':_0x3fcc3d,'json':!![]};return rp(_0x37fbb2)[_0xa823('0xa')](function(_0x379671){if(_0x379671['result'][_0xa823('0xc')]>0x0){_0x4f9b71[_0xa823('0x23')]=_0x379671[_0xa823('0xb')][0x0]['sys_id'];logger['info']('['+[_0x1bd86a[_0xa823('0x10')]()]+_0xa823('0x26'),_0x4f9b71);_0x2a15d6(_0x4f9b71);}else{return createEndUser(_0x1bd86a,_0x3fcc3d,_0x4f9b71,_0xa735ff,_0x4379f5)[_0xa823('0xa')](function(_0x1113f2){logger[_0xa823('0xf')]('['+[_0x1bd86a[_0xa823('0x10')]()]+'],\x20createEndUser\x20crm',_0x1113f2);_0x2a15d6(_0x1113f2);});}})[_0xa823('0x27')](function(_0x131de6){logger[_0xa823('0x11')]('['+[_0x1bd86a[_0xa823('0x10')]()]+']',_0x131de6[_0xa823('0x12')]);_0x510999(_0x131de6[_0xa823('0x12')]);});});};}function getCustomFields(_0x5599ad,_0x1c4288){var _0xc3f255={};if(_0x5599ad[_0xa823('0xc')]>0x0){_[_0xa823('0x28')](_0x5599ad,function(_0x5bb982){if(_[_0xa823('0x29')](['string',_0xa823('0x2a')],_0x5bb982[_0xa823('0x2b')])&&_0x5bb982[_0xa823('0x2c')]&&!_0x5bb982[_0xa823('0x2d')]){_0xc3f255[_0x5bb982['nameField'][_0xa823('0x2e')]()]=_0x5bb982[_0xa823('0x2f')][_0xa823('0x30')]();}else if(_[_0xa823('0x29')]([_0xa823('0x31'),_0xa823('0x2a')],_0x5bb982[_0xa823('0x2b')])&&_0x5bb982[_0xa823('0x32')]&&_0x5bb982[_0xa823('0x2d')]){_0xc3f255[_0x5bb982[_0xa823('0x32')]['toLowerCase']()]=_0x5bb982[_0xa823('0x2f')]['toString']();}else if(_0x5bb982['type']==='variable'&&_0x5bb982[_0xa823('0x33')]&&_0x5bb982[_0xa823('0x32')]&&_0x5bb982[_0xa823('0x2d')]){_0xc3f255[_0x5bb982[_0xa823('0x32')]['toLowerCase']()]=_0x1c4288[_0x5bb982[_0xa823('0x33')]][_0xa823('0x30')]();}else if(_0x5bb982[_0xa823('0x2b')]===_0xa823('0x34')&&_0x5bb982[_0xa823('0x35')]&&_0x5bb982[_0xa823('0x35')][_0xa823('0x36')]&&_0x5bb982[_0xa823('0x32')]&&_0x5bb982[_0xa823('0x2d')]){_0xc3f255[_0x5bb982[_0xa823('0x32')][_0xa823('0x2e')]()]=_0x1c4288[_0x5bb982[_0xa823('0x35')][_0xa823('0x36')][_0xa823('0x2e')]()][_0xa823('0x30')]();}});}return _0xc3f255;}function getTicket(_0xf56ce1,_0x56eb4c,_0x4b087b,_0x541989,_0x2fe3b0,_0x2ed018){return function(_0xeded92){logger[_0xa823('0xf')]('['+[_0xf56ce1[_0xa823('0x10')]()]+_0xa823('0x37'),_0xeded92);return new Promise(function(_0x56c6fe,_0x100e46){var _0xfcf0fc=_0xf56ce1['toLowerCase']()===_0xa823('0x38')?_0xeded92[_0xa823('0x1a')]:_0xeded92[_0xa823('0x23')];var _0x3d25d9={'method':_0xa823('0x1d'),'uri':_0x4b087b+_0xa823('0x39')+'?'+_0x2ed018,'body':Object[_0xa823('0x3a')]({},{'active':_0xa823('0x19'),'caller_id':_0xfcf0fc,'assigned_to':_0xeded92[_0xa823('0x1a')],'short_description':intUtil[_0xa823('0x3b')](_0x541989[_0xa823('0x3c')],_0x2fe3b0,'\x20'),'description':intUtil['getString'](_0x541989['Descriptions'],_0x2fe3b0,'\x0a')},getCustomFields(_0x541989[_0xa823('0x3d')],_0x2fe3b0)),'auth':_0x56eb4c,'json':!![]};return rp(_0x3d25d9)['then'](function(_0x1bdf5e){logger[_0xa823('0xf')]('['+[_0xf56ce1[_0xa823('0x10')]()]+_0xa823('0x3e'),_0x1bdf5e[_0xa823('0xb')]);_0xeded92[_0xa823('0x3f')]=_0x1bdf5e[_0xa823('0xb')][_0xa823('0xe')];_0xeded92[_0xa823('0x40')]=_0x1bdf5e[_0xa823('0xb')][_0xa823('0x41')];logger[_0xa823('0xf')]('['+[_0xf56ce1[_0xa823('0x10')]()]+_0xa823('0x42'),_0xeded92);_0x56c6fe(_0xeded92);})[_0xa823('0x27')](function(_0x83b70b){logger[_0xa823('0x11')]('['+[_0xf56ce1[_0xa823('0x10')]()]+']',_0x83b70b['message']);_0x100e46(_0x83b70b[_0xa823('0x12')]);});});};}function createRemoteTag(_0x5bbba1,_0x3e2f80,_0x5ebc28,_0x19d058){return new Promise(function(_0x245874,_0x1d78d8){var _0x1780d8={'method':_0xa823('0x1d'),'uri':_0x5ebc28+_0xa823('0x43')+'?'+_0x19d058,'body':{'short_description':_0x5bbba1,'global':!![],'active':!![],'name':_0x5bbba1},'auth':_0x3e2f80,'json':!![]};return rp(_0x1780d8)[_0xa823('0xa')](function(_0x2fb2){var _0x2b965a=_0x2fb2[_0xa823('0xb')][_0xa823('0xe')];_0x245874(_0x2b965a);});});}function getRemoteTag(_0x3f761d,_0x52ef1f,_0x4612bf,_0x20b4c2,_0x55f129){return new Promise(function(_0x36bc42,_0x144bd4){var _0x4bacf5={'method':'GET','uri':_0x4612bf+_0xa823('0x43')+_0xa823('0x44')+_0x3f761d+'&'+_0x20b4c2,'auth':_0x52ef1f,'json':!![]};return rp(_0x4bacf5)[_0xa823('0xa')](function(_0x1e90ea){if(_0x1e90ea[_0xa823('0xb')][_0xa823('0xc')]>0x0){var _0x45444a=_0x1e90ea['result'][0x0][_0xa823('0xe')];_0x36bc42(_0x45444a);}else{return createRemoteTag(_0x3f761d,_0x52ef1f,_0x4612bf,_0x20b4c2)[_0xa823('0xa')](function(_0x2f0481){_0x36bc42(_0x2f0481);});}});});}function assignTagToIncident(_0xf831b,_0x1a9458,_0x6e2623,_0x2eb962,_0x4a99f1){return new Promise(function(_0x1fe976,_0x13bb73){var _0x5bc9de={'method':_0xa823('0x1d'),'uri':_0x6e2623+'label_entry'+'?'+_0x4a99f1,'body':{'label':_0xf831b,'table':_0xa823('0x39'),'id_type':'Incident','table_key':_0x2eb962[_0xa823('0x3f')],'title':_0xa823('0x45')+_0x2eb962[_0xa823('0x40')],'id_display':_0x2eb962[_0xa823('0x40')]},'auth':_0x1a9458,'json':!![]};return rp(_0x5bc9de)[_0xa823('0xa')](function(_0x44d767){_0x1fe976();})[_0xa823('0x27')](function(){_0x1fe976();});});}function manageTags(_0x657ce7,_0x4479b1,_0x16fa15,_0x3736ac,_0x25c38d,_0x4d76a6,_0x5003f5){return new Promise(function(_0x36202d,_0x4f0a3e){var _0x184e18=[];_0x4479b1['forEach'](function(_0x2b7b07){_0x184e18['push'](getRemoteTag(_0x2b7b07,_0x16fa15,_0x3736ac,_0x4d76a6,_0x5003f5));});return Promise['all'](_0x184e18)[_0xa823('0xa')](function(_0x12950e){if(_0x12950e[_0xa823('0xc')]){logger[_0xa823('0xf')]('['+[_0x657ce7[_0xa823('0x10')]()]+_0xa823('0x46'),_0x12950e);var _0x3a01a6=[];_0x12950e[_0xa823('0x28')](function(_0x480bd9){_0x3a01a6[_0xa823('0x47')](assignTagToIncident(_0x480bd9,_0x16fa15,_0x3736ac,_0x25c38d,_0x4d76a6));});return Promise[_0xa823('0x48')](_0x3a01a6)[_0xa823('0xa')](function(){_0x36202d();})[_0xa823('0x27')](function(){_0x36202d();});}else{_0x36202d();}});});}function getTags(_0x1dc24c,_0x29a16a,_0x517899,_0x3b750c,_0xb5650c,_0x5ed96c){return function(_0x389849){return new Promise(function(_0x4b84ad,_0x378ed4){var _0x536e63=[];var _0x4de596=_0x3b750c[_0xa823('0x49')];if(_0x4de596&&_0x4de596['length']>0x0){_0x536e63=_[_0xa823('0x4a')](_0x4de596,_0xa823('0x36'));}if(_0x536e63['length']>0x0){return manageTags(_0x1dc24c,_0x536e63,_0x29a16a,_0x517899,_0x389849,_0xb5650c,_0x5ed96c)['then'](function(){_0x4b84ad(_0x389849);});}else{_0x4b84ad(_0x389849);}});};}function emit(_0x836404,_0x555725,_0x3347b7){var _0x37fe97=_0xa823('0x4b')+_0xa823('0x4c')+_0xa823('0x4d')+'%255EORDERBYDESCnumber';var _0x42199c={'uri':_0x836404+_0xa823('0x4e')+_0x3347b7+_0x37fe97};io['to'](util[_0xa823('0x4f')](_0xa823('0x50'),_0x555725))[_0xa823('0x51')](_0xa823('0x52'),_0x42199c);}exports['cs']=function(_0x6190e6,_0x5a1d2c,_0x1cc87d,_0x238ae1,_0x2759f9,_0x1cffd5,_0x247c85,_0x412041){var _0x218164={};var _0x420f86={'user':_0x1cffd5[_0xa823('0x53')],'pass':_0x1cffd5[_0xa823('0x54')]};var _0x533bab=_0xa823('0x55');var _0x14bec5=_0xa823('0x56');_0x1cffd5['remoteUri']=intUtil[_0xa823('0x57')](_0x1cffd5[_0xa823('0x58')]);_0x1cffd5['serverUrl']=intUtil['stripTrailingSlash'](_0x1cffd5[_0xa823('0x59')]);var _0x109435=util['format'](_0xa823('0x5a'),_0x1cffd5[_0xa823('0x58')]);_0x218164[_0xa823('0x14')]=!_[_0xa823('0x5b')](_0x238ae1)?_0x238ae1['email']:null;_0x218164['adminEmail']=_0x1cffd5[_0xa823('0x5c')];_0x218164[_0xa823('0x1f')]=_0x412041['toLowerCase']()===_0xa823('0x38')?_0x5a1d2c[_0xa823('0x5d')]:_0x5a1d2c[_0xa823('0x5e')];_0x218164[_0xa823('0x5f')]=_0x412041==='queue'||_0x412041===_0xa823('0x60')?'queue':_0xa823('0x38');var _0x51015f=util[_0xa823('0x4f')](_0xa823('0x61'),_0x1cffd5[_0xa823('0x59')],_0x5a1d2c['uniqueid'],md5(_0x5a1d2c['uniqueid']));if(_0x2759f9&&_0x2759f9['monitor_format']){logger[_0xa823('0xf')](_0xa823('0x62'),'Recording\x20is\x20enabled!');_0x5a1d2c[_0xa823('0x63')]=_0x51015f;}else if(_0x247c85&&_0x247c85['recordingFormat']&&_0x247c85[_0xa823('0x64')]!=='none'){logger['info'](_0xa823('0x65'),_0xa823('0x66'));_0x5a1d2c[_0xa823('0x63')]=_0x51015f;}else{_0x5a1d2c[_0xa823('0x63')]='';}return getAdminUser(_0x412041,_0x420f86,_0x218164,_0x109435,_0x14bec5,_0x533bab)[_0xa823('0xa')](getUser(_0x412041,_0x420f86,_0x109435,_0x14bec5,_0x533bab))[_0xa823('0xa')](getEndUser(_0x412041,_0x420f86,_0x109435,_0x14bec5,_0x533bab))[_0xa823('0xa')](getTicket(_0x412041,_0x420f86,_0x109435,_0x1cc87d,_0x5a1d2c,_0x14bec5))[_0xa823('0xa')](function(_0x121678){logger[_0xa823('0xf')](util[_0xa823('0x4f')](_0xa823('0x67'),_0x121678['ticketId']));logger['info'](util['format']('call\x20direction:\x20%s',_0x412041));if(_0x412041!==_0xa823('0x60')){logger[_0xa823('0xf')]('['+[_0x412041['toUpperCase']()]+']',_0xa823('0x68'));emit(_0x1cffd5['remoteUri'],_0x238ae1[_0xa823('0x36')],_0x121678[_0xa823('0x3f')]);}})[_0xa823('0x27')](function(_0xdc7c18){logger[_0xa823('0x11')]('['+[_0x412041['toUpperCase']()]+_0xa823('0x69'),util['inspect'](_0xdc7c18,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x209c=['stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','adminId','userEmail','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','push','all','Tags','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','user:%s','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x209c,0xf4));var _0xc209=function(_0x2d645d,_0x8513e9){_0x2d645d=_0x2d645d-0x0;var _0x23e71e=_0x209c[_0x2d645d];return _0x23e71e;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xc209('0x0'));var util=require(_0xc209('0x1'));var md5=require(_0xc209('0x2'));var Redis=require(_0xc209('0x3'));var intUtil=require(_0xc209('0x4'));var config=require(_0xc209('0x5'));var logger=require(_0xc209('0x6'))(_0xc209('0x7'));config[_0xc209('0x8')]=_['defaults'](config[_0xc209('0x8')],{'host':_0xc209('0x9'),'port':0x18eb});var io=require(_0xc209('0xa'))(new Redis(config['redis']));function getAdminUser(_0x27d87e,_0x3bd8df,_0x5c6253,_0x421616,_0x2963e8,_0x5a30c5){return new Promise(function(_0x51b029,_0x4ddd32){var _0x49f319={'method':_0xc209('0xb'),'uri':_0x421616+_0xc209('0xc')+'&'+_0x2963e8+'&'+_0x5a30c5,'auth':_0x3bd8df,'json':!![]};return rp(_0x49f319)['then'](function(_0x3bd2b1){if(_0x3bd2b1['result'][_0xc209('0xd')]>0x0){_0x5c6253['adminId']=_0x3bd2b1[_0xc209('0xe')][0x0][_0xc209('0xf')];}logger[_0xc209('0x10')]('['+[_0x27d87e[_0xc209('0x11')]()]+_0xc209('0x12'),_0x5c6253);_0x51b029(_0x5c6253);})[_0xc209('0x13')](function(_0x2c20b1){logger[_0xc209('0x14')]('['+[_0x27d87e['toUpperCase']()]+']',_0x2c20b1[_0xc209('0x15')]);_0x4ddd32(_0x2c20b1['message']);});});}function getUser(_0xee9b72,_0x7625f,_0x58a7c7,_0x574a76,_0x2864cc){return function(_0xec0b41){logger['info']('['+[_0xee9b72['toUpperCase']()]+_0xc209('0x16'),_0xec0b41);return new Promise(function(_0x3a8288,_0x3d0ee5){if(intUtil[_0xc209('0x17')](_0xec0b41['userEmail'])){var _0x3784f0={'method':_0xc209('0xb'),'uri':_0x58a7c7+_0xc209('0x18')+_0xec0b41['userEmail']+'&'+_0x574a76+'&'+_0x2864cc,'auth':_0x7625f,'json':!![]};logger['info']('['+[_0xee9b72[_0xc209('0x11')]()]+_0xc209('0x19'),_0x3784f0);return rp(_0x3784f0)[_0xc209('0x1a')](function(_0x45bd75){logger[_0xc209('0x10')]('['+[_0xee9b72[_0xc209('0x11')]()]+_0xc209('0x1b'),_0x45bd75);if(_0x45bd75['result']['length']>0x0&&String(_0x45bd75[_0xc209('0xe')][0x0][_0xc209('0x1c')])===_0xc209('0x1d')){_0xec0b41[_0xc209('0x1e')]=_0x45bd75[_0xc209('0xe')][0x0][_0xc209('0xf')];}else{_0xec0b41[_0xc209('0x1e')]=_0xec0b41[_0xc209('0x1f')];_0xec0b41[_0xc209('0x20')]=_0xec0b41[_0xc209('0x21')];}logger[_0xc209('0x10')]('['+[_0xee9b72['toUpperCase']()]+'],\x20getUser\x20crm',_0xec0b41);_0x3a8288(_0xec0b41);})[_0xc209('0x13')](function(_0x304e05){logger['error']('['+[_0xee9b72[_0xc209('0x11')]()]+']',_0x304e05[_0xc209('0x15')]);_0x3d0ee5(_0x304e05[_0xc209('0x15')]);});}else{logger[_0xc209('0x10')]('['+[_0xee9b72[_0xc209('0x11')]()]+']\x20using\x20admin\x20profile');_0xec0b41[_0xc209('0x1e')]=_0xec0b41[_0xc209('0x1f')];_0xec0b41[_0xc209('0x20')]=_0xec0b41[_0xc209('0x21')];_0x3a8288(_0xec0b41);}});};}function createEndUser(_0x54a98d,_0x3546d1,_0x50070c,_0xba07bb,_0x4afb0e){logger[_0xc209('0x10')]('['+[_0x54a98d[_0xc209('0x11')]()]+_0xc209('0x22'),_0x50070c);return new Promise(function(_0x11d53c,_0x1c4e13){var _0x151544={'method':_0xc209('0x23'),'uri':_0xba07bb+_0xc209('0x24')+_0x4afb0e,'body':{'user_name':_0x50070c[_0xc209('0x25')],'roles':_0xc209('0x26'),'first_name':_0x50070c[_0xc209('0x25')],'active':_0xc209('0x1d'),'date_format':_0xc209('0x27'),'phone':_0x50070c[_0xc209('0x25')]},'auth':_0x3546d1,'json':!![]};return rp(_0x151544)[_0xc209('0x1a')](function(_0x4e49ac){logger['info']('['+[_0x54a98d['toUpperCase']()]+_0xc209('0x28'),_0x4e49ac['result']);_0x50070c['endUserId']=_0x4e49ac['result'][_0xc209('0xf')];_0x11d53c(_0x50070c);})[_0xc209('0x13')](function(_0x3e14e9){logger[_0xc209('0x14')]('['+[_0x54a98d['toUpperCase']()]+']',_0x3e14e9[_0xc209('0x15')]);_0x1c4e13(_0x3e14e9[_0xc209('0x15')]);});});}function getEndUser(_0x412cc4,_0x5d0ab0,_0x35b091,_0x2f92d4,_0x76e484){return function(_0x3902dc){logger[_0xc209('0x10')]('['+[_0x412cc4['toUpperCase']()]+_0xc209('0x29'),_0x3902dc);return new Promise(function(_0x21f87e,_0x3f4163){var _0x5ca959={'method':'GET','uri':_0x35b091+'sys_user?sysparm_query=phone%3D'+_0x3902dc[_0xc209('0x25')]+'&'+_0x2f92d4+'&'+_0x76e484,'auth':_0x5d0ab0,'json':!![]};return rp(_0x5ca959)['then'](function(_0x63f47){if(_0x63f47[_0xc209('0xe')][_0xc209('0xd')]>0x0){_0x3902dc['endUserId']=_0x63f47[_0xc209('0xe')][0x0]['sys_id'];logger['info']('['+[_0x412cc4[_0xc209('0x11')]()]+'],\x20getEndUser\x20crm',_0x3902dc);_0x21f87e(_0x3902dc);}else{return createEndUser(_0x412cc4,_0x5d0ab0,_0x3902dc,_0x35b091,_0x2f92d4)[_0xc209('0x1a')](function(_0x2210fd){logger[_0xc209('0x10')]('['+[_0x412cc4[_0xc209('0x11')]()]+_0xc209('0x2a'),_0x2210fd);_0x21f87e(_0x2210fd);});}})['catch'](function(_0x5c6615){logger['error']('['+[_0x412cc4[_0xc209('0x11')]()]+']',_0x5c6615[_0xc209('0x15')]);_0x3f4163(_0x5c6615[_0xc209('0x15')]);});});};}function getCustomFields(_0x10858c,_0x5e2ff8){var _0x2893a8={};if(_0x10858c[_0xc209('0xd')]>0x0){_[_0xc209('0x2b')](_0x10858c,function(_0x29750f){if(_[_0xc209('0x2c')]([_0xc209('0x2d'),_0xc209('0x2e')],_0x29750f[_0xc209('0x2f')])&&_0x29750f[_0xc209('0x30')]&&!_0x29750f[_0xc209('0x31')]){_0x2893a8[_0x29750f['nameField'][_0xc209('0x32')]()]=_0x29750f[_0xc209('0x33')][_0xc209('0x34')]();}else if(_['includes'](['string','picklist'],_0x29750f[_0xc209('0x2f')])&&_0x29750f[_0xc209('0x35')]&&_0x29750f[_0xc209('0x31')]){_0x2893a8[_0x29750f[_0xc209('0x35')]['toLowerCase']()]=_0x29750f[_0xc209('0x33')]['toString']();}else if(_0x29750f['type']===_0xc209('0x36')&&_0x29750f[_0xc209('0x37')]&&_0x29750f[_0xc209('0x35')]&&_0x29750f['customField']){_0x2893a8[_0x29750f[_0xc209('0x35')][_0xc209('0x32')]()]=_0x5e2ff8[_0x29750f[_0xc209('0x37')]][_0xc209('0x34')]();}else if(_0x29750f[_0xc209('0x2f')]===_0xc209('0x38')&&_0x29750f[_0xc209('0x39')]&&_0x29750f[_0xc209('0x39')]['name']&&_0x29750f[_0xc209('0x35')]&&_0x29750f[_0xc209('0x31')]){_0x2893a8[_0x29750f[_0xc209('0x35')]['toLowerCase']()]=_0x5e2ff8[_0x29750f['Variable']['name'][_0xc209('0x32')]()]['toString']();}});}return _0x2893a8;}function getTicket(_0x2b6d40,_0x47541b,_0x1c35f4,_0x1c5da1,_0x5977d5,_0xbbb278){return function(_0x388982){logger['info']('['+[_0x2b6d40[_0xc209('0x11')]()]+_0xc209('0x3a'),_0x388982);return new Promise(function(_0x1838c1,_0x4a4c66){var _0x50fc85=_0x2b6d40['toLowerCase']()===_0xc209('0x3b')?_0x388982['userId']:_0x388982[_0xc209('0x3c')];var _0x46d418={'method':_0xc209('0x23'),'uri':_0x1c35f4+_0xc209('0x3d')+'?'+_0xbbb278,'body':Object[_0xc209('0x3e')]({},{'active':'true','caller_id':_0x50fc85,'assigned_to':_0x388982['userId'],'short_description':intUtil[_0xc209('0x3f')](_0x1c5da1[_0xc209('0x40')],_0x5977d5,'\x20'),'description':intUtil['getString'](_0x1c5da1[_0xc209('0x41')],_0x5977d5,'\x0a')},getCustomFields(_0x1c5da1[_0xc209('0x42')],_0x5977d5)),'auth':_0x47541b,'json':!![]};return rp(_0x46d418)['then'](function(_0x1fcbe0){logger['info']('['+[_0x2b6d40['toUpperCase']()]+_0xc209('0x43'),_0x1fcbe0[_0xc209('0xe')]);_0x388982['ticketId']=_0x1fcbe0[_0xc209('0xe')][_0xc209('0xf')];_0x388982[_0xc209('0x44')]=_0x1fcbe0[_0xc209('0xe')][_0xc209('0x45')];logger['info']('['+[_0x2b6d40[_0xc209('0x11')]()]+']\x20getTicket\x20crm',_0x388982);_0x1838c1(_0x388982);})[_0xc209('0x13')](function(_0x199129){logger[_0xc209('0x14')]('['+[_0x2b6d40[_0xc209('0x11')]()]+']',_0x199129[_0xc209('0x15')]);_0x4a4c66(_0x199129[_0xc209('0x15')]);});});};}function createRemoteTag(_0x52366a,_0x3c4e44,_0x56d3d1,_0x3455c0){return new Promise(function(_0x111cdb,_0x19effa){var _0x35ed8c={'method':_0xc209('0x23'),'uri':_0x56d3d1+'label'+'?'+_0x3455c0,'body':{'short_description':_0x52366a,'global':!![],'active':!![],'name':_0x52366a},'auth':_0x3c4e44,'json':!![]};return rp(_0x35ed8c)[_0xc209('0x1a')](function(_0x4fe855){var _0x2a6ba8=_0x4fe855['result'][_0xc209('0xf')];_0x111cdb(_0x2a6ba8);});});}function getRemoteTag(_0x1c4f52,_0x538aa5,_0x51a64c,_0x583a5e,_0xea441a){return new Promise(function(_0x25cabb,_0x137951){var _0x2c0503={'method':_0xc209('0xb'),'uri':_0x51a64c+'label'+_0xc209('0x46')+_0x1c4f52+'&'+_0x583a5e,'auth':_0x538aa5,'json':!![]};return rp(_0x2c0503)['then'](function(_0x22b4cf){if(_0x22b4cf[_0xc209('0xe')][_0xc209('0xd')]>0x0){var _0x40c97e=_0x22b4cf[_0xc209('0xe')][0x0][_0xc209('0xf')];_0x25cabb(_0x40c97e);}else{return createRemoteTag(_0x1c4f52,_0x538aa5,_0x51a64c,_0x583a5e)[_0xc209('0x1a')](function(_0xfbdd19){_0x25cabb(_0xfbdd19);});}});});}function assignTagToIncident(_0x10c2c1,_0xac2c5e,_0x16b1cb,_0x323d02,_0x246bdb){return new Promise(function(_0x2c0293,_0x9fb267){var _0x25ab99={'method':_0xc209('0x23'),'uri':_0x16b1cb+_0xc209('0x47')+'?'+_0x246bdb,'body':{'label':_0x10c2c1,'table':_0xc209('0x3d'),'id_type':_0xc209('0x48'),'table_key':_0x323d02[_0xc209('0x49')],'title':_0xc209('0x4a')+_0x323d02[_0xc209('0x44')],'id_display':_0x323d02[_0xc209('0x44')]},'auth':_0xac2c5e,'json':!![]};return rp(_0x25ab99)[_0xc209('0x1a')](function(_0x5cea14){_0x2c0293();})[_0xc209('0x13')](function(){_0x2c0293();});});}function manageTags(_0x49fb51,_0x1ba8cd,_0x2e8079,_0x1c8847,_0x253558,_0x2d8cc4,_0xa04aaf){return new Promise(function(_0x4baa96,_0x460eaf){var _0x2bbc6d=[];_0x1ba8cd[_0xc209('0x2b')](function(_0x2ca04e){_0x2bbc6d[_0xc209('0x4b')](getRemoteTag(_0x2ca04e,_0x2e8079,_0x1c8847,_0x2d8cc4,_0xa04aaf));});return Promise[_0xc209('0x4c')](_0x2bbc6d)[_0xc209('0x1a')](function(_0x2d2dbe){if(_0x2d2dbe[_0xc209('0xd')]){logger[_0xc209('0x10')]('['+[_0x49fb51[_0xc209('0x11')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x2d2dbe);var _0x1bfb0f=[];_0x2d2dbe[_0xc209('0x2b')](function(_0x30cc3f){_0x1bfb0f['push'](assignTagToIncident(_0x30cc3f,_0x2e8079,_0x1c8847,_0x253558,_0x2d8cc4));});return Promise['all'](_0x1bfb0f)[_0xc209('0x1a')](function(){_0x4baa96();})['catch'](function(){_0x4baa96();});}else{_0x4baa96();}});});}function getTags(_0x2bf4de,_0x3caa31,_0x1aa742,_0x2a546d,_0x32f2f0,_0x40681f){return function(_0x1bfd3c){return new Promise(function(_0x46f534,_0x315116){var _0x1e5485=[];var _0x2680f5=_0x2a546d[_0xc209('0x4d')];if(_0x2680f5&&_0x2680f5[_0xc209('0xd')]>0x0){_0x1e5485=_[_0xc209('0x4e')](_0x2680f5,_0xc209('0x4f'));}if(_0x1e5485['length']>0x0){return manageTags(_0x2bf4de,_0x1e5485,_0x3caa31,_0x1aa742,_0x1bfd3c,_0x32f2f0,_0x40681f)[_0xc209('0x1a')](function(){_0x46f534(_0x1bfd3c);});}else{_0x46f534(_0x1bfd3c);}});};}function emit(_0x29f132,_0x166f30,_0x3521f1){var _0x3b4826=_0xc209('0x50')+_0xc209('0x51')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xc209('0x52');var _0xbd8460={'uri':_0x29f132+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3521f1+_0x3b4826};io['to'](util['format'](_0xc209('0x53'),_0x166f30))['emit'](_0xc209('0x54'),_0xbd8460);}exports['cs']=function(_0x16ab94,_0x302284,_0x40ba6e,_0x9c9522,_0x54d1a5,_0x1ba731,_0xb1ba01,_0x4b819e){var _0xc8b8a6={};var _0x457f10={'user':_0x1ba731[_0xc209('0x55')],'pass':_0x1ba731[_0xc209('0x56')]};var _0x26b4a0='sysparm_limit=1';var _0x947585=_0xc209('0x57');_0x1ba731['remoteUri']=intUtil['stripTrailingSlash'](_0x1ba731[_0xc209('0x58')]);_0x1ba731['serverUrl']=intUtil[_0xc209('0x59')](_0x1ba731[_0xc209('0x5a')]);var _0x4194e3=util[_0xc209('0x5b')](_0xc209('0x5c'),_0x1ba731[_0xc209('0x58')]);_0xc8b8a6[_0xc209('0x20')]=!_[_0xc209('0x5d')](_0x9c9522)?_0x9c9522[_0xc209('0x5e')]:null;_0xc8b8a6['adminEmail']=_0x1ba731[_0xc209('0x5e')];_0xc8b8a6['endUserNumber']=_0x4b819e[_0xc209('0x32')]()===_0xc209('0x3b')?_0x302284['destcalleridnum']:_0x302284['calleridnum'];_0xc8b8a6[_0xc209('0x5f')]=_0x4b819e==='queue'||_0x4b819e===_0xc209('0x60')?_0xc209('0x61'):_0xc209('0x3b');var _0x51e639=util['format'](_0xc209('0x62'),_0x1ba731[_0xc209('0x5a')],_0x302284[_0xc209('0x63')],md5(_0x302284[_0xc209('0x63')]));if(_0x54d1a5&&_0x54d1a5[_0xc209('0x64')]){logger[_0xc209('0x10')](_0xc209('0x65'),_0xc209('0x66'));_0x302284[_0xc209('0x67')]=_0x51e639;}else if(_0xb1ba01&&_0xb1ba01[_0xc209('0x68')]&&_0xb1ba01[_0xc209('0x68')]!==_0xc209('0x69')){logger[_0xc209('0x10')](_0xc209('0x6a'),_0xc209('0x66'));_0x302284[_0xc209('0x67')]=_0x51e639;}else{_0x302284[_0xc209('0x67')]='';}return getAdminUser(_0x4b819e,_0x457f10,_0xc8b8a6,_0x4194e3,_0x947585,_0x26b4a0)[_0xc209('0x1a')](getUser(_0x4b819e,_0x457f10,_0x4194e3,_0x947585,_0x26b4a0))[_0xc209('0x1a')](getEndUser(_0x4b819e,_0x457f10,_0x4194e3,_0x947585,_0x26b4a0))[_0xc209('0x1a')](getTicket(_0x4b819e,_0x457f10,_0x4194e3,_0x40ba6e,_0x302284,_0x947585))[_0xc209('0x1a')](function(_0x497ef0){logger[_0xc209('0x10')](util[_0xc209('0x5b')](_0xc209('0x6b'),_0x497ef0['ticketId']));logger[_0xc209('0x10')](util['format']('call\x20direction:\x20%s',_0x4b819e));if(_0x4b819e!==_0xc209('0x60')){logger[_0xc209('0x10')]('['+[_0x4b819e['toUpperCase']()]+']',_0xc209('0x6c'));emit(_0x1ba731[_0xc209('0x58')],_0x9c9522[_0xc209('0x4f')],_0x497ef0[_0xc209('0x49')]);}})['catch'](function(_0x44c30a){logger['error']('['+[_0x4b819e[_0xc209('0x11')]()]+_0xc209('0x6d'),util[_0xc209('0x6e')](_0x44c30a,{'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 464d537..5520a5a 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 _0xbd24=['md5','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','Contacts','parent_name','direction','forEach','variableName','push','set_entry','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','JSON','Employees','user_name','then','entry_list','length','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','phone_home','Enduser\x20created.','[HTTP]','merge','map','string','nameField','type','idField','customField','custom_fields','variable','Variable','toLowerCase','POST','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','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','recordingFormat','none','destcalleridname','Outbound','The\x20Ticket\x20ID\x20is:','contacts','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise'];(function(_0x411ce7,_0x12ec97){var _0x4dc1d9=function(_0x4e8a68){while(--_0x4e8a68){_0x411ce7['push'](_0x411ce7['shift']());}};_0x4dc1d9(++_0x12ec97);}(_0xbd24,0xee));var _0x4bd2=function(_0x588370,_0x4563b9){_0x588370=_0x588370-0x0;var _0x1b0dc1=_0xbd24[_0x588370];return _0x1b0dc1;};'use strict';var _=require(_0x4bd2('0x0'));var rp=require(_0x4bd2('0x1'));var BPromise=require('bluebird');var md5=require(_0x4bd2('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x4bd2('0x3'));var config=require(_0x4bd2('0x4'));var logger=require(_0x4bd2('0x5'))(_0x4bd2('0x6'));config[_0x4bd2('0x7')]=_[_0x4bd2('0x8')](config[_0x4bd2('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x4bd2('0x9'))(new Redis(config[_0x4bd2('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x13fc34,_0xe7b612,_0x41d2e0){io['to'](_0x13fc34)[_0x4bd2('0xa')](_0xe7b612,_0x41d2e0);}function getTicket(_0x19012b,_0x36c1eb,_0x521555,_0x22a501,_0x1a1710,_0x342eae,_0x171eb9,_0x2794fb){logger[_0x4bd2('0xb')](_0x4bd2('0xc'));var _0x3d8d03=new Date();var _0x19ffd7=[{'name':_0x4bd2('0xd'),'value':intUtil[_0x4bd2('0xe')](_0x22a501[_0x4bd2('0xf')],_0x1a1710,'\x20')},{'name':_0x4bd2('0x10'),'value':_0x36c1eb['id']},{'name':'created_by','value':_0x36c1eb['id']},{'name':_0x4bd2('0x11'),'value':intUtil[_0x4bd2('0xe')](_0x22a501[_0x4bd2('0x12')],_0x1a1710,'\x0a')},{'name':'date_start','value':_0x3d8d03[_0x4bd2('0x13')]()[_0x4bd2('0x14')](0x0,0x13)[_0x4bd2('0x15')]('T','\x20')},{'name':_0x4bd2('0x16'),'value':'0'},{'name':_0x4bd2('0x17'),'value':'15'},{'name':'parent_id','value':_0x521555['id']},{'name':'parent_type','value':_0x4bd2('0x18')},{'name':_0x4bd2('0x19'),'value':_0x521555['name']},{'name':_0x4bd2('0x1a'),'value':_0x2794fb}];if(_0x342eae['length']){_[_0x4bd2('0x1b')](_0x342eae,function(_0x555c40){if(_0x1a1710[_0x555c40[_0x4bd2('0x1c')]]){_0x19ffd7[_0x4bd2('0x1d')]({'name':_0x555c40['idField'],'value':_0x1a1710[_0x555c40[_0x4bd2('0x1c')]]});}});}return request({'form':{'method':_0x4bd2('0x1e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4bd2('0x1f')]({'session':_0x171eb9['id'],'module_name':'Calls','name_value_list':_0x19ffd7})}});}function getAuth(_0x2c4697){return util[_0x4bd2('0x20')](_0x4bd2('0x21'),new Buffer(_0x2c4697[_0x4bd2('0x22')]+':X')[_0x4bd2('0x23')](_0x4bd2('0x24')));}function getServerInfo(_0x4c5d1d){return request({'form':{'method':_0x4bd2('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4bd2('0x1f')]({'session':_0x4c5d1d['id']})}});}function getUser(_0x46ee38,_0x535921,_0x52ae68){if(!_[_0x4bd2('0x26')](_0x535921)){logger[_0x4bd2('0xb')](_0x4bd2('0x27'),_0x535921);return request({'form':{'method':_0x4bd2('0x28'),'input_type':_0x4bd2('0x29'),'response_type':'JSON','rest_data':JSON[_0x4bd2('0x1f')]({'session':_0x52ae68['id'],'module_name':_0x4bd2('0x2a'),'query':util[_0x4bd2('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x535921),'order_by':'','offset':'0','select_fields':['id',_0x4bd2('0xd'),_0x4bd2('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4bd2('0x2c')](function(_0x2d4a44){if(_0x2d4a44[_0x4bd2('0x2d')][_0x4bd2('0x2e')]){var _0x52ecd2=_['find'](_0x2d4a44[_0x4bd2('0x2d')],function(_0x3899c0){return _0x3899c0[_0x4bd2('0x2f')][_0x4bd2('0x2b')]['value']===_0x535921;});if(_0x52ecd2){logger[_0x4bd2('0xb')](_0x4bd2('0x30'));return BPromise[_0x4bd2('0x31')]({'id':_0x52ecd2['name_value_list']['id'][_0x4bd2('0x32')],'name':_0x52ecd2['name_value_list'][_0x4bd2('0xd')][_0x4bd2('0x32')]});}}logger[_0x4bd2('0xb')](_0x4bd2('0x33'));return BPromise[_0x4bd2('0x31')]({'id':_0x52ae68[_0x4bd2('0x2f')][_0x4bd2('0x34')][_0x4bd2('0x32')],'name':_0x52ae68[_0x4bd2('0x2f')][_0x4bd2('0x2b')]['value']});});}else{logger['info'](_0x4bd2('0x35'));return BPromise[_0x4bd2('0x31')]({'id':_0x52ae68[_0x4bd2('0x2f')][_0x4bd2('0x34')][_0x4bd2('0x32')],'name':_0x52ae68[_0x4bd2('0x2f')][_0x4bd2('0x2b')][_0x4bd2('0x32')]});}}function getEndUser(_0x8c9ddb,_0xb3ea5c,_0x582fab,_0x4a7b06){logger[_0x4bd2('0xb')](_0x4bd2('0x36'),_0x582fab);return request({'form':{'method':_0x4bd2('0x28'),'input_type':'JSON','response_type':_0x4bd2('0x29'),'rest_data':JSON['stringify']({'session':_0x4a7b06['id'],'module_name':_0x4bd2('0x18'),'query':util[_0x4bd2('0x20')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x582fab),'order_by':'','offset':'0','select_fields':['id',_0x4bd2('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4bd2('0x2c')](function(_0xf53900){if(_0xf53900[_0x4bd2('0x2d')]['length']){var _0x2a89ba=_['find'](_0xf53900[_0x4bd2('0x2d')],function(_0x3229f5){return _0x3229f5[_0x4bd2('0x2f')]['phone_home']['value']===_0x582fab;});if(_0x2a89ba){logger['info'](_0x4bd2('0x37'));return BPromise['resolve']({'id':_0x2a89ba[_0x4bd2('0x2f')]['id'][_0x4bd2('0x32')],'name':_0x2a89ba[_0x4bd2('0x2f')][_0x4bd2('0xd')][_0x4bd2('0x32')],'phone':_0x2a89ba[_0x4bd2('0x2f')]['phone_home'][_0x4bd2('0x32')]});}}else{logger[_0x4bd2('0xb')](_0x4bd2('0x38'));return request({'form':{'method':_0x4bd2('0x1e'),'input_type':_0x4bd2('0x29'),'response_type':_0x4bd2('0x29'),'rest_data':JSON['stringify']({'session':_0x4a7b06['id'],'module_name':_0x4bd2('0x18'),'name_value_list':[{'name':_0x4bd2('0x39'),'value':_0xb3ea5c!==_0x4bd2('0x3a')?_0xb3ea5c:util[_0x4bd2('0x20')](_0x4bd2('0x3b'),_0x582fab)},{'name':_0x4bd2('0x3c'),'value':_0x582fab}]})}})[_0x4bd2('0x2c')](function(_0x9982a8){logger[_0x4bd2('0xb')](_0x4bd2('0x3d'));return BPromise['resolve']({'id':_0x9982a8['id'],'name':_0x9982a8[_0x4bd2('0x2d')][_0x4bd2('0x39')][_0x4bd2('0x32')],'phone':_0x9982a8[_0x4bd2('0x2d')][_0x4bd2('0x3c')]['value']});});}});}function request(_0xb56fcd){logger['debug'](_0x4bd2('0x3e'),JSON[_0x4bd2('0x1f')](_0xb56fcd));return rp(_[_0x4bd2('0x3f')](def,_0xb56fcd));}function getTags(_0x187be2,_0x95ee66){var _0xdd80ef=[];if(_0x187be2&&_0x187be2[_0x4bd2('0x2e')]>0x0){_0xdd80ef=_[_0x4bd2('0x40')](_0x187be2,_0x95ee66);}return _0xdd80ef;}function getCustomFields(_0x16e6f7,_0x46d146){var _0x5656d8=[];var _0x2e3d69={'custom_fields':[]};if(_0x16e6f7[_0x4bd2('0x2e')]>0x0){_[_0x4bd2('0x1b')](_0x16e6f7,function(_0x1d8fd5){if(_0x1d8fd5['type']===_0x4bd2('0x41')&&_0x1d8fd5['nameField']&&!_0x1d8fd5['customField']){_0x2e3d69[_0x1d8fd5[_0x4bd2('0x42')]['toLowerCase']()]=_0x1d8fd5['content']['toString']();}else if(_0x1d8fd5[_0x4bd2('0x43')]===_0x4bd2('0x41')&&_0x1d8fd5[_0x4bd2('0x44')]&&_0x1d8fd5[_0x4bd2('0x45')]){_0x2e3d69[_0x4bd2('0x46')][_0x4bd2('0x1d')]({'id':_0x1d8fd5[_0x4bd2('0x44')],'value':_0x1d8fd5['content']['toString']()});}else if(_0x1d8fd5[_0x4bd2('0x43')]===_0x4bd2('0x47')&&_0x1d8fd5['variableName']&&_0x1d8fd5[_0x4bd2('0x44')]&&_0x1d8fd5['customField']){_0x46d146[_0x1d8fd5[_0x4bd2('0x1c')]]&&_0x2e3d69[_0x4bd2('0x46')][_0x4bd2('0x1d')]({'id':_0x1d8fd5[_0x4bd2('0x44')],'value':_0x46d146[_0x1d8fd5['variableName']][_0x4bd2('0x23')]()});}else if(_0x1d8fd5[_0x4bd2('0x43')]==='customVariable'&&_0x1d8fd5['Variable']&&_0x1d8fd5[_0x4bd2('0x48')]['name']&&_0x1d8fd5[_0x4bd2('0x44')]&&_0x1d8fd5[_0x4bd2('0x45')]){_0x46d146[_0x1d8fd5[_0x4bd2('0x48')][_0x4bd2('0xd')][_0x4bd2('0x49')]()]&&_0x2e3d69[_0x4bd2('0x46')][_0x4bd2('0x1d')]({'id':_0x1d8fd5['idField'],'value':_0x46d146[_0x1d8fd5['Variable'][_0x4bd2('0xd')]['toLowerCase']()][_0x4bd2('0x23')]()});}});}return _0x2e3d69;}function getConnection(_0x3582da){return request({'method':_0x4bd2('0x4a'),'form':{'method':_0x4bd2('0x4b'),'input_type':_0x4bd2('0x29'),'response_type':_0x4bd2('0x29'),'rest_data':JSON[_0x4bd2('0x1f')]({'user_auth':{'user_name':_0x3582da[_0x4bd2('0x4c')],'password':_0x3582da[_0x4bd2('0x4d')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4bd2('0x2c')](function(_0x339f2e){var _0x2d9336=_0x339f2e;if(_0x2d9336['id']){def[_0x4bd2('0x4e')]=_0x2d9336['id'];return BPromise[_0x4bd2('0x31')](_0x2d9336);}else{throw new Error(util[_0x4bd2('0x20')](_0x4bd2('0x4f'),_0x3582da['id']));}});}function setRelationship(_0x5cdbea,_0x244dbe,_0x34e3c7,_0x2b8f6a){return request({'form':{'method':'set_relationship','input_type':_0x4bd2('0x29'),'response_type':_0x4bd2('0x29'),'rest_data':JSON['stringify']({'session':_0x5cdbea['id'],'module_name':_0x4bd2('0x50'),'module_id':_0x34e3c7['id'],'link_field_name':_0x2b8f6a,'related_ids':[_0x244dbe['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4a9a4c,_0x5ae66c,_0x496a60,_0xee7916,_0x390fd3,_0x468808){var _0x31cad0,_0x2d04a7,_0x38bae5,_0x4ff313;_0x468808[_0x4bd2('0x51')]=intUtil[_0x4bd2('0x52')](_0x468808[_0x4bd2('0x51')]);_0x468808['serverUrl']=intUtil['stripTrailingSlash'](_0x468808[_0x4bd2('0x53')]);def[_0x4bd2('0x54')]=util[_0x4bd2('0x20')](_0x4bd2('0x55'),_0x468808[_0x4bd2('0x51')]);if(_0x390fd3&&_0x390fd3[_0x4bd2('0x56')]){logger['info'](_0x4bd2('0x57'),_0x4bd2('0x58'));_0x5ae66c[_0x4bd2('0x59')]=util['format'](_0x4bd2('0x5a'),_0x468808['serverUrl'],_0x5ae66c[_0x4bd2('0x5b')],md5(_0x5ae66c['uniqueid']));}else{_0x5ae66c['recordingURL']='';}return getConnection(_0x468808)['then'](function(_0x3afc60){_0x4ff313=_0x3afc60;return getUser(_0x468808,_0xee7916[_0x4bd2('0xd')],_0x4ff313);})[_0x4bd2('0x2c')](function(_0x301107){_0x31cad0=_0x301107;logger['info'](_0x4bd2('0x5c'),_0x31cad0['id']);return getEndUser(_0x468808,_0x5ae66c['calleridname'],_0x5ae66c[_0x4bd2('0x5d')],_0x4ff313);})[_0x4bd2('0x2c')](function(_0x394952){_0x2d04a7=_0x394952;logger[_0x4bd2('0xb')](_0x4bd2('0x5e'),_0x2d04a7['id']);return getTicket(_0x468808,_0x31cad0,_0x2d04a7,_0x496a60,_0x5ae66c,_0x496a60[_0x4bd2('0x5f')],_0x4ff313,_0x4bd2('0x60'));})[_0x4bd2('0x2c')](function(_0x5b1f3f){_0x38bae5=_0x5b1f3f;logger['info'](_0x4bd2('0x61'));logger[_0x4bd2('0xb')]('The\x20Ticket\x20ID\x20is:',_0x38bae5['id']);return setRelationship(_0x4ff313,_0x31cad0,_0x38bae5,_0x4bd2('0x62'));})[_0x4bd2('0x2c')](function(){return setRelationship(_0x4ff313,_0x2d04a7,_0x38bae5,'contacts');})[_0x4bd2('0x2c')](function(){return getServerInfo(_0x4ff313);})[_0x4bd2('0x2c')](function(_0x185db3){var _0x32dfd4=parseInt(_0x185db3[_0x4bd2('0x63')][_0x4bd2('0x64')](0x0));var _0x42e129=util[_0x4bd2('0x20')](_0x4bd2('0x65'),_0x468808[_0x4bd2('0x51')],_0x38bae5['id']);if(_0x32dfd4>0x6){_0x42e129=util['format'](_0x4bd2('0x66'),_0x468808[_0x4bd2('0x51')],_0x38bae5['id']);}logger['info']('[QUEUE]',_0x4bd2('0x67'));emit(util['format'](_0x4bd2('0x68'),_0xee7916[_0x4bd2('0xd')]),_0x4bd2('0x69'),{'uri':_0x42e129});})[_0x4bd2('0x6a')](function(_0xa73579){logger[_0x4bd2('0x6b')](_0x4bd2('0x57'),JSON[_0x4bd2('0x1f')](_0xa73579));});};exports[_0x4bd2('0x6c')]=function(_0x23f867,_0x3a95f0,_0x24dc74,_0x5ad53a,_0x573a09,_0x4aae96,_0x567b53){var _0x14e8ce,_0x2f633e,_0x58dc8e,_0x5b6be9;_0x4aae96[_0x4bd2('0x51')]=intUtil[_0x4bd2('0x52')](_0x4aae96['remoteUri']);_0x4aae96[_0x4bd2('0x53')]=intUtil['stripTrailingSlash'](_0x4aae96[_0x4bd2('0x53')]);def['uri']=util[_0x4bd2('0x20')](_0x4bd2('0x55'),_0x4aae96[_0x4bd2('0x51')]);if(_0x567b53&&_0x567b53[_0x4bd2('0x6d')]&&_0x567b53[_0x4bd2('0x6d')]!==_0x4bd2('0x6e')){logger[_0x4bd2('0xb')]('[OUTBOUND]',_0x4bd2('0x58'));_0x3a95f0[_0x4bd2('0x59')]=util[_0x4bd2('0x20')](_0x4bd2('0x5a'),_0x4aae96[_0x4bd2('0x53')],_0x3a95f0[_0x4bd2('0x5b')],md5(_0x3a95f0['uniqueid']));}return getConnection(_0x4aae96)[_0x4bd2('0x2c')](function(_0x2f38e9){_0x5b6be9=_0x2f38e9;return getUser(_0x4aae96,_0x5ad53a[_0x4bd2('0xd')],_0x5b6be9);})[_0x4bd2('0x2c')](function(_0x20fa66){_0x14e8ce=_0x20fa66;logger[_0x4bd2('0xb')](_0x4bd2('0x5c'),_0x14e8ce['id']);return getEndUser(_0x4aae96,_0x3a95f0[_0x4bd2('0x6f')],_0x3a95f0['destcalleridnum'],_0x5b6be9);})[_0x4bd2('0x2c')](function(_0x5eab9e){_0x2f633e=_0x5eab9e;logger['info'](_0x4bd2('0x5e'),_0x2f633e['id']);return getTicket(_0x4aae96,_0x14e8ce,_0x2f633e,_0x24dc74,_0x3a95f0,_0x24dc74[_0x4bd2('0x5f')],_0x5b6be9,_0x4bd2('0x70'));})['then'](function(_0x14373a){_0x58dc8e=_0x14373a;logger['info'](_0x4bd2('0x61'));logger['info'](_0x4bd2('0x71'),_0x58dc8e['id']);return setRelationship(_0x5b6be9,_0x14e8ce,_0x58dc8e,_0x4bd2('0x62'));})[_0x4bd2('0x2c')](function(){return setRelationship(_0x5b6be9,_0x2f633e,_0x58dc8e,_0x4bd2('0x72'));})['then'](function(){return getServerInfo(_0x5b6be9);})['then'](function(_0x3d2128){var _0x409b98=parseInt(_0x3d2128[_0x4bd2('0x63')][_0x4bd2('0x64')](0x0));var _0x5b87e0=util['format'](_0x4bd2('0x65'),_0x4aae96[_0x4bd2('0x51')],_0x58dc8e['id']);if(_0x409b98>0x6){_0x5b87e0=util[_0x4bd2('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4aae96[_0x4bd2('0x51')],_0x58dc8e['id']);}logger[_0x4bd2('0xb')]('[OUTBOUND]',_0x4bd2('0x67'));emit(util[_0x4bd2('0x20')]('user:%s',_0x5ad53a['name']),_0x4bd2('0x69'),{'uri':_0x5b87e0});})['catch'](function(_0xcceeab){logger[_0x4bd2('0x6b')](_0x4bd2('0x73'),JSON[_0x4bd2('0x1f')](_0xcceeab));});};exports[_0x4bd2('0x74')]=function(_0x17ed04,_0x4cf14c,_0x1c6f12,_0x1350f2,_0x5d2cfb,_0x1f7dac){var _0x541df6,_0x42a3e3,_0x39fd7d,_0x2137bd;_0x1f7dac[_0x4bd2('0x51')]=intUtil['stripTrailingSlash'](_0x1f7dac[_0x4bd2('0x51')]);_0x1f7dac[_0x4bd2('0x53')]=intUtil[_0x4bd2('0x52')](_0x1f7dac[_0x4bd2('0x53')]);def[_0x4bd2('0x54')]=util[_0x4bd2('0x20')](_0x4bd2('0x55'),_0x1f7dac[_0x4bd2('0x51')]);if(_0x5d2cfb&&_0x5d2cfb[_0x4bd2('0x56')]){logger['info']('['+_0x4cf14c[_0x4bd2('0x75')][_0x4bd2('0x76')]()+']','Recording\x20is\x20enabled!');_0x4cf14c[_0x4bd2('0x59')]=util[_0x4bd2('0x20')](_0x4bd2('0x5a'),_0x1f7dac[_0x4bd2('0x53')],_0x4cf14c['uniqueid'],md5(_0x4cf14c[_0x4bd2('0x5b')]));}else{_0x4cf14c['recordingURL']='';}return getConnection(_0x1f7dac)[_0x4bd2('0x2c')](function(_0x4631f0){_0x2137bd=_0x4631f0;if(!_[_0x4bd2('0x26')](_0x1350f2)){return getUser(_0x1f7dac,_0x1350f2[_0x4bd2('0xd')],_0x2137bd);}else{return getUser(_0x1f7dac,null,_0x2137bd);}})['then'](function(_0x55903c){_0x541df6=_0x55903c;logger[_0x4bd2('0xb')]('The\x20User\x20ID\x20is:',_0x541df6['id']);return getEndUser(_0x1f7dac,_0x4cf14c[_0x4bd2('0x77')],_0x4cf14c[_0x4bd2('0x5d')],_0x2137bd);})[_0x4bd2('0x2c')](function(_0x17c59c){_0x42a3e3=_0x17c59c;logger[_0x4bd2('0xb')](_0x4bd2('0x5e'),_0x42a3e3['id']);return getTicket(_0x1f7dac,_0x541df6,_0x42a3e3,_0x1c6f12,_0x4cf14c,_0x1c6f12[_0x4bd2('0x5f')],_0x2137bd,'Inbound');})[_0x4bd2('0x2c')](function(_0x412058){_0x39fd7d=_0x412058;logger[_0x4bd2('0xb')](_0x4bd2('0x61'));logger['info'](_0x4bd2('0x71'),_0x39fd7d['id']);return setRelationship(_0x2137bd,_0x541df6,_0x39fd7d,_0x4bd2('0x62'));})[_0x4bd2('0x2c')](function(){return setRelationship(_0x2137bd,_0x42a3e3,_0x39fd7d,_0x4bd2('0x72'));})[_0x4bd2('0x2c')](function(){return getServerInfo(_0x2137bd);})[_0x4bd2('0x6a')](function(_0x7b8a4){logger[_0x4bd2('0x6b')]('['+_0x4cf14c[_0x4bd2('0x75')]['toUpperCase']()+']',JSON[_0x4bd2('0x1f')](_0x7b8a4));});}; \ No newline at end of file +var _0x02a3=['Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','user:%s','error','unmanaged','toUpperCase','isNil','calleridname','lastevent','lodash','md5','util','ioredis','../../../../config/logger','sugarcrm','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','type','customField','nameField','toLowerCase','content','string','custom_fields','variable','customVariable','Variable','POST','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','[QUEUE]','%s/service/v4_1/rest.php','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x02a3,0x101));var _0x302a=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x02a3[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x302a('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x302a('0x1'));var util=require(_0x302a('0x2'));var Redis=require(_0x302a('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x302a('0x4'))(_0x302a('0x5'));config['redis']=_[_0x302a('0x6')](config['redis'],{'host':_0x302a('0x7'),'port':0x18eb});var io=require(_0x302a('0x8'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x211522,_0x2b9a4d,_0xcd47c5){io['to'](_0x211522)[_0x302a('0x9')](_0x2b9a4d,_0xcd47c5);}function getTicket(_0x35f1e0,_0x3bc7e0,_0x387eb4,_0x160d2a,_0x21ba93,_0x5035f9,_0x368556,_0xed30d1){logger[_0x302a('0xa')](_0x302a('0xb'));var _0x429a27=new Date();var _0xed6e51=[{'name':_0x302a('0xc'),'value':intUtil[_0x302a('0xd')](_0x160d2a['Subjects'],_0x21ba93,'\x20')},{'name':_0x302a('0xe'),'value':_0x3bc7e0['id']},{'name':_0x302a('0xf'),'value':_0x3bc7e0['id']},{'name':_0x302a('0x10'),'value':intUtil[_0x302a('0xd')](_0x160d2a[_0x302a('0x11')],_0x21ba93,'\x0a')},{'name':_0x302a('0x12'),'value':_0x429a27[_0x302a('0x13')]()['slice'](0x0,0x13)[_0x302a('0x14')]('T','\x20')},{'name':_0x302a('0x15'),'value':'0'},{'name':_0x302a('0x16'),'value':'15'},{'name':_0x302a('0x17'),'value':_0x387eb4['id']},{'name':_0x302a('0x18'),'value':_0x302a('0x19')},{'name':_0x302a('0x1a'),'value':_0x387eb4[_0x302a('0xc')]},{'name':_0x302a('0x1b'),'value':_0xed30d1}];if(_0x5035f9[_0x302a('0x1c')]){_[_0x302a('0x1d')](_0x5035f9,function(_0x1e50cb){if(_0x21ba93[_0x1e50cb[_0x302a('0x1e')]]){_0xed6e51[_0x302a('0x1f')]({'name':_0x1e50cb[_0x302a('0x20')],'value':_0x21ba93[_0x1e50cb[_0x302a('0x1e')]]});}});}return request({'form':{'method':_0x302a('0x21'),'input_type':'JSON','response_type':_0x302a('0x22'),'rest_data':JSON[_0x302a('0x23')]({'session':_0x368556['id'],'module_name':_0x302a('0x24'),'name_value_list':_0xed6e51})}});}function getAuth(_0xccfcb9){return util[_0x302a('0x25')](_0x302a('0x26'),new Buffer(_0xccfcb9['apiKey']+':X')[_0x302a('0x27')](_0x302a('0x28')));}function getServerInfo(_0x154f63){return request({'form':{'method':_0x302a('0x29'),'input_type':_0x302a('0x22'),'response_type':_0x302a('0x22'),'rest_data':JSON[_0x302a('0x23')]({'session':_0x154f63['id']})}});}function getUser(_0x43f3ea,_0x34f220,_0x495fed){if(!_['isNil'](_0x34f220)){logger['info']('Getting\x20agent\x20with\x20name',_0x34f220);return request({'form':{'method':'get_entry_list','input_type':_0x302a('0x22'),'response_type':_0x302a('0x22'),'rest_data':JSON[_0x302a('0x23')]({'session':_0x495fed['id'],'module_name':_0x302a('0x2a'),'query':util['format'](_0x302a('0x2b'),_0x34f220),'order_by':'','offset':'0','select_fields':['id','name',_0x302a('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x302a('0x2d')](function(_0x39252b){if(_0x39252b[_0x302a('0x2e')][_0x302a('0x1c')]){var _0xae1e09=_[_0x302a('0x2f')](_0x39252b[_0x302a('0x2e')],function(_0xa2c0a3){return _0xa2c0a3[_0x302a('0x30')][_0x302a('0x2c')][_0x302a('0x31')]===_0x34f220;});if(_0xae1e09){logger['info'](_0x302a('0x32'));return BPromise['resolve']({'id':_0xae1e09[_0x302a('0x30')]['id'][_0x302a('0x31')],'name':_0xae1e09['name_value_list'][_0x302a('0xc')][_0x302a('0x31')]});}}logger[_0x302a('0xa')](_0x302a('0x33'));return BPromise[_0x302a('0x34')]({'id':_0x495fed[_0x302a('0x30')][_0x302a('0x35')][_0x302a('0x31')],'name':_0x495fed[_0x302a('0x30')][_0x302a('0x2c')][_0x302a('0x31')]});});}else{logger[_0x302a('0xa')](_0x302a('0x36'));return BPromise[_0x302a('0x34')]({'id':_0x495fed['name_value_list'][_0x302a('0x35')]['value'],'name':_0x495fed[_0x302a('0x30')][_0x302a('0x2c')][_0x302a('0x31')]});}}function getEndUser(_0x2f9123,_0xa05c25,_0xdc77dd,_0x140059){logger['info'](_0x302a('0x37'),_0xdc77dd);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x302a('0x22'),'rest_data':JSON[_0x302a('0x23')]({'session':_0x140059['id'],'module_name':_0x302a('0x19'),'query':util[_0x302a('0x25')](_0x302a('0x38'),_0xdc77dd),'order_by':'','offset':'0','select_fields':['id',_0x302a('0xc'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x302a('0x2d')](function(_0xa0b923){if(_0xa0b923[_0x302a('0x2e')][_0x302a('0x1c')]){var _0x134f96=_[_0x302a('0x2f')](_0xa0b923[_0x302a('0x2e')],function(_0x552da3){return _0x552da3[_0x302a('0x30')][_0x302a('0x39')][_0x302a('0x31')]===_0xdc77dd;});if(_0x134f96){logger[_0x302a('0xa')](_0x302a('0x3a'));return BPromise[_0x302a('0x34')]({'id':_0x134f96[_0x302a('0x30')]['id'][_0x302a('0x31')],'name':_0x134f96['name_value_list'][_0x302a('0xc')][_0x302a('0x31')],'phone':_0x134f96[_0x302a('0x30')][_0x302a('0x39')]['value']});}}else{logger[_0x302a('0xa')](_0x302a('0x3b'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x302a('0x22'),'rest_data':JSON[_0x302a('0x23')]({'session':_0x140059['id'],'module_name':_0x302a('0x19'),'name_value_list':[{'name':_0x302a('0x3c'),'value':_0xa05c25!==_0x302a('0x3d')?_0xa05c25:util[_0x302a('0x25')](_0x302a('0x3e'),_0xdc77dd)},{'name':'phone_home','value':_0xdc77dd}]})}})[_0x302a('0x2d')](function(_0x14fac2){logger[_0x302a('0xa')](_0x302a('0x3f'));return BPromise['resolve']({'id':_0x14fac2['id'],'name':_0x14fac2[_0x302a('0x2e')][_0x302a('0x3c')][_0x302a('0x31')],'phone':_0x14fac2[_0x302a('0x2e')][_0x302a('0x39')][_0x302a('0x31')]});});}});}function request(_0xf44f33){logger[_0x302a('0x40')]('[HTTP]',JSON[_0x302a('0x23')](_0xf44f33));return rp(_[_0x302a('0x41')](def,_0xf44f33));}function getTags(_0x334a0d,_0x1804c2){var _0x4bd3ea=[];if(_0x334a0d&&_0x334a0d['length']>0x0){_0x4bd3ea=_['map'](_0x334a0d,_0x1804c2);}return _0x4bd3ea;}function getCustomFields(_0x6bdbc6,_0x3cdf37){var _0x520a84=[];var _0x4e20a3={'custom_fields':[]};if(_0x6bdbc6[_0x302a('0x1c')]>0x0){_[_0x302a('0x1d')](_0x6bdbc6,function(_0x549806){if(_0x549806[_0x302a('0x42')]==='string'&&_0x549806['nameField']&&!_0x549806[_0x302a('0x43')]){_0x4e20a3[_0x549806[_0x302a('0x44')][_0x302a('0x45')]()]=_0x549806[_0x302a('0x46')]['toString']();}else if(_0x549806['type']===_0x302a('0x47')&&_0x549806['idField']&&_0x549806[_0x302a('0x43')]){_0x4e20a3[_0x302a('0x48')][_0x302a('0x1f')]({'id':_0x549806[_0x302a('0x20')],'value':_0x549806['content'][_0x302a('0x27')]()});}else if(_0x549806[_0x302a('0x42')]===_0x302a('0x49')&&_0x549806[_0x302a('0x1e')]&&_0x549806[_0x302a('0x20')]&&_0x549806[_0x302a('0x43')]){_0x3cdf37[_0x549806[_0x302a('0x1e')]]&&_0x4e20a3[_0x302a('0x48')][_0x302a('0x1f')]({'id':_0x549806[_0x302a('0x20')],'value':_0x3cdf37[_0x549806['variableName']][_0x302a('0x27')]()});}else if(_0x549806[_0x302a('0x42')]===_0x302a('0x4a')&&_0x549806[_0x302a('0x4b')]&&_0x549806['Variable'][_0x302a('0xc')]&&_0x549806[_0x302a('0x20')]&&_0x549806[_0x302a('0x43')]){_0x3cdf37[_0x549806[_0x302a('0x4b')][_0x302a('0xc')][_0x302a('0x45')]()]&&_0x4e20a3[_0x302a('0x48')][_0x302a('0x1f')]({'id':_0x549806[_0x302a('0x20')],'value':_0x3cdf37[_0x549806[_0x302a('0x4b')][_0x302a('0xc')]['toLowerCase']()]['toString']()});}});}return _0x4e20a3;}function getConnection(_0x5d5c67){return request({'method':_0x302a('0x4c'),'form':{'method':'login','input_type':'JSON','response_type':_0x302a('0x22'),'rest_data':JSON[_0x302a('0x23')]({'user_auth':{'user_name':_0x5d5c67[_0x302a('0x4d')],'password':_0x5d5c67[_0x302a('0x4e')],'encryption':_0x302a('0x4f')},'application':_0x302a('0x50')})}})[_0x302a('0x2d')](function(_0x468a02){var _0xd022fa=_0x468a02;if(_0xd022fa['id']){def['sessionID']=_0xd022fa['id'];return BPromise[_0x302a('0x34')](_0xd022fa);}else{throw new Error(util[_0x302a('0x25')](_0x302a('0x51'),_0x5d5c67['id']));}});}function setRelationship(_0x28ba18,_0x5eedb4,_0x551318,_0x227b8b){return request({'form':{'method':_0x302a('0x52'),'input_type':'JSON','response_type':_0x302a('0x22'),'rest_data':JSON[_0x302a('0x23')]({'session':_0x28ba18['id'],'module_name':_0x302a('0x24'),'module_id':_0x551318['id'],'link_field_name':_0x227b8b,'related_ids':[_0x5eedb4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x302a('0x53')]=function(_0x18c66c,_0x23e4f0,_0xb356dc,_0x4fcfa6,_0x4d2790,_0x29ff6d){var _0x4d1ccf,_0x5991ff,_0x2ccbba,_0x297401;_0x29ff6d[_0x302a('0x54')]=intUtil[_0x302a('0x55')](_0x29ff6d[_0x302a('0x54')]);_0x29ff6d[_0x302a('0x56')]=intUtil[_0x302a('0x55')](_0x29ff6d[_0x302a('0x56')]);def[_0x302a('0x57')]=util[_0x302a('0x25')]('%s/service/v4_1/rest.php',_0x29ff6d[_0x302a('0x54')]);if(_0x4d2790&&_0x4d2790[_0x302a('0x58')]){logger[_0x302a('0xa')]('[QUEUE]','Recording\x20is\x20enabled!');_0x23e4f0[_0x302a('0x59')]=util[_0x302a('0x25')](_0x302a('0x5a'),_0x29ff6d['serverUrl'],_0x23e4f0['uniqueid'],md5(_0x23e4f0[_0x302a('0x5b')]));}else{_0x23e4f0[_0x302a('0x59')]='';}return getConnection(_0x29ff6d)[_0x302a('0x2d')](function(_0x392f36){_0x297401=_0x392f36;return getUser(_0x29ff6d,_0x4fcfa6[_0x302a('0xc')],_0x297401);})[_0x302a('0x2d')](function(_0x3ad2f5){_0x4d1ccf=_0x3ad2f5;logger[_0x302a('0xa')]('The\x20User\x20ID\x20is:',_0x4d1ccf['id']);return getEndUser(_0x29ff6d,_0x23e4f0['calleridname'],_0x23e4f0[_0x302a('0x5c')],_0x297401);})[_0x302a('0x2d')](function(_0x286e08){_0x5991ff=_0x286e08;logger[_0x302a('0xa')](_0x302a('0x5d'),_0x5991ff['id']);return getTicket(_0x29ff6d,_0x4d1ccf,_0x5991ff,_0xb356dc,_0x23e4f0,_0xb356dc[_0x302a('0x5e')],_0x297401,'Inbound');})['then'](function(_0x5cf54b){_0x2ccbba=_0x5cf54b;logger[_0x302a('0xa')](_0x302a('0x5f'));logger['info'](_0x302a('0x60'),_0x2ccbba['id']);return setRelationship(_0x297401,_0x4d1ccf,_0x2ccbba,'users');})[_0x302a('0x2d')](function(){return setRelationship(_0x297401,_0x5991ff,_0x2ccbba,_0x302a('0x61'));})[_0x302a('0x2d')](function(){return getServerInfo(_0x297401);})[_0x302a('0x2d')](function(_0x13185b){var _0x56d484=parseInt(_0x13185b[_0x302a('0x62')][_0x302a('0x63')](0x0));var _0x4ebdb7=util['format'](_0x302a('0x64'),_0x29ff6d['remoteUri'],_0x2ccbba['id']);if(_0x56d484>0x6){_0x4ebdb7=util[_0x302a('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x29ff6d[_0x302a('0x54')],_0x2ccbba['id']);}logger[_0x302a('0xa')]('[QUEUE]',_0x302a('0x65'));emit(util[_0x302a('0x25')]('user:%s',_0x4fcfa6['name']),_0x302a('0x66'),{'uri':_0x4ebdb7});})[_0x302a('0x67')](function(_0x429579){logger['error'](_0x302a('0x68'),JSON['stringify'](_0x429579));});};exports['outbound']=function(_0x5822d4,_0x30b0fd,_0x34e335,_0x580935,_0x59f9c4,_0x4f4b95,_0x209275){var _0x1b9138,_0x24aae5,_0x3497cb,_0x19a282;_0x4f4b95[_0x302a('0x54')]=intUtil[_0x302a('0x55')](_0x4f4b95[_0x302a('0x54')]);_0x4f4b95['serverUrl']=intUtil[_0x302a('0x55')](_0x4f4b95['serverUrl']);def['uri']=util[_0x302a('0x25')](_0x302a('0x69'),_0x4f4b95[_0x302a('0x54')]);if(_0x209275&&_0x209275['recordingFormat']&&_0x209275[_0x302a('0x6a')]!==_0x302a('0x6b')){logger[_0x302a('0xa')]('[OUTBOUND]',_0x302a('0x6c'));_0x30b0fd['recordingURL']=util[_0x302a('0x25')](_0x302a('0x5a'),_0x4f4b95[_0x302a('0x56')],_0x30b0fd['uniqueid'],md5(_0x30b0fd[_0x302a('0x5b')]));}return getConnection(_0x4f4b95)[_0x302a('0x2d')](function(_0x441aee){_0x19a282=_0x441aee;return getUser(_0x4f4b95,_0x580935[_0x302a('0xc')],_0x19a282);})[_0x302a('0x2d')](function(_0x559571){_0x1b9138=_0x559571;logger[_0x302a('0xa')](_0x302a('0x6d'),_0x1b9138['id']);return getEndUser(_0x4f4b95,_0x30b0fd[_0x302a('0x6e')],_0x30b0fd[_0x302a('0x6f')],_0x19a282);})[_0x302a('0x2d')](function(_0xb34413){_0x24aae5=_0xb34413;logger['info'](_0x302a('0x5d'),_0x24aae5['id']);return getTicket(_0x4f4b95,_0x1b9138,_0x24aae5,_0x34e335,_0x30b0fd,_0x34e335[_0x302a('0x5e')],_0x19a282,_0x302a('0x70'));})[_0x302a('0x2d')](function(_0x287484){_0x3497cb=_0x287484;logger[_0x302a('0xa')](_0x302a('0x5f'));logger[_0x302a('0xa')]('The\x20Ticket\x20ID\x20is:',_0x3497cb['id']);return setRelationship(_0x19a282,_0x1b9138,_0x3497cb,_0x302a('0x71'));})[_0x302a('0x2d')](function(){return setRelationship(_0x19a282,_0x24aae5,_0x3497cb,_0x302a('0x61'));})['then'](function(){return getServerInfo(_0x19a282);})[_0x302a('0x2d')](function(_0x46d75b){var _0x1a2b11=parseInt(_0x46d75b[_0x302a('0x62')][_0x302a('0x63')](0x0));var _0x4065fd=util[_0x302a('0x25')](_0x302a('0x64'),_0x4f4b95['remoteUri'],_0x3497cb['id']);if(_0x1a2b11>0x6){_0x4065fd=util['format'](_0x302a('0x72'),_0x4f4b95[_0x302a('0x54')],_0x3497cb['id']);}logger[_0x302a('0xa')](_0x302a('0x73'),_0x302a('0x65'));emit(util[_0x302a('0x25')](_0x302a('0x74'),_0x580935[_0x302a('0xc')]),_0x302a('0x66'),{'uri':_0x4065fd});})[_0x302a('0x67')](function(_0x19e3c4){logger[_0x302a('0x75')](_0x302a('0x73'),JSON['stringify'](_0x19e3c4));});};exports[_0x302a('0x76')]=function(_0x5ac5eb,_0x3bc939,_0x2b3ed6,_0x2d41fc,_0x4604ba,_0x42241e){var _0x24b2b4,_0x3756f5,_0x332f66,_0x5ed55b;_0x42241e[_0x302a('0x54')]=intUtil[_0x302a('0x55')](_0x42241e[_0x302a('0x54')]);_0x42241e[_0x302a('0x56')]=intUtil[_0x302a('0x55')](_0x42241e[_0x302a('0x56')]);def['uri']=util[_0x302a('0x25')](_0x302a('0x69'),_0x42241e[_0x302a('0x54')]);if(_0x4604ba&&_0x4604ba[_0x302a('0x58')]){logger['info']('['+_0x3bc939['lastevent'][_0x302a('0x77')]()+']',_0x302a('0x6c'));_0x3bc939[_0x302a('0x59')]=util[_0x302a('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42241e[_0x302a('0x56')],_0x3bc939[_0x302a('0x5b')],md5(_0x3bc939[_0x302a('0x5b')]));}else{_0x3bc939[_0x302a('0x59')]='';}return getConnection(_0x42241e)[_0x302a('0x2d')](function(_0x450401){_0x5ed55b=_0x450401;if(!_[_0x302a('0x78')](_0x2d41fc)){return getUser(_0x42241e,_0x2d41fc[_0x302a('0xc')],_0x5ed55b);}else{return getUser(_0x42241e,null,_0x5ed55b);}})[_0x302a('0x2d')](function(_0xd269bd){_0x24b2b4=_0xd269bd;logger['info']('The\x20User\x20ID\x20is:',_0x24b2b4['id']);return getEndUser(_0x42241e,_0x3bc939[_0x302a('0x79')],_0x3bc939[_0x302a('0x5c')],_0x5ed55b);})[_0x302a('0x2d')](function(_0x3608a0){_0x3756f5=_0x3608a0;logger[_0x302a('0xa')](_0x302a('0x5d'),_0x3756f5['id']);return getTicket(_0x42241e,_0x24b2b4,_0x3756f5,_0x2b3ed6,_0x3bc939,_0x2b3ed6[_0x302a('0x5e')],_0x5ed55b,'Inbound');})[_0x302a('0x2d')](function(_0x306599){_0x332f66=_0x306599;logger[_0x302a('0xa')](_0x302a('0x5f'));logger[_0x302a('0xa')](_0x302a('0x60'),_0x332f66['id']);return setRelationship(_0x5ed55b,_0x24b2b4,_0x332f66,_0x302a('0x71'));})[_0x302a('0x2d')](function(){return setRelationship(_0x5ed55b,_0x3756f5,_0x332f66,_0x302a('0x61'));})['then'](function(){return getServerInfo(_0x5ed55b);})[_0x302a('0x67')](function(_0x332835){logger['error']('['+_0x3bc939[_0x302a('0x7a')][_0x302a('0x77')]()+']',JSON['stringify'](_0x332835));});}; \ 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 3dd2803..7fa2d18 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 _0xf4ea=['getString','sortBy','length','type','string','push','variableName','toString','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','variable','customVariable','join','slice','substring','isNil','test','lodash','util'];(function(_0x31218c,_0x28ae34){var _0x13e4ab=function(_0x3e0521){while(--_0x3e0521){_0x31218c['push'](_0x31218c['shift']());}};_0x13e4ab(++_0x28ae34);}(_0xf4ea,0xad));var _0xaf4e=function(_0x169a8a,_0x3526b1){_0x169a8a=_0x169a8a-0x0;var _0x2e8502=_0xf4ea[_0x169a8a];return _0x2e8502;};'use strict';var _=require(_0xaf4e('0x0'));var util=require(_0xaf4e('0x1'));exports[_0xaf4e('0x2')]=function(_0x16e329,_0x4221dc,_0x17f4d9){var _0x464aed=[];if(_0x16e329['length']>0x0){var _0x427acc=_[_0xaf4e('0x3')](_0x16e329,['id']);for(var _0x8b0c7f=0x0;_0x8b0c7f<_0x427acc[_0xaf4e('0x4')];_0x8b0c7f++){var _0x3e5527=_0x427acc[_0x8b0c7f];if(_0x3e5527[_0xaf4e('0x5')]===_0xaf4e('0x6')){_0x464aed[_0xaf4e('0x7')](_0x3e5527['content']);}else if(_0x3e5527[_0xaf4e('0x5')]==='variable'&&_0x3e5527[_0xaf4e('0x8')]){_0x4221dc[_0x3e5527['variableName']]&&_0x464aed[_0xaf4e('0x7')](_0x4221dc[_0x3e5527['variableName']][_0xaf4e('0x9')]());}else if(_0x3e5527['type']==='customVariable'&&_0x3e5527['Variable']&&_0x3e5527[_0xaf4e('0xa')][_0xaf4e('0xb')]){_0x4221dc[_0x3e5527[_0xaf4e('0xa')][_0xaf4e('0xb')][_0xaf4e('0xc')]()]&&_0x464aed[_0xaf4e('0x7')](_0x4221dc[_0x3e5527[_0xaf4e('0xa')][_0xaf4e('0xb')][_0xaf4e('0xc')]()][_0xaf4e('0x9')]());}else if(_0x3e5527['type']==='keyValue'){if(_0x3e5527[_0xaf4e('0xd')]===_0xaf4e('0x6')&&_0x3e5527[_0xaf4e('0xe')]){_0x464aed[_0xaf4e('0x7')](util[_0xaf4e('0xf')](_0xaf4e('0x10'),_0x3e5527['key'],_0x3e5527[_0xaf4e('0x11')]));}else if(_0x3e5527[_0xaf4e('0xd')]===_0xaf4e('0x12')&&_0x3e5527[_0xaf4e('0x8')]&&_0x3e5527[_0xaf4e('0xe')]){_0x4221dc[_0x3e5527['variableName']]&&_0x464aed[_0xaf4e('0x7')](util[_0xaf4e('0xf')]('%s:\x20%s',_0x3e5527[_0xaf4e('0xe')],_0x4221dc[_0x3e5527[_0xaf4e('0x8')]]));}else if(_0x3e5527[_0xaf4e('0xd')]===_0xaf4e('0x13')&&_0x3e5527['Variable']&&_0x3e5527[_0xaf4e('0xa')][_0xaf4e('0xb')]&&_0x3e5527['key']){_0x4221dc[_0x3e5527[_0xaf4e('0xa')][_0xaf4e('0xb')][_0xaf4e('0xc')]()]&&_0x464aed[_0xaf4e('0x7')](util[_0xaf4e('0xf')](_0xaf4e('0x10'),_0x3e5527[_0xaf4e('0xe')],_0x4221dc[_0x3e5527[_0xaf4e('0xa')][_0xaf4e('0xb')][_0xaf4e('0xc')]()]));}}}}return _0x464aed[_0xaf4e('0x14')](_0x17f4d9);};exports['stripTrailingSlash']=function(_0x4648e9){var _0xc46fc5=_0x4648e9[_0xaf4e('0x15')](-0x1);if(_0xc46fc5==='/'){_0x4648e9=_0x4648e9[_0xaf4e('0x16')](0x0,_0x4648e9['lastIndexOf'](_0xc46fc5));}return _0x4648e9;};exports['validateEmail']=function(_0x36b9a4){if(!_[_0xaf4e('0x17')](_0x36b9a4)&&_0x36b9a4!==''){var _0x6641e4=/^(([^<>()\[\]\\.,;:\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 _0x6641e4[_0xaf4e('0x18')](String(_0x36b9a4)[_0xaf4e('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x11d2=['lodash','util','getString','sortBy','length','string','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test'];(function(_0xf5936,_0x5ddef2){var _0x124458=function(_0x1b03b){while(--_0x1b03b){_0xf5936['push'](_0xf5936['shift']());}};_0x124458(++_0x5ddef2);}(_0x11d2,0x134));var _0x211d=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x11d2[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x211d('0x0'));var util=require(_0x211d('0x1'));exports[_0x211d('0x2')]=function(_0xc9643c,_0x356f7b,_0x7e0795){var _0x23650c=[];if(_0xc9643c['length']>0x0){var _0xb2a4c1=_[_0x211d('0x3')](_0xc9643c,['id']);for(var _0x3e6579=0x0;_0x3e6579<_0xb2a4c1[_0x211d('0x4')];_0x3e6579++){var _0x892a7c=_0xb2a4c1[_0x3e6579];if(_0x892a7c['type']===_0x211d('0x5')){_0x23650c[_0x211d('0x6')](_0x892a7c['content']);}else if(_0x892a7c[_0x211d('0x7')]===_0x211d('0x8')&&_0x892a7c[_0x211d('0x9')]){_0x356f7b[_0x892a7c[_0x211d('0x9')]]&&_0x23650c['push'](_0x356f7b[_0x892a7c[_0x211d('0x9')]][_0x211d('0xa')]());}else if(_0x892a7c[_0x211d('0x7')]===_0x211d('0xb')&&_0x892a7c[_0x211d('0xc')]&&_0x892a7c[_0x211d('0xc')][_0x211d('0xd')]){_0x356f7b[_0x892a7c['Variable'][_0x211d('0xd')][_0x211d('0xe')]()]&&_0x23650c[_0x211d('0x6')](_0x356f7b[_0x892a7c[_0x211d('0xc')][_0x211d('0xd')][_0x211d('0xe')]()][_0x211d('0xa')]());}else if(_0x892a7c[_0x211d('0x7')]===_0x211d('0xf')){if(_0x892a7c[_0x211d('0x10')]===_0x211d('0x5')&&_0x892a7c[_0x211d('0x11')]){_0x23650c[_0x211d('0x6')](util[_0x211d('0x12')](_0x211d('0x13'),_0x892a7c[_0x211d('0x11')],_0x892a7c['keyContent']));}else if(_0x892a7c['keyType']===_0x211d('0x8')&&_0x892a7c[_0x211d('0x9')]&&_0x892a7c[_0x211d('0x11')]){_0x356f7b[_0x892a7c[_0x211d('0x9')]]&&_0x23650c[_0x211d('0x6')](util[_0x211d('0x12')](_0x211d('0x13'),_0x892a7c[_0x211d('0x11')],_0x356f7b[_0x892a7c[_0x211d('0x9')]]));}else if(_0x892a7c[_0x211d('0x10')]===_0x211d('0xb')&&_0x892a7c[_0x211d('0xc')]&&_0x892a7c[_0x211d('0xc')][_0x211d('0xd')]&&_0x892a7c[_0x211d('0x11')]){_0x356f7b[_0x892a7c[_0x211d('0xc')][_0x211d('0xd')][_0x211d('0xe')]()]&&_0x23650c['push'](util['format']('%s:\x20%s',_0x892a7c[_0x211d('0x11')],_0x356f7b[_0x892a7c['Variable'][_0x211d('0xd')][_0x211d('0xe')]()]));}}}}return _0x23650c[_0x211d('0x14')](_0x7e0795);};exports[_0x211d('0x15')]=function(_0x594e7d){var _0x179de4=_0x594e7d[_0x211d('0x16')](-0x1);if(_0x179de4==='/'){_0x594e7d=_0x594e7d[_0x211d('0x17')](0x0,_0x594e7d[_0x211d('0x18')](_0x179de4));}return _0x594e7d;};exports[_0x211d('0x19')]=function(_0x35552f){if(!_[_0x211d('0x1a')](_0x35552f)&&_0x35552f!==''){var _0x2e5bad=/^(([^<>()\[\]\\.,;:\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 _0x2e5bad[_0x211d('0x1b')](String(_0x35552f)[_0x211d('0xe')]());}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 38658e5..5a0bfab 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(_0x14fd55,_0x2c43d4){var _0x1bd36c=function(_0x55d543){while(--_0x55d543){_0x14fd55['push'](_0x14fd55['shift']());}};_0x1bd36c(++_0x2c43d4);}(_0xe706,0xa3));var _0x6e70=function(_0x3dca5f,_0x3bf609){_0x3dca5f=_0x3dca5f-0x0;var _0x2ad290=_0xe706[_0x3dca5f];return _0x2ad290;};'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(_0x45df98,_0x3384a4){var _0x2b1f91=function(_0x633b7e){while(--_0x633b7e){_0x45df98['push'](_0x45df98['shift']());}};_0x2b1f91(++_0x3384a4);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'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 68ed587..67533bb 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 _0x1d56=['%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','/api/v2','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','Authorization','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','remoteUri','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','first','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','type','customField','content','includes','string','picklist','idField','custom_fields','push','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...'];(function(_0x37b0af,_0x243091){var _0x719d71=function(_0x352295){while(--_0x352295){_0x37b0af['push'](_0x37b0af['shift']());}};_0x719d71(++_0x243091);}(_0x1d56,0x1db));var _0x61d5=function(_0x5a4b0d,_0x5c44f6){_0x5a4b0d=_0x5a4b0d-0x0;var _0x2e6e8b=_0x1d56[_0x5a4b0d];return _0x2e6e8b;};'use strict';var _=require(_0x61d5('0x0'));var rp=require(_0x61d5('0x1'));var md5=require(_0x61d5('0x2'));var util=require(_0x61d5('0x3'));var Redis=require('ioredis');var intUtil=require(_0x61d5('0x4'));var config=require(_0x61d5('0x5'));var logger=require(_0x61d5('0x6'))('zendesk');config[_0x61d5('0x7')]=_[_0x61d5('0x8')](config[_0x61d5('0x7')],{'host':_0x61d5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x61d5('0x7')]));function emit(_0x46151f,_0x16ae73,_0x52add1){io['to'](_0x46151f)[_0x61d5('0xa')](_0x16ae73,_0x52add1);}var headers={'Content-Type':'application/json','Accept':_0x61d5('0xb')};function getTicket(_0x2c6318,_0x1966e4,_0x54a443,_0x340d69,_0x291800){logger[_0x61d5('0xc')](_0x61d5('0xd'));return request({'uri':util[_0x61d5('0xe')](_0x61d5('0xf'),_0x2c6318['remoteUri']),'method':_0x61d5('0x10'),'body':{'ticket':_[_0x61d5('0x11')]({'requester_id':_0x54a443['id'],'submitter_id':_0x1966e4?_0x1966e4['id']:undefined,'assignee_id':_0x1966e4?_0x1966e4['id']:undefined,'tags':getTags(_0x340d69[_0x61d5('0x12')],_0x61d5('0x13')),'subject':intUtil['getString'](_0x340d69[_0x61d5('0x14')],_0x291800,'\x20'),'description':intUtil[_0x61d5('0x15')](_0x340d69[_0x61d5('0x16')],_0x291800,'\x0a'),'comment':{'public':![],'body':intUtil[_0x61d5('0x15')](_0x340d69[_0x61d5('0x16')],_0x291800,'\x0a')}},getCustomFields(_0x340d69[_0x61d5('0x17')],_0x291800))}})['then'](function(_0x2ba2d3){logger[_0x61d5('0xc')](_0x61d5('0x18'));return _0x2ba2d3[_0x61d5('0x19')];});}function getUser(_0x1cd244,_0x27139a){if(intUtil['validateEmail'](_0x27139a)){logger[_0x61d5('0xc')](_0x61d5('0x1a'),_0x27139a);return request({'uri':util[_0x61d5('0xe')](_0x61d5('0x1b'),_0x1cd244['remoteUri']),'qs':{'query':util[_0x61d5('0xe')](_0x61d5('0x1c'),_0x27139a)}})[_0x61d5('0x1d')](function(_0x3fe458){if(_0x3fe458[_0x61d5('0x1e')]){logger[_0x61d5('0xc')](_0x61d5('0x1f'));return _[_0x61d5('0x20')](_0x3fe458['results'],{'email':_0x27139a,'role':_0x61d5('0x21')});}else{logger[_0x61d5('0xc')](_0x61d5('0x22'));return request({'uri':util[_0x61d5('0xe')](_0x61d5('0x23'),_0x1cd244['remoteUri'])})[_0x61d5('0x1d')](function(_0xdaef5c){logger[_0x61d5('0xc')](_0x61d5('0x24'));return _0xdaef5c['user'];});}});}else{logger[_0x61d5('0xc')](_0x61d5('0x22'));return request({'uri':util['format'](_0x61d5('0x23'),_0x1cd244[_0x61d5('0x25')])})[_0x61d5('0x1d')](function(_0x3932c4){logger[_0x61d5('0xc')](_0x61d5('0x24'));return _0x3932c4[_0x61d5('0x26')];});}}function getEndUser(_0x175946,_0x483349,_0x55ca6e){logger[_0x61d5('0xc')](_0x61d5('0x27'),_0x55ca6e);return request({'uri':util['format'](_0x61d5('0x1b'),_0x175946['remoteUri']),'qs':{'query':util[_0x61d5('0xe')](_0x61d5('0x28'),_0x55ca6e)}})[_0x61d5('0x1d')](function(_0x528780){var _0x259880;if(_0x528780[_0x61d5('0x29')][_0x61d5('0x2a')]){_0x528780['results']=_[_0x61d5('0x2b')](_0x528780[_0x61d5('0x29')],{'suspended':![],'role':'end-user'});if(_0x528780['results'][_0x61d5('0x2a')]){_0x259880=_[_0x61d5('0x2c')](_0x528780[_0x61d5('0x29')]);}}if(_0x259880){logger[_0x61d5('0xc')]('Enduser\x20found!');return _0x259880;}else{logger[_0x61d5('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x61d5('0xe')](_0x61d5('0x2d'),_0x175946[_0x61d5('0x25')]),'method':_0x61d5('0x10'),'body':{'user':{'role':_0x61d5('0x2e'),'name':util[_0x61d5('0xe')](_0x61d5('0x2f'),_0x483349||_0x55ca6e),'phone':_0x55ca6e}}})[_0x61d5('0x1d')](function(_0x471866){logger[_0x61d5('0xc')](_0x61d5('0x30'));return _0x471866[_0x61d5('0x26')];});}});}function getAuth(_0x8a6012){var _0x58ce48;if(_0x8a6012[_0x61d5('0x31')]===_0x61d5('0x32')){_0x58ce48=util[_0x61d5('0xe')](_0x61d5('0x33'),_0x8a6012[_0x61d5('0x34')],_0x8a6012[_0x61d5('0x32')]);}else if(_0x8a6012[_0x61d5('0x31')]===_0x61d5('0x35')){_0x58ce48=util[_0x61d5('0xe')](_0x61d5('0x36'),_0x8a6012[_0x61d5('0x34')],_0x8a6012[_0x61d5('0x35')]);}return util[_0x61d5('0xe')](_0x61d5('0x37'),new Buffer(_0x58ce48)[_0x61d5('0x38')](_0x61d5('0x39')));}function request(_0x510fbf){logger['debug'](_0x61d5('0x3a'),JSON[_0x61d5('0x3b')](_0x510fbf));return rp(_[_0x61d5('0x8')](_0x510fbf,{'method':_0x61d5('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x26739b,_0x27e242){var _0x147752=[];if(_0x26739b&&_0x26739b['length']>0x0){_0x147752=_[_0x61d5('0x3d')](_0x26739b,_0x27e242);}return _0x147752;}function getCustomFields(_0xe2c6d6,_0x3db98a){var _0x37ef65=[];var _0x54723c={'custom_fields':[]};if(_0xe2c6d6[_0x61d5('0x2a')]>0x0){_['forEach'](_0xe2c6d6,function(_0x1c47e4){if(_['includes'](['string','picklist'],_0x1c47e4[_0x61d5('0x3e')])&&_0x1c47e4['nameField']&&!_0x1c47e4[_0x61d5('0x3f')]){_0x54723c[_0x1c47e4['nameField']['toLowerCase']()]=_0x1c47e4[_0x61d5('0x40')][_0x61d5('0x38')]();}else if(_[_0x61d5('0x41')]([_0x61d5('0x42'),_0x61d5('0x43')],_0x1c47e4['type'])&&_0x1c47e4[_0x61d5('0x44')]&&_0x1c47e4[_0x61d5('0x3f')]){_0x54723c[_0x61d5('0x45')][_0x61d5('0x46')]({'id':_0x1c47e4['idField'],'value':_0x1c47e4[_0x61d5('0x40')][_0x61d5('0x38')]()});}else if(_0x1c47e4['type']===_0x61d5('0x47')&&_0x1c47e4[_0x61d5('0x48')]&&_0x1c47e4['idField']&&_0x1c47e4['customField']){_0x3db98a[_0x1c47e4[_0x61d5('0x48')]]&&_0x54723c['custom_fields'][_0x61d5('0x46')]({'id':_0x1c47e4[_0x61d5('0x44')],'value':_0x3db98a[_0x1c47e4[_0x61d5('0x48')]][_0x61d5('0x38')]()});}else if(_0x1c47e4['type']==='customVariable'&&_0x1c47e4['Variable']&&_0x1c47e4['Variable']['name']&&_0x1c47e4['idField']&&_0x1c47e4['customField']){_0x3db98a[_0x1c47e4[_0x61d5('0x49')][_0x61d5('0x13')][_0x61d5('0x4a')]()]&&_0x54723c[_0x61d5('0x45')]['push']({'id':_0x1c47e4[_0x61d5('0x44')],'value':_0x3db98a[_0x1c47e4[_0x61d5('0x49')][_0x61d5('0x13')][_0x61d5('0x4a')]()][_0x61d5('0x38')]()});}});}return _0x54723c;}exports[_0x61d5('0x4b')]=function(_0x29d952,_0x248196,_0x5e4282,_0x47e85c,_0x3326b1,_0x17a424){var _0x2c4e18,_0x5f0586;_0x17a424[_0x61d5('0x25')]=intUtil[_0x61d5('0x4c')](_0x17a424[_0x61d5('0x25')]);_0x17a424[_0x61d5('0x4d')]=intUtil['stripTrailingSlash'](_0x17a424[_0x61d5('0x4d')]);if(_0x3326b1&&_0x3326b1[_0x61d5('0x4e')]){logger[_0x61d5('0xc')](_0x61d5('0x4f'),_0x61d5('0x50'));_0x248196['recordingURL']=util[_0x61d5('0xe')](_0x61d5('0x51'),_0x17a424['serverUrl'],_0x248196['uniqueid'],md5(_0x248196[_0x61d5('0x52')]));}else{_0x248196[_0x61d5('0x53')]='';}headers['Authorization']=getAuth(_0x17a424);return getUser(_0x17a424,_0x47e85c[_0x61d5('0x54')])[_0x61d5('0x1d')](function(_0x3edfca){_0x2c4e18=_0x3edfca;logger['info'](_0x61d5('0x55'),_0x2c4e18['id']);return getEndUser(_0x17a424,_0x248196['calleridname'],_0x248196[_0x61d5('0x56')]);})[_0x61d5('0x1d')](function(_0x2b5478){_0x5f0586=_0x2b5478;logger[_0x61d5('0xc')](_0x61d5('0x57'),_0x5f0586['id']);return getTicket(_0x17a424,_0x2c4e18,_0x5f0586,_0x5e4282,_0x248196);})[_0x61d5('0x1d')](function(_0x2398d4){if(_0x2398d4){logger[_0x61d5('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2398d4['id']);switch(_0x17a424[_0x61d5('0x3e')]){case _0x61d5('0x58'):logger[_0x61d5('0xc')](_0x61d5('0x4f'),_0x61d5('0x59'));return request({'uri':util[_0x61d5('0xe')](_0x61d5('0x5a'),_0x17a424[_0x61d5('0x25')],_0x2c4e18['id'],_0x2398d4['id']),'method':_0x61d5('0x10')});case _0x61d5('0x5b'):logger[_0x61d5('0xc')](_0x61d5('0x4f'),_0x61d5('0x5c'));emit(util[_0x61d5('0xe')](_0x61d5('0x5d'),_0x47e85c[_0x61d5('0x13')]),_0x61d5('0x5e'),{'uri':util['format']('%s/agent/tickets/%s',_0x17a424[_0x61d5('0x25')]['replace']('/api/v2',''),_0x2398d4['id'])});break;default:logger[_0x61d5('0x5f')](_0x61d5('0x4f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x111176){logger['error'](_0x61d5('0x60'),util[_0x61d5('0x61')](_0x111176,{'showHidden':!![],'depth':null}));});};exports[_0x61d5('0x62')]=function(_0x1d654f,_0x4ec7de,_0x36e4d0,_0x4897ae,_0x23d98f,_0x4df692,_0x3e093f){var _0x5dabd2,_0xa0f65;_0x4df692[_0x61d5('0x25')]=intUtil[_0x61d5('0x4c')](_0x4df692[_0x61d5('0x25')]);_0x4df692['serverUrl']=intUtil[_0x61d5('0x4c')](_0x4df692['serverUrl']);if(_0x3e093f&&_0x3e093f[_0x61d5('0x63')]&&_0x3e093f[_0x61d5('0x63')]!==_0x61d5('0x64')){logger[_0x61d5('0xc')](_0x61d5('0x65'),'Recording\x20is\x20enabled!');_0x4ec7de['recordingURL']=util[_0x61d5('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4df692[_0x61d5('0x4d')],_0x4ec7de[_0x61d5('0x52')],md5(_0x4ec7de[_0x61d5('0x52')]));}headers['Authorization']=getAuth(_0x4df692);return getUser(_0x4df692,_0x4897ae[_0x61d5('0x54')])[_0x61d5('0x1d')](function(_0x58e9c3){_0x5dabd2=_0x58e9c3;logger['info'](_0x61d5('0x55'),_0x5dabd2['id']);return getEndUser(_0x4df692,_0x4ec7de[_0x61d5('0x66')],_0x4ec7de[_0x61d5('0x67')]);})[_0x61d5('0x1d')](function(_0x5c0c5d){_0xa0f65=_0x5c0c5d;logger[_0x61d5('0xc')]('The\x20Enduser\x20ID\x20is:',_0xa0f65['id']);return getTicket(_0x4df692,_0x5dabd2,_0xa0f65,_0x36e4d0,_0x4ec7de);})['then'](function(_0x559c21){if(_0x559c21){logger[_0x61d5('0xc')]('The\x20Ticket\x20ID\x20is:',_0x559c21['id']);switch(_0x4df692[_0x61d5('0x3e')]){case'integrationTab':logger['info'](_0x61d5('0x65'),_0x61d5('0x59'));return request({'uri':util[_0x61d5('0xe')](_0x61d5('0x5a'),_0x4df692[_0x61d5('0x25')],_0x5dabd2['id'],_0x559c21['id']),'method':_0x61d5('0x10')});case _0x61d5('0x5b'):logger['info'](_0x61d5('0x65'),_0x61d5('0x5c'));emit(util['format'](_0x61d5('0x5d'),_0x4897ae[_0x61d5('0x13')]),_0x61d5('0x5e'),{'uri':util[_0x61d5('0xe')]('%s/agent/tickets/%s',_0x4df692[_0x61d5('0x25')]['replace'](_0x61d5('0x68'),''),_0x559c21['id'])});break;default:logger[_0x61d5('0x5f')](_0x61d5('0x65'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x61d5('0x69')](function(_0xf28033){logger[_0x61d5('0x5f')](_0x61d5('0x6a'),util[_0x61d5('0x61')](_0xf28033,{'showHidden':!![],'depth':null}));});};exports[_0x61d5('0x6b')]=function(_0x8d2ecc,_0xccf0ba,_0x1eebad,_0x19806b,_0x34df65,_0x1315d4){var _0x34d30c,_0x33b15a;_0x1315d4[_0x61d5('0x25')]=intUtil[_0x61d5('0x4c')](_0x1315d4[_0x61d5('0x25')]);_0x1315d4[_0x61d5('0x4d')]=intUtil[_0x61d5('0x4c')](_0x1315d4[_0x61d5('0x4d')]);if(_0x34df65&&_0x34df65[_0x61d5('0x4e')]){logger[_0x61d5('0xc')]('['+_0xccf0ba['lastevent'][_0x61d5('0x6c')]()+']',_0x61d5('0x50'));_0xccf0ba[_0x61d5('0x53')]=util[_0x61d5('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1315d4['serverUrl'],_0xccf0ba['uniqueid'],md5(_0xccf0ba[_0x61d5('0x52')]));}else{_0xccf0ba['recordingURL']='';}headers[_0x61d5('0x6d')]=getAuth(_0x1315d4);return getUser(_0x1315d4)[_0x61d5('0x1d')](function(_0x1dd4ba){_0x34d30c=_0x1dd4ba;logger[_0x61d5('0xc')](_0x61d5('0x55'),_0x34d30c['id']);return getEndUser(_0x1315d4,_0xccf0ba[_0x61d5('0x6e')],_0xccf0ba[_0x61d5('0x56')]);})[_0x61d5('0x1d')](function(_0x81cc7a){_0x33b15a=_0x81cc7a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x33b15a['id']);return getTicket(_0x1315d4,_0x34d30c,_0x33b15a,_0x1eebad,_0xccf0ba);})['then'](function(_0x2c3938){if(_0x2c3938){logger['info']('The\x20Ticket\x20ID\x20is:',_0x2c3938['id']);}})[_0x61d5('0x69')](function(_0x435c13){logger[_0x61d5('0x5f')]('['+_0xccf0ba[_0x61d5('0x6f')][_0x61d5('0x6c')]()+']'+_0x61d5('0x70'),util['inspect'](_0x435c13,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xec3e=['toString','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','customField','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','inspect','recordingFormat','none','[OUTBOUND]','destcalleridnum','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','format','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','authType','password','%s:%s','username','token','%s/token:%s','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','nameField','toLowerCase','content'];(function(_0x5d5e3b,_0xc516c3){var _0x4d559d=function(_0x3a25ed){while(--_0x3a25ed){_0x5d5e3b['push'](_0x5d5e3b['shift']());}};_0x4d559d(++_0xc516c3);}(_0xec3e,0x10b));var _0xeec3=function(_0x6fa273,_0x4e46d8){_0x6fa273=_0x6fa273-0x0;var _0x9acc8b=_0xec3e[_0x6fa273];return _0x9acc8b;};'use strict';var _=require(_0xeec3('0x0'));var rp=require(_0xeec3('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xeec3('0x2'));var intUtil=require(_0xeec3('0x3'));var config=require(_0xeec3('0x4'));var logger=require(_0xeec3('0x5'))(_0xeec3('0x6'));config['redis']=_[_0xeec3('0x7')](config[_0xeec3('0x8')],{'host':_0xeec3('0x9'),'port':0x18eb});var io=require(_0xeec3('0xa'))(new Redis(config[_0xeec3('0x8')]));function emit(_0x342b4f,_0x26a024,_0x181ec6){io['to'](_0x342b4f)[_0xeec3('0xb')](_0x26a024,_0x181ec6);}var headers={'Content-Type':_0xeec3('0xc'),'Accept':_0xeec3('0xc')};function getTicket(_0x3b6a60,_0x383d00,_0x3b6370,_0x37bc12,_0x5c33e0){logger[_0xeec3('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xeec3('0xe')]('%s/tickets.json',_0x3b6a60['remoteUri']),'method':_0xeec3('0xf'),'body':{'ticket':_[_0xeec3('0x10')]({'requester_id':_0x3b6370['id'],'submitter_id':_0x383d00?_0x383d00['id']:undefined,'assignee_id':_0x383d00?_0x383d00['id']:undefined,'tags':getTags(_0x37bc12[_0xeec3('0x11')],'name'),'subject':intUtil[_0xeec3('0x12')](_0x37bc12[_0xeec3('0x13')],_0x5c33e0,'\x20'),'description':intUtil[_0xeec3('0x12')](_0x37bc12[_0xeec3('0x14')],_0x5c33e0,'\x0a'),'comment':{'public':![],'body':intUtil[_0xeec3('0x12')](_0x37bc12[_0xeec3('0x14')],_0x5c33e0,'\x0a')}},getCustomFields(_0x37bc12[_0xeec3('0x15')],_0x5c33e0))}})[_0xeec3('0x16')](function(_0x263de7){logger[_0xeec3('0xd')](_0xeec3('0x17'));return _0x263de7[_0xeec3('0x18')];});}function getUser(_0x9211e6,_0x148481){if(intUtil[_0xeec3('0x19')](_0x148481)){logger['info'](_0xeec3('0x1a'),_0x148481);return request({'uri':util['format'](_0xeec3('0x1b'),_0x9211e6[_0xeec3('0x1c')]),'qs':{'query':util[_0xeec3('0xe')](_0xeec3('0x1d'),_0x148481)}})[_0xeec3('0x16')](function(_0x4e5ef2){if(_0x4e5ef2[_0xeec3('0x1e')]){logger[_0xeec3('0xd')]('Agent\x20found!');return _[_0xeec3('0x1f')](_0x4e5ef2[_0xeec3('0x20')],{'email':_0x148481,'role':_0xeec3('0x21')});}else{logger[_0xeec3('0xd')](_0xeec3('0x22'));return request({'uri':util[_0xeec3('0xe')](_0xeec3('0x23'),_0x9211e6[_0xeec3('0x1c')])})[_0xeec3('0x16')](function(_0x158166){logger[_0xeec3('0xd')](_0xeec3('0x24'));return _0x158166['user'];});}});}else{logger[_0xeec3('0xd')](_0xeec3('0x22'));return request({'uri':util[_0xeec3('0xe')](_0xeec3('0x23'),_0x9211e6[_0xeec3('0x1c')])})[_0xeec3('0x16')](function(_0x161440){logger[_0xeec3('0xd')](_0xeec3('0x24'));return _0x161440[_0xeec3('0x25')];});}}function getEndUser(_0x1a2968,_0x548b8d,_0xcb63ce){logger['info'](_0xeec3('0x26'),_0xcb63ce);return request({'uri':util['format'](_0xeec3('0x1b'),_0x1a2968['remoteUri']),'qs':{'query':util['format'](_0xeec3('0x27'),_0xcb63ce)}})[_0xeec3('0x16')](function(_0x4be0bb){var _0x59fd75;if(_0x4be0bb[_0xeec3('0x20')][_0xeec3('0x28')]){_0x4be0bb[_0xeec3('0x20')]=_['filter'](_0x4be0bb[_0xeec3('0x20')],{'suspended':![],'role':'end-user'});if(_0x4be0bb[_0xeec3('0x20')][_0xeec3('0x28')]){_0x59fd75=_[_0xeec3('0x29')](_0x4be0bb['results']);}}if(_0x59fd75){logger[_0xeec3('0xd')]('Enduser\x20found!');return _0x59fd75;}else{logger[_0xeec3('0xd')](_0xeec3('0x2a'));return request({'uri':util[_0xeec3('0xe')](_0xeec3('0x2b'),_0x1a2968[_0xeec3('0x1c')]),'method':_0xeec3('0xf'),'body':{'user':{'role':_0xeec3('0x2c'),'name':util[_0xeec3('0xe')]('Caller\x20-\x20%s',_0x548b8d||_0xcb63ce),'phone':_0xcb63ce}}})[_0xeec3('0x16')](function(_0xfd073b){logger['info']('Enduser\x20created.');return _0xfd073b[_0xeec3('0x25')];});}});}function getAuth(_0x1c7ad7){var _0x174e6e;if(_0x1c7ad7[_0xeec3('0x2d')]===_0xeec3('0x2e')){_0x174e6e=util[_0xeec3('0xe')](_0xeec3('0x2f'),_0x1c7ad7[_0xeec3('0x30')],_0x1c7ad7[_0xeec3('0x2e')]);}else if(_0x1c7ad7[_0xeec3('0x2d')]===_0xeec3('0x31')){_0x174e6e=util['format'](_0xeec3('0x32'),_0x1c7ad7[_0xeec3('0x30')],_0x1c7ad7['token']);}return util['format']('Basic\x20%s',new Buffer(_0x174e6e)['toString'](_0xeec3('0x33')));}function request(_0x48a62c){logger[_0xeec3('0x34')](_0xeec3('0x35'),JSON[_0xeec3('0x36')](_0x48a62c));return rp(_[_0xeec3('0x7')](_0x48a62c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x51b1f5,_0x45b603){var _0x234039=[];if(_0x51b1f5&&_0x51b1f5[_0xeec3('0x28')]>0x0){_0x234039=_[_0xeec3('0x37')](_0x51b1f5,_0x45b603);}return _0x234039;}function getCustomFields(_0x147968,_0x54e312){var _0x58b2a8=[];var _0x962d15={'custom_fields':[]};if(_0x147968['length']>0x0){_[_0xeec3('0x38')](_0x147968,function(_0x2012d1){if(_[_0xeec3('0x39')]([_0xeec3('0x3a'),_0xeec3('0x3b')],_0x2012d1['type'])&&_0x2012d1[_0xeec3('0x3c')]&&!_0x2012d1['customField']){_0x962d15[_0x2012d1[_0xeec3('0x3c')][_0xeec3('0x3d')]()]=_0x2012d1[_0xeec3('0x3e')][_0xeec3('0x3f')]();}else if(_['includes']([_0xeec3('0x3a'),_0xeec3('0x3b')],_0x2012d1[_0xeec3('0x40')])&&_0x2012d1[_0xeec3('0x41')]&&_0x2012d1['customField']){_0x962d15[_0xeec3('0x42')][_0xeec3('0x43')]({'id':_0x2012d1['idField'],'value':_0x2012d1['content'][_0xeec3('0x3f')]()});}else if(_0x2012d1[_0xeec3('0x40')]===_0xeec3('0x44')&&_0x2012d1[_0xeec3('0x45')]&&_0x2012d1[_0xeec3('0x41')]&&_0x2012d1['customField']){_0x54e312[_0x2012d1['variableName']]&&_0x962d15[_0xeec3('0x42')][_0xeec3('0x43')]({'id':_0x2012d1[_0xeec3('0x41')],'value':_0x54e312[_0x2012d1[_0xeec3('0x45')]][_0xeec3('0x3f')]()});}else if(_0x2012d1[_0xeec3('0x40')]===_0xeec3('0x46')&&_0x2012d1[_0xeec3('0x47')]&&_0x2012d1[_0xeec3('0x47')][_0xeec3('0x48')]&&_0x2012d1[_0xeec3('0x41')]&&_0x2012d1[_0xeec3('0x49')]){_0x54e312[_0x2012d1['Variable']['name'][_0xeec3('0x3d')]()]&&_0x962d15['custom_fields'][_0xeec3('0x43')]({'id':_0x2012d1[_0xeec3('0x41')],'value':_0x54e312[_0x2012d1[_0xeec3('0x47')][_0xeec3('0x48')][_0xeec3('0x3d')]()][_0xeec3('0x3f')]()});}});}return _0x962d15;}exports[_0xeec3('0x4a')]=function(_0xf7bd48,_0x1a6f35,_0x15195e,_0x15c072,_0x4fdcd9,_0x22bb76){var _0x1ad5f7,_0x4dcf68;_0x22bb76[_0xeec3('0x1c')]=intUtil[_0xeec3('0x4b')](_0x22bb76[_0xeec3('0x1c')]);_0x22bb76[_0xeec3('0x4c')]=intUtil[_0xeec3('0x4b')](_0x22bb76[_0xeec3('0x4c')]);if(_0x4fdcd9&&_0x4fdcd9['monitor_format']){logger[_0xeec3('0xd')](_0xeec3('0x4d'),_0xeec3('0x4e'));_0x1a6f35[_0xeec3('0x4f')]=util[_0xeec3('0xe')](_0xeec3('0x50'),_0x22bb76[_0xeec3('0x4c')],_0x1a6f35[_0xeec3('0x51')],md5(_0x1a6f35[_0xeec3('0x51')]));}else{_0x1a6f35[_0xeec3('0x4f')]='';}headers[_0xeec3('0x52')]=getAuth(_0x22bb76);return getUser(_0x22bb76,_0x15c072[_0xeec3('0x53')])[_0xeec3('0x16')](function(_0x3d1b8e){_0x1ad5f7=_0x3d1b8e;logger[_0xeec3('0xd')](_0xeec3('0x54'),_0x1ad5f7['id']);return getEndUser(_0x22bb76,_0x1a6f35[_0xeec3('0x55')],_0x1a6f35[_0xeec3('0x56')]);})[_0xeec3('0x16')](function(_0x130fd8){_0x4dcf68=_0x130fd8;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4dcf68['id']);return getTicket(_0x22bb76,_0x1ad5f7,_0x4dcf68,_0x15195e,_0x1a6f35);})['then'](function(_0x2b4807){if(_0x2b4807){logger[_0xeec3('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2b4807['id']);switch(_0x22bb76[_0xeec3('0x40')]){case'integrationTab':logger[_0xeec3('0xd')]('[QUEUE]',_0xeec3('0x57'));return request({'uri':util['format'](_0xeec3('0x58'),_0x22bb76[_0xeec3('0x1c')],_0x1ad5f7['id'],_0x2b4807['id']),'method':'POST'});case'newTab':logger['info'](_0xeec3('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xeec3('0xe')](_0xeec3('0x59'),_0x15c072[_0xeec3('0x48')]),_0xeec3('0x5a'),{'uri':util[_0xeec3('0xe')](_0xeec3('0x5b'),_0x22bb76[_0xeec3('0x1c')]['replace'](_0xeec3('0x5c'),''),_0x2b4807['id'])});break;default:logger[_0xeec3('0x5d')](_0xeec3('0x4d'),_0xeec3('0x5e'));}}})['catch'](function(_0x5c9d02){logger[_0xeec3('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xeec3('0x5f')](_0x5c9d02,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x2145d1,_0x5bcb9f,_0x1a1b55,_0x133512,_0x32468d,_0x3346d7,_0x2a4370){var _0x1c1a46,_0x513a28;_0x3346d7[_0xeec3('0x1c')]=intUtil[_0xeec3('0x4b')](_0x3346d7['remoteUri']);_0x3346d7[_0xeec3('0x4c')]=intUtil[_0xeec3('0x4b')](_0x3346d7['serverUrl']);if(_0x2a4370&&_0x2a4370[_0xeec3('0x60')]&&_0x2a4370[_0xeec3('0x60')]!==_0xeec3('0x61')){logger[_0xeec3('0xd')](_0xeec3('0x62'),'Recording\x20is\x20enabled!');_0x5bcb9f[_0xeec3('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3346d7[_0xeec3('0x4c')],_0x5bcb9f['uniqueid'],md5(_0x5bcb9f['uniqueid']));}headers[_0xeec3('0x52')]=getAuth(_0x3346d7);return getUser(_0x3346d7,_0x133512[_0xeec3('0x53')])['then'](function(_0x402977){_0x1c1a46=_0x402977;logger[_0xeec3('0xd')](_0xeec3('0x54'),_0x1c1a46['id']);return getEndUser(_0x3346d7,_0x5bcb9f['destcalleridname'],_0x5bcb9f[_0xeec3('0x63')]);})[_0xeec3('0x16')](function(_0x21866a){_0x513a28=_0x21866a;logger[_0xeec3('0xd')]('The\x20Enduser\x20ID\x20is:',_0x513a28['id']);return getTicket(_0x3346d7,_0x1c1a46,_0x513a28,_0x1a1b55,_0x5bcb9f);})['then'](function(_0x440cb4){if(_0x440cb4){logger['info']('The\x20Ticket\x20ID\x20is:',_0x440cb4['id']);switch(_0x3346d7['type']){case _0xeec3('0x64'):logger[_0xeec3('0xd')](_0xeec3('0x62'),_0xeec3('0x57'));return request({'uri':util['format'](_0xeec3('0x58'),_0x3346d7[_0xeec3('0x1c')],_0x1c1a46['id'],_0x440cb4['id']),'method':_0xeec3('0xf')});case _0xeec3('0x65'):logger[_0xeec3('0xd')](_0xeec3('0x62'),_0xeec3('0x66'));emit(util[_0xeec3('0xe')](_0xeec3('0x59'),_0x133512['name']),'trigger:browser:url',{'uri':util[_0xeec3('0xe')](_0xeec3('0x5b'),_0x3346d7[_0xeec3('0x1c')][_0xeec3('0x67')]('/api/v2',''),_0x440cb4['id'])});break;default:logger[_0xeec3('0x5d')](_0xeec3('0x62'),_0xeec3('0x5e'));}}})[_0xeec3('0x68')](function(_0x1b9d14){logger[_0xeec3('0x5d')](_0xeec3('0x69'),util[_0xeec3('0x5f')](_0x1b9d14,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x423cfe,_0x1bde34,_0xbc6668,_0x2907d0,_0x20e205,_0x8fc2ea){var _0x694b5c,_0x242cdd;_0x8fc2ea['remoteUri']=intUtil['stripTrailingSlash'](_0x8fc2ea[_0xeec3('0x1c')]);_0x8fc2ea[_0xeec3('0x4c')]=intUtil[_0xeec3('0x4b')](_0x8fc2ea[_0xeec3('0x4c')]);if(_0x20e205&&_0x20e205[_0xeec3('0x6a')]){logger[_0xeec3('0xd')]('['+_0x1bde34[_0xeec3('0x6b')]['toUpperCase']()+']',_0xeec3('0x4e'));_0x1bde34['recordingURL']=util[_0xeec3('0xe')](_0xeec3('0x50'),_0x8fc2ea[_0xeec3('0x4c')],_0x1bde34[_0xeec3('0x51')],md5(_0x1bde34[_0xeec3('0x51')]));}else{_0x1bde34[_0xeec3('0x4f')]='';}headers[_0xeec3('0x52')]=getAuth(_0x8fc2ea);return getUser(_0x8fc2ea)[_0xeec3('0x16')](function(_0x305abf){_0x694b5c=_0x305abf;logger[_0xeec3('0xd')](_0xeec3('0x54'),_0x694b5c['id']);return getEndUser(_0x8fc2ea,_0x1bde34['calleridname'],_0x1bde34['calleridnum']);})['then'](function(_0x444839){_0x242cdd=_0x444839;logger['info']('The\x20Enduser\x20ID\x20is:',_0x242cdd['id']);return getTicket(_0x8fc2ea,_0x694b5c,_0x242cdd,_0xbc6668,_0x1bde34);})['then'](function(_0x3fc428){if(_0x3fc428){logger[_0xeec3('0xd')](_0xeec3('0x6c'),_0x3fc428['id']);}})[_0xeec3('0x68')](function(_0x1d6865){logger[_0xeec3('0x5d')]('['+_0x1bde34[_0xeec3('0x6b')]['toUpperCase']()+']'+_0xeec3('0x6d'),util['inspect'](_0x1d6865,{'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 13f473c..0f1617a 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 _0x8ea9=['Inbound','merge','/crm/v2/Calls','err','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','outbound','recordingFormat','[OUTBOUND]','zoho.eu','destcalleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','request-promise','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','defaults','emit','[HTTP]','stringify','length','string','picklist','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','endtime','YYYY-MM-DDTHH:mm:ss','mm:ss','called','Call_Result','Called','complete','connect','Answered','Rejected','Abandoned','timeout','Timeout','starttime','agentcalledAt'];(function(_0x45ce18,_0x280311){var _0xd5ca1d=function(_0xe3e48f){while(--_0xe3e48f){_0x45ce18['push'](_0x45ce18['shift']());}};_0xd5ca1d(++_0x280311);}(_0x8ea9,0xb3));var _0x98ea=function(_0x1ddf30,_0x760a24){_0x1ddf30=_0x1ddf30-0x0;var _0x38a14d=_0x8ea9[_0x1ddf30];return _0x38a14d;};'use strict';var _=require(_0x98ea('0x0'));var rp=require(_0x98ea('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x98ea('0x2'));var moment=require(_0x98ea('0x3'));var Redis=require(_0x98ea('0x4'));var BPromise=require(_0x98ea('0x5'));var config=require('../../../../config/environment');var logger=require(_0x98ea('0x6'))(_0x98ea('0x7'));config['redis']=_[_0x98ea('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4ec02a,_0x1dd9e7,_0x3452b4){io['to'](_0x4ec02a)[_0x98ea('0x9')](_0x1dd9e7,_0x3452b4);}function request(_0x2fb1c3){logger['debug'](_0x98ea('0xa'),JSON[_0x98ea('0xb')](_0x2fb1c3));return rp(_0x2fb1c3);}function getCustomFields(_0x18c3ca,_0x1cc433){var _0x5392c7={};if(_0x18c3ca[_0x98ea('0xc')]>0x0){_['forEach'](_0x18c3ca,function(_0x2efc75){if(_['includes']([_0x98ea('0xd'),_0x98ea('0xe')],_0x2efc75[_0x98ea('0xf')])&&_0x2efc75[_0x98ea('0x10')]){_0x5392c7[_0x2efc75[_0x98ea('0x10')]]=_0x2efc75[_0x98ea('0x11')]['toString']();}else if(_0x2efc75[_0x98ea('0xf')]===_0x98ea('0x12')&&_0x2efc75[_0x98ea('0x13')]&&_0x2efc75['idField']&&_0x1cc433[_0x2efc75[_0x98ea('0x13')]]){_0x5392c7[_0x2efc75['idField']]=_0x1cc433[_0x2efc75[_0x98ea('0x13')]][_0x98ea('0x14')]();}else if(_0x2efc75[_0x98ea('0xf')]==='customVariable'&&_0x2efc75[_0x98ea('0x15')]&&_0x2efc75[_0x98ea('0x15')][_0x98ea('0x16')]&&_0x2efc75[_0x98ea('0x10')]&&_0x1cc433[_0x2efc75['Variable'][_0x98ea('0x16')][_0x98ea('0x17')]()]){_0x5392c7[_0x2efc75[_0x98ea('0x10')]]=_0x1cc433[_0x2efc75[_0x98ea('0x15')][_0x98ea('0x16')][_0x98ea('0x17')]()]['toString']();}});}return _0x5392c7;}function getName(_0x251746){if(_0x251746[_0x98ea('0x18')]('\x20')>0x0){var _0x25f26a=_0x251746[_0x98ea('0x19')](/ (.+)/);if(_0x25f26a[0x1]){return _0x25f26a;}}return[_0x251746,_0x251746];}var accountsTokens={};function getAccessToken(_0x5e0c46){return new Promise(function(_0x3420df,_0x46792b){if(!_[_0x98ea('0x1a')](accountsTokens[_0x5e0c46['id']])&&!_[_0x98ea('0x1a')](accountsTokens[_0x5e0c46['id']][_0x98ea('0x1b')])){if(moment()[_0x98ea('0x1c')](accountsTokens[_0x5e0c46['id']][_0x98ea('0x1d')])){_0x3420df(accountsTokens[_0x5e0c46['id']][_0x98ea('0x1b')]);}}var _0x4f6672;switch(_0x5e0c46[_0x98ea('0x1e')]){case'US':_0x4f6672=_0x98ea('0x1f');break;case'AU':_0x4f6672=_0x98ea('0x20');break;case'EU':_0x4f6672=_0x98ea('0x21');break;case'IN':_0x4f6672=_0x98ea('0x22');break;case'CN':_0x4f6672=_0x98ea('0x23');break;default:_0x4f6672=_0x98ea('0x21');break;}var _0x3884af={'method':_0x98ea('0x24'),'uri':_0x4f6672+_0x98ea('0x25'),'qs':{'refresh_token':_0x5e0c46[_0x98ea('0x26')],'client_id':_0x5e0c46[_0x98ea('0x27')],'client_secret':_0x5e0c46[_0x98ea('0x28')],'grant_type':_0x98ea('0x29')},'json':!![]};return rp(_0x3884af)[_0x98ea('0x2a')](function(_0x3c9c0f){accountsTokens[_0x5e0c46['id']]={'access_token':_0x3c9c0f['access_token'],'expires_in':moment()[_0x98ea('0x2b')](_0x3c9c0f[_0x98ea('0x1d')],'seconds')};_0x3420df(_0x3c9c0f[_0x98ea('0x1b')]);})[_0x98ea('0x2c')](function(_0x19b407){logger[_0x98ea('0x2d')](_0x98ea('0x2e'),_0x19b407[_0x98ea('0x2f')]);_0x46792b(_0x19b407);});});}function getUser(_0x1328d3,_0x30a27d,_0x588d14,_0x47c7c3){logger[_0x98ea('0x30')]('Search\x20user');return request({'method':_0x98ea('0x31'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x30a27d),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x98ea('0x32')+_0x1328d3},'json':!![]})['then'](function(_0x824f72){if(_0x824f72[_0x98ea('0x33')]){var _0x157e20=-0x1;if(_[_0x98ea('0x34')](_0x824f72[_0x98ea('0x33')])){if(!_[_0x98ea('0x1a')](_0x47c7c3)){_0x157e20=_[_0x98ea('0x35')](_0x824f72[_0x98ea('0x33')],function(_0x28599a){return _0x28599a[_0x98ea('0x36')]===_0x47c7c3;});}if(_0x157e20>=0x0){logger[_0x98ea('0x30')](_0x98ea('0x37'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x157e20=_['findIndex'](_0x824f72['users'],function(_0xb15a8a){return _0xb15a8a[_0x98ea('0x38')][_0x98ea('0x16')]===_0x98ea('0x39');});}return _0x824f72[_0x98ea('0x33')][_0x157e20];}else{if(_0x824f72[_0x98ea('0x3a')][_0x98ea('0x38')][_0x98ea('0x16')]===_0x98ea('0x39')){logger[_0x98ea('0x30')](_0x98ea('0x3b'));user=_0x824f72[_0x98ea('0x3a')];return user;}else{logger[_0x98ea('0x2d')](_0x98ea('0x3c'),JSON[_0x98ea('0xb')](_0x824f72));throw new Error(_0x98ea('0x3d')+JSON['stringify'](_0x824f72));}}}else{logger[_0x98ea('0x2d')](_0x98ea('0x3c'),JSON[_0x98ea('0xb')](_0x824f72));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x824f72));}})[_0x98ea('0x2c')](function(_0x34723f){console[_0x98ea('0x2d')](_0x34723f);});}function getZohoUser(_0x15cc81,_0x4e9183){return new BPromise(function(_0x57b4e5,_0x39b8b0){request(_0x15cc81)[_0x98ea('0x2a')](function(_0x1c0f0d){var _0x143532=null;if(_0x1c0f0d){_0x143532=_0x1c0f0d[_0x98ea('0x3e')][0x0];_0x143532['enduserType']=_0x4e9183;}_0x57b4e5(_0x143532);})[_0x98ea('0x2c')](function(_0x4907ac){_0x39b8b0(_0x4907ac);});});}function createEndUser(_0x1362cb,_0x50c4f7,_0x11a91a,_0x310dce,_0x18e859,_0x29a2ba){var _0x11a91a=getName(_0x11a91a);return request({'method':_0x98ea('0x24'),'uri':_0x98ea('0x3f')+_0x50c4f7+_0x98ea('0x40')+_[_0x98ea('0x41')](_0x29a2ba[_0x98ea('0x42')])+'s','body':{'data':[{'Last_Name':_0x11a91a[0x1],'First_Name':_0x11a91a[0x0],'Phone':_0x310dce,'Owner':{'name':!_['isNil'](_0x18e859[_0x98ea('0x43')]['name'])?_0x18e859[_0x98ea('0x43')]['name']:!_[_0x98ea('0x1a')](_0x18e859['first_name'])?_0x18e859[_0x98ea('0x44')]+'\x20'+_0x18e859[_0x98ea('0x45')]:_0x18e859[_0x98ea('0x45')],'id':_0x18e859['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1362cb},'json':!![]})[_0x98ea('0x2a')](function(_0x18bf6b){if(_0x18bf6b&&_0x18bf6b['data'][0x0][_0x98ea('0x46')]===_0x98ea('0x47')){var _0x1fe7ce=_0x18bf6b[_0x98ea('0x3e')][0x0][_0x98ea('0x48')];_0x1fe7ce[_0x98ea('0x49')]=_[_0x98ea('0x41')](_0x29a2ba[_0x98ea('0x42')])+'s';return _0x1fe7ce;}logger[_0x98ea('0x2d')](_0x98ea('0x3c'),JSON['stringify'](data));throw new Error(_0x98ea('0x4a')+JSON[_0x98ea('0xb')](data));})[_0x98ea('0x2c')](function(_0x474f15){console[_0x98ea('0x4b')](_0x98ea('0x4c'),_0x474f15);});}function getEndUser(_0x1663e2,_0x1d9237,_0x324817,_0x3b5dea,_0x2dd6dd,_0x3411b2,_0x29c23e){var _0x5df0ab={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1663e2},'json':!![]};switch(_0x29c23e[_0x98ea('0x4d')]){case _0x98ea('0x4e'):_0x5df0ab[_0x98ea('0x4f')]=_0x98ea('0x3f')+_0x1d9237+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2dd6dd+'))';return getZohoUser(_0x5df0ab,_0x98ea('0x50'))[_0x98ea('0x2a')](function(_0x360ae3){if(_0x360ae3)return _0x360ae3;_0x5df0ab[_0x98ea('0x4f')]='https://www.zohoapis.'+_0x1d9237+_0x98ea('0x51')+_0x2dd6dd+'))';return getZohoUser(_0x5df0ab,_0x98ea('0x52'))[_0x98ea('0x2a')](function(_0x2213a8){if(_0x2213a8)return _0x2213a8;if(_0x29c23e['moduleCreate']!=_0x98ea('0x53')){return createEndUser(_0x1663e2,_0x1d9237,_0x3b5dea,_0x2dd6dd,_0x3411b2,_0x29c23e);}else{return{};}});});break;case _0x98ea('0x54'):_0x5df0ab[_0x98ea('0x4f')]=_0x98ea('0x3f')+_0x1d9237+_0x98ea('0x55')+_0x2dd6dd+'))';return getZohoUser(_0x5df0ab,_0x98ea('0x50'))[_0x98ea('0x2a')](function(_0xfacad7){if(_0xfacad7)return _0xfacad7;if(_0x29c23e[_0x98ea('0x42')]!=_0x98ea('0x53')){return createEndUser(_0x1663e2,_0x1d9237,_0x3b5dea,_0x2dd6dd,_0x3411b2,_0x29c23e);}else{return{};}});break;case _0x98ea('0x56'):_0x5df0ab[_0x98ea('0x4f')]='https://www.zohoapis.'+_0x1d9237+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2dd6dd+'))';return getZohoUser(_0x5df0ab,'Leads')['then'](function(_0x134839){if(_0x134839)return _0x134839;if(_0x29c23e[_0x98ea('0x42')]!=_0x98ea('0x53')){return createEndUser(_0x1663e2,_0x1d9237,_0x3b5dea,_0x2dd6dd,_0x3411b2,_0x29c23e);}else{return{};}});break;}}function getCall(_0x3bc9f4,_0x34bfc1,_0x51791c,_0x43f2bd,_0x33846f,_0x3e3285,_0x534119,_0x596e7a){logger[_0x98ea('0x30')](_0x98ea('0x57'));var _0x4f7327={};_0x4f7327['Owner']={'name':!_[_0x98ea('0x1a')](_0x43f2bd[_0x98ea('0x43')][_0x98ea('0x16')])&&!_['isNil'](_0x43f2bd[_0x98ea('0x38')]['name'])&&_0x43f2bd['profile']['name']==='administrator'?_0x43f2bd[_0x98ea('0x43')][_0x98ea('0x16')]:!_[_0x98ea('0x1a')](_0x43f2bd[_0x98ea('0x44')])?_0x43f2bd['first_name']+'\x20'+_0x43f2bd[_0x98ea('0x45')]:_0x43f2bd[_0x98ea('0x45')],'id':_0x43f2bd['id']};_0x4f7327[_0x98ea('0x58')]=intUtil[_0x98ea('0x59')](_0x3e3285['Subjects'],_0x534119,'\x20');_0x4f7327[_0x98ea('0x5a')]=intUtil['getString'](_0x3e3285[_0x98ea('0x5b')],_0x534119,'\x0a');if(_0x33846f['enduserType']===_0x98ea('0x50')){_0x4f7327[_0x98ea('0x5c')]={'name':!_['isNil'](_0x33846f['Full_Name'])?_0x33846f[_0x98ea('0x5d')]:!_[_0x98ea('0x1a')](_0x33846f['First_Name'])?_0x33846f[_0x98ea('0x5e')]+'\x20'+_0x33846f[_0x98ea('0x5f')]:_0x33846f[_0x98ea('0x5f')],'id':_0x33846f['id']};}if(_0x33846f[_0x98ea('0x49')]===_0x98ea('0x52')){_0x4f7327[_0x98ea('0x60')]={'name':!_['isNil'](_0x33846f[_0x98ea('0x5d')])?_0x33846f[_0x98ea('0x5d')]:!_['isNil'](_0x33846f['First_Name'])?_0x33846f[_0x98ea('0x5e')]+'\x20'+_0x33846f[_0x98ea('0x5f')]:_0x33846f[_0x98ea('0x5f')],'id':_0x33846f['id']};_0x4f7327[_0x98ea('0x61')]=_[_0x98ea('0x41')](_0x33846f['enduserType']);}if(_0x534119[_0x98ea('0x62')]){_0x4f7327[_0x98ea('0x63')]=moment[_0x98ea('0x64')](parseInt(_0x534119[_0x98ea('0x62')])*0x3e8)[_0x98ea('0x65')]('mm:ss');}else if(_0x534119['answertime']&&_0x534119[_0x98ea('0x66')]){_0x4f7327['Call_Duration']=moment['utc'](moment(_0x534119[_0x98ea('0x66')],_0x98ea('0x67'))['diff'](moment(_0x534119['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x98ea('0x65')](_0x98ea('0x68'));}switch(_0x534119['lastevent']){case _0x98ea('0x69'):_0x4f7327[_0x98ea('0x6a')]=_0x98ea('0x6b');break;case _0x98ea('0x6c'):case _0x98ea('0x6d'):_0x4f7327[_0x98ea('0x6a')]=_0x98ea('0x6e');break;case'rejected':_0x4f7327[_0x98ea('0x6a')]=_0x98ea('0x6f');break;case'abandoned':_0x4f7327[_0x98ea('0x6a')]=_0x98ea('0x70');break;case _0x98ea('0x71'):_0x4f7327[_0x98ea('0x6a')]=_0x98ea('0x72');default:}_0x4f7327['Call_Start_Time']=(_0x596e7a==='outbound'?moment(_0x534119[_0x98ea('0x73')])[_0x98ea('0x65')](_0x98ea('0x67')):moment(_0x534119[_0x98ea('0x74')])['format'](_0x98ea('0x67')))||moment()[_0x98ea('0x65')](_0x98ea('0x67'));_0x4f7327['Call_Type']=_0x596e7a||_0x98ea('0x75');_0x4f7327=_[_0x98ea('0x76')](_0x4f7327,getCustomFields(_0x3e3285['Fields'],_0x534119));return request({'method':_0x98ea('0x24'),'uri':'https://www.zohoapis.'+_0x34bfc1+_0x98ea('0x77'),'headers':{'Authorization':_0x98ea('0x32')+_0x3bc9f4},'body':{'data':[_0x4f7327]},'json':!![]})['then'](function(_0x1319f8){if(_0x1319f8&&_0x1319f8[_0x98ea('0x3e')][0x0][_0x98ea('0x46')]===_0x98ea('0x47')){logger['info']('Call\x20created!');return{'id':_0x1319f8[_0x98ea('0x3e')][0x0][_0x98ea('0x48')]['id']};}})[_0x98ea('0x2c')](function(_0x1d748a){logger['info']('err',_0x1d748a[_0x98ea('0x2f')]);console[_0x98ea('0x4b')](_0x98ea('0x78'),_0x1d748a);});}exports['queue']=function(_0x3faadd,_0x1a655e,_0x5e417e,_0x2979a2,_0x1c35a5,_0x3ad331){var _0x3d1166,_0x3240b3,_0x5e9d84;_0x3ad331['host']=intUtil[_0x98ea('0x79')](_0x3ad331[_0x98ea('0x7a')]);_0x3ad331[_0x98ea('0x7b')]=intUtil[_0x98ea('0x79')](_0x3ad331['serverUrl']);if(_0x1c35a5&&_0x1c35a5[_0x98ea('0x7c')]){logger[_0x98ea('0x30')](_0x98ea('0x7d'),_0x98ea('0x7e'));_0x1a655e[_0x98ea('0x7f')]=_0x3ad331[_0x98ea('0x7b')]+_0x98ea('0x80')+_0x1a655e[_0x98ea('0x81')]+_0x98ea('0x82')+md5(_0x1a655e[_0x98ea('0x81')]);}else{_0x1a655e[_0x98ea('0x7f')]='';}var _0x406538=_0x3ad331[_0x98ea('0x7a')]==='zoho.eu'?'eu':_0x98ea('0x83');return getAccessToken(_0x3ad331)[_0x98ea('0x2a')](function(_0x79ad96){_0x5e9d84=_0x79ad96;return getUser(_0x5e9d84,_0x406538,_0x3ad331,_0x2979a2[_0x98ea('0x36')]);})[_0x98ea('0x2a')](function(_0x491b79){_0x3d1166=_0x491b79;logger['info'](_0x98ea('0x84'),_0x3d1166['id']);return getEndUser(_0x5e9d84,_0x406538,_0x3ad331,_0x1a655e[_0x98ea('0x85')],_0x1a655e[_0x98ea('0x86')],_0x3d1166,_0x5e417e);})[_0x98ea('0x2a')](function(_0x3870dc){_0x3240b3=_0x3870dc;return getCall(_0x5e9d84,_0x406538,_0x3ad331,_0x3d1166,_0x3240b3,_0x5e417e,_0x1a655e,_0x98ea('0x75'));})[_0x98ea('0x2a')](function(_0x1e2b86){if(_0x1e2b86){logger['info'](_0x98ea('0x87'),_0x1e2b86['id']);logger[_0x98ea('0x30')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x98ea('0x88'),_0x2979a2[_0x98ea('0x16')]),_0x98ea('0x89'),{'uri':'https://crm.'+_0x3ad331['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1e2b86['id']});}})[_0x98ea('0x2c')](function(_0x45edc8){logger[_0x98ea('0x2d')]('[QUEUE]',JSON[_0x98ea('0xb')](_0x45edc8));});};exports[_0x98ea('0x8a')]=function(_0x3e8418,_0x1ea43a,_0x2b40d1,_0x3b988a,_0xb7e4bf,_0x3c8b86,_0x1211e5){var _0x41cbd2,_0x2a5a49,_0x4d9606;_0x3c8b86[_0x98ea('0x7a')]=intUtil[_0x98ea('0x79')](_0x3c8b86[_0x98ea('0x7a')]);_0x3c8b86[_0x98ea('0x7b')]=intUtil['stripTrailingSlash'](_0x3c8b86[_0x98ea('0x7b')]);if(_0x1211e5&&_0x1211e5[_0x98ea('0x8b')]&&_0x1211e5[_0x98ea('0x8b')]!=='none'){logger[_0x98ea('0x30')](_0x98ea('0x8c'),_0x98ea('0x7e'));_0x1ea43a[_0x98ea('0x7f')]=_0x3c8b86[_0x98ea('0x7b')]+'/api/voice/recordings/'+_0x1ea43a['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x1ea43a['uniqueid']);}var _0x1fa5ab=_0x3c8b86['host']===_0x98ea('0x8d')?'eu':_0x98ea('0x83');return getAccessToken(_0x3c8b86)[_0x98ea('0x2a')](function(_0x3d9af7){_0x4d9606=_0x3d9af7;return getUser(_0x4d9606,_0x1fa5ab,_0x3c8b86,_0x3b988a[_0x98ea('0x36')]);})[_0x98ea('0x2a')](function(_0x35f45a){_0x41cbd2=_0x35f45a;logger[_0x98ea('0x30')]('The\x20User\x20ID\x20is:',_0x41cbd2['id']);return getEndUser(_0x4d9606,_0x1fa5ab,_0x3c8b86,_0x1ea43a[_0x98ea('0x8e')],_0x1ea43a['destcalleridnum'],_0x41cbd2,_0x2b40d1);})[_0x98ea('0x2a')](function(_0x329d54){_0x2a5a49=_0x329d54;return getCall(_0x4d9606,_0x1fa5ab,_0x3c8b86,_0x41cbd2,_0x2a5a49,_0x2b40d1,_0x1ea43a,'Outbound');})[_0x98ea('0x2a')](function(_0x21b1e0){if(_0x21b1e0){logger[_0x98ea('0x30')](_0x98ea('0x87'),_0x21b1e0['id']);logger[_0x98ea('0x30')](_0x98ea('0x8c'),_0x98ea('0x8f'));emit(util[_0x98ea('0x65')](_0x98ea('0x88'),_0x3b988a['name']),_0x98ea('0x89'),{'uri':'https://crm.'+_0x3c8b86['host']+_0x98ea('0x90')+_0x21b1e0['id']});}})[_0x98ea('0x2c')](function(_0x137aa8){logger[_0x98ea('0x2d')](_0x98ea('0x8c'),JSON[_0x98ea('0xb')](_0x137aa8));});};exports[_0x98ea('0x91')]=function(_0x212163,_0x3c7112,_0x591630,_0x5136e1,_0x4c4dc8,_0x338310){var _0x3e6ec1,_0x2f6c0c,_0x6003f;_0x338310[_0x98ea('0x7a')]=intUtil['stripTrailingSlash'](_0x338310['host']);_0x338310[_0x98ea('0x7b')]=intUtil['stripTrailingSlash'](_0x338310[_0x98ea('0x7b')]);if(_0x4c4dc8&&_0x4c4dc8[_0x98ea('0x7c')]){logger[_0x98ea('0x30')]('['+_0x3c7112[_0x98ea('0x92')][_0x98ea('0x93')]()+']','Recording\x20is\x20enabled!');_0x3c7112['recordingURL']=_0x338310[_0x98ea('0x7b')]+_0x98ea('0x80')+_0x3c7112['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x3c7112[_0x98ea('0x81')]);}else{_0x3c7112['recordingURL']='';}var _0x483631=_0x338310[_0x98ea('0x7a')]==='zoho.eu'?'eu':_0x98ea('0x83');return getAccessToken(_0x338310)[_0x98ea('0x2a')](function(_0x37f364){_0x6003f=_0x37f364;return getUser(_0x6003f,_0x483631,_0x338310);})[_0x98ea('0x2a')](function(_0x26c7d7){_0x3e6ec1=_0x26c7d7;logger['info'](_0x98ea('0x84'),_0x3e6ec1['id']);return getEndUser(_0x6003f,_0x483631,_0x338310,_0x3c7112[_0x98ea('0x85')],_0x3c7112['calleridnum'],_0x3e6ec1,_0x591630);})[_0x98ea('0x2a')](function(_0x4611e2){_0x2f6c0c=_0x4611e2;return getCall(_0x6003f,_0x483631,_0x338310,_0x3e6ec1,_0x2f6c0c,_0x591630,_0x3c7112,'Inbound');})['then'](function(_0x1badcd){if(_0x1badcd){logger['info'](_0x98ea('0x87'),_0x1badcd['id']);}})[_0x98ea('0x2c')](function(_0x35b641){logger[_0x98ea('0x2d')]('['+_0x3c7112[_0x98ea('0x92')][_0x98ea('0x93')]()+']',JSON[_0x98ea('0xb')](_0x35b641));});}; \ No newline at end of file +var _0x5145=['recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','calleridnum','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','emit','debug','[HTTP]','string','picklist','idField','toString','variable','variableName','type','customVariable','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','refresh_token','then','add','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','name','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','The\x20failing\x20result\x20is','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','Error:\x20','log','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Subject','getString','Subjects','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','code','err','host','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.'];(function(_0x49d9db,_0x41347b){var _0x5f049d=function(_0x2fb1ac){while(--_0x2fb1ac){_0x49d9db['push'](_0x49d9db['shift']());}};_0x5f049d(++_0x41347b);}(_0x5145,0x1bf));var _0x5514=function(_0x3d449d,_0x13beef){_0x3d449d=_0x3d449d-0x0;var _0x191130=_0x5145[_0x3d449d];return _0x191130;};'use strict';var _=require(_0x5514('0x0'));var rp=require(_0x5514('0x1'));var md5=require(_0x5514('0x2'));var util=require(_0x5514('0x3'));var intUtil=require(_0x5514('0x4'));var moment=require(_0x5514('0x5'));var Redis=require('ioredis');var BPromise=require(_0x5514('0x6'));var config=require(_0x5514('0x7'));var logger=require(_0x5514('0x8'))(_0x5514('0x9'));config[_0x5514('0xa')]=_[_0x5514('0xb')](config[_0x5514('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5514('0xa')]));function emit(_0x357f2b,_0x3dc3d7,_0x1ae0ec){io['to'](_0x357f2b)[_0x5514('0xc')](_0x3dc3d7,_0x1ae0ec);}function request(_0x2448ca){logger[_0x5514('0xd')](_0x5514('0xe'),JSON['stringify'](_0x2448ca));return rp(_0x2448ca);}function getCustomFields(_0x2c97f2,_0x462bca){var _0x59c929={};if(_0x2c97f2['length']>0x0){_['forEach'](_0x2c97f2,function(_0x83dfa4){if(_['includes']([_0x5514('0xf'),_0x5514('0x10')],_0x83dfa4['type'])&&_0x83dfa4[_0x5514('0x11')]){_0x59c929[_0x83dfa4[_0x5514('0x11')]]=_0x83dfa4['content'][_0x5514('0x12')]();}else if(_0x83dfa4['type']===_0x5514('0x13')&&_0x83dfa4['variableName']&&_0x83dfa4['idField']&&_0x462bca[_0x83dfa4[_0x5514('0x14')]]){_0x59c929[_0x83dfa4['idField']]=_0x462bca[_0x83dfa4[_0x5514('0x14')]][_0x5514('0x12')]();}else if(_0x83dfa4[_0x5514('0x15')]===_0x5514('0x16')&&_0x83dfa4['Variable']&&_0x83dfa4[_0x5514('0x17')]['name']&&_0x83dfa4['idField']&&_0x462bca[_0x83dfa4[_0x5514('0x17')]['name'][_0x5514('0x18')]()]){_0x59c929[_0x83dfa4[_0x5514('0x11')]]=_0x462bca[_0x83dfa4[_0x5514('0x17')]['name']['toLowerCase']()][_0x5514('0x12')]();}});}return _0x59c929;}function getName(_0x3f7eaa){if(_0x3f7eaa[_0x5514('0x19')]('\x20')>0x0){var _0x4f5147=_0x3f7eaa[_0x5514('0x1a')](/ (.+)/);if(_0x4f5147[0x1]){return _0x4f5147;}}return[_0x3f7eaa,_0x3f7eaa];}var accountsTokens={};function getAccessToken(_0xb58224){return new Promise(function(_0x10d1c9,_0x14c334){if(!_[_0x5514('0x1b')](accountsTokens[_0xb58224['id']])&&!_[_0x5514('0x1b')](accountsTokens[_0xb58224['id']][_0x5514('0x1c')])){if(moment()[_0x5514('0x1d')](accountsTokens[_0xb58224['id']][_0x5514('0x1e')])){_0x10d1c9(accountsTokens[_0xb58224['id']][_0x5514('0x1c')]);}}var _0x5cfc05;switch(_0xb58224[_0x5514('0x1f')]){case'US':_0x5cfc05=_0x5514('0x20');break;case'AU':_0x5cfc05=_0x5514('0x21');break;case'EU':_0x5cfc05='https://accounts.zoho.eu';break;case'IN':_0x5cfc05=_0x5514('0x22');break;case'CN':_0x5cfc05='https://accounts.zoho.com.cn';break;default:_0x5cfc05=_0x5514('0x23');break;}var _0xd23515={'method':_0x5514('0x24'),'uri':_0x5cfc05+_0x5514('0x25'),'qs':{'refresh_token':_0xb58224['refreshToken'],'client_id':_0xb58224[_0x5514('0x26')],'client_secret':_0xb58224['clientSecret'],'grant_type':_0x5514('0x27')},'json':!![]};return rp(_0xd23515)[_0x5514('0x28')](function(_0x129a7e){accountsTokens[_0xb58224['id']]={'access_token':_0x129a7e[_0x5514('0x1c')],'expires_in':moment()[_0x5514('0x29')](_0x129a7e[_0x5514('0x1e')],'seconds')};_0x10d1c9(_0x129a7e[_0x5514('0x1c')]);})['catch'](function(_0x564af8){logger['error'](_0x5514('0x2a'),_0x564af8[_0x5514('0x2b')]);_0x14c334(_0x564af8);});});}function getUser(_0x1318d7,_0x30ea86,_0x12ce99,_0x4df769){logger[_0x5514('0x2c')](_0x5514('0x2d'));return request({'method':_0x5514('0x2e'),'uri':util[_0x5514('0x2f')](_0x5514('0x30'),_0x30ea86),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1318d7},'json':!![]})[_0x5514('0x28')](function(_0x172f64){if(_0x172f64[_0x5514('0x31')]){var _0x1218ec=-0x1;if(_[_0x5514('0x32')](_0x172f64['users'])){if(!_['isNil'](_0x4df769)){_0x1218ec=_[_0x5514('0x33')](_0x172f64[_0x5514('0x31')],function(_0x5e5915){return _0x5e5915[_0x5514('0x34')]===_0x4df769;});}if(_0x1218ec>=0x0){logger[_0x5514('0x2c')](_0x5514('0x35'));}else{logger[_0x5514('0x2c')](_0x5514('0x36'));_0x1218ec=_[_0x5514('0x33')](_0x172f64['users'],function(_0x2eac8f){return _0x2eac8f[_0x5514('0x37')]['name']===_0x5514('0x38');});}return _0x172f64['users'][_0x1218ec];}else{if(_0x172f64[_0x5514('0x39')][_0x5514('0x37')][_0x5514('0x3a')]==='Administrator'){logger[_0x5514('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x172f64[_0x5514('0x39')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x5514('0x3b')](_0x172f64));throw new Error(_0x5514('0x3c')+JSON[_0x5514('0x3b')](_0x172f64));}}}else{logger[_0x5514('0x3d')](_0x5514('0x3e'),JSON['stringify'](_0x172f64));throw new Error(_0x5514('0x3c')+JSON[_0x5514('0x3b')](_0x172f64));}})[_0x5514('0x3f')](function(_0x7e18de){console[_0x5514('0x3d')](_0x7e18de);});}function getZohoUser(_0x11465b,_0x1a74be){return new BPromise(function(_0x55077b,_0x516b72){request(_0x11465b)['then'](function(_0x3db954){var _0x5f25ec=null;if(_0x3db954){_0x5f25ec=_0x3db954[_0x5514('0x40')][0x0];_0x5f25ec[_0x5514('0x41')]=_0x1a74be;}_0x55077b(_0x5f25ec);})[_0x5514('0x3f')](function(_0x81d9f){_0x516b72(_0x81d9f);});});}function createEndUser(_0x177791,_0x4be071,_0x3681e1,_0x5a0dd1,_0x15ee82,_0x59c2f1){var _0x3681e1=getName(_0x3681e1);return request({'method':_0x5514('0x24'),'uri':_0x5514('0x42')+_0x4be071+_0x5514('0x43')+_[_0x5514('0x44')](_0x59c2f1[_0x5514('0x45')])+'s','body':{'data':[{'Last_Name':_0x3681e1[0x1],'First_Name':_0x3681e1[0x0],'Phone':_0x5a0dd1,'Owner':{'name':!_[_0x5514('0x1b')](_0x15ee82['role'][_0x5514('0x3a')])?_0x15ee82[_0x5514('0x46')]['name']:!_[_0x5514('0x1b')](_0x15ee82['first_name'])?_0x15ee82[_0x5514('0x47')]+'\x20'+_0x15ee82['last_name']:_0x15ee82[_0x5514('0x48')],'id':_0x15ee82['id']}}]},'headers':{'Authorization':_0x5514('0x49')+_0x177791},'json':!![]})[_0x5514('0x28')](function(_0x29811b){if(_0x29811b&&_0x29811b['data'][0x0]['code']===_0x5514('0x4a')){var _0x5bf601=_0x29811b[_0x5514('0x40')][0x0][_0x5514('0x4b')];_0x5bf601['enduserType']=_[_0x5514('0x44')](_0x59c2f1[_0x5514('0x45')])+'s';return _0x5bf601;}logger[_0x5514('0x3d')](_0x5514('0x3e'),JSON[_0x5514('0x3b')](data));throw new Error(_0x5514('0x4c')+JSON[_0x5514('0x3b')](data));})['catch'](function(_0x5d2bf3){console[_0x5514('0x4d')]('CREATE\x20ERROR',_0x5d2bf3);});}function getEndUser(_0x3c741c,_0x216592,_0x1f7488,_0xac7408,_0x12cfec,_0x510d72,_0x16fa56){var _0x376cfa={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3c741c},'json':!![]};switch(_0x16fa56[_0x5514('0x4e')]){case'contact_lead':_0x376cfa[_0x5514('0x4f')]=_0x5514('0x42')+_0x216592+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x12cfec+'))';return getZohoUser(_0x376cfa,_0x5514('0x50'))[_0x5514('0x28')](function(_0x2edd70){if(_0x2edd70)return _0x2edd70;_0x376cfa[_0x5514('0x4f')]=_0x5514('0x42')+_0x216592+_0x5514('0x51')+_0x12cfec+'))';return getZohoUser(_0x376cfa,_0x5514('0x52'))['then'](function(_0x5086c3){if(_0x5086c3)return _0x5086c3;if(_0x16fa56[_0x5514('0x45')]!=_0x5514('0x53')){return createEndUser(_0x3c741c,_0x216592,_0xac7408,_0x12cfec,_0x510d72,_0x16fa56);}else{return{};}});});break;case'contact':_0x376cfa[_0x5514('0x4f')]=_0x5514('0x42')+_0x216592+_0x5514('0x54')+_0x12cfec+'))';return getZohoUser(_0x376cfa,'Contacts')['then'](function(_0x110f1c){if(_0x110f1c)return _0x110f1c;if(_0x16fa56[_0x5514('0x45')]!=_0x5514('0x53')){return createEndUser(_0x3c741c,_0x216592,_0xac7408,_0x12cfec,_0x510d72,_0x16fa56);}else{return{};}});break;case _0x5514('0x55'):_0x376cfa['uri']=_0x5514('0x42')+_0x216592+_0x5514('0x51')+_0x12cfec+'))';return getZohoUser(_0x376cfa,_0x5514('0x52'))[_0x5514('0x28')](function(_0x571578){if(_0x571578)return _0x571578;if(_0x16fa56[_0x5514('0x45')]!=_0x5514('0x53')){return createEndUser(_0x3c741c,_0x216592,_0xac7408,_0x12cfec,_0x510d72,_0x16fa56);}else{return{};}});break;}}function getCall(_0x52758e,_0x4fdc4f,_0x53c908,_0x719f7b,_0x2b1872,_0x31853c,_0x572f37,_0x46e368){logger[_0x5514('0x2c')](_0x5514('0x56'));var _0x59dd8f={};_0x59dd8f['Owner']={'name':!_['isNil'](_0x719f7b[_0x5514('0x46')][_0x5514('0x3a')])&&!_[_0x5514('0x1b')](_0x719f7b[_0x5514('0x37')][_0x5514('0x3a')])&&_0x719f7b[_0x5514('0x37')][_0x5514('0x3a')]==='administrator'?_0x719f7b[_0x5514('0x46')]['name']:!_[_0x5514('0x1b')](_0x719f7b[_0x5514('0x47')])?_0x719f7b['first_name']+'\x20'+_0x719f7b[_0x5514('0x48')]:_0x719f7b[_0x5514('0x48')],'id':_0x719f7b['id']};_0x59dd8f[_0x5514('0x57')]=intUtil[_0x5514('0x58')](_0x31853c[_0x5514('0x59')],_0x572f37,'\x20');_0x59dd8f['Description']=intUtil[_0x5514('0x58')](_0x31853c['Descriptions'],_0x572f37,'\x0a');if(_0x2b1872[_0x5514('0x41')]===_0x5514('0x50')){_0x59dd8f['Who_Id']={'name':!_['isNil'](_0x2b1872[_0x5514('0x5a')])?_0x2b1872[_0x5514('0x5a')]:!_['isNil'](_0x2b1872[_0x5514('0x5b')])?_0x2b1872[_0x5514('0x5b')]+'\x20'+_0x2b1872[_0x5514('0x5c')]:_0x2b1872[_0x5514('0x5c')],'id':_0x2b1872['id']};}if(_0x2b1872[_0x5514('0x41')]===_0x5514('0x52')){_0x59dd8f[_0x5514('0x5d')]={'name':!_[_0x5514('0x1b')](_0x2b1872[_0x5514('0x5a')])?_0x2b1872[_0x5514('0x5a')]:!_[_0x5514('0x1b')](_0x2b1872[_0x5514('0x5b')])?_0x2b1872['First_Name']+'\x20'+_0x2b1872['Last_Name']:_0x2b1872[_0x5514('0x5c')],'id':_0x2b1872['id']};_0x59dd8f[_0x5514('0x5e')]=_[_0x5514('0x44')](_0x2b1872[_0x5514('0x41')]);}if(_0x572f37['talktime']){_0x59dd8f[_0x5514('0x5f')]=moment[_0x5514('0x60')](parseInt(_0x572f37[_0x5514('0x61')])*0x3e8)[_0x5514('0x2f')](_0x5514('0x62'));}else if(_0x572f37[_0x5514('0x63')]&&_0x572f37[_0x5514('0x64')]){_0x59dd8f[_0x5514('0x5f')]=moment['utc'](moment(_0x572f37[_0x5514('0x64')],_0x5514('0x65'))[_0x5514('0x66')](moment(_0x572f37['starttime'],_0x5514('0x65'))))['format'](_0x5514('0x62'));}switch(_0x572f37['lastevent']){case _0x5514('0x67'):_0x59dd8f[_0x5514('0x68')]='Called';break;case _0x5514('0x69'):case _0x5514('0x6a'):_0x59dd8f[_0x5514('0x68')]=_0x5514('0x6b');break;case _0x5514('0x6c'):_0x59dd8f['Call_Result']=_0x5514('0x6d');break;case _0x5514('0x6e'):_0x59dd8f['Call_Result']=_0x5514('0x6f');break;case _0x5514('0x70'):_0x59dd8f[_0x5514('0x68')]=_0x5514('0x71');default:}_0x59dd8f['Call_Start_Time']=(_0x46e368===_0x5514('0x72')?moment(_0x572f37['starttime'])[_0x5514('0x2f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x572f37[_0x5514('0x73')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x5514('0x2f')](_0x5514('0x65'));_0x59dd8f['Call_Type']=_0x46e368||_0x5514('0x74');_0x59dd8f=_[_0x5514('0x75')](_0x59dd8f,getCustomFields(_0x31853c['Fields'],_0x572f37));return request({'method':_0x5514('0x24'),'uri':_0x5514('0x42')+_0x4fdc4f+_0x5514('0x76'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x52758e},'body':{'data':[_0x59dd8f]},'json':!![]})['then'](function(_0x485dd4){if(_0x485dd4&&_0x485dd4[_0x5514('0x40')][0x0][_0x5514('0x77')]===_0x5514('0x4a')){logger[_0x5514('0x2c')]('Call\x20created!');return{'id':_0x485dd4[_0x5514('0x40')][0x0]['details']['id']};}})[_0x5514('0x3f')](function(_0x1310b6){logger[_0x5514('0x2c')](_0x5514('0x78'),_0x1310b6[_0x5514('0x2b')]);console[_0x5514('0x4d')](_0x5514('0x78'),_0x1310b6);});}exports['queue']=function(_0x406d10,_0x58487f,_0xa7b2a2,_0x13ba52,_0x17c381,_0x119b70){var _0x2324dc,_0x38c521,_0x526f39;_0x119b70[_0x5514('0x79')]=intUtil['stripTrailingSlash'](_0x119b70[_0x5514('0x79')]);_0x119b70[_0x5514('0x7a')]=intUtil[_0x5514('0x7b')](_0x119b70['serverUrl']);if(_0x17c381&&_0x17c381['monitor_format']){logger['info']('[QUEUE]',_0x5514('0x7c'));_0x58487f[_0x5514('0x7d')]=_0x119b70[_0x5514('0x7a')]+_0x5514('0x7e')+_0x58487f[_0x5514('0x7f')]+_0x5514('0x80')+md5(_0x58487f[_0x5514('0x7f')]);}else{_0x58487f[_0x5514('0x7d')]='';}var _0x1fda87=_0x119b70[_0x5514('0x79')]===_0x5514('0x81')?'eu':_0x5514('0x82');return getAccessToken(_0x119b70)[_0x5514('0x28')](function(_0x15ed08){_0x526f39=_0x15ed08;return getUser(_0x526f39,_0x1fda87,_0x119b70,_0x13ba52['email']);})[_0x5514('0x28')](function(_0x228eac){_0x2324dc=_0x228eac;logger[_0x5514('0x2c')](_0x5514('0x83'),_0x2324dc['id']);return getEndUser(_0x526f39,_0x1fda87,_0x119b70,_0x58487f[_0x5514('0x84')],_0x58487f['calleridnum'],_0x2324dc,_0xa7b2a2);})['then'](function(_0x2973ba){_0x38c521=_0x2973ba;return getCall(_0x526f39,_0x1fda87,_0x119b70,_0x2324dc,_0x38c521,_0xa7b2a2,_0x58487f,_0x5514('0x74'));})[_0x5514('0x28')](function(_0x485f5d){if(_0x485f5d){logger['info'](_0x5514('0x85'),_0x485f5d['id']);logger['info']('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5514('0x86'),_0x13ba52[_0x5514('0x3a')]),_0x5514('0x87'),{'uri':_0x5514('0x88')+_0x119b70['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x485f5d['id']});}})[_0x5514('0x3f')](function(_0x490e25){logger[_0x5514('0x3d')]('[QUEUE]',JSON[_0x5514('0x3b')](_0x490e25));});};exports['outbound']=function(_0x6b4ca8,_0x29e9d9,_0x3a5764,_0x3c9186,_0x5aff91,_0x18e9e0,_0x1edace){var _0x2d43db,_0x3c7021,_0x374aa0;_0x18e9e0['host']=intUtil['stripTrailingSlash'](_0x18e9e0[_0x5514('0x79')]);_0x18e9e0['serverUrl']=intUtil[_0x5514('0x7b')](_0x18e9e0[_0x5514('0x7a')]);if(_0x1edace&&_0x1edace['recordingFormat']&&_0x1edace[_0x5514('0x89')]!==_0x5514('0x8a')){logger[_0x5514('0x2c')](_0x5514('0x8b'),_0x5514('0x7c'));_0x29e9d9[_0x5514('0x7d')]=_0x18e9e0[_0x5514('0x7a')]+_0x5514('0x7e')+_0x29e9d9[_0x5514('0x7f')]+_0x5514('0x80')+md5(_0x29e9d9[_0x5514('0x7f')]);}var _0xd438da=_0x18e9e0[_0x5514('0x79')]==='zoho.eu'?'eu':_0x5514('0x82');return getAccessToken(_0x18e9e0)[_0x5514('0x28')](function(_0x275265){_0x374aa0=_0x275265;return getUser(_0x374aa0,_0xd438da,_0x18e9e0,_0x3c9186[_0x5514('0x34')]);})['then'](function(_0x47eb17){_0x2d43db=_0x47eb17;logger['info'](_0x5514('0x83'),_0x2d43db['id']);return getEndUser(_0x374aa0,_0xd438da,_0x18e9e0,_0x29e9d9['destcalleridname'],_0x29e9d9[_0x5514('0x8c')],_0x2d43db,_0x3a5764);})['then'](function(_0x276a4){_0x3c7021=_0x276a4;return getCall(_0x374aa0,_0xd438da,_0x18e9e0,_0x2d43db,_0x3c7021,_0x3a5764,_0x29e9d9,'Outbound');})['then'](function(_0x5e04f9){if(_0x5e04f9){logger[_0x5514('0x2c')](_0x5514('0x85'),_0x5e04f9['id']);logger['info'](_0x5514('0x8b'),_0x5514('0x8d'));emit(util[_0x5514('0x2f')](_0x5514('0x86'),_0x3c9186['name']),_0x5514('0x87'),{'uri':_0x5514('0x88')+_0x18e9e0[_0x5514('0x79')]+_0x5514('0x8e')+_0x5e04f9['id']});}})[_0x5514('0x3f')](function(_0x1f5f64){logger['error'](_0x5514('0x8b'),JSON[_0x5514('0x3b')](_0x1f5f64));});};exports['unmanaged']=function(_0x1c9c62,_0x193d9c,_0x589dea,_0x194def,_0x459d57,_0x392d2a){var _0x4e7ab2,_0x4da936,_0x24c2cf;_0x392d2a[_0x5514('0x79')]=intUtil[_0x5514('0x7b')](_0x392d2a[_0x5514('0x79')]);_0x392d2a[_0x5514('0x7a')]=intUtil[_0x5514('0x7b')](_0x392d2a['serverUrl']);if(_0x459d57&&_0x459d57['monitor_format']){logger[_0x5514('0x2c')]('['+_0x193d9c['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x193d9c[_0x5514('0x7d')]=_0x392d2a['serverUrl']+'/api/voice/recordings/'+_0x193d9c['uniqueid']+_0x5514('0x80')+md5(_0x193d9c[_0x5514('0x7f')]);}else{_0x193d9c[_0x5514('0x7d')]='';}var _0x11849e=_0x392d2a['host']==='zoho.eu'?'eu':_0x5514('0x82');return getAccessToken(_0x392d2a)['then'](function(_0x500078){_0x24c2cf=_0x500078;return getUser(_0x24c2cf,_0x11849e,_0x392d2a);})[_0x5514('0x28')](function(_0x36af54){_0x4e7ab2=_0x36af54;logger[_0x5514('0x2c')]('The\x20User\x20ID\x20is:',_0x4e7ab2['id']);return getEndUser(_0x24c2cf,_0x11849e,_0x392d2a,_0x193d9c[_0x5514('0x84')],_0x193d9c[_0x5514('0x8f')],_0x4e7ab2,_0x589dea);})[_0x5514('0x28')](function(_0x315150){_0x4da936=_0x315150;return getCall(_0x24c2cf,_0x11849e,_0x392d2a,_0x4e7ab2,_0x4da936,_0x589dea,_0x193d9c,'Inbound');})[_0x5514('0x28')](function(_0x4b8bdf){if(_0x4b8bdf){logger[_0x5514('0x2c')](_0x5514('0x85'),_0x4b8bdf['id']);}})[_0x5514('0x3f')](function(_0x424c2f){logger['error']('['+_0x193d9c[_0x5514('0x90')][_0x5514('0x91')]()+']',JSON[_0x5514('0x3b')](_0x424c2f));});}; \ 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 71ca605..63a8973 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 _0xdd45=['error','format','%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','trigger','exec','data2','Script','data3','render'];(function(_0x19417c,_0x1ed898){var _0x326045=function(_0x2d7caa){while(--_0x2d7caa){_0x19417c['push'](_0x19417c['shift']());}};_0x326045(++_0x1ed898);}(_0xdd45,0x89));var _0x5dd4=function(_0x17d010,_0x24c04c){_0x17d010=_0x17d010-0x0;var _0xf5b0bb=_0xdd45[_0x17d010];return _0xf5b0bb;};'use strict';var util=require(_0x5dd4('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x5dd4('0x1'));exports[_0x5dd4('0x2')]=function(_0x1186b6,_0x1f754a){var _0xf19662=_0x1186b6[_0x5dd4('0x3')]?_0x1186b6['data2']:_0x5dd4('0x4');var _0x302d36=_0x1186b6[_0x5dd4('0x5')]?Mustache[_0x5dd4('0x6')](_0x1186b6[_0x5dd4('0x5')],_0x1f754a):_0x1f754a;sh[_0x5dd4('0x2')](_0x302d36,function(_0x75fe46,_0x44b946,_0x917f46){if(_0x75fe46!==0x0){logger[_0x5dd4('0x7')](util[_0x5dd4('0x8')](_0x5dd4('0x9'),_0xf19662,_0x302d36,_0x75fe46,_0x917f46));}else{logger[_0x5dd4('0xa')](util[_0x5dd4('0x8')](_0x5dd4('0xb'),_0xf19662,_0x302d36,_0x44b946));}});}; \ No newline at end of file +var _0xdc21=['exec','data2','Script','data3','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger'];(function(_0x4278f2,_0x35a90a){var _0x51f6fd=function(_0x3f44fb){while(--_0x3f44fb){_0x4278f2['push'](_0x4278f2['shift']());}};_0x51f6fd(++_0x35a90a);}(_0xdc21,0xcb));var _0x1dc2=function(_0x3d9877,_0x2beb68){_0x3d9877=_0x3d9877-0x0;var _0x4273cb=_0xdc21[_0x3d9877];return _0x4273cb;};'use strict';var util=require(_0x1dc2('0x0'));var sh=require(_0x1dc2('0x1'));var Mustache=require(_0x1dc2('0x2'));var logger=require(_0x1dc2('0x3'))(_0x1dc2('0x4'));exports[_0x1dc2('0x5')]=function(_0x27a264,_0x5d80d2){var _0x290c94=_0x27a264[_0x1dc2('0x6')]?_0x27a264[_0x1dc2('0x6')]:_0x1dc2('0x7');var _0x4dc712=_0x27a264[_0x1dc2('0x8')]?Mustache['render'](_0x27a264[_0x1dc2('0x8')],_0x5d80d2):_0x5d80d2;sh[_0x1dc2('0x5')](_0x4dc712,function(_0x3280f7,_0x5842c5,_0x2a0d60){if(_0x3280f7!==0x0){logger[_0x1dc2('0x9')](util[_0x1dc2('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x290c94,_0x4dc712,_0x3280f7,_0x2a0d60));}else{logger[_0x1dc2('0xb')](util[_0x1dc2('0xa')](_0x1dc2('0xc'),_0x290c94,_0x4dc712,_0x5842c5));}});}; \ 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 6131f54..b13b6aa 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 _0x7e34=['error','GET','POST','PUT','data7','parse','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','lodash','../../../../config/logger','exec','data1','toUpperCase','data2','number','data5','headers','data6','render'];(function(_0x5f0e48,_0x3a16d9){var _0x2188d=function(_0x508863){while(--_0x508863){_0x5f0e48['push'](_0x5f0e48['shift']());}};_0x2188d(++_0x3a16d9);}(_0x7e34,0xdc));var _0x47e3=function(_0x29c4b2,_0x343ba6){_0x29c4b2=_0x29c4b2-0x0;var _0xad4540=_0x7e34[_0x29c4b2];return _0xad4540;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x47e3('0x0'));var Mustache=require('mustache');var logger=require(_0x47e3('0x1'))('trigger');exports[_0x47e3('0x2')]=function(_0x485189,_0xbdcbfb){var _0xfea4b2,_0x354303;var _0xf167aa={'method':_0x485189[_0x47e3('0x3')][_0x47e3('0x4')](),'uri':Mustache['render'](_0x485189[_0x47e3('0x5')],_0xbdcbfb),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x485189['data5'])===_0x47e3('0x6')&&parseInt(_0x485189[_0x47e3('0x7')])>=0x1&&parseInt(_0x485189[_0x47e3('0x7')])<=0xa?parseInt(_0x485189[_0x47e3('0x7')])*0x3e8:0x5*0x3e8};try{_0xf167aa[_0x47e3('0x8')]=_0x485189[_0x47e3('0x9')]?JSON['parse'](Mustache[_0x47e3('0xa')](_0x485189[_0x47e3('0x9')],_0xbdcbfb)):{};}catch(_0x3b9b3e){logger[_0x47e3('0xb')](_0x3b9b3e['stack']);}switch(_0x485189[_0x47e3('0x3')]['toUpperCase']()){case _0x47e3('0xc'):case'DELETE':_0xfea4b2=null;_0xf167aa['qs']=_0xbdcbfb;break;case _0x47e3('0xd'):case _0x47e3('0xe'):if(_0x485189[_0x47e3('0xf')]){try{_0xfea4b2=JSON[_0x47e3('0x10')](Mustache[_0x47e3('0xa')](_0x485189[_0x47e3('0xf')],_0xbdcbfb));_0xf167aa[_0x47e3('0x11')]=_0xfea4b2;}catch(_0x23dd4b){logger[_0x47e3('0xb')](_0x23dd4b[_0x47e3('0x12')]);logger[_0x47e3('0xb')](_0x47e3('0x13'));}}else{_0xfea4b2=_0xbdcbfb;_0xf167aa[_0x47e3('0x11')]=_0xfea4b2;}break;}logger[_0x47e3('0x14')](util[_0x47e3('0x15')](_0x47e3('0x16'),_0x485189[_0x47e3('0x3')],_0x485189[_0x47e3('0x5')],JSON[_0x47e3('0x17')](_0xf167aa)));rp(_0xf167aa)[_0x47e3('0x18')](function(_0x2ca03c){_0xfea4b2=!_[_0x47e3('0x19')](_0xfea4b2)?_0x47e3('0x1a')+_0xfea4b2:'';_0x354303=typeof _0x2ca03c[_0x47e3('0x11')]===_0x47e3('0x1b')?JSON[_0x47e3('0x17')](_0x2ca03c[_0x47e3('0x11')]):_0x2ca03c[_0x47e3('0x11')];logger[_0x47e3('0x14')](util['format'](_0x47e3('0x1c'),_0x485189['data1'],_0x485189[_0x47e3('0x5')],_0x2ca03c['statusCode'],_0x354303));})['catch'](function(_0x11dc5c){logger['error'](util[_0x47e3('0x15')](_0x47e3('0x1d'),_0x485189[_0x47e3('0x3')],_0x485189['data2'],_0x11dc5c[_0x47e3('0x1e')],_0x11dc5c[_0x47e3('0x1f')],_0x11dc5c[_0x47e3('0x20')]));});}; \ No newline at end of file +var _0xe5a7=['PUT','data7','body','info','format','stringify','then','isNil',',\x20request\x20body:\x20','%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','request-promise','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','error','stack','GET','DELETE','POST'];(function(_0x270718,_0xab9058){var _0x4af2ba=function(_0x5f3dcd){while(--_0x5f3dcd){_0x270718['push'](_0x270718['shift']());}};_0x4af2ba(++_0xab9058);}(_0xe5a7,0x179));var _0x7e5a=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xe5a7[_0x55e08b];return _0xd1a7ff;};'use strict';var rp=require(_0x7e5a('0x0'));var util=require('util');var _=require(_0x7e5a('0x1'));var Mustache=require(_0x7e5a('0x2'));var logger=require(_0x7e5a('0x3'))('trigger');exports[_0x7e5a('0x4')]=function(_0x37fb75,_0x2e5c94){var _0x4f78a3,_0x42dc7f;var _0x348340={'method':_0x37fb75[_0x7e5a('0x5')][_0x7e5a('0x6')](),'uri':Mustache[_0x7e5a('0x7')](_0x37fb75[_0x7e5a('0x8')],_0x2e5c94),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x37fb75['data5'])===_0x7e5a('0x9')&&parseInt(_0x37fb75['data5'])>=0x1&&parseInt(_0x37fb75[_0x7e5a('0xa')])<=0xa?parseInt(_0x37fb75[_0x7e5a('0xa')])*0x3e8:0x5*0x3e8};try{_0x348340[_0x7e5a('0xb')]=_0x37fb75[_0x7e5a('0xc')]?JSON[_0x7e5a('0xd')](Mustache['render'](_0x37fb75[_0x7e5a('0xc')],_0x2e5c94)):{};}catch(_0xe9e1e3){logger[_0x7e5a('0xe')](_0xe9e1e3[_0x7e5a('0xf')]);}switch(_0x37fb75[_0x7e5a('0x5')][_0x7e5a('0x6')]()){case _0x7e5a('0x10'):case _0x7e5a('0x11'):_0x4f78a3=null;_0x348340['qs']=_0x2e5c94;break;case _0x7e5a('0x12'):case _0x7e5a('0x13'):if(_0x37fb75[_0x7e5a('0x14')]){try{_0x4f78a3=JSON['parse'](Mustache[_0x7e5a('0x7')](_0x37fb75[_0x7e5a('0x14')],_0x2e5c94));_0x348340['body']=_0x4f78a3;}catch(_0x501a0c){logger['error'](_0x501a0c[_0x7e5a('0xf')]);logger[_0x7e5a('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x4f78a3=_0x2e5c94;_0x348340[_0x7e5a('0x15')]=_0x4f78a3;}break;}logger[_0x7e5a('0x16')](util[_0x7e5a('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x37fb75['data1'],_0x37fb75[_0x7e5a('0x8')],JSON[_0x7e5a('0x18')](_0x348340)));rp(_0x348340)[_0x7e5a('0x19')](function(_0x34b0cb){_0x4f78a3=!_[_0x7e5a('0x1a')](_0x4f78a3)?_0x7e5a('0x1b')+_0x4f78a3:'';_0x42dc7f=typeof _0x34b0cb[_0x7e5a('0x15')]==='object'?JSON[_0x7e5a('0x18')](_0x34b0cb[_0x7e5a('0x15')]):_0x34b0cb[_0x7e5a('0x15')];logger[_0x7e5a('0x16')](util['format'](_0x7e5a('0x1c'),_0x37fb75[_0x7e5a('0x5')],_0x37fb75['data2'],_0x34b0cb[_0x7e5a('0x1d')],_0x42dc7f));})['catch'](function(_0x5bfd53){logger[_0x7e5a('0xe')](util[_0x7e5a('0x17')](_0x7e5a('0x1e'),_0x37fb75[_0x7e5a('0x5')],_0x37fb75[_0x7e5a('0x8')],_0x5bfd53[_0x7e5a('0x1d')],_0x5bfd53[_0x7e5a('0x1f')],_0x5bfd53[_0x7e5a('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index db794e8..eeb6a2b 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 _0x67b3=['result','exports','jayson/promise','Request','request','debug','routing','error','rpc','message'];(function(_0x28876d,_0x29d339){var _0xfcfc78=function(_0x1c2dcd){while(--_0x1c2dcd){_0x28876d['push'](_0x28876d['shift']());}};_0xfcfc78(++_0x29d339);}(_0x67b3,0x98));var _0x367b=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x67b3[_0x562f3b];return _0x1edd55;};'use strict';var jayson=require(_0x367b('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson['client']['http']({'port':0x2329});client[_0x367b('0x1')]=function(_0x504de8,_0x340b58){return new BPromise(function(_0x577c10,_0x11d1c){return client[_0x367b('0x2')](_0x504de8,_0x340b58)['then'](function(_0x13b65f){logger[_0x367b('0x3')]('rpc',_0x367b('0x4'),_0x504de8,_0x340b58,_0x13b65f);if(_0x13b65f[_0x367b('0x5')]){logger[_0x367b('0x5')](_0x367b('0x6'),_0x367b('0x4'),_0x504de8,_0x13b65f['error'][_0x367b('0x7')],_0x340b58);return _0x11d1c(_0x13b65f[_0x367b('0x5')][_0x367b('0x7')]);}else{return _0x577c10(_0x13b65f[_0x367b('0x8')]);}})['catch'](function(_0x1706c8){logger[_0x367b('0x5')](_0x367b('0x6'),_0x367b('0x4'),_0x504de8,_0x1706c8,_0x340b58);return _0x11d1c(_0x1706c8);});});};module[_0x367b('0x9')]=client; \ No newline at end of file +var _0xbab5=['then','debug','rpc','error','message','catch','exports','jayson/promise','bluebird','routing','client','Request','request'];(function(_0xe6dcc9,_0x78419b){var _0xeb450=function(_0x5438e4){while(--_0x5438e4){_0xe6dcc9['push'](_0xe6dcc9['shift']());}};_0xeb450(++_0x78419b);}(_0xbab5,0x1b4));var _0x5bab=function(_0x246ae4,_0x1a5fec){_0x246ae4=_0x246ae4-0x0;var _0x19f22f=_0xbab5[_0x246ae4];return _0x19f22f;};'use strict';var jayson=require(_0x5bab('0x0'));var BPromise=require(_0x5bab('0x1'));var logger=require('../../config/logger')(_0x5bab('0x2'));var client=jayson[_0x5bab('0x3')]['http']({'port':0x2329});client[_0x5bab('0x4')]=function(_0x383f29,_0x58cfa7){return new BPromise(function(_0x58667c,_0x3a3aa6){return client[_0x5bab('0x5')](_0x383f29,_0x58cfa7)[_0x5bab('0x6')](function(_0x2a2d78){logger[_0x5bab('0x7')](_0x5bab('0x8'),'routing',_0x383f29,_0x58cfa7,_0x2a2d78);if(_0x2a2d78['error']){logger[_0x5bab('0x9')](_0x5bab('0x8'),'routing',_0x383f29,_0x2a2d78['error'][_0x5bab('0xa')],_0x58cfa7);return _0x3a3aa6(_0x2a2d78[_0x5bab('0x9')]['message']);}else{return _0x58667c(_0x2a2d78['result']);}})[_0x5bab('0xb')](function(_0x56c180){logger[_0x5bab('0x9')](_0x5bab('0x8'),_0x5bab('0x2'),_0x383f29,_0x56c180,_0x58cfa7);return _0x3a3aa6(_0x56c180);});});};module[_0x5bab('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5121048..765e4be 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 _0x5777=['resolve','getMailAccounts','then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x3d976a,_0x4042a3){var _0x2c0378=function(_0x5b8fc5){while(--_0x5b8fc5){_0x3d976a['push'](_0x3d976a['shift']());}};_0x2c0378(++_0x4042a3);}(_0x5777,0xb2));var _0x7577=function(_0x4178a7,_0x2df290){_0x4178a7=_0x4178a7-0x0;var _0x5a32e5=_0x5777[_0x4178a7];return _0x5a32e5;};'use strict';var BPromise=require(_0x7577('0x0'));var server=require('./server');var Realtime=require(_0x7577('0x1'));var EmailChannel=require(_0x7577('0x2'));var mailAccount=require(_0x7577('0x3'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x7577('0x4')]()['then'](mailAccount[_0x7577('0x5')]())[_0x7577('0x6')](realtime['initMailAccounts']())[_0x7577('0x6')](function(){email[_0x7577('0x7')](realtime[_0x7577('0x8')]);return realtime;});}function main(){return server[_0x7577('0x9')](realtime,email)[_0x7577('0x6')](function(){return initRealtime();})[_0x7577('0x6')](function(){return setting[_0x7577('0xa')]();})['then'](function(_0x425111){return setInterval(initRealtime,_0x425111[_0x7577('0xb')]*0x3e8);})[_0x7577('0xc')](function(_0x466c7b){console[_0x7577('0xd')](_0x466c7b);});}main(); \ No newline at end of file +var _0xad6b=['./rpc/mailAccount','./rpc/setting','then','initMailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server','./lib/email'];(function(_0x5f4f1,_0x121988){var _0x310966=function(_0x2960bf){while(--_0x2960bf){_0x5f4f1['push'](_0x5f4f1['shift']());}};_0x310966(++_0x121988);}(_0xad6b,0x159));var _0xbad6=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xad6b[_0x4e676e];return _0x336a3c;};'use strict';var BPromise=require(_0xbad6('0x0'));var server=require(_0xbad6('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0xbad6('0x2'));var mailAccount=require(_0xbad6('0x3'));var setting=require(_0xbad6('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xbad6('0x5')](mailAccount['getMailAccounts']())[_0xbad6('0x5')](realtime[_0xbad6('0x6')]())[_0xbad6('0x5')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xbad6('0x7')](realtime,email)[_0xbad6('0x5')](function(){return initRealtime();})[_0xbad6('0x5')](function(){return setting[_0xbad6('0x8')]();})[_0xbad6('0x5')](function(_0x4f3e76){return setInterval(initRealtime,_0x4f3e76[_0xbad6('0x9')]*0x3e8);})[_0xbad6('0xa')](function(_0x1d91f9){console[_0xbad6('0xb')](_0x1d91f9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 666a4e6..20aca9f 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 _0x48ef=['messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','isNil','Smtp','then','verify','exports','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','stringify','md5','mailAccount:update','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','connected'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x48ef,0x190));var _0xf48e=function(_0x4a3553,_0x12e68f){_0x4a3553=_0x4a3553-0x0;var _0x569d42=_0x48ef[_0x4a3553];return _0x569d42;};'use strict';var _=require('lodash');var moment=require(_0xf48e('0x0'));var BPromise=require(_0xf48e('0x1'));var md5=require('md5');var Redis=require(_0xf48e('0x2'));var config=require(_0xf48e('0x3'));var logger=require(_0xf48e('0x4'))(_0xf48e('0x5'));config[_0xf48e('0x6')]=_[_0xf48e('0x7')](config[_0xf48e('0x6')],{'host':_0xf48e('0x8'),'port':0x18eb});var io=require(_0xf48e('0x9'))(new Redis(config['redis']));var EmailImap=require(_0xf48e('0xa'));var EmailSmtp=require(_0xf48e('0xb'));var mailAccount=require(_0xf48e('0xc'));var md5Accounts={};function EmailChannel(_0x1e8861){logger[_0xf48e('0xd')](_0xf48e('0xe'));this[_0xf48e('0xf')]=_0x1e8861[_0xf48e('0xf')];this[_0xf48e('0x10')]={};this[_0xf48e('0x11')]=new EmailSmtp();}EmailChannel[_0xf48e('0x12')][_0xf48e('0x13')]=function(_0x2b0782){var _0x318a20=this['mailAccounts'][_0x2b0782];var _0x317aff={'id':_0x318a20['id'],'name':_0x318a20[_0xf48e('0x14')],'key':_0x318a20[_0xf48e('0x15')],'active':_0x318a20[_0xf48e('0x16')],'Imap':{'status':_0x318a20['Imap']['status'],'messageStatus':_0x318a20[_0xf48e('0x17')][_0xf48e('0x18')],'total':_0x318a20[_0xf48e('0x17')][_0xf48e('0x19')]}};if(_['isNil'](md5Accounts[_0x2b0782])){md5Accounts[_0x2b0782]={};}var _0x5595a=md5(JSON[_0xf48e('0x1a')](_0x317aff));if(md5Accounts[_0x2b0782][_0xf48e('0x1b')]!==_0x5595a){md5Accounts[_0x2b0782][_0xf48e('0x1b')]=_0x5595a;io[_0xf48e('0x13')](_0xf48e('0x1c'),_0x317aff);}};EmailChannel['prototype']['refresh']=function(_0x371c2e){for(var _0x56b1e5 in _0x371c2e){if(_0x371c2e[_0xf48e('0x1d')](_0x56b1e5)){if(_0x371c2e[_0x56b1e5][_0xf48e('0x17')]&&_0x371c2e[_0x56b1e5][_0xf48e('0x16')]){var _0x15ff9b=_0x371c2e[_0x56b1e5][_0xf48e('0x17')];if(!this['imapAccounts']['hasOwnProperty'](_0x15ff9b['id'])){this[_0xf48e('0x10')][_0x15ff9b['id']]=new EmailImap(_0x15ff9b,_0x371c2e[_0x56b1e5]['email']);this['imapAccounts'][_0x15ff9b['id']]['on']('box',this[_0xf48e('0x1e')][_0xf48e('0x1f')](this,_0x56b1e5));this[_0xf48e('0x10')][_0x15ff9b['id']]['on'](_0xf48e('0x5'),this[_0xf48e('0x20')]['bind'](this,_0x56b1e5));this[_0xf48e('0x10')][_0x15ff9b['id']]['on'](_0xf48e('0x21'),this[_0xf48e('0x22')][_0xf48e('0x1f')](this,_0x56b1e5));this[_0xf48e('0x10')][_0x15ff9b['id']]['on'](_0xf48e('0x23'),this[_0xf48e('0x24')]['bind'](this,_0x56b1e5));}}else{if(_['isNil'](this[_0xf48e('0xf')][_0x56b1e5]['Imap'])){this['mailAccounts'][_0x56b1e5][_0xf48e('0x17')]={};}this['mailAccounts'][_0x56b1e5][_0xf48e('0x17')][_0xf48e('0x25')]=_0xf48e('0x26');this['mailAccounts'][_0x56b1e5][_0xf48e('0x17')]['messageStatus']='';this['emit'](_0x56b1e5);}}}};EmailChannel[_0xf48e('0x12')]['handleImapBox']=function(_0x2b7a81,_0x1f9bda){if(this['mailAccounts'][_0x2b7a81]){this[_0xf48e('0xf')][_0x2b7a81]['Imap'][_0xf48e('0x25')]=_0xf48e('0x27');this[_0xf48e('0xf')][_0x2b7a81][_0xf48e('0x17')]['messageStatus']=_0x1f9bda[_0xf48e('0x14')];if(_0x1f9bda[_0xf48e('0x28')]){this['mailAccounts'][_0x2b7a81][_0xf48e('0x17')][_0xf48e('0x19')]=_0x1f9bda['messages'][_0xf48e('0x19')];}return this[_0xf48e('0x13')](_0x2b7a81);}};EmailChannel['prototype'][_0xf48e('0x20')]=function(_0x3a7a11,_0x4c1fed){logger['info'](_0xf48e('0x29'),_0x4c1fed[_0xf48e('0x2a')],_0x4c1fed['lastName'],_0x4c1fed[_0xf48e('0x2b')],_0x3a7a11);if(this[_0xf48e('0xf')][_0x3a7a11]){return mailAccount['notify'](_0x3a7a11,_0x4c1fed)['then'](function(_0xfffd8e){if(_0xfffd8e){logger[_0xf48e('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0xf48e('0x2c')](function(_0x546a75){logger[_0xf48e('0x23')](_0xf48e('0x2d'),JSON['stringify'](_0x546a75));});}};EmailChannel[_0xf48e('0x12')][_0xf48e('0x22')]=function(_0x1d2895){if(this[_0xf48e('0xf')][_0x1d2895]&&this[_0xf48e('0xf')][_0x1d2895][_0xf48e('0x17')]){if(this[_0xf48e('0x10')][this[_0xf48e('0xf')][_0x1d2895][_0xf48e('0x17')]['id']]){delete this[_0xf48e('0x10')][this['mailAccounts'][_0x1d2895][_0xf48e('0x17')]['id']];}this[_0xf48e('0xf')][_0x1d2895][_0xf48e('0x17')][_0xf48e('0x2e')]=moment();this['emit'](_0x1d2895);}};EmailChannel[_0xf48e('0x12')][_0xf48e('0x24')]=function(_0x164d1a,_0x591cbb){if(this['mailAccounts'][_0x164d1a]){this['mailAccounts'][_0x164d1a][_0xf48e('0x17')]['status']=_0xf48e('0x23');this[_0xf48e('0xf')][_0x164d1a][_0xf48e('0x17')][_0xf48e('0x18')]=_0x591cbb;return this[_0xf48e('0x13')](_0x164d1a);}};EmailChannel[_0xf48e('0x12')][_0xf48e('0x2f')]=function(_0x15fc42,_0x4029ed){return this['smtp'][_0xf48e('0x30')](_0x15fc42,_0x4029ed);};EmailChannel[_0xf48e('0x12')][_0xf48e('0x31')]=function(_0x5ed6f3){var _0x6c68f3=this;if(this[_0xf48e('0xf')][_0x5ed6f3['id']]){if(_[_0xf48e('0x32')](this[_0xf48e('0xf')][_0x5ed6f3['id']]['Smtp'])){this['mailAccounts'][_0x5ed6f3['id']][_0xf48e('0x33')]={};}this[_0xf48e('0xf')][_0x5ed6f3['id']][_0xf48e('0x33')][_0xf48e('0x2e')]=moment();return new BPromise(function(_0x5d8af2,_0x3f2e92){return _0x6c68f3[_0xf48e('0x11')]['verify'](_0x5ed6f3)[_0xf48e('0x34')](function(_0x52ac3d){_0x6c68f3[_0xf48e('0xf')][_0x5ed6f3['id']][_0xf48e('0x33')]['status']='verified';_0x6c68f3['mailAccounts'][_0x5ed6f3['id']][_0xf48e('0x33')][_0xf48e('0x18')]='';_0x6c68f3[_0xf48e('0x13')](_0x5ed6f3['id']);_0x5d8af2(_0x52ac3d);})[_0xf48e('0x2c')](function(_0x24b319){_0x6c68f3[_0xf48e('0xf')][_0x5ed6f3['id']][_0xf48e('0x33')][_0xf48e('0x25')]=_0xf48e('0x23');_0x6c68f3[_0xf48e('0xf')][_0x5ed6f3['id']][_0xf48e('0x33')][_0xf48e('0x18')]=_0x24b319;_0x6c68f3[_0xf48e('0x13')](_0x5ed6f3['id']);_0x3f2e92(_0x24b319);});});}return this[_0xf48e('0x11')][_0xf48e('0x35')](_0x5ed6f3);};module[_0xf48e('0x36')]=EmailChannel; \ No newline at end of file +var _0xdf3a=['emit','mailAccount:update','hasOwnProperty','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','send','verifySmtp','Smtp','lastSync','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','active','status','Imap','messageStatus','total','isNil','stringify'];(function(_0x3191f9,_0x52c4d1){var _0x2cb3b0=function(_0x44a247){while(--_0x44a247){_0x3191f9['push'](_0x3191f9['shift']());}};_0x2cb3b0(++_0x52c4d1);}(_0xdf3a,0x1a3));var _0xadf3=function(_0x303b47,_0x3d1f9a){_0x303b47=_0x303b47-0x0;var _0x4785bd=_0xdf3a[_0x303b47];return _0x4785bd;};'use strict';var _=require(_0xadf3('0x0'));var moment=require(_0xadf3('0x1'));var BPromise=require(_0xadf3('0x2'));var md5=require(_0xadf3('0x3'));var Redis=require(_0xadf3('0x4'));var config=require('../../../config/environment');var logger=require(_0xadf3('0x5'))(_0xadf3('0x6'));config[_0xadf3('0x7')]=_[_0xadf3('0x8')](config[_0xadf3('0x7')],{'host':_0xadf3('0x9'),'port':0x18eb});var io=require(_0xadf3('0xa'))(new Redis(config[_0xadf3('0x7')]));var EmailImap=require(_0xadf3('0xb'));var EmailSmtp=require(_0xadf3('0xc'));var mailAccount=require(_0xadf3('0xd'));var md5Accounts={};function EmailChannel(_0x173454){logger[_0xadf3('0xe')](_0xadf3('0xf'));this[_0xadf3('0x10')]=_0x173454[_0xadf3('0x10')];this[_0xadf3('0x11')]={};this[_0xadf3('0x12')]=new EmailSmtp();}EmailChannel[_0xadf3('0x13')]['emit']=function(_0x5e43f3){var _0x5399c2=this[_0xadf3('0x10')][_0x5e43f3];var _0x160d4e={'id':_0x5399c2['id'],'name':_0x5399c2[_0xadf3('0x14')],'key':_0x5399c2[_0xadf3('0x15')],'active':_0x5399c2[_0xadf3('0x16')],'Imap':{'status':_0x5399c2['Imap'][_0xadf3('0x17')],'messageStatus':_0x5399c2[_0xadf3('0x18')][_0xadf3('0x19')],'total':_0x5399c2['Imap'][_0xadf3('0x1a')]}};if(_[_0xadf3('0x1b')](md5Accounts[_0x5e43f3])){md5Accounts[_0x5e43f3]={};}var _0x14a7c5=md5(JSON[_0xadf3('0x1c')](_0x160d4e));if(md5Accounts[_0x5e43f3][_0xadf3('0x3')]!==_0x14a7c5){md5Accounts[_0x5e43f3][_0xadf3('0x3')]=_0x14a7c5;io[_0xadf3('0x1d')](_0xadf3('0x1e'),_0x160d4e);}};EmailChannel[_0xadf3('0x13')]['refresh']=function(_0x307620){for(var _0x2d006d in _0x307620){if(_0x307620[_0xadf3('0x1f')](_0x2d006d)){if(_0x307620[_0x2d006d]['Imap']&&_0x307620[_0x2d006d]['active']){var _0x5e5c26=_0x307620[_0x2d006d]['Imap'];if(!this[_0xadf3('0x11')][_0xadf3('0x1f')](_0x5e5c26['id'])){this['imapAccounts'][_0x5e5c26['id']]=new EmailImap(_0x5e5c26,_0x307620[_0x2d006d][_0xadf3('0x6')]);this[_0xadf3('0x11')][_0x5e5c26['id']]['on'](_0xadf3('0x20'),this[_0xadf3('0x21')]['bind'](this,_0x2d006d));this['imapAccounts'][_0x5e5c26['id']]['on'](_0xadf3('0x6'),this[_0xadf3('0x22')][_0xadf3('0x23')](this,_0x2d006d));this['imapAccounts'][_0x5e5c26['id']]['on'](_0xadf3('0x24'),this[_0xadf3('0x25')][_0xadf3('0x23')](this,_0x2d006d));this[_0xadf3('0x11')][_0x5e5c26['id']]['on']('error',this['handleImapError']['bind'](this,_0x2d006d));}}else{if(_['isNil'](this['mailAccounts'][_0x2d006d]['Imap'])){this[_0xadf3('0x10')][_0x2d006d][_0xadf3('0x18')]={};}this['mailAccounts'][_0x2d006d][_0xadf3('0x18')][_0xadf3('0x17')]=_0xadf3('0x26');this[_0xadf3('0x10')][_0x2d006d][_0xadf3('0x18')]['messageStatus']='';this[_0xadf3('0x1d')](_0x2d006d);}}}};EmailChannel[_0xadf3('0x13')][_0xadf3('0x21')]=function(_0x234888,_0xaceef9){if(this['mailAccounts'][_0x234888]){this[_0xadf3('0x10')][_0x234888][_0xadf3('0x18')]['status']='connected';this['mailAccounts'][_0x234888]['Imap']['messageStatus']=_0xaceef9[_0xadf3('0x14')];if(_0xaceef9[_0xadf3('0x27')]){this['mailAccounts'][_0x234888][_0xadf3('0x18')][_0xadf3('0x1a')]=_0xaceef9[_0xadf3('0x27')]['total'];}return this['emit'](_0x234888);}};EmailChannel['prototype'][_0xadf3('0x22')]=function(_0x4a9817,_0x3d6881){logger['info'](_0xadf3('0x28'),_0x3d6881[_0xadf3('0x29')],_0x3d6881[_0xadf3('0x2a')],_0x3d6881[_0xadf3('0x2b')],_0x4a9817);if(this[_0xadf3('0x10')][_0x4a9817]){return mailAccount[_0xadf3('0x2c')](_0x4a9817,_0x3d6881)['then'](function(_0x38f569){if(_0x38f569){logger[_0xadf3('0xe')](_0xadf3('0x2d'));}})[_0xadf3('0x2e')](function(_0x5b6beb){logger[_0xadf3('0x2f')](_0xadf3('0x30'),JSON['stringify'](_0x5b6beb));});}};EmailChannel[_0xadf3('0x13')][_0xadf3('0x25')]=function(_0x2f9fc4){if(this[_0xadf3('0x10')][_0x2f9fc4]&&this[_0xadf3('0x10')][_0x2f9fc4][_0xadf3('0x18')]){if(this[_0xadf3('0x11')][this[_0xadf3('0x10')][_0x2f9fc4][_0xadf3('0x18')]['id']]){delete this[_0xadf3('0x11')][this[_0xadf3('0x10')][_0x2f9fc4][_0xadf3('0x18')]['id']];}this[_0xadf3('0x10')][_0x2f9fc4][_0xadf3('0x18')]['lastSync']=moment();this[_0xadf3('0x1d')](_0x2f9fc4);}};EmailChannel[_0xadf3('0x13')][_0xadf3('0x31')]=function(_0x19bc6c,_0x4c9e82){if(this[_0xadf3('0x10')][_0x19bc6c]){this[_0xadf3('0x10')][_0x19bc6c]['Imap'][_0xadf3('0x17')]=_0xadf3('0x2f');this['mailAccounts'][_0x19bc6c][_0xadf3('0x18')][_0xadf3('0x19')]=_0x4c9e82;return this[_0xadf3('0x1d')](_0x19bc6c);}};EmailChannel['prototype']['sendMail']=function(_0x2a7823,_0x534d90){return this[_0xadf3('0x12')][_0xadf3('0x32')](_0x2a7823,_0x534d90);};EmailChannel['prototype'][_0xadf3('0x33')]=function(_0x310b6b){var _0xe76107=this;if(this[_0xadf3('0x10')][_0x310b6b['id']]){if(_[_0xadf3('0x1b')](this['mailAccounts'][_0x310b6b['id']][_0xadf3('0x34')])){this['mailAccounts'][_0x310b6b['id']][_0xadf3('0x34')]={};}this[_0xadf3('0x10')][_0x310b6b['id']][_0xadf3('0x34')][_0xadf3('0x35')]=moment();return new BPromise(function(_0x3c5654,_0x58f33d){return _0xe76107[_0xadf3('0x12')][_0xadf3('0x36')](_0x310b6b)['then'](function(_0x8b6403){_0xe76107[_0xadf3('0x10')][_0x310b6b['id']][_0xadf3('0x34')][_0xadf3('0x17')]=_0xadf3('0x37');_0xe76107['mailAccounts'][_0x310b6b['id']]['Smtp'][_0xadf3('0x19')]='';_0xe76107[_0xadf3('0x1d')](_0x310b6b['id']);_0x3c5654(_0x8b6403);})[_0xadf3('0x2e')](function(_0x138688){_0xe76107[_0xadf3('0x10')][_0x310b6b['id']]['Smtp'][_0xadf3('0x17')]=_0xadf3('0x2f');_0xe76107['mailAccounts'][_0x310b6b['id']][_0xadf3('0x34')]['messageStatus']=_0x138688;_0xe76107['emit'](_0x310b6b['id']);_0x58f33d(_0x138688);});});}return this[_0xadf3('0x12')][_0xadf3('0x36')](_0x310b6b);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 2f364bf..6711aa2 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 _0x32ef=['Iconv','EventEmitter','./utils','../../../config/logger','email','INBOX','getAccount','account','once','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','upperFirst','path','util','imap','lodash','randomstring','mailparser','iconv'];(function(_0x2f5f36,_0xf875f3){var _0x21fc9b=function(_0x432298){while(--_0x432298){_0x2f5f36['push'](_0x2f5f36['shift']());}};_0x21fc9b(++_0xf875f3);}(_0x32ef,0xf9));var _0xf32e=function(_0x2bb428,_0x2379ac){_0x2bb428=_0x2bb428-0x0;var _0x43b1a1=_0x32ef[_0x2bb428];return _0x43b1a1;};'use strict';var fs=require('fs');var path=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var Imap=require(_0xf32e('0x2'));var _=require(_0xf32e('0x3'));var rs=require(_0xf32e('0x4'));var simpleParser=require(_0xf32e('0x5'))['simpleParser'];var Iconv=require(_0xf32e('0x6'))[_0xf32e('0x7')];var EventEmitter=require('events')[_0xf32e('0x8')];var utils=require(_0xf32e('0x9'));var logger=require(_0xf32e('0xa'))(_0xf32e('0xb'));function EmailImap(_0xefc0a7,_0x899efc){this['mailbox']=_0xf32e('0xc');this['account']=this[_0xf32e('0xd')](_0xefc0a7,_0x899efc);this[_0xf32e('0x2')]=new Imap(this[_0xf32e('0xe')]);this[_0xf32e('0x2')][_0xf32e('0xf')]('ready',this[_0xf32e('0x10')][_0xf32e('0x11')](this));this[_0xf32e('0x2')][_0xf32e('0xf')](_0xf32e('0x12'),this[_0xf32e('0x13')][_0xf32e('0x11')](this));this[_0xf32e('0x2')]['on'](_0xf32e('0x14'),this[_0xf32e('0x15')][_0xf32e('0x11')](this));this['imap'][_0xf32e('0x16')]();}util[_0xf32e('0x17')](EmailImap,EventEmitter);EmailImap[_0xf32e('0x18')][_0xf32e('0xd')]=function(_0x35988d,_0x458002){var _0x5c5ab7={'connTimeout':_0x35988d[_0xf32e('0x19')]?_0x35988d[_0xf32e('0x19')]*0x3e8:0x2710,'authTimeout':_0x35988d[_0xf32e('0x1a')]?_0x35988d[_0xf32e('0x1a')]*0x3e8:0x1388};if(_[_0xf32e('0x1b')](_0x35988d[_0xf32e('0x1c')])){if(_0x35988d[_0xf32e('0x1d')]){_0x5c5ab7[_0xf32e('0x1e')]=_0x35988d[_0xf32e('0x1e')];_0x5c5ab7['password']=_0x35988d[_0xf32e('0x1f')];}_0x5c5ab7[_0xf32e('0x20')]=_0x35988d[_0xf32e('0x20')];_0x5c5ab7[_0xf32e('0x21')]=_0x35988d[_0xf32e('0x21')]||0x3e1;if(_0x35988d[_0xf32e('0x22')]){_0x5c5ab7[_0xf32e('0x22')]=!![];}else{_0x5c5ab7[_0xf32e('0x22')]=![];_0x5c5ab7[_0xf32e('0x23')]=_0xf32e('0x24');}}else{_0x5c5ab7[_0xf32e('0x1e')]=_0x35988d[_0xf32e('0x1e')];_0x5c5ab7[_0xf32e('0x1f')]=_0x35988d[_0xf32e('0x1f')];_0x5c5ab7[_0xf32e('0x20')]=utils['getHost'](_0x35988d[_0xf32e('0x1c')]);_0x5c5ab7['port']=0x3e1;_0x5c5ab7[_0xf32e('0x22')]=!![];}_0x5c5ab7[_0xf32e('0xb')]=_0x458002||_0x35988d[_0xf32e('0x1e')]||_0xf32e('0x25');return _0x5c5ab7;};EmailImap[_0xf32e('0x18')]['handleReady']=function(){this[_0xf32e('0x2')][_0xf32e('0x26')](this[_0xf32e('0x27')],![],this[_0xf32e('0x28')]['bind'](this));};EmailImap[_0xf32e('0x18')][_0xf32e('0x28')]=function(_0x2e8c34,_0xe0a285){if(_0x2e8c34){this[_0xf32e('0x15')](_0x2e8c34,!![]);}else{this[_0xf32e('0x29')](_0xf32e('0x2a'),_0xe0a285);this[_0xf32e('0x2b')]();}};EmailImap[_0xf32e('0x18')][_0xf32e('0x2c')]=function(_0x488489){if(_0x488489){this[_0xf32e('0x15')](_0x488489,!![]);}else{this[_0xf32e('0x2')][_0xf32e('0x12')]();}};EmailImap['prototype'][_0xf32e('0x2b')]=function(){this['imap'][_0xf32e('0x2d')](['UNSEEN'],this[_0xf32e('0x2e')][_0xf32e('0x11')](this));};EmailImap[_0xf32e('0x18')][_0xf32e('0x2e')]=function(_0x32a74b,_0x4e64d4){if(_0x32a74b){this[_0xf32e('0x15')](_0x32a74b,!![]);}else{if(_0x4e64d4[_0xf32e('0x2f')]){try{var _0x175096=this['imap'][_0xf32e('0x30')](_0x4e64d4,{'bodies':'','markSeen':!![]});_0x175096['on'](_0xf32e('0x31'),this[_0xf32e('0x32')][_0xf32e('0x11')](this));_0x175096[_0xf32e('0xf')](_0xf32e('0x14'),this[_0xf32e('0x33')][_0xf32e('0x11')](this));_0x175096[_0xf32e('0xf')](_0xf32e('0x12'),this[_0xf32e('0x34')][_0xf32e('0x11')](this));}catch(_0xe36079){logger['error'](_0xe36079);}}else{this[_0xf32e('0x2')]['closeBox'](!![],this[_0xf32e('0x2c')]['bind'](this));}}};EmailImap['prototype'][_0xf32e('0x32')]=function(_0x300013,_0x37231c){_0x300013['on'](_0xf32e('0x35'),this[_0xf32e('0x36')]['bind'](this));_0x300013[_0xf32e('0xf')](_0xf32e('0x37'),this[_0xf32e('0x38')][_0xf32e('0x11')](this));_0x300013['once'](_0xf32e('0x12'),this[_0xf32e('0x39')][_0xf32e('0x11')](this));};EmailImap[_0xf32e('0x18')][_0xf32e('0x36')]=function(_0x576f37,_0xb5e9a6){simpleParser(_0x576f37,{'Iconv':Iconv},this[_0xf32e('0x3a')][_0xf32e('0x11')](this));};EmailImap['prototype'][_0xf32e('0x38')]=function(_0x53b641){};EmailImap[_0xf32e('0x18')][_0xf32e('0x39')]=function(){};EmailImap[_0xf32e('0x18')]['handleSimpleParser']=function(_0x409701,_0x3a156b){if(_0x409701){logger[_0xf32e('0x14')](_0x409701);}else{var _0x4a623=this;utils[_0xf32e('0x3b')](this[_0xf32e('0xe')],_0x3a156b,function(_0x583e5b){_0x4a623[_0xf32e('0x29')](_0xf32e('0xb'),_0x583e5b);});}};EmailImap[_0xf32e('0x18')][_0xf32e('0x34')]=function(){this[_0xf32e('0x2')][_0xf32e('0x3c')](!![],this[_0xf32e('0x2c')]['bind'](this));};EmailImap[_0xf32e('0x18')][_0xf32e('0x33')]=function(_0x41fbb1){this[_0xf32e('0x15')](_0x41fbb1);this[_0xf32e('0x2')][_0xf32e('0x3c')](!![],this[_0xf32e('0x2c')]['bind'](this));};EmailImap[_0xf32e('0x18')][_0xf32e('0x13')]=function(){this[_0xf32e('0x29')](_0xf32e('0x12'));};EmailImap[_0xf32e('0x18')][_0xf32e('0x15')]=function(_0x1bff7b,_0x3ce422){logger[_0xf32e('0x14')](_0xf32e('0x15'),this['account'][_0xf32e('0xb')],JSON[_0xf32e('0x3d')](_0x1bff7b));var _0xbd0442='';if(_0x1bff7b){if(_0x1bff7b[_0xf32e('0x3e')]){_0xbd0442=_0x1bff7b[_0xf32e('0x3e')];}else{for(var _0x120410 in _0x1bff7b){if(_0x1bff7b['hasOwnProperty'](_0x120410)){_0xbd0442+=_[_0xf32e('0x3f')](_0x120410)+':\x20'+_0x1bff7b[_0x120410]+'\x0a';}}}}if(_0x3ce422){this[_0xf32e('0x2')][_0xf32e('0x12')]();}else{this[_0xf32e('0x29')](_0xf32e('0x14'),_0xbd0442);this['emit'](_0xf32e('0x12'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x9c44=['handleFetchMessage','error','handleFetchEnd','closeBox','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','lodash','randomstring','mailparser','simpleParser','iconv','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','once','bind','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','openBox','handleOpenBox','emit','box','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','message'];(function(_0x20daa4,_0x25ada7){var _0x15c123=function(_0x228736){while(--_0x228736){_0x20daa4['push'](_0x20daa4['shift']());}};_0x15c123(++_0x25ada7);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var simpleParser=require(_0x49c4('0x3'))[_0x49c4('0x4')];var Iconv=require(_0x49c4('0x5'))['Iconv'];var EventEmitter=require('events')[_0x49c4('0x6')];var utils=require('./utils');var logger=require(_0x49c4('0x7'))(_0x49c4('0x8'));function EmailImap(_0x69bc41,_0x2c4e2e){this[_0x49c4('0x9')]='INBOX';this[_0x49c4('0xa')]=this[_0x49c4('0xb')](_0x69bc41,_0x2c4e2e);this[_0x49c4('0x0')]=new Imap(this[_0x49c4('0xa')]);this['imap']['once'](_0x49c4('0xc'),this[_0x49c4('0xd')]['bind'](this));this[_0x49c4('0x0')][_0x49c4('0xe')]('end',this['handleEnd'][_0x49c4('0xf')](this));this[_0x49c4('0x0')]['on']('error',this[_0x49c4('0x10')][_0x49c4('0xf')](this));this['imap'][_0x49c4('0x11')]();}util[_0x49c4('0x12')](EmailImap,EventEmitter);EmailImap[_0x49c4('0x13')][_0x49c4('0xb')]=function(_0x12777c,_0x18211c){var _0x75ea8={'connTimeout':_0x12777c[_0x49c4('0x14')]?_0x12777c['connTimeout']*0x3e8:0x2710,'authTimeout':_0x12777c[_0x49c4('0x15')]?_0x12777c[_0x49c4('0x15')]*0x3e8:0x1388};if(_[_0x49c4('0x16')](_0x12777c[_0x49c4('0x17')])){if(_0x12777c[_0x49c4('0x18')]){_0x75ea8['user']=_0x12777c[_0x49c4('0x19')];_0x75ea8[_0x49c4('0x1a')]=_0x12777c['password'];}_0x75ea8['host']=_0x12777c[_0x49c4('0x1b')];_0x75ea8[_0x49c4('0x1c')]=_0x12777c[_0x49c4('0x1c')]||0x3e1;if(_0x12777c['tls']){_0x75ea8[_0x49c4('0x1d')]=!![];}else{_0x75ea8['tls']=![];_0x75ea8[_0x49c4('0x1e')]=_0x49c4('0x1f');}}else{_0x75ea8[_0x49c4('0x19')]=_0x12777c[_0x49c4('0x19')];_0x75ea8[_0x49c4('0x1a')]=_0x12777c[_0x49c4('0x1a')];_0x75ea8[_0x49c4('0x1b')]=utils[_0x49c4('0x20')](_0x12777c[_0x49c4('0x17')]);_0x75ea8['port']=0x3e1;_0x75ea8['tls']=!![];}_0x75ea8['email']=_0x18211c||_0x12777c[_0x49c4('0x19')]||'anonymous@xcally.com';return _0x75ea8;};EmailImap['prototype'][_0x49c4('0xd')]=function(){this[_0x49c4('0x0')][_0x49c4('0x21')](this[_0x49c4('0x9')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x49c4('0x13')][_0x49c4('0x22')]=function(_0x565423,_0x207358){if(_0x565423){this[_0x49c4('0x10')](_0x565423,!![]);}else{this[_0x49c4('0x23')](_0x49c4('0x24'),_0x207358);this['readUnseen']();}};EmailImap['prototype'][_0x49c4('0x25')]=function(_0x53c199){if(_0x53c199){this[_0x49c4('0x10')](_0x53c199,!![]);}else{this[_0x49c4('0x0')][_0x49c4('0x26')]();}};EmailImap[_0x49c4('0x13')]['readUnseen']=function(){this[_0x49c4('0x0')][_0x49c4('0x27')]([_0x49c4('0x28')],this[_0x49c4('0x29')][_0x49c4('0xf')](this));};EmailImap[_0x49c4('0x13')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_0x427b26){this[_0x49c4('0x10')](_0x427b26,!![]);}else{if(_0x17b50f[_0x49c4('0x2a')]){try{var _0x4ea6ea=this['imap']['fetch'](_0x17b50f,{'bodies':'','markSeen':!![]});_0x4ea6ea['on'](_0x49c4('0x2b'),this[_0x49c4('0x2c')][_0x49c4('0xf')](this));_0x4ea6ea[_0x49c4('0xe')](_0x49c4('0x2d'),this['handleFetchError'][_0x49c4('0xf')](this));_0x4ea6ea[_0x49c4('0xe')](_0x49c4('0x26'),this[_0x49c4('0x2e')]['bind'](this));}catch(_0x57a29c){logger[_0x49c4('0x2d')](_0x57a29c);}}else{this[_0x49c4('0x0')][_0x49c4('0x2f')](!![],this[_0x49c4('0x25')][_0x49c4('0xf')](this));}}};EmailImap['prototype'][_0x49c4('0x2c')]=function(_0x84c621,_0x1bfa0f){_0x84c621['on']('body',this['handleMessageBody'][_0x49c4('0xf')](this));_0x84c621[_0x49c4('0xe')](_0x49c4('0x30'),this[_0x49c4('0x31')][_0x49c4('0xf')](this));_0x84c621[_0x49c4('0xe')](_0x49c4('0x26'),this[_0x49c4('0x32')][_0x49c4('0xf')](this));};EmailImap['prototype'][_0x49c4('0x33')]=function(_0x5b96df,_0xdda586){simpleParser(_0x5b96df,{'Iconv':Iconv},this[_0x49c4('0x34')][_0x49c4('0xf')](this));};EmailImap[_0x49c4('0x13')]['handleMessageAttributes']=function(_0x335f0c){};EmailImap[_0x49c4('0x13')][_0x49c4('0x32')]=function(){};EmailImap['prototype'][_0x49c4('0x34')]=function(_0x21d8c7,_0x178987){if(_0x21d8c7){logger[_0x49c4('0x2d')](_0x21d8c7);}else{var _0x1ba7a0=this;utils[_0x49c4('0x35')](this[_0x49c4('0xa')],_0x178987,function(_0x2ba76a){_0x1ba7a0[_0x49c4('0x23')](_0x49c4('0x8'),_0x2ba76a);});}};EmailImap[_0x49c4('0x13')]['handleFetchEnd']=function(){this[_0x49c4('0x0')][_0x49c4('0x2f')](!![],this[_0x49c4('0x25')][_0x49c4('0xf')](this));};EmailImap[_0x49c4('0x13')][_0x49c4('0x36')]=function(_0x1be62d){this[_0x49c4('0x10')](_0x1be62d);this[_0x49c4('0x0')][_0x49c4('0x2f')](!![],this[_0x49c4('0x25')][_0x49c4('0xf')](this));};EmailImap[_0x49c4('0x13')]['handleEnd']=function(){this[_0x49c4('0x23')]('end');};EmailImap[_0x49c4('0x13')][_0x49c4('0x10')]=function(_0x28d4fb,_0x1480da){logger[_0x49c4('0x2d')](_0x49c4('0x10'),this['account']['email'],JSON[_0x49c4('0x37')](_0x28d4fb));var _0x1e7bdc='';if(_0x28d4fb){if(_0x28d4fb[_0x49c4('0x38')]){_0x1e7bdc=_0x28d4fb[_0x49c4('0x38')];}else{for(var _0x490823 in _0x28d4fb){if(_0x28d4fb[_0x49c4('0x39')](_0x490823)){_0x1e7bdc+=_[_0x49c4('0x3a')](_0x490823)+':\x20'+_0x28d4fb[_0x490823]+'\x0a';}}}}if(_0x1480da){this[_0x49c4('0x0')][_0x49c4('0x26')]();}else{this[_0x49c4('0x23')](_0x49c4('0x2d'),_0x1e7bdc);this[_0x49c4('0x23')](_0x49c4('0x26'));}};module[_0x49c4('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index f2c54b2..e249b47 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 _0x750a=['createTransport','Not\x20verifired','nodemailer','bluebird','prototype','compile','sendMail','toString','verify'];(function(_0x25ded9,_0x5c740f){var _0x312705=function(_0x21f940){while(--_0x21f940){_0x25ded9['push'](_0x25ded9['shift']());}};_0x312705(++_0x5c740f);}(_0x750a,0x161));var _0xa750=function(_0x509f5a,_0xe0ec2f){_0x509f5a=_0x509f5a-0x0;var _0x302aa3=_0x750a[_0x509f5a];return _0x302aa3;};'use strict';var nodemailer=require(_0xa750('0x0'));var BPromise=require(_0xa750('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xa750('0x2')]['send']=function(_0x160a9b,_0x5df86b){return new BPromise(function(_0x26b52d,_0x29ef10){var _0x509da1=nodemailer['createTransport'](_0x160a9b);_0x509da1['use'](_0xa750('0x3'),inlineBase64());_0x509da1[_0xa750('0x4')](_0x5df86b,function(_0x27fdac,_0x2e486e){if(_0x27fdac){_0x29ef10(_0x27fdac[_0xa750('0x5')]());}else{_0x26b52d(_0x2e486e);}});});};EmailSmtp[_0xa750('0x2')][_0xa750('0x6')]=function(_0x3c5621){return new BPromise(function(_0x2699bf,_0x40c51e){var _0x4581ab=nodemailer[_0xa750('0x7')](_0x3c5621);_0x4581ab[_0xa750('0x6')](function(_0xbdc72,_0x2127f2){if(_0xbdc72){_0x40c51e(_0xbdc72[_0xa750('0x5')]());}else{if(_0x2127f2){_0x2699bf(_0x2127f2);}else{_0x40c51e(_0xa750('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x5cda=['nodemailer','bluebird','send','use','compile','sendMail','toString','prototype','verify','Not\x20verifired','exports'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x5cda,0xa5));var _0xa5cd=function(_0x499029,_0xa41dab){_0x499029=_0x499029-0x0;var _0xea8b32=_0x5cda[_0x499029];return _0xea8b32;};'use strict';var nodemailer=require(_0xa5cd('0x0'));var BPromise=require(_0xa5cd('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xa5cd('0x2')]=function(_0xd11475,_0x6eb336){return new BPromise(function(_0x452d3f,_0x5688bc){var _0x4b79ed=nodemailer['createTransport'](_0xd11475);_0x4b79ed[_0xa5cd('0x3')](_0xa5cd('0x4'),inlineBase64());_0x4b79ed[_0xa5cd('0x5')](_0x6eb336,function(_0x80f7bc,_0x166a33){if(_0x80f7bc){_0x5688bc(_0x80f7bc[_0xa5cd('0x6')]());}else{_0x452d3f(_0x166a33);}});});};EmailSmtp[_0xa5cd('0x7')]['verify']=function(_0x41f168){return new BPromise(function(_0x3e3d11,_0x5e2cb1){var _0x42bbf3=nodemailer['createTransport'](_0x41f168);_0x42bbf3[_0xa5cd('0x8')](function(_0x15a546,_0x51d94f){if(_0x15a546){_0x5e2cb1(_0x15a546[_0xa5cd('0x6')]());}else{if(_0x51d94f){_0x3e3d11(_0x51d94f);}else{_0x5e2cb1(_0xa5cd('0x9'));}}});});};module[_0xa5cd('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 6901f4f..6c80b37 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 _0xcf2f=['type','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','contentType','parser','from','subject','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','length','slice','join','isEmpty','html','test','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc'];(function(_0x102b8d,_0x572411){var _0x4ae883=function(_0x19c6a4){while(--_0x19c6a4){_0x102b8d['push'](_0x102b8d['shift']());}};_0x4ae883(++_0x572411);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x240650,_0x521133){_0x240650=_0x240650-0x0;var _0x3e5303=_0xcf2f[_0x240650];return _0x3e5303;};'use strict';var _=require(_0xfcf2('0x0'));var moment=require(_0xfcf2('0x1'));var random=require(_0xfcf2('0x2'));var fs=require('fs');var path=require(_0xfcf2('0x3'));var util=require(_0xfcf2('0x4'));var tnef=require('node-tnef');var logger=require(_0xfcf2('0x5'))(_0xfcf2('0x6'));var config=require(_0xfcf2('0x7'));function getAddress(_0x34bcaf){var _0x179e60=_[_0xfcf2('0x8')](_0x34bcaf[_0xfcf2('0x9')]);return _0x179e60&&_0x179e60[_0xfcf2('0xa')]?_0x179e60[_0xfcf2('0xa')]:_0xfcf2('0xb')+random[_0xfcf2('0xc')](0x6)+_0xfcf2('0xd');}function getFirstName(_0xb4c510){var _0x13ce18=_['head'](_0xb4c510['value']);if(_0x13ce18&&_0x13ce18['name']){var _0x91b579=_0x13ce18[_0xfcf2('0xe')]['split'](/\s+/);return _0x91b579[_0xfcf2('0xf')]?_0x91b579[_0xfcf2('0x10')](0x0,-0x1)[_0xfcf2('0x11')]('\x20'):_0x13ce18[_0xfcf2('0xe')];}return'Anonymous';}function getLastName(_0x4bb3ca){var _0xec301d=_[_0xfcf2('0x8')](_0x4bb3ca[_0xfcf2('0x9')]);if(_0xec301d&&_0xec301d[_0xfcf2('0xe')]){var _0x49e204=_0xec301d[_0xfcf2('0xe')]['split'](/\s+/);return _0x49e204['length']>0x1?_0x49e204['pop']():'';}return'';}function getMails(_0xc87ff4,_0x5ef004){var _0x3aa6c0='';for(var _0x1febf8=0x0;_0x1febf8<_0x5ef004[_0xfcf2('0x9')][_0xfcf2('0xf')];_0x1febf8+=0x1){if(_0x5ef004[_0xfcf2('0x9')][_0x1febf8][_0xfcf2('0xa')]!==_0xc87ff4){if(!_[_0xfcf2('0x12')](_0x3aa6c0)){_0x3aa6c0+=',';}_0x3aa6c0+=_0x5ef004['value'][_0x1febf8][_0xfcf2('0xe')]||_0x5ef004[_0xfcf2('0x9')][_0x1febf8][_0xfcf2('0xa')]||'';_0x3aa6c0+='\x20<';_0x3aa6c0+=_0x5ef004['value'][_0x1febf8][_0xfcf2('0xa')]?_0x5ef004[_0xfcf2('0x9')][_0x1febf8][_0xfcf2('0xa')]:_0xfcf2('0xb')+random[_0xfcf2('0xc')](0x6)+'@xcally.com';_0x3aa6c0+='>';}}return _0x3aa6c0;}function parseEmail(_0x203301,_0x11c34f,_0x4939e4){if(_0x11c34f[_0xfcf2('0x13')]){var _0x23c079=/)<[^<]*)*<\/script>/gi;while(_0x23c079[_0xfcf2('0x14')](_0x11c34f[_0xfcf2('0x13')])){_0x11c34f[_0xfcf2('0x13')]=_0x11c34f[_0xfcf2('0x13')][_0xfcf2('0x15')](_0x23c079,'');}if(_0x11c34f[_0xfcf2('0x13')][_0xfcf2('0x16')]('{_0x3790ed[_0xfcf2('0x19')](_0x584e76[_0xfcf2('0x1a')]);});var _0x5ddea1=/]+>/g;var _0x3c3774=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0xbc8722=_0x11c34f['html'][_0xfcf2('0x15')](_0x3c3774,_0xfcf2('0x1b'));var _0x1f0f07=_0xbc8722[_0xfcf2('0x15')](_0x5ddea1,'_IMG');for(let _0x1deca3=0x0;_0x1deca3<_0x3790ed[_0xfcf2('0xf')];_0x1deca3++){var _0x2a9d64=_0x1f0f07[_0xfcf2('0x15')](_0xfcf2('0x1c'),_0xfcf2('0x1d')+_0x3790ed[_0x1deca3]+_0xfcf2('0x1e'));_0x1f0f07=_0x2a9d64;}_0x11c34f[_0xfcf2('0x13')]=_0x1f0f07;}_0x4939e4[_0xfcf2('0x1f')]=_0x11c34f['html'];}else{_0x4939e4['body']=_0x11c34f[_0xfcf2('0x20')];}if(_0x4939e4[_0xfcf2('0x1f')]){_0x4939e4[_0xfcf2('0x1f')]=_0x4939e4['body'][_0xfcf2('0x15')](/Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','127.0.0.1','randomstring','path','util','email','../../../config/environment','head','address','anonymous','generate','value','name','split','length','slice','join','Anonymous','pop','isEmpty','@xcally.com','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml'];(function(_0x6eba65,_0x1c4afa){var _0x4fe862=function(_0x51cd30){while(--_0x51cd30){_0x6eba65['push'](_0x6eba65['shift']());}};_0x4fe862(++_0x1c4afa);}(_0x1a85,0x178));var _0x51a8=function(_0x52fd3d,_0x3af718){_0x52fd3d=_0x52fd3d-0x0;var _0x49b06d=_0x1a85[_0x52fd3d];return _0x49b06d;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x51a8('0x0'));var fs=require('fs');var path=require(_0x51a8('0x1'));var util=require(_0x51a8('0x2'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0x51a8('0x3'));var config=require(_0x51a8('0x4'));function getAddress(_0x99e371){var _0x48a21b=_[_0x51a8('0x5')](_0x99e371['value']);return _0x48a21b&&_0x48a21b[_0x51a8('0x6')]?_0x48a21b['address']:_0x51a8('0x7')+random[_0x51a8('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x228c64){var _0x513685=_['head'](_0x228c64[_0x51a8('0x9')]);if(_0x513685&&_0x513685[_0x51a8('0xa')]){var _0x1a476d=_0x513685[_0x51a8('0xa')][_0x51a8('0xb')](/\s+/);return _0x1a476d[_0x51a8('0xc')]?_0x1a476d[_0x51a8('0xd')](0x0,-0x1)[_0x51a8('0xe')]('\x20'):_0x513685[_0x51a8('0xa')];}return _0x51a8('0xf');}function getLastName(_0xc7c203){var _0xc46d7=_[_0x51a8('0x5')](_0xc7c203[_0x51a8('0x9')]);if(_0xc46d7&&_0xc46d7[_0x51a8('0xa')]){var _0x2e1629=_0xc46d7[_0x51a8('0xa')]['split'](/\s+/);return _0x2e1629[_0x51a8('0xc')]>0x1?_0x2e1629[_0x51a8('0x10')]():'';}return'';}function getMails(_0xaec066,_0x50d992){var _0xf4eb6e='';for(var _0x547d40=0x0;_0x547d40<_0x50d992[_0x51a8('0x9')][_0x51a8('0xc')];_0x547d40+=0x1){if(_0x50d992[_0x51a8('0x9')][_0x547d40][_0x51a8('0x6')]!==_0xaec066){if(!_[_0x51a8('0x11')](_0xf4eb6e)){_0xf4eb6e+=',';}_0xf4eb6e+=_0x50d992[_0x51a8('0x9')][_0x547d40][_0x51a8('0xa')]||_0x50d992['value'][_0x547d40][_0x51a8('0x6')]||'';_0xf4eb6e+='\x20<';_0xf4eb6e+=_0x50d992[_0x51a8('0x9')][_0x547d40][_0x51a8('0x6')]?_0x50d992[_0x51a8('0x9')][_0x547d40][_0x51a8('0x6')]:_0x51a8('0x7')+random['generate'](0x6)+_0x51a8('0x12');_0xf4eb6e+='>';}}return _0xf4eb6e;}function parseEmail(_0x3b7e7e,_0x2217ce,_0x2f2681){if(_0x2217ce[_0x51a8('0x13')]){var _0x3bc044=/)<[^<]*)*<\/script>/gi;while(_0x3bc044[_0x51a8('0x14')](_0x2217ce[_0x51a8('0x13')])){_0x2217ce['html']=_0x2217ce[_0x51a8('0x13')]['replace'](_0x3bc044,'');}if(_0x2217ce[_0x51a8('0x13')][_0x51a8('0x15')](_0x51a8('0x16'))){var _0x3759d6=[];_0x2217ce['attachments'][_0x51a8('0x17')](_0x4b9cdd=>{_0x3759d6['push'](_0x4b9cdd[_0x51a8('0x18')]);});var _0x52e503=/]+>/g;var _0x384d25=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x78d3d6=_0x2217ce[_0x51a8('0x13')][_0x51a8('0x19')](_0x384d25,_0x51a8('0x1a'));var _0x2f2f05=_0x78d3d6[_0x51a8('0x19')](_0x52e503,_0x51a8('0x1b'));for(let _0x5b3f49=0x0;_0x5b3f49<_0x3759d6[_0x51a8('0xc')];_0x5b3f49++){var _0x1b7577=_0x2f2f05[_0x51a8('0x19')](_0x51a8('0x1b'),_0x51a8('0x1c')+_0x3759d6[_0x5b3f49]+_0x51a8('0x1d'));_0x2f2f05=_0x1b7577;}_0x2217ce[_0x51a8('0x13')]=_0x2f2f05;}_0x2f2681[_0x51a8('0x1e')]=_0x2217ce[_0x51a8('0x13')];}else{_0x2f2681[_0x51a8('0x1e')]=_0x2217ce[_0x51a8('0x1f')];}if(_0x2f2681[_0x51a8('0x1e')]){_0x2f2681['body']=_0x2f2681[_0x51a8('0x1e')]['replace'](/0x0){if(this[_0x38a8c8+'Capacity']>0x0&&this[_0x38a8c8+'CurrentCapacity']>=this[_0x38a8c8+_0x1ec2('0x27')]){return _0x1ec2('0x28');}else{return _0x1ec2('0x29');}}else{return _0x1ec2('0x2a');}};Agent[_0x1ec2('0x25')][_0x1ec2('0x24')]=function(){var _0x4f4eab=['mail',_0x1ec2('0x2b'),_0x1ec2('0x2c'),_0x1ec2('0x2d'),_0x1ec2('0x2e'),_0x1ec2('0x2f')];for(var _0x3e5e55=0x0;_0x3e5e55<_0x4f4eab[_0x1ec2('0x30')];_0x3e5e55+=0x1){var _0x15ae5a=this[_0x1ec2('0x31')](_0x4f4eab[_0x3e5e55]);if(this[_0x4f4eab[_0x3e5e55]+_0x1ec2('0x32')]!==_0x15ae5a){this[_0x4f4eab[_0x3e5e55]+_0x1ec2('0x33')]=_[_0x1ec2('0x34')](moment()['format']('x'));}this[_0x4f4eab[_0x3e5e55]+_0x1ec2('0x32')]=_0x15ae5a;}var _0x1ff8f8={'id':this['id'],'name':this[_0x1ec2('0x7')],'online':this[_0x1ec2('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x1ec2('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x1ec2('0xd')],'faxPause':this[_0x1ec2('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x1ec2('0x11')],'chatCapacity':this[_0x1ec2('0x12')],'chatCurrentCapacity':this[_0x1ec2('0x13')],'mailStatus':this[_0x1ec2('0x14')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x1ec2('0x35')],'faxStatus':this[_0x1ec2('0x17')],'faxStatusTime':this[_0x1ec2('0x18')],'faxCapacity':this[_0x1ec2('0x19')],'faxCurrentCapacity':this[_0x1ec2('0x36')],'smsStatus':this[_0x1ec2('0x37')],'smsStatusTime':this[_0x1ec2('0x1a')],'smsCapacity':this[_0x1ec2('0x38')],'smsCurrentCapacity':this[_0x1ec2('0x1b')],'whatsappStatus':this[_0x1ec2('0x1c')],'whatsappStatusTime':this[_0x1ec2('0x1d')],'whatsappCapacity':this[_0x1ec2('0x1e')],'whatsappCurrentCapacity':this[_0x1ec2('0x1f')],'openchannelStatus':this[_0x1ec2('0x20')],'openchannelStatusTime':this[_0x1ec2('0x39')],'openchannelCapacity':this[_0x1ec2('0x21')],'openchannelCurrentCapacity':this[_0x1ec2('0x22')],'busy':this[_0x1ec2('0x3a')],'busyQueue':this[_0x1ec2('0x23')]};var _0x13b20f=md5(JSON[_0x1ec2('0x3b')](_0x1ff8f8));if(this[_0x1ec2('0x2')]!==_0x13b20f){this[_0x1ec2('0x2')]=_0x13b20f;io[_0x1ec2('0x3c')]('user:save',_0x1ff8f8);}};module[_0x1ec2('0x3d')]=Agent; \ No newline at end of file +var _0x1da8=['mailStatus','faxStatus','smsCurrentCapacity','whatsappStatusTime','whatsappCurrentCapacity','stringify','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','openchannel','fax','sms','whatsapp','Status','StatusTime','format','chatStatusTime','chatCurrentCapacity'];(function(_0x133cba,_0x50edaa){var _0xf76432=function(_0x362f8f){while(--_0x362f8f){_0x133cba['push'](_0x133cba['shift']());}};_0xf76432(++_0x50edaa);}(_0x1da8,0x1ad));var _0x81da=function(_0x27024d,_0x1fdd92){_0x27024d=_0x27024d-0x0;var _0x2acf9e=_0x1da8[_0x27024d];return _0x2acf9e;};'use strict';var _=require(_0x81da('0x0'));var moment=require(_0x81da('0x1'));var md5=require(_0x81da('0x2'));var Redis=require('ioredis');var config=require(_0x81da('0x3'));config[_0x81da('0x4')]=_['defaults'](config['redis'],{'host':_0x81da('0x5'),'port':0x18eb});var io=require(_0x81da('0x6'))(new Redis(config[_0x81da('0x4')]));function Agent(_0x444e24){this['id']=_0x444e24['id']||0x0;this[_0x81da('0x7')]=_0x444e24['name']||'';this['online']=_0x444e24[_0x81da('0x8')]||!![];this[_0x81da('0x9')]=_0x444e24[_0x81da('0x9')]||![];this[_0x81da('0xa')]=_0x444e24[_0x81da('0xa')]||![];this[_0x81da('0xb')]=_0x444e24[_0x81da('0xb')]||![];this[_0x81da('0xc')]=_0x444e24['faxPause']||![];this[_0x81da('0xd')]=_0x444e24[_0x81da('0xd')]||![];this[_0x81da('0xe')]=_0x444e24['openchannelPause']||![];this[_0x81da('0xf')]=_0x81da('0x10');this['chatStatusTime']=0x0;this[_0x81da('0x11')]=_0x444e24['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x81da('0x10');this[_0x81da('0x12')]=0x0;this[_0x81da('0x13')]=_0x444e24[_0x81da('0x13')]||0x0;this[_0x81da('0x14')]=0x0;this['faxStatus']=_0x81da('0x10');this[_0x81da('0x15')]=0x0;this[_0x81da('0x16')]=_0x444e24['faxCapacity']||0x0;this[_0x81da('0x17')]=0x0;this[_0x81da('0x18')]=_0x81da('0x10');this[_0x81da('0x19')]=0x0;this[_0x81da('0x1a')]=_0x444e24[_0x81da('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x81da('0x1b')]='unknown';this['whatsappStatusTime']=0x0;this[_0x81da('0x1c')]=_0x444e24[_0x81da('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x81da('0x1d')]=_0x81da('0x10');this[_0x81da('0x1e')]=0x0;this[_0x81da('0x1f')]=_0x444e24[_0x81da('0x1f')]||0x0;this[_0x81da('0x20')]=0x0;this['busy']=![];this[_0x81da('0x21')]=undefined;this[_0x81da('0x2')]='';this['updateRealtime']();}Agent[_0x81da('0x22')][_0x81da('0x23')]=function(_0x1fe675){if(this[_0x1fe675+_0x81da('0x24')]>0x0){if(this[_0x1fe675+_0x81da('0x25')]>0x0&&this[_0x1fe675+_0x81da('0x24')]>=this[_0x1fe675+_0x81da('0x25')]){return _0x81da('0x26');}else{return _0x81da('0x27');}}else{return _0x81da('0x28');}};Agent[_0x81da('0x22')]['updateRealtime']=function(){var _0x117d72=[_0x81da('0x29'),'chat',_0x81da('0x2a'),_0x81da('0x2b'),_0x81da('0x2c'),_0x81da('0x2d')];for(var _0x265ec0=0x0;_0x265ec0<_0x117d72['length'];_0x265ec0+=0x1){var _0x266688=this['getChannelStatus'](_0x117d72[_0x265ec0]);if(this[_0x117d72[_0x265ec0]+_0x81da('0x2e')]!==_0x266688){this[_0x117d72[_0x265ec0]+_0x81da('0x2f')]=_['toNumber'](moment()[_0x81da('0x30')]('x'));}this[_0x117d72[_0x265ec0]+_0x81da('0x2e')]=_0x266688;}var _0xaa05e5={'id':this['id'],'name':this[_0x81da('0x7')],'online':this[_0x81da('0x8')],'voicePause':this[_0x81da('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x81da('0xb')],'smsPause':this[_0x81da('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x81da('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x81da('0x31')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x81da('0x32')],'mailStatus':this[_0x81da('0x33')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x81da('0x13')],'mailCurrentCapacity':this[_0x81da('0x14')],'faxStatus':this[_0x81da('0x34')],'faxStatusTime':this[_0x81da('0x15')],'faxCapacity':this[_0x81da('0x16')],'faxCurrentCapacity':this[_0x81da('0x17')],'smsStatus':this[_0x81da('0x18')],'smsStatusTime':this[_0x81da('0x19')],'smsCapacity':this[_0x81da('0x1a')],'smsCurrentCapacity':this[_0x81da('0x35')],'whatsappStatus':this[_0x81da('0x1b')],'whatsappStatusTime':this[_0x81da('0x36')],'whatsappCapacity':this[_0x81da('0x1c')],'whatsappCurrentCapacity':this[_0x81da('0x37')],'openchannelStatus':this[_0x81da('0x1d')],'openchannelStatusTime':this[_0x81da('0x1e')],'openchannelCapacity':this[_0x81da('0x1f')],'openchannelCurrentCapacity':this[_0x81da('0x20')],'busy':this['busy'],'busyQueue':this[_0x81da('0x21')]};var _0x14b293=md5(JSON[_0x81da('0x38')](_0xaa05e5));if(this[_0x81da('0x2')]!==_0x14b293){this[_0x81da('0x2')]=_0x14b293;io[_0x81da('0x39')](_0x81da('0x3a'),_0xaa05e5);}};module[_0x81da('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index f3f3239..583d9ef 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 _0x5af0=['prototype','_rr','map','updateRealtime','paused','length','online','loggedIn','chatPause','available','stringify','emit','chat_queue:save','exports','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x5af0,0x113));var _0x05af=function(_0x54a92d,_0x2a4edc){_0x54a92d=_0x54a92d-0x0;var _0x37fd93=_0x5af0[_0x54a92d];return _0x37fd93;};'use strict';var _=require('lodash');var md5=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var Redis=require(_0x05af('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x05af('0x3')](config[_0x05af('0x4')],{'host':_0x05af('0x5'),'port':0x18eb});var io=require(_0x05af('0x6'))(new Redis(config['redis']));function ChatQueue(_0x519622){this['id']=_0x519622['id']||0x0;this[_0x05af('0x7')]=_0x519622[_0x05af('0x7')]||'';this['timeout']=_0x519622[_0x05af('0x8')]||0xa;this[_0x05af('0x9')]=_0x519622[_0x05af('0x9')]||_0x05af('0xa');this[_0x05af('0xb')]=_0x519622['Agents'];this[_0x05af('0xc')]={};this[_0x05af('0xd')]=0x0;this[_0x05af('0x0')]='';this[_0x05af('0xe')]();this['updateRealtime']();}ChatQueue[_0x05af('0xf')]['updateRouting']=function(){var _0x319e04=this[_0x05af('0xc')][_0x05af('0x10')];this['mapAgentsId']=_[_0x05af('0x11')](this['Agents'],'id');this[_0x05af('0xc')][_0x05af('0x10')]=_0x319e04;};ChatQueue['prototype'][_0x05af('0x12')]=function(){this['loggedIn']=0x0;this[_0x05af('0x13')]=0x0;for(var _0x5efa14=0x0;_0x5efa14=0x0?this[_0x05af('0x18')]:0x0;var _0x12f62d={'id':this['id'],'available':this[_0x05af('0x18')],'loggedIn':this[_0x05af('0x16')],'name':this[_0x05af('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x50aabb=md5(JSON[_0x05af('0x19')](_0x12f62d));if(this['md5']!==_0x50aabb){this[_0x05af('0x0')]=_0x50aabb;io['to'](util['format']('chat:queue:%s',_0x12f62d[_0x05af('0x7')]))[_0x05af('0x1a')](_0x05af('0x1b'),_0x12f62d);}};module[_0x05af('0x1c')]=ChatQueue; \ No newline at end of file +var _0x79a0=['md5','util','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','available','waiting','stringify','chat:queue:%s','emit','chat_queue:save','lodash'];(function(_0x130e28,_0x2a818c){var _0x53fde5=function(_0x35697e){while(--_0x35697e){_0x130e28['push'](_0x130e28['shift']());}};_0x53fde5(++_0x2a818c);}(_0x79a0,0x1b9));var _0x079a=function(_0x54d0bd,_0x256a7e){_0x54d0bd=_0x54d0bd-0x0;var _0x4f9107=_0x79a0[_0x54d0bd];return _0x4f9107;};'use strict';var _=require(_0x079a('0x0'));var md5=require(_0x079a('0x1'));var util=require(_0x079a('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x079a('0x3')]=_[_0x079a('0x4')](config[_0x079a('0x3')],{'host':_0x079a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x079a('0x3')]));function ChatQueue(_0x1fe2f8){this['id']=_0x1fe2f8['id']||0x0;this[_0x079a('0x6')]=_0x1fe2f8[_0x079a('0x6')]||'';this[_0x079a('0x7')]=_0x1fe2f8[_0x079a('0x7')]||0xa;this['strategy']=_0x1fe2f8[_0x079a('0x8')]||'beepall';this[_0x079a('0x9')]=_0x1fe2f8[_0x079a('0x9')];this[_0x079a('0xa')]={};this['waiting']=0x0;this[_0x079a('0x1')]='';this[_0x079a('0xb')]();this['updateRealtime']();}ChatQueue[_0x079a('0xc')]['updateRouting']=function(){var _0x2fcad=this[_0x079a('0xa')][_0x079a('0xd')];this[_0x079a('0xa')]=_[_0x079a('0xe')](this[_0x079a('0x9')],'id');this[_0x079a('0xa')]['_rr']=_0x2fcad;};ChatQueue[_0x079a('0xc')][_0x079a('0xf')]=function(){this[_0x079a('0x10')]=0x0;this[_0x079a('0x11')]=0x0;for(var _0x58ed45=0x0;_0x58ed45=0x0?this[_0x079a('0x14')]:0x0;var _0x4ea656={'id':this['id'],'available':this[_0x079a('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x079a('0x6')],'paused':this[_0x079a('0x11')],'waiting':this[_0x079a('0x15')]};var _0x1f717e=md5(JSON[_0x079a('0x16')](_0x4ea656));if(this['md5']!==_0x1f717e){this[_0x079a('0x1')]=_0x1f717e;io['to'](util['format'](_0x079a('0x17'),_0x4ea656[_0x079a('0x6')]))[_0x079a('0x18')](_0x079a('0x19'),_0x4ea656);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index ca72c84..f16c40e 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 _0xbc98=['lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','waiting','emit','exports'];(function(_0x2a4a61,_0x3c3cae){var _0x308182=function(_0x5dd985){while(--_0x5dd985){_0x2a4a61['push'](_0x2a4a61['shift']());}};_0x308182(++_0x3c3cae);}(_0xbc98,0x16c));var _0x8bc9=function(_0x4f9350,_0x1eb2e1){_0x4f9350=_0x4f9350-0x0;var _0x4af838=_0xbc98[_0x4f9350];return _0x4af838;};'use strict';var _=require(_0x8bc9('0x0'));var md5=require(_0x8bc9('0x1'));var util=require(_0x8bc9('0x2'));var Redis=require(_0x8bc9('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x8bc9('0x4')],{'host':_0x8bc9('0x5'),'port':0x18eb});var io=require(_0x8bc9('0x6'))(new Redis(config['redis']));function FaxQueue(_0x2417ce){this['id']=_0x2417ce['id']||0x0;this[_0x8bc9('0x7')]=_0x2417ce[_0x8bc9('0x7')]||'';this['timeout']=_0x2417ce['timeout']||0xa;this[_0x8bc9('0x8')]=_0x2417ce[_0x8bc9('0x8')]||_0x8bc9('0x9');this[_0x8bc9('0xa')]=_0x2417ce[_0x8bc9('0xa')];this[_0x8bc9('0xb')]={};this['waiting']=0x0;this[_0x8bc9('0x1')]='';this[_0x8bc9('0xc')]();this[_0x8bc9('0xd')]();}FaxQueue[_0x8bc9('0xe')][_0x8bc9('0xc')]=function(){var _0x4c3131=this[_0x8bc9('0xb')][_0x8bc9('0xf')];this[_0x8bc9('0xb')]=_[_0x8bc9('0x10')](this[_0x8bc9('0xa')],'id');this[_0x8bc9('0xb')][_0x8bc9('0xf')]=_0x4c3131;};FaxQueue[_0x8bc9('0xe')][_0x8bc9('0xd')]=function(){this[_0x8bc9('0x11')]=0x0;this[_0x8bc9('0x12')]=0x0;for(var _0x347554=0x0;_0x347554=0x0?this[_0x8bc9('0x16')]:0x0;var _0x3f11e1={'id':this['id'],'available':this[_0x8bc9('0x16')],'loggedIn':this[_0x8bc9('0x11')],'name':this['name'],'paused':this[_0x8bc9('0x12')],'waiting':this[_0x8bc9('0x17')]};var _0x5e4b41=md5(JSON['stringify'](_0x3f11e1));if(this[_0x8bc9('0x1')]!==_0x5e4b41){this[_0x8bc9('0x1')]=_0x5e4b41;io['to'](util['format']('fax:queue:%s',_0x3f11e1[_0x8bc9('0x7')]))[_0x8bc9('0x18')]('fax_queue:save',_0x3f11e1);}};module[_0x8bc9('0x19')]=FaxQueue; \ No newline at end of file +var _0xc003=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','paused','length','online','faxPause','loggedIn','available','format','fax:queue:%s','fax_queue:save','md5','util','defaults','redis','localhost','name','timeout','strategy','beepall'];(function(_0x569ba0,_0x52f552){var _0x33c118=function(_0xa33691){while(--_0xa33691){_0x569ba0['push'](_0x569ba0['shift']());}};_0x33c118(++_0x52f552);}(_0xc003,0x197));var _0x3c00=function(_0x5b2a8f,_0x34cd2d){_0x5b2a8f=_0x5b2a8f-0x0;var _0x104354=_0xc003[_0x5b2a8f];return _0x104354;};'use strict';var _=require('lodash');var md5=require(_0x3c00('0x0'));var util=require(_0x3c00('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x3c00('0x2')](config[_0x3c00('0x3')],{'host':_0x3c00('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3c00('0x3')]));function FaxQueue(_0x28cf99){this['id']=_0x28cf99['id']||0x0;this[_0x3c00('0x5')]=_0x28cf99[_0x3c00('0x5')]||'';this['timeout']=_0x28cf99[_0x3c00('0x6')]||0xa;this[_0x3c00('0x7')]=_0x28cf99[_0x3c00('0x7')]||_0x3c00('0x8');this[_0x3c00('0x9')]=_0x28cf99[_0x3c00('0x9')];this[_0x3c00('0xa')]={};this[_0x3c00('0xb')]=0x0;this[_0x3c00('0x0')]='';this[_0x3c00('0xc')]();this[_0x3c00('0xd')]();}FaxQueue[_0x3c00('0xe')][_0x3c00('0xc')]=function(){var _0x282c34=this[_0x3c00('0xa')]['_rr'];this[_0x3c00('0xa')]=_[_0x3c00('0xf')](this[_0x3c00('0x9')],'id');this[_0x3c00('0xa')][_0x3c00('0x10')]=_0x282c34;};FaxQueue[_0x3c00('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x3c00('0x11')]=0x0;for(var _0x5d829d=0x0;_0x5d829d=0x0?this[_0x3c00('0x16')]:0x0;var _0x4a74fc={'id':this['id'],'available':this[_0x3c00('0x16')],'loggedIn':this[_0x3c00('0x15')],'name':this['name'],'paused':this[_0x3c00('0x11')],'waiting':this[_0x3c00('0xb')]};var _0x5cab4c=md5(JSON['stringify'](_0x4a74fc));if(this[_0x3c00('0x0')]!==_0x5cab4c){this['md5']=_0x5cab4c;io['to'](util[_0x3c00('0x17')](_0x3c00('0x18'),_0x4a74fc[_0x3c00('0x5')]))['emit'](_0x3c00('0x19'),_0x4a74fc);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1f12599..3815e1a 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 _0x94c1=['name','Intervals','exports'];(function(_0x1a5bec,_0x176bf3){var _0x1601e3=function(_0x6926a1){while(--_0x6926a1){_0x1a5bec['push'](_0x1a5bec['shift']());}};_0x1601e3(++_0x176bf3);}(_0x94c1,0x6c));var _0x194c=function(_0x5093fa,_0x2a6320){_0x5093fa=_0x5093fa-0x0;var _0x2873e2=_0x94c1[_0x5093fa];return _0x2873e2;};'use strict';function Interval(_0x4cbb8f){this['id']=_0x4cbb8f['id']||0x0;this[_0x194c('0x0')]=_0x4cbb8f['name']||'';this[_0x194c('0x1')]=_0x4cbb8f[_0x194c('0x1')]||{};}module[_0x194c('0x2')]=Interval; \ No newline at end of file +var _0xe964=['Intervals'];(function(_0x1dbb21,_0x3e649f){var _0x53d001=function(_0x26b8e6){while(--_0x26b8e6){_0x1dbb21['push'](_0x1dbb21['shift']());}};_0x53d001(++_0x3e649f);}(_0xe964,0x9f));var _0x4e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe964[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0xf67cf3){this['id']=_0xf67cf3['id']||0x0;this['name']=_0xf67cf3['name']||'';this[_0x4e96('0x0')]=_0xf67cf3[_0x4e96('0x0')]||{};}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 4fee075..5f404a0 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 _0x2f6e=['available','stringify','format','mail:queue:%s','emit','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','paused','length','online','loggedIn','mailPause'];(function(_0x3b07f4,_0x2a465f){var _0x43ae21=function(_0x269512){while(--_0x269512){_0x3b07f4['push'](_0x3b07f4['shift']());}};_0x43ae21(++_0x2a465f);}(_0x2f6e,0x18d));var _0xe2f6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2f6e[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var md5=require(_0xe2f6('0x0'));var util=require(_0xe2f6('0x1'));var Redis=require(_0xe2f6('0x2'));var config=require('../../../config/environment');config[_0xe2f6('0x3')]=_[_0xe2f6('0x4')](config['redis'],{'host':_0xe2f6('0x5'),'port':0x18eb});var io=require(_0xe2f6('0x6'))(new Redis(config[_0xe2f6('0x3')]));function MailQueue(_0x1b4d44){this['id']=_0x1b4d44['id']||0x0;this[_0xe2f6('0x7')]=_0x1b4d44[_0xe2f6('0x7')]||'';this['timeout']=_0x1b4d44[_0xe2f6('0x8')]||0xa;this[_0xe2f6('0x9')]=_0x1b4d44[_0xe2f6('0x9')]||_0xe2f6('0xa');this[_0xe2f6('0xb')]=_0x1b4d44['Agents'];this['mapAgentsId']={};this[_0xe2f6('0xc')]=0x0;this[_0xe2f6('0x0')]='';this[_0xe2f6('0xd')]();this[_0xe2f6('0xe')]();}MailQueue[_0xe2f6('0xf')][_0xe2f6('0xd')]=function(){var _0x348181=this['mapAgentsId'][_0xe2f6('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe2f6('0x11')][_0xe2f6('0x10')]=_0x348181;};MailQueue[_0xe2f6('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xe2f6('0x12')]=0x0;for(var _0x4cce8f=0x0;_0x4cce8f=0x0?this[_0xe2f6('0x17')]:0x0;var _0x357f57={'id':this['id'],'available':this[_0xe2f6('0x17')],'loggedIn':this[_0xe2f6('0x15')],'name':this[_0xe2f6('0x7')],'paused':this[_0xe2f6('0x12')],'waiting':this[_0xe2f6('0xc')]};var _0x3ebaa3=md5(JSON[_0xe2f6('0x18')](_0x357f57));if(this[_0xe2f6('0x0')]!==_0x3ebaa3){this[_0xe2f6('0x0')]=_0x3ebaa3;io['to'](util[_0xe2f6('0x19')](_0xe2f6('0x1a'),_0x357f57['name']))[_0xe2f6('0x1b')]('mail_queue:save',_0x357f57);}};module['exports']=MailQueue; \ No newline at end of file +var _0xac51=['beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','updateRealtime','loggedIn','length','online','mailPause','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x18cf20,_0xf30f84){var _0x36ceb2=function(_0x4d401d){while(--_0x4d401d){_0x18cf20['push'](_0x18cf20['shift']());}};_0x36ceb2(++_0xf30f84);}(_0xac51,0x1b7));var _0x1ac5=function(_0x2f3923,_0x15eb6d){_0x2f3923=_0x2f3923-0x0;var _0x2ebbae=_0xac51[_0x2f3923];return _0x2ebbae;};'use strict';var _=require(_0x1ac5('0x0'));var md5=require(_0x1ac5('0x1'));var util=require(_0x1ac5('0x2'));var Redis=require(_0x1ac5('0x3'));var config=require(_0x1ac5('0x4'));config['redis']=_['defaults'](config[_0x1ac5('0x5')],{'host':_0x1ac5('0x6'),'port':0x18eb});var io=require(_0x1ac5('0x7'))(new Redis(config['redis']));function MailQueue(_0xa3c01d){this['id']=_0xa3c01d['id']||0x0;this[_0x1ac5('0x8')]=_0xa3c01d[_0x1ac5('0x8')]||'';this[_0x1ac5('0x9')]=_0xa3c01d[_0x1ac5('0x9')]||0xa;this[_0x1ac5('0xa')]=_0xa3c01d[_0x1ac5('0xa')]||_0x1ac5('0xb');this['Agents']=_0xa3c01d[_0x1ac5('0xc')];this['mapAgentsId']={};this[_0x1ac5('0xd')]=0x0;this[_0x1ac5('0x1')]='';this[_0x1ac5('0xe')]();this['updateRealtime']();}MailQueue[_0x1ac5('0xf')][_0x1ac5('0xe')]=function(){var _0x16cfa8=this[_0x1ac5('0x10')][_0x1ac5('0x11')];this[_0x1ac5('0x10')]=_['map'](this['Agents'],'id');this[_0x1ac5('0x10')][_0x1ac5('0x11')]=_0x16cfa8;};MailQueue[_0x1ac5('0xf')][_0x1ac5('0x12')]=function(){this[_0x1ac5('0x13')]=0x0;this['paused']=0x0;for(var _0x2d16ca=0x0;_0x2d16ca=0x0?this[_0x1ac5('0x18')]:0x0;var _0x7a34e3={'id':this['id'],'available':this[_0x1ac5('0x18')],'loggedIn':this[_0x1ac5('0x13')],'name':this[_0x1ac5('0x8')],'paused':this[_0x1ac5('0x17')],'waiting':this[_0x1ac5('0xd')]};var _0x412641=md5(JSON['stringify'](_0x7a34e3));if(this['md5']!==_0x412641){this[_0x1ac5('0x1')]=_0x412641;io['to'](util[_0x1ac5('0x19')](_0x1ac5('0x1a'),_0x7a34e3[_0x1ac5('0x8')]))[_0x1ac5('0x1b')](_0x1ac5('0x1c'),_0x7a34e3);}};module[_0x1ac5('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 29cadcc..b8422ba 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x2ef3,0xba));var _0x32ef=function(_0x2c2882,_0x47bb0d){_0x2c2882=_0x2c2882-0x0;var _0x2ddc1a=_0x2ef3[_0x2c2882];return _0x2ddc1a;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x326f,0xd1));var _0xf326=function(_0x489b65,_0x4ca747){_0x489b65=_0x489b65-0x0;var _0x1e5c98=_0x326f[_0x489b65];return _0x1e5c98;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 2bc7319..dca6da4 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 _0xfaa4=['name','timeout','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','smsPause','available','stringify','sms:queue:%s','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfaa4,0x1a8));var _0x4faa=function(_0xd29a2d,_0x108f1f){_0xd29a2d=_0xd29a2d-0x0;var _0x1b3ef2=_0xfaa4[_0xd29a2d];return _0x1b3ef2;};'use strict';var _=require(_0x4faa('0x0'));var md5=require(_0x4faa('0x1'));var util=require(_0x4faa('0x2'));var Redis=require(_0x4faa('0x3'));var config=require(_0x4faa('0x4'));config[_0x4faa('0x5')]=_['defaults'](config[_0x4faa('0x5')],{'host':_0x4faa('0x6'),'port':0x18eb});var io=require(_0x4faa('0x7'))(new Redis(config[_0x4faa('0x5')]));function SmsQueue(_0x5d753f){this['id']=_0x5d753f['id']||0x0;this[_0x4faa('0x8')]=_0x5d753f[_0x4faa('0x8')]||'';this[_0x4faa('0x9')]=_0x5d753f['timeout']||0xa;this['strategy']=_0x5d753f['strategy']||_0x4faa('0xa');this[_0x4faa('0xb')]=_0x5d753f[_0x4faa('0xb')];this['mapAgentsId']={};this[_0x4faa('0xc')]=0x0;this[_0x4faa('0x1')]='';this[_0x4faa('0xd')]();this[_0x4faa('0xe')]();}SmsQueue[_0x4faa('0xf')]['updateRouting']=function(){var _0x58cbac=this[_0x4faa('0x10')][_0x4faa('0x11')];this[_0x4faa('0x10')]=_[_0x4faa('0x12')](this[_0x4faa('0xb')],'id');this[_0x4faa('0x10')][_0x4faa('0x11')]=_0x58cbac;};SmsQueue[_0x4faa('0xf')][_0x4faa('0xe')]=function(){this[_0x4faa('0x13')]=0x0;this[_0x4faa('0x14')]=0x0;for(var _0x325030=0x0;_0x325030=0x0?this['available']:0x0;var _0x5444d9={'id':this['id'],'available':this[_0x4faa('0x17')],'loggedIn':this[_0x4faa('0x13')],'name':this[_0x4faa('0x8')],'paused':this[_0x4faa('0x14')],'waiting':this['waiting']};var _0xdc472b=md5(JSON[_0x4faa('0x18')](_0x5444d9));if(this[_0x4faa('0x1')]!==_0xdc472b){this[_0x4faa('0x1')]=_0xdc472b;io['to'](util['format'](_0x4faa('0x19'),_0x5444d9['name']))['emit'](_0x4faa('0x1a'),_0x5444d9);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x72b1=['format','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','md5'];(function(_0xba3b80,_0x3ccb24){var _0x6e5fae=function(_0x1189d6){while(--_0x1189d6){_0xba3b80['push'](_0xba3b80['shift']());}};_0x6e5fae(++_0x3ccb24);}(_0x72b1,0x16e));var _0x172b=function(_0x39098d,_0x367ab3){_0x39098d=_0x39098d-0x0;var _0x1bbd10=_0x72b1[_0x39098d];return _0x1bbd10;};'use strict';var _=require(_0x172b('0x0'));var md5=require('md5');var util=require(_0x172b('0x1'));var Redis=require(_0x172b('0x2'));var config=require(_0x172b('0x3'));config[_0x172b('0x4')]=_[_0x172b('0x5')](config[_0x172b('0x4')],{'host':_0x172b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x172b('0x4')]));function SmsQueue(_0x40c72e){this['id']=_0x40c72e['id']||0x0;this[_0x172b('0x7')]=_0x40c72e[_0x172b('0x7')]||'';this['timeout']=_0x40c72e[_0x172b('0x8')]||0xa;this['strategy']=_0x40c72e[_0x172b('0x9')]||'beepall';this[_0x172b('0xa')]=_0x40c72e[_0x172b('0xa')];this[_0x172b('0xb')]={};this[_0x172b('0xc')]=0x0;this['md5']='';this[_0x172b('0xd')]();this[_0x172b('0xe')]();}SmsQueue[_0x172b('0xf')][_0x172b('0xd')]=function(){var _0xa4ada9=this[_0x172b('0xb')][_0x172b('0x10')];this['mapAgentsId']=_[_0x172b('0x11')](this[_0x172b('0xa')],'id');this[_0x172b('0xb')]['_rr']=_0xa4ada9;};SmsQueue[_0x172b('0xf')]['updateRealtime']=function(){this[_0x172b('0x12')]=0x0;this[_0x172b('0x13')]=0x0;for(var _0x5239b9=0x0;_0x5239b9=0x0?this[_0x172b('0x17')]:0x0;var _0x18c22a={'id':this['id'],'available':this[_0x172b('0x17')],'loggedIn':this[_0x172b('0x12')],'name':this['name'],'paused':this[_0x172b('0x13')],'waiting':this[_0x172b('0xc')]};var _0x2bedae=md5(JSON[_0x172b('0x18')](_0x18c22a));if(this[_0x172b('0x19')]!==_0x2bedae){this[_0x172b('0x19')]=_0x2bedae;io['to'](util[_0x172b('0x1a')]('sms:queue:%s',_0x18c22a['name']))['emit']('sms_queue:save',_0x18c22a);}};module[_0x172b('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 49c2880..66e354b 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 _0xbf32=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','length','online','loggedIn','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults'];(function(_0x6cf6b1,_0x554720){var _0x131360=function(_0x2832c1){while(--_0x2832c1){_0x6cf6b1['push'](_0x6cf6b1['shift']());}};_0x131360(++_0x554720);}(_0xbf32,0x1eb));var _0x2bf3=function(_0x213f9d,_0x9a6f2a){_0x213f9d=_0x213f9d-0x0;var _0x138299=_0xbf32[_0x213f9d];return _0x138299;};'use strict';var _=require(_0x2bf3('0x0'));var md5=require(_0x2bf3('0x1'));var util=require('util');var Redis=require(_0x2bf3('0x2'));var config=require(_0x2bf3('0x3'));config['redis']=_[_0x2bf3('0x4')](config[_0x2bf3('0x5')],{'host':_0x2bf3('0x6'),'port':0x18eb});var io=require(_0x2bf3('0x7'))(new Redis(config[_0x2bf3('0x5')]));function WhatsappQueue(_0x61dff9){this['id']=_0x61dff9['id']||0x0;this[_0x2bf3('0x8')]=_0x61dff9[_0x2bf3('0x8')]||'';this[_0x2bf3('0x9')]=_0x61dff9['timeout']||0xa;this[_0x2bf3('0xa')]=_0x61dff9['strategy']||_0x2bf3('0xb');this[_0x2bf3('0xc')]=_0x61dff9['Agents'];this['mapAgentsId']={};this[_0x2bf3('0xd')]=0x0;this[_0x2bf3('0x1')]='';this[_0x2bf3('0xe')]();this[_0x2bf3('0xf')]();}WhatsappQueue['prototype'][_0x2bf3('0xe')]=function(){var _0x276e92=this[_0x2bf3('0x10')][_0x2bf3('0x11')];this[_0x2bf3('0x10')]=_[_0x2bf3('0x12')](this[_0x2bf3('0xc')],'id');this[_0x2bf3('0x10')]['_rr']=_0x276e92;};WhatsappQueue[_0x2bf3('0x13')][_0x2bf3('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x43c5f0=0x0;_0x43c5f0=0x0?this[_0x2bf3('0x19')]:0x0;var _0x101f18={'id':this['id'],'available':this[_0x2bf3('0x19')],'loggedIn':this[_0x2bf3('0x16')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x2bf3('0xd')]};var _0x38b8b1=md5(JSON[_0x2bf3('0x1a')](_0x101f18));if(this[_0x2bf3('0x1')]!==_0x38b8b1){this[_0x2bf3('0x1')]=_0x38b8b1;io['to'](util[_0x2bf3('0x1b')](_0x2bf3('0x1c'),_0x101f18[_0x2bf3('0x8')]))['emit'](_0x2bf3('0x1d'),_0x101f18);}};module[_0x2bf3('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0xd628=['name','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','strategy','beepall','Agents','waiting','prototype','updateRouting','_rr','map','mapAgentsId','loggedIn','paused','length','online','whatsappPause','available'];(function(_0x50efe7,_0xae9d62){var _0x4272ac=function(_0xa4463d){while(--_0xa4463d){_0x50efe7['push'](_0x50efe7['shift']());}};_0x4272ac(++_0xae9d62);}(_0xd628,0x7f));var _0x8d62=function(_0x46c824,_0x3e4067){_0x46c824=_0x46c824-0x0;var _0x345d33=_0xd628[_0x46c824];return _0x345d33;};'use strict';var _=require('lodash');var md5=require(_0x8d62('0x0'));var util=require(_0x8d62('0x1'));var Redis=require(_0x8d62('0x2'));var config=require(_0x8d62('0x3'));config[_0x8d62('0x4')]=_[_0x8d62('0x5')](config[_0x8d62('0x4')],{'host':_0x8d62('0x6'),'port':0x18eb});var io=require(_0x8d62('0x7'))(new Redis(config[_0x8d62('0x4')]));function WhatsappQueue(_0x2f3bdc){this['id']=_0x2f3bdc['id']||0x0;this['name']=_0x2f3bdc['name']||'';this['timeout']=_0x2f3bdc['timeout']||0xa;this[_0x8d62('0x8')]=_0x2f3bdc['strategy']||_0x8d62('0x9');this[_0x8d62('0xa')]=_0x2f3bdc[_0x8d62('0xa')];this['mapAgentsId']={};this[_0x8d62('0xb')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x8d62('0xc')][_0x8d62('0xd')]=function(){var _0x36cbca=this['mapAgentsId'][_0x8d62('0xe')];this['mapAgentsId']=_[_0x8d62('0xf')](this[_0x8d62('0xa')],'id');this[_0x8d62('0x10')]['_rr']=_0x36cbca;};WhatsappQueue[_0x8d62('0xc')]['updateRealtime']=function(){this[_0x8d62('0x11')]=0x0;this[_0x8d62('0x12')]=0x0;for(var _0x5e5dc2=0x0;_0x5e5dc2=0x0?this[_0x8d62('0x16')]:0x0;var _0x33b4c2={'id':this['id'],'available':this[_0x8d62('0x16')],'loggedIn':this[_0x8d62('0x11')],'name':this[_0x8d62('0x17')],'paused':this[_0x8d62('0x12')],'waiting':this[_0x8d62('0xb')]};var _0x6f78b=md5(JSON[_0x8d62('0x18')](_0x33b4c2));if(this[_0x8d62('0x0')]!==_0x6f78b){this['md5']=_0x6f78b;io['to'](util[_0x8d62('0x19')](_0x8d62('0x1a'),_0x33b4c2[_0x8d62('0x17')]))[_0x8d62('0x1b')](_0x8d62('0x1c'),_0x33b4c2);}};module[_0x8d62('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index abed969..1f83280 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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x48a550,_0x57e445){var _0xe21a10=function(_0x383f94){while(--_0x383f94){_0x48a550['push'](_0x48a550['shift']());}};_0xe21a10(++_0x57e445);}(_0xb10b,0x12a));var _0xbb10=function(_0xcdac34,_0x43f665){_0xcdac34=_0xcdac34-0x0;var _0x269d23=_0xb10b[_0xcdac34];return _0x269d23;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 e0e842d..33b0b1c 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 _0x5a30=['addTags','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x22fc1d,_0x5b8ee1){var _0x29e032=function(_0x69e18a){while(--_0x69e18a){_0x22fc1d['push'](_0x22fc1d['shift']());}};_0x29e032(++_0x5b8ee1);}(_0x5a30,0x1d0));var _0x05a3=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x5a30[_0x1fcaf1];return _0x55f464;};'use strict';var client=require(_0x05a3('0x0'));exports[_0x05a3('0x1')]=function(_0x5dbad0,_0x2704c2){return client[_0x05a3('0x2')](_0x05a3('0x3'),{'body':_0x2704c2,'options':{'where':{'id':_0x5dbad0}},'log':_0x05a3('0x4')});};exports[_0x05a3('0x5')]=function(_0x15ebef,_0x823791){return client[_0x05a3('0x2')](_0x05a3('0x6'),{'body':_0x823791,'options':{'where':{'id':_0x15ebef}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x8142=['Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x50358e,_0x3c8398){var _0x778d94=function(_0x1b8ea8){while(--_0x1b8ea8){_0x50358e['push'](_0x50358e['shift']());}};_0x778d94(++_0x3c8398);}(_0x8142,0x180));var _0x2814=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0x8142[_0x5c7a85];return _0x35290f;};'use strict';var client=require(_0x2814('0x0'));exports['update']=function(_0x10f9ea,_0x10134e){return client[_0x2814('0x1')](_0x2814('0x2'),{'body':_0x10134e,'options':{'where':{'id':_0x10f9ea}},'log':'updateChatInteraction'});};exports[_0x2814('0x3')]=function(_0x5c3bc1,_0x1b92de){return client['Request'](_0x2814('0x4'),{'body':_0x1b92de,'options':{'where':{'id':_0x5c3bc1}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index ad54e1f..cf13c85 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 _0x0e08=['CreateChatMessage','createChatMessage','create','Request'];(function(_0x106ba5,_0x2a8899){var _0x36d595=function(_0x29f8cc){while(--_0x29f8cc){_0x106ba5['push'](_0x106ba5['shift']());}};_0x36d595(++_0x2a8899);}(_0x0e08,0x196));var _0x80e0=function(_0x1521dc,_0x1fa407){_0x1521dc=_0x1521dc-0x0;var _0xee4d34=_0x0e08[_0x1521dc];return _0xee4d34;};'use strict';var client=require('../client');exports[_0x80e0('0x0')]=function(_0x4cf3a8){return client[_0x80e0('0x1')](_0x80e0('0x2'),{'body':_0x4cf3a8,'log':_0x80e0('0x3')});}; \ No newline at end of file +var _0x86e5=['Request','CreateChatMessage','../client','create'];(function(_0x10c004,_0x32499d){var _0x245a80=function(_0x5589af){while(--_0x5589af){_0x10c004['push'](_0x10c004['shift']());}};_0x245a80(++_0x32499d);}(_0x86e5,0x11a));var _0x586e=function(_0x270af3,_0x3461fb){_0x270af3=_0x270af3-0x0;var _0x52fcad=_0x86e5[_0x270af3];return _0x52fcad;};'use strict';var client=require(_0x586e('0x0'));exports[_0x586e('0x1')]=function(_0x425687){return client[_0x586e('0x2')](_0x586e('0x3'),{'body':_0x425687,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index f900479..c67c079 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 _0x8784=['chatPause','../client','getChatQueues','GetChatQueue','name','timeout','strategy','User','online'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x8784,0x172));var _0x4878=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x8784[_0x577519];return _0x5b12f7;};'use strict';var client=require(_0x4878('0x0'));exports[_0x4878('0x1')]=function(){return function(){return client['Request'](_0x4878('0x2'),{'options':{'raw':![],'attributes':['id',_0x4878('0x3'),_0x4878('0x4'),_0x4878('0x5')],'include':[{'model':_0x4878('0x6'),'as':'Agents','attributes':['id','name',_0x4878('0x7'),_0x4878('0x8')]}]},'log':_0x4878('0x1')});};}; \ No newline at end of file +var _0x3435=['Request','GetChatQueue','name','timeout','User','Agents','chatPause','../client','getChatQueues'];(function(_0x4b362b,_0xb811a){var _0x5cde92=function(_0x143f21){while(--_0x143f21){_0x4b362b['push'](_0x4b362b['shift']());}};_0x5cde92(++_0xb811a);}(_0x3435,0xfa));var _0x5343=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x3435[_0x255d5b];return _0x3e141a;};'use strict';var client=require(_0x5343('0x0'));exports[_0x5343('0x1')]=function(){return function(){return client[_0x5343('0x2')](_0x5343('0x3'),{'options':{'raw':![],'attributes':['id',_0x5343('0x4'),_0x5343('0x5'),'strategy'],'include':[{'model':_0x5343('0x6'),'as':_0x5343('0x7'),'attributes':['id','name','online',_0x5343('0x8')]}]},'log':_0x5343('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e733b26..1e6bb3c 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 _0x2504=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x2cfd85,_0x459a19){var _0x2bb949=function(_0x280279){while(--_0x280279){_0x2cfd85['push'](_0x2cfd85['shift']());}};_0x2bb949(++_0x459a19);}(_0x2504,0xee));var _0x4250=function(_0x1d6c56,_0x113b93){_0x1d6c56=_0x1d6c56-0x0;var _0x2b9777=_0x2504[_0x1d6c56];return _0x2b9777;};'use strict';var client=require(_0x4250('0x0'));exports[_0x4250('0x1')]=function(_0x3e4ada){return client[_0x4250('0x2')](_0x4250('0x3'),{'body':_0x3e4ada,'log':_0x4250('0x3')});};exports[_0x4250('0x4')]=function(_0x320d79,_0x17d2d8){return client[_0x4250('0x2')](_0x4250('0x5'),{'body':_0x17d2d8,'options':{'where':{'uniqueid':_0x320d79},'order':[['id',_0x4250('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x5d31=['CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create'];(function(_0x4f6618,_0xfda162){var _0x394e1a=function(_0x46416b){while(--_0x46416b){_0x4f6618['push'](_0x4f6618['shift']());}};_0x394e1a(++_0xfda162);}(_0x5d31,0xb7));var _0x15d3=function(_0x472ded,_0x7b9b67){_0x472ded=_0x472ded-0x0;var _0x4cdf81=_0x5d31[_0x472ded];return _0x4cdf81;};'use strict';var client=require(_0x15d3('0x0'));exports[_0x15d3('0x1')]=function(_0x255280){return client['Request'](_0x15d3('0x2'),{'body':_0x255280,'log':_0x15d3('0x2')});};exports['update']=function(_0x19b9b6,_0x526c77){return client['Request'](_0x15d3('0x3'),{'body':_0x526c77,'options':{'where':{'uniqueid':_0x19b9b6},'order':[['id',_0x15d3('0x4')]],'limit':0x1},'log':_0x15d3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 4063b5d..949674b 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(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x7a54,0x106));var _0x47a5=function(_0x34a7fa,_0x302f7a){_0x34a7fa=_0x34a7fa-0x0;var _0x555fd3=_0x7a54[_0x34a7fa];return _0x555fd3;};'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(_0x3d0966,_0x39b8ab){var _0x357663=function(_0x51040b){while(--_0x51040b){_0x3d0966['push'](_0x3d0966['shift']());}};_0x357663(++_0x39b8ab);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 0cc84b6..401a604 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 _0xa0e5=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x9a8896,_0x11bb72){var _0x224804=function(_0x2bd71a){while(--_0x2bd71a){_0x9a8896['push'](_0x9a8896['shift']());}};_0x224804(++_0x11bb72);}(_0xa0e5,0x13e));var _0x5a0e=function(_0x12095b,_0x476127){_0x12095b=_0x12095b-0x0;var _0x4528a9=_0xa0e5[_0x12095b];return _0x4528a9;};'use strict';var client=require(_0x5a0e('0x0'));exports[_0x5a0e('0x1')]=function(_0x50a4b8){return client[_0x5a0e('0x2')](_0x5a0e('0x3'),{'body':_0x50a4b8,'log':_0x5a0e('0x4')});}; \ No newline at end of file +var _0x510f=['createFaxMessage','create','Request'];(function(_0x21b067,_0x2df071){var _0x21d746=function(_0x1f9aca){while(--_0x1f9aca){_0x21b067['push'](_0x21b067['shift']());}};_0x21d746(++_0x2df071);}(_0x510f,0x130));var _0xf510=function(_0x16d793,_0x22f0f7){_0x16d793=_0x16d793-0x0;var _0x444f4f=_0x510f[_0x16d793];return _0x444f4f;};'use strict';var client=require('../client');exports[_0xf510('0x0')]=function(_0x500017){return client[_0xf510('0x1')]('CreateFaxMessage',{'body':_0x500017,'log':_0xf510('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 7b77d43..d9a1fa4 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 _0x61f6=['getFaxQueues','../client','name','timeout','User','Agents','online','faxPause'];(function(_0x2dc477,_0x543f96){var _0x47c28f=function(_0x5842bd){while(--_0x5842bd){_0x2dc477['push'](_0x2dc477['shift']());}};_0x47c28f(++_0x543f96);}(_0x61f6,0xb1));var _0x661f=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x61f6[_0x609988];return _0x159984;};'use strict';var client=require(_0x661f('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x661f('0x1'),_0x661f('0x2'),'strategy'],'include':[{'model':_0x661f('0x3'),'as':_0x661f('0x4'),'attributes':['id','name',_0x661f('0x5'),_0x661f('0x6')]}]},'log':_0x661f('0x7')});};}; \ No newline at end of file +var _0x0134=['User','Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x20aff0,_0x56bf42){var _0xd17ce9=function(_0x3af923){while(--_0x3af923){_0x20aff0['push'](_0x20aff0['shift']());}};_0xd17ce9(++_0x56bf42);}(_0x0134,0xec));var _0x4013=function(_0x4dcf3a,_0xa0d121){_0x4dcf3a=_0x4dcf3a-0x0;var _0x31cc5f=_0x0134[_0x4dcf3a];return _0x31cc5f;};'use strict';var client=require('../client');exports[_0x4013('0x0')]=function(){return function(){return client[_0x4013('0x1')](_0x4013('0x2'),{'options':{'raw':![],'attributes':['id',_0x4013('0x3'),'timeout','strategy'],'include':[{'model':_0x4013('0x4'),'as':_0x4013('0x5'),'attributes':['id',_0x4013('0x3'),_0x4013('0x6'),_0x4013('0x7')]}]},'log':_0x4013('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index a275613..a476e32 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 _0x8006=['update','DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x570664,_0x2f077b){var _0x86a2bf=function(_0x302bd5){while(--_0x302bd5){_0x570664['push'](_0x570664['shift']());}};_0x86a2bf(++_0x2f077b);}(_0x8006,0xb2));var _0x6800=function(_0x42795e,_0x4b665e){_0x42795e=_0x42795e-0x0;var _0x443cc7=_0x8006[_0x42795e];return _0x443cc7;};'use strict';var client=require(_0x6800('0x0'));exports[_0x6800('0x1')]=function(_0x4b75a8){return client[_0x6800('0x2')](_0x6800('0x3'),{'body':_0x4b75a8,'log':_0x6800('0x3')});};exports[_0x6800('0x4')]=function(_0x2b0f14,_0x2e7fac){return client[_0x6800('0x2')]('UpdateFaxQueueReport',{'body':_0x2e7fac,'options':{'where':{'uniqueid':_0x2b0f14},'order':[['id',_0x6800('0x5')]],'limit':0x1},'log':_0x6800('0x6')});}; \ No newline at end of file +var _0x1419=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1419,0x14e));var _0x9141=function(_0x42ab25,_0x1b4d60){_0x42ab25=_0x42ab25-0x0;var _0x47c111=_0x1419[_0x42ab25];return _0x47c111;};'use strict';var client=require(_0x9141('0x0'));exports[_0x9141('0x1')]=function(_0x59e3f7){return client['Request'](_0x9141('0x2'),{'body':_0x59e3f7,'log':_0x9141('0x2')});};exports[_0x9141('0x3')]=function(_0xd3f0c4,_0x458485){return client[_0x9141('0x4')](_0x9141('0x5'),{'body':_0x458485,'options':{'where':{'uniqueid':_0xd3f0c4},'order':[['id',_0x9141('0x6')]],'limit':0x1},'log':_0x9141('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b563061..e08026b 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 _0xc024=['getIntervals','Request','GetInterval','Intervals','../client'];(function(_0x384068,_0x2e7c2d){var _0x47e63b=function(_0x2cb4e4){while(--_0x2cb4e4){_0x384068['push'](_0x384068['shift']());}};_0x47e63b(++_0x2e7c2d);}(_0xc024,0xbd));var _0x4c02=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xc024[_0x47b58b];return _0x46bebe;};'use strict';var client=require(_0x4c02('0x0'));exports[_0x4c02('0x1')]=function(){return function(){return client[_0x4c02('0x2')](_0x4c02('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x4c02('0x4'),'attributes':['id','name','interval']}]},'log':_0x4c02('0x1')});};}; \ No newline at end of file +var _0x3783=['Request','GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x2b2d6d,_0x358f90){var _0x55a665=function(_0x121d9a){while(--_0x121d9a){_0x2b2d6d['push'](_0x2b2d6d['shift']());}};_0x55a665(++_0x358f90);}(_0x3783,0x12e));var _0x3378=function(_0x456dad,_0x1a9889){_0x456dad=_0x456dad-0x0;var _0x245f82=_0x3783[_0x456dad];return _0x245f82;};'use strict';var client=require(_0x3378('0x0'));exports[_0x3378('0x1')]=function(){return function(){return client[_0x3378('0x2')](_0x3378('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3378('0x4')],'include':[{'model':_0x3378('0x5'),'as':_0x3378('0x6'),'attributes':['id',_0x3378('0x4'),_0x3378('0x7')]}]},'log':_0x3378('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 2960ece..ba2fb3f 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 _0x1a85=['AddTagsToMailInteraction','Request','addTags'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1a85,0x178));var _0x51a8=function(_0xc352bd,_0x312795){_0xc352bd=_0xc352bd-0x0;var _0x10e333=_0x1a85[_0xc352bd];return _0x10e333;};'use strict';var client=require('../client');exports['update']=function(_0x305f18,_0x382cb8){return client[_0x51a8('0x0')]('UpdateMailInteraction',{'body':_0x382cb8,'options':{'where':{'id':_0x305f18}},'log':'updateMailInteraction'});};exports[_0x51a8('0x1')]=function(_0x1377a4,_0x99e371){return client['Request'](_0x51a8('0x2'),{'body':_0x99e371,'options':{'where':{'id':_0x1377a4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xf2e3=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x498c19,_0x118e41){var _0x924202=function(_0x5257a6){while(--_0x5257a6){_0x498c19['push'](_0x498c19['shift']());}};_0x924202(++_0x118e41);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf2e3[_0x525c7b];return _0x27b33e;};'use strict';var client=require(_0x3f2e('0x0'));exports['update']=function(_0x143e9e,_0x231b2b){return client[_0x3f2e('0x1')](_0x3f2e('0x2'),{'body':_0x231b2b,'options':{'where':{'id':_0x143e9e}},'log':_0x3f2e('0x3')});};exports[_0x3f2e('0x4')]=function(_0x3938e2,_0xabcf5c){return client[_0x3f2e('0x1')]('AddTagsToMailInteraction',{'body':_0xabcf5c,'options':{'where':{'id':_0x3938e2}},'log':_0x3f2e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 3a7106b..bc57e5c 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 _0xabc0=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x3e6238,_0x2eea18){var _0x7cccfe=function(_0x1de820){while(--_0x1de820){_0x3e6238['push'](_0x3e6238['shift']());}};_0x7cccfe(++_0x2eea18);}(_0xabc0,0x114));var _0x0abc=function(_0x3dbd6b,_0x11c035){_0x3dbd6b=_0x3dbd6b-0x0;var _0x2898ef=_0xabc0[_0x3dbd6b];return _0x2898ef;};'use strict';var client=require(_0x0abc('0x0'));exports[_0x0abc('0x1')]=function(_0x1743b0){return client['Request'](_0x0abc('0x2'),{'body':_0x1743b0,'log':_0x0abc('0x3')});}; \ No newline at end of file +var _0x31e5=['CreateMailMessage','../client','create','Request'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x31e5,0x1e1));var _0x531e=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x31e5[_0xcda377];return _0x1c024f;};'use strict';var client=require(_0x531e('0x0'));exports[_0x531e('0x1')]=function(_0x369d82){return client[_0x531e('0x2')](_0x531e('0x3'),{'body':_0x369d82,'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 787c111..03a4600 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 _0x9ba5=['Request','name','strategy','User','Agents','online','mailPause','../client','getMailQueues'];(function(_0x3c8f26,_0x453699){var _0x5a4dd7=function(_0xd5c4b9){while(--_0xd5c4b9){_0x3c8f26['push'](_0x3c8f26['shift']());}};_0x5a4dd7(++_0x453699);}(_0x9ba5,0x139));var _0x59ba=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9ba5[_0x5f1391];return _0x50ebe3;};'use strict';var client=require(_0x59ba('0x0'));exports[_0x59ba('0x1')]=function(){return function(){return client[_0x59ba('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x59ba('0x3'),'timeout',_0x59ba('0x4')],'include':[{'model':_0x59ba('0x5'),'as':_0x59ba('0x6'),'attributes':['id',_0x59ba('0x3'),_0x59ba('0x7'),_0x59ba('0x8')]}]},'log':_0x59ba('0x1')});};}; \ No newline at end of file +var _0x5040=['User','Agents','online','getMailQueues','../client','Request','name','timeout','strategy'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x5040,0x1b4));var _0x0504=function(_0x4e43ab,_0x148206){_0x4e43ab=_0x4e43ab-0x0;var _0x8a4a51=_0x5040[_0x4e43ab];return _0x8a4a51;};'use strict';var client=require(_0x0504('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x0504('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x0504('0x2'),_0x0504('0x3'),_0x0504('0x4')],'include':[{'model':_0x0504('0x5'),'as':_0x0504('0x6'),'attributes':['id',_0x0504('0x2'),_0x0504('0x7'),'mailPause']}]},'log':_0x0504('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b9bc390..26c6a28 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 _0x91f9=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport','update'];(function(_0x57e072,_0x2ef18e){var _0x560c09=function(_0x3bdcad){while(--_0x3bdcad){_0x57e072['push'](_0x57e072['shift']());}};_0x560c09(++_0x2ef18e);}(_0x91f9,0x95));var _0x991f=function(_0x2e8775,_0x310049){_0x2e8775=_0x2e8775-0x0;var _0x4cbf35=_0x91f9[_0x2e8775];return _0x4cbf35;};'use strict';var client=require(_0x991f('0x0'));exports[_0x991f('0x1')]=function(_0xa774cc){return client[_0x991f('0x2')](_0x991f('0x3'),{'body':_0xa774cc,'log':'CreateMailQueueReport'});};exports[_0x991f('0x4')]=function(_0xf41cb3,_0x5200a4){return client['Request'](_0x991f('0x5'),{'body':_0x5200a4,'options':{'where':{'uniqueid':_0xf41cb3},'order':[['id',_0x991f('0x6')]],'limit':0x1},'log':_0x991f('0x5')});}; \ No newline at end of file +var _0x7f56=['CreateMailQueueReport','UpdateMailQueueReport','DESC','create','Request'];(function(_0x3ec8b6,_0x2e0c56){var _0x23b89e=function(_0xb35d72){while(--_0xb35d72){_0x3ec8b6['push'](_0x3ec8b6['shift']());}};_0x23b89e(++_0x2e0c56);}(_0x7f56,0x139));var _0x67f5=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x7f56[_0x4d2993];return _0x427374;};'use strict';var client=require('../client');exports[_0x67f5('0x0')]=function(_0x1d0d65){return client[_0x67f5('0x1')]('CreateMailQueueReport',{'body':_0x1d0d65,'log':_0x67f5('0x2')});};exports['update']=function(_0x288fe0,_0x5573fe){return client['Request'](_0x67f5('0x3'),{'body':_0x5573fe,'options':{'where':{'uniqueid':_0x288fe0},'order':[['id',_0x67f5('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 12b87bb..afd01f4 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 _0xcb8f=['../client','update','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x491b1c,_0x50b1f5){var _0xc2e4ff=function(_0x301560){while(--_0x301560){_0x491b1c['push'](_0x491b1c['shift']());}};_0xc2e4ff(++_0x50b1f5);}(_0xcb8f,0x173));var _0xfcb8=function(_0x15d77e,_0x288568){_0x15d77e=_0x15d77e-0x0;var _0x2c75ed=_0xcb8f[_0x15d77e];return _0x2c75ed;};'use strict';var client=require(_0xfcb8('0x0'));exports[_0xfcb8('0x1')]=function(_0x5c12be,_0xa7af35){return client[_0xfcb8('0x2')]('UpdateOpenchannelInteraction',{'body':_0xa7af35,'options':{'where':{'id':_0x5c12be}},'log':_0xfcb8('0x3')});};exports[_0xfcb8('0x4')]=function(_0x343eec,_0x13c13d){return client[_0xfcb8('0x2')](_0xfcb8('0x5'),{'body':_0x13c13d,'options':{'where':{'id':_0x343eec}},'log':_0xfcb8('0x6')});}; \ No newline at end of file +var _0x4042=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x52d127,_0x20484b){var _0x4ddf33=function(_0x3d288f){while(--_0x3d288f){_0x52d127['push'](_0x52d127['shift']());}};_0x4ddf33(++_0x20484b);}(_0x4042,0xfb));var _0x2404=function(_0x8bff5b,_0x1d21d3){_0x8bff5b=_0x8bff5b-0x0;var _0x1b9b4b=_0x4042[_0x8bff5b];return _0x1b9b4b;};'use strict';var client=require('../client');exports[_0x2404('0x0')]=function(_0x4d3ed2,_0x275317){return client[_0x2404('0x1')](_0x2404('0x2'),{'body':_0x275317,'options':{'where':{'id':_0x4d3ed2}},'log':_0x2404('0x3')});};exports[_0x2404('0x4')]=function(_0x231c7a,_0x13f346){return client['Request'](_0x2404('0x5'),{'body':_0x13f346,'options':{'where':{'id':_0x231c7a}},'log':_0x2404('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b4ccf4d..08babbe 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 _0xdc62=['createOpenchannelMessage','create'];(function(_0xafc244,_0x19c0ae){var _0xb91010=function(_0x43eac0){while(--_0x43eac0){_0xafc244['push'](_0xafc244['shift']());}};_0xb91010(++_0x19c0ae);}(_0xdc62,0x18b));var _0x2dc6=function(_0x2e8d44,_0x443fb5){_0x2e8d44=_0x2e8d44-0x0;var _0x5e8a89=_0xdc62[_0x2e8d44];return _0x5e8a89;};'use strict';var client=require('../client');exports[_0x2dc6('0x0')]=function(_0x2db401){return client['Request']('CreateOpenchannelMessage',{'body':_0x2db401,'log':_0x2dc6('0x1')});}; \ No newline at end of file +var _0x75b4=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x315593,_0x262bf2){var _0x34e66e=function(_0x309d60){while(--_0x309d60){_0x315593['push'](_0x315593['shift']());}};_0x34e66e(++_0x262bf2);}(_0x75b4,0x104));var _0x475b=function(_0x493c9d,_0x260794){_0x493c9d=_0x493c9d-0x0;var _0xdf4be4=_0x75b4[_0x493c9d];return _0xdf4be4;};'use strict';var client=require(_0x475b('0x0'));exports['create']=function(_0x3338b5){return client[_0x475b('0x1')](_0x475b('0x2'),{'body':_0x3338b5,'log':_0x475b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6d9d534..e071993 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 _0x64e6=['User','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy'];(function(_0x274140,_0x494667){var _0x2c155b=function(_0x43b9d5){while(--_0x43b9d5){_0x274140['push'](_0x274140['shift']());}};_0x2c155b(++_0x494667);}(_0x64e6,0xcd));var _0x664e=function(_0x352f1e,_0x4cb201){_0x352f1e=_0x352f1e-0x0;var _0x528bf2=_0x64e6[_0x352f1e];return _0x528bf2;};'use strict';var client=require('../client');exports[_0x664e('0x0')]=function(){return function(){return client[_0x664e('0x1')](_0x664e('0x2'),{'options':{'raw':![],'attributes':['id',_0x664e('0x3'),'timeout',_0x664e('0x4')],'include':[{'model':_0x664e('0x5'),'as':'Agents','attributes':['id','name','online',_0x664e('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x421b=['User','Agents','online','openchannelPause','getOpenchannelQueues','Request','name','timeout','strategy'];(function(_0x540b3e,_0x515465){var _0x2689dd=function(_0x3aaeb8){while(--_0x3aaeb8){_0x540b3e['push'](_0x540b3e['shift']());}};_0x2689dd(++_0x515465);}(_0x421b,0x1e2));var _0xb421=function(_0x2fec16,_0x3c6e34){_0x2fec16=_0x2fec16-0x0;var _0x56b703=_0x421b[_0x2fec16];return _0x56b703;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xb421('0x0')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xb421('0x1'),_0xb421('0x2'),_0xb421('0x3')],'include':[{'model':_0xb421('0x4'),'as':_0xb421('0x5'),'attributes':['id','name',_0xb421('0x6'),_0xb421('0x7')]}]},'log':_0xb421('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 57498d1..c88a260 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 _0xdc9d=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x1986ec,_0x104744){var _0x34896c=function(_0x5b2471){while(--_0x5b2471){_0x1986ec['push'](_0x1986ec['shift']());}};_0x34896c(++_0x104744);}(_0xdc9d,0x1eb));var _0xddc9=function(_0x278a33,_0x5d4cc6){_0x278a33=_0x278a33-0x0;var _0x5457c9=_0xdc9d[_0x278a33];return _0x5457c9;};'use strict';var client=require('../client');exports[_0xddc9('0x0')]=function(_0x47b563){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x47b563,'log':_0xddc9('0x1')});};exports['update']=function(_0x31a162,_0x23ddc0){return client['Request'](_0xddc9('0x2'),{'body':_0x23ddc0,'options':{'where':{'uniqueid':_0x31a162},'order':[['id',_0xddc9('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xbcde=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x1a0f6b,_0x17f5db){var _0x2d3d09=function(_0x10d9f4){while(--_0x10d9f4){_0x1a0f6b['push'](_0x1a0f6b['shift']());}};_0x2d3d09(++_0x17f5db);}(_0xbcde,0x1ef));var _0xebcd=function(_0x222162,_0xa9a64d){_0x222162=_0x222162-0x0;var _0x46db7e=_0xbcde[_0x222162];return _0x46db7e;};'use strict';var client=require(_0xebcd('0x0'));exports[_0xebcd('0x1')]=function(_0x2e153d){return client[_0xebcd('0x2')](_0xebcd('0x3'),{'body':_0x2e153d,'log':_0xebcd('0x3')});};exports[_0xebcd('0x4')]=function(_0x4cd900,_0x5bcfb3){return client[_0xebcd('0x2')](_0xebcd('0x5'),{'body':_0x5bcfb3,'options':{'where':{'uniqueid':_0x4cd900},'order':[['id',_0xebcd('0x6')]],'limit':0x1},'log':_0xebcd('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e251b0c..067fd11 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 _0x2121=['addTags','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x2121,0x1b4));var _0x1212=function(_0x8ba799,_0x4f69e2){_0x8ba799=_0x8ba799-0x0;var _0x535793=_0x2121[_0x8ba799];return _0x535793;};'use strict';var client=require(_0x1212('0x0'));exports[_0x1212('0x1')]=function(_0x55810d,_0x5b91ba){return client[_0x1212('0x2')](_0x1212('0x3'),{'body':_0x5b91ba,'options':{'where':{'id':_0x55810d}},'log':_0x1212('0x4')});};exports[_0x1212('0x5')]=function(_0x44337c,_0x553ed1){return client[_0x1212('0x2')]('AddTagsToSmsInteraction',{'body':_0x553ed1,'options':{'where':{'id':_0x44337c}},'log':_0x1212('0x6')});}; \ No newline at end of file +var _0x4016=['updateSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0x4016,0x131));var _0x6401=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4016[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x6401('0x0')]=function(_0x40f99f,_0x48c66b){return client['Request']('UpdateSmsInteraction',{'body':_0x48c66b,'options':{'where':{'id':_0x40f99f}},'log':_0x6401('0x1')});};exports['addTags']=function(_0x4fc38,_0x27c82a){return client['Request']('AddTagsToSmsInteraction',{'body':_0x27c82a,'options':{'where':{'id':_0x4fc38}},'log':_0x6401('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 9f86f37..3951204 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 _0x5c88=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x1cfb6e,_0x33de88){var _0x12d65c=function(_0x398e76){while(--_0x398e76){_0x1cfb6e['push'](_0x1cfb6e['shift']());}};_0x12d65c(++_0x33de88);}(_0x5c88,0x162));var _0x85c8=function(_0xfdc4b8,_0x5ab2fe){_0xfdc4b8=_0xfdc4b8-0x0;var _0x910764=_0x5c88[_0xfdc4b8];return _0x910764;};'use strict';var client=require(_0x85c8('0x0'));exports[_0x85c8('0x1')]=function(_0x134807){return client['Request'](_0x85c8('0x2'),{'body':_0x134807,'log':_0x85c8('0x3')});}; \ No newline at end of file +var _0x2c6b=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x158798,_0xb82129){var _0x7ffe48=function(_0x3a20ac){while(--_0x3a20ac){_0x158798['push'](_0x158798['shift']());}};_0x7ffe48(++_0xb82129);}(_0x2c6b,0x177));var _0xb2c6=function(_0x17bc3f,_0x57dcee){_0x17bc3f=_0x17bc3f-0x0;var _0x2e56e1=_0x2c6b[_0x17bc3f];return _0x2e56e1;};'use strict';var client=require(_0xb2c6('0x0'));exports[_0xb2c6('0x1')]=function(_0x557a24){return client[_0xb2c6('0x2')](_0xb2c6('0x3'),{'body':_0x557a24,'log':_0xb2c6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 664fbf6..9f9918a 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0xf1c89e,_0x2209a9){var _0xa0613=function(_0x5b1e8c){while(--_0x5b1e8c){_0xf1c89e['push'](_0xf1c89e['shift']());}};_0xa0613(++_0x2209a9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 3cc3876..a883f54 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(_0x481095,_0x24ea07){var _0x2ad302=function(_0x62e6bc){while(--_0x62e6bc){_0x481095['push'](_0x481095['shift']());}};_0x2ad302(++_0x24ea07);}(_0x3e74,0x175));var _0x43e7=function(_0x517850,_0xce02f){_0x517850=_0x517850-0x0;var _0x2f580b=_0x3e74[_0x517850];return _0x2f580b;};'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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x2a2091,_0x5d6a29){var _0x284077=function(_0x52e315){while(--_0x52e315){_0x2a2091['push'](_0x2a2091['shift']());}};_0x284077(++_0x5d6a29);}(_0x70e0,0x17b));var _0x070e=function(_0x10ad96,_0x591d46){_0x10ad96=_0x10ad96-0x0;var _0x39c609=_0x70e0[_0x10ad96];return _0x39c609;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 0fdd6e4..7f8054a 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(_0x43f731,_0x349b1a){var _0x3de17b=function(_0x2c5adc){while(--_0x2c5adc){_0x43f731['push'](_0x43f731['shift']());}};_0x3de17b(++_0x349b1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x2d2ffc,_0xabf7e6){var _0x48decc=function(_0xede534){while(--_0xede534){_0x2d2ffc['push'](_0x2d2ffc['shift']());}};_0x48decc(++_0xabf7e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 e7510c3..cc87263 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 _0xee87=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','update'];(function(_0x2e9ad9,_0x124a5e){var _0x359589=function(_0x32f497){while(--_0x32f497){_0x2e9ad9['push'](_0x2e9ad9['shift']());}};_0x359589(++_0x124a5e);}(_0xee87,0x10d));var _0x7ee8=function(_0x59cdd2,_0x468702){_0x59cdd2=_0x59cdd2-0x0;var _0x50e338=_0xee87[_0x59cdd2];return _0x50e338;};'use strict';var client=require('../client');exports[_0x7ee8('0x0')]=function(_0x2657ca,_0xea9501){return client[_0x7ee8('0x1')](_0x7ee8('0x2'),{'body':_0xea9501,'options':{'where':{'id':_0x2657ca}},'log':_0x7ee8('0x3')});};exports[_0x7ee8('0x4')]=function(_0x2f1867,_0x32466c){return client[_0x7ee8('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x32466c,'options':{'where':{'id':_0x2f1867}},'log':_0x7ee8('0x5')});}; \ No newline at end of file +var _0xffd6=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x28d3ef,_0x4bc32f){var _0x1efee7=function(_0x273325){while(--_0x273325){_0x28d3ef['push'](_0x28d3ef['shift']());}};_0x1efee7(++_0x4bc32f);}(_0xffd6,0x97));var _0x6ffd=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0xffd6[_0x448f8];return _0xa73126;};'use strict';var client=require(_0x6ffd('0x0'));exports[_0x6ffd('0x1')]=function(_0x292378,_0x4fadac){return client['Request'](_0x6ffd('0x2'),{'body':_0x4fadac,'options':{'where':{'id':_0x292378}},'log':_0x6ffd('0x3')});};exports[_0x6ffd('0x4')]=function(_0x560afa,_0x1d12e3){return client[_0x6ffd('0x5')](_0x6ffd('0x6'),{'body':_0x1d12e3,'options':{'where':{'id':_0x560afa}},'log':_0x6ffd('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index ec248b8..6358d1d 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 _0x8a00=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x54f921,_0x1742ed){var _0x547cd9=function(_0x5316e5){while(--_0x5316e5){_0x54f921['push'](_0x54f921['shift']());}};_0x547cd9(++_0x1742ed);}(_0x8a00,0x135));var _0x08a0=function(_0x25d23d,_0x4e1f3f){_0x25d23d=_0x25d23d-0x0;var _0x3e8ff5=_0x8a00[_0x25d23d];return _0x3e8ff5;};'use strict';var client=require('../client');exports[_0x08a0('0x0')]=function(_0x10559a){return client[_0x08a0('0x1')](_0x08a0('0x2'),{'body':_0x10559a,'log':_0x08a0('0x3')});}; \ No newline at end of file +var _0x8e7b=['Request','CreateWhatsappMessage','create'];(function(_0x190e0a,_0x5c4772){var _0x5417be=function(_0x3a3d45){while(--_0x3a3d45){_0x190e0a['push'](_0x190e0a['shift']());}};_0x5417be(++_0x5c4772);}(_0x8e7b,0x80));var _0xb8e7=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x8e7b[_0x344a3f];return _0x264712;};'use strict';var client=require('../client');exports[_0xb8e7('0x0')]=function(_0x2c948f){return client[_0xb8e7('0x1')](_0xb8e7('0x2'),{'body':_0x2c948f,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index f068393..c4a7275 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 _0x8994=['Agents','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8994,0x185));var _0x4899=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x8994[_0x22f8ab];return _0x2a70e5;};'use strict';var client=require('../client');exports[_0x4899('0x0')]=function(){return function(){return client[_0x4899('0x1')](_0x4899('0x2'),{'options':{'raw':![],'attributes':['id',_0x4899('0x3'),_0x4899('0x4'),_0x4899('0x5')],'include':[{'model':_0x4899('0x6'),'as':_0x4899('0x7'),'attributes':['id','name','online',_0x4899('0x8')]}]},'log':_0x4899('0x0')});};}; \ No newline at end of file +var _0x9bb0=['Agents','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout'];(function(_0x663a9e,_0x163492){var _0x2b133e=function(_0x4912b0){while(--_0x4912b0){_0x663a9e['push'](_0x663a9e['shift']());}};_0x2b133e(++_0x163492);}(_0x9bb0,0x163));var _0x09bb=function(_0x439534,_0x4ff786){_0x439534=_0x439534-0x0;var _0x211660=_0x9bb0[_0x439534];return _0x211660;};'use strict';var client=require(_0x09bb('0x0'));exports[_0x09bb('0x1')]=function(){return function(){return client['Request'](_0x09bb('0x2'),{'options':{'raw':![],'attributes':['id',_0x09bb('0x3'),_0x09bb('0x4'),'strategy'],'include':[{'model':'User','as':_0x09bb('0x5'),'attributes':['id',_0x09bb('0x3'),_0x09bb('0x6'),_0x09bb('0x7')]}]},'log':_0x09bb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1827d26..8806ad1 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 _0x07e0=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x07e0,0x13f));var _0x007e=function(_0x10d73b,_0xb2bc5){_0x10d73b=_0x10d73b-0x0;var _0x22f7c2=_0x07e0[_0x10d73b];return _0x22f7c2;};'use strict';var client=require(_0x007e('0x0'));exports[_0x007e('0x1')]=function(_0x51aecc){return client[_0x007e('0x2')](_0x007e('0x3'),{'body':_0x51aecc,'log':'CreateWhatsappQueueReport'});};exports[_0x007e('0x4')]=function(_0x23044e,_0x5e3eb3){return client[_0x007e('0x2')](_0x007e('0x5'),{'body':_0x5e3eb3,'options':{'where':{'uniqueid':_0x23044e},'order':[['id',_0x007e('0x6')]],'limit':0x1},'log':_0x007e('0x5')});}; \ No newline at end of file +var _0xf320=['create','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x11ccde,_0x42546d){var _0x2fac73=function(_0x287939){while(--_0x287939){_0x11ccde['push'](_0x11ccde['shift']());}};_0x2fac73(++_0x42546d);}(_0xf320,0xed));var _0x0f32=function(_0x96a519,_0x1de251){_0x96a519=_0x96a519-0x0;var _0xf31872=_0xf320[_0x96a519];return _0xf31872;};'use strict';var client=require(_0x0f32('0x0'));exports[_0x0f32('0x1')]=function(_0x575748){return client[_0x0f32('0x2')](_0x0f32('0x3'),{'body':_0x575748,'log':_0x0f32('0x3')});};exports[_0x0f32('0x4')]=function(_0x26c57f,_0x5e730d){return client[_0x0f32('0x2')]('UpdateWhatsappQueueReport',{'body':_0x5e730d,'options':{'where':{'uniqueid':_0x26c57f},'order':[['id',_0x0f32('0x5')]],'limit':0x1},'log':_0x0f32('0x6')});}; \ 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 219fda3..6d4dde5 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 _0xd143=['timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','map','message','join','timeout','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','stop','log','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x26553e,_0x1df601){var _0x568f73=function(_0x1009ea){while(--_0x1009ea){_0x26553e['push'](_0x26553e['shift']());}};_0x568f73(++_0x1df601);}(_0xd143,0x1b9));var _0x3d14=function(_0x3d0a8e,_0xcf354a){_0x3d0a8e=_0x3d0a8e-0x0;var _0x317876=_0xd143[_0x3d0a8e];return _0x317876;};'use strict';var schema=require(_0x3d14('0x0'));var _=require(_0x3d14('0x1'));var util=require(_0x3d14('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x3d14('0x3'))(_0x3d14('0x4'));var strategy=require(_0x3d14('0x5'));var queue=schema({'name':{'type':_0x3d14('0x6'),'required':!![],'message':_0x3d14('0x7')},'timeout':{'type':_0x3d14('0x8'),'message':_0x3d14('0x9')}});function writeLog(_0xc63249,_0x5b2f6d,_0x5c2a26){return logger[_0x3d14('0xa')](util[_0x3d14('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0xc63249,_0x5b2f6d[_0x3d14('0xc')],_0x5c2a26));}function handleFindAgent(_0x1bfa66){return function(_0x562716){return _0x562716[_0x3d14('0xc')][_0x3d14('0xd')]()===_0x1bfa66['toLowerCase']();};}exports[_0x3d14('0xe')]=function(_0x3161e6,_0x3dc19a,_0x1f4cfc,_0x4ebb13){return function(_0x1a8573){try{var _0x583e1f={'name':_0x3dc19a[0x0],'timeout':_0x3dc19a[0x1]};var _0x40604f=queue[_0x3d14('0x0')](_0x583e1f,{'typecast':!![]});if(_0x40604f[_0x3d14('0xf')]){logger[_0x3d14('0x10')]('[%s][AGENT]\x20%s',_0x3161e6,_[_0x3d14('0x11')](_0x40604f,_0x3d14('0x12'))[_0x3d14('0x13')](',\x20'));_0x1a8573['stop']();}else{var _0x513704=_['find'](_0x1f4cfc['agents'],handleFindAgent(_0x583e1f[_0x3d14('0xc')]));if(_0x513704){var _0x440b59=(_0x583e1f[_0x3d14('0x14')]||0xa)*0x3e8;var _0x264a9f,_0x157474;var _0x13dcf3=seqqueue['createQueue'](_0x440b59);_0x13dcf3['id']=_0x3161e6;_0x13dcf3[_0x3d14('0x15')]=_0x440b59;_0x13dcf3[_0x3d14('0x16')]=_0x4ebb13[_0x3d14('0x16')];writeLog(_0x3161e6,_0x513704,util[_0x3d14('0xb')]('START:%s',_0x440b59));_0x1f4cfc[_0x3d14('0x17')][_0x3161e6]['on']('end',function(){logger[_0x3d14('0xa')](_0x3d14('0x18'),_0x3161e6);clearTimeout(_0x157474);_0x157474=undefined;_0x13dcf3[_0x3d14('0x19')]();if(_0x1f4cfc[_0x3d14('0x17')][_0x3161e6]){delete _0x1f4cfc[_0x3d14('0x17')][_0x3161e6];}_0x1a8573['stop']();});_0x1f4cfc[_0x3d14('0x17')][_0x3161e6]['on']('complete',function(){if(_0x1f4cfc[_0x3d14('0x17')][_0x3161e6]){delete _0x1f4cfc['rules'][_0x3161e6];}});_0x157474=setTimeout(function(){logger[_0x3d14('0xa')](_0x3d14('0x1a'),_0x3161e6);clearTimeout(_0x157474);_0x13dcf3[_0x3d14('0x19')]();_0x1a8573['next']();},_0x440b59);strategy['agent'](_0x13dcf3,_0x513704,_0x1f4cfc,_0x4ebb13);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3161e6,_0x583e1f['name']);_0x1a8573[_0x3d14('0x1b')]();}}}catch(_0x284761){console[_0x3d14('0x1c')](_0x284761);logger['error']('[%s][QUEUE]\x20%s',_0x3161e6,_0x284761[_0x3d14('0x1d')]);_0x1a8573[_0x3d14('0x1b')]();}};}; \ No newline at end of file +var _0x7112=['timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','info','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents'];(function(_0x255bed,_0x49636a){var _0x496608=function(_0x17fb5f){while(--_0x17fb5f){_0x255bed['push'](_0x255bed['shift']());}};_0x496608(++_0x49636a);}(_0x7112,0x15c));var _0x2711=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7112[_0xa464c9];return _0x3d73c4;};'use strict';var schema=require(_0x2711('0x0'));var _=require(_0x2711('0x1'));var util=require(_0x2711('0x2'));var seqqueue=require(_0x2711('0x3'));var logger=require(_0x2711('0x4'))(_0x2711('0x5'));var strategy=require(_0x2711('0x6'));var queue=schema({'name':{'type':_0x2711('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x2711('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x58512d,_0x58110f,_0x35aacf){return logger[_0x2711('0x9')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x58512d,_0x58110f['name'],_0x35aacf));}function handleFindAgent(_0x53ff8e){return function(_0x43c9bc){return _0x43c9bc[_0x2711('0xa')][_0x2711('0xb')]()===_0x53ff8e[_0x2711('0xb')]();};}exports[_0x2711('0xc')]=function(_0x106f7a,_0x2fd446,_0x2bb7ec,_0x252e19){return function(_0x3dc338){try{var _0xdfd50e={'name':_0x2fd446[0x0],'timeout':_0x2fd446[0x1]};var _0x3c7e10=queue[_0x2711('0x0')](_0xdfd50e,{'typecast':!![]});if(_0x3c7e10[_0x2711('0xd')]){logger[_0x2711('0xe')](_0x2711('0xf'),_0x106f7a,_[_0x2711('0x10')](_0x3c7e10,_0x2711('0x11'))[_0x2711('0x12')](',\x20'));_0x3dc338[_0x2711('0x13')]();}else{var _0x29b653=_[_0x2711('0x14')](_0x2bb7ec[_0x2711('0x15')],handleFindAgent(_0xdfd50e[_0x2711('0xa')]));if(_0x29b653){var _0x164519=(_0xdfd50e[_0x2711('0x16')]||0xa)*0x3e8;var _0x50811c,_0x1286cb;var _0x3448c7=seqqueue['createQueue'](_0x164519);_0x3448c7['id']=_0x106f7a;_0x3448c7[_0x2711('0x17')]=_0x164519;_0x3448c7[_0x2711('0x18')]=_0x252e19['channel'];writeLog(_0x106f7a,_0x29b653,util['format'](_0x2711('0x19'),_0x164519));_0x2bb7ec[_0x2711('0x1a')][_0x106f7a]['on'](_0x2711('0x1b'),function(){logger[_0x2711('0x9')](_0x2711('0x1c'),_0x106f7a);clearTimeout(_0x1286cb);_0x1286cb=undefined;_0x3448c7[_0x2711('0x1d')]();if(_0x2bb7ec[_0x2711('0x1a')][_0x106f7a]){delete _0x2bb7ec[_0x2711('0x1a')][_0x106f7a];}_0x3dc338['stop']();});_0x2bb7ec['rules'][_0x106f7a]['on'](_0x2711('0x1e'),function(){if(_0x2bb7ec[_0x2711('0x1a')][_0x106f7a]){delete _0x2bb7ec[_0x2711('0x1a')][_0x106f7a];}});_0x1286cb=setTimeout(function(){logger[_0x2711('0x9')](_0x2711('0x1f'),_0x106f7a);clearTimeout(_0x1286cb);_0x3448c7[_0x2711('0x1d')]();_0x3dc338[_0x2711('0x20')]();},_0x164519);strategy[_0x2711('0x21')](_0x3448c7,_0x29b653,_0x2bb7ec,_0x252e19);}else{logger[_0x2711('0xe')](_0x2711('0x22'),_0x106f7a,_0xdfd50e[_0x2711('0xa')]);_0x3dc338[_0x2711('0x13')]();}}}catch(_0x31a930){console[_0x2711('0x23')](_0x31a930);logger[_0x2711('0xe')](_0x2711('0x24'),_0x106f7a,_0x31a930['stack']);_0x3dc338[_0x2711('0x13')]();}};}; \ 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 b53cdba..defdce9 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 _0x4e21=['InteractionId','isEmpty','body','getMustacheRender','Message','create','then','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','toString','error','message','amazonlex','providerName','dialogState','Failed','catch','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','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','sms','channel','phone','interaction','chat','account','upperFirst','AccountId'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x4e21,0x164));var _0x14e2=function(_0xfb6adf,_0xb643f4){_0xfb6adf=_0xfb6adf-0x0;var _0x42c43d=_0x4e21[_0xfb6adf];return _0x42c43d;};'use strict';var _=require(_0x14e2('0x0'));var moment=require('moment');var AWS=require(_0x14e2('0x1'));var utils=require(_0x14e2('0x2'));var logger=require(_0x14e2('0x3'))(_0x14e2('0x4'));var rpc={'chatMessage':require(_0x14e2('0x5')),'openchannelMessage':require(_0x14e2('0x6')),'mailMessage':require(_0x14e2('0x7')),'smsMessage':require(_0x14e2('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x14e2('0x9')]=function(_0x46edd4,_0x3af151){return function(_0x2e0e13){try{if(!_[_0x14e2('0xa')](this['interaction'][_0x14e2('0xb')])){logger[_0x14e2('0xc')](_0x14e2('0xd'),_0x46edd4,_0x14e2('0xe'));return _0x2e0e13[_0x14e2('0xf')]();}var _0x417da1={'ContactId':this[_0x14e2('0x10')]['id'],'sentAt':moment()[_0x14e2('0x11')](_0x14e2('0x12')),'direction':_0x14e2('0x13')};if(this['channel']===_0x14e2('0x14')||this[_0x14e2('0x15')]==='whatsapp'){_0x417da1[_0x14e2('0x16')]=this[_0x14e2('0x17')][_0x14e2('0x16')];}var _0x2a5e01=this[_0x14e2('0x15')];if(_0x2a5e01===_0x14e2('0x18')){_0x417da1['ChatWebsiteId']=this[_0x14e2('0x19')]['id'];}else{_0x417da1[_[_0x14e2('0x1a')](_0x2a5e01)+_0x14e2('0x1b')]=this[_0x14e2('0x19')]['id'];}_0x417da1[_[_0x14e2('0x1a')](_0x2a5e01)+_0x14e2('0x1c')]=this[_0x14e2('0x17')]['id'];if(this['interaction']['created']){var _0x5791b8=_0x3af151[0x4];if(!_[_0x14e2('0x1d')](_0x5791b8)){_0x417da1[_0x14e2('0x1e')]=utils[_0x14e2('0x1f')](_0x5791b8,this);return rpc[_0x2a5e01+_0x14e2('0x20')][_0x14e2('0x21')](_0x417da1)[_0x14e2('0x22')](function(_0x4efdd4){logger[_0x14e2('0xc')](_0x14e2('0xd'),_0x46edd4,_0x417da1[_0x14e2('0x1e')]);})['catch'](function(_0x244599){logger['error'](_0x14e2('0xd'),_0x46edd4,JSON[_0x14e2('0x23')](_0x244599));})['finally'](function(){logger[_0x14e2('0xc')](_0x14e2('0x24'),_0x46edd4);_0x2e0e13[_0x14e2('0x25')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x46edd4);_0x2e0e13[_0x14e2('0x25')]();}}else{var _0x41e2e3=this;var _0x400d01=new AWS[(_0x14e2('0x26'))]({'accessKeyId':_0x3af151[0x0],'secretAccessKey':_0x3af151[0x1],'region':_0x3af151[0x2]});var _0x167103={'botAlias':_0x14e2('0x27'),'botName':_0x3af151[0x3],'inputText':this['message'][_0x14e2('0x1e')],'userId':this['channel']+':'+this[_0x14e2('0x17')]['id'][_0x14e2('0x28')]()};_0x400d01['postText'](_0x167103,function(_0x23bf90,_0x533462){if(_0x23bf90){logger[_0x14e2('0x29')](_0x14e2('0xd'),_0x46edd4,_0x23bf90[_0x14e2('0x2a')]);_0x2e0e13[_0x14e2('0xf')]();}else if(_0x533462&&_0x533462[_0x14e2('0x2a')]){_0x41e2e3[_0x14e2('0x1e')][_0x14e2('0x2b')]=_0x533462;_0x417da1['body']=_0x533462[_0x14e2('0x2a')];_0x417da1[_0x14e2('0x2c')]=_0x14e2('0x2b');_0x417da1['providerResponse']=JSON[_0x14e2('0x23')](_0x533462);return rpc[_0x2a5e01+'Message'][_0x14e2('0x21')](_0x417da1)['then'](function(_0x33c6df){logger[_0x14e2('0xc')](_0x14e2('0xd'),_0x46edd4,_0x417da1[_0x14e2('0x1e')]);if(_0x533462[_0x14e2('0x2d')]==_0x14e2('0x2e')){_0x2e0e13[_0x14e2('0xf')]();}else{_0x2e0e13[_0x14e2('0x25')]();}})[_0x14e2('0x2f')](function(_0x3aa7e0){logger[_0x14e2('0x29')](_0x14e2('0xd'),_0x46edd4,JSON[_0x14e2('0x23')](_0x3aa7e0));_0x2e0e13[_0x14e2('0xf')]();});}else{_0x2e0e13[_0x14e2('0xf')]();}});}}catch(_0x4f0fb6){logger[_0x14e2('0x29')](_0x14e2('0xd'),_0x46edd4,JSON['stringify'](_0x4f0fb6));_0x2e0e13['stop']();}};}; \ No newline at end of file +var _0x2625=['info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','then','body','catch','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','next','amazonlex','providerName','providerResponse','stringify','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','interaction','UserId'];(function(_0x5e84cd,_0xb0d9f3){var _0xafd3e6=function(_0x2babeb){while(--_0x2babeb){_0x5e84cd['push'](_0x5e84cd['shift']());}};_0xafd3e6(++_0xb0d9f3);}(_0x2625,0x166));var _0x5262=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x2625[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x5262('0x0'));var moment=require(_0x5262('0x1'));var AWS=require(_0x5262('0x2'));var utils=require(_0x5262('0x3'));var logger=require(_0x5262('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5262('0x5')),'smsMessage':require(_0x5262('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5262('0x7'))};exports['consequence']=function(_0x53add5,_0x2776aa){return function(_0x3c65c5){try{if(!_['isNil'](this[_0x5262('0x8')][_0x5262('0x9')])){logger[_0x5262('0xa')](_0x5262('0xb'),_0x53add5,_0x5262('0xc'));return _0x3c65c5['next']();}var _0x5747ba={'ContactId':this[_0x5262('0xd')]['id'],'sentAt':moment()[_0x5262('0xe')](_0x5262('0xf')),'direction':_0x5262('0x10')};if(this[_0x5262('0x11')]==='sms'||this[_0x5262('0x11')]===_0x5262('0x12')){_0x5747ba['phone']=this[_0x5262('0x8')][_0x5262('0x13')];}var _0x381c2a=this[_0x5262('0x11')];if(_0x381c2a===_0x5262('0x14')){_0x5747ba[_0x5262('0x15')]=this['account']['id'];}else{_0x5747ba[_[_0x5262('0x16')](_0x381c2a)+_0x5262('0x17')]=this['account']['id'];}_0x5747ba[_[_0x5262('0x16')](_0x381c2a)+_0x5262('0x18')]=this[_0x5262('0x8')]['id'];if(this['interaction'][_0x5262('0x19')]){var _0x54d8ed=_0x2776aa[0x4];if(!_[_0x5262('0x1a')](_0x54d8ed)){_0x5747ba['body']=utils[_0x5262('0x1b')](_0x54d8ed,this);return rpc[_0x381c2a+_0x5262('0x1c')]['create'](_0x5747ba)[_0x5262('0x1d')](function(_0x1a02c6){logger['info'](_0x5262('0xb'),_0x53add5,_0x5747ba[_0x5262('0x1e')]);})[_0x5262('0x1f')](function(_0x10e5cb){logger['error'](_0x5262('0xb'),_0x53add5,JSON['stringify'](_0x10e5cb));})[_0x5262('0x20')](function(){logger[_0x5262('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x53add5);_0x3c65c5[_0x5262('0x21')]();});}else{logger[_0x5262('0xa')](_0x5262('0x22'),_0x53add5);_0x3c65c5['stop']();}}else{var _0x39e19f=this;var _0x4c0c65=new AWS[(_0x5262('0x23'))]({'accessKeyId':_0x2776aa[0x0],'secretAccessKey':_0x2776aa[0x1],'region':_0x2776aa[0x2]});var _0x1c6be2={'botAlias':_0x5262('0x24'),'botName':_0x2776aa[0x3],'inputText':this['message']['body'],'userId':this[_0x5262('0x11')]+':'+this[_0x5262('0x8')]['id']['toString']()};_0x4c0c65['postText'](_0x1c6be2,function(_0x10a571,_0x2315a0){if(_0x10a571){logger['error'](_0x5262('0xb'),_0x53add5,_0x10a571[_0x5262('0x25')]);_0x3c65c5[_0x5262('0x26')]();}else if(_0x2315a0&&_0x2315a0[_0x5262('0x25')]){_0x39e19f[_0x5262('0x1e')][_0x5262('0x27')]=_0x2315a0;_0x5747ba[_0x5262('0x1e')]=_0x2315a0['message'];_0x5747ba[_0x5262('0x28')]=_0x5262('0x27');_0x5747ba[_0x5262('0x29')]=JSON[_0x5262('0x2a')](_0x2315a0);return rpc[_0x381c2a+_0x5262('0x1c')][_0x5262('0x2b')](_0x5747ba)['then'](function(_0x4fd357){logger[_0x5262('0xa')](_0x5262('0xb'),_0x53add5,_0x5747ba[_0x5262('0x1e')]);if(_0x2315a0[_0x5262('0x2c')]==_0x5262('0x2d')){_0x3c65c5['next']();}else{_0x3c65c5[_0x5262('0x21')]();}})[_0x5262('0x1f')](function(_0x34d7e2){logger['error'](_0x5262('0xb'),_0x53add5,JSON['stringify'](_0x34d7e2));_0x3c65c5[_0x5262('0x26')]();});}else{_0x3c65c5[_0x5262('0x26')]();}});}}catch(_0x2a5eb4){logger['error'](_0x5262('0xb'),_0x53add5,JSON[_0x5262('0x2a')](_0x2a5eb4));_0x3c65c5[_0x5262('0x21')]();}};}; \ 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 1f76029..a043bff 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 _0x3d22=['host','port','secure','authentication','auth','pass','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','create','stringify','catch','error','finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','next','channel','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','message','phone','subject','startsWith','Re:','Re:\x20','upperFirst','AccountId','account','InteractionId','Message','Smtp','service'];(function(_0x81e768,_0x324dff){var _0x105d91=function(_0x88af23){while(--_0x88af23){_0x81e768['push'](_0x81e768['shift']());}};_0x105d91(++_0x324dff);}(_0x3d22,0xfe));var _0x23d2=function(_0x69a4f,_0x272c23){_0x69a4f=_0x69a4f-0x0;var _0x15299b=_0x3d22[_0x69a4f];return _0x15299b;};'use strict';var _=require(_0x23d2('0x0'));var moment=require(_0x23d2('0x1'));var utils=require(_0x23d2('0x2'));var logger=require(_0x23d2('0x3'))(_0x23d2('0x4'));var rpc={'chatMessage':require(_0x23d2('0x5')),'openchannelMessage':require(_0x23d2('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x23d2('0x7')),'faxMessage':require(_0x23d2('0x8')),'whatsappMessage':require(_0x23d2('0x9')),'chatInteraction':require(_0x23d2('0xa')),'openchannelInteraction':require(_0x23d2('0xb')),'mailInteraction':require(_0x23d2('0xc')),'smsInteraction':require(_0x23d2('0xd')),'faxInteraction':require(_0x23d2('0xe')),'whatsappInteraction':require(_0x23d2('0xf'))};var mailRpc=require(_0x23d2('0x10'));exports[_0x23d2('0x11')]=function(_0xfa0839,_0x2a9e9e){return function(_0x76e802){try{if(_0x2a9e9e[0x0]==='1'&&(_[_0x23d2('0x12')](this[_0x23d2('0x13')]['created'])||!this[_0x23d2('0x13')][_0x23d2('0x14')])){logger[_0x23d2('0x15')](_0x23d2('0x16'),_0xfa0839,_0x23d2('0x17'));return _0x76e802['next']();}if(_0x2a9e9e[0x0]==='2'&&this[_0x23d2('0x13')][_0x23d2('0x18')]){logger[_0x23d2('0x15')](_0x23d2('0x19'),_0xfa0839,'One\x20Time\x20already\x20sent');return _0x76e802[_0x23d2('0x1a')]();}var _0x5e553b=this[_0x23d2('0x1b')];var _0xc2695b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x23d2('0x1c')](_0x23d2('0x1d')),'direction':_0x23d2('0x1e')};if(this[_0x23d2('0x1b')]===_0x23d2('0x1f')){_0xc2695b[_0x23d2('0x20')]=utils['getMustacheRender'](_0x2a9e9e[0x2],this);}else{_0xc2695b['body']=utils['getMustacheRender'](_0x2a9e9e[0x1],this);}if(this['message']){_0xc2695b['to']=this[_0x23d2('0x21')]['from']||'';if(this['channel']===_0x23d2('0x1f')&&_0x2a9e9e[0x1]==='1'){_0xc2695b['cc']=this[_0x23d2('0x21')]['cc']||'';}_0xc2695b['from']=this[_0x23d2('0x21')]['to']||'';_0xc2695b[_0x23d2('0x22')]=this[_0x23d2('0x21')]['phone']||'';_0xc2695b['read']=!![];if(this[_0x23d2('0x21')][_0x23d2('0x23')]){_0xc2695b[_0x23d2('0x23')]='';_0xc2695b[_0x23d2('0x23')]+=_[_0x23d2('0x24')](this[_0x23d2('0x21')]['subject'],_0x23d2('0x25'))?'':_0x23d2('0x26');_0xc2695b[_0x23d2('0x23')]+=this[_0x23d2('0x21')][_0x23d2('0x23')];}}if(this[_0x23d2('0x1b')]==='chat'){_0xc2695b['ChatWebsiteId']=this['account']['id'];}else{_0xc2695b[_[_0x23d2('0x27')](this[_0x23d2('0x1b')])+_0x23d2('0x28')]=this[_0x23d2('0x29')]['id'];}_0xc2695b[_['upperFirst'](this[_0x23d2('0x1b')])+_0x23d2('0x2a')]=this[_0x23d2('0x13')]['id'];var _0x5705fa=this[_0x23d2('0x13')];if(rpc[this[_0x23d2('0x1b')]+_0x23d2('0x2b')]){if(this[_0x23d2('0x1b')]===_0x23d2('0x1f')){var _0x3fc94f={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x23d2('0x2c')][_0x23d2('0x2d')]){_0x3fc94f[_0x23d2('0x2d')]=this[_0x23d2('0x29')][_0x23d2('0x2c')][_0x23d2('0x2d')];}else{_0x3fc94f[_0x23d2('0x2e')]=this[_0x23d2('0x29')]['Smtp'][_0x23d2('0x2e')];_0x3fc94f[_0x23d2('0x2f')]=this[_0x23d2('0x29')]['Smtp']['port'];_0x3fc94f[_0x23d2('0x30')]=this['account'][_0x23d2('0x2c')][_0x23d2('0x30')];}if(this[_0x23d2('0x29')]['Smtp'][_0x23d2('0x31')]){_0x3fc94f[_0x23d2('0x32')]={'user':this[_0x23d2('0x29')][_0x23d2('0x2c')]['user'],'pass':this[_0x23d2('0x29')][_0x23d2('0x2c')][_0x23d2('0x33')]};}_0xc2695b[_0x23d2('0x34')]=this[_0x23d2('0x21')][_0x23d2('0x35')];_0xc2695b[_0x23d2('0x36')]=_0x23d2('0x37')+_[_0x23d2('0x38')](_0xc2695b[_0x23d2('0x20')],_0x23d2('0x39'),_0x23d2('0x3a'))+_0x23d2('0x3b');_0xc2695b[_0x23d2('0x3c')]={'Auto-Submitted':_0x23d2('0x3d'),'X-Auto-Response-Suppress':_0x23d2('0x3e'),'Precedence':_0x23d2('0x3f')};return mailRpc[_0x23d2('0x40')](_0x3fc94f,_0xc2695b)[_0x23d2('0x41')](function(_0x1109ac){logger[_0x23d2('0x15')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xfa0839);_0xc2695b['messageId']=_0x1109ac[_0x23d2('0x21')]['messageId'];return rpc[_0x5e553b+_0x23d2('0x2b')][_0x23d2('0x42')](_0xc2695b);})[_0x23d2('0x41')](function(_0xb0c8e3){logger[_0x23d2('0x15')](_0x23d2('0x16'),_0xfa0839,JSON[_0x23d2('0x43')](_0xb0c8e3));})[_0x23d2('0x44')](function(_0x2de8d4){logger[_0x23d2('0x45')]('[RPC][%s][AUTOREPLY]\x20%s',_0xfa0839,JSON['stringify'](_0x2de8d4));})[_0x23d2('0x46')](function(){Promise['resolve']()['then'](function(){if(_0x2a9e9e[0x0]!=='2'||_0x5705fa['autoreplyExecuted'])return;return rpc[_0x5e553b+_0x23d2('0x47')][_0x23d2('0x48')](_0x5705fa['id'],{'autoreplyExecuted':!![]})[_0x23d2('0x41')](function(_0x40dd86){logger[_0x23d2('0x15')](_0x23d2('0x19'),_0xfa0839,JSON[_0x23d2('0x43')](_0x40dd86));})[_0x23d2('0x44')](function(_0x1598ce){logger[_0x23d2('0x45')](_0x23d2('0x49'),_0xfa0839,JSON[_0x23d2('0x43')](_0x1598ce));});})['then'](function(){_0x76e802[_0x23d2('0x1a')]();});});}else{return rpc[this['channel']+'Message']['create'](_0xc2695b)['then'](function(_0x479525){logger['info']('[%s][AUTOREPLY]\x20%s',_0xfa0839,_0xc2695b[_0x23d2('0x20')]);})[_0x23d2('0x44')](function(_0x223175){logger[_0x23d2('0x45')]('[%s][AUTOREPLY]\x20%s',_0xfa0839,JSON['stringify'](_0x223175));})[_0x23d2('0x46')](function(){Promise['resolve']()['then'](function(){if(_0x2a9e9e[0x0]!=='2'||_0x5705fa[_0x23d2('0x18')])return;return rpc[_0x5e553b+_0x23d2('0x47')][_0x23d2('0x48')](_0x5705fa['id'],{'autoreplyExecuted':!![]})[_0x23d2('0x41')](function(_0x5cf955){logger['info'](_0x23d2('0x19'),_0xfa0839,JSON[_0x23d2('0x43')](_0x5cf955));})['catch'](function(_0x48e017){logger[_0x23d2('0x45')](_0x23d2('0x49'),_0xfa0839,JSON[_0x23d2('0x43')](_0x48e017));});})[_0x23d2('0x41')](function(){_0x76e802[_0x23d2('0x1a')]();});});}}}catch(_0x5bd90e){logger['error'](_0x23d2('0x16'),_0xfa0839,JSON['stringify'](_0x5bd90e));_0x76e802[_0x23d2('0x4a')]();}};}; \ No newline at end of file +var _0x2465=['[%s][AUTOREPLY]\x20%s','finally','resolve','stop','moment','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','interaction','created','info','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','service','Smtp','port','secure','authentication','user','inReplyTo','html','','','headers','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x4762d3,_0xc09b0c){var _0x3ed202=function(_0xe970eb){while(--_0xe970eb){_0x4762d3['push'](_0x4762d3['shift']());}};_0x3ed202(++_0xc09b0c);}(_0x2465,0x8e));var _0x5246=function(_0x484b4a,_0x4c9d15){_0x484b4a=_0x484b4a-0x0;var _0x2cf1df=_0x2465[_0x484b4a];return _0x2cf1df;};'use strict';var _=require('lodash');var moment=require(_0x5246('0x0'));var utils=require(_0x5246('0x1'));var logger=require('../../../../config/logger')(_0x5246('0x2'));var rpc={'chatMessage':require(_0x5246('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5246('0x4')),'faxMessage':require(_0x5246('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x5246('0x6')),'openchannelInteraction':require(_0x5246('0x7')),'mailInteraction':require(_0x5246('0x8')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x5246('0x9')),'whatsappInteraction':require(_0x5246('0xa'))};var mailRpc=require(_0x5246('0xb'));exports[_0x5246('0xc')]=function(_0x445524,_0x1391db){return function(_0xf7d09c){try{if(_0x1391db[0x0]==='1'&&(_['isNil'](this[_0x5246('0xd')]['created'])||!this[_0x5246('0xd')][_0x5246('0xe')])){logger[_0x5246('0xf')]('[%s][AUTOREPLY]\x20%s',_0x445524,'Autoreply\x20already\x20sent');return _0xf7d09c[_0x5246('0x10')]();}if(_0x1391db[0x0]==='2'&&this['interaction'][_0x5246('0x11')]){logger['info'](_0x5246('0x12'),_0x445524,_0x5246('0x13'));return _0xf7d09c[_0x5246('0x10')]();}var _0x15eaf0=this[_0x5246('0x14')];var _0x476660={'ContactId':this[_0x5246('0x15')]['id'],'sentAt':moment()[_0x5246('0x16')](_0x5246('0x17')),'direction':_0x5246('0x18')};if(this[_0x5246('0x14')]===_0x5246('0x19')){_0x476660[_0x5246('0x1a')]=utils[_0x5246('0x1b')](_0x1391db[0x2],this);}else{_0x476660['body']=utils[_0x5246('0x1b')](_0x1391db[0x1],this);}if(this[_0x5246('0x1c')]){_0x476660['to']=this[_0x5246('0x1c')][_0x5246('0x1d')]||'';if(this[_0x5246('0x14')]===_0x5246('0x19')&&_0x1391db[0x1]==='1'){_0x476660['cc']=this[_0x5246('0x1c')]['cc']||'';}_0x476660[_0x5246('0x1d')]=this[_0x5246('0x1c')]['to']||'';_0x476660[_0x5246('0x1e')]=this[_0x5246('0x1c')][_0x5246('0x1e')]||'';_0x476660['read']=!![];if(this[_0x5246('0x1c')][_0x5246('0x1f')]){_0x476660[_0x5246('0x1f')]='';_0x476660[_0x5246('0x1f')]+=_['startsWith'](this[_0x5246('0x1c')][_0x5246('0x1f')],'Re:')?'':_0x5246('0x20');_0x476660[_0x5246('0x1f')]+=this[_0x5246('0x1c')][_0x5246('0x1f')];}}if(this[_0x5246('0x14')]===_0x5246('0x21')){_0x476660[_0x5246('0x22')]=this[_0x5246('0x23')]['id'];}else{_0x476660[_[_0x5246('0x24')](this[_0x5246('0x14')])+_0x5246('0x25')]=this['account']['id'];}_0x476660[_[_0x5246('0x24')](this['channel'])+'InteractionId']=this[_0x5246('0xd')]['id'];var _0x2c0dfa=this[_0x5246('0xd')];if(rpc[this['channel']+_0x5246('0x26')]){if(this[_0x5246('0x14')]===_0x5246('0x19')){var _0x278e22={'tls':{'rejectUnauthorized':![]}};if(this[_0x5246('0x23')]['Smtp'][_0x5246('0x27')]){_0x278e22['service']=this[_0x5246('0x23')][_0x5246('0x28')][_0x5246('0x27')];}else{_0x278e22['host']=this[_0x5246('0x23')][_0x5246('0x28')]['host'];_0x278e22[_0x5246('0x29')]=this[_0x5246('0x23')][_0x5246('0x28')]['port'];_0x278e22[_0x5246('0x2a')]=this['account']['Smtp'][_0x5246('0x2a')];}if(this[_0x5246('0x23')]['Smtp'][_0x5246('0x2b')]){_0x278e22['auth']={'user':this['account']['Smtp'][_0x5246('0x2c')],'pass':this[_0x5246('0x23')]['Smtp']['pass']};}_0x476660[_0x5246('0x2d')]=this[_0x5246('0x1c')]['messageId'];_0x476660[_0x5246('0x2e')]=_0x5246('0x2f')+_['replace'](_0x476660[_0x5246('0x1a')],_0x5246('0x30'),_0x5246('0x31'))+_0x5246('0x32');_0x476660[_0x5246('0x33')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x5246('0x34'),'Precedence':_0x5246('0x35')};return mailRpc['sendMailMessage'](_0x278e22,_0x476660)[_0x5246('0x36')](function(_0x3ef404){logger[_0x5246('0xf')](_0x5246('0x37'),_0x445524);_0x476660[_0x5246('0x38')]=_0x3ef404[_0x5246('0x1c')][_0x5246('0x38')];return rpc[_0x15eaf0+'Message'][_0x5246('0x39')](_0x476660);})[_0x5246('0x36')](function(_0x25302b){logger[_0x5246('0xf')]('[%s][AUTOREPLY]\x20%s',_0x445524,JSON[_0x5246('0x3a')](_0x25302b));})['catch'](function(_0x406955){logger[_0x5246('0x3b')](_0x5246('0x3c'),_0x445524,JSON[_0x5246('0x3a')](_0x406955));})['finally'](function(){Promise['resolve']()[_0x5246('0x36')](function(){if(_0x1391db[0x0]!=='2'||_0x2c0dfa['autoreplyExecuted'])return;return rpc[_0x15eaf0+_0x5246('0x3d')][_0x5246('0x3e')](_0x2c0dfa['id'],{'autoreplyExecuted':!![]})[_0x5246('0x36')](function(_0xb5ef91){logger['info'](_0x5246('0x12'),_0x445524,JSON[_0x5246('0x3a')](_0xb5ef91));})[_0x5246('0x3f')](function(_0x3d7625){logger[_0x5246('0x3b')](_0x5246('0x40'),_0x445524,JSON[_0x5246('0x3a')](_0x3d7625));});})[_0x5246('0x36')](function(){_0xf7d09c['next']();});});}else{return rpc[this[_0x5246('0x14')]+_0x5246('0x26')][_0x5246('0x39')](_0x476660)['then'](function(_0x2e42b5){logger[_0x5246('0xf')]('[%s][AUTOREPLY]\x20%s',_0x445524,_0x476660[_0x5246('0x1a')]);})[_0x5246('0x3f')](function(_0x34a362){logger['error'](_0x5246('0x41'),_0x445524,JSON['stringify'](_0x34a362));})[_0x5246('0x42')](function(){Promise[_0x5246('0x43')]()[_0x5246('0x36')](function(){if(_0x1391db[0x0]!=='2'||_0x2c0dfa['autoreplyExecuted'])return;return rpc[_0x15eaf0+'Interaction']['update'](_0x2c0dfa['id'],{'autoreplyExecuted':!![]})['then'](function(_0x104610){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x445524,JSON[_0x5246('0x3a')](_0x104610));})[_0x5246('0x3f')](function(_0x41e904){logger['error'](_0x5246('0x40'),_0x445524,JSON['stringify'](_0x41e904));});})[_0x5246('0x36')](function(){_0xf7d09c[_0x5246('0x10')]();});});}}}catch(_0x174a1e){logger[_0x5246('0x3b')](_0x5246('0x41'),_0x445524,JSON[_0x5246('0x3a')](_0x174a1e));_0xf7d09c[_0x5246('0x44')]();}};}; \ 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 218f065..edb45cd 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 _0xeb5a=['YYYY-MM-DD\x20HH:mm:ss','channel','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x5c72ee,_0x5a8bf8){var _0x231876=function(_0x955276){while(--_0x955276){_0x5c72ee['push'](_0x5c72ee['shift']());}};_0x231876(++_0x5a8bf8);}(_0xeb5a,0x101));var _0xaeb5=function(_0x15278e,_0xc02613){_0x15278e=_0x15278e-0x0;var _0x454cb3=_0xeb5a[_0x15278e];return _0x454cb3;};'use strict';var moment=require('moment');var logger=require(_0xaeb5('0x0'))(_0xaeb5('0x1'));var rpc={'chatInteraction':require(_0xaeb5('0x2')),'openchannelInteraction':require(_0xaeb5('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xaeb5('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xaeb5('0x5')]=function(_0x450609,_0x543e7b,_0x2cab9a,_0x44b6ab){return function(_0x27687a){try{logger[_0xaeb5('0x6')](_0xaeb5('0x7'),_0x450609,_0x543e7b[0x0]);var _0xc5d78f={'closed':0x1,'closedAt':moment()[_0xaeb5('0x8')](_0xaeb5('0x9')),'closeReason':'system','disposition':_0x543e7b[0x0]};if(rpc[_0x44b6ab[_0xaeb5('0xa')]+'Interaction']){rpc[_0x44b6ab[_0xaeb5('0xa')]+'Interaction'][_0xaeb5('0xb')](_0x44b6ab[_0xaeb5('0xc')]['id'],_0xc5d78f)['then'](function(_0x3ad1a0){logger['info'](_0xaeb5('0xd'),_0x450609,_0x44b6ab[_0xaeb5('0xc')]['id']);})['catch'](function(_0x3621b4){logger[_0xaeb5('0xe')](_0xaeb5('0xf'),_0x450609,JSON[_0xaeb5('0x10')](_0x3621b4));})[_0xaeb5('0x11')](function(){_0x27687a[_0xaeb5('0x12')]();});}}catch(_0x4a1ab7){logger[_0xaeb5('0xe')]('[%s][CLOSE]\x20%s',_0x450609,JSON['stringify'](_0x4a1ab7));_0x27687a['stop']();}};}; \ No newline at end of file +var _0x24d3=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','error','moment','../../../../config/logger','routing','../../rpc/smsInteraction'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x24d3,0xbc));var _0x324d=function(_0x51a23b,_0x548760){_0x51a23b=_0x51a23b-0x0;var _0x5ad63a=_0x24d3[_0x51a23b];return _0x5ad63a;};'use strict';var moment=require(_0x324d('0x0'));var logger=require(_0x324d('0x1'))(_0x324d('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x324d('0x3')),'mailInteraction':require(_0x324d('0x4')),'faxInteraction':require(_0x324d('0x5')),'whatsappInteraction':require(_0x324d('0x6'))};exports[_0x324d('0x7')]=function(_0x567786,_0x2e71c8,_0x2a703f,_0x3e3c58){return function(_0x291d43){try{logger[_0x324d('0x8')](_0x324d('0x9'),_0x567786,_0x2e71c8[0x0]);var _0x5a9ba4={'closed':0x1,'closedAt':moment()[_0x324d('0xa')](_0x324d('0xb')),'closeReason':_0x324d('0xc'),'disposition':_0x2e71c8[0x0]};if(rpc[_0x3e3c58[_0x324d('0xd')]+'Interaction']){rpc[_0x3e3c58[_0x324d('0xd')]+_0x324d('0xe')][_0x324d('0xf')](_0x3e3c58[_0x324d('0x10')]['id'],_0x5a9ba4)[_0x324d('0x11')](function(_0x3d8676){logger[_0x324d('0x8')](_0x324d('0x12'),_0x567786,_0x3e3c58[_0x324d('0x10')]['id']);})[_0x324d('0x13')](function(_0x3391f8){logger['error'](_0x324d('0x14'),_0x567786,JSON[_0x324d('0x15')](_0x3391f8));})[_0x324d('0x16')](function(){_0x291d43['stop']();});}}catch(_0x196797){logger[_0x324d('0x17')](_0x324d('0x14'),_0x567786,JSON[_0x324d('0x15')](_0x196797));_0x291d43['stop']();}};}; \ 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 4a51d36..d5c6e46 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 _0x9219=['consequence','isNil','interaction','UserId','next','contact','out','channel','sms','phone','ChatWebsiteId','account','AccountId','upperFirst','created','isEmpty','body','getMustacheRender','Message','then','info','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','result','fulfillment','dialogflow','providerResponse','metadata','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0x9219,0x19e));var _0x9921=function(_0x2700f4,_0xfe0889){_0x2700f4=_0x2700f4-0x0;var _0x2964b4=_0x9219[_0x2700f4];return _0x2964b4;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x9921('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x9921('0x1')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9921('0x2')),'faxMessage':require(_0x9921('0x3')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9921('0x4')]=function(_0x26d1db,_0x16edb8){return function(_0x2fd860){try{if(!_[_0x9921('0x5')](this[_0x9921('0x6')][_0x9921('0x7')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x26d1db,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2fd860[_0x9921('0x8')]();}var _0x4b975c={'ContactId':this[_0x9921('0x9')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x9921('0xa')};if(this[_0x9921('0xb')]===_0x9921('0xc')||this[_0x9921('0xb')]==='whatsapp'){_0x4b975c[_0x9921('0xd')]=this['interaction']['phone'];}var _0x411bfd=this[_0x9921('0xb')];if(_0x411bfd==='chat'){_0x4b975c[_0x9921('0xe')]=this[_0x9921('0xf')]['id'];}else{_0x4b975c[_['upperFirst'](_0x411bfd)+_0x9921('0x10')]=this[_0x9921('0xf')]['id'];}_0x4b975c[_[_0x9921('0x11')](_0x411bfd)+'InteractionId']=this[_0x9921('0x6')]['id'];if(this[_0x9921('0x6')][_0x9921('0x12')]){var _0x4ad6e1=_0x16edb8[0x2];if(!_[_0x9921('0x13')](_0x4ad6e1)){_0x4b975c[_0x9921('0x14')]=utils[_0x9921('0x15')](_0x4ad6e1,this);return rpc[_0x411bfd+_0x9921('0x16')]['create'](_0x4b975c)[_0x9921('0x17')](function(_0x291874){logger[_0x9921('0x18')]('[%s][DIALOGFLOW]\x20%s',_0x26d1db,_0x4b975c[_0x9921('0x14')]);})[_0x9921('0x19')](function(_0x25b02a){logger[_0x9921('0x1a')](_0x9921('0x1b'),_0x26d1db,JSON[_0x9921('0x1c')](_0x25b02a));})['finally'](function(){logger[_0x9921('0x18')](_0x9921('0x1d'),_0x26d1db);_0x2fd860[_0x9921('0x1e')]();});}else{logger[_0x9921('0x18')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x26d1db);_0x2fd860[_0x9921('0x1e')]();}}else{var _0x3d1f40=this;var _0x24023b=apiai(_0x16edb8[0x0],{'language':_0x16edb8[0x1]||'en'});return _0x24023b[_0x9921('0x1f')](this[_0x9921('0x20')][_0x9921('0x14')],{'sessionId':md5(this[_0x9921('0x6')]['id'])})[_0x9921('0x17')](function(_0x2bc3f7){_0x3d1f40[_0x9921('0x14')]['dialogflow']=_0x2bc3f7;_0x4b975c['body']=_0x2bc3f7[_0x9921('0x21')][_0x9921('0x22')]['speech'];_0x4b975c['providerName']=_0x9921('0x23');_0x4b975c[_0x9921('0x24')]=JSON[_0x9921('0x1c')](_0x2bc3f7);return rpc[_0x411bfd+_0x9921('0x16')]['create'](_0x4b975c)[_0x9921('0x17')](function(_0x491300){logger[_0x9921('0x18')](_0x9921('0x1b'),_0x26d1db,_0x4b975c[_0x9921('0x14')]);if(_0x2bc3f7['result'][_0x9921('0x25')]['endConversation']){_0x2fd860[_0x9921('0x8')]();}else{_0x2fd860[_0x9921('0x1e')]();}})[_0x9921('0x19')](function(_0x486446){logger[_0x9921('0x1a')](_0x9921('0x1b'),_0x26d1db,JSON['stringify'](_0x486446));_0x2fd860[_0x9921('0x8')]();});})[_0x9921('0x19')](function(_0x1d0874){logger[_0x9921('0x1a')](_0x9921('0x1b'),_0x26d1db,_0x1d0874[_0x9921('0x20')]);_0x2fd860[_0x9921('0x8')]();});}}catch(_0x4629e3){logger['error'](_0x9921('0x1b'),_0x26d1db,JSON[_0x9921('0x1c')](_0x4629e3));_0x2fd860['stop']();}};}; \ No newline at end of file +var _0x6afc=['stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','providerName','providerResponse','create','metadata','lodash','apiai-promise','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','interaction','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','[%s][DIALOGFLOW]\x20%s','catch','error'];(function(_0x44c340,_0x575719){var _0x2cd080=function(_0x1109ea){while(--_0x1109ea){_0x44c340['push'](_0x44c340['shift']());}};_0x2cd080(++_0x575719);}(_0x6afc,0x16b));var _0xc6af=function(_0x52dc4e,_0x17824d){_0x52dc4e=_0x52dc4e-0x0;var _0x2356dc=_0x6afc[_0x52dc4e];return _0x2356dc;};'use strict';var _=require(_0xc6af('0x0'));var moment=require('moment');var apiai=require(_0xc6af('0x1'));var md5=require('md5');var utils=require(_0xc6af('0x2'));var logger=require(_0xc6af('0x3'))('routing');var rpc={'chatMessage':require(_0xc6af('0x4')),'openchannelMessage':require(_0xc6af('0x5')),'mailMessage':require(_0xc6af('0x6')),'smsMessage':require(_0xc6af('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc6af('0x8'))};exports[_0xc6af('0x9')]=function(_0x3c0485,_0x6d4994){return function(_0x3bfb71){try{if(!_[_0xc6af('0xa')](this['interaction'][_0xc6af('0xb')])){logger[_0xc6af('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x3c0485,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3bfb71[_0xc6af('0xd')]();}var _0x305fde={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc6af('0xe')](_0xc6af('0xf')),'direction':_0xc6af('0x10')};if(this['channel']===_0xc6af('0x11')||this['channel']===_0xc6af('0x12')){_0x305fde[_0xc6af('0x13')]=this[_0xc6af('0x14')][_0xc6af('0x13')];}var _0x1ffa2b=this[_0xc6af('0x15')];if(_0x1ffa2b===_0xc6af('0x16')){_0x305fde[_0xc6af('0x17')]=this['account']['id'];}else{_0x305fde[_[_0xc6af('0x18')](_0x1ffa2b)+_0xc6af('0x19')]=this[_0xc6af('0x1a')]['id'];}_0x305fde[_[_0xc6af('0x18')](_0x1ffa2b)+_0xc6af('0x1b')]=this[_0xc6af('0x14')]['id'];if(this[_0xc6af('0x14')][_0xc6af('0x1c')]){var _0x3b8b37=_0x6d4994[0x2];if(!_[_0xc6af('0x1d')](_0x3b8b37)){_0x305fde[_0xc6af('0x1e')]=utils[_0xc6af('0x1f')](_0x3b8b37,this);return rpc[_0x1ffa2b+_0xc6af('0x20')]['create'](_0x305fde)[_0xc6af('0x21')](function(_0x3d75b8){logger['info'](_0xc6af('0x22'),_0x3c0485,_0x305fde[_0xc6af('0x1e')]);})[_0xc6af('0x23')](function(_0x5ef3f7){logger[_0xc6af('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x3c0485,JSON[_0xc6af('0x25')](_0x5ef3f7));})['finally'](function(){logger[_0xc6af('0xc')](_0xc6af('0x26'),_0x3c0485);_0x3bfb71[_0xc6af('0x27')]();});}else{logger[_0xc6af('0xc')](_0xc6af('0x28'),_0x3c0485);_0x3bfb71[_0xc6af('0x27')]();}}else{var _0x85cc2c=this;var _0x1e0e37=apiai(_0x6d4994[0x0],{'language':_0x6d4994[0x1]||'en'});return _0x1e0e37[_0xc6af('0x29')](this[_0xc6af('0x2a')][_0xc6af('0x1e')],{'sessionId':md5(this['interaction']['id'])})[_0xc6af('0x21')](function(_0x4b1b68){_0x85cc2c[_0xc6af('0x1e')][_0xc6af('0x2b')]=_0x4b1b68;_0x305fde[_0xc6af('0x1e')]=_0x4b1b68[_0xc6af('0x2c')][_0xc6af('0x2d')]['speech'];_0x305fde[_0xc6af('0x2e')]=_0xc6af('0x2b');_0x305fde[_0xc6af('0x2f')]=JSON[_0xc6af('0x25')](_0x4b1b68);return rpc[_0x1ffa2b+'Message'][_0xc6af('0x30')](_0x305fde)['then'](function(_0x1dfb41){logger[_0xc6af('0xc')](_0xc6af('0x22'),_0x3c0485,_0x305fde[_0xc6af('0x1e')]);if(_0x4b1b68[_0xc6af('0x2c')][_0xc6af('0x31')]['endConversation']){_0x3bfb71[_0xc6af('0xd')]();}else{_0x3bfb71[_0xc6af('0x27')]();}})[_0xc6af('0x23')](function(_0x165b64){logger[_0xc6af('0x24')](_0xc6af('0x22'),_0x3c0485,JSON['stringify'](_0x165b64));_0x3bfb71[_0xc6af('0xd')]();});})['catch'](function(_0x14a0a2){logger[_0xc6af('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x3c0485,_0x14a0a2[_0xc6af('0x2a')]);_0x3bfb71[_0xc6af('0xd')]();});}}catch(_0x2314dc){logger['error'](_0xc6af('0x22'),_0x3c0485,JSON['stringify'](_0x2314dc));_0x3bfb71[_0xc6af('0x27')]();}};}; \ 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 fe5798c..d0afc84 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 _0xdedc=['InteractionId','created','isEmpty','getMustacheRender','then','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','all','next','lodash','dialogflow','md5','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x29d071,_0x587f3f){var _0x5ec7e5=function(_0xc52ca){while(--_0xc52ca){_0x29d071['push'](_0x29d071['shift']());}};_0x5ec7e5(++_0x587f3f);}(_0xdedc,0xb8));var _0xcded=function(_0x1bca14,_0x2db9d8){_0x1bca14=_0x1bca14-0x0;var _0x348df5=_0xdedc[_0x1bca14];return _0x348df5;};'use strict';var _=require(_0xcded('0x0'));var dialogflow=require(_0xcded('0x1'));var md5=require(_0xcded('0x2'));var moment=require(_0xcded('0x3'));var Promise=require(_0xcded('0x4'));var logger=require('../../../../config/logger')(_0xcded('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0xcded('0x6')),'openchannelMessage':require(_0xcded('0x7')),'mailMessage':require(_0xcded('0x8')),'smsMessage':require(_0xcded('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xcded('0xa'))};function createMessage(_0x333e61,_0x50d7ae,_0x21f513,_0x488df8){return new Promise(function(_0x5a8057,_0x18e8e1){var _0x5b354e=_['clone'](_0x21f513);_0x5b354e[_0xcded('0xb')]=_0x488df8;return rpc[_0x50d7ae+_0xcded('0xc')][_0xcded('0xd')](_0x5b354e)['then'](function(){logger[_0xcded('0xe')](_0xcded('0xf'),_0x333e61,_0x5b354e[_0xcded('0xb')]);_0x5a8057();})[_0xcded('0x10')](function(_0x331d5b){logger['error'](_0xcded('0xf'),_0x333e61,JSON[_0xcded('0x11')](_0x331d5b));_0x18e8e1(_0x331d5b);});});}exports[_0xcded('0x12')]=function(_0x90d985,_0x51eb76){return function(_0x36ae02){try{if(!_[_0xcded('0x13')](this[_0xcded('0x14')]['UserId'])){logger[_0xcded('0xe')](_0xcded('0xf'),_0x90d985,_0xcded('0x15'));return _0x36ae02['next']();}var _0x43210a={'ContactId':this['contact']['id'],'sentAt':moment()[_0xcded('0x16')](_0xcded('0x17')),'direction':_0xcded('0x18')};if(this['channel']===_0xcded('0x19')||this[_0xcded('0x1a')]==='whatsapp'){_0x43210a['phone']=this[_0xcded('0x14')][_0xcded('0x1b')];}var _0x590998=this[_0xcded('0x1a')];if(_0x590998==='chat'){_0x43210a[_0xcded('0x1c')]=this[_0xcded('0x1d')]['id'];}else{_0x43210a[_[_0xcded('0x1e')](_0x590998)+_0xcded('0x1f')]=this[_0xcded('0x1d')]['id'];}_0x43210a[_[_0xcded('0x1e')](_0x590998)+_0xcded('0x20')]=this['interaction']['id'];if(this[_0xcded('0x14')][_0xcded('0x21')]){var _0x3b2edb=_0x51eb76[0x4];if(!_[_0xcded('0x22')](_0x3b2edb)){_0x43210a[_0xcded('0xb')]=utils[_0xcded('0x23')](_0x3b2edb,this);return rpc[_0x590998+_0xcded('0xc')]['create'](_0x43210a)[_0xcded('0x24')](function(_0x18584f){logger[_0xcded('0xe')](_0xcded('0xf'),_0x90d985,_0x43210a['body']);})[_0xcded('0x10')](function(_0x5c1663){logger[_0xcded('0x25')](_0xcded('0xf'),_0x90d985,JSON[_0xcded('0x11')](_0x5c1663));})[_0xcded('0x26')](function(){logger['info'](_0xcded('0x27'),_0x90d985);_0x36ae02['stop']();});}else{logger[_0xcded('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x90d985);_0x36ae02[_0xcded('0x28')]();}}else{var _0x527d76=this;var _0x23dcd7=_0x51eb76[0x2]['replace'](/\\n/g,'\x0a');var _0x48de76={'credentials':{'private_key':_0x23dcd7,'client_email':_0x51eb76[0x1]}};var _0x5f4e0c=new dialogflow[(_0xcded('0x29'))](_0x48de76);var _0x1c9082=_0x5f4e0c[_0xcded('0x2a')](_0x51eb76[0x0],md5(_0x527d76[_0xcded('0x14')]['id']));var _0x418176={'session':_0x1c9082,'queryInput':{'text':{'text':_0x527d76[_0xcded('0x2b')]['body'],'languageCode':_0x51eb76[0x3]||'en'}}};return _0x5f4e0c[_0xcded('0x2c')](_0x418176)['then'](function(_0x4014d6){if(_0x4014d6&&_0x4014d6[_0xcded('0x2d')]){_0x527d76[_0xcded('0xb')][_0xcded('0x2e')]=_0x4014d6;var _0x32b3c6=_0x4014d6[0x0];var _0x516579=_0x32b3c6[_0xcded('0x2f')][_0xcded('0x30')]&&_0x32b3c6[_0xcded('0x2f')][_0xcded('0x30')][_0xcded('0x31')]?_0x32b3c6['queryResult'][_0xcded('0x30')][_0xcded('0x31')][_0xcded('0x32')][_0xcded('0x33')]:![];_0x527d76[_0xcded('0xb')]['DIALOGFLOWV2_ACTION']=_0x32b3c6[_0xcded('0x2f')][_0xcded('0x34')];_0x527d76['body'][_0xcded('0x35')]=_0x32b3c6[_0xcded('0x2f')][_0xcded('0x36')];_0x527d76[_0xcded('0xb')][_0xcded('0x37')]=_0x32b3c6[_0xcded('0x2f')][_0xcded('0x30')]&&_0x32b3c6['queryResult'][_0xcded('0x30')][_0xcded('0x31')]?_0x32b3c6[_0xcded('0x2f')]['diagnosticInfo'][_0xcded('0x31')][_0xcded('0x32')][_0xcded('0x33')]:![];_0x527d76[_0xcded('0xb')][_0xcded('0x38')]=_0x32b3c6[_0xcded('0x2f')][_0xcded('0x39')][_0xcded('0x3a')];_0x527d76[_0xcded('0xb')][_0xcded('0x3b')]=_0x32b3c6['queryResult'][_0xcded('0x39')][_0xcded('0x3c')];_0x527d76['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x32b3c6[_0xcded('0x2f')][_0xcded('0x39')][_0xcded('0x3d')];_0x527d76[_0xcded('0xb')][_0xcded('0x3e')]=_0x32b3c6[_0xcded('0x2f')]['languageCode'];_0x527d76[_0xcded('0xb')][_0xcded('0x3f')]=_0x32b3c6[_0xcded('0x2f')][_0xcded('0x40')];_0x527d76[_0xcded('0xb')][_0xcded('0x41')]=_0x32b3c6[_0xcded('0x2f')][_0xcded('0x42')];_0x43210a[_0xcded('0x43')]='dialogflowV2';_0x43210a['providerResponse']=JSON['stringify'](_0x4014d6);var _0x36e86d=[];for(var _0x10ec30=0x0;_0x10ec30<_0x4014d6['length'];_0x10ec30++){var _0x36c2da=_0x4014d6[_0x10ec30];if(_0x36c2da&&_0x36c2da['queryResult']&&_0x36c2da['queryResult'][_0xcded('0x44')]){_0x36e86d[_0xcded('0x45')](createMessage(_0x90d985,_0x590998,_0x43210a,_0x36c2da[_0xcded('0x2f')][_0xcded('0x44')]));}}return Promise[_0xcded('0x46')](_0x36e86d)['then'](function(){if(_0x516579){_0x36ae02['next']();}else{_0x36ae02[_0xcded('0x28')]();}})[_0xcded('0x10')](function(_0x2f83b9){logger['error'](_0xcded('0xf'),_0x90d985,JSON[_0xcded('0x11')](_0x2f83b9));_0x36ae02[_0xcded('0x47')]();});}})[_0xcded('0x10')](function(_0x3f760a){logger[_0xcded('0x25')]('[%s][DIALOGFLOWV2]\x20%s',_0x90d985,_0x3f760a[_0xcded('0x2b')]);_0x36ae02['next']();});}}catch(_0x1af075){logger['error'](_0xcded('0xf'),_0x90d985,JSON[_0xcded('0x11')](_0x1af075));_0x36ae02[_0xcded('0x28')]();}};}; \ No newline at end of file +var _0x27c5=['queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','dialogflowV2','stringify','fulfillmentText','push','all','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','isNil','UserId','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','ChatWebsiteId','account','upperFirst','AccountId','interaction','created','isEmpty','getMustacheRender','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length'];(function(_0x55cb95,_0x5c6523){var _0x33cff1=function(_0x154ec1){while(--_0x154ec1){_0x55cb95['push'](_0x55cb95['shift']());}};_0x33cff1(++_0x5c6523);}(_0x27c5,0x173));var _0x527c=function(_0x1d0fe1,_0x452dbb){_0x1d0fe1=_0x1d0fe1-0x0;var _0x228558=_0x27c5[_0x1d0fe1];return _0x228558;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x527c('0x0'));var moment=require(_0x527c('0x1'));var Promise=require(_0x527c('0x2'));var logger=require('../../../../config/logger')(_0x527c('0x3'));var utils=require(_0x527c('0x4'));var rpc={'chatMessage':require(_0x527c('0x5')),'openchannelMessage':require(_0x527c('0x6')),'mailMessage':require(_0x527c('0x7')),'smsMessage':require(_0x527c('0x8')),'faxMessage':require(_0x527c('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x18c413,_0x5a68e8,_0x2db820,_0x5e07ba){return new Promise(function(_0x1071f5,_0x38f876){var _0xf25395=_['clone'](_0x2db820);_0xf25395[_0x527c('0xa')]=_0x5e07ba;return rpc[_0x5a68e8+_0x527c('0xb')][_0x527c('0xc')](_0xf25395)[_0x527c('0xd')](function(){logger[_0x527c('0xe')](_0x527c('0xf'),_0x18c413,_0xf25395[_0x527c('0xa')]);_0x1071f5();})[_0x527c('0x10')](function(_0x17224d){logger[_0x527c('0x11')](_0x527c('0xf'),_0x18c413,JSON['stringify'](_0x17224d));_0x38f876(_0x17224d);});});}exports['consequence']=function(_0xedfbf2,_0xd8e9e){return function(_0x30a65a){try{if(!_[_0x527c('0x12')](this['interaction'][_0x527c('0x13')])){logger[_0x527c('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0xedfbf2,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x30a65a[_0x527c('0x14')]();}var _0x5eb87f={'ContactId':this['contact']['id'],'sentAt':moment()[_0x527c('0x15')](_0x527c('0x16')),'direction':_0x527c('0x17')};if(this['channel']===_0x527c('0x18')||this[_0x527c('0x19')]==='whatsapp'){_0x5eb87f[_0x527c('0x1a')]=this['interaction'][_0x527c('0x1a')];}var _0xc89be3=this['channel'];if(_0xc89be3==='chat'){_0x5eb87f[_0x527c('0x1b')]=this[_0x527c('0x1c')]['id'];}else{_0x5eb87f[_[_0x527c('0x1d')](_0xc89be3)+_0x527c('0x1e')]=this['account']['id'];}_0x5eb87f[_[_0x527c('0x1d')](_0xc89be3)+'InteractionId']=this[_0x527c('0x1f')]['id'];if(this['interaction'][_0x527c('0x20')]){var _0x5124dc=_0xd8e9e[0x4];if(!_[_0x527c('0x21')](_0x5124dc)){_0x5eb87f[_0x527c('0xa')]=utils[_0x527c('0x22')](_0x5124dc,this);return rpc[_0xc89be3+'Message'][_0x527c('0xc')](_0x5eb87f)['then'](function(_0x176e11){logger[_0x527c('0xe')](_0x527c('0xf'),_0xedfbf2,_0x5eb87f[_0x527c('0xa')]);})[_0x527c('0x10')](function(_0x203040){logger[_0x527c('0x11')](_0x527c('0xf'),_0xedfbf2,JSON['stringify'](_0x203040));})[_0x527c('0x23')](function(){logger[_0x527c('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xedfbf2);_0x30a65a[_0x527c('0x24')]();});}else{logger['info'](_0x527c('0x25'),_0xedfbf2);_0x30a65a[_0x527c('0x24')]();}}else{var _0x436825=this;var _0x49bbd7=_0xd8e9e[0x2]['replace'](/\\n/g,'\x0a');var _0x796051={'credentials':{'private_key':_0x49bbd7,'client_email':_0xd8e9e[0x1]}};var _0x5f00bd=new dialogflow[(_0x527c('0x26'))](_0x796051);var _0x37e04f=_0x5f00bd[_0x527c('0x27')](_0xd8e9e[0x0],md5(_0x436825['interaction']['id']));var _0x46ffef={'session':_0x37e04f,'queryInput':{'text':{'text':_0x436825[_0x527c('0x28')]['body'],'languageCode':_0xd8e9e[0x3]||'en'}}};return _0x5f00bd[_0x527c('0x29')](_0x46ffef)['then'](function(_0x24dec6){if(_0x24dec6&&_0x24dec6[_0x527c('0x2a')]){_0x436825['body']['dialogflowV2']=_0x24dec6;var _0x1f40c2=_0x24dec6[0x0];var _0x2779f1=_0x1f40c2[_0x527c('0x2b')][_0x527c('0x2c')]&&_0x1f40c2['queryResult'][_0x527c('0x2c')]['fields']?_0x1f40c2[_0x527c('0x2b')][_0x527c('0x2c')][_0x527c('0x2d')][_0x527c('0x2e')][_0x527c('0x2f')]:![];_0x436825[_0x527c('0xa')][_0x527c('0x30')]=_0x1f40c2[_0x527c('0x2b')][_0x527c('0x31')];_0x436825['body'][_0x527c('0x32')]=_0x1f40c2['queryResult']['allRequiredParamsPresent'];_0x436825[_0x527c('0xa')][_0x527c('0x33')]=_0x1f40c2[_0x527c('0x2b')]['diagnosticInfo']&&_0x1f40c2[_0x527c('0x2b')][_0x527c('0x2c')]['fields']?_0x1f40c2['queryResult'][_0x527c('0x2c')][_0x527c('0x2d')][_0x527c('0x2e')]['boolValue']:![];_0x436825['body'][_0x527c('0x34')]=_0x1f40c2[_0x527c('0x2b')]['intent']['name'];_0x436825[_0x527c('0xa')][_0x527c('0x35')]=_0x1f40c2[_0x527c('0x2b')]['intent'][_0x527c('0x36')];_0x436825[_0x527c('0xa')][_0x527c('0x37')]=_0x1f40c2[_0x527c('0x2b')][_0x527c('0x38')][_0x527c('0x39')];_0x436825[_0x527c('0xa')][_0x527c('0x3a')]=_0x1f40c2[_0x527c('0x2b')][_0x527c('0x3b')];_0x436825['body'][_0x527c('0x3c')]=_0x1f40c2[_0x527c('0x2b')][_0x527c('0x3d')];_0x436825['body'][_0x527c('0x3e')]=_0x1f40c2[_0x527c('0x2b')][_0x527c('0x3f')];_0x5eb87f['providerName']=_0x527c('0x40');_0x5eb87f['providerResponse']=JSON[_0x527c('0x41')](_0x24dec6);var _0xb7e878=[];for(var _0x55feb4=0x0;_0x55feb4<_0x24dec6[_0x527c('0x2a')];_0x55feb4++){var _0x574759=_0x24dec6[_0x55feb4];if(_0x574759&&_0x574759['queryResult']&&_0x574759['queryResult'][_0x527c('0x42')]){_0xb7e878[_0x527c('0x43')](createMessage(_0xedfbf2,_0xc89be3,_0x5eb87f,_0x574759[_0x527c('0x2b')][_0x527c('0x42')]));}}return Promise[_0x527c('0x44')](_0xb7e878)[_0x527c('0xd')](function(){if(_0x2779f1){_0x30a65a[_0x527c('0x14')]();}else{_0x30a65a[_0x527c('0x24')]();}})[_0x527c('0x10')](function(_0x76ca3){logger['error'](_0x527c('0xf'),_0xedfbf2,JSON[_0x527c('0x41')](_0x76ca3));_0x30a65a[_0x527c('0x14')]();});}})[_0x527c('0x10')](function(_0x885775){logger[_0x527c('0x11')](_0x527c('0xf'),_0xedfbf2,_0x885775[_0x527c('0x28')]);_0x30a65a[_0x527c('0x14')]();});}}catch(_0x3ba19c){logger[_0x527c('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0xedfbf2,JSON['stringify'](_0x3ba19c));_0x30a65a['stop']();}};}; \ 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 51bd330..b2f9610 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 _0xaab2=['../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text'];(function(_0x1fa475,_0x1b505f){var _0x355241=function(_0xadadf){while(--_0xadadf){_0x1fa475['push'](_0x1fa475['shift']());}};_0x355241(++_0x1b505f);}(_0xaab2,0x98));var _0x2aab=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xaab2[_0x55e08b];return _0xd1a7ff;};'use strict';var schema=require(_0x2aab('0x0'));var _=require(_0x2aab('0x1'));var htmlToText=require(_0x2aab('0x2'));var utils=require('./utils');var logger=require(_0x2aab('0x3'))(_0x2aab('0x4'));var gotoif=schema({'condition':{'type':_0x2aab('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x2aab('0x6'),'message':_0x2aab('0x7')},'priorityFalse':{'type':_0x2aab('0x6'),'message':_0x2aab('0x8')}});exports[_0x2aab('0x9')]=function(_0x280597,_0x17a077){return function(_0x4bf27f){try{var _0x2440cf={'condition':htmlToText[_0x2aab('0xa')](utils[_0x2aab('0xb')](_0x17a077[0x0],this),{'wordwrap':![]})[_0x2aab('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x17a077[0x1],'priorityFalse':_0x17a077[0x2]};var _0xf560ce=gotoif[_0x2aab('0x0')](_0x2440cf,{'typecast':!![]});if(_0xf560ce[_0x2aab('0xd')]){logger[_0x2aab('0xe')](_0x2aab('0xf'),_0x280597,_[_0x2aab('0x10')](_0xf560ce,_0x2aab('0x11'))[_0x2aab('0x12')](',\x20'));_0x4bf27f[_0x2aab('0x13')]();}else{try{var _0x4739dc=eval('('+_0x2440cf[_0x2aab('0x14')]+')');var _0x16aba3=_0x4739dc?_0x2440cf[_0x2aab('0x15')]:_0x2440cf['priorityFalse'];logger[_0x2aab('0x16')](_0x2aab('0x17'),_0x280597,_0x2440cf['condition'],_0x4739dc,_0x16aba3||_0x2aab('0x18'));if(_0x16aba3){var _0x558094=_[_0x2aab('0x19')](_0x4bf27f[_0x2aab('0x1a')](),{'p':_0x16aba3});if(_0x558094>=0x0){logger[_0x2aab('0x16')](_0x2aab('0x1b'),_0x280597,_0x16aba3||'next',_0x558094);_0x4bf27f[_0x2aab('0x18')](_0x558094);}else{logger['info'](_0x2aab('0x1c'),_0x280597,_0x16aba3||_0x2aab('0x18'));_0x4bf27f[_0x2aab('0x13')]();}}else{_0x4bf27f['next']();}}catch(_0x3d951c){logger[_0x2aab('0xe')](_0x2aab('0x1d'),_0x280597,_0x3d951c[_0x2aab('0x11')]);_0x4bf27f[_0x2aab('0x13')]();}}}catch(_0x59811c){logger['error']('[%s][GOTOIF]\x20%s',_0x280597,JSON[_0x2aab('0x1e')](_0x59811c));_0x4bf27f[_0x2aab('0x13')]();}};}; \ No newline at end of file +var _0x00c9=['routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','rules','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text'];(function(_0xa081,_0x31fb88){var _0x236f7a=function(_0x192ae4){while(--_0x192ae4){_0xa081['push'](_0xa081['shift']());}};_0x236f7a(++_0x31fb88);}(_0x00c9,0x99));var _0x900c=function(_0x281ae5,_0x47f861){_0x281ae5=_0x281ae5-0x0;var _0x12089c=_0x00c9[_0x281ae5];return _0x12089c;};'use strict';var schema=require(_0x900c('0x0'));var _=require(_0x900c('0x1'));var htmlToText=require(_0x900c('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x900c('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x900c('0x4')},'priorityTrue':{'type':_0x900c('0x5'),'message':_0x900c('0x6')},'priorityFalse':{'type':_0x900c('0x5'),'message':_0x900c('0x7')}});exports['consequence']=function(_0x422719,_0x2f2d1f){return function(_0x4753ed){try{var _0x3034d1={'condition':htmlToText[_0x900c('0x8')](utils[_0x900c('0x9')](_0x2f2d1f[0x0],this),{'wordwrap':![]})[_0x900c('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2f2d1f[0x1],'priorityFalse':_0x2f2d1f[0x2]};var _0x2a35cf=gotoif[_0x900c('0x0')](_0x3034d1,{'typecast':!![]});if(_0x2a35cf[_0x900c('0xb')]){logger[_0x900c('0xc')](_0x900c('0xd'),_0x422719,_['map'](_0x2a35cf,_0x900c('0xe'))['join'](',\x20'));_0x4753ed[_0x900c('0xf')]();}else{try{var _0x17c936=eval('('+_0x3034d1[_0x900c('0x10')]+')');var _0x55af01=_0x17c936?_0x3034d1[_0x900c('0x11')]:_0x3034d1[_0x900c('0x12')];logger[_0x900c('0x13')](_0x900c('0x14'),_0x422719,_0x3034d1[_0x900c('0x10')],_0x17c936,_0x55af01||'next');if(_0x55af01){var _0x3f7acc=_['findIndex'](_0x4753ed[_0x900c('0x15')](),{'p':_0x55af01});if(_0x3f7acc>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x422719,_0x55af01||_0x900c('0x16'),_0x3f7acc);_0x4753ed[_0x900c('0x16')](_0x3f7acc);}else{logger['info'](_0x900c('0x17'),_0x422719,_0x55af01||_0x900c('0x16'));_0x4753ed['stop']();}}else{_0x4753ed['next']();}}catch(_0x2c92cf){logger[_0x900c('0xc')](_0x900c('0x18'),_0x422719,_0x2c92cf[_0x900c('0xe')]);_0x4753ed[_0x900c('0xf')]();}}}catch(_0x387905){logger[_0x900c('0xc')](_0x900c('0xd'),_0x422719,JSON[_0x900c('0x19')](_0x387905));_0x4753ed['stop']();}};}; \ 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 f994e22..a154d99 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 _0x5da8=['info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','message','join','stop'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x5da8,0x84));var _0x85da=function(_0x514858,_0x555880){_0x514858=_0x514858-0x0;var _0x171ae3=_0x5da8[_0x514858];return _0x171ae3;};'use strict';var schema=require(_0x85da('0x0'));var _=require(_0x85da('0x1'));var logger=require(_0x85da('0x2'))(_0x85da('0x3'));var gotop=schema({'priority':{'type':_0x85da('0x4'),'required':!![],'message':_0x85da('0x5')}});exports['consequence']=function(_0x56fdc9,_0x31adb3){return function(_0x599432){try{var _0x594c4a={'priority':_0x31adb3[0x0]};var _0x20beea=gotop[_0x85da('0x0')](_0x594c4a,{'typecast':!![]});if(_0x20beea[_0x85da('0x6')]){logger[_0x85da('0x7')](_0x85da('0x8'),_0x56fdc9,_['map'](_0x20beea,_0x85da('0x9'))[_0x85da('0xa')](',\x20'));_0x599432[_0x85da('0xb')]();}else{logger[_0x85da('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x56fdc9,_0x594c4a[_0x85da('0xd')]);if(_0x594c4a[_0x85da('0xd')]){var _0x5e204f=_['findIndex'](_0x599432[_0x85da('0xe')](),{'p':_0x594c4a[_0x85da('0xd')]});if(_0x5e204f>=0x0){logger['info'](_0x85da('0xf'),_0x56fdc9,_0x594c4a[_0x85da('0xd')]||_0x85da('0x10'),_0x5e204f);_0x599432[_0x85da('0x10')](_0x5e204f);}else{logger[_0x85da('0xc')](_0x85da('0x11'),_0x56fdc9,_0x594c4a['priority']||_0x85da('0x10'));_0x599432[_0x85da('0xb')]();}}else{_0x599432[_0x85da('0x10')]();}}}catch(_0x4d1b56){logger[_0x85da('0x7')](_0x85da('0x8'),_0x56fdc9,JSON['stringify'](_0x4d1b56));_0x599432['stop']();}};}; \ No newline at end of file +var _0xbf5c=['map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s'];(function(_0x259d11,_0x222597){var _0x34f70c=function(_0x5b6321){while(--_0x5b6321){_0x259d11['push'](_0x259d11['shift']());}};_0x34f70c(++_0x222597);}(_0xbf5c,0x98));var _0xcbf5=function(_0x57b8f,_0x46bd03){_0x57b8f=_0x57b8f-0x0;var _0x500dc9=_0xbf5c[_0x57b8f];return _0x500dc9;};'use strict';var schema=require(_0xcbf5('0x0'));var _=require(_0xcbf5('0x1'));var logger=require(_0xcbf5('0x2'))(_0xcbf5('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xcbf5('0x4')}});exports[_0xcbf5('0x5')]=function(_0x580c57,_0x52188f){return function(_0x40f5eb){try{var _0x53bd65={'priority':_0x52188f[0x0]};var _0x206f5d=gotop[_0xcbf5('0x0')](_0x53bd65,{'typecast':!![]});if(_0x206f5d['length']){logger[_0xcbf5('0x6')](_0xcbf5('0x7'),_0x580c57,_[_0xcbf5('0x8')](_0x206f5d,_0xcbf5('0x9'))[_0xcbf5('0xa')](',\x20'));_0x40f5eb[_0xcbf5('0xb')]();}else{logger[_0xcbf5('0xc')](_0xcbf5('0xd'),_0x580c57,_0x53bd65[_0xcbf5('0xe')]);if(_0x53bd65['priority']){var _0x26cfd9=_[_0xcbf5('0xf')](_0x40f5eb['rules'](),{'p':_0x53bd65['priority']});if(_0x26cfd9>=0x0){logger[_0xcbf5('0xc')](_0xcbf5('0x10'),_0x580c57,_0x53bd65['priority']||_0xcbf5('0x11'),_0x26cfd9);_0x40f5eb[_0xcbf5('0x11')](_0x26cfd9);}else{logger[_0xcbf5('0xc')](_0xcbf5('0x12'),_0x580c57,_0x53bd65[_0xcbf5('0xe')]||_0xcbf5('0x11'));_0x40f5eb['stop']();}}else{_0x40f5eb[_0xcbf5('0x11')]();}}}catch(_0x31b275){logger[_0xcbf5('0x6')](_0xcbf5('0x7'),_0x580c57,JSON[_0xcbf5('0x13')](_0x31b275));_0x40f5eb[_0xcbf5('0xb')]();}};}; \ 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 816ae7c..bef22c5 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 _0x536f=['../../rpc/smsMessage','../../rpc/faxMessage','consequence','channel','chat','ChatWebsiteId','account','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x59cd00,_0x5e90fe){var _0x5b716d=function(_0x2b0a28){while(--_0x2b0a28){_0x59cd00['push'](_0x59cd00['shift']());}};_0x5b716d(++_0x5e90fe);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf536('0x1')),'mailMessage':require(_0xf536('0x2')),'smsMessage':require(_0xf536('0x3')),'faxMessage':require(_0xf536('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xf536('0x5')]=function(_0x4e90e2,_0xbe060e){return function(_0x7e339b){try{var _0x2fc517={'body':utils['getMustacheRender'](_0xbe060e[0x0],this),'ContactId':this['contact']['id']};if(this[_0xf536('0x6')]===_0xf536('0x7')){_0x2fc517[_0xf536('0x8')]=this[_0xf536('0x9')]['id'];}else{_0x2fc517[_['upperFirst'](this['channel'])+_0xf536('0xa')]=this[_0xf536('0x9')]['id'];}_0x2fc517[_['upperFirst'](this['channel'])+_0xf536('0xb')]=this[_0xf536('0xc')]['id'];if(rpc[this[_0xf536('0x6')]+_0xf536('0xd')]){return rpc[this[_0xf536('0x6')]+'Message'][_0xf536('0xe')](_0x2fc517)['then'](function(_0x146970){logger[_0xf536('0xf')](_0xf536('0x10'),_0x4e90e2,_0x2fc517[_0xf536('0x11')]);_0x7e339b[_0xf536('0x12')]();})[_0xf536('0x13')](function(_0xbae810){logger[_0xf536('0x14')](_0xf536('0x10'),_0x4e90e2,JSON[_0xf536('0x15')](_0xbae810));_0x7e339b[_0xf536('0x16')]();});}}catch(_0x33f5ef){logger['error'](_0xf536('0x10'),_0x4e90e2,JSON['stringify'](_0x33f5ef));_0x7e339b[_0xf536('0x16')]();}};}; \ No newline at end of file +var _0xd6ab=['next','catch','error','stop','[%s][MESSAGE]\x20%s','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','contact','chat','account','upperFirst','channel','AccountId','interaction','Message','create','then','info','body'];(function(_0xeb8609,_0x111e27){var _0x3ec75d=function(_0x53e458){while(--_0x53e458){_0xeb8609['push'](_0xeb8609['shift']());}};_0x3ec75d(++_0x111e27);}(_0xd6ab,0x124));var _0xbd6a=function(_0x819e48,_0x430040){_0x819e48=_0x819e48-0x0;var _0x522d4a=_0xd6ab[_0x819e48];return _0x522d4a;};'use strict';var _=require(_0xbd6a('0x0'));var utils=require(_0xbd6a('0x1'));var logger=require(_0xbd6a('0x2'))(_0xbd6a('0x3'));var rpc={'chatMessage':require(_0xbd6a('0x4')),'openchannelMessage':require(_0xbd6a('0x5')),'mailMessage':require(_0xbd6a('0x6')),'smsMessage':require(_0xbd6a('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x6545b8,_0x24a641){return function(_0x5c5bfe){try{var _0x441979={'body':utils['getMustacheRender'](_0x24a641[0x0],this),'ContactId':this[_0xbd6a('0x8')]['id']};if(this['channel']===_0xbd6a('0x9')){_0x441979['ChatWebsiteId']=this[_0xbd6a('0xa')]['id'];}else{_0x441979[_[_0xbd6a('0xb')](this[_0xbd6a('0xc')])+_0xbd6a('0xd')]=this[_0xbd6a('0xa')]['id'];}_0x441979[_[_0xbd6a('0xb')](this[_0xbd6a('0xc')])+'InteractionId']=this[_0xbd6a('0xe')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0xbd6a('0xc')]+_0xbd6a('0xf')][_0xbd6a('0x10')](_0x441979)[_0xbd6a('0x11')](function(_0x64e59){logger[_0xbd6a('0x12')]('[%s][MESSAGE]\x20%s',_0x6545b8,_0x441979[_0xbd6a('0x13')]);_0x5c5bfe[_0xbd6a('0x14')]();})[_0xbd6a('0x15')](function(_0x1897fd){logger[_0xbd6a('0x16')]('[%s][MESSAGE]\x20%s',_0x6545b8,JSON['stringify'](_0x1897fd));_0x5c5bfe[_0xbd6a('0x17')]();});}}catch(_0x467a41){logger[_0xbd6a('0x16')](_0xbd6a('0x18'),_0x6545b8,JSON[_0xbd6a('0x19')](_0x467a41));_0x5c5bfe[_0xbd6a('0x17')]();}};}; \ 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 6279884..7caebe0 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 _0x50ec=['info','getMustacheRender','error','[%s][NOOP]\x20%s','stop','./utils','routing','consequence'];(function(_0x422953,_0x19b50c){var _0x2a73e7=function(_0x4cc72d){while(--_0x4cc72d){_0x422953['push'](_0x422953['shift']());}};_0x2a73e7(++_0x19b50c);}(_0x50ec,0x1cd));var _0xc50e=function(_0x4e2072,_0x4ea958){_0x4e2072=_0x4e2072-0x0;var _0x264780=_0x50ec[_0x4e2072];return _0x264780;};'use strict';var utils=require(_0xc50e('0x0'));var logger=require('../../../../config/logger')(_0xc50e('0x1'));exports[_0xc50e('0x2')]=function(_0x56e048,_0x417b8b){return function(_0x2a4910){try{logger[_0xc50e('0x3')]('[%s][NOOP]\x20%s',_0x56e048,utils[_0xc50e('0x4')](_0x417b8b[0x0],this));_0x2a4910['next']();}catch(_0x223294){logger[_0xc50e('0x5')](_0xc50e('0x6'),_0x56e048,JSON['stringify'](_0x223294));_0x2a4910[_0xc50e('0x7')]();}};}; \ No newline at end of file +var _0x41b8=['getMustacheRender','next','stringify','stop','./utils','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x146edd,_0x2be255){var _0x46079b=function(_0x20ad8c){while(--_0x20ad8c){_0x146edd['push'](_0x146edd['shift']());}};_0x46079b(++_0x2be255);}(_0x41b8,0x94));var _0x841b=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x41b8[_0x4c1ec2];return _0x3f6f1c;};'use strict';var utils=require(_0x841b('0x0'));var logger=require(_0x841b('0x1'))(_0x841b('0x2'));exports[_0x841b('0x3')]=function(_0x40a8b5,_0x4ee583){return function(_0x5bddc8){try{logger['info'](_0x841b('0x4'),_0x40a8b5,utils[_0x841b('0x5')](_0x4ee583[0x0],this));_0x5bddc8[_0x841b('0x6')]();}catch(_0x1a58e9){logger['error'](_0x841b('0x4'),_0x40a8b5,JSON[_0x841b('0x7')](_0x1a58e9));_0x5bddc8[_0x841b('0x8')]();}};}; \ 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 5d98748..0008de3 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 _0xd7b7=['body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','stop','find','Queues','timeout','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x2d54ba,_0x3e6ed6){var _0x1a133e=function(_0x14e303){while(--_0x14e303){_0x2d54ba['push'](_0x2d54ba['shift']());}};_0x1a133e(++_0x3e6ed6);}(_0xd7b7,0x1c6));var _0x7d7b=function(_0x21f22f,_0x4283cd){_0x21f22f=_0x21f22f-0x0;var _0x28d056=_0xd7b7[_0x21f22f];return _0x28d056;};'use strict';var schema=require(_0x7d7b('0x0'));var _=require(_0x7d7b('0x1'));var util=require(_0x7d7b('0x2'));var seqqueue=require(_0x7d7b('0x3'));var moment=require(_0x7d7b('0x4'));var Redis=require(_0x7d7b('0x5'));var config=require(_0x7d7b('0x6'));var logger=require(_0x7d7b('0x7'))('routing');var strategy=require(_0x7d7b('0x8'));config['redis']=_['defaults'](config[_0x7d7b('0x9')],{'host':_0x7d7b('0xa'),'port':0x18eb});var io=require(_0x7d7b('0xb'))(new Redis(config[_0x7d7b('0x9')]));var attributes=['id',_0x7d7b('0xc'),_0x7d7b('0xd'),_0x7d7b('0xe'),_0x7d7b('0xf'),_0x7d7b('0x10')];function emit(_0x6619b,_0x21f10c,_0x4c0d5d){io['to'](_0x6619b)[_0x7d7b('0x11')](_0x21f10c,_0x4c0d5d);}function emitChannelQueueInteraction(_0x4aae69,_0x3a57f3,_0x3f376b,_0xbd2ae,_0x31dc8e,_0x419c12,_0x6a80de,_0x5ba41c){var _0x42a72a=_['clone'](_0x3f376b);_0x42a72a[_0x7d7b('0xc')]=_0x5ba41c;_0x42a72a[_0x7d7b('0xe')]=_0x3a57f3;_0x42a72a[_0x7d7b('0xd')]=_0xbd2ae;_0x42a72a['id']=_0x31dc8e;if(_0x419c12){_0x6a80de[util[_0x7d7b('0x12')](_0x7d7b('0x13'),_0x4aae69)][_0x31dc8e]=_[_0x7d7b('0x14')](_0x42a72a,attributes);}else{delete _0x6a80de[util[_0x7d7b('0x12')](_0x7d7b('0x13'),_0x4aae69)][_0x31dc8e];}emit(util[_0x7d7b('0x12')](_0x7d7b('0x15'),_0x4aae69,_0x3a57f3),util[_0x7d7b('0x12')]('%s_queue_waiting_interaction:%s',_0x4aae69,_0x419c12?_0x7d7b('0x16'):_0x7d7b('0x17')),_['pick'](_0x42a72a,attributes));}var rpc={'openchannelQueueReport':require(_0x7d7b('0x18')),'mailQueueReport':require(_0x7d7b('0x19')),'chatQueueReport':require(_0x7d7b('0x1a')),'smsQueueReport':require(_0x7d7b('0x1b')),'faxQueueReport':require(_0x7d7b('0x1c')),'whatsappQueueReport':require(_0x7d7b('0x1d'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x7d7b('0x1e')},'timeout':{'type':_0x7d7b('0x1f'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x5b7144,_0x24f972,_0x55888c,_0x6dff52){if(_0x5b7144&&_0x24f972&&_0x55888c){_0x24f972['waiting']+=0x1;var _0x447f17={'uniqueid':_0x5b7144,'from':_0x55888c[_0x7d7b('0x20')]?_0x55888c[_0x7d7b('0x20')][_0x7d7b('0xf')]:'','joinAt':moment()[_0x7d7b('0x12')](_0x7d7b('0x21')),'ContactId':_0x55888c[_0x7d7b('0x22')]?_0x55888c['contact']['id']:null,'ListId':_0x55888c[_0x7d7b('0x23')]?_0x55888c[_0x7d7b('0x23')]['id']:null};_0x447f17[_['upperFirst'](_0x55888c[_0x7d7b('0x24')])+_0x7d7b('0x25')]=_0x24f972['id']||null;_0x447f17[_[_0x7d7b('0x26')](_0x55888c[_0x7d7b('0x24')])+'InteractionId']=_0x55888c['interaction']?_0x55888c[_0x7d7b('0x27')]['id']:null;_0x447f17[_[_0x7d7b('0x26')](_0x55888c['channel'])+_0x7d7b('0x28')]=_0x55888c['message']?_0x55888c[_0x7d7b('0x29')]['id']:null;_0x447f17[_[_0x7d7b('0x26')](_0x55888c[_0x7d7b('0x24')])+(_0x55888c['channel']!==_0x7d7b('0x2a')?_0x7d7b('0x2b'):_0x7d7b('0x2c'))]=_0x55888c[_0x7d7b('0xd')]?_0x55888c[_0x7d7b('0xd')]['id']:null;logger[_0x7d7b('0x2d')](util[_0x7d7b('0x12')](_0x7d7b('0x2e'),_0x5b7144,_0x24f972['name']));emitChannelQueueInteraction(_0x55888c[_0x7d7b('0x24')],_0x24f972['name'],_0x447f17,_0x55888c[_0x7d7b('0xd')][_0x7d7b('0x2f')],_0x55888c[_0x7d7b('0x29')]['id'],!![],_0x6dff52,_0x24f972['id']);if(rpc[_0x55888c[_0x7d7b('0x24')]+_0x7d7b('0x30')]){return rpc[_0x55888c[_0x7d7b('0x24')]+_0x7d7b('0x30')][_0x7d7b('0x31')](_0x447f17)[_0x7d7b('0x32')](function(_0x35dee3){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x24becc,_0x4d237c,_0x420b41,_0x80d205){if(_0x24becc&&_0x4d237c){_0x4d237c[_0x7d7b('0x33')]-=0x1;var _0x39cbc5={'leaveAt':moment()[_0x7d7b('0x12')](_0x7d7b('0x21')),'acceptAt':moment()['format'](_0x7d7b('0x21')),'reason':_0x7d7b('0x34')};logger[_0x7d7b('0x2d')](util['format'](_0x7d7b('0x35'),_0x24becc,_0x4d237c[_0x7d7b('0x2f')]));emitChannelQueueInteraction(_0x420b41[_0x7d7b('0x24')],_0x4d237c[_0x7d7b('0x2f')],_0x420b41[_0x7d7b('0x20')],_0x420b41[_0x7d7b('0xd')]['name'],_0x420b41['message']['id'],![],_0x80d205,_0x4d237c['id']);if(rpc[_0x420b41[_0x7d7b('0x24')]+_0x7d7b('0x30')]){return rpc[_0x420b41['channel']+_0x7d7b('0x30')][_0x7d7b('0x36')](_0x24becc,_0x39cbc5)['catch'](function(_0x525dae){logger[_0x7d7b('0x37')](_0x7d7b('0x38'));});}}}function endRouting(_0x12d307,_0x157803,_0x10a1d2,_0x5ecffc){if(_0x12d307&&_0x157803){_0x157803['waiting']-=0x1;var _0xee8f28={'leaveAt':moment()[_0x7d7b('0x12')](_0x7d7b('0x21')),'exitAt':moment()[_0x7d7b('0x12')](_0x7d7b('0x21')),'reason':'timeout'};logger[_0x7d7b('0x2d')](util[_0x7d7b('0x12')](_0x7d7b('0x39'),_0x12d307,_0x157803['name']));emitChannelQueueInteraction(_0x10a1d2[_0x7d7b('0x24')],_0x157803[_0x7d7b('0x2f')],_0x10a1d2['body'],_0x10a1d2[_0x7d7b('0xd')][_0x7d7b('0x2f')],_0x10a1d2[_0x7d7b('0x29')]['id'],![],_0x5ecffc);if(rpc[_0x10a1d2[_0x7d7b('0x24')]+'QueueReport']){return rpc[_0x10a1d2[_0x7d7b('0x24')]+_0x7d7b('0x30')]['update'](_0x12d307,_0xee8f28)[_0x7d7b('0x32')](function(_0x986638){logger[_0x7d7b('0x37')](_0x7d7b('0x38'));});}}}function handleFindQueue(_0x2873b3){return function(_0x5ed616){return _0x5ed616[_0x7d7b('0x2f')][_0x7d7b('0x3a')]()===_0x2873b3[_0x7d7b('0x3a')]();};}exports[_0x7d7b('0x3b')]=function(_0x7f58fe,_0x29c08a,_0x129c55,_0x33385f){return function(_0x2bdb47){try{var _0x47b743={'name':_0x29c08a[0x0],'timeout':_0x29c08a[0x1]};var _0x4d0d7c=queue['validate'](_0x47b743,{'typecast':!![]});if(_0x4d0d7c[_0x7d7b('0x3c')]){logger['error'](_0x7d7b('0x3d'),_0x7f58fe,_['map'](_0x4d0d7c,_0x7d7b('0x29'))['join'](',\x20'));_0x2bdb47[_0x7d7b('0x3e')]();}else{var _0x22ca37=_[_0x7d7b('0x3f')](_0x129c55[_0x33385f[_0x7d7b('0x24')]+_0x7d7b('0x40')],handleFindQueue(_0x47b743['name']));if(_0x22ca37){startRouting(_0x7f58fe,_0x22ca37,_0x33385f,_0x129c55);var _0x4846ed=(_0x22ca37[_0x7d7b('0x41')]||0xa)*0x3e8;var _0x5ba88b=(_0x47b743[_0x7d7b('0x41')]||0x14)*0x3e8;var _0x5a0366,_0x4fe9e1;if(_0x4846ed>_0x5ba88b){_0x5ba88b=_0x4846ed;}var _0x4b32a9=seqqueue[_0x7d7b('0x42')](_0x4846ed);_0x4b32a9['id']=_0x7f58fe;_0x4b32a9['atimeout']=_0x4846ed;_0x4b32a9[_0x7d7b('0x43')]=_0x5ba88b;_0x4b32a9[_0x7d7b('0x24')]=_0x33385f[_0x7d7b('0x24')];_0x129c55[_0x7d7b('0x44')][_0x7f58fe]['on'](_0x7d7b('0x45'),function(){logger[_0x7d7b('0x2d')](_0x7d7b('0x46'),_0x7f58fe);stopRouting(_0x7f58fe,_0x22ca37,_0x33385f,_0x129c55);clearTimeout(_0x5a0366);_0x5a0366=undefined;_0x4b32a9[_0x7d7b('0x47')](!![]);if(_0x129c55[_0x7d7b('0x44')][_0x7f58fe]){delete _0x129c55[_0x7d7b('0x44')][_0x7f58fe];}_0x2bdb47[_0x7d7b('0x3e')]();});_0x129c55[_0x7d7b('0x44')][_0x7f58fe]['on'](_0x7d7b('0x48'),function(){if(_0x129c55[_0x7d7b('0x44')][_0x7f58fe]){delete _0x129c55[_0x7d7b('0x44')][_0x7f58fe];}});_0x5a0366=setTimeout(function(){logger[_0x7d7b('0x2d')](_0x7d7b('0x49'),_0x7f58fe);endRouting(_0x7f58fe,_0x22ca37,_0x33385f,_0x129c55);clearTimeout(_0x5a0366);_0x4b32a9[_0x7d7b('0x47')](!![]);_0x2bdb47[_0x7d7b('0x4a')]();},_0x5ba88b);switch(_0x22ca37[_0x7d7b('0x4b')]){case'rrmemory':strategy[_0x7d7b('0x4c')](_0x4b32a9,_0x22ca37,_0x129c55,_0x33385f);break;default:strategy[_0x7d7b('0x4d')](_0x4b32a9,_0x22ca37,_0x129c55,_0x33385f);}}else{logger[_0x7d7b('0x37')](_0x7d7b('0x4e'),_0x7f58fe,_0x47b743['name']);_0x2bdb47[_0x7d7b('0x3e')]();}}}catch(_0x94fe1c){console[_0x7d7b('0x4f')](_0x94fe1c);logger[_0x7d7b('0x37')](_0x7d7b('0x3d'),_0x7f58fe,_0x94fe1c[_0x7d7b('0x50')]);_0x2bdb47[_0x7d7b('0x3e')]();}};}; \ No newline at end of file +var _0xbfae=['rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','body','catch','update\x20queue\x20report','timeout','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','createQueue','atimeout','qtimeout'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xbfae,0x13a));var _0xebfa=function(_0x152ad2,_0x1ec031){_0x152ad2=_0x152ad2-0x0;var _0x31cfba=_0xbfae[_0x152ad2];return _0x31cfba;};'use strict';var schema=require('validate');var _=require(_0xebfa('0x0'));var util=require(_0xebfa('0x1'));var seqqueue=require(_0xebfa('0x2'));var moment=require(_0xebfa('0x3'));var Redis=require(_0xebfa('0x4'));var config=require(_0xebfa('0x5'));var logger=require(_0xebfa('0x6'))(_0xebfa('0x7'));var strategy=require('./strategy');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0xebfa('0x8'),_0xebfa('0x9'),_0xebfa('0xa'),_0xebfa('0xb'),_0xebfa('0xc')];function emit(_0x37c8ef,_0x5867d0,_0x217ac4){io['to'](_0x37c8ef)['emit'](_0x5867d0,_0x217ac4);}function emitChannelQueueInteraction(_0x39483e,_0x3f6d04,_0x17021b,_0x3fc9c3,_0x26cbf1,_0x26308b,_0x3918c2,_0x34a1a1){var _0x1871c7=_[_0xebfa('0xd')](_0x17021b);_0x1871c7[_0xebfa('0x8')]=_0x34a1a1;_0x1871c7[_0xebfa('0xa')]=_0x3f6d04;_0x1871c7[_0xebfa('0x9')]=_0x3fc9c3;_0x1871c7['id']=_0x26cbf1;if(_0x26308b){_0x3918c2[util[_0xebfa('0xe')](_0xebfa('0xf'),_0x39483e)][_0x26cbf1]=_['pick'](_0x1871c7,attributes);}else{delete _0x3918c2[util['format']('%sQueuesWaitingInteractions',_0x39483e)][_0x26cbf1];}emit(util[_0xebfa('0xe')](_0xebfa('0x10'),_0x39483e,_0x3f6d04),util[_0xebfa('0xe')](_0xebfa('0x11'),_0x39483e,_0x26308b?_0xebfa('0x12'):'remove'),_[_0xebfa('0x13')](_0x1871c7,attributes));}var rpc={'openchannelQueueReport':require(_0xebfa('0x14')),'mailQueueReport':require(_0xebfa('0x15')),'chatQueueReport':require(_0xebfa('0x16')),'smsQueueReport':require(_0xebfa('0x17')),'faxQueueReport':require(_0xebfa('0x18')),'whatsappQueueReport':require(_0xebfa('0x19'))};var queue=schema({'name':{'type':_0xebfa('0x1a'),'required':!![],'message':_0xebfa('0x1b')},'timeout':{'type':_0xebfa('0x1c'),'message':_0xebfa('0x1d')}});function startRouting(_0x43ff48,_0x25762e,_0x8e37,_0x59d15f){if(_0x43ff48&&_0x25762e&&_0x8e37){_0x25762e['waiting']+=0x1;var _0x3fe552={'uniqueid':_0x43ff48,'from':_0x8e37['body']?_0x8e37['body'][_0xebfa('0xb')]:'','joinAt':moment()[_0xebfa('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8e37[_0xebfa('0x1e')]?_0x8e37[_0xebfa('0x1e')]['id']:null,'ListId':_0x8e37[_0xebfa('0x1f')]?_0x8e37[_0xebfa('0x1f')]['id']:null};_0x3fe552[_[_0xebfa('0x20')](_0x8e37[_0xebfa('0x21')])+_0xebfa('0x22')]=_0x25762e['id']||null;_0x3fe552[_['upperFirst'](_0x8e37['channel'])+_0xebfa('0x23')]=_0x8e37[_0xebfa('0x24')]?_0x8e37[_0xebfa('0x24')]['id']:null;_0x3fe552[_[_0xebfa('0x20')](_0x8e37[_0xebfa('0x21')])+_0xebfa('0x25')]=_0x8e37[_0xebfa('0x26')]?_0x8e37[_0xebfa('0x26')]['id']:null;_0x3fe552[_[_0xebfa('0x20')](_0x8e37[_0xebfa('0x21')])+(_0x8e37[_0xebfa('0x21')]!==_0xebfa('0x27')?_0xebfa('0x28'):_0xebfa('0x29'))]=_0x8e37['account']?_0x8e37['account']['id']:null;logger[_0xebfa('0x2a')](util[_0xebfa('0xe')](_0xebfa('0x2b'),_0x43ff48,_0x25762e[_0xebfa('0x2c')]));emitChannelQueueInteraction(_0x8e37[_0xebfa('0x21')],_0x25762e[_0xebfa('0x2c')],_0x3fe552,_0x8e37['account']['name'],_0x8e37[_0xebfa('0x26')]['id'],!![],_0x59d15f,_0x25762e['id']);if(rpc[_0x8e37[_0xebfa('0x21')]+_0xebfa('0x2d')]){return rpc[_0x8e37[_0xebfa('0x21')]+_0xebfa('0x2d')]['create'](_0x3fe552)['catch'](function(_0xf2813e){logger[_0xebfa('0x2e')](_0xebfa('0x2f'));});}}}function stopRouting(_0xce663a,_0x2f3e2d,_0x4abc63,_0x599f5f){if(_0xce663a&&_0x2f3e2d){_0x2f3e2d[_0xebfa('0x30')]-=0x1;var _0x3c6825={'leaveAt':moment()[_0xebfa('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xebfa('0xe')](_0xebfa('0x31')),'reason':_0xebfa('0x32')};logger[_0xebfa('0x2a')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0xce663a,_0x2f3e2d[_0xebfa('0x2c')]));emitChannelQueueInteraction(_0x4abc63['channel'],_0x2f3e2d[_0xebfa('0x2c')],_0x4abc63[_0xebfa('0x33')],_0x4abc63[_0xebfa('0x9')]['name'],_0x4abc63['message']['id'],![],_0x599f5f,_0x2f3e2d['id']);if(rpc[_0x4abc63[_0xebfa('0x21')]+_0xebfa('0x2d')]){return rpc[_0x4abc63[_0xebfa('0x21')]+_0xebfa('0x2d')]['update'](_0xce663a,_0x3c6825)[_0xebfa('0x34')](function(_0x3ddb8d){logger['error'](_0xebfa('0x35'));});}}}function endRouting(_0x28750e,_0x48d01e,_0x5c5277,_0x340738){if(_0x28750e&&_0x48d01e){_0x48d01e[_0xebfa('0x30')]-=0x1;var _0x23d1c5={'leaveAt':moment()[_0xebfa('0xe')](_0xebfa('0x31')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xebfa('0x36')};logger[_0xebfa('0x2a')](util[_0xebfa('0xe')]('[%s][END:QUEUE][NAME:%s]',_0x28750e,_0x48d01e[_0xebfa('0x2c')]));emitChannelQueueInteraction(_0x5c5277[_0xebfa('0x21')],_0x48d01e['name'],_0x5c5277[_0xebfa('0x33')],_0x5c5277[_0xebfa('0x9')][_0xebfa('0x2c')],_0x5c5277['message']['id'],![],_0x340738);if(rpc[_0x5c5277[_0xebfa('0x21')]+_0xebfa('0x2d')]){return rpc[_0x5c5277['channel']+'QueueReport'][_0xebfa('0x37')](_0x28750e,_0x23d1c5)[_0xebfa('0x34')](function(_0x1b3d73){logger[_0xebfa('0x2e')](_0xebfa('0x35'));});}}}function handleFindQueue(_0x36fc70){return function(_0x46de37){return _0x46de37['name'][_0xebfa('0x38')]()===_0x36fc70['toLowerCase']();};}exports[_0xebfa('0x39')]=function(_0x474de9,_0x171130,_0x4cbd03,_0x82a63e){return function(_0x2ce973){try{var _0x447ac1={'name':_0x171130[0x0],'timeout':_0x171130[0x1]};var _0x804caa=queue['validate'](_0x447ac1,{'typecast':!![]});if(_0x804caa[_0xebfa('0x3a')]){logger[_0xebfa('0x2e')](_0xebfa('0x3b'),_0x474de9,_[_0xebfa('0x3c')](_0x804caa,_0xebfa('0x26'))['join'](',\x20'));_0x2ce973[_0xebfa('0x3d')]();}else{var _0x25cb3a=_[_0xebfa('0x3e')](_0x4cbd03[_0x82a63e[_0xebfa('0x21')]+'Queues'],handleFindQueue(_0x447ac1[_0xebfa('0x2c')]));if(_0x25cb3a){startRouting(_0x474de9,_0x25cb3a,_0x82a63e,_0x4cbd03);var _0x4a3725=(_0x25cb3a[_0xebfa('0x36')]||0xa)*0x3e8;var _0x333936=(_0x447ac1[_0xebfa('0x36')]||0x14)*0x3e8;var _0x6d6751,_0x3222f8;if(_0x4a3725>_0x333936){_0x333936=_0x4a3725;}var _0x4e5562=seqqueue[_0xebfa('0x3f')](_0x4a3725);_0x4e5562['id']=_0x474de9;_0x4e5562[_0xebfa('0x40')]=_0x4a3725;_0x4e5562[_0xebfa('0x41')]=_0x333936;_0x4e5562['channel']=_0x82a63e['channel'];_0x4cbd03[_0xebfa('0x42')][_0x474de9]['on']('end',function(){logger[_0xebfa('0x2a')](_0xebfa('0x43'),_0x474de9);stopRouting(_0x474de9,_0x25cb3a,_0x82a63e,_0x4cbd03);clearTimeout(_0x6d6751);_0x6d6751=undefined;_0x4e5562[_0xebfa('0x44')](!![]);if(_0x4cbd03['rules'][_0x474de9]){delete _0x4cbd03[_0xebfa('0x42')][_0x474de9];}_0x2ce973[_0xebfa('0x3d')]();});_0x4cbd03[_0xebfa('0x42')][_0x474de9]['on'](_0xebfa('0x45'),function(){if(_0x4cbd03[_0xebfa('0x42')][_0x474de9]){delete _0x4cbd03['rules'][_0x474de9];}});_0x6d6751=setTimeout(function(){logger[_0xebfa('0x2a')](_0xebfa('0x46'),_0x474de9);endRouting(_0x474de9,_0x25cb3a,_0x82a63e,_0x4cbd03);clearTimeout(_0x6d6751);_0x4e5562[_0xebfa('0x44')](!![]);_0x2ce973['next']();},_0x333936);switch(_0x25cb3a[_0xebfa('0x47')]){case'rrmemory':strategy[_0xebfa('0x48')](_0x4e5562,_0x25cb3a,_0x4cbd03,_0x82a63e);break;default:strategy['beepall'](_0x4e5562,_0x25cb3a,_0x4cbd03,_0x82a63e);}}else{logger['error'](_0xebfa('0x49'),_0x474de9,_0x447ac1[_0xebfa('0x2c')]);_0x2ce973[_0xebfa('0x3d')]();}}}catch(_0xafdd6c){console[_0xebfa('0x4a')](_0xafdd6c);logger[_0xebfa('0x2e')](_0xebfa('0x3b'),_0x474de9,_0xafdd6c[_0xebfa('0x4b')]);_0x2ce973['stop']();}};}; \ 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 c89715b..cc275e5 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 _0xddd9=['push','bind','handleTimeout','timeout','drained','prototype','handleDrained','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busyQueue','RINGING','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime'];(function(_0x5dd23a,_0x32741e){var _0x528573=function(_0x38e609){while(--_0x38e609){_0x5dd23a['push'](_0x5dd23a['shift']());}};_0x528573(++_0x32741e);}(_0xddd9,0xac));var _0x9ddd=function(_0x566e96,_0x4063eb){_0x566e96=_0x566e96-0x0;var _0x102ce5=_0xddd9[_0x566e96];return _0x102ce5;};'use strict';var _=require('lodash');var uuid=require(_0x9ddd('0x0'));var util=require(_0x9ddd('0x1'));var logger=require(_0x9ddd('0x2'))(_0x9ddd('0x3'));var Agent=function(_0x3506e1,_0x24bb2a,_0x3fb19b,_0x368249){this[_0x9ddd('0x4')]=uuid['v4']();this[_0x9ddd('0x5')]=_0x3506e1;this[_0x9ddd('0x6')]=_0x24bb2a;this[_0x9ddd('0x7')]=_0x3fb19b;this['routing']=_0x368249;this[_0x9ddd('0x5')][_0x9ddd('0x8')](this['handleRun'][_0x9ddd('0x9')](this),this[_0x9ddd('0xa')][_0x9ddd('0x9')](this));this[_0x9ddd('0x5')]['on'](_0x9ddd('0xb'),this[_0x9ddd('0xa')][_0x9ddd('0x9')](this));this[_0x9ddd('0x5')]['on'](_0x9ddd('0xc'),this['handleDrained'][_0x9ddd('0x9')](this));};Agent[_0x9ddd('0xd')][_0x9ddd('0x8')]=function(){this[_0x9ddd('0x5')][_0x9ddd('0x8')](this['handleRun'][_0x9ddd('0x9')](this),this[_0x9ddd('0xa')][_0x9ddd('0x9')](this));};Agent[_0x9ddd('0xd')][_0x9ddd('0xe')]=function(){this['handleTimeout'](!![]);};Agent[_0x9ddd('0xd')][_0x9ddd('0xf')]=function(_0x24cd45){logger[_0x9ddd('0x10')](_0x9ddd('0x11'),this[_0x9ddd('0x5')]['id'],this[_0x9ddd('0x6')]['id']);if(_[_0x9ddd('0x12')](this[_0x9ddd('0x7')][_0x9ddd('0x13')][this[_0x9ddd('0x6')]['id']])){logger[_0x9ddd('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x9ddd('0x5')]['id'],this[_0x9ddd('0x6')]['id']);setTimeout(this[_0x9ddd('0x8')][_0x9ddd('0x9')](this),0x3e8);}else{if(this[_0x9ddd('0x3')][_0x9ddd('0x14')]||util[_0x9ddd('0x15')](this['squeue']['id'],this[_0x9ddd('0x7')][_0x9ddd('0x13')][this[_0x9ddd('0x6')]['id']],this[_0x9ddd('0x5')][_0x9ddd('0x16')],![])){this['realtime']['agents'][this['agent']['id']]['busy']=!![];this[_0x9ddd('0x7')]['agents'][this['agent']['id']][_0x9ddd('0x17')]=undefined;util['showNotification'](this['notificationId'],this[_0x9ddd('0x5')]['id'],this['realtime'][_0x9ddd('0x13')][this['agent']['id']],null,this[_0x9ddd('0x3')]);util['writeLog'](this[_0x9ddd('0x5')]['id'],this['realtime'][_0x9ddd('0x13')][this[_0x9ddd('0x6')]['id']],_0x9ddd('0x18')+(this[_0x9ddd('0x3')][_0x9ddd('0x14')]?':FORCED':''));}else{logger[_0x9ddd('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x9ddd('0x6')]['id']);setTimeout(this['push'][_0x9ddd('0x9')](this),0x3e8);}}};Agent[_0x9ddd('0xd')][_0x9ddd('0xa')]=function(_0x12c259){if(_[_0x9ddd('0x12')](this['realtime']['agents'][this[_0x9ddd('0x6')]['id']])){return logger[_0x9ddd('0x10')](_0x9ddd('0x19'),this[_0x9ddd('0x5')]['id'],this[_0x9ddd('0x6')]['id']);}else{logger['info'](_0x9ddd('0x1a'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0x9ddd('0x4')],this[_0x9ddd('0x5')]['id'],this['realtime'][_0x9ddd('0x13')][this[_0x9ddd('0x6')]['id']],null,this[_0x9ddd('0x3')]);this[_0x9ddd('0x7')]['agents'][this[_0x9ddd('0x6')]['id']]['busy']=![];this[_0x9ddd('0x7')][_0x9ddd('0x13')][this[_0x9ddd('0x6')]['id']][_0x9ddd('0x17')]=undefined;util[_0x9ddd('0x1b')](this[_0x9ddd('0x5')]['id'],this[_0x9ddd('0x7')][_0x9ddd('0x13')][this[_0x9ddd('0x6')]['id']],_0x12c259?_0x9ddd('0x1c'):_0x9ddd('0x1d'));}if(!_0x12c259){setTimeout(this['push'][_0x9ddd('0x9')](this),0x3e8);}};function agent(_0x10e75f,_0x5884e8,_0x40e3e0,_0x1d4613){return new Agent(_0x10e75f,_0x5884e8,_0x40e3e0,_0x1d4613);}module['exports']=agent; \ No newline at end of file +var _0xb7b5=['isAgentAvailable','busyQueue','showNotification','notificationId',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','writeLog','STOP','TIMEOUT','uuid','../../../../../config/logger','routing','squeue','agent','push','handleRun','bind','handleTimeout','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x15fc0b,_0x186ccc){var _0x1dc955=function(_0x3df31f){while(--_0x3df31f){_0x15fc0b['push'](_0x15fc0b['shift']());}};_0x1dc955(++_0x186ccc);}(_0xb7b5,0xeb));var _0x5b7b=function(_0x1b35a6,_0x597111){_0x1b35a6=_0x1b35a6-0x0;var _0x4853bf=_0xb7b5[_0x1b35a6];return _0x4853bf;};'use strict';var _=require('lodash');var uuid=require(_0x5b7b('0x0'));var util=require('./util');var logger=require(_0x5b7b('0x1'))(_0x5b7b('0x2'));var Agent=function(_0x1546ca,_0x287591,_0x17d9dc,_0x52f4f0){this['notificationId']=uuid['v4']();this[_0x5b7b('0x3')]=_0x1546ca;this[_0x5b7b('0x4')]=_0x287591;this['realtime']=_0x17d9dc;this[_0x5b7b('0x2')]=_0x52f4f0;this[_0x5b7b('0x3')][_0x5b7b('0x5')](this[_0x5b7b('0x6')][_0x5b7b('0x7')](this),this['handleTimeout'][_0x5b7b('0x7')](this));this[_0x5b7b('0x3')]['on']('timeout',this[_0x5b7b('0x8')]['bind'](this));this['squeue']['on']('drained',this[_0x5b7b('0x9')][_0x5b7b('0x7')](this));};Agent[_0x5b7b('0xa')][_0x5b7b('0x5')]=function(){this['squeue'][_0x5b7b('0x5')](this['handleRun'][_0x5b7b('0x7')](this),this[_0x5b7b('0x8')][_0x5b7b('0x7')](this));};Agent[_0x5b7b('0xa')][_0x5b7b('0x9')]=function(){this[_0x5b7b('0x8')](!![]);};Agent[_0x5b7b('0xa')][_0x5b7b('0x6')]=function(_0x15897b){logger['info'](_0x5b7b('0xb'),this['squeue']['id'],this[_0x5b7b('0x4')]['id']);if(_['isNil'](this[_0x5b7b('0xc')][_0x5b7b('0xd')][this[_0x5b7b('0x4')]['id']])){logger[_0x5b7b('0xe')](_0x5b7b('0xf'),this[_0x5b7b('0x3')]['id'],this[_0x5b7b('0x4')]['id']);setTimeout(this['push'][_0x5b7b('0x7')](this),0x3e8);}else{if(this[_0x5b7b('0x2')][_0x5b7b('0x10')]||util[_0x5b7b('0x11')](this[_0x5b7b('0x3')]['id'],this[_0x5b7b('0xc')][_0x5b7b('0xd')][this[_0x5b7b('0x4')]['id']],this[_0x5b7b('0x3')]['channel'],![])){this[_0x5b7b('0xc')][_0x5b7b('0xd')][this[_0x5b7b('0x4')]['id']]['busy']=!![];this[_0x5b7b('0xc')]['agents'][this['agent']['id']][_0x5b7b('0x12')]=undefined;util[_0x5b7b('0x13')](this[_0x5b7b('0x14')],this[_0x5b7b('0x3')]['id'],this['realtime'][_0x5b7b('0xd')][this['agent']['id']],null,this[_0x5b7b('0x2')]);util['writeLog'](this['squeue']['id'],this[_0x5b7b('0xc')][_0x5b7b('0xd')][this[_0x5b7b('0x4')]['id']],'RINGING'+(this[_0x5b7b('0x2')][_0x5b7b('0x10')]?_0x5b7b('0x15'):''));}else{logger['info'](_0x5b7b('0x16'),this['squeue']['id'],this[_0x5b7b('0x4')]['id']);setTimeout(this[_0x5b7b('0x5')]['bind'](this),0x3e8);}}};Agent[_0x5b7b('0xa')][_0x5b7b('0x8')]=function(_0x14df3f){if(_['isNil'](this[_0x5b7b('0xc')][_0x5b7b('0xd')][this[_0x5b7b('0x4')]['id']])){return logger[_0x5b7b('0xe')](_0x5b7b('0xf'),this['squeue']['id'],this[_0x5b7b('0x4')]['id']);}else{logger['info'](_0x5b7b('0x17'),this[_0x5b7b('0x3')]['id'],this[_0x5b7b('0x4')]['id']);util['hideNotification'](this['notificationId'],this[_0x5b7b('0x3')]['id'],this['realtime'][_0x5b7b('0xd')][this[_0x5b7b('0x4')]['id']],null,this['routing']);this[_0x5b7b('0xc')][_0x5b7b('0xd')][this[_0x5b7b('0x4')]['id']][_0x5b7b('0x18')]=![];this[_0x5b7b('0xc')]['agents'][this[_0x5b7b('0x4')]['id']]['busyQueue']=undefined;util[_0x5b7b('0x19')](this[_0x5b7b('0x3')]['id'],this[_0x5b7b('0xc')][_0x5b7b('0xd')][this[_0x5b7b('0x4')]['id']],_0x14df3f?_0x5b7b('0x1a'):_0x5b7b('0x1b'));}if(!_0x14df3f){setTimeout(this['push'][_0x5b7b('0x7')](this),0x3e8);}};function agent(_0x16d1e4,_0x3e160a,_0x2ac861,_0x28811a){return new Agent(_0x16d1e4,_0x3e160a,_0x2ac861,_0x28811a);}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 2078989..4f7cde5 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 _0x5162=['handleDrained','isNil','Agents','length','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','name','showNotification','routing','[%s][QUEUE]\x20EMPTY','writeLog','STOP','exports','lodash','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','timeout','drained','prototype'];(function(_0x44595e,_0x5649f3){var _0x47c659=function(_0x209bd9){while(--_0x209bd9){_0x44595e['push'](_0x44595e['shift']());}};_0x47c659(++_0x5649f3);}(_0x5162,0x103));var _0x2516=function(_0x15f455,_0x1ec373){_0x15f455=_0x15f455-0x0;var _0x45f542=_0x5162[_0x15f455];return _0x45f542;};'use strict';var _=require(_0x2516('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x41fd28,_0x2aaef5,_0x3ce7de,_0x2d0b53){this[_0x2516('0x1')]=uuid['v4']();this[_0x2516('0x2')]=_0x41fd28;this[_0x2516('0x3')]=_0x2aaef5;this['realtime']=_0x3ce7de;this['routing']=_0x2d0b53;this['squeue'][_0x2516('0x4')](this[_0x2516('0x5')][_0x2516('0x6')](this),this[_0x2516('0x7')][_0x2516('0x6')](this));this[_0x2516('0x2')]['on'](_0x2516('0x8'),this['handleTimeout'][_0x2516('0x6')](this));this[_0x2516('0x2')]['on'](_0x2516('0x9'),this['handleDrained']['bind'](this));};Beepall['prototype']['push']=function(){this[_0x2516('0x2')][_0x2516('0x4')](this[_0x2516('0x5')][_0x2516('0x6')](this),this['handleTimeout'][_0x2516('0x6')](this));};Beepall[_0x2516('0xa')][_0x2516('0xb')]=function(_0xb28714){this[_0x2516('0x7')](!![]);};Beepall[_0x2516('0xa')][_0x2516('0x5')]=function(_0x2edb47){var _0x1b3c7e=!![];if(!_[_0x2516('0xc')](this[_0x2516('0x3')])&&!_[_0x2516('0xc')](this[_0x2516('0x3')][_0x2516('0xd')])&&this[_0x2516('0x3')]['Agents'][_0x2516('0xe')]>0x0){for(var _0x1ced29=0x0,_0x1a1005;_0x1ced290x0){for(var _0x2cd7ca=0x0,_0x4a6f95;_0x2cd7ca0x0&&_0x11ecf7[_0x300be8+_0xae3d('0x28')]>=_0x11ecf7[_0x300be8+_0xae3d('0x27')]){writeLog(_0x3224ff,_0x11ecf7,_0x300be8[_0xae3d('0x29')]()+_0xae3d('0x2a'));return![];}}return!![];};exports[_0xae3d('0x2b')]=function(_0x54c1e1,_0x57864e,_0x12e3a5,_0x1281aa,_0x3a5840){return sendNotification(!![],_0x54c1e1,_0x57864e,_0x12e3a5,_0x1281aa,_0x3a5840);};exports[_0xae3d('0x2c')]=function(_0xb69ec9,_0x561371,_0x1d1483,_0x3a2434,_0x5a39c5){return sendNotification(![],_0xb69ec9,_0x561371,_0x1d1483,_0x3a2434,_0x5a39c5);};exports[_0xae3d('0x2d')]=writeLog; \ No newline at end of file +var _0x4745=['../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','format','user:%s','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','notification:%s','save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','online','OFFLINE','Pause','hasOwnProperty','CurrentCapacity','toUpperCase','showNotification','lodash','util','../utils','mustache','ioredis'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x4745,0x1e7));var _0x5474=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x4745[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var utils=require(_0x5474('0x2'));var Mustache=require(_0x5474('0x3'));var Redis=require(_0x5474('0x4'));var config=require(_0x5474('0x5'));var logger=require(_0x5474('0x6'))(_0x5474('0x7'));config[_0x5474('0x8')]=_[_0x5474('0x9')](config[_0x5474('0x8')],{'host':_0x5474('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5474('0x8')]));function emit(_0x431f81,_0x57add7,_0x13929f){io['to'](_0x431f81)['emit'](_0x57add7,_0x13929f);}function sendNotification(_0x902ba8,_0x3c8860,_0x4fae2b,_0xf876f8,_0x11dcb2,_0x46b4b3){io['to'](util[_0x5474('0xb')](_0x5474('0xc'),_0xf876f8[_0x5474('0xd')]))[_0x5474('0xe')](_0x5474('0xf'),_0xf876f8);var _0x48fc51=_0x46b4b3||{};var _0x38dadb=_0x4fae2b[_0x5474('0x10')]('.');var _0xdc4c23={'uniqueid':_0x3c8860,'channel':_0x38dadb[0x0],'id':_0x38dadb[0x1],'title':_0x38dadb[0x0]+_0x5474('0x11'),'interactionId':_0x38dadb[0x2],'queue':_0x11dcb2?_0x11dcb2[_0x5474('0xd')]:null,'sound':_0x48fc51[_0x5474('0x12')][_0x5474('0x13')],'shake':_0x48fc51[_0x5474('0x12')][_0x5474('0x14')]};try{if(!_0x48fc51['body']){_0x48fc51[_0x5474('0x15')]={};}if(_0x11dcb2){_0x48fc51[_0x5474('0x15')][_0x5474('0x16')]=_0x11dcb2;}else if(_0x48fc51[_0x5474('0x15')]['queue']){delete _0x48fc51['body']['queue'];}_0xdc4c23['msg']=utils[_0x5474('0x17')](_0x48fc51[_0x5474('0x12')][_0x5474('0x18')],_0x48fc51);}catch(_0x532718){_0xdc4c23[_0x5474('0x19')]=_0x5474('0x1a');logger['error'](util[_0x5474('0xb')](_0x5474('0x1b'),_0x3c8860,_0x532718[_0x5474('0x1c')]));}io['to'](util[_0x5474('0xb')](_0x5474('0xc'),_0xf876f8['name']))[_0x5474('0xe')](util['format'](_0x5474('0x1d'),_0x902ba8?_0x5474('0x1e'):'remove'),_0xdc4c23);}function writeLog(_0x504826,_0x563539,_0x1f81d6){return logger[_0x5474('0x1f')](util[_0x5474('0xb')](_0x5474('0x20'),_0x504826,_0x563539[_0x5474('0xd')],_0x1f81d6));}exports[_0x5474('0x21')]=function(_0xe4850d,_0x1e512d,_0x219be1,_0x9c80cc){if(_0x1e512d['busy']){writeLog(_0xe4850d,_0x1e512d,'BUSY');return![];}if(!_0x1e512d[_0x5474('0x22')]){writeLog(_0xe4850d,_0x1e512d,_0x5474('0x23'));return![];}if(_0x1e512d[_0x219be1+_0x5474('0x24')]){writeLog(_0xe4850d,_0x1e512d,'PAUSE');return![];}if(_0x9c80cc&&_0x1e512d[_0x5474('0x25')](_0x219be1+'Capacity')&&_0x1e512d[_0x5474('0x25')](_0x219be1+_0x5474('0x26'))){if(_0x1e512d[_0x219be1+'Capacity']>0x0&&_0x1e512d[_0x219be1+_0x5474('0x26')]>=_0x1e512d[_0x219be1+'Capacity']){writeLog(_0xe4850d,_0x1e512d,_0x219be1[_0x5474('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5474('0x28')]=function(_0x1384e4,_0x2a8730,_0x5865fe,_0x574ed6,_0x42b99a){return sendNotification(!![],_0x1384e4,_0x2a8730,_0x5865fe,_0x574ed6,_0x42b99a);};exports['hideNotification']=function(_0x57731b,_0x5d2381,_0x492a31,_0x168dee,_0x1b8adb){return sendNotification(![],_0x57731b,_0x5d2381,_0x492a31,_0x168dee,_0x1b8adb);};exports['writeLog']=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 647c27a..32a0fbc 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 _0xe8cf=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','map','message'];(function(_0xb540a0,_0x3d855e){var _0x4afe15=function(_0xdb9da1){while(--_0xdb9da1){_0xb540a0['push'](_0xb540a0['shift']());}};_0x4afe15(++_0x3d855e);}(_0xe8cf,0x16e));var _0xfe8c=function(_0x1a3c9b,_0x3eb0cb){_0x1a3c9b=_0x1a3c9b-0x0;var _0x57f1d8=_0xe8cf[_0x1a3c9b];return _0x57f1d8;};'use strict';var schema=require('validate');var sh=require(_0xfe8c('0x0'));var _=require(_0xfe8c('0x1'));var utils=require(_0xfe8c('0x2'));var logger=require(_0xfe8c('0x3'))(_0xfe8c('0x4'));var system=schema({'command':{'type':_0xfe8c('0x5'),'required':!![],'message':_0xfe8c('0x6')}});exports[_0xfe8c('0x7')]=function(_0x578d1a,_0x59a8d4){return function(_0x106dfa){try{var _0x49c46b={'command':_0x59a8d4[0x0]};var _0xb5ce37=system[_0xfe8c('0x8')](_0x49c46b,{'typecast':!![]});if(_0xb5ce37[_0xfe8c('0x9')]){logger['error']('[%s][SYSTEM]\x20%s',_0x578d1a,_[_0xfe8c('0xa')](_0xb5ce37,_0xfe8c('0xb'))['join'](',\x20'));logger['info'](_0xfe8c('0xc'),_0x578d1a);_0x106dfa[_0xfe8c('0xd')]();}else{var _0x56a962=this;var _0x56477c=utils[_0xfe8c('0xe')](_0x59a8d4[0x0],this);logger[_0xfe8c('0xf')](_0xfe8c('0x10'),_0x578d1a,_0x56477c);sh[_0xfe8c('0x11')](_['trim'](_0x56477c),function(_0x1d4166,_0x46a8a9){logger[_0xfe8c('0xf')](_0xfe8c('0x12'),_0x578d1a,_0x1d4166);if(_0x1d4166==0x0){var _0x3efa81=_0x46a8a9['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xfe8c('0x13')](_0x59a8d4[0x1])||_[_0xfe8c('0x14')](_0x59a8d4[0x1])){logger[_0xfe8c('0xf')](_0xfe8c('0x15'),_0x578d1a);_0x56a962[_0xfe8c('0x16')][_0x59a8d4[0x1]]=_0x3efa81;}else{logger[_0xfe8c('0xf')](_0xfe8c('0x17'),_0x578d1a,_0x59a8d4[0x1],_0x3efa81);_0x56a962[_0xfe8c('0x16')][_0x59a8d4[0x1]]=_0x3efa81;}}_0x106dfa['next']();});}}catch(_0x8c924b){logger[_0xfe8c('0x18')]('[%s][SYSTEM]\x20%s',_0x578d1a,_[_0xfe8c('0x19')](_0x8c924b)?JSON[_0xfe8c('0x1a')](_0x8c924b):_0x8c924b);logger[_0xfe8c('0xf')](_0xfe8c('0xc'),_0x578d1a);_0x106dfa[_0xfe8c('0xd')]();}};}; \ No newline at end of file +var _0x749e=['next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x5e0aa1,_0x30a9fa){var _0x111fae=function(_0x2c34af){while(--_0x2c34af){_0x5e0aa1['push'](_0x5e0aa1['shift']());}};_0x111fae(++_0x30a9fa);}(_0x749e,0x171));var _0xe749=function(_0x8ccb31,_0x7659b5){_0x8ccb31=_0x8ccb31-0x0;var _0x4011f8=_0x749e[_0x8ccb31];return _0x4011f8;};'use strict';var schema=require(_0xe749('0x0'));var sh=require(_0xe749('0x1'));var _=require(_0xe749('0x2'));var utils=require(_0xe749('0x3'));var logger=require(_0xe749('0x4'))('routing');var system=schema({'command':{'type':_0xe749('0x5'),'required':!![],'message':_0xe749('0x6')}});exports[_0xe749('0x7')]=function(_0x13500d,_0x3cfebb){return function(_0x2853d7){try{var _0x17879f={'command':_0x3cfebb[0x0]};var _0x380a33=system[_0xe749('0x0')](_0x17879f,{'typecast':!![]});if(_0x380a33[_0xe749('0x8')]){logger[_0xe749('0x9')](_0xe749('0xa'),_0x13500d,_['map'](_0x380a33,_0xe749('0xb'))[_0xe749('0xc')](',\x20'));logger[_0xe749('0xd')](_0xe749('0xe'),_0x13500d);_0x2853d7[_0xe749('0xf')]();}else{var _0x5444f3=this;var _0xb12710=utils[_0xe749('0x10')](_0x3cfebb[0x0],this);logger['info'](_0xe749('0x11'),_0x13500d,_0xb12710);sh['exec'](_['trim'](_0xb12710),function(_0x105df0,_0x4e408d){logger[_0xe749('0xd')](_0xe749('0x12'),_0x13500d,_0x105df0);if(_0x105df0==0x0){var _0x345528=_0x4e408d[_0xe749('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xe749('0x14')](_0x3cfebb[0x1])||_[_0xe749('0x15')](_0x3cfebb[0x1])){logger[_0xe749('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x13500d);_0x5444f3[_0xe749('0x16')][_0x3cfebb[0x1]]=_0x345528;}else{logger[_0xe749('0xd')](_0xe749('0x17'),_0x13500d,_0x3cfebb[0x1],_0x345528);_0x5444f3[_0xe749('0x16')][_0x3cfebb[0x1]]=_0x345528;}}_0x2853d7[_0xe749('0xf')]();});}}catch(_0x3491c7){logger[_0xe749('0x9')](_0xe749('0xa'),_0x13500d,_['isObject'](_0x3491c7)?JSON['stringify'](_0x3491c7):_0x3491c7);logger[_0xe749('0xd')](_0xe749('0xe'),_0x13500d);_0x2853d7[_0xe749('0xf')]();}};}; \ 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 6d16d03..55ee6b6 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 _0xd60f=['lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','isObject','validate'];(function(_0x260c16,_0x37365a){var _0x3566e6=function(_0x101132){while(--_0x101132){_0x260c16['push'](_0x260c16['shift']());}};_0x3566e6(++_0x37365a);}(_0xd60f,0x15e));var _0xfd60=function(_0x862788,_0x1c47df){_0x862788=_0x862788-0x0;var _0x1e5b3a=_0xd60f[_0x862788];return _0x1e5b3a;};'use strict';var schema=require(_0xfd60('0x0'));var _=require(_0xfd60('0x1'));var rpc={'chatInteraction':require(_0xfd60('0x2')),'openchannelInteraction':require(_0xfd60('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xfd60('0x4')),'faxInteraction':require(_0xfd60('0x5')),'whatsappInteraction':require(_0xfd60('0x6'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xfd60('0x7'),'required':!![],'message':_0xfd60('0x8')}});exports[_0xfd60('0x9')]=function(_0x5468e9,_0x4c0e61,_0x4158c4,_0x3b1f97){return function(_0x2bea0c){try{var _0x46ecdc={'tag':_0x4c0e61[0x0]};var _0x12d852=tag[_0xfd60('0x0')](_0x46ecdc,{'typecast':!![]});if(_0x12d852['length']){logger[_0xfd60('0xa')]('[%s][TAG]\x20%s',_0x5468e9,_[_0xfd60('0xb')](_0x12d852,_0xfd60('0xc'))[_0xfd60('0xd')](',\x20'));logger[_0xfd60('0xe')](_0xfd60('0xf'),_0x5468e9);_0x2bea0c[_0xfd60('0x10')]();}else{var _0x5d7c2b={'ids':[_0x4c0e61[0x0]]};if(rpc[_0x3b1f97[_0xfd60('0x11')]+_0xfd60('0x12')]){rpc[_0x3b1f97[_0xfd60('0x11')]+_0xfd60('0x12')][_0xfd60('0x13')](_0x3b1f97['interaction']['id'],_0x5d7c2b)[_0xfd60('0x14')](function(_0x5b019b){logger[_0xfd60('0xe')](_0xfd60('0x15'),_0x5468e9,_0x4c0e61[0x1],_0x3b1f97[_0xfd60('0x11')],_0x3b1f97['interaction']['id']);})[_0xfd60('0x16')](function(_0x2eadb1){logger[_0xfd60('0xa')](_0xfd60('0x17'),_0x5468e9,JSON[_0xfd60('0x18')](_0x2eadb1));logger[_0xfd60('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5468e9);})[_0xfd60('0x19')](function(){_0x2bea0c[_0xfd60('0x10')]();});}}}catch(_0x10e2c6){logger[_0xfd60('0xa')](_0xfd60('0x17'),_0x5468e9,_[_0xfd60('0x1a')](_0x10e2c6)?JSON[_0xfd60('0x18')](_0x10e2c6):_0x10e2c6);logger[_0xfd60('0xe')](_0xfd60('0xf'),_0x5468e9);_0x2bea0c[_0xfd60('0x10')]();}};}; \ No newline at end of file +var _0xfeac=['then','info','catch','stringify','finally','error','[%s][TAG]\x20%s','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','consequence','map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction'];(function(_0x184031,_0x2672ea){var _0x4aa18a=function(_0x217bd1){while(--_0x217bd1){_0x184031['push'](_0x184031['shift']());}};_0x4aa18a(++_0x2672ea);}(_0xfeac,0xd8));var _0xcfea=function(_0x225c6e,_0x3b09cb){_0x225c6e=_0x225c6e-0x0;var _0x1f73c2=_0xfeac[_0x225c6e];return _0x1f73c2;};'use strict';var schema=require(_0xcfea('0x0'));var _=require(_0xcfea('0x1'));var rpc={'chatInteraction':require(_0xcfea('0x2')),'openchannelInteraction':require(_0xcfea('0x3')),'smsInteraction':require(_0xcfea('0x4')),'mailInteraction':require(_0xcfea('0x5')),'faxInteraction':require(_0xcfea('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xcfea('0x7'))('routing');var tag=schema({'tag':{'type':_0xcfea('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xcfea('0x9')]=function(_0x527cbb,_0x2dd917,_0x5c5c7c,_0x4700d5){return function(_0x24ae65){try{var _0x1bb80a={'tag':_0x2dd917[0x0]};var _0xc5c3c8=tag[_0xcfea('0x0')](_0x1bb80a,{'typecast':!![]});if(_0xc5c3c8['length']){logger['error']('[%s][TAG]\x20%s',_0x527cbb,_[_0xcfea('0xa')](_0xc5c3c8,'message')[_0xcfea('0xb')](',\x20'));logger['info'](_0xcfea('0xc'),_0x527cbb);_0x24ae65[_0xcfea('0xd')]();}else{var _0x36e484={'ids':[_0x2dd917[0x0]]};if(rpc[_0x4700d5[_0xcfea('0xe')]+_0xcfea('0xf')]){rpc[_0x4700d5[_0xcfea('0xe')]+_0xcfea('0xf')][_0xcfea('0x10')](_0x4700d5[_0xcfea('0x11')]['id'],_0x36e484)[_0xcfea('0x12')](function(_0x5241e5){logger[_0xcfea('0x13')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x527cbb,_0x2dd917[0x1],_0x4700d5[_0xcfea('0xe')],_0x4700d5[_0xcfea('0x11')]['id']);})[_0xcfea('0x14')](function(_0x387f24){logger['error']('[%s][TAG]\x20%s',_0x527cbb,JSON[_0xcfea('0x15')](_0x387f24));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x527cbb);})[_0xcfea('0x16')](function(){_0x24ae65[_0xcfea('0xd')]();});}}}catch(_0x5f28cb){logger[_0xcfea('0x17')](_0xcfea('0x18'),_0x527cbb,_[_0xcfea('0x19')](_0x5f28cb)?JSON[_0xcfea('0x15')](_0x5f28cb):_0x5f28cb);logger[_0xcfea('0x13')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x527cbb);_0x24ae65['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 d6e0665..b8da2ce 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x25dccb,_0x24aa4f){var _0x4e7751=function(_0x4c3123){while(--_0x4c3123){_0x25dccb['push'](_0x25dccb['shift']());}};_0x4e7751(++_0x24aa4f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x3801ea,_0x3daa3a){var _0x18743e=function(_0x32763c){while(--_0x32763c){_0x3801ea['push'](_0x3801ea['shift']());}};_0x18743e(++_0x3daa3a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 894324d..7c03781 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 _0xd48a=['smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','isNil','IntervalId','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','join','.js','app','appdata','split','channel','mail','push','slice','dialogflowv2','amazonlex','%s:%s:%s','./interval','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues'];(function(_0x5204ee,_0x5db0c9){var _0x43bb7d=function(_0x2d5548){while(--_0x2d5548){_0x5204ee['push'](_0x5204ee['shift']());}};_0x43bb7d(++_0x5db0c9);}(_0xd48a,0x68));var _0xad48=function(_0x171b5c,_0x5192ef){_0x171b5c=_0x171b5c-0x0;var _0x4b8660=_0xd48a[_0x171b5c];return _0x4b8660;};'use strict';var _=require(_0xad48('0x0'));var util=require('util');var path=require(_0xad48('0x1'));var fs=require('fs');var jayson=require(_0xad48('0x2'));var BPromise=require(_0xad48('0x3'));var uuid=require(_0xad48('0x4'));var config=require(_0xad48('0x5'));var logger=require(_0xad48('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0xad48('0x7')),'mailQueueReport':require(_0xad48('0x8')),'chatQueueReport':require(_0xad48('0x9')),'smsQueueReport':require(_0xad48('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xad48('0xb'));function getId(_0xd5a718,_0x8fc144,_0x42bd8c){return util[_0xad48('0xc')]('%s.%s.%s',_0xd5a718,_0x8fc144||0x0,_0x42bd8c||0x0);}function getIntervals(_0x463dd0,_0x4b4202){var _0x59d26c=[];if(!_[_0xad48('0xd')](_0x4b4202[_0xad48('0xe')])&&!_[_0xad48('0xd')](_0x463dd0[_0x4b4202[_0xad48('0xe')]])&&!_['isNil'](_0x463dd0[_0x4b4202[_0xad48('0xe')]]['Intervals'])){_0x59d26c=_[_0xad48('0xf')](_0x463dd0[_0x4b4202[_0xad48('0xe')]]['Intervals'],_0xad48('0x10'));}else if(!_['isNil'](_0x4b4202[_0xad48('0x10')])){_0x59d26c=[_0x4b4202['interval']];}return _0x59d26c;}exports[_0xad48('0x11')]=function(_0x1433d7){_0x1433d7[_0xad48('0x12')]={};return new BPromise(function(_0x4cb223,_0x322e2d){var _0x4116b7={'Start':function(_0x1120bb){var _0x480abb=this;return new Promise(function(_0x385ac9,_0x387682){if(_0x1120bb){try{var _0x3a68de=[];var _0x24d1a5=getId(_0x1120bb['channel'],_0x1120bb[_0xad48('0x13')]?_0x1120bb[_0xad48('0x13')]['id']:0x0,_0x1120bb['interaction']?_0x1120bb[_0xad48('0x14')]['id']:0x0);if(_0x1120bb[_0xad48('0x15')]&&_[_0xad48('0x16')](_0x1120bb[_0xad48('0x15')])&&_0x1120bb[_0xad48('0x15')][_0xad48('0x17')]){for(var _0x44530a=0x0;_0x44530a<_0x1120bb['applications'][_0xad48('0x17')];_0x44530a+=0x1){var _0x129ec3=_0x1120bb[_0xad48('0x15')][_0x44530a];if(fs[_0xad48('0x18')](path[_0xad48('0x19')](__dirname,_0xad48('0x15'),_0x129ec3['app']+_0xad48('0x1a')))){var _0xd466c2=[];switch(_0x129ec3[_0xad48('0x1b')]['toLowerCase']()){case'autoreply':var _0x10d0ac=_0x129ec3[_0xad48('0x1c')][_0xad48('0x1d')](',');if(_0x1120bb[_0xad48('0x1e')]===_0xad48('0x1f')){_0xd466c2[_0xad48('0x20')](_0x10d0ac[0x0]);_0xd466c2[_0xad48('0x20')](_0x10d0ac[0x1]);_0xd466c2[_0xad48('0x20')](_0x10d0ac['slice'](0x2,_0x10d0ac[_0xad48('0x17')])[_0xad48('0x19')](','));}else{_0xd466c2[_0xad48('0x20')](_0x10d0ac[0x0]);_0xd466c2['push'](_0x10d0ac[_0xad48('0x21')](0x1,_0x10d0ac[_0xad48('0x17')])[_0xad48('0x19')](','));}break;case'dialogflow':var _0x15e824=_0x129ec3[_0xad48('0x1c')][_0xad48('0x1d')](',');_0xd466c2['push'](_0x15e824[0x0]);_0xd466c2[_0xad48('0x20')](_0x15e824[0x1]);_0xd466c2[_0xad48('0x20')](_0x15e824[_0xad48('0x21')](0x2,_0x15e824['length'])['join'](','));break;case _0xad48('0x22'):var _0x59e5ea=_0x129ec3[_0xad48('0x1c')][_0xad48('0x1d')](',');_0xd466c2['push'](_0x59e5ea[0x0]);_0xd466c2[_0xad48('0x20')](_0x59e5ea[0x1]);_0xd466c2['push'](_0x59e5ea[0x2]);_0xd466c2[_0xad48('0x20')](_0x59e5ea[0x3]);_0xd466c2[_0xad48('0x20')](_0x59e5ea['slice'](0x4,_0x59e5ea[_0xad48('0x17')])[_0xad48('0x19')](','));break;case _0xad48('0x23'):var _0x2583d7=_0x129ec3[_0xad48('0x1c')][_0xad48('0x1d')](',');_0xd466c2['push'](_0x2583d7[0x0]);_0xd466c2[_0xad48('0x20')](_0x2583d7[0x1]);_0xd466c2['push'](_0x2583d7[0x2]);_0xd466c2[_0xad48('0x20')](_0x2583d7[0x3]);_0xd466c2[_0xad48('0x20')](_0x2583d7[_0xad48('0x21')](0x4,_0x2583d7[_0xad48('0x17')])[_0xad48('0x19')](','));break;case _0xad48('0x13'):_0xd466c2[_0xad48('0x20')](_0x129ec3[_0xad48('0x1c')]);break;case'tag':_0xd466c2[_0xad48('0x20')](_0x129ec3['TagId']);_0xd466c2['push'](_0x129ec3[_0xad48('0x1c')]);break;default:_0xd466c2=_[_0xad48('0xd')](_0x129ec3[_0xad48('0x1c')])?[]:_0x129ec3['appdata']['split'](',');}var _0x20f936={'id':util['format'](_0xad48('0x24'),_0x24d1a5,_0x129ec3['id'],_0x129ec3['app']),'condition':require(_0xad48('0x25'))['condition'](_0x24d1a5,getIntervals(_0x1433d7[_0xad48('0x26')],_0x129ec3),_0x1433d7),'consequence':require(_0xad48('0x27')+_0x129ec3[_0xad48('0x1b')])['consequence'](_0x24d1a5,_0xd466c2,_0x1433d7,_0x1120bb),'p':_0x129ec3[_0xad48('0x28')]||0x0};logger[_0xad48('0x29')](_0xad48('0x2a'),_0x20f936['id'],_0xad48('0x2b'),getIntervals(_0x1433d7[_0xad48('0x26')],_0x129ec3)[_0xad48('0x19')](_0xad48('0x2c')));_0x3a68de[_0xad48('0x20')](_0x20f936);}else{logger[_0xad48('0x2d')](_0xad48('0x2e'),path[_0xad48('0x19')](__dirname,_0xad48('0x15'),_0x129ec3[_0xad48('0x1b')]+_0xad48('0x1a')));}}_0x1433d7[_0xad48('0x12')][_0x24d1a5]=new RuleEngine(_0x3a68de);_0x1433d7[_0xad48('0x12')][_0x24d1a5][_0xad48('0x2f')](_0x1120bb,function(_0x71119f){logger[_0xad48('0x29')](_0xad48('0x30'),JSON[_0xad48('0x31')](_0x71119f[_0xad48('0x32')]));if(_0x1433d7['rules'][_0x24d1a5]){_0x1433d7['rules'][_0x24d1a5]['emit'](_0xad48('0x33'));}});return _0x385ac9({'code':0xc8,'message':_0x1120bb});}else{logger[_0xad48('0x29')](_0xad48('0x34'));return _0x385ac9({'code':0xc8,'message':_0x1120bb});}}catch(_0x5efb43){logger[_0xad48('0x2d')](_0x5efb43[_0xad48('0x35')]);return _0x387682(_0x480abb[_0xad48('0x2d')](0x1f4,_0x5efb43));}}return _0x387682(_0xad48('0x36'));});},'AcceptMessage':function(_0x5dd611){var _0x17778f=this;return new Promise(function(_0xf45e09,_0x31fdb9){if(_0x5dd611[_0xad48('0x37')]&&_0x5dd611[_0xad48('0x37')]['id']){if(_0x1433d7['agents'][_0x5dd611[_0xad48('0x37')]['id']]){_0x1433d7[_0xad48('0x38')][_0x5dd611[_0xad48('0x37')]['id']][_0xad48('0x39')]=![];_0x1433d7[_0xad48('0x38')][_0x5dd611[_0xad48('0x37')]['id']][_0xad48('0x3a')]=undefined;}}if(_0x5dd611[_0xad48('0x13')]&&_0x5dd611['message']['id']){try{var _0x7da10a=getId(_0x5dd611[_0xad48('0x1e')],_0x5dd611['message']?_0x5dd611['message']['id']:0x0,_0x5dd611[_0xad48('0x14')]?_0x5dd611[_0xad48('0x14')]['id']:0x0);if(_0x1433d7[_0xad48('0x12')][_0x7da10a]){_0x1433d7[_0xad48('0x12')][_0x7da10a][_0xad48('0x3b')](_0xad48('0x3c'));if(rpc[_0x5dd611['channel']+_0xad48('0x3d')]){rpc[_0x5dd611['channel']+_0xad48('0x3d')][_0xad48('0x3e')](_0x7da10a,{'UserId':_0x5dd611[_0xad48('0x13')][_0xad48('0x3f')]})[_0xad48('0x40')](function(_0x4dae1b){logger[_0xad48('0x2d')](_0xad48('0x41'));});}}return _0xf45e09({'code':0xc8,'message':_0x5dd611});}catch(_0x1a71d9){logger[_0xad48('0x2d')](_0x1a71d9['stack']);return _0x31fdb9(_0x17778f[_0xad48('0x2d')](0x1f4,_0x1a71d9));}}logger['error'](_0xad48('0x42'));return _0x31fdb9(_0x17778f['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xe9086e){var _0x1aa628=this;return new Promise(function(_0x1734a3,_0x56dcf6){if(_0xe9086e[_0xad48('0x37')]&&_0xe9086e[_0xad48('0x37')]['id']){try{if(_0x1433d7[_0xad48('0x38')][_0xe9086e[_0xad48('0x37')]['id']]){_0x1433d7[_0xad48('0x38')][_0xe9086e['agent']['id']][_0xad48('0x39')]=![];_0x1433d7[_0xad48('0x38')][_0xe9086e[_0xad48('0x37')]['id']][_0xad48('0x3a')]=undefined;}return _0x1734a3({'code':0xc8,'message':_0xe9086e});}catch(_0x269666){logger[_0xad48('0x2d')](_0x269666[_0xad48('0x35')]);return _0x56dcf6(_0x1aa628[_0xad48('0x2d')](0x1f4,_0x269666));}}logger['error'](_0xad48('0x42'));return _0x56dcf6(_0x1aa628[_0xad48('0x2d')](0x1f4,_0xad48('0x42')));});},'AbandonInteraction':function(_0x54e538){var _0x12ceea=this;return new Promise(function(_0x2a7e39,_0x6aa60b){if(_0x54e538[_0xad48('0x1e')]&&_0x54e538[_0xad48('0x14')]&&_0x54e538[_0xad48('0x14')]['id']){try{var _0x5106cd=getId(_0x54e538[_0xad48('0x1e')],_0x54e538[_0xad48('0x13')]?_0x54e538[_0xad48('0x13')]['id']:0x0,_0x54e538['interaction']?_0x54e538[_0xad48('0x14')]['id']:0x0);if(_0x1433d7['rules'][_0x5106cd]){_0x1433d7[_0xad48('0x12')][_0x5106cd][_0xad48('0x3b')]('end');}return _0x2a7e39({'code':0xc8,'message':_0x54e538});}catch(_0xec026){logger[_0xad48('0x2d')](_0xec026[_0xad48('0x35')]);return _0x6aa60b(_0x12ceea[_0xad48('0x2d')](0x1f4,_0xec026));}}logger[_0xad48('0x2d')]('message\x20is\x20empty');return _0x6aa60b(_0x12ceea[_0xad48('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xd38337){var _0x59bc0f=this;return new Promise(function(_0x4dfc72,_0x55c566){if(_0x1433d7[_0xad48('0x38')][_0xad48('0x43')](_0xd38337['id'])){for(var _0x2b2fc0 in _0xd38337[_0xad48('0x44')]){if(_0xd38337['capacity']['hasOwnProperty'](_0x2b2fc0)){if(_0x1433d7['agents'][_0xd38337['id']][_0xad48('0x43')](_0x2b2fc0+_0xad48('0x45'))){_0x1433d7[_0xad48('0x38')][_0xd38337['id']][_0x2b2fc0+_0xad48('0x45')]=parseInt(_0xd38337[_0xad48('0x44')][_0x2b2fc0],0xa);}}}_0x1433d7[_0xad48('0x38')][_0xd38337['id']]['updateRealtime']();return _0x4dfc72({'code':0xc8,'message':_0x1433d7[_0xad48('0x38')][_0xd38337['id']]});}else{return _0x55c566(_0x59bc0f[_0xad48('0x2d')](0x1f4,_0xad48('0x46')));}});},'Agents':function(_0x5bb23c){return new Promise(function(_0x2c2e7c,_0x1d3526){var _0x569b08=_[_0xad48('0x47')](_0x1433d7[_0xad48('0x38')]);_0x2c2e7c({'count':_0x569b08[_0xad48('0x17')],'rows':_0x569b08});});},'ChatQueues':function(_0x1fab54){return new Promise(function(_0xa268de,_0x4e1719){var _0x31c447=[];for(var _0x5d1e13 in _0x1433d7[_0xad48('0x48')]){if(_0x1433d7[_0xad48('0x48')][_0xad48('0x43')](_0x5d1e13)){var _0x4f9b53=_0x1433d7[_0xad48('0x48')][_0x5d1e13];var _0x1a3b34={'id':_0x4f9b53['id'],'available':_0x4f9b53[_0xad48('0x49')],'loggedIn':_0x4f9b53[_0xad48('0x4a')],'name':_0x4f9b53[_0xad48('0x4b')],'paused':_0x4f9b53[_0xad48('0x4c')],'waiting':_0x4f9b53[_0xad48('0x4d')]};_0x31c447[_0xad48('0x20')](_0x1a3b34);}}_0xa268de({'count':_0x31c447[_0xad48('0x17')],'rows':_0x31c447});});},'MailQueues':function(_0x2e8934){return new Promise(function(_0x295c6c,_0x390142){var _0x1589b1=[];for(var _0x1e93d8 in _0x1433d7[_0xad48('0x4e')]){if(_0x1433d7[_0xad48('0x4e')][_0xad48('0x43')](_0x1e93d8)){var _0x21723a=_0x1433d7[_0xad48('0x4e')][_0x1e93d8];var _0x473adb={'id':_0x21723a['id'],'available':_0x21723a['available'],'loggedIn':_0x21723a[_0xad48('0x4a')],'name':_0x21723a[_0xad48('0x4b')],'paused':_0x21723a[_0xad48('0x4c')],'waiting':_0x21723a[_0xad48('0x4d')]};_0x1589b1[_0xad48('0x20')](_0x473adb);}}_0x295c6c({'count':_0x1589b1[_0xad48('0x17')],'rows':_0x1589b1});});},'OpenchannelQueues':function(_0xf98d0){return new Promise(function(_0x240db3,_0x323e05){var _0x3ab9b5=[];for(var _0x96bbea in _0x1433d7[_0xad48('0x4f')]){if(_0x1433d7['openchannelQueues'][_0xad48('0x43')](_0x96bbea)){var _0x34e2b6=_0x1433d7[_0xad48('0x4f')][_0x96bbea];var _0x5cac92={'id':_0x34e2b6['id'],'available':_0x34e2b6[_0xad48('0x49')],'loggedIn':_0x34e2b6[_0xad48('0x4a')],'name':_0x34e2b6[_0xad48('0x4b')],'paused':_0x34e2b6[_0xad48('0x4c')],'waiting':_0x34e2b6[_0xad48('0x4d')]};_0x3ab9b5[_0xad48('0x20')](_0x5cac92);}}_0x240db3({'count':_0x3ab9b5[_0xad48('0x17')],'rows':_0x3ab9b5});});},'SmsQueues':function(_0x5d9e73){return new Promise(function(_0x12b44b,_0x5550b2){var _0x1f2165=[];for(var _0x440a37 in _0x1433d7[_0xad48('0x50')]){if(_0x1433d7[_0xad48('0x50')]['hasOwnProperty'](_0x440a37)){var _0xa499d8=_0x1433d7[_0xad48('0x50')][_0x440a37];var _0x1ec276={'id':_0xa499d8['id'],'available':_0xa499d8[_0xad48('0x49')],'loggedIn':_0xa499d8[_0xad48('0x4a')],'name':_0xa499d8[_0xad48('0x4b')],'paused':_0xa499d8['paused'],'waiting':_0xa499d8[_0xad48('0x4d')]};_0x1f2165[_0xad48('0x20')](_0x1ec276);}}_0x12b44b({'count':_0x1f2165['length'],'rows':_0x1f2165});});},'FaxQueues':function(_0x1e0e82){return new Promise(function(_0x2dbbbf,_0x2b5ff5){var _0x4d5172=[];for(var _0x243b05 in _0x1433d7['faxQueues']){if(_0x1433d7['faxQueues'][_0xad48('0x43')](_0x243b05)){var _0x4182b3=_0x1433d7[_0xad48('0x51')][_0x243b05];var _0x3f93b1={'id':_0x4182b3['id'],'available':_0x4182b3['available'],'loggedIn':_0x4182b3[_0xad48('0x4a')],'name':_0x4182b3[_0xad48('0x4b')],'paused':_0x4182b3[_0xad48('0x4c')],'waiting':_0x4182b3[_0xad48('0x4d')]};_0x4d5172[_0xad48('0x20')](_0x3f93b1);}}_0x2dbbbf({'count':_0x4d5172[_0xad48('0x17')],'rows':_0x4d5172});});},'WhatsappQueues':function(_0x5affab){return new Promise(function(_0x467f4a,_0x5129e8){var _0x4f55d3=[];for(var _0x16ac38 in _0x1433d7[_0xad48('0x52')]){if(_0x1433d7[_0xad48('0x52')][_0xad48('0x43')](_0x16ac38)){var _0x4b3c8b=_0x1433d7[_0xad48('0x52')][_0x16ac38];var _0x2a140e={'id':_0x4b3c8b['id'],'available':_0x4b3c8b[_0xad48('0x49')],'loggedIn':_0x4b3c8b['loggedIn'],'name':_0x4b3c8b[_0xad48('0x4b')],'paused':_0x4b3c8b['paused'],'waiting':_0x4b3c8b[_0xad48('0x4d')]};_0x4f55d3[_0xad48('0x20')](_0x2a140e);}}_0x467f4a({'count':_0x4f55d3[_0xad48('0x17')],'rows':_0x4f55d3});});},'ChatQueuesWaitingInteractions':function(_0x3b4c1f){return new Promise(function(_0x2278f8,_0x2d3669){var _0x1fef14=_[_0xad48('0x47')](_0x1433d7[_0xad48('0x53')]);_0x2278f8({'count':_0x1fef14[_0xad48('0x17')],'rows':_0x1fef14});});},'MailQueuesWaitingInteractions':function(_0x16a784){return new Promise(function(_0x40717e,_0x11224c){var _0x69377d=_[_0xad48('0x47')](_0x1433d7[_0xad48('0x54')]);_0x40717e({'count':_0x69377d['length'],'rows':_0x69377d});});},'OpenchannelQueuesWaitingInteractions':function(_0x2bb671){return new Promise(function(_0x167bee,_0x951a5e){var _0x2802fa=_[_0xad48('0x47')](_0x1433d7['openchannelQueuesWaitingInteractions']);_0x167bee({'count':_0x2802fa[_0xad48('0x17')],'rows':_0x2802fa});});},'SmsQueuesWaitingInteractions':function(_0x5cefe6){return new Promise(function(_0x244951,_0x55fb24){var _0x585548=_['values'](_0x1433d7[_0xad48('0x55')]);_0x244951({'count':_0x585548[_0xad48('0x17')],'rows':_0x585548});});},'FaxQueuesWaitingInteractions':function(_0x5a4912){return new Promise(function(_0x47c605,_0x29de75){var _0xe7269b=_[_0xad48('0x47')](_0x1433d7['faxQueuesWaitingInteractions']);_0x47c605({'count':_0xe7269b[_0xad48('0x17')],'rows':_0xe7269b});});},'WhatsappQueuesWaitingInteractions':function(_0x258ba9){return new Promise(function(_0x1af865,_0x24818d){var _0x2ad474=_[_0xad48('0x47')](_0x1433d7[_0xad48('0x56')]);_0x1af865({'count':_0x2ad474[_0xad48('0x17')],'rows':_0x2ad474});});}};var _0x22be61=jayson[_0xad48('0x57')](_0x4116b7)[_0xad48('0x58')]();_0x22be61['on']('error',function(_0x2dee0b){logger['error'](JSON[_0xad48('0x31')](_0x2dee0b));return _0x322e2d(_0x2dee0b);});_0x22be61[_0xad48('0x11')](0x232c,'127.0.0.1',function(){console[_0xad48('0x59')](_0xad48('0x5a'),0x232c);return _0x4cb223(_0xad48('0x5b')+0x232c);});});}; \ No newline at end of file +var _0x743c=['priority','info','Push\x20new\x20rule','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','agent','agents','busy','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','.js','autoreply','split','mail','push','slice','join','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x743c,0x148));var _0xc743=function(_0x197853,_0x24487b){_0x197853=_0x197853-0x0;var _0x1cbb30=_0x743c[_0x197853];return _0x1cbb30;};'use strict';var _=require(_0xc743('0x0'));var util=require(_0xc743('0x1'));var path=require(_0xc743('0x2'));var fs=require('fs');var jayson=require(_0xc743('0x3'));var BPromise=require(_0xc743('0x4'));var uuid=require(_0xc743('0x5'));var config=require('../../../config/environment');var logger=require(_0xc743('0x6'))(_0xc743('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xc743('0x8')),'smsQueueReport':require(_0xc743('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xc743('0xa'))};var RuleEngine=require(_0xc743('0xb'));function getId(_0x343055,_0x14e768,_0xd288d0){return util[_0xc743('0xc')](_0xc743('0xd'),_0x343055,_0x14e768||0x0,_0xd288d0||0x0);}function getIntervals(_0x2b1c10,_0x553c5e){var _0x4063c4=[];if(!_[_0xc743('0xe')](_0x553c5e[_0xc743('0xf')])&&!_[_0xc743('0xe')](_0x2b1c10[_0x553c5e[_0xc743('0xf')]])&&!_[_0xc743('0xe')](_0x2b1c10[_0x553c5e['IntervalId']][_0xc743('0x10')])){_0x4063c4=_[_0xc743('0x11')](_0x2b1c10[_0x553c5e['IntervalId']][_0xc743('0x10')],_0xc743('0x12'));}else if(!_[_0xc743('0xe')](_0x553c5e[_0xc743('0x12')])){_0x4063c4=[_0x553c5e[_0xc743('0x12')]];}return _0x4063c4;}exports[_0xc743('0x13')]=function(_0x357cd3){_0x357cd3[_0xc743('0x14')]={};return new BPromise(function(_0x377836,_0x5bc776){var _0x5739e6={'Start':function(_0x16ad71){var _0x43f301=this;return new Promise(function(_0x15019b,_0x48d7ba){if(_0x16ad71){try{var _0x4f46fa=[];var _0x54cb0f=getId(_0x16ad71[_0xc743('0x15')],_0x16ad71[_0xc743('0x16')]?_0x16ad71[_0xc743('0x16')]['id']:0x0,_0x16ad71[_0xc743('0x17')]?_0x16ad71[_0xc743('0x17')]['id']:0x0);if(_0x16ad71[_0xc743('0x18')]&&_[_0xc743('0x19')](_0x16ad71[_0xc743('0x18')])&&_0x16ad71[_0xc743('0x18')][_0xc743('0x1a')]){for(var _0x4156f7=0x0;_0x4156f7<_0x16ad71[_0xc743('0x18')]['length'];_0x4156f7+=0x1){var _0x4be3d7=_0x16ad71[_0xc743('0x18')][_0x4156f7];if(fs[_0xc743('0x1b')](path['join'](__dirname,_0xc743('0x18'),_0x4be3d7[_0xc743('0x1c')]+_0xc743('0x1d')))){var _0xd4fd0f=[];switch(_0x4be3d7[_0xc743('0x1c')]['toLowerCase']()){case _0xc743('0x1e'):var _0x45f9d9=_0x4be3d7['appdata'][_0xc743('0x1f')](',');if(_0x16ad71['channel']===_0xc743('0x20')){_0xd4fd0f[_0xc743('0x21')](_0x45f9d9[0x0]);_0xd4fd0f[_0xc743('0x21')](_0x45f9d9[0x1]);_0xd4fd0f[_0xc743('0x21')](_0x45f9d9[_0xc743('0x22')](0x2,_0x45f9d9['length'])[_0xc743('0x23')](','));}else{_0xd4fd0f['push'](_0x45f9d9[0x0]);_0xd4fd0f['push'](_0x45f9d9[_0xc743('0x22')](0x1,_0x45f9d9[_0xc743('0x1a')])['join'](','));}break;case _0xc743('0x24'):var _0x49ac28=_0x4be3d7[_0xc743('0x25')][_0xc743('0x1f')](',');_0xd4fd0f[_0xc743('0x21')](_0x49ac28[0x0]);_0xd4fd0f[_0xc743('0x21')](_0x49ac28[0x1]);_0xd4fd0f[_0xc743('0x21')](_0x49ac28[_0xc743('0x22')](0x2,_0x49ac28[_0xc743('0x1a')])[_0xc743('0x23')](','));break;case _0xc743('0x26'):var _0x3d9945=_0x4be3d7[_0xc743('0x25')][_0xc743('0x1f')](',');_0xd4fd0f[_0xc743('0x21')](_0x3d9945[0x0]);_0xd4fd0f[_0xc743('0x21')](_0x3d9945[0x1]);_0xd4fd0f[_0xc743('0x21')](_0x3d9945[0x2]);_0xd4fd0f['push'](_0x3d9945[0x3]);_0xd4fd0f[_0xc743('0x21')](_0x3d9945[_0xc743('0x22')](0x4,_0x3d9945[_0xc743('0x1a')])[_0xc743('0x23')](','));break;case _0xc743('0x27'):var _0x5725ea=_0x4be3d7[_0xc743('0x25')][_0xc743('0x1f')](',');_0xd4fd0f['push'](_0x5725ea[0x0]);_0xd4fd0f[_0xc743('0x21')](_0x5725ea[0x1]);_0xd4fd0f[_0xc743('0x21')](_0x5725ea[0x2]);_0xd4fd0f[_0xc743('0x21')](_0x5725ea[0x3]);_0xd4fd0f[_0xc743('0x21')](_0x5725ea[_0xc743('0x22')](0x4,_0x5725ea[_0xc743('0x1a')])[_0xc743('0x23')](','));break;case'message':_0xd4fd0f[_0xc743('0x21')](_0x4be3d7[_0xc743('0x25')]);break;case _0xc743('0x28'):_0xd4fd0f[_0xc743('0x21')](_0x4be3d7[_0xc743('0x29')]);_0xd4fd0f[_0xc743('0x21')](_0x4be3d7[_0xc743('0x25')]);break;default:_0xd4fd0f=_[_0xc743('0xe')](_0x4be3d7[_0xc743('0x25')])?[]:_0x4be3d7[_0xc743('0x25')][_0xc743('0x1f')](',');}var _0x55d95c={'id':util[_0xc743('0xc')](_0xc743('0x2a'),_0x54cb0f,_0x4be3d7['id'],_0x4be3d7[_0xc743('0x1c')]),'condition':require(_0xc743('0x2b'))[_0xc743('0x2c')](_0x54cb0f,getIntervals(_0x357cd3[_0xc743('0x2d')],_0x4be3d7),_0x357cd3),'consequence':require(_0xc743('0x2e')+_0x4be3d7[_0xc743('0x1c')])[_0xc743('0x2f')](_0x54cb0f,_0xd4fd0f,_0x357cd3,_0x16ad71),'p':_0x4be3d7[_0xc743('0x30')]||0x0};logger[_0xc743('0x31')](_0xc743('0x32'),_0x55d95c['id'],'on\x20interval',getIntervals(_0x357cd3[_0xc743('0x2d')],_0x4be3d7)['join']('\x20|\x20'));_0x4f46fa[_0xc743('0x21')](_0x55d95c);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc743('0x23')](__dirname,_0xc743('0x18'),_0x4be3d7[_0xc743('0x1c')]+_0xc743('0x1d')));}}_0x357cd3[_0xc743('0x14')][_0x54cb0f]=new RuleEngine(_0x4f46fa);_0x357cd3[_0xc743('0x14')][_0x54cb0f][_0xc743('0x33')](_0x16ad71,function(_0x53426a){logger['info'](_0xc743('0x34'),JSON[_0xc743('0x35')](_0x53426a[_0xc743('0x36')]));if(_0x357cd3['rules'][_0x54cb0f]){_0x357cd3['rules'][_0x54cb0f][_0xc743('0x37')](_0xc743('0x38'));}});return _0x15019b({'code':0xc8,'message':_0x16ad71});}else{logger[_0xc743('0x31')](_0xc743('0x39'));return _0x15019b({'code':0xc8,'message':_0x16ad71});}}catch(_0x3a658d){logger[_0xc743('0x3a')](_0x3a658d['stack']);return _0x48d7ba(_0x43f301[_0xc743('0x3a')](0x1f4,_0x3a658d));}}return _0x48d7ba('routing\x20is\x20empty');});},'AcceptMessage':function(_0xed4843){var _0x5f5161=this;return new Promise(function(_0x2cba86,_0x3262e7){if(_0xed4843[_0xc743('0x3b')]&&_0xed4843[_0xc743('0x3b')]['id']){if(_0x357cd3[_0xc743('0x3c')][_0xed4843[_0xc743('0x3b')]['id']]){_0x357cd3['agents'][_0xed4843['agent']['id']][_0xc743('0x3d')]=![];_0x357cd3[_0xc743('0x3c')][_0xed4843[_0xc743('0x3b')]['id']]['busyQueue']=undefined;}}if(_0xed4843['message']&&_0xed4843[_0xc743('0x16')]['id']){try{var _0x2319c3=getId(_0xed4843[_0xc743('0x15')],_0xed4843[_0xc743('0x16')]?_0xed4843[_0xc743('0x16')]['id']:0x0,_0xed4843[_0xc743('0x17')]?_0xed4843[_0xc743('0x17')]['id']:0x0);if(_0x357cd3['rules'][_0x2319c3]){_0x357cd3[_0xc743('0x14')][_0x2319c3]['emit'](_0xc743('0x3e'));if(rpc[_0xed4843[_0xc743('0x15')]+'QueueReport']){rpc[_0xed4843['channel']+_0xc743('0x3f')]['update'](_0x2319c3,{'UserId':_0xed4843[_0xc743('0x16')][_0xc743('0x40')]})[_0xc743('0x41')](function(_0x19167f){logger[_0xc743('0x3a')](_0xc743('0x42'));});}}return _0x2cba86({'code':0xc8,'message':_0xed4843});}catch(_0x23b28c){logger['error'](_0x23b28c[_0xc743('0x43')]);return _0x3262e7(_0x5f5161['error'](0x1f4,_0x23b28c));}}logger['error'](_0xc743('0x44'));return _0x3262e7(_0x5f5161[_0xc743('0x3a')](0x1f4,_0xc743('0x44')));});},'RejectMessage':function(_0x47fa2c){var _0x4d2bb4=this;return new Promise(function(_0x207c5e,_0xd2fb73){if(_0x47fa2c[_0xc743('0x3b')]&&_0x47fa2c[_0xc743('0x3b')]['id']){try{if(_0x357cd3['agents'][_0x47fa2c[_0xc743('0x3b')]['id']]){_0x357cd3[_0xc743('0x3c')][_0x47fa2c[_0xc743('0x3b')]['id']][_0xc743('0x3d')]=![];_0x357cd3['agents'][_0x47fa2c[_0xc743('0x3b')]['id']][_0xc743('0x45')]=undefined;}return _0x207c5e({'code':0xc8,'message':_0x47fa2c});}catch(_0x3ca4ec){logger[_0xc743('0x3a')](_0x3ca4ec[_0xc743('0x43')]);return _0xd2fb73(_0x4d2bb4[_0xc743('0x3a')](0x1f4,_0x3ca4ec));}}logger[_0xc743('0x3a')](_0xc743('0x44'));return _0xd2fb73(_0x4d2bb4[_0xc743('0x3a')](0x1f4,_0xc743('0x44')));});},'AbandonInteraction':function(_0x15fe9d){var _0x33ae11=this;return new Promise(function(_0x17cb11,_0x29953d){if(_0x15fe9d[_0xc743('0x15')]&&_0x15fe9d[_0xc743('0x17')]&&_0x15fe9d[_0xc743('0x17')]['id']){try{var _0xe201ef=getId(_0x15fe9d['channel'],_0x15fe9d['message']?_0x15fe9d['message']['id']:0x0,_0x15fe9d[_0xc743('0x17')]?_0x15fe9d[_0xc743('0x17')]['id']:0x0);if(_0x357cd3[_0xc743('0x14')][_0xe201ef]){_0x357cd3[_0xc743('0x14')][_0xe201ef][_0xc743('0x37')](_0xc743('0x3e'));}return _0x17cb11({'code':0xc8,'message':_0x15fe9d});}catch(_0x38f15a){logger[_0xc743('0x3a')](_0x38f15a['stack']);return _0x29953d(_0x33ae11[_0xc743('0x3a')](0x1f4,_0x38f15a));}}logger['error'](_0xc743('0x44'));return _0x29953d(_0x33ae11[_0xc743('0x3a')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x45dc69){var _0x34f81a=this;return new Promise(function(_0x1e2450,_0x474d23){if(_0x357cd3[_0xc743('0x3c')][_0xc743('0x46')](_0x45dc69['id'])){for(var _0x573471 in _0x45dc69[_0xc743('0x47')]){if(_0x45dc69['capacity']['hasOwnProperty'](_0x573471)){if(_0x357cd3['agents'][_0x45dc69['id']][_0xc743('0x46')](_0x573471+_0xc743('0x48'))){_0x357cd3[_0xc743('0x3c')][_0x45dc69['id']][_0x573471+'CurrentCapacity']=parseInt(_0x45dc69['capacity'][_0x573471],0xa);}}}_0x357cd3[_0xc743('0x3c')][_0x45dc69['id']][_0xc743('0x49')]();return _0x1e2450({'code':0xc8,'message':_0x357cd3[_0xc743('0x3c')][_0x45dc69['id']]});}else{return _0x474d23(_0x34f81a[_0xc743('0x3a')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x29e993){return new Promise(function(_0x4de155,_0x3209d8){var _0x7c0850=_[_0xc743('0x4a')](_0x357cd3['agents']);_0x4de155({'count':_0x7c0850['length'],'rows':_0x7c0850});});},'ChatQueues':function(_0xd23451){return new Promise(function(_0x2e261e,_0xc469e5){var _0x40c6db=[];for(var _0x495ab6 in _0x357cd3[_0xc743('0x4b')]){if(_0x357cd3[_0xc743('0x4b')][_0xc743('0x46')](_0x495ab6)){var _0x18ee8c=_0x357cd3[_0xc743('0x4b')][_0x495ab6];var _0x4472a5={'id':_0x18ee8c['id'],'available':_0x18ee8c[_0xc743('0x4c')],'loggedIn':_0x18ee8c[_0xc743('0x4d')],'name':_0x18ee8c[_0xc743('0x4e')],'paused':_0x18ee8c[_0xc743('0x4f')],'waiting':_0x18ee8c[_0xc743('0x50')]};_0x40c6db['push'](_0x4472a5);}}_0x2e261e({'count':_0x40c6db[_0xc743('0x1a')],'rows':_0x40c6db});});},'MailQueues':function(_0x418e96){return new Promise(function(_0x3def59,_0x50a23d){var _0x195311=[];for(var _0x6af443 in _0x357cd3[_0xc743('0x51')]){if(_0x357cd3[_0xc743('0x51')]['hasOwnProperty'](_0x6af443)){var _0x3120ee=_0x357cd3['mailQueues'][_0x6af443];var _0x294eb4={'id':_0x3120ee['id'],'available':_0x3120ee[_0xc743('0x4c')],'loggedIn':_0x3120ee[_0xc743('0x4d')],'name':_0x3120ee[_0xc743('0x4e')],'paused':_0x3120ee['paused'],'waiting':_0x3120ee[_0xc743('0x50')]};_0x195311[_0xc743('0x21')](_0x294eb4);}}_0x3def59({'count':_0x195311[_0xc743('0x1a')],'rows':_0x195311});});},'OpenchannelQueues':function(_0x301e5e){return new Promise(function(_0x49371e,_0x2fc2e4){var _0x3f92e8=[];for(var _0x216336 in _0x357cd3['openchannelQueues']){if(_0x357cd3[_0xc743('0x52')][_0xc743('0x46')](_0x216336)){var _0x551b07=_0x357cd3['openchannelQueues'][_0x216336];var _0x13df4b={'id':_0x551b07['id'],'available':_0x551b07['available'],'loggedIn':_0x551b07[_0xc743('0x4d')],'name':_0x551b07[_0xc743('0x4e')],'paused':_0x551b07[_0xc743('0x4f')],'waiting':_0x551b07[_0xc743('0x50')]};_0x3f92e8[_0xc743('0x21')](_0x13df4b);}}_0x49371e({'count':_0x3f92e8['length'],'rows':_0x3f92e8});});},'SmsQueues':function(_0x1924fc){return new Promise(function(_0x442966,_0x1f3d10){var _0x48a420=[];for(var _0x476d15 in _0x357cd3[_0xc743('0x53')]){if(_0x357cd3['smsQueues']['hasOwnProperty'](_0x476d15)){var _0x26e6b4=_0x357cd3[_0xc743('0x53')][_0x476d15];var _0x2d0fc6={'id':_0x26e6b4['id'],'available':_0x26e6b4['available'],'loggedIn':_0x26e6b4[_0xc743('0x4d')],'name':_0x26e6b4['name'],'paused':_0x26e6b4[_0xc743('0x4f')],'waiting':_0x26e6b4[_0xc743('0x50')]};_0x48a420[_0xc743('0x21')](_0x2d0fc6);}}_0x442966({'count':_0x48a420[_0xc743('0x1a')],'rows':_0x48a420});});},'FaxQueues':function(_0x290466){return new Promise(function(_0x2ddaae,_0x2c64fd){var _0x802190=[];for(var _0x1f1522 in _0x357cd3[_0xc743('0x54')]){if(_0x357cd3[_0xc743('0x54')]['hasOwnProperty'](_0x1f1522)){var _0x531d0f=_0x357cd3[_0xc743('0x54')][_0x1f1522];var _0x19fdb2={'id':_0x531d0f['id'],'available':_0x531d0f['available'],'loggedIn':_0x531d0f[_0xc743('0x4d')],'name':_0x531d0f['name'],'paused':_0x531d0f[_0xc743('0x4f')],'waiting':_0x531d0f[_0xc743('0x50')]};_0x802190[_0xc743('0x21')](_0x19fdb2);}}_0x2ddaae({'count':_0x802190[_0xc743('0x1a')],'rows':_0x802190});});},'WhatsappQueues':function(_0x21cc1f){return new Promise(function(_0x3fe377,_0x4618e1){var _0x5e52a5=[];for(var _0x5bd332 in _0x357cd3['whatsappQueues']){if(_0x357cd3[_0xc743('0x55')][_0xc743('0x46')](_0x5bd332)){var _0x1f8f2f=_0x357cd3[_0xc743('0x55')][_0x5bd332];var _0xeae10b={'id':_0x1f8f2f['id'],'available':_0x1f8f2f[_0xc743('0x4c')],'loggedIn':_0x1f8f2f[_0xc743('0x4d')],'name':_0x1f8f2f[_0xc743('0x4e')],'paused':_0x1f8f2f[_0xc743('0x4f')],'waiting':_0x1f8f2f[_0xc743('0x50')]};_0x5e52a5[_0xc743('0x21')](_0xeae10b);}}_0x3fe377({'count':_0x5e52a5[_0xc743('0x1a')],'rows':_0x5e52a5});});},'ChatQueuesWaitingInteractions':function(_0x3a1358){return new Promise(function(_0x229872,_0x368735){var _0x2e65d2=_['values'](_0x357cd3['chatQueuesWaitingInteractions']);_0x229872({'count':_0x2e65d2['length'],'rows':_0x2e65d2});});},'MailQueuesWaitingInteractions':function(_0x27883a){return new Promise(function(_0x41c457,_0x2155b4){var _0x4bc33d=_['values'](_0x357cd3[_0xc743('0x56')]);_0x41c457({'count':_0x4bc33d[_0xc743('0x1a')],'rows':_0x4bc33d});});},'OpenchannelQueuesWaitingInteractions':function(_0x52bd00){return new Promise(function(_0x343dfb,_0x587255){var _0x3445dd=_[_0xc743('0x4a')](_0x357cd3[_0xc743('0x57')]);_0x343dfb({'count':_0x3445dd[_0xc743('0x1a')],'rows':_0x3445dd});});},'SmsQueuesWaitingInteractions':function(_0x10cd14){return new Promise(function(_0x5c809b,_0x3bc874){var _0x12ae96=_['values'](_0x357cd3[_0xc743('0x58')]);_0x5c809b({'count':_0x12ae96[_0xc743('0x1a')],'rows':_0x12ae96});});},'FaxQueuesWaitingInteractions':function(_0x310680){return new Promise(function(_0x30ed52,_0x52770f){var _0x6266b4=_[_0xc743('0x4a')](_0x357cd3[_0xc743('0x59')]);_0x30ed52({'count':_0x6266b4['length'],'rows':_0x6266b4});});},'WhatsappQueuesWaitingInteractions':function(_0x34104c){return new Promise(function(_0x1e420c,_0x22e27a){var _0x9bbebf=_[_0xc743('0x4a')](_0x357cd3[_0xc743('0x5a')]);_0x1e420c({'count':_0x9bbebf[_0xc743('0x1a')],'rows':_0x9bbebf});});}};var _0x1a7f80=jayson[_0xc743('0x5b')](_0x5739e6)['http']();_0x1a7f80['on'](_0xc743('0x3a'),function(_0x444b8a){logger['error'](JSON[_0xc743('0x35')](_0x444b8a));return _0x5bc776(_0x444b8a);});_0x1a7f80[_0xc743('0x13')](0x232c,_0xc743('0x5c'),function(){console[_0xc743('0x5d')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x377836('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 1765318..9d8bb47 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 _0x4e79=['iftime\x20%s','message','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','jayson/promise','lodash','../../../config/logger','client','http','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4e79,0x1b0));var _0x94e7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4e79[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x94e7('0x0'));var BPromise=require('bluebird');var jayson=require(_0x94e7('0x1'));var _=require(_0x94e7('0x2'));var logger=require(_0x94e7('0x3'))('routing');var client=jayson[_0x94e7('0x4')][_0x94e7('0x5')]({'port':0x232a});function request(_0x37b481,_0x1d0815){return new BPromise(function(_0x398ddc,_0x249077){return client[_0x94e7('0x6')](_0x37b481,_0x1d0815)[_0x94e7('0x7')](function(_0x52b76d){if(_0x52b76d[_0x94e7('0x8')]){return _0x249077(_0x52b76d[_0x94e7('0x8')]['message']);}else{return _0x398ddc(_0x52b76d[_0x94e7('0x9')]);}})[_0x94e7('0xa')](function(_0x5b5665){return _0x249077(_0x5b5665);});});}exports[_0x94e7('0xb')]=function(_0x1012db,_0xdc56e6,_0x2a64cc){return function(_0x1b5049){if(_0x2a64cc[_0x94e7('0xc')]&&!_0x2a64cc[_0x94e7('0xc')][_0x1012db]){logger[_0x94e7('0xd')](_0x94e7('0xe'),_0x1012db);return _0x1b5049[_0x94e7('0xf')]();}var _0x158833=[];for(var _0xb6ee20=0x0;_0xb6ee20<_0xdc56e6[_0x94e7('0x10')];_0xb6ee20+=0x1){_0x158833['push'](request(_0x94e7('0x11'),{'command':util['format'](_0x94e7('0x12'),_0xdc56e6[_0xb6ee20])})[_0x94e7('0x7')](function(_0x1b3c10){return _0x1b3c10&&_0x1b3c10[_0x94e7('0x13')]&&_0x1b3c10[_0x94e7('0x13')][_0x94e7('0x14')](_0x94e7('0x15'))>=0x0?!![]:![];})[_0x94e7('0xa')](function(_0x1a4071){logger[_0x94e7('0x8')]('[%s][INTERVAL]\x20%s',_0x1012db,_0xdc56e6[_0xb6ee20]);}));}BPromise[_0x94e7('0x16')](_0x158833)[_0x94e7('0x7')](function(_0x497af1){var _0x55603d=_[_0x94e7('0x17')](_0x497af1);logger['info'](_0x94e7('0x18'),_0x1012db,_0xdc56e6['join'](_0x94e7('0x19')),_0x55603d);_0x1b5049[_0x94e7('0x1a')](_0x55603d);})[_0x94e7('0xa')](function(_0x55d35d){console[_0x94e7('0x1b')](_0x55d35d);logger[_0x94e7('0x8')](_0x94e7('0x18'),_0x1012db,_0xdc56e6[_0x94e7('0x1c')](_0x94e7('0x19')),_0x55d35d[_0x94e7('0x1d')]);_0x1b5049[_0x94e7('0xf')]();});};}; \ No newline at end of file +var _0xf0c5=['info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','indexOf','true','all','some','join','\x20|\x20','log','util','lodash','../../../config/logger','client','http','request','then','error','message','result','catch','rules'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xf0c5,0x184));var _0x5f0c=function(_0x2fdb9c,_0x54946e){_0x2fdb9c=_0x2fdb9c-0x0;var _0x272937=_0xf0c5[_0x2fdb9c];return _0x272937;};'use strict';var util=require(_0x5f0c('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x5f0c('0x1'));var logger=require(_0x5f0c('0x2'))('routing');var client=jayson[_0x5f0c('0x3')][_0x5f0c('0x4')]({'port':0x232a});function request(_0x541c43,_0x3cd417){return new BPromise(function(_0x3433b2,_0x31ebc1){return client[_0x5f0c('0x5')](_0x541c43,_0x3cd417)[_0x5f0c('0x6')](function(_0x81e545){if(_0x81e545[_0x5f0c('0x7')]){return _0x31ebc1(_0x81e545['error'][_0x5f0c('0x8')]);}else{return _0x3433b2(_0x81e545[_0x5f0c('0x9')]);}})[_0x5f0c('0xa')](function(_0xd8bd3d){return _0x31ebc1(_0xd8bd3d);});});}exports['condition']=function(_0x133e38,_0x341b88,_0x5706e5){return function(_0x5c473f){if(_0x5706e5[_0x5f0c('0xb')]&&!_0x5706e5[_0x5f0c('0xb')][_0x133e38]){logger[_0x5f0c('0xc')](_0x5f0c('0xd'),_0x133e38);return _0x5c473f[_0x5f0c('0xe')]();}var _0x34ba0c=[];for(var _0x4008ba=0x0;_0x4008ba<_0x341b88[_0x5f0c('0xf')];_0x4008ba+=0x1){_0x34ba0c['push'](request(_0x5f0c('0x10'),{'command':util[_0x5f0c('0x11')]('iftime\x20%s',_0x341b88[_0x4008ba])})['then'](function(_0x168904){return _0x168904&&_0x168904[_0x5f0c('0x8')]&&_0x168904[_0x5f0c('0x8')][_0x5f0c('0x12')](_0x5f0c('0x13'))>=0x0?!![]:![];})[_0x5f0c('0xa')](function(_0x4ef8a7){logger['error']('[%s][INTERVAL]\x20%s',_0x133e38,_0x341b88[_0x4008ba]);}));}BPromise[_0x5f0c('0x14')](_0x34ba0c)[_0x5f0c('0x6')](function(_0x5e6580){var _0x51938b=_[_0x5f0c('0x15')](_0x5e6580);logger[_0x5f0c('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x133e38,_0x341b88[_0x5f0c('0x16')](_0x5f0c('0x17')),_0x51938b);_0x5c473f['when'](_0x51938b);})['catch'](function(_0x40dae9){console[_0x5f0c('0x18')](_0x40dae9);logger[_0x5f0c('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x133e38,_0x341b88[_0x5f0c('0x16')]('\x20|\x20'),_0x40dae9['stack']);_0x5c473f[_0x5f0c('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2ecc938..0902495 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 _0x84a0=['transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','complete','lodash','util','./utils','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x84a0,0x66));var _0x084a=function(_0x17f006,_0x4221ee){_0x17f006=_0x17f006-0x0;var _0x531496=_0x84a0[_0x17f006];return _0x531496;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var utils=require(_0x084a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fff7f,_0x483bfa){utils[_0x084a('0x3')](util[_0x084a('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1fff7f['uniqueid'],_0x1fff7f[_0x084a('0x5')],_0x1fff7f[_0x084a('0x6')],_0x1fff7f['membername'],_0x1fff7f[_0x084a('0x7')],_0x1fff7f[_0x084a('0x8')],_0x1fff7f[_0x084a('0x9')],_0x1fff7f[_0x084a('0xa')]));if(_0x1fff7f[_0x084a('0x6')]){utils['getVoiceQueueByName'](_0x1fff7f[_0x084a('0x6')])[_0x084a('0xb')](function(_0x8198ad){if(_0x8198ad){_0x1fff7f[_0x084a('0xc')]=_0x8198ad[_0x084a('0xc')];_0x1fff7f['agentacw']=_0x1fff7f['agentcomplete']?_0x8198ad[_0x084a('0xd')]:![];_0x1fff7f[_0x084a('0xe')]=_0x1fff7f[_0x084a('0xf')]?_0x8198ad[_0x084a('0x10')]:0x0;}utils[_0x084a('0x11')]('CreateVoiceAgentReport',_0x1fff7f);});}else{utils['request'](_0x084a('0x12'),_0x1fff7f);}if(_0x483bfa){delete transfers[_0x1fff7f[_0x084a('0x13')]];}else{delete agents[_0x1fff7f[_0x084a('0x14')]];}}exports[_0x084a('0x15')]=function(_0x1bdfb8){try{utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8['uniqueid']),_0x1bdfb8);agents[_0x1bdfb8[_0x084a('0x14')]]=_0x1bdfb8;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x18')]=utils[_0x084a('0x19')]();agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x1a');agents[_0x1bdfb8['destuniqueid']][_0x084a('0x9')]=null;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x1b')]=null;utils[_0x084a('0x3')](util['format'](_0x084a('0x1c'),_0x1bdfb8[_0x084a('0x13')],agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0x1d')],_0x1bdfb8[_0x084a('0x14')]));}catch(_0x145636){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8[_0x084a('0x13')]),_0x145636);}};exports[_0x084a('0x1f')]=function(_0x279e25){try{if(!_[_0x084a('0x20')](agents[_0x279e25[_0x084a('0x14')]])){utils[_0x084a('0x16')](util['format'](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x279e25);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x22'),_0x279e25['uniqueid'],agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1d')],_0x279e25[_0x084a('0x14')]));agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1f')]=!![];agents[_0x279e25[_0x084a('0x14')]]['agentringnoanswerAt']=utils[_0x084a('0x19')]();agents[_0x279e25[_0x084a('0x14')]][_0x084a('0xa')]='timeout';agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x23')]=_0x084a('0x24');agents[_0x279e25['destuniqueid']]['holdtime']=_0x279e25['ringtime']?parseInt(_0x279e25['ringtime'])/0x3e8:0x0;agents[_0x279e25[_0x084a('0x14')]]['talktime']=0x0;unanswered['push'](_0x279e25['destuniqueid']);}}catch(_0x3b8176){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x3b8176);}};exports[_0x084a('0x25')]=function(_0x378de6){try{_[_0x084a('0x26')](agents,function(_0x5e6ea8,_0x2ed3cd){if(_0x5e6ea8[_0x084a('0x13')]==_0x378de6['uniqueid']&&!_[_0x084a('0x27')](unanswered,_0x5e6ea8[_0x084a('0x14')])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x378de6);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x29'),_0x378de6[_0x084a('0x13')],_0x5e6ea8[_0x084a('0x1d')],_0x5e6ea8[_0x084a('0x14')]));_0x5e6ea8[_0x084a('0x1f')]=!![];_0x5e6ea8['agentringnoanswerAt']=utils['now']();_0x5e6ea8[_0x084a('0xa')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x23')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x2b')]=_0x378de6['holdtime'];_0x5e6ea8[_0x084a('0x2c')]=0x0;writeDB(_0x5e6ea8);}});}catch(_0x1b56ad){utils[_0x084a('0x1e')](util['format'](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x1b56ad);}};exports[_0x084a('0x2d')]=function(_0x4c4c90){try{if(agents[_0x4c4c90['destuniqueid']]){utils['debug'](util[_0x084a('0x4')](_0x084a('0x2e'),_0x4c4c90[_0x084a('0x13')]),_0x4c4c90);utils['info'](util[_0x084a('0x4')](_0x084a('0x2f'),_0x4c4c90[_0x084a('0x13')],agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1d')],_0x4c4c90[_0x084a('0x14')]));agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x9')]=_0x4c4c90[_0x084a('0x9')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1b')]=_0x4c4c90[_0x084a('0x1b')];agents[_0x4c4c90['destuniqueid']][_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x32');_[_0x084a('0x26')](agents,function(_0xa7b652,_0x183e10){if(_0xa7b652[_0x084a('0x14')]!=_0x4c4c90['destuniqueid']&&_0xa7b652[_0x084a('0x13')]==_0x4c4c90[_0x084a('0x13')]){_0xa7b652[_0x084a('0x2c')]=0x0;_0xa7b652[_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];_0xa7b652[_0x084a('0x1f')]=!![];_0xa7b652['agentringnoanswerAt']=utils[_0x084a('0x19')]();_0xa7b652[_0x084a('0xa')]='answered_elsewhere';_0xa7b652[_0x084a('0x23')]=_0x084a('0x33');_0xa7b652[_0x084a('0x34')]=_0x4c4c90['destuniqueid'];_0xa7b652[_0x084a('0x35')]=_0x4c4c90[_0x084a('0x1d')];writeDB(_0xa7b652);}});}}catch(_0x4fe9c2){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentconnect]',_0x4c4c90['uniqueid']),_0x4fe9c2);}};exports[_0x084a('0x36')]=function(_0x17a8d4){try{if(!_[_0x084a('0x20')](agents[_0x17a8d4[_0x084a('0x14')]])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x37'),_0x17a8d4[_0x084a('0x13')]),_0x17a8d4);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x38'),_0x17a8d4['uniqueid'],agents[_0x17a8d4['destuniqueid']][_0x084a('0x1d')],_0x17a8d4[_0x084a('0x14')]));agents[_0x17a8d4[_0x084a('0x14')]]['agentcomplete']=!![];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x2c')]=utils['diffTime'](agents[_0x17a8d4[_0x084a('0x14')]]['agentcompleteAt'],agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x30')]);agents[_0x17a8d4[_0x084a('0x14')]]['reason']=_0x17a8d4['reason'];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0xa')]='complete';writeDB(agents[_0x17a8d4[_0x084a('0x14')]]);}}catch(_0x2c2c2e){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentcomplete]',_0x17a8d4[_0x084a('0x13')]),_0x2c2c2e);}};exports[_0x084a('0x3a')]=function(_0x31677b){try{if(!_[_0x084a('0x20')](agents[_0x31677b['transfereruniqueid']])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x31677b);utils['info'](util['format'](_0x084a('0x3c'),_0x31677b[_0x084a('0x13')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x1d')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')]));agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3e')]=!![];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3f')]=_0x084a('0x40');agents[_0x31677b[_0x084a('0x3d')]]['transferexten']=_0x31677b[_0x084a('0x41')];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x42')]=agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')];}}catch(_0x1c972c){utils[_0x084a('0x1e')](util['format'](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x1c972c);}};exports[_0x084a('0x43')]=function(_0x54aa6c){try{utils['debug'](util[_0x084a('0x4')]('[%s][agents][attendedtransfer]',_0x54aa6c[_0x084a('0x44')]),_0x54aa6c);if(_0x54aa6c[_0x084a('0x44')]==_0x54aa6c['origtransfererlinkedid']){if(!_[_0x084a('0x20')](agents[_0x54aa6c['secondtransfereruniqueid']])){utils['info'](util[_0x084a('0x4')](_0x084a('0x45'),_0x54aa6c[_0x084a('0x44')],agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x1d')]));agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x3e')]=!![];agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c[_0x084a('0x46')]]['transferexten']=_0x54aa6c[_0x084a('0x48')];agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x44')];}if(_0x54aa6c['transfereeuniqueid']&&agents[_0x54aa6c[_0x084a('0x49')]]){agents[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x1;transfers[_0x54aa6c[_0x084a('0x49')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfereeuniqueid']]);transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x46')]]['calleridnum'];transfers[_0x54aa6c[_0x084a('0x49')]]['calleridname']=agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x4c')];transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x18')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x2;}}else if(_0x54aa6c[_0x084a('0x46')]==_0x54aa6c[_0x084a('0x4d')]){if(!_['isNil'](agents[_0x54aa6c[_0x084a('0x44')]])){utils[_0x084a('0x3')](util['format'](_0x084a('0x45'),_0x54aa6c['origtransfereruniqueid'],agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x1d')]));agents[_0x54aa6c['origtransfereruniqueid']]['transfer']=!![];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x4e')]=_0x54aa6c[_0x084a('0x4f')];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x46')];}if(_0x54aa6c[_0x084a('0x50')]&&agents[_0x54aa6c[_0x084a('0x50')]]){agents[_0x54aa6c['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x54aa6c[_0x084a('0x50')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfertargetuniqueid']]);transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x8')];transfers[_0x54aa6c['transfertargetuniqueid']][_0x084a('0x4c')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x4c')];transfers[_0x54aa6c['transfertargetuniqueid']]['agentcalledAt']=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c[_0x084a('0x50')]]['agententerreason']=0x2;}}}catch(_0x22efb6){utils['error'](util['format'](_0x084a('0x51'),_0x54aa6c[_0x084a('0x44')]),_0x22efb6);}};exports[_0x084a('0x52')]=function(_0x4a2745){try{utils[_0x084a('0x16')](util['format'](_0x084a('0x53'),_0x4a2745[_0x084a('0x13')]),_0x4a2745);if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]===_0x084a('0x24')){if(_0x4a2745['cause']==='21'){agents[_0x4a2745['uniqueid']][_0x084a('0x23')]=_0x084a('0x54');agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]=_0x084a('0x54');}utils[_0x084a('0x3')](util['format'](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]]['lastevent']));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);var _0x38b5b6=unanswered[_0x084a('0x56')](_0x4a2745[_0x084a('0x13')]);if(_0x38b5b6>-0x1){unanswered[_0x084a('0x57')](_0x38b5b6,0x1);}}if(transfers[_0x4a2745[_0x084a('0x13')]]){transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils['now']();transfers[_0x4a2745['uniqueid']]['talktime']=utils[_0x084a('0x58')](transfers[_0x4a2745[_0x084a('0x13')]]['agentcompleteAt'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x30')]);transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]='agent';transfers[_0x4a2745['uniqueid']][_0x084a('0xa')]=_0x084a('0x59');utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],transfers[_0x4a2745[_0x084a('0x13')]]['membername'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(transfers[_0x4a2745[_0x084a('0x13')]],!![]);}if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']){agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x2c')]=utils[_0x084a('0x58')](agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')],agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']);agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]=agents[_0x4a2745['uniqueid']][_0x084a('0x3e')]?'transfer':'agent';agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]='complete';utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);}}catch(_0x7c85e3){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x53'),_0x4a2745['uniqueid']),_0x7c85e3);}}; \ No newline at end of file +var _0x7af2=['agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','agententerreason','[%s][agents][attendedtransfer]','cause','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','type','agentcomplete','agentacw','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af2,0x119));var _0x27af=function(_0x336660,_0x3dfc4c){_0x336660=_0x336660-0x0;var _0x535345=_0x7af2[_0x336660];return _0x535345;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var utils=require(_0x27af('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x908794,_0x316e13){utils['info'](util[_0x27af('0x2')](_0x27af('0x3'),_0x908794[_0x27af('0x4')],_0x908794[_0x27af('0x5')],_0x908794[_0x27af('0x6')],_0x908794[_0x27af('0x7')],_0x908794[_0x27af('0x8')],_0x908794[_0x27af('0x9')],_0x908794[_0x27af('0xa')],_0x908794['lastevent']));if(_0x908794[_0x27af('0x6')]){utils[_0x27af('0xb')](_0x908794[_0x27af('0x6')])['then'](function(_0x369a20){if(_0x369a20){_0x908794[_0x27af('0xc')]=_0x369a20[_0x27af('0xc')];_0x908794['agentacw']=_0x908794[_0x27af('0xd')]?_0x369a20['acw']:![];_0x908794['acwtime']=_0x908794[_0x27af('0xe')]?_0x369a20['acwTimeout']:0x0;}utils['request'](_0x27af('0xf'),_0x908794);});}else{utils['request'](_0x27af('0xf'),_0x908794);}if(_0x316e13){delete transfers[_0x908794['uniqueid']];}else{delete agents[_0x908794[_0x27af('0x10')]];}}exports[_0x27af('0x11')]=function(_0x1fd964){try{utils[_0x27af('0x12')](util[_0x27af('0x2')](_0x27af('0x13'),_0x1fd964[_0x27af('0x4')]),_0x1fd964);agents[_0x1fd964[_0x27af('0x10')]]=_0x1fd964;agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x14')]=utils[_0x27af('0x15')]();agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x17');agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0xa')]=null;agents[_0x1fd964[_0x27af('0x10')]][_0x27af('0x18')]=null;utils['info'](util[_0x27af('0x2')](_0x27af('0x19'),_0x1fd964['uniqueid'],agents[_0x1fd964['destuniqueid']][_0x27af('0x7')],_0x1fd964[_0x27af('0x10')]));}catch(_0x351587){utils[_0x27af('0x1a')](util[_0x27af('0x2')]('[%s][agents][agentcalled]',_0x1fd964[_0x27af('0x4')]),_0x351587);}};exports[_0x27af('0x1b')]=function(_0xcb4b90){try{if(!_['isNil'](agents[_0xcb4b90[_0x27af('0x10')]])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][agentringnoanswer]',_0xcb4b90[_0x27af('0x4')]),_0xcb4b90);utils[_0x27af('0x1c')](util[_0x27af('0x2')](_0x27af('0x1d'),_0xcb4b90[_0x27af('0x4')],agents[_0xcb4b90[_0x27af('0x10')]][_0x27af('0x7')],_0xcb4b90[_0x27af('0x10')]));agents[_0xcb4b90[_0x27af('0x10')]]['agentringnoanswer']=!![];agents[_0xcb4b90['destuniqueid']]['agentringnoanswerAt']=utils[_0x27af('0x15')]();agents[_0xcb4b90['destuniqueid']][_0x27af('0x16')]=_0x27af('0x1e');agents[_0xcb4b90['destuniqueid']][_0x27af('0x1f')]=_0x27af('0x1e');agents[_0xcb4b90[_0x27af('0x10')]][_0x27af('0x20')]=_0xcb4b90[_0x27af('0x21')]?parseInt(_0xcb4b90[_0x27af('0x21')])/0x3e8:0x0;agents[_0xcb4b90[_0x27af('0x10')]]['talktime']=0x0;unanswered[_0x27af('0x22')](_0xcb4b90[_0x27af('0x10')]);}}catch(_0xadd38e){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x23'),_0xcb4b90[_0x27af('0x4')]),_0xadd38e);}};exports[_0x27af('0x24')]=function(_0x4406e2){try{_[_0x27af('0x25')](agents,function(_0x205e41,_0x4f4955){if(_0x205e41[_0x27af('0x4')]==_0x4406e2[_0x27af('0x4')]&&!_[_0x27af('0x26')](unanswered,_0x205e41[_0x27af('0x10')])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][queuecallerabandon]',_0x4406e2['uniqueid']),_0x4406e2);utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4406e2[_0x27af('0x4')],_0x205e41[_0x27af('0x7')],_0x205e41[_0x27af('0x10')]));_0x205e41[_0x27af('0x1b')]=!![];_0x205e41[_0x27af('0x27')]=utils[_0x27af('0x15')]();_0x205e41[_0x27af('0x16')]=_0x27af('0x28');_0x205e41[_0x27af('0x1f')]=_0x27af('0x28');_0x205e41[_0x27af('0x20')]=_0x4406e2['holdtime'];_0x205e41['talktime']=0x0;writeDB(_0x205e41);}});}catch(_0x1de1d0){utils[_0x27af('0x1a')](util['format'](_0x27af('0x29'),_0x4406e2[_0x27af('0x4')]),_0x1de1d0);}};exports['agentconnect']=function(_0x83aa0b){try{if(agents[_0x83aa0b[_0x27af('0x10')]]){utils[_0x27af('0x12')](util[_0x27af('0x2')](_0x27af('0x2a'),_0x83aa0b['uniqueid']),_0x83aa0b);utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x83aa0b['uniqueid'],agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x7')],_0x83aa0b[_0x27af('0x10')]));agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x2b')]=utils[_0x27af('0x15')]();agents[_0x83aa0b['destuniqueid']][_0x27af('0xa')]=_0x83aa0b['connectedlinenum'];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x18')]=_0x83aa0b[_0x27af('0x18')];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x20')]=_0x83aa0b['ringtime'];agents[_0x83aa0b[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x2c');_[_0x27af('0x25')](agents,function(_0x10c1be,_0x32b558){if(_0x10c1be[_0x27af('0x10')]!=_0x83aa0b[_0x27af('0x10')]&&_0x10c1be[_0x27af('0x4')]==_0x83aa0b[_0x27af('0x4')]){_0x10c1be[_0x27af('0x2d')]=0x0;_0x10c1be[_0x27af('0x20')]=_0x83aa0b[_0x27af('0x21')];_0x10c1be[_0x27af('0x1b')]=!![];_0x10c1be['agentringnoanswerAt']=utils[_0x27af('0x15')]();_0x10c1be[_0x27af('0x16')]=_0x27af('0x2e');_0x10c1be[_0x27af('0x1f')]='answered_elsewhere';_0x10c1be[_0x27af('0x2f')]=_0x83aa0b['destuniqueid'];_0x10c1be['answeredelsewheremembername']=_0x83aa0b[_0x27af('0x7')];writeDB(_0x10c1be);}});}}catch(_0x3c9c81){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x2a'),_0x83aa0b[_0x27af('0x4')]),_0x3c9c81);}};exports[_0x27af('0xd')]=function(_0x26eb28){try{if(!_[_0x27af('0x30')](agents[_0x26eb28[_0x27af('0x10')]])){utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][agentcomplete]',_0x26eb28[_0x27af('0x4')]),_0x26eb28);utils[_0x27af('0x1c')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x26eb28[_0x27af('0x4')],agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x7')],_0x26eb28[_0x27af('0x10')]));agents[_0x26eb28[_0x27af('0x10')]]['agentcomplete']=!![];agents[_0x26eb28[_0x27af('0x10')]]['agentcompleteAt']=utils[_0x27af('0x15')]();agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x2d')]=utils[_0x27af('0x31')](agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x32')],agents[_0x26eb28[_0x27af('0x10')]]['agentconnectAt']);agents[_0x26eb28['destuniqueid']][_0x27af('0x1f')]=_0x26eb28['reason'];agents[_0x26eb28[_0x27af('0x10')]][_0x27af('0x16')]=_0x27af('0x33');writeDB(agents[_0x26eb28[_0x27af('0x10')]]);}}catch(_0x37f2fa){utils[_0x27af('0x1a')](util[_0x27af('0x2')]('[%s][agents][agentcomplete]',_0x26eb28[_0x27af('0x4')]),_0x37f2fa);}};exports[_0x27af('0x34')]=function(_0x20e180){try{if(!_[_0x27af('0x30')](agents[_0x20e180[_0x27af('0x35')]])){utils['debug'](util[_0x27af('0x2')](_0x27af('0x36'),_0x20e180[_0x27af('0x4')]),_0x20e180);utils['info'](util['format'](_0x27af('0x37'),_0x20e180[_0x27af('0x4')],agents[_0x20e180[_0x27af('0x35')]]['membername'],agents[_0x20e180['transfereruniqueid']][_0x27af('0x4')]));agents[_0x20e180['transfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x39')]=_0x27af('0x3a');agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x3b')]=_0x20e180[_0x27af('0x3c')];agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x3d')]=agents[_0x20e180[_0x27af('0x35')]][_0x27af('0x4')];}}catch(_0x5c02c1){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x36'),_0x20e180[_0x27af('0x4')]),_0x5c02c1);}};exports[_0x27af('0x3e')]=function(_0x2ad074){try{utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]',_0x2ad074[_0x27af('0x3f')]),_0x2ad074);if(_0x2ad074['origtransfereruniqueid']==_0x2ad074[_0x27af('0x40')]){if(!_[_0x27af('0x30')](agents[_0x2ad074[_0x27af('0x41')]])){utils['info'](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2ad074[_0x27af('0x3f')],agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x7')]));agents[_0x2ad074['secondtransfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x2ad074['secondtransfereruniqueid']][_0x27af('0x39')]='ATTENDED';agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x3b')]=_0x2ad074[_0x27af('0x42')];agents[_0x2ad074['secondtransfereruniqueid']]['transferuniqueid']=_0x2ad074[_0x27af('0x3f')];}if(_0x2ad074[_0x27af('0x43')]&&agents[_0x2ad074[_0x27af('0x43')]]){agents[_0x2ad074[_0x27af('0x43')]]['agententerreason']=0x1;transfers[_0x2ad074[_0x27af('0x43')]]=_[_0x27af('0x44')](agents[_0x2ad074[_0x27af('0x43')]]);transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x9')]=agents[_0x2ad074[_0x27af('0x41')]]['calleridnum'];transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x45')]=agents[_0x2ad074[_0x27af('0x41')]][_0x27af('0x45')];transfers[_0x2ad074['transfereeuniqueid']][_0x27af('0x14')]=utils['now']();transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x2b')]=utils['now']();transfers[_0x2ad074[_0x27af('0x43')]][_0x27af('0x20')]=0x0;transfers[_0x2ad074['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x2ad074[_0x27af('0x41')]==_0x2ad074[_0x27af('0x46')]){if(!_[_0x27af('0x30')](agents[_0x2ad074['origtransfereruniqueid']])){utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2ad074[_0x27af('0x3f')],agents[_0x2ad074[_0x27af('0x3f')]]['membername']));agents[_0x2ad074['origtransfereruniqueid']][_0x27af('0x38')]=!![];agents[_0x2ad074[_0x27af('0x3f')]]['transfertype']='ATTENDED';agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x3b')]=_0x2ad074[_0x27af('0x47')];agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x3d')]=_0x2ad074[_0x27af('0x41')];}if(_0x2ad074[_0x27af('0x48')]&&agents[_0x2ad074['transfertargetuniqueid']]){agents[_0x2ad074['transfertargetuniqueid']][_0x27af('0x49')]=0x1;transfers[_0x2ad074[_0x27af('0x48')]]=_[_0x27af('0x44')](agents[_0x2ad074[_0x27af('0x48')]]);transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x9')]=agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x9')];transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x45')]=agents[_0x2ad074[_0x27af('0x3f')]][_0x27af('0x45')];transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x14')]=utils[_0x27af('0x15')]();transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x2b')]=utils['now']();transfers[_0x2ad074[_0x27af('0x48')]][_0x27af('0x20')]=0x0;transfers[_0x2ad074['transfertargetuniqueid']][_0x27af('0x49')]=0x2;}}}catch(_0x4b0a4){utils[_0x27af('0x1a')](util[_0x27af('0x2')](_0x27af('0x4a'),_0x2ad074[_0x27af('0x3f')]),_0x4b0a4);}};exports['hangup']=function(_0x132ed4){try{utils[_0x27af('0x12')](util[_0x27af('0x2')]('[%s][agents][hangup]',_0x132ed4['uniqueid']),_0x132ed4);if(agents[_0x132ed4[_0x27af('0x4')]]&&agents[_0x132ed4['uniqueid']][_0x27af('0x1f')]===_0x27af('0x1e')){if(_0x132ed4[_0x27af('0x4b')]==='21'){agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')]='rejected';agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]='rejected';}utils[_0x27af('0x1c')](util[_0x27af('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x132ed4['uniqueid'],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x7')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(agents[_0x132ed4[_0x27af('0x4')]]);var _0x5db94f=unanswered[_0x27af('0x4c')](_0x132ed4[_0x27af('0x4')]);if(_0x5db94f>-0x1){unanswered[_0x27af('0x4d')](_0x5db94f,0x1);}}if(transfers[_0x132ed4[_0x27af('0x4')]]){transfers[_0x132ed4['uniqueid']]['agentcomplete']=!![];transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x32')]=utils[_0x27af('0x15')]();transfers[_0x132ed4[_0x27af('0x4')]]['talktime']=utils['diffTime'](transfers[_0x132ed4['uniqueid']][_0x27af('0x32')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x2b')]);transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')]=_0x27af('0x4e');transfers[_0x132ed4['uniqueid']]['lastevent']=_0x27af('0x33');utils[_0x27af('0x1c')](util[_0x27af('0x2')](_0x27af('0x4f'),_0x132ed4['uniqueid'],transfers[_0x132ed4['uniqueid']][_0x27af('0x7')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x1f')],transfers[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(transfers[_0x132ed4[_0x27af('0x4')]],!![]);}if(agents[_0x132ed4[_0x27af('0x4')]]&&agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x2b')]){agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0xd')]=!![];agents[_0x132ed4['uniqueid']][_0x27af('0x32')]=utils[_0x27af('0x15')]();agents[_0x132ed4[_0x27af('0x4')]]['talktime']=utils[_0x27af('0x31')](agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x32')],agents[_0x132ed4['uniqueid']][_0x27af('0x2b')]);agents[_0x132ed4['uniqueid']][_0x27af('0x1f')]=agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x38')]?_0x27af('0x38'):_0x27af('0x4e');agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]=_0x27af('0x33');utils['info'](util[_0x27af('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x132ed4[_0x27af('0x4')],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x7')],agents[_0x132ed4['uniqueid']]['reason'],agents[_0x132ed4[_0x27af('0x4')]][_0x27af('0x16')]));writeDB(agents[_0x132ed4[_0x27af('0x4')]]);}}catch(_0x48c7eb){utils['error'](util['format'](_0x27af('0x50'),_0x132ed4[_0x27af('0x4')]),_0x48c7eb);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index e02c9b9..c945ebc 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 _0x3a35=['split','substring','lastIndexOf','includes','execif','set','gotoif','[%s][calls][newexten]','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','format','[%s][calls][newchannel]','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','error','hangup','[%s][calls][hangup]','callerid','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr'];(function(_0x3e9041,_0x58ab0e){var _0xf111fe=function(_0x2e9293){while(--_0x2e9293){_0x3e9041['push'](_0x3e9041['shift']());}};_0xf111fe(++_0x58ab0e);}(_0x3a35,0x76));var _0x53a3=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x3a35[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x53a3('0x0'));var util=require('util');var utils=require(_0x53a3('0x1'));var transfers=require(_0x53a3('0x2'));var dispositions=[_0x53a3('0x3'),_0x53a3('0x4'),'FAILED',_0x53a3('0x3'),'NO\x20ANSWER',_0x53a3('0x3'),'ANSWERED',_0x53a3('0x5'),_0x53a3('0x4'),_0x53a3('0x4'),_0x53a3('0x4')];var channels={};function writeDB(_0x41eafd){var _0x14f61c;if(transfers[_0x53a3('0x6')][_0x41eafd[_0x53a3('0x7')]]){_0x14f61c=_0x41eafd['uniqueid'];_0x41eafd[_0x53a3('0x7')]=transfers['blinds'][_0x41eafd[_0x53a3('0x7')]][_0x53a3('0x8')];}utils['info'](util['format'](_0x53a3('0x9'),_0x41eafd[_0x53a3('0x7')],_0x41eafd[_0x53a3('0xa')],_0x41eafd['queue'],_0x41eafd[_0x53a3('0xb')],_0x41eafd[_0x53a3('0xc')],_0x41eafd['calleridnum'],_0x41eafd[_0x53a3('0xd')],_0x41eafd['lastevent']));if(_0x41eafd[_0x53a3('0xe')]){utils[_0x53a3('0xf')](_0x41eafd[_0x53a3('0xe')])[_0x53a3('0x10')](function(_0x4c90b0){if(_0x4c90b0){_0x41eafd[_0x53a3('0x11')]=_0x4c90b0['id'];}utils['request']('CreateVoiceCallReport',_0x41eafd);});}else{utils[_0x53a3('0x12')](_0x53a3('0x13'),_0x41eafd);}if(channels[_0x41eafd[_0x53a3('0x7')]]){delete channels[_0x41eafd[_0x53a3('0x7')]];}else if(_0x14f61c&&channels[_0x14f61c]){delete transfers[_0x53a3('0x6')][_0x14f61c];delete channels[_0x14f61c];}}exports['newchannel']=function(_0x245132){try{utils[_0x53a3('0x14')](util[_0x53a3('0x15')](_0x53a3('0x16'),_0x245132['uniqueid']),_0x245132);if(_0x245132[_0x53a3('0x7')]==_0x245132[_0x53a3('0x17')]&&_0x245132['channel']!='OutgoingSpoolFailed'){utils[_0x53a3('0x18')](util['format'](_0x53a3('0x19'),_0x245132['uniqueid'],_0x245132[_0x53a3('0x1a')],_0x245132[_0x53a3('0x1b')]));channels[_0x245132['uniqueid']]={'uniqueid':_0x245132[_0x53a3('0x7')],'accountcode':_0x245132[_0x53a3('0xe')],'source':_0x245132['calleridnum'],'destination':_0x245132['exten'],'destinationcontext':_0x245132['context'],'channel':_0x245132[_0x53a3('0xa')],'starttime':utils[_0x53a3('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x53a3('0x3'),'amaflags':_0x53a3('0x1d')};}}catch(_0x51647c){utils['error'](util[_0x53a3('0x15')](_0x53a3('0x16'),_0x245132[_0x53a3('0x7')]),_0x51647c);}};exports[_0x53a3('0x1e')]=function(_0x179fc7){try{utils[_0x53a3('0x14')](util[_0x53a3('0x15')](_0x53a3('0x1f'),_0x179fc7[_0x53a3('0x7')]),_0x179fc7);if(!_[_0x53a3('0x20')](channels[_0x179fc7[_0x53a3('0x7')]])&&_0x179fc7[_0x53a3('0x21')]==0x6){utils[_0x53a3('0x18')](util[_0x53a3('0x15')](_0x53a3('0x22'),_0x179fc7[_0x53a3('0x7')],_0x179fc7[_0x53a3('0x1a')],_0x179fc7[_0x53a3('0xa')]));if(_[_0x53a3('0x20')](channels[_0x179fc7['uniqueid']][_0x53a3('0x23')])){channels[_0x179fc7[_0x53a3('0x7')]]['systemanswertime']=utils[_0x53a3('0x1c')]();}}else if(!_[_0x53a3('0x20')](channels[_0x179fc7['linkedid']])&&_0x179fc7[_0x53a3('0x21')]==0x6&&_0x179fc7[_0x53a3('0x1a')]!='transfer'){utils[_0x53a3('0x18')](util[_0x53a3('0x15')](_0x53a3('0x24'),_0x179fc7['uniqueid'],_0x179fc7['linkedid'],_0x179fc7[_0x53a3('0x1a')],_0x179fc7[_0x53a3('0xa')]));channels[_0x179fc7['linkedid']]['accountcode']=_0x179fc7['accountcode'];channels[_0x179fc7[_0x53a3('0x17')]][_0x53a3('0x25')]=_0x179fc7[_0x53a3('0xa')];if(_[_0x53a3('0x20')](channels[_0x179fc7['linkedid']][_0x53a3('0x26')])){channels[_0x179fc7['linkedid']][_0x53a3('0x26')]=utils['now']();}channels[_0x179fc7[_0x53a3('0x17')]][_0x53a3('0x27')]=dispositions[_['toNumber'](_0x179fc7[_0x53a3('0x21')])]||'ANSWERED';}}catch(_0x3af145){utils[_0x53a3('0x28')](util[_0x53a3('0x15')](_0x53a3('0x1f'),_0x179fc7[_0x53a3('0x7')]),_0x3af145);}};exports[_0x53a3('0x29')]=function(_0x351022){try{if(!_[_0x53a3('0x20')](channels[_0x351022[_0x53a3('0x7')]])){utils[_0x53a3('0x14')](util[_0x53a3('0x15')](_0x53a3('0x2a'),_0x351022[_0x53a3('0x7')]),_0x351022);if(_[_0x53a3('0x20')](channels[_0x351022[_0x53a3('0x7')]]['callerid'])){channels[_0x351022['uniqueid']][_0x53a3('0x2b')]=_0x351022['calleridname']+'\x20<'+_0x351022[_0x53a3('0x2c')]+'>';}utils[_0x53a3('0x18')](util[_0x53a3('0x15')](_0x53a3('0x2d'),_0x351022[_0x53a3('0x7')],channels[_0x351022[_0x53a3('0x7')]][_0x53a3('0x2b')],_0x351022[_0x53a3('0x2e')]));channels[_0x351022[_0x53a3('0x7')]][_0x53a3('0x2f')]=utils['now']();channels[_0x351022['uniqueid']][_0x53a3('0x30')]=utils[_0x53a3('0x31')](channels[_0x351022['uniqueid']][_0x53a3('0x2f')],channels[_0x351022['uniqueid']][_0x53a3('0x32')]);channels[_0x351022[_0x53a3('0x7')]][_0x53a3('0x33')]=channels[_0x351022[_0x53a3('0x7')]][_0x53a3('0x26')]?utils[_0x53a3('0x31')](channels[_0x351022[_0x53a3('0x7')]][_0x53a3('0x2f')],channels[_0x351022[_0x53a3('0x7')]][_0x53a3('0x26')]):0x0;writeDB(channels[_0x351022[_0x53a3('0x7')]]);}}catch(_0x200a03){utils[_0x53a3('0x28')](util[_0x53a3('0x15')]('[%s][calls][hangup]',_0x351022[_0x53a3('0x7')]),_0x200a03);}};exports[_0x53a3('0x34')]=function(_0x3c09f7){try{if(!_[_0x53a3('0x20')](channels[_0x3c09f7[_0x53a3('0x35')]])){utils[_0x53a3('0x14')](util[_0x53a3('0x15')](_0x53a3('0x36'),_0x3c09f7['origtransfereruniqueid']),_0x3c09f7);if(channels[_0x3c09f7[_0x53a3('0x35')]][_0x53a3('0xa')]==_0x3c09f7[_0x53a3('0x37')]){utils[_0x53a3('0x18')](util[_0x53a3('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3c09f7[_0x53a3('0x38')],_0x3c09f7[_0x53a3('0x35')],_0x3c09f7[_0x53a3('0x39')]));channels[_0x3c09f7[_0x53a3('0x35')]]['destinationchannel']=_0x3c09f7[_0x53a3('0x39')];channels[_0x3c09f7[_0x53a3('0x35')]][_0x53a3('0x3a')]='_attended';}else if(channels[_0x3c09f7['localtwolinkedid']][_0x53a3('0xa')]=_0x3c09f7[_0x53a3('0x3b')]){utils['info'](util['format'](_0x53a3('0x3c'),_0x3c09f7[_0x53a3('0x38')],_0x3c09f7['localtwolinkedid'],_0x3c09f7[_0x53a3('0x3d')]));channels[_0x3c09f7[_0x53a3('0x35')]][_0x53a3('0x25')]=_0x3c09f7[_0x53a3('0x3d')];channels[_0x3c09f7[_0x53a3('0x35')]]['userfield']=_0x53a3('0x3e');}}}catch(_0x88d0bf){utils['error'](util[_0x53a3('0x15')]('[%s][calls][attendedtransfer]',_0x3c09f7[_0x53a3('0x38')]),_0x88d0bf);}};exports[_0x53a3('0x3f')]=function(_0x270cea){try{if(!_[_0x53a3('0x20')](channels[_0x270cea[_0x53a3('0x7')]])){utils[_0x53a3('0x14')](util[_0x53a3('0x15')](_0x53a3('0x40'),_0x270cea[_0x53a3('0x7')]),_0x270cea);channels[_0x270cea[_0x53a3('0x7')]][_0x53a3('0x41')]=utils[_0x53a3('0x1c')]();utils[_0x53a3('0x18')](util[_0x53a3('0x15')](_0x53a3('0x42'),_0x270cea['uniqueid'],channels[_0x270cea['uniqueid']][_0x53a3('0x41')]));}}catch(_0x2bda8e){utils['error'](util[_0x53a3('0x15')]('[%s][calls][musiconholdstart]',_0x270cea[_0x53a3('0x7')]),_0x2bda8e);}};exports['musiconholdstop']=function(_0x14911b){try{if(!_[_0x53a3('0x20')](channels[_0x14911b[_0x53a3('0x7')]])){utils[_0x53a3('0x14')](util['format']('[%s][calls][musiconholdstop]',_0x14911b['uniqueid']),_0x14911b);if(!_[_0x53a3('0x20')](channels[_0x14911b[_0x53a3('0x7')]][_0x53a3('0x41')])){channels[_0x14911b[_0x53a3('0x7')]][_0x53a3('0x43')]+=utils[_0x53a3('0x31')](utils['now'](),channels[_0x14911b[_0x53a3('0x7')]][_0x53a3('0x41')]);utils[_0x53a3('0x18')](util[_0x53a3('0x15')](_0x53a3('0x44'),_0x14911b[_0x53a3('0x7')],channels[_0x14911b[_0x53a3('0x7')]][_0x53a3('0x43')]));delete channels[_0x14911b['uniqueid']][_0x53a3('0x41')];}}}catch(_0xa7a6ca){utils['error'](util[_0x53a3('0x15')](_0x53a3('0x45'),_0x14911b[_0x53a3('0x7')]),_0xa7a6ca);}};exports[_0x53a3('0x46')]=function(_0x575aca){try{if(!_[_0x53a3('0x20')](channels[_0x575aca[_0x53a3('0x7')]])){utils['debug'](util[_0x53a3('0x15')](_0x53a3('0x47'),_0x575aca[_0x53a3('0x7')]),_0x575aca);if(!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')]['xmd-originatecalleridnum'])){utils[_0x53a3('0x18')](util[_0x53a3('0x15')](_0x53a3('0x49'),_0x575aca[_0x53a3('0x7')],_0x575aca[_0x53a3('0x4a')]));channels[_0x575aca['uniqueid']][_0x53a3('0x4b')]=_0x575aca[_0x53a3('0x4a')];}if(!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')]['xmd-phone'])){utils['info'](util[_0x53a3('0x15')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x575aca['uniqueid'],_0x575aca[_0x53a3('0x4a')]));channels[_0x575aca['uniqueid']]['destination']=_0x575aca['value'];channels[_0x575aca[_0x53a3('0x7')]]['callerid']='\x22'+_0x575aca[_0x53a3('0x4a')]+'\x22\x20<'+_0x575aca[_0x53a3('0x4a')]+'>';}if(!_['isNil'](_0x575aca[_0x53a3('0x48')][_0x53a3('0x4c')])||!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')]['xmd-callerid'])){utils[_0x53a3('0x18')](util['format'](_0x53a3('0x4d'),_0x575aca['uniqueid'],!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')][_0x53a3('0x4c')])?_0x53a3('0x4c'):_0x53a3('0x4e'),_0x575aca[_0x53a3('0x4a')]));channels[_0x575aca['uniqueid']]['callerid']=_0x575aca[_0x53a3('0x4a')];}if(!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')][_0x53a3('0x4f')])||!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')][_0x53a3('0x50')])){utils[_0x53a3('0x18')](util['format'](_0x53a3('0x4d'),_0x575aca[_0x53a3('0x7')],!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')][_0x53a3('0x4f')])?_0x53a3('0x4f'):_0x53a3('0x50'),_0x575aca[_0x53a3('0x4a')]));channels[_0x575aca[_0x53a3('0x7')]][_0x53a3('0x51')]=_0x53a3('0x52');channels[_0x575aca['uniqueid']][_0x53a3('0x53')]=_0x575aca['value'];channels[_0x575aca[_0x53a3('0x7')]][_0x53a3('0x54')]=!![];}if(!_['isNil'](_0x575aca[_0x53a3('0x48')][_0x53a3('0x55')])){utils[_0x53a3('0x18')](util[_0x53a3('0x15')](_0x53a3('0x56'),_0x575aca[_0x53a3('0x7')],_0x575aca[_0x53a3('0x4a')]));channels[_0x575aca[_0x53a3('0x7')]][_0x53a3('0x57')]=_0x575aca[_0x53a3('0x4a')];}if(!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')][_0x53a3('0x58')])){utils['info'](util['format'](_0x53a3('0x59'),_0x575aca['uniqueid'],_0x575aca[_0x53a3('0x4a')]));channels[_0x575aca[_0x53a3('0x7')]][_0x53a3('0x5a')]=_0x575aca[_0x53a3('0x4a')];}if(!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')][_0x53a3('0x5b')])){utils[_0x53a3('0x18')](util[_0x53a3('0x15')](_0x53a3('0x5c'),_0x575aca[_0x53a3('0x7')],_0x575aca['value']));channels[_0x575aca[_0x53a3('0x7')]]['routeid']=_0x575aca['value'];}if(!_[_0x53a3('0x20')](_0x575aca[_0x53a3('0x48')][_0x53a3('0x5d')])){utils[_0x53a3('0x18')](util['format'](_0x53a3('0x5e'),_0x575aca[_0x53a3('0x7')],_0x575aca[_0x53a3('0x4a')]));channels[_0x575aca[_0x53a3('0x7')]][_0x53a3('0x5d')]=_0x575aca[_0x53a3('0x4a')];}}}catch(_0x18123b){utils['error'](util[_0x53a3('0x15')](_0x53a3('0x47'),_0x575aca[_0x53a3('0x7')]),_0x18123b);}};exports[_0x53a3('0x5f')]=function(_0x541c61){try{if(!_[_0x53a3('0x20')](channels[_0x541c61[_0x53a3('0x7')]])){utils['debug'](util[_0x53a3('0x15')]('[%s][calls][newexten]',_0x541c61['uniqueid']),_0x541c61);utils[_0x53a3('0x18')](util[_0x53a3('0x15')](_0x53a3('0x60'),_0x541c61[_0x53a3('0x7')],_0x541c61[_0x53a3('0x61')],_0x541c61['appdata']));if(_0x541c61[_0x53a3('0x61')][_0x53a3('0x62')]()=='set'&&_[_0x53a3('0x63')](_0x541c61[_0x53a3('0x64')][_0x53a3('0x62')](),_0x53a3('0x65'))){var _0xa2a8fa=_0x541c61[_0x53a3('0x64')][_0x53a3('0x66')]('=');var _0x928d3e=_0xa2a8fa[0x0][_0x53a3('0x67')](_0xa2a8fa[0x0][_0x53a3('0x68')]('(')+0x1,_0xa2a8fa[0x0][_0x53a3('0x68')](')'));var _0x3be489=_0xa2a8fa[0x1];channels[_0x541c61[_0x53a3('0x7')]][_0x928d3e]=_0x3be489;}if(!_[_0x53a3('0x69')](['hangup','noop',_0x53a3('0x6a'),_0x53a3('0x6b'),_0x53a3('0x6c')],_0x541c61[_0x53a3('0x61')]['toLowerCase']())){channels[_0x541c61['uniqueid']][_0x53a3('0x51')]=_0x541c61[_0x53a3('0x61')];channels[_0x541c61[_0x53a3('0x7')]][_0x53a3('0x53')]=_0x541c61[_0x53a3('0x64')];}}}catch(_0x5374cf){utils['error'](util[_0x53a3('0x15')](_0x53a3('0x6d'),_0x541c61['uniqueid']),_0x5374cf);}}; \ No newline at end of file +var _0x3c2e=['membername','connectedlinenum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','error','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable','xmd-phone','destination','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','startsWith','split','substring','includes','hangup','noop','execif','set','NO\x20ANSWER','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'];(function(_0x221657,_0x3cccd8){var _0x123902=function(_0x58a2ac){while(--_0x58a2ac){_0x221657['push'](_0x221657['shift']());}};_0x123902(++_0x3cccd8);}(_0x3c2e,0x186));var _0xe3c2=function(_0x2bbba2,_0x45831a){_0x2bbba2=_0x2bbba2-0x0;var _0x7521b1=_0x3c2e[_0x2bbba2];return _0x7521b1;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0xe3c2('0x0'),'FAILED','FAILED',_0xe3c2('0x0'),_0xe3c2('0x0'),_0xe3c2('0x0'),'ANSWERED','BUSY','FAILED','FAILED',_0xe3c2('0x1')];var channels={};function writeDB(_0x4323ef){var _0x424e8c;if(transfers['blinds'][_0x4323ef['uniqueid']]){_0x424e8c=_0x4323ef['uniqueid'];_0x4323ef['uniqueid']=transfers[_0xe3c2('0x2')][_0x4323ef[_0xe3c2('0x3')]][_0xe3c2('0x4')];}utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')](_0xe3c2('0x7'),_0x4323ef[_0xe3c2('0x3')],_0x4323ef[_0xe3c2('0x8')],_0x4323ef[_0xe3c2('0x9')],_0x4323ef[_0xe3c2('0xa')],_0x4323ef['interface'],_0x4323ef['calleridnum'],_0x4323ef[_0xe3c2('0xb')],_0x4323ef[_0xe3c2('0xc')]));if(_0x4323ef[_0xe3c2('0xd')]){utils['getUserByInternal'](_0x4323ef[_0xe3c2('0xd')])['then'](function(_0x1a00ed){if(_0x1a00ed){_0x4323ef[_0xe3c2('0xe')]=_0x1a00ed['id'];}utils[_0xe3c2('0xf')](_0xe3c2('0x10'),_0x4323ef);});}else{utils['request']('CreateVoiceCallReport',_0x4323ef);}if(channels[_0x4323ef['uniqueid']]){delete channels[_0x4323ef[_0xe3c2('0x3')]];}else if(_0x424e8c&&channels[_0x424e8c]){delete transfers[_0xe3c2('0x2')][_0x424e8c];delete channels[_0x424e8c];}}exports['newchannel']=function(_0x3116a4){try{utils[_0xe3c2('0x11')](util[_0xe3c2('0x6')](_0xe3c2('0x12'),_0x3116a4[_0xe3c2('0x3')]),_0x3116a4);if(_0x3116a4[_0xe3c2('0x3')]==_0x3116a4[_0xe3c2('0x13')]&&_0x3116a4['channel']!=_0xe3c2('0x14')){utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')](_0xe3c2('0x15'),_0x3116a4['uniqueid'],_0x3116a4[_0xe3c2('0x16')],_0x3116a4[_0xe3c2('0x17')]));channels[_0x3116a4['uniqueid']]={'uniqueid':_0x3116a4[_0xe3c2('0x3')],'accountcode':_0x3116a4[_0xe3c2('0xd')],'source':_0x3116a4[_0xe3c2('0x18')],'destination':_0x3116a4[_0xe3c2('0x17')],'destinationcontext':_0x3116a4[_0xe3c2('0x16')],'channel':_0x3116a4[_0xe3c2('0x8')],'starttime':utils[_0xe3c2('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe3c2('0x0'),'amaflags':_0xe3c2('0x1a')};}}catch(_0x37727d){utils['error'](util[_0xe3c2('0x6')](_0xe3c2('0x12'),_0x3116a4[_0xe3c2('0x3')]),_0x37727d);}};exports['newstate']=function(_0x19d169){try{utils[_0xe3c2('0x11')](util['format'](_0xe3c2('0x1b'),_0x19d169[_0xe3c2('0x3')]),_0x19d169);if(!_['isNil'](channels[_0x19d169['uniqueid']])&&_0x19d169[_0xe3c2('0x1c')]==0x6){utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')](_0xe3c2('0x1d'),_0x19d169['uniqueid'],_0x19d169[_0xe3c2('0x16')],_0x19d169['channel']));if(_[_0xe3c2('0x1e')](channels[_0x19d169[_0xe3c2('0x3')]]['systemanswertime'])){channels[_0x19d169[_0xe3c2('0x3')]]['systemanswertime']=utils[_0xe3c2('0x19')]();}}else if(!_['isNil'](channels[_0x19d169[_0xe3c2('0x13')]])&&_0x19d169[_0xe3c2('0x1c')]==0x6&&_0x19d169[_0xe3c2('0x16')]!='transfer'){utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')](_0xe3c2('0x1f'),_0x19d169[_0xe3c2('0x3')],_0x19d169[_0xe3c2('0x13')],_0x19d169['context'],_0x19d169['channel']));channels[_0x19d169['linkedid']][_0xe3c2('0xd')]=_0x19d169[_0xe3c2('0xd')];channels[_0x19d169[_0xe3c2('0x13')]][_0xe3c2('0x20')]=_0x19d169[_0xe3c2('0x8')];if(_[_0xe3c2('0x1e')](channels[_0x19d169[_0xe3c2('0x13')]]['answertime'])){channels[_0x19d169[_0xe3c2('0x13')]][_0xe3c2('0x21')]=utils[_0xe3c2('0x19')]();}channels[_0x19d169[_0xe3c2('0x13')]][_0xe3c2('0x22')]=dispositions[_[_0xe3c2('0x23')](_0x19d169[_0xe3c2('0x1c')])]||_0xe3c2('0x24');}}catch(_0x2d188d){utils[_0xe3c2('0x25')](util[_0xe3c2('0x6')](_0xe3c2('0x1b'),_0x19d169[_0xe3c2('0x3')]),_0x2d188d);}};exports['hangup']=function(_0x3f5354){try{if(!_[_0xe3c2('0x1e')](channels[_0x3f5354[_0xe3c2('0x3')]])){utils[_0xe3c2('0x11')](util[_0xe3c2('0x6')](_0xe3c2('0x26'),_0x3f5354[_0xe3c2('0x3')]),_0x3f5354);if(_['isNil'](channels[_0x3f5354[_0xe3c2('0x3')]][_0xe3c2('0x27')])){channels[_0x3f5354[_0xe3c2('0x3')]]['callerid']=_0x3f5354[_0xe3c2('0x28')]+'\x20<'+_0x3f5354[_0xe3c2('0x18')]+'>';}utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')](_0xe3c2('0x29'),_0x3f5354[_0xe3c2('0x3')],channels[_0x3f5354[_0xe3c2('0x3')]][_0xe3c2('0x27')],_0x3f5354['cause-txt']));channels[_0x3f5354['uniqueid']][_0xe3c2('0x2a')]=utils[_0xe3c2('0x19')]();channels[_0x3f5354[_0xe3c2('0x3')]]['duration']=utils[_0xe3c2('0x2b')](channels[_0x3f5354[_0xe3c2('0x3')]][_0xe3c2('0x2a')],channels[_0x3f5354['uniqueid']][_0xe3c2('0x2c')]);channels[_0x3f5354['uniqueid']]['billableseconds']=channels[_0x3f5354['uniqueid']][_0xe3c2('0x21')]?utils['diffTime'](channels[_0x3f5354[_0xe3c2('0x3')]]['endtime'],channels[_0x3f5354[_0xe3c2('0x3')]][_0xe3c2('0x21')]):0x0;writeDB(channels[_0x3f5354[_0xe3c2('0x3')]]);}}catch(_0x54ada8){utils['error'](util[_0xe3c2('0x6')]('[%s][calls][hangup]',_0x3f5354[_0xe3c2('0x3')]),_0x54ada8);}};exports[_0xe3c2('0x2d')]=function(_0x259317){try{if(!_[_0xe3c2('0x1e')](channels[_0x259317[_0xe3c2('0x2e')]])){utils[_0xe3c2('0x11')](util[_0xe3c2('0x6')](_0xe3c2('0x2f'),_0x259317[_0xe3c2('0x30')]),_0x259317);if(channels[_0x259317['localtwolinkedid']][_0xe3c2('0x8')]==_0x259317['transfereechannel']){utils[_0xe3c2('0x5')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x259317[_0xe3c2('0x30')],_0x259317['localtwolinkedid'],_0x259317[_0xe3c2('0x31')]));channels[_0x259317[_0xe3c2('0x2e')]]['destinationchannel']=_0x259317['secondtransfererchannel'];channels[_0x259317[_0xe3c2('0x2e')]][_0xe3c2('0x32')]=_0xe3c2('0x33');}else if(channels[_0x259317[_0xe3c2('0x2e')]][_0xe3c2('0x8')]=_0x259317[_0xe3c2('0x34')]){utils['info'](util[_0xe3c2('0x6')](_0xe3c2('0x35'),_0x259317[_0xe3c2('0x30')],_0x259317['localtwolinkedid'],_0x259317['origtransfererchannel']));channels[_0x259317[_0xe3c2('0x2e')]]['destinationchannel']=_0x259317[_0xe3c2('0x36')];channels[_0x259317[_0xe3c2('0x2e')]]['userfield']=_0xe3c2('0x33');}}}catch(_0x163210){utils[_0xe3c2('0x25')](util[_0xe3c2('0x6')]('[%s][calls][attendedtransfer]',_0x259317[_0xe3c2('0x30')]),_0x163210);}};exports[_0xe3c2('0x37')]=function(_0x56393d){try{if(!_[_0xe3c2('0x1e')](channels[_0x56393d['uniqueid']])){utils[_0xe3c2('0x11')](util[_0xe3c2('0x6')]('[%s][calls][musiconholdstart]',_0x56393d[_0xe3c2('0x3')]),_0x56393d);channels[_0x56393d[_0xe3c2('0x3')]]['musiconholdstartAt']=utils[_0xe3c2('0x19')]();utils['info'](util[_0xe3c2('0x6')](_0xe3c2('0x38'),_0x56393d[_0xe3c2('0x3')],channels[_0x56393d[_0xe3c2('0x3')]][_0xe3c2('0x39')]));}}catch(_0x3c33e6){utils['error'](util[_0xe3c2('0x6')](_0xe3c2('0x3a'),_0x56393d[_0xe3c2('0x3')]),_0x3c33e6);}};exports['musiconholdstop']=function(_0x48cf22){try{if(!_[_0xe3c2('0x1e')](channels[_0x48cf22['uniqueid']])){utils[_0xe3c2('0x11')](util['format'](_0xe3c2('0x3b'),_0x48cf22[_0xe3c2('0x3')]),_0x48cf22);if(!_['isNil'](channels[_0x48cf22['uniqueid']]['musiconholdstartAt'])){channels[_0x48cf22['uniqueid']]['mohtime']+=utils[_0xe3c2('0x2b')](utils[_0xe3c2('0x19')](),channels[_0x48cf22[_0xe3c2('0x3')]][_0xe3c2('0x39')]);utils[_0xe3c2('0x5')](util['format'](_0xe3c2('0x3c'),_0x48cf22[_0xe3c2('0x3')],channels[_0x48cf22[_0xe3c2('0x3')]][_0xe3c2('0x3d')]));delete channels[_0x48cf22[_0xe3c2('0x3')]][_0xe3c2('0x39')];}}}catch(_0x15ab4a){utils['error'](util[_0xe3c2('0x6')](_0xe3c2('0x3b'),_0x48cf22[_0xe3c2('0x3')]),_0x15ab4a);}};exports[_0xe3c2('0x3e')]=function(_0x25e024){try{if(!_[_0xe3c2('0x1e')](channels[_0x25e024['uniqueid']])){utils[_0xe3c2('0x11')](util[_0xe3c2('0x6')](_0xe3c2('0x3f'),_0x25e024[_0xe3c2('0x3')]),_0x25e024);if(!_[_0xe3c2('0x1e')](_0x25e024['variable'][_0xe3c2('0x40')])){utils['info'](util['format'](_0xe3c2('0x41'),_0x25e024[_0xe3c2('0x3')],_0x25e024['value']));channels[_0x25e024['uniqueid']][_0xe3c2('0x42')]=_0x25e024[_0xe3c2('0x43')];}if(!_[_0xe3c2('0x1e')](_0x25e024[_0xe3c2('0x44')][_0xe3c2('0x45')])){utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x25e024['uniqueid'],_0x25e024[_0xe3c2('0x43')]));channels[_0x25e024[_0xe3c2('0x3')]][_0xe3c2('0x46')]=_0x25e024[_0xe3c2('0x43')];channels[_0x25e024['uniqueid']][_0xe3c2('0x27')]='\x22'+_0x25e024['value']+'\x22\x20<'+_0x25e024['value']+'>';}if(!_[_0xe3c2('0x1e')](_0x25e024[_0xe3c2('0x44')]['xmd-callerid-preview'])||!_[_0xe3c2('0x1e')](_0x25e024[_0xe3c2('0x44')][_0xe3c2('0x47')])){utils['info'](util[_0xe3c2('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x25e024[_0xe3c2('0x3')],!_['isNil'](_0x25e024[_0xe3c2('0x44')][_0xe3c2('0x48')])?'xmd-callerid-preview':'xmd-callerid',_0x25e024[_0xe3c2('0x43')]));channels[_0x25e024[_0xe3c2('0x3')]][_0xe3c2('0x27')]=_0x25e024[_0xe3c2('0x43')];}if(!_[_0xe3c2('0x1e')](_0x25e024['variable'][_0xe3c2('0x49')])||!_[_0xe3c2('0x1e')](_0x25e024[_0xe3c2('0x44')][_0xe3c2('0x4a')])){utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')](_0xe3c2('0x4b'),_0x25e024[_0xe3c2('0x3')],!_[_0xe3c2('0x1e')](_0x25e024[_0xe3c2('0x44')][_0xe3c2('0x49')])?_0xe3c2('0x49'):_0xe3c2('0x4a'),_0x25e024[_0xe3c2('0x43')]));channels[_0x25e024[_0xe3c2('0x3')]][_0xe3c2('0x4c')]=_0xe3c2('0x4d');channels[_0x25e024[_0xe3c2('0x3')]][_0xe3c2('0x4e')]=_0x25e024['value'];channels[_0x25e024[_0xe3c2('0x3')]][_0xe3c2('0x9')]=!![];}if(!_[_0xe3c2('0x1e')](_0x25e024[_0xe3c2('0x44')]['xmd-contactid'])){utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')](_0xe3c2('0x4f'),_0x25e024[_0xe3c2('0x3')],_0x25e024[_0xe3c2('0x43')]));channels[_0x25e024['uniqueid']][_0xe3c2('0x50')]=_0x25e024[_0xe3c2('0x43')];}if(!_[_0xe3c2('0x1e')](_0x25e024[_0xe3c2('0x44')]['xmd-cdrtype'])){utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')](_0xe3c2('0x51'),_0x25e024['uniqueid'],_0x25e024[_0xe3c2('0x43')]));channels[_0x25e024[_0xe3c2('0x3')]][_0xe3c2('0x52')]=_0x25e024[_0xe3c2('0x43')];}if(!_[_0xe3c2('0x1e')](_0x25e024[_0xe3c2('0x44')]['outboundrouteid'])){utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')](_0xe3c2('0x53'),_0x25e024[_0xe3c2('0x3')],_0x25e024[_0xe3c2('0x43')]));channels[_0x25e024[_0xe3c2('0x3')]][_0xe3c2('0x54')]=_0x25e024[_0xe3c2('0x43')];}if(!_[_0xe3c2('0x1e')](_0x25e024['variable']['sipcallid'])){utils['info'](util[_0xe3c2('0x6')](_0xe3c2('0x55'),_0x25e024[_0xe3c2('0x3')],_0x25e024[_0xe3c2('0x43')]));channels[_0x25e024[_0xe3c2('0x3')]][_0xe3c2('0x56')]=_0x25e024[_0xe3c2('0x43')];}}}catch(_0x4dc4f7){utils[_0xe3c2('0x25')](util['format'](_0xe3c2('0x3f'),_0x25e024[_0xe3c2('0x3')]),_0x4dc4f7);}};exports[_0xe3c2('0x57')]=function(_0x15c362){try{if(!_[_0xe3c2('0x1e')](channels[_0x15c362[_0xe3c2('0x3')]])){utils[_0xe3c2('0x11')](util['format'](_0xe3c2('0x58'),_0x15c362[_0xe3c2('0x3')]),_0x15c362);utils[_0xe3c2('0x5')](util[_0xe3c2('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x15c362[_0xe3c2('0x3')],_0x15c362[_0xe3c2('0x59')],_0x15c362[_0xe3c2('0x5a')]));if(_0x15c362[_0xe3c2('0x59')][_0xe3c2('0x5b')]()=='set'&&_[_0xe3c2('0x5c')](_0x15c362[_0xe3c2('0x5a')][_0xe3c2('0x5b')](),'cdr')){var _0x2538a6=_0x15c362['appdata'][_0xe3c2('0x5d')]('=');var _0x4c2f8a=_0x2538a6[0x0][_0xe3c2('0x5e')](_0x2538a6[0x0]['lastIndexOf']('(')+0x1,_0x2538a6[0x0]['lastIndexOf'](')'));var _0x46711a=_0x2538a6[0x1];channels[_0x15c362[_0xe3c2('0x3')]][_0x4c2f8a]=_0x46711a;}if(!_[_0xe3c2('0x5f')]([_0xe3c2('0x60'),_0xe3c2('0x61'),_0xe3c2('0x62'),_0xe3c2('0x63'),'gotoif'],_0x15c362[_0xe3c2('0x59')]['toLowerCase']())){channels[_0x15c362[_0xe3c2('0x3')]][_0xe3c2('0x4c')]=_0x15c362['application'];channels[_0x15c362[_0xe3c2('0x3')]][_0xe3c2('0x4e')]=_0x15c362['appdata'];}}}catch(_0x37b5df){utils['error'](util[_0xe3c2('0x6')](_0xe3c2('0x58'),_0x15c362[_0xe3c2('0x3')]),_0x37b5df);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a495991..bfbdf82 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 _0x786d=['shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','info','[core]\x20connected'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0x786d,0x1de));var _0xd786=function(_0x31148f,_0x366f97){_0x31148f=_0x31148f-0x0;var _0x1c0768=_0x786d[_0x31148f];return _0x1c0768;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0xd786('0x0')](_0xd786('0x1'));};exports[_0xd786('0x2')]=function(){utils[_0xd786('0x0')](_0xd786('0x3'));};exports[_0xd786('0x4')]=function(){utils[_0xd786('0x0')]('[core]\x20fullybooted');};exports[_0xd786('0x5')]=function(_0x39f6a3){utils[_0xd786('0x5')](_0xd786('0x6'),_0x39f6a3);};exports[_0xd786('0x7')]=function(){utils[_0xd786('0x0')](_0xd786('0x8'));};exports[_0xd786('0x9')]=function(_0x1bca80){}; \ No newline at end of file +var _0xadf0=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','close','connect','info','[core]\x20connected'];(function(_0x47aecd,_0x4fb832){var _0x51abf0=function(_0x1336ad){while(--_0x1336ad){_0x47aecd['push'](_0x47aecd['shift']());}};_0x51abf0(++_0x4fb832);}(_0xadf0,0x12d));var _0x0adf=function(_0x24d2dc,_0x3f92b6){_0x24d2dc=_0x24d2dc-0x0;var _0x5c64e1=_0xadf0[_0x24d2dc];return _0x5c64e1;};'use strict';var utils=require('./utils');exports[_0x0adf('0x0')]=function(){utils[_0x0adf('0x1')](_0x0adf('0x2'));};exports[_0x0adf('0x3')]=function(){utils[_0x0adf('0x1')](_0x0adf('0x4'));};exports[_0x0adf('0x5')]=function(){utils['info'](_0x0adf('0x6'));};exports['error']=function(_0x5a492c){utils['error']('[core]\x20error',_0x5a492c);};exports[_0x0adf('0x7')]=function(){utils[_0x0adf('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x33e906){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index fd7f4bd..605eb67 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 _0x56bc=['lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','isNil','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','./utils','info','format','uniqueid','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr(routeid)','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','assign','starttime','now'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x56bc,0x1b8));var _0xc56b=function(_0x27a576,_0x33435a){_0x27a576=_0x27a576-0x0;var _0x22651b=_0x56bc[_0x27a576];return _0x22651b;};'use strict';var _=require(_0xc56b('0x0'));var util=require('util');var utils=require(_0xc56b('0x1'));var dials={};function writeDB(_0x56ea33){utils[_0xc56b('0x2')](util[_0xc56b('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x56ea33[_0xc56b('0x4')],_0x56ea33['channel'],_0x56ea33['dialstring'],_0x56ea33['calleridnum'],_0x56ea33['connectedlinenum'],_0x56ea33[_0xc56b('0x5')]));utils[_0xc56b('0x6')](_0xc56b('0x7'),_0x56ea33);delete dials[_0x56ea33[_0xc56b('0x4')]];}exports[_0xc56b('0x8')]=function(_0x3e9de4){try{utils[_0xc56b('0x9')](util['format'](_0xc56b('0xa'),_0x3e9de4[_0xc56b('0x4')]),_0x3e9de4);utils[_0xc56b('0x2')](util[_0xc56b('0x3')](_0xc56b('0xb'),_0x3e9de4[_0xc56b('0x4')],_0x3e9de4['application'],_0x3e9de4[_0xc56b('0xc')]));if(_0x3e9de4[_0xc56b('0xd')][_0xc56b('0xe')]()==_0xc56b('0xf')&&_['startsWith'](_0x3e9de4[_0xc56b('0xc')][_0xc56b('0xe')](),_0xc56b('0x10'))){var _0x12ab15=_0x3e9de4[_0xc56b('0xc')]['split']('=');dials[_0x3e9de4['uniqueid']]={'routeId':_0x12ab15[0x1]};}}catch(_0x2d002c){utils['error'](util['format']('[%s][dials][newexten]',_0x3e9de4['uniqueid']),_0x2d002c);}};exports[_0xc56b('0x11')]=function(_0xbcd6a5){try{utils[_0xc56b('0x9')](util[_0xc56b('0x3')](_0xc56b('0x12'),_0xbcd6a5[_0xc56b('0x4')]),_0xbcd6a5);if(!_['isNil'](_0xbcd6a5[_0xc56b('0x13')][_0xc56b('0x14')])){utils[_0xc56b('0x2')](util[_0xc56b('0x3')](_0xc56b('0x15'),_0xbcd6a5[_0xc56b('0x4')],_0xbcd6a5[_0xc56b('0x16')]));dials[_0xbcd6a5[_0xc56b('0x4')]]={'routeId':_0xbcd6a5['value']};}}catch(_0x396337){utils[_0xc56b('0x17')](util['format'](_0xc56b('0x12'),_0xbcd6a5[_0xc56b('0x4')]),_0x396337);}};exports[_0xc56b('0x18')]=function(_0x5c5d63){try{if(!_['isNil'](dials[_0x5c5d63[_0xc56b('0x4')]])){utils[_0xc56b('0x9')](util['format']('[%s][dials][dialbegin]',_0x5c5d63[_0xc56b('0x4')]),_0x5c5d63);dials[_0x5c5d63[_0xc56b('0x4')]]=_[_0xc56b('0x19')](dials[_0x5c5d63[_0xc56b('0x4')]],_0x5c5d63);dials[_0x5c5d63[_0xc56b('0x4')]][_0xc56b('0x1a')]=utils[_0xc56b('0x1b')]();dials[_0x5c5d63[_0xc56b('0x4')]][_0xc56b('0x1c')]=_0xc56b('0x1d');utils['info'](util[_0xc56b('0x3')](_0xc56b('0x1e'),_0x5c5d63['uniqueid'],dials[_0x5c5d63[_0xc56b('0x4')]][_0xc56b('0x1a')]));}}catch(_0x565b99){utils[_0xc56b('0x17')](util[_0xc56b('0x3')](_0xc56b('0x1f'),_0x5c5d63[_0xc56b('0x4')]),_0x565b99);}};exports[_0xc56b('0x20')]=function(_0x5cb295){try{if(!_[_0xc56b('0x21')](dials[_0x5cb295[_0xc56b('0x4')]])){utils['debug'](util[_0xc56b('0x3')](_0xc56b('0x22'),_0x5cb295[_0xc56b('0x4')]),_0x5cb295);dials[_0x5cb295[_0xc56b('0x4')]][_0xc56b('0x5')]=_0x5cb295[_0xc56b('0x5')];if(_0x5cb295[_0xc56b('0x5')]==_0xc56b('0x23')){dials[_0x5cb295['uniqueid']]=_[_0xc56b('0x19')](dials[_0x5cb295[_0xc56b('0x4')]],_0x5cb295);dials[_0x5cb295[_0xc56b('0x4')]]['answertime']=utils['now']();dials[_0x5cb295[_0xc56b('0x4')]][_0xc56b('0x1c')]=_0xc56b('0x24');utils[_0xc56b('0x2')](util['format'](_0xc56b('0x25'),_0x5cb295['uniqueid'],_0x5cb295[_0xc56b('0x5')],dials[_0x5cb295[_0xc56b('0x4')]][_0xc56b('0x26')]));}else{utils['info'](util[_0xc56b('0x3')](_0xc56b('0x27'),_0x5cb295[_0xc56b('0x4')],_0x5cb295[_0xc56b('0x5')]));}}}catch(_0x28b2a0){utils[_0xc56b('0x17')](util[_0xc56b('0x3')](_0xc56b('0x22'),_0x5cb295[_0xc56b('0x4')]),_0x28b2a0);}};exports[_0xc56b('0x28')]=function(_0x206646){try{if(!_[_0xc56b('0x21')](dials[_0x206646['uniqueid']])){utils[_0xc56b('0x9')](util[_0xc56b('0x3')](_0xc56b('0x29'),_0x206646[_0xc56b('0x4')]),_0x206646);utils[_0xc56b('0x2')](util[_0xc56b('0x3')](_0xc56b('0x2a'),_0x206646[_0xc56b('0x4')],_0x206646[_0xc56b('0x2b')],_0x206646[_0xc56b('0x2c')],_0x206646[_0xc56b('0x2d')]));dials[_0x206646[_0xc56b('0x4')]]=_[_0xc56b('0x19')](dials[_0x206646[_0xc56b('0x4')]],{'endtime':utils[_0xc56b('0x1b')](),'lastevent':_0xc56b('0x2e')});dials[_0x206646[_0xc56b('0x4')]][_0xc56b('0x2f')]=utils[_0xc56b('0x30')](dials[_0x206646[_0xc56b('0x4')]][_0xc56b('0x31')],dials[_0x206646[_0xc56b('0x4')]][_0xc56b('0x1a')]);dials[_0x206646['uniqueid']][_0xc56b('0x32')]=utils[_0xc56b('0x30')](dials[_0x206646[_0xc56b('0x4')]]['answertime']||dials[_0x206646['uniqueid']]['endtime'],dials[_0x206646[_0xc56b('0x4')]][_0xc56b('0x1a')]);dials[_0x206646[_0xc56b('0x4')]][_0xc56b('0x33')]=dials[_0x206646['uniqueid']][_0xc56b('0x26')]?utils['diffTime'](dials[_0x206646[_0xc56b('0x4')]][_0xc56b('0x31')],dials[_0x206646[_0xc56b('0x4')]][_0xc56b('0x26')]):0x0;writeDB(dials[_0x206646['uniqueid']]);}}catch(_0x72a037){utils[_0xc56b('0x17')](util[_0xc56b('0x3')](_0xc56b('0x29'),_0x206646[_0xc56b('0x4')]),_0x72a037);}}; \ No newline at end of file +var _0xb66c=['isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','diffTime','endtime','util','./utils','info','format','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','error','varset','[%s][dials][varset]'];(function(_0x11fbfe,_0x170dbb){var _0xc54685=function(_0x5c0986){while(--_0x5c0986){_0x11fbfe['push'](_0x11fbfe['shift']());}};_0xc54685(++_0x170dbb);}(_0xb66c,0xcb));var _0xcb66=function(_0x270982,_0xb92382){_0x270982=_0x270982-0x0;var _0x5841fa=_0xb66c[_0x270982];return _0x5841fa;};'use strict';var _=require('lodash');var util=require(_0xcb66('0x0'));var utils=require(_0xcb66('0x1'));var dials={};function writeDB(_0x432b48){utils[_0xcb66('0x2')](util[_0xcb66('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x432b48['uniqueid'],_0x432b48[_0xcb66('0x4')],_0x432b48[_0xcb66('0x5')],_0x432b48[_0xcb66('0x6')],_0x432b48['connectedlinenum'],_0x432b48[_0xcb66('0x7')]));utils[_0xcb66('0x8')](_0xcb66('0x9'),_0x432b48);delete dials[_0x432b48[_0xcb66('0xa')]];}exports['newexten']=function(_0x110f8e){try{utils[_0xcb66('0xb')](util[_0xcb66('0x3')](_0xcb66('0xc'),_0x110f8e[_0xcb66('0xa')]),_0x110f8e);utils[_0xcb66('0x2')](util[_0xcb66('0x3')](_0xcb66('0xd'),_0x110f8e['uniqueid'],_0x110f8e[_0xcb66('0xe')],_0x110f8e['appdata']));if(_0x110f8e['application'][_0xcb66('0xf')]()==_0xcb66('0x10')&&_[_0xcb66('0x11')](_0x110f8e[_0xcb66('0x12')][_0xcb66('0xf')](),'cdr(routeid)')){var _0x3c31b4=_0x110f8e['appdata']['split']('=');dials[_0x110f8e[_0xcb66('0xa')]]={'routeId':_0x3c31b4[0x1]};}}catch(_0x1db74f){utils[_0xcb66('0x13')](util[_0xcb66('0x3')](_0xcb66('0xc'),_0x110f8e[_0xcb66('0xa')]),_0x1db74f);}};exports[_0xcb66('0x14')]=function(_0x3fd20e){try{utils[_0xcb66('0xb')](util[_0xcb66('0x3')](_0xcb66('0x15'),_0x3fd20e['uniqueid']),_0x3fd20e);if(!_[_0xcb66('0x16')](_0x3fd20e[_0xcb66('0x17')][_0xcb66('0x18')])){utils[_0xcb66('0x2')](util[_0xcb66('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3fd20e[_0xcb66('0xa')],_0x3fd20e['value']));dials[_0x3fd20e[_0xcb66('0xa')]]={'routeId':_0x3fd20e[_0xcb66('0x19')]};}}catch(_0x263d7c){utils[_0xcb66('0x13')](util[_0xcb66('0x3')](_0xcb66('0x15'),_0x3fd20e[_0xcb66('0xa')]),_0x263d7c);}};exports[_0xcb66('0x1a')]=function(_0x4247cf){try{if(!_[_0xcb66('0x16')](dials[_0x4247cf[_0xcb66('0xa')]])){utils['debug'](util[_0xcb66('0x3')](_0xcb66('0x1b'),_0x4247cf[_0xcb66('0xa')]),_0x4247cf);dials[_0x4247cf[_0xcb66('0xa')]]=_[_0xcb66('0x1c')](dials[_0x4247cf['uniqueid']],_0x4247cf);dials[_0x4247cf[_0xcb66('0xa')]][_0xcb66('0x1d')]=utils[_0xcb66('0x1e')]();dials[_0x4247cf['uniqueid']][_0xcb66('0x1f')]=_0xcb66('0x20');utils[_0xcb66('0x2')](util[_0xcb66('0x3')](_0xcb66('0x21'),_0x4247cf[_0xcb66('0xa')],dials[_0x4247cf[_0xcb66('0xa')]][_0xcb66('0x1d')]));}}catch(_0x34abfb){utils[_0xcb66('0x13')](util[_0xcb66('0x3')](_0xcb66('0x1b'),_0x4247cf['uniqueid']),_0x34abfb);}};exports[_0xcb66('0x22')]=function(_0x58cf30){try{if(!_[_0xcb66('0x16')](dials[_0x58cf30[_0xcb66('0xa')]])){utils[_0xcb66('0xb')](util[_0xcb66('0x3')](_0xcb66('0x23'),_0x58cf30['uniqueid']),_0x58cf30);dials[_0x58cf30['uniqueid']]['dialstatus']=_0x58cf30[_0xcb66('0x7')];if(_0x58cf30[_0xcb66('0x7')]=='ANSWER'){dials[_0x58cf30[_0xcb66('0xa')]]=_[_0xcb66('0x1c')](dials[_0x58cf30[_0xcb66('0xa')]],_0x58cf30);dials[_0x58cf30['uniqueid']][_0xcb66('0x24')]=utils[_0xcb66('0x1e')]();dials[_0x58cf30[_0xcb66('0xa')]][_0xcb66('0x1f')]='connect';utils[_0xcb66('0x2')](util[_0xcb66('0x3')](_0xcb66('0x25'),_0x58cf30[_0xcb66('0xa')],_0x58cf30[_0xcb66('0x7')],dials[_0x58cf30[_0xcb66('0xa')]][_0xcb66('0x24')]));}else{utils[_0xcb66('0x2')](util[_0xcb66('0x3')](_0xcb66('0x26'),_0x58cf30[_0xcb66('0xa')],_0x58cf30['dialstatus']));}}}catch(_0x3afb57){utils[_0xcb66('0x13')](util[_0xcb66('0x3')](_0xcb66('0x23'),_0x58cf30[_0xcb66('0xa')]),_0x3afb57);}};exports['hangup']=function(_0x37121f){try{if(!_[_0xcb66('0x16')](dials[_0x37121f[_0xcb66('0xa')]])){utils[_0xcb66('0xb')](util[_0xcb66('0x3')](_0xcb66('0x27'),_0x37121f[_0xcb66('0xa')]),_0x37121f);utils[_0xcb66('0x2')](util[_0xcb66('0x3')](_0xcb66('0x28'),_0x37121f[_0xcb66('0xa')],_0x37121f['calleridnum'],_0x37121f['calleridname'],_0x37121f[_0xcb66('0x29')]));dials[_0x37121f[_0xcb66('0xa')]]=_[_0xcb66('0x1c')](dials[_0x37121f[_0xcb66('0xa')]],{'endtime':utils[_0xcb66('0x1e')](),'lastevent':_0xcb66('0x2a')});dials[_0x37121f[_0xcb66('0xa')]]['duration']=utils[_0xcb66('0x2b')](dials[_0x37121f[_0xcb66('0xa')]][_0xcb66('0x2c')],dials[_0x37121f['uniqueid']][_0xcb66('0x1d')]);dials[_0x37121f['uniqueid']]['holdtime']=utils[_0xcb66('0x2b')](dials[_0x37121f[_0xcb66('0xa')]]['answertime']||dials[_0x37121f[_0xcb66('0xa')]][_0xcb66('0x2c')],dials[_0x37121f[_0xcb66('0xa')]][_0xcb66('0x1d')]);dials[_0x37121f[_0xcb66('0xa')]]['billableseconds']=dials[_0x37121f[_0xcb66('0xa')]][_0xcb66('0x24')]?utils[_0xcb66('0x2b')](dials[_0x37121f[_0xcb66('0xa')]][_0xcb66('0x2c')],dials[_0x37121f[_0xcb66('0xa')]]['answertime']):0x0;writeDB(dials[_0x37121f[_0xcb66('0xa')]]);}}catch(_0x3a2fe6){utils[_0xcb66('0x13')](util[_0xcb66('0x3')](_0xcb66('0x27'),_0x37121f[_0xcb66('0xa')]),_0x3a2fe6);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 136d3bc..25dbaaa 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 _0x0149=['asterisk-manager','../../config/environment','./utils','asterisk','port','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','devicestatechange','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend'];(function(_0x4f38e3,_0x4822f5){var _0x19e72b=function(_0x2a896d){while(--_0x2a896d){_0x4f38e3['push'](_0x4f38e3['shift']());}};_0x19e72b(++_0x4822f5);}(_0x0149,0x100));var _0x9014=function(_0xbcff36,_0x41a3e6){_0xbcff36=_0xbcff36-0x0;var _0xfe0fc4=_0x0149[_0xbcff36];return _0xfe0fc4;};var AsteriskManager=require(_0x9014('0x0'));var config=require(_0x9014('0x1'));var utils=require(_0x9014('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0x9014('0x3')][_0x9014('0x4')],config['asterisk']['ip'],config[_0x9014('0x3')]['username'],config[_0x9014('0x3')]['password'],!![]);ami['keepConnected']();if(config[_0x9014('0x5')]&&config[_0x9014('0x5')][_0x9014('0x6')]){utils[_0x9014('0x7')](_0x9014('0x8'));}else{var agents=require(_0x9014('0x9'));var calls=require('./calls.controller');var queues=require(_0x9014('0xa'));var recordings=require('./recordings.controller');var members=require(_0x9014('0xb'));var dials=require(_0x9014('0xc'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x9014('0xd'),core[_0x9014('0xd')]);ami['on'](_0x9014('0xe'),core[_0x9014('0xe')]);ami['on'](_0x9014('0xf'),core[_0x9014('0xf')]);ami['on'](_0x9014('0x10'),core[_0x9014('0x10')]);ami['on'](_0x9014('0x11'),core['close']);ami['on'](_0x9014('0x12'),core['managerevent']);ami['on']('devicestatechange',function(_0x45879c){try{utils['debug'](util[_0x9014('0x13')](_0x9014('0x14'),_0x45879c['device']),_0x45879c);members[_0x9014('0x15')](_0x45879c);}catch(_0x450705){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x14'),_0x45879c[_0x9014('0x16')]),_0x450705);}});ami['on'](_0x9014('0x17'),function(_0x58fb9d){try{utils[_0x9014('0x18')](util[_0x9014('0x13')](_0x9014('0x19'),_0x58fb9d['uniqueid']),_0x58fb9d);agents[_0x9014('0x17')](_0x58fb9d);}catch(_0x2098c5){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x19'),_0x58fb9d[_0x9014('0x1a')]),_0x2098c5);}});ami['on'](_0x9014('0x1b'),function(_0x2085a1){try{utils['debug'](util['format'](_0x9014('0x1c'),_0x2085a1[_0x9014('0x1a')]),_0x2085a1);agents[_0x9014('0x1b')](_0x2085a1);}catch(_0x1af850){utils[_0x9014('0x10')](util['format'](_0x9014('0x1c'),_0x2085a1[_0x9014('0x1a')]),_0x1af850);}});ami['on']('agentconnect',function(_0x44b40c){try{utils['debug'](util[_0x9014('0x13')]('[%s][index][agentconnect]',_0x44b40c[_0x9014('0x1a')]),_0x44b40c);agents[_0x9014('0x1d')](_0x44b40c);queues[_0x9014('0x1d')](_0x44b40c);}catch(_0x1fcca2){utils['error'](util['format'](_0x9014('0x1e'),_0x44b40c['uniqueid']),_0x1fcca2);}});ami['on'](_0x9014('0x1f'),function(_0x133f1e){try{utils['debug'](util['format'](_0x9014('0x20'),_0x133f1e[_0x9014('0x1a')]),_0x133f1e);agents[_0x9014('0x1f')](_0x133f1e);queues['agentcomplete'](_0x133f1e);members[_0x9014('0x1f')](_0x133f1e);}catch(_0x25e2dc){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x20'),_0x133f1e[_0x9014('0x1a')]),_0x25e2dc);}});ami['on'](_0x9014('0x21'),function(_0x36ea3d){try{utils[_0x9014('0x18')](util[_0x9014('0x13')](_0x9014('0x22'),_0x36ea3d[_0x9014('0x1a')]),_0x36ea3d);agents[_0x9014('0x21')](_0x36ea3d);queues[_0x9014('0x21')](_0x36ea3d);}catch(_0x267650){utils['error'](util[_0x9014('0x13')](_0x9014('0x22'),_0x36ea3d['uniqueid']),_0x267650);}});ami['on'](_0x9014('0x23'),function(_0x383ee4){try{utils[_0x9014('0x18')](util['format'](_0x9014('0x24'),_0x383ee4['uniqueid']),_0x383ee4);queues[_0x9014('0x23')](_0x383ee4);recordings[_0x9014('0x23')](_0x383ee4);}catch(_0x5e7ef1){utils['error'](util[_0x9014('0x13')]('[%s][index][queuecallerjoin]',_0x383ee4['uniqueid']),_0x5e7ef1);}});ami['on'](_0x9014('0x25'),function(_0x3549aa){try{utils[_0x9014('0x18')](util[_0x9014('0x13')](_0x9014('0x26'),_0x3549aa[_0x9014('0x1a')]),_0x3549aa);queues[_0x9014('0x25')](_0x3549aa);}catch(_0x3ea27c){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x26'),_0x3549aa[_0x9014('0x1a')]),_0x3ea27c);}});ami['on']('musiconholdstart',function(_0x3806de){try{utils[_0x9014('0x18')](util['format'](_0x9014('0x27'),_0x3806de[_0x9014('0x1a')]),_0x3806de);queues['musiconholdstart'](_0x3806de);calls[_0x9014('0x28')](_0x3806de);}catch(_0x373a2c){utils['error'](util['format'](_0x9014('0x27'),_0x3806de[_0x9014('0x1a')]),_0x373a2c);}});ami['on'](_0x9014('0x29'),function(_0x1169c8){try{utils[_0x9014('0x18')](util[_0x9014('0x13')](_0x9014('0x2a'),_0x1169c8[_0x9014('0x1a')]),_0x1169c8);queues[_0x9014('0x29')](_0x1169c8);calls['musiconholdstop'](_0x1169c8);}catch(_0x4395e7){utils[_0x9014('0x10')](util['format'](_0x9014('0x2a'),_0x1169c8[_0x9014('0x1a')]),_0x4395e7);}});ami['on'](_0x9014('0x2b'),function(_0xceb0da){try{utils[_0x9014('0x18')](util[_0x9014('0x13')](_0x9014('0x2c'),_0xceb0da[_0x9014('0x1a')]),_0xceb0da);calls['newstate'](_0xceb0da);recordings[_0x9014('0x2b')](_0xceb0da);}catch(_0xd57dc9){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x2c'),_0xceb0da[_0x9014('0x1a')]),_0xd57dc9);}});ami['on'](_0x9014('0x2d'),function(_0x19a9b9){try{utils[_0x9014('0x18')](util[_0x9014('0x13')](_0x9014('0x2e'),_0x19a9b9[_0x9014('0x1a')]),_0x19a9b9);calls[_0x9014('0x2d')](_0x19a9b9);recordings[_0x9014('0x2d')](_0x19a9b9);dials[_0x9014('0x2d')](_0x19a9b9);agents[_0x9014('0x2d')](_0x19a9b9);queues['hangup'](_0x19a9b9);}catch(_0x14443e){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x2e'),_0x19a9b9[_0x9014('0x1a')]),_0x14443e);}});ami['on']('cdr',function(_0x8daf53){try{utils[_0x9014('0x18')](util[_0x9014('0x13')](_0x9014('0x2f'),_0x8daf53[_0x9014('0x1a')]),_0x8daf53);members[_0x9014('0x30')](_0x8daf53);}catch(_0xe27411){utils[_0x9014('0x10')](util[_0x9014('0x13')]('[%s][index][cdr]',_0x8daf53[_0x9014('0x1a')]),_0xe27411);}});ami['on'](_0x9014('0x31'),function(_0x2cfbd4){try{utils['debug'](util['format'](_0x9014('0x32'),_0x2cfbd4[_0x9014('0x1a')]),_0x2cfbd4);queues[_0x9014('0x31')](_0x2cfbd4);agents[_0x9014('0x31')](_0x2cfbd4);transfers[_0x9014('0x31')](_0x2cfbd4);}catch(_0x35dbf5){utils[_0x9014('0x10')](util[_0x9014('0x13')]('[%s][index][blindtransfer]',_0x2cfbd4[_0x9014('0x1a')]),_0x35dbf5);}});ami['on']('attendedtransfer',function(_0x550a2c){try{utils[_0x9014('0x18')](util['format'](_0x9014('0x33'),_0x550a2c[_0x9014('0x34')]),_0x550a2c);queues[_0x9014('0x35')](_0x550a2c);transfers['attendedtransfer'](_0x550a2c);agents['attendedtransfer'](_0x550a2c);calls[_0x9014('0x35')](_0x550a2c);}catch(_0x4f573c){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x33'),_0x550a2c['origtransfereruniqueid']),_0x4f573c);}});ami['on']('varset',function(_0x14a0b5){try{utils['debug'](util[_0x9014('0x13')](_0x9014('0x36'),_0x14a0b5[_0x9014('0x1a')]),_0x14a0b5);queues[_0x9014('0x37')](_0x14a0b5);recordings[_0x9014('0x37')](_0x14a0b5);calls[_0x9014('0x37')](_0x14a0b5);dials[_0x9014('0x37')](_0x14a0b5);}catch(_0x2a0f75){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x36'),_0x14a0b5[_0x9014('0x1a')]),_0x2a0f75);}});ami['on'](_0x9014('0x38'),function(_0x37166a){try{utils['debug'](util[_0x9014('0x13')](_0x9014('0x39'),_0x37166a[_0x9014('0x1a')]),_0x37166a);calls[_0x9014('0x38')](_0x37166a);recordings[_0x9014('0x38')](_0x37166a);dials[_0x9014('0x38')](_0x37166a);}catch(_0x3aecac){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x39'),_0x37166a['uniqueid']),_0x3aecac);}});ami['on'](_0x9014('0x3a'),function(_0x192d04){try{utils[_0x9014('0x18')](util[_0x9014('0x13')]('[%s][index][newchannel]',_0x192d04[_0x9014('0x1a')]),_0x192d04);calls[_0x9014('0x3a')](_0x192d04);recordings[_0x9014('0x3a')](_0x192d04);}catch(_0x12b646){utils['error'](util[_0x9014('0x13')](_0x9014('0x3b'),_0x192d04[_0x9014('0x1a')]),_0x12b646);}});ami['on']('dialbegin',function(_0x1a8028){try{utils[_0x9014('0x18')](util[_0x9014('0x13')](_0x9014('0x3c'),_0x1a8028['uniqueid']),_0x1a8028);dials[_0x9014('0x3d')](_0x1a8028);}catch(_0x3285ec){utils[_0x9014('0x10')](util[_0x9014('0x13')](_0x9014('0x3e'),_0x1a8028[_0x9014('0x1a')]),_0x3285ec);}});ami['on'](_0x9014('0x3f'),function(_0x156d75){try{utils['debug'](util[_0x9014('0x13')]('[%s][index][dialend]',_0x156d75[_0x9014('0x1a')]),_0x156d75);dials['dialend'](_0x156d75);}catch(_0x33a5c2){utils[_0x9014('0x10')](util[_0x9014('0x13')]('[%s][index][dialend]',_0x156d75[_0x9014('0x1a')]),_0x33a5c2);}});} \ No newline at end of file +var _0x4d44=['[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','username','keepConnected','xdr','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%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]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4d44,0x186));var _0x44d4=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4d44[_0x199572];return _0x13cfa3;};var AsteriskManager=require(_0x44d4('0x0'));var config=require(_0x44d4('0x1'));var utils=require(_0x44d4('0x2'));var util=require(_0x44d4('0x3'));var ami=new AsteriskManager(config[_0x44d4('0x4')]['port'],config[_0x44d4('0x4')]['ip'],config[_0x44d4('0x4')][_0x44d4('0x5')],config[_0x44d4('0x4')]['password'],!![]);ami[_0x44d4('0x6')]();if(config[_0x44d4('0x7')]&&config['xdr']['disabled']){utils[_0x44d4('0x8')](_0x44d4('0x9'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x44d4('0xa'));var recordings=require(_0x44d4('0xb'));var members=require('./members.controller');var dials=require(_0x44d4('0xc'));var transfers=require(_0x44d4('0xd'));var core=require('./core.controller');ami['on'](_0x44d4('0xe'),core[_0x44d4('0xe')]);ami['on'](_0x44d4('0xf'),core[_0x44d4('0xf')]);ami['on'](_0x44d4('0x10'),core[_0x44d4('0x10')]);ami['on'](_0x44d4('0x11'),core[_0x44d4('0x11')]);ami['on'](_0x44d4('0x12'),core['close']);ami['on']('managerevent',core[_0x44d4('0x13')]);ami['on'](_0x44d4('0x14'),function(_0x15105d){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')](_0x44d4('0x17'),_0x15105d[_0x44d4('0x18')]),_0x15105d);members[_0x44d4('0x14')](_0x15105d);}catch(_0x4869cd){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x17'),_0x15105d['device']),_0x4869cd);}});ami['on'](_0x44d4('0x19'),function(_0x585f50){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')](_0x44d4('0x1a'),_0x585f50[_0x44d4('0x1b')]),_0x585f50);agents[_0x44d4('0x19')](_0x585f50);}catch(_0xf9f053){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x1a'),_0x585f50[_0x44d4('0x1b')]),_0xf9f053);}});ami['on'](_0x44d4('0x1c'),function(_0x5af799){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')](_0x44d4('0x1d'),_0x5af799['uniqueid']),_0x5af799);agents[_0x44d4('0x1c')](_0x5af799);}catch(_0x3111b4){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x1d'),_0x5af799[_0x44d4('0x1b')]),_0x3111b4);}});ami['on'](_0x44d4('0x1e'),function(_0xf29424){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')]('[%s][index][agentconnect]',_0xf29424['uniqueid']),_0xf29424);agents[_0x44d4('0x1e')](_0xf29424);queues[_0x44d4('0x1e')](_0xf29424);}catch(_0x1801c0){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x1f'),_0xf29424['uniqueid']),_0x1801c0);}});ami['on']('agentcomplete',function(_0x466152){try{utils['debug'](util[_0x44d4('0x16')](_0x44d4('0x20'),_0x466152['uniqueid']),_0x466152);agents[_0x44d4('0x21')](_0x466152);queues['agentcomplete'](_0x466152);members[_0x44d4('0x21')](_0x466152);}catch(_0x3d2130){utils['error'](util[_0x44d4('0x16')](_0x44d4('0x20'),_0x466152[_0x44d4('0x1b')]),_0x3d2130);}});ami['on'](_0x44d4('0x22'),function(_0xec72f3){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')](_0x44d4('0x23'),_0xec72f3['uniqueid']),_0xec72f3);agents[_0x44d4('0x22')](_0xec72f3);queues[_0x44d4('0x22')](_0xec72f3);}catch(_0x1ff7dd){utils[_0x44d4('0x11')](util[_0x44d4('0x16')]('[%s][index][queuecallerabandon]',_0xec72f3['uniqueid']),_0x1ff7dd);}});ami['on'](_0x44d4('0x24'),function(_0xc39663){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')](_0x44d4('0x25'),_0xc39663[_0x44d4('0x1b')]),_0xc39663);queues[_0x44d4('0x24')](_0xc39663);recordings[_0x44d4('0x24')](_0xc39663);}catch(_0x23378a){utils['error'](util[_0x44d4('0x16')](_0x44d4('0x25'),_0xc39663[_0x44d4('0x1b')]),_0x23378a);}});ami['on'](_0x44d4('0x26'),function(_0x4f4b7c){try{utils['debug'](util[_0x44d4('0x16')](_0x44d4('0x27'),_0x4f4b7c['uniqueid']),_0x4f4b7c);queues[_0x44d4('0x26')](_0x4f4b7c);}catch(_0x4541c0){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x27'),_0x4f4b7c[_0x44d4('0x1b')]),_0x4541c0);}});ami['on'](_0x44d4('0x28'),function(_0x4c1d8e){try{utils['debug'](util[_0x44d4('0x16')]('[%s][index][musiconholdstart]',_0x4c1d8e['uniqueid']),_0x4c1d8e);queues[_0x44d4('0x28')](_0x4c1d8e);calls['musiconholdstart'](_0x4c1d8e);}catch(_0x22ec4b){utils[_0x44d4('0x11')](util[_0x44d4('0x16')]('[%s][index][musiconholdstart]',_0x4c1d8e['uniqueid']),_0x22ec4b);}});ami['on'](_0x44d4('0x29'),function(_0x4e1770){try{utils['debug'](util[_0x44d4('0x16')]('[%s][index][musiconholdstop]',_0x4e1770[_0x44d4('0x1b')]),_0x4e1770);queues['musiconholdstop'](_0x4e1770);calls[_0x44d4('0x29')](_0x4e1770);}catch(_0x53a375){utils['error'](util['format'](_0x44d4('0x2a'),_0x4e1770[_0x44d4('0x1b')]),_0x53a375);}});ami['on'](_0x44d4('0x2b'),function(_0x42e47b){try{utils['debug'](util[_0x44d4('0x16')](_0x44d4('0x2c'),_0x42e47b['uniqueid']),_0x42e47b);calls[_0x44d4('0x2b')](_0x42e47b);recordings[_0x44d4('0x2b')](_0x42e47b);}catch(_0x47cc6b){utils[_0x44d4('0x11')](util['format'](_0x44d4('0x2c'),_0x42e47b[_0x44d4('0x1b')]),_0x47cc6b);}});ami['on'](_0x44d4('0x2d'),function(_0x454be0){try{utils[_0x44d4('0x15')](util['format'](_0x44d4('0x2e'),_0x454be0[_0x44d4('0x1b')]),_0x454be0);calls[_0x44d4('0x2d')](_0x454be0);recordings[_0x44d4('0x2d')](_0x454be0);dials[_0x44d4('0x2d')](_0x454be0);agents[_0x44d4('0x2d')](_0x454be0);queues[_0x44d4('0x2d')](_0x454be0);}catch(_0x3c97c0){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x2e'),_0x454be0[_0x44d4('0x1b')]),_0x3c97c0);}});ami['on'](_0x44d4('0x2f'),function(_0x54e347){try{utils['debug'](util[_0x44d4('0x16')](_0x44d4('0x30'),_0x54e347[_0x44d4('0x1b')]),_0x54e347);members[_0x44d4('0x2f')](_0x54e347);}catch(_0x1f6daa){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x30'),_0x54e347[_0x44d4('0x1b')]),_0x1f6daa);}});ami['on'](_0x44d4('0x31'),function(_0x470e09){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')]('[%s][index][blindtransfer]',_0x470e09[_0x44d4('0x1b')]),_0x470e09);queues[_0x44d4('0x31')](_0x470e09);agents['blindtransfer'](_0x470e09);transfers[_0x44d4('0x31')](_0x470e09);}catch(_0x5a61cd){utils[_0x44d4('0x11')](util[_0x44d4('0x16')]('[%s][index][blindtransfer]',_0x470e09['uniqueid']),_0x5a61cd);}});ami['on'](_0x44d4('0x32'),function(_0x4ad287){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')](_0x44d4('0x33'),_0x4ad287[_0x44d4('0x34')]),_0x4ad287);queues['attendedtransfer'](_0x4ad287);transfers[_0x44d4('0x32')](_0x4ad287);agents[_0x44d4('0x32')](_0x4ad287);calls['attendedtransfer'](_0x4ad287);}catch(_0x237a1d){utils[_0x44d4('0x11')](util['format'](_0x44d4('0x33'),_0x4ad287[_0x44d4('0x34')]),_0x237a1d);}});ami['on'](_0x44d4('0x35'),function(_0x298b88){try{utils['debug'](util[_0x44d4('0x16')](_0x44d4('0x36'),_0x298b88['uniqueid']),_0x298b88);queues[_0x44d4('0x35')](_0x298b88);recordings[_0x44d4('0x35')](_0x298b88);calls[_0x44d4('0x35')](_0x298b88);dials['varset'](_0x298b88);}catch(_0x434be5){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x36'),_0x298b88[_0x44d4('0x1b')]),_0x434be5);}});ami['on'](_0x44d4('0x37'),function(_0x4aa485){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')](_0x44d4('0x38'),_0x4aa485[_0x44d4('0x1b')]),_0x4aa485);calls['newexten'](_0x4aa485);recordings[_0x44d4('0x37')](_0x4aa485);dials['newexten'](_0x4aa485);}catch(_0x66fae3){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x38'),_0x4aa485['uniqueid']),_0x66fae3);}});ami['on'](_0x44d4('0x39'),function(_0x452ad3){try{utils['debug'](util[_0x44d4('0x16')]('[%s][index][newchannel]',_0x452ad3[_0x44d4('0x1b')]),_0x452ad3);calls[_0x44d4('0x39')](_0x452ad3);recordings[_0x44d4('0x39')](_0x452ad3);}catch(_0x1bf9b5){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x3a'),_0x452ad3['uniqueid']),_0x1bf9b5);}});ami['on']('dialbegin',function(_0x291149){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')](_0x44d4('0x3b'),_0x291149[_0x44d4('0x1b')]),_0x291149);dials[_0x44d4('0x3c')](_0x291149);}catch(_0x34a8ba){utils['error'](util[_0x44d4('0x16')](_0x44d4('0x3d'),_0x291149[_0x44d4('0x1b')]),_0x34a8ba);}});ami['on'](_0x44d4('0x3e'),function(_0x4c4bdc){try{utils[_0x44d4('0x15')](util[_0x44d4('0x16')](_0x44d4('0x3f'),_0x4c4bdc['uniqueid']),_0x4c4bdc);dials['dialend'](_0x4c4bdc);}catch(_0x357f6d){utils[_0x44d4('0x11')](util[_0x44d4('0x16')](_0x44d4('0x3f'),_0x4c4bdc[_0x44d4('0x1b')]),_0x357f6d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index f259a93..a6753c5 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 _0xd14a=['format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','split','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data3','data1','destinationchannel','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Queue:','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd14a,0x1be));var _0xad14=function(_0x116e20,_0x1f5561){_0x116e20=_0x116e20-0x0;var _0x22edb2=_0xd14a[_0x116e20];return _0x22edb2;};'use strict';var _=require(_0xad14('0x0'));var util=require(_0xad14('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0xad14('0x2')];function writeDB(_0x1d4eef){utils[_0xad14('0x3')](util[_0xad14('0x4')](_0xad14('0x5'),_0x1d4eef[_0xad14('0x6')],_0x1d4eef[_0xad14('0x7')],_0x1d4eef[_0xad14('0x8')],_0x1d4eef[_0xad14('0x9')],_0x1d4eef['membername'],_0x1d4eef[_0xad14('0xa')]));if(_0x1d4eef[_0xad14('0x7')]){utils[_0xad14('0xb')](_0x1d4eef[_0xad14('0x7')])[_0xad14('0xc')](function(_0x36f1e2){if(_0x36f1e2){_0x1d4eef[_0xad14('0xd')]=_0x36f1e2[_0xad14('0xe')];_0x1d4eef[_0xad14('0xf')]=_0x36f1e2[_0xad14('0xf')];utils[_0xad14('0x10')](_0xad14('0x11'),_0x1d4eef);}else{utils['getUserByName'](_0x1d4eef['interface'][_0xad14('0x12')]('/')[0x1])[_0xad14('0xc')](function(_0x2ed9cd){if(_0x2ed9cd){_0x1d4eef[_0xad14('0xd')]=_0x2ed9cd[_0xad14('0xe')];_0x1d4eef[_0xad14('0xf')]=_0x2ed9cd[_0xad14('0xf')];utils['request'](_0xad14('0x11'),_0x1d4eef);}});}})[_0xad14('0x13')](function(_0x4ba096){utils[_0xad14('0x14')](util[_0xad14('0x4')](_0xad14('0x15'),_0x1d4eef[_0xad14('0x6')]),_0x4ba096);});}delete members[_0x1d4eef['interface']];}function startsWith(_0x1eaa66,_0x474a93){return _[_0xad14('0x16')](_0x1eaa66,function(_0x1dad15){return _[_0xad14('0x17')](_0x474a93,_0x1dad15);});}exports['devicestatechange']=function(_0x13464f){try{utils[_0xad14('0x18')](util[_0xad14('0x4')](_0xad14('0x19'),members[_0x13464f[_0xad14('0x1a')]]?members[_0x13464f['device']][_0xad14('0x6')]:_0x13464f[_0xad14('0x1a')]),_0x13464f);utils['info'](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x13464f[_0xad14('0x1a')]]?members[_0x13464f[_0xad14('0x1a')]][_0xad14('0x6')]:_0x13464f[_0xad14('0x1a')],_0x13464f[_0xad14('0x1b')],_0x13464f[_0xad14('0x1a')]));switch(_0x13464f[_0xad14('0x1b')]){case'INUSE':case _0xad14('0x1c'):if(!startsWith(exclude,_0x13464f[_0xad14('0x1a')])){members[_0x13464f[_0xad14('0x1a')]]={'channel':_0xad14('0x1d'),'interface':_0x13464f['device'],'type':_0xad14('0x1e'),'enterAt':utils[_0xad14('0x1f')](),'role':_0xad14('0x20')};}break;case _0xad14('0x21'):if(!_[_0xad14('0x22')](members[_0x13464f[_0xad14('0x1a')]])){members[_0x13464f['device']]['exitAt']=utils[_0xad14('0x1f')]();members[_0x13464f[_0xad14('0x1a')]][_0xad14('0x23')]=utils[_0xad14('0x24')](members[_0x13464f[_0xad14('0x1a')]][_0xad14('0x25')],members[_0x13464f[_0xad14('0x1a')]][_0xad14('0x26')]);if(members[_0x13464f[_0xad14('0x1a')]][_0xad14('0x6')]){writeDB(members[_0x13464f[_0xad14('0x1a')]]);}}break;default:break;}}catch(_0x597228){utils['error'](util['format'](_0xad14('0x19'),members[_0x13464f[_0xad14('0x1a')]]?members[_0x13464f[_0xad14('0x1a')]][_0xad14('0x6')]:_0x13464f['device']),_0x597228);}};exports['agentcomplete']=function(_0x1c2627){try{if(!_['isNil'](members[_0x1c2627[_0xad14('0x7')]])){utils[_0xad14('0x18')](util[_0xad14('0x4')](_0xad14('0x27'),_0x1c2627[_0xad14('0x6')]),_0x1c2627);utils[_0xad14('0x3')](util[_0xad14('0x4')](_0xad14('0x28'),_0x1c2627[_0xad14('0x6')],_0x1c2627[_0xad14('0x7')],_0x1c2627[_0xad14('0x29')]));members[_0x1c2627['interface']]=_[_0xad14('0x2a')](members[_0x1c2627['interface']],{'data4':_0x1c2627[_0xad14('0x29')],'uniqueid':_0x1c2627['uniqueid']});}}catch(_0x3c8276){utils['error'](util[_0xad14('0x4')](_0xad14('0x27'),_0x1c2627[_0xad14('0x6')]),_0x3c8276);}};exports[_0xad14('0x2b')]=function(_0x5ab5ce){try{utils[_0xad14('0x18')](util[_0xad14('0x4')]('[%s][members][cdr]',_0x5ab5ce[_0xad14('0x6')]),_0x5ab5ce);if(_0x5ab5ce[_0xad14('0x8')]){var _0x558159=_0x5ab5ce[_0xad14('0x8')]['split']('-')[0x0];if(!_[_0xad14('0x22')](members[_0x558159])){members[_0x558159]=_[_0xad14('0x2a')](members[_0x558159],{'data1':members[_0x558159]['data1']||_0x5ab5ce['type'],'data2':members[_0x558159]['data2']||_0x5ab5ce['source'],'data3':members[_0x558159][_0xad14('0x2c')]||_0x5ab5ce['destination'],'uniqueid':members[_0x558159][_0xad14('0x6')]||_0x5ab5ce[_0xad14('0x6')]});utils['info'](util[_0xad14('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5ab5ce['uniqueid'],members[_0x558159][_0xad14('0x2d')],members[_0x558159][_0xad14('0x9')],members[_0x558159][_0xad14('0x2c')]));if(members[_0x558159][_0xad14('0x25')]){writeDB(members[_0x558159]);}}}if(_0x5ab5ce[_0xad14('0x2e')]){var _0x28c3ba=_0x5ab5ce['destinationchannel']['split']('-')[0x0];if(!_[_0xad14('0x22')](members[_0x28c3ba])){members[_0x28c3ba]=_['assign'](members[_0x28c3ba],{'data1':members[_0x28c3ba][_0xad14('0x2d')]||_0x5ab5ce[_0xad14('0xa')],'data2':members[_0x28c3ba][_0xad14('0x9')]||_0x5ab5ce[_0xad14('0x2f')],'data3':members[_0x28c3ba][_0xad14('0x2c')]||_0x5ab5ce[_0xad14('0x30')],'uniqueid':members[_0x28c3ba][_0xad14('0x6')]||_0x5ab5ce[_0xad14('0x6')]});utils[_0xad14('0x3')](util[_0xad14('0x4')](_0xad14('0x31'),_0x5ab5ce['uniqueid'],members[_0x28c3ba]['data1'],members[_0x28c3ba]['data2'],members[_0x28c3ba][_0xad14('0x2c')]));if(members[_0x28c3ba][_0xad14('0x25')]){writeDB(members[_0x28c3ba]);}}}}catch(_0x1cebe2){utils[_0xad14('0x14')](util[_0xad14('0x4')]('[%s][members][cdr]',_0x5ab5ce[_0xad14('0x6')]),_0x1cebe2);}}; \ No newline at end of file +var _0x90ae=['Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','voice','TALKING','now','NOT_INUSE','exitAt','duration','enterAt','error','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','lodash','util','./utils'];(function(_0x5c8eea,_0xad222b){var _0x5980d3=function(_0x353056){while(--_0x353056){_0x5c8eea['push'](_0x5c8eea['shift']());}};_0x5980d3(++_0xad222b);}(_0x90ae,0x195));var _0xe90a=function(_0x529820,_0x246f6d){_0x529820=_0x529820-0x0;var _0x223a4d=_0x90ae[_0x529820];return _0x223a4d;};'use strict';var _=require(_0xe90a('0x0'));var util=require(_0xe90a('0x1'));var utils=require(_0xe90a('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xe90a('0x3')];function writeDB(_0x2eb615){utils[_0xe90a('0x4')](util[_0xe90a('0x5')](_0xe90a('0x6'),_0x2eb615[_0xe90a('0x7')],_0x2eb615[_0xe90a('0x8')],_0x2eb615[_0xe90a('0x9')],_0x2eb615[_0xe90a('0xa')],_0x2eb615['membername'],_0x2eb615[_0xe90a('0xb')]));if(_0x2eb615[_0xe90a('0x8')]){utils[_0xe90a('0xc')](_0x2eb615[_0xe90a('0x8')])[_0xe90a('0xd')](function(_0x2602fa){if(_0x2602fa){_0x2eb615['membername']=_0x2602fa[_0xe90a('0xe')];_0x2eb615[_0xe90a('0xf')]=_0x2602fa[_0xe90a('0xf')];utils[_0xe90a('0x10')](_0xe90a('0x11'),_0x2eb615);}else{utils[_0xe90a('0x12')](_0x2eb615[_0xe90a('0x8')]['split']('/')[0x1])[_0xe90a('0xd')](function(_0x3da327){if(_0x3da327){_0x2eb615['membername']=_0x3da327['name'];_0x2eb615[_0xe90a('0xf')]=_0x3da327[_0xe90a('0xf')];utils['request'](_0xe90a('0x11'),_0x2eb615);}});}})[_0xe90a('0x13')](function(_0x20ea41){utils['error'](util[_0xe90a('0x5')](_0xe90a('0x14'),_0x2eb615['uniqueid']),_0x20ea41);});}delete members[_0x2eb615[_0xe90a('0x8')]];}function startsWith(_0x53969d,_0x5342d7){return _['some'](_0x53969d,function(_0x3061fb){return _[_0xe90a('0x15')](_0x5342d7,_0x3061fb);});}exports[_0xe90a('0x16')]=function(_0x22602f){try{utils[_0xe90a('0x17')](util[_0xe90a('0x5')](_0xe90a('0x18'),members[_0x22602f[_0xe90a('0x19')]]?members[_0x22602f[_0xe90a('0x19')]][_0xe90a('0x7')]:_0x22602f[_0xe90a('0x19')]),_0x22602f);utils[_0xe90a('0x4')](util[_0xe90a('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x22602f[_0xe90a('0x19')]]?members[_0x22602f[_0xe90a('0x19')]][_0xe90a('0x7')]:_0x22602f[_0xe90a('0x19')],_0x22602f['state'],_0x22602f[_0xe90a('0x19')]));switch(_0x22602f[_0xe90a('0x1a')]){case _0xe90a('0x1b'):case'BUSY':if(!startsWith(exclude,_0x22602f[_0xe90a('0x19')])){members[_0x22602f[_0xe90a('0x19')]]={'channel':_0xe90a('0x1c'),'interface':_0x22602f[_0xe90a('0x19')],'type':_0xe90a('0x1d'),'enterAt':utils[_0xe90a('0x1e')](),'role':'agent'};}break;case _0xe90a('0x1f'):if(!_['isNil'](members[_0x22602f[_0xe90a('0x19')]])){members[_0x22602f[_0xe90a('0x19')]][_0xe90a('0x20')]=utils[_0xe90a('0x1e')]();members[_0x22602f[_0xe90a('0x19')]][_0xe90a('0x21')]=utils['diffTime'](members[_0x22602f[_0xe90a('0x19')]][_0xe90a('0x20')],members[_0x22602f['device']][_0xe90a('0x22')]);if(members[_0x22602f[_0xe90a('0x19')]]['uniqueid']){writeDB(members[_0x22602f[_0xe90a('0x19')]]);}}break;default:break;}}catch(_0xd167a5){utils[_0xe90a('0x23')](util[_0xe90a('0x5')]('[%s][members][devicestatechange]',members[_0x22602f[_0xe90a('0x19')]]?members[_0x22602f[_0xe90a('0x19')]]['uniqueid']:_0x22602f[_0xe90a('0x19')]),_0xd167a5);}};exports[_0xe90a('0x24')]=function(_0x2dac6f){try{if(!_[_0xe90a('0x25')](members[_0x2dac6f[_0xe90a('0x8')]])){utils[_0xe90a('0x17')](util['format'](_0xe90a('0x26'),_0x2dac6f[_0xe90a('0x7')]),_0x2dac6f);utils['info'](util[_0xe90a('0x5')](_0xe90a('0x27'),_0x2dac6f[_0xe90a('0x7')],_0x2dac6f[_0xe90a('0x8')],_0x2dac6f[_0xe90a('0x28')]));members[_0x2dac6f[_0xe90a('0x8')]]=_[_0xe90a('0x29')](members[_0x2dac6f[_0xe90a('0x8')]],{'data4':_0x2dac6f['queue'],'uniqueid':_0x2dac6f[_0xe90a('0x7')]});}}catch(_0x3ac7b6){utils[_0xe90a('0x23')](util[_0xe90a('0x5')]('[%s][members][agentcomplete]',_0x2dac6f[_0xe90a('0x7')]),_0x3ac7b6);}};exports[_0xe90a('0x2a')]=function(_0x1b9dc9){try{utils[_0xe90a('0x17')](util[_0xe90a('0x5')](_0xe90a('0x2b'),_0x1b9dc9[_0xe90a('0x7')]),_0x1b9dc9);if(_0x1b9dc9[_0xe90a('0x9')]){var _0x9cee5=_0x1b9dc9['channel']['split']('-')[0x0];if(!_[_0xe90a('0x25')](members[_0x9cee5])){members[_0x9cee5]=_[_0xe90a('0x29')](members[_0x9cee5],{'data1':members[_0x9cee5][_0xe90a('0x2c')]||_0x1b9dc9[_0xe90a('0xb')],'data2':members[_0x9cee5]['data2']||_0x1b9dc9[_0xe90a('0x2d')],'data3':members[_0x9cee5][_0xe90a('0x2e')]||_0x1b9dc9[_0xe90a('0x2f')],'uniqueid':members[_0x9cee5][_0xe90a('0x7')]||_0x1b9dc9[_0xe90a('0x7')]});utils[_0xe90a('0x4')](util['format'](_0xe90a('0x30'),_0x1b9dc9[_0xe90a('0x7')],members[_0x9cee5][_0xe90a('0x2c')],members[_0x9cee5][_0xe90a('0xa')],members[_0x9cee5]['data3']));if(members[_0x9cee5][_0xe90a('0x20')]){writeDB(members[_0x9cee5]);}}}if(_0x1b9dc9['destinationchannel']){var _0xb70230=_0x1b9dc9[_0xe90a('0x31')][_0xe90a('0x32')]('-')[0x0];if(!_[_0xe90a('0x25')](members[_0xb70230])){members[_0xb70230]=_['assign'](members[_0xb70230],{'data1':members[_0xb70230][_0xe90a('0x2c')]||_0x1b9dc9[_0xe90a('0xb')],'data2':members[_0xb70230][_0xe90a('0xa')]||_0x1b9dc9['source'],'data3':members[_0xb70230]['data3']||_0x1b9dc9['destination'],'uniqueid':members[_0xb70230][_0xe90a('0x7')]||_0x1b9dc9[_0xe90a('0x7')]});utils[_0xe90a('0x4')](util[_0xe90a('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1b9dc9[_0xe90a('0x7')],members[_0xb70230][_0xe90a('0x2c')],members[_0xb70230][_0xe90a('0xa')],members[_0xb70230][_0xe90a('0x2e')]));if(members[_0xb70230]['exitAt']){writeDB(members[_0xb70230]);}}}}catch(_0x169ca8){utils['error'](util['format'](_0xe90a('0x2b'),_0x1b9dc9['uniqueid']),_0x169ca8);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 21c0968..751e2bf 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 _0x759d=['secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','type','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','queuecallerenterreason','varset','debug','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','destaccountcode','assigned','accountcode','membername','agentcomplete','[%s][queues][agentcomplete]','reason','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfer','transfertype','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','transferexten','transfereelinkedid','clone','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s'];(function(_0x5244bb,_0x4b1940){var _0x132555=function(_0x135a24){while(--_0x135a24){_0x5244bb['push'](_0x5244bb['shift']());}};_0x132555(++_0x4b1940);}(_0x759d,0x1a1));var _0xd759=function(_0x5c2063,_0x13d1a5){_0x5c2063=_0x5c2063-0x0;var _0x26fde6=_0x759d[_0x5c2063];return _0x26fde6;};'use strict';var _=require('lodash');var util=require(_0xd759('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x2f5cf2){utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0x3'),_0x2f5cf2[_0xd759('0x4')],_0x2f5cf2['channel'],_0x2f5cf2['queue'],_0x2f5cf2[_0xd759('0x5')],_0x2f5cf2[_0xd759('0x6')],_0x2f5cf2['accountcode'],_0x2f5cf2[_0xd759('0x7')]));if(_0x2f5cf2[_0xd759('0x8')]){utils[_0xd759('0x9')](_0x2f5cf2[_0xd759('0x8')])['then'](function(_0x31ae7c){if(_0x31ae7c){_0x2f5cf2[_0xd759('0xa')]=_0x31ae7c[_0xd759('0xa')];}utils['request'](_0xd759('0xb'),_0x2f5cf2);});}else{utils['request'](_0xd759('0xb'),_0x2f5cf2);}if(_0x2f5cf2[_0xd759('0xc')]){delete queues[_0x2f5cf2[_0xd759('0xc')]];}else{delete queues[_0x2f5cf2[_0xd759('0x4')]];}}exports['queuecallerjoin']=function(_0x3b59a3){try{utils['debug'](util[_0xd759('0x2')](_0xd759('0xd'),_0x3b59a3[_0xd759('0x4')]),_0x3b59a3);utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0xe'),_0x3b59a3[_0xd759('0x4')],_0x3b59a3['queue'],_0x3b59a3['position']));queues[_0x3b59a3[_0xd759('0x4')]]=_[_0xd759('0xf')](_0x3b59a3,{'originalposition':_0x3b59a3[_0xd759('0x10')],'queuecallerjoinAt':utils[_0xd759('0x11')](),'mohtime':0x0});}catch(_0x48aeb0){utils[_0xd759('0x12')](util[_0xd759('0x2')](_0xd759('0xd'),_0x3b59a3[_0xd759('0x4')]),_0x48aeb0);}};exports[_0xd759('0x13')]=function(_0x1d8ca4){try{if(!_[_0xd759('0x14')](queues[_0x1d8ca4['uniqueid']])){utils['debug'](util[_0xd759('0x2')](_0xd759('0x15'),_0x1d8ca4['uniqueid']),_0x1d8ca4);if(queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0x16')]){if(!queues[_0x1d8ca4['uniqueid']][_0xd759('0x17')]&&!queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0x18')]){queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0x19')]=!![];queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0x1a')]=utils[_0xd759('0x11')]();queues[_0x1d8ca4['uniqueid']][_0xd759('0x7')]=_0xd759('0x1b');}utils[_0xd759('0x1')](util[_0xd759('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x1d8ca4[_0xd759('0x4')],queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0x1c')],queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0x7')]));writeDB(queues[_0x1d8ca4[_0xd759('0x4')]]);}else if(queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0xc')]){utils[_0xd759('0x1')](util[_0xd759('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x1d8ca4[_0xd759('0x4')],queues[_0x1d8ca4['uniqueid']]['name'],queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0xc')]));queues[queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0xc')]]=queues[_0x1d8ca4['uniqueid']];queues[queues[_0x1d8ca4[_0xd759('0x4')]][_0xd759('0xc')]][_0xd759('0x1d')]=0x2;delete queues[_0x1d8ca4[_0xd759('0x4')]];}}}catch(_0x41e09e){utils['error'](util[_0xd759('0x2')](_0xd759('0x15'),_0x1d8ca4['uniqueid']),_0x41e09e);}};exports[_0xd759('0x1e')]=function(_0x356c6a){try{utils[_0xd759('0x1f')](util[_0xd759('0x2')](_0xd759('0x20'),_0x356c6a[_0xd759('0x4')]),_0x356c6a);if(!_['isNil'](_0x356c6a[_0xd759('0x21')][_0xd759('0x22')])&&_0x356c6a[_0xd759('0x23')][_0xd759('0x24')]()!==_0xd759('0x25')){if(!_[_0xd759('0x14')](queues[_0x356c6a[_0xd759('0x4')]])){queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x17')]=![];queues[_0x356c6a[_0xd759('0x4')]]['queuecallerabandonAt']=null;queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x18')]=!![];queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x26')]=utils[_0xd759('0x11')]();queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x7')]=_0x356c6a[_0xd759('0x23')][_0xd759('0x24')]();utils[_0xd759('0x1')](util['format'](_0xd759('0x27'),_0x356c6a[_0xd759('0x4')],queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x1c')],_0x356c6a[_0xd759('0x23')],queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x7')]));writeDB(queues[_0x356c6a[_0xd759('0x4')]]);}}else if(!_[_0xd759('0x14')](_0x356c6a['variable']['queueposition'])){if(!_[_0xd759('0x14')](queues[_0x356c6a[_0xd759('0x4')]])&&!queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x17')]){queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x17')]=![];queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x28')]=null;queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x18')]=!![];queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x26')]=utils[_0xd759('0x11')]();queues[_0x356c6a['uniqueid']][_0xd759('0x7')]=_0xd759('0x29');utils['info'](util[_0xd759('0x2')](_0xd759('0x2a'),_0x356c6a[_0xd759('0x4')],queues[_0x356c6a[_0xd759('0x4')]]['name'],_0x356c6a[_0xd759('0x23')],queues[_0x356c6a[_0xd759('0x4')]][_0xd759('0x7')]));}}}catch(_0x4e2a71){utils[_0xd759('0x12')](util[_0xd759('0x2')]('[%s][queues][varset]',_0x356c6a[_0xd759('0x4')]),_0x4e2a71);}};exports[_0xd759('0x17')]=function(_0x2fecc7){try{if(!_[_0xd759('0x14')](queues[_0x2fecc7[_0xd759('0x4')]])){utils[_0xd759('0x1f')](util[_0xd759('0x2')](_0xd759('0x2b'),_0x2fecc7[_0xd759('0x4')]),_0x2fecc7);queues[_0x2fecc7[_0xd759('0x4')]][_0xd759('0x18')]=![];queues[_0x2fecc7['uniqueid']][_0xd759('0x26')]=null;queues[_0x2fecc7[_0xd759('0x4')]]['queuecallerabandon']=!![];queues[_0x2fecc7[_0xd759('0x4')]][_0xd759('0x28')]=utils['now']();queues[_0x2fecc7[_0xd759('0x4')]]['queuecallerexitreason']=_0xd759('0x2c');utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0x2d'),_0x2fecc7[_0xd759('0x4')],queues[_0x2fecc7[_0xd759('0x4')]]['name'],queues[_0x2fecc7['uniqueid']][_0xd759('0x7')]));}}catch(_0x2b0152){utils['error'](util[_0xd759('0x2')](_0xd759('0x2b'),_0x2fecc7[_0xd759('0x4')]),_0x2b0152);}};exports[_0xd759('0x2e')]=function(_0x376bfa){try{if(!_[_0xd759('0x14')](queues[_0x376bfa[_0xd759('0x4')]])){utils[_0xd759('0x1f')](util[_0xd759('0x2')](_0xd759('0x2f'),_0x376bfa[_0xd759('0x4')]),_0x376bfa);utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0x30'),_0x376bfa[_0xd759('0x4')],queues[_0x376bfa[_0xd759('0x4')]][_0xd759('0x1c')],_0x376bfa['connectedlinenum'],_0x376bfa[_0xd759('0x31')]));queues[_0x376bfa[_0xd759('0x4')]][_0xd759('0x2e')]=!![];queues[_0x376bfa['uniqueid']][_0xd759('0x16')]=utils[_0xd759('0x11')]();queues[_0x376bfa[_0xd759('0x4')]][_0xd759('0x32')]=utils[_0xd759('0x33')](queues[_0x376bfa[_0xd759('0x4')]][_0xd759('0x16')],queues[_0x376bfa[_0xd759('0x4')]][_0xd759('0x34')]);queues[_0x376bfa[_0xd759('0x4')]][_0xd759('0x10')]=_0x376bfa[_0xd759('0x10')];queues[_0x376bfa['uniqueid']][_0xd759('0x35')]=_0x376bfa[_0xd759('0x35')];queues[_0x376bfa['uniqueid']]['connectedlinenum']=_0x376bfa[_0xd759('0x36')];queues[_0x376bfa[_0xd759('0x4')]][_0xd759('0x31')]=_0x376bfa[_0xd759('0x31')];}}catch(_0x88913e){utils[_0xd759('0x12')](util['format'](_0xd759('0x2f'),_0x376bfa['uniqueid']),_0x88913e);}};exports['agentconnect']=function(_0xd03341){try{if(!_['isNil'](queues[_0xd03341[_0xd759('0x4')]])){utils['debug'](util[_0xd759('0x2')](_0xd759('0x37'),_0xd03341[_0xd759('0x4')]),_0xd03341);utils[_0xd759('0x1')](util[_0xd759('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xd03341[_0xd759('0x4')],queues[_0xd03341[_0xd759('0x4')]]['name'],_0xd03341['membername'],_0xd03341[_0xd759('0x38')]));queues[_0xd03341['uniqueid']][_0xd759('0x17')]=![];queues[_0xd03341['uniqueid']][_0xd759('0x17')]=![];queues[_0xd03341['uniqueid']][_0xd759('0x28')]=null;queues[_0xd03341[_0xd759('0x4')]]['queuecallerexit']=![];queues[_0xd03341[_0xd759('0x4')]][_0xd759('0x7')]=null;queues[_0xd03341[_0xd759('0x4')]][_0xd759('0x26')]=null;queues[_0xd03341[_0xd759('0x4')]][_0xd759('0x39')]=!![];queues[_0xd03341[_0xd759('0x4')]][_0xd759('0x3a')]=_0xd03341['destaccountcode'];queues[_0xd03341[_0xd759('0x4')]]['lastAssignedTo']=_0xd03341[_0xd759('0x3b')];}}catch(_0x489409){utils[_0xd759('0x12')](util[_0xd759('0x2')](_0xd759('0x37'),_0xd03341['uniqueid']),_0x489409);}};exports[_0xd759('0x3c')]=function(_0x3b4995){try{if(!_[_0xd759('0x14')](queues[_0x3b4995[_0xd759('0x4')]])){if(queues[_0x3b4995[_0xd759('0x4')]][_0xd759('0x16')]){utils[_0xd759('0x1f')](util[_0xd759('0x2')](_0xd759('0x3d'),_0x3b4995[_0xd759('0x4')]),_0x3b4995);queues[_0x3b4995[_0xd759('0x4')]][_0xd759('0x17')]=![];queues[_0x3b4995['uniqueid']][_0xd759('0x17')]=![];queues[_0x3b4995[_0xd759('0x4')]][_0xd759('0x28')]=null;queues[_0x3b4995[_0xd759('0x4')]][_0xd759('0x18')]=![];queues[_0x3b4995[_0xd759('0x4')]]['queuecallerexitAt']=null;queues[_0x3b4995['uniqueid']][_0xd759('0x39')]=!![];queues[_0x3b4995['uniqueid']][_0xd759('0x5')]=_0x3b4995[_0xd759('0x3b')];queues[_0x3b4995[_0xd759('0x4')]]['queuecallercomplete']=!![];queues[_0x3b4995['uniqueid']]['queuecallercompleteAt']=utils[_0xd759('0x11')]();if(_0x3b4995[_0xd759('0x3e')]=='transfer'){if(!queues[_0x3b4995['uniqueid']]['transfer']){queues[_0x3b4995[_0xd759('0x4')]][_0xd759('0x7')]=_0xd759('0x3f');}}else{queues[_0x3b4995['uniqueid']][_0xd759('0x7')]=_0xd759('0x40')+_0x3b4995[_0xd759('0x3e')]['toUpperCase']();}utils[_0xd759('0x1')](util[_0xd759('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3b4995[_0xd759('0x4')],queues[_0x3b4995['uniqueid']]['name'],_0x3b4995[_0xd759('0x3b')],queues[_0x3b4995[_0xd759('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x3b4995[_0xd759('0x4')]]);}}}catch(_0x14b44f){utils[_0xd759('0x12')](util['format'](_0xd759('0x3d'),_0x3b4995[_0xd759('0x4')]),_0x14b44f);}};exports[_0xd759('0x41')]=function(_0x299e08){try{if(!_[_0xd759('0x14')](queues[_0x299e08[_0xd759('0x42')]])){utils[_0xd759('0x1f')](util['format']('[%s][queues][blindtransfer]',_0x299e08[_0xd759('0x4')]),_0x299e08);queues[_0x299e08[_0xd759('0x42')]][_0xd759('0x43')]=!![];queues[_0x299e08[_0xd759('0x42')]][_0xd759('0x44')]='BLIND';queues[_0x299e08[_0xd759('0x42')]]['transferexten']=_0x299e08[_0xd759('0x45')];queues[_0x299e08['transfereeuniqueid']][_0xd759('0x46')]=_0x299e08[_0xd759('0x42')];queues[_0x299e08[_0xd759('0x42')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0x47'),_0x299e08[_0xd759('0x4')],queues[_0x299e08[_0xd759('0x42')]][_0xd759('0x1c')],_0x299e08[_0xd759('0x42')],_0x299e08[_0xd759('0x45')]));}}catch(_0x3e0e20){utils[_0xd759('0x12')](util[_0xd759('0x2')](_0xd759('0x48'),_0x299e08[_0xd759('0x4')]),_0x3e0e20);}};exports[_0xd759('0x49')]=function(_0x54efba){try{utils[_0xd759('0x1f')](util[_0xd759('0x2')](_0xd759('0x4a'),_0x54efba[_0xd759('0x4b')]),_0x54efba);if(_0x54efba[_0xd759('0x4b')]==_0x54efba[_0xd759('0x4c')]){if(!_[_0xd759('0x14')](queues[_0x54efba['secondtransfererlinkedid']])){utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0x4d'),_0x54efba[_0xd759('0x4b')],queues[_0x54efba[_0xd759('0x4e')]]['name'],_0x54efba['origtransfererexten']));queues[_0x54efba[_0xd759('0x4e')]]['transfer']=!![];queues[_0x54efba['secondtransfererlinkedid']][_0xd759('0x44')]=_0xd759('0x4f');queues[_0x54efba['secondtransfererlinkedid']][_0xd759('0x50')]=_0x54efba['origtransfererexten'];queues[_0x54efba['secondtransfererlinkedid']][_0xd759('0x46')]=_0x54efba[_0xd759('0x4b')];queues[_0x54efba['secondtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xd759('0x14')](queues[_0x54efba[_0xd759('0x4c')]])){if(_0x54efba[_0xd759('0x51')]&&queues[_0x54efba[_0xd759('0x51')]]){queues[_0x54efba[_0xd759('0x51')]][_0xd759('0x1d')]=0x1;queues[_0x54efba['transfereeuniqueid']]=_[_0xd759('0x52')](queues[_0x54efba[_0xd759('0x51')]]);queues[_0x54efba['transfereeuniqueid']][_0xd759('0xc')]=_0x54efba[_0xd759('0x53')];queues[_0x54efba['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x54efba[_0xd759('0x42')]][_0xd759('0x6')]=queues[_0x54efba['secondtransfererlinkedid']][_0xd759('0x6')];queues[_0x54efba['transfereeuniqueid']]['calleridname']=queues[_0x54efba[_0xd759('0x4e')]]['calleridname'];queues[_0x54efba[_0xd759('0x42')]][_0xd759('0x34')]=utils['now']();queues[_0x54efba[_0xd759('0x42')]][_0xd759('0x16')]=utils[_0xd759('0x11')]();queues[_0x54efba['transfereeuniqueid']][_0xd759('0x32')]=0x0;queues[_0x54efba[_0xd759('0x42')]][_0xd759('0x54')]=0x0;utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0x55'),_0x54efba[_0xd759('0x4b')],queues[_0x54efba[_0xd759('0x42')]][_0xd759('0x1c')],queues[_0x54efba[_0xd759('0x42')]]['calleridnum'],queues[_0x54efba[_0xd759('0x42')]][_0xd759('0x56')]));}else{utils[_0xd759('0x1')](util['format'](_0xd759('0x57'),_0x54efba['origtransfereruniqueid'],queues[_0x54efba['origtransfererlinkedid']][_0xd759('0x1c')],_0x54efba[_0xd759('0x4e')]));queues[_0x54efba[_0xd759('0x4c')]]['transfereduniqueid']=_0x54efba[_0xd759('0x4e')];}}}else if(_0x54efba[_0xd759('0x58')]==_0x54efba[_0xd759('0x4e')]){if(!_[_0xd759('0x14')](queues[_0x54efba[_0xd759('0x4c')]])){utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0x59'),_0x54efba[_0xd759('0x4b')],queues[_0x54efba[_0xd759('0x4c')]][_0xd759('0x1c')],_0x54efba['secondtransfereruniqueid'],_0x54efba['secondtransfererexten']));queues[_0x54efba[_0xd759('0x4c')]]['transfer']=!![];queues[_0x54efba[_0xd759('0x4c')]]['transfertype']=_0xd759('0x4f');queues[_0x54efba['origtransfererlinkedid']]['transferexten']=_0x54efba[_0xd759('0x5a')];queues[_0x54efba['origtransfererlinkedid']]['transferuniqueid']=_0x54efba[_0xd759('0x58')];queues[_0x54efba[_0xd759('0x4c')]][_0xd759('0x7')]=_0xd759('0x5b');}if(!_[_0xd759('0x14')](queues[_0x54efba[_0xd759('0x4e')]])){if(_0x54efba[_0xd759('0x5c')]&&queues[_0x54efba[_0xd759('0x5c')]]){queues[_0x54efba['transfertargetlinkedid']][_0xd759('0x1d')]=0x1;queues[_0x54efba[_0xd759('0x53')]]=_['clone'](queues[_0x54efba['transfertargetlinkedid']]);queues[_0x54efba[_0xd759('0x53')]][_0xd759('0xc')]=_0x54efba[_0xd759('0x53')];queues[_0x54efba['transfertargetuniqueid']][_0xd759('0x1d')]=0x2;queues[_0x54efba[_0xd759('0x53')]][_0xd759('0x6')]=queues[_0x54efba['origtransfererlinkedid']][_0xd759('0x6')];queues[_0x54efba[_0xd759('0x53')]][_0xd759('0x56')]=queues[_0x54efba[_0xd759('0x4c')]]['calleridname'];queues[_0x54efba[_0xd759('0x53')]][_0xd759('0x34')]=utils['now']();queues[_0x54efba[_0xd759('0x53')]][_0xd759('0x16')]=utils[_0xd759('0x11')]();queues[_0x54efba['transfertargetuniqueid']][_0xd759('0x32')]=0x0;queues[_0x54efba['transfertargetuniqueid']][_0xd759('0x54')]=0x0;utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0x5d'),_0x54efba['origtransfereruniqueid'],queues[_0x54efba[_0xd759('0x53')]]['name'],queues[_0x54efba[_0xd759('0x53')]][_0xd759('0xc')],queues[_0x54efba[_0xd759('0x53')]][_0xd759('0x6')],queues[_0x54efba[_0xd759('0x53')]][_0xd759('0x56')]));}else{utils['info'](util[_0xd759('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x54efba['origtransfereruniqueid'],queues[_0x54efba[_0xd759('0x4e')]]['name'],_0x54efba[_0xd759('0x4c')]));queues[_0x54efba['secondtransfererlinkedid']][_0xd759('0xc')]=_0x54efba[_0xd759('0x4c')];}}}}catch(_0x4bb861){utils[_0xd759('0x12')](util[_0xd759('0x2')]('[%s][queues][attendedtransfer]',_0x54efba[_0xd759('0x4b')]),_0x4bb861);}};exports[_0xd759('0x5e')]=function(_0x1669c2){try{if(!_['isNil'](queues[_0x1669c2[_0xd759('0x4')]])){utils[_0xd759('0x1f')](util[_0xd759('0x2')]('[%s][queues][musiconholdstart]',_0x1669c2['uniqueid']),_0x1669c2);queues[_0x1669c2['uniqueid']][_0xd759('0x5f')]=utils[_0xd759('0x11')]();utils[_0xd759('0x1')](util['format'](_0xd759('0x60'),_0x1669c2[_0xd759('0x4')],queues[_0x1669c2[_0xd759('0x4')]][_0xd759('0x1c')],queues[_0x1669c2[_0xd759('0x4')]][_0xd759('0x5f')]));}}catch(_0x2afaef){utils[_0xd759('0x12')](util[_0xd759('0x2')](_0xd759('0x61'),_0x1669c2['uniqueid']),_0x2afaef);}};exports[_0xd759('0x62')]=function(_0x130efd){try{if(!_[_0xd759('0x14')](queues[_0x130efd[_0xd759('0x4')]])){if(!_[_0xd759('0x14')](queues[_0x130efd[_0xd759('0x4')]][_0xd759('0x5f')])){utils[_0xd759('0x1f')](util[_0xd759('0x2')]('[%s][queues][musiconholdstop]',_0x130efd[_0xd759('0x4')]),_0x130efd);queues[_0x130efd[_0xd759('0x4')]][_0xd759('0x54')]+=utils[_0xd759('0x33')](utils['now'](),queues[_0x130efd['uniqueid']]['musiconholdstartAt']);utils[_0xd759('0x1')](util[_0xd759('0x2')](_0xd759('0x63'),_0x130efd[_0xd759('0x4')],queues[_0x130efd['uniqueid']][_0xd759('0x1c')],queues[_0x130efd['uniqueid']]['mohtime']));delete queues[_0x130efd[_0xd759('0x4')]][_0xd759('0x5f')];}}}catch(_0x492817){utils[_0xd759('0x12')](util[_0xd759('0x2')](_0xd759('0x64'),_0x130efd[_0xd759('0x4')]),_0x492817);}}; \ No newline at end of file +var _0x6371=['queuecallerabandon','queuecallerabandonAt','info','name','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','assigned','destaccountcode','membername','agentcomplete','lastAssignedTo','reason','transfer','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','./utils','format','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','isNil','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','variable','queuestatus','value','CONTINUE'];(function(_0x4ef88b,_0x272542){var _0xba292=function(_0x1411c4){while(--_0x1411c4){_0x4ef88b['push'](_0x4ef88b['shift']());}};_0xba292(++_0x272542);}(_0x6371,0x1d4));var _0x1637=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x6371[_0x389832];return _0x59429e;};'use strict';var _=require(_0x1637('0x0'));var util=require('util');var utils=require(_0x1637('0x1'));var queues={};function writeDB(_0x42ff3a){utils['info'](util[_0x1637('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x42ff3a[_0x1637('0x3')],_0x42ff3a[_0x1637('0x4')],_0x42ff3a[_0x1637('0x5')],_0x42ff3a['lastAssignedTo'],_0x42ff3a[_0x1637('0x6')],_0x42ff3a[_0x1637('0x7')],_0x42ff3a[_0x1637('0x8')]));if(_0x42ff3a[_0x1637('0x5')]){utils['getVoiceQueueByName'](_0x42ff3a['queue'])[_0x1637('0x9')](function(_0x3c983a){if(_0x3c983a){_0x42ff3a[_0x1637('0xa')]=_0x3c983a['type'];}utils[_0x1637('0xb')](_0x1637('0xc'),_0x42ff3a);});}else{utils[_0x1637('0xb')](_0x1637('0xc'),_0x42ff3a);}if(_0x42ff3a[_0x1637('0xd')]){delete queues[_0x42ff3a[_0x1637('0xd')]];}else{delete queues[_0x42ff3a['uniqueid']];}}exports[_0x1637('0xe')]=function(_0x2bde47){try{utils[_0x1637('0xf')](util[_0x1637('0x2')](_0x1637('0x10'),_0x2bde47[_0x1637('0x3')]),_0x2bde47);utils['info'](util[_0x1637('0x2')](_0x1637('0x11'),_0x2bde47[_0x1637('0x3')],_0x2bde47['queue'],_0x2bde47['position']));queues[_0x2bde47[_0x1637('0x3')]]=_[_0x1637('0x12')](_0x2bde47,{'originalposition':_0x2bde47[_0x1637('0x13')],'queuecallerjoinAt':utils[_0x1637('0x14')](),'mohtime':0x0});}catch(_0x56c9e9){utils[_0x1637('0x15')](util[_0x1637('0x2')](_0x1637('0x10'),_0x2bde47[_0x1637('0x3')]),_0x56c9e9);}};exports['hangup']=function(_0x56604b){try{if(!_[_0x1637('0x16')](queues[_0x56604b[_0x1637('0x3')]])){utils['debug'](util['format']('[%s][queues][hangup]',_0x56604b[_0x1637('0x3')]),_0x56604b);if(queues[_0x56604b[_0x1637('0x3')]][_0x1637('0x17')]){if(!queues[_0x56604b[_0x1637('0x3')]]['queuecallerabandon']&&!queues[_0x56604b[_0x1637('0x3')]][_0x1637('0x18')]){queues[_0x56604b[_0x1637('0x3')]][_0x1637('0x19')]=!![];queues[_0x56604b[_0x1637('0x3')]][_0x1637('0x1a')]=utils[_0x1637('0x14')]();queues[_0x56604b['uniqueid']][_0x1637('0x8')]=_0x1637('0x1b');}utils['info'](util[_0x1637('0x2')](_0x1637('0x1c'),_0x56604b[_0x1637('0x3')],queues[_0x56604b['uniqueid']]['name'],queues[_0x56604b['uniqueid']][_0x1637('0x8')]));writeDB(queues[_0x56604b[_0x1637('0x3')]]);}else if(queues[_0x56604b['uniqueid']][_0x1637('0xd')]){utils['info'](util[_0x1637('0x2')](_0x1637('0x1d'),_0x56604b[_0x1637('0x3')],queues[_0x56604b['uniqueid']]['name'],queues[_0x56604b[_0x1637('0x3')]][_0x1637('0xd')]));queues[queues[_0x56604b[_0x1637('0x3')]][_0x1637('0xd')]]=queues[_0x56604b[_0x1637('0x3')]];queues[queues[_0x56604b[_0x1637('0x3')]][_0x1637('0xd')]][_0x1637('0x1e')]=0x2;delete queues[_0x56604b[_0x1637('0x3')]];}}}catch(_0x2bb34e){utils[_0x1637('0x15')](util['format'](_0x1637('0x1f'),_0x56604b[_0x1637('0x3')]),_0x2bb34e);}};exports['varset']=function(_0x197be1){try{utils[_0x1637('0xf')](util['format'](_0x1637('0x20'),_0x197be1['uniqueid']),_0x197be1);if(!_[_0x1637('0x16')](_0x197be1[_0x1637('0x21')][_0x1637('0x22')])&&_0x197be1[_0x1637('0x23')]['toUpperCase']()!==_0x1637('0x24')){if(!_[_0x1637('0x16')](queues[_0x197be1[_0x1637('0x3')]])){queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x25')]=![];queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x26')]=null;queues[_0x197be1[_0x1637('0x3')]]['queuecallerexit']=!![];queues[_0x197be1[_0x1637('0x3')]]['queuecallerexitAt']=utils[_0x1637('0x14')]();queues[_0x197be1[_0x1637('0x3')]]['queuecallerexitreason']=_0x197be1[_0x1637('0x23')]['toUpperCase']();utils[_0x1637('0x27')](util[_0x1637('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x197be1['uniqueid'],queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x28')],_0x197be1[_0x1637('0x23')],queues[_0x197be1['uniqueid']][_0x1637('0x8')]));writeDB(queues[_0x197be1[_0x1637('0x3')]]);}}else if(!_[_0x1637('0x16')](_0x197be1[_0x1637('0x21')][_0x1637('0x29')])){if(!_[_0x1637('0x16')](queues[_0x197be1[_0x1637('0x3')]])&&!queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x25')]){queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x25')]=![];queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x26')]=null;queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x18')]=!![];queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x2a')]=utils[_0x1637('0x14')]();queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x8')]=_0x1637('0x2b');utils['info'](util[_0x1637('0x2')](_0x1637('0x2c'),_0x197be1[_0x1637('0x3')],queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x28')],_0x197be1[_0x1637('0x23')],queues[_0x197be1[_0x1637('0x3')]][_0x1637('0x8')]));}}}catch(_0x3b5fbf){utils[_0x1637('0x15')](util[_0x1637('0x2')](_0x1637('0x20'),_0x197be1[_0x1637('0x3')]),_0x3b5fbf);}};exports[_0x1637('0x25')]=function(_0x27d755){try{if(!_['isNil'](queues[_0x27d755[_0x1637('0x3')]])){utils[_0x1637('0xf')](util[_0x1637('0x2')](_0x1637('0x2d'),_0x27d755['uniqueid']),_0x27d755);queues[_0x27d755[_0x1637('0x3')]][_0x1637('0x18')]=![];queues[_0x27d755[_0x1637('0x3')]][_0x1637('0x2a')]=null;queues[_0x27d755[_0x1637('0x3')]][_0x1637('0x25')]=!![];queues[_0x27d755[_0x1637('0x3')]][_0x1637('0x26')]=utils[_0x1637('0x14')]();queues[_0x27d755['uniqueid']][_0x1637('0x8')]=_0x1637('0x2e');utils[_0x1637('0x27')](util['format'](_0x1637('0x2f'),_0x27d755[_0x1637('0x3')],queues[_0x27d755['uniqueid']][_0x1637('0x28')],queues[_0x27d755[_0x1637('0x3')]][_0x1637('0x8')]));}}catch(_0x3492f0){utils['error'](util['format'](_0x1637('0x2d'),_0x27d755[_0x1637('0x3')]),_0x3492f0);}};exports[_0x1637('0x30')]=function(_0x6e4b3c){try{if(!_[_0x1637('0x16')](queues[_0x6e4b3c[_0x1637('0x3')]])){utils['debug'](util[_0x1637('0x2')](_0x1637('0x31'),_0x6e4b3c[_0x1637('0x3')]),_0x6e4b3c);utils[_0x1637('0x27')](util[_0x1637('0x2')](_0x1637('0x32'),_0x6e4b3c[_0x1637('0x3')],queues[_0x6e4b3c[_0x1637('0x3')]][_0x1637('0x28')],_0x6e4b3c[_0x1637('0x33')],_0x6e4b3c[_0x1637('0x34')]));queues[_0x6e4b3c[_0x1637('0x3')]]['queuecallerleave']=!![];queues[_0x6e4b3c[_0x1637('0x3')]][_0x1637('0x17')]=utils[_0x1637('0x14')]();queues[_0x6e4b3c[_0x1637('0x3')]][_0x1637('0x35')]=utils[_0x1637('0x36')](queues[_0x6e4b3c['uniqueid']][_0x1637('0x17')],queues[_0x6e4b3c[_0x1637('0x3')]][_0x1637('0x37')]);queues[_0x6e4b3c['uniqueid']][_0x1637('0x13')]=_0x6e4b3c[_0x1637('0x13')];queues[_0x6e4b3c[_0x1637('0x3')]][_0x1637('0x38')]=_0x6e4b3c[_0x1637('0x38')];queues[_0x6e4b3c[_0x1637('0x3')]][_0x1637('0x33')]=_0x6e4b3c[_0x1637('0x33')];queues[_0x6e4b3c[_0x1637('0x3')]][_0x1637('0x34')]=_0x6e4b3c['connectedlinename'];}}catch(_0x3af21f){utils[_0x1637('0x15')](util[_0x1637('0x2')](_0x1637('0x31'),_0x6e4b3c[_0x1637('0x3')]),_0x3af21f);}};exports['agentconnect']=function(_0x52369e){try{if(!_['isNil'](queues[_0x52369e[_0x1637('0x3')]])){utils['debug'](util[_0x1637('0x2')]('[%s][queues][agentconnect]',_0x52369e[_0x1637('0x3')]),_0x52369e);utils[_0x1637('0x27')](util['format'](_0x1637('0x39'),_0x52369e['uniqueid'],queues[_0x52369e[_0x1637('0x3')]]['name'],_0x52369e['membername'],_0x52369e['destaccountcode']));queues[_0x52369e[_0x1637('0x3')]][_0x1637('0x25')]=![];queues[_0x52369e['uniqueid']]['queuecallerabandon']=![];queues[_0x52369e['uniqueid']][_0x1637('0x26')]=null;queues[_0x52369e['uniqueid']][_0x1637('0x18')]=![];queues[_0x52369e[_0x1637('0x3')]][_0x1637('0x8')]=null;queues[_0x52369e[_0x1637('0x3')]][_0x1637('0x2a')]=null;queues[_0x52369e[_0x1637('0x3')]][_0x1637('0x3a')]=!![];queues[_0x52369e[_0x1637('0x3')]]['accountcode']=_0x52369e[_0x1637('0x3b')];queues[_0x52369e[_0x1637('0x3')]]['lastAssignedTo']=_0x52369e[_0x1637('0x3c')];}}catch(_0xa85deb){utils[_0x1637('0x15')](util[_0x1637('0x2')]('[%s][queues][agentconnect]',_0x52369e[_0x1637('0x3')]),_0xa85deb);}};exports[_0x1637('0x3d')]=function(_0x4114cf){try{if(!_[_0x1637('0x16')](queues[_0x4114cf['uniqueid']])){if(queues[_0x4114cf[_0x1637('0x3')]]['queuecallerleaveAt']){utils[_0x1637('0xf')](util[_0x1637('0x2')]('[%s][queues][agentcomplete]',_0x4114cf[_0x1637('0x3')]),_0x4114cf);queues[_0x4114cf['uniqueid']][_0x1637('0x25')]=![];queues[_0x4114cf[_0x1637('0x3')]][_0x1637('0x25')]=![];queues[_0x4114cf[_0x1637('0x3')]]['queuecallerabandonAt']=null;queues[_0x4114cf['uniqueid']][_0x1637('0x18')]=![];queues[_0x4114cf[_0x1637('0x3')]]['queuecallerexitAt']=null;queues[_0x4114cf[_0x1637('0x3')]][_0x1637('0x3a')]=!![];queues[_0x4114cf[_0x1637('0x3')]][_0x1637('0x3e')]=_0x4114cf[_0x1637('0x3c')];queues[_0x4114cf[_0x1637('0x3')]]['queuecallercomplete']=!![];queues[_0x4114cf[_0x1637('0x3')]][_0x1637('0x1a')]=utils[_0x1637('0x14')]();if(_0x4114cf[_0x1637('0x3f')]==_0x1637('0x40')){if(!queues[_0x4114cf[_0x1637('0x3')]][_0x1637('0x40')]){queues[_0x4114cf[_0x1637('0x3')]][_0x1637('0x8')]='TRANSFER';}}else{queues[_0x4114cf[_0x1637('0x3')]][_0x1637('0x8')]=_0x1637('0x41')+_0x4114cf[_0x1637('0x3f')][_0x1637('0x42')]();}utils[_0x1637('0x27')](util[_0x1637('0x2')](_0x1637('0x43'),_0x4114cf[_0x1637('0x3')],queues[_0x4114cf['uniqueid']][_0x1637('0x28')],_0x4114cf['membername'],queues[_0x4114cf[_0x1637('0x3')]][_0x1637('0x8')]));writeDB(queues[_0x4114cf[_0x1637('0x3')]]);}}}catch(_0x17703b){utils[_0x1637('0x15')](util['format'](_0x1637('0x44'),_0x4114cf['uniqueid']),_0x17703b);}};exports['blindtransfer']=function(_0x493a89){try{if(!_[_0x1637('0x16')](queues[_0x493a89['transfereeuniqueid']])){utils[_0x1637('0xf')](util[_0x1637('0x2')]('[%s][queues][blindtransfer]',_0x493a89['uniqueid']),_0x493a89);queues[_0x493a89[_0x1637('0x45')]]['transfer']=!![];queues[_0x493a89[_0x1637('0x45')]][_0x1637('0x46')]=_0x1637('0x47');queues[_0x493a89[_0x1637('0x45')]][_0x1637('0x48')]=_0x493a89[_0x1637('0x49')];queues[_0x493a89[_0x1637('0x45')]][_0x1637('0x4a')]=_0x493a89[_0x1637('0x45')];queues[_0x493a89['transfereeuniqueid']][_0x1637('0x8')]=_0x1637('0x4b');utils['info'](util[_0x1637('0x2')](_0x1637('0x4c'),_0x493a89[_0x1637('0x3')],queues[_0x493a89[_0x1637('0x45')]][_0x1637('0x28')],_0x493a89[_0x1637('0x45')],_0x493a89['extension']));}}catch(_0x173891){utils[_0x1637('0x15')](util[_0x1637('0x2')](_0x1637('0x4d'),_0x493a89[_0x1637('0x3')]),_0x173891);}};exports[_0x1637('0x4e')]=function(_0x5580c2){try{utils[_0x1637('0xf')](util[_0x1637('0x2')](_0x1637('0x4f'),_0x5580c2[_0x1637('0x50')]),_0x5580c2);if(_0x5580c2['origtransfereruniqueid']==_0x5580c2[_0x1637('0x51')]){if(!_['isNil'](queues[_0x5580c2['secondtransfererlinkedid']])){utils[_0x1637('0x27')](util[_0x1637('0x2')](_0x1637('0x52'),_0x5580c2[_0x1637('0x50')],queues[_0x5580c2[_0x1637('0x53')]]['name'],_0x5580c2[_0x1637('0x54')]));queues[_0x5580c2[_0x1637('0x53')]][_0x1637('0x40')]=!![];queues[_0x5580c2['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x5580c2[_0x1637('0x53')]]['transferexten']=_0x5580c2[_0x1637('0x54')];queues[_0x5580c2[_0x1637('0x53')]]['transferuniqueid']=_0x5580c2['origtransfereruniqueid'];queues[_0x5580c2['secondtransfererlinkedid']][_0x1637('0x8')]=_0x1637('0x55');}if(!_[_0x1637('0x16')](queues[_0x5580c2[_0x1637('0x51')]])){if(_0x5580c2['transfereelinkedid']&&queues[_0x5580c2[_0x1637('0x56')]]){queues[_0x5580c2[_0x1637('0x56')]][_0x1637('0x1e')]=0x1;queues[_0x5580c2['transfereeuniqueid']]=_[_0x1637('0x57')](queues[_0x5580c2[_0x1637('0x56')]]);queues[_0x5580c2[_0x1637('0x45')]][_0x1637('0xd')]=_0x5580c2[_0x1637('0x58')];queues[_0x5580c2[_0x1637('0x45')]]['queuecallerenterreason']=0x2;queues[_0x5580c2[_0x1637('0x45')]][_0x1637('0x6')]=queues[_0x5580c2['secondtransfererlinkedid']][_0x1637('0x6')];queues[_0x5580c2[_0x1637('0x45')]]['calleridname']=queues[_0x5580c2[_0x1637('0x53')]][_0x1637('0x59')];queues[_0x5580c2[_0x1637('0x45')]][_0x1637('0x37')]=utils[_0x1637('0x14')]();queues[_0x5580c2[_0x1637('0x45')]][_0x1637('0x17')]=utils['now']();queues[_0x5580c2[_0x1637('0x45')]]['holdtime']=0x0;queues[_0x5580c2[_0x1637('0x45')]][_0x1637('0x5a')]=0x0;utils[_0x1637('0x27')](util[_0x1637('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x5580c2['origtransfereruniqueid'],queues[_0x5580c2[_0x1637('0x45')]]['name'],queues[_0x5580c2[_0x1637('0x45')]][_0x1637('0x6')],queues[_0x5580c2[_0x1637('0x45')]][_0x1637('0x59')]));}else{utils[_0x1637('0x27')](util[_0x1637('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5580c2['origtransfereruniqueid'],queues[_0x5580c2['origtransfererlinkedid']][_0x1637('0x28')],_0x5580c2[_0x1637('0x53')]));queues[_0x5580c2[_0x1637('0x51')]]['transfereduniqueid']=_0x5580c2[_0x1637('0x53')];}}}else if(_0x5580c2[_0x1637('0x5b')]==_0x5580c2['secondtransfererlinkedid']){if(!_[_0x1637('0x16')](queues[_0x5580c2[_0x1637('0x51')]])){utils['info'](util[_0x1637('0x2')](_0x1637('0x5c'),_0x5580c2['origtransfereruniqueid'],queues[_0x5580c2['origtransfererlinkedid']][_0x1637('0x28')],_0x5580c2[_0x1637('0x5b')],_0x5580c2[_0x1637('0x5d')]));queues[_0x5580c2[_0x1637('0x51')]][_0x1637('0x40')]=!![];queues[_0x5580c2['origtransfererlinkedid']][_0x1637('0x46')]=_0x1637('0x5e');queues[_0x5580c2['origtransfererlinkedid']][_0x1637('0x48')]=_0x5580c2[_0x1637('0x5d')];queues[_0x5580c2['origtransfererlinkedid']]['transferuniqueid']=_0x5580c2[_0x1637('0x5b')];queues[_0x5580c2['origtransfererlinkedid']][_0x1637('0x8')]=_0x1637('0x55');}if(!_[_0x1637('0x16')](queues[_0x5580c2[_0x1637('0x53')]])){if(_0x5580c2[_0x1637('0x5f')]&&queues[_0x5580c2[_0x1637('0x5f')]]){queues[_0x5580c2[_0x1637('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x5580c2['transfertargetuniqueid']]=_[_0x1637('0x57')](queues[_0x5580c2[_0x1637('0x5f')]]);queues[_0x5580c2[_0x1637('0x58')]][_0x1637('0xd')]=_0x5580c2[_0x1637('0x58')];queues[_0x5580c2[_0x1637('0x58')]][_0x1637('0x1e')]=0x2;queues[_0x5580c2[_0x1637('0x58')]][_0x1637('0x6')]=queues[_0x5580c2[_0x1637('0x51')]][_0x1637('0x6')];queues[_0x5580c2[_0x1637('0x58')]][_0x1637('0x59')]=queues[_0x5580c2[_0x1637('0x51')]][_0x1637('0x59')];queues[_0x5580c2['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x1637('0x14')]();queues[_0x5580c2['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x1637('0x14')]();queues[_0x5580c2[_0x1637('0x58')]][_0x1637('0x35')]=0x0;queues[_0x5580c2[_0x1637('0x58')]][_0x1637('0x5a')]=0x0;utils[_0x1637('0x27')](util[_0x1637('0x2')](_0x1637('0x60'),_0x5580c2[_0x1637('0x50')],queues[_0x5580c2[_0x1637('0x58')]]['name'],queues[_0x5580c2[_0x1637('0x58')]][_0x1637('0xd')],queues[_0x5580c2['transfertargetuniqueid']]['calleridnum'],queues[_0x5580c2[_0x1637('0x58')]][_0x1637('0x59')]));}else{utils['info'](util['format'](_0x1637('0x61'),_0x5580c2[_0x1637('0x50')],queues[_0x5580c2[_0x1637('0x53')]][_0x1637('0x28')],_0x5580c2[_0x1637('0x51')]));queues[_0x5580c2[_0x1637('0x53')]][_0x1637('0xd')]=_0x5580c2[_0x1637('0x51')];}}}}catch(_0x25f4fa){utils[_0x1637('0x15')](util[_0x1637('0x2')](_0x1637('0x4f'),_0x5580c2['origtransfereruniqueid']),_0x25f4fa);}};exports['musiconholdstart']=function(_0x3b59af){try{if(!_[_0x1637('0x16')](queues[_0x3b59af[_0x1637('0x3')]])){utils['debug'](util[_0x1637('0x2')](_0x1637('0x62'),_0x3b59af[_0x1637('0x3')]),_0x3b59af);queues[_0x3b59af[_0x1637('0x3')]][_0x1637('0x63')]=utils[_0x1637('0x14')]();utils[_0x1637('0x27')](util[_0x1637('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3b59af[_0x1637('0x3')],queues[_0x3b59af['uniqueid']]['name'],queues[_0x3b59af[_0x1637('0x3')]][_0x1637('0x63')]));}}catch(_0x39256e){utils[_0x1637('0x15')](util[_0x1637('0x2')](_0x1637('0x62'),_0x3b59af[_0x1637('0x3')]),_0x39256e);}};exports['musiconholdstop']=function(_0x5ddd4a){try{if(!_[_0x1637('0x16')](queues[_0x5ddd4a[_0x1637('0x3')]])){if(!_[_0x1637('0x16')](queues[_0x5ddd4a['uniqueid']][_0x1637('0x63')])){utils[_0x1637('0xf')](util[_0x1637('0x2')](_0x1637('0x64'),_0x5ddd4a[_0x1637('0x3')]),_0x5ddd4a);queues[_0x5ddd4a[_0x1637('0x3')]][_0x1637('0x5a')]+=utils[_0x1637('0x36')](utils['now'](),queues[_0x5ddd4a[_0x1637('0x3')]][_0x1637('0x63')]);utils[_0x1637('0x27')](util[_0x1637('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x5ddd4a['uniqueid'],queues[_0x5ddd4a[_0x1637('0x3')]][_0x1637('0x28')],queues[_0x5ddd4a['uniqueid']][_0x1637('0x5a')]));delete queues[_0x5ddd4a['uniqueid']][_0x1637('0x63')];}}}catch(_0x33765c){utils[_0x1637('0x15')](util[_0x1637('0x2')](_0x1637('0x64'),_0x5ddd4a[_0x1637('0x3')]),_0x33765c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 2ac9d3d..e226ddd 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 _0x2da8=['[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','linkedid'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x2da8,0xac));var _0x82da=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2da8[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x82da('0x0'));var util=require(_0x82da('0x1'));var utils=require(_0x82da('0x2'));var recordings={};function writeDB(_0x1fd362){utils[_0x82da('0x3')](util['format'](_0x82da('0x4'),_0x1fd362[_0x82da('0x5')]));if(_0x1fd362[_0x82da('0x6')]){utils['getUserByInternal'](_0x1fd362[_0x82da('0x6')])[_0x82da('0x7')](function(_0x39544a){if(_0x39544a){_0x1fd362[_0x82da('0x8')]=_0x39544a[_0x82da('0x9')];_0x1fd362[_0x82da('0xa')]=_0x39544a['id'];}utils[_0x82da('0xb')](_0x82da('0xc'),_0x1fd362);});}else{utils['request'](_0x82da('0xc'),_0x1fd362);}}exports['newchannel']=function(_0x4d8455){try{utils[_0x82da('0xd')](util[_0x82da('0xe')](_0x82da('0xf'),_0x4d8455['uniqueid']),_0x4d8455);if(_0x4d8455[_0x82da('0x5')]==_0x4d8455[_0x82da('0x10')]){utils[_0x82da('0x3')](util[_0x82da('0xe')](_0x82da('0x11'),_0x4d8455[_0x82da('0x5')],_0x4d8455[_0x82da('0x12')],_0x4d8455[_0x82da('0x13')]));recordings[_0x4d8455[_0x82da('0x5')]]={'uniqueid':_0x4d8455[_0x82da('0x5')],'accountcode':_0x4d8455[_0x82da('0x6')],'exten':_0x4d8455[_0x82da('0x13')],'context':_0x4d8455[_0x82da('0x12')],'channel':_0x4d8455[_0x82da('0x14')],'monitors':[]};}}catch(_0x1576a8){utils[_0x82da('0x15')](util[_0x82da('0xe')](_0x82da('0xf'),_0x4d8455[_0x82da('0x5')]),_0x1576a8);}};exports[_0x82da('0x16')]=function(_0x1e10ed){try{utils[_0x82da('0xd')](util[_0x82da('0xe')](_0x82da('0x17'),_0x1e10ed[_0x82da('0x5')]),_0x1e10ed);if(!_[_0x82da('0x18')](recordings[_0x1e10ed[_0x82da('0x5')]])&&_0x1e10ed['channelstate']==0x6){utils['info'](util[_0x82da('0xe')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x1e10ed['uniqueid'],_0x1e10ed[_0x82da('0x12')],_0x1e10ed[_0x82da('0x14')]));}else if(!_[_0x82da('0x18')](recordings[_0x1e10ed[_0x82da('0x10')]])&&_0x1e10ed[_0x82da('0x19')]==0x6&&_0x1e10ed[_0x82da('0x12')]!=_0x82da('0x1a')){utils[_0x82da('0x3')](util['format'](_0x82da('0x1b'),_0x1e10ed[_0x82da('0x5')],_0x1e10ed[_0x82da('0x10')],_0x1e10ed['context'],_0x1e10ed[_0x82da('0x14')]));recordings[_0x1e10ed[_0x82da('0x10')]][_0x82da('0x6')]=_0x1e10ed['accountcode'];}}catch(_0x45e4c1){utils[_0x82da('0x15')](util['format'](_0x82da('0x17'),_0x1e10ed[_0x82da('0x5')]),_0x45e4c1);}};exports[_0x82da('0x1c')]=function(_0x8732a9){try{if(!_[_0x82da('0x18')](_0x8732a9[_0x82da('0x1d')])&&!_['isNil'](_0x8732a9[_0x82da('0x1d')][_0x82da('0x1e')])){utils[_0x82da('0xd')](util[_0x82da('0xe')](_0x82da('0x1f'),_0x8732a9['uniqueid']),_0x8732a9);utils[_0x82da('0x3')](util['format'](_0x82da('0x20'),_0x8732a9[_0x82da('0x5')],_0x8732a9[_0x82da('0x1d')],_0x8732a9[_0x82da('0x21')]));if(_[_0x82da('0x22')](_0x8732a9[_0x82da('0x21')],_0x82da('0x23'))){_0x8732a9['value']=_0x8732a9[_0x82da('0x21')][_0x82da('0x24')](_0x82da('0x23'),_0x82da('0x25'));}if(recordings[_0x8732a9[_0x82da('0x10')]]){var _0x21b745=_[_0x82da('0x26')](recordings[_0x8732a9[_0x82da('0x10')]][_0x82da('0x27')],{'value':_0x8732a9['value']});if(_[_0x82da('0x18')](_0x21b745)){recordings[_0x8732a9[_0x82da('0x10')]]['monitors']['push']({'value':_0x8732a9['value']});}}}}catch(_0x42c254){utils[_0x82da('0x15')](util['format'](_0x82da('0x1f'),_0x8732a9[_0x82da('0x5')]),_0x42c254);}};exports['hangup']=function(_0x3ddaec){try{if(!_[_0x82da('0x18')](recordings[_0x3ddaec['uniqueid']])){utils[_0x82da('0xd')](util[_0x82da('0xe')]('[%s][recordings][hangup]',_0x3ddaec[_0x82da('0x5')]),_0x3ddaec);utils['info'](util['format'](_0x82da('0x28'),_0x3ddaec[_0x82da('0x5')],_0x3ddaec[_0x82da('0x29')],_0x3ddaec['calleridname'],_0x3ddaec[_0x82da('0x2a')]));recordings[_0x3ddaec['uniqueid']][_0x82da('0x29')]=_0x3ddaec[_0x82da('0x29')];recordings[_0x3ddaec['uniqueid']][_0x82da('0x2b')]=_0x3ddaec[_0x82da('0x2b')];recordings[_0x3ddaec[_0x82da('0x5')]]['connectedlinenum']=_0x3ddaec[_0x82da('0x2c')];recordings[_0x3ddaec[_0x82da('0x5')]]['connectedlinename']=_0x3ddaec[_0x82da('0x2d')];if(recordings[_0x3ddaec['uniqueid']][_0x82da('0x2e')]==_0x82da('0x2f')&&recordings[_0x3ddaec[_0x82da('0x5')]][_0x82da('0x6')]){recordings[_0x3ddaec['uniqueid']][_0x82da('0x2c')]=recordings[_0x3ddaec[_0x82da('0x5')]][_0x82da('0x6')];recordings[_0x3ddaec[_0x82da('0x5')]][_0x82da('0x2d')]='';}recordings[_0x3ddaec[_0x82da('0x5')]]['monitors']['forEach'](function(_0x476535){var _0x39e25d=_['clone'](recordings[_0x3ddaec[_0x82da('0x5')]]);_0x39e25d['value']=_0x476535['value'];writeDB(_0x39e25d);});delete recordings[_0x3ddaec[_0x82da('0x5')]];}}catch(_0xc86dbe){utils['error'](util[_0x82da('0xe')](_0x82da('0x30'),_0x3ddaec[_0x82da('0x5')]),_0xc86dbe);}};exports[_0x82da('0x31')]=function(_0x5298c2){try{if(!_[_0x82da('0x18')](recordings[_0x5298c2[_0x82da('0x5')]])){utils[_0x82da('0xd')](util['format']('[%s][recordings][newexten]',_0x5298c2[_0x82da('0x5')]),_0x5298c2);utils['info'](util['format'](_0x82da('0x32'),_0x5298c2['uniqueid'],_0x5298c2[_0x82da('0x33')],_0x5298c2[_0x82da('0x34')]));if(_0x5298c2['application']['toLowerCase']()=='set'&&_[_0x82da('0x35')](_0x5298c2[_0x82da('0x34')][_0x82da('0x36')](),'cdr')){var _0x34d048=_0x5298c2[_0x82da('0x34')][_0x82da('0x37')]('=');var _0x2dc54e=_0x34d048[0x0][_0x82da('0x38')](_0x34d048[0x0]['lastIndexOf']('(')+0x1,_0x34d048[0x0][_0x82da('0x39')](')'));var _0x5be367=_0x34d048[0x1];recordings[_0x5298c2[_0x82da('0x5')]][_0x2dc54e]=_0x5be367;}}}catch(_0x347f2d){utils[_0x82da('0x15')](util['format'](_0x82da('0x3a'),_0x5298c2[_0x82da('0x5')]),_0x347f2d);}};exports[_0x82da('0x3b')]=function(_0x301317){try{if(!_[_0x82da('0x18')](recordings[_0x301317[_0x82da('0x5')]])){utils[_0x82da('0xd')](util[_0x82da('0xe')](_0x82da('0x3c'),_0x301317[_0x82da('0x5')]),_0x301317);utils[_0x82da('0x3')](util[_0x82da('0xe')](_0x82da('0x3d'),_0x301317[_0x82da('0x5')],_0x301317['queue']));recordings[_0x301317[_0x82da('0x5')]][_0x82da('0x3e')]=_0x301317[_0x82da('0x3e')];}}catch(_0xa2cc9d){utils[_0x82da('0x15')](util[_0x82da('0xe')](_0x82da('0x3c'),_0x301317[_0x82da('0x5')]),_0xa2cc9d);}}; \ No newline at end of file +var _0x5288=['[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','context','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','[%s][recordings][newstate]','isNil'];(function(_0x245772,_0x2c0818){var _0x1a1c3b=function(_0x4087ac){while(--_0x4087ac){_0x245772['push'](_0x245772['shift']());}};_0x1a1c3b(++_0x2c0818);}(_0x5288,0x6a));var _0x8528=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x5288[_0x62c958];return _0x57ec61;};'use strict';var _=require('lodash');var util=require(_0x8528('0x0'));var utils=require(_0x8528('0x1'));var recordings={};function writeDB(_0x434916){utils[_0x8528('0x2')](util[_0x8528('0x3')]('[%s][recordings][writeDB]',_0x434916[_0x8528('0x4')]));if(_0x434916[_0x8528('0x5')]){utils[_0x8528('0x6')](_0x434916[_0x8528('0x5')])[_0x8528('0x7')](function(_0x1845a3){if(_0x1845a3){_0x434916[_0x8528('0x8')]=_0x1845a3[_0x8528('0x9')];_0x434916[_0x8528('0xa')]=_0x1845a3['id'];}utils[_0x8528('0xb')]('CreateVoiceRecording',_0x434916);});}else{utils[_0x8528('0xb')]('CreateVoiceRecording',_0x434916);}}exports['newchannel']=function(_0xad8a35){try{utils[_0x8528('0xc')](util[_0x8528('0x3')]('[%s][recordings][newchannel]',_0xad8a35['uniqueid']),_0xad8a35);if(_0xad8a35[_0x8528('0x4')]==_0xad8a35['linkedid']){utils[_0x8528('0x2')](util[_0x8528('0x3')](_0x8528('0xd'),_0xad8a35['uniqueid'],_0xad8a35['context'],_0xad8a35[_0x8528('0xe')]));recordings[_0xad8a35[_0x8528('0x4')]]={'uniqueid':_0xad8a35[_0x8528('0x4')],'accountcode':_0xad8a35[_0x8528('0x5')],'exten':_0xad8a35['exten'],'context':_0xad8a35['context'],'channel':_0xad8a35[_0x8528('0xf')],'monitors':[]};}}catch(_0x2111df){utils['error'](util[_0x8528('0x3')]('[%s][recordings][newchannel]',_0xad8a35[_0x8528('0x4')]),_0x2111df);}};exports['newstate']=function(_0x217f3d){try{utils[_0x8528('0xc')](util[_0x8528('0x3')](_0x8528('0x10'),_0x217f3d['uniqueid']),_0x217f3d);if(!_[_0x8528('0x11')](recordings[_0x217f3d[_0x8528('0x4')]])&&_0x217f3d['channelstate']==0x6){utils[_0x8528('0x2')](util['format'](_0x8528('0x12'),_0x217f3d[_0x8528('0x4')],_0x217f3d['context'],_0x217f3d[_0x8528('0xf')]));}else if(!_['isNil'](recordings[_0x217f3d[_0x8528('0x13')]])&&_0x217f3d[_0x8528('0x14')]==0x6&&_0x217f3d['context']!=_0x8528('0x15')){utils[_0x8528('0x2')](util[_0x8528('0x3')](_0x8528('0x16'),_0x217f3d[_0x8528('0x4')],_0x217f3d['linkedid'],_0x217f3d[_0x8528('0x17')],_0x217f3d['channel']));recordings[_0x217f3d[_0x8528('0x13')]][_0x8528('0x5')]=_0x217f3d[_0x8528('0x5')];}}catch(_0x21af9d){utils[_0x8528('0x18')](util[_0x8528('0x3')]('[%s][recordings][newstate]',_0x217f3d[_0x8528('0x4')]),_0x21af9d);}};exports[_0x8528('0x19')]=function(_0x1b0b2b){try{if(!_[_0x8528('0x11')](_0x1b0b2b[_0x8528('0x1a')])&&!_[_0x8528('0x11')](_0x1b0b2b[_0x8528('0x1a')][_0x8528('0x1b')])){utils[_0x8528('0xc')](util[_0x8528('0x3')](_0x8528('0x1c'),_0x1b0b2b[_0x8528('0x4')]),_0x1b0b2b);utils[_0x8528('0x2')](util['format'](_0x8528('0x1d'),_0x1b0b2b['uniqueid'],_0x1b0b2b['variable'],_0x1b0b2b[_0x8528('0x1e')]));if(_[_0x8528('0x1f')](_0x1b0b2b['value'],_0x8528('0x20'))){_0x1b0b2b[_0x8528('0x1e')]=_0x1b0b2b['value'][_0x8528('0x21')](_0x8528('0x20'),'.WAV');}if(recordings[_0x1b0b2b[_0x8528('0x13')]]){var _0x2bffd2=_[_0x8528('0x22')](recordings[_0x1b0b2b[_0x8528('0x13')]][_0x8528('0x23')],{'value':_0x1b0b2b[_0x8528('0x1e')]});if(_['isNil'](_0x2bffd2)){recordings[_0x1b0b2b[_0x8528('0x13')]][_0x8528('0x23')][_0x8528('0x24')]({'value':_0x1b0b2b[_0x8528('0x1e')]});}}}}catch(_0x5c9436){utils['error'](util[_0x8528('0x3')](_0x8528('0x1c'),_0x1b0b2b['uniqueid']),_0x5c9436);}};exports[_0x8528('0x25')]=function(_0x3501bb){try{if(!_[_0x8528('0x11')](recordings[_0x3501bb[_0x8528('0x4')]])){utils['debug'](util[_0x8528('0x3')](_0x8528('0x26'),_0x3501bb[_0x8528('0x4')]),_0x3501bb);utils['info'](util[_0x8528('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3501bb[_0x8528('0x4')],_0x3501bb[_0x8528('0x27')],_0x3501bb['calleridname'],_0x3501bb[_0x8528('0x28')]));recordings[_0x3501bb[_0x8528('0x4')]]['calleridnum']=_0x3501bb[_0x8528('0x27')];recordings[_0x3501bb[_0x8528('0x4')]]['calleridname']=_0x3501bb[_0x8528('0x29')];recordings[_0x3501bb[_0x8528('0x4')]][_0x8528('0x2a')]=_0x3501bb[_0x8528('0x2a')];recordings[_0x3501bb[_0x8528('0x4')]][_0x8528('0x2b')]=_0x3501bb['connectedlinename'];if(recordings[_0x3501bb['uniqueid']][_0x8528('0x2c')]==_0x8528('0x2d')&&recordings[_0x3501bb['uniqueid']][_0x8528('0x5')]){recordings[_0x3501bb['uniqueid']][_0x8528('0x2a')]=recordings[_0x3501bb[_0x8528('0x4')]][_0x8528('0x5')];recordings[_0x3501bb['uniqueid']]['connectedlinename']='';}recordings[_0x3501bb[_0x8528('0x4')]][_0x8528('0x23')][_0x8528('0x2e')](function(_0x1c2480){var _0x26324a=_['clone'](recordings[_0x3501bb['uniqueid']]);_0x26324a[_0x8528('0x1e')]=_0x1c2480['value'];writeDB(_0x26324a);});delete recordings[_0x3501bb[_0x8528('0x4')]];}}catch(_0x2b6c57){utils[_0x8528('0x18')](util['format'](_0x8528('0x26'),_0x3501bb[_0x8528('0x4')]),_0x2b6c57);}};exports[_0x8528('0x2f')]=function(_0x3f68ed){try{if(!_['isNil'](recordings[_0x3f68ed[_0x8528('0x4')]])){utils['debug'](util[_0x8528('0x3')](_0x8528('0x30'),_0x3f68ed[_0x8528('0x4')]),_0x3f68ed);utils[_0x8528('0x2')](util[_0x8528('0x3')](_0x8528('0x31'),_0x3f68ed[_0x8528('0x4')],_0x3f68ed['application'],_0x3f68ed[_0x8528('0x32')]));if(_0x3f68ed[_0x8528('0x33')][_0x8528('0x34')]()==_0x8528('0x35')&&_[_0x8528('0x36')](_0x3f68ed[_0x8528('0x32')][_0x8528('0x34')](),_0x8528('0x37'))){var _0x566320=_0x3f68ed['appdata'][_0x8528('0x38')]('=');var _0x29e7cc=_0x566320[0x0]['substring'](_0x566320[0x0][_0x8528('0x39')]('(')+0x1,_0x566320[0x0][_0x8528('0x39')](')'));var _0x29b1c9=_0x566320[0x1];recordings[_0x3f68ed[_0x8528('0x4')]][_0x29e7cc]=_0x29b1c9;}}}catch(_0x399187){utils[_0x8528('0x18')](util[_0x8528('0x3')](_0x8528('0x30'),_0x3f68ed[_0x8528('0x4')]),_0x399187);}};exports[_0x8528('0x3a')]=function(_0x4616c5){try{if(!_['isNil'](recordings[_0x4616c5[_0x8528('0x4')]])){utils['debug'](util[_0x8528('0x3')](_0x8528('0x3b'),_0x4616c5[_0x8528('0x4')]),_0x4616c5);utils[_0x8528('0x2')](util[_0x8528('0x3')](_0x8528('0x3c'),_0x4616c5[_0x8528('0x4')],_0x4616c5[_0x8528('0x3d')]));recordings[_0x4616c5[_0x8528('0x4')]][_0x8528('0x3d')]=_0x4616c5[_0x8528('0x3d')];}}catch(_0x4bd509){utils[_0x8528('0x18')](util[_0x8528('0x3')]('[%s][recordings][queuecallerjoin]',_0x4616c5['uniqueid']),_0x4bd509);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8ab321b..2382729 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 _0x4e12=['[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','blinds','blindtransfer'];(function(_0x47574b,_0x49b324){var _0x55e3dd=function(_0x2d29b5){while(--_0x2d29b5){_0x47574b['push'](_0x47574b['shift']());}};_0x55e3dd(++_0x49b324);}(_0x4e12,0x17c));var _0x24e1=function(_0x3f83e,_0x36d4ee){_0x3f83e=_0x3f83e-0x0;var _0x46f933=_0x4e12[_0x3f83e];return _0x46f933;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x24e1('0x0'));function writeDB(_0x2d727d){utils[_0x24e1('0x1')](util[_0x24e1('0x2')](_0x24e1('0x3'),_0x2d727d[_0x24e1('0x4')]===_0x24e1('0x5')?_0x2d727d[_0x24e1('0x6')]:_0x2d727d[_0x24e1('0x7')],_0x2d727d['type']));utils['request']('CreateVoiceTransferReport',_0x2d727d);}exports[_0x24e1('0x8')]={};exports[_0x24e1('0x9')]=function(_0xcd1e5a){try{utils['debug'](util[_0x24e1('0x2')]('[%s][transfers][blindtransfer]',_0xcd1e5a[_0x24e1('0x7')]),_0xcd1e5a);utils[_0x24e1('0x1')](util[_0x24e1('0x2')](_0x24e1('0xa'),_0xcd1e5a[_0x24e1('0x7')],_0xcd1e5a[_0x24e1('0xb')],_0xcd1e5a[_0x24e1('0xc')],_0xcd1e5a['transfereecalleridnum'],_0xcd1e5a[_0x24e1('0xd')]));_0xcd1e5a[_0x24e1('0x4')]=_0x24e1('0xe');exports['blinds'][_0xcd1e5a[_0x24e1('0xf')]]=_0xcd1e5a;writeDB(_0xcd1e5a);}catch(_0x11e44b){utils[_0x24e1('0x10')](util[_0x24e1('0x2')](_0x24e1('0x11'),_0xcd1e5a[_0x24e1('0x7')]),_0x11e44b);}};exports[_0x24e1('0x12')]=function(_0x13b9e4){try{utils['debug'](util['format'](_0x24e1('0x13'),_0x13b9e4[_0x24e1('0x6')]),_0x13b9e4);utils[_0x24e1('0x1')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x13b9e4[_0x24e1('0x6')],_0x13b9e4['origtransferercalleridnum'],_0x13b9e4['origtransferercalleridname'],_0x13b9e4['transfertargetcalleridnum'],_0x13b9e4[_0x24e1('0x14')]));_0x13b9e4=_[_0x24e1('0x15')](_0x13b9e4,{'transfererchannel':_0x13b9e4[_0x24e1('0x16')],'transferercalleridnum':_0x13b9e4[_0x24e1('0x17')],'transferercalleridname':_0x13b9e4[_0x24e1('0x18')],'transfererconnectedlinenum':_0x13b9e4[_0x24e1('0x19')],'transfererconnectedlinename':_0x13b9e4[_0x24e1('0x1a')],'transfereraccountcode':_0x13b9e4['origtransfereraccountcode'],'transferercontext':_0x13b9e4[_0x24e1('0x1b')],'transfererexten':_0x13b9e4['secondtransfererexten'],'transfererlinkedid':_0x13b9e4[_0x24e1('0x1c')],'context':_0x13b9e4[_0x24e1('0x1d')],'extension':_0x13b9e4['origtransfererexten'],'type':_0x24e1('0x5')});if(_[_0x24e1('0x1e')](_0x13b9e4[_0x24e1('0x1f')])){_0x13b9e4=_[_0x24e1('0x15')](_0x13b9e4,{'transfereechannel':_0x13b9e4[_0x24e1('0x20')],'transfereecalleridnum':_0x13b9e4['transfertargetcalleridnum'],'transfereecalleridname':_0x13b9e4[_0x24e1('0x14')],'transfereeconnectedlinenum':_0x13b9e4[_0x24e1('0x21')],'transfereeconnectedlinename':_0x13b9e4[_0x24e1('0x22')],'transfereeaccountcode':_0x13b9e4[_0x24e1('0x23')],'transfereecontext':_0x13b9e4[_0x24e1('0x24')],'transfereeexten':_0x13b9e4[_0x24e1('0x25')],'transfereelinkedid':_0x13b9e4[_0x24e1('0x26')]});}writeDB(_0x13b9e4);}catch(_0x4ef667){utils['error'](util[_0x24e1('0x2')](_0x24e1('0x13'),_0x13b9e4[_0x24e1('0x6')]),_0x4ef667);}}; \ No newline at end of file +var _0x7127=['attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','info','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransfererexten'];(function(_0x1d3861,_0x5680bc){var _0x4ce942=function(_0x55a635){while(--_0x55a635){_0x1d3861['push'](_0x1d3861['shift']());}};_0x4ce942(++_0x5680bc);}(_0x7127,0x82));var _0x7712=function(_0x45abb0,_0x46bcfc){_0x45abb0=_0x45abb0-0x0;var _0x553de2=_0x7127[_0x45abb0];return _0x553de2;};'use strict';var _=require(_0x7712('0x0'));var util=require(_0x7712('0x1'));var utils=require(_0x7712('0x2'));function writeDB(_0xce6694){utils['info'](util[_0x7712('0x3')](_0x7712('0x4'),_0xce6694[_0x7712('0x5')]==='attended'?_0xce6694[_0x7712('0x6')]:_0xce6694[_0x7712('0x7')],_0xce6694['type']));utils['request'](_0x7712('0x8'),_0xce6694);}exports[_0x7712('0x9')]={};exports[_0x7712('0xa')]=function(_0x32e6e3){try{utils[_0x7712('0xb')](util[_0x7712('0x3')](_0x7712('0xc'),_0x32e6e3[_0x7712('0x7')]),_0x32e6e3);utils[_0x7712('0xd')](util[_0x7712('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x32e6e3[_0x7712('0x7')],_0x32e6e3[_0x7712('0xe')],_0x32e6e3[_0x7712('0xf')],_0x32e6e3[_0x7712('0x10')],_0x32e6e3[_0x7712('0x11')]));_0x32e6e3['type']=_0x7712('0x12');exports[_0x7712('0x9')][_0x32e6e3[_0x7712('0x13')]]=_0x32e6e3;writeDB(_0x32e6e3);}catch(_0xb67c9e){utils[_0x7712('0x14')](util[_0x7712('0x3')](_0x7712('0xc'),_0x32e6e3[_0x7712('0x7')]),_0xb67c9e);}};exports[_0x7712('0x15')]=function(_0x5ba6e1){try{utils[_0x7712('0xb')](util['format'](_0x7712('0x16'),_0x5ba6e1[_0x7712('0x6')]),_0x5ba6e1);utils[_0x7712('0xd')](util[_0x7712('0x3')](_0x7712('0x17'),_0x5ba6e1[_0x7712('0x6')],_0x5ba6e1[_0x7712('0x18')],_0x5ba6e1[_0x7712('0x19')],_0x5ba6e1[_0x7712('0x1a')],_0x5ba6e1[_0x7712('0x1b')]));_0x5ba6e1=_[_0x7712('0x1c')](_0x5ba6e1,{'transfererchannel':_0x5ba6e1[_0x7712('0x1d')],'transferercalleridnum':_0x5ba6e1[_0x7712('0x18')],'transferercalleridname':_0x5ba6e1[_0x7712('0x19')],'transfererconnectedlinenum':_0x5ba6e1['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5ba6e1[_0x7712('0x1e')],'transfereraccountcode':_0x5ba6e1['origtransfereraccountcode'],'transferercontext':_0x5ba6e1[_0x7712('0x1f')],'transfererexten':_0x5ba6e1['secondtransfererexten'],'transfererlinkedid':_0x5ba6e1[_0x7712('0x20')],'context':_0x5ba6e1['origtransferercontext'],'extension':_0x5ba6e1[_0x7712('0x21')],'type':_0x7712('0x22')});if(_[_0x7712('0x23')](_0x5ba6e1[_0x7712('0x24')])){_0x5ba6e1=_[_0x7712('0x1c')](_0x5ba6e1,{'transfereechannel':_0x5ba6e1[_0x7712('0x25')],'transfereecalleridnum':_0x5ba6e1['transfertargetcalleridnum'],'transfereecalleridname':_0x5ba6e1[_0x7712('0x1b')],'transfereeconnectedlinenum':_0x5ba6e1[_0x7712('0x26')],'transfereeconnectedlinename':_0x5ba6e1['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5ba6e1[_0x7712('0x27')],'transfereecontext':_0x5ba6e1['transfertargetcontext'],'transfereeexten':_0x5ba6e1[_0x7712('0x28')],'transfereelinkedid':_0x5ba6e1['transfertargetlinkedid']});}writeDB(_0x5ba6e1);}catch(_0x4076c1){utils[_0x7712('0x14')](util[_0x7712('0x3')](_0x7712('0x16'),_0x5ba6e1[_0x7712('0x6')]),_0x4076c1);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c5fcd42..f193702 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 _0x24d7=['notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','isBefore','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','name','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found'];(function(_0x5a12a5,_0x231380){var _0x448554=function(_0x1d029b){while(--_0x1d029b){_0x5a12a5['push'](_0x5a12a5['shift']());}};_0x448554(++_0x231380);}(_0x24d7,0xb3));var _0x724d=function(_0x44481e,_0x5af4e8){_0x44481e=_0x44481e-0x0;var _0x570394=_0x24d7[_0x44481e];return _0x570394;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x724d('0x0'));var util=require(_0x724d('0x1'));var client=jayson[_0x724d('0x2')][_0x724d('0x3')]({'port':0x2329});var logger=require(_0x724d('0x4'))(_0x724d('0x5'));exports[_0x724d('0x6')]=function(_0x5a98ea,_0x3eb985){logger[_0x724d('0x6')](_0x5a98ea,_0x3eb985?util[_0x724d('0x7')](_0x3eb985,{'showHidden':![],'depth':null}):'');};exports[_0x724d('0x8')]=function(_0x6a5534,_0x443938){logger[_0x724d('0x8')](_0x6a5534,_0x443938?util[_0x724d('0x7')](_0x443938,{'showHidden':![],'depth':null}):'');};exports[_0x724d('0x9')]=function(_0x530351,_0x4fd26e){logger['error'](_0x530351,_0x4fd26e?util[_0x724d('0x7')](_0x4fd26e,{'showHidden':![],'depth':null}):'');};exports[_0x724d('0xa')]=function(_0xc14c9f,_0x2ab536){return client[_0x724d('0xa')](_0xc14c9f,{'body':_0x2ab536})[_0x724d('0xb')](function(_0x33a588){logger[_0x724d('0x8')](_0x724d('0xc'),_0xc14c9f,_0x33a588?util[_0x724d('0x7')](_0x33a588,{'showHidden':![],'depth':null}):'');})[_0x724d('0xd')](function(_0x52c3b6){logger[_0x724d('0x9')]('[utils][request]\x20name:%s',_0xc14c9f,_0x52c3b6?util['inspect'](_0x52c3b6,{'showHidden':![],'depth':null}):'');});};function getUser(_0x275bc4){return client[_0x724d('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x724d('0xe'),_0x724d('0xf'),'interface'],'where':_0x275bc4,'limit':0x1}})[_0x724d('0xb')](function(_0x112469){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0x724d('0x10')](_0x275bc4),_0x112469?util[_0x724d('0x7')](_0x112469,{'showHidden':![],'depth':null}):'');return _0x112469[_0x724d('0x11')]['length']?_0x112469[_0x724d('0x11')][0x0]:null;});}exports[_0x724d('0x12')]=function(_0x2b0c97){return new BPromise(function(_0x26b6e8,_0x5d4351){if(_0x2b0c97){return getUser({'internal':_0x2b0c97})['then'](function(_0x55d6b1){logger[_0x724d('0x6')](_0x724d('0x13'),_0x2b0c97,_0x55d6b1?_0x724d('0x14'):_0x724d('0x15'));return _0x26b6e8(_0x55d6b1);})[_0x724d('0xd')](function(_0x7a074f){logger[_0x724d('0x9')](_0x724d('0x16'),_0x7a074f?util[_0x724d('0x7')](_0x7a074f,{'showHidden':![],'depth':null}):'');return _0x26b6e8(null);});}return _0x26b6e8(null);});};exports[_0x724d('0x17')]=function(_0x39bc27){return new BPromise(function(_0x2373e2,_0x2d14ae){if(_0x39bc27){return getUser({'interface':_0x39bc27})[_0x724d('0xb')](function(_0x7cec78){logger[_0x724d('0x6')](_0x724d('0x18'),_0x39bc27,_0x7cec78?_0x724d('0x14'):'notfound');return _0x2373e2(_0x7cec78);})[_0x724d('0xd')](function(_0x49bbba){logger['error']('[utils][getUserByInterface]',_0x49bbba?util[_0x724d('0x7')](_0x49bbba,{'showHidden':![],'depth':null}):'');return _0x2373e2(null);});}return _0x2373e2(null);});};exports[_0x724d('0x19')]=function(_0x17c65c){return new BPromise(function(_0x1b1999,_0x28c321){if(_0x17c65c){return getUser({'name':_0x17c65c})[_0x724d('0xb')](function(_0x30e07c){logger[_0x724d('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x17c65c,_0x30e07c?_0x724d('0x14'):_0x724d('0x15'));return _0x1b1999(_0x30e07c);})[_0x724d('0xd')](function(_0x3604a7){logger[_0x724d('0x9')](_0x724d('0x1a'),_0x3604a7?util[_0x724d('0x7')](_0x3604a7,{'showHidden':![],'depth':null}):'');return _0x1b1999(null);});}return _0x1b1999(null);});};exports[_0x724d('0x1b')]=function(_0x2362e9){return new BPromise(function(_0x1d4258,_0x4b3aa4){if(_0x2362e9){return client[_0x724d('0xa')](_0x724d('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x724d('0xf'),'type',_0x724d('0x1d'),'acwTimeout'],'where':{'name':_0x2362e9},'limit':0x1}})['then'](function(_0x1a82eb){logger[_0x724d('0x8')](_0x724d('0x1e'),_0x2362e9,_0x1a82eb?util[_0x724d('0x7')](_0x1a82eb,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x2362e9,_0x1a82eb?_0x724d('0x14'):_0x724d('0x15'));return _0x1d4258(_0x1a82eb[_0x724d('0x11')]['length']?_0x1a82eb[_0x724d('0x11')][0x0]:null);})[_0x724d('0xd')](function(_0xc6df65){logger['error'](_0x724d('0x1f'),_0xc6df65?util[_0x724d('0x7')](_0xc6df65,{'showHidden':![],'depth':null}):'');return _0x1d4258(null);});}return _0x1d4258(null);});};exports[_0x724d('0x20')]=function(_0x1e4c73,_0x1894cf){return moment(_0x1e4c73)['add'](_0x1894cf,_0x724d('0x21'))[_0x724d('0x22')](_0x724d('0x23'));};exports[_0x724d('0x24')]=function(_0x519ab6,_0x2f9585){return moment(_0x519ab6)['subtract'](_0x2f9585,_0x724d('0x21'))[_0x724d('0x22')](_0x724d('0x23'));};exports[_0x724d('0x25')]=function(_0x29f886,_0x34e533){return moment(_0x29f886)[_0x724d('0x26')](moment(_0x34e533),'seconds');};exports['sumTime']=function(_0x42021d,_0x39f83d){return parseInt(_0x42021d,0xa)+parseInt(_0x39f83d,0xa);};exports['now']=function(){return moment()[_0x724d('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0xebb0d4,_0x358efc){if(_0x358efc){return moment(_0xebb0d4)['isAfter'](_0x358efc);}return!![];};exports[_0x724d('0x27')]=function(_0x5d17db,_0x505fd1){if(_0x505fd1){return moment(_0x5d17db)['isBefore'](_0x505fd1);}else if(_0x5d17db){return!![];}return![];}; \ No newline at end of file +var _0xfa75=['request','[utils][request]\x20name:%s','GetUser','internal','name','interface','then','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','subtractTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error'];(function(_0x251ff4,_0x340fbf){var _0x5f1afd=function(_0xdb0a32){while(--_0xdb0a32){_0x251ff4['push'](_0x251ff4['shift']());}};_0x5f1afd(++_0x340fbf);}(_0xfa75,0x1ef));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x5fa7('0x0'));var jayson=require(_0x5fa7('0x1'));var moment=require(_0x5fa7('0x2'));var util=require('util');var client=jayson[_0x5fa7('0x3')][_0x5fa7('0x4')]({'port':0x2329});var logger=require(_0x5fa7('0x5'))(_0x5fa7('0x6'));exports['info']=function(_0x6a44ff,_0xd10f54){logger[_0x5fa7('0x7')](_0x6a44ff,_0xd10f54?util[_0x5fa7('0x8')](_0xd10f54,{'showHidden':![],'depth':null}):'');};exports[_0x5fa7('0x9')]=function(_0x548e4e,_0x317893){logger['debug'](_0x548e4e,_0x317893?util[_0x5fa7('0x8')](_0x317893,{'showHidden':![],'depth':null}):'');};exports[_0x5fa7('0xa')]=function(_0x2d5024,_0x27492d){logger[_0x5fa7('0xa')](_0x2d5024,_0x27492d?util['inspect'](_0x27492d,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3be490,_0x4da680){return client[_0x5fa7('0xb')](_0x3be490,{'body':_0x4da680})['then'](function(_0x36a70f){logger['debug'](_0x5fa7('0xc'),_0x3be490,_0x36a70f?util[_0x5fa7('0x8')](_0x36a70f,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1d6b5a){logger[_0x5fa7('0xa')](_0x5fa7('0xc'),_0x3be490,_0x1d6b5a?util[_0x5fa7('0x8')](_0x1d6b5a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1287f5){return client[_0x5fa7('0xb')](_0x5fa7('0xd'),{'options':{'raw':!![],'attributes':['id',_0x5fa7('0xe'),_0x5fa7('0xf'),_0x5fa7('0x10')],'where':_0x1287f5,'limit':0x1}})[_0x5fa7('0x11')](function(_0x139941){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0x5fa7('0x12')](_0x1287f5),_0x139941?util[_0x5fa7('0x8')](_0x139941,{'showHidden':![],'depth':null}):'');return _0x139941[_0x5fa7('0x13')][_0x5fa7('0x14')]?_0x139941['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x1669b1){return new BPromise(function(_0x38da63,_0x212f13){if(_0x1669b1){return getUser({'internal':_0x1669b1})['then'](function(_0xdbc522){logger[_0x5fa7('0x7')](_0x5fa7('0x15'),_0x1669b1,_0xdbc522?'found':_0x5fa7('0x16'));return _0x38da63(_0xdbc522);})[_0x5fa7('0x17')](function(_0x3a3cce){logger['error']('[utils][getUserByInternal]',_0x3a3cce?util[_0x5fa7('0x8')](_0x3a3cce,{'showHidden':![],'depth':null}):'');return _0x38da63(null);});}return _0x38da63(null);});};exports[_0x5fa7('0x18')]=function(_0x3ae4c1){return new BPromise(function(_0xf58234,_0x1b47ae){if(_0x3ae4c1){return getUser({'interface':_0x3ae4c1})['then'](function(_0x58c402){logger[_0x5fa7('0x7')](_0x5fa7('0x19'),_0x3ae4c1,_0x58c402?_0x5fa7('0x1a'):_0x5fa7('0x16'));return _0xf58234(_0x58c402);})[_0x5fa7('0x17')](function(_0x551f58){logger['error'](_0x5fa7('0x1b'),_0x551f58?util[_0x5fa7('0x8')](_0x551f58,{'showHidden':![],'depth':null}):'');return _0xf58234(null);});}return _0xf58234(null);});};exports[_0x5fa7('0x1c')]=function(_0x58fc8a){return new BPromise(function(_0x52f35,_0x4a377f){if(_0x58fc8a){return getUser({'name':_0x58fc8a})[_0x5fa7('0x11')](function(_0x14203b){logger[_0x5fa7('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x58fc8a,_0x14203b?_0x5fa7('0x1a'):_0x5fa7('0x16'));return _0x52f35(_0x14203b);})[_0x5fa7('0x17')](function(_0x15111e){logger[_0x5fa7('0xa')]('[utils][getUserByName]',_0x15111e?util[_0x5fa7('0x8')](_0x15111e,{'showHidden':![],'depth':null}):'');return _0x52f35(null);});}return _0x52f35(null);});};exports['getVoiceQueueByName']=function(_0x2bac5e){return new BPromise(function(_0x31d7c9,_0x1b1157){if(_0x2bac5e){return client[_0x5fa7('0xb')](_0x5fa7('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x5fa7('0xf'),_0x5fa7('0x1e'),_0x5fa7('0x1f'),_0x5fa7('0x20')],'where':{'name':_0x2bac5e},'limit':0x1}})[_0x5fa7('0x11')](function(_0x11df17){logger[_0x5fa7('0x9')](_0x5fa7('0x21'),_0x2bac5e,_0x11df17?util['inspect'](_0x11df17,{'showHidden':![],'depth':null}):'');logger[_0x5fa7('0x7')](_0x5fa7('0x22'),_0x2bac5e,_0x11df17?'found':_0x5fa7('0x16'));return _0x31d7c9(_0x11df17[_0x5fa7('0x13')]['length']?_0x11df17[_0x5fa7('0x13')][0x0]:null);})[_0x5fa7('0x17')](function(_0x24a492){logger[_0x5fa7('0xa')](_0x5fa7('0x23'),_0x24a492?util[_0x5fa7('0x8')](_0x24a492,{'showHidden':![],'depth':null}):'');return _0x31d7c9(null);});}return _0x31d7c9(null);});};exports[_0x5fa7('0x24')]=function(_0x14bfca,_0x553073){return moment(_0x14bfca)[_0x5fa7('0x25')](_0x553073,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5fa7('0x26')]=function(_0x5d180f,_0x5e63c8){return moment(_0x5d180f)['subtract'](_0x5e63c8,_0x5fa7('0x27'))[_0x5fa7('0x28')](_0x5fa7('0x29'));};exports['diffTime']=function(_0x2ebbf8,_0x3aec54){return moment(_0x2ebbf8)[_0x5fa7('0x2a')](moment(_0x3aec54),_0x5fa7('0x27'));};exports['sumTime']=function(_0x3b8e87,_0x2bbe24){return parseInt(_0x3b8e87,0xa)+parseInt(_0x2bbe24,0xa);};exports[_0x5fa7('0x2b')]=function(){return moment()['format'](_0x5fa7('0x29'));};exports[_0x5fa7('0x2c')]=function(_0x561a42,_0x5805bc){if(_0x5805bc){return moment(_0x561a42)[_0x5fa7('0x2c')](_0x5805bc);}return!![];};exports[_0x5fa7('0x2d')]=function(_0x3a18e5,_0x377ea4){if(_0x377ea4){return moment(_0x3a18e5)[_0x5fa7('0x2d')](_0x377ea4);}else if(_0x3a18e5){return!![];}return![];}; \ No newline at end of file -- 1.7.1